linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: linuxppc-dev@lists.ozlabs.org
Subject: [PATCH 15/38] powerpc/64: Move MMU backend selection out of platform code
Date: Mon, 27 Jun 2016 21:29:13 +1000	[thread overview]
Message-ID: <1467026976-7974-16-git-send-email-benh@kernel.crashing.org> (raw)
In-Reply-To: <1467026976-7974-1-git-send-email-benh@kernel.crashing.org>

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: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---
 arch/powerpc/include/asm/ps3.h          |  2 ++
 arch/powerpc/kernel/prom.c              |  7 +++++++
 arch/powerpc/mm/hash_utils_64.c         |  9 +++++++++
 arch/powerpc/mm/pgtable-radix.c         |  1 +
 arch/powerpc/platforms/cell/setup.c     |  1 -
 arch/powerpc/platforms/maple/setup.c    |  1 -
 arch/powerpc/platforms/pasemi/setup.c   |  2 --
 arch/powerpc/platforms/powermac/setup.c |  4 ----
 arch/powerpc/platforms/powernv/setup.c  |  5 -----
 arch/powerpc/platforms/ps3/setup.c      | 15 +++++++++------
 arch/powerpc/platforms/pseries/setup.c  |  7 -------
 11 files changed, 28 insertions(+), 26 deletions(-)

diff --git a/arch/powerpc/include/asm/ps3.h b/arch/powerpc/include/asm/ps3.h
index a1bc7e7..a19f831 100644
--- a/arch/powerpc/include/asm/ps3.h
+++ b/arch/powerpc/include/asm/ps3.h
@@ -526,4 +526,6 @@ void ps3_sync_irq(int node);
 u32 ps3_get_hw_thread_id(int cpu);
 u64 ps3_get_spe_id(void *arg);
 
+void ps3_early_mm_init(void);
+
 #endif
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index d10e786..5d59f11 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -748,6 +748,13 @@ void __init early_init_devtree(void *params)
 	/* Now try to figure out if we are running on LPAR */
 	of_scan_flat_dt(pseries_probe_fw_features, NULL);
 #endif
+
+#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");
 }
 
diff --git a/arch/powerpc/mm/hash_utils_64.c b/arch/powerpc/mm/hash_utils_64.c
index 2bea864..e4f796f 100644
--- a/arch/powerpc/mm/hash_utils_64.c
+++ b/arch/powerpc/mm/hash_utils_64.c
@@ -58,6 +58,7 @@
 #include <asm/firmware.h>
 #include <asm/tm.h>
 #include <asm/trace.h>
+#include <asm/ps3.h>
 
 #ifdef DEBUG
 #define DBG(fmt...) udbg_printf(fmt)
@@ -886,6 +887,14 @@ void __init hash__early_init_mmu(void)
 	vmemmap = (struct page *)H_VMEMMAP_BASE;
 	ioremap_bot = IOREMAP_BASE;
 
