From: tip-bot for Matt Fleming <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: hpa@zytor.com, torvalds@linux-foundation.org,
sai.praneeth.prakhya@intel.com, peterz@infradead.org,
luto@amacapital.net, linux-kernel@vger.kernel.org,
dvlasenk@redhat.com, mingo@kernel.org, ard.biesheuvel@linaro.org,
tglx@linutronix.de, bp@suse.de, bp@alien8.de,
matt@codeblueprint.co.uk, brgerst@gmail.com, toshi.kani@hp.com
Subject: [tip:x86/efi] x86/efi: Map RAM into the identity page table for mixed mode
Date: Sun, 29 Nov 2015 01:04:24 -0800 [thread overview]
Message-ID: <tip-b61a76f8850d2979550abc42d7e09154ebb8d785@git.kernel.org> (raw)
In-Reply-To: <1448658575-17029-4-git-send-email-matt@codeblueprint.co.uk>
Commit-ID: b61a76f8850d2979550abc42d7e09154ebb8d785
Gitweb: http://git.kernel.org/tip/b61a76f8850d2979550abc42d7e09154ebb8d785
Author: Matt Fleming <matt@codeblueprint.co.uk>
AuthorDate: Fri, 27 Nov 2015 21:09:32 +0000
Committer: Ingo Molnar <mingo@kernel.org>
CommitDate: Sun, 29 Nov 2015 09:15:42 +0100
x86/efi: Map RAM into the identity page table for mixed mode
We are relying on the pre-existing mappings in 'trampoline_pgd'
when accessing function arguments in the EFI mixed mode thunking
code.
Instead let's map memory explicitly so that things will continue
to work when we move to a separate page table in the future.
Signed-off-by: Matt Fleming <matt@codeblueprint.co.uk>
Reviewed-by: Borislav Petkov <bp@suse.de>
Acked-by: Borislav Petkov <bp@suse.de>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Sai Praneeth Prakhya <sai.praneeth.prakhya@intel.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Toshi Kani <toshi.kani@hp.com>
Cc: linux-efi@vger.kernel.org
Link: http://lkml.kernel.org/r/1448658575-17029-4-git-send-email-matt@codeblueprint.co.uk
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
arch/x86/platform/efi/efi_64.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/arch/x86/platform/efi/efi_64.c b/arch/x86/platform/efi/efi_64.c
index 5aa186d..102976d 100644
--- a/arch/x86/platform/efi/efi_64.c
+++ b/arch/x86/platform/efi/efi_64.c
@@ -144,6 +144,7 @@ void efi_sync_low_kernel_mappings(void)
int __init efi_setup_page_tables(unsigned long pa_memmap, unsigned num_pages)
{
unsigned long pfn, text;
+ efi_memory_desc_t *md;
struct page *page;
unsigned npages;
pgd_t *pgd;
@@ -177,6 +178,25 @@ int __init efi_setup_page_tables(unsigned long pa_memmap, unsigned num_pages)
if (!IS_ENABLED(CONFIG_EFI_MIXED))
return 0;
+ /*
+ * Map all of RAM so that we can access arguments in the 1:1
+ * mapping when making EFI runtime calls.
+ */
+ for_each_efi_memory_desc(&memmap, md) {
+ if (md->type != EFI_CONVENTIONAL_MEMORY &&
+ md->type != EFI_LOADER_DATA &&
+ md->type != EFI_LOADER_CODE)
+ continue;
+
+ pfn = md->phys_addr >> PAGE_SHIFT;
+ npages = md->num_pages;
+
+ if (kernel_map_pages_in_pgd(pgd, pfn, md->phys_addr, npages, 0)) {
+ pr_err("Failed to map 1:1 memory\n");
+ return 1;
+ }
+ }
+
page = alloc_page(GFP_KERNEL|__GFP_DMA32);
if (!page)
panic("Unable to allocate EFI runtime stack < 4GB\n");
next prev parent reply other threads:[~2015-11-29 9:05 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-27 21:09 [GIT PULL v4 0/6] EFI page table isolation Matt Fleming
2015-11-27 21:09 ` [PATCH v4 1/6] x86: Page align _end to avoid pfn conversion bugs Matt Fleming
2015-11-29 9:03 ` [tip:x86/efi] x86/mm: Page align the '_end' symbol " tip-bot for Matt Fleming
2015-11-27 21:09 ` [PATCH v4 2/6] x86/mm/pageattr: Ensure cpa->pfn only contains page frame numbers Matt Fleming
2015-11-29 9:04 ` [tip:x86/efi] x86/mm/pat: Ensure cpa-> pfn " tip-bot for Matt Fleming
2015-11-27 21:09 ` [PATCH v4 3/6] x86/efi: Map RAM into the identity page table for mixed mode Matt Fleming
2015-11-29 9:04 ` tip-bot for Matt Fleming [this message]
2015-11-27 21:09 ` [PATCH v4 4/6] x86/efi: Hoist page table switching code into efi_call_virt() Matt Fleming
2015-11-29 9:04 ` [tip:x86/efi] " tip-bot for Matt Fleming
2015-11-27 21:09 ` [PATCH v4 5/6] x86/efi: Build our own page table structures Matt Fleming
2015-11-29 9:05 ` [tip:x86/efi] " tip-bot for Matt Fleming
2015-11-27 21:09 ` [PATCH v4 6/6] Documentation/x86: Update EFI memory region description Matt Fleming
2015-11-29 9:05 ` [tip:x86/efi] " tip-bot for Matt Fleming
2015-11-29 8:18 ` [GIT PULL v4 0/6] EFI page table isolation Ingo Molnar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=tip-b61a76f8850d2979550abc42d7e09154ebb8d785@git.kernel.org \
--to=tipbot@zytor.com \
--cc=ard.biesheuvel@linaro.org \
--cc=bp@alien8.de \
--cc=bp@suse.de \
--cc=brgerst@gmail.com \
--cc=dvlasenk@redhat.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=luto@amacapital.net \
--cc=matt@codeblueprint.co.uk \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=sai.praneeth.prakhya@intel.com \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
--cc=toshi.kani@hp.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome