[edk2-devel] [PATCH v2 0/3] New RISC-V Patches

Daniel Schaefer posted 3 patches 1 week ago
Failed in applying to current master (apply log)
Silicon/RISC-V/ProcessorPkg/Library/RiscVEdk2SbiLib/RiscVEdk2SbiLib.inf |  28 +
Silicon/RISC-V/ProcessorPkg/Library/RiscVOpensbiLib/RiscVOpensbiLib.inf |  60 ++
Silicon/RISC-V/ProcessorPkg/Include/IndustryStandard/RiscVOpensbi.h     |  72 ++
Silicon/RISC-V/ProcessorPkg/Include/Library/RiscVEdk2SbiLib.h           | 631 ++++++++++++++++
Silicon/RISC-V/ProcessorPkg/Include/OpensbiTypes.h                      |  73 ++
Silicon/RISC-V/ProcessorPkg/Library/RiscVEdk2SbiLib/RiscVEdk2SbiLib.c   | 789 ++++++++++++++++++++
.gitmodules                                                             |   3 +
Readme.md                                                               |  36 +
Silicon/RISC-V/ProcessorPkg/Library/RiscVOpensbiLib/opensbi             |   1 +
9 files changed, 1693 insertions(+)
create mode 100644 Silicon/RISC-V/ProcessorPkg/Library/RiscVEdk2SbiLib/RiscVEdk2SbiLib.inf
create mode 100644 Silicon/RISC-V/ProcessorPkg/Library/RiscVOpensbiLib/RiscVOpensbiLib.inf
create mode 100644 Silicon/RISC-V/ProcessorPkg/Include/IndustryStandard/RiscVOpensbi.h
create mode 100644 Silicon/RISC-V/ProcessorPkg/Include/Library/RiscVEdk2SbiLib.h
create mode 100644 Silicon/RISC-V/ProcessorPkg/Include/OpensbiTypes.h
create mode 100644 Silicon/RISC-V/ProcessorPkg/Library/RiscVEdk2SbiLib/RiscVEdk2SbiLib.c
create mode 100644 .gitmodules
create mode 160000 Silicon/RISC-V/ProcessorPkg/Library/RiscVOpensbiLib/opensbi

[edk2-devel] [PATCH v2 0/3] New RISC-V Patches

Posted by Daniel Schaefer 1 week ago
In this updated version I addressed Leif's comments and made the following
changes:

- Refactor sbi_call* to SbiCall* (EDKII style)
- Use OpenSBI constants if possible
- Include Base.h in OpensbiTypes.h
- Only use __builtin_expect with Clang and GCC (not MSVC)

I'm sorry, I hadn't explained the new branches properly.
Previously we had all code going to EDK2 via the RISC-V-V2 branch.

Now we're only making the least amount of necessary changes in edk2 and
everything else in edk2-platforms.
Those changes to edk2 can be grouped into different categories:

- Patches for RISC-V EDK2 CI enablement
- Patches for edk2 modules other than RISC-V ones, to allow building them with the RISC-V toolchain
- Other RISC-V enablement like PE/COFF relocation

Those have all been reviewed and merged to edk2 master.

Previously we had two packages just for RISC-V on our edk2 branch:
  RiscVPkg and RiscVPlatformPkg
They are now under
  Platform/RISC-V/PlatformPkg and Silicon/RISC-V/ProcessorPkg
in edk2-platforms.
You, Leif, have previously reviewed those. In addition to this old code, which
was moved, we need some more patches to allow running PEI in S-Mode and
building in edk2-platforms. That's what this patch series is about.

In the previous version of this patchseries I forgot to attach the biggest new
commit, which adds RiscVEdk2SbiLib. It wraps the ecall interface for calling
SBI in a C API and lets PEI and DXE call SBI interfaces. Because we need more
M-Mode capabilities in PEI and DXE than SBI gives us, we register another SBI
extension, that gives us access to the mscratch register.

I hope now it makes more sense.

- Daniel

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>

Abner Chang (1):
  ProcessorPkg/Library: Add RiscVOpensbiLib

