]> git.proxmox.com Git - mirror_qemu.git/blame - target/i386/sev_i386.h
i386: Fix signedness of hyperv_spinlock_attempts
[mirror_qemu.git] / target / i386 / sev_i386.h
CommitLineData
a9b4942f
BS
1/*
2 * QEMU Secure Encrypted Virutualization (SEV) support
3 *
4 * Copyright: Advanced Micro Devices, 2016-2018
5 *
6 * Authors:
7 * Brijesh Singh <brijesh.singh@amd.com>
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"
d8575c6c 20#include "sysemu/sev.h"
a9b4942f 21#include "qemu/error-report.h"
b0227cdb 22#include "qapi/qapi-commands-misc-target.h"
a9b4942f
BS
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
d8575c6c
BS
35extern bool sev_enabled(void);
36extern uint64_t sev_get_me_mask(void);
37extern SevInfo *sev_get_info(void);
38extern uint32_t sev_get_cbit_position(void);
39extern uint32_t sev_get_reduced_phys_bits(void);
c6c89c97 40extern char *sev_get_launch_measurement(void);
9f750794 41extern SevCapability *sev_get_capabilities(void);
d8575c6c 42
a9b4942f
BS
43typedef struct QSevGuestInfo QSevGuestInfo;
44typedef struct QSevGuestInfoClass QSevGuestInfoClass;
45
46/**
47 * QSevGuestInfo:
48 *
49 * The QSevGuestInfo object is used for creating a SEV guest.
50 *
51 * # $QEMU \
52 * -object sev-guest,id=sev0 \
53 * -machine ...,memory-encryption=sev0
54 */
55struct QSevGuestInfo {
56 Object parent_obj;
57
58 char *sev_device;
59 uint32_t policy;
60 uint32_t handle;
61 char *dh_cert_file;
62 char *session_file;
63 uint32_t cbitpos;
64 uint32_t reduced_phys_bits;
65};
66
67struct QSevGuestInfoClass {
68 ObjectClass parent_class;
69};
70
d8575c6c
BS
71struct SEVState {
72 QSevGuestInfo *sev_info;
73 uint8_t api_major;
74 uint8_t api_minor;
75 uint8_t build_id;
76 uint32_t policy;
77 uint64_t me_mask;
78 uint32_t cbitpos;
79 uint32_t reduced_phys_bits;
80 uint32_t handle;
81 int sev_fd;
82 SevState state;
c6c89c97 83 gchar *measurement;
d8575c6c
BS
84};
85
86typedef struct SEVState SEVState;
87
a9b4942f 88#endif