From: Andrew Cooper Subject: [PATCH] xen/efi: Add /mapres to map EfiReservedMemoryType for runtime services Date: Wed, 17 Jun 2015 14:46:47 +0100 Message-ID: <1434548807-15598-1-git-send-email-andrew.cooper3@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Xen-devel Cc: Ross Lagerwall , Jan Beulich , Andrew Cooper List-Id: xen-devel@lists.xenproject.org From: Ross Lagerwall In the same vein as needing /mapbs, some EFI firmware runtime services access areas marked as EfiReservedMemoryType. The failing firmware implementations were: Product Name: PowerEdge R720 Vendor: Dell Inc. Version: 2.1.2 Release Date: 09/19/2013 BIOS Revision: 2.1 Product Name: PowerEdge R320 Vendor: Dell Inc. Version: 1.5.2 Release Date: 03/11/2013 BIOS Revision: 1.5 Signed-off-by: Ross Lagerwall Signed-off-by: Andrew Cooper CC: Jan Beulich --- xen/common/efi/boot.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/xen/common/efi/boot.c b/xen/common/efi/boot.c index 75a939f..8173490 100644 --- a/xen/common/efi/boot.c +++ b/xen/common/efi/boot.c @@ -88,6 +88,7 @@ static bool_t read_file(EFI_FILE_HANDLE dir_handle, CHAR16 *name, static UINT32 __initdata mdesc_ver; static bool_t __initdata map_bs; +static bool_t __initdata map_res; static struct file __initdata cfg; static struct file __initdata kernel; @@ -763,6 +764,8 @@ static int __init __maybe_unused set_color(u32 mask, int bpp, u8 *pos, u8 *sz) base_video = 1; else if ( wstrcmp(ptr + 1, L"mapbs") == 0 ) map_bs = 1; + else if ( wstrcmp(ptr + 1, L"mapres") == 0 ) + map_res = 1; else if ( wstrncmp(ptr + 1, L"cfg=", 4) == 0 ) cfg_file_name = ptr + 5; else if ( i + 1 < argc && wstrcmp(ptr + 1, L"cfg") == 0 ) @@ -1216,7 +1219,9 @@ void __init efi_init_memory(void) (!(desc->Attribute & EFI_MEMORY_RUNTIME) && (!map_bs || (desc->Type != EfiBootServicesCode && - desc->Type != EfiBootServicesData))) ) + desc->Type != EfiBootServicesData)) && + (!map_res || + desc->Type != EfiReservedMemoryType)) ) continue; desc->VirtualStart = INVALID_VIRTUAL_ADDRESS; @@ -1311,7 +1316,9 @@ void __init efi_init_memory(void) if ( ((desc->Attribute & EFI_MEMORY_RUNTIME) || (map_bs && (desc->Type == EfiBootServicesCode || - desc->Type == EfiBootServicesData))) && + desc->Type == EfiBootServicesData)) || + (map_res && + (desc->Type == EfiReservedMemoryType))) && desc->VirtualStart != INVALID_VIRTUAL_ADDRESS && desc->VirtualStart != desc->PhysicalStart ) copy_mapping(PFN_DOWN(desc->PhysicalStart), -- 1.7.10.4