Skip to content

Commit f5a7ac1

Browse files
ij-intelbjorn-helgaas
authored andcommitted
wifi: ath12k: Use RMW accessors for changing LNKCTL
Don't assume that only the driver would be accessing LNKCTL. ASPM policy changes can trigger write to LNKCTL outside of driver's control. Use RMW capability accessors which do proper locking to avoid losing concurrent updates to the register value. On restore, clear the ASPMC field properly. Suggested-by: Lukas Wunner <lukas@wunner.de> Fixes: d889913 ("wifi: ath12k: driver for Qualcomm Wi-Fi 7 devices") Link: https://lore.kernel.org/r/20230717120503.15276-10-ilpo.jarvinen@linux.intel.com Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Reviewed-by: Simon Horman <simon.horman@corigine.com> Acked-by: Kalle Valo <kvalo@kernel.org>
1 parent 6c1b6bd commit f5a7ac1

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

  • drivers/net/wireless/ath/ath12k

drivers/net/wireless/ath/ath12k/pci.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -794,17 +794,19 @@ static void ath12k_pci_aspm_disable(struct ath12k_pci *ab_pci)
794794
u16_get_bits(ab_pci->link_ctl, PCI_EXP_LNKCTL_ASPM_L1));
795795

796796
/* disable L0s and L1 */
797-
pcie_capability_write_word(ab_pci->pdev, PCI_EXP_LNKCTL,
798-
ab_pci->link_ctl & ~PCI_EXP_LNKCTL_ASPMC);
797+
pcie_capability_clear_word(ab_pci->pdev, PCI_EXP_LNKCTL,
798+
PCI_EXP_LNKCTL_ASPMC);
799799

800800
set_bit(ATH12K_PCI_ASPM_RESTORE, &ab_pci->flags);
801801
}
802802

803803
static void ath12k_pci_aspm_restore(struct ath12k_pci *ab_pci)
804804
{
805805
if (test_and_clear_bit(ATH12K_PCI_ASPM_RESTORE, &ab_pci->flags))
806-
pcie_capability_write_word(ab_pci->pdev, PCI_EXP_LNKCTL,
807-
ab_pci->link_ctl);
806+
pcie_capability_clear_and_set_word(ab_pci->pdev, PCI_EXP_LNKCTL,
807+
PCI_EXP_LNKCTL_ASPMC,
808+
ab_pci->link_ctl &
809+
PCI_EXP_LNKCTL_ASPMC);
808810
}
809811

810812
static void ath12k_pci_kill_tasklets(struct ath12k_base *ab)

0 commit comments

Comments
 (0)