LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH] isdn: mISDN HFC PCI support depends on virt_to_bus()
From: Alan Cox @ 2008-07-27 17:27 UTC (permalink / raw)
  To: Stephen Rothwell; +Cc: ppc-dev, Andrew Morton, Linus, LKML, Karsten Keil
In-Reply-To: <20080728023732.090aff83.sfr@canb.auug.org.au>

On Mon, 28 Jul 2008 02:37:32 +1000
Stephen Rothwell <sfr@canb.auug.org.au> wrote:

> On powerpc (allyesconfig build) we get this error:
> 
> drivers/isdn/hardware/mISDN/hfcpci.c:1991: error: implicit declaration of function 'virt_to_bus'
> 
> Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>

Can we please not merge new virt_to_bus users and instead fix the actual
code to use the right functions?

^ permalink raw reply

* Re: [PATCH] isdn: mISDN HFC PCI support depends on virt_to_bus()
From: Sean MacLennan @ 2008-07-27 17:39 UTC (permalink / raw)
  To: Stephen Rothwell; +Cc: ppc-dev, Andrew Morton, Linus, LKML, Karsten Keil
In-Reply-To: <20080728023732.090aff83.sfr@canb.auug.org.au>

On Mon, 28 Jul 2008 02:37:32 +1000
"Stephen Rothwell" <sfr@canb.auug.org.au> wrote:

> On powerpc (allyesconfig build) we get this error:
> 
> drivers/isdn/hardware/mISDN/hfcpci.c:1991: error: implicit
> declaration of function 'virt_to_bus'

When did mISDN make it into the kernel? And which kernel tree is it in?
I don't see it in the Linux next tree....

I am very interested since we are trying to get mISDN working on the
Warp. There was no notice that they got 2.6.26 compiling.

Cheers,
   Sean

^ permalink raw reply

* Re: [PATCH] powerpc: Use new printk extension %pS to print symbols on oops
From: Linus Torvalds @ 2008-07-27 17:26 UTC (permalink / raw)
  To: David Woodhouse; +Cc: linuxppc-dev
In-Reply-To: <1217137231.1769.33.camel@shinybook.infradead.org>



On Sun, 27 Jul 2008, David Woodhouse wrote:
> 
> Out of interest, why is it %pS and not %Sp? Shouldn't the modifier come
> first? What if we want to print a pointer immediately followed by a
> capital S?

Try it. 

			Linus

^ permalink raw reply

* [PATCH] isdn: mISDN HFC PCI support depends on virt_to_bus()
From: Stephen Rothwell @ 2008-07-27 16:37 UTC (permalink / raw)
  To: Karsten Keil; +Cc: ppc-dev, Andrew Morton, Linus, LKML

On powerpc (allyesconfig build) we get this error:

drivers/isdn/hardware/mISDN/hfcpci.c:1991: error: implicit declaration of function 'virt_to_bus'

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
 drivers/isdn/hardware/mISDN/Kconfig |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/isdn/hardware/mISDN/Kconfig b/drivers/isdn/hardware/mISDN/Kconfig
index 1479348..9cd5f5f 100644
--- a/drivers/isdn/hardware/mISDN/Kconfig
+++ b/drivers/isdn/hardware/mISDN/Kconfig
@@ -7,6 +7,7 @@ config MISDN_HFCPCI
 	tristate "Support for HFC PCI cards"
 	depends on MISDN
 	depends on PCI
+	depends on VIRT_TO_BUS
 	help
 	  Enable support for cards with Cologne Chip AG's
           HFC PCI chip.
-- 
1.5.6.3

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

^ permalink raw reply related

* [PATCH] powerpc/vio: more fallout from dma_mapping_error API change
From: Stephen Rothwell @ 2008-07-27 16:22 UTC (permalink / raw)
  To: Benjamin Herrenschmidt, Paul Mackerras
  Cc: LKML, Tomonori, ppc-dev, Andrew Morton, FUJITA

arch/powerpc/kernel/vio.c:533: error: too few arguments to function 'dma_mapping_error'

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

Compile tested for ppc64_defconfig.

diff --git a/arch/powerpc/kernel/vio.c b/arch/powerpc/kernel/vio.c
index ade8aea..49a166d 100644
--- a/arch/powerpc/kernel/vio.c
+++ b/arch/powerpc/kernel/vio.c
@@ -530,7 +530,7 @@ static dma_addr_t vio_dma_iommu_map_single(struct device *dev, void *vaddr,
 	}
 
 	ret = dma_iommu_ops.map_single(dev, vaddr, size, direction, attrs);
