Re: [edk2-devel] [PATCH v4 0/8] Adjust the QemuFwCfgLibMmio and add PEI stage

2024-04-29 Thread Chao Li



Thanks,
Chao
On 2024/4/29 15:14, Ard Biesheuvel wrote:

On Mon, 29 Apr 2024 at 09:09, Chao Li  wrote:

Hi Ard,

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


No, please do not make any adjustments. I will take the v4 and apply
these changes directly.

Please do not send another revision unless there are other review comments.

OK, I see.








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




Re: [edk2-devel] [PATCH v4 0/8] Adjust the QemuFwCfgLibMmio and add PEI stage

2024-04-29 Thread Ard Biesheuvel
On Mon, 29 Apr 2024 at 09:09, Chao Li  wrote:
>
> Hi Ard,
>
> OK, I will make adjustments according to your suggestions and submit the V5 
> today.
>

No, please do not make any adjustments. I will take the v4 and apply
these changes directly.

Please do not send another revision unless there are other review comments.


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




Re: [edk2-devel] [PATCH v4 0/8] Adjust the QemuFwCfgLibMmio and add PEI stage

2024-04-29 Thread Chao Li

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  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 (
UINT64FwCfgDmaAddress;
UINT64FwCfgDmaSize;
QEMU_FW_CFG_RESOURCE  *FwCfgResource;
-  VOID  *Buffer;

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

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







-=-=-=-=-=-=-=-=-=-=-=-
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/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH v4 0/8] Adjust the QemuFwCfgLibMmio and add PEI stage

2024-04-28 Thread Ard Biesheuvel
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 (
   UINT64FwCfgDmaAddress;
   UINT64FwCfgDmaSize;
   QEMU_FW_CFG_RESOURCE  *FwCfgResource;
-  VOID  *Buffer;

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

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


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




Re: [edk2-devel] [PATCH v4 0/8] Adjust the QemuFwCfgLibMmio and add PEI stage

2024-04-28 Thread Chao Li

Hi Ard and Gerd and other maintainers,

Could you review this version and give your suggestions?


Thanks,
Chao
On 2024/4/26 16:28, Chao Li wrote:

Patch1: Added three PCDs for QemuFwCfgLibMmio
Patch2: Sparate QemuFwCfgLibMmio.c into two files and default as DXE
stage library.
Patch3: Added QemuFwCfgMmiLib PEI version
Patch4: Rename QemuFwCfgLibMmio.inf to QemuFwCfgMmioDxeLib.inf and
enable it in AARCH64 and RISCV64.

V1 -> V2:
1. Use HOBs instead of PCD.
2. The old patch2 is divided into two parts, one is code splitting, and
the other is functional changes.
3. add two patches to keep the safe when change the platform DSC file.

V2 -> V3:
1. Merge three HOBs into a single HOB.
2. Remove the dynamic global variables in PEI.

V3 -> V4:
1. Adjust the HOB content, this version saves all of structual contents
in HOB.
2. Remove the Loongson copyright in separation patch, and add it in the
funciton change patch.
3. Restored some variables as static in DXE version.
4. Added the HOB GUID in OvmfPkg.dec.

BZ:https://bugzilla.tianocore.org/show_bug.cgi?id=4755

PR:https://github.com/tianocore/edk2/pull/5568

Cc: Ard Biesheuvel
Cc: Jiewen Yao
Cc: Gerd Hoffmann
Cc: Leif Lindholm
Cc: Sami Mujawar
Cc: Sunil V L
Cc: Andrei Warkentin

Chao Li (8):
   OvmfPkg: Add a GUID for QemuFwCfgLib
   OvmfPkg: Separate QemuFwCfgLibMmio.c into two files
   OvmfPkg: Add the way of HOBs in QemuFwCfgLibMmio
   OvmfPkg: Add the QemuFwCfgMmioLib PEI stage version
   OvmfPkg: Copy the same new INF as QemuFwCfgLibMmio.inf
   ArmVirtPkg: Enable QemuFwCfgMmioDxeLib.inf
   OvmfPkg/RiscVVirt: Enable QemuFwCfgMmioDxeLib.inf
   OvmfPkg: Remove QemuFwCfgLibMmio.inf

  ArmVirtPkg/ArmVirtQemu.dsc|   2 +-
  ArmVirtPkg/ArmVirtQemuKernel.dsc  |   2 +-
  .../Library/QemuFwCfgLib/QemuFwCfgLibMmio.c   | 243 +
  .../QemuFwCfgLib/QemuFwCfgLibMmioInternal.h   | 244 ++
  .../Library/QemuFwCfgLib/QemuFwCfgMmioDxe.c   | 214 +++
  ...CfgLibMmio.inf => QemuFwCfgMmioDxeLib.inf} |   8 +-
  .../Library/QemuFwCfgLib/QemuFwCfgMmioPei.c   | 235 +
  .../QemuFwCfgLib/QemuFwCfgMmioPeiLib.inf  |  52 
  OvmfPkg/OvmfPkg.dec   |   1 +
  OvmfPkg/RiscVVirt/RiscVVirtQemu.dsc   |   2 +-
  10 files changed, 814 insertions(+), 189 deletions(-)
  create mode 100644 OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMmioInternal.h
  create mode 100644 OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgMmioDxe.c
  rename OvmfPkg/Library/QemuFwCfgLib/{QemuFwCfgLibMmio.inf => 
QemuFwCfgMmioDxeLib.inf} (78%)
  create mode 100644 OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgMmioPei.c
  create mode 100644 OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgMmioPeiLib.inf




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




