Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
de59511
x86/hvm: Use direct structures instead of guest handles
TSnake41 Jul 22, 2025
0bbc0f2
common: Isolate XENVER_get_features into a separate function
TSnake41 Jul 22, 2025
3443dc8
common/grant_table: Use direct structures instead of guest handles
TSnake41 Jul 24, 2025
43589cd
WIP: FastABI bits
TSnake41 Jul 16, 2025
d3f3f4a
x86/msr: Introduce SYSCFG_MEM_ENCRYPT MSR.
TSnake41 May 9, 2025
f1b3e3c
x86/svm: Move svm_domain structure to svm.h
TSnake41 May 9, 2025
7d4f342
vmx: Introduce vcpu single context VPID invalidation
TSnake41 Mar 14, 2025
1a812dc
x86/hvm: Introduce Xen-wide ASID allocator
TSnake41 Mar 18, 2025
6df9cef
hvm: Allow specifying a prefered asid minimum
TSnake41 Aug 19, 2025
26ef715
x86/crypto: Introduce AMD PSP driver for SEV
TSnake41 May 7, 2025
963d8b3
common: Introduce confidential computing infrastructure
TSnake41 May 7, 2025
f38ce9f
xl/coco: Introduce confidential computing support
TSnake41 May 9, 2025
6ed779b
x86/svm: Introduce NPCTRL VMCB bits
TSnake41 May 9, 2025
d7adf56
x86/cpufeature: Introduce SME and SEV-related CPU features
TSnake41 May 9, 2025
8a5c9b0
x86/coco: Introduce AMD-SEV support
TSnake41 May 9, 2025
e47fa8b
sev/emulate: Handle some non-emulable HVM paths
TSnake41 May 12, 2025
968f7fc
HACK: Add sev_console hypercall
TSnake41 May 13, 2025
719a189
sev: fix typing issue in sev_domain_prepare_initial_mem
TSnake41 Aug 21, 2025
06a4c12
fastabi: fix debug build issue
TSnake41 Aug 21, 2025
809b9ee
coco: some fixes around typing and ifdef-ary
TSnake41 Aug 21, 2025
b7c426a
feat(sev-attestation): skeleton done
Th0rOnDoR Oct 1, 2025
9c6ca36
feat(sev-attestation): xl attestation options
Th0rOnDoR Oct 1, 2025
548fa5c
fix(sev/attestation): prepare pr
Th0rOnDoR Oct 2, 2025
bec4255
fix(sev/attestation): addresses correction for hypercall and names
Th0rOnDoR Oct 6, 2025
a70bbe9
fix(sev/attestation): set default values for psp ret
Th0rOnDoR Oct 6, 2025
61f3c75
change attestation to coco
Th0rOnDoR Oct 22, 2025
3fea632
WIP exports certificates
Th0rOnDoR Oct 24, 2025
1770591
WIP: hypercall with 8500 bytes
Th0rOnDoR Oct 28, 2025
73c2caf
Merge branch 'xen-fastabi-sev' into xen-fastabi-seves
Th0rOnDoR Oct 28, 2025
5880f8e
Add export phd
Th0rOnDoR Oct 30, 2025
2e7db89
WIP : segfault & random buffer
Th0rOnDoR Nov 4, 2025
caeb370
feat(launch start): all settings available
Th0rOnDoR Nov 5, 2025
75d07e0
fix(sev): clean attestation
Th0rOnDoR Nov 6, 2025
e0d45b2
fix(sev): attestation output file option
Th0rOnDoR Nov 6, 2025
245d107
fix(sev): typo in domctl.c
Th0rOnDoR Nov 6, 2025
e2393a9
fix(sev): remove useless includes
Th0rOnDoR Nov 6, 2025
087e030
fix(sev): remove useless includes and typo
Th0rOnDoR Nov 6, 2025
1d0d6e5
fix(sev): typo and clean
Th0rOnDoR Nov 6, 2025
7e1deae
fix(sev): typo and clean
Th0rOnDoR Nov 6, 2025
9b26cac
fix(sev): typo and clean
Th0rOnDoR Nov 6, 2025
6bb9c72
fix(sev/launchmeasure) : set 48 bytes
Th0rOnDoR Nov 7, 2025
0da189c
feat(sev): add guest status
Th0rOnDoR Nov 7, 2025
8f2e661
feat(sev): platform ownership
Th0rOnDoR Nov 17, 2025
815c6e9
fix(sev): clean mr
Th0rOnDoR Nov 17, 2025
6f33091
fix(sev): clean mr
Th0rOnDoR Nov 17, 2025
38c0ec3
a bit of documentation / error handling
Th0rOnDoR Nov 20, 2025
6267c6e
error handling on certificate regen
Th0rOnDoR Nov 20, 2025
3086b23
feat(sev): update firmware
Th0rOnDoR Nov 24, 2025
75a831c
split domain creation finished
Th0rOnDoR Dec 1, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions tools/include/libxl.h
Original file line number Diff line number Diff line change
Expand Up @@ -3025,6 +3025,27 @@ static inline int libxl_qemu_monitor_command_0x041200(libxl_ctx *ctx,
*/
int libxl_clear_domid_history(libxl_ctx *ctx);

/*
* Used to retrieve an attestation for a coco domain
*/
int libxl_coco_domain_attestation(libxl_ctx *ctx, uint32_t domid, int file, bool is_mmonce_file, char *mmonce);

/*
* Used to retrieve platform public keys and relevant information (identification, certificates);
*/
int libxl_coco_platform_certs(libxl_ctx *ctx, char *path);

/*
* Retrieve a certificate signing request
*/
int libxl_coco_csr(libxl_ctx *ctx, char* path);

int libxl_coco_update(libxl_ctx *ctx, char* path);

int libxl_coco_regen_certificate(libxl_ctx *ctx, char* cert);

int libxl_coco_import_certificate(libxl_ctx *ctx, char* pek, char *crt);

#endif /* LIBXL_H */

/*
Expand Down
9 changes: 8 additions & 1 deletion tools/include/xenctrl.h
Original file line number Diff line number Diff line change
Expand Up @@ -1685,6 +1685,13 @@ int xc_get_hvm_param(xc_interface *handle, uint32_t dom, int param, unsigned lon

int xc_coco_platform_status(xc_interface *handle, coco_platform_status_t *status);
int xc_coco_prepare_initial_mem(xc_interface *handle, coco_prepare_initial_mem_t *cmd);
int xc_coco_finish_initial_mem(xc_interface *handle, domid_t domid);
int xc_coco_get_attestation(xc_interface *handle, coco_attestation_report_t *report);
int xc_coco_get_platform_certs(xc_interface *handle, coco_platform_certs_t *cmd);
int xc_coco_get_csr(xc_interface *handle, coco_certificate_t *cmd);
int xc_coco_regen_certificate(xc_interface *handle, coco_certificate_name_t cert);
int xc_coco_import_certificate(xc_interface *handle, coco_platform_import_certs_t *cmd);
int xc_coco_update(xc_interface *handle, coco_update_t *cmd);

/* HVM guest pass-through */
int xc_assign_device(xc_interface *xch,
Expand Down Expand Up @@ -2684,4 +2691,4 @@ int xc_dt_overlay_domain(xc_interface *xch, void *overlay_fdt,
* tab-width: 4
* indent-tabs-mode: nil
* End:
*/
*/
37 changes: 37 additions & 0 deletions tools/libs/ctrl/xc_domain.c
Original file line number Diff line number Diff line change
Expand Up @@ -1532,6 +1532,43 @@ int xc_coco_prepare_initial_mem(xc_interface *handle, coco_prepare_initial_mem_t
return rc;
}

int xc_coco_finish_initial_mem(xc_interface *handle, domid_t domid)
{
DECLARE_HYPERCALL_BUFFER(domid_t, arg);
int rc;

arg = xc_hypercall_buffer_alloc(handle, arg, sizeof(*arg));
if ( arg == NULL )
return -1;
*arg = domid;

rc = xencall2(handle->xcall, __HYPERVISOR_coco_op, XEN_COCO_finish_initial_mem,
HYPERCALL_BUFFER_AS_ARG(arg));

xc_hypercall_buffer_free(handle, arg);
return rc;
}

int xc_coco_get_attestation(xc_interface *handle, coco_attestation_report_t *cmd)
{
DECLARE_HYPERCALL_BUFFER(coco_attestation_report_t, arg);
int rc;

arg = xc_hypercall_buffer_alloc(handle, arg, sizeof(*arg));
if ( arg == NULL )
return -1;
memcpy(arg, cmd, sizeof(coco_attestation_report_t));

rc = xencall2(handle->xcall, __HYPERVISOR_coco_op, XEN_COCO_attestation_report,
HYPERCALL_BUFFER_AS_ARG(arg));

if (!rc) {
memcpy(cmd, arg, sizeof(coco_attestation_report_t));
}
xc_hypercall_buffer_free(handle, arg);
return rc;
}

int xc_domain_setdebugging(xc_interface *xch,
uint32_t domid,
unsigned int enable)
Expand Down
99 changes: 99 additions & 0 deletions tools/libs/ctrl/xc_version.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

#include "xc_private.h"
#include <assert.h>
#include <xen/hvm/coco.h>

static int do_xen_version(xc_interface *xch, int cmd,
xc_hypercall_buffer_t *dest)
Expand Down Expand Up @@ -204,3 +205,101 @@ char *xc_xenver_buildid(xc_interface *xch)

return res;
}


int xc_coco_get_platform_certs(xc_interface *handle, coco_platform_certs_t *cmd)
{
DECLARE_HYPERCALL_BUFFER(coco_platform_certs_t, arg);
int rc;

arg = xc_hypercall_buffer_alloc(handle, arg, sizeof(*arg));
if ( arg == NULL )
return -1;
memcpy(arg, cmd, sizeof(coco_platform_certs_t));

rc = xencall2(handle->xcall, __HYPERVISOR_coco_op, XEN_COCO_platform_certs,
HYPERCALL_BUFFER_AS_ARG(arg));

if (!rc) {
memcpy(cmd, arg, sizeof(coco_platform_certs_t));
}
xc_hypercall_buffer_free(handle, arg);
return rc;
}

int xc_coco_get_csr(xc_interface *handle, coco_certificate_t *cmd)
{
DECLARE_HYPERCALL_BUFFER(coco_certificate_t, arg);
int rc;

arg = xc_hypercall_buffer_alloc(handle, arg, sizeof(*arg));
if ( arg == NULL )
return -1;
memcpy(arg, cmd, sizeof(coco_certificate_t));

rc = xencall2(handle->xcall, __HYPERVISOR_coco_op, XEN_COCO_platform_csr,
HYPERCALL_BUFFER_AS_ARG(arg));

if (!rc) {
memcpy(cmd, arg, sizeof(coco_certificate_t));
}
xc_hypercall_buffer_free(handle, arg);
return rc;
}

int xc_coco_update(xc_interface *handle, coco_update_t *cmd)
{
DECLARE_HYPERCALL_BUFFER(coco_update_t, arg);
int rc;

arg = xc_hypercall_buffer_alloc(handle, arg, sizeof(*arg));
if ( arg == NULL )
return -1;
memcpy(arg, cmd, sizeof(coco_update_t));

rc = xencall2(handle->xcall, __HYPERVISOR_coco_op, XEN_COCO_platform_update,
HYPERCALL_BUFFER_AS_ARG(arg));

if (!rc) {
memcpy(cmd, arg, sizeof(coco_update_t));
}
xc_hypercall_buffer_free(handle, arg);
return rc;
}
int xc_coco_regen_certificate(xc_interface *handle, coco_certificate_name_t cert)
{
/* Maybe it's not necessary to add another syscall for that */
DECLARE_HYPERCALL_BUFFER(coco_certificate_name_t, arg);
int rc;

arg = xc_hypercall_buffer_alloc(handle, arg, sizeof(*arg));
if ( arg == NULL )
return -1;
*arg = cert;

rc = xencall2(handle->xcall, __HYPERVISOR_coco_op, XEN_COCO_platform_regen_cert,
HYPERCALL_BUFFER_AS_ARG(arg));

xc_hypercall_buffer_free(handle, arg);
return rc;
}

int xc_coco_import_certificate(xc_interface *handle, coco_platform_import_certs_t *cmd)
{
DECLARE_HYPERCALL_BUFFER(coco_platform_import_certs_t, arg);
int rc;

arg = xc_hypercall_buffer_alloc(handle, arg, sizeof(*arg));
if ( arg == NULL )
return -1;
memcpy(arg, cmd, sizeof(coco_platform_import_certs_t));

rc = xencall2(handle->xcall, __HYPERVISOR_coco_op, XEN_COCO_platform_cert_import,
HYPERCALL_BUFFER_AS_ARG(arg));

if (!rc) {
memcpy(cmd, arg, sizeof(coco_platform_import_certs_t));
}
xc_hypercall_buffer_free(handle, arg);
return rc;
}
10 changes: 8 additions & 2 deletions tools/libs/guest/xg_dom_boot.c
Original file line number Diff line number Diff line change
Expand Up @@ -192,10 +192,10 @@ int xc_dom_boot_image(struct xc_dom_image *dom)
(rc = dom->arch_hooks->setup_pgtables(dom)) != 0 )
return rc;

if ( dom->coco )
if ( dom->coco ) {
/* We need to check if we are actually a SEV-ES guest to set SIF_HVM_GHCB */
dom->use_ghcb = info.arch_config.coco.sev.policy & 0x4;

}
/* start info page */
if ( dom->arch_hooks->start_info )
dom->arch_hooks->start_info(dom);
Expand Down Expand Up @@ -241,6 +241,12 @@ int xc_dom_boot_image(struct xc_dom_image *dom)
/* let the vm run */
if ( (rc = dom->arch_hooks->vcpu(dom)) != 0 )
return rc;

if (dom->coco) {
/* vcpu needs to be initialized */
if ( (rc = xg_dom_coco_finish_encrypt(dom->xch, dom)) != 0 )
return rc;
}
xc_dom_unmap_all(dom);

return rc;
Expand Down
4 changes: 4 additions & 0 deletions tools/libs/guest/xg_dom_coco.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,8 @@ int xg_dom_coco_encrypt_seg(xc_interface *xch, struct xc_dom_image *dom,
cmd.count = seg.pages;

return xc_coco_prepare_initial_mem(xch, &cmd);
}
int xg_dom_coco_finish_encrypt(xc_interface *xch, struct xc_dom_image *dom)
{
return xc_coco_finish_initial_mem(xch, dom->guest_domid);
}
2 changes: 2 additions & 0 deletions tools/libs/guest/xg_dom_coco.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
int xg_dom_coco_encrypt_seg(xc_interface *xch, struct xc_dom_image *dom,
struct xc_dom_seg seg, const char *name);

int xg_dom_coco_finish_encrypt(xc_interface *xch, struct xc_dom_image *dom);

#endif /* XC_DOM_COCO_H */

/*
Expand Down
2 changes: 2 additions & 0 deletions tools/libs/light/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ OBJS-y += libxl_colo_nic.o
else
OBJS-y += libxl_no_colo.o
endif
# TODO: add something like CONFIG_COCO ?
OBJS-y += libxl_coco.o

ACPI_PATH = $(XEN_ROOT)/tools/libacpi
DSDT_FILES-$(CONFIG_X86) = dsdt_pvh.c
Expand Down
Loading