OSDN Git Service

Merge tag 'powerpc-5.9-1' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc...
[uclinux-h8/linux.git] / arch / powerpc / mm / book3s64 / hash_utils.c
index 9b9f92a..1478fce 100644 (file)
@@ -232,8 +232,6 @@ unsigned long htab_convert_pte_flags(unsigned long pteflags)
                rflags |= HPTE_R_I;
        else if ((pteflags & _PAGE_CACHE_CTL) == _PAGE_NON_IDEMPOTENT)
                rflags |= (HPTE_R_I | HPTE_R_G);
-       else if ((pteflags & _PAGE_CACHE_CTL) == _PAGE_SAO)
-               rflags |= (HPTE_R_W | HPTE_R_I | HPTE_R_M);
        else
                /*
                 * Add memory coherence if cache inhibited is not set
@@ -596,7 +594,7 @@ static void __init htab_scan_page_sizes(void)
        }
 
 #ifdef CONFIG_HUGETLB_PAGE
-       if (!hugetlb_disabled) {
+       if (!hugetlb_disabled && !early_radix_enabled() ) {
                /* Reserve 16G huge page memory sections for huge pages */
                of_scan_flat_dt(htab_dt_scan_hugepage_blocks, NULL);
        }
@@ -663,11 +661,10 @@ static void __init htab_init_page_sizes(void)
                 * Pick a size for the linear mapping. Currently, we only
                 * support 16M, 1M and 4K which is the default
                 */
-               if (IS_ENABLED(STRICT_KERNEL_RWX) &&
+               if (IS_ENABLED(CONFIG_STRICT_KERNEL_RWX) &&
                    (unsigned long)_stext % 0x1000000) {
                        if (mmu_psize_defs[MMU_PAGE_16M].shift)
-                               pr_warn("Kernel not 16M aligned, "
-                                       "disabling 16M linear map alignment");
+                               pr_warn("Kernel not 16M aligned, disabling 16M linear map alignment\n");
                        aligned = false;
                }
 
@@ -788,7 +785,7 @@ static unsigned long __init htab_get_table_size(void)
 }
 
 #ifdef CONFIG_MEMORY_HOTPLUG
-int resize_hpt_for_hotplug(unsigned long new_mem_size)
+static int resize_hpt_for_hotplug(unsigned long new_mem_size)
 {
        unsigned target_hpt_shift;
 
@@ -822,6 +819,8 @@ int hash__create_section_mapping(unsigned long start, unsigned long end,
                return -1;
        }
 
+       resize_hpt_for_hotplug(memblock_phys_mem_size());
+
        rc = htab_bolt_mapping(start, end, __pa(start),
                               pgprot_val(prot), mmu_linear_psize,
                               mmu_kernel_ssize);
@@ -839,6 +838,10 @@ int hash__remove_section_mapping(unsigned long start, unsigned long end)
        int rc = htab_remove_mapping(start, end, mmu_linear_psize,
                                     mmu_kernel_ssize);
        WARN_ON(rc < 0);
+
+       if (resize_hpt_for_hotplug(memblock_phys_mem_size()) == -ENOSPC)
+               pr_warn("Hash collision while resizing HPT\n");
+
        return rc;
 }
 #endif /* CONFIG_MEMORY_HOTPLUG */
@@ -1111,6 +1114,10 @@ void hash__early_init_mmu_secondary(void)
        if (cpu_has_feature(CPU_FTR_ARCH_206)
                        && cpu_has_feature(CPU_FTR_HVMODE))
                tlbiel_all();
+
+#ifdef CONFIG_PPC_MEM_KEYS
+       mtspr(SPRN_UAMOR, default_uamor);
+#endif
 }
 #endif /* CONFIG_SMP */
 
@@ -1731,10 +1738,6 @@ unsigned long pte_get_hash_gslot(unsigned long vpn, unsigned long shift,
        return gslot;
 }
 
-/*
- * WARNING: This is called from hash_low_64.S, if you change this prototype,
- *          do not forget to update the assembly call site !
- */
 void flush_hash_page(unsigned long vpn, real_pte_t pte, int psize, int ssize,
                     unsigned long flags)
 {