mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-12 13:55:32 +00:00
powerpc/64: Fix the definition of the fixmap area
At the time being, the fixmap area is defined at the top of
the address space or just below KASAN.
This definition is not valid for PPC64.
For PPC64, use the top of the I/O space.
Because of circular dependencies, it is not possible to include
asm/fixmap.h in asm/book3s/64/pgtable.h , so define a fixed size
AREA at the top of the I/O space for fixmap and ensure during
build that the size is big enough.
Fixes: 265c3491c4
("powerpc: Add support for GENERIC_EARLY_IOREMAP")
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/0d51620eacf036d683d1a3c41328f69adb601dc0.1618925560.git.christophe.leroy@csgroup.eu
This commit is contained in:
parent
389586333c
commit
9ccba66d4d
3 changed files with 16 additions and 2 deletions
|
@ -7,6 +7,7 @@
|
|||
#ifndef __ASSEMBLY__
|
||||
#include <linux/mmdebug.h>
|
||||
#include <linux/bug.h>
|
||||
#include <linux/sizes.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
@ -324,7 +325,8 @@ extern unsigned long pci_io_base;
|
|||
#define PHB_IO_END (KERN_IO_START + FULL_IO_SIZE)
|
||||
#define IOREMAP_BASE (PHB_IO_END)
|
||||
#define IOREMAP_START (ioremap_bot)
|
||||
#define IOREMAP_END (KERN_IO_END)
|
||||
#define IOREMAP_END (KERN_IO_END - FIXADDR_SIZE)
|
||||
#define FIXADDR_SIZE SZ_32M
|
||||
|
||||
/* Advertise special mapping type for AGP */
|
||||
#define HAVE_PAGE_AGP
|
||||
|
|
|
@ -23,12 +23,17 @@
|
|||
#include <asm/kmap_size.h>
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_PPC64
|
||||
#define FIXADDR_TOP (IOREMAP_END + FIXADDR_SIZE)
|
||||
#else
|
||||
#define FIXADDR_SIZE 0
|
||||
#ifdef CONFIG_KASAN
|
||||
#include <asm/kasan.h>
|
||||
#define FIXADDR_TOP (KASAN_SHADOW_START - PAGE_SIZE)
|
||||
#else
|
||||
#define FIXADDR_TOP ((unsigned long)(-PAGE_SIZE))
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Here we define all the compile-time 'special' virtual
|
||||
|
@ -50,6 +55,7 @@
|
|||
*/
|
||||
enum fixed_addresses {
|
||||
FIX_HOLE,
|
||||
#ifdef CONFIG_PPC32
|
||||
/* reserve the top 128K for early debugging purposes */
|
||||
FIX_EARLY_DEBUG_TOP = FIX_HOLE,
|
||||
FIX_EARLY_DEBUG_BASE = FIX_EARLY_DEBUG_TOP+(ALIGN(SZ_128K, PAGE_SIZE)/PAGE_SIZE)-1,
|
||||
|
@ -72,6 +78,7 @@ enum fixed_addresses {
|
|||
FIX_IMMR_SIZE,
|
||||
#endif
|
||||
/* FIX_PCIE_MCFG, */
|
||||
#endif /* CONFIG_PPC32 */
|
||||
__end_of_permanent_fixed_addresses,
|
||||
|
||||
#define NR_FIX_BTMAPS (SZ_256K / PAGE_SIZE)
|
||||
|
@ -98,6 +105,8 @@ enum fixed_addresses {
|
|||
static inline void __set_fixmap(enum fixed_addresses idx,
|
||||
phys_addr_t phys, pgprot_t flags)
|
||||
{
|
||||
BUILD_BUG_ON(IS_ENABLED(CONFIG_PPC64) && __FIXADDR_SIZE > FIXADDR_SIZE);
|
||||
|
||||
if (__builtin_constant_p(idx))
|
||||
BUILD_BUG_ON(idx >= __end_of_fixed_addresses);
|
||||
else if (WARN_ON(idx >= __end_of_fixed_addresses))
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
* the ppc64 non-hashed page table.
|
||||
*/
|
||||
|
||||
#include <linux/sizes.h>
|
||||
|
||||
#include <asm/nohash/64/pgtable-4k.h>
|
||||
#include <asm/barrier.h>
|
||||
#include <asm/asm-const.h>
|
||||
|
@ -54,7 +56,8 @@
|
|||
#define PHB_IO_END (KERN_IO_START + FULL_IO_SIZE)
|
||||
#define IOREMAP_BASE (PHB_IO_END)
|
||||
#define IOREMAP_START (ioremap_bot)
|
||||
#define IOREMAP_END (KERN_VIRT_START + KERN_VIRT_SIZE)
|
||||
#define IOREMAP_END (KERN_VIRT_START + KERN_VIRT_SIZE - FIXADDR_SIZE)
|
||||
#define FIXADDR_SIZE SZ_32M
|
||||
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in a new issue