qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/5] Check host IOMMU compatilibity with vIOMMU
@ 2024-04-08  8:43 Zhenzhong Duan
  2024-04-08  8:44 ` [PATCH v2 1/5] intel_iommu: Extract out vtd_cap_init() to initialize cap/ecap Zhenzhong Duan
                   ` (4 more replies)
  0 siblings, 5 replies; 21+ messages in thread
From: Zhenzhong Duan @ 2024-04-08  8:43 UTC (permalink / raw)
  To: qemu-devel
  Cc: alex.williamson, clg, eric.auger, peterx, jasowang, mst, jgg,
	nicolinc, joao.m.martins, kevin.tian, yi.l.liu, chao.p.peng,
	Zhenzhong Duan

Hi,

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

1st part implements get_host_iommu_info() callback which vIOMMU can call to
get host IOMMU info. For legacy VFIO or VDPA device, aw_bits is provided;
for IOMMUFD backed device, IOMMUFD uAPI provides detailed cap/ecap bits from
host.

vIOMMU implements set/unset_iommu_device() callback to get HostIOMMUDevice
and call get_host_iommu_info(). So vIOMMU can do compatibility check with
the return host IOMMU info.

This is also a prerequisite for incoming iommufd nesting series:
'intel_iommu: Enable stage-1 translation' where HostIOMMUDevice provides
more data such as iommufd/devid/ioas_id and callback attach/detach_hwpt()
for vIOMMU to create nested hwpt, attaching/detaching hwpt, etc.

The major change of this version is dropping the cap/ecap update logic based
on MST's suggestion. We can add property for any cap/ecap bit when necessary
just like "aw-bits". This way we don't need to concern about migration
compatibility and code is cleaner.

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

[1] https://lore.kernel.org/qemu-devel/20240201072818.327930-1-zhenzhong.duan@intel.com/
[2] https://lists.gnu.org/archive/html/qemu-devel/2024-04/msg00763.html

Thanks
Zhenzhong

Changelog:
v2:
- drop cap/ecap update logic (MST)
- check aw-bits from get_host_iommu_info() in legacy mode

v1:
- convert HostIOMMUDevice to sub object pointer in vtd_check_hdev

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 (2):
  intel_iommu: Implement set/unset_iommu_device() callback
  intel_iommu: Add a framework to do compatibility check with host IOMMU
    cap/ecap

Zhenzhong Duan (3):
  intel_iommu: Extract out vtd_cap_init() to initialize cap/ecap
  intel_iommu: Check for compatibility with legacy device
  intel_iommu: Check for compatibility with iommufd backed device

 hw/i386/intel_iommu_internal.h |   8 ++
 include/hw/i386/intel_iommu.h  |   3 +
 hw/i386/intel_iommu.c          | 242 +++++++++++++++++++++++++++------
 3 files changed, 211 insertions(+), 42 deletions(-)

-- 
2.34.1



^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2024-06-03  6:26 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-08  8:43 [PATCH v2 0/5] Check host IOMMU compatilibity with vIOMMU Zhenzhong Duan
2024-04-08  8:44 ` [PATCH v2 1/5] intel_iommu: Extract out vtd_cap_init() to initialize cap/ecap Zhenzhong Duan
2024-04-08  8:44 ` [PATCH v2 2/5] intel_iommu: Implement set/unset_iommu_device() callback Zhenzhong Duan
2024-04-08  8:44 ` [PATCH v2 3/5] intel_iommu: Add a framework to do compatibility check with host IOMMU cap/ecap Zhenzhong Duan
2024-04-15 15:31   ` Cédric Le Goater
2024-04-16  7:09     ` Duan, Zhenzhong
2024-04-16 14:17       ` Cédric Le Goater
2024-04-17  4:21         ` Duan, Zhenzhong
2024-04-17  8:30           ` Cédric Le Goater
2024-04-17  9:24             ` Duan, Zhenzhong
2024-04-18  6:42               ` Cédric Le Goater
2024-04-18  8:42                 ` Duan, Zhenzhong
2024-04-19  6:20                   ` Cédric Le Goater
2024-04-19  9:49                     ` Duan, Zhenzhong
2024-04-25  8:46                     ` Duan, Zhenzhong
2024-04-25 12:40                       ` Cédric Le Goater
2024-04-26  3:10                         ` Duan, Zhenzhong
2024-06-02 12:56                           ` Michael S. Tsirkin
2024-06-03  6:25                             ` Duan, Zhenzhong
2024-04-08  8:44 ` [PATCH v2 4/5] intel_iommu: Check for compatibility with legacy device Zhenzhong Duan
2024-04-08  8:44 ` [PATCH v2 5/5] intel_iommu: Check for compatibility with iommufd backed device Zhenzhong Duan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).