14726dd60SMichal Simek /* SPDX-License-Identifier: GPL-2.0 */ 241938761SMichal Simek /* 341938761SMichal Simek * fixmap.h: compile-time virtual memory allocation 441938761SMichal Simek * 541938761SMichal Simek * Copyright (C) 1998 Ingo Molnar 641938761SMichal Simek * 741938761SMichal Simek * Copyright 2008 Freescale Semiconductor Inc. 841938761SMichal Simek * Port to powerpc added by Kumar Gala 941938761SMichal Simek * 1041938761SMichal Simek * Copyright 2011 Michal Simek <monstr@monstr.eu> 1141938761SMichal Simek * Copyright 2011 PetaLogix Qld Pty Ltd 1241938761SMichal Simek * Port to Microblaze 1341938761SMichal Simek */ 1441938761SMichal Simek 1541938761SMichal Simek #ifndef _ASM_FIXMAP_H 1641938761SMichal Simek #define _ASM_FIXMAP_H 1741938761SMichal Simek 1841938761SMichal Simek #ifndef __ASSEMBLY__ 1941938761SMichal Simek #include <linux/kernel.h> 2041938761SMichal Simek #include <asm/page.h> 212f2f371fSMichal Simek #ifdef CONFIG_HIGHMEM 222f2f371fSMichal Simek #include <linux/threads.h> 23*7ac1b26bSThomas Gleixner #include <asm/kmap_size.h> 242f2f371fSMichal Simek #endif 2541938761SMichal Simek 2641938761SMichal Simek #define FIXADDR_TOP ((unsigned long)(-PAGE_SIZE)) 2741938761SMichal Simek 2841938761SMichal Simek /* 2941938761SMichal Simek * Here we define all the compile-time 'special' virtual 3041938761SMichal Simek * addresses. The point is to have a constant address at 3141938761SMichal Simek * compile time, but to set the physical address only 3241938761SMichal Simek * in the boot process. We allocate these special addresses 3341938761SMichal Simek * from the end of virtual memory (0xfffff000) backwards. 3441938761SMichal Simek * Also this lets us do fail-safe vmalloc(), we 3541938761SMichal Simek * can guarantee that these special addresses and 3641938761SMichal Simek * vmalloc()-ed addresses never overlap. 3741938761SMichal Simek * 3841938761SMichal Simek * these 'compile-time allocated' memory buffers are 3941938761SMichal Simek * fixed-size 4k pages. (or larger if used with an increment 4041938761SMichal Simek * highger than 1) use fixmap_set(idx,phys) to associate 4141938761SMichal Simek * physical memory with fixmap indices. 4241938761SMichal Simek * 4341938761SMichal Simek * TLB entries of such buffers will not be flushed across 4441938761SMichal Simek * task switches. 4541938761SMichal Simek */ 4641938761SMichal Simek enum fixed_addresses { 4741938761SMichal Simek FIX_HOLE, 482f2f371fSMichal Simek #ifdef CONFIG_HIGHMEM 492f2f371fSMichal Simek FIX_KMAP_BEGIN, /* reserved pte's for temporary kernel mappings */ 50*7ac1b26bSThomas Gleixner FIX_KMAP_END = FIX_KMAP_BEGIN + (KM_MAX_IDX * num_possible_cpus()) - 1, 512f2f371fSMichal Simek #endif 5241938761SMichal Simek __end_of_fixed_addresses 5341938761SMichal Simek }; 5441938761SMichal Simek 5541938761SMichal Simek extern void __set_fixmap(enum fixed_addresses idx, 5641938761SMichal Simek phys_addr_t phys, pgprot_t flags); 5741938761SMichal Simek 5841938761SMichal Simek #define __FIXADDR_SIZE (__end_of_fixed_addresses << PAGE_SHIFT) 5941938761SMichal Simek #define FIXADDR_START (FIXADDR_TOP - __FIXADDR_SIZE) 6041938761SMichal Simek 6114288537SMark Salter #define FIXMAP_PAGE_NOCACHE PAGE_KERNEL_CI 6241938761SMichal Simek 6314288537SMark Salter #include <asm-generic/fixmap.h> 6441938761SMichal Simek 6541938761SMichal Simek #endif /* !__ASSEMBLY__ */ 6641938761SMichal Simek #endif 67