[edk2-devel] [PATCH] UefiCpuPkg: CpuTimerDxeRiscV64: Fix timer event not working correctly

Tuan Phan posted 1 patch 10 months, 1 week ago
Failed in applying to current master (apply log)
UefiCpuPkg/CpuTimerDxeRiscV64/Timer.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
[edk2-devel] [PATCH] UefiCpuPkg: CpuTimerDxeRiscV64: Fix timer event not working correctly
Posted by Tuan Phan 10 months, 1 week ago
The timer notify function should be called with timer period, not the
value read from timer register.

Signed-off-by: Tuan Phan <tphan@ventanamicro.com>
---
 UefiCpuPkg/CpuTimerDxeRiscV64/Timer.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/UefiCpuPkg/CpuTimerDxeRiscV64/Timer.c b/UefiCpuPkg/CpuTimerDxeRiscV64/Timer.c
index 358057e7c6a4..30e48061cd06 100644
--- a/UefiCpuPkg/CpuTimerDxeRiscV64/Timer.c
+++ b/UefiCpuPkg/CpuTimerDxeRiscV64/Timer.c
@@ -9,6 +9,7 @@
 
 #include <Library/BaseLib.h>
 #include <Library/BaseRiscVSbiLib.h>
+#include <Library/UefiLib.h>
 #include "Timer.h"
 
 //
@@ -71,7 +72,12 @@ TimerInterruptHandler (
     // time to increment slower. So when we take an interrupt,
     // account for the actual time passed.
     //
-    mTimerNotifyFunction (PeriodStart - mLastPeriodStart);
+    mTimerNotifyFunction (
+      DivU64x32 (
+        EFI_TIMER_PERIOD_SECONDS (PeriodStart - mLastPeriodStart),
+        PcdGet64 (PcdCpuCoreCrystalClockFrequency)
+        )
+      );
   }
 
   if (mTimerPeriod == 0) {
-- 
2.25.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#106452): https://edk2.groups.io/g/devel/message/106452
Mute This Topic: https://groups.io/mt/99822131/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [PATCH] UefiCpuPkg: CpuTimerDxeRiscV64: Fix timer event not working correctly
Posted by Sunil V L 10 months, 1 week ago
On Tue, Jun 27, 2023 at 06:15:57PM -0700, Tuan Phan wrote:
> The timer notify function should be called with timer period, not the
> value read from timer register.
> 
> Signed-off-by: Tuan Phan <tphan@ventanamicro.com>
> ---

LGTM.

Reviewed-by: Sunil V L <sunilvl@ventanamicro.com>

Thanks!
Sunil


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#106471): https://edk2.groups.io/g/devel/message/106471
Mute This Topic: https://groups.io/mt/99822131/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [PATCH] UefiCpuPkg: CpuTimerDxeRiscV64: Fix timer event not working correctly
Posted by Tuan Phan 10 months, 1 week ago
Thanks Sunil,
Updated pull request: https://github.com/tianocore/edk2/pull/4585
Please help merge it if no objection.

Thanks,

From: Sunil V L <sunilvl@ventanamicro.com>
Date: Wednesday, June 28, 2023 at 7:43 AM
To: Tuan Phan <tphan@ventanamicro.com>
Cc: devel@edk2.groups.io <devel@edk2.groups.io>, andrei.warkentin@intel.com <andrei.warkentin@intel.com>
Subject: Re: [PATCH] UefiCpuPkg: CpuTimerDxeRiscV64: Fix timer event not working correctly
On Tue, Jun 27, 2023 at 06:15:57PM -0700, Tuan Phan wrote:
> The timer notify function should be called with timer period, not the
> value read from timer register.
>
> Signed-off-by: Tuan Phan <tphan@ventanamicro.com>
> ---

LGTM.

Reviewed-by: Sunil V L <sunilvl@ventanamicro.com>

Thanks!
Sunil


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#106486): https://edk2.groups.io/g/devel/message/106486
Mute This Topic: https://groups.io/mt/99822131/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-