1 Star 0 Fork 126

ganqx/src-qemu

forked from src-openEuler/qemu 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
vdpa-support-resizing-virtio-blk-capacity-online-for.patch 1.40 KB
一键复制 编辑 原始数据 按行查看 历史
fangyi 提交于 2024-11-28 00:07 . support kernel vDpa
From 8c65e8d7c923ade6f3c7fbef43000562d4733629 Mon Sep 17 00:00:00 2001
From: fangyi <eric.fangyi@huawei.com>
Date: Sat, 7 Sep 2024 07:11:07 +0000
Subject: [PATCH 2/6] vdpa: support resizing virtio-blk capacity online for
kernel vdpa
Signed-off-by: fangyi <eric.fangyi@huawei.com>
---
hw/virtio/vdpa-dev.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/hw/virtio/vdpa-dev.c b/hw/virtio/vdpa-dev.c
index 91e71847b0..bf4b3ec3fd 100644
--- a/hw/virtio/vdpa-dev.c
+++ b/hw/virtio/vdpa-dev.c
@@ -31,6 +31,7 @@
#include "hw/virtio/vdpa-dev-mig.h"
#include "migration/migration.h"
#include "exec/address-spaces.h"
+#include "standard-headers/linux/virtio_ids.h"
static void
vhost_vdpa_device_dummy_handle_output(VirtIODevice *vdev, VirtQueue *vq)
@@ -201,7 +202,23 @@ static void
vhost_vdpa_device_get_config(VirtIODevice *vdev, uint8_t *config)
{
VhostVdpaDevice *s = VHOST_VDPA_DEVICE(vdev);
+ uint8_t *new_config;
+ int ret;
+
+ if (s->vdev_id != VIRTIO_ID_BLOCK) {
+ goto out;
+ }
+ new_config = g_malloc0(s->config_size);
+ ret = vhost_dev_get_config(&s->dev, new_config, s->config_size, NULL);
+ if (ret < 0) {
+ error_report("vhost-vdpa-device: get config failed(%d)\n", ret);
+ goto free;
+ }
+ memcpy(s->config, new_config, s->config_size);
+free:
+ g_free(new_config);
+out:
memcpy(config, s->config, s->config_size);
}
--
2.43.0
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/ganqx/src-qemu.git
git@gitee.com:ganqx/src-qemu.git
ganqx
src-qemu
src-qemu
master

搜索帮助