From: Clément Mathieu--Drif
Signed-off-by: Clément Mathieu--Drif
Signed-off-by: Zhenzhong Duan
---
hw/i386/intel_iommu_internal.h | 3 +++
hw/i386/intel_iommu.c | 25 -
2 files changed, 27 insertions(+), 1 deletion(-)
diff --git a/hw/i386
PASID-based iotlb (piotlb) is used during walking Intel
VT-d stage-1 page table.
This emulates the stage-1 page table iotlb invalidation requested
by a PASID-based IOTLB Invalidate Descriptor (P_IOTLB).
Signed-off-by: Yi Liu
Signed-off-by: Zhenzhong Duan
Reviewed-by: Clément Mathieu--Drif
From: Clément Mathieu--Drif
Signed-off-by: Clément Mathieu--Drif
Signed-off-by: Zhenzhong Duan
---
hw/i386/intel_iommu_internal.h | 11
hw/i386/intel_iommu.c | 50 ++
2 files changed, 61 insertions(+)
diff --git a/hw/i386
what in iotlb cache are only first-stage and second-stage mappings.
Add a tag pgtt in VTDIOTLBEntry to mark PGTT type of the mapping and
invalidate entries based on PGTT type.
Signed-off-by: Zhenzhong Duan
Reviewed-by: Clément Mathieu--Drif
Acked-by: Jason Wang
---
include/hw/i386/intel_iommu.h
VT-d spec removed Transient Mapping (TM) field from second-level page-tables
and treat the field as Reserved(0) since revision 3.2. Update code to match
spec.
This doesn't impact function of vIOMMU as there was no logic to emulate
Transient Mapping.
Suggested-by: Yi Liu
Signed-off-by: Zhen
o known as scalable
modern mode is supported. When enabled in legacy mode, throw out error.
With scalable modern mode exposed to user, also accurate the pasid entry
check in vtd_pe_type_check().
Signed-off-by: Yi Liu
Signed-off-by: Yi Sun
Signed-off-by: Zhenzhong Duan
---
hw/i386/intel_iommu_
From: Clément Mathieu--Drif
First stage translation must fail if the address to translate is
not canonical.
Signed-off-by: Clément Mathieu--Drif
Signed-off-by: Zhenzhong Duan
Acked-by: Jason Wang
---
hw/i386/intel_iommu_internal.h | 2 ++
hw/i386/intel_iommu.c | 23
, remove old IOTLB related definitions which were unused.
Signed-off-by: Zhenzhong Duan
Reviewed-by: Clément Mathieu--Drif
Acked-by: Jason Wang
---
hw/i386/intel_iommu_internal.h | 14 --
hw/i386/intel_iommu.c | 88 +-
2 files changed, 96 insertions(+), 6
Add the framework to test the intel-iommu device.
Currently only tested cap/ecap bits correctness in scalable
modern mode. Also tested cap/ecap bits consistency before
and after system reset.
Signed-off-by: Zhenzhong Duan
Acked-by: Thomas Huth
Reviewed-by: Clément Mathieu--Drif
Acked-by: Jason
ansient Mapping.
Suggested-by: Yi Liu
Suggested-by: Jason Wang
Signed-off-by: Zhenzhong Duan
---
v2: Introcude "x-stale-tm" to handle migration compatibility (Jason)
hw/i386/intel_iommu_internal.h | 12 ++--
include/hw/i386/intel_iommu.h | 3 +++
hw/i386/intel_iommu.c
ansient Mapping.
Suggested-by: Yi Liu
Suggested-by: Jason Wang
Signed-off-by: Zhenzhong Duan
---
v4: s/x-stale-tm/stale-tm (Jason)
v3: still need to check x86_iommu->dt_supported
v2: introcude "x-stale-tm" to handle migration compatibility (Jason)
hw/i386/intel_iommu_internal.h | 12 +
ue as error_report_once()
here is mainly used to help debug guest error, but it only dumps once in
qemu life cycle and doesn't help much, we need error_report() instead.
Fixes: c0c1d351849b ("intel_iommu: add 256 bits qi_desc support")
Suggested-by: Yi Liu
Signed-off-by: Zhenzhon
Hi,
This adds missed sanity check when IQ size is 256-bit per Yi's suggestion,
see patch for details.
I don't add check for VTD_INV_DESC_PC and VTD_INV_DESC_PIOTLB, will do it
in "intel_iommu: Enable stage-1 translation for emulated device" series.
Thanks
Zhenzhon
ned-off-by: Zhenzhong Duan
---
hw/i386/intel_iommu_internal.h | 3 +++
hw/i386/intel_iommu.c | 8
2 files changed, 11 insertions(+)
diff --git a/hw/i386/intel_iommu_internal.h b/hw/i386/intel_iommu_internal.h
index 75ccd501b0..4323fc5d6d 100644
--- a/hw/i386/intel_iommu_internal.h
+++
;
Current code missed to send IQE event to guest, fix it.
Fixes: c0c1d351849b ("intel_iommu: add 256 bits qi_desc support")
Suggested-by: Yi Liu
Signed-off-by: Zhenzhong Duan
---
hw/i386/intel_iommu.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/hw/i386/intel_iommu.c b/hw/i386
ansient Mapping.
Suggested-by: Yi Liu
Suggested-by: Jason Wang
Signed-off-by: Zhenzhong Duan
Acked-by: Jason Wang
Reviewed-by: Yi Liu
---
v5: fix typo, s/hw_compat_9_1/pc_compat_9_1 (Liuyi)
v4: s/x-stale-tm/stale-tm (Jason)
v3: still need to check x86_iommu->dt_supported
v2: introcude "x-stale-
are
supported. Instead cap/ecap bits should be checked.
Signed-off-by: Yu Zhang
Signed-off-by: Zhenzhong Duan
Reviewed-by: Clément Mathieu--Drif
Reviewed-by: Yi Liu
Acked-by: Jason Wang
---
hw/i386/intel_iommu_internal.h | 9 -
hw/i386/intel_iommu.c | 25
igned-off-by: Yi Liu
Signed-off-by: Zhenzhong Duan
Acked-by: Jason Wang
Reviewed-by: Clément Mathieu--Drif
Reviewed-by: Yi Liu
---
include/hw/i386/intel_iommu.h | 1 +
hw/i386/intel_iommu.c | 23 ++-
2 files changed, 19 insertions(+), 5 deletions(-)
diff --git a/in
PASID-based iotlb (piotlb) is used during walking Intel
VT-d stage-1 page table.
This emulates the stage-1 page table iotlb invalidation requested
by a PASID-based IOTLB Invalidate Descriptor (P_IOTLB).
Signed-off-by: Yi Liu
Signed-off-by: Zhenzhong Duan
Reviewed-by: Clément Mathieu--Drif
: Set accessed and dirty bits during stage-1 translation
intel_iommu: Add an internal API to find an address space with PASID
intel_iommu: Add support for PASID-based device IOTLB invalidation
Yi Liu (2):
intel_iommu: Rename slpte to pte
intel_iommu: Implement stage-1 translation
Yu Zhang (1
invalidation.
For device that does not implement ATS capability or disable
it but still caches the translation result, it is better to
implement ATS cap or enable it if there is need to cache the
translation result.
Signed-off-by: Yi Sun
Signed-off-by: Zhenzhong Duan
Acked-by: Jason Wang
From: Clément Mathieu--Drif
This will be used to implement the device IOTLB invalidation
Signed-off-by: Clément Mathieu--Drif
Signed-off-by: Zhenzhong Duan
Acked-by: Jason Wang
Reviewed-by: Yi Liu
---
hw/i386/intel_iommu.c | 38 +++---
1 file changed, 23
Signed-off-by: Zhenzhong Duan
---
tests/qtest/bios-tables-test-allowed-diff.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/tests/qtest/bios-tables-test-allowed-diff.h
b/tests/qtest/bios-tables-test-allowed-diff.h
index dfb8523c8b..46f80be9ca 100644
--- a/tests/qtest/bios-tables-test
Signed-off-by: Zhenzhong Duan
Reviewed-by: Clément Mathieu--Drif
Reviewed-by: Yi Liu
Acked-by: Jason Wang
---
hw/i386/intel_iommu.c | 12
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c
index 67dc99cfdf..10b8425a6c 10064
: Clément Mathieu--Drif
Signed-off-by: Yi Sun
Signed-off-by: Zhenzhong Duan
Acked-by: Jason Wang
Reviewed-by: Yi Liu
---
hw/i386/intel_iommu_internal.h | 24 +++---
include/hw/i386/intel_iommu.h | 2 +-
hw/i386/intel_iommu.c | 129 +
3 files changed
also known as scalable
modern mode is supported. When enabled in legacy mode, throw out error.
With scalable modern mode exposed to user, also accurate the pasid entry
check in vtd_pe_type_check().
Suggested-by: Jason Wang
Signed-off-by: Yi Liu
Signed-off-by: Yi Sun
Signed-off-by: Zhenzhong Dua
From: Clément Mathieu--Drif
First stage translation must fail if the address to translate is
not canonical.
Signed-off-by: Clément Mathieu--Drif
Signed-off-by: Zhenzhong Duan
Acked-by: Jason Wang
Reviewed-by: Yi Liu
---
hw/i386/intel_iommu_internal.h | 1 +
hw/i386/intel_iommu.c
slpte() to vtd_do_iommu_translate() so stage-1
page table could also be checked.
By this chance, update the comment with correct section number.
Suggested-by: Yi Liu
Signed-off-by: Zhenzhong Duan
---
hw/i386/intel_iommu.c | 48 ++-
1 file changed, 25 insertions(+), 23
From: Clément Mathieu--Drif
Signed-off-by: Clément Mathieu--Drif
Signed-off-by: Zhenzhong Duan
---
hw/i386/intel_iommu_internal.h | 11
hw/i386/intel_iommu.c | 50 ++
2 files changed, 61 insertions(+)
diff --git a/hw/i386
what in iotlb cache are only first-stage and second-stage mappings.
Add a tag pgtt in VTDIOTLBEntry to mark PGTT type of the mapping and
invalidate entries based on PGTT type.
Signed-off-by: Zhenzhong Duan
Reviewed-by: Clément Mathieu--Drif
Acked-by: Jason Wang
Reviewed-by: Yi Liu
---
inclu
From: Yi Liu
This adds stage-1 page table walking to support stage-1 only
translation in scalable modern mode.
Signed-off-by: Yi Liu
Co-developed-by: Clément Mathieu--Drif
Signed-off-by: Clément Mathieu--Drif
Signed-off-by: Yi Sun
Signed-off-by: Zhenzhong Duan
Acked-by: Jason Wang
---
hw
n to flush either stage-1 or stage-2 entries.
By this chance, remove old IOTLB related definitions which were unused.
Signed-off-by: Zhenzhong Duan
Reviewed-by: Clément Mathieu--Drif
Acked-by: Jason Wang
---
hw/i386/intel_iommu_internal.h | 14 --
hw/i386/intel_iommu.c
From: Clément Mathieu--Drif
Signed-off-by: Clément Mathieu--Drif
Signed-off-by: Zhenzhong Duan
Reviewed-by: Yi Liu
Acked-by: Jason Wang
---
hw/i386/intel_iommu_internal.h | 3 +++
hw/i386/intel_iommu.c | 25 -
2 files changed, 27 insertions(+), 1 deletion
Reserved :
[044h 0068 1] Enumeration ID : 00
[045h 0069 1] PCI Bus Number : FF
Signed-off-by: Zhenzhong Duan
---
tests/qtest/bios-tables-test-allowed-diff.h | 1 -
tests/data/acpi/x86/q35/DMAR.dmar | Bin 120 -> 120 bytes
2 files changed, 1
Add the framework to test the intel-iommu device.
Currently only tested cap/ecap bits correctness in scalable
modern mode. Also tested cap/ecap bits consistency before
and after system reset.
Signed-off-by: Zhenzhong Duan
Acked-by: Thomas Huth
Reviewed-by: Clément Mathieu--Drif
Acked-by: Jason
n scalable modern
mode.
Signed-off-by: Zhenzhong Duan
Reviewed-by: Clément Mathieu--Drif
Reviewed-by: Yi Liu
Acked-by: Jason Wang
---
include/hw/i386/intel_iommu.h | 1 +
hw/i386/intel_iommu.c | 5 -
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/include/hw/i386/intel
is the default choice for
modern OS when both 48 and 39 are supported. So it makes sense to
set default to 48 for these two modes too starting from QEMU 9.2.
Use pc_compat_9_1 to handle the compatibility for machines before
9.2.
Suggested-by: Jason Wang
Signed-off-by: Zhenzhong Duan
Reviewed-by
n to flush either stage-1 or stage-2 entries.
By this chance, remove old IOTLB related definitions which were unused.
Signed-off-by: Zhenzhong Duan
Reviewed-by: Clément Mathieu--Drif
Acked-by: Jason Wang
---
hw/i386/intel_iommu_internal.h | 14 --
hw/i386/intel_iommu.c
are
supported. Instead cap/ecap bits should be checked.
Signed-off-by: Yu Zhang
Signed-off-by: Zhenzhong Duan
Reviewed-by: Clément Mathieu--Drif
Reviewed-by: Yi Liu
Acked-by: Jason Wang
---
hw/i386/intel_iommu_internal.h | 9 -
hw/i386/intel_iommu.c | 25
PASID-based iotlb (piotlb) is used during walking Intel
VT-d stage-1 page table.
This emulates the stage-1 page table iotlb invalidation requested
by a PASID-based IOTLB Invalidate Descriptor (P_IOTLB).
Signed-off-by: Yi Liu
Signed-off-by: Zhenzhong Duan
Reviewed-by: Clément Mathieu--Drif
sting is supported.
Signed-off-by: Yi Liu
Signed-off-by: Zhenzhong Duan
Acked-by: Jason Wang
Reviewed-by: Clément Mathieu--Drif
Reviewed-by: Yi Liu
---
include/hw/i386/intel_iommu.h | 1 +
hw/i386/intel_iommu.c | 23 ++-
2 files changed, 19 insertions(+), 5 dele
: Clément Mathieu--Drif
Signed-off-by: Yi Sun
Signed-off-by: Zhenzhong Duan
Acked-by: Jason Wang
Reviewed-by: Yi Liu
---
hw/i386/intel_iommu_internal.h | 24 +++---
include/hw/i386/intel_iommu.h | 2 +-
hw/i386/intel_iommu.c | 129 +
3 files changed
From: Clément Mathieu--Drif
Signed-off-by: Clément Mathieu--Drif
Signed-off-by: Zhenzhong Duan
Acked-by: Jason Wang
---
hw/i386/intel_iommu_internal.h | 11
hw/i386/intel_iommu.c | 50 ++
2 files changed, 61 insertions(+)
diff --git a/hw
Signed-off-by: Zhenzhong Duan
Reviewed-by: Clément Mathieu--Drif
Reviewed-by: Yi Liu
Acked-by: Jason Wang
---
hw/i386/intel_iommu.c | 12
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c
index 67dc99cfdf..10b8425a6c 10064
modes, 48 is the default choice for modern
OS when both 48 and 39 are supported. So it makes sense to set
default to 48 for these two modes too starting from QEMU 9.2.
Use pc_compat_9_1 to handle the compatibility for machines before
9.2.
Suggested-by: Jason Wang
Signed-off-by: Zhenzhong Duan
slpte() to vtd_do_iommu_translate() so stage-1
page table could also be checked.
By this chance, update the comment with correct section number.
Suggested-by: Yi Liu
Signed-off-by: Zhenzhong Duan
Reviewed-by: Clément Mathieu--Drif
Acked-by: Jason Wang
---
hw/i386/intel_io
intel_iommu: Implement stage-1 translation
Yu Zhang (1):
intel_iommu: Use the latest fault reasons defined by spec
Zhenzhong Duan (13):
intel_iommu: Make pasid entry type check accurate
intel_iommu: Add a placeholder variable for scalable mode stage-1
translation
intel_iommu: Flush
invalidation.
For device that does not implement ATS capability or disable
it but still caches the translation result, it is better to
implement ATS cap or enable it if there is need to cache the
translation result.
Signed-off-by: Yi Sun
Signed-off-by: Zhenzhong Duan
Acked-by: Jason Wang
Add the framework to test the intel-iommu device.
Currently only tested cap/ecap bits correctness when x-flts=on in scalable
mode. Also tested cap/ecap bits consistency before and after system reset.
Signed-off-by: Zhenzhong Duan
Acked-by: Thomas Huth
Reviewed-by: Clément Mathieu--Drif
Acked
what in iotlb cache are only first-stage and second-stage mappings.
Add a tag pgtt in VTDIOTLBEntry to mark PGTT type of the mapping and
invalidate entries based on PGTT type.
Signed-off-by: Zhenzhong Duan
Reviewed-by: Clément Mathieu--Drif
Acked-by: Jason Wang
Reviewed-by: Yi Liu
---
inclu
Signed-off-by: Zhenzhong Duan
Acked-by: Jason Wang
---
tests/qtest/bios-tables-test-allowed-diff.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/tests/qtest/bios-tables-test-allowed-diff.h
b/tests/qtest/bios-tables-test-allowed-diff.h
index dfb8523c8b..46f80be9ca 100644
--- a/tests/qtest
From: Clément Mathieu--Drif
Signed-off-by: Clément Mathieu--Drif
Signed-off-by: Zhenzhong Duan
Reviewed-by: Yi Liu
Acked-by: Jason Wang
---
hw/i386/intel_iommu_internal.h | 3 +++
hw/i386/intel_iommu.c | 25 -
2 files changed, 27 insertions(+), 1 deletion
supported. When turned
on in legacy mode, throw out error.
With stage-1 translation support exposed to user, also accurate the pasid entry
check in vtd_pe_type_check().
Suggested-by: Jason Wang
Signed-off-by: Yi Liu
Signed-off-by: Yi Sun
Signed-off-by: Zhenzhong Duan
Reviewed-by: Clément Mat
mode or x-flts=off
in scalable modme.
Signed-off-by: Zhenzhong Duan
Reviewed-by: Clément Mathieu--Drif
Reviewed-by: Yi Liu
Acked-by: Jason Wang
---
include/hw/i386/intel_iommu.h | 1 +
hw/i386/intel_iommu.c | 5 -
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/inclu
From: Clément Mathieu--Drif
This will be used to implement the device IOTLB invalidation
Signed-off-by: Clément Mathieu--Drif
Signed-off-by: Zhenzhong Duan
Acked-by: Jason Wang
Reviewed-by: Yi Liu
---
hw/i386/intel_iommu.c | 38 +++---
1 file changed, 23
Reserved :
[044h 0068 1] Enumeration ID : 00
[045h 0069 1] PCI Bus Number : FF
Signed-off-by: Zhenzhong Duan
Acked-by: Clément Mathieu--Drif
---
tests/qtest/bios-tables-test-allowed-diff.h | 1 -
tests/data/acpi/x86/q35/DMAR.dmar | Bin 120 -
From: Yi Liu
This adds stage-1 page table walking to support stage-1 only
translation in scalable mode.
Signed-off-by: Yi Liu
Co-developed-by: Clément Mathieu--Drif
Signed-off-by: Clément Mathieu--Drif
Signed-off-by: Yi Sun
Signed-off-by: Zhenzhong Duan
Acked-by: Jason Wang
---
hw/i386
From: Clément Mathieu--Drif
Stage-1 translation must fail if the address to translate is
not canonical.
Signed-off-by: Clément Mathieu--Drif
Signed-off-by: Zhenzhong Duan
Acked-by: Jason Wang
Reviewed-by: Yi Liu
---
hw/i386/intel_iommu_internal.h | 1 +
hw/i386/intel_iommu.c | 23
ement the iommufd backend")
Signed-off-by: Zhenzhong Duan
---
hw/vfio/iommufd.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/hw/vfio/iommufd.c b/hw/vfio/iommufd.c
index 3490a8f1eb..df61edffc0 100644
--- a/hw/vfio/iommufd.c
+++ b/hw/vfio/iommufd.c
@@ -515,8 +515,8
: Zhenzhong Duan
---
include/system/host_iommu_device.h | 14 --
hw/vfio/iommufd.c | 15 ---
2 files changed, 29 deletions(-)
diff --git a/include/system/host_iommu_device.h
b/include/system/host_iommu_device.h
index 809cced4ba..6f10bea25f 100644
--- a
specific capability, e.g., for vtd, checking
code will be in hiod_iommufd_get_vtd_cap().
This also fixes an issue that calling vfio_device_get_aw_bits() in
TYPE_HOST_IOMMU_DEVICE_IOMMUFD parent class .get_cap().
Signed-off-by: Zhenzhong Duan
---
include/system/iommufd.h | 4
backends
ze() after .attach_device().
Suggested-by: Cédric Le Goater
Suggested-by: Eric Auger
Suggested-by: Nicolin Chen
Signed-off-by: Zhenzhong Duan
---
include/hw/vfio/vfio-device.h | 1 +
include/system/iommufd.h | 22 ++
hw/vfio/iommufd.c | 10 +-
3 fil
4/msg01211.html
[2] https://lists.gnu.org/archive/html/qemu-devel/2025-04/msg00898.html
[3] https://lists.gnu.org/archive/html/qemu-devel/2025-03/msg01552.html
Test:
net card passthrough and ping test
hotplug/unplug
Based on vfio-next(b9d42a878b).
Thanks
Zhenzhong
Zhenzhong Duan (5):
vfio/iom
vfio_device_attach().
Drop vfio_device_hiod_realize() which looks redundant now.
Suggested-by: Cédric Le Goater
Suggested-by: Donald Dutile
Signed-off-by: Zhenzhong Duan
---
include/hw/vfio/vfio-device.h | 1 -
hw/vfio/container.c | 4
hw/vfio/device.c | 28
Because sub-class TYPE_HOST_IOMMU_DEVICE_IOMMUFD_VFIO has it's own
implementation of .get_cap(), hiod_iommufd_get_cap() isn't used
any more, drop it.
Signed-off-by: Zhenzhong Duan
---
backends/iommufd.c | 23 ---
1 file changed, 23 deletions(-)
diff --git
realize() is now moved after attachment, do the same for hiod creation.
Introduce a new function vfio_device_hiod_create_and_realize() to do
them all in one go.
Suggested-by: Cédric Le Goater
Signed-off-by: Zhenzhong Duan
---
include/hw/vfio/vfio-device.h | 3 ++-
hw/vfio/container.c
unction to create and realize hiod
- remove hiod_typename property
Zhenzhong Duan (5):
vfio/iommufd: Make a separate call to get IOMMU capabilities
vfio/iommufd: Move realize() after attachment
vfio/container: Move realize() after attachment
vfio: Cleanup host IOMMU device creation
vf
To match the change for IOMMUFD backend, move realize() after attachment
for legacy backend too.
Suggested-by: Cédric Le Goater
Suggested-by: Donald Dutile
Signed-off-by: Zhenzhong Duan
---
hw/vfio/container.c | 20
1 file changed, 12 insertions(+), 8 deletions(-)
diff
Because we handle host IOMMU device creation in each container backend,
we know which type name to use, so hiod_typename property is useless
now, just remove it.
Signed-off-by: Zhenzhong Duan
---
include/hw/vfio/vfio-container-base.h | 3 ---
hw/vfio/container.c | 2 --
hw
after attachment
succeed.
Suggested-by: Cédric Le Goater
Suggested-by: Donald Dutile
Signed-off-by: Zhenzhong Duan
---
hw/vfio/iommufd.c | 17 ++---
1 file changed, 6 insertions(+), 11 deletions(-)
diff --git a/hw/vfio/iommufd.c b/hw/vfio/iommufd.c
index 2253778b3a..f273dc8712
oater
Signed-off-by: Zhenzhong Duan
---
hw/vfio/iommufd.c | 10 --
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/hw/vfio/iommufd.c b/hw/vfio/iommufd.c
index 48db105422..2253778b3a 100644
--- a/hw/vfio/iommufd.c
+++ b/hw/vfio/iommufd.c
@@ -287,7 +287,8 @@ static
: d9fa4223b30a ("vfio: register container for cpr")
Signed-off-by: Zhenzhong Duan
---
btw: untested as I have no env with two migration capable devices,
appreciate if someone have env to help test, thanks
hw/vfio/iommufd.c | 14 ++
1 file changed, 6 insertions(+), 8 deletion
pport iommufd.
Signed-off-by: Yi Liu
Signed-off-by: Zhenzhong Duan
---
include/system/host_iommu_device.h | 13
hw/i386/intel_iommu.c | 34 ++
2 files changed, 47 insertions(+)
diff --git a/include/system/host_iommu_device.h
b/include/s
0) | | (iommufd0) |
.---. .---. .. ..
Changed to pass VTDHostIOMMUDevice pointer to vtd_check_hdev() so errata
could be saved.
Suggested-by: Yi Liu
Signed-off-by: Zhenzhong Duan
---
hw/i386/intel_iommu_internal.h | 1 +
include/hw/i386/intel_iommu.h
ce |
| (iommufd0)| | (iommufd0)| | (non-CC) |
| | | | | (iommufd0) |
.---. .---. ..
Co-Authored-by: Yi Liu
Signed-off-by: Yi Liu
Signed-off-by: Yi Sun
Signed-off-by: Zhenzhong Duan
---
hw/i386/intel_iommu_internal.h
u_pasid() helper to translate between vtd_as and
iommu pasid, this is important for dropping VTDPASIDAddressSpace
Yi Liu (3):
intel_iommu: Replay pasid binds after context cache invalidation
intel_iommu: Propagate PASID-based iotlb invalidation to host
intel_iommu: Refresh pasid bind when
Signed-off-by: Zhenzhong Duan
---
hw/i386/intel_iommu_internal.h | 1 +
hw/i386/intel_iommu.c | 51 --
hw/i386/trace-events | 1 +
3 files changed, 51 insertions(+), 2 deletions(-)
diff --git a/hw/i386/intel_iommu_internal.h b/hw/i386
Implement query of HOST_IOMMU_DEVICE_CAP_[NESTING|FS1GP] for IOMMUFD
backed host IOMMU device.
Query on these two capabilities is not supported for legacy backend
because there is no plan to support nesting with leacy backend backed
host device.
Signed-off-by: Zhenzhong Duan
---
hw/i386
Implement query of HOST_IOMMU_DEVICE_CAP_ERRATA for IOMMUFD
backed host IOMMU device.
Query on this capability is not supported for legacy backend
because there is no plan to support nesting with leacy backend
backed host device.
Signed-off-by: Zhenzhong Duan
---
include/system
From: Yi Liu
When either 'Set Root Table Pointer' or 'Translation Enable' bit is changed,
the pasid bindings on host side become stale and need to be updated.
Introduce a helper function vtd_refresh_pasid_bind() for that purpose.
Signed-off-by: Yi Liu
Signed-off-by: Zhe
*) a present pasid entry to be a present entry
*) a non-present pasid entry moved to present
vIOMMU emulator could figure out the reason by fetching latest guest pasid entry
and compare it with the PASID cache.
Signed-off-by: Yi Liu
Signed-off-by: Yi Sun
Signed-off-by: Zhenzhong Duan
Signed-off-by: Zhenzhong Duan
---
include/system/host_iommu_device.h | 8
1 file changed, 8 insertions(+)
diff --git a/include/system/host_iommu_device.h
b/include/system/host_iommu_device.h
index df782598f2..18f8b5e5cf 100644
--- a/include/system/host_iommu_device.h
+++ b/include
it.
So introduce a helper function vtd_as_to_context_entry() to fetch from cache
before trying with vtd_dev_to_context_entry().
Signed-off-by: Zhenzhong Duan
---
hw/i386/intel_iommu.c | 36 +++-
1 file changed, 23 insertions(+), 13 deletions(-)
diff --git a
Implement [at|de]tach_hwpt handlers in VFIO subsystem. vIOMMU
utilizes them to attach to or detach from hwpt on host side.
Signed-off-by: Yi Liu
Signed-off-by: Zhenzhong Duan
---
hw/vfio/iommufd.c | 22 ++
1 file changed, 22 insertions(+)
diff --git a/hw/vfio/iommufd.c b
VFIO utilizes replay to setup initial shadow iommu mappings.
But when stage-1 page table is configured, it is passed to
host to construct nested page table, there is no replay needed.
Signed-off-by: Zhenzhong Duan
---
hw/i386/intel_iommu.c | 8
1 file changed, 8 insertions(+)
diff
U will cache first
level page table related mappings during DMA address translation.
Signed-off-by: Yi Liu
Signed-off-by: Yi Sun
Signed-off-by: Zhenzhong Duan
---
hw/i386/intel_iommu_internal.h | 6 ++
hw/i386/intel_iommu.c | 116 -
2 files change
]tach_hwpt to
wrap the two handlers.
This is a prerequisite patch for following ones.
Signed-off-by: Zhenzhong Duan
---
include/system/iommufd.h | 50
backends/iommufd.c | 22 ++
2 files changed, 72 insertions(+)
diff --git a/include/system
There are three iommufd related elements iommufd handle, devid and
hwpt_id. hwpt_id is ready only after VFIO device attachment. Device
id and iommufd handle are ready before attachment, but they are all
iommufd related stuff, initialize them together with hwpt_id.
Signed-off-by: Zhenzhong Duan
Now that all infrastructures of supporting passthrough device running
with stage-1 translation are there, enable it now.
Signed-off-by: Zhenzhong Duan
---
hw/i386/intel_iommu.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c
Signed-off-by: Nicolin Chen
Signed-off-by: Zhenzhong Duan
---
include/system/iommufd.h | 3 +++
backends/iommufd.c | 30 ++
backends/trace-events| 1 +
3 files changed, 34 insertions(+)
diff --git a/include/system/iommufd.h b/include/system/iommufd.h
Introduce a new structure VTDHostIOMMUDevice which replaces
HostIOMMUDevice to be stored in hash table.
It includes a reference to HostIOMMUDevice and IntelIOMMUState,
also includes BDF information which will be used in future
patches.
Signed-off-by: Zhenzhong Duan
---
hw/i386
nothing needs to be initialized after attachment.
Signed-off-by: Zhenzhong Duan
---
include/system/host_iommu_device.h | 17 +
hw/vfio/common.c | 17 ++---
2 files changed, 31 insertions(+), 3 deletions(-)
diff --git a/include/system
In early days vtd_ce_get_rid2pasid_entry() is used to get pasid entry of
rid2pasid, then extend to any pasid. So a new name vtd_ce_get_pasid_entry
is better to match its functions.
No functional change intended.
Signed-off-by: Zhenzhong Duan
---
hw/i386/intel_iommu.c | 14 +++---
1
The nested IOMMU support needs device and hwpt id which are generated
only after attachment. Hiod encapsulates these information in realize()
and passes to vIOMMU.
Suggested-by: Cédric Le Goater
Signed-off-by: Zhenzhong Duan
---
hw/vfio/iommufd.c | 4
1 file changed, 4 insertions(+)
diff
There are three iommufd specific members in HostIOMMUDeviceIOMMUFD
that need to be initialized after attachment, they will all be used
by vIOMMU.
Signed-off-by: Zhenzhong Duan
---
hw/vfio/iommufd.c | 6 ++
1 file changed, 6 insertions(+)
diff --git a/hw/vfio/iommufd.c b/hw/vfio/iommufd.c
Implement [at|de]tach_hwpt handlers in VFIO subsystem. vIOMMU
utilizes them to attach to or detach from hwpt on host side.
Signed-off-by: Yi Liu
Signed-off-by: Zhenzhong Duan
---
hw/vfio/iommufd.c | 22 ++
1 file changed, 22 insertions(+)
diff --git a/hw/vfio/iommufd.c b
supported in linux, so declare those
capability related structures with CONFIG_LINUX.
Suggested-by: Eric Auger
Suggested-by: Nicolin Chen
Signed-off-by: Zhenzhong Duan
---
include/system/host_iommu_device.h | 11 +++
hw/vfio/iommufd.c | 8 +++-
2 files changed, 14
Implement query of HOST_IOMMU_DEVICE_CAP_[NESTING|FS1GP|ERRATA] for IOMMUFD
backed host VTD IOMMU device.
Query on these capabilities is not supported for legacy backend because there
is no plan to support nesting with legacy backend backed host device.
Signed-off-by: Zhenzhong Duan
---
hw
This helper passes cache invalidation request from guest to invalidate
stage-1 page table cache in host hardware.
Signed-off-by: Nicolin Chen
Signed-off-by: Zhenzhong Duan
---
include/system/iommufd.h | 4
backends/iommufd.c | 33 +
backends/trace
instead of HostIOMMUDeviceIOMMUFD,
e.g., in HostIOMMUDeviceIOMMUFDVFIO.
Add two wrappers host_iommu_device_iommufd_[at|de]tach_hwpt to
wrap the two functions.
Signed-off-by: Zhenzhong Duan
---
include/system/iommufd.h | 50
backends/iommufd.c | 22
701 - 800 of 946 matches
Mail list logo