[PATCH] powerpc: Add an in memory udbg console

2013-04-29 Thread Alistair Popple
This patch adds a new udbg early debug console which utilises
statically defined input and output buffers stored within the kernel
BSS. It is primarily designed to assist with bring up of new hardware
which may not have a working console but which has a method of
reading/writing kernel memory.

Signed-off-by: Alistair Popple alist...@popple.id.au
---
 arch/powerpc/Kconfig.debug |   23 ++
 arch/powerpc/include/asm/udbg.h|1 +
 arch/powerpc/kernel/udbg.c |3 ++
 arch/powerpc/sysdev/Makefile   |2 +
 arch/powerpc/sysdev/udbg_memcons.c |   85 
 5 files changed, 114 insertions(+)
 create mode 100644 arch/powerpc/sysdev/udbg_memcons.c

diff --git a/arch/powerpc/Kconfig.debug b/arch/powerpc/Kconfig.debug
index 5416e28..863d877 100644
--- a/arch/powerpc/Kconfig.debug
+++ b/arch/powerpc/Kconfig.debug
@@ -262,8 +262,31 @@ config PPC_EARLY_DEBUG_OPAL_HVSI
  Select this to enable early debugging for the PowerNV platform
  using an hvsi console
 
+config PPC_EARLY_DEBUG_MEMCONS
+   bool In memory console
+   help
+ Select this to enable early debugging using an in memory console.
+ This console provides input and output buffers stored within the
+ kernel BSS and should be safe to select on any system. A debugger
+ can then be used to read kernel output or send input to the console.
 endchoice
 
+config PPC_MEMCONS_OUTPUT_SIZE
+   int In memory console output buffer size
+   depends on PPC_EARLY_DEBUG_MEMCONS
+   default 4096
+   help
+ Selects the size of the output buffer (in bytes) of the in memory
+ console.
+
+config PPC_MEMCONS_INPUT_SIZE
+   int In memory console input buffer size
+   depends on PPC_EARLY_DEBUG_MEMCONS
+   default 128
+   help
+ Selects the size of the input buffer (in bytes) of the in memory
+ console.
+
 config PPC_EARLY_DEBUG_OPAL
def_bool y
depends on PPC_EARLY_DEBUG_OPAL_RAW || PPC_EARLY_DEBUG_OPAL_HVSI
diff --git a/arch/powerpc/include/asm/udbg.h b/arch/powerpc/include/asm/udbg.h
index 5a7510e..dc59091 100644
--- a/arch/powerpc/include/asm/udbg.h
+++ b/arch/powerpc/include/asm/udbg.h
@@ -52,6 +52,7 @@ extern void __init udbg_init_40x_realmode(void);
 extern void __init udbg_init_cpm(void);
 extern void __init udbg_init_usbgecko(void);
 extern void __init udbg_init_wsp(void);
+extern void __init udbg_init_memcons(void);
 extern void __init udbg_init_ehv_bc(void);
 extern void __init udbg_init_ps3gelic(void);
 extern void __init udbg_init_debug_opal_raw(void);
diff --git a/arch/powerpc/kernel/udbg.c b/arch/powerpc/kernel/udbg.c
index f974849..efa5c93 100644
--- a/arch/powerpc/kernel/udbg.c
+++ b/arch/powerpc/kernel/udbg.c
@@ -64,6 +64,9 @@ void __init udbg_early_init(void)
udbg_init_usbgecko();
 #elif defined(CONFIG_PPC_EARLY_DEBUG_WSP)
udbg_init_wsp();
+#elif defined(CONFIG_PPC_EARLY_DEBUG_MEMCONS)
+   /* In memory console */
+   udbg_init_memcons();
 #elif defined(CONFIG_PPC_EARLY_DEBUG_EHV_BC)
udbg_init_ehv_bc();
 #elif defined(CONFIG_PPC_EARLY_DEBUG_PS3GELIC)
diff --git a/arch/powerpc/sysdev/Makefile b/arch/powerpc/sysdev/Makefile
index b0a518e..99464a7 100644
--- a/arch/powerpc/sysdev/Makefile
+++ b/arch/powerpc/sysdev/Makefile
@@ -64,6 +64,8 @@ endif
 
 obj-$(CONFIG_PPC_SCOM) += scom.o
 
+obj-$(CONFIG_PPC_EARLY_DEBUG_MEMCONS)  += udbg_memcons.o
+
 subdir-ccflags-$(CONFIG_PPC_WERROR) := -Werror
 
 obj-$(CONFIG_PPC_XICS) += xics/
