2018-03-08 12:48:41 +00:00
|
|
|
/*
|
|
|
|
* QEMU Secure Encrypted Virutualization (SEV) support
|
|
|
|
*
|
|
|
|
* Copyright: Advanced Micro Devices, 2016-2018
|
|
|
|
*
|
|
|
|
* Authors:
|
|
|
|
* Brijesh Singh <brijesh.singh@amd.com>
|
|
|
|
*
|
|
|
|
* This work is licensed under the terms of the GNU GPL, version 2 or later.
|
|
|
|
* See the COPYING file in the top-level directory.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef QEMU_SEV_I386_H
|
|
|
|
#define QEMU_SEV_I386_H
|
|
|
|
|
2021-10-07 16:17:09 +00:00
|
|
|
#ifndef CONFIG_USER_ONLY
|
|
|
|
#include CONFIG_DEVICES /* CONFIG_SEV */
|
|
|
|
#endif
|
|
|
|
|
2021-10-07 16:17:08 +00:00
|
|
|
#include "exec/confidential-guest-support.h"
|
2019-08-12 05:23:32 +00:00
|
|
|
#include "qapi/qapi-types-misc-target.h"
|
2018-03-08 12:48:41 +00:00
|
|
|
|
|
|
|
#define SEV_POLICY_NODBG 0x1
|
|
|
|
#define SEV_POLICY_NOKS 0x2
|
|
|
|
#define SEV_POLICY_ES 0x4
|
|
|
|
#define SEV_POLICY_NOSEND 0x8
|
|
|
|
#define SEV_POLICY_DOMAIN 0x10
|
|
|
|
#define SEV_POLICY_SEV 0x20
|
|
|
|
|
2021-09-30 05:49:14 +00:00
|
|
|
typedef struct SevKernelLoaderContext {
|
|
|
|
char *setup_data;
|
|
|
|
size_t setup_size;
|
|
|
|
char *kernel_data;
|
|
|
|
size_t kernel_size;
|
|
|
|
char *initrd_data;
|
|
|
|
size_t initrd_size;
|
|
|
|
char *cmdline_data;
|
|
|
|
size_t cmdline_size;
|
|
|
|
} SevKernelLoaderContext;
|
|
|
|
|
2021-10-07 16:17:09 +00:00
|
|
|
#ifdef CONFIG_SEV
|
2021-10-07 16:17:08 +00:00
|
|
|
bool sev_enabled(void);
|
2021-10-07 16:17:09 +00:00
|
|
|
bool sev_es_enabled(void);
|
|
|
|
#else
|
|
|
|
#define sev_enabled() 0
|
|
|
|
#define sev_es_enabled() 0
|
|
|
|
#endif
|
|
|
|
|
2018-03-08 12:48:44 +00:00
|
|
|
extern SevInfo *sev_get_info(void);
|
|
|
|
extern uint32_t sev_get_cbit_position(void);
|
|
|
|
extern uint32_t sev_get_reduced_phys_bits(void);
|
2018-03-08 12:48:51 +00:00
|
|
|
extern char *sev_get_launch_measurement(void);
|
2020-06-30 15:35:46 +00:00
|
|
|
extern SevCapability *sev_get_capabilities(Error **errp);
|
2021-04-29 17:07:28 +00:00
|
|
|
extern SevAttestationReport *
|
|
|
|
sev_get_attestation_report(const char *mnonce, Error **errp);
|
2021-09-30 05:49:14 +00:00
|
|
|
extern bool sev_add_kernel_loader_hashes(SevKernelLoaderContext *ctx, Error **errp);
|
2018-03-08 12:48:44 +00:00
|
|
|
|
2021-10-07 16:17:08 +00:00
|
|
|
int sev_encrypt_flash(uint8_t *ptr, uint64_t len, Error **errp);
|
|
|
|
int sev_inject_launch_secret(const char *hdr, const char *secret,
|
|
|
|
uint64_t gpa, Error **errp);
|
|
|
|
|
|
|
|
int sev_es_save_reset_vector(void *flash_ptr, uint64_t flash_size);
|
|
|
|
void sev_es_set_reset_vector(CPUState *cpu);
|
|
|
|
|
|
|
|
int sev_kvm_init(ConfidentialGuestSupport *cgs, Error **errp);
|
|
|
|
|
2018-03-08 12:48:41 +00:00
|
|
|
#endif
|