Re: Build regressions/improvements in v3.10-rc4

2013-06-03 Thread Geert Uytterhoeven
On Mon, 3 Jun 2013, Geert Uytterhoeven wrote:
> JFYI, when comparing v3.10-rc4 to v3.10-rc3[3], the summaries are:
>   - build errors: +6/-2
>   - build warnings: +66/-132

  + arch/powerpc/sysdev/mpic.c: error: case label does not reduce to an integer 
constant:  => 890:9, 898:9, 886:9, 894:9

powerpc-randconfig

  + error: No rule to make target /etc/sound/msndinit.bin:  => N/A
  + error: No rule to make target /etc/sound/msndperm.bin:  => N/A

i386-randconfig

  + error: spi-rspi.c: undefined reference to `shdma_chan_filter':  => 
.text+0x64f28), .text+0x65108)
  
sh-randconfig

There seems to be something wrong with the dependencies for SH_DMAE_BASE,
with more failures in linux-next for kota2_defconfig and marzen_defconfig
on ARM (http://kisskb.ellerman.id.au/kisskb/buildresult/8848370/ resp.
 http://kisskb.ellerman.id.au/kisskb/buildresult/8848367/)

> [1] http://kisskb.ellerman.id.au/kisskb/head/6290/ (all 120 configs)
> [3] http://kisskb.ellerman.id.au/kisskb/head/6268/ (all 120 configs)

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


Re: DTB build failure due to preproccessing

2013-06-03 Thread Ian Campbell
On Fri, 2013-05-31 at 17:31 +0100, Grant Likely wrote:
> On Fri, May 31, 2013 at 5:04 PM, Stephen Warren  wrote:
> > On 05/31/2013 05:48 AM, Grant Likely wrote:
> >> ---
> >> commit d01dccdcb3ea8233b09efb9c24db9f057fbd3b37
> >> Author: Grant Likely 
> >> Date:   Fri May 31 12:45:18 2013 +0100
> >>
> >> dtc: Suppress cpp linemarker annotations
> >>
> >> DTC isn't able to parse cpp linemarker annotations, so suppress them in
> >> the cpp output by adding the -P flag to the cpp options.
> >
> > That's not true; it explicitly does have code to parse the line markers.
> > I'll have to investigate why it isn't working in this case.
> >
> > If you apply this patch, then anyone who has switched to #include rther
> > than /include/ will get incorrect line numbers in dtc error messages.
> > Admittedly that's a smaller population right now though. Perhaps we
> > should just do a kernel-wide conversion though.
> 
> My mistake. I tested the wrong thing. I've dropped the patch.

FWIW I've also dropped it from my device-tree.git tree.

Ian.


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


Re: [PATCH] powerpc/sysfs: disable hotplug for the boot cpu

2013-06-03 Thread Zhao Chenhui
On Sat, Jun 01, 2013 at 07:49:44AM +1000, Benjamin Herrenschmidt wrote:
> On Tue, 2013-05-28 at 15:59 +0800, Zhao Chenhui wrote:
> > Some features depend on the boot cpu, for instance, hibernate/suspend.
> > So disable hotplug for the boot cpu.
> 
> Don't we have code to "move" the boot CPU around when that happens ?
> 
> Ben.
> 

Currently, the code in generic_cpu_disable() likes this:

if (cpu == boot_cpuid) 
return -EBUSY;

If the dying cpu is the boot cpu, it will return -EBUSY. In the subsequent 
error handling,
cpu_notify_nofail(CPU_DOWN_FAILED) in _cpu_down() will be called. 
Unfortunately, some
cpu notifier callbacks handled CPU_DOWN_PREPARE, but not CPU_DOWN_FAILED, such 
as sched_cpu_inactive().
So it will cause issues.

If we set the hotpluggable for the boot cpu, we can prevent user applications 
from disabling the boot cpu.

-Chenhui

> > Signed-off-by: Zhao Chenhui 
> > ---
> >  arch/powerpc/kernel/sysfs.c |4 +++-
> >  1 files changed, 3 insertions(+), 1 deletions(-)
> > 
> > diff --git a/arch/powerpc/kernel/sysfs.c b/arch/powerpc/kernel/sysfs.c
> > index e68a845..294b1c4e 100644
> > --- a/arch/powerpc/kernel/sysfs.c
> > +++ b/arch/powerpc/kernel/sysfs.c
> > @@ -655,8 +655,10 @@ static int __init topology_init(void)
> >  * CPU.  For instance, the boot cpu might never be valid
> >  * for hotplugging.
> >  */
> > -   if (ppc_md.cpu_die)
> > +   if (ppc_md.cpu_die && cpu != boot_cpuid)
> > c->hotpluggable = 1;
> > +   else
> > +   c->hotpluggable = 0;
> >  
> > if (cpu_online(cpu) || c->hotpluggable) {
> > register_cpu(c, cpu);
> 
> 
> 

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


powerpc/tm: Fix 32bit non-rt signal return

2013-06-03 Thread Michael Neuling
Currently sys_sigreturn() is transactional memory unaware, hence if we take a
32 bit signal without SIGINFO (non RT) inside a transaction, we don't restore
the signal frame correctly on return.

This checks if the signal frame being restoring is an active transaction, and
if so, it copies the additional state to the ptregs so it can be restored.

Signed-off-by: Michael Neuling 
cc:  # 3.9 only

diff --git a/arch/powerpc/kernel/signal_32.c b/arch/powerpc/kernel/signal_32.c
index 201385c..0bc961b 100644
--- a/arch/powerpc/kernel/signal_32.c
+++ b/arch/powerpc/kernel/signal_32.c
@@ -1481,16 +1481,22 @@ badframe:
 long sys_sigreturn(int r3, int r4, int r5, int r6, int r7, int r8,
   struct pt_regs *regs)
 {
+   struct sigframe __user *sf;
struct sigcontext __user *sc;
struct sigcontext sigctx;
struct mcontext __user *sr;
void __user *addr;
sigset_t set;
+#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
+   struct mcontext __user *mcp, *tm_mcp;
+   unsigned long msr_hi;
+#endif
 
/* Always make any pending restarted system calls return -EINTR */
current_thread_info()->restart_block.fn = do_no_restart_syscall;
 
-   sc = (struct sigcontext __user *)(regs->gpr[1] + __SIGNAL_FRAMESIZE);
+   sf = (struct sigframe __user *)(regs->gpr[1] + __SIGNAL_FRAMESIZE);
+   sc = &sf->sctx;
addr = sc;
if (copy_from_user(&sigctx, sc, sizeof(sigctx)))
goto badframe;
@@ -1507,12 +1513,23 @@ long sys_sigreturn(int r3, int r4, int r5, int r6, int 
r7, int r8,
 #endif
set_current_blocked(&set);
 
-   sr = (struct mcontext __user *)from_user_ptr(sigctx.regs);
-   addr = sr;
-   if (!access_ok(VERIFY_READ, sr, sizeof(*sr))
-   || restore_user_regs(regs, sr, 1))
+#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
+   mcp = (struct mcontext __user *)&sf->mctx;
+   tm_mcp = (struct mcontext __user *)&sf->mctx_transact;
+   if (__get_user(msr_hi, &mcp->mc_gregs[PT_MSR]))
goto badframe;
-
+   if MSR_TM_ACTIVE(msr_hi<<32) {
+   if (restore_tm_user_regs(regs, mcp, tm_mcp))
+   goto badframe;
+   } else
+#endif
+   {
+   sr = (struct mcontext __user *)from_user_ptr(sigctx.regs);
+   addr = sr;
+   if (!access_ok(VERIFY_READ, sr, sizeof(*sr))
+   || restore_user_regs(regs, sr, 1))
+   goto badframe;
+   }
set_thread_flag(TIF_RESTOREALL);
return 0;
 

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


[PATCH] powerpc/dts/virtex440: declare address/size-cells for phy device

2013-06-03 Thread Ian Campbell
This fixes a warning:

  DTC arch/powerpc/boot/virtex440-ml507.dtb
Warning (reg_format): "reg" property in 
/plb@0/xps-ll-temac@81c0/ethernet@81c0/phy@7 has invalid length (4 
bytes) (#address-cells == 2, #size-cells == 1)
Warning (avoid_default_addr_size): Relying on default #address-cells value for 
/plb@0/xps-ll-temac@81c0/ethernet@81c0/phy@7
Warning (avoid_default_addr_size): Relying on default #size-cells value for 
/plb@0/xps-ll-temac@81c0/ethernet@81c0/phy@7

Signed-off-by: Ian Campbell 
Cc: Benjamin Herrenschmidt 
Cc: Paul Mackerras 
Cc: Gernot Vormayr 
Cc: linuxppc-dev@lists.ozlabs.org
Cc: linux-ker...@vger.kernel.org
---
 arch/powerpc/boot/dts/virtex440-ml507.dts |2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/powerpc/boot/dts/virtex440-ml507.dts 
b/arch/powerpc/boot/dts/virtex440-ml507.dts
index fc7073b..391a4e2 100644
--- a/arch/powerpc/boot/dts/virtex440-ml507.dts
+++ b/arch/powerpc/boot/dts/virtex440-ml507.dts
@@ -257,6 +257,8 @@
#size-cells = <1>;
compatible = "xlnx,compound";
ethernet@81c0 {
+   #address-cells = <1>;
+   #size-cells = <0>;
compatible = "xlnx,xps-ll-temac-1.01.b";
device_type = "network";
interrupt-parent = <&xps_intc_0>;
-- 
1.7.10.4

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


[PATCH] powerpc/4xx: Fix warning in kilauea.dtb

2013-06-03 Thread Ian Campbell
Currently I see:
  DTC arch/powerpc/boot/kilauea.dtb
Warning (reg_format): "reg" property in /plb/ppc4xx-msi@C1000 has invalid 
length (12 bytes) (#address-cells == 1, #size-cells == 1)

It appears that unlike the other plarforms handled by 3fb7933850fa
"powerpc/4xx: Adding PCIe MSI support" this platform does not use 
address-cells=2.

Signed-off-by: Ian Campbell 
Cc: Rupjyoti Sarmah 
Cc: Tirumala R Marri 
Cc: Josh Boyer 
Cc: Benjamin Herrenschmidt 
Cc: Paul Mackerras 
Cc: linuxppc-dev@lists.ozlabs.org
Cc: linux-ker...@vger.kernel.org
---
 arch/powerpc/boot/dts/kilauea.dts |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/boot/dts/kilauea.dts 
b/arch/powerpc/boot/dts/kilauea.dts
index 1613d6e..5ba7f01 100644
--- a/arch/powerpc/boot/dts/kilauea.dts
+++ b/arch/powerpc/boot/dts/kilauea.dts
@@ -406,7 +406,7 @@
 
MSI: ppc4xx-msi@C1000 {
compatible = "amcc,ppc4xx-msi", "ppc4xx-msi";
-   reg = < 0x0 0xEF62 0x100>;
+   reg = <0xEF62 0x100>;
sdr-base = <0x4B0>;
msi-data = <0x>;
msi-mask = <0x>;
-- 
1.7.10.4

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


[PATCH] powerpc/boot: Ignore .dtb files.

2013-06-03 Thread Ian Campbell
Signed-off-by: Ian Campbell 
Cc: Benjamin Herrenschmidt 
Cc: Paul Mackerras 
Cc: linuxppc-dev@lists.ozlabs.org
Cc: linux-ker...@vger.kernel.org
---
 arch/powerpc/boot/.gitignore |1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/powerpc/boot/.gitignore b/arch/powerpc/boot/.gitignore
index c32ae5c..8fa258e 100644
--- a/arch/powerpc/boot/.gitignore
+++ b/arch/powerpc/boot/.gitignore
@@ -16,6 +16,7 @@ mktree
 uImage
 cuImage.*
 dtbImage.*
+*.dtb
 treeImage.*
 zImage
 zImage.initrd
-- 
1.7.10.4

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


[PATCH v1 1/1] mpc512x: silence a USB Kconfig dependency warning

2013-06-03 Thread Gerhard Sittig
the PPC_MPC512x config automatically selected USB_EHCI_BIG_ENDIAN_*
switches, which made Kconfig warn about "unmet direct dependencies":

  scripts/kconfig/conf --silentoldconfig Kconfig
  warning: (PPC_MPC512x && 440EPX) selects USB_EHCI_BIG_ENDIAN_DESC which has 
unmet direct dependencies (USB_SUPPORT && USB && USB_EHCI_HCD)
  warning: (PPC_MPC512x && PPC_PS3 && PPC_CELLEB && 440EPX) selects 
USB_EHCI_BIG_ENDIAN_MMIO which has unmet direct dependencies (USB_SUPPORT && 
USB && USB_EHCI_HCD)
  warning: (PPC_MPC512x && 440EPX) selects USB_EHCI_BIG_ENDIAN_DESC which has 
unmet direct dependencies (USB_SUPPORT && USB && USB_EHCI_HCD)
  warning: (PPC_MPC512x && PPC_PS3 && PPC_CELLEB && 440EPX) selects 
USB_EHCI_BIG_ENDIAN_MMIO which has unmet direct dependencies (USB_SUPPORT && 
USB && USB_EHCI_HCD)

make the selected entries additionally depend on USB_EHCI_HCD which
silences the warning

Signed-off-by: Gerhard Sittig 
---
 arch/powerpc/platforms/512x/Kconfig |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/platforms/512x/Kconfig 
b/arch/powerpc/platforms/512x/Kconfig
index aaf1edb..049fb7b 100644
--- a/arch/powerpc/platforms/512x/Kconfig
+++ b/arch/powerpc/platforms/512x/Kconfig
@@ -17,8 +17,8 @@ config PPC_MPC512x
select PPC_PCI_CHOICE
select FSL_PCI if PCI
select ARCH_WANT_OPTIONAL_GPIOLIB
-   select USB_EHCI_BIG_ENDIAN_MMIO
-   select USB_EHCI_BIG_ENDIAN_DESC
+   select USB_EHCI_BIG_ENDIAN_MMIO if USB_EHCI_HCD
+   select USB_EHCI_BIG_ENDIAN_DESC if USB_EHCI_HCD
 
 config MPC5121_ADS
bool "Freescale MPC5121E ADS"
-- 
1.7.10.4

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


Re: [PATCH V2] dtc: ensure #line directives don't consume data from the next line

2013-06-03 Thread Jon Loeliger
> From: Stephen Warren 
> 
> Previously, the #line parsing regex ended with ({WS}+[0-9]+)?. The {WS}
> could match line-break characters. If the #line directive did not contain
> the optional flags field at the end, this could cause any integer data on
> the next line to be consumed as part of the #line directive parsing. This
> could cause syntax errors (i.e. #line parsing consuming the leading 0
> from a hex literal 0x1234, leaving x1234 to be parsed as cell data,
> which is a syntax error), or invalid compilation results (i.e. simply
> consuming literal 1234 as part of the #line processing, thus removing it
> from the cell data).
> 
> Fix this by replacing {WS} with [ \t] so that it can't match line-breaks.
> 
> Convert all instances of {WS}, even though the other instances should be
> irrelevant for any well-formed #line directive. This is done for
> consistency and ultimate safety.
> 
> Reported-by: Ian Campbell 
> Signed-off-by: Stephen Warren 
> ---
> v2: Convert all instances of {WS} in the regex.

Applied.

Thanks!

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


Re: [PATCH] powerpc/4xx: Fix warning in kilauea.dtb

2013-06-03 Thread Josh Boyer
On Mon, Jun 03, 2013 at 12:00:24PM +0100, Ian Campbell wrote:
>Currently I see:
>  DTC arch/powerpc/boot/kilauea.dtb
>Warning (reg_format): "reg" property in /plb/ppc4xx-msi@C1000 has invalid 
>length (12 bytes) (#address-cells == 1, #size-cells == 1)
>
>It appears that unlike the other plarforms handled by 3fb7933850fa
>"powerpc/4xx: Adding PCIe MSI support" this platform does not use 
>address-cells=2.

Right, it's a 405, not a 440.  I should have caught that in the initial
review.

>Signed-off-by: Ian Campbell 
>Cc: Rupjyoti Sarmah 
>Cc: Tirumala R Marri 
>Cc: Josh Boyer 

That address should bounce.  It hasn't been active in almost 2 years.

>Cc: Benjamin Herrenschmidt 
>Cc: Paul Mackerras 
>Cc: linuxppc-dev@lists.ozlabs.org
>Cc: linux-ker...@vger.kernel.org

Acked-by: Josh Boyer 

>---
> arch/powerpc/boot/dts/kilauea.dts |2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/arch/powerpc/boot/dts/kilauea.dts 
>b/arch/powerpc/boot/dts/kilauea.dts
>index 1613d6e..5ba7f01 100644
>--- a/arch/powerpc/boot/dts/kilauea.dts
>+++ b/arch/powerpc/boot/dts/kilauea.dts
>@@ -406,7 +406,7 @@
> 
>   MSI: ppc4xx-msi@C1000 {
>   compatible = "amcc,ppc4xx-msi", "ppc4xx-msi";
>-  reg = < 0x0 0xEF62 0x100>;
>+  reg = <0xEF62 0x100>;
>   sdr-base = <0x4B0>;
>   msi-data = <0x>;
>   msi-mask = <0x>;
>-- 
>1.7.10.4
>
>___
>Linuxppc-dev mailing list
>Linuxppc-dev@lists.ozlabs.org
>https://lists.ozlabs.org/listinfo/linuxppc-dev
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: [PATCH] powerpc/4xx: Fix warning in kilauea.dtb

2013-06-03 Thread Ian Campbell
On Mon, 2013-06-03 at 09:36 -0400, Josh Boyer wrote:
> On Mon, Jun 03, 2013 at 12:00:24PM +0100, Ian Campbell wrote:
> >Currently I see:
> >  DTC arch/powerpc/boot/kilauea.dtb
> >Warning (reg_format): "reg" property in /plb/ppc4xx-msi@C1000 has 
> >invalid length (12 bytes) (#address-cells == 1, #size-cells == 1)
> >
> >It appears that unlike the other plarforms handled by 3fb7933850fa
> >"powerpc/4xx: Adding PCIe MSI support" this platform does not use 
> >address-cells=2.
> 
> Right, it's a 405, not a 440.  I should have caught that in the initial
> review.
> 
> >Signed-off-by: Ian Campbell 
> >Cc: Rupjyoti Sarmah 
> >Cc: Tirumala R Marri 
> >Cc: Josh Boyer 
> 
> That address should bounce.  It hasn't been active in almost 2 years.

Funnily enough the previous patch to this file (where I nabbed the
address from) was approximately that long ago ;-)

I've updated my local copy with your Ack with the correct address,
thanks.

I also corrected the "plarforms" typo which I just spotted...

Ian.

> >Cc: Benjamin Herrenschmidt 
> >Cc: Paul Mackerras 
> >Cc: linuxppc-dev@lists.ozlabs.org
> >Cc: linux-ker...@vger.kernel.org
> 
> Acked-by: Josh Boyer 
> 
> >---
> > arch/powerpc/boot/dts/kilauea.dts |2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> >diff --git a/arch/powerpc/boot/dts/kilauea.dts 
> >b/arch/powerpc/boot/dts/kilauea.dts
> >index 1613d6e..5ba7f01 100644
> >--- a/arch/powerpc/boot/dts/kilauea.dts
> >+++ b/arch/powerpc/boot/dts/kilauea.dts
> >@@ -406,7 +406,7 @@
> > 
> > MSI: ppc4xx-msi@C1000 {
> > compatible = "amcc,ppc4xx-msi", "ppc4xx-msi";
> >-reg = < 0x0 0xEF62 0x100>;
> >+reg = <0xEF62 0x100>;
> > sdr-base = <0x4B0>;
> > msi-data = <0x>;
> > msi-mask = <0x>;
> >-- 
> >1.7.10.4
> >
> >___
> >Linuxppc-dev mailing list
> >Linuxppc-dev@lists.ozlabs.org
> >https://lists.ozlabs.org/listinfo/linuxppc-dev


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


[PATCH] dtc: ensure #line directives don't consume data from the next line

2013-06-03 Thread Stephen Warren
From: Stephen Warren 

Previously, the #line parsing regex ended with ({WS}+[0-9]+)?. The {WS}
could match line-break characters. If the #line directive did not contain
the optional flags field at the end, this could cause any integer data on
the next line to be consumed as part of the #line directive parsing. This
could cause syntax errors (i.e. #line parsing consuming the leading 0
from a hex literal 0x1234, leaving x1234 to be parsed as cell data,
which is a syntax error), or invalid compilation results (i.e. simply
consuming literal 1234 as part of the #line processing, thus removing it
from the cell data).

Fix this by replacing {WS} with [ \t] so that it can't match line-breaks.

Convert all instances of {WS}, even though the other instances should be
irrelevant for any well-formed #line directive. This is done for
consistency and ultimate safety.

This is a port of upstream dtc commit a1ee6f0 (with same subject) to the
kernel's copy of dtc.

Reported-by: Ian Campbell 
Signed-off-by: Stephen Warren 
---
This is a fix for 3.10.

 scripts/dtc/dtc-lexer.l |2 +-
 scripts/dtc/dtc-lexer.lex.c_shipped |  232 +--
 2 files changed, 117 insertions(+), 117 deletions(-)

diff --git a/scripts/dtc/dtc-lexer.l b/scripts/dtc/dtc-lexer.l
index 254d5af..3b41bfc 100644
--- a/scripts/dtc/dtc-lexer.l
+++ b/scripts/dtc/dtc-lexer.l
@@ -71,7 +71,7 @@ static int pop_input_file(void);
push_input_file(name);
}
 
-<*>^"#"(line)?{WS}+[0-9]+{WS}+{STRING}({WS}+[0-9]+)? {
+<*>^"#"(line)?[ \t]+[0-9]+[ \t]+{STRING}([ \t]+[0-9]+)? {
char *line, *tmp, *fn;
/* skip text before line # */
line = yytext;
diff --git a/scripts/dtc/dtc-lexer.lex.c_shipped 
b/scripts/dtc/dtc-lexer.lex.c_shipped
index a6c5fcd..2d30f41 100644
--- a/scripts/dtc/dtc-lexer.lex.c_shipped
+++ b/scripts/dtc/dtc-lexer.lex.c_shipped
@@ -405,19 +405,19 @@ static yyconst flex_int16_t yy_accept[161] =
 static yyconst flex_int32_t yy_ec[256] =
 {   0,
 1,1,1,1,1,1,1,1,2,3,
-2,2,2,1,1,1,1,1,1,1,
+4,4,4,1,1,1,1,1,1,1,
 1,1,1,1,1,1,1,1,1,1,
-1,2,4,5,6,1,1,7,8,1,
-1,9,   10,   10,   11,   10,   12,   13,   14,   15,
-   15,   15,   15,   15,   15,   15,   15,   16,1,   17,
-   18,   19,   10,   10,   20,   20,   20,   20,   20,   20,
-   21,   21,   21,   21,   21,   22,   21,   21,   21,   21,
-   21,   21,   21,   21,   23,   21,   21,   24,   21,   21,
-1,   25,   26,1,   21,1,   20,   27,   28,   29,
-
-   30,   20,   21,   21,   31,   21,   21,   32,   33,   34,
-   35,   36,   21,   37,   38,   39,   40,   41,   21,   24,
-   42,   21,   43,   44,   45,1,1,1,1,1,
+1,2,5,6,7,1,1,8,9,1,
+1,   10,   11,   11,   12,   11,   13,   14,   15,   16,
+   16,   16,   16,   16,   16,   16,   16,   17,1,   18,
+   19,   20,   11,   11,   21,   21,   21,   21,   21,   21,
+   22,   22,   22,   22,   22,   23,   22,   22,   22,   22,
+   22,   22,   22,   22,   24,   22,   22,   25,   22,   22,
+1,   26,   27,1,   22,1,   21,   28,   29,   30,
+
+   31,   21,   22,   22,   32,   22,   22,   33,   34,   35,
+   36,   37,   22,   38,   39,   40,   41,   42,   22,   25,
+   43,   22,   44,   45,   46,1,1,1,1,1,
 1,1,1,1,1,1,1,1,1,1,
 1,1,1,1,1,1,1,1,1,1,
 1,1,1,1,1,1,1,1,1,1,
@@ -434,36 +434,36 @@ static yyconst flex_int32_t yy_ec[256] =
 1,1,1,1,1
 } ;
 
-static yyconst flex_int32_t yy_meta[46] =
+static yyconst flex_int32_t yy_meta[47] =
 {   0,
-1,1,1,1,1,2,3,1,2,2,
-2,4,5,5,5,6,1,1,1,7,
-8,8,8,8,1,1,7,7,7,7,
-8,8,8,8,8,8,8,8,8,8,
-8,8,3,1,1
+1,1,1,1,1,1,2,3,1,2,
+2,2,4,5,5,5,6,1,1,1,
+7,8,8,8,8,1,1,7,7,7,
+7,8,8,8,8,8,8,8,8,8,
+8,8,8,3,1,1
 } ;
 
 static yyconst flex_int16_t yy_base[175] =
 {   0,
-0,  388,  381,   40,   41,  386,   71,  385,   34,   44,
-  390,  395,   60,   62,  371,  112,  111,  111,  111,  104,
-  370,  106,  371,  342,  124,  119,0,  144,  395,0,
-  123,0,  159,  153,  165,  167,  395,  130,  3

Re: [PATCH] dtc: ensure #line directives don't consume data from the next line

2013-06-03 Thread Ian Campbell
On Mon, 2013-06-03 at 09:36 -0600, Stephen Warren wrote:
> From: Stephen Warren 
> 
> Previously, the #line parsing regex ended with ({WS}+[0-9]+)?. The {WS}
> could match line-break characters. If the #line directive did not contain
> the optional flags field at the end, this could cause any integer data on
> the next line to be consumed as part of the #line directive parsing. This
> could cause syntax errors (i.e. #line parsing consuming the leading 0
> from a hex literal 0x1234, leaving x1234 to be parsed as cell data,
> which is a syntax error), or invalid compilation results (i.e. simply
> consuming literal 1234 as part of the #line processing, thus removing it
> from the cell data).
> 
> Fix this by replacing {WS} with [ \t] so that it can't match line-breaks.
> 
> Convert all instances of {WS}, even though the other instances should be
> irrelevant for any well-formed #line directive. This is done for
> consistency and ultimate safety.
> 
> This is a port of upstream dtc commit a1ee6f0 (with same subject) to the
> kernel's copy of dtc.

FWIW I have tested the upstream commit via my device-tree.git. If that
is considered sufficient then it is OK by me to apply
   Tested-by: Ian Campbell 
to this change too.

> 
> Reported-by: Ian Campbell 
> Signed-off-by: Stephen Warren 
> ---
> This is a fix for 3.10.
> 
>  scripts/dtc/dtc-lexer.l |2 +-
>  scripts/dtc/dtc-lexer.lex.c_shipped |  232 
> +--
>  2 files changed, 117 insertions(+), 117 deletions(-)
> 
> diff --git a/scripts/dtc/dtc-lexer.l b/scripts/dtc/dtc-lexer.l
> index 254d5af..3b41bfc 100644
> --- a/scripts/dtc/dtc-lexer.l
> +++ b/scripts/dtc/dtc-lexer.l
> @@ -71,7 +71,7 @@ static int pop_input_file(void);
>   push_input_file(name);
>   }
>  
> -<*>^"#"(line)?{WS}+[0-9]+{WS}+{STRING}({WS}+[0-9]+)? {
> +<*>^"#"(line)?[ \t]+[0-9]+[ \t]+{STRING}([ \t]+[0-9]+)? {
>   char *line, *tmp, *fn;
>   /* skip text before line # */
>   line = yytext;
> diff --git a/scripts/dtc/dtc-lexer.lex.c_shipped 
> b/scripts/dtc/dtc-lexer.lex.c_shipped
> index a6c5fcd..2d30f41 100644
> --- a/scripts/dtc/dtc-lexer.lex.c_shipped
> +++ b/scripts/dtc/dtc-lexer.lex.c_shipped
> @@ -405,19 +405,19 @@ static yyconst flex_int16_t yy_accept[161] =
>  static yyconst flex_int32_t yy_ec[256] =
>  {   0,
>  1,1,1,1,1,1,1,1,2,3,
> -2,2,2,1,1,1,1,1,1,1,
> +4,4,4,1,1,1,1,1,1,1,
>  1,1,1,1,1,1,1,1,1,1,
> -1,2,4,5,6,1,1,7,8,1,
> -1,9,   10,   10,   11,   10,   12,   13,   14,   15,
> -   15,   15,   15,   15,   15,   15,   15,   16,1,   17,
> -   18,   19,   10,   10,   20,   20,   20,   20,   20,   20,
> -   21,   21,   21,   21,   21,   22,   21,   21,   21,   21,
> -   21,   21,   21,   21,   23,   21,   21,   24,   21,   21,
> -1,   25,   26,1,   21,1,   20,   27,   28,   29,
> -
> -   30,   20,   21,   21,   31,   21,   21,   32,   33,   34,
> -   35,   36,   21,   37,   38,   39,   40,   41,   21,   24,
> -   42,   21,   43,   44,   45,1,1,1,1,1,
> +1,2,5,6,7,1,1,8,9,1,
> +1,   10,   11,   11,   12,   11,   13,   14,   15,   16,
> +   16,   16,   16,   16,   16,   16,   16,   17,1,   18,
> +   19,   20,   11,   11,   21,   21,   21,   21,   21,   21,
> +   22,   22,   22,   22,   22,   23,   22,   22,   22,   22,
> +   22,   22,   22,   22,   24,   22,   22,   25,   22,   22,
> +1,   26,   27,1,   22,1,   21,   28,   29,   30,
> +
> +   31,   21,   22,   22,   32,   22,   22,   33,   34,   35,
> +   36,   37,   22,   38,   39,   40,   41,   42,   22,   25,
> +   43,   22,   44,   45,   46,1,1,1,1,1,
>  1,1,1,1,1,1,1,1,1,1,
>  1,1,1,1,1,1,1,1,1,1,
>  1,1,1,1,1,1,1,1,1,1,
> @@ -434,36 +434,36 @@ static yyconst flex_int32_t yy_ec[256] =
>  1,1,1,1,1
>  } ;
>  
> -static yyconst flex_int32_t yy_meta[46] =
> +static yyconst flex_int32_t yy_meta[47] =
>  {   0,
> -1,1,1,1,1,2,3,1,2,2,
> -2,4,5,5,5,6,1,1,1,7,
> -8,8,8,8,1,1,7,7,7,7,
> -8,8,8,8,8,8,8,8,8,8,
> -8,8,3,1,1
> +1,1,1,1,1,1,2,3,1,2,
> +2,2,4,5,5,5,6,1,1,1,
> +7,8,8,8,8,1,1,7,7,7,
> +7,

Re: [PATCH 1/3] powerpc/mpc85xx: remove the unneeded pci init functions for corenet ds board

2013-06-03 Thread Scott Wood

On 06/01/2013 07:07:20 PM, Kevin Hao wrote:
On Sat, Jun 01, 2013 at 09:47:16PM +1000, Benjamin Herrenschmidt  
wrote:

> On Sat, 2013-06-01 at 18:59 +0800, Kevin Hao wrote:
>
> > The effect of this change is that the isa_io_base will be 0 and  
the IO
> > resource are equal to the virtual address of the IO space. But  
the IO
> > functions such as outx/inx should work as well. This is why I ask  
the
> > above question. What do you think about this? Are there any  
subtle bugs

> > that will be triggered by this?
>
> I don't see any obvious reason why that wouldn't work but like  
anything

> in that area, it needs a bit of testing & hammering to be sure ;-)

Agreed.


Please include QEMU in your testing, as that was where breakage was  
observed that caused us to add the default primary.


> In fact it would work on pmac32 as well since those generally don't  
have

> legacy crap either.
>
> So I have no fundamental objection, it just needs testing. My worry  
is
> that we need to make sure we don't break old chrp and I don't have  
any

> to test with.

Don't worry, my patch just drop the picking of primary bus for several
fsl boards. All these changes are in board specific file, so it should
have no affect to other boards at all.


Is anything actually fixed by this?

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


[RFC PATCH 1/6] KVM: PPC: Book3E: Fix AltiVec interrupt numbers and build breakage

2013-06-03 Thread Mihai Caraman
Interrupt numbers defined for Book3E follows IVORs definition. Align
BOOKE_INTERRUPT_ALTIVEC_UNAVAIL and BOOKE_INTERRUPT_ALTIVEC_ASSIST to this
rule which also fixes the build breakage.
IVORs 32 and 33 are shared so reflect this in the interrupts naming.

Signed-off-by: Mihai Caraman 
---
 arch/powerpc/include/asm/kvm_asm.h |   16 ++--
 1 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/arch/powerpc/include/asm/kvm_asm.h 
b/arch/powerpc/include/asm/kvm_asm.h
index b9dd382..851bac7 100644
--- a/arch/powerpc/include/asm/kvm_asm.h
+++ b/arch/powerpc/include/asm/kvm_asm.h
@@ -54,8 +54,16 @@
 #define BOOKE_INTERRUPT_DEBUG 15
 
 /* E500 */
-#define BOOKE_INTERRUPT_SPE_UNAVAIL 32
-#define BOOKE_INTERRUPT_SPE_FP_DATA 33
+#define BOOKE_INTERRUPT_SPE_ALTIVEC_UNAVAIL 32
+#define BOOKE_INTERRUPT_SPE_FP_DATA_ALTIVEC_ASSIST 33
+/*
+ * TODO: Unify 32-bit and 64-bit kernel exception handlers to use same defines
+ */
+#define BOOKE_INTERRUPT_SPE_UNAVAIL BOOKE_INTERRUPT_SPE_ALTIVEC_UNAVAIL
+#define BOOKE_INTERRUPT_SPE_FP_DATA BOOKE_INTERRUPT_SPE_FP_DATA_ALTIVEC_ASSIST
+#define BOOKE_INTERRUPT_ALTIVEC_UNAVAIL BOOKE_INTERRUPT_SPE_ALTIVEC_UNAVAIL
+#define BOOKE_INTERRUPT_ALTIVEC_ASSIST \
+   BOOKE_INTERRUPT_SPE_FP_DATA_ALTIVEC_ASSIST
 #define BOOKE_INTERRUPT_SPE_FP_ROUND 34
 #define BOOKE_INTERRUPT_PERFORMANCE_MONITOR 35
 #define BOOKE_INTERRUPT_DOORBELL 36
@@ -67,10 +75,6 @@
 #define BOOKE_INTERRUPT_HV_SYSCALL 40
 #define BOOKE_INTERRUPT_HV_PRIV 41
 
-/* altivec */
-#define BOOKE_INTERRUPT_ALTIVEC_UNAVAIL 42
-#define BOOKE_INTERRUPT_ALTIVEC_ASSIST 43
-
 /* book3s */
 
 #define BOOK3S_INTERRUPT_SYSTEM_RESET  0x100
-- 
1.7.4.1


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


[RFC PATCH 5/6] KVM: PPC: Book3E: Add ONE_REG AltiVec support

2013-06-03 Thread Mihai Caraman
Add ONE_REG support for AltiVec on Book3E.

Signed-off-by: Mihai Caraman 
---
 arch/powerpc/kvm/booke.c |   32 
 1 files changed, 32 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/kvm/booke.c b/arch/powerpc/kvm/booke.c
index 01eb635..019496d 100644
--- a/arch/powerpc/kvm/booke.c
+++ b/arch/powerpc/kvm/booke.c
@@ -1570,6 +1570,22 @@ int kvm_vcpu_ioctl_get_one_reg(struct kvm_vcpu *vcpu, 
struct kvm_one_reg *reg)
case KVM_REG_PPC_DEBUG_INST:
val = get_reg_val(reg->id, KVMPPC_INST_EHPRIV);
break;
+#ifdef CONFIG_ALTIVEC
+   case KVM_REG_PPC_VR0 ... KVM_REG_PPC_VR31:
+   if (!cpu_has_feature(CPU_FTR_ALTIVEC)) {
+   r = -ENXIO;
+   break;
+   }
+   val.vval = vcpu->arch.vr[reg->id - KVM_REG_PPC_VR0];
+   break;
+   case KVM_REG_PPC_VSCR:
+   if (!cpu_has_feature(CPU_FTR_ALTIVEC)) {
+   r = -ENXIO;
+   break;
+   }
+   val = get_reg_val(reg->id, vcpu->arch.vscr.u[3]);
+   break;
+#endif /* CONFIG_ALTIVEC */
default:
r = kvmppc_get_one_reg(vcpu, reg->id, &val);
break;
@@ -1643,6 +1659,22 @@ int kvm_vcpu_ioctl_set_one_reg(struct kvm_vcpu *vcpu, 
struct kvm_one_reg *reg)
kvmppc_set_tcr(vcpu, tcr);
break;
}
+#ifdef CONFIG_ALTIVEC
+   case KVM_REG_PPC_VR0 ... KVM_REG_PPC_VR31:
+   if (!cpu_has_feature(CPU_FTR_ALTIVEC)) {
+   r = -ENXIO;
+   break;
+   }
+   vcpu->arch.vr[reg->id - KVM_REG_PPC_VR0] = val.vval;
+   break;
+   case KVM_REG_PPC_VSCR:
+   if (!cpu_has_feature(CPU_FTR_ALTIVEC)) {
+   r = -ENXIO;
+   break;
+   }
+   vcpu->arch.vscr.u[3] = set_reg_val(reg->id, val);
+   break;
+#endif /* CONFIG_ALTIVEC */
default:
r = kvmppc_set_one_reg(vcpu, reg->id, &val);
break;
-- 
1.7.4.1


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


[RFC PATCH 3/6] KVM: PPC: Book3E: Rename IRQPRIO names to accommodate ALTIVEC

2013-06-03 Thread Mihai Caraman
Rename BOOKE_IRQPRIO_SPE_UNAVAIL and BOOKE_IRQPRIO_SPE_FP_DATA names
to accommodate ALTIVEC. Replace BOOKE_INTERRUPT_SPE_UNAVAIL and
BOOKE_INTERRUPT_SPE_FP_DATA with the common version.

Signed-off-by: Mihai Caraman 
---
 arch/powerpc/kvm/booke.c  |   12 ++--
 arch/powerpc/kvm/booke.h  |4 ++--
 arch/powerpc/kvm/bookehv_interrupts.S |8 
 arch/powerpc/kvm/e500.c   |   10 ++
 arch/powerpc/kvm/e500_emulate.c   |8 
 5 files changed, 22 insertions(+), 20 deletions(-)

diff --git a/arch/powerpc/kvm/booke.c b/arch/powerpc/kvm/booke.c
index d082bbc..c08b04b 100644
--- a/arch/powerpc/kvm/booke.c
+++ b/arch/powerpc/kvm/booke.c
@@ -362,8 +362,8 @@ static int kvmppc_booke_irqprio_deliver(struct kvm_vcpu 
*vcpu,
case BOOKE_IRQPRIO_ITLB_MISS:
case BOOKE_IRQPRIO_SYSCALL:
case BOOKE_IRQPRIO_FP_UNAVAIL:
-   case BOOKE_IRQPRIO_SPE_UNAVAIL:
-   case BOOKE_IRQPRIO_SPE_FP_DATA:
+   case BOOKE_IRQPRIO_SPE_ALTIVEC_UNAVAIL:
+   case BOOKE_IRQPRIO_SPE_FP_DATA_ALTIVEC_ASSIST:
case BOOKE_IRQPRIO_SPE_FP_ROUND:
case BOOKE_IRQPRIO_AP_UNAVAIL:
allowed = 1;
@@ -940,7 +940,7 @@ int kvmppc_handle_exit(struct kvm_run *run, struct kvm_vcpu 
*vcpu,
r = RESUME_GUEST;
break;
 
-   case BOOKE_INTERRUPT_SPE_UNAVAIL: {
+   case BOOKE_INTERRUPT_SPE_ALTIVEC_UNAVAIL: {
/*
 * The interrupt is shared, KVM support for the featured unit
 * is detected at run-time.
@@ -957,7 +957,7 @@ int kvmppc_handle_exit(struct kvm_run *run, struct kvm_vcpu 
*vcpu,
 #endif
if (!handled)
kvmppc_booke_queue_irqprio(vcpu,
-   BOOKE_IRQPRIO_SPE_UNAVAIL);
+   BOOKE_IRQPRIO_SPE_ALTIVEC_UNAVAIL);
} else {
/* 
 * Guest wants SPE, but host kernel doesn't support it.
@@ -971,14 +971,14 @@ int kvmppc_handle_exit(struct kvm_run *run, struct 
kvm_vcpu *vcpu,
break;
}
 
-   case BOOKE_INTERRUPT_SPE_FP_DATA:
+   case BOOKE_INTERRUPT_SPE_FP_DATA_ALTIVEC_ASSIST:
/*
 * The interrupt is shared, KVM support for the featured unit
 * is detected at run-time.
 */
if (kvmppc_supports_spe()) {
kvmppc_booke_queue_irqprio(vcpu,
-   BOOKE_IRQPRIO_SPE_FP_DATA);
+   BOOKE_IRQPRIO_SPE_FP_DATA_ALTIVEC_ASSIST);
r = RESUME_GUEST;
} else {
/*
diff --git a/arch/powerpc/kvm/booke.h b/arch/powerpc/kvm/booke.h
index 5fd1ba6..9e92006 100644
--- a/arch/powerpc/kvm/booke.h
+++ b/arch/powerpc/kvm/booke.h
@@ -32,8 +32,8 @@
 #define BOOKE_IRQPRIO_ALIGNMENT 2
 #define BOOKE_IRQPRIO_PROGRAM 3
 #define BOOKE_IRQPRIO_FP_UNAVAIL 4
-#define BOOKE_IRQPRIO_SPE_UNAVAIL 5
-#define BOOKE_IRQPRIO_SPE_FP_DATA 6
+#define BOOKE_IRQPRIO_SPE_ALTIVEC_UNAVAIL 5
+#define BOOKE_IRQPRIO_SPE_FP_DATA_ALTIVEC_ASSIST 6
 #define BOOKE_IRQPRIO_SPE_FP_ROUND 7
 #define BOOKE_IRQPRIO_SYSCALL 8
 #define BOOKE_IRQPRIO_AP_UNAVAIL 9
diff --git a/arch/powerpc/kvm/bookehv_interrupts.S 
b/arch/powerpc/kvm/bookehv_interrupts.S
index e8ed7d6..8d35dc0 100644
--- a/arch/powerpc/kvm/bookehv_interrupts.S
+++ b/arch/powerpc/kvm/bookehv_interrupts.S
@@ -295,9 +295,9 @@ kvm_handler BOOKE_INTERRUPT_DTLB_MISS, EX_PARAMS_TLB, \
SPRN_SRR0, SPRN_SRR1, (NEED_EMU | NEED_DEAR | NEED_ESR)
 kvm_handler BOOKE_INTERRUPT_ITLB_MISS, EX_PARAMS_TLB, \
SPRN_SRR0, SPRN_SRR1, 0
-kvm_handler BOOKE_INTERRUPT_SPE_UNAVAIL, EX_PARAMS(GEN), \
+kvm_handler BOOKE_INTERRUPT_SPE_ALTIVEC_UNAVAIL, EX_PARAMS(GEN), \
SPRN_SRR0, SPRN_SRR1, 0
-kvm_handler BOOKE_INTERRUPT_SPE_FP_DATA, EX_PARAMS(GEN), \
+kvm_handler BOOKE_INTERRUPT_SPE_FP_DATA_ALTIVEC_ASSIST, EX_PARAMS(GEN), \
SPRN_SRR0, SPRN_SRR1, 0
 kvm_handler BOOKE_INTERRUPT_SPE_FP_ROUND, EX_PARAMS(GEN), \
SPRN_SRR0, SPRN_SRR1, 0
@@ -398,8 +398,8 @@ kvm_lvl_handler BOOKE_INTERRUPT_WATCHDOG, \
 kvm_handler BOOKE_INTERRUPT_DTLB_MISS, \
SPRN_SRR0, SPRN_SRR1, (NEED_EMU | NEED_DEAR | NEED_ESR)
 kvm_handler BOOKE_INTERRUPT_ITLB_MISS, SPRN_SRR0, SPRN_SRR1, 0
-kvm_handler BOOKE_INTERRUPT_SPE_UNAVAIL, SPRN_SRR0, SPRN_SRR1, 0
-kvm_handler BOOKE_INTERRUPT_SPE_FP_DATA, SPRN_SRR0, SPRN_SRR1, 0
+kvm_handler BOOKE_INTERRUPT_SPE_ALTIVEC_UNAVAIL, SPRN_SRR0, SPRN_SRR1, 0
+kvm_handler BOOKE_INTERRUPT_SPE_FP_DATA_ALTIVEC_ASSIST, SPRN_SRR0, SPRN_SRR1, 0
 kvm_handler BOOKE_INTERRUPT_SPE_FP_ROUND, SPRN_SRR0, SPRN_SRR1, 0
 kvm_handler BOOKE_INTERRUPT_PERFORMANCE_MONITOR, SPRN_SRR0, SPRN_SRR1, 0
 kvm_handler BOOKE_INTERRUPT_DOORBELL, SPRN_SRR0, SPRN_SRR1, 0
diff --git a/arch/powerpc/kvm/e500.c b/arch/powerpc/kvm/e500.c
index ce6b73c..0fb2f4d

[RFC PATCH 2/6] KVM: PPC: Book3E: Refactor SPE_FP exit handling

2013-06-03 Thread Mihai Caraman
SPE_FP interrupts are shared with ALTIVEC. Refactor SPE_FP exit handling
to detect KVM support for the featured unit at run-time, in order to
accommodate ALTIVEC later.

Signed-off-by: Mihai Caraman 
---
 arch/powerpc/kvm/booke.c |   80 ++
 1 files changed, 59 insertions(+), 21 deletions(-)

diff --git a/arch/powerpc/kvm/booke.c b/arch/powerpc/kvm/booke.c
index 1020119..d082bbc 100644
--- a/arch/powerpc/kvm/booke.c
+++ b/arch/powerpc/kvm/booke.c
@@ -822,6 +822,15 @@ static void kvmppc_restart_interrupt(struct kvm_vcpu *vcpu,
}
 }
 
+static inline bool kvmppc_supports_spe(void)
+{
+#ifdef CONFIG_SPE
+   if (cpu_has_feature(CPU_FTR_SPE))
+   return true;
+#endif
+   return false;
+}
+
 /**
  * kvmppc_handle_exit
  *
@@ -931,42 +940,71 @@ int kvmppc_handle_exit(struct kvm_run *run, struct 
kvm_vcpu *vcpu,
r = RESUME_GUEST;
break;
 
-#ifdef CONFIG_SPE
case BOOKE_INTERRUPT_SPE_UNAVAIL: {
-   if (vcpu->arch.shared->msr & MSR_SPE)
-   kvmppc_vcpu_enable_spe(vcpu);
-   else
-   kvmppc_booke_queue_irqprio(vcpu,
-  BOOKE_IRQPRIO_SPE_UNAVAIL);
+   /*
+* The interrupt is shared, KVM support for the featured unit
+* is detected at run-time.
+*/
+   bool handled = false;
+
+   if (kvmppc_supports_spe()) {
+#ifdef CONFIG_SPE
+   if (cpu_has_feature(CPU_FTR_SPE))
+   if (vcpu->arch.shared->msr & MSR_SPE) {
+   kvmppc_vcpu_enable_spe(vcpu);
+   handled = true;
+   }
+#endif
+   if (!handled)
+   kvmppc_booke_queue_irqprio(vcpu,
+   BOOKE_IRQPRIO_SPE_UNAVAIL);
+   } else {
+   /* 
+* Guest wants SPE, but host kernel doesn't support it.
+* Send an "unimplemented operation" program check to
+* the guest.
+*/
+   kvmppc_core_queue_program(vcpu, ESR_PUO | ESR_SPV);
+   }
+
r = RESUME_GUEST;
break;
}
 
case BOOKE_INTERRUPT_SPE_FP_DATA:
-   kvmppc_booke_queue_irqprio(vcpu, BOOKE_IRQPRIO_SPE_FP_DATA);
-   r = RESUME_GUEST;
+   /*
+* The interrupt is shared, KVM support for the featured unit
+* is detected at run-time.
+*/
+   if (kvmppc_supports_spe()) {
+   kvmppc_booke_queue_irqprio(vcpu,
+   BOOKE_IRQPRIO_SPE_FP_DATA);
+   r = RESUME_GUEST;
+   } else {
+   /*
+* These really should never happen without CONFIG_SPE,
+* as we should never enable the real MSR[SPE] in the
+* guest.
+*/
+   printk(KERN_CRIT "%s: unexpected SPE interrupt %u at \
+   %08lx\n", __func__, exit_nr, vcpu->arch.pc);
+   run->hw.hardware_exit_reason = exit_nr;
+   r = RESUME_HOST;
+   }
+
break;
 
case BOOKE_INTERRUPT_SPE_FP_ROUND:
+#ifdef CONFIG_SPE
kvmppc_booke_queue_irqprio(vcpu, BOOKE_IRQPRIO_SPE_FP_ROUND);
r = RESUME_GUEST;
break;
 #else
-   case BOOKE_INTERRUPT_SPE_UNAVAIL:
/*
-* Guest wants SPE, but host kernel doesn't support it.  Send
-* an "unimplemented operation" program check to the guest.
+* These really should never happen without CONFIG_SPE,
+* as we should never enable the real MSR[SPE] in the
+* guest.
 */
-   kvmppc_core_queue_program(vcpu, ESR_PUO | ESR_SPV);
-   r = RESUME_GUEST;
-   break;
-
-   /*
-* These really should never happen without CONFIG_SPE,
-* as we should never enable the real MSR[SPE] in the guest.
-*/
-   case BOOKE_INTERRUPT_SPE_FP_DATA:
-   case BOOKE_INTERRUPT_SPE_FP_ROUND:
printk(KERN_CRIT "%s: unexpected SPE interrupt %u at %08lx\n",
   __func__, exit_nr, vcpu->arch.pc);
run->hw.hardware_exit_reason = exit_nr;
-- 
1.7.4.1


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


[RFC PATCH 0/6] KVM: PPC: Book3E: AltiVec support

2013-06-03 Thread Mihai Caraman
Mihai Caraman (6):
  KVM: PPC: Book3E: Fix AltiVec interrupt numbers and build breakage
  KVM: PPC: Book3E: Refactor SPE_FP exit handling
  KVM: PPC: Book3E: Rename IRQPRIO names to accommodate ALTIVEC
  KVM: PPC: Book3E: Add AltiVec support
  KVM: PPC: Book3E: Add ONE_REG AltiVec support
  KVM: PPC: Book3E: Enhance FPU laziness

 arch/powerpc/include/asm/kvm_asm.h|   16 ++-
 arch/powerpc/kvm/booke.c  |  189 
 arch/powerpc/kvm/booke.h  |4 +-
 arch/powerpc/kvm/bookehv_interrupts.S |8 +-
 arch/powerpc/kvm/e500.c   |   10 +-
 arch/powerpc/kvm/e500_emulate.c   |8 +-
 arch/powerpc/kvm/e500mc.c |   10 ++-
 7 files changed, 199 insertions(+), 46 deletions(-)

-- 
1.7.4.1


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


[RFC PATCH 4/6] KVM: PPC: Book3E: Add AltiVec support

2013-06-03 Thread Mihai Caraman
KVM Book3E FPU support gracefully reuse host infrastructure so we do the
same for AltiVec. To keep AltiVec lazy call kvmppc_load_guest_altivec()
just when returning to guest instead of each sched in.

Signed-off-by: Mihai Caraman 
---
 arch/powerpc/kvm/booke.c  |   74 +++-
 arch/powerpc/kvm/e500mc.c |8 +
 2 files changed, 80 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/kvm/booke.c b/arch/powerpc/kvm/booke.c
index c08b04b..01eb635 100644
--- a/arch/powerpc/kvm/booke.c
+++ b/arch/powerpc/kvm/booke.c
@@ -134,6 +134,23 @@ static void kvmppc_vcpu_sync_fpu(struct kvm_vcpu *vcpu)
 }
 
 /*
+ * Simulate AltiVec unavailable fault to load guest state
+ * from thread to AltiVec unit.
+ * It requires to be called with preemption disabled.
+ */
+static inline void kvmppc_load_guest_altivec(struct kvm_vcpu *vcpu)
+{
+#ifdef CONFIG_ALTIVEC
+   if (cpu_has_feature(CPU_FTR_ALTIVEC)) {
+   if (!(current->thread.regs->msr & MSR_VEC)) {
+   load_up_altivec(NULL);
+   current->thread.regs->msr |= MSR_VEC;
+   }
+   }
+#endif
+}
+
+/*
  * Helper function for "full" MSR writes.  No need to call this if only
  * EE/CE/ME/DE/RI are changing.
  */
@@ -661,6 +678,12 @@ int kvmppc_vcpu_run(struct kvm_run *kvm_run, struct 
kvm_vcpu *vcpu)
u64 fpr[32];
 #endif
 
+#ifdef CONFIG_ALTIVEC
+   vector128 vr[32];
+   vector128 vscr;
+   int used_vr = 0;
+#endif
+
if (!vcpu->arch.sane) {
kvm_run->exit_reason = KVM_EXIT_INTERNAL_ERROR;
return -EINVAL;
@@ -699,6 +722,22 @@ int kvmppc_vcpu_run(struct kvm_run *kvm_run, struct 
kvm_vcpu *vcpu)
kvmppc_load_guest_fp(vcpu);
 #endif
 
+#ifdef CONFIG_ALTIVEC
+   if (cpu_has_feature(CPU_FTR_ALTIVEC)) {
+   /* Save userspace VEC state in stack */
+   enable_kernel_altivec();
+   memcpy(vr, current->thread.vr, sizeof(current->thread.vr));
+   vscr = current->thread.vscr;
+   used_vr = current->thread.used_vr;
+
+   /* Restore guest VEC state to thread */
+   memcpy(current->thread.vr, vcpu->arch.vr, 
sizeof(vcpu->arch.vr));
+   current->thread.vscr = vcpu->arch.vscr;
+
+   kvmppc_load_guest_altivec(vcpu);
+   }
+#endif
+
ret = __kvmppc_vcpu_run(kvm_run, vcpu);
 
/* No need for kvm_guest_exit. It's done in handle_exit.
@@ -719,6 +758,23 @@ int kvmppc_vcpu_run(struct kvm_run *kvm_run, struct 
kvm_vcpu *vcpu)
current->thread.fpexc_mode = fpexc_mode;
 #endif
 
+#ifdef CONFIG_ALTIVEC
+   if (cpu_has_feature(CPU_FTR_ALTIVEC)) {
+   /* Save AltiVec state to thread */
+   if (current->thread.regs->msr & MSR_VEC)
+   giveup_altivec(current);
+
+   /* Save guest state */
+   memcpy(vcpu->arch.vr, current->thread.vr, 
sizeof(vcpu->arch.vr));
+   vcpu->arch.vscr = current->thread.vscr;
+
+   /* Restore userspace state */
+   memcpy(current->thread.vr, vr, sizeof(current->thread.vr));
+   current->thread.vscr = vscr;
+   current->thread.used_vr = used_vr;
+   }
+#endif
+
 out:
vcpu->mode = OUTSIDE_GUEST_MODE;
return ret;
@@ -822,6 +878,19 @@ static void kvmppc_restart_interrupt(struct kvm_vcpu *vcpu,
}
 }
 
+/*
+ * Always returns true is AltiVec unit is present, see
+ * kvmppc_core_check_processor_compat().
+ */
+static inline bool kvmppc_supports_altivec(void)
+{
+#ifdef CONFIG_ALTIVEC
+   if (cpu_has_feature(CPU_FTR_ALTIVEC))
+   return true;
+#endif
+   return false;
+}
+
 static inline bool kvmppc_supports_spe(void)
 {
 #ifdef CONFIG_SPE
@@ -947,7 +1016,7 @@ int kvmppc_handle_exit(struct kvm_run *run, struct 
kvm_vcpu *vcpu,
 */
bool handled = false;
 
-   if (kvmppc_supports_spe()) {
+   if (kvmppc_supports_altivec() || kvmppc_supports_spe()) {
 #ifdef CONFIG_SPE
if (cpu_has_feature(CPU_FTR_SPE))
if (vcpu->arch.shared->msr & MSR_SPE) {
@@ -976,7 +1045,7 @@ int kvmppc_handle_exit(struct kvm_run *run, struct 
kvm_vcpu *vcpu,
 * The interrupt is shared, KVM support for the featured unit
 * is detected at run-time.
 */
-   if (kvmppc_supports_spe()) {
+   if (kvmppc_supports_altivec() || kvmppc_supports_spe()) {
kvmppc_booke_queue_irqprio(vcpu,
BOOKE_IRQPRIO_SPE_FP_DATA_ALTIVEC_ASSIST);
r = RESUME_GUEST;
@@ -1188,6 +1257,7 @@ int kvmppc_handle_exit(struct kvm_run *run, struct 
kvm_vcpu *vcpu,
r = (s << 2) | RESUME_HOST | (r & RESUME_FLAG_NV);
} else {
kvmppc_lazy_ee_enabl

[RFC PATCH 6/6] KVM: PPC: Book3E: Enhance FPU laziness

2013-06-03 Thread Mihai Caraman
Adopt AltiVec approach to increase laziness by calling kvmppc_load_guest_fp()
just before returning to guest instaed of each sched in.

Signed-off-by: Mihai Caraman 
---
 arch/powerpc/kvm/booke.c  |1 +
 arch/powerpc/kvm/e500mc.c |2 --
 2 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/kvm/booke.c b/arch/powerpc/kvm/booke.c
index 019496d..5382238 100644
--- a/arch/powerpc/kvm/booke.c
+++ b/arch/powerpc/kvm/booke.c
@@ -1258,6 +1258,7 @@ int kvmppc_handle_exit(struct kvm_run *run, struct 
kvm_vcpu *vcpu,
} else {
kvmppc_lazy_ee_enable();
kvmppc_load_guest_altivec(vcpu);
+   kvmppc_load_guest_fp(vcpu);
}
}
 
diff --git a/arch/powerpc/kvm/e500mc.c b/arch/powerpc/kvm/e500mc.c
index 9d7f38e..29cf97a 100644
--- a/arch/powerpc/kvm/e500mc.c
+++ b/arch/powerpc/kvm/e500mc.c
@@ -138,8 +138,6 @@ void kvmppc_core_vcpu_load(struct kvm_vcpu *vcpu, int cpu)
 
if (vcpu->arch.oldpir != mfspr(SPRN_PIR))
kvmppc_e500_tlbil_all(vcpu_e500);
-
-   kvmppc_load_guest_fp(vcpu);
 }
 
 void kvmppc_core_vcpu_put(struct kvm_vcpu *vcpu)
-- 
1.7.4.1


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


Re: IBM OpenPower 720 ipr driver woes

2013-06-03 Thread Robert Knight

On 5/29/2013 2:11 PM, Brian King wrote:

On 05/29/2013 10:15 AM, Robert Knight wrote:

Sometime after kernel 3.3.4, Fedora 17 running on an IBM OpenPower
720 stopped being able to read the SCSI disks with an error
concerning a return code -1.  In the updates since, it has not
resumed working.

Does the ipr driver no longer support this (admittedly ancient)
hardware?

Do you have a boot log you can share?

Thanks,

Brian

Apologies for the slowness of my response.  I had wiped the system, 
Fedora 17 won't install without grub2 tweaks and I had to discover that.


I have copied and pasted the HMC console window:


Boo
ting `Fedora (3.8.11-100.fc17.ppc64)'

