From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail05.groups.io (mail05.groups.io [45.79.224.7]) by spool.mail.gandi.net (Postfix) with ESMTPS id 664FD78003C for ; Fri, 12 Jul 2024 18:16:53 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=IujHyg4iRDd3rCh0y/jxD4VIJQGe7AeyRnWHQBowhGA=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Resent-Date:Resent-From:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Type:Content-Transfer-Encoding; s=20240206; t=1720808213; v=1; b=acYhD6Zu2+16BDxHExBjQuZ2fJhMOmhequvq0TbSDR4EOM/MVkKgrEbG6ie5cruAZkDg621x 03GjyHGNRp4EKgK3VJe5DcIKXov2BKxtmM0gPYK9Z+w93u0prFvjDU0Txxw7M0kOImfCNbEhZnm dqrG8srHZxw16mwkFBIB9nndC6vZcPqskZfTL0KtZvmAQxfci2Hdi4q7ggjcXlebxd3bktuBXSB +DxOGKfLA/6RpJacdap5UfzlfsDRyYBNAvGzpJssqDL5wRfqn6aHzOlkRJaul+Nl+RFCEJQ+R4R oTK9umBOdjIliA9CQm8j8ZevZU7TmXst545Iy+Qq3gxsA== X-Received: by 127.0.0.2 with SMTP id kc3kYY7687511xIB2fMzYB34; Fri, 12 Jul 2024 11:16:51 -0700 X-Received: from mail-pg1-f177.google.com (mail-pg1-f177.google.com [209.85.215.177]) by mx.groups.io with SMTP id smtpd.web10.3207.1720772441356197682 for ; Fri, 12 Jul 2024 01:20:41 -0700 X-Received: by mail-pg1-f177.google.com with SMTP id 41be03b00d2f7-78aeee1068aso255891a12.2 for ; Fri, 12 Jul 2024 01:20:41 -0700 (PDT) X-Gm-Message-State: jZVJ5asWBkeIme9uvFcQPs34x7686176AA= X-Google-Smtp-Source: AGHT+IFXIdyZgL2E7lGskoseRgA+wPLMkB65o5N/8bFR+lJ+zPQiLS6zlfmS9b7+b1X4+WnfVzvYrA== X-Received: by 2002:a05:6a20:439f:b0:1c0:f529:af05 with SMTP id adf61e73a8af0-1c2984cda84mr11323456637.43.1720772440233; Fri, 12 Jul 2024 01:20:40 -0700 (PDT) X-Received: from localhost.localdomain ([47.246.98.206]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2cacd2d08a7sm878660a91.10.2024.07.12.01.20.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Jul 2024 01:20:39 -0700 (PDT) From: Evan Chai X-Google-Original-From: Evan Chai To: devel@edk2.groups.io Cc: Evan Chai , Andrei Warkentin , Sunil V L , Yong Li Subject: [edk2-devel] [PATCH V3 2/2] RiscVQemuServerPlatform: added README file Date: Fri, 12 Jul 2024 16:20:05 +0800 Message-ID: <20240712082007.2942-3-evan.chai@linux.alibaba.com> In-Reply-To: <20240712082007.2942-1-evan.chai@linux.alibaba.com> References: <20240712082007.2942-1-evan.chai@linux.alibaba.com> MIME-Version: 1.0 Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Resent-Date: Fri, 12 Jul 2024 11:16:49 -0700 Resent-From: evanchai91@gmail.com Reply-To: devel@edk2.groups.io,evanchai91@gmail.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20240206 header.b=acYhD6Zu; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 45.79.224.7 as permitted sender) smtp.mailfrom=bounce@groups.io 1. Added high-level software architecture model 2. Included reference examples for build and execution environments 3. Provided reference materials for other dependent components Cc: Andrei Warkentin Cc: Sunil V L Cc: Yong Li Signed-off-by: Evan Chai --- Platform/Qemu/RiscVQemuServerPlatform/Readme.md | 165 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 165 insertions(+) diff --git a/Platform/Qemu/RiscVQemuServerPlatform/Readme.md b/Platform/Qemu/RiscVQemuServerPlatform/Readme.md new file mode 100644 index 00000000..21b87249 --- /dev/null +++ b/Platform/Qemu/RiscVQemuServerPlatform/Readme.md @@ -0,0 +1,165 @@ +# RISC-V UEFI Server Reference Board +The goal of this document is to provide a generic server platform firmware solution applicable to systems built on the RISC-V architecture SOC. + +## Revision History + +| Document Number | Revision Number | Description | Maintainer | Revision Date | +| ------------- | --- | :--------------------------------------------------------------------- | ---------- | -------- | +| \ | 0.1 | Initial release : create RISC-V UEFI server reference board | [Evan Chai](evan.chai@intel.com) | Mar 2024 | +| | 0.2 | | | | + + +## INDEX +* 1 [Overview](#1-Overview) +* 2 [Server SOC Reference Model](#2-Server-SOC-Reference-Model) +* 3 [Boot Flow](#3-Boot-Flow) +* 4 [Development Environment Setup](#4-Development-Environment-Setup) +* 5 [Verification](#5-Verification) +* 6 [WIP and Pending Tasks](#6-WIP-and-Pending-Tasks) +* 7 [Known Issues](#7-Known-Issues) +* 8 [Appendix](#8-Appendix) + +## 1 Overview +### 1.1 References +* UEFI Specification v2.10: https://uefi.org/sites/default/files/resources/UEFI_Spec_2_10_Aug29.pdf +* UEFI PI Specification v1.8.0: https://uefi.org/sites/default/files/resources/UEFI_PI_Spec_1_8_March3.pdf +* ACPI Specification v6.5: https://uefi.org/sites/default/files/resources/ACPI_Spec_6_5_Aug29.pdf +* OpenSbi Specification: https://github.com/riscv-software-src/opensbi +* BRS Specification: https://github.com/riscv-non-isa/riscv-brs +* Device Tree Specification v0.4: https://www.devicetree.org/ +* Smbios Specification v3.7.0: https://www.dmtf.org/sites/default/files/standards/documents/DSP0134_3.7.0.pdf +* Server Soc Specification: https://github.com/riscv-non-isa/server-soc +* Server Platform Specification: https://github.com/riscv-non-isa/riscv-server-platform + +### 1.2 Target Audience +This document is intended for the following readers: +* IHVs and OSVs who actively engaged in the building of the RISC-V ecosystem, serving as a vital component in the vertical integration of systems. +* Bios developers, either those who create general-purpose BIOS and other firmware products or those who modify these products for use in various vendor architecture-based products. +* Other stakeholders who are interested in the RISC-V platform and have firmware development needs. + +### 1.3 Terminology + +| Term | Description +|:-------------------- |:------------------------- +| UEFI | Unified Extensible Firmware Interface +| SBI | Supervisor Binary Interface +| BRS | Boot and Runtime Services +| RVI | [RISC-V International](https://riscv.org/) +| RISE | [RISC-V Software Ecosystem](https://wiki.riseproject.dev/display/HOME/About+RISE) +| SCT | UEFI Self Certification Tests +| FWTS | Firmware Test Suite + + +## 2 Server SOC Reference Model +This chapter introduces the hardware-level topology of ‘rvsp-ref’, allowing users to gain insights into the device list and resource allocation under this model. + +### 2.1 Requirements +This qemu virtual machine (server soc reference board) is required to be compliant with RISC-V [Server SOC Spec](https://github.com/riscv-non-isa/server-soc) as much as possible. The details of Server SOC Requrement can be found in [Table 1 Server SOC Requirement](https://wiki.riseproject.dev/display/HOME/EDK2_00_18+-+RISC-V+QEMU+Server+Reference+Platform#EDK2_00_18RISCVQEMUServerReferencePlatform-Table1ServerSOCRequirement). + +### 2.2 High Level Design +The Implementation Choices +* Make the configuration as fixed as possible so that this new machine is easy-to-go and less confusing. +* Remove the unnecessary devices as many as possible, e.g. CLINT/PLIC are removed. +* Keep the MemMap entries as similar as RiscVVirt vm for easy adoption at the early stage. +* Keep dtb entries as small as possible. + +Refer to [Table 2 Devices and Memory Mappings](https://wiki.riseproject.dev/display/HOME/EDK2_00_18+-+RISC-V+QEMU+Server+Reference+Platform#EDK2_00_18RISCVQEMUServerReferencePlatform-Table2DevicesandMemoryMappings) for the details. + +## 3 Boot Flow +The following diagram illustrates various platform initialization scenarios. This document will not cover the detailed work of initializing on real hardware platforms, as it is beyond its scope. Our focus will be on the more general firmware initialization tasks performed on the qemu emulator. See the part of the diagram indicated by the blue color, which corresponds to QemuServerPlatform Boot Flow. + +Note: _For specifics on the qemu Server SOC reference model in this document, it is essential to consult both the latest developments in the qemu source code and the definition in the server platform specifications. Relevant information for both can be obtained from Server SOC TG and Server Platform TG of RVI.c_ + +#### Figuire 1 RISC-V Platform EDK2 Firmware Enabling Philosophy + +![RISC-V_Platform_EDK2_Firmware_Enabling_Philosophy](https://wiki.riseproject.dev/download/attachments/25395218/RISC-V_Platform_EDK2_Firmware_Enabling_Philosophy.jpg?version=1&modificationDate=1720687252108&api=v2) + +For a more detailed introduction to the background and specifics of Boot-Flow, please refer to [3.1 The Traditional Boot Flow](https://wiki.riseproject.dev/display/HOME/EDK2_00_18+-+RISC-V+QEMU+Server+Reference+Platform#EDK2_00_18RISCVQEMUServerReferencePlatform-3.1TheTraditionalBootFlow) and [3.2 The Alternative Boot Flow](https://wiki.riseproject.dev/display/HOME/EDK2_00_18+-+RISC-V+QEMU+Server+Reference+Platform#EDK2_00_18RISCVQEMUServerReferencePlatform-3.2AlternativeBootFlow). To understand the design concepts of other modules, refer to the remaining sections of [this chapter](https://wiki.riseproject.dev/display/HOME/EDK2_00_18+-+RISC-V+QEMU+Server+Reference+Platform#EDK2_00_18RISCVQEMUServerReferencePlatform-3BootFlow). + +## 4 Development Environment Setup + +### 4.1 Building and running based on BRS environment (**Recommended but not mandatory**) + +1. Build brs test suit +``` +git clone https://github.com/intel/rv-brs-test-suite.git +``` + +Please refer to detailed build steps from [README.md](https://github.com/intel/rv-brs-test-suite/blob/main/README.md), then you will get the following stuff: +``` + QEMU_DIR=$WORKSPACE/rv-brs-test-suite/brsi/scripts/qemu/build + BRS_IMG_DIR=$WORKSPACE/rv-brs-test-suite/brsi/scripts/output + OPENSBI_DIR=$WORKSPACE/rv-brs-test-suite/brsi/scripts/opensbi/build/platform/generic/firmware + EDK2_DIR=$WORKSPACE/rv-brs-test-suite/brsi/scripts/Build/RiscVQemuServerPlatform/DEBUG_GCC5/FV +``` + +2. Boot Execution + +__Command example1__: +``` + ./qemu-system-riscv64 -nographic -m 8G -smp 2 \ + -machine rvsp-ref,pflash0=pflash0,pflash1=pflash1 \ + -blockdev node-name=pflash0,driver=file,read-only=on,filename=$FW_DIR/RISCV_SP_CODE.fd \ + -blockdev node-name=pflash1,driver=file,filename=$FW_DIR/RISCV_SP_VARS.fd \ + -bios $Sbi_DIR/fw_dynamic.bin \ + -drive file=$Img_DIR/brs_live_image.img,if=ide,format=raw +``` +__Note__: +* _‘rvsp-ref’ is a specified qemu-based SOC model, whose source code is still under development and will be accessible from the RVI staging repository later. (The ongoing patch can be found in the note of )_ +* _The Pre-build image ‘brs_live_image.img,if’ can be downloaded in RISC-V BRS Development Suite repository, or you can build it by yourself. See [3.6](https://wiki.riseproject.dev/display/HOME/EDK2_00_18+-+RISC-V+QEMU+Server+Reference+Platform#EDK2_00_18RISCVQEMUServerReferencePlatform-3.6OSImage)_ +* _‘-bios $Sbi_DIR/fw_dynamic.bin’ the parameter points to the opensbi path. See more in [3.5](https://wiki.riseproject.dev/display/HOME/EDK2_00_18+-+RISC-V+QEMU+Server+Reference+Platform#EDK2_00_18RISCVQEMUServerReferencePlatform-3.5OpenSbi)._ +* _In case the developer aims to boot just to the UEFI shell, the parameter '-drive file=$Img_DIR/brs_live_image.img,if=ide,format=raw' in the final line is not needed._ + +### 4.2 Compiling edk2 firmware separately outside of BRS (Manually) +1. Building the RISC-V edk2 server platform + +``` +git clone https://github.com/tianocore/edk2.git +cd edk2 +git submodule update --init +cd .. + +git clone https://github.com/tianocore/edk2-platforms.git +cd edk2-platforms +git submodule update --init +cd .. + +export WORKSPACE=`pwd` +export GCC5_RISCV64_PREFIX=riscv64-linux-gnu- +export PACKAGES_PATH=$WORKSPACE/edk2:$WORKSPACE/edk2-platforms + +cd edk2 +make -C BaseTools clean +make -C BaseTools +source edksetup.sh +./edksetup.sh + +build -a RISCV64 -t GCC5 -p Platform/Qemu/RiscVQemuServerPlatform/RiscVQemuServerPlatform.dsc +``` +2. Convert FD files +``` + truncate -s 32M Build/RiscVQemuServerPlatform/DEBUG_GCC5/FV/RISCV_SP_CODE.fd + truncate -s 32M Build/RiscVQemuServerPlatform/DEBUG_GCC5/FV/RISCV_SP_VARS.fd +``` +3. Boot Execution + +(See the __Command example1__) + +## 5 Verification +The tests covered in this document are based on the BRS spec, focusing on two primary modules: SCT and FWTS. The relevant test scripts, pre-build image and guidance can be obtained from the [RISC-V BRS Development Suite Repository](https://github.com/intel/rv-brs-test-suite): + +## 6 WIP and Pending Tasks +The listed items in the table represent ongoing firmware development tasks that are still unfinished. Some specifications are in the process of refinement, and a few are yet to be drafted. Please refer to subsequent updates from the RISE community for more information. + +To see [Table 5 Bios Requirements](https://wiki.riseproject.dev/display/HOME/EDK2_00_18+-+RISC-V+QEMU+Server+Reference+Platform#EDK2_00_18RISCVQEMUServerReferencePlatform-Table5BiosRequirements) and [Table 6 Upcoming UEFI Features List](https://wiki.riseproject.dev/display/HOME/EDK2_00_18+-+RISC-V+QEMU+Server+Reference+Platform#EDK2_00_18RISCVQEMUServerReferencePlatform-Table6UpcomingUEFIFeaturesList) + +## 7 Known Issues + +The current known issues, which will be resolved gradually during the subsequent phases of development. Please refer to [Table 7 Known Issues](https://wiki.riseproject.dev/display/HOME/EDK2_00_18+-+RISC-V+QEMU+Server+Reference+Platform#EDK2_00_18RISCVQEMUServerReferencePlatform-Table7KnownIssues) for more details. + +## 8 Appendix +NA + +## Contributors +- ~~Evan Chai ~~ +- Evan Chai \ No newline at end of file -- 2.45.1.windows.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#119918): https://edk2.groups.io/g/devel/message/119918 Mute This Topic: https://groups.io/mt/107187583/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-