]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
powerpc/64s: remove register_process_table callback
authorNicholas Piggin <npiggin@gmail.com>
Mon, 2 Sep 2019 15:29:26 +0000 (01:29 +1000)
committerMichael Ellerman <mpe@ellerman.id.au>
Thu, 5 Sep 2019 04:22:40 +0000 (14:22 +1000)
This callback is only required because the partition table init comes
before process table allocation on powernv (aka bare metal aka native).

Change the order to allocate the process table first, and remove the
callback.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20190902152931.17840-2-npiggin@gmail.com
arch/powerpc/include/asm/book3s/64/mmu.h
arch/powerpc/mm/book3s64/hash_utils.c
arch/powerpc/mm/book3s64/pgtable.c
arch/powerpc/mm/book3s64/radix_pgtable.c
arch/powerpc/platforms/pseries/lpar.c

index 23b83d3593e2a59f0a041e41cf2d0a8ec7c66d08..bb3deb76c951ba4bcdccf3689b96de5594cdb4d5 100644 (file)
@@ -206,7 +206,6 @@ extern int mmu_io_psize;
 void mmu_early_init_devtree(void);
 void hash__early_init_devtree(void);
 void radix__early_init_devtree(void);
-extern void radix_init_native(void);
 extern void hash__early_init_mmu(void);
 extern void radix__early_init_mmu(void);
 static inline void early_init_mmu(void)
@@ -238,9 +237,6 @@ static inline void setup_initial_memory_limit(phys_addr_t first_memblock_base,
                                           first_memblock_size);
 }
 
-extern int (*register_process_table)(unsigned long base, unsigned long page_size,
-                                    unsigned long tbl_size);
-
 #ifdef CONFIG_PPC_PSERIES
 extern void radix_init_pseries(void);
 #else
index fe99bba39b698cecd50fa4ce849aaad74a224d09..7aed27ea53614b1d277550efb4196feb68462b23 100644 (file)
@@ -859,12 +859,6 @@ static void __init htab_initialize(void)
                /* Using a hypervisor which owns the htab */
                htab_address = NULL;
                _SDR1 = 0; 
-               /*
-                * On POWER9, we need to do a H_REGISTER_PROC_TBL hcall
-                * to inform the hypervisor that we wish to use the HPT.
-                */
-               if (cpu_has_feature(CPU_FTR_ARCH_300))
-                       register_process_table(0, 0, 0);
 #ifdef CONFIG_FA_DUMP
                /*
                 * If firmware assisted dump is active firmware preserves
index 206b43ae4000c4014ba242f4e090113e7f7d3939..97f3be778c79f44736425bfb509363f69f3057ed 100644 (file)
@@ -23,9 +23,6 @@ EXPORT_SYMBOL(__pmd_frag_nr);
 unsigned long __pmd_frag_size_shift;
 EXPORT_SYMBOL(__pmd_frag_size_shift);
 
-int (*register_process_table)(unsigned long base, unsigned long page_size,
-                             unsigned long tbl_size);
-
 #ifdef CONFIG_TRANSPARENT_HUGEPAGE
 /*
  * This is called when relaxing access to a hugepage. It's also called in the page
index 71b6494730453b0bcd7d9c559490b3c905e7f024..83fa7864e8f48012d52e81329e190d963e69638d 100644 (file)
 unsigned int mmu_pid_bits;
 unsigned int mmu_base_pid;
 
-static int native_register_process_table(unsigned long base, unsigned long pg_sz,
-                                        unsigned long table_size)
-{
-       unsigned long patb0, patb1;
-
-       patb0 = be64_to_cpu(partition_tb[0].patb0);
-       patb1 = base | table_size | PATB_GR;
-
-       mmu_partition_table_set_entry(0, patb0, patb1);
-
-       return 0;
-}
-
 static __ref void *early_alloc_pgtable(unsigned long size, int nid,
                        unsigned long region_start, unsigned long region_end)
 {
@@ -381,18 +368,8 @@ static void __init radix_init_pgtable(void)
         */
        rts_field = radix__get_tree_size();
        process_tb->prtb0 = cpu_to_be64(rts_field | __pa(init_mm.pgd) | RADIX_PGD_INDEX_SIZE);
-       /*
-        * Fill in the partition table. We are suppose to use effective address
-        * of process table here. But our linear mapping also enable us to use
-        * physical address here.
-        */
-       register_process_table(__pa(process_tb), 0, PRTB_SIZE_SHIFT - 12);
+
        pr_info("Process table %p and radix root for kernel: %p\n", process_tb, init_mm.pgd);
