Re: [edk2-devel] [PATCH 0/4] RISC-V: Add support for Sstc extension

2024-01-07 Thread Sunil V L
Hi Pedro,

On Fri, Jan 05, 2024 at 07:10:40PM +, Pedro Falcato wrote:
> On Wed, Jan 3, 2024 at 1:59 PM Sunil V L  wrote:
> >
> > This series adds the support for RISV-V Sstc extension in EDK2 timer
> 
> nit: RISC-V
> > implementation. Sstc extension allows S-mode software to program the
> > timer directly without using SBI calls.
> >
> > Currently, PCD variable is used to detect whether feature is enabled. By
> > default the feature is enabled and platforms need to set the PCD to
> > disable the feature if Sstc is not supported.
> >
> > For RiscVVirtQemu, it is disabled by default (until extension discovery
> > feature is enabled).
> 
> I'm curious, what do you want Sstc for? Is the performance difference
> measurable (if so, please post numbers, and add them to the commit)?
> Does it have any other advantages?
> 
Good question.

Without Sstc, timer needs to be programmed using SBI call. The number of
instructions via SBI call is way more than a simple CSR access. So, when
the CPU supports Sstc, there is no point in using SBI call. The issue
with SBI call will be worse under KVM since it has to emulate the timer.

Supporting Sstc is futuristic. The platforms can decide not to implement
SBI TIME interface at all since they have Sstc. In that case, EDK2 needs
to have option to support either.

Thanks,
Sunil


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#113353): https://edk2.groups.io/g/devel/message/113353
Mute This Topic: https://groups.io/mt/103501836/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH 0/4] RISC-V: Add support for Sstc extension

2024-01-05 Thread Pedro Falcato
On Wed, Jan 3, 2024 at 1:59 PM Sunil V L  wrote:
>
> This series adds the support for RISV-V Sstc extension in EDK2 timer

nit: RISC-V
> implementation. Sstc extension allows S-mode software to program the
> timer directly without using SBI calls.
>
> Currently, PCD variable is used to detect whether feature is enabled. By
> default the feature is enabled and platforms need to set the PCD to
> disable the feature if Sstc is not supported.
>
> For RiscVVirtQemu, it is disabled by default (until extension discovery
> feature is enabled).

I'm curious, what do you want Sstc for? Is the performance difference
measurable (if so, please post numbers, and add them to the commit)?
Does it have any other advantages?

-- 
Pedro


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#113315): https://edk2.groups.io/g/devel/message/113315
Mute This Topic: https://groups.io/mt/103501836/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH 0/4] RISC-V: Add support for Sstc extension

2024-01-03 Thread Sunil V L
This series adds the support for RISV-V Sstc extension in EDK2 timer
implementation. Sstc extension allows S-mode software to program the
timer directly without using SBI calls.

Currently, PCD variable is used to detect whether feature is enabled. By
default the feature is enabled and platforms need to set the PCD to
disable the feature if Sstc is not supported.

For RiscVVirtQemu, it is disabled by default (until extension discovery
feature is enabled).

Cc: Andrei Warkentin 
Cc: Ard Biesheuvel 
Cc: Gerd Hoffmann 
Cc: Jiewen Yao 
Cc: Laszlo Ersek 
Cc: Rahul Kumar 
Cc: Ray Ni 
Cc: Michael D Kinney 
Cc: Liming Gao 
Cc: Zhiguang Liu 

Sunil V L (4):
  MdePkg.dec: RISC-V: Define override bit for Sstc extension
  MdePkg/BaseLib: RISC-V: Add function to update stimecmp register
  UefiCpuPkg/CpuTimerDxeRiscV64: Add support for Sstc
  OvmfPkg/RiscVVirt: Override Sstc extension

 MdePkg/MdePkg.dec |  2 ++
 OvmfPkg/RiscVVirt/RiscVVirt.dsc.inc   |  2 +-
 .../CpuTimerDxeRiscV64/CpuTimerDxeRiscV64.inf |  1 +
 MdePkg/Include/Library/BaseLib.h  |  5 
 .../Include/Register/RiscV64/RiscVEncoding.h  |  3 ++
 UefiCpuPkg/CpuTimerDxeRiscV64/Timer.h |  2 ++
 UefiCpuPkg/CpuTimerDxeRiscV64/Timer.c | 30 +--
 MdePkg/Library/BaseLib/RiscV64/ReadTimer.S|  7 +
 8 files changed, 49 insertions(+), 3 deletions(-)

-- 
2.34.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#113092): https://edk2.groups.io/g/devel/message/113092
Mute This Topic: https://groups.io/mt/103501836/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-