public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "\"vicshuang(黄松) via groups.io" <vicshuang=tencent.com@groups.io>
To: devel <devel@edk2.groups.io>
Subject: [edk2-devel] A bug in the use of timer was discovered during the RISC-V adaptation process
Date: Mon, 4 Mar 2024 10:36:15 +0800	[thread overview]
Message-ID: <tencent_7E22CD7C6F42EF9C6096CB5E@qq.com> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 829 bytes --]

Hello:


&nbsp;


In the process of using UEFI EDK2 to adapt to RISC-V, we referred to SIFIVE's adaptation method.&nbsp;


&nbsp; &nbsp; However, during the debugging process, we found that there was an issue with inaccurate timer operation. This problem also existed in the package that targeted SIFIVE, so we wanted to submit it. patch to fix this problem.


&nbsp; &nbsp; The relevant patches are in the attachment.







发自我的企业微信

-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#116335): https://edk2.groups.io/g/devel/message/116335
Mute This Topic: https://groups.io/mt/104727456/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



[-- Attachment #1.2: Type: text/html, Size: 5003 bytes --]

[-- Attachment #2: 0001-fix-Fixed-incorrect-Timer-timing-in-RISC-V.patch --]
[-- Type: application/octet-stream, Size: 1959 bytes --]

From bfe08a688b9074b507e962982f373f88fa16ac5a Mon Sep 17 00:00:00 2001
From: vicshuang <vicshuang@tencent.com>
Date: Fri, 1 Mar 2024 16:30:53 +0800
Subject: [PATCH] fix:Fixed incorrect Timer timing in RISC-V The current code
 has the problem of inaccurate Timer timing. The main reason is that the
 PcdCpuCoreCrystalClockFrequency variable required by the
 BaseRiscV64CpuTimerLib.inf library used by the system is not assigned a value
 in the file.

    Cc: Bin Fan <tombinfan@tencent.com>
    Cc: Lingheng Du <dylanlhdu@tencent.com>
    Signed-off-by: Song Huang  <vicshuang@tencent.com>
---
 .../U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U540.fdf.inc  | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U540.fdf.inc b/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U540.fdf.inc
index 404c0b71ca..d7115f3eba 100644
--- a/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U540.fdf.inc
+++ b/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U540.fdf.inc
@@ -3,6 +3,8 @@
 #
 #  Copyright (c) 2021, Hewlett Packard Enterprise Development LP. All rights reserved.<BR>
 #
+#  Copyright (c) 2024, Tencent. All rights reserved.<BR>
+#
 #  SPDX-License-Identifier: BSD-2-Clause-Patent
 #
 ##
@@ -87,7 +89,7 @@ SET gUefiRiscVPlatformPkgTokenSpaceGuid.PcdScratchRamSize   = $(SCRATCH_SIZE)
 SET gUefiRiscVPlatformPkgTokenSpaceGuid.PcdTemporaryRamBase = $(CODE_BASE_ADDRESS) + $(FW_SIZE)
 SET gUefiRiscVPlatformPkgTokenSpaceGuid.PcdTemporaryRamSize = 0x10000
 
-
+SET gUefiCpuPkgTokenSpaceGuid.PcdCpuCoreCrystalClockFrequency    = 1000000
 SET gUefiRiscVPkgTokenSpaceGuid.PcdRiscVMachineTimerFrequencyInHerz    = 1000000
 SET gSiFiveU5SeriesPlatformsPkgTokenSpaceGuid.PcdU5PlatformSystemClock = 1000000000 # 1GHz system clock
 SET gUefiRiscVPlatformPkgTokenSpaceGuid.PcdBootHartId                  = 1          # Boot hart ID
-- 
2.34.1


             reply	other threads:[~2024-03-04 17:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-04  2:36 "vicshuang(黄松) via groups.io [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-03-04  8:57 [edk2-devel] A bug in the use of timer was discovered during the RISC-V adaptation process "vicshuang(黄松) via groups.io

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=tencent_7E22CD7C6F42EF9C6096CB5E@qq.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