initialization,
compatibility check and block host device passthrough until nesting
is supported.
Signed-off-by: Yi Liu
Signed-off-by: Zhenzhong Duan
---
hw/i386/intel_iommu_internal.h | 2 ++
include/hw/i386/intel_iommu.h | 1 +
hw/i386/intel_iommu.c | 34
On 2024/7/15 16:21, Zhao Liu wrote:
For qemu_open_old(), osdep.h said:
Don't introduce new usage of this function, prefer the following
qemu_open/qemu_create that take an "Error **errp".
So replace qemu_open_old() with qemu_open().
Cc: Yi Liu
Cc: Eric Auger
Cc: Zhenzhong Duan
member to refine
the commit message a bit.
Reviewed-by: Yi Liu
Signed-off-by: Clément Mathieu--Drif
Reviewed-by: Minwoo Im
---
hw/i386/intel_iommu_internal.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hw/i386/intel_iommu_internal.h b/hw/i386/intel_iommu_internal.h
changed, 2 insertions(+), 2 deletions(-)
Reviewed-by: Yi Liu
diff --git a/hw/i386/intel_iommu_internal.h b/hw/i386/intel_iommu_internal.h
index cbc4030031..faea23e8d6 100644
--- a/hw/i386/intel_iommu_internal.h
+++ b/hw/i386/intel_iommu_internal.h
@@ -264,10 +264,10 @@
#define VTD_FRCD_FR
On 2024/7/9 10:51, Jason Wang wrote:
On Mon, Jul 8, 2024 at 3:04 PM Yi Liu wrote:
On 2024/7/5 19:01, CLEMENT MATHIEU--DRIF wrote:
From: Clément Mathieu--Drif
The constant must be unsigned, otherwise the two's complement
overrides the other fields when a PASID is present.
Fixes
*vtd_lookup_iotlb(IntelIOMMUState *s,
uint16_t source_id,
{
struct vtd_iotlb_key key;
VTDIOTLBEntry *entry;
-int level;
+unsigned level;
for (level = VTD_SL_PT_LEVEL; level < VTD_SL_PML4_LEVEL; level++) {
key.gfn = vtd_get_iotlb_gfn(addr, level);
Reviewed-by: Yi
nt32_t pasid;
uint64_t addr;
-uint8_t mask;
+uint64_t mask;
};
typedef struct VTDIOTLBPageInvInfo VTDIOTLBPageInvInfo;
--
Regards,
Yi Liu
TD_SL_PML4_LEVEL; level++) {
key.gfn = vtd_get_iotlb_gfn(addr, level);
--
Regards,
Yi Liu
nt64_t mask;
};
typedef struct VTDIOTLBPageInvInfo VTDIOTLBPageInvInfo;
--
Regards,
Yi Liu
"Fixes tag" is not needed.
Signed-off-by: Clément Mathieu--Drif
Reviewed-by: Yi Liu
Reviewed-by: Zhenzhong Duan
---
hw/i386/intel_iommu_internal.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hw/i386/intel_iommu_internal.h b/hw/i386/intel_iommu_internal.h
index f8cf99bdd
Signed-off-by: Yi Liu
---
MAINTAINERS | 1 +
1 file changed, 1 insertion(+)
diff --git a/MAINTAINERS b/MAINTAINERS
index 6725913c8b..61724b91d8 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -3656,6 +3656,7 @@ F: tests/uefi-test-tools/
VT-d Emulation
M: Michael S. Tsirkin
R: Jason Wang
+R
On 2024/7/5 13:13, CLEMENT MATHIEU--DRIF wrote:
On 05/07/2024 05:03, Yi Liu wrote:
Caution: External email. Do not open attachments or click links,
unless this email comes from a known sender and you know the content
is safe.
On 2024/5/30 20:24, CLEMENT MATHIEU--DRIF wrote:
This series
)
Fixes: 1b2b12376c ("intel-iommu: PASID support")
you need more digits per the result of "grep Fixes
docs/devel/submitting-a-patch.rst".
docs/devel/submitting-a-patch.rst:add an additional line with "Fixes:
Signed-off-by: Clément Mathieu--Drif
Reviewed-by: Yi Liu
---
| 4 +
system/memory.c| 49 ++
10 files changed, 604 insertions(+), 2 deletions(-)
--
Regards,
Yi Liu
" (unknown type)", __func__, inv_desc->hi,
--
Regards,
Yi Liu
vInfo VTDIOTLBPageInvInfo;
--
2.45.2
--
Regards,
Yi Liu
On 2024/7/4 12:30, CLEMENT MATHIEU--DRIF wrote:
On 03/07/2024 14:14, Yi Liu wrote:
Caution: External email. Do not open attachments or click links,
unless this email comes from a known sender and you know the content
is safe.
On 2024/7/2 13:52, CLEMENT MATHIEU--DRIF wrote:
From: Clément
On 2024/7/4 12:36, CLEMENT MATHIEU--DRIF wrote:
On 03/07/2024 14:32, Yi Liu wrote:
Caution: External email. Do not open attachments or click links,
unless this email comes from a known sender and you know the content
is safe.
Hi, thanks for your review! very efficient!
Hi CMD,
I've went
: Clement Mathieu--Drif
This series belongs to a list of series that add SVM support for VT-d.
As a starting point, we use the series called 'intel_iommu: Enable stage-1
translation' (rfc2) by Zhenzhong Duan and Yi Liu.
Here we focus on the implementation of ATS support in the IOMMU and on a
PCI
write, result,
+ result_length, err_count);
+}
+
void memory_region_notify_iommu_one(IOMMUNotifier *notifier,
IOMMUTLBEvent *event)
{
--
Regards,
Yi Liu
AP_WIDTH_SHIFT 8
#define PCI_PASID_CTRL0x06/* PASID control register */
#define PCI_PASID_CTRL_ENABLE0x0001 /* Enable bit */
#define PCI_PASID_CTRL_EXEC 0x0002 /* Exec permissions Enable */
--
Regards,
Yi Liu
tep = flpte;
-*flpte_level = level;
return 0;
}
addr = vtd_get_pte_addr(flpte, aw_bits);
-level--;
+(*flpte_level)--;
}
}
--
Regards,
Yi Liu
On 2024/7/2 23:29, CLEMENT MATHIEU--DRIF wrote:
On 02/07/2024 15:33, Yi Liu wrote:
Caution: External email. Do not open attachments or click links,
unless this email comes from a known sender and you know the content
is safe.
On 2024/7/2 13:52, CLEMENT MATHIEU--DRIF wrote:
From: Clément
On 2024/7/2 13:52, CLEMENT MATHIEU--DRIF wrote:
From: Clement Mathieu--Drif
This series belongs to a list of series that add SVM support for VT-d.
As a starting point, we use the series called 'intel_iommu: Enable stage-1
translation' (rfc2) by Zhenzhong Duan and Yi Liu.
Here we focus
stage-1
translation' (rfc2) by Zhenzhong Duan and Yi Liu.
Here we focus on the implementation of ATS support in the IOMMU and on a
PCI-level
API for ATS to be used by virtual devices.
This work is based on the VT-d specification version 4.1 (March 2023).
Here is a link to a GitHub repository
t with FN flag. Is it? Have you already seen a wait
descriptor that only has FN flag set but no SW nor IF flag?
} else {
error_report_once("%s: invalid wait desc: hi=%"PRIx64", lo=%"PRIx64
" (unknown type)", __func__, inv_desc->hi,
--
Regards,
Yi Liu
On 2024/7/2 13:52, CLEMENT MATHIEU--DRIF wrote:
From: Clément Mathieu--Drif
The 'level' field in vtd_iotlb_key is an unsigned integer.
We don't need to store level as an int in vtd_lookup_iotlb.
VTDIOTLBPageInvInfo.mask is used in binary operations with addresses.
Reviewed-by: Yi Liu
On 2024/7/2 13:52, CLEMENT MATHIEU--DRIF wrote:
From: Clément Mathieu--Drif
The constant must be unsigned, otherwise the two's complement
overrides the other fields when a PASID is present
does it need a fix tag since it overrides the other fields?
Reviewed-by: Yi Liu
Signed-off
apability via the cap/ecap registers. The new fault reasons in this
patch is meaningful only when the ecap.SMTS bit is set. So bumping version
does not mean too much about the introduction of new capabilities. @Jason,
given the above statements, can we reconsider if it is necessary to bump
up the version number?
--
Regards,
Yi Liu
ation.
But I'm not sure if there is a real scenario migrating to old qemu,
why not just update qemu on destination?
Thanks
Zhenzhong
--
Regards,
Yi Liu
On 2024/3/14 05:06, Cédric Le Goater wrote:
Make sure variable contents is freed if scanf fails.
Cc: Eric Auger
Cc: Yi Liu
Cc: Zhenzhong Duan
Fixes: CID 1540007
Fixes: 5ee3dc7af785 ("vfio/iommufd: Implement the iommufd backend")
Signed-off-by: Cédric Le Goater
---
hw/vfio/iom
On 2024/1/31 22:40, Joel Granados wrote:
On Mon, Jan 15, 2024 at 06:37:35PM +0800, Zhenzhong Duan wrote:
From: Yi Liu
Intel VT-d 3.0 introduces scalable mode, and it has a bunch of capabilities
related to scalable mode translation, thus there are multiple combinations.
While this vIOMMU
ommufd_device_init() are available in the new
place. And remember to destroy it if the code failed after initializing
iommufd_device.
--
Regards,
Yi Liu
On 2022/10/31 17:15, Jason Wang wrote:
On Mon, Oct 31, 2022 at 2:43 PM Michael S. Tsirkin wrote:
On Fri, Oct 28, 2022 at 09:49:36PM +0800, Yi Liu wrote:
On 2022/10/28 14:14, Jason Wang wrote:
This patch introduce ECAP_PASID via "x-pasid-mode". Based on the
existing support for sca
td_as = s->vtd_as_cache[bus_num];
+
+if (vtd_as &&
+(sid == PCI_BUILD_BDF(pci_bus_num(vtd_as->bus), vtd_as->devfn))) {
this checks sid as well. not sure if it can share the above helper.:-)
Besides the above nits, this patch looks good to me.
Reviewed-by: Yi Liu
ressSpace {
PCIBus *bus;
uint8_t devfn;
+uint32_t pasid;
AddressSpace as;
IOMMUMemoryRegion iommu;
MemoryRegion root; /* The root container of the device */
MemoryRegion nodmar;/* The alias of shared nodmar MR */
MemoryRegion iommu_ir; /* Interrupt region: 0xfeeX */
+MemoryRegion iommu_ir_fault; /* Interrupt region for catching fault */
IntelIOMMUState *iommu_state;
VTDContextCacheEntry context_cache_entry;
QLIST_ENTRY(VTDAddressSpace) next;
@@ -113,6 +115,7 @@ struct VTDAddressSpace {
struct VTDIOTLBEntry {
uint64_t gfn;
uint16_t domain_id;
+uint32_t pasid;
uint64_t slpte;
uint64_t mask;
uint8_t access_flags;
@@ -261,6 +264,7 @@ struct IntelIOMMUState {
uint8_t aw_bits;/* Host/IOVA address width (in bits) */
bool dma_drain; /* Whether DMA r/w draining enabled */
bool dma_translation; /* Whether DMA translation supported */
+bool pasid; /* Whether to support PASID */
/*
* Protects IOMMU states in general. Currently it protects the
@@ -272,6 +276,7 @@ struct IntelIOMMUState {
/* Find the VTD Address space associated with the given bus pointer,
* create a new one if none exists
*/
-VTDAddressSpace *vtd_find_add_as(IntelIOMMUState *s, PCIBus *bus, int devfn);
+VTDAddressSpace *vtd_find_add_as(IntelIOMMUState *s, PCIBus *bus,
+ int devfn, unsigned int pasid);
#endif
diff --git a/include/hw/pci/pci_bus.h b/include/hw/pci/pci_bus.h
index eb94e7e85c..5653175957 100644
--- a/include/hw/pci/pci_bus.h
+++ b/include/hw/pci/pci_bus.h
@@ -28,6 +28,8 @@ enum PCIBusFlags {
PCI_BUS_CXL = 0x0004,
};
+#define PCI_NO_PASID UINT32_MAX
+
struct PCIBus {
BusState qbus;
enum PCIBusFlags flags;
--
Regards,
Yi Liu
/intel_iommu.c | 42 --
1 file changed, 28 insertions(+), 14 deletions(-)
Reviewed-by: Yi Liu
diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c
index 9fe5a222eb..9029ee98f4 100644
--- a/hw/i386/intel_iommu.c
+++ b/hw/i386/intel_iommu.c
@@ -49,17 +49,6
to avoid using ret variable
---
hw/i386/intel_iommu.c | 12 ++--
1 file changed, 6 insertions(+), 6 deletions(-)
Reviewed-by: Yi Liu
diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c
index 6524c2ee32..271de995be 100644
--- a/hw/i386/intel_iommu.c
+++ b/hw/i386/intel_iommu.c
return (VTD_PE_GET_TYPE() == VTD_SM_PASID_ENTRY_PT);
--
Regards,
Yi Liu
evel_page_mask(level);
access_flags = IOMMU_ACCESS_FLAG(reads, writes);
--
Regards,
Yi Liu
the /dev/iommu device may have been pre-opened by a
management tool such as libvirt. This mode is no more considered
for the legacy backend. So let's remove the "TODO" comment.
Signed-off-by: Eric Auger
Signed-off-by: Yi Liu
Suggested-by: Alex Williamson
---
hw/vfio/as.c | 9 ++--
-by: Yi Liu
Suggested-by: Alex Williamson
---
MAINTAINERS | 7 ++
backends/Kconfig | 5 +
backends/iommufd.c | 265 +++
backends/meson.build | 1 +
backends/trace-events| 12 ++
include/sysemu/iommufd.h | 47 +++
qapi
From: Eric Auger
Let's turn attach/detach_device as container callbacks. That way,
their implementation can be easily customized for a given backend.
For the time being, only the legacy container is supported.
Signed-off-by: Eric Auger
Signed-off-by: Yi Liu
---
hw/vfio/as.c
the first iommufd container to other iommufd containers within the
address space. For legacy containers, IOVA mapping is done by
VFIO_IOMMU_MAP_DMA.
Signed-off-by: Yi Liu
---
hw/vfio/as.c | 117 ++
hw/vfio/container-base.c | 13
that only a subset of the container class callbacks is implemented.
Co-authored-by: Eric Auger
Signed-off-by: Eric Auger
Signed-off-by: Yi Liu
---
v1 -> v2:
- arbitrarily set bcontainer->pgsizes to 4K to fix interoperability
with virtio-iommu (Nicolin)
- add tear down in iommufd_attach_device
/dev/vfio/devices/vfioX may not exist. In that case it is still possible
to open /dev/char/$major:$minor instead. Add helper function to abstract
the cdev open.
Suggested-by: Jason Gunthorpe
Signed-off-by: Yi Liu
---
MAINTAINERS | 6 +
include/qemu/char_dev.h | 16
From: Eric Auger
Let the vfio-ap device use vfio_attach_device() and
vfio_detach_device(), hence hiding the details of the used
IOMMU backend.
Signed-off-by: Eric Auger
Signed-off-by: Yi Liu
---
hw/vfio/ap.c | 62
1 file changed, 9
-by: Eric Auger
Signed-off-by: Yi Liu
---
hw/vfio/container.c | 65 +++
hw/vfio/pci.c | 50 +++
include/hw/vfio/vfio-common.h | 2 ++
3 files changed, 72 insertions(+), 45 deletions(-)
diff --git a/hw/vfio/container.c b
functions, local to container.c.
Signed-off-by: Eric Auger
Signed-off-by: Yi Liu
---
hw/vfio/ccw.c | 118 --
hw/vfio/container.c | 8 +--
include/hw/vfio/vfio-common.h | 4 --
3 files changed, 32 insertions(+), 98 deletions(-)
diff --git
to a place that is not backend-specific
(first vfio address space created instead of the first group).
Signed-off-by: Eric Auger
Signed-off-by: Yi Liu
---
hw/vfio/as.c | 18 ++
hw/vfio/container-base.c | 9 +
hw/vfio/container.c
From: Eric Auger
Let the vfio-platform device use vfio_attach_device() and
vfio_detach_device(), hence hiding the details of the used
IOMMU backend.
Signed-off-by: Eric Auger
Signed-off-by: Yi Liu
---
hw/vfio/platform.c | 42 ++
1 file changed, 2
tach/detach]_device container
callbacks
vfio/container-base: Introduce VFIOContainer reset callback
backends/iommufd: Introduce the iommufd object
vfio/as: Allow the selection of a given iommu backend
Yi Liu (5):
vfio/common: Split common.c into common.c, container.c and as.c
vfio: Add b
From: Eric Auger
Update the script to import iommufd.h
Signed-off-by: Eric Auger
Signed-off-by: Yi Liu
---
scripts/update-linux-headers.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/update-linux-headers.sh b/scripts/update-linux-headers.sh
index 839a5ec614
) group_list;
};
Co-authored-by: Eric Auger
Signed-off-by: Eric Auger
Signed-off-by: Yi Liu
---
v1 -> v2:
- Remove QOM for VFIOContainer object, use callback instead per David's
comment.
- Rename container-obj.c/.h to be container-base.c/.h
---
hw/vfio/as.c | 48 +++---
From: Eric Auger
Imported from https://github.com/luxis1999/iommufd/tree/iommufd-v5.17-rc6
Signed-off-by: Eric Auger
Signed-off-by: Yi Liu
---
linux-headers/linux/iommufd.h | 223 ++
linux-headers/linux/vfio.h| 84 +
2 files changed, 307
On 2022/5/18 15:22, zhangfei@foxmail.com wrote:
On 2022/5/17 下午4:55, Yi Liu wrote:
Hi Zhangfei,
On 2022/5/12 17:01, zhangfei@foxmail.com wrote:
Hi, Yi
On 2022/5/11 下午10:17, zhangfei@foxmail.com wrote:
On 2022/5/10 下午10:08, Yi Liu wrote:
On 2022/5/10 20:45, Jason Gunthorpe
Hi Zhangfei,
On 2022/5/12 17:01, zhangfei@foxmail.com wrote:
Hi, Yi
On 2022/5/11 下午10:17, zhangfei@foxmail.com wrote:
On 2022/5/10 下午10:08, Yi Liu wrote:
On 2022/5/10 20:45, Jason Gunthorpe wrote:
On Tue, May 10, 2022 at 08:35:00PM +0800, Zhangfei Gao wrote:
Thanks Yi and Eric
Hi Zhangfei,
On 2022/5/11 22:17, zhangfei@foxmail.com wrote:
On 2022/5/10 下午10:08, Yi Liu wrote:
On 2022/5/10 20:45, Jason Gunthorpe wrote:
On Tue, May 10, 2022 at 08:35:00PM +0800, Zhangfei Gao wrote:
Thanks Yi and Eric,
Then will wait for the updated iommufd kernel for the PCI MMIO
the hwpt) it should be returned by
the vfio attach ioctl.
yes, hwpt_id is returned by the vfio attach ioctl and recorded in
qemu. You can query page table related capabilities with this id.
https://lore.kernel.org/kvm/20220414104710.28534-16-yi.l@intel.com/
--
Regards,
Yi Liu
Kolothum Thodi ; Yi
Liu ; alex.william...@redhat.com; coh...@redhat.com;
qemu-devel@nongnu.org
Cc: da...@gibson.dropbear.id.au; th...@redhat.com; far...@linux.ibm.com;
mjros...@linux.ibm.com; akrow...@linux.ibm.com; pa...@linux.ibm.com;
jjhe...@linux.ibm.com; jasow...@redhat.com; k
On 2022/4/29 14:29, David Gibson wrote:
On Thu, Apr 14, 2022 at 03:46:59AM -0700, Yi Liu wrote:
Qomify the VFIOContainer object which acts as a base class for a
container. This base class is derived into the legacy VFIO container
and later on, into the new iommufd based container.
You
From: Eric Auger
Properly output the errno string.
Signed-off-by: Eric Auger
Signed-off-by: Yi Liu
---
hw/vfio/pci.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c
index 9fd9faee1d..4a66376be6 100644
--- a/hw/vfio/pci.c
+++ b/hw/vfio/pci.c
Rename VFIOGuestIOMMU iommu field into iommu_mr. Then it becomes clearer
it is an IOMMU memory region.
no functional change intended
Signed-off-by: Yi Liu
---
hw/vfio/common.c | 16
include/hw/vfio/vfio-common.h | 2 +-
2 files changed, 9 insertions(+), 9
The three patches were part of iommufd RFC series, sent separately per
Kevin's suggestion.
https://lore.kernel.org/kvm/bn9pr11mb5276085cdf750807005a775b8c...@bn9pr11mb5276.namprd11.prod.outlook.com/
Regards,
Yi Liu
Eric Auger (2):
hw/vfio/pci: fix vfio_pci_hot_reset_result trace point
vfio
From: Eric Auger
Using a VFIODevice handle local variable to improve the code readability.
no functional change intended
Signed-off-by: Eric Auger
Signed-off-by: Yi Liu
---
hw/vfio/pci.c | 49 +
1 file changed, 25 insertions(+), 24 deletions
gt; can fail in a variety of ways."
Though, it is not so important that it is urgent (and copy makes it
work better anyhow), qemu can stay as it is.
yes. as a start, keep it would be simpler.
Jason
--
Regards,
Yi Liu
Hi Jason,
On 2022/4/22 22:58, Jason Gunthorpe wrote:
On Thu, Apr 14, 2022 at 03:47:07AM -0700, Yi Liu wrote:
+static int vfio_get_devicefd(const char *sysfs_path, Error **errp)
+{
+long int vfio_id = -1, ret = -ENOTTY;
+char *path, *tmp = NULL;
+DIR *dir;
+struct dirent *dent
m/0-v1-a8faf768d202+125dd-
vfio_mdev_no_group_...@nvidia.com/
Following is probably more relevant to [4]:
https://lore.kernel.org/all/10-v1-33906a626da1+16b0-vfio_kvm_no_group_...@nvidia.com/
absolutely.:-) thanks.
Thanks
Kevin
--
Regards,
Yi Liu
that only a subset of the container class callbacks is implemented.
Co-authored-by: Eric Auger
Signed-off-by: Eric Auger
Signed-off-by: Yi Liu
---
hw/vfio/as.c | 2 +-
hw/vfio/iommufd.c| 545 +++
hw/vfio/meson.build
functions, local to container.c.
Signed-off-by: Eric Auger
Signed-off-by: Yi Liu
---
hw/vfio/ccw.c | 118 --
hw/vfio/container.c | 8 +--
include/hw/vfio/vfio-common.h | 4 --
3 files changed, 32 insertions(+), 98 deletions(-)
diff --git
From: Eric Auger
Let the vfio-ap device use vfio_attach_device() and
vfio_detach_device(), hence hiding the details of the used
IOMMU backend.
Signed-off-by: Eric Auger
Signed-off-by: Yi Liu
---
hw/vfio/ap.c | 62
1 file changed, 9
From: Eric Auger
This auto/on/off option allows the user to force a the select
the iommu BE (iommufd or legacy).
Signed-off-by: Eric Auger
Signed-off-by: Yi Liu
---
hw/vfio/pci.c | 26 ++
1 file changed, 26 insertions(+)
diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c
From: Eric Auger
Now we support two types of iommu backends, let's add the capability
to select one of them. This is based on a VFIODevice auto/on/off
iommu_be field. This field is likely to be forced to a given value or
set by a device option.
Signed-off-by: Eric Auger
Signed-off-by: Yi Liu
;
QLIST_HEAD(, VFIOGroup) group_list;
};
Co-authored-by: Eric Auger
Signed-off-by: Eric Auger
Signed-off-by: Yi Liu
---
hw/vfio/as.c | 48 +++---
hw/vfio/container-obj.c | 195 +++
hw/vfio/container.c | 224
the first iommufd container to other iommufd containers within the
address space. For legacy containers, IOVA mapping is done by
VFIO_IOMMU_MAP_DMA.
Signed-off-by: Yi Liu
---
hw/vfio/as.c | 117 +++
hw/vfio/container-obj.c | 17
Introduce iommufd utility library which can be compiled out with
CONFIG_IOMMUFD configuration. This code is bound to be called by
several subsystems: vdpa, and vfio.
Co-authored-by: Eric Auger
Signed-off-by: Eric Auger
Signed-off-by: Yi Liu
---
MAINTAINERS | 7 ++
hw
From: Eric Auger
Let the vfio-platform device use vfio_attach_device() and
vfio_detach_device(), hence hiding the details of the used
IOMMU backend.
Signed-off-by: Eric Auger
Signed-off-by: Yi Liu
---
hw/vfio/platform.c | 42 ++
1 file changed, 2
-by: Eric Auger
Signed-off-by: Yi Liu
---
hw/vfio/container.c | 65 +++
hw/vfio/pci.c | 50 +++
include/hw/vfio/vfio-common.h | 2 ++
3 files changed, 72 insertions(+), 45 deletions(-)
diff --git a/hw/vfio/container.c b
From: Eric Auger
Let's turn attach/detach_device as container callbacks. That way,
their implementation can be easily customized for a given backend.
For the time being, only the legacy container is supported.
Signed-off-by: Eric Auger
Signed-off-by: Yi Liu
---
hw/vfio/as.c
From: Eric Auger
Imported from https://github.com/luxis1999/iommufd/tree/iommufd-v5.17-rc6
Signed-off-by: Eric Auger
Signed-off-by: Yi Liu
---
linux-headers/linux/iommufd.h | 223 ++
linux-headers/linux/vfio.h| 84 +
2 files changed, 307
From: Eric Auger
Using a VFIODevice handle local variable to improve the code readability.
no functional change intended
Signed-off-by: Eric Auger
Signed-off-by: Yi Liu
---
hw/vfio/pci.c | 49 +
1 file changed, 25 insertions(+), 24 deletions
Rename VFIOGuestIOMMU iommu field into iommu_mr. Then it becomes clearer
it is an IOMMU memory region.
no functional change intended
Signed-off-by: Yi Liu
---
hw/vfio/common.c | 16
include/hw/vfio/vfio-common.h | 2 +-
2 files changed, 9 insertions(+), 9
to a place that is not backend-specific
(first vfio address space created instead of the first group).
Signed-off-by: Eric Auger
Signed-off-by: Yi Liu
---
hw/vfio/as.c | 18 ++
hw/vfio/container-obj.c | 13 +
hw/vfio/container.c
iommufd option
Yi Liu (6):
vfio/common: Rename VFIOGuestIOMMU::iommu into ::iommu_mr
vfio/common: Split common.c into common.c, container.c and as.c
vfio: Add base object for VFIOContainer
hw/iommufd: Creation
vfio/iommufd: Implement iommufd backend
vfio/iommufd: Add IOAS_COPY_DMA
From: Eric Auger
Properly output the errno string.
Signed-off-by: Eric Auger
Signed-off-by: Yi Liu
---
hw/vfio/pci.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c
index 67a183f17b..e26e65bb1f 100644
--- a/hw/vfio/pci.c
+++ b/hw/vfio/pci.c
From: Eric Auger
Update the script to import iommufd.h
Signed-off-by: Eric Auger
Signed-off-by: Yi Liu
---
scripts/update-linux-headers.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/update-linux-headers.sh b/scripts/update-linux-headers.sh
index 839a5ec614
On 2022/3/29 12:54, Jason Wang wrote:
在 2022/3/28 下午4:45, Yi Liu 写道:
On 2022/3/21 13:54, Jason Wang wrote:
This patch introduce ECAP_PASID via "x-pasid-mode". Based on the
existing support for scalable mode, we need to implement the following
missing parts:
1) tag VTDAd
IOMMU support was following 3.0 spec, while RPS is added in 3.1. Needs
to be fixed.
Thanks
return false;
}
return (VTD_PE_GET_TYPE() == VTD_SM_PASID_ENTRY_PT);
--
2.25.1
--
Regards,
Yi Liu
{
struct VTDIOTLBEntry {
uint64_t gfn;
uint16_t domain_id;
+uint32_t pasid;
uint64_t slpte;
uint64_t mask;
uint8_t access_flags;
@@ -260,6 +263,7 @@ struct IntelIOMMUState {
bool buggy_eim; /* Force buggy EIM unless eim=off */
uint8_t aw_bits;/* Host/IOVA address width (in bits) */
bool dma_drain; /* Whether DMA r/w draining enabled */
+bool pasid; /* Whether to support PASID */
/*
* Protects IOMMU states in general. Currently it protects the
@@ -271,6 +275,7 @@ struct IntelIOMMUState {
/* Find the VTD Address space associated with the given bus pointer,
* create a new one if none exists
*/
-VTDAddressSpace *vtd_find_add_as(IntelIOMMUState *s, PCIBus *bus, int devfn);
+VTDAddressSpace *vtd_find_add_as(IntelIOMMUState *s, PCIBus *bus,
+ int devfn, unsigned int pasid);
#endif
diff --git a/include/hw/pci/pci_bus.h b/include/hw/pci/pci_bus.h
index 347440d42c..cbfcf0b770 100644
--- a/include/hw/pci/pci_bus.h
+++ b/include/hw/pci/pci_bus.h
@@ -26,6 +26,8 @@ enum PCIBusFlags {
PCI_BUS_EXTENDED_CONFIG_SPACE = 0x0002,
};
+#define PCI_NO_PASID UINT32_MAX
+
struct PCIBus {
BusState qbus;
enum PCIBusFlags flags;
--
Regards,
Yi Liu
89 matches
Mail list logo