[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [PATCH rfcv2 10/18] hw/pci: Introduce pci_device_set/unset_iommu_dev
From: |
Duan, Zhenzhong |
Subject: |
RE: [PATCH rfcv2 10/18] hw/pci: Introduce pci_device_set/unset_iommu_device() |
Date: |
Mon, 26 Feb 2024 06:26:54 +0000 |
>-----Original Message-----
>From: Eric Auger <eric.auger@redhat.com>
>Subject: Re: [PATCH rfcv2 10/18] hw/pci: Introduce
>pci_device_set/unset_iommu_device()
>
>Hi Zhenzhong,
>
>On 2/1/24 08:28, Zhenzhong Duan wrote:
>> From: Yi Liu <yi.l.liu@intel.com>
>>
>> This adds pci_device_set/unset_iommu_device() to set/unset
>> HostIOMMUDevice for a given PCIe device. Caller of set
>> should fail if set operation fails.
>>
>> Extract out pci_device_get_iommu_bus_devfn() to facilitate
>> implementation of pci_device_set/unset_iommu_device().
>>
>> Signed-off-by: Yi Liu <yi.l.liu@intel.com>
>> Signed-off-by: Yi Sun <yi.y.sun@linux.intel.com>
>> Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>
>> Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
>> ---
>> include/hw/pci/pci.h | 38 ++++++++++++++++++++++++++-
>> hw/pci/pci.c | 62
>+++++++++++++++++++++++++++++++++++++++++---
>> 2 files changed, 96 insertions(+), 4 deletions(-)
>>
>> diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h
>> index fa6313aabc..5b471fd380 100644
>> --- a/include/hw/pci/pci.h
>> +++ b/include/hw/pci/pci.h
>> @@ -3,6 +3,7 @@
>>
>> #include "exec/memory.h"
>> #include "sysemu/dma.h"
>> +#include "sysemu/host_iommu_device.h"
>>
>> /* PCI includes legacy ISA access. */
>> #include "hw/isa/isa.h"
>> @@ -384,10 +385,45 @@ typedef struct PCIIOMMUOps {
>> *
>> * @devfn: device and function number
>> */
>> - AddressSpace * (*get_address_space)(PCIBus *bus, void *opaque, int
>devfn);
>> + AddressSpace * (*get_address_space)(PCIBus *bus, void *opaque, int
>devfn);
>> + /**
>> + * @set_iommu_device: set iommufd device for a PCI device to
>vIOMMU
>attach a HostIOMMUDevice to a vIOMMU
Will do.
>> + *
>> + * Optional callback, if not implemented in vIOMMU, then vIOMMU
>can't
>> + * utilize iommufd specific features.
>looks too iommufd specific. Then vIOMMU can't retrieve host information
>from the associated HostIOMMUDevice
Will do.
>> + *
>> + * Return true if iommufd device is accepted, or else return false with
>s/accepted/attached
Will do.
>> + * errp set.
>> + *
>> + * @bus: the #PCIBus of the PCI device.
>> + *
>> + * @opaque: the data passed to pci_setup_iommu().
>> + *
>> + * @devfn: device and function number of the PCI device.
>> + *
>> + * @dev: the data structure representing host assigned device.
>> + *
>> + */
>> + int (*set_iommu_device)(PCIBus *bus, void *opaque, int devfn,
>> + HostIOMMUDevice *dev, Error **errp);
>> + /**
>> + * @unset_iommu_device: unset iommufd device for a PCI device from
>vIOMMU
>same suggestion here
Will do.
Thanks
Zhenzhong
- [PATCH rfcv2 03/18] vfio: Introduce IOMMULegacyDevice, (continued)
- [PATCH rfcv2 03/18] vfio: Introduce IOMMULegacyDevice, Zhenzhong Duan, 2024/02/01
- [PATCH rfcv2 05/18] vfio: Remove redundant iommufd and devid elements in VFIODevice, Zhenzhong Duan, 2024/02/01
- [PATCH rfcv2 06/18] vfio: Introduce host_iommu_device_init callback, Zhenzhong Duan, 2024/02/01
- [PATCH rfcv2 07/18] vfio/container: Implement host_iommu_device_init callback in legacy mode, Zhenzhong Duan, 2024/02/01
- [PATCH rfcv2 08/18] vfio/iommufd: Implement host_iommu_device_init callback in iommufd mode, Zhenzhong Duan, 2024/02/01
- [PATCH rfcv2 09/18] vfio/pci: Initialize host iommu device instance after attachment, Zhenzhong Duan, 2024/02/01
- [PATCH rfcv2 10/18] hw/pci: Introduce pci_device_set/unset_iommu_device(), Zhenzhong Duan, 2024/02/01
- [PATCH rfcv2 12/18] vfio: Initialize host IOMMU device and pass to vIOMMU, Zhenzhong Duan, 2024/02/01
- [PATCH rfcv2 11/18] intel_iommu: Add set/unset_iommu_device callback, Zhenzhong Duan, 2024/02/01
- [PATCH rfcv2 13/18] intel_iommu: Extract out vtd_cap_init to initialize cap/ecap, Zhenzhong Duan, 2024/02/01
- [PATCH rfcv2 14/18] intel_iommu: Add a framework to check and sync host IOMMU cap/ecap, Zhenzhong Duan, 2024/02/01
- [PATCH rfcv2 18/18] intel_iommu: Block migration if cap is updated, Zhenzhong Duan, 2024/02/01