[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH v2 5/8] pci/arm: Use iommu_add_dt_pci_device()
From: Oleksandr Tyshchenko <oleksandr_tyshchenko@xxxxxxxx> On Arm we need to parse DT PCI-IOMMU specifier and provide it to the driver (for describing the relationship between PCI devices and IOMMUs) before adding a device to it. Signed-off-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@xxxxxxxx> Signed-off-by: Stewart Hildebrand <stewart.hildebrand@xxxxxxx> --- v1->v2: * new patch title (was: "pci/arm: Use iommu_add_dt_pci_device() instead of arch hook") * move iommu_add_dt_pci_device() call (and associated #ifdef) to pci_add_device() * use existing call to iommu_add_device() downstream->v1: * rebase * add __maybe_unused attribute to const struct domain_iommu *hd; * Rename: s/iommu_add_pci_device/iommu_add_dt_pci_device/ * guard iommu_add_dt_pci_device call with CONFIG_HAS_DEVICE_TREE instead of CONFIG_ARM (cherry picked from commit 2b9d26badab8b24b5a80d028c4499a5022817213 from the downstream branch poc/pci-passthrough from https://gitlab.com/xen-project/people/bmarquis/xen-arm-poc.git) --- xen/drivers/passthrough/pci.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/xen/drivers/passthrough/pci.c b/xen/drivers/passthrough/pci.c index b42acb8d7c09..6dbaae682773 100644 --- a/xen/drivers/passthrough/pci.c +++ b/xen/drivers/passthrough/pci.c @@ -34,6 +34,11 @@ #include <xen/vpci.h> #include <xen/msi.h> #include <xsm/xsm.h> + +#ifdef CONFIG_HAS_DEVICE_TREE +#include <asm/iommu_fwspec.h> +#endif + #include "ats.h" struct pci_seg { @@ -762,9 +767,20 @@ int pci_add_device(u16 seg, u8 bus, u8 devfn, pdev->domain = NULL; goto out; } +#ifdef CONFIG_HAS_DEVICE_TREE + ret = iommu_add_dt_pci_device(pdev); + if ( ret < 0 ) + { + printk(XENLOG_ERR "pci-iommu translation failed: %d\n", ret); + goto out; + } +#endif ret = iommu_add_device(pdev); if ( ret ) { +#ifdef CONFIG_HAS_DEVICE_TREE + iommu_fwspec_free(pci_to_dev(pdev)); +#endif vpci_remove_device(pdev); list_del(&pdev->domain_list); pdev->domain = NULL; -- 2.40.1
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |