58 lines
1.8 KiB
Diff
58 lines
1.8 KiB
Diff
|
|
From 184e5195a815d57701cd9358f4b0537025729833 Mon Sep 17 00:00:00 2001
|
||
|
|
From: libai <libai12@huawei.com>
|
||
|
|
Date: Wed, 26 Mar 2025 20:44:40 +0800
|
||
|
|
Subject: [PATCH] vdpa/iommufd:support associating iommufd backend for vDPA
|
||
|
|
devices
|
||
|
|
|
||
|
|
The following parameters can associate the iommufd object with the vdpa device:
|
||
|
|
|
||
|
|
-object iommufd,id=iommufd1
|
||
|
|
-device '{
|
||
|
|
"driver":"vhost-vdpa-device-pci",
|
||
|
|
"id":"vhostdev0",
|
||
|
|
"vhostdev":"/dev/vhost-vdpa-1",
|
||
|
|
"iommufd":"iommufd1",
|
||
|
|
}'
|
||
|
|
|
||
|
|
Signed-off-by: libai <libai12@huawei.com>
|
||
|
|
---
|
||
|
|
hw/virtio/vdpa-dev.c | 1 +
|
||
|
|
include/hw/virtio/vdpa-dev.h | 2 ++
|
||
|
|
2 files changed, 3 insertions(+)
|
||
|
|
|
||
|
|
diff --git a/hw/virtio/vdpa-dev.c b/hw/virtio/vdpa-dev.c
|
||
|
|
index bd787cf39c..9ce7ed7eae 100644
|
||
|
|
--- a/hw/virtio/vdpa-dev.c
|
||
|
|
+++ b/hw/virtio/vdpa-dev.c
|
||
|
|
@@ -356,6 +356,7 @@ static void vhost_vdpa_device_set_status(VirtIODevice *vdev, uint8_t status)
|
||
|
|
static Property vhost_vdpa_device_properties[] = {
|
||
|
|
DEFINE_PROP_STRING("vhostdev", VhostVdpaDevice, vhostdev),
|
||
|
|
DEFINE_PROP_UINT16("queue-size", VhostVdpaDevice, queue_size, 0),
|
||
|
|
+ DEFINE_PROP_LINK("iommufd", VhostVdpaDevice, iommufd, TYPE_IOMMUFD_BACKEND, IOMMUFDBackend *),
|
||
|
|
DEFINE_PROP_END_OF_LIST(),
|
||
|
|
};
|
||
|
|
|
||
|
|
diff --git a/include/hw/virtio/vdpa-dev.h b/include/hw/virtio/vdpa-dev.h
|
||
|
|
index 60e9c3f3fe..accdb7fa28 100644
|
||
|
|
--- a/include/hw/virtio/vdpa-dev.h
|
||
|
|
+++ b/include/hw/virtio/vdpa-dev.h
|
||
|
|
@@ -18,6 +18,7 @@
|
||
|
|
#include "hw/virtio/vhost.h"
|
||
|
|
#include "hw/virtio/vhost-vdpa.h"
|
||
|
|
#include "qom/object.h"
|
||
|
|
+#include "sysemu/iommufd.h"
|
||
|
|
|
||
|
|
|
||
|
|
#define TYPE_VHOST_VDPA_DEVICE "vhost-vdpa-device"
|
||
|
|
@@ -41,6 +42,7 @@ struct VhostVdpaDevice {
|
||
|
|
int (*post_init)(VhostVdpaDevice *v, Error **errp);
|
||
|
|
VMChangeStateEntry *vmstate;
|
||
|
|
Notifier migration_state;
|
||
|
|
+ IOMMUFDBackend *iommufd;
|
||
|
|
};
|
||
|
|
|
||
|
|
#endif
|
||
|
|
--
|
||
|
|
2.41.0.windows.1
|
||
|
|
|