All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3] PCI: vmd: Honor ACPI _OSC on PCIe features
@ 2021-12-03  3:15 Kai-Heng Feng
  2021-12-03 14:00 ` Rafael J. Wysocki
                   ` (2 more replies)
  0 siblings, 3 replies; 14+ messages in thread
From: Kai-Heng Feng @ 2021-12-03  3:15 UTC (permalink / raw)
  To: bhelgaas
  Cc: linux-pm, Kai-Heng Feng, Rafael J . Wysocki, Nirmal Patel,
	Jonathan Derrick, Lorenzo Pieralisi, Rob Herring,
	Krzysztof Wilczyński, linux-pci, linux-kernel

When Samsung PCIe Gen4 NVMe is connected to Intel ADL VMD, the
combination causes AER message flood and drags the system performance
down.

The issue doesn't happen when VMD mode is disabled in BIOS, since AER
isn't enabled by acpi_pci_root_create() . When VMD mode is enabled, AER
is enabled regardless of _OSC:
[    0.410076] acpi PNP0A08:00: _OSC: platform does not support [AER]
...
[    1.486704] pcieport 10000:e0:06.0: AER: enabled with IRQ 146

Since VMD is an aperture to regular PCIe root ports, honor ACPI _OSC to
disable PCIe features accordingly to resolve the issue.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=215027
Suggested-by: Rafael J. Wysocki <rafael@kernel.org>
Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
---
v3:
 - Use a new helper function.

v2:
 - Use pci_find_host_bridge() instead of open coding.

 drivers/pci/controller/vmd.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/drivers/pci/controller/vmd.c b/drivers/pci/controller/vmd.c
index a45e8e59d3d48..691765e6c12aa 100644
--- a/drivers/pci/controller/vmd.c
+++ b/drivers/pci/controller/vmd.c
@@ -661,6 +661,21 @@ static int vmd_alloc_irqs(struct vmd_dev *vmd)
 	return 0;
 }
 
+/*
+ * Since VMD is an aperture to regular PCIe root ports, only allow it to
+ * control features that the OS is allowed to control on the physical PCI bus.
+ */
+static void vmd_copy_host_bridge_flags(struct pci_host_bridge *root_bridge,
+				       struct pci_host_bridge *vmd_bridge)
+{
+	vmd_bridge->native_pcie_hotplug = root_bridge->native_pcie_hotplug;
+	vmd_bridge->native_shpc_hotplug = root_bridge->native_shpc_hotplug;
+	vmd_bridge->native_aer = root_bridge->native_aer;
+	vmd_bridge->native_pme = root_bridge->native_pme;
+	vmd_bridge->native_ltr = root_bridge->native_ltr;
+	vmd_bridge->native_dpc = root_bridge->native_dpc;
+}
+
 static int vmd_enable_domain(struct vmd_dev *vmd, unsigned long features)
 {
 	struct pci_sysdata *sd = &vmd->sysdata;
@@ -798,6 +813,9 @@ static int vmd_enable_domain(struct vmd_dev *vmd, unsigned long features)
 		return -ENODEV;
 	}
 
+	vmd_copy_host_bridge_flags(pci_find_host_bridge(vmd->dev->bus),
+				   to_pci_host_bridge(vmd->bus->bridge));
+
 	vmd_attach_resources(vmd);
 	if (vmd->irq_domain)
 		dev_set_msi_domain(&vmd->bus->dev, vmd->irq_domain);
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2022-02-16 12:37 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-03  3:15 [PATCH v3] PCI: vmd: Honor ACPI _OSC on PCIe features Kai-Heng Feng
2021-12-03 14:00 ` Rafael J. Wysocki
2021-12-06 23:12 ` Keith Busch
2021-12-07 13:15   ` Rafael J. Wysocki
2022-02-09 21:36     ` Bjorn Helgaas
2022-02-10 17:52       ` Jonathan Derrick
2022-02-14  0:27         ` Kai-Heng Feng
2022-02-14  0:23       ` Kai-Heng Feng
2022-02-15 15:09         ` Bjorn Helgaas
2022-02-15 17:09           ` Rafael J. Wysocki
2022-02-16  1:53             ` Bjorn Helgaas
2022-02-16  8:14               ` Christoph Hellwig
2022-02-16 12:37               ` Rafael J. Wysocki
2022-01-04 15:26 ` Lorenzo Pieralisi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.