mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-31 16:38:12 +00:00
e455248d5e
To enable x86 to use the generic walk_page_range() function, the callers
of ptdump_walk_pgd_level() need to pass an mm_struct rather than the raw
pgd_t pointer. Luckily since commit 7e904a91bf
("efi: Use efi_mm in x86
as well as ARM") we now have an mm_struct for EFI on x86.
Link: http://lkml.kernel.org/r/20191218162402.45610-18-steven.price@arm.com
Signed-off-by: Steven Price <steven.price@arm.com>
Cc: Albert Ou <aou@eecs.berkeley.edu>
Cc: Alexandre Ghiti <alex@ghiti.fr>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Christian Borntraeger <borntraeger@de.ibm.com>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: David S. Miller <davem@davemloft.net>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: James Hogan <jhogan@kernel.org>
Cc: James Morse <james.morse@arm.com>
Cc: Jerome Glisse <jglisse@redhat.com>
Cc: "Liang, Kan" <kan.liang@linux.intel.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Paul Burton <paul.burton@mips.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Paul Walmsley <paul.walmsley@sifive.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Russell King <linux@armlinux.org.uk>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Vasily Gorbik <gor@linux.ibm.com>
Cc: Vineet Gupta <vgupta@synopsys.com>
Cc: Will Deacon <will@kernel.org>
Cc: Zong Li <zong.li@sifive.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
109 lines
2.7 KiB
C
109 lines
2.7 KiB
C
// SPDX-License-Identifier: GPL-2.0
|
|
/*
|
|
* Extensible Firmware Interface
|
|
*
|
|
* Based on Extensible Firmware Interface Specification version 1.0
|
|
*
|
|
* Copyright (C) 1999 VA Linux Systems
|
|
* Copyright (C) 1999 Walt Drummond <drummond@valinux.com>
|
|
* Copyright (C) 1999-2002 Hewlett-Packard Co.
|
|
* David Mosberger-Tang <davidm@hpl.hp.com>
|
|
* Stephane Eranian <eranian@hpl.hp.com>
|
|
*
|
|
* All EFI Runtime Services are not implemented yet as EFI only
|
|
* supports physical mode addressing on SoftSDV. This is to be fixed
|
|
* in a future version. --drummond 1999-07-20
|
|
*
|
|
* Implemented EFI runtime services and virtual mode calls. --davidm
|
|
*
|
|
* Goutham Rao: <goutham.rao@intel.com>
|
|
* Skip non-WB memory and ignore empty memory ranges.
|
|
*/
|
|
|
|
#include <linux/kernel.h>
|
|
#include <linux/types.h>
|
|
#include <linux/ioport.h>
|
|
#include <linux/efi.h>
|
|
|
|
#include <asm/io.h>
|
|
#include <asm/desc.h>
|
|
#include <asm/page.h>
|
|
#include <asm/pgtable.h>
|
|
#include <asm/tlbflush.h>
|
|
#include <asm/efi.h>
|
|
|
|
/*
|
|
* To make EFI call EFI runtime service in physical addressing mode we need
|
|
* prolog/epilog before/after the invocation to claim the EFI runtime service
|
|
* handler exclusively and to duplicate a memory mapping in low memory space,
|
|
* say 0 - 3G.
|
|
*/
|
|
|
|
int __init efi_alloc_page_tables(void)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
void efi_sync_low_kernel_mappings(void) {}
|
|
|
|
void __init efi_dump_pagetable(void)
|
|
{
|
|
#ifdef CONFIG_EFI_PGT_DUMP
|
|
ptdump_walk_pgd_level(NULL, &init_mm);
|
|
#endif
|
|
}
|
|
|
|
int __init efi_setup_page_tables(unsigned long pa_memmap, unsigned num_pages)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
void __init efi_map_region(efi_memory_desc_t *md)
|
|
{
|
|
old_map_region(md);
|
|
}
|
|
|
|
void __init efi_map_region_fixed(efi_memory_desc_t *md) {}
|
|
void __init parse_efi_setup(u64 phys_addr, u32 data_len) {}
|
|
|
|
efi_status_t efi_call_svam(efi_set_virtual_address_map_t *__efiapi *,
|
|
u32, u32, u32, void *);
|
|
|
|
efi_status_t __init efi_set_virtual_address_map(unsigned long memory_map_size,
|
|
unsigned long descriptor_size,
|
|
u32 descriptor_version,
|
|
efi_memory_desc_t *virtual_map)
|
|
{
|
|
struct desc_ptr gdt_descr;
|
|
efi_status_t status;
|
|
unsigned long flags;
|
|
pgd_t *save_pgd;
|
|
|
|
/* Current pgd is swapper_pg_dir, we'll restore it later: */
|
|
save_pgd = swapper_pg_dir;
|
|
load_cr3(initial_page_table);
|
|
__flush_tlb_all();
|
|
|
|
gdt_descr.address = get_cpu_gdt_paddr(0);
|
|
gdt_descr.size = GDT_SIZE - 1;
|
|
load_gdt(&gdt_descr);
|
|
|
|
/* Disable interrupts around EFI calls: */
|
|
local_irq_save(flags);
|
|
status = efi_call_svam(&efi.systab->runtime->set_virtual_address_map,
|
|
memory_map_size, descriptor_size,
|
|
descriptor_version, virtual_map);
|
|
local_irq_restore(flags);
|
|
|
|
load_fixmap_gdt(0);
|
|
load_cr3(save_pgd);
|
|
__flush_tlb_all();
|
|
|
|
return status;
|
|
}
|
|
|
|
void __init efi_runtime_update_mappings(void)
|
|
{
|
|
if (__supported_pte_mask & _PAGE_NX)
|
|
runtime_code_page_mkexec();
|
|
}
|