PCI/ASPM: Mask ASPM states based on Devicetree properties
PATCH v5 1/1 PCI/ASPM: Mask ASPM states based on Devicetree properties
Some platforms require selectively disabling specific ASPM states on a given PCIe link to avoid link instability or functional failures caused by board-level connectivity constraints such as PCB routing, connectors, slots, or external cabling.
Devicetree supports disabling ASPM L0s, L1, and L1 PM Substates via the 'aspm-no-l0s', 'aspm-no-l1' [1], and 'aspm-no-l1ss' [2] properties. However, the ASPM driver does not currently honor these properties when initializing the default link state.
When firmware enables L1 PM Substates before the kernel takes over, masking aspm_support alone is insufficient to disable them in hardware. pcie_config_aspm_link() guards L1SS configuration behind a check on aspm_capable, which is derived from aspm_support. Once aspm_support is masked, pcie_config_aspm_l1ss() is never called, leaving firmware-enabled L1SS substates active in hardware.
Fix this by introducing pcie_link_has_aspm_override() to check for DT override properties on either endpoint of the link. In pcie_aspm_override_default_link_state(), use it to:
- Mask aspm_support, aspm_default, and aspm_enabled for any disabled state, so software's view of the link stays in sync with what is actually programmed in hardware. Leaving aspm_enabled stale would make pcie_aspm_enabled() and the aspm sysfs attributes report a state as active even after it has been masked, and could cause pcie_config_aspm_link()'s "already in requested state" check to skip reprogramming hardware to match.
- Explicitly call pcie_config_aspm_l1ss(link, 0) before masking aspm_support when firmware has L1SS active and DT requests disabling L1 or L1SS, since pcie_config_aspm_link() will no longer do so once aspm_capable is derived from the masked aspm_support.
Move the aspm_default initialization and pcie_aspm_override_default_link_state() call in pcie_aspm_cap_init() to before the "Restore L0s/L1" block. pcie_aspm_cap_init() disables L1 in hardware prior to aspm_l1ss_init() and re-enables it only in the restore block. Calling pcie_config_aspm_l1ss() while L1 is already disabled satisfies its precondition ("Caller must disable L1 first"), whereas the previous placement after the restore violated it.
Since the restore block writes back the parent_lnkctl/child_lnkctl snapshot taken from hardware before the DT override ran, mask the L0s and L1 enable bits out of that snapshot for any state the override has just disabled in aspm_support. Otherwise the restore step would unconditionally reprogram the link back to firmware's original L0s/L1 configuration, defeating the Devicetree override it is meant to enforce.
Move pcie_config_aspm_l1ss() earlier in the file so it can be called from pcie_aspm_override_default_link_state().
Link [1]: https://github.com/devicetree-org/dt-schema/pull/188
Link [2]: https://github.com/devicetree-org/dt-schema/pull/190
---
Changes in v5:
- update all the child devices when enabling the ASPM back (sashiko).
- Link to v4: https://patch.msgid.link/[email protected]
Changes in v4:
- Clear link->aspm_enabled alongside aspm_support/aspm_default when an ASPM state is masked, so it no longer goes stale relative to hardware (sashiko).
- Mask the LNKCTL restore snapshot against the post-override
aspm_support so the restore step can no longer re-enable a state the Devicetree override just disabled. (sashiko)
- Link to v3: https://patch.msgid.link/[email protected]
Changes in v3:
- Move pcie_aspm_override_default_link_state() call in pcie_aspm_cap_init() to before the "Restore L0s/L1" block. pcie_aspm_cap_init() disables L1 in hardware prior to aspm_l1ss_init() and re-enables it only in the restore block. Calling pcie_config_aspm_l1ss() while L1 is already disabled satisfies its precondition ("Caller must disable L1 first"), whereas the previous placement after the restore violated it (sashiko).
- Link to v2: https://patch.msgid.link/[email protected]
Changes in v2:
- Disable L1ss when L1 is disabled as pointed by sashiko.
- Disable L1ss if bootloader enables them but we are disabling via devicetree pointed by sashiko.
- Link to v1: https://patch.msgid.link/[email protected]
--- drivers/pci/pcie/aspm.c | 135 +++++++++++++++++++++++++++++++++--------------- 1 file changed, 92 insertions(+), 43 deletions(-)
drivers/pci/pcie/aspm.c +92 -43
@@ -839,6 +839,49 @@ static void aspm_l1ss_init(struct pcie_link_state *link)#define FLAG (x, y, d) (((x) & (PCIE_LINK_STATE_##y)) ? d : "") +/* Configure the ASPM L1 substates. Caller must disable L1 first. */ +static void pcie_config_aspm_l1ss (struct pcie_link_state *link,u32 state) +{ +u32 val =0 ; +struct pci_dev *child = link->downstream, *parent = link->pdev; + +if (state &PCIE_LINK_STATE_L1_1 ) + val |=PCI_L1SS_CTL1_ASPM_L1_1 ; +if (state &PCIE_LINK_STATE_L1_2 ) + val |=PCI_L1SS_CTL1_ASPM_L1_2 ; +if (state &PCIE_LINK_STATE_L1_1_PCIPM ) + val |=PCI_L1SS_CTL1_PCIPM_L1_1 ; +if (state &PCIE_LINK_STATE_L1_2_PCIPM ) + val |=PCI_L1SS_CTL1_PCIPM_L1_2 ; + +/* +* PCIe r6.2, sec 5.5.4, rules for enabling L1 PM Substates: +* - Clear L1.x enable bits at child first, then at parent +* - Set L1.x enable bits at parent first, then at child +* - ASPM/PCIPM L1.2 must be disabled while programming timing +* parameters +*/ + +/* Disable all L1 substates */ +pci_clear_and_set_config_dword (child, child->l1ss +PCI_L1SS_CTL1 , +PCI_L1SS_CTL1_L1SS_MASK ,0 ); +pci_clear_and_set_config_dword (parent, parent->l1ss +PCI_L1SS_CTL1 , +PCI_L1SS_CTL1_L1SS_MASK ,0 ); + +/* Enable what we need to enable */ +pci_clear_and_set_config_dword (parent, parent->l1ss +PCI_L1SS_CTL1 , +PCI_L1SS_CTL1_L1SS_MASK , val); +pci_clear_and_set_config_dword (child, child->l1ss +PCI_L1SS_CTL1 , +PCI_L1SS_CTL1_L1SS_MASK , val); +} + +static bool pcie_link_has_aspm_override (const struct pcie_link_state *link, +const char *aspm) +{ +return (device_property_present (&link->pdev->dev, aspm) || +device_property_present (&link->downstream->dev, aspm)); +} +static void pcie_aspm_override_default_link_state (struct pcie_link_state *link) {struct pci_dev *pdev = link->downstream;
@@ -846,6 +889,36 @@ static void pcie_aspm_override_default_link_state(struct pcie_link_state *link)/* For devicetree platforms, enable L0s and L1 by default */ if (of_have_populated_dt ()) { +bool no_l0s =pcie_link_has_aspm_override (link,"aspm-no-l0s" ); +bool no_l1 =pcie_link_has_aspm_override (link,"aspm-no-l1" ); +bool no_l1ss =pcie_link_has_aspm_override (link,"aspm-no-l1ss" ); + +if (no_l0s) { + link->aspm_support &= ~PCIE_LINK_STATE_L0S ; + link->aspm_default &= ~PCIE_LINK_STATE_L0S ; + link->aspm_enabled &= ~PCIE_LINK_STATE_L0S ; + } + +/* +* Clear L1SS in hardware before updating aspm_support. Once +* aspm_capable is derived from aspm_support, pcie_config_aspm_link() +* skips pcie_config_aspm_l1ss() entirely via the aspm_capable guard, +* leaving firmware-enabled L1SS substates active in hardware. +* This applies equally when disabling L1 (which implies L1SS). +*/ +if ((no_l1 || no_l1ss) && (link->aspm_enabled &PCIE_LINK_STATE_L1SS )) +pcie_config_aspm_l1ss (link,0 ); + +if (no_l1) { + link->aspm_support &= ~(PCIE_LINK_STATE_L1 |PCIE_LINK_STATE_L1SS ); + link->aspm_default &= ~(PCIE_LINK_STATE_L1 |PCIE_LINK_STATE_L1SS ); + link->aspm_enabled &= ~(PCIE_LINK_STATE_L1 |PCIE_LINK_STATE_L1SS ); + }else if (no_l1ss) { + link->aspm_support &= ~PCIE_LINK_STATE_L1SS ; + link->aspm_default &= ~PCIE_LINK_STATE_L1SS ; + link->aspm_enabled &= ~PCIE_LINK_STATE_L1SS ; + } +if (link->aspm_support &PCIE_LINK_STATE_L0S ) link->aspm_default |=PCIE_LINK_STATE_L0S ;if (link->aspm_support &PCIE_LINK_STATE_L1 )
@@ -924,18 +997,30 @@ static void pcie_aspm_cap_init(struct pcie_link_state *link, int blacklist)aspm_l1ss_init (link); -/* Restore L0s/L1 if they were enabled */ -if (FIELD_GET (PCI_EXP_LNKCTL_ASPMC , child_lnkctl) || -FIELD_GET (PCI_EXP_LNKCTL_ASPMC , parent_lnkctl)) { -pcie_capability_write_word (parent,PCI_EXP_LNKCTL , parent_lnkctl); -pcie_capability_write_word (child,PCI_EXP_LNKCTL , child_lnkctl); - } -/* Save default state */ link->aspm_default = link->aspm_enabled;pcie_aspm_override_default_link_state (link); +/* +* Restore L0s/L1 if they were enabled, but don't restore any +* state a Devicetree override just disabled in aspm_support above. +*/ +if (FIELD_GET (PCI_EXP_LNKCTL_ASPMC , child_lnkctl) || +FIELD_GET (PCI_EXP_LNKCTL_ASPMC , parent_lnkctl)) { +if (!(link->aspm_support &PCIE_LINK_STATE_L0S )) { + child_lnkctl &= ~PCI_EXP_LNKCTL_ASPM_L0S ; + parent_lnkctl &= ~PCI_EXP_LNKCTL_ASPM_L0S ; + } +if (!(link->aspm_support &PCIE_LINK_STATE_L1 )) { + child_lnkctl &= ~PCI_EXP_LNKCTL_ASPM_L1 ; + parent_lnkctl &= ~PCI_EXP_LNKCTL_ASPM_L1 ; + } +pcie_capability_write_word (parent,PCI_EXP_LNKCTL , parent_lnkctl); +list_for_each_entry (child, &linkbus->devices, bus_list) +pcie_capability_write_word (child,PCI_EXP_LNKCTL , child_lnkctl); + } +/* Setup initial capable state. Will be updated later */ link->aspm_capable = link->aspm_support;
@@ -949,42 +1034,6 @@ static void pcie_aspm_cap_init(struct pcie_link_state *link, int blacklist) } } -/* Configure the ASPM L1 substates. Caller must disable L1 first. */ -static void pcie_config_aspm_l1ss (struct pcie_link_state *link,u32 state) -{ -u32 val =0 ; -struct pci_dev *child = link->downstream, *parent = link->pdev; - -if (state &PCIE_LINK_STATE_L1_1 ) - val |=PCI_L1SS_CTL1_ASPM_L1_1 ; -if (state &PCIE_LINK_STATE_L1_2 ) - val |=PCI_L1SS_CTL1_ASPM_L1_2 ; -if (state &PCIE_LINK_STATE_L1_1_PCIPM ) - val |=PCI_L1SS_CTL1_PCIPM_L1_1 ; -if (state &PCIE_LINK_STATE_L1_2_PCIPM ) - val |=PCI_L1SS_CTL1_PCIPM_L1_2 ; - -/* -* PCIe r6.2, sec 5.5.4, rules for enabling L1 PM Substates: -* - Clear L1.x enable bits at child first, then at parent -* - Set L1.x enable bits at parent first, then at child -* - ASPM/PCIPM L1.2 must be disabled while programming timing -* parameters -*/ - -/* Disable all L1 substates */ -pci_clear_and_set_config_dword (child, child->l1ss +PCI_L1SS_CTL1 , -PCI_L1SS_CTL1_L1SS_MASK ,0 ); -pci_clear_and_set_config_dword (parent, parent->l1ss +PCI_L1SS_CTL1 , -PCI_L1SS_CTL1_L1SS_MASK ,0 ); - -/* Enable what we need to enable */ -pci_clear_and_set_config_dword (parent, parent->l1ss +PCI_L1SS_CTL1 , -PCI_L1SS_CTL1_L1SS_MASK , val); -pci_clear_and_set_config_dword (child, child->l1ss +PCI_L1SS_CTL1 , -PCI_L1SS_CTL1_L1SS_MASK , val); -} -static void pcie_config_aspm_dev (struct pci_dev *pdev,u32 val) { pcie_capability_clear_and_set_word(pdev, PCI_EXP_LNKCTL,
---
base-commit: b95f03f04d475aa6719d15a636ddf32222d55657
change-id: 20260429-aspm-da55a54279e4
Best regards,
Signature · 1 line
Krishna Chaitanya Chundru <[email protected]>
[email protected]
AI reviewThank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider: - [High] The ASPM state restoration loop unconditionally overwrites the entire PCI Express Link Control…
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] The ASPM state restoration loop unconditionally overwrites the entire PCI Express Link Control (PCI_EXP_LNKCTL) register of all downstream functions with the exact snapshot from function 0, corrupting function-specific configuration.
- [Medium] ASPM L1 is only temporarily disabled on function 0 before executing the Devicetree override that disables L1SS, leaving L1 enabled on other functions and creating an asymmetric configuration flow. --
--- Patch [1]: [PATCH v5] PCI/ASPM: Mask ASPM states based on Devicetree properties --- commit 164cdaf6b21843e390d8074afc28fbe939d2fb44
Author: Krishna Chaitanya Chundru <[email protected]>
Subject: PCI/ASPM: Mask ASPM states based on Devicetree properties
Some platforms require selectively disabling specific ASPM states on a given PCIe link to avoid link instability or functional failures caused by board-level connectivity constraints. Devicetree supports disabling ASPM L0s, L1, and L1 PM Substates via the 'aspm-no-l0s', 'aspm-no-l1', and 'aspm-no-l1ss' properties. This commit enables the ASPM driver to honor these properties when initializing the default link state.
Quoted 4 lines
drivers/pci/pcie/aspm.c +0
-0
[ ... ]
Quoted 13 lines
drivers/pci/pcie/aspm.c +9
-0@@ -846,6 +889,36 @@ static void pcie_aspm_override_default_link_state(struct pcie_link_state *link)/* For devicetree platforms, enable L0s and L1 by default */ if (of_have_populated_dt ()) { +bool no_l0s =pcie_link_has_aspm_override (link,"aspm-no-l0s" ); +bool no_l1 =pcie_link_has_aspm_override (link,"aspm-no-l1" ); +bool no_l1ss =pcie_link_has_aspm_override (link,"aspm-no-l1ss" ); + +if (no_l0s) { + link->aspm_support &= ~PCIE_LINK_STATE_L0S ; + link->aspm_default &= ~PCIE_LINK_STATE_L0S ; + link->aspm_enabled &= ~PCIE_LINK_STATE_L0S ; + }
drivers/pci/pcie/aspm.c static void pcie_aspm_override_default_link_state(struct pcie_link_state *link) · line 910
Quoted 10 lines
drivers/pci/pcie/aspm.c +10
-0+ +/* +* Clear L1SS in hardware before updating aspm_support. Once +* aspm_capable is derived from aspm_support, pcie_config_aspm_link() +* skips pcie_config_aspm_l1ss() entirely via the aspm_capable guard, +* leaving firmware-enabled L1SS substates active in hardware. +* This applies equally when disabling L1 (which implies L1SS). +*/ +if ((no_l1 || no_l1ss) && (link->aspm_enabled &PCIE_LINK_STATE_L1SS )) +pcie_config_aspm_l1ss (link,0 );
[Severity: Medium]
Does this hardware write violate the PCIe specification precondition for L1 PM Substates on multi-function devices?
The PCIe spec mandates disabling ASPM L1 across the entire link before modifying L1SS. Before calling this override, pcie_aspm_cap_init() temporarily disables L0s/L1, but it only clears the ASPM Control bits for the first child function:
pcie_aspm_cap_init()
pcie_capability_write_word(child, PCI_EXP_LNKCTL,
child_lnkctl & ~PCI_EXP_LNKCTL_ASPMC);If L1 was enabled on functions > 0, they remain active when pcie_config_aspm_l1ss(link, 0) is called here. Could this cause hardware configuration faults or link instability since the precondition isn't fully met across all functions?
Quoted 3 lines
drivers/pci/pcie/aspm.c +3
-0+ +if (no_l1) { + link->aspm_support &= ~(PCIE_LINK_STATE_L1 |PCIE_LINK_STATE_L1SS );
[ ... ]
Quoted 16 lines
drivers/pci/pcie/aspm.c +7
-0@@ -924,18 +997,30 @@ static void pcie_aspm_cap_init(struct pcie_link_state *link, int blacklist)aspm_l1ss_init (link);/* Save default state */ link->aspm_default = link->aspm_enabled;pcie_aspm_override_default_link_state (link); +/* +* Restore L0s/L1 if they were enabled, but don't restore any +* state a Devicetree override just disabled in aspm_support above. +*/ +if (FIELD_GET (PCI_EXP_LNKCTL_ASPMC , child_lnkctl) || +FIELD_GET (PCI_EXP_LNKCTL_ASPMC , parent_lnkctl)) { +if (!(link->aspm_support &PCIE_LINK_STATE_L0S )) {
drivers/pci/pcie/aspm.c static void pcie_aspm_cap_init(struct pcie_link_state *link, int blacklist) · line 1021
Quoted 10 lines
drivers/pci/pcie/aspm.c +10
-0+ child_lnkctl &= ~PCI_EXP_LNKCTL_ASPM_L0S ; + parent_lnkctl &= ~PCI_EXP_LNKCTL_ASPM_L0S ; + } +if (!(link->aspm_support &PCIE_LINK_STATE_L1 )) { + child_lnkctl &= ~PCI_EXP_LNKCTL_ASPM_L1 ; + parent_lnkctl &= ~PCI_EXP_LNKCTL_ASPM_L1 ; + } +pcie_capability_write_word (parent,PCI_EXP_LNKCTL , parent_lnkctl); +list_for_each_entry (child, &linkbus->devices, bus_list) +pcie_capability_write_word (child,PCI_EXP_LNKCTL , child_lnkctl);
[Severity: High]
Can this unconditional write corrupt function-specific configuration?
The child_lnkctl variable is a complete snapshot of PCI_EXP_LNKCTL taken exclusively from function 0. The PCI_EXP_LNKCTL register contains function-specific fields, such as the Read Completion Boundary at bit 3.
Writing the full 16-bit word from function 0 to all other downstream functions blindly overwrites their distinct state.
Should this loop use a read-modify-write targeting only the PCI_EXP_LNKCTL_ASPMC bits to safely restore the ASPM state across all functions?
Quoted 4 lines
drivers/pci/pcie/aspm.c +2
-0+ } +/* Setup initial capable state. Will be updated later */ link->aspm_capable = link->aspm_support;
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Quoted 60 lines · On Tue, Jul 21, 2026 at 02:39:45PM +0000, [email protected] wrote:
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] The ASPM state restoration loop unconditionally overwrites the entire PCI Express Link Control (PCI_EXP_LNKCTL) register of all downstream functions with the exact snapshot from function 0, corrupting function-specific configuration.
- [Medium] ASPM L1 is only temporarily disabled on function 0 before executing the Devicetree override that disables L1SS, leaving L1 enabled on other functions and creating an asymmetric configuration flow. ----- Patch [1]: [PATCH v5] PCI/ASPM: Mask ASPM states based on Devicetree properties --- commit
164cdaf6b21843e390d8074afc28fbe939d2fb44
Author: Krishna Chaitanya Chundru <[email protected]>
Subject: PCI/ASPM: Mask ASPM states based on Devicetree propertiesSome platforms require selectively disabling specific ASPM states on a given PCIe link to avoid link instability or functional failures caused by board-level connectivity constraints. Devicetree supports disabling ASPM L0s, L1, and L1 PM Substates via the 'aspm-no-l0s', 'aspm-no-l1', and 'aspm-no-l1ss' properties. This commit enables the ASPM driver to honor these properties when initializing the default link state.
Quoted 4 lines
drivers/pci/pcie/aspm.c +0
-0[ ... ]
Quoted 13 lines
drivers/pci/pcie/aspm.c +9
-0@@ -846,6 +889,36 @@ static void pcie_aspm_override_default_link_state(struct pcie_link_state *link)/* For devicetree platforms, enable L0s and L1 by default */ if (of_have_populated_dt ()) { +bool no_l0s =pcie_link_has_aspm_override (link,"aspm-no-l0s" ); +bool no_l1 =pcie_link_has_aspm_override (link,"aspm-no-l1" ); +bool no_l1ss =pcie_link_has_aspm_override (link,"aspm-no-l1ss" ); + +if (no_l0s) { + link->aspm_support &= ~PCIE_LINK_STATE_L0S ; + link->aspm_default &= ~PCIE_LINK_STATE_L0S ; + link->aspm_enabled &= ~PCIE_LINK_STATE_L0S ; + }drivers/pci/pcie/aspm.c static void pcie_aspm_override_default_link_state(struct pcie_link_state *link) · line 910
Quoted 10 lines
drivers/pci/pcie/aspm.c +10
-0+ +/* +* Clear L1SS in hardware before updating aspm_support. Once +* aspm_capable is derived from aspm_support, pcie_config_aspm_link() +* skips pcie_config_aspm_l1ss() entirely via the aspm_capable guard, +* leaving firmware-enabled L1SS substates active in hardware. +* This applies equally when disabling L1 (which implies L1SS). +*/ +if ((no_l1 || no_l1ss) && (link->aspm_enabled &PCIE_LINK_STATE_L1SS )) +pcie_config_aspm_l1ss (link,0 );[Severity: Medium]
Does this hardware write violate the PCIe specification precondition for L1 PM Substates on multi-function devices?The PCIe spec mandates disabling ASPM L1 across the entire link before modifying L1SS. Before calling this override,
pcie_aspm_cap_init()temporarily disables L0s/L1, but it only clears the ASPM Control bits for the first child function:
Quoted 9 lines
pcie_aspm_cap_init()pcie_capability_write_word(child, PCI_EXP_LNKCTL, child_lnkctl & ~PCI_EXP_LNKCTL_ASPMC);If L1 was enabled on functions > 0, they remain active when
pcie_config_aspm_l1ss(link, 0)is called here. Could this cause hardware configuration faults or link instability since the precondition isn't fully met across all functions?
This is a valid concern. We should disable ASPM L1 of all functions of the child of the link and enable it later if required, like pcie_config_aspm_link().
Quoted 40 lines
Quoted 3 lines
drivers/pci/pcie/aspm.c +3
-0+ +if (no_l1) { + link->aspm_support &= ~(PCIE_LINK_STATE_L1 |PCIE_LINK_STATE_L1SS );[ ... ]
Quoted 16 lines
drivers/pci/pcie/aspm.c +7
-0@@ -924,18 +997,30 @@ static void pcie_aspm_cap_init(struct pcie_link_state *link, int blacklist)aspm_l1ss_init (link);/* Save default state */ link->aspm_default = link->aspm_enabled;pcie_aspm_override_default_link_state (link); +/* +* Restore L0s/L1 if they were enabled, but don't restore any +* state a Devicetree override just disabled in aspm_support above. +*/ +if (FIELD_GET (PCI_EXP_LNKCTL_ASPMC , child_lnkctl) || +FIELD_GET (PCI_EXP_LNKCTL_ASPMC , parent_lnkctl)) { +if (!(link->aspm_support &PCIE_LINK_STATE_L0S )) {drivers/pci/pcie/aspm.c static void pcie_aspm_cap_init(struct pcie_link_state *link, int blacklist) · line 1021
Quoted 10 lines
drivers/pci/pcie/aspm.c +10
-0+ child_lnkctl &= ~PCI_EXP_LNKCTL_ASPM_L0S ; + parent_lnkctl &= ~PCI_EXP_LNKCTL_ASPM_L0S ; + } +if (!(link->aspm_support &PCIE_LINK_STATE_L1 )) { + child_lnkctl &= ~PCI_EXP_LNKCTL_ASPM_L1 ; + parent_lnkctl &= ~PCI_EXP_LNKCTL_ASPM_L1 ; + } +pcie_capability_write_word (parent,PCI_EXP_LNKCTL , parent_lnkctl); +list_for_each_entry (child, &linkbus->devices, bus_list) +pcie_capability_write_word (child,PCI_EXP_LNKCTL , child_lnkctl);[Severity: High]
Can this unconditional write corrupt function-specific configuration?The
child_lnkctlvariable is a complete snapshot ofPCI_EXP_LNKCTLtaken exclusively from function 0. ThePCI_EXP_LNKCTLregister contains function-specific fields, such as the Read Completion Boundary at bit 3.
Quoted 7 lines
Writing the full 16-bit word from function 0 to all other downstream functions blindly overwrites their distinct state.
Should this loop use a read-modify-write targeting only the
PCI_EXP_LNKCTL_ASPMCbits to safely restore the ASPM state across all functions?
True. pcie_capability_clear_and_set_word() should be used here.
- Mani
Signature · 1 line
மணிவண்ணன் சதாசிவம்