mm.h 2.4 KB

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