linux-stable/drivers/iommu/amd
Mario Limonciello 386c248775 iommu/amd: Mark interrupt as managed
[ Upstream commit 0feda94c86 ]

On many systems that have an AMD IOMMU the following sequence of
warnings is observed during bootup.

```
pci 0000:00:00.2  can't derive routing for PCI INT A
pci 0000:00:00.2: PCI INT A: not connected
```

This series of events happens because of the IOMMU initialization
sequence order and the lack of _PRT entries for the IOMMU.

During initialization the IOMMU driver first enables the PCI device
using pci_enable_device().  This will call acpi_pci_irq_enable()
which will check if the interrupt is declared in a PCI routing table
(_PRT) entry. According to the PCI spec [1] these routing entries
are only required under PCI root bridges:
	The _PRT object is required under all PCI root bridges

The IOMMU is directly connected to the root complex, so there is no
parent bridge to look for a _PRT entry. The first warning is emitted
since no entry could be found in the hierarchy. The second warning is
then emitted because the interrupt hasn't yet been configured to any
value.  The pin was configured in pci_read_irq() but the byte in
PCI_INTERRUPT_LINE return 0xff which means "Unknown".

After that sequence of events pci_enable_msi() is called and this
will allocate an interrupt.

That is both of these warnings are totally harmless because the IOMMU
uses MSI for interrupts.  To avoid even trying to probe for a _PRT
entry mark the IOMMU as IRQ managed. This avoids both warnings.

Link: https://uefi.org/htmlspecs/ACPI_Spec_6_4_html/06_Device_Configuration/Device_Configuration.html?highlight=_prt#prt-pci-routing-table [1]
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Fixes: cffe0a2b5a ("x86, irq: Keep balance of IOAPIC pin reference count")
Reviewed-by: Vasant Hegde <vasant.hegde@amd.com>
Link: https://lore.kernel.org/r/20240122233400.1802-1-mario.limonciello@amd.com
Signed-off-by: Joerg Roedel <jroedel@suse.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-03-26 18:20:36 -04:00
..
amd_iommu.h iommu/amd: Fix up merge conflict resolution 2023-06-09 10:34:00 +02:00
amd_iommu_types.h iommu/amd: Introduce Disable IRTE Caching Support 2023-08-23 17:52:21 +02:00
debugfs.c
init.c iommu/amd: Mark interrupt as managed 2024-03-26 18:20:36 -04:00
io_pgtable.c iommu/amd/io-pgtable: Implement unmap_pages io_pgtable_ops callback 2022-09-07 16:12:33 +02:00
io_pgtable_v2.c iommu/amd: Initial support for AMD IOMMU v2 page table 2022-09-07 16:12:35 +02:00
iommu.c iommu/amd/pgtbl_v2: Fix domain max address 2023-06-09 10:34:28 +02:00
iommu_v2.c iommu/amd/iommu_v2: Fix pasid_state refcount dec hit 0 warning on pasid unbind 2023-09-13 09:42:50 +02:00
Kconfig iommu/dma: Clean up Kconfig 2022-09-07 14:46:59 +02:00
Makefile iommu/amd: Initial support for AMD IOMMU v2 page table 2022-09-07 16:12:35 +02:00
quirks.c iommu/amd: Include PCI segment ID when initialize IOMMU 2022-07-07 09:37:51 +02:00