LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH 1/2] Add thread_info_cache_init() to all archs
From: Benjamin Herrenschmidt @ 2008-04-18  6:44 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Linux-Arch, linux-m32r, takata, linux-kernel, linuxppc-dev,
	Paul Mackerras
In-Reply-To: <20080417211905.8ff769fa.akpm@linux-foundation.org>


> > so what
> > about the patch below ?
> 
> I like it, but the compiler won't ;)
> 
> > If you're ok, I'll re-send with appropriate sob
> > & adapted powerpc part.
> 
> Sure.
> 
> > +void __init __attribute__((weak) thread_info_cache_init(void)
> 
> s/weak)/weak))/

Yeah, missing quilt ref :-)

I'll send the proper patches in a minute.

Cheers,
Ben.

^ permalink raw reply

* Re: 2.6.25-mm1 on the g5
From: Paul Mackerras @ 2008-04-18  6:38 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linuxppc-dev
In-Reply-To: <20080417224248.fdd89284.akpm@linux-foundation.org>

Andrew Morton writes:

> It had been running happily and hard for a couple of hours when:

Looks like the bug that Kamalesh Babulal reported and which I have
been chasing without success so far.

> That's a pretty crappy trace.  Perhaps netconsole lost some of it, dunno.

Yeah, there's a bug in the handling of that particular error condition
which I have a patch to fix.

Paul.

^ permalink raw reply

* 2.6.25-mm1 on the g5
From: Andrew Morton @ 2008-04-18  5:42 UTC (permalink / raw)
  To: Paul Mackerras, Benjamin Herrenschmidt; +Cc: linuxppc-dev


It had been running happily and hard for a couple of hours when:


