From: "Daniel Schaefer" <daniel.schaefer@hpe.com>
To: Leif Lindholm <leif@nuviainc.com>
Cc: <devel@edk2.groups.io>, Gilbert Chen <gilbert.chen@hpe.com>,
Leif Lindholm <leif.lindholm@linaro.org>,
Abner Chang <abner.chang@hpe.com>,
Michael D Kinney <michael.d.kinney@intel.com>
Subject: Re: [PATCH v2 2/3] ProcessorPkg/Library: Add RiscVOpensbiLib
Date: Wed, 20 May 2020 16:44:38 +0200 [thread overview]
Message-ID: <89fdccad-9dc9-398a-738c-31552ca90dad@hpe.com> (raw)
In-Reply-To: <20200520120042.GM1923@vanye>
On 5/20/20 2:00 PM, Leif Lindholm wrote:
> (Fixing Mike's email in reply)
>
> On Fri, May 15, 2020 at 15:39:36 +0200, Daniel Schaefer wrote:
>> From: Abner Chang <abner.chang@hpe.com>
>>
>> EDK2 RISC-V OpenSBI library which pull in external source files under
>> RISC-V/ProcessorPkg/Library/RiscVOpensbiLib/opensbi to the build process.
>>
>> Signed-off-by: Abner Chang <abner.chang@hpe.com>
>> Co-authored-by: Daniel Schaefer <daniel.schaefer@hpe.com>
>
> These two fields have flipped contents since v1 (without being
> mentioned in either cover letter or below --- of this one).
>
> The v1 form was correct - only the contributor can certify the
> adherence of the contribution to https://developercertificate.org/ .
>
Meaning if the commit says Signed-off-by: Abner, I can't send it to the
list?
>> Co-authored-by: Gilbert Chen <gilbert.chen@hpe.com>
>> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
>>
>> Cc: Abner Chang <abner.chang@hpe.com>
>> Cc: Gilbert Chen <gilbert.chen@hpe.com>
>> Cc: Michael D Kinney <michael.k.kinney@intel.com>
>> Cc: Leif Lindholm <leif@nuviainc.com>
>> ---
>> Silicon/RISC-V/ProcessorPkg/Library/RiscVOpensbiLib/RiscVOpensbiLib.inf | 60 +++++++++++++++
>> Silicon/RISC-V/ProcessorPkg/Include/IndustryStandard/RiscVOpensbi.h | 79 ++++++++++++++++++++
>> Silicon/RISC-V/ProcessorPkg/Include/OpensbiTypes.h | 73 ++++++++++++++++++
>> 3 files changed, 212 insertions(+)
>>
>> diff --git a/Silicon/RISC-V/ProcessorPkg/Library/RiscVOpensbiLib/RiscVOpensbiLib.inf b/Silicon/RISC-V/ProcessorPkg/Library/RiscVOpensbiLib/RiscVOpensbiLib.inf
>> new file mode 100644
>> index 000000000000..59dbd67d8e03
>> --- /dev/null
>> +++ b/Silicon/RISC-V/ProcessorPkg/Library/RiscVOpensbiLib/RiscVOpensbiLib.inf
>> @@ -0,0 +1,60 @@
>> +## @file
>> +# RISC-V Opensbi Library Instance.
>> +#
>> +# Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights reserved.<BR>
>> +#
>> +# SPDX-License-Identifier: BSD-2-Clause-Patent
>> +#
>> +##
>> +
>> +[Defines]
>> + INF_VERSION = 0x0001001b
>> + BASE_NAME = RiscVOpensbiLib
>> + FILE_GUID = 6EF0C812-66F6-11E9-93CE-3F5D5F0DF0A7
>> + MODULE_TYPE = BASE
>> + VERSION_STRING = 1.0
>> + LIBRARY_CLASS = RiscVOpensbiLib
>> +
>> +[Sources]
>> + opensbi/lib/sbi/riscv_asm.c
>> + opensbi/lib/sbi/riscv_atomic.c
>> + opensbi/lib/sbi/riscv_hardfp.S
>> + opensbi/lib/sbi/riscv_locks.c
>> + opensbi/lib/sbi/sbi_console.c
>> + opensbi/lib/sbi/sbi_ecall.c
>> + opensbi/lib/sbi/sbi_ecall_vendor.c
>> + opensbi/lib/sbi/sbi_ecall_replace.c
>> + opensbi/lib/sbi/sbi_ecall_legacy.c
>> + opensbi/lib/sbi/sbi_ecall_base.c
>> + opensbi/lib/sbi/sbi_emulate_csr.c
>> + opensbi/lib/sbi/sbi_fifo.c
>> + opensbi/lib/sbi/sbi_hart.c
>> + opensbi/lib/sbi/sbi_hfence.S
>> + opensbi/lib/sbi/sbi_illegal_insn.c
>> + opensbi/lib/sbi/sbi_init.c
>> + opensbi/lib/sbi/sbi_ipi.c
>> + opensbi/lib/sbi/sbi_misaligned_ldst.c
>> + opensbi/lib/sbi/sbi_scratch.c
>> + opensbi/lib/sbi/sbi_string.c
>> + opensbi/lib/sbi/sbi_system.c
>> + opensbi/lib/sbi/sbi_timer.c
>> + opensbi/lib/sbi/sbi_tlb.c
>> + opensbi/lib/sbi/sbi_trap.c
>> + opensbi/lib/sbi/sbi_unpriv.c
>> + opensbi/lib/utils/sys/clint.c
>> + opensbi/lib/utils/irqchip/plic.c
>> + opensbi/lib/utils/serial/sifive-uart.c
>> + opensbi/lib/utils/serial/uart8250.c
>> +
>> +[Packages]
>> + EmbeddedPkg/EmbeddedPkg.dec # For libfdt.
>> + MdePkg/MdePkg.dec
>> + Silicon/RISC-V/ProcessorPkg/RiscVProcessorPkg.dec
>> +
>> +[LibraryClasses]
>> + BaseLib
>> + PcdLib
>> + RiscVCpuLib
>> +
I talked to Abner about this and we're going to remove this
LibraryClasses section. It's not needed.
>> +
>> +
>> diff --git a/Silicon/RISC-V/ProcessorPkg/Include/IndustryStandard/RiscVOpensbi.h b/Silicon/RISC-V/ProcessorPkg/Include/IndustryStandard/RiscVOpensbi.h
>> new file mode 100644
>> index 000000000000..c5c0bd6d9b01
>> --- /dev/null
>> +++ b/Silicon/RISC-V/ProcessorPkg/Include/IndustryStandard/RiscVOpensbi.h
>> @@ -0,0 +1,79 @@
>> +/** @file
>> + SBI inline function calls.
>> +
>> + Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights reserved.<BR>
>> +
>> + SPDX-License-Identifier: BSD-2-Clause-Patent
>> +
>> +**/
>> +
>> +#ifndef EDK2_SBI_H_
>> +#define EDK2_SBI_H_
>> +
>> +#include <include/sbi/riscv_asm.h> // Reference to header file in opensbi
>> +#include <RiscVImpl.h>
>> +#include <sbi/sbi_types.h> // Reference to header file wrapper
>> +
>> +#define SBI_SUCCESS 0
>> +#define SBI_ERR_FAILED -1
>> +#define SBI_ERR_NOT_SUPPORTED -2
>> +#define SBI_ERR_INVALID_PARAM -3
>> +#define SBI_ERR_DENIED -4
>> +#define SBI_ERR_INVALID_ADDRESS -5
>> +#define SBI_ERR_ALREADY_AVAILABLE -6
>
> Did the cover-letter changelog not suggest these had been changed from
> local definitions to redefining the existing ones from Opensbi?
> If this was "not possible" (the exception stated in cover letter), I
> would have expected a comment above (below ---) on why. Or a reply to
> my feedback on v1.
Oh, I squashed it into the other commit:
ProcessorPkg/Library: Add RiscVEdk2SbiLib
>
>> +
>> +#define SBI_BASE_EXT 0x10
>> +#define SBI_HSM_EXT 0x48534D
>> +#define SBI_TIME_EXT 0x54494D45
>> +#define SBI_IPI_EXT 0x735049
>> +#define SBI_RFNC_EXT 0x52464E43
>> +
>> +//
>> +// Below two definitions should be defined in OpenSBI.
>> +//
>> +#define SBI_EXT_FIRMWARE_CODE_BASE_START 0x0A000000
>> +#define SBI_EXT_FIRMWARE_CODE_BASE_END 0x0AFFFFFF
>> +
>> +#define SBI_GET_SPEC_VERSION_FUNC 0
>> +#define SBI_GET_IMPL_ID_FUNC 1
>> +#define SBI_GET_IMPL_VERSION_FUNC 2
>> +#define SBI_PROBE_EXTENSION_FUNC 3
>> +#define SBI_GET_MVENDORID_FUNC 4
>> +#define SBI_GET_MARCHID_FUNC 5
>> +#define SBI_GET_MIMPID_FUNC 6
>> +
>> +#define SBI_HART_START_FUNC 0
>> +#define SBI_HART_STOP_FUNC 1
>> +#define SBI_HART_GET_STATUS_FUNC 2
>> +
>> +#define RISC_V_MAX_HART_SUPPORTED 16
>> +
>> +typedef
>> +VOID
>> +(EFIAPI *RISCV_HART_SWITCH_MODE)(
>> + IN UINTN FuncArg0,
>> + IN UINTN FuncArg1,
>> + IN UINTN NextAddr,
>> + IN UINTN NextMode,
>> + IN BOOLEAN NextVirt
>> + );
>> +
>> +//
>> +// Keep the structure member in 64-bit alignment.
>> +//
>> +typedef struct {
>> + UINT64 IsaExtensionSupported; // The ISA extension this core supported.
>> + RISCV_UINT128 MachineVendorId; // Machine vendor ID
>> + RISCV_UINT128 MachineArchId; // Machine Architecture ID
>> + RISCV_UINT128 MachineImplId; // Machine Implementation ID
>> + RISCV_HART_SWITCH_MODE HartSwitchMode; // OpenSBI's function to switch the mode of a hart
>> +} EFI_RISCV_FIRMWARE_CONTEXT_HART_SPECIFIC;
>> +#define FIRMWARE_CONTEXT_HART_SPECIFIC_SIZE (64 * 8) // This is the size of EFI_RISCV_FIRMWARE_CONTEXT_HART_SPECIFIC
>> + // structure. Referred by both C code and assembly code.
>> +
>> +typedef struct {
>> + VOID *PeiServiceTable; // PEI Service table
>> + EFI_RISCV_FIRMWARE_CONTEXT_HART_SPECIFIC *HartSpecific[RISC_V_MAX_HART_SUPPORTED];
>> +} EFI_RISCV_OPENSBI_FIRMWARE_CONTEXT;
>> +
>> +#endif
>> diff --git a/Silicon/RISC-V/ProcessorPkg/Include/OpensbiTypes.h b/Silicon/RISC-V/ProcessorPkg/Include/OpensbiTypes.h
>> new file mode 100644
>> index 000000000000..5f3278e8461f
>> --- /dev/null
>> +++ b/Silicon/RISC-V/ProcessorPkg/Include/OpensbiTypes.h
>> @@ -0,0 +1,73 @@
>> +/** @file
>> + RISC-V OpesbSBI header file reference.
>> +
>> + Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights reserved.<BR>
>> +
>> + SPDX-License-Identifier: BSD-2-Clause-Patent
>> +
>> +**/
>> +#ifndef EDK2_SBI_TYPES_H_
>> +#define EDK2_SBI_TYPES_H_
>> +
>> +#include <Base.h>
>> +
>> +typedef INT8 s8;
>> +typedef UINT8 u8;
>> +typedef UINT8 uint8_t;
>> +
>> +typedef INT16 s16;
>> +typedef UINT16 u16;
>> +typedef INT16 int16_t;
>> +typedef UINT16 uint16_t;
>> +
>> +typedef INT32 s32;
>> +typedef UINT32 u32;
>> +typedef INT32 int32_t;
>> +typedef UINT32 uint32_t;
>> +
>> +typedef INT64 s64;
>> +typedef UINT64 u64;
>> +typedef INT64 int64_t;
>> +typedef UINT64 uint64_t;
>> +
>> +#define PRILX "016lx"
>
> Feedback on PRILX not addressed, or commented on.> /
> Leif
>
In addition to the cover letter, I also responded to your previous
review, see:
https://edk2.groups.io/g/devel/message/59681
TLDR; we need to keep it.
next prev parent reply other threads:[~2020-05-20 14:44 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-15 13:39 [PATCH v2 0/3] New RISC-V Patches Daniel Schaefer
2020-05-15 13:39 ` [PATCH v2 1/3] ProcessorPkg/RiscVOpensbLib: Add opensbi submodule Daniel Schaefer
2020-05-20 11:51 ` Leif Lindholm
2020-05-15 13:39 ` [PATCH v2 2/3] ProcessorPkg/Library: Add RiscVOpensbiLib Daniel Schaefer
2020-05-20 12:00 ` Leif Lindholm
2020-05-20 14:44 ` Daniel Schaefer [this message]
2020-05-15 13:39 ` [PATCH v2 3/3] ProcessorPkg/Library: Add RiscVEdk2SbiLib Daniel Schaefer
2020-05-20 18:27 ` Leif Lindholm
2020-05-29 12:43 ` [edk2-devel] " Daniel Schaefer
2020-05-29 13:15 ` Leif Lindholm
2020-05-20 11:43 ` [edk2-devel] [PATCH v2 0/3] New RISC-V Patches Leif Lindholm
2020-05-20 16:03 ` [edk2-devel] [PATCH v2 0/3] New RISC-V Patches - Why in edk2-platforms Daniel Schaefer
2020-05-20 16:07 ` Daniel Schaefer
2020-05-20 16:17 ` Daniel Schaefer
2020-05-21 6:59 ` Abner Chang
2020-05-28 11:54 ` Leif Lindholm
2020-05-29 14:41 ` Abner Chang
[not found] ` <b55ee3ec-74de-532e-01f7-bd24a327d00b@hpe.com>
[not found] ` <CY4PR21MB0743421F39A05298FBCFBAA0EF8F0@CY4PR21MB0743.namprd21.prod.outlook.com>
[not found] ` <MN2PR11MB4461D8666DE6DA1E7D4B5B9BD28F0@MN2PR11MB4461.namprd11.prod.outlook.com>
[not found] ` <TU4PR8401MB1182F755F76709FF1D46D3F2FF8F0@TU4PR8401MB1182.NAMPRD84.PROD.OUTLOOK.COM>
[not found] ` <MN2PR11MB4461442E7462457D6C20F6F2D28F0@MN2PR11MB4461.namprd11.prod.outlook.com>
[not found] ` <MW2PR2101MB092494AB8318628E06B62089E18F0@MW2PR2101MB0924.namprd21.prod.outlook.com>
2020-06-03 11:57 ` [edk2-devel] Where to put RISC-V packages Daniel Schaefer
2020-06-03 15:02 ` Abner Chang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=89fdccad-9dc9-398a-738c-31552ca90dad@hpe.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox