public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH v2 0/4] UefiPayloadPkg: LinuxBoot Support in UefiPayload
@ 2021-08-07 14:51 Cheng-Chieh Huang
  2021-08-07 14:51 ` [PATCH v2 1/4] UefiPayloadPkg: Add LINUXBOOT payload target Cheng-Chieh Huang
                   ` (5 more replies)
  0 siblings, 6 replies; 10+ messages in thread
From: Cheng-Chieh Huang @ 2021-08-07 14:51 UTC (permalink / raw)
  To: devel
  Cc: Cheng-Chieh Huang, Daniel Schaefer, Trammell Hudson, Maurice Ma,
	Guo Dong, Benjamin You

These are necessary patches to Support LinuxBoot in UefiPayload.
With these paches, we can boot to ESXi and Windows from a linux in QEMU.

This is second parse. In addition to fixing reviwer's suggestions,
I removed the following CLs.
* Add DISABLE_MMX_SSE to avoid generating floating points operation
-> will send a seperate patch to add these flags to BaseTools

* LinuxBoot: use a text format for the configuration block.
-> will work with Trammell Hudson to cover this patch to EDK2 style.

LinuxBoot README:
https://github.com/linuxboot/edk2/blob/uefipayload/UefiPayloadPkg/README.md

v2 PR to tianocore:
https://github.com/tianocore/edk2/pull/1873

Cheng-Chieh Huang (4):
  UefiPayloadPkg: Add LINUXBOOT payload target
  UefiPayloadPkg: Use legacy timer in Linuxboot payload
  UefiPayloadPkg: Update maximum logic processor to 256
  UefiPayloadPkg: Reserve Payload config in runtime services data

 UefiPayloadPkg/UefiPayloadPkg.dsc                              |  24 ++-
 UefiPayloadPkg/UefiPayloadPkg.fdf                              |   5 +
 UefiPayloadPkg/Library/LbParseLib/LbParseLib.inf               |  39 +++++
 UefiPayloadPkg/Library/LbParseLib/Linuxboot.h                  |  47 +++++
 UefiPayloadPkg/Library/LbParseLib/LbParseLib.c                 | 182 ++++++++++++++++++++
 UefiPayloadPkg/Library/PciHostBridgeLib/PciHostBridgeSupport.c |   6 +-
 UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c             |   4 +
 7 files changed, 299 insertions(+), 8 deletions(-)
 create mode 100644 UefiPayloadPkg/Library/LbParseLib/LbParseLib.inf
 create mode 100644 UefiPayloadPkg/Library/LbParseLib/Linuxboot.h
 create mode 100644 UefiPayloadPkg/Library/LbParseLib/LbParseLib.c

Cc: Cheng-Chieh Huang <chengchieh@google.com>
Cc: Daniel Schaefer <daniel.schaefer@hpe.com>
Cc: Trammell Hudson <hudson@trmm.net>
Cc: Maurice Ma <maurice.ma@intel.com>
Cc: Guo Dong <guo.dong@intel.com>
Cc: Benjamin You <benjamin.you@intel.com>


-- 
2.32.0.605.g8dce9f2422-goog


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH v2 1/4] UefiPayloadPkg: Add LINUXBOOT payload target
  2021-08-07 14:51 [PATCH v2 0/4] UefiPayloadPkg: LinuxBoot Support in UefiPayload Cheng-Chieh Huang
@ 2021-08-07 14:51 ` Cheng-Chieh Huang
  2021-08-07 14:51 ` [PATCH v2 2/4] UefiPayloadPkg: Use legacy timer in Linuxboot payload Cheng-Chieh Huang
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 10+ messages in thread
From: Cheng-Chieh Huang @ 2021-08-07 14:51 UTC (permalink / raw)
  To: devel
  Cc: Cheng-Chieh Huang, Daniel Schaefer, Trammell Hudson, Maurice Ma,
	Guo Dong, Benjamin You

Initial commit to support linuxboot payload.

Signed-off-by: Cheng-Chieh Huang <chengchieh@google.com>
Cc: Cheng-Chieh Huang <chengchieh@google.com>
Cc: Daniel Schaefer <daniel.schaefer@hpe.com>
Cc: Trammell Hudson <hudson@trmm.net>
Cc: Maurice Ma <maurice.ma@intel.com>
Cc: Guo Dong <guo.dong@intel.com>
Cc: Benjamin You <benjamin.you@intel.com>
---
 UefiPayloadPkg/UefiPayloadPkg.dsc                              |  16 +-
 UefiPayloadPkg/Library/LbParseLib/LbParseLib.inf               |  39 +++++
 UefiPayloadPkg/Library/LbParseLib/Linuxboot.h                  |  47 +++++
 UefiPayloadPkg/Library/LbParseLib/LbParseLib.c                 | 182 ++++++++++++++++++++
 UefiPayloadPkg/Library/PciHostBridgeLib/PciHostBridgeSupport.c |   6 +-
 5 files changed, 283 insertions(+), 7 deletions(-)

diff --git a/UefiPayloadPkg/UefiPayloadPkg.dsc b/UefiPayloadPkg/UefiPayloadPkg.dsc
index bcedf1c746b4..54576ba485b7 100644
--- a/UefiPayloadPkg/UefiPayloadPkg.dsc
+++ b/UefiPayloadPkg/UefiPayloadPkg.dsc
@@ -33,6 +33,7 @@ [Defines]
   #
   # SBL:      UEFI payload for Slim Bootloader
   # COREBOOT: UEFI payload for coreboot
+  # LINUXBOOT: UEFI payload for linuxboot
   #
   DEFINE   BOOTLOADER = SBL
 
@@ -93,6 +94,9 @@ [Defines]
 
 [BuildOptions]
   *_*_*_CC_FLAGS                 = -D DISABLE_NEW_DEPRECATED_INTERFACES
+!if $(BOOTLOADER) == "LINUXBOOT"
+  *_*_*_CC_FLAGS                 = -D LINUXBOOT_PAYLOAD
+!endif
   GCC:*_UNIXGCC_*_CC_FLAGS       = -DMDEPKG_NDEBUG
   GCC:RELEASE_*_*_CC_FLAGS       = -DMDEPKG_NDEBUG
   INTEL:RELEASE_*_*_CC_FLAGS     = /D MDEPKG_NDEBUG
@@ -222,11 +226,13 @@ [LibraryClasses]
 !endif
   PlatformSupportLib|UefiPayloadPkg/Library/PlatformSupportLibNull/PlatformSupportLibNull.inf
 !if $(UNIVERSAL_PAYLOAD) == FALSE
-  !if $(BOOTLOADER) == "COREBOOT"
-    BlParseLib|UefiPayloadPkg/Library/CbParseLib/CbParseLib.inf
-  !else
-    BlParseLib|UefiPayloadPkg/Library/SblParseLib/SblParseLib.inf
-  !endif
+ !if $(BOOTLOADER) == "COREBOOT"
+   BlParseLib|UefiPayloadPkg/Library/CbParseLib/CbParseLib.inf
+ !elseif $(BOOTLOADER) == "LINUXBOOT"
+   BlParseLib|UefiPayloadPkg/Library/LbParseLib/LbParseLib.inf
+ !else
+   BlParseLib|UefiPayloadPkg/Library/SblParseLib/SblParseLib.inf
+ !endif
 !endif
 
   DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
