LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH] PowerPC: clockevents and HRT support
From: Sergei Shtylyov @ 2006-11-12 18:30 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: tglx, greg.weeks, John Stultz, linuxppc-dev
In-Reply-To: <17749.4257.415783.451756@cargo.ozlabs.ibm.com>

Hello.

Paul Mackerras wrote:

>>    I think the usual rule is: "you want it, you do it". ;-)

> Sure!  And I will, at some point, if someone else doesn't do it
> first.

> My point is simply that as maintainer I won't accept a patch that
> breaks an important feature, even if it adds another important
> feature.

    It's too early to talk about the mainline acceptance of this patch ATM, 
while TOD vsyscalls are broken/removed by the GENERIC_TIME support patches 
(which are aboslutely needed for HRT as well).  We'll try to return to getting 
them straight when the time permits, but for now the HRT patchset is still in 
better form than it was for several months before that (not even compilable, 
and vsyscalls broken)...

>>    Seriously, we have neither time, not hardware, nor docs for the h/w this 
>>accounting option applies to.

> Really?  You're working on machines that don't have a timebase
> register?  What powerpc chip doesn't have a timebase register, other
> than the really old 601? :)  The timebase is all the hardware that is
> needed.

    If you look at arch/powerpc/Kconfig, you'll see that this option depends 
on PPC64 which basically says it all:  we have only 32-bit targets to care 
about ATM.  When it comes to 64-bit ones, we'll see... :-)

>>And coercing the generic clcokevents/hrtimers 
>>code into calling the arch hooks is serious design decision which I felt is 
>>better to be left to Thomas as a maintainer...

> CONFIG_VIRT_CPU_ACCOUNTING is used, and needed, on powerpc and s390,
> both of which also want to do dynticks.  If the current framework
> can't cope with that, then it needs to be extended.

    Well, why not make Linus "extend" update_process_times() for starters? :-)

> Paul.

WBR, Sergei

^ permalink raw reply

* Re: [PATCH 31/32] powerpc: Merge 32 and 64 bits asm-powerpc/io.h
From: Guennadi Liakhovetski @ 2006-11-12 20:38 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: linuxppc-dev
In-Reply-To: <20061111062552.2648A68527@ozlabs.org>

On Sat, 11 Nov 2006, Benjamin Herrenschmidt wrote:

> +/* 32 bits uses slightly different variables for the various IO
> + * bases. Most of this file only uses _IO_BASE though which we
> + * define properly based on the platform
> + */
> +#ifdef CONFIG_PCI
> +#define _IO_BASE	0
> +#define _ISA_MEM_BASE	0
> +#define PCI_DRAM_OFFSET 0
> +#elif defined(CONFIG_PPC32)
> +#define _IO_BASE	isa_io_base
> +#define _ISA_MEM_BASE	isa_mem_base
> +#define PCI_DRAM_OFFSET	pci_dram_offset
> +#else
> +#define _IO_BASE	pci_io_base
> +#define _ISA_MEM_BASE	0
> +#define PCI_DRAM_OFFSET	0
> +#endif

As narrowed down by me during a git-bisect session, debugging non-working 
IDE on kuroboxHG with your patches applied, actually found by a modest IRC 
hero, wiching to remain incognito, and verified by me, that is a typo, it 
should have been

> +#ifndef CONFIG_PCI

Thanks
Guennadi
---
Guennadi Liakhovetski

^ permalink raw reply

* Re: Freescale combined ethernet driver
From: Robin Gilks @ 2006-11-12 20:43 UTC (permalink / raw)
  To: ppc embedded list
In-Reply-To: <47D6F8FB-261B-42C3-8494-6897AF14B132@freescale.com>

Andy Fleming wrote:

> 
> Documentation/driver-model/*
> 

Duh!!

=======================================================================
This email, including any attachments, is only for the intended
addressee.  It is subject to copyright, is confidential and may be
the subject of legal or other privilege, none of which is waived or
lost by reason of this transmission.
If the receiver is not the intended addressee, please accept our
apologies, notify us by return, delete all copies and perform no
other act on the email.
Unfortunately, we cannot warrant that the email has not been
 altered or corrupted during transmission.
=======================================================================

^ permalink raw reply

* Fwd: [PATCH] 2.6.18-rt7: fix more issues with 32-bit cycles_t in latency_trace.c
From: Sergei Shtylyov @ 2006-11-12 21:26 UTC (permalink / raw)
  To: linuxppc-dev

Hello.

   Ugh, got the linuxppc-dev address wrong in the original mail...

WBR, Sergei

----------  Forwarded Message  ----------

Subject: [PATCH] 2.6.18-rt7: fix more issues with 32-bit cycles_t in latency_trace.c
Date: Monday 13 November 2006 00:23
From: Sergei Shtylyov <sshtylyov@ru.mvista.com>
To: mingo@elte.hu
Cc: linux-kernel@vger.kernel.org, linuxppc-dev@linux-mips.org, dwalker@mvista.com, khilman@mvista.com

In addition to clock wrap check being falsely triggered with 32-bit cycles_t,
as noticed to Kevin Hilman, there's another issue: using %Lx format to print
32-bit values warrants erroneous values on 32-bit machines like ARM and
 PPC32.

Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>

---
PPC32 actually has 64-bit timebase counter, so could provide for 64-bit
cycles_t -- maybe it's worth to rewrite get_cycles() to read both lower and
upper registers?

Index: linux-2.6/kernel/latency_trace.c
===================================================================
--- linux-2.6.orig/kernel/latency_trace.c
+++ linux-2.6/kernel/latency_trace.c
@@ -1623,8 +1623,8 @@ check_critical_timing(int cpu, struct cp
 #ifndef CONFIG_CRITICAL_LATENCY_HIST
 	if (!preempt_thresh && preempt_max_latency > delta) {
 		printk("bug: updating %016Lx > %016Lx?\n",
-			preempt_max_latency, delta);
-		printk("  [%016Lx %016Lx %016Lx]\n", T0, T1, T2);
+			(u64)preempt_max_latency, (u64)delta);
+		printk("  [%016Lx %016Lx %016Lx]\n", (u64)T0, (u64)T1, (u64)T2);
 	}
 #endif

-------------------------------------------------------

^ permalink raw reply

* [PATCH 31/32-fix] powerpc: Merge 32 and 64 bits asm-powerpc/io.h
From: Benjamin Herrenschmidt @ 2006-11-12 22:27 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: linuxppc-dev list

powerpc: Merge 32 and 64 bits asm-powerpc/io.h

The rework on io.h done for the new hookable accessors made it easier,
so I just finished the work and merged 32 and 64 bits io.h for arch/powerpc.

arch/ppc still uses the old version in asm-ppc, there is just too much gunk
in there that I really can't be bothered trying to cleanup.

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

Fixes a typo causing various problems mostly with PCI IO space. Change from
previous version is in io.h, near the top,
 
#ifdef CONFIG_PCI -> #ifndef CONFIG_PCI

Thanks to Guennadi Liakhovetski for spotting it.

Index: linux-cell/arch/powerpc/kernel/Makefile
===================================================================
--- linux-cell.orig/arch/powerpc/kernel/Makefile	2006-11-13 09:23:10.000000000 +1100
+++ linux-cell/arch/powerpc/kernel/Makefile	2006-11-13 09:23:13.000000000 +1100
@@ -73,7 +73,7 @@
 obj64-$(CONFIG_AUDIT)		+= compat_audit.o
 
 ifneq ($(CONFIG_PPC_INDIRECT_IO),y)
-pci64-$(CONFIG_PPC64)		+= iomap.o
+obj-y				+= iomap.o
 endif
 
 ifeq ($(CONFIG_PPC_ISERIES),y)
Index: linux-cell/arch/powerpc/kernel/io.c
===================================================================
--- linux-cell.orig/arch/powerpc/kernel/io.c	2006-11-13 09:23:10.000000000 +1100
+++ linux-cell/arch/powerpc/kernel/io.c	2006-11-13 09:23:13.000000000 +1100
@@ -117,3 +117,90 @@
 	asm volatile("sync");
 }
 EXPORT_SYMBOL(_outsl_ns);
+
+#define IO_CHECK_ALIGN(v,a) ((((unsigned long)(v)) & ((a) - 1)) == 0)
+
+void _memset_io(volatile void __iomem *addr, int c, unsigned long n)
+{
+	void *p = (void __force *)addr;
+	u32 lc = c;
+	lc |= lc << 8;
+	lc |= lc << 16;
+
+	__asm__ __volatile__ ("sync" : : : "memory");
+	while(n && !IO_CHECK_ALIGN(p, 4)) {
+		*((volatile u8 *)p) = c;
+		p++;
+		n--;
+	}
+	while(n >= 4) {
+		*((volatile u32 *)p) = lc;
+		p += 4;
+		n -= 4;
+	}
+	while(n) {
+		*((volatile u8 *)p) = c;
+		p++;
+		n--;
+	}
+	__asm__ __volatile__ ("sync" : : : "memory");
+}
+EXPORT_SYMBOL(_memset_io);
+
+void _memcpy_fromio(void *dest, const volatile void __iomem *src,
+		    unsigned long n)
+{
+	void *vsrc = (void __force *) src;
+
+	__asm__ __volatile__ ("sync" : : : "memory");
+	while(n && (!IO_CHECK_ALIGN(vsrc, 4) || !IO_CHECK_ALIGN(dest, 4))) {
+		*((u8 *)dest) = *((volatile u8 *)vsrc);
+		__asm__ __volatile__ ("eieio" : : : "memory");
+		vsrc++;
+		dest++;
+		n--;
+	}
+	while(n > 4) {
+		*((u32 *)dest) = *((volatile u32 *)vsrc);
+		__asm__ __volatile__ ("eieio" : : : "memory");
+		vsrc += 4;
+		dest += 4;
+		n -= 4;
+	}
+	while(n) {
+		*((u8 *)dest) = *((volatile u8 *)vsrc);
+		__asm__ __volatile__ ("eieio" : : : "memory");
+		vsrc++;
+		dest++;
+		n--;
+	}
+	__asm__ __volatile__ ("sync" : : : "memory");
+}
+EXPORT_SYMBOL(_memcpy_fromio);
+
+void _memcpy_toio(volatile void __iomem *dest, const void *src, unsigned long n)
+{
+	void *vdest = (void __force *) dest;
+
+	__asm__ __volatile__ ("sync" : : : "memory");
+	while(n && (!IO_CHECK_ALIGN(vdest, 4) || !IO_CHECK_ALIGN(src, 4))) {
+		*((volatile u8 *)vdest) = *((u8 *)src);
+		src++;
+		vdest++;
+		n--;
+	}
+	while(n > 4) {
+		*((volatile u32 *)vdest) = *((volatile u32 *)src);
+		src += 4;
+		vdest += 4;
+		n-=4;
+	}
+	while(n) {
+		*((volatile u8 *)vdest) = *((u8 *)src);
+		src++;
+		vdest++;
+		n--;
+	}
+	__asm__ __volatile__ ("sync" : : : "memory");
+}
+EXPORT_SYMBOL(_memcpy_toio);
Index: linux-cell/include/asm-powerpc/eeh.h
===================================================================
--- linux-cell.orig/include/asm-powerpc/eeh.h	2006-11-13 09:23:10.000000000 +1100
+++ linux-cell/include/asm-powerpc/eeh.h	2006-11-13 09:23:13.000000000 +1100
@@ -169,104 +169,19 @@
 	return val;
 }
 
-#define EEH_CHECK_ALIGN(v,a) \
-	((((unsigned long)(v)) & ((a) - 1)) == 0)
-
-static inline void eeh_memset_io(volatile void __iomem *addr, int c,
-				 unsigned long n)
-{
-	void *p = (void __force *)addr;
-	u32 lc = c;
-	lc |= lc << 8;
-	lc |= lc << 16;
-
-	__asm__ __volatile__ ("sync" : : : "memory");
-	while(n && !EEH_CHECK_ALIGN(p, 4)) {
-		*((volatile u8 *)p) = c;
-		p++;
-		n--;
-	}
-	while(n >= 4) {
-		*((volatile u32 *)p) = lc;
-		p += 4;
-		n -= 4;
-	}
-	while(n) {
-		*((volatile u8 *)p) = c;
-		p++;
-		n--;
-	}
-	__asm__ __volatile__ ("sync" : : : "memory");
-}
-static inline void eeh_memcpy_fromio(void *dest, const volatile void __iomem *src,
+static inline void eeh_memcpy_fromio(void *dest, const
+				     volatile void __iomem *src,
 				     unsigned long n)
 {
-	void *vsrc = (void __force *) src;
-	void *destsave = dest;
-	unsigned long nsave = n;
-
-	__asm__ __volatile__ ("sync" : : : "memory");
-	while(n && (!EEH_CHECK_ALIGN(vsrc, 4) || !EEH_CHECK_ALIGN(dest, 4))) {
-		*((u8 *)dest) = *((volatile u8 *)vsrc);
-		__asm__ __volatile__ ("eieio" : : : "memory");
-		vsrc++;
-		dest++;
-		n--;
-	}
-	while(n > 4) {
-		*((u32 *)dest) = *((volatile u32 *)vsrc);
-		__asm__ __volatile__ ("eieio" : : : "memory");
-		vsrc += 4;
-		dest += 4;
-		n -= 4;
-	}
-	while(n) {
-		*((u8 *)dest) = *((volatile u8 *)vsrc);
-		__asm__ __volatile__ ("eieio" : : : "memory");
-		vsrc++;
-		dest++;
-		n--;
-	}
-	__asm__ __volatile__ ("sync" : : : "memory");
+	_memcpy_fromio(dest, src, n);
 
 	/* Look for ffff's here at dest[n].  Assume that at least 4 bytes
 	 * were copied. Check all four bytes.
 	 */
