[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c5be4dd3-824b-9ad0-29c4-d2f4c9149c34@intel.com>
Date: Wed, 14 Dec 2022 12:30:32 +0530
From: "Gupta, Anshuman" <anshuman.gupta@...el.com>
To: Bjorn Helgaas <helgaas@...nel.org>,
Mika Westerberg <mika.westerberg@...ux.intel.com>
CC: Sathyanarayanan Kuppuswamy
<sathyanarayanan.kuppuswamy@...ux.intel.com>,
<linux-pci@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
Bjorn Helgaas <bhelgaas@...gle.com>
Subject: Re: [PATCH v3] PCI/portdrv: Allow AER service only for Root Ports &
RCECs
On 12/10/2022 5:59 AM, Bjorn Helgaas wrote:
> From: Bjorn Helgaas <bhelgaas@...gle.com>
>
> Previously portdrv allowed the AER service for any device with an AER
> capability (assuming Linux had control of AER) even though the AER service
> driver only attaches to Root Port and RCECs.
>
> Because get_port_device_capability() included AER for non-RP, non-RCEC
> devices, we tried to initialize the AER IRQ even though these devices
> don't generate AER interrupts.
>
> Intel DG1 and DG2 discrete graphics cards contain a switch leading to a
> GPU. The switch supports AER but not MSI, so initializing an AER IRQ
> failed, and portdrv failed to claim the switch port at all. The GPU itself
> could be suspended, but the switch could not be put in a low-power state
> because it had no driver.
Tested with Intel DG2 Card, virtual switch ports bind with pcieport
driver and enters to lower power state.
Tested-by: Anshuman Gupta <anshuman.gupta@...el.com>
>
> Don't allow the AER service on non-Root Port, non-Root Complex Event
> Collector devices. This means we won't enable Bus Mastering if the device
> doesn't require MSI, the AER service will not appear in sysfs, and the AER
> service driver will not bind to the device.
>
> Link: https://lore.kernel.org/r/20221207084105.84947-1-mika.westerberg@linux.intel.com
> Based-on-patch-by: Mika Westerberg <mika.westerberg@...ux.intel.com>
> Signed-off-by: Bjorn Helgaas <bhelgaas@...gle.com>
> ---
>
> This is a v3 based on Mika's patch at
> https://lore.kernel.org/r/20221207084105.84947-1-mika.westerberg@linux.intel.com
>
> I wouldn't normally kibbitz like this, but I'm hoping to squeeze this into
> the v6.2 merge window.
>
> Changes from v2:
>
> * Test the device type in get_port_device_capability() instead of
> pcie_init_service_irqs(). The benefits are to keep the device type
> checking together (this is similar to the PME test), avoid enabling Bus
> Mastering unnecessarily, avoid exposing the portdrv AER service in
> sysfs, and preventing the AER service driver from binding to devices it
> doesn't need to.
>
> drivers/pci/pcie/portdrv.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/pci/pcie/portdrv.c b/drivers/pci/pcie/portdrv.c
> index a6c4225505d5..8b16e96ec15c 100644
> --- a/drivers/pci/pcie/portdrv.c
> +++ b/drivers/pci/pcie/portdrv.c
> @@ -232,7 +232,9 @@ static int get_port_device_capability(struct pci_dev *dev)
> }
>
> #ifdef CONFIG_PCIEAER
> - if (dev->aer_cap && pci_aer_available() &&
> + if ((pci_pcie_type(dev) == PCI_EXP_TYPE_ROOT_PORT ||
> + pci_pcie_type(dev) == PCI_EXP_TYPE_RC_EC) &&
> + dev->aer_cap && pci_aer_available() &&
> (pcie_ports_native || host->native_aer))
> services |= PCIE_PORT_SERVICE_AER;
> #endif
Powered by blists - more mailing lists