registered taskstats version 1
Freeing unused kernel memory: 304k freed
windfarm: CPUs control loops started.
EXT3-fs: INFO: recovery required on readonly filesystem.
EXT3-fs: write access will be enabled during recovery.
kjournald starting.  Commit interval 5 seconds
EXT3-fs: recovery complete.
EXT3-fs: mounted filesystem with ordered data mode.
Unrecoverable exception 4100 at c000000000008c24
Oops: Unrecoverable exception, sig: 6 [#1]
SMP NR_CPUS=4 PowerMac
Modules linked in: autofs
NIP: c000000000008c24 LR: 000000000feea4ac CTR: 000000000feea450
REGS: c000000178fb7bb0 TRAP: 4100   Not tainted  (2.6.25-mm1)
MSR: 9000000000001030 <ME,IR,DR>  CR: 42000424  XER: 20000000
TASK = c000000178aae3c0[24350] 'sed' THREAD: c000000178fb4000 CPU: 2
GPR00: 0000000000004000 c000000178fb7e30 000000000ff41d14 100000000000d032 
GPR04: 000000000000000c 0000000000000400 0000000000000024 0000000000000000 
GPR08: 0000000000000000 0000000000000000 0000000000000000 0000000000000000 
GPR12: 0000000000000000 0000000010023338 0000000000000000 0000000010020000 
GPR16: 0000000000000000 0000000000000000 0000000000000000 000000001003d868 
GPR20: 0000000000000000 00000000ffec39d0 000000001003c850 0000000000000000 
GPR24: 0000000000000000 0000000000000015 000000000000003b 0000000000000400 
GPR28: 000000000ffc69d0 00000000f7ff7000 000000000ffc6e5c 0000000000000400 
NIP [c000000000008c24] restore+0xa4/0xc0
LR [000000000feea4ac] 0xfeea4ac
Call Trace:
[c000000178fb7e30] [c000000000008c54] do_work+0x14/0x2c (unreliable)
Instruction dump:
e88d01e0 f84d01e0 7c841050 e84d01d8 7c422214 f84d01d8 e9a100d8 7c7b03a6 
e84101a0 7c4ff120 e8410170 7c5a03a6 <e8010070> e8410080 e8610088 e8810090 
---[ end trace 07fd463c013eef9d ]---
BUG: soft lockup - CPU#2 stuck for 61s! [swapper:0]
NIP: c000000000013bd4 LR: c000000000013bd4 CTR: c00000000001c9bc
REGS: c00000017a10bbe0 TRAP: 0901   Tainted: G      D    (2.6.25-mm1)
MSR: 9000000000009032 <EE,ME,IR,DR>  CR: 44ffff28  XER: 00000000
TASK = c00000017a105260[0] 'swapper' THREAD: c00000017a108000 CPU: 2
GPR00: 0000000000000001 c00000017a10be60 c0000000006eac48 c00000000070a200 
GPR04: 0000000000000001 0000000000002d2e 0000000024ffff22 9000000000049032 
GPR08: 0000000000000001 c00000017a108000 c00000017a108000 0000000000000000 
GPR12: 0000000022024448 c00000000062d380 
NIP [c000000000013bd4] .cpu_idle+0x14c/0x154
LR [c000000000013bd4] .cpu_idle+0x14c/0x154
Call Trace:
[c00000017a10be60] [c000000000013ba0] .cpu_idle+0x118/0x154 (unreliable)
[c00000017a10bf00] [c000000000456970] .start_secondary+0x148/0x1b0
[c00000017a10bf90] [c0000000000083c0] .start_secondary_prolog+0xc/0x10
Instruction dump:
4bffff64 7c210b78 7ffffb78 4bffff58 e93b01b0 e8090000 f8410028 60000000 
e9690010 e8490008 7c0903a6 4e800421 <e8410028> 4bffff80 e8030008 e9440008 
BUG: soft lockup - CPU#1 stuck for 936s! [mrtg:24361]
NIP: 000000000eafb6ac LR: 000000000eafb4dc CTR: 0000000000000000
REGS: c000000177197ea0 TRAP: 0901   Tainted: G      D    (2.6.25-mm1)
MSR: 100000000200f032 <EE,PR,FP,ME,IR,DR>  CR: 24422482  XER: 00000000
TASK = c0000001771b5260[24361] 'mrtg' THREAD: c000000177194000 CPU: 1
GPR00: 0000000000000000 00000000ff803c10 00000000f7fe0860 0000000010445278 
GPR04: 0000000000000001 0000000000000007 000000000eb14720 0000000000000007 
GPR08: 0000000010452840 0000000000000040 0000000000000000 0000000010041640 
GPR12: 0000000044422484 000000001001bb2c 
NIP [000000000eafb6ac] 0xeafb6ac
LR [000000000eafb4dc] 0xeafb4dc
Call Trace:
BUG: soft lockup - CPU#0 stuck for 936s! [mrtg:24365]
NIP: 000000000eb34800 LR: 000000000eb345e8 CTR: 000000010eb2bb5c
REGS: c0000001788b3ea0 TRAP: 0901   Tainted: G      D    (2.6.25-mm1)
MSR: 100000000200f032 <EE,PR,FP,ME,IR,DR>  CR: 44422484  XER: 00000000
TASK = c00000017863f5e0[24365] 'mrtg' THREAD: c0000001788b0000 CPU: 0
GPR00: 00000000104670f0 00000000ffba12c0 00000000f7fe0860 0000000010015008 
GPR04: 0000000010137100 0000000000000008 0000000000000003 0000000000000482 
GPR08: 000000001012bbb8 0000000000000002 000000001012aad8 000000001002afe0 
GPR12: 0000000024422442 000000001001bb2c 
NIP [000000000eb34800] 0xeb34800
LR [000000000eb345e8] 0xeb345e8
Call Trace:
BUG: soft lockup - CPU#3 stuck for 936s! [python:24362]
NIP: 000000000fef62c0 LR: 000000000fd31c58 CTR: 000000000fccfcdc
REGS: c000000178e43ea0 TRAP: 0901   Tainted: G      D    (2.6.25-mm1)
MSR: 100000000000f032 <EE,PR,FP,ME,IR,DR>  CR: 22288424  XER: 20000000
TASK = c00000017735b560[24362] 'python' THREAD: c000000178e40000 CPU: 3
GPR00: 0000000000000000 00000000ff83abc0 00000000f7fe0480 00000000ff83b14c 
GPR04: 000000000fd6e354 00000000ff83b148 000000002e736f00 fffffffffefefeff 
GPR08: 000000007f7f0000 000000000fdbff64 0000000000000000 0000000000000000 
GPR12: 0000000000000000 0000000010019b88 
NIP [000000000fef62c0] 0xfef62c0
LR [000000000fd31c58] 0xfd31c58
Call Trace:


That's a pretty crappy trace.  Perhaps netconsole lost some of it, dunno.

^ permalink raw reply

* [PATCH 2.6.26?] Raise the upper limit of NR_CPUS.
From: Tony Breeds @ 2008-04-18  5:33 UTC (permalink / raw)
  To: Paul Mackerras, LinuxPPC-dev

As the pacas are statically initialised increasing NR_CPUS beyond 128,
means that any additional pacas will be empty  ... which is bad.

This patch adds the required functionality to fill in any excess pacas
at runtime.

Signed-off-by: Tony Breeds <tony@bakeyournoodle.com>
---
I know it's late, but can this be considered for 2.6.26?

 arch/powerpc/kernel/paca.c             |   33 ++++++++++------------------
 arch/powerpc/kernel/prom_init.c        |   36 ++++++++++++++++++++++++++++++++
 arch/powerpc/platforms/Kconfig.cputype |    4 +-
 include/asm-powerpc/paca.h             |   19 ++++++++++++++++
 4 files changed, 69 insertions(+), 23 deletions(-)

diff --git a/arch/powerpc/kernel/paca.c b/arch/powerpc/kernel/paca.c
index ac163bd..29186eb 100644
--- a/arch/powerpc/kernel/paca.c
+++ b/arch/powerpc/kernel/paca.c
@@ -18,6 +18,15 @@
 #include <asm/paca.h>
 #include <asm/mmu.h>
 
+/*
+ * In order to handle "strange" values of NR_CPUS, Make sure we use
+ * max(NR_CPUS, NR_STATIC_PACAS) for array sizes below
+ */
+#if NR_CPUS > NR_STATIC_PACAS
+#define MAX_CPUS	NR_CPUS
+#else
+#define MAX_CPUS	NR_STATIC_PACAS
+#endif
 
 /* This symbol is provided by the linker - let it fill in the paca
  * field correctly */
@@ -33,7 +42,7 @@ extern unsigned long __toc_start;
  * will suffice to ensure that it doesn't cross a page boundary.
  */
 struct lppaca lppaca[] = {
-	[0 ... (NR_CPUS-1)] = {
+	[0 ... (MAX_CPUS-1)] = {
 		.desc = 0xd397d781,	/* "LpPa" */
 		.size = sizeof(struct lppaca),
 		.dyn_proc_status = 2,
@@ -50,7 +59,7 @@ struct lppaca lppaca[] = {
  * initially, hence will all be invaild until we actually write them.
  */
 struct slb_shadow slb_shadow[] __cacheline_aligned = {
-	[0 ... (NR_CPUS-1)] = {
+	[0 ... (MAX_CPUS-1)] = {
 		.persistent = SLB_NUM_BOLTED,
 		.buffer_length = sizeof(struct slb_shadow),
 	},
@@ -76,7 +85,7 @@ struct slb_shadow slb_shadow[] __cacheline_aligned = {
 	.__current = &init_task,					    \
 }
 
-struct paca_struct paca[] = {
+struct paca_struct paca[MAX_CPUS] = {
 	PACA_INIT(0),
 #if NR_CPUS > 1
 	PACA_INIT(  1), PACA_INIT(  2), PACA_INIT(  3),
@@ -98,24 +107,6 @@ struct paca_struct paca[] = {
 	PACA_INIT( 52), PACA_INIT( 53), PACA_INIT( 54), PACA_INIT( 55),
 	PACA_INIT( 56), PACA_INIT( 57), PACA_INIT( 58), PACA_INIT( 59),
 	PACA_INIT( 60), PACA_INIT( 61), PACA_INIT( 62), PACA_INIT( 63),
-#if NR_CPUS > 64
-	PACA_INIT( 64), PACA_INIT( 65), PACA_INIT( 66), PACA_INIT( 67),
-	PACA_INIT( 68), PACA_INIT( 69), PACA_INIT( 70), PACA_INIT( 71),
-	PACA_INIT( 72), PACA_INIT( 73), PACA_INIT( 74), PACA_INIT( 75),
-	PACA_INIT( 76), PACA_INIT( 77), PACA_INIT( 78), PACA_INIT( 79),
-	PACA_INIT( 80), PACA_INIT( 81), PACA_INIT( 82), PACA_INIT( 83),
-	PACA_INIT( 84), PACA_INIT( 85), PACA_INIT( 86), PACA_INIT( 87),
-	PACA_INIT( 88), PACA_INIT( 89), PACA_INIT( 90), PACA_INIT( 91),
-	PACA_INIT( 92), PACA_INIT( 93), PACA_INIT( 94), PACA_INIT( 95),
-	PACA_INIT( 96), PACA_INIT( 97), PACA_INIT( 98), PACA_INIT( 99),
-	PACA_INIT(100), PACA_INIT(101), PACA_INIT(102), PACA_INIT(103),
-	PACA_INIT(104), PACA_INIT(105), PACA_INIT(106), PACA_INIT(107),
-	PACA_INIT(108), PACA_INIT(109), PACA_INIT(110), PACA_INIT(111),
-	PACA_INIT(112), PACA_INIT(113), PACA_INIT(114), PACA_INIT(115),
-	PACA_INIT(116), PACA_INIT(117), PACA_INIT(118), PACA_INIT(119),
-	PACA_INIT(120), PACA_INIT(121), PACA_INIT(122), PACA_INIT(123),
-	PACA_INIT(124), PACA_INIT(125), PACA_INIT(126), PACA_INIT(127),
-#endif
 #endif
 #endif
 #endif
diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c
index 6d6df1e..cf2a2db 100644
--- a/arch/powerpc/kernel/prom_init.c
+++ b/arch/powerpc/kernel/prom_init.c
@@ -37,6 +37,9 @@
 #include <asm/smp.h>
 #include <asm/system.h>
 #include <asm/mmu.h>
+#ifdef CONFIG_PPC64
+#include <asm/paca.h>
+#endif
 #include <asm/pgtable.h>
 #include <asm/pci.h>
 #include <asm/iommu.h>
@@ -49,6 +52,10 @@
 extern const struct linux_logo logo_linux_clut224;
 #endif
 
+/* This symbol is provided by the linker - let it fill in the paca
+ * field correctly */
+extern unsigned long __toc_start;
+
 /*
  * Properties whose value is longer than this get excluded from our
  * copy of the device tree. This value does need to be big enough to
@@ -2332,6 +2339,32 @@ static void __init prom_check_initrd(unsigned long r3, unsigned long r4)
 }
 
 /*
+ * The first few (NR_STATIC_PACAS) paca entires are initiialised
+ * statically. populate the rest.
+ */
+static void __init prom_initialise_pacas(void)
+{
+#ifdef CONFIG_PPC64
+	int cpu;
+	unsigned long kernel_toc = (unsigned long)(&__toc_start) + 0x8000UL;
+
+	/* Can't use for_each_*_cpu, as they aren't functional yet */
+	for (cpu = NR_STATIC_PACAS; cpu < NR_CPUS; cpu++) {
+		struct paca_struct *new_paca = &RELOC(paca[cpu]);
+
+		new_paca->lppaca_ptr = &lppaca[cpu];
+		new_paca->lock_token = 0x8000;
+		new_paca->paca_index = cpu;
+		new_paca->kernel_toc = kernel_toc;
+		new_paca->hw_cpu_id = 0xffff;
+		new_paca->slb_shadow_ptr = &slb_shadow[cpu];
+		new_paca->__current = &init_task;
+
+	}
+#endif /* CONFIG_PPC64 */
+}
+
+/*
  * We enter here early on, when the Open Firmware prom is still
  * handling exceptions and the MMU hash table for us.
  */
@@ -2432,6 +2465,9 @@ unsigned long __init prom_init(unsigned long r3, unsigned long r4,
 		prom_initialize_tce_table();
 #endif
 
+	/* We statically initialised /some/ of the paca's, lets do the rest. */
+	prom_initialise_pacas();
+
 	/*
 	 * On non-powermacs, try to instantiate RTAS and puts all CPUs
 	 * in spin-loops. PowerMacs don't have a working RTAS and use
diff --git a/arch/powerpc/platforms/Kconfig.cputype b/arch/powerpc/platforms/Kconfig.cputype
index 5fc7fac..f7efaa9 100644
--- a/arch/powerpc/platforms/Kconfig.cputype
+++ b/arch/powerpc/platforms/Kconfig.cputype
@@ -220,8 +220,8 @@ config SMP
 	  If you don't know what to do here, say N.
 
 config NR_CPUS
-	int "Maximum number of CPUs (2-128)"
-	range 2 128
+	int "Maximum number of CPUs (2-1024)"
+	range 2 1024
 	depends on SMP
 	default "32" if PPC64
 	default "4"
diff --git a/include/asm-powerpc/paca.h b/include/asm-powerpc/paca.h
index eb61b9c..511ebc9 100644
--- a/include/asm-powerpc/paca.h
+++ b/include/asm-powerpc/paca.h
@@ -16,10 +16,29 @@
 #define _ASM_POWERPC_PACA_H
 #ifdef __KERNEL__
 
+#include <linux/threads.h>
+
 #include	<asm/types.h>
 #include	<asm/lppaca.h>
 #include	<asm/mmu.h>
 
+/*
+ * iSeries needs the paca to be statically allocated and initialised.
+ * We will allocated this many, based on NR_CPUS.
+ */
+#if   NR_CPUS >= 32
+#define NR_STATIC_PACAS	64
+#elif NR_CPUS > 8
+#define NR_STATIC_PACAS	32
+#elif NR_CPUS > 4
+#define NR_STATIC_PACAS	8
+#elif NR_CPUS > 1
+#define NR_STATIC_PACAS	4
+#else
+#define NR_STATIC_PACAS	1
+#endif
+
+
 register struct paca_struct *local_paca asm("r13");
 
 #if defined(CONFIG_DEBUG_PREEMPT) && defined(CONFIG_SMP)
-- 
1.5.5



Yours Tony

  linux.conf.au    http://www.marchsouth.org/
  Jan 19 - 24 2009 The Australian Linux Technical Conference!

^ permalink raw reply related

* [POWERPC] Optimize fls64() on 64-bit processors
From: Paul Mackerras @ 2008-04-18  5:19 UTC (permalink / raw)
  To: linuxppc-dev

64-bit powerpc processors can find the leftmost 1 bit in a 64-bit
doubleword in one instruction, so use that rather than using the
generic fls64(), which does two 32-bit fls() calls.

Signed-off-by: Paul Mackerras <paulus@samba.org>
---
This is on top of a patch from Alexander van Heukelum that was posted
to lkml (http://lkml.org/lkml/2008/4/16/107), which just uses
asm-generic/bitops/find.h in place of some declarations we had in
asm-powerpc/bitops.h.

diff --git a/include/asm-powerpc/bitops.h b/include/asm-powerpc/bitops.h
index 36c8f3a..a99a749 100644
--- a/include/asm-powerpc/bitops.h
+++ b/include/asm-powerpc/bitops.h
@@ -312,7 +312,24 @@ static __inline__ int fls(unsigned int x)
 	asm ("cntlzw %0,%1" : "=r" (lz) : "r" (x));
 	return 32 - lz;
 }
+
+/*
+ * 64-bit can do this using one cntlzd (count leading zeroes doubleword)
+ * instruction; for 32-bit we use the generic version, which does two
+ * 32-bit fls calls.
+ */
+#ifdef __powerpc64__
+static __inline__ int fls64(__u64 x)
+{
+	int lz;
+
+	asm ("cntlzd %0,%1" : "=r" (lz) : "r" (x));
+	return 64 - lz;
+}
+#else
 #include <asm-generic/bitops/fls64.h>
+#endif /* __powerpc64__ */
+
 #include <asm-generic/bitops/hweight.h>
 #include <asm-generic/bitops/find.h>
 

^ permalink raw reply related

* Re: [RFC/PATCH 3/4] Use pseries_setup_i8259_cascade() in pseries_mpic_init_IRQ()
From: Michael Ellerman @ 2008-04-18  4:47 UTC (permalink / raw)
  To: benh; +Cc: linuxppc-dev
In-Reply-To: <1208492131.6958.390.camel@pasglop>

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

On Fri, 2008-04-18 at 14:15 +1000, Benjamin Herrenschmidt wrote:
> On Tue, 2008-04-01 at 17:42 +1100, Michael Ellerman wrote:
> > pseries_mpic_init_IRQ() implements the same logic as the xics code did to
> > find the i8259 cascade irq. Now that we've pulled that logic out into
> > pseries_setup_i8259_cascade() we can use it in the mpic code.
> > 
> > Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
> 
> Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> 
> (provided you test it and it works :-)

Done. Booted on a Power something (5 or 6) partion and also booted fine
on bongohits, an old power 3 machine with an MPIC.

cheers

-- 
Michael Ellerman
OzLabs, IBM Australia Development Lab

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

* Re: [PATCH 1/2] Add thread_info_cache_init() to all archs
From: Michael Ellerman @ 2008-04-18  4:38 UTC (permalink / raw)
  To: Benjamin Herrenschmidt
  Cc: Linux-Arch, linux-m32r, takata, linux-kernel, linuxppc-dev,
	Paul Mackerras, Andrew Morton
In-Reply-To: <20080417211905.8ff769fa.akpm@linux-foundation.org>

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

On Thu, 2008-04-17 at 21:19 -0700, Andrew Morton wrote:
> On Fri, 18 Apr 2008 13:58:06 +1000 Benjamin Herrenschmidt <benh@ozlabs.org> wrote:
> 
> > 
> > > > > otoh, if only one .c file will ever call this function then I think that
> > > > > all problems are solved by
> > > > > 
> > > > > a) moving the above ifdeffery into the .c file
> > > > > b) adding a comment explaining which arch file must provide the override
> > > > > c) directly including that file from within the .c file.
> > > > 
> > > > I can definitely do that. I have no problem either way. I can add to all
> > > > archs too, it's just that whatever way I choose, some people won't be
> > > > happy with it :-)
> > > > 
> > > > Anyway, I'll move the ifdeferry to init/main.c then.
> > > 
> > > Thanks ;)
> > > 
> > > I'm still wounded by my recent encounter with set_softirq_pending()
> > > and or_softirq_pending().
> > 
> > Well, looking there, I saw we already used weak symbols for that
> 
> Yes, `weak' is a nice solution.  It does add a few bytes of text which we
> could avoid with compile-time trickery, but only a very few.
> 
> Plus this is __init anyway, although I don't know how well the combination
> of `weak' and __init works.
> 
> > +void __init __attribute__((weak) thread_info_cache_init(void)
> 
> s/weak)/weak))/

There's also a #define of this called "__weak" if you like, less typing
and less ugly.

cheers

-- 
Michael Ellerman
OzLabs, IBM Australia Development Lab

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

* Re: [PATCH 1/2] Add thread_info_cache_init() to all archs
From: Kyle McMartin @ 2008-04-18  4:21 UTC (permalink / raw)
  To: Benjamin Herrenschmidt
  Cc: Linux-Arch, linux-m32r, takata, linux-kernel, linuxppc-dev,
	Paul Mackerras, Andrew Morton
In-Reply-To: <1208491086.6958.381.camel@pasglop>

On Fri, Apr 18, 2008 at 01:58:06PM +1000, Benjamin Herrenschmidt wrote:
> Well, looking there, I saw we already used weak symbols for that so what
> about the patch below ? If you're ok, I'll re-send with appropriate sob
> & adapted powerpc part.
> 

This is definitely the cleanest way to do this from my pov. Although I'm
slightly concerned about the proliferation of weak symbols, I'm much
more concerned with adding more include-order-dependent arch overrides. :)

speaking with the parisc dunce-cap on,
	Kyle

^ permalink raw reply

* Re: [PATCH 1/5] [POWERPC] sysdev: implement FSL GTM support
From: Kumar Gala @ 2008-04-18  4:19 UTC (permalink / raw)
  To: cbouatmailru; +Cc: linuxppc-dev
In-Reply-To: <20080417224740.GA25323@zarina>


On Apr 17, 2008, at 5:47 PM, Anton Vorontsov wrote:
> On Thu, Apr 17, 2008 at 11:28:32PM +0400, Anton Vorontsov wrote:
>> GTM stands for General-purpose Timers Module and able to generate
>> timer{1,2,3,4} interrupts. These timers are used by the drivers that
>> need time precise interrupts (like for USB transactions scheduling =20=

>> for
>> the Freescale USB Host controller as found in some QE and CPM chips),
>> or these timers could be used as wakeup events from the CPU deep-=20
>> sleep
>> mode.
>>
>> Things unimplemented:
>> 1. Cascaded (32 bit) timers (1-2, 3-4).
>>   This is straightforward to implement when needed, two timers should
>>   be marked as "requested" and configured as appropriate.
>> 2. Super-cascaded (64 bit) timers (1-2-3-4).
>>   This is also straightforward to implement when needed, all timers
>>   should be marked as "requested" and configured as appropriate.
>>
>> Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
>> ---
>> Documentation/powerpc/booting-without-of.txt |   32 +++-
>> arch/powerpc/Kconfig                         |    5 +
>> arch/powerpc/sysdev/Makefile                 |    1 +
>> arch/powerpc/sysdev/fsl_gtm.c                |  362 ++++++++++++++++=20=

>> ++++++++++
>> include/asm-powerpc/fsl_gtm.h                |  108 ++++++++
>> 5 files changed, 507 insertions(+), 1 deletions(-)
>> create mode 100644 arch/powerpc/sysdev/fsl_gtm.c
>> create mode 100644 include/asm-powerpc/fsl_gtm.h
>>
>> diff --git a/Documentation/powerpc/booting-without-of.txt b/=20
>> Documentation/powerpc/booting-without-of.txt
>> index 4cc7800..827b630 100644
>> --- a/Documentation/powerpc/booting-without-of.txt
>> +++ b/Documentation/powerpc/booting-without-of.txt
> [...]
>> +/**
>> + * gtm_reset_timer16 - reset 16 bit timer with arbitrary precision
>> + * @tmr:	pointer to the gtm_timer structure obtained from =20
>> gtm_get_timer
>> + * @usec:	timer interval in microseconds
>> + * @reload:	if set, the timer will reset upon expiry rather than
>> + *         	continue running free.
>> + *
>> + * This function (re)sets the GTM timer so that it counts up to =20
>> the requested
>> + * interval value, and fires the interrupt when the value is =20
>> reached. This
>> + * function will reduce the precision of the timer as needed in =20
>> order for the
>> + * requested timeout to fit in a 16-bit register.
>> + */
>> +int gtm_reset_timer16(struct gtm_timer *tmr, unsigned long usec, =20
>> bool reload)
>> +{
>> +	/* quite obvious, frequency which is enough for =C2=B5Sec =
precision */
>> +	int freq =3D 1000000;
>> +	unsigned int bit;
>> +
>> +	bit =3D fls_long(usec);
>> +	if (bit > 15) {
>> +		freq >>=3D bit - 15;
>> +		usec >>=3D bit - 15;
>> +	}
>
> if (!freq)
> 	return -EINVAL;

do you want me to fix this up on commit or are you going to respin the =20=

patch set based on feedback?

- k=

^ permalink raw reply

* Re: [PATCH 1/2] Add thread_info_cache_init() to all archs
From: Andrew Morton @ 2008-04-18  4:19 UTC (permalink / raw)
  To: Benjamin Herrenschmidt
  Cc: Linux-Arch, linux-m32r, takata, linux-kernel, linuxppc-dev,
	Paul Mackerras
In-Reply-To: <1208491086.6958.381.camel@pasglop>

On Fri, 18 Apr 2008 13:58:06 +1000 Benjamin Herrenschmidt <benh@ozlabs.org> wrote:

> 
> > > > otoh, if only one .c file will ever call this function then I think that
> > > > all problems are solved by
> > > > 
> > > > a) moving the above ifdeffery into the .c file
> > > > b) adding a comment explaining which arch file must provide the override
> > > > c) directly including that file from within the .c file.
> > > 
> > > I can definitely do that. I have no problem either way. I can add to all
> > > archs too, it's just that whatever way I choose, some people won't be
> > > happy with it :-)
> > > 
> > > Anyway, I'll move the ifdeferry to init/main.c then.
> > 
> > Thanks ;)
> > 
> > I'm still wounded by my recent encounter with set_softirq_pending()
> > and or_softirq_pending().
> 
> Well, looking there, I saw we already used weak symbols for that

