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 Nov 4, 2024
1 parent 2fed82b commit a08f811
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
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, 0x434F5648 /* SBI_EXT_COVH */
li a6, 0x15 /* SBI_EXT_COVH_PROMOTE_TO_TVM */
mv a0, a1 /* DTB physical address */
la a1, __cove_tap_start /* TAP physical address */
ecall
/* Attestation reflects the result of promotion, so ignore it */
mv a0, s0
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_PROMOTE
. = 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 a08f811

Please sign in to comment.