Daniel Schaefer (2):
  ProcessorPkg/RiscVOpensbLib: Add opensbi submodule
  ProcessorPkg/Library: Add RiscVEdk2SbiLib

 Silicon/RISC-V/ProcessorPkg/Library/RiscVEdk2SbiLib/RiscVEdk2SbiLib.inf |  28 +
 Silicon/RISC-V/ProcessorPkg/Library/RiscVOpensbiLib/RiscVOpensbiLib.inf |  60 ++
 Silicon/RISC-V/ProcessorPkg/Include/IndustryStandard/RiscVOpensbi.h     |  72 ++
 Silicon/RISC-V/ProcessorPkg/Include/Library/RiscVEdk2SbiLib.h           | 631 ++++++++++++++++
 Silicon/RISC-V/ProcessorPkg/Include/OpensbiTypes.h                      |  73 ++
 Silicon/RISC-V/ProcessorPkg/Library/RiscVEdk2SbiLib/RiscVEdk2SbiLib.c   | 789 ++++++++++++++++++++
 .gitmodules                                                             |   3 +
 Readme.md                                                               |  36 +
 Silicon/RISC-V/ProcessorPkg/Library/RiscVOpensbiLib/opensbi             |   1 +
 9 files changed, 1693 insertions(+)
 create mode 100644 Silicon/RISC-V/ProcessorPkg/Library/RiscVEdk2SbiLib/RiscVEdk2SbiLib.inf
 create mode 100644 Silicon/RISC-V/ProcessorPkg/Library/RiscVOpensbiLib/RiscVOpensbiLib.inf
 create mode 100644 Silicon/RISC-V/ProcessorPkg/Include/IndustryStandard/RiscVOpensbi.h
 create mode 100644 Silicon/RISC-V/ProcessorPkg/Include/Library/RiscVEdk2SbiLib.h
 create mode 100644 Silicon/RISC-V/ProcessorPkg/Include/OpensbiTypes.h
 create mode 100644 Silicon/RISC-V/ProcessorPkg/Library/RiscVEdk2SbiLib/RiscVEdk2SbiLib.c
 create mode 100644 .gitmodules
 create mode 160000 Silicon/RISC-V/ProcessorPkg/Library/RiscVOpensbiLib/opensbi

-- 
2.26.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#59682): https://edk2.groups.io/g/devel/message/59682
Mute This Topic: https://groups.io/mt/74227138/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-

Re: [edk2-devel] [PATCH v2 0/3] New RISC-V Patches

Posted by Leif Lindholm 4 days ago
On Fri, May 15, 2020 at 15:39:34 +0200, Daniel Schaefer wrote:
> In this updated version I addressed Leif's comments and made the following
> changes:
> 
> - Refactor sbi_call* to SbiCall* (EDKII style)
> - Use OpenSBI constants if possible
> - Include Base.h in OpensbiTypes.h
> - Only use __builtin_expect with Clang and GCC (not MSVC)
> 
> I'm sorry, I hadn't explained the new branches properly.
> Previously we had all code going to EDK2 via the RISC-V-V2 branch.
> 
> Now we're only making the least amount of necessary changes in edk2 and
> everything else in edk2-platforms.
> Those changes to edk2 can be grouped into different categories:
> 
> - Patches for RISC-V EDK2 CI enablement
> - Patches for edk2 modules other than RISC-V ones, to allow building them with the RISC-V toolchain
> - Other RISC-V enablement like PE/COFF relocation
> 
> Those have all been reviewed and merged to edk2 master.
> 
> Previously we had two packages just for RISC-V on our edk2 branch:
>   RiscVPkg and RiscVPlatformPkg
> They are now under
>   Platform/RISC-V/PlatformPkg and Silicon/RISC-V/ProcessorPkg
> in edk2-platforms.

Understood. I took my eye off the ball there for a while, but I'm a
bit confused as to why RiscVPkg isn't going into EDK2. That is very
counterintuitive. And clearly it will need revisiting if we are to add
first-class CI checks like those we do with OvmfPkg/ArmVirtPkg.

> You, Leif, have previously reviewed those. In addition to this old code, which
> was moved, we need some more patches to allow running PEI in S-Mode and
> building in edk2-platforms. That's what this patch series is about.

I *did* have some outstanding comments specifically with regards to
large amounts of code duplication between the SMBIOS implementation of
some closely related RISC-V platforms. That now needs to be revisited.

> In the previous version of this patchseries I forgot to attach the biggest new
> commit, which adds RiscVEdk2SbiLib. It wraps the ecall interface for calling
> SBI in a C API and lets PEI and DXE call SBI interfaces. Because we need more
> M-Mode capabilities in PEI and DXE than SBI gives us, we register another SBI
> extension, that gives us access to the mscratch register.

Without looking at it yet, it sounds like that may resolve the only
remaining major issue I had with RiscVPkg.

> I hope now it makes more sense.

It is more clear, as per above I am not sure it makes more sense :)
Thanks!

Best Regards,

Leif

> - Daniel
> 
> 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>
> 
> Abner Chang (1):
>   ProcessorPkg/Library: Add RiscVOpensbiLib
> 
> Daniel Schaefer (2):
>   ProcessorPkg/RiscVOpensbLib: Add opensbi submodule
>   ProcessorPkg/Library: Add RiscVEdk2SbiLib
> 
>  Silicon/RISC-V/ProcessorPkg/Library/RiscVEdk2SbiLib/RiscVEdk2SbiLib.inf |  28 +
>  Silicon/RISC-V/ProcessorPkg/Library/RiscVOpensbiLib/RiscVOpensbiLib.inf |  60 ++
>  Silicon/RISC-V/ProcessorPkg/Include/IndustryStandard/RiscVOpensbi.h     |  72 ++
>  Silicon/RISC-V/ProcessorPkg/Include/Library/RiscVEdk2SbiLib.h           | 631 ++++++++++++++++
>  Silicon/RISC-V/ProcessorPkg/Include/OpensbiTypes.h                      |  73 ++
>  Silicon/RISC-V/ProcessorPkg/Library/RiscVEdk2SbiLib/RiscVEdk2SbiLib.c   | 789 ++++++++++++++++++++
>  .gitmodules                                                             |   3 +
>  Readme.md                                                               |  36 +
>  Silicon/RISC-V/ProcessorPkg/Library/RiscVOpensbiLib/opensbi             |   1 +
>  9 files changed, 1693 insertions(+)
>  create mode 100644 Silicon/RISC-V/ProcessorPkg/Library/RiscVEdk2SbiLib/RiscVEdk2SbiLib.inf
>  create mode 100644 Silicon/RISC-V/ProcessorPkg/Library/RiscVOpensbiLib/RiscVOpensbiLib.inf
>  create mode 100644 Silicon/RISC-V/ProcessorPkg/Include/IndustryStandard/RiscVOpensbi.h
>  create mode 100644 Silicon/RISC-V/ProcessorPkg/Include/Library/RiscVEdk2SbiLib.h
>  create mode 100644 Silicon/RISC-V/ProcessorPkg/Include/OpensbiTypes.h
>  create mode 100644 Silicon/RISC-V/ProcessorPkg/Library/RiscVEdk2SbiLib/RiscVEdk2SbiLib.c
>  create mode 100644 .gitmodules
>  create mode 160000 Silicon/RISC-V/ProcessorPkg/Library/RiscVOpensbiLib/opensbi
> 
> -- 
> 2.26.1
> 
> 
> 
> 

-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#59960): https://edk2.groups.io/g/devel/message/59960
Mute This Topic: https://groups.io/mt/74227138/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-

Re: [edk2-devel] [PATCH v2 0/3] New RISC-V Patches - Why in edk2-platforms

Posted by Daniel Schaefer 4 days ago
On 5/20/20 1:43 PM, Leif Lindholm wrote:
> On Fri, May 15, 2020 at 15:39:34 +0200, Daniel Schaefer wrote:
>> Previously we had two packages just for RISC-V on our edk2 branch:
>>    RiscVPkg and RiscVPlatformPkg
>> They are now under
>>    Platform/RISC-V/PlatformPkg and Silicon/RISC-V/ProcessorPkg
>> in edk2-platforms.
> 
> Understood. I took my eye off the ball there for a while, but I'm a
> bit confused as to why RiscVPkg isn't going into EDK2. That is very
> counterintuitive. And clearly it will need revisiting if we are to add
> first-class CI checks like those we do with OvmfPkg/ArmVirtPkg.

