On 28.05.2025 11:12, Mykyta Poturai wrote:
> From: Stewart Hildebrand <[email protected]>
>
> Enable the use of IOMMU + PCI in dom0 without having to specify
> "pci-passthrough=yes". Due to possible platform specific dependencies
> of the PCI host, we rely on dom0 to initialize it and perform
> a PHYSDEVOP_pci_device_add/remove call to add each device to SMMU.
> PHYSDEVOP_pci_device_reset is left untouched as it does not have the
> pci_passthrough_enabled check.
Just to re-raise the question here: Is this actually correct?
> --- a/xen/drivers/pci/physdev.c
> +++ b/xen/drivers/pci/physdev.c
> @@ -19,7 +19,7 @@ ret_t pci_physdev_op(int cmd, XEN_GUEST_HANDLE_PARAM(void)
> arg)
> struct pci_dev_info pdev_info;
> nodeid_t node = NUMA_NO_NODE;
>
> - if ( !is_pci_passthrough_enabled() )
> + if ( !is_pci_passthrough_enabled() && !arch_pci_device_physdevop())
> return -EOPNOTSUPP;
>
> ret = -EFAULT;
> @@ -57,7 +57,7 @@ ret_t pci_physdev_op(int cmd, XEN_GUEST_HANDLE_PARAM(void)
> arg)
> case PHYSDEVOP_pci_device_remove: {
> struct physdev_pci_device dev;
>
> - if ( !is_pci_passthrough_enabled() )
> + if ( !is_pci_passthrough_enabled() && !arch_pci_device_physdevop())
> return -EOPNOTSUPP;
Nit (style): You're losing a relevant blank each.
Jan