From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail05.groups.io (mail05.groups.io [45.79.224.7]) by spool.mail.gandi.net (Postfix) with ESMTPS id 698207803D0 for ; Mon, 29 Apr 2024 07:09:41 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=P4jwoCt1iCxUV/g4GKkToYhsuo44R5aD/ZCLBH0FD74=; 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:Resent-From:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Type; s=20240206; t=1714374579; v=1; b=GBtG4cODMpLFWvYeMom2aJenNwfSVef+httk/1XvIgrs3ubjYKpJ7zz1/liuScVxc1AYISIH QFWSNozMIKAMXOcom30Ty2EQMnz+cYy6b/d2iD0NvmMg1Y0/VZguxaTxD0BbUB3Lkzp3yCLoA4g 2E60+VLjv2uaBgHAAdDitg0T7KjVEMpd8dkov5qNIYQniuBsqKb8j46Pv9f5wCcUZbvBJUWYT0V NTDvn6WYqMbvoTyjh46PFVcKeJq8e+z3T+4uFW5VfBztZ6+6lr81A1YpkdN9JmQPDJEoLOSpci3 AKCFf8IQT/8POAC01K/lcOkmt4bExYGdiF1lS6wuPO8GA== X-Received: by 127.0.0.2 with SMTP id RphaYY7687511xnj6cYFrdH2; Mon, 29 Apr 2024 00:09:39 -0700 X-Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by mx.groups.io with SMTP id smtpd.web11.14614.1714374577355944763 for ; Mon, 29 Apr 2024 00:09:38 -0700 X-Received: from loongson.cn (unknown [10.40.24.149]) by gateway (Coremail) with SMTP id _____8DxfeurRy9mddQEAA--.12593S3; Mon, 29 Apr 2024 15:09:31 +0800 (CST) X-Received: from [10.40.24.149] (unknown [10.40.24.149]) by localhost.localdomain (Coremail) with SMTP id AQAAf8BxrdyoRy9mmNsJAA--.24332S3; Mon, 29 Apr 2024 15:09:29 +0800 (CST) Message-ID: <2dfaf620-81d7-4190-978a-b13296d8cf26@loongson.cn> Date: Mon, 29 Apr 2024 15:09:28 +0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [edk2-devel] [PATCH v4 0/8] Adjust the QemuFwCfgLibMmio and add PEI stage To: devel@edk2.groups.io, ardb@kernel.org Cc: Ard Biesheuvel , Gerd Hoffmann , Jiewen Yao , Leif Lindholm , Sami Mujawar , Sunil V L , Andrei Warkentin References: <20240426082827.68489-1-lichao@loongson.cn> <4e7dc099-7b05-4a8f-8fa9-a72784507adf@loongson.cn> From: "Chao Li" In-Reply-To: X-CM-TRANSID: AQAAf8BxrdyoRy9mmNsJAA--.24332S3 X-CM-SenderInfo: xolfxt3r6o00pqjv00gofq/1tbiAQACCGYvCpMBAwANsU X-Coremail-Antispam: 1Uk129KBjDUn29KB7ZKAUJUUUUU529EdanIXcx71UUUUU7KY7 ZEXasCq-sGcSsGvfJ3UbIjqfuFe4nvWSU5nxnvy29KBjDU0xBIdaVrnUUvcSsGvfC2Kfnx nUUI43ZEXa7xR_UUUUUUUUU== 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: Mon, 29 Apr 2024 00:09:39 -0700 Resent-From: lichao@loongson.cn Reply-To: devel@edk2.groups.io,lichao@loongson.cn List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: iqIIT47sYH5gETZhcsMsKkBax7686176AA= Content-Type: multipart/alternative; boundary="------------Lgc0b2ie1Ane0XK0a0zqDmRc" X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20240206 header.b=GBtG4cOD; dmarc=none; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 45.79.224.7 as permitted sender) smtp.mailfrom=bounce@groups.io --------------Lgc0b2ie1Ane0XK0a0zqDmRc Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable Hi Ard, OK, I will make adjustments according to your suggestions and submit the=20 V5 today. Thanks, Chao On 2024/4/29 14:56, Ard Biesheuvel wrote: > On Mon, 29 Apr 2024 at 03:17, Chao Li wrote: >> Hi Ard and Gerd and other maintainers, >> >> Could you review this version and give your suggestions? >> > This looks ok to me now, modulo a few minor tweaks (see below) that I > will apply when merging. > > I also changed the type signatures to > > extern > VOID > (EFIAPI *InternalQemuFwCfgReadBytes) ( > IN UINTN Size, > IN VOID *Buffer OPTIONAL > ); > > Note that the EFIAPI applies to the function itself, not the pointer > so it needs to be inside the () > > > > --- a/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgMmioPei.c > +++ b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgMmioPei.c > @@ -104,7 +104,6 @@ QemuFwCfgInitialize ( > UINT64 FwCfgDmaAddress; > UINT64 FwCfgDmaSize; > QEMU_FW_CFG_RESOURCE *FwCfgResource; > - VOID *Buffer; > > // > // Check whether the Qemu firmware configure resources HOB has been c= reated, > @@ -125,11 +124,8 @@ QemuFwCfgInitialize ( > // > // Create resouce memory > // > - Buffer =3D AllocatePages(EFI_SIZE_TO_PAGES (sizeof (QEMU_FW_CFG_RESOUR= CE))); > - ASSERT (Buffer !=3D NULL); > - ZeroMem (Buffer, sizeof (QEMU_FW_CFG_RESOURCE)); > - > - FwCfgResource =3D (QEMU_FW_CFG_RESOURCE *)Buffer; > + FwCfgResource =3D AllocateZeroPool (sizeof (QEMU_FW_CFG_RESOURCE)); > + ASSERT (FwCfgResource !=3D NULL); > > for (Prev =3D 0; ; Prev =3D Node) { > Node =3D fdt_next_node (DeviceTreeBase, Prev, NULL); > @@ -141,7 +137,7 @@ QemuFwCfgInitialize ( > // Check for memory node > // > Type =3D fdt_getprop (DeviceTreeBase, Node, "compatible", &Len); > - if ((Type) && > + if ((Type !=3D NULL) && > (AsciiStrnCmp (Type, "qemu,fw-cfg-mmio", Len) =3D=3D 0)) > { > // > > >=20 > -=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 (#118377): https://edk2.groups.io/g/devel/message/118377 Mute This Topic: https://groups.io/mt/105746786/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- --------------Lgc0b2ie1Ane0XK0a0zqDmRc Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable

Hi Ard,

OK, I will make adjustments according to your suggestions and submit the V5 today.


=
Thanks,
Chao
On 2024/4/29 14:56, Ard Biesheuvel wrote:
On Mon, 29 Apr 2024 at 03:17, =
Chao Li <lichao@loongson.cn> wrote:
Hi Ard and Gerd and other maintainers,

Could you review this version and give your suggestions?

This looks ok to me now, modulo a few minor tweaks (see below) that I
will apply when merging.

I also changed the type signatures to

extern
VOID
(EFIAPI *InternalQemuFwCfgReadBytes) (
  IN UINTN  Size,
  IN VOID   *Buffer  OPTIONAL
  );

Note that the EFIAPI applies to the function itself, not the pointer
so it needs to be inside the ()



--- a/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgMmioPei.c
+++ b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgMmioPei.c
@@ -104,7 +104,6 @@ QemuFwCfgInitialize (
   UINT64                FwCfgDmaAddress;
   UINT64                FwCfgDmaSize;
   QEMU_FW_CFG_RESOURCE  *FwCfgResource;
-  VOID                  *Buffer;

   //
   // Check whether the Qemu firmware configure resources HOB has been crea=
ted,
@@ -125,11 +124,8 @@ QemuFwCfgInitialize (
   //
   // Create resouce memory
   //
-  Buffer =3D AllocatePages(EFI_SIZE_TO_PAGES (sizeof (QEMU_FW_CFG_RESOURCE=
)));
-  ASSERT (Buffer !=3D NULL);
-  ZeroMem (Buffer, sizeof (QEMU_FW_CFG_RESOURCE));
-
-  FwCfgResource =3D (QEMU_FW_CFG_RESOURCE *)Buffer;
+  FwCfgResource =3D AllocateZeroPool (sizeof (QEMU_FW_CFG_RESOURCE));
+  ASSERT (FwCfgResource !=3D NULL);

   for (Prev =3D 0; ; Prev =3D Node) {
     Node =3D fdt_next_node (DeviceTreeBase, Prev, NULL);
@@ -141,7 +137,7 @@ QemuFwCfgInitialize (
     // Check for memory node
     //
     Type =3D fdt_getprop (DeviceTreeBase, Node, "compatible", &Len);
-    if ((Type) &&
+    if ((Type !=3D NULL) &&
         (AsciiStrnCmp (Type, "qemu,fw-cfg-mmio", Len) =3D=3D 0))
     {
       //




_._,_._,_

Groups.io Links:

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

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

_._,_._,_
--------------Lgc0b2ie1Ane0XK0a0zqDmRc--