- hw/loongarch/virt: Fix FDT memory node address width - hw/loongarch: Fix fdt memory node wrong 'reg' - load_elf: fix iterator's type for elf file processing - migration/colo: Fix bdrv_graph_rdlock_main_loop: Assertion `!qemu_in_… - target/i386: no single-step exception after MOV or POP SS - char-stdio: Restore blocking mode of stdout on exit - backends/cryptodev-builtin: Fix local_error leaks - target/loongarch: fix a wrong print in cpu dump - virtio-pci: fix use of a released vector - target/arm: Disable SVE extensions when SVE is disabled - hw/misc/bcm2835_property: Fix handling of FRAMEBUFFER_SET_PALETTE - target/i386: Introduce SapphireRapids-v3 to add missing features - virtio-net: Ensure queue index fits with RSS (CVE-2024-6505) - nbd/server: CVE-2024-7409: Avoid use-after-free when closing server - update io/trace-events. Parameters should remain consistent. - update docs/tools/virtfs-proxy-helper.rst. This place is spelled wrong. - kvm: Add support for CSV2 reboot - target/i386/kvm: Fix the resettable info when emulate Hygon CSV2 guest - target/i386: get/set/migrate GHCB state - target/i386: csv: Add support for migrate VMSA for CSV2 guest - migration/ram: Accelerate the loading of CSV guest's encrypted pages - migration/ram: Accelerate the transmission of CSV guest's encrypted pages - target/i386: csv: add support to load incoming encrypted pages queued in the CMD list - target/i386: csv: add support to queue the incoming page into a list - target/i386: csv: add support to encrypt the outgoing pages in the list queued before. - target/i386: csv: add support to queue the outgoing page into a list - target/i386: csv: Read cert chain from file when prepared for CSV live migration - target/i386: Introduce header file csv.h - migration/ram: Fix calculation of gfn correpond to a page in ramblock - target/i386: sev: Clear shared_regions_list when reboot CSV Guest - migration/ram: Force encrypted status for VGA vram - target/i386: sev: Return 0 if sev_send_get_packet_len() fails - kvm: Add support for userspace MSR filtering and handling of MSR_KVM_MIGRATION_CONTROL. - migration/ram: Force encrypted status for flash0 & flash1 devices. - migration/ram: add support to send encrypted pages - migration: add support to migrate shared regions list - kvm: Add support for SEV shared regions list and KVM_EXIT_HYPERCALL. - target/i386: sev: add support to load incoming encrypted page - target/i386: sev: add support to encrypt the outgoing page - target/i386: sev: do not create launch context for an incoming guest - target/i386: sev: provide callback to setup outgoing context - confidential guest support: introduce ConfidentialGuestMemoryEncryptionOps for encrypted VMs - migration.json: add AMD SEV specific migration parameters - doc: update AMD SEV to include Live migration flow - crypto/tlscredspsk: Free username on finalize - hw/nvme: fix leak of uninitialized memory in io_mgmt_recv - hw/display/vhost-user-gpu.c: fix vhost_user_gpu_chr_read() - cvm : Implement command blacklist for cvm security enhancement - crypto: Introduce SM3 hash hmac pbkdf algorithm - virtio-net: Use virtual time for RSC timers - vvfat: Fix bug in writing to middle of file - hw/core/ptimer: fix timer zero period condition for freq > 1GHz - hw/misc: support vpsp Signed-off-by: Jiabo Feng <fengjiabo1@huawei.com>
180 lines
5.3 KiB
Diff
180 lines
5.3 KiB
Diff
From 366c11c56875ae053043c48c8b93349c6e3125cc Mon Sep 17 00:00:00 2001
|
|
From: hanliyang <hanliyang@hygon.cn>
|
|
Date: Sun, 19 Jun 2022 16:49:45 +0800
|
|
Subject: [PATCH] target/i386/kvm: Fix the resettable info when emulate Hygon
|
|
CSV2 guest
|
|
|
|
SEV-ES guest will be terminated by QEMU when receive reboot request.
|
|
In order to support reboot for CSV2 guest, report resettable in
|
|
kvm_arch_cpu_check_are_resettable(). But the CSV2 guest is still not
|
|
resettable if it was migrated to target machine.
|
|
|
|
Signed-off-by: hanliyang <hanliyang@hygon.cn>
|
|
---
|
|
target/i386/csv-sysemu-stub.c | 16 ++++++++++++++++
|
|
target/i386/csv.c | 20 ++++++++++++++++++++
|
|
target/i386/csv.h | 2 ++
|
|
target/i386/kvm/csv-stub.c | 17 +++++++++++++++++
|
|
target/i386/kvm/kvm.c | 4 ++++
|
|
target/i386/kvm/meson.build | 1 +
|
|
target/i386/meson.build | 1 +
|
|
target/i386/sev.c | 9 +++++++++
|
|
8 files changed, 70 insertions(+)
|
|
create mode 100644 target/i386/csv-sysemu-stub.c
|
|
create mode 100644 target/i386/csv.c
|
|
create mode 100644 target/i386/kvm/csv-stub.c
|
|
|
|
diff --git a/target/i386/csv-sysemu-stub.c b/target/i386/csv-sysemu-stub.c
|
|
new file mode 100644
|
|
index 0000000000..5874e4cc1d
|
|
--- /dev/null
|
|
+++ b/target/i386/csv-sysemu-stub.c
|
|
@@ -0,0 +1,16 @@
|
|
+/*
|
|
+ * QEMU CSV system stub
|
|
+ *
|
|
+ * Copyright: Hygon Info Technologies Ltd. 2022
|
|
+ *
|
|
+ * Author:
|
|
+ * Jiang Xin <jiangxin@hygon.cn>
|
|
+ *
|
|
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
|
|
+ * See the COPYING file in the top-level directory.
|
|
+ *
|
|
+ */
|
|
+
|
|
+#include "qemu/osdep.h"
|
|
+#include "sev.h"
|
|
+#include "csv.h"
|
|
diff --git a/target/i386/csv.c b/target/i386/csv.c
|
|
new file mode 100644
|
|
index 0000000000..88fb05ac37
|
|
--- /dev/null
|
|
+++ b/target/i386/csv.c
|
|
@@ -0,0 +1,20 @@
|
|
+/*
|
|
+ * QEMU CSV support
|
|
+ *
|
|
+ * Copyright: Hygon Info Technologies Ltd. 2022
|
|
+ *
|
|
+ * Author:
|
|
+ * Jiang Xin <jiangxin@hygon.cn>
|
|
+ *
|
|
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
|
|
+ * See the COPYING file in the top-level directory.
|
|
+ *
|
|
+ */
|
|
+
|
|
+#include "qemu/osdep.h"
|
|
+
|
|
+#include "cpu.h"
|
|
+#include "sev.h"
|
|
+#include "csv.h"
|
|
+
|
|
+bool csv_kvm_cpu_reset_inhibit;
|
|
diff --git a/target/i386/csv.h b/target/i386/csv.h
|
|
index 47741a0a4f..ac4bb5bee1 100644
|
|
--- a/target/i386/csv.h
|
|
+++ b/target/i386/csv.h
|
|
@@ -46,6 +46,8 @@ static bool __attribute__((unused)) is_hygon_cpu(void)
|
|
|
|
#define CSV_OUTGOING_PAGE_WINDOW_SIZE (4094 * TARGET_PAGE_SIZE)
|
|
|
|
+extern bool csv_kvm_cpu_reset_inhibit;
|
|
+
|
|
typedef struct CsvBatchCmdList CsvBatchCmdList;
|
|
typedef void (*CsvDestroyCmdNodeFn) (void *data);
|
|
|
|
diff --git a/target/i386/kvm/csv-stub.c b/target/i386/kvm/csv-stub.c
|
|
new file mode 100644
|
|
index 0000000000..4d1376f268
|
|
--- /dev/null
|
|
+++ b/target/i386/kvm/csv-stub.c
|
|
@@ -0,0 +1,17 @@
|
|
+/*
|
|
+ * QEMU CSV stub
|
|
+ *
|
|
+ * Copyright Hygon Info Technologies Ltd. 2024
|
|
+ *
|
|
+ * Authors:
|
|
+ * Han Liyang <hanliyang@hygon.cn>
|
|
+ *
|
|
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
|
|
+ * See the COPYING file in the top-level directory.
|
|
+ *
|
|
+ */
|
|
+
|
|
+#include "qemu/osdep.h"
|
|
+#include "csv.h"
|
|
+
|
|
+bool csv_kvm_cpu_reset_inhibit;
|
|
diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c
|
|
index 9e65242739..2866a6d0ec 100644
|
|
--- a/target/i386/kvm/kvm.c
|
|
+++ b/target/i386/kvm/kvm.c
|
|
@@ -32,6 +32,7 @@
|
|
#include "sysemu/runstate.h"
|
|
#include "kvm_i386.h"
|
|
#include "sev.h"
|
|
+#include "csv.h"
|
|
#include "xen-emu.h"
|
|
#include "hyperv.h"
|
|
#include "hyperv-proto.h"
|
|
@@ -5710,6 +5711,9 @@ bool kvm_has_waitpkg(void)
|
|
|
|
bool kvm_arch_cpu_check_are_resettable(void)
|
|
{
|
|
+ if (is_hygon_cpu())
|
|
+ return !csv_kvm_cpu_reset_inhibit;
|
|
+
|
|
return !sev_es_enabled();
|
|
}
|
|
|
|
diff --git a/target/i386/kvm/meson.build b/target/i386/kvm/meson.build
|
|
index 84d9143e60..3c3f8cf93c 100644
|
|
--- a/target/i386/kvm/meson.build
|
|
+++ b/target/i386/kvm/meson.build
|
|
@@ -8,6 +8,7 @@ i386_kvm_ss.add(files(
|
|
i386_kvm_ss.add(when: 'CONFIG_XEN_EMU', if_true: files('xen-emu.c'))
|
|
|
|
i386_kvm_ss.add(when: 'CONFIG_SEV', if_false: files('sev-stub.c'))
|
|
+i386_kvm_ss.add(when: 'CONFIG_CSV', if_false: files('csv-stub.c'))
|
|
|
|
i386_system_ss.add(when: 'CONFIG_HYPERV', if_true: files('hyperv.c'), if_false: files('hyperv-stub.c'))
|
|
|
|
diff --git a/target/i386/meson.build b/target/i386/meson.build
|
|
index 7c74bfa859..594a0a6abf 100644
|
|
--- a/target/i386/meson.build
|
|
+++ b/target/i386/meson.build
|
|
@@ -21,6 +21,7 @@ i386_system_ss.add(files(
|
|
'cpu-sysemu.c',
|
|
))
|
|
i386_system_ss.add(when: 'CONFIG_SEV', if_true: files('sev.c'), if_false: files('sev-sysemu-stub.c'))
|
|
+i386_system_ss.add(when: 'CONFIG_CSV', if_true: files('csv.c'), if_false: files('csv-sysemu-stub.c'))
|
|
|
|
i386_user_ss = ss.source_set()
|
|
|
|
diff --git a/target/i386/sev.c b/target/i386/sev.c
|
|
index 7744378112..2c6aecd1a3 100644
|
|
--- a/target/i386/sev.c
|
|
+++ b/target/i386/sev.c
|
|
@@ -1190,6 +1190,15 @@ int sev_kvm_init(ConfidentialGuestSupport *cgs, Error **errp)
|
|
error_setg(errp, "%s: failed to create encryption context", __func__);
|
|
goto err;
|
|
}
|
|
+ } else {
|
|
+ /*
|
|
+ * The CSV2 guest is not resettable after migrated to target machine,
|
|
+ * set csv_kvm_cpu_reset_inhibit to true to indicate the CSV2 guest is
|
|
+ * not resettable.
|
|
+ */
|
|
+ if (is_hygon_cpu() && sev_es_enabled()) {
|
|
+ csv_kvm_cpu_reset_inhibit = true;
|
|
+ }
|
|
}
|
|
|
|
ram_block_notifier_add(&sev_ram_notifier);
|
|
--
|
|
2.41.0.windows.1
|
|
|