LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 01/12] Move declaration of init_bootmem_done into system.h
From: Michael Ellerman @ 2008-05-08  4:27 UTC (permalink / raw)
  To: linuxppc-dev

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
---
 arch/powerpc/mm/init_32.c    |    3 +--
 include/asm-powerpc/system.h |    1 +
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/mm/init_32.c b/arch/powerpc/mm/init_32.c
index 1952b4d..4541859 100644
--- a/arch/powerpc/mm/init_32.c
+++ b/arch/powerpc/mm/init_32.c
@@ -43,6 +43,7 @@
 #include <asm/btext.h>
 #include <asm/tlb.h>
 #include <asm/sections.h>
+#include <asm/system.h>
 
 #include "mmu_decl.h"
 
@@ -76,8 +77,6 @@ void MMU_init(void);
 /* XXX should be in current.h  -- paulus */
 extern struct task_struct *current_set[NR_CPUS];
 
-extern int init_bootmem_done;
-
 /*
  * this tells the system to map all of ram with the segregs
  * (i.e. page tables) instead of the bats.
diff --git a/include/asm-powerpc/system.h b/include/asm-powerpc/system.h
index 2b6559a..df781ad 100644
--- a/include/asm-powerpc/system.h
+++ b/include/asm-powerpc/system.h
@@ -190,6 +190,7 @@ extern struct task_struct *_switch(struct thread_struct *prev,
 
 extern unsigned int rtas_data;
 extern int mem_init_done;	/* set on boot once kmalloc can be called */
+extern int init_bootmem_done;	/* set on !NUMA once bootmem is available */
 extern unsigned long memory_limit;
 extern unsigned long klimit;
 
-- 
1.5.5

^ permalink raw reply related

* [PATCH 02/12] Fix sparse warnings in arch/powerpc/mm
From: Michael Ellerman @ 2008-05-08  4:27 UTC (permalink / raw)
  To: linuxppc-dev
In-Reply-To: <5d2ed2a7e92250bdc6d9959dbeaeb3784a7109b4.1210220828.git.michael@ellerman.id.au>

Make two vmemmap helpers static in init_64.c.
Make stab variables static in stab.c
Make psize defs static in hash_utils_64.c

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
---
 arch/powerpc/mm/hash_utils_64.c |    4 ++--
 arch/powerpc/mm/init_64.c       |    4 ++--
 arch/powerpc/mm/stab.c          |    4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/arch/powerpc/mm/hash_utils_64.c b/arch/powerpc/mm/hash_utils_64.c
index 2b5a399..1a4b4b3 100644
--- a/arch/powerpc/mm/hash_utils_64.c
+++ b/arch/powerpc/mm/hash_utils_64.c
@@ -117,7 +117,7 @@ static DEFINE_SPINLOCK(linear_map_hash_lock);
 
 /* Pre-POWER4 CPUs (4k pages only)
  */
