highmem.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. #ifndef _ASM_HIGHMEM_H
  2. #define _ASM_HIGHMEM_H
  3. #include <asm/kmap_types.h>
  4. #define PKMAP_BASE (PAGE_OFFSET - PMD_SIZE)
  5. #define LAST_PKMAP PTRS_PER_PTE
  6. #define LAST_PKMAP_MASK (LAST_PKMAP - 1)
  7. #define PKMAP_NR(virt) (((virt) - PKMAP_BASE) >> PAGE_SHIFT)
  8. #define PKMAP_ADDR(nr) (PKMAP_BASE + ((nr) << PAGE_SHIFT))
  9. #define kmap_prot PAGE_KERNEL
  10. #define flush_cache_kmaps() \
  11. do { \
  12. if (cache_is_vivt()) \
  13. flush_cache_all(); \
  14. } while (0)
  15. extern pte_t *pkmap_page_table;
  16. extern pte_t *fixmap_page_table;
  17. extern void *kmap_high(struct page *page);
  18. extern void kunmap_high(struct page *page);
  19. /*
  20. * The reason for kmap_high_get() is to ensure that the currently kmap'd
  21. * page usage count does not decrease to zero while we're using its
  22. * existing virtual mapping in an atomic context. With a VIVT cache this
  23. * is essential to do, but with a VIPT cache this is only an optimization
  24. * so not to pay the price of establishing a second mapping if an existing
  25. * one can be used. However, on platforms without hardware TLB maintenance
  26. * broadcast, we simply cannot use ARCH_NEEDS_KMAP_HIGH_GET at all since
  27. * the locking involved must also disable IRQs which is incompatible with
  28. * the IPI mechanism used by global TLB operations.
  29. */
  30. #define ARCH_NEEDS_KMAP_HIGH_GET
  31. #if defined(CONFIG_SMP) && defined(CONFIG_CPU_TLB_V6)
  32. #undef ARCH_NEEDS_KMAP_HIGH_GET
  33. #if defined(CONFIG_HIGHMEM) && defined(CONFIG_CPU_CACHE_VIVT)
  34. #error "The sum of features in your kernel config cannot be supported together"
  35. #endif
  36. #endif
  37. /*
  38. * Needed to be able to broadcast the TLB invalidation for kmap.
  39. */
  40. #ifdef CONFIG_ARM_ERRATA_798181
  41. #undef ARCH_NEEDS_KMAP_HIGH_GET
  42. #endif
  43. #ifdef ARCH_NEEDS_KMAP_HIGH_GET
  44. extern void *kmap_high_get(struct page *page);
  45. #else
  46. static inline void *kmap_high_get(struct page *page)
  47. {
  48. return NULL;
  49. }
  50. #endif
  51. /*
  52. * The following functions are already defined by <linux/highmem.h>
  53. * when CONFIG_HIGHMEM is not set.
  54. */
  55. #ifdef CONFIG_HIGHMEM
  56. extern void *kmap(struct page *page);
  57. extern void kunmap(struct page *page);
  58. extern void *kmap_atomic(struct page *page);
  59. extern void __kunmap_atomic(void *kvaddr);
  60. extern void *kmap_atomic_pfn(unsigned long pfn);
  61. #endif
  62. #endif