@@ -208,6 +208,7 @@ extern int mmu_vmemmap_psize;
/* MMU initialization */
void mmu_early_init_devtree(void);
+void mmu_early_init_type(void);
void hash__early_init_devtree(void);
void radix__early_init_devtree(void);
#ifdef CONFIG_PPC_PKEY
@@ -384,6 +384,7 @@ extern void early_init_mmu_secondary(void);
extern void setup_initial_memory_limit(phys_addr_t first_memblock_base,
phys_addr_t first_memblock_size);
static inline void mmu_early_init_devtree(void) { }
+static inline void mmu_early_init_type(void) { }
static inline void pkey_early_init_devtree(void) {}
@@ -853,6 +853,22 @@ void __init early_init_devtree(void *params)
if (PHYSICAL_START > MEMORY_START)
memblock_reserve(MEMORY_START, int_vector_size);
reserve_kdump_trampoline();
+
+ DBG("Scanning CPUs ...\n");
+
+ dt_cpu_ftrs_scan();
+
+ /* Retrieve CPU related informations from the flat tree
+ * (altivec support, boot CPU ID, ...)
+ */
+ of_scan_flat_dt(early_init_dt_scan_cpus, NULL);
+ if (boot_cpuid < 0) {
+ printk("Failed to identify boot CPU !\n");
+ BUG();
+ }
+
+ mmu_early_init_type();
+
#if defined(CONFIG_FA_DUMP) || defined(CONFIG_PRESERVE_FA_DUMP)
/*
* If we fail to reserve memory for firmware-assisted dump then
@@ -884,19 +900,6 @@ void __init early_init_devtree(void *params)
* FIXME .. and the initrd too? */
move_device_tree();
- DBG("Scanning CPUs ...\n");
-
- dt_cpu_ftrs_scan();
-
- /* Retrieve CPU related informations from the flat tree
- * (altivec support, boot CPU ID, ...)
- */
- of_scan_flat_dt(early_init_dt_scan_cpus, NULL);
- if (boot_cpuid < 0) {
- printk("Failed to identify boot CPU !\n");
- BUG();
- }
-
save_fscr_to_task();
#if defined(CONFIG_SMP) && defined(CONFIG_PPC64)
@@ -614,7 +614,8 @@ static void __init early_init_memory_block_size(void)
of_scan_flat_dt(probe_memory_block_size, &memory_block_size);
}
-void __init mmu_early_init_devtree(void)
+
+void __init mmu_early_init_type(void)
{
bool hvmode = !!(mfmsr() & MSR_HV);
@@ -626,6 +627,20 @@ void __init mmu_early_init_devtree(void)
pr_warn("WARNING: Ignoring cmdline option disable_radix\n");
}
+ /*
+ * Check /chosen/ibm,architecture-vec-5 if running as a guest.
+ * When running bare-metal, we can use radix if we like
+ * even though the ibm,architecture-vec-5 property created by
+ * skiboot doesn't have the necessary bits set.
+ */
+ if (!hvmode)
+ early_check_vec5();
+}
+
+void __init mmu_early_init_devtree(void)
+{
+ bool hvmode = !!(mfmsr() & MSR_HV);
+
of_scan_flat_dt(dt_scan_mmu_pid_width, NULL);
if (hvmode && !mmu_lpid_bits) {
if (early_cpu_has_feature(CPU_FTR_ARCH_207S))
@@ -638,15 +653,6 @@ void __init mmu_early_init_devtree(void)
mmu_pid_bits = 20; /* POWER9-10 */
}
- /*
- * Check /chosen/ibm,architecture-vec-5 if running as a guest.
- * When running bare-metal, we can use radix if we like
- * even though the ibm,architecture-vec-5 property created by
- * skiboot doesn't have the necessary bits set.
- */
- if (!hvmode)
- early_check_vec5();
-
early_init_memory_block_size();
if (early_radix_enabled()) {