mm.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifdef CONFIG_MMU
  3. #include <linux/list.h>
  4. #include <linux/vmalloc.h>
  5. #include <linux/pgtable.h>
  6. /* the upper-most page table pointer */
  7. extern pmd_t *top_pmd;
  8. extern int icache_size;
  9. /*
  10. * 0xffff8000 to 0xffffffff is reserved for any ARM architecture
  11. * specific hacks for copying pages efficiently, while 0xffff4000
  12. * is reserved for VIPT aliasing flushing by generic code.
  13. *
  14. * Note that we don't allow VIPT aliasing caches with SMP.
  15. */
  16. #define COPYPAGE_MINICACHE 0xffff8000
  17. #define COPYPAGE_V6_FROM 0xffff8000
  18. #define COPYPAGE_V6_TO 0xffffc000
  19. /* PFN alias flushing, for VIPT caches */
  20. #define FLUSH_ALIAS_START 0xffff4000
  21. static inline void set_top_pte(unsigned long va, pte_t pte)
  22. {
  23. pte_t *ptep = pte_offset_kernel(top_pmd, va);
  24. set_pte_ext(ptep, pte, 0);
  25. local_flush_tlb_kernel_page(va);
  26. }
  27. static inline pte_t get_top_pte(unsigned long va)
  28. {
  29. pte_t *ptep = pte_offset_kernel(top_pmd, va);
  30. return *ptep;
  31. }
  32. struct mem_type {
  33. pteval_t prot_pte;
  34. pteval_t prot_pte_s2;
  35. pmdval_t prot_l1;
  36. pmdval_t prot_sect;
  37. unsigned int domain;
  38. };
  39. const struct mem_type *get_mem_type(unsigned int type);
  40. extern void __flush_dcache_page(struct address_space *mapping, struct page *page);
  41. /*
  42. * ARM specific vm_struct->flags bits.
  43. */
  44. /* (super)section-mapped I/O regions used by ioremap()/iounmap() */
  45. #define VM_ARM_SECTION_MAPPING 0x80000000
  46. /* permanent static mappings from iotable_init() */
  47. #define VM_ARM_STATIC_MAPPING 0x40000000
  48. /* empty mapping */
  49. #define VM_ARM_EMPTY_MAPPING 0x20000000
  50. /* mapping type (attributes) for permanent static mappings */
  51. #define VM_ARM_MTYPE(mt) ((mt) << 20)
  52. #define VM_ARM_MTYPE_MASK (0x1f << 20)
  53. struct static_vm {
  54. struct vm_struct vm;
  55. struct list_head list;
  56. };
  57. extern struct list_head static_vmlist;
  58. extern struct static_vm *find_static_vm_vaddr(void *vaddr);
  59. extern __init void add_static_vm_early(struct static_vm *svm);
  60. #endif
  61. #ifdef CONFIG_ZONE_DMA
  62. extern phys_addr_t arm_dma_limit;
  63. extern unsigned long arm_dma_pfn_limit;
  64. #else
  65. #define arm_dma_limit ((phys_addr_t)~0)
  66. #define arm_dma_pfn_limit (~0ul >> PAGE_SHIFT)
  67. #endif
  68. extern phys_addr_t arm_lowmem_limit;
  69. void __init bootmem_init(void);
  70. void arm_mm_memblock_reserve(void);
  71. #ifdef CONFIG_CMA_AREAS
  72. void dma_contiguous_remap(void);
  73. #else
  74. static inline void dma_contiguous_remap(void) { }
  75. #endif
  76. unsigned long __clear_cr(unsigned long mask);