-struct mmu_psize_def mmu_psize_defaults_old[] = {
+static struct mmu_psize_def mmu_psize_defaults_old[] = {
 	[MMU_PAGE_4K] = {
 		.shift	= 12,
 		.sllp	= 0,
@@ -131,7 +131,7 @@ struct mmu_psize_def mmu_psize_defaults_old[] = {
  *
  * Support for 16Mb large pages
  */
-struct mmu_psize_def mmu_psize_defaults_gp[] = {
+static struct mmu_psize_def mmu_psize_defaults_gp[] = {
 	[MMU_PAGE_4K] = {
 		.shift	= 12,
 		.sllp	= 0,
diff --git a/arch/powerpc/mm/init_64.c b/arch/powerpc/mm/init_64.c
index c5ac532..1e52e97 100644
--- a/arch/powerpc/mm/init_64.c
+++ b/arch/powerpc/mm/init_64.c
@@ -183,7 +183,7 @@ void pgtable_cache_init(void)
  * do this by hand as the proffered address may not be correctly aligned.
  * Subtraction of non-aligned pointers produces undefined results.
  */
-unsigned long __meminit vmemmap_section_start(unsigned long page)
+static unsigned long __meminit vmemmap_section_start(unsigned long page)
 {
 	unsigned long offset = page - ((unsigned long)(vmemmap));
 
@@ -196,7 +196,7 @@ unsigned long __meminit vmemmap_section_start(unsigned long page)
  * which overlaps this vmemmap page is initialised then this page is
  * initialised already.
  */
-int __meminit vmemmap_populated(unsigned long start, int page_size)
+static int __meminit vmemmap_populated(unsigned long start, int page_size)
 {
 	unsigned long end = start + page_size;
 
diff --git a/arch/powerpc/mm/stab.c b/arch/powerpc/mm/stab.c
index efbbd13..60e6032 100644
--- a/arch/powerpc/mm/stab.c
+++ b/arch/powerpc/mm/stab.c
@@ -30,8 +30,8 @@ struct stab_entry {
 };
 
 #define NR_STAB_CACHE_ENTRIES 8
-DEFINE_PER_CPU(long, stab_cache_ptr);
-DEFINE_PER_CPU(long, stab_cache[NR_STAB_CACHE_ENTRIES]);
+static DEFINE_PER_CPU(long, stab_cache_ptr);
+static DEFINE_PER_CPU(long, stab_cache[NR_STAB_CACHE_ENTRIES]);
 
 /*
  * Create a segment table entry for the given esid/vsid pair.
-- 
1.5.5

^ permalink raw reply related

* [PATCH 03/12] Move declaration of tce variables into mmu-hash64.h
From: Michael Ellerman @ 2008-05-08  4:27 UTC (permalink / raw)
  To: linuxppc-dev
In-Reply-To: <5d2ed2a7e92250bdc6d9959dbeaeb3784a7109b4.1210220828.git.michael@ellerman.id.au>


Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
---
 arch/powerpc/mm/hash_utils_64.c  |    2 --
 include/asm-powerpc/mmu-hash64.h |    1 +
 2 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/mm/hash_utils_64.c b/arch/powerpc/mm/hash_utils_64.c
index 1a4b4b3..05f955f 100644
--- a/arch/powerpc/mm/hash_utils_64.c
+++ b/arch/powerpc/mm/hash_utils_64.c
@@ -509,8 +509,6 @@ void __init htab_initialize(void)
 	unsigned long base = 0, size = 0, limit;
 	int i;
 
-	extern unsigned long tce_alloc_start, tce_alloc_end;
-
 	DBG(" -> htab_initialize()\n");
 
 	/* Initialize segment sizes */
diff --git a/include/asm-powerpc/mmu-hash64.h b/include/asm-powerpc/mmu-hash64.h
index 0dff767..f35d1e1 100644
--- a/include/asm-powerpc/mmu-hash64.h
+++ b/include/asm-powerpc/mmu-hash64.h
@@ -181,6 +181,7 @@ extern int mmu_io_psize;
 extern int mmu_kernel_ssize;
 extern int mmu_highuser_ssize;
 extern u16 mmu_slb_size;
+extern unsigned long tce_alloc_start, tce_alloc_end;
 
 /*
  * If the processor supports 64k normal pages but not 64k cache
-- 
1.5.5

^ permalink raw reply related

* [PATCH 04/12] Remove duplicate variable definitions in mm/tlb_64.c
From: Michael Ellerman @ 2008-05-08  4:27 UTC (permalink / raw)
  To: linuxppc-dev
In-Reply-To: <5d2ed2a7e92250bdc6d9959dbeaeb3784a7109b4.1210220828.git.michael@ellerman.id.au>

Somewhere along the way (e28f7faf05159f1cfd564596f5e6178edba6bd49,
"Four level pagetables for ppc64") we ended up with duplicate
definitions for pte_freelist_cur and pte_freelist_force_free.
Somehow this compiles, but it would be better to just have one
definition for each.

The two definitions we end up with can be static too!

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
---
 arch/powerpc/mm/tlb_64.c |    7 ++-----
 1 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/arch/powerpc/mm/tlb_64.c b/arch/powerpc/mm/tlb_64.c
index e2d867c..509bc56 100644
--- a/arch/powerpc/mm/tlb_64.c
+++ b/arch/powerpc/mm/tlb_64.c
@@ -37,8 +37,8 @@ DEFINE_PER_CPU(struct ppc64_tlb_batch, ppc64_tlb_batch);
  * include/asm-powerpc/tlb.h file -- tgall
  */
 DEFINE_PER_CPU(struct mmu_gather, mmu_gathers);
-DEFINE_PER_CPU(struct pte_freelist_batch *, pte_freelist_cur);
-unsigned long pte_freelist_forced_free;
+static DEFINE_PER_CPU(struct pte_freelist_batch *, pte_freelist_cur);
+static unsigned long pte_freelist_forced_free;
 
 struct pte_freelist_batch
 {
@@ -47,9 +47,6 @@ struct pte_freelist_batch
 	pgtable_free_t	tables[0];
 };
 
-DEFINE_PER_CPU(struct pte_freelist_batch *, pte_freelist_cur);
-unsigned long pte_freelist_forced_free;
-
 #define PTE_FREELIST_SIZE \
 	((PAGE_SIZE - sizeof(struct pte_freelist_batch)) \
 	  / sizeof(pgtable_free_t))
-- 
1.5.5

^ permalink raw reply related

* [PATCH 05/12] sysdev/mpic_msi.c should include sysdev/mpic.h
From: Michael Ellerman @ 2008-05-08  4:27 UTC (permalink / raw)
  To: linuxppc-dev
In-Reply-To: <5d2ed2a7e92250bdc6d9959dbeaeb3784a7109b4.1210220828.git.michael@ellerman.id.au>

Some of the routines defined in mpic_msi.c are declared mpic.h,
so the former should include the latter.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
---
 arch/powerpc/sysdev/mpic_msi.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/sysdev/mpic_msi.c b/arch/powerpc/sysdev/mpic_msi.c
index d272a52..de3e5e8 100644
--- a/arch/powerpc/sysdev/mpic_msi.c
+++ b/arch/powerpc/sysdev/mpic_msi.c
@@ -16,6 +16,7 @@
 #include <asm/hw_irq.h>
 #include <asm/ppc-pci.h>
 
+#include <sysdev/mpic.h>
 
 static void __mpic_msi_reserve_hwirq(struct mpic *mpic, irq_hw_number_t hwirq)
 {
-- 
1.5.5

^ permalink raw reply related

* [PATCH 06/12] Add a declaration for xmon()
From: Michael Ellerman @ 2008-05-08  4:27 UTC (permalink / raw)
  To: linuxppc-dev
In-Reply-To: <5d2ed2a7e92250bdc6d9959dbeaeb3784a7109b4.1210220828.git.michael@ellerman.id.au>

Usually we call xmon() via debugger(), so this could be static.
Sometimes when debugging it's nice to be able to call xmon()
directly though, so add a declaration.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
---
 include/asm-powerpc/xmon.h |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/include/asm-powerpc/xmon.h b/include/asm-powerpc/xmon.h
index 88320a0..81477f2 100644
--- a/include/asm-powerpc/xmon.h
+++ b/include/asm-powerpc/xmon.h
@@ -15,6 +15,8 @@
 #ifdef CONFIG_XMON
 extern void xmon_setup(void);
 extern void xmon_register_spus(struct list_head *list);
+struct pt_regs;
+extern int xmon(struct pt_regs *excp);
 #else
 static inline void xmon_setup(void) { };
 static inline void xmon_register_spus(struct list_head *list) { };
-- 
1.5.5

^ permalink raw reply related

* [PATCH 07/12] Move xmon_irq() declaration into xmon.h
From: Michael Ellerman @ 2008-05-08  4:27 UTC (permalink / raw)
  To: linuxppc-dev
In-Reply-To: <5d2ed2a7e92250bdc6d9959dbeaeb3784a7109b4.1210220828.git.michael@ellerman.id.au>

The typdef for irqreturn_t was moved into its own header a
while back, so there's no reason we can't move xmon_irq()
into xmon.h now.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
---
 arch/powerpc/platforms/chrp/setup.c   |    7 -------
 arch/powerpc/platforms/powermac/pic.c |    8 +-------
 include/asm-powerpc/xmon.h            |    3 +++
 3 files changed, 4 insertions(+), 14 deletions(-)

diff --git a/arch/powerpc/platforms/chrp/setup.c b/arch/powerpc/platforms/chrp/setup.c
index 116babb..1ba7ce5 100644
--- a/arch/powerpc/platforms/chrp/setup.c
+++ b/arch/powerpc/platforms/chrp/setup.c
@@ -63,13 +63,6 @@ static struct mpic *chrp_mpic;
 DEFINE_PER_CPU(struct timer_list, heartbeat_timer);
 unsigned long event_scan_interval;
 
-/*
- * XXX this should be in xmon.h, but putting it there means xmon.h
- * has to include <linux/interrupt.h> (to get irqreturn_t), which
- * causes all sorts of problems.  -- paulus
- */
-extern irqreturn_t xmon_irq(int, void *);
-
 extern unsigned long loops_per_jiffy;
 
 /* To be replaced by RTAS when available */
diff --git a/arch/powerpc/platforms/powermac/pic.c b/arch/powerpc/platforms/powermac/pic.c
index 829b8b0..6d149ae 100644
--- a/arch/powerpc/platforms/powermac/pic.c
+++ b/arch/powerpc/platforms/powermac/pic.c
@@ -34,16 +34,10 @@
 #include <asm/time.h>
 #include <asm/pmac_feature.h>
 #include <asm/mpic.h>
+#include <asm/xmon.h>
 
 #include "pmac.h"
 
-/*
- * XXX this should be in xmon.h, but putting it there means xmon.h
- * has to include <linux/interrupt.h> (to get irqreturn_t), which
- * causes all sorts of problems.  -- paulus
- */
-extern irqreturn_t xmon_irq(int, void *);
-
 #ifdef CONFIG_PPC32
 struct pmac_irq_hw {
         unsigned int    event;
diff --git a/include/asm-powerpc/xmon.h b/include/asm-powerpc/xmon.h
index 81477f2..d83da3c 100644
--- a/include/asm-powerpc/xmon.h
+++ b/include/asm-powerpc/xmon.h
@@ -12,11 +12,14 @@
 
 #ifdef __KERNEL__
 
+#include <linux/irqreturn.h>
+
 #ifdef CONFIG_XMON
 extern void xmon_setup(void);
 extern void xmon_register_spus(struct list_head *list);
 struct pt_regs;
 extern int xmon(struct pt_regs *excp);
+extern irqreturn_t xmon_irq(int, void *);
 #else
 static inline void xmon_setup(void) { };
 static inline void xmon_register_spus(struct list_head *list) { };
-- 
1.5.5

^ permalink raw reply related

* [PATCH 08/12] Fix sparse warnings in xmon.c
From: Michael Ellerman @ 2008-05-08  4:27 UTC (permalink / raw)
  To: linuxppc-dev
In-Reply-To: <5d2ed2a7e92250bdc6d9959dbeaeb3784a7109b4.1210220828.git.michael@ellerman.id.au>

 warning: Using plain integer as NULL pointer
 warning: Using plain integer as NULL pointer
 warning: symbol 'excprint' was not declared. Should it be static?
 warning: symbol 'prregs' was not declared. Should it be static?
 warning: symbol 'cacheflush' was not declared. Should it be static?
 warning: symbol 'read_spr' was not declared. Should it be static?
 warning: symbol 'write_spr' was not declared. Should it be static?
 warning: symbol 'super_regs' was not declared. Should it be static?
 warning: symbol 'mread' was not declared. Should it be static?
 warning: symbol 'mwrite' was not declared. Should it be static?
 warning: symbol 'byterev' was not declared. Should it be static?
 warning: symbol 'memex' was not declared. Should it be static?
 warning: symbol 'bsesc' was not declared. Should it be static?
 warning: symbol 'dump' was not declared. Should it be static?
 warning: symbol 'prdump' was not declared. Should it be static?
 warning: symbol 'generic_inst_dump' was not declared. Should it be static?
 warning: symbol 'ppc_inst_dump' was not declared. Should it be static?
 warning: symbol 'memops' was not declared. Should it be static?
 warning: symbol 'memdiffs' was not declared. Should it be static?
 warning: symbol 'memlocate' was not declared. Should it be static?
 warning: symbol 'memzcan' was not declared. Should it be static?
 warning: symbol 'proccall' was not declared. Should it be static?
 warning: symbol 'scannl' was not declared. Should it be static?
 warning: symbol 'hexdigit' was not declared. Should it be static?
 warning: symbol 'flush_input' was not declared. Should it be static?
 warning: symbol 'inchar' was not declared. Should it be static?
 warning: symbol 'take_input' was not declared. Should it be static?
 warning: symbol 'xmon_init' was not declared. Should it be static?

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
---
 arch/powerpc/xmon/xmon.c |   59 +++++++++++++++++++++++----------------------
 1 files changed, 30 insertions(+), 29 deletions(-)

diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
index 52c7478..2f57850 100644
--- a/arch/powerpc/xmon/xmon.c
+++ b/arch/powerpc/xmon/xmon.c
@@ -154,7 +154,7 @@ static int do_spu_cmd(void);
 static void dump_tlb_44x(void);
 #endif
 
-int xmon_no_auto_backtrace;
+static int xmon_no_auto_backtrace;
 
 extern void xmon_enter(void);
 extern void xmon_leave(void);
@@ -593,7 +593,7 @@ static int xmon_iabr_match(struct pt_regs *regs)
 {
 	if ((regs->msr & (MSR_IR|MSR_PR|MSR_SF)) != (MSR_IR|MSR_SF))
 		return 0;
-	if (iabr == 0)
+	if (iabr == NULL)
 		return 0;
 	xmon_core(regs, 0);
 	return 1;
@@ -1142,7 +1142,7 @@ bpt_cmds(void)
 		} else {
 			/* assume a breakpoint address */
 			bp = at_breakpoint(a);
-			if (bp == 0) {
+			if (bp == NULL) {
 				printf("No breakpoint at %x\n", a);
 				break;
 			}
@@ -1370,7 +1370,7 @@ static void print_bug_trap(struct pt_regs *regs)
 #endif
 }
 
-void excprint(struct pt_regs *fp)
+static void excprint(struct pt_regs *fp)
 {
 	unsigned long trap;
 
@@ -1408,7 +1408,7 @@ void excprint(struct pt_regs *fp)
 		print_bug_trap(fp);
 }
 
-void prregs(struct pt_regs *fp)
+static void prregs(struct pt_regs *fp)
 {
 	int n, trap;
 	unsigned long base;
@@ -1463,7 +1463,7 @@ void prregs(struct pt_regs *fp)
 		printf("dar = "REG"   dsisr = %.8lx\n", fp->dar, fp->dsisr);
 }
 
-void cacheflush(void)
+static void cacheflush(void)
 {
 	int cmd;
 	unsigned long nflush;
@@ -1495,7 +1495,7 @@ void cacheflush(void)
 	catch_memory_errors = 0;
 }
 
-unsigned long
+static unsigned long
 read_spr(int n)
 {
 	unsigned int instrs[2];
@@ -1533,7 +1533,7 @@ read_spr(int n)
 	return ret;
 }
 
-void
+static void
 write_spr(int n, unsigned long val)
 {
 	unsigned int instrs[2];
@@ -1571,7 +1571,7 @@ static unsigned long regno;
 extern char exc_prolog;
 extern char dec_exc;
 
-void super_regs(void)
+static void super_regs(void)
 {
 	int cmd;
 	unsigned long val;
@@ -1629,7 +1629,7 @@ void super_regs(void)
 /*
  * Stuff for reading and writing memory safely
  */
-int
+static int
 mread(unsigned long adrs, void *buf, int size)
 {
 	volatile int n;
@@ -1666,7 +1666,7 @@ mread(unsigned long adrs, void *buf, int size)
 	return n;
 }
 
-int
+static int
 mwrite(unsigned long adrs, void *buf, int size)
 {
 	volatile int n;
@@ -1731,7 +1731,7 @@ static int handle_fault(struct pt_regs *regs)
 
 #define SWAP(a, b, t)	((t) = (a), (a) = (b), (b) = (t))
 
-void
+static void
 byterev(unsigned char *val, int size)
 {
 	int t;
@@ -1793,7 +1793,7 @@ static char *memex_subcmd_help_string =
     "  x        exit this mode\n"
     "";
 
-void
+static void
 memex(void)
 {
 	int cmd, inc, i, nslash;
@@ -1944,7 +1944,7 @@ memex(void)
 	}
 }
 
-int
+static int
 bsesc(void)
 {
 	int c;
@@ -1984,7 +1984,7 @@ static void xmon_rawdump (unsigned long adrs, long ndump)
 #define isxdigit(c)	(('0' <= (c) && (c) <= '9') \
 			 || ('a' <= (c) && (c) <= 'f') \
 			 || ('A' <= (c) && (c) <= 'F'))
-void
+static void
 dump(void)
 {
 	int c;
@@ -2022,7 +2022,7 @@ dump(void)
 	}
 }
 
-void
+static void
 prdump(unsigned long adrs, long ndump)
 {
 	long n, m, c, r, nr;
@@ -2066,7 +2066,7 @@ prdump(unsigned long adrs, long ndump)
 
 typedef int (*instruction_dump_func)(unsigned long inst, unsigned long addr);
 
-int
+static int
 generic_inst_dump(unsigned long adr, long count, int praddr,
 			instruction_dump_func dump_func)
 {
@@ -2104,7 +2104,7 @@ generic_inst_dump(unsigned long adr, long count, int praddr,
 	return adr - first_adr;
 }
 
-int
+static int
 ppc_inst_dump(unsigned long adr, long count, int praddr)
 {
 	return generic_inst_dump(adr, count, praddr, print_insn_powerpc);
@@ -2126,7 +2126,7 @@ static unsigned long mval;		/* byte value to set memory to */
 static unsigned long mcount;		/* # bytes to affect */
 static unsigned long mdiffs;		/* max # differences to print */
 
-void
+static void
 memops(int cmd)
 {
 	scanhex((void *)&mdest);
@@ -2152,7 +2152,7 @@ memops(int cmd)
 	}
 }
 
-void
+static void
 memdiffs(unsigned char *p1, unsigned char *p2, unsigned nb, unsigned maxpr)
 {
 	unsigned n, prt;
@@ -2170,7 +2170,7 @@ memdiffs(unsigned char *p1, unsigned char *p2, unsigned nb, unsigned maxpr)
 static unsigned mend;
 static unsigned mask;
 
-void
+static void
 memlocate(void)
 {
 	unsigned a, n;
@@ -2203,7 +2203,7 @@ memlocate(void)
 static unsigned long mskip = 0x1000;
 static unsigned long mlim = 0xffffffff;
 
-void
+static void
 memzcan(void)
 {
 	unsigned char v;
@@ -2230,7 +2230,7 @@ memzcan(void)
 		printf("%.8x\n", a - mskip);
 }
 
-void proccall(void)
+static void proccall(void)
 {
 	unsigned long args[8];
 	unsigned long ret;
@@ -2388,7 +2388,7 @@ scanhex(unsigned long *vp)
 	return 1;
 }
 
-void
+static void
 scannl(void)
 {
 	int c;
@@ -2399,7 +2399,7 @@ scannl(void)
 		c = inchar();
 }
 
-int hexdigit(int c)
+static int hexdigit(int c)
 {
 	if( '0' <= c && c <= '9' )
 		return c - '0';
@@ -2430,13 +2430,13 @@ getstring(char *s, int size)
 static char line[256];
 static char *lineptr;
 
-void
+static void
 flush_input(void)
 {
 	lineptr = NULL;
 }
 
-int
+static int
 inchar(void)
 {
 	if (lineptr == NULL || *lineptr == 0) {
@@ -2449,7 +2449,7 @@ inchar(void)
 	return *lineptr++;
 }
 
-void
+static void
 take_input(char *str)
 {
 	lineptr = str;
@@ -2618,7 +2618,8 @@ static void dump_tlb_44x(void)
 	}
 }
 #endif /* CONFIG_44x */
-void xmon_init(int enable)
+
+static void xmon_init(int enable)
 {
 #ifdef CONFIG_PPC_ISERIES
 	if (firmware_has_feature(FW_FEATURE_ISERIES))
-- 
1.5.5

^ permalink raw reply related

* [PATCH 09/12] Make cpus_in_xmon static and remove extern mess from hvc_console.c
From: Michael Ellerman @ 2008-05-08  4:27 UTC (permalink / raw)
  To: linuxppc-dev
In-Reply-To: <5d2ed2a7e92250bdc6d9959dbeaeb3784a7109b4.1210220828.git.michael@ellerman.id.au>

This is a little messier than I'd like because xmon.h only exists
on powerpc and we can't have a static inline and an extern declaration
visible at the same time.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
---
 arch/powerpc/xmon/xmon.c   |    7 ++++++-
 drivers/char/hvc_console.c |    8 +-------
 drivers/char/hvc_console.h |   10 ++++++++++
 include/asm-powerpc/xmon.h |    4 ++++
 4 files changed, 21 insertions(+), 8 deletions(-)

diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
index 2f57850..863ba0a 100644
--- a/arch/powerpc/xmon/xmon.c
+++ b/arch/powerpc/xmon/xmon.c
@@ -54,7 +54,7 @@
 #define skipbl	xmon_skipbl
 
 #ifdef CONFIG_SMP
-cpumask_t cpus_in_xmon = CPU_MASK_NONE;
+static cpumask_t cpus_in_xmon = CPU_MASK_NONE;
 static unsigned long xmon_taken = 1;
 static int xmon_owner;
 static int xmon_gate;
@@ -327,6 +327,11 @@ static void release_output_lock(void)
 {
 	xmon_speaker = 0;
 }
+
+int cpus_are_in_xmon(void)
+{
+	return !cpus_empty(cpus_in_xmon);
+}
 #endif
 
 static int xmon_core(struct pt_regs *regs, int fromipi)
diff --git a/drivers/char/hvc_console.c b/drivers/char/hvc_console.c
index 44160d5..2f9759d 100644
--- a/drivers/char/hvc_console.c
+++ b/drivers/char/hvc_console.c
@@ -675,12 +675,6 @@ static int hvc_poll(struct hvc_struct *hp)
 	return poll_mask;
 }
 
-#if defined(CONFIG_XMON) && defined(CONFIG_SMP)
-extern cpumask_t cpus_in_xmon;
-#else
-static const cpumask_t cpus_in_xmon = CPU_MASK_NONE;
-#endif
-
 /*
  * This kthread is either polling or interrupt driven.  This is determined by
  * calling hvc_poll() who determines whether a console adapter support
@@ -698,7 +692,7 @@ static int khvcd(void *unused)
 		hvc_kicked = 0;
 		try_to_freeze();
 		wmb();
-		if (cpus_empty(cpus_in_xmon)) {
+		if (!cpus_are_in_xmon()) {
 			spin_lock(&hvc_structs_lock);
 			list_for_each_entry(hp, &hvc_structs, next) {
 				poll_mask |= hvc_poll(hp);
diff --git a/drivers/char/hvc_console.h b/drivers/char/hvc_console.h
index 8c59818..42ffb17 100644
--- a/drivers/char/hvc_console.h
+++ b/drivers/char/hvc_console.h
@@ -60,4 +60,14 @@ extern struct hvc_struct * __devinit hvc_alloc(uint32_t vtermno, int irq,
 /* remove a vterm from hvc tty operation (modele_exit or hotplug remove) */
 extern int __devexit hvc_remove(struct hvc_struct *hp);
 
+
+#if defined(CONFIG_XMON) && defined(CONFIG_SMP)
+#include <asm/xmon.h>
+#else
+static inline int cpus_are_in_xmon(void)
+{
+	return 0;
+}
+#endif
+
 #endif // HVC_CONSOLE_H
diff --git a/include/asm-powerpc/xmon.h b/include/asm-powerpc/xmon.h
index d83da3c..5eb8e59 100644
--- a/include/asm-powerpc/xmon.h
+++ b/include/asm-powerpc/xmon.h
@@ -25,5 +25,9 @@ static inline void xmon_setup(void) { };
 static inline void xmon_register_spus(struct list_head *list) { };
 #endif
 
+#if defined(CONFIG_XMON) && defined(CONFIG_SMP)
+extern int cpus_are_in_xmon(void);
+#endif
+
 #endif /* __KERNEL __ */
 #endif /* __ASM_POWERPC_XMON_H */
-- 
1.5.5

^ permalink raw reply related

* [PATCH 10/12] Fix sparse warnings in arch/powerpc/kernel
From: Michael Ellerman @ 2008-05-08  4:27 UTC (permalink / raw)
  To: linuxppc-dev
In-Reply-To: <5d2ed2a7e92250bdc6d9959dbeaeb3784a7109b4.1210220828.git.michael@ellerman.id.au>

Make a few things static in lparcfg.c
Make init and exit routines static in rtas_flash.c
Make things static in rtas_pci.c
Make some functions static in rtas.c
Make fops static in rtas-proc.c
Remove unneeded extern for do_gtod in smp.c
Make clocksource_init() static in time.c
Make last_tick_len and ticklen_to_xs static in time.c
Move the declaration of the pvr per-cpu into smp.h
Make kexec_smp_down() and kexec_stack static in machine_kexec_64.c
Don't return void in arch_teardown_msi_irqs() in msi.c
Move declaration of GregorianDay()into asm/time.h

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
---
 arch/powerpc/kernel/lparcfg.c          |    6 +++---
 arch/powerpc/kernel/machine_kexec_64.c |    4 ++--
 arch/powerpc/kernel/msi.c              |    2 +-
 arch/powerpc/kernel/rtas-proc.c        |   14 +++++++-------
 arch/powerpc/kernel/rtas.c             |    6 +++---
 arch/powerpc/kernel/rtas_flash.c       |    4 ++--
 arch/powerpc/kernel/rtas_pci.c         |    4 ++--
 arch/powerpc/kernel/smp.c              |    4 ----
 arch/powerpc/kernel/time.c             |   10 +++++-----
 arch/powerpc/platforms/maple/time.c    |    2 --
 include/asm-powerpc/smp.h              |    2 ++
 include/asm-powerpc/time.h             |    1 +
 12 files changed, 28 insertions(+), 31 deletions(-)

diff --git a/arch/powerpc/kernel/lparcfg.c b/arch/powerpc/kernel/lparcfg.c
index 1e656b4..827a572 100644
--- a/arch/powerpc/kernel/lparcfg.c
+++ b/arch/powerpc/kernel/lparcfg.c
@@ -573,7 +573,7 @@ static int lparcfg_open(struct inode *inode, struct file *file)
 	return single_open(file, lparcfg_data, NULL);
 }
 
-const struct file_operations lparcfg_fops = {
+static const struct file_operations lparcfg_fops = {
 	.owner		= THIS_MODULE,
 	.read		= seq_read,
 	.write		= lparcfg_write,
@@ -581,7 +581,7 @@ const struct file_operations lparcfg_fops = {
 	.release	= single_release,
 };
 
-int __init lparcfg_init(void)
+static int __init lparcfg_init(void)
 {
 	struct proc_dir_entry *ent;
 	mode_t mode = S_IRUSR | S_IRGRP | S_IROTH;
@@ -601,7 +601,7 @@ int __init lparcfg_init(void)
 	return 0;
 }
 
-void __exit lparcfg_cleanup(void)
+static void __exit lparcfg_cleanup(void)
 {
 	if (proc_ppc64_lparcfg)
 		remove_proc_entry("lparcfg", proc_ppc64_lparcfg->parent);
diff --git a/arch/powerpc/kernel/machine_kexec_64.c b/arch/powerpc/kernel/machine_kexec_64.c
index 704375b..631dfd6 100644
--- a/arch/powerpc/kernel/machine_kexec_64.c
+++ b/arch/powerpc/kernel/machine_kexec_64.c
@@ -158,7 +158,7 @@ void kexec_copy_flush(struct kimage *image)
  * on calling the interrupts, but we would like to call it off irq level
  * so that the interrupt controller is clean.
  */
-void kexec_smp_down(void *arg)
+static void kexec_smp_down(void *arg)
 {
 	if (ppc_md.kexec_cpu_down)
 		ppc_md.kexec_cpu_down(0, 1);
@@ -249,7 +249,7 @@ static void kexec_prepare_cpus(void)
  * We could use a smaller stack if we don't care about anything using
  * current, but that audit has not been performed.
  */
-union thread_union kexec_stack
+static union thread_union kexec_stack
 	__attribute__((__section__(".data.init_task"))) = { };
 
 /* Our assembly helper, in kexec_stub.S */
diff --git a/arch/powerpc/kernel/msi.c b/arch/powerpc/kernel/msi.c
index c62d101..3bb7d3d 100644
--- a/arch/powerpc/kernel/msi.c
+++ b/arch/powerpc/kernel/msi.c
@@ -34,5 +34,5 @@ int arch_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
 
 void arch_teardown_msi_irqs(struct pci_dev *dev)
 {
-	return ppc_md.teardown_msi_irqs(dev);
+	ppc_md.teardown_msi_irqs(dev);
 }
diff --git a/arch/powerpc/kernel/rtas-proc.c b/arch/powerpc/kernel/rtas-proc.c
index f9c6abc..1be9fe3 100644
--- a/arch/powerpc/kernel/rtas-proc.c
+++ b/arch/powerpc/kernel/rtas-proc.c
@@ -160,7 +160,7 @@ static int sensors_open(struct inode *inode, struct file *file)
 	return single_open(file, ppc_rtas_sensors_show, NULL);
 }
 
-const struct file_operations ppc_rtas_sensors_operations = {
+static const struct file_operations ppc_rtas_sensors_operations = {
 	.open		= sensors_open,
 	.read		= seq_read,
 	.llseek		= seq_lseek,
@@ -172,7 +172,7 @@ static int poweron_open(struct inode *inode, struct file *file)
 	return single_open(file, ppc_rtas_poweron_show, NULL);
 }
 
-const struct file_operations ppc_rtas_poweron_operations = {
+static const struct file_operations ppc_rtas_poweron_operations = {
 	.open		= poweron_open,
 	.read		= seq_read,
 	.llseek		= seq_lseek,
@@ -185,7 +185,7 @@ static int progress_open(struct inode *inode, struct file *file)
 	return single_open(file, ppc_rtas_progress_show, NULL);
 }
 
-const struct file_operations ppc_rtas_progress_operations = {
+static const struct file_operations ppc_rtas_progress_operations = {
 	.open		= progress_open,
 	.read		= seq_read,
 	.llseek		= seq_lseek,
@@ -198,7 +198,7 @@ static int clock_open(struct inode *inode, struct file *file)
 	return single_open(file, ppc_rtas_clock_show, NULL);
 }
 
-const struct file_operations ppc_rtas_clock_operations = {
+static const struct file_operations ppc_rtas_clock_operations = {
 	.open		= clock_open,
 	.read		= seq_read,
 	.llseek		= seq_lseek,
@@ -211,7 +211,7 @@ static int tone_freq_open(struct inode *inode, struct file *file)
 	return single_open(file, ppc_rtas_tone_freq_show, NULL);
 }
 
-const struct file_operations ppc_rtas_tone_freq_operations = {
+static const struct file_operations ppc_rtas_tone_freq_operations = {
 	.open		= tone_freq_open,
 	.read		= seq_read,
 	.llseek		= seq_lseek,
@@ -224,7 +224,7 @@ static int tone_volume_open(struct inode *inode, struct file *file)
 	return single_open(file, ppc_rtas_tone_volume_show, NULL);
 }
 
-const struct file_operations ppc_rtas_tone_volume_operations = {
+static const struct file_operations ppc_rtas_tone_volume_operations = {
 	.open		= tone_volume_open,
 	.read		= seq_read,
 	.llseek		= seq_lseek,
@@ -237,7 +237,7 @@ static int rmo_buf_open(struct inode *inode, struct file *file)
 	return single_open(file, ppc_rtas_rmo_buf_show, NULL);
 }
 
-const struct file_operations ppc_rtas_rmo_buf_ops = {
+static const struct file_operations ppc_rtas_rmo_buf_ops = {
 	.open		= rmo_buf_open,
 	.read		= seq_read,
 	.llseek		= seq_lseek,
diff --git a/arch/powerpc/kernel/rtas.c b/arch/powerpc/kernel/rtas.c
index 34843c3..2a60bd3 100644
--- a/arch/powerpc/kernel/rtas.c
+++ b/arch/powerpc/kernel/rtas.c
@@ -340,8 +340,8 @@ int rtas_get_error_log_max(void)
 EXPORT_SYMBOL(rtas_get_error_log_max);
 
 
-char rtas_err_buf[RTAS_ERROR_LOG_MAX];
-int rtas_last_error_token;
+static char rtas_err_buf[RTAS_ERROR_LOG_MAX];
+static int rtas_last_error_token;
 
 /** Return a copy of the detailed error text associated with the
  *  most recent failed call to rtas.  Because the error text
@@ -484,7 +484,7 @@ unsigned int rtas_busy_delay(int status)
 }
 EXPORT_SYMBOL(rtas_busy_delay);
 
-int rtas_error_rc(int rtas_rc)
+static int rtas_error_rc(int rtas_rc)
 {
 	int rc;
 
diff --git a/arch/powerpc/kernel/rtas_flash.c b/arch/powerpc/kernel/rtas_flash.c
index 0a5e22b..09ded5c 100644
--- a/arch/powerpc/kernel/rtas_flash.c
+++ b/arch/powerpc/kernel/rtas_flash.c
@@ -731,7 +731,7 @@ static const struct file_operations validate_flash_operations = {
 	.release	= validate_flash_release,
 };
 
-int __init rtas_flash_init(void)
+static int __init rtas_flash_init(void)
 {
 	int rc;
 
@@ -817,7 +817,7 @@ cleanup:
 	return rc;
 }
 
-void __exit rtas_flash_cleanup(void)
+static void __exit rtas_flash_cleanup(void)
 {
 	rtas_flash_term_hook = NULL;
 
diff --git a/arch/powerpc/kernel/rtas_pci.c b/arch/powerpc/kernel/rtas_pci.c
index 3ab88a9..589a279 100644
--- a/arch/powerpc/kernel/rtas_pci.c
+++ b/arch/powerpc/kernel/rtas_pci.c
@@ -155,12 +155,12 @@ static int rtas_pci_write_config(struct pci_bus *bus,
 	return PCIBIOS_DEVICE_NOT_FOUND;
 }
 
-struct pci_ops rtas_pci_ops = {
+static struct pci_ops rtas_pci_ops = {
 	.read = rtas_pci_read_config,
 	.write = rtas_pci_write_config,
 };
 
-int is_python(struct device_node *dev)
+static int is_python(struct device_node *dev)
 {
 	const char *model = of_get_property(dev, "model", NULL);
 
diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
index 1457aa0..ba7989f 100644
--- a/arch/powerpc/kernel/smp.c
+++ b/arch/powerpc/kernel/smp.c
@@ -365,12 +365,8 @@ void smp_call_function_interrupt(void)
 	}
 }
 
-extern struct gettimeofday_struct do_gtod;
-
 struct thread_info *current_set[NR_CPUS];
 
-DECLARE_PER_CPU(unsigned int, pvr);
-
 static void __devinit smp_store_cpu_info(int id)
 {
 	per_cpu(pvr, id) = mfspr(SPRN_PVR);
diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c
index 73401e8..c73fc33 100644
--- a/arch/powerpc/kernel/time.c
+++ b/arch/powerpc/kernel/time.c
@@ -129,7 +129,7 @@ static unsigned long __initdata iSeries_recal_titan;
 static signed long __initdata iSeries_recal_tb;
 
 /* Forward declaration is only needed for iSereis compiles */
-void __init clocksource_init(void);
+static void __init clocksource_init(void);
 #endif
 
 #define XSEC_PER_SEC (1024*1024)
@@ -150,8 +150,8 @@ u64 tb_to_xs;
 unsigned tb_to_us;
 
 #define TICKLEN_SCALE	NTP_SCALE_SHIFT
-u64 last_tick_len;	/* units are ns / 2^TICKLEN_SCALE */
-u64 ticklen_to_xs;	/* 0.64 fraction */
+static u64 last_tick_len;	/* units are ns / 2^TICKLEN_SCALE */
+static u64 ticklen_to_xs;	/* 0.64 fraction */
 
 /* If last_tick_len corresponds to about 1/HZ seconds, then
    last_tick_len << TICKLEN_SHIFT will be about 2^63. */
@@ -164,7 +164,7 @@ static u64 tb_to_ns_scale __read_mostly;
 static unsigned tb_to_ns_shift __read_mostly;
 static unsigned long boot_tb __read_mostly;
 
-struct gettimeofday_struct do_gtod;
+static struct gettimeofday_struct do_gtod;
 
 extern struct timezone sys_tz;
 static long timezone_offset;
@@ -832,7 +832,7 @@ void update_vsyscall_tz(void)
 	++vdso_data->tb_update_count;
 }
 
-void __init clocksource_init(void)
+static void __init clocksource_init(void)
 {
 	struct clocksource *clock;
 
diff --git a/arch/powerpc/platforms/maple/time.c b/arch/powerpc/platforms/maple/time.c
index 9f7579b..53bca13 100644
--- a/arch/powerpc/platforms/maple/time.c
+++ b/arch/powerpc/platforms/maple/time.c
@@ -41,8 +41,6 @@
 #define DBG(x...)
 #endif
 
-extern void GregorianDay(struct rtc_time * tm);
-
 static int maple_rtc_addr;
 
 static int maple_clock_read(int addr)
diff --git a/include/asm-powerpc/smp.h b/include/asm-powerpc/smp.h
index 505f35b..1cd43e3 100644
--- a/include/asm-powerpc/smp.h
+++ b/include/asm-powerpc/smp.h
@@ -37,6 +37,8 @@ extern void cpu_die(void);
 extern void smp_send_debugger_break(int cpu);
 extern void smp_message_recv(int);
 
+DECLARE_PER_CPU(unsigned int, pvr);
+
 #ifdef CONFIG_HOTPLUG_CPU
 extern void fixup_irqs(cpumask_t map);
 int generic_cpu_disable(void);
diff --git a/include/asm-powerpc/time.h b/include/asm-powerpc/time.h
index ce5de6e..febd581 100644
--- a/include/asm-powerpc/time.h
+++ b/include/asm-powerpc/time.h
@@ -33,6 +33,7 @@ extern unsigned      tb_to_us;
 
 struct rtc_time;
 extern void to_tm(int tim, struct rtc_time * tm);
+extern void GregorianDay(struct rtc_time *tm);
 extern time_t last_rtc_update;
 
 extern void generic_calibrate_decr(void);
-- 
1.5.5

^ permalink raw reply related

* [PATCH 11/12] pseries/firmware.c should include pseries/pseries.h
From: Michael Ellerman @ 2008-05-08  4:27 UTC (permalink / raw)
  To: linuxppc-dev
In-Reply-To: <5d2ed2a7e92250bdc6d9959dbeaeb3784a7109b4.1210220828.git.michael@ellerman.id.au>

The declaration for fw_feature_init() is in pseries.h and
implemented in firmware.c, so the latter should include the
former.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
---
 arch/powerpc/platforms/pseries/firmware.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/platforms/pseries/firmware.c b/arch/powerpc/platforms/pseries/firmware.c
index 9d3a40f..5a707da 100644
--- a/arch/powerpc/platforms/pseries/firmware.c
+++ b/arch/powerpc/platforms/pseries/firmware.c
@@ -26,6 +26,7 @@
 #include <asm/prom.h>
 #include <asm/udbg.h>
 
+#include "pseries.h"
 
 typedef struct {
     unsigned long val;
-- 
1.5.5

^ permalink raw reply related

* [PATCH 12/12] Fix sparse warnings in arch/powerpc/platforms/pseries
From: Michael Ellerman @ 2008-05-08  4:27 UTC (permalink / raw)
  To: linuxppc-dev
In-Reply-To: <5d2ed2a7e92250bdc6d9959dbeaeb3784a7109b4.1210220828.git.michael@ellerman.id.au>

Don't return void in pseries/iommu.c
Make mce_data_buf static in pseries/ras.c
Make things static in pseries/rtasd.c
Make things static in pseries/setup.c
vtermno may as well be static in platforms/pseries/lpar.c

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
---
 arch/powerpc/platforms/pseries/iommu.c |   15 +++++++++------
 arch/powerpc/platforms/pseries/lpar.c  |    2 +-
 arch/powerpc/platforms/pseries/ras.c   |    2 +-
 arch/powerpc/platforms/pseries/rtasd.c |    4 ++--
 arch/powerpc/platforms/pseries/setup.c |    4 ++--
 5 files changed, 15 insertions(+), 12 deletions(-)

diff --git a/arch/powerpc/platforms/pseries/iommu.c b/arch/powerpc/platforms/pseries/iommu.c
index 176f1f3..9a12908 100644
--- a/arch/powerpc/platforms/pseries/iommu.c
+++ b/arch/powerpc/platforms/pseries/iommu.c
@@ -135,9 +135,10 @@ static void tce_buildmulti_pSeriesLP(struct iommu_table *tbl, long tcenum,
 	u64 rpn;
 	long l, limit;
 
-	if (npages == 1)
-		return tce_build_pSeriesLP(tbl, tcenum, npages, uaddr,
-					   direction);
+	if (npages == 1) {
+		tce_build_pSeriesLP(tbl, tcenum, npages, uaddr, direction);
+		return;
+	}
 
 	tcep = __get_cpu_var(tce_page);
 
@@ -147,9 +148,11 @@ static void tce_buildmulti_pSeriesLP(struct iommu_table *tbl, long tcenum,
 	if (!tcep) {
 		tcep = (u64 *)__get_free_page(GFP_ATOMIC);
 		/* If allocation fails, fall back to the loop implementation */
-		if (!tcep)
-			return tce_build_pSeriesLP(tbl, tcenum, npages,
-						   uaddr, direction);
+		if (!tcep) {
+			tce_build_pSeriesLP(tbl, tcenum, npages, uaddr,
+					    direction);
+			return;
+		}
 		__get_cpu_var(tce_page) = tcep;
 	}
 
diff --git a/arch/powerpc/platforms/pseries/lpar.c b/arch/powerpc/platforms/pseries/lpar.c
index 2cbaedb..3b4651b 100644
--- a/arch/powerpc/platforms/pseries/lpar.c
+++ b/arch/powerpc/platforms/pseries/lpar.c
@@ -52,7 +52,7 @@ EXPORT_SYMBOL(plpar_hcall_norets);
 extern void pSeries_find_serial_port(void);
 
 
-int vtermno;	/* virtual terminal# for udbg  */
+static int vtermno;	/* virtual terminal# for udbg  */
 
 #define __ALIGNED__ __attribute__((__aligned__(sizeof(long))))
 static void udbg_hvsi_putc(char c)
diff --git a/arch/powerpc/platforms/pseries/ras.c b/arch/powerpc/platforms/pseries/ras.c
index 2b548af..d20b96e 100644
--- a/arch/powerpc/platforms/pseries/ras.c
+++ b/arch/powerpc/platforms/pseries/ras.c
@@ -55,7 +55,7 @@
 static unsigned char ras_log_buf[RTAS_ERROR_LOG_MAX];
 static DEFINE_SPINLOCK(ras_log_buf_lock);
 
-char mce_data_buf[RTAS_ERROR_LOG_MAX];
+static char mce_data_buf[RTAS_ERROR_LOG_MAX];
 
 static int ras_get_sensor_state_token;
 static int ras_check_exception_token;
diff --git a/arch/powerpc/platforms/pseries/rtasd.c b/arch/powerpc/platforms/pseries/rtasd.c
index 7d3e2b0..c9ffd8c 100644
--- a/arch/powerpc/platforms/pseries/rtasd.c
+++ b/arch/powerpc/platforms/pseries/rtasd.c
@@ -32,7 +32,7 @@
 
 static DEFINE_SPINLOCK(rtasd_log_lock);
 
-DECLARE_WAIT_QUEUE_HEAD(rtas_log_wait);
+static DECLARE_WAIT_QUEUE_HEAD(rtas_log_wait);
 
 static char *rtas_log_buf;
 static unsigned long rtas_log_start;
@@ -329,7 +329,7 @@ static unsigned int rtas_log_poll(struct file *file, poll_table * wait)
 	return 0;
 }
 
-const struct file_operations proc_rtas_log_operations = {
+static const struct file_operations proc_rtas_log_operations = {
 	.read =		rtas_log_read,
 	.poll =		rtas_log_poll,
 	.open =		rtas_log_open,
diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c
index f5d29f5..90beb44 100644
--- a/arch/powerpc/platforms/pseries/setup.c
+++ b/arch/powerpc/platforms/pseries/setup.c
@@ -109,7 +109,7 @@ static void __init fwnmi_init(void)
 		fwnmi_active = 1;
 }
 
-void pseries_8259_cascade(unsigned int irq, struct irq_desc *desc)
+static void pseries_8259_cascade(unsigned int irq, struct irq_desc *desc)
 {
 	unsigned int cascade_irq = i8259_irq();
 	if (cascade_irq != NO_IRQ)
@@ -482,7 +482,7 @@ static int pSeries_pci_probe_mode(struct pci_bus *bus)
  * possible with power button press. If ibm,power-off-ups token is used
  * it will allow auto poweron after power is restored.
  */
-void pSeries_power_off(void)
+static void pSeries_power_off(void)
 {
 	int rc;
 	int rtas_poweroff_ups_token = rtas_token("ibm,power-off-ups");
-- 
1.5.5

^ permalink raw reply related

* Re: All your drivers are belong to us [was WARNING: mutexes are preferredfor single holder semaphores]
From: Sean MacLennan @ 2008-05-08  4:41 UTC (permalink / raw)
  To: linuxppc-dev
In-Reply-To: <20080507194957.47abb103@zod.rchland.ibm.com>

I have attached the driver in question below. This is *not*
representative of PIKA board drivers in general. This driver was
rewritten from scratch to work in 2.6.26, but still work on the 2.6.9
kernel in RedHatES 4.

Since it was rewritten, it matches the kernel coding specs rather than
PIKA's. Emacs users will recognize the comment at the bottom ;)

This is also a generally useful driver that does one specific thing. It
is also very small. The next smallest PIKA driver is close to 9,000
lines of code. Our largest is about 130,000 lines of code and lsmod
reports 1.6M in size.

The other board drivers are *very* specific to PIKA hardware, and are
not "chip" drivers as such. I suspect Greg was mainly talking about
chip drivers.

I use this driver all the time to write quick drivers. It handles all
the dirty work for you so you can quickly prototype character drivers.

And while the Linux driver project looks interesting, it doesn't really
help me. We still have to support all our customers, which includes
windows, and old Linux kernels. This means I would still have to
maintain the PIKA version of the driver separate from the driver
projects version.

Cheers,
   Sean

--- /dev/null	2005-11-20 22:22:37.000000000 -0500
+++ pikacore.h	2008-05-07 23:48:47.000000000 -0400
@@ -0,0 +1,39 @@
+/*
+ * PIKA Core Driver
+ *
+ * Copyright (c) 2008 PIKA Technologies
+ *   Sean MacLennan <smaclennan@pikatech.com>
+ */
+
+#ifndef PIKACORE_H
+#define PIKACORE_H
+
+#include <linux/module.h>
+#include <linux/fs.h>
+#include <linux/device.h>
+
+
+/* pikacore_register* returns a negative number on error.
+ * On success, it returns the minor number.
+ */
+int pikacore_register_board(struct file_operations *fops);
+int pikacore_register(int minor, char *name, struct file_operations *fops);
+int pikacore_unregister(int minor);
+int pikacore_device_attr(int minor, struct device_attribute *attr, void *data);
+
+
+/* Some compatibility changes. */
+
+#ifndef DEFINE_MUTEX
+#define DEFINE_MUTEX DECLARE_MUTEX
+#define mutex_lock down
+#define mutex_unlock up
+#endif
+
+#include <linux/interrupt.h>
+#ifndef IRQF_SHARED
+#define IRQF_SHARED (SA_SHIRQ | SA_INTERRUPT)
+#define IRQF_DISABLED 0
+#endif
+
+#endif
--- /dev/null	2005-11-20 22:22:37.000000000 -0500
+++ pikacore.c	2008-05-08 00:18:35.000000000 -0400
@@ -0,0 +1,261 @@
+/*
+ * PIKA Core Driver
+ *
+ * Copyright (c) 2008 PIKA Technologies
+ *   Sean MacLennan <smaclennan@pikatech.com>
+ *
+ * This driver handles all the details of creating a character device
+ * driver. It also allows us to reuse one major number for all the
+ * character device drivers.
+ */
+
+#include "pikacore.h"
+
+#include <linux/cdev.h>
+#include <linux/version.h>
+
+
+static int major;
+module_param(major, int, 0444);
+
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 13)
+/* This is really for RedHatES4 */
+#define OLD_KERNEL
+
+#define class_create class_simple_create
+#define class_destroy class_simple_destroy
+
+static inline struct class_device *device_create(struct class_simple *cls,
+						 void *parent, dev_t devt,
+						 const char *fmt, ...)
+{
+	va_list ap;
+	char tmpname[20];
+
+	va_start(ap, fmt);
+	vsnprintf(tmpname, sizeof(tmpname), fmt, ap);
+	va_end(ap);
+
+	return class_simple_device_add(cls, devt, parent, tmpname);
+}
+
+#define device_destroy(a, b) class_simple_device_remove(b)
+
+#define device class_device
+static struct class_simple *pikacore_class;
+#else
+static struct class *pikacore_class;
+#endif
+
+
+struct pk_coredevice  {
+	struct list_head list;
+	int minor;
+	struct cdev cdev;
+	struct device *device;
+};
+
+static LIST_HEAD(pikacore_list);
+static DEFINE_MUTEX(pikacore_mtx);
+
+#define MAX_MINORS 64
+static unsigned long pikacore_minors[MAX_MINORS / 8 / sizeof(unsigned long)];
+
+
+int pikacore_register(int minor, char *name, struct file_operations *fops)
+{
+	struct pk_coredevice *pika;
+	dev_t dev;
+	int err;
+
+	mutex_lock(&pikacore_mtx);
+
+	if (minor == 0)
+		minor = find_first_zero_bit(pikacore_minors, MAX_MINORS);
+
+	if (minor >= MAX_MINORS ||
+	    test_and_set_bit(minor, pikacore_minors)) {
+		mutex_unlock(&pikacore_mtx);
+		return -ENOENT;
+	}
+
+	mutex_unlock(&pikacore_mtx);
+
+	pika = kzalloc(sizeof(struct pk_coredevice), GFP_KERNEL);
+	if (!pika)
+		return -ENOMEM;
+
+	INIT_LIST_HEAD(&pika->list);
+	pika->minor = minor;
+	dev = MKDEV(major, minor);
+
+	if (name)
+		pika->device = device_create(pikacore_class, NULL, dev,
+					     "%s", name);
+	else
+		pika->device = device_create(pikacore_class, NULL, dev,
+					     "pika%d", minor);
+	if (IS_ERR(pika->device)) {
+		err = PTR_ERR(pika->device);
+		goto out;
+	}
+
+	cdev_init(&pika->cdev, fops);
+	err = cdev_add(&pika->cdev, dev, 1);
+	if (err)
+		goto out;
+
+	mutex_lock(&pikacore_mtx);
+	list_add(&pika->list, &pikacore_list);
+	mutex_unlock(&pikacore_mtx);
+
+	printk(KERN_INFO "pikacore: registered %d.%d\n", major, minor);
+
+	return minor;
+
+ out:
+	if (pika->device)
+		device_destroy(pikacore_class, MKDEV(major, minor));
+
+	kfree(pika);
+	return err;
+}
+EXPORT_SYMBOL(pikacore_register);
+
+int pikacore_register_board(struct file_operations *fops)
+{
+	return pikacore_register(0, NULL, fops);
+}
+EXPORT_SYMBOL(pikacore_register_board);
+
+/* You must have pikacore_mtx held */
+static inline struct pk_coredevice *find_by_minor(int minor)
+{
+	struct pk_coredevice *pika;
+
+	list_for_each_entry(pika, &pikacore_list, list)
+		if (pika->minor == minor)
+			return pika;
+
+	return NULL;
+}
+
+int pikacore_unregister(int minor)
+{
+	struct pk_coredevice *pika;
+
+	mutex_lock(&pikacore_mtx);
+
+	pika = find_by_minor(minor);
+	if (!pika) {
+		mutex_unlock(&pikacore_mtx);
+		return -EINVAL;
+	}
+
+	list_del(&pika->list);
+
+	clear_bit(minor, pikacore_minors);
+
+	mutex_unlock(&pikacore_mtx);
+
+	printk(KERN_INFO "pikacore: remove %d.%d\n", major, minor);
+
+	device_destroy(pikacore_class, MKDEV(major, minor));
+
+	cdev_del(&pika->cdev);
+
+	kfree(pika);
+
+	return 0;
+}
+EXPORT_SYMBOL(pikacore_unregister);
+
+int pikacore_device_attr(int minor, struct device_attribute *attr, void *data)
+{
+#ifdef OLD_KERNEL
+	return -ENOSYS;
+#else
+	struct pk_coredevice *pika;
+	int rc;
+
+	mutex_lock(&pikacore_mtx);
+
+	pika = find_by_minor(minor);
+	if (!pika) {
+		printk(KERN_WARNING "%s: %d is not a pika device\n",
+		       __func__, minor);
+		rc = -ENOENT;
+		goto out;
+	}
+
+	if (data) {
+		void *cur = dev_get_drvdata(pika->device);
+		if (cur == NULL)
+			dev_set_drvdata(pika->device, data);
+		else if (cur != data) {
+			printk(KERN_WARNING "%s: data already set!!!\n",
+			       __func__);
+			rc = -EINVAL;
+			goto out;
+		}
+	}
+
+	rc = device_create_file(pika->device, attr);
+
+out:
+	mutex_unlock(&pikacore_mtx);
+
+	return rc;
+#endif
+}
+EXPORT_SYMBOL(pikacore_device_attr);
+
+static int __init pikacore_init(void)
+{
+	int rc;
+	dev_t devt;
+
+	pikacore_class = class_create(THIS_MODULE, "pika");
+	if (IS_ERR(pikacore_class))
+		return PTR_ERR(pikacore_class);
+
+	if (major) {
+		/* user specified the major */
+		devt = MKDEV(major, 0);
+		rc = register_chrdev_region(devt, MAX_MINORS, "pikacore");
+	} else
+		/* dynamic */
+		rc = alloc_chrdev_region(&devt, 0, MAX_MINORS, "pikacore");
+	if (rc) {
+		printk(KERN_ERR "pikacore: Unable to register (%d).\n", rc);
+		class_destroy(pikacore_class);
+		return rc;
+	}
+
+	major = MAJOR(devt);
+
+	return 0;
+}
+module_init(pikacore_init);
+
+void __exit pikacore_exit(void)
+{
+	unregister_chrdev_region(MKDEV(major, 0), MAX_MINORS);
+
+	class_destroy(pikacore_class);
+}
+module_exit(pikacore_exit);
+
+MODULE_DESCRIPTION("pikacore - core class driver");
+MODULE_AUTHOR("Sean MacLennan");
+MODULE_LICENSE("GPL");
+
+/*
+ * Force kernel coding standard on PIKA code
+ * Local Variables:
+ * tab-width: 8
+ * c-basic-offset: 8
+ * indent-tabs-mode: t
+ * End:
+ */

^ permalink raw reply

* RE: [PATCH 4/4] [POWERPC] Xilinx: Framebuffer: Usedcrinfrastructure.
From: Stephen Neuendorffer @ 2008-05-08  4:46 UTC (permalink / raw)
  To: David Gibson; +Cc: linuxppc-dev
In-Reply-To: <20080508015948.GG5156@yookeroo.seuss>

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


The problem is that the tft driver currently in mainline assumes that the dcr control registers
are accessed through mmio, and probes for a reg=<> property.  Since the device is actually a dcr device,
it can be connected via mmio through a bride, or to the native dcr bus of the processor.  For the time being,
I'd like to generate device trees compatible with either mechanism.

so, the problem is that the tree-parents of the tft node all have ranges, and if the dcr-parent of the node is a bridge, then it has a reg=<> property,
But if the dcr-parent is also a tree-parent, then it has to have ranges; and a reg=<> property, which seems very strange, and not something I think is
a good thing to do.

Steve

-----Original Message-----
From: David Gibson [mailto:david@gibson.dropbear.id.au]
Sent: Wed 5/7/2008 6:59 PM
To: Stephen Neuendorffer
Cc: Grant Likely; linuxppc-dev@ozlabs.org
Subject: Re: [PATCH 4/4] [POWERPC] Xilinx: Framebuffer: Usedcrinfrastructure.
 
On Tue, May 06, 2008 at 10:43:50AM -0700, Stephen Neuendorffer wrote:
[snip]
> > > Hmmm, something doesn't quite feel right about this.  The node
> > > describing the tft device is a child of the dcr@0 node which is the
> > > dcr bus.  However, dcr bindings use dcr-bus and dcr-reg instead of
> > > parent-child relationship to specify how to access the dcr
> registers.
> > > So, in this example; if the device is described by tft@80, and the
> dcr
> > > bus is described by opb2dcr-bridge@40700000, then what does dcr@0
> > > describe?  (I do understand what they really describe in EDK terms;
> > > but I'm looking at it through device tree glasses).
> > >
> > > I don't think the presence of a dcr@0 node is a problem, but in this
> > > case #size/address-cells doesn't have any meaning (the child doesn't
> > > have a reg property) and it looks like it should be a child of the
> > > opb2dcr-bridge node (otherwise, what is it attached to?).
> > 
> > Yes, indeed.  If dcr@0 is representing the DCR bus / interface it
> > should really have the dcr-access-method property and have all the
> > dcr-parent handles point at it.
> 
> Hmm, I tend to agree.  Certainly the address-cells and size-cells can
> go.  Part of the nastiness is that I'm trying to maintain a modicum of
> backward compatibility at the moment in the device tree generator.  This
> structure allow the dcr@0 node to have ranges; and the tft node to have
> a properly translated reg = <> property for the existing driver which
> only understands mmio.  I don't think it really works for the opb2dcr
> bridge to be a bridge and a dcr-controller at the same time. :)  This
> structure is also very similar to what is generated if the
> dcr-controller is native from the processor (there's just no bridge).

I don't really understand what you're getting at here, sorry.  Perhaps
you could describe what you're doing with the tft device in more
detail?

> > Current standard practice is not to represent the DCR bus as node with
> > subnodes for the DCR-controlled devices.  That's because the DCR bus
> > tends to run in addition to other on-chip busses, and some things have
> > to go on another on-chip bus to make sense, but still have DCR control
> > registers (for example the internal bus bridges on 4xx).
> > 
> > Arguably for DCR-only devices we should instead have a node
> > representing the DCR bus and just put the devices under it with the
> > DCR number encoded in reg in the normal way.  But then its
> > inconsistent with the devices that need the other DCR representation.
> 
> Yup, it's exactly this problem I'm trying to fix in the case of the tft
> driver.

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson



[-- Attachment #2: Type: text/html, Size: 5306 bytes --]

^ permalink raw reply

* [PATCH] [POWERPC] Reintroduce O_SYNC flag to make DRAM non-cached.
From: nick.spence @ 2008-05-08  5:26 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Nick Spence

From: Nick Spence <nick.spence@freescale.com>

This patch re-introduces the O_SYNC flag to make DRAM non-cached, which is the default behavior
for non PowerPC architectures in /drivers/char/mem.c

Signed-off-by: Nick Spence <nick.spence@freescale.com>
---
diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c
index 5ccb579..f994b0a 100644
--- a/arch/powerpc/mm/mem.c
+++ b/arch/powerpc/mm/mem.c
@@ -101,7 +101,7 @@ pgprot_t phys_mem_access_prot(struct file *file, unsigned long pfn,
 	if (ppc_md.phys_mem_access_prot)
 		return ppc_md.phys_mem_access_prot(file, pfn, size, vma_prot);
 
-	if (!page_is_ram(pfn))
+	if ((file->f_flags & O_SYNC) || (!page_is_ram(pfn)))
 		vma_prot = __pgprot(pgprot_val(vma_prot)
 				    | _PAGE_GUARDED | _PAGE_NO_CACHE);
 	return vma_prot;
-- 
1.5.5

^ permalink raw reply related

* Re: [PATCH] [POWERPC] Reintroduce O_SYNC flag to make DRAM non-cached.
From: Paul Mackerras @ 2008-05-08  5:50 UTC (permalink / raw)
  To: nick.spence; +Cc: linuxppc-dev
In-Reply-To: <1210224392246-git-send-email-nick.spence@freescale.com>

nick.spence@freescale.com writes:

> This patch re-introduces the O_SYNC flag to make DRAM non-cached, which is the default behavior
> for non PowerPC architectures in /drivers/char/mem.c

This says nothing about why you want to do this---what bad things
arise from the present code, or what good things would happen if the
change was made.  It needs to.

The change isn't acceptable as it is, because IBM machines with a
hypervisor don't allow system memory to be mapped uncacheable.  It
would at least have to have some platform-specific check in there.

On other powerpc platforms, this would introduce possible cache
paradoxes, where a page is mapped cacheable at one address (via the
linear mapping) and uncacheable at another address (via /dev/mem).  If
you really really want to do this, you'll need to add code to bust up
the large pages (or TLB entries) used for the linear mapping so that
the corresponding pages of the linear mapping can be unmapped, or
mapped cacheable.  Plus you'll need to add the appropriate cache
flushing code to make sure there aren't any cache lines for the page
in cache.  Further, you'll need to arrange somehow to make sure that
the kernel stack has a resident TLB entry during the unrecoverable
parts of the exception entry and exit paths.

Paul.

^ permalink raw reply

* device tree in open firmware on power6
From: Chandru @ 2008-05-08  6:21 UTC (permalink / raw)
  To: linuxppc-dev

Hi,

When I set linux 2.6.26-rc1 as default kernel to boot in 
/etc/yaboot.conf, then the device tree in open firmware shows only one 
memory node ( the same memory node appears in /proc/device-tree/memory@0 
).  But when RHEL5.2 kernel is set as default in /etc/yaboot.conf then 
the device tree in open firmware shows plenty of memory nodes. Following 
is the open firmware output..

linux-2.6.26-rc1:

<snip>
0 > dev / ls
...
000000caf1b8:   /PowerPC,POWER6@6
000000cb0120: /memory@0
000000cb83d8: /ibm,dynamic-reconfiguration-memory
000000cbcd60: /options
...

0 > dev /memory@0  ok
0 > .properties
name                    memory
device_type             memory
reg                     00000000 00000000  00000000 08000000
available               00000000 00004000 00000000 00bfc000 00000000 02020000
00000000 05fe0000
#address-cells          00000001
#size-cells             00000000
ibm,phandle             fffffffa
ibm,associativity       00000004 00000000 00000000 00000000 00000000

<snip-end>




when default=RHEL5.2:

0 > dev / ls 
000000c8d200: /ibm,serial
000000c8dff8: /chosen
...
000000cae2c0:   /PowerPC,POWER6@4
000000caf1b8:   /PowerPC,POWER6@6
000000cb0120: /memory@0
000000cb5af0: /memory@8000000
000000cb5ce0: /memory@c000000
000000cb5ed0: /memory@10000000
000000cb60c0: /memory@14000000
000000cb62b0: /memory@18000000
000000cb64a0: /memory@1c000000
000000cb6690: /memory@20000000

...


The open firmware environment variable "ibm,fw-new-mem-def" is false for 
rhel5.2 kernel where as it is 'true' for 2.6.26-rc1 as default kernel to 
boot.  Any inputs if the one memory node in 2.6.26-rc1 should show the 
size of available system memory ?, or there should be many memory nodes 
for 2.6.26-rc1 ?.

Thanks,
Chandru

^ permalink raw reply

* Re: powerpc port for sbc8260-based board problem
From: Sergej Stepanov @ 2008-05-08  6:22 UTC (permalink / raw)
  To: Scott Wood; +Cc: linuxppc-dev
In-Reply-To: <48220690.7080301@freescale.com>


Am Mittwoch, den 07.05.2008, 14:44 -0500 schrieb Scott Wood:
> Scott Wood wrote:
> > Sergej Stepanov wrote:
> >> Hm... it looks like the default uart_set_termios from
> >>
> >> static const struct tty_operations uart_ops in serial_core.c
> >>
> >> and not cpm_uart_set_termios(..)?..
> >>
> >> Is not it? but why?...
> > 
> > tty_operations != uart_ops
> 
> Despite the unfortunate name of the instance of the former.
> 
> -Scott

Of course :)

^ permalink raw reply

* Re: [PATCH] [POWERPC] Fix kernel builds with newer gcc versions and -Os
From: Paul Mackerras @ 2008-05-08  6:26 UTC (permalink / raw)
  To: Kumar Gala; +Cc: Scott Wood, linuxppc-dev
In-Reply-To: <BFB7B7A0-6EA9-467D-B23E-B0D46EF6BA54@kernel.crashing.org>

Kumar Gala writes:

> We'll hopefully this thread might spark either an explanation for why  
> we aren't just linking libgcc in a statement that says we should and  
> we can remove the code that implements libgcc functionality.

I've just reviewed the code in the 32-bit and 64-bit PowerPC versions
of libgcc.  It's pretty huge (half a megabyte or so in total) but
fortunately most of the bulk is in the decimal floating-point support,
which I largely ignored (though I did notice in passing that it calls
libc functions including strchr, strtof, and sprintf).

On 64-bit I don't see anything there that I would expect we would
need.  There are some things that are in there because some processors
have particular instructions that others don't, for example popcountb
(which is in the V2.05 architecture but not earlier versions), so gcc
can generate either the instruction or a call to the libgcc function,
depending on what sort of processor you're compiling for.  However, in
those cases, we'd want our own version of the libgcc function so that
we could use our CPU feature mechanism to give us the new instruction
on those CPUs that have it.

On 32-bit, it's pretty much just the 64-bit arithmetic routines that
we would need from libgcc (shifts, compares, multiply, divide,
modulo).  I'm not too impressed with the quality of the code there,
for example, the 64-bit signed divide routine is 299 instructions,
which seems enormous to me.  It's all generated from portable C code
by gcc.  I think I can do a smaller and faster 64-bit divide routine
in assembler, for instance.

So on the whole I don't think we want to link with libgcc, although I
don't feel very strongly about it.

Paul.

^ permalink raw reply

* RE: [PATCH] [POWERPC] Reintroduce O_SYNC flag to make DRAM non-cached.
From: Spence Nick @ 2008-05-08  6:31 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: linuxppc-dev
In-Reply-To: <18466.38047.531381.157886@cargo.ozlabs.ibm.com>

Paul Mackerras wrote:
> This says nothing about why you want to do this---what bad=20
> things arise from the present code, or what good things would=20
> happen if the change was made.  It needs to.

We found the problem when porting code from Linux 2.4 to 2.6, where a
user space application maps a 1 MByte region of DRAM with the O_SYNC=20
flag to communicate with an internal core that shares access to the
DRAM but does not have any cache snooping logic.

In 2.4 the mem driver honors the O_SYNC flag and makes the requested
memory
memory non-cached so that writes from user space are immediately
available
to the second core.

In 2.6 the powerpc mem driver no longer honors the O_SYNC flag so the
data
is only written out to DRAM (and becoming visible to the second core) as
the
cache reloads with other data.

> The change isn't acceptable as it is, because IBM machines=20
> with a hypervisor don't allow system memory to be mapped=20
> uncacheable.  It would at least have to have some=20
> platform-specific check in there.
>=20
> On other powerpc platforms, this would introduce possible=20
> cache paradoxes, where a page is mapped cacheable at one=20
> address (via the linear mapping) and uncacheable at another=20
> address (via /dev/mem).  If you really really want to do=20
> this, you'll need to add code to bust up the large pages (or=20
> TLB entries) used for the linear mapping so that the=20
> corresponding pages of the linear mapping can be unmapped, or=20
> mapped cacheable.  Plus you'll need to add the appropriate=20
> cache flushing code to make sure there aren't any cache lines=20
> for the page in cache.  Further, you'll need to arrange=20
> somehow to make sure that the kernel stack has a resident TLB=20
> entry during the unrecoverable parts of the exception entry=20
> and exit paths.
>=20

This is getting to be a much more elaborate project.

In our case the memory area is reserved so that the main processor will
not
touch it except when mapped by the mem driver.

Alternative solutions are to modify the user space code to flush out the
caches by reading a large area, or to implement a board specific=20
ppc_md.phys_mem_access_prot() function to do this.

Either of these will meet my needs, but this will leave the O_SYNC flag
ignored on the PowerPC architecture in 2.6, but honored by Linux 2.4 and
other architectures. Probably not a problem for most people.

Thanks,
  Nick

^ permalink raw reply

* Re: device tree in open firmware on power6
From: Paul Mackerras @ 2008-05-08  6:32 UTC (permalink / raw)
  To: Chandru; +Cc: linuxppc-dev
In-Reply-To: <48229BF5.9090602@in.ibm.com>

Chandru writes:

> When I set linux 2.6.26-rc1 as default kernel to boot in 
> /etc/yaboot.conf, then the device tree in open firmware shows only one 
> memory node ( the same memory node appears in /proc/device-tree/memory@0 
> ).  But when RHEL5.2 kernel is set as default in /etc/yaboot.conf then 
> the device tree in open firmware shows plenty of memory nodes. Following 
> is the open firmware output..

Current kernels tell the firmware that they can handle having memory
represented in the /ibm,dynamic-reconfiguration-memory node, which is
a more compact representation than having it represented in multiple
/memory@xxx nodes.  Therefore firmware reports most of the memory in
the /ibm,dynamic-reconfiguration-memory node you have here:

> linux-2.6.26-rc1:
> 
> <snip>
> 0 > dev / ls
> ...
> 000000caf1b8:   /PowerPC,POWER6@6
> 000000cb0120: /memory@0
> 000000cb83d8: /ibm,dynamic-reconfiguration-memory

and only gives you one /memory@xxx node, which represents the real
memory area.  See sections C.6.2.3 and C.6.6.2 of PAPR for more
information.

Paul.

^ permalink raw reply

* RE: [PATCH] [POWERPC] Reintroduce O_SYNC flag to make DRAM non-cached.
From: Benjamin Herrenschmidt @ 2008-05-08  6:55 UTC (permalink / raw)
  To: Spence Nick; +Cc: linuxppc-dev, Paul Mackerras
In-Reply-To: <9E50B2A5FE44294CBF877745D9A4125F01D37125@az33exm24.fsl.freescale.net>


On Wed, 2008-05-07 at 23:31 -0700, Spence Nick wrote:
> 
> In our case the memory area is reserved so that the main processor will
> not touch it except when mapped by the mem driver.

Then you should completely carve it out of the LMB's which will ensure
it's not seen as RAM by /dev/mem and not mapped by the linear mapping
(well, the later depends ... if it's carved out of the top of RAM it
should work fine, if it's a hole, I'm not sure we handle holes in the
linear mapping on 32 bits).

> Alternative solutions are to modify the user space code to flush out the
> caches by reading a large area, or to implement a board specific 
> ppc_md.phys_mem_access_prot() function to do this.
> 
> Either of these will meet my needs, but this will leave the O_SYNC flag
> ignored on the PowerPC architecture in 2.6, but honored by Linux 2.4 and
> other architectures. Probably not a problem for most people.

^ permalink raw reply

* Re: [PATCH 4/4] [POWERPC] Xilinx: Framebuffer: Usedcrinfrastructure.
From: David Gibson @ 2008-05-08  7:01 UTC (permalink / raw)
  To: Stephen Neuendorffer; +Cc: linuxppc-dev
In-Reply-To: <20080508044652.98467AA8064@mail133-wa4.bigfish.com>

On Wed, May 07, 2008 at 09:46:51PM -0700, Stephen Neuendorffer wrote:
> 
> The problem is that the tft driver currently in mainline assumes
> that the dcr control registers are accessed through mmio, and probes
> for a reg=<> property.  Since the device is actually a dcr device,
> it can be connected via mmio through a bride, or to the native dcr
> bus of the processor.  For the time being, I'd like to generate
> device trees compatible with either mechanism.

Ah, I think I see.  The current driver expects the device to be
represented as if it were an mmio device, not using the standard dcr
notation.  It can get away with this because the DCRs are
memory-mapped, in a way representable by 'ranges'.

> so, the problem is that the tree-parents of the tft node all have
> ranges, and if the dcr-parent of the node is a bridge, then it has a
> reg=<> property, But if the dcr-parent is also a tree-parent, then
> it has to have ranges; and a reg=<> property, which seems very
> strange, and not something I think is a good thing to do.

This I don't follow.

But I don't think it matters.  The representation suggested by Segher,
which has the DCR addressing redundantly described in 'reg' and
'dcr-reg' properties should work for you.

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

^ permalink raw reply

* Re: [PATCH] [POWERPC] Reintroduce O_SYNC flag to make DRAM non-cached.
From: Nick Spence @ 2008-05-08  7:17 UTC (permalink / raw)
  To: benh; +Cc: linuxppc-dev, Paul Mackerras
In-Reply-To: <1210229743.1421.36.camel@pasglop>

Benjamin Herrenschmidt wrote:
> On Wed, 2008-05-07 at 23:31 -0700, Spence Nick wrote:
> 
> Then you should completely carve it out of the LMB's which will ensure
> it's not seen as RAM by /dev/mem and not mapped by the linear mapping
> (well, the later depends ... if it's carved out of the top of RAM it
> should work fine, if it's a hole, I'm not sure we handle holes in the
> linear mapping on 32 bits).
> 

Unfortunately the memory window is 4 MBytes into the DDR and not at the 
end. It would be hard to put it at the end because the contents are 
location dependent and we can change the memory size.

The region is reserved with an lmb_reserve().

/* Set the location and size of the shared DDR memory region */
void* shared_mem_base = (void *)0x400000;
long  shared_mem_size = 0x100000;

....
lmb_reserve((unsigned long)shared_mem_base, shared_mem_size);



The page protection seemed to be allocated on a per pte basis, where 
each PTE is a small fixed size. I will need to check the TLB setup further.

Nick

^ permalink raw reply

* Re: [PATCH] [POWERPC] Reintroduce O_SYNC flag to make DRAM non-cached.
From: Benjamin Herrenschmidt @ 2008-05-08  7:21 UTC (permalink / raw)
  To: Nick Spence; +Cc: linuxppc-dev, Paul Mackerras
In-Reply-To: <4822A8F0.1010602@freescale.com>


On Thu, 2008-05-08 at 00:17 -0700, Nick Spence wrote:
> The page protection seemed to be allocated on a per pte basis, where 
> each PTE is a small fixed size. I will need to check the TLB setup
> further.

The problem is that it will then be part of the linear mapping, which
means you'll end up with a double cacheable & non-cacheable mapping for
that memory, this is not nice ... it might work as long as we stick to
having G bit set for the whole linear mapping but it's going to come
back and bite.

I still think you should look closely whether it could be carved out
of the end of memory... even if that involves changing application
code.

Now, if you aren't afraid of cache paradox caused by the linear
mapping, then carve it out of the LMB wherever it is rather than
lmb_reserve() it. That would probably work.

Ben.

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox