Commit ed6546bd authored by Nicholas Piggin's avatar Nicholas Piggin Committed by Michael Ellerman

powerpc/64s: remove register_process_table callback

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: default avatarNicholas Piggin <npiggin@gmail.com>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20190902152931.17840-2-npiggin@gmail.com
parent 85d86c8a
...@@ -206,7 +206,6 @@ extern int mmu_io_psize; ...@@ -206,7 +206,6 @@ extern int mmu_io_psize;
void mmu_early_init_devtree(void); void mmu_early_init_devtree(void);
void hash__early_init_devtree(void); void hash__early_init_devtree(void);
void radix__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 hash__early_init_mmu(void);
extern void radix__early_init_mmu(void); extern void radix__early_init_mmu(void);
static inline void 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, ...@@ -238,9 +237,6 @@ static inline void setup_initial_memory_limit(phys_addr_t first_memblock_base,
first_memblock_size); first_memblock_size);
} }
extern int (*register_process_table)(unsigned long base, unsigned long page_size,
unsigned long tbl_size);
#ifdef CONFIG_PPC_PSERIES #ifdef CONFIG_PPC_PSERIES
extern void radix_init_pseries(void); extern void radix_init_pseries(void);
#else #else
......
...@@ -859,12 +859,6 @@ static void __init htab_initialize(void) ...@@ -859,12 +859,6 @@ static void __init htab_initialize(void)
/* Using a hypervisor which owns the htab */ /* Using a hypervisor which owns the htab */
htab_address = NULL; htab_address = NULL;
_SDR1 = 0; _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 #ifdef CONFIG_FA_DUMP
/* /*
* If firmware assisted dump is active firmware preserves * If firmware assisted dump is active firmware preserves
......
...@@ -23,9 +23,6 @@ EXPORT_SYMBOL(__pmd_frag_nr); ...@@ -23,9 +23,6 @@ EXPORT_SYMBOL(__pmd_frag_nr);
unsigned long __pmd_frag_size_shift; unsigned long __pmd_frag_size_shift;
EXPORT_SYMBOL(__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 #ifdef CONFIG_TRANSPARENT_HUGEPAGE
/* /*
* This is called when relaxing access to a hugepage. It's also called in the page * This is called when relaxing access to a hugepage. It's also called in the page
......
...@@ -34,19 +34,6 @@ ...@@ -34,19 +34,6 @@
unsigned int mmu_pid_bits; unsigned int mmu_pid_bits;
unsigned int mmu_base_pid; 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, static __ref void *early_alloc_pgtable(unsigned long size, int nid,
unsigned long region_start, unsigned long region_end) unsigned long region_start, unsigned long region_end)
{ {
...@@ -381,18 +368,8 @@ static void __init radix_init_pgtable(void) ...@@ -381,18 +368,8 @@ static void __init radix_init_pgtable(void)
*/ */
rts_field = radix__get_tree_size(); rts_field = radix__get_tree_size();
process_tb->prtb0 = cpu_to_be64(rts_field | __pa(init_mm.pgd) | RADIX_PGD_INDEX_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); 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, * The init_mm context is given the first available (non-zero) PID,
...@@ -413,22 +390,24 @@ static void __init radix_init_pgtable(void) ...@@ -413,22 +390,24 @@ static void __init radix_init_pgtable(void)
static void __init radix_init_partition_table(void) static void __init radix_init_partition_table(void)
{ {
unsigned long rts_field, dw0; unsigned long rts_field, dw0, dw1;
mmu_partition_table_init(); mmu_partition_table_init();
rts_field = radix__get_tree_size(); rts_field = radix__get_tree_size();
dw0 = rts_field | __pa(init_mm.pgd) | RADIX_PGD_INDEX_SIZE | PATB_HR; 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("Initializing Radix MMU\n");
pr_info("Partition table %p\n", partition_tb); 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) static int __init get_idx_from_shift(unsigned int shift)
{ {
int idx = -1; int idx = -1;
...@@ -622,8 +601,9 @@ void __init radix__early_init_mmu(void) ...@@ -622,8 +601,9 @@ void __init radix__early_init_mmu(void)
__pmd_frag_nr = RADIX_PMD_FRAG_NR; __pmd_frag_nr = RADIX_PMD_FRAG_NR;
__pmd_frag_size_shift = RADIX_PMD_FRAG_SIZE_SHIFT; __pmd_frag_size_shift = RADIX_PMD_FRAG_SIZE_SHIFT;
radix_init_pgtable();
if (!firmware_has_feature(FW_FEATURE_LPAR)) { if (!firmware_has_feature(FW_FEATURE_LPAR)) {
radix_init_native();
lpcr = mfspr(SPRN_LPCR); lpcr = mfspr(SPRN_LPCR);
mtspr(SPRN_LPCR, lpcr | LPCR_UPRT | LPCR_HR); mtspr(SPRN_LPCR, lpcr | LPCR_UPRT | LPCR_HR);
radix_init_partition_table(); radix_init_partition_table();
...@@ -634,7 +614,6 @@ void __init radix__early_init_mmu(void) ...@@ -634,7 +614,6 @@ void __init radix__early_init_mmu(void)
memblock_set_current_limit(MEMBLOCK_ALLOC_ANYWHERE); memblock_set_current_limit(MEMBLOCK_ALLOC_ANYWHERE);
radix_init_pgtable();
/* Switch to the guard PID before turning on MMU */ /* Switch to the guard PID before turning on MMU */
radix__switch_mmu_context(NULL, &init_mm); radix__switch_mmu_context(NULL, &init_mm);
if (cpu_has_feature(CPU_FTR_HVMODE)) if (cpu_has_feature(CPU_FTR_HVMODE))
......
...@@ -1531,16 +1531,29 @@ void __init hpte_init_pseries(void) ...@@ -1531,16 +1531,29 @@ void __init hpte_init_pseries(void)
mmu_hash_ops.flush_hash_range = pSeries_lpar_flush_hash_range; mmu_hash_ops.flush_hash_range = pSeries_lpar_flush_hash_range;
mmu_hash_ops.hpte_clear_all = pseries_hpte_clear_all; mmu_hash_ops.hpte_clear_all = pseries_hpte_clear_all;
mmu_hash_ops.hugepage_invalidate = pSeries_lpar_hugepage_invalidate; 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)) if (firmware_has_feature(FW_FEATURE_HPT_RESIZE))
mmu_hash_ops.resize_hpt = pseries_lpar_resize_hpt; 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) void radix_init_pseries(void)
{ {
pr_info("Using radix MMU under hypervisor\n"); 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 #ifdef CONFIG_PPC_SMLPAR
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment