1 Star 0 Fork 126

wanglmb/qemu

forked from src-openEuler/qemu 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
vfio-migration-Fix-incorrect-initialization-value-fo.patch 1.54 KB
一键复制 编辑 原始数据 按行查看 历史
yezengruan 提交于 2022-11-22 17:45 . Qemu update to version 6.2.0-59
From d57f2527fd747d2b51ad18dc38fa9d0c25ebc8a7 Mon Sep 17 00:00:00 2001
From: Kunkun Jiang <jiangkunkun@huawei.com>
Date: Mon, 11 Jul 2022 09:46:51 +0800
Subject: [PATCH 2/3] vfio/migration: Fix incorrect initialization value for
parameters in VFIOMigration
The structure VFIOMigration of a VFIODevice is allocated and initialized
in vfio_migration_init(). "device_state" and "vm_running" are initialized
to 0, indicating that VFIO device is_STOP and VM is not-running. The
initialization value is incorrect. According to the agreement, default
state of VFIO device is _RUNNING. And if a VFIO device is hot-plugged
while the VM is running, "vm_running" should be 1. This patch fixes it.
Fixes: 02a7e71b1e5b ("vfio: Add VM state change handler to know state of VM")
Signed-off-by: Kunkun Jiang <jiangkunkun@huawei.com>
Link: https://lore.kernel.org/r/20220711014651.1327-1-jiangkunkun@huawei.com
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
---
hw/vfio/migration.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/hw/vfio/migration.c b/hw/vfio/migration.c
index ff6b45de6b..e69b5f2e42 100644
--- a/hw/vfio/migration.c
+++ b/hw/vfio/migration.c
@@ -805,6 +805,8 @@ static int vfio_migration_init(VFIODevice *vbasedev,
}
vbasedev->migration = g_new0(VFIOMigration, 1);
+ vbasedev->migration->device_state = VFIO_DEVICE_STATE_RUNNING;
+ vbasedev->migration->vm_running = runstate_is_running();
ret = vfio_region_setup(obj, vbasedev, &vbasedev->migration->region,
info->index, "migration");
--
2.27.0
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/wanglmb/qemu.git
git@gitee.com:wanglmb/qemu.git
wanglmb
qemu
qemu
master

搜索帮助