2 * QEMU Secure Encrypted Virutualization (SEV) support
4 * Copyright: Advanced Micro Devices, 2016-2018
7 * Brijesh Singh <brijesh.singh@amd.com>
9 * This work is licensed under the terms of the GNU GPL, version 2 or later.
10 * See the COPYING file in the top-level directory.
14 #ifndef QEMU_SEV_I386_H
15 #define QEMU_SEV_I386_H
17 #include "qom/object.h"
18 #include "qapi/error.h"
19 #include "sysemu/kvm.h"
20 #include "sysemu/sev.h"
21 #include "qemu/error-report.h"
22 #include "qapi/qapi-commands-target.h"
24 #define SEV_POLICY_NODBG 0x1
25 #define SEV_POLICY_NOKS 0x2
26 #define SEV_POLICY_ES 0x4
27 #define SEV_POLICY_NOSEND 0x8
28 #define SEV_POLICY_DOMAIN 0x10
29 #define SEV_POLICY_SEV 0x20
31 #define TYPE_QSEV_GUEST_INFO "sev-guest"
32 #define QSEV_GUEST_INFO(obj) \
33 OBJECT_CHECK(QSevGuestInfo, (obj), TYPE_QSEV_GUEST_INFO)
35 extern bool sev_enabled(void);
36 extern uint64_t sev_get_me_mask(void);
37 extern SevInfo
*sev_get_info(void);
38 extern uint32_t sev_get_cbit_position(void);
39 extern uint32_t sev_get_reduced_phys_bits(void);
40 extern char *sev_get_launch_measurement(void);
41 extern SevCapability
*sev_get_capabilities(void);
43 typedef struct QSevGuestInfo QSevGuestInfo
;
44 typedef struct QSevGuestInfoClass QSevGuestInfoClass
;
49 * The QSevGuestInfo object is used for creating a SEV guest.
52 * -object sev-guest,id=sev0 \
53 * -machine ...,memory-encryption=sev0
55 struct QSevGuestInfo
{
64 uint32_t reduced_phys_bits
;
67 struct QSevGuestInfoClass
{
68 ObjectClass parent_class
;
72 QSevGuestInfo
*sev_info
;
79 uint32_t reduced_phys_bits
;
86 typedef struct SEVState SEVState
;