diff --git a/UefiPayloadPkg/Library/LbParseLib/LbParseLib.inf b/UefiPayloadPkg/Library/LbParseLib/LbParseLib.inf
new file mode 100644
index 000000000000..d75ba8db8cf3
--- /dev/null
+++ b/UefiPayloadPkg/Library/LbParseLib/LbParseLib.inf
@@ -0,0 +1,39 @@
+## @file
+#  Linuxboot Table Parse Library.
+#
+#  Copyright (c) 2021, the u-root Authors. All rights reserved.<BR>
+#  SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+[Defines]
+  INF_VERSION                    = 0x00010005
+  BASE_NAME                      = LbParseLib
+  FILE_GUID                      = DBA15E1E-4C16-47DF-93C0-AB5888ED14C3
+  MODULE_TYPE                    = BASE
+  VERSION_STRING                 = 1.0
+  LIBRARY_CLASS                  = BlParseLib
+
+#
+# The following information is for reference only and not required by the build tools.
+#
+#  VALID_ARCHITECTURES           = IA32 X64
+#
+
+[Sources]
+  LbParseLib.c
+
+[Packages]
+  MdePkg/MdePkg.dec
+  MdeModulePkg/MdeModulePkg.dec
+  UefiPayloadPkg/UefiPayloadPkg.dec
+
+[LibraryClasses]
+  BaseLib
+  BaseMemoryLib
+  IoLib
+  DebugLib
+  PcdLib
+
+[Pcd]
+  gUefiPayloadPkgTokenSpaceGuid.PcdPayloadFdMemBase
diff --git a/UefiPayloadPkg/Library/LbParseLib/Linuxboot.h b/UefiPayloadPkg/Library/LbParseLib/Linuxboot.h
new file mode 100644
index 000000000000..34ca18069983
--- /dev/null
+++ b/UefiPayloadPkg/Library/LbParseLib/Linuxboot.h
@@ -0,0 +1,47 @@
+/** @file
+  LinuxBoot PEI module include file.
+**/
+#ifndef _LINUXBOOT_PEI_H_INCLUDED_
+#define _LINUXBOOT_PEI_H_INCLUDED_
+
+#if defined(_MSC_VER)
+#pragma warning(disable : 4200)
+#endif
+
+#pragma pack(1)
+typedef struct SerialPortConfigStruct {
+  UINT32 Type;
+  UINT32 BaseAddr;
+  UINT32 Baud;
+  UINT32 RegWidth;
+  UINT32 InputHertz;
+  UINT32 UartPciAddr;
+} SerialPortConfig;
+
+typedef struct MemoryMapEntryStruct {
+  UINT64 Start;
+  UINT64 End;
+  UINT32 Type;
+} MemoryMapEntry;
+
+typedef struct UefiPayloadConfigStruct {
+  UINT64 Version;
+  UINT64 AcpiBase;
+  UINT64 AcpiSize;
+  UINT64 SmbiosBase;
+  UINT64 SmbiosSize;
+  SerialPortConfig SerialConfig;
+  UINT32 NumMemoryMapEntries;
+  MemoryMapEntry MemoryMapEntries[0];
+} UefiPayloadConfig;
+#pragma pack()
+
+#define UEFI_PAYLOAD_CONFIG_VERSION 1
+
+#define LINUXBOOT_MEM_RAM 1
+#define LINUXBOOT_MEM_DEFAULT 2
+#define LINUXBOOT_MEM_ACPI 3
+#define LINUXBOOT_MEM_NVS 4
+#define LINUXBOOT_MEM_RESERVED 5
+
+#endif  // _LINUXBOOT_PEI_H_INCLUDED_
diff --git a/UefiPayloadPkg/Library/LbParseLib/LbParseLib.c b/UefiPayloadPkg/Library/LbParseLib/LbParseLib.c
new file mode 100644
index 000000000000..410062af314a
--- /dev/null
+++ b/UefiPayloadPkg/Library/LbParseLib/LbParseLib.c
@@ -0,0 +1,182 @@
+/** @file
+  This library will parse the linuxboot table in memory and extract those required
+  information.
+
+  Copyright (c) 2021, the u-root Authors. All rights reserved.<BR>
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+
+#include <IndustryStandard/Acpi.h>
+#include <IndustryStandard/SmBios.h>
+#include <Library/BaseLib.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/BlParseLib.h>
+#include <Library/DebugLib.h>
+#include <Library/IoLib.h>
+#include <Library/PcdLib.h>
+#include <Linuxboot.h>
+#include <Uefi/UefiBaseType.h>
+
+// Retrieve UefiPayloadConfig from Linuxboot's uefiboot
+UefiPayloadConfig* GetUefiPayLoadConfig() {
+  UefiPayloadConfig *Config =
+      (UefiPayloadConfig*)(UINTN)(PcdGet32(PcdPayloadFdMemBase) - SIZE_64KB);
+  if (Config->Version != UEFI_PAYLOAD_CONFIG_VERSION) {
+    DEBUG((DEBUG_ERROR, "Expect payload Config version: %d, but get %d\n",
+           UEFI_PAYLOAD_CONFIG_VERSION, Config->Version));
+    CpuDeadLoop ();
+  }
+  return Config;
+}
+
+// Align the address and add memory rang to MemInfoCallback
+void AddMemoryRange(
+    IN BL_MEM_INFO_CALLBACK MemInfoCallback,
+    IN UINTN start,
+    IN UINTN end,
+    IN int type) {
+  MEMROY_MAP_ENTRY MemoryMap;
+  UINTN AlignedStart;
+  UINTN AlignedEnd;
+  AlignedStart = ALIGN_VALUE(start, SIZE_4KB);
+  AlignedEnd = ALIGN_VALUE(end, SIZE_4KB);
+  // Conservative adjustment on Memory map. This should happen when booting from
+  // non UEFI bios and it may report a memory region less than 4KB.
+  if (AlignedStart > start && type != LINUXBOOT_MEM_RAM) {
+    AlignedStart -= SIZE_4KB;
+  }
+  if (AlignedEnd > end + 1 && type == LINUXBOOT_MEM_RAM) {
+    AlignedEnd -= SIZE_4KB;
+  }
+  MemoryMap.Base = AlignedStart;
+  MemoryMap.Size = AlignedEnd - AlignedStart;
+  MemoryMap.Type = type;
+  MemoryMap.Flag = 0;
+  MemInfoCallback(&MemoryMap, NULL);
+}
+
+/**
+  Acquire the memory information from the linuxboot table in memory.
+
+  @param  MemInfoCallback     The callback routine
+  @param  Params              Pointer to the callback routine parameter
+
+  @retval RETURN_SUCCESS     Successfully find out the memory information.
+  @retval RETURN_NOT_FOUND   Failed to find the memory information.
+
+**/
+RETURN_STATUS
+EFIAPI
+ParseMemoryInfo(
+    IN BL_MEM_INFO_CALLBACK MemInfoCallback,
+    IN VOID* Params
+    ) {
+  UefiPayloadConfig *Config;
+  int Index;
+
+  Config = GetUefiPayLoadConfig();
+
+  DEBUG((DEBUG_INFO, "MemoryMap #entries: %d\n", Config->NumMemoryMapEntries));
+
+  MemoryMapEntry* entry = &Config->MemoryMapEntries[0];
+  for (Index = 0; Index < Config->NumMemoryMapEntries; Index++) {
+    DEBUG((DEBUG_INFO, "Start: 0x%lx End: 0x%lx Type:%d\n", entry->Start,
+           entry->End, entry->Type));
+    AddMemoryRange(MemInfoCallback, entry->Start, entry->End, entry->Type);
+    entry++;
+  }
+  return RETURN_SUCCESS;
+}
+
+/**
+  Acquire acpi table and smbios table from linuxboot
+
+  @param  SystemTableInfo          Pointer to the system table info
+
+  @retval RETURN_SUCCESS            Successfully find out the tables.
+  @retval RETURN_NOT_FOUND          Failed to find the tables.
+
+**/
+RETURN_STATUS
+EFIAPI
+ParseSystemTable(
+    OUT SYSTEM_TABLE_INFO* SystemTableInfo
+    ) {
+  UefiPayloadConfig *Config;
+
+  Config = GetUefiPayLoadConfig();
+  SystemTableInfo->AcpiTableBase = Config->AcpiBase;
+  SystemTableInfo->AcpiTableSize = Config->AcpiSize;
+
+  SystemTableInfo->SmbiosTableBase = Config->SmbiosBase;
+  SystemTableInfo->SmbiosTableSize = Config->SmbiosSize;
+
+  return RETURN_SUCCESS;
+}
+
+/**
+  Find the serial port information
+
+  @param  SERIAL_PORT_INFO   Pointer to serial port info structure
+
+  @retval RETURN_SUCCESS     Successfully find the serial port information.
+  @retval RETURN_NOT_FOUND   Failed to find the serial port information .
+
+**/
+RETURN_STATUS
+EFIAPI
+ParseSerialInfo(
+    OUT SERIAL_PORT_INFO* SerialPortInfo
+    ) {
+  UefiPayloadConfig *Config;
+  Config = GetUefiPayLoadConfig();
+
+  SerialPortInfo->BaseAddr = Config->SerialConfig.BaseAddr;
+  SerialPortInfo->RegWidth = Config->SerialConfig.RegWidth;
+  SerialPortInfo->Type = Config->SerialConfig.Type;
+  SerialPortInfo->Baud = Config->SerialConfig.Baud;
+  SerialPortInfo->InputHertz = Config->SerialConfig.InputHertz;
+  SerialPortInfo->UartPciAddr = Config->SerialConfig.UartPciAddr;
+
+  return RETURN_SUCCESS;
+}
+
+/**
+  Find the video frame buffer information
+
+  @param  GfxInfo             Pointer to the EFI_PEI_GRAPHICS_INFO_HOB structure
+
+  @retval RETURN_SUCCESS     Successfully find the video frame buffer
+information.
+  @retval RETURN_NOT_FOUND   Failed to find the video frame buffer information .
+
+**/
+RETURN_STATUS
+EFIAPI
+ParseGfxInfo(
+    OUT EFI_PEI_GRAPHICS_INFO_HOB* GfxInfo
+    ) {
+  // Not supported
+  return RETURN_NOT_FOUND;
+}
+
+/**
+  Find the video frame buffer device information
+
+  @param  GfxDeviceInfo      Pointer to the EFI_PEI_GRAPHICS_DEVICE_INFO_HOB
+structure
+
+  @retval RETURN_SUCCESS     Successfully find the video frame buffer
+information.
+  @retval RETURN_NOT_FOUND   Failed to find the video frame buffer information.
+
+**/
+RETURN_STATUS
+EFIAPI
+ParseGfxDeviceInfo(
+    OUT EFI_PEI_GRAPHICS_DEVICE_INFO_HOB* GfxDeviceInfo
+    ) {
+  return RETURN_NOT_FOUND;
+}
diff --git a/UefiPayloadPkg/Library/PciHostBridgeLib/PciHostBridgeSupport.c b/UefiPayloadPkg/Library/PciHostBridgeLib/PciHostBridgeSupport.c
index b0268f05069c..a4f714f765ea 100644
--- a/UefiPayloadPkg/Library/PciHostBridgeLib/PciHostBridgeSupport.c
+++ b/UefiPayloadPkg/Library/PciHostBridgeLib/PciHostBridgeSupport.c
@@ -40,8 +40,9 @@ AdjustRootBridgeResource (
   IN  PCI_ROOT_BRIDGE_APERTURE *PMemAbove4G
 )
 {
+#ifndef LINUXBOOT_PAYLOAD
   UINT64  Mask;
-
+#endif
   //
   // For now try to downgrade everything into MEM32 since
   // - coreboot does not assign resource above 4GB
@@ -80,7 +81,7 @@ AdjustRootBridgeResource (
     PMemAbove4G->Base  = MAX_UINT64;
     PMemAbove4G->Limit = 0;
   }
-
+#ifndef LINUXBOOT_PAYLOAD
   //
   // Align IO  resource at 4K  boundary
   //
@@ -98,6 +99,7 @@ AdjustRootBridgeResource (
   if (Mem->Base != MAX_UINT64) {
     Mem->Base &= ~Mask;
   }
+#endif
 }
 
 /**
-- 
2.32.0.605.g8dce9f2422-goog


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH v2 2/4] UefiPayloadPkg: Use legacy timer in Linuxboot payload
  2021-08-07 14:51 [PATCH v2 0/4] UefiPayloadPkg: LinuxBoot Support in UefiPayload Cheng-Chieh Huang
  2021-08-07 14:51 ` [PATCH v2 1/4] UefiPayloadPkg: Add LINUXBOOT payload target Cheng-Chieh Huang
@ 2021-08-07 14:51 ` Cheng-Chieh Huang
  2021-08-07 14:51 ` [PATCH v2 3/4] UefiPayloadPkg: Update maximum logic processor to 256 Cheng-Chieh Huang
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 10+ messages in thread
From: Cheng-Chieh Huang @ 2021-08-07 14:51 UTC (permalink / raw)
  To: devel
  Cc: Cheng-Chieh Huang, Guo Dong, Daniel Schaefer, Trammell Hudson,
	Maurice Ma, Benjamin You

HPET timer may fail to init after prior linux taking over.

Signed-off-by: Cheng-Chieh Huang <chengchieh@google.com>
Reviewed-by: Guo Dong <guo.dong@intel.com>
Cc: Cheng-Chieh Huang <chengchieh@google.com>
Cc: Daniel Schaefer <daniel.schaefer@hpe.com>
Cc: Trammell Hudson <hudson@trmm.net>
Cc: Maurice Ma <maurice.ma@intel.com>
Cc: Guo Dong <guo.dong@intel.com>
Cc: Benjamin You <benjamin.you@intel.com>
---
 UefiPayloadPkg/UefiPayloadPkg.dsc | 6 ++++++
 UefiPayloadPkg/UefiPayloadPkg.fdf | 5 +++++
 2 files changed, 11 insertions(+)

diff --git a/UefiPayloadPkg/UefiPayloadPkg.dsc b/UefiPayloadPkg/UefiPayloadPkg.dsc
index 54576ba485b7..e56e6f4a5379 100644
--- a/UefiPayloadPkg/UefiPayloadPkg.dsc
+++ b/UefiPayloadPkg/UefiPayloadPkg.dsc
@@ -438,7 +438,13 @@ [Components.X64]
       NULL|MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManagerUiLib.inf
   }
 
+!if $(BOOTLOADER) == "LINUXBOOT"
+  OvmfPkg/8254TimerDxe/8254Timer.inf
+  OvmfPkg/8259InterruptControllerDxe/8259.inf
+!else
   PcAtChipsetPkg/HpetTimerDxe/HpetTimerDxe.inf
+!endif
+
   MdeModulePkg/Universal/Metronome/Metronome.inf
   MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf
   MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
diff --git a/UefiPayloadPkg/UefiPayloadPkg.fdf b/UefiPayloadPkg/UefiPayloadPkg.fdf
index 041fed842cd8..f57a8b4bf3d3 100644
--- a/UefiPayloadPkg/UefiPayloadPkg.fdf
+++ b/UefiPayloadPkg/UefiPayloadPkg.fdf
@@ -101,7 +101,12 @@ [FV.DXEFV]
 INF UefiCpuPkg/CpuDxe/CpuDxe.inf
 INF MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
 INF MdeModulePkg/Application/UiApp/UiApp.inf
+!if $(BOOTLOADER) != "LINUXBOOT"
 INF PcAtChipsetPkg/HpetTimerDxe/HpetTimerDxe.inf
+!else
+INF OvmfPkg/8254TimerDxe/8254Timer.inf
+INF OvmfPkg/8259InterruptControllerDxe/8259.inf
+!endif
 INF MdeModulePkg/Universal/Metronome/Metronome.inf
 INF MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf
 INF MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
-- 
2.32.0.605.g8dce9f2422-goog


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH v2 3/4] UefiPayloadPkg: Update maximum logic processor to 256
  2021-08-07 14:51 [PATCH v2 0/4] UefiPayloadPkg: LinuxBoot Support in UefiPayload Cheng-Chieh Huang
  2021-08-07 14:51 ` [PATCH v2 1/4] UefiPayloadPkg: Add LINUXBOOT payload target Cheng-Chieh Huang
  2021-08-07 14:51 ` [PATCH v2 2/4] UefiPayloadPkg: Use legacy timer in Linuxboot payload Cheng-Chieh Huang
@ 2021-08-07 14:51 ` Cheng-Chieh Huang
  2021-08-07 14:51 ` [PATCH v2 4/4] UefiPayloadPkg: Reserve Payload config in runtime services data Cheng-Chieh Huang
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 10+ messages in thread
From: Cheng-Chieh Huang @ 2021-08-07 14:51 UTC (permalink / raw)
  To: devel
  Cc: Cheng-Chieh Huang, Guo Dong, Daniel Schaefer, Trammell Hudson,
	Maurice Ma, Benjamin You

Signed-off-by: Cheng-Chieh Huang <chengchieh@google.com>
Reviewed-by: Guo Dong <guo.dong@intel.com>

Cc: Cheng-Chieh Huang <chengchieh@google.com>
Cc: Daniel Schaefer <daniel.schaefer@hpe.com>
Cc: Trammell Hudson <hudson@trmm.net>
Cc: Maurice Ma <maurice.ma@intel.com>
Cc: Guo Dong <guo.dong@intel.com>
Cc: Benjamin You <benjamin.you@intel.com>
---
 UefiPayloadPkg/UefiPayloadPkg.dsc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/UefiPayloadPkg/UefiPayloadPkg.dsc b/UefiPayloadPkg/UefiPayloadPkg.dsc
index e56e6f4a5379..8aa5f18cd35c 100644
--- a/UefiPayloadPkg/UefiPayloadPkg.dsc
+++ b/UefiPayloadPkg/UefiPayloadPkg.dsc
@@ -40,7 +40,7 @@ [Defines]
   #
   # CPU options
   #
-  DEFINE MAX_LOGICAL_PROCESSORS       = 64
+  DEFINE MAX_LOGICAL_PROCESSORS       = 256
 
   #
   # PCI options
-- 
2.32.0.605.g8dce9f2422-goog


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH v2 4/4] UefiPayloadPkg: Reserve Payload config in runtime services data
  2021-08-07 14:51 [PATCH v2 0/4] UefiPayloadPkg: LinuxBoot Support in UefiPayload Cheng-Chieh Huang
                   ` (2 preceding siblings ...)
  2021-08-07 14:51 ` [PATCH v2 3/4] UefiPayloadPkg: Update maximum logic processor to 256 Cheng-Chieh Huang
@ 2021-08-07 14:51 ` Cheng-Chieh Huang
  2021-08-07 15:05 ` [PATCH v2 0/4] UefiPayloadPkg: LinuxBoot Support in UefiPayload Cheng-Chieh Huang
  2021-08-12  4:49 ` [edk2-devel] " Ni, Ray
  5 siblings, 0 replies; 10+ messages in thread
From: Cheng-Chieh Huang @ 2021-08-07 14:51 UTC (permalink / raw)
  To: devel
  Cc: Cheng-Chieh Huang, Daniel Schaefer, Trammell Hudson, Maurice Ma,
	Guo Dong, Benjamin You

Signed-off-by: Cheng-Chieh Huang <chengchieh@google.com>

Cc: Cheng-Chieh Huang <chengchieh@google.com>
Cc: Daniel Schaefer <daniel.schaefer@hpe.com>
Cc: Trammell Hudson <hudson@trmm.net>
Cc: Maurice Ma <maurice.ma@intel.com>
Cc: Guo Dong <guo.dong@intel.com>
Cc: Benjamin You <benjamin.you@intel.com>
---
 UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c
index ae16f25c7c0e..5bace742d73e 100644
--- a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c
+++ b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c
@@ -517,6 +517,10 @@ BuildGenericHob (
 
   // The UEFI payload FV
   BuildMemoryAllocationHob (PcdGet32 (PcdPayloadFdMemBase), PcdGet32 (PcdPayloadFdMemSize), EfiBootServicesData);
+  #ifdef LINUXBOOT_PAYLOAD
+  // The UEFI payload config FV
+  BuildMemoryAllocationHob (PcdGet32 (PcdPayloadFdMemBase) - SIZE_64KB, SIZE_64KB, EfiRuntimeServicesData);
+  #endif
 
   //
   // Build CPU memory space and IO space hob
-- 
2.32.0.605.g8dce9f2422-goog


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH v2 0/4] UefiPayloadPkg: LinuxBoot Support in UefiPayload
  2021-08-07 14:51 [PATCH v2 0/4] UefiPayloadPkg: LinuxBoot Support in UefiPayload Cheng-Chieh Huang
                   ` (3 preceding siblings ...)
  2021-08-07 14:51 ` [PATCH v2 4/4] UefiPayloadPkg: Reserve Payload config in runtime services data Cheng-Chieh Huang
@ 2021-08-07 15:05 ` Cheng-Chieh Huang
  2021-08-07 16:34   ` Guo Dong
  2021-08-12  4:49 ` [edk2-devel] " Ni, Ray
  5 siblings, 1 reply; 10+ messages in thread
From: Cheng-Chieh Huang @ 2021-08-07 15:05 UTC (permalink / raw)
  To: devel; +Cc: Daniel Schaefer, Trammell Hudson, Maurice Ma, Guo Dong,
	Benjamin You

[-- Attachment #1: Type: text/plain, Size: 2325 bytes --]

Hi Guo,

I saw you left messages in https://github.com/tianocore/edk2/pull/1820. If
it's also possible to upstreaming using github PR. I can just update my old
branch.

--
Cheng-chieh

On Sat, Aug 7, 2021 at 10:51 PM Cheng-Chieh Huang <chengchieh@google.com>
wrote:

> These are necessary patches to Support LinuxBoot in UefiPayload.
> With these paches, we can boot to ESXi and Windows from a linux in QEMU.
>
> This is second parse. In addition to fixing reviwer's suggestions,
> I removed the following CLs.
> * Add DISABLE_MMX_SSE to avoid generating floating points operation
> -> will send a seperate patch to add these flags to BaseTools
>
> * LinuxBoot: use a text format for the configuration block.
> -> will work with Trammell Hudson to cover this patch to EDK2 style.
>
> LinuxBoot README:
> https://github.com/linuxboot/edk2/blob/uefipayload/UefiPayloadPkg/README.md
>
> v2 PR to tianocore:
> https://github.com/tianocore/edk2/pull/1873
>
> Cheng-Chieh Huang (4):
>   UefiPayloadPkg: Add LINUXBOOT payload target
>   UefiPayloadPkg: Use legacy timer in Linuxboot payload
>   UefiPayloadPkg: Update maximum logic processor to 256
>   UefiPayloadPkg: Reserve Payload config in runtime services data
>
>  UefiPayloadPkg/UefiPayloadPkg.dsc                              |  24 ++-
>  UefiPayloadPkg/UefiPayloadPkg.fdf                              |   5 +
>  UefiPayloadPkg/Library/LbParseLib/LbParseLib.inf               |  39 +++++
>  UefiPayloadPkg/Library/LbParseLib/Linuxboot.h                  |  47 +++++
>  UefiPayloadPkg/Library/LbParseLib/LbParseLib.c                 | 182
> ++++++++++++++++++++
>  UefiPayloadPkg/Library/PciHostBridgeLib/PciHostBridgeSupport.c |   6 +-
>  UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c             |   4 +
>  7 files changed, 299 insertions(+), 8 deletions(-)
>  create mode 100644 UefiPayloadPkg/Library/LbParseLib/LbParseLib.inf
>  create mode 100644 UefiPayloadPkg/Library/LbParseLib/Linuxboot.h
>  create mode 100644 UefiPayloadPkg/Library/LbParseLib/LbParseLib.c
>
> Cc: Cheng-Chieh Huang <chengchieh@google.com>
> Cc: Daniel Schaefer <daniel.schaefer@hpe.com>
> Cc: Trammell Hudson <hudson@trmm.net>
> Cc: Maurice Ma <maurice.ma@intel.com>
> Cc: Guo Dong <guo.dong@intel.com>
> Cc: Benjamin You <benjamin.you@intel.com>
>
>
> --
> 2.32.0.605.g8dce9f2422-goog
>
>

[-- Attachment #2: Type: text/html, Size: 3566 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v2 0/4] UefiPayloadPkg: LinuxBoot Support in UefiPayload
  2021-08-07 15:05 ` [PATCH v2 0/4] UefiPayloadPkg: LinuxBoot Support in UefiPayload Cheng-Chieh Huang
@ 2021-08-07 16:34   ` Guo Dong
  0 siblings, 0 replies; 10+ messages in thread
From: Guo Dong @ 2021-08-07 16:34 UTC (permalink / raw)
  To: Cheng-Chieh Huang, devel@edk2.groups.io
  Cc: Schaefer, Daniel, Trammell Hudson, Ma, Maurice, You, Benjamin

[-- Attachment #1: Type: text/plain, Size: 3144 bytes --]


Hi Cheng-chieh,

The Github comments is just for your reference to quick locate the comment place. You could update the PR with new changes and I could comment there.
But we still need follow EDII requirement to review the patches by email.

Thanks,
Guo

From: Cheng-Chieh Huang <chengchieh@google.com>
Sent: Saturday, August 7, 2021 8:06 AM
To: devel@edk2.groups.io
Cc: Schaefer, Daniel <daniel.schaefer@hpe.com>; Trammell Hudson <hudson@trmm.net>; Ma, Maurice <maurice.ma@intel.com>; Dong, Guo <guo.dong@intel.com>; You, Benjamin <benjamin.you@intel.com>
Subject: Re: [PATCH v2 0/4] UefiPayloadPkg: LinuxBoot Support in UefiPayload

Hi Guo,

I saw you left messages in https://github.com/tianocore/edk2/pull/1820. If it's also possible to upstreaming using github PR. I can just update my old branch.

--
Cheng-chieh

On Sat, Aug 7, 2021 at 10:51 PM Cheng-Chieh Huang <chengchieh@google.com<mailto:chengchieh@google.com>> wrote:
These are necessary patches to Support LinuxBoot in UefiPayload.
With these paches, we can boot to ESXi and Windows from a linux in QEMU.

This is second parse. In addition to fixing reviwer's suggestions,
I removed the following CLs.
* Add DISABLE_MMX_SSE to avoid generating floating points operation
-> will send a seperate patch to add these flags to BaseTools

* LinuxBoot: use a text format for the configuration block.
-> will work with Trammell Hudson to cover this patch to EDK2 style.

LinuxBoot README:
https://github.com/linuxboot/edk2/blob/uefipayload/UefiPayloadPkg/README.md

v2 PR to tianocore:
https://github.com/tianocore/edk2/pull/1873

Cheng-Chieh Huang (4):
  UefiPayloadPkg: Add LINUXBOOT payload target
  UefiPayloadPkg: Use legacy timer in Linuxboot payload
  UefiPayloadPkg: Update maximum logic processor to 256
  UefiPayloadPkg: Reserve Payload config in runtime services data

 UefiPayloadPkg/UefiPayloadPkg.dsc                              |  24 ++-
 UefiPayloadPkg/UefiPayloadPkg.fdf                              |   5 +
 UefiPayloadPkg/Library/LbParseLib/LbParseLib.inf               |  39 +++++
 UefiPayloadPkg/Library/LbParseLib/Linuxboot.h                  |  47 +++++
 UefiPayloadPkg/Library/LbParseLib/LbParseLib.c                 | 182 ++++++++++++++++++++
 UefiPayloadPkg/Library/PciHostBridgeLib/PciHostBridgeSupport.c |   6 +-
 UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c             |   4 +
 7 files changed, 299 insertions(+), 8 deletions(-)
 create mode 100644 UefiPayloadPkg/Library/LbParseLib/LbParseLib.inf
 create mode 100644 UefiPayloadPkg/Library/LbParseLib/Linuxboot.h
 create mode 100644 UefiPayloadPkg/Library/LbParseLib/LbParseLib.c

Cc: Cheng-Chieh Huang <chengchieh@google.com<mailto:chengchieh@google.com>>
Cc: Daniel Schaefer <daniel.schaefer@hpe.com<mailto:daniel.schaefer@hpe.com>>
Cc: Trammell Hudson <hudson@trmm.net<mailto:hudson@trmm.net>>
Cc: Maurice Ma <maurice.ma@intel.com<mailto:maurice.ma@intel.com>>
Cc: Guo Dong <guo.dong@intel.com<mailto:guo.dong@intel.com>>
Cc: Benjamin You <benjamin.you@intel.com<mailto:benjamin.you@intel.com>>


--
2.32.0.605.g8dce9f2422-goog

[-- Attachment #2: Type: text/html, Size: 7112 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [edk2-devel] [PATCH v2 0/4] UefiPayloadPkg: LinuxBoot Support in UefiPayload
  2021-08-07 14:51 [PATCH v2 0/4] UefiPayloadPkg: LinuxBoot Support in UefiPayload Cheng-Chieh Huang
                   ` (4 preceding siblings ...)
  2021-08-07 15:05 ` [PATCH v2 0/4] UefiPayloadPkg: LinuxBoot Support in UefiPayload Cheng-Chieh Huang
@ 2021-08-12  4:49 ` Ni, Ray
  2021-08-12  8:51   ` Cheng-Chieh Huang
  5 siblings, 1 reply; 10+ messages in thread
From: Ni, Ray @ 2021-08-12  4:49 UTC (permalink / raw)
  To: devel@edk2.groups.io, chengchieh@google.com
  Cc: Schaefer, Daniel, Trammell Hudson, Ma, Maurice, Dong, Guo,
	You, Benjamin

I will leave all comments to the patches here since I have difficulty to find individual patches without these patches sending to me directly.

In general, the commit messages are too short to explain the background/reason of the code change. Can you please put more explanation in the commit message?

1. UefiPayloadPkg: Add LINUXBOOT payload target
  a. Why is IO/MEM align in AdjustRootBridgeResource() skipped for Linux Payload?
  b. can you please run ECC to make sure the C source code complains to EDKII coding standard?

2. UefiPayloadPkg: Use legacy timer in Linuxboot payload
  a. Can you kindly explain the reason of HPET timer failure? Is this patch a temporary workaround?

3. UefiPayloadPkg: Update maximum logic processor to 256
  a. It still has the limitation of 256 threads. I am ok with your code change.

4. UefiPayloadPkg: Reserve Payload config in runtime services data
  a. Why?


By the way, can you please add me to the CC list since I am the maintainer of UefiPayloadPkg (newly become so you might not notice that😊) next time you send updates?

Thanks,
ray

-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Cheng-Chieh Huang via groups.io
Sent: Saturday, August 7, 2021 10:51 PM
To: devel@edk2.groups.io
Cc: Cheng-Chieh Huang <chengchieh@google.com>; Schaefer, Daniel <daniel.schaefer@hpe.com>; Trammell Hudson <hudson@trmm.net>; Ma, Maurice <maurice.ma@intel.com>; Dong, Guo <guo.dong@intel.com>; You, Benjamin <benjamin.you@intel.com>
Subject: [edk2-devel] [PATCH v2 0/4] UefiPayloadPkg: LinuxBoot Support in UefiPayload

These are necessary patches to Support LinuxBoot in UefiPayload.
With these paches, we can boot to ESXi and Windows from a linux in QEMU.

This is second parse. In addition to fixing reviwer's suggestions, I removed the following CLs.
* Add DISABLE_MMX_SSE to avoid generating floating points operation
-> will send a seperate patch to add these flags to BaseTools

* LinuxBoot: use a text format for the configuration block.
-> will work with Trammell Hudson to cover this patch to EDK2 style.

LinuxBoot README:
https://github.com/linuxboot/edk2/blob/uefipayload/UefiPayloadPkg/README.md

v2 PR to tianocore:
https://github.com/tianocore/edk2/pull/1873

Cheng-Chieh Huang (4):
  UefiPayloadPkg: Add LINUXBOOT payload target
  UefiPayloadPkg: Use legacy timer in Linuxboot payload
  UefiPayloadPkg: Update maximum logic processor to 256
  UefiPayloadPkg: Reserve Payload config in runtime services data

 UefiPayloadPkg/UefiPayloadPkg.dsc                              |  24 ++-
 UefiPayloadPkg/UefiPayloadPkg.fdf                              |   5 +
 UefiPayloadPkg/Library/LbParseLib/LbParseLib.inf               |  39 +++++
 UefiPayloadPkg/Library/LbParseLib/Linuxboot.h                  |  47 +++++
 UefiPayloadPkg/Library/LbParseLib/LbParseLib.c                 | 182 ++++++++++++++++++++
 UefiPayloadPkg/Library/PciHostBridgeLib/PciHostBridgeSupport.c |   6 +-
 UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c             |   4 +
 7 files changed, 299 insertions(+), 8 deletions(-)  create mode 100644 UefiPayloadPkg/Library/LbParseLib/LbParseLib.inf
 create mode 100644 UefiPayloadPkg/Library/LbParseLib/Linuxboot.h
 create mode 100644 UefiPayloadPkg/Library/LbParseLib/LbParseLib.c

Cc: Cheng-Chieh Huang <chengchieh@google.com>
Cc: Daniel Schaefer <daniel.schaefer@hpe.com>
Cc: Trammell Hudson <hudson@trmm.net>
Cc: Maurice Ma <maurice.ma@intel.com>
Cc: Guo Dong <guo.dong@intel.com>
Cc: Benjamin You <benjamin.you@intel.com>


--
2.32.0.605.g8dce9f2422-goog







^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [edk2-devel] [PATCH v2 0/4] UefiPayloadPkg: LinuxBoot Support in UefiPayload
  2021-08-12  4:49 ` [edk2-devel] " Ni, Ray
@ 2021-08-12  8:51   ` Cheng-Chieh Huang
  2021-08-16  4:42     ` Guo Dong
  0 siblings, 1 reply; 10+ messages in thread
From: Cheng-Chieh Huang @ 2021-08-12  8:51 UTC (permalink / raw)
  To: Ni, Ray
  Cc: devel@edk2.groups.io, Schaefer, Daniel, Trammell Hudson,
	Ma, Maurice, Dong, Guo, You, Benjamin

[-- Attachment #1: Type: text/plain, Size: 5450 bytes --]

Hi Ray,

1. UefiPayloadPkg: Add LINUXBOOT payload target
  a. Why is IO/MEM align in AdjustRootBridgeResource() skipped for Linux
Payload?
-> This alignment is too conservative and causes the system to run out of
IO resources. AFAIK, we do not need this in UEFI OS and our use case
involves larger systems (let's say server) .
  b. can you please run ECC to make sure the C source code complains to
EDKII coding standard?
-> sure will do.

2. UefiPayloadPkg: Use legacy timer in Linuxboot payload
  a. Can you kindly explain the reason of HPET timer failure? Is this patch
a temporary workaround?
 ->  This is taken from OvmfPkg's Xen package. Current Hpet driver does not
work well after we hand over control to OS. Yes we can consider this as a
workaround. This should not affect functionality because we will go back to
the regular TSC/HPET timer in linux after booting to the next OS.

4. UefiPayloadPkg: Reserve Payload config in runtime services data
  a. Why?
-> Currently, due to some design issue, this Hook will also be called in
BDS. Dong said he will work on a fix for this and he suggested that
I gate it LINUXBOOT_PAYLOAD and he will clean it up in his fix.
 For more details, please see earlier mail thread titled [PATCH v1 4/6]
UefiPayloadPkg: Reserve Payload config in runtime services data


> By the way, can you please add me to the CC list since I am the
maintainer of UefiPayloadPkg (newly become so you might not notice that😊)
next time you send updates?
Sure.

--
Cheng-Chieh
On Thu, Aug 12, 2021 at 12:49 PM Ni, Ray <ray.ni@intel.com> wrote:

> I will leave all comments to the patches here since I have difficulty to
> find individual patches without these patches sending to me directly.
>
> In general, the commit messages are too short to explain the
> background/reason of the code change. Can you please put more explanation
> in the commit message?
>
> 1. UefiPayloadPkg: Add LINUXBOOT payload target
>   a. Why is IO/MEM align in AdjustRootBridgeResource() skipped for Linux
> Payload?
>   b. can you please run ECC to make sure the C source code complains to
> EDKII coding standard?
>
> 2. UefiPayloadPkg: Use legacy timer in Linuxboot payload
>   a. Can you kindly explain the reason of HPET timer failure? Is this
> patch a temporary workaround?
>
> 3. UefiPayloadPkg: Update maximum logic processor to 256
>   a. It still has the limitation of 256 threads. I am ok with your code
> change.
>
> 4. UefiPayloadPkg: Reserve Payload config in runtime services data
>   a. Why?
>
>
> By the way, can you please add me to the CC list since I am the maintainer
> of UefiPayloadPkg (newly become so you might not notice that😊) next time
> you send updates?
>
> Thanks,
> ray
>
> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of
> Cheng-Chieh Huang via groups.io
> Sent: Saturday, August 7, 2021 10:51 PM
> To: devel@edk2.groups.io
> Cc: Cheng-Chieh Huang <chengchieh@google.com>; Schaefer, Daniel <
> daniel.schaefer@hpe.com>; Trammell Hudson <hudson@trmm.net>; Ma, Maurice <
> maurice.ma@intel.com>; Dong, Guo <guo.dong@intel.com>; You, Benjamin <
> benjamin.you@intel.com>
> Subject: [edk2-devel] [PATCH v2 0/4] UefiPayloadPkg: LinuxBoot Support in
> UefiPayload
>
> These are necessary patches to Support LinuxBoot in UefiPayload.
> With these paches, we can boot to ESXi and Windows from a linux in QEMU.
>
> This is second parse. In addition to fixing reviwer's suggestions, I
> removed the following CLs.
> * Add DISABLE_MMX_SSE to avoid generating floating points operation
> -> will send a seperate patch to add these flags to BaseTools
>
> * LinuxBoot: use a text format for the configuration block.
> -> will work with Trammell Hudson to cover this patch to EDK2 style.
>
> LinuxBoot README:
> https://github.com/linuxboot/edk2/blob/uefipayload/UefiPayloadPkg/README.md
>
> v2 PR to tianocore:
> https://github.com/tianocore/edk2/pull/1873
>
> Cheng-Chieh Huang (4):
>   UefiPayloadPkg: Add LINUXBOOT payload target
>   UefiPayloadPkg: Use legacy timer in Linuxboot payload
>   UefiPayloadPkg: Update maximum logic processor to 256
>   UefiPayloadPkg: Reserve Payload config in runtime services data
>
>  UefiPayloadPkg/UefiPayloadPkg.dsc                              |  24 ++-
>  UefiPayloadPkg/UefiPayloadPkg.fdf                              |   5 +
>  UefiPayloadPkg/Library/LbParseLib/LbParseLib.inf               |  39 +++++
>  UefiPayloadPkg/Library/LbParseLib/Linuxboot.h                  |  47 +++++
>  UefiPayloadPkg/Library/LbParseLib/LbParseLib.c                 | 182
> ++++++++++++++++++++
>  UefiPayloadPkg/Library/PciHostBridgeLib/PciHostBridgeSupport.c |   6 +-
>  UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c             |   4 +
>  7 files changed, 299 insertions(+), 8 deletions(-)  create mode 100644
> UefiPayloadPkg/Library/LbParseLib/LbParseLib.inf
>  create mode 100644 UefiPayloadPkg/Library/LbParseLib/Linuxboot.h
>  create mode 100644 UefiPayloadPkg/Library/LbParseLib/LbParseLib.c
>
> Cc: Cheng-Chieh Huang <chengchieh@google.com>
> Cc: Daniel Schaefer <daniel.schaefer@hpe.com>
> Cc: Trammell Hudson <hudson@trmm.net>
> Cc: Maurice Ma <maurice.ma@intel.com>
> Cc: Guo Dong <guo.dong@intel.com>
> Cc: Benjamin You <benjamin.you@intel.com>
>
>
> --
> 2.32.0.605.g8dce9f2422-goog
>
>
>
> 
>
>
>

[-- Attachment #2: Type: text/html, Size: 7557 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [edk2-devel] [PATCH v2 0/4] UefiPayloadPkg: LinuxBoot Support in UefiPayload
  2021-08-12  8:51   ` Cheng-Chieh Huang
@ 2021-08-16  4:42     ` Guo Dong
  0 siblings, 0 replies; 10+ messages in thread
From: Guo Dong @ 2021-08-16  4:42 UTC (permalink / raw)
  To: Cheng-Chieh Huang, Ni, Ray
  Cc: devel@edk2.groups.io, Schaefer, Daniel, Trammell Hudson,
	Ma, Maurice, You, Benjamin

[-- Attachment #1: Type: text/plain, Size: 6544 bytes --]


For the HPET timer failure, not sure it has relation with 8259 since OvmfPkg uses 8259 timer by default.
For “Reserve Payload config in runtime services data”, yes, I will remove that WA once platform hook lib is updated late.
This patch logic looks good to me, only some minor coding style issue I added comments in PR. https://github.com/tianocore/edk2/pull/1873/files

Thanks,
Guo

From: Cheng-Chieh Huang <chengchieh@google.com>
Sent: Thursday, August 12, 2021 1:52 AM
To: Ni, Ray <ray.ni@intel.com>
Cc: devel@edk2.groups.io; Schaefer, Daniel <daniel.schaefer@hpe.com>; Trammell Hudson <hudson@trmm.net>; Ma, Maurice <maurice.ma@intel.com>; Dong, Guo <guo.dong@intel.com>; You, Benjamin <benjamin.you@intel.com>
Subject: Re: [edk2-devel] [PATCH v2 0/4] UefiPayloadPkg: LinuxBoot Support in UefiPayload

Hi Ray,

1. UefiPayloadPkg: Add LINUXBOOT payload target
  a. Why is IO/MEM align in AdjustRootBridgeResource() skipped for Linux Payload?
-> This alignment is too conservative and causes the system to run out of IO resources. AFAIK, we do not need this in UEFI OS and our use case involves larger systems (let's say server) .
  b. can you please run ECC to make sure the C source code complains to EDKII coding standard?
-> sure will do.

2. UefiPayloadPkg: Use legacy timer in Linuxboot payload
  a. Can you kindly explain the reason of HPET timer failure? Is this patch a temporary workaround?
 ->  This is taken from OvmfPkg's Xen package. Current Hpet driver does not work well after we hand over control to OS. Yes we can consider this as a workaround. This should not affect functionality because we will go back to the regular TSC/HPET timer in linux after booting to the next OS.

4. UefiPayloadPkg: Reserve Payload config in runtime services data
  a. Why?
-> Currently, due to some design issue, this Hook will also be called in BDS. Dong said he will work on a fix for this and he suggested that I gate it LINUXBOOT_PAYLOAD and he will clean it up in his fix.
 For more details, please see earlier mail thread titled [PATCH v1 4/6] UefiPayloadPkg: Reserve Payload config in runtime services data


> By the way, can you please add me to the CC list since I am the maintainer of UefiPayloadPkg (newly become so you might not notice that😊) next time you send updates?
Sure.

--
Cheng-Chieh
On Thu, Aug 12, 2021 at 12:49 PM Ni, Ray <ray.ni@intel.com<mailto:ray.ni@intel.com>> wrote:
I will leave all comments to the patches here since I have difficulty to find individual patches without these patches sending to me directly.

In general, the commit messages are too short to explain the background/reason of the code change. Can you please put more explanation in the commit message?

1. UefiPayloadPkg: Add LINUXBOOT payload target
  a. Why is IO/MEM align in AdjustRootBridgeResource() skipped for Linux Payload?
  b. can you please run ECC to make sure the C source code complains to EDKII coding standard?

2. UefiPayloadPkg: Use legacy timer in Linuxboot payload
  a. Can you kindly explain the reason of HPET timer failure? Is this patch a temporary workaround?

3. UefiPayloadPkg: Update maximum logic processor to 256
  a. It still has the limitation of 256 threads. I am ok with your code change.

4. UefiPayloadPkg: Reserve Payload config in runtime services data
  a. Why?


By the way, can you please add me to the CC list since I am the maintainer of UefiPayloadPkg (newly become so you might not notice that😊) next time you send updates?

Thanks,
ray

-----Original Message-----
From: devel@edk2.groups.io<mailto:devel@edk2.groups.io> <devel@edk2.groups.io<mailto:devel@edk2.groups.io>> On Behalf Of Cheng-Chieh Huang via groups.io<http://groups.io>
Sent: Saturday, August 7, 2021 10:51 PM
To: devel@edk2.groups.io<mailto:devel@edk2.groups.io>
Cc: Cheng-Chieh Huang <chengchieh@google.com<mailto:chengchieh@google.com>>; Schaefer, Daniel <daniel.schaefer@hpe.com<mailto:daniel.schaefer@hpe.com>>; Trammell Hudson <hudson@trmm.net<mailto:hudson@trmm.net>>; Ma, Maurice <maurice.ma@intel.com<mailto:maurice.ma@intel.com>>; Dong, Guo <guo.dong@intel.com<mailto:guo.dong@intel.com>>; You, Benjamin <benjamin.you@intel.com<mailto:benjamin.you@intel.com>>
Subject: [edk2-devel] [PATCH v2 0/4] UefiPayloadPkg: LinuxBoot Support in UefiPayload

These are necessary patches to Support LinuxBoot in UefiPayload.
With these paches, we can boot to ESXi and Windows from a linux in QEMU.

This is second parse. In addition to fixing reviwer's suggestions, I removed the following CLs.
* Add DISABLE_MMX_SSE to avoid generating floating points operation
-> will send a seperate patch to add these flags to BaseTools

* LinuxBoot: use a text format for the configuration block.
-> will work with Trammell Hudson to cover this patch to EDK2 style.

LinuxBoot README:
https://github.com/linuxboot/edk2/blob/uefipayload/UefiPayloadPkg/README.md

v2 PR to tianocore:
https://github.com/tianocore/edk2/pull/1873

Cheng-Chieh Huang (4):
  UefiPayloadPkg: Add LINUXBOOT payload target
  UefiPayloadPkg: Use legacy timer in Linuxboot payload
  UefiPayloadPkg: Update maximum logic processor to 256
  UefiPayloadPkg: Reserve Payload config in runtime services data

 UefiPayloadPkg/UefiPayloadPkg.dsc                              |  24 ++-
 UefiPayloadPkg/UefiPayloadPkg.fdf                              |   5 +
 UefiPayloadPkg/Library/LbParseLib/LbParseLib.inf               |  39 +++++
 UefiPayloadPkg/Library/LbParseLib/Linuxboot.h                  |  47 +++++
 UefiPayloadPkg/Library/LbParseLib/LbParseLib.c                 | 182 ++++++++++++++++++++
 UefiPayloadPkg/Library/PciHostBridgeLib/PciHostBridgeSupport.c |   6 +-
 UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c             |   4 +
 7 files changed, 299 insertions(+), 8 deletions(-)  create mode 100644 UefiPayloadPkg/Library/LbParseLib/LbParseLib.inf
 create mode 100644 UefiPayloadPkg/Library/LbParseLib/Linuxboot.h
 create mode 100644 UefiPayloadPkg/Library/LbParseLib/LbParseLib.c

Cc: Cheng-Chieh Huang <chengchieh@google.com<mailto:chengchieh@google.com>>
Cc: Daniel Schaefer <daniel.schaefer@hpe.com<mailto:daniel.schaefer@hpe.com>>
Cc: Trammell Hudson <hudson@trmm.net<mailto:hudson@trmm.net>>
Cc: Maurice Ma <maurice.ma@intel.com<mailto:maurice.ma@intel.com>>
Cc: Guo Dong <guo.dong@intel.com<mailto:guo.dong@intel.com>>
Cc: Benjamin You <benjamin.you@intel.com<mailto:benjamin.you@intel.com>>


--
2.32.0.605.g8dce9f2422-goog






[-- Attachment #2: Type: text/html, Size: 12064 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2021-08-16  4:42 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-08-07 14:51 [PATCH v2 0/4] UefiPayloadPkg: LinuxBoot Support in UefiPayload Cheng-Chieh Huang
2021-08-07 14:51 ` [PATCH v2 1/4] UefiPayloadPkg: Add LINUXBOOT payload target Cheng-Chieh Huang
2021-08-07 14:51 ` [PATCH v2 2/4] UefiPayloadPkg: Use legacy timer in Linuxboot payload Cheng-Chieh Huang
2021-08-07 14:51 ` [PATCH v2 3/4] UefiPayloadPkg: Update maximum logic processor to 256 Cheng-Chieh Huang
2021-08-07 14:51 ` [PATCH v2 4/4] UefiPayloadPkg: Reserve Payload config in runtime services data Cheng-Chieh Huang
2021-08-07 15:05 ` [PATCH v2 0/4] UefiPayloadPkg: LinuxBoot Support in UefiPayload Cheng-Chieh Huang
2021-08-07 16:34   ` Guo Dong
2021-08-12  4:49 ` [edk2-devel] " Ni, Ray
2021-08-12  8:51   ` Cheng-Chieh Huang
2021-08-16  4:42     ` Guo Dong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox