- 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>
266 lines
10 KiB
Diff
266 lines
10 KiB
Diff
From 5ff59a5649385672da42097b24a2428bc2348d9b Mon Sep 17 00:00:00 2001
|
|
From: Brijesh Singh <brijesh.singh@amd.com>
|
|
Date: Tue, 27 Jul 2021 11:27:00 +0000
|
|
Subject: [PATCH] migration.json: add AMD SEV specific migration parameters
|
|
|
|
cherry-picked from https://github.com/AMDESE/qemu/commit/d6a23bde6b6e.
|
|
|
|
AMD SEV migration flow requires that target machine's public Diffie-Hellman
|
|
key (PDH) and certificate chain must be passed before initiating the guest
|
|
migration. User can use QMP 'migrate-set-parameters' to pass the certificate
|
|
chain. The certificate chain will be used while creating the outgoing
|
|
encryption context.
|
|
|
|
Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
|
|
Signed-off-by: Ashish Kalra <ashish.kalra@amd.com>
|
|
[ Fix conflicts and qapi errors. ]
|
|
Signed-off-by: hanliyang <hanliyang@hygon.cn>
|
|
---
|
|
migration/migration-hmp-cmds.c | 28 ++++++++++++++++
|
|
migration/options.c | 60 ++++++++++++++++++++++++++++++++++
|
|
qapi/migration.json | 41 +++++++++++++++++++++--
|
|
3 files changed, 126 insertions(+), 3 deletions(-)
|
|
|
|
diff --git a/migration/migration-hmp-cmds.c b/migration/migration-hmp-cmds.c
|
|
index 1fa6a5f478..7ce0446d46 100644
|
|
--- a/migration/migration-hmp-cmds.c
|
|
+++ b/migration/migration-hmp-cmds.c
|
|
@@ -395,6 +395,19 @@ void hmp_info_migrate_parameters(Monitor *mon, const QDict *qdict)
|
|
monitor_printf(mon, "%s: %s\n",
|
|
MigrationParameter_str(MIGRATION_PARAMETER_MODE),
|
|
qapi_enum_lookup(&MigMode_lookup, params->mode));
|
|
+
|
|
+ assert(params->sev_pdh);
|
|
+ monitor_printf(mon, "%s: %s\n",
|
|
+ MigrationParameter_str(MIGRATION_PARAMETER_SEV_PDH),
|
|
+ params->sev_pdh);
|
|
+ assert(params->sev_plat_cert);
|
|
+ monitor_printf(mon, "%s: %s\n",
|
|
+ MigrationParameter_str(MIGRATION_PARAMETER_SEV_PLAT_CERT),
|
|
+ params->sev_plat_cert);
|
|
+ assert(params->sev_amd_cert);
|
|
+ monitor_printf(mon, "%s: %s\n",
|
|
+ MigrationParameter_str(MIGRATION_PARAMETER_SEV_AMD_CERT),
|
|
+ params->sev_amd_cert);
|
|
}
|
|
|
|
qapi_free_MigrationParameters(params);
|
|
@@ -691,6 +704,21 @@ void hmp_migrate_set_parameter(Monitor *mon, const QDict *qdict)
|
|
p->has_mode = true;
|
|
visit_type_MigMode(v, param, &p->mode, &err);
|
|
break;
|
|
+ case MIGRATION_PARAMETER_SEV_PDH:
|
|
+ p->sev_pdh = g_new0(StrOrNull, 1);
|
|
+ p->sev_pdh->type = QTYPE_QSTRING;
|
|
+ visit_type_str(v, param, &p->sev_pdh->u.s, &err);
|
|
+ break;
|
|
+ case MIGRATION_PARAMETER_SEV_PLAT_CERT:
|
|
+ p->sev_plat_cert = g_new0(StrOrNull, 1);
|
|
+ p->sev_plat_cert->type = QTYPE_QSTRING;
|
|
+ visit_type_str(v, param, &p->sev_plat_cert->u.s, &err);
|
|
+ break;
|
|
+ case MIGRATION_PARAMETER_SEV_AMD_CERT:
|
|
+ p->sev_amd_cert = g_new0(StrOrNull, 1);
|
|
+ p->sev_amd_cert->type = QTYPE_QSTRING;
|
|
+ visit_type_str(v, param, &p->sev_amd_cert->u.s, &err);
|
|
+ break;
|
|
default:
|
|
assert(0);
|
|
}
|
|
diff --git a/migration/options.c b/migration/options.c
|
|
index 9b68962a65..71e71ea801 100644
|
|
--- a/migration/options.c
|
|
+++ b/migration/options.c
|
|
@@ -183,6 +183,9 @@ Property migration_properties[] = {
|
|
DEFINE_PROP_MIG_MODE("mode", MigrationState,
|
|
parameters.mode,
|
|
MIG_MODE_NORMAL),
|
|
+ DEFINE_PROP_STRING("sev-pdh", MigrationState, parameters.sev_pdh),
|
|
+ DEFINE_PROP_STRING("sev-plat-cert", MigrationState, parameters.sev_plat_cert),
|
|
+ DEFINE_PROP_STRING("sev-amd-cert", MigrationState, parameters.sev_amd_cert),
|
|
|
|
/* Migration capabilities */
|
|
DEFINE_PROP_MIG_CAP("x-xbzrle", MIGRATION_CAPABILITY_XBZRLE),
|
|
@@ -1012,6 +1015,9 @@ MigrationParameters *qmp_query_migrate_parameters(Error **errp)
|
|
params->announce_rounds = s->parameters.announce_rounds;
|
|
params->has_announce_step = true;
|
|
params->announce_step = s->parameters.announce_step;
|
|
+ params->sev_pdh = g_strdup(s->parameters.sev_pdh);
|
|
+ params->sev_plat_cert = g_strdup(s->parameters.sev_plat_cert);
|
|
+ params->sev_amd_cert = g_strdup(s->parameters.sev_amd_cert);
|
|
|
|
if (s->parameters.has_block_bitmap_mapping) {
|
|
params->has_block_bitmap_mapping = true;
|
|
@@ -1063,6 +1069,10 @@ void migrate_params_init(MigrationParameters *params)
|
|
params->has_x_vcpu_dirty_limit_period = true;
|
|
params->has_vcpu_dirty_limit = true;
|
|
params->has_mode = true;
|
|
+
|
|
+ params->sev_pdh = g_strdup("");
|
|
+ params->sev_plat_cert = g_strdup("");
|
|
+ params->sev_amd_cert = g_strdup("");
|
|
}
|
|
|
|
static bool compress_level_check(MigrationParameters *params, Error **errp)
|
|
@@ -1392,6 +1402,19 @@ static void migrate_params_test_apply(MigrateSetParameters *params,
|
|
if (params->has_mode) {
|
|
dest->mode = params->mode;
|
|
}
|
|
+
|
|
+ if (params->sev_pdh) {
|
|
+ assert(params->sev_pdh->type == QTYPE_QSTRING);
|
|
+ dest->sev_pdh = params->sev_pdh->u.s;
|
|
+ }
|
|
+ if (params->sev_plat_cert) {
|
|
+ assert(params->sev_plat_cert->type == QTYPE_QSTRING);
|
|
+ dest->sev_plat_cert = params->sev_plat_cert->u.s;
|
|
+ }
|
|
+ if (params->sev_amd_cert) {
|
|
+ assert(params->sev_amd_cert->type == QTYPE_QSTRING);
|
|
+ dest->sev_amd_cert = params->sev_amd_cert->u.s;
|
|
+ }
|
|
}
|
|
|
|
static void migrate_params_apply(MigrateSetParameters *params, Error **errp)
|
|
@@ -1540,6 +1563,22 @@ static void migrate_params_apply(MigrateSetParameters *params, Error **errp)
|
|
if (params->has_mode) {
|
|
s->parameters.mode = params->mode;
|
|
}
|
|
+
|
|
+ if (params->sev_pdh) {
|
|
+ g_free(s->parameters.sev_pdh);
|
|
+ assert(params->sev_pdh->type == QTYPE_QSTRING);
|
|
+ s->parameters.sev_pdh = g_strdup(params->sev_pdh->u.s);
|
|
+ }
|
|
+ if (params->sev_plat_cert) {
|
|
+ g_free(s->parameters.sev_plat_cert);
|
|
+ assert(params->sev_plat_cert->type == QTYPE_QSTRING);
|
|
+ s->parameters.sev_plat_cert = g_strdup(params->sev_plat_cert->u.s);
|
|
+ }
|
|
+ if (params->sev_amd_cert) {
|
|
+ g_free(s->parameters.sev_amd_cert);
|
|
+ assert(params->sev_amd_cert->type == QTYPE_QSTRING);
|
|
+ s->parameters.sev_amd_cert = g_strdup(params->sev_amd_cert->u.s);
|
|
+ }
|
|
}
|
|
|
|
void qmp_migrate_set_parameters(MigrateSetParameters *params, Error **errp)
|
|
@@ -1565,6 +1604,27 @@ void qmp_migrate_set_parameters(MigrateSetParameters *params, Error **errp)
|
|
params->tls_authz->type = QTYPE_QSTRING;
|
|
params->tls_authz->u.s = strdup("");
|
|
}
|
|
+ /* TODO Rewrite "" to null instead */
|
|
+ if (params->sev_pdh
|
|
+ && params->sev_pdh->type == QTYPE_QNULL) {
|
|
+ qobject_unref(params->sev_pdh->u.n);
|
|
+ params->sev_pdh->type = QTYPE_QSTRING;
|
|
+ params->sev_pdh->u.s = strdup("");
|
|
+ }
|
|
+ /* TODO Rewrite "" to null instead */
|
|
+ if (params->sev_plat_cert
|
|
+ && params->sev_plat_cert->type == QTYPE_QNULL) {
|
|
+ qobject_unref(params->sev_plat_cert->u.n);
|
|
+ params->sev_plat_cert->type = QTYPE_QSTRING;
|
|
+ params->sev_plat_cert->u.s = strdup("");
|
|
+ }
|
|
+ /* TODO Rewrite "" to null instead */
|
|
+ if (params->sev_amd_cert
|
|
+ && params->sev_amd_cert->type == QTYPE_QNULL) {
|
|
+ qobject_unref(params->sev_amd_cert->u.n);
|
|
+ params->sev_amd_cert->type = QTYPE_QSTRING;
|
|
+ params->sev_amd_cert->u.s = strdup("");
|
|
+ }
|
|
|
|
migrate_params_test_apply(params, &tmp);
|
|
|
|
diff --git a/qapi/migration.json b/qapi/migration.json
|
|
index 5d0855a1d8..038e99cba3 100644
|
|
--- a/qapi/migration.json
|
|
+++ b/qapi/migration.json
|
|
@@ -891,6 +891,15 @@
|
|
# @mode: Migration mode. See description in @MigMode. Default is 'normal'.
|
|
# (Since 8.2)
|
|
#
|
|
+# @sev-pdh: The target host platform diffie-hellman key encoded in base64
|
|
+# (Since 4.2)
|
|
+#
|
|
+# @sev-plat-cert: The target host platform certificate chain encoded in base64
|
|
+# (Since 4.2)
|
|
+#
|
|
+# @sev-amd-cert: AMD certificate chain which include ASK and OCA encoded in
|
|
+# base64 (Since 4.2)
|
|
+#
|
|
# Features:
|
|
#
|
|
# @deprecated: Member @block-incremental is deprecated. Use
|
|
@@ -925,7 +934,8 @@
|
|
'block-bitmap-mapping',
|
|
{ 'name': 'x-vcpu-dirty-limit-period', 'features': ['unstable'] },
|
|
'vcpu-dirty-limit',
|
|
- 'mode'] }
|
|
+ 'mode',
|
|
+ 'sev-pdh', 'sev-plat-cert', 'sev-amd-cert'] }
|
|
|
|
##
|
|
# @MigrateSetParameters:
|
|
@@ -1083,6 +1093,15 @@
|
|
# @mode: Migration mode. See description in @MigMode. Default is 'normal'.
|
|
# (Since 8.2)
|
|
#
|
|
+# @sev-pdh: The target host platform diffie-hellman key encoded in base64
|
|
+# (Since 4.2)
|
|
+#
|
|
+# @sev-plat-cert: The target host platform certificate chain encoded in base64
|
|
+# (Since 4.2)
|
|
+#
|
|
+# @sev-amd-cert: AMD certificate chain which include ASK and OCA encoded in
|
|
+# base64 (Since 4.2)
|
|
+#
|
|
# Features:
|
|
#
|
|
# @deprecated: Member @block-incremental is deprecated. Use
|
|
@@ -1139,7 +1158,11 @@
|
|
'*x-vcpu-dirty-limit-period': { 'type': 'uint64',
|
|
'features': [ 'unstable' ] },
|
|
'*vcpu-dirty-limit': 'uint64',
|
|
- '*mode': 'MigMode'} }
|
|
+ '*mode': 'MigMode',
|
|
+ '*sev-pdh': 'StrOrNull',
|
|
+ '*sev-plat-cert': 'StrOrNull',
|
|
+ '*sev-amd-cert' : 'StrOrNull' } }
|
|
+
|
|
|
|
##
|
|
# @migrate-set-parameters:
|
|
@@ -1317,6 +1340,15 @@
|
|
# @mode: Migration mode. See description in @MigMode. Default is 'normal'.
|
|
# (Since 8.2)
|
|
#
|
|
+# @sev-pdh: The target host platform diffie-hellman key encoded in base64
|
|
+# (Since 4.2)
|
|
+#
|
|
+# @sev-plat-cert: The target host platform certificate chain encoded in base64
|
|
+# (Since 4.2)
|
|
+#
|
|
+# @sev-amd-cert: AMD certificate chain which include ASK and OCA encoded in
|
|
+# base64 (Since 4.2)
|
|
+#
|
|
# Features:
|
|
#
|
|
# @deprecated: Member @block-incremental is deprecated. Use
|
|
@@ -1369,7 +1401,10 @@
|
|
'*x-vcpu-dirty-limit-period': { 'type': 'uint64',
|
|
'features': [ 'unstable' ] },
|
|
'*vcpu-dirty-limit': 'uint64',
|
|
- '*mode': 'MigMode'} }
|
|
+ '*mode': 'MigMode',
|
|
+ '*sev-pdh': 'str',
|
|
+ '*sev-plat-cert': 'str',
|
|
+ '*sev-amd-cert' : 'str'} }
|
|
|
|
##
|
|
# @query-migrate-parameters:
|
|
--
|
|
2.41.0.windows.1
|
|
|