From: sashiko-bot@kernel.org
To: "Manivannan Sadhasivam" <mani@kernel.org>
Cc: linux-pci@vger.kernel.org
Subject: Re: [PATCH v3 6/8] wifi: ath12k: Use pci_{enable/disable}_link_state() APIs to enable/disable ASPM states
Date: Wed, 08 Jul 2026 14:49:03 +0000 [thread overview]
Message-ID: <20260708144904.0CC4F1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260708-pci-aspm-fix-v3-6-6bd72451746e@kernel.org>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
New issues:
- [Medium] Adding `depends on PCIEASPM` unnecessarily restricts the driver from being built on kernels where ASPM control is disabled.
Pre-existing issues:
- [High] ASPM state is permanently lost (leaked as disabled) if initialization fails before `ath12k_pci_start()`.
--
--- Patch [6]: [PATCH v3 6/8] wifi: ath12k: Use pci_{enable/disable}_link_state() APIs to enable/disable ASPM states ---
commit 6aeb96e7a1d3a96df659d6e1d629f287d946f802
Author: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
wifi: ath12k: Use pci_{enable/disable}_link_state() APIs to enable/disable ASPM states
This commit changes the ath12k driver to use the PCI core's
pci_disable_link_state() and pci_force_enable_link_state() APIs for managing
ASPM states instead of directly modifying the LNKCTL register. It also adds a
Kconfig dependency on PCIEASPM.
> diff --git a/drivers/net/wireless/ath/ath12k/Kconfig b/drivers/net/wireless/ath/ath12k/Kconfig
> index 4a2b240f967af..7852ede3eaea8 100644
> --- a/drivers/net/wireless/ath/ath12k/Kconfig
> +++ b/drivers/net/wireless/ath/ath12k/Kconfig
> @@ -1,7 +1,7 @@
> # SPDX-License-Identifier: BSD-3-Clause-Clear
> config ATH12K
> tristate "Qualcomm Wi-Fi 7 support (ath12k)"
> - depends on MAC80211 && HAS_DMA && PCI
> + depends on MAC80211 && HAS_DMA && PCI && PCIEASPM
[Severity: Medium]
Is the PCIEASPM dependency necessary here?
The PCI subsystem provides static inline no-ops for pci_disable_link_state(),
pcie_aspm_enabled(), and pci_force_enable_link_state() in linux/pci.h when
CONFIG_PCIEASPM is not set. Adding this strict dependency restricts the
driver from being built on kernels where ASPM control is intentionally
disabled.
> select QCOM_QMI_HELPERS
> select MHI_BUS
> select QRTR
[ ... ]
> diff --git a/drivers/net/wireless/ath/ath12k/pci.c b/drivers/net/wireless/ath/ath12k/pci.c
> index d9a22d6afbb02..6d48fb25690de 100644
> --- a/drivers/net/wireless/ath/ath12k/pci.c
> +++ b/drivers/net/wireless/ath/ath12k/pci.c
> @@ -884,19 +884,9 @@ static void ath12k_pci_free_region(struct ath12k_pci *ab_pci)
>
> static void ath12k_pci_aspm_disable(struct ath12k_pci *ab_pci)
> {
> - struct ath12k_base *ab = ab_pci->ab;
> -
> - pcie_capability_read_word(ab_pci->pdev, PCI_EXP_LNKCTL,
> - &ab_pci->link_ctl);
> -
> - ath12k_dbg(ab, ATH12K_DBG_PCI, "pci link_ctl 0x%04x L0s %d L1 %d\n",
> - ab_pci->link_ctl,
> - u16_get_bits(ab_pci->link_ctl, PCI_EXP_LNKCTL_ASPM_L0S),
> - u16_get_bits(ab_pci->link_ctl, PCI_EXP_LNKCTL_ASPM_L1));
> + ab_pci->aspm_states = pcie_aspm_enabled(ab_pci->pdev);
[Severity: High]
This is a pre-existing issue, but does this logic permanently lose the ASPM
state if initialization fails before ath12k_pci_start()?
If ath12k_mhi_start() fails in ath12k_pci_power_up(), the initialization
is aborted. The current ASPM state is unconditionally saved to
ab_pci->aspm_states here and then disabled. On failure,
ath12k_pci_power_down() is called to clean up, but it returns early if
ATH12K_PCI_FLAG_INIT_DONE is not set:
drivers/net/wireless/ath/ath12k/pci.c:ath12k_pci_power_down() {
if (!test_bit(ATH12K_PCI_FLAG_INIT_DONE, &ab_pci->flags))
return;
/* restore aspm in case firmware bootup fails */
ath12k_pci_aspm_restore(ab_pci);
...
}
This early return skips the restore and leaves ASPM disabled. When the
device is later retried, ath12k_pci_power_up() is called again, overwriting
ab_pci->aspm_states with the now-disabled state (0). When initialization
finally succeeds, it restores 0, permanently disabling ASPM.
>
> - /* disable L0s and L1 */
> - pcie_capability_clear_word(ab_pci->pdev, PCI_EXP_LNKCTL,
> - PCI_EXP_LNKCTL_ASPMC);
> + pci_disable_link_state(ab_pci->pdev, PCIE_LINK_STATE_ASPM_ALL);
>
> set_bit(ATH12K_PCI_ASPM_RESTORE, &ab_pci->flags);
> }
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260708-pci-aspm-fix-v3-0-6bd72451746e@kernel.org?part=6
next prev parent reply other threads:[~2026-07-08 14:49 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-08 14:30 [PATCH v3 0/8] PCI/ASPM: Add pci_force_enable_link_state() API and convert Atheros drivers Manivannan Sadhasivam
2026-07-08 14:30 ` [PATCH v3 1/8] PCI/ASPM: Always disable ASPM when driver requests it Manivannan Sadhasivam
2026-07-08 14:44 ` sashiko-bot
2026-07-08 14:30 ` [PATCH v3 2/8] PCI/ASPM: Add pci_force_enable_link_state() API Manivannan Sadhasivam
2026-07-08 14:44 ` sashiko-bot
2026-07-08 14:30 ` [PATCH v3 3/8] PCI/ASPM: Transition the device to D0 (if required) when enabling ASPM link states Manivannan Sadhasivam
2026-07-08 14:50 ` sashiko-bot
2026-07-08 14:30 ` [PATCH v3 4/8] PCI/ASPM: Improve the kernel-doc for pci_{enable,disable}_link_state*() APIs Manivannan Sadhasivam
2026-07-08 14:37 ` sashiko-bot
2026-07-08 14:30 ` [PATCH v3 5/8] PCI/ASPM: Return enabled ASPM states from pcie_aspm_enabled() API Manivannan Sadhasivam
2026-07-08 14:36 ` sashiko-bot
2026-07-08 14:30 ` [PATCH v3 6/8] wifi: ath12k: Use pci_{enable/disable}_link_state() APIs to enable/disable ASPM states Manivannan Sadhasivam
2026-07-08 14:49 ` sashiko-bot [this message]
2026-07-10 20:25 ` Bjorn Helgaas
2026-07-08 14:30 ` [PATCH v3 7/8] wifi: ath11k: " Manivannan Sadhasivam
2026-07-08 14:47 ` sashiko-bot
2026-07-08 14:30 ` [PATCH v3 8/8] wifi: ath10k: " Manivannan Sadhasivam
2026-07-08 14:51 ` sashiko-bot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260708144904.0CC4F1F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=mani@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox