1b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */ 22f2f371fSMichal Simek /* 32f2f371fSMichal Simek * highmem.h: virtual kernel memory mappings for high memory 42f2f371fSMichal Simek * 52f2f371fSMichal Simek * Used in CONFIG_HIGHMEM systems for memory pages which 62f2f371fSMichal Simek * are not addressable by direct kernel virtual addresses. 72f2f371fSMichal Simek * 82f2f371fSMichal Simek * Copyright (C) 1999 Gerhard Wichert, Siemens AG 92f2f371fSMichal Simek * Gerhard.Wichert@pdb.siemens.de 102f2f371fSMichal Simek * 112f2f371fSMichal Simek * 122f2f371fSMichal Simek * Redesigned the x86 32-bit VM architecture to deal with 132f2f371fSMichal Simek * up to 16 Terabyte physical memory. With current x86 CPUs 142f2f371fSMichal Simek * we now support up to 64 Gigabytes physical RAM. 152f2f371fSMichal Simek * 162f2f371fSMichal Simek * Copyright (C) 1999 Ingo Molnar <mingo@redhat.com> 172f2f371fSMichal Simek */ 182f2f371fSMichal Simek #ifndef _ASM_HIGHMEM_H 192f2f371fSMichal Simek #define _ASM_HIGHMEM_H 202f2f371fSMichal Simek 212f2f371fSMichal Simek #ifdef __KERNEL__ 222f2f371fSMichal Simek 232f2f371fSMichal Simek #include <linux/init.h> 242f2f371fSMichal Simek #include <linux/interrupt.h> 252f2f371fSMichal Simek #include <linux/uaccess.h> 262f2f371fSMichal Simek #include <asm/fixmap.h> 272f2f371fSMichal Simek 282f2f371fSMichal Simek extern pte_t *pkmap_page_table; 292f2f371fSMichal Simek 302f2f371fSMichal Simek /* 312f2f371fSMichal Simek * Right now we initialize only a single pte table. It can be extended 322f2f371fSMichal Simek * easily, subsequent pte tables have to be allocated in one physical 332f2f371fSMichal Simek * chunk of RAM. 342f2f371fSMichal Simek */ 352f2f371fSMichal Simek /* 362f2f371fSMichal Simek * We use one full pte table with 4K pages. And with 16K/64K/256K pages pte 372f2f371fSMichal Simek * table covers enough memory (32MB/512MB/2GB resp.), so that both FIXMAP 382f2f371fSMichal Simek * and PKMAP can be placed in a single pte table. We use 512 pages for PKMAP 392f2f371fSMichal Simek * in case of 16K/64K/256K page sizes. 402f2f371fSMichal Simek */ 412f2f371fSMichal Simek 422f2f371fSMichal Simek #define PKMAP_ORDER PTE_SHIFT 432f2f371fSMichal Simek #define LAST_PKMAP (1 << PKMAP_ORDER) 442f2f371fSMichal Simek 452f2f371fSMichal Simek #define PKMAP_BASE ((FIXADDR_START - PAGE_SIZE * (LAST_PKMAP + 1)) \ 462f2f371fSMichal Simek & PMD_MASK) 472f2f371fSMichal Simek 482f2f371fSMichal Simek #define LAST_PKMAP_MASK (LAST_PKMAP - 1) 492f2f371fSMichal Simek #define PKMAP_NR(virt) ((virt - PKMAP_BASE) >> PAGE_SHIFT) 502f2f371fSMichal Simek #define PKMAP_ADDR(nr) (PKMAP_BASE + ((nr) << PAGE_SHIFT)) 512f2f371fSMichal Simek 522f2f371fSMichal Simek #define flush_cache_kmaps() { flush_icache(); flush_dcache(); } 532f2f371fSMichal Simek 54*7ac1b26bSThomas Gleixner #define arch_kmap_local_post_map(vaddr, pteval) \ 55*7ac1b26bSThomas Gleixner local_flush_tlb_page(NULL, vaddr); 56*7ac1b26bSThomas Gleixner #define arch_kmap_local_post_unmap(vaddr) \ 57*7ac1b26bSThomas Gleixner local_flush_tlb_page(NULL, vaddr); 58*7ac1b26bSThomas Gleixner 592f2f371fSMichal Simek #endif /* __KERNEL__ */ 602f2f371fSMichal Simek 612f2f371fSMichal Simek #endif /* _ASM_HIGHMEM_H */ 62