-	if (unlikely(dma_mapping_error(ret))) {
+	if (unlikely(dma_mapping_error(dev, ret))) {
 		vio_cmo_dealloc(viodev, roundup(size, IOMMU_PAGE_SIZE));
 		atomic_inc(&viodev->cmo.allocs_failed);
 	}
-- 
1.5.6.3

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

^ permalink raw reply related

* [PATCH] powerpc/ibmveth: fix multiple errors with dma_mapping_error conversion
From: Stephen Rothwell @ 2008-07-27 16:14 UTC (permalink / raw)
  To: Benjamin Herrenschmidt, Paul Mackerras
  Cc: Jeff Garzik, LKML, Tomonori, ppc-dev, Andrew Morton, FUJITA

The addition of an argument to dma_mapping_error() in commit
8d8bb39b9eba32dd70e87fd5ad5c5dd4ba118e06 "dma-mapping: add the device
argument to dma_mapping_error()" left a bit of fallout:

drivers/net/ibmveth.c:263: error: too few arguments to function 'dma_mapping_error'
drivers/net/ibmveth.c:264: error: expected ')' before 'goto'
drivers/net/ibmveth.c:284: error: expected expression before '}' token
drivers/net/ibmveth.c:297: error: too few arguments to function 'dma_mapping_error'
drivers/net/ibmveth.c:298: error: expected ')' before 'dma_unmap_single'
drivers/net/ibmveth.c:306: error: expected expression before '}' token
drivers/net/ibmveth.c:491: error: too few arguments to function 'dma_mapping_error'
drivers/net/ibmveth.c:927: error: too few arguments to function 'dma_mapping_error'
drivers/net/ibmveth.c:927: error: expected ')' before '{' token
drivers/net/ibmveth.c:974: error: expected expression before '}' token
drivers/net/ibmveth.c:914: error: label 'out' used but not defined m

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
 drivers/net/ibmveth.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

Compiler tested for ppc64_defconfig.

diff --git a/drivers/net/ibmveth.c b/drivers/net/ibmveth.c
index 91ec9fd..a03fe1f 100644
--- a/drivers/net/ibmveth.c
+++ b/drivers/net/ibmveth.c
@@ -260,7 +260,7 @@ static void ibmveth_replenish_buffer_pool(struct ibmveth_adapter *adapter, struc
 		dma_addr = dma_map_single(&adapter->vdev->dev, skb->data,
 				pool->buff_size, DMA_FROM_DEVICE);
 
-		if (dma_mapping_error((&adapter->vdev->dev, dma_addr))
+		if (dma_mapping_error(&adapter->vdev->dev, dma_addr))
 			goto failure;
 
 		pool->free_map[free_index] = IBM_VETH_INVALID_MAP;
@@ -294,7 +294,7 @@ failure:
 		pool->consumer_index = pool->size - 1;
 	else
 		pool->consumer_index--;
-	if (!dma_mapping_error((&adapter->vdev->dev, dma_addr))
+	if (!dma_mapping_error(&adapter->vdev->dev, dma_addr))
 		dma_unmap_single(&adapter->vdev->dev,
 		                 pool->dma_addr[index], pool->buff_size,
 		                 DMA_FROM_DEVICE);
@@ -488,7 +488,7 @@ static void ibmveth_cleanup(struct ibmveth_adapter *adapter)
 						 &adapter->rx_buff_pool[i]);
 
 	if (adapter->bounce_buffer != NULL) {
-		if (!dma_mapping_error(adapter->bounce_buffer_dma)) {
+		if (!dma_mapping_error(dev, adapter->bounce_buffer_dma)) {
 			dma_unmap_single(&adapter->vdev->dev,
 					adapter->bounce_buffer_dma,
 					adapter->netdev->mtu + IBMVETH_BUFF_OH,
@@ -924,7 +924,7 @@ static int ibmveth_start_xmit(struct sk_buff *skb, struct net_device *netdev)
 		buf[1] = 0;
 	}
 
-	if (dma_mapping_error((&adapter->vdev->dev, data_dma_addr)) {
+	if (dma_mapping_error(&adapter->vdev->dev, data_dma_addr)) {
 		if (!firmware_has_feature(FW_FEATURE_CMO))
 			ibmveth_error_printk("tx: unable to map xmit buffer\n");
 		skb_copy_from_linear_data(skb, adapter->bounce_buffer,
-- 
1.5.6.3

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

^ permalink raw reply related

* [PATCH] powerpc/cmo: fix sysdev attribute API change fallout
From: Stephen Rothwell @ 2008-07-27 14:51 UTC (permalink / raw)
  To: Benjamin Herrenschmidt, Paul Mackerras; +Cc: Brian King, ppc-dev

Noticed due to these wanings:

arch/powerpc/platforms/pseries/cmm.c:298: warning: initialization from incompatible pointer type
arch/powerpc/platforms/pseries/cmm.c:299: warning: initialization from incompatible pointer type
arch/powerpc/platforms/pseries/cmm.c:320: warning: initialization from incompatible pointer type
arch/powerpc/platforms/pseries/cmm.c:320: warning: initialization from incompatible pointer type

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
 arch/powerpc/platforms/pseries/cmm.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

Only build tested with ppc64_defconfig.

diff --git a/arch/powerpc/platforms/pseries/cmm.c b/arch/powerpc/platforms/pseries/cmm.c
index c6b3be0..38fe32a 100644
--- a/arch/powerpc/platforms/pseries/cmm.c
+++ b/arch/powerpc/platforms/pseries/cmm.c
@@ -289,7 +289,9 @@ static int cmm_thread(void *dummy)
 }
 
 #define CMM_SHOW(name, format, args...)			\
-	static ssize_t show_##name(struct sys_device *dev, char *buf)	\
+	static ssize_t show_##name(struct sys_device *dev,	\
+				   struct sysdev_attribute *attr,	\
+				   char *buf)			\
 	{							\
 		return sprintf(buf, format, ##args);		\
 	}							\
@@ -298,12 +300,14 @@ static int cmm_thread(void *dummy)
 CMM_SHOW(loaned_kb, "%lu\n", PAGES2KB(loaned_pages));
 CMM_SHOW(loaned_target_kb, "%lu\n", PAGES2KB(loaned_pages_target));
 
-static ssize_t show_oom_pages(struct sys_device *dev, char *buf)
+static ssize_t show_oom_pages(struct sys_device *dev,
+			      struct sysdev_attribute *attr, char *buf)
 {
 	return sprintf(buf, "%lu\n", PAGES2KB(oom_freed_pages));
 }
 
 static ssize_t store_oom_pages(struct sys_device *dev,
+			       struct sysdev_attribute *attr,
 			       const char *buf, size_t count)
 {
 	unsigned long val = simple_strtoul (buf, NULL, 10);
-- 
1.5.6.3



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

^ permalink raw reply related

* Re: [PATCH] Fix powerpc64 build if CONFIG_EPOLL=n
From: Stephen Rothwell @ 2008-07-27 14:23 UTC (permalink / raw)
  To: Jimi Xenidis; +Cc: linuxppc-dev list
In-Reply-To: <B6E6E232-5793-4BBB-BD82-95B19716ACE4@watson.ibm.com>

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

Hi Jimi,

On Sun, 27 Jul 2008 08:48:09 -0400 Jimi Xenidis <jimix@watson.ibm.com> wrote:
>
> Declate compat_sys_epoll_pwait as a conditional syscall like the rest  
> of the epoll interfaces.
> We could have put an #ifdef around the entry in include/asm-powerpc/ 
> systbl.h, but IMHO this is ultimately correct patch.

Already in Linus' tree - commit 5f17156fc55abac476d180e480bedb0f07f01b14
"Fix build on COMPAT platforms when CONFIG_EPOLL is disabled"

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

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

^ permalink raw reply

* Re: [PATCH] of: i2c: improve last resort compatible entry selection
From: Jon Smirl @ 2008-07-27 14:21 UTC (permalink / raw)
  To: Grant Likely; +Cc: linuxppc-dev, devicetree-discuss
In-Reply-To: <fa686aa40807262235l47bff0bfi15d86a6e171d6775@mail.gmail.com>

On 7/27/08, Grant Likely <grant.likely@secretlab.ca> wrote:
> On Sun, Jul 27, 2008 at 1:05 AM, Jon Smirl <jonsmirl@gmail.com> wrote:
>  > On 7/26/08, Grant Likely <grant.likely@secretlab.ca> wrote:
>  >> On Mon, Jul 14, 2008 at 09:54:37PM +0400, Anton Vorontsov wrote:
>  >>  > Currently of_i2c will select first compatible property as a last resort
>  >>  > option. This isn't best choice though, because generic compatible entries
>  >>  > are listed last, not first. For example, two compatible entries given for
>  >>  > the MCU node:
>  >>  >
>  >>  > "fsl,mc9s08qg8-mpc837xrdb", "fsl,mcu-mpc8349emitx";
>  >>  >
>  >>  > Since no sane driver will ever match specific devices, what we want is
>  >>  > to select most generic option (last). Then driver may call
>  >>  > of_device_is_compatible() if it is really interested in details.
>  >>
>  >>
>  >> I highly suspect that this will actually be a rare condition and that
>  >>  most of the time the driver you want will bind against the first entry
>  >>  in the list (I'm basing this on what discussion I've seen on the list
>  >>  and it seems to me that Jiri does want i2c devices to list the exact set
>  >>  of chips that each driver binds against).
>  >
>  > Can we put a loop on request_module() and have it try each one down
>  > the list until something matches? request_module() returns errors, but
>  > I can't tell from the source if one of those errors is "no matching
>  > module found" since it invokes a user space helper.
>
>
> What will request_module() do if the modules is compiled in
>  statically?  If it is workable then I'm not opposed to this approach.

I'm no expert on request_module, from the comments:

It appears to be synchronous with user space...
	call_usermodehelper wait flag, and remove exec_usermodehelper.
	Rusty Russell <rusty@rustcorp.com.au>  Jan 2003

 * Load a module using the user mode module loader. The function returns
 * zero on success or a negative errno code on failure. Note that a
 * successful module load does not mean the module did not then unload
 * and exit on an error of its own. Callers must check that the service
 * they requested is now available not blindly invoke it.

Is this really a problem? If the specific driver gets loaded and then
errors out, then something must be wrong. The appropriate action
probably should not be to load the next driver on the list.

It looks like it should work. Compiled in moduled and modules that are
already loaded are essentially the same so they should return 0 from
request module.

>
>
>  > That would work for this compatible string:
>  > compatible = "atmel,24c32wp", "24c32", "eeprom";
>  >
>  > request_module will always fail for the first entry. If you have at24
>  > in your system the second one will succeed. If you have eeprom the
>  > third one works. All of those names are valid in a device tree.
>
>
> I know this is just an example; but to keep thinks clear, the second
>  and third values in this compatible property are completely bogus (for
>  device trees).  The manufacturer prefix needs to be present and
>  'eeprom' is far to vague.

Isn't 24c32 a generic, cross manufacturer term used for these devices?
What if I have a socket and use a different vendor's chip each week?

eeprom is the vague Linuxism that at24 is attempting to correct.
eeprom just goes and searches for anything resembling an eeprom. It
will trigger on chips that aren't eeproms.

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


-- 
Jon Smirl
jonsmirl@gmail.com

^ permalink raw reply

* Re: [PATCH 2/2] Allow a custom ASOC machine driver with soc-of-simple
From: Jon Smirl @ 2008-07-27 14:07 UTC (permalink / raw)
  To: Grant Likely; +Cc: linuxppc-dev, alsa-devel
In-Reply-To: <fa686aa40807262229r76750664v48405f13dcb84f23@mail.gmail.com>

On 7/27/08, Grant Likely <grant.likely@secretlab.ca> wrote:
> On Sun, Jul 27, 2008 at 12:44 AM, Jon Smirl <jonsmirl@gmail.com> wrote:
>  > On 7/26/08, Grant Likely <grant.likely@secretlab.ca> wrote:
>  >> On Tue, Jul 22, 2008 at 07:53:51PM -0400, Jon Smirl wrote:
>  >>
>  >> > Allow a custom ASOC machine driver with soc-of-simple
>  >>  >
>  >>  > Signed-off-by: Jon Smirl <jonsmirl@gmail.com>
>
> >>  > diff --git a/sound/soc/fsl/soc-of-simple.c b/sound/soc/fsl/soc-of-simple.c
>  >>  > index 0382fda..dd2fa23 100644
>  >>  > --- a/sound/soc/fsl/soc-of-simple.c
>  >>  > +++ b/sound/soc/fsl/soc-of-simple.c
>  >>  > @@ -38,8 +38,8 @@ struct of_snd_soc_device {
>  >>  >       struct device_node *codec_node;
>  >>  >  };
>  >>  >
>  >>  > -static struct snd_soc_ops of_snd_soc_ops = {
>  >>  > -};
>  >>  > +static struct snd_soc_ops *machine_ops = NULL;
>  >>  > +static char *machine_name = NULL;
>  >>
>  >>
>  >> Doing this prevents multiple instances of this machine driver (which is
>  >>  exactly what I have on my board).  To register a machine driver it
>  >>  creates a 3-way bind condition instead of the existing 2-way one.  Right
>  >>  now it is easy to match up codec and platform drivers because a common
>  >>  key is available in the device tree.
>  >>
>  >>  Alternately, it might be okay to only allow for a single machine driver
>  >>  that is able to create multiple sound card instances, but this current
>  >>  code just uses the same name and ops for each registered device.
>  >>
>  > We need to call them fabric drivers since we already have machine
>  > drivers in arch/.... It is too confusing.
>
>
> heh, even worse; we've already got platform drivers under drivers/.
>  :-P  I disagree.  We need to be consistent with ALSA terminology, but
>  I will be more diligent to call them ASoC Machine drivers.
>
>
>  > My fabric driver was getting probed after the rest of ASOC bound,
>  > that's why I had to add the third condition.
>  >
>  > An important feature for me is the ability to compile in multiple
>  > fabric drivers and then get the right one selected based on the
>  > machine name in the device tree.
>
>
> Absolutely; this is a hard requirement as far as I'm concerned.
>
>  It is also a hard requirement for either multiple *active* ASoC
>  machine drivers, or support ASoC machine drivers that control multiple
>  ASoC device instances.
>
>
>  >  I'm doing via my machine driver.
>  >
>  > Could we dynamically build an OF fabric device entry with a compatible
>  > string like this: compatible="machinename-fabric,generic-fabric"
>  > Now a hard requirement for a fabric driver is ok since one of those
>  > two will load for sure. generic-fabric is just a do nothing driver
>  > that is always built in.
>
>
> Ugh; unfortunately that results in Linux internal details getting
>  leaked out to the device tree.  Not a good idea; especially when we
>  *know* this driver is a stop gap measure until v2 changes things on
>  us.

It has been pointed out several times that the sound fabric (wires,
external chips) really is a device so why can't it have a device tree
entry?

ASOCv2 still has this same problem of triggering the load of the fabric driver.

The Linuxism being exposed here is the split between the machine
driver and the fabric driver. Machine drivers are dynamically selected
by the device tree. The device tree model is assuming these are
combined into a single unit.

Simulating the merge of these two two into a single unit is why I
added the platform device creation code for my fabric driver to my
machine driver. But then we run in to the problem that Linux doesn't
support device drivers that override each other. There is no way to
have a dspeak01-fabric override a generic-fabric.

One solution to the override problem would be to make an overridable
callout in the machine driver that always creates a generic-fabric
platform device. I would then set a bit in my machine driver which
would cause the name to change from generic-fabric to dspeak01-fabric.

Another Linuxism involved here is creating devices without knowing
when or if a driver is ever going to show up. You hit this when making
the ASOC devices, say we only created a dspeak01-fabric platform
device and it hasn't been probed yet. How do you know if it is safe to
assume a generic-fabric? Is dspeak01-fabric coming and it just hasn't
been probed yet, or is it never coming at all?

>
>  But that still doesn't help the question of how to trigger loading of
>  the board specific machine drivers.  grumble.  But I do think that the
>  sanest approach is still to trigger on the top level model property in
>  the tree.
>
>  Oh well, if I need to add a dummy machine driver that matches on my
>  board, then that's what I'll do.  It certainly sidesteps all the ugly
>  heuristics of figuring out when custom code is needed.
>
>
>  > /* Trigger the platform specific ASOC driver to load */
>  > static struct platform_device platform = {
>  >        .name           = "dspeak01-fabric",
>  >        .id             = -1,
>  > };
>  >
>  > static struct platform_device *devices[] = {
>  >        &platform,
>  > };
>  >
>  > static void __init digispeaker_declare_platform_devices(void)
>  > {
>  >        mpc52xx_declare_of_platform_devices();
>  >        platform_add_devices(&devices[0], ARRAY_SIZE(devices));
>  > }
>
>
> I'm not convinced that all this is necessary.  I'm partial to just
>  having the ASoC machine module probe routine check the top level board
>  property and registering the ASoC machine driver if it is a match.
>  That also eliminates needing to build knowledge of the sound circuit
>  into the PPC platform driver which helps stem the tide of
>  proliferating platform files.
>
>  g.
>
>
>
>  --
>  Grant Likely, B.Sc., P.Eng.
>  Secret Lab Technologies Ltd.
>


-- 
Jon Smirl
jonsmirl@gmail.com

^ permalink raw reply

* Re: [PATCH 1/2] leds: make the default trigger name const
From: Stephen Rothwell @ 2008-07-27 13:11 UTC (permalink / raw)
  To: Trent Piepho; +Cc: linux-kernel, linuxppc-dev, Richard Purdie
In-Reply-To: <20080727020857.GM12191@secretlab.ca>

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

Hi Trent,

On Sat, 26 Jul 2008 20:08:57 -0600 Grant Likely <grant.likely@secretlab.ca> wrote:
>
> On Fri, Jul 25, 2008 at 02:01:44PM -0700, Trent Piepho wrote:
> > The default_trigger fields of struct gpio_led and thus struct led_classdev
> > are pretty much always assigned from a string literal, which means the
> > string can't be modified.  Which is fine, since there is no reason to
> > modify the string and in fact it never is.
> > 
> > But they should be marked const to prevent such code from being added, to
> > prevent warnings if -Wwrite-strings is used and when assigned from a
> > constant string other than a string literal (which produces a warning under
> > current kernel compiler flags), and for general good coding practices.
> > 
> > Signed-off-by: Trent Piepho <tpiepho@freescale.com>
> Acked-by: Grant Likely <grant.likely@secretlab.ca>

I would ack this as well, except I am not sure what tree this patch is
against.  In the current powerpc next tree,


> > +++ b/include/linux/leds.h
> > @@ -48,7 +48,7 @@ struct led_classdev {
> >  
> >  	struct device		*dev;
> >  	struct list_head	 node;			/* LED Device list */
> > -	char			*default_trigger;	/* Trigger to use */
> > +	const char		*default_trigger;	/* Trigger to use */

this is already const, but there is another structure slightly further
down (struct led_info) that has a non-const default_tigger.

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

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

^ permalink raw reply

* [PATCH] Fix powerpc64 build if CONFIG_EPOLL=n
From: Jimi Xenidis @ 2008-07-27 12:48 UTC (permalink / raw)
  To: linuxppc-dev list

Declate compat_sys_epoll_pwait as a conditional syscall like the rest  
of the epoll interfaces.
We could have put an #ifdef around the entry in include/asm-powerpc/ 
systbl.h, but IMHO this is ultimately correct patch.

Signed-off-by: Jimi Xenidis <jimix@watson.ibm.com>
---

diff --git a/kernel/sys_ni.c b/kernel/sys_ni.c
index 5b9b467..0fea0ee 100644
--- a/kernel/sys_ni.c
+++ b/kernel/sys_ni.c
@@ -59,6 +59,7 @@ cond_syscall(sys_epoll_create);
  cond_syscall(sys_epoll_ctl);
  cond_syscall(sys_epoll_wait);
  cond_syscall(sys_epoll_pwait);
+cond_syscall(compat_sys_epoll_pwait);
  cond_syscall(sys_semget);
  cond_syscall(sys_semop);
  cond_syscall(sys_semtimedop);

^ permalink raw reply related

* Re: [PATCH 0/5] powerpc tracehook
From: Benjamin Herrenschmidt @ 2008-07-27  8:51 UTC (permalink / raw)
  To: David Miller; +Cc: linuxppc-dev, paulus, linux-kernel, roland
In-Reply-To: <20080727.005518.08712012.davem@davemloft.net>


> > Thanks for this. I haven't followed the story of tracehook so far, are
> > those patches dependent on something else or it's all already upstream
> > and do you think that's still 2.6.27 material ?
> 
> The infrastructure is in Linus's tree.

Thanks David. I'll review these on monday and if Paul has no objection,
I suppose we can still merge them.

Cheers,
Ben.

^ permalink raw reply

* Re: [PATCH 0/5] powerpc tracehook
From: David Miller @ 2008-07-27  7:55 UTC (permalink / raw)
  To: benh; +Cc: linuxppc-dev, paulus, linux-kernel, roland
In-Reply-To: <1217145165.11188.132.camel@pasglop>

From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Date: Sun, 27 Jul 2008 17:52:45 +1000

> On Sat, 2008-07-26 at 23:48 -0700, Roland McGrath wrote:
> > These patches are posted for review, but you can just pull the GIT branch
> > if you prefer.  Patch 1/5 corrects a long-standing (minor) error in ptrace
> > behavior.  The others change no existing behavior, just enable new and
> > future features to work on the arch.
> 
> Hi Roland !
> 
> Thanks for this. I haven't followed the story of tracehook so far, are
> those patches dependent on something else or it's all already upstream
> and do you think that's still 2.6.27 material ?

The infrastructure is in Linus's tree.

^ permalink raw reply

* Re: [PATCH 0/5] powerpc tracehook
From: Benjamin Herrenschmidt @ 2008-07-27  7:52 UTC (permalink / raw)
  To: Roland McGrath; +Cc: linuxppc-dev, Paul Mackerras, linux-kernel
In-Reply-To: <20080727064859.69692154280@magilla.localdomain>

On Sat, 2008-07-26 at 23:48 -0700, Roland McGrath wrote:
> These patches are posted for review, but you can just pull the GIT branch
> if you prefer.  Patch 1/5 corrects a long-standing (minor) error in ptrace
> behavior.  The others change no existing behavior, just enable new and
> future features to work on the arch.

Hi Roland !

Thanks for this. I haven't followed the story of tracehook so far, are
those patches dependent on something else or it's all already upstream
and do you think that's still 2.6.27 material ?

Cheers,
Ben.

> The following changes since commit 8be1a6d6c77ab4532e4476fdb8177030ef48b52c:
>   Linus Torvalds (1):
>         Merge branch 'for-linus' of git://git.kernel.org/.../roland/infiniband
> 
> are available in the git repository at:
> 
>   git://git.kernel.org/pub/scm/linux/kernel/git/frob/linux-2.6-utrace.git powerpc-tracehook
> 
> Roland McGrath (5):
>       powerpc: tracehook_signal_handler
>       powerpc: tracehook syscall
>       powerpc: tracehook: asm/syscall.h
>       powerpc: tracehook: TIF_NOTIFY_RESUME
>       powerpc: tracehook: CONFIG_HAVE_ARCH_TRACEHOOK
> 
>  arch/powerpc/Kconfig              |    1 +
>  arch/powerpc/kernel/entry_32.S    |   11 ++++-
>  arch/powerpc/kernel/entry_64.S    |   10 +++-
>  arch/powerpc/kernel/ptrace.c      |   47 ++++++++++-----------
>  arch/powerpc/kernel/signal.c      |   21 ++++++++-
>  include/asm-powerpc/ptrace.h      |    1 +
>  include/asm-powerpc/signal.h      |    3 +-
>  include/asm-powerpc/syscall.h     |   84 +++++++++++++++++++++++++++++++++++++
>  include/asm-powerpc/thread_info.h |    5 ++-
>  9 files changed, 147 insertions(+), 36 deletions(-)
>  create mode 100644 include/asm-powerpc/syscall.h
> 
> 
> Thanks,
> Roland
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

^ permalink raw reply

* [PATCH 5/5] powerpc: tracehook: CONFIG_HAVE_ARCH_TRACEHOOK
From: Roland McGrath @ 2008-07-27  6:53 UTC (permalink / raw)
  To: Paul Mackerras, Benjamin Herrenschmidt; +Cc: linuxppc-dev, linux-kernel
In-Reply-To: <20080727064859.69692154280@magilla.localdomain>

The powerpc arch code has all the prerequisites, so set HAVE_ARCH_TRACEHOOK.

Signed-off-by: Roland McGrath <roland@redhat.com>
---
 arch/powerpc/Kconfig |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index fe88418..587da5e 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -117,6 +117,7 @@ config PPC
 	select HAVE_KPROBES
 	select HAVE_ARCH_KGDB
 	select HAVE_KRETPROBES
+	select HAVE_ARCH_TRACEHOOK
 	select HAVE_LMB
 	select HAVE_DMA_ATTRS if PPC64
 	select USE_GENERIC_SMP_HELPERS if SMP

^ permalink raw reply related

* [PATCH 4/5] powerpc: tracehook: TIF_NOTIFY_RESUME
From: Roland McGrath @ 2008-07-27  6:52 UTC (permalink / raw)
  To: Paul Mackerras, Benjamin Herrenschmidt; +Cc: linuxppc-dev, linux-kernel
In-Reply-To: <20080727064859.69692154280@magilla.localdomain>

This adds TIF_NOTIFY_RESUME support for powerpc.  When set,
we call tracehook_notify_resume() on the way to user mode.
This overloads do_signal() to do the work, but changes its
arguments to it has the TIF_* bits handy in a register and
drops the useless first argument that was always zero.

Signed-off-by: Roland McGrath <roland@redhat.com>
---
 arch/powerpc/kernel/entry_32.S    |    4 ++--
 arch/powerpc/kernel/entry_64.S    |    3 +--
 arch/powerpc/kernel/signal.c      |   13 ++++++++++++-
 include/asm-powerpc/signal.h      |    3 +--
 include/asm-powerpc/thread_info.h |    5 ++++-
 5 files changed, 20 insertions(+), 8 deletions(-)

diff --git a/arch/powerpc/kernel/entry_32.S b/arch/powerpc/kernel/entry_32.S
index 0efc1e6..3e7445e 100644
--- a/arch/powerpc/kernel/entry_32.S
+++ b/arch/powerpc/kernel/entry_32.S
@@ -1060,8 +1060,8 @@ do_user_signal:			/* r10 contains MSR_KERNEL here */
 	SAVE_NVGPRS(r1)
 	rlwinm	r3,r3,0,0,30
 	stw	r3,_TRAP(r1)
-2:	li	r3,0
-	addi	r4,r1,STACK_FRAME_OVERHEAD
+2:	addi	r3,r1,STACK_FRAME_OVERHEAD
+	mr	r4,r9
 	bl	do_signal
 	REST_NVGPRS(r1)
 	b	recheck
diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S
index 79c089e..2d802e9 100644
--- a/arch/powerpc/kernel/entry_64.S
+++ b/arch/powerpc/kernel/entry_64.S
@@ -643,8 +643,7 @@ user_work:
 	b	.ret_from_except_lite
 
 1:	bl	.save_nvgprs
-	li	r3,0
-	addi	r4,r1,STACK_FRAME_OVERHEAD
+	addi	r3,r1,STACK_FRAME_OVERHEAD
 	bl	.do_signal
 	b	.ret_from_except
 
diff --git a/arch/powerpc/kernel/signal.c b/arch/powerpc/kernel/signal.c
index 11a5c45..060d2a8 100644
--- a/arch/powerpc/kernel/signal.c
+++ b/arch/powerpc/kernel/signal.c
@@ -112,7 +112,7 @@ static void check_syscall_restart(struct pt_regs *regs, struct k_sigaction *ka,
 	}
 }
 
-int do_signal(sigset_t *oldset, struct pt_regs *regs)
+static int do_signal_pending(sigset_t *oldset, struct pt_regs *regs)
 {
 	siginfo_t info;
 	int signr;
@@ -188,6 +188,17 @@ int do_signal(sigset_t *oldset, struct pt_regs *regs)
 	return ret;
 }
 
+void do_signal(struct pt_regs *regs, unsigned long thread_info_flags)
+{
+	if (thread_info_flags & _TIF_SIGPENDING)
+		do_signal_pending(NULL, regs);
+
+	if (thread_info_flags & _TIF_NOTIFY_RESUME) {
+		clear_thread_flag(TIF_NOTIFY_RESUME);
+		tracehook_notify_resume(regs);
+	}
+}
+
 long sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss,
 		unsigned long r5, unsigned long r6, unsigned long r7,
 		unsigned long r8, struct pt_regs *regs)
diff --git a/include/asm-powerpc/signal.h b/include/asm-powerpc/signal.h
index a8c7bab..a7360cd 100644
--- a/include/asm-powerpc/signal.h
+++ b/include/asm-powerpc/signal.h
@@ -122,8 +122,7 @@ typedef struct sigaltstack {
 
 #ifdef __KERNEL__
 struct pt_regs;
-extern int do_signal(sigset_t *oldset, struct pt_regs *regs);
-extern int do_signal32(sigset_t *oldset, struct pt_regs *regs);
+extern void do_signal(struct pt_regs *regs, unsigned long thread_info_flags);
 #define ptrace_signal_deliver(regs, cookie) do { } while (0)
 #endif /* __KERNEL__ */
 
diff --git a/include/asm-powerpc/thread_info.h b/include/asm-powerpc/thread_info.h
index a9db562..9665a26 100644
--- a/include/asm-powerpc/thread_info.h
+++ b/include/asm-powerpc/thread_info.h
@@ -108,6 +108,7 @@ static inline struct thread_info *current_thread_info(void)
 #define TIF_SECCOMP		10	/* secure computing */
 #define TIF_RESTOREALL		11	/* Restore all regs (implies NOERROR) */
 #define TIF_NOERROR		12	/* Force successful syscall return */
+#define TIF_NOTIFY_RESUME	13	/* callback before returning to user */
 #define TIF_FREEZE		14	/* Freezing for suspend */
 #define TIF_RUNLATCH		15	/* Is the runlatch enabled? */
 #define TIF_ABI_PENDING		16	/* 32/64 bit switch needed */
@@ -125,12 +126,14 @@ static inline struct thread_info *current_thread_info(void)
 #define _TIF_SECCOMP		(1<<TIF_SECCOMP)
 #define _TIF_RESTOREALL		(1<<TIF_RESTOREALL)
 #define _TIF_NOERROR		(1<<TIF_NOERROR)
+#define _TIF_NOTIFY_RESUME	(1<<TIF_NOTIFY_RESUME)
 #define _TIF_FREEZE		(1<<TIF_FREEZE)
 #define _TIF_RUNLATCH		(1<<TIF_RUNLATCH)
 #define _TIF_ABI_PENDING	(1<<TIF_ABI_PENDING)
 #define _TIF_SYSCALL_T_OR_A	(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SECCOMP)
 
-#define _TIF_USER_WORK_MASK	(_TIF_SIGPENDING | _TIF_NEED_RESCHED)
+#define _TIF_USER_WORK_MASK	(_TIF_SIGPENDING | _TIF_NEED_RESCHED | \
+				 _TIF_NOTIFY_RESUME)
 #define _TIF_PERSYSCALL_MASK	(_TIF_RESTOREALL|_TIF_NOERROR)
 
 /* Bits in local_flags */

^ permalink raw reply related

* [PATCH 3/5] powerpc: tracehook: asm/syscall.h
From: Roland McGrath @ 2008-07-27  6:51 UTC (permalink / raw)
  To: Paul Mackerras, Benjamin Herrenschmidt; +Cc: linuxppc-dev, linux-kernel
In-Reply-To: <20080727064859.69692154280@magilla.localdomain>

Add asm/syscall.h for powerpc with all the required entry points.
This will allow arch-independent tracing code for system calls.

Signed-off-by: Roland McGrath <roland@redhat.com>
---
 include/asm-powerpc/ptrace.h  |    1 +
 include/asm-powerpc/syscall.h |   84 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 85 insertions(+), 0 deletions(-)
 create mode 100644 include/asm-powerpc/syscall.h

diff --git a/include/asm-powerpc/ptrace.h b/include/asm-powerpc/ptrace.h
index 3d6e310..734e075 100644
--- a/include/asm-powerpc/ptrace.h
+++ b/include/asm-powerpc/ptrace.h
@@ -84,6 +84,7 @@ struct pt_regs {
 #ifndef __ASSEMBLY__
 
 #define instruction_pointer(regs) ((regs)->nip)
+#define user_stack_pointer(regs) ((regs)->gpr[1])
 #define regs_return_value(regs) ((regs)->gpr[3])
 
 #ifdef CONFIG_SMP
diff --git a/include/asm-powerpc/syscall.h b/include/asm-powerpc/syscall.h
new file mode 100644
index 0000000..3ced23a
--- /dev/null
+++ b/include/asm-powerpc/syscall.h
@@ -0,0 +1,84 @@
+/*
+ * Access to user system call parameters and results
+ *
+ * Copyright (C) 2008 Red Hat, Inc.  All rights reserved.
+ *
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU General Public License v.2.
+ *
+ * See asm-generic/syscall.h for descriptions of what we must do here.
+ */
+
+#ifndef _ASM_SYSCALL_H
+#define _ASM_SYSCALL_H	1
+
+#include <linux/sched.h>
+
+static inline long syscall_get_nr(struct task_struct *task,
+				  struct pt_regs *regs)
+{
+	return regs->trap == 0xc01 ? regs->gpr[0] : -1L;
+}
+
+static inline void syscall_rollback(struct task_struct *task,
+				    struct pt_regs *regs)
+{
+	regs->gpr[3] = regs->orig_gpr3;
+}
+
+static inline long syscall_get_error(struct task_struct *task,
+				     struct pt_regs *regs)
+{
+	return (regs->ccr & 0x1000) ? -regs->gpr[3] : 0;
+}
+
+static inline long syscall_get_return_value(struct task_struct *task,
+					    struct pt_regs *regs)
+{
+	return regs->gpr[3];
+}
+
+static inline void syscall_set_return_value(struct task_struct *task,
+					    struct pt_regs *regs,
+					    int error, long val)
+{
+	if (error) {
+		regs->ccr |= 0x1000L;
+		regs->gpr[3] = -error;
+	} else {
+		regs->ccr &= ~0x1000L;
+		regs->gpr[3] = val;
+	}
+}
+
+static inline void syscall_get_arguments(struct task_struct *task,
+					 struct pt_regs *regs,
+					 unsigned int i, unsigned int n,
+					 unsigned long *args)
+{
+	BUG_ON(i + n > 6);
+#ifdef CONFIG_PPC64
+	if (test_tsk_thread_flag(task, TIF_32BIT)) {
+		/*
+		 * Zero-extend 32-bit argument values.  The high bits are
+		 * garbage ignored by the actual syscall dispatch.
+		 */
+		while (n-- > 0)
+			args[n] = (u32) regs->gpr[3 + i + n];
+		return;
+	}
+#endif
+	memcpy(args, &regs->gpr[3 + i], n * sizeof(args[0]));
+}
+
+static inline void syscall_set_arguments(struct task_struct *task,
+					 struct pt_regs *regs,
+					 unsigned int i, unsigned int n,
+					 const unsigned long *args)
+{
+	BUG_ON(i + n > 6);
+	memcpy(&regs->gpr[3 + i], args, n * sizeof(args[0]));
+}
+
+#endif	/* _ASM_SYSCALL_H */

^ permalink raw reply related

* [PATCH 2/5] powerpc: tracehook syscall
From: Roland McGrath @ 2008-07-27  6:51 UTC (permalink / raw)
  To: Paul Mackerras, Benjamin Herrenschmidt; +Cc: linuxppc-dev, linux-kernel
In-Reply-To: <20080727064859.69692154280@magilla.localdomain>

This changes powerpc syscall tracing to use the new tracehook.h entry
points.  There is no change, only cleanup.

The assembly changes allow do_syscall_trace_enter() to abort the
syscall without losing the information about the original r0 value.

Signed-off-by: Roland McGrath <roland@redhat.com>
---
 arch/powerpc/kernel/entry_32.S |    7 +++++-
 arch/powerpc/kernel/entry_64.S |    7 +++++-
 arch/powerpc/kernel/ptrace.c   |   47 ++++++++++++++++++---------------------
 3 files changed, 34 insertions(+), 27 deletions(-)

diff --git a/arch/powerpc/kernel/entry_32.S b/arch/powerpc/kernel/entry_32.S
index 81c8324..0efc1e6 100644
--- a/arch/powerpc/kernel/entry_32.S
+++ b/arch/powerpc/kernel/entry_32.S
@@ -343,7 +343,12 @@ syscall_dotrace:
 	stw	r0,_TRAP(r1)
 	addi	r3,r1,STACK_FRAME_OVERHEAD
 	bl	do_syscall_trace_enter
-	lwz	r0,GPR0(r1)	/* Restore original registers */
+	/*
+	 * Restore argument registers possibly just changed.
+	 * We use the return value of do_syscall_trace_enter
+	 * for call number to look up in the table (r0).
+	 */
+	mr	r0,r3
 	lwz	r3,GPR3(r1)
 	lwz	r4,GPR4(r1)
 	lwz	r5,GPR5(r1)
diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S
index d736924..79c089e 100644
--- a/arch/powerpc/kernel/entry_64.S
+++ b/arch/powerpc/kernel/entry_64.S
@@ -214,7 +214,12 @@ syscall_dotrace:
 	bl	.save_nvgprs
 	addi	r3,r1,STACK_FRAME_OVERHEAD
 	bl	.do_syscall_trace_enter
-	ld	r0,GPR0(r1)	/* Restore original registers */
+	/*
+	 * Restore argument registers possibly just changed.
+	 * We use the return value of do_syscall_trace_enter
+	 * for the call number to look up in the table (r0).
+	 */
+	mr	r0,r3
 	ld	r3,GPR3(r1)
 	ld	r4,GPR4(r1)
 	ld	r5,GPR5(r1)
diff --git a/arch/powerpc/kernel/ptrace.c b/arch/powerpc/kernel/ptrace.c
index a5d0e78..3f9a942 100644
--- a/arch/powerpc/kernel/ptrace.c
+++ b/arch/powerpc/kernel/ptrace.c
@@ -22,6 +22,7 @@
 #include <linux/errno.h>
 #include <linux/ptrace.h>
 #include <linux/regset.h>
+#include <linux/tracehook.h>
 #include <linux/elf.h>
 #include <linux/user.h>
 #include <linux/security.h>
@@ -1013,31 +1014,24 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
 	return ret;
 }
 
-static void do_syscall_trace(void)
+/*
+ * We must return the syscall number to actually look up in the table.
+ * This can be -1L to skip running any syscall at all.
+ */
+long do_syscall_trace_enter(struct pt_regs *regs)
 {
-	/* the 0x80 provides a way for the tracing parent to distinguish
-	   between a syscall stop and SIGTRAP delivery */
-	ptrace_notify(SIGTRAP | ((current->ptrace & PT_TRACESYSGOOD)
-				 ? 0x80 : 0));
-
-	/*
-	 * this isn't the same as continuing with a signal, but it will do
-	 * for normal use.  strace only continues with a signal if the
-	 * stopping signal is not SIGTRAP.  -brl
-	 */
-	if (current->exit_code) {
-		send_sig(current->exit_code, current, 1);
-		current->exit_code = 0;
-	}
-}
+	long ret = 0;
 
-void do_syscall_trace_enter(struct pt_regs *regs)
-{
 	secure_computing(regs->gpr[0]);
 
-	if (test_thread_flag(TIF_SYSCALL_TRACE)
-	    && (current->ptrace & PT_PTRACED))
-		do_syscall_trace();
+	if (test_thread_flag(TIF_SYSCALL_TRACE) &&
+	    tracehook_report_syscall_entry(regs))
+		/*
+		 * Tracing decided this syscall should not happen.
+		 * We'll return a bogus call number to get an ENOSYS
+		 * error, but leave the original number in regs->gpr[0].
+		 */
+		ret = -1L;
 
 	if (unlikely(current->audit_context)) {
 #ifdef CONFIG_PPC64
@@ -1055,16 +1049,19 @@ void do_syscall_trace_enter(struct pt_regs *regs)
 					    regs->gpr[5] & 0xffffffff,
 					    regs->gpr[6] & 0xffffffff);
 	}
+
+	return ret ?: regs->gpr[0];
 }
 
 void do_syscall_trace_leave(struct pt_regs *regs)
 {
+	int step;
+
 	if (unlikely(current->audit_context))
 		audit_syscall_exit((regs->ccr&0x10000000)?AUDITSC_FAILURE:AUDITSC_SUCCESS,
 				   regs->result);
 
-	if ((test_thread_flag(TIF_SYSCALL_TRACE)
-	     || test_thread_flag(TIF_SINGLESTEP))
-	    && (current->ptrace & PT_PTRACED))
-		do_syscall_trace();
+	step = test_thread_flag(TIF_SINGLESTEP);
+	if (step || test_thread_flag(TIF_SYSCALL_TRACE))
+		tracehook_report_syscall_exit(regs, step);
 }

^ permalink raw reply related

* [PATCH 1/5] powerpc: tracehook_signal_handler
From: Roland McGrath @ 2008-07-27  6:49 UTC (permalink / raw)
  To: Paul Mackerras, Benjamin Herrenschmidt; +Cc: linuxppc-dev, linux-kernel
In-Reply-To: <20080727064859.69692154280@magilla.localdomain>

This makes the powerpc signal handling code call tracehook_signal_handler()
after a handler is set up.  This means that using PTRACE_SINGLESTEP to
enter a signal handler will report to ptrace on the first instruction of
the handler, instead of the second.  This is consistent with what x86 and
other machines do, and what users and debuggers want.

Signed-off-by: Roland McGrath <roland@redhat.com>
---
 arch/powerpc/kernel/signal.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/arch/powerpc/kernel/signal.c b/arch/powerpc/kernel/signal.c
index 7aada78..11a5c45 100644
--- a/arch/powerpc/kernel/signal.c
+++ b/arch/powerpc/kernel/signal.c
@@ -9,7 +9,7 @@
  * this archive for more details.
  */
 
-#include <linux/ptrace.h>
+#include <linux/tracehook.h>
 #include <linux/signal.h>
 #include <asm/uaccess.h>
 #include <asm/unistd.h>
@@ -177,6 +177,12 @@ int do_signal(sigset_t *oldset, struct pt_regs *regs)
 		 * its frame, and we can clear the TLF_RESTORE_SIGMASK flag.
 		 */
 		current_thread_info()->local_flags &= ~_TLF_RESTORE_SIGMASK;
+
+		/*
+		 * Let tracing know that we've done the handler setup.
+		 */
+		tracehook_signal_handler(signr, &info, &ka, regs,
+					 test_thread_flag(TIF_SINGLESTEP));
 	}
 
 	return ret;

^ permalink raw reply related

* [PATCH 0/5] powerpc tracehook
From: Roland McGrath @ 2008-07-27  6:48 UTC (permalink / raw)
  To: Paul Mackerras, Benjamin Herrenschmidt; +Cc: linuxppc-dev, linux-kernel

These patches are posted for review, but you can just pull the GIT branch
if you prefer.  Patch 1/5 corrects a long-standing (minor) error in ptrace
behavior.  The others change no existing behavior, just enable new and
future features to work on the arch.

The following changes since commit 8be1a6d6c77ab4532e4476fdb8177030ef48b52c:
  Linus Torvalds (1):
        Merge branch 'for-linus' of git://git.kernel.org/.../roland/infiniband

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/frob/linux-2.6-utrace.git powerpc-tracehook

Roland McGrath (5):
      powerpc: tracehook_signal_handler
      powerpc: tracehook syscall
      powerpc: tracehook: asm/syscall.h
      powerpc: tracehook: TIF_NOTIFY_RESUME
      powerpc: tracehook: CONFIG_HAVE_ARCH_TRACEHOOK

 arch/powerpc/Kconfig              |    1 +
 arch/powerpc/kernel/entry_32.S    |   11 ++++-
 arch/powerpc/kernel/entry_64.S    |   10 +++-
 arch/powerpc/kernel/ptrace.c      |   47 ++++++++++-----------
 arch/powerpc/kernel/signal.c      |   21 ++++++++-
 include/asm-powerpc/ptrace.h      |    1 +
 include/asm-powerpc/signal.h      |    3 +-
 include/asm-powerpc/syscall.h     |   84 +++++++++++++++++++++++++++++++++++++
 include/asm-powerpc/thread_info.h |    5 ++-
 9 files changed, 147 insertions(+), 36 deletions(-)
 create mode 100644 include/asm-powerpc/syscall.h


Thanks,
Roland

^ permalink raw reply

* Re: [PATCH] powerpc: Use new printk extension %pS to print symbols on oops
From: David Woodhouse @ 2008-07-27  5:40 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: linuxppc-dev
In-Reply-To: <alpine.LFD.1.10.0807071006270.11076@woody.linux-foundation.org>

On Mon, 2008-07-07 at 10:08 -0700, Linus Torvalds wrote:
> On Mon, 7 Jul 2008, Benjamin Herrenschmidt wrote:
> >
> > This changes the oops and backtrace code to use the new %pS
> > printk extension to print out symbols rather than manually
> > calling print_symbol.
> 
> Ok, I ended up committing the suppor for '%pS' early (as a series of 
> smaller patches to make it clearer), just because it makes it easier for 
> different people to start converthing things with the infrastructure in 
> place.

Out of interest, why is it %pS and not %Sp? Shouldn't the modifier come
first? What if we want to print a pointer immediately followed by a
capital S?

-- 
David Woodhouse                            Open Source Technology Centre
David.Woodhouse@intel.com                              Intel Corporation

^ permalink raw reply

* Re: [PATCH] of: i2c: improve last resort compatible entry selection
From: Grant Likely @ 2008-07-27  5:35 UTC (permalink / raw)
  To: Jon Smirl; +Cc: linuxppc-dev, devicetree-discuss
In-Reply-To: <9e4733910807262205l2db8d662u9dd2e517282686f8@mail.gmail.com>

On Sun, Jul 27, 2008 at 1:05 AM, Jon Smirl <jonsmirl@gmail.com> wrote:
> On 7/26/08, Grant Likely <grant.likely@secretlab.ca> wrote:
>> On Mon, Jul 14, 2008 at 09:54:37PM +0400, Anton Vorontsov wrote:
>>  > Currently of_i2c will select first compatible property as a last resort
>>  > option. This isn't best choice though, because generic compatible entries
>>  > are listed last, not first. For example, two compatible entries given for
>>  > the MCU node:
>>  >
>>  > "fsl,mc9s08qg8-mpc837xrdb", "fsl,mcu-mpc8349emitx";
>>  >
>>  > Since no sane driver will ever match specific devices, what we want is
>>  > to select most generic option (last). Then driver may call
>>  > of_device_is_compatible() if it is really interested in details.
>>
>>
>> I highly suspect that this will actually be a rare condition and that
>>  most of the time the driver you want will bind against the first entry
>>  in the list (I'm basing this on what discussion I've seen on the list
>>  and it seems to me that Jiri does want i2c devices to list the exact set
>>  of chips that each driver binds against).
>
> Can we put a loop on request_module() and have it try each one down
> the list until something matches? request_module() returns errors, but
> I can't tell from the source if one of those errors is "no matching
> module found" since it invokes a user space helper.

What will request_module() do if the modules is compiled in
statically?  If it is workable then I'm not opposed to this approach.

> That would work for this compatible string:
> compatible = "atmel,24c32wp", "24c32", "eeprom";
>
> request_module will always fail for the first entry. If you have at24
> in your system the second one will succeed. If you have eeprom the
> third one works. All of those names are valid in a device tree.

I know this is just an example; but to keep thinks clear, the second
and third values in this compatible property are completely bogus (for
device trees).  The manufacturer prefix needs to be present and
'eeprom' is far to vague.

g.


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

^ permalink raw reply

* Re: [PATCH 2/2] Allow a custom ASOC machine driver with soc-of-simple
From: Grant Likely @ 2008-07-27  5:29 UTC (permalink / raw)
  To: Jon Smirl; +Cc: linuxppc-dev, alsa-devel
In-Reply-To: <9e4733910807262144l7be98192l95dd526bf08e0434@mail.gmail.com>

On Sun, Jul 27, 2008 at 12:44 AM, Jon Smirl <jonsmirl@gmail.com> wrote:
> On 7/26/08, Grant Likely <grant.likely@secretlab.ca> wrote:
>> On Tue, Jul 22, 2008 at 07:53:51PM -0400, Jon Smirl wrote:
>>
>> > Allow a custom ASOC machine driver with soc-of-simple
>>  >
>>  > Signed-off-by: Jon Smirl <jonsmirl@gmail.com>
>>  > diff --git a/sound/soc/fsl/soc-of-simple.c b/sound/soc/fsl/soc-of-simple.c
>>  > index 0382fda..dd2fa23 100644
>>  > --- a/sound/soc/fsl/soc-of-simple.c
>>  > +++ b/sound/soc/fsl/soc-of-simple.c
>>  > @@ -38,8 +38,8 @@ struct of_snd_soc_device {
>>  >       struct device_node *codec_node;
>>  >  };
>>  >
>>  > -static struct snd_soc_ops of_snd_soc_ops = {
>>  > -};
>>  > +static struct snd_soc_ops *machine_ops = NULL;
>>  > +static char *machine_name = NULL;
>>
>>
>> Doing this prevents multiple instances of this machine driver (which is
>>  exactly what I have on my board).  To register a machine driver it
>>  creates a 3-way bind condition instead of the existing 2-way one.  Right
>>  now it is easy to match up codec and platform drivers because a common
>>  key is available in the device tree.
>>
>>  Alternately, it might be okay to only allow for a single machine driver
>>  that is able to create multiple sound card instances, but this current
>>  code just uses the same name and ops for each registered device.
>>
> We need to call them fabric drivers since we already have machine
> drivers in arch/.... It is too confusing.

heh, even worse; we've already got platform drivers under drivers/.
:-P  I disagree.  We need to be consistent with ALSA terminology, but
I will be more diligent to call them ASoC Machine drivers.

> My fabric driver was getting probed after the rest of ASOC bound,
> that's why I had to add the third condition.
>
> An important feature for me is the ability to compile in multiple
> fabric drivers and then get the right one selected based on the
> machine name in the device tree.

Absolutely; this is a hard requirement as far as I'm concerned.

It is also a hard requirement for either multiple *active* ASoC
machine drivers, or support ASoC machine drivers that control multiple
ASoC device instances.

>  I'm doing via my machine driver.
>
> Could we dynamically build an OF fabric device entry with a compatible
> string like this: compatible="machinename-fabric,generic-fabric"
> Now a hard requirement for a fabric driver is ok since one of those
> two will load for sure. generic-fabric is just a do nothing driver
> that is always built in.

Ugh; unfortunately that results in Linux internal details getting
leaked out to the device tree.  Not a good idea; especially when we
*know* this driver is a stop gap measure until v2 changes things on
us.

But that still doesn't help the question of how to trigger loading of
the board specific machine drivers.  grumble.  But I do think that the
sanest approach is still to trigger on the top level model property in
the tree.

Oh well, if I need to add a dummy machine driver that matches on my
board, then that's what I'll do.  It certainly sidesteps all the ugly
heuristics of figuring out when custom code is needed.

> /* Trigger the platform specific ASOC driver to load */
> static struct platform_device platform = {
>        .name           = "dspeak01-fabric",
>        .id             = -1,
> };
>
> static struct platform_device *devices[] = {
>        &platform,
> };
>
> static void __init digispeaker_declare_platform_devices(void)
> {
>        mpc52xx_declare_of_platform_devices();
>        platform_add_devices(&devices[0], ARRAY_SIZE(devices));
> }

I'm not convinced that all this is necessary.  I'm partial to just
having the ASoC machine module probe routine check the top level board
property and registering the ASoC machine driver if it is a match.
That also eliminates needing to build knowledge of the sound circuit
into the PPC platform driver which helps stem the tide of
proliferating platform files.

g.


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

^ permalink raw reply

* [PATCH 6/6] show processor cache information in sysfs
From: Nathan Lynch @ 2008-07-27  5:24 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: linuxppc-dev, Paul Mackerras
In-Reply-To: <1217136295-18693-1-git-send-email-ntl@pobox.com>

Collect cache information from the OF device tree and display it in
the cpu hierarchy in sysfs.  This is intended to be compatible at the
userspace level with x86's implementation[1], hence some of the funny
attribute names.  The arrangement of cache info is not immediately
intuitive, but (again) it's for compatibility's sake.

The cache attributes exposed are:

type (Data, Instruction, or Unified)
level (1, 2, 3...)
size
coherency_line_size
number_of_sets
ways_of_associativity

All of these can be derived on platforms that follow the OF PowerPC
Processor binding.  The code "publishes" only those attributes for
which it is able to determine values; attributes for values which
cannot be determined are not created at all.

[1] arch/x86/kernel/cpu/intel_cacheinfo.c

Signed-off-by: Nathan Lynch <ntl@pobox.com>
---
 arch/powerpc/kernel/sysfs.c |  308 +++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 308 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/kernel/sysfs.c b/arch/powerpc/kernel/sysfs.c
index 1568080..7f56cc8 100644
--- a/arch/powerpc/kernel/sysfs.c
+++ b/arch/powerpc/kernel/sysfs.c
@@ -22,6 +22,8 @@
 
 static DEFINE_PER_CPU(struct cpu, cpu_devices);
 
+static DEFINE_PER_CPU(struct kobject *, cache_toplevel);
+
 /* SMT stuff */
 
 #ifdef CONFIG_PPC_MULTIPLATFORM
@@ -297,6 +299,286 @@ static struct sysdev_attribute pa6t_attrs[] = {
 #endif /* CONFIG_DEBUG_KERNEL */
 };
 
+struct cache_desc {
+	struct kobject kobj;
+	struct cache_desc *next;
+	const char *type;	/* Instruction, Data, or Unified */
+	u32 size;		/* total cache size in KB */
+	u32 line_size;		/* in bytes */
+	u32 nr_sets;		/* number of sets */
+	u32 level;		/* e.g. 1, 2, 3... */
+	u32 associativity;	/* e.g. 8-way... 0 is fully associative */
+};
+
+DEFINE_PER_CPU(struct cache_desc *, cache_desc);
+
+static struct cache_desc *kobj_to_cache_desc(struct kobject *k)
+{
+	return container_of(k, struct cache_desc, kobj);
+}
+
+static void cache_desc_release(struct kobject *k)
+{
+	struct cache_desc *desc = kobj_to_cache_desc(k);
+
+	printk("releasing %s\n", kobject_name(k));
+
+	if (desc->next)
+		kobject_put(&desc->next->kobj);
+
+	kfree(kobj_to_cache_desc(k));
+}
+
+static ssize_t cache_desc_show(struct kobject *k, struct attribute *attr, char *buf)
+{
+	struct kobj_attribute *kobj_attr;
+
+	kobj_attr = container_of(attr, struct kobj_attribute, attr);
+
+	return kobj_attr->show(k, kobj_attr, buf);
+}
+
+static struct sysfs_ops cache_desc_sysfs_ops = {
+	.show = cache_desc_show,
+};
+
+static struct kobj_type cache_desc_type = {
+	.release = cache_desc_release,
+	.sysfs_ops = &cache_desc_sysfs_ops,
+};
+
+static ssize_t cache_size_show(struct kobject *k, struct kobj_attribute *attr, char *buf)
+{
+	struct cache_desc *cache = kobj_to_cache_desc(k);
+
+	return sprintf(buf, "%uK\n", cache->size);
+}
+
+static struct kobj_attribute cache_size_attr =
+	__ATTR(size, 0444, cache_size_show, NULL);
+
+static ssize_t cache_line_size_show(struct kobject *k, struct kobj_attribute *attr, char *buf)
+{
+	struct cache_desc *cache = kobj_to_cache_desc(k);
+
+	return sprintf(buf, "%u\n", cache->line_size);
+}
+
+static struct kobj_attribute cache_line_size_attr =
+	__ATTR(coherency_line_size, 0444, cache_line_size_show, NULL);
+
+static ssize_t cache_nr_sets_show(struct kobject *k, struct kobj_attribute *attr, char *buf)
+{
+	struct cache_desc *cache = kobj_to_cache_desc(k);
+
+	return sprintf(buf, "%u\n", cache->nr_sets);
+}
+
+static struct kobj_attribute cache_nr_sets_attr =
+	__ATTR(number_of_sets, 0444, cache_nr_sets_show, NULL);
+
+static ssize_t cache_type_show(struct kobject *k, struct kobj_attribute *attr, char *buf)
+{
+	struct cache_desc *cache = kobj_to_cache_desc(k);
+
+	return sprintf(buf, "%s\n", cache->type);
+}
+
+static struct kobj_attribute cache_type_attr =
+	__ATTR(type, 0444, cache_type_show, NULL);
+
+static ssize_t cache_level_show(struct kobject *k, struct kobj_attribute *attr, char *buf)
+{
+	struct cache_desc *cache = kobj_to_cache_desc(k);
+
+	return sprintf(buf, "%u\n", cache->level);
+}
+
+static struct kobj_attribute cache_level_attr =
+	__ATTR(level, 0444, cache_level_show, NULL);
+
+static ssize_t cache_assoc_show(struct kobject *k, struct kobj_attribute *attr, char *buf)
+{
+	struct cache_desc *cache = kobj_to_cache_desc(k);
+
+	return sprintf(buf, "%u\n", cache->associativity);
+}
+
+static struct kobj_attribute cache_assoc_attr =
+	__ATTR(ways_of_associativity, 0444, cache_assoc_show, NULL);
+
+struct cache_desc_info {
+	const char *type;
+	const char *size_prop;
+	const char *line_size_prop;
+	const char *nr_sets_prop;
+};
+
+/* PowerPC Processor binding says the [di]-cache-* must be equal on
+ * unified caches, so just use d-cache properties. */
+static struct cache_desc_info ucache_info = {
+	.type = "Unified",
+	.size_prop = "d-cache-size",
+	.line_size_prop = "d-cache-line-size",
+	.nr_sets_prop = "d-cache-sets",
+};
+
+static struct cache_desc_info dcache_info = {
+	.type = "Data",
+	.size_prop = "d-cache-size",
+	.line_size_prop = "d-cache-line-size",
+	.nr_sets_prop = "d-cache-sets",
+};
+
+static struct cache_desc_info icache_info = {
+	.type = "Instruction",
+	.size_prop = "i-cache-size",
+	.line_size_prop = "i-cache-line-size",
+	.nr_sets_prop = "i-cache-sets",
+};
+
+static struct cache_desc * __cpuinit create_cache_desc(struct device_node *np, struct kobject *parent, int index, int level, struct cache_desc_info *info)
+{
+	const u32 *cache_line_size;
+	struct cache_desc *new;
+	const u32 *cache_size;
+	const u32 *nr_sets;
+	int rc;
+
+	new = kzalloc(sizeof(*new), GFP_KERNEL);
+	if (!new)
+		return NULL;
+
+	rc = kobject_init_and_add(&new->kobj, &cache_desc_type, parent,
+				  "index%d", index);
+	if (rc)
+		goto err;
+
+	/* type */
+	new->type = info->type;
+	rc = sysfs_create_file(&new->kobj, &cache_type_attr.attr);
+	WARN_ON(rc);
+
+	/* level */
+	new->level = level;
+	rc = sysfs_create_file(&new->kobj, &cache_level_attr.attr);
+	WARN_ON(rc);
+
+	/* size */
+	cache_size = of_get_property(np, info->size_prop, NULL);
+	if (cache_size) {
+		new->size = *cache_size / 1024;
+		rc = sysfs_create_file(&new->kobj,
+				       &cache_size_attr.attr);
+		WARN_ON(rc);
+	}
+
+	/* coherency_line_size */
+	cache_line_size = of_get_property(np, info->line_size_prop, NULL);
+	if (cache_line_size) {
+		new->line_size = *cache_line_size;
+		rc = sysfs_create_file(&new->kobj,
+				       &cache_line_size_attr.attr);
+		WARN_ON(rc);
+	}
+
+	/* number_of_sets */
+	nr_sets = of_get_property(np, info->nr_sets_prop, NULL);
+	if (nr_sets) {
+		new->nr_sets = *nr_sets;
+		rc = sysfs_create_file(&new->kobj,
+				       &cache_nr_sets_attr.attr);
+		WARN_ON(rc);
+	}
+
+	/* ways_of_associativity */
+	if (new->nr_sets == 1) {
+		/* fully associative */
+		new->associativity = 0;
+		goto create_assoc;
+	}
+
+	if (new->nr_sets && new->size && new->line_size) {
+		/* If we have values for all of these we can derive
+		 * the associativity. */
+		new->associativity =
+			((new->size * 1024) / new->nr_sets) / new->line_size;
+create_assoc:
+		rc = sysfs_create_file(&new->kobj,
+				       &cache_assoc_attr.attr);
+		WARN_ON(rc);
+	}
+
+	return new;
+err:
+	kfree(new);
+	return NULL;
+}
+
+static bool cache_is_unified(struct device_node *np)
+{
+	return of_get_property(np, "cache-unified", NULL);
+}
+
+static struct cache_desc * __cpuinit create_cache_index_info(struct device_node *np, struct kobject *parent, int index, int level)
+{
+	const phandle *next_cache_phandle;
+	struct device_node *next_cache;
+	struct cache_desc *new, **end;
+
+	printk("%s(np = %s, index = %d)\n", __func__, np->name, index);
+	if (cache_is_unified(np)) {
+		new = create_cache_desc(np, parent, index, level,
+					&ucache_info);
+	} else {
+		new = create_cache_desc(np, parent, index, level,
+					&dcache_info);
+		if (new) {
+			index++;
+			new->next = create_cache_desc(np, parent, index, level,
+						      &icache_info);
+		}
+	}
+	if (!new)
+		return NULL;
+
+	end = &new->next;
+	while (*end)
+		end = &(*end)->next;
+
+	next_cache_phandle = of_get_property(np, "l2-cache", NULL);
+	if (!next_cache_phandle)
+		goto out;
+
+	next_cache = of_find_node_by_phandle(*next_cache_phandle);
+	if (!next_cache)
+		goto out;
+
+	*end = create_cache_index_info(next_cache, parent, ++index, ++level);
+
+	of_node_put(next_cache);
+out:
+	return new;
+}
+
+static void __cpuinit create_cache_info(struct sys_device *sysdev)
+{
+	struct kobject *cache_toplevel;
+	struct device_node *np = NULL;
+	int cpu = sysdev->id;
+
+	cache_toplevel = kobject_create_and_add("cache", &sysdev->kobj);
+	if (!cache_toplevel)
+		return;
+	per_cpu(cache_toplevel, cpu) = cache_toplevel;
+
+	np = of_get_cpu_node(cpu, NULL);
+	per_cpu(cache_desc, cpu) =
+		create_cache_index_info(np, cache_toplevel, 0, 1);
+	of_node_put(np);
+
+	return;
+}
 
 static void __cpuinit register_cpu_online(unsigned int cpu)
 {
@@ -346,9 +628,33 @@ static void __cpuinit register_cpu_online(unsigned int cpu)
 
 	if (cpu_has_feature(CPU_FTR_DSCR))
 		sysdev_create_file(s, &attr_dscr);
+
+	create_cache_info(s);
 }
 
 #ifdef CONFIG_HOTPLUG_CPU
+static void remove_cache_info(struct sys_device *sysdev)
+{
+	struct kobject *cache_toplevel;
+	struct cache_desc *cache_desc;
+	int cpu = sysdev->id;
+
+	cache_desc = per_cpu(cache_desc, cpu);
+
+	sysfs_remove_file(&cache_desc->kobj, &cache_size_attr.attr);
+	sysfs_remove_file(&cache_desc->kobj, &cache_line_size_attr.attr);
+	sysfs_remove_file(&cache_desc->kobj, &cache_type_attr.attr);
+	sysfs_remove_file(&cache_desc->kobj, &cache_level_attr.attr);
+	sysfs_remove_file(&cache_desc->kobj, &cache_nr_sets_attr.attr);
+	sysfs_remove_file(&cache_desc->kobj, &cache_assoc_attr.attr);
+
+	kobject_put(&cache_desc->kobj);
+
+	cache_toplevel = per_cpu(cache_toplevel, cpu);
+
+	kobject_put(cache_toplevel);
+}
+
 static void unregister_cpu_online(unsigned int cpu)
 {
 	struct cpu *c = &per_cpu(cpu_devices, cpu);
@@ -399,6 +705,8 @@ static void unregister_cpu_online(unsigned int cpu)
 
 	if (cpu_has_feature(CPU_FTR_DSCR))
 		sysdev_remove_file(s, &attr_dscr);
+
+	remove_cache_info(s);
 }
 #endif /* CONFIG_HOTPLUG_CPU */
 
-- 
1.5.6.2

^ permalink raw reply related


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