-       asm volatile("ptesync" : : : "memory");
-       asm volatile(PPC_TLBIE_5(%0,%1,2,1,1) : :
-                    "r" (TLBIEL_INVAL_SET_LPID), "r" (0));
-       asm volatile("eieio; tlbsync; ptesync" : : : "memory");
-       trace_tlbie(0, 0, TLBIEL_INVAL_SET_LPID, 0, 2, 1, 1);
 
        /*
         * The init_mm context is given the first available (non-zero) PID,
@@ -413,22 +390,24 @@ static void __init radix_init_pgtable(void)
 
 static void __init radix_init_partition_table(void)
 {
-       unsigned long rts_field, dw0;
+       unsigned long rts_field, dw0, dw1;
 
        mmu_partition_table_init();
        rts_field = radix__get_tree_size();
        dw0 = rts_field | __pa(init_mm.pgd) | RADIX_PGD_INDEX_SIZE | PATB_HR;
-       mmu_partition_table_set_entry(0, dw0, 0);
+       dw1 = __pa(process_tb) | (PRTB_SIZE_SHIFT - 12) | PATB_GR;
+       mmu_partition_table_set_entry(0, dw0, dw1);
+
+       asm volatile("ptesync" : : : "memory");
+       asm volatile(PPC_TLBIE_5(%0,%1,2,1,1) : :
+                    "r" (TLBIEL_INVAL_SET_LPID), "r" (0));
+       asm volatile("eieio; tlbsync; ptesync" : : : "memory");
+       trace_tlbie(0, 0, TLBIEL_INVAL_SET_LPID, 0, 2, 1, 1);
 
        pr_info("Initializing Radix MMU\n");
        pr_info("Partition table %p\n", partition_tb);
 }
 
-void __init radix_init_native(void)
-{
-       register_process_table = native_register_process_table;
-}
-
 static int __init get_idx_from_shift(unsigned int shift)
 {
        int idx = -1;
@@ -622,8 +601,9 @@ void __init radix__early_init_mmu(void)
        __pmd_frag_nr = RADIX_PMD_FRAG_NR;
        __pmd_frag_size_shift = RADIX_PMD_FRAG_SIZE_SHIFT;
 
+       radix_init_pgtable();
+
        if (!firmware_has_feature(FW_FEATURE_LPAR)) {
-               radix_init_native();
                lpcr = mfspr(SPRN_LPCR);
                mtspr(SPRN_LPCR, lpcr | LPCR_UPRT | LPCR_HR);
                radix_init_partition_table();
@@ -634,7 +614,6 @@ void __init radix__early_init_mmu(void)
 
        memblock_set_current_limit(MEMBLOCK_ALLOC_ANYWHERE);
 
-       radix_init_pgtable();
        /* Switch to the guard PID before turning on MMU */
        radix__switch_mmu_context(NULL, &init_mm);
        if (cpu_has_feature(CPU_FTR_HVMODE))
index 4f76e5f30c971e8ed1040774eca77bbd16c21a61..b3205a6c950c00622cc3d6762ae37cdf1d9b4af9 100644 (file)
@@ -1531,16 +1531,29 @@ void __init hpte_init_pseries(void)
        mmu_hash_ops.flush_hash_range    = pSeries_lpar_flush_hash_range;
        mmu_hash_ops.hpte_clear_all      = pseries_hpte_clear_all;
        mmu_hash_ops.hugepage_invalidate = pSeries_lpar_hugepage_invalidate;
-       register_process_table           = pseries_lpar_register_process_table;
 
        if (firmware_has_feature(FW_FEATURE_HPT_RESIZE))
                mmu_hash_ops.resize_hpt = pseries_lpar_resize_hpt;
+
+       /*
+        * On POWER9, we need to do a H_REGISTER_PROC_TBL hcall
+        * to inform the hypervisor that we wish to use the HPT.
+        */
+       if (cpu_has_feature(CPU_FTR_ARCH_300))
+               pseries_lpar_register_process_table(0, 0, 0);
 }
 
 void radix_init_pseries(void)
 {
        pr_info("Using radix MMU under hypervisor\n");
-       register_process_table = pseries_lpar_register_process_table;
+
+       pseries_lpar_register_process_table(__pa(process_tb),
+                                               0, PRTB_SIZE_SHIFT - 12);
+       asm volatile("ptesync" : : : "memory");
+       asm volatile(PPC_TLBIE_5(%0,%1,2,1,1) : :
+                    "r" (TLBIEL_INVAL_SET_LPID), "r" (0));
+       asm volatile("eieio; tlbsync; ptesync" : : : "memory");
+       trace_tlbie(0, 0, TLBIEL_INVAL_SET_LPID, 0, 2, 1, 1);
 }
 
 #ifdef CONFIG_PPC_SMLPAR