From 76169cd214e4830a523c8c2ee7bbddc04b4253df Mon Sep 17 00:00:00 2001 From: Miquel Sabaté Solà Date: Thu, 5 Dec 2024 15:34:33 +0100 Subject: supervisor: Add an example on the HSM extension MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The HSM extension from SBI v2.0 allows a supervisor to manage the state of harts on the system. Moreover, it also guarantees that only one hart makes it into the booting stages of the supervisor, and it's up to the supervisor to wake up the rest through the HSM extension. I have added an example which showcases this extension in different ways, and it finally shuts down the machine. Signed-off-by: Miquel Sabaté Solà --- arch/riscv/supervisor/hsm/hsm.ld.S | 48 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 arch/riscv/supervisor/hsm/hsm.ld.S (limited to 'arch/riscv/supervisor/hsm/hsm.ld.S') diff --git a/arch/riscv/supervisor/hsm/hsm.ld.S b/arch/riscv/supervisor/hsm/hsm.ld.S new file mode 100644 index 0000000..db83dc9 --- /dev/null +++ b/arch/riscv/supervisor/hsm/hsm.ld.S @@ -0,0 +1,48 @@ +#define PAGE_SIZE 0x1000 +#define STACK_SIZE PAGE_SIZE + +#define LOAD_BASE_ADDR 0x80000000 +#define LOAD_BASE_OFFSET 0x00200000 +#define LOAD_OFFSET (LOAD_BASE_ADDR + LOAD_BASE_OFFSET) + +OUTPUT_ARCH(riscv) +ENTRY(_start) + +SECTIONS { + . = LOAD_OFFSET; + _start = .; + . = ALIGN(PAGE_SIZE); + + .text : { + _text = .; + KEEP(*(.head.text)) + . = ALIGN(PAGE_SIZE); + *(.text) + } + . = ALIGN(PAGE_SIZE); + + .data : { + *(.data) + } + . = ALIGN(8); + + .rodata : { + *(.rodata) + } + . = ALIGN(8); + + .sdata : { + *(.sdata*) + } + . = ALIGN(8); + + .bss : { + *(.bss) + } + + . = ALIGN(8); + . = . + STACK_SIZE; + _STACK_PTR = .; + + _end = .; +} -- cgit v1.2.3