All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86/EFI: keep EFI runtime services top level page tables up-to-date
@ 2015-05-18 10:22 Jan Beulich
  2015-05-18 10:27 ` Andrew Cooper
  0 siblings, 1 reply; 2+ messages in thread
From: Jan Beulich @ 2015-05-18 10:22 UTC (permalink / raw)
  To: xen-devel; +Cc: Andrew Cooper, Keir Fraser, Ross Lagerwall

[-- Attachment #1: Type: text/plain, Size: 2026 bytes --]

Updates to idle_pg_table[] need to be mirrored into the page tables
used for invoking EFI runtime services.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
---
This in particular is a prereq for the patch at
http://lists.xenproject.org/archives/html/xen-devel/2015-05/msg02125.html 
to be correct.

--- a/xen/arch/x86/efi/runtime.h
+++ b/xen/arch/x86/efi/runtime.h
@@ -2,4 +2,10 @@
 
 #ifndef COMPAT
 l4_pgentry_t *__read_mostly efi_l4_pgtable;
+
+void efi_update_l4_pgtable(unsigned int l4idx, l4_pgentry_t l4e)
+{
+    if ( efi_l4_pgtable )
+        l4e_write(efi_l4_pgtable + l4idx, l4e);
+}
 #endif
--- a/xen/arch/x86/efi/stub.c
+++ b/xen/arch/x86/efi/stub.c
@@ -2,6 +2,7 @@
 #include <xen/errno.h>
 #include <xen/init.h>
 #include <xen/lib.h>
+#include <asm/page.h>
 
 #ifndef efi_enabled
 const bool_t efi_enabled = 0;
@@ -9,6 +10,8 @@ const bool_t efi_enabled = 0;
 
 void __init efi_init_memory(void) { }
 
+void efi_update_l4_pgtable(unsigned int l4idx, l4_pgentry_t l4e) { }
+
 paddr_t efi_rs_page_table(void)
 {
     BUG();
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -5311,7 +5311,10 @@ static l3_pgentry_t *virt_to_xen_l3e(uns
             spin_lock(&map_pgdir_lock);
         if ( !(l4e_get_flags(*pl4e) & _PAGE_PRESENT) )
         {
-            l4e_write(pl4e, l4e_from_paddr(__pa(pl3e), __PAGE_HYPERVISOR));
+            l4_pgentry_t l4e = l4e_from_paddr(__pa(pl3e), __PAGE_HYPERVISOR);
+
+            l4e_write(pl4e, l4e);
+            efi_update_l4_pgtable(l4_table_offset(v), l4e);
             pl3e = NULL;
         }
         if ( locking )
--- a/xen/include/asm-x86/page.h
+++ b/xen/include/asm-x86/page.h
@@ -288,6 +288,7 @@ extern l2_pgentry_t l2_identmap[4*L2_PAG
 extern l1_pgentry_t l1_identmap[L1_PAGETABLE_ENTRIES],
     l1_fixmap[L1_PAGETABLE_ENTRIES];
 void paging_init(void);
+void efi_update_l4_pgtable(unsigned int l4idx, l4_pgentry_t);
 #endif /* !defined(__ASSEMBLY__) */
 
 #define _PAGE_NONE     _AC(0x000,U)




[-- Attachment #2: x86-EFI-sync-L4-pgt.patch --]
[-- Type: text/plain, Size: 2090 bytes --]

x86/EFI: keep EFI runtime services top level page tables up-to-date

Updates to idle_pg_table[] need to be mirrored into the page tables
used for invoking EFI runtime services.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
---
This in particular is a prereq for the patch at
http://lists.xenproject.org/archives/html/xen-devel/2015-05/msg02125.html
to be correct.

--- a/xen/arch/x86/efi/runtime.h
+++ b/xen/arch/x86/efi/runtime.h
@@ -2,4 +2,10 @@
 
 #ifndef COMPAT
 l4_pgentry_t *__read_mostly efi_l4_pgtable;
+
+void efi_update_l4_pgtable(unsigned int l4idx, l4_pgentry_t l4e)
+{
+    if ( efi_l4_pgtable )
+        l4e_write(efi_l4_pgtable + l4idx, l4e);
+}
 #endif
--- a/xen/arch/x86/efi/stub.c
+++ b/xen/arch/x86/efi/stub.c
@@ -2,6 +2,7 @@
 #include <xen/errno.h>
 #include <xen/init.h>
 #include <xen/lib.h>
+#include <asm/page.h>
 
 #ifndef efi_enabled
 const bool_t efi_enabled = 0;
@@ -9,6 +10,8 @@ const bool_t efi_enabled = 0;
 
 void __init efi_init_memory(void) { }
 
+void efi_update_l4_pgtable(unsigned int l4idx, l4_pgentry_t l4e) { }
+
 paddr_t efi_rs_page_table(void)
 {
     BUG();
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -5311,7 +5311,10 @@ static l3_pgentry_t *virt_to_xen_l3e(uns
             spin_lock(&map_pgdir_lock);
         if ( !(l4e_get_flags(*pl4e) & _PAGE_PRESENT) )
         {
-            l4e_write(pl4e, l4e_from_paddr(__pa(pl3e), __PAGE_HYPERVISOR));
+            l4_pgentry_t l4e = l4e_from_paddr(__pa(pl3e), __PAGE_HYPERVISOR);
+
+            l4e_write(pl4e, l4e);
+            efi_update_l4_pgtable(l4_table_offset(v), l4e);
             pl3e = NULL;
         }
         if ( locking )
--- a/xen/include/asm-x86/page.h
+++ b/xen/include/asm-x86/page.h
@@ -288,6 +288,7 @@ extern l2_pgentry_t l2_identmap[4*L2_PAG
 extern l1_pgentry_t l1_identmap[L1_PAGETABLE_ENTRIES],
     l1_fixmap[L1_PAGETABLE_ENTRIES];
 void paging_init(void);
+void efi_update_l4_pgtable(unsigned int l4idx, l4_pgentry_t);
 #endif /* !defined(__ASSEMBLY__) */
 
 #define _PAGE_NONE     _AC(0x000,U)

[-- Attachment #3: Type: text/plain, Size: 126 bytes --]

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

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

* Re: [PATCH] x86/EFI: keep EFI runtime services top level page tables up-to-date
  2015-05-18 10:22 [PATCH] x86/EFI: keep EFI runtime services top level page tables up-to-date Jan Beulich
@ 2015-05-18 10:27 ` Andrew Cooper
  0 siblings, 0 replies; 2+ messages in thread