-	if ((nsave >= 4) &&
-		(EEH_POSSIBLE_ERROR((*((u32 *) destsave+nsave-4)), u32))) {
-		eeh_check_failure(src, (*((u32 *) destsave+nsave-4)));
-	}
-}
-
-static inline void eeh_memcpy_toio(volatile void __iomem *dest, const void *src,
-				   unsigned long n)
-{
-	void *vdest = (void __force *) dest;
-
-	__asm__ __volatile__ ("sync" : : : "memory");
-	while(n && (!EEH_CHECK_ALIGN(vdest, 4) || !EEH_CHECK_ALIGN(src, 4))) {
-		*((volatile u8 *)vdest) = *((u8 *)src);
-		src++;
-		vdest++;
-		n--;
-	}
-	while(n > 4) {
-		*((volatile u32 *)vdest) = *((volatile u32 *)src);
-		src += 4;
-		vdest += 4;
-		n-=4;
-	}
-	while(n) {
-		*((volatile u8 *)vdest) = *((u8 *)src);
-		src++;
-		vdest++;
-		n--;
-	}
-	__asm__ __volatile__ ("sync" : : : "memory");
+	if (n >= 4 && EEH_POSSIBLE_ERROR(*((u32 *)(dest + n - 4)), u32))
+		eeh_check_failure(src, *((u32 *)(dest + n - 4)));
 }
 
-#undef EEH_CHECK_ALIGN
-
 /* in-string eeh macros */
 static inline void eeh_readsb(const volatile void __iomem *addr, void * buf,
 			      int ns)
Index: linux-cell/include/asm-powerpc/io-defs.h
===================================================================
--- linux-cell.orig/include/asm-powerpc/io-defs.h	2006-11-13 09:23:10.000000000 +1100
+++ linux-cell/include/asm-powerpc/io-defs.h	2006-11-13 09:23:13.000000000 +1100
@@ -3,17 +3,20 @@
 DEF_PCI_AC_RET(readb, u8, (const PCI_IO_ADDR addr), (addr))
 DEF_PCI_AC_RET(readw, u16, (const PCI_IO_ADDR addr), (addr))
 DEF_PCI_AC_RET(readl, u32, (const PCI_IO_ADDR addr), (addr))
-DEF_PCI_AC_RET(readq, u64, (const PCI_IO_ADDR addr), (addr))
 DEF_PCI_AC_RET(readw_be, u16, (const PCI_IO_ADDR addr), (addr))
 DEF_PCI_AC_RET(readl_be, u32, (const PCI_IO_ADDR addr), (addr))
-DEF_PCI_AC_RET(readq_be, u64, (const PCI_IO_ADDR addr), (addr))
 DEF_PCI_AC_NORET(writeb, (u8 val, PCI_IO_ADDR addr), (val, addr))
 DEF_PCI_AC_NORET(writew, (u16 val, PCI_IO_ADDR addr), (val, addr))
 DEF_PCI_AC_NORET(writel, (u32 val, PCI_IO_ADDR addr), (val, addr))
-DEF_PCI_AC_NORET(writeq, (u64 val, PCI_IO_ADDR addr), (val, addr))
 DEF_PCI_AC_NORET(writew_be, (u16 val, PCI_IO_ADDR addr), (val, addr))
 DEF_PCI_AC_NORET(writel_be, (u32 val, PCI_IO_ADDR addr), (val, addr))
+
+#ifdef __powerpc64__
+DEF_PCI_AC_RET(readq, u64, (const PCI_IO_ADDR addr), (addr))
+DEF_PCI_AC_RET(readq_be, u64, (const PCI_IO_ADDR addr), (addr))
+DEF_PCI_AC_NORET(writeq, (u64 val, PCI_IO_ADDR addr), (val, addr))
 DEF_PCI_AC_NORET(writeq_be, (u64 val, PCI_IO_ADDR addr), (val, addr))
+#endif /* __powerpc64__ */
 
 DEF_PCI_AC_RET(inb, u8, (unsigned long port), (port))
 DEF_PCI_AC_RET(inw, u16, (unsigned long port), (port))
Index: linux-cell/include/asm-powerpc/io.h
===================================================================
--- linux-cell.orig/include/asm-powerpc/io.h	2006-11-13 09:23:10.000000000 +1100
+++ linux-cell/include/asm-powerpc/io.h	2006-11-13 09:23:45.000000000 +1100
@@ -13,24 +13,51 @@
 extern int check_legacy_ioport(unsigned long base_port);
 #define PNPBIOS_BASE	0xf000	/* only relevant for PReP */
 
-#ifndef CONFIG_PPC64
-#include <asm-ppc/io.h>
-#else
-
 #include <linux/compiler.h>
 #include <asm/page.h>
 #include <asm/byteorder.h>
-#include <asm/paca.h>
 #include <asm/synch.h>
 #include <asm/delay.h>
+#include <asm/mmu.h>
 
 #include <asm-generic/iomap.h>
 
+#ifdef CONFIG_PPC64
+#include <asm/paca.h>
+#endif
+
 #define SIO_CONFIG_RA	0x398
 #define SIO_CONFIG_RD	0x399
 
 #define SLOW_DOWN_IO
 
+/* 32 bits uses slightly different variables for the various IO
+ * bases. Most of this file only uses _IO_BASE though which we
+ * define properly based on the platform
+ */
+#ifndef CONFIG_PCI
+#define _IO_BASE	0
+#define _ISA_MEM_BASE	0
+#define PCI_DRAM_OFFSET 0
+#elif defined(CONFIG_PPC32)
+#define _IO_BASE	isa_io_base
+#define _ISA_MEM_BASE	isa_mem_base
+#define PCI_DRAM_OFFSET	pci_dram_offset
+#else
+#define _IO_BASE	pci_io_base
+#define _ISA_MEM_BASE	0
+#define PCI_DRAM_OFFSET	0
+#endif
+
+extern unsigned long isa_io_base;
+extern unsigned long isa_mem_base;
+extern unsigned long pci_io_base;
+extern unsigned long pci_dram_offset;
+
+#if defined(CONFIG_PPC32) && defined(CONFIG_PPC_INDIRECT_IO)
+#error CONFIG_PPC_INDIRECT_IO is not yet supported on 32 bits
+#endif
+
 /*
  *
  * Low level MMIO accessors
@@ -53,7 +80,11 @@
  *
  */
 
+#ifdef CONFIG_PPC64
 #define IO_SET_SYNC_FLAG()	do { get_paca()->io_sync = 1; } while(0)
+#else
+#define IO_SET_SYNC_FLAG()
+#endif
 
 #define DEF_MMIO_IN(name, type, insn)					\
 static inline type name(const volatile type __iomem *addr)		\
@@ -86,17 +117,19 @@
 DEF_MMIO_IN_BE(in_8,     8, lbz);
 DEF_MMIO_IN_BE(in_be16, 16, lhz);
 DEF_MMIO_IN_BE(in_be32, 32, lwz);
-DEF_MMIO_IN_BE(in_be64, 64, ld);
 DEF_MMIO_IN_LE(in_le16, 16, lhbrx);
 DEF_MMIO_IN_LE(in_le32, 32, lwbrx);
 
 DEF_MMIO_OUT_BE(out_8,     8, stb);
 DEF_MMIO_OUT_BE(out_be16, 16, sth);
 DEF_MMIO_OUT_BE(out_be32, 32, stw);
-DEF_MMIO_OUT_BE(out_be64, 64, std);
 DEF_MMIO_OUT_LE(out_le16, 16, sthbrx);
 DEF_MMIO_OUT_LE(out_le32, 32, stwbrx);
 
+#ifdef __powerpc64__
+DEF_MMIO_OUT_BE(out_be64, 64, std);
+DEF_MMIO_IN_BE(in_be64, 64, ld);
+
 /* There is no asm instructions for 64 bits reverse loads and stores */
 static inline u64 in_le64(const volatile u64 __iomem *addr)
 {
@@ -107,6 +140,7 @@
 {
 	out_be64(addr, cpu_to_le64(val));
 }
+#endif /* __powerpc64__ */
 
 /*
  * Low level IO stream instructions are defined out of line for now
@@ -126,6 +160,17 @@
 #define _outsw	_outsw_ns
 #define _outsl	_outsl_ns
 
+
+/*
+ * memset_io, memcpy_toio, memcpy_fromio base implementations are out of line
+ */
+
+extern void _memset_io(volatile void __iomem *addr, int c, unsigned long n);
+extern void _memcpy_fromio(void *dest, const volatile void __iomem *src,
+			   unsigned long n);
+extern void _memcpy_toio(volatile void __iomem *dest, const void *src,
+			 unsigned long n);
+
 /*
  *
  * PCI and standard ISA accessors
@@ -140,9 +185,6 @@
  * of the accessors.
  */
 
-extern unsigned long isa_io_base;
-extern unsigned long pci_io_base;
-
 
 /*
  * Non ordered and non-swapping "raw" accessors
@@ -160,10 +202,6 @@
 {
 	return *(volatile unsigned int __force *)addr;
 }
-static inline unsigned long __raw_readq(const volatile void __iomem *addr)
-{
-	return *(volatile unsigned long __force *)addr;
-}
 static inline void __raw_writeb(unsigned char v, volatile void __iomem *addr)
 {
 	*(volatile unsigned char __force *)addr = v;
@@ -176,11 +214,17 @@
 {
 	*(volatile unsigned int __force *)addr = v;
 }
+
+#ifdef __powerpc64__
+static inline unsigned long __raw_readq(const volatile void __iomem *addr)
+{
+	return *(volatile unsigned long __force *)addr;
+}
 static inline void __raw_writeq(unsigned long v, volatile void __iomem *addr)
 {
 	*(volatile unsigned long __force *)addr = v;
 }
-
+#endif /* __powerpc64__ */
 
 /*
  *
@@ -188,7 +232,13 @@
  *
  */
 
+/*
+ * Include the EEH definitions when EEH is enabled only so they don't get
+ * in the way when building for 32 bits
+ */
+#ifdef CONFIG_EEH
 #include <asm/eeh.h>
+#endif
 
 /* Shortcut to the MMIO argument pointer */
 #define PCI_IO_ADDR	volatile void __iomem *
@@ -196,7 +246,7 @@
 /* Indirect IO address tokens:
  *
  * When CONFIG_PPC_INDIRECT_IO is set, the platform can provide hooks
- * on all IOs.
+ * on all IOs. (Note that this is all 64 bits only for now)
  *
  * To help platforms who may need to differenciate MMIO addresses in
  * their hooks, a bitfield is reserved for use by the platform near the
@@ -241,6 +291,70 @@
 #define PCI_FIX_ADDR(addr) (addr)
 #endif
 
+/*
+ * On 32 bits, PIO operations have a recovery mechanism in case they trigger
+ * machine checks (which they occasionally do when probing non existing
+ * IO ports on some platforms, like PowerMac and 8xx).
+ * I always found it to be of dubious reliability and I am tempted to get
+ * rid of it one of these days. So if you think it's important to keep it,
+ * please voice up asap. We never had it for 64 bits and I do not intend
+ * to port it over
+ */
+
+#ifdef CONFIG_PPC32
+
+#define __do_in_asm(name, op)				\
+extern __inline__ unsigned int name(unsigned int port)	\
+{							\
+	unsigned int x;					\
+	__asm__ __volatile__(				\
+		"sync\n"				\
+		"0:"	op "	%0,0,%1\n"		\
+		"1:	twi	0,%0,0\n"		\
+		"2:	isync\n"			\
+		"3:	nop\n"				\
+		"4:\n"					\
+		".section .fixup,\"ax\"\n"		\
+		"5:	li	%0,-1\n"		\
+		"	b	4b\n"			\
+		".previous\n"				\
+		".section __ex_table,\"a\"\n"		\
+		"	.align	2\n"			\
+		"	.long	0b,5b\n"		\
+		"	.long	1b,5b\n"		\
+		"	.long	2b,5b\n"		\
+		"	.long	3b,5b\n"		\
+		".previous"				\
+		: "=&r" (x)				\
+		: "r" (port + _IO_BASE));		\
+	return x;					\
+}
+
+#define __do_out_asm(name, op)				\
+extern __inline__ void name(unsigned int val, unsigned int port) \
+{							\
+	__asm__ __volatile__(				\
+		"sync\n"				\
+		"0:" op " %0,0,%1\n"			\
+		"1:	sync\n"				\
+		"2:\n"					\
+		".section __ex_table,\"a\"\n"		\
+		"	.align	2\n"			\
+		"	.long	0b,2b\n"		\
+		"	.long	1b,2b\n"		\
+		".previous"				\
+		: : "r" (val), "r" (port + _IO_BASE));	\
+}
+
+__do_in_asm(_rec_inb, "lbzx")
+__do_in_asm(_rec_inw, "lhbrx")
+__do_in_asm(_rec_inl, "lwbrx")
+__do_out_asm(_rec_outb, "stbx")
+__do_out_asm(_rec_outw, "sthbrx")
+__do_out_asm(_rec_outl, "stwbrx")
+
+#endif /* CONFIG_PPC32 */
+
 /* The "__do_*" operations below provide the actual "base" implementation
  * for each of the defined acccessor. Some of them use the out_* functions
  * directly, some of them still use EEH, though we might change that in the
@@ -263,6 +377,8 @@
 #define __do_writew_be(val, addr) out_be16(PCI_FIX_ADDR(addr), val)
 #define __do_writel_be(val, addr) out_be32(PCI_FIX_ADDR(addr), val)
 #define __do_writeq_be(val, addr) out_be64(PCI_FIX_ADDR(addr), val)
+
+#ifdef CONFIG_EEH
 #define __do_readb(addr)	eeh_readb(PCI_FIX_ADDR(addr))
 #define __do_readw(addr)	eeh_readw(PCI_FIX_ADDR(addr))
 #define __do_readl(addr)	eeh_readl(PCI_FIX_ADDR(addr))
@@ -270,33 +386,64 @@
 #define __do_readw_be(addr)	eeh_readw_be(PCI_FIX_ADDR(addr))
 #define __do_readl_be(addr)	eeh_readl_be(PCI_FIX_ADDR(addr))
 #define __do_readq_be(addr)	eeh_readq_be(PCI_FIX_ADDR(addr))
+#else /* CONFIG_EEH */
+#define __do_readb(addr)	in_8(PCI_FIX_ADDR(addr))
+#define __do_readw(addr)	in_le16(PCI_FIX_ADDR(addr))
+#define __do_readl(addr)	in_le32(PCI_FIX_ADDR(addr))
+#define __do_readq(addr)	in_le64(PCI_FIX_ADDR(addr))
+#define __do_readw_be(addr)	in_be16(PCI_FIX_ADDR(addr))
+#define __do_readl_be(addr)	in_be32(PCI_FIX_ADDR(addr))
+#define __do_readq_be(addr)	in_be64(PCI_FIX_ADDR(addr))
+#endif /* !defined(CONFIG_EEH) */
+
+#ifdef CONFIG_PPC32
+#define __do_outb(val, port)	_rec_outb(val, port)
+#define __do_outw(val, port)	_rec_outw(val, port)
+#define __do_outl(val, port)	_rec_outl(val, port)
+#define __do_inb(port)		_rec_inb(port)
+#define __do_inw(port)		_rec_inw(port)
+#define __do_inl(port)		_rec_inl(port)
+#else /* CONFIG_PPC32 */
+#define __do_outb(val, port)	writeb(val,(PCI_IO_ADDR)_IO_BASE+port);
+#define __do_outw(val, port)	writew(val,(PCI_IO_ADDR)_IO_BASE+port);
+#define __do_outl(val, port)	writel(val,(PCI_IO_ADDR)_IO_BASE+port);
+#define __do_inb(port)		readb((PCI_IO_ADDR)_IO_BASE + port);
+#define __do_inw(port)		readw((PCI_IO_ADDR)_IO_BASE + port);
+#define __do_inl(port)		readl((PCI_IO_ADDR)_IO_BASE + port);
+#endif /* !CONFIG_PPC32 */
 
-#define __do_outb(val, port)	writeb(val,(PCI_IO_ADDR)pci_io_base+port);
-#define __do_outw(val, port)	writew(val,(PCI_IO_ADDR)pci_io_base+port);
-#define __do_outl(val, port)	writel(val,(PCI_IO_ADDR)pci_io_base+port);
-#define __do_inb(port)		readb((PCI_IO_ADDR)pci_io_base + port);
-#define __do_inw(port)		readw((PCI_IO_ADDR)pci_io_base + port);
-#define __do_inl(port)		readl((PCI_IO_ADDR)pci_io_base + port);
-
+#ifdef CONFIG_EEH
 #define __do_readsb(a, b, n)	eeh_readsb(PCI_FIX_ADDR(a), (b), (n))
 #define __do_readsw(a, b, n)	eeh_readsw(PCI_FIX_ADDR(a), (b), (n))
 #define __do_readsl(a, b, n)	eeh_readsl(PCI_FIX_ADDR(a), (b), (n))
+#else /* CONFIG_EEH */
+#define __do_readsb(a, b, n)	_insb(PCI_FIX_ADDR(a), (b), (n))
+#define __do_readsw(a, b, n)	_insw(PCI_FIX_ADDR(a), (b), (n))
+#define __do_readsl(a, b, n)	_insl(PCI_FIX_ADDR(a), (b), (n))
+#endif /* !CONFIG_EEH */
 #define __do_writesb(a, b, n)	_outsb(PCI_FIX_ADDR(a),(b),(n))
 #define __do_writesw(a, b, n)	_outsw(PCI_FIX_ADDR(a),(b),(n))
 #define __do_writesl(a, b, n)	_outsl(PCI_FIX_ADDR(a),(b),(n))
 
-#define __do_insb(p, b, n)	readsb((PCI_IO_ADDR)pci_io_base+(p), (b), (n))
-#define __do_insw(p, b, n)	readsw((PCI_IO_ADDR)pci_io_base+(p), (b), (n))
-#define __do_insl(p, b, n)	readsl((PCI_IO_ADDR)pci_io_base+(p), (b), (n))
-#define __do_outsb(p, b, n)	writesb((PCI_IO_ADDR)pci_io_base+(p),(b),(n))
-#define __do_outsw(p, b, n)	writesw((PCI_IO_ADDR)pci_io_base+(p),(b),(n))
-#define __do_outsl(p, b, n)	writesl((PCI_IO_ADDR)pci_io_base+(p),(b),(n))
-
-#define __do_memset_io(addr, c, n)	eeh_memset_io(PCI_FIX_ADDR(addr), c, n)
-#define __do_memcpy_fromio(dst, src, n)	eeh_memcpy_fromio(dst, \
-						PCI_FIX_ADDR(src), n)
-#define __do_memcpy_toio(dst, src, n)	eeh_memcpy_toio(PCI_FIX_ADDR(dst), \
-						src, n)
+#define __do_insb(p, b, n)	readsb((PCI_IO_ADDR)_IO_BASE+(p), (b), (n))
+#define __do_insw(p, b, n)	readsw((PCI_IO_ADDR)_IO_BASE+(p), (b), (n))
+#define __do_insl(p, b, n)	readsl((PCI_IO_ADDR)_IO_BASE+(p), (b), (n))
+#define __do_outsb(p, b, n)	writesb((PCI_IO_ADDR)_IO_BASE+(p),(b),(n))
+#define __do_outsw(p, b, n)	writesw((PCI_IO_ADDR)_IO_BASE+(p),(b),(n))
+#define __do_outsl(p, b, n)	writesl((PCI_IO_ADDR)_IO_BASE+(p),(b),(n))
+
+#define __do_memset_io(addr, c, n)	\
+				_memset_io(PCI_FIX_ADDR(addr), c, n)
+#define __do_memcpy_toio(dst, src, n)	\
+				_memcpy_toio(PCI_FIX_ADDR(dst), src, n)
+
+#ifdef CONFIG_EEH
+#define __do_memcpy_fromio(dst, src, n)	\
+				eeh_memcpy_fromio(dst, PCI_FIX_ADDR(src), n)
+#else /* CONFIG_EEH */
+#define __do_memcpy_fromio(dst, src, n)	\
+				_memcpy_fromio(dst,PCI_FIX_ADDR(src),n)
+#endif /* !CONFIG_EEH */
 
 #ifdef CONFIG_PPC_INDIRECT_IO
 #define DEF_PCI_HOOK(x)		x
