Blame view

arch/arm/include/asm/highmem.h 2.03 KB
d73cd4289   Nicolas Pitre   [ARM] kmap support
1
2
3
4
5
6
7
8
9
10
11
12
  #ifndef _ASM_HIGHMEM_H
  #define _ASM_HIGHMEM_H
  
  #include <asm/kmap_types.h>
  
  #define PKMAP_BASE		(PAGE_OFFSET - PMD_SIZE)
  #define LAST_PKMAP		PTRS_PER_PTE
  #define LAST_PKMAP_MASK		(LAST_PKMAP - 1)
  #define PKMAP_NR(virt)		(((virt) - PKMAP_BASE) >> PAGE_SHIFT)
  #define PKMAP_ADDR(nr)		(PKMAP_BASE + ((nr) << PAGE_SHIFT))
  
  #define kmap_prot		PAGE_KERNEL
7e5a69e83   Nicolas Pitre   ARM: 6007/1: fix ...
13
14
15
16
17
  #define flush_cache_kmaps() \
  	do { \
  		if (cache_is_vivt()) \
  			flush_cache_all(); \
  	} while (0)
d73cd4289   Nicolas Pitre   [ARM] kmap support
18
19
  
  extern pte_t *pkmap_page_table;
aaa50048f   Nicolas Pitre   ARM: 6639/1: allo...
20
21
22
23
24
25
26
27
28
29
30
31
32
33
  extern void *kmap_high(struct page *page);
  extern void kunmap_high(struct page *page);
  
  /*
   * The reason for kmap_high_get() is to ensure that the currently kmap'd
   * page usage count does not decrease to zero while we're using its
   * existing virtual mapping in an atomic context.  With a VIVT cache this
   * is essential to do, but with a VIPT cache this is only an optimization
   * so not to pay the price of establishing a second mapping if an existing
   * one can be used.  However, on platforms without hardware TLB maintenance
   * broadcast, we simply cannot use ARCH_NEEDS_KMAP_HIGH_GET at all since
   * the locking involved must also disable IRQs which is incompatible with
   * the IPI mechanism used by global TLB operations.
   */
43377453a   Nicolas Pitre   [ARM] introduce d...
34
  #define ARCH_NEEDS_KMAP_HIGH_GET
aaa50048f   Nicolas Pitre   ARM: 6639/1: allo...
35
36
37
38
39
40
  #if defined(CONFIG_SMP) && defined(CONFIG_CPU_TLB_V6)
  #undef ARCH_NEEDS_KMAP_HIGH_GET
  #if defined(CONFIG_HIGHMEM) && defined(CONFIG_CPU_CACHE_VIVT)
  #error "The sum of features in your kernel config cannot be supported together"
  #endif
  #endif
43377453a   Nicolas Pitre   [ARM] introduce d...
41

aaa50048f   Nicolas Pitre   ARM: 6639/1: allo...
42
  #ifdef ARCH_NEEDS_KMAP_HIGH_GET
43377453a   Nicolas Pitre   [ARM] introduce d...
43
  extern void *kmap_high_get(struct page *page);
aaa50048f   Nicolas Pitre   ARM: 6639/1: allo...
44
45
46
47
48
49
  #else
  static inline void *kmap_high_get(struct page *page)
  {
  	return NULL;
  }
  #endif
d73cd4289   Nicolas Pitre   [ARM] kmap support
50

7e5a69e83   Nicolas Pitre   ARM: 6007/1: fix ...
51
52
53
54
55
  /*
   * The following functions are already defined by <linux/highmem.h>
   * when CONFIG_HIGHMEM is not set.
   */
  #ifdef CONFIG_HIGHMEM
d73cd4289   Nicolas Pitre   [ARM] kmap support
56
57
  extern void *kmap(struct page *page);
  extern void kunmap(struct page *page);
3e4d3af50   Peter Zijlstra   mm: stack based k...
58
59
60
  extern void *__kmap_atomic(struct page *page);
  extern void __kunmap_atomic(void *kvaddr);
  extern void *kmap_atomic_pfn(unsigned long pfn);
d73cd4289   Nicolas Pitre   [ARM] kmap support
61
  extern struct page *kmap_atomic_to_page(const void *ptr);
7e5a69e83   Nicolas Pitre   ARM: 6007/1: fix ...
62
  #endif
d73cd4289   Nicolas Pitre   [ARM] kmap support
63
64
  
  #endif