Loading Fedora (3.8.11-100.fc17.ppc64)
Loading initial ramdisk ...
OF stdout device is: /vdevice/vty@3000
Preparing to boot Linux version 3.8.11-100.fc17.ppc64 
(mockbu...@ppc-builder7.qa
.fedoraproject.org) (gcc version 4.7.2 20120921 (Red Hat 4.7.2-2) 
(GCC) ) #1 SMP

 Wed May 1 13:51:54 MST 2013
Detected machine type: 0101
Max number of cores passed to firmware: 512 (NR_CPUS = 1024)
Calling ibm,client-architecture-support... not implemented
command line: BOOT_IMAGE=/vmlinuz-3.8.11-100.fc17.ppc64 
root=/dev/mapper/vg_narv
i-lv_root ro rd.md=0 rd.dm=0 KEYTABLE=us rd.lvm.lv=vg_narvi/lv_swap 
rd.luks=0 rd

.lvm.lv=vg_narvi/lv_root SYSFONT=True LANG=en_US.UTF-8 rhgb quiet
memory layout at init:
  memory_limit :  (16 MB aligned)
  alloc_bottom : 0480
  alloc_top: 0800
  alloc_top_hi : ee00
  rmo_top  : 0800
  ram_top  : ee00
instantiating rtas at 0x077b... done
Querying for OPAL presence... not there.
boot cpu hw idx 0
starting cpu hw idx 2... done
copying OF device tree...
Building dt strings...
Building dt structure...
Device tree strings 0x0481 -> 0x0481123d
Device tree struct  0x0482 -> 0x0484
Calling quiesce...
returning from prom_init
[1.376359] ehci-pci :c8:01.2: can't setup
[1.376749] ehci-pci :c8:01.2: init :c8:01.2 fail, -19
[   11.388273] ohci_hcd :c8:01.0: USB HC takeover failed! 
(BIOS/SMM bug)

