代码拉取完成,页面将自动刷新
From 4b103bfc7b873bc070a6d714341f6b25b2d251c1 Mon Sep 17 00:00:00 2001
From: hanliyang <hanliyang@hygon.cn>
Date: Fri, 26 Apr 2024 21:17:35 +0800
Subject: [PATCH 3/4] target/i386/csv: The CSV2 guest running on the recipient
side is not resettable
Currently, both CSV2 guest running on the recipient side and CSV3
guest are not resettable. Provide a new global variable
kvm_csv_reset_inhibit to indicate the resettable state if the VM
is using CSV technologies.
Signed-off-by: hanliyang <hanliyang@hygon.cn>
---
target/i386/csv.c | 2 ++
target/i386/csv.h | 2 ++
target/i386/kvm/kvm.c | 4 +++-
target/i386/kvm/sev-stub.c | 2 ++
target/i386/sev.c | 3 +++
5 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/target/i386/csv.c b/target/i386/csv.c
index 770ea7d5bf..12e2cc16be 100644
--- a/target/i386/csv.c
+++ b/target/i386/csv.c
@@ -93,6 +93,8 @@ csv_init(uint32_t policy, int fd, void *state, struct sev_ops *ops)
qemu_mutex_init(&csv_guest.dma_map_regions_list_mutex);
csv_guest.sev_send_start = ops->sev_send_start;
csv_guest.sev_receive_start = ops->sev_receive_start;
+
+ kvm_csv_reset_inhibit = true;
}
return 0;
}
diff --git a/target/i386/csv.h b/target/i386/csv.h
index 485534d2d6..cc02ba83a4 100644
--- a/target/i386/csv.h
+++ b/target/i386/csv.h
@@ -18,6 +18,8 @@
#include "qemu/thread.h"
#include "qemu/queue.h"
+extern bool kvm_csv_reset_inhibit;
+
#ifdef CONFIG_SEV
#include "cpu.h"
diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c
index 469349420c..a14debcfc2 100644
--- a/target/i386/kvm/kvm.c
+++ b/target/i386/kvm/kvm.c
@@ -5383,7 +5383,9 @@ bool kvm_has_waitpkg(void)
bool kvm_arch_cpu_check_are_resettable(void)
{
- return !(sev_es_enabled() && !is_hygon_cpu()) && !csv_enabled();
+ if (is_hygon_cpu())
+ return !kvm_csv_reset_inhibit;
+ return !sev_es_enabled();
}
#define ARCH_REQ_XCOMP_GUEST_PERM 0x1025
diff --git a/target/i386/kvm/sev-stub.c b/target/i386/kvm/sev-stub.c
index 6080c007a2..0651502f1c 100644
--- a/target/i386/kvm/sev-stub.c
+++ b/target/i386/kvm/sev-stub.c
@@ -20,3 +20,5 @@ int sev_kvm_init(ConfidentialGuestSupport *cgs, Error **errp)
/* If we get here, cgs must be some non-SEV thing */
return 0;
}
+
+bool kvm_csv_reset_inhibit;
diff --git a/target/i386/sev.c b/target/i386/sev.c
index 484e6e7509..3f25d2b6d7 100644
--- a/target/i386/sev.c
+++ b/target/i386/sev.c
@@ -219,6 +219,7 @@ static struct ConfidentialGuestMemoryEncryptionOps sev_memory_encryption_ops = {
};
bool kvm_has_msr_ghcb;
+bool kvm_csv_reset_inhibit;
static int
sev_ioctl(int fd, int cmd, void *data, int *error)
@@ -1275,6 +1276,8 @@ int sev_kvm_init(ConfidentialGuestSupport *cgs, Error **errp)
error_setg(errp, "%s: failed to create encryption context", __func__);
goto err;
}
+ } else if (is_hygon_cpu() && sev_es_enabled()) {
+ kvm_csv_reset_inhibit = true;
}
/* CSV guest needs no notifier to reg/unreg memory */
--
2.39.3
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。