linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/11] powerpc: Unconfuse htab_bolt_mapping() callers
@ 2006-03-21  9:45 Michael Ellerman
  2006-03-21  9:45 ` [PATCH 3/11] powerpc: trivial: Cleanup whitespace in cputable.h Michael Ellerman
                   ` (9 more replies)
  0 siblings, 10 replies; 19+ messages in thread
From: Michael Ellerman @ 2006-03-21  9:45 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: linuxppc-dev

htab_bolt_mapping() takes a vstart and pstart parameter, but all but one of
its callers actually pass it vstart and vstart. Luckily before it passes
paddr (calculated from paddr) to the hpte_insert routines it calls
virt_to_abs() (aka. __pa()) on the address, so there isn't actually a bug.

map_io_page() however does pass pstart properly, so currently it's broken
AFAICT because we're calling __pa(paddr) which will get us something very
large. Presumably no one's calling map_io_page() in the right context.

Anyway, change htab_bolt_mapping() callers to properly pass pstart, and then
use it properly in htab_bolt_mapping(), ie. don't call __pa() on it again.

Booted on p5 LPAR, iSeries and Power3.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
---

 arch/powerpc/mm/hash_utils_64.c |   27 ++++++++++++++-------------
 1 files changed, 14 insertions(+), 13 deletions(-)

Index: to-merge/arch/powerpc/mm/hash_utils_64.c
===================================================================
--- to-merge.orig/arch/powerpc/mm/hash_utils_64.c
+++ to-merge/arch/powerpc/mm/hash_utils_64.c
@@ -169,7 +169,7 @@ int htab_bolt_mapping(unsigned long vsta
 #ifdef CONFIG_PPC_ISERIES
 		if (_machine == PLATFORM_ISERIES_LPAR)
 			ret = iSeries_hpte_insert(hpteg, va,
-						  __pa(vaddr),
+						  paddr,
 						  tmp_mode,
 						  HPTE_V_BOLTED,
 						  psize);
@@ -178,7 +178,7 @@ int htab_bolt_mapping(unsigned long vsta
 #ifdef CONFIG_PPC_PSERIES
 		if (_machine & PLATFORM_LPAR)
 			ret = pSeries_lpar_hpte_insert(hpteg, va,
-						       virt_to_abs(paddr),
+						       paddr,
 						       tmp_mode,
 						       HPTE_V_BOLTED,
 						       psize);
@@ -186,7 +186,7 @@ int htab_bolt_mapping(unsigned long vsta
 #endif
 #ifdef CONFIG_PPC_MULTIPLATFORM
 			ret = native_hpte_insert(hpteg, va,
-						 virt_to_abs(paddr),
+						 paddr,
 						 tmp_mode, HPTE_V_BOLTED,
 						 psize);
 #endif
@@ -392,7 +392,7 @@ static unsigned long __init htab_get_tab
 #ifdef CONFIG_MEMORY_HOTPLUG
 void create_section_mapping(unsigned long start, unsigned long end)
 {
-		BUG_ON(htab_bolt_mapping(start, end, start,
+		BUG_ON(htab_bolt_mapping(start, end, __pa(start),
 			_PAGE_ACCESSED | _PAGE_DIRTY | _PAGE_COHERENT | PP_RWXX,
 			mmu_linear_psize));
 }
@@ -473,21 +473,22 @@ void __init htab_initialize(void)
 
 		if (dart_tablebase != 0 && dart_tablebase >= base
 		    && dart_tablebase < (base + size)) {
+			unsigned long dart_table_end = dart_tablebase + 16 * MB;
 			if (base != dart_tablebase)
 				BUG_ON(htab_bolt_mapping(base, dart_tablebase,
-							 base, mode_rw,
-							 mmu_linear_psize));
-			if ((base + size) > (dart_tablebase + 16*MB))
+							__pa(base), mode_rw,
+							mmu_linear_psize));
+			if ((base + size) > dart_table_end)
 				BUG_ON(htab_bolt_mapping(dart_tablebase+16*MB,
-							 base + size,
-							 dart_tablebase+16*MB,
+							base + size,
+							__pa(dart_table_end),
 							 mode_rw,
 							 mmu_linear_psize));
 			continue;
 		}
 #endif /* CONFIG_U3_DART */
-		BUG_ON(htab_bolt_mapping(base, base + size, base,
-					 mode_rw, mmu_linear_psize));
+		BUG_ON(htab_bolt_mapping(base, base + size, __pa(base),
+					mode_rw, mmu_linear_psize));
        }
 
 	/*
@@ -504,8 +505,8 @@ void __init htab_initialize(void)
 		if (base + size >= tce_alloc_start)
 			tce_alloc_start = base + size + 1;
 
- 		BUG_ON(htab_bolt_mapping(tce_alloc_start, tce_alloc_end,
- 					 tce_alloc_start, mode_rw,
+		BUG_ON(htab_bolt_mapping(tce_alloc_start, tce_alloc_end,
+					 __pa(tce_alloc_start), mode_rw,
 					 mmu_linear_psize));
 	}
 

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [PATCH 2/11] powerpc: Remove unused iommu_off logic from pSeries_init_early()
  2006-03-21  9:45 [PATCH 1/11] powerpc: Unconfuse htab_bolt_mapping() callers Michael Ellerman
  2006-03-21  9:45 ` [PATCH 3/11] powerpc: trivial: Cleanup whitespace in cputable.h Michael Ellerman
@ 2006-03-21  9:45 ` Michael Ellerman
  2006-03-21 16:15   ` Olof Johansson
  2006-03-21  9:45 ` [PATCH 4/11] powerpc: Replace platform_is_lpar() with a firmware feature Michael Ellerman
                   ` (7 subsequent siblings)
  9 siblings, 1 reply; 19+ messages in thread
From: Michael Ellerman @ 2006-03-21  9:45 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: linuxppc-dev

When iommu_init_early_pSeries() was added, ages ago, we forgot to remove
the code that checks /chosen/linux,iommu-off in pSeries_init_early(). We
do it now in iommu_init_early_pSeries().

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
---

 arch/powerpc/platforms/pseries/setup.c |    7 +------
 1 files changed, 1 insertion(+), 6 deletions(-)

Index: to-merge/arch/powerpc/platforms/pseries/setup.c
===================================================================
--- to-merge.orig/arch/powerpc/platforms/pseries/setup.c
+++ to-merge/arch/powerpc/platforms/pseries/setup.c
@@ -320,19 +320,14 @@ static int pseries_set_xdabr(unsigned lo
  */
 static void __init pSeries_init_early(void)
 {
-	int iommu_off = 0;
-
 	DBG(" -> pSeries_init_early()\n");
 
 	fw_feature_init();
 	
 	if (platform_is_lpar())
 		hpte_init_lpar();
-	else {
+	else
 		hpte_init_native();
-		iommu_off = (of_chosen &&
-			     get_property(of_chosen, "linux,iommu-off", NULL));
-	}
 
 	if (platform_is_lpar())
 		find_udbg_vterm();

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [PATCH 3/11] powerpc: trivial: Cleanup whitespace in cputable.h
  2006-03-21  9:45 [PATCH 1/11] powerpc: Unconfuse htab_bolt_mapping() callers Michael Ellerman
@ 2006-03-21  9:45 ` Michael Ellerman
  2006-03-21  9:45 ` [PATCH 2/11] powerpc: Remove unused iommu_off logic from pSeries_init_early() Michael Ellerman
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 19+ messages in thread
From: Michael Ellerman @ 2006-03-21  9:45 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: linuxppc-dev

Remove redundant whitespace in include/asm-powerpc/cputable.h

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
---

 include/asm-powerpc/cputable.h |   34 +++++++++++++++++-----------------
 1 files changed, 17 insertions(+), 17 deletions(-)

Index: to-merge/include/asm-powerpc/cputable.h
===================================================================
--- to-merge.orig/include/asm-powerpc/cputable.h
+++ to-merge/include/asm-powerpc/cputable.h
@@ -102,19 +102,19 @@ extern void do_cpu_ftr_fixups(unsigned l
 #define CPU_FTR_NEED_COHERENT		ASM_CONST(0x0000000000020000)
 #define CPU_FTR_NO_BTIC			ASM_CONST(0x0000000000040000)
 #define CPU_FTR_BIG_PHYS		ASM_CONST(0x0000000000080000)
-#define CPU_FTR_NODSISRALIGN  		ASM_CONST(0x0000000000100000)
+#define CPU_FTR_NODSISRALIGN		ASM_CONST(0x0000000000100000)
 
 #ifdef __powerpc64__
 /* Add the 64b processor unique features in the top half of the word */
-#define CPU_FTR_SLB           		ASM_CONST(0x0000000100000000)
-#define CPU_FTR_16M_PAGE      		ASM_CONST(0x0000000200000000)
-#define CPU_FTR_TLBIEL         		ASM_CONST(0x0000000400000000)
-#define CPU_FTR_NOEXECUTE     		ASM_CONST(0x0000000800000000)
-#define CPU_FTR_IABR  			ASM_CONST(0x0000002000000000)
-#define CPU_FTR_MMCRA  			ASM_CONST(0x0000004000000000)
+#define CPU_FTR_SLB			ASM_CONST(0x0000000100000000)
+#define CPU_FTR_16M_PAGE		ASM_CONST(0x0000000200000000)
+#define CPU_FTR_TLBIEL			ASM_CONST(0x0000000400000000)
+#define CPU_FTR_NOEXECUTE		ASM_CONST(0x0000000800000000)
+#define CPU_FTR_IABR			ASM_CONST(0x0000002000000000)
+#define CPU_FTR_MMCRA			ASM_CONST(0x0000004000000000)
 #define CPU_FTR_CTRL			ASM_CONST(0x0000008000000000)
-#define CPU_FTR_SMT  			ASM_CONST(0x0000010000000000)
-#define CPU_FTR_COHERENT_ICACHE  	ASM_CONST(0x0000020000000000)
+#define CPU_FTR_SMT			ASM_CONST(0x0000010000000000)
+#define CPU_FTR_COHERENT_ICACHE		ASM_CONST(0x0000020000000000)
 #define CPU_FTR_LOCKLESS_TLBIE		ASM_CONST(0x0000040000000000)
 #define CPU_FTR_MMCRA_SIHV		ASM_CONST(0x0000080000000000)
 #define CPU_FTR_CI_LARGE_PAGE		ASM_CONST(0x0000100000000000)
@@ -123,15 +123,15 @@ extern void do_cpu_ftr_fixups(unsigned l
 #else
 /* ensure on 32b processors the flags are available for compiling but
  * don't do anything */
-#define CPU_FTR_SLB           		ASM_CONST(0x0)
-#define CPU_FTR_16M_PAGE      		ASM_CONST(0x0)
-#define CPU_FTR_TLBIEL         		ASM_CONST(0x0)
-#define CPU_FTR_NOEXECUTE     		ASM_CONST(0x0)
-#define CPU_FTR_IABR  			ASM_CONST(0x0)
-#define CPU_FTR_MMCRA  			ASM_CONST(0x0)
+#define CPU_FTR_SLB			ASM_CONST(0x0)
+#define CPU_FTR_16M_PAGE		ASM_CONST(0x0)
+#define CPU_FTR_TLBIEL			ASM_CONST(0x0)
+#define CPU_FTR_NOEXECUTE		ASM_CONST(0x0)
+#define CPU_FTR_IABR			ASM_CONST(0x0)
+#define CPU_FTR_MMCRA			ASM_CONST(0x0)
 #define CPU_FTR_CTRL			ASM_CONST(0x0)
-#define CPU_FTR_SMT  			ASM_CONST(0x0)
-#define CPU_FTR_COHERENT_ICACHE  	ASM_CONST(0x0)
+#define CPU_FTR_SMT			ASM_CONST(0x0)
+#define CPU_FTR_COHERENT_ICACHE		ASM_CONST(0x0)
 #define CPU_FTR_LOCKLESS_TLBIE		ASM_CONST(0x0)
 #define CPU_FTR_MMCRA_SIHV		ASM_CONST(0x0)
 #define CPU_FTR_CI_LARGE_PAGE		ASM_CONST(0x0)

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [PATCH 4/11] powerpc: Replace platform_is_lpar() with a firmware feature
  2006-03-21  9:45 [PATCH 1/11] powerpc: Unconfuse htab_bolt_mapping() callers Michael Ellerman
  2006-03-21  9:45 ` [PATCH 3/11] powerpc: trivial: Cleanup whitespace in cputable.h Michael Ellerman
  2006-03-21  9:45 ` [PATCH 2/11] powerpc: Remove unused iommu_off logic from pSeries_init_early() Michael Ellerman
@ 2006-03-21  9:45 ` Michael Ellerman
  2006-03-22  0:35   ` Stephen Rothwell
  2006-03-21  9:46 ` [PATCH 5/11] powerpc: iseries: mf related cleanups Michael Ellerman
                   ` (6 subsequent siblings)
  9 siblings, 1 reply; 19+ messages in thread
From: Michael Ellerman @ 2006-03-21  9:45 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: linuxppc-dev

It has been decreed that platform numbers are evil, so as a step in that
direction, replace platform_is_lpar() with a FW_FEATURE_LPAR bit.

Currently FW_FEATURE_LPAR really means i/pSeries LPAR, in the future we might
have to clean that up if we need to be more specific about what LPAR actually
means. But that's another patch ...

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
---

 arch/powerpc/mm/hash_utils_64.c         |    4 ++--
 arch/powerpc/oprofile/op_model_power4.c |    3 ++-
 arch/powerpc/platforms/iseries/setup.c  |   10 +++++++---
 arch/powerpc/platforms/pseries/iommu.c  |    2 +-
 arch/powerpc/platforms/pseries/setup.c  |   11 +++++++----
 arch/powerpc/platforms/pseries/smp.c    |    2 +-
 arch/powerpc/platforms/pseries/xics.c   |    3 ++-
 include/asm-powerpc/firmware.h          |    7 ++++---
 include/asm-powerpc/processor.h         |    1 -
 9 files changed, 26 insertions(+), 17 deletions(-)

Index: to-merge/arch/powerpc/mm/hash_utils_64.c
===================================================================
--- to-merge.orig/arch/powerpc/mm/hash_utils_64.c
+++ to-merge/arch/powerpc/mm/hash_utils_64.c
@@ -422,7 +422,7 @@ void __init htab_initialize(void)
 
 	htab_hash_mask = pteg_count - 1;
 
-	if (platform_is_lpar()) {
+	if (firmware_has_feature(FW_FEATURE_LPAR)) {
 		/* Using a hypervisor which owns the htab */
 		htab_address = NULL;
 		_SDR1 = 0; 
@@ -517,7 +517,7 @@ void __init htab_initialize(void)
 
 void htab_initialize_secondary(void)
 {
-	if (!platform_is_lpar())
+	if (!firmware_has_feature(FW_FEATURE_LPAR))
 		mtspr(SPRN_SDR1, _SDR1);
 }
 
Index: to-merge/arch/powerpc/oprofile/op_model_power4.c
===================================================================
--- to-merge.orig/arch/powerpc/oprofile/op_model_power4.c
+++ to-merge/arch/powerpc/oprofile/op_model_power4.c
@@ -10,6 +10,7 @@
 #include <linux/oprofile.h>
 #include <linux/init.h>
 #include <linux/smp.h>
+#include <asm/firmware.h>
 #include <asm/ptrace.h>
 #include <asm/system.h>
 #include <asm/processor.h>
@@ -232,7 +233,7 @@ static unsigned long get_pc(struct pt_re
 	mmcra = mfspr(SPRN_MMCRA);
 
 	/* Were we in the hypervisor? */
-	if (platform_is_lpar() && (mmcra & MMCRA_SIHV))
+	if (firmware_has_feature(FW_FEATURE_LPAR) && (mmcra & MMCRA_SIHV))
 		/* function descriptor madness */
 		return *((unsigned long *)hypervisor_bucket);
 
Index: to-merge/arch/powerpc/platforms/iseries/setup.c
===================================================================
--- to-merge.orig/arch/powerpc/platforms/iseries/setup.c
+++ to-merge/arch/powerpc/platforms/iseries/setup.c
@@ -303,8 +303,6 @@ static void __init iSeries_init_early(vo
 {
 	DBG(" -> iSeries_init_early()\n");
 
-	ppc64_firmware_features = FW_FEATURE_ISERIES;
-
 	ppc64_interrupt_controller = IC_ISERIES;
 
 #if defined(CONFIG_BLK_DEV_INITRD)
@@ -711,7 +709,13 @@ void __init iSeries_init_IRQ(void) { }
 
 static int __init iseries_probe(int platform)
 {
-	return PLATFORM_ISERIES_LPAR == platform;
+	if (PLATFORM_ISERIES_LPAR != platform)
+		return 0;
+
+	ppc64_firmware_features |= FW_FEATURE_ISERIES;
+	ppc64_firmware_features |= FW_FEATURE_LPAR;
+
+	return 1;
 }
 
 struct machdep_calls __initdata iseries_md = {
Index: to-merge/arch/powerpc/platforms/pseries/iommu.c
===================================================================
--- to-merge.orig/arch/powerpc/platforms/pseries/iommu.c
+++ to-merge/arch/powerpc/platforms/pseries/iommu.c
@@ -580,7 +580,7 @@ void iommu_init_early_pSeries(void)
 		return;
 	}
 
-	if (platform_is_lpar()) {
+	if (firmware_has_feature(FW_FEATURE_LPAR)) {
 		if (firmware_has_feature(FW_FEATURE_MULTITCE)) {
 			ppc_md.tce_build = tce_buildmulti_pSeriesLP;
 			ppc_md.tce_free	 = tce_freemulti_pSeriesLP;
Index: to-merge/arch/powerpc/platforms/pseries/setup.c
===================================================================
--- to-merge.orig/arch/powerpc/platforms/pseries/setup.c
+++ to-merge/arch/powerpc/platforms/pseries/setup.c
@@ -246,7 +246,7 @@ static void __init pSeries_setup_arch(vo
 		ppc_md.idle_loop = default_idle;
 	}
 
-	if (platform_is_lpar())
+	if (firmware_has_feature(FW_FEATURE_LPAR))
 		ppc_md.enable_pmcs = pseries_lpar_enable_pmcs;
 	else
 		ppc_md.enable_pmcs = power4_enable_pmcs;
@@ -324,12 +324,12 @@ static void __init pSeries_init_early(vo
 
 	fw_feature_init();
 	
-	if (platform_is_lpar())
+	if (firmware_has_feature(FW_FEATURE_LPAR))
 		hpte_init_lpar();
 	else
 		hpte_init_native();
 
-	if (platform_is_lpar())
+	if (firmware_has_feature(FW_FEATURE_LPAR))
 		find_udbg_vterm();
 
 	if (firmware_has_feature(FW_FEATURE_DABR))
@@ -385,6 +385,9 @@ static int __init pSeries_probe(int plat
 	 * it here ...
 	 */
 
+	if (platform == PLATFORM_PSERIES_LPAR)
+		ppc64_firmware_features |= FW_FEATURE_LPAR;
+
 	return 1;
 }
 
@@ -524,7 +527,7 @@ static void pseries_shared_idle(void)
 
 static int pSeries_pci_probe_mode(struct pci_bus *bus)
 {
-	if (platform_is_lpar())
+	if (firmware_has_feature(FW_FEATURE_LPAR))
 		return PCI_PROBE_DEVTREE;
 	return PCI_PROBE_NORMAL;
 }
Index: to-merge/arch/powerpc/platforms/pseries/smp.c
===================================================================
--- to-merge.orig/arch/powerpc/platforms/pseries/smp.c
+++ to-merge/arch/powerpc/platforms/pseries/smp.c
@@ -443,7 +443,7 @@ void __init smp_init_pSeries(void)
 	smp_ops->cpu_die = pSeries_cpu_die;
 
 	/* Processors can be added/removed only on LPAR */
-	if (platform_is_lpar())
+	if (firmware_has_feature(FW_FEATURE_LPAR))
 		pSeries_reconfig_notifier_register(&pSeries_smp_nb);
 #endif
 
Index: to-merge/arch/powerpc/platforms/pseries/xics.c
===================================================================
--- to-merge.orig/arch/powerpc/platforms/pseries/xics.c
+++ to-merge/arch/powerpc/platforms/pseries/xics.c
@@ -20,6 +20,7 @@
 #include <linux/gfp.h>
 #include <linux/radix-tree.h>
 #include <linux/cpu.h>
+#include <asm/firmware.h>
 #include <asm/prom.h>
 #include <asm/io.h>
 #include <asm/pgtable.h>
@@ -536,7 +537,7 @@ nextnode:
 		of_node_put(np);
 	}
 
-	if (platform_is_lpar())
+	if (firmware_has_feature(FW_FEATURE_LPAR))
 		ops = &pSeriesLP_ops;
 	else {
 #ifdef CONFIG_SMP
Index: to-merge/include/asm-powerpc/firmware.h
===================================================================
--- to-merge.orig/include/asm-powerpc/firmware.h
+++ to-merge/include/asm-powerpc/firmware.h
@@ -41,6 +41,7 @@
 #define FW_FEATURE_MULTITCE	(1UL<<19)
 #define FW_FEATURE_SPLPAR	(1UL<<20)
 #define FW_FEATURE_ISERIES	(1UL<<21)
+#define FW_FEATURE_LPAR		(1UL<<22)
 
 enum {
 #ifdef CONFIG_PPC64
@@ -51,10 +52,10 @@ enum {
 		FW_FEATURE_MIGRATE | FW_FEATURE_PERFMON | FW_FEATURE_CRQ |
 		FW_FEATURE_VIO | FW_FEATURE_RDMA | FW_FEATURE_LLAN |
 		FW_FEATURE_BULK | FW_FEATURE_XDABR | FW_FEATURE_MULTITCE |
-		FW_FEATURE_SPLPAR,
+		FW_FEATURE_SPLPAR | FW_FEATURE_LPAR,
 	FW_FEATURE_PSERIES_ALWAYS = 0,
-	FW_FEATURE_ISERIES_POSSIBLE = FW_FEATURE_ISERIES,
-	FW_FEATURE_ISERIES_ALWAYS = FW_FEATURE_ISERIES,
+	FW_FEATURE_ISERIES_POSSIBLE = FW_FEATURE_ISERIES | FW_FEATURE_LPAR,
+	FW_FEATURE_ISERIES_ALWAYS = FW_FEATURE_ISERIES | FW_FEATURE_LPAR,
 	FW_FEATURE_POSSIBLE =
 #ifdef CONFIG_PPC_PSERIES
 		FW_FEATURE_PSERIES_POSSIBLE |
Index: to-merge/include/asm-powerpc/processor.h
===================================================================
--- to-merge.orig/include/asm-powerpc/processor.h
+++ to-merge/include/asm-powerpc/processor.h
@@ -52,7 +52,6 @@
 #ifdef __KERNEL__
 #define platform_is_pseries()	(_machine == PLATFORM_PSERIES || \
 				 _machine == PLATFORM_PSERIES_LPAR)
-#define platform_is_lpar()	(!!(_machine & PLATFORM_LPAR))
 
 #if defined(CONFIG_PPC_MULTIPLATFORM)
 extern int _machine;

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [PATCH 5/11] powerpc: iseries: mf related cleanups
  2006-03-21  9:45 [PATCH 1/11] powerpc: Unconfuse htab_bolt_mapping() callers Michael Ellerman
                   ` (2 preceding siblings ...)
  2006-03-21  9:45 ` [PATCH 4/11] powerpc: Replace platform_is_lpar() with a firmware feature Michael Ellerman
@ 2006-03-21  9:46 ` Michael Ellerman
  2006-03-22  0:39   ` Stephen Rothwell
  2006-03-21  9:46 ` [PATCH 6/11] powerpc: iseries: Remove pointless iSeries_(restart|power_off|halt) Michael Ellerman
                   ` (5 subsequent siblings)
  9 siblings, 1 reply; 19+ messages in thread
From: Michael Ellerman @ 2006-03-21  9:46 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: linuxppc-dev

Some cleanups in the iSeries code.
 - Make mf_display_progress() check mf_initialized rather than the caller.
 - Set mf_initialized in mf_init() rather than in setup.c
 - Then move mf_initialized into mf.c, the only place it's used.
 - Move the mf related logic from iSeries_progress() to mf_display_progress()
 - Use a #define to size the pending_event_prealloc array
 - Use that define in the initialsation loop rather than sizeof jiggery pokery
 - Remove stupid comment(s)
 - Mark stuff static and/or __init

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
---

 arch/powerpc/platforms/iseries/mf.c    |   32 +++++++++++++++++++++++---------
 arch/powerpc/platforms/iseries/setup.c |   11 +----------
 include/asm-powerpc/iseries/mf.h       |    1 -
 3 files changed, 24 insertions(+), 20 deletions(-)

Index: to-merge/arch/powerpc/platforms/iseries/mf.c
===================================================================
--- to-merge.orig/arch/powerpc/platforms/iseries/mf.c
+++ to-merge/arch/powerpc/platforms/iseries/mf.c
@@ -46,6 +46,7 @@
 #include "setup.h"
 
 extern int piranha_simulator;
+static int mf_initialized = 0;
 
 /*
  * This is the structure layout for the Machine Facilites LPAR event
@@ -143,7 +144,8 @@ static spinlock_t pending_event_spinlock
 static struct pending_event *pending_event_head;
 static struct pending_event *pending_event_tail;
 static struct pending_event *pending_event_avail;
-static struct pending_event pending_event_prealloc[16];
+#define PENDING_EVENT_PREALLOC_LEN 16
+static struct pending_event pending_event_prealloc[PENDING_EVENT_PREALLOC_LEN];
 
 /*
  * Put a pending event onto the available queue, so it can get reused.
@@ -625,7 +627,7 @@ void mf_display_src(u32 word)
 /*
  * Display a single word SRC of the form "PROGXXXX" on the VSP control panel.
  */
-void mf_display_progress(u16 value)
+static __init void mf_display_progress_src(u16 value)
 {
 	u8 ce[12];
 	u8 src[72];
@@ -649,30 +651,42 @@ void mf_display_progress(u16 value)
  * Clear the VSP control panel.  Used to "erase" an SRC that was
  * previously displayed.
  */
-void mf_clear_src(void)
+static void mf_clear_src(void)
 {
 	signal_ce_msg_simple(0x4b, NULL);
 }
 
+void __init mf_display_progress(u16 value)
+{
+	if (piranha_simulator || !mf_initialized)
+		return;
+
+	if (0xFFFF == value)
+		mf_clear_src();
+	else
+		mf_display_progress_src(value);
+}
+
 /*
  * Initialization code here.
  */
-void mf_init(void)
+void __init mf_init(void)
 {
 	int i;
 
-	/* initialize */
 	spin_lock_init(&pending_event_spinlock);
-	for (i = 0;
-	     i < sizeof(pending_event_prealloc) / sizeof(*pending_event_prealloc);
-	     ++i)
+
+	for (i = 0; i < PENDING_EVENT_PREALLOC_LEN; i++)
 		free_pending_event(&pending_event_prealloc[i]);
+
 	HvLpEvent_registerHandler(HvLpEvent_Type_MachineFac, &hv_handler);
 
 	/* virtual continue ack */
 	signal_ce_msg_simple(0x57, NULL);
 
-	/* initialization complete */
+	mf_initialized = 1;
+	mb();
+
 	printk(KERN_NOTICE "mf.c: iSeries Linux LPAR Machine Facilities "
 			"initialized\n");
 }
Index: to-merge/arch/powerpc/platforms/iseries/setup.c
===================================================================
--- to-merge.orig/arch/powerpc/platforms/iseries/setup.c
+++ to-merge/arch/powerpc/platforms/iseries/setup.c
@@ -89,8 +89,6 @@ extern unsigned long embedded_sysmap_end
 extern unsigned long iSeries_recal_tb;
 extern unsigned long iSeries_recal_titan;
 
-static int mf_initialized;
-
 static unsigned long cmd_mem_limit;
 
 struct MemoryBlock {
@@ -347,8 +345,6 @@ static void __init iSeries_init_early(vo
 	HvCallEvent_setLpEventQueueInterruptProc(0, 0);
 
 	mf_init();
-	mf_initialized = 1;
-	mb();
 
 	/* If we were passed an initrd, set the ROOT_DEV properly if the values
 	 * look sensible. If not, clear initrd reference.
@@ -585,12 +581,7 @@ static void iSeries_halt(void)
 static void __init iSeries_progress(char * st, unsigned short code)
 {
 	printk("Progress: [%04x] - %s\n", (unsigned)code, st);
-	if (!piranha_simulator && mf_initialized) {
-		if (code != 0xffff)
-			mf_display_progress(code);
-		else
-			mf_clear_src();
-	}
+	mf_display_progress(code);
 }
 
 static void __init iSeries_fixup_klimit(void)
Index: to-merge/include/asm-powerpc/iseries/mf.h
===================================================================
--- to-merge.orig/include/asm-powerpc/iseries/mf.h
+++ to-merge/include/asm-powerpc/iseries/mf.h
@@ -45,7 +45,6 @@ extern void mf_reboot(void);
 
 extern void mf_display_src(u32 word);
 extern void mf_display_progress(u16 value);
-extern void mf_clear_src(void);
 
 extern void mf_init(void);
 

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [PATCH 6/11] powerpc: iseries: Remove pointless iSeries_(restart|power_off|halt)
  2006-03-21  9:45 [PATCH 1/11] powerpc: Unconfuse htab_bolt_mapping() callers Michael Ellerman
                   ` (3 preceding siblings ...)
  2006-03-21  9:46 ` [PATCH 5/11] powerpc: iseries: mf related cleanups Michael Ellerman
@ 2006-03-21  9:46 ` Michael Ellerman
  2006-03-21  9:46 ` [PATCH 7/11] powerpc: iseries: Make more stuff static in platforms/iseries/mf.c Michael Ellerman
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 19+ messages in thread
From: Michael Ellerman @ 2006-03-21  9:46 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: linuxppc-dev

These routines just call through to the mf routines, so point ppc_md straight
at the mf routines. We need to pass the cmd through to mf_reboot to make it
work, but that seems reasonable.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
---

 arch/powerpc/platforms/iseries/mf.c    |    2 +-
 arch/powerpc/platforms/iseries/setup.c |   30 +++---------------------------
 include/asm-powerpc/iseries/mf.h       |    2 +-
 3 files changed, 5 insertions(+), 29 deletions(-)

Index: to-merge/arch/powerpc/platforms/iseries/mf.c
===================================================================
--- to-merge.orig/arch/powerpc/platforms/iseries/mf.c
+++ to-merge/arch/powerpc/platforms/iseries/mf.c
@@ -599,7 +599,7 @@ void mf_power_off(void)
  * Global kernel interface to tell the VSP object in the primary
  * partition to reboot this partition.
  */
-void mf_reboot(void)
+void mf_reboot(char *cmd)
 {
 	printk(KERN_INFO "mf.c: Preparing to bounce...\n");
 	signal_ce_msg_simple(0x4e, NULL);
Index: to-merge/arch/powerpc/platforms/iseries/setup.c
===================================================================
--- to-merge.orig/arch/powerpc/platforms/iseries/setup.c
+++ to-merge/arch/powerpc/platforms/iseries/setup.c
@@ -554,30 +554,6 @@ static void iSeries_show_cpuinfo(struct 
 	seq_printf(m, "machine\t\t: 64-bit iSeries Logical Partition\n");
 }
 
-/*
- * Document me.
- */
-static void iSeries_restart(char *cmd)
-{
-	mf_reboot();
-}
-
-/*
- * Document me.
- */
-static void iSeries_power_off(void)
-{
-	mf_power_off();
-}
-
-/*
- * Document me.
- */
-static void iSeries_halt(void)
-{
-	mf_power_off();
-}
-
 static void __init iSeries_progress(char * st, unsigned short code)
 {
 	printk("Progress: [%04x] - %s\n", (unsigned)code, st);
@@ -716,9 +692,9 @@ struct machdep_calls __initdata iseries_
 	.get_irq	= iSeries_get_irq,
 	.init_early	= iSeries_init_early,
 	.pcibios_fixup	= iSeries_pci_final_fixup,
-	.restart	= iSeries_restart,
-	.power_off	= iSeries_power_off,
-	.halt		= iSeries_halt,
+	.restart	= mf_reboot,
+	.power_off	= mf_power_off,
+	.halt		= mf_power_off,
 	.get_boot_time	= iSeries_get_boot_time,
 	.set_rtc_time	= iSeries_set_rtc_time,
 	.get_rtc_time	= iSeries_get_rtc_time,
Index: to-merge/include/asm-powerpc/iseries/mf.h
===================================================================
--- to-merge.orig/include/asm-powerpc/iseries/mf.h
+++ to-merge/include/asm-powerpc/iseries/mf.h
@@ -41,7 +41,7 @@ extern void mf_deallocate_lp_events(HvLp
 		unsigned count, MFCompleteHandler hdlr, void *userToken);
 
 extern void mf_power_off(void);
-extern void mf_reboot(void);
+extern void mf_reboot(char *cmd);
 
 extern void mf_display_src(u32 word);
 extern void mf_display_progress(u16 value);

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [PATCH 7/11] powerpc: iseries: Make more stuff static in platforms/iseries/mf.c
  2006-03-21  9:45 [PATCH 1/11] powerpc: Unconfuse htab_bolt_mapping() callers Michael Ellerman
                   ` (4 preceding siblings ...)
  2006-03-21  9:46 ` [PATCH 6/11] powerpc: iseries: Remove pointless iSeries_(restart|power_off|halt) Michael Ellerman
@ 2006-03-21  9:46 ` Michael Ellerman
  2006-03-21  9:46 ` [PATCH 8/11] powerpc: Add strne2a() to convert a string from EBCDIC to ASCII Michael Ellerman
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 19+ messages in thread
From: Michael Ellerman @ 2006-03-21  9:46 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: linuxppc-dev

Make mf_get_rtc(), mf_get_boot_rtc() and mf_set_rtc() static, cause they can
be. We need to move mf_set_rtc() to avoid a forward declaration.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
---

 arch/powerpc/platforms/iseries/mf.c |   78 ++++++++++++++++++------------------
 include/asm-powerpc/iseries/mf.h    |    4 -
 2 files changed, 39 insertions(+), 43 deletions(-)

Index: to-merge/arch/powerpc/platforms/iseries/mf.c
===================================================================
--- to-merge.orig/arch/powerpc/platforms/iseries/mf.c
+++ to-merge/arch/powerpc/platforms/iseries/mf.c
@@ -706,6 +706,43 @@ static void get_rtc_time_complete(void *
 	complete(&rtc->com);
 }
 
+static int mf_set_rtc(struct rtc_time *tm)
+{
+	char ce_time[12];
+	u8 day, mon, hour, min, sec, y1, y2;
+	unsigned year;
+
+	year = 1900 + tm->tm_year;
+	y1 = year / 100;
+	y2 = year % 100;
+
+	sec = tm->tm_sec;
+	min = tm->tm_min;
+	hour = tm->tm_hour;
+	day = tm->tm_mday;
+	mon = tm->tm_mon + 1;
+
+	BIN_TO_BCD(sec);
+	BIN_TO_BCD(min);
+	BIN_TO_BCD(hour);
+	BIN_TO_BCD(mon);
+	BIN_TO_BCD(day);
+	BIN_TO_BCD(y1);
+	BIN_TO_BCD(y2);
+
+	memset(ce_time, 0, sizeof(ce_time));
+	ce_time[3] = 0x41;
+	ce_time[4] = y1;
+	ce_time[5] = y2;
+	ce_time[6] = sec;
+	ce_time[7] = min;
+	ce_time[8] = hour;
+	ce_time[10] = day;
+	ce_time[11] = mon;
+
+	return signal_ce_msg(ce_time, NULL);
+}
+
 static int rtc_set_tm(int rc, u8 *ce_msg, struct rtc_time *tm)
 {
 	tm->tm_wday = 0;
@@ -761,7 +798,7 @@ static int rtc_set_tm(int rc, u8 *ce_msg
 	return 0;
 }
 
-int mf_get_rtc(struct rtc_time *tm)
+static int mf_get_rtc(struct rtc_time *tm)
 {
 	struct ce_msg_comp_data ce_complete;
 	struct rtc_time_data rtc_data;
@@ -794,7 +831,7 @@ static void get_boot_rtc_time_complete(v
 	rtc->busy = 0;
 }
 
-int mf_get_boot_rtc(struct rtc_time *tm)
+static int mf_get_boot_rtc(struct rtc_time *tm)
 {
 	struct ce_msg_comp_data ce_complete;
 	struct boot_rtc_time_data rtc_data;
@@ -816,43 +853,6 @@ int mf_get_boot_rtc(struct rtc_time *tm)
 	return rtc_set_tm(rtc_data.rc, rtc_data.ce_msg.ce_msg, tm);
 }
 
-int mf_set_rtc(struct rtc_time *tm)
-{
-	char ce_time[12];
-	u8 day, mon, hour, min, sec, y1, y2;
-	unsigned year;
-
-	year = 1900 + tm->tm_year;
-	y1 = year / 100;
-	y2 = year % 100;
-
-	sec = tm->tm_sec;
-	min = tm->tm_min;
-	hour = tm->tm_hour;
-	day = tm->tm_mday;
-	mon = tm->tm_mon + 1;
-
-	BIN_TO_BCD(sec);
-	BIN_TO_BCD(min);
-	BIN_TO_BCD(hour);
-	BIN_TO_BCD(mon);
-	BIN_TO_BCD(day);
-	BIN_TO_BCD(y1);
-	BIN_TO_BCD(y2);
-
-	memset(ce_time, 0, sizeof(ce_time));
-	ce_time[3] = 0x41;
-	ce_time[4] = y1;
-	ce_time[5] = y2;
-	ce_time[6] = sec;
-	ce_time[7] = min;
-	ce_time[8] = hour;
-	ce_time[10] = day;
-	ce_time[11] = mon;
-
-	return signal_ce_msg(ce_time, NULL);
-}
-
 #ifdef CONFIG_PROC_FS
 
 static int proc_mf_dump_cmdline(char *page, char **start, off_t off,
Index: to-merge/include/asm-powerpc/iseries/mf.h
===================================================================
--- to-merge.orig/include/asm-powerpc/iseries/mf.h
+++ to-merge/include/asm-powerpc/iseries/mf.h
@@ -48,8 +48,4 @@ extern void mf_display_progress(u16 valu
 
 extern void mf_init(void);
 
-extern int mf_get_rtc(struct rtc_time *tm);
-extern int mf_get_boot_rtc(struct rtc_time *tm);
-extern int mf_set_rtc(struct rtc_time *tm);
-
 #endif /* _ASM_POWERPC_ISERIES_MF_H */

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [PATCH 8/11] powerpc: Add strne2a() to convert a string from EBCDIC to ASCII
  2006-03-21  9:45 [PATCH 1/11] powerpc: Unconfuse htab_bolt_mapping() callers Michael Ellerman
                   ` (5 preceding siblings ...)
  2006-03-21  9:46 ` [PATCH 7/11] powerpc: iseries: Make more stuff static in platforms/iseries/mf.c Michael Ellerman
@ 2006-03-21  9:46 ` Michael Ellerman
  2006-03-21 18:11   ` Olof Johansson
  2006-03-21  9:46 ` [PATCH 9/11] powerpc: iseries: Add /system-id, /model and /compatible Michael Ellerman
                   ` (2 subsequent siblings)
  9 siblings, 1 reply; 19+ messages in thread
From: Michael Ellerman @ 2006-03-21  9:46 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: linuxppc-dev

Add strne2a() which converts a string from EBCDIC to ASCII.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
---

 arch/powerpc/lib/e2a.c       |   10 ++++++++++
 include/asm-powerpc/system.h |    2 ++
 2 files changed, 12 insertions(+)

Index: to-merge/arch/powerpc/lib/e2a.c
===================================================================
--- to-merge.orig/arch/powerpc/lib/e2a.c
+++ to-merge/arch/powerpc/lib/e2a.c
@@ -103,4 +103,14 @@ unsigned char e2a(unsigned char x)
 }
 EXPORT_SYMBOL(e2a);
 
+unsigned char* strne2a(unsigned char *dest, const unsigned char *src, size_t n)
+{
+	int i;
 
+	n = strnlen(src, n);
+
+	for (i = 0; i < n; i++)
+		dest[i] = e2a(src[i]);
+
+	return dest;
+}
Index: to-merge/include/asm-powerpc/system.h
===================================================================
--- to-merge.orig/include/asm-powerpc/system.h
+++ to-merge/include/asm-powerpc/system.h
@@ -171,6 +171,8 @@ extern u32 booke_wdt_period;
 
 /* EBCDIC -> ASCII conversion for [0-9A-Z] on iSeries */
 extern unsigned char e2a(unsigned char);
+extern unsigned char* strne2a(unsigned char *dest,
+		const unsigned char *src, size_t n);
 
 struct device_node;
 extern void note_scsi_host(struct device_node *, void *);

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [PATCH 9/11] powerpc: iseries: Add /system-id, /model and /compatible
  2006-03-21  9:45 [PATCH 1/11] powerpc: Unconfuse htab_bolt_mapping() callers Michael Ellerman
                   ` (6 preceding siblings ...)
  2006-03-21  9:46 ` [PATCH 8/11] powerpc: Add strne2a() to convert a string from EBCDIC to ASCII Michael Ellerman
@ 2006-03-21  9:46 ` Michael Ellerman
  2006-03-21  9:46 ` [PATCH 10/11] powerpc: iseries: Add bootargs to /chosen Michael Ellerman
  2006-03-21  9:46 ` [PATCH 11/11] powerpc: Remove calculation of io hole Michael Ellerman
  9 siblings, 0 replies; 19+ messages in thread
From: Michael Ellerman @ 2006-03-21  9:46 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: linuxppc-dev

Add /system-id, /model and /compatible to the iSeries device tree.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
---

 arch/powerpc/platforms/iseries/setup.c |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+)

Index: to-merge/arch/powerpc/platforms/iseries/setup.c
===================================================================
--- to-merge.orig/arch/powerpc/platforms/iseries/setup.c
+++ to-merge/arch/powerpc/platforms/iseries/setup.c
@@ -50,6 +50,7 @@
 #include <asm/iseries/hv_call_xm.h>
 #include <asm/iseries/it_lp_queue.h>
 #include <asm/iseries/mf.h>
+#include <asm/iseries/it_exp_vpd_panel.h>
 #include <asm/iseries/hv_lp_event.h>
 #include <asm/iseries/lpar_map.h>
 #include <asm/udbg.h>
@@ -888,6 +889,24 @@ void dt_cpus(struct iseries_flat_dt *dt)
 	dt_end_node(dt);
 }
 
+void dt_model(struct iseries_flat_dt *dt)
+{
+	char buf[16] = "IBM,";
+
+	/* "IBM," + mfgId[2:3] + systemSerial[1:5] */
+	strne2a(buf + 4, xItExtVpdPanel.mfgID + 2, 2);
+	strne2a(buf + 6, xItExtVpdPanel.systemSerial + 1, 5);
+	buf[11] = '\0';
+	dt_prop_str(dt, "system-id", buf);
+
+	/* "IBM," + machineType[0:4] */
+	strne2a(buf + 4, xItExtVpdPanel.machineType, 4);
+	buf[8] = '\0';
+	dt_prop_str(dt, "model", buf);
+
+	dt_prop_str(dt, "compatible", "IBM,iSeries");
+}
+
 void build_flat_dt(struct iseries_flat_dt *dt, unsigned long phys_mem_size)
 {
 	u64 tmp[2];
@@ -898,6 +917,7 @@ void build_flat_dt(struct iseries_flat_d
 
 	dt_prop_u32(dt, "#address-cells", 2);
 	dt_prop_u32(dt, "#size-cells", 2);
+	dt_model(dt);
 
 	/* /memory */
 	dt_start_node(dt, "memory@0");

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [PATCH 10/11] powerpc: iseries: Add bootargs to /chosen
  2006-03-21  9:45 [PATCH 1/11] powerpc: Unconfuse htab_bolt_mapping() callers Michael Ellerman
                   ` (7 preceding siblings ...)
  2006-03-21  9:46 ` [PATCH 9/11] powerpc: iseries: Add /system-id, /model and /compatible Michael Ellerman
@ 2006-03-21  9:46 ` Michael Ellerman
  2006-03-21  9:46 ` [PATCH 11/11] powerpc: Remove calculation of io hole Michael Ellerman
  9 siblings, 0 replies; 19+ messages in thread
From: Michael Ellerman @ 2006-03-21  9:46 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: linuxppc-dev

Add the command line args to the device tree as /chosen/bootargs.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
---

 arch/powerpc/platforms/iseries/setup.c |    1 +
 1 files changed, 1 insertion(+)

Index: to-merge/arch/powerpc/platforms/iseries/setup.c
===================================================================
--- to-merge.orig/arch/powerpc/platforms/iseries/setup.c
+++ to-merge/arch/powerpc/platforms/iseries/setup.c
@@ -931,6 +931,7 @@ void build_flat_dt(struct iseries_flat_d
 	/* /chosen */
 	dt_start_node(dt, "chosen");
 	dt_prop_u32(dt, "linux,platform", PLATFORM_ISERIES_LPAR);
+	dt_prop_str(dt, "bootargs", cmd_line);
 	if (cmd_mem_limit)
 		dt_prop_u64(dt, "linux,memory-limit", cmd_mem_limit);
 	dt_end_node(dt);

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [PATCH 11/11] powerpc: Remove calculation of io hole
  2006-03-21  9:45 [PATCH 1/11] powerpc: Unconfuse htab_bolt_mapping() callers Michael Ellerman
                   ` (8 preceding siblings ...)
  2006-03-21  9:46 ` [PATCH 10/11] powerpc: iseries: Add bootargs to /chosen Michael Ellerman
@ 2006-03-21  9:46 ` Michael Ellerman
  9 siblings, 0 replies; 19+ messages in thread
From: Michael Ellerman @ 2006-03-21  9:46 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: linuxppc-dev

In mm_init_ppc64() we calculate the location of the "IO hole", but then
no one ever looks at the value. So don't bother.

That's actually all mm_init_ppc64() does, so get rid of it too.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
---

 arch/powerpc/kernel/setup_64.c |    2 -
 arch/powerpc/mm/init_64.c      |   48 -----------------------------------------
 include/asm-powerpc/lmb.h      |    2 -
 include/asm-powerpc/mmu.h      |    1 
 4 files changed, 53 deletions(-)

Index: to-merge/arch/powerpc/kernel/setup_64.c
===================================================================
--- to-merge.orig/arch/powerpc/kernel/setup_64.c
+++ to-merge/arch/powerpc/kernel/setup_64.c
@@ -497,8 +497,6 @@ void __init setup_system(void)
 #endif
 	printk("-----------------------------------------------------\n");
 
-	mm_init_ppc64();
-
 	DBG(" <- setup_system()\n");
 }
 
Index: to-merge/arch/powerpc/mm/init_64.c
===================================================================
--- to-merge.orig/arch/powerpc/mm/init_64.c
+++ to-merge/arch/powerpc/mm/init_64.c
@@ -84,54 +84,6 @@
 /* max amount of RAM to use */
 unsigned long __max_memory;
 
-/* info on what we think the IO hole is */
-unsigned long 	io_hole_start;
-unsigned long	io_hole_size;
-
-/*
- * Do very early mm setup.
- */
-void __init mm_init_ppc64(void)
-{
-#ifndef CONFIG_PPC_ISERIES
-	unsigned long i;
-#endif
-
-	ppc64_boot_msg(0x100, "MM Init");
-
-	/* This is the story of the IO hole... please, keep seated,
-	 * unfortunately, we are out of oxygen masks at the moment.
-	 * So we need some rough way to tell where your big IO hole
-	 * is. On pmac, it's between 2G and 4G, on POWER3, it's around
-	 * that area as well, on POWER4 we don't have one, etc...
-	 * We need that as a "hint" when sizing the TCE table on POWER3
-	 * So far, the simplest way that seem work well enough for us it
-	 * to just assume that the first discontinuity in our physical
-	 * RAM layout is the IO hole. That may not be correct in the future
-	 * (and isn't on iSeries but then we don't care ;)
-	 */
-
-#ifndef CONFIG_PPC_ISERIES
-	for (i = 1; i < lmb.memory.cnt; i++) {
-		unsigned long base, prevbase, prevsize;
-
-		prevbase = lmb.memory.region[i-1].base;
-		prevsize = lmb.memory.region[i-1].size;
-		base = lmb.memory.region[i].base;
-		if (base > (prevbase + prevsize)) {
-			io_hole_start = prevbase + prevsize;
-			io_hole_size = base  - (prevbase + prevsize);
-			break;
-		}
-	}
-#endif /* CONFIG_PPC_ISERIES */
-	if (io_hole_start)
-		printk("IO Hole assumed to be %lx -> %lx\n",
-		       io_hole_start, io_hole_start + io_hole_size - 1);
-
-	ppc64_boot_msg(0x100, "MM Init Done");
-}
-
 void free_initmem(void)
 {
 	unsigned long addr;
Index: to-merge/include/asm-powerpc/lmb.h
===================================================================
--- to-merge.orig/include/asm-powerpc/lmb.h
+++ to-merge/include/asm-powerpc/lmb.h
@@ -54,8 +54,6 @@ extern void __init lmb_enforce_memory_li
 
 extern void lmb_dump_all(void);
 
-extern unsigned long io_hole_start;
-
 static inline unsigned long
 lmb_size_bytes(struct lmb_region *type, unsigned long region_nr)
 {
Index: to-merge/include/asm-powerpc/mmu.h
===================================================================
--- to-merge.orig/include/asm-powerpc/mmu.h
+++ to-merge/include/asm-powerpc/mmu.h
@@ -236,7 +236,6 @@ extern void htab_initialize_secondary(vo
 extern void hpte_init_native(void);
 extern void hpte_init_lpar(void);
 extern void hpte_init_iSeries(void);
-extern void mm_init_ppc64(void);
 
 extern long pSeries_lpar_hpte_insert(unsigned long hpte_group,
 				     unsigned long va, unsigned long prpn,

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 2/11] powerpc: Remove unused iommu_off logic from pSeries_init_early()
  2006-03-21  9:45 ` [PATCH 2/11] powerpc: Remove unused iommu_off logic from pSeries_init_early() Michael Ellerman
@ 2006-03-21 16:15   ` Olof Johansson
  0 siblings, 0 replies; 19+ messages in thread
From: Olof Johansson @ 2006-03-21 16:15 UTC (permalink / raw)
  To: Michael Ellerman; +Cc: linuxppc-dev, Paul Mackerras

On Tue, Mar 21, 2006 at 08:45:58PM +1100, Michael Ellerman wrote:
> When iommu_init_early_pSeries() was added, ages ago, we forgot to remove
> the code that checks /chosen/linux,iommu-off in pSeries_init_early(). We
> do it now in iommu_init_early_pSeries().
> 
> Signed-off-by: Michael Ellerman <michael@ellerman.id.au>

Acked-by: Olof Johansson <olof@lixom.net>

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 8/11] powerpc: Add strne2a() to convert a string from EBCDIC to ASCII
  2006-03-21  9:46 ` [PATCH 8/11] powerpc: Add strne2a() to convert a string from EBCDIC to ASCII Michael Ellerman
@ 2006-03-21 18:11   ` Olof Johansson
  2006-03-21 18:32     ` Andreas Schwab
  0 siblings, 1 reply; 19+ messages in thread
From: Olof Johansson @ 2006-03-21 18:11 UTC (permalink / raw)
  To: Michael Ellerman; +Cc: linuxppc-dev, Paul Mackerras

On Tue, Mar 21, 2006 at 08:46:08PM +1100, Michael Ellerman wrote:
> Add strne2a() which converts a string from EBCDIC to ASCII.

Nitpick, since this isn't hot path:

> 
> Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
> ---
> 
>  arch/powerpc/lib/e2a.c       |   10 ++++++++++
>  include/asm-powerpc/system.h |    2 ++
>  2 files changed, 12 insertions(+)
> 
> Index: to-merge/arch/powerpc/lib/e2a.c
> ===================================================================
> --- to-merge.orig/arch/powerpc/lib/e2a.c
> +++ to-merge/arch/powerpc/lib/e2a.c
> @@ -103,4 +103,14 @@ unsigned char e2a(unsigned char x)
>  }
>  EXPORT_SYMBOL(e2a);
>  
> +unsigned char* strne2a(unsigned char *dest, const unsigned char *src, size_t n)
> +{
> +	int i;
>  
> +	n = strnlen(src, n);
> +
> +	for (i = 0; i < n; i++)
> +		dest[i] = e2a(src[i]);

Why iterate over the string twice? Why not do 
	for (..; i < n && src[n]; ...)
instead?


-Olof

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 8/11] powerpc: Add strne2a() to convert a string from EBCDIC to ASCII
  2006-03-21 18:11   ` Olof Johansson
@ 2006-03-21 18:32     ` Andreas Schwab
  2006-03-21 18:43       ` Olof Johansson
  0 siblings, 1 reply; 19+ messages in thread
From: Andreas Schwab @ 2006-03-21 18:32 UTC (permalink / raw)
  To: Olof Johansson; +Cc: Michael Ellerman, linuxppc-dev, Paul Mackerras

Olof Johansson <olof@lixom.net> writes:

> Why iterate over the string twice? Why not do 
> 	for (..; i < n && src[n]; ...)

ITYM i < n && src[i].

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 8/11] powerpc: Add strne2a() to convert a string from EBCDIC to ASCII
  2006-03-21 18:32     ` Andreas Schwab
@ 2006-03-21 18:43       ` Olof Johansson
  2006-03-21 23:25         ` Michael Ellerman
  0 siblings, 1 reply; 19+ messages in thread
From: Olof Johansson @ 2006-03-21 18:43 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: Michael Ellerman, Paul Mackerras, linuxppc-dev

On Tue, Mar 21, 2006 at 07:32:39PM +0100, Andreas Schwab wrote:
> Olof Johansson <olof@lixom.net> writes:
> 
> > Why iterate over the string twice? Why not do 
> > 	for (..; i < n && src[n]; ...)
> 
> ITYM i < n && src[i].

Doh, right.


-Olof

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 8/11] powerpc: Add strne2a() to convert a string from EBCDIC to ASCII
  2006-03-21 18:43       ` Olof Johansson
@ 2006-03-21 23:25         ` Michael Ellerman
  0 siblings, 0 replies; 19+ messages in thread
From: Michael Ellerman @ 2006-03-21 23:25 UTC (permalink / raw)
  To: Olof Johansson; +Cc: Paul Mackerras, linuxppc-dev

[-- Attachment #1: Type: text/plain, Size: 545 bytes --]

On Wed, 22 Mar 2006 05:43, Olof Johansson wrote:
> On Tue, Mar 21, 2006 at 07:32:39PM +0100, Andreas Schwab wrote:
> > Olof Johansson <olof@lixom.net> writes:
> > > Why iterate over the string twice? Why not do
> > > 	for (..; i < n && src[n]; ...)
> >
> > ITYM i < n && src[i].
>
> Doh, right.

That's why :)

-- 
Michael Ellerman
IBM OzLabs

wwweb: http://michael.ellerman.id.au
phone: +61 2 6212 1183 (tie line 70 21183)

We do not inherit the earth from our ancestors,
we borrow it from our children. - S.M.A.R.T Person

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 4/11] powerpc: Replace platform_is_lpar() with a firmware feature
  2006-03-21  9:45 ` [PATCH 4/11] powerpc: Replace platform_is_lpar() with a firmware feature Michael Ellerman
@ 2006-03-22  0:35   ` Stephen Rothwell
  2006-03-22  0:48     ` Michael Ellerman
  0 siblings, 1 reply; 19+ messages in thread
From: Stephen Rothwell @ 2006-03-22  0:35 UTC (permalink / raw)
  To: Michael Ellerman; +Cc: linuxppc-dev, paulus

[-- Attachment #1: Type: text/plain, Size: 808 bytes --]

On Tue, 21 Mar 2006 20:45:59 +1100 Michael Ellerman <michael@ellerman.id.au> wrote:
>
> It has been decreed that platform numbers are evil, so as a step in that
> direction, replace platform_is_lpar() with a FW_FEATURE_LPAR bit.
> 
> Currently FW_FEATURE_LPAR really means i/pSeries LPAR, in the future we might
> have to clean that up if we need to be more specific about what LPAR actually
> means. But that's another patch ...
> 
> Signed-off-by: Michael Ellerman <michael@ellerman.id.au>

Just wondering if you considered just #defining platform_is_lpar() to be
firmware_has_feature(FW_FEATURE_LPAR) ...

Otherwise looks good.

Acked-by: Stephen Rothwell <sfr@canb.auug.org.au>

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

[-- Attachment #2: Type: application/pgp-signature, Size: 191 bytes --]

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 5/11] powerpc: iseries: mf related cleanups
  2006-03-21  9:46 ` [PATCH 5/11] powerpc: iseries: mf related cleanups Michael Ellerman
@ 2006-03-22  0:39   ` Stephen Rothwell
  0 siblings, 0 replies; 19+ messages in thread
From: Stephen Rothwell @ 2006-03-22  0:39 UTC (permalink / raw)
  To: Michael Ellerman; +Cc: linuxppc-dev, paulus

[-- Attachment #1: Type: text/plain, Size: 495 bytes --]

Hi Michael,

Just some small nits ...

On Tue, 21 Mar 2006 20:46:02 +1100 Michael Ellerman <michael@ellerman.id.au> wrote:
>
> +static int mf_initialized = 0;

We don't generally put the "= 0".

> +	mf_initialized = 1;
> +	mb();

Do we really need the mb().  If so, a comment saying why would be good. 
(Yes, I know that you are just moving code.)

Otherwise looks good.
-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

[-- Attachment #2: Type: application/pgp-signature, Size: 191 bytes --]

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 4/11] powerpc: Replace platform_is_lpar() with a firmware feature
  2006-03-22  0:35   ` Stephen Rothwell
@ 2006-03-22  0:48     ` Michael Ellerman
  0 siblings, 0 replies; 19+ messages in thread
From: Michael Ellerman @ 2006-03-22  0:48 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Stephen Rothwell, paulus

[-- Attachment #1: Type: text/plain, Size: 1053 bytes --]

On Wed, 22 Mar 2006 11:35, Stephen Rothwell wrote:
> On Tue, 21 Mar 2006 20:45:59 +1100 Michael Ellerman <michael@ellerman.id.au> 
wrote:
> > It has been decreed that platform numbers are evil, so as a step in that
> > direction, replace platform_is_lpar() with a FW_FEATURE_LPAR bit.
> >
> > Currently FW_FEATURE_LPAR really means i/pSeries LPAR, in the future we
> > might have to clean that up if we need to be more specific about what
> > LPAR actually means. But that's another patch ...
> >
> > Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
>
> Just wondering if you considered just #defining platform_is_lpar() to be
> firmware_has_feature(FW_FEATURE_LPAR) ...

Thought about it, but decided it was ugly, and obscures what's really 
happening, ie. LPAR-ness is just a FW_FEATURE bit.

cheers

-- 
Michael Ellerman
IBM OzLabs

wwweb: http://michael.ellerman.id.au
phone: +61 2 6212 1183 (tie line 70 21183)

We do not inherit the earth from our ancestors,
we borrow it from our children. - S.M.A.R.T Person

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2006-03-22  0:48 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-03-21  9:45 [PATCH 1/11] powerpc: Unconfuse htab_bolt_mapping() callers Michael Ellerman
2006-03-21  9:45 ` [PATCH 3/11] powerpc: trivial: Cleanup whitespace in cputable.h Michael Ellerman
2006-03-21  9:45 ` [PATCH 2/11] powerpc: Remove unused iommu_off logic from pSeries_init_early() Michael Ellerman
2006-03-21 16:15   ` Olof Johansson
2006-03-21  9:45 ` [PATCH 4/11] powerpc: Replace platform_is_lpar() with a firmware feature Michael Ellerman
2006-03-22  0:35   ` Stephen Rothwell
2006-03-22  0:48     ` Michael Ellerman
2006-03-21  9:46 ` [PATCH 5/11] powerpc: iseries: mf related cleanups Michael Ellerman
2006-03-22  0:39   ` Stephen Rothwell
2006-03-21  9:46 ` [PATCH 6/11] powerpc: iseries: Remove pointless iSeries_(restart|power_off|halt) Michael Ellerman
2006-03-21  9:46 ` [PATCH 7/11] powerpc: iseries: Make more stuff static in platforms/iseries/mf.c Michael Ellerman
2006-03-21  9:46 ` [PATCH 8/11] powerpc: Add strne2a() to convert a string from EBCDIC to ASCII Michael Ellerman
2006-03-21 18:11   ` Olof Johansson
2006-03-21 18:32     ` Andreas Schwab
2006-03-21 18:43       ` Olof Johansson
2006-03-21 23:25         ` Michael Ellerman
2006-03-21  9:46 ` [PATCH 9/11] powerpc: iseries: Add /system-id, /model and /compatible Michael Ellerman
2006-03-21  9:46 ` [PATCH 10/11] powerpc: iseries: Add bootargs to /chosen Michael Ellerman
2006-03-21  9:46 ` [PATCH 11/11] powerpc: Remove calculation of io hole Michael Ellerman

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).