Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752502AbbK2JFx (ORCPT ); Sun, 29 Nov 2015 04:05:53 -0500 Received: from terminus.zytor.com ([198.137.202.10]:40554 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751837AbbK2JFo (ORCPT ); Sun, 29 Nov 2015 04:05:44 -0500 Date: Sun, 29 Nov 2015 01:04:24 -0800 From: tip-bot for Matt Fleming Message-ID: 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 Reply-To: peterz@infradead.org, luto@amacapital.net, sai.praneeth.prakhya@intel.com, hpa@zytor.com, torvalds@linux-foundation.org, tglx@linutronix.de, ard.biesheuvel@linaro.org, dvlasenk@redhat.com, mingo@kernel.org, linux-kernel@vger.kernel.org, bp@alien8.de, matt@codeblueprint.co.uk, bp@suse.de, toshi.kani@hp.com, brgerst@gmail.com In-Reply-To: <1448658575-17029-4-git-send-email-matt@codeblueprint.co.uk> References: <1448658575-17029-4-git-send-email-matt@codeblueprint.co.uk> To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/efi] x86/efi: Map RAM into the identity page table for mixed mode Git-Commit-ID: b61a76f8850d2979550abc42d7e09154ebb8d785 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2944 Lines: 80 Commit-ID: b61a76f8850d2979550abc42d7e09154ebb8d785 Gitweb: http://git.kernel.org/tip/b61a76f8850d2979550abc42d7e09154ebb8d785 Author: Matt Fleming AuthorDate: Fri, 27 Nov 2015 21:09:32 +0000 Committer: Ingo Molnar 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 Reviewed-by: Borislav Petkov Acked-by: Borislav Petkov Cc: Andy Lutomirski Cc: Ard Biesheuvel Cc: Borislav Petkov Cc: Brian Gerst Cc: Denys Vlasenko Cc: H. Peter Anvin Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Sai Praneeth Prakhya Cc: Thomas Gleixner Cc: Toshi Kani 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 --- 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"); -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/