RE: [PATCH v1 00/11] Add a host IOMMU device abstraction

2024-03-19 Thread Duan, Zhenzhong


>-Original Message-
>From: Eric Auger 
>Subject: Re: [PATCH v1 00/11] Add a host IOMMU device abstraction
>
>
>
>On 2/28/24 04:58, Zhenzhong Duan wrote:
>> Hi,
>>
>> Based on Joao's suggestion, the iommufd nesting prerequisite series [1]
>> is further splitted to host IOMMU device abstract part and vIOMMU
>> check/sync part. This series implements the 1st part.
>>
>> This split also faciliates the dirty tracking series [2] and virtio-iommu
>> series [3] to depend on 1st part.
>>
>> PATCH1-3: Introduce HostIOMMUDevice and two sub class
>> PATCH4: Define HostIOMMUDevice handle in VFIODevice
>> PATCH5-8: Introdcue host_iommu_device_create callback to allocate and
>intialize HostIOMMUDevice
>Introduce, here and below

Good catch, will fix.

Thanks
Zhenzhong

>
>Eric
>> PATCH9-10: Introdcue set/unset_iommu_device to pass
>HostIOMMUDevice to vIOMMU
>> PATCH11: a helper to get host IOMMU info
>>
>> Because it's becoming clear on community's suggestion, I'd like to remove
>> rfc tag from this version.
>>
>> Qemu code can be found at:
>>
>https://github.com/yiliu1765/qemu/tree/zhenzhong/iommufd_nesting_pre
>q_part1_v1
>>
>> [1] https://lore.kernel.org/qemu-devel/20240201072818.327930-1-
>zhenzhong.d...@intel.com/
>> [2] https://lore.kernel.org/qemu-devel/20240212135643.5858-1-
>joao.m.mart...@oracle.com/
>> [3] https://lore.kernel.org/qemu-devel/20240117080414.316890-1-
>eric.au...@redhat.com/
>>
>> Thanks
>> Zhenzhong
>>
>> Changelog:
>> v1:
>> - use HostIOMMUDevice handle instead of union in VFIODevice (Eric)
>> - change host_iommu_device_init to host_iommu_device_create
>> - allocate HostIOMMUDevice in host_iommu_device_create callback
>>   and set the VFIODevice base_hdev handle (Eric)
>> - refine pci_device_set/unset_iommu_device doc (Eric)
>> - use HostIOMMUDevice handle instead of union in VTDHostIOMMUDevice
>(Eric)
>>
>> rfcv2:
>> - introduce common abstract HostIOMMUDevice and sub struct for
>different BEs (Eric, Cédric)
>> - remove iommufd_device.[ch] (Cédric)
>> - remove duplicate iommufd/devid define from VFIODevice (Eric)
>> - drop the p in aliased_pbus and aliased_pdevfn (Eric)
>> - assert devfn and iommu_bus in pci_device_get_iommu_bus_devfn
>(Cédric, Eric)
>> - use errp in iommufd_device_get_info (Eric)
>> - split and simplify cap/ecap check/sync code in intel_iommu.c (Cédric)
>> - move VTDHostIOMMUDevice declaration to intel_iommu_internal.h
>(Cédric)
>> - make '(vtd->cap_reg >> 16) & 0x3fULL' a MACRO and add missed '+1'
>(Cédric)
>> - block migration if vIOMMU cap/ecap updated based on host IOMMU
>cap/ecap
>> - add R-B
>>
>>
>> Yi Liu (1):
>>   hw/pci: Introduce pci_device_set/unset_iommu_device()
>>
>> Zhenzhong Duan (10):
>>   Introduce a common abstract struct HostIOMMUDevice
>>   backends/iommufd: Introduce IOMMUFDDevice
>>   vfio: Introduce IOMMULegacyDevice
>>   vfio: Add HostIOMMUDevice handle into VFIODevice
>>   vfio: Introduce host_iommu_device_create callback
>>   vfio/container: Implement host_iommu_device_create callback in legacy
>> mode
>>   vfio/iommufd: Implement host_iommu_device_create callback in
>iommufd
>> mode
>>   vfio/pci: Allocate and initialize HostIOMMUDevice after attachment
>>   vfio: Pass HostIOMMUDevice to vIOMMU
>>   backends/iommufd: Introduce helper function iommufd_device_get_info()
>>
>>  include/hw/pci/pci.h  | 38 +++-
>>  include/hw/vfio/vfio-common.h |  8 
>>  include/hw/vfio/vfio-container-base.h |  1 +
>>  include/sysemu/host_iommu_device.h| 22 ++
>>  include/sysemu/iommufd.h  | 19 
>>  backends/iommufd.c| 32 +-
>>  hw/pci/pci.c  | 62 +--
>>  hw/vfio/common.c  |  8 
>>  hw/vfio/container.c   |  9 
>>  hw/vfio/iommufd.c | 10 +
>>  hw/vfio/pci.c | 24 ---
>>  11 files changed, 223 insertions(+), 10 deletions(-)
>>  create mode 100644 include/sysemu/host_iommu_device.h
>>



