Re: [PATCH v4] Base boot and runtime requirements - initial commit

Heinrich Schuchardt

On 11.05.21 05:41, Rahul Pathak wrote:
Initial changes for the Base Boot & Runtime requirements.
The sections which are currently in-progress are marked as TBD.
These changes can serve as the starting point and more details/changes
can be done tailored for RISC-V.

Updated the section "Storage and Partition" along with details on
SBI Extensions in Runtime Section.

There is an patch to add RISC-V details in the EBBR spec sent by Atish.
That patch is not yet merged in the EBBR. The section on the
"Startup Protocol" in this spec will refer to the requirements there
and currently that link is marked as TBD.

Corrected SBI Spec version

Signed-off-by: Rahul Pathak <rpathak@...>
riscv-platform-spec.adoc | 134 +++++++++++++++++++++++++++++++++++++--
1 file changed, 127 insertions(+), 7 deletions(-)

diff --git a/riscv-platform-spec.adoc b/riscv-platform-spec.adoc
index 160c74a..8827476 100644
--- a/riscv-platform-spec.adoc
+++ b/riscv-platform-spec.adoc
@@ -34,6 +34,36 @@ include::profiles.adoc[]
// Linux-2022 Platform
== Linux-2022 Platform

+=== Terminology
+[cols="1,2", width=80%, align="left", options="header"]
+|SBI | Supervisor Binary Interface
+|UEFI | Unified Extensible Firmware Interface
+|ACPI | Advanced Configuration and Power Interface
+|SMBIOS | System Management Basic I/O System
+|DTS | Devicetree source file
+|DTB | Devicetree binary
+|RVA22 | RISC-V Application 2022
+|EE | Execution Environment
+|RV32GC | RISC-V 32-bit general purpose ISA described as RV32IMAFDC.
+|RV64GC | RISC-V 64-bit general purpose ISA described as RV64IMAFDC.
+=== Specifications
+[cols="1,2", width=80%, align="left", options="header"]
+|link:[UEFI Specification] | v2.9
+|link:[Devicetree Specification] | v0.3
+|link:[SBI Specification] | v0.3-rc0
+|link:[RVA22 Specification] | TBD
+|link:[EBBR Specification] | v2.0.0-pre1
+|link:[ACPI Specification] | v6.4
+|link:[SMBIOS Specification] | v3.4.0
+|link:[Platform Policy] | TBD
// Base feature set for Linux-2022 Platform
=== Base
==== Architecture
@@ -59,14 +89,104 @@ include::profiles.adoc[]
* Timers
* Watchdog Timers

-==== Boot Process
-* Firmware
-* Boot-Loader
-* Discovery Mechanisms
+==== Boot and Runtime Requirements
+- The base specification defines the interface between the firmware and the
+operating system suitable for the RISC-V platforms with rich operating
+- These requirements specifies the required boot and runtime services, device
+discovery mechanism, etc.
+- The requirements are operating system agnostic, specific firmware/bootloader
+implementation agnostic.
+- Any RV32GC or RV64GC platform seeking compliance with the base specification
+require to implement all three privilege modes i.e. M, S and U mode.
+- For the generic mandatory requirements this base specification will refer to
+the EBBR Specification. Any deviation from the EBBR will be explicitly
+mentioned in the requirements.
+- Specifications followed are mentioned in the
+<<Specifications,Specification Section>>
+===== Firmware
+- UEFI Platform is required to adhere to RISC-V Platform requirements on
+calling conventions, ABI support specific to RISC-V. Refer Chapter - 2.3.7
+RISC-V Platforms of UEFI specification.
+- For compliance with base specification platform is required to implement
+link:[EBBR - UEFI Required Elements],
+link:[EBBR - UEFI Platform Specific Elements]
+and following
+link:[EBBR - Global Variables].
+====== Storage and Partitioning
+- Firmware is required to implement requirements as per the
+link:[EBBR Firmware Storage].
+- For shared storage base spec requires GPT partitioning, MBR is deprecated.
"deprecated" implies is required but will be removed in next version.
Use instead:

"MBR support is not required."

+===== Boot Services
+- All functions defined as boot services are required. Methods for
+unsupported or unimplemented behavior must return an appropriate error
+====== Startup Protocol
+- UEFI firmware could be executed in either Machine mode or Supervisor mode
+during the entire POST, according to the hart capability and the platform
+design. For detailed requirements on startup protocol refer link:[**TBD** - EBBR LINK FOR STARTUP PROTOCOL]
+and UEFI chapter 2.3.7 RISC-V Platforms.
+====== Memory Map
+- Base specification requires UEFI environment to provide a system memory map
+as per the requirements link:[EBBR - Memory Map].
+===== Discovery Mechanisms
+- Devicetree is the required mechanism for system description.
+- System is required to implement link:[EBBR - Devicetree requirements]
+to comply with this base specification. Also refer Devicetree tables section in
+chapter - 4.6 EFI Configuration Table & Properties Table of UEFI specification.
+===== Runtime Services
+====== SBI

-==== Runtime services
-* SBI
+- Required SBI spec version is 0.3 or higher.
+- Legacy Extensions from the SBI Specification are deprecated.
Please, remove this sentence because we do not require to implement

Best regards


+- Required SBI extensions -
+[cols="1,2", width=80%, align="left", options="header"]
+|SBI TIME | if **stimecmp** CSR not available
+- Required responsibilities of M-Mode runtime also includes -
+ ** Interrupt and Exception Delegation
+ ** Misaligned Load & Stores handling
+ ** Missing CSRs emulation
+ ** PMP Configuration
+- Wherever applicable firmware must implement UEFI interfaces over similar
+interfaces and services present in the SBI specification. For example, UEFI
+runtime services must implement ResetSystem() via SBI Reset extension.
+====== UEFI
+- Firmware must conform to the
+link:[EBBR - UEFI EFI_RUNTIME_SERVICES requirements].
+- Firmware must meet the requirements for
+link:[EBBR - Runtime Device Mappings]
+to avoid conflict between the firmware and OS when accessing the mapped
+- Compliant UEFI runtime environment must meet the requirements for the
+link:[EBBR - Runtime Variable Access].
+- Compliant implementation must meet the Realtime Clock requirements
+link:[EBBR - UEFI RTC interface]
+if RTC is present in the system.
+- OS should prioritize calling the UEFI interfaces before the SBI or Platform
+specific mechanisms.

// Server extension for Linux-2022 Platform
=== Server Extension

Join { to automatically receive all group messages.