powerepc/book3s64/hash: Align start/end address correctly with bolt mapping
[linux-2.6-microblaze.git] / arch / powerpc / mm / book3s64 / radix_pgtable.c
index c5bf2ef..5c8adeb 100644 (file)
@@ -276,6 +276,7 @@ static int __meminit create_physical_mapping(unsigned long start,
        int psize;
 
        start = ALIGN(start, PAGE_SIZE);
+       end   = ALIGN_DOWN(end, PAGE_SIZE);
        for (addr = start; addr < end; addr += mapping_size) {
                unsigned long gap, previous_size;
                int rc;
@@ -593,8 +594,10 @@ void setup_kuep(bool disabled)
        if (disabled || !early_radix_enabled())
                return;
 
-       if (smp_processor_id() == boot_cpuid)
+       if (smp_processor_id() == boot_cpuid) {
                pr_info("Activating Kernel Userspace Execution Prevention\n");
+               cur_cpu_spec->mmu_features |= MMU_FTR_KUEP;
+       }
 
        /*
         * Radix always uses key0 of the IAMR to determine if an access is
@@ -618,6 +621,10 @@ void setup_kuap(bool disabled)
 
        /* Make sure userspace can't change the AMR */
        mtspr(SPRN_UAMOR, 0);
+
+       /*
+        * Set the default kernel AMR values on all cpus.
+        */
        mtspr(SPRN_AMR, AMR_KUAP_BLOCKED);
        isync();
 }
@@ -728,21 +735,6 @@ void radix__mmu_cleanup_all(void)
        }
 }
 
-void radix__setup_initial_memory_limit(phys_addr_t first_memblock_base,
-                               phys_addr_t first_memblock_size)
-{
-       /*
-        * We don't currently support the first MEMBLOCK not mapping 0
-        * physical on those processors
-        */
-       BUG_ON(first_memblock_base != 0);
-
-       /*
-        * Radix mode is not limited by RMA / VRMA addressing.
-        */
-       ppc64_rma_size = ULONG_MAX;
-}
-
 #ifdef CONFIG_MEMORY_HOTPLUG
 static void free_pte_table(pte_t *pte_start, pmd_t *pmd)
 {
@@ -817,7 +809,7 @@ static void remove_pte_table(pte_t *pte_start, unsigned long addr,
        }
 }
 
-static void remove_pmd_table(pmd_t *pmd_start, unsigned long addr,
+static void __meminit remove_pmd_table(pmd_t *pmd_start, unsigned long addr,
                             unsigned long end)
 {
        unsigned long next;
@@ -847,7 +839,7 @@ static void remove_pmd_table(pmd_t *pmd_start, unsigned long addr,
        }
 }
 
-static void remove_pud_table(pud_t *pud_start, unsigned long addr,
+static void __meminit remove_pud_table(pud_t *pud_start, unsigned long addr,
                             unsigned long end)
 {
        unsigned long next;