162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 262306a36Sopenharmony_ci/* 362306a36Sopenharmony_ci * highmem.h: virtual kernel memory mappings for high memory 462306a36Sopenharmony_ci * 562306a36Sopenharmony_ci * Used in CONFIG_HIGHMEM systems for memory pages which 662306a36Sopenharmony_ci * are not addressable by direct kernel virtual addresses. 762306a36Sopenharmony_ci * 862306a36Sopenharmony_ci * Copyright (C) 1999 Gerhard Wichert, Siemens AG 962306a36Sopenharmony_ci * Gerhard.Wichert@pdb.siemens.de 1062306a36Sopenharmony_ci * 1162306a36Sopenharmony_ci * 1262306a36Sopenharmony_ci * Redesigned the x86 32-bit VM architecture to deal with 1362306a36Sopenharmony_ci * up to 16 Terabyte physical memory. With current x86 CPUs 1462306a36Sopenharmony_ci * we now support up to 64 Gigabytes physical RAM. 1562306a36Sopenharmony_ci * 1662306a36Sopenharmony_ci * Copyright (C) 1999 Ingo Molnar <mingo@redhat.com> 1762306a36Sopenharmony_ci */ 1862306a36Sopenharmony_ci#ifndef _ASM_HIGHMEM_H 1962306a36Sopenharmony_ci#define _ASM_HIGHMEM_H 2062306a36Sopenharmony_ci 2162306a36Sopenharmony_ci#ifdef __KERNEL__ 2262306a36Sopenharmony_ci 2362306a36Sopenharmony_ci#include <linux/bug.h> 2462306a36Sopenharmony_ci#include <linux/interrupt.h> 2562306a36Sopenharmony_ci#include <linux/uaccess.h> 2662306a36Sopenharmony_ci#include <asm/cpu-features.h> 2762306a36Sopenharmony_ci#include <asm/kmap_size.h> 2862306a36Sopenharmony_ci 2962306a36Sopenharmony_ci/* declarations for highmem.c */ 3062306a36Sopenharmony_ciextern unsigned long highstart_pfn, highend_pfn; 3162306a36Sopenharmony_ci 3262306a36Sopenharmony_ciextern pte_t *pkmap_page_table; 3362306a36Sopenharmony_ci 3462306a36Sopenharmony_ci/* 3562306a36Sopenharmony_ci * Right now we initialize only a single pte table. It can be extended 3662306a36Sopenharmony_ci * easily, subsequent pte tables have to be allocated in one physical 3762306a36Sopenharmony_ci * chunk of RAM. 3862306a36Sopenharmony_ci */ 3962306a36Sopenharmony_ci#if defined(CONFIG_PHYS_ADDR_T_64BIT) || defined(CONFIG_MIPS_HUGE_TLB_SUPPORT) 4062306a36Sopenharmony_ci#define LAST_PKMAP 512 4162306a36Sopenharmony_ci#else 4262306a36Sopenharmony_ci#define LAST_PKMAP 1024 4362306a36Sopenharmony_ci#endif 4462306a36Sopenharmony_ci 4562306a36Sopenharmony_ci#define LAST_PKMAP_MASK (LAST_PKMAP-1) 4662306a36Sopenharmony_ci#define PKMAP_NR(virt) ((virt-PKMAP_BASE) >> PAGE_SHIFT) 4762306a36Sopenharmony_ci#define PKMAP_ADDR(nr) (PKMAP_BASE + ((nr) << PAGE_SHIFT)) 4862306a36Sopenharmony_ci 4962306a36Sopenharmony_ci#define ARCH_HAS_KMAP_FLUSH_TLB 5062306a36Sopenharmony_ciextern void kmap_flush_tlb(unsigned long addr); 5162306a36Sopenharmony_ci 5262306a36Sopenharmony_ci#define flush_cache_kmaps() BUG_ON(cpu_has_dc_aliases) 5362306a36Sopenharmony_ci 5462306a36Sopenharmony_ci#define arch_kmap_local_set_pte(mm, vaddr, ptep, ptev) set_pte(ptep, ptev) 5562306a36Sopenharmony_ci#define arch_kmap_local_post_map(vaddr, pteval) local_flush_tlb_one(vaddr) 5662306a36Sopenharmony_ci#define arch_kmap_local_post_unmap(vaddr) local_flush_tlb_one(vaddr) 5762306a36Sopenharmony_ci 5862306a36Sopenharmony_ci#endif /* __KERNEL__ */ 5962306a36Sopenharmony_ci 6062306a36Sopenharmony_ci#endif /* _ASM_HIGHMEM_H */ 61