Skip to contentSkip to conversation

PCI/DPC: Allow Non-ACPI Native ports to use DPC

PATCH In review Jon Derrick 2 participants 3 messages Apr 16, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 PCI/DPC: Allow Non-ACPI Native ports to use DPC

Some platforms have a mix of ports whose capabilities can be negotiated by _OSC, and some ports which are not described by ACPI and instead managed by Native drivers. The existing Firmware-First HEST model can incorrectly tag these Native, Non-ACPI ports as Firmware-First capable ports by advertising the HEST Global flag and specifying the type and class (aer_hest_parse).

This ultimately can lead to bad situations if the BIOS or port firmware leaves DPC preconfigured and the Linux DPC driver is unable to bind to the port to handle DPC events.

This patch adds the check for Native DPC in the port's host bridge in order to allow DPC services to bind to the port.

---
 drivers/pci/pcie/dpc.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/pci/pcie/dpc.c +3 -1
index 7621704..a1e355d 100644
@@ -281,10 +281,12 @@ static int dpc_probe(struct pcie_device *dev)
 {
 	struct pci_dev *pdev = dev->port;
 	struct device *device = &dev->device;
+	struct pci_host_bridge *host = pci_find_host_bridge(pdev->bus);
 	int status;
 	u16 ctl, cap;
 
-	if (pcie_aer_get_firmware_first(pdev) && !pcie_ports_dpc_native)
+	if (pcie_aer_get_firmware_first(pdev) && !pcie_ports_dpc_native &&
+	    !host->native_dpc)
 		return -ENOTSUPP;
 
 	status = devm_request_threaded_irq(device, dev->irq, dpc_irq,
Signature · 1 line
1.8.3.1
#1 lore raw

Hi,

Quoted 24 lines · Jon Derrick

Some platforms have a mix of ports whose capabilities can be negotiated by _OSC, and some ports which are not described by ACPI and instead managed by Native drivers. The existing Firmware-First HEST model can incorrectly tag these Native, Non-ACPI ports as Firmware-First capable ports by advertising the HEST Global flag and specifying the type and class (aer_hest_parse).

This ultimately can lead to bad situations if the BIOS or port firmware leaves DPC preconfigured and the Linux DPC driver is unable to bind to the port to handle DPC events.

This patch adds the check for Native DPC in the port's host bridge in order to allow DPC services to bind to the port.

---
  drivers/pci/pcie/dpc.c | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)
drivers/pci/pcie/dpc.c +0 -0
index 7621704..a1e355d 100644

drivers/pci/pcie/dpc.c static int dpc_probe(struct pcie_device *dev) · line 288

Quoted 9 lines
drivers/pci/pcie/dpc.c +2 -1
@@ -281,10 +281,12 @@ static int dpc_probe(struct pcie_device *dev)
  {
  	struct pci_dev *pdev = dev->port;
  	struct device *device = &dev->device;
+	struct pci_host_bridge *host = pci_find_host_bridge(pdev->bus);
  	int status;
  	u16 ctl, cap;
 
-	if (pcie_aer_get_firmware_first(pdev) && !pcie_ports_dpc_native)
+	if (pcie_aer_get_firmware_first(pdev) && !pcie_ports_dpc_native &&

For other PCIe services, this check is added in get_port_device_capability(). Why not add it there for DPC as well ?

Quoted 5 lines
drivers/pci/pcie/dpc.c +1 -0
+	    !host->native_dpc)
  		return -ENOTSUPP;
 
  	status = devm_request_threaded_irq(device, dev->irq, dpc_irq,
#2 lore raw
Quoted 34 lines · Sathyanarayanan

Hi,

Quoted 31 lines · Jon Derrick

Some platforms have a mix of ports whose capabilities can be negotiated by _OSC, and some ports which are not described by ACPI and instead managed by Native drivers. The existing Firmware-First HEST model can incorrectly tag these Native, Non-ACPI ports as Firmware-First capable ports by advertising the HEST Global flag and specifying the type and class (aer_hest_parse).

This ultimately can lead to bad situations if the BIOS or port firmware leaves DPC preconfigured and the Linux DPC driver is unable to bind to the port to handle DPC events.

This patch adds the check for Native DPC in the port's host bridge in order to allow DPC services to bind to the port.

---
  drivers/pci/pcie/dpc.c | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)
drivers/pci/pcie/dpc.c +1 -0
index 7621704..a1e355d 100644
@@ -281,10 +281,12 @@ static int dpc_probe(struct pcie_device *dev)
  {
  	struct pci_dev *pdev = dev->port;
  	struct device *device = &dev->device;
+	struct pci_host_bridge *host = pci_find_host_bridge(pdev->bus);
  	int status;
  	u16 ctl, cap;
 
Quoted 5 lines

drivers/pci/pcie/dpc.c static int dpc_probe(struct pcie_device *dev) · line 288

Quoted 2 lines
drivers/pci/pcie/dpc.c +1 -1
-	if (pcie_aer_get_firmware_first(pdev) && !pcie_ports_dpc_native)
+	if (pcie_aer_get_firmware_first(pdev) && !pcie_ports_dpc_native &&

For other PCIe services, this check is added in
get_port_device_capability().
Why not add it there for DPC as well ?

Sure. Looking at this, it seems like it needs some more de-tangling to fit into my model.

Quoted 5 lines
Quoted 5 lines
drivers/pci/pcie/dpc.c +1 -0
+	    !host->native_dpc)
  		return -ENOTSUPP;
 
  	status = devm_request_threaded_irq(device, dev->irq, dpc_irq,