Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /*
0003  * highmem.h: virtual kernel memory mappings for high memory
0004  *
0005  * Used in CONFIG_HIGHMEM systems for memory pages which
0006  * are not addressable by direct kernel virtual addresses.
0007  *
0008  * Copyright (C) 1999 Gerhard Wichert, Siemens AG
0009  *            Gerhard.Wichert@pdb.siemens.de
0010  *
0011  *
0012  * Redesigned the x86 32-bit VM architecture to deal with
0013  * up to 16 Terabyte physical memory. With current x86 CPUs
0014  * we now support up to 64 Gigabytes physical RAM.
0015  *
0016  * Copyright (C) 1999 Ingo Molnar <mingo@redhat.com>
0017  */
0018 
0019 #ifndef _ASM_X86_HIGHMEM_H
0020 #define _ASM_X86_HIGHMEM_H
0021 
0022 #ifdef __KERNEL__
0023 
0024 #include <linux/interrupt.h>
0025 #include <linux/threads.h>
0026 #include <asm/tlbflush.h>
0027 #include <asm/paravirt.h>
0028 #include <asm/fixmap.h>
0029 #include <asm/pgtable_areas.h>
0030 
0031 /* declarations for highmem.c */
0032 extern unsigned long highstart_pfn, highend_pfn;
0033 
0034 /*
0035  * Right now we initialize only a single pte table. It can be extended
0036  * easily, subsequent pte tables have to be allocated in one physical
0037  * chunk of RAM.
0038  */
0039 /*
0040  * Ordering is:
0041  *
0042  * high memory on:                        high_memory off:
0043  *    FIXADDR_TOP                                        FIXADDR_TOP
0044  *        fixed addresses                                    fixed addresses
0045  *    FIXADDR_START                                      FIXADDR_START
0046  *        temp fixed addresses/persistent kmap area      VMALLOC_END
0047  *    PKMAP_BASE                                             temp fixed addresses/vmalloc area
0048  *    VMALLOC_END                                        VMALLOC_START
0049  *        vmalloc area                                   high_memory
0050  *    VMALLOC_START
0051  *    high_memory
0052  *
0053  * The temp fixed area is only used during boot for early_ioremap(), and
0054  * it is unused when the ioremap() is functional. vmalloc/pkmap area become
0055  * available after early boot so the temp fixed area is available for re-use.
0056  */
0057 #define LAST_PKMAP_MASK (LAST_PKMAP-1)
0058 #define PKMAP_NR(virt)  ((virt-PKMAP_BASE) >> PAGE_SHIFT)
0059 #define PKMAP_ADDR(nr)  (PKMAP_BASE + ((nr) << PAGE_SHIFT))
0060 
0061 #define flush_cache_kmaps() do { } while (0)
0062 
0063 #define arch_kmap_local_post_map(vaddr, pteval)     \
0064     arch_flush_lazy_mmu_mode()
0065 
0066 #define arch_kmap_local_post_unmap(vaddr)       \
0067     do {                        \
0068         flush_tlb_one_kernel((vaddr));      \
0069         arch_flush_lazy_mmu_mode();     \
0070     } while (0)
0071 
0072 extern void add_highpages_with_active_regions(int nid, unsigned long start_pfn,
0073                     unsigned long end_pfn);
0074 
0075 #endif /* __KERNEL__ */
0076 
0077 #endif /* _ASM_X86_HIGHMEM_H */