Message ID | 20230511191654.400720-7-stewart.hildebrand@amd.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | SMMU handling for PCIe Passthrough on ARM | expand |
On 11.05.2023 21:16, Stewart Hildebrand wrote: > It's not necessary to add/remove/assign/deassign pci phantom functions > for the ARM SMMU drivers. All associated AXI stream IDs are added during > the iommu call for the base PCI device/function. > > However, the ARM SMMU drivers can cope with the extra/unnecessary calls just > fine, so this patch is RFC as it's not strictly required. Tying the skipping to IS_ENABLED(CONFIG_HAS_DEVICE_TREE) goes against one of Julien's earlier comments, towards DT and ACPI wanting to co-exist at some point. So I think keeping the supposedly unnecessary calls is going to be unavoidable, unless you have a runtime property that you could check instead. Jan
On 5/12/23 03:28, Jan Beulich wrote: > On 11.05.2023 21:16, Stewart Hildebrand wrote: >> It's not necessary to add/remove/assign/deassign pci phantom functions >> for the ARM SMMU drivers. All associated AXI stream IDs are added during >> the iommu call for the base PCI device/function. >> >> However, the ARM SMMU drivers can cope with the extra/unnecessary calls just >> fine, so this patch is RFC as it's not strictly required. > > Tying the skipping to IS_ENABLED(CONFIG_HAS_DEVICE_TREE) goes against > one of Julien's earlier comments, towards DT and ACPI wanting to > co-exist at some point. So I think keeping the supposedly unnecessary > calls is going to be unavoidable, unless you have a runtime property > that you could check instead. I'll drop this patch in v3
diff --git a/xen/drivers/passthrough/pci.c b/xen/drivers/passthrough/pci.c index 6dbaae682773..3823edf096eb 100644 --- a/xen/drivers/passthrough/pci.c +++ b/xen/drivers/passthrough/pci.c @@ -871,6 +871,7 @@ static int deassign_device(struct domain *d, uint16_t seg, uint8_t bus, else target = hardware_domain; + if ( !IS_ENABLED(CONFIG_HAS_DEVICE_TREE) ) while ( pdev->phantom_stride ) { devfn += pdev->phantom_stride; @@ -1335,7 +1336,7 @@ static int iommu_add_device(struct pci_dev *pdev) return 0; rc = iommu_call(hd->platform_ops, add_device, devfn, pci_to_dev(pdev)); - if ( rc || !pdev->phantom_stride ) + if ( rc || !pdev->phantom_stride || IS_ENABLED(CONFIG_HAS_DEVICE_TREE) ) return rc; for ( ; ; ) @@ -1379,6 +1380,7 @@ static int iommu_remove_device(struct pci_dev *pdev) if ( !is_iommu_enabled(pdev->domain) ) return 0; + if ( !IS_ENABLED(CONFIG_HAS_DEVICE_TREE) ) for ( devfn = pdev->devfn ; pdev->phantom_stride; ) { int rc; @@ -1464,6 +1466,7 @@ static int assign_device(struct domain *d, u16 seg, u8 bus, u8 devfn, u32 flag) pci_to_dev(pdev), flag)) ) goto done; + if ( !IS_ENABLED(CONFIG_HAS_DEVICE_TREE) ) for ( ; pdev->phantom_stride; rc = 0 ) { devfn += pdev->phantom_stride;
It's not necessary to add/remove/assign/deassign pci phantom functions for the ARM SMMU drivers. All associated AXI stream IDs are added during the iommu call for the base PCI device/function. However, the ARM SMMU drivers can cope with the extra/unnecessary calls just fine, so this patch is RFC as it's not strictly required. Signed-off-by: Stewart Hildebrand <stewart.hildebrand@amd.com> --- I'm aware the indentation is wrong. I just wanted to keep the diffstat small while this particular patch is RFC. v1->v2: * new patch --- xen/drivers/passthrough/pci.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)