[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 07/10] vdpa-dev: implement the get_config/set_config interface
|
From: |
Longpeng(Mike) |
|
Subject: |
[PATCH v2 07/10] vdpa-dev: implement the get_config/set_config interface |
|
Date: |
Mon, 17 Jan 2022 20:43:28 +0800 |
From: Longpeng <longpeng2@huawei.com>
Implements the .get_config and .set_config interface.
Signed-off-by: Longpeng <longpeng2@huawei.com>
---
hw/virtio/vdpa-dev.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/hw/virtio/vdpa-dev.c b/hw/virtio/vdpa-dev.c
index e5691d02bb..cef0a58012 100644
--- a/hw/virtio/vdpa-dev.c
+++ b/hw/virtio/vdpa-dev.c
@@ -162,13 +162,23 @@ static void vhost_vdpa_device_unrealize(DeviceState *dev)
static void
vhost_vdpa_device_get_config(VirtIODevice *vdev, uint8_t *config)
{
- return;
+ VhostVdpaDevice *s = VHOST_VDPA_DEVICE(vdev);
+
+ memcpy(config, s->config, s->config_size);
}
static void
vhost_vdpa_device_set_config(VirtIODevice *vdev, const uint8_t *config)
{
- return;
+ VhostVdpaDevice *s = VHOST_VDPA_DEVICE(vdev);
+ int ret;
+
+ ret = vhost_dev_set_config(&s->dev, s->config, 0, s->config_size,
+ VHOST_SET_CONFIG_TYPE_MASTER);
+ if (ret) {
+ error_report("set device config space failed");
+ return;
+ }
}
static uint64_t vhost_vdpa_device_get_features(VirtIODevice *vdev,
--
2.23.0
- [PATCH v2 00/10] add generic vDPA device support, Longpeng(Mike), 2022/01/17
- [PATCH v2 02/10] update linux headers, Longpeng(Mike), 2022/01/17
- [PATCH v2 04/10] vdpa-dev: implement the instance_init/class_init interface, Longpeng(Mike), 2022/01/17
- [PATCH v2 09/10] vdpa-dev: implement the set_status interface, Longpeng(Mike), 2022/01/17
- [PATCH v2 07/10] vdpa-dev: implement the get_config/set_config interface,
Longpeng(Mike) <=
- [PATCH v2 08/10] vdpa-dev: implement the get_features interface, Longpeng(Mike), 2022/01/17
- [PATCH v2 01/10] virtio: get class_id and pci device id by the virtio id, Longpeng(Mike), 2022/01/17
- [PATCH v2 03/10] vdpa: add the infrastructure of vdpa-dev, Longpeng(Mike), 2022/01/17
- [PATCH v2 10/10] vdpa-dev: mark the device as unmigratable, Longpeng(Mike), 2022/01/17
- [PATCH v2 06/10] vdpa-dev: implement the unrealize interface, Longpeng(Mike), 2022/01/17
- [PATCH v2 05/10] vdpa-dev: implement the realize interface, Longpeng(Mike), 2022/01/17