[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH] Use EfiACPIReclaimMemory for ESRT
As discussed on xen-devel, using EfiRuntimeServicesData for more than is absolutely necessary is a bad idea. --- xen/common/efi/boot.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/xen/common/efi/boot.c b/xen/common/efi/boot.c index db0340c8e2628314226c618dda11ede4c62fdf3b..dba23439758d1e842d267dcd19448e0f9113b115 100644 --- a/xen/common/efi/boot.c +++ b/xen/common/efi/boot.c @@ -601,11 +601,13 @@ static size_t __init get_esrt_size(const EFI_MEMORY_DESCRIPTOR *desc) if ( physical_start > esrt || esrt - physical_start >= len ) return 0; /* - * The specification requires EfiBootServicesData, but accept - * EfiRuntimeServicesData, which is a more logical choice. + * The specification requires EfiBootServicesData, but also accept + * EfiRuntimeServicesData (for compatibility) and EfiACPIReclaimMemory + * (which will contain the tables after successful kexec). */ if ( (desc->Type != EfiRuntimeServicesData) && - (desc->Type != EfiBootServicesData) ) + (desc->Type != EfiBootServicesData) && + (desc->Type != EfiACPIReclaimMemory) ) return 0; available_len = len - (esrt - physical_start); if ( available_len <= offsetof(EFI_SYSTEM_RESOURCE_TABLE, Entries) ) @@ -1144,18 +1146,19 @@ static void __init efi_relocate_esrt(EFI_SYSTEM_TABLE *SystemTable) for ( i = 0; i < info_size; i += mdesc_size ) { /* - * ESRT needs to be moved to memory of type EfiRuntimeServicesData + * ESRT needs to be moved to memory of type EfiACPIReclaimMemory * so that the memory it is in will not be used for other purposes. */ void *new_esrt = NULL; - size_t esrt_size = get_esrt_size(memory_map + i); + const EFI_MEMORY_DESCRIPTOR *desc = memory_map + i; + size_t esrt_size = get_esrt_size(desc); if ( !esrt_size ) continue; - if ( ((EFI_MEMORY_DESCRIPTOR *)(memory_map + i))->Type == - EfiRuntimeServicesData ) + if ( desc->Type == EfiRuntimeServicesData || + desc->Type == EfiACPIReclaimMemory ) break; /* ESRT already safe from reuse */ - status = efi_bs->AllocatePool(EfiRuntimeServicesData, esrt_size, + status = efi_bs->AllocatePool(EfiACPIReclaimMemory, esrt_size, &new_esrt); if ( status == EFI_SUCCESS && new_esrt ) { -- Sincerely, Demi Marie Obenour (she/her/hers) Invisible Things Lab
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |