OpenSBI system reset device tree binding
Hello Anup,
now that we have the system reset extension in OpenSBI the next logical step for me would be to implement a U-Boot driver using it to provide the UEFI ResetSystem() runtime service.
Similarly a reset driver could be built into Linux.
First thing that is needed is a device tree binding describing that we have an OpenSBI system reset available for the board. A comparable binding exists in the ARM world for PSCI. Cf. Documentation/devicetree/bindings/arm/psci.yaml in the Linux code.
Has such a binding been defined for OpenSBI yet?
Best regards
Heinrich
Hi Heinrich,
Quoted 7 lines
-----Original Message-----
From: Heinrich Schuchardt <[email protected]>
Sent: 03 March 2021 12:45
To: Anup Patel <[email protected]>
Cc: OpenSBI <[email protected]>
Subject: OpenSBI system reset device tree binding
Quoted 5 lines
Hello Anup,
now that we have the system reset extension in OpenSBI the next logical step for me would be to implement a U-Boot driver using it to provide the UEFI
ResetSystem()runtime service.
Yes, that's the right way.
Quoted 2 lines
Similarly a reset driver could be built into Linux.
I have already send-out couple of revision of Linux patches.
May be you can review that and take it as reference for U-Boot driver ??
Quoted 5 lines
First thing that is needed is a device tree binding describing that we have an OpenSBI system reset available for the board. A comparable binding exists in the ARM world for PSCI. Cf.
Documentation/devicetree/bindings/arm/psci.yamlin the Linux code.
The ARM world is bit different. The PSCI came late in ARM world so they Have ARM 32bit systems which run without PSCI. Probably, that?s why PSCI is detected/probed via DT node.
Quoted 2 lines
Has such a binding been defined for OpenSBI yet?
In RISC-V S-mode world, the SBI is assumed to be always there so we don't need a DT node to detect SBI presence. Instead, we have SBI calls to get SBI spec version and detect available SBI extensions. This also simplify Guest/VM DT generation for hypervisors.
Regards,
Anup
Quoted 15 lines · Anup Patel
Hi Heinrich,
Quoted 7 lines
-----Original Message-----
From: Heinrich Schuchardt <[email protected]>
Sent: 03 March 2021 12:45
To: Anup Patel <[email protected]>
Cc: OpenSBI <[email protected]>
Subject: OpenSBI system reset device tree bindingQuoted 5 lines
Hello Anup,
now that we have the system reset extension in OpenSBI the next logical step for me would be to implement a U-Boot driver using it to provide the UEFI
ResetSystem()runtime service.
Quoted 8 lines
Yes, that's the right way.
Quoted 2 lines
Similarly a reset driver could be built into Linux.
I have already send-out couple of revision of Linux patches.
May be you can review that and take it as reference for U-Boot driver ??
Are you referring to this series:
https://patchwork.kernel.org/project/kvm/list/?series=427585 ?
Quoted 12 lines
Quoted 6 lines
First thing that is needed is a device tree binding describing that we have an OpenSBI system reset available for the board. A comparable binding exists in the ARM world for PSCI. Cf.
Documentation/devicetree/bindings/arm/psci.yamlin the Linux code.The ARM world is bit different. The PSCI came late in ARM world so they Have ARM 32bit systems which run without PSCI. Probably, that?s why PSCI is detected/probed via DT node.
Quoted 1 line
Quoted 6 lines
Quoted 1 line
Has such a binding been defined for OpenSBI yet?
In RISC-V S-mode world, the SBI is assumed to be always there so we don't need a DT node to detect SBI presence. Instead, we have SBI calls to get SBI spec version and detect available SBI extensions. This also simplify Guest/VM DT generation for hypervisors.
The OpenSBI project was started after RISC-V support entered U-Boot. Hence U-Boot can be built with and without SBI (qemu-riscv64_smode_defconfig vs qemu-riscv64_defconfig, sipeed_maix_bitm_defconfig vs sipeed_maix_smode_defconfig).
How would an operating system know if there is an SBI present if it is not stated in the device-tree?
Once we know there is an SBI we can check if it has the reset extension. So this bit of information is not needed in the device-tree.
Best regards
Heinrich
Quoted 49 lines · Heinrich Schuchardt
Quoted 15 lines · Anup Patel
Hi Heinrich,
Quoted 7 lines
-----Original Message-----
From: Heinrich Schuchardt <[email protected]>
Sent: 03 March 2021 12:45
To: Anup Patel <[email protected]>
Cc: OpenSBI <[email protected]>
Subject: OpenSBI system reset device tree bindingQuoted 5 lines
Hello Anup,
now that we have the system reset extension in OpenSBI the next logical step for me would be to implement a U-Boot driver using it to provide the UEFI
ResetSystem()runtime service.Quoted 8 lines
Yes, that's the right way.
Quoted 2 lines
Similarly a reset driver could be built into Linux.
I have already send-out couple of revision of Linux patches.
May be you can review that and take it as reference for U-Boot driver ??
Are you referring to this series:
https://patchwork.kernel.org/project/kvm/list/?series=427585 ?
Quoted 12 lines
Quoted 6 lines
First thing that is needed is a device tree binding describing that we have an OpenSBI system reset available for the board. A comparable binding exists in the ARM world for PSCI. Cf.
Documentation/devicetree/bindings/arm/psci.yamlin the Linux code.The ARM world is bit different. The PSCI came late in ARM world so they Have ARM 32bit systems which run without PSCI. Probably, that?s why PSCI is detected/probed via DT node.
Quoted 1 line
Quoted 6 lines
Quoted 1 line
Has such a binding been defined for OpenSBI yet?
In RISC-V S-mode world, the SBI is assumed to be always there so we don't need a DT node to detect SBI presence. Instead, we have SBI calls to get SBI spec version and detect available SBI extensions. This also simplify Guest/VM DT generation for hypervisors.
Quoted 7 lines
The OpenSBI project was started after RISC-V support entered U-Boot. Hence U-Boot can be built with and without SBI (qemu-riscv64_smode_defconfig vs qemu-riscv64_defconfig,
sipeed_maix_bitm_defconfigvssipeed_maix_smode_defconfig).How would an operating system know if there is an SBI present if it is not stated in the device-tree?
If it's running in S-mode, there is an SBI implementation present. It's that simple. It is *the* interface between S-mode and whatever's running below it. The configs you speak of are for running in M-mode, so SBI doesn't exist because you're not in S-mode.
Quoted 2 lines
Once we know there is an SBI we can check if it has the reset extension. So this bit of information is not needed in the device-tree.
If you're an EFI implementation, you have S-mode and you can rely on SBI being present. You do not need any detection.
Jess
Quoted 22 lines · Heinrich Schuchardt
Quoted 20 lines · Anup Patel
Hi Heinrich,
Quoted 7 lines
-----Original Message-----
From: Heinrich Schuchardt <[email protected]>
Sent: 03 March 2021 12:45
To: Anup Patel <[email protected]>
Cc: OpenSBI <[email protected]>
Subject: OpenSBI system reset device tree bindingQuoted 5 lines
Hello Anup,
now that we have the system reset extension in OpenSBI the next logical step for me would be to implement a U-Boot driver using it to provide the UEFI
ResetSystem()runtime service.Yes, that's the right way.
Quoted 2 lines
Similarly a reset driver could be built into Linux.
Quoted 7 lines
Quoted 3 lines
I have already send-out couple of revision of Linux patches.
May be you can review that and take it as reference for U-Boot driver ??
Are you referring to this series:
https://patchwork.kernel.org/project/kvm/list/?series=427585 ?
This particular series is about implementing SBI v0.2 specification for the KVM RISC-V hypervisor.
I am referring to this patch:
https://patchwork.kernel.org/project/linux-riscv/patch/20210301115833.382364-1-anup.patel at wdc.com/
Quoted 20 lines
Quoted 13 lines
Quoted 7 lines
First thing that is needed is a device tree binding describing that we have an OpenSBI system reset available for the board. A comparable binding exists in the ARM world for PSCI. Cf.
Documentation/devicetree/bindings/arm/psci.yamlin the Linux code.The ARM world is bit different. The PSCI came late in ARM world so they Have ARM 32bit systems which run without PSCI. Probably, that?s why PSCI is detected/probed via DT node.
Quoted 1 line
Quoted 6 lines
Quoted 1 line
Has such a binding been defined for OpenSBI yet?
In RISC-V S-mode world, the SBI is assumed to be always there so we don't need a DT node to detect SBI presence. Instead, we have SBI calls to get SBI spec version and detect available SBI extensions. This also simplify Guest/VM DT generation for hypervisors.
Quoted 4 lines
The OpenSBI project was started after RISC-V support entered U-Boot. Hence U-Boot can be built with and without SBI (qemu-riscv64_smode_defconfig vs qemu-riscv64_defconfig,
sipeed_maix_bitm_defconfigvssipeed_maix_smode_defconfig).
The SBI specification is independent of the OpenSBI project. The oldest SBI implementation is BBL (https://github.com/riscv/riscv-pk) which is still at SBI v0.1 specification. The OpenSBI project is a SBI implementation from scratch and designed for using with various bootloaders (such as U-Boot, EDK2, or standalone).
The OpenSBI project is not only for U-Boot. In fact, even EDK2 project uses OpenSBI. There are lot of FPGA platforms which have no boot-loader and use OpenSBI to boot kernel directly without boot-loaders.
The U-Boot M-mode and U-Boot SPL does not have SBI because both are running directly in M-mode but U-Boot S-mode always has some M-mode firmware (OpenSBI) running in background so U-Boot S-mode always has SBI calls.
The EFI implementation of U-Boot S-mode and EDK2 both run in S-mode so these EFI implementations can always use SBI calls.
Quoted 3 lines
How would an operating system know if there is an SBI present if it is not stated in the device-tree?
All S-mode operating systems (Linux, FreeBSD, and other BSD variants, etc) and HS-mode hypervisors (Xvisor, KVM, Bao, etc).
Quoted 3 lines
Once we know there is an SBI we can check if it has the reset extension. So this bit of information is not needed in the device-tree.
Linux kernel does this as follows:
1) SBI is always there so try to read SBI spec version
2) If SBI spec version is v0.1 then we have only legacy SBI calls so no SBI extensions available
3) If SBI spec version is v0.2 or higher then we can check for any SBI extension.
Regards,
Anup