From 4331180aa09e44550ff8de781c618bae5e99bb70 Mon Sep 17 00:00:00 2001 From: Michael Roth Date: Tue, 9 Apr 2024 18:07:43 -0500 Subject: [PATCH 025/100] hw/i386/sev: Use legacy SEV VM types for older machine types RH-Author: Paolo Bonzini RH-MergeRequest: 245: SEV-SNP support RH-Jira: RHEL-39544 RH-Acked-by: Thomas Huth RH-Acked-by: Bandan Das RH-Acked-by: Vitaly Kuznetsov RH-Commit: [25/91] 8c73cd312736ccb0818b4d3216fd13712f21f3c9 (bonzini/rhel-qemu-kvm) Newer 9.1 machine types will default to using the KVM_SEV_INIT2 API for creating SEV/SEV-ES going forward. However, this API results in guest measurement changes which are generally not expected for users of these older guest types and can cause disruption if they switch to a newer QEMU/kernel version. Avoid this by continuing to use the older KVM_SEV_INIT/KVM_SEV_ES_INIT APIs for older machine types. Signed-off-by: Michael Roth Message-ID: <20240409230743.962513-4-michael.roth@amd.com> Signed-off-by: Paolo Bonzini (cherry picked from commit ea7fbd37537b3a598335c21ccb2ea674630fc810) Signed-off-by: Paolo Bonzini --- hw/i386/pc.c | 1 + target/i386/sev.c | 1 + 2 files changed, 2 insertions(+) diff --git a/hw/i386/pc.c b/hw/i386/pc.c index b9fde3cec1..1a34bc4522 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -351,6 +351,7 @@ const size_t pc_rhel_compat_len = G_N_ELEMENTS(pc_rhel_compat); GlobalProperty pc_rhel_9_5_compat[] = { /* pc_rhel_9_5_compat from pc_compat_pc_9_0 (backported from 9.1) */ { TYPE_X86_CPU, "guest-phys-bits", "0" }, + { "sev-guest", "legacy-vm-type", "true" }, }; const size_t pc_rhel_9_5_compat_len = G_N_ELEMENTS(pc_rhel_9_5_compat); diff --git a/target/i386/sev.c b/target/i386/sev.c index f4ee317cb0..d30b68c11e 100644 --- a/target/i386/sev.c +++ b/target/i386/sev.c @@ -1417,6 +1417,7 @@ sev_guest_instance_init(Object *obj) object_property_add_uint32_ptr(obj, "reduced-phys-bits", &sev->reduced_phys_bits, OBJ_PROP_FLAG_READWRITE); + object_apply_compat_props(obj); } /* sev guest info */ -- 2.39.3