public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/edk2] rawhide: backport arm uart fix
@ 2026-11-30 14:15 Gerd Hoffmann
  0 siblings, 0 replies; only message in thread
From: Gerd Hoffmann @ 2026-11-30 14:15 UTC (permalink / raw)
  To: git-commits

A new commit has been pushed.

Repo   : rpms/edk2
Branch : rawhide
Commit : 9eaffe7cf843648fd83d477672507ae912d10715
Author : Gerd Hoffmann <kraxel@redhat.com>
Date   : 2026-11-30T08:38:40+01:00
Stats  : +211/-59 in 4 file(s)
URL    : https://src.fedoraproject.org/rpms/edk2/c/9eaffe7cf843648fd83d477672507ae912d10715?branch=rawhide

Log:
backport arm uart fix

---
diff --git a/0026-SecurityPkg-AuthVariableLib-verify-signature-count-f.patch b/0026-SecurityPkg-AuthVariableLib-verify-signature-count-f.patch
new file mode 100644
index 0000000..43ee5f4
--- /dev/null
+++ b/0026-SecurityPkg-AuthVariableLib-verify-signature-count-f.patch
@@ -0,0 +1,58 @@
+From c7ff7e43780012c6bfaeb53dabcb16d1f99ffa35 Mon Sep 17 00:00:00 2001
+From: Gerd Hoffmann <kraxel@redhat.com>
+Date: Mon, 23 Nov 2026 08:14:45 +0100
+Subject: [PATCH 26/27] SecurityPkg/AuthVariableLib: verify signature count for
+ x509 certificates
+
+Add SigListCount variable to make the code a bit more readable.
+Verify SigListCount is one for x509 cerificates.
+
+Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
+---
+ SecurityPkg/Library/AuthVariableLib/AuthService.c | 9 ++++++++-
+ 1 file changed, 8 insertions(+), 1 deletion(-)
+
+diff --git a/SecurityPkg/Library/AuthVariableLib/AuthService.c b/SecurityPkg/Library/AuthVariableLib/AuthService.c
+index 741669912043..1f795700547d 100644
+--- a/SecurityPkg/Library/AuthVariableLib/AuthService.c
++++ b/SecurityPkg/Library/AuthVariableLib/AuthService.c
+@@ -557,6 +557,7 @@ CheckSignatureListFormat (
+   UINTN               SigDataSize;
+   UINT32              Index;
+   UINT32              SigCount;
++  UINT32              SigListCount;
+   BOOLEAN             IsPk;
+   EFI_SIGNATURE_DATA  *CertData;
+   UINTN               CertLen;
+@@ -605,6 +606,8 @@ CheckSignatureListFormat (
+       return EFI_INVALID_PARAMETER;
+     }
+ 
++    SigListCount = (SigList->SignatureListSize - sizeof (EFI_SIGNATURE_LIST) - SigList->SignatureHeaderSize) / SigList->SignatureSize;
++
+     for (Index = 0; Index < (sizeof (mSupportSigItem) / sizeof (EFI_SIGNATURE_ITEM)); Index++ ) {
+       if (CompareGuid (&SigList->SignatureType, &mSupportSigItem[Index].SigType)) {
+         //
+@@ -635,6 +638,10 @@ CheckSignatureListFormat (
+     }
+ 
+     if (CompareGuid (&SigList->SignatureType, &gEfiCertX509Guid)) {
++      if (SigListCount != 1) {
++        return EFI_INVALID_PARAMETER;
++      }
++
+       //
+       // Try to retrieve the RSA public key from the X.509 certificate.
+       // If this operation fails, it's not a valid certificate.
+@@ -647,7 +654,7 @@ CheckSignatureListFormat (
+       }
+     }
+ 
+-    SigCount += (SigList->SignatureListSize - sizeof (EFI_SIGNATURE_LIST) - SigList->SignatureHeaderSize) / SigList->SignatureSize;
++    SigCount += SigListCount;
+ 
+     SigDataSize -= SigList->SignatureListSize;
+     SigList      = (EFI_SIGNATURE_LIST *)((UINT8 *)SigList + SigList->SignatureListSize);
+-- 
+2.56.1
+

diff --git a/0026-SecurityPkg-AuthVariableLib-verify-the-signature-cou.patch b/0026-SecurityPkg-AuthVariableLib-verify-the-signature-cou.patch
deleted file mode 100644
index 3948f0c..0000000
--- a/0026-SecurityPkg-AuthVariableLib-verify-the-signature-cou.patch
+++ /dev/null
@@ -1,58 +0,0 @@
-From dadd0b0e72bcbb9c544381c75b73f8cc738f4b8a Mon Sep 17 00:00:00 2001
-From: Gerd Hoffmann <kraxel@redhat.com>
-Date: Mon, 23 Nov 2026 08:14:45 +0100
-Subject: [PATCH 26/26] SecurityPkg/AuthVariableLib: verify the signature count
- for x509 certificates
-
-Add SigListCount variable to make the code a bit more readable.
-Verify SigListCount is one for x509 cerificates.
-
-Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
----
- SecurityPkg/Library/AuthVariableLib/AuthService.c | 9 ++++++++-
- 1 file changed, 8 insertions(+), 1 deletion(-)
-
-diff --git a/SecurityPkg/Library/AuthVariableLib/AuthService.c b/SecurityPkg/Library/AuthVariableLib/AuthService.c
-index 741669912043..1f795700547d 100644
---- a/SecurityPkg/Library/AuthVariableLib/AuthService.c
-+++ b/SecurityPkg/Library/AuthVariableLib/AuthService.c
-@@ -557,6 +557,7 @@ CheckSignatureListFormat (
-   UINTN               SigDataSize;
-   UINT32              Index;
-   UINT32              SigCount;
-+  UINT32              SigListCount;
-   BOOLEAN             IsPk;
-   EFI_SIGNATURE_DATA  *CertData;
-   UINTN               CertLen;
-@@ -605,6 +606,8 @@ CheckSignatureListFormat (
-       return EFI_INVALID_PARAMETER;
-     }
- 
-+    SigListCount = (SigList->SignatureListSize - sizeof (EFI_SIGNATURE_LIST) - SigList->SignatureHeaderSize) / SigList->SignatureSize;
-+
-     for (Index = 0; Index < (sizeof (mSupportSigItem) / sizeof (EFI_SIGNATURE_ITEM)); Index++ ) {
-       if (CompareGuid (&SigList->SignatureType, &mSupportSigItem[Index].SigType)) {
-         //
-@@ -635,6 +638,10 @@ CheckSignatureListFormat (
-     }
- 
-     if (CompareGuid (&SigList->SignatureType, &gEfiCertX509Guid)) {
-+      if (SigListCount != 1) {
-+        return EFI_INVALID_PARAMETER;
-+      }
-+
-       //
-       // Try to retrieve the RSA public key from the X.509 certificate.
-       // If this operation fails, it's not a valid certificate.
-@@ -647,7 +654,7 @@ CheckSignatureListFormat (
-       }
-     }
- 
--    SigCount += (SigList->SignatureListSize - sizeof (EFI_SIGNATURE_LIST) - SigList->SignatureHeaderSize) / SigList->SignatureSize;
-+    SigCount += SigListCount;
- 
-     SigDataSize -= SigList->SignatureListSize;
-     SigList      = (EFI_SIGNATURE_LIST *)((UINT8 *)SigList + SigList->SignatureListSize);
--- 
-2.56.1
-

diff --git a/0027-ArmVirtPkg-QemuVirtMemInfoLib-Map-two-PL011-UARTs-in.patch b/0027-ArmVirtPkg-QemuVirtMemInfoLib-Map-two-PL011-UARTs-in.patch
new file mode 100644
index 0000000..d1175ab
--- /dev/null
+++ b/0027-ArmVirtPkg-QemuVirtMemInfoLib-Map-two-PL011-UARTs-in.patch
@@ -0,0 +1,151 @@
+From 509bde07dac99cfc499c301e75e6a941cfab85f8 Mon Sep 17 00:00:00 2001
+From: Luigi Leonardi <leonardi@redhat.com>
+Date: Fri, 27 Nov 2026 12:29:55 +0100
+Subject: [PATCH 27/27] ArmVirtPkg/QemuVirtMemInfoLib: Map two PL011 UARTs in
+ PEI
+
+Commit 158c1b614b ("ArmVirtPkg: Refactor virtual memory mapping for
+qemu guest firmware") restricted the PEI memory map to the System
+Memory, the FV and the console UART selected by "/chosen".
+
+When QEMU's virt machine is launched with two -serial options, the DT
+describes two PL011 UARTs and DebugLib routes DEBUG output to the one
+that is not the console. That UART is not mapped, so the first DEBUG
+print after the MMU is enabled triggers an exception and the firmware
+hangs.
+
+Map at most the two PL011 UARTs reported by FdtSerialGetPorts(), so
+that both the console and the debug UART are accessible. Also bump
+MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS to account for the extra entry.
+
+Fixes: 158c1b614bb0 ("ArmVirtPkg: Refactor virtual memory mapping for qemu guest firmware")
+Signed-off-by: Luigi Leonardi <leonardi@redhat.com>
+(cherry picked from commit aec2441aff9ab3f35ebe09d85847df46a523d21f)
+---
+ .../QemuVirtMemInfoLib/QemuVirtMemInfoLib.c   | 82 ++++++-------------
+ 1 file changed, 24 insertions(+), 58 deletions(-)
+
+diff --git a/ArmVirtPkg/Library/QemuVirtMemInfoLib/QemuVirtMemInfoLib.c b/ArmVirtPkg/Library/QemuVirtMemInfoLib/QemuVirtMemInfoLib.c
+index 5b963ec42dd6..0c713e838531 100644
+--- a/ArmVirtPkg/Library/QemuVirtMemInfoLib/QemuVirtMemInfoLib.c
++++ b/ArmVirtPkg/Library/QemuVirtMemInfoLib/QemuVirtMemInfoLib.c
+@@ -20,7 +20,7 @@
+ #include <Library/FdtLib.h>
+ 
+ // Number of Virtual Memory Map Descriptors
+-#define MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS  (5)
++#define MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS  (6)
+ 
+ /** A macro to trace the memory map.
+ **/
+@@ -59,49 +59,6 @@ QemuVirtMemInfoLibConstructor (
+   return RETURN_SUCCESS;
+ }
+ 
+-/**
+-  Get the serial port base address to be used for the serial console output.
+-
+-  @param[in]  DeviceTreeBase        Base address of the Device Tree.
+-  @param[out] UartBase              Base address of the Uart.
+-
+-  @retval RETURN_INVALID_PARAMETER  Device Tree Base address is invalid.
+-  @retval RETURN_NOT_FOUND          No enabled console port has been found.
+-  @retval RETURN_SUCCESS            BaseAddress has been populated.
+-**/
+-STATIC
+-RETURN_STATUS
+-EFIAPI
+-GetUartBase (
+-  IN  VOID    *DeviceTreeBase,
+-  OUT UINT64  *UartBase
+-  )
+-{
+-  RETURN_STATUS     RetStatus;
+-  FDT_SERIAL_PORTS  Ports;
+-
+-  if (DeviceTreeBase == NULL) {
+-    return RETURN_INVALID_PARAMETER;
+-  }
+-
+-  RetStatus = FdtSerialGetPorts (DeviceTreeBase, "arm,pl011", &Ports);
+-  if (RETURN_ERROR (RetStatus)) {
+-    return RetStatus;
+-  }
+-
+-  //
+-  // Default to the first port found, but (if there are multiple ports) allow
+-  // the "/chosen" node to override it. Note that if FdtSerialGetConsolePort()
+-  // fails, it does not modify UartBase.
+-  //
+-  *UartBase = Ports.BaseAddress[0];
+-  if (Ports.NumberOfPorts > 1) {
+-    FdtSerialGetConsolePort (DeviceTreeBase, UartBase);
+-  }
+-
+-  return RETURN_SUCCESS;
+-}
+-
+ /**
+   Get the QEMU fw_cfg MMIO region from the device tree.
+ 
+@@ -198,7 +155,8 @@ ArmVirtGetMemoryMap (
+   VOID                          *DeviceTreeBase;
+   UINT64                        MappingBase;
+   UINT64                        MappingSize;
+-  UINT64                        UartBase;
++  UINTN                         PortIdx;
++  FDT_SERIAL_PORTS              Ports;
+   UINT64                        FwCfgBase;
+   UINT64                        FwCfgSize;
+ 
+@@ -223,8 +181,12 @@ ArmVirtGetMemoryMap (
+     return;
+   }
+ 
+-  RetStatus = GetUartBase (DeviceTreeBase, &UartBase);
+-  if (RETURN_ERROR (RetStatus) || (UartBase == 0)) {
++  //
++  // Map at most two PL011 UARTs, as reported by FdtSerialGetPorts(). When
++  // two are present, the console uses the one selected by "/chosen" and
++  // DebugLib uses the other one.
++  RetStatus = FdtSerialGetPorts (DeviceTreeBase, "arm,pl011", &Ports);
++  if (RETURN_ERROR (RetStatus)) {
+     ASSERT_RETURN_ERROR (RetStatus);
+     return;
+   }
+@@ -270,17 +232,21 @@ ArmVirtGetMemoryMap (
+   LOG_MEM_MAP ("FV Region");
+   Idx++;
+ 
+-  // Map the UART
+-  MappingBase = UartBase & ~(UINT64)EFI_PAGE_MASK;
+-  MappingSize = EFI_PAGES_TO_SIZE (
+-                  EFI_SIZE_TO_PAGES (UartBase - MappingBase + EFI_PAGE_SIZE)
+-                  );
+-  VirtualMemoryTable[Idx].PhysicalBase = (MappingBase | DevMapBit);
+-  VirtualMemoryTable[Idx].VirtualBase  = MappingBase;
+-  VirtualMemoryTable[Idx].Length       = MappingSize;
+-  VirtualMemoryTable[Idx].Attributes   = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE;
+-  LOG_MEM_MAP ("Serial Port");
+-  Idx++;
++  // Map the UARTs
++  for (PortIdx = 0; PortIdx < Ports.NumberOfPorts; PortIdx++) {
++    MappingBase = Ports.BaseAddress[PortIdx] & ~(UINT64)EFI_PAGE_MASK;
++    MappingSize = EFI_PAGES_TO_SIZE (
++                    EFI_SIZE_TO_PAGES (
++                      Ports.BaseAddress[PortIdx] - MappingBase + EFI_PAGE_SIZE
++                      )
++                    );
++    VirtualMemoryTable[Idx].PhysicalBase = (MappingBase | DevMapBit);
++    VirtualMemoryTable[Idx].VirtualBase  = MappingBase;
++    VirtualMemoryTable[Idx].Length       = MappingSize;
++    VirtualMemoryTable[Idx].Attributes   = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE;
++    LOG_MEM_MAP ("Serial Port");
++    Idx++;
++  }
+ 
+   // Map the fw_cfg MMIO region
+   MappingBase = FwCfgBase & ~(UINT64)EFI_PAGE_MASK;
+-- 
+2.56.1
+

diff --git a/edk2.spec b/edk2.spec
index df8e8f5..1e13e32 100644
--- a/edk2.spec
+++ b/edk2.spec
@@ -153,7 +153,8 @@ Patch0022: 0022-pqc-SecurityPkg-AuthVariableLib-factor-out-certifica.patch
 Patch0023: 0023-pqc-SecurityPkg-AuthVariableLib-accept-ml-dsa-certif.patch
 Patch0024: 0024-SecurityPkg-AuthVariableLib-add-CheckSignatureListFo.patch
 Patch0025: 0025-SecurityPkg-AuthVariableLib-move-SigList-SignatureSi.patch
-Patch0026: 0026-SecurityPkg-AuthVariableLib-verify-the-signature-cou.patch
+Patch0026: 0026-SecurityPkg-AuthVariableLib-verify-signature-count-f.patch
+Patch0027: 0027-ArmVirtPkg-QemuVirtMemInfoLib-Map-two-PL011-UARTs-in.patch
 
 
 # needed by %prep

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-11-30 14:15 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-30 14:15 [rpms/edk2] rawhide: backport arm uart fix Gerd Hoffmann

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