From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id 2040DAC02DF for ; Fri, 15 Mar 2024 06:37:53 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=UlOhvVa0UK+V492rCYteUHLGewdGCkCQwQIRKJN0cLQ=; c=relaxed/simple; d=groups.io; h=Message-ID:Date:MIME-Version:User-Agent:Subject:To:Cc:References:From:In-Reply-To:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Resent-Date:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Type; s=20240206; t=1710484672; v=1; b=G6NO1T/6b1giO+SaablpXnvob6laxFvkPSMvKPrwMpJUPbVqWQSypKSalrtKlTByYbqHbxGk 7VnYx0W2vlRc8sUMphXRYeh9TjKcOMCdu9CaDMInp6op3SmPuPj4afcrpYsee5v74HNoog8Dult X1uVw4hL1YwnYuWOpcXnWRVhqnBVEwV3XaHApOqlqLkuAJ0Rznapr9alquutxSESA/9lF+PO6hH T1AIiNzh8ZTV4xOpVDPh/dSchNlZWglmdp2DgVqKZj+mQ3HOTS0qLVX4VEPqP0Xyb/Nd2WKurg6 39v+oPrAX89HZ3/fvFd9DigInzkR74ddhAr5o9lSdpFnQ== X-Received: by 127.0.0.2 with SMTP id 5yzSYY7687511xCub0m0Q8gP; Thu, 14 Mar 2024 23:37:52 -0700 X-Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by mx.groups.io with SMTP id smtpd.web10.14493.1710484670702050668 for ; Thu, 14 Mar 2024 23:37:51 -0700 X-Received: from loongson.cn (unknown [10.40.24.149]) by gateway (Coremail) with SMTP id _____8BxOPCv7PNlKGAZAA--.61802S3; Fri, 15 Mar 2024 14:37:35 +0800 (CST) X-Received: from [10.40.24.149] (unknown [10.40.24.149]) by localhost.localdomain (Coremail) with SMTP id AQAAf8AxDBOv7PNlC71aAA--.42054S3; Fri, 15 Mar 2024 14:37:35 +0800 (CST) Message-ID: Date: Fri, 15 Mar 2024 14:37:35 +0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [edk2-devel] [PATCH v1 05/26] UefiCpuPkg: Add LoongArch64 CPU Timer instance To: Gerd Hoffmann Cc: devel@edk2.groups.io, Ray Ni , Rahul Kumar References: <20240311093631.1251466-1-lichao@loongson.cn> <20240311093752.1253486-1-lichao@loongson.cn> From: "Chao Li" In-Reply-To: X-CM-TRANSID: AQAAf8AxDBOv7PNlC71aAA--.42054S3 X-CM-SenderInfo: xolfxt3r6o00pqjv00gofq/1tbiAQARCGXytWcN2wABsK X-Coremail-Antispam: 1Uk129KBj9xXoWrtFWfCr47uryDXw47Jr1kWFX_yoWkurb_Ga yfAF1xGw4UZF1kZFsxJr1vkr4I93yDAFWYqryUXw17KF9xAFWfu398CrW8Zry7XFyYvrWa va4rCFsxurWj9osvyTuYvTs0mTUanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUj1kv1TuYvT s0mT0YCTnIWjDUYxn0WfASr-VFAUDa7-sFnT9fnUUIcSsGvfJTRUUUbzkYFVCjjxCrM7AC 8VAFwI0_Jr0_Gr1l1xkIjI8I6I8E6xAIw20EY4v20xvaj40_Wr0E3s1l1IIY67AEw4v_Jr I_Jryl8cAvFVAK0II2c7xJM28CjxkF64kEwVA0rcxSw2x7M28EF7xvwVC0I7IYx2IY67AK xVW8JVW5JwA2z4x0Y4vE2Ix0cI8IcVCY1x0267AKxVW8JVWxJwA2z4x0Y4vEx4A2jsIE14 v26r4UJVWxJr1l84ACjcxK6I8E87Iv6xkF7I0E14v26r4UJVWxJr1le2I262IYc4CY6c8I j28IcVAaY2xG8wAqjxCEc2xF0cIa020Ex4CE44I27wAv7VC0I7IYx2IY67AKxVWUAVWUtw Av7VC2z280aVAFwI0_Gr0_Cr1lOx8S6xCaFVCjc4AY6r1j6r4UM4x0Y48IcVAKI48JMx8G jcxK6IxK0xIIj40E5I8CrwCF04k20xvY0x0EwIxGrwCFx2IqxVCFs4IE7xkEbVWUJVW8Jw C20s026c02F40E14v26r106r1rMI8I3I0E7480Y4vE14v26r106r1rMI8E67AF67kF1VAF wI0_JF0_Jw1lIxkGc2Ij64vIr41lIxAIcVC0I7IYx2IY67AKxVWUCVW8JwCI42IY6xIIjx v20xvEc7CjxVAFwI0_Jr0_Gr1lIxAIcVCF04k26cxKx2IYs7xG6r1j6r1xMIIF0xvEx4A2 jsIE14v26r4j6F4UMIIF0xvEx4A2jsIEc7CjxVAFwI0_Gr0_Gr1UYxBIdaVFxhVjvjDU0x ZFpf9x07j1T5dUUUUU= Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Resent-Date: Thu, 14 Mar 2024 23:37:51 -0700 Reply-To: devel@edk2.groups.io,lichao@loongson.cn List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: wi9LJ4BahzJjLsdOaxwYJaxXx7686176AA= Content-Type: multipart/alternative; boundary="------------x7FZs6ipqmqLwo2qxBAurR4F" X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20240206 header.b="G6NO1T/6"; dmarc=none; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io --------------x7FZs6ipqmqLwo2qxBAurR4F Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable Hi Gerd, This email was not send by EDK2 community, but other emails which you=20 send were by EDK2 community, I don't know what happened. Regardless,=20 I'll respond your question about this changes via this email. Here is my comments: Thanks, Chao On 2024/3/14 18:59, Gerd Hoffmann wrote: > Hi, > >> + if ((BaseFreq =3D=3D 0x0) || (ClockMultiplier =3D=3D 0x0) || (ClockDi= vide =3D=3D 0x0)) { >> + DEBUG (( >> + DEBUG_ERROR, >> + "LoongArch Stable Timer is not available in the CPU, hence this l= ibrary cannot be used.\n" >> + )); >> + ASSERT (FALSE); >> + CpuDeadLoop (); >> + } >> + >> + StableTimerFreq =3D ((ClockMultiplier * BaseFreq) / ClockDivide); >> + >> + if (StableTimerFreq =3D=3D 0x0) { >> + ASSERT (FALSE); >> + } > If you don't want to log a message (as in the case above) you can > simplify this to "ASSERT(StableTimerFreq !=3D 0);" Additional benefit > is that it'll give a more helpful log message. OK, I will adjust it next time. > >> + // >> + // Ticks >> + // Time =3D --------- x 1,000,000,000 >> + // Frequency >> + // >> + Status =3D SafeUint64Mult ( >> + DivU64x64Remainder (Ticks, Frequency, &Remainder), >> + 1000000000u, >> + &NanoSeconds >> + ); > Not checking Status here? Oh, I forget, I will add the checking stage next time, thank you! > > take care, > Gerd -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#116783): https://edk2.groups.io/g/devel/message/116783 Mute This Topic: https://groups.io/mt/104859876/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- --------------x7FZs6ipqmqLwo2qxBAurR4F Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable

Hi Gerd,

This email was not send by EDK2 community, but other emails which you send were by EDK2 community, I don't know what happened. Regardless, I'll respond your question about this changes via this email.

Here is my comments:


=
Thanks,
Chao
On 2024/3/14 18:59, Gerd Hoffmann wrote:
  Hi,

+  if ((BaseFreq =3D=3D 0x0)=
 || (ClockMultiplier =3D=3D 0x0) || (ClockDivide =3D=3D 0x0)) {
+    DEBUG ((
+      DEBUG_ERROR,
+      "LoongArch Stable Timer is not available in the CPU, hence this libr=
ary cannot be used.\n"
+      ));
+    ASSERT (FALSE);
+    CpuDeadLoop ();
+  }
+
+  StableTimerFreq =3D ((ClockMultiplier * BaseFreq) / ClockDivide);
+
+  if (StableTimerFreq =3D=3D 0x0) {
+    ASSERT (FALSE);
+  }
If you don't want to log a message (as in the case above) you can
simplify this to "ASSERT(StableTimerFreq !=3D 0);"  Additional benefit
is that it'll give a more helpful log message.
OK, I will adjust it next time.

+  //
+  //          Ticks
+  // Time =3D --------- x 1,000,000,000
+  //        Frequency
+  //
+  Status =3D SafeUint64Mult (
+             DivU64x64Remainder (Ticks, Frequency, &Remainder),
+             1000000000u,
+             &NanoSeconds
+             );
Not checking Status here?
Oh, I forget, I will add the checking stage next time, thank you!

take care,
  Gerd
_._,_._,_

Groups.io Links:

=20 You receive all messages sent to this group. =20 =20

View/Reply Online (#116783) | =20 | Mute= This Topic | New Topic
Your Subscriptio= n | Contact Group Owner | Unsubscribe [rebecca@openfw.io]

_._,_._,_
--------------x7FZs6ipqmqLwo2qxBAurR4F--