]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
PCI: vmd: Honor ACPI _OSC on PCIe features
authorKai-Heng Feng <kai.heng.feng@canonical.com>
Tue, 11 Jan 2022 14:26:01 +0000 (22:26 +0800)
committerAndrea Righi <andrea.righi@canonical.com>
Fri, 21 Jan 2022 14:49:21 +0000 (15:49 +0100)
BugLink: https://bugs.launchpad.net/bugs/1954611
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.

Suggested-by: Rafael J. Wysocki <rafael@kernel.org>
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=215027
Link: https://lore.kernel.org/r/20211203031541.1428904-1-kai.heng.feng@canonical.com
Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Reviewed-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
(cherry picked from commit 04b12ef163d10e348db664900ae7f611b83c7a0e linux-next)
Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
Acked-by: Tim Gardner <tim.gardner@canonical.com>
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
drivers/pci/controller/vmd.c

index a5987e52700e3ad7f37422910e67a73253b4f7dd..274e42e967f63005ad149ef1b215c1cee8c34aa5 100644 (file)
@@ -658,6 +658,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;
@@ -794,6 +809,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);