]> Git Repo - qemu.git/blob - target/i386/sev_i386.h
sev/i386: add command to initialize the memory encryption context
[qemu.git] / target / i386 / sev_i386.h
1 /*
2  * QEMU Secure Encrypted Virutualization (SEV) support
3  *
4  * Copyright: Advanced Micro Devices, 2016-2018
5  *
6  * Authors:
7  *  Brijesh Singh <[email protected]>
8  *
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.
11  *
12  */
13
14 #ifndef QEMU_SEV_I386_H
15 #define QEMU_SEV_I386_H
16
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-misc.h"
23
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
30
31 #define TYPE_QSEV_GUEST_INFO "sev-guest"
32 #define QSEV_GUEST_INFO(obj)                  \
33     OBJECT_CHECK(QSevGuestInfo, (obj), TYPE_QSEV_GUEST_INFO)
34
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
41 typedef struct QSevGuestInfo QSevGuestInfo;
42 typedef struct QSevGuestInfoClass QSevGuestInfoClass;
43
44 /**
45  * QSevGuestInfo:
46  *
47  * The QSevGuestInfo object is used for creating a SEV guest.
48  *
49  * # $QEMU \
50  *         -object sev-guest,id=sev0 \
51  *         -machine ...,memory-encryption=sev0
52  */
53 struct QSevGuestInfo {
54     Object parent_obj;
55
56     char *sev_device;
57     uint32_t policy;
58     uint32_t handle;
59     char *dh_cert_file;
60     char *session_file;
61     uint32_t cbitpos;
62     uint32_t reduced_phys_bits;
63 };
64
65 struct QSevGuestInfoClass {
66     ObjectClass parent_class;
67 };
68
69 struct SEVState {
70     QSevGuestInfo *sev_info;
71     uint8_t api_major;
72     uint8_t api_minor;
73     uint8_t build_id;
74     uint32_t policy;
75     uint64_t me_mask;
76     uint32_t cbitpos;
77     uint32_t reduced_phys_bits;
78     uint32_t handle;
79     int sev_fd;
80     SevState state;
81 };
82
83 typedef struct SEVState SEVState;
84
85 #endif
This page took 0.029172 seconds and 4 git commands to generate.