PCI/DPC: Request DPC only if also requesting AER
Subsystems (3)
PATCH 1/1 PCI/DPC: Request DPC only if also requesting AER
From: Bjorn Helgaas <[email protected]>
When booting with "pci=noaer", we don't request control of AER, but we previously *did* request control of DPC, as in the dmesg log attached at the bugzilla below:
Command line: ... pci=noaer
acpi PNP0A08:00: _OSC: OS supports [ExtendedConfig ASPM ClockPM Segments MSI EDR HPX-Type3] acpi PNP0A08:00: _OSC: OS now controls [PCIeHotplug SHPCHotplug PME PCIeCapability LTR DPC]
That's illegal per PCI Firmware Spec, r3.3, sec 4.5.1, table 4-5, which says:
If the operating system sets this bit [OSC_PCI_EXPRESS_DPC_CONTROL], it must also set bit 7 of the Support field (indicating support for Error Disconnect Recover notifications) and bits 3 and 4 of the Control field (requesting control of PCI Express Advanced Error Reporting and the PCI Express Capability Structure).
Request DPC control only if we have also requested AER control.
--- drivers/acpi/pci_root.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-)
drivers/acpi/pci_root.c +11 -9
@@ -518,17 +518,19 @@ static u32 calculate_control(void)if (IS_ENABLED (CONFIG_HOTPLUG_PCI_SHPC )) control |=OSC_PCI_SHPC_NATIVE_HP_CONTROL ; -if (pci_aer_available ()) +if (pci_aer_available ()) { control |=OSC_PCI_EXPRESS_AER_CONTROL ; -/* -* Per the Downstream Port Containment Related Enhancements ECN to -* the PCI Firmware Spec, r3.2, sec 4.5.1, table 4-5, -* OSC_PCI_EXPRESS_DPC_CONTROL indicates the OS supports both DPC -* and EDR. -*/ -if (IS_ENABLED (CONFIG_PCIE_DPC ) &&IS_ENABLED (CONFIG_PCIE_EDR )) - control |=OSC_PCI_EXPRESS_DPC_CONTROL ; +/* +* Per PCI Firmware Spec, r3.3, sec 4.5.1, table 4-5, the +* OS can request DPC control only if it has advertised +* OSC_PCI_EDR_SUPPORT and requested both +* OSC_PCI_EXPRESS_CAPABILITY_CONTROL and +* OSC_PCI_EXPRESS_AER_CONTROL. +*/ +if (IS_ENABLED (CONFIG_PCIE_DPC ) &&IS_ENABLED (CONFIG_PCIE_EDR )) + control |=OSC_PCI_EXPRESS_DPC_CONTROL ; + }return control; }
Signature · 1 line
2.34.1
Quoted 13 lines · Bjorn Helgaas
From: Bjorn Helgaas <[email protected]>
When booting with "pci=noaer", we don't request control of AER, but we previously *did* request control of DPC, as in the dmesg log attached at the bugzilla below:
Command line: ... pci=noaer
acpi PNP0A08:00:_OSC: OS supports [ExtendedConfig ASPM ClockPM Segments MSI EDR HPX-Type3] acpi PNP0A08:00:_OSC: OS now controls [PCIeHotplug SHPCHotplug PME PCIeCapability LTR DPC]That's illegal per PCI Firmware Spec, r3.3, sec 4.5.1, table 4-5, which says:
Quoted 7 lines
If the operating system sets this bit [
OSC_PCI_EXPRESS_DPC_CONTROL], it must also set bit 7 of the Support field (indicating support for Error Disconnect Recover notifications) and bits 3 and 4 of the Control field (requesting control of PCI Express Advanced Error Reporting and the PCI Express Capability Structure).Request DPC control only if we have also requested AER control.
Can you also add similar check in calculate_support call?
if (pci_aer_available() && IS_ENABLED(CONFIG_PCIE_EDR)) support |= OSC_PCI_EDR_SUPPORT;
Quoted 30 lines
Fixes ac1c8e35a326 ("PCI/DPC: Add Error Disconnect Recover (EDR) support")Signed-off-by Bjorn Helgaas <[email protected]>Cc <[email protected]> # v5.7+Cc Kuppuswamy Sathyanarayanan <[email protected]>Cc Matthew W Carlis <[email protected]>Cc Keith Busch <[email protected]>Cc Lukas Wunner <[email protected]>Cc Mika Westerberg <[email protected]>Cc Jesse Brandeburg <[email protected]>--- drivers/acpi/pci_root.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-)drivers/acpi/pci_root.c +1
-4@@ -518,17 +518,19 @@ static u32 calculate_control(void)if (IS_ENABLED (CONFIG_HOTPLUG_PCI_SHPC )) control |=OSC_PCI_SHPC_NATIVE_HP_CONTROL ; -if (pci_aer_available ()) +if (pci_aer_available ()) { control |=OSC_PCI_EXPRESS_AER_CONTROL ; -/* -* Per the Downstream Port Containment Related Enhancements ECN to -* the PCI Firmware Spec, r3.2, sec 4.5.1, table 4-5,
drivers/acpi/pci_root.c static u32 calculate_control(void) · line 528
Quoted 10 lines
drivers/acpi/pci_root.c +5
-5-* OSC_PCI_EXPRESS_DPC_CONTROL indicates the OS supports both DPC -* and EDR. -*/ -if (IS_ENABLED (CONFIG_PCIE_DPC ) &&IS_ENABLED (CONFIG_PCIE_EDR )) - control |=OSC_PCI_EXPRESS_DPC_CONTROL ; +/* +* Per PCI Firmware Spec, r3.3, sec 4.5.1, table 4-5, the +* OS can request DPC control only if it has advertised +* OSC_PCI_EDR_SUPPORT and requested both +* OSC_PCI_EXPRESS_CAPABILITY_CONTROL and
I think you mean OSC_PCI_EXPRESS_DPC_CONTROL.
drivers/acpi/pci_root.c static u32 calculate_control(void) · line 532
Quoted 4 lines
drivers/acpi/pci_root.c +4
-0+* OSC_PCI_EXPRESS_AER_CONTROL. +*/ +if (IS_ENABLED (CONFIG_PCIE_DPC ) &&IS_ENABLED (CONFIG_PCIE_EDR )) + control |=OSC_PCI_EXPRESS_DPC_CONTROL ;
Since you are cleaning up this part, why not add a patch to remove CONFIG_PCIE_EDR?
Quoted 4 lines
drivers/acpi/pci_root.c +1
-0+ }return control; }
Signature · 2 lines
Sathyanarayanan Kuppuswamy Linux Kernel Developer
Quoted 20 lines · Kuppuswamy Sathyanarayanan
Quoted 19 lines · Bjorn Helgaas
From: Bjorn Helgaas <[email protected]>
When booting with "pci=noaer", we don't request control of AER, but we previously *did* request control of DPC, as in the dmesg log attached at the bugzilla below:
Command line: ... pci=noaer
acpi PNP0A08:00:_OSC: OS supports [ExtendedConfig ASPM ClockPM Segments MSI EDR HPX-Type3] acpi PNP0A08:00:_OSC: OS now controls [PCIeHotplug SHPCHotplug PME PCIeCapability LTR DPC]That's illegal per PCI Firmware Spec, r3.3, sec 4.5.1, table 4-5, which says:
If the operating system sets this bit [
OSC_PCI_EXPRESS_DPC_CONTROL], it must also set bit 7 of the Support field (indicating support for Error Disconnect Recover notifications) and bits 3 and 4 of the Control field (requesting control of PCI Express Advanced Error Reporting and the PCI Express Capability Structure).
Quoted 6 lines
Quoted 1 line
Request DPC control only if we have also requested AER control.
Can you also add similar check in
calculate_supportcall?if (
pci_aer_available()&&IS_ENABLED(CONFIG_PCIE_EDR)) support |=OSC_PCI_EDR_SUPPORT;
That doesn't seem right to me. The implementation note in sec 4.6.12 suggests that EDR Notifications may be used even when the firmware maintains control of AER and DPC. Maybe that note is wrong or misleading, but as written, I interpret that as meaning that it may be useful for the platform to know that the OS supports EDR even if it AER control isn't requested or granted.
Quoted 26 lines
Quoted 26 lines
Fixes ac1c8e35a326 ("PCI/DPC: Add Error Disconnect Recover (EDR) support")Signed-off-by Bjorn Helgaas <[email protected]>Cc <[email protected]> # v5.7+Cc Kuppuswamy Sathyanarayanan <[email protected]>Cc Matthew W Carlis <[email protected]>Cc Keith Busch <[email protected]>Cc Lukas Wunner <[email protected]>Cc Mika Westerberg <[email protected]>Cc Jesse Brandeburg <[email protected]>--- drivers/acpi/pci_root.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-)drivers/acpi/pci_root.c +1
-1@@ -518,17 +518,19 @@ static u32 calculate_control(void)if (IS_ENABLED (CONFIG_HOTPLUG_PCI_SHPC )) control |=OSC_PCI_SHPC_NATIVE_HP_CONTROL ; -if (pci_aer_available ()) +if (pci_aer_available ()) { control |=OSC_PCI_EXPRESS_AER_CONTROL ;
Quoted 15 lines
drivers/acpi/pci_root.c static u32 calculate_control(void) · line 528
Quoted 13 lines
drivers/acpi/pci_root.c +5
-8-/* -* Per the Downstream Port Containment Related Enhancements ECN to -* the PCI Firmware Spec, r3.2, sec 4.5.1, table 4-5, -* OSC_PCI_EXPRESS_DPC_CONTROL indicates the OS supports both DPC -* and EDR. -*/ -if (IS_ENABLED (CONFIG_PCIE_DPC ) &&IS_ENABLED (CONFIG_PCIE_EDR )) - control |=OSC_PCI_EXPRESS_DPC_CONTROL ; +/* +* Per PCI Firmware Spec, r3.3, sec 4.5.1, table 4-5, the +* OS can request DPC control only if it has advertised +* OSC_PCI_EDR_SUPPORT and requested both +* OSC_PCI_EXPRESS_CAPABILITY_CONTROL and I think you mean
OSC_PCI_EXPRESS_DPC_CONTROL.
No, I just tried to rephrase the text for _OSC Control, bit 7 (quoted in the commit log), so I think requesting control of bits 3 and 4 (AER and PCIe Capability) is right.
Quoted 7 lines
drivers/acpi/pci_root.c static u32 calculate_control(void) · line 532
Quoted 4 lines
drivers/acpi/pci_root.c +4
-0+* OSC_PCI_EXPRESS_AER_CONTROL. +*/ +if (IS_ENABLED (CONFIG_PCIE_DPC ) &&IS_ENABLED (CONFIG_PCIE_EDR )) + control |=OSC_PCI_EXPRESS_DPC_CONTROL ;Since you are cleaning up this part, why not add a patch to remove
CONFIG_PCIE_EDR?
Good idea, I'll do that, too.
Bjorn
Quoted 21 lines · Bjorn Helgaas
Quoted 20 lines · Kuppuswamy Sathyanarayanan
Quoted 19 lines · Bjorn Helgaas
From: Bjorn Helgaas <[email protected]>
When booting with "pci=noaer", we don't request control of AER, but we previously *did* request control of DPC, as in the dmesg log attached at the bugzilla below:
Command line: ... pci=noaer
acpi PNP0A08:00:_OSC: OS supports [ExtendedConfig ASPM ClockPM Segments MSI EDR HPX-Type3] acpi PNP0A08:00:_OSC: OS now controls [PCIeHotplug SHPCHotplug PME PCIeCapability LTR DPC]That's illegal per PCI Firmware Spec, r3.3, sec 4.5.1, table 4-5, which says:
If the operating system sets this bit [
OSC_PCI_EXPRESS_DPC_CONTROL], it must also set bit 7 of the Support field (indicating support for Error Disconnect Recover notifications) and bits 3 and 4 of the Control field (requesting control of PCI Express Advanced Error Reporting and the PCI Express Capability Structure).
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
Request DPC control only if we have also requested AER control.
Can you also add similar check in
calculate_supportcall?if (
pci_aer_available()&&IS_ENABLED(CONFIG_PCIE_EDR)) support |=OSC_PCI_EDR_SUPPORT;That doesn't seem right to me. The implementation note in sec 4.6.12 suggests that EDR Notifications may be used even when the firmware maintains control of AER and DPC. Maybe that note is wrong or
It is correct. EDR notification is used when firmware retains control of AER and DPC, but wants OS to handle the recovery action. But, since EDR (like DPC) also touches the AER registers and depends on OS supporting AER capability. For example, EDR driver internally calls pci_aer_raw_clear_status(). So we need at-least ensure that AER driver code is enabled when exposing support for EDR.
Quoted 58 lines
misleading, but as written, I interpret that as meaning that it may be useful for the platform to know that the OS supports EDR even if it AER control isn't requested or granted.
Quoted 26 lines
Quoted 26 lines
Fixes ac1c8e35a326 ("PCI/DPC: Add Error Disconnect Recover (EDR) support")Signed-off-by Bjorn Helgaas <[email protected]>Cc <[email protected]> # v5.7+Cc Kuppuswamy Sathyanarayanan <[email protected]>Cc Matthew W Carlis <[email protected]>Cc Keith Busch <[email protected]>Cc Lukas Wunner <[email protected]>Cc Mika Westerberg <[email protected]>Cc Jesse Brandeburg <[email protected]>--- drivers/acpi/pci_root.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-)drivers/acpi/pci_root.c +1
-1@@ -518,17 +518,19 @@ static u32 calculate_control(void)if (IS_ENABLED (CONFIG_HOTPLUG_PCI_SHPC )) control |=OSC_PCI_SHPC_NATIVE_HP_CONTROL ; -if (pci_aer_available ()) +if (pci_aer_available ()) { control |=OSC_PCI_EXPRESS_AER_CONTROL ;Quoted 14 lines
drivers/acpi/pci_root.c static u32 calculate_control(void) · line 528
Quoted 13 lines
drivers/acpi/pci_root.c +5
-8-/* -* Per the Downstream Port Containment Related Enhancements ECN to -* the PCI Firmware Spec, r3.2, sec 4.5.1, table 4-5, -* OSC_PCI_EXPRESS_DPC_CONTROL indicates the OS supports both DPC -* and EDR. -*/ -if (IS_ENABLED (CONFIG_PCIE_DPC ) &&IS_ENABLED (CONFIG_PCIE_EDR )) - control |=OSC_PCI_EXPRESS_DPC_CONTROL ; +/* +* Per PCI Firmware Spec, r3.3, sec 4.5.1, table 4-5, the +* OS can request DPC control only if it has advertised +* OSC_PCI_EDR_SUPPORT and requested both +* OSC_PCI_EXPRESS_CAPABILITY_CONTROL and I think you mean
OSC_PCI_EXPRESS_DPC_CONTROL.No, I just tried to rephrase the text for
_OSCControl, bit 7 (quoted in the commit log), so I think requesting control of bits 3 and 4 (AER and PCIe Capability) is right.Quoted 6 lines
drivers/acpi/pci_root.c static u32 calculate_control(void) · line 532
Quoted 4 lines
drivers/acpi/pci_root.c +4
-0+* OSC_PCI_EXPRESS_AER_CONTROL. +*/ +if (IS_ENABLED (CONFIG_PCIE_DPC ) &&IS_ENABLED (CONFIG_PCIE_EDR )) + control |=OSC_PCI_EXPRESS_DPC_CONTROL ;Since you are cleaning up this part, why not add a patch to remove
CONFIG_PCIE_EDR?Good idea, I'll do that, too.
Bjorn
Signature · 2 lines
Sathyanarayanan Kuppuswamy Linux Kernel Developer