aboutsummaryrefslogtreecommitdiff
path: root/target/i386/sev_i386.h
diff options
context:
space:
mode:
authorBrijesh Singh <brijesh.singh@amd.com>2018-03-08 06:48:44 -0600
committerPaolo Bonzini <pbonzini@redhat.com>2018-03-13 17:35:16 +0100
commitd8575c6c0242bb1457589111e879f46348704534 (patch)
tree2b360573a58ed3ee94714080371a2b45586868e4 /target/i386/sev_i386.h
parent9d8ad11429fed6c54dcc7e0018dcb494927e3440 (diff)
sev/i386: add command to initialize the memory encryption context
When memory encryption is enabled, KVM_SEV_INIT command is used to initialize the platform. The command loads the SEV related persistent data from non-volatile storage and initializes the platform context. This command should be first issued before invoking any other guest commands provided by the SEV firmware. Cc: Paolo Bonzini <pbonzini@redhat.com> Cc: Richard Henderson <rth@twiddle.net> Cc: Eduardo Habkost <ehabkost@redhat.com> Signed-off-by: Brijesh Singh <brijesh.singh@amd.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'target/i386/sev_i386.h')
-rw-r--r--target/i386/sev_i386.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/target/i386/sev_i386.h b/target/i386/sev_i386.h
index caf879c3b8..924cebcab0 100644
--- a/target/i386/sev_i386.h
+++ b/target/i386/sev_i386.h
@@ -17,7 +17,9 @@
#include "qom/object.h"
#include "qapi/error.h"
#include "sysemu/kvm.h"
+#include "sysemu/sev.h"
#include "qemu/error-report.h"
+#include "qapi/qapi-commands-misc.h"
#define SEV_POLICY_NODBG 0x1
#define SEV_POLICY_NOKS 0x2
@@ -30,6 +32,12 @@
#define QSEV_GUEST_INFO(obj) \
OBJECT_CHECK(QSevGuestInfo, (obj), TYPE_QSEV_GUEST_INFO)
+extern bool sev_enabled(void);
+extern uint64_t sev_get_me_mask(void);
+extern SevInfo *sev_get_info(void);
+extern uint32_t sev_get_cbit_position(void);
+extern uint32_t sev_get_reduced_phys_bits(void);
+
typedef struct QSevGuestInfo QSevGuestInfo;
typedef struct QSevGuestInfoClass QSevGuestInfoClass;
@@ -58,4 +66,20 @@ struct QSevGuestInfoClass {
ObjectClass parent_class;
};
+struct SEVState {
+ QSevGuestInfo *sev_info;
+ uint8_t api_major;
+ uint8_t api_minor;
+ uint8_t build_id;
+ uint32_t policy;
+ uint64_t me_mask;
+ uint32_t cbitpos;
+ uint32_t reduced_phys_bits;
+ uint32_t handle;
+ int sev_fd;
+ SevState state;
+};
+
+typedef struct SEVState SEVState;
+
#endif