1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * Copyright (C) 2015 Synopsys, Inc. (www.synopsys.com)
11 #include <uapi/asm/page.h>
12 #include <asm/kmap_types.h>
14 /* start after vmalloc area */
15 #define FIXMAP_BASE (PAGE_OFFSET - FIXMAP_SIZE - PKMAP_SIZE)
16 #define FIXMAP_SIZE PGDIR_SIZE /* only 1 PGD worth */
17 #define KM_TYPE_NR ((FIXMAP_SIZE >> PAGE_SHIFT)/NR_CPUS)
18 #define FIXMAP_ADDR(nr) (FIXMAP_BASE + ((nr) << PAGE_SHIFT))
20 /* start after fixmap area */
21 #define PKMAP_BASE (FIXMAP_BASE + FIXMAP_SIZE)
22 #define PKMAP_SIZE PGDIR_SIZE
23 #define LAST_PKMAP (PKMAP_SIZE >> PAGE_SHIFT)
24 #define LAST_PKMAP_MASK (LAST_PKMAP - 1)
25 #define PKMAP_ADDR(nr) (PKMAP_BASE + ((nr) << PAGE_SHIFT))
26 #define PKMAP_NR(virt) (((virt) - PKMAP_BASE) >> PAGE_SHIFT)
28 #define kmap_prot PAGE_KERNEL
31 #include <asm/cacheflush.h>
33 extern void *kmap(struct page *page);
34 extern void *kmap_high(struct page *page);
35 extern void *kmap_atomic(struct page *page);
36 extern void __kunmap_atomic(void *kvaddr);
37 extern void kunmap_high(struct page *page);
39 extern void kmap_init(void);
41 static inline void flush_cache_kmaps(void)
46 static inline void kunmap(struct page *page)
48 BUG_ON(in_interrupt());
49 if (!PageHighMem(page))