+	/* 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
 	 * of memory. Has to be done before SLB initialization as this is
 	 * currently where the page size encoding is obtained.
diff --git a/arch/powerpc/mm/pgtable-radix.c b/arch/powerpc/mm/pgtable-radix.c
index c939e6e..6624b7b 100644
--- a/arch/powerpc/mm/pgtable-radix.c
+++ b/arch/powerpc/mm/pgtable-radix.c
@@ -339,6 +339,7 @@ void __init radix__early_init_mmu(void)
 
 	radix_init_page_sizes();
 	if (!firmware_has_feature(FW_FEATURE_LPAR)) {
+		radix_init_native();
 		lpcr = mfspr(SPRN_LPCR);
 		mtspr(SPRN_LPCR, lpcr | LPCR_UPRT);
 		radix_init_partition_table();
diff --git a/arch/powerpc/platforms/cell/setup.c b/arch/powerpc/platforms/cell/setup.c
index 36cff28..e342f78 100644
--- a/arch/powerpc/platforms/cell/setup.c
+++ b/arch/powerpc/platforms/cell/setup.c
@@ -261,7 +261,6 @@ static int __init cell_probe(void)
 	    !of_flat_dt_is_compatible(root, "IBM,CPBW-1.0"))
 		return 0;
 
-	hpte_init_native();
 	pm_power_off = rtas_power_off;
 
 	return 1;
diff --git a/arch/powerpc/platforms/maple/setup.c b/arch/powerpc/platforms/maple/setup.c
index 3cd625d..a56828c 100644
--- a/arch/powerpc/platforms/maple/setup.c
+++ b/arch/powerpc/platforms/maple/setup.c
@@ -304,7 +304,6 @@ static int __init maple_probe(void)
 	    !of_flat_dt_is_compatible(root, "Momentum,Apache"))
 		return 0;
 
-	hpte_init_native();
 	pm_power_off = maple_power_off;
 
 	return 1;
diff --git a/arch/powerpc/platforms/pasemi/setup.c b/arch/powerpc/platforms/pasemi/setup.c
index d71b2c7..7605bc6 100644
--- a/arch/powerpc/platforms/pasemi/setup.c
+++ b/arch/powerpc/platforms/pasemi/setup.c
@@ -426,8 +426,6 @@ static int __init pas_probe(void)
 	    !of_flat_dt_is_compatible(root, "pasemi,pwrficient"))
 		return 0;
 
-	hpte_init_native();
-
 	alloc_iobmap_l2();
 
 	return 1;
diff --git a/arch/powerpc/platforms/powermac/setup.c b/arch/powerpc/platforms/powermac/setup.c
index 43d02c2..5801889 100644
--- a/arch/powerpc/platforms/powermac/setup.c
+++ b/arch/powerpc/platforms/powermac/setup.c
@@ -597,10 +597,6 @@ static int __init pmac_probe(void)
 	    !of_flat_dt_is_compatible(root, "MacRISC"))
 		return 0;
 
-#ifdef CONFIG_PPC64
-	hpte_init_native();
-#endif
-
 #ifdef CONFIG_PPC32
 	/* isa_io_base gets set in pmac_pci_init */
 	ISA_DMA_THRESHOLD = ~0L;
diff --git a/arch/powerpc/platforms/powernv/setup.c b/arch/powerpc/platforms/powernv/setup.c
index ee6430b..15e3b8b 100644
--- a/arch/powerpc/platforms/powernv/setup.c
+++ b/arch/powerpc/platforms/powernv/setup.c
@@ -273,11 +273,6 @@ static int __init pnv_probe(void)
 	if (!of_flat_dt_is_compatible(root, "ibm,powernv"))
 		return 0;
 
-	if (IS_ENABLED(CONFIG_PPC_RADIX_MMU) && radix_enabled())
-		radix_init_native();
-	else if (IS_ENABLED(CONFIG_PPC_STD_MMU_64))
-		hpte_init_native();
-
 	if (firmware_has_feature(FW_FEATURE_OPAL))
 		pnv_setup_machdep_opal();
 
diff --git a/arch/powerpc/platforms/ps3/setup.c b/arch/powerpc/platforms/ps3/setup.c
index 799c858..e5ee80d 100644
--- a/arch/powerpc/platforms/ps3/setup.c
+++ b/arch/powerpc/platforms/ps3/setup.c
@@ -226,9 +226,17 @@ static void __init ps3_progress(char *s, unsigned short hex)
 	printk("*** %04x : %s\n", hex, s ? s : "");
 }
 
-static int __init ps3_probe(void)
+void __init ps3_early_mm_init(void)
 {
 	unsigned long htab_size;
+
+	ps3_mm_init();
+	ps3_mm_vas_create(&htab_size);
+	ps3_hpte_init(htab_size);
+}
+
+static int __init ps3_probe(void)
+{
 	unsigned long dt_root;
 
 	DBG(" -> %s:%d\n", __func__, __LINE__);
@@ -237,12 +245,7 @@ static int __init ps3_probe(void)
 	if (!of_flat_dt_is_compatible(dt_root, "sony,ps3"))
 		return 0;
 
-	powerpc_firmware_features |= FW_FEATURE_PS3_POSSIBLE;
-
 	ps3_os_area_save_params();
-	ps3_mm_init();
-	ps3_mm_vas_create(&htab_size);
-	ps3_hpte_init(htab_size);
 	pm_power_off = ps3_power_off;
 
 	DBG(" <- %s:%d\n", __func__, __LINE__);
diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c
index 6dc91a4..a8e33424 100644
--- a/arch/powerpc/platforms/pseries/setup.c
+++ b/arch/powerpc/platforms/pseries/setup.c
@@ -737,13 +737,6 @@ static int __init pSeries_probe(void)
 	    of_flat_dt_is_compatible(root, "IBM,CBEA"))
 		return 0;
 
-	pr_debug("pSeries detected, looking for LPAR capability...\n");
-
-	if (firmware_has_feature(FW_FEATURE_LPAR))
-		hpte_init_lpar();
-	else
-		hpte_init_native();
-
 	pm_power_off = pseries_power_off;
 
 	pr_debug("Machine is%s LPAR !\n",
-- 
2.7.4

  parent reply	other threads:[~2016-06-27 11:30 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-27 11:28 [PATCH 00/38] Reorganize setup code and merge 32 and 64-bit setup_arch() Benjamin Herrenschmidt
2016-06-27 11:28 ` [PATCH 01/38] dt: Add of_device_compatible_match() Benjamin Herrenschmidt
2016-06-27 11:29 ` [PATCH 02/38] drm: Fix broken use of _PAGE_NO_CACHE on powerpc Benjamin Herrenschmidt
2016-06-27 11:29 ` [PATCH 03/38] powerpc/prom_init: PTRRELOC is not needed Benjamin Herrenschmidt
2016-06-27 11:29 ` [PATCH 04/38] powerpc: Make PTRRELOC() 32-bit only Benjamin Herrenschmidt
2016-06-27 11:29 ` [PATCH 05/38] powerpc: Factor do_feature_fixup calls Benjamin Herrenschmidt
2016-06-27 11:29 ` [PATCH 06/38] powerpc: Move 64-bit feature fixup earlier Benjamin Herrenschmidt
2016-06-28 11:05   ` Aneesh Kumar K.V
2016-06-28 11:14     ` Benjamin Herrenschmidt
2016-06-28 11:49       ` Aneesh Kumar K.V
2016-06-28 11:57         ` Benjamin Herrenschmidt
2016-06-27 11:29 ` [PATCH 07/38] powerpc: Move 64-bit memory reserves to setup_arch() Benjamin Herrenschmidt
2016-06-27 11:29 ` [PATCH 08/38] powerpc: Move epapr_paravirt_early_init() to early_init_devtree() Benjamin Herrenschmidt
2016-06-27 11:29 ` [PATCH 09/38] powerpc: Update obsolete comments in setup_32.c about entry conditions Benjamin Herrenschmidt
2016-06-27 11:29 ` [PATCH 10/38] powerpc: Add comment explaining the purpose of setup_kdump_trampoline() Benjamin Herrenschmidt
2016-06-27 11:29 ` [PATCH 11/38] powerpc/dart: Use a cachable DART Benjamin Herrenschmidt
2016-06-27 11:29 ` [PATCH 12/38] powerpc: Move FW feature probing out of pseries probe() Benjamin Herrenschmidt
2016-06-27 11:29 ` [PATCH 13/38] powerpc: Put exception configuration in a common place Benjamin Herrenschmidt
2016-06-29  6:45   ` [PATCH v2 " Benjamin Herrenschmidt
2016-11-11 10:06   ` [PATCH " Anton Blanchard
2016-11-11 11:04     ` Benjamin Herrenschmidt
2016-06-27 11:29 ` [PATCH 14/38] powerpc/pmac: Remove early allocation of the SMU command buffer Benjamin Herrenschmidt
2016-06-27 11:29 ` Benjamin Herrenschmidt [this message]
2016-06-27 11:29 ` [PATCH 16/38] powerpc/pasemi: Remove IOBMAP allocation from platform probe() Benjamin Herrenschmidt
2016-06-27 11:29 ` [PATCH 17/38] powerpc/mm/hash: Don't use machine_is() early during boot Benjamin Herrenschmidt
2016-06-27 11:29 ` [PATCH 18/38] powerpc/rtas: Don't test for machine type in rtas_initialize() Benjamin Herrenschmidt
2016-06-27 11:29 ` [PATCH 19/38] powerpc: Don't test for machine type in smp_setup_cpu_maps() Benjamin Herrenschmidt
2016-06-27 11:29 ` [PATCH 20/38] powerpc/mm/hash64: Don't test for machine type to detect HEA special case Benjamin Herrenschmidt
2016-06-27 11:29 ` [PATCH 21/38] powerpc/pmac: Remove spurrious machine type test Benjamin Herrenschmidt
2016-06-27 11:29 ` [PATCH 22/38] powerpc/mm: Move hash table ops to a separate structure Benjamin Herrenschmidt
2016-06-27 11:29 ` [PATCH 23/38] powerpc: Ensure that ppc_md is empty before probing for machine type Benjamin Herrenschmidt
2016-06-27 11:29 ` [PATCH 24/38] powerpc: Move 64-bit probe_machine() to later in the boot process Benjamin Herrenschmidt
2016-06-27 11:29 ` [PATCH 25/38] powerpc/cell: Don't use flat device-tree after boot Benjamin Herrenschmidt
2016-06-27 11:29 ` [PATCH 26/38] powerpc/85xx/ge_imp3a: Don't use the " Benjamin Herrenschmidt
2016-06-27 11:29 ` [PATCH 27/38] powerpc/85xx/mpc85xx_ds: " Benjamin Herrenschmidt
2016-06-27 11:29 ` [PATCH 28/38] powerpc/85xx/mpc85xx_rdb: " Benjamin Herrenschmidt
2016-06-27 11:29 ` [PATCH 29/38] powerpc: Move 32-bit probe() machine to later in the boot process Benjamin Herrenschmidt
2016-06-27 20:42   ` Gerhard Pircher
2016-06-27 21:40     ` Benjamin Herrenschmidt
2016-06-28 11:42       ` Gerhard Pircher
2016-06-28 12:01         ` Benjamin Herrenschmidt
2016-06-28 13:25           ` Gerhard Pircher
2016-06-28 22:05             ` Benjamin Herrenschmidt
2016-06-27 11:29 ` [PATCH 30/38] powerpc: Get rid of ppc_md.init_early() Benjamin Herrenschmidt
2016-06-27 11:29 ` [PATCH 31/38] powerpc/64: Move the boot time info banner to a separate function Benjamin Herrenschmidt
2016-06-27 11:29 ` [PATCH 32/38] powerpc/64: Move setting of {i, d}cache_bsize to initialize_cache_info() Benjamin Herrenschmidt
2016-06-27 11:29 ` [PATCH 33/38] powerpc/64: Move the content of setup_system() to setup_arch() Benjamin Herrenschmidt
2016-06-27 11:29 ` [PATCH 34/38] powerpc/32: Move cache info inits to a separate function Benjamin Herrenschmidt
2016-06-27 11:29 ` [PATCH 35/38] powerpc: Re-order the call to smp_setup_cpu_maps() Benjamin Herrenschmidt
2016-06-27 11:29 ` [PATCH 36/38] powerpc: Re-order setup_panic() Benjamin Herrenschmidt
2016-06-27 11:29 ` [PATCH 37/38] powerpc/64: Make a few boot functions __init Benjamin Herrenschmidt
2016-06-27 11:29 ` [PATCH 38/38] powerpc: Merge 32-bit and 64-bit setup_arch() Benjamin Herrenschmidt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1467026976-7974-16-git-send-email-benh@kernel.crashing.org \
    --to=benh@kernel.crashing.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).