2014-04-08 06:39:52 +08:00
|
|
|
/*
|
|
|
|
* fixmap.h: compile-time virtual memory allocation
|
|
|
|
*
|
|
|
|
* This file is subject to the terms and conditions of the GNU General Public
|
|
|
|
* License. See the file "COPYING" in the main directory of this archive
|
|
|
|
* for more details.
|
|
|
|
*
|
|
|
|
* Copyright (C) 1998 Ingo Molnar
|
|
|
|
* Copyright (C) 2013 Mark Salter <msalter@redhat.com>
|
|
|
|
*
|
2015-08-23 21:24:44 +08:00
|
|
|
* Adapted from arch/x86 version.
|
2014-04-08 06:39:52 +08:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _ASM_ARM64_FIXMAP_H
|
|
|
|
#define _ASM_ARM64_FIXMAP_H
|
|
|
|
|
|
|
|
#ifndef __ASSEMBLY__
|
|
|
|
#include <linux/kernel.h>
|
2015-10-19 21:19:33 +08:00
|
|
|
#include <linux/sizes.h>
|
2015-06-01 19:40:32 +08:00
|
|
|
#include <asm/boot.h>
|
2014-04-08 06:39:52 +08:00
|
|
|
#include <asm/page.h>
|
arm64: Remove fixmap include fragility
The asm-generic fixmap.h depends on each architecture's fixmap.h to pull
in the definition of PAGE_KERNEL_RO, if this exists. In the absence of
this, FIXMAP_PAGE_RO will not be defined. In mm/early_ioremap.c the
definition of early_memremap_ro is predicated on FIXMAP_PAGE_RO being
defined.
Currently, the arm64 fixmap.h doesn't include pgtable.h for the
definition of PAGE_KERNEL_RO, and as a knock-on effect early_memremap_ro
is not always defined, leading to link-time failures when it is used.
This has been observed with defconfig on next-20160226.
Unfortunately, as pgtable.h includes fixmap.h, adding the include
introduces a circular dependency, which is just as fragile.
Instead, this patch factors out PAGE_KERNEL_RO and other prot
definitions into a new pgtable-prot header which can be included by poth
pgtable.h and fixmap.h, avoiding the circular dependency, and ensuring
that early_memremap_ro is alwyas defined where it is used.
Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Reported-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Will Deacon <will.deacon@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
2016-02-26 22:31:32 +08:00
|
|
|
#include <asm/pgtable-prot.h>
|
2014-04-08 06:39:52 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Here we define all the compile-time 'special' virtual
|
|
|
|
* addresses. The point is to have a constant address at
|
|
|
|
* compile time, but to set the physical address only
|
|
|
|
* in the boot process.
|
|
|
|
*
|
|
|
|
* These 'compile-time allocated' memory buffers are
|
|
|
|
* page-sized. Use set_fixmap(idx,phys) to associate
|
|
|
|
* physical memory with fixmap indices.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
enum fixed_addresses {
|
2014-11-26 08:14:16 +08:00
|
|
|
FIX_HOLE,
|
2015-06-01 19:40:32 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Reserve a virtual window for the FDT that is 2 MB larger than the
|
|
|
|
* maximum supported size, and put it at the top of the fixmap region.
|
|
|
|
* The additional space ensures that any FDT that does not exceed
|
|
|
|
* MAX_FDT_SIZE can be mapped regardless of whether it crosses any
|
|
|
|
* 2 MB alignment boundaries.
|
|
|
|
*
|
|
|
|
* Keep this at the top so it remains 2 MB aligned.
|
|
|
|
*/
|
|
|
|
#define FIX_FDT_SIZE (MAX_FDT_SIZE + SZ_2M)
|
|
|
|
FIX_FDT_END,
|
|
|
|
FIX_FDT = FIX_FDT_END + FIX_FDT_SIZE / PAGE_SIZE - 1,
|
|
|
|
|
2014-04-08 06:39:52 +08:00
|
|
|
FIX_EARLYCON_MEM_BASE,
|
2015-03-04 21:27:34 +08:00
|
|
|
FIX_TEXT_POKE0,
|
2017-11-07 02:44:24 +08:00
|
|
|
|
|
|
|
#ifdef CONFIG_ACPI_APEI_GHES
|
|
|
|
/* Used for GHES mapping from assorted contexts */
|
|
|
|
FIX_APEI_GHES_IRQ,
|
2019-01-30 02:48:57 +08:00
|
|
|
FIX_APEI_GHES_SEA,
|
2019-01-30 02:49:01 +08:00
|
|
|
#ifdef CONFIG_ARM_SDE_INTERFACE
|
|
|
|
FIX_APEI_GHES_SDEI_NORMAL,
|
|
|
|
FIX_APEI_GHES_SDEI_CRITICAL,
|
|
|
|
#endif
|
2017-11-07 02:44:24 +08:00
|
|
|
#endif /* CONFIG_ACPI_APEI_GHES */
|
|
|
|
|
2017-11-14 22:14:17 +08:00
|
|
|
#ifdef CONFIG_UNMAP_KERNEL_AT_EL0
|
2017-12-06 19:24:02 +08:00
|
|
|
FIX_ENTRY_TRAMP_DATA,
|
2017-11-14 22:14:17 +08:00
|
|
|
FIX_ENTRY_TRAMP_TEXT,
|
|
|
|
#define TRAMP_VALIAS (__fix_to_virt(FIX_ENTRY_TRAMP_TEXT))
|
|
|
|
#endif /* CONFIG_UNMAP_KERNEL_AT_EL0 */
|
2014-04-08 06:39:52 +08:00
|
|
|
__end_of_permanent_fixed_addresses,
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Temporary boot-time mappings, used by early_ioremap(),
|
|
|
|
* before ioremap() is functional.
|
|
|
|
*/
|
2015-10-19 21:19:33 +08:00
|
|
|
#define NR_FIX_BTMAPS (SZ_256K / PAGE_SIZE)
|
2014-04-08 06:39:52 +08:00
|
|
|
#define FIX_BTMAPS_SLOTS 7
|
|
|
|
#define TOTAL_FIX_BTMAPS (NR_FIX_BTMAPS * FIX_BTMAPS_SLOTS)
|
|
|
|
|
|
|
|
FIX_BTMAP_END = __end_of_permanent_fixed_addresses,
|
|
|
|
FIX_BTMAP_BEGIN = FIX_BTMAP_END + TOTAL_FIX_BTMAPS - 1,
|
2016-01-25 19:45:07 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Used for kernel page table creation, so unmapped memory may be used
|
|
|
|
* for tables.
|
|
|
|
*/
|
|
|
|
FIX_PTE,
|
|
|
|
FIX_PMD,
|
|
|
|
FIX_PUD,
|
|
|
|
FIX_PGD,
|
|
|
|
|
2014-04-08 06:39:52 +08:00
|
|
|
__end_of_fixed_addresses
|
|
|
|
};
|
|
|
|
|
|
|
|
#define FIXADDR_SIZE (__end_of_permanent_fixed_addresses << PAGE_SHIFT)
|
|
|
|
#define FIXADDR_START (FIXADDR_TOP - FIXADDR_SIZE)
|
|
|
|
|
|
|
|
#define FIXMAP_PAGE_IO __pgprot(PROT_DEVICE_nGnRE)
|
|
|
|
|
2014-11-22 05:50:42 +08:00
|
|
|
void __init early_fixmap_init(void);
|
2014-04-08 06:39:52 +08:00
|
|
|
|
2014-11-22 05:50:42 +08:00
|
|
|
#define __early_set_fixmap __set_fixmap
|
|
|
|
|
2015-03-24 22:02:36 +08:00
|
|
|
#define __late_set_fixmap __set_fixmap
|
|
|
|
#define __late_clear_fixmap(idx) __set_fixmap((idx), 0, FIXMAP_PAGE_CLEAR)
|
|
|
|
|
2014-11-22 05:50:42 +08:00
|
|
|
extern void __set_fixmap(enum fixed_addresses idx, phys_addr_t phys, pgprot_t prot);
|
2014-04-08 06:39:52 +08:00
|
|
|
|
|
|
|
#include <asm-generic/fixmap.h>
|
|
|
|
|
|
|
|
#endif /* !__ASSEMBLY__ */
|
|
|
|
#endif /* _ASM_ARM64_FIXMAP_H */
|