Re: [RFC][PATCH] Kexec support for PPC440x

2011-06-01 Thread Suzuki Poulose

On 05/31/11 20:45, Sebastian Andrzej Siewior wrote:


Suzuki Poulose wrote:

Index: powerpc/arch/powerpc/kernel/44x_kexec_mapping.S
===
--- /dev/null
+++ powerpc/arch/powerpc/kernel/44x_kexec_mapping.S




+ *
+ */
+ bl nxtins /* Find our address */
+nxtins: mflr r5 /* Make it accessible */


Please don't mix labels and instructions.

OK.



+ tlbsx r23,0,r5 /* Find entry we are in */


using tabs instead of spaces would make it look nice. Please also separate the 
arguments of the instruction i.e.
tlbsx r23, 0, r5


Sure.




Index: powerpc/arch/powerpc/kernel/misc_32.S
===
--- powerpc.orig/arch/powerpc/kernel/misc_32.S
+++ powerpc/arch/powerpc/kernel/misc_32.S
@@ -736,6 +736,28 @@ relocate_new_kernel:
mr r5, r31

li r0, 0
+#elif defined(CONFIG_44x) && !defined(CONFIG_47x)
+
+ mr r29, r3
+ mr r30, r4
+ mr r31, r5
+
+#include "44x_kexec_mapping.S"


The way you setup the 1:1 mapping should be close to what you are doing on
kernel entry.Isn't it possible to include the file here and in the entry
code?

I will make this change and resend the patch.

Thanks

Suzuki
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: [RFT][PATCH 3.0] ssb: fix PCI(e) driver regression causing oops on PCI cards

2011-06-01 Thread Christian Kujau
On Thu, 2 Jun 2011 at 08:13, Rafał Miłecki wrote:
> John, I'm afraid more and more people get angry at me because of this ;)

Erm, I'm not angry at anyone :-) On the contrary, I'm happy about the fix 
so quickly available!

Though I'm a bit afraid of the next git bisect session, as it might not be 
so straightforward than this one...

Thanks to all involved,
Christian.
-- 
BOFH excuse #230:

Lusers learning curve appears to be fractal
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Re: 3.0-rc1: powerpc hangs at Kernel virtual memory layout

2011-06-01 Thread Christian Kujau
On Thu, 2 Jun 2011 at 08:07, Rafał Miłecki wrote:
> 1) You didn't see (like Andres):
> Machine check in kernel mode.
>  Caused by (from SRR1=149030): Transfer error ack signal
>  Oops: Machine check, sig: 7 [#1]
> But, OK, maybe machine check requires something additional in kernel,
> I don't know...
> 
> 2) You didn't see SSB messages
> This is confusing. You should see SSB messages that appear before my
> invalid read happens. Did you somehow disable most of the important
> logs, or sth? Having ssb messages and the end of hung boot would
> directly point you to ssb module.

