|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH v6 3/9] iommu/arm: Introduce iommu_add_dt_pci_sideband_ids API
Hi Stewart, On 09/11/2023 18:27, Stewart Hildebrand wrote: From: Oleksandr Tyshchenko <oleksandr_tyshchenko@xxxxxxxx> The main purpose of this patch is to add a way to register PCI device (which is behind the IOMMU) using the generic PCI-IOMMU DT bindings [1] before assigning that device to a domain. This behaves similarly to the existing iommu_add_dt_device API, except it handles PCI devices, and it is to be invoked from the add_device hook in the SMMU driver. The function dt_map_id to translate an ID through a downstream mapping (which is also suitable for mapping Requester ID) was borrowed from Linux (v5.10-rc6) and updated according to the Xen code base. [1] https://www.kernel.org/doc/Documentation/devicetree/bindings/pci/pci-iommu.txt Signed-off-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@xxxxxxxx> Signed-off-by: Stewart Hildebrand <stewart.hildebrand@xxxxxxx> --- v5->v6: * pass ops to iommu_dt_xlate() v4->v5: * style: add newlines after variable declarations and before return in iommu.h * drop device_is_protected() check in iommu_add_dt_pci_sideband_ids() * rebase on top of ("dynamic node programming using overlay dtbo") series * fix typo in commit message * remove #ifdef around dt_map_id() prototype * move dt_map_id() to xen/common/device_tree.c * add function name in error prints * use dprintk for debug prints * use GENMASK and #include <xen/bitops.h> * fix typo in comment * remove unnecessary (int) cast in loop condition * assign *id_out and return success in case of no translation in dt_map_id() * don't initialize local variable unnecessarily * return error in case of ACPI/no DT in iommu_add_{dt_}pci_sideband_ids() v3->v4: * wrap #include <asm/acpi.h> and if ( acpi_disabled ) in #ifdef CONFIG_ACPI * fix Michal's remarks about style, parenthesis, and print formats * remove !ops->dt_xlate check since it is already in iommu_dt_xlate helper * rename s/iommu_dt_pci_map_id/dt_map_id/ because it is generic, not specific to iommu * update commit description v2->v3: * new patch title (was: iommu/arm: Introduce iommu_add_dt_pci_device API) * renamed function from: iommu_add_dt_pci_device to: iommu_add_dt_pci_sideband_ids * removed stale ops->add_device check * iommu.h: add empty stub iommu_add_dt_pci_sideband_ids for !HAS_DEVICE_TREE * iommu.h: add iommu_add_pci_sideband_ids helper * iommu.h: don't wrap prototype in #ifdef CONFIG_HAS_PCI * s/iommu_fwspec_free(pci_to_dev(pdev))/iommu_fwspec_free(dev)/ v1->v2: * remove extra devfn parameter since pdev fully describes the device * remove ops->add_device() call from iommu_add_dt_pci_device(). Instead, rely on the existing iommu call in iommu_add_device(). * move the ops->add_device and ops->dt_xlate checks earlier downstream->v1: * rebase * add const qualifier to struct dt_device_node *np arg in dt_map_id() * add const qualifier to struct dt_device_node *np declaration in iommu_add_pci_device() * use stdint.h types instead of u8/u32/etc... * rename functions: s/dt_iommu_xlate/iommu_dt_xlate/ s/dt_map_id/iommu_dt_pci_map_id/ s/iommu_add_pci_device/iommu_add_dt_pci_device/ * add device_is_protected check in iommu_add_dt_pci_device * wrap prototypes in CONFIG_HAS_PCI (cherry picked from commit 734e3bf6ee77e7947667ab8fa96c25b349c2e1da from the downstream branch poc/pci-passthrough from https://gitlab.com/xen-project/people/bmarquis/xen-arm-poc.git) --- xen/common/device_tree.c | 91 +++++++++++++++++++++++++++ xen/drivers/passthrough/device_tree.c | 42 +++++++++++++ xen/include/xen/device_tree.h | 23 +++++++ xen/include/xen/iommu.h | 24 ++++++- 4 files changed, 179 insertions(+), 1 deletion(-) diff --git a/xen/common/device_tree.c b/xen/common/device_tree.c index b1c29529514f..5cb84864b89b 100644 --- a/xen/common/device_tree.c +++ b/xen/common/device_tree.c @@ -10,6 +10,7 @@ * published by the Free Software Foundation. */+#include <xen/bitops.h> OOI (no changes requested), compare to Linux, why did you rename 'rid' to 'id'? Are we going to pass something different than a requester ID?
It is not fully clear why in Xen we directly call dt_map_id() (aka of_map_rid() in Linux) whereas Linux will may map multiple RID via pci_for_each_dma_alias(). Can you clarify? Cheers, -- Julien Grall
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |