diff mbox series

[2/5] x86/efi: Replace efi_pgd with efi_mm.pgd

Message ID 20180312084500.10764-3-ard.biesheuvel@linaro.org
State New
Headers show
Series None | expand

Commit Message

Ard Biesheuvel March 12, 2018, 8:44 a.m. UTC
From: Sai Praneeth <sai.praneeth.prakhya@intel.com>


Since the previous patch added support for efi_mm, let's handle efi_pgd
through efi_mm and remove global variable efi_pgd.

Signed-off-by: Sai Praneeth Prakhya <sai.praneeth.prakhya@intel.com>

Cc: "Lee, Chun-Yi" <jlee@suse.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: Bhupesh Sharma <bhsharma@redhat.com>
Cc: Ricardo Neri <ricardo.neri@intel.com>
Cc: Ravi Shankar <ravi.v.shankar@intel.com>
Tested-by: Bhupesh Sharma <bhsharma@redhat.com>

Reviewed-by: Matt Fleming <matt@codeblueprint.co.uk>

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

---
 arch/x86/platform/efi/efi_64.c | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

-- 
2.15.1

--
To unsubscribe from this list: send the line "unsubscribe linux-efi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Ingo Molnar March 12, 2018, 9:02 a.m. UTC | #1
* Ard Biesheuvel <ard.biesheuvel@linaro.org> wrote:

> From: Sai Praneeth <sai.praneeth.prakhya@intel.com>

> 

> Since the previous patch added support for efi_mm, let's handle efi_pgd

> through efi_mm and remove global variable efi_pgd.

> 

> Signed-off-by: Sai Praneeth Prakhya <sai.praneeth.prakhya@intel.com>

> Cc: "Lee, Chun-Yi" <jlee@suse.com>

> Cc: Borislav Petkov <bp@alien8.de>

> Cc: Tony Luck <tony.luck@intel.com>

> Cc: Andy Lutomirski <luto@kernel.org>

> Cc: Michael S. Tsirkin <mst@redhat.com>

> Cc: Bhupesh Sharma <bhsharma@redhat.com>

> Cc: Ricardo Neri <ricardo.neri@intel.com>

> Cc: Ravi Shankar <ravi.v.shankar@intel.com>

> Tested-by: Bhupesh Sharma <bhsharma@redhat.com>

> Reviewed-by: Matt Fleming <matt@codeblueprint.co.uk>

> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

> ---

>  arch/x86/platform/efi/efi_64.c | 17 ++++++++---------

>  1 file changed, 8 insertions(+), 9 deletions(-)

> 

> diff --git a/arch/x86/platform/efi/efi_64.c b/arch/x86/platform/efi/efi_64.c

> index 0045efe9947b..8881e601c32d 100644

> --- a/arch/x86/platform/efi/efi_64.c

> +++ b/arch/x86/platform/efi/efi_64.c

> @@ -190,8 +190,6 @@ void __init efi_call_phys_epilog(pgd_t *save_pgd)

>  	early_code_mapping_set_exec(0);

>  }

>  

> -static pgd_t *efi_pgd;

> -


Hm, so there's some interaction here with:

  116fef640859: x86/mm/dump_pagetables: Add the EFI pagetable to the debugfs 'page_tables' directory

which is in tip:x86/mm.

Could you please resolve that conflict? I'll sort out the topic branches 
afterwards.

Thanks,

	Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-efi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Ingo Molnar March 12, 2018, 9:26 a.m. UTC | #2
* Ingo Molnar <mingo@kernel.org> wrote:

> > -static pgd_t *efi_pgd;

> > -

> 

> Hm, so there's some interaction here with:

> 

>   116fef640859: x86/mm/dump_pagetables: Add the EFI pagetable to the debugfs 'page_tables' directory

> 

> which is in tip:x86/mm.

> 

> Could you please resolve that conflict? I'll sort out the topic branches 

> afterwards.


So I've resolved it the following way, I merged the conflicting commit into 
tip:efi/core and applied the 3 unrelated patches from your series:

 36b649760e94: efi: Use string literals for efi_char16_t variable initializers
 136d5d57e35c: efi/esrt: Fix handling of early ESRT table mapping
 7e904a91bf60: efi: Use efi_mm in x86 as well as ARM
 b0599e2801df: Merge branch 'x86/mm' into efi/core

and pushed it out.

So if you could resolve the two conflicting patches on top of 36b649760e94 then we 
should be good going forward.

Thanks,

	Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-efi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Ingo Molnar March 12, 2018, 9:48 a.m. UTC | #3
* Ard Biesheuvel <ard.biesheuvel@linaro.org> wrote:

> On 12 March 2018 at 09:26, Ingo Molnar <mingo@kernel.org> wrote:

> >

> > * Ingo Molnar <mingo@kernel.org> wrote:

> >

> >> > -static pgd_t *efi_pgd;

> >> > -

> >>

> >> Hm, so there's some interaction here with:

> >>

> >>   116fef640859: x86/mm/dump_pagetables: Add the EFI pagetable to the debugfs 'page_tables' directory

