Skip to content

Commit 894ae0c

Browse files
committed
Support CoVE local attestation by reserving memory in the kernel image 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>
1 parent 6e702e9 commit 894ae0c

File tree

5 files changed

+28
-0
lines changed

5 files changed

+28
-0
lines changed

arch/riscv/cove/core.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
#include <asm/sbi.h>
1414
#include <asm/cove.h>
1515

16+
extern char __cove_tap_start[];
17+
1618
static bool is_tvm;
1719

1820
bool is_cove_guest(void)

arch/riscv/kernel/head.S

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,7 @@ ENTRY(_start_kernel)
205205
li a7, COVE_PROMOTE_SBI_EXT_ID
206206
li a6, COVE_PROMOTE_SBI_FID
207207
mv a0, a1
208+
la a1, __cove_tap_start
208209
ecall
209210
mv a0, s1
210211
mv a1, s2

arch/riscv/kernel/vmlinux-xip.lds.S

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,17 @@ SECTIONS
5858
}
5959
_exiprom = .; /* End of XIP ROM area */
6060

61+
#ifdef CONFIG_RISCV_COVE_GUEST
62+
. = ALIGN(4096);
63+
.cove_tvm_attestation_payload : {
64+
__cove_tap_start = .;
65+
LONG(0xace0ace0)
66+
SHORT(0x0FFA)
67+
FILL(0x00)
68+
. += 4090;
69+
__cove_tap_end = .;
70+
}
71+
#endif
6172

6273
/*
6374
* From this point, stuff is considered writable and will be copied to RAM

arch/riscv/kernel/vmlinux.lds.S

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,18 @@ SECTIONS
113113
}
114114
__init_end = .;
115115

116+
#ifdef CONFIG_RISCV_COVE_GUEST
117+
. = ALIGN(4096);
118+
.cove_tvm_attestation_payload : {
119+
__cove_tap_start = .;
120+
LONG(0xace0ace0)
121+
SHORT(0x0FFA)
122+
FILL(0x00)
123+
. += 4090;
124+
__cove_tap_end = .;
125+
}
126+
#endif
127+
116128
/* Start of data section */
117129
_sdata = .;
118130
RO_DATA(SECTION_ALIGN)

drivers/of/fdt.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1167,6 +1167,7 @@ int __init early_init_dt_scan_chosen(char *cmdline)
11671167
early_init_dt_check_for_initrd(node);
11681168
early_init_dt_check_for_elfcorehdr(node);
11691169

1170+
#ifndef CONFIG_RISCV_COVE_GUEST
11701171
rng_seed = of_get_flat_dt_prop(node, "rng-seed", &l);
11711172
if (rng_seed && l > 0) {
11721173
add_bootloader_randomness(rng_seed, l);
@@ -1178,6 +1179,7 @@ int __init early_init_dt_scan_chosen(char *cmdline)
11781179
of_fdt_crc32 = crc32_be(~0, initial_boot_params,
11791180
fdt_totalsize(initial_boot_params));
11801181
}
1182+
#endif
11811183

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

0 commit comments

Comments
 (0)