[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 41/45] i386/sev: Reorder struct declarations
From: |
Paolo Bonzini |
Subject: |
[PULL 41/45] i386/sev: Reorder struct declarations |
Date: |
Tue, 4 Jun 2024 08:44:05 +0200 |
From: Dov Murik <dovmurik@linux.ibm.com>
Move the declaration of PaddedSevHashTable before SevSnpGuest so
we can add a new such field to the latter.
No functional change intended.
Signed-off-by: Dov Murik <dovmurik@linux.ibm.com>
Signed-off-by: Michael Roth <michael.roth@amd.com>
Signed-off-by: Pankaj Gupta <pankaj.gupta@amd.com>
Message-ID: <20240530111643.1091816-23-pankaj.gupta@amd.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
target/i386/sev.c | 84 +++++++++++++++++++++++------------------------
1 file changed, 42 insertions(+), 42 deletions(-)
diff --git a/target/i386/sev.c b/target/i386/sev.c
index 73f94067155..3fce4c08ebb 100644
--- a/target/i386/sev.c
+++ b/target/i386/sev.c
@@ -46,6 +46,48 @@ OBJECT_DECLARE_TYPE(SevCommonState, SevCommonStateClass,
SEV_COMMON)
OBJECT_DECLARE_TYPE(SevGuestState, SevCommonStateClass, SEV_GUEST)
OBJECT_DECLARE_TYPE(SevSnpGuestState, SevCommonStateClass, SEV_SNP_GUEST)
+/* hard code sha256 digest size */
+#define HASH_SIZE 32
+
+typedef struct QEMU_PACKED SevHashTableEntry {
+ QemuUUID guid;
+ uint16_t len;
+ uint8_t hash[HASH_SIZE];
+} SevHashTableEntry;
+
+typedef struct QEMU_PACKED SevHashTable {
+ QemuUUID guid;
+ uint16_t len;
+ SevHashTableEntry cmdline;
+ SevHashTableEntry initrd;
+ SevHashTableEntry kernel;
+} SevHashTable;
+
+/*
+ * Data encrypted by sev_encrypt_flash() must be padded to a multiple of
+ * 16 bytes.
+ */
+typedef struct QEMU_PACKED PaddedSevHashTable {
+ SevHashTable ht;
+ uint8_t padding[ROUND_UP(sizeof(SevHashTable), 16) - sizeof(SevHashTable)];
+} PaddedSevHashTable;
+
+QEMU_BUILD_BUG_ON(sizeof(PaddedSevHashTable) % 16 != 0);
+
+#define SEV_INFO_BLOCK_GUID "00f771de-1a7e-4fcb-890e-68c77e2fb44e"
+typedef struct __attribute__((__packed__)) SevInfoBlock {
+ /* SEV-ES Reset Vector Address */
+ uint32_t reset_addr;
+} SevInfoBlock;
+
+#define SEV_HASH_TABLE_RV_GUID "7255371f-3a3b-4b04-927b-1da6efa8d454"
+typedef struct QEMU_PACKED SevHashTableDescriptor {
+ /* SEV hash table area guest address */
+ uint32_t base;
+ /* SEV hash table area size (in bytes) */
+ uint32_t size;
+} SevHashTableDescriptor;
+
struct SevCommonState {
X86ConfidentialGuest parent_obj;
@@ -128,48 +170,6 @@ typedef struct SevLaunchUpdateData {
static QTAILQ_HEAD(, SevLaunchUpdateData) launch_update;
-#define SEV_INFO_BLOCK_GUID "00f771de-1a7e-4fcb-890e-68c77e2fb44e"
-typedef struct __attribute__((__packed__)) SevInfoBlock {
- /* SEV-ES Reset Vector Address */
- uint32_t reset_addr;
-} SevInfoBlock;
-
-#define SEV_HASH_TABLE_RV_GUID "7255371f-3a3b-4b04-927b-1da6efa8d454"
-typedef struct QEMU_PACKED SevHashTableDescriptor {
- /* SEV hash table area guest address */
- uint32_t base;
- /* SEV hash table area size (in bytes) */
- uint32_t size;
-} SevHashTableDescriptor;
-
-/* hard code sha256 digest size */
-#define HASH_SIZE 32
-
-typedef struct QEMU_PACKED SevHashTableEntry {
- QemuUUID guid;
- uint16_t len;
- uint8_t hash[HASH_SIZE];
-} SevHashTableEntry;
-
-typedef struct QEMU_PACKED SevHashTable {
- QemuUUID guid;
- uint16_t len;
- SevHashTableEntry cmdline;
- SevHashTableEntry initrd;
- SevHashTableEntry kernel;
-} SevHashTable;
-
-/*
- * Data encrypted by sev_encrypt_flash() must be padded to a multiple of
- * 16 bytes.
- */
-typedef struct QEMU_PACKED PaddedSevHashTable {
- SevHashTable ht;
- uint8_t padding[ROUND_UP(sizeof(SevHashTable), 16) - sizeof(SevHashTable)];
-} PaddedSevHashTable;
-
-QEMU_BUILD_BUG_ON(sizeof(PaddedSevHashTable) % 16 != 0);
-
static Error *sev_mig_blocker;
static const char *const sev_fw_errlist[] = {
--
2.45.1
- Re: [PULL 18/45] i386/sev: Introduce "sev-common" type to encapsulate common SEV state, (continued)
- [PULL 19/45] i386/sev: Move sev_launch_update to separate class method, Paolo Bonzini, 2024/06/04
- [PULL 20/45] i386/sev: Move sev_launch_finish to separate class method, Paolo Bonzini, 2024/06/04
- [PULL 21/45] i386/sev: Introduce 'sev-snp-guest' object, Paolo Bonzini, 2024/06/04
- [PULL 22/45] i386/sev: Add a sev_snp_enabled() helper, Paolo Bonzini, 2024/06/04
- [PULL 23/45] i386/sev: Add sev_kvm_init() override for SEV class, Paolo Bonzini, 2024/06/04
- [PULL 24/45] i386/sev: Add snp_kvm_init() override for SNP class, Paolo Bonzini, 2024/06/04
- [PULL 27/45] i386/sev: Add a class method to determine KVM VM type for SNP guests, Paolo Bonzini, 2024/06/04
- [PULL 32/45] hw/i386/sev: Add function to get SEV metadata from OVMF header, Paolo Bonzini, 2024/06/04
- [PULL 41/45] i386/sev: Reorder struct declarations,
Paolo Bonzini <=
- [PULL 30/45] i386/sev: Add handling to encrypt/finalize guest launch data, Paolo Bonzini, 2024/06/04
- [PULL 26/45] i386/sev: Don't return launch measurements for SEV-SNP guests, Paolo Bonzini, 2024/06/04
- [PULL 25/45] i386/cpu: Set SEV-SNP CPUID bit when SNP enabled, Paolo Bonzini, 2024/06/04
- [PULL 34/45] i386/sev: Add support for SNP CPUID validation, Paolo Bonzini, 2024/06/04
- [PULL 37/45] i386/sev: Invoke launch_updata_data() for SNP class, Paolo Bonzini, 2024/06/04
- [PULL 35/45] hw/i386/sev: Add support to encrypt BIOS when SEV-SNP is enabled, Paolo Bonzini, 2024/06/04
- [PULL 38/45] i386/kvm: Add KVM_EXIT_HYPERCALL handling for KVM_HC_MAP_GPA_RANGE, Paolo Bonzini, 2024/06/04
- [PULL 40/45] i386/sev: Extract build_kernel_loader_hashes, Paolo Bonzini, 2024/06/04
- [PULL 43/45] memory: Introduce memory_region_init_ram_guest_memfd(), Paolo Bonzini, 2024/06/04