Re: [PATCH v1 00/11] Add a host IOMMU device abstraction

2024-03-18 Thread Eric Auger



On 2/28/24 04:58, Zhenzhong Duan wrote:
> Hi,
>
> Based on Joao's suggestion, the iommufd nesting prerequisite series [1]
> is further splitted to host IOMMU device abstract part and vIOMMU
> check/sync part. This series implements the 1st part.
>
> This split also faciliates the dirty tracking series [2] and virtio-iommu
> series [3] to depend on 1st part.
>
> PATCH1-3: Introduce HostIOMMUDevice and two sub class
> PATCH4: Define HostIOMMUDevice handle in VFIODevice
> PATCH5-8: Introdcue host_iommu_device_create callback to allocate and 
> intialize HostIOMMUDevice
Introduce, here and below

Eric
> PATCH9-10: Introdcue set/unset_iommu_device to pass HostIOMMUDevice to vIOMMU
> PATCH11: a helper to get host IOMMU info
>
> Because it's becoming clear on community's suggestion, I'd like to remove
> rfc tag from this version.
>
> Qemu code can be found at:
> https://github.com/yiliu1765/qemu/tree/zhenzhong/iommufd_nesting_preq_part1_v1
>
> [1] 
> https://lore.kernel.org/qemu-devel/20240201072818.327930-1-zhenzhong.d...@intel.com/
> [2] 
> https://lore.kernel.org/qemu-devel/20240212135643.5858-1-joao.m.mart...@oracle.com/
> [3] 
> https://lore.kernel.org/qemu-devel/20240117080414.316890-1-eric.au...@redhat.com/
>
> Thanks
> Zhenzhong
>
> Changelog:
> v1:
> - use HostIOMMUDevice handle instead of union in VFIODevice (Eric)
> - change host_iommu_device_init to host_iommu_device_create
> - allocate HostIOMMUDevice in host_iommu_device_create callback
>   and set the VFIODevice base_hdev handle (Eric)
> - refine pci_device_set/unset_iommu_device doc (Eric)
> - use HostIOMMUDevice handle instead of union in VTDHostIOMMUDevice (Eric)
>
> rfcv2:
> - introduce common abstract HostIOMMUDevice and sub struct for different BEs 
> (Eric, Cédric)
> - remove iommufd_device.[ch] (Cédric)
> - remove duplicate iommufd/devid define from VFIODevice (Eric)
> - drop the p in aliased_pbus and aliased_pdevfn (Eric)
> - assert devfn and iommu_bus in pci_device_get_iommu_bus_devfn (Cédric, Eric)
> - use errp in iommufd_device_get_info (Eric)
> - split and simplify cap/ecap check/sync code in intel_iommu.c (Cédric)
> - move VTDHostIOMMUDevice declaration to intel_iommu_internal.h (Cédric)
> - make '(vtd->cap_reg >> 16) & 0x3fULL' a MACRO and add missed '+1' (Cédric)
> - block migration if vIOMMU cap/ecap updated based on host IOMMU cap/ecap
> - add R-B
>
>
> Yi Liu (1):
>   hw/pci: Introduce pci_device_set/unset_iommu_device()
>
> Zhenzhong Duan (10):
>   Introduce a common abstract struct HostIOMMUDevice
>   backends/iommufd: Introduce IOMMUFDDevice
>   vfio: Introduce IOMMULegacyDevice
>   vfio: Add HostIOMMUDevice handle into VFIODevice
>   vfio: Introduce host_iommu_device_create callback
>   vfio/container: Implement host_iommu_device_create callback in legacy
> mode
>   vfio/iommufd: Implement host_iommu_device_create callback in iommufd
> mode
>   vfio/pci: Allocate and initialize HostIOMMUDevice after attachment
>   vfio: Pass HostIOMMUDevice to vIOMMU
>   backends/iommufd: Introduce helper function iommufd_device_get_info()
>
>  include/hw/pci/pci.h  | 38 +++-
>  include/hw/vfio/vfio-common.h |  8 
>  include/hw/vfio/vfio-container-base.h |  1 +
>  include/sysemu/host_iommu_device.h| 22 ++
>  include/sysemu/iommufd.h  | 19 
>  backends/iommufd.c| 32 +-
>  hw/pci/pci.c  | 62 +--
>  hw/vfio/common.c  |  8 
>  hw/vfio/container.c   |  9 
>  hw/vfio/iommufd.c | 10 +
>  hw/vfio/pci.c | 24 ---
>  11 files changed, 223 insertions(+), 10 deletions(-)
>  create mode 100644 include/sysemu/host_iommu_device.h
>