[edk2-devel] [PATCH v4 0/8] Adjust the QemuFwCfgLibMmio and add PEI stage

2024-04-26 Thread Chao Li


Patch1: Added three PCDs for QemuFwCfgLibMmio
Patch2: Sparate QemuFwCfgLibMmio.c into two files and default as DXE
stage library.
Patch3: Added QemuFwCfgMmiLib PEI version
Patch4: Rename QemuFwCfgLibMmio.inf to QemuFwCfgMmioDxeLib.inf and
enable it in AARCH64 and RISCV64.

V1 -> V2:
1. Use HOBs instead of PCD.
2. The old patch2 is divided into two parts, one is code splitting, and
the other is functional changes.
3. add two patches to keep the safe when change the platform DSC file.

V2 -> V3:
1. Merge three HOBs into a single HOB.
2. Remove the dynamic global variables in PEI.

V3 -> V4:
1. Adjust the HOB content, this version saves all of structual contents
in HOB.
2. Remove the Loongson copyright in separation patch, and add it in the
funciton change patch.
3. Restored some variables as static in DXE version.
4. Added the HOB GUID in OvmfPkg.dec.

BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=4755

PR: https://github.com/tianocore/edk2/pull/5568

Cc: Ard Biesheuvel 
Cc: Jiewen Yao 
Cc: Gerd Hoffmann 
Cc: Leif Lindholm 
Cc: Sami Mujawar 
Cc: Sunil V L 
Cc: Andrei Warkentin 

Chao Li (8):
  OvmfPkg: Add a GUID for QemuFwCfgLib
  OvmfPkg: Separate QemuFwCfgLibMmio.c into two files
  OvmfPkg: Add the way of HOBs in QemuFwCfgLibMmio
  OvmfPkg: Add the QemuFwCfgMmioLib PEI stage version
  OvmfPkg: Copy the same new INF as QemuFwCfgLibMmio.inf
  ArmVirtPkg: Enable QemuFwCfgMmioDxeLib.inf
  OvmfPkg/RiscVVirt: Enable QemuFwCfgMmioDxeLib.inf
  OvmfPkg: Remove QemuFwCfgLibMmio.inf

 ArmVirtPkg/ArmVirtQemu.dsc|   2 +-
 ArmVirtPkg/ArmVirtQemuKernel.dsc  |   2 +-
 .../Library/QemuFwCfgLib/QemuFwCfgLibMmio.c   | 243 +
 .../QemuFwCfgLib/QemuFwCfgLibMmioInternal.h   | 244 ++
 .../Library/QemuFwCfgLib/QemuFwCfgMmioDxe.c   | 214 +++
 ...CfgLibMmio.inf => QemuFwCfgMmioDxeLib.inf} |   8 +-
 .../Library/QemuFwCfgLib/QemuFwCfgMmioPei.c   | 235 +
 .../QemuFwCfgLib/QemuFwCfgMmioPeiLib.inf  |  52 
 OvmfPkg/OvmfPkg.dec   |   1 +
 OvmfPkg/RiscVVirt/RiscVVirtQemu.dsc   |   2 +-
 10 files changed, 814 insertions(+), 189 deletions(-)
 create mode 100644 OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMmioInternal.h
 create mode 100644 OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgMmioDxe.c
 rename OvmfPkg/Library/QemuFwCfgLib/{QemuFwCfgLibMmio.inf => 
QemuFwCfgMmioDxeLib.inf} (78%)
 create mode 100644 OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgMmioPei.c
 create mode 100644 OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgMmioPeiLib.inf

-- 
2.27.0



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