]> Git Repo - linux.git/blobdiff - arch/arm64/mm/mmu.c
Merge tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux
[linux.git] / arch / arm64 / mm / mmu.c
index af0ebcad3e1f6477aedde2e56f03b16066ae3e14..6dd9369e3ea0e12db81a1d667343ad2b172182e6 100644 (file)
@@ -1337,27 +1337,6 @@ void *__init fixmap_remap_fdt(phys_addr_t dt_phys, int *size, pgprot_t prot)
        return dt_virt;
 }
 
-int __init arch_ioremap_p4d_supported(void)
-{
-       return 0;
-}
-
-int __init arch_ioremap_pud_supported(void)
-{
-       /*
-        * Only 4k granule supports level 1 block mappings.
-        * SW table walks can't handle removal of intermediate entries.
-        */
-       return IS_ENABLED(CONFIG_ARM64_4K_PAGES) &&
-              !IS_ENABLED(CONFIG_PTDUMP_DEBUGFS);
-}
-
-int __init arch_ioremap_pmd_supported(void)
-{
-       /* See arch_ioremap_pud_supported() */
-       return !IS_ENABLED(CONFIG_PTDUMP_DEBUGFS);
-}
-
 int pud_set_huge(pud_t *pudp, phys_addr_t phys, pgprot_t prot)
 {
        pud_t new_pud = pfn_pud(__phys_to_pfn(phys), mk_pud_sect_prot(prot));
@@ -1449,11 +1428,6 @@ int pud_free_pmd_page(pud_t *pudp, unsigned long addr)
        return 1;
 }
 
-int p4d_free_pud_page(p4d_t *p4d, unsigned long addr)
-{
-       return 0;       /* Don't attempt a block mapping */
-}
-
 #ifdef CONFIG_MEMORY_HOTPLUG
 static void __remove_pgd_mapping(pgd_t *pgdir, unsigned long start, u64 size)
 {
@@ -1469,6 +1443,22 @@ static void __remove_pgd_mapping(pgd_t *pgdir, unsigned long start, u64 size)
 struct range arch_get_mappable_range(void)
 {
        struct range mhp_range;
+       u64 start_linear_pa = __pa(_PAGE_OFFSET(vabits_actual));
+       u64 end_linear_pa = __pa(PAGE_END - 1);
+
+       if (IS_ENABLED(CONFIG_RANDOMIZE_BASE)) {
+               /*
+                * Check for a wrap, it is possible because of randomized linear
+                * mapping the start physical address is actually bigger than
+                * the end physical address. In this case set start to zero
+                * because [0, end_linear_pa] range must still be able to cover
+                * all addressable physical addresses.
+                */
+               if (start_linear_pa > end_linear_pa)
+                       start_linear_pa = 0;
+       }
+
+       WARN_ON(start_linear_pa > end_linear_pa);
 
        /*
         * Linear mapping region is the range [PAGE_OFFSET..(PAGE_END - 1)]
@@ -1476,8 +1466,9 @@ struct range arch_get_mappable_range(void)
         * range which can be mapped inside this linear mapping range, must
         * also be derived from its end points.
         */
-       mhp_range.start = __pa(_PAGE_OFFSET(vabits_actual));
-       mhp_range.end =  __pa(PAGE_END - 1);
+       mhp_range.start = start_linear_pa;
+       mhp_range.end =  end_linear_pa;
+
        return mhp_range;
 }
 
This page took 0.035219 seconds and 4 git commands to generate.