BenH advised to boot with udbg-immortal and out came:

 http://nerdbynature.de/bits/3.0-rc1/linux-3.0_powerpc_2.jpg
 http://nerdbynature.de/bits/3.0-rc1/linux-3.0_powerpc_2.mp4
 (watch it at very slow speed, as it's only 3sec long)

I've enabled[0] FB_NVIDIA and during normal booting the screen flickers 
after the "... : fixmap" message and the screen clears and is filled again 
from the top - maybe the messages would've been there if booted w/o the 
framebuffer enabled.

Right now I'm happy that Ben's fix helped to get past this message, but 
the system remains unsuable[1] with the latest -git, but more debugging 
has to wait until tomorrow...

Thanks,
Christian.

[0] http://nerdbynature.de/bits/3.0-rc1/config-2.6.39.txt
[1] https://lkml.org/lkml/2011/6/2/6
-- 
BOFH excuse #230:

Lusers learning curve appears to be fractal
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Re: [RFT][PATCH 3.0] ssb: fix PCI(e) driver regression causing oops on PCI cards

2011-06-01 Thread Rafał Miłecki
2011/6/1 Rafał Miłecki :
> 2011/6/1 Rafał Miłecki :
>> We were incorrectly executing PCIe specific workarounds on PCI cards.
>> This resulted in:
>> Machine check in kernel mode.
>> Caused by (from SRR1=149030): Transfer error ack signal
>> Oops: Machine check, sig: 7 [#1]
>
> John, I've tested this patch myself on my PCI BCM4318, including
> checking for 0x reads in MMIO dumps.
>
> The patch is correct, please take it for 3.0.

John, I'm afraid more and more people get angry at me because of this ;)

Christian Kujau confirmed this problem and fix.

-- 
Rafał
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Re: 3.0-rc1: powerpc hangs at Kernel virtual memory layout

2011-06-01 Thread Rafał Miłecki
On Tue, 31 May 2011 at 16:50, Christian Kujau wrote:
> trying to boot 3.0-rc1 on powerpc32 only progresses until:
>
>   > Kernel virtual memory layout:
>   >   * 0xfffcf000..0xf000  : fixmap

The weird thing is that:

1) You didn't see (like Andres):
Machine check in kernel mode.
 Caused by (from SRR1=149030): Transfer error ack signal
 Oops: Machine check, sig: 7 [#1]
But, OK, maybe machine check requires something additional in kernel,
I don't know...

2) You didn't see SSB messages
This is confusing. You should see SSB messages that appear before my
invalid read happens. Did you somehow disable most of the important
logs, or sth? Having ssb messages and the end of hung boot would
directly point you to ssb module.

-- 
Rafał
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Re: 3.0-rc1: powerpc hangs at Kernel virtual memory layout

2011-06-01 Thread Rafał Miłecki
2011/6/2 Christian Kujau :
> On Tue, 31 May 2011 at 16:50, Christian Kujau wrote:
>> trying to boot 3.0-rc1 on powerpc32 only progresses until:
>>
>>   > Kernel virtual memory layout:
>>   >   * 0xfffcf000..0xf000  : fixmap
>
> After hours (and hours!) of git-bisecting, it said:
>
> ---
> ccc7c28af205888798b51b6cbc0b557ac1170a49 is the first bad commit
> commit ccc7c28af205888798b51b6cbc0b557ac1170a49
> Author: Rafał Miłecki 
> Date:   Fri Apr 1 13:26:52 2011 +0200
>
>    ssb: pci: implement serdes workaround
>
>    Signed-off-by: Rafał Miłecki 
>    Signed-off-by: John W. Linville 
> ---

I'm for the problem :(

Patch was already send yesterday, I've even CCed linuxppc-dev:
[RFT][PATCH 3.0] ssb: fix PCI(e) driver regression causing oops on PCI cards

-- 
Rafał
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Re: [PATCH] Fix build warning of the defconfigs

2011-06-01 Thread Paul Mundt
On Thu, Jun 02, 2011 at 12:29:23AM +0800, Wanlong Gao wrote:
> RTC_CLASS is changed to bool.
> So value 'm' is invalid.
> 
> Signed-off-by: Wanlong Gao 

>  arch/sh/configs/titan_defconfig|2 +-

Acked-by: Paul Mundt 
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: 3.0-rc1: powerpc hangs at Kernel virtual memory layout

2011-06-01 Thread Christian Kujau
On Thu, 2 Jun 2011 at 12:57, Benjamin Herrenschmidt wrote:
> Ok, thanks a lot, It looks rather trivial actually: That new workaround
> is PCIe specific but is called unconditionally, and will do bad things
> non-PCIe implementations.

OK, with your patch applied to Linus' latest git tree the machine 
continues to boot. Also, with the latest tree, the "machine is stuck after 
ide-cd init" problem[0] went away.

For this particular problem and patch, feel free to add:

Tested-by: Christian Kujau 

However, shortly after boot and loggin in to the box remotely, the bux did 
not respond any more. I'm not sure if these are related to those SSB/PCIe 
changes, but somehow I hope they are - bisecting those would take much 
longer, as it's not an "instant" death:

 * http://nerdbynature.de/bits/3.0-rc1/linux-3.0-rc1_stuck1.jpg
 * http://nerdbynature.de/bits/3.0-rc1/linux-3.0-rc1_stuck2.jpg

This is what an OCR program made of it:

irq euent stamp: 185804850
hardirqs last enabled at (185904849): [] 
_raw_spin_unlock_irqrestore+0x40/0x?e
hardirqs last disabled at (185904850): [] reenable_mmu+0x24/0x78
Softirqs last enabled at (185892414): [] call_do_softirq+0x14/0x24
softirqs last disabled at (18589240?): [] call_do_softirq+0x14/0x24
NIP: e04005b4 LR: e04005b0 CTR: 
REGS: ef92be10 TRHP: 0901 Not tainted (3.0.0-rel-00049-g1fa?b6a-dirtg)
MSB: 9032  CR: 42002084
TRSK = ef8d[38B] ’kuorker/0:2’ THREAD:
GPR00: c04005b0 ef92bec0 efBd 0001
GPR08:  0b14aed0 0049a306 00030600
HIP [c01005b1] _rau_spin_unlock_irqrestore+0x44/0x?c
LR [c04005b0] _rau_spin_unlock_irqrestore+0x40/0x?c
Call Trace:
[ef92bec0] [c04005b0] _raw_spin_unlock_irqrestore+0x40/0x?c (unreliable)
[ef92bed0] [c029c504] flush_tu_ldisc+0x121/0x230
[ef92bf10] [c001c86c] process_one_uork+0x1c1/0x4cB
[ef92bfS0] [c004efac] worker_thread+0x1?8/0x3c1
[ef92bf90] [c0051148] kthread+0x81/0x88
[ef92hff0] [c0810390] kernel_thread+0x1c/0x68

XER: 2000
ef92a000 ef8d0660 0006  18614000 22002088
Instruction dump:
??? 93e1060c ?c9f23?B 3881 90010011 4bc6e9a9 ?fc3i`3?8 4be61a69
?3e08080 11820021 1bc6b515 ?fe00124
B8c16008 ?c0803a6 83c1000c

Well, the picture is way better :-\

Thanks,
Christian.

[0] http://nerdbynature.de/bits/3.0-rc1/linux-3.0-rc1-cdrom.jpg
-- 
BOFH excuse #399:

We are a 100% Microsoft Shop.
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Re: 3.0-rc1: powerpc hangs at Kernel virtual memory layout

2011-06-01 Thread Christian Kujau
On Thu, 2 Jun 2011 at 12:57, Benjamin Herrenschmidt wrote:
> Ok, thanks a lot, It looks rather trivial actually: That new workaround
> is PCIe specific but is called unconditionally, and will do bad things
> non-PCIe implementations.

Indeed. This PowerBook G4 does not has PCIe, yet the whole SSB thingy gets 
enabled in my .config somehow. Thanks for the quick fix, I tried to revert 
ccc7c28af2... from Linus' current tree, but I had to rip out some more to 
make it compile.

I'll try your fix in a minute and get back to you with those cdrom init 
problems as well.

Thanks,
Christian.
-- 
BOFH excuse #166:

/pub/lunch
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: 3.0-rc1: powerpc hangs at Kernel virtual memory layout

2011-06-01 Thread Benjamin Herrenschmidt
On Wed, 2011-06-01 at 17:16 -0700, Christian Kujau wrote:
> On Tue, 31 May 2011 at 16:50, Christian Kujau wrote:
> > trying to boot 3.0-rc1 on powerpc32 only progresses until:
> > 
> >   > Kernel virtual memory layout:
> >   >   * 0xfffcf000..0xf000  : fixmap
> 
> After hours (and hours!) of git-bisecting, it said:
> 
> ---
> ccc7c28af205888798b51b6cbc0b557ac1170a49 is the first bad commit
> commit ccc7c28af205888798b51b6cbc0b557ac1170a49
> Author: Rafał Miłecki 
> Date:   Fri Apr 1 13:26:52 2011 +0200
> 
> ssb: pci: implement serdes workaround
> 
> Signed-off-by: Rafał Miłecki 
> Signed-off-by: John W. Linville 
> ---

Ok, thanks a lot, It looks rather trivial actually: That new workaround
is PCIe specific but is called unconditionally, and will do bad things
non-PCIe implementations.

John, care to send the patch below to Linus ASAP ? I could reproduce and
verify it fixes it. Thanks !

ssb: pci: Don't call PCIe specific workarounds on PCI cores

Otherwise it can/will crash

Signed-off-by: Benjamin Herrenschmidt 
---

diff --git a/drivers/ssb/driver_pcicore.c b/drivers/ssb/driver_pcicore.c
index 82feb34..eddf1b9 100644
--- a/drivers/ssb/driver_pcicore.c
+++ b/drivers/ssb/driver_pcicore.c
@@ -540,7 +540,8 @@ void ssb_pcicore_init(struct ssb_pcicore *pc)
ssb_pcicore_init_clientmode(pc);
 
/* Additional always once-executed workarounds */
-   ssb_pcicore_serdes_workaround(pc);
+   if (dev->id.coreid == SSB_DEV_PCIE)
+   ssb_pcicore_serdes_workaround(pc);
/* TODO: ASPM */
/* TODO: Clock Request Update */
 }


___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Re: [PATCH] Fix build warning of the defconfigs

2011-06-01 Thread Guan Xuetao
On Thu, 2011-06-02 at 00:29 +0800, Wanlong Gao wrote:
> RTC_CLASS is changed to bool.
> So value 'm' is invalid.
> 
> Signed-off-by: Wanlong Gao 
> ---
>  arch/arm/configs/davinci_all_defconfig |2 +-
>  arch/arm/configs/mxs_defconfig |2 +-
>  arch/arm/configs/netx_defconfig|2 +-
>  arch/arm/configs/viper_defconfig   |2 +-
>  arch/arm/configs/xcep_defconfig|2 +-
>  arch/arm/configs/zeus_defconfig|2 +-
>  arch/avr32/configs/atngw100_mrmt_defconfig |2 +-
>  arch/blackfin/configs/CM-BF548_defconfig   |2 +-
>  arch/mips/configs/mtx1_defconfig   |2 +-
>  arch/powerpc/configs/52xx/pcm030_defconfig |2 +-
>  arch/powerpc/configs/ps3_defconfig |2 +-
>  arch/sh/configs/titan_defconfig|2 +-
>  arch/unicore32/configs/debug_defconfig |2 +-
>  13 files changed, 13 insertions(+), 13 deletions(-)
> 
> diff --git a/arch/unicore32/configs/debug_defconfig 
> b/arch/unicore32/configs/debug_defconfig
> index b5fbde9..1c367f0 100644
> --- a/arch/unicore32/configs/debug_defconfig
> +++ b/arch/unicore32/configs/debug_defconfig
> @@ -168,7 +168,7 @@ CONFIG_LEDS_TRIGGER_HEARTBEAT=y
>  
>  #Real Time Clock
>  CONFIG_RTC_LIB=m
> -CONFIG_RTC_CLASS=m
> +CONFIG_RTC_CLASS=y
>  
>  ### File systems
>  CONFIG_EXT2_FS=m

I adjust this config option recently, and enable it with y.
So please just drop the modification in unicore32 config file.

Thanks & Regards.

Guan Xuetao

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: 3.0-rc1: powerpc hangs at Kernel virtual memory layout

2011-06-01 Thread Benjamin Herrenschmidt
On Wed, 2011-06-01 at 17:16 -0700, Christian Kujau wrote:
> ccc7c28af205888798b51b6cbc0b557ac1170a49 is the first bad commit
> commit ccc7c28af205888798b51b6cbc0b557ac1170a49
> Author: Rafał Miłecki 
> Date:   Fri Apr 1 13:26:52 2011 +0200
> 
> ssb: pci: implement serdes workaround
> 
> Signed-off-by: Rafał Miłecki 
> Signed-off-by: John W. Linville 
> ---
> 
> When I reverted this one from the gi-bisected tree, the box continued to 
> boot (until it got stuck again during IDE/CDROM init, but that may be a 
> different story). I'l; try to revert this from a vanilla 3.0-rc1 and see 
> if it helps 

Thanks. I'll have a look later today. As for the IDE/CDROM init, have
you tried the very latest linus snapshot ? Does that still happens ?
What kind of error do you observe ?

There was some time during the 3.0 merge window process when interrupts
were broken on some PowerBooks, but that should be fixed now.

Cheers,
Ben.


___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Re: 3.0-rc1: powerpc hangs at Kernel virtual memory layout

2011-06-01 Thread Christian Kujau
On Tue, 31 May 2011 at 16:50, Christian Kujau wrote:
> trying to boot 3.0-rc1 on powerpc32 only progresses until:
> 
>   > Kernel virtual memory layout:
>   >   * 0xfffcf000..0xf000  : fixmap

After hours (and hours!) of git-bisecting, it said:

---
ccc7c28af205888798b51b6cbc0b557ac1170a49 is the first bad commit
commit ccc7c28af205888798b51b6cbc0b557ac1170a49
Author: Rafał Miłecki 
Date:   Fri Apr 1 13:26:52 2011 +0200

ssb: pci: implement serdes workaround

Signed-off-by: Rafał Miłecki 
Signed-off-by: John W. Linville 
---

When I reverted this one from the gi-bisected tree, the box continued to 
boot (until it got stuck again during IDE/CDROM init, but that may be a 
different story). I'l; try to revert this from a vanilla 3.0-rc1 and see 
if it helps

Thanks,
Christian.

Full gist-bisect-log: http://nerdbynature.de/bits/3.0-rc1/

> And then the system hangs, does not respond to keyboard (sysrq does not 
> seem to work on this PowerBook G4). But after a while the system reboots 
> itself, so I guess the machine panicked but did not print anything on the 
> screen.
> 
> Full messages (picture), config & (working) dmesg:
> 
>http://nerdbynature.de/bits/3.0-rc1/
> 
-- 
BOFH excuse #406:

Bad cafeteria food landed all the sysadmins in the hospital.
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Re: [PATCH 7/7] [v2] drivers/misc: introduce Freescale hypervisor management driver

2011-06-01 Thread Scott Wood
On Wed, 1 Jun 2011 23:40:14 +0200
Arnd Bergmann  wrote:

> > +static long ioctl_dtprop(struct fsl_hv_ioctl_prop __user *p, int set)
> > +{
> > +   struct fsl_hv_ioctl_prop param;
> > +   char __user *upath, *upropname;
> > +   void __user *upropval;
> > +   char *path = NULL, *propname = NULL;
> > +   void *propval = NULL;
> > +   int ret = 0;
> > +
> 
> I'm not convinced that an ioctl interface is the right way to work with
> device tree properties. A more natural way would be to export it as
> a file system, or maybe as a flattened device tree blob (the latter option
> would require changing the hypervisor interface, which might not be
> possible).

I wanted to have the hypervisor take an update dtb (we already have special
meta-properties for things like deletion as part of the hv config
mechanism).  But others on the project wanted to keep it simple, and so
get/set property it was. :-/

It's unlikely to change at this point without a real need.

As for a filesystem interface, it's not a good match either.  You can't
iterate over anything to read out the full tree from the hv.  You can't
delete anything.  You can't create empty nodes.  The hv interface was meant
to enable some specific management actions, rather than to provide general
device tree access.  This driver is a thin wrapper around the management
hcalls.

There would still be other ioctls needed for starting/stopping the
partition, etc.

> > +/**
> > + * fsl_hv_ioctl: ioctl main entry point
> > + */
> > +static long fsl_hv_ioctl(struct file *file, unsigned int cmd,
> > +unsigned long argaddr)
> > +{
> > +   union fsl_hv_ioctl_param __user *arg =
> > +   (union fsl_hv_ioctl_param __user *)argaddr;
> > +   long ret;
> > +
> 
> For an ioctl, please follow the normal pattern of defining a separate
> structure for each case, no union.

And have fsl_hypervisor.h provide the full set of proper ioctl numbers, with
the specific struct for each ioctl referenced, rather than having the client 
program do
"ioctl(f, _IOWR(0, cmd, union fsl_hv_ioctl_param), p)".

-Scott

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: [PATCH] document udbg-immortal

2011-06-01 Thread Jesse Larrew
On 05/31/2011 08:22 PM, Christian Kujau wrote:

> + udbg-immortal   [PPC] When debugging early kernel crashes that
> + happen after console_init() and before a proper 
> + console driver takes over, this boot options might
> + help "seeing" what's going on.
> +

Thanks for documenting this!

Suggested grammatical tweaks:

s/options/option/
s/help "seeing"/help to "see"/

-- 

Jesse Larrew
Software Engineer, Linux on Power Kernel Team
IBM Linux Technology Center
Phone: (512) 973-2052 (T/L: 363-2052)
jlar...@linux.vnet.ibm.com
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: [git pull] Please pull powerpc.git merge branch

2011-06-01 Thread Tabi Timur-B04825
On Fri, May 20, 2011 at 9:35 AM, Kumar Gala  wrote:

> Shaohui Xie (2):
>      powerpc/fsl_rio: move machine_check handler

This patch causes a build failure if CONFIG_FSL_RIO is not defined:

arch/powerpc/kernel/built-in.o: In function `machine_check_e500mc':
/home/b04825/git/linux.hv/arch/powerpc/kernel/traps.c:429: undefined
reference to `fsl_rio_mcheck_exception'
arch/powerpc/kernel/built-in.o: In function `machine_check_e500':
/home/b04825/git/linux.hv/arch/powerpc/kernel/traps.c:519: undefined
reference to `fsl_rio_mcheck_exception'

-- 
Timur Tabi
Linux kernel developer at Freescale
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: [PATCH 7/7] [v2] drivers/misc: introduce Freescale hypervisor management driver

2011-06-01 Thread Alan Cox

> There's a check for -ENOIOCTLCMD in vfs_ioctl() -- though it generates
> -EINVAL rather than -ENOTTY (why?).

Good question - perhaps someone didn't read the spec 8)
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: [PATCH 7/7] [v2] drivers/misc: introduce Freescale hypervisor management driver

2011-06-01 Thread Arnd Bergmann
On Wednesday 01 June 2011, Timur Tabi wrote:
> The Freescale hypervisor management driver provides several services to
> drivers and applications related to the Freescale hypervisor:
> 
> 1. An ioctl interface for querying and managing partitions
> 
> 2. A file interface to reading incoming doorbells
> 
> 3. An interrupt handler for shutting down the partition upon receiving the
>shutdown doorbell from a manager partition
> 
> 4. An interface for receiving callbacks when a managed partition shuts down.
> 
> Signed-off-by: Timur Tabi 
> ---
>  drivers/misc/Kconfig   |7 +
>  drivers/misc/Makefile  |1 +
>  drivers/misc/fsl_hypervisor.c  |  941 
> 
>  include/linux/Kbuild   |1 +
>  include/linux/fsl_hypervisor.h |  203 +
>  5 files changed, 1153 insertions(+), 0 deletions(-)
>  create mode 100644 drivers/misc/fsl_hypervisor.c
>  create mode 100644 include/linux/fsl_hypervisor.h

I think drivers/misc is not the right place for this, but I'm not completely
sure what is. drivers/firmware would be better at least, but virt/fsl might
also be ok.

> +static long ioctl_dtprop(struct fsl_hv_ioctl_prop __user *p, int set)
> +{
> + struct fsl_hv_ioctl_prop param;
> + char __user *upath, *upropname;
> + void __user *upropval;
> + char *path = NULL, *propname = NULL;
> + void *propval = NULL;
> + int ret = 0;
> +

I'm not convinced that an ioctl interface is the right way to work with
device tree properties. A more natural way would be to export it as
a file system, or maybe as a flattened device tree blob (the latter option
would require changing the hypervisor interface, which might not be
possible).

> +/**
> + * fsl_hv_ioctl: ioctl main entry point
> + */
> +static long fsl_hv_ioctl(struct file *file, unsigned int cmd,
> +  unsigned long argaddr)
> +{
> + union fsl_hv_ioctl_param __user *arg =
> + (union fsl_hv_ioctl_param __user *)argaddr;
> + long ret;
> +

For an ioctl, please follow the normal pattern of defining a separate
structure for each case, no union.

You can use a void __user * in the common ioctl function, and pass that
to the typed argument list in the specific functions.

Arnd
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: [PATCH 7/7] [v2] drivers/misc: introduce Freescale hypervisor management driver

2011-06-01 Thread Scott Wood
On Wed, 1 Jun 2011 20:46:18 +0100
Alan Cox  wrote:

> > +static char *strdup_from_user(const char __user *ustr, size_t max)
> > +{
> > +   size_t len;
> > +   char *str;
> > +
> > +   len = strnlen_user(ustr, max);
> > +   if (len > max)
> > +   return ERR_PTR(-ENAMETOOLONG);

if (len >= max)

> > +   str = kmalloc(len, GFP_KERNEL);
> > +   if (!str)
> > +   return ERR_PTR(-ENOMEM);
> > +
> > +   if (copy_from_user(str, ustr, len))
> > +   return ERR_PTR(-EFAULT);
> > +
> > +   return str;
> > +}

Memory leak on the EFAULT path

If strnlen_user gets an exception, it'll return zero, causing a
zero-length kmalloc.  Will kmalloc(0, ...) return NULL?  If so, a bad
user pointer would result in -ENOMEM rather than -EFAULT.

> > +   default:
> > +   pr_debug("fsl-hv: unknown ioctl %u\n", cmd);
> > +   ret = -ENOIOCTLCMD;
> 
> -ENOTTY
> 
> (-ENOIOCTLCMD is an internal indicator designed so driver layers can say
> 'dunno, try the next layer up')

There's a check for -ENOIOCTLCMD in vfs_ioctl() -- though it generates
-EINVAL rather than -ENOTTY (why?).

Using -ENOIOCTLCMD consistently would make it easier to refactor a
toplevel ioctl handler into a nested one, plus consistency is good in
general.

> > + * We use the same interrupt handler for all doorbells.  Whenever a 
> > doorbell
> > + * is rung, and we receive an interrupt, we just put the handle for that
> > + * doorbell (passed to us as *data) into all of the queues.
> 
> I wonder if these should be presented as IRQs or whether that makes no
> sense ?

They are presented as IRQs.  This driver registers the same handler for all
doorbell IRQs, and pipes the notifications up to userspace, but you could
also directly register a kernel handler for an individual doorbell IRQ.

> > +static irqreturn_t fsl_hv_shutdown_isr(int irq, void *data)
> > +{
> > +   schedule_work(&power_off);
> > +
> > +   /* We should never get here */
> 
> Probably worth printing something if you do (panic(...) ?)

I don't think the comment is accurate.  We've just scheduled the workqueue,
not waited for it to complete.

Timur, shouldn't this schedule orderly_poweroff rather than
kernel_power_off?

-Scott

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: [PATCH 7/7] [v2] drivers/misc: introduce Freescale hypervisor management driver

2011-06-01 Thread Alan Cox
On Wed, 1 Jun 2011 15:24:51 -0500
Timur Tabi  wrote:

> Alan Cox wrote:
> > O> +/* One partition must be local, the other must be remote.  In 
> > other
> >> + words, if source and target are both -1, or are both not -1, then
> >> + return an error. */
> >> +  if ((param.source == -1) == (param.target == -1))
> >> +  return -EINVAL;
> > 
> > Excess brackets (I just mention that one in passing)'
> 
> Do you mean excess parentheses?  If so, then I don't see how.  "(param.source 
> ==
> -1)" and "(param.target == -1)" are expressions that return a boolean.  I'm
> comparing the two boolean results to see if they're equal

Ok - it's a bit non obvious but yes fair enough and it is commented.

> Where exactly in lib/ should it go?  lib/strings.c seems too low-level for a
> function like this.  lib/string_helpers.c is for sprintf-like functions.  And
> it's too generic for lib/powerpc/

I'd submit it to lib/string personally but I'm not sure where would be
better. If someone doesn't like lib/string they can suggest a better
place 8)

> Well, the "handles" are supposed to be just unique numbers.  In this case, 
> they
> are IRQs, but we don't want to expose that.  The application is supposed to 
> scan
> the device tree looking for the doorbell nodes that it wants, and in those 
> nodes
> there is a 'reg' property that contains the handle for that doorbell.  So the
> numbers just need to match.  What they represent is not relevant.

Ok so they are always going to be exposed to users not to drivers, in
which case yes it makes sense. If they are going to get used by kernel
drivers as well an IRQ interface would probably also make sense.

Alan
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: [PATCH 7/7] [v2] drivers/misc: introduce Freescale hypervisor management driver

2011-06-01 Thread Timur Tabi
Alan Cox wrote:
> O> +  /* One partition must be local, the other must be remote.  In other
>> +   words, if source and target are both -1, or are both not -1, then
>> +   return an error. */
>> +if ((param.source == -1) == (param.target == -1))
>> +return -EINVAL;
> 
> Excess brackets (I just mention that one in passing)'

Do you mean excess parentheses?  If so, then I don't see how.  "(param.source ==
-1)" and "(param.target == -1)" are expressions that return a boolean.  I'm
comparing the two boolean results to see if they're equal.  I want to make sure
that the compiler doesn't do something like this:

if (param.source == (-1 == (param.target == -1)))

I don't even know what that means, but it's not what I want.

>> +static char *strdup_from_user(const char __user *ustr, size_t max)
>> +{
>> +size_t len;
>> +char *str;
>> +
>> +len = strnlen_user(ustr, max);
>> +if (len > max)
>> +return ERR_PTR(-ENAMETOOLONG);
>> +
>> +str = kmalloc(len, GFP_KERNEL);
>> +if (!str)
>> +return ERR_PTR(-ENOMEM);
>> +
>> +if (copy_from_user(str, ustr, len))
>> +return ERR_PTR(-EFAULT);
>> +
>> +return str;
>> +}
> 
> This belongs on lib/ if its of general use which I think it perhaps is
> and if we don't have one already.

Where exactly in lib/ should it go?  lib/strings.c seems too low-level for a
function like this.  lib/string_helpers.c is for sprintf-like functions.  And
it's too generic for lib/powerpc/

>> +default:
>> +pr_debug("fsl-hv: unknown ioctl %u\n", cmd);
>> +ret = -ENOIOCTLCMD;
> 
> -ENOTTY
> 
> (-ENOIOCTLCMD is an internal indicator designed so driver layers can say
> 'dunno, try the next layer up')
> 
>> +/* Linked list of processes that have us open */
>> +struct list_head db_list;
> 
> static ?
> 
> 
>> + * We use the same interrupt handler for all doorbells.  Whenever a doorbell
>> + * is rung, and we receive an interrupt, we just put the handle for that
>> + * doorbell (passed to us as *data) into all of the queues.
> 
> I wonder if these should be presented as IRQs or whether that makes no
> sense ?

Well, the "handles" are supposed to be just unique numbers.  In this case, they
are IRQs, but we don't want to expose that.  The application is supposed to scan
the device tree looking for the doorbell nodes that it wants, and in those nodes
there is a 'reg' property that contains the handle for that doorbell.  So the
numbers just need to match.  What they represent is not relevant.

>> +static irqreturn_t fsl_hv_state_change_isr(int irq, void *data)
>> +{
>> +unsigned int status;
>> +struct doorbell_isr *dbisr = data;
>> +int ret;
>> +
>> +/* Determine the new state, and if it's stopped, notify the clients. */
>> +ret = fh_partition_get_status(dbisr->partition, &status);
>> +if (!ret && (status == FH_PARTITION_STOPPED))
>> +schedule_work(&dbisr->work);
>> +
>> +/* Call the normal handler */
>> +return fsl_hv_isr(irq, (void *) (uintptr_t) dbisr->doorbell);
>> +}
> 
> Would a threaded IRQ clean this up by avoiding the queue/work stuff ?

Yes, I think so.  V3 coming up.

-- 
Timur Tabi
Linux kernel developer at Freescale

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[patch 13/14] PCSPKR: Cleanup Kconfig dependencies

2011-06-01 Thread ralf
Lenghty lists of the kind "depends on ARCH1 || ARCH2 ... || ARCH123" are
usually either wrong or too coarse grained.  Or plain an ugly sin.

Signed-off-by: Ralf Baechle 
To: linux-ker...@vger.kernel.org
Cc: Richard Henderson 
Cc: Ivan Kokshaysky 
Cc: Matt Turner 
Cc: Benjamin Herrenschmidt 
Cc: Paul Mackerras 
Cc: Thomas Gleixner 
Cc: Ingo Molnar 
Cc: "H. Peter Anvin" 
Cc: x...@kernel.org
Cc: linux-al...@vger.kernel.org
Cc: linux-m...@linux-mips.org
Cc: linuxppc-dev@lists.ozlabs.org

 arch/alpha/Kconfig |1 +
 arch/mips/Kconfig  |1 +
 arch/powerpc/platforms/chrp/Kconfig|1 +
 arch/powerpc/platforms/prep/Kconfig|1 +
 arch/powerpc/platforms/pseries/Kconfig |1 +
 arch/x86/Kconfig   |1 +
 init/Kconfig   |5 -
 7 files changed, 10 insertions(+), 1 deletion(-)

Index: linux-mips/arch/alpha/Kconfig
===
--- linux-mips.orig/arch/alpha/Kconfig
+++ linux-mips/arch/alpha/Kconfig
@@ -6,6 +6,7 @@ config ALPHA
select HAVE_OPROFILE
select HAVE_SYSCALL_WRAPPERS
select HAVE_IRQ_WORK
+   select HAVE_PCSPKR_PLATFORM
select HAVE_PERF_EVENTS
select HAVE_DMA_ATTRS
select HAVE_GENERIC_HARDIRQS
Index: linux-mips/arch/mips/Kconfig
===
--- linux-mips.orig/arch/mips/Kconfig
+++ linux-mips/arch/mips/Kconfig
@@ -5,6 +5,7 @@ config MIPS
select HAVE_IDE
select HAVE_OPROFILE
select HAVE_IRQ_WORK
+   select HAVE_PCSPKR_PLATFORM
select HAVE_PERF_EVENTS
select PERF_USE_VMALLOC
select HAVE_ARCH_KGDB
Index: linux-mips/arch/powerpc/platforms/chrp/Kconfig
===
--- linux-mips.orig/arch/powerpc/platforms/chrp/Kconfig
+++ linux-mips/arch/powerpc/platforms/chrp/Kconfig
@@ -1,6 +1,7 @@
 config PPC_CHRP
bool "Common Hardware Reference Platform (CHRP) based machines"
depends on 6xx
+   select HAVE_PCSPKR_PLATFORM
select MPIC
select PPC_I8259
select PPC_INDIRECT_PCI
Index: linux-mips/arch/powerpc/platforms/prep/Kconfig
===
--- linux-mips.orig/arch/powerpc/platforms/prep/Kconfig
+++ linux-mips/arch/powerpc/platforms/prep/Kconfig
@@ -1,6 +1,7 @@
 config PPC_PREP
bool "PowerPC Reference Platform (PReP) based machines"
depends on 6xx && BROKEN
+   select HAVE_PCSPKR_PLATFORM
select MPIC
select PPC_I8259
select PPC_INDIRECT_PCI
Index: linux-mips/arch/powerpc/platforms/pseries/Kconfig
===
--- linux-mips.orig/arch/powerpc/platforms/pseries/Kconfig
+++ linux-mips/arch/powerpc/platforms/pseries/Kconfig
@@ -1,6 +1,7 @@
 config PPC_PSERIES
depends on PPC64 && PPC_BOOK3S
bool "IBM pSeries & new (POWER5-based) iSeries"
+   select HAVE_PCSPKR_PLATFORM
select MPIC
select PCI_MSI
select PPC_XICS
Index: linux-mips/arch/x86/Kconfig
===
--- linux-mips.orig/arch/x86/Kconfig
+++ linux-mips/arch/x86/Kconfig
@@ -20,6 +20,7 @@ config X86
select HAVE_UNSTABLE_SCHED_CLOCK
select HAVE_IDE
select HAVE_OPROFILE
+   select HAVE_PCSPKR_PLATFORM
select HAVE_PERF_EVENTS
select HAVE_IRQ_WORK
select HAVE_IOREMAP_PROT
Index: linux-mips/init/Kconfig
===
--- linux-mips.orig/init/Kconfig
+++ linux-mips/init/Kconfig
@@ -1001,12 +1001,15 @@ config ELF_CORE
 
 config PCSPKR_PLATFORM
bool "Enable PC-Speaker support" if EXPERT
-   depends on ALPHA || X86 || MIPS || PPC_PREP || PPC_CHRP || PPC_PSERIES
+   depends on HAVE_PCSPKR_PLATFORM
default y
help
   This option allows to disable the internal PC-Speaker
   support, saving some memory.
 
+config HAVE_PCSPKR_PLATFORM
+   bool
+
 config BASE_FULL
default y
bool "Enable full-sized data structures for core" if EXPERT


___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[patch 09/14] i8253: Alpha, PowerPC: Remove unused header.

2011-06-01 Thread ralf
Signed-off-by: Ralf Baechle 
To: linux-ker...@vger.kernel.org
Cc: Richard Henderson 
Cc: Ivan Kokshaysky 
Cc: Matt Turner 
Cc: linux-al...@vger.kernel.org
Cc: Benjamin Herrenschmidt 
Cc: Paul Mackerras 
Cc: linuxppc-dev@lists.ozlabs.org

 arch/alpha/include/asm/8253pit.h   |3 ---
 arch/powerpc/include/asm/8253pit.h |3 ---
 2 files changed, 6 deletions(-)

Index: linux-mips/arch/alpha/include/asm/8253pit.h
===
--- linux-mips.orig/arch/alpha/include/asm/8253pit.h
+++ /dev/null
@@ -1,3 +0,0 @@
-/*
- * 8253/8254 Programmable Interval Timer
- */
Index: linux-mips/arch/powerpc/include/asm/8253pit.h
===
--- linux-mips.orig/arch/powerpc/include/asm/8253pit.h
+++ /dev/null
@@ -1,3 +0,0 @@
-/*
- * 8253/8254 Programmable Interval Timer
- */


___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[patch 00/14] Sort out i8253 and PC speaker locking and headers

2011-06-01 Thread ralf
No longer terribly relevant these days but still broken and just an eyesore
mess of neglience just as I've already raised it a few days ago.  Time to
sort this.

drivers/input/misc/pcspkr.c:

#if defined(CONFIG_MIPS) || defined(CONFIG_X86)
/* Use the global PIT lock ! */
#include 
#else
#include 
static DEFINE_RAW_SPINLOCK(i8253_lock);
#endif

sound/drivers/pcsp/pcsp.h:

#if defined(CONFIG_MIPS) || defined(CONFIG_X86)
/* Use the global PIT lock ! */
#include 
#else
#include 
static DEFINE_RAW_SPINLOCK(i8253_lock);

$ git grep -F pcsp.h sound/drivers/pcsp
sound/drivers/pcsp/pcsp.c:#include "pcsp.h"
sound/drivers/pcsp/pcsp_input.c:#include "pcsp.h"
sound/drivers/pcsp/pcsp_lib.c:#include "pcsp.h"
sound/drivers/pcsp/pcsp_mixer.c:#include "pcsp.h"
$ git grep -w i8253_lock sound/drivers/pcsp/
sound/drivers/pcsp/pcsp.h:static DEFINE_RAW_SPINLOCK(i8253_lock);
sound/drivers/pcsp/pcsp_input.c:raw_spin_lock_irqsave(&i8253_lock, flags
sound/drivers/pcsp/pcsp_input.c:raw_spin_unlock_irqrestore(&i8253_lock, 
sound/drivers/pcsp/pcsp_lib.c:  raw_spin_lock_irqsave(&i8253_lock, flags
sound/drivers/pcsp/pcsp_lib.c:  raw_spin_unlock_irqrestore(&i8253_lock, 
sound/drivers/pcsp/pcsp_lib.c:  raw_spin_lock(&i8253_lock);
sound/drivers/pcsp/pcsp_lib.c:  raw_spin_unlock(&i8253_lock);
sound/drivers/pcsp/pcsp_lib.c:  raw_spin_lock(&i8253_lock);
sound/drivers/pcsp/pcsp_lib.c:  raw_spin_unlock(&i8253_lock);

Locks are great, everybody should have their own lock!

$ find . -name 8253pit.h
./arch/powerpc/include/asm/8253pit.h
./arch/alpha/include/asm/8253pit.h
$ cat arch/*/include/asm/8253pit.h
/*
 * 8253/8254 Programmable Interval Timer
 */
/*
 * 8253/8254 Programmable Interval Timer
 */
$

Eh...

$ git grep -w PCSPKR_PLATFORM 
arch/mips/Kconfig:  select PCSPKR_PLATFORM
arch/mips/Kconfig:  select PCSPKR_PLATFORM
arch/mips/Kconfig:  select PCSPKR_PLATFORM
arch/powerpc/platforms/amigaone/Kconfig:select PCSPKR_PLATFORM
drivers/input/misc/Kconfig: depends on PCSPKR_PLATFORM
init/Kconfig:config PCSPKR_PLATFORM
sound/drivers/Kconfig:  depends on PCSPKR_PLATFORM && X86 && HIGH_RES_TIMERS

So the status is:

 Alpha: There is no PCSPKR_PLATFORM so while a platform device is
being installed no drivers will be built.  I don't know
which Alpha platforms or even if all of Alpha should be
doing a PCSPKR_PLATFORM so I haven't even tried to sort
this.
 ARM:   No PC speaker supported, yeah :)
 PowerPC:   Should compile but the locking is wrong but only the AmigaOne
platforms should be affected.
 MIPS:  Ok.
 x86:   Ok.
 All others:No PC speaker supported

Also only the plain old IBM PC XT was using a i8253; every later system
had i8254.  So maybe this is the time for renaming the support code?

  Ralf

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: [PATCH 7/7] [v2] drivers/misc: introduce Freescale hypervisor management driver

2011-06-01 Thread Alan Cox
O> +/* One partition must be local, the other must be remote.  In other
> +words, if source and target are both -1, or are both not -1, then
> +return an error. */
> + if ((param.source == -1) == (param.target == -1))
> + return -EINVAL;

Excess brackets (I just mention that one in passing)

> + /* pages is an array of struct page pointers that's initialized by
> +get_user_pages() */
> + pages = kzalloc(nr_pages * sizeof(struct page *), GFP_KERNEL);
> + if (!pages) {
> + pr_debug("fsl-hv: could not allocate page list\n");
> + return -ENOMEM;
> + }

pages allocated

> +
> + /* sg_list is the list of fh_sg_list objects that we pass to the
> +hypervisor */
> + sg_list_unaligned = kmalloc(nr_pages * sizeof(struct fh_sg_list) +
> + sizeof(struct fh_sg_list) - 1, GFP_KERNEL);
> + if (!sg_list_unaligned) {
> + pr_debug("fsl-hv: could not allocate S/G list\n");

but not freed on this path

Although the other paths look fine.

> +exit:
> + if (pages) {
> + for (i = 0; i < nr_pages; i++)
> + if (pages[i])
> + page_cache_release(pages[i]);
> + }
> +
> + kfree(sg_list_unaligned);
> + kfree(pages);

> +static char *strdup_from_user(const char __user *ustr, size_t max)
> +{
> + size_t len;
> + char *str;
> +
> + len = strnlen_user(ustr, max);
> + if (len > max)
> + return ERR_PTR(-ENAMETOOLONG);
> +
> + str = kmalloc(len, GFP_KERNEL);
> + if (!str)
> + return ERR_PTR(-ENOMEM);
> +
> + if (copy_from_user(str, ustr, len))
> + return ERR_PTR(-EFAULT);
> +
> + return str;
> +}

This belongs on lib/ if its of general use which I think it perhaps is
and if we don't have one already.


> + default:
> + pr_debug("fsl-hv: unknown ioctl %u\n", cmd);
> + ret = -ENOIOCTLCMD;

-ENOTTY

(-ENOIOCTLCMD is an internal indicator designed so driver layers can say
'dunno, try the next layer up')

> +/* Linked list of processes that have us open */
> +struct list_head db_list;

static ?


> + * We use the same interrupt handler for all doorbells.  Whenever a doorbell
> + * is rung, and we receive an interrupt, we just put the handle for that
> + * doorbell (passed to us as *data) into all of the queues.

I wonder if these should be presented as IRQs or whether that makes no
sense ?


> +static irqreturn_t fsl_hv_state_change_isr(int irq, void *data)
> +{
> + unsigned int status;
> + struct doorbell_isr *dbisr = data;
> + int ret;
> +
> + /* Determine the new state, and if it's stopped, notify the clients. */
> + ret = fh_partition_get_status(dbisr->partition, &status);
> + if (!ret && (status == FH_PARTITION_STOPPED))
> + schedule_work(&dbisr->work);
> +
> + /* Call the normal handler */
> + return fsl_hv_isr(irq, (void *) (uintptr_t) dbisr->doorbell);
> +}

Would a threaded IRQ clean this up by avoiding the queue/work stuff ?


> +static irqreturn_t fsl_hv_shutdown_isr(int irq, void *data)
> +{
> + schedule_work(&power_off);
> +
> + /* We should never get here */

Probably worth printing something if you do (panic(...) ?)

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: [RFT][PATCH 3.0] ssb: fix PCI(e) driver regression causing oops on PCI cards

2011-06-01 Thread Rafał Miłecki
2011/6/1 Rafał Miłecki :
> We were incorrectly executing PCIe specific workarounds on PCI cards.
> This resulted in:
> Machine check in kernel mode.
> Caused by (from SRR1=149030): Transfer error ack signal
> Oops: Machine check, sig: 7 [#1]

John, I've tested this patch myself on my PCI BCM4318, including
checking for 0x reads in MMIO dumps.

The patch is correct, please take it for 3.0.

-- 
Rafał
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

[PATCH 7/7] [v2] drivers/misc: introduce Freescale hypervisor management driver

2011-06-01 Thread Timur Tabi
The Freescale hypervisor management driver provides several services to
drivers and applications related to the Freescale hypervisor:

1. An ioctl interface for querying and managing partitions

2. A file interface to reading incoming doorbells

3. An interrupt handler for shutting down the partition upon receiving the
   shutdown doorbell from a manager partition

4. An interface for receiving callbacks when a managed partition shuts down.

Signed-off-by: Timur Tabi 
---
 drivers/misc/Kconfig   |7 +
 drivers/misc/Makefile  |1 +
 drivers/misc/fsl_hypervisor.c  |  941 
 include/linux/Kbuild   |1 +
 include/linux/fsl_hypervisor.h |  203 +
 5 files changed, 1153 insertions(+), 0 deletions(-)
 create mode 100644 drivers/misc/fsl_hypervisor.c
 create mode 100644 include/linux/fsl_hypervisor.h

diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
index d80dcde..3e016b3 100644
--- a/drivers/misc/Kconfig
+++ b/drivers/misc/Kconfig
@@ -216,6 +216,13 @@ config ENCLOSURE_SERVICES
  driver (SCSI/ATA) which supports enclosures
  or a SCSI enclosure device (SES) to use these services.
 
+config FSL_HV_MANAGER
+   tristate "Freescale hypervisor management driver"
+   depends on FSL_SOC
+   help
+ This driver allows applications to communicate with the Freescale
+ Hypervisor.
+
 config SGI_XP
tristate "Support communication between SGI SSIs"
depends on NET
diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile
index 848e846..d93bd76 100644
--- a/drivers/misc/Makefile
+++ b/drivers/misc/Makefile
@@ -20,6 +20,7 @@ obj-$(CONFIG_SENSORS_BH1770)  += bh1770glc.o
 obj-$(CONFIG_SENSORS_APDS990X) += apds990x.o
 obj-$(CONFIG_SGI_IOC4) += ioc4.o
 obj-$(CONFIG_ENCLOSURE_SERVICES) += enclosure.o
+obj-$(CONFIG_FSL_HV_MANAGER)   += fsl_hypervisor.o
 obj-$(CONFIG_KGDB_TESTS)   += kgdbts.o
 obj-$(CONFIG_SGI_XP)   += sgi-xp/
 obj-$(CONFIG_SGI_GRU)  += sgi-gru/
diff --git a/drivers/misc/fsl_hypervisor.c b/drivers/misc/fsl_hypervisor.c
new file mode 100644
index 000..a03aa7b
--- /dev/null
+++ b/drivers/misc/fsl_hypervisor.c
@@ -0,0 +1,941 @@
+/** @file
+ * Freescale Hypervisor Management Driver
+ *
+ * This driver contains functions to support the Freescale hypervisor.
+ */
+/* Copyright (C) 2008-2010 Freescale Semiconductor, Inc.
+ * Author: Timur Tabi 
+ *
+ * This file is licensed under the terms of the GNU General Public License
+ * version 2.  This program is licensed "as is" without any warranty of any
+ * kind, whether express or implied.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+
+static BLOCKING_NOTIFIER_HEAD(failover_subscribers);
+
+/**
+ * ioctl_restart: ioctl interface for FSL_HV_IOCTL_PARTITION_RESTART
+ *
+ * Restart a running partition
+ */
+static long ioctl_restart(struct fsl_hv_ioctl_restart __user *p)
+{
+   struct fsl_hv_ioctl_restart param;
+
+   /* Get the parameters from the user */
+   if (copy_from_user(¶m, p, sizeof(struct fsl_hv_ioctl_restart)))
+   return -EFAULT;
+
+   param.ret = fh_partition_restart(param.partition);
+
+   if (copy_to_user(&p->ret, ¶m.ret, sizeof(__u32)))
+   return -EFAULT;
+
+   return 0;
+}
+
+/**
+ * ioctl_status: ioctl interface for FSL_HV_IOCTL_PARTITION_STATUS
+ *
+ * Query the status of a partition
+ */
+static long ioctl_status(struct fsl_hv_ioctl_status __user *p)
+{
+   struct fsl_hv_ioctl_status param;
+   u32 status;
+
+   /* Get the parameters from the user */
+   if (copy_from_user(¶m, p, sizeof(struct fsl_hv_ioctl_status)))
+   return -EFAULT;
+
+   param.ret = fh_partition_get_status(param.partition, &status);
+   if (!param.ret)
+   param.status = status;
+
+   if (copy_to_user(p, ¶m, sizeof(struct fsl_hv_ioctl_status)))
+   return -EFAULT;
+
+   return 0;
+}
+
+/**
+ * ioctl_start: ioctl interface for FSL_HV_IOCTL_PARTITION_START
+ *
+ * Start a stopped partition.
+ */
+static long ioctl_start(struct fsl_hv_ioctl_start __user *p)
+{
+   struct fsl_hv_ioctl_start param;
+
+   /* Get the parameters from the user */
+   if (copy_from_user(¶m, p, sizeof(struct fsl_hv_ioctl_start)))
+   return -EFAULT;
+
+   param.ret = fh_partition_start(param.partition, param.entry_point,
+  param.load);
+
+   if (copy_to_user(&p->ret, ¶m.ret, sizeof(__u32)))
+   return -EFAULT;
+
+   return 0;
+}
+
+/**
+ * ioctl_stop: ioctl interface for FSL_HV_IOCTL_PARTITION_STOP
+ *
+ * Stop a running partition
+ */
+static long ioctl_stop(struct fsl_hv_ioctl_stop __user *p)
+{
+   struct fsl_hv_ioctl_stop param;
+
+   /* Get the parameters from the user */

Re: [PATCH] Fix build warning of the defconfigs

2011-06-01 Thread Wolfram Sang
On Thu, Jun 02, 2011 at 12:29:23AM +0800, Wanlong Gao wrote:
> RTC_CLASS is changed to bool.
> So value 'm' is invalid.
> 
> Signed-off-by: Wanlong Gao 
> ---
>  arch/arm/configs/davinci_all_defconfig |2 +-
>  arch/arm/configs/mxs_defconfig |2 +-
>  arch/arm/configs/netx_defconfig|2 +-
>  arch/arm/configs/viper_defconfig   |2 +-
>  arch/arm/configs/xcep_defconfig|2 +-
>  arch/arm/configs/zeus_defconfig|2 +-
>  arch/avr32/configs/atngw100_mrmt_defconfig |2 +-
>  arch/blackfin/configs/CM-BF548_defconfig   |2 +-
>  arch/mips/configs/mtx1_defconfig   |2 +-
>  arch/powerpc/configs/52xx/pcm030_defconfig |2 +-
>  arch/powerpc/configs/ps3_defconfig |2 +-
>  arch/sh/configs/titan_defconfig|2 +-
>  arch/unicore32/configs/debug_defconfig |2 +-
>  13 files changed, 13 insertions(+), 13 deletions(-)

The mxs-part has already been sent by Shawn Guo (shouldn't harm).

Thanks for doing tree-wide:

Acked-by: Wolfram Sang 

-- 
Pengutronix e.K.   | Wolfram Sang|
Industrial Linux Solutions | http://www.pengutronix.de/  |


signature.asc
Description: Digital signature
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Re: [PATCH] Fix build warning of the defconfigs

2011-06-01 Thread Mike Frysinger
On Wed, Jun 1, 2011 at 12:29, Wanlong Gao wrote:
>  arch/blackfin/configs/CM-BF548_defconfig   |    2 +-

Acked-by: Mike Frysinger 
-mike
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Re: [PATCH 1/2] ppc/85xx: create a platform node for PCI EDAC device

2011-06-01 Thread Scott Wood
On Wed, 1 Jun 2011 18:55:35 +0400
Dmitry Eremin-Solenikov  wrote:

> On 6/1/11, Anton Vorontsov  wrote:
> > On Wed, Jun 01, 2011 at 04:28:11PM +0400, Dmitry Eremin-Solenikov wrote:
> > [...]
> > Also, why not add this call to the fsl_add_bridge(), so you
> > won't need to touch board files at all.
> 
> Because fsl_add_bridge is called too early, so allocation
> of platform device fails.

That doesn't seem like a good reason for putting more stuff in board
files that isn't board-specific.  Why not just make fsl_add_pci_err() an
initcall?  It already only works when a compatible device tree node is
found.  Is there any case where a board would not want this PCI code to be
used, even if the device tree node is present?  If so, fsl_add_bridge could
set a flag that fsl_add_pci_err() could check -- but I doubt it's needed.

-Scott

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[PATCH] Fix build warning of the defconfigs

2011-06-01 Thread Wanlong Gao
RTC_CLASS is changed to bool.
So value 'm' is invalid.

Signed-off-by: Wanlong Gao 
---
 arch/arm/configs/davinci_all_defconfig |2 +-
 arch/arm/configs/mxs_defconfig |2 +-
 arch/arm/configs/netx_defconfig|2 +-
 arch/arm/configs/viper_defconfig   |2 +-
 arch/arm/configs/xcep_defconfig|2 +-
 arch/arm/configs/zeus_defconfig|2 +-
 arch/avr32/configs/atngw100_mrmt_defconfig |2 +-
 arch/blackfin/configs/CM-BF548_defconfig   |2 +-
 arch/mips/configs/mtx1_defconfig   |2 +-
 arch/powerpc/configs/52xx/pcm030_defconfig |2 +-
 arch/powerpc/configs/ps3_defconfig |2 +-
 arch/sh/configs/titan_defconfig|2 +-
 arch/unicore32/configs/debug_defconfig |2 +-
 13 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/arch/arm/configs/davinci_all_defconfig 
b/arch/arm/configs/davinci_all_defconfig
index 889922a..67b5abb6 100644
--- a/arch/arm/configs/davinci_all_defconfig
+++ b/arch/arm/configs/davinci_all_defconfig
@@ -157,7 +157,7 @@ CONFIG_LEDS_GPIO=m
 CONFIG_LEDS_TRIGGERS=y
 CONFIG_LEDS_TRIGGER_TIMER=m
 CONFIG_LEDS_TRIGGER_HEARTBEAT=m
-CONFIG_RTC_CLASS=m
+CONFIG_RTC_CLASS=y
 CONFIG_EXT2_FS=y
 CONFIG_EXT3_FS=y
 CONFIG_XFS_FS=m
diff --git a/arch/arm/configs/mxs_defconfig b/arch/arm/configs/mxs_defconfig
index 2bf2243..5a6ff7c 100644
--- a/arch/arm/configs/mxs_defconfig
+++ b/arch/arm/configs/mxs_defconfig
@@ -89,7 +89,7 @@ CONFIG_DISPLAY_SUPPORT=m
 # CONFIG_USB_SUPPORT is not set
 CONFIG_MMC=y
 CONFIG_MMC_MXS=y
-CONFIG_RTC_CLASS=m
+CONFIG_RTC_CLASS=y
 CONFIG_RTC_DRV_DS1307=m
 CONFIG_DMADEVICES=y
 CONFIG_MXS_DMA=y
diff --git a/arch/arm/configs/netx_defconfig b/arch/arm/configs/netx_defconfig
index 316af54..9c0ad79 100644
--- a/arch/arm/configs/netx_defconfig
+++ b/arch/arm/configs/netx_defconfig
@@ -60,7 +60,7 @@ CONFIG_FB_ARMCLCD=y
 # CONFIG_VGA_CONSOLE is not set
 CONFIG_FRAMEBUFFER_CONSOLE=y
 CONFIG_LOGO=y
-CONFIG_RTC_CLASS=m
+CONFIG_RTC_CLASS=y
 CONFIG_INOTIFY=y
 CONFIG_TMPFS=y
 CONFIG_JFFS2_FS=y
diff --git a/arch/arm/configs/viper_defconfig b/arch/arm/configs/viper_defconfig
index 8b0c717..1d01ddd 100644
--- a/arch/arm/configs/viper_defconfig
+++ b/arch/arm/configs/viper_defconfig
@@ -142,7 +142,7 @@ CONFIG_USB_GADGETFS=m
 CONFIG_USB_FILE_STORAGE=m
 CONFIG_USB_G_SERIAL=m
 CONFIG_USB_G_PRINTER=m
-CONFIG_RTC_CLASS=m
+CONFIG_RTC_CLASS=y
 CONFIG_RTC_DRV_DS1307=m
 CONFIG_RTC_DRV_SA1100=m
 CONFIG_EXT2_FS=m
diff --git a/arch/arm/configs/xcep_defconfig b/arch/arm/configs/xcep_defconfig
index 5b55041..721832f 100644
--- a/arch/arm/configs/xcep_defconfig
+++ b/arch/arm/configs/xcep_defconfig
@@ -73,7 +73,7 @@ CONFIG_SENSORS_MAX6650=m
 # CONFIG_VGA_CONSOLE is not set
 # CONFIG_HID_SUPPORT is not set
 # CONFIG_USB_SUPPORT is not set
-CONFIG_RTC_CLASS=m
+CONFIG_RTC_CLASS=y
 CONFIG_RTC_DRV_SA1100=m
 CONFIG_DMADEVICES=y
 # CONFIG_DNOTIFY is not set
diff --git a/arch/arm/configs/zeus_defconfig b/arch/arm/configs/zeus_defconfig
index 960f655..59577ad 100644
--- a/arch/arm/configs/zeus_defconfig
+++ b/arch/arm/configs/zeus_defconfig
@@ -158,7 +158,7 @@ CONFIG_LEDS_TRIGGER_HEARTBEAT=m
 CONFIG_LEDS_TRIGGER_BACKLIGHT=m
 CONFIG_LEDS_TRIGGER_GPIO=m
 CONFIG_LEDS_TRIGGER_DEFAULT_ON=m
-CONFIG_RTC_CLASS=m
+CONFIG_RTC_CLASS=y
 CONFIG_RTC_DRV_ISL1208=m
 CONFIG_RTC_DRV_PXA=m
 CONFIG_EXT2_FS=y
diff --git a/arch/avr32/configs/atngw100_mrmt_defconfig 
b/arch/avr32/configs/atngw100_mrmt_defconfig
index 19f6cee..fb6dab8 100644
--- a/arch/avr32/configs/atngw100_mrmt_defconfig
+++ b/arch/avr32/configs/atngw100_mrmt_defconfig
@@ -109,7 +109,7 @@ CONFIG_LEDS_GPIO=y
 CONFIG_LEDS_TRIGGERS=y
 CONFIG_LEDS_TRIGGER_TIMER=y
 CONFIG_LEDS_TRIGGER_HEARTBEAT=y
-CONFIG_RTC_CLASS=m
+CONFIG_RTC_CLASS=y
 CONFIG_RTC_DRV_S35390A=m
 CONFIG_RTC_DRV_AT32AP700X=m
 CONFIG_DMADEVICES=y
diff --git a/arch/blackfin/configs/CM-BF548_defconfig 
b/arch/blackfin/configs/CM-BF548_defconfig
index 31d9542..9f1d084 100644
--- a/arch/blackfin/configs/CM-BF548_defconfig
+++ b/arch/blackfin/configs/CM-BF548_defconfig
@@ -112,7 +112,7 @@ CONFIG_USB_G_SERIAL=m
 CONFIG_USB_G_PRINTER=m
 CONFIG_MMC=m
 CONFIG_SDH_BFIN=m
-CONFIG_RTC_CLASS=m
+CONFIG_RTC_CLASS=y
 CONFIG_RTC_DRV_BFIN=m
 CONFIG_EXT2_FS=m
 # CONFIG_DNOTIFY is not set
diff --git a/arch/mips/configs/mtx1_defconfig b/arch/mips/configs/mtx1_defconfig
index 37862b2..807c97e 100644
--- a/arch/mips/configs/mtx1_defconfig
+++ b/arch/mips/configs/mtx1_defconfig
@@ -678,7 +678,7 @@ CONFIG_LEDS_TRIGGERS=y
 CONFIG_LEDS_TRIGGER_TIMER=y
 CONFIG_LEDS_TRIGGER_HEARTBEAT=y
 CONFIG_LEDS_TRIGGER_DEFAULT_ON=y
-CONFIG_RTC_CLASS=m
+CONFIG_RTC_CLASS=y
 CONFIG_RTC_INTF_DEV_UIE_EMUL=y
 CONFIG_RTC_DRV_TEST=m
 CONFIG_RTC_DRV_DS1307=m
diff --git a/arch/powerpc/configs/52xx/pcm030_defconfig 
b/arch/powerpc/configs/52xx/pcm030_defconfig
index 7f7e4a8..22e7195 100644
--- a/arch/powerpc/configs/52xx/pcm030_defconfig
+++ b/arch/powerpc/configs/52xx/pcm030_defconfig
@@ -85,7 +85,7 @@ CONFIG_USB_OHCI_HCD=m
 CONFIG_USB_OHCI_HCD_P

[PATCH 1/2] ppc/85xx: create a platform node for PCI EDAC device

2011-06-01 Thread Dmitry Eremin-Solenikov
As a device for pci node isn't created, create a special platform_device
for PCI EDAC device on MPC85xx.

Signed-off-by: Dmitry Eremin-Solenikov 
---
 arch/powerpc/platforms/85xx/ksi8560.c |2 +
 arch/powerpc/platforms/85xx/mpc8536_ds.c  |2 +
 arch/powerpc/platforms/85xx/mpc85xx_ads.c |2 +
 arch/powerpc/platforms/85xx/mpc85xx_cds.c |2 +
 arch/powerpc/platforms/85xx/mpc85xx_ds.c  |2 +
 arch/powerpc/platforms/85xx/mpc85xx_mds.c |4 +++
 arch/powerpc/platforms/85xx/mpc85xx_rdb.c |2 +
 arch/powerpc/platforms/85xx/p1022_ds.c|2 +
 arch/powerpc/platforms/85xx/sbc8548.c |2 +
 arch/powerpc/platforms/85xx/sbc8560.c |2 +
 arch/powerpc/platforms/85xx/socrates.c|2 +
 arch/powerpc/platforms/85xx/stx_gp3.c |2 +
 arch/powerpc/platforms/85xx/tqm85xx.c |2 +
 arch/powerpc/platforms/85xx/xes_mpc85xx.c |2 +
 arch/powerpc/sysdev/fsl_pci.c |   30 +
 arch/powerpc/sysdev/fsl_pci.h |5 
 16 files changed, 65 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/platforms/85xx/ksi8560.c 
b/arch/powerpc/platforms/85xx/ksi8560.c
index c46f935..288fc4686 100644
--- a/arch/powerpc/platforms/85xx/ksi8560.c
+++ b/arch/powerpc/platforms/85xx/ksi8560.c
@@ -228,6 +228,8 @@ static int __init declare_of_platform_devices(void)
 {
of_platform_bus_probe(NULL, of_bus_ids, NULL);
 
+   fsl_add_pci_err();
+
return 0;
 }
 machine_device_initcall(ksi8560, declare_of_platform_devices);
diff --git a/arch/powerpc/platforms/85xx/mpc8536_ds.c 
b/arch/powerpc/platforms/85xx/mpc8536_ds.c
index f79f2f1..cfcbd88 100644
--- a/arch/powerpc/platforms/85xx/mpc8536_ds.c
+++ b/arch/powerpc/platforms/85xx/mpc8536_ds.c
@@ -114,6 +114,8 @@ static struct of_device_id __initdata mpc8536_ds_ids[] = {
 
 static int __init mpc8536_ds_publish_devices(void)
 {
+   fsl_add_pci_err();
+
return of_platform_bus_probe(NULL, mpc8536_ds_ids, NULL);
 }
 machine_device_initcall(mpc8536_ds, mpc8536_ds_publish_devices);
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_ads.c 
b/arch/powerpc/platforms/85xx/mpc85xx_ads.c
index 3b2c9bb..6af50d4 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_ads.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_ads.c
@@ -235,6 +235,8 @@ static int __init declare_of_platform_devices(void)
 {
of_platform_bus_probe(NULL, of_bus_ids, NULL);
 
+   fsl_add_pci_err();
+
return 0;
 }
 machine_device_initcall(mpc85xx_ads, declare_of_platform_devices);
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_cds.c 
b/arch/powerpc/platforms/85xx/mpc85xx_cds.c
index 6299a2a..2785c75 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_cds.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_cds.c
@@ -341,6 +341,8 @@ static struct of_device_id __initdata of_bus_ids[] = {
 
 static int __init declare_of_platform_devices(void)
 {
+   fsl_add_pci_err();
+
return of_platform_bus_probe(NULL, of_bus_ids, NULL);
 }
 machine_device_initcall(mpc85xx_cds, declare_of_platform_devices);
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_ds.c 
b/arch/powerpc/platforms/85xx/mpc85xx_ds.c
index c7b97f7..2d0a138 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_ds.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_ds.c
@@ -228,6 +228,8 @@ static struct of_device_id __initdata mpc85xxds_ids[] = {
 
 static int __init mpc85xxds_publish_devices(void)
 {
+   fsl_add_pci_err();
+
return of_platform_bus_probe(NULL, mpc85xxds_ids, NULL);
 }
 machine_device_initcall(mpc8544_ds, mpc85xxds_publish_devices);
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_mds.c 
b/arch/powerpc/platforms/85xx/mpc85xx_mds.c
index 747d1ee..2ff879a 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_mds.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_mds.c
@@ -455,6 +455,8 @@ static int __init mpc85xx_publish_devices(void)
if (machine_is(mpc8569_mds))
simple_gpiochip_init("fsl,mpc8569mds-bcsr-gpio");
 
+   fsl_add_pci_err();
+
of_platform_bus_probe(NULL, mpc85xx_ids, NULL);
mpc85xx_publish_qe_devices();
 
@@ -463,6 +465,8 @@ static int __init mpc85xx_publish_devices(void)
 
 static int __init p1021_publish_devices(void)
 {
+   fsl_add_pci_err();
+
of_platform_bus_probe(NULL, p1021_ids, NULL);
mpc85xx_publish_qe_devices();
 
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_rdb.c 
b/arch/powerpc/platforms/85xx/mpc85xx_rdb.c
index 088f30b..511a86c 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_rdb.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_rdb.c
@@ -118,6 +118,8 @@ static struct of_device_id __initdata mpc85xxrdb_ids[] = {
 
 static int __init mpc85xxrdb_publish_devices(void)
 {
+   fsl_add_pci_err();
+
return of_platform_bus_probe(NULL, mpc85xxrdb_ids, NULL);
 }
 machine_device_initcall(p2020_rdb, mpc85xxrdb_publish_devices);
diff --git a/arch/powerpc/platforms/85xx/p1022_ds.c 
b/arch/powerpc/platforms/85xx/p1022_ds.c
index 7eb5c40..249f302 100644
--- a/arch/powerpc/p

[PATCH] ppc/85xx: specify interrupt for pq3-localbus devices

2011-06-01 Thread Dmitry Eremin-Solenikov
fsl-lbc driver requires an interrupt to bind to localbus device.
Populate 85xx boards' dts trees with lbc interrupt info.

Signed-off-by: Dmitry Eremin-Solenikov 
---
 arch/powerpc/boot/dts/mpc8568mds.dts   |2 ++
 arch/powerpc/boot/dts/socrates.dts |2 ++
 arch/powerpc/boot/dts/tqm8540.dts  |2 ++
 arch/powerpc/boot/dts/tqm8548-bigflash.dts |2 ++
 arch/powerpc/boot/dts/tqm8548.dts  |2 ++
 arch/powerpc/boot/dts/tqm8560.dts  |2 ++
 arch/powerpc/boot/dts/xpedite5200.dts  |2 ++
 arch/powerpc/boot/dts/xpedite5200_xmon.dts |2 ++
 8 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/boot/dts/mpc8568mds.dts 
b/arch/powerpc/boot/dts/mpc8568mds.dts
index 30cf0e0..647daf8 100644
--- a/arch/powerpc/boot/dts/mpc8568mds.dts
+++ b/arch/powerpc/boot/dts/mpc8568mds.dts
@@ -60,6 +60,8 @@
compatible = "fsl,mpc8568-localbus", "fsl,pq3-localbus",
 "simple-bus";
reg = <0xe0005000 0x1000>;
+   interrupt-parent = <&mpic>;
+   interrupts = <19 2>;
 
ranges = <0x0 0x0 0xfe00 0x0200
  0x1 0x0 0xf800 0x8000
diff --git a/arch/powerpc/boot/dts/socrates.dts 
b/arch/powerpc/boot/dts/socrates.dts
index feb4ef6..38c3540 100644
--- a/arch/powerpc/boot/dts/socrates.dts
+++ b/arch/powerpc/boot/dts/socrates.dts
@@ -240,6 +240,8 @@
#address-cells = <2>;
#size-cells = <1>;
reg = <0xe0005000 0x40>;
+   interrupt-parent = <&mpic>;
+   interrupts = <19 2>;
 
ranges = <0 0 0xfc00 0x0400
  2 0 0xc800 0x0400
diff --git a/arch/powerpc/boot/dts/tqm8540.dts 
b/arch/powerpc/boot/dts/tqm8540.dts
index e028457..0a4cedb 100644
--- a/arch/powerpc/boot/dts/tqm8540.dts
+++ b/arch/powerpc/boot/dts/tqm8540.dts
@@ -283,6 +283,8 @@
compatible = "fsl,mpc8540-localbus", "fsl,pq3-localbus",
 "simple-bus";
reg = <0xe0005000 0x1000>;
+   interrupt-parent = <&mpic>;
+   interrupts = <19 2>;
 
ranges = <0x0 0x0 0xfe00 0x0200>;
 
diff --git a/arch/powerpc/boot/dts/tqm8548-bigflash.dts 
b/arch/powerpc/boot/dts/tqm8548-bigflash.dts
index 5dbb36e..9452c3c 100644
--- a/arch/powerpc/boot/dts/tqm8548-bigflash.dts
+++ b/arch/powerpc/boot/dts/tqm8548-bigflash.dts
@@ -346,6 +346,8 @@
#address-cells = <2>;
#size-cells = <1>;
reg = <0xa0005000 0x100>;   // BRx, ORx, etc.
+   interrupt-parent = <&mpic>;
+   interrupts = <19 2>;
 
ranges = <
0 0x0 0xfc00 0x0400 // NOR FLASH bank 1
diff --git a/arch/powerpc/boot/dts/tqm8548.dts 
b/arch/powerpc/boot/dts/tqm8548.dts
index a050ae4..619776f 100644
--- a/arch/powerpc/boot/dts/tqm8548.dts
+++ b/arch/powerpc/boot/dts/tqm8548.dts
@@ -346,6 +346,8 @@
#address-cells = <2>;
#size-cells = <1>;
reg = <0xe0005000 0x100>;   // BRx, ORx, etc.
+   interrupt-parent = <&mpic>;
+   interrupts = <19 2>;
 
ranges = <
0 0x0 0xfc00 0x0400 // NOR FLASH bank 1
diff --git a/arch/powerpc/boot/dts/tqm8560.dts 
b/arch/powerpc/boot/dts/tqm8560.dts
index 22ec39b..7665a16 100644
--- a/arch/powerpc/boot/dts/tqm8560.dts
+++ b/arch/powerpc/boot/dts/tqm8560.dts
@@ -312,6 +312,8 @@
#address-cells = <2>;
#size-cells = <1>;
reg = <0xe0005000 0x100>;   // BRx, ORx, etc.
+   interrupt-parent = <&mpic>;
+   interrupts = <19 2>;
 
ranges = <
0 0x0 0xfc00 0x0400 // NOR FLASH bank 1
diff --git a/arch/powerpc/boot/dts/xpedite5200.dts 
b/arch/powerpc/boot/dts/xpedite5200.dts
index a0cf53f..c41a80c 100644
--- a/arch/powerpc/boot/dts/xpedite5200.dts
+++ b/arch/powerpc/boot/dts/xpedite5200.dts
@@ -374,6 +374,8 @@
#address-cells = <2>;
#size-cells = <1>;
reg = <0xef005000 0x100>;   // BRx, ORx, etc.
+   interrupt-parent = <&mpic>;
+   interrupts = <19 2>;
 
ranges = <
0 0x0 0xfc00 0x0400 // NOR boot flash
diff --git a/arch/powerpc/boot/dts/xpedite5200_xmon.dts 
b/arch/powerpc/boot/dts/xpedite5200_xmon.dts
index c5b2975..c0efcbb 100644
--- a/arch/powerpc/boot/dts/xpedite5200_xmon.dts
+++ b/arch/powerpc/boot/dts/xpedite5200_xmon.dts
@@ -378,6 +378,8 @@
#address-cells = <2>;
#size-cells = <1>;
reg = <0xef005000 0x100>;   // BRx, ORx, etc.
+   interrupt-parent = <&mpic>;
+   interrupts = <19 2>;
 
ranges = <
0 0x0 

Re: [PATCH 1/2] ppc/85xx: create a platform node for PCI EDAC device

2011-06-01 Thread Anton Vorontsov
On Wed, Jun 01, 2011 at 06:55:35PM +0400, Dmitry Eremin-Solenikov wrote:
> On 6/1/11, Anton Vorontsov  wrote:
> > On Wed, Jun 01, 2011 at 04:28:11PM +0400, Dmitry Eremin-Solenikov wrote:
> > [...]
> >> --- a/arch/powerpc/sysdev/fsl_pci.h
> >> +++ b/arch/powerpc/sysdev/fsl_pci.h
> >> @@ -92,6 +92,7 @@ extern int fsl_add_bridge(struct device_node *dev, int
> >> is_primary);
> >>  extern void fsl_pcibios_fixup_bus(struct pci_bus *bus);
> >>  extern int mpc83xx_add_bridge(struct device_node *dev);
> >>  u64 fsl_pci_immrbar_base(struct pci_controller *hose);
> >> +int fsl_add_pci_err(void);
> >
> > With
> >
> > #ifdef CONFIG_PCI
> > int fsl_add_pci_err(void);
> > #else
> > static inline int fsl_add_pci_err(void) { return -ENODEV; }
> > #endif
> >
> > You won't need endless ifdefs in the board files:
> 
> OK, will redo this patch.

Btw, if you don't check return value of fsl_add_pci_err(), then
it would probably make sense to return void. And if you do
check it somewhere, be sure to include linux/errno.h for
-ENODEV. :-)

Thanks,

-- 
Anton Vorontsov
Email: cbouatmai...@gmail.com
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: [PATCH 1/2] ppc/85xx: create a platform node for PCI EDAC device

2011-06-01 Thread Dmitry Eremin-Solenikov
On 6/1/11, Anton Vorontsov  wrote:
> On Wed, Jun 01, 2011 at 04:28:11PM +0400, Dmitry Eremin-Solenikov wrote:
> [...]
>> --- a/arch/powerpc/sysdev/fsl_pci.h
>> +++ b/arch/powerpc/sysdev/fsl_pci.h
>> @@ -92,6 +92,7 @@ extern int fsl_add_bridge(struct device_node *dev, int
>> is_primary);
>>  extern void fsl_pcibios_fixup_bus(struct pci_bus *bus);
>>  extern int mpc83xx_add_bridge(struct device_node *dev);
>>  u64 fsl_pci_immrbar_base(struct pci_controller *hose);
>> +int fsl_add_pci_err(void);
>
> With
>
> #ifdef CONFIG_PCI
> int fsl_add_pci_err(void);
> #else
> static inline int fsl_add_pci_err(void) { return -ENODEV; }
> #endif
>
> You won't need endless ifdefs in the board files:

OK, will redo this patch.

>
> #ifdef CONFIG_PCI
>   fsl_add_pci_err();
> #endif
>
> Also, why not add this call to the fsl_add_bridge(), so you
> won't need to touch board files at all.

Because fsl_add_bridge is called too early, so allocation
of platform device fails.

-- 
With best wishes
Dmitry
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: [PATCH 1/2] ppc/85xx: create a platform node for PCI EDAC device

2011-06-01 Thread Anton Vorontsov
On Wed, Jun 01, 2011 at 04:28:11PM +0400, Dmitry Eremin-Solenikov wrote:
[...]
> --- a/arch/powerpc/sysdev/fsl_pci.h
> +++ b/arch/powerpc/sysdev/fsl_pci.h
> @@ -92,6 +92,7 @@ extern int fsl_add_bridge(struct device_node *dev, int 
> is_primary);
>  extern void fsl_pcibios_fixup_bus(struct pci_bus *bus);
>  extern int mpc83xx_add_bridge(struct device_node *dev);
>  u64 fsl_pci_immrbar_base(struct pci_controller *hose);
> +int fsl_add_pci_err(void);

With

#ifdef CONFIG_PCI
int fsl_add_pci_err(void);
#else
static inline int fsl_add_pci_err(void) { return -ENODEV; }
#endif

You won't need endless ifdefs in the board files:

#ifdef CONFIG_PCI
fsl_add_pci_err();
#endif

Also, why not add this call to the fsl_add_bridge(), so you
won't need to touch board files at all.

Thanks,

-- 
Anton Vorontsov
Email: cbouatmai...@gmail.com
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[PATCH] perf_events: Enable idle state tracing for pseries (ppc64)

2011-06-01 Thread Deepthi Dharwar
Hi,

Please find below a patch, which has perf_events added for pseries (ppc64)
platform in order to emit the trace required for perf timechart. 
It essentially enables perf timechart for pseries platfrom to analyse
power savings events like cpuidle states.

Steps to enable and disable the trace;
1) Mount  debugfs;
   mount -t debugfs none /sys/kernel/debug
2) Then, enable the event using;
echo 1 > /sys/kernel/debug/tracing/events/power/cpu_idle/enable
3) The output of the trace can be seen in /sys/kernel/debug/tracing/trace
4) To disable the trace use;
echo 0 > sys/kernel/debug/tracing/events/power/cpu_idle/enable

Trace .svg o/p can be viewed for pseries (ppc64) systems showing various 
cpu-idle states as a part of perf timechart tool. 
References: http://blog.fenrus.org/?p=5

Issue command 'perf timechart record' to enable tracing. 
This generates the trace and records in  perf.data file by default.
One can generate output.svg file by issuing 'perf timechart'. 

Sample o/p from the trace file: 
===

State 1 -> Snooze
State 2 -> Cede

# tracer: nop
#
TASK-PIDCPU#TIMESTAMP  FUNCTION
  | |   |  | |
-0 [000]   292.482314: cpu_idle: state=1 cpu_id=0 
^^ Enter Snooze
-0 [001]   292.482363: cpu_idle: state=1 cpu_id=1
-0 [000]   292.492315: cpu_idle: state=4294967295 cpu_id=0
^^ Exit Snooze  
-0 [000]   292.492316: cpu_idle: state=2 cpu_id=0 
^^ Enter  Cede 
-0 [001]   292.492364: cpu_idle: state=4294967295 cpu_id=1
-0 [001]   292.492364: cpu_idle: state=2 cpu_id=1 
-0 [000]   292.504198: cpu_idle: state=4294967295 cpu_id=0 
^^Exit Cede 
-0 [000]   292.504204: cpu_idle: state=1 cpu_id=0
-0 [001]   292.504921: cpu_idle: state=4294967295 cpu_id=1
-0 [001]   292.504936: cpu_idle: state=1 cpu_id=1
-0 [000]   292.514205: cpu_idle: state=4294967295 cpu_id=0

This patch applies on 2.6.39 and tested on a IBM POWER7 machine.  

-Deepthi

Adding perf events to trace various cpu idle states on ppc64 (pseries) platform.
Signed-off-by: Deepthi Dharwar 

pseries.h |4 
setup.c   |   14 ++
2 files changed, 18 insertions(+)

Index: linux-2.6.39/arch/powerpc/platforms/pseries/setup.c
===
--- linux-2.6.39.orig/arch/powerpc/platforms/pseries/setup.c2011-05-19 
00:06:34.0 -0400
+++ linux-2.6.39/arch/powerpc/platforms/pseries/setup.c 2011-06-01 
07:46:00.0 -0400
@@ -39,6 +39,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -582,6 +583,10 @@
 * while, do so.
 */
if (snooze) {
+
+   trace_power_start(POWER_CSTATE, CPU_IDLE_SNOOZE, cpu);
+   trace_cpu_idle(CPU_IDLE_SNOOZE, cpu);
+
start_snooze = get_tb() + snooze * tb_ticks_per_usec;
local_irq_enable();
set_thread_flag(TIF_POLLING_NRFLAG);
@@ -602,9 +607,19 @@
goto out;
}
 
+   trace_power_end(cpu);
+   trace_cpu_idle(PWR_EVENT_EXIT, cpu);
+
+   trace_power_start(POWER_CSTATE, CPU_IDLE_CEDE, cpu);
+   trace_cpu_idle(CPU_IDLE_CEDE, cpu);
+
cede_processor();
 
 out:
+
+   trace_power_end(cpu);
+   trace_cpu_idle(PWR_EVENT_EXIT, cpu);
+
HMT_medium();
out_purr = mfspr(SPRN_PURR);
get_lppaca()->wait_state_cycles += out_purr - in_purr;
Index: linux-2.6.39/arch/powerpc/platforms/pseries/pseries.h
===
--- linux-2.6.39.orig/arch/powerpc/platforms/pseries/pseries.h  2011-05-19 
00:06:34.0 -0400
+++ linux-2.6.39/arch/powerpc/platforms/pseries/pseries.h   2011-06-01 
07:53:24.0 -0400
@@ -12,6 +12,9 @@
 
 #include 
 
+#define CPU_IDLE_SNOOZE 1
+#define CPU_IDLE_CEDE   2
+
 struct device_node;
 
 extern void request_event_sources_irqs(struct device_node *np,
@@ -56,4 +59,5 @@
 extern int dlpar_attach_node(struct device_node *);
 extern int dlpar_detach_node(struct device_node *);
 
+
 #endif /* _PSERIES_PSERIES_H */
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[PATCH 2/2] mpc85xx_edac: adapt to ppc/85xx changes for mpc85xx_pci_err

2011-06-01 Thread Dmitry Eremin-Solenikov
Currently mpc85xx_edac fails to bind to PCI host device node. Adapt it
to bind to special platform device mpc85xx_pci_err.

Signed-off-by: Dmitry Eremin-Solenikov 
---
 drivers/edac/mpc85xx_edac.c |   33 -
 1 files changed, 12 insertions(+), 21 deletions(-)

diff --git a/drivers/edac/mpc85xx_edac.c b/drivers/edac/mpc85xx_edac.c
index c42e483..e91e8fb 100644
--- a/drivers/edac/mpc85xx_edac.c
+++ b/drivers/edac/mpc85xx_edac.c
@@ -204,7 +204,7 @@ static int __devinit mpc85xx_pci_err_probe(struct 
platform_device *op)
 {
struct edac_pci_ctl_info *pci;
struct mpc85xx_pci_pdata *pdata;
-   struct resource r;
+   struct resource *r;
int res = 0;
 
if (!devres_open_group(&op->dev, mpc85xx_pci_err_probe, GFP_KERNEL))
@@ -228,17 +228,15 @@ static int __devinit mpc85xx_pci_err_probe(struct 
platform_device *op)
 
pdata->edac_idx = edac_pci_idx++;
 
-   res = of_address_to_resource(op->dev.of_node, 0, &r);
-   if (res) {
+   r = platform_get_resource(op, IORESOURCE_MEM, 0);
+   if (!r) {
printk(KERN_ERR "%s: Unable to get resource for "
   "PCI err regs\n", __func__);
+   res = -ENODEV;
goto err;
}
 
-   /* we only need the error registers */
-   r.start += 0xe00;
-
-   if (!devm_request_mem_region(&op->dev, r.start, resource_size(&r),
+   if (!devm_request_mem_region(&op->dev, r->start, resource_size(r),
pdata->name)) {
printk(KERN_ERR "%s: Error while requesting mem region\n",
   __func__);
@@ -246,7 +244,7 @@ static int __devinit mpc85xx_pci_err_probe(struct 
platform_device *op)
goto err;
}
 
-   pdata->pci_vbase = devm_ioremap(&op->dev, r.start, resource_size(&r));
+   pdata->pci_vbase = devm_ioremap(&op->dev, r->start, resource_size(r));
if (!pdata->pci_vbase) {
printk(KERN_ERR "%s: Unable to setup PCI err regs\n", __func__);
res = -ENOMEM;
@@ -273,7 +271,11 @@ static int __devinit mpc85xx_pci_err_probe(struct 
platform_device *op)
}
 
if (edac_op_state == EDAC_OPSTATE_INT) {
-   pdata->irq = irq_of_parse_and_map(op->dev.of_node, 0);
+   res =  platform_get_irq(op, 0);
+   if (res >= 0)
+   pdata->irq = res;
+   else
+   goto err2;
res = devm_request_irq(&op->dev, pdata->irq,
   mpc85xx_pci_isr, IRQF_DISABLED,
   "[EDAC] PCI err", pci);
@@ -281,7 +283,6 @@ static int __devinit mpc85xx_pci_err_probe(struct 
platform_device *op)
printk(KERN_ERR
   "%s: Unable to requiest irq %d for "
   "MPC85xx PCI err\n", __func__, pdata->irq);
-   irq_dispose_mapping(pdata->irq);
res = -ENODEV;
goto err2;
}
@@ -326,16 +327,7 @@ static int mpc85xx_pci_err_remove(struct platform_device 
*op)
return 0;
 }
 
-static struct of_device_id mpc85xx_pci_err_of_match[] = {
-   {
-.compatible = "fsl,mpc8540-pcix",
-},
-   {
-.compatible = "fsl,mpc8540-pci",
-   },
-   {},
-};
-MODULE_DEVICE_TABLE(of, mpc85xx_pci_err_of_match);
+MODULE_ALIAS("platform:mpc85xx_pci_err");
 
 static struct platform_driver mpc85xx_pci_err_driver = {
.probe = mpc85xx_pci_err_probe,
@@ -343,7 +335,6 @@ static struct platform_driver mpc85xx_pci_err_driver = {
.driver = {
.name = "mpc85xx_pci_err",
.owner = THIS_MODULE,
-   .of_match_table = mpc85xx_pci_err_of_match,
},
 };
 
-- 
1.7.4.4

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[PATCH 1/2] ppc/85xx: create a platform node for PCI EDAC device

2011-06-01 Thread Dmitry Eremin-Solenikov
As a device for pci node isn't created, create a special platform_device
for PCI EDAC device on MPC85xx.

Signed-off-by: Dmitry Eremin-Solenikov 
---
 arch/powerpc/platforms/85xx/ksi8560.c |4 +++
 arch/powerpc/platforms/85xx/mpc8536_ds.c  |4 +++
 arch/powerpc/platforms/85xx/mpc85xx_ads.c |4 +++
 arch/powerpc/platforms/85xx/mpc85xx_cds.c |4 +++
 arch/powerpc/platforms/85xx/mpc85xx_ds.c  |4 +++
 arch/powerpc/platforms/85xx/mpc85xx_mds.c |8 +++
 arch/powerpc/platforms/85xx/mpc85xx_rdb.c |4 +++
 arch/powerpc/platforms/85xx/p1022_ds.c|4 +++
 arch/powerpc/platforms/85xx/sbc8548.c |4 +++
 arch/powerpc/platforms/85xx/sbc8560.c |4 +++
 arch/powerpc/platforms/85xx/socrates.c|4 +++
 arch/powerpc/platforms/85xx/stx_gp3.c |4 +++
 arch/powerpc/platforms/85xx/tqm85xx.c |4 +++
 arch/powerpc/platforms/85xx/xes_mpc85xx.c |4 +++
 arch/powerpc/sysdev/fsl_pci.c |   32 +
 arch/powerpc/sysdev/fsl_pci.h |1 +
 16 files changed, 93 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/platforms/85xx/ksi8560.c 
b/arch/powerpc/platforms/85xx/ksi8560.c
index c46f935..0b4e98c 100644
--- a/arch/powerpc/platforms/85xx/ksi8560.c
+++ b/arch/powerpc/platforms/85xx/ksi8560.c
@@ -228,6 +228,10 @@ static int __init declare_of_platform_devices(void)
 {
of_platform_bus_probe(NULL, of_bus_ids, NULL);
 
+#ifdef CONFIG_PCI
+   fsl_add_pci_err();
+#endif
+
return 0;
 }
 machine_device_initcall(ksi8560, declare_of_platform_devices);
diff --git a/arch/powerpc/platforms/85xx/mpc8536_ds.c 
b/arch/powerpc/platforms/85xx/mpc8536_ds.c
index f79f2f1..fe4d835 100644
--- a/arch/powerpc/platforms/85xx/mpc8536_ds.c
+++ b/arch/powerpc/platforms/85xx/mpc8536_ds.c
@@ -114,6 +114,10 @@ static struct of_device_id __initdata mpc8536_ds_ids[] = {
 
 static int __init mpc8536_ds_publish_devices(void)
 {
+#ifdef CONFIG_PCI
+   fsl_add_pci_err();
+#endif
+
return of_platform_bus_probe(NULL, mpc8536_ds_ids, NULL);
 }
 machine_device_initcall(mpc8536_ds, mpc8536_ds_publish_devices);
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_ads.c 
b/arch/powerpc/platforms/85xx/mpc85xx_ads.c
index 3b2c9bb..d5ef029 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_ads.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_ads.c
@@ -235,6 +235,10 @@ static int __init declare_of_platform_devices(void)
 {
of_platform_bus_probe(NULL, of_bus_ids, NULL);
 
+#ifdef CONFIG_PCI
+   fsl_add_pci_err();
+#endif
+
return 0;
 }
 machine_device_initcall(mpc85xx_ads, declare_of_platform_devices);
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_cds.c 
b/arch/powerpc/platforms/85xx/mpc85xx_cds.c
index 6299a2a..1101608 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_cds.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_cds.c
@@ -341,6 +341,10 @@ static struct of_device_id __initdata of_bus_ids[] = {
 
 static int __init declare_of_platform_devices(void)
 {
+#ifdef CONFIG_PCI
+   fsl_add_pci_err();
+#endif
+
return of_platform_bus_probe(NULL, of_bus_ids, NULL);
 }
 machine_device_initcall(mpc85xx_cds, declare_of_platform_devices);
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_ds.c 
b/arch/powerpc/platforms/85xx/mpc85xx_ds.c
index c7b97f7..d17a49f 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_ds.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_ds.c
@@ -228,6 +228,10 @@ static struct of_device_id __initdata mpc85xxds_ids[] = {
 
 static int __init mpc85xxds_publish_devices(void)
 {
+#ifdef CONFIG_PCI
+   fsl_add_pci_err();
+#endif
+
return of_platform_bus_probe(NULL, mpc85xxds_ids, NULL);
 }
 machine_device_initcall(mpc8544_ds, mpc85xxds_publish_devices);
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_mds.c 
b/arch/powerpc/platforms/85xx/mpc85xx_mds.c
index 747d1ee..856ba60 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_mds.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_mds.c
@@ -455,6 +455,10 @@ static int __init mpc85xx_publish_devices(void)
if (machine_is(mpc8569_mds))
simple_gpiochip_init("fsl,mpc8569mds-bcsr-gpio");
 
+#ifdef CONFIG_PCI
+   fsl_add_pci_err();
+#endif
+
of_platform_bus_probe(NULL, mpc85xx_ids, NULL);
mpc85xx_publish_qe_devices();
 
@@ -463,6 +467,10 @@ static int __init mpc85xx_publish_devices(void)
 
 static int __init p1021_publish_devices(void)
 {
+#ifdef CONFIG_PCI
+   fsl_add_pci_err();
+#endif
+
of_platform_bus_probe(NULL, p1021_ids, NULL);
mpc85xx_publish_qe_devices();
 
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_rdb.c 
b/arch/powerpc/platforms/85xx/mpc85xx_rdb.c
index 088f30b..918b7b6 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_rdb.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_rdb.c
@@ -118,6 +118,10 @@ static struct of_device_id __initdata mpc85xxrdb_ids[] = {
 
 static int __init mpc85xxrdb_publish_devices(void)
 {
+#ifdef CONFIG_PCI
+   fsl_add_pci_err();
+#endif
+
return of_platform_bu

[RFT][PATCH 3.0] ssb: fix PCI(e) driver regression causing oops on PCI cards

2011-06-01 Thread Rafał Miłecki
We were incorrectly executing PCIe specific workarounds on PCI cards.
This resulted in:
Machine check in kernel mode.
Caused by (from SRR1=149030): Transfer error ack signal
Oops: Machine check, sig: 7 [#1]

Reported-by: Andreas Schwab 
Signed-off-by: Rafał Miłecki 
---
 drivers/ssb/driver_pcicore.c |   10 ++
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/ssb/driver_pcicore.c b/drivers/ssb/driver_pcicore.c
index 82feb34..2a20dab 100644
--- a/drivers/ssb/driver_pcicore.c
+++ b/drivers/ssb/driver_pcicore.c
@@ -539,10 +539,12 @@ void ssb_pcicore_init(struct ssb_pcicore *pc)
if (!pc->hostmode)
ssb_pcicore_init_clientmode(pc);
 
-   /* Additional always once-executed workarounds */
-   ssb_pcicore_serdes_workaround(pc);
-   /* TODO: ASPM */
-   /* TODO: Clock Request Update */
+   /* Additional PCIe always once-executed workarounds */
+   if (dev->id.coreid == SSB_DEV_PCIE) {
+   ssb_pcicore_serdes_workaround(pc);
+   /* TODO: ASPM */
+   /* TODO: Clock Request Update */
+   }
 }
 
 static u32 ssb_pcie_read(struct ssb_pcicore *pc, u32 address)
-- 
1.7.1

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Re: [PATCH] powerpc/fsl: Use irq_data_get_irq_handler_data() in chain handler

2011-06-01 Thread Thomas Gleixner
On Wed, 1 Jun 2011, Geert Uytterhoeven wrote:

> If you already have a pointer to a struct irq_data , it's more efficient
> to use irq_data_get_irq_handler_data().
> irq_get_handler_data() has to look up the struct irq_desc pointer again,
> which was already passed to the chain handler.
> 
> Signed-off-by: Geert Uytterhoeven 
> ---
> Completely untested, not even compile-tested.
> If this is correct, there are probably more of these?
> 
>  arch/powerpc/sysdev/fsl_msi.c |2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/arch/powerpc/sysdev/fsl_msi.c b/arch/powerpc/sysdev/fsl_msi.c
> index 92e7833..9b92c82 100644
> --- a/arch/powerpc/sysdev/fsl_msi.c
> +++ b/arch/powerpc/sysdev/fsl_msi.c
> @@ -193,7 +193,7 @@ static void fsl_msi_cascade(unsigned int irq, struct 
> irq_desc *desc)
>   u32 have_shift = 0;
>   struct fsl_msi_cascade_data *cascade_data;
>  
> - cascade_data = irq_get_handler_data(irq);
> + cascade_data = irq_data_get_irq_handler_data(idata);

  cascade_data = irq_desc_get_handler_data(desc);

Might compile and work :)

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[PATCH] powerpc/fsl: Use irq_data_get_irq_handler_data() in chain handler

2011-06-01 Thread Geert Uytterhoeven
If you already have a pointer to a struct irq_data , it's more efficient
to use irq_data_get_irq_handler_data().
irq_get_handler_data() has to look up the struct irq_desc pointer again,
which was already passed to the chain handler.

Signed-off-by: Geert Uytterhoeven 
---
Completely untested, not even compile-tested.
If this is correct, there are probably more of these?

 arch/powerpc/sysdev/fsl_msi.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/powerpc/sysdev/fsl_msi.c b/arch/powerpc/sysdev/fsl_msi.c
index 92e7833..9b92c82 100644
--- a/arch/powerpc/sysdev/fsl_msi.c
+++ b/arch/powerpc/sysdev/fsl_msi.c
@@ -193,7 +193,7 @@ static void fsl_msi_cascade(unsigned int irq, struct 
irq_desc *desc)
u32 have_shift = 0;
struct fsl_msi_cascade_data *cascade_data;
 
-   cascade_data = irq_get_handler_data(irq);
+   cascade_data = irq_data_get_irq_handler_data(idata);
msi_data = cascade_data->msi_data;
 
raw_spin_lock(&desc->lock);
-- 
1.7.0.4

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[088/165] seqlock: Dont smp_rmb in seqlock reader spin loop

2011-06-01 Thread Greg KH
2.6.39-stable review patch.  If anyone has any objections, please let us know.

--
Content-Length: 2553
Lines: 71

From: Milton Miller 

commit 5db1256a5131d3b133946fa02ac9770a784e6eb2 upstream.

Move the smp_rmb after cpu_relax loop in read_seqlock and add
ACCESS_ONCE to make sure the test and return are consistent.

A multi-threaded core in the lab didn't like the update
from 2.6.35 to 2.6.36, to the point it would hang during
boot when multiple threads were active.  Bisection showed
af5ab277ded04bd9bc6b048c5a2f0e7d70ef0867 (clockevents:
Remove the per cpu tick skew) as the culprit and it is
supported with stack traces showing xtime_lock waits including
tick_do_update_jiffies64 and/or update_vsyscall.

Experimentation showed the combination of cpu_relax and smp_rmb
was significantly slowing the progress of other threads sharing
the core, and this patch is effective in avoiding the hang.

A theory is the rmb is affecting the whole core while the
cpu_relax is causing a resource rebalance flush, together they
cause an interfernce cadance that is unbroken when the seqlock
reader has interrupts disabled.

At first I was confused why the refactor in
3c22cd5709e8143444a6d08682a87f4c57902df3 (kernel: optimise
seqlock) didn't affect this patch application, but after some
study that affected seqcount not seqlock. The new seqcount was
not factored back into the seqlock.  I defer that the future.

While the removal of the timer interrupt offset created
contention for the xtime lock while a cpu does the
additonal work to update the system clock, the seqlock
implementation with the tight rmb spin loop goes back much
further, and is just waiting for the right trigger.

Signed-off-by: Milton Miller 
Cc: 
Cc: Linus Torvalds 
Cc: Andi Kleen 
Cc: Nick Piggin 
Cc: Benjamin Herrenschmidt 
Cc: Anton Blanchard 
Cc: Paul McKenney 
Acked-by: Eric Dumazet 
Link: http://lkml.kernel.org/r/%3Cseqlock-rmb%40mdm.bga.com%3E
Signed-off-by: Thomas Gleixner 
Signed-off-by: Greg Kroah-Hartman 

---
 include/linux/seqlock.h |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/include/linux/seqlock.h
+++ b/include/linux/seqlock.h
@@ -88,12 +88,12 @@ static __always_inline unsigned read_seq
unsigned ret;
 
 repeat:
-   ret = sl->sequence;
-   smp_rmb();
+   ret = ACCESS_ONCE(sl->sequence);
if (unlikely(ret & 1)) {
cpu_relax();
goto repeat;
}
+   smp_rmb();
 
return ret;
 }


___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[086/146] seqlock: Dont smp_rmb in seqlock reader spin loop

2011-06-01 Thread Greg KH
2.6.38-stable review patch.  If anyone has any objections, please let us know.

--

From: Milton Miller 

commit 5db1256a5131d3b133946fa02ac9770a784e6eb2 upstream.

Move the smp_rmb after cpu_relax loop in read_seqlock and add
ACCESS_ONCE to make sure the test and return are consistent.

A multi-threaded core in the lab didn't like the update
from 2.6.35 to 2.6.36, to the point it would hang during
boot when multiple threads were active.  Bisection showed
af5ab277ded04bd9bc6b048c5a2f0e7d70ef0867 (clockevents:
Remove the per cpu tick skew) as the culprit and it is
supported with stack traces showing xtime_lock waits including
tick_do_update_jiffies64 and/or update_vsyscall.

Experimentation showed the combination of cpu_relax and smp_rmb
was significantly slowing the progress of other threads sharing
the core, and this patch is effective in avoiding the hang.

A theory is the rmb is affecting the whole core while the
cpu_relax is causing a resource rebalance flush, together they
cause an interfernce cadance that is unbroken when the seqlock
reader has interrupts disabled.

At first I was confused why the refactor in
3c22cd5709e8143444a6d08682a87f4c57902df3 (kernel: optimise
seqlock) didn't affect this patch application, but after some
study that affected seqcount not seqlock. The new seqcount was
not factored back into the seqlock.  I defer that the future.

While the removal of the timer interrupt offset created
contention for the xtime lock while a cpu does the
additonal work to update the system clock, the seqlock
implementation with the tight rmb spin loop goes back much
further, and is just waiting for the right trigger.

Signed-off-by: Milton Miller 
Cc: 
Cc: Linus Torvalds 
Cc: Andi Kleen 
Cc: Nick Piggin 
Cc: Benjamin Herrenschmidt 
Cc: Anton Blanchard 
Cc: Paul McKenney 
Acked-by: Eric Dumazet 
Link: http://lkml.kernel.org/r/%3Cseqlock-rmb%40mdm.bga.com%3E
Signed-off-by: Thomas Gleixner 
Signed-off-by: Greg Kroah-Hartman 

---
 include/linux/seqlock.h |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/include/linux/seqlock.h
+++ b/include/linux/seqlock.h
@@ -88,12 +88,12 @@ static __always_inline unsigned read_seq
unsigned ret;
 
 repeat:
-   ret = sl->sequence;
-   smp_rmb();
+   ret = ACCESS_ONCE(sl->sequence);
if (unlikely(ret & 1)) {
cpu_relax();
goto repeat;
}
+   smp_rmb();
 
return ret;
 }


___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev