rebase patches to ekd2-stable202302

This commit is contained in:
Gerd Hoffmann 2023-03-02 13:01:18 +01:00
parent a698739e9f
commit 0e05742d13
35 changed files with 116 additions and 2606 deletions

View File

@ -1,7 +1,7 @@
From 7dcb09329342195068afc51f590793903af6ac0f Mon Sep 17 00:00:00 2001
From e1e3402a5bf94f2e4a5b67f9587b20ceb4a109ac Mon Sep 17 00:00:00 2001
From: Laszlo Ersek <lersek@redhat.com>
Date: Thu, 4 Jun 2020 13:34:12 +0200
Subject: [PATCH 01/17] BaseTools: do not build BrotliCompress (RH only)
Subject: [PATCH 01/14] BaseTools: do not build BrotliCompress (RH only)
Notes about the RHEL-8.3/20200603-ca407c7246bf [edk2-stable202005] ->
RHEL-8.5/20210520-e1999b264f1f [edk2-stable202105] rebase:
@ -39,5 +39,5 @@ index 5275f657efe8..39d719975309 100644
EfiRom \
GenFfs \
--
2.38.1
2.39.2

View File

@ -1,7 +1,7 @@
From c107b4e09579df67285ee9ef4d904fada23d7c94 Mon Sep 17 00:00:00 2001
From 7115ded03e80aa8f359a9e45979715a8dc47257c Mon Sep 17 00:00:00 2001
From: Laszlo Ersek <lersek@redhat.com>
Date: Thu, 4 Jun 2020 13:39:08 +0200
Subject: [PATCH 02/17] MdeModulePkg: remove package-private Brotli include
Subject: [PATCH 02/14] MdeModulePkg: remove package-private Brotli include
path (RH only)
Notes about the RHEL-8.3/20200603-ca407c7246bf [edk2-stable202005] ->
@ -32,10 +32,10 @@ Signed-off-by: Laszlo Ersek <lersek@redhat.com>
1 file changed, 3 deletions(-)
diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec
index 58e6ab004882..775f1b27af08 100644
index e8058c8bfaec..f33312fb3510 100644
--- a/MdeModulePkg/MdeModulePkg.dec
+++ b/MdeModulePkg/MdeModulePkg.dec
@@ -24,9 +24,6 @@ [Defines]
@@ -25,9 +25,6 @@ [Defines]
[Includes]
Include
@ -46,5 +46,5 @@ index 58e6ab004882..775f1b27af08 100644
## @libraryclass Defines a set of methods to reset whole system.
ResetSystemLib|Include/Library/ResetSystemLib.h
--
2.38.1
2.39.2

View File