@@ -343,15 +490,27 @@
 /* Some drivers check for the presence of readq & writeq with
  * a #ifdef, so we make them happy here.
  */
+#ifdef __powerpc64__
 #define readq	readq
 #define writeq	writeq
+#endif
 
-/* Nothing to do for cache stuff x*/
+#ifdef CONFIG_NOT_COHERENT_CACHE
+
+#define dma_cache_inv(_start,_size) \
+	invalidate_dcache_range(_start, (_start + _size))
+#define dma_cache_wback(_start,_size) \
+	clean_dcache_range(_start, (_start + _size))
+#define dma_cache_wback_inv(_start,_size) \
+	flush_dcache_range(_start, (_start + _size))
+
+#else /* CONFIG_NOT_COHERENT_CACHE */
 
 #define dma_cache_inv(_start,_size)		do { } while (0)
 #define dma_cache_wback(_start,_size)		do { } while (0)
 #define dma_cache_wback_inv(_start,_size)	do { } while (0)
 
+#endif /* !CONFIG_NOT_COHERENT_CACHE */
 
 /*
  * Convert a physical pointer to a virtual kernel pointer for /dev/mem
@@ -372,6 +531,9 @@
 #define readl_relaxed(addr) readl(addr)
 #define readq_relaxed(addr) readq(addr)
 
+#ifdef CONFIG_PPC32
+#define mmiowb()
+#else
 /*
  * Enforce synchronisation of stores vs. spin_unlock
  * (this does it explicitely, though our implementation of spin_unlock
@@ -385,6 +547,7 @@
 	: "=&r" (tmp) : "i" (offsetof(struct paca_struct, io_sync))
 	: "memory");
 }
+#endif /* !CONFIG_PPC32 */
 
 static inline void iosync(void)
 {
@@ -453,22 +616,29 @@
  *   be hooked (but can be used by a hook on iounmap)
  *
  */
-extern void __iomem *ioremap(unsigned long address, unsigned long size);
-extern void __iomem *ioremap_flags(unsigned long address, unsigned long size,
+extern void __iomem *ioremap(phys_addr_t address, unsigned long size);
+extern void __iomem *ioremap_flags(phys_addr_t address, unsigned long size,
 				   unsigned long flags);
 #define ioremap_nocache(addr, size)	ioremap((addr), (size))
-extern void iounmap(void __iomem *addr);
+extern void iounmap(volatile void __iomem *addr);
 
-extern void __iomem *__ioremap(unsigned long address, unsigned long size,
+extern void __iomem *__ioremap(phys_addr_t, unsigned long size,
 			       unsigned long flags);
-extern void __iounmap(void __iomem *addr);
+extern void __iounmap(volatile void __iomem *addr);
 
-extern int __ioremap_explicit(unsigned long p_addr, unsigned long v_addr,
+extern int __ioremap_explicit(phys_addr_t p_addr, unsigned long v_addr,
 		     	      unsigned long size, unsigned long flags);
-extern int __iounmap_explicit(void __iomem *start, unsigned long size);
+extern int __iounmap_explicit(volatile void __iomem *start,
+			      unsigned long size);
 
 extern void __iomem * reserve_phb_iospace(unsigned long size);
 
+/* Those are more 32 bits only functions */
+extern unsigned long iopa(unsigned long addr);
+extern unsigned long mm_ptov(unsigned long addr) __attribute_const__;
+extern void io_block_mapping(unsigned long virt, phys_addr_t phys,
+			     unsigned int size, int flags);
+
 
 /*
  * When CONFIG_PPC_INDIRECT_IO is set, we use the generic iomap implementation
@@ -538,7 +708,33 @@
  */
 #define BIO_VMERGE_BOUNDARY	0
 
+/*
+ * 32 bits still uses virt_to_bus() for it's implementation of DMA
+ * mappings se we have to keep it defined here. We also have some old
+ * drivers (shame shame shame) that use bus_to_virt() and haven't been
+ * fixed yet so I need to define it here.
+ */
+#ifdef CONFIG_PPC32
+
+static inline unsigned long virt_to_bus(volatile void * address)
+{
+        if (address == NULL)
+		return 0;
+        return __pa(address) + PCI_DRAM_OFFSET;
+}
+
+static inline void * bus_to_virt(unsigned long address)
+{
+        if (address == 0)
+		return NULL;
+        return __va(address - PCI_DRAM_OFFSET);
+}
+
+#define page_to_bus(page)	(page_to_phys(page) + PCI_DRAM_OFFSET)
+
+#endif /* CONFIG_PPC32 */
+
+
 #endif /* __KERNEL__ */
 
-#endif /* CONFIG_PPC64 */
 #endif /* _ASM_POWERPC_IO_H */
Index: linux-cell/arch/powerpc/kernel/traps.c
===================================================================
--- linux-cell.orig/arch/powerpc/kernel/traps.c	2006-11-13 09:23:10.000000000 +1100
+++ linux-cell/arch/powerpc/kernel/traps.c	2006-11-13 09:23:13.000000000 +1100
@@ -53,10 +53,6 @@
 #endif
 #include <asm/kexec.h>
 
-#ifdef CONFIG_PPC64	/* XXX */
-#define _IO_BASE	pci_io_base
-#endif
-
 #ifdef CONFIG_DEBUGGER
 int (*__debugger)(struct pt_regs *regs);
 int (*__debugger_ipi)(struct pt_regs *regs);
@@ -241,7 +237,7 @@
  */
 static inline int check_io_access(struct pt_regs *regs)
 {
-#if defined(CONFIG_PPC_PMAC) && defined(CONFIG_PPC32)
+#ifdef CONFIG_PPC32
 	unsigned long msr = regs->msr;
 	const struct exception_table_entry *entry;
 	unsigned int *nip = (unsigned int *)regs->nip;
@@ -274,7 +270,7 @@
 			return 1;
 		}
 	}
-#endif /* CONFIG_PPC_PMAC && CONFIG_PPC32 */
+#endif /* CONFIG_PPC32 */
 	return 0;
 }
 
Index: linux-cell/arch/powerpc/kernel/rtas_pci.c
===================================================================
--- linux-cell.orig/arch/powerpc/kernel/rtas_pci.c	2006-11-13 09:23:10.000000000 +1100
+++ linux-cell/arch/powerpc/kernel/rtas_pci.c	2006-11-13 09:23:13.000000000 +1100
@@ -38,6 +38,7 @@
 #include <asm/rtas.h>
 #include <asm/mpic.h>
 #include <asm/ppc-pci.h>
+#include <asm/eeh.h>
 
 /* RTAS tokens */
 static int read_pci_config;
Index: linux-cell/arch/powerpc/platforms/chrp/setup.c
===================================================================
--- linux-cell.orig/arch/powerpc/platforms/chrp/setup.c	2006-11-13 09:23:10.000000000 +1100
+++ linux-cell/arch/powerpc/platforms/chrp/setup.c	2006-11-13 09:23:13.000000000 +1100
@@ -588,7 +588,6 @@
 	ISA_DMA_THRESHOLD = ~0L;
 	DMA_MODE_READ = 0x44;
 	DMA_MODE_WRITE = 0x48;
-	isa_io_base = CHRP_ISA_IO_BASE;		/* default value */
 
 	return 1;
 }
Index: linux-cell/arch/powerpc/platforms/powermac/setup.c
===================================================================
--- linux-cell.orig/arch/powerpc/platforms/powermac/setup.c	2006-11-13 09:23:10.000000000 +1100
+++ linux-cell/arch/powerpc/platforms/powermac/setup.c	2006-11-13 09:23:13.000000000 +1100
@@ -677,8 +677,6 @@
 
 #ifdef CONFIG_PPC32
 	/* isa_io_base gets set in pmac_pci_init */
-	isa_mem_base = PMAC_ISA_MEM_BASE;
-	pci_dram_offset = PMAC_PCI_DRAM_OFFSET;
 	ISA_DMA_THRESHOLD = ~0L;
 	DMA_MODE_READ = 1;
 	DMA_MODE_WRITE = 2;
Index: linux-cell/arch/powerpc/mm/pgtable_32.c
===================================================================
--- linux-cell.orig/arch/powerpc/mm/pgtable_32.c	2006-11-13 09:23:10.000000000 +1100
+++ linux-cell/arch/powerpc/mm/pgtable_32.c	2006-11-13 09:23:13.000000000 +1100
@@ -149,6 +149,13 @@
 EXPORT_SYMBOL(ioremap);
 
 void __iomem *
+ioremap_flags(phys_addr_t addr, unsigned long size, unsigned long flags)
+{
+	return __ioremap(addr, size, flags);
+}
+EXPORT_SYMBOL(ioremap_flags);
+
+void __iomem *
 __ioremap(phys_addr_t addr, unsigned long size, unsigned long flags)
 {
 	unsigned long v, i;
@@ -247,20 +254,7 @@
 }
 EXPORT_SYMBOL(iounmap);
 
-void __iomem *ioport_map(unsigned long port, unsigned int len)
-{
-	return (void __iomem *) (port + _IO_BASE);
-}
-
-void ioport_unmap(void __iomem *addr)
-{
-	/* Nothing to do */
-}
-EXPORT_SYMBOL(ioport_map);
-EXPORT_SYMBOL(ioport_unmap);
-
-int
-map_page(unsigned long va, phys_addr_t pa, int flags)
+int map_page(unsigned long va, phys_addr_t pa, int flags)
 {
 	pmd_t *pd;
 	pte_t *pg;
Index: linux-cell/arch/powerpc/mm/pgtable_64.c
===================================================================
--- linux-cell.orig/arch/powerpc/mm/pgtable_64.c	2006-11-13 09:23:10.000000000 +1100
+++ linux-cell/arch/powerpc/mm/pgtable_64.c	2006-11-13 09:23:13.000000000 +1100
@@ -113,7 +113,7 @@
 }
 
 
-static void __iomem * __ioremap_com(unsigned long addr, unsigned long pa,
+static void __iomem * __ioremap_com(phys_addr_t addr, unsigned long pa,
 			    unsigned long ea, unsigned long size,
 			    unsigned long flags)
 {
@@ -129,7 +129,7 @@
 	return (void __iomem *) (ea + (addr & ~PAGE_MASK));
 }
 
-void __iomem * __ioremap(unsigned long addr, unsigned long size,
+void __iomem * __ioremap(phys_addr_t addr, unsigned long size,
 			 unsigned long flags)
 {
 	unsigned long pa, ea;
@@ -169,7 +169,7 @@
 }
 
 
-void __iomem * ioremap(unsigned long addr, unsigned long size)
+void __iomem * ioremap(phys_addr_t addr, unsigned long size)
 {
 	unsigned long flags = _PAGE_NO_CACHE | _PAGE_GUARDED;
 
@@ -178,7 +178,7 @@
 	return __ioremap(addr, size, flags);
 }
 
-void __iomem * ioremap_flags(unsigned long addr, unsigned long size,
+void __iomem * ioremap_flags(phys_addr_t addr, unsigned long size,
 			     unsigned long flags)
 {
 	if (ppc_md.ioremap)
@@ -189,7 +189,7 @@
 
 #define IS_PAGE_ALIGNED(_val) ((_val) == ((_val) & PAGE_MASK))
 
-int __ioremap_explicit(unsigned long pa, unsigned long ea,
+int __ioremap_explicit(phys_addr_t pa, unsigned long ea,
 		       unsigned long size, unsigned long flags)
 {
 	struct vm_struct *area;
@@ -244,7 +244,7 @@
  *
  * XXX	what about calls before mem_init_done (ie python_countermeasures())
  */
-void __iounmap(void __iomem *token)
+void __iounmap(volatile void __iomem *token)
 {
 	void *addr;
 
@@ -256,7 +256,7 @@
 	im_free(addr);
 }
 
-void iounmap(void __iomem *token)
+void iounmap(volatile void __iomem *token)
 {
 	if (ppc_md.iounmap)
 		ppc_md.iounmap(token);
@@ -282,7 +282,7 @@
 	return 0;
 }
 
-int __iounmap_explicit(void __iomem *start, unsigned long size)
+int __iounmap_explicit(volatile void __iomem *start, unsigned long size)
 {
 	struct vm_struct *area;
 	unsigned long addr;
Index: linux-cell/arch/powerpc/platforms/iseries/setup.c
===================================================================
--- linux-cell.orig/arch/powerpc/platforms/iseries/setup.c	2006-11-13 09:23:10.000000000 +1100
+++ linux-cell/arch/powerpc/platforms/iseries/setup.c	2006-11-13 09:23:13.000000000 +1100
@@ -649,13 +649,13 @@
 void __init iSeries_init_IRQ(void) { }
 #endif
 
-static void __iomem *iseries_ioremap(unsigned long address, unsigned long size,
+static void __iomem *iseries_ioremap(phys_addr_t address, unsigned long size,
 				     unsigned long flags)
 {
 	return (void __iomem *)address;
 }
 
-static void iseries_iounmap(void __iomem *token)
+static void iseries_iounmap(volatile void __iomem *token)
 {
 }
 
Index: linux-cell/include/asm-powerpc/machdep.h
===================================================================
--- linux-cell.orig/include/asm-powerpc/machdep.h	2006-11-13 09:23:10.000000000 +1100
+++ linux-cell/include/asm-powerpc/machdep.h	2006-11-13 09:23:13.000000000 +1100
@@ -88,9 +88,9 @@
 	void		(*pci_dma_dev_setup)(struct pci_dev *dev);
 	void		(*pci_dma_bus_setup)(struct pci_bus *bus);
 
-	void __iomem *	(*ioremap)(unsigned long addr, unsigned long size,
+	void __iomem *	(*ioremap)(phys_addr_t addr, unsigned long size,
 				   unsigned long flags);
-	void		(*iounmap)(void __iomem *token);
+	void		(*iounmap)(volatile void __iomem *token);
 #endif /* CONFIG_PPC64 */
 
 	int		(*probe)(void);
Index: linux-cell/arch/powerpc/kernel/pci_32.c
===================================================================
--- linux-cell.orig/arch/powerpc/kernel/pci_32.c	2006-11-13 09:23:10.000000000 +1100
+++ linux-cell/arch/powerpc/kernel/pci_32.c	2006-11-13 09:23:13.000000000 +1100
@@ -1561,7 +1561,7 @@
 		*offset += hose->pci_mem_offset;
 		res_bit = IORESOURCE_MEM;
 	} else {
-		io_offset = hose->io_base_virt - ___IO_BASE;
+		io_offset = hose->io_base_virt - (void __iomem *)_IO_BASE;
 		*offset += io_offset;
 		res_bit = IORESOURCE_IO;
 	}
@@ -1816,7 +1816,8 @@
 		return;
 
 	if (rsrc->flags & IORESOURCE_IO)
-		offset = ___IO_BASE - hose->io_base_virt + hose->io_base_phys;
+		offset = (void __iomem *)_IO_BASE - hose->io_base_virt
+			+ hose->io_base_phys;
 
 	*start = rsrc->start + offset;
 	*end = rsrc->end + offset;
@@ -1835,35 +1836,6 @@
 	res->child = NULL;
 }
 
-void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max)
-{
-	unsigned long start = pci_resource_start(dev, bar);
-	unsigned long len = pci_resource_len(dev, bar);
-	unsigned long flags = pci_resource_flags(dev, bar);
-
-	if (!len)
-		return NULL;
-	if (max && len > max)
-		len = max;
-	if (flags & IORESOURCE_IO)
-		return ioport_map(start, len);
-	if (flags & IORESOURCE_MEM)
-		/* Not checking IORESOURCE_CACHEABLE because PPC does
-		 * not currently distinguish between ioremap and
-		 * ioremap_nocache.
-		 */
-		return ioremap(start, len);
-	/* What? */
-	return NULL;
-}
-
-void pci_iounmap(struct pci_dev *dev, void __iomem *addr)
-{
-	/* Nothing to do */
-}
-EXPORT_SYMBOL(pci_iomap);
-EXPORT_SYMBOL(pci_iounmap);
-
 unsigned long pci_address_to_pio(phys_addr_t address)
 {
 	struct pci_controller* hose = hose_head;
Index: linux-cell/arch/powerpc/kernel/iomap.c
===================================================================
--- linux-cell.orig/arch/powerpc/kernel/iomap.c	2006-11-13 09:23:10.000000000 +1100
+++ linux-cell/arch/powerpc/kernel/iomap.c	2006-11-13 09:23:13.000000000 +1100
@@ -106,7 +106,7 @@
 
 void __iomem *ioport_map(unsigned long port, unsigned int len)
 {
-	return (void __iomem *) (port+pci_io_base);
+	return (void __iomem *) (port + _IO_BASE);
 }
 
 void ioport_unmap(void __iomem *addr)
Index: linux-cell/include/asm-powerpc/ide.h
===================================================================
--- linux-cell.orig/include/asm-powerpc/ide.h	2006-11-13 09:23:10.000000000 +1100
+++ linux-cell/include/asm-powerpc/ide.h	2006-11-13 09:23:13.000000000 +1100
@@ -22,17 +22,10 @@
 #endif
 #endif
 
-#ifdef __powerpc64__
 #define __ide_mm_insw(p, a, c)	readsw((void __iomem *)(p), (a), (c))
 #define __ide_mm_insl(p, a, c)	readsl((void __iomem *)(p), (a), (c))
 #define __ide_mm_outsw(p, a, c)	writesw((void __iomem *)(p), (a), (c))
 #define __ide_mm_outsl(p, a, c)	writesl((void __iomem *)(p), (a), (c))
-#else
-#define __ide_mm_insw(p, a, c)	_insw_ns((volatile u16 __iomem *)(p), (a), (c))
-#define __ide_mm_insl(p, a, c)	_insl_ns((volatile u32 __iomem *)(p), (a), (c))
-#define __ide_mm_outsw(p, a, c)	_outsw_ns((volatile u16 __iomem *)(p), (a), (c))
-#define __ide_mm_outsl(p, a, c)	_outsl_ns((volatile u32 __iomem *)(p), (a), (c))
-#endif
 
 #ifndef  __powerpc64__
 #include <linux/hdreg.h>

^ permalink raw reply

* Re: [PATCH]: PowerPC: make sure the rtas stop-self token is defined.
From: Michael Ellerman @ 2006-11-13  0:32 UTC (permalink / raw)
  To: Linas Vepstas; +Cc: linuxppc-dev, Nathan Lynch, paulus
In-Reply-To: <20061111010108.GX30625@austin.ibm.com>

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

On Fri, 2006-11-10 at 19:01 -0600, Linas Vepstas wrote:
> On Fri, Nov 10, 2006 at 02:01:52PM -0600, Nathan Lynch wrote:
> > Linas Vepstas wrote:
> > > 
> > > There are a variety of code paths that lead to rtas_stop_self()
> > > being called, primarily through cpu_die(). However, rtas_stop_self() 
> > > has a BUG_ON(rtas_args->token == RTAS_UNKNOWN_SERVICE); in it, and
> > > this rtas token is only set up if CONFIG_HOTPLUG_CPU is defined.
> > > 
> > > Rather than wrapping all of the callers of rtas_stop_self()
> > > with CONFIG_HOTPLUG_CPU, it seems wiser to just unwrap the token
> > > definition.
> > 
> > Is there actually a code path that calls rtas_stop_self with
> > CONFIG_HOTPLUG_CPU=n?  That would be a bug, I think.
> 
> Yeah, that was my first reaction too, right next to "user error". 
> But then I started tracing the code paths, and after they multiplied
> a bit, it was clear that the answer wouldn't be clear. 
> 
> So then I philosophized a bit: if the code cannot be called
> unless CONFIG_HOTPLUG_CPU=y, then I should add #ifdef CONFIG_HOTPLUG_CPU
> to make sure that the code doesn't even get compiled in.
> 
> Well, there used to be such ifdefs (according to Joel) but someone 
> removed the ifdefs. I'm guessing that these got removed during the
> powerpc tree migration.
> 
> So... Rather than wrapping all of the callers of rtas_stop_self() ...

I can only find one caller? Is it called via a #define or something?

Wouldn't it be preferable to just change rtas.h like so:

#ifdef CONFIG_HOTPLUG_CPU
extern void rtas_stop_self(void);
#else
static inline void rtas_stop_self(void) { }
#endif

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 13/16] powerpc: add ps3 platform lpar addressing
From: Michael Ellerman @ 2006-11-13  0:41 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: linuxppc-dev, Paul Mackerras
In-Reply-To: <1163292316.4982.240.camel@localhost.localdomain>

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

On Sun, 2006-11-12 at 11:45 +1100, Benjamin Herrenschmidt wrote:
> On Sat, 2006-11-11 at 12:28 +0100, Christoph Hellwig wrote:
> > On Fri, Nov 10, 2006 at 12:03:32PM -0800, Geoff Levand wrote:
> > > Adds some needed bits for a config option PS3PF_USE_LPAR_ADDR that disables
> > > the ps3pf lpar address translation mechanism.  This is a currently needed
> > > workaround for limitations in the design of the spu support.
> > 
> > So make the code do the sane thing and don't put the config in the
> > kernel tree.
> 
> Well... I'd like to keep the option for a little while.
> 
> There are performances issues with sparsemem the way it's used by
> ps3pf.. the problem is that the memory map looks like you get a bunch of
> memory at 0 (the RMO, not sure exactly how much in practice) and the
> rest in a chunk all the way up the 48 bits or so max physical space.
> 
> So sparsemem ends up with an enormous mapping only populated at the very
> beginning and the very end.
> 
> Thus, I'd like Geoff to keep the option of doing the manual translation
> in the hash code for now until I finally get some HW and thus can do
> some measurements, and possibly figure out a nicer way to deal with
> that.

I haven't read the ps3 code very carefully, but at first glance it
struck me that it has a similar problem to iSeries. It might be worth
seeing if the iSeries mschunks_map gunk can help (see
include/asm-powerpc/abs_addr.h)

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 14/16] powerpc: add ps3 platform OS params support
From: Michael Ellerman @ 2006-11-13  1:29 UTC (permalink / raw)
  To: Geoff Levand; +Cc: linuxppc-dev, Paul Mackerras
In-Reply-To: <4554DB20.9020200@am.sony.com>

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

Hi Geoff,

A few comments below ...

On Fri, 2006-11-10 at 12:03 -0800, Geoff Levand wrote:
> Add support to access the parameter data from the ps3pf other OS area of flash
> memory.  The parameter data mainly holds user preferences like static ip
> address, etc.
> 
> Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com>
> 
> ---
>  arch/powerpc/platforms/ps3pf/Makefile  |    2 
>  arch/powerpc/platforms/ps3pf/os-area.c |  245 +++++++++++++++++++++++++++++++++
>  arch/powerpc/platforms/ps3pf/setup.c   |    1 
>  3 files changed, 247 insertions(+), 1 deletion(-)
> 
> Index: cell--common--6/arch/powerpc/platforms/ps3pf/Makefile
> ===================================================================
> --- cell--common--6.orig/arch/powerpc/platforms/ps3pf/Makefile
> +++ cell--common--6/arch/powerpc/platforms/ps3pf/Makefile
> @@ -1,2 +1,2 @@
>  obj-$(CONFIG_PS3PF) += setup.o mm.o smp.o time.o hvcall.o htab.o repository.o
> -obj-$(CONFIG_PS3PF) += interrupt.o exports.o
> +obj-$(CONFIG_PS3PF) += interrupt.o exports.o os-area.o

You don't need CONFIG_PS3PF in this Makefile, it'll only be built if
CONFIG_PS3PF is already set, just add to obj-y. See the other platform
Makefiles for example.

> Index: cell--common--6/arch/powerpc/platforms/ps3pf/os-area.c
> ===================================================================
> --- /dev/null
> +++ cell--common--6/arch/powerpc/platforms/ps3pf/os-area.c
> @@ -0,0 +1,245 @@
> +/*
> + * os-area.c - PS3 Platform OS data area.
> + *
> + *  Copyright (C) 2006 Sony Computer Entertainment Inc.
> + *  Copyright 2006 Sony Corp.
> + *
> + *  This program is free software; you can redistribute it and/or modify
> + *  it under the terms of the GNU General Public License as published by
> + *  the Free Software Foundation; version 2 of the License.
> + *
> + *  This program is distributed in the hope that it will be useful,
> + *  but WITHOUT ANY WARRANTY; without even the implied warranty of
> + *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + *  GNU General Public License for more details.
> + *
> + *  You should have received a copy of the GNU General Public License
> + *  along with this program; if not, write to the Free Software
> + *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
> + */
> +
> +#undef DEBUG
> +
> +#include <linux/kernel.h>
> +#include <linux/io.h>
> +
> +#include <asm/lmb.h>
> +#include <asm/ps3pf.h>
> +
> +#include "platform.h"
> +
> +enum {
> +	segment_size = 0x200,
> +	ldr_format_raw = 0,
> +	ldr_format_gzip = 1,
> +	boot_flag_game_os = 0,
> +	boot_flag_other_os = 1,
> +	av_multi_out_ntsc = 0,
> +	av_multi_out_pal_rgb = 1,
> +	av_multi_out_pal_ycbcr = 2,
> +	av_multi_out_secam = 3,
> +	ctrl_button_o_is_yes = 0,
> +	ctrl_button_x_is_yes = 1,
> +};

I know you've got a lot of code to get reviewed and merged, but this
still irks me. These aren't related constants, so I don't think they
belong in an enum together, ctrl_button_o_is_yes == boot_flag_game_os ?

CodingStyle says the labels should be capitalised. 

> +/**
> + * struct header - os area header segment.
> + * @magic_num: Always 'cell_ext_os_area'.
> + * @hdr_version: Header format version number.
> + * @os_region_offset: Segment number of os region.

Doesn't match the name in the struct.

> + * @bootloader_offset: Segment number of bootloader image.

Is it an offset (from something) or a segment number?

> + * @ldr_format: ldr_format flag.
> + * @ldr_size: Size of bootloader image in bytes.

If these three all describe the same thing, the bootloader, it'd be good
if the names were similar, eg: bootloader_offset, bootloader_format,
bootloader_size.

> + */
> +
> +struct header {
> +	s8 magic_num[16];

You compare this later to "cell_ext_os_area", so it's not really a magic
number at all, it's a string?

> +	u32 hdr_version;
> +	u32 os_image_offset;
> +	u32 bootloader_offset;
> +	u32 _reserved_1;
> +	u32 ldr_format;
> +	u32 ldr_size;
> +	u32 _reserved_2[6];
> +} __attribute__ ((packed));
> +
> +/**
> + * struct params - os area params segment.
> + * @boot_flag: User preference of operating system.
> + * @num_params: Number of params in this (params) segment.
> + * @rtc_diff: Difference in seconds between 1970 and the ps3pf rtc value.
> + * @av_multi_out: User preference of AV output.
> + * @ctrl_button: User preference of controller button config.
> + * @static_ip_addr: User preference of static IP address.
> + * @network_mask: User preference of static network mask.
> + * @default_gateway: User preference of static default gateway.
> + * @dns_primary: User preference of static primary dns server.
> + * @dns_secondary: User preference of static secondary dns server.
> + *
> + * User preference of zero for static_ip_addr means use dhcp.
> + */
> +
> +struct params {
> +	u32 boot_flag;
> +	u32 _reserved_1[3];
> +	u32 num_params;
> +	u32 _reserved_2[3];
> +	/* param 0 */
> +	s64 rtc_diff;
> +	u8 av_multi_out;
> +	u8 ctrl_button;
> +	u8 _reserved_3[6];
> +	/* param 1 */
> +	u8 static_ip_addr[4];
> +	u8 network_mask[4];
> +	u8 default_gateway[4];
> +	u8 _reserved_4[4];
> +	/* param 2 */
> +	u8 dns_primary[4];
> +	u8 dns_secondary[4];
> +	u8 _reserved_5[8];
> +} __attribute__ ((packed));
> +
> +/**
> + * struct os_params - Static working copies of data from the os area.
> + *
> + * For the convinience of the guest, the HV makes a copy of the os area in
> + * flash to a high address in the boot memory region and then puts that RAM
> + * address and the byte count into the repository for retreval by the guest.
> + * We copy the data we want into a static variable and allow the memory setup
> + * by the HV to be claimed by the lmb manager.
> + */
> +
> +struct os_params {
> +	/* param 0 */
> +	s64 rtc_diff;
> +	unsigned int av_multi_out;
> +	unsigned int ctrl_button;
> +	/* param 1 */
> +	u8 static_ip_addr[4];
> +	u8 network_mask[4];
> +	u8 default_gateway[4];
> +	/* param 2 */
> +	u8 dns_primary[4];
> +	u8 dns_secondary[4];
> +} static os_params;

Several of these structs could use a better name: header, params etc.

> +
> +#define dump_header(_a) _dump_header(_a, __func__, __LINE__)
> +static void _dump_header(const struct header __iomem *h, const char* func,
> +	int line)
> +{
> +	pr_debug("%s:%d: h.magic_num:         '%s'\n", func, line,
> +		h->magic_num);
> +	pr_debug("%s:%d: h.hdr_version:       %u\n", func, line,
> +		h->hdr_version);
> +	pr_debug("%s:%d: h.os_image_offset:   %u\n", func, line,
> +		h->os_image_offset);
> +	pr_debug("%s:%d: h.bootloader_offset: %u\n", func, line,
> +		h->bootloader_offset);
> +	pr_debug("%s:%d: h.ldr_format:        %u\n", func, line,
> +		h->ldr_format);
> +	pr_debug("%s:%d: h.ldr_size:          %xh\n", func, line,
> +		h->ldr_size);
> +}
> +
> +#define dump_params(_a) _dump_params(_a, __func__, __LINE__)
> +static void _dump_params(const struct params __iomem *p, const char* func,
> +	int line)
> +{
> +	pr_debug("%s:%d: p.boot_flag:       %u\n", func, line, p->boot_flag);
> +	pr_debug("%s:%d: p.num_params:      %u\n", func, line, p->num_params);
> +	pr_debug("%s:%d: p.rtc_diff         %ld\n", func, line, p->rtc_diff);
> +	pr_debug("%s:%d: p.av_multi_out     %u\n", func, line, p->av_multi_out);
> +	pr_debug("%s:%d: p.ctrl_button:     %u\n", func, line, p->ctrl_button);
> +	pr_debug("%s:%d: p.static_ip_addr:  %u.%u.%u.%u\n", func, line,
> +		p->static_ip_addr[0], p->static_ip_addr[1],
> +		p->static_ip_addr[2], p->static_ip_addr[3]);
> +	pr_debug("%s:%d: p.network_mask:    %u.%u.%u.%u\n", func, line,
> +		p->network_mask[0], p->network_mask[1],
> +		p->network_mask[2], p->network_mask[3]);
> +	pr_debug("%s:%d: p.default_gateway: %u.%u.%u.%u\n", func, line,
> +		p->default_gateway[0], p->default_gateway[1],
> +		p->default_gateway[2], p->default_gateway[3]);
> +	pr_debug("%s:%d: p.dns_primary:     %u.%u.%u.%u\n", func, line,
> +		p->dns_primary[0], p->dns_primary[1],
> +		p->dns_primary[2], p->dns_primary[3]);
> +	pr_debug("%s:%d: p.dns_secondary:   %u.%u.%u.%u\n", func, line,
> +		p->dns_secondary[0], p->dns_secondary[1],
> +		p->dns_secondary[2], p->dns_secondary[3]);
> +}
> +
> +static int __init verify_header(const struct header *header)
> +{
> +	if (memcmp(header->magic_num, "cell_ext_os_area", 16)) {
> +		pr_debug("%s:%d magic_num failed\n", __func__, __LINE__);
> +		return -1;
> +	}
> +
> +	if (header->hdr_version != 1) {
> +		pr_debug("%s:%d hdr_version failed\n", __func__, __LINE__);
> +		return -1;
> +	}

Is version 2 not going to be backward compatible? Could it be >= 1 ?

> +
> +	if (header->os_image_offset > header->bootloader_offset) {
> +		pr_debug("%s:%d offsets failed\n", __func__, __LINE__);
> +		return -1;
> +	}
> +
> +	return 0;
> +}
> +
> +int __init ps3pf_os_area_init(void)
> +{
> +	int result;
> +	u64 lpar_addr;
> +	unsigned int size;
> +	struct header *header;
> +	struct params *params;
> +
> +	result = ps3pf_repository_read_boot_dat_info(&lpar_addr, &size);
> +
> +	if (result) {
> +		pr_debug("%s:%d ps3pf_repository_read_boot_dat_info failed\n",
> +			__func__, __LINE__);
> +		return result;
> +	}
> +
> +	header = (struct header *)__va(lpar_addr);
> +	params = (struct params *)__va(lpar_addr + segment_size);
> +
> +	result = verify_header(header);
> +
> +	if (result) {
> +		pr_debug("%s:%d verify_header failed\n", __func__, __LINE__);
> +		dump_header(header);
> +		return -EIO;
> +	}
> +
> +	dump_header(header);
> +	dump_params(params);
> +
> +	os_params.rtc_diff = params->rtc_diff;
> +	os_params.av_multi_out = params->av_multi_out;
> +	if (0) { /* currently not used */

Why not?

> +		os_params.ctrl_button = params->ctrl_button;
> +		memcpy(os_params.static_ip_addr, params->static_ip_addr, 4);
> +		memcpy(os_params.network_mask, params->network_mask, 4);
> +		memcpy(os_params.default_gateway, params->default_gateway, 4);
> +		memcpy(os_params.dns_secondary, params->dns_secondary, 4);
> +	}
> +
> +	return result;
> +}
> +
> +/**
> + * ps3pf_os_area_rtc_diff - Returns the ps3pf rtc diff value.
> + *
> + * The ps3pf rtc maintains a value that approximates seconds since
> + * 2000-01-01 00:00:00 UTC.  Returns the exact number of seconds from 1970 to
> + * 2000 when os_params.rtc_diff has not been properly set up.
> + */
> +
> +u64 ps3pf_os_area_rtc_diff(void)
> +{
> +	return os_params.rtc_diff ? os_params.rtc_diff : 946684800UL;
> +}
> Index: cell--common--6/arch/powerpc/platforms/ps3pf/setup.c
> ===================================================================
> --- cell--common--6.orig/arch/powerpc/platforms/ps3pf/setup.c
> +++ cell--common--6/arch/powerpc/platforms/ps3pf/setup.c
> @@ -115,6 +115,7 @@
>  
>  	powerpc_firmware_features |= FW_FEATURE_LPAR;
>  
> +	ps3pf_os_area_init();
>  	ps3pf_mm_init();
>  	ps3pf_mm_vas_create(&htab_size);
>  	ps3pf_hpte_init(htab_size);


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 13/16] powerpc: add ps3 platform lpar addressing
From: Geoff Levand @ 2006-11-13  2:05 UTC (permalink / raw)
  To: michael; +Cc: Paul Mackerras, linuxppc-dev
In-Reply-To: <1163378514.7410.16.camel@localhost.localdomain>

Michael Ellerman wrote:
> On Sun, 2006-11-12 at 11:45 +1100, Benjamin Herrenschmidt wrote:
>> On Sat, 2006-11-11 at 12:28 +0100, Christoph Hellwig wrote:
>> > On Fri, Nov 10, 2006 at 12:03:32PM -0800, Geoff Levand wrote:
>> > > Adds some needed bits for a config option PS3PF_USE_LPAR_ADDR that disables
>> > > the ps3pf lpar address translation mechanism.  This is a currently needed
>> > > workaround for limitations in the design of the spu support.
>> > 
>> > So make the code do the sane thing and don't put the config in the
>> > kernel tree.
>> 
>> Well... I'd like to keep the option for a little while.
>> 
>> There are performances issues with sparsemem the way it's used by
>> ps3pf.. the problem is that the memory map looks like you get a bunch of
>> memory at 0 (the RMO, not sure exactly how much in practice) and the
>> rest in a chunk all the way up the 48 bits or so max physical space.
>> 
>> So sparsemem ends up with an enormous mapping only populated at the very
>> beginning and the very end.
>> 
>> Thus, I'd like Geoff to keep the option of doing the manual translation
>> in the hash code for now until I finally get some HW and thus can do
>> some measurements, and possibly figure out a nicer way to deal with
>> that.
> 
> I haven't read the ps3 code very carefully, but at first glance it
> struck me that it has a similar problem to iSeries. It might be worth
> seeing if the iSeries mschunks_map gunk can help (see
> include/asm-powerpc/abs_addr.h)

Yes, it is essentially the same as iSeries, but since the current spu
code sets up the spu local stores as chunks of sparse memory, I still
need this for those.  To fix it properly the spu code needs to be re-worked,
and Ben said he plans to do some work there.  At that time I will reconsider
how to manage the mem regions.

As Christoph says though, this doesn't really need to be exposed as a config
option, but I wanted to include it for anyone that wanted to experiment with
it.  If you don't use spus you can save about 256KB with this option.

-Geoff

^ permalink raw reply

* Re: [PATCH 14/16] powerpc: add ps3 platform OS params support
From: Geoff Levand @ 2006-11-13  3:19 UTC (permalink / raw)
  To: michael; +Cc: linuxppc-dev, Paul Mackerras
In-Reply-To: <1163381393.7410.39.camel@localhost.localdomain>

Michael Ellerman wrote:
>> +++ cell--common--6/arch/powerpc/platforms/ps3pf/Makefile
>> @@ -1,2 +1,2 @@
>>  obj-$(CONFIG_PS3PF) += setup.o mm.o smp.o time.o hvcall.o htab.o repository.o
>> -obj-$(CONFIG_PS3PF) += interrupt.o exports.o
>> +obj-$(CONFIG_PS3PF) += interrupt.o exports.o os-area.o
> 
> You don't need CONFIG_PS3PF in this Makefile, it'll only be built if
> CONFIG_PS3PF is already set, just add to obj-y. See the other platform
> Makefiles for example.


Good point, thanks.


>> +enum {
>> +	segment_size = 0x200,
>> +	ldr_format_raw = 0,
>> +	ldr_format_gzip = 1,
>> +	boot_flag_game_os = 0,
>> +	boot_flag_other_os = 1,
>> +	av_multi_out_ntsc = 0,
>> +	av_multi_out_pal_rgb = 1,
>> +	av_multi_out_pal_ycbcr = 2,
>> +	av_multi_out_secam = 3,
>> +	ctrl_button_o_is_yes = 0,
>> +	ctrl_button_x_is_yes = 1,
>> +};
> 
> I know you've got a lot of code to get reviewed and merged, but this
> still irks me. These aren't related constants, so I don't think they
> belong in an enum together, ctrl_button_o_is_yes == boot_flag_game_os ?
> 
> CodingStyle says the labels should be capitalised. 


I'll do that.


> Is it an offset (from something) or a segment number?
> 
>> + * @ldr_format: ldr_format flag.
>> + * @ldr_size: Size of bootloader image in bytes.
> 
> If these three all describe the same thing, the bootloader, it'd be good
> if the names were similar, eg: bootloader_offset, bootloader_format,
> bootloader_size.


These names came from the docs.  I think it would be best to keep them the
same to avoid confusion.

It is not so convenient to view, but the other os area is documented in the
iso image CELL-Linux-CL_20061110-ADDON.iso at
http://ftp.uk.linux.org/pub/linux/Sony-PS3/.


>> + */
>> +
>> +struct header {
>> +	s8 magic_num[16];
> 
> You compare this later to "cell_ext_os_area", so it's not really a magic
> number at all, it's a string?


Same thing, the name from the docs.


>> +static int __init verify_header(const struct header *header)
>> +{
>> +	if (memcmp(header->magic_num, "cell_ext_os_area", 16)) {
>> +		pr_debug("%s:%d magic_num failed\n", __func__, __LINE__);
>> +		return -1;
>> +	}
>> +
>> +	if (header->hdr_version != 1) {
>> +		pr_debug("%s:%d hdr_version failed\n", __func__, __LINE__);
>> +		return -1;
>> +	}
> 
> Is version 2 not going to be backward compatible? Could it be >= 1 ?


I have absolutely no clue what the next version number will be, nor the
compatibility, etc.  I'll set this when the version changes.


>> +	dump_header(header);
>> +	dump_params(params);
>> +
>> +	os_params.rtc_diff = params->rtc_diff;
>> +	os_params.av_multi_out = params->av_multi_out;
>> +	if (0) { /* currently not used */
> 
> Why not?


The drivers aren't ported yet.  I suppose I could take this out though.


-Geoff

^ permalink raw reply

* Re: [PATCH 7/16] powerpc: add support for ps3 platform
From: Geoff Levand @ 2006-11-13  3:29 UTC (permalink / raw)
  To: Arnd Bergmann; +Cc: linuxppc-dev, Paul Mackerras
In-Reply-To: <200611111250.59279.arnd@arndb.de>

QXJuZCBCZXJnbWFubiB3cm90ZToNCj4gT24gRnJpZGF5IDEwIE5vdmVtYmVyIDIwMDYgMjE6MDIs
IEdlb2ZmIExldmFuZCB3cm90ZToNCj4+IEBAIC04NzYsNyArODg1LDcgQEANCj4+IO+/ve+/ve+/
ve+/ve+/ve+/ve+/ve+/vWJvb2wgIlBDSSBzdXBwb3J0IiBpZiA0MHggfHwgQ1BNMiB8fCBQUENf
ODN4eCB8fCBQUENfODV4eCB8fCBQUENfODZ4eCBcDQo+PiDvv73vv73vv73vv73vv73vv73vv73v
v73vv73vv73vv73vv73vv73vv73vv73vv718fCBQUENfTVBDNTJ4eCB8fCAoRU1CRURERUQgJiYg
UFBDX0lTRVJJRVMpIHx8IE1QQzc0NDhIUEMyDQo+PiDvv73vv73vv73vv73vv73vv73vv73vv71k
ZWZhdWx0IHkgaWYgITQweCAmJiAhQ1BNMiAmJiAhOHh4ICYmICFBUFVTICYmICFQUENfODN4eCBc
DQo+PiAt77+977+977+977+977+977+977+977+977+977+977+977+977+977+977+9JiYgIVBQ
Q184NXh4ICYmICFQUENfODZ4eA0KPj4gK++/ve+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/
ve+/ve+/ve+/ve+/vSYmICFQUENfODV4eCAmJiAhUFBDXzg2eHggJiYgIVBTM1BGDQo+PiDvv73v
v73vv73vv73vv73vv73vv73vv71kZWZhdWx0IFBDSV9QRVJNRURJQSBpZiAhNHh4ICYmICFDUE0y
ICYmICE4eHggJiYgQVBVUw0KPj4g77+977+977+977+977+977+977+977+9ZGVmYXVsdCBQQ0lf
UVNQQU4gaWYgITR4eCAmJiAhQ1BNMiAmJiA4eHgNCj4+IO+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/
vWhlbHANCj4gDQo+IFRoaXMgY2hhbmdlIGNhdXNlcyB0cm91YmxlIHdoZW4gdHJ5aW5nIHRvIGJ1
aWxkIGEgbXVsdGlwbGF0Zm9ybSBrZXJuZWwNCj4gdGhhdCBpbmNsdWRlcyBQUzNQRiBhbmQgb3Ro
ZXJzIGF0IHRoZSBzYW1lIHRpbWUsIGJlY2F1c2UgUENJIGdldHMNCj4gZGlzYWJsZWQgdW5jb25k
aXRpb25hbGx5IHdoZW4gUFMzUEYgaXMgc2VsZWN0ZWQuDQoNCg0KT0ssIEkgZGlkbid0IGRvIGFu
eSBtdWx0aS1wbGF0Zm9ybSB0ZXN0aW5nIHlldCwgYnV0IEknbGwgc3RhcnQuDQoNCg0KQXMgYSBz
aG9ydC10ZXJtDQo+IGZpeCwgSSdkIGNoYW5nZSB0aGlzIHRvIGRvDQo+IA0KPiAgICAgICAgIGJv
b2wgIlBDSSBzdXBwb3J0IiBpZiA0MHggfHwgQ1BNMiB8fCBQUENfODN4eCB8fCBQUENfODV4eCB8
fCBQUENfODZ4eCBcDQo+IC0gICAgICAgICAgICAgICB8fCBQUENfTVBDNTJ4eCB8fCAoRU1CRURE
RUQgJiYgUFBDX0lTRVJJRVMpIHx8IE1QQzc0NDhIUEMyDQo+ICsgICAgICAgICAgICAgICB8fCBQ
UENfTVBDNTJ4eCB8fCAoRU1CRURERUQgJiYgUFBDX0lTRVJJRVMpIHx8IE1QQzc0NDhIUEMyIFwN
Cj4gKyAgICAgICAgICAgICAgIHx8IFBTM1BGDQo+ICAgICAgICAgZGVmYXVsdCB5IGlmICE0MHgg
JiYgIUNQTTIgJiYgITh4eCAmJiAhQVBVUyAmJiAhUFBDXzgzeHggXA0KPiAgICAgICAgICAgICAg
ICAmJiAhUFBDXzg1eHggJiYgIVBQQ184Nnh4DQo+IA0KPiBXaGljaCBtYWtlcyBQQ0kgc3VwcG9y
dCBvcHRpb25hbCB3aGVuIFBTM1BGIGlzIHNlbGVjdGVkLiBIb3dldmVyLCB0aGlzIHN0aWxsDQo+
IG1lYW5zIHRoYXQgeW91IGNhbiBjaG9vc2UgYnJva2VuIGNvbmZpZ3VyYXRpb25zIChlLmcuIFBT
RVJJRVM9eSwgUFMzUEY9eSwNCj4gUENJPW4pLg0KDQoNCk9LLCBJJ2xsIHRyeSBpdC4NCg0KDQo+
IFRoZSByZWFsIGZpeCBzaG91bGQgYmUgdG8gZ2V0IHJpZCBvZiB0aGUgbG9uZyBjb25kaXRpb25h
bCBmb3IgQ09ORklHX1BDSSwNCj4gYW5kIGhhdmUgUENJIHNlbGVjdGVkIGJ5IHRoZSBwbGF0Zm9y
bXMgdGhlbXNlbHZlczoNCj4gDQo+IGNvbmZpZyBQUENfUFNFUklFUw0KPiAJc2VsZWN0IFBDSQ0K
DQoNClllcywgd2UgY2FuIHdvcmsgdG93YXJkcyB0aGF0Lg0KDQotR2VvZmYNCg==

^ permalink raw reply

* [POWERPC] iSeries: improve viodasd initialisation
From: Stephen Rothwell @ 2006-11-13  3:43 UTC (permalink / raw)
  To: paulus; +Cc: ppc-dev

On error, make sure that we undo all necessary operations.

This also gets rid of a must_check warning.

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
 drivers/block/viodasd.c |   49 ++++++++++++++++++++++++++++++++++------------
 1 files changed, 36 insertions(+), 13 deletions(-)

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au

diff --git a/drivers/block/viodasd.c b/drivers/block/viodasd.c
index ec5a1b9..e19ba4e 100644
--- a/drivers/block/viodasd.c
+++ b/drivers/block/viodasd.c
@@ -759,6 +759,8 @@ static struct vio_driver viodasd_driver
 	}
 };
 
+static int need_delete_probe;
+
 /*
  * Initialize the whole device driver.  Handle module and non-module
  * versions
@@ -773,46 +775,67 @@ static int __init viodasd_init(void)
 
 	if (viopath_hostLp == HvLpIndexInvalid) {
 		printk(VIOD_KERN_WARNING "invalid hosting partition\n");
-		return -EIO;
+		rc = -EIO;
+		goto early_fail;
 	}
 
 	printk(VIOD_KERN_INFO "vers " VIOD_VERS ", hosting partition %d\n",
 			viopath_hostLp);
 
         /* register the block device */
-	if (register_blkdev(VIODASD_MAJOR, VIOD_GENHD_NAME)) {
+	rc =  register_blkdev(VIODASD_MAJOR, VIOD_GENHD_NAME);
+	if (rc) {
 		printk(VIOD_KERN_WARNING
 				"Unable to get major number %d for %s\n",
 				VIODASD_MAJOR, VIOD_GENHD_NAME);
-		return -EIO;
+		goto early_fail;
 	}
 	/* Actually open the path to the hosting partition */
-	if (viopath_open(viopath_hostLp, viomajorsubtype_blockio,
-				VIOMAXREQ + 2)) {
+	rc = viopath_open(viopath_hostLp, viomajorsubtype_blockio,
+				VIOMAXREQ + 2);
+	if (rc) {
 		printk(VIOD_KERN_WARNING
 		       "error opening path to host partition %d\n",
 		       viopath_hostLp);
-		unregister_blkdev(VIODASD_MAJOR, VIOD_GENHD_NAME);
-		return -EIO;
+		goto unregister_blk;
 	}
 
 	/* Initialize our request handler */
 	vio_setHandler(viomajorsubtype_blockio, handle_block_event);
 
 	rc = vio_register_driver(&viodasd_driver);
-	if (rc == 0)
-		driver_create_file(&viodasd_driver.driver, &driver_attr_probe);
+	if (rc) {
+		printk(VIOD_KERN_WARNING "vio_register_driver failed\n");
+		goto unset_handler;
+	}
+
+	/*
+	 * If this call fails, it just means that we cannot dynamically
+	 * add virtual disks, but the driver will still work fine for
+	 * all existing disk, so ignore the failure.
+	 */
+	if (!driver_create_file(&viodasd_driver.driver, &driver_attr_probe))
+		need_delete_probe = 1;
+
+	return 0;
+
+unset_handler:
+	vio_clearHandler(viomajorsubtype_blockio);
+	viopath_close(viopath_hostLp, viomajorsubtype_blockio, VIOMAXREQ + 2);
+unregister_blk:
+	unregister_blkdev(VIODASD_MAJOR, VIOD_GENHD_NAME);
+early_fail:
 	return rc;
 }
 module_init(viodasd_init);
 
-void viodasd_exit(void)
+void __exit viodasd_exit(void)
 {
-	driver_remove_file(&viodasd_driver.driver, &driver_attr_probe);
+	if (need_delete_probe)
+		driver_remove_file(&viodasd_driver.driver, &driver_attr_probe);
 	vio_unregister_driver(&viodasd_driver);
 	vio_clearHandler(viomajorsubtype_blockio);
-	unregister_blkdev(VIODASD_MAJOR, VIOD_GENHD_NAME);
 	viopath_close(viopath_hostLp, viomajorsubtype_blockio, VIOMAXREQ + 2);
+	unregister_blkdev(VIODASD_MAJOR, VIOD_GENHD_NAME);
 }
-
 module_exit(viodasd_exit);
-- 
1.4.3.3

^ permalink raw reply related

* [POWERPC] iSeries: fix irq.c for combined build
From: Stephen Rothwell @ 2006-11-13  3:44 UTC (permalink / raw)
  To: paulus; +Cc: ppc-dev


Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
 arch/powerpc/kernel/irq.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au

diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c
index eb9fc62..e173c76 100644
--- a/arch/powerpc/kernel/irq.c
+++ b/arch/powerpc/kernel/irq.c
@@ -267,13 +267,12 @@ void do_IRQ(struct pt_regs *regs)
         irq_exit();
 	set_irq_regs(old_regs);
 
-#ifdef CONFIG_PPC_ISERIES
-	if (get_lppaca()->int_dword.fields.decr_int) {
+	if (firmware_has_feature(FW_FEATURE_ISERIES) &&
+			get_lppaca()->int_dword.fields.decr_int) {
 		get_lppaca()->int_dword.fields.decr_int = 0;
 		/* Signal a fake decrementer interrupt */
 		timer_interrupt(regs);
 	}
-#endif
 }
 
 void __init init_IRQ(void)
-- 
1.4.3.3

^ permalink raw reply related

* [POWERPC] iSeries: fix sysfs.c for combined build
From: Stephen Rothwell @ 2006-11-13  3:46 UTC (permalink / raw)
  To: paulus; +Cc: ppc-dev


Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
 arch/powerpc/kernel/sysfs.c |   10 ++++------
 1 files changed, 4 insertions(+), 6 deletions(-)

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au

diff --git a/arch/powerpc/kernel/sysfs.c b/arch/powerpc/kernel/sysfs.c
index cda21a2..22123a0 100644
--- a/arch/powerpc/kernel/sysfs.c
+++ b/arch/powerpc/kernel/sysfs.c
@@ -200,10 +200,9 @@ static void register_cpu_online(unsigned
 	struct cpu *c = &per_cpu(cpu_devices, cpu);
 	struct sys_device *s = &c->sysdev;
 
-#ifndef CONFIG_PPC_ISERIES
-	if (cpu_has_feature(CPU_FTR_SMT))
+	if (!firmware_has_feature(FW_FEATURE_ISERIES) &&
+			cpu_has_feature(CPU_FTR_SMT))
 		sysdev_create_file(s, &attr_smt_snooze_delay);
-#endif
 
 	/* PMC stuff */
 
@@ -242,10 +241,9 @@ static void unregister_cpu_online(unsign
 
 	BUG_ON(c->no_control);
 
-#ifndef CONFIG_PPC_ISERIES
-	if (cpu_has_feature(CPU_FTR_SMT))
+	if (!firmware_has_feature(FW_FEATURE_ISERIES) &&
+			cpu_has_feature(CPU_FTR_SMT))
 		sysdev_remove_file(s, &attr_smt_snooze_delay);
-#endif
 
 	/* PMC stuff */
 
-- 
1.4.3.3

^ permalink raw reply related

* [POWERPC] iSeries: fix time.c for combined build
From: Stephen Rothwell @ 2006-11-13  3:47 UTC (permalink / raw)
  To: paulus; +Cc: ppc-dev


Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
 arch/powerpc/kernel/time.c |    9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au

diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c
index a1b5e4b..ab35854 100644
--- a/arch/powerpc/kernel/time.c
+++ b/arch/powerpc/kernel/time.c
@@ -630,9 +630,8 @@ void timer_interrupt(struct pt_regs * re
 	profile_tick(CPU_PROFILING);
 	calculate_steal_time();
 
-#ifdef CONFIG_PPC_ISERIES
-	get_lppaca()->int_dword.fields.decr_int = 0;
-#endif
+	if (firmware_has_feature(FW_FEATURE_ISERIES))
+		get_lppaca()->int_dword.fields.decr_int = 0;
 
 	while ((ticks = tb_ticks_since(per_cpu(last_jiffy, cpu)))
 	       >= tb_ticks_per_jiffy) {
@@ -674,7 +673,7 @@ void timer_interrupt(struct pt_regs * re
 	set_dec(next_dec);
 
 #ifdef CONFIG_PPC_ISERIES
-	if (hvlpevent_is_pending())
+	if (firmware_has_feature(FW_FEATURE_ISERIES) && hvlpevent_is_pending())
 		process_hvlpevents();
 #endif
 
@@ -774,7 +773,7 @@ int do_settimeofday(struct timespec *tv)
 	 * settimeofday to perform this operation.
 	 */
 #ifdef CONFIG_PPC_ISERIES
-	if (first_settimeofday) {
+	if (firmware_has_feature(FW_FEATURE_ISERIES) && first_settimeofday) {
 		iSeries_tb_recal();
 		first_settimeofday = 0;
 	}
-- 
1.4.3.3

^ permalink raw reply related

* [POWERPC] iSeries: fix slb.c for combined build
From: Stephen Rothwell @ 2006-11-13  3:49 UTC (permalink / raw)
  To: paulus; +Cc: ppc-dev


Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
 arch/powerpc/mm/slb.c |   39 +++++++++++++++++++--------------------
 1 files changed, 19 insertions(+), 20 deletions(-)

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au

diff --git a/arch/powerpc/mm/slb.c b/arch/powerpc/mm/slb.c
index d373391..06c0055 100644
--- a/arch/powerpc/mm/slb.c
+++ b/arch/powerpc/mm/slb.c
@@ -23,6 +23,7 @@
 #include <asm/cputable.h>
 #include <asm/cacheflush.h>
 #include <asm/smp.h>
+#include <asm/firmware.h>
 #include <linux/compiler.h>
 
 #ifdef DEBUG
@@ -227,28 +228,26 @@ void slb_initialize(void)
 
 	/* On iSeries the bolted entries have already been set up by
 	 * the hypervisor from the lparMap data in head.S */
-#ifndef CONFIG_PPC_ISERIES
- {
-	unsigned long lflags, vflags;
+	if (!firmware_has_feature(FW_FEATURE_ISERIES)) {
+		unsigned long lflags, vflags;
 
-	lflags = SLB_VSID_KERNEL | linear_llp;
-	vflags = SLB_VSID_KERNEL | vmalloc_llp;
+		lflags = SLB_VSID_KERNEL | linear_llp;
+		vflags = SLB_VSID_KERNEL | vmalloc_llp;
+
+		/* Invalidate the entire SLB (even slot 0) & all the ERATS */
+		asm volatile("isync":::"memory");
+		asm volatile("slbmte  %0,%0"::"r" (0) : "memory");
+		asm volatile("isync; slbia; isync":::"memory");
+		create_shadowed_slbe(PAGE_OFFSET, lflags, 0);
 
-	/* Invalidate the entire SLB (even slot 0) & all the ERATS */
-	asm volatile("isync":::"memory");
-	asm volatile("slbmte  %0,%0"::"r" (0) : "memory");
-	asm volatile("isync; slbia; isync":::"memory");
-	create_shadowed_slbe(PAGE_OFFSET, lflags, 0);
-
-	create_shadowed_slbe(VMALLOC_START, vflags, 1);
-
-	/* We don't bolt the stack for the time being - we're in boot,
-	 * so the stack is in the bolted segment.  By the time it goes
-	 * elsewhere, we'll call _switch() which will bolt in the new
-	 * one. */
-	asm volatile("isync":::"memory");
- }
-#endif /* CONFIG_PPC_ISERIES */
+		create_shadowed_slbe(VMALLOC_START, vflags, 1);
+
+		/* We don't bolt the stack for the time being - we're in boot,
+		 * so the stack is in the bolted segment.  By the time it goes
+		 * elsewhere, we'll call _switch() which will bolt in the new
+		 * one. */
+		asm volatile("isync":::"memory");
+	}
 
 	get_paca()->stab_rr = SLB_NUM_BOLTED;
 }
-- 
1.4.3.3

^ permalink raw reply related

* [POWERPC] iSeries: fix xmon.c for combined build
From: Stephen Rothwell @ 2006-11-13  3:50 UTC (permalink / raw)
  To: paulus; +Cc: ppc-dev


Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
 arch/powerpc/xmon/xmon.c |   52 +++++++++++++++++++++++----------------------
 1 files changed, 27 insertions(+), 25 deletions(-)

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au

diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
index 0689c08..d66c3a1 100644
--- a/arch/powerpc/xmon/xmon.c
+++ b/arch/powerpc/xmon/xmon.c
@@ -39,6 +39,7 @@
 #include <asm/irq_regs.h>
 #include <asm/spu.h>
 #include <asm/spu_priv1.h>
+#include <asm/firmware.h>
 
 #ifdef CONFIG_PPC64
 #include <asm/hvcall.h>
@@ -1567,11 +1568,6 @@ void super_regs(void)
 {
 	int cmd;
 	unsigned long val;
-#ifdef CONFIG_PPC_ISERIES
-	struct paca_struct *ptrPaca = NULL;
-	struct lppaca *ptrLpPaca = NULL;
-	struct ItLpRegSave *ptrLpRegSave = NULL;
-#endif
 
 	cmd = skipbl();
 	if (cmd == '\n') {
@@ -1588,26 +1584,32 @@ void super_regs(void)
 		printf("sp   = "REG"  sprg3= "REG"\n", sp, mfspr(SPRN_SPRG3));
 		printf("toc  = "REG"  dar  = "REG"\n", toc, mfspr(SPRN_DAR));
 #ifdef CONFIG_PPC_ISERIES
-		// Dump out relevant Paca data areas.
-		printf("Paca: \n");
-		ptrPaca = get_paca();
-    
-		printf("  Local Processor Control Area (LpPaca): \n");
-		ptrLpPaca = ptrPaca->lppaca_ptr;
-		printf("    Saved Srr0=%.16lx  Saved Srr1=%.16lx \n",
-		       ptrLpPaca->saved_srr0, ptrLpPaca->saved_srr1);
-		printf("    Saved Gpr3=%.16lx  Saved Gpr4=%.16lx \n",
-		       ptrLpPaca->saved_gpr3, ptrLpPaca->saved_gpr4);
-		printf("    Saved Gpr5=%.16lx \n", ptrLpPaca->saved_gpr5);
-    
-		printf("  Local Processor Register Save Area (LpRegSave): \n");
-		ptrLpRegSave = ptrPaca->reg_save_ptr;
-		printf("    Saved Sprg0=%.16lx  Saved Sprg1=%.16lx \n",
-		       ptrLpRegSave->xSPRG0, ptrLpRegSave->xSPRG0);
-		printf("    Saved Sprg2=%.16lx  Saved Sprg3=%.16lx \n",
-		       ptrLpRegSave->xSPRG2, ptrLpRegSave->xSPRG3);
-		printf("    Saved Msr  =%.16lx  Saved Nia  =%.16lx \n",
-		       ptrLpRegSave->xMSR, ptrLpRegSave->xNIA);
+		if (firmware_has_feature(FW_FEATURE_ISERIES)) {
+			struct paca_struct *ptrPaca;
+			struct lppaca *ptrLpPaca;
+			struct ItLpRegSave *ptrLpRegSave;
+
+			/* Dump out relevant Paca data areas. */
+			printf("Paca: \n");
+			ptrPaca = get_paca();
+
+			printf("  Local Processor Control Area (LpPaca): \n");
+			ptrLpPaca = ptrPaca->lppaca_ptr;
+			printf("    Saved Srr0=%.16lx  Saved Srr1=%.16lx \n",
+			       ptrLpPaca->saved_srr0, ptrLpPaca->saved_srr1);
+			printf("    Saved Gpr3=%.16lx  Saved Gpr4=%.16lx \n",
+			       ptrLpPaca->saved_gpr3, ptrLpPaca->saved_gpr4);
+			printf("    Saved Gpr5=%.16lx \n", ptrLpPaca->saved_gpr5);
+
+			printf("  Local Processor Register Save Area (LpRegSave): \n");
+			ptrLpRegSave = ptrPaca->reg_save_ptr;
+			printf("    Saved Sprg0=%.16lx  Saved Sprg1=%.16lx \n",
+			       ptrLpRegSave->xSPRG0, ptrLpRegSave->xSPRG0);
+			printf("    Saved Sprg2=%.16lx  Saved Sprg3=%.16lx \n",
+			       ptrLpRegSave->xSPRG2, ptrLpRegSave->xSPRG3);
+			printf("    Saved Msr  =%.16lx  Saved Nia  =%.16lx \n",
+			       ptrLpRegSave->xMSR, ptrLpRegSave->xNIA);
+		}
 #endif
 
 		return;
-- 
1.4.3.3

^ permalink raw reply related

* [POWERPC] Add the thread topolgy to sysfs
From: Stephen Rothwell @ 2006-11-13  3:51 UTC (permalink / raw)
  To: paulus; +Cc: ppc-dev

This adds the /sys/devices/system/cpu/*/topology/thread_siblings
files.

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
 include/asm-powerpc/topology.h |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au

diff --git a/include/asm-powerpc/topology.h b/include/asm-powerpc/topology.h
index 8f7ee16..9fe7894 100644
--- a/include/asm-powerpc/topology.h
+++ b/include/asm-powerpc/topology.h
@@ -96,7 +96,13 @@ static inline void sysfs_remove_device_f
 
 #ifdef CONFIG_SMP
 #include <asm/cputable.h>
-#define smt_capable() 		(cpu_has_feature(CPU_FTR_SMT))
+#define smt_capable()		(cpu_has_feature(CPU_FTR_SMT))
+
+#ifdef CONFIG_PPC64
+#include <asm/smp.h>
+
+#define topology_thread_siblings(cpu)	(cpu_sibling_map[cpu])
+#endif
 #endif
 
 #endif /* __KERNEL__ */
-- 
1.4.3.3

^ permalink raw reply related

* [POWERPC] Wire up sys_move_pages
From: Stephen Rothwell @ 2006-11-13  3:52 UTC (permalink / raw)
  To: paulus; +Cc: ppc-dev


Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
 include/asm-powerpc/systbl.h |    1 +
 include/asm-powerpc/unistd.h |    3 ++-
 2 files changed, 3 insertions(+), 1 deletions(-)

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au

diff --git a/include/asm-powerpc/systbl.h b/include/asm-powerpc/systbl.h
index eac85ce..d9919a0 100644
--- a/include/asm-powerpc/systbl.h
+++ b/include/asm-powerpc/systbl.h
@@ -304,3 +304,4 @@ SYSCALL_SPU(fchmodat)
 SYSCALL_SPU(faccessat)
 COMPAT_SYS_SPU(get_robust_list)
 COMPAT_SYS_SPU(set_robust_list)
+COMPAT_SYS(move_pages)
diff --git a/include/asm-powerpc/unistd.h b/include/asm-powerpc/unistd.h
index 464a48c..b07d91c 100644
--- a/include/asm-powerpc/unistd.h
+++ b/include/asm-powerpc/unistd.h
@@ -323,10 +323,11 @@
 #define __NR_faccessat		298
 #define __NR_get_robust_list	299
 #define __NR_set_robust_list	300
+#define __NR_move_pages		301
 
 #ifdef __KERNEL__
 
-#define __NR_syscalls		301
+#define __NR_syscalls		302
 
 #define __NR__exit __NR_exit
 #define NR_syscalls	__NR_syscalls
-- 
1.4.3.3

^ permalink raw reply related

* Re: [PATCH 8/16] powerpc: add ps3 platform hvcalls
From: Geoff Levand @ 2006-11-13  3:52 UTC (permalink / raw)
  To: Arnd Bergmann; +Cc: linuxppc-dev, Paul Mackerras
In-Reply-To: <200611110313.40940.arnd@arndb.de>

Arnd Bergmann wrote:
> On Friday 10 November 2006 21:02, Geoff Levand wrote:
>> Adds the ps3pf hvcalls.
>> 
>> Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com>
> 
> This one reminds of the inline hcall abstraction layer I did
> some time ago. The implementation in your patch is a lot
> less elegant than both the pseries in its current incarnation
> and the one that I did (IMHO). Any opinions on how we should
> proceed here?


I wanted to do some cleanup here, but Ben suggested to wait until
this was released publicly.  

I would like to have full function declarations that would be ctags
parable, and inline docs of all the lv1 call arguments.  With the
current implementation there is no way to understand many of the
arguments.  Another is to preserve the inline wrapper, or have some
other mechanism that allows call instrumentation.  This is old code
done by someone else, I have no affection for it.


> I can dig out my patch again in the version I did for the
> ps3 hypervisor, if there is demand, or I could help moving
> over so code that is more like the pseries one. Unfortunately
> the calling conventions are very different from pseries 
> (the hcall number is passed in r11, not in one of the argument
> registers), so that would not be as nice as Anton's implementation.


If you have something, I would like to see it.

-Geoff

^ permalink raw reply

* Re: [PATCH 14/16] powerpc: add ps3 platform OS params support
From: Michael Ellerman @ 2006-11-13  4:02 UTC (permalink / raw)
  To: Geoff Levand; +Cc: linuxppc-dev, Paul Mackerras
In-Reply-To: <4557E45C.10703@am.sony.com>

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

On Sun, 2006-11-12 at 19:19 -0800, Geoff Levand wrote:
> > Is it an offset (from something) or a segment number?
> > 
> >> + * @ldr_format: ldr_format flag.
> >> + * @ldr_size: Size of bootloader image in bytes.
> > 
> > If these three all describe the same thing, the bootloader, it'd be good
> > if the names were similar, eg: bootloader_offset, bootloader_format,
> > bootloader_size.
> 
> 
> These names came from the docs.  I think it would be best to keep them the
> same to avoid confusion.

I'm not sure I like that argument, if we followed it throughout the
kernel we'd have one unholy mess, but I'm not that fussed.

> 
> It is not so convenient to view, but the other os area is documented in the
> iso image CELL-Linux-CL_20061110-ADDON.iso at
> http://ftp.uk.linux.org/pub/linux/Sony-PS3/.

Any chance we can get that in some sort of non-insane format? Like a
PDF? :)
 
> >> +static int __init verify_header(const struct header *header)
> >> +{
> >> +	if (memcmp(header->magic_num, "cell_ext_os_area", 16)) {
> >> +		pr_debug("%s:%d magic_num failed\n", __func__, __LINE__);
> >> +		return -1;
> >> +	}
> >> +
> >> +	if (header->hdr_version != 1) {
> >> +		pr_debug("%s:%d hdr_version failed\n", __func__, __LINE__);
> >> +		return -1;
> >> +	}
> > 
> > Is version 2 not going to be backward compatible? Could it be >= 1 ?
> 
> 
> I have absolutely no clue what the next version number will be, nor the
> compatibility, etc.  I'll set this when the version changes.

Except you'll have trouble changing it on the installed base of millions
of PS3s running Linux :) - At the moment if firmware bump the version on
you, you've got an unbootable system until the user does a kernel
upgrade. But it's your baby.

> 
> 
> >> +	dump_header(header);
> >> +	dump_params(params);
> >> +
> >> +	os_params.rtc_diff = params->rtc_diff;
> >> +	os_params.av_multi_out = params->av_multi_out;
> >> +	if (0) { /* currently not used */
> > 
> > Why not?
> 
> 
> The drivers aren't ported yet.  I suppose I could take this out though.

Not fussed, but if you leave it in, expand the comment so no one else
needs to ask :)

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 6/16] cell: abstract spu management routines
From: Michael Ellerman @ 2006-11-13  4:11 UTC (permalink / raw)
  To: Geoff Levand; +Cc: linuxppc-dev, Paul Mackerras, Arnd Bergmann
In-Reply-To: <4554DA9C.9040102@am.sony.com>

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

On Fri, 2006-11-10 at 12:01 -0800, Geoff Levand wrote:
> This adds a platform specific spu management abstraction and the coresponding
> routines to support the IBM Cell Blade.  It also removes the hypervisor only
> resources that were included in struct spu.
> 
> Three new platform specific routines are introduced, spu_enumerate_spus(),
> spu_create_spu() and spu_destroy_spu().  The underlining design uses a new
> type, struct spu_management_ops, to hold function pointers that the platform
> setup code is expected to initialize to instances appropriate to that platform.
> 
> For the IBM Cell Blade support, I put the hypervisor only resources that were
> in struct spu into a platform specific data structure struct spu_pdata.

As far as I can see you haven't posted your HV-backed management ops, is
that right?

Why can't your PS3 platform code fake-up device nodes for SPUs? It seems
that would simplify this quite a lot.

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 6/16] cell: abstract spu management routines
From: Geoff Levand @ 2006-11-13  4:34 UTC (permalink / raw)
  To: michael; +Cc: linuxppc-dev, Paul Mackerras, Arnd Bergmann
In-Reply-To: <1163391081.7410.65.camel@localhost.localdomain>

Michael Ellerman wrote:
> On Fri, 2006-11-10 at 12:01 -0800, Geoff Levand wrote:
>> This adds a platform specific spu management abstraction and the coresponding
>> routines to support the IBM Cell Blade.  It also removes the hypervisor only
>> resources that were included in struct spu.
>> 
>> Three new platform specific routines are introduced, spu_enumerate_spus(),
>> spu_create_spu() and spu_destroy_spu().  The underlining design uses a new
>> type, struct spu_management_ops, to hold function pointers that the platform
>> setup code is expected to initialize to instances appropriate to that platform.
>> 
>> For the IBM Cell Blade support, I put the hypervisor only resources that were
>> in struct spu into a platform specific data structure struct spu_pdata.
> 
> As far as I can see you haven't posted your HV-backed management ops, is
> that right?


Yes, that is in '[PATCH 15/16] cell: add ps3 platform spu support' posted
with the other ps3pf patches.


> Why can't your PS3 platform code fake-up device nodes for SPUs? It seems
> that would simplify this quite a lot.


Seems like a hack to me.  My concern is that I just have to keep adding some
extra hack for every new spu feature that comes out.  I would prefer to make
a proper design from the start, but if anyone can be more convincing I am
open to suggestions.

-Geoff

^ permalink raw reply

* Re: [PATCH 14/16] powerpc: add ps3 platform OS params support
From: Geoff Levand @ 2006-11-13  4:45 UTC (permalink / raw)
  To: michael; +Cc: linuxppc-dev, Paul Mackerras
In-Reply-To: <1163390536.7410.61.camel@localhost.localdomain>

Michael Ellerman wrote:
>> It is not so convenient to view, but the other os area is documented in the
>> iso image CELL-Linux-CL_20061110-ADDON.iso at
>> http://ftp.uk.linux.org/pub/linux/Sony-PS3/.
> 
> Any chance we can get that in some sort of non-insane format? Like a
> PDF? :)

OK, I put it here for you:

 http://67.117.136.164/pub/cell/linux-20061110-docs/BootLinuxAndInstallation.html

The coverage of the other os area is not so good, but more complete
documentation should be provided sometime in the future.


>> >> +	if (header->hdr_version != 1) {
>> >> +		pr_debug("%s:%d hdr_version failed\n", __func__, __LINE__);
>> >> +		return -1;
>> >> +	}
>> > 
>> > Is version 2 not going to be backward compatible? Could it be >= 1 ?
>> 
>> 
>> I have absolutely no clue what the next version number will be, nor the
>> compatibility, etc.  I'll set this when the version changes.
> 
> Except you'll have trouble changing it on the installed base of millions
> of PS3s running Linux :) - At the moment if firmware bump the version on
> you, you've got an unbootable system until the user does a kernel
> upgrade. But it's your baby.

Good point.  Actually, you'll just have a little inaccuracy in your clock
for this version, but I'll change it.


-Geoff

^ permalink raw reply

* [RFC] make sys_pciconfig_iobase lethal to calling processes
From: Benjamin Herrenschmidt @ 2006-11-13  5:20 UTC (permalink / raw)
  To: Linux Kernel list, linuxppc-dev list

Hi !

I'm fixing various bugs (oops... some are even my faul) in powerpc's
implementation of mmap of PCI resources via /proc and /sys. While there,
I noticed that we have some nasty issues with the sys_pciconfig_iobase
syscall.

We introduced that syscall in a distant past to let apps like X retreive
the physical address at which they could find PCI IOs when
using /dev/mem to access PCI cards.

There are several problems with it however, though the main one is that
it returns that base address as the syscall result, which means it's
limited to 32 bits for 32 bits processes, while on pSeries machines,
among others, PCI sits way above that.

So basically, it really only works for PowerMacs.

The other nasty problem is that the only user I know of (and -please-
let me know asap if you know of anything else using it), X.org, will not
only not test for errors from that syscall (and happily try to mmap -1 +
BAR value via /dev/mem and whack that), but also, 32 bits X on 64 bits
machine will truncate the top 32 bits of PCI addresses and then try to
access them via /dev/mem...

So basically, this syscall being called by a 32 bits process, means
that:

 - if the PCI host bridge has the IO and MMIO below 32 bits, there is a
chance that things will work, so proceed as before (+/- a bug where we
might not get the right bus but I'm trying to fix that).

 - if the PCI host bridge has IO or MMIO above 32 bits, then there is no
way the calling process will work since we'll return a truncated value.
In fact, we know that (at least I think) the only caller is X and it
will do very bad things to /dev/mem and ignore errors. So the sanest
things we can do in this case is to kill the calling process with
force_sig (what about SIGSEGV for that ?). If we don't do that, we'll
end up with random levels of memory corruption due to X whacking things
in /dev/mem at completely wrong addresses.

If the caller is a 64 bits process, things can work so we don't do
anything special. The syscall is deprecated anyway, so once X gets fixed
to properly use /sysfs or /proc, it won't use it anymore and thus won't
trigger that killswitch.

Any objection ? Does anybody knows of another legitimate user of that
syscall that might deserve to survive calling it in 32 bits mode on a 64
bits machine with PCI IO or MMIO above 32 bits ?

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