Yes, `weak' is a nice solution.  It does add a few bytes of text which we
could avoid with compile-time trickery, but only a very few.

Plus this is __init anyway, although I don't know how well the combination
of `weak' and __init works.


> so what
> about the patch below ?

I like it, but the compiler won't ;)

> If you're ok, I'll re-send with appropriate sob
> & adapted powerpc part.

Sure.

> +void __init __attribute__((weak) thread_info_cache_init(void)

s/weak)/weak))/

^ permalink raw reply

* Re: [RFC/PATCH 4/4] Simplify xics direct/lpar irq_host setup
From: Benjamin Herrenschmidt @ 2008-04-18  4:16 UTC (permalink / raw)
  To: Michael Ellerman; +Cc: linuxppc-dev
In-Reply-To: <e16ca5457060787c0d339e1b707e75c6f875f7b6.1207032121.git.michael@ellerman.id.au>


On Tue, 2008-04-01 at 17:42 +1100, Michael Ellerman wrote:
> The xics code currently has a direct and lpar variant of xics_host_map, the
> only difference being which irq_chip they use. If we remember which irq_chip
> we're using we can combine these two routines. That also allows us to have a
> single irq_host_ops instead of two.
> 
> Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
> ---

Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>

^ permalink raw reply

* Re: [RFC/PATCH 3/4] Use pseries_setup_i8259_cascade() in pseries_mpic_init_IRQ()
From: Benjamin Herrenschmidt @ 2008-04-18  4:15 UTC (permalink / raw)
  To: Michael Ellerman; +Cc: linuxppc-dev