> >>

> >> which is in tip:x86/mm.

> >>

> >> Could you please resolve that conflict? I'll sort out the topic branches

> >> afterwards.

> >

> > So I've resolved it the following way, I merged the conflicting commit into

> > tip:efi/core and applied the 3 unrelated patches from your series:

> >

> >  36b649760e94: efi: Use string literals for efi_char16_t variable initializers

> >  136d5d57e35c: efi/esrt: Fix handling of early ESRT table mapping

> >  7e904a91bf60: efi: Use efi_mm in x86 as well as ARM

> >  b0599e2801df: Merge branch 'x86/mm' into efi/core

> >

> > and pushed it out.

> >

> > So if you could resolve the two conflicting patches on top of 36b649760e94 then we

> > should be good going forward.

> >

> 

> By 'resolve' you mean rebase and resend, right?


Yeah.

I expected it to probably be a bit more work than a regular rebase, because we 
grew a new efi_pgd user and I didn't want to trivialize the conflict resolution 
effort - hence the 'resolve the conflict' formulation! :-)

Thanks,

	Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-efi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox series

Patch

diff --git a/arch/x86/platform/efi/efi_64.c b/arch/x86/platform/efi/efi_64.c
index 0045efe9947b..8881e601c32d 100644
--- a/arch/x86/platform/efi/efi_64.c
+++ b/arch/x86/platform/efi/efi_64.c
@@ -190,8 +190,6 @@  void __init efi_call_phys_epilog(pgd_t *save_pgd)
 	early_code_mapping_set_exec(0);
 }
 
-static pgd_t *efi_pgd;
-
 /*
  * We need our own copy of the higher levels of the page tables
  * because we want to avoid inserting EFI region mappings (EFI_VA_END
@@ -203,7 +201,7 @@  static pgd_t *efi_pgd;
  */
 int __init efi_alloc_page_tables(void)
 {
-	pgd_t *pgd;
+	pgd_t *pgd, *efi_pgd;
 	p4d_t *p4d;
 	pud_t *pud;
 	gfp_t gfp_mask;
@@ -231,6 +229,7 @@  int __init efi_alloc_page_tables(void)
 		return -ENOMEM;
 	}
 
+	efi_mm.pgd = efi_pgd;
 	mm_init_cpumask(&efi_mm);
 	init_new_context(NULL, &efi_mm);
 
@@ -246,6 +245,7 @@  void efi_sync_low_kernel_mappings(void)
 	pgd_t *pgd_k, *pgd_efi;
 	p4d_t *p4d_k, *p4d_efi;
 	pud_t *pud_k, *pud_efi;
+	pgd_t *efi_pgd = efi_mm.pgd;
 
 	if (efi_enabled(EFI_OLD_MEMMAP))
 		return;
@@ -339,7 +339,7 @@  int __init efi_setup_page_tables(unsigned long pa_memmap, unsigned num_pages)
 	unsigned long pfn, text, pf;
 	struct page *page;
 	unsigned npages;
-	pgd_t *pgd;
+	pgd_t *pgd = efi_mm.pgd;
 
 	if (efi_enabled(EFI_OLD_MEMMAP))
 		return 0;
@@ -349,8 +349,7 @@  int __init efi_setup_page_tables(unsigned long pa_memmap, unsigned num_pages)
 	 * this value is loaded into cr3 the PGD will be decrypted during
 	 * the pagetable walk.
 	 */
-	efi_scratch.efi_pgt = (pgd_t *)__sme_pa(efi_pgd);
-	pgd = efi_pgd;
+	efi_scratch.efi_pgt = (pgd_t *)__sme_pa(pgd);
 
 	/*
 	 * It can happen that the physical address of new_memmap lands in memory
@@ -420,7 +419,7 @@  static void __init __map_region(efi_memory_desc_t *md, u64 va)
 {
 	unsigned long flags = _PAGE_RW;
 	unsigned long pfn;
-	pgd_t *pgd = efi_pgd;
+	pgd_t *pgd = efi_mm.pgd;
 
 	if (!(md->attribute & EFI_MEMORY_WB))
 		flags |= _PAGE_PCD;
@@ -524,7 +523,7 @@  void __init parse_efi_setup(u64 phys_addr, u32 data_len)
 static int __init efi_update_mappings(efi_memory_desc_t *md, unsigned long pf)
 {
 	unsigned long pfn;
-	pgd_t *pgd = efi_pgd;
+	pgd_t *pgd = efi_mm.pgd;
 	int err1, err2;
 
 	/* Update the 1:1 mapping */
@@ -621,7 +620,7 @@  void __init efi_dump_pagetable(void)
 	if (efi_enabled(EFI_OLD_MEMMAP))
 		ptdump_walk_pgd_level(NULL, swapper_pg_dir);
 	else
-		ptdump_walk_pgd_level(NULL, efi_pgd);
+		ptdump_walk_pgd_level(NULL, efi_mm.pgd);
 #endif
 }