From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Jan Beulich" Subject: [PATCH 2/4] EFI/early: add /mapbs to map EfiBootServices{Code, Data} Date: Tue, 09 Jun 2015 14:53:03 +0100 Message-ID: <55770BDF0200007800082A43@mail.emea.novell.com> References: <55770B190200007800082A2C@mail.emea.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__Part0B3F25AF.0__=" Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1Z2Jxk-0005Xx-8I for xen-devel@lists.xenproject.org; Tue, 09 Jun 2015 13:53:08 +0000 In-Reply-To: <55770B190200007800082A2C@mail.emea.novell.com> 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 List-Id: xen-devel@lists.xenproject.org This is a MIME message. If you are reading this text, you may want to consider changing to a mail reader or gateway that understands how to properly handle MIME multipart messages. --=__Part0B3F25AF.0__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline From: Konrad Rzeszutek Wilk To help on certain platforms to run. Signed-off-by: Konrad Rzeszutek Wilk Signed-off-by: Jan Beulich --- a/xen/arch/x86/efi/efi-boot.h +++ b/xen/arch/x86/efi/efi-boot.h @@ -148,12 +148,16 @@ static void __init efi_arch_process_memo =20 switch ( desc->Type ) { - default: - type =3D E820_RESERVED; - break; - case EfiConventionalMemory: case EfiBootServicesCode: case EfiBootServicesData: + if ( map_bs ) + { + default: + type =3D E820_RESERVED; + break; + } + /* fall through */ + case EfiConventionalMemory: if ( !trampoline_phys && desc->PhysicalStart + len <=3D = 0x100000 && len >=3D cfg.size && desc->PhysicalStart + len > = cfg.addr ) cfg.addr =3D (desc->PhysicalStart + len - cfg.size) & = PAGE_MASK; --- a/xen/common/efi/boot.c +++ b/xen/common/efi/boot.c @@ -84,6 +84,7 @@ static SIMPLE_TEXT_OUTPUT_INTERFACE *__i static SIMPLE_TEXT_OUTPUT_INTERFACE *__initdata StdErr; =20 static UINT32 __initdata mdesc_ver; +static bool_t __initdata map_bs; =20 static struct file __initdata cfg; static struct file __initdata kernel; @@ -753,6 +754,8 @@ efi_start(EFI_HANDLE ImageHandle, EFI_SY { if ( wstrcmp(ptr + 1, L"basevideo") =3D=3D 0 ) base_video =3D 1; + else if ( wstrcmp(ptr + 1, L"mapbs") =3D=3D 0 ) + map_bs =3D 1; else if ( wstrncmp(ptr + 1, L"cfg=3D", 4) =3D=3D 0 ) cfg_file_name =3D ptr + 5; else if ( i + 1 < argc && wstrcmp(ptr + 1, L"cfg") =3D=3D = 0 ) @@ -762,6 +765,7 @@ efi_start(EFI_HANDLE ImageHandle, EFI_SY { PrintStr(L"Xen EFI Loader options:\r\n"); PrintStr(L"-basevideo retain current video = mode\r\n"); + PrintStr(L"-mapbs map EfiBootServices{Code,Data}= \r\n"); PrintStr(L"-cfg=3D specify configuration = file\r\n"); PrintStr(L"-help, -? display this help\r\n"); blexit(NULL); @@ -1158,7 +1162,8 @@ void __init efi_init_memory(void) } *extra, *extra_head =3D NULL; #endif =20 - printk(XENLOG_INFO "EFI memory map:\n"); + printk(XENLOG_INFO "EFI memory map:%s\n", + map_bs ? " (mapping BootServices)" : ""); for ( i =3D 0; i < efi_memmap_size; i +=3D efi_mdesc_size ) { EFI_MEMORY_DESCRIPTOR *desc =3D efi_memmap + i; @@ -1171,7 +1176,11 @@ void __init efi_init_memory(void) desc->PhysicalStart, desc->PhysicalStart + len - 1, desc->Type, desc->Attribute); =20 - if ( !efi_rs_enable || !(desc->Attribute & EFI_MEMORY_RUNTIME) ) + if ( !efi_rs_enable || + (!(desc->Attribute & EFI_MEMORY_RUNTIME) && + (!map_bs || + (desc->Type !=3D EfiBootServicesCode && + desc->Type !=3D EfiBootServicesData))) ) continue; =20 desc->VirtualStart =3D INVALID_VIRTUAL_ADDRESS; @@ -1257,7 +1266,10 @@ void __init efi_init_memory(void) { const EFI_MEMORY_DESCRIPTOR *desc =3D efi_memmap + i; =20 - if ( (desc->Attribute & EFI_MEMORY_RUNTIME) && + if ( ((desc->Attribute & EFI_MEMORY_RUNTIME) || + (map_bs && + (desc->Type =3D=3D EfiBootServicesCode || + desc->Type =3D=3D EfiBootServicesData))) && desc->VirtualStart !=3D INVALID_VIRTUAL_ADDRESS && desc->VirtualStart !=3D desc->PhysicalStart ) copy_mapping(PFN_DOWN(desc->PhysicalStart), --=__Part0B3F25AF.0__= Content-Type: text/plain; name="EFI-optionally-map-BS.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="EFI-optionally-map-BS.patch" EFI/early: add /mapbs to map EfiBootServices{Code,Data}=0A=0AFrom: Konrad = Rzeszutek Wilk =0A=0ATo help on certain platforms = to run.=0A=0ASigned-off-by: Konrad Rzeszutek Wilk = =0ASigned-off-by: Jan Beulich =0A=0A--- a/xen/arch/x86/e= fi/efi-boot.h=0A+++ b/xen/arch/x86/efi/efi-boot.h=0A@@ -148,12 +148,16 @@ = static void __init efi_arch_process_memo=0A =0A switch ( desc->Type= )=0A {=0A- default:=0A- type =3D E820_RESERVED;= =0A- break;=0A- case EfiConventionalMemory:=0A = case EfiBootServicesCode:=0A case EfiBootServicesData:=0A+ = if ( map_bs )=0A+ {=0A+ default:=0A+ = type =3D E820_RESERVED;=0A+ break;=0A+ }=0A+ = /* fall through */=0A+ case EfiConventionalMemory:=0A = if ( !trampoline_phys && desc->PhysicalStart + len <=3D 0x100000 = &&=0A len >=3D cfg.size && desc->PhysicalStart + len > = cfg.addr )=0A cfg.addr =3D (desc->PhysicalStart + len - = cfg.size) & PAGE_MASK;=0A--- a/xen/common/efi/boot.c=0A+++ b/xen/common/efi= /boot.c=0A@@ -84,6 +84,7 @@ static SIMPLE_TEXT_OUTPUT_INTERFACE *__i=0A = static SIMPLE_TEXT_OUTPUT_INTERFACE *__initdata StdErr;=0A =0A static = UINT32 __initdata mdesc_ver;=0A+static bool_t __initdata map_bs;=0A =0A = static struct file __initdata cfg;=0A static struct file __initdata = kernel;=0A@@ -753,6 +754,8 @@ efi_start(EFI_HANDLE ImageHandle, EFI_SY=0A = {=0A if ( wstrcmp(ptr + 1, L"basevideo") =3D=3D = 0 )=0A base_video =3D 1;=0A+ else if ( = wstrcmp(ptr + 1, L"mapbs") =3D=3D 0 )=0A+ map_bs =3D = 1;=0A else if ( wstrncmp(ptr + 1, L"cfg=3D", 4) =3D=3D 0 = )=0A cfg_file_name =3D ptr + 5;=0A = else if ( i + 1 < argc && wstrcmp(ptr + 1, L"cfg") =3D=3D 0 )=0A@@ -762,6 = +765,7 @@ efi_start(EFI_HANDLE ImageHandle, EFI_SY=0A {=0A = PrintStr(L"Xen EFI Loader options:\r\n");=0A = PrintStr(L"-basevideo retain current video mode\r\n");=0A+ = PrintStr(L"-mapbs map EfiBootServices{Code,Data}\r\n")= ;=0A PrintStr(L"-cfg=3D specify configuration = file\r\n");=0A PrintStr(L"-help, -? display this = help\r\n");=0A blexit(NULL);=0A@@ -1158,7 +1162,8 @@ = void __init efi_init_memory(void)=0A } *extra, *extra_head =3D = NULL;=0A #endif=0A =0A- printk(XENLOG_INFO "EFI memory map:\n");=0A+ = printk(XENLOG_INFO "EFI memory map:%s\n",=0A+ map_bs ? " = (mapping BootServices)" : "");=0A for ( i =3D 0; i < efi_memmap_size; = i +=3D efi_mdesc_size )=0A {=0A EFI_MEMORY_DESCRIPTOR *desc = =3D efi_memmap + i;=0A@@ -1171,7 +1176,11 @@ void __init efi_init_memory(vo= id)=0A desc->PhysicalStart, desc->PhysicalStart + len - = 1,=0A desc->Type, desc->Attribute);=0A =0A- if ( = !efi_rs_enable || !(desc->Attribute & EFI_MEMORY_RUNTIME) )=0A+ if = ( !efi_rs_enable ||=0A+ (!(desc->Attribute & EFI_MEMORY_RUNTIME= ) &&=0A+ (!map_bs ||=0A+ (desc->Type !=3D = EfiBootServicesCode &&=0A+ desc->Type !=3D EfiBootServicesDa= ta))) )=0A continue;=0A =0A desc->VirtualStart =3D = INVALID_VIRTUAL_ADDRESS;=0A@@ -1257,7 +1266,10 @@ void __init efi_init_memo= ry(void)=0A {=0A const EFI_MEMORY_DESCRIPTOR *desc =3D = efi_memmap + i;=0A =0A- if ( (desc->Attribute & EFI_MEMORY_RUNTIME) = &&=0A+ if ( ((desc->Attribute & EFI_MEMORY_RUNTIME) ||=0A+ = (map_bs &&=0A+ (desc->Type =3D=3D EfiBootServicesCode = ||=0A+ desc->Type =3D=3D EfiBootServicesData))) &&=0A = desc->VirtualStart !=3D INVALID_VIRTUAL_ADDRESS &&=0A = desc->VirtualStart !=3D desc->PhysicalStart )=0A copy_mapping(P= FN_DOWN(desc->PhysicalStart),=0A --=__Part0B3F25AF.0__= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel --=__Part0B3F25AF.0__=--