Yes, I understand your concern. Personally I'd like it also to be in 
EDK2 straight away, however Mike, Bret and Sean have raised valid concerns:

1. RISC-V is very new and potentially unstable - it's quicker to make 
changes in edk2-platforms.

2. If we define new interfaces and libraries in edk2, we can't remove 
them easily because it would be a backwards-incompatible change. 
edk2-platforms isn't quite as strict.

3. Long-term, I think many agree, we should aim to move much of the 
RISC-V code into UefiCpuPkg and OvmfPkg. Mike mentioned that would need 
coordination with ARM maintainers because it might make sense to move 
their code there as well.

Maybe Mike, Bret or Sean would like to provide some more comments?

> I *did* have some outstanding comments specifically with regards to
> large amounts of code duplication between the SMBIOS implementation of
> some closely related RISC-V platforms. That now needs to be revisited.

The SMBIOS code hasn't changed. It has moved to
   Silicon/SiFive/{E51,U54,U54MCCoreplex}/Library/PeiCoreInfoHobLib
You're referring to this library, right?

They build the SMBIOS entries for a particular processor. Yes, the 
values do have a lot of overlap but these files are like configuration 
files. They don't do much, they only set the values of the properties.

Currently it is not possible to let the UEFI firmware get this 
information from the hardware at runtime, especially now, since we're 
running in S-Mode.
To allow that, we created a RISC-V working group to be able to retrieve 
all of this information dynamically from the processor (among other 
goals). Then the vendor will not have to modify these files and hardcode 
the values anymore. Which enables us to create a single library for all 
processors.
See: https://github.com/riscv/configuration-structure

I hope I described everything properly, please correct me otherwise, Abner.

> 
>> In the previous version of this patchseries I forgot to attach the biggest new
>> commit, which adds RiscVEdk2SbiLib. It wraps the ecall interface for calling
>> SBI in a C API and lets PEI and DXE call SBI interfaces. Because we need more
>> M-Mode capabilities in PEI and DXE than SBI gives us, we register another SBI
>> extension, that gives us access to the mscratch register.
> 
> Without looking at it yet, it sounds like that may resolve the only
> remaining major issue I had with RiscVPkg.
> 
>> I hope now it makes more sense.
> 
> It is more clear, as per above I am not sure it makes more sense :)
> Thanks!

Your concerns are very valid, however due to the mentioned trade-offs it 
might not make sense to address them.

- Daniel

-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#59973): https://edk2.groups.io/g/devel/message/59973
Mute This Topic: https://groups.io/mt/74353494/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-

Re: [edk2-devel] [PATCH v2 0/3] New RISC-V Patches - Why in edk2-platforms

Posted by Daniel Schaefer 4 days ago
please reply here, fixed Mike's email address, sorry...

On 5/20/20 6:03 PM, Daniel Schaefer wrote:
> On 5/20/20 1:43 PM, Leif Lindholm wrote:
>> On Fri, May 15, 2020 at 15:39:34 +0200, Daniel Schaefer wrote:
>>> Previously we had two packages just for RISC-V on our edk2 branch:
>>>    RiscVPkg and RiscVPlatformPkg
>>> They are now under
>>>    Platform/RISC-V/PlatformPkg and Silicon/RISC-V/ProcessorPkg
>>> in edk2-platforms.
>>
>> Understood. I took my eye off the ball there for a while, but I'm a
>> bit confused as to why RiscVPkg isn't going into EDK2. That is very
>> counterintuitive. And clearly it will need revisiting if we are to add
>> first-class CI checks like those we do with OvmfPkg/ArmVirtPkg.
> 
> Yes, I understand your concern. Personally I'd like it also to be in 
> EDK2 straight away, however Mike, Bret and Sean have raised valid concerns:
> 
> 1. RISC-V is very new and potentially unstable - it's quicker to make 
> changes in edk2-platforms.
> 
> 2. If we define new interfaces and libraries in edk2, we can't remove 
> them easily because it would be a backwards-incompatible change. 
> edk2-platforms isn't quite as strict.
> 
> 3. Long-term, I think many agree, we should aim to move much of the 
> RISC-V code into UefiCpuPkg and OvmfPkg. Mike mentioned that would need 
> coordination with ARM maintainers because it might make sense to move 
> their code there as well.
> 
> Maybe Mike, Bret or Sean would like to provide some more comments?
> 
>> I *did* have some outstanding comments specifically with regards to
>> large amounts of code duplication between the SMBIOS implementation of
>> some closely related RISC-V platforms. That now needs to be revisited.
> 
> The SMBIOS code hasn't changed. It has moved to
>    Silicon/SiFive/{E51,U54,U54MCCoreplex}/Library/PeiCoreInfoHobLib
> You're referring to this library, right?
> 
> They build the SMBIOS entries for a particular processor. Yes, the 
> values do have a lot of overlap but these files are like configuration 
> files. They don't do much, they only set the values of the properties.
> 
> Currently it is not possible to let the UEFI firmware get this 
> information from the hardware at runtime, especially now, since we're 
> running in S-Mode.
> To allow that, we created a RISC-V working group to be able to retrieve 
> all of this information dynamically from the processor (among other 
> goals). Then the vendor will not have to modify these files and hardcode 
> the values anymore. Which enables us to create a single library for all 
> processors.
> See: https://github.com/riscv/configuration-structure
> 
> I hope I described everything properly, please correct me otherwise, Abner.
> 
>>
>>> In the previous version of this patchseries I forgot to attach the 
>>> biggest new
>>> commit, which adds RiscVEdk2SbiLib. It wraps the ecall interface for 
>>> calling
>>> SBI in a C API and lets PEI and DXE call SBI interfaces. Because we 
>>> need more
>>> M-Mode capabilities in PEI and DXE than SBI gives us, we register 
>>> another SBI
>>> extension, that gives us access to the mscratch register.
>>
>> Without looking at it yet, it sounds like that may resolve the only
>> remaining major issue I had with RiscVPkg.
>>
>>> I hope now it makes more sense.
>>
>> It is more clear, as per above I am not sure it makes more sense :)
>> Thanks!
> 
> Your concerns are very valid, however due to the mentioned trade-offs it 
> might not make sense to address them.
> 
> - Daniel

-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#59974): https://edk2.groups.io/g/devel/message/59974
Mute This Topic: https://groups.io/mt/74353494/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-

Re: [edk2-devel] [PATCH v2 0/3] New RISC-V Patches - Why in edk2-platforms

Posted by Daniel Schaefer 4 days ago

On 5/20/20 6:07 PM, Daniel Schaefer wrote:
> please reply here, fixed Mike's email address, sorry...
> 
> On 5/20/20 6:03 PM, Daniel Schaefer wrote:
>> On 5/20/20 1:43 PM, Leif Lindholm wrote:
>>> On Fri, May 15, 2020 at 15:39:34 +0200, Daniel Schaefer wrote:
>>>> Previously we had two packages just for RISC-V on our edk2 branch:
>>>>    RiscVPkg and RiscVPlatformPkg
>>>> They are now under
>>>>    Platform/RISC-V/PlatformPkg and Silicon/RISC-V/ProcessorPkg
>>>> in edk2-platforms.
>>>
>>> Understood. I took my eye off the ball there for a while, but I'm a
>>> bit confused as to why RiscVPkg isn't going into EDK2. That is very
>>> counterintuitive. And clearly it will need revisiting if we are to add
>>> first-class CI checks like those we do with OvmfPkg/ArmVirtPkg.
>>
>> Yes, I understand your concern. Personally I'd like it also to be in 
>> EDK2 straight away, however Mike, Bret and Sean have raised valid 
>> concerns:
>>
>> 1. RISC-V is very new and potentially unstable - it's quicker to make 
>> changes in edk2-platforms.
>>
>> 2. If we define new interfaces and libraries in edk2, we can't remove 
>> them easily because it would be a backwards-incompatible change. 
>> edk2-platforms isn't quite as strict.
>>
>> 3. Long-term, I think many agree, we should aim to move much of the 
>> RISC-V code into UefiCpuPkg and OvmfPkg. Mike mentioned that would 
>> need coordination with ARM maintainers because it might make sense to 
>> move their code there as well.
>>
>> Maybe Mike, Bret or Sean would like to provide some more comments?
>>
>>> I *did* have some outstanding comments specifically with regards to
>>> large amounts of code duplication between the SMBIOS implementation of
>>> some closely related RISC-V platforms. That now needs to be revisited.
>>
>> The SMBIOS code hasn't changed. It has moved to
>>    Silicon/SiFive/{E51,U54,U54MCCoreplex}/Library/PeiCoreInfoHobLib
>> You're referring to this library, right?
>>
>> They build the SMBIOS entries for a particular processor. Yes, the 
>> values do have a lot of overlap but these files are like configuration 
>> files. They don't do much, they only set the values of the properties.
>>
>> Currently it is not possible to let the UEFI firmware get this 
>> information from the hardware at runtime, especially now, since we're 
>> running in S-Mode.
>> To allow that, we created a RISC-V working group to be able to 
>> retrieve all of this information dynamically from the processor (among 
>> other goals). Then the vendor will not have to modify these files and 
>> hardcode the values anymore. Which enables us to create a single 
>> library for all processors.
>> See: https://github.com/riscv/configuration-structure
>>
>> I hope I described everything properly, please correct me otherwise, 
>> Abner.
>>
>>>
>>>> In the previous version of this patchseries I forgot to attach the 
>>>> biggest new
>>>> commit, which adds RiscVEdk2SbiLib. It wraps the ecall interface for 
>>>> calling
>>>> SBI in a C API and lets PEI and DXE call SBI interfaces. Because we 
>>>> need more
>>>> M-Mode capabilities in PEI and DXE than SBI gives us, we register 
>>>> another SBI
>>>> extension, that gives us access to the mscratch register.
>>>
>>> Without looking at it yet, it sounds like that may resolve the only
>>> remaining major issue I had with RiscVPkg.
>>>
>>>> I hope now it makes more sense.
>>>
>>> It is more clear, as per above I am not sure it makes more sense :)
>>> Thanks!
>>
>> Your concerns are very valid, however due to the mentioned trade-offs 
>> it might not make sense to address them.
>>
>> - Daniel

-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#59975): https://edk2.groups.io/g/devel/message/59975
Mute This Topic: https://groups.io/mt/74353494/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-

Re: [edk2-devel] [PATCH v2 0/3] New RISC-V Patches - Why in edk2-platforms

Posted by Abner Chang 4 days ago

> -----Original Message-----
> From: Schaefer, Daniel (DualStudy)
> Sent: Thursday, May 21, 2020 12:18 AM
> To: Leif Lindholm <leif@nuviainc.com>; devel@edk2.groups.io
> Cc: Chang, Abner (HPS SW/FW Technologist) <abner.chang@hpe.com>;
> Chen, Gilbert <gilbert.chen@hpe.com>; Kinney, Michael D
> <michael.d.kinney@intel.com>; Bret.Barkelew@microsoft.com;
> sean.brogan@microsoft.com
> Subject: Re: [edk2-devel] [PATCH v2 0/3] New RISC-V Patches - Why in edk2-
> platforms
> 
> 
> 
> On 5/20/20 6:07 PM, Daniel Schaefer wrote:
> > please reply here, fixed Mike's email address, sorry...
> >
> > On 5/20/20 6:03 PM, Daniel Schaefer wrote:
> >> On 5/20/20 1:43 PM, Leif Lindholm wrote:
> >>> On Fri, May 15, 2020 at 15:39:34 +0200, Daniel Schaefer wrote:
> >>>> Previously we had two packages just for RISC-V on our edk2 branch:
> >>>>    RiscVPkg and RiscVPlatformPkg
> >>>> They are now under
> >>>>    Platform/RISC-V/PlatformPkg and Silicon/RISC-V/ProcessorPkg in
> >>>> edk2-platforms.
> >>>
> >>> Understood. I took my eye off the ball there for a while, but I'm a
> >>> bit confused as to why RiscVPkg isn't going into EDK2. That is very
> >>> counterintuitive. And clearly it will need revisiting if we are to
> >>> add first-class CI checks like those we do with OvmfPkg/ArmVirtPkg.
> >>
> >> Yes, I understand your concern. Personally I'd like it also to be in
> >> EDK2 straight away, however Mike, Bret and Sean have raised valid
> >> concerns:
> >>
> >> 1. RISC-V is very new and potentially unstable - it's quicker to make
> >> changes in edk2-platforms.
> >>
> >> 2. If we define new interfaces and libraries in edk2, we can't remove
> >> them easily because it would be a backwards-incompatible change.
> >> edk2-platforms isn't quite as strict.
> >>
> >> 3. Long-term, I think many agree, we should aim to move much of the
> >> RISC-V code into UefiCpuPkg and OvmfPkg. Mike mentioned that would
> >> need coordination with ARM maintainers because it might make sense to
> >> move their code there as well.
> >>
> >> Maybe Mike, Bret or Sean would like to provide some more comments?
> >>
> >>> I *did* have some outstanding comments specifically with regards to
> >>> large amounts of code duplication between the SMBIOS implementation
> >>> of some closely related RISC-V platforms. That now needs to be revisited.
> >>
> >> The SMBIOS code hasn't changed. It has moved to
> >>    Silicon/SiFive/{E51,U54,U54MCCoreplex}/Library/PeiCoreInfoHobLib
> >> You're referring to this library, right?
> >>
> >> They build the SMBIOS entries for a particular processor. Yes, the
> >> values do have a lot of overlap but these files are like
> >> configuration files. They don't do much, they only set the values of the
> properties.
> >>
> >> Currently it is not possible to let the UEFI firmware get this
> >> information from the hardware at runtime, especially now, since we're
> >> running in S-Mode.
> >> To allow that, we created a RISC-V working group to be able to
> >> retrieve all of this information dynamically from the processor
> >> (among other goals). Then the vendor will not have to modify these
> >> files and hardcode the values anymore. Which enables us to create a
> >> single library for all processors.
> >> See: https://github.com/riscv/configuration-structure
> >>
> >> I hope I described everything properly, please correct me otherwise,
> >> Abner.
[Abner]  Yes almost. Thanks Daniel.
One thing I would like to add,
If you take a look on SiFive Core IP https://www.sifive.com/risc-v-core-ip you can see there are different SKUs of RISC-V core. Just take some as example,
S51 - Single core
U54 - Single core
S76 - Single core
U74- single core
U54-MC - Multicore which is 4*U54 cores +1*S51 core
U74-MC - Multicore which is 4*U74 core + 1*S7 core

Those are the combinations of core IP. Silicon vendor can get those core IPs and combine them to the RISC-V processor. To have CoreInfoHobLib libraries for each different core (not multicore) to build up the core capability is reasonable and makes sense. For the multicore, it just pulling the single core CoreInfoHobLib to build up the SMBIOS table for the multicore processor. Those libraries look duplicate in logically, however only one instance of CoreInfoHobLib is built in for multiple identical cores in physically view. Maybe we still can move some identical core into the core-specific library but it is not worthwhile.

Abner

> >>
> >>>
> >>>> In the previous version of this patchseries I forgot to attach the
> >>>> biggest new commit, which adds RiscVEdk2SbiLib. It wraps the ecall
> >>>> interface for calling SBI in a C API and lets PEI and DXE call SBI
> >>>> interfaces. Because we need more M-Mode capabilities in PEI and DXE
> >>>> than SBI gives us, we register another SBI extension, that gives us
> >>>> access to the mscratch register.
> >>>
> >>> Without looking at it yet, it sounds like that may resolve the only
> >>> remaining major issue I had with RiscVPkg.
> >>>
> >>>> I hope now it makes more sense.
> >>>
> >>> It is more clear, as per above I am not sure it makes more sense :)
> >>> Thanks!
> >>
> >> Your concerns are very valid, however due to the mentioned trade-offs
> >> it might not make sense to address them.
> >>
> >> - Daniel

-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#60012): https://edk2.groups.io/g/devel/message/60012
Mute This Topic: https://groups.io/mt/74353494/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-