From: Zhenzhong Duan <zhenzhong.duan@intel.com>
To: qemu-devel@nongnu.org
Cc: alex.williamson@redhat.com, clg@redhat.com,
eric.auger@redhat.com, peterx@redhat.com, jasowang@redhat.com,
mst@redhat.com, jgg@nvidia.com, nicolinc@nvidia.com,
joao.m.martins@oracle.com, kevin.tian@intel.com,
yi.l.liu@intel.com, chao.p.peng@intel.com,
Zhenzhong Duan <zhenzhong.duan@intel.com>
Subject: [PATCH v2 0/5] Check host IOMMU compatilibity with vIOMMU
Date: Mon, 8 Apr 2024 16:43:59 +0800 [thread overview]
Message-ID: <20240408084404.1111628-1-zhenzhong.duan@intel.com> (raw)
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
next reply other threads:[~2024-04-08 8:46 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-08 8:43 Zhenzhong Duan [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240408084404.1111628-1-zhenzhong.duan@intel.com \
--to=zhenzhong.duan@intel.com \
--cc=alex.williamson@redhat.com \
--cc=chao.p.peng@intel.com \
--cc=clg@redhat.com \
--cc=eric.auger@redhat.com \
--cc=jasowang@redhat.com \
--cc=jgg@nvidia.com \
--cc=joao.m.martins@oracle.com \
--cc=kevin.tian@intel.com \
--cc=mst@redhat.com \
--cc=nicolinc@nvidia.com \
--cc=peterx@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=yi.l.liu@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).