[   11.388287] ohci_hcd :c8:01.0: can't setup
[   11.388686] ohci_hcd :c8:01.0: init :c8:01.0 fail, -16
[   21.408214] ohci_hcd :c8:01.1: USB HC takeover failed! 
(BIOS/SMM bug)

[   21.408228] ohci_hcd :c8:01.1: can't setup
[   21.408596] ohci_hcd :c8:01.1: init :c8:01.1 fail, -16
Cannot open font file True
Cannot open font file True
[   21.949512] ipr 0001:d0:01.0: Write of cache line size failed
[   22.032546] pata_pdc2027x: Invalid PLL input clock 0kHz, give up!


dracut Warning: Unable to process initqueue
Cannot open font file True


dracut Warning: Unable to process initqueue
dracut Warning: /dev/mapper/vg_narvi-lv_root does not exist
dracut Warning: /dev/vg_narvi/lv_root does not exist
dracut Warning: /dev/vg_narvi/lv_swap does not exist

Dropping to debug shell.

dracut:/#



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


Re: IBM OpenPower 720 ipr driver woes

2013-06-03 Thread Benjamin Herrenschmidt
On Mon, 2013-06-03 at 17:20 -0400, Robert Knight wrote:
> On 5/29/2013 2:11 PM, Brian King wrote:
> > On 05/29/2013 10:15 AM, Robert Knight wrote:
> >> Sometime after kernel 3.3.4, Fedora 17 running on an IBM OpenPower
> >> 720 stopped being able to read the SCSI disks with an error
> >> concerning a return code -1.  In the updates since, it has not
> >> resumed working.
> >>
> >> Does the ipr driver no longer support this (admittedly ancient)
> >> hardware?
> > Do you have a boot log you can share?
> >
> > Thanks,
> >
> > Brian
> >
> Apologies for the slowness of my response.  I had wiped the system, 
> Fedora 17 won't install without grub2 tweaks and I had to discover that.
> 
> I have copied and pasted the HMC console window:

