1 /* SPDX-License-Identifier: GPL-2.0 */ 2 /* 3 * highmem.h: virtual kernel memory mappings for high memory 4 * 5 * Used in CONFIG_HIGHMEM systems for memory pages which 6 * are not addressable by direct kernel virtual addresses. 7 * 8 * Copyright (C) 2025 Loongson Technology Corporation Limited 9 */ 10 #ifndef _ASM_HIGHMEM_H 11 #define _ASM_HIGHMEM_H 12 13 #ifdef __KERNEL__ 14 15 #include <asm/kmap_size.h> 16 17 #ifndef __ASSEMBLER__ 18 19 extern pte_t *pkmap_page_table; 20 21 #define ARCH_HAS_KMAP_FLUSH_TLB 22 void kmap_flush_tlb(unsigned long addr); 23 24 #endif /* !__ASSEMBLER__ */ 25 26 /* 27 * Right now we initialize only a single pte table. It can be extended 28 * easily, subsequent pte tables have to be allocated in one physical 29 * chunk of RAM. 30 */ 31 #define LAST_PKMAP 1024 32 #define LAST_PKMAP_MASK (LAST_PKMAP - 1) 33 #define PKMAP_NR(virt) ((virt - PKMAP_BASE) >> PAGE_SHIFT) 34 #define PKMAP_ADDR(nr) (PKMAP_BASE + ((nr) << PAGE_SHIFT)) 35 36 #define flush_cache_kmaps() do {} while (0) 37 38 #define arch_kmap_local_post_map(vaddr, pteval) local_flush_tlb_one(vaddr) 39 #define arch_kmap_local_post_unmap(vaddr) local_flush_tlb_one(vaddr) 40 41 #endif /* __KERNEL__ */ 42 43 #endif /* _ASM_HIGHMEM_H */ 44