In-Reply-To: <87206bccf429273c3d7abba408ef606b69bae265.1207032121.git.michael@ellerman.id.au>


On Tue, 2008-04-01 at 17:42 +1100, Michael Ellerman wrote:
> pseries_mpic_init_IRQ() implements the same logic as the xics code did to
> find the i8259 cascade irq. Now that we've pulled that logic out into
> pseries_setup_i8259_cascade() we can use it in the mpic code.
> 
> Signed-off-by: Michael Ellerman <michael@ellerman.id.au>

Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>

(provided you test it and it works :-)

Ben.

^ permalink raw reply

* Re: [RFC/PATCH 2/4] Turn xics_setup_8259_cascade() into a generic pseries_setup_i8259_cascade()
From: Benjamin Herrenschmidt @ 2008-04-18  4:05 UTC (permalink / raw)
  To: Michael Ellerman; +Cc: linuxppc-dev
In-Reply-To: <f82f14fe5748aa91cafc9341ba02544c05090a28.1207032121.git.michael@ellerman.id.au>


On Tue, 2008-04-01 at 17:42 +1100, Michael Ellerman wrote:
> Remove the xics references from xics_setup_8259_cascade(), and merge the
> good bits from the almost identical logic in pseries_mpic_init_IRQ().
> 
> Signed-off-by: Michael Ellerman <michael@ellerman.id.au>

Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>

> ---
>  arch/powerpc/platforms/pseries/setup.c |   20 ++++++++++++--------
>  1 files changed, 12 insertions(+), 8 deletions(-)
> 
> diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c
> index 43e4801..1e1faa1 100644
> --- a/arch/powerpc/platforms/pseries/setup.c
> +++ b/arch/powerpc/platforms/pseries/setup.c
> @@ -127,28 +127,32 @@ void pseries_8259_cascade(unsigned int irq, struct irq_desc *desc)
>  	desc->chip->eoi(irq);
>  }
>  
> -static void __init xics_setup_8259_cascade(void)
> +static void __init pseries_setup_i8259_cascade(void)
>  {
>  	struct device_node *np, *old, *found = NULL;
> -	int cascade, naddr;
> +	unsigned int cascade;
>  	const u32 *addrp;
>  	unsigned long intack = 0;
> +	int naddr;
>  
> -	for_each_node_by_type(np, "interrupt-controller")
> +	for_each_node_by_type(np, "interrupt-controller") {
>  		if (of_device_is_compatible(np, "chrp,iic")) {
>  			found = np;
>  			break;
>  		}
> +	}
> +
>  	if (found == NULL) {
> -		printk(KERN_DEBUG "xics: no ISA interrupt controller\n");
> +		printk(KERN_DEBUG "pic: no ISA interrupt controller\n");
>  		return;
>  	}
> +
>  	cascade = irq_of_parse_and_map(found, 0);
>  	if (cascade == NO_IRQ) {
> -		printk(KERN_ERR "xics: failed to map cascade interrupt");
> +		printk(KERN_ERR "pic: failed to map cascade interrupt");
>  		return;
>  	}
> -	pr_debug("xics: cascade mapped to irq %d\n", cascade);
> +	pr_debug("pic: cascade mapped to irq %d\n", cascade);
>  
>  	for (old = of_node_get(found); old != NULL ; old = np) {
>  		np = of_get_parent(old);
> @@ -166,7 +170,7 @@ static void __init xics_setup_8259_cascade(void)
>  			intack |= ((unsigned long)addrp[naddr-2]) << 32;
>  	}
>  	if (intack)
> -		printk(KERN_DEBUG "xics: PCI 8259 intack at 0x%016lx\n", intack);
> +		printk(KERN_DEBUG "pic: PCI 8259 intack at 0x%016lx\n", intack);
>  	i8259_init(found, intack);
>  	of_node_put(found);
>  	set_irq_chained_handler(cascade, pseries_8259_cascade);
> @@ -254,7 +258,7 @@ static void __init pseries_mpic_init_IRQ(void)
>  static void __init pseries_xics_init_IRQ(void)
>  {
>  	xics_init_IRQ();
> -	xics_setup_8259_cascade();
> +	pseries_setup_i8259_cascade();
>  }
>  
>  static void pseries_lpar_enable_pmcs(void)

^ permalink raw reply

* Re: [RFC/PATCH 1/4] Move xics_setup_8259_cascade() into platforms/pseries/setup.c
From: Benjamin Herrenschmidt @ 2008-04-18  3:59 UTC (permalink / raw)
  To: Michael Ellerman; +Cc: linuxppc-dev
In-Reply-To: <6840627eab063b5246ec661968986a4ae2d7be61.1207032121.git.michael@ellerman.id.au>


On Tue, 2008-04-01 at 17:42 +1100, Michael Ellerman wrote:
> The code in xics.c to setup the i8259 cascaded irq handler is not really
> xics specific, so move it into setup.c - we will clean this up further in
> a subsequent patch.
> 
> Signed-off-by: Michael Ellerman <michael@ellerman.id.au>

Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>

> ---
>  arch/powerpc/platforms/pseries/setup.c |   53 +++++++++++++++++++++++++++++++-
>  arch/powerpc/platforms/pseries/xics.c  |   48 -----------------------------
>  arch/powerpc/platforms/pseries/xics.h  |    3 --
>  3 files changed, 52 insertions(+), 52 deletions(-)
> 
> diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c
> index fdb9b1c..43e4801 100644
> --- a/arch/powerpc/platforms/pseries/setup.c
> +++ b/arch/powerpc/platforms/pseries/setup.c
> @@ -127,6 +127,51 @@ void pseries_8259_cascade(unsigned int irq, struct irq_desc *desc)
>  	desc->chip->eoi(irq);
>  }
>  
> +static void __init xics_setup_8259_cascade(void)
> +{
> +	struct device_node *np, *old, *found = NULL;
> +	int cascade, naddr;
> +	const u32 *addrp;
> +	unsigned long intack = 0;
> +
> +	for_each_node_by_type(np, "interrupt-controller")
> +		if (of_device_is_compatible(np, "chrp,iic")) {
> +			found = np;
> +			break;
> +		}
> +	if (found == NULL) {
> +		printk(KERN_DEBUG "xics: no ISA interrupt controller\n");
> +		return;
> +	}
> +	cascade = irq_of_parse_and_map(found, 0);
> +	if (cascade == NO_IRQ) {
> +		printk(KERN_ERR "xics: failed to map cascade interrupt");
> +		return;
> +	}
> +	pr_debug("xics: cascade mapped to irq %d\n", cascade);
> +
> +	for (old = of_node_get(found); old != NULL ; old = np) {
> +		np = of_get_parent(old);
> +		of_node_put(old);
> +		if (np == NULL)
> +			break;
> +		if (strcmp(np->name, "pci") != 0)
> +			continue;
> +		addrp = of_get_property(np, "8259-interrupt-acknowledge", NULL);
> +		if (addrp == NULL)
> +			continue;
> +		naddr = of_n_addr_cells(np);
> +		intack = addrp[naddr-1];
> +		if (naddr > 1)
> +			intack |= ((unsigned long)addrp[naddr-2]) << 32;
> +	}
> +	if (intack)
> +		printk(KERN_DEBUG "xics: PCI 8259 intack at 0x%016lx\n", intack);
> +	i8259_init(found, intack);
> +	of_node_put(found);
> +	set_irq_chained_handler(cascade, pseries_8259_cascade);
> +}
> +
>  static void __init pseries_mpic_init_IRQ(void)
>  {
>  	struct device_node *np, *old, *cascade = NULL;
> @@ -206,6 +251,12 @@ static void __init pseries_mpic_init_IRQ(void)
>  	set_irq_chained_handler(cascade_irq, pseries_8259_cascade);
>  }
>  
> +static void __init pseries_xics_init_IRQ(void)
> +{
> +	xics_init_IRQ();
> +	xics_setup_8259_cascade();
> +}
> +
>  static void pseries_lpar_enable_pmcs(void)
>  {
>  	unsigned long set, reset;
> @@ -235,7 +286,7 @@ static void __init pseries_discover_pic(void)
>  			smp_init_pseries_mpic();
>  			return;
>  		} else if (strstr(typep, "ppc-xicp")) {
> -			ppc_md.init_IRQ       = xics_init_IRQ;
> +			ppc_md.init_IRQ       = pseries_xics_init_IRQ;
>  			setup_kexec_cpu_down_xics();
>  			smp_init_pseries_xics();
>  			return;
> diff --git a/arch/powerpc/platforms/pseries/xics.c b/arch/powerpc/platforms/pseries/xics.c
> index ca52b58..5a72f27 100644
> --- a/arch/powerpc/platforms/pseries/xics.c
> +++ b/arch/powerpc/platforms/pseries/xics.c
> @@ -655,52 +655,6 @@ static void __init xics_init_one_node(struct device_node *np,
>  	}
>  }
>  
> -
> -static void __init xics_setup_8259_cascade(void)
> -{
> -	struct device_node *np, *old, *found = NULL;
> -	int cascade, naddr;
> -	const u32 *addrp;
> -	unsigned long intack = 0;
> -
> -	for_each_node_by_type(np, "interrupt-controller")
> -		if (of_device_is_compatible(np, "chrp,iic")) {
> -			found = np;
> -			break;
> -		}
> -	if (found == NULL) {
> -		printk(KERN_DEBUG "xics: no ISA interrupt controller\n");
> -		return;
> -	}
> -	cascade = irq_of_parse_and_map(found, 0);
> -	if (cascade == NO_IRQ) {
> -		printk(KERN_ERR "xics: failed to map cascade interrupt");
> -		return;
> -	}
> -	pr_debug("xics: cascade mapped to irq %d\n", cascade);
> -
> -	for (old = of_node_get(found); old != NULL ; old = np) {
> -		np = of_get_parent(old);
> -		of_node_put(old);
> -		if (np == NULL)
> -			break;
> -		if (strcmp(np->name, "pci") != 0)
> -			continue;
> -		addrp = of_get_property(np, "8259-interrupt-acknowledge", NULL);
> -		if (addrp == NULL)
> -			continue;
> -		naddr = of_n_addr_cells(np);
> -		intack = addrp[naddr-1];
> -		if (naddr > 1)
> -			intack |= ((unsigned long)addrp[naddr-2]) << 32;
> -	}
> -	if (intack)
> -		printk(KERN_DEBUG "xics: PCI 8259 intack at 0x%016lx\n", intack);
> -	i8259_init(found, intack);
> -	of_node_put(found);
> -	set_irq_chained_handler(cascade, pseries_8259_cascade);
> -}
> -
>  void __init xics_init_IRQ(void)
>  {
>  	struct device_node *np;
> @@ -733,8 +687,6 @@ void __init xics_init_IRQ(void)
>  
>  	xics_setup_cpu();
>  
> -	xics_setup_8259_cascade();
> -
>  	ppc64_boot_msg(0x21, "XICS Done");
>  }
>  
> diff --git a/arch/powerpc/platforms/pseries/xics.h b/arch/powerpc/platforms/pseries/xics.h
> index c26bcff..1c5321a 100644
> --- a/arch/powerpc/platforms/pseries/xics.h
> +++ b/arch/powerpc/platforms/pseries/xics.h
> @@ -28,7 +28,4 @@ struct xics_ipi_struct {
>  
>  extern struct xics_ipi_struct xics_ipi_message[NR_CPUS] __cacheline_aligned;
>  
> -struct irq_desc;
> -extern void pseries_8259_cascade(unsigned int irq, struct irq_desc *desc);
> -
>  #endif /* _POWERPC_KERNEL_XICS_H */

^ permalink raw reply

* Re: [PATCH 1/2] Add thread_info_cache_init() to all archs
From: Benjamin Herrenschmidt @ 2008-04-18  3:58 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Linux-Arch, linux-m32r, takata, linux-kernel, linuxppc-dev,
	Paul Mackerras
In-Reply-To: <20080413191338.9776ebd0.akpm@linux-foundation.org>


> > > otoh, if only one .c file will ever call this function then I think that
> > > all problems are solved by
> > > 
> > > a) moving the above ifdeffery into the .c file
> > > b) adding a comment explaining which arch file must provide the override
> > > c) directly including that file from within the .c file.
> > 
> > I can definitely do that. I have no problem either way. I can add to all
> > archs too, it's just that whatever way I choose, some people won't be
> > happy with it :-)
> > 
> > Anyway, I'll move the ifdeferry to init/main.c then.
> 
> Thanks ;)
> 
> I'm still wounded by my recent encounter with set_softirq_pending()
> and or_softirq_pending().

Well, looking there, I saw we already used weak symbols for that so what
about the patch below ? If you're ok, I'll re-send with appropriate sob
& adapted powerpc part.

Cheers,
Ben.

Index: linux-work/init/main.c
===================================================================
--- linux-work.orig/init/main.c	2008-03-26 10:39:25.000000000 +1100
+++ linux-work/init/main.c	2008-04-18 13:10:35.000000000 +1000
@@ -504,6 +504,10 @@ void __init __attribute__((weak)) smp_se
 {
 }
 
+void __init __attribute__((weak) thread_info_cache_init(void)
+{
+}
+
 asmlinkage void __init start_kernel(void)
 {
 	char * command_line;
@@ -623,6 +627,7 @@ asmlinkage void __init start_kernel(void
 	if (efi_enabled)
 		efi_enter_virtual_mode();
 #endif
+	thread_info_cache_init();
 	fork_init(num_physpages);
 	proc_caches_init();
 	buffer_init();
Index: linux-work/include/linux/sched.h
===================================================================
--- linux-work.orig/include/linux/sched.h	2008-04-02 09:47:56.000000000 +1100
+++ linux-work/include/linux/sched.h	2008-04-18 13:11:10.000000000 +1000
@@ -1893,6 +1893,8 @@ static inline unsigned long *end_of_stac
 
 #endif
 
+extern void thread_info_cache_init(void);
+
 /* set thread flags in other task's structures
  * - see asm/thread_info.h for TIF_xxxx flags available
  */

^ permalink raw reply

* Re: More patches pushed to powerpc.git master and powerpc-next branches (second try)
From: Michael Ellerman @ 2008-04-18  3:49 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: linuxppc-dev
In-Reply-To: <18438.39830.98206.763623@cargo.ozlabs.ibm.com>

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

Hi Paul,

Can you grab these when you're bored?

http://patchwork.ozlabs.org/linuxppc/patch?q=ellerman&id=17653
http://patchwork.ozlabs.org/linuxppc/patch?q=ellerman&id=17654
http://patchwork.ozlabs.org/linuxppc/patch?q=ellerman&id=17655
http://patchwork.ozlabs.org/linuxppc/patch?q=ellerman&id=17656

BenH might want to Ack them.

cheers

-- 
Michael Ellerman
OzLabs, IBM Australia Development Lab

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

* RE: [PATCH v2][POWERPC] qe_lib and ucc_geth: switch to the cpm_muram implementation
From: Li Yang @ 2008-04-18  3:29 UTC (permalink / raw)
  To: Wood Scott; +Cc: netdev, linuxppc-dev, Jeff Garzik, Tabi Timur
In-Reply-To: <20080417141043.GA21793@ld0162-tx32.am.freescale.net>

> -----Original Message-----
> From: Wood Scott=20
> Sent: Thursday, April 17, 2008 10:11 PM
> To: Li Yang
> Cc: avorontsov@ru.mvista.com; Kumar Gala;=20
> linuxppc-dev@ozlabs.org; Jeff Garzik; Tabi Timur;=20
> netdev@vger.kernel.org
> Subject: Re: [PATCH v2][POWERPC] qe_lib and ucc_geth: switch=20
> to the cpm_muram implementation
>=20
> On Wed, Apr 16, 2008 at 08:38:19PM -0700, Li Yang wrote:
> > It is a good thing to unify the CPM dpram operation and QE muram=20
> > operation.  But I'm having concerns about the naming as CPM is an=20
> > obsolete block.  Can we change to use the new name QE instead?
>=20
> And then change it again when marketing decides that CPM4=20
> will be called something other than QE2? :-P

It's a good point. :)  Technically they are quite similar.  But they are
not so well known as Pentium to x86.  The change will cause confusion
especially when both of the terms of CPM and QE are used in one file.  I
agree with Kumar's suggestion that we keep both names.

- Leo

^ permalink raw reply

* Re: problems with 'XPAR_PLB_CLOCK_FREQ_HZ'.
From: Grant Likely @ 2008-04-18  3:14 UTC (permalink / raw)
  To: rodolfo; +Cc: Linuxppc embedded
In-Reply-To: <75c089d6de2ba74b5fdbf6a6fd91e468@lesc.ufc.br>

On Thu, Apr 17, 2008 at 12:15 PM, rodolfo <rodolfo@lesc.ufc.br> wrote:
> Hi, everybody,
>
>  my xparameters_ml300.h does not include 'XPAR_PLB_CLOCK_FREQ_HZ'.
>
>
>   CC      arch/ppc/boot/simple/embed_config.o
>  arch/ppc/boot/simple/embed_config.c: In function 'embed_config':
>  arch/ppc/boot/simple/embed_config.c:781: error: 'XPAR_PLB_CLOCK_FREQ_HZ'
>  undeclared (first use in this function)
>  arch/ppc/boot/simple/embed_config.c:781: error: (Each undeclared identifier
>  is reported only once
>  arch/ppc/boot/simple/embed_config.c:781: error: for each function it
>  appears in.)
>  make[2]: ** [arch/ppc/boot/simple/embed_config.o] Erro 1
>  make[1]: ** [simple] Erro 2
>  make: ** [zImage] Erro 2
>

You probably didn't select the "linux_26" OS target in software
platform settings before generating your xparameters_ml40x.h file.

>
>  Can I replace 'XPAR_PLB_CLOCK_FREQ_HZ' for XPAR_CORE_CLOCK_FREQ_HZ/3
>  knowing that my MHS file description is:

No; that one is different.

Cheers,
g.

-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

^ permalink raw reply

* [PATCH] [POWERPC] Port fixmap from x86 and use for kmap_atomic
From: Kumar Gala @ 2008-04-18  2:57 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: linuxppc-dev

The fixmap code from x86 allows us to have compile time virtual addresses
that we change the physical addresses of at run time.

This is useful for applications like kmap_atomic, PCI config that is done
via direct memory map, kexec/kdump.

We got ride of CONFIG_HIGHMEM_START as we can now determine a more optimal
location for PKMAP_BASE based on where the fixmap addresses start and
working back from there.

Additionally, the kmap code in asm-powerpc/highmem.h always had debug
enabled.  Moved to using CONFIG_DEBUG_HIGHMEM to determine if we should
have the extra debug checking.

Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
---
 arch/powerpc/Kconfig          |   14 -----
 arch/powerpc/mm/init_32.c     |    8 ---
 arch/powerpc/mm/mem.c         |   32 ++++++++++--
 arch/powerpc/mm/pgtable_32.c  |   23 ++++++++
 include/asm-powerpc/fixmap.h  |  112 +++++++++++++++++++++++++++++++++++++++++
 include/asm-powerpc/highmem.h |   41 ++++++++-------
 6 files changed, 183 insertions(+), 47 deletions(-)
 create mode 100644 include/asm-powerpc/fixmap.h

diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 10e9df7..96cc0ad 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -613,20 +613,6 @@ config ADVANCED_OPTIONS
 comment "Default settings for advanced configuration options are used"
 	depends on !ADVANCED_OPTIONS

-config HIGHMEM_START_BOOL
-	bool "Set high memory pool address"
-	depends on ADVANCED_OPTIONS && HIGHMEM
-	help
-	  This option allows you to set the base address of the kernel virtual
-	  area used to map high memory pages.  This can be useful in
-	  optimizing the layout of kernel virtual memory.
-
-	  Say N here unless you know what you are doing.
-
-config HIGHMEM_START
-	hex "Virtual start address of high memory pool" if HIGHMEM_START_BOOL
-	default "0xfe000000"
-
 config LOWMEM_SIZE_BOOL
 	bool "Set maximum low memory"
 	depends on ADVANCED_OPTIONS
diff --git a/arch/powerpc/mm/init_32.c b/arch/powerpc/mm/init_32.c
index 578750e..1952b4d 100644
--- a/arch/powerpc/mm/init_32.c
+++ b/arch/powerpc/mm/init_32.c
@@ -71,14 +71,6 @@ unsigned long agp_special_page;
 EXPORT_SYMBOL(agp_special_page);
 #endif

-#ifdef CONFIG_HIGHMEM
-pte_t *kmap_pte;
-pgprot_t kmap_prot;
-
-EXPORT_SYMBOL(kmap_prot);
-EXPORT_SYMBOL(kmap_pte);
-#endif
-
 void MMU_init(void);

 /* XXX should be in current.h  -- paulus */
diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c
index 0062e6b..5ccb579 100644
--- a/arch/powerpc/mm/mem.c
+++ b/arch/powerpc/mm/mem.c
@@ -45,6 +45,7 @@
 #include <asm/tlb.h>
 #include <asm/sections.h>
 #include <asm/vdso.h>
+#include <asm/fixmap.h>

 #include "mmu_decl.h"

@@ -57,6 +58,20 @@ int init_bootmem_done;
 int mem_init_done;
 unsigned long memory_limit;

+#ifdef CONFIG_HIGHMEM
+pte_t *kmap_pte;
+pgprot_t kmap_prot;
+
+EXPORT_SYMBOL(kmap_prot);
+EXPORT_SYMBOL(kmap_pte);
+
+static inline pte_t *virt_to_kpte(unsigned long vaddr)
+{
+	return pte_offset_kernel(pmd_offset(pud_offset(pgd_offset_k(vaddr),
+			vaddr), vaddr), vaddr);
+}
+#endif
+
 int page_is_ram(unsigned long pfn)
 {
 	unsigned long paddr = (pfn << PAGE_SHIFT);
@@ -311,14 +326,19 @@ void __init paging_init(void)
 	unsigned long top_of_ram = lmb_end_of_DRAM();
 	unsigned long max_zone_pfns[MAX_NR_ZONES];

+#ifdef CONFIG_PPC32
+	unsigned long v = __fix_to_virt(__end_of_fixed_addresses - 1);
+	unsigned long end = __fix_to_virt(FIX_HOLE);
+
+	for (; v < end; v += PAGE_SIZE)
+		map_page(v, 0, 0); /* XXX gross */
+#endif
+
 #ifdef CONFIG_HIGHMEM
 	map_page(PKMAP_BASE, 0, 0);	/* XXX gross */
-	pkmap_page_table = pte_offset_kernel(pmd_offset(pud_offset(pgd_offset_k
-			(PKMAP_BASE), PKMAP_BASE), PKMAP_BASE), PKMAP_BASE);
-	map_page(KMAP_FIX_BEGIN, 0, 0);	/* XXX gross */
-	kmap_pte = pte_offset_kernel(pmd_offset(pud_offset(pgd_offset_k
-			(KMAP_FIX_BEGIN), KMAP_FIX_BEGIN), KMAP_FIX_BEGIN),
-			 KMAP_FIX_BEGIN);
+	pkmap_page_table = virt_to_kpte(PKMAP_BASE);
+
+	kmap_pte = virt_to_kpte(__fix_to_virt(FIX_KMAP_BEGIN));
 	kmap_prot = PAGE_KERNEL;
 #endif /* CONFIG_HIGHMEM */

diff --git a/arch/powerpc/mm/pgtable_32.c b/arch/powerpc/mm/pgtable_32.c
index 64c44bc..5d0a601 100644
--- a/arch/powerpc/mm/pgtable_32.c
+++ b/arch/powerpc/mm/pgtable_32.c
@@ -29,6 +29,7 @@

 #include <asm/pgtable.h>
 #include <asm/pgalloc.h>
+#include <asm/fixmap.h>
 #include <asm/io.h>

 #include "mmu_decl.h"
@@ -387,3 +388,25 @@ void kernel_map_pages(struct page *page, int numpages, int enable)
 	change_page_attr(page, numpages, enable ? PAGE_KERNEL : __pgprot(0));
 }
 #endif /* CONFIG_DEBUG_PAGEALLOC */
+
+static int fixmaps;
+unsigned long __FIXADDR_TOP = 0xfffff000;
+EXPORT_SYMBOL(__FIXADDR_TOP);
+
+void __set_fixmap (enum fixed_addresses idx, phys_addr_t phys, pgprot_t flags)
+{
+	unsigned long address = __fix_to_virt(idx);
+
+	if (idx >= __end_of_fixed_addresses) {
+		BUG();
+		return;
+	}
+
+	map_page(address, phys, flags);
+	fixmaps++;
+}
+
+void __this_fixmap_does_not_exist(void)
+{
+	WARN_ON(1);
+}
diff --git a/include/asm-powerpc/fixmap.h b/include/asm-powerpc/fixmap.h
new file mode 100644
index 0000000..f303921
--- /dev/null
+++ b/include/asm-powerpc/fixmap.h
@@ -0,0 +1,112 @@
+/*
+ * fixmap.h: compile-time virtual memory allocation
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Copyright (C) 1998 Ingo Molnar
+ *
+ * Support of BIGMEM added by Gerhard Wichert, Siemens AG, July 1999
+ *
+ * Copyright 2008 Freescale Semiconductor Inc.
+ *   Port to powerpc added by Kumar Gala
+ */
+
+#ifndef _ASM_FIXMAP_H
+#define _ASM_FIXMAP_H
+
+extern unsigned long __FIXADDR_TOP;
+
+#ifndef __ASSEMBLY__
+#include <linux/kernel.h>
+#include <asm/page.h>
+#ifdef CONFIG_HIGHMEM
+#include <linux/threads.h>
+#include <asm/kmap_types.h>
+#endif
+
+/*
+ * Here we define all the compile-time 'special' virtual
+ * addresses. The point is to have a constant address at
+ * compile time, but to set the physical address only
+ * in the boot process. We allocate these special addresses
+ * from the end of virtual memory (0xfffff000) backwards.
+ * Also this lets us do fail-safe vmalloc(), we
+ * can guarantee that these special addresses and
+ * vmalloc()-ed addresses never overlap.
+ *
+ * these 'compile-time allocated' memory buffers are
+ * fixed-size 4k pages. (or larger if used with an increment
+ * highger than 1) use fixmap_set(idx,phys) to associate
+ * physical memory with fixmap indices.
+ *
+ * TLB entries of such buffers will not be flushed across
+ * task switches.
+ */
+enum fixed_addresses {
+	FIX_HOLE,
+#ifdef CONFIG_HIGHMEM
+	FIX_KMAP_BEGIN,	/* reserved pte's for temporary kernel mappings */
+	FIX_KMAP_END = FIX_KMAP_BEGIN+(KM_TYPE_NR*NR_CPUS)-1,
+#endif
+	/* FIX_PCIE_MCFG, */
+	__end_of_fixed_addresses
+};
+
+extern void __set_fixmap (enum fixed_addresses idx,
+					phys_addr_t phys, pgprot_t flags);
+
+#define set_fixmap(idx, phys) \
+		__set_fixmap(idx, phys, PAGE_KERNEL)
+/*
+ * Some hardware wants to get fixmapped without caching.
+ */
+#define set_fixmap_nocache(idx, phys) \
+		__set_fixmap(idx, phys, PAGE_KERNEL_NOCACHE)
+
+#define clear_fixmap(idx) \
+		__set_fixmap(idx, 0, __pgprot(0))
+
+#define FIXADDR_TOP	((unsigned long)__FIXADDR_TOP)
+
+#define __FIXADDR_SIZE	(__end_of_fixed_addresses << PAGE_SHIFT)
+#define __FIXADDR_BOOT_SIZE	(__end_of_fixed_addresses << PAGE_SHIFT)
+#define FIXADDR_START		(FIXADDR_TOP - __FIXADDR_SIZE)
+#define FIXADDR_BOOT_START	(FIXADDR_TOP - __FIXADDR_BOOT_SIZE)
+
+#define __fix_to_virt(x)	(FIXADDR_TOP - ((x) << PAGE_SHIFT))
+#define __virt_to_fix(x)	((FIXADDR_TOP - ((x)&PAGE_MASK)) >> PAGE_SHIFT)
+
+extern void __this_fixmap_does_not_exist(void);
+
+/*
+ * 'index to address' translation. If anyone tries to use the idx
+ * directly without tranlation, we catch the bug with a NULL-deference
+ * kernel oops. Illegal ranges of incoming indices are caught too.
+ */
+static __always_inline unsigned long fix_to_virt(const unsigned int idx)
+{
+	/*
+	 * this branch gets completely eliminated after inlining,
+	 * except when someone tries to use fixaddr indices in an
+	 * illegal way. (such as mixing up address types or using
+	 * out-of-range indices).
+	 *
+	 * If it doesn't get removed, the linker will complain
+	 * loudly with a reasonably clear error message..
+	 */
+	if (idx >= __end_of_fixed_addresses)
+		__this_fixmap_does_not_exist();
+
+        return __fix_to_virt(idx);
+}
+
+static inline unsigned long virt_to_fix(const unsigned long vaddr)
+{
+	BUG_ON(vaddr >= FIXADDR_TOP || vaddr < FIXADDR_START);
+	return __virt_to_fix(vaddr);
+}
+
+#endif /* !__ASSEMBLY__ */
+#endif
diff --git a/include/asm-powerpc/highmem.h b/include/asm-powerpc/highmem.h
index f7b21ee..d81a088 100644
--- a/include/asm-powerpc/highmem.h
+++ b/include/asm-powerpc/highmem.h
@@ -27,9 +27,7 @@
 #include <asm/kmap_types.h>
 #include <asm/tlbflush.h>
 #include <asm/page.h>
-
-/* undef for production */
-#define HIGHMEM_DEBUG 1
+#include <asm/fixmap.h>

 extern pte_t *kmap_pte;
 extern pgprot_t kmap_prot;
@@ -40,14 +38,12 @@ extern pte_t *pkmap_page_table;
  * easily, subsequent pte tables have to be allocated in one physical
  * chunk of RAM.
  */
-#define PKMAP_BASE 	CONFIG_HIGHMEM_START
 #define LAST_PKMAP 	(1 << PTE_SHIFT)
 #define LAST_PKMAP_MASK (LAST_PKMAP-1)
+#define PKMAP_BASE	((FIXADDR_BOOT_START - PAGE_SIZE*(LAST_PKMAP + 1)) & PMD_MASK)
 #define PKMAP_NR(virt)  ((virt-PKMAP_BASE) >> PAGE_SHIFT)
 #define PKMAP_ADDR(nr)  (PKMAP_BASE + ((nr) << PAGE_SHIFT))

-#define KMAP_FIX_BEGIN	(PKMAP_BASE + 0x00400000UL)
-
 extern void *kmap_high(struct page *page);
 extern void kunmap_high(struct page *page);

@@ -73,7 +69,7 @@ static inline void kunmap(struct page *page)
  * be used in IRQ contexts, so in some (very limited) cases we need
  * it.
  */
-static inline void *kmap_atomic(struct page *page, enum km_type type)
+static inline void *kmap_atomic_prot(struct page *page, enum km_type type, pgprot_t prot)
 {
 	unsigned int idx;
 	unsigned long vaddr;
@@ -84,34 +80,39 @@ static inline void *kmap_atomic(struct page *page, enum km_type type)
 		return page_address(page);

 	idx = type + KM_TYPE_NR*smp_processor_id();
-	vaddr = KMAP_FIX_BEGIN + idx * PAGE_SIZE;
-#ifdef HIGHMEM_DEBUG
-	BUG_ON(!pte_none(*(kmap_pte+idx)));
+	vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx);
+#ifdef CONFIG_DEBUG_HIGHMEM
+	BUG_ON(!pte_none(*(kmap_pte-idx)));
 #endif
-	set_pte_at(&init_mm, vaddr, kmap_pte+idx, mk_pte(page, kmap_prot));
+	set_pte_at(&init_mm, vaddr, kmap_pte-idx, mk_pte(page, prot));
 	flush_tlb_page(NULL, vaddr);

 	return (void*) vaddr;
 }

+static inline void *kmap_atomic(struct page *page, enum km_type type)
+{
+	return kmap_atomic_prot(page, type, kmap_prot);
+}
+
 static inline void kunmap_atomic(void *kvaddr, enum km_type type)
 {
-#ifdef HIGHMEM_DEBUG
+#ifdef CONFIG_DEBUG_HIGHMEM
 	unsigned long vaddr = (unsigned long) kvaddr & PAGE_MASK;
-	unsigned int idx = type + KM_TYPE_NR*smp_processor_id();
+	enum fixed_addresses idx = type + KM_TYPE_NR*smp_processor_id();

-	if (vaddr < KMAP_FIX_BEGIN) { // FIXME
+	if (vaddr < __fix_to_virt(FIX_KMAP_END)) {
 		pagefault_enable();
 		return;
 	}

-	BUG_ON(vaddr != KMAP_FIX_BEGIN + idx * PAGE_SIZE);
+	BUG_ON(vaddr != __fix_to_virt(FIX_KMAP_BEGIN + idx));

 	/*
 	 * force other mappings to Oops if they'll try to access
 	 * this pte without first remap it
 	 */
-	pte_clear(&init_mm, vaddr, kmap_pte+idx);
+	pte_clear(&init_mm, vaddr, kmap_pte-idx);
 	flush_tlb_page(NULL, vaddr);
 #endif
 	pagefault_enable();
@@ -120,12 +121,14 @@ static inline void kunmap_atomic(void *kvaddr, enum km_type type)
 static inline struct page *kmap_atomic_to_page(void *ptr)
 {
 	unsigned long idx, vaddr = (unsigned long) ptr;
+	pte_t *pte;

-	if (vaddr < KMAP_FIX_BEGIN)
+	if (vaddr < FIXADDR_START)
 		return virt_to_page(ptr);

-	idx = (vaddr - KMAP_FIX_BEGIN) >> PAGE_SHIFT;
-	return pte_page(kmap_pte[idx]);
+	idx = virt_to_fix(vaddr);
+	pte = kmap_pte - (idx - FIX_KMAP_BEGIN);
+	return pte_page(*pte);
 }

 #define flush_cache_kmaps()	flush_cache_all()
-- 
1.5.4.1

^ permalink raw reply related

* Re: [PATCH 4/5] [POWERPC] QE: implement support for the GPIO LIB API
From: Kumar Gala @ 2008-04-18  2:21 UTC (permalink / raw)
  To: cbouatmailru; +Cc: linuxppc-dev
In-Reply-To: <20080417224106.GA22438@zarina>


On Apr 17, 2008, at 5:41 PM, Anton Vorontsov wrote:
> On Thu, Apr 17, 2008 at 05:35:53PM -0500, Kumar Gala wrote:
>>> index a3f9c3f..a4a195a 100644
>>> --- a/arch/powerpc/sysdev/qe_lib/qe_io.c
>>> +++ b/arch/powerpc/sysdev/qe_lib/qe_io.c
>>> @@ -20,7 +20,8 @@
>>> #include <linux/errno.h>
>>> #include <linux/module.h>
>>> #include <linux/ioport.h>
>>> -
>>> +#include <linux/spinlock.h>
>>> +#include <linux/of_gpio.h>
>>> #include <asm/io.h>
>>> #include <asm/qe.h>
>>> #include <asm/prom.h>
>>> @@ -214,6 +215,140 @@ int par_io_of_config(struct device_node *np)
>>> }
>>> EXPORT_SYMBOL(par_io_of_config);
>>
>> can we split this out into a new file since its pretty much a driver.
>
> No problem. Would you prefer this to go under drivers/gpio/ ?


Yes that would be better.  We actively worked on pull drivers out of  
arch/ppc back in the day.

- k

^ permalink raw reply

* Re: [PATCH] 86xx: mark functions static, other minor cleanups
From: David Gibson @ 2008-04-18  0:35 UTC (permalink / raw)
  To: Paul Gortmaker; +Cc: Scott Wood, Paul Gortmaker, linuxppc-dev, sfr
In-Reply-To: <7d1d9c250804141832pa9c9fbbicf4939c9854dc5f5@mail.gmail.com>

On Mon, Apr 14, 2008 at 09:32:44PM -0400, Paul Gortmaker wrote:
> On Fri, Apr 11, 2008 at 3:11 PM, Segher Boessenkool
> <segher@kernel.crashing.org> wrote:
> >
> > > Updated as per above, and with tickerized prefixes for sbc8641.
> > >
> >
> >  Care to try once more?  It's only "tickerized" if it's in all
> >  uppercase.
> 
> I'm looking at what exists in arch/powerpc/boot/dts/* and I'm
> not seeing too much uppercase - here is a sample:
> 
> ebony.dts:        compatible = "ibm,ebony";
> ep405.dts:        compatible = "ibm,uic";
> ep8248e.dts:    compatible = "fsl,ep8248e";
> bamboo.dts:     compatible = "amcc,bamboo";
> cm5200.dts:     compatible = "schindler,cm5200";
> ep88xc.dts:     compatible = "fsl,ep88xc";
> haleakala.dts:  compatible = "amcc,kilauea";
> holly.dts:         compatible = "ibm,holly";
> katmai.dts:     compatible = "amcc,katmai";
> kilauea.dts:    compatible = "amcc,kilauea";
> lite5200b.dts:  compatible = "fsl,lite5200b";
> motionpro.dts:  compatible = "promess,motionpro";
> mpc8272ads.dts: compatible = "fsl,mpc8272ads";
> mpc866ads.dts:  compatible = "fsl,mpc866ads";
> 
> > > +       compatible = "wind,sbc8641";
> 
> To me this looks in keeping with the rest.  And I prefer
> with the lower case, actually.  (Apparently so do a lot of
> other people...)

The confusion arises due to a difference between historical OF
practice, and current flattened DT practice.

Historically, as Segher says, uppercase names are stock tickers (and
thereby a centrally registered, guaranteed-unique namespace).
Lowercase names are a free-for-all, no central management, put pick a
reasonable name and it will probably be ok.

Use of the formal uppercase names in OF practice isn't particularly
common - there certainly are AAPL, and IBM, names out there but
they're rather outnumbered by the informal lowercase prefixes.  Which
is why most of us doing flattened tree work didn't realise the
distinction.  So, the flattened tree Linux community independently
came up with the convention of using stock tickers as a way of
uniqueifying the names - but used lowercase names.

So, it's a bit of a mess.  Here's my recommended procedure:

	* If you can find a single dominant existing practice for the
vendor in question, use that.  (Consider both OF and flattened tree
practice). i.e. existing practice trumps all.

	* If you can't find any existing practice and need to make a
new prefix, use the stock ticker.

	* If you find more than one existing practice (and none is
clearly dominant), take it to the list and we can argue about it.

-- 
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: [EFIKA] Really, don't pretend to be CHRP
From: David Gibson @ 2008-04-18  0:17 UTC (permalink / raw)
  To: Matt Sealey; +Cc: linuxppc-dev, David Woodhouse, paulus
In-Reply-To: <48076A00.1080608@genesi-usa.com>

On Thu, Apr 17, 2008 at 04:17:20PM +0100, Matt Sealey wrote:
>
> David Woodhouse wrote:
>> On Thu, 2008-04-17 at 13:28 +0100, Matt Sealey wrote:
>>> I thought we were using efika.forth for this in Fedora.
>>
>> We were, until you pointed out that the kernel actually works just fine
>> these days without it.
>
> I said the kernel has had braindead patches shoved into it that sort of
> obviate the need for the most heinous of crimes committed in the Efika
> device tree.
>
> The Linux kernel fixups don't add the CDM or XLB arbiter or many other
> components some out-of-mainline drivers will need (and should be able
> to just access without writing a fixup first) to map to work properly.
> Adding these will clean up things like the UART module, Sylvain's sleep
> patches will work on Efika, etc.
>
>> can't set environment variables from within Linux (and yes, we can
>> probably improve on that too, but we let them setenv for themselves, for
>> now).
>
> You really won't be improving on it because there's no reliable way to
> pass setenv back to the firmware from userland :D
>
>> That might be a little cleaner than what we have at the moment, yes. But
>> what we have also works, so I'd rather concentrate on things like
>> getting audio support merged, before we faff around with what are
>> essentially cosmetics.
>
> My ideal situation is all this stuff is stripped from the kernel. You do
> realise 90% of the Efika traffic on this list is submitting code that
> fixes fixups for a firmware which has a seperated fixup script, putting
> the responsibility firmly where Linux-PPC policy dictated it should be
> (with the firmware).

That's not Linux-PPC policy as far as I'm concerned.  It's nice if
firmware provides a more-or-less accurate device tree, but we're not
naive enough to think that's actually going to happen.  Firmware
always is, and always will be, crap, so it's expected that the kernel
will have to workaround device tree inaccuracies in the firmware.

Sometimes the simplest way of doing that is just to have workarounds
in the drivers.  Other times, doing that would be ugly and invasive,
so instead the bootwrapper should fixup the device tree before passing
it on to the kernel - this is one of the purposes of the bootwrapper.

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

* eldk and usb to serial converters
From: Daniel Stonier @ 2008-04-18  0:04 UTC (permalink / raw)
  To: Linuxppc-embedded

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

Hi all,

I'm currently trying to compile a kernel for an AMCC440EP board within an
eldk environment. We've got a FTDI usb2serial converter we need to connect
to the board. Now I've compiled a kernel on a gentoo machine for this device
and had no problems. With this board, the kernel recognizes the device fine:

ftdi_sio 1-1:1.0: FTDI USB Serial Device converter detected
usb 1-1: FTDI USB Serial Device converter now attached to ttyUSB0
drivers/usb/serial/ftdi_sio.c: v1.4.3:USB FTDI Serial Converters Driver

but udev doesn't actually make the ttyUSB0 node. If anyone knows what may
have caused the problem and how to fix it, it'd be much appreciated.

Cheers,
Daniel.

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

^ permalink raw reply

* [PATCH] sysdev,mv64x60: initialization of mv64x60 ethernet, serial and I2C
From: Remi Machet @ 2008-04-17 23:35 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: linuxppc-dev

This patch affects only the mv64x60 driver. It fixes 2 problem:

-If one of the devices of the mv64x60 init fails, the remaining 
devices are not initialized => I changed the code to display an
error and continue the initialization.

-I2C parameters freq_m and freq_n are assigned default in the code
but if those properties are not found in the open firmware description 
the init returns an error=> the code now uses the default
values if the properties are not found.

Signed-off-by: Remi Machet (rmachet@slac.stanford.edu)
---

diff --git a/arch/powerpc/sysdev/mv64x60_dev.c b/arch/powerpc/sysdev/mv64x60_dev.c
index 047b310..ef0fc99 100644
--- a/arch/powerpc/sysdev/mv64x60_dev.c
+++ b/arch/powerpc/sysdev/mv64x60_dev.c
@@ -338,15 +338,13 @@ static int __init mv64x60_i2c_device_setup(struct device_node *np, int id)
 
 	pdata.freq_m = 8;	/* default */
 	prop = of_get_property(np, "freq_m", NULL);
-	if (!prop)
-		return -ENODEV;
-	pdata.freq_m = *prop;
+	if (prop)
+		pdata.freq_m = *prop;
 
 	pdata.freq_m = 3;	/* default */
 	prop = of_get_property(np, "freq_n", NULL);
-	if (!prop)
-		return -ENODEV;
-	pdata.freq_n = *prop;
+	if (prop)
+		pdata.freq_n = *prop;
 
 	pdata.timeout = 1000;				/* default: 1 second */
 
@@ -433,9 +431,15 @@ static int __init mv64x60_device_setup(void)
 	int err;
 
 	id = 0;
-	for_each_compatible_node(np, "serial", "marvell,mv64360-mpsc")
-		if ((err = mv64x60_mpsc_device_setup(np, id++)))
-			goto error;
+	for_each_compatible_node(np, "serial", "marvell,mv64360-mpsc") {
+		err = mv64x60_mpsc_device_setup(np, id++);
+		if (err) {
+			printk(KERN_ERR "Failed to initialize MV64x60 " \
+					"serial device %s: error %d.\n",
+					np->full_name, err);
+			of_node_put(np);
+		};
+	};
 
 	id = 0;
 	id2 = 0;
@@ -443,38 +447,48 @@ static int __init mv64x60_device_setup(void)
 		pdev = mv64x60_eth_register_shared_pdev(np, id++);
 		if (IS_ERR(pdev)) {
 			err = PTR_ERR(pdev);
-			goto error;
-		}
+			printk(KERN_ERR "Failed to initialize MV64x60 " \
+					"network block %s: error %d.\n",
+					np->full_name, err);
+			of_node_put(np);
+			continue;
+		};
 		for_each_child_of_node(np, np2) {
 			if (!of_device_is_compatible(np2,
 					"marvell,mv64360-eth"))
 				continue;
 			err = mv64x60_eth_device_setup(np2, id2++, pdev);
 			if (err) {
-				of_node_put(np2);
-				goto error;
+				printk(KERN_ERR "Failed to initialize " \
+						"MV64x60 network device %s: " \
+						"error %d.\n",
+						np2->full_name, err);
 			}
 		}
 	}
 
 	id = 0;
-	for_each_compatible_node(np, "i2c", "marvell,mv64360-i2c")
-		if ((err = mv64x60_i2c_device_setup(np, id++)))
-			goto error;
+	for_each_compatible_node(np, "i2c", "marvell,mv64360-i2c") {
+		err = mv64x60_i2c_device_setup(np, id++);
+		if (err) {
+			printk(KERN_ERR "Failed to initialize MV64x60 I2C " \
+					"bus %s: error %d.\n",
+					np->full_name, err);
+			of_node_put(np);
+		};
+	};
 
 	/* support up to one watchdog timer */
 	np = of_find_compatible_node(np, NULL, "marvell,mv64360-wdt");
 	if (np) {
 		if ((err = mv64x60_wdt_device_setup(np, id)))
-			goto error;
+			printk(KERN_ERR "Failed to initialize MV64x60 " \
+					"Watchdog %s: error %d.\n",
+					np->full_name, err);
 		of_node_put(np);
 	}
 
 	return 0;
-
-error:
-	of_node_put(np);
-	return err;
 }
 arch_initcall(mv64x60_device_setup);
 

^ permalink raw reply related

* Re: [PATCH 1/5] [POWERPC] sysdev: implement FSL GTM support
From: Anton Vorontsov @ 2008-04-17 22:47 UTC (permalink / raw)
  To: Anton Vorontsov; +Cc: linuxppc-dev
