highmem.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (C) 2015 Synopsys, Inc. (www.synopsys.com)
  4. */
  5. #ifndef _ASM_HIGHMEM_H
  6. #define _ASM_HIGHMEM_H
  7. #ifdef CONFIG_HIGHMEM
  8. #include <uapi/asm/page.h>
  9. #include <asm/kmap_size.h>
  10. #define FIXMAP_SIZE PGDIR_SIZE
  11. #define PKMAP_SIZE PGDIR_SIZE
  12. /* start after vmalloc area */
  13. #define FIXMAP_BASE (PAGE_OFFSET - FIXMAP_SIZE - PKMAP_SIZE)
  14. #define FIX_KMAP_SLOTS (KM_MAX_IDX * NR_CPUS)
  15. #define FIX_KMAP_BEGIN (0UL)
  16. #define FIX_KMAP_END ((FIX_KMAP_BEGIN + FIX_KMAP_SLOTS) - 1)
  17. #define FIXADDR_TOP (FIXMAP_BASE + (FIX_KMAP_END << PAGE_SHIFT))
  18. /*
  19. * This should be converted to the asm-generic version, but of course this
  20. * is needlessly different from all other architectures. Sigh - tglx
  21. */
  22. #define __fix_to_virt(x) (FIXADDR_TOP - ((x) << PAGE_SHIFT))
  23. #define __virt_to_fix(x) (((FIXADDR_TOP - ((x) & PAGE_MASK))) >> PAGE_SHIFT)
  24. /* start after fixmap area */
  25. #define PKMAP_BASE (FIXMAP_BASE + FIXMAP_SIZE)
  26. #define LAST_PKMAP (PKMAP_SIZE >> PAGE_SHIFT)
  27. #define LAST_PKMAP_MASK (LAST_PKMAP - 1)
  28. #define PKMAP_ADDR(nr) (PKMAP_BASE + ((nr) << PAGE_SHIFT))
  29. #define PKMAP_NR(virt) (((virt) - PKMAP_BASE) >> PAGE_SHIFT)
  30. #include <asm/cacheflush.h>
  31. extern void kmap_init(void);
  32. #define arch_kmap_local_post_unmap(vaddr) \
  33. local_flush_tlb_kernel_range(vaddr, vaddr + PAGE_SIZE)
  34. static inline void flush_cache_kmaps(void)
  35. {
  36. flush_cache_all();
  37. }
  38. #endif
  39. #endif