Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 166dd7d3 authored by Benjamin Herrenschmidt's avatar Benjamin Herrenschmidt Committed by Michael Ellerman
Browse files

powerpc/64: Move MMU backend selection out of platform code



We move it into early_mmu_init() based on firmware features. For PS3,
we have to move the setting of these into early_init_devtree().

Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
parent 91b6fad5
Loading
Loading
Loading
Loading
+2 −0
Original line number Original line Diff line number Diff line
@@ -526,4 +526,6 @@ void ps3_sync_irq(int node);
u32 ps3_get_hw_thread_id(int cpu);
u32 ps3_get_hw_thread_id(int cpu);
u64 ps3_get_spe_id(void *arg);
u64 ps3_get_spe_id(void *arg);


void ps3_early_mm_init(void);

#endif
#endif
+6 −0
Original line number Original line Diff line number Diff line
@@ -759,6 +759,12 @@ void __init early_init_devtree(void *params)
	/* Now try to figure out if we are running on LPAR and so on */
	/* Now try to figure out if we are running on LPAR and so on */
	pseries_probe_fw_features();
	pseries_probe_fw_features();


#ifdef CONFIG_PPC_PS3
	/* Identify PS3 firmware */
	if (of_flat_dt_is_compatible(of_get_flat_dt_root(), "sony,ps3"))
		powerpc_firmware_features |= FW_FEATURE_PS3_POSSIBLE;
#endif

	DBG(" <- early_init_devtree()\n");
	DBG(" <- early_init_devtree()\n");
}
}


+14 −0
Original line number Original line Diff line number Diff line
@@ -58,6 +58,7 @@
#include <asm/firmware.h>
#include <asm/firmware.h>
#include <asm/tm.h>
#include <asm/tm.h>
#include <asm/trace.h>
#include <asm/trace.h>
#include <asm/ps3.h>


#ifdef DEBUG
#ifdef DEBUG
#define DBG(fmt...) udbg_printf(fmt)
#define DBG(fmt...) udbg_printf(fmt)
@@ -872,6 +873,11 @@ static void __init htab_initialize(void)
#undef KB
#undef KB
#undef MB
#undef MB


void __init __weak hpte_init_lpar(void)
{
	panic("FW_FEATURE_LPAR set but no LPAR support compiled\n");
}

void __init hash__early_init_mmu(void)
void __init hash__early_init_mmu(void)
{
{
	/*
	/*
@@ -908,6 +914,14 @@ void __init hash__early_init_mmu(void)
	pci_io_base = ISA_IO_BASE;
	pci_io_base = ISA_IO_BASE;
#endif
#endif


	/* Select appropriate backend */
	if (firmware_has_feature(FW_FEATURE_PS3_LV1))
		ps3_early_mm_init();
	else if (firmware_has_feature(FW_FEATURE_LPAR))
		hpte_init_lpar();
	else
		hpte_init_native();

	/* Initialize the MMU Hash table and create the linear mapping
	/* Initialize the MMU Hash table and create the linear mapping
	 * of memory. Has to be done before SLB initialization as this is
	 * of memory. Has to be done before SLB initialization as this is
	 * currently where the page size encoding is obtained.
	 * currently where the page size encoding is obtained.
+1 −0
Original line number Original line Diff line number Diff line
@@ -345,6 +345,7 @@ void __init radix__early_init_mmu(void)


	radix_init_page_sizes();
	radix_init_page_sizes();
	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();
+0 −1
Original line number Original line Diff line number Diff line
@@ -261,7 +261,6 @@ static int __init cell_probe(void)
	    !of_flat_dt_is_compatible(root, "IBM,CPBW-1.0"))
	    !of_flat_dt_is_compatible(root, "IBM,CPBW-1.0"))
		return 0;
		return 0;


	hpte_init_native();
	pm_power_off = rtas_power_off;
	pm_power_off = rtas_power_off;


	return 1;
	return 1;
Loading