From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Cooper Subject: Re: [PATCH 2/4] EFI/early: add /mapbs to map EfiBootServices{Code, Data} Date: Tue, 9 Jun 2015 15:03:18 +0100 Message-ID: <5576F226.6080104@citrix.com> References: <55770B190200007800082A2C@mail.emea.novell.com> <55770BDF0200007800082A43@mail.emea.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============2928264778187322457==" Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1Z2K81-0007IR-51 for xen-devel@lists.xenproject.org; Tue, 09 Jun 2015 14:03:45 +0000 In-Reply-To: <55770BDF0200007800082A43@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: Jan Beulich , xen-devel List-Id: xen-devel@lists.xenproject.org --===============2928264778187322457== Content-Type: multipart/alternative; boundary="------------060303070801010004020700" --------------060303070801010004020700 Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit On 09/06/15 14:53, Jan Beulich wrote: > 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 > > switch ( desc->Type ) > { > - default: > - type = E820_RESERVED; > - break; > - case EfiConventionalMemory: > case EfiBootServicesCode: > case EfiBootServicesData: > + if ( map_bs ) if ( !map_bs ) surely? It is the else case which sets a type of E820_RAM. ~Andrew > + { > + default: > + type = E820_RESERVED; > + break; > + } > + /* fall through */ > + case EfiConventionalMemory: > if ( !trampoline_phys && desc->PhysicalStart + len <= 0x100000 && > len >= cfg.size && desc->PhysicalStart + len > cfg.addr ) > cfg.addr = (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; > > static UINT32 __initdata mdesc_ver; > +static bool_t __initdata map_bs; > > 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") == 0 ) > base_video = 1; > + else if ( wstrcmp(ptr + 1, L"mapbs") == 0 ) > + map_bs = 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 ) > @@ -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= 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 = NULL; > #endif > > - printk(XENLOG_INFO "EFI memory map:\n"); > + printk(XENLOG_INFO "EFI memory map:%s\n", > + map_bs ? " (mapping BootServices)" : ""); > for ( i = 0; i < efi_memmap_size; i += efi_mdesc_size ) > { > EFI_MEMORY_DESCRIPTOR *desc = efi_memmap + i; > @@ -1171,7 +1176,11 @@ void __init efi_init_memory(void) > desc->PhysicalStart, desc->PhysicalStart + len - 1, > desc->Type, desc->Attribute); > > - if ( !efi_rs_enable || !(desc->Attribute & EFI_MEMORY_RUNTIME) ) > + if ( !efi_rs_enable || > + (!(desc->Attribute & EFI_MEMORY_RUNTIME) && > + (!map_bs || > + (desc->Type != EfiBootServicesCode && > + desc->Type != EfiBootServicesData))) ) > continue; > > desc->VirtualStart = INVALID_VIRTUAL_ADDRESS; > @@ -1257,7 +1266,10 @@ void __init efi_init_memory(void) > { > const EFI_MEMORY_DESCRIPTOR *desc = efi_memmap + i; > > - if ( (desc->Attribute & EFI_MEMORY_RUNTIME) && > + if ( ((desc->Attribute & EFI_MEMORY_RUNTIME) || > + (map_bs && > + (desc->Type == EfiBootServicesCode || > + desc->Type == EfiBootServicesData))) && > desc->VirtualStart != INVALID_VIRTUAL_ADDRESS && > desc->VirtualStart != desc->PhysicalStart ) > copy_mapping(PFN_DOWN(desc->PhysicalStart), > > > > > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xen.org > http://lists.xen.org/xen-devel --------------060303070801010004020700 Content-Type: text/html; charset="windows-1252" Content-Length: 5465 Content-Transfer-Encoding: quoted-printable
On 09/06/15 14:53, Jan Beulich wrote:
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>

To help on certain platforms to run.

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>

--- 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
 
         switch ( desc->Type )
         {
-        default:
-            type =3D E820_RESERVED;
-            break;
-        case EfiConventionalMemory:
         case EfiBootServicesCode:
         case EfiBootServicesData:
+            if ( map_bs )

if ( !map_bs ) surely=3F=A0 It is the else case which sets a type of E820_RAM.

~Andrew

+            {
+        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;
 
 static UINT32 __initdata mdesc_ver;
+static bool_t __initdata map_bs;
 
 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<file>  specify configuration file\r\n");
                     PrintStr(L"-help, -=3F    display this help\r\n");
                     blexit(NULL);
@@ -1158,7 +1162,8 @@ void __init efi_init_memory(void)
     } *extra, *extra_head =3D NULL;
 #endif
 
-    printk(XENLOG_INFO "EFI memory map:\n");
+    printk(XENLOG_INFO "EFI memory map:%s\n",
+           map_bs =3F " (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);
 
-        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;
 
         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;
 
-        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),





_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

--------------060303070801010004020700-- --===============2928264778187322457== 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 --===============2928264778187322457==--