3e026f665c
- Add safety measure to pcr snapshot by checking platform and tpm status * safe_tpm_pcr_snapshot.patch - Fix installation failure due to unavailable nvram device on ppc64le (bsc#1201361) * 0001-grub-install-set-point-of-no-return-for-powerpc-ieee1275.patch - Add patches to dynamically allocate additional memory regions for EFI systems (bsc#1202438) * 0001-mm-Allow-dynamically-requesting-additional-memory-re.patch * 0002-kern-efi-mm-Always-request-a-fixed-number-of-pages-o.patch * 0003-kern-efi-mm-Extract-function-to-add-memory-regions.patch * 0004-kern-efi-mm-Pass-up-errors-from-add_memory_regions.patch * 0005-kern-efi-mm-Implement-runtime-addition-of-pages.patch - Enlarge the default heap size and defer the disk cache invalidation (bsc#1202438) * 0001-kern-efi-mm-Enlarge-the-default-heap-size.patch * 0002-mm-Defer-the-disk-cache-invalidation.patch - Add patches for ALP FDE support * 0001-devmapper-getroot-Have-devmapper-recognize-LUKS2.patch * 0002-devmapper-getroot-Set-up-cheated-LUKS2-cryptodisk-mo.patch * 0003-disk-cryptodisk-When-cheatmounting-use-the-sector-in.patch * 0004-normal-menu-Don-t-show-Booting-s-msg-when-auto-booti.patch * 0005-EFI-suppress-the-Welcome-to-GRUB-message-in-EFI-buil.patch * 0006-EFI-console-Do-not-set-colorstate-until-the-first-te.patch * 0007-EFI-console-Do-not-set-cursor-until-the-first-text-o.patch * 0008-linuxefi-Use-common-grub_initrd_load.patch * 0009-Add-crypttab_entry-to-obviate-the-need-to-input-pass.patch * 0010-templates-import-etc-crypttab-to-grub.cfg.patch OBS-URL: https://build.opensuse.org/request/show/1004537 OBS-URL: https://build.opensuse.org/package/show/Base:System/grub2?expand=0&rev=419
78 lines
2.8 KiB
Diff
78 lines
2.8 KiB
Diff
From 3a2119e11b9c216f3b008a2c61aca52b91ad7547 Mon Sep 17 00:00:00 2001
|
|
From: Patrick Steinhardt <ps@pks.im>
|
|
Date: Thu, 21 Apr 2022 15:24:22 +1000
|
|
Subject: [PATCH 5/5] kern/efi/mm: Implement runtime addition of pages
|
|
|
|
Adjust the interface of grub_efi_mm_add_regions() to take a set of
|
|
GRUB_MM_ADD_REGION_* flags, which most notably is currently only the
|
|
GRUB_MM_ADD_REGION_CONSECUTIVE flag. This allows us to set the function
|
|
up as callback for the memory subsystem and have it call out to us in
|
|
case there's not enough pages available in the current heap.
|
|
|
|
Signed-off-by: Patrick Steinhardt <ps@pks.im>
|
|
Signed-off-by: Daniel Axtens <dja@axtens.net>
|
|
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
|
Tested-by: Patrick Steinhardt <ps@pks.im>
|
|
---
|
|
grub-core/kern/efi/mm.c | 15 +++++++++++----
|
|
1 file changed, 11 insertions(+), 4 deletions(-)
|
|
|
|
diff --git a/grub-core/kern/efi/mm.c b/grub-core/kern/efi/mm.c
|
|
index 45ea6d5..48380d3 100644
|
|
--- a/grub-core/kern/efi/mm.c
|
|
+++ b/grub-core/kern/efi/mm.c
|
|
@@ -518,7 +518,8 @@ static grub_err_t
|
|
add_memory_regions (grub_efi_memory_descriptor_t *memory_map,
|
|
grub_efi_uintn_t desc_size,
|
|
grub_efi_memory_descriptor_t *memory_map_end,
|
|
- grub_efi_uint64_t required_pages)
|
|
+ grub_efi_uint64_t required_pages,
|
|
+ unsigned int flags)
|
|
{
|
|
grub_efi_memory_descriptor_t *desc;
|
|
|
|
@@ -532,6 +533,10 @@ add_memory_regions (grub_efi_memory_descriptor_t *memory_map,
|
|
|
|
start = desc->physical_start;
|
|
pages = desc->num_pages;
|
|
+
|
|
+ if (pages < required_pages && (flags & GRUB_MM_ADD_REGION_CONSECUTIVE))
|
|
+ continue;
|
|
+
|
|
if (pages > required_pages)
|
|
{
|
|
start += PAGES_TO_BYTES (pages - required_pages);
|
|
@@ -597,7 +602,7 @@ print_memory_map (grub_efi_memory_descriptor_t *memory_map,
|
|
#endif
|
|
|
|
static grub_err_t
|
|
-grub_efi_mm_add_regions (grub_size_t required_bytes)
|
|
+grub_efi_mm_add_regions (grub_size_t required_bytes, unsigned int flags)
|
|
{
|
|
grub_efi_memory_descriptor_t *memory_map;
|
|
grub_efi_memory_descriptor_t *memory_map_end;
|
|
@@ -652,7 +657,8 @@ grub_efi_mm_add_regions (grub_size_t required_bytes)
|
|
/* Allocate memory regions for GRUB's memory management. */
|
|
err = add_memory_regions (filtered_memory_map, desc_size,
|
|
filtered_memory_map_end,
|
|
- BYTES_TO_PAGES (required_bytes));
|
|
+ BYTES_TO_PAGES (required_bytes),
|
|
+ flags);
|
|
if (err != GRUB_ERR_NONE)
|
|
return err;
|
|
|
|
@@ -679,8 +685,9 @@ grub_efi_mm_add_regions (grub_size_t required_bytes)
|
|
void
|
|
grub_efi_mm_init (void)
|
|
{
|
|
- if (grub_efi_mm_add_regions (DEFAULT_HEAP_SIZE) != GRUB_ERR_NONE)
|
|
+ if (grub_efi_mm_add_regions (DEFAULT_HEAP_SIZE, GRUB_MM_ADD_REGION_NONE) != GRUB_ERR_NONE)
|
|
grub_fatal ("%s", grub_errmsg);
|
|
+ grub_mm_add_region_fn = grub_efi_mm_add_regions;
|
|
}
|
|
|
|
#if defined (__aarch64__) || defined (__arm__) || defined (__riscv)
|
|
--
|
|
2.35.3
|
|
|