@ -1,169 +0,0 @@
From 4f27957c6abb99d8fa59e6d1f6cc58e0769e9588 Mon Sep 17 00:00:00 2001
From: Laszlo Ersek <lersek@redhat.com>
Date: Tue, 25 Feb 2014 18:40:35 +0100
Subject: [PATCH 03/17] MdeModulePkg: TerminalDxe: add other text resolutions
(RHEL only)
Notes about the RHEL-8.3/20200603-ca407c7246bf [edk2-stable202005] ->
RHEL-8.5/20210520-e1999b264f1f [edk2-stable202105] rebase:
- no change
Notes about the RHEL-8.2/20190904-37eef91017ad [edk2-stable201908] ->
RHEL-8.3/20200603-ca407c7246bf [edk2-stable202005] rebase:
- no changes
Notes about the RHEL-8.1/20190308-89910a39dcfd [edk2-stable201903] ->
RHEL-8.2/20190904-37eef91017ad [edk2-stable201908] rebase:
- no changes
Notes about the RHEL-8.0/20180508-ee3198e672e2 ->
RHEL-8.1/20190308-89910a39dcfd rebase:
- no change
Notes about the RHEL-7.6/ovmf-20180508-2.gitee3198e672e2.el7 ->
RHEL-8.0/20180508-ee3198e672e2 rebase:
- reorder the rebase changelog in the commit message so that it reads like
a blog: place more recent entries near the top
- no changes to the patch body
Notes about the 20171011-92d07e48907f -> 20180508-ee3198e672e2 rebase:
- update commit message as requested in
<https://bugzilla.redhat.com/show_bug.cgi?id=1503316#c0>
Notes about the 20170228-c325e41585e3 -> 20171011-92d07e48907f rebase:
- no changes
Notes about the 20160608b-988715a -> 20170228-c325e41585e3 rebase:
- adapt commit 0bc77c63de03 (code and commit message) to upstream commit
390b95a49c14 ("MdeModulePkg/TerminalDxe: Refine
InitializeTerminalConsoleTextMode", 2017-01-10).
When the console output is multiplexed to several devices by
ConSplitterDxe, then ConSplitterDxe builds an intersection of text modes
supported by all console output devices.
Two notable output devices are provided by:
(1) MdeModulePkg/Universal/Console/GraphicsConsoleDxe,
(2) MdeModulePkg/Universal/Console/TerminalDxe.
GraphicsConsoleDxe supports four modes at most -- see
InitializeGraphicsConsoleTextMode() and "mGraphicsConsoleModeData":
(1a) 80x25 (required by the UEFI spec as mode 0),
(1b) 80x50 (not necessarily supported, but if it is, then the UEFI spec
requires the driver to provide it as mode 1),
(1c) 100x31 (corresponding to graphics resolution 800x600, which the UEFI
spec requires from all plug-in graphics devices),
(1d) "full screen" resolution, derived form the underlying GOP's
horizontal and vertical resolutions with division by EFI_GLYPH_WIDTH
(8) and EFI_GLYPH_HEIGHT (19), respectively.
The automatic "full screen resolution" makes GraphicsConsoleDxe's
character console very flexible. However, TerminalDxe (which runs on
serial ports) only provides the following fixed resolutions -- see
InitializeTerminalConsoleTextMode() and "mTerminalConsoleModeData":
(2a) 80x25 (required by the UEFI spec as mode 0),
(2b) 80x50 (since the character resolution of a serial device cannot be
interrogated easily, this is added unconditionally as mode 1),
(2c) 100x31 (since the character resolution of a serial device cannot be
interrogated easily, this is added unconditionally as mode 2).
When ConSplitterDxe combines (1) and (2), multiplexing console output to
both video output and serial terminal, the list of commonly supported text
modes (ie. the "intersection") comprises:
(3a) 80x25, unconditionally, from (1a) and (2a),
(3b) 80x50, if the graphics console provides at least 640x950 pixel
resolution, from (1b) and (2b)
(3c) 100x31, if the graphics device is a plug-in one (because in that case
800x600 is a mandated pixel resolution), from (1c) and (2c).
Unfortunately, the "full screen resolution" (1d) of the GOP-based text
console is not available in general.
Mitigate this problem by extending "mTerminalConsoleModeData" with a
handful of text resolutions that are derived from widespread maximal pixel
resolutions. This way TerminalDxe won't cause ConSplitterDxe to filter out
the most frequent (1d) values from the intersection, and eg. the MODE
command in the UEFI shell will offer the "best" (ie. full screen)
resolution too.
Upstreaming efforts for this patch have been discontinued; it was clear
from the off-list thread that consensus was impossible to reach.
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
(cherry picked from commit 99dc3720ac86059f60156197328cc433603c536e)
(cherry picked from commit d2066c1748f885043026c51dec1bc8d6d406ae8f)
(cherry picked from commit 1facdd58e946c584a3dc1e5be8f2f837b5a7c621)
(cherry picked from commit 28faeb5f94b4866b9da16cf2a1e4e0fc09a26e37)
(cherry picked from commit 4e4e15b80a5b2103eadd495ef4a830d46dd4ed51)
(cherry picked from commit 12cb13a1da913912bd9148ce8f2353a75be77f18)
(cherry picked from commit 82b9edc5fef3a07227a45059bbe821af7b9abd69)
---
.../Universal/Console/TerminalDxe/Terminal.c | 41 +++++++++++++++++--
1 file changed, 38 insertions(+), 3 deletions(-)
diff --git a/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c b/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c
index e2d779c78378..f238c4103b3d 100644
--- a/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c
+++ b/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c
@@ -112,9 +112,44 @@ TERMINAL_DEV mTerminalDevTemplate = {
};
TERMINAL_CONSOLE_MODE_DATA mTerminalConsoleModeData[] = {
- { 80, 25 },
- { 80, 50 },
- { 100, 31 },
+ { 80, 25 }, // from graphics resolution 640 x 480
+ { 80, 50 }, // from graphics resolution 640 x 960
+ { 100, 25 }, // from graphics resolution 800 x 480
+ { 100, 31 }, // from graphics resolution 800 x 600
+ { 104, 32 }, // from graphics resolution 832 x 624
+ { 120, 33 }, // from graphics resolution 960 x 640
+ { 128, 31 }, // from graphics resolution 1024 x 600
+ { 128, 40 }, // from graphics resolution 1024 x 768
+ { 144, 45 }, // from graphics resolution 1152 x 864
+ { 144, 45 }, // from graphics resolution 1152 x 870
+ { 160, 37 }, // from graphics resolution 1280 x 720
+ { 160, 40 }, // from graphics resolution 1280 x 760
+ { 160, 40 }, // from graphics resolution 1280 x 768
+ { 160, 42 }, // from graphics resolution 1280 x 800
+ { 160, 50 }, // from graphics resolution 1280 x 960
+ { 160, 53 }, // from graphics resolution 1280 x 1024
+ { 170, 40 }, // from graphics resolution 1360 x 768
+ { 170, 40 }, // from graphics resolution 1366 x 768
+ { 175, 55 }, // from graphics resolution 1400 x 1050
+ { 180, 47 }, // from graphics resolution 1440 x 900
+ { 200, 47 }, // from graphics resolution 1600 x 900
+ { 200, 63 }, // from graphics resolution 1600 x 1200
+ { 210, 55 }, // from graphics resolution 1680 x 1050
+ { 240, 56 }, // from graphics resolution 1920 x 1080
+ { 240, 63 }, // from graphics resolution 1920 x 1200
+ { 240, 75 }, // from graphics resolution 1920 x 1440
+ { 250, 105 }, // from graphics resolution 2000 x 2000
+ { 256, 80 }, // from graphics resolution 2048 x 1536
+ { 256, 107 }, // from graphics resolution 2048 x 2048
+ { 320, 75 }, // from graphics resolution 2560 x 1440
+ { 320, 84 }, // from graphics resolution 2560 x 1600
+ { 320, 107 }, // from graphics resolution 2560 x 2048
+ { 350, 110 }, // from graphics resolution 2800 x 2100
+ { 400, 126 }, // from graphics resolution 3200 x 2400
+ { 480, 113 }, // from graphics resolution 3840 x 2160
+ { 512, 113 }, // from graphics resolution 4096 x 2160
+ { 960, 227 }, // from graphics resolution 7680 x 4320
+ { 1024, 227 }, // from graphics resolution 8192 x 4320
//
// New modes can be added here.
//
--
2.38.1

View File

@ -1,7 +1,7 @@
From 06b69358fb26eed68b2b9b99735d17ddf1013257 Mon Sep 17 00:00:00 2001
From 84149154c873d3521bf0848d8473f2c09f3ccca0 Mon Sep 17 00:00:00 2001
From: Laszlo Ersek <lersek@redhat.com>
Date: Tue, 25 Feb 2014 22:40:01 +0100
Subject: [PATCH 04/17] MdeModulePkg: TerminalDxe: set xterm resolution on mode
Subject: [PATCH 03/14] MdeModulePkg: TerminalDxe: set xterm resolution on mode
change (RH only)
Notes about the RHEL-8.3/20200603-ca407c7246bf [edk2-stable202005] ->
@ -87,10 +87,10 @@ Signed-off-by: Laszlo Ersek <lersek@redhat.com>
3 files changed, 35 insertions(+)
diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec
index 775f1b27af08..94f3394cef16 100644
index f33312fb3510..020f62fcc668 100644
--- a/MdeModulePkg/MdeModulePkg.dec
+++ b/MdeModulePkg/MdeModulePkg.dec
@@ -2099,6 +2099,10 @@ [PcdsFixedAtBuild, PcdsPatchableInModule, PcdsDynamic, PcdsDynamicEx]
@@ -2102,6 +2102,10 @@ [PcdsFixedAtBuild, PcdsPatchableInModule, PcdsDynamic, PcdsDynamicEx]
# @Prompt The shared bit mask when Intel Tdx is enabled.
gEfiMdeModulePkgTokenSpaceGuid.PcdTdxSharedBitMask|0x0|UINT64|0x10000025
@ -176,5 +176,5 @@ index 7809869e7d49..496849458db4 100644
Status = This->ClearScreen (This);
--
2.38.1
2.39.2

View File

@ -1,7 +1,7 @@
From 71fa9595fe0ac39bb755eba385559bf8d7f4da5a Mon Sep 17 00:00:00 2001
From defcdb8fe170e58cb0b0de8ddd2784bcc2dd67d7 Mon Sep 17 00:00:00 2001
From: Laszlo Ersek <lersek@redhat.com>
Date: Wed, 14 Oct 2015 15:59:06 +0200
Subject: [PATCH 05/17] OvmfPkg: take PcdResizeXterm from the QEMU command line
Subject: [PATCH 04/14] OvmfPkg: take PcdResizeXterm from the QEMU command line
(RH only)
edk2-stable202205 rebase
@ -88,10 +88,10 @@ Signed-off-by: Laszlo Ersek <lersek@redhat.com>
9 files changed, 21 insertions(+)
diff --git a/OvmfPkg/AmdSev/AmdSevX64.dsc b/OvmfPkg/AmdSev/AmdSevX64.dsc
index 8f7cae787e97..41ad97b47dc9 100644
index 1cebd6b4bcc2..0bec51d5eeac 100644
--- a/OvmfPkg/AmdSev/AmdSevX64.dsc
+++ b/OvmfPkg/AmdSev/AmdSevX64.dsc
@@ -475,6 +475,7 @@ [PcdsFixedAtBuild]
@@ -477,6 +477,7 @@ [PcdsFixedAtBuild]
[PcdsDynamicDefault]
gEfiMdeModulePkgTokenSpaceGuid.PcdEmuVariableNvStoreReserved|0
@ -100,10 +100,10 @@ index 8f7cae787e97..41ad97b47dc9 100644
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase64|0
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase64|0
diff --git a/OvmfPkg/CloudHv/CloudHvX64.dsc b/OvmfPkg/CloudHv/CloudHvX64.dsc
index ce277cb2398b..faab59ae8d74 100644
index fda7d2b9e52f..97a74cfb07e4 100644
--- a/OvmfPkg/CloudHv/CloudHvX64.dsc
+++ b/OvmfPkg/CloudHv/CloudHvX64.dsc
@@ -582,6 +582,7 @@ [PcdsDynamicDefault]
@@ -587,6 +587,7 @@ [PcdsDynamicDefault]
# ($(SMM_REQUIRE) == FALSE)
gEfiMdeModulePkgTokenSpaceGuid.PcdEmuVariableNvStoreReserved|0
@ -112,10 +112,10 @@ index ce277cb2398b..faab59ae8d74 100644
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase64|0
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase64|0
diff --git a/OvmfPkg/IntelTdx/IntelTdxX64.dsc b/OvmfPkg/IntelTdx/IntelTdxX64.dsc
index 345892651520..4c4da09b9024 100644
index 95b9594ddce0..bf4bf4cb1d4c 100644
--- a/OvmfPkg/IntelTdx/IntelTdxX64.dsc
+++ b/OvmfPkg/IntelTdx/IntelTdxX64.dsc
@@ -474,6 +474,7 @@ [PcdsDynamicDefault]
@@ -485,6 +485,7 @@ [PcdsDynamicDefault]
# ($(SMM_REQUIRE) == FALSE)
gEfiMdeModulePkgTokenSpaceGuid.PcdEmuVariableNvStoreReserved|0
@ -124,10 +124,10 @@ index 345892651520..4c4da09b9024 100644
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase64|0
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase64|0
diff --git a/OvmfPkg/Microvm/MicrovmX64.dsc b/OvmfPkg/Microvm/MicrovmX64.dsc
index 994a02d30107..3444304d0e46 100644
index 0d65d21e651c..f123ca853085 100644
--- a/OvmfPkg/Microvm/MicrovmX64.dsc
+++ b/OvmfPkg/Microvm/MicrovmX64.dsc
@@ -580,6 +580,7 @@ [PcdsDynamicDefault]
@@ -585,6 +585,7 @@ [PcdsDynamicDefault]
# ($(SMM_REQUIRE) == FALSE)
gEfiMdeModulePkgTokenSpaceGuid.PcdEmuVariableNvStoreReserved|0
@ -136,10 +136,10 @@ index 994a02d30107..3444304d0e46 100644
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase64|0
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase64|0
diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc
index 6f774baf90f5..e8a074153a77 100644
index 22dc29330d2d..9242e7714036 100644
--- a/OvmfPkg/OvmfPkgIa32.dsc
+++ b/OvmfPkg/OvmfPkgIa32.dsc
@@ -601,6 +601,7 @@ [PcdsDynamicDefault]
@@ -606,6 +606,7 @@ [PcdsDynamicDefault]
# ($(SMM_REQUIRE) == FALSE)
gEfiMdeModulePkgTokenSpaceGuid.PcdEmuVariableNvStoreReserved|0
@ -148,10 +148,10 @@ index 6f774baf90f5..e8a074153a77 100644
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase64|0
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase64|0
diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc
index c851764dec05..0197997793a9 100644
index 6b539814bdb0..43d40ddc9c46 100644
--- a/OvmfPkg/OvmfPkgIa32X64.dsc
+++ b/OvmfPkg/OvmfPkgIa32X64.dsc
@@ -609,6 +609,7 @@ [PcdsDynamicDefault]
@@ -613,6 +613,7 @@ [PcdsDynamicDefault]
# ($(SMM_REQUIRE) == FALSE)
gEfiMdeModulePkgTokenSpaceGuid.PcdEmuVariableNvStoreReserved|0
@ -160,10 +160,10 @@ index c851764dec05..0197997793a9 100644
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase64|0
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase64|0
diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc
index 63c3a47aea30..fade13b4e80c 100644
index e3c64456dfef..231e5e7e4d1c 100644
--- a/OvmfPkg/OvmfPkgX64.dsc
+++ b/OvmfPkg/OvmfPkgX64.dsc
@@ -631,6 +631,7 @@ [PcdsDynamicDefault]
@@ -636,6 +636,7 @@ [PcdsDynamicDefault]
# ($(SMM_REQUIRE) == FALSE)
gEfiMdeModulePkgTokenSpaceGuid.PcdEmuVariableNvStoreReserved|0
@ -184,7 +184,7 @@ index 1fadadeb5565..3e28e1596d32 100644
gEfiMdeModulePkgTokenSpaceGuid.PcdUse1GPageTable
gEfiMdeModulePkgTokenSpaceGuid.PcdSetNxForStack
diff --git a/OvmfPkg/PlatformPei/Platform.c b/OvmfPkg/PlatformPei/Platform.c
index b1f8140d6041..e5132d95a8f8 100644
index 148240342b4b..d324ae95f8f5 100644
--- a/OvmfPkg/PlatformPei/Platform.c
+++ b/OvmfPkg/PlatformPei/Platform.c
@@ -41,6 +41,18 @@
@ -203,17 +203,17 @@ index b1f8140d6041..e5132d95a8f8 100644
+ } \
+ } while (0)
+
EFI_HOB_PLATFORM_INFO mPlatformInfoHob = { 0 };
EFI_PEI_PPI_DESCRIPTOR mPpiBootMode[] = {
@@ -376,6 +388,7 @@ InitializePlatform (
MemTypeInfoInitialization ();
MemMapInitialization (&mPlatformInfoHob);
NoexecDxeInitialization ();
{
EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST,
@@ -385,6 +397,7 @@ InitializePlatform (
MemTypeInfoInitialization (PlatformInfoHob);
MemMapInitialization (PlatformInfoHob);
NoexecDxeInitialization (PlatformInfoHob);
+ UPDATE_BOOLEAN_PCD_FROM_FW_CFG (PcdResizeXterm);
}
InstallClearCacheCallback ();
--
2.38.1
2.39.2

View File

@ -1,7 +1,7 @@
From 643aed66df8d427f8912f74326140b74915e73f9 Mon Sep 17 00:00:00 2001
From 2d09cde35ac031aabf7a1dc09c8c8a5e65917ae8 Mon Sep 17 00:00:00 2001
From: Laszlo Ersek <lersek@redhat.com>
Date: Sun, 26 Jul 2015 08:02:50 +0000
Subject: [PATCH 06/17] ArmVirtPkg: take PcdResizeXterm from the QEMU command
Subject: [PATCH 05/14] ArmVirtPkg: take PcdResizeXterm from the QEMU command
line (RH only)
Notes about the RHEL-8.3/20200603-ca407c7246bf [edk2-stable202005] ->
@ -96,19 +96,19 @@ Signed-off-by: Laszlo Ersek <lersek@redhat.com>
create mode 100644 ArmVirtPkg/Library/TerminalPcdProducerLib/TerminalPcdProducerLib.c
diff --git a/ArmVirtPkg/ArmVirtQemu.dsc b/ArmVirtPkg/ArmVirtQemu.dsc
index f77443229e8e..ed66f0003082 100644
index 72a0cacab4a8..7a3be7e8592c 100644
--- a/ArmVirtPkg/ArmVirtQemu.dsc
+++ b/ArmVirtPkg/ArmVirtQemu.dsc
@@ -299,6 +299,8 @@ [PcdsPatchableInModule]
@@ -304,6 +304,8 @@ [PcdsPatchableInModule]
gEfiSecurityPkgTokenSpaceGuid.PcdTpmBaseAddress|0x0
!endif
+ gEfiMdeModulePkgTokenSpaceGuid.PcdResizeXterm|FALSE
+
[PcdsDynamicHii]
gArmVirtTokenSpaceGuid.PcdForceNoAcpi|L"ForceNoAcpi"|gArmVirtVariableGuid|0x0|FALSE|NV,BS
gUefiOvmfPkgTokenSpaceGuid.PcdForceNoAcpi|L"ForceNoAcpi"|gOvmfVariableGuid|0x0|FALSE|NV,BS
@@ -413,7 +415,10 @@ [Components.common]
@@ -418,7 +420,10 @@ [Components.common]
MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf
MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe.inf
MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe.inf
@ -200,5 +200,5 @@ index 000000000000..bfd3a6a535f9
+ return RETURN_SUCCESS;
+}
--
2.38.1
2.39.2

View File

@ -1,7 +1,7 @@
From f934be726d47dea28664f46ea2e989b5a043cb5c Mon Sep 17 00:00:00 2001
From 9070eb8deb0a973e9dd8f96b70955c7d3abca074 Mon Sep 17 00:00:00 2001
From: Paolo Bonzini <pbonzini@redhat.com>
Date: Tue, 21 Nov 2017 00:57:45 +0100
Subject: [PATCH 07/17] OvmfPkg: enable DEBUG_VERBOSE (RHEL only)
Subject: [PATCH 06/14] OvmfPkg: enable DEBUG_VERBOSE (RHEL only)
Notes about the RHEL-8.3/20200603-ca407c7246bf [edk2-stable202005] ->
RHEL-8.5/20210520-e1999b264f1f [edk2-stable202105] rebase:
@ -65,10 +65,10 @@ Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/OvmfPkg/AmdSev/AmdSevX64.dsc b/OvmfPkg/AmdSev/AmdSevX64.dsc
index 41ad97b47dc9..53a8938965ea 100644
index 0bec51d5eeac..ae3f9c75c4a4 100644
--- a/OvmfPkg/AmdSev/AmdSevX64.dsc
+++ b/OvmfPkg/AmdSev/AmdSevX64.dsc
@@ -427,7 +427,7 @@ [PcdsFixedAtBuild]
@@ -429,7 +429,7 @@ [PcdsFixedAtBuild]
# DEBUG_VERBOSE 0x00400000 // Detailed debug messages that may
# // significantly impact boot performance
# DEBUG_ERROR 0x80000000 // Error
@ -78,10 +78,10 @@ index 41ad97b47dc9..53a8938965ea 100644
!if $(SOURCE_DEBUG_ENABLE) == TRUE
gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x17
diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc
index e8a074153a77..7bced89f2a6b 100644
index 9242e7714036..bb3b0c1c96f3 100644
--- a/OvmfPkg/OvmfPkgIa32.dsc
+++ b/OvmfPkg/OvmfPkgIa32.dsc
@@ -541,7 +541,7 @@ [PcdsFixedAtBuild]
@@ -546,7 +546,7 @@ [PcdsFixedAtBuild]
# DEBUG_VERBOSE 0x00400000 // Detailed debug messages that may
# // significantly impact boot performance
# DEBUG_ERROR 0x80000000 // Error
@ -91,10 +91,10 @@ index e8a074153a77..7bced89f2a6b 100644
!if $(SOURCE_DEBUG_ENABLE) == TRUE
gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x17
diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc
index 0197997793a9..2599facbb7cd 100644
index 43d40ddc9c46..19b968bd945d 100644
--- a/OvmfPkg/OvmfPkgIa32X64.dsc
+++ b/OvmfPkg/OvmfPkgIa32X64.dsc
@@ -547,7 +547,7 @@ [PcdsFixedAtBuild]
@@ -551,7 +551,7 @@ [PcdsFixedAtBuild]
# DEBUG_VERBOSE 0x00400000 // Detailed debug messages that may
# // significantly impact boot performance
# DEBUG_ERROR 0x80000000 // Error
@ -104,10 +104,10 @@ index 0197997793a9..2599facbb7cd 100644
!if $(SOURCE_DEBUG_ENABLE) == TRUE
gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x17
diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc
index fade13b4e80c..7bd445ca36f7 100644
index 231e5e7e4d1c..876f2374a2cc 100644
--- a/OvmfPkg/OvmfPkgX64.dsc
+++ b/OvmfPkg/OvmfPkgX64.dsc
@@ -567,7 +567,7 @@ [PcdsFixedAtBuild]
@@ -572,7 +572,7 @@ [PcdsFixedAtBuild]
# DEBUG_VERBOSE 0x00400000 // Detailed debug messages that may
# // significantly impact boot performance
# DEBUG_ERROR 0x80000000 // Error
@ -117,5 +117,5 @@ index fade13b4e80c..7bd445ca36f7 100644
!if $(SOURCE_DEBUG_ENABLE) == TRUE
gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x17
--
2.38.1
2.39.2

View File

@ -1,7 +1,7 @@
From 75e3104437472cd3a83b9be7613b935daeacfd45 Mon Sep 17 00:00:00 2001
From ea0ec39c85e21daa5b4f31884ee1e4a198c78fcd Mon Sep 17 00:00:00 2001
From: Paolo Bonzini <pbonzini@redhat.com>
Date: Tue, 21 Nov 2017 00:57:46 +0100
Subject: [PATCH 08/17] OvmfPkg: silence DEBUG_VERBOSE (0x00400000) in
Subject: [PATCH 07/14] OvmfPkg: silence DEBUG_VERBOSE (0x00400000) in
QemuVideoDxe/QemuRamfbDxe (RH)
Notes about the RHEL-8.3/20200603-ca407c7246bf [edk2-stable202005] ->
@ -82,10 +82,10 @@ Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4 files changed, 32 insertions(+), 8 deletions(-)
diff --git a/OvmfPkg/AmdSev/AmdSevX64.dsc b/OvmfPkg/AmdSev/AmdSevX64.dsc
index 53a8938965ea..f5133a801f8f 100644
index ae3f9c75c4a4..c7d7add60d44 100644
--- a/OvmfPkg/AmdSev/AmdSevX64.dsc
+++ b/OvmfPkg/AmdSev/AmdSevX64.dsc
@@ -677,8 +677,14 @@ [Components]
@@ -682,8 +682,14 @@ [Components]
MdeModulePkg/Universal/DisplayEngineDxe/DisplayEngineDxe.inf
MdeModulePkg/Universal/MemoryTest/NullMemoryTestDxe/NullMemoryTestDxe.inf
@ -103,10 +103,10 @@ index 53a8938965ea..f5133a801f8f 100644
#
diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc
index 7bced89f2a6b..1d271a3bdcab 100644
index bb3b0c1c96f3..30b843d2287a 100644
--- a/OvmfPkg/OvmfPkgIa32.dsc
+++ b/OvmfPkg/OvmfPkgIa32.dsc
@@ -846,9 +846,15 @@ [Components]
@@ -851,9 +851,15 @@ [Components]
MdeModulePkg/Universal/MemoryTest/NullMemoryTestDxe/NullMemoryTestDxe.inf
!ifndef $(CSM_ENABLE)
@ -125,10 +125,10 @@ index 7bced89f2a6b..1d271a3bdcab 100644
#
diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc
index 2599facbb7cd..240bc43d14c6 100644
index 19b968bd945d..2327c5c29611 100644
--- a/OvmfPkg/OvmfPkgIa32X64.dsc
+++ b/OvmfPkg/OvmfPkgIa32X64.dsc
@@ -860,9 +860,15 @@ [Components.X64]
@@ -864,9 +864,15 @@ [Components.X64]
MdeModulePkg/Universal/MemoryTest/NullMemoryTestDxe/NullMemoryTestDxe.inf
!ifndef $(CSM_ENABLE)
@ -147,10 +147,10 @@ index 2599facbb7cd..240bc43d14c6 100644
#
diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc
index 7bd445ca36f7..7c6faba9509b 100644
index 876f2374a2cc..49b914c29f35 100644
--- a/OvmfPkg/OvmfPkgX64.dsc
+++ b/OvmfPkg/OvmfPkgX64.dsc
@@ -928,9 +928,15 @@ [Components]
@@ -937,9 +937,15 @@ [Components]
MdeModulePkg/Universal/MemoryTest/NullMemoryTestDxe/NullMemoryTestDxe.inf
!ifndef $(CSM_ENABLE)
@ -169,5 +169,5 @@ index 7bd445ca36f7..7c6faba9509b 100644
#
--
2.38.1
2.39.2

View File

@ -1,7 +1,7 @@
From aede9477834cf0495425750cbf3ce2cefa208828 Mon Sep 17 00:00:00 2001
From a7f8d385ac55fce62cc5a9a1608e4d085801e6f3 Mon Sep 17 00:00:00 2001
From: Laszlo Ersek <lersek@redhat.com>
Date: Wed, 27 Jan 2016 03:05:18 +0100
Subject: [PATCH 09/17] ArmVirtPkg: silence DEBUG_VERBOSE (0x00400000) in
Subject: [PATCH 08/14] ArmVirtPkg: silence DEBUG_VERBOSE (0x00400000) in
QemuRamfbDxe (RH only)
Notes about the RHEL-8.3/20200603-ca407c7246bf [edk2-stable202005] ->
@ -61,10 +61,10 @@ Signed-off-by: Laszlo Ersek <lersek@redhat.com>
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/ArmVirtPkg/ArmVirtQemu.dsc b/ArmVirtPkg/ArmVirtQemu.dsc
index ed66f0003082..a3d744931a15 100644
index 7a3be7e8592c..865172c5d56b 100644
--- a/ArmVirtPkg/ArmVirtQemu.dsc
+++ b/ArmVirtPkg/ArmVirtQemu.dsc
@@ -537,7 +537,10 @@ [Components.common]
@@ -546,7 +546,10 @@ [Components.common]
#
# Video support
#
@ -77,10 +77,10 @@ index ed66f0003082..a3d744931a15 100644
OvmfPkg/PlatformDxe/Platform.inf
diff --git a/ArmVirtPkg/ArmVirtQemuKernel.dsc b/ArmVirtPkg/ArmVirtQemuKernel.dsc
index f5db3ac432f3..ff3e6c5974b6 100644
index 3cb9120e4e10..02877284bfa3 100644
--- a/ArmVirtPkg/ArmVirtQemuKernel.dsc
+++ b/ArmVirtPkg/ArmVirtQemuKernel.dsc
@@ -440,7 +440,10 @@ [Components.common]
@@ -444,7 +444,10 @@ [Components.common]
#
# Video support
#
@ -93,5 +93,5 @@ index f5db3ac432f3..ff3e6c5974b6 100644
OvmfPkg/PlatformDxe/Platform.inf
--
2.38.1
2.39.2

View File

@ -1,7 +1,7 @@
From a8048db38e11d9b4cbcde3addf907455833be332 Mon Sep 17 00:00:00 2001
From 08c466269cf4728e954d61c1801b0eb6ca4175ff Mon Sep 17 00:00:00 2001
From: Philippe Mathieu-Daude <philmd@redhat.com>
Date: Thu, 1 Aug 2019 20:43:48 +0200
Subject: [PATCH 10/17] OvmfPkg: QemuRamfbDxe: Do not report DXE failure on
Subject: [PATCH 09/14] OvmfPkg: QemuRamfbDxe: Do not report DXE failure on
Aarch64 silent builds (RH only)
Notes about the RHEL-8.3/20200603-ca407c7246bf [edk2-stable202005] ->
@ -92,5 +92,5 @@ index f5113fbc78a6..0295986fe0f1 100644
}
--
2.38.1
2.39.2

View File

@ -1,7 +1,7 @@
From 7a001a5ba349a3b425f6da1df561a5a1a272a0ca Mon Sep 17 00:00:00 2001
From ce8bf8cbb5ad81677c2b632b98f527a1d9fda3b1 Mon Sep 17 00:00:00 2001
From: Paolo Bonzini <pbonzini@redhat.com>
Date: Tue, 21 Nov 2017 00:57:47 +0100
Subject: [PATCH 11/17] OvmfPkg: silence EFI_D_VERBOSE (0x00400000) in
Subject: [PATCH 10/14] OvmfPkg: silence EFI_D_VERBOSE (0x00400000) in
NvmExpressDxe (RH only)
Notes about the RHEL-8.3/20200603-ca407c7246bf [edk2-stable202005] ->
@ -63,10 +63,10 @@ Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/OvmfPkg/AmdSev/AmdSevX64.dsc b/OvmfPkg/AmdSev/AmdSevX64.dsc
index f5133a801f8f..05908a72270f 100644
index c7d7add60d44..2ea6fad2018a 100644
--- a/OvmfPkg/AmdSev/AmdSevX64.dsc
+++ b/OvmfPkg/AmdSev/AmdSevX64.dsc
@@ -671,7 +671,10 @@ [Components]
@@ -676,7 +676,10 @@ [Components]
OvmfPkg/SataControllerDxe/SataControllerDxe.inf
MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.inf
MdeModulePkg/Bus/Ata/AtaBusDxe/AtaBusDxe.inf
@ -79,10 +79,10 @@ index f5133a801f8f..05908a72270f 100644
MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf
MdeModulePkg/Universal/DisplayEngineDxe/DisplayEngineDxe.inf
diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc
index 1d271a3bdcab..9c0fb7d545b8 100644
index 30b843d2287a..db1cde0a3b03 100644
--- a/OvmfPkg/OvmfPkgIa32.dsc
+++ b/OvmfPkg/OvmfPkgIa32.dsc
@@ -839,7 +839,10 @@ [Components]
@@ -844,7 +844,10 @@ [Components]
OvmfPkg/SataControllerDxe/SataControllerDxe.inf
MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.inf
MdeModulePkg/Bus/Ata/AtaBusDxe/AtaBusDxe.inf
@ -95,10 +95,10 @@ index 1d271a3bdcab..9c0fb7d545b8 100644
MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf
MdeModulePkg/Universal/DisplayEngineDxe/DisplayEngineDxe.inf
diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc
index 240bc43d14c6..8b93437044e7 100644
index 2327c5c29611..938eaba74ad4 100644
--- a/OvmfPkg/OvmfPkgIa32X64.dsc
+++ b/OvmfPkg/OvmfPkgIa32X64.dsc
@@ -853,7 +853,10 @@ [Components.X64]
@@ -857,7 +857,10 @@ [Components.X64]
OvmfPkg/SataControllerDxe/SataControllerDxe.inf
MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.inf
MdeModulePkg/Bus/Ata/AtaBusDxe/AtaBusDxe.inf
@ -111,10 +111,10 @@ index 240bc43d14c6..8b93437044e7 100644
MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf
MdeModulePkg/Universal/DisplayEngineDxe/DisplayEngineDxe.inf
diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc
index 7c6faba9509b..8c9162db1743 100644
index 49b914c29f35..91fbe83bfac1 100644
--- a/OvmfPkg/OvmfPkgX64.dsc
+++ b/OvmfPkg/OvmfPkgX64.dsc
@@ -921,7 +921,10 @@ [Components]
@@ -930,7 +930,10 @@ [Components]
OvmfPkg/SataControllerDxe/SataControllerDxe.inf
MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.inf
MdeModulePkg/Bus/Ata/AtaBusDxe/AtaBusDxe.inf
@ -127,5 +127,5 @@ index 7c6faba9509b..8c9162db1743 100644
MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf
MdeModulePkg/Universal/DisplayEngineDxe/DisplayEngineDxe.inf
--
2.38.1
2.39.2

View File

@ -1,7 +1,7 @@
From 72c050576a41a14915f02a2c243cd41b22ad2384 Mon Sep 17 00:00:00 2001
From 586d6536227c0fd176a1567b9a59345de348d472 Mon Sep 17 00:00:00 2001
From: Laszlo Ersek <lersek@redhat.com>
Date: Sat, 16 Nov 2019 17:11:27 +0100
Subject: [PATCH 12/17] CryptoPkg/OpensslLib: list RHEL8-specific OpenSSL files
Subject: [PATCH 11/14] CryptoPkg/OpensslLib: list RHEL8-specific OpenSSL files
in the INFs (RH)
Notes about the RHEL-8.3/20200603-ca407c7246bf [edk2-stable202005] ->
@ -126,19 +126,20 @@ Signed-off-by: Laszlo Ersek <lersek@redhat.com>
(cherry picked from commit 57bd3f146590df8757865d8f2cdd1db3cf3f4d40)
(cherry picked from commit 56c4bb81b311dfcee6a34c81d3e4feeda7f88995)
---
CryptoPkg/Library/OpensslLib/OpensslLib.inf | 11 +++++++++++
CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf | 11 +++++++++++
2 files changed, 22 insertions(+)
CryptoPkg/Library/OpensslLib/OpensslLib.inf | 12 ++++++++++++
CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf | 12 ++++++++++++
2 files changed, 24 insertions(+)
diff --git a/CryptoPkg/Library/OpensslLib/OpensslLib.inf b/CryptoPkg/Library/OpensslLib/OpensslLib.inf
index 60c6c24b0a67..e446b51e66cd 100644
index 60c6c24b0a67..7e78255467b1 100644
--- a/CryptoPkg/Library/OpensslLib/OpensslLib.inf
+++ b/CryptoPkg/Library/OpensslLib/OpensslLib.inf
@@ -575,6 +575,17 @@ [Sources]
@@ -575,6 +575,18 @@ [Sources]
$(OPENSSL_PATH)/ssl/statem/statem.h
$(OPENSSL_PATH)/ssl/statem/statem_local.h
# Autogenerated files list ends here
+# RHEL8-specific OpenSSL file list starts here
+ $(OPENSSL_PATH)/crypto/bn/rsa_sup_mul.c
+ $(OPENSSL_PATH)/crypto/evp/kdf_lib.c
+ $(OPENSSL_PATH)/crypto/evp/pkey_kdf.c
+ $(OPENSSL_PATH)/crypto/kdf/kbkdf.c
@ -153,14 +154,15 @@ index 60c6c24b0a67..e446b51e66cd 100644
ossl_store.c
rand_pool.c
diff --git a/CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf b/CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf
index c4eaea888c1a..c207dc8f4cfd 100644
index c4eaea888c1a..1c551cb0990c 100644
--- a/CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf
+++ b/CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf
@@ -525,6 +525,17 @@ [Sources]
@@ -525,6 +525,18 @@ [Sources]
$(OPENSSL_PATH)/crypto/x509v3/standard_exts.h
$(OPENSSL_PATH)/crypto/x509v3/v3_admis.h
# Autogenerated files list ends here
+# RHEL8-specific OpenSSL file list starts here
+ $(OPENSSL_PATH)/crypto/bn/rsa_sup_mul.c
+ $(OPENSSL_PATH)/crypto/evp/kdf_lib.c
+ $(OPENSSL_PATH)/crypto/evp/pkey_kdf.c
+ $(OPENSSL_PATH)/crypto/kdf/kbkdf.c
@ -175,5 +177,5 @@ index c4eaea888c1a..c207dc8f4cfd 100644
ossl_store.c
rand_pool.c
--
2.38.1
2.39.2

View File

@ -1,7 +1,7 @@
From 2998ee646f22dc7acddcad7725c1b8d2de5b0130 Mon Sep 17 00:00:00 2001
From b748f55a0018d1766e46d27eedf7806c95d90075 Mon Sep 17 00:00:00 2001
From: Laszlo Ersek <lersek@redhat.com>
Date: Wed, 24 Jun 2020 11:31:36 +0200
Subject: [PATCH 13/17] OvmfPkg/QemuKernelLoaderFsDxe: suppress error on no
Subject: [PATCH 12/14] OvmfPkg/QemuKernelLoaderFsDxe: suppress error on no
"-kernel" in silent aa64 build (RH)
Notes about the RHEL-8.3/20200603-ca407c7246bf [edk2-stable202005] ->
@ -80,5 +80,5 @@ index d4f3cd92255f..f007f8a6c233 100644
}
--
2.38.1
2.39.2

