mirror of
https://github.com/izzy2lost/xemu.git
synced 2026-07-06 00:20:22 -07:00
i386/sev: Introduce "sev-common" type to encapsulate common SEV state
Currently all SEV/SEV-ES functionality is managed through a single
'sev-guest' QOM type. With upcoming support for SEV-SNP, taking this
same approach won't work well since some of the properties/state
managed by 'sev-guest' is not applicable to SEV-SNP, which will instead
rely on a new QOM type with its own set of properties/state.
To prepare for this, this patch moves common state into an abstract
'sev-common' parent type to encapsulate properties/state that are
common to both SEV/SEV-ES and SEV-SNP, leaving only SEV/SEV-ES-specific
properties/state in the current 'sev-guest' type. This should not
affect current behavior or command-line options.
As part of this patch, some related changes are also made:
- a static 'sev_guest' variable is currently used to keep track of
the 'sev-guest' instance. SEV-SNP would similarly introduce an
'sev_snp_guest' static variable. But these instances are now
available via qdev_get_machine()->cgs, so switch to using that
instead and drop the static variable.
- 'sev_guest' is currently used as the name for the static variable
holding a pointer to the 'sev-guest' instance. Re-purpose the name
as a local variable referring the 'sev-guest' instance, and use
that consistently throughout the code so it can be easily
distinguished from sev-common/sev-snp-guest instances.
- 'sev' is generally used as the name for local variables holding a
pointer to the 'sev-guest' instance. In cases where that now points
to common state, use the name 'sev_common'; in cases where that now
points to state specific to 'sev-guest' instance, use the name
'sev_guest'
In order to enable kernel-hashes for SNP, pull it from
SevGuestProperties to its parent SevCommonProperties so
it will be available for both SEV and SNP.
Signed-off-by: Michael Roth <michael.roth@amd.com>
Co-developed-by: Dov Murik <dovmurik@linux.ibm.com>
Signed-off-by: Dov Murik <dovmurik@linux.ibm.com>
Acked-by: Markus Armbruster <armbru@redhat.com> (QAPI schema)
Co-developed-by: Pankaj Gupta <pankaj.gupta@amd.com>
Signed-off-by: Pankaj Gupta <pankaj.gupta@amd.com>
Message-ID: <20240530111643.1091816-5-pankaj.gupta@amd.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
committed by
Paolo Bonzini
parent
18c453409a
commit
16dcf200dc
+25
-15
@@ -875,20 +875,12 @@
|
||||
'data': { '*filename': 'str' } }
|
||||
|
||||
##
|
||||
# @SevGuestProperties:
|
||||
# @SevCommonProperties:
|
||||
#
|
||||
# Properties for sev-guest objects.
|
||||
# Properties common to objects that are derivatives of sev-common.
|
||||
#
|
||||
# @sev-device: SEV device to use (default: "/dev/sev")
|
||||
#
|
||||
# @dh-cert-file: guest owners DH certificate (encoded with base64)
|
||||
#
|
||||
# @session-file: guest owners session parameters (encoded with base64)
|
||||
#
|
||||
# @policy: SEV policy value (default: 0x1)
|
||||
#
|
||||
# @handle: SEV firmware handle (default: 0)
|
||||
#
|
||||
# @cbitpos: C-bit location in page table entry (default: 0)
|
||||
#
|
||||
# @reduced-phys-bits: number of bits in physical addresses that become
|
||||
@@ -898,6 +890,27 @@
|
||||
# designated guest firmware page for measured boot with -kernel
|
||||
# (default: false) (since 6.2)
|
||||
#
|
||||
# Since: 9.1
|
||||
##
|
||||
{ 'struct': 'SevCommonProperties',
|
||||
'data': { '*sev-device': 'str',
|
||||
'*cbitpos': 'uint32',
|
||||
'reduced-phys-bits': 'uint32',
|
||||
'*kernel-hashes': 'bool' } }
|
||||
|
||||
##
|
||||
# @SevGuestProperties:
|
||||
#
|
||||
# Properties for sev-guest objects.
|
||||
#
|
||||
# @dh-cert-file: guest owners DH certificate (encoded with base64)
|
||||
#
|
||||
# @session-file: guest owners session parameters (encoded with base64)
|
||||
#
|
||||
# @policy: SEV policy value (default: 0x1)
|
||||
#
|
||||
# @handle: SEV firmware handle (default: 0)
|
||||
#
|
||||
# @legacy-vm-type: Use legacy KVM_SEV_INIT KVM interface for creating the VM.
|
||||
# The newer KVM_SEV_INIT2 interface syncs additional vCPU
|
||||
# state when initializing the VMSA structures, which will
|
||||
@@ -909,14 +922,11 @@
|
||||
# Since: 2.12
|
||||
##
|
||||
{ 'struct': 'SevGuestProperties',
|
||||
'data': { '*sev-device': 'str',
|
||||
'*dh-cert-file': 'str',
|
||||
'base': 'SevCommonProperties',
|
||||
'data': { '*dh-cert-file': 'str',
|
||||
'*session-file': 'str',
|
||||
'*policy': 'uint32',
|
||||
'*handle': 'uint32',
|
||||
'*cbitpos': 'uint32',
|
||||
'reduced-phys-bits': 'uint32',
|
||||
'*kernel-hashes': 'bool',
|
||||
'*legacy-vm-type': 'bool' } }
|
||||
|
||||
##
|
||||
|
||||
+275
-218
File diff suppressed because it is too large
Load Diff
@@ -20,6 +20,9 @@
|
||||
|
||||
#include "exec/confidential-guest-support.h"
|
||||
|
||||
#define TYPE_SEV_COMMON "sev-common"
|
||||
#define TYPE_SEV_GUEST "sev-guest"
|
||||
|
||||
#define SEV_POLICY_NODBG 0x1
|
||||
#define SEV_POLICY_NOKS 0x2
|
||||
#define SEV_POLICY_ES 0x4
|
||||
|
||||
Reference in New Issue
Block a user