From: Andrew Cooper @ 2015-05-18 10:27 UTC (permalink / raw)
  To: Jan Beulich, xen-devel; +Cc: Ross Lagerwall, Keir Fraser

On 18/05/15 11:22, Jan Beulich wrote:
> Updates to idle_pg_table[] need to be mirrored into the page tables
> used for invoking EFI runtime services.
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>

> ---
> This in particular is a prereq for the patch at
> http://lists.xenproject.org/archives/html/xen-devel/2015-05/msg02125.html 
> to be correct.
>
> --- a/xen/arch/x86/efi/runtime.h
> +++ b/xen/arch/x86/efi/runtime.h
> @@ -2,4 +2,10 @@
>  
>  #ifndef COMPAT
>  l4_pgentry_t *__read_mostly efi_l4_pgtable;
> +
> +void efi_update_l4_pgtable(unsigned int l4idx, l4_pgentry_t l4e)
> +{
> +    if ( efi_l4_pgtable )
> +        l4e_write(efi_l4_pgtable + l4idx, l4e);
> +}
>  #endif
> --- a/xen/arch/x86/efi/stub.c
> +++ b/xen/arch/x86/efi/stub.c
> @@ -2,6 +2,7 @@
>  #include <xen/errno.h>
>  #include <xen/init.h>
>  #include <xen/lib.h>
> +#include <asm/page.h>
>  
>  #ifndef efi_enabled
>  const bool_t efi_enabled = 0;
> @@ -9,6 +10,8 @@ const bool_t efi_enabled = 0;
>  
>  void __init efi_init_memory(void) { }
>  
> +void efi_update_l4_pgtable(unsigned int l4idx, l4_pgentry_t l4e) { }
> +
>  paddr_t efi_rs_page_table(void)
>  {
>      BUG();
> --- a/xen/arch/x86/mm.c
> +++ b/xen/arch/x86/mm.c
> @@ -5311,7 +5311,10 @@ static l3_pgentry_t *virt_to_xen_l3e(uns
>              spin_lock(&map_pgdir_lock);
>          if ( !(l4e_get_flags(*pl4e) & _PAGE_PRESENT) )
>          {
> -            l4e_write(pl4e, l4e_from_paddr(__pa(pl3e), __PAGE_HYPERVISOR));
> +            l4_pgentry_t l4e = l4e_from_paddr(__pa(pl3e), __PAGE_HYPERVISOR);
> +
> +            l4e_write(pl4e, l4e);
> +            efi_update_l4_pgtable(l4_table_offset(v), l4e);
>              pl3e = NULL;
>          }
>          if ( locking )
> --- a/xen/include/asm-x86/page.h
> +++ b/xen/include/asm-x86/page.h
> @@ -288,6 +288,7 @@ extern l2_pgentry_t l2_identmap[4*L2_PAG
>  extern l1_pgentry_t l1_identmap[L1_PAGETABLE_ENTRIES],
>      l1_fixmap[L1_PAGETABLE_ENTRIES];
>  void paging_init(void);
> +void efi_update_l4_pgtable(unsigned int l4idx, l4_pgentry_t);
>  #endif /* !defined(__ASSEMBLY__) */
>  
>  #define _PAGE_NONE     _AC(0x000,U)
>
>
>

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

end of thread, other threads:[~2015-05-18 12:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-18 10:22 [PATCH] x86/EFI: keep EFI runtime services top level page tables up-to-date Jan Beulich
2015-05-18 10:27 ` Andrew Cooper

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.