diff --git a/arch/powerpc/sysdev/udbg_memcons.c 
b/arch/powerpc/sysdev/udbg_memcons.c
new file mode 100644
index 000..36f5c44
--- /dev/null
+++ b/arch/powerpc/sysdev/udbg_memcons.c
@@ -0,0 +1,85 @@
+/*
+ * A udbg backend which logs messages and reads input from in memory
+ * buffers.
+ *
+ * Copyright (C) 2003-2005 Anton Blanchard and Milton Miller, IBM Corp
+ * Copyright (C) 2013 Alistair Popple, IBM Corp
+ *
+ *  This program is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU General Public License
+ *  as published by the Free Software Foundation; either version
+ *  2 of the License, or (at your option) any later version.
+ */
+
+#include linux/init.h
+#include linux/kernel.h
+#include asm/page.h
+#include asm/processor.h
+#include asm/udbg.h
+
+struct memcons {
+   char *output_start;
+   char *output_pos;
+   char *output_end;
+   char *input_start;
+   char *input_pos;
+   char *input_end;
+};
+
+static char memcons_output[CONFIG_PPC_MEMCONS_OUTPUT_SIZE];
+static char memcons_input[CONFIG_PPC_MEMCONS_INPUT_SIZE];
+
+struct memcons memcons = {
+   .output_start = memcons_output,
+   .output_pos = memcons_output,
+   .output_end = memcons_output[CONFIG_PPC_MEMCONS_OUTPUT_SIZE],
+   .input_start = memcons_input,
+   .input_pos = memcons_input,
+   .input_end = 

[PATCH] powerpc: Fix missing doorbell IPIs during nap power saving

2013-04-29 Thread Ian Munsie
From: Ian Munsie imun...@au1.ibm.com

If a doorbell IPI comes in while a thread is in nap power saving, the
doorbell interrupt won't be replayed by the hardware since it is edge
sensitive. Currently we are not replaying these interrupts in software,
which can cause threads to miss IPIs that come in during power saving
and eventually will result in an RCU warning from rcu_sched that it has
detected a stalled CPU.

This patch fixes the issue by testing if a doorbell caused the thread to
come out of power saving and sets the corresponding bit in the paca to
indicate a doorbell happened, which will then be handled by the existing
interrupt replay code.

This is not an issue with other interrupts that can wake a thread
(external, decrementer) as they are level sensitive and will continue to
be asserted by the hardware.

Signed-off-by: Ian Munsie imun...@au1.ibm.com
---
 arch/powerpc/include/asm/reg.h|5 -
 arch/powerpc/kernel/idle_power7.S |   23 +++
 2 files changed, 23 insertions(+), 5 deletions(-)

diff --git a/arch/powerpc/include/asm/reg.h b/arch/powerpc/include/asm/reg.h
index 5c6fbe2..dd8a071 100644
--- a/arch/powerpc/include/asm/reg.h
+++ b/arch/powerpc/include/asm/reg.h
@@ -549,14 +549,17 @@
 #define   SRR1_ISI_NOPT0x4000 /* ISI: Not found in hash */
 #define   SRR1_ISI_N_OR_G  0x1000 /* ISI: Access is no-exec or G */
 #define   SRR1_ISI_PROT0x0800 /* ISI: Other protection 
fault */
-#define   SRR1_WAKEMASK0x0038 /* reason for wakeup */
+#define   SRR1_WAKEMASK0x003c /* reason for wakeup [42:45] 
*/
+#define   SRR1_WAKESHIFT   18
 #define   SRR1_WAKESYSERR  0x0030 /* System error */
 #define   SRR1_WAKEEE  0x0020 /* External interrupt */
 #define   SRR1_WAKEMT  0x0028 /* mtctrl */
 #define  SRR1_WAKEHMI  0x0028 /* Hypervisor maintenance */
 #define   SRR1_WAKEDEC 0x0018 /* Decrementer interrupt */
+#define   SRR1_WAKEDBELLP  0x0014 /* Privileged Doorbell */
 #define   SRR1_WAKETHERM   0x0010 /* Thermal management interrupt */
 #define  SRR1_WAKERESET0x0010 /* System reset */
+#define   SRR1_WAKEDBELLH  0x000c /* Hypervisor Doorbell */
 #define  SRR1_WAKESTATE0x0003 /* Powersave exit mask 
[46:47] */
 #define  SRR1_WS_DEEPEST   0x0003 /* Some resources not 
maintained,
  * may not be recoverable */
diff --git a/arch/powerpc/kernel/idle_power7.S 
b/arch/powerpc/kernel/idle_power7.S
index e11863f..c80bb4b 100644
--- a/arch/powerpc/kernel/idle_power7.S
+++ b/arch/powerpc/kernel/idle_power7.S
@@ -108,9 +108,7 @@ _GLOBAL(power7_wakeup_loss)
ld  r5,_NIP(r1)
addir1,r1,INT_FRAME_SIZE
mtcrr3
-   mtspr   SPRN_SRR1,r4
-   mtspr   SPRN_SRR0,r5
-   rfid
+   b   power7_wakeup_common
 
 _GLOBAL(power7_wakeup_noloss)
lbz r0,PACA_NAPSTATELOST(r13)
@@ -120,6 +118,23 @@ _GLOBAL(power7_wakeup_noloss)
ld  r4,_MSR(r1)
ld  r5,_NIP(r1)
addir1,r1,INT_FRAME_SIZE
-   mtspr   SPRN_SRR1,r4
+   /* Fall through */
+
+power7_wakeup_common:
+BEGIN_FTR_SECTION
+   mfspr   r3,SPRN_SRR1
+   extrdi  r3,r3,4,42 /* Extract SRR1_WAKEMASK */
+   cmpwi   r3,SRR1_WAKEDBELLH  SRR1_WAKESHIFT
+   beq 1f
+   cmpwi   r3,SRR1_WAKEDBELLP  SRR1_WAKESHIFT
+   bne 2f
+
+1: /* Woken by a doorbell, set doorbell happened in paca */
+   lbz r3,PACAIRQHAPPENED(r13)
+   ori r3,r3,PACA_IRQ_DBELL
+   stb r3,PACAIRQHAPPENED(r13)
+END_FTR_SECTION_IFSET(CPU_FTR_DBELL)
+
+2: mtspr   SPRN_SRR1,r4
mtspr   SPRN_SRR0,r5
rfid
-- 
1.7.10.4

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


Re: [PATCH] powerpc: Fix missing doorbell IPIs during nap power saving

2013-04-29 Thread Benjamin Herrenschmidt
On Mon, 2013-04-29 at 18:17 +1000, Ian Munsie wrote:
 This is not an issue with other interrupts that can wake a thread
 (external, decrementer) as they are level sensitive and will continue to
 be asserted by the hardware.

However, it might be worth experimenting setting the corresponding
bits in the PACA as well, as this will diminish the latency of
processing them.

IE. local_irq_enable() will see the bit, generate an interrupt
frame and call the handler which is a faster path than re-enabling
MSR:EE and then taking an external interrupt.

Cheers,
Ben.


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


Re: [PATCH] powerpc: Add an in memory udbg console

2013-04-29 Thread Benjamin Herrenschmidt
On Mon, 2013-04-29 at 16:24 +1000, Alistair Popple wrote:
 This patch adds a new udbg early debug console which utilises
 statically defined input and output buffers stored within the kernel
 BSS. It is primarily designed to assist with bring up of new hardware
 which may not have a working console but which has a method of
 reading/writing kernel memory.

This probably need some memory barriers :-)

Cheers,
Ben.

 Signed-off-by: Alistair Popple alist...@popple.id.au
 ---
  arch/powerpc/Kconfig.debug |   23 ++
  arch/powerpc/include/asm/udbg.h|1 +
  arch/powerpc/kernel/udbg.c |3 ++
  arch/powerpc/sysdev/Makefile   |2 +
  arch/powerpc/sysdev/udbg_memcons.c |   85 
 
  5 files changed, 114 insertions(+)
  create mode 100644 arch/powerpc/sysdev/udbg_memcons.c
 
 diff --git a/arch/powerpc/Kconfig.debug b/arch/powerpc/Kconfig.debug
 index 5416e28..863d877 100644
 --- a/arch/powerpc/Kconfig.debug
 +++ b/arch/powerpc/Kconfig.debug
 @@ -262,8 +262,31 @@ config PPC_EARLY_DEBUG_OPAL_HVSI
 Select this to enable early debugging for the PowerNV platform
 using an hvsi console
  
 +config PPC_EARLY_DEBUG_MEMCONS
 + bool In memory console
 + help
 +   Select this to enable early debugging using an in memory console.
 +   This console provides input and output buffers stored within the
 +   kernel BSS and should be safe to select on any system. A debugger
 +   can then be used to read kernel output or send input to the console.
  endchoice
  
 +config PPC_MEMCONS_OUTPUT_SIZE
 + int In memory console output buffer size
 + depends on PPC_EARLY_DEBUG_MEMCONS
 + default 4096
 + help
 +   Selects the size of the output buffer (in bytes) of the in memory
 +   console.
 +
 +config PPC_MEMCONS_INPUT_SIZE
 + int In memory console input buffer size
 + depends on PPC_EARLY_DEBUG_MEMCONS
 + default 128
 + help
 +   Selects the size of the input buffer (in bytes) of the in memory
 +   console.
 +
  config PPC_EARLY_DEBUG_OPAL
   def_bool y
   depends on PPC_EARLY_DEBUG_OPAL_RAW || PPC_EARLY_DEBUG_OPAL_HVSI
 diff --git a/arch/powerpc/include/asm/udbg.h b/arch/powerpc/include/asm/udbg.h
 index 5a7510e..dc59091 100644
 --- a/arch/powerpc/include/asm/udbg.h
 +++ b/arch/powerpc/include/asm/udbg.h
 @@ -52,6 +52,7 @@ extern void __init udbg_init_40x_realmode(void);
  extern void __init udbg_init_cpm(void);
  extern void __init udbg_init_usbgecko(void);
  extern void __init udbg_init_wsp(void);
 +extern void __init udbg_init_memcons(void);
  extern void __init udbg_init_ehv_bc(void);
  extern void __init udbg_init_ps3gelic(void);
  extern void __init udbg_init_debug_opal_raw(void);
 diff --git a/arch/powerpc/kernel/udbg.c b/arch/powerpc/kernel/udbg.c
 index f974849..efa5c93 100644
 --- a/arch/powerpc/kernel/udbg.c
 +++ b/arch/powerpc/kernel/udbg.c
 @@ -64,6 +64,9 @@ void __init udbg_early_init(void)
   udbg_init_usbgecko();
  #elif defined(CONFIG_PPC_EARLY_DEBUG_WSP)
   udbg_init_wsp();
 +#elif defined(CONFIG_PPC_EARLY_DEBUG_MEMCONS)
 + /* In memory console */
 + udbg_init_memcons();
  #elif defined(CONFIG_PPC_EARLY_DEBUG_EHV_BC)
   udbg_init_ehv_bc();
  #elif defined(CONFIG_PPC_EARLY_DEBUG_PS3GELIC)
 diff --git a/arch/powerpc/sysdev/Makefile b/arch/powerpc/sysdev/Makefile
 index b0a518e..99464a7 100644
 --- a/arch/powerpc/sysdev/Makefile
 +++ b/arch/powerpc/sysdev/Makefile
 @@ -64,6 +64,8 @@ endif
  
  obj-$(CONFIG_PPC_SCOM)   += scom.o
  
 +obj-$(CONFIG_PPC_EARLY_DEBUG_MEMCONS)+= udbg_memcons.o
 +
  subdir-ccflags-$(CONFIG_PPC_WERROR) := -Werror
  
  obj-$(CONFIG_PPC_XICS)   += xics/
 diff --git a/arch/powerpc/sysdev/udbg_memcons.c 
 b/arch/powerpc/sysdev/udbg_memcons.c
 new file mode 100644
 index 000..36f5c44
 --- /dev/null
 +++ b/arch/powerpc/sysdev/udbg_memcons.c
 @@ -0,0 +1,85 @@
 +/*
 + * A udbg backend which logs messages and reads input from in memory
 + * buffers.
 + *
 + * Copyright (C) 2003-2005 Anton Blanchard and Milton Miller, IBM Corp
 + * Copyright (C) 2013 Alistair Popple, IBM Corp
 + *
 + *  This program is free software; you can redistribute it and/or
 + *  modify it under the terms of the GNU General Public License
 + *  as published by the Free Software Foundation; either version
 + *  2 of the License, or (at your option) any later version.
 + */
 +
 +#include linux/init.h
 +#include linux/kernel.h
 +#include asm/page.h
 +#include asm/processor.h
 +#include asm/udbg.h
 +
 +struct memcons {
 + char *output_start;
 + char *output_pos;
 + char *output_end;
 + char *input_start;
 + char *input_pos;
 + char *input_end;
 +};
 +
 +static char memcons_output[CONFIG_PPC_MEMCONS_OUTPUT_SIZE];
 +static char memcons_input[CONFIG_PPC_MEMCONS_INPUT_SIZE];
 +
 +struct memcons memcons = {
 + .output_start = memcons_output,
 + .output_pos = memcons_output,
 +  

Please pull 'next' branch of 5xxx tree

2013-04-29 Thread Anatolij Gustschin
Hi Ben !

Please pull mpc5xxx patches for v3.10. There are some changes
for mpc5121 generic platform code to support mpc5125 SoC and DTS
files for ac14xx and MPC5125-TWR boards.

All these patches have already been in linux-next for a while.

Thanks,

Anatolij

The following changes since commit 07961ac7c0ee8b546658717034fe692fd12eefa9:

  Linux 3.9-rc5 (2013-03-31 15:12:43 -0700)

are available in the git repository at:

  git://git.denx.de/linux-2.6-agust.git next

for you to fetch changes up to fdeaf0e20e9f3999c5cb129e821595fe927bf259:

  powerpc/512x: add ifm ac14xx board (2013-04-10 20:48:44 +0200)


Anatolij Gustschin (2):
  powerpc/mpc512x: create SoC devices for more nodes
  powerpc/512x: add ifm ac14xx board

Matteo Facchinetti (2):
  powerpc/512x: move mpc5121_generic platform to mpc512x_generic.
  powerpc/mpc512x: add platform code for MPC5125.

 arch/powerpc/boot/dts/ac14xx.dts   |  392 
 arch/powerpc/boot/dts/mpc5121.dtsi |2 +-
 arch/powerpc/boot/dts/mpc5121ads.dts   |2 +-
 arch/powerpc/boot/dts/mpc5125twr.dts   |  233 
 arch/powerpc/boot/dts/pdm360ng.dts |2 +-
 arch/powerpc/configs/mpc512x_defconfig |2 +-
 arch/powerpc/platforms/512x/Kconfig|8 +-
 arch/powerpc/platforms/512x/Makefile   |2 +-
 arch/powerpc/platforms/512x/clock.c|9 +-
 arch/powerpc/platforms/512x/mpc512x.h  |1 +
 .../512x/{mpc5121_generic.c = mpc512x_generic.c}  |   12 +-
 arch/powerpc/platforms/512x/mpc512x_shared.c   |   33 +-
 12 files changed, 674 insertions(+), 24 deletions(-)
 create mode 100644 arch/powerpc/boot/dts/ac14xx.dts
 create mode 100644 arch/powerpc/boot/dts/mpc5125twr.dts
 rename arch/powerpc/platforms/512x/{mpc5121_generic.c = mpc512x_generic.c} 
(83%)
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[PATCH] powerpc/booke: remove obsolete macro FINISH_EXCEPTION

2013-04-29 Thread Kevin Hao
This is stale and not used by anyone now.

Signed-off-by: Kevin Hao haoke...@gmail.com
---
This passed the build test with the ppc44x_defconfig, corenet32_smp_defconfig.

 arch/powerpc/kernel/head_booke.h | 5 -
 1 file changed, 5 deletions(-)

diff --git a/arch/powerpc/kernel/head_booke.h b/arch/powerpc/kernel/head_booke.h
index 5f051ee..b385350 100644
--- a/arch/powerpc/kernel/head_booke.h
+++ b/arch/powerpc/kernel/head_booke.h
@@ -199,11 +199,6 @@
 .align 5;  
 \
 label:
 
-#define FINISH_EXCEPTION(func) \
-   bl  transfer_to_handler_full;   \
-   .long   func;   \
-   .long   ret_from_except_full
-
 #define EXCEPTION(n, intno, label, hdlr, xfer) \
START_EXCEPTION(label); \
NORMAL_EXCEPTION_PROLOG(intno); \
-- 
1.8.1.4

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


RE: [PATCH 1/3] rapidio: make enumeration/discovery configurable

2013-04-29 Thread Bounine, Alexandre
On Fri, 26 Apr 2013 6:53 PM Andrew Morton a...@linux-foundation.org wrote:
 Subject: Re: [PATCH 1/3] rapidio: make enumeration/discovery
 configurable
 
 This Kconfig change makes my kbuild do Weird Things.
 
 make mrproper ; yes  | make allmodconfig ; make 2/tmp/x
... skip ... 
 :   DMA Engine support for RapidIO (RAPIDIO_DMA_ENGINE) [Y/n/?] y
 :   RapidIO subsystem debug messages (RAPIDIO_DEBUG) [Y/n/?] y
 :   Enumeration method [M/y/?] (NEW) aborted!
 :
 : Console input/output is redirected. Run 'make oldconfig' to update 
 configuration.
 :
 :   SYSHDR  arch/x86/syscalls/../include/generated/uapi/asm/unistd_32.h
 :   SYSHDR  arch/x86/syscalls/../include/generated/uapi/asm/unistd_64.h
 :   SYSHDR
 arch/x86/syscalls/../include/generated/uapi/asm/unistd_x32.h
 
 
 See the Enumeration method [M/y/?] (NEW) aborted!
 
 Note that this only happens when make's stderr is redirected.
 
 I've no idea what's going on here.  This appears to fix things:
 
 --- a/drivers/rapidio/Kconfig~rapidio-make-enumeration-discovery-
 configurable-fix
 +++ a/drivers/rapidio/Kconfig
 @@ -59,7 +59,7 @@ choice
 If unsure, select Basic built-in.
 
  config RAPIDIO_ENUM_BASIC
 - tristate Basic
 + bool Basic
   help
 This option includes basic RapidIO fabric enumeration and
 discovery
 mechanism similar to one described in RapidIO specification
 Annex 1.
 
 but doesn't appear to be what you intended.

Goal is to build enumerator as a module or built-in.
I will retest v2 of patches for this issue.
There are some changes to Kconfig (removed AUTO_ENUM option).

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


[PATCH] powerpc/pseries: correct builds break when CONFIG_SMP not defined

2013-04-29 Thread Nathan Fontenot
Correct build failure for powerpc/pseries builds with CONFIG_SMP not defined.

The function cpu_sibling_mask has no meaning (or definition) when CONFIG_SMP
is not defined. Additionally, the updating of NUMA affinity for a CPU in a UP
system doesn't really make sense.

This patch ifdef's out the code making the affinity updates for PRRN events to
fix the following build break.

arch/powerpc/mm/numa.c: In function ‘stage_topology_update’:
arch/powerpc/mm/numa.c:1535: error: implicit declaration of function 
‘cpu_sibling_mask’
arch/powerpc/mm/numa.c:1535: warning: passing argument 3 of ‘cpumask_or’ makes 
pointer from integer without a cast
make[1]: *** [arch/powerpc/mm/numa.o] Error 1

Signed-off-by: Nathan Fontenot nf...@linux.vnet.ibm.com
---
 arch/powerpc/mm/numa.c |8 
 1 file changed, 8 insertions(+)

Index: ppc-next/arch/powerpc/mm/numa.c
===
--- ppc-next.orig/arch/powerpc/mm/numa.c2013-04-29 07:16:00.0 
-0500
+++ ppc-next/arch/powerpc/mm/numa.c 2013-04-29 07:21:35.0 -0500
@@ -1529,6 +1529,8 @@
mod_timer(topology_timer, topology_timer.expires);
 }
 
+#ifdef CONFIG_SMP
+
 static void stage_topology_update(int core_id)
 {
cpumask_or(cpu_associativity_changes_mask,
@@ -1562,6 +1564,8 @@
.notifier_call = dt_update_callback,
 };
 
+#endif
+
 /*
  * Start polling for associativity changes.
  */
@@ -1573,7 +1577,9 @@
if (!prrn_enabled) {
prrn_enabled = 1;
vphn_enabled = 0;
+#ifdef CONFIG_SMP
rc = of_reconfig_notifier_register(dt_update_nb);
+#endif
}
} else if (firmware_has_feature(FW_FEATURE_VPHN) 
   get_lppaca()-shared_proc) {
@@ -1598,7 +1604,9 @@
 
if (prrn_enabled) {
prrn_enabled = 0;
+#ifdef CONFIG_SMP
rc = of_reconfig_notifier_unregister(dt_update_nb);
+#endif
} else if (vphn_enabled) {
vphn_enabled = 0;
rc = del_timer_sync(topology_timer);

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


Re: [PATCH] powerpc: Fix missing doorbell IPIs during nap power saving

2013-04-29 Thread Greg KH
On Mon, Apr 29, 2013 at 06:17:40PM +1000, Ian Munsie wrote:
 From: Ian Munsie imun...@au1.ibm.com
 
 If a doorbell IPI comes in while a thread is in nap power saving, the
 doorbell interrupt won't be replayed by the hardware since it is edge
 sensitive. Currently we are not replaying these interrupts in software,
 which can cause threads to miss IPIs that come in during power saving
 and eventually will result in an RCU warning from rcu_sched that it has
 detected a stalled CPU.
 
 This patch fixes the issue by testing if a doorbell caused the thread to
 come out of power saving and sets the corresponding bit in the paca to
 indicate a doorbell happened, which will then be handled by the existing
 interrupt replay code.
 
 This is not an issue with other interrupts that can wake a thread
 (external, decrementer) as they are level sensitive and will continue to
 be asserted by the hardware.
 
 Signed-off-by: Ian Munsie imun...@au1.ibm.com


formletter

This is not the correct way to submit patches for inclusion in the
stable kernel tree.  Please read Documentation/stable_kernel_rules.txt
for how to do this properly.

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


Re: [PATCH] powerpc/fsl-pci: don't unmap the PCI SoC controller registers in setup_pci_atmu

2013-04-29 Thread Kumar Gala

On Apr 13, 2013, at 2:14 AM, Kevin Hao wrote:

 In patch 34642bbb (powerpc/fsl-pci: Keep PCI SoC controller registers in
 pci_controller) we choose to keep the map of the PCI SoC controller
 registers. But we missed to delete the unmap in setup_pci_atmu
 function. This will cause the following call trace once we access
 the PCI SoC controller registers later.
 
 Unable to handle kernel paging request for data at address 0x880080040f14
 Faulting instruction address: 0xc002ea58
 Oops: Kernel access of bad area, sig: 11 [#1]
 SMP NR_CPUS=24 T4240 QDS
 Modules linked in:
 NIP: c002ea58 LR: c002eaf4 CTR: c002eac0
 REGS: c0017e10b4a0 TRAP: 0300   Not tainted  
 (3.9.0-rc1-00052-gfa3529f-dirty)
 MSR: 80029000 CE,EE,ME  CR: 28adbe22  XER: 
 SOFTE: 0
 DEAR: 880080040f14, ESR: 
 TASK = c0017e10[1] 'swapper/0' THREAD: c0017e108000 CPU: 2
 GPR00:  c0017e10b720 c09928d8 c0017e578e00
 GPR04:  000c 0001 c0017e10bb40
 GPR08:  88008004  0016
 GPR12: 88adbe22 cfffa800 c0001ba0 
 GPR16:    
 GPR20:    c08a5b70
 GPR24: c08af938 c09a28d8 c09bb5dc c0017e10bb40
 GPR28: c0017e32a400 c0017e10bc00 c0017e32a400 c0017e578e00
 NIP [c002ea58] .fsl_pcie_check_link+0x88/0xf0
 LR [c002eaf4] .fsl_indirect_read_config+0x34/0xb0
 Call Trace:
 [c0017e10b720] [c0017e10b7a0] 0xc0017e10b7a0 (unreliable)
 [c0017e10ba30] [c002eaf4] .fsl_indirect_read_config+0x34/0xb0
 [c0017e10bad0] [c033aa08] .pci_bus_read_config_byte+0x88/0xd0
 [c0017e10bb90] [c088d708] .pci_apply_final_quirks+0x9c/0x18c
 [c0017e10bc40] [c00013dc] .do_one_initcall+0x5c/0x1f0
 [c0017e10bcf0] [c086ebac] .kernel_init_freeable+0x180/0x26c
 [c0017e10bdb0] [c0001bbc] .kernel_init+0x1c/0x460
 [c0017e10be30] [c880] .ret_from_kernel_thread+0x64/0xe4
 Instruction dump:
 38210310 2b800015 4fdde842 7c600026 5463fffe e8010010 7c0803a6 4e800020
 6000 6000 e92301d0 7c0004ac 80690f14 0c03 4c00012c 38210310
 ---[ end trace 7a8fe0cbccb7d992 ]---
 
 Kernel panic - not syncing: Attempted to kill init! exitcode=0x000b
 
 Signed-off-by: Kevin Hao haoke...@gmail.com
 ---
 This is based on Kumar's next branch.
 
 arch/powerpc/sysdev/fsl_pci.c | 7 ++-
 1 file changed, 2 insertions(+), 5 deletions(-)

applied to next

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


Re: [PATCH] powerpc/fsl-booke: add the reg property for pci bridge device node for t4/b4xx boards

2013-04-29 Thread Kumar Gala

On Apr 14, 2013, at 12:40 AM, Kevin Hao wrote:

 The reg property in the pci bridge device node is used to bind this
 device node to the pci bridge device. Then all the pci devices under
 this bridge could use the interrupt maps defined in this device node
 to do the irq translation. So if this property is missed, the pci
 traditional irq mechanism will not work.
 
 Signed-off-by: Kevin Hao haoke...@gmail.com
 ---
 arch/powerpc/boot/dts/fsl/b4si-post.dtsi| 1 +
 arch/powerpc/boot/dts/fsl/t4240si-post.dtsi | 4 
 2 files changed, 5 insertions(+)

applied to next

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


Re: [PATCH v2] powerpc/dts: Fix the dts for p1025rdb 36bit

2013-04-29 Thread Kumar Gala

On Mar 24, 2013, at 8:23 PM, Zhicheng Fan wrote:

 fix the following errors:
   Error: arch/powerpc/boot/dts/p1025rdb.dtsi:326.2-3 label or path, 'qe', 
 not found
   Error: arch/powerpc/boot/dts/fsl/p1021si-post.dtsi:242.2-3 label or 
 path, 'qe', not found
   FATAL ERROR: Syntax error parsing input tree
 
 Signed-off-by: Zhicheng Fan b32...@freescale.com
 ---
 arch/powerpc/boot/dts/p1025rdb_36b.dts |5 +
 1 files changed, 5 insertions(+), 0 deletions(-)

applied to next

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


[git pull] Please pull powerpc.git next branch

2013-04-29 Thread Kumar Gala
Ben,

Add support for T4 and B4 SoC families from Freescale, e6500 altivec support, 
some various board fixes and other minor cleanups.

- k

The following changes since commit 54c9b2253d34e8998e4bff9ac2d7a3ba0b861d52:

  powerpc: Set DSCR bit in FSCR setup (2013-03-05 16:56:30 +1100)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/galak/powerpc.git next

for you to fetch changes up to 9e2ecdbba3b0745f9ed454ab86961e3ccf9dc224:

  powerpc/fsl-booke: add the reg prop for pci bridge device node for T4/B4 
(2013-04-29 14:47:25 -0500)


Ben Collins (1):
  powerpc/85xx: sgy-cts1000 - Remove __dev* attributes

Chen-Hui Zhao (1):
  powerpc/85xx: fix a bug with the parameter of mpic_reset_core()

Jia Hongtao (1):
  powerpc/85xx: Add platform_device declaration to fsl_pci.h

Jiucheng Xu (1):
  powerpc/85xx: Reserve a partition of NOR flash for QE ucode firmware

Kevin Hao (2):
  powerpc/fsl-pci: don't unmap the PCI SoC controller registers in 
setup_pci_atmu
  powerpc/fsl-booke: add the reg prop for pci bridge device node for T4/B4

Kumar Gala (11):
  powerpc/fsl-booke: Support detection of page sizes on e6500
  powerpc/85xx: Add AltiVec support for e6500
  powerpc/fsl-booke: Add initial silicon device tree for T4240
  powerpc/fsl-booke: Add initial T4240QDS board device tree
  powerpc/fsl-booke: Add initial T4240QDS board support
  powerpc/85xx: Update corenet64_smp_defconfig for T4240
  powerpc/qe: Fix Kconfig enablement of QE_USB support
  powerpc/fsl-booke: Update T4240 device config node in device tree
  powerpc/fsl-booke: Minor fixes to T4240 Si device tree
  powerpc/fsl-pci: Keep PCI SoC controller registers in pci_controller
  powerpc/85xx: Fix MPC8536DS 36-bit device tree

Paul Bolle (2):
  powerpc: remove config 8260_PCI9
  powerpc: remove config MPC10X_OPENPIC

Prabhakar Kushwaha (1):
  powerpc: add CONFIG(s) require for using flash controller

Ramneek Mehresh (1):
  powerpc/85xx: Add first usb controller node for Qonverge platforms

Rojhalat Ibrahim (1):
  powerpc/fsl-pci Make PCIe hotplug work with Freescale PCIe controllers

Roy ZANG (2):
  powerpc/85xx: Add support for FSL PCIe controller v3.0
  powerpc/85xx: enable Silicon image 3132 PCIe to SATA controller

Roy Zang (2):
  powerpc/85xx: enable E1000 NIC to mpc85xx_defconfig
  powerpc/fsl_pci: fix 64 bit pci size issue

Scott Wood (1):
  powerpc/85xx: add CONFIG_E1000E to corenet64_smp_defconfig

Sebastian Andrzej Siewior (1):
  powerpc/fsl-msi: use a different lockclass for the cascade interrupt

Shaveta Leekha (5):
  powerpc/85xx: add SEC-5.3 device tree
  powerpc/fsl-booke: Add initial silicon device tree files for B4860 and 
B4420
  powerpc/fsl-booke: Add initial B4860QDS and B4420QDS board device tree
  powerpc/fsl-booke: Add B4_QDS board support
  powerpc/85xx: Update corenet64_smp_defconfig for B4_QDS

Stephen George (2):
  powerpc/fsl-booke: Added device tree DCSR entries for T4240 Chassis v2 
Debug IP
  powerpc/fsl-booke: Update DCSR EPU device tree entries for existing SoCs

Stuart Yoder (3):
  powerpc/e6500: Add architecture categories for e6500 cores
  powerpc: add missing deo arch category to e500mc/e5500 dts
  powerpc: Add paravirt idle loop for 64-bit Book-E

Tang Yuantian (1):
  powerpc/fsl: remove the PPC_CLOCK dependency

Vakul Garg (3):
  powerpc/85xx: Added SEC-5.0 device tree.
  powerpc/fsl: removed qoriq-sec4.1-0.dtsi.
  powerpc/fsl: Add property for 'era' in SEC dts crypto node

Zhicheng Fan (1):
  powerpc/dts: Fix the dts for p1025rdb 36bit

 .../devicetree/bindings/powerpc/fsl/cpus.txt   |  22 +
 arch/powerpc/Kconfig   |   6 -
 arch/powerpc/boot/dts/b4420qds.dts |  50 +++
 arch/powerpc/boot/dts/b4860qds.dts |  61 +++
 arch/powerpc/boot/dts/b4qds.dts| 169 
 arch/powerpc/boot/dts/fsl/b4420si-post.dtsi|  98 +
 arch/powerpc/boot/dts/fsl/b4420si-pre.dtsi |  73 
 arch/powerpc/boot/dts/fsl/b4860si-post.dtsi| 142 +++
 arch/powerpc/boot/dts/fsl/b4860si-pre.dtsi |  83 
 arch/powerpc/boot/dts/fsl/b4si-post.dtsi   | 268 +
 arch/powerpc/boot/dts/fsl/e500mc_power_isa.dtsi|   1 +
 arch/powerpc/boot/dts/fsl/e5500_power_isa.dtsi |   1 +
 arch/powerpc/boot/dts/fsl/e6500_power_isa.dtsi |  65 +++
 arch/powerpc/boot/dts/fsl/p1023si-post.dtsi|   1 +
 arch/powerpc/boot/dts/fsl/p2041si-post.dtsi|   2 +-
 arch/powerpc/boot/dts/fsl/p3041si-post.dtsi|   2 +-
 arch/powerpc/boot/dts/fsl/p4080si-post.dtsi|   2 +-
 arch/powerpc/boot/dts/fsl/p5020si-post.dtsi|   2 +-
 arch/powerpc/boot/dts/fsl/p5040si-post.dtsi|   2 +-
 arch/powerpc/boot/dts/fsl/pq3-sec4.4-0.dtsi  

Re: [PATCH v2 12/15] powerpc/85xx: add time base sync support for e6500

2013-04-29 Thread Scott Wood

On 04/28/2013 04:56:34 AM, Zhao Chenhui wrote:

On Thu, Apr 25, 2013 at 07:07:24PM -0500, Scott Wood wrote:
 On 04/24/2013 07:28:18 PM, Zhao Chenhui wrote:
 On Wed, Apr 24, 2013 at 05:38:16PM -0500, Scott Wood wrote:
  We shouldn't base it on CPU_FTR_SMT.  For example, e6500 doesn't
  claim that feature yet, except in our SDK kernel.  That doesn't
  change the topology of CPU numbering.
 
 
 Then, where can I get the thread information? dts?
 Or, wait for upstream of the thread suppport of e6500.

 It's an inherent property of e6500 (outside of some virtualization
 scenarios, but you wouldn't run this code under a hypervisor) that
 you have two threads per core (whether Linux uses them or not).  Or
 you could read TMCFG0[NTHRD] if you know you're on a chip that has
 TMRs but aren't positive it's an e6500, but I wouldn't bother.  If
 we do ever have such a chip, there are probably other things that
 will need updating.


But how to know that there are TMRs on a chip except by CPU_FTR_SMT.


I don't know.  I said I wouldn't bother. :-)

Just assume there are 2 threads per core on e6500.  Then you won't have  
a dependency on the threading patches, and you won't break if  
CPU_FTR_SMT gets disabled for some other reason, or if the threads are  
missing from the device tree for some reason (I've seen some people  
remove them manually in an attempt to disable threading -- I tell them  
not to when I see it, but eventually others will do it again).


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


Re: [PATCH 2/2 V7] powerpc/85xx: Add machine check handler to fix PCIe erratum on mpc85xx

2013-04-29 Thread Scott Wood

On 04/26/2013 09:26:26 PM, Jia Hongtao-B38951 wrote:

 -Original Message-
 From: Wood Scott-B07421
 Sent: Friday, April 26, 2013 12:58 AM
 To: Segher Boessenkool
 Cc: Jia Hongtao-B38951; linuxppc-dev@lists.ozlabs.org;
 ga...@kernel.crashing.org; Wood Scott-B07421
 Subject: Re: [PATCH 2/2 V7] powerpc/85xx: Add machine check handler  
to

 fix PCIe erratum on mpc85xx

 On 04/25/2013 10:31:51 AM, Segher Boessenkool wrote:
  * Remove A variant of load instruction emulation
 
  Why is this?  You handle all other simple load insns, there is  
nothing
  special about LHA.  (I reviewed the V4 email thread, no reason  
for the

  chance is given there).

 The LHA implementation in V5 was incorrect (didn't sign-extend).

 -Scott

In former email you doubt whether we need A variant or not.
Any particular reason for that?
If not should I emulate all the A ARX AU AUX and AX variant?


I was just noting that the variants you left out from the earlier  
revisions (e.g. BRX) were much more likely to be used for I/O than some  
of the ones you included (e.g. A).  Implementing all the normal  
load/store instructions would be better, if they're done correctly.


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


Re: linux-next: build failure after merge of the cgroup tree

2013-04-29 Thread Tejun Heo
Hello,

On Mon, Apr 29, 2013 at 02:04:33PM +1000, Stephen Rothwell wrote:
 I have added the following merge fix patch for today (but it should be
 applied to the powerpc tree ASAP).
 
 From: Stephen Rothwell s...@canb.auug.org.au
 Date: Mon, 29 Apr 2013 14:01:44 +1000
 Subject: [PATCH] powerpc: numa.c: using kzalloc/kfree requires including
  slab.h
 
 fixes these build errors:
 
 arch/powerpc/mm/numa.c: In function 'arch_update_cpu_topology':
 arch/powerpc/mm/numa.c:1465:2: error: implicit declaration of function 
 'kzalloc' [-Werror=implicit-function-declaration]
 arch/powerpc/mm/numa.c:1465:10: error: assignment makes pointer from integer 
 without a cast [-Werror]
 arch/powerpc/mm/numa.c:1497:2: error: implicit declaration of function 
 'kfree' [-Werror=implicit-function-declaration]
 
 Signed-off-by: Stephen Rothwell s...@canb.auug.org.au

Acked-by: Tejun Heo t...@kernel.org

Benjamin, can you please pick this up?

Thanks a lot and sorry about the trouble.

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


Re: [PATCH] powerpc: fix usage of setup_pci_atmu()

2013-04-29 Thread Stephen Rothwell
Hi Kumar,

On Mon, 15 Apr 2013 15:42:01 +1000 Michael Neuling mi...@neuling.org wrote:

 Linux next is currently failing to compile mpc85xx_defconfig with:
   arch/powerpc/sysdev/fsl_pci.c:944:2: error: too many arguments to function 
 'setup_pci_atmu'
 
 This is caused by (from Kumar's next branch):
   commit 34642bbb3d12121333efcf4ea7dfe66685e403a1
   Author: Kumar Gala ga...@kernel.crashing.org
   powerpc/fsl-pci: Keep PCI SoC controller registers in pci_controller
 
 Which changed definition of setup_pci_atmu() but didn't update one of
 the callers.  Below fixes this.
 
 Signed-off-by: Michael Neuling mi...@neuling.org
 ---
 Kumar: this is for your next tree
 
 diff --git a/arch/powerpc/sysdev/fsl_pci.c b/arch/powerpc/sysdev/fsl_pci.c
 index 83918c3..a10a036 100644
 --- a/arch/powerpc/sysdev/fsl_pci.c
 +++ b/arch/powerpc/sysdev/fsl_pci.c
 @@ -941,7 +941,7 @@ static int fsl_pci_resume(struct device *dev)
   return -ENODEV;
   }
  
 - setup_pci_atmu(hose, pci_rsrc);
 + setup_pci_atmu(hose);
  
   return 0;
  }
 

This is still not in your tree ...
-- 
Cheers,
Stephen Rothwells...@canb.auug.org.au


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

Re: [PATCH] powerpc: fix usage of setup_pci_atmu()

2013-04-29 Thread Benjamin Herrenschmidt
On Tue, 2013-04-30 at 09:06 +1000, Stephen Rothwell wrote:

 
 This is still not in your tree ...

I'll apply it after I merge kumar stuff.

Cheers,
Ben.

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


Re: linux-next: build failure after merge of the cgroup tree

2013-04-29 Thread Benjamin Herrenschmidt
On Mon, 2013-04-29 at 15:55 -0700, Tejun Heo wrote:
 Benjamin, can you please pick this up?
 
 Thanks a lot and sorry about the trouble.

Done.

Cheers,
Ben.


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


Re: [PATCH -V7 01/18] mm/THP: HPAGE_SHIFT is not a #define on some arch

2013-04-29 Thread David Gibson
On Mon, Apr 29, 2013 at 01:07:22AM +0530, Aneesh Kumar K.V wrote:
 From: Aneesh Kumar K.V aneesh.ku...@linux.vnet.ibm.com
 
 On archs like powerpc that support different hugepage sizes, HPAGE_SHIFT
 and other derived values like HPAGE_PMD_ORDER are not constants. So move
 that to hugepage_init

These seems to miss the point.  Those variables may be defined in
terms of HPAGE_SHIFT right now, but that is of itself kind of broken.
The transparent hugepage mechanism only works if the hugepage size is
equal to the PMD size - and PMD_SHIFT remains a compile time constant.

There's no reason having transparent hugepage should force the PMD
size of hugepage to be the default for other purposes - it should be
possible to do THP as long as PMD-sized is a possible hugepage size.

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


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

Re: [PATCH -V7 01/18] mm/THP: HPAGE_SHIFT is not a #define on some arch

2013-04-29 Thread David Gibson
On Tue, Apr 30, 2013 at 12:21:49PM +1000, David Gibson wrote:
 On Mon, Apr 29, 2013 at 01:07:22AM +0530, Aneesh Kumar K.V wrote:
  From: Aneesh Kumar K.V aneesh.ku...@linux.vnet.ibm.com
  
  On archs like powerpc that support different hugepage sizes, HPAGE_SHIFT
  and other derived values like HPAGE_PMD_ORDER are not constants. So move
  that to hugepage_init
 
 These seems to miss the point.  Those variables may be defined in
 terms of HPAGE_SHIFT right now, but that is of itself kind of broken.
 The transparent hugepage mechanism only works if the hugepage size is
 equal to the PMD size - and PMD_SHIFT remains a compile time constant.
 
 There's no reason having transparent hugepage should force the PMD
 size of hugepage to be the default for other purposes - it should be
 possible to do THP as long as PMD-sized is a possible hugepage size.

Oh, also, I'm pretty sure I said something similar on the last
posting.  Receiving review comments and then ignoring them does not
count as Reviewed-by...

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


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

Re: [PATCH -V7 01/18] mm/THP: HPAGE_SHIFT is not a #define on some arch

2013-04-29 Thread Aneesh Kumar K.V
David Gibson d...@au1.ibm.com writes:

 On Mon, Apr 29, 2013 at 01:07:22AM +0530, Aneesh Kumar K.V wrote:
 From: Aneesh Kumar K.V aneesh.ku...@linux.vnet.ibm.com
 
 On archs like powerpc that support different hugepage sizes, HPAGE_SHIFT
 and other derived values like HPAGE_PMD_ORDER are not constants. So move
 that to hugepage_init

 These seems to miss the point.  Those variables may be defined in
 terms of HPAGE_SHIFT right now, but that is of itself kind of broken.
 The transparent hugepage mechanism only works if the hugepage size is
 equal to the PMD size - and PMD_SHIFT remains a compile time constant.

 There's no reason having transparent hugepage should force the PMD
 size of hugepage to be the default for other purposes - it should be
 possible to do THP as long as PMD-sized is a possible hugepage size.


THP code does

#define HPAGE_PMD_SHIFT HPAGE_SHIFT
#define HPAGE_PMD_MASK HPAGE_MASK
#define HPAGE_PMD_SIZE HPAGE_SIZE

I had two options, one to move all those in terms of PMD_SHIFT or switch
ppc64 to not use HPAGE_SHIFT the way it use now. Both would involve large
code changes. Hence I end up moving some of the checks to runtime
checks. Actual HPAGE_SHIFT == PMD_SHIFT check happens in the 
has_transparent_hugepage() 

https://lists.ozlabs.org/pipermail/linuxppc-dev/2013-April/106002.html

IMHO what the patch is checking is that, HPAGE_SHIFT
value is not resulting in a page order higher than MAX_ORDER. 

Related to Reviewed-by: that came from V5 patchset 
https://lists.ozlabs.org/pipermail/linuxppc-dev/2013-April/105299.html

Your review suggestion to move that runtime check back to macro happened
in V6. I missed dropping reviewed-by after that. 

-aneesh

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


[PATCH v2] powerpc: Add an in memory udbg console

2013-04-29 Thread Alistair Popple

This patch adds a new udbg early debug console which utilises
statically defined input and output buffers stored within the kernel
BSS. It is primarily designed to assist with bring up of new hardware
which may not have a working console but which has a method of
reading/writing kernel memory.

This version incorporates comments made by Ben H (thanks!).

Changes from v1:
- Add memory barriers.
- Ensure updating of read/write positions is atomic.

Signed-off-by: Alistair Popple alist...@popple.id.au
---
arch/powerpc/Kconfig.debug |   23 
arch/powerpc/include/asm/udbg.h|1 +
arch/powerpc/kernel/udbg.c |3 ++
arch/powerpc/sysdev/Makefile   |2 +
arch/powerpc/sysdev/udbg_memcons.c |  105 
5 files changed, 134 insertions(+)
create mode 100644 arch/powerpc/sysdev/udbg_memcons.c

diff --git a/arch/powerpc/Kconfig.debug b/arch/powerpc/Kconfig.debug
index 5416e28..863d877 100644
--- a/arch/powerpc/Kconfig.debug
+++ b/arch/powerpc/Kconfig.debug
@@ -262,8 +262,31 @@ config PPC_EARLY_DEBUG_OPAL_HVSI
  Select this to enable early debugging for the PowerNV platform
  using an hvsi console

+config PPC_EARLY_DEBUG_MEMCONS
+   bool In memory console
+   help
+ Select this to enable early debugging using an in memory console.
+ This console provides input and output buffers stored within the
+ kernel BSS and should be safe to select on any system. A debugger
+ can then be used to read kernel output or send input to the console.
endchoice

+config PPC_MEMCONS_OUTPUT_SIZE
+   int In memory console output buffer size
+   depends on PPC_EARLY_DEBUG_MEMCONS
+   default 4096
+   help
+ Selects the size of the output buffer (in bytes) of the in memory
+ console.
+
+config PPC_MEMCONS_INPUT_SIZE
+   int In memory console input buffer size
+   depends on PPC_EARLY_DEBUG_MEMCONS
+   default 128
+   help
+ Selects the size of the input buffer (in bytes) of the in memory
+ console.
+
config PPC_EARLY_DEBUG_OPAL
def_bool y
depends on PPC_EARLY_DEBUG_OPAL_RAW || PPC_EARLY_DEBUG_OPAL_HVSI
diff --git a/arch/powerpc/include/asm/udbg.h b/arch/powerpc/include/asm/udbg.h
index 5a7510e..dc59091 100644
--- a/arch/powerpc/include/asm/udbg.h
+++ b/arch/powerpc/include/asm/udbg.h
@@ -52,6 +52,7 @@ extern void __init udbg_init_40x_realmode(void);
extern void __init udbg_init_cpm(void);
extern void __init udbg_init_usbgecko(void);
extern void __init udbg_init_wsp(void);
+extern void __init udbg_init_memcons(void);
extern void __init udbg_init_ehv_bc(void);
extern void __init udbg_init_ps3gelic(void);
extern void __init udbg_init_debug_opal_raw(void);
diff --git a/arch/powerpc/kernel/udbg.c b/arch/powerpc/kernel/udbg.c
index f974849..efa5c93 100644
--- a/arch/powerpc/kernel/udbg.c
+++ b/arch/powerpc/kernel/udbg.c
@@ -64,6 +64,9 @@ void __init udbg_early_init(void)
udbg_init_usbgecko();
#elif defined(CONFIG_PPC_EARLY_DEBUG_WSP)
udbg_init_wsp();
+#elif defined(CONFIG_PPC_EARLY_DEBUG_MEMCONS)
+   /* In memory console */
+   udbg_init_memcons();
#elif defined(CONFIG_PPC_EARLY_DEBUG_EHV_BC)
udbg_init_ehv_bc();
#elif defined(CONFIG_PPC_EARLY_DEBUG_PS3GELIC)
diff --git a/arch/powerpc/sysdev/Makefile b/arch/powerpc/sysdev/Makefile
index b0a518e..99464a7 100644
--- a/arch/powerpc/sysdev/Makefile
+++ b/arch/powerpc/sysdev/Makefile
@@ -64,6 +64,8 @@ endif

obj-$(CONFIG_PPC_SCOM)  += scom.o

+obj-$(CONFIG_PPC_EARLY_DEBUG_MEMCONS)  += udbg_memcons.o
+
subdir-ccflags-$(CONFIG_PPC_WERROR) := -Werror

obj-$(CONFIG_PPC_XICS)  += xics/
diff --git a/arch/powerpc/sysdev/udbg_memcons.c 
b/arch/powerpc/sysdev/udbg_memcons.c
new file mode 100644
index 000..ce5a7b4
--- /dev/null
+++ b/arch/powerpc/sysdev/udbg_memcons.c
@@ -0,0 +1,105 @@
+/*
+ * A udbg backend which logs messages and reads input from in memory
+ * buffers.
+ *
+ * The console output can be read from memcons_output which is a
+ * circular buffer whose next write position is stored in memcons.output_pos.
+ *
+ * Input may be passed by writing into the memcons_input buffer when it is
+ * empty. The input buffer is empty when both input_pos == input_start and
+ * *input_start == '\0'.
+ *
+ * Copyright (C) 2003-2005 Anton Blanchard and Milton Miller, IBM Corp
+ * Copyright (C) 2013 Alistair Popple, IBM Corp
+ *
+ *  This program is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU General Public License
+ *  as published by the Free Software Foundation; either version
+ *  2 of the License, or (at your option) any later version.
+ */
+
+#include linux/init.h
+#include linux/kernel.h
+#include asm/barrier.h
+#include asm/page.h
+#include asm/processor.h
+#include asm/udbg.h
+
+struct memcons {
+   char *output_start;
+   char *output_pos;
+   char *output_end;
+   

Re: [PATCH -V7 01/18] mm/THP: HPAGE_SHIFT is not a #define on some arch

2013-04-29 Thread David Gibson
On Tue, Apr 30, 2013 at 09:12:09AM +0530, Aneesh Kumar K.V wrote:
 David Gibson d...@au1.ibm.com writes:
 
  On Mon, Apr 29, 2013 at 01:07:22AM +0530, Aneesh Kumar K.V wrote:
  From: Aneesh Kumar K.V aneesh.ku...@linux.vnet.ibm.com
  
  On archs like powerpc that support different hugepage sizes, HPAGE_SHIFT
  and other derived values like HPAGE_PMD_ORDER are not constants. So move
  that to hugepage_init
 
  These seems to miss the point.  Those variables may be defined in
  terms of HPAGE_SHIFT right now, but that is of itself kind of broken.
  The transparent hugepage mechanism only works if the hugepage size is
  equal to the PMD size - and PMD_SHIFT remains a compile time constant.
 
  There's no reason having transparent hugepage should force the PMD
  size of hugepage to be the default for other purposes - it should be
  possible to do THP as long as PMD-sized is a possible hugepage size.
 
 
 THP code does
 
 #define HPAGE_PMD_SHIFT HPAGE_SHIFT
 #define HPAGE_PMD_MASK HPAGE_MASK
 #define HPAGE_PMD_SIZE HPAGE_SIZE
 
 I had two options, one to move all those in terms of PMD_SHIFT

This is a much better option that you've taken now, and really
shouldn't be that hard.  The THP code is much more strongly tied to
the fact that it is a PMD than the fact that it's the same size as
explicit huge pages.

 or switch
 ppc64 to not use HPAGE_SHIFT the way it use now. Both would involve large
 code changes. Hence I end up moving some of the checks to runtime
 checks. Actual HPAGE_SHIFT == PMD_SHIFT check happens in the 
 has_transparent_hugepage() 
 
 https://lists.ozlabs.org/pipermail/linuxppc-dev/2013-April/106002.html

And my other point is that this is also wrong.  All you should need to
check is that HPAGE_PMD_SHIFT (== PMD_SHIFT) is a supported hugepage
size, not that it is equal to HPAGE_SHIFT the default explicit
hugepage size.

 IMHO what the patch is checking is that, HPAGE_SHIFT
 value is not resulting in a page order higher than MAX_ORDER. 

Which you don't actually care about in THP - you only care that
HPAGE_PMD_SHIFT doesn't exceed MAX_ORDER.

 Related to Reviewed-by: that came from V5 patchset 
 https://lists.ozlabs.org/pipermail/linuxppc-dev/2013-April/105299.html
 
 Your review suggestion to move that runtime check back to macro happened
 in V6. I missed dropping reviewed-by after that. 

Ok.

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


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

Re: [PATCH -V7 09/18] powerpc: Switch 16GB and 16MB explicit hugepages to a different page table format

2013-04-29 Thread David Gibson
On Mon, Apr 29, 2013 at 01:07:30AM +0530, Aneesh Kumar K.V wrote:
 From: Aneesh Kumar K.V aneesh.ku...@linux.vnet.ibm.com
 
 We will be switching PMD_SHIFT to 24 bits to facilitate THP impmenetation.
 With PMD_SHIFT set to 24, we now have 16MB huge pages allocated at PGD level.
 That means with 32 bit process we cannot allocate normal pages at
 all, because we cover the entire address space with one pgd entry. Fix this
 by switching to a new page table format for hugepages. With the new page table
 format for 16GB and 16MB hugepages we won't allocate hugepage directory. 
 Instead
 we encode the PTE information directly at the directory level. This forces 
 16MB
 hugepage at PMD level. This will also make the page take walk much simpler 
 later
 when we add the THP support.
 
 With the new table format we have 4 cases for pgds and pmds:
 (1) invalid (all zeroes)
 (2) pointer to next table, as normal; bottom 6 bits == 0
 (3) leaf pte for huge page, bottom two bits != 00
 (4) hugepd pointer, bottom two bits == 00, next 4 bits indicate size
 of table
 
 Signed-off-by: Aneesh Kumar K.V aneesh.ku...@linux.vnet.ibm.com

Mostly ok, except that in several pages your comments imply you have
16M and 16M page directory levels, but you haven't actually made that
change yet.

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


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

Re: [PATCH -V7 08/18] powerpc: New hugepage directory format

2013-04-29 Thread David Gibson
On Mon, Apr 29, 2013 at 01:07:29AM +0530, Aneesh Kumar K.V wrote:
 From: Aneesh Kumar K.V aneesh.ku...@linux.vnet.ibm.com
 
 Change the hugepage directory format so that we can have leaf ptes directly
 at page directory avoiding the allocation of hugepage directory.
 
 With the new table format we have 3 cases for pgds and pmds:
 (1) invalid (all zeroes)
 (2) pointer to next table, as normal; bottom 6 bits == 0
 (4) hugepd pointer, bottom two bits == 00, next 4 bits indicate size of table
 
 Instead of storing shift value in hugepd pointer we use mmu_psize_def index
 so that we can fit all the supported hugepage size in 4 bits
 
 Signed-off-by: Aneesh Kumar K.V aneesh.ku...@linux.vnet.ibm.com

Looks ok.

Reviewed-by: David Gibson da...@gibson.dropbear.id.au

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


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