加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
kvm-arm-Fix-compatibility-of-cold-plug-CPU-with-SVE.patch 1.88 KB
一键复制 编辑 原始数据 按行查看 历史
Jiabo Feng 提交于 2024-05-10 16:44 . QEMU update to version 8.2.0-12:
From baacc5ed528a5259286622482a01e3e848aed57e Mon Sep 17 00:00:00 2001
From: Keqian Zhu <zhukeqian1@huawei.com>
Date: Mon, 29 Apr 2024 17:14:47 +0800
Subject: [PATCH] kvm/arm: Fix compatibility of cold-plug CPU with SVE
For arm virt machine, besides hotplugged vcpu, the kvm state of
coldplugged CPU is also pre-inited and thus SVE is finalized.
And a flag in ARMCPU state and skip finalize SVE again.
Signed-off-by: Keqian Zhu <zhukeqian1@huawei.com>
---
hw/arm/virt.c | 5 +++++
target/arm/cpu.h | 3 +++
target/arm/kvm64.c | 2 +-
3 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index 507b09d96c..dfe4d9e129 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -3282,6 +3282,11 @@ static void virt_cpu_pre_plug(HotplugHandler *hotplug_dev, DeviceState *dev,
if (!dev->hotplugged) {
cs->cold_booted = true;
}
+#ifdef CONFIG_KVM
+ if (cs->cpu_index >= ms->smp.cpus) {
+ cpu->kvm_sve_finalized = true;
+ }
+#endif
}
static void virt_cpu_plug(HotplugHandler *hotplug_dev, DeviceState *dev,
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
index c51a0e3467..a5ba7f2a26 100644
--- a/target/arm/cpu.h
+++ b/target/arm/cpu.h
@@ -971,6 +971,9 @@ struct ArchCPU {
/* KVM steal time */
OnOffAuto kvm_steal_time;
+
+ /* KVM SVE has been finalized for this CPU */
+ bool kvm_sve_finalized;
#endif /* CONFIG_KVM */
/* Uniprocessor system with MP extensions */
diff --git a/target/arm/kvm64.c b/target/arm/kvm64.c
index 615e8bbbdf..8f01d485b0 100644
--- a/target/arm/kvm64.c
+++ b/target/arm/kvm64.c
@@ -647,7 +647,7 @@ int kvm_arch_init_vcpu(CPUState *cs)
return ret;
}
- if (cpu_isar_feature(aa64_sve, cpu) && !DEVICE(cpu)->hotplugged) {
+ if (cpu_isar_feature(aa64_sve, cpu) && !cpu->kvm_sve_finalized) {
ret = kvm_arm_sve_set_vls(cs);
if (ret) {
return ret;
--
2.27.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化