Skip to content

Commit daba2b6

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 2fed82b commit daba2b6

File tree

4 files changed

+27
-0
lines changed

4 files changed

+27
-0
lines changed

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, 0x434F5648 /* SBI_EXT_COVH */
206206
li a6, 0x15 /* SBI_EXT_COVH_PROMOTE_TO_TVM */
207207
mv a0, a1 /* DTB physical address */
208+
la a1, __cove_tap_start /* TAP physical address */
208209
ecall
209210
/* Attestation reflects the result of promotion, so ignore it */
210211
mv a0, s0

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,18 @@ SECTIONS
106106
}
107107
__init_end = .;
108108

109+
#ifdef CONFIG_RISCV_COVE_GUEST
110+
. = ALIGN(4096);
111+
.cove_tvm_attestation_payload : {
112+
__cove_tap_start = .;
113+
LONG(0xace0ace0)
114+
SHORT(0x0FFA)
115+
FILL(0x00)
116+
. += 4090;
117+
__cove_tap_end = .;
118+
}
119+
#endif
120+
109121
. = ALIGN(16);
110122
.xip.traps : {
111123
__xip_traps_start = .;

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)