cherry-pick some fixes
This commit is contained in:
parent
ec5ec9658f
commit
0ccbe4782d
72
0015-OvmfPkg-PlatformPei-drop-S3Verification.patch
Normal file
72
0015-OvmfPkg-PlatformPei-drop-S3Verification.patch
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
From 55a09dea67c8818d1c871af825307fb3b2b0ba4b Mon Sep 17 00:00:00 2001
|
||||||
|
From: Gerd Hoffmann <kraxel@redhat.com>
|
||||||
|
Date: Tue, 23 May 2023 10:25:51 +0200
|
||||||
|
Subject: [PATCH 15/27] OvmfPkg/PlatformPei: drop S3Verification()
|
||||||
|
|
||||||
|
Not needed any more, SMM + 64-bit PEI + S3 suspend works now.
|
||||||
|
|
||||||
|
Fixed by commits:
|
||||||
|
- 8bd2028f9ac3 ("MdeModulePkg: Supporting S3 in 64bit PEI")
|
||||||
|
- 6acf72901a2e ("UefiCpuPkg: Supporting S3 in 64bit PEI")
|
||||||
|
See also https://bugzilla.tianocore.org/show_bug.cgi?id=4195
|
||||||
|
|
||||||
|
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
|
||||||
|
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
|
||||||
|
Reviewed-by: Ray Ni <ray.ni@intel.com>
|
||||||
|
(cherry picked from commit 098c55702318fd907de6fad7b43b5e9a6ad9ff7f)
|
||||||
|
---
|
||||||
|
OvmfPkg/PlatformPei/Platform.c | 31 -------------------------------
|
||||||
|
1 file changed, 31 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/OvmfPkg/PlatformPei/Platform.c b/OvmfPkg/PlatformPei/Platform.c
|
||||||
|
index 5d7f50cc5876..ce9868d57de1 100644
|
||||||
|
--- a/OvmfPkg/PlatformPei/Platform.c
|
||||||
|
+++ b/OvmfPkg/PlatformPei/Platform.c
|
||||||
|
@@ -242,36 +242,6 @@ ReserveEmuVariableNvStore (
|
||||||
|
ASSERT_RETURN_ERROR (PcdStatus);
|
||||||
|
}
|
||||||
|
|
||||||
|
-STATIC
|
||||||
|
-VOID
|
||||||
|
-S3Verification (
|
||||||
|
- IN EFI_HOB_PLATFORM_INFO *PlatformInfoHob
|
||||||
|
- )
|
||||||
|
-{
|
||||||
|
- #if defined (MDE_CPU_X64)
|
||||||
|
- if (PlatformInfoHob->SmmSmramRequire && PlatformInfoHob->S3Supported) {
|
||||||
|
- DEBUG ((
|
||||||
|
- DEBUG_ERROR,
|
||||||
|
- "%a: S3Resume2Pei doesn't support X64 PEI + SMM yet.\n",
|
||||||
|
- __func__
|
||||||
|
- ));
|
||||||
|
- DEBUG ((
|
||||||
|
- DEBUG_ERROR,
|
||||||
|
- "%a: Please disable S3 on the QEMU command line (see the README),\n",
|
||||||
|
- __func__
|
||||||
|
- ));
|
||||||
|
- DEBUG ((
|
||||||
|
- DEBUG_ERROR,
|
||||||
|
- "%a: or build OVMF with \"OvmfPkgIa32X64.dsc\".\n",
|
||||||
|
- __func__
|
||||||
|
- ));
|
||||||
|
- ASSERT (FALSE);
|
||||||
|
- CpuDeadLoop ();
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- #endif
|
||||||
|
-}
|
||||||
|
-
|
||||||
|
STATIC
|
||||||
|
VOID
|
||||||
|
Q35BoardVerification (
|
||||||
|
@@ -366,7 +336,6 @@ InitializePlatform (
|
||||||
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
}
|
||||||
|
|
||||||
|
- S3Verification (PlatformInfoHob);
|
||||||
|
BootModeInitialization (PlatformInfoHob);
|
||||||
|
|
||||||
|
//
|
||||||
|
--
|
||||||
|
2.40.1
|
||||||
|
|
@ -0,0 +1,47 @@
|
|||||||
|
From e54dd3f5c1ea0171317d9054d44b35d634ac4557 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Gerd Hoffmann <kraxel@redhat.com>
|
||||||
|
Date: Tue, 16 May 2023 11:47:58 +0200
|
||||||
|
Subject: [PATCH 16/27] OvmfPkg/PciHotPlugInitDxe: Do not reserve IO ports by
|
||||||
|
default.
|
||||||
|
|
||||||
|
Flip the default for IO address space reservations for PCI(e) bridges
|
||||||
|
and root ports with hotplug support from TRUE to FALSE.
|
||||||
|
|
||||||
|
PCI(e) bridges will still get IO address space assigned in case:
|
||||||
|
|
||||||
|
(a) Downstream devices actually need IO address space, or
|
||||||
|
(b) Explicit configuration, using "qemu -device
|
||||||
|
pcie-root-port,io-reserve=<size>".
|
||||||
|
|
||||||
|
In case IO address space is exhausted edk2 will stop assigning resources
|
||||||
|
to PCI(e) bridges. This is not limited to IO resources, the affected
|
||||||
|
bridges will not get any memory resources assigned either.
|
||||||
|
|
||||||
|
This patch solves this issue by not handing out the scarce IO address
|
||||||
|
space, which is not needed in most cases anyway. Result is a more
|
||||||
|
consistent PCI configuration in virtual machine configurations with many
|
||||||
|
PCie root ports.
|
||||||
|
|
||||||
|
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
|
||||||
|
Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
|
||||||
|
(cherry picked from commit 27727338b2c0e3f50eb0176a1044e903fcb3c3b1)
|
||||||
|
---
|
||||||
|
OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.c | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.c b/OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.c
|
||||||
|
index 6b2b6797b3b6..69903a600981 100644
|
||||||
|
--- a/OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.c
|
||||||
|
+++ b/OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.c
|
||||||
|
@@ -589,7 +589,7 @@ GetResourcePadding (
|
||||||
|
return EFI_INVALID_PARAMETER;
|
||||||
|
}
|
||||||
|
|
||||||
|
- DefaultIo = TRUE;
|
||||||
|
+ DefaultIo = FALSE;
|
||||||
|
DefaultMmio = TRUE;
|
||||||
|
DefaultPrefMmio = TRUE;
|
||||||
|
|
||||||
|
--
|
||||||
|
2.40.1
|
||||||
|
|
51
0017-OvmfPkg-PlatformInitLib-check-PcdUse1GPageTable.patch
Normal file
51
0017-OvmfPkg-PlatformInitLib-check-PcdUse1GPageTable.patch
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
From 543497088c1356c408f1bf79c06ab64b5c35be6b Mon Sep 17 00:00:00 2001
|
||||||
|
From: Gerd Hoffmann <kraxel@redhat.com>
|
||||||
|
Date: Wed, 17 May 2023 12:24:47 +0200
|
||||||
|
Subject: [PATCH 17/27] OvmfPkg/PlatformInitLib: check PcdUse1GPageTable
|
||||||
|
|
||||||
|
If PcdUse1GPageTable is not enabled restrict the physical address space
|
||||||
|
used to 1TB, to limit the amount of memory needed for identity mapping
|
||||||
|
page tables.
|
||||||
|
|
||||||
|
The same already happens in case the processor has no support for
|
||||||
|
gigabyte pages.
|
||||||
|
|
||||||
|
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
|
||||||
|
Acked-by: Ard Biesheuvel <ardb@kernel.org>
|
||||||
|
(cherry picked from commit d4d24001f78bcee965d8854fba6f08f48b4ec446)
|
||||||
|
---
|
||||||
|
OvmfPkg/Library/PlatformInitLib/PlatformInitLib.inf | 1 +
|
||||||
|
OvmfPkg/Library/PlatformInitLib/MemDetect.c | 5 +++++
|
||||||
|
2 files changed, 6 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/OvmfPkg/Library/PlatformInitLib/PlatformInitLib.inf b/OvmfPkg/Library/PlatformInitLib/PlatformInitLib.inf
|
||||||
|
index 86a82ad3e084..5a79d95b689c 100644
|
||||||
|
--- a/OvmfPkg/Library/PlatformInitLib/PlatformInitLib.inf
|
||||||
|
+++ b/OvmfPkg/Library/PlatformInitLib/PlatformInitLib.inf
|
||||||
|
@@ -58,6 +58,7 @@ [LibraryClasses.X64]
|
||||||
|
|
||||||
|
[Pcd]
|
||||||
|
gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress
|
||||||
|
+ gEfiMdeModulePkgTokenSpaceGuid.PcdUse1GPageTable
|
||||||
|
|
||||||
|
[FixedPcd]
|
||||||
|
gUefiOvmfPkgTokenSpaceGuid.PcdOvmfWorkAreaBase
|
||||||
|
diff --git a/OvmfPkg/Library/PlatformInitLib/MemDetect.c b/OvmfPkg/Library/PlatformInitLib/MemDetect.c
|
||||||
|
index acf90b4e93fd..1102b00ecbf0 100644
|
||||||
|
--- a/OvmfPkg/Library/PlatformInitLib/MemDetect.c
|
||||||
|
+++ b/OvmfPkg/Library/PlatformInitLib/MemDetect.c
|
||||||
|
@@ -663,6 +663,11 @@ PlatformAddressWidthFromCpuid (
|
||||||
|
PhysBits = 40;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ if (!FixedPcdGetBool (PcdUse1GPageTable) && (PhysBits > 40)) {
|
||||||
|
+ DEBUG ((DEBUG_INFO, "%a: limit PhysBits to 40 (PcdUse1GPageTable is false)\n", __func__));
|
||||||
|
+ PhysBits = 40;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
PlatformInfoHob->PhysMemAddressWidth = PhysBits;
|
||||||
|
PlatformInfoHob->FirstNonAddress = LShiftU64 (1, PlatformInfoHob->PhysMemAddressWidth);
|
||||||
|
}
|
||||||
|
--
|
||||||
|
2.40.1
|
||||||
|
|
31
0018-OvmfPkg-OvmfPkgIa32X64-enable-1G-pages.patch
Normal file
31
0018-OvmfPkg-OvmfPkgIa32X64-enable-1G-pages.patch
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
From f1bbf3e4195bb21d4edfb2af8e940bceacc2ced4 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Gerd Hoffmann <kraxel@redhat.com>
|
||||||
|
Date: Wed, 17 May 2023 12:24:48 +0200
|
||||||
|
Subject: [PATCH 18/27] OvmfPkg/OvmfPkgIa32X64: enable 1G pages
|
||||||
|
|
||||||
|
Reduces the memory footprint and speeds up booting.
|
||||||
|
|
||||||
|
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
|
||||||
|
Acked-by: Ard Biesheuvel <ardb@kernel.org>
|
||||||
|
(cherry picked from commit b63e17d746aa6bab2b1101711395725005e71a02)
|
||||||
|
---
|
||||||
|
OvmfPkg/OvmfPkgIa32X64.dsc | 3 +++
|
||||||
|
1 file changed, 3 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc
|
||||||
|
index e37ec97fbc7a..2b2f8e3e84d3 100644
|
||||||
|
--- a/OvmfPkg/OvmfPkgIa32X64.dsc
|
||||||
|
+++ b/OvmfPkg/OvmfPkgIa32X64.dsc
|
||||||
|
@@ -557,6 +557,9 @@ [PcdsFixedAtBuild]
|
||||||
|
# never lets the RAM below 4 GB exceed 2816 MB.
|
||||||
|
gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress|0xE0000000
|
||||||
|
|
||||||
|
+ # use 1G pages
|
||||||
|
+ gEfiMdeModulePkgTokenSpaceGuid.PcdUse1GPageTable|TRUE
|
||||||
|
+
|
||||||
|
!if $(SOURCE_DEBUG_ENABLE) == TRUE
|
||||||
|
gEfiSourceLevelDebugPkgTokenSpaceGuid.PcdDebugLoadImageMethod|0x2
|
||||||
|
!endif
|
||||||
|
--
|
||||||
|
2.40.1
|
||||||
|
|
31
0019-OvmfPkg-MicrovmX64-enable-1G-pages.patch
Normal file
31
0019-OvmfPkg-MicrovmX64-enable-1G-pages.patch
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
From 9c6bc52b413feda953158ad623237f6c9e7b533d Mon Sep 17 00:00:00 2001
|
||||||
|
From: Gerd Hoffmann <kraxel@redhat.com>
|
||||||
|
Date: Wed, 17 May 2023 12:24:49 +0200
|
||||||
|
Subject: [PATCH 19/27] OvmfPkg/MicrovmX64: enable 1G pages
|
||||||
|
|
||||||
|
Reduces the memory footprint and speeds up booting.
|
||||||
|
|
||||||
|
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
|
||||||
|
Acked-by: Ard Biesheuvel <ardb@kernel.org>
|
||||||
|
(cherry picked from commit 04c5b3023e49c35d291f41d2c39b4d12a62b8f9c)
|
||||||
|
---
|
||||||
|
OvmfPkg/Microvm/MicrovmX64.dsc | 3 +++
|
||||||
|
1 file changed, 3 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/OvmfPkg/Microvm/MicrovmX64.dsc b/OvmfPkg/Microvm/MicrovmX64.dsc
|
||||||
|
index 02c225f6d2a7..b0acab41103b 100644
|
||||||
|
--- a/OvmfPkg/Microvm/MicrovmX64.dsc
|
||||||
|
+++ b/OvmfPkg/Microvm/MicrovmX64.dsc
|
||||||
|
@@ -544,6 +544,9 @@ [PcdsFixedAtBuild]
|
||||||
|
gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesCode|0x100
|
||||||
|
gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesData|0x100
|
||||||
|
|
||||||
|
+ # use 1G pages
|
||||||
|
+ gEfiMdeModulePkgTokenSpaceGuid.PcdUse1GPageTable|TRUE
|
||||||
|
+
|
||||||
|
#
|
||||||
|
# Network Pcds
|
||||||
|
#
|
||||||
|
--
|
||||||
|
2.40.1
|
||||||
|
|
39
0020-OvmfPkg-VirtioSerialDxe-use-TPL_NOTIFY.patch
Normal file
39
0020-OvmfPkg-VirtioSerialDxe-use-TPL_NOTIFY.patch
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
From 71024b694fa3a6317ebbba1d79626f80d8dce792 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Gerd Hoffmann <kraxel@redhat.com>
|
||||||
|
Date: Fri, 12 May 2023 16:23:06 +0200
|
||||||
|
Subject: [PATCH 20/27] OvmfPkg/VirtioSerialDxe: use TPL_NOTIFY
|
||||||
|
|
||||||
|
Apparently TPL_CALLBACK is too low, code runs into an ASSERT
|
||||||
|
complaining the new TPL is lower than the old TPL.
|
||||||
|
|
||||||
|
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
|
||||||
|
(cherry picked from commit 4e5a804222415ec7b2bec90ea0300b8a9f60f131)
|
||||||
|
---
|
||||||
|
OvmfPkg/VirtioSerialDxe/VirtioSerialPort.c | 4 ++--
|
||||||
|
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/OvmfPkg/VirtioSerialDxe/VirtioSerialPort.c b/OvmfPkg/VirtioSerialDxe/VirtioSerialPort.c
|
||||||
|
index 522b25e9698c..e4a58deff162 100644
|
||||||
|
--- a/OvmfPkg/VirtioSerialDxe/VirtioSerialPort.c
|
||||||
|
+++ b/OvmfPkg/VirtioSerialDxe/VirtioSerialPort.c
|
||||||
|
@@ -158,7 +158,7 @@ VirtioSerialIoWrite (
|
||||||
|
|
||||||
|
VirtioSerialRingClearTx (SerialIo->Dev, PortTx (SerialIo->PortId));
|
||||||
|
|
||||||
|
- OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
|
||||||
|
+ OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
|
||||||
|
if (SerialIo->WriteOffset &&
|
||||||
|
(SerialIo->WriteOffset + *BufferSize > PORT_TX_BUFSIZE))
|
||||||
|
{
|
||||||
|
@@ -201,7 +201,7 @@ VirtioSerialIoRead (
|
||||||
|
goto NoData;
|
||||||
|
}
|
||||||
|
|
||||||
|
- OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
|
||||||
|
+ OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
|
||||||
|
if (SerialIo->WriteOffset) {
|
||||||
|
DEBUG ((DEBUG_VERBOSE, "%a:%d: WriteFlush %d\n", __func__, __LINE__, SerialIo->WriteOffset));
|
||||||
|
VirtioSerialRingSendBuffer (
|
||||||
|
--
|
||||||
|
2.40.1
|
||||||
|
|
@ -0,0 +1,51 @@
|
|||||||
|
From 8372a31938eb57921bd8a9a5dd5d56b838b074a2 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Gerd Hoffmann <kraxel@redhat.com>
|
||||||
|
Date: Thu, 1 Jun 2023 08:08:03 +0200
|
||||||
|
Subject: [PATCH 21/27] OvmfPkg/QemuFlashFvbServicesRuntimeDxe: refine flash
|
||||||
|
detection
|
||||||
|
|
||||||
|
Flash can be write-protected in qemu (which is usually the case for
|
||||||
|
code). In case the variable store flash block is configured read-only
|
||||||
|
ovmf wouldn't be able to store EFI variables there, so not setting up
|
||||||
|
fvb in that case (and fallhack to emulation) is the better option.
|
||||||
|
It'll avoid problems later due to flash writes failing.
|
||||||
|
|
||||||
|
The patch tries to write back the original value read earlier, so flash
|
||||||
|
content doesn't change in case the write succeeds. But the status we
|
||||||
|
read back after the attempt to write will tell us whenever flash is
|
||||||
|
writable or not.
|
||||||
|
|
||||||
|
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
|
||||||
|
(cherry picked from commit 578a715cfc6abc08ead8f585f096789374254b2a)
|
||||||
|
---
|
||||||
|
OvmfPkg/QemuFlashFvbServicesRuntimeDxe/QemuFlash.c | 14 +++++++++++---
|
||||||
|
1 file changed, 11 insertions(+), 3 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/QemuFlash.c b/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/QemuFlash.c
|
||||||
|
index 54f859de9ff9..a577aea55614 100644
|
||||||
|
--- a/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/QemuFlash.c
|
||||||
|
+++ b/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/QemuFlash.c
|
||||||
|
@@ -114,9 +114,17 @@ QemuFlashDetected (
|
||||||
|
DEBUG ((DEBUG_INFO, "QemuFlashDetected => FD behaves as RAM\n"));
|
||||||
|
*Ptr = OriginalUint8;
|
||||||
|
} else if (ProbeUint8 == CLEARED_ARRAY_STATUS) {
|
||||||
|
- DEBUG ((DEBUG_INFO, "QemuFlashDetected => FD behaves as FLASH\n"));
|
||||||
|
- FlashDetected = TRUE;
|
||||||
|
- *Ptr = READ_ARRAY_CMD;
|
||||||
|
+ *Ptr = WRITE_BYTE_CMD;
|
||||||
|
+ *Ptr = OriginalUint8;
|
||||||
|
+ *Ptr = READ_STATUS_CMD;
|
||||||
|
+ ProbeUint8 = *Ptr;
|
||||||
|
+ *Ptr = READ_ARRAY_CMD;
|
||||||
|
+ if (ProbeUint8 & 0x10 /* programming error */) {
|
||||||
|
+ DEBUG ((DEBUG_INFO, "QemuFlashDetected => FD behaves as FLASH, write-protected\n"));
|
||||||
|
+ } else {
|
||||||
|
+ DEBUG ((DEBUG_INFO, "QemuFlashDetected => FD behaves as FLASH, writable\n"));
|
||||||
|
+ FlashDetected = TRUE;
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
--
|
||||||
|
2.40.1
|
||||||
|
|
47
0022-OvmfPkg-PlatformInitLib-limit-phys-bits-to-46.patch
Normal file
47
0022-OvmfPkg-PlatformInitLib-limit-phys-bits-to-46.patch
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
From cdb34f5003b9001d12d1841e8a4eeab9471ab928 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Gerd Hoffmann <kraxel@redhat.com>
|
||||||
|
Date: Thu, 1 Jun 2023 09:57:31 +0200
|
||||||
|
Subject: [PATCH 22/27] OvmfPkg/PlatformInitLib: limit phys-bits to 46.
|
||||||
|
|
||||||
|
Older linux kernels have problems with phys-bits larger than 46,
|
||||||
|
ubuntu 18.04 (kernel 4.15) has been reported to be affected.
|
||||||
|
|
||||||
|
Reduce phys-bits limit from 47 to 46.
|
||||||
|
|
||||||
|
Reported-by: Fiona Ebner <f.ebner@proxmox.com>
|
||||||
|
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
|
||||||
|
(cherry picked from commit c1e853769046b322690ad336fdb98966757e7414)
|
||||||
|
---
|
||||||
|
OvmfPkg/Library/PlatformInitLib/MemDetect.c | 9 ++++++---
|
||||||
|
1 file changed, 6 insertions(+), 3 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/OvmfPkg/Library/PlatformInitLib/MemDetect.c b/OvmfPkg/Library/PlatformInitLib/MemDetect.c
|
||||||
|
index 1102b00ecbf0..662e7e85bbc5 100644
|
||||||
|
--- a/OvmfPkg/Library/PlatformInitLib/MemDetect.c
|
||||||
|
+++ b/OvmfPkg/Library/PlatformInitLib/MemDetect.c
|
||||||
|
@@ -646,16 +646,19 @@ PlatformAddressWidthFromCpuid (
|
||||||
|
));
|
||||||
|
|
||||||
|
if (Valid) {
|
||||||
|
- if (PhysBits > 47) {
|
||||||
|
+ if (PhysBits > 46) {
|
||||||
|
/*
|
||||||
|
* Avoid 5-level paging altogether for now, which limits
|
||||||
|
* PhysBits to 48. Also avoid using address bit 48, due to sign
|
||||||
|
* extension we can't identity-map these addresses (and lots of
|
||||||
|
* places in edk2 assume we have everything identity-mapped).
|
||||||
|
* So the actual limit is 47.
|
||||||
|
+ *
|
||||||
|
+ * Also some older linux kernels apparently have problems handling
|
||||||
|
+ * phys-bits > 46 correctly, so use that as limit.
|
||||||
|
*/
|
||||||
|
- DEBUG ((DEBUG_INFO, "%a: limit PhysBits to 47 (avoid 5-level paging)\n", __func__));
|
||||||
|
- PhysBits = 47;
|
||||||
|
+ DEBUG ((DEBUG_INFO, "%a: limit PhysBits to 46 (avoid 5-level paging)\n", __func__));
|
||||||
|
+ PhysBits = 46;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!Page1GSupport && (PhysBits > 40)) {
|
||||||
|
--
|
||||||
|
2.40.1
|
||||||
|
|
53
0023-ArmVirt-add-VirtioSerialDxe-to-ArmVirtQemu-builds.patch
Normal file
53
0023-ArmVirt-add-VirtioSerialDxe-to-ArmVirtQemu-builds.patch
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
From bc308234de0455d9448f6b841506bd1e2b04b024 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Gerd Hoffmann <kraxel@redhat.com>
|
||||||
|
Date: Thu, 1 Jun 2023 13:57:10 +0200
|
||||||
|
Subject: [PATCH 23/27] ArmVirt: add VirtioSerialDxe to ArmVirtQemu builds
|
||||||
|
|
||||||
|
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
|
||||||
|
Acked-by: Ard Biesheuvel <ardb@kernel.org>
|
||||||
|
(cherry picked from commit 6925150febb3a76d8e40c19babcc578555ca78fe)
|
||||||
|
---
|
||||||
|
ArmVirtPkg/ArmVirtQemu.dsc | 1 +
|
||||||
|
ArmVirtPkg/ArmVirtQemuKernel.dsc | 1 +
|
||||||
|
ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc | 1 +
|
||||||
|
3 files changed, 3 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/ArmVirtPkg/ArmVirtQemu.dsc b/ArmVirtPkg/ArmVirtQemu.dsc
|
||||||
|
index bc097880f79f..a03f5e4d43cf 100644
|
||||||
|
--- a/ArmVirtPkg/ArmVirtQemu.dsc
|
||||||
|
+++ b/ArmVirtPkg/ArmVirtQemu.dsc
|
||||||
|
@@ -453,6 +453,7 @@ [Components.common]
|
||||||
|
OvmfPkg/VirtioScsiDxe/VirtioScsi.inf
|
||||||
|
OvmfPkg/VirtioNetDxe/VirtioNet.inf
|
||||||
|
OvmfPkg/VirtioRngDxe/VirtioRng.inf
|
||||||
|
+ OvmfPkg/VirtioSerialDxe/VirtioSerial.inf
|
||||||
|
|
||||||
|
#
|
||||||
|
# FAT filesystem + GPT/MBR partitioning + UDF filesystem + virtio-fs
|
||||||
|
diff --git a/ArmVirtPkg/ArmVirtQemuKernel.dsc b/ArmVirtPkg/ArmVirtQemuKernel.dsc
|
||||||
|
index 02877284bfa3..e7d76a6502c7 100644
|
||||||
|
--- a/ArmVirtPkg/ArmVirtQemuKernel.dsc
|
||||||
|
+++ b/ArmVirtPkg/ArmVirtQemuKernel.dsc
|
||||||
|
@@ -353,6 +353,7 @@ [Components.common]
|
||||||
|
OvmfPkg/VirtioScsiDxe/VirtioScsi.inf
|
||||||
|
OvmfPkg/VirtioNetDxe/VirtioNet.inf
|
||||||
|
OvmfPkg/VirtioRngDxe/VirtioRng.inf
|
||||||
|
+ OvmfPkg/VirtioSerialDxe/VirtioSerial.inf
|
||||||
|
|
||||||
|
#
|
||||||
|
# FAT filesystem + GPT/MBR partitioning + UDF filesystem + virtio-fs
|
||||||
|
diff --git a/ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc b/ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc
|
||||||
|
index 8a063bac04ac..2894bc853a46 100644
|
||||||
|
--- a/ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc
|
||||||
|
+++ b/ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc
|
||||||
|
@@ -98,6 +98,7 @@ [FV.FvMain]
|
||||||
|
INF OvmfPkg/VirtioNetDxe/VirtioNet.inf
|
||||||
|
INF OvmfPkg/VirtioScsiDxe/VirtioScsi.inf
|
||||||
|
INF OvmfPkg/VirtioRngDxe/VirtioRng.inf
|
||||||
|
+ INF OvmfPkg/VirtioSerialDxe/VirtioSerial.inf
|
||||||
|
|
||||||
|
INF ShellPkg/Application/Shell/Shell.inf
|
||||||
|
INF ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf
|
||||||
|
--
|
||||||
|
2.40.1
|
||||||
|
|
@ -0,0 +1,68 @@
|
|||||||
|
From f0d2e5cf0f436cf48afae5e7b86bd5bd7e137751 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Gerd Hoffmann <kraxel@redhat.com>
|
||||||
|
Date: Thu, 1 Jun 2023 13:57:11 +0200
|
||||||
|
Subject: [PATCH 24/27] ArmVirt/PlatformBootManagerLib: factor out IsVirtio()
|
||||||
|
|
||||||
|
IsVirtioRng() becomes just a thin wrapper for IsVirtio().
|
||||||
|
This allows to add similar thin wrappers for other virtio
|
||||||
|
devices in the future.
|
||||||
|
|
||||||
|
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
|
||||||
|
Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
|
||||||
|
(cherry picked from commit a196b04926e70880334fcd649837d0ac63b0bfd5)
|
||||||
|
---
|
||||||
|
.../PlatformBootManagerLib/PlatformBm.c | 26 +++++++++++++++----
|
||||||
|
1 file changed, 21 insertions(+), 5 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBm.c b/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBm.c
|
||||||
|
index 10c815378cd5..5eb6f0f9c14a 100644
|
||||||
|
--- a/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBm.c
|
||||||
|
+++ b/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBm.c
|
||||||
|
@@ -269,15 +269,16 @@ IsPciDisplay (
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
- This FILTER_FUNCTION checks if a handle corresponds to a Virtio RNG device at
|
||||||
|
- the VIRTIO_DEVICE_PROTOCOL level.
|
||||||
|
+ This function checks if a handle corresponds to the Virtio Device ID given
|
||||||
|
+ at the VIRTIO_DEVICE_PROTOCOL level.
|
||||||
|
**/
|
||||||
|
STATIC
|
||||||
|
BOOLEAN
|
||||||
|
EFIAPI
|
||||||
|
-IsVirtioRng (
|
||||||
|
+IsVirtio (
|
||||||
|
IN EFI_HANDLE Handle,
|
||||||
|
- IN CONST CHAR16 *ReportText
|
||||||
|
+ IN CONST CHAR16 *ReportText,
|
||||||
|
+ IN UINT16 VirtIoDeviceId
|
||||||
|
)
|
||||||
|
{
|
||||||
|
EFI_STATUS Status;
|
||||||
|
@@ -293,7 +294,22 @@ IsVirtioRng (
|
||||||
|
}
|
||||||
|
|
||||||
|
return (BOOLEAN)(VirtIo->SubSystemDeviceId ==
|
||||||
|
- VIRTIO_SUBSYSTEM_ENTROPY_SOURCE);
|
||||||
|
+ VirtIoDeviceId);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+/**
|
||||||
|
+ This FILTER_FUNCTION checks if a handle corresponds to a Virtio RNG device at
|
||||||
|
+ the VIRTIO_DEVICE_PROTOCOL level.
|
||||||
|
+**/
|
||||||
|
+STATIC
|
||||||
|
+BOOLEAN
|
||||||
|
+EFIAPI
|
||||||
|
+IsVirtioRng (
|
||||||
|
+ IN EFI_HANDLE Handle,
|
||||||
|
+ IN CONST CHAR16 *ReportText
|
||||||
|
+ )
|
||||||
|
+{
|
||||||
|
+ return IsVirtio (Handle, ReportText, VIRTIO_SUBSYSTEM_ENTROPY_SOURCE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
--
|
||||||
|
2.40.1
|
||||||
|
|
@ -0,0 +1,90 @@
|
|||||||
|
From 7863796aacb5dc2acd852920bd33a3fec167c80b Mon Sep 17 00:00:00 2001
|
||||||
|
From: Gerd Hoffmann <kraxel@redhat.com>
|
||||||
|
Date: Thu, 1 Jun 2023 13:57:12 +0200
|
||||||
|
Subject: [PATCH 25/27] ArmVirt/PlatformBootManagerLib: factor out
|
||||||
|
IsVirtioPci()
|
||||||
|
|
||||||
|
IsVirtioPciRng() becomes just a thin wrapper for IsVirtioPci().
|
||||||
|
This allows to add similar thin wrappers for other virtio
|
||||||
|
devices in the future.
|
||||||
|
|
||||||
|
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
|
||||||
|
Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
|
||||||
|
(cherry picked from commit aaf546879ab71722c36738ccc6f0f0ab4ecf5076)
|
||||||
|
---
|
||||||
|
.../PlatformBootManagerLib/PlatformBm.c | 30 ++++++++++++++-----
|
||||||
|
1 file changed, 23 insertions(+), 7 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBm.c b/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBm.c
|
||||||
|
index 5eb6f0f9c14a..ed38c42a43ee 100644
|
||||||
|
--- a/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBm.c
|
||||||
|
+++ b/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBm.c
|
||||||
|
@@ -313,15 +313,16 @@ IsVirtioRng (
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
- This FILTER_FUNCTION checks if a handle corresponds to a Virtio RNG device at
|
||||||
|
- the EFI_PCI_IO_PROTOCOL level.
|
||||||
|
+ This function checks if a handle corresponds to the Virtio Device ID given
|
||||||
|
+ at the EFI_PCI_IO_PROTOCOL level.
|
||||||
|
**/
|
||||||
|
STATIC
|
||||||
|
BOOLEAN
|
||||||
|
EFIAPI
|
||||||
|
-IsVirtioPciRng (
|
||||||
|
+IsVirtioPci (
|
||||||
|
IN EFI_HANDLE Handle,
|
||||||
|
- IN CONST CHAR16 *ReportText
|
||||||
|
+ IN CONST CHAR16 *ReportText,
|
||||||
|
+ IN UINT16 VirtIoDeviceId
|
||||||
|
)
|
||||||
|
{
|
||||||
|
EFI_STATUS Status;
|
||||||
|
@@ -387,11 +388,11 @@ IsVirtioPciRng (
|
||||||
|
//
|
||||||
|
// From DeviceId and RevisionId, determine whether the device is a
|
||||||
|
// modern-only Virtio 1.0 device. In case of Virtio 1.0, DeviceId can
|
||||||
|
- // immediately be restricted to VIRTIO_SUBSYSTEM_ENTROPY_SOURCE, and
|
||||||
|
+ // immediately be restricted to VirtIoDeviceId, and
|
||||||
|
// SubsystemId will only play a sanity-check role. Otherwise, DeviceId can
|
||||||
|
// only be sanity-checked, and SubsystemId will decide.
|
||||||
|
//
|
||||||
|
- if ((DeviceId == 0x1040 + VIRTIO_SUBSYSTEM_ENTROPY_SOURCE) &&
|
||||||
|
+ if ((DeviceId == 0x1040 + VirtIoDeviceId) &&
|
||||||
|
(RevisionId >= 0x01))
|
||||||
|
{
|
||||||
|
Virtio10 = TRUE;
|
||||||
|
@@ -419,7 +420,7 @@ IsVirtioPciRng (
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
- if (!Virtio10 && (SubsystemId == VIRTIO_SUBSYSTEM_ENTROPY_SOURCE)) {
|
||||||
|
+ if (!Virtio10 && (SubsystemId == VirtIoDeviceId)) {
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -430,6 +431,21 @@ IsVirtioPciRng (
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
+/**
|
||||||
|
+ This FILTER_FUNCTION checks if a handle corresponds to a Virtio RNG device at
|
||||||
|
+ the EFI_PCI_IO_PROTOCOL level.
|
||||||
|
+**/
|
||||||
|
+STATIC
|
||||||
|
+BOOLEAN
|
||||||
|
+EFIAPI
|
||||||
|
+IsVirtioPciRng (
|
||||||
|
+ IN EFI_HANDLE Handle,
|
||||||
|
+ IN CONST CHAR16 *ReportText
|
||||||
|
+ )
|
||||||
|
+{
|
||||||
|
+ return IsVirtioPci (Handle, ReportText, VIRTIO_SUBSYSTEM_ENTROPY_SOURCE);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
/**
|
||||||
|
This CALLBACK_FUNCTION attempts to connect a handle non-recursively, asking
|
||||||
|
the matching driver to produce all first-level child handles.
|
||||||
|
--
|
||||||
|
2.40.1
|
||||||
|
|
222
0026-ArmVirt-PlatformBootManagerLib-set-up-virtio-serial-.patch
Normal file
222
0026-ArmVirt-PlatformBootManagerLib-set-up-virtio-serial-.patch
Normal file
@ -0,0 +1,222 @@
|
|||||||
|
From 83a8a9dc1a51d340199587d5bea715406bbc4efa Mon Sep 17 00:00:00 2001
|
||||||
|
From: Gerd Hoffmann <kraxel@redhat.com>
|
||||||
|
Date: Thu, 1 Jun 2023 13:57:13 +0200
|
||||||
|
Subject: [PATCH 26/27] ArmVirt/PlatformBootManagerLib: set up virtio serial as
|
||||||
|
console
|
||||||
|
|
||||||
|
In case a virtio serial device is found in the system register the first
|
||||||
|
console port as EFI console, by updating ConIn, ConOut and ErrOut.
|
||||||
|
|
||||||
|
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
|
||||||
|
(cherry picked from commit 15f83fa36442eaa272300b31699b3b82ce7e07a9)
|
||||||
|
---
|
||||||
|
.../PlatformBootManagerLib/PlatformBm.c | 172 ++++++++++++++++++
|
||||||
|
1 file changed, 172 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBm.c b/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBm.c
|
||||||
|
index ed38c42a43ee..b92a916f7eec 100644
|
||||||
|
--- a/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBm.c
|
||||||
|
+++ b/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBm.c
|
||||||
|
@@ -312,6 +312,21 @@ IsVirtioRng (
|
||||||
|
return IsVirtio (Handle, ReportText, VIRTIO_SUBSYSTEM_ENTROPY_SOURCE);
|
||||||
|
}
|
||||||
|
|
||||||
|
+/**
|
||||||
|
+ This FILTER_FUNCTION checks if a handle corresponds to a Virtio serial device at
|
||||||
|
+ the VIRTIO_DEVICE_PROTOCOL level.
|
||||||
|
+**/
|
||||||
|
+STATIC
|
||||||
|
+BOOLEAN
|
||||||
|
+EFIAPI
|
||||||
|
+IsVirtioSerial (
|
||||||
|
+ IN EFI_HANDLE Handle,
|
||||||
|
+ IN CONST CHAR16 *ReportText
|
||||||
|
+ )
|
||||||
|
+{
|
||||||
|
+ return IsVirtio (Handle, ReportText, VIRTIO_SUBSYSTEM_CONSOLE);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
/**
|
||||||
|
This function checks if a handle corresponds to the Virtio Device ID given
|
||||||
|
at the EFI_PCI_IO_PROTOCOL level.
|
||||||
|
@@ -446,6 +461,21 @@ IsVirtioPciRng (
|
||||||
|
return IsVirtioPci (Handle, ReportText, VIRTIO_SUBSYSTEM_ENTROPY_SOURCE);
|
||||||
|
}
|
||||||
|
|
||||||
|
+/**
|
||||||
|
+ This FILTER_FUNCTION checks if a handle corresponds to a Virtio serial device at
|
||||||
|
+ the EFI_PCI_IO_PROTOCOL level.
|
||||||
|
+**/
|
||||||
|
+STATIC
|
||||||
|
+BOOLEAN
|
||||||
|
+EFIAPI
|
||||||
|
+IsVirtioPciSerial (
|
||||||
|
+ IN EFI_HANDLE Handle,
|
||||||
|
+ IN CONST CHAR16 *ReportText
|
||||||
|
+ )
|
||||||
|
+{
|
||||||
|
+ return IsVirtioPci (Handle, ReportText, VIRTIO_SUBSYSTEM_CONSOLE);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
/**
|
||||||
|
This CALLBACK_FUNCTION attempts to connect a handle non-recursively, asking
|
||||||
|
the matching driver to produce all first-level child handles.
|
||||||
|
@@ -534,6 +564,142 @@ AddOutput (
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
+/**
|
||||||
|
+ This CALLBACK_FUNCTION retrieves the EFI_DEVICE_PATH_PROTOCOL from
|
||||||
|
+ the handle, appends serial, uart and terminal nodes, finally updates
|
||||||
|
+ ConIn, ConOut and ErrOut.
|
||||||
|
+**/
|
||||||
|
+STATIC
|
||||||
|
+VOID
|
||||||
|
+EFIAPI
|
||||||
|
+SetupVirtioSerial (
|
||||||
|
+ IN EFI_HANDLE Handle,
|
||||||
|
+ IN CONST CHAR16 *ReportText
|
||||||
|
+ )
|
||||||
|
+{
|
||||||
|
+ STATIC CONST ACPI_HID_DEVICE_PATH SerialNode = {
|
||||||
|
+ {
|
||||||
|
+ ACPI_DEVICE_PATH,
|
||||||
|
+ ACPI_DP,
|
||||||
|
+ {
|
||||||
|
+ (UINT8)(sizeof (ACPI_HID_DEVICE_PATH)),
|
||||||
|
+ (UINT8)((sizeof (ACPI_HID_DEVICE_PATH)) >> 8)
|
||||||
|
+ },
|
||||||
|
+ },
|
||||||
|
+ EISA_PNP_ID (0x0501),
|
||||||
|
+ 0
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
+ STATIC CONST UART_DEVICE_PATH UartNode = {
|
||||||
|
+ {
|
||||||
|
+ MESSAGING_DEVICE_PATH,
|
||||||
|
+ MSG_UART_DP,
|
||||||
|
+ {
|
||||||
|
+ (UINT8)(sizeof (UART_DEVICE_PATH)),
|
||||||
|
+ (UINT8)((sizeof (UART_DEVICE_PATH)) >> 8)
|
||||||
|
+ },
|
||||||
|
+ },
|
||||||
|
+ 0,
|
||||||
|
+ 115200,
|
||||||
|
+ 8,
|
||||||
|
+ 1,
|
||||||
|
+ 1
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
+ STATIC CONST VENDOR_DEVICE_PATH TerminalNode = {
|
||||||
|
+ {
|
||||||
|
+ MESSAGING_DEVICE_PATH,
|
||||||
|
+ MSG_VENDOR_DP,
|
||||||
|
+ {
|
||||||
|
+ (UINT8)(sizeof (VENDOR_DEVICE_PATH)),
|
||||||
|
+ (UINT8)((sizeof (VENDOR_DEVICE_PATH)) >> 8)
|
||||||
|
+ },
|
||||||
|
+ },
|
||||||
|
+ DEVICE_PATH_MESSAGING_VT_UTF8
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
+ EFI_STATUS Status;
|
||||||
|
+ EFI_DEVICE_PATH_PROTOCOL *DevicePath, *OldDevicePath;
|
||||||
|
+
|
||||||
|
+ DevicePath = DevicePathFromHandle (Handle);
|
||||||
|
+
|
||||||
|
+ if (DevicePath == NULL) {
|
||||||
|
+ DEBUG ((
|
||||||
|
+ DEBUG_ERROR,
|
||||||
|
+ "%a: %s: handle %p: device path not found\n",
|
||||||
|
+ __func__,
|
||||||
|
+ ReportText,
|
||||||
|
+ Handle
|
||||||
|
+ ));
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ DevicePath = AppendDevicePathNode (
|
||||||
|
+ DevicePath,
|
||||||
|
+ &SerialNode.Header
|
||||||
|
+ );
|
||||||
|
+
|
||||||
|
+ OldDevicePath = DevicePath;
|
||||||
|
+ DevicePath = AppendDevicePathNode (
|
||||||
|
+ DevicePath,
|
||||||
|
+ &UartNode.Header
|
||||||
|
+ );
|
||||||
|
+ FreePool (OldDevicePath);
|
||||||
|
+
|
||||||
|
+ OldDevicePath = DevicePath;
|
||||||
|
+ DevicePath = AppendDevicePathNode (
|
||||||
|
+ DevicePath,
|
||||||
|
+ &TerminalNode.Header
|
||||||
|
+ );
|
||||||
|
+ FreePool (OldDevicePath);
|
||||||
|
+
|
||||||
|
+ Status = EfiBootManagerUpdateConsoleVariable (ConIn, DevicePath, NULL);
|
||||||
|
+ if (EFI_ERROR (Status)) {
|
||||||
|
+ DEBUG ((
|
||||||
|
+ DEBUG_ERROR,
|
||||||
|
+ "%a: %s: adding to ConIn: %r\n",
|
||||||
|
+ __func__,
|
||||||
|
+ ReportText,
|
||||||
|
+ Status
|
||||||
|
+ ));
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ Status = EfiBootManagerUpdateConsoleVariable (ConOut, DevicePath, NULL);
|
||||||
|
+ if (EFI_ERROR (Status)) {
|
||||||
|
+ DEBUG ((
|
||||||
|
+ DEBUG_ERROR,
|
||||||
|
+
|
||||||
|
+ "%a: %s: adding to ConOut: %r\n",
|
||||||
|
+ __func__,
|
||||||
|
+ ReportText,
|
||||||
|
+ Status
|
||||||
|
+ ));
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ Status = EfiBootManagerUpdateConsoleVariable (ErrOut, DevicePath, NULL);
|
||||||
|
+ if (EFI_ERROR (Status)) {
|
||||||
|
+ DEBUG ((
|
||||||
|
+ DEBUG_ERROR,
|
||||||
|
+ "%a: %s: adding to ErrOut: %r\n",
|
||||||
|
+ __func__,
|
||||||
|
+ ReportText,
|
||||||
|
+ Status
|
||||||
|
+ ));
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ FreePool (DevicePath);
|
||||||
|
+
|
||||||
|
+ DEBUG ((
|
||||||
|
+ DEBUG_VERBOSE,
|
||||||
|
+ "%a: %s: added to ConIn, ConOut and ErrOut\n",
|
||||||
|
+ __func__,
|
||||||
|
+ ReportText
|
||||||
|
+ ));
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
STATIC
|
||||||
|
VOID
|
||||||
|
PlatformRegisterFvBootOption (
|
||||||
|
@@ -932,6 +1098,12 @@ PlatformBootManagerBeforeConsole (
|
||||||
|
// instances on Virtio PCI RNG devices.
|
||||||
|
//
|
||||||
|
FilterAndProcess (&gEfiPciIoProtocolGuid, IsVirtioPciRng, Connect);
|
||||||
|
+
|
||||||
|
+ //
|
||||||
|
+ // Register Virtio serial devices as console.
|
||||||
|
+ //
|
||||||
|
+ FilterAndProcess (&gVirtioDeviceProtocolGuid, IsVirtioSerial, SetupVirtioSerial);
|
||||||
|
+ FilterAndProcess (&gEfiPciIoProtocolGuid, IsVirtioPciSerial, SetupVirtioSerial);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
--
|
||||||
|
2.40.1
|
||||||
|
|
@ -0,0 +1,42 @@
|
|||||||
|
From e2fb1116801f5725812b37f18022fe46959bd5fb Mon Sep 17 00:00:00 2001
|
||||||
|
From: Gerd Hoffmann <kraxel@redhat.com>
|
||||||
|
Date: Tue, 28 Feb 2023 15:47:00 +0100
|
||||||
|
Subject: [PATCH 27/27] UefiCpuPkg/MpInitLib: fix apic mode for cpu hotplug
|
||||||
|
|
||||||
|
In case the number of CPUs can in increase beyond 255
|
||||||
|
due to CPU hotplug choose x2apic mode.
|
||||||
|
|
||||||
|
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
|
||||||
|
---
|
||||||
|
UefiCpuPkg/Library/MpInitLib/MpLib.c | 8 +++++++-
|
||||||
|
1 file changed, 7 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c b/UefiCpuPkg/Library/MpInitLib/MpLib.c
|
||||||
|
index f1f284071441..79fd8fb04dad 100644
|
||||||
|
--- a/UefiCpuPkg/Library/MpInitLib/MpLib.c
|
||||||
|
+++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c
|
||||||
|
@@ -526,7 +526,9 @@ CollectProcessorCount (
|
||||||
|
//
|
||||||
|
// Enable x2APIC mode if
|
||||||
|
// 1. Number of CPU is greater than 255; or
|
||||||
|
- // 2. There are any logical processors reporting an Initial APIC ID of 255 or greater.
|
||||||
|
+ // 2. The platform exposed the exact *boot* CPU count to us in advance, and
|
||||||
|
+ // more than 255 logical processors are possible later, with hotplug; or
|
||||||
|
+ // 3. There are any logical processors reporting an Initial APIC ID of 255 or greater.
|
||||||
|
//
|
||||||
|
X2Apic = FALSE;
|
||||||
|
if (CpuMpData->CpuCount > 255) {
|
||||||
|
@@ -534,6 +536,10 @@ CollectProcessorCount (
|
||||||
|
// If there are more than 255 processor found, force to enable X2APIC
|
||||||
|
//
|
||||||
|
X2Apic = TRUE;
|
||||||
|
+ } else if ((PcdGet32 (PcdCpuBootLogicalProcessorNumber) > 0) &&
|
||||||
|
+ (PcdGet32 (PcdCpuMaxLogicalProcessorNumber) > 255))
|
||||||
|
+ {
|
||||||
|
+ X2Apic = TRUE;
|
||||||
|
} else {
|
||||||
|
CpuInfoInHob = (CPU_INFO_IN_HOB *)(UINTN)CpuMpData->CpuInfoInHob;
|
||||||
|
for (Index = 0; Index < CpuMpData->CpuCount; Index++) {
|
||||||
|
--
|
||||||
|
2.40.1
|
||||||
|
|
14
edk2.spec
14
edk2.spec
@ -100,6 +100,20 @@ Patch0011: 0011-CryptoPkg-OpensslLib-list-RHEL8-specific-OpenSSL-fil.patch
|
|||||||
Patch0012: 0012-OvmfPkg-QemuKernelLoaderFsDxe-suppress-error-on-no-k.patch
|
Patch0012: 0012-OvmfPkg-QemuKernelLoaderFsDxe-suppress-error-on-no-k.patch
|
||||||
Patch0013: 0013-SecurityPkg-Tcg2Dxe-suppress-error-on-no-swtpm-in-si.patch
|
Patch0013: 0013-SecurityPkg-Tcg2Dxe-suppress-error-on-no-swtpm-in-si.patch
|
||||||
|
|
||||||
|
Patch0015: 0015-OvmfPkg-PlatformPei-drop-S3Verification.patch
|
||||||
|
Patch0016: 0016-OvmfPkg-PciHotPlugInitDxe-Do-not-reserve-IO-ports-by.patch
|
||||||
|
Patch0017: 0017-OvmfPkg-PlatformInitLib-check-PcdUse1GPageTable.patch
|
||||||
|
Patch0018: 0018-OvmfPkg-OvmfPkgIa32X64-enable-1G-pages.patch
|
||||||
|
Patch0019: 0019-OvmfPkg-MicrovmX64-enable-1G-pages.patch
|
||||||
|
Patch0020: 0020-OvmfPkg-VirtioSerialDxe-use-TPL_NOTIFY.patch
|
||||||
|
Patch0021: 0021-OvmfPkg-QemuFlashFvbServicesRuntimeDxe-refine-flash-.patch
|
||||||
|
Patch0022: 0022-OvmfPkg-PlatformInitLib-limit-phys-bits-to-46.patch
|
||||||
|
Patch0023: 0023-ArmVirt-add-VirtioSerialDxe-to-ArmVirtQemu-builds.patch
|
||||||
|
Patch0024: 0024-ArmVirt-PlatformBootManagerLib-factor-out-IsVirtio.patch
|
||||||
|
Patch0025: 0025-ArmVirt-PlatformBootManagerLib-factor-out-IsVirtioPc.patch
|
||||||
|
Patch0026: 0026-ArmVirt-PlatformBootManagerLib-set-up-virtio-serial-.patch
|
||||||
|
Patch0027: 0027-UefiCpuPkg-MpInitLib-fix-apic-mode-for-cpu-hotplug.patch
|
||||||
|
|
||||||
|
|
||||||
# python3-devel and libuuid-devel are required for building tools.
|
# python3-devel and libuuid-devel are required for building tools.
|
||||||
# python3-devel is also needed for varstore template generation and
|
# python3-devel is also needed for varstore template generation and
|
||||||
|
Loading…
Reference in New Issue
Block a user