[PATCH v1 00/11] Add a host IOMMU device abstraction

2024-02-27 Thread Zhenzhong Duan
Hi,

Based on Joao's suggestion, the iommufd nesting prerequisite series [1]
is further splitted to host IOMMU device abstract part and vIOMMU
check/sync part. This series implements the 1st part.

This split also faciliates the dirty tracking series [2] and virtio-iommu
series [3] to depend on 1st part.

PATCH1-3: Introduce HostIOMMUDevice and two sub class
PATCH4: Define HostIOMMUDevice handle in VFIODevice
PATCH5-8: Introdcue host_iommu_device_create callback to allocate and intialize 
HostIOMMUDevice
PATCH9-10: Introdcue set/unset_iommu_device to pass HostIOMMUDevice to vIOMMU
PATCH11: a helper to get host IOMMU info

Because it's becoming clear on community's suggestion, I'd like to remove
rfc tag from this version.

Qemu code can be found at:
https://github.com/yiliu1765/qemu/tree/zhenzhong/iommufd_nesting_preq_part1_v1

[1] 
https://lore.kernel.org/qemu-devel/20240201072818.327930-1-zhenzhong.d...@intel.com/
[2] 
https://lore.kernel.org/qemu-devel/20240212135643.5858-1-joao.m.mart...@oracle.com/
[3] 
https://lore.kernel.org/qemu-devel/20240117080414.316890-1-eric.au...@redhat.com/

Thanks
Zhenzhong

Changelog:
v1:
- use HostIOMMUDevice handle instead of union in VFIODevice (Eric)
- change host_iommu_device_init to host_iommu_device_create
- allocate HostIOMMUDevice in host_iommu_device_create callback
  and set the VFIODevice base_hdev handle (Eric)
- refine pci_device_set/unset_iommu_device doc (Eric)
- use HostIOMMUDevice handle instead of union in VTDHostIOMMUDevice (Eric)

rfcv2:
- introduce common abstract HostIOMMUDevice and sub struct for different BEs 
(Eric, Cédric)
- remove iommufd_device.[ch] (Cédric)
- remove duplicate iommufd/devid define from VFIODevice (Eric)
- drop the p in aliased_pbus and aliased_pdevfn (Eric)
- assert devfn and iommu_bus in pci_device_get_iommu_bus_devfn (Cédric, Eric)
- use errp in iommufd_device_get_info (Eric)
- split and simplify cap/ecap check/sync code in intel_iommu.c (Cédric)
- move VTDHostIOMMUDevice declaration to intel_iommu_internal.h (Cédric)
- make '(vtd->cap_reg >> 16) & 0x3fULL' a MACRO and add missed '+1' (Cédric)
- block migration if vIOMMU cap/ecap updated based on host IOMMU cap/ecap
- add R-B


Yi Liu (1):
  hw/pci: Introduce pci_device_set/unset_iommu_device()

Zhenzhong Duan (10):
  Introduce a common abstract struct HostIOMMUDevice
  backends/iommufd: Introduce IOMMUFDDevice
  vfio: Introduce IOMMULegacyDevice
  vfio: Add HostIOMMUDevice handle into VFIODevice
  vfio: Introduce host_iommu_device_create callback
  vfio/container: Implement host_iommu_device_create callback in legacy
mode
  vfio/iommufd: Implement host_iommu_device_create callback in iommufd
mode
  vfio/pci: Allocate and initialize HostIOMMUDevice after attachment
  vfio: Pass HostIOMMUDevice to vIOMMU
  backends/iommufd: Introduce helper function iommufd_device_get_info()

 include/hw/pci/pci.h  | 38 +++-
 include/hw/vfio/vfio-common.h |  8 
 include/hw/vfio/vfio-container-base.h |  1 +
 include/sysemu/host_iommu_device.h| 22 ++
 include/sysemu/iommufd.h  | 19 
 backends/iommufd.c| 32 +-
 hw/pci/pci.c  | 62 +--
 hw/vfio/common.c  |  8 
 hw/vfio/container.c   |  9 
 hw/vfio/iommufd.c | 10 +
 hw/vfio/pci.c | 24 ---
 11 files changed, 223 insertions(+), 10 deletions(-)
 create mode 100644 include/sysemu/host_iommu_device.h

-- 
2.34.1