1 Star 0 Fork 126

ganqx/src-qemu

forked from src-openEuler/qemu 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
vga-Force-full-update-for-CSV3-guest.patch 3.71 KB
一键复制 编辑 原始数据 按行查看 历史
Jiabo Feng 提交于 2024-12-12 17:01 . QEMU update to version 8.2.0-26:
From b791d13a0630e6640b3c39dc90671a2150734a24 Mon Sep 17 00:00:00 2001
From: Xin Jiang <jiangxin@hygon.cn>
Date: Thu, 13 Jul 2023 09:35:10 +0800
Subject: [PATCH] vga: Force full update for CSV3 guest
As CSV3's NPT(nested page table) is managed by firmware, VMM is hard
to track the dirty pages of vga buffer. Although VMM could perform
a command to firmware to update read/write attribute of vga buffer
in NPT, it costs more time due to communication between VMM and
firmware. So the simplest method is to fully update vga buffer
always.
Signed-off-by: Xin Jiang <jiangxin@hygon.cn>
Signed-off-by: hanliyang <hanliyang@hygon.cn>
---
accel/kvm/kvm-all.c | 1 +
accel/stubs/kvm-stub.c | 2 ++
hw/display/vga.c | 7 +++++++
include/sysemu/kvm.h | 8 ++++++++
target/i386/csv.c | 3 +++
5 files changed, 21 insertions(+)
diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c
index 8077630825..8028caddf9 100644
--- a/accel/kvm/kvm-all.c
+++ b/accel/kvm/kvm-all.c
@@ -103,6 +103,7 @@ bool kvm_allowed;
bool kvm_readonly_mem_allowed;
bool kvm_vm_attributes_allowed;
bool kvm_msi_use_devid;
+bool kvm_csv3_allowed;
bool kvm_has_guest_debug;
static int kvm_sstep_flags;
static bool kvm_immediate_exit;
diff --git a/accel/stubs/kvm-stub.c b/accel/stubs/kvm-stub.c
index ad39a434c4..b071afee45 100644
--- a/accel/stubs/kvm-stub.c
+++ b/accel/stubs/kvm-stub.c
@@ -27,6 +27,8 @@ bool kvm_msi_use_devid;
bool virtcca_cvm_allowed;
+bool kvm_csv3_allowed;
+
void kvm_flush_coalesced_mmio_buffer(void)
{
}
diff --git a/hw/display/vga.c b/hw/display/vga.c
index cb6b6ee2ca..3f1358676b 100644
--- a/hw/display/vga.c
+++ b/hw/display/vga.c
@@ -39,6 +39,8 @@
#include "migration/vmstate.h"
#include "trace.h"
+#include "sysemu/kvm.h"
+
//#define DEBUG_VGA_MEM
//#define DEBUG_VGA_REG
@@ -1790,6 +1792,11 @@ static void vga_update_display(void *opaque)
s->cursor_blink_time = qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL);
full_update = 1;
}
+
+ /* Force to full update in CSV guest. */
+ if (kvm_csv3_enabled())
+ full_update = 1;
+
switch(graphic_mode) {
case GMODE_TEXT:
vga_draw_text(s, full_update);
diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h
index 31af5f0e24..fd8634cc8f 100644
--- a/include/sysemu/kvm.h
+++ b/include/sysemu/kvm.h
@@ -44,6 +44,7 @@ extern bool kvm_gsi_routing_allowed;
extern bool kvm_gsi_direct_mapping;
extern bool kvm_readonly_mem_allowed;
extern bool kvm_msi_use_devid;
+extern bool kvm_csv3_allowed;
#define kvm_enabled() (kvm_allowed)
#define virtcca_cvm_enabled() (virtcca_cvm_allowed)
@@ -147,6 +148,12 @@ extern bool kvm_msi_use_devid;
*/
#define kvm_msi_devid_required() (kvm_msi_use_devid)
+/**
+ * kvm_csv3_enabled:
+ * Returns: true if CSV3 feature is used for the VM.
+ */
+#define kvm_csv3_enabled() (kvm_csv3_allowed)
+
#else
#define kvm_enabled() (0)
@@ -163,6 +170,7 @@ extern bool kvm_msi_use_devid;
#define kvm_gsi_direct_mapping() (false)
#define kvm_readonly_mem_enabled() (false)
#define kvm_msi_devid_required() (false)
+#define kvm_csv3_enabled() (false)
#endif /* CONFIG_KVM_IS_POSSIBLE */
diff --git a/target/i386/csv.c b/target/i386/csv.c
index 12282ba451..65d87de003 100644
--- a/target/i386/csv.c
+++ b/target/i386/csv.c
@@ -14,6 +14,7 @@
#include "qemu/osdep.h"
#include "qemu/error-report.h"
#include "qapi/error.h"
+#include "sysemu/kvm.h"
#include <linux/kvm.h>
@@ -60,6 +61,8 @@ csv3_init(uint32_t policy, int fd, void *state, struct sev_ops *ops)
return -1;
}
+ kvm_csv3_allowed = true;
+
csv3_guest.sev_fd = fd;
csv3_guest.state = state;
csv3_guest.sev_ioctl = ops->sev_ioctl;
--
2.41.0.windows.1
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/ganqx/src-qemu.git
git@gitee.com:ganqx/src-qemu.git
ganqx
src-qemu
src-qemu
master

搜索帮助