From: "Jan Beulich" Subject: [PATCH] x86/EFI: keep EFI runtime services top level page tables up-to-date Date: Mon, 18 May 2015 11:22:49 +0100 Message-ID: <5559D999020000780007AFD3@mail.emea.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__PartB084B169.1__=" Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YuJhE-0003Qf-OQ for xen-devel@lists.xenproject.org; Mon, 18 May 2015 11:59:00 +0000 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: Andrew Cooper , Keir Fraser , Ross Lagerwall 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. --=__PartB084B169.1__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Updates to idle_pg_table[] need to be mirrored into the page tables used for invoking EFI runtime services. Signed-off-by: Jan Beulich --- This in particular is a prereq for the patch at http://lists.xenproject.org/archives/html/xen-devel/2015-05/msg02125.html= =20 to be correct. --- a/xen/arch/x86/efi/runtime.h +++ b/xen/arch/x86/efi/runtime.h @@ -2,4 +2,10 @@ =20 #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 #include #include +#include =20 #ifndef efi_enabled const bool_t efi_enabled =3D 0; @@ -9,6 +10,8 @@ const bool_t efi_enabled =3D 0; =20 void __init efi_init_memory(void) { } =20 +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 =3D l4e_from_paddr(__pa(pl3e), __PAGE_HYPERVI= SOR); + + l4e_write(pl4e, l4e); + efi_update_l4_pgtable(l4_table_offset(v), l4e); pl3e =3D 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__) */ =20 #define _PAGE_NONE _AC(0x000,U) --=__PartB084B169.1__= Content-Type: text/plain; name="x86-EFI-sync-L4-pgt.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="x86-EFI-sync-L4-pgt.patch" x86/EFI: keep EFI runtime services top level page tables up-to-date=0A=0AUp= dates to idle_pg_table[] need to be mirrored into the page tables=0Aused = for invoking EFI runtime services.=0A=0ASigned-off-by: Jan Beulich = =0A---=0AThis in particular is a prereq for the patch = at=0Ahttp://lists.xenproject.org/archives/html/xen-devel/2015-05/msg02125.h= tml=0Ato be correct.=0A=0A--- a/xen/arch/x86/efi/runtime.h=0A+++ b/xen/arch= /x86/efi/runtime.h=0A@@ -2,4 +2,10 @@=0A =0A #ifndef COMPAT=0A l4_pgentry_t= *__read_mostly efi_l4_pgtable;=0A+=0A+void efi_update_l4_pgtable(unsigned = int l4idx, l4_pgentry_t l4e)=0A+{=0A+ if ( efi_l4_pgtable )=0A+ = l4e_write(efi_l4_pgtable + l4idx, l4e);=0A+}=0A #endif=0A--- a/xen/arch/x86= /efi/stub.c=0A+++ b/xen/arch/x86/efi/stub.c=0A@@ -2,6 +2,7 @@=0A #include = =0A #include =0A #include =0A+#include = =0A =0A #ifndef efi_enabled=0A const bool_t efi_enabled =3D = 0;=0A@@ -9,6 +10,8 @@ const bool_t efi_enabled =3D 0;=0A =0A void __init = efi_init_memory(void) { }=0A =0A+void efi_update_l4_pgtable(unsigned int = l4idx, l4_pgentry_t l4e) { }=0A+=0A paddr_t efi_rs_page_table(void)=0A = {=0A BUG();=0A--- a/xen/arch/x86/mm.c=0A+++ b/xen/arch/x86/mm.c=0A@@ = -5311,7 +5311,10 @@ static l3_pgentry_t *virt_to_xen_l3e(uns=0A = spin_lock(&map_pgdir_lock);=0A if ( !(l4e_get_flags(*pl4e) & = _PAGE_PRESENT) )=0A {=0A- l4e_write(pl4e, l4e_from_paddr= (__pa(pl3e), __PAGE_HYPERVISOR));=0A+ l4_pgentry_t l4e =3D = l4e_from_paddr(__pa(pl3e), __PAGE_HYPERVISOR);=0A+=0A+ = l4e_write(pl4e, l4e);=0A+ efi_update_l4_pgtable(l4_table_offset(= v), l4e);=0A pl3e =3D NULL;=0A }=0A if ( = locking )=0A--- a/xen/include/asm-x86/page.h=0A+++ b/xen/include/asm-x86/pa= ge.h=0A@@ -288,6 +288,7 @@ extern l2_pgentry_t l2_identmap[4*L2_PAG=0A = extern l1_pgentry_t l1_identmap[L1_PAGETABLE_ENTRIES],=0A l1_fixmap[L1_= PAGETABLE_ENTRIES];=0A void paging_init(void);=0A+void efi_update_l4_pgtabl= e(unsigned int l4idx, l4_pgentry_t);=0A #endif /* !defined(__ASSEMBLY__) = */=0A =0A #define _PAGE_NONE _AC(0x000,U)=0A --=__PartB084B169.1__= 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 --=__PartB084B169.1__=--