ACPI: VIOT: Initialize the correct IOMMU fwspec
authorJean-Philippe Brucker <jean-philippe@linaro.org>
Mon, 20 Mar 2023 18:05:29 +0000 (18:05 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 11 May 2023 14:03:12 +0000 (23:03 +0900)
commita260921b81b06724d07a5819bc4e2bbc7dc46638
tree014c74c875424e8124d6c912eca0dbb4dd83a3f8
parent1a258bfa00f1bd33d40f56b06b34d7645f26eee1
ACPI: VIOT: Initialize the correct IOMMU fwspec

[ Upstream commit 47d26684185d09e083669bbbd0c465ab3493a51f ]

When setting up DMA for a PCI device, we need to initialize its
iommu_fwspec with all possible alias RIDs (such as PCI bridges). To do
this we use pci_for_each_dma_alias() which calls
viot_pci_dev_iommu_init(). This function incorrectly initializes the
fwspec of the bridge instead of the device being configured. Fix it by
passing the original device as context to pci_for_each_dma_alias().

Fixes: 3cf485540e7b ("ACPI: Add driver for the VIOT table")
Link: https://lore.kernel.org/all/Y8qzOKm6kvhGWG1T@myrica
Reported-by: Eric Auger <eric.auger@redhat.com>
Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
Reviewed-by: Eric Auger <eric.auger@redhat.com>
Tested-by: Eric Auger <eric.auger@redhat.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/acpi/viot.c