64 lines
2.2 KiB
Diff
64 lines
2.2 KiB
Diff
|
|
From bda13dc55ae5e16174a4a611353f4bb8a590d510 Mon Sep 17 00:00:00 2001
|
||
|
|
From: Zhenzhong Duan <zhenzhong.duan@intel.com>
|
||
|
|
Date: Sat, 11 Jan 2025 10:52:19 +0800
|
||
|
|
Subject: [PATCH] vfio/container: Introduce a empty VFIOIOMMUOps
|
||
|
|
MIME-Version: 1.0
|
||
|
|
Content-Type: text/plain; charset=UTF-8
|
||
|
|
Content-Transfer-Encoding: 8bit
|
||
|
|
|
||
|
|
This empty VFIOIOMMUOps named vfio_legacy_ops will hold all general
|
||
|
|
IOMMU ops of legacy container.
|
||
|
|
|
||
|
|
Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
|
||
|
|
Reviewed-by: Cédric Le Goater <clg@redhat.com>
|
||
|
|
Signed-off-by: Cédric Le Goater <clg@redhat.com>
|
||
|
|
Signed-off-by: Zhou Wang <wangzhou1@hisilicon.com>
|
||
|
|
---
|
||
|
|
hw/vfio/container.c | 5 +++++
|
||
|
|
include/hw/vfio/vfio-common.h | 2 +-
|
||
|
|
2 files changed, 6 insertions(+), 1 deletion(-)
|
||
|
|
|
||
|
|
diff --git a/hw/vfio/container.c b/hw/vfio/container.c
|
||
|
|
index 77e61cfedd..8d8ed13e93 100644
|
||
|
|
--- a/hw/vfio/container.c
|
||
|
|
+++ b/hw/vfio/container.c
|
||
|
|
@@ -565,6 +565,7 @@ static int vfio_connect_container(VFIOGroup *group, AddressSpace *as,
|
||
|
|
Error **errp)
|
||
|
|
{
|
||
|
|
VFIOContainer *container;
|
||
|
|
+ VFIOContainerBase *bcontainer;
|
||
|
|
int ret, fd;
|
||
|
|
VFIOAddressSpace *space;
|
||
|
|
|
||
|
|
@@ -646,6 +647,8 @@ static int vfio_connect_container(VFIOGroup *group, AddressSpace *as,
|
||
|
|
QLIST_INIT(&container->giommu_list);
|
||
|
|
QLIST_INIT(&container->vrdl_list);
|
||
|
|
QLIST_INIT(&container->dma_list);
|
||
|
|
+ bcontainer = &container->bcontainer;
|
||
|
|
+ bcontainer->ops = &vfio_legacy_ops;
|
||
|
|
|
||
|
|
ret = vfio_init_container(container, group->fd, errp);
|
||
|
|
if (ret) {
|
||
|
|
@@ -1046,3 +1049,5 @@ void vfio_detach_device(VFIODevice *vbasedev)
|
||
|
|
vfio_put_base_device(vbasedev);
|
||
|
|
vfio_put_group(group);
|
||
|
|
}
|
||
|
|
+
|
||
|
|
+const VFIOIOMMUOps vfio_legacy_ops;
|
||
|
|
diff --git a/include/hw/vfio/vfio-common.h b/include/hw/vfio/vfio-common.h
|
||
|
|
index c89b5886f2..3a0a6ab6ee 100644
|
||
|
|
--- a/include/hw/vfio/vfio-common.h
|
||
|
|
+++ b/include/hw/vfio/vfio-common.h
|
||
|
|
@@ -268,7 +268,7 @@ typedef QLIST_HEAD(VFIOGroupList, VFIOGroup) VFIOGroupList;
|
||
|
|
typedef QLIST_HEAD(VFIODeviceList, VFIODevice) VFIODeviceList;
|
||
|
|
extern VFIOGroupList vfio_group_list;
|
||
|
|
extern VFIODeviceList vfio_device_list;
|
||
|
|
-
|
||
|
|
+extern const VFIOIOMMUOps vfio_legacy_ops;
|
||
|
|
extern const MemoryListener vfio_memory_listener;
|
||
|
|
extern int vfio_kvm_device_fd;
|
||
|
|
|
||
|
|
--
|
||
|
|
2.41.0.windows.1
|
||
|
|
|