public inbox for linux-efi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] efi/unaccepted: Use ACPI reclaim memory for unaccepted memory table
@ 2023-08-16 19:05 Ard Biesheuvel
  2023-08-16 21:24 ` [PATCH] x86/mm: Make e820_end_ram_pfn() cover E820_TYPE_ACPI ranges Kirill A. Shutemov
  2023-09-18 22:03 ` [PATCH] efi/unaccepted: Use ACPI reclaim memory for unaccepted memory table Tom Lendacky
  0 siblings, 2 replies; 16+ messages in thread
From: Ard Biesheuvel @ 2023-08-16 19:05 UTC (permalink / raw)
  To: linux-efi; +Cc: Ard Biesheuvel, Kirill A . Shutemov

Kyril reports that crashkernels fail to work on confidential VMs that
rely on the unaccepted memory table, and this appears to be caused by
the fact that it is not considered part of the set of firmware tables
that the crashkernel needs to map.

This is an oversight, and a result of the use of the EFI_LOADER_DATA
memory type for this table. The correct memory type to use for any
firmware table is EFI_ACPI_RECLAIM_MEMORY (including ones created by the
EFI stub), even though the name suggests that is it specific to ACPI.
ACPI reclaim means that the memory is used by the firmware to expose
information to the operating system, but that the memory region has no
special significance to the firmware itself, and the OS is free to
reclaim the memory and use it as ordinary memory if it is not interested
in the contents, or if it has already consumed them. In Linux, this
memory is never reclaimed, but it is always covered by the kernel direct
map and generally made accessible as ordinary memory.

On x86, ACPI reclaim memory is translated into E820_ACPI, which the
kexec logic already recognizes as memory that the crashkernel may need
to to access, and so it will be mapped and accessible to the booting
crash kernel.

Reported-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
---
 drivers/firmware/efi/libstub/unaccepted_memory.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/firmware/efi/libstub/unaccepted_memory.c b/drivers/firmware/efi/libstub/unaccepted_memory.c
index ca61f4733ea58693..9a655f30ba47db01 100644
--- a/drivers/firmware/efi/libstub/unaccepted_memory.c
+++ b/drivers/firmware/efi/libstub/unaccepted_memory.c
@@ -62,7 +62,7 @@ efi_status_t allocate_unaccepted_bitmap(__u32 nr_desc,
 	bitmap_size = DIV_ROUND_UP(unaccepted_end - unaccepted_start,
 				   EFI_UNACCEPTED_UNIT_SIZE * BITS_PER_BYTE);
 
-	status = efi_bs_call(allocate_pool, EFI_LOADER_DATA,
+	status = efi_bs_call(allocate_pool, EFI_ACPI_RECLAIM_MEMORY,
 			     sizeof(*unaccepted_table) + bitmap_size,
 			     (void **)&unaccepted_table);
 	if (status != EFI_SUCCESS) {
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2023-09-19 15:08 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-16 19:05 [PATCH] efi/unaccepted: Use ACPI reclaim memory for unaccepted memory table Ard Biesheuvel
2023-08-16 21:24 ` [PATCH] x86/mm: Make e820_end_ram_pfn() cover E820_TYPE_ACPI ranges Kirill A. Shutemov
2023-08-17 20:25   ` Ard Biesheuvel
2023-08-18 15:16     ` Kirill A. Shutemov
2023-09-06  9:17       ` Ard Biesheuvel
2023-09-07 10:49         ` Kirill A. Shutemov
2023-09-17 17:06           ` Kirill A. Shutemov
2023-09-18  7:01             ` Ard Biesheuvel
2023-09-18 12:12               ` Kirill A. Shutemov
2023-09-18 12:32                 ` Ard Biesheuvel
2023-09-18 22:03 ` [PATCH] efi/unaccepted: Use ACPI reclaim memory for unaccepted memory table Tom Lendacky
2023-09-18 22:10   ` Kirill A . Shutemov
2023-09-19 13:28     ` Tom Lendacky
2023-09-19 13:37       ` Ard Biesheuvel
2023-09-19 15:04         ` Ard Biesheuvel
2023-09-19 15:08           ` Tom Lendacky

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