diff --git a/0001-powerpc-increase-MIN-RMA-size-for-CAS-negotiation.patch b/0001-powerpc-increase-MIN-RMA-size-for-CAS-negotiation.patch new file mode 100644 index 0000000..013b7aa --- /dev/null +++ b/0001-powerpc-increase-MIN-RMA-size-for-CAS-negotiation.patch @@ -0,0 +1,102 @@ +From 68a2663cc316d55c2670a639c8a4a2a43ffdb141 Mon Sep 17 00:00:00 2001 +From: Avnish Chouhan +Date: Wed, 15 Jan 2025 17:46:05 +0530 +Subject: [PATCH] powerpc: increase MIN RMA size for CAS negotiation + +Change RMA size from 512 MB to 768 MB which will result +in more memory at boot time for PowerPC. When PowerPC LPAR use/uses vTPM, +Secure Boot or FADump, the 512 MB RMA memory is not sufficient for +booting. With this 512 MB RMA, GRUB2 run out of memory and unable to +load the necessary. Sometimes even usage of CDROM which requires more +memory for installation along with the options mentioned above troubles +the boot memory and result in boot failures. Increasing the RMA size +will resolves multiple out of memory issues observed in PowerPC. + +Failure details (GRUB2 debugs): + +kern/ieee1275/init.c:550: mm requested region of size 8513000, flags 1 +kern/ieee1275/init.c:563: Cannot satisfy allocation and retain minimum runtime +space +kern/ieee1275/init.c:550: mm requested region of size 8513000, flags 0 +kern/ieee1275/init.c:563: Cannot satisfy allocation and retain minimum runtime +space +kern/file.c:215: Closing `/ppc/ppc64/initrd.img' ... +kern/disk.c:297: Closing +`ieee1275//vdevice/v-scsi +@30000067/disk@8300000000000000'... +kern/disk.c:311: Closing +`ieee1275//vdevice/v-scsi +@30000067/disk@8300000000000000' succeeded. +kern/file.c:225: Closing `/ppc/ppc64/initrd.img' failed with 3. +kern/file.c:148: Opening `/ppc/ppc64/initrd.img' succeeded. +error: ../../grub-core/kern/mm.c:552:out of memory. + +Signed-off-by: Avnish Chouhan +Link: https://lore.kernel.org/r/20250115121605.56049-1-avnish@linux.ibm.com +--- + grub-core/kern/ieee1275/init.c | 33 +++++++++++++++++++++++++++++---- + 1 file changed, 29 insertions(+), 4 deletions(-) + +diff --git a/grub-core/kern/ieee1275/init.c b/grub-core/kern/ieee1275/init.c +index 8e08e5dd5c..e0634603ef 100644 +--- a/grub-core/kern/ieee1275/init.c ++++ b/grub-core/kern/ieee1275/init.c +@@ -855,7 +855,7 @@ grub_ieee1275_ibm_cas (void) + .vec1 = 0x80, /* ignore */ + .vec2_size = 1 + sizeof (struct option_vector2) - 2, + .vec2 = { +- 0, 0, -1, -1, -1, -1, -1, 512, -1, 0, 48 ++ 0, 0, -1, -1, -1, -1, -1, 768, -1, 0, 48 + }, + .vec3_size = 2 - 1, + .vec3 = 0x00e0, /* ask for FP + VMX + DFP but don't halt if unsatisfied */ +@@ -892,6 +892,10 @@ grub_claim_heap (void) + { + grub_err_t err; + grub_uint32_t total = HEAP_MAX_SIZE; ++#if defined(__powerpc__) ++ grub_uint32_t ibm_ca_support_reboot; ++ grub_ssize_t actual; ++#endif + + err = grub_ieee1275_total_mem (&rmo_top); + +@@ -904,11 +908,32 @@ grub_claim_heap (void) + grub_mm_add_region_fn = grub_ieee1275_mm_add_region; + + #if defined(__powerpc__) ++ /* Check if it's a CAS reboot with below property. If so, we will skip CAS call */ ++ ibm_ca_support_reboot = 0; ++ if (grub_ieee1275_get_integer_property (grub_ieee1275_chosen, ++ "ibm,client-architecture-support-reboot", ++ &ibm_ca_support_reboot, ++ sizeof (ibm_ca_support_reboot), ++ &actual) >= 0) ++ grub_dprintf ("ieee1275", "ibm,client-architecture-support-reboot: %u\n", ++ ibm_ca_support_reboot); ++ + if (grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_CAN_TRY_CAS_FOR_MORE_MEMORY)) + { +- /* if we have an error, don't call CAS, just hope for the best */ +- if (err == GRUB_ERR_NONE && rmo_top < (512 * 1024 * 1024)) +- grub_ieee1275_ibm_cas (); ++ /* ++ * If we have an error or the reboot is detected as CAS reboot, ++ * don't call CAS, just hope for the best. ++ * Along with the above, if the rmo_top is 512 MB or above. We ++ * will skip the CAS call. Though if we call CAS, the rmo_top will ++ * be set to 768 MB via CAS Vector2. This condition is required to avoid the ++ * issue where the older Linux kernels are still using rmo_top as 512 MB. ++ * Calling CAS when rmo_top is less then 768 MB will result in a issue ++ * where we won't be able to boot to a newer kernel and continue to ++ * boot with older kernel having rmo_top as 512 MB. ++ */ ++ if (!ibm_ca_support_reboot && err == GRUB_ERR_NONE ++ && rmo_top < (512 * 1024 * 1024)) ++ grub_ieee1275_ibm_cas (); + } + #endif + +-- +2.48.1 + diff --git a/grub2.changes b/grub2.changes index 6c8b000..880ae98 100644 --- a/grub2.changes +++ b/grub2.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Thu Feb 13 15:28:50 UTC 2025 - Michael Chang + +- Fix out of memory issue on PowerPC by increasing RMA size (bsc#1236744) + * 0001-powerpc-increase-MIN-RMA-size-for-CAS-negotiation.patch + ------------------------------------------------------------------- Sun Dec 8 10:22:43 UTC 2024 - Michael Chang diff --git a/grub2.spec b/grub2.spec index aa660fc..09ea27e 100644 --- a/grub2.spec +++ b/grub2.spec @@ -1,7 +1,7 @@ # # spec file for package grub2 # -# Copyright (c) 2024 SUSE LLC +# Copyright (c) 2025 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -416,6 +416,7 @@ Patch234: 0001-cli_lock-Add-build-option-to-block-command-line-inte.patch Patch235: 0002-Requiring-authentication-after-tpm-unlock-for-CLI-ac.patch Patch236: 0001-kern-main-Fix-cmdpath-in-root-directory.patch Patch237: grub2-s390x-secure-execution-support.patch +Patch238: 0001-powerpc-increase-MIN-RMA-size-for-CAS-negotiation.patch %if 0%{?suse_version} <= 1600 Requires: gettext-runtime