Skip to content

Commit

Permalink
Support CoVE local attestation by reserving memory in the kernel imag…
Browse files Browse the repository at this point in the history
…e for TVM Attestation

Payload (TAP). Pass the physical address of the TAP when requesting to be promoted to a
TVM.

Signed-off-by: Wojciech Ozga <woz@zurich.ibm.com>
  • Loading branch information
wojciechozga committed Oct 17, 2024
1 parent 6e702e9 commit 894ae0c
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 0 deletions.
2 changes: 2 additions & 0 deletions arch/riscv/cove/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
#include <asm/sbi.h>
#include <asm/cove.h>

extern char __cove_tap_start[];

static bool is_tvm;

bool is_cove_guest(void)
Expand Down
1 change: 1 addition & 0 deletions arch/riscv/kernel/head.S
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ ENTRY(_start_kernel)
li a7, COVE_PROMOTE_SBI_EXT_ID
li a6, COVE_PROMOTE_SBI_FID
mv a0, a1
la a1, __cove_tap_start
ecall
mv a0, s1
mv a1, s2
Expand Down
11 changes: 11 additions & 0 deletions arch/riscv/kernel/vmlinux-xip.lds.S
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,17 @@ SECTIONS
}
_exiprom = .; /* End of XIP ROM area */

#ifdef CONFIG_RISCV_COVE_GUEST
. = ALIGN(4096);
.cove_tvm_attestation_payload : {
__cove_tap_start = .;
LONG(0xace0ace0)
SHORT(0x0FFA)
FILL(0x00)
. += 4090;
__cove_tap_end = .;
}
#endif

/*
* From this point, stuff is considered writable and will be copied to RAM
Expand Down
12 changes: 12 additions & 0 deletions arch/riscv/kernel/vmlinux.lds.S
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,18 @@ SECTIONS
}
__init_end = .;

#ifdef CONFIG_RISCV_COVE_GUEST
. = ALIGN(4096);
.cove_tvm_attestation_payload : {
__cove_tap_start = .;
LONG(0xace0ace0)
SHORT(0x0FFA)
FILL(0x00)
. += 4090;
__cove_tap_end = .;
}
#endif

/* Start of data section */
_sdata = .;
RO_DATA(SECTION_ALIGN)
Expand Down
2 changes: 2 additions & 0 deletions drivers/of/fdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -1167,6 +1167,7 @@ int __init early_init_dt_scan_chosen(char *cmdline)
early_init_dt_check_for_initrd(node);
early_init_dt_check_for_elfcorehdr(node);

#ifndef CONFIG_RISCV_COVE_GUEST
rng_seed = of_get_flat_dt_prop(node, "rng-seed", &l);
if (rng_seed && l > 0) {
add_bootloader_randomness(rng_seed, l);
Expand All @@ -1178,6 +1179,7 @@ int __init early_init_dt_scan_chosen(char *cmdline)
of_fdt_crc32 = crc32_be(~0, initial_boot_params,
fdt_totalsize(initial_boot_params));
}
#endif

/* Retrieve command line */
p = of_get_flat_dt_prop(node, "bootargs", &l);
Expand Down

0 comments on commit 894ae0c

Please sign in to comment.