View File

@ -1,7 +1,7 @@
From 55492cd43586befec40b2ff13ea202db0427eb28 Mon Sep 17 00:00:00 2001
From 8d5230a47e76ce2a10d722f1fb0349650c4287ed Mon Sep 17 00:00:00 2001
From: Laszlo Ersek <lersek@redhat.com>
Date: Wed, 24 Jun 2020 11:40:09 +0200
Subject: [PATCH 14/17] SecurityPkg/Tcg2Dxe: suppress error on no swtpm in
Subject: [PATCH 13/14] SecurityPkg/Tcg2Dxe: suppress error on no swtpm in
silent aa64 build (RH)
Notes about the RHEL-8.3/20200603-ca407c7246bf [edk2-stable202005] ->
@ -78,5 +78,5 @@ index f6ea8b2bbf18..681eb7e08b98 100644
}
--
2.38.1
2.39.2

View File

@ -1,78 +0,0 @@
From b1019e386b52d7d221a5349ec9c26145d9a45497 Mon Sep 17 00:00:00 2001
From: Paolo Bonzini <pbonzini@redhat.com>
Date: Thu, 16 Aug 2018 15:45:47 -0400
Subject: [PATCH 15/17] Tweak the tools_def to support cross-compiling.
These files are meant for customization, so this is not upstream.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
---
BaseTools/Conf/tools_def.template | 44 +++++++++++++++----------------
1 file changed, 22 insertions(+), 22 deletions(-)
diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.template
index c4e4c7ded0af..f19c59039921 100755
--- a/BaseTools/Conf/tools_def.template
+++ b/BaseTools/Conf/tools_def.template
@@ -2294,17 +2294,17 @@ RELEASE_GCC49_AARCH64_DLINK_XIPFLAGS = -z common-page-size=0x20
##################
# GCC5 IA32 definitions
##################
-*_GCC5_IA32_OBJCOPY_PATH = DEF(GCC5_IA32_PREFIX)objcopy
-*_GCC5_IA32_CC_PATH = DEF(GCC5_IA32_PREFIX)gcc
-*_GCC5_IA32_SLINK_PATH = DEF(GCC5_IA32_PREFIX)gcc-ar
-*_GCC5_IA32_DLINK_PATH = DEF(GCC5_IA32_PREFIX)gcc
-*_GCC5_IA32_ASLDLINK_PATH = DEF(GCC5_IA32_PREFIX)gcc
-*_GCC5_IA32_ASM_PATH = DEF(GCC5_IA32_PREFIX)gcc
-*_GCC5_IA32_PP_PATH = DEF(GCC5_IA32_PREFIX)gcc
-*_GCC5_IA32_VFRPP_PATH = DEF(GCC5_IA32_PREFIX)gcc
-*_GCC5_IA32_ASLCC_PATH = DEF(GCC5_IA32_PREFIX)gcc
-*_GCC5_IA32_ASLPP_PATH = DEF(GCC5_IA32_PREFIX)gcc
-*_GCC5_IA32_RC_PATH = DEF(GCC5_IA32_PREFIX)objcopy
+*_GCC5_IA32_OBJCOPY_PATH = ENV(GCC5_IA32_PREFIX)objcopy
+*_GCC5_IA32_CC_PATH = ENV(GCC5_IA32_PREFIX)gcc
+*_GCC5_IA32_SLINK_PATH = ENV(GCC5_IA32_PREFIX)gcc-ar
+*_GCC5_IA32_DLINK_PATH = ENV(GCC5_IA32_PREFIX)gcc
+*_GCC5_IA32_ASLDLINK_PATH = ENV(GCC5_IA32_PREFIX)gcc
+*_GCC5_IA32_ASM_PATH = ENV(GCC5_IA32_PREFIX)gcc
+*_GCC5_IA32_PP_PATH = ENV(GCC5_IA32_PREFIX)gcc
+*_GCC5_IA32_VFRPP_PATH = ENV(GCC5_IA32_PREFIX)gcc
+*_GCC5_IA32_ASLCC_PATH = ENV(GCC5_IA32_PREFIX)gcc
+*_GCC5_IA32_ASLPP_PATH = ENV(GCC5_IA32_PREFIX)gcc
+*_GCC5_IA32_RC_PATH = ENV(GCC5_IA32_PREFIX)objcopy
*_GCC5_IA32_ASLCC_FLAGS = DEF(GCC5_ASLCC_FLAGS) -m32
*_GCC5_IA32_ASLDLINK_FLAGS = DEF(GCC5_IA32_X64_ASLDLINK_FLAGS) -Wl,-m,elf_i386 -no-pie
@@ -2326,17 +2326,17 @@ RELEASE_GCC5_IA32_DLINK_FLAGS = DEF(GCC5_IA32_X64_DLINK_FLAGS) -flto -Os -Wl,
##################
# GCC5 X64 definitions
##################
-*_GCC5_X64_OBJCOPY_PATH = DEF(GCC5_X64_PREFIX)objcopy
-*_GCC5_X64_CC_PATH = DEF(GCC5_X64_PREFIX)gcc
-*_GCC5_X64_SLINK_PATH = DEF(GCC5_X64_PREFIX)gcc-ar
-*_GCC5_X64_DLINK_PATH = DEF(GCC5_X64_PREFIX)gcc
-*_GCC5_X64_ASLDLINK_PATH = DEF(GCC5_X64_PREFIX)gcc
-*_GCC5_X64_ASM_PATH = DEF(GCC5_X64_PREFIX)gcc
-*_GCC5_X64_PP_PATH = DEF(GCC5_X64_PREFIX)gcc
-*_GCC5_X64_VFRPP_PATH = DEF(GCC5_X64_PREFIX)gcc
-*_GCC5_X64_ASLCC_PATH = DEF(GCC5_X64_PREFIX)gcc
-*_GCC5_X64_ASLPP_PATH = DEF(GCC5_X64_PREFIX)gcc
-*_GCC5_X64_RC_PATH = DEF(GCC5_X64_PREFIX)objcopy
+*_GCC5_X64_OBJCOPY_PATH = ENV(GCC5_X64_PREFIX)objcopy
+*_GCC5_X64_CC_PATH = ENV(GCC5_X64_PREFIX)gcc
+*_GCC5_X64_SLINK_PATH = ENV(GCC5_X64_PREFIX)gcc-ar
+*_GCC5_X64_DLINK_PATH = ENV(GCC5_X64_PREFIX)gcc
+*_GCC5_X64_ASLDLINK_PATH = ENV(GCC5_X64_PREFIX)gcc
+*_GCC5_X64_ASM_PATH = ENV(GCC5_X64_PREFIX)gcc
+*_GCC5_X64_PP_PATH = ENV(GCC5_X64_PREFIX)gcc
+*_GCC5_X64_VFRPP_PATH = ENV(GCC5_X64_PREFIX)gcc
+*_GCC5_X64_ASLCC_PATH = ENV(GCC5_X64_PREFIX)gcc
+*_GCC5_X64_ASLPP_PATH = ENV(GCC5_X64_PREFIX)gcc
+*_GCC5_X64_RC_PATH = ENV(GCC5_X64_PREFIX)objcopy
*_GCC5_X64_ASLCC_FLAGS = DEF(GCC5_ASLCC_FLAGS) -m64
*_GCC5_X64_ASLDLINK_FLAGS = DEF(GCC5_IA32_X64_ASLDLINK_FLAGS) -Wl,-m,elf_x86_64
--
2.38.1

View File

@ -1,32 +0,0 @@
From a655395cd7ed48eb70f33eaeb2637d531503fc8f Mon Sep 17 00:00:00 2001
From: Gerd Hoffmann <kraxel@redhat.com>
Date: Fri, 10 Jun 2022 07:43:15 +0200
Subject: [PATCH 16/17] tools_def: add -fno-omit-frame-pointer to
GCC48_{IA32,X64}_CC_FLAGS
Fixes problems due to code assuming it runs with frame pointers and thus
updates rbp / ebp registers when switching stacks.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
BaseTools/Conf/tools_def.template | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.template
index f19c59039921..2e20e9b84428 100755
--- a/BaseTools/Conf/tools_def.template
+++ b/BaseTools/Conf/tools_def.template
@@ -1890,8 +1890,8 @@ DEFINE GCC_DEPS_FLAGS = -MMD -MF $@.deps
DEFINE GCC48_ALL_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -ffunction-sections -fdata-sections -DSTRING_ARRAY_NAME=$(BASE_NAME)Strings
DEFINE GCC48_IA32_X64_DLINK_COMMON = -nostdlib -Wl,-n,-q,--gc-sections -z common-page-size=0x20
-DEFINE GCC48_IA32_CC_FLAGS = DEF(GCC48_ALL_CC_FLAGS) -m32 -march=i586 -malign-double -fno-stack-protector -D EFI32 -fno-asynchronous-unwind-tables -Wno-address
-DEFINE GCC48_X64_CC_FLAGS = DEF(GCC48_ALL_CC_FLAGS) -m64 -fno-stack-protector "-DEFIAPI=__attribute__((ms_abi))" -maccumulate-outgoing-args -mno-red-zone -Wno-address -mcmodel=small -fpie -fno-asynchronous-unwind-tables -Wno-address
+DEFINE GCC48_IA32_CC_FLAGS = DEF(GCC48_ALL_CC_FLAGS) -m32 -march=i586 -malign-double -fno-stack-protector -D EFI32 -fno-asynchronous-unwind-tables -Wno-address -fno-omit-frame-pointer
+DEFINE GCC48_X64_CC_FLAGS = DEF(GCC48_ALL_CC_FLAGS) -m64 -fno-stack-protector "-DEFIAPI=__attribute__((ms_abi))" -maccumulate-outgoing-args -mno-red-zone -Wno-address -mcmodel=small -fpie -fno-asynchronous-unwind-tables -Wno-address -fno-omit-frame-pointer
DEFINE GCC48_IA32_X64_ASLDLINK_FLAGS = DEF(GCC48_IA32_X64_DLINK_COMMON) -Wl,--entry,ReferenceAcpiTable -u ReferenceAcpiTable
DEFINE GCC48_IA32_X64_DLINK_FLAGS = DEF(GCC48_IA32_X64_DLINK_COMMON) -Wl,--entry,$(IMAGE_ENTRY_POINT) -u $(IMAGE_ENTRY_POINT) -Wl,-Map,$(DEST_DIR_DEBUG)/$(BASE_NAME).map,--whole-archive
DEFINE GCC48_IA32_DLINK2_FLAGS = -Wl,--defsym=PECOFF_HEADER_SIZE=0x220 DEF(GCC_DLINK2_FLAGS_COMMON)
--
2.38.1

View File

@ -1,29 +0,0 @@
From 79d7efa44192acd8b7c2a693bd8bf6e1e964f708 Mon Sep 17 00:00:00 2001
From: Gerd Hoffmann <kraxel@redhat.com>
Date: Mon, 28 Nov 2022 14:30:57 +0100
Subject: [PATCH 17/18] Revert "ArmVirtPkg: make EFI_LOADER_DATA
non-executable"
This reverts commit 2997ae38739756ecba9b0de19e86032ebc689ef9.
Fedora grub is apparently still broken ...
---
ArmVirtPkg/ArmVirt.dsc.inc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ArmVirtPkg/ArmVirt.dsc.inc b/ArmVirtPkg/ArmVirt.dsc.inc
index 462073517a22..34575585adbb 100644
--- a/ArmVirtPkg/ArmVirt.dsc.inc
+++ b/ArmVirtPkg/ArmVirt.dsc.inc
@@ -368,7 +368,7 @@ [PcdsFixedAtBuild.common]
# reserved ones, with the exception of LoaderData regions, of which OS loaders
# (i.e., GRUB) may assume that its contents are executable.
#
- gEfiMdeModulePkgTokenSpaceGuid.PcdDxeNxMemoryProtectionPolicy|0xC000000000007FD5
+ gEfiMdeModulePkgTokenSpaceGuid.PcdDxeNxMemoryProtectionPolicy|0xC000000000007FD1
[Components.common]
#
--
2.38.1

View File

