efi_loader: architecture specific UEFI setup
PATCH v2 1/1 efi_loader: architecture specific UEFI setup
RISC-V booting currently is based on a per boot stage lottery to determine the active CPU. The Hart State Management (HSM) SBI extension replaces this lottery by using a dedicated primary CPU.
Cf. Hart State Management Extension, Extension ID: 0x48534D (HSM)
https://github.com/riscv/riscv-sbi-doc/blob/master/riscv-sbi.adoc
In this scenario the id of the active hart has to be passed from boot stage to boot stage. Using a UEFI variable would provide an easy implementation.
This patch provides a weak function that is called at the end of the setup of U-Boot's UEFI sub-system. By overriding this function architecture specific UEFI variables or configuration tables can be created.
---
v2:
reference the Hart State Management Extension in the commit message
--- include/efi_loader.h | 3 +++ lib/efi_loader/efi_setup.c | 16 ++++++++++++++++ 2 files changed, 19 insertions(+)
include/efi_loader.h +3 -0
@@ -116,6 +116,9 @@ extern efi_uintn_t efi_memory_map_key;extern struct efi_runtime_services efi_runtime_services;extern struct efi_system_table systab; +/* Architecture specific initialization of the UEFI system */ +efi_status_t efi_setup_arch_specific (void ); +extern struct efi_simple_text_output_protocol efi_con_out;extern struct efi_simple_text_input_protocol efi_con_in;extern struct efi_console_control_protocol efi_console_control;
lib/efi_loader/efi_setup.c +16 -0
@@ -22,6 +22,17 @@ void __weak allow_unaligned(void) { } +/** +* efi_setup_arch_specific() - architecture specific UEFI setup +* +* This routine can be used to define architecture specific variables +* or configuration tables, e.g. HART id for RISC-V +*/ +efi_status_t __weak efi_setup_arch_specific (void ) +{ +return EFI_SUCCESS ; +} +/** * efi_init_platform_lang() - define supported languages *
@@ -179,6 +190,11 @@ efi_status_t efi_init_obj_list(void)if (ret !=EFI_SUCCESS ) goto out; +/* Architecture specific setup */ + ret =efi_setup_arch_specific (); +if (ret !=EFI_SUCCESS ) + goto out; + out: efi_obj_list_initialized = ret;return ret;
--
2.24.1
PATCH v2 1/1 efi_loader: architecture specific UEFI setup
Quoted 11 lines · Heinrich Schuchardt
RISC-V booting currently is based on a per boot stage lottery to determine the active CPU. The Hart State Management (HSM) SBI extension replaces this lottery by using a dedicated primary CPU.
Cf. Hart State Management Extension, Extension ID:
0x48534D(HSM)
https://github.com/riscv/riscv-sbi-doc/blob/master/riscv-sbi.adocIn this scenario the id of the active hart has to be passed from boot stage to boot stage. Using a UEFI variable would provide an easy implementation.
Quoted 6 lines
This patch provides a weak function that is called at the end of the setup of U-Boot's UEFI sub-system. By overriding this function architecture specific UEFI variables or configuration tables can be created.
Signed-off-by Heinrich Schuchardt <[email protected]>Reviewed-by Atish Patra <[email protected]>
OK, so I have a couple of questions:
- does RISC-V use device tree? if so, why are you not passing the active hart via a property in the /chosen node? I'd assume the EFI stub would not care at all about this information, and it would give you a Linux/RISC-V specific way to convey this information that is independent of EFI.
- using variables to pass information from firmware to OS only is overkill, and config tables are preferred, given that they only require access to the system table. If required, a RISC-V specific data structure containing boot parameters could be installed as a configuration table, and the address passed to the startup code in the kernel proper [rather than just a hart id], allowing you to put any piece of information you like in there.
Config tables work fine with kexec, btw. It is up to the first OS to memblock_reserve() the table to guarantee that it is still there at kexec time, but this applies equally to all other data structures passed as config tables. Alternatively, in this case, you can stipulate that it is passed as AcpiReclaim [ignore the 'Acpi' in the name] which is intended for firmware tables (and we never reclaim it in linux)
I'd also recommend that RISC-V adopt the same principle as ARM does when it comes to EFI: call SetVirtualAddressMap in the stub, so that the kernel proper always sees the same handover state, regardless of kexec. Additionally, you shouldn't ever modify the EFI memory map provided by the firmware, so that the kexec kernel sees the exact same version.
Quoted 59 lines
---
v2:
reference the Hart State Management Extension in the commit message--- include/efi_loader.h | 3 +++ lib/efi_loader/efi_setup.c | 16 ++++++++++++++++ 2 files changed, 19 insertions(+)include/efi_loader.h +3
-0@@ -116,6 +116,9 @@ extern efi_uintn_t efi_memory_map_key;extern struct efi_runtime_services efi_runtime_services;extern struct efi_system_table systab; +/* Architecture specific initialization of the UEFI system */ +efi_status_t efi_setup_arch_specific (void ); +extern struct efi_simple_text_output_protocol efi_con_out;extern struct efi_simple_text_input_protocol efi_con_in;extern struct efi_console_control_protocol efi_console_control;lib/efi_loader/efi_setup.c +16
-1@@ -22,6 +22,17 @@ void __weak allow_unaligned(void) { } +/** +* efi_setup_arch_specific() - architecture specific UEFI setup +* +* This routine can be used to define architecture specific variables +* or configuration tables, e.g. HART id for RISC-V +*/ +efi_status_t __weak efi_setup_arch_specific (void ) +{ +return EFI_SUCCESS ; +} +/** * efi_init_platform_lang() - define supported languages * @@ -179,6 +190,11 @@ efi_status_t efi_init_obj_list(void)if (ret !=EFI_SUCCESS ) goto out; +/* Architecture specific setup */ + ret =efi_setup_arch_specific (); +if (ret !=EFI_SUCCESS ) + goto out; + out: efi_obj_list_initialized = ret;return ret; --2.24.1
PATCH v2 1/1 efi_loader: architecture specific UEFI setup
Quoted 16 lines · Ard Biesheuvel
Quoted 15 lines · Heinrich Schuchardt
RISC-V booting currently is based on a per boot stage lottery to determine the active CPU. The Hart State Management (HSM) SBI extension replaces this lottery by using a dedicated primary CPU.
Cf. Hart State Management Extension, Extension ID:
0x48534D(HSM)
https://github.com/riscv/riscv-sbi-doc/blob/master/riscv-sbi.adocIn this scenario the id of the active hart has to be passed from boot stage to boot stage. Using a UEFI variable would provide an easy implementation.
This patch provides a weak function that is called at the end of the setup of U-Boot's UEFI sub-system. By overriding this function architecture specific UEFI variables or configuration tables can be created.
Quoted 6 lines
Quoted 2 lines
Signed-off-by Heinrich Schuchardt <[email protected]>Reviewed-by Atish Patra <[email protected]>OK, so I have a couple of questions:
- does RISC-V use device tree? if so, why are you not passing the
In the Linux kernel tree you can find the SiFive HiFive Unleashed device
tree: arch/riscv/boot/dts/sifive/hifive-unleashed-a00.dts
Some of the QEMU emulated RISC-V boards provide device trees, cf.
https://github.com/riscv/riscv-qemu/wiki#machines
Quoted 1 line
active hart via a property in the /chosen node? I'd assume the EFI
There is a hart (core) that calls the entry point of the next boot-stage. Could this define the active hart?
Best regards
Heinrich
Quoted 88 lines
stub would not care at all about this information, and it would give you a Linux/RISC-V specific way to convey this information that is independent of EFI.
- using variables to pass information from firmware to OS only is overkill, and config tables are preferred, given that they only require access to the system table. If required, a RISC-V specific data structure containing boot parameters could be installed as a configuration table, and the address passed to the startup code in the kernel proper [rather than just a hart id], allowing you to put any piece of information you like in there.Config tables work fine with kexec, btw. It is up to the first OS to
memblock_reserve()the table to guarantee that it is still there at kexec time, but this applies equally to all other data structures passed as config tables. Alternatively, in this case, you can stipulate that it is passed as AcpiReclaim [ignore the 'Acpi' in the name] which is intended for firmware tables (and we never reclaim it in linux)I'd also recommend that RISC-V adopt the same principle as ARM does when it comes to EFI: call SetVirtualAddressMap in the stub, so that the kernel proper always sees the same handover state, regardless of kexec. Additionally, you shouldn't ever modify the EFI memory map provided by the firmware, so that the kexec kernel sees the exact same version.
Quoted 59 lines
---
v2:
reference the Hart State Management Extension in the commit message--- include/efi_loader.h | 3 +++ lib/efi_loader/efi_setup.c | 16 ++++++++++++++++ 2 files changed, 19 insertions(+)include/efi_loader.h +3
-0@@ -116,6 +116,9 @@ extern efi_uintn_t efi_memory_map_key;extern struct efi_runtime_services efi_runtime_services;extern struct efi_system_table systab; +/* Architecture specific initialization of the UEFI system */ +efi_status_t efi_setup_arch_specific (void ); +extern struct efi_simple_text_output_protocol efi_con_out;extern struct efi_simple_text_input_protocol efi_con_in;extern struct efi_console_control_protocol efi_console_control;lib/efi_loader/efi_setup.c +16
-1@@ -22,6 +22,17 @@ void __weak allow_unaligned(void) { } +/** +* efi_setup_arch_specific() - architecture specific UEFI setup +* +* This routine can be used to define architecture specific variables +* or configuration tables, e.g. HART id for RISC-V +*/ +efi_status_t __weak efi_setup_arch_specific (void ) +{ +return EFI_SUCCESS ; +} +/** * efi_init_platform_lang() - define supported languages * @@ -179,6 +190,11 @@ efi_status_t efi_init_obj_list(void)if (ret !=EFI_SUCCESS ) goto out; +/* Architecture specific setup */ + ret =efi_setup_arch_specific (); +if (ret !=EFI_SUCCESS ) + goto out; + out: efi_obj_list_initialized = ret;return ret; --2.24.1
PATCH v2 1/1 efi_loader: architecture specific UEFI setup
Hello Daniel, hello Leif,
what is the GRUB view on this discussion?
Best regards
Heinrich
Quoted 134 lines · Heinrich Schuchardt
Quoted 21 lines · Ard Biesheuvel
Quoted 19 lines · Heinrich Schuchardt
RISC-V booting currently is based on a per boot stage lottery to determine
the active CPU. The Hart State Management (HSM) SBI extension replaces this lottery by using a dedicated primary CPU.Cf. Hart State Management Extension, Extension ID:
0x48534D(HSM)
https://github.com/riscv/riscv-sbi-doc/blob/master/riscv-sbi.adocIn this scenario the id of the active hart has to be passed from boot stage
to boot stage. Using a UEFI variable would provide an easy implementation.This patch provides a weak function that is called at the end of the setup
of U-Boot's UEFI sub-system. By overriding this function architecture specific UEFI variables or configuration tables can be created.Quoted 6 lines
Quoted 2 lines
Signed-off-by Heinrich Schuchardt <[email protected]>Reviewed-by Atish Patra <[email protected]>OK, so I have a couple of questions:
- does RISC-V use device tree? if so, why are you not passing the
In the Linux kernel tree you can find the SiFive HiFive Unleashed device
tree:arch/riscv/boot/dts/sifive/hifive-unleashed-a00.dtsSome of the QEMU emulated RISC-V boards provide device trees, cf.
https://github.com/riscv/riscv-qemu/wiki#machinesQuoted 1 line
active hart via a property in the /chosen node? I'd assume the EFI
There is a hart (core) that calls the entry point of the next boot-stage. Could this define the active hart?
Best regards
Heinrich
Quoted 89 lines
stub would not care at all about this information, and it would give you a Linux/RISC-V specific way to convey this information that is independent of EFI.
- using variables to pass information from firmware to OS only is overkill, and config tables are preferred, given that they only require access to the system table. If required, a RISC-V specific data structure containing boot parameters could be installed as a configuration table, and the address passed to the startup code in the kernel proper [rather than just a hart id], allowing you to put any piece of information you like in there.Config tables work fine with kexec, btw. It is up to the first OS to
memblock_reserve()the table to guarantee that it is still there at kexec time, but this applies equally to all other data structures passed as config tables. Alternatively, in this case, you can stipulate that it is passed as AcpiReclaim [ignore the 'Acpi' in the name] which is intended for firmware tables (and we never reclaim it in linux)I'd also recommend that RISC-V adopt the same principle as ARM does when it comes to EFI: call SetVirtualAddressMap in the stub, so that the kernel proper always sees the same handover state, regardless of kexec. Additionally, you shouldn't ever modify the EFI memory map provided by the firmware, so that the kexec kernel sees the exact same version.
Quoted 60 lines
---
v2:
reference the Hart State Management Extension in the commit message
---
include/efi_loader.h | 3 +++lib/efi_loader/efi_setup.c| 16 ++++++++++++++++2 files changed, 19 insertions(+)include/efi_loader.h +3
-0@@ -116,6 +116,9 @@ extern efi_uintn_t efi_memory_map_key; extern struct efi_runtime_services efi_runtime_services; extern struct efi_system_table systab; +/* Architecture specific initialization of the UEFI system */ +efi_status_t efi_setup_arch_specific (void ); + extern struct efi_simple_text_output_protocol efi_con_out; extern struct efi_simple_text_input_protocol efi_con_in; extern struct efi_console_control_protocol efi_console_control;lib/efi_loader/efi_setup.c +16
-0@@ -22,6 +22,17 @@ void __weak allow_unaligned(void) { } +/** +* efi_setup_arch_specific() - architecture specific UEFI setup +* +* This routine can be used to define architecture specific variables +* or configuration tables, e.g. HART id for RISC-V +*/ +efi_status_t __weak efi_setup_arch_specific (void ) +{ + return EFI_SUCCESS; +} + /*** efi_init_platform_lang() - define supported languages * @@ -179,6 +190,11 @@ efi_status_t efi_init_obj_list(void) if (ret != EFI_SUCCESS) goto out; + /* Architecture specific setup */ + ret = efi_setup_arch_specific(); + if (ret != EFI_SUCCESS) + goto out; +out:
efi_obj_list_initialized= ret;
return ret;
--
2.24.1
PATCH v2 1/1 efi_loader: architecture specific UEFI setup
Quoted 3 lines · Heinrich Schuchardt
Hello Daniel, hello Leif,
what is the GRUB view on this discussion?
Alex, could you chime in on this as a GRUB RISC-V maintainer?
Daniel
Quoted 137 lines
Best regards
Heinrich
Quoted 132 lines · Heinrich Schuchardt
Quoted 21 lines · Ard Biesheuvel
Quoted 19 lines · Heinrich Schuchardt
RISC-V booting currently is based on a per boot stage lottery to determine
the active CPU. The Hart State Management (HSM) SBI extension replaces this lottery by using a dedicated primary CPU.Cf. Hart State Management Extension, Extension ID:
0x48534D(HSM)
https://github.com/riscv/riscv-sbi-doc/blob/master/riscv-sbi.adocIn this scenario the id of the active hart has to be passed from boot stage
to boot stage. Using a UEFI variable would provide an easy implementation.This patch provides a weak function that is called at the end of the setup
of U-Boot's UEFI sub-system. By overriding this function architecture specific UEFI variables or configuration tables can be created.Quoted 6 lines
Quoted 2 lines
Signed-off-by Heinrich Schuchardt <[email protected]>Reviewed-by Atish Patra <[email protected]>OK, so I have a couple of questions:
- does RISC-V use device tree? if so, why are you not passing the
In the Linux kernel tree you can find the SiFive HiFive Unleashed device
tree:arch/riscv/boot/dts/sifive/hifive-unleashed-a00.dtsSome of the QEMU emulated RISC-V boards provide device trees, cf.
https://github.com/riscv/riscv-qemu/wiki#machinesQuoted 1 line
active hart via a property in the /chosen node? I'd assume the EFI
There is a hart (core) that calls the entry point of the next boot-stage. Could this define the active hart?
Best regards
Heinrich
Quoted 88 lines
stub would not care at all about this information, and it would give you a Linux/RISC-V specific way to convey this information that is independent of EFI.
- using variables to pass information from firmware to OS only is overkill, and config tables are preferred, given that they only require access to the system table. If required, a RISC-V specific data structure containing boot parameters could be installed as a configuration table, and the address passed to the startup code in the kernel proper [rather than just a hart id], allowing you to put any piece of information you like in there.Config tables work fine with kexec, btw. It is up to the first OS to
memblock_reserve()the table to guarantee that it is still there at kexec time, but this applies equally to all other data structures passed as config tables. Alternatively, in this case, you can stipulate that it is passed as AcpiReclaim [ignore the 'Acpi' in the name] which is intended for firmware tables (and we never reclaim it in linux)I'd also recommend that RISC-V adopt the same principle as ARM does when it comes to EFI: call SetVirtualAddressMap in the stub, so that the kernel proper always sees the same handover state, regardless of kexec. Additionally, you shouldn't ever modify the EFI memory map provided by the firmware, so that the kexec kernel sees the exact same version.
Quoted 59 lines
---
v2:
reference the Hart State Management Extension in the commit message
---
include/efi_loader.h | 3 +++lib/efi_loader/efi_setup.c| 16 ++++++++++++++++2 files changed, 19 insertions(+)include/efi_loader.h +3
-0@@ -116,6 +116,9 @@ extern efi_uintn_t efi_memory_map_key; extern struct efi_runtime_services efi_runtime_services; extern struct efi_system_table systab; +/* Architecture specific initialization of the UEFI system */ +efi_status_t efi_setup_arch_specific (void ); + extern struct efi_simple_text_output_protocol efi_con_out; extern struct efi_simple_text_input_protocol efi_con_in; extern struct efi_console_control_protocol efi_console_control;lib/efi_loader/efi_setup.c +16
-0@@ -22,6 +22,17 @@ void __weak allow_unaligned(void) { } +/** +* efi_setup_arch_specific() - architecture specific UEFI setup +* +* This routine can be used to define architecture specific variables +* or configuration tables, e.g. HART id for RISC-V +*/ +efi_status_t __weak efi_setup_arch_specific (void ) +{ + return EFI_SUCCESS; +} + /*** efi_init_platform_lang() - define supported languages * @@ -179,6 +190,11 @@ efi_status_t efi_init_obj_list(void) if (ret != EFI_SUCCESS) goto out; + /* Architecture specific setup */ + ret = efi_setup_arch_specific(); + if (ret != EFI_SUCCESS) + goto out; +out:
efi_obj_list_initialized= ret;
return ret;
--
2.24.1
PATCH v2 1/1 efi_loader: architecture specific UEFI setup
In reply to Ard BiesheuvelQuoted 17 lines · Ard Biesheuvel
Quoted 15 lines · Heinrich Schuchardt
RISC-V booting currently is based on a per boot stage lottery to determine the active CPU. The Hart State Management (HSM) SBI extension replaces this lottery by using a dedicated primary CPU.
Cf. Hart State Management Extension, Extension ID:
0x48534D(HSM)
https://github.com/riscv/riscv-sbi-doc/blob/master/riscv-sbi.adocIn this scenario the id of the active hart has to be passed from boot stage to boot stage. Using a UEFI variable would provide an easy implementation.
This patch provides a weak function that is called at the end of the setup of U-Boot's UEFI sub-system. By overriding this function architecture specific UEFI variables or configuration tables can be created.
Quoted 7 lines
Quoted 2 lines
Signed-off-by Heinrich Schuchardt <[email protected]>Reviewed-by Atish Patra <[email protected]>OK, so I have a couple of questions:
- does RISC-V use device tree? if so, why are you not passing the active hart via a property in the /chosen node?
Yes. RISC-V uses device tree. Technically, we can pass the active hart by a DT property
but that means we have to modify the DT in OpenSBI (RISC-V specific run time service provider).
We have been trying to avoid that if possible so that DT is not bounced around. This also limits
U-Boot to have its own device tree.
Quoted 3 lines
I'd assume the EFI stub would not care at all about this information, and it would give you a Linux/RISC-V specific way to convey this information that is independent of EFI.
Yes. EFI stub doesn't care about this information. However, it needs to save the information somewhere
so that it can pass to the real kernel after exiting boot time services.
Quoted 8 lines
- using variables to pass information from firmware to OS only is overkill, and config tables are preferred, given that they only require access to the system table. If required, a RISC-V specific data structure containing boot parameters could be installed as a configuration table, and the address passed to the startup code in the kernel proper [rather than just a hart id], allowing you to put any piece of information you like in there.
Sounds good to me. I will experiment with configuration table and send the EFI stub patch series.
Quoted 8 lines
Config tables work fine with kexec, btw. It is up to the first OS to
memblock_reserve()the table to guarantee that it is still there at kexec time, but this applies equally to all other data structures passed as config tables. Alternatively, in this case, you can stipulate that it is passed as AcpiReclaim [ignore the 'Acpi' in the name] which is intended for firmware tables (and we never reclaim it in linux)
Quoted 7 lines
I'd also recommend that RISC-V adopt the same principle as ARM does when it comes to EFI: call SetVirtualAddressMap in the stub, so that the kernel proper always sees the same handover state, regardless of kexec. Additionally, you shouldn't ever modify the EFI memory map provided by the firmware, so that the kexec kernel sees the exact same version.
Sure. There is no kexec implementation available now. We will keep this in mind while implementing it. Thanks!
Quoted 62 lines
Quoted 62 lines
---
v2:
reference the Hart State Management Extension in the commit message--- include/efi_loader.h | 3 +++ lib/efi_loader/efi_setup.c | 16 ++++++++++++++++ 2 files changed, 19 insertions(+)include/efi_loader.h +3
-0@@ -116,6 +116,9 @@ extern efi_uintn_t efi_memory_map_key;extern struct efi_runtime_services efi_runtime_services;extern struct efi_system_table systab; +/* Architecture specific initialization of the UEFI system */ +efi_status_t efi_setup_arch_specific (void ); +extern struct efi_simple_text_output_protocol efi_con_out;extern struct efi_simple_text_input_protocol efi_con_in;extern struct efi_console_control_protocol efi_console_control;lib/efi_loader/efi_setup.c +16
-1@@ -22,6 +22,17 @@ void __weak allow_unaligned(void) { } +/** +* efi_setup_arch_specific() - architecture specific UEFI setup +* +* This routine can be used to define architecture specific variables +* or configuration tables, e.g. HART id for RISC-V +*/ +efi_status_t __weak efi_setup_arch_specific (void ) +{ +return EFI_SUCCESS ; +} +/** * efi_init_platform_lang() - define supported languages * @@ -179,6 +190,11 @@ efi_status_t efi_init_obj_list(void)if (ret !=EFI_SUCCESS ) goto out; +/* Architecture specific setup */ + ret =efi_setup_arch_specific (); +if (ret !=EFI_SUCCESS ) + goto out; + out: efi_obj_list_initialized = ret;return ret; --2.24.1
Signature · 2 lines
Regards, Atish
PATCH v2 1/1 efi_loader: architecture specific UEFI setup
Quoted 23 lines · Atish Patra
Quoted 15 lines · Ard Biesheuvel
Quoted 14 lines · Heinrich Schuchardt
RISC-V booting currently is based on a per boot stage lottery to determine the active CPU. The Hart State Management (HSM) SBI extension replaces this lottery by using a dedicated primary CPU.
Cf. Hart State Management Extension, Extension ID:
0x48534D(HSM)
https://github.com/riscv/riscv-sbi-doc/blob/master/riscv-sbi.adocIn this scenario the id of the active hart has to be passed from boot stage to boot stage. Using a UEFI variable would provide an easy implementation.
This patch provides a weak function that is called at the end of the setup of U-Boot's UEFI sub-system. By overriding this function architecture specific UEFI variables or configuration tables can be created.
Quoted 6 lines
Quoted 2 lines
Signed-off-by Heinrich Schuchardt <[email protected]>Reviewed-by Atish Patra <[email protected]>OK, so I have a couple of questions:
- does RISC-V use device tree? if so, why are you not passing the active hart via a property in the /chosen node?
Quoted 7 lines
Yes. RISC-V uses device tree. Technically, we can pass the active hart by a DT property
but that means we have to modify the DT in OpenSBI (RISC-V specific run time service provider).
We have been trying to avoid that if possible so that DT is not bounced around. This also limits
U-Boot to have its own device tree.
I don't understand how this is different from the UEFI variable scheme proposed here? If you want to create an SBI interface to propagate the active HART that U-Boot then uses to populate the /chosen property, that's probably fine as well.
We already have hooks that allow you to modify the DT right before it gets delivered to the payload. Just add it there?
Quoted 8 lines
Quoted 5 lines
I'd assume the EFI stub would not care at all about this information, and it would give you a Linux/RISC-V specific way to convey this information that is independent of EFI.
Yes. EFI stub doesn't care about this information. However, it needs to save the information somewhere
so that it can pass to the real kernel after exiting boot time services.
DT sounds like a pretty natural choice for that to me :).
Alex
PATCH v2 1/1 efi_loader: architecture specific UEFI setup
Quoted 35 lines · Alexander Graf
Quoted 23 lines · Atish Patra
Quoted 15 lines · Ard Biesheuvel
Quoted 14 lines · Heinrich Schuchardt
RISC-V booting currently is based on a per boot stage lottery to determine the active CPU. The Hart State Management (HSM) SBI extension replaces this lottery by using a dedicated primary CPU.
Cf. Hart State Management Extension, Extension ID:
0x48534D(HSM)
https://github.com/riscv/riscv-sbi-doc/blob/master/riscv-sbi.adocIn this scenario the id of the active hart has to be passed from boot stage to boot stage. Using a UEFI variable would provide an easy implementation.
This patch provides a weak function that is called at the end of the setup of U-Boot's UEFI sub-system. By overriding this function architecture specific UEFI variables or configuration tables can be created.
Quoted 6 lines
Quoted 2 lines
Signed-off-by Heinrich Schuchardt <[email protected]>Reviewed-by Atish Patra <[email protected]>OK, so I have a couple of questions:
- does RISC-V use device tree? if so, why are you not passing the active hart via a property in the /chosen node?
Quoted 7 lines
Yes. RISC-V uses device tree. Technically, we can pass the active hart by a DT property
but that means we have to modify the DT in OpenSBI (RISC-V specific run time service provider).
We have been trying to avoid that if possible so that DT is not bounced around. This also limits
U-Boot to have its own device tree.
Quoted 5 lines
I don't understand how this is different from the UEFI variable scheme proposed here? If you want to create an SBI interface to propagate the active HART that U-Boot then uses to populate the /chosen property, that's probably fine as well.
We don't want to create SBI interface to pass this information.
Quoted 3 lines
We already have hooks that allow you to modify the DT right before it gets delivered to the payload. Just add it there?
Hmm. I guess it is true if the DT is loaded from MMC or network as well. How about EDK2 ? If we go DT route, it also has to modify the DT to pass the boot hart.
As it requires DT modification in multiple projects, why not use efi configuration tables as
suggested by Ard ?
Quoted 16 lines
Quoted 8 lines
Quoted 5 lines
I'd assume the EFI stub would not care at all about this information, and it would give you a Linux/RISC-V specific way to convey this information that is independent of EFI.
Yes. EFI stub doesn't care about this information. However, it needs to save the information somewhere
so that it can pass to the real kernel after exiting boot time services.DT sounds like a pretty natural choice for that to me :).
Alex
Signature · 2 lines
Regards, Atish
PATCH v2 1/1 efi_loader: architecture specific UEFI setup
Quoted 52 lines
Am 06.02.2020 um 22:06 schrieb Atish Patra <[email protected]>:
Quoted 35 lines · Alexander Graf
Quoted 26 lines · Atish Patra
Quoted 15 lines · Ard Biesheuvel
Quoted 14 lines · Heinrich Schuchardt
RISC-V booting currently is based on a per boot stage lottery to determine the active CPU. The Hart State Management (HSM) SBI extension replaces this lottery by using a dedicated primary CPU.
Cf. Hart State Management Extension, Extension ID:
0x48534D(HSM)
https://github.com/riscv/riscv-sbi-doc/blob/master/riscv-sbi.adocIn this scenario the id of the active hart has to be passed from boot stage to boot stage. Using a UEFI variable would provide an easy implementation.
This patch provides a weak function that is called at the end of the setup of U-Boot's UEFI sub-system. By overriding this function architecture specific UEFI variables or configuration tables can be created.
Quoted 6 lines
Quoted 2 lines
Signed-off-by Heinrich Schuchardt <[email protected]>Reviewed-by Atish Patra <[email protected]>OK, so I have a couple of questions:
- does RISC-V use device tree? if so, why are you not passing the active hart via a property in the /chosen node?
Quoted 7 lines
Yes. RISC-V uses device tree. Technically, we can pass the active hart by a DT property
but that means we have to modify the DT in OpenSBI (RISC-V specific run time service provider).
We have been trying to avoid that if possible so that DT is not bounced around. This also limits
U-Boot to have its own device tree.Quoted 5 lines
I don't understand how this is different from the UEFI variable scheme proposed here? If you want to create an SBI interface to propagate the active HART that U-Boot then uses to populate the /chosen property, that's probably fine as well.
We don't want to create SBI interface to pass this information.
Quoted 3 lines
We already have hooks that allow you to modify the DT right before it gets delivered to the payload. Just add it there?
Quoted 7 lines
Hmm. I guess it is true if the DT is loaded from MMC or network as well. How about EDK2 ? If we go DT route, it also has to modify the DT to pass the boot hart.
As it requires DT modification in multiple projects, why not use efi configuration tables as
suggested by Ard ?
How is assembling a configuration table better than modifying a DT?
Alex
Quoted 22 lines
Quoted 17 lines
Quoted 9 lines
Quoted 6 lines
I'd assume the EFI stub would not care at all about this information, and it would give you a Linux/RISC-V specific way to convey this information that is independent of EFI.
Yes. EFI stub doesn't care about this information. However, it needs to save the information somewhere
so that it can pass to the real kernel after exiting boot time services.DT sounds like a pretty natural choice for that to me :).
Alex
Signature · 2 lines
Regards, Atish
PATCH v2 1/1 efi_loader: architecture specific UEFI setup
In reply to Atish PatraQuoted 49 lines · Atish Patra
Quoted 35 lines · Alexander Graf
Quoted 23 lines · Atish Patra
Quoted 15 lines · Ard Biesheuvel
Quoted 14 lines · Heinrich Schuchardt
RISC-V booting currently is based on a per boot stage lottery to determine the active CPU. The Hart State Management (HSM) SBI extension replaces this lottery by using a dedicated primary CPU.
Cf. Hart State Management Extension, Extension ID:
0x48534D(HSM)
https://github.com/riscv/riscv-sbi-doc/blob/master/riscv-sbi.adocIn this scenario the id of the active hart has to be passed from boot stage to boot stage. Using a UEFI variable would provide an easy implementation.
This patch provides a weak function that is called at the end of the setup of U-Boot's UEFI sub-system. By overriding this function architecture specific UEFI variables or configuration tables can be created.
Quoted 6 lines
Quoted 2 lines
Signed-off-by Heinrich Schuchardt <[email protected]>Reviewed-by Atish Patra <[email protected]>OK, so I have a couple of questions:
- does RISC-V use device tree? if so, why are you not passing the active hart via a property in the /chosen node?
Quoted 7 lines
Yes. RISC-V uses device tree. Technically, we can pass the active hart by a DT property
but that means we have to modify the DT in OpenSBI (RISC-V specific run time service provider).
We have been trying to avoid that if possible so that DT is not bounced around. This also limits
U-Boot to have its own device tree.Quoted 5 lines
I don't understand how this is different from the UEFI variable scheme proposed here? If you want to create an SBI interface to propagate the active HART that U-Boot then uses to populate the /chosen property, that's probably fine as well.
We don't want to create SBI interface to pass this information.
Quoted 3 lines
We already have hooks that allow you to modify the DT right before it gets delivered to the payload. Just add it there?
Quoted 8 lines
Hmm. I guess it is true if the DT is loaded from MMC or network as well. How about EDK2 ? If we go DT route, it also has to modify the DT to pass the boot hart.
As it requires DT modification in multiple projects, why not use efi configuration tables as
suggested by Ard ?
Configuration tables are preferred over variables, but putting it in the DT makes even more sense, since in that case, nothing that runs in the UEFI context has to care about any of this.
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
I'd assume the EFI stub would not care at all about this information, and it would give you a Linux/RISC-V specific way to convey this information that is independent of EFI.
Quoted 7 lines
Quoted 7 lines
Quoted 3 lines
Yes. EFI stub doesn't care about this information. However, it needs to save the information somewhere
so that it can pass to the real kernel after exiting boot time services.DT sounds like a pretty natural choice for that to me :).
Indeed. DT has a /chosen node that is set aside for this purpose. It does depend on how early you need the value (i.e., before or after you can run C code), but since you are passing the DT address to the core kernel, it makes way more sense to drop any additional information that you need to pass in there.
PATCH v2 1/1 efi_loader: architecture specific UEFI setup
Quoted 74 lines · Ard Biesheuvel
Quoted 49 lines · Atish Patra
Quoted 35 lines · Alexander Graf
Quoted 23 lines · Atish Patra
Quoted 15 lines · Ard Biesheuvel
Quoted 14 lines · Heinrich Schuchardt
RISC-V booting currently is based on a per boot stage lottery to determine the active CPU. The Hart State Management (HSM) SBI extension replaces this lottery by using a dedicated primary CPU.
Cf. Hart State Management Extension, Extension ID:
0x48534D(HSM)
https://github.com/riscv/riscv-sbi-doc/blob/master/riscv-sbi.adocIn this scenario the id of the active hart has to be passed from boot stage to boot stage. Using a UEFI variable would provide an easy implementation.
This patch provides a weak function that is called at the end of the setup of U-Boot's UEFI sub-system. By overriding this function architecture specific UEFI variables or configuration tables can be created.
Quoted 6 lines
Quoted 2 lines
Signed-off-by Heinrich Schuchardt <[email protected]>Reviewed-by Atish Patra <[email protected]>OK, so I have a couple of questions:
- does RISC-V use device tree? if so, why are you not passing the active hart via a property in the /chosen node?
Quoted 7 lines
Yes. RISC-V uses device tree. Technically, we can pass the active hart by a DT property
but that means we have to modify the DT in OpenSBI (RISC-V specific run time service provider).
We have been trying to avoid that if possible so that DT is not bounced around. This also limits
U-Boot to have its own device tree.Quoted 5 lines
I don't understand how this is different from the UEFI variable scheme proposed here? If you want to create an SBI interface to propagate the active HART that U-Boot then uses to populate the /chosen property, that's probably fine as well.
We don't want to create SBI interface to pass this information.
Quoted 3 lines
We already have hooks that allow you to modify the DT right before it gets delivered to the payload. Just add it there?
Quoted 8 lines
Hmm. I guess it is true if the DT is loaded from MMC or network as well. How about EDK2 ? If we go DT route, it also has to modify the DT to pass the boot hart.
As it requires DT modification in multiple projects, why not use efi configuration tables as
suggested by Ard ?Configuration tables are preferred over variables, but putting it in the DT makes even more sense, since in that case, nothing that runs in the UEFI context has to care about any of this.
Quoted 10 lines
Quoted 10 lines
Quoted 8 lines
Quoted 5 lines
I'd assume the EFI stub would not care at all about this information, and it would give you a Linux/RISC-V specific way to convey this information that is independent of EFI.
Yes. EFI stub doesn't care about this information. However, it needs to save the information somewhere
so that it can pass to the real kernel after exiting boot time services.
Quoted 8 lines
Quoted 2 lines
Quoted 2 lines
DT sounds like a pretty natural choice for that to me :).
Indeed. DT has a /chosen node that is set aside for this purpose. It does depend on how early you need the value (i.e., before or after you can run C code), but since you are passing the DT address to the core kernel, it makes way more sense to drop any additional information that you need to pass in there.
We don't need boot hart id until real kernel boots and parse DT. So that should be okay.
I just looked at the efi stub code once more and realized that it is already parsing the DT to setup
uefi memory maps from /chosen node. Adding boot hart id to the chosen node does seem much
cleaner to me :). Thanks for all the explanations.
I have not looked at EDK2 code. But I am assuming modifying the DT just before jumping to the payload
won't be too hard for EDK2 as well.
Added Leif and Abner for the opinion.
--
Regards,
Atish
Chang
PATCH v2 1/1 efi_loader: architecture specific UEFI setup
Quoted 108 lines
-----Original Message-----
From: Atish Patra [mailto:atishp at atishpatra.org]
Sent: Friday, February 7, 2020 6:56 AM
To: Ard Biesheuvel <[email protected]>; Chang, Abner (HPS SW/FW Technologist) <[email protected]>
Cc: Alexander Graf <[email protected]>; Heinrich Schuchardt <[email protected]>; U-Boot Mailing List <[email protected]>; Atish Patra <[email protected]>; leif at nuviainc.com
Subject: Re: [PATCH v2 1/1]efi_loader: architecture specific UEFI setupQuoted 10 lines · Ard Biesheuvel
Quoted 8 lines · Atish Patra
Quoted 6 lines · Alexander Graf
Quoted 3 lines · Atish Patra
Quoted 1 line · Ard Biesheuvel
On Wed, 5 Feb 2020 at 05:53, Heinrich Schuchardt
Quoted 3 lines · <[email protected]> wrote:
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
RISC-V booting currently is based on a per boot stage lottery to determine the active CPU. The Hart State Management (HSM) SBI extension replaces this lottery by using a dedicated primary
CPU.
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Cf. Hart State Management Extension, Extension ID:
0x48534D(HSM)
https://github.com/riscv/riscv-sbi-doc/blob/master/riscv-sbi.a
docIn this scenario the id of the active hart has to be passed from boot stage to boot stage. Using a UEFI variable would provide
an easy implementation.
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
This patch provides a weak function that is called at the end of the setup of U-Boot's UEFI sub-system. By overriding this function architecture specific UEFI variables or configuration tables
can be created.
Quoted 49 lines
Quoted 27 lines
Quoted 15 lines
Quoted 5 lines
Quoted 5 lines
Quoted 3 lines
Signed-off-by Heinrich Schuchardt <[email protected]>Reviewed-by Atish Patra <[email protected]>OK, so I have a couple of questions:
Quoted 8 lines
Quoted 2 lines
- does RISC-V use device tree? if so, why are you not passing the active hart via a property in the /chosen node?
Yes. RISC-V uses device tree. Technically, we can pass the active hart by a DT property but that means we have to modify the DT in OpenSBI (RISC-V specific run time service provider). We have been trying to avoid that if possible so that DT is not bounced around. This also limits U-Boot to have its own device tree.
Quoted 5 lines
I don't understand how this is different from the UEFI variable scheme proposed here? If you want to create an SBI interface to propagate the active HART that U-Boot then uses to populate the /chosen property, that's probably fine as well.
We don't want to create SBI interface to pass this information.
Quoted 3 lines
We already have hooks that allow you to modify the DT right before it gets delivered to the payload. Just add it there?
Quoted 7 lines
Hmm. I guess it is true if the DT is loaded from MMC or network as well. How about EDK2 ? If we go DT route, it also has to modify the DT to pass the boot hart.
As it requires DT modification in multiple projects, why not use efi configuration tables as suggested by Ard ?
Configuration tables are preferred over variables, but putting it in the DT makes even more sense, since in that case, nothing that runs in the UEFI context has to care about any of this.
Quoted 10 lines
Quoted 10 lines
Quoted 8 lines
Quoted 5 lines
I'd assume the EFI stub would not care at all about this information, and it would give you a Linux/RISC-V specific way to convey this information that is independent of EFI.
Yes. EFI stub doesn't care about this information. However, it needs to save the information somewhere so that it can pass to the real kernel after exiting boot time services.
Quoted 8 lines
Quoted 2 lines
Quoted 2 lines
DT sounds like a pretty natural choice for that to me :).
Indeed. DT has a /chosen node that is set aside for this purpose. It does depend on how early you need the value (i.e., before or after you can run C code), but since you are passing the DT address to the core kernel, it makes way more sense to drop any additional information that you need to pass in there.
We don't need boot hart id until real kernel boots and parse DT. So that should be okay.
I just looked at the efi stub code once more and realized that it is already parsing the DT to setup uefi memory maps from /chosen node. Adding boot hart id to the chosen node does seem much cleaner to me :). Thanks for all the explanations.
Quoted 2 lines
I have not looked at EDK2 code. But I am assuming modifying the DT just before jumping to the payload won't be too hard for EDK2 as well.
We don’t use DT in edk2 RISC-V port and we pass boot HART ID in SMBIOS type 44h as it is spec out in below link,
https://github.com/riscv/riscv-smbios/blob/master/RISCV-SMBIOS.md
Abner
Quoted 8 lines
Added Leif and Abner for the opinion.
--
Regards,
Atish
PATCH v2 1/1 efi_loader: architecture specific UEFI setup
Quoted 108 lines · Abner (HPS SW/FW Technologist)
Quoted 108 lines
-----Original Message-----
From: Atish Patra [mailto:atishp at atishpatra.org]
Sent: Friday, February 7, 2020 6:56 AM
To: Ard Biesheuvel <[email protected]>; Chang, Abner (HPS SW/FW Technologist) <[email protected]>
Cc: Alexander Graf <[email protected]>; Heinrich Schuchardt <[email protected]>; U-Boot Mailing List <[email protected]>; Atish Patra <[email protected]>; leif at nuviainc.com
Subject: Re: [PATCH v2 1/1]efi_loader: architecture specific UEFI setupQuoted 10 lines · Ard Biesheuvel
Quoted 8 lines · Atish Patra
Quoted 6 lines · Alexander Graf
Quoted 3 lines · Atish Patra
Quoted 1 line · Ard Biesheuvel
On Wed, 5 Feb 2020 at 05:53, Heinrich Schuchardt
Quoted 3 lines · <[email protected]> wrote:
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
RISC-V booting currently is based on a per boot stage lottery to determine the active CPU. The Hart State Management (HSM) SBI extension replaces this lottery by using a dedicated primary
CPU.
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Cf. Hart State Management Extension, Extension ID:
0x48534D(HSM)
https://github.com/riscv/riscv-sbi-doc/blob/master/riscv-sbi.a
docIn this scenario the id of the active hart has to be passed from boot stage to boot stage. Using a UEFI variable would provide
an easy implementation.
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
This patch provides a weak function that is called at the end of the setup of U-Boot's UEFI sub-system. By overriding this function architecture specific UEFI variables or configuration tables
can be created.
Quoted 49 lines
Quoted 27 lines
Quoted 15 lines
Quoted 5 lines
Quoted 5 lines
Quoted 3 lines
Signed-off-by Heinrich Schuchardt <[email protected]>Reviewed-by Atish Patra <[email protected]>OK, so I have a couple of questions:
Quoted 8 lines
Quoted 2 lines
- does RISC-V use device tree? if so, why are you not passing the active hart via a property in the /chosen node?
Yes. RISC-V uses device tree. Technically, we can pass the active hart by a DT property but that means we have to modify the DT in OpenSBI (RISC-V specific run time service provider). We have been trying to avoid that if possible so that DT is not bounced around. This also limits U-Boot to have its own device tree.
Quoted 5 lines
I don't understand how this is different from the UEFI variable scheme proposed here? If you want to create an SBI interface to propagate the active HART that U-Boot then uses to populate the /chosen property, that's probably fine as well.
We don't want to create SBI interface to pass this information.
Quoted 3 lines
We already have hooks that allow you to modify the DT right before it gets delivered to the payload. Just add it there?
Quoted 7 lines
Hmm. I guess it is true if the DT is loaded from MMC or network as well. How about EDK2 ? If we go DT route, it also has to modify the DT to pass the boot hart.
As it requires DT modification in multiple projects, why not use efi configuration tables as suggested by Ard ?
Configuration tables are preferred over variables, but putting it in the DT makes even more sense, since in that case, nothing that runs in the UEFI context has to care about any of this.
Quoted 10 lines
Quoted 10 lines
Quoted 8 lines
Quoted 5 lines
I'd assume the EFI stub would not care at all about this information, and it would give you a Linux/RISC-V specific way to convey this information that is independent of EFI.
Yes. EFI stub doesn't care about this information. However, it needs to save the information somewhere so that it can pass to the real kernel after exiting boot time services.
Quoted 8 lines
Quoted 2 lines
Quoted 2 lines
DT sounds like a pretty natural choice for that to me :).
Indeed. DT has a /chosen node that is set aside for this purpose. It does depend on how early you need the value (i.e., before or after you can run C code), but since you are passing the DT address to the core kernel, it makes way more sense to drop any additional information that you need to pass in there.
We don't need boot hart id until real kernel boots and parse DT. So that should be okay.
I just looked at the efi stub code once more and realized that it is already parsing the DT to setup uefi memory maps from /chosen node. Adding boot hart id to the chosen node does seem much cleaner to me :). Thanks for all the explanations.
Quoted 4 lines
Quoted 2 lines
I have not looked at EDK2 code. But I am assuming modifying the DT just before jumping to the payload won't be too hard for EDK2 as well.
We don’t use DT in edk2 RISC-V port and we pass boot HART ID in SMBIOS type 44h as it is spec out in below link,
https://github.com/riscv/riscv-smbios/blob/master/RISCV-SMBIOS.md
Thanks for the link.
For 'RISC-V SMBIOS Type 44 Processor Additional Information' I find entry 0x13h 1: This is boot hart to boot system .
But is '44' a hexadecimal number? The document does not indicate this.
Best regards
Heinrich
Quoted 11 lines
Abner
Quoted 8 lines
Added Leif and Abner for the opinion.
--
Regards,
Atish
Chang
PATCH v2 1/1 efi_loader: architecture specific UEFI setup
Quoted 135 lines
-----Original Message-----
From: Heinrich Schuchardt [mailto:xypron.glpk at gmx.de]
Sent: Wednesday, February 12, 2020 2:26 AM
To: Chang, Abner (HPS SW/FW Technologist) <[email protected]>; Atish Patra <[email protected]>; Ard Biesheuvel <[email protected]>
Cc: Alexander Graf <[email protected]>; U-Boot Mailing List <u- boot at lists.denx.de>; Atish Patra <[email protected]>; leif at nuviainc.com
Subject: Re: [PATCH v2 1/1]efi_loader: architecture specific UEFI setupQuoted 21 lines · Abner (HPS SW/FW Technologist)
Quoted 21 lines
-----Original Message-----
From: Atish Patra [mailto:atishp at atishpatra.org]
Sent: Friday, February 7, 2020 6:56 AM
To: Ard Biesheuvel <[email protected]>; Chang, Abner (HPS SW/FW
Technologist) <[email protected]>
Cc: Alexander Graf <[email protected]>; Heinrich Schuchardt <[email protected]>; U-Boot Mailing List <[email protected]>; Atish Patra <[email protected]>; leif at nuviainc.com
Subject: Re: [PATCH v2 1/1]efi_loader: architecture specific UEFI setupQuoted 4 lines · Ard Biesheuvel
Quoted 2 lines · Atish Patra
On Thu, Feb 6, 2020 at 12:10 PM Alexander Graf <[email protected]>
Quoted 93 lines · wrote:
Quoted 93 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines · Atish Patra
Quoted 3 lines
Quoted 1 line · Ard Biesheuvel
On Wed, 5 Feb 2020 at 05:53, Heinrich Schuchardt
Quoted 4 lines · <[email protected]> wrote:
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
RISC-V booting currently is based on a per boot stage lottery to determine the active CPU. The Hart State Management (HSM) SBI extension replaces this lottery by using a dedicated primary
CPU.
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Cf. Hart State Management Extension, Extension ID:
0x48534D(HSM)
https://github.com/riscv/riscv-sbi-doc/blob/master/riscv-sbi.a
docIn this scenario the id of the active hart has to be passed from boot stage to boot stage. Using a UEFI variable would provide
an easy implementation.
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
This patch provides a weak function that is called at the end of the setup of U-Boot's UEFI sub-system. By overriding this function architecture specific UEFI variables or configuration tables
can be created.
Quoted 49 lines
Quoted 27 lines
Quoted 15 lines
Quoted 5 lines
Quoted 5 lines
Quoted 3 lines
Signed-off-by Heinrich Schuchardt <[email protected]>Reviewed-by Atish Patra <[email protected]>OK, so I have a couple of questions:
Quoted 8 lines
Quoted 2 lines
- does RISC-V use device tree? if so, why are you not passing the active hart via a property in the /chosen node?
Yes. RISC-V uses device tree. Technically, we can pass the active hart by a DT property but that means we have to modify the DT in OpenSBI (RISC-V specific run time service provider).
We have been trying to avoid that if possible so that DT is not bounced around. This also limits U-Boot to have its own device tree.Quoted 5 lines
I don't understand how this is different from the UEFI variable scheme proposed here? If you want to create an SBI interface to propagate the active HART that U-Boot then uses to populate the /chosen property, that's probably fine as well.
We don't want to create SBI interface to pass this information.
Quoted 3 lines
We already have hooks that allow you to modify the DT right before it gets delivered to the payload. Just add it there?
Quoted 7 lines
Hmm. I guess it is true if the DT is loaded from MMC or network as well. How about EDK2 ? If we go DT route, it also has to modify the DT to pass the boot hart.
As it requires DT modification in multiple projects, why not use efi configuration tables as suggested by Ard ?
Configuration tables are preferred over variables, but putting it in the DT makes even more sense, since in that case, nothing that runs in the UEFI context has to care about any of this.
Quoted 10 lines
Quoted 10 lines
Quoted 8 lines
Quoted 5 lines
I'd assume the EFI stub would not care at all about this information, and it would give you a Linux/RISC-V specific way to convey this information that is independent of EFI.
Yes. EFI stub doesn't care about this information. However, it needs to save the information somewhere so that it can pass to the real kernel after exiting boot time services.
Quoted 8 lines
Quoted 2 lines
Quoted 2 lines
DT sounds like a pretty natural choice for that to me :).
Indeed. DT has a /chosen node that is set aside for this purpose. It does depend on how early you need the value (i.e., before or after you can run C code), but since you are passing the DT address to the core kernel, it makes way more sense to drop any additional information that you need to pass in there.
We don't need boot hart id until real kernel boots and parse DT. So that should be okay.
I just looked at the efi stub code once more and realized that it is already parsing the DT to setup uefi memory maps from /chosen node. Adding boot hart id to the chosen node does seem much cleaner to me :). Thanks for all the explanations.Quoted 5 lines
Quoted 2 lines
I have not looked at EDK2 code. But I am assuming modifying the DT just before jumping to the payload won't be too hard for EDK2 as well.
We don?t use DT in edk2 RISC-V port and we pass boot HART ID in SMBIOS type 44h as it is spec out in below link,
https://github.com/riscv/riscv-smbios/blob/master/RISCV-SMBIOS.md
Quoted 6 lines
Thanks for the link.
For 'RISC-V SMBIOS Type 44 Processor Additional Information' I find entry 0x13h 1: This is boot hart to boot system .
But is '44' a hexadecimal number? The document does not indicate this.
Type '44' is decimal format as it mentioned in SMBIOS spec, I had typo in above which said '44h'. However, that's good to mention this in RISCV_SMBIOS.md. Thanks for the recommendation.
Quoted 16 lines
Best regards
Heinrich
Quoted 11 lines
Abner
Quoted 8 lines
Added Leif and Abner for the opinion.
--
Regards,
Atish
PATCH v2 1/1 efi_loader: architecture specific UEFI setup
Quoted 136 lines · Abner (HPS SW/FW Technologist)
Quoted 136 lines
-----Original Message-----
From: Heinrich Schuchardt [mailto:xypron.glpk at gmx.de]
Sent: Wednesday, February 12, 2020 2:26 AM
To: Chang, Abner (HPS SW/FW Technologist) <[email protected]>; Atish Patra <[email protected]>; Ard Biesheuvel <[email protected]>
Cc: Alexander Graf <[email protected]>; U-Boot Mailing List <u- boot at lists.denx.de>; Atish Patra <[email protected]>; leif at nuviainc.com
Subject: Re: [PATCH v2 1/1]efi_loader: architecture specific UEFI setupQuoted 21 lines · Abner (HPS SW/FW Technologist)
Quoted 21 lines
-----Original Message-----
From: Atish Patra [mailto:atishp at atishpatra.org]
Sent: Friday, February 7, 2020 6:56 AM
To: Ard Biesheuvel <[email protected]>; Chang, Abner (HPS SW/FW
Technologist) <[email protected]>
Cc: Alexander Graf <[email protected]>; Heinrich Schuchardt <[email protected]>; U-Boot Mailing List <[email protected]>; Atish Patra <[email protected]>; leif at nuviainc.com
Subject: Re: [PATCH v2 1/1]efi_loader: architecture specific UEFI setupQuoted 4 lines · Ard Biesheuvel
Quoted 2 lines · Atish Patra
On Thu, Feb 6, 2020 at 12:10 PM Alexander Graf <[email protected]>
Quoted 98 lines · wrote:
Quoted 93 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines · Atish Patra
Quoted 3 lines
Quoted 1 line · Ard Biesheuvel
On Wed, 5 Feb 2020 at 05:53, Heinrich Schuchardt
Quoted 4 lines · <[email protected]> wrote:
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
RISC-V booting currently is based on a per boot stage lottery to determine the active CPU. The Hart State Management (HSM) SBI extension replaces this lottery by using a dedicated primary
CPU.
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Cf. Hart State Management Extension, Extension ID:
0x48534D(HSM)
https://github.com/riscv/riscv-sbi-doc/blob/master/riscv-sbi.a
docIn this scenario the id of the active hart has to be passed from boot stage to boot stage. Using a UEFI variable would provide
an easy implementation.
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
This patch provides a weak function that is called at the end of the setup of U-Boot's UEFI sub-system. By overriding this function architecture specific UEFI variables or configuration tables
can be created.
Quoted 49 lines
Quoted 27 lines
Quoted 15 lines
Quoted 5 lines
Quoted 5 lines
Quoted 3 lines
Signed-off-by Heinrich Schuchardt <[email protected]>Reviewed-by Atish Patra <[email protected]>OK, so I have a couple of questions:
Quoted 8 lines
Quoted 2 lines
- does RISC-V use device tree? if so, why are you not passing the active hart via a property in the /chosen node?
Yes. RISC-V uses device tree. Technically, we can pass the active hart by a DT property but that means we have to modify the DT in OpenSBI (RISC-V specific run time service provider).
We have been trying to avoid that if possible so that DT is not bounced around. This also limits U-Boot to have its own device tree.Quoted 5 lines
I don't understand how this is different from the UEFI variable scheme proposed here? If you want to create an SBI interface to propagate the active HART that U-Boot then uses to populate the /chosen property, that's probably fine as well.
We don't want to create SBI interface to pass this information.
Quoted 3 lines
We already have hooks that allow you to modify the DT right before it gets delivered to the payload. Just add it there?
Quoted 7 lines
Hmm. I guess it is true if the DT is loaded from MMC or network as well. How about EDK2 ? If we go DT route, it also has to modify the DT to pass the boot hart.
As it requires DT modification in multiple projects, why not use efi configuration tables as suggested by Ard ?
Configuration tables are preferred over variables, but putting it in the DT makes even more sense, since in that case, nothing that runs in the UEFI context has to care about any of this.
Quoted 10 lines
Quoted 10 lines
Quoted 8 lines
Quoted 5 lines
I'd assume the EFI stub would not care at all about this information, and it would give you a Linux/RISC-V specific way to convey this information that is independent of EFI.
Yes. EFI stub doesn't care about this information. However, it needs to save the information somewhere so that it can pass to the real kernel after exiting boot time services.
Quoted 8 lines
Quoted 2 lines
Quoted 2 lines
DT sounds like a pretty natural choice for that to me :).
Indeed. DT has a /chosen node that is set aside for this purpose. It does depend on how early you need the value (i.e., before or after you can run C code), but since you are passing the DT address to the core kernel, it makes way more sense to drop any additional information that you need to pass in there.
We don't need boot hart id until real kernel boots and parse DT. So that should be okay.
I just looked at the efi stub code once more and realized that it is already parsing the DT to setup uefi memory maps from /chosen node. Adding boot hart id to the chosen node does seem much cleaner to me :). Thanks for all the explanations.Quoted 2 lines
I have not looked at EDK2 code. But I am assuming modifying the DT just before jumping to the payload won't be too hard for EDK2 as well.
We don’t use DT in edk2 RISC-V port and we pass boot HART ID in SMBIOS type 44h as it is spec out in below link,
https://github.com/riscv/riscv-smbios/blob/master/RISCV-SMBIOS.md
Quoted 8 lines
Quoted 6 lines
Thanks for the link.
For 'RISC-V SMBIOS Type 44 Processor Additional Information' I find entry 0x13h 1: This is boot hart to boot system .
But is '44' a hexadecimal number? The document does not indicate this.
Type '44' is decimal format as it mentioned in SMBIOS spec, I had typo in above which said '44h'. However, that's good to mention this in RISCV_SMBIOS.md. Thanks for the recommendation.
Quoted 1 line
SMBIOS data is intended to describe the hardware to system administrators, not to the OS loader, and I don't think it makes sense to rely on it for booting. I'd assume that SMBIOS tables are not mandatory to begin with.
For EFI boot, it is acceptable if the stub loader in Linux itself needs to obtain the value from something like a device tree and pass it in a CPU register at handover time, although I would still prefer it if the kernel simply gets it from the device tree directly if one is guaranteed to be available.
Adding a new ABI between the firmware and the stub loader in Linux to use EFI specific conduits like config tables or EFI variables should really be avoided, though, as it affects every EFI loader while the code that runs in the EFI context doesn't even care (note that beyond u-boot and GRUB, there are other EFI loaders such as systemd-boot that need to be taken into account).
PATCH v2 1/1 efi_loader: architecture specific UEFI setup
Quoted 148 lines · Ard Biesheuvel
Quoted 136 lines · Abner (HPS SW/FW Technologist)
Quoted 136 lines
-----Original Message-----
From: Heinrich Schuchardt [mailto:xypron.glpk at gmx.de]
Sent: Wednesday, February 12, 2020 2:26 AM
To: Chang, Abner (HPS SW/FW Technologist) <[email protected]>; Atish Patra <[email protected]>; Ard Biesheuvel <[email protected]>
Cc: Alexander Graf <[email protected]>; U-Boot Mailing List <u- boot at lists.denx.de>; Atish Patra <[email protected]>; leif at nuviainc.com
Subject: Re: [PATCH v2 1/1]efi_loader: architecture specific UEFI setupQuoted 21 lines · Abner (HPS SW/FW Technologist)
Quoted 21 lines
-----Original Message-----
From: Atish Patra [mailto:atishp at atishpatra.org]
Sent: Friday, February 7, 2020 6:56 AM
To: Ard Biesheuvel <[email protected]>; Chang, Abner (HPS SW/FW
Technologist) <[email protected]>
Cc: Alexander Graf <[email protected]>; Heinrich Schuchardt <[email protected]>; U-Boot Mailing List <[email protected]>; Atish Patra <[email protected]>; leif at nuviainc.com
Subject: Re: [PATCH v2 1/1]efi_loader: architecture specific UEFI setupQuoted 4 lines · Ard Biesheuvel
Quoted 2 lines · Atish Patra
On Thu, Feb 6, 2020 at 12:10 PM Alexander Graf <[email protected]>
Quoted 98 lines · wrote:
Quoted 93 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines · Atish Patra
Quoted 3 lines
Quoted 1 line · Ard Biesheuvel
On Wed, 5 Feb 2020 at 05:53, Heinrich Schuchardt
Quoted 4 lines · <[email protected]> wrote:
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
RISC-V booting currently is based on a per boot stage lottery to determine the active CPU. The Hart State Management (HSM) SBI extension replaces this lottery by using a dedicated primary
CPU.
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Cf. Hart State Management Extension, Extension ID:
0x48534D(HSM)
https://github.com/riscv/riscv-sbi-doc/blob/master/riscv-sbi.a
docIn this scenario the id of the active hart has to be passed from boot stage to boot stage. Using a UEFI variable would provide
an easy implementation.
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
This patch provides a weak function that is called at the end of the setup of U-Boot's UEFI sub-system. By overriding this function architecture specific UEFI variables or configuration tables
can be created.
Quoted 49 lines
Quoted 27 lines
Quoted 15 lines
Quoted 5 lines
Quoted 5 lines
Quoted 3 lines
Signed-off-by Heinrich Schuchardt <[email protected]>Reviewed-by Atish Patra <[email protected]>OK, so I have a couple of questions:
Quoted 8 lines
Quoted 2 lines
- does RISC-V use device tree? if so, why are you not passing the active hart via a property in the /chosen node?
Yes. RISC-V uses device tree. Technically, we can pass the active hart by a DT property but that means we have to modify the DT in OpenSBI (RISC-V specific run time service provider).
We have been trying to avoid that if possible so that DT is not bounced around. This also limits U-Boot to have its own device tree.Quoted 5 lines
I don't understand how this is different from the UEFI variable scheme proposed here? If you want to create an SBI interface to propagate the active HART that U-Boot then uses to populate the /chosen property, that's probably fine as well.
We don't want to create SBI interface to pass this information.
Quoted 3 lines
We already have hooks that allow you to modify the DT right before it gets delivered to the payload. Just add it there?
Quoted 7 lines
Hmm. I guess it is true if the DT is loaded from MMC or network as well. How about EDK2 ? If we go DT route, it also has to modify the DT to pass the boot hart.
As it requires DT modification in multiple projects, why not use efi configuration tables as suggested by Ard ?
Configuration tables are preferred over variables, but putting it in the DT makes even more sense, since in that case, nothing that runs in the UEFI context has to care about any of this.
Quoted 10 lines
Quoted 10 lines
Quoted 8 lines
Quoted 5 lines
I'd assume the EFI stub would not care at all about this information, and it would give you a Linux/RISC-V specific way to convey this information that is independent of EFI.
Yes. EFI stub doesn't care about this information. However, it needs to save the information somewhere so that it can pass to the real kernel after exiting boot time services.
Quoted 8 lines
Quoted 2 lines
Quoted 2 lines
DT sounds like a pretty natural choice for that to me :).
Indeed. DT has a /chosen node that is set aside for this purpose. It does depend on how early you need the value (i.e., before or after you can run C code), but since you are passing the DT address to the core kernel, it makes way more sense to drop any additional information that you need to pass in there.
We don't need boot hart id until real kernel boots and parse DT. So that should be okay.
I just looked at the efi stub code once more and realized that it is already parsing the DT to setup uefi memory maps from /chosen node. Adding boot hart id to the chosen node does seem much cleaner to me :). Thanks for all the explanations.Quoted 2 lines
I have not looked at EDK2 code. But I am assuming modifying the DT just before jumping to the payload won't be too hard for EDK2 as well.
We don?t use DT in edk2 RISC-V port and we pass boot HART ID in SMBIOS type 44h as it is spec out in below link,
https://github.com/riscv/riscv-smbios/blob/master/RISCV-SMBIOS.mdQuoted 8 lines
Quoted 6 lines
Thanks for the link.
For 'RISC-V SMBIOS Type 44 Processor Additional Information' I find entry 0x13h 1: This is boot hart to boot system .
But is '44' a hexadecimal number? The document does not indicate this.
Type '44' is decimal format as it mentioned in SMBIOS spec, I had typo in above which said '44h'. However, that's good to mention this in RISCV_SMBIOS.md. Thanks for the recommendation.
Quoted 1 line
Quoted 8 lines
SMBIOS data is intended to describe the hardware to system administrators, not to the OS loader, and I don't think it makes sense to rely on it for booting. I'd assume that SMBIOS tables are not mandatory to begin with.
For EFI boot, it is acceptable if the stub loader in Linux itself needs to obtain the value from something like a device tree and pass it in a CPU register at handover time,
That's what I am planning to do for now. We can add SMBIOS parsing as well if required in future.
although I would still prefer
Quoted 3 lines
it if the kernel simply gets it from the device tree directly if one is guaranteed to be available.
That would break current booting protocol in RISC-V where register "a0" should contain the booting hartid. If we have to move away for that method, changes need to
be in multiple places (to modify the DT) and it has to be done in a backward compatible
way.
Quoted 6 lines
Adding a new ABI between the firmware and the stub loader in Linux to use EFI specific conduits like config tables or EFI variables should really be avoided, though, as it affects every EFI loader while the code that runs in the EFI context doesn't even care (note that beyond u-boot and GRUB, there are other EFI loaders such as systemd-boot that need to be taken into account).
Which booting stage should be responsible for changing the DT for those EFI loaders ?
Signature · 2 lines
Regards, Atish
PATCH v2 1/1 efi_loader: architecture specific UEFI setup
Quoted 168 lines · Atish Patra
Quoted 148 lines · Ard Biesheuvel
Quoted 136 lines · Abner (HPS SW/FW Technologist)
Quoted 136 lines
-----Original Message-----
From: Heinrich Schuchardt [mailto:xypron.glpk at gmx.de]
Sent: Wednesday, February 12, 2020 2:26 AM
To: Chang, Abner (HPS SW/FW Technologist) <[email protected]>; Atish Patra <[email protected]>; Ard Biesheuvel <[email protected]>
Cc: Alexander Graf <[email protected]>; U-Boot Mailing List <u- boot at lists.denx.de>; Atish Patra <[email protected]>; leif at nuviainc.com
Subject: Re: [PATCH v2 1/1]efi_loader: architecture specific UEFI setupQuoted 21 lines · Abner (HPS SW/FW Technologist)
Quoted 21 lines
-----Original Message-----
From: Atish Patra [mailto:atishp at atishpatra.org]
Sent: Friday, February 7, 2020 6:56 AM
To: Ard Biesheuvel <[email protected]>; Chang, Abner (HPS SW/FW
Technologist) <[email protected]>
Cc: Alexander Graf <[email protected]>; Heinrich Schuchardt <[email protected]>; U-Boot Mailing List <[email protected]>; Atish Patra <[email protected]>; leif at nuviainc.com
Subject: Re: [PATCH v2 1/1]efi_loader: architecture specific UEFI setupQuoted 4 lines · Ard Biesheuvel
Quoted 2 lines · Atish Patra
On Thu, Feb 6, 2020 at 12:10 PM Alexander Graf <[email protected]>
Quoted 98 lines · wrote:
Quoted 93 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines · Atish Patra
Quoted 3 lines
Quoted 1 line · Ard Biesheuvel
On Wed, 5 Feb 2020 at 05:53, Heinrich Schuchardt
Quoted 4 lines · <[email protected]> wrote:
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
RISC-V booting currently is based on a per boot stage lottery to determine the active CPU. The Hart State Management (HSM) SBI extension replaces this lottery by using a dedicated primary
CPU.
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Cf. Hart State Management Extension, Extension ID:
0x48534D(HSM)
https://github.com/riscv/riscv-sbi-doc/blob/master/riscv-sbi.a
docIn this scenario the id of the active hart has to be passed from boot stage to boot stage. Using a UEFI variable would provide
an easy implementation.
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
This patch provides a weak function that is called at the end of the setup of U-Boot's UEFI sub-system. By overriding this function architecture specific UEFI variables or configuration tables
can be created.
Quoted 49 lines
Quoted 27 lines
Quoted 15 lines
Quoted 5 lines
Quoted 5 lines
Quoted 3 lines
Signed-off-by Heinrich Schuchardt <[email protected]>Reviewed-by Atish Patra <[email protected]>OK, so I have a couple of questions:
Quoted 8 lines
Quoted 2 lines
- does RISC-V use device tree? if so, why are you not passing the active hart via a property in the /chosen node?
Yes. RISC-V uses device tree. Technically, we can pass the active hart by a DT property but that means we have to modify the DT in OpenSBI (RISC-V specific run time service provider).
We have been trying to avoid that if possible so that DT is not bounced around. This also limits U-Boot to have its own device tree.Quoted 5 lines
I don't understand how this is different from the UEFI variable scheme proposed here? If you want to create an SBI interface to propagate the active HART that U-Boot then uses to populate the /chosen property, that's probably fine as well.
We don't want to create SBI interface to pass this information.
Quoted 3 lines
We already have hooks that allow you to modify the DT right before it gets delivered to the payload. Just add it there?
Quoted 7 lines
Hmm. I guess it is true if the DT is loaded from MMC or network as well. How about EDK2 ? If we go DT route, it also has to modify the DT to pass the boot hart.
As it requires DT modification in multiple projects, why not use efi configuration tables as suggested by Ard ?
Configuration tables are preferred over variables, but putting it in the DT makes even more sense, since in that case, nothing that runs in the UEFI context has to care about any of this.
Quoted 10 lines
Quoted 10 lines
Quoted 8 lines
Quoted 5 lines
I'd assume the EFI stub would not care at all about this information, and it would give you a Linux/RISC-V specific way to convey this information that is independent of EFI.
Yes. EFI stub doesn't care about this information. However, it needs to save the information somewhere so that it can pass to the real kernel after exiting boot time services.
Quoted 8 lines
Quoted 2 lines
Quoted 2 lines
DT sounds like a pretty natural choice for that to me :).
Indeed. DT has a /chosen node that is set aside for this purpose. It does depend on how early you need the value (i.e., before or after you can run C code), but since you are passing the DT address to the core kernel, it makes way more sense to drop any additional information that you need to pass in there.
We don't need boot hart id until real kernel boots and parse DT. So that should be okay.
I just looked at the efi stub code once more and realized that it is already parsing the DT to setup uefi memory maps from /chosen node. Adding boot hart id to the chosen node does seem much cleaner to me :). Thanks for all the explanations.Quoted 2 lines
I have not looked at EDK2 code. But I am assuming modifying the DT just before jumping to the payload won't be too hard for EDK2 as well.
We don?t use DT in edk2 RISC-V port and we pass boot HART ID in SMBIOS type 44h as it is spec out in below link,
https://github.com/riscv/riscv-smbios/blob/master/RISCV-SMBIOS.mdQuoted 8 lines
Quoted 6 lines
Thanks for the link.
For 'RISC-V SMBIOS Type 44 Processor Additional Information' I find entry 0x13h 1: This is boot hart to boot system .
But is '44' a hexadecimal number? The document does not indicate this.
Type '44' is decimal format as it mentioned in SMBIOS spec, I had typo in above which said '44h'. However, that's good to mention this in RISCV_SMBIOS.md. Thanks for the recommendation.
Quoted 1 line
Quoted 8 lines
SMBIOS data is intended to describe the hardware to system administrators, not to the OS loader, and I don't think it makes sense to rely on it for booting. I'd assume that SMBIOS tables are not mandatory to begin with.
For EFI boot, it is acceptable if the stub loader in Linux itself needs to obtain the value from something like a device tree and pass it in a CPU register at handover time,
That's what I am planning to do for now. We can add SMBIOS parsing as well if required in future.
although I would still prefer
Quoted 3 lines
it if the kernel simply gets it from the device tree directly if one is guaranteed to be available.
Quoted 7 lines
That would break current booting protocol in RISC-V where register "a0" should contain the booting hartid. If we have to move away for that method, changes need to
be in multiple places (to modify the DT) and it has to be done in a backward compatible
way.
How do you pass the device tree address?
Quoted 10 lines
Quoted 6 lines
Adding a new ABI between the firmware and the stub loader in Linux to use EFI specific conduits like config tables or EFI variables should really be avoided, though, as it affects every EFI loader while the code that runs in the EFI context doesn't even care (note that beyond u-boot and GRUB, there are other EFI loaders such as systemd-boot that need to be taken into account).
Which booting stage should be responsible for changing the DT for those EFI loaders ?
If the EFI stub for RISC-V needs to read the hart id from somewhere and pass it in a register when it enters the startup code of the core kernel, that is fine.
Since DT is mandatory on your systems, and EFI is not, defining some EFI specific way of conveying this information seems like a bad idea to me.
I'd say the firmware stage that incorporates the DT stuffs the hartid in /chosen so that any later stage can find it there if it needs to, without the software having to be aware of this. That way, you can use intermediate loaders like GRUB or systemd-boot without any changes. (This would actually be true when using a EFI variable for the same purpose, but I still prefer DT for this)
PATCH v2 1/1 efi_loader: architecture specific UEFI setup
Quoted 178 lines · Ard Biesheuvel
Quoted 168 lines · Atish Patra
Quoted 148 lines · Ard Biesheuvel
Quoted 136 lines · Abner (HPS SW/FW Technologist)
Quoted 136 lines
-----Original Message-----
From: Heinrich Schuchardt [mailto:xypron.glpk at gmx.de]
Sent: Wednesday, February 12, 2020 2:26 AM
To: Chang, Abner (HPS SW/FW Technologist) <[email protected]>; Atish Patra <[email protected]>; Ard Biesheuvel <[email protected]>
Cc: Alexander Graf <[email protected]>; U-Boot Mailing List <u- boot at lists.denx.de>; Atish Patra <[email protected]>; leif at nuviainc.com
Subject: Re: [PATCH v2 1/1]efi_loader: architecture specific UEFI setupQuoted 21 lines · Abner (HPS SW/FW Technologist)
Quoted 21 lines
-----Original Message-----
From: Atish Patra [mailto:atishp at atishpatra.org]
Sent: Friday, February 7, 2020 6:56 AM
To: Ard Biesheuvel <[email protected]>; Chang, Abner (HPS SW/FW
Technologist) <[email protected]>
Cc: Alexander Graf <[email protected]>; Heinrich Schuchardt <[email protected]>; U-Boot Mailing List <[email protected]>; Atish Patra <[email protected]>; leif at nuviainc.com
Subject: Re: [PATCH v2 1/1]efi_loader: architecture specific UEFI setupQuoted 4 lines · Ard Biesheuvel
Quoted 2 lines · Atish Patra
On Thu, Feb 6, 2020 at 12:10 PM Alexander Graf <[email protected]>
Quoted 98 lines · wrote:
Quoted 93 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines · Atish Patra
Quoted 3 lines
Quoted 1 line · Ard Biesheuvel
On Wed, 5 Feb 2020 at 05:53, Heinrich Schuchardt
Quoted 4 lines · <[email protected]> wrote:
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
RISC-V booting currently is based on a per boot stage lottery
to determine the active CPU. The Hart State Management (HSM)
SBI extension replaces this lottery by using a dedicated
primaryCPU.
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Cf. Hart State Management Extension, Extension ID: 0x48534D
(HSM)
https://github.com/riscv/riscv-sbi-doc/blob/master/riscv-sbi.a
docIn this scenario the id of the active hart has to be passed
from boot stage to boot stage. Using a UEFI variable would
providean easy implementation.
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
This patch provides a weak function that is called at the end
of the setup of U-Boot's UEFI sub-system. By overriding this
function architecture specific UEFI variables or configuration
tablescan be created.
Quoted 49 lines
Quoted 27 lines
Quoted 15 lines
Quoted 5 lines
Quoted 5 lines
Quoted 3 lines
Signed-off-by: Heinrich Schuchardt <[email protected]>
Reviewed-by: Atish Patra <[email protected]>OK, so I have a couple of questions:
Quoted 8 lines
Quoted 2 lines
- does RISC-V use device tree? if so, why are you not passing the active hart via a property in the /chosen node?
Yes. RISC-V uses device tree. Technically, we can pass the active hart by a DT property but that means we have to modify the DT in OpenSBI (RISC-V specific run time service provider).
We have been trying to avoid that if possible so that DT is not bounced around. This also limits U-Boot to have its own device tree.Quoted 5 lines
I don't understand how this is different from the UEFI variable scheme proposed here? If you want to create an SBI interface to propagate the active HART that U-Boot then uses to populate the /chosen property, that's probably fine as well.
We don't want to create SBI interface to pass this information.
Quoted 3 lines
We already have hooks that allow you to modify the DT right before it gets delivered to the payload. Just add it there?
Quoted 7 lines
Hmm. I guess it is true if the DT is loaded from MMC or network as well. How about EDK2 ? If we go DT route, it also has to modify the DT to pass the boot hart.
As it requires DT modification in multiple projects, why not use efi configuration tables as suggested by Ard ?
Configuration tables are preferred over variables, but putting it in the DT makes even more sense, since in that case, nothing that runs in the UEFI context has to care about any of this.
Quoted 10 lines
Quoted 10 lines
Quoted 8 lines
Quoted 5 lines
I'd assume the EFI stub would not care at all about this information, and it would give you a Linux/RISC-V specific way to convey this information that is independent of EFI.
Yes. EFI stub doesn't care about this information. However, it needs to save the information somewhere so that it can pass to the real kernel after exiting boot time services.
Quoted 8 lines
Quoted 2 lines
Quoted 2 lines
DT sounds like a pretty natural choice for that to me :).
Indeed. DT has a /chosen node that is set aside for this purpose. It does depend on how early you need the value (i.e., before or after you can run C code), but since you are passing the DT address to the core kernel, it makes way more sense to drop any additional information that you need to pass in there.
We don't need boot hart id until real kernel boots and parse DT. So that should be okay.
I just looked at the efi stub code once more and realized that it is already parsing the DT to setup uefi memory maps from /chosen node. Adding boot hart id to the chosen node does seem much cleaner to me :). Thanks for all the explanations.Quoted 2 lines
I have not looked at EDK2 code. But I am assuming modifying the DT just before jumping to the payload won't be too hard for EDK2 as well.
We don?t use DT in edk2 RISC-V port and we pass boot HART ID in SMBIOS type 44h as it is spec out in below link,
https://github.com/riscv/riscv-smbios/blob/master/RISCV-SMBIOS.mdQuoted 8 lines
Quoted 6 lines
Thanks for the link.
For 'RISC-V SMBIOS Type 44 Processor Additional Information' I find entry 0x13h 1: This is boot hart to boot system .
But is '44' a hexadecimal number? The document does not indicate this.
Type '44' is decimal format as it mentioned in SMBIOS spec, I had typo in above which said '44h'. However, that's good to mention this in RISCV_SMBIOS.md. Thanks for the recommendation.
Quoted 1 line
Quoted 8 lines
SMBIOS data is intended to describe the hardware to system administrators, not to the OS loader, and I don't think it makes sense to rely on it for booting. I'd assume that SMBIOS tables are not mandatory to begin with.
For EFI boot, it is acceptable if the stub loader in Linux itself needs to obtain the value from something like a device tree and pass it in a CPU register at handover time,
That's what I am planning to do for now. We can add SMBIOS parsing as well if required in future.
although I would still prefer
Quoted 3 lines
it if the kernel simply gets it from the device tree directly if one is guaranteed to be available.
Quoted 7 lines
That would break current booting protocol in RISC-V where register "a0" should contain the booting hartid. If we have to move away for that method, changes need to
be in multiple places (to modify the DT) and it has to be done in a backward compatible
way.
Quoted 1 line
How do you pass the device tree address?
in register "a1"
Quoted 19 lines
Quoted 10 lines
Quoted 6 lines
Adding a new ABI between the firmware and the stub loader in Linux to use EFI specific conduits like config tables or EFI variables should really be avoided, though, as it affects every EFI loader while the code that runs in the EFI context doesn't even care (note that beyond u-boot and GRUB, there are other EFI loaders such as systemd-boot that need to be taken into account).
Which booting stage should be responsible for changing the DT for those EFI loaders ?
If the EFI stub for RISC-V needs to read the hart id from somewhere and pass it in a register when it enters the startup code of the core kernel, that is fine.
Since DT is mandatory on your systems, and EFI is not, defining some EFI specific way of conveying this information seems like a bad idea to me.
Quoted 6 lines
I'd say the firmware stage that incorporates the DT stuffs the hartid in /chosen so that any later stage can find it there if it needs to, without the software having to be aware of this. That way, you can use intermediate loaders like GRUB or systemd-boot without any changes. (This would actually be true when using a EFI variable for the same purpose, but I still prefer DT for this)
I am fine with this. For now, U-Boot can append the chosen node.
@Abner: I might have missed something. But I couldn't find anything other than boot hartid in SMBIOS table that
EFI stub need to parse in order to boot kernel. How difficult is to modify the DT in EDK2 ?
Signature · 2 lines
Regards, Atish
Chang
PATCH v2 1/1 efi_loader: architecture specific UEFI setup
Quoted 240 lines
-----Original Message-----
From: Atish Patra [mailto:atishp at atishpatra.org]
Sent: Friday, February 14, 2020 7:57 AM
To: Ard Biesheuvel <[email protected]>
Cc: Chang, Abner (HPS SW/FW Technologist) <[email protected]>; Heinrich Schuchardt <[email protected]>; Alexander Graf <[email protected]>; U-Boot Mailing List <[email protected]>; Atish Patra <[email protected]>; leif at nuviainc.com
Subject: Re: [PATCH v2 1/1]efi_loader: architecture specific UEFI setupQuoted 44 lines · Ard Biesheuvel
Quoted 42 lines · Atish Patra
Quoted 39 lines · Ard Biesheuvel
Quoted 36 lines · Abner (HPS SW/FW Technologist)
Quoted 36 lines
-----Original Message-----
From: Heinrich Schuchardt [mailto:xypron.glpk at gmx.de]
Sent: Wednesday, February 12, 2020 2:26 AM
To: Chang, Abner (HPS SW/FW Technologist) <[email protected]>; Atish Patra <[email protected]>; Ard Biesheuvel <[email protected]>
Cc: Alexander Graf <[email protected]>; U-Boot Mailing List <u- boot at lists.denx.de>; Atish Patra <[email protected]>; leif at nuviainc.com
Subject: Re: [PATCH v2 1/1]efi_loader: architecture specific UEFI setupQuoted 20 lines · Abner (HPS SW/FW Technologist)
Quoted 20 lines
-----Original Message-----
From: Atish Patra [mailto:atishp at atishpatra.org]
Sent: Friday, February 7, 2020 6:56 AM
To: Ard Biesheuvel <[email protected]>; Chang, Abner (HPS SW/FW
Technologist) <[email protected]>
Cc: Alexander Graf <[email protected]>; Heinrich Schuchardt <[email protected]>; U-Boot Mailing List <[email protected]>; Atish Patra <[email protected]>; leif at nuviainc.com
Subject: Re: [PATCH v2 1/1]efi_loader: architecture specific UEFI setupQuoted 2 lines · Ard Biesheuvel
On Thu, 6 Feb 2020 at 21:06, Atish Patra
Quoted 38 lines · <[email protected]> wrote:
Quoted 38 lines
Quoted 38 lines
Quoted 38 lines
Quoted 38 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
On Thu, Feb 6, 2020 at 12:10 PM Alexander Graf
<[email protected]>Quoted 34 lines · wrote:
Quoted 34 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines · Atish Patra
Quoted 3 lines
Quoted 1 line · Ard Biesheuvel
On Wed, 5 Feb 2020 at 05:53, Heinrich Schuchardt
Quoted 4 lines · <[email protected]> wrote:
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
RISC-V booting currently is based on a per boot stage
lottery to determine the active CPU. The Hart State
Management (HSM) SBI extension replaces this lottery
by using a dedicated primaryCPU.
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Cf. Hart State Management Extension, Extension ID:
0x48534D
(HSM)
https://github.com/riscv/riscv-sbi-doc/blob/master/ri
scv-sbi.a
docIn this scenario the id of the active hart has to be
passed from boot stage to boot stage. Using a UEFI
variable would providean easy implementation.
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
This patch provides a weak function that is called at
the end of the setup of U-Boot's UEFI sub-system. By
overriding this function architecture specific UEFI
variables or configuration tablescan be created.
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Signed-off-by: Heinrich Schuchardt
<[email protected]>
Reviewed-by: Atish Patra <[email protected]>Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 4 lines
OK, so I have a couple of questions:
- does RISC-V use device tree? if so, why are you not
passing the active hart via a property in the /chosen node?Yes. RISC-V uses device tree. Technically, we can pass the active hart by a DT property but that means we have to modify the DT in OpenSBI (RISC-V specific run time
service provider).
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 3 lines
We have been trying to avoid that if possible so that DT is not bounced around. This also limits U-Boot to have its own device tree.
I don't understand how this is different from the UEFI variable scheme proposed here? If you want to create an SBI interface to propagate the active HART that U-Boot then uses to populate the /chosen property, that's probably
fine as well.
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 1 line
We don't want to create SBI interface to pass this information.
Quoted 3 lines
We already have hooks that allow you to modify the DT right before it gets delivered to the payload. Just add it there?
Hmm. I guess it is true if the DT is loaded from MMC or
network as well.
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 6 lines
How about EDK2 ? If we go DT route, it also has to modify the DT to pass the boot hart.
As it requires DT modification in multiple projects, why not use efi configuration tables as suggested by Ard ?
Configuration tables are preferred over variables, but putting it in the DT makes even more sense, since in that case, nothing that runs in the UEFI context has to care about
any of this.
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
I'd assume the EFI stub would not care at all about
this information, and it would give you a Linux/RISC-V
specific way to convey this information that isindependent of EFI.
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Yes. EFI stub doesn't care about this information. However, it needs to save the information somewhere so that it can pass to the real kernel after exiting boot time
services.
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 4 lines
Quoted 4 lines
DT sounds like a pretty natural choice for that to me :).
Indeed. DT has a /chosen node that is set aside for this purpose. It does depend on how early you need the value (i.e., before or after you can run C code), but since you are passing the DT address to the core kernel, it makes way more sense to drop any additional information that you
need to pass in there.
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
We don't need boot hart id until real kernel boots and parse DT. So that should be okay.
I just looked at the efi stub code once more and realized that it is already parsing the DT to setup uefi memory maps from/chosen node.
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Adding boot hart id to the chosen node does seem much cleaner to me :). Thanks for all the explanations.
I have not looked at EDK2 code. But I am assuming modifying the DT just before jumping to the payload won't be too hard for
EDK2 as well.
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 4 lines
We don?t use DT in edk2 RISC-V port and we pass boot HART ID in SMBIOS type 44h as it is spec out in below link,
https://github.com/riscv/riscv-smbios/blob/master/RISCV-SMBI
OS.mdThanks for the link.
For 'RISC-V SMBIOS Type 44 Processor Additional Information' I find entry 0x13h 1: This is boot hart to boot system .
But is '44' a hexadecimal number? The document does not indicate
this.
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Type '44' is decimal format as it mentioned in SMBIOS spec, I had typo
in above which said '44h'. However, that's good to mention this in RISCV_SMBIOS.md. Thanks for the recommendation.
Quoted 19 lines
Quoted 19 lines
Quoted 10 lines
Quoted 1 line
Quoted 1 line
SMBIOS data is intended to describe the hardware to system administrators, not to the OS loader, and I don't think it makes sense to rely on it for booting. I'd assume that SMBIOS tables are not mandatory to begin with.
For EFI boot, it is acceptable if the stub loader in Linux itself needs to obtain the value from something like a device tree and pass it in a CPU register at handover time,
That's what I am planning to do for now. We can add SMBIOS parsing as well if required in future.
although I would still prefer
Quoted 3 lines
it if the kernel simply gets it from the device tree directly if one is guaranteed to be available.
Quoted 7 lines
Quoted 5 lines
That would break current booting protocol in RISC-V where register "a0" should contain the booting hartid. If we have to move away for that method, changes need to be in multiple places (to modify the DT) and it has to be done in a backward compatible way.
How do you pass the device tree address?
in register "a1"
Quoted 19 lines
Quoted 10 lines
Quoted 6 lines
Adding a new ABI between the firmware and the stub loader in Linux to use EFI specific conduits like config tables or EFI variables should really be avoided, though, as it affects every EFI loader while the code that runs in the EFI context doesn't even care (note that beyond u-boot and GRUB, there are other EFI loaders such as systemd-boot that need to be taken into account).
Which booting stage should be responsible for changing the DT for those EFI loaders ?
If the EFI stub for RISC-V needs to read the hart id from somewhere and pass it in a register when it enters the startup code of the core kernel, that is fine.
Since DT is mandatory on your systems, and EFI is not, defining some EFI specific way of conveying this information seems like a bad idea to me.
Quoted 6 lines
I'd say the firmware stage that incorporates the DT stuffs the hartid in /chosen so that any later stage can find it there if it needs to, without the software having to be aware of this. That way, you can use intermediate loaders like GRUB or systemd-boot without any changes. (This would actually be true when using a EFI variable for the same purpose, but I still prefer DT for this)
Quoted 4 lines
I am fine with this. For now, U-Boot can append the chosen node.
@Abner: I might have missed something. But I couldn't find anything other than boot hartid in SMBIOS table that EFI stub need to parse in order to boot
The table from this link https://github.com/riscv/riscv-smbios/blob/master/RISCV-SMBIOS.md
Offset 3 is HART ID, and offset 13h is the boolean indicates this hart is the boot hart.
Quoted 2 lines
kernel. How difficult is to modify the DT in EDK2 ?
I never used DT before on PC/Server project. However, the DT code is over there in edk2 repo which mostly used by ARM platforms. I don?t think it is difficult to adopt it though.
Quoted 3 lines
--
Regards,
Atish
PATCH v2 1/1 efi_loader: architecture specific UEFI setup
Quoted 246 lines
Am 14.02.2020 um 05:21 schrieb Chang, Abner (HPS SW/FW Technologist) <[email protected]>:
?
Quoted 240 lines
-----Original Message-----
From: Atish Patra [mailto:atishp at atishpatra.org]
Sent: Friday, February 14, 2020 7:57 AM
To: Ard Biesheuvel <[email protected]>
Cc: Chang, Abner (HPS SW/FW Technologist) <[email protected]>; Heinrich Schuchardt <[email protected]>; Alexander Graf <[email protected]>; U-Boot Mailing List <[email protected]>; Atish Patra <[email protected]>; leif at nuviainc.com
Subject: Re: [PATCH v2 1/1]efi_loader: architecture specific UEFI setupQuoted 46 lines
On Thu, Feb 13, 2020 at 2:11 PM Ard Biesheuvel <[email protected]> wrote:
Quoted 42 lines · Atish Patra
Quoted 39 lines · Ard Biesheuvel
Quoted 36 lines · Abner (HPS SW/FW Technologist)
Quoted 36 lines
-----Original Message-----
From: Heinrich Schuchardt [mailto:xypron.glpk at gmx.de]
Sent: Wednesday, February 12, 2020 2:26 AM
To: Chang, Abner (HPS SW/FW Technologist) <[email protected]>; Atish Patra <[email protected]>; Ard Biesheuvel <[email protected]>
Cc: Alexander Graf <[email protected]>; U-Boot Mailing List <u- boot at lists.denx.de>; Atish Patra <[email protected]>; leif at nuviainc.com
Subject: Re: [PATCH v2 1/1]efi_loader: architecture specific UEFI setupQuoted 20 lines · Abner (HPS SW/FW Technologist)
Quoted 20 lines
-----Original Message-----
From: Atish Patra [mailto:atishp at atishpatra.org]
Sent: Friday, February 7, 2020 6:56 AM
To: Ard Biesheuvel <[email protected]>; Chang, Abner (HPS SW/FW
Technologist) <[email protected]>
Cc: Alexander Graf <[email protected]>; Heinrich Schuchardt <[email protected]>; U-Boot Mailing List <[email protected]>; Atish Patra <[email protected]>; leif at nuviainc.com
Subject: Re: [PATCH v2 1/1]efi_loader: architecture specific UEFI setupQuoted 2 lines · Ard Biesheuvel
On Thu, 6 Feb 2020 at 21:06, Atish Patra
Quoted 38 lines · <[email protected]> wrote:
Quoted 38 lines
Quoted 38 lines
Quoted 38 lines
Quoted 38 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
On Thu, Feb 6, 2020 at 12:10 PM Alexander Graf
<[email protected]>Quoted 34 lines · wrote:
Quoted 34 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines · Atish Patra
Quoted 3 lines
On Tue, Feb 4, 2020 at 11:43 PM Ard Biesheuvel
<[email protected]> wrote:
On Wed, 5 Feb 2020 at 05:53, Heinrich SchuchardtQuoted 4 lines · <[email protected]> wrote:
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
RISC-V booting currently is based on a per boot stage
lottery to determine the active CPU. The Hart State
Management (HSM) SBI extension replaces this lottery
by using a dedicated primaryCPU.
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Cf. Hart State Management Extension, Extension ID:
0x48534D
(HSM)
https://github.com/riscv/riscv-sbi-doc/blob/master/ri
scv-sbi.a
docIn this scenario the id of the active hart has to be
passed from boot stage to boot stage. Using a UEFI
variable would providean easy implementation.
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
This patch provides a weak function that is called at
the end of the setup of U-Boot's UEFI sub-system. By
overriding this function architecture specific UEFI
variables or configuration tablescan be created.
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Signed-off-by: Heinrich Schuchardt
<[email protected]>
Reviewed-by: Atish Patra <[email protected]>Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
OK, so I have a couple of questions:
- does RISC-V use device tree? if so, why are you not
passing the active hart via a property in the /chosen node?
Yes. RISC-V uses device tree. Technically, we can pass
the active hart by a DT property but that means we have
to modify the DT in OpenSBI (RISC-V specific run timeservice provider).
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 3 lines
We have been trying to avoid that if possible so that
DT is not bounced around. This also limits U-Boot to
have its own device tree.I don't understand how this is different from the UEFI variable scheme proposed here? If you want to create an SBI interface to propagate the active HART that U-Boot then uses to populate the /chosen property, that's probably
fine as well.
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 1 line
We don't want to create SBI interface to pass this information.
Quoted 3 lines
We already have hooks that allow you to modify the DT right before it gets delivered to the payload. Just add it there?
Hmm. I guess it is true if the DT is loaded from MMC or
network as well.
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 6 lines
How about EDK2 ? If we go DT route, it also has to modify the DT to pass the boot hart.
As it requires DT modification in multiple projects, why not use efi configuration tables as suggested by Ard ?
Configuration tables are preferred over variables, but putting it in the DT makes even more sense, since in that case, nothing that runs in the UEFI context has to care about
any of this.
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
I'd assume the EFI stub would not care at all about
this information, and it would give you a Linux/RISC-V
specific way to convey this information that isindependent of EFI.
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Yes. EFI stub doesn't care about this information.
However, it needs to save the information somewhere so
that it can pass to the real kernel after exiting boot timeservices.
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 4 lines
Quoted 4 lines
DT sounds like a pretty natural choice for that to me :).
Indeed. DT has a /chosen node that is set aside for this purpose. It does depend on how early you need the value (i.e., before or after you can run C code), but since you are passing the DT address to the core kernel, it makes way more sense to drop any additional information that you
need to pass in there.
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
We don't need boot hart id until real kernel boots and parse DT. So that should be okay.
I just looked at the efi stub code once more and realized that it is already parsing the DT to setup uefi memory maps from/chosen node.
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Adding boot hart id to the chosen node does seem much cleaner to me :). Thanks for all the explanations.
I have not looked at EDK2 code. But I am assuming modifying the DT just before jumping to the payload won't be too hard for
EDK2 as well.
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 4 lines
We don?t use DT in edk2 RISC-V port and we pass boot HART ID in SMBIOS type 44h as it is spec out in below link,
https://github.com/riscv/riscv-smbios/blob/master/RISCV-SMBI
OS.mdThanks for the link.
For 'RISC-V SMBIOS Type 44 Processor Additional Information' I find entry 0x13h 1: This is boot hart to boot system .
But is '44' a hexadecimal number? The document does not indicate
this.
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Type '44' is decimal format as it mentioned in SMBIOS spec, I had typo
in above which said '44h'. However, that's good to mention this in RISCV_SMBIOS.md. Thanks for the recommendation.
Quoted 19 lines
Quoted 19 lines
Quoted 10 lines
Quoted 1 line
Quoted 1 line
SMBIOS data is intended to describe the hardware to system administrators, not to the OS loader, and I don't think it makes sense to rely on it for booting. I'd assume that SMBIOS tables are not mandatory to begin with.
For EFI boot, it is acceptable if the stub loader in Linux itself needs to obtain the value from something like a device tree and pass it in a CPU register at handover time,
That's what I am planning to do for now. We can add SMBIOS parsing as well if required in future.
although I would still prefer
Quoted 3 lines
it if the kernel simply gets it from the device tree directly if one is guaranteed to be available.
Quoted 7 lines
Quoted 5 lines
That would break current booting protocol in RISC-V where register "a0" should contain the booting hartid. If we have to move away for that method, changes need to be in multiple places (to modify the DT) and it has to be done in a backward compatible way.
How do you pass the device tree address?
in register "a1"
Quoted 19 lines
Quoted 10 lines
Quoted 6 lines
Adding a new ABI between the firmware and the stub loader in Linux to use EFI specific conduits like config tables or EFI variables should really be avoided, though, as it affects every EFI loader while the code that runs in the EFI context doesn't even care (note that beyond u-boot and GRUB, there are other EFI loaders such as systemd-boot that need to be taken into account).
Which booting stage should be responsible for changing the DT for those EFI loaders ?
If the EFI stub for RISC-V needs to read the hart id from somewhere and pass it in a register when it enters the startup code of the core kernel, that is fine.
Since DT is mandatory on your systems, and EFI is not, defining some EFI specific way of conveying this information seems like a bad idea to me.
Quoted 6 lines
I'd say the firmware stage that incorporates the DT stuffs the hartid in /chosen so that any later stage can find it there if it needs to, without the software having to be aware of this. That way, you can use intermediate loaders like GRUB or systemd-boot without any changes. (This would actually be true when using a EFI variable for the same purpose, but I still prefer DT for this)
I am fine with this. For now, U-Boot can append the chosen node.
Quoted 8 lines
Quoted 2 lines
@Abner: I might have missed something. But I couldn't find anything other than boot hartid in SMBIOS table that EFI stub need to parse in order to boot
The table from this link https://github.com/riscv/riscv-smbios/blob/master/RISCV-SMBIOS.md
Offset 3 is HART ID, and offset 13h is the boolean indicates this hart is the boot hart.Quoted 2 lines
kernel. How difficult is to modify the DT in EDK2 ?
I never used DT before on PC/Server project. However, the DT code is over there in edk2 repo which mostly used by ARM platforms. I don?t think it is difficult to adopt it though.
Yes, some arm platforms already transform the DT just fine. Let's really please not use SMBIOS for anything boot or system configuration related: its purpose is in general purely informational.
So yes, unless I hear really good arguments against passing it via /chosen in DT, I'd strongly prefer that mechanism. For ACPI (if it ever happens), there would be a special ACPI table for it anyway.
Thanks,
Alex
Chang
PATCH v2 1/1 efi_loader: architecture specific UEFI setup
Quoted 273 lines
-----Original Message-----
From: Alexander Graf [mailto:agraf at csgraf.de]
Sent: Friday, February 14, 2020 4:07 PM
To: Chang, Abner (HPS SW/FW Technologist) <[email protected]>
Cc: Atish Patra <[email protected]>; Ard Biesheuvel <[email protected]>; Heinrich Schuchardt <[email protected]>; U-Boot Mailing List <[email protected]>; Atish Patra <[email protected]>; leif at nuviainc.com
Subject: Re: [PATCH v2 1/1]efi_loader: architecture specific UEFI setupQuoted 1 line
Am 14.02.2020 um 05:21 schrieb Chang, Abner (HPS SW/FW Technologist)
Quoted 10 lines
Quoted 10 lines
-----Original Message-----
From: Atish Patra [mailto:atishp at atishpatra.org]
Sent: Friday, February 14, 2020 7:57 AM
To: Ard Biesheuvel <[email protected]>
Cc: Chang, Abner (HPS SW/FW Technologist) <[email protected]>; Heinrich Schuchardt <[email protected]>; Alexander Graf <[email protected]>; U-Boot Mailing List <[email protected]>; AtishPatra
Quoted 4 lines
Quoted 4 lines
<[email protected]>; leif at nuviainc.com
Subject: Re: [PATCH v2 1/1]efi_loader: architecture specific UEFI setupQuoted 1 line
On Thu, Feb 13, 2020 at 2:11 PM Ard Biesheuvel
Quoted 162 lines
Quoted 162 lines
Quoted 45 lines
wrote:
Quoted 42 lines · Atish Patra
Quoted 39 lines · Ard Biesheuvel
Quoted 36 lines · Abner (HPS SW/FW Technologist)
Quoted 36 lines
-----Original Message-----
From: Heinrich Schuchardt [mailto:xypron.glpk at gmx.de]
Sent: Wednesday, February 12, 2020 2:26 AM
To: Chang, Abner (HPS SW/FW Technologist) <[email protected]>; Atish Patra <[email protected]>; Ard Biesheuvel <[email protected]>
Cc: Alexander Graf <[email protected]>; U-Boot Mailing List <u- boot at lists.denx.de>; Atish Patra <[email protected]>; leif at nuviainc.com
Subject: Re: [PATCH v2 1/1]efi_loader: architecture specific UEFI setupQuoted 20 lines · Abner (HPS SW/FW Technologist)
Quoted 20 lines
-----Original Message-----
From: Atish Patra [mailto:atishp at atishpatra.org]
Sent: Friday, February 7, 2020 6:56 AM
To: Ard Biesheuvel <[email protected]>; Chang, Abner (HPS SW/FW
Technologist) <[email protected]>
Cc: Alexander Graf <[email protected]>; Heinrich Schuchardt <[email protected]>; U-Boot Mailing List <[email protected]>; Atish Patra <[email protected]>; leif at nuviainc.com
Subject: Re: [PATCH v2 1/1]efi_loader: architecture specific UEFI setupQuoted 2 lines · Ard Biesheuvel
On Thu, 6 Feb 2020 at 21:06, Atish Patra
Quoted 38 lines · <[email protected]> wrote:
Quoted 38 lines
Quoted 38 lines
Quoted 38 lines
Quoted 38 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
On Thu, Feb 6, 2020 at 12:10 PM Alexander Graf
<[email protected]>Quoted 34 lines · wrote:
Quoted 34 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines · Atish Patra
On Tue, Feb 4, 2020 at 11:43 PM Ard Biesheuvel
<[email protected]> wrote:
On Wed, 5 Feb 2020 at 05:53, Heinrich SchuchardtQuoted 4 lines · <[email protected]> wrote:
Quoted 4 lines
Quoted 4 lines
RISC-V booting currently is based on a per boot stage
lottery to determine the active CPU. The Hart State
Management (HSM) SBI extension replaces this lottery
by using a dedicated primaryCPU.
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Cf. Hart State Management Extension, Extension ID:
0x48534D
(HSM)
https://github.com/riscv/riscv-sbi-doc/blob/master/ri
scv-sbi.a
docIn this scenario the id of the active hart has to be
passed from boot stage to boot stage. Using a UEFI
variable would providean easy implementation.
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
This patch provides a weak function that is called at
the end of the setup of U-Boot's UEFI sub-system. By
overriding this function architecture specific UEFI
variables or configuration tablescan be created.
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Signed-off-by: Heinrich Schuchardt
<[email protected]>
Reviewed-by: Atish Patra <[email protected]>Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
OK, so I have a couple of questions:
- does RISC-V use device tree? if so, why are you not
passing the active hart via a property in the /chosen node?
Yes. RISC-V uses device tree. Technically, we can pass
the active hart by a DT property but that means we have
to modify the DT in OpenSBI (RISC-V specific run timeservice provider).
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
We have been trying to avoid that if possible so that
DT is not bounced around. This also limits U-Boot to
have its own device tree.I don't understand how this is different from the UEFI
variable scheme proposed here? If you want to create an
SBI interface to propagate the active HART that U-Boot
then uses to populate the /chosen property, that's probablyfine as well.
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 1 line
We don't want to create SBI interface to pass this information.
Quoted 3 lines
We already have hooks that allow you to modify the DT
right before it gets delivered to the payload. Just add it there?Hmm. I guess it is true if the DT is loaded from MMC or
network as well.
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 6 lines
How about EDK2 ? If we go DT route, it also has to modify the DT to pass the boot hart.
As it requires DT modification in multiple projects, why not use efi configuration tables as suggested by Ard ?
Configuration tables are preferred over variables, but putting it in the DT makes even more sense, since in that case, nothing that runs in the UEFI context has to care about
any of this.
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
I'd assume the EFI stub would not care at all about
this information, and it would give you a Linux/RISC-V
specific way to convey this information that isindependent of EFI.
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Yes. EFI stub doesn't care about this information.
However, it needs to save the information somewhere so
that it can pass to the real kernel after exiting boot timeservices.
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 4 lines
Quoted 4 lines
DT sounds like a pretty natural choice for that to me :).
Indeed. DT has a /chosen node that is set aside for this purpose. It does depend on how early you need the value (i.e., before or after you can run C code), but since you are passing the DT address to the core kernel, it makes way more sense to drop any additional information that you
need to pass in there.
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
We don't need boot hart id until real kernel boots and parse DT. So that should be okay.
I just looked at the efi stub code once more and realized that it is already parsing the DT to setup uefi memory maps from/chosen node.
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Adding boot hart id to the chosen node does seem much cleaner to me :). Thanks for all the explanations.
I have not looked at EDK2 code. But I am assuming modifying the DT just before jumping to the payload won't be too hard for
EDK2 as well.
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
We don?t use DT in edk2 RISC-V port and we pass boot HART ID in SMBIOS type 44h as it is spec out in below link,
https://github.com/riscv/riscv-smbios/blob/master/RISCV-SMBI
OS.mdQuoted 8 lines
Quoted 8 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Thanks for the link.
For 'RISC-V SMBIOS Type 44 Processor Additional Information' I find entry 0x13h 1: This is boot hart to boot system .
But is '44' a hexadecimal number? The document does not indicate
this.
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Type '44' is decimal format as it mentioned in SMBIOS spec, I had
typo
Quoted 57 lines
Quoted 57 lines
in above which said '44h'. However, that's good to mention this in RISCV_SMBIOS.md. Thanks for the recommendation.
Quoted 19 lines
Quoted 19 lines
Quoted 10 lines
Quoted 1 line
Quoted 1 line
SMBIOS data is intended to describe the hardware to system administrators, not to the OS loader, and I don't think it makes sense to rely on it for booting. I'd assume that SMBIOS tables are not mandatory to begin with.
For EFI boot, it is acceptable if the stub loader in Linux itself needs to obtain the value from something like a device tree and pass it in a CPU register at handover time,
That's what I am planning to do for now. We can add SMBIOS parsing as well if required in future.
although I would still prefer
Quoted 3 lines
it if the kernel simply gets it from the device tree directly if one is guaranteed to be available.
Quoted 7 lines
Quoted 5 lines
That would break current booting protocol in RISC-V where register "a0" should contain the booting hartid. If we have to move away for that method, changes need to be in multiple places (to modify the DT) and it has to be done in a backward compatible way.
How do you pass the device tree address?
in register "a1"
Quoted 25 lines
Quoted 10 lines
Quoted 6 lines
Adding a new ABI between the firmware and the stub loader in Linux to use EFI specific conduits like config tables or EFI variables should really be avoided, though, as it affects every EFI loader while the code that runs in the EFI context doesn't even care (note that beyond u-boot and GRUB, there are other EFI loaders such as systemd-boot that need to be taken into account).
Which booting stage should be responsible for changing the DT for those EFI loaders ?
If the EFI stub for RISC-V needs to read the hart id from somewhere and pass it in a register when it enters the startup code of the core kernel, that is fine.
Since DT is mandatory on your systems, and EFI is not, defining some EFI specific way of conveying this information seems like a bad idea to me.
I'd say the firmware stage that incorporates the DT stuffs the hartid in /chosen so that any later stage can find it there if it needs to, without the software having to be aware of this. That way, you can use intermediate loaders like GRUB or systemd-boot without any changes. (This would actually be true when using a EFI variable for the same purpose, but I still prefer DT for this)
Quoted 3 lines
Quoted 3 lines
I am fine with this. For now, U-Boot can append the chosen node.
@Abner: I might have missed something. But I couldn't find anything
other
Quoted 1 line
Quoted 1 line
than boot hartid in SMBIOS table that EFI stub need to parse in order to
boot
Quoted 1 line
The table from this link https://github.com/riscv/riscv-
smbios/blob/master/RISCV-SMBIOS.mdQuoted 1 line
Offset 3 is HART ID, and offset 13h is the boolean indicates this hart is the
boot hart.
Quoted 3 lines
Quoted 3 lines
kernel. How difficult is to modify the DT in EDK2 ?
Quoted 7 lines
Quoted 1 line
I never used DT before on PC/Server project. However, the DT code is over
there in edk2 repo which mostly used by ARM platforms. I don?t think it is difficult to adopt it though.
Yes, some arm platforms already transform the DT just fine. Let's really please not use SMBIOS for anything boot or system configuration related: its purpose is in general purely informational.
As DT to embedded system, SMBIOS provides system information/configuration on most PC/Server platforms. Especially to pre-OS applications such as EFI diagnostic tool, factory/customer deployment tools, pre-OS system configuration, network boot image and EFI OS boot loader as well. The intention of RISC-V SMBIOS is support above applications using single image for the RISC-V core variants, Non ACPI-aware OS is also part of this scope, but it is rare though. If you are booting to OS which is actually well understand DT then just use DT, but for PC/Server industry, SMBIOS would be still our choice before OS.
We may have to define the corresponding syntax If DT doesn't have it for boot HART information. RISC-V System Description Task Group (f it formed) would be a good place to bring this topic.
Maybe you can support both DT or SMBIOS to retrieve the information you need on demand...
Quoted 4 lines
So yes, unless I hear really good arguments against passing it via /chosen in DT, I'd strongly prefer that mechanism. For ACPI (if it ever happens), there would be a special ACPI table for it anyway.
Yes, we do have an ECR for ACPI spec to report the RISC-V core characteristic which is similar to what we done for SMBIOS.
Quoted 6 lines
Thanks,
Alex
PATCH v2 1/1 efi_loader: architecture specific UEFI setup
Quoted 18 lines · Abner (HPS SW/FW Technologist)
Quoted 18 lines
-----Original Message-----
From: Alexander Graf [mailto:agraf at csgraf.de]
Sent: Friday, February 14, 2020 4:07 PM
To: Chang, Abner (HPS SW/FW Technologist) <[email protected]>
Cc: Atish Patra <[email protected]>; Ard Biesheuvel <[email protected]>; Heinrich Schuchardt <[email protected]>; U-Boot Mailing List <[email protected]>; Atish Patra <[email protected]>; leif at nuviainc.com
Subject: Re: [PATCH v2 1/1]efi_loader: architecture specific UEFI setupQuoted 1 line
Am 14.02.2020 um 05:21 schrieb Chang, Abner (HPS SW/FW Technologist)
Quoted 1 line
...
Quoted 11 lines
Quoted 11 lines
The table from this link https://github.com/riscv/riscv-
smbios/blob/master/RISCV-SMBIOS.mdQuoted 1 line
Offset 3 is HART ID, and offset 13h is the boolean indicates this hart is the
boot hart.
Quoted 4 lines
Quoted 3 lines
kernel. How difficult is to modify the DT in EDK2 ?
I never used DT before on PC/Server project. However, the DT code is over
there in edk2 repo which mostly used by ARM platforms. I don?t think it is difficult to adopt it though.
Quoted 8 lines
Quoted 3 lines
Yes, some arm platforms already transform the DT just fine. Let's really please not use SMBIOS for anything boot or system configuration related: its purpose is in general purely informational.
As DT to embedded system, SMBIOS provides system information/configuration on most PC/Server platforms. Especially to pre-OS applications such as EFI diagnostic tool, factory/customer deployment tools, pre-OS system configuration, network boot image and EFI OS boot loader as well. The intention of RISC-V SMBIOS is support above applications using single image for the RISC-V core variants, Non ACPI-aware OS is also part of this scope, but it is rare though. If you are booting to OS which is actually well understand DT then just use DT, but for PC/Server industry, SMBIOS would be still our choice before OS.
We may have to define the corresponding syntax If DT doesn't have it for boot HART information. RISC-V System Description Task Group (f it formed) would be a good place to bring this topic.
Maybe you can support both DT or SMBIOS to retrieve the information you need on demand...
SMBIOS is an informational protocol. Firmware or OS loaders should not rely on it for low-level things like the hart id.
Quoted 6 lines
Quoted 4 lines
So yes, unless I hear really good arguments against passing it via /chosen in DT, I'd strongly prefer that mechanism. For ACPI (if it ever happens), there would be a special ACPI table for it anyway.
Yes, we do have an ECR for ACPI spec to report the RISC-V core characteristic which is similar to what we done for SMBIOS.
So we'll end up with a DT+SMBIOS or ACPI+SMBIOS boot protocol, and we'll always have to parse two sets of tables, just to discover the hart id. I don't think that makes sense at all, to be honest.
SMBIOS is wonderful for the sysadmin to look at the model numbers of the installed DIMMs etc. But for core boot stuff, we really should avoid it.
Chang
PATCH v2 1/1 efi_loader: architecture specific UEFI setup
Quoted 62 lines
-----Original Message-----
From: Ard Biesheuvel [mailto:ard.biesheuvel at linaro.org]
Sent: Friday, February 14, 2020 7:33 PM
To: Chang, Abner (HPS SW/FW Technologist) <[email protected]>
Cc: Alexander Graf <[email protected]>; Atish Patra <[email protected]>; Heinrich Schuchardt <[email protected]>; U-Boot Mailing List <u- boot at lists.denx.de>; Atish Patra <[email protected]>; leif at nuviainc.com
Subject: Re: [PATCH v2 1/1]efi_loader: architecture specific UEFI setupQuoted 20 lines · Abner (HPS SW/FW Technologist)
Quoted 20 lines
-----Original Message-----
From: Alexander Graf [mailto:agraf at csgraf.de]
Sent: Friday, February 14, 2020 4:07 PM
To: Chang, Abner (HPS SW/FW Technologist) <[email protected]>
Cc: Atish Patra <[email protected]>; Ard Biesheuvel <[email protected]>; Heinrich Schuchardt <[email protected]>; U-Boot Mailing List <[email protected]>; Atish Patra <[email protected]>; leif at nuviainc.com
Subject: Re: [PATCH v2 1/1]efi_loader: architecture specific UEFI setupQuoted 2 lines
Am 14.02.2020 um 05:21 schrieb Chang, Abner (HPS SW/FW Technologist)
Quoted 1 line
...
Quoted 10 lines
Quoted 10 lines
The table from this link https://github.com/riscv/riscv-
smbios/blob/master/RISCV-SMBIOS.mdQuoted 2 lines
Offset 3 is HART ID, and offset 13h is the boolean indicates this hart is the
boot hart.
Quoted 5 lines
Quoted 3 lines
kernel. How difficult is to modify the DT in EDK2 ?
I never used DT before on PC/Server project. However, the DT code is over
Quoted 7 lines
Quoted 6 lines
there in edk2 repo which mostly used by ARM platforms. I don?t think it is difficult to adopt it though.
Yes, some arm platforms already transform the DT just fine. Let's really please not use SMBIOS for anything boot or system configuration related: its purpose is in general purely informational.
As DT to embedded system, SMBIOS provides system
information/configuration on most PC/Server platforms. Especially to pre-OS applications such as EFI diagnostic tool, factory/customer deployment tools, pre-OS system configuration, network boot image and EFI OS boot loader as well. The intention of RISC-V SMBIOS is support above applications using single image for the RISC-V core variants, Non ACPI-aware OS is also part of this scope, but it is rare though.
Quoted 1 line
If you are booting to OS which is actually well understand DT then just use
DT, but for PC/Server industry, SMBIOS would be still our choice before OS.
Quoted 1 line
We may have to define the corresponding syntax If DT doesn't have it for
Quoted 8 lines
boot HART information. RISC-V System Description Task Group (f it formed) would be a good place to bring this topic.
Quoted 1 line
Maybe you can support both DT or SMBIOS to retrieve the information you
need on demand...
Quoted 1 line
SMBIOS is an informational protocol. Firmware or OS loaders should not rely on it for low-level things like the hart id.
Hart ID is just one of the information in type 44 which is the same as the processor information provided in type 4.
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
So yes, unless I hear really good arguments against passing it via /chosen in DT, I'd strongly prefer that mechanism. For ACPI (if it ever happens), there would be a special ACPI table for it anyway.
Quoted 7 lines
Quoted 1 line
Yes, we do have an ECR for ACPI spec to report the RISC-V core
characteristic which is similar to what we done for SMBIOS.
Quoted 1 line
So we'll end up with a DT+SMBIOS or ACPI+SMBIOS boot protocol, and we'll always have to parse two sets of tables, just to discover the hart id. I don't think that makes sense at all, to be honest.
As I said, SMBIOS is mostly for pre OS applications, Type 42 is a good example, the Host interface used to talk to BMC and Redfish service in pre-OS environment (also runtime OS). For OS boot, maybe OS (like Windows) still retrieves information from it before ACPI enable.
I have no preference of using which way to get boot hard ID for the boot process, either to get it from DT, SMBIOS or ACPI seems to me the same... just the information is provided over there
Quoted 3 lines
SMBIOS is wonderful for the sysadmin to look at the model numbers of the installed DIMMs etc. But for core boot stuff, we really should avoid it.
Security consideration?
PATCH v2 1/1 efi_loader: architecture specific UEFI setup
Quoted 65 lines · Abner (HPS SW/FW Technologist)
Quoted 65 lines
-----Original Message-----
From: Ard Biesheuvel [mailto:ard.biesheuvel at linaro.org]
Sent: Friday, February 14, 2020 7:33 PM
To: Chang, Abner (HPS SW/FW Technologist) <[email protected]>
Cc: Alexander Graf <[email protected]>; Atish Patra <[email protected]>; Heinrich Schuchardt <[email protected]>; U-Boot Mailing List <u- boot at lists.denx.de>; Atish Patra <[email protected]>; leif at nuviainc.com
Subject: Re: [PATCH v2 1/1]efi_loader: architecture specific UEFI setupQuoted 20 lines · Abner (HPS SW/FW Technologist)
Quoted 20 lines
-----Original Message-----
From: Alexander Graf [mailto:agraf at csgraf.de]
Sent: Friday, February 14, 2020 4:07 PM
To: Chang, Abner (HPS SW/FW Technologist) <[email protected]>
Cc: Atish Patra <[email protected]>; Ard Biesheuvel <[email protected]>; Heinrich Schuchardt <[email protected]>; U-Boot Mailing List <[email protected]>; Atish Patra <[email protected]>; leif at nuviainc.com
Subject: Re: [PATCH v2 1/1]efi_loader: architecture specific UEFI setupQuoted 2 lines
Am 14.02.2020 um 05:21 schrieb Chang, Abner (HPS SW/FW Technologist)
Quoted 1 line
...
Quoted 10 lines
Quoted 10 lines
The table from this link https://github.com/riscv/riscv-
smbios/blob/master/RISCV-SMBIOS.mdQuoted 2 lines
Offset 3 is HART ID, and offset 13h is the boolean indicates this hart is the
boot hart.
Quoted 5 lines
Quoted 3 lines
kernel. How difficult is to modify the DT in EDK2 ?
I never used DT before on PC/Server project. However, the DT code is over
Quoted 7 lines
Quoted 6 lines
there in edk2 repo which mostly used by ARM platforms. I don?t think it is difficult to adopt it though.
Yes, some arm platforms already transform the DT just fine. Let's really please not use SMBIOS for anything boot or system configuration related: its purpose is in general purely informational.
As DT to embedded system, SMBIOS provides system
information/configuration on most PC/Server platforms. Especially to pre-OS applications such as EFI diagnostic tool, factory/customer deployment tools, pre-OS system configuration, network boot image and EFI OS boot loader as well. The intention of RISC-V SMBIOS is support above applications using single image for the RISC-V core variants, Non ACPI-aware OS is also part of this scope, but it is rare though.
Quoted 1 line
If you are booting to OS which is actually well understand DT then just use
DT, but for PC/Server industry, SMBIOS would be still our choice before OS.
Quoted 1 line
We may have to define the corresponding syntax If DT doesn't have it for
boot HART information. RISC-V System Description Task Group (f it formed) would be a good place to bring this topic.
Quoted 8 lines
Quoted 6 lines
Quoted 1 line
Maybe you can support both DT or SMBIOS to retrieve the information you
need on demand...
Quoted 1 line
SMBIOS is an informational protocol. Firmware or OS loaders should not rely on it for low-level things like the hart id.
Hart ID is just one of the information in type 44 which is the same as the processor information provided in type 4.
Fine. But that doesn't mean we should be parsing SMBIOS tables in the Linux startup code.
Quoted 15 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
So yes, unless I hear really good arguments against passing it via /chosen in DT, I'd strongly prefer that mechanism. For ACPI (if it ever happens), there would be a special ACPI table for it anyway.
Quoted 7 lines
Quoted 1 line
Yes, we do have an ECR for ACPI spec to report the RISC-V core
characteristic which is similar to what we done for SMBIOS.
Quoted 1 line
So we'll end up with a DT+SMBIOS or ACPI+SMBIOS boot protocol, and we'll always have to parse two sets of tables, just to discover the hart id. I don't think that makes sense at all, to be honest.
As I said, SMBIOS is mostly for pre OS applications, Type 42 is a good example, the Host interface used to talk to BMC and Redfish service in pre-OS environment (also runtime OS). For OS boot, maybe OS (like Windows) still retrieves information from it before ACPI enable.
Quoted 6 lines
I have no preference of using which way to get boot hard ID for the boot process, either to get it from DT, SMBIOS or ACPI seems to me the same... just the information is provided over there
Quoted 3 lines
SMBIOS is wonderful for the sysadmin to look at the model numbers of the installed DIMMs etc. But for core boot stuff, we really should avoid it.
Security consideration?
What security considerations did you have in mind?
Chang
PATCH v2 1/1 efi_loader: architecture specific UEFI setup
Quoted 91 lines
-----Original Message-----
From: Ard Biesheuvel [mailto:ard.biesheuvel at linaro.org]
Sent: Friday, February 14, 2020 8:07 PM
To: Chang, Abner (HPS SW/FW Technologist) <[email protected]>
Cc: Alexander Graf <[email protected]>; Atish Patra <[email protected]>; Heinrich Schuchardt <[email protected]>; U-Boot Mailing List <u- boot at lists.denx.de>; Atish Patra <[email protected]>; leif at nuviainc.com
Subject: Re: [PATCH v2 1/1]efi_loader: architecture specific UEFI setupQuoted 19 lines · Abner (HPS SW/FW Technologist)
Quoted 19 lines
-----Original Message-----
From: Ard Biesheuvel [mailto:ard.biesheuvel at linaro.org]
Sent: Friday, February 14, 2020 7:33 PM
To: Chang, Abner (HPS SW/FW Technologist) <[email protected]>
Cc: Alexander Graf <[email protected]>; Atish Patra <[email protected]>; Heinrich Schuchardt <[email protected]>; U-Boot Mailing List <u- [email protected]>; Atish Patra <[email protected]>; leif at nuviainc.com
Subject: Re: [PATCH v2 1/1]efi_loader: architecture specific UEFI setupQuoted 3 lines · Abner (HPS SW/FW Technologist)
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
-----Original Message-----
From: Alexander Graf [mailto:agraf at csgraf.de]
Sent: Friday, February 14, 2020 4:07 PM
To: Chang, Abner (HPS SW/FW Technologist)Quoted 32 lines
Quoted 32 lines
Quoted 14 lines
Quoted 14 lines
Cc: Atish Patra <[email protected]>; Ard Biesheuvel <[email protected]>; Heinrich Schuchardt <[email protected]>; U-Boot Mailing List <[email protected]>; Atish Patra <[email protected]>; leif at nuviainc.com
Subject: Re: [PATCH v2 1/1]efi_loader: architecture specific UEFI setupQuoted 2 lines
Am 14.02.2020 um 05:21 schrieb Chang, Abner (HPS SW/FW Technologist)
Quoted 1 line
...
Quoted 16 lines
Quoted 16 lines
The table from this link https://github.com/riscv/riscv-
smbios/blob/master/RISCV-SMBIOS.mdQuoted 2 lines
Offset 3 is HART ID, and offset 13h is the boolean indicates this hart is the
boot hart.
Quoted 5 lines
Quoted 3 lines
kernel. How difficult is to modify the DT in EDK2 ?
I never used DT before on PC/Server project. However, the DT code is over
there in edk2 repo which mostly used by ARM platforms. I don?t think it is difficult to adopt it though.
Yes, some arm platforms already transform the DT just fine. Let's really please not use SMBIOS for anything boot or system configuration related: its purpose is in general purely informational.
Quoted 7 lines
Quoted 7 lines
Quoted 1 line
As DT to embedded system, SMBIOS provides system
information/configuration on most PC/Server platforms. Especially to pre-OS applications such as EFI diagnostic tool, factory/customer deployment tools, pre-OS system configuration, network boot image and EFI OS boot loader as well. The intention of RISC-V SMBIOS is support above applications using single image for the RISC-V core variants, Non ACPI-aware OS is also part of this scope, but it is rare
though.
Quoted 3 lines
Quoted 3 lines
Quoted 2 lines
If you are booting to OS which is actually well understand DT then just use
DT, but for PC/Server industry, SMBIOS would be still our choice before
OS.
Quoted 9 lines
Quoted 9 lines
Quoted 2 lines
We may have to define the corresponding syntax If DT doesn't have it for
boot HART information. RISC-V System Description Task Group (f it formed) would be a good place to bring this topic.
Quoted 2 lines
Maybe you can support both DT or SMBIOS to retrieve the information you
need on demand...
Quoted 1 line
Quoted 8 lines
Quoted 3 lines
Quoted 2 lines
SMBIOS is an informational protocol. Firmware or OS loaders should not rely on it for low-level things like the hart id.
Hart ID is just one of the information in type 44 which is the same as the
processor information provided in type 4.
Quoted 1 line
Fine. But that doesn't mean we should be parsing SMBIOS tables in the Linux startup code.
Ok, this is not my familiar area. You guys are better than me.
Quoted 24 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
So yes, unless I hear really good arguments against passing it via /chosen in DT, I'd strongly prefer that mechanism. For ACPI (if it ever happens), there would be a special ACPI table for it anyway.
Quoted 8 lines
Quoted 7 lines
Quoted 1 line
Yes, we do have an ECR for ACPI spec to report the RISC-V core
characteristic which is similar to what we done for SMBIOS.
Quoted 1 line
So we'll end up with a DT+SMBIOS or ACPI+SMBIOS boot protocol, and we'll always have to parse two sets of tables, just to discover the hart id. I don't think that makes sense at all, to be honest.
As I said, SMBIOS is mostly for pre OS applications, Type 42 is a good
example, the Host interface used to talk to BMC and Redfish service in pre- OS environment (also runtime OS).
Quoted 1 line
For OS boot, maybe OS (like Windows) still retrieves information from it
before ACPI enable.
Quoted 6 lines
I have no preference of using which way to get boot hard ID for the boot process, either to get it from DT, SMBIOS or ACPI seems to me the same... just the information is provided over there
Quoted 1 line
Quoted 5 lines
Quoted 3 lines
Quoted 2 lines
SMBIOS is wonderful for the sysadmin to look at the model numbers of the installed DIMMs etc. But for core boot stuff, we really should avoid it.
Security consideration?
What security considerations did you have in mind?
Hah this is my question for you. Can someone under Pre-OS environment and steal boot hard ID and do something bad? Or change it to run malicious code from another HART?