Nothing about IPR here but the USB messages seem to indicate that
something's busted in general with PCI (ie, bus going EEH or something).

Not sure what's up as we don't see a complete boot log. However I don't
think fc17 got much love, have you tried 18 ? We've been running it on
a number of machines reasonably successfully.

Cheers,
Ben.

> > Boo
> > ting `Fedora (3.8.11-100.fc17.ppc64)'
> >
> > Loading Fedora (3.8.11-100.fc17.ppc64)
> > Loading initial ramdisk ...
> > OF stdout device is: /vdevice/vty@3000
> > Preparing to boot Linux version 3.8.11-100.fc17.ppc64 
> > (mockbu...@ppc-builder7.qa
> > .fedoraproject.org) (gcc version 4.7.2 20120921 (Red Hat 4.7.2-2) 
> > (GCC) ) #1 SMP
> >  Wed May 1 13:51:54 MST 2013
> > Detected machine type: 0101
> > Max number of cores passed to firmware: 512 (NR_CPUS = 1024)
> > Calling ibm,client-architecture-support... not implemented
> > command line: BOOT_IMAGE=/vmlinuz-3.8.11-100.fc17.ppc64 
> > root=/dev/mapper/vg_narv
> > i-lv_root ro rd.md=0 rd.dm=0 KEYTABLE=us rd.lvm.lv=vg_narvi/lv_swap 
> > rd.luks=0 rd
> > .lvm.lv=vg_narvi/lv_root SYSFONT=True LANG=en_US.UTF-8 rhgb quiet
> > memory layout at init:
> >   memory_limit :  (16 MB aligned)
> >   alloc_bottom : 0480
> >   alloc_top: 0800
> >   alloc_top_hi : ee00
> >   rmo_top  : 0800
> >   ram_top  : ee00
> > instantiating rtas at 0x077b... done
> > Querying for OPAL presence... not there.
> > boot cpu hw idx 0
> > starting cpu hw idx 2... done
> > copying OF device tree...
> > Building dt strings...
> > Building dt structure...
> > Device tree strings 0x0481 -> 0x0481123d
> > Device tree struct  0x0482 -> 0x0484
> > Calling quiesce...
> > returning from prom_init
> > [1.376359] ehci-pci :c8:01.2: can't setup
> > [1.376749] ehci-pci :c8:01.2: init :c8:01.2 fail, -19
> > [   11.388273] ohci_hcd :c8:01.0: USB HC takeover failed! 
> > (BIOS/SMM bug)
> > [   11.388287] ohci_hcd :c8:01.0: can't setup
> > [   11.388686] ohci_hcd :c8:01.0: init :c8:01.0 fail, -16
> > [   21.408214] ohci_hcd :c8:01.1: USB HC takeover failed! 
> > (BIOS/SMM bug)
> > [   21.408228] ohci_hcd :c8:01.1: can't setup
> > [   21.408596] ohci_hcd :c8:01.1: init :c8:01.1 fail, -16
> > Cannot open font file True
> > Cannot open font file True
> > [   21.949512] ipr 0001:d0:01.0: Write of cache line size failed
> > [   22.032546] pata_pdc2027x: Invalid PLL input clock 0kHz, give up!
> >
> >
> > dracut Warning: Unable to process initqueue
> > Cannot open font file True
> >
> >
> > dracut Warning: Unable to process initqueue
> > dracut Warning: /dev/mapper/vg_narvi-lv_root does not exist
> > dracut Warning: /dev/vg_narvi/lv_root does not exist
> > dracut Warning: /dev/vg_narvi/lv_swap does not exist
> >
> > Dropping to debug shell.
> >
> > dracut:/#
> 
> 
> ___
> Linuxppc-dev mailing list
> Linuxppc-dev@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev


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


Re: [PATCH v2 05/15] fsl_pmc: update device bindings

2013-06-03 Thread Scott Wood

On 04/19/2013 05:47:38 AM, Zhao Chenhui wrote:

From: Li Yang 

Signed-off-by: Li Yang 
Signed-off-by: Zhao Chenhui 
---
 .../devicetree/bindings/powerpc/fsl/pmc.txt|   59  
+++

 1 files changed, 34 insertions(+), 25 deletions(-)

diff --git a/Documentation/devicetree/bindings/powerpc/fsl/pmc.txt  
b/Documentation/devicetree/bindings/powerpc/fsl/pmc.txt

index 07256b7..f1f749f 100644
--- a/Documentation/devicetree/bindings/powerpc/fsl/pmc.txt
+++ b/Documentation/devicetree/bindings/powerpc/fsl/pmc.txt
@@ -9,15 +9,20 @@ Properties:

   "fsl,mpc8548-pmc" should be listed for any chip whose PMC is
   compatible.  "fsl,mpc8536-pmc" should also be listed for any chip
-  whose PMC is compatible, and implies deep-sleep capability.
+  whose PMC is compatible, and implies deep-sleep capability and
+  wake on user defined packet(wakeup on ARP).
+
+  "fsl,p1022-pmc" should be listed for any chip whose PMC is
+  compatible, and implies lossless Ethernet capability during sleep.

   "fsl,mpc8641d-pmc" should be listed for any chip whose PMC is
   compatible; all statements below that apply to "fsl,mpc8548-pmc"  
also

   apply to "fsl,mpc8641d-pmc".

   Compatibility does not include bit assignments in  
SCCR/PMCDR/DEVDISR; these
-  bit assignments are indicated via the sleep specifier in each  
device's

-  sleep property.
+  bit assignments are indicated via the clock nodes.  Device which  
has a
+  controllable clock source should have a "fsl,pmc-handle" property  
pointing

+  to the clock node.


Please respond to the feedback given on v1:
http://patchwork.ozlabs.org/patch/147177/

Also indicate, below the ---, what has changed from previous versions.

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


Re: [1/4] powerpc/85xx: Add a head file for cpu type detection

2013-06-03 Thread Scott Wood
On Mon, Mar 05, 2012 at 11:10:53PM -, chenhui zhao wrote:
> From: chenhui zhao 
> 
> The workarounds need to detect the cpu type. Add these macros
> and inline routines to help cpu type detection in runtime.
> 
> Signed-off-by: Zhao Chenhui 
> Signed-off-by: Li Yang 
> 
> ---
> arch/powerpc/include/asm/mpc85xx.h |   72 
>  1 files changed, 72 insertions(+), 0 deletions(-)
>  create mode 100644 arch/powerpc/include/asm/mpc85xx.h
> 
> diff --git a/arch/powerpc/include/asm/mpc85xx.h 
> b/arch/powerpc/include/asm/mpc85xx.h
> new file mode 100644
> index 000..451777c
> --- /dev/null
> +++ b/arch/powerpc/include/asm/mpc85xx.h
> @@ -0,0 +1,72 @@
> +/*
> + * MPC85xx cpu type detection
> + *
> + * Copyright 2011-2012 Freescale Semiconductor, Inc.
> + *
> + * This is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; either version 2 of the License, or
> + * (at your option) any later version.
> + */
> +
> +#ifndef __ASM_PPC_CPU_H
> +#define __ASM_PPC_CPU_H

s/CPU/MPC85xx/

> +#define SVR_REV(svr) ((svr) & 0xFF)  /* SOC design resision */

Please update U-Boot's definition, so that shared code doesn't run into
problems.

> +#define SVR_MAJ(svr) (((svr) >>  4) & 0xF)   /* Major revision field*/
> +#define SVR_MIN(svr) (((svr) >>  0) & 0xF)   /* Minor revision field*/
> +
> +/* Some parts define SVR[0:23] as the SOC version */
> +#define SVR_SOC_VER(svr) (((svr) >> 8) & 0xFF)   /* SOC Version fields */
> +
> +#define IS_SVR_REV(svr, maj, min) \
> + ((SVR_MAJ(svr) == (maj)) && (SVR_MIN(svr) == (min)))
> +
> +#define SVR_8533 0x803400
> +#define SVR_8533_E   0x803C00
> +#define SVR_8535 0x803701
> +#define SVR_8535_E   0x803F01
> +#define SVR_8536 0x803700
> +#define SVR_8536_E   0x803F00
> +#define SVR_8540 0x803000
> +#define SVR_8541 0x807200
> +#define SVR_8541_E   0x807A00
> +#define SVR_8543 0x803200
> +#define SVR_8543_E   0x803A00

Can we separate out E as an orthogonal bit, as we now do in U-Boot?

> +#define SVR_8544 0x803401
> +#define SVR_8544_E   0x803C01
> +#define SVR_8545 0x803102
> +#define SVR_8545_E   0x803902
> +#define SVR_8547_E   0x803901
> +#define SVR_8548 0x803100
> +#define SVR_8548_E   0x803900
> +#define SVR_8555 0x807100
> +#define SVR_8555_E   0x807900
> +#define SVR_8560 0x807000
> +#define SVR_8567 0x807501
> +#define SVR_8567_E   0x807D01
> +#define SVR_8568 0x807500
> +#define SVR_8568_E   0x807D00
> +#define SVR_8569 0x808000
> +#define SVR_8569_E   0x808800
> +#define SVR_8572 0x80E000
> +#define SVR_8572_E   0x80E800
> +
> +
> +static inline int fsl_svr_is(u32 svr)
> +{
> + u32 id = SVR_SOC_VER(mfspr(SPRN_SVR));
> +
> + return (id == svr);
> +}

fsl_svr_is() and IS_SVR_REV() are confusingly similar, and the
upper/lower difference and word-order difference is jarring.  I'm not
sure why you even need fsl_svr_is.  This file is obviously patterned
after U-Boot code, but U-Boot doesn't have this.  Why can't the caller do
the equality check?

> +/* Return true if current SOC revision is prior to (maj, min)  */
> +static inline int fsl_svr_older_than(u8 maj, u8 min)
> +{
> + u32 rev = SVR_REV(mfspr(SPRN_SVR));
> + u32 cmp = (maj << 4) | min;
> +
> + return (rev < cmp);
> +}

Is this that much easier than the caller doing:

if (SVR_REV(svr) < 0x20)

?

-Scott
 

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


Re: IBM OpenPower 720 ipr driver woes

2013-06-03 Thread Tony Breeds
On Mon, Jun 03, 2013 at 05:20:12PM -0400, Robert Knight wrote:

> >Device tree struct  0x0482 -> 0x0484
> >Calling quiesce...
> >returning from prom_init
> >[1.376359] ehci-pci :c8:01.2: can't setup

Can you try adding "debug" to the kernel commandline.  We're missing a
great chunk of detail. If you're starting from scratch either try F18 or
the F19 Beta (if you're brave :))

Yours Tony


pgpHmmSknjlsw.pgp
Description: PGP signature
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Re: IBM OpenPower 720 ipr driver woes

2013-06-03 Thread Robert Knight

On 6/3/2013 8:01 PM, Tony Breeds wrote:

On Mon, Jun 03, 2013 at 05:20:12PM -0400, Robert Knight wrote:


Device tree struct  0x0482 -> 0x0484
Calling quiesce...
returning from prom_init
[1.376359] ehci-pci :c8:01.2: can't setup

Can you try adding "debug" to the kernel commandline.  We're missing a
great chunk of detail. If you're starting from scratch either try F18 or
the F19 Beta (if you're brave :))

Yours Tony
So, two points.  Since I have no live disks, I can't copy the dmesg 
output in dracut onto a disk and just sent it to you -- the only way 
that I know to get it is cut and paste from a HMC console window into a 
vi buffer.


I removed rhgb and quiet in addition to adding debug to the kernel 
command line in the hope of providing you with information.


My second point is that this failure to connect to the disks happens in 
F18 in pretty much the same way -- it always ends with "pata_pdc2027x 
... give up!".


Here we go again.

Thank you for being willing to try to help remotely.


[0.00] Allocated 917504 bytes for 1024 pacas at c76d
[0.00] Using pSeries machine description
[0.00] Page orders: linear mapping = 24, virtual = 12, io = 12, vmemmap
= 24
[0.00] Found initrd at 0xc380:0xc47f9800
[0.00] bootconsole [udbg0] enabled
[0.00] Partition configured for 4 cpus.
[0.00] CPU maps initialized for 2 threads per core
[0.00]  (thread shift is 1)
[0.00] Freed 851968 bytes for unused pacas
[0.00] Starting Linux PPC64 #1 SMP Wed May 1 13:51:54 MST 2013
[0.00] -
[0.00] ppc64_pft_size= 0x1a
[0.00] physicalMemorySize= 0xee00
[0.00] htab_hash_mask= 0x7
[0.00] -
[0.00] Initializing cgroup subsys cpuset
[0.00] Initializing cgroup subsys cpu
[0.00] Linux version 3.8.11-100.fc17.ppc64 (mockbu...@ppc-builder7.qa.fe
doraproject.org) (gcc version 4.7.2 20120921 (Red Hat 4.7.2-2) (GCC) ) #1 SMP We
d May 1 13:51:54 MST 2013
[0.00] [boot]0012 Setup Arch
[0.00] Node 0 Memory: 0x0-0xee00
[0.00] PCI host bridge /pci@8002002  ranges:
[0.00]   IO 0x03fe0020..0x03fe002f -> 0x
[0.00]  MEM 0x04008000..0x0400bfff -> 0xc000

[0.00] PCI host bridge /pci@8002003  ranges:
[0.00]   IO 0x03fe0070..0x03fe007f -> 0x
[0.00]  MEM 0x0401c000..0x0401 -> 0xc000

[0.00] PPC64 nvram contains 7168 bytes
[0.00] Zone ranges:
[0.00]   DMA  [mem 0x-0xedff]
[0.00]   Normal   empty
[0.00] Movable zone start for each node
[0.00] Early memory node ranges
[0.00]   node   0: [mem 0x-0xedff]
[0.00] On node 0 totalpages: 60928
[0.00]   DMA zone: 53 pages used for memmap
[0.00]   DMA zone: 0 pages reserved
[0.00]   DMA zone: 60875 pages, LIFO batch:1
[0.00] [boot]0015 Setup Done
[0.00] PERCPU: Embedded 2 pages/cpu @c180 s87168 r0 d43904 u
262144
[0.00] pcpu-alloc: s87168 r0 d43904 u262144 alloc=1*1048576 
[0.00] pcpu-alloc: [0] 0 1 2 3
[0.00] Built 1 zonelists in Node order, mobility grouping on.  Total pag
es: 60875
[0.00] Policy zone: DMA
[0.00] Kernel command line: BOOT_IMAGE=/vmlinuz-3.8.11-100.fc17.ppc64 ro
ot=/dev/mapper/vg_narvi-lv_root ro rd.md=0 rd.dm=0 KEYTABLE=us rd.lvm.lv=vg_narv
i/lv_swap rd.luks=0 rd.lvm.lv=vg_narvi/lv_root SYSFONT=True LANG=en_US.UTF-8 deb
ug
[0.00] PID hash table entries: 4096 (order: -1, 32768 bytes)
[0.00] freeing bootmem node 0
[0.00] Memory: 3766784k/3899392k available (18560k kernel code, 132608k
reserved, 1984k data, 2785k bss, 6912k init)
[0.00] SLUB: Genslabs=19, HWalign=128, Order=0-3, MinObjects=0, CPUs=4,
Nodes=256
[0.00] Hierarchical RCU implementation.
[0.00]  RCU restricting CPUs from NR_CPUS=1024 to nr_cpu_ids=4.
[0.00] NR_IRQS:512 nr_irqs:512 16
[0.00] pic: no ISA interrupt controller
[0.00] time_init: decrementer frequency = 188.043000 MHz
[0.00] time_init: processor frequency   = 1504.344000 MHz
[0.00] clocksource: timebase mult[5516408] shift[24] registered
[0.00] clockevent: decrementer mult[30239607] shift[32] cpu[0]
[0.00] Console: colour dummy device 80x25

[0.00] console [hvc0] enabled, bootconsole disabled
[0.00] allocated 974848 bytes of page_cgroup
[0.00] please try 'cgroup_disable=memory' option if you don't want memor
y cgroups
[

Re: [PATCH] powerpc/hw_breakpoints: Add DABRX cpu feature

2013-06-03 Thread Michael Neuling
Benh,

Can you take this for 3.10 also?

Mikey

Michael Neuling  wrote:
> Some CPUs have a DABR but not DABRX.  Configuration are:
> - No 32bit CPUs have DABRX but some have DABR.
> - POWER4+ and below have the DABR but no DABRX.
> - 970 and POWER5 and above have DABR and DABRX.
> - POWER8 has DAWR, hence no DABRX.
> 
> This introduces CPU_FTR_DABRX and sets it on appropriate CPUs.  We use
> the top 64 bits for CPU FTR bits since only 64 bit CPUs have this.
> 
> Processors that don't have the DABRX will still work as they will fall
> back to software filtering these breakpoints via perf_exclude_event().
> 
> Signed-off-by: Michael Neuling 
> Reported-by: "Gorelik, Jacob (335F)" 
> cc: sta...@vger.kernel.org (v3.9 only)
> 
> diff --git a/arch/powerpc/include/asm/cputable.h 
> b/arch/powerpc/include/asm/cputable.h
> index 26807e5..6f3887d 100644
> --- a/arch/powerpc/include/asm/cputable.h
> +++ b/arch/powerpc/include/asm/cputable.h
> @@ -176,6 +176,7 @@ extern const char *powerpc_base_platform;
>  #define CPU_FTR_CFAR LONG_ASM_CONST(0x0100)
>  #define  CPU_FTR_HAS_PPR 
> LONG_ASM_CONST(0x0200)
>  #define CPU_FTR_DAWR LONG_ASM_CONST(0x0400)
> +#define CPU_FTR_DABRX
> LONG_ASM_CONST(0x0800)
>  
>  #ifndef __ASSEMBLY__
>  
> @@ -394,19 +395,20 @@ extern const char *powerpc_base_platform;
>   CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | CPU_FTR_ARCH_201 | \
>   CPU_FTR_ALTIVEC_COMP | CPU_FTR_CAN_NAP | CPU_FTR_MMCRA | \
>   CPU_FTR_CP_USE_DCBTZ | CPU_FTR_STCX_CHECKS_ADDRESS | \
> - CPU_FTR_HVMODE)
> + CPU_FTR_HVMODE | CPU_FTR_DABRX)
>  #define CPU_FTRS_POWER5  (CPU_FTR_USE_TB | CPU_FTR_LWSYNC | \
>   CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \
>   CPU_FTR_MMCRA | CPU_FTR_SMT | \
>   CPU_FTR_COHERENT_ICACHE | CPU_FTR_PURR | \
> - CPU_FTR_STCX_CHECKS_ADDRESS | CPU_FTR_POPCNTB)
> + CPU_FTR_STCX_CHECKS_ADDRESS | CPU_FTR_POPCNTB | CPU_FTR_DABRX)
>  #define CPU_FTRS_POWER6 (CPU_FTR_USE_TB | CPU_FTR_LWSYNC | \
>   CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \
>   CPU_FTR_MMCRA | CPU_FTR_SMT | \
>   CPU_FTR_COHERENT_ICACHE | \
>   CPU_FTR_PURR | CPU_FTR_SPURR | CPU_FTR_REAL_LE | \
>   CPU_FTR_DSCR | CPU_FTR_UNALIGNED_LD_STD | \
> - CPU_FTR_STCX_CHECKS_ADDRESS | CPU_FTR_POPCNTB | CPU_FTR_CFAR)
> + CPU_FTR_STCX_CHECKS_ADDRESS | CPU_FTR_POPCNTB | CPU_FTR_CFAR | \
> + CPU_FTR_DABRX)
>  #define CPU_FTRS_POWER7 (CPU_FTR_USE_TB | CPU_FTR_LWSYNC | \
>   CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | CPU_FTR_ARCH_206 |\
>   CPU_FTR_MMCRA | CPU_FTR_SMT | \
> @@ -415,7 +417,7 @@ extern const char *powerpc_base_platform;
>   CPU_FTR_DSCR | CPU_FTR_SAO  | CPU_FTR_ASYM_SMT | \
>   CPU_FTR_STCX_CHECKS_ADDRESS | CPU_FTR_POPCNTB | CPU_FTR_POPCNTD | \
>   CPU_FTR_ICSWX | CPU_FTR_CFAR | CPU_FTR_HVMODE | \
> - CPU_FTR_VMX_COPY | CPU_FTR_HAS_PPR)
> + CPU_FTR_VMX_COPY | CPU_FTR_HAS_PPR | CPU_FTR_DABRX)
>  #define CPU_FTRS_POWER8 (CPU_FTR_USE_TB | CPU_FTR_LWSYNC | \
>   CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | CPU_FTR_ARCH_206 |\
>   CPU_FTR_MMCRA | CPU_FTR_SMT | \
> @@ -430,14 +432,15 @@ extern const char *powerpc_base_platform;
>   CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \
>   CPU_FTR_ALTIVEC_COMP | CPU_FTR_MMCRA | CPU_FTR_SMT | \
>   CPU_FTR_PAUSE_ZERO  | CPU_FTR_CELL_TB_BUG | CPU_FTR_CP_USE_DCBTZ | \
> - CPU_FTR_UNALIGNED_LD_STD)
> + CPU_FTR_UNALIGNED_LD_STD | CPU_FTR_DABRX)
>  #define CPU_FTRS_PA6T (CPU_FTR_USE_TB | CPU_FTR_LWSYNC | \
>   CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_ALTIVEC_COMP | \
> - CPU_FTR_PURR | CPU_FTR_REAL_LE)
> + CPU_FTR_PURR | CPU_FTR_REAL_LE | CPU_FTR_DABRX)
>  #define CPU_FTRS_COMPATIBLE  (CPU_FTR_USE_TB | CPU_FTR_PPCAS_ARCH_V2)
>  
>  #define CPU_FTRS_A2 (CPU_FTR_USE_TB | CPU_FTR_SMT | CPU_FTR_DBELL | \
> -  CPU_FTR_NOEXECUTE | CPU_FTR_NODSISRALIGN | CPU_FTR_ICSWX)
> +  CPU_FTR_NOEXECUTE | CPU_FTR_NODSISRALIGN | \
> +  CPU_FTR_ICSWX | CPU_FTR_DABRX )
>  
>  #ifdef __powerpc64__
>  #ifdef CONFIG_PPC_BOOK3E
> diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
> index a902723..b0f3e3f 100644
> --- a/arch/powerpc/kernel/process.c
> +++ b/arch/powerpc/kernel/process.c
> @@ -399,7 +399,8 @@ static inline int __set_dabr(unsigned long dabr, unsigned 
> long dabrx)
>  static inline int __set_dabr(unsigned long dabr, unsigned long dabrx)
>  {
>   mtspr(SPRN_DABR, dabr);
> - mtspr(SPRN_DABRX, dabrx);
> + if (cpu_has_feature(CPU_FTR_DABRX))
> + mtspr(SPRN_DABRX, dabrx);
>   return 0;
>  }
>  #else
> ___
> Linuxppc-dev mailing list
> Linuxppc-dev@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev
> 
___

Re: IBM OpenPower 720 ipr driver woes

2013-06-03 Thread Tony Breeds
On Mon, Jun 03, 2013 at 09:40:52PM -0400, Robert Knight wrote:
> On 6/3/2013 8:01 PM, Tony Breeds wrote:
> >On Mon, Jun 03, 2013 at 05:20:12PM -0400, Robert Knight wrote:
> >
> >>>Device tree struct  0x0482 -> 0x0484
> >>>Calling quiesce...
> >>>returning from prom_init
> >>>[1.376359] ehci-pci :c8:01.2: can't setup
> >Can you try adding "debug" to the kernel commandline.  We're missing a
> >great chunk of detail. If you're starting from scratch either try F18 or
> >the F19 Beta (if you're brave :))
> >
> >Yours Tony
> So, two points.  Since I have no live disks, I can't copy the dmesg
> output in dracut onto a disk and just sent it to you -- the only way
> that I know to get it is cut and paste from a HMC console window
> into a vi buffer.

Okay, when I've been in that situation, I run "script" locally and then
conenct to the HMC console.

When you're done you can exit script adn then a file called typescript
will exist in the directory you ran script in.

It's a less overhead way of doign what you're already doing.
 [0.087097] NET: Registered protocol family 16

> [0.087144] pseries_eeh_init: RTAS service  and 
>  bm,get-config-addr-info> invalid
> [0.087155] eeh_init: Failed to call platform init function (-22)

Hmm this seems pretty strange to me.  Gavin are these RTAS tokens
supported on older power5 boxes?


Yours Tony


pgphy7uesd9Ge.pgp
Description: PGP signature
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Re: IBM OpenPower 720 ipr driver woes

2013-06-03 Thread Gavin Shan
On Tue, Jun 04, 2013 at 01:16:52PM +1000, Tony Breeds wrote:
>On Mon, Jun 03, 2013 at 09:40:52PM -0400, Robert Knight wrote:
>> On 6/3/2013 8:01 PM, Tony Breeds wrote:
>> >On Mon, Jun 03, 2013 at 05:20:12PM -0400, Robert Knight wrote:
>> >
>> >>>Device tree struct  0x0482 -> 0x0484
>> >>>Calling quiesce...
>> >>>returning from prom_init
>> >>>[1.376359] ehci-pci :c8:01.2: can't setup
>> >Can you try adding "debug" to the kernel commandline.  We're missing a
>> >great chunk of detail. If you're starting from scratch either try F18 or
>> >the F19 Beta (if you're brave :))
>> >
>> >Yours Tony
>> So, two points.  Since I have no live disks, I can't copy the dmesg
>> output in dracut onto a disk and just sent it to you -- the only way
>> that I know to get it is cut and paste from a HMC console window
>> into a vi buffer.
>
>Okay, when I've been in that situation, I run "script" locally and then
>conenct to the HMC console.
>
>When you're done you can exit script adn then a file called typescript
>will exist in the directory you ran script in.
>
>It's a less overhead way of doign what you're already doing.
> [0.087097] NET: Registered protocol family 16
>
>> [0.087144] pseries_eeh_init: RTAS service  
>> and > bm,get-config-addr-info> invalid
>> [0.087155] eeh_init: Failed to call platform init function (-22)
>
>Hmm this seems pretty strange to me.  Gavin are these RTAS tokens
>supported on older power5 boxes?
>

Yes, Tony. "ibm,get-config-addr-info" should be supported on Power5 box.
Newer PowerBox (e.g. P7) should support "ibm,get-config-addr-info2"

Please have a try on the attached patch, which is based on mainline (3.10).

Thanks,
Gavin


>From 04771628d53e1e6883063ed21bd6825ee9680366 Mon Sep 17 00:00:00 2001
From: Gavin Shan 
Date: Tue, 4 Jun 2013 11:47:59 +0800
Subject: [PATCH] powerpc/eeh: Don't check RTAS token to get PE addr

RTAS token "ibm,get-config-addr-info" or ibm,get-config-addr-info2"
are used to retrieve the PE address according to PCI address, which
made up of domain/bus/slot/function. If we don't have those 2 tokens,
the domain/bus/slot/function would be used as the address for EEH
RTAS operations. Some older f/w might not have those 2 tokens and
that blocks the EEH functionality to be initialized.

The patch skips the check on those 2 tokens so we can bring up EEH
functionality successfully. And domain/bus/slot/function will be
used as address for EEH RTAS operations.

Signed-off-by: Gavin Shan 
---
 arch/powerpc/platforms/pseries/eeh_pseries.c |   12 +---
 1 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/arch/powerpc/platforms/pseries/eeh_pseries.c b/arch/powerpc/platforms/pseries/eeh_pseries.c
index 19506f9..b456b15 100644
--- a/arch/powerpc/platforms/pseries/eeh_pseries.c
+++ b/arch/powerpc/platforms/pseries/eeh_pseries.c
@@ -83,7 +83,11 @@ static int pseries_eeh_init(void)
 	ibm_configure_pe		= rtas_token("ibm,configure-pe");
 	ibm_configure_bridge		= rtas_token("ibm,configure-bridge");
 
-	/* necessary sanity check */
+	/*
+	 * Necessary sanity check. We needn't check "get-config-addr-info"
+	 * and its variant since the old firmware probably support address
+	 * of domain/bus/slot/function for EEH RTAS operations.
+	 */
 	if (ibm_set_eeh_option == RTAS_UNKNOWN_SERVICE) {
 		pr_warning("%s: RTAS service  invalid\n",
 			__func__);
@@ -102,12 +106,6 @@ static int pseries_eeh_init(void)
 		pr_warning("%s: RTAS service  invalid\n",
 			__func__);
 		return -EINVAL;
-	} else if (ibm_get_config_addr_info2 == RTAS_UNKNOWN_SERVICE &&
-		   ibm_get_config_addr_info == RTAS_UNKNOWN_SERVICE) {
-		pr_warning("%s: RTAS service  and "
-			" invalid\n",
-			__func__);
-		return -EINVAL;
 	} else if (ibm_configure_pe == RTAS_UNKNOWN_SERVICE &&
 		   ibm_configure_bridge == RTAS_UNKNOWN_SERVICE) {
 		pr_warning("%s: RTAS service  and "
-- 
1.7.5.4

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

[PATCH] powerpc/perf: Fix deadlock caused by calling printk() in PMU exception

2013-06-03 Thread Michael Ellerman
In commit bc09c21 "Fix finding overflowed PMC in interrupt" we added
a printk() to the PMU exception handler. Unfortunately that is not safe.

The problem is that the PMU exception runs even when interrupts are soft
disabled. We do this so that we can profile parts of the kernel that
have interrupts soft-disabled.

But by calling printk() from the exception handler, we can potentially
deadlock in the printk code on logbuf_lock, eg:

  [c0038ba575c0] c0081928 .vprintk_emit+0xa8/0x540
  [c0038ba576a0] c07bcde8 .printk+0x48/0x58
  [c0038ba57710] c0076504 .perf_event_interrupt+0x2d4/0x490
  [c0038ba57810] c001f6f8 .performance_monitor_exception+0x48/0x60
  [c0038ba57880] c00032cc performance_monitor_common+0x14c/0x180
  --- Exception: f01 (Performance Monitor) at c07b25d4 
._raw_spin_lock_irq
  +0x64/0xc0
  [c0038ba57bf0] c007ed90 .devkmsg_read+0xd0/0x5a0
  [c0038ba57d00] c01c2934 .vfs_read+0xc4/0x1e0
  [c0038ba57d90] c01c2cd8 .SyS_read+0x58/0xd0
  [c0038ba57e30] c0009d54 syscall_exit+0x0/0x98
  --- Exception: c01 (System Call) at 1fbf6f7c
  SP (36d4de10) is in userspace

The fix is to not call printk() from the PMU exception handler. Instead
add a counter to track spurious PMU interrupts and display them in
/proc/interrupts.

Signed-off-by: Michael Ellerman 
Cc:  # 3.9
---
 arch/powerpc/include/asm/hardirq.h |1 +
 arch/powerpc/kernel/irq.c  |5 +
 arch/powerpc/perf/core-book3s.c|5 +++--
 3 files changed, 9 insertions(+), 2 deletions(-)

tag: for-3.10

diff --git a/arch/powerpc/include/asm/hardirq.h 
b/arch/powerpc/include/asm/hardirq.h
index 3bdcfce..23b5c45 100644
--- a/arch/powerpc/include/asm/hardirq.h
+++ b/arch/powerpc/include/asm/hardirq.h
@@ -8,6 +8,7 @@ typedef struct {
unsigned int __softirq_pending;
unsigned int timer_irqs;
unsigned int pmu_irqs;
+   unsigned int pmu_spurious_irqs;
unsigned int mce_exceptions;
unsigned int spurious_irqs;
 #ifdef CONFIG_PPC_DOORBELL
diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c
index 5cbcf4d..91f5d03 100644
--- a/arch/powerpc/kernel/irq.c
+++ b/arch/powerpc/kernel/irq.c
@@ -369,6 +369,11 @@ int arch_show_interrupts(struct seq_file *p, int prec)
seq_printf(p, "%10u ", per_cpu(irq_stat, j).pmu_irqs);
seq_printf(p, "  Performance monitoring interrupts\n");
 
+   seq_printf(p, "%*s: ", prec, "PMS");
+   for_each_online_cpu(j)
+   seq_printf(p, "%10u ", per_cpu(irq_stat, j).pmu_irqs);
+   seq_printf(p, "  Performance monitoring interrupts (spurious)\n");
+
seq_printf(p, "%*s: ", prec, "MCE");
for_each_online_cpu(j)
seq_printf(p, "%10u ", per_cpu(irq_stat, j).mce_exceptions);
diff --git a/arch/powerpc/perf/core-book3s.c b/arch/powerpc/perf/core-book3s.c
index 845c867..3a71069 100644
--- a/arch/powerpc/perf/core-book3s.c
+++ b/arch/powerpc/perf/core-book3s.c
@@ -1758,8 +1758,9 @@ static void perf_event_interrupt(struct pt_regs *regs)
}
}
}
-   if ((!found) && printk_ratelimit())
-   printk(KERN_WARNING "Can't find PMC that caused IRQ\n");
+
+   if (!found)
+   __get_cpu_var(irq_stat).pmu_spurious_irqs++;
 
/*
 * Reset MMCR0 to its normal value.  This will set PMXE and
-- 
1.7.10.4

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


[PATCH] powerpc: Rename PMU interrupts from CNT to PMI

2013-06-03 Thread Michael Ellerman
Back in commit 89713ed "Add timer, performance monitor and machine check
counts to /proc/interrupts" we added a count of PMU interrupts to the
output of /proc/interrupts.

At the time we named them "CNT" to match x86.

However in commit 89ccf46 "Rename 'performance counter interrupt'", the
x86 guys renamed theirs from "CNT" to "PMI".

Arguably changing the name could break someone's script, but I think the
chance of that is minimal, and it's preferable to have a name that 1) is
somewhat meaningful, and 2) matches x86.

Signed-off-by: Michael Ellerman 
---
 arch/powerpc/kernel/irq.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c
index 91f5d03..f3da6215 100644
--- a/arch/powerpc/kernel/irq.c
+++ b/arch/powerpc/kernel/irq.c
@@ -364,7 +364,7 @@ int arch_show_interrupts(struct seq_file *p, int prec)
seq_printf(p, "%10u ", per_cpu(irq_stat, j).spurious_irqs);
seq_printf(p, "  Spurious interrupts\n");
 
-   seq_printf(p, "%*s: ", prec, "CNT");
+   seq_printf(p, "%*s: ", prec, "PMI");
for_each_online_cpu(j)
seq_printf(p, "%10u ", per_cpu(irq_stat, j).pmu_irqs);
seq_printf(p, "  Performance monitoring interrupts\n");
-- 
1.7.10.4

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