xref: /openbmc/linux/arch/mips/include/asm/highmem.h (revision cf02ce74)
1b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */
2384740dcSRalf Baechle /*
3384740dcSRalf Baechle  * highmem.h: virtual kernel memory mappings for high memory
4384740dcSRalf Baechle  *
5384740dcSRalf Baechle  * Used in CONFIG_HIGHMEM systems for memory pages which
6384740dcSRalf Baechle  * are not addressable by direct kernel virtual addresses.
7384740dcSRalf Baechle  *
8384740dcSRalf Baechle  * Copyright (C) 1999 Gerhard Wichert, Siemens AG
9384740dcSRalf Baechle  *		      Gerhard.Wichert@pdb.siemens.de
10384740dcSRalf Baechle  *
11384740dcSRalf Baechle  *
12384740dcSRalf Baechle  * Redesigned the x86 32-bit VM architecture to deal with
13384740dcSRalf Baechle  * up to 16 Terabyte physical memory. With current x86 CPUs
14384740dcSRalf Baechle  * we now support up to 64 Gigabytes physical RAM.
15384740dcSRalf Baechle  *
16384740dcSRalf Baechle  * Copyright (C) 1999 Ingo Molnar <mingo@redhat.com>
17384740dcSRalf Baechle  */
18384740dcSRalf Baechle #ifndef _ASM_HIGHMEM_H
19384740dcSRalf Baechle #define _ASM_HIGHMEM_H
20384740dcSRalf Baechle 
21384740dcSRalf Baechle #ifdef __KERNEL__
22384740dcSRalf Baechle 
2334ae8e36SRalf Baechle #include <linux/bug.h>
24384740dcSRalf Baechle #include <linux/interrupt.h>
25384740dcSRalf Baechle #include <linux/uaccess.h>
2634ae8e36SRalf Baechle #include <asm/cpu-features.h>
27a4c33e83SThomas Gleixner #include <asm/kmap_size.h>
28384740dcSRalf Baechle 
29384740dcSRalf Baechle /* declarations for highmem.c */
30384740dcSRalf Baechle extern unsigned long highstart_pfn, highend_pfn;
31384740dcSRalf Baechle 
32384740dcSRalf Baechle extern pte_t *pkmap_page_table;
33384740dcSRalf Baechle 
34384740dcSRalf Baechle /*
35384740dcSRalf Baechle  * Right now we initialize only a single pte table. It can be extended
36384740dcSRalf Baechle  * easily, subsequent pte tables have to be allocated in one physical
37384740dcSRalf Baechle  * chunk of RAM.
38384740dcSRalf Baechle  */
39*cf02ce74SWei Li #if defined(CONFIG_PHYS_ADDR_T_64BIT) || defined(CONFIG_MIPS_HUGE_TLB_SUPPORT)
40725a269bSMarcin Nowakowski #define LAST_PKMAP 512
41725a269bSMarcin Nowakowski #else
42384740dcSRalf Baechle #define LAST_PKMAP 1024
43725a269bSMarcin Nowakowski #endif
44725a269bSMarcin Nowakowski 
45384740dcSRalf Baechle #define LAST_PKMAP_MASK (LAST_PKMAP-1)
46384740dcSRalf Baechle #define PKMAP_NR(virt)	((virt-PKMAP_BASE) >> PAGE_SHIFT)
47384740dcSRalf Baechle #define PKMAP_ADDR(nr)	(PKMAP_BASE + ((nr) << PAGE_SHIFT))
48384740dcSRalf Baechle 
49525aaf9bSIra Weiny #define ARCH_HAS_KMAP_FLUSH_TLB
50525aaf9bSIra Weiny extern void kmap_flush_tlb(unsigned long addr);
51384740dcSRalf Baechle 
5234ae8e36SRalf Baechle #define flush_cache_kmaps()	BUG_ON(cpu_has_dc_aliases)
53384740dcSRalf Baechle 
548c0d5d78SThomas Gleixner #define arch_kmap_local_set_pte(mm, vaddr, ptep, ptev)	set_pte(ptep, ptev)
55a4c33e83SThomas Gleixner #define arch_kmap_local_post_map(vaddr, pteval)	local_flush_tlb_one(vaddr)
56a4c33e83SThomas Gleixner #define arch_kmap_local_post_unmap(vaddr)	local_flush_tlb_one(vaddr)
57bb86bf28SRalf Baechle 
58384740dcSRalf Baechle #endif /* __KERNEL__ */
59384740dcSRalf Baechle 
60384740dcSRalf Baechle #endif /* _ASM_HIGHMEM_H */
61