qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v3 07/37] vfio/container: Introduce a empty VFIOIOMMUOps


From: Cédric Le Goater
Subject: Re: [PATCH v3 07/37] vfio/container: Introduce a empty VFIOIOMMUOps
Date: Fri, 27 Oct 2023 16:20:53 +0200
User-agent: Mozilla Thunderbird

On 10/26/23 12:30, Zhenzhong Duan wrote:
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>
---
  include/hw/vfio/vfio-common.h | 2 +-
  hw/vfio/container.c           | 5 +++++
  2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/include/hw/vfio/vfio-common.h b/include/hw/vfio/vfio-common.h
index d8f293cb57..8ded5cd8e4 100644
--- a/include/hw/vfio/vfio-common.h
+++ b/include/hw/vfio/vfio-common.h
@@ -255,7 +255,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;


why does it need to be external ?

Thanks,

C.


  extern const MemoryListener vfio_memory_listener;
  extern int vfio_kvm_device_fd;
diff --git a/hw/vfio/container.c b/hw/vfio/container.c
index 242010036a..4bc43ddfa4 100644
--- a/hw/vfio/container.c
+++ b/hw/vfio/container.c
@@ -472,6 +472,7 @@ static int vfio_connect_container(VFIOGroup *group, 
AddressSpace *as,
                                    Error **errp)
  {
      VFIOContainer *container;
+    VFIOContainerBase *bcontainer;
      int ret, fd;
      VFIOAddressSpace *space;
@@ -552,6 +553,8 @@ static int vfio_connect_container(VFIOGroup *group, AddressSpace *as,
      container->iova_ranges = NULL;
      QLIST_INIT(&container->giommu_list);
      QLIST_INIT(&container->vrdl_list);
+    bcontainer = &container->bcontainer;
+    bcontainer->ops = &vfio_legacy_ops;
ret = vfio_init_container(container, group->fd, errp);
      if (ret) {
@@ -933,3 +936,5 @@ void vfio_detach_device(VFIODevice *vbasedev)
      vfio_put_base_device(vbasedev);
      vfio_put_group(group);
  }
+
+const VFIOIOMMUOps vfio_legacy_ops;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]