@ -1,211 +0,0 @@
From e151560ee60af405429ca7dd7d0a914aa20213a3 Mon Sep 17 00:00:00 2001
From: Gerd Hoffmann <kraxel@redhat.com>
Date: Mon, 12 Dec 2022 10:05:27 +0100
Subject: [PATCH 18/20] Revert "OvmfPkg/PlatformDxe: Handle all requests in
ExtractConfig and RouteConfig"
This reverts commit aefcc91805fd69e4aad4bc08a9f708db11cae5f0.
---
OvmfPkg/PlatformDxe/PlatformConfig.h | 2 -
OvmfPkg/PlatformDxe/Platform.c | 115 +--------------------------
OvmfPkg/PlatformDxe/PlatformConfig.c | 2 +-
3 files changed, 3 insertions(+), 116 deletions(-)
diff --git a/OvmfPkg/PlatformDxe/PlatformConfig.h b/OvmfPkg/PlatformDxe/PlatformConfig.h
index 5d9b457b1b4b..902c9b2ce043 100644
--- a/OvmfPkg/PlatformDxe/PlatformConfig.h
+++ b/OvmfPkg/PlatformDxe/PlatformConfig.h
@@ -50,6 +50,4 @@ PlatformConfigLoad (
#define PLATFORM_CONFIG_F_GRAPHICS_RESOLUTION BIT0
#define PLATFORM_CONFIG_F_DOWNGRADE BIT63
-extern CHAR16 mVariableName[];
-
#endif // _PLATFORM_CONFIG_H_
diff --git a/OvmfPkg/PlatformDxe/Platform.c b/OvmfPkg/PlatformDxe/Platform.c
index ac31fafbdce3..4d432f18df37 100644
--- a/OvmfPkg/PlatformDxe/Platform.c
+++ b/OvmfPkg/PlatformDxe/Platform.c
@@ -108,11 +108,6 @@ STATIC EFI_EVENT mGopEvent;
//
STATIC VOID *mGopTracker;
-//
-// The driver image handle, used to obtain the device path for <ConfigHdr>.
-//
-STATIC EFI_HANDLE mImageHandle;
-
//
// Cache the resolutions we get from the GOP.
//
@@ -234,10 +229,6 @@ ExtractConfig (
{
MAIN_FORM_STATE MainFormState;
EFI_STATUS Status;
- EFI_STRING ConfigRequestHdr;
- EFI_STRING ConfigRequest;
- UINTN Size;
- BOOLEAN AllocatedRequest;
DEBUG ((DEBUG_VERBOSE, "%a: Request=\"%s\"\n", __FUNCTION__, Request));
@@ -245,73 +236,18 @@ ExtractConfig (
return EFI_INVALID_PARAMETER;
}
- ConfigRequestHdr = NULL;
- ConfigRequest = NULL;
- Size = 0;
- AllocatedRequest = FALSE;
-
- //
- // Check if <ConfigHdr> matches the GUID and name
- //
- *Progress = Request;
- if ((Request != NULL) &&
- !HiiIsConfigHdrMatch (
- Request,
- &gOvmfPlatformConfigGuid,
- mVariableName
- )
- )
- {
- return EFI_NOT_FOUND;
- }
-
Status = PlatformConfigToFormState (&MainFormState);
if (EFI_ERROR (Status)) {
+ *Progress = Request;
return Status;
}
- if ((Request == NULL) || (StrStr (Request, L"OFFSET") == NULL)) {
- //
- // Request has no <RequestElement>, so construct full request string.
- // Allocate and fill a buffer large enough to hold <ConfigHdr>
- // followed by "&OFFSET=0&WIDTH=WWWWWWWWWWWWWWWW" followed by a
- // null terminator.
- //
- ConfigRequestHdr = HiiConstructConfigHdr (
- &gOvmfPlatformConfigGuid,
- mVariableName,
- mImageHandle
- );
- if (ConfigRequestHdr == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- Size = (StrLen (ConfigRequestHdr) + 32 + 1) * sizeof (CHAR16);
- ConfigRequest = AllocateZeroPool (Size);
- AllocatedRequest = TRUE;
- if (ConfigRequest == NULL) {
- FreePool (ConfigRequestHdr);
- return EFI_OUT_OF_RESOURCES;
- }
-
- UnicodeSPrint (
- ConfigRequest,
- Size,
- L"%s&OFFSET=0&WIDTH=%016LX",
- ConfigRequestHdr,
- sizeof MainFormState
- );
- FreePool (ConfigRequestHdr);
- } else {
- ConfigRequest = Request;
- }
-
//
// Answer the textual request keying off the binary form state.
//
Status = gHiiConfigRouting->BlockToConfig (
gHiiConfigRouting,
- ConfigRequest,
+ Request,
(VOID *)&MainFormState,
sizeof MainFormState,
Results,
@@ -329,33 +265,6 @@ ExtractConfig (
DEBUG ((DEBUG_VERBOSE, "%a: Results=\"%s\"\n", __FUNCTION__, *Results));
}
- //
- // If we used a newly allocated ConfigRequest, update Progress to point to
- // original Request instead of ConfigRequest.
- //
- if (Request == NULL) {
- *Progress = NULL;
- } else if (StrStr (Request, L"OFFSET") == NULL) {
- if (EFI_ERROR (Status)) {
- //
- // Since we constructed ConfigRequest, failure can only occur if there
- // is not enough memory. In this case, we point Progress to the first
- // character of Request.
- //
- *Progress = Request;
- } else {
- //
- // In case of success, we point Progress to the null terminator of
- // Request.
- //
- *Progress = Request + StrLen (Request);
- }
- }
-
- if (AllocatedRequest) {
- FreePool (ConfigRequest);
- }
-
return Status;
}
@@ -439,21 +348,6 @@ RouteConfig (
return EFI_INVALID_PARAMETER;
}
- //
- // Check if <ConfigHdr> matches the GUID and name
- //
- *Progress = Configuration;
- if ((Configuration != NULL) &&
- !HiiIsConfigHdrMatch (
- Configuration,
- &gOvmfPlatformConfigGuid,
- mVariableName
- )
- )
- {
- return EFI_NOT_FOUND;
- }
-
//
// the "read" step in RMW
//
@@ -972,11 +866,6 @@ PlatformInit (
return Status;
}
- //
- // Save the driver image handle.
- //
- mImageHandle = ImageHandle;
-
//
// Publish the HII package list to HII Database.
//
diff --git a/OvmfPkg/PlatformDxe/PlatformConfig.c b/OvmfPkg/PlatformDxe/PlatformConfig.c
index f5ac2d0609ff..e202ac5b4798 100644
--- a/OvmfPkg/PlatformDxe/PlatformConfig.c
+++ b/OvmfPkg/PlatformDxe/PlatformConfig.c
@@ -21,7 +21,7 @@
//
// Name of the UEFI variable that we use for persistent storage.
//
-CHAR16 mVariableName[] = L"PlatformConfig";
+STATIC CHAR16 mVariableName[] = L"PlatformConfig";
/**
Serialize and persistently save platform configuration.
--
2.38.1

View File

@ -1,229 +0,0 @@
From 29842668ef9c1b3d553279954c18743acdb3036c Mon Sep 17 00:00:00 2001
From: Gerd Hoffmann <kraxel@redhat.com>
Date: Mon, 28 Nov 2022 13:40:20 +0800
Subject: [PATCH 19/20] OvmfPkg/SmbiosPlatformDxe: use PcdFirmware*
Instead of using hard-coded strings ("0.0.0" for BiosVersion etc)
which is mostly useless read the PCDs (PcdFirmwareVendor,
PcdFirmwareVersionString and PcdFirmwareReleaseDateString) and
build the string table dynamuically at runtime.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
(cherry picked from commit 4cb94f20b002c99dd2b4b75f07c5495b81a34ffd)
---
.../SmbiosPlatformDxe/SmbiosPlatformDxe.inf | 6 +
.../XenSmbiosPlatformDxe.inf | 9 +-
OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.c | 115 +++++++++++-------
3 files changed, 85 insertions(+), 45 deletions(-)
diff --git a/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf b/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf
index 0066bbc9229c..52689c96e5af 100644
--- a/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf
+++ b/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf
@@ -32,9 +32,12 @@ [Sources]
[Packages]
MdePkg/MdePkg.dec
+ MdeModulePkg/MdeModulePkg.dec
OvmfPkg/OvmfPkg.dec
[LibraryClasses]
+ BaseLib
+ BaseMemoryLib
DebugLib
MemoryAllocationLib
PcdLib
@@ -45,6 +48,9 @@ [LibraryClasses]
[Pcd]
gUefiOvmfPkgTokenSpaceGuid.PcdOvmfHostBridgePciDevId
gUefiOvmfPkgTokenSpaceGuid.PcdQemuSmbiosValidated
+ gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareVendor
+ gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareVersionString
+ gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareReleaseDateString
[Protocols]
gEfiSmbiosProtocolGuid # PROTOCOL ALWAYS_CONSUMED
diff --git a/OvmfPkg/SmbiosPlatformDxe/XenSmbiosPlatformDxe.inf b/OvmfPkg/SmbiosPlatformDxe/XenSmbiosPlatformDxe.inf
index 7f4588e33d1e..e646c88741b6 100644
--- a/OvmfPkg/SmbiosPlatformDxe/XenSmbiosPlatformDxe.inf
+++ b/OvmfPkg/SmbiosPlatformDxe/XenSmbiosPlatformDxe.inf
@@ -38,19 +38,26 @@ [Sources.ARM, Sources.AARCH64]
[Packages]
MdePkg/MdePkg.dec
+ MdeModulePkg/MdeModulePkg.dec
[Packages.IA32, Packages.X64]
OvmfPkg/OvmfPkg.dec
[LibraryClasses]
+ BaseLib
+ BaseMemoryLib
DebugLib
UefiBootServicesTableLib
UefiDriverEntryPoint
[LibraryClasses.IA32, LibraryClasses.X64]
- BaseLib
HobLib
+[Pcd]
+ gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareVendor
+ gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareVersionString
+ gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareReleaseDateString
+
[Protocols]
gEfiSmbiosProtocolGuid # PROTOCOL ALWAYS_CONSUMED
diff --git a/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.c b/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.c
index 94249d3ff1b0..dc1e6aed634f 100644
--- a/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.c
+++ b/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.c
@@ -9,57 +9,43 @@
**/
#include <IndustryStandard/SmBios.h> // SMBIOS_TABLE_TYPE0
+#include <Library/BaseLib.h>
+#include <Library/BaseMemoryLib.h>
#include <Library/DebugLib.h> // ASSERT_EFI_ERROR()
+#include <Library/MemoryAllocationLib.h>
+#include <Library/PcdLib.h>
#include <Library/UefiBootServicesTableLib.h> // gBS
#include <Protocol/Smbios.h> // EFI_SMBIOS_PROTOCOL
#include "SmbiosPlatformDxe.h"
-#define TYPE0_STRINGS \
- "EFI Development Kit II / OVMF\0" /* Vendor */ \
- "0.0.0\0" /* BiosVersion */ \
- "02/06/2015\0" /* BiosReleaseDate */
-//
-// Type definition and contents of the default Type 0 SMBIOS table.
-//
-#pragma pack(1)
-typedef struct {
- SMBIOS_TABLE_TYPE0 Base;
- UINT8 Strings[sizeof (TYPE0_STRINGS)];
-} OVMF_TYPE0;
-#pragma pack()
-
-STATIC CONST OVMF_TYPE0 mOvmfDefaultType0 = {
+STATIC CONST SMBIOS_TABLE_TYPE0 mOvmfDefaultType0 = {
+ // SMBIOS_STRUCTURE Hdr
{
- // SMBIOS_STRUCTURE Hdr
- {
- EFI_SMBIOS_TYPE_BIOS_INFORMATION, // UINT8 Type
- sizeof (SMBIOS_TABLE_TYPE0), // UINT8 Length
- },
- 1, // SMBIOS_TABLE_STRING Vendor
- 2, // SMBIOS_TABLE_STRING BiosVersion
- 0xE800, // UINT16 BiosSegment
- 3, // SMBIOS_TABLE_STRING BiosReleaseDate
- 0, // UINT8 BiosSize
- { // MISC_BIOS_CHARACTERISTICS BiosCharacteristics
- 0, // Reserved :2
- 0, // Unknown :1
- 1, // BiosCharacteristicsNotSupported :1
- // Remaining BiosCharacteristics bits left unset :60
- },
- { // BIOSCharacteristicsExtensionBytes[2]
- 0, // BiosReserved
- 0x1C // SystemReserved = VirtualMachineSupported |
- // UefiSpecificationSupported |
- // TargetContentDistributionEnabled
- },
- 0, // UINT8 SystemBiosMajorRelease
- 0, // UINT8 SystemBiosMinorRelease
- 0xFF, // UINT8 EmbeddedControllerFirmwareMajorRelease
- 0xFF // UINT8 EmbeddedControllerFirmwareMinorRelease
+ EFI_SMBIOS_TYPE_BIOS_INFORMATION, // UINT8 Type
+ sizeof (SMBIOS_TABLE_TYPE0), // UINT8 Length
},
- // Text strings (unformatted area)
- TYPE0_STRINGS
+ 1, // SMBIOS_TABLE_STRING Vendor
+ 2, // SMBIOS_TABLE_STRING BiosVersion
+ 0xE800, // UINT16 BiosSegment
+ 3, // SMBIOS_TABLE_STRING BiosReleaseDate
+ 0, // UINT8 BiosSize
+ { // MISC_BIOS_CHARACTERISTICS BiosCharacteristics
+ 0, // Reserved :2
+ 0, // Unknown :1
+ 1, // BiosCharacteristicsNotSupported :1
+ // Remaining BiosCharacteristics bits left unset :60
+ },
+ { // BIOSCharacteristicsExtensionBytes[2]
+ 0, // BiosReserved
+ 0x1C // SystemReserved = VirtualMachineSupported |
+ // UefiSpecificationSupported |
+ // TargetContentDistributionEnabled
+ },
+ 0, // UINT8 SystemBiosMajorRelease
+ 0, // UINT8 SystemBiosMinorRelease
+ 0xFF, // UINT8 EmbeddedControllerFirmwareMajorRelease
+ 0xFF // UINT8 EmbeddedControllerFirmwareMinorRelease
};
/**
@@ -153,14 +139,55 @@ InstallAllStructures (
//
// Add OVMF default Type 0 (BIOS Information) table
//
+ CHAR16 *VendStr, *VersStr, *DateStr;
+ UINTN VendLen, VersLen, DateLen;
+ CHAR8 *Type0;
+
+ VendStr = (CHAR16 *)FixedPcdGetPtr (PcdFirmwareVendor);
+ VendLen = StrLen (VendStr);
+ if (VendLen < 3) {
+ VendStr = L"unknown";
+ VendLen = StrLen (VendStr);
+ }
+
+ VersStr = (CHAR16 *)FixedPcdGetPtr (PcdFirmwareVersionString);
+ VersLen = StrLen (VersStr);
+ if (VersLen < 3) {
+ VersStr = L"unknown";
+ VersLen = StrLen (VersStr);
+ }
+
+ DateStr = (CHAR16 *)FixedPcdGetPtr (PcdFirmwareReleaseDateString);
+ DateLen = StrLen (DateStr);
+ if (DateLen < 3) {
+ DateStr = L"unknown";
+ DateLen = StrLen (DateStr);
+ }
+
+ DEBUG ((DEBUG_INFO, "FirmwareVendor: \"%s\" (%d chars)\n", VendStr, VendLen));
+ DEBUG ((DEBUG_INFO, "FirmwareVersionString: \"%s\" (%d chars)\n", VersStr, VersLen));
+ DEBUG ((DEBUG_INFO, "FirmwareReleaseDateString: \"%s\" (%d chars)\n", DateStr, DateLen));
+
+ Type0 = AllocateZeroPool (sizeof (mOvmfDefaultType0) + VendLen + VersLen + DateLen + 4);
+ if (Type0 == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ CopyMem (Type0, &mOvmfDefaultType0, sizeof (mOvmfDefaultType0));
+ UnicodeStrToAsciiStrS (VendStr, Type0 + sizeof (mOvmfDefaultType0), VendLen + 1);
+ UnicodeStrToAsciiStrS (VersStr, Type0 + sizeof (mOvmfDefaultType0) + VendLen + 1, VersLen + 1);
+ UnicodeStrToAsciiStrS (DateStr, Type0 + sizeof (mOvmfDefaultType0) + VendLen + VersLen + 2, DateLen + 1);
+
SmbiosHandle = SMBIOS_HANDLE_PI_RESERVED;
Status = Smbios->Add (
Smbios,
NULL,
&SmbiosHandle,
- (EFI_SMBIOS_TABLE_HEADER *)&mOvmfDefaultType0
+ (EFI_SMBIOS_TABLE_HEADER *)Type0
);
ASSERT_EFI_ERROR (Status);
+
+ FreePool (Type0);
}
return EFI_SUCCESS;
--
2.38.1

View File

@ -1,116 +0,0 @@
From 4e22a4d1c1d7b492d1e1eee4fa81c697e0d59314 Mon Sep 17 00:00:00 2001
From: Gerd Hoffmann <kraxel@redhat.com>
Date: Fri, 2 Dec 2022 14:09:58 +0100
Subject: [PATCH 20/32] OvmfPkg/PlatformPei: AmdSev: stop using
mPlatformInfoHob
Stop using the mPlatformInfoHob global variable in AmdSevInitialize()
and AmdSevEsInitialize() functions. Pass a pointer to the
PlatformInfoHob instead.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Tested-by: Tom Lendacky <thomas.lendacky@amd.com>
Acked-by: Ard Biesheuvel <ardb@kernel.org>
(cherry picked from commit 78c373f2a5273af00b23b55d3e8c41583310cfb6)
---
OvmfPkg/PlatformPei/Platform.h | 2 +-
OvmfPkg/PlatformPei/AmdSev.c | 14 +++++++-------
OvmfPkg/PlatformPei/Platform.c | 2 +-
3 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/OvmfPkg/PlatformPei/Platform.h b/OvmfPkg/PlatformPei/Platform.h
index 29b51b2debd8..f245025fb46f 100644
--- a/OvmfPkg/PlatformPei/Platform.h
+++ b/OvmfPkg/PlatformPei/Platform.h
@@ -82,7 +82,7 @@ InstallClearCacheCallback (
VOID
AmdSevInitialize (
- VOID
+ IN EFI_HOB_PLATFORM_INFO *PlatformInfoHob
);
/**
diff --git a/OvmfPkg/PlatformPei/AmdSev.c b/OvmfPkg/PlatformPei/AmdSev.c
index e1b9fd9b7f68..c23fae7fcae0 100644
--- a/OvmfPkg/PlatformPei/AmdSev.c
+++ b/OvmfPkg/PlatformPei/AmdSev.c
@@ -201,7 +201,7 @@ GhcbRegister (
STATIC
VOID
AmdSevEsInitialize (
- VOID
+ IN EFI_HOB_PLATFORM_INFO *PlatformInfoHob
)
{
UINT8 *GhcbBase;
@@ -228,7 +228,7 @@ AmdSevEsInitialize (
// Since the pages must survive across the UEFI to OS transition
// make them reserved.
//
- GhcbPageCount = mPlatformInfoHob.PcdCpuMaxLogicalProcessorNumber * 2;
+ GhcbPageCount = PlatformInfoHob->PcdCpuMaxLogicalProcessorNumber * 2;
GhcbBase = AllocateReservedPages (GhcbPageCount);
ASSERT (GhcbBase != NULL);
@@ -266,7 +266,7 @@ AmdSevEsInitialize (
// Allocate #VC recursion backup pages. The number of backup pages needed is
// one less than the maximum VC count.
//
- GhcbBackupPageCount = mPlatformInfoHob.PcdCpuMaxLogicalProcessorNumber * (VMGEXIT_MAXIMUM_VC_COUNT - 1);
+ GhcbBackupPageCount = PlatformInfoHob->PcdCpuMaxLogicalProcessorNumber * (VMGEXIT_MAXIMUM_VC_COUNT - 1);
GhcbBackupBase = AllocatePages (GhcbBackupPageCount);
ASSERT (GhcbBackupBase != NULL);
@@ -320,7 +320,7 @@ AmdSevEsInitialize (
**/
VOID
AmdSevInitialize (
- VOID
+ IN OUT EFI_HOB_PLATFORM_INFO *PlatformInfoHob
)
{
UINT64 EncryptionMask;
@@ -367,7 +367,7 @@ AmdSevInitialize (
// until after re-encryption, in order to prevent an information leak to the
// hypervisor.
//
- if (mPlatformInfoHob.SmmSmramRequire && (mPlatformInfoHob.BootMode != BOOT_ON_S3_RESUME)) {
+ if (PlatformInfoHob->SmmSmramRequire && (PlatformInfoHob->BootMode != BOOT_ON_S3_RESUME)) {
RETURN_STATUS LocateMapStatus;
UINTN MapPagesBase;
UINTN MapPagesCount;
@@ -378,7 +378,7 @@ AmdSevInitialize (
);
ASSERT_RETURN_ERROR (LocateMapStatus);
- if (mPlatformInfoHob.Q35SmramAtDefaultSmbase) {
+ if (PlatformInfoHob->Q35SmramAtDefaultSmbase) {
//
// The initial SMRAM Save State Map has been covered as part of a larger
// reserved memory allocation in InitializeRamRegions().
@@ -400,7 +400,7 @@ AmdSevInitialize (
//
// Check and perform SEV-ES initialization if required.
//
- AmdSevEsInitialize ();
+ AmdSevEsInitialize (PlatformInfoHob);
//
// Set the Confidential computing attr PCD to communicate which SEV
diff --git a/OvmfPkg/PlatformPei/Platform.c b/OvmfPkg/PlatformPei/Platform.c
index e5132d95a8f8..14a75d40c005 100644
--- a/OvmfPkg/PlatformPei/Platform.c
+++ b/OvmfPkg/PlatformPei/Platform.c
@@ -392,7 +392,7 @@ InitializePlatform (
}
InstallClearCacheCallback ();
- AmdSevInitialize ();
+ AmdSevInitialize (&mPlatformInfoHob);
if (mPlatformInfoHob.HostBridgeDevId == 0xffff) {
MiscInitializationForMicrovm (&mPlatformInfoHob);
} else {
--
2.38.1

View File

@ -1,78 +0,0 @@
From 8d45eeb9bbec1085b31b8b5ede6145bf9458566c Mon Sep 17 00:00:00 2001
From: Gerd Hoffmann <kraxel@redhat.com>
Date: Fri, 2 Dec 2022 14:09:59 +0100
Subject: [PATCH 21/32] OvmfPkg/PlatformPei: PeiFv: stop using mPlatformInfoHob
Stop using the mPlatformInfoHob global variable in PeiFvInitialization()
function. Pass a pointer to the PlatformInfoHob instead.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Tested-by: Tom Lendacky <thomas.lendacky@amd.com>
Acked-by: Ard Biesheuvel <ardb@kernel.org>
(cherry picked from commit 9d9d15b42a5e13bb18729da0f608c629aa274e80)
---
OvmfPkg/PlatformPei/Platform.h | 2 +-
OvmfPkg/PlatformPei/Fv.c | 6 +++---
OvmfPkg/PlatformPei/Platform.c | 2 +-
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/OvmfPkg/PlatformPei/Platform.h b/OvmfPkg/PlatformPei/Platform.h
index f245025fb46f..b13f45ecdb69 100644
--- a/OvmfPkg/PlatformPei/Platform.h
+++ b/OvmfPkg/PlatformPei/Platform.h
@@ -62,7 +62,7 @@ MaxCpuCountInitialization (
EFI_STATUS
PeiFvInitialization (
- VOID
+ IN EFI_HOB_PLATFORM_INFO *PlatformInfoHob
);
VOID
diff --git a/OvmfPkg/PlatformPei/Fv.c b/OvmfPkg/PlatformPei/Fv.c
index e40c5922206b..fcf14c88faa7 100644
--- a/OvmfPkg/PlatformPei/Fv.c
+++ b/OvmfPkg/PlatformPei/Fv.c
@@ -22,7 +22,7 @@
**/
EFI_STATUS
PeiFvInitialization (
- VOID
+ IN EFI_HOB_PLATFORM_INFO *PlatformInfoHob
)
{
BOOLEAN SecureS3Needed;
@@ -37,7 +37,7 @@ PeiFvInitialization (
BuildMemoryAllocationHob (
PcdGet32 (PcdOvmfPeiMemFvBase),
PcdGet32 (PcdOvmfPeiMemFvSize),
- mPlatformInfoHob.S3Supported ? EfiACPIMemoryNVS : EfiBootServicesData
+ PlatformInfoHob->S3Supported ? EfiACPIMemoryNVS : EfiBootServicesData
);
//
@@ -45,7 +45,7 @@ PeiFvInitialization (
//
BuildFvHob (PcdGet32 (PcdOvmfDxeMemFvBase), PcdGet32 (PcdOvmfDxeMemFvSize));
- SecureS3Needed = mPlatformInfoHob.S3Supported && mPlatformInfoHob.SmmSmramRequire;
+ SecureS3Needed = PlatformInfoHob->S3Supported && PlatformInfoHob->SmmSmramRequire;
//
// Create a memory allocation HOB for the DXE FV.
diff --git a/OvmfPkg/PlatformPei/Platform.c b/OvmfPkg/PlatformPei/Platform.c
index 14a75d40c005..5ecd5d8b1ab6 100644
--- a/OvmfPkg/PlatformPei/Platform.c
+++ b/OvmfPkg/PlatformPei/Platform.c
@@ -384,7 +384,7 @@ InitializePlatform (
ReserveEmuVariableNvStore ();
}
- PeiFvInitialization ();
+ PeiFvInitialization (&mPlatformInfoHob);
MemTypeInfoInitialization ();
MemMapInitialization (&mPlatformInfoHob);
NoexecDxeInitialization ();
--
2.38.1

View File

@ -1,134 +0,0 @@
From 1f0cc9c8bbc387a3e39daea604931fc819ba1650 Mon Sep 17 00:00:00 2001
From: Gerd Hoffmann <kraxel@redhat.com>
Date: Fri, 2 Dec 2022 14:10:00 +0100
Subject: [PATCH 22/32] OvmfPkg/PlatformPei Q35 SMM helpers: stop using
mPlatformInfoHob
Stop using the mPlatformInfoHob global variable in
Q35TsegMbytesInitialization() and
Q35SmramAtDefaultSmbaseInitialization() ) functions.
Pass a pointer to the PlatformInfoHob instead.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Tested-by: Tom Lendacky <thomas.lendacky@amd.com>
Acked-by: Ard Biesheuvel <ardb@kernel.org>
(cherry picked from commit 00743d144bc5b643e9323ad66f16cb48cf338705)
---
OvmfPkg/PlatformPei/Platform.h | 4 ++--
OvmfPkg/PlatformPei/MemDetect.c | 20 ++++++++++----------
OvmfPkg/PlatformPei/Platform.c | 4 ++--
3 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/OvmfPkg/PlatformPei/Platform.h b/OvmfPkg/PlatformPei/Platform.h
index b13f45ecdb69..7baa5e1d289f 100644
--- a/OvmfPkg/PlatformPei/Platform.h
+++ b/OvmfPkg/PlatformPei/Platform.h
@@ -22,12 +22,12 @@ AddressWidthInitialization (
VOID
Q35TsegMbytesInitialization (
- VOID
+ IN OUT EFI_HOB_PLATFORM_INFO *PlatformInfoHob
);
VOID
Q35SmramAtDefaultSmbaseInitialization (
- VOID
+ IN OUT EFI_HOB_PLATFORM_INFO *PlatformInfoHob
);
EFI_STATUS
diff --git a/OvmfPkg/PlatformPei/MemDetect.c b/OvmfPkg/PlatformPei/MemDetect.c
index 2e47b1322990..b9207107b4d9 100644
--- a/OvmfPkg/PlatformPei/MemDetect.c
+++ b/OvmfPkg/PlatformPei/MemDetect.c
@@ -41,13 +41,13 @@ Module Name:
VOID
Q35TsegMbytesInitialization (
- VOID
+ IN OUT EFI_HOB_PLATFORM_INFO *PlatformInfoHob
)
{
UINT16 ExtendedTsegMbytes;
RETURN_STATUS PcdStatus;
- ASSERT (mPlatformInfoHob.HostBridgeDevId == INTEL_Q35_MCH_DEVICE_ID);
+ ASSERT (PlatformInfoHob->HostBridgeDevId == INTEL_Q35_MCH_DEVICE_ID);
//
// Check if QEMU offers an extended TSEG.
@@ -68,7 +68,7 @@ Q35TsegMbytesInitialization (
PciWrite16 (DRAMC_REGISTER_Q35 (MCH_EXT_TSEG_MB), MCH_EXT_TSEG_MB_QUERY);
ExtendedTsegMbytes = PciRead16 (DRAMC_REGISTER_Q35 (MCH_EXT_TSEG_MB));
if (ExtendedTsegMbytes == MCH_EXT_TSEG_MB_QUERY) {
- mPlatformInfoHob.Q35TsegMbytes = PcdGet16 (PcdQ35TsegMbytes);
+ PlatformInfoHob->Q35TsegMbytes = PcdGet16 (PcdQ35TsegMbytes);
return;
}
@@ -80,19 +80,19 @@ Q35TsegMbytesInitialization (
));
PcdStatus = PcdSet16S (PcdQ35TsegMbytes, ExtendedTsegMbytes);
ASSERT_RETURN_ERROR (PcdStatus);
- mPlatformInfoHob.Q35TsegMbytes = ExtendedTsegMbytes;
+ PlatformInfoHob->Q35TsegMbytes = ExtendedTsegMbytes;
}
VOID
Q35SmramAtDefaultSmbaseInitialization (
- VOID
+ IN OUT EFI_HOB_PLATFORM_INFO *PlatformInfoHob
)
{
RETURN_STATUS PcdStatus;
- ASSERT (mPlatformInfoHob.HostBridgeDevId == INTEL_Q35_MCH_DEVICE_ID);
+ ASSERT (PlatformInfoHob->HostBridgeDevId == INTEL_Q35_MCH_DEVICE_ID);
- mPlatformInfoHob.Q35SmramAtDefaultSmbase = FALSE;
+ PlatformInfoHob->Q35SmramAtDefaultSmbase = FALSE;
if (FeaturePcdGet (PcdCsmEnable)) {
DEBUG ((
DEBUG_INFO,
@@ -106,19 +106,19 @@ Q35SmramAtDefaultSmbaseInitialization (
CtlReg = DRAMC_REGISTER_Q35 (MCH_DEFAULT_SMBASE_CTL);
PciWrite8 (CtlReg, MCH_DEFAULT_SMBASE_QUERY);
CtlRegVal = PciRead8 (CtlReg);
- mPlatformInfoHob.Q35SmramAtDefaultSmbase = (BOOLEAN)(CtlRegVal ==
+ PlatformInfoHob->Q35SmramAtDefaultSmbase = (BOOLEAN)(CtlRegVal ==
MCH_DEFAULT_SMBASE_IN_RAM);
DEBUG ((
DEBUG_INFO,
"%a: SMRAM at default SMBASE %a\n",
__FUNCTION__,
- mPlatformInfoHob.Q35SmramAtDefaultSmbase ? "found" : "not found"
+ PlatformInfoHob->Q35SmramAtDefaultSmbase ? "found" : "not found"
));
}
PcdStatus = PcdSetBoolS (
PcdQ35SmramAtDefaultSmbase,
- mPlatformInfoHob.Q35SmramAtDefaultSmbase
+ PlatformInfoHob->Q35SmramAtDefaultSmbase
);
ASSERT_RETURN_ERROR (PcdStatus);
}
diff --git a/OvmfPkg/PlatformPei/Platform.c b/OvmfPkg/PlatformPei/Platform.c
index 5ecd5d8b1ab6..402b2e88461e 100644
--- a/OvmfPkg/PlatformPei/Platform.c
+++ b/OvmfPkg/PlatformPei/Platform.c
@@ -369,8 +369,8 @@ InitializePlatform (
if (mPlatformInfoHob.SmmSmramRequire) {
Q35BoardVerification ();
- Q35TsegMbytesInitialization ();
- Q35SmramAtDefaultSmbaseInitialization ();
+ Q35TsegMbytesInitialization (&mPlatformInfoHob);
+ Q35SmramAtDefaultSmbaseInitialization (&mPlatformInfoHob);
}
PublishPeiMemory ();
--
2.38.1

View File

@ -1,160 +0,0 @@
From 44d2137d1bc1c3768b7c75843d6c40ef7491e630 Mon Sep 17 00:00:00 2001
From: Gerd Hoffmann <kraxel@redhat.com>
Date: Fri, 2 Dec 2022 14:10:01 +0100
Subject: [PATCH 23/32] OvmfPkg/PlatformPei: PeiMemory: stop using
mPlatformInfoHob
Stop using the mPlatformInfoHob global variable in PublishPeiMemory()
and GetPeiMemoryCap() functions. Pass a pointer to the PlatformInfoHob
instead.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Tested-by: Tom Lendacky <thomas.lendacky@amd.com>
Acked-by: Ard Biesheuvel <ardb@kernel.org>
(cherry picked from commit 27874a382c38a95d3ab613eebd35c152ca9b3897)
---
OvmfPkg/PlatformPei/Platform.h | 2 +-
OvmfPkg/PlatformPei/MemDetect.c | 36 ++++++++++++++++-----------------
OvmfPkg/PlatformPei/Platform.c | 2 +-
3 files changed, 20 insertions(+), 20 deletions(-)
diff --git a/OvmfPkg/PlatformPei/Platform.h b/OvmfPkg/PlatformPei/Platform.h
index 7baa5e1d289f..d0c673c5a346 100644
--- a/OvmfPkg/PlatformPei/Platform.h
+++ b/OvmfPkg/PlatformPei/Platform.h
@@ -32,7 +32,7 @@ Q35SmramAtDefaultSmbaseInitialization (
EFI_STATUS
PublishPeiMemory (
- VOID
+ IN OUT EFI_HOB_PLATFORM_INFO *PlatformInfoHob
);
VOID
diff --git a/OvmfPkg/PlatformPei/MemDetect.c b/OvmfPkg/PlatformPei/MemDetect.c
index b9207107b4d9..3d8375320dcb 100644
--- a/OvmfPkg/PlatformPei/MemDetect.c
+++ b/OvmfPkg/PlatformPei/MemDetect.c
@@ -188,7 +188,7 @@ AddressWidthInitialization (
STATIC
UINT32
GetPeiMemoryCap (
- VOID
+ IN EFI_HOB_PLATFORM_INFO *PlatformInfoHob
)
{
BOOLEAN Page1GSupport;
@@ -225,15 +225,15 @@ GetPeiMemoryCap (
}
}
- if (mPlatformInfoHob.PhysMemAddressWidth <= 39) {
+ if (PlatformInfoHob->PhysMemAddressWidth <= 39) {
Pml4Entries = 1;
- PdpEntries = 1 << (mPlatformInfoHob.PhysMemAddressWidth - 30);
+ PdpEntries = 1 << (PlatformInfoHob->PhysMemAddressWidth - 30);
ASSERT (PdpEntries <= 0x200);
} else {
- if (mPlatformInfoHob.PhysMemAddressWidth > 48) {
+ if (PlatformInfoHob->PhysMemAddressWidth > 48) {
Pml4Entries = 0x200;
} else {
- Pml4Entries = 1 << (mPlatformInfoHob.PhysMemAddressWidth - 39);
+ Pml4Entries = 1 << (PlatformInfoHob->PhysMemAddressWidth - 39);
}
ASSERT (Pml4Entries <= 0x200);
@@ -260,7 +260,7 @@ GetPeiMemoryCap (
**/
EFI_STATUS
PublishPeiMemory (
- VOID
+ IN OUT EFI_HOB_PLATFORM_INFO *PlatformInfoHob
)
{
EFI_STATUS Status;
@@ -271,12 +271,12 @@ PublishPeiMemory (
UINT32 S3AcpiReservedMemoryBase;
UINT32 S3AcpiReservedMemorySize;
- LowerMemorySize = PlatformGetSystemMemorySizeBelow4gb (&mPlatformInfoHob);
- if (mPlatformInfoHob.SmmSmramRequire) {
+ LowerMemorySize = PlatformGetSystemMemorySizeBelow4gb (PlatformInfoHob);
+ if (PlatformInfoHob->SmmSmramRequire) {
//
// TSEG is chipped from the end of low RAM
//
- LowerMemorySize -= mPlatformInfoHob.Q35TsegMbytes * SIZE_1MB;
+ LowerMemorySize -= PlatformInfoHob->Q35TsegMbytes * SIZE_1MB;
}
S3AcpiReservedMemoryBase = 0;
@@ -287,27 +287,27 @@ PublishPeiMemory (
// downwards. Its size is primarily dictated by CpuMpPei. The formula below
// is an approximation.
//
- if (mPlatformInfoHob.S3Supported) {
+ if (PlatformInfoHob->S3Supported) {
S3AcpiReservedMemorySize = SIZE_512KB +
- mPlatformInfoHob.PcdCpuMaxLogicalProcessorNumber *
+ PlatformInfoHob->PcdCpuMaxLogicalProcessorNumber *
PcdGet32 (PcdCpuApStackSize);
S3AcpiReservedMemoryBase = LowerMemorySize - S3AcpiReservedMemorySize;
LowerMemorySize = S3AcpiReservedMemoryBase;
}
- mPlatformInfoHob.S3AcpiReservedMemoryBase = S3AcpiReservedMemoryBase;
- mPlatformInfoHob.S3AcpiReservedMemorySize = S3AcpiReservedMemorySize;
+ PlatformInfoHob->S3AcpiReservedMemoryBase = S3AcpiReservedMemoryBase;
+ PlatformInfoHob->S3AcpiReservedMemorySize = S3AcpiReservedMemorySize;
- if (mPlatformInfoHob.BootMode == BOOT_ON_S3_RESUME) {
+ if (PlatformInfoHob->BootMode == BOOT_ON_S3_RESUME) {
MemoryBase = S3AcpiReservedMemoryBase;
MemorySize = S3AcpiReservedMemorySize;
} else {
- PeiMemoryCap = GetPeiMemoryCap ();
+ PeiMemoryCap = GetPeiMemoryCap (PlatformInfoHob);
DEBUG ((
DEBUG_INFO,
"%a: PhysMemAddressWidth=%d PeiMemoryCap=%u KB\n",
__FUNCTION__,
- mPlatformInfoHob.PhysMemAddressWidth,
+ PlatformInfoHob->PhysMemAddressWidth,
PeiMemoryCap >> 10
));
@@ -321,7 +321,7 @@ PublishPeiMemory (
// allocation HOB, and other allocations served from the permanent PEI RAM
// shouldn't overlap with that HOB.
//
- MemoryBase = mPlatformInfoHob.S3Supported && mPlatformInfoHob.SmmSmramRequire ?
+ MemoryBase = PlatformInfoHob->S3Supported && PlatformInfoHob->SmmSmramRequire ?
PcdGet32 (PcdOvmfDecompressionScratchEnd) :
PcdGet32 (PcdOvmfDxeMemFvBase) + PcdGet32 (PcdOvmfDxeMemFvSize);
MemorySize = LowerMemorySize - MemoryBase;
@@ -336,7 +336,7 @@ PublishPeiMemory (
// normal boot permanent PEI RAM. Regarding the S3 boot path, the S3
// permanent PEI RAM is located even higher.
//
- if (mPlatformInfoHob.SmmSmramRequire && mPlatformInfoHob.Q35SmramAtDefaultSmbase) {
+ if (PlatformInfoHob->SmmSmramRequire && PlatformInfoHob->Q35SmramAtDefaultSmbase) {
ASSERT (SMM_DEFAULT_SMBASE + MCH_DEFAULT_SMBASE_SIZE <= MemoryBase);
}
diff --git a/OvmfPkg/PlatformPei/Platform.c b/OvmfPkg/PlatformPei/Platform.c
index 402b2e88461e..0d5ead724d3f 100644
--- a/OvmfPkg/PlatformPei/Platform.c
+++ b/OvmfPkg/PlatformPei/Platform.c
@@ -373,7 +373,7 @@ InitializePlatform (
Q35SmramAtDefaultSmbaseInitialization (&mPlatformInfoHob);
}
- PublishPeiMemory ();
+ PublishPeiMemory (&mPlatformInfoHob);
PlatformQemuUc32BaseInitialization (&mPlatformInfoHob);
--
2.38.1

View File

@ -1,67 +0,0 @@
From 63ce5d51b90f213ec2281b6da8c1def59f9acaf8 Mon Sep 17 00:00:00 2001
From: Gerd Hoffmann <kraxel@redhat.com>
Date: Fri, 2 Dec 2022 14:10:02 +0100
Subject: [PATCH 24/32] OvmfPkg/PlatformPei: MemTypeInfo: stop using
mPlatformInfoHob
Stop using the mPlatformInfoHob global variable in MemTypeInfoInitialization()
function. Pass a pointer to the PlatformInfoHob instead.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Tested-by: Tom Lendacky <thomas.lendacky@amd.com>
Acked-by: Ard Biesheuvel <ardb@kernel.org>
(cherry picked from commit cc6efda7770b8cabea3ae8c6054d47c4a8e229c3)
---
OvmfPkg/PlatformPei/Platform.h | 2 +-
OvmfPkg/PlatformPei/MemTypeInfo.c | 4 ++--
OvmfPkg/PlatformPei/Platform.c | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/OvmfPkg/PlatformPei/Platform.h b/OvmfPkg/PlatformPei/Platform.h
index d0c673c5a346..0c0558f0626c 100644
--- a/OvmfPkg/PlatformPei/Platform.h
+++ b/OvmfPkg/PlatformPei/Platform.h
@@ -67,7 +67,7 @@ PeiFvInitialization (
VOID
MemTypeInfoInitialization (
- VOID
+ IN OUT EFI_HOB_PLATFORM_INFO *PlatformInfoHob
);
VOID
diff --git a/OvmfPkg/PlatformPei/MemTypeInfo.c b/OvmfPkg/PlatformPei/MemTypeInfo.c
index c8fcf1732687..eb37febb31ae 100644
--- a/OvmfPkg/PlatformPei/MemTypeInfo.c
+++ b/OvmfPkg/PlatformPei/MemTypeInfo.c
@@ -203,12 +203,12 @@ STATIC CONST EFI_PEI_NOTIFY_DESCRIPTOR mReadOnlyVariable2Notify = {
VOID
MemTypeInfoInitialization (
- VOID
+ IN OUT EFI_HOB_PLATFORM_INFO *PlatformInfoHob
)
{
EFI_STATUS Status;
- if (!mPlatformInfoHob.SmmSmramRequire) {
+ if (!PlatformInfoHob->SmmSmramRequire) {
//
// EFI_PEI_READ_ONLY_VARIABLE2_PPI will never be available; install
// the default memory type information HOB right away.
diff --git a/OvmfPkg/PlatformPei/Platform.c b/OvmfPkg/PlatformPei/Platform.c
index 0d5ead724d3f..c0273091326c 100644
--- a/OvmfPkg/PlatformPei/Platform.c
+++ b/OvmfPkg/PlatformPei/Platform.c
@@ -385,7 +385,7 @@ InitializePlatform (
}
PeiFvInitialization (&mPlatformInfoHob);
- MemTypeInfoInitialization ();
+ MemTypeInfoInitialization (&mPlatformInfoHob);
MemMapInitialization (&mPlatformInfoHob);
NoexecDxeInitialization ();
UPDATE_BOOLEAN_PCD_FROM_FW_CFG (PcdResizeXterm);
--
2.38.1

View File

@ -1,54 +0,0 @@
From 6c10dc63b0753d9e241274d1cac62c0af406256e Mon Sep 17 00:00:00 2001
From: Gerd Hoffmann <kraxel@redhat.com>
Date: Fri, 2 Dec 2022 14:10:03 +0100
Subject: [PATCH 25/32] OvmfPkg/PlatformPei: NoExec: stop using
mPlatformInfoHob
Stop using the mPlatformInfoHob global variable in NoexecDxeInitialization()
function. Pass a pointer to the PlatformInfoHob instead.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Tested-by: Tom Lendacky <thomas.lendacky@amd.com>
Acked-by: Ard Biesheuvel <ardb@kernel.org>
(cherry picked from commit 7dbb8a24d1a3403f85d959bc1234b9f4a92bfbf0)
---
OvmfPkg/PlatformPei/Platform.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/OvmfPkg/PlatformPei/Platform.c b/OvmfPkg/PlatformPei/Platform.c
index c0273091326c..8307a80617fc 100644
--- a/OvmfPkg/PlatformPei/Platform.c
+++ b/OvmfPkg/PlatformPei/Platform.c
@@ -87,16 +87,17 @@ MemMapInitialization (
ASSERT_RETURN_ERROR (PcdStatus);
}
+STATIC
VOID
NoexecDxeInitialization (
- VOID
+ IN OUT EFI_HOB_PLATFORM_INFO *PlatformInfoHob
)
{
RETURN_STATUS Status;
- Status = PlatformNoexecDxeInitialization (&mPlatformInfoHob);
+ Status = PlatformNoexecDxeInitialization (PlatformInfoHob);
if (!RETURN_ERROR (Status)) {
- Status = PcdSetBoolS (PcdSetNxForStack, mPlatformInfoHob.PcdSetNxForStack);
+ Status = PcdSetBoolS (PcdSetNxForStack, PlatformInfoHob->PcdSetNxForStack);
ASSERT_RETURN_ERROR (Status);
}
}
@@ -387,7 +388,7 @@ InitializePlatform (
PeiFvInitialization (&mPlatformInfoHob);
MemTypeInfoInitialization (&mPlatformInfoHob);
MemMapInitialization (&mPlatformInfoHob);
- NoexecDxeInitialization ();
+ NoexecDxeInitialization (&mPlatformInfoHob);
UPDATE_BOOLEAN_PCD_FROM_FW_CFG (PcdResizeXterm);
}
--
2.38.1

View File

@ -1,85 +0,0 @@
From d9fb9c50028ab90b0a1b044c9d13f3143f6093aa Mon Sep 17 00:00:00 2001
From: Gerd Hoffmann <kraxel@redhat.com>
Date: Fri, 2 Dec 2022 14:10:04 +0100
Subject: [PATCH 26/32] OvmfPkg/PlatformPei: Verification: stop using
mPlatformInfoHob
Stop using the mPlatformInfoHob global variable in S3Verification() and
Q35BoardVerification() functions. Pass a pointer to the PlatformInfoHob
instead.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Tested-by: Tom Lendacky <thomas.lendacky@amd.com>
Acked-by: Ard Biesheuvel <ardb@kernel.org>
(cherry picked from commit 4bc2c748516e5c4a8bb86093cd5e1b80a9f35c0f)
---
OvmfPkg/PlatformPei/Platform.c | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/OvmfPkg/PlatformPei/Platform.c b/OvmfPkg/PlatformPei/Platform.c
index 8307a80617fc..6e31c5fc1f41 100644
--- a/OvmfPkg/PlatformPei/Platform.c
+++ b/OvmfPkg/PlatformPei/Platform.c
@@ -243,13 +243,14 @@ ReserveEmuVariableNvStore (
ASSERT_RETURN_ERROR (PcdStatus);
}
+STATIC
VOID
S3Verification (
- VOID
+ IN EFI_HOB_PLATFORM_INFO *PlatformInfoHob
)
{
#if defined (MDE_CPU_X64)
- if (mPlatformInfoHob.SmmSmramRequire && mPlatformInfoHob.S3Supported) {
+ if (PlatformInfoHob->SmmSmramRequire && PlatformInfoHob->S3Supported) {
DEBUG ((
DEBUG_ERROR,
"%a: S3Resume2Pei doesn't support X64 PEI + SMM yet.\n",
@@ -272,12 +273,13 @@ S3Verification (
#endif
}
+STATIC
VOID
Q35BoardVerification (
- VOID
+ IN EFI_HOB_PLATFORM_INFO *PlatformInfoHob
)
{
- if (mPlatformInfoHob.HostBridgeDevId == INTEL_Q35_MCH_DEVICE_ID) {
+ if (PlatformInfoHob->HostBridgeDevId == INTEL_Q35_MCH_DEVICE_ID) {
return;
}
@@ -286,7 +288,7 @@ Q35BoardVerification (
"%a: no TSEG (SMRAM) on host bridge DID=0x%04x; "
"only DID=0x%04x (Q35) is supported\n",
__FUNCTION__,
- mPlatformInfoHob.HostBridgeDevId,
+ PlatformInfoHob->HostBridgeDevId,
INTEL_Q35_MCH_DEVICE_ID
));
ASSERT (FALSE);
@@ -357,7 +359,7 @@ InitializePlatform (
ASSERT_EFI_ERROR (Status);
}
- S3Verification ();
+ S3Verification (&mPlatformInfoHob);
BootModeInitialization (&mPlatformInfoHob);
//
@@ -369,7 +371,7 @@ InitializePlatform (
MaxCpuCountInitialization (&mPlatformInfoHob);
if (mPlatformInfoHob.SmmSmramRequire) {
- Q35BoardVerification ();
+ Q35BoardVerification (&mPlatformInfoHob);
Q35TsegMbytesInitialization (&mPlatformInfoHob);
Q35SmramAtDefaultSmbaseInitialization (&mPlatformInfoHob);
}
--
2.38.1

View File

@ -1,177 +0,0 @@
From 0aa971e9b02ff1b380c5363a5a543bc4e2b9532f Mon Sep 17 00:00:00 2001
From: Gerd Hoffmann <kraxel@redhat.com>
Date: Fri, 2 Dec 2022 14:10:05 +0100
Subject: [PATCH 27/32] OvmfPkg/PlatformPei: remove mPlatformInfoHob
Stop using the mPlatformInfoHob global variable. Let
BuildPlatformInfoHob() allocate and return PlatformInfoHob instead.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Tested-by: Tom Lendacky <thomas.lendacky@amd.com>
Acked-by: Ard Biesheuvel <ardb@kernel.org>
(cherry picked from commit 862614e2544997c848fab7388733774ae0ea92d8)
---
OvmfPkg/PlatformPei/Platform.h | 4 +-
OvmfPkg/PlatformPei/Platform.c | 71 ++++++++++++++++++----------------
2 files changed, 39 insertions(+), 36 deletions(-)
diff --git a/OvmfPkg/PlatformPei/Platform.h b/OvmfPkg/PlatformPei/Platform.h
index 0c0558f0626c..86f603ff649c 100644
--- a/OvmfPkg/PlatformPei/Platform.h
+++ b/OvmfPkg/PlatformPei/Platform.h
@@ -13,8 +13,6 @@
#include <Library/PlatformInitLib.h>
#include <IndustryStandard/IntelTdx.h>
-extern EFI_HOB_PLATFORM_INFO mPlatformInfoHob;
-
VOID
AddressWidthInitialization (
IN OUT EFI_HOB_PLATFORM_INFO *PlatformInfoHob
@@ -98,7 +96,7 @@ IntelTdxInitialize (
/**
* @brief Builds PlatformInfo Hob
*/
-VOID
+EFI_HOB_PLATFORM_INFO *
BuildPlatformInfoHob (
VOID
);
diff --git a/OvmfPkg/PlatformPei/Platform.c b/OvmfPkg/PlatformPei/Platform.c
index 6e31c5fc1f41..ee72b4ef24aa 100644
--- a/OvmfPkg/PlatformPei/Platform.c
+++ b/OvmfPkg/PlatformPei/Platform.c
@@ -53,8 +53,6 @@
} \
} while (0)
-EFI_HOB_PLATFORM_INFO mPlatformInfoHob = { 0 };
-
EFI_PEI_PPI_DESCRIPTOR mPpiBootMode[] = {
{
EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST,
@@ -317,12 +315,18 @@ MaxCpuCountInitialization (
/**
* @brief Builds PlatformInfo Hob
*/
-VOID
+EFI_HOB_PLATFORM_INFO *
BuildPlatformInfoHob (
VOID
)
{
- BuildGuidDataHob (&gUefiOvmfPkgPlatformInfoGuid, &mPlatformInfoHob, sizeof (EFI_HOB_PLATFORM_INFO));
+ EFI_HOB_PLATFORM_INFO PlatformInfoHob;
+ EFI_HOB_GUID_TYPE *GuidHob;
+
+ ZeroMem (&PlatformInfoHob, sizeof PlatformInfoHob);
+ BuildGuidDataHob (&gUefiOvmfPkgPlatformInfoGuid, &PlatformInfoHob, sizeof (EFI_HOB_PLATFORM_INFO));
+ GuidHob = GetFirstGuidHob (&gUefiOvmfPkgPlatformInfoGuid);
+ return (EFI_HOB_PLATFORM_INFO *)GET_GUID_HOB_DATA (GuidHob);
}
/**
@@ -341,70 +345,71 @@ InitializePlatform (
IN CONST EFI_PEI_SERVICES **PeiServices
)
{
- EFI_STATUS Status;
+ EFI_HOB_PLATFORM_INFO *PlatformInfoHob;
+ EFI_STATUS Status;
DEBUG ((DEBUG_INFO, "Platform PEIM Loaded\n"));
+ PlatformInfoHob = BuildPlatformInfoHob ();
- mPlatformInfoHob.SmmSmramRequire = FeaturePcdGet (PcdSmmSmramRequire);
- mPlatformInfoHob.SevEsIsEnabled = MemEncryptSevEsIsEnabled ();
- mPlatformInfoHob.PcdPciMmio64Size = PcdGet64 (PcdPciMmio64Size);
- mPlatformInfoHob.DefaultMaxCpuNumber = PcdGet32 (PcdCpuMaxLogicalProcessorNumber);
+ PlatformInfoHob->SmmSmramRequire = FeaturePcdGet (PcdSmmSmramRequire);
+ PlatformInfoHob->SevEsIsEnabled = MemEncryptSevEsIsEnabled ();
+ PlatformInfoHob->PcdPciMmio64Size = PcdGet64 (PcdPciMmio64Size);
+ PlatformInfoHob->DefaultMaxCpuNumber = PcdGet32 (PcdCpuMaxLogicalProcessorNumber);
PlatformDebugDumpCmos ();
if (QemuFwCfgS3Enabled ()) {
DEBUG ((DEBUG_INFO, "S3 support was detected on QEMU\n"));
- mPlatformInfoHob.S3Supported = TRUE;
+ PlatformInfoHob->S3Supported = TRUE;
Status = PcdSetBoolS (PcdAcpiS3Enable, TRUE);
ASSERT_EFI_ERROR (Status);
}
- S3Verification (&mPlatformInfoHob);
- BootModeInitialization (&mPlatformInfoHob);
+ S3Verification (PlatformInfoHob);
+ BootModeInitialization (PlatformInfoHob);
//
// Query Host Bridge DID
//
- mPlatformInfoHob.HostBridgeDevId = PciRead16 (OVMF_HOSTBRIDGE_DID);
- AddressWidthInitialization (&mPlatformInfoHob);
+ PlatformInfoHob->HostBridgeDevId = PciRead16 (OVMF_HOSTBRIDGE_DID);
+ AddressWidthInitialization (PlatformInfoHob);
- MaxCpuCountInitialization (&mPlatformInfoHob);
+ MaxCpuCountInitialization (PlatformInfoHob);
- if (mPlatformInfoHob.SmmSmramRequire) {
- Q35BoardVerification (&mPlatformInfoHob);
- Q35TsegMbytesInitialization (&mPlatformInfoHob);
- Q35SmramAtDefaultSmbaseInitialization (&mPlatformInfoHob);
+ if (PlatformInfoHob->SmmSmramRequire) {
+ Q35BoardVerification (PlatformInfoHob);
+ Q35TsegMbytesInitialization (PlatformInfoHob);
+ Q35SmramAtDefaultSmbaseInitialization (PlatformInfoHob);
}
- PublishPeiMemory (&mPlatformInfoHob);
+ PublishPeiMemory (PlatformInfoHob);
- PlatformQemuUc32BaseInitialization (&mPlatformInfoHob);
+ PlatformQemuUc32BaseInitialization (PlatformInfoHob);
- InitializeRamRegions (&mPlatformInfoHob);
+ InitializeRamRegions (PlatformInfoHob);
- if (mPlatformInfoHob.BootMode != BOOT_ON_S3_RESUME) {
- if (!mPlatformInfoHob.SmmSmramRequire) {
+ if (PlatformInfoHob->BootMode != BOOT_ON_S3_RESUME) {
+ if (!PlatformInfoHob->SmmSmramRequire) {
ReserveEmuVariableNvStore ();
}
- PeiFvInitialization (&mPlatformInfoHob);
- MemTypeInfoInitialization (&mPlatformInfoHob);
- MemMapInitialization (&mPlatformInfoHob);
- NoexecDxeInitialization (&mPlatformInfoHob);
+ PeiFvInitialization (PlatformInfoHob);
+ MemTypeInfoInitialization (PlatformInfoHob);
+ MemMapInitialization (PlatformInfoHob);
+ NoexecDxeInitialization (PlatformInfoHob);
UPDATE_BOOLEAN_PCD_FROM_FW_CFG (PcdResizeXterm);
}
InstallClearCacheCallback ();
- AmdSevInitialize (&mPlatformInfoHob);
- if (mPlatformInfoHob.HostBridgeDevId == 0xffff) {
- MiscInitializationForMicrovm (&mPlatformInfoHob);
+ AmdSevInitialize (PlatformInfoHob);
+ if (PlatformInfoHob->HostBridgeDevId == 0xffff) {
+ MiscInitializationForMicrovm (PlatformInfoHob);
} else {
- MiscInitialization (&mPlatformInfoHob);
+ MiscInitialization (PlatformInfoHob);
}
IntelTdxInitialize ();
InstallFeatureControlCallback ();
- BuildPlatformInfoHob ();
return EFI_SUCCESS;
}
--
2.38.1

View File

@ -1,176 +0,0 @@
From f0d41555cc5b42bd284c8ee1f3b419c612a9a8ca Mon Sep 17 00:00:00 2001
From: Gerd Hoffmann <kraxel@redhat.com>
Date: Fri, 2 Dec 2022 14:10:06 +0100
Subject: [PATCH 28/32] OvmfPkg/PlatformPei: remove mFeatureControlValue
Use PlatformInfoHob->FeatureControlValue instead.
OnMpServicesAvailable() will find PlatformInfoHob using
GetFirstGuidHob() and pass a pointer to the WriteFeatureControl
callback.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Tested-by: Tom Lendacky <thomas.lendacky@amd.com>
Acked-by: Ard Biesheuvel <ardb@kernel.org>
(cherry picked from commit f6a196c7eb34affff0cfe1864e126953096885e1)
---
OvmfPkg/Include/Library/PlatformInitLib.h | 2 ++
OvmfPkg/PlatformPei/Platform.h | 2 +-
OvmfPkg/PlatformPei/FeatureControl.c | 44 ++++++++++++++++-------
OvmfPkg/PlatformPei/Platform.c | 2 +-
4 files changed, 36 insertions(+), 14 deletions(-)
diff --git a/OvmfPkg/Include/Library/PlatformInitLib.h b/OvmfPkg/Include/Library/PlatformInitLib.h
index c5234bf26d45..da7ed76041d2 100644
--- a/OvmfPkg/Include/Library/PlatformInitLib.h
+++ b/OvmfPkg/Include/Library/PlatformInitLib.h
@@ -48,6 +48,8 @@ typedef struct {
UINT32 S3AcpiReservedMemoryBase;
UINT32 S3AcpiReservedMemorySize;
+
+ UINT64 FeatureControlValue;
} EFI_HOB_PLATFORM_INFO;
#pragma pack()
diff --git a/OvmfPkg/PlatformPei/Platform.h b/OvmfPkg/PlatformPei/Platform.h
index 86f603ff649c..1cf44844a781 100644
--- a/OvmfPkg/PlatformPei/Platform.h
+++ b/OvmfPkg/PlatformPei/Platform.h
@@ -70,7 +70,7 @@ MemTypeInfoInitialization (
VOID
InstallFeatureControlCallback (
- VOID
+ IN OUT EFI_HOB_PLATFORM_INFO *PlatformInfoHob
);
VOID
diff --git a/OvmfPkg/PlatformPei/FeatureControl.c b/OvmfPkg/PlatformPei/FeatureControl.c
index 5864ee0c214d..d8a398cd5565 100644
--- a/OvmfPkg/PlatformPei/FeatureControl.c
+++ b/OvmfPkg/PlatformPei/FeatureControl.c
@@ -8,6 +8,7 @@
**/
#include <Library/DebugLib.h>
+#include <Library/HobLib.h>
#include <Library/PeiServicesLib.h>
#include <Library/QemuFwCfgLib.h>
#include <Ppi/MpServices.h>
@@ -16,11 +17,6 @@
#include "Platform.h"
-//
-// The value to be written to the Feature Control MSR, retrieved from fw_cfg.
-//
-STATIC UINT64 mFeatureControlValue;
-
/**
Write the Feature Control MSR on an Application Processor or the Boot
Processor.
@@ -38,10 +34,22 @@ WriteFeatureControl (
IN OUT VOID *WorkSpace
)
{
+ EFI_HOB_PLATFORM_INFO *PlatformInfoHob = WorkSpace;
+
if (TdIsEnabled ()) {
- TdVmCall (TDVMCALL_WRMSR, (UINT64)MSR_IA32_FEATURE_CONTROL, mFeatureControlValue, 0, 0, 0);
+ TdVmCall (
+ TDVMCALL_WRMSR,
+ (UINT64)MSR_IA32_FEATURE_CONTROL,
+ PlatformInfoHob->FeatureControlValue,
+ 0,
+ 0,
+ 0
+ );
} else {
- AsmWriteMsr64 (MSR_IA32_FEATURE_CONTROL, mFeatureControlValue);
+ AsmWriteMsr64 (
+ MSR_IA32_FEATURE_CONTROL,
+ PlatformInfoHob->FeatureControlValue
+ );
}
}
@@ -67,6 +75,15 @@ OnMpServicesAvailable (
{
EFI_PEI_MP_SERVICES_PPI *MpServices;
EFI_STATUS Status;
+ EFI_HOB_PLATFORM_INFO *PlatformInfoHob;
+ EFI_HOB_GUID_TYPE *GuidHob;
+
+ GuidHob = GetFirstGuidHob (&gUefiOvmfPkgPlatformInfoGuid);
+ if (GuidHob == NULL) {
+ return EFI_UNSUPPORTED;
+ }
+
+ PlatformInfoHob = (EFI_HOB_PLATFORM_INFO *)GET_GUID_HOB_DATA (GuidHob);
DEBUG ((DEBUG_VERBOSE, "%a: %a\n", gEfiCallerBaseName, __FUNCTION__));
@@ -80,7 +97,7 @@ OnMpServicesAvailable (
WriteFeatureControl, // Procedure
FALSE, // SingleThread
0, // TimeoutInMicroSeconds: inf.
- NULL // ProcedureArgument
+ PlatformInfoHob // ProcedureArgument
);
if (EFI_ERROR (Status) && (Status != EFI_NOT_STARTED)) {
DEBUG ((DEBUG_ERROR, "%a: StartupAllAps(): %r\n", __FUNCTION__, Status));
@@ -90,7 +107,7 @@ OnMpServicesAvailable (
//
// Now write the MSR on the BSP too.
//
- WriteFeatureControl (NULL);
+ WriteFeatureControl (PlatformInfoHob);
return EFI_SUCCESS;
}
@@ -107,7 +124,7 @@ STATIC CONST EFI_PEI_NOTIFY_DESCRIPTOR mMpServicesNotify = {
VOID
InstallFeatureControlCallback (
- VOID
+ IN OUT EFI_HOB_PLATFORM_INFO *PlatformInfoHob
)
{
EFI_STATUS Status;
@@ -119,7 +136,7 @@ InstallFeatureControlCallback (
&FwCfgItem,
&FwCfgSize
);
- if (EFI_ERROR (Status) || (FwCfgSize != sizeof mFeatureControlValue)) {
+ if (EFI_ERROR (Status) || (FwCfgSize != sizeof (PlatformInfoHob->FeatureControlValue))) {
//
// Nothing to do.
//
@@ -127,7 +144,10 @@ InstallFeatureControlCallback (
}
QemuFwCfgSelectItem (FwCfgItem);
- QemuFwCfgReadBytes (sizeof mFeatureControlValue, &mFeatureControlValue);
+ QemuFwCfgReadBytes (
+ sizeof (PlatformInfoHob->FeatureControlValue),
+ &(PlatformInfoHob->FeatureControlValue)
+ );
Status = PeiServicesNotifyPpi (&mMpServicesNotify);
if (EFI_ERROR (Status)) {
diff --git a/OvmfPkg/PlatformPei/Platform.c b/OvmfPkg/PlatformPei/Platform.c
index ee72b4ef24aa..d324ae95f8f5 100644
--- a/OvmfPkg/PlatformPei/Platform.c
+++ b/OvmfPkg/PlatformPei/Platform.c
@@ -409,7 +409,7 @@ InitializePlatform (
}
IntelTdxInitialize ();
- InstallFeatureControlCallback ();
+ InstallFeatureControlCallback (PlatformInfoHob);
return EFI_SUCCESS;
}
--
2.38.1

View File

@ -1,169 +0,0 @@
From b0f503de63b9f177d5457956025567806066bfb3 Mon Sep 17 00:00:00 2001
From: Gerd Hoffmann <kraxel@redhat.com>
Date: Fri, 2 Dec 2022 14:10:07 +0100
Subject: [PATCH 29/32] OvmfPkg/DebugLibIoPort: use Rom version for PEI
This variant does not use global variables.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Tested-by: Tom Lendacky <thomas.lendacky@amd.com>
Acked-by: Ard Biesheuvel <ardb@kernel.org>
(cherry picked from commit e59747bd8246135faeecc18879d62db66a6acfc2)
---
OvmfPkg/AmdSev/AmdSevX64.dsc | 4 ++--
OvmfPkg/Bhyve/BhyveX64.dsc | 4 ++--
OvmfPkg/Microvm/MicrovmX64.dsc | 4 ++--
OvmfPkg/OvmfPkgIa32.dsc | 4 ++--
OvmfPkg/OvmfPkgIa32X64.dsc | 4 ++--
OvmfPkg/OvmfPkgX64.dsc | 4 ++--
.../PlatformDebugLibIoPort/PlatformRomDebugLibIoPort.inf | 2 +-
7 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/OvmfPkg/AmdSev/AmdSevX64.dsc b/OvmfPkg/AmdSev/AmdSevX64.dsc
index 05908a72270f..ea755afbab82 100644
--- a/OvmfPkg/AmdSev/AmdSevX64.dsc
+++ b/OvmfPkg/AmdSev/AmdSevX64.dsc
@@ -244,7 +244,7 @@ [LibraryClasses.common.PEI_CORE]
!ifdef $(DEBUG_ON_SERIAL_PORT)
DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
!else
- DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.inf
+ DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformRomDebugLibIoPort.inf
!endif
PeCoffLib|MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf
@@ -260,7 +260,7 @@ [LibraryClasses.common.PEIM]
!ifdef $(DEBUG_ON_SERIAL_PORT)
DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
!else
- DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.inf
+ DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformRomDebugLibIoPort.inf
!endif
PeCoffLib|MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf
ResourcePublicationLib|MdePkg/Library/PeiResourcePublicationLib/PeiResourcePublicationLib.inf
diff --git a/OvmfPkg/Bhyve/BhyveX64.dsc b/OvmfPkg/Bhyve/BhyveX64.dsc
index e3bb367b6bf6..befec670d4f3 100644
--- a/OvmfPkg/Bhyve/BhyveX64.dsc
+++ b/OvmfPkg/Bhyve/BhyveX64.dsc
@@ -265,7 +265,7 @@ [LibraryClasses.common.PEI_CORE]
!ifdef $(DEBUG_ON_SERIAL_PORT)
DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
!else
- DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.inf
+ DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformRomDebugLibIoPort.inf
!endif
PeCoffLib|MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf
@@ -281,7 +281,7 @@ [LibraryClasses.common.PEIM]
!ifdef $(DEBUG_ON_SERIAL_PORT)
DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
!else
- DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.inf
+ DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformRomDebugLibIoPort.inf
!endif
PeCoffLib|MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf
ResourcePublicationLib|MdePkg/Library/PeiResourcePublicationLib/PeiResourcePublicationLib.inf
diff --git a/OvmfPkg/Microvm/MicrovmX64.dsc b/OvmfPkg/Microvm/MicrovmX64.dsc
index 3444304d0e46..97339d48a5ef 100644
--- a/OvmfPkg/Microvm/MicrovmX64.dsc
+++ b/OvmfPkg/Microvm/MicrovmX64.dsc
@@ -292,7 +292,7 @@ [LibraryClasses.common.PEI_CORE]
!ifdef $(DEBUG_ON_SERIAL_PORT)
DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
!else
- DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.inf
+ DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformRomDebugLibIoPort.inf
!endif
PeCoffLib|MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf
@@ -308,7 +308,7 @@ [LibraryClasses.common.PEIM]
!ifdef $(DEBUG_ON_SERIAL_PORT)
DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
!else
- DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.inf
+ DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformRomDebugLibIoPort.inf
!endif
PeCoffLib|MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf
ResourcePublicationLib|MdePkg/Library/PeiResourcePublicationLib/PeiResourcePublicationLib.inf
diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc
index 9c0fb7d545b8..72e623a65a38 100644
--- a/OvmfPkg/OvmfPkgIa32.dsc
+++ b/OvmfPkg/OvmfPkgIa32.dsc
@@ -294,7 +294,7 @@ [LibraryClasses.common.PEI_CORE]
!ifdef $(DEBUG_ON_SERIAL_PORT)
DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
!else
- DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.inf
+ DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformRomDebugLibIoPort.inf
!endif
PeCoffLib|MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf
@@ -310,7 +310,7 @@ [LibraryClasses.common.PEIM]
!ifdef $(DEBUG_ON_SERIAL_PORT)
DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
!else
- DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.inf
+ DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformRomDebugLibIoPort.inf
!endif
PeCoffLib|MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf
ResourcePublicationLib|MdePkg/Library/PeiResourcePublicationLib/PeiResourcePublicationLib.inf
diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc
index 8b93437044e7..55ceb5c3420b 100644
--- a/OvmfPkg/OvmfPkgIa32X64.dsc
+++ b/OvmfPkg/OvmfPkgIa32X64.dsc
@@ -300,7 +300,7 @@ [LibraryClasses.common.PEI_CORE]
!ifdef $(DEBUG_ON_SERIAL_PORT)
DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
!else
- DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.inf
+ DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformRomDebugLibIoPort.inf
!endif
PeCoffLib|MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf
@@ -316,7 +316,7 @@ [LibraryClasses.common.PEIM]
!ifdef $(DEBUG_ON_SERIAL_PORT)
DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
!else
- DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.inf
+ DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformRomDebugLibIoPort.inf
!endif
PeCoffLib|MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf
ResourcePublicationLib|MdePkg/Library/PeiResourcePublicationLib/PeiResourcePublicationLib.inf
diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc
index 8c9162db1743..6cef37c10822 100644
--- a/OvmfPkg/OvmfPkgX64.dsc
+++ b/OvmfPkg/OvmfPkgX64.dsc
@@ -318,7 +318,7 @@ [LibraryClasses.common.PEI_CORE]
!ifdef $(DEBUG_ON_SERIAL_PORT)
DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
!else
- DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.inf
+ DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformRomDebugLibIoPort.inf
!endif
PeCoffLib|MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf
CcProbeLib|OvmfPkg/Library/CcProbeLib/SecPeiCcProbeLib.inf
@@ -335,7 +335,7 @@ [LibraryClasses.common.PEIM]
!ifdef $(DEBUG_ON_SERIAL_PORT)
DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
!else
- DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.inf
+ DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformRomDebugLibIoPort.inf
!endif
PeCoffLib|MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf
ResourcePublicationLib|MdePkg/Library/PeiResourcePublicationLib/PeiResourcePublicationLib.inf
diff --git a/OvmfPkg/Library/PlatformDebugLibIoPort/PlatformRomDebugLibIoPort.inf b/OvmfPkg/Library/PlatformDebugLibIoPort/PlatformRomDebugLibIoPort.inf
index 8f721d249dd5..c89b1571bad8 100644
--- a/OvmfPkg/Library/PlatformDebugLibIoPort/PlatformRomDebugLibIoPort.inf
+++ b/OvmfPkg/Library/PlatformDebugLibIoPort/PlatformRomDebugLibIoPort.inf
@@ -16,7 +16,7 @@ [Defines]
FILE_GUID = CEB0D9D3-328F-4C24-8C02-28FA1986AE1B
MODULE_TYPE = BASE
VERSION_STRING = 1.0
- LIBRARY_CLASS = DebugLib|SEC
+ LIBRARY_CLASS = DebugLib|SEC PEI_CORE PEIM
CONSTRUCTOR = PlatformRomDebugLibIoPortConstructor
#
--
2.38.1

View File

@ -1,183 +0,0 @@
From 64d555122ee65151008255a30173a3608006ae25 Mon Sep 17 00:00:00 2001
From: Gerd Hoffmann <kraxel@redhat.com>
Date: Fri, 2 Dec 2022 14:10:08 +0100
Subject: [PATCH 30/32] OvmfPkg/QemuFwCfgLib: rewrite fw_cfg probe
Move the code to a new QemuFwCfgProbe() function. Use direct Io*() calls
instead of indirect QemuFwCfg*() calls to make sure we don't get
recursive calls. Also simplify CC guest detection.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Tested-by: Tom Lendacky <thomas.lendacky@amd.com>
Acked-by: Ard Biesheuvel <ardb@kernel.org>
(cherry picked from commit 81bbc1452c972218f071cd4a8f5899df974b1dae)
---
.../Library/QemuFwCfgLib/QemuFwCfgPeiLib.inf | 1 -
OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgPei.c | 101 +++++++-----------
2 files changed, 41 insertions(+), 61 deletions(-)
diff --git a/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgPeiLib.inf b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgPeiLib.inf
index 3910511880c9..1d7543a7d40f 100644
--- a/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgPeiLib.inf
+++ b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgPeiLib.inf
@@ -41,7 +41,6 @@ [LibraryClasses]
DebugLib
IoLib
MemoryAllocationLib
- MemEncryptSevLib
[Pcd]
gUefiOvmfPkgTokenSpaceGuid.PcdOvmfWorkAreaBase
diff --git a/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgPei.c b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgPei.c
index 7ab7027af168..a936fd103955 100644
--- a/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgPei.c
+++ b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgPei.c
@@ -13,7 +13,6 @@
#include <Library/IoLib.h>
#include <Library/DebugLib.h>
#include <Library/QemuFwCfgLib.h>
-#include <Library/MemEncryptSevLib.h>
#include <WorkArea.h>
#include "QemuFwCfgLibInternal.h"
@@ -27,15 +26,16 @@ STATIC BOOLEAN mQemuFwCfgDmaSupported;
@retval TRUE It is Tdx guest
@retval FALSE It is not Tdx guest
**/
+STATIC
BOOLEAN
-QemuFwCfgIsTdxGuest (
+QemuFwCfgIsCcGuest (
VOID
)
{
CONFIDENTIAL_COMPUTING_WORK_AREA_HEADER *CcWorkAreaHeader;
CcWorkAreaHeader = (CONFIDENTIAL_COMPUTING_WORK_AREA_HEADER *)FixedPcdGet32 (PcdOvmfWorkAreaBase);
- return (CcWorkAreaHeader != NULL && CcWorkAreaHeader->GuestType == CcGuestTypeIntelTdx);
+ return (CcWorkAreaHeader != NULL && CcWorkAreaHeader->GuestType != CcGuestTypeNonEncrypted);
}
/**
@@ -57,62 +57,49 @@ QemuFwCfgIsAvailable (
return InternalQemuFwCfgIsAvailable ();
}
+STATIC
+VOID
+QemuFwCfgProbe (
+ BOOLEAN *Supported,
+ BOOLEAN *DmaSupported
+ )
+{
+ UINT32 Signature;
+ UINT32 Revision;
+ BOOLEAN CcGuest;
+
+ // Use direct Io* calls for probing to avoid recursion.
+ IoWrite16 (FW_CFG_IO_SELECTOR, (UINT16)QemuFwCfgItemSignature);
+ IoReadFifo8 (FW_CFG_IO_DATA, sizeof Signature, &Signature);
+ IoWrite16 (FW_CFG_IO_SELECTOR, (UINT16)QemuFwCfgItemInterfaceVersion);
+ IoReadFifo8 (FW_CFG_IO_DATA, sizeof Revision, &Revision);
+ CcGuest = QemuFwCfgIsCcGuest ();
+
+ *Supported = FALSE;
+ *DmaSupported = FALSE;
+ if ((Signature == SIGNATURE_32 ('Q', 'E', 'M', 'U')) && (Revision >= 1)) {
+ *Supported = TRUE;
+ if ((Revision & FW_CFG_F_DMA) && !CcGuest) {
+ *DmaSupported = TRUE;
+ }
+ }
+
+ DEBUG ((
+ DEBUG_INFO,
+ "%a: Supported %d, DMA %d\n",
+ __func__,
+ *Supported,
+ *DmaSupported
+ ));
+}
+
RETURN_STATUS
EFIAPI
QemuFwCfgInitialize (
VOID
)
{
- UINT32 Signature;
- UINT32 Revision;
-
- //
- // Enable the access routines while probing to see if it is supported.
- // For probing we always use the IO Port (IoReadFifo8()) access method.
- //
- mQemuFwCfgSupported = TRUE;
- mQemuFwCfgDmaSupported = FALSE;
-
- QemuFwCfgSelectItem (QemuFwCfgItemSignature);
- Signature = QemuFwCfgRead32 ();
- DEBUG ((DEBUG_INFO, "FW CFG Signature: 0x%x\n", Signature));
- QemuFwCfgSelectItem (QemuFwCfgItemInterfaceVersion);
- Revision = QemuFwCfgRead32 ();
- DEBUG ((DEBUG_INFO, "FW CFG Revision: 0x%x\n", Revision));
- if ((Signature != SIGNATURE_32 ('Q', 'E', 'M', 'U')) ||
- (Revision < 1)
- )
- {
- DEBUG ((DEBUG_INFO, "QemuFwCfg interface not supported.\n"));
- mQemuFwCfgSupported = FALSE;
- return RETURN_SUCCESS;
- }
-
- if ((Revision & FW_CFG_F_DMA) == 0) {
- DEBUG ((DEBUG_INFO, "QemuFwCfg interface (IO Port) is supported.\n"));
- } else {
- //
- // If SEV is enabled then we do not support DMA operations in PEI phase.
- // This is mainly because DMA in SEV guest requires using bounce buffer
- // (which need to allocate dynamic memory and allocating a PAGE size'd
- // buffer can be challenge in PEI phase)
- //
- if (MemEncryptSevIsEnabled ()) {
- DEBUG ((DEBUG_INFO, "SEV: QemuFwCfg fallback to IO Port interface.\n"));
- } else if (QemuFwCfgIsTdxGuest ()) {
- //
- // If TDX is enabled then we do not support DMA operations in PEI phase.
- // This is mainly because DMA in TDX guest requires using bounce buffer
- // (which need to allocate dynamic memory and allocating a PAGE size'd
- // buffer can be challenge in PEI phase)
- //
- DEBUG ((DEBUG_INFO, "TDX: QemuFwCfg fallback to IO Port interface.\n"));
- } else {
- mQemuFwCfgDmaSupported = TRUE;
- DEBUG ((DEBUG_INFO, "QemuFwCfg interface (DMA) is supported.\n"));
- }
- }
-
+ QemuFwCfgProbe (&mQemuFwCfgSupported, &mQemuFwCfgDmaSupported);
return RETURN_SUCCESS;
}
@@ -183,17 +170,11 @@ InternalQemuFwCfgDmaBytes (
return;
}
- //
- // SEV does not support DMA operations in PEI stage, we should
- // not have reached here.
- //
- ASSERT (!MemEncryptSevIsEnabled ());
-
//
// TDX does not support DMA operations in PEI stage, we should
// not have reached here.
//
- ASSERT (!QemuFwCfgIsTdxGuest ());
+ ASSERT (!QemuFwCfgIsCcGuest ());
Access.Control = SwapBytes32 (Control);
Access.Length = SwapBytes32 (Size);
--
2.38.1

View File

@ -1,144 +0,0 @@
From ed22693f4fc4d780c19280a7a26438b7c9d84ecd Mon Sep 17 00:00:00 2001
From: Gerd Hoffmann <kraxel@redhat.com>
Date: Fri, 2 Dec 2022 14:10:09 +0100
Subject: [PATCH 31/32] OvmfPkg/QemuFwCfgLib: remove mQemuFwCfgSupported +
mQemuFwCfgDmaSupported
Remove global variables, store the state in PlatformInfoHob instead.
Probing for fw_cfg happens on first use, at library initialization
time the Hob might not be present yet.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Tested-by: Tom Lendacky <thomas.lendacky@amd.com>
Acked-by: Ard Biesheuvel <ardb@kernel.org>
(cherry picked from commit cda98df16228970dcf9a4ce2af5368219711b4b0)
---
.../Library/QemuFwCfgLib/QemuFwCfgPeiLib.inf | 4 ++
OvmfPkg/Include/Library/PlatformInitLib.h | 4 ++
OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgPei.c | 44 ++++++++++++++++---
3 files changed, 45 insertions(+), 7 deletions(-)
diff --git a/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgPeiLib.inf b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgPeiLib.inf
index 1d7543a7d40f..b1f548febcf7 100644
--- a/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgPeiLib.inf
+++ b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgPeiLib.inf
@@ -39,8 +39,12 @@ [LibraryClasses]
BaseLib
BaseMemoryLib
DebugLib
+ HobLib
IoLib
MemoryAllocationLib
+[Guids]
+ gUefiOvmfPkgPlatformInfoGuid
+
[Pcd]
gUefiOvmfPkgTokenSpaceGuid.PcdOvmfWorkAreaBase
diff --git a/OvmfPkg/Include/Library/PlatformInitLib.h b/OvmfPkg/Include/Library/PlatformInitLib.h
index da7ed76041d2..bf6f90a5761c 100644
--- a/OvmfPkg/Include/Library/PlatformInitLib.h
+++ b/OvmfPkg/Include/Library/PlatformInitLib.h
@@ -50,6 +50,10 @@ typedef struct {
UINT32 S3AcpiReservedMemorySize;
UINT64 FeatureControlValue;
+
+ BOOLEAN QemuFwCfgChecked;
+ BOOLEAN QemuFwCfgSupported;
+ BOOLEAN QemuFwCfgDmaSupported;
} EFI_HOB_PLATFORM_INFO;
#pragma pack()
diff --git a/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgPei.c b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgPei.c
index a936fd103955..da86a3c84c02 100644
--- a/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgPei.c
+++ b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgPei.c
@@ -9,17 +9,17 @@
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
+#include <PiPei.h>
#include <Library/BaseLib.h>
-#include <Library/IoLib.h>
#include <Library/DebugLib.h>
+#include <Library/HobLib.h>
+#include <Library/IoLib.h>
+#include <Library/PlatformInitLib.h>
#include <Library/QemuFwCfgLib.h>
#include <WorkArea.h>
#include "QemuFwCfgLibInternal.h"
-STATIC BOOLEAN mQemuFwCfgSupported = FALSE;
-STATIC BOOLEAN mQemuFwCfgDmaSupported;
-
/**
Check if it is Tdx guest
@@ -93,13 +93,39 @@ QemuFwCfgProbe (
));
}
+STATIC
+EFI_HOB_PLATFORM_INFO *
+QemuFwCfgGetPlatformInfo (
+ VOID
+ )
+{
+ EFI_HOB_PLATFORM_INFO *PlatformInfoHob;
+ EFI_HOB_GUID_TYPE *GuidHob;
+
+ GuidHob = GetFirstGuidHob (&gUefiOvmfPkgPlatformInfoGuid);
+ if (GuidHob == NULL) {
+ return NULL;
+ }
+
+ PlatformInfoHob = (EFI_HOB_PLATFORM_INFO *)GET_GUID_HOB_DATA (GuidHob);
+
+ if (!PlatformInfoHob->QemuFwCfgChecked) {
+ QemuFwCfgProbe (
+ &PlatformInfoHob->QemuFwCfgSupported,
+ &PlatformInfoHob->QemuFwCfgDmaSupported
+ );
+ PlatformInfoHob->QemuFwCfgChecked = TRUE;
+ }
+
+ return PlatformInfoHob;
+}
+
RETURN_STATUS
EFIAPI
QemuFwCfgInitialize (
VOID
)
{
- QemuFwCfgProbe (&mQemuFwCfgSupported, &mQemuFwCfgDmaSupported);
return RETURN_SUCCESS;
}
@@ -117,7 +143,9 @@ InternalQemuFwCfgIsAvailable (
VOID
)
{
- return mQemuFwCfgSupported;
+ EFI_HOB_PLATFORM_INFO *PlatformInfoHob = QemuFwCfgGetPlatformInfo ();
+
+ return PlatformInfoHob->QemuFwCfgSupported;
}
/**
@@ -132,7 +160,9 @@ InternalQemuFwCfgDmaIsAvailable (
VOID
)
{
- return mQemuFwCfgDmaSupported;
+ EFI_HOB_PLATFORM_INFO *PlatformInfoHob = QemuFwCfgGetPlatformInfo ();
+
+ return PlatformInfoHob->QemuFwCfgDmaSupported;
}
/**
--
2.38.1

View File

@ -1,61 +0,0 @@
From c5c9385ffa28b9989a53c3a51ce3f8b4ef40aa41 Mon Sep 17 00:00:00 2001
From: Gerd Hoffmann <kraxel@redhat.com>
Date: Wed, 11 Jan 2023 19:00:23 +0100
Subject: [PATCH 32/34] OvmfPkg/VirtNorFlashDxe: map flash memory as
uncacheable
Switching from the ArmPlatformPkg/NorFlashDxe driver to the
OvmfPkg/VirtNorFlashDxe driver had the side effect that flash address
space got registered as EFI_MEMORY_WC instead of EFI_MEMORY_UC.
That confuses the linux kernel's numa code, seems this makes kernel
consider the flash being node memory. "lsmem" changes from ...
RANGE SIZE STATE REMOVABLE BLOCK
0x0000000040000000-0x000000013fffffff 4G online yes 8-39
... to ...
RANGE SIZE STATE REMOVABLE BLOCK
0x0000000000000000-0x0000000007ffffff 128M online yes 0
0x0000000040000000-0x000000013fffffff 4G online yes 8-39
... and in the kernel log got new error lines:
NUMA: Warning: invalid memblk node 512 [mem 0x0000000004000000-0x0000000007ffffff]
NUMA: Faking a node at [mem 0x0000000004000000-0x000000013fffffff]
Changing the attributes back to EFI_MEMORY_UC fixes this.
Fixes: b92298af8218 ("ArmVirtPkg/ArmVirtQemu: migrate to OVMF's VirtNorFlashDxe")
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
(cherry picked from commit e5ec3ba409b5baa9cf429cc25fdf3c8d1b8dcef0)
---
OvmfPkg/VirtNorFlashDxe/VirtNorFlashDxe.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/OvmfPkg/VirtNorFlashDxe/VirtNorFlashDxe.c b/OvmfPkg/VirtNorFlashDxe/VirtNorFlashDxe.c
index ff3121af2a40..f9a41f6aab0f 100644
--- a/OvmfPkg/VirtNorFlashDxe/VirtNorFlashDxe.c
+++ b/OvmfPkg/VirtNorFlashDxe/VirtNorFlashDxe.c
@@ -394,14 +394,14 @@ NorFlashFvbInitialize (
EfiGcdMemoryTypeMemoryMappedIo,
Instance->DeviceBaseAddress,
RuntimeMmioRegionSize,
- EFI_MEMORY_WC | EFI_MEMORY_RUNTIME
+ EFI_MEMORY_UC | EFI_MEMORY_RUNTIME
);
ASSERT_EFI_ERROR (Status);
Status = gDS->SetMemorySpaceAttributes (
Instance->DeviceBaseAddress,
RuntimeMmioRegionSize,
- EFI_MEMORY_WC | EFI_MEMORY_RUNTIME
+ EFI_MEMORY_UC | EFI_MEMORY_RUNTIME
);
ASSERT_EFI_ERROR (Status);
--
2.39.0

View File

@ -1,82 +0,0 @@
From 4cab22343b32fec515813584a2620d6dafe0b1c2 Mon Sep 17 00:00:00 2001
From: Ard Biesheuvel <ardb@kernel.org>
Date: Wed, 4 Jan 2023 16:51:35 +0100
Subject: [PATCH 33/34] ArmVirtPkg/ArmVirtQemu: Avoid early ID map on ThunderX
The early ID map used by ArmVirtQemu uses ASID scoped non-global
mappings, as this allows us to switch to the permanent ID map seamlessly
without the need for explicit TLB maintenance.
However, this triggers a known erratum on ThunderX, which does not
tolerate non-global mappings that are executable at EL1, as this appears
to result in I-cache corruption. (Linux disables the KPTI based Meltdown
mitigation on ThunderX for the same reason)
So work around this, by detecting the CPU implementor and part number,
and proceeding without the early ID map if a ThunderX CPU is detected.
Note that this requires the C code to be built with strict alignment
again, as we may end up executing it with the MMU and caches off.
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: dann frazier <dann.frazier@canonical.com>
(cherry picked from commit ec54ce1f1ab41b92782b37ae59e752fff0ef9c41)
---
ArmVirtPkg/ArmVirtQemu.dsc | 5 +++++
.../AArch64/ArmPlatformHelper.S | 15 +++++++++++++++
2 files changed, 20 insertions(+)
diff --git a/ArmVirtPkg/ArmVirtQemu.dsc b/ArmVirtPkg/ArmVirtQemu.dsc
index a3d744931a15..6b4dc213a7f7 100644
--- a/ArmVirtPkg/ArmVirtQemu.dsc
+++ b/ArmVirtPkg/ArmVirtQemu.dsc
@@ -31,6 +31,7 @@ [Defines]
DEFINE SECURE_BOOT_ENABLE = FALSE
DEFINE TPM2_ENABLE = FALSE
DEFINE TPM2_CONFIG_ENABLE = FALSE
+ DEFINE CAVIUM_ERRATUM_27456 = FALSE
#
# Network definition
@@ -117,7 +118,11 @@ [LibraryClasses.common.UEFI_DRIVER]
UefiScsiLib|MdePkg/Library/UefiScsiLib/UefiScsiLib.inf
[BuildOptions]
+!if $(CAVIUM_ERRATUM_27456) == TRUE
+ GCC:*_*_AARCH64_PP_FLAGS = -DCAVIUM_ERRATUM_27456
+!else
GCC:*_*_AARCH64_CC_XIPFLAGS ==
+!endif
!include NetworkPkg/NetworkBuildOptions.dsc.inc
diff --git a/ArmVirtPkg/Library/ArmPlatformLibQemu/AArch64/ArmPlatformHelper.S b/ArmVirtPkg/Library/ArmPlatformLibQemu/AArch64/ArmPlatformHelper.S
index 05ccc7f9f043..1c0022c1efd9 100644
--- a/ArmVirtPkg/Library/ArmPlatformLibQemu/AArch64/ArmPlatformHelper.S
+++ b/ArmVirtPkg/Library/ArmPlatformLibQemu/AArch64/ArmPlatformHelper.S
@@ -44,6 +44,21 @@
ASM_FUNC(ArmPlatformPeiBootAction)
+#ifdef CAVIUM_ERRATUM_27456
+ /*
+ * On Cavium ThunderX, using non-global mappings that are executable at EL1
+ * results in I-cache corruption. So just avoid the early ID mapping there.
+ *
+ * MIDR implementor 0x43
+ * MIDR part numbers 0xA1 0xA2 (but not 0xAF)
+ */
+ mrs x0, midr_el1 // read the MIDR into X0
+ ubfx x1, x0, #24, #8 // grab implementor id
+ ubfx x0, x0, #7, #9 // grab part number bits [11:3]
+ cmp x1, #0x43 // compare implementor id
+ ccmp x0, #0xA0 >> 3, #0, eq // compare part# bits [11:3]
+ b.eq 0f
+#endif
mrs x0, CurrentEL // check current exception level
tbz x0, #3, 0f // bail if above EL1
ret
--
2.39.0

View File

@ -1,37 +0,0 @@
From 630fa990847e14507354a4d921143a8bfb255194 Mon Sep 17 00:00:00 2001
From: Gerd Hoffmann <kraxel@redhat.com>
Date: Fri, 10 Feb 2023 10:49:44 +0100
Subject: [PATCH 34/34] rh openssl: add crypto/bn/rsa_sup_mul.c to file list
---
CryptoPkg/Library/OpensslLib/OpensslLib.inf | 1 +
CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf | 1 +
2 files changed, 2 insertions(+)
diff --git a/CryptoPkg/Library/OpensslLib/OpensslLib.inf b/CryptoPkg/Library/OpensslLib/OpensslLib.inf
index e446b51e66cd..7e78255467b1 100644
--- a/CryptoPkg/Library/OpensslLib/OpensslLib.inf
+++ b/CryptoPkg/Library/OpensslLib/OpensslLib.inf
@@ -576,6 +576,7 @@ [Sources]
$(OPENSSL_PATH)/ssl/statem/statem_local.h
# Autogenerated files list ends here
# RHEL8-specific OpenSSL file list starts here
+ $(OPENSSL_PATH)/crypto/bn/rsa_sup_mul.c
$(OPENSSL_PATH)/crypto/evp/kdf_lib.c
$(OPENSSL_PATH)/crypto/evp/pkey_kdf.c
$(OPENSSL_PATH)/crypto/kdf/kbkdf.c
diff --git a/CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf b/CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf
index c207dc8f4cfd..1c551cb0990c 100644
--- a/CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf
+++ b/CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf
@@ -526,6 +526,7 @@ [Sources]
$(OPENSSL_PATH)/crypto/x509v3/v3_admis.h
# Autogenerated files list ends here
# RHEL8-specific OpenSSL file list starts here
+ $(OPENSSL_PATH)/crypto/bn/rsa_sup_mul.c
$(OPENSSL_PATH)/crypto/evp/kdf_lib.c
$(OPENSSL_PATH)/crypto/evp/pkey_kdf.c
$(OPENSSL_PATH)/crypto/kdf/kbkdf.c
--
2.39.1

View File

@ -78,38 +78,17 @@ Source90: DBXUpdate-20200729.x64.bin
Patch0001: 0001-BaseTools-do-not-build-BrotliCompress-RH-only.patch
Patch0002: 0002-MdeModulePkg-remove-package-private-Brotli-include-p.patch
#Patch0003: 0003-MdeModulePkg-TerminalDxe-add-other-text-resolutions-.patch
Patch0004: 0004-MdeModulePkg-TerminalDxe-set-xterm-resolution-on-mod.patch
Patch0005: 0005-OvmfPkg-take-PcdResizeXterm-from-the-QEMU-command-li.patch
Patch0006: 0006-ArmVirtPkg-take-PcdResizeXterm-from-the-QEMU-command.patch
Patch0007: 0007-OvmfPkg-enable-DEBUG_VERBOSE-RHEL-only.patch
Patch0008: 0008-OvmfPkg-silence-DEBUG_VERBOSE-0x00400000-in-QemuVide.patch
Patch0009: 0009-ArmVirtPkg-silence-DEBUG_VERBOSE-0x00400000-in-QemuR.patch
Patch0010: 0010-OvmfPkg-QemuRamfbDxe-Do-not-report-DXE-failure-on-Aa.patch
Patch0011: 0011-OvmfPkg-silence-EFI_D_VERBOSE-0x00400000-in-NvmExpre.patch
Patch0012: 0012-CryptoPkg-OpensslLib-list-RHEL8-specific-OpenSSL-fil.patch
Patch0013: 0013-OvmfPkg-QemuKernelLoaderFsDxe-suppress-error-on-no-k.patch
Patch0014: 0014-SecurityPkg-Tcg2Dxe-suppress-error-on-no-swtpm-in-si.patch
Patch0015: 0015-Tweak-the-tools_def-to-support-cross-compiling.patch
Patch0016: 0016-tools_def-add-fno-omit-frame-pointer-to-GCC48_-IA32-.patch
Patch0017: 0017-Revert-ArmVirtPkg-make-EFI_LOADER_DATA-non-executabl.patch
Patch0018: 0018-Revert-OvmfPkg-PlatformDxe-Handle-all-requests-in-Ex.patch
Patch0019: 0019-OvmfPkg-SmbiosPlatformDxe-use-PcdFirmware.patch
Patch0020: 0020-OvmfPkg-PlatformPei-AmdSev-stop-using-mPlatformInfoH.patch
Patch0021: 0021-OvmfPkg-PlatformPei-PeiFv-stop-using-mPlatformInfoHo.patch
Patch0022: 0022-OvmfPkg-PlatformPei-Q35-SMM-helpers-stop-using-mPlat.patch
Patch0023: 0023-OvmfPkg-PlatformPei-PeiMemory-stop-using-mPlatformIn.patch
Patch0024: 0024-OvmfPkg-PlatformPei-MemTypeInfo-stop-using-mPlatform.patch
Patch0025: 0025-OvmfPkg-PlatformPei-NoExec-stop-using-mPlatformInfoH.patch
Patch0026: 0026-OvmfPkg-PlatformPei-Verification-stop-using-mPlatfor.patch
Patch0027: 0027-OvmfPkg-PlatformPei-remove-mPlatformInfoHob.patch
Patch0028: 0028-OvmfPkg-PlatformPei-remove-mFeatureControlValue.patch
Patch0029: 0029-OvmfPkg-DebugLibIoPort-use-Rom-version-for-PEI.patch
Patch0030: 0030-OvmfPkg-QemuFwCfgLib-rewrite-fw_cfg-probe.patch
Patch0031: 0031-OvmfPkg-QemuFwCfgLib-remove-mQemuFwCfgSupported-mQem.patch
Patch0032: 0032-OvmfPkg-VirtNorFlashDxe-map-flash-memory-as-uncachea.patch
Patch0033: 0033-ArmVirtPkg-ArmVirtQemu-Avoid-early-ID-map-on-Thunder.patch
Patch0034: 0034-rh-openssl-add-crypto-bn-rsa_sup_mul.c-to-file-list.patch
Patch0003: 0003-MdeModulePkg-TerminalDxe-set-xterm-resolution-on-mod.patch
Patch0004: 0004-OvmfPkg-take-PcdResizeXterm-from-the-QEMU-command-li.patch
Patch0005: 0005-ArmVirtPkg-take-PcdResizeXterm-from-the-QEMU-command.patch
Patch0006: 0006-OvmfPkg-enable-DEBUG_VERBOSE-RHEL-only.patch
Patch0007: 0007-OvmfPkg-silence-DEBUG_VERBOSE-0x00400000-in-QemuVide.patch
Patch0008: 0008-ArmVirtPkg-silence-DEBUG_VERBOSE-0x00400000-in-QemuR.patch
Patch0009: 0009-OvmfPkg-QemuRamfbDxe-Do-not-report-DXE-failure-on-Aa.patch
Patch0010: 0010-OvmfPkg-silence-EFI_D_VERBOSE-0x00400000-in-NvmExpre.patch
Patch0011: 0011-CryptoPkg-OpensslLib-list-RHEL8-specific-OpenSSL-fil.patch
Patch0012: 0012-OvmfPkg-QemuKernelLoaderFsDxe-suppress-error-on-no-k.patch
Patch0013: 0013-SecurityPkg-Tcg2Dxe-suppress-error-on-no-swtpm-in-si.patch
# python3-devel and libuuid-devel are required for building tools.