From 77530eea0bf0562cb8afe8dafe67be53bb62e6c9 Mon Sep 17 00:00:00 2001 From: Jinwei Chen Date: Thu, 20 Jan 2022 02:27:41 -0800 Subject: [PATCH] qcacmn: support PLD lock for window register accessing Currently window register accessing with PLD lock is not enabled for HIF path of KIWI, enable it so there is no race condition with HAL register accessing path. Change-Id: Iceeba36ca6febdeca0e7f7bc0dcb7d4adc17bc51 CRs-Fixed: 3110425 --- hal/wifi3.0/hal_api.h | 29 ++++++++++++++--------------- hif/src/hif_io32.h | 12 ++++++------ 2 files changed, 20 insertions(+), 21 deletions(-) diff --git a/hal/wifi3.0/hal_api.h b/hal/wifi3.0/hal_api.h index 907f62934b..15683781bb 100644 --- a/hal/wifi3.0/hal_api.h +++ b/hal/wifi3.0/hal_api.h @@ -1,6 +1,6 @@ /* * Copyright (c) 2016-2021 The Linux Foundation. All rights reserved. - * Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved. + * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -129,20 +129,7 @@ static inline void hal_reg_write_result_check(struct hal_soc *hal_soc, } } -#if !defined(QCA_WIFI_QCA6390) && !defined(QCA_WIFI_QCA6490) && \ - !defined(QCA_WIFI_KIWI) -static inline void hal_lock_reg_access(struct hal_soc *soc, - unsigned long *flags) -{ - qdf_spin_lock_irqsave(&soc->register_access_lock); -} - -static inline void hal_unlock_reg_access(struct hal_soc *soc, - unsigned long *flags) -{ - qdf_spin_unlock_irqrestore(&soc->register_access_lock); -} -#else +#ifdef WINDOW_REG_PLD_LOCK_ENABLE static inline void hal_lock_reg_access(struct hal_soc *soc, unsigned long *flags) { @@ -154,6 +141,18 @@ static inline void hal_unlock_reg_access(struct hal_soc *soc, { pld_unlock_reg_window(soc->qdf_dev->dev, flags); } +#else +static inline void hal_lock_reg_access(struct hal_soc *soc, + unsigned long *flags) +{ + qdf_spin_lock_irqsave(&soc->register_access_lock); +} + +static inline void hal_unlock_reg_access(struct hal_soc *soc, + unsigned long *flags) +{ + qdf_spin_unlock_irqrestore(&soc->register_access_lock); +} #endif #ifdef PCIE_REG_WINDOW_LOCAL_NO_CACHE diff --git a/hif/src/hif_io32.h b/hif/src/hif_io32.h index 6cd3b1b146..cb62e72957 100644 --- a/hif/src/hif_io32.h +++ b/hif/src/hif_io32.h @@ -1,6 +1,6 @@ /* * Copyright (c) 2015-2021 The Linux Foundation. All rights reserved. - * Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved. + * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -207,7 +207,7 @@ void hif_select_window_confirm(struct hif_pci_softc *sc, uint32_t offset) } #endif /* PCIE_REG_WINDOW_LOCAL_NO_CACHE */ -#if !defined(QCA_WIFI_QCA6390) && !defined(QCA_WIFI_QCA6490) +#ifdef WINDOW_REG_PLD_LOCK_ENABLE /** * hif_lock_reg_access() - Lock window register access spinlock * @sc: HIF handle @@ -220,7 +220,7 @@ void hif_select_window_confirm(struct hif_pci_softc *sc, uint32_t offset) static inline void hif_lock_reg_access(struct hif_pci_softc *sc, unsigned long *flags) { - qdf_spin_lock_irqsave(&sc->register_access_lock); + pld_lock_reg_window(sc->dev, flags); } /** @@ -235,19 +235,19 @@ static inline void hif_lock_reg_access(struct hif_pci_softc *sc, static inline void hif_unlock_reg_access(struct hif_pci_softc *sc, unsigned long *flags) { - qdf_spin_unlock_irqrestore(&sc->register_access_lock); + pld_unlock_reg_window(sc->dev, flags); } #else static inline void hif_lock_reg_access(struct hif_pci_softc *sc, unsigned long *flags) { - pld_lock_reg_window(sc->dev, flags); + qdf_spin_lock_irqsave(&sc->register_access_lock); } static inline void hif_unlock_reg_access(struct hif_pci_softc *sc, unsigned long *flags) { - pld_unlock_reg_window(sc->dev, flags); + qdf_spin_unlock_irqrestore(&sc->register_access_lock); } #endif