LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* Re: [patch 2/4] powerpc: add i2c pins to dts and board setup
From: Scott Wood @ 2008-05-14 23:25 UTC (permalink / raw)
  To: akpm; +Cc: linuxppc-dev, paulus
In-Reply-To: <200805142312.m4ENCrIb026259@imap1.linux-foundation.org>

akpm@linux-foundation.org wrote:
> From: Jochen Friedrich <jochen@scram.de>
> 
> Initialize I2C pins on boards with CPM1/CPM2 controllers.
> 
> Signed-off-by: Jochen Friedrich <jochen@scram.de>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
> ---
> 
>  arch/powerpc/boot/dts/mpc8272ads.dts         |   10 ++++++++++
>  arch/powerpc/boot/dts/mpc866ads.dts          |   10 ++++++++++
>  arch/powerpc/boot/dts/mpc885ads.dts          |   10 ++++++++++
>  arch/powerpc/platforms/82xx/mpc8272_ads.c    |    4 ++++
>  arch/powerpc/platforms/8xx/mpc86xads_setup.c |    4 ++++
>  arch/powerpc/platforms/8xx/mpc885ads_setup.c |    3 +++
>  6 files changed, 41 insertions(+)
> 
> diff -puN arch/powerpc/boot/dts/mpc8272ads.dts~powerpc-add-i2c-pins-to-dts-and-board-setup arch/powerpc/boot/dts/mpc8272ads.dts
> --- a/arch/powerpc/boot/dts/mpc8272ads.dts~powerpc-add-i2c-pins-to-dts-and-board-setup
> +++ a/arch/powerpc/boot/dts/mpc8272ads.dts
> @@ -217,6 +217,16 @@
>  				linux,network-index = <1>;
>  				fsl,cpm-command = <0x16200300>;
>  			};
> +
> +			i2c@11860 {
> +				compatible = "fsl,mpc8272-i2c",
> +					     "fsl,cpm2-i2c",
> +					     "fsl,cpm-i2c";
> +				reg = <11860 20 8afc 2>;
> +				interrupts = <1 8>;
> +				interrupt-parent = <&PIC>;
> +				fsl,cpm-command = <29600000>;
> +			};

As I pointed out earlier, this patch is sticking dts-v0 style constants 
into a dts-v1 file.  It will not work.

We also need to document CPM2 i2c as an exception to the normal 
interpretation of the second resource for a CPM device in 
booting-without-of.txt.

-Scott

^ permalink raw reply

* Re: [patch 1/1] fsldma: the MPC8377MDS board device tree node for fsldma driver
From: Scott Wood @ 2008-05-14 23:28 UTC (permalink / raw)
  To: akpm; +Cc: shannon.nelson, linuxppc-dev, paulus, galak, dan.j.williams,
	wei.zhang
In-Reply-To: <200805142317.m4ENHNlm026461@imap1.linux-foundation.org>

akpm@linux-foundation.org wrote:
> From: Zhang Wei <wei.zhang@freescale.com>
> 
> The fsldma driver is tested on MPC8377MDS board.  The patch adds fsldma driver
> support into MPC8377MDS device tree.
> 
> Signed-off-by: Zhang Wei <wei.zhang@freescale.com>
> Cc: "Nelson, Shannon" <shannon.nelson@intel.com>
> Cc: Dan Williams <dan.j.williams@intel.com>
> Cc: Kumar Gala <galak@gate.crashing.org>
> Cc: Paul Mackerras <paulus@samba.org>
> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
> ---
> 
>  arch/powerpc/boot/dts/mpc8377_mds.dts |   27 ++++++++++++++++++++++++
>  1 file changed, 27 insertions(+)
> 
> diff -puN arch/powerpc/boot/dts/mpc8377_mds.dts~fsldma-the-mpc8377mds-board-device-tree-node-for-fsldma-driver arch/powerpc/boot/dts/mpc8377_mds.dts
> --- a/arch/powerpc/boot/dts/mpc8377_mds.dts~fsldma-the-mpc8377mds-board-device-tree-node-for-fsldma-driver
> +++ a/arch/powerpc/boot/dts/mpc8377_mds.dts
> @@ -295,6 +295,33 @@
>  			};
>  		};
>  
> +		dma@82a8 {
> +			#address-cells = <1>;
> +			#size-cells = <1>;
> +			compatible = "fsl,mpc8349-dma";
> +			reg = <0x82a8 4>;
> +			ranges = <0 0x8100 0x1a8>;
> +			interrupt-parent = <&ipic>;
> +			interrupts = <0x47 8>;
> +			cell-index = <0>;
> +			dma-channel@0 {
> +				compatible = "fsl,mpc8349-dma-channel";
> +				reg = <0 0x80>;
> +			};
> +			dma-channel@80 {
> +				compatible = "fsl,mpc8349-dma-channel";
> +				reg = <0x80 0x80>;
> +			};
> +			dma-channel@100 {
> +				compatible = "fsl,mpc8349-dma-channel";
> +				reg = <0x100 0x80>;
> +			};
> +			dma-channel@180 {
> +				compatible = "fsl,mpc8349-dma-channel";
> +				reg = <0x180 0x28>;
> +			};

According to booting-without-of.txt, the interrupts property should be 
repeated in each channel.  The driver also needs to be fixed to remember 
whether it registered a DMA-block-level interrupt handler already, and 
not try to register a channel interrupt.

-Scott

^ permalink raw reply

* Patches added to powerpc.git powerpc-next branch
From: Paul Mackerras @ 2008-05-14 23:31 UTC (permalink / raw)
  To: linuxppc-dev

I have added the following patches to the powerpc-next and master
branches of the powerpc.git repository.  This includes commits pulled
from Kumar's tree.

Paul.

Andy Fleming (2):
      [POWERPC] 85xx: Add 8568 PHY workarounds to board code
      [POWERPC] 85xx: Fix some sparse warnings for 85xx MDS

Anton Vorontsov (3):
      [POWERPC] 86xx: mpc8610_hpcd: use ULI526X driver for on-board ethernet
      [POWERPC] 86xx: mpc8610_hpcd: add support for NOR and NAND flashes
      [POWERPC] 86xx: mpc8610_hpcd: fix second serial port

Becky Bruce (1):
      [POWERPC] Delete unused fec_8xx net driver

Jeremy McNicoll (1):
      [POWERPC] 85xx: SBC8548 - Add flash support and HW Rev reporting

Kumar Gala (1):
      [POWERPC] Set lower flag bits in regs->trap to indicate debug level exception

Michael Ellerman (12):
      [POWERPC] Move declaration of init_bootmem_done into system.h
      [POWERPC] Fix sparse warnings in arch/powerpc/mm
      [POWERPC] Move declaration of tce variables into mmu-hash64.h
      [POWERPC] Remove duplicate variable definitions in mm/tlb_64.c
      [POWERPC] sysdev/mpic_msi.c should include sysdev/mpic.h
      [POWERPC] Add a declaration for xmon()
      [POWERPC] Move xmon_irq() declaration into xmon.h
      [POWERPC] Fix sparse warnings in xmon.c
      [POWERPC] Make cpus_in_xmon static and remove extern mess from hvc_console.c
      [POWERPC] Fix sparse warnings in arch/powerpc/kernel
      [POWERPC] pseries/firmware.c should include pseries/pseries.h
      [POWERPC] Fix sparse warnings in arch/powerpc/platforms/pseries

Olaf Hering (1):
      [POWERPC] Create modalias file in sysfs for of_platform bus

Remi Machet (1):
      [POWERPC] Create of_buses for MV64x60 devices

Roel Kluin (2):
      [POWERPC] mpic_pasemi_msi: Failed allocation unnoticed
      [POWERPC] mpic_u3msi: Failed allocation unnoticed

Roland McGrath (1):
      [POWERPC] Define and use TLF_RESTORE_SIGMASK

Zhang Wei (1):
      [POWERPC] 83xx: Enable DMA engine on the MPC8377 MDS board.

^ permalink raw reply

* Re: [patch 1/1] fsldma: the MPC8377MDS board device tree node for fsldma driver
From: Dan Williams @ 2008-05-14 23:36 UTC (permalink / raw)
  To: Scott Wood
  Cc: Nelson, Shannon, linuxppc-dev, paulus, galak, akpm, leoli,
	wei.zhang
In-Reply-To: <482B7588.1010201@freescale.com>

[adding Li Yang (new fsldma maintainer) to the cc]

On Wed, 2008-05-14 at 16:28 -0700, Scott Wood wrote:
> akpm@linux-foundation.org wrote:
> > From: Zhang Wei <wei.zhang@freescale.com>
> >
> > The fsldma driver is tested on MPC8377MDS board.  The patch adds fsldma driver
> > support into MPC8377MDS device tree.
> >
> > Signed-off-by: Zhang Wei <wei.zhang@freescale.com>
> > Cc: "Nelson, Shannon" <shannon.nelson@intel.com>
> > Cc: Dan Williams <dan.j.williams@intel.com>
> > Cc: Kumar Gala <galak@gate.crashing.org>
> > Cc: Paul Mackerras <paulus@samba.org>
> > Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> > Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
> > ---
> >
> >  arch/powerpc/boot/dts/mpc8377_mds.dts |   27 ++++++++++++++++++++++++
> >  1 file changed, 27 insertions(+)
> >
> > diff -puN arch/powerpc/boot/dts/mpc8377_mds.dts~fsldma-the-mpc8377mds-board-device-tree-node-for-fsldma-driver arch/powerpc/boot/dts/mpc8377_mds.dts
> > --- a/arch/powerpc/boot/dts/mpc8377_mds.dts~fsldma-the-mpc8377mds-board-device-tree-node-for-fsldma-driver
> > +++ a/arch/powerpc/boot/dts/mpc8377_mds.dts
> > @@ -295,6 +295,33 @@
> >                       };
> >               };
> > 
> > +             dma@82a8 {
> > +                     #address-cells = <1>;
> > +                     #size-cells = <1>;
> > +                     compatible = "fsl,mpc8349-dma";
> > +                     reg = <0x82a8 4>;
> > +                     ranges = <0 0x8100 0x1a8>;
> > +                     interrupt-parent = <&ipic>;
> > +                     interrupts = <0x47 8>;
> > +                     cell-index = <0>;
> > +                     dma-channel@0 {
> > +                             compatible = "fsl,mpc8349-dma-channel";
> > +                             reg = <0 0x80>;
> > +                     };
> > +                     dma-channel@80 {
> > +                             compatible = "fsl,mpc8349-dma-channel";
> > +                             reg = <0x80 0x80>;
> > +                     };
> > +                     dma-channel@100 {
> > +                             compatible = "fsl,mpc8349-dma-channel";
> > +                             reg = <0x100 0x80>;
> > +                     };
> > +                     dma-channel@180 {
> > +                             compatible = "fsl,mpc8349-dma-channel";
> > +                             reg = <0x180 0x28>;
> > +                     };
> 
> According to booting-without-of.txt, the interrupts property should be
> repeated in each channel.  The driver also needs to be fixed to remember
> whether it registered a DMA-block-level interrupt handler already, and
> not try to register a channel interrupt.
> 
> -Scott
> 
> 

^ permalink raw reply

* [PATCH] list_for_each_rcu must die: networking
From: Paul E. McKenney @ 2008-05-15  0:16 UTC (permalink / raw)
  To: linux-kernel
  Cc: shemminger, kamalesh, linuxppc-dev, adobriyan, akpm, balbir,
	davem, sri
In-Reply-To: <20080424033849.GA4401@linux.vnet.ibm.com>

All uses of list_for_each_rcu() can be profitably replaced by the
easier-to-use list_for_each_entry_rcu().  This patch makes this change
for networking, in preparation for removing the list_for_each_rcu()
API entirely.

Updated to remove the two now-unused variables as noted by Dave Miller,
and also to fix my bonehead error detected by Kamalesh Babulal and
Alexey Dobriyan.  It now passes LTP on POWER.  And also has valid SOB.
Some days it just doesn't pay to get out of bed...

Acked-by: David S. Miller <davem@davemloft.net> (lkml.org/lkml/2008/4/23/448)
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
---

 802/psnap.c     |    4 +---
 ipv4/af_inet.c  |    9 +++------
 ipv6/af_inet6.c |    9 +++------
 3 files changed, 7 insertions(+), 15 deletions(-)

diff -urpNa -X dontdiff linux-2.6.26-rc2/net/802/psnap.c linux-2.6.26-rc2-lfer-net/net/802/psnap.c
--- linux-2.6.26-rc2/net/802/psnap.c	2008-04-16 19:49:44.000000000 -0700
+++ linux-2.6.26-rc2-lfer-net/net/802/psnap.c	2008-05-14 13:38:13.000000000 -0700
@@ -30,11 +30,9 @@ static struct llc_sap *snap_sap;
  */
 static struct datalink_proto *find_snap_client(unsigned char *desc)
 {
-	struct list_head *entry;
 	struct datalink_proto *proto = NULL, *p;
 
-	list_for_each_rcu(entry, &snap_list) {
-		p = list_entry(entry, struct datalink_proto, node);
+	list_for_each_entry_rcu(p, &snap_list, node) {
 		if (!memcmp(p->type, desc, 5)) {
 			proto = p;
 			break;
diff -urpNa -X dontdiff linux-2.6.26-rc2/net/ipv4/af_inet.c linux-2.6.26-rc2-lfer-net/net/ipv4/af_inet.c
--- linux-2.6.26-rc2/net/ipv4/af_inet.c	2008-05-14 13:35:32.000000000 -0700
+++ linux-2.6.26-rc2-lfer-net/net/ipv4/af_inet.c	2008-05-14 13:46:26.000000000 -0700
@@ -267,7 +267,6 @@ static inline int inet_netns_ok(struct n
 static int inet_create(struct net *net, struct socket *sock, int protocol)
 {
 	struct sock *sk;
-	struct list_head *p;
 	struct inet_protosw *answer;
 	struct inet_sock *inet;
 	struct proto *answer_prot;
@@ -284,13 +283,12 @@ static int inet_create(struct net *net, 
 	sock->state = SS_UNCONNECTED;
 
 	/* Look for the requested type/protocol pair. */
-	answer = NULL;
 lookup_protocol:
 	err = -ESOCKTNOSUPPORT;
 	rcu_read_lock();
-	list_for_each_rcu(p, &inetsw[sock->type]) {
-		answer = list_entry(p, struct inet_protosw, list);
+	list_for_each_entry_rcu(answer, &inetsw[sock->type], list) {
 
+		err = 0;
 		/* Check the non-wild match. */
 		if (protocol == answer->protocol) {
 			if (protocol != IPPROTO_IP)
@@ -305,10 +303,9 @@ lookup_protocol:
 				break;
 		}
 		err = -EPROTONOSUPPORT;
-		answer = NULL;
 	}
 
-	if (unlikely(answer == NULL)) {
+	if (unlikely(err)) {
 		if (try_loading_module < 2) {
 			rcu_read_unlock();
 			/*
diff -urpNa -X dontdiff linux-2.6.26-rc2/net/ipv6/af_inet6.c linux-2.6.26-rc2-lfer-net/net/ipv6/af_inet6.c
--- linux-2.6.26-rc2/net/ipv6/af_inet6.c	2008-05-14 13:35:32.000000000 -0700
+++ linux-2.6.26-rc2-lfer-net/net/ipv6/af_inet6.c	2008-05-14 13:45:08.000000000 -0700
@@ -87,7 +87,6 @@ static int inet6_create(struct net *net,
 	struct inet_sock *inet;
 	struct ipv6_pinfo *np;
 	struct sock *sk;
-	struct list_head *p;
 	struct inet_protosw *answer;
 	struct proto *answer_prot;
 	unsigned char answer_flags;
@@ -101,13 +100,12 @@ static int inet6_create(struct net *net,
 		build_ehash_secret();
 
 	/* Look for the requested type/protocol pair. */
-	answer = NULL;
 lookup_protocol:
 	err = -ESOCKTNOSUPPORT;
 	rcu_read_lock();
-	list_for_each_rcu(p, &inetsw6[sock->type]) {
-		answer = list_entry(p, struct inet_protosw, list);
+	list_for_each_entry_rcu(answer, &inetsw6[sock->type], list) {
 
+		err = 0;
 		/* Check the non-wild match. */
 		if (protocol == answer->protocol) {
 			if (protocol != IPPROTO_IP)
@@ -122,10 +120,9 @@ lookup_protocol:
 				break;
 		}
 		err = -EPROTONOSUPPORT;
-		answer = NULL;
 	}
 
-	if (!answer) {
+	if (err) {
 		if (try_loading_module < 2) {
 			rcu_read_unlock();
 			/*

^ permalink raw reply

* Re: [patch 1/4] powerpc: fix for OProfile callgraph for Power 64 bit user apps
From: Michael Ellerman @ 2008-05-15  0:20 UTC (permalink / raw)
  To: akpm; +Cc: linuxppc-dev, cel, paulus, carll
In-Reply-To: <200805142312.m4ENCqLg026256@imap1.linux-foundation.org>

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

On Wed, 2008-05-14 at 16:12 -0700, akpm@linux-foundation.org wrote:
> From: Carl Love <cel@us.ibm.com>
> 
> Fix the 64 bit user code backtrace which currently may hang the system.
> 
> Signed-off-by: Carl Love <carll@us.ibm.com>
> Cc: Maynard Johnson <maynardj@us.ibm.com>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

Hi Carl,

I'm a bit confused by this change ..

> diff -puN arch/powerpc/oprofile/backtrace.c~powerpc-fix-for-oprofile-callgraph-for-power-64-bit-user-apps arch/powerpc/oprofile/backtrace.c
> --- a/arch/powerpc/oprofile/backtrace.c~powerpc-fix-for-oprofile-callgraph-for-power-64-bit-user-apps
> +++ a/arch/powerpc/oprofile/backtrace.c
> @@ -53,19 +53,40 @@ static unsigned int user_getsp32(unsigne
>  #ifdef CONFIG_PPC64
>  static unsigned long user_getsp64(unsigned long sp, int is_first)
>  {
> -	unsigned long stack_frame[3];
> +	unsigned long stk_frm_lr;
> +	unsigned long stk_frm_sp;
> +	unsigned long size;
> +
> +	/* Issue the __copy_from_user_inatomic() third argument currently
> +	 * only takes sizes 1, 2, 4 or 8 bytes.  Don't read more then the
> +	 * first 48 bytes of the stack frame.  That is all that is
> +	 * guaranteed to exist.  Reading more may cause the system to hang.

__copy_from_user_inatomic() accepts any value for n, it just has a
special case for 1, 2, 4 and 8 - but it should still work for other
values.

The old code copied 24 bytes from sp, and the new code copies 8 bytes
from sp and 8 bytes from sp + 16 - so I don't see where the 48 bytes
comes in to it?

Also the comment is a little hard to parse, I think you mean "Issue:
the ..", but I read "Issue" as a verb in that sentence. And "Don't read
more then" should be "than".

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 4/4] spufs: convert nopfn to fault
From: Nick Piggin @ 2008-05-15  0:53 UTC (permalink / raw)
  To: akpm; +Cc: linuxppc-dev, paulus, jk
In-Reply-To: <200805142312.m4ENCtlq026265@imap1.linux-foundation.org>

Thanks for helping out with merging these Andrew. The problem with
this is that these nopfn conversions won't work unless the
BUG_ON is removed from mm/memory.c (patch 1/ that I sent you). So
there is a little dependency chain here. I guess you could send
that patch 1 upstream ASAP, and then let the subsequent non trivial
patches filter up in their own time. I don't know, just a heads up.

On Wed, May 14, 2008 at 04:12:54PM -0700, Andrew Morton wrote:
> From: Nick Piggin <npiggin@suse.de>
> 
> spufs: convert nopfn to fault
> 
> Signed-off-by: Nick Piggin <npiggin@suse.de>
> Acked-by: Jeremy Kerr <jk@ozlabs.org>
> Cc: Paul Mackerras <paulus@samba.org>
> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
> ---
> 
>  arch/powerpc/platforms/cell/spufs/file.c     |   98 ++++++++---------
>  arch/powerpc/platforms/cell/spufs/sputrace.c |    8 -
>  2 files changed, 54 insertions(+), 52 deletions(-)
> 
> diff -puN arch/powerpc/platforms/cell/spufs/file.c~spufs-convert-nopfn-to-fault arch/powerpc/platforms/cell/spufs/file.c
> --- a/arch/powerpc/platforms/cell/spufs/file.c~spufs-convert-nopfn-to-fault
> +++ a/arch/powerpc/platforms/cell/spufs/file.c
> @@ -237,11 +237,13 @@ spufs_mem_write(struct file *file, const
>  	return size;
>  }
>  
> -static unsigned long spufs_mem_mmap_nopfn(struct vm_area_struct *vma,
> -					  unsigned long address)
> +static int
> +spufs_mem_mmap_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
>  {
>  	struct spu_context *ctx	= vma->vm_file->private_data;
> -	unsigned long pfn, offset, addr0 = address;
> +	unsigned long address = (unsigned long)vmf->virtual_address;
> +	unsigned long pfn, offset;
> +
>  #ifdef CONFIG_SPU_FS_64K_LS
>  	struct spu_state *csa = &ctx->csa;
>  	int psize;
> @@ -259,15 +261,15 @@ static unsigned long spufs_mem_mmap_nopf
>  	}
>  #endif /* CONFIG_SPU_FS_64K_LS */
>  
> -	offset = (address - vma->vm_start) + (vma->vm_pgoff << PAGE_SHIFT);
> +	offset = vmf->pgoff << PAGE_SHIFT;
>  	if (offset >= LS_SIZE)
> -		return NOPFN_SIGBUS;
> +		return VM_FAULT_SIGBUS;
>  
> -	pr_debug("spufs_mem_mmap_nopfn address=0x%lx -> 0x%lx, offset=0x%lx\n",
> -		 addr0, address, offset);
> +	pr_debug("spufs_mem_mmap_fault address=0x%lx, offset=0x%lx\n",
> +			address, offset);
>  
>  	if (spu_acquire(ctx))
> -		return NOPFN_REFAULT;
> +		return VM_FAULT_NOPAGE;
>  
>  	if (ctx->state == SPU_STATE_SAVED) {
>  		vma->vm_page_prot = __pgprot(pgprot_val(vma->vm_page_prot)
> @@ -282,12 +284,12 @@ static unsigned long spufs_mem_mmap_nopf
>  
>  	spu_release(ctx);
>  
> -	return NOPFN_REFAULT;
> +	return VM_FAULT_NOPAGE;
>  }
>  
>  
>  static struct vm_operations_struct spufs_mem_mmap_vmops = {
> -	.nopfn = spufs_mem_mmap_nopfn,
> +	.fault = spufs_mem_mmap_fault,
>  };
>  
>  static int spufs_mem_mmap(struct file *file, struct vm_area_struct *vma)
> @@ -350,20 +352,19 @@ static const struct file_operations spuf
>  #endif
>  };
>  
> -static unsigned long spufs_ps_nopfn(struct vm_area_struct *vma,
> -				    unsigned long address,
> +static int spufs_ps_fault(struct vm_area_struct *vma,
> +				    struct vm_fault *vmf,
>  				    unsigned long ps_offs,
>  				    unsigned long ps_size)
>  {
>  	struct spu_context *ctx = vma->vm_file->private_data;
> -	unsigned long area, offset = address - vma->vm_start;
> +	unsigned long area, offset = vmf->pgoff << PAGE_SHIFT;
>  	int ret = 0;
>  
> -	spu_context_nospu_trace(spufs_ps_nopfn__enter, ctx);
> +	spu_context_nospu_trace(spufs_ps_fault__enter, ctx);
>  
> -	offset += vma->vm_pgoff << PAGE_SHIFT;
>  	if (offset >= ps_size)
> -		return NOPFN_SIGBUS;
> +		return VM_FAULT_SIGBUS;
>  
>  	/*
>  	 * Because we release the mmap_sem, the context may be destroyed while
> @@ -377,7 +378,7 @@ static unsigned long spufs_ps_nopfn(stru
>  	 * pages to hand out to the user, but we don't want to wait
>  	 * with the mmap_sem held.
>  	 * It is possible to drop the mmap_sem here, but then we need
> -	 * to return NOPFN_REFAULT because the mappings may have
> +	 * to return VM_FAULT_NOPAGE because the mappings may have
>  	 * hanged.
>  	 */
>  	if (spu_acquire(ctx))
> @@ -385,14 +386,15 @@ static unsigned long spufs_ps_nopfn(stru
>  
>  	if (ctx->state == SPU_STATE_SAVED) {
>  		up_read(&current->mm->mmap_sem);
> -		spu_context_nospu_trace(spufs_ps_nopfn__sleep, ctx);
> +		spu_context_nospu_trace(spufs_ps_fault__sleep, ctx);
>  		ret = spufs_wait(ctx->run_wq, ctx->state == SPU_STATE_RUNNABLE);
> -		spu_context_trace(spufs_ps_nopfn__wake, ctx, ctx->spu);
> +		spu_context_trace(spufs_ps_fault__wake, ctx, ctx->spu);
>  		down_read(&current->mm->mmap_sem);
>  	} else {
>  		area = ctx->spu->problem_phys + ps_offs;
> -		vm_insert_pfn(vma, address, (area + offset) >> PAGE_SHIFT);
> -		spu_context_trace(spufs_ps_nopfn__insert, ctx, ctx->spu);
> +		vm_insert_pfn(vma, (unsigned long)vmf->virtual_address,
> +					(area + offset) >> PAGE_SHIFT);
> +		spu_context_trace(spufs_ps_fault__insert, ctx, ctx->spu);
>  	}
>  
>  	if (!ret)
> @@ -400,18 +402,18 @@ static unsigned long spufs_ps_nopfn(stru
>  
>  refault:
>  	put_spu_context(ctx);
> -	return NOPFN_REFAULT;
> +	return VM_FAULT_NOPAGE;
>  }
>  
>  #if SPUFS_MMAP_4K
> -static unsigned long spufs_cntl_mmap_nopfn(struct vm_area_struct *vma,
> -					   unsigned long address)
> +static int spufs_cntl_mmap_fault(struct vm_area_struct *vma,
> +					   struct vm_fault *vmf)
>  {
> -	return spufs_ps_nopfn(vma, address, 0x4000, 0x1000);
> +	return spufs_ps_fault(vma, vmf, 0x4000, 0x1000);
>  }
>  
>  static struct vm_operations_struct spufs_cntl_mmap_vmops = {
> -	.nopfn = spufs_cntl_mmap_nopfn,
> +	.fault = spufs_cntl_mmap_fault,
>  };
>  
>  /*
> @@ -1096,23 +1098,23 @@ static ssize_t spufs_signal1_write(struc
>  	return 4;
>  }
>  
> -static unsigned long spufs_signal1_mmap_nopfn(struct vm_area_struct *vma,
> -					      unsigned long address)
> +static int
> +spufs_signal1_mmap_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
>  {
>  #if PAGE_SIZE == 0x1000
> -	return spufs_ps_nopfn(vma, address, 0x14000, 0x1000);
> +	return spufs_ps_fault(vma, vmf, 0x14000, 0x1000);
>  #elif PAGE_SIZE == 0x10000
>  	/* For 64k pages, both signal1 and signal2 can be used to mmap the whole
>  	 * signal 1 and 2 area
>  	 */
> -	return spufs_ps_nopfn(vma, address, 0x10000, 0x10000);
> +	return spufs_ps_fault(vma, vmf, 0x10000, 0x10000);
>  #else
>  #error unsupported page size
>  #endif
>  }
>  
>  static struct vm_operations_struct spufs_signal1_mmap_vmops = {
> -	.nopfn = spufs_signal1_mmap_nopfn,
> +	.fault = spufs_signal1_mmap_fault,
>  };
>  
>  static int spufs_signal1_mmap(struct file *file, struct vm_area_struct *vma)
> @@ -1233,23 +1235,23 @@ static ssize_t spufs_signal2_write(struc
>  }
>  
>  #if SPUFS_MMAP_4K
> -static unsigned long spufs_signal2_mmap_nopfn(struct vm_area_struct *vma,
> -					      unsigned long address)
> +static int
> +spufs_signal2_mmap_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
>  {
>  #if PAGE_SIZE == 0x1000
> -	return spufs_ps_nopfn(vma, address, 0x1c000, 0x1000);
> +	return spufs_ps_fault(vma, vmf, 0x1c000, 0x1000);
>  #elif PAGE_SIZE == 0x10000
>  	/* For 64k pages, both signal1 and signal2 can be used to mmap the whole
>  	 * signal 1 and 2 area
>  	 */
> -	return spufs_ps_nopfn(vma, address, 0x10000, 0x10000);
> +	return spufs_ps_fault(vma, vmf, 0x10000, 0x10000);
>  #else
>  #error unsupported page size
>  #endif
>  }
>  
>  static struct vm_operations_struct spufs_signal2_mmap_vmops = {
> -	.nopfn = spufs_signal2_mmap_nopfn,
> +	.fault = spufs_signal2_mmap_fault,
>  };
>  
>  static int spufs_signal2_mmap(struct file *file, struct vm_area_struct *vma)
> @@ -1361,14 +1363,14 @@ DEFINE_SPUFS_ATTRIBUTE(spufs_signal2_typ
>  		       spufs_signal2_type_set, "%llu\n", SPU_ATTR_ACQUIRE);
>  
>  #if SPUFS_MMAP_4K
> -static unsigned long spufs_mss_mmap_nopfn(struct vm_area_struct *vma,
> -					  unsigned long address)
> +static int
> +spufs_mss_mmap_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
>  {
> -	return spufs_ps_nopfn(vma, address, 0x0000, 0x1000);
> +	return spufs_ps_fault(vma, vmf, 0x0000, 0x1000);
>  }
>  
>  static struct vm_operations_struct spufs_mss_mmap_vmops = {
> -	.nopfn = spufs_mss_mmap_nopfn,
> +	.fault = spufs_mss_mmap_fault,
>  };
>  
>  /*
> @@ -1423,14 +1425,14 @@ static const struct file_operations spuf
>  	.mmap	 = spufs_mss_mmap,
>  };
>  
> -static unsigned long spufs_psmap_mmap_nopfn(struct vm_area_struct *vma,
> -					    unsigned long address)
> +static int
> +spufs_psmap_mmap_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
>  {
> -	return spufs_ps_nopfn(vma, address, 0x0000, 0x20000);
> +	return spufs_ps_fault(vma, vmf, 0x0000, 0x20000);
>  }
>  
>  static struct vm_operations_struct spufs_psmap_mmap_vmops = {
> -	.nopfn = spufs_psmap_mmap_nopfn,
> +	.fault = spufs_psmap_mmap_fault,
>  };
>  
>  /*
> @@ -1483,14 +1485,14 @@ static const struct file_operations spuf
>  
>  
>  #if SPUFS_MMAP_4K
> -static unsigned long spufs_mfc_mmap_nopfn(struct vm_area_struct *vma,
> -					  unsigned long address)
> +static int
> +spufs_mfc_mmap_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
>  {
> -	return spufs_ps_nopfn(vma, address, 0x3000, 0x1000);
> +	return spufs_ps_fault(vma, vmf, 0x3000, 0x1000);
>  }
>  
>  static struct vm_operations_struct spufs_mfc_mmap_vmops = {
> -	.nopfn = spufs_mfc_mmap_nopfn,
> +	.fault = spufs_mfc_mmap_fault,
>  };
>  
>  /*
> diff -puN arch/powerpc/platforms/cell/spufs/sputrace.c~spufs-convert-nopfn-to-fault arch/powerpc/platforms/cell/spufs/sputrace.c
> --- a/arch/powerpc/platforms/cell/spufs/sputrace.c~spufs-convert-nopfn-to-fault
> +++ a/arch/powerpc/platforms/cell/spufs/sputrace.c
> @@ -182,10 +182,10 @@ struct spu_probe spu_probes[] = {
>  	{ "spu_yield__enter", "ctx %p", spu_context_nospu_event },
>  	{ "spu_deactivate__enter", "ctx %p", spu_context_nospu_event },
>  	{ "__spu_deactivate__unload", "ctx %p spu %p", spu_context_event },
> -	{ "spufs_ps_nopfn__enter", "ctx %p", spu_context_nospu_event },
> -	{ "spufs_ps_nopfn__sleep", "ctx %p", spu_context_nospu_event },
> -	{ "spufs_ps_nopfn__wake", "ctx %p spu %p", spu_context_event },
> -	{ "spufs_ps_nopfn__insert", "ctx %p spu %p", spu_context_event },
> +	{ "spufs_ps_fault__enter", "ctx %p", spu_context_nospu_event },
> +	{ "spufs_ps_fault__sleep", "ctx %p", spu_context_nospu_event },
> +	{ "spufs_ps_fault__wake", "ctx %p spu %p", spu_context_event },
> +	{ "spufs_ps_fault__insert", "ctx %p spu %p", spu_context_event },
>  	{ "spu_acquire_saved__enter", "ctx %p", spu_context_nospu_event },
>  	{ "destroy_spu_context__enter", "ctx %p", spu_context_nospu_event },
>  	{ "spufs_stop_callback__enter", "ctx %p spu %p", spu_context_event },
> _

^ permalink raw reply

* Re: [patch 4/4] spufs: convert nopfn to fault
From: Andrew Morton @ 2008-05-15  1:30 UTC (permalink / raw)
  To: Nick Piggin; +Cc: linuxppc-dev, paulus, jk
In-Reply-To: <20080515005305.GD30448@wotan.suse.de>

On Thu, 15 May 2008 02:53:05 +0200 Nick Piggin <npiggin@suse.de> wrote:

> Thanks for helping out with merging these Andrew. The problem with
> this is that these nopfn conversions won't work unless the
> BUG_ON is removed from mm/memory.c (patch 1/ that I sent you).

oh.

> So
> there is a little dependency chain here. I guess you could send
> that patch 1 upstream ASAP, and then let the subsequent non trivial
> patches filter up in their own time. I don't know, just a heads up.

OK, I'll include mm-allow-pfnmap-faults.patch in the next linuswards
batch.

^ permalink raw reply

* Re: How to test the DDR memory with burst visit mode?
From: Frank @ 2008-05-15  2:13 UTC (permalink / raw)
  To: ¹ù¾¢, linuxppc-embedded
In-Reply-To: <410764342.21662@tsinghua.org.cn>


--- ¹ù¾¢ <guojin02@tsinghua.org.cn> wrote:

> Hi,friends,
>    I designed my MPC8360E board with 1GBytes DDR-1 memory, I
> built two demo
> boards, one is 533/266/400, the other is 660/330/400. The
> lower frequancy board is
> no problem for our program, but the higher frequency board is
> always problem about
> the data transmit on ethernet. 
>    I want to test 1GBytes DDR-1 memory, I want to know whether
> or not the DDR is
> stable and accuracy. Could you tell me a simple way that test
> my DDR memory? 
> 
Boot the kernel and run something like stress from LTP (Linux
Test project). I guarantee you if there is any instability it
will show up...



      

^ permalink raw reply

* RE: [PATCH 3/6] [WATCHDOG] mpc83xx_wdt: rename to mpc8xxx_wdt
From: Chen Gong @ 2008-05-15  3:11 UTC (permalink / raw)
  To: Kumar Gala
  Cc: Stephen Rothwell, linuxppc-dev, Wim Van Sebroeck, Wood Scott,
	Tabi Timur
In-Reply-To: <DA55CC6B-F9AC-4ACB-A704-D61CCEB98023@kernel.crashing.org>

=20

> -----Original Message-----
> From: Kumar Gala [mailto:galak@kernel.crashing.org]=20
> Sent: 2008?5?14? 23:03
> To: Chen Gong
> Cc: Stephen Rothwell; Anton Vorontsov; Wood Scott;=20
> linuxppc-dev@ozlabs.org; Wim Van Sebroeck; Tabi Timur
> Subject: Re: [PATCH 3/6] [WATCHDOG] mpc83xx_wdt: rename to mpc8xxx_wdt
>=20
>=20
> On May 13, 2008, at 10:53 PM, Chen Gong wrote:
>=20
> >
> >
> >> -----Original Message-----
> >> From: linuxppc-dev-bounces+b11801=3Dfreescale.com@ozlabs.org
> >> [mailto:linuxppc-dev-bounces+b11801=3Dfreescale.com@ozlabs.org]
> >> On Behalf Of Stephen Rothwell
> >> Sent: 2008?5?14? 9:45
> >> To: Anton Vorontsov
> >> Cc: Wood Scott; linuxppc-dev@ozlabs.org; Wim Van Sebroeck;=20
> Tabi Timur
> >> Subject: Re: [PATCH 3/6] [WATCHDOG] mpc83xx_wdt: rename to=20
> >> mpc8xxx_wdt
> >>
> >> On Tue, 13 May 2008 18:14:59 +0400 Anton Vorontsov=20
> >> <avorontsov@ru.mvista.com> wrote:
> >>>
> >>> Rename the driver because now we support some MPC86xx processors.
> > What I want to know is that what about watchdog for booke(85xx) ?
>=20
> what about it, its still there in the tree (booke_wdt.c). =20
> This driver is for a SoC level watchdog that exists on 8xx,=20
> 83xx and 8610.
Yeah, I know it well, but I'm just afraid it will take confusion for
user.
>=20
> - k
>=20

^ permalink raw reply

* Re: [patch 1/4] powerpc: fix for OProfile callgraph for Power 64 bit user apps
From: Paul Mackerras @ 2008-05-15  3:58 UTC (permalink / raw)
  To: michael; +Cc: linuxppc-dev, akpm, cel, carll
In-Reply-To: <1210810844.7603.17.camel@localhost>

Michael Ellerman writes:

> __copy_from_user_inatomic() accepts any value for n, it just has a
> special case for 1, 2, 4 and 8 - but it should still work for other
> values.

There is a bug in __copy_from_user_inatomic that

http://patchwork.ozlabs.org/linuxppc/patch?id=18418

fixes, and I'm about to send that Linus-wards.

Carl, to what extent does that fix eliminate the need for the changes
in your patch?

Paul.

^ permalink raw reply

* [PATCH 1/2] ftrace ppc: add irqs_disabled_flags to ppc
From: Steven Rostedt @ 2008-05-15  3:49 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: proski, a.p.zijlstra, pq, linux-kernel, Steven Rostedt,
	linuxppc-dev, sandmann, paulus
In-Reply-To: <20080515034942.109223655@goodmis.org>

PPC doesn't have the irqs_disabled_flags needed by ftrace.
This patch adds it.

Signed-off-by: Steven Rostedt <srostedt@redhat.com>
---
 include/asm-powerpc/hw_irq.h |   10 ++++++++++
 1 file changed, 10 insertions(+)

Index: linux-sched-devel.git/include/asm-powerpc/hw_irq.h
===================================================================
--- linux-sched-devel.git.orig/include/asm-powerpc/hw_irq.h	2008-05-14 18:12:21.000000000 -0700
+++ linux-sched-devel.git/include/asm-powerpc/hw_irq.h	2008-05-14 19:24:59.000000000 -0700
@@ -59,6 +59,11 @@ extern void iseries_handle_interrupts(vo
 		get_paca()->hard_enabled = 0;	\
 	} while(0)
 
+static inline int irqs_disabled_flags(unsigned long flags)
+{
+	return flags == 0;
+}
+
 #else
 
 #if defined(CONFIG_BOOKE)
@@ -113,6 +118,11 @@ static inline void local_irq_save_ptr(un
 #define hard_irq_enable()	local_irq_enable()
 #define hard_irq_disable()	local_irq_disable()
 
+static inline int irqs_disabled_flags(unsigned long flags)
+{
+	return (flags & MSR_EE) == 0;
+}
+
 #endif /* CONFIG_PPC64 */
 
 /*

-- 

^ permalink raw reply

* Re: [patch 3/4] macintosh: replace deprecated __initcall with device_initcall
From: Paul Mackerras @ 2008-05-15  4:14 UTC (permalink / raw)
  To: akpm; +Cc: linuxppc-dev, rpjday
In-Reply-To: <200805142312.m4ENCsdu026262@imap1.linux-foundation.org>

akpm@linux-foundation.org writes:

> -__initcall(adb_init);
> +device_initcall(adb_init);

There's no particular reason why this needs to go in 2.6.26, is there?
It looks to me like something that I should queue up for 2.6.27.

Paul.

^ permalink raw reply

* [PATCH 0/2] ftrace ported to PPC
From: Steven Rostedt @ 2008-05-15  3:49 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: proski, a.p.zijlstra, pq, linux-kernel, linuxppc-dev, sandmann,
	paulus


The following two patches ports ftrace to PowerPC. I tested this on
both my PPC64 box as well as my 32bit PowerBook G4.

This applies to the latest sched-devel (with some extra hacks to get that
to boot on PPC).

This also depends on the CFLAGS_REMOVE_foo.o patches I sent earlier.

-- Steve

^ permalink raw reply

* [PATCH 2/2] ftrace: support for PowerPC
From: Steven Rostedt @ 2008-05-15  3:49 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: proski, a.p.zijlstra, pq, linux-kernel, Steven Rostedt,
	linuxppc-dev, sandmann, paulus
In-Reply-To: <20080515034942.109223655@goodmis.org>

This patch adds full support for ftrace for PowerPC (both 64 and 32 bit).
This includes dynamic tracing and function filtering.

Signed-off-by: Steven Rostedt <srostedt@redhat.com>
---
 arch/powerpc/Kconfig                     |    5 
 arch/powerpc/kernel/Makefile             |   14 ++
 arch/powerpc/kernel/entry_32.S           |  130 ++++++++++++++++++++++++
 arch/powerpc/kernel/entry_64.S           |   62 +++++++++++
 arch/powerpc/kernel/ftrace.c             |  165 +++++++++++++++++++++++++++++++
 arch/powerpc/kernel/io.c                 |    3 
 arch/powerpc/kernel/irq.c                |    6 -
 arch/powerpc/kernel/setup_32.c           |   11 +-
 arch/powerpc/kernel/setup_64.c           |    5 
 arch/powerpc/platforms/powermac/Makefile |    5 
 kernel/trace/trace_selftest.c            |   11 +-
 11 files changed, 406 insertions(+), 11 deletions(-)

Index: linux-sched-devel.git/arch/powerpc/kernel/io.c
===================================================================
--- linux-sched-devel.git.orig/arch/powerpc/kernel/io.c	2008-05-14 19:30:53.000000000 -0700
+++ linux-sched-devel.git/arch/powerpc/kernel/io.c	2008-05-14 19:31:48.000000000 -0700
@@ -120,7 +120,8 @@ 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)
+notrace void
+_memset_io(volatile void __iomem *addr, int c, unsigned long n)
 {
 	void *p = (void __force *)addr;
 	u32 lc = c;
Index: linux-sched-devel.git/arch/powerpc/kernel/Makefile
===================================================================
--- linux-sched-devel.git.orig/arch/powerpc/kernel/Makefile	2008-05-14 19:30:53.000000000 -0700
+++ linux-sched-devel.git/arch/powerpc/kernel/Makefile	2008-05-14 19:31:56.000000000 -0700
@@ -12,6 +12,18 @@ CFLAGS_prom_init.o      += -fPIC
 CFLAGS_btext.o		+= -fPIC
 endif
 
+ifdef CONFIG_FTRACE
+# Do not trace early boot code
+CFLAGS_REMOVE_cputable.o = -pg
+CFLAGS_REMOVE_prom_init.o = -pg
+
+ifdef CONFIG_DYNAMIC_FTRACE
+# dynamic ftrace setup.
+CFLAGS_REMOVE_ftrace.o = -pg
+endif
+
+endif
+
 obj-y				:= cputable.o ptrace.o syscalls.o \
 				   irq.o align.o signal_32.o pmc.o vdso.o \
 				   init_task.o process.o systbl.o idle.o \
@@ -79,6 +91,8 @@ obj-$(CONFIG_KEXEC)		+= machine_kexec.o 
 obj-$(CONFIG_AUDIT)		+= audit.o
 obj64-$(CONFIG_AUDIT)		+= compat_audit.o
 
+obj-$(CONFIG_DYNAMIC_FTRACE)	+= ftrace.o
+
 obj-$(CONFIG_8XX_MINIMAL_FPEMU) += softemu8xx.o
 
 ifneq ($(CONFIG_PPC_INDIRECT_IO),y)
Index: linux-sched-devel.git/arch/powerpc/platforms/powermac/Makefile
===================================================================
--- linux-sched-devel.git.orig/arch/powerpc/platforms/powermac/Makefile	2008-05-14 19:30:53.000000000 -0700
+++ linux-sched-devel.git/arch/powerpc/platforms/powermac/Makefile	2008-05-14 19:31:48.000000000 -0700
@@ -1,5 +1,10 @@
 CFLAGS_bootx_init.o  		+= -fPIC
 
+ifdef CONFIG_FTRACE
+# Do not trace early boot code
+CFLAGS_REMOVE_bootx_init.o = -pg
+endif
+
 obj-y				+= pic.o setup.o time.o feature.o pci.o \
 				   sleep.o low_i2c.o cache.o pfunc_core.o \
 				   pfunc_base.o
Index: linux-sched-devel.git/arch/powerpc/Kconfig
===================================================================
--- linux-sched-devel.git.orig/arch/powerpc/Kconfig	2008-05-14 19:30:50.000000000 -0700
+++ linux-sched-devel.git/arch/powerpc/Kconfig	2008-05-14 19:31:56.000000000 -0700
@@ -106,11 +106,12 @@ config PPC
 	bool
 	default y
 	select HAVE_IDE
-	select HAVE_OPROFILE
+	select HAVE_IMMEDIATE
+	select HAVE_FTRACE
 	select HAVE_KPROBES
 	select HAVE_KRETPROBES
 	select HAVE_LMB
-	select HAVE_IMMEDIATE
+	select HAVE_OPROFILE
 
 config EARLY_PRINTK
 	bool
Index: linux-sched-devel.git/arch/powerpc/kernel/entry_32.S
===================================================================
--- linux-sched-devel.git.orig/arch/powerpc/kernel/entry_32.S	2008-05-14 19:30:50.000000000 -0700
+++ linux-sched-devel.git/arch/powerpc/kernel/entry_32.S	2008-05-14 19:31:56.000000000 -0700
@@ -1035,3 +1035,133 @@ machine_check_in_rtas:
 	/* XXX load up BATs and panic */
 
 #endif /* CONFIG_PPC_RTAS */
+
+#ifdef CONFIG_FTRACE
+#ifdef CONFIG_DYNAMIC_FTRACE
+_GLOBAL(mcount)
+_GLOBAL(_mcount)
+	stwu	r1,-48(r1)
+	stw	r3, 12(r1)
+	stw	r4, 16(r1)
+	stw	r5, 20(r1)
+	stw	r6, 24(r1)
+	mflr	r3
+	stw	r7, 28(r1)
+	mfcr	r5
+	stw	r8, 32(r1)
+	stw	r9, 36(r1)
+	stw	r10,40(r1)
+	stw	r3, 44(r1)
+	stw	r5, 8(r1)
+	.globl mcount_call
+mcount_call:
+	bl	ftrace_stub
+	nop
+	lwz	r6, 8(r1)
+	lwz	r0, 44(r1)
+	lwz	r3, 12(r1)
+	mtctr	r0
+	lwz	r4, 16(r1)
+	mtcr	r6
+	lwz	r5, 20(r1)
+	lwz	r6, 24(r1)
+	lwz	r0, 52(r1)
+	lwz	r7, 28(r1)
+	lwz	r8, 32(r1)
+	mtlr	r0
+	lwz	r9, 36(r1)
+	lwz	r10,40(r1)
+	addi	r1, r1, 48
+	bctr
+
+_GLOBAL(ftrace_caller)
+	/* Based off of objdump optput from glibc */
+	stwu	r1,-48(r1)
+	stw	r3, 12(r1)
+	stw	r4, 16(r1)
+	stw	r5, 20(r1)
+	stw	r6, 24(r1)
+	mflr	r3
+	lwz	r4, 52(r1)
+	mfcr	r5
+	stw	r7, 28(r1)
+	stw	r8, 32(r1)
+	stw	r9, 36(r1)
+	stw	r10,40(r1)
+	stw	r3, 44(r1)
+	stw	r5, 8(r1)
+.globl ftrace_call
+ftrace_call:
+	bl	ftrace_stub
+	nop
+	lwz	r6, 8(r1)
+	lwz	r0, 44(r1)
+	lwz	r3, 12(r1)
+	mtctr	r0
+	lwz	r4, 16(r1)
+	mtcr	r6
+	lwz	r5, 20(r1)
+	lwz	r6, 24(r1)
+	lwz	r0, 52(r1)
+	lwz	r7, 28(r1)
+	lwz	r8, 32(r1)
+	mtlr	r0
+	lwz	r9, 36(r1)
+	lwz	r10,40(r1)
+	addi	r1, r1, 48
+	bctr
+#else
+_GLOBAL(mcount)
+_GLOBAL(_mcount)
+	stwu	r1,-48(r1)
+	stw	r3, 12(r1)
+	stw	r4, 16(r1)
+	stw	r5, 20(r1)
+	stw	r6, 24(r1)
+	mflr	r3
+	lwz	r4, 52(r1)
+	mfcr	r5
+	stw	r7, 28(r1)
+	stw	r8, 32(r1)
+	stw	r9, 36(r1)
+	stw	r10,40(r1)
+	stw	r3, 44(r1)
+	stw	r5, 8(r1)
+
+	LOAD_REG_ADDR(r5, ftrace_trace_function)
+#if 0
+	mtctr	r3
+	mr	r1, r5
+	bctrl
+#endif
+	lwz	r5,0(r5)
+#if 1
+	mtctr	r5
+	bctrl
+#else
+	bl	ftrace_stub
+#endif
+	nop
+
+	lwz	r6, 8(r1)
+	lwz	r0, 44(r1)
+	lwz	r3, 12(r1)
+	mtctr	r0
+	lwz	r4, 16(r1)
+	mtcr	r6
+	lwz	r5, 20(r1)
+	lwz	r6, 24(r1)
+	lwz	r0, 52(r1)
+	lwz	r7, 28(r1)
+	lwz	r8, 32(r1)
+	mtlr	r0
+	lwz	r9, 36(r1)
+	lwz	r10,40(r1)
+	addi	r1, r1, 48
+	bctr
+#endif
+
+_GLOBAL(ftrace_stub)
+	blr
+
+#endif /* CONFIG_MCOUNT */
Index: linux-sched-devel.git/arch/powerpc/kernel/entry_64.S
===================================================================
--- linux-sched-devel.git.orig/arch/powerpc/kernel/entry_64.S	2008-05-14 19:30:50.000000000 -0700
+++ linux-sched-devel.git/arch/powerpc/kernel/entry_64.S	2008-05-14 19:31:56.000000000 -0700
@@ -870,3 +870,65 @@ _GLOBAL(enter_prom)
 	ld	r0,16(r1)
 	mtlr    r0
         blr
+
+#ifdef CONFIG_FTRACE
+#ifdef CONFIG_DYNAMIC_FTRACE
+_GLOBAL(mcount)
+_GLOBAL(_mcount)
+	/* Taken from output of objdump from lib64/glibc */
+	mflr	r3
+	stdu	r1, -112(r1)
+	std	r3, 128(r1)
+	.globl mcount_call
+mcount_call:
+	bl	ftrace_stub
+	nop
+	ld	r0, 128(r1)
+	mtlr	r0
+	addi	r1, r1, 112
+	blr
+
+_GLOBAL(ftrace_caller)
+	/* Taken from output of objdump from lib64/glibc */
+	mflr	r3
+	ld	r11, 0(r1)
+	stdu	r1, -112(r1)
+	std	r3, 128(r1)
+	ld	r4, 16(r11)
+.globl ftrace_call
+ftrace_call:
+	bl	ftrace_stub
+	nop
+	ld	r0, 128(r1)
+	mtlr	r0
+	addi	r1, r1, 112
+_GLOBAL(ftrace_stub)
+	blr
+#else
+_GLOBAL(mcount)
+	blr
+
+_GLOBAL(_mcount)
+	/* Taken from output of objdump from lib64/glibc */
+	mflr	r3
+	ld	r11, 0(r1)
+	stdu	r1, -112(r1)
+	std	r3, 128(r1)
+	ld	r4, 16(r11)
+
+
+	LOAD_REG_ADDR(r5,ftrace_trace_function)
+	ld	r5,0(r5)
+	ld	r5,0(r5)
+	mtctr	r5
+	bctrl
+
+	nop
+	ld	r0, 128(r1)
+	mtlr	r0
+	addi	r1, r1, 112
+_GLOBAL(ftrace_stub)
+	blr
+
+#endif
+#endif
Index: linux-sched-devel.git/arch/powerpc/kernel/ftrace.c
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ linux-sched-devel.git/arch/powerpc/kernel/ftrace.c	2008-05-14 19:31:56.000000000 -0700
@@ -0,0 +1,165 @@
+/*
+ * Code for replacing ftrace calls with jumps.
+ *
+ * Copyright (C) 2007-2008 Steven Rostedt <srostedt@redhat.com>
+ *
+ * Thanks goes out to P.A. Semi, Inc for supplying me with a PPC64 box.
+ *
+ */
+
+#include <linux/spinlock.h>
+#include <linux/hardirq.h>
+#include <linux/ftrace.h>
+#include <linux/percpu.h>
+#include <linux/init.h>
+#include <linux/list.h>
+
+#include <asm/cacheflush.h>
+
+#define CALL_BACK		4
+
+static unsigned int ftrace_nop = 0x60000000;
+
+#ifdef CONFIG_PPC32
+# define GET_ADDR(addr) addr
+#else
+/* PowerPC64's functions are data that points to the functions */
+# define GET_ADDR(addr) *(unsigned long *)addr
+#endif
+
+notrace int ftrace_ip_converted(unsigned long ip)
+{
+	unsigned int save;
+
+	ip -= CALL_BACK;
+	save = *(unsigned int *)ip;
+
+	return save == ftrace_nop;
+}
+
+static unsigned int notrace ftrace_calc_offset(long ip, long addr)
+{
+	return (int)((addr + CALL_BACK) - ip);
+}
+
+notrace unsigned char *ftrace_nop_replace(void)
+{
+	return (char *)&ftrace_nop;
+}
+
+notrace unsigned char *ftrace_call_replace(unsigned long ip, unsigned long addr)
+{
+	static unsigned int op;
+
+	addr = GET_ADDR(addr);
+
+	/* Set to "bl addr" */
+	op = 0x48000001 | (ftrace_calc_offset(ip, addr) & 0x03fffffe);
+
+	/*
+	 * No locking needed, this must be called via kstop_machine
+	 * which in essence is like running on a uniprocessor machine.
+	 */
+	return (unsigned char *)&op;
+}
+
+#ifdef CONFIG_PPC64
+# define _ASM_ALIGN	" .align 3 "
+# define _ASM_PTR	" .llong "
+#else
+# define _ASM_ALIGN	" .align 2 "
+# define _ASM_PTR	" .long "
+#endif
+
+notrace int
+ftrace_modify_code(unsigned long ip, unsigned char *old_code,
+		   unsigned char *new_code)
+{
+	unsigned replaced;
+	unsigned old = *(unsigned *)old_code;
+	unsigned new = *(unsigned *)new_code;
+	int faulted = 0;
+
+	/* move the IP back to the start of the call */
+	ip -= CALL_BACK;
+
+	/*
+	 * Note: Due to modules and __init, code can
+	 *  disappear and change, we need to protect against faulting
+	 *  as well as code changing.
+	 *
+	 * No real locking needed, this code is run through
+	 * kstop_machine.
+	 */
+	asm volatile (
+		"1: lwz		%1, 0(%2)\n"
+		"   cmpw	%1, %5\n"
+		"   bne		2f\n"
+		"   stwu	%3, 0(%2)\n"
+		"2:\n"
+		".section .fixup, \"ax\"\n"
+		"3:	li %0, 1\n"
+		"	b 2b\n"
+		".previous\n"
+		".section __ex_table,\"a\"\n"
+		_ASM_ALIGN "\n"
+		_ASM_PTR "1b, 3b\n"
+		".previous"
+		: "=r"(faulted), "=r"(replaced)
+		: "r"(ip), "r"(new),
+		  "0"(faulted), "r"(old)
+		: "memory");
+
+	if (replaced != old && replaced != new)
+		faulted = 2;
+
+	if (!faulted)
+		flush_icache_range(ip, ip + 8);
+
+	return faulted;
+}
+
+notrace int ftrace_update_ftrace_func(ftrace_func_t func)
+{
+	unsigned long ip = (unsigned long)(&ftrace_call);
+	unsigned char old[4], *new;
+	int ret;
+
+	ip += CALL_BACK;
+
+	memcpy(old, &ftrace_call, 4);
+	new = ftrace_call_replace(ip, (unsigned long)func);
+	ret = ftrace_modify_code(ip, old, new);
+
+	return ret;
+}
+
+notrace int ftrace_mcount_set(unsigned long *data)
+{
+	unsigned long ip = (long)(&mcount_call);
+	unsigned long *addr = data;
+	unsigned char old[4], *new;
+
+	/* ip is at the location, but modify code will subtact this */
+	ip += CALL_BACK;
+
+	/*
+	 * Replace the mcount stub with a pointer to the
+	 * ip recorder function.
+	 */
+	memcpy(old, &mcount_call, 4);
+	new = ftrace_call_replace(ip, *addr);
+	*addr = ftrace_modify_code(ip, old, new);
+
+	return 0;
+}
+
+int __init ftrace_dyn_arch_init(void *data)
+{
+	/* This is running in kstop_machine */
+
+	ftrace_mcount_set(data);
+
+	return 0;
+}
+
Index: linux-sched-devel.git/arch/powerpc/kernel/irq.c
===================================================================
--- linux-sched-devel.git.orig/arch/powerpc/kernel/irq.c	2008-05-14 19:30:50.000000000 -0700
+++ linux-sched-devel.git/arch/powerpc/kernel/irq.c	2008-05-14 19:31:56.000000000 -0700
@@ -98,7 +98,7 @@ EXPORT_SYMBOL(irq_desc);
 
 int distribute_irqs = 1;
 
-static inline unsigned long get_hard_enabled(void)
+static inline notrace unsigned long get_hard_enabled(void)
 {
 	unsigned long enabled;
 
@@ -108,13 +108,13 @@ static inline unsigned long get_hard_ena
 	return enabled;
 }
 
-static inline void set_soft_enabled(unsigned long enable)
+static inline notrace void set_soft_enabled(unsigned long enable)
 {
 	__asm__ __volatile__("stb %0,%1(13)"
 	: : "r" (enable), "i" (offsetof(struct paca_struct, soft_enabled)));
 }
 
-void raw_local_irq_restore(unsigned long en)
+notrace void raw_local_irq_restore(unsigned long en)
 {
 	/*
 	 * get_paca()->soft_enabled = en;
Index: linux-sched-devel.git/arch/powerpc/kernel/setup_32.c
===================================================================
--- linux-sched-devel.git.orig/arch/powerpc/kernel/setup_32.c	2008-05-14 19:30:50.000000000 -0700
+++ linux-sched-devel.git/arch/powerpc/kernel/setup_32.c	2008-05-14 19:31:56.000000000 -0700
@@ -47,6 +47,11 @@
 #include <asm/kgdb.h>
 #endif
 
+#ifdef CONFIG_FTRACE
+extern void _mcount(void);
+EXPORT_SYMBOL(_mcount);
+#endif
+
 extern void bootx_init(unsigned long r4, unsigned long phys);
 
 int boot_cpuid;
@@ -81,7 +86,7 @@ int ucache_bsize;
  * from the address that it was linked at, so we must use RELOC/PTRRELOC
  * to access static data (including strings).  -- paulus
  */
-unsigned long __init early_init(unsigned long dt_ptr)
+notrace unsigned long __init early_init(unsigned long dt_ptr)
 {
 	unsigned long offset = reloc_offset();
 	struct cpu_spec *spec;
@@ -111,7 +116,7 @@ unsigned long __init early_init(unsigned
  * This is called very early on the boot process, after a minimal
  * MMU environment has been set up but before MMU_init is called.
  */
-void __init machine_init(unsigned long dt_ptr, unsigned long phys)
+notrace void __init machine_init(unsigned long dt_ptr, unsigned long phys)
 {
 	/* Enable early debugging if any specified (see udbg.h) */
 	udbg_early_init();
@@ -133,7 +138,7 @@ void __init machine_init(unsigned long d
 
 #ifdef CONFIG_BOOKE_WDT
 /* Checks wdt=x and wdt_period=xx command-line option */
-int __init early_parse_wdt(char *p)
+notrace int __init early_parse_wdt(char *p)
 {
 	if (p && strncmp(p, "0", 1) != 0)
 	       booke_wdt_enabled = 1;
Index: linux-sched-devel.git/arch/powerpc/kernel/setup_64.c
===================================================================
--- linux-sched-devel.git.orig/arch/powerpc/kernel/setup_64.c	2008-05-14 19:30:50.000000000 -0700
+++ linux-sched-devel.git/arch/powerpc/kernel/setup_64.c	2008-05-14 19:31:56.000000000 -0700
@@ -85,6 +85,11 @@ struct ppc64_caches ppc64_caches = {
 };
 EXPORT_SYMBOL_GPL(ppc64_caches);
 
+#ifdef CONFIG_FTRACE
+extern void _mcount(void);
+EXPORT_SYMBOL(_mcount);
+#endif
+
 /*
  * These are used in binfmt_elf.c to put aux entries on the stack
  * for each elf executable being started.
Index: linux-sched-devel.git/kernel/trace/trace_selftest.c
===================================================================
--- linux-sched-devel.git.orig/kernel/trace/trace_selftest.c	2008-05-14 19:30:50.000000000 -0700
+++ linux-sched-devel.git/kernel/trace/trace_selftest.c	2008-05-14 19:31:56.000000000 -0700
@@ -123,6 +123,7 @@ int trace_selftest_startup_dynamic_traci
 	int ret;
 	int save_ftrace_enabled = ftrace_enabled;
 	int save_tracer_enabled = tracer_enabled;
+	char *func_name;
 
 	/* The ftrace test PASSED */
 	printk(KERN_CONT "PASSED\n");
@@ -142,9 +143,15 @@ int trace_selftest_startup_dynamic_traci
 		return ret;
 	}
 
+	/*
+	 * Some archs *cough*PowerPC*cough* add charachters to the
+	 * start of the function names. We simply put a '*' to
+	 * accomodate them.
+	 */
+	func_name = "*" STR(DYN_FTRACE_TEST_NAME);
+
 	/* filter only on our function */
-	ftrace_set_filter(STR(DYN_FTRACE_TEST_NAME),
-			  sizeof(STR(DYN_FTRACE_TEST_NAME)), 1);
+	ftrace_set_filter(func_name, strlen(func_name), 1);
 
 	/* enable tracing */
 	tr->ctrl = 1;

-- 

^ permalink raw reply

* Re: [PATCH 0/2] ftrace ported to PPC
From: Paul Mackerras @ 2008-05-15  4:40 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: proski, a.p.zijlstra, pq, linux-kernel, linuxppc-dev, sandmann,
	Ingo Molnar
In-Reply-To: <20080515034942.109223655@goodmis.org>

Steven Rostedt writes:

> The following two patches ports ftrace to PowerPC. I tested this on
> both my PPC64 box as well as my 32bit PowerBook G4.

Very cool!  Thanks.

> This applies to the latest sched-devel (with some extra hacks to get that
> to boot on PPC).
> 
> This also depends on the CFLAGS_REMOVE_foo.o patches I sent earlier.

Ingo, when do you intend to send the ftrace stuff to Linus?  In the
next merge window?

Paul.

^ permalink raw reply

* linux-next: powercp-next build failure
From: Stephen Rothwell @ 2008-05-15  4:59 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: linuxppc-dev, Olaf Hering, linux-next, David Miller

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

Hi Paul,

Today's linux-next build (sparc64 defconfig) fails like this:

drivers/of/device.c: In function `modalias_show':
drivers/of/device.c:66: error: implicit declaration of function `of_device_get_modalias'

Caused by commit 140b932f8cb6cced10b96860651a198b1b89cbb9 ("[POWERPC]
Create modalias file in sysfs for of_platform bus") from the powerpc-next
tree as there is a definition and declaration of of_device_get_modalias
only for powerpc.  I reverted that commit for today.

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

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

^ permalink raw reply

* Re: [PATCH] list_for_each_rcu must die: networking
From: Kamalesh Babulal @ 2008-05-15  5:26 UTC (permalink / raw)
  To: paulmck
  Cc: shemminger, linux-kernel, linuxppc-dev, adobriyan, akpm, balbir,
	davem, sri
In-Reply-To: <20080515001607.GB20811@linux.vnet.ibm.com>

Paul E. McKenney wrote:
> All uses of list_for_each_rcu() can be profitably replaced by the
> easier-to-use list_for_each_entry_rcu().  This patch makes this change
> for networking, in preparation for removing the list_for_each_rcu()
> API entirely.
> 
> Updated to remove the two now-unused variables as noted by Dave Miller,
> and also to fix my bonehead error detected by Kamalesh Babulal and
> Alexey Dobriyan.  It now passes LTP on POWER.  And also has valid SOB.
> Some days it just doesn't pay to get out of bed...

Hi Paul,

Thanks, the patch fixes the oops.

Tested-by: Kamalesh Babulal <kamalesh@linux.vnet.ibm.com>
> Acked-by: David S. Miller <davem@davemloft.net> (lkml.org/lkml/2008/4/23/448)
> Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> ---
> 
>  802/psnap.c     |    4 +---
>  ipv4/af_inet.c  |    9 +++------
>  ipv6/af_inet6.c |    9 +++------
>  3 files changed, 7 insertions(+), 15 deletions(-)
> 
> diff -urpNa -X dontdiff linux-2.6.26-rc2/net/802/psnap.c linux-2.6.26-rc2-lfer-net/net/802/psnap.c
> --- linux-2.6.26-rc2/net/802/psnap.c	2008-04-16 19:49:44.000000000 -0700
> +++ linux-2.6.26-rc2-lfer-net/net/802/psnap.c	2008-05-14 13:38:13.000000000 -0700
> @@ -30,11 +30,9 @@ static struct llc_sap *snap_sap;
>   */
>  static struct datalink_proto *find_snap_client(unsigned char *desc)
>  {
> -	struct list_head *entry;
>  	struct datalink_proto *proto = NULL, *p;
> 
> -	list_for_each_rcu(entry, &snap_list) {
> -		p = list_entry(entry, struct datalink_proto, node);
> +	list_for_each_entry_rcu(p, &snap_list, node) {
>  		if (!memcmp(p->type, desc, 5)) {
>  			proto = p;
>  			break;
> diff -urpNa -X dontdiff linux-2.6.26-rc2/net/ipv4/af_inet.c linux-2.6.26-rc2-lfer-net/net/ipv4/af_inet.c
> --- linux-2.6.26-rc2/net/ipv4/af_inet.c	2008-05-14 13:35:32.000000000 -0700
> +++ linux-2.6.26-rc2-lfer-net/net/ipv4/af_inet.c	2008-05-14 13:46:26.000000000 -0700
> @@ -267,7 +267,6 @@ static inline int inet_netns_ok(struct n
>  static int inet_create(struct net *net, struct socket *sock, int protocol)
>  {
>  	struct sock *sk;
> -	struct list_head *p;
>  	struct inet_protosw *answer;
>  	struct inet_sock *inet;
>  	struct proto *answer_prot;
> @@ -284,13 +283,12 @@ static int inet_create(struct net *net, 
>  	sock->state = SS_UNCONNECTED;
> 
>  	/* Look for the requested type/protocol pair. */
> -	answer = NULL;
>  lookup_protocol:
>  	err = -ESOCKTNOSUPPORT;
>  	rcu_read_lock();
> -	list_for_each_rcu(p, &inetsw[sock->type]) {
> -		answer = list_entry(p, struct inet_protosw, list);
> +	list_for_each_entry_rcu(answer, &inetsw[sock->type], list) {
> 
> +		err = 0;
>  		/* Check the non-wild match. */
>  		if (protocol == answer->protocol) {
>  			if (protocol != IPPROTO_IP)
> @@ -305,10 +303,9 @@ lookup_protocol:
>  				break;
>  		}
>  		err = -EPROTONOSUPPORT;
> -		answer = NULL;
>  	}
> 
> -	if (unlikely(answer == NULL)) {
> +	if (unlikely(err)) {
>  		if (try_loading_module < 2) {
>  			rcu_read_unlock();
>  			/*
> diff -urpNa -X dontdiff linux-2.6.26-rc2/net/ipv6/af_inet6.c linux-2.6.26-rc2-lfer-net/net/ipv6/af_inet6.c
> --- linux-2.6.26-rc2/net/ipv6/af_inet6.c	2008-05-14 13:35:32.000000000 -0700
> +++ linux-2.6.26-rc2-lfer-net/net/ipv6/af_inet6.c	2008-05-14 13:45:08.000000000 -0700
> @@ -87,7 +87,6 @@ static int inet6_create(struct net *net,
>  	struct inet_sock *inet;
>  	struct ipv6_pinfo *np;
>  	struct sock *sk;
> -	struct list_head *p;
>  	struct inet_protosw *answer;
>  	struct proto *answer_prot;
>  	unsigned char answer_flags;
> @@ -101,13 +100,12 @@ static int inet6_create(struct net *net,
>  		build_ehash_secret();
> 
>  	/* Look for the requested type/protocol pair. */
> -	answer = NULL;
>  lookup_protocol:
>  	err = -ESOCKTNOSUPPORT;
>  	rcu_read_lock();
> -	list_for_each_rcu(p, &inetsw6[sock->type]) {
> -		answer = list_entry(p, struct inet_protosw, list);
> +	list_for_each_entry_rcu(answer, &inetsw6[sock->type], list) {
> 
> +		err = 0;
>  		/* Check the non-wild match. */
>  		if (protocol == answer->protocol) {
>  			if (protocol != IPPROTO_IP)
> @@ -122,10 +120,9 @@ lookup_protocol:
>  				break;
>  		}
>  		err = -EPROTONOSUPPORT;
> -		answer = NULL;
>  	}
> 
> -	if (!answer) {
> +	if (err) {
>  		if (try_loading_module < 2) {
>  			rcu_read_unlock();
>  			/*
> --

-- 
Thanks & Regards,
Kamalesh Babulal,
Linux Technology Center,
IBM, ISTL.

^ permalink raw reply

* Re: [PATCH 2/2] ftrace: support for PowerPC
From: David Miller @ 2008-05-15  5:28 UTC (permalink / raw)
  To: rostedt
  Cc: proski, a.p.zijlstra, pq, linux-kernel, srostedt, linuxppc-dev,
	sandmann, paulus, mingo
In-Reply-To: <20080515035918.896765954@goodmis.org>

From: Steven Rostedt <rostedt@goodmis.org>
Date: Wed, 14 May 2008 23:49:44 -0400

> +#ifdef CONFIG_FTRACE
> +#ifdef CONFIG_DYNAMIC_FTRACE
> +_GLOBAL(mcount)
> +_GLOBAL(_mcount)
> +	stwu	r1,-48(r1)
> +	stw	r3, 12(r1)
> +	stw	r4, 16(r1)
> +	stw	r5, 20(r1)
> +	stw	r6, 24(r1)
> +	mflr	r3
> +	stw	r7, 28(r1)
> +	mfcr	r5
> +	stw	r8, 32(r1)
> +	stw	r9, 36(r1)
> +	stw	r10,40(r1)
> +	stw	r3, 44(r1)
> +	stw	r5, 8(r1)

Yikes, that's really expensive.

Can't you do a tail call and let the function you end
up calling do all the callee-saved register pops onto
the stack?

That's what I did on sparc.

^ permalink raw reply

* Re: ALSA fixes for non-coherent archs (Re: [PATCH] Sam440ep support)
From: Takashi Iwai @ 2008-05-15  5:42 UTC (permalink / raw)
  To: Gerhard Pircher; +Cc: linuxppc-dev, alsa-devel, cjg
In-Reply-To: <20080514210110.155050@gmx.net>

At Wed, 14 May 2008 23:01:10 +0200,
Gerhard Pircher wrote:
> 
> 
> -------- Original-Nachricht --------
> > Datum: Wed, 14 May 2008 14:26:53 +0200
> > Von: Takashi Iwai <tiwai@suse.de>
> > An: "Gerhard Pircher" <gerhard_pircher@gmx.net>
> > CC: benh@kernel.crashing.org, galak@kernel.crashing.org, cjg@cruxppc.org, linuxppc-dev@ozlabs.org, alsa-devel@alsa-project.org
> > Betreff: ALSA fixes for non-coherent archs (Re: [PATCH] Sam440ep support)
> 
> > At Tue, 06 May 2008 11:16:22 +0200,
> > Gerhard Pircher wrote:
> > > 
> > > Naturally I can do some tests, if you or Takashi come up with a new
> > > patch.
> > 
> > OK, here is another patch for testing.  Since I lost my old patch
> > somewhere (and it's not worth to dig the archive), I wrote it up
> > quickly from scratch.  This version should cover both SG and non-SG
> > buffers.  It's against the latest git tree.
> > 
> > The patch adds a hackish verison of dma_mmap_coherent() for some
> > architectures in sound/core/pcm_native.c.  I'm not sure whether this
> > works.  I just tested it on X86.  It'd be appreciated if someone can
> > test this.
> > 
> > Also, this disables HDSPM driver for non-X86/IA64 since the driver has
> > own copy and silence methods that are incompatible with the new
> > SG-buffer data.
> > 
> > 
> > And, yes, I know we need to clean up huge messes in ALSA memory
> > handling routines.  But, let's fix obvious bugs before starting a big
> > rewrite...
> Okay, it seems to work fine so far. No lock-ups or kernel oopses. Tested
> with kernel v2.6.26-rc2 and a Soundblaster 5.1/EMU10k1 device (which was
> not working with the old patch) on my non cache coherent G4 system.

Good to hear.  The next step is to move dma_mmap_coherent() to arch/*
directories...


Takashi

^ permalink raw reply

* Re: [patch 3/4] macintosh: replace deprecated __initcall with device_initcall
From: Andrew Morton @ 2008-05-15  6:06 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: linuxppc-dev, rpjday
In-Reply-To: <18475.47278.446992.728481@cargo.ozlabs.ibm.com>

On Thu, 15 May 2008 14:14:38 +1000 Paul Mackerras <paulus@samba.org> wrote:

> akpm@linux-foundation.org writes:
> 
> > -__initcall(adb_init);
> > +device_initcall(adb_init);
> 
> There's no particular reason why this needs to go in 2.6.26, is there?
> It looks to me like something that I should queue up for 2.6.27.
> 

No, this make no difference in code generation - it's just a
use-the-modern-interface thing.

^ permalink raw reply

* Re: [PATCH] list_for_each_rcu must die: networking
From: David Miller @ 2008-05-15  6:20 UTC (permalink / raw)
  To: kamalesh
  Cc: balbir, linux-kernel, linuxppc-dev, adobriyan, akpm, paulmck,
	shemminger, sri
In-Reply-To: <482BC96F.1030008@linux.vnet.ibm.com>

From: Kamalesh Babulal <kamalesh@linux.vnet.ibm.com>
Date: Thu, 15 May 2008 10:56:07 +0530

> Paul E. McKenney wrote:
> > All uses of list_for_each_rcu() can be profitably replaced by the
> > easier-to-use list_for_each_entry_rcu().  This patch makes this change
> > for networking, in preparation for removing the list_for_each_rcu()
> > API entirely.
> > 
> > Updated to remove the two now-unused variables as noted by Dave Miller,
> > and also to fix my bonehead error detected by Kamalesh Babulal and
> > Alexey Dobriyan.  It now passes LTP on POWER.  And also has valid SOB.
> > Some days it just doesn't pay to get out of bed...
> 
> Hi Paul,
> 
> Thanks, the patch fixes the oops.
> 
> Tested-by: Kamalesh Babulal <kamalesh@linux.vnet.ibm.com>
> > Acked-by: David S. Miller <davem@davemloft.net> (lkml.org/lkml/2008/4/23/448)
> > Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>

I'm fine with these changes, and I acked them already.
They belong as a set with the other list_for_each_rcu killing
patches, so I'm fine with them going all together in Andrew's
tree.

Thanks!

^ permalink raw reply

* Re: [patch 3/4] macintosh: replace deprecated __initcall with device_initcall
From: Michael Ellerman @ 2008-05-15  6:28 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linuxppc-dev, rpjday, Paul Mackerras
In-Reply-To: <20080514230647.15d58897.akpm@linux-foundation.org>

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

On Wed, 2008-05-14 at 23:06 -0700, Andrew Morton wrote:
> On Thu, 15 May 2008 14:14:38 +1000 Paul Mackerras <paulus@samba.org> wrote:
> 
> > akpm@linux-foundation.org writes:
> > 
> > > -__initcall(adb_init);
> > > +device_initcall(adb_init);
> > 
> > There's no particular reason why this needs to go in 2.6.26, is there?
> > It looks to me like something that I should queue up for 2.6.27.
> > 
> 
> No, this make no difference in code generation - it's just a
> use-the-modern-interface thing.

I missed the memo about __initcall being deprecated, or is it only
deprecated for use in device drivers?

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

* dtc: Add program to convert dts files from v0 to v1
From: David Gibson @ 2008-05-15  6:39 UTC (permalink / raw)
  To: Jon Loeliger; +Cc: linuxppc-dev

This patch adds a new utility program, convert-dtsv0, to the dtc
sources.  This program will convert dts files from v0 to v1,
preserving comments and spacing.  It also includes some heuristics to
guess an appropriate base to use in the v1 output (so it will use hex
for the contents of reg properties and decimal for clock-frequency
properties, for example).  They're limited and imperfect, but not
terrible.

The guts of the converter program is a modified version of the lexer
from dtc itself.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>

Index: dtc/Makefile
===================================================================
--- dtc.orig/Makefile	2008-05-15 13:08:38.000000000 +1000
+++ dtc/Makefile	2008-05-15 13:33:02.000000000 +1000
@@ -46,7 +46,7 @@
 DEPTARGETS = $(filter-out $(NODEPTARGETS),$(MAKECMDGOALS))
 endif
 
-all: dtc ftdump libfdt
+all: dtc ftdump convert-dtsv0 libfdt
 
 install: all
 	@$(VECHO) INSTALL
@@ -121,12 +121,16 @@
 -include $(DTC_OBJS:%.o=%.d)
 endif
 #
-# Rules for ftdump
+# Rules for ftdump & convert-dtsv0
 #
-BIN += ftdump
+BIN += ftdump convert-dtsv0
 
 ftdump:	ftdump.o
 
+convert-dtsv0: convert-dtsv0-lexer.lex.o srcpos.o
+	@$(VECHO) LD $@
+	$(LINK.c) -o $@ $^
+
 ifneq ($(DEPTARGETS),)
 -include ftdump.d
 endif
Index: dtc/convert-dtsv0-lexer.l
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ dtc/convert-dtsv0-lexer.l	2008-05-15 16:28:33.000000000 +1000
@@ -0,0 +1,260 @@
+/*
+ * (C) Copyright David Gibson <dwg@au1.ibm.com>, IBM Corporation.  2005, 2008.
+ *
+ * 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; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ *  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
+ */
+
+%option noyywrap nounput stack
+
+%x INCLUDE
+%x BYTESTRING
+%x PROPNODENAME
+
+PROPNODECHAR	[a-zA-Z0-9,._+*#?@-]
+PATHCHAR	({PROPNODECHAR}|[/])
+LABEL		[a-zA-Z_][a-zA-Z0-9_]*
+
+%{
+#include <stdarg.h>
+#include <assert.h>
+#include <fnmatch.h>
+#include "srcpos.h"
+
+static int v1_tagged; /* = 0 */
+static int cbase = 16;
+static int saw_hyphen; /* = 0 */
+static unsigned long long last_val;
+static char *last_name; /* = NULL */
+
+#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
+
+static inline void __attribute__((noreturn)) die(char * str, ...)
+{
+	va_list ap;
+
+	va_start(ap, str);
+	fprintf(stderr, "FATAL ERROR: ");
+	vfprintf(stderr, str, ap);
+	exit(1);
+}
+
+static inline void *xmalloc(size_t len)
+{
+	void *new = malloc(len);
+
+	if (! new)
+		die("malloc() failed\n");
+
+	return new;
+}
+
+const struct {
+	const char *pattern;
+	int obase, width;
+} guess_table[] = {
+	{ "*-frequency", 10, 0 },
+	{ "num-*", 10, 0 },
+	{ "#*-cells", 10, 0 },
+	{ "*cache-line-size", 10, 0 },
+	{ "*cache-block-size", 10, 0 },
+	{ "*cache-size", 10, 0 },
+	{ "*cache-sets", 10, 0 },
+	{ "cell-index", 10, 0 },
+	{ "bank-width", 10, 0 },
+	{ "*-fifo-size", 10, 0 },
+	{ "*-frame-size", 10, 0 },
+	{ "*-channel", 10, 0 },
+	{ "current-speed", 10, 0 },
+	{ "phy-map", 16, 8 },
+	{ "dcr-reg", 16, 3 },
+	{ "reg", 16, 8 },
+	{ "ranges", 16, 8},
+};
+%}
+
+%%
+<*>"/include/"	{
+			ECHO;
+			yy_push_state(INCLUDE);
+		}
+
+<INCLUDE>\"[^"\n]*\"	{
+			ECHO;
+			yy_pop_state();
+		}
+
+
+<*>\"([^\\"]|\\.)*\"	ECHO;
+
+<*>"/dts-v1/"	{
+			die("Input dts file is already version 1\n");
+		}
+
+<*>"/memreserve/"	{
+			if (!v1_tagged) {
+				fprintf(yyout, "/dts-v1/;\n\n");
+				v1_tagged = 1;
+			}
+
+			ECHO;
+			BEGIN(INITIAL);
+		}
+
+<*>{LABEL}:		ECHO;
+
+<INITIAL>[bodh]# {
+			if (*yytext == 'b')
+				cbase = 2;
+			else if (*yytext == 'o')
+				cbase = 8;
+			else if (*yytext == 'd')
+				cbase = 10;
+			else
+				cbase = 16;
+		}
+
+<INITIAL>[0-9a-fA-F]+	{
+			unsigned long long val;
+			int obase = 16, width = 0;
+			int i;
+
+			val = strtoull(yytext, NULL, cbase);
+
+			if (saw_hyphen)
+				val = val - last_val + 1;
+
+			if (last_name) {
+				for (i = 0; i < ARRAY_SIZE(guess_table); i++)
+					if (fnmatch(guess_table[i].pattern,
+					    last_name, 0) == 0) {
+					    	obase = guess_table[i].obase;
+						width = guess_table[i].width;
+					}
+			} else {
+				obase = 16;
+				width = 16;
+			}
+
+			if (cbase != 16)
+				obase = cbase;
+
+			switch (obase) {
+			case 2:
+			case 16:
+				fprintf(yyout, "0x%0*llx", width, val);
+				break;
+			case 8:
+				fprintf(yyout, "0%0*llo", width, val);
+				break;
+			case 10:
+				fprintf(yyout, "%*llu", width, val);
+				break;
+			}
+
+			cbase = 16;
+			last_val = val;
+			saw_hyphen = 0;
+		}
+
+\&{LABEL}		ECHO;
+
+"&{/"{PATHCHAR}+\}	ECHO;
+
+<INITIAL>"&/"{PATHCHAR}+ fprintf(yyout, "&{/%s}", yytext + 2);
+
+<BYTESTRING>[0-9a-fA-F]{2} ECHO;
+
+<BYTESTRING>"]"	{
+			ECHO;
+			BEGIN(INITIAL);
+		}
+
+<PROPNODENAME>{PROPNODECHAR}+ {
+			ECHO;
+			last_name = strdup(yytext);
+			BEGIN(INITIAL);
+		}
+
+<*>[[:space:]]+		ECHO;
+
+<*>"/*"([^*]|\*+[^*/])*\*+"/" ECHO;
+
+<*>"//".*\n		ECHO;
+
+<*>-		{	/* Hack to convert old style memreserves */
+			saw_hyphen = 1;
+			fprintf(yyout, " ");
+		}
+
+<*>.		{
+			if (!v1_tagged) {
+				fprintf(yyout, "/dts-v1/;\n\n");
+				v1_tagged = 1;
+			}
+
+			ECHO;
+			if (yytext[0] == '[') {
+				BEGIN(BYTESTRING);
+			}
+			if ((yytext[0] == '{')
+			    || (yytext[0] == ';')) {
+				BEGIN(PROPNODENAME);
+			}
+		}
+
+%%
+static void usage(void)
+{
+	fprintf(stderr, "convert-dtsv0 <v0 dts file>...\n");
+	exit(3);
+}
+
+static void convert_file(const char *fname)
+{
+	const char suffix[] = "v1";
+	int len = strlen(fname);
+	char *newname;
+
+	newname = xmalloc(len + sizeof(suffix));
+	memcpy(newname, fname, len);
+	memcpy(newname + len, suffix, sizeof(suffix));
+
+	srcpos_file = dtc_open_file(fname, NULL);
+	yyin = srcpos_file->file;
+
+	yyout = fopen(newname, "w");
+	if (!yyout)
+		die("Couldn't open output file %s: %s\n",
+		    newname, strerror(errno));
+
+	while(yylex())
+		;
+}
+
+int main(int argc, char *argv[])
+{
+	int i;
+
+	if (argc < 2)
+		usage();
+
+	for (i = 1; i < argc; i++) {
+		fprintf(stderr, "Converting %s from dts v0 to dts v1\n", argv[i]);
+		convert_file(argv[i]);
+	}
+
+	exit(0);
+}
Index: dtc/tests/Makefile.tests
===================================================================
--- dtc.orig/tests/Makefile.tests	2008-05-15 13:58:38.000000000 +1000
+++ dtc/tests/Makefile.tests	2008-05-15 14:19:06.000000000 +1000
@@ -27,7 +27,7 @@
 TESTS_DEPFILES = $(TESTS:%=%.d) \
 	$(addprefix $(TESTS_PREFIX),testutils.d trees.d dumptrees.d)
 
-TESTS_CLEANFILES_L =  *.output vglog.* vgcore.* *.dtb *.test.dts tmp.*
+TESTS_CLEANFILES_L =  *.output vglog.* vgcore.* *.dtb *.test.dts *.dtsv1 tmp.*
 TESTS_CLEANFILES = $(TESTS_CLEANFILES_L:%=$(TESTS_PREFIX)%)
 
 BIN += $(TESTS) $(TESTS_PREFIX)dumptrees
@@ -50,13 +50,13 @@
 	rm -f $(STD_CLEANFILES:%=$(TESTS_PREFIX)%)
 	rm -f $(TESTS_CLEANFILES)
 
-check:	tests dtc
+check:	tests dtc convert-dtsv0
 	cd $(TESTS_PREFIX); ./run_tests.sh
 
-checkm: tests dtc
+checkm: tests dtc convert-dtsv0
 	cd $(TESTS_PREFIX); ./run_tests.sh -m 2>&1 | tee vglog.$$$$
 
-checkv:	tests dtc
+checkv:	tests dtc convert-dtsv0
 	cd $(TESTS_PREFIX); ./run_tests.sh -v
 
 ifneq ($(DEPTARGETS),)
Index: dtc/tests/run_tests.sh
===================================================================
--- dtc.orig/tests/run_tests.sh	2008-05-15 13:46:24.000000000 +1000
+++ dtc/tests/run_tests.sh	2008-05-15 14:22:15.000000000 +1000
@@ -72,6 +72,13 @@
     base_run_test wrap_test $VALGRIND $DTC "$@"
 }
 
+CONVERT=../convert-dtsv0
+
+run_convert_test () {
+    echo -n "convert-dtsv0 $@:	"
+    base_run_test wrap_test $VALGRIND $CONVERT "$@"
+}
+
 tree1_tests () {
     TREE=$1
 
@@ -260,6 +267,21 @@
     run_sh_test dtc-fatal.sh -I fs -O dtb nosuchfile
 }
 
+convert_tests () {
+    V0_DTS="test_tree1_dts0.dts references_dts0.dts empty.dts escapes.dts \
+	test01.dts label01.dts"
+    for dts in $V0_DTS; do
+	run_dtc_test -I dts -O dtb -o cvtraw_$dts.test.dtb $dts
+	run_dtc_test -I dts -O dts -o cvtdtc_$dts.test.dts $dts
+	run_dtc_test -I dts -O dtb -o cvtdtc_$dts.test.dtb cvtdtc_$dts.test.dts
+	run_convert_test $dts
+	run_dtc_test -I dts -O dtb -o cvtcvt_$dts.test.dtb ${dts}v1
+
+	run_wrap_test cmp cvtraw_$dts.test.dtb cvtdtc_$dts.test.dtb
+	run_wrap_test cmp cvtraw_$dts.test.dtb cvtcvt_$dts.test.dtb
+    done
+}
+
 while getopts "vt:m" ARG ; do
     case $ARG in
 	"v")
@@ -275,7 +297,7 @@
 done
 
 if [ -z "$TESTSETS" ]; then
-    TESTSETS="libfdt dtc"
+    TESTSETS="libfdt dtc convert"
 fi
 
 # Make sure we don't have stale blobs lying around
@@ -289,6 +311,9 @@
 	"dtc")
 	    dtc_tests
 	    ;;
+	"convert")
+	    convert_tests
+	    ;;
     esac
 done
 

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

^ permalink raw reply

* Re: [patch 3/4] macintosh: replace deprecated __initcall with device_initcall
From: Andrew Morton @ 2008-05-15  6:41 UTC (permalink / raw)
  To: michael; +Cc: linuxppc-dev, rpjday, Paul Mackerras
In-Reply-To: <1210832908.17568.16.camel@localhost>

On Thu, 15 May 2008 16:28:28 +1000 Michael Ellerman <michael@ellerman.id.au> wrote:

> On Wed, 2008-05-14 at 23:06 -0700, Andrew Morton wrote:
> > On Thu, 15 May 2008 14:14:38 +1000 Paul Mackerras <paulus@samba.org> wrote:
> > 
> > > akpm@linux-foundation.org writes:
> > > 
> > > > -__initcall(adb_init);
> > > > +device_initcall(adb_init);
> > > 
> > > There's no particular reason why this needs to go in 2.6.26, is there?
> > > It looks to me like something that I should queue up for 2.6.27.
> > > 
> > 
> > No, this make no difference in code generation - it's just a
> > use-the-modern-interface thing.
> 
> I missed the memo about __initcall being deprecated, or is it only
> deprecated for use in device drivers?
> 

It's just old-fashioned, that's all.

#define pure_initcall(fn)		__define_initcall("0",fn,0)

#define core_initcall(fn)		__define_initcall("1",fn,1)
#define core_initcall_sync(fn)		__define_initcall("1s",fn,1s)
#define postcore_initcall(fn)		__define_initcall("2",fn,2)
#define postcore_initcall_sync(fn)	__define_initcall("2s",fn,2s)
#define arch_initcall(fn)		__define_initcall("3",fn,3)
#define arch_initcall_sync(fn)		__define_initcall("3s",fn,3s)
#define subsys_initcall(fn)		__define_initcall("4",fn,4)
#define subsys_initcall_sync(fn)	__define_initcall("4s",fn,4s)
#define fs_initcall(fn)			__define_initcall("5",fn,5)
#define fs_initcall_sync(fn)		__define_initcall("5s",fn,5s)
#define rootfs_initcall(fn)		__define_initcall("rootfs",fn,rootfs)
#define device_initcall(fn)		__define_initcall("6",fn,6)
#define device_initcall_sync(fn)	__define_initcall("6s",fn,6s)
#define late_initcall(fn)		__define_initcall("7",fn,7)
#define late_initcall_sync(fn)		__define_initcall("7s",fn,7s)

#define __initcall(fn) device_initcall(fn)

See, we have the nicely-ordered foo_initcall()'s, and the old-fashioned
legacy __initcall happens to map onto device_initcall().

Such code should use device_initcall() directly.  So we see at which
stage in initcalls this function will be called.

^ 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