In-Reply-To: <20080417192832.GA28286@polina.dev.rtsoft.ru>

On Thu, Apr 17, 2008 at 11:28:32PM +0400, Anton Vorontsov wrote:
> GTM stands for General-purpose Timers Module and able to generate
> timer{1,2,3,4} interrupts. These timers are used by the drivers that
> need time precise interrupts (like for USB transactions scheduling for
> the Freescale USB Host controller as found in some QE and CPM chips),
> or these timers could be used as wakeup events from the CPU deep-sleep
> mode.
> 
> Things unimplemented:
> 1. Cascaded (32 bit) timers (1-2, 3-4).
>    This is straightforward to implement when needed, two timers should
>    be marked as "requested" and configured as appropriate.
> 2. Super-cascaded (64 bit) timers (1-2-3-4).
>    This is also straightforward to implement when needed, all timers
>    should be marked as "requested" and configured as appropriate.
> 
> Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
> ---
>  Documentation/powerpc/booting-without-of.txt |   32 +++-
>  arch/powerpc/Kconfig                         |    5 +
>  arch/powerpc/sysdev/Makefile                 |    1 +
>  arch/powerpc/sysdev/fsl_gtm.c                |  362 ++++++++++++++++++++++++++
>  include/asm-powerpc/fsl_gtm.h                |  108 ++++++++
>  5 files changed, 507 insertions(+), 1 deletions(-)
>  create mode 100644 arch/powerpc/sysdev/fsl_gtm.c
>  create mode 100644 include/asm-powerpc/fsl_gtm.h
> 
> diff --git a/Documentation/powerpc/booting-without-of.txt b/Documentation/powerpc/booting-without-of.txt
> index 4cc7800..827b630 100644
> --- a/Documentation/powerpc/booting-without-of.txt
> +++ b/Documentation/powerpc/booting-without-of.txt
[...]
> +/**
> + * gtm_reset_timer16 - reset 16 bit timer with arbitrary precision
> + * @tmr:	pointer to the gtm_timer structure obtained from gtm_get_timer
> + * @usec:	timer interval in microseconds
> + * @reload:	if set, the timer will reset upon expiry rather than
> + *         	continue running free.
> + *
> + * This function (re)sets the GTM timer so that it counts up to the requested
> + * interval value, and fires the interrupt when the value is reached. This
> + * function will reduce the precision of the timer as needed in order for the
> + * requested timeout to fit in a 16-bit register.
> + */
> +int gtm_reset_timer16(struct gtm_timer *tmr, unsigned long usec, bool reload)
> +{
> +	/* quite obvious, frequency which is enough for µSec precision */
> +	int freq = 1000000;
> +	unsigned int bit;
> +
> +	bit = fls_long(usec);
> +	if (bit > 15) {
> +		freq >>= bit - 15;
> +		usec >>= bit - 15;
> +	}

if (!freq)
	return -EINVAL;

> +	return gtm_reset_ref_timer16(tmr, freq, usec, reload);
> +}
> +EXPORT_SYMBOL(gtm_reset_timer16);

-- 
Anton Vorontsov
email: cbouatmailru@gmail.com
irc://irc.freenode.net/bd2

^ 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