linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/5] powerpc: Cleanup htab code a little
@ 2006-03-30  6:12 Michael Ellerman
  2006-03-30  6:12 ` [PATCH 1/5] powerpc: Initialise ppc_md htab pointers earlier Michael Ellerman
                   ` (5 more replies)
  0 siblings, 6 replies; 9+ messages in thread
From: Michael Ellerman @ 2006-03-30  6:12 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: linuxppc-dev

A few cleanups to the htab. Built for pSeries, iSeries, pmac, pmac32 and maple. Booted on P5 LPAR and iSeries.

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

* [PATCH 1/5] powerpc: Initialise ppc_md htab pointers earlier
  2006-03-30  6:12 [PATCH 0/5] powerpc: Cleanup htab code a little Michael Ellerman
@ 2006-03-30  6:12 ` Michael Ellerman
  2006-03-30  6:12 ` [PATCH 2/5] powerpc: Use ppc_md.hpte_insert() in htab_bolt_mapping() Michael Ellerman
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: Michael Ellerman @ 2006-03-30  6:12 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: linuxppc-dev

Initialise the ppc_md htab callbacks earlier, in the probe routines. This
allows us to call htab_finish_init() from htab_initialize(), and makes it
private to hash_utils_64.c.

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

 arch/powerpc/kernel/setup_64.c          |    6 --
 arch/powerpc/mm/hash_native_64.c        |    3 -
 arch/powerpc/mm/hash_utils_64.c         |   72 ++++++++++++++++----------------
 arch/powerpc/platforms/iseries/htab.c   |    4 -
 arch/powerpc/platforms/iseries/setup.c  |    7 ---
 arch/powerpc/platforms/maple/setup.c    |    7 ---
 arch/powerpc/platforms/powermac/setup.c |    9 ----
 arch/powerpc/platforms/pseries/lpar.c   |    4 -
 arch/powerpc/platforms/pseries/setup.c  |   10 ++--
 include/asm-powerpc/mmu.h               |    1 
 10 files changed, 52 insertions(+), 71 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
@@ -371,11 +371,7 @@ void __init setup_system(void)
 	 * Fill the ppc64_caches & systemcfg structures with informations
 	 * retrieved from the device-tree. Need to be called before
 	 * finish_device_tree() since the later requires some of the
-	 * informations filled up here to properly parse the interrupt
-	 * tree.
-	 * It also sets up the cache line sizes which allows to call
-	 * routines like flush_icache_range (used by the hash init
-	 * later on).
+	 * informations filled up here to properly parse the interrupt tree.
 	 */
 	initialize_cache_info();
 
Index: to-merge/arch/powerpc/mm/hash_native_64.c
===================================================================
--- to-merge.orig/arch/powerpc/mm/hash_native_64.c
+++ to-merge/arch/powerpc/mm/hash_native_64.c
@@ -520,7 +520,7 @@ static inline int tlb_batching_enabled(v
 }
 #endif
 
-void hpte_init_native(void)
+void __init hpte_init_native(void)
 {
 	ppc_md.hpte_invalidate	= native_hpte_invalidate;
 	ppc_md.hpte_updatepp	= native_hpte_updatepp;
@@ -530,5 +530,4 @@ void hpte_init_native(void)
 	ppc_md.hpte_clear_all	= native_hpte_clear;
 	if (tlb_batching_enabled())
 		ppc_md.flush_hash_range = native_flush_hash_range;
-	htab_finish_init();
 }
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
@@ -397,6 +397,41 @@ void create_section_mapping(unsigned lon
 }
 #endif /* CONFIG_MEMORY_HOTPLUG */
 
+static inline void make_bl(unsigned int *insn_addr, void *func)
+{
+	unsigned long funcp = *((unsigned long *)func);
+	int offset = funcp - (unsigned long)insn_addr;
+
+	*insn_addr = (unsigned int)(0x48000001 | (offset & 0x03fffffc));
+	flush_icache_range((unsigned long)insn_addr, 4+
+			   (unsigned long)insn_addr);
+}
+
+static void __init htab_finish_init(void)
+{
+	extern unsigned int *htab_call_hpte_insert1;
+	extern unsigned int *htab_call_hpte_insert2;
+	extern unsigned int *htab_call_hpte_remove;
+	extern unsigned int *htab_call_hpte_updatepp;
+
+#ifdef CONFIG_PPC_64K_PAGES
+	extern unsigned int *ht64_call_hpte_insert1;
+	extern unsigned int *ht64_call_hpte_insert2;
+	extern unsigned int *ht64_call_hpte_remove;
+	extern unsigned int *ht64_call_hpte_updatepp;
+
+	make_bl(ht64_call_hpte_insert1, ppc_md.hpte_insert);
+	make_bl(ht64_call_hpte_insert2, ppc_md.hpte_insert);
+	make_bl(ht64_call_hpte_remove, ppc_md.hpte_remove);
+	make_bl(ht64_call_hpte_updatepp, ppc_md.hpte_updatepp);
+#endif /* CONFIG_PPC_64K_PAGES */
+
+	make_bl(htab_call_hpte_insert1, ppc_md.hpte_insert);
+	make_bl(htab_call_hpte_insert2, ppc_md.hpte_insert);
+	make_bl(htab_call_hpte_remove, ppc_md.hpte_remove);
+	make_bl(htab_call_hpte_updatepp, ppc_md.hpte_updatepp);
+}
+
 void __init htab_initialize(void)
 {
 	unsigned long table;
@@ -509,6 +544,8 @@ void __init htab_initialize(void)
 					 mmu_linear_psize));
 	}
 
+	htab_finish_init();
+
 	DBG(" <- htab_initialize()\n");
 }
 #undef KB
@@ -721,16 +758,6 @@ void flush_hash_range(unsigned long numb
 	}
 }
 
-static inline void make_bl(unsigned int *insn_addr, void *func)
-{
-	unsigned long funcp = *((unsigned long *)func);
-	int offset = funcp - (unsigned long)insn_addr;
-
-	*insn_addr = (unsigned int)(0x48000001 | (offset & 0x03fffffc));
-	flush_icache_range((unsigned long)insn_addr, 4+
-			   (unsigned long)insn_addr);
-}
-
 /*
  * low_hash_fault is called when we the low level hash code failed
  * to instert a PTE due to an hypervisor error
@@ -749,28 +776,3 @@ void low_hash_fault(struct pt_regs *regs
 	}
 	bad_page_fault(regs, address, SIGBUS);
 }
-
-void __init htab_finish_init(void)
-{
-	extern unsigned int *htab_call_hpte_insert1;
-	extern unsigned int *htab_call_hpte_insert2;
-	extern unsigned int *htab_call_hpte_remove;
-	extern unsigned int *htab_call_hpte_updatepp;
-
-#ifdef CONFIG_PPC_64K_PAGES
-	extern unsigned int *ht64_call_hpte_insert1;
-	extern unsigned int *ht64_call_hpte_insert2;
-	extern unsigned int *ht64_call_hpte_remove;
-	extern unsigned int *ht64_call_hpte_updatepp;
-
-	make_bl(ht64_call_hpte_insert1, ppc_md.hpte_insert);
-	make_bl(ht64_call_hpte_insert2, ppc_md.hpte_insert);
-	make_bl(ht64_call_hpte_remove, ppc_md.hpte_remove);
-	make_bl(ht64_call_hpte_updatepp, ppc_md.hpte_updatepp);
-#endif /* CONFIG_PPC_64K_PAGES */
-
-	make_bl(htab_call_hpte_insert1, ppc_md.hpte_insert);
-	make_bl(htab_call_hpte_insert2, ppc_md.hpte_insert);
-	make_bl(htab_call_hpte_remove, ppc_md.hpte_remove);
-	make_bl(htab_call_hpte_updatepp, ppc_md.hpte_updatepp);
-}
Index: to-merge/arch/powerpc/platforms/iseries/htab.c
===================================================================
--- to-merge.orig/arch/powerpc/platforms/iseries/htab.c
+++ to-merge/arch/powerpc/platforms/iseries/htab.c
@@ -242,13 +242,11 @@ static void iSeries_hpte_invalidate(unsi
 	local_irq_restore(flags);
 }
 
-void hpte_init_iSeries(void)
+void __init hpte_init_iSeries(void)
 {
 	ppc_md.hpte_invalidate	= iSeries_hpte_invalidate;
 	ppc_md.hpte_updatepp	= iSeries_hpte_updatepp;
 	ppc_md.hpte_updateboltedpp = iSeries_hpte_updateboltedpp;
 	ppc_md.hpte_insert	= iSeries_hpte_insert;
 	ppc_md.hpte_remove	= iSeries_hpte_remove;
-
-	htab_finish_init();
 }
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
@@ -326,11 +326,6 @@ static void __init iSeries_init_early(vo
 	iSeries_recal_titan = HvCallXm_loadTod();
 
 	/*
-	 * Initialize the hash table management pointers
-	 */
-	hpte_init_iSeries();
-
-	/*
 	 * Initialize the DMA/TCE management
 	 */
 	iommu_init_early_iSeries();
@@ -684,6 +679,8 @@ static int __init iseries_probe(void)
 	powerpc_firmware_features |= FW_FEATURE_ISERIES;
 	powerpc_firmware_features |= FW_FEATURE_LPAR;
 
+	hpte_init_iSeries();
+
 	return 1;
 }
 
Index: to-merge/arch/powerpc/platforms/maple/setup.c
===================================================================
--- to-merge.orig/arch/powerpc/platforms/maple/setup.c
+++ to-merge/arch/powerpc/platforms/maple/setup.c
@@ -199,11 +199,6 @@ static void __init maple_init_early(void
 {
 	DBG(" -> maple_init_early\n");
 
-	/* Initialize hash table, from now on, we can take hash faults
-	 * and call ioremap
-	 */
-	hpte_init_native();
-
 	/* Setup interrupt mapping options */
 	ppc64_interrupt_controller = IC_OPEN_PIC;
 
@@ -272,6 +267,8 @@ static int __init maple_probe(void)
 	 */
 	alloc_dart_table();
 
+	hpte_init_native();
+
 	return 1;
 }
 
Index: to-merge/arch/powerpc/platforms/powermac/setup.c
===================================================================
--- to-merge.orig/arch/powerpc/platforms/powermac/setup.c
+++ to-merge/arch/powerpc/platforms/powermac/setup.c
@@ -588,13 +588,6 @@ pmac_halt(void)
  */
 static void __init pmac_init_early(void)
 {
-#ifdef CONFIG_PPC64
-	/* Initialize hash table, from now on, we can take hash faults
-	 * and call ioremap
-	 */
-	hpte_init_native();
-#endif
-
 	/* Enable early btext debug if requested */
 	if (strstr(cmd_line, "btextdbg")) {
 		udbg_adb_init_early();
@@ -671,6 +664,8 @@ static int __init pmac_probe(void)
 	 * part of the cacheable linar mapping
 	 */
 	alloc_dart_table();
+
+	hpte_init_native();
 #endif
 
 #ifdef CONFIG_PPC32
Index: to-merge/arch/powerpc/platforms/pseries/lpar.c
===================================================================
--- to-merge.orig/arch/powerpc/platforms/pseries/lpar.c
+++ to-merge/arch/powerpc/platforms/pseries/lpar.c
@@ -512,7 +512,7 @@ void pSeries_lpar_flush_hash_range(unsig
 		spin_unlock_irqrestore(&pSeries_lpar_tlbie_lock, flags);
 }
 
-void hpte_init_lpar(void)
+void __init hpte_init_lpar(void)
 {
 	ppc_md.hpte_invalidate	= pSeries_lpar_hpte_invalidate;
 	ppc_md.hpte_updatepp	= pSeries_lpar_hpte_updatepp;
@@ -521,6 +521,4 @@ void hpte_init_lpar(void)
 	ppc_md.hpte_remove	= pSeries_lpar_hpte_remove;
 	ppc_md.flush_hash_range	= pSeries_lpar_flush_hash_range;
 	ppc_md.hpte_clear_all   = pSeries_lpar_hptab_clear;
-
-	htab_finish_init();
 }
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
@@ -322,11 +322,6 @@ static void __init pSeries_init_early(vo
 	DBG(" -> pSeries_init_early()\n");
 
 	fw_feature_init();
-	
-	if (firmware_has_feature(FW_FEATURE_LPAR))
-		hpte_init_lpar();
-	else
-		hpte_init_native();
 
 	if (firmware_has_feature(FW_FEATURE_LPAR))
 		find_udbg_vterm();
@@ -384,6 +379,11 @@ static int __init pSeries_probe_hypertas
 	if (of_get_flat_dt_prop(node, "ibm,hypertas-functions", NULL) != NULL)
  		powerpc_firmware_features |= FW_FEATURE_LPAR;
 
+	if (firmware_has_feature(FW_FEATURE_LPAR))
+		hpte_init_lpar();
+	else
+		hpte_init_native();
+
  	return 1;
 }
 
Index: to-merge/include/asm-powerpc/mmu.h
===================================================================
--- to-merge.orig/include/asm-powerpc/mmu.h
+++ to-merge/include/asm-powerpc/mmu.h
@@ -226,7 +226,6 @@ extern int hash_huge_page(struct mm_stru
 			  unsigned long ea, unsigned long vsid, int local,
 			  unsigned long trap);
 
-extern void htab_finish_init(void);
 extern int htab_bolt_mapping(unsigned long vstart, unsigned long vend,
 			     unsigned long pstart, unsigned long mode,
 			     int psize);

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

* [PATCH 2/5] powerpc: Use ppc_md.hpte_insert() in htab_bolt_mapping()
  2006-03-30  6:12 [PATCH 0/5] powerpc: Cleanup htab code a little Michael Ellerman
  2006-03-30  6:12 ` [PATCH 1/5] powerpc: Initialise ppc_md htab pointers earlier Michael Ellerman
@ 2006-03-30  6:12 ` Michael Ellerman
  2006-03-30  6:12 ` [PATCH 3/5] powerpc: Move create_(instruction|branch|function_call) into util.h Michael Ellerman
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: Michael Ellerman @ 2006-03-30  6:12 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: linuxppc-dev

With the ppc_md htab pointers setup earlier, we can use ppc_md.hpte_insert
in htab_bolt_mapping(), rather than deciding which version to call by hand.

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

 arch/powerpc/mm/hash_utils_64.c |   34 ++++++----------------------------
 1 files changed, 6 insertions(+), 28 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
@@ -162,34 +162,12 @@ int htab_bolt_mapping(unsigned long vsta
 		hash = hpt_hash(va, shift);
 		hpteg = ((hash & htab_hash_mask) * HPTES_PER_GROUP);
 
-		/* The crap below can be cleaned once ppd_md.probe() can
-		 * set up the hash callbacks, thus we can just used the
-		 * normal insert callback here.
-		 */
-#ifdef CONFIG_PPC_ISERIES
-		if (machine_is(iseries))
-			ret = iSeries_hpte_insert(hpteg, va,
-						  paddr,
-						  tmp_mode,
-						  HPTE_V_BOLTED,
-						  psize);
-		else
-#endif
-#ifdef CONFIG_PPC_PSERIES
-		if (machine_is(pseries) && firmware_has_feature(FW_FEATURE_LPAR))
-			ret = pSeries_lpar_hpte_insert(hpteg, va,
-						       paddr,
-						       tmp_mode,
-						       HPTE_V_BOLTED,
-						       psize);
-		else
-#endif
-#ifdef CONFIG_PPC_MULTIPLATFORM
-			ret = native_hpte_insert(hpteg, va,
-						 paddr,
-						 tmp_mode, HPTE_V_BOLTED,
-						 psize);
-#endif
+		DBG("htab_bolt_mapping: calling %p\n", ppc_md.hpte_insert);
+
+		BUG_ON(!ppc_md.hpte_insert);
+		ret = ppc_md.hpte_insert(hpteg, va, paddr,
+				tmp_mode, HPTE_V_BOLTED, psize);
+
 		if (ret < 0)
 			break;
 	}

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

* [PATCH 3/5] powerpc: Move create_(instruction|branch|function_call) into util.h
  2006-03-30  6:12 [PATCH 0/5] powerpc: Cleanup htab code a little Michael Ellerman
  2006-03-30  6:12 ` [PATCH 1/5] powerpc: Initialise ppc_md htab pointers earlier Michael Ellerman
  2006-03-30  6:12 ` [PATCH 2/5] powerpc: Use ppc_md.hpte_insert() in htab_bolt_mapping() Michael Ellerman
@ 2006-03-30  6:12 ` Michael Ellerman
  2006-03-30 18:10   ` Linas Vepstas
  2006-03-30  6:13 ` [PATCH 4/5] powerpc: Use flush_icache_range() in create_instruction() Michael Ellerman
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 9+ messages in thread
From: Michael Ellerman @ 2006-03-30  6:12 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: linuxppc-dev

These functions don't really belong in system.h, and they can't be there if
the next patch is going to work. So create util.h for them.

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

 arch/powerpc/kernel/crash_dump.c      |    1 
 arch/powerpc/platforms/powermac/smp.c |    1 
 include/asm-powerpc/system.h          |   48 -----------------------------
 include/asm-powerpc/util.h            |   56 ++++++++++++++++++++++++++++++++++
 4 files changed, 58 insertions(+), 48 deletions(-)

Index: to-merge/arch/powerpc/kernel/crash_dump.c
===================================================================
--- to-merge.orig/arch/powerpc/kernel/crash_dump.c
+++ to-merge/arch/powerpc/kernel/crash_dump.c
@@ -17,6 +17,7 @@
 #include <asm/lmb.h>
 #include <asm/firmware.h>
 #include <asm/uaccess.h>
+#include <asm/util.h>
 
 #ifdef DEBUG
 #include <asm/udbg.h>
Index: to-merge/arch/powerpc/platforms/powermac/smp.c
===================================================================
--- to-merge.orig/arch/powerpc/platforms/powermac/smp.c
+++ to-merge/arch/powerpc/platforms/powermac/smp.c
@@ -53,6 +53,7 @@
 #include <asm/keylargo.h>
 #include <asm/pmac_low_i2c.h>
 #include <asm/pmac_pfunc.h>
+#include <asm/util.h>
 
 #define DEBUG
 
Index: to-merge/include/asm-powerpc/system.h
===================================================================
--- to-merge.orig/include/asm-powerpc/system.h
+++ to-merge/include/asm-powerpc/system.h
@@ -378,54 +378,6 @@ extern void reloc_got2(unsigned long);
 
 #define PTRRELOC(x)	((typeof(x)) add_reloc_offset((unsigned long)(x)))
 
-static inline void create_instruction(unsigned long addr, unsigned int instr)
-{
-	unsigned int *p;
-	p  = (unsigned int *)addr;
-	*p = instr;
-	asm ("dcbst 0, %0; sync; icbi 0,%0; sync; isync" : : "r" (p));
-}
-
-/* Flags for create_branch:
- * "b"   == create_branch(addr, target, 0);
- * "ba"  == create_branch(addr, target, BRANCH_ABSOLUTE);
- * "bl"  == create_branch(addr, target, BRANCH_SET_LINK);
- * "bla" == create_branch(addr, target, BRANCH_ABSOLUTE | BRANCH_SET_LINK);
- */
-#define BRANCH_SET_LINK	0x1
-#define BRANCH_ABSOLUTE	0x2
-
-static inline void create_branch(unsigned long addr,
-		unsigned long target, int flags)
-{
-	unsigned int instruction;
-
-	if (! (flags & BRANCH_ABSOLUTE))
-		target = target - addr;
-
-	/* Mask out the flags and target, so they don't step on each other. */
-	instruction = 0x48000000 | (flags & 0x3) | (target & 0x03FFFFFC);
-
-	create_instruction(addr, instruction);
-}
-
-static inline void create_function_call(unsigned long addr, void * func)
-{
-	unsigned long func_addr;
-
-#ifdef CONFIG_PPC64
-	/*
-	 * On PPC64 the function pointer actually points to the function's
-	 * descriptor. The first entry in the descriptor is the address
-	 * of the function text.
-	 */
-	func_addr = *(unsigned long *)func;
-#else
-	func_addr = (unsigned long)func;
-#endif
-	create_branch(addr, func_addr, BRANCH_SET_LINK);
-}
-
 #ifdef CONFIG_VIRT_CPU_ACCOUNTING
 extern void account_system_vtime(struct task_struct *);
 #endif
Index: to-merge/include/asm-powerpc/util.h
===================================================================
--- /dev/null
+++ to-merge/include/asm-powerpc/util.h
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2005,2006 IBM Corporation.
+ */
+
+#ifndef _ASM_POWERPC_UTIL_H
+#define _ASM_POWERPC_UTIL_H
+
+static inline void create_instruction(unsigned long addr, unsigned int instr)
+{
+	unsigned int *p;
+	p  = (unsigned int *)addr;
+	*p = instr;
+	asm ("dcbst 0, %0; sync; icbi 0,%0; sync; isync" : : "r" (p));
+}
+
+/* Flags for create_branch:
+ * "b"   == create_branch(addr, target, 0);
+ * "ba"  == create_branch(addr, target, BRANCH_ABSOLUTE);
+ * "bl"  == create_branch(addr, target, BRANCH_SET_LINK);
+ * "bla" == create_branch(addr, target, BRANCH_ABSOLUTE | BRANCH_SET_LINK);
+ */
+#define BRANCH_SET_LINK	0x1
+#define BRANCH_ABSOLUTE	0x2
+
+static inline void create_branch(unsigned long addr,
+		unsigned long target, int flags)
+{
+	unsigned int instruction;
+
+	if (! (flags & BRANCH_ABSOLUTE))
+		target = target - addr;
+
+	/* Mask out the flags and target, so they don't step on each other. */
+	instruction = 0x48000000 | (flags & 0x3) | (target & 0x03FFFFFC);
+
+	create_instruction(addr, instruction);
+}
+
+static inline void create_function_call(unsigned long addr, void *func)
+{
+	unsigned long func_addr;
+
+#ifdef CONFIG_PPC64
+	/*
+	 * On PPC64 the function pointer actually points to the function's
+	 * descriptor. The first entry in the descriptor is the address
+	 * of the function text.
+	 */
+	func_addr = *(unsigned long *)func;
+#else
+	func_addr = (unsigned long)func;
+#endif
+	create_branch(addr, func_addr, BRANCH_SET_LINK);
+}
+
+#endif /* _ASM_POWERPC_UTIL_H */

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

* [PATCH 4/5] powerpc: Use flush_icache_range() in create_instruction()
  2006-03-30  6:12 [PATCH 0/5] powerpc: Cleanup htab code a little Michael Ellerman
                   ` (2 preceding siblings ...)
  2006-03-30  6:12 ` [PATCH 3/5] powerpc: Move create_(instruction|branch|function_call) into util.h Michael Ellerman
@ 2006-03-30  6:13 ` Michael Ellerman
  2006-03-30  6:13 ` [PATCH 5/5] powerpc: Replace calls to make_bl() with create_function_call() Michael Ellerman
  2006-05-02  1:09 ` [PATCH 0/5] powerpc: Cleanup htab code a little Michael Ellerman
  5 siblings, 0 replies; 9+ messages in thread
From: Michael Ellerman @ 2006-03-30  6:13 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: linuxppc-dev

Now that ppc64_caches is setup with default values, we can call
flush_icache_range() from create_instruction() rather than using our own
asm version.

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

 include/asm-powerpc/util.h |    4 +++-
 1 files changed, 3 insertions(+), 1 deletion(-)

Index: to-merge/include/asm-powerpc/util.h
===================================================================
--- to-merge.orig/include/asm-powerpc/util.h
+++ to-merge/include/asm-powerpc/util.h
@@ -5,12 +5,14 @@
 #ifndef _ASM_POWERPC_UTIL_H
 #define _ASM_POWERPC_UTIL_H
 
+#include <asm/cacheflush.h>
+
 static inline void create_instruction(unsigned long addr, unsigned int instr)
 {
 	unsigned int *p;
 	p  = (unsigned int *)addr;
 	*p = instr;
-	asm ("dcbst 0, %0; sync; icbi 0,%0; sync; isync" : : "r" (p));
+	flush_icache_range(addr, addr + 4);
 }
 
 /* Flags for create_branch:

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

* [PATCH 5/5] powerpc: Replace calls to make_bl() with create_function_call()
  2006-03-30  6:12 [PATCH 0/5] powerpc: Cleanup htab code a little Michael Ellerman
                   ` (3 preceding siblings ...)
  2006-03-30  6:13 ` [PATCH 4/5] powerpc: Use flush_icache_range() in create_instruction() Michael Ellerman
@ 2006-03-30  6:13 ` Michael Ellerman
  2006-05-02  1:09 ` [PATCH 0/5] powerpc: Cleanup htab code a little Michael Ellerman
  5 siblings, 0 replies; 9+ messages in thread
From: Michael Ellerman @ 2006-03-30  6:13 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: linuxppc-dev

Use create_function_call() instead of make_bl() in htab_finish_init().

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

 arch/powerpc/mm/hash_utils_64.c |   45 ++++++++++++++++------------------------
 1 files changed, 18 insertions(+), 27 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
@@ -52,6 +52,7 @@
 #include <asm/cputable.h>
 #include <asm/abs_addr.h>
 #include <asm/sections.h>
+#include <asm/util.h>
 
 #ifdef DEBUG
 #define DBG(fmt...) udbg_printf(fmt)
@@ -375,39 +376,29 @@ void create_section_mapping(unsigned lon
 }
 #endif /* CONFIG_MEMORY_HOTPLUG */
 
-static inline void make_bl(unsigned int *insn_addr, void *func)
-{
-	unsigned long funcp = *((unsigned long *)func);
-	int offset = funcp - (unsigned long)insn_addr;
-
-	*insn_addr = (unsigned int)(0x48000001 | (offset & 0x03fffffc));
-	flush_icache_range((unsigned long)insn_addr, 4+
-			   (unsigned long)insn_addr);
-}
-
 static void __init htab_finish_init(void)
 {
-	extern unsigned int *htab_call_hpte_insert1;
-	extern unsigned int *htab_call_hpte_insert2;
-	extern unsigned int *htab_call_hpte_remove;
-	extern unsigned int *htab_call_hpte_updatepp;
+	extern unsigned long htab_call_hpte_insert1;
+	extern unsigned long htab_call_hpte_insert2;
+	extern unsigned long htab_call_hpte_remove;
+	extern unsigned long htab_call_hpte_updatepp;
 
 #ifdef CONFIG_PPC_64K_PAGES
-	extern unsigned int *ht64_call_hpte_insert1;
-	extern unsigned int *ht64_call_hpte_insert2;
-	extern unsigned int *ht64_call_hpte_remove;
-	extern unsigned int *ht64_call_hpte_updatepp;
-
-	make_bl(ht64_call_hpte_insert1, ppc_md.hpte_insert);
-	make_bl(ht64_call_hpte_insert2, ppc_md.hpte_insert);
-	make_bl(ht64_call_hpte_remove, ppc_md.hpte_remove);
-	make_bl(ht64_call_hpte_updatepp, ppc_md.hpte_updatepp);
+	extern unsigned long ht64_call_hpte_insert1;
+	extern unsigned long ht64_call_hpte_insert2;
+	extern unsigned long ht64_call_hpte_remove;
+	extern unsigned long ht64_call_hpte_updatepp;
+
+	create_function_call(ht64_call_hpte_insert1, ppc_md.hpte_insert);
+	create_function_call(ht64_call_hpte_insert2, ppc_md.hpte_insert);
+	create_function_call(ht64_call_hpte_remove, ppc_md.hpte_remove);
+	create_function_call(ht64_call_hpte_updatepp, ppc_md.hpte_updatepp);
 #endif /* CONFIG_PPC_64K_PAGES */
 
-	make_bl(htab_call_hpte_insert1, ppc_md.hpte_insert);
-	make_bl(htab_call_hpte_insert2, ppc_md.hpte_insert);
-	make_bl(htab_call_hpte_remove, ppc_md.hpte_remove);
-	make_bl(htab_call_hpte_updatepp, ppc_md.hpte_updatepp);
+	create_function_call(htab_call_hpte_insert1, ppc_md.hpte_insert);
+	create_function_call(htab_call_hpte_insert2, ppc_md.hpte_insert);
+	create_function_call(htab_call_hpte_remove, ppc_md.hpte_remove);
+	create_function_call(htab_call_hpte_updatepp, ppc_md.hpte_updatepp);
 }
 
 void __init htab_initialize(void)

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

* Re: [PATCH 3/5] powerpc: Move create_(instruction|branch|function_call) into util.h
  2006-03-30  6:12 ` [PATCH 3/5] powerpc: Move create_(instruction|branch|function_call) into util.h Michael Ellerman
@ 2006-03-30 18:10   ` Linas Vepstas
  2006-03-30 22:43     ` Michael Ellerman
  0 siblings, 1 reply; 9+ messages in thread
From: Linas Vepstas @ 2006-03-30 18:10 UTC (permalink / raw)
  To: Michael Ellerman; +Cc: linuxppc-dev, Paul Mackerras


Hi,
A minor quibble from the dept. of naming things:

On Thu, Mar 30, 2006 at 05:12:59PM +1100, Michael Ellerman wrote:
> ===================================================================
> --- /dev/null
> +++ to-merge/include/asm-powerpc/util.h
> @@ -0,0 +1,56 @@
> +
> +#ifndef _ASM_POWERPC_UTIL_H
> +#define _ASM_POWERPC_UTIL_H
> +
> +static inline void create_instruction(unsigned long addr, unsigned int instr)


Surely there is a more descriptive name for this new file than "util.h"?

How about "dynamic_insn.h" or "insn_patch.h" or "dyn_fixup.h" or
something like that? 

--linas

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

* Re: [PATCH 3/5] powerpc: Move create_(instruction|branch|function_call) into util.h
  2006-03-30 18:10   ` Linas Vepstas
@ 2006-03-30 22:43     ` Michael Ellerman
  0 siblings, 0 replies; 9+ messages in thread
From: Michael Ellerman @ 2006-03-30 22:43 UTC (permalink / raw)
  To: Linas Vepstas; +Cc: linuxppc-dev, Paul Mackerras

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

On Thu, 2006-03-30 at 12:10 -0600, Linas Vepstas wrote:
> Hi,
> A minor quibble from the dept. of naming things:
> 
> On Thu, Mar 30, 2006 at 05:12:59PM +1100, Michael Ellerman wrote:
> > ===================================================================
> > --- /dev/null
> > +++ to-merge/include/asm-powerpc/util.h
> > @@ -0,0 +1,56 @@
> > +
> > +#ifndef _ASM_POWERPC_UTIL_H
> > +#define _ASM_POWERPC_UTIL_H
> > +
> > +static inline void create_instruction(unsigned long addr, unsigned int instr)
> 
> 
> Surely there is a more descriptive name for this new file than "util.h"?
> 
> How about "dynamic_insn.h" or "insn_patch.h" or "dyn_fixup.h" or
> something like that? 

That would be more descriptive of what's in there now, but I actually
intended it to be a place where we can put util-ish code. Obviously
we'll have to make sure it doesn't get abused, but I think it's valid to
have one header file for random stuff that doesn't belong elsewhere.
Others may disagree?

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: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

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

* Re: [PATCH 0/5] powerpc: Cleanup htab code a little
  2006-03-30  6:12 [PATCH 0/5] powerpc: Cleanup htab code a little Michael Ellerman
                   ` (4 preceding siblings ...)
  2006-03-30  6:13 ` [PATCH 5/5] powerpc: Replace calls to make_bl() with create_function_call() Michael Ellerman
@ 2006-05-02  1:09 ` Michael Ellerman
  5 siblings, 0 replies; 9+ messages in thread
From: Michael Ellerman @ 2006-05-02  1:09 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: linuxppc-dev

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

On Thu, 2006-03-30 at 17:12 +1100, Michael Ellerman wrote:
> A few cleanups to the htab. Built for pSeries, iSeries, pmac, pmac32
> and maple. Booted on P5 LPAR and iSeries.

This series still applies cleanly, so consider this a resend for 2.6.18
if you will.

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: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 191 bytes --]

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

end of thread, other threads:[~2006-05-02  1:09 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-03-30  6:12 [PATCH 0/5] powerpc: Cleanup htab code a little Michael Ellerman
2006-03-30  6:12 ` [PATCH 1/5] powerpc: Initialise ppc_md htab pointers earlier Michael Ellerman
2006-03-30  6:12 ` [PATCH 2/5] powerpc: Use ppc_md.hpte_insert() in htab_bolt_mapping() Michael Ellerman
2006-03-30  6:12 ` [PATCH 3/5] powerpc: Move create_(instruction|branch|function_call) into util.h Michael Ellerman
2006-03-30 18:10   ` Linas Vepstas
2006-03-30 22:43     ` Michael Ellerman
2006-03-30  6:13 ` [PATCH 4/5] powerpc: Use flush_icache_range() in create_instruction() Michael Ellerman
2006-03-30  6:13 ` [PATCH 5/5] powerpc: Replace calls to make_bl() with create_function_call() Michael Ellerman
2006-05-02  1:09 ` [PATCH 0/5] powerpc: Cleanup htab code a little 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).