Re: [PATCH 1/9] ARM: get rid of arch_cpu_idle_prepare()

2014-01-27 Thread Daniel Lezcano

On 01/27/2014 07:08 AM, Nicolas Pitre wrote:

ARM and ARM64 are the only two architectures implementing
arch_cpu_idle_prepare() simply to call local_fiq_enable().

We have secondary_start_kernel() already calling local_fiq_enable() and
this is done a second time in arch_cpu_idle_prepare() in that case. And
enabling FIQs has nothing to do with idling the CPU to start with.

So let's introduce init_fiq_boot_cpu() to take care of FIQs on the boot
CPU and remove arch_cpu_idle_prepare(). This is now done a bit earlier
at late_initcall time but this shouldn't make a difference in practice
i.e. when FIQs are actually used.

Signed-off-by: Nicolas Pitre n...@linaro.org


Reviewed-by: Daniel Lezcano daniel.lezc...@linaro.org


---
  arch/arm/kernel/process.c | 5 -
  arch/arm/kernel/setup.c   | 7 +++
  2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c
index 92f7b15dd2..725b8c95e0 100644
--- a/arch/arm/kernel/process.c
+++ b/arch/arm/kernel/process.c
@@ -142,11 +142,6 @@ static void default_idle(void)
local_irq_enable();
  }

-void arch_cpu_idle_prepare(void)
-{
-   local_fiq_enable();
-}
-
  void arch_cpu_idle_enter(void)
  {
ledtrig_cpu(CPU_LED_IDLE_START);
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
index 987a7f5bce..d027b1a6fe 100644
--- a/arch/arm/kernel/setup.c
+++ b/arch/arm/kernel/setup.c
@@ -789,6 +789,13 @@ static int __init init_machine_late(void)
  }
  late_initcall(init_machine_late);

+static int __init init_fiq_boot_cpu(void)
+{
+   local_fiq_enable();
+   return 0;
+}
+late_initcall(init_fiq_boot_cpu);
+
  #ifdef CONFIG_KEXEC
  static inline unsigned long long get_total_mem(void)
  {




--
 http://www.linaro.org/ Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  http://www.facebook.com/pages/Linaro Facebook |
http://twitter.com/#!/linaroorg Twitter |
http://www.linaro.org/linaro-blog/ Blog

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

Re: [PATCH 2/9] ARM64: get rid of arch_cpu_idle_prepare()

2014-01-27 Thread Daniel Lezcano

On 01/27/2014 07:08 AM, Nicolas Pitre wrote:

ARM and ARM64 are the only two architectures implementing
arch_cpu_idle_prepare() simply to call local_fiq_enable().

We have secondary_start_kernel() already calling local_fiq_enable() and
this is done a second time in arch_cpu_idle_prepare() in that case. And
enabling FIQs has nothing to do with idling the CPU to start with.

So let's introduce init_fiq_boot_cpu() to take care of FIQs on the boot
CPU and remove arch_cpu_idle_prepare(). This is now done a bit earlier
at late_initcall time but this shouldn't make a difference in practice
given that FIQs are not currently used on ARM64.

Signed-off-by: Nicolas Pitre n...@linaro.org


Reviewed-by: Daniel Lezcano daniel.lezc...@linaro.org


---
  arch/arm64/kernel/process.c | 5 -
  arch/arm64/kernel/setup.c   | 7 +++
  2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c
index de17c89985..f6c733da67 100644
--- a/arch/arm64/kernel/process.c
+++ b/arch/arm64/kernel/process.c
@@ -84,11 +84,6 @@ EXPORT_SYMBOL_GPL(pm_power_off);
  void (*arm_pm_restart)(enum reboot_mode reboot_mode, const char *cmd);
  EXPORT_SYMBOL_GPL(arm_pm_restart);

-void arch_cpu_idle_prepare(void)
-{
-   local_fiq_enable();
-}
-
  /*
   * This is our default idle handler.
   */
diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c
index bd9bbd0e44..259557983a 100644
--- a/arch/arm64/kernel/setup.c
+++ b/arch/arm64/kernel/setup.c
@@ -255,6 +255,13 @@ static int __init arm64_device_init(void)
  }
  arch_initcall(arm64_device_init);

+static int __init init_fiq_boot_cpu(void)
+{
+   local_fiq_enable();
+   return 0;
+}
+late_initcall(init_fiq_boot_cpu);
+
  static DEFINE_PER_CPU(struct cpu, cpu_data);

  static int __init topology_init(void)




--
 http://www.linaro.org/ Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  http://www.facebook.com/pages/Linaro Facebook |
http://twitter.com/#!/linaroorg Twitter |
http://www.linaro.org/linaro-blog/ Blog

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

Re: [PATCH 3/9] idle: no more arch_cpu_idle_prepare() users

2014-01-27 Thread Daniel Lezcano

On 01/27/2014 07:08 AM, Nicolas Pitre wrote:

... so we can get rid of it entirely.

Signed-off-by: Nicolas Pitre n...@linaro.org


Acked-by: Daniel Lezcano daniel.lezc...@linaro.org


---
  include/linux/cpu.h | 1 -
  kernel/cpu/idle.c   | 2 --
  2 files changed, 3 deletions(-)

diff --git a/include/linux/cpu.h b/include/linux/cpu.h
index 03e235ad1b..218fab7521 100644
--- a/include/linux/cpu.h
+++ b/include/linux/cpu.h
@@ -221,7 +221,6 @@ void cpu_idle(void);
  void cpu_idle_poll_ctrl(bool enable);

  void arch_cpu_idle(void);
-void arch_cpu_idle_prepare(void);
  void arch_cpu_idle_enter(void);
  void arch_cpu_idle_exit(void);
  void arch_cpu_idle_dead(void);
diff --git a/kernel/cpu/idle.c b/kernel/cpu/idle.c
index 988573a9a3..4e327e211b 100644
--- a/kernel/cpu/idle.c
+++ b/kernel/cpu/idle.c
@@ -52,7 +52,6 @@ static inline int cpu_idle_poll(void)
  }

  /* Weak implementations for optional arch specific functions */
-void __weak arch_cpu_idle_prepare(void) { }
  void __weak arch_cpu_idle_enter(void) { }
  void __weak arch_cpu_idle_exit(void) { }
  void __weak arch_cpu_idle_dead(void) { }
@@ -136,6 +135,5 @@ void cpu_startup_entry(enum cpuhp_state state)
boot_init_stack_canary();
  #endif
__current_set_polling();
-   arch_cpu_idle_prepare();
cpu_idle_loop();
  }




--
 http://www.linaro.org/ Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  http://www.facebook.com/pages/Linaro Facebook |
http://twitter.com/#!/linaroorg Twitter |
http://www.linaro.org/linaro-blog/ Blog

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

Re: [PATCH 4/9] idle: move the cpuidle entry point to the generic idle loop

2014-01-27 Thread Daniel Lezcano

On 01/27/2014 07:08 AM, Nicolas Pitre wrote:

In order to integrate cpuidle with the scheduler, we must have a better
proximity in the core code with what cpuidle is doing and not delegate
such interaction to arch code.

Architectures implementing arch_cpu_idle() should simply enter
a cheap idle mode in the absence of a proper cpuidle driver.

Signed-off-by: Nicolas Pitre n...@linaro.org


This patch without the next ones will lead to an extra call to 
cpuidle_idle_call.


cpuidle_idle_call
arch_cpu_idle
cpuidle_idle_call
x86_idle

But I guess it is acceptable as it is fixed with the next patches of the 
serie.


Acked-by: Daniel Lezcano daniel.lezc...@linaro.org


---
  kernel/cpu/idle.c | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/kernel/cpu/idle.c b/kernel/cpu/idle.c
index 4e327e211b..a6f40ad9f8 100644
--- a/kernel/cpu/idle.c
+++ b/kernel/cpu/idle.c
@@ -3,6 +3,7 @@
   */
  #include linux/sched.h
  #include linux/cpu.h
+#include linux/cpuidle.h
  #include linux/tick.h
  #include linux/mm.h
  #include linux/stackprotector.h
@@ -94,7 +95,8 @@ static void cpu_idle_loop(void)
if (!current_clr_polling_and_test()) {
stop_critical_timings();
rcu_idle_enter();
-   arch_cpu_idle();
+   if (cpuidle_idle_call())
+   arch_cpu_idle();
WARN_ON_ONCE(irqs_disabled());
rcu_idle_exit();
start_critical_timings();




--
 http://www.linaro.org/ Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  http://www.facebook.com/pages/Linaro Facebook |
http://twitter.com/#!/linaroorg Twitter |
http://www.linaro.org/linaro-blog/ Blog

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

Re: [PATCH 5/9] ARM: remove redundant cpuidle_idle_call()

2014-01-27 Thread Daniel Lezcano

On 01/27/2014 07:08 AM, Nicolas Pitre wrote:

The core idle loop now takes care of it.

Signed-off-by: Nicolas Pitre n...@linaro.org


Acked-by: Daniel Lezcano daniel.lezc...@linaro.org



---
  arch/arm/kernel/process.c | 16 +---
  1 file changed, 5 insertions(+), 11 deletions(-)

diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c
index 725b8c95e0..34a59b7614 100644
--- a/arch/arm/kernel/process.c
+++ b/arch/arm/kernel/process.c
@@ -30,7 +30,6 @@
  #include linux/uaccess.h
  #include linux/random.h
  #include linux/hw_breakpoint.h
-#include linux/cpuidle.h
  #include linux/leds.h
  #include linux/reboot.h

@@ -133,7 +132,11 @@ EXPORT_SYMBOL_GPL(arm_pm_restart);

  void (*arm_pm_idle)(void);

-static void default_idle(void)
+/*
+ * Called from the core idle loop.
+ */
+
+void arch_cpu_idle(void)
  {
if (arm_pm_idle)
arm_pm_idle();
@@ -163,15 +166,6 @@ void arch_cpu_idle_dead(void)
  #endif

  /*
- * Called from the core idle loop.
- */
-void arch_cpu_idle(void)
-{
-   if (cpuidle_idle_call())
-   default_idle();
-}
-
-/*
   * Called by kexec, immediately prior to machine_kexec().
   *
   * This must completely disable all secondary CPUs; simply causing those CPUs




--
 http://www.linaro.org/ Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  http://www.facebook.com/pages/Linaro Facebook |
http://twitter.com/#!/linaroorg Twitter |
http://www.linaro.org/linaro-blog/ Blog

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

Re: [PATCH 6/9] PPC: remove redundant cpuidle_idle_call()

2014-01-27 Thread Daniel Lezcano

On 01/27/2014 07:08 AM, Nicolas Pitre wrote:

The core idle loop now takes care of it.  However a few things need
checking:

- Invocation of cpuidle_idle_call() in pseries_lpar_idle() happened
   through arch_cpu_idle() and was therefore always preceded by a call
   to ppc64_runlatch_off().  To preserve this property now that
   cpuidle_idle_call() is invoked directly from core code, a call to
   ppc64_runlatch_off() has been added to idle_loop_prolog() in
   platforms/pseries/processor_idle.c.

- Similarly, cpuidle_idle_call() was followed by ppc64_runlatch_off()
   so a call to the later has been added to idle_loop_epilog().

- And since arch_cpu_idle() always made sure to re-enable IRQs if they
   were not enabled, this is now
   done in idle_loop_epilog() as well.

The above was made in order to keep the execution flow close to the
original.  I don't know if that was strictly necessary. Someone well
aquainted with the platform details might find some room for possible
optimizations.

Signed-off-by: Nicolas Pitre n...@linaro.org


Added Preeti U Murthy as recipient.


---
  arch/powerpc/platforms/pseries/processor_idle.c |  5 
  arch/powerpc/platforms/pseries/setup.c  | 34 ++---
  2 files changed, 19 insertions(+), 20 deletions(-)

diff --git a/arch/powerpc/platforms/pseries/processor_idle.c 
b/arch/powerpc/platforms/pseries/processor_idle.c
index a166e38bd6..72ddfe3d2f 100644
--- a/arch/powerpc/platforms/pseries/processor_idle.c
+++ b/arch/powerpc/platforms/pseries/processor_idle.c
@@ -33,6 +33,7 @@ static struct cpuidle_state *cpuidle_state_table;

  static inline void idle_loop_prolog(unsigned long *in_purr)
  {
+   ppc64_runlatch_off();
*in_purr = mfspr(SPRN_PURR);
/*
 * Indicate to the HV that we are idle. Now would be
@@ -49,6 +50,10 @@ static inline void idle_loop_epilog(unsigned long in_purr)
wait_cycles += mfspr(SPRN_PURR) - in_purr;
get_lppaca()-wait_state_cycles = cpu_to_be64(wait_cycles);
get_lppaca()-idle = 0;
+
+   if (irqs_disabled())
+   local_irq_enable();
+   ppc64_runlatch_on();
  }

  static int snooze_loop(struct cpuidle_device *dev,
diff --git a/arch/powerpc/platforms/pseries/setup.c 
b/arch/powerpc/platforms/pseries/setup.c
index c1f1908587..7604c19d54 100644
--- a/arch/powerpc/platforms/pseries/setup.c
+++ b/arch/powerpc/platforms/pseries/setup.c
@@ -39,7 +39,6 @@
  #include linux/irq.h
  #include linux/seq_file.h
  #include linux/root_dev.h
-#include linux/cpuidle.h
  #include linux/of.h
  #include linux/kexec.h

@@ -356,29 +355,24 @@ early_initcall(alloc_dispatch_log_kmem_cache);

  static void pseries_lpar_idle(void)
  {
-   /* This would call on the cpuidle framework, and the back-end pseries
-* driver to  go to idle states
+   /*
+* Default handler to go into low thread priority and possibly
+* low power mode by cedeing processor to hypervisor
 */
-   if (cpuidle_idle_call()) {
-   /* On error, execute default handler
-* to go into low thread priority and possibly
-* low power mode by cedeing processor to hypervisor
-*/

-   /* Indicate to hypervisor that we are idle. */
-   get_lppaca()-idle = 1;
+   /* Indicate to hypervisor that we are idle. */
+   get_lppaca()-idle = 1;

-   /*
-* Yield the processor to the hypervisor.  We return if
-* an external interrupt occurs (which are driven prior
-* to returning here) or if a prod occurs from another
-* processor. When returning here, external interrupts
-* are enabled.
-*/
-   cede_processor();
+   /*
+* Yield the processor to the hypervisor.  We return if
+* an external interrupt occurs (which are driven prior
+* to returning here) or if a prod occurs from another
+* processor. When returning here, external interrupts
+* are enabled.
+*/
+   cede_processor();

-   get_lppaca()-idle = 0;
-   }
+   get_lppaca()-idle = 0;
  }

  /*




--
 http://www.linaro.org/ Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  http://www.facebook.com/pages/Linaro Facebook |
http://twitter.com/#!/linaroorg Twitter |
http://www.linaro.org/linaro-blog/ Blog

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

Re: [PATCH 7/9] SH: remove redundant cpuidle_idle_call()

2014-01-27 Thread Daniel Lezcano

On 01/27/2014 07:08 AM, Nicolas Pitre wrote:

The core idle loop now takes care of it.

Signed-off-by: Nicolas Pitre n...@linaro.org


Acked-by: Daniel Lezcano daniel.lezc...@linaro.org


---
  arch/sh/kernel/idle.c | 4 +---
  1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/arch/sh/kernel/idle.c b/arch/sh/kernel/idle.c
index 2ea4483fd7..be616ee0cf 100644
--- a/arch/sh/kernel/idle.c
+++ b/arch/sh/kernel/idle.c
@@ -16,7 +16,6 @@
  #include linux/thread_info.h
  #include linux/irqflags.h
  #include linux/smp.h
-#include linux/cpuidle.h
  #include linux/atomic.h
  #include asm/pgalloc.h
  #include asm/smp.h
@@ -40,8 +39,7 @@ void arch_cpu_idle_dead(void)

  void arch_cpu_idle(void)
  {
-   if (cpuidle_idle_call())
-   sh_idle();
+   sh_idle();
  }

  void __init select_idle_routine(void)




--
 http://www.linaro.org/ Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  http://www.facebook.com/pages/Linaro Facebook |
http://twitter.com/#!/linaroorg Twitter |
http://www.linaro.org/linaro-blog/ Blog

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

Re: [PATCH 8/9] X86: remove redundant cpuidle_idle_call()

2014-01-27 Thread Daniel Lezcano

On 01/27/2014 07:08 AM, Nicolas Pitre wrote:

The core idle loop now takes care of it.

Signed-off-by: Nicolas Pitre n...@linaro.org


Acked-by: Daniel Lezcano daniel.lezc...@linaro.org


---
  arch/x86/kernel/process.c | 5 +
  1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c
index 3fb8d95ab8..4505e2a950 100644
--- a/arch/x86/kernel/process.c
+++ b/arch/x86/kernel/process.c
@@ -298,10 +298,7 @@ void arch_cpu_idle_dead(void)
   */
  void arch_cpu_idle(void)
  {
-   if (cpuidle_idle_call())
-   x86_idle();
-   else
-   local_irq_enable();


For the record, it was pointless to enable the local irq here because it 
is handled by the cpuidle framework when exiting the idle state.



+   x86_idle();
  }

  /*




--
 http://www.linaro.org/ Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  http://www.facebook.com/pages/Linaro Facebook |
http://twitter.com/#!/linaroorg Twitter |
http://www.linaro.org/linaro-blog/ Blog

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

Re: [PATCH v2] powernv: kvm: make _PAGE_NUMA take effect

2014-01-27 Thread Alexander Graf

On 21.01.2014, at 10:42, Aneesh Kumar K.V aneesh.ku...@linux.vnet.ibm.com 
wrote:

 Liu Ping Fan kernelf...@gmail.com writes:
 
 To make sure that on host, the pages marked with _PAGE_NUMA result in a fault
 when guest access them, we should force the checking when guest uses 
 hypercall
 to setup hpte.
 
 Signed-off-by: Liu Ping Fan pingf...@linux.vnet.ibm.com
 
 Reviewed-by: Aneesh Kumar K.V aneesh.ku...@linux.vnet.ibm.com
 
 When we mark pte with _PAGE_NUMA we already call 
 mmu_notifier_invalidate_range_start and
 mmu_notifier_invalidate_range_end, which will mark existing guest hpte
 entry as HPTE_V_ABSENT. Now we need to do that when we are inserting new
 guest hpte entries. This patch does that. 

So what happens next? We insert a page into the HTAB without HPTE_V_VALID set, 
so the guest will fail to use it. If the guest does an H_READ on it it will 
suddenly turn to V_VALID though?

I might need a crash course in the use of HPTE_V_ABSENT.


Alex

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


Re: [PATCH v2] powernv: kvm: make _PAGE_NUMA take effect

2014-01-27 Thread Aneesh Kumar K.V
Alexander Graf ag...@suse.de writes:

 On 21.01.2014, at 10:42, Aneesh Kumar K.V aneesh.ku...@linux.vnet.ibm.com 
 wrote:

 Liu Ping Fan kernelf...@gmail.com writes:
 
 To make sure that on host, the pages marked with _PAGE_NUMA result in a 
 fault
 when guest access them, we should force the checking when guest uses 
 hypercall
 to setup hpte.
 
 Signed-off-by: Liu Ping Fan pingf...@linux.vnet.ibm.com
 
 Reviewed-by: Aneesh Kumar K.V aneesh.ku...@linux.vnet.ibm.com
 
 When we mark pte with _PAGE_NUMA we already call 
 mmu_notifier_invalidate_range_start and
 mmu_notifier_invalidate_range_end, which will mark existing guest hpte
 entry as HPTE_V_ABSENT. Now we need to do that when we are inserting new
 guest hpte entries. This patch does that. 

 So what happens next? We insert a page into the HTAB without
 HPTE_V_VALID set, so the guest will fail to use it. If the guest does
 an H_READ on it it will suddenly turn to V_VALID though?

As per the guest the entry is valid, so yes an hread should return a
valid entry. But in real hpte we would mark it not valid.


 I might need a crash course in the use of HPTE_V_ABSENT.

When guest tries to access the address, the host will handle the fault.

kvmppc_hpte_hv_fault should give more info

-aneesh

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


Re: [PATCH v2] powernv: kvm: make _PAGE_NUMA take effect

2014-01-27 Thread Paul Mackerras
On Mon, Jan 27, 2014 at 10:11:40AM +0100, Alexander Graf wrote:
 
 On 21.01.2014, at 10:42, Aneesh Kumar K.V aneesh.ku...@linux.vnet.ibm.com 
 wrote:
 
  Liu Ping Fan kernelf...@gmail.com writes:
  
  To make sure that on host, the pages marked with _PAGE_NUMA result in a 
  fault
  when guest access them, we should force the checking when guest uses 
  hypercall
  to setup hpte.
  
  Signed-off-by: Liu Ping Fan pingf...@linux.vnet.ibm.com
  
  Reviewed-by: Aneesh Kumar K.V aneesh.ku...@linux.vnet.ibm.com
  
  When we mark pte with _PAGE_NUMA we already call 
  mmu_notifier_invalidate_range_start and
  mmu_notifier_invalidate_range_end, which will mark existing guest hpte
  entry as HPTE_V_ABSENT. Now we need to do that when we are inserting new
  guest hpte entries. This patch does that. 
 
 So what happens next? We insert a page into the HTAB without HPTE_V_VALID 
 set, so the guest will fail to use it. If the guest does an H_READ on it it 
 will suddenly turn to V_VALID though?
 
 I might need a crash course in the use of HPTE_V_ABSENT.

HPTE_V_ABSENT means present from the point of view of the guest but
not present from the host's point of view, so yes H_READ turns
HPTE_V_ABSENT into HPTE_V_VALID.

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


Re: [PATCH v2] powernv: kvm: make _PAGE_NUMA take effect

2014-01-27 Thread Alexander Graf

On 27.01.2014, at 11:28, Aneesh Kumar K.V aneesh.ku...@linux.vnet.ibm.com 
wrote:

 Alexander Graf ag...@suse.de writes:
 
 On 21.01.2014, at 10:42, Aneesh Kumar K.V aneesh.ku...@linux.vnet.ibm.com 
 wrote:
 
 Liu Ping Fan kernelf...@gmail.com writes:
 
 To make sure that on host, the pages marked with _PAGE_NUMA result in a 
 fault
 when guest access them, we should force the checking when guest uses 
 hypercall
 to setup hpte.
 
 Signed-off-by: Liu Ping Fan pingf...@linux.vnet.ibm.com
 
 Reviewed-by: Aneesh Kumar K.V aneesh.ku...@linux.vnet.ibm.com
 
 When we mark pte with _PAGE_NUMA we already call 
 mmu_notifier_invalidate_range_start and
 mmu_notifier_invalidate_range_end, which will mark existing guest hpte
 entry as HPTE_V_ABSENT. Now we need to do that when we are inserting new
 guest hpte entries. This patch does that. 
 
 So what happens next? We insert a page into the HTAB without
 HPTE_V_VALID set, so the guest will fail to use it. If the guest does
 an H_READ on it it will suddenly turn to V_VALID though?
 
 As per the guest the entry is valid, so yes an hread should return a
 valid entry. But in real hpte we would mark it not valid.

Ah, yes.

 
 
 I might need a crash course in the use of HPTE_V_ABSENT.
 
 When guest tries to access the address, the host will handle the fault.
 
 kvmppc_hpte_hv_fault should give more info

Thanks for the pointer. So we fault it in lazily. Is there any particular 
reason we can't do that on h_enter already? After all this just means an 
additional roundtrip because the guest is pretty likely to use the page it just 
entered, no?


Alex

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


Re: [PATCH 6/9] PPC: remove redundant cpuidle_idle_call()

2014-01-27 Thread Preeti U Murthy
Hi Nicolas,

On 01/27/2014 11:38 AM, Nicolas Pitre wrote:
 The core idle loop now takes care of it.  However a few things need
 checking:
 
 - Invocation of cpuidle_idle_call() in pseries_lpar_idle() happened
   through arch_cpu_idle() and was therefore always preceded by a call
   to ppc64_runlatch_off().  To preserve this property now that
   cpuidle_idle_call() is invoked directly from core code, a call to
   ppc64_runlatch_off() has been added to idle_loop_prolog() in
   platforms/pseries/processor_idle.c.
 
 - Similarly, cpuidle_idle_call() was followed by ppc64_runlatch_off()
   so a call to the later has been added to idle_loop_epilog().
 
 - And since arch_cpu_idle() always made sure to re-enable IRQs if they
   were not enabled, this is now
   done in idle_loop_epilog() as well.
 
 The above was made in order to keep the execution flow close to the
 original.  I don't know if that was strictly necessary. Someone well
 aquainted with the platform details might find some room for possible
 optimizations.
 
 Signed-off-by: Nicolas Pitre n...@linaro.org
 ---
  arch/powerpc/platforms/pseries/processor_idle.c |  5 
  arch/powerpc/platforms/pseries/setup.c  | 34 
 ++---
  2 files changed, 19 insertions(+), 20 deletions(-)
 
 diff --git a/arch/powerpc/platforms/pseries/processor_idle.c 
 b/arch/powerpc/platforms/pseries/processor_idle.c
 index a166e38bd6..72ddfe3d2f 100644
 --- a/arch/powerpc/platforms/pseries/processor_idle.c
 +++ b/arch/powerpc/platforms/pseries/processor_idle.c
 @@ -33,6 +33,7 @@ static struct cpuidle_state *cpuidle_state_table;
 
  static inline void idle_loop_prolog(unsigned long *in_purr)
  {
 + ppc64_runlatch_off();
   *in_purr = mfspr(SPRN_PURR);
   /*
* Indicate to the HV that we are idle. Now would be
 @@ -49,6 +50,10 @@ static inline void idle_loop_epilog(unsigned long in_purr)
   wait_cycles += mfspr(SPRN_PURR) - in_purr;
   get_lppaca()-wait_state_cycles = cpu_to_be64(wait_cycles);
   get_lppaca()-idle = 0;
 +
 + if (irqs_disabled())
 + local_irq_enable();
 + ppc64_runlatch_on();
  }
 
  static int snooze_loop(struct cpuidle_device *dev,
 diff --git a/arch/powerpc/platforms/pseries/setup.c 
 b/arch/powerpc/platforms/pseries/setup.c
 index c1f1908587..7604c19d54 100644
 --- a/arch/powerpc/platforms/pseries/setup.c
 +++ b/arch/powerpc/platforms/pseries/setup.c
 @@ -39,7 +39,6 @@
  #include linux/irq.h
  #include linux/seq_file.h
  #include linux/root_dev.h
 -#include linux/cpuidle.h
  #include linux/of.h
  #include linux/kexec.h
 
 @@ -356,29 +355,24 @@ early_initcall(alloc_dispatch_log_kmem_cache);
 
  static void pseries_lpar_idle(void)
  {
 - /* This would call on the cpuidle framework, and the back-end pseries
 -  * driver to  go to idle states
 + /*
 +  * Default handler to go into low thread priority and possibly
 +  * low power mode by cedeing processor to hypervisor
*/
 - if (cpuidle_idle_call()) {
 - /* On error, execute default handler
 -  * to go into low thread priority and possibly
 -  * low power mode by cedeing processor to hypervisor
 -  */
 
 - /* Indicate to hypervisor that we are idle. */
 - get_lppaca()-idle = 1;
 + /* Indicate to hypervisor that we are idle. */
 + get_lppaca()-idle = 1;
 
 - /*
 -  * Yield the processor to the hypervisor.  We return if
 -  * an external interrupt occurs (which are driven prior
 -  * to returning here) or if a prod occurs from another
 -  * processor. When returning here, external interrupts
 -  * are enabled.
 -  */
 - cede_processor();
 + /*
 +  * Yield the processor to the hypervisor.  We return if
 +  * an external interrupt occurs (which are driven prior
 +  * to returning here) or if a prod occurs from another
 +  * processor. When returning here, external interrupts
 +  * are enabled.
 +  */
 + cede_processor();
 
 - get_lppaca()-idle = 0;
 - }
 + get_lppaca()-idle = 0;
  }
 
  /*
 

Reviewed-by: Preeti U Murthy pre...@linux.vnet.ibm.com

The consequence of this would be for other Power platforms like PowerNV,
we will need to invoke ppc_runlatch_off() and ppc_runlatch_on() in each
of the idle routines since the idle_loop_prologue() and
idle_loop_epilogue() are not invoked by them, but we will take care of this.

Regards
Preeti U Murthy

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


Re: [PATCH 1/9] ARM: get rid of arch_cpu_idle_prepare()

2014-01-27 Thread Russell King - ARM Linux
On Mon, Jan 27, 2014 at 01:08:16AM -0500, Nicolas Pitre wrote:
 ARM and ARM64 are the only two architectures implementing
 arch_cpu_idle_prepare() simply to call local_fiq_enable().
 
 We have secondary_start_kernel() already calling local_fiq_enable() and
 this is done a second time in arch_cpu_idle_prepare() in that case. And
 enabling FIQs has nothing to do with idling the CPU to start with.
 
 So let's introduce init_fiq_boot_cpu() to take care of FIQs on the boot
 CPU and remove arch_cpu_idle_prepare(). This is now done a bit earlier
 at late_initcall time but this shouldn't make a difference in practice
 i.e. when FIQs are actually used.
 
 Signed-off-by: Nicolas Pitre n...@linaro.org
 ---
  arch/arm/kernel/process.c | 5 -
  arch/arm/kernel/setup.c   | 7 +++
  2 files changed, 7 insertions(+), 5 deletions(-)
 
 diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c
 index 92f7b15dd2..725b8c95e0 100644
 --- a/arch/arm/kernel/process.c
 +++ b/arch/arm/kernel/process.c
 @@ -142,11 +142,6 @@ static void default_idle(void)
   local_irq_enable();
  }
  
 -void arch_cpu_idle_prepare(void)
 -{
 - local_fiq_enable();
 -}
 -
  void arch_cpu_idle_enter(void)
  {
   ledtrig_cpu(CPU_LED_IDLE_START);
 diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
 index 987a7f5bce..d027b1a6fe 100644
 --- a/arch/arm/kernel/setup.c
 +++ b/arch/arm/kernel/setup.c
 @@ -789,6 +789,13 @@ static int __init init_machine_late(void)
  }
  late_initcall(init_machine_late);
  
 +static int __init init_fiq_boot_cpu(void)
 +{
 + local_fiq_enable();
 + return 0;
 +}
 +late_initcall(init_fiq_boot_cpu);

arch_cpu_idle_prepare() gets called from the swapper thread, and changes
the swapper thread's CPSR. init_fiq_boot_cpu() gets called from PID1, the
init thread, and changes the init thread's CPSR, which will already have
FIQs enabled by way of how kernel threads are created.

Hence, the above code fragment has no effect what so ever, and those
platforms using FIQs will not have FIQs delivered if they're idle
(because the swapper will have FIQs masked at the CPU.)

NAK.

-- 
FTTC broadband for 0.8mile line: 5.8Mbps down 500kbps up.  Estimation
in database were 13.1 to 19Mbit for a good line, about 7.5+ for a bad.
Estimate before purchase was up to 13.2Mbit.
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: [PATCH 0/9] setting the table for integration of cpuidle with the scheduler

2014-01-27 Thread Peter Zijlstra
On Mon, Jan 27, 2014 at 01:08:15AM -0500, Nicolas Pitre wrote:
 As everyone should know by now, we want to integrate the cpuidle
 governor with the scheduler for a more efficient idling of CPUs.
 In order to help the transition, this small patch series moves the
 existing interaction with cpuidle from architecture code to generic
 core code.  No functional change should have occurred yet.
 
 The ARM, PPC, SH and X86 architectures are concerned.  Small cleanups
 to ARM and ARM64 are also included. I don't know yet the best path for
 those patches to get into mainline, but it is probably best if they
 stay together. So ACKs from architecture maintainers would be greatly
 appreciated.
 
 
  arch/arm/kernel/process.c   | 21 +++-
  arch/arm/kernel/setup.c |  7 
  arch/arm64/kernel/process.c |  5 ---
  arch/arm64/kernel/setup.c   |  7 
  arch/powerpc/platforms/pseries/processor_idle.c |  5 +++
  arch/powerpc/platforms/pseries/setup.c  | 34 ---
  arch/sh/kernel/idle.c   |  4 +--
  arch/x86/kernel/process.c   |  5 +--
  include/linux/cpu.h |  1 -
  kernel/Makefile |  1 -
  kernel/cpu/Makefile |  1 -
  kernel/sched/Makefile   |  2 +-
  kernel/{cpu = sched}/idle.c|  6 ++--
  13 files changed, 44 insertions(+), 55 deletions(-)

Thomas, any objections to this? It looks like a sensible thing to do.
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: [PATCH 1/9] ARM: get rid of arch_cpu_idle_prepare()

2014-01-27 Thread Nicolas Pitre
On Mon, 27 Jan 2014, Russell King - ARM Linux wrote:

 On Mon, Jan 27, 2014 at 01:08:16AM -0500, Nicolas Pitre wrote:
  ARM and ARM64 are the only two architectures implementing
  arch_cpu_idle_prepare() simply to call local_fiq_enable().
  
  We have secondary_start_kernel() already calling local_fiq_enable() and
  this is done a second time in arch_cpu_idle_prepare() in that case. And
  enabling FIQs has nothing to do with idling the CPU to start with.
  
  So let's introduce init_fiq_boot_cpu() to take care of FIQs on the boot
  CPU and remove arch_cpu_idle_prepare(). This is now done a bit earlier
  at late_initcall time but this shouldn't make a difference in practice
  i.e. when FIQs are actually used.
  
  Signed-off-by: Nicolas Pitre n...@linaro.org
  ---
   arch/arm/kernel/process.c | 5 -
   arch/arm/kernel/setup.c   | 7 +++
   2 files changed, 7 insertions(+), 5 deletions(-)
  
  diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c
  index 92f7b15dd2..725b8c95e0 100644
  --- a/arch/arm/kernel/process.c
  +++ b/arch/arm/kernel/process.c
  @@ -142,11 +142,6 @@ static void default_idle(void)
  local_irq_enable();
   }
   
  -void arch_cpu_idle_prepare(void)
  -{
  -   local_fiq_enable();
  -}
  -
   void arch_cpu_idle_enter(void)
   {
  ledtrig_cpu(CPU_LED_IDLE_START);
  diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
  index 987a7f5bce..d027b1a6fe 100644
  --- a/arch/arm/kernel/setup.c
  +++ b/arch/arm/kernel/setup.c
  @@ -789,6 +789,13 @@ static int __init init_machine_late(void)
   }
   late_initcall(init_machine_late);
   
  +static int __init init_fiq_boot_cpu(void)
  +{
  +   local_fiq_enable();
  +   return 0;
  +}
  +late_initcall(init_fiq_boot_cpu);
 
 arch_cpu_idle_prepare() gets called from the swapper thread, and changes
 the swapper thread's CPSR. init_fiq_boot_cpu() gets called from PID1, the
 init thread, and changes the init thread's CPSR, which will already have
 FIQs enabled by way of how kernel threads are created.
 
 Hence, the above code fragment has no effect what so ever, and those
 platforms using FIQs will not have FIQs delivered if they're idle
 (because the swapper will have FIQs masked at the CPU.)

You're right.

What about moving local_fiq_enable() to trap_init() then?


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


Re: [PATCH 2/9] ARM64: get rid of arch_cpu_idle_prepare()

2014-01-27 Thread Nicolas Pitre
On Mon, 27 Jan 2014, Catalin Marinas wrote:

 On Mon, Jan 27, 2014 at 06:08:17AM +, Nicolas Pitre wrote:
  ARM and ARM64 are the only two architectures implementing
  arch_cpu_idle_prepare() simply to call local_fiq_enable().
  
  We have secondary_start_kernel() already calling local_fiq_enable() and
  this is done a second time in arch_cpu_idle_prepare() in that case. And
  enabling FIQs has nothing to do with idling the CPU to start with.
  
  So let's introduce init_fiq_boot_cpu() to take care of FIQs on the boot
  CPU and remove arch_cpu_idle_prepare(). This is now done a bit earlier
  at late_initcall time but this shouldn't make a difference in practice
  given that FIQs are not currently used on ARM64.
  
  Signed-off-by: Nicolas Pitre n...@linaro.org
 
 For arm64, we could simply remove any reference to FIQs. I'm not aware
 of anyone using them.

OK. What if I sumply remove arch_cpu_idle_prepare() and let you do the 
remove the rest?

IMHO I'd simply remove local_fiq_{enable/disable}() from 
arm64/kernel/smp.c and leave the infrastructure in place in case someone 
needs it eventually.  In which case I could include that into my patch 
as well.


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


Re: [PATCH 2/9] ARM64: get rid of arch_cpu_idle_prepare()

2014-01-27 Thread Catalin Marinas
On Mon, Jan 27, 2014 at 06:08:17AM +, Nicolas Pitre wrote:
 ARM and ARM64 are the only two architectures implementing
 arch_cpu_idle_prepare() simply to call local_fiq_enable().
 
 We have secondary_start_kernel() already calling local_fiq_enable() and
 this is done a second time in arch_cpu_idle_prepare() in that case. And
 enabling FIQs has nothing to do with idling the CPU to start with.
 
 So let's introduce init_fiq_boot_cpu() to take care of FIQs on the boot
 CPU and remove arch_cpu_idle_prepare(). This is now done a bit earlier
 at late_initcall time but this shouldn't make a difference in practice
 given that FIQs are not currently used on ARM64.
 
 Signed-off-by: Nicolas Pitre n...@linaro.org

For arm64, we could simply remove any reference to FIQs. I'm not aware
of anyone using them.

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


Re: [PATCH v2] powernv: kvm: make _PAGE_NUMA take effect

2014-01-27 Thread Aneesh Kumar K.V
Alexander Graf ag...@suse.de writes:

 On 27.01.2014, at 11:28, Aneesh Kumar K.V aneesh.ku...@linux.vnet.ibm.com 
 wrote:

 Alexander Graf ag...@suse.de writes:
 
 On 21.01.2014, at 10:42, Aneesh Kumar K.V aneesh.ku...@linux.vnet.ibm.com 
 wrote:
 
 Liu Ping Fan kernelf...@gmail.com writes:
 
 To make sure that on host, the pages marked with _PAGE_NUMA result in a 
 fault
 when guest access them, we should force the checking when guest uses 
 hypercall
 to setup hpte.
 
 Signed-off-by: Liu Ping Fan pingf...@linux.vnet.ibm.com
 
 Reviewed-by: Aneesh Kumar K.V aneesh.ku...@linux.vnet.ibm.com
 
 When we mark pte with _PAGE_NUMA we already call 
 mmu_notifier_invalidate_range_start and
 mmu_notifier_invalidate_range_end, which will mark existing guest hpte
 entry as HPTE_V_ABSENT. Now we need to do that when we are inserting new
 guest hpte entries. This patch does that. 
 
 So what happens next? We insert a page into the HTAB without
 HPTE_V_VALID set, so the guest will fail to use it. If the guest does
 an H_READ on it it will suddenly turn to V_VALID though?
 
 As per the guest the entry is valid, so yes an hread should return a
 valid entry. But in real hpte we would mark it not valid.

 Ah, yes.

 
 
 I might need a crash course in the use of HPTE_V_ABSENT.
 
 When guest tries to access the address, the host will handle the fault.
 
 kvmppc_hpte_hv_fault should give more info

 Thanks for the pointer. So we fault it in lazily. Is there any
 particular reason we can't do that on h_enter already? After all this
 just means an additional roundtrip because the guest is pretty likely
 to use the page it just entered, no?

We could get wrong numa fault information if we didn't do h_enter from
the right node from which we faulted.

-aneesh

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


Re: [PATCH 2/9] ARM64: get rid of arch_cpu_idle_prepare()

2014-01-27 Thread Catalin Marinas
On Mon, Jan 27, 2014 at 03:51:02PM +, Nicolas Pitre wrote:
 On Mon, 27 Jan 2014, Catalin Marinas wrote:
 
  On Mon, Jan 27, 2014 at 06:08:17AM +, Nicolas Pitre wrote:
   ARM and ARM64 are the only two architectures implementing
   arch_cpu_idle_prepare() simply to call local_fiq_enable().
   
   We have secondary_start_kernel() already calling local_fiq_enable() and
   this is done a second time in arch_cpu_idle_prepare() in that case. And
   enabling FIQs has nothing to do with idling the CPU to start with.
   
   So let's introduce init_fiq_boot_cpu() to take care of FIQs on the boot
   CPU and remove arch_cpu_idle_prepare(). This is now done a bit earlier
   at late_initcall time but this shouldn't make a difference in practice
   given that FIQs are not currently used on ARM64.
   
   Signed-off-by: Nicolas Pitre n...@linaro.org
  
  For arm64, we could simply remove any reference to FIQs. I'm not aware
  of anyone using them.
 
 OK. What if I sumply remove arch_cpu_idle_prepare() and let you do the 
 remove the rest?
 
 IMHO I'd simply remove local_fiq_{enable/disable}() from 
 arm64/kernel/smp.c and leave the infrastructure in place in case someone 
 needs it eventually.  In which case I could include that into my patch 
 as well.

Sounds good. We can keep the local_fiq_*() functions but remove about 4
calling sites (process.c and smp.c) until needed.

Thanks.

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


Re: [PATCH 1/9] ARM: get rid of arch_cpu_idle_prepare()

2014-01-27 Thread Russell King - ARM Linux
On Mon, Jan 27, 2014 at 09:22:55AM +0100, Daniel Lezcano wrote:
 On 01/27/2014 07:08 AM, Nicolas Pitre wrote:
 ARM and ARM64 are the only two architectures implementing
 arch_cpu_idle_prepare() simply to call local_fiq_enable().

 We have secondary_start_kernel() already calling local_fiq_enable() and
 this is done a second time in arch_cpu_idle_prepare() in that case. And
 enabling FIQs has nothing to do with idling the CPU to start with.

 So let's introduce init_fiq_boot_cpu() to take care of FIQs on the boot
 CPU and remove arch_cpu_idle_prepare(). This is now done a bit earlier
 at late_initcall time but this shouldn't make a difference in practice
 i.e. when FIQs are actually used.

 Signed-off-by: Nicolas Pitre n...@linaro.org

 Reviewed-by: Daniel Lezcano daniel.lezc...@linaro.org

What kind of review did you do when giving that attributation?

-- 
FTTC broadband for 0.8mile line: 5.8Mbps down 500kbps up.  Estimation
in database were 13.1 to 19Mbit for a good line, about 7.5+ for a bad.
Estimate before purchase was up to 13.2Mbit.
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: [PATCH 1/9] ARM: get rid of arch_cpu_idle_prepare()

2014-01-27 Thread Russell King - ARM Linux
On Mon, Jan 27, 2014 at 10:45:59AM -0500, Nicolas Pitre wrote:
 On Mon, 27 Jan 2014, Russell King - ARM Linux wrote:
 
  On Mon, Jan 27, 2014 at 01:08:16AM -0500, Nicolas Pitre wrote:
   ARM and ARM64 are the only two architectures implementing
   arch_cpu_idle_prepare() simply to call local_fiq_enable().
   
   We have secondary_start_kernel() already calling local_fiq_enable() and
   this is done a second time in arch_cpu_idle_prepare() in that case. And
   enabling FIQs has nothing to do with idling the CPU to start with.
   
   So let's introduce init_fiq_boot_cpu() to take care of FIQs on the boot
   CPU and remove arch_cpu_idle_prepare(). This is now done a bit earlier
   at late_initcall time but this shouldn't make a difference in practice
   i.e. when FIQs are actually used.
   
   Signed-off-by: Nicolas Pitre n...@linaro.org
   ---
arch/arm/kernel/process.c | 5 -
arch/arm/kernel/setup.c   | 7 +++
2 files changed, 7 insertions(+), 5 deletions(-)
   
   diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c
   index 92f7b15dd2..725b8c95e0 100644
   --- a/arch/arm/kernel/process.c
   +++ b/arch/arm/kernel/process.c
   @@ -142,11 +142,6 @@ static void default_idle(void)
 local_irq_enable();
}

   -void arch_cpu_idle_prepare(void)
   -{
   - local_fiq_enable();
   -}
   -
void arch_cpu_idle_enter(void)
{
 ledtrig_cpu(CPU_LED_IDLE_START);
   diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
   index 987a7f5bce..d027b1a6fe 100644
   --- a/arch/arm/kernel/setup.c
   +++ b/arch/arm/kernel/setup.c
   @@ -789,6 +789,13 @@ static int __init init_machine_late(void)
}
late_initcall(init_machine_late);

   +static int __init init_fiq_boot_cpu(void)
   +{
   + local_fiq_enable();
   + return 0;
   +}
   +late_initcall(init_fiq_boot_cpu);
  
  arch_cpu_idle_prepare() gets called from the swapper thread, and changes
  the swapper thread's CPSR. init_fiq_boot_cpu() gets called from PID1, the
  init thread, and changes the init thread's CPSR, which will already have
  FIQs enabled by way of how kernel threads are created.
  
  Hence, the above code fragment has no effect what so ever, and those
  platforms using FIQs will not have FIQs delivered if they're idle
  (because the swapper will have FIQs masked at the CPU.)
 
 You're right.
 
 What about moving local_fiq_enable() to trap_init() then?

That's potentially unsafe, as we haven't touched any of the IRQ
controllers at that point - we can't guarantee what state they'd be
in.  Given that the default FIQ is to just return, a FIQ being raised
at that point will end up with an infinite loop re-entering the FIQ
handler.

-- 
FTTC broadband for 0.8mile line: 5.8Mbps down 500kbps up.  Estimation
in database were 13.1 to 19Mbit for a good line, about 7.5+ for a bad.
Estimate before purchase was up to 13.2Mbit.
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: [PATCH] slub: Don't throw away partial remote slabs if there is no local memory

2014-01-27 Thread Christoph Lameter
On Fri, 24 Jan 2014, David Rientjes wrote:

 kmalloc_node(nid) and kmem_cache_alloc_node(nid) should fallback to nodes
 other than nid when memory can't be allocated, these functions only
 indicate a preference.

The nid passed indicated a preference unless __GFP_THIS_NODE is specified.
Then the allocation must occur on that node.


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


Re: [PATCH] slub: Don't throw away partial remote slabs if there is no local memory

2014-01-27 Thread Christoph Lameter
On Fri, 24 Jan 2014, Nishanth Aravamudan wrote:

 As to cpu_to_node() being passed to kmalloc_node(), I think an
 appropriate fix is to change that to cpu_to_mem()?

Yup.

  Yeah, the default policy should be to fallback to local memory if the node
  passed is memoryless.

 Thanks!

I would suggest to use NUMA_NO_NODE instead. That will fit any slab that
we may be currently allocating from or can get a hold of and is mosty
efficient.
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[PATCH] powerpc/pseries Use remove_memory() to remove memory

2014-01-27 Thread Nathan Fontenot
The memory remove code for powerpc/pseries should call remove_memory()
so that we are holding the hotplug_memory lock during memory remove
operations.

This patch updates the memory node remove handler to call remove_memory()
and adds a ppc_md.remove_memory() entry to handle pseries specific work
that is called from arch_remove_memory().

During memory remove in pseries_remove_memblock() we have to stay with
removing memory one section at a time. This is needed because of how memory
resources are handled. During memory add for pseries (via the probe file in
sysfs) we add memory one section at a time which gives us a memory resource
for each section. Future patches will aim to address this so will not have
to remove memory one section at a time.

Signed-off-by: Nathan Fontenot nf...@linux.vnet.ibm.com
---
 arch/powerpc/include/asm/machdep.h  |4 +
 arch/powerpc/mm/mem.c   |7 +
 arch/powerpc/platforms/pseries/hotplug-memory.c |   85 +++-
 3 files changed, 50 insertions(+), 46 deletions(-)

Index: powerpc/arch/powerpc/platforms/pseries/hotplug-memory.c
===
--- powerpc.orig/arch/powerpc/platforms/pseries/hotplug-memory.c
2014-01-27 08:47:19.0 -0600
+++ powerpc/arch/powerpc/platforms/pseries/hotplug-memory.c 2014-01-27 
09:21:54.0 -0600
@@ -14,6 +14,7 @@
 #include linux/memblock.h
 #include linux/vmalloc.h
 #include linux/memory.h
+#include linux/memory_hotplug.h
 
 #include asm/firmware.h
 #include asm/machdep.h
@@ -75,13 +76,27 @@
 }
 
 #ifdef CONFIG_MEMORY_HOTREMOVE
-static int pseries_remove_memblock(unsigned long base, unsigned int 
memblock_size)
+static int pseries_remove_memory(u64 start, u64 size)
 {
-   unsigned long start, start_pfn;
-   struct zone *zone;
int ret;
-   unsigned long section;
-   unsigned long sections_to_remove;
+
+   /* Remove htab bolted mappings for this section of memory */
+   start = (unsigned long)__va(start);
+   ret = remove_section_mapping(start, start + size);
+
+   /* Ensure all vmalloc mappings are flushed in case they also
+* hit that section of memory
+*/
+   vm_unmap_aliases();
+
+   return ret;
+}
+
+static int pseries_remove_memblock(unsigned long base, unsigned int 
memblock_size)
+{
+   unsigned long block_sz, start_pfn;
+   int sections_per_block;
+   int i, nid;
 
start_pfn = base  PAGE_SHIFT;
 
@@ -90,45 +105,21 @@
return 0;
}
 
-   zone = page_zone(pfn_to_page(start_pfn));
-
-   /*
-* Remove section mappings and sysfs entries for the
-* section of the memory we are removing.
-*
-* NOTE: Ideally, this should be done in generic code like
-* remove_memory(). But remove_memory() gets called by writing
-* to sysfs state file and we can't remove sysfs entries
-* while writing to it. So we have to defer it to here.
-*/
-   sections_to_remove = (memblock_size  PAGE_SHIFT) / PAGES_PER_SECTION;
-   for (section = 0; section  sections_to_remove; section++) {
-   unsigned long pfn = start_pfn + section * PAGES_PER_SECTION;
-   ret = __remove_pages(zone, pfn, PAGES_PER_SECTION);
-   if (ret)
-   return ret;
+   block_sz = memory_block_size_bytes();
+   sections_per_block = block_sz / MIN_MEMORY_BLOCK_SIZE;
+   nid = memory_add_physaddr_to_nid(base);
+
+   for (i = 0; i  sections_per_block; i++) {
+   remove_memory(nid, base, MIN_MEMORY_BLOCK_SIZE);
+   base += MIN_MEMORY_BLOCK_SIZE;
}
 
-   /*
-* Update memory regions for memory remove
-*/
+   /* Update memory regions for memory remove */
memblock_remove(base, memblock_size);
-
-   /*
-* Remove htab bolted mappings for this section of memory
-*/
-   start = (unsigned long)__va(base);
-   ret = remove_section_mapping(start, start + memblock_size);
-
-   /* Ensure all vmalloc mappings are flushed in case they also
-* hit that section of memory
-*/
-   vm_unmap_aliases();
-
-   return ret;
+   return 0;
 }
 
-static int pseries_remove_memory(struct device_node *np)
+static int pseries_remove_mem_node(struct device_node *np)
 {
const char *type;
const unsigned int *regs;
@@ -153,8 +144,8 @@
base = *(unsigned long *)regs;
lmb_size = regs[3];
 
-   ret = pseries_remove_memblock(base, lmb_size);
-   return ret;
+   pseries_remove_memblock(base, lmb_size);
+   return 0;
 }
 #else
 static inline int pseries_remove_memblock(unsigned long base,
@@ -162,13 +153,13 @@
 {
return -EOPNOTSUPP;
 }
-static inline int pseries_remove_memory(struct device_node *np)
+static inline int pseries_remove_mem_node(struct device_node *np)
 {
return 

Re: [PATCH 1/9] ARM: get rid of arch_cpu_idle_prepare()

2014-01-27 Thread Daniel Lezcano

On 01/27/2014 06:21 PM, Russell King - ARM Linux wrote:

On Mon, Jan 27, 2014 at 06:12:53PM +0100, Daniel Lezcano wrote:

On 01/27/2014 05:07 PM, Russell King - ARM Linux wrote:

On Mon, Jan 27, 2014 at 09:22:55AM +0100, Daniel Lezcano wrote:

On 01/27/2014 07:08 AM, Nicolas Pitre wrote:

ARM and ARM64 are the only two architectures implementing
arch_cpu_idle_prepare() simply to call local_fiq_enable().

We have secondary_start_kernel() already calling local_fiq_enable() and
this is done a second time in arch_cpu_idle_prepare() in that case. And
enabling FIQs has nothing to do with idling the CPU to start with.

So let's introduce init_fiq_boot_cpu() to take care of FIQs on the boot
CPU and remove arch_cpu_idle_prepare(). This is now done a bit earlier
at late_initcall time but this shouldn't make a difference in practice
i.e. when FIQs are actually used.

Signed-off-by: Nicolas Pitre n...@linaro.org


Reviewed-by: Daniel Lezcano daniel.lezc...@linaro.org


What kind of review did you do when giving that attributation?


I did the review to the best of my knowledge and with good will.

I read your comment on this patch and I learnt one more thing.

Today, I am smarter than yesterday and dumber than tomorrow :)


Just be aware that putting a comment along with the reviewed-by tag
is always a good idea.  I know that's a little more work, but this has
been raised a number of times by various people over the years.

A reviewed-by tag on its own doesn't mean much, as it could mean that
you've just glanced over the code and decided yea, it looks okay, or
it could mean that you've spent all day verifying that the code change
is indeed correct.

Consequently, some will ignore emails which just contain a reviewed-by
attributation.


Thanks for the clarification. I will take care of giving a comment next 
time.


  -- Daniel


--
 http://www.linaro.org/ Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  http://www.facebook.com/pages/Linaro Facebook |
http://twitter.com/#!/linaroorg Twitter |
http://www.linaro.org/linaro-blog/ Blog

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

Re: [PATCH 1/9] ARM: get rid of arch_cpu_idle_prepare()

2014-01-27 Thread Nicolas Pitre
On Mon, 27 Jan 2014, Russell King - ARM Linux wrote:

 On Mon, Jan 27, 2014 at 10:45:59AM -0500, Nicolas Pitre wrote:
  On Mon, 27 Jan 2014, Russell King - ARM Linux wrote:
  
   On Mon, Jan 27, 2014 at 01:08:16AM -0500, Nicolas Pitre wrote:
ARM and ARM64 are the only two architectures implementing
arch_cpu_idle_prepare() simply to call local_fiq_enable().

We have secondary_start_kernel() already calling local_fiq_enable() and
this is done a second time in arch_cpu_idle_prepare() in that case. And
enabling FIQs has nothing to do with idling the CPU to start with.

So let's introduce init_fiq_boot_cpu() to take care of FIQs on the boot
CPU and remove arch_cpu_idle_prepare(). This is now done a bit earlier
at late_initcall time but this shouldn't make a difference in practice
i.e. when FIQs are actually used.

Signed-off-by: Nicolas Pitre n...@linaro.org
---
 arch/arm/kernel/process.c | 5 -
 arch/arm/kernel/setup.c   | 7 +++
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c
index 92f7b15dd2..725b8c95e0 100644
--- a/arch/arm/kernel/process.c
+++ b/arch/arm/kernel/process.c
@@ -142,11 +142,6 @@ static void default_idle(void)
local_irq_enable();
 }
 
-void arch_cpu_idle_prepare(void)
-{
-   local_fiq_enable();
-}
-
 void arch_cpu_idle_enter(void)
 {
ledtrig_cpu(CPU_LED_IDLE_START);
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
index 987a7f5bce..d027b1a6fe 100644
--- a/arch/arm/kernel/setup.c
+++ b/arch/arm/kernel/setup.c
@@ -789,6 +789,13 @@ static int __init init_machine_late(void)
 }
 late_initcall(init_machine_late);
 
+static int __init init_fiq_boot_cpu(void)
+{
+   local_fiq_enable();
+   return 0;
+}
+late_initcall(init_fiq_boot_cpu);
   
   arch_cpu_idle_prepare() gets called from the swapper thread, and changes
   the swapper thread's CPSR. init_fiq_boot_cpu() gets called from PID1, the
   init thread, and changes the init thread's CPSR, which will already have
   FIQs enabled by way of how kernel threads are created.
   
   Hence, the above code fragment has no effect what so ever, and those
   platforms using FIQs will not have FIQs delivered if they're idle
   (because the swapper will have FIQs masked at the CPU.)
  
  You're right.
  
  What about moving local_fiq_enable() to trap_init() then?
 
 That's potentially unsafe, as we haven't touched any of the IRQ
 controllers at that point - we can't guarantee what state they'd be
 in.  Given that the default FIQ is to just return, a FIQ being raised
 at that point will end up with an infinite loop re-entering the FIQ
 handler.

Okay... I don't see any obvious way to work around that besides adding 
another explicit hook, which arch_cpu_idle_prepare() incidentally 
already is. So, unless you have a better idea, I'll drop this patch and 
leave ARM as the only user of arch_cpu_idle_prepare().


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


Re: [PATCH 1/9] ARM: get rid of arch_cpu_idle_prepare()

2014-01-27 Thread Peter Zijlstra
On Mon, Jan 27, 2014 at 05:21:10PM +, Russell King - ARM Linux wrote:
 A reviewed-by tag on its own doesn't mean much, as it could mean that
 you've just glanced over the code and decided yea, it looks okay, or
 it could mean that you've spent all day verifying that the code change
 is indeed correct.

One should use Acked-by for the 'yea, it looks okay' thing.
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: [PATCH 1/9] ARM: get rid of arch_cpu_idle_prepare()

2014-01-27 Thread Daniel Lezcano

On 01/27/2014 05:07 PM, Russell King - ARM Linux wrote:

On Mon, Jan 27, 2014 at 09:22:55AM +0100, Daniel Lezcano wrote:

On 01/27/2014 07:08 AM, Nicolas Pitre wrote:

ARM and ARM64 are the only two architectures implementing
arch_cpu_idle_prepare() simply to call local_fiq_enable().

We have secondary_start_kernel() already calling local_fiq_enable() and
this is done a second time in arch_cpu_idle_prepare() in that case. And
enabling FIQs has nothing to do with idling the CPU to start with.

So let's introduce init_fiq_boot_cpu() to take care of FIQs on the boot
CPU and remove arch_cpu_idle_prepare(). This is now done a bit earlier
at late_initcall time but this shouldn't make a difference in practice
i.e. when FIQs are actually used.

Signed-off-by: Nicolas Pitre n...@linaro.org


Reviewed-by: Daniel Lezcano daniel.lezc...@linaro.org


What kind of review did you do when giving that attributation?


I did the review to the best of my knowledge and with good will.

I read your comment on this patch and I learnt one more thing.

Today, I am smarter than yesterday and dumber than tomorrow :)


  -- Daniel


--
 http://www.linaro.org/ Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  http://www.facebook.com/pages/Linaro Facebook |
http://twitter.com/#!/linaroorg Twitter |
http://www.linaro.org/linaro-blog/ Blog

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

Re: [PATCH 1/2][v6] driver/memory:Move Freescale IFC driver to a common driver

2014-01-27 Thread Kumar Gala

On Jan 25, 2014, at 6:06 AM, Prabhakar Kushwaha prabha...@freescale.com wrote:

 Freescale IFC controller has been used for mpc8xxx. It will be used
 for ARM-based SoC as well. This patch moves the driver to driver/memory
 and fix the header file includes.
 
 Also remove module_platform_driver() and  instead call
 platform_driver_register() from subsys_initcall() to make sure this module
 has been loaded before MTD partition parsing starts.
 
 Signed-off-by: Prabhakar Kushwaha prabha...@freescale.com
 Acked-by: Arnd Bergmann a...@arndb.de
 ---
 Based upon git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc.git
 Branch next
 
 Changes for v2:
   - Move fsl_ifc in driver/memory
 
 Changes for v3:
   - move device tree bindings to memory
 
 Changes for v4: Rebased to 
   git://git.kernel.org/pub/scm/linux/kernel/git/scottwood/linux.git
 
 Changes for v5: 
   - Moved powerpc/Kconfig option to driver/memory
 
 Changes for v6:
   - Update Kconfig details
 
 .../{powerpc = memory-controllers}/fsl/ifc.txt|0
 arch/powerpc/Kconfig   |4 
 arch/powerpc/sysdev/Makefile   |1 -
 drivers/memory/Kconfig |9 +
 drivers/memory/Makefile|1 +
 {arch/powerpc/sysdev = drivers/memory}/fsl_ifc.c  |8 ++--
 drivers/mtd/nand/fsl_ifc_nand.c|2 +-
 .../include/asm = include/linux}/fsl_ifc.h|0
 8 files changed, 17 insertions(+), 8 deletions(-)
 rename Documentation/devicetree/bindings/{powerpc = 
 memory-controllers}/fsl/ifc.txt (100%)
 rename {arch/powerpc/sysdev = drivers/memory}/fsl_ifc.c (98%)
 rename {arch/powerpc/include/asm = include/linux}/fsl_ifc.h (100%)
 
 diff --git a/Documentation/devicetree/bindings/powerpc/fsl/ifc.txt 
 b/Documentation/devicetree/bindings/memory-controllers/fsl/ifc.txt
 similarity index 100%
 rename from Documentation/devicetree/bindings/powerpc/fsl/ifc.txt
 rename to Documentation/devicetree/bindings/memory-controllers/fsl/ifc.txt
 diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
 index fa39517..91dc43c 100644
 --- a/arch/powerpc/Kconfig
 +++ b/arch/powerpc/Kconfig
 @@ -727,10 +727,6 @@ config FSL_LBC
 controller.  Also contains some common code used by
 drivers for specific local bus peripherals.
 
 -config FSL_IFC
 - bool
 -depends on FSL_SOC
 -
 config FSL_GTM
   bool
   depends on PPC_83xx || QUICC_ENGINE || CPM2
 diff --git a/arch/powerpc/sysdev/Makefile b/arch/powerpc/sysdev/Makefile
 index f67ac90..afbcc37 100644
 --- a/arch/powerpc/sysdev/Makefile
 +++ b/arch/powerpc/sysdev/Makefile
 @@ -21,7 +21,6 @@ obj-$(CONFIG_FSL_SOC)   += fsl_soc.o 
 fsl_mpic_err.o
 obj-$(CONFIG_FSL_PCI) += fsl_pci.o $(fsl-msi-obj-y)
 obj-$(CONFIG_FSL_PMC) += fsl_pmc.o
 obj-$(CONFIG_FSL_LBC) += fsl_lbc.o
 -obj-$(CONFIG_FSL_IFC)+= fsl_ifc.o
 obj-$(CONFIG_FSL_GTM) += fsl_gtm.o
 obj-$(CONFIG_FSL_85XX_CACHE_SRAM) += fsl_85xx_l2ctlr.o 
 fsl_85xx_cache_sram.o
 obj-$(CONFIG_SIMPLE_GPIO) += simple_gpio.o
 diff --git a/drivers/memory/Kconfig b/drivers/memory/Kconfig
 index 29a11db..555d26f 100644
 --- a/drivers/memory/Kconfig
 +++ b/drivers/memory/Kconfig
 @@ -50,4 +50,13 @@ config TEGRA30_MC
 analysis, especially for IOMMU/SMMU(System Memory Management
 Unit) module.
 
 +config FSL_IFC
 + bool Freescale Integrated Flash Controller
 + default y
 +depends on FSL_SOC

minor white space nit (spaces instead of tab)

 + help
 +   This driver is for the Integrated Flash Controller Controller(IFC) 
 +   module available in Freescale SoCs. This controller allows to handle 
 flash
 +   devices such as NOR, NAND, FPGA and ASIC etc
 +
 endif

- k

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


Re: [PATCH 1/2][v6] driver/memory:Move Freescale IFC driver to a common driver

2014-01-27 Thread Scott Wood
On Sat, 2014-01-25 at 17:36 +0530, Prabhakar Kushwaha wrote:
 diff --git a/drivers/memory/Kconfig b/drivers/memory/Kconfig
 index 29a11db..555d26f 100644
 --- a/drivers/memory/Kconfig
 +++ b/drivers/memory/Kconfig
 @@ -50,4 +50,13 @@ config TEGRA30_MC
 analysis, especially for IOMMU/SMMU(System Memory Management
 Unit) module.
  
 +config FSL_IFC
 + bool Freescale Integrated Flash Controller
 + default y

Don't use default y.

-Scott


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


Re: [PATCH 1/1] Fixed some coding style problems

2014-01-27 Thread Joe Perches
On Mon, 2014-01-27 at 19:43 -0600, Brandon Stewart wrote:
[]
 diff --git a/drivers/macintosh/adb.c b/drivers/macintosh/adb.c
[]
 @@ -624,8 +623,7 @@ do_adb_query(struct adb_request *req)
  {
   int ret = -EINVAL;
  
 - switch(req-data[1])
 - {
 + switch(req-data[1]) {

switch (req-data[1]) {

 @@ -794,8 +792,8 @@ static ssize_t adb_write(struct file *file, const char 
 __user *buf,
   }
   /* Special case for ADB_BUSRESET request, all others are sent to
  the controller */
 - else if ((req-data[0] == ADB_PACKET)(count  1)
 - (req-data[1] == ADB_BUSRESET)) {
 + else if ((req-data[0] == ADB_PACKET)  (count  1)
 +  (req-data[1] == ADB_BUSRESET)) {

else if (req-data[0] == ADB_PACKET 
 req-data[1] == ADB_BUSRESET 
 count  1) {


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


[PATCH 1/1] Fixed some coding style problems

2014-01-27 Thread Brandon Stewart
Signed-off-by: Brandon Stewart stewar...@gmail.com
---
 drivers/macintosh/adb.c | 16 +++-
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/drivers/macintosh/adb.c b/drivers/macintosh/adb.c
index 04a5049..53611de 100644
--- a/drivers/macintosh/adb.c
+++ b/drivers/macintosh/adb.c
@@ -38,7 +38,7 @@
 #include linux/platform_device.h
 #include linux/mutex.h
 
-#include asm/uaccess.h
+#include linux/uaccess.h
 #ifdef CONFIG_PPC
 #include asm/prom.h
 #include asm/machdep.h
@@ -193,8 +193,7 @@ static int adb_scan_bus(void)
break;
 
noMovement = 0;
-   }
-   else {
+   } else {
/*
 * No devices left at address i; move the
 * one(s) we moved to `highFree' back to i.
@@ -502,7 +501,7 @@ void
 adb_input(unsigned char *buf, int nb, int autopoll)
 {
int i, id;
-   static int dump_adb_input = 0;
+   static int dump_adb_input;
unsigned long flags;

void (*handler)(unsigned char *, int, int);
@@ -624,8 +623,7 @@ do_adb_query(struct adb_request *req)
 {
int ret = -EINVAL;
 
-   switch(req-data[1])
-   {
+   switch(req-data[1]) {
case ADB_QUERY_GETDEVINFO:
if (req-nbytes  3)
break;
@@ -697,7 +695,7 @@ static ssize_t adb_read(struct file *file, char __user *buf,
int ret = 0;
struct adbdev_state *state = file-private_data;
struct adb_request *req;
-   DECLARE_WAITQUEUE(wait,current);
+   DECLARE_WAITQUEUE(wait, current);
unsigned long flags;
 
if (count  2)
@@ -794,8 +792,8 @@ static ssize_t adb_write(struct file *file, const char 
__user *buf,
}
/* Special case for ADB_BUSRESET request, all others are sent to
   the controller */
-   else if ((req-data[0] == ADB_PACKET)(count  1)
-   (req-data[1] == ADB_BUSRESET)) {
+   else if ((req-data[0] == ADB_PACKET)  (count  1)
+(req-data[1] == ADB_BUSRESET)) {
ret = do_adb_reset_bus();
up(adb_probe_mutex);
atomic_dec(state-n_pending);
-- 
1.8.5.3

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


[PATCH 2/2] Fix coding style errors

2014-01-27 Thread Brandon Stewart
I corrected several coding errors.

Signed-off-by: Brandon Stewart stewar...@gmail.com
---
 drivers/macintosh/adb.c | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/macintosh/adb.c b/drivers/macintosh/adb.c
index 53611de..dd3f49a 100644
--- a/drivers/macintosh/adb.c
+++ b/drivers/macintosh/adb.c
@@ -623,7 +623,7 @@ do_adb_query(struct adb_request *req)
 {
int ret = -EINVAL;
 
-   switch(req-data[1]) {
+   switch (req-data[1]) {
case ADB_QUERY_GETDEVINFO:
if (req-nbytes  3)
break;
@@ -792,8 +792,9 @@ static ssize_t adb_write(struct file *file, const char 
__user *buf,
}
/* Special case for ADB_BUSRESET request, all others are sent to
   the controller */
-   else if ((req-data[0] == ADB_PACKET)  (count  1)
-(req-data[1] == ADB_BUSRESET)) {
+   else if (req-data[0] == ADB_PACKET 
+   req-data[1] == ADB_BUSRESET 
+   count  1) {
ret = do_adb_reset_bus();
up(adb_probe_mutex);
atomic_dec(state-n_pending);
-- 
1.8.5.3

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


Re: [PATCH RFC 00/73] tree-wide: clean up some no longer required #include linux/init.h

2014-01-27 Thread Benjamin Herrenschmidt
On Wed, 2014-01-22 at 19:38 -0500, Paul Gortmaker wrote:

 Thanks, it was a great help as it uncovered a few issues in fringe arch
 that I didn't have toolchains for, and I've fixed all of those up.
 
 I've noticed that powerpc has been un-buildable for a while now; I have
 used this hack patch locally so I could run the ppc defconfigs to check
 that I didn't break anything.  Maybe useful for linux-next in the
 interim?  It is a hack patch -- Not-Signed-off-by: Paul Gortmaker.  :)

Can you and/or Aneesh submit that as a proper patch (with S-O-B
etc...) ?

Thanks !

Cheers,
Ben.

 Paul.
 --
 
 diff --git a/arch/powerpc/include/asm/pgtable-ppc64.h 
 b/arch/powerpc/include/asm/pgtable-ppc64.h
 index d27960c89a71..d0f070a2b395 100644
 --- a/arch/powerpc/include/asm/pgtable-ppc64.h
 +++ b/arch/powerpc/include/asm/pgtable-ppc64.h
 @@ -560,9 +560,9 @@ extern void pmdp_invalidate(struct vm_area_struct *vma, 
 unsigned long address,
   pmd_t *pmdp);
  
  #define pmd_move_must_withdraw pmd_move_must_withdraw
 -typedef struct spinlock spinlock_t;
 -static inline int pmd_move_must_withdraw(spinlock_t *new_pmd_ptl,
 -  spinlock_t *old_pmd_ptl)
 +struct spinlock;
 +static inline int pmd_move_must_withdraw(struct spinlock *new_pmd_ptl,
 +  struct spinlock *old_pmd_ptl)
  {
   /*
* Archs like ppc64 use pgtable to store per pmd
 
 ___
 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


[git pull] Please pull powerpc.git next branch

2014-01-27 Thread Benjamin Herrenschmidt
Hi Linus !

So here's my next branch for powerpc. A bit late as I was on vacation
last week. It's mostly the same stuff that was in next already, I just
added two patches today which are the wiring up of lockref for powerpc,
which for some reason fell through the cracks last time and is trivial.

The merge has conflicts that aren't too nasty but in case you have an
issue resolving them, I've put a resolved branch in test of the same
repository for you to look at.

The highlights are, in addition to a bunch of bug fixes:

 - Reworked Machine Check handling on kernels running without a
hypervisor (or acting as a hypervisor). Provides hooks to handle
some errors in real mode such as TLB errors, handle SLB errors, etc...

 - Support for retrieving memory error information from the service
processor on IBM servers running without a hypervisor and routing
them to the memory poison infrastructure.

 - _PAGE_NUMA support on server processors

 - 32-bit BookE relocatable kernel support

 - FSL e6500 hardware tablewalk support

 - A bunch of new/revived board support

 - FSL e6500 deeper idle states and altivec powerdown support

I have a remaining fix that is still based on a different branch for
which I will send you a pull request separately (it's the patch that
didn't make it in -rc8 since it might potentially affect x86).

You'll notice a generic mm change here, it has been acked by the
relevant authorities and is a pre-req for our _PAGE_NUMA support.

The following changes since commit f991db1cf1bdca43675b5d2df0af991719727029:

  Merge remote-tracking branch 'agust/merge' into merge (2013-12-30 14:48:27 
+1100)

are available in the git repository at:


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

for you to fetch changes up to 7179ba52889bef7e5e23f72908270e1ab2b7fc6f:

  powerpc: Implement arch_spin_is_locked() using arch_spin_value_unlocked() 
(2014-01-28 14:45:44 +1100)


Alexey Kardashevskiy (1):
  PPC: POWERNV: move iommu_add_device earlier

Alistair Popple (3):
  powerpc/iommu: Update constant names to reflect their hardcoded page size
  powerpc/iommu: Add it_page_shift field to determine iommu page size
  powerpc/iommu: Update the generic code to use dynamic iommu page sizes

Andreas Schwab (1):
  powerpc: Add vr save/restore functions

Aneesh Kumar K.V (5):
  mm: Move change_prot_numa outside CONFIG_ARCH_USES_NUMA_PROT_NONE
  powerpc/mm: Use HPTE constants when updating hpte bits
  powerpc/mm: Free up _PAGE_COHERENCE for numa fault use later
  powerpc/mm: Only check for _PAGE_PRESENT in set_pte/pmd functions
  powerpc/mm: Enable _PAGE_NUMA for book3s

Anton Blanchard (2):
  powerpc: Fix endian issues in power7/8 machine check handler
  drivers/tty: ehv_bytechan fails to build as a module

Benjamin Herrenschmidt (3):
  powerpc: Fix races with irq_work

Brian King (1):
  powerpc: Increase EEH recovery timeout for SR-IOV

Chen Gang (1):
  powerpc: kernel: remove useless code which related with 'max_cpus'

Christian Engelmayer (1):
  powerpc/sysdev: Fix a pci section mismatch for Book E

Denis Efremov (1):
  powerpc/ps3: Remove inline marking of EXPORT_SYMBOL functions

Diana Craciun (1):
  powerpc: Replaced tlbilx with tlbwe in the initialization code

Gavin Shan (9):
  powerpc/powernv: Move PHB-diag dump functions around
  powerpc/eeh: Output PHB diag-data
  powerpc/powernv: Remove unnecessary assignment
  powerpc/eeh: Add restore_config operation
  powerpc/eeh: Call opal_pci_reinit() on powernv for restoring config space
  powerpc/eeh: Hotplug improvement
  powerpc/iommu: Don't detach device without IOMMU group
  powerpc/eeh: Handle multiple EEH errors
  powerpc/eeh: Escalate error on non-existing PE

Geert Uytterhoeven (2):
  powerpc/windfarm: Remove superfluous name casts
  powerpc: Make add_system_ram_resources() __init

Ian Campbell (3):
  powerpc/4xx: Fix warning in kilauea.dtb
  powerpc/dts/virtex440: Declare address/size-cells for phy device
  powerpc/boot: Ignore .dtb files.

Jeremy Kerr (2):
  powerpc: Make slb_shadow a local
  powerpc: Dynamically allocate slb_shadow from memblock

Joseph Myers (6):
  powerpc: fix exception clearing in e500 SPE float emulation
  powerpc: fix e500 SPE float rounding inexactness detection
  math-emu: fix floating-point to integer unsigned saturation
  math-emu: fix floating-point to integer overflow detection
  powerpc: fix e500 SPE float to integer and fixed-point conversions
  powerpc: fix e500 SPE float SIGFPE generation

Kevin Hao (14):
  powerpc: Move the patch_exception to a common place
  powerpc: Use patch_exception to update the debug exception handler
  powerpc: purge all the prefetched instructions for the coherent icache 
flush
  powerpc/85xx: don't init the mpic ipi for the SoC which has 

[git pull] Please pull powerpc.git merge branch

2014-01-27 Thread Benjamin Herrenschmidt
Hi Linus !

This is the patch that I had sent after -rc8 and which we decided
to wait before merging. It's based on a different tree than my
-next branch (it needs some pre-reqs that were in -rc4 or so while
my -next is based on -rc1) so I left it as a separate branch for
your to pull. It's identical to the request I did 2 or 3 weeks back.

This fixes crashes in mremap with THP on powerpc.

The fix however requires a small change in the generic code. It moves a
condition into a helper we can override from the arch which is harmless,
but it *also* slightly changes the order of the set_pmd and the withdraw
 deposit, which should be fine according to Kirill (who wrote that
code) but I agree -rc8 is a bit late...

It was acked by Kirill and Andrew told me to just merge it via powerpc.

Cheers,
Ben.

The following changes since commit a6da83f98267bc8ee4e34aa899169991eb0ceb93:

  Merge branch 'merge' of 
git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc (2014-01-13 10:59:05 
+0700)

are available in the git repository at:


  git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc.git merge

for you to fetch changes up to b3084f4db3aeb991c507ca774337c7e7893ed04f:

  powerpc/thp: Fix crash on mremap (2014-01-15 15:46:38 +1100)


Aneesh Kumar K.V (1):
  powerpc/thp: Fix crash on mremap

 arch/powerpc/include/asm/pgtable-ppc64.h | 14 ++
 include/asm-generic/pgtable.h| 12 
 mm/huge_memory.c | 14 +-
 3 files changed, 31 insertions(+), 9 deletions(-)



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


[PATCH 1/2][v7] driver/memory:Move Freescale IFC driver to a common driver

2014-01-27 Thread Prabhakar Kushwaha
 Freescale IFC controller has been used for mpc8xxx. It will be used
 for ARM-based SoC as well. This patch moves the driver to driver/memory
 and fix the header file includes.

 Also remove module_platform_driver() and  instead call
 platform_driver_register() from subsys_initcall() to make sure this module
 has been loaded before MTD partition parsing starts.

Signed-off-by: Prabhakar Kushwaha prabha...@freescale.com
Acked-by: Arnd Bergmann a...@arndb.de
---
Based upon git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc.git
Branch next

Changes for v2:
- Move fsl_ifc in driver/memory

Changes for v3:
- move device tree bindings to memory

Changes for v4: Rebased to 
git://git.kernel.org/pub/scm/linux/kernel/git/scottwood/linux.git

Changes for v5: 
- Moved powerpc/Kconfig option to driver/memory

Changes for v6:
- Update Kconfig details

Changes for v7:
- Update Kconfig

 .../{powerpc = memory-controllers}/fsl/ifc.txt|0
 arch/powerpc/Kconfig   |4 
 arch/powerpc/sysdev/Makefile   |1 -
 drivers/memory/Kconfig |8 
 drivers/memory/Makefile|1 +
 {arch/powerpc/sysdev = drivers/memory}/fsl_ifc.c  |8 ++--
 drivers/mtd/nand/fsl_ifc_nand.c|2 +-
 .../include/asm = include/linux}/fsl_ifc.h|0
 8 files changed, 16 insertions(+), 8 deletions(-)
 rename Documentation/devicetree/bindings/{powerpc = 
memory-controllers}/fsl/ifc.txt (100%)
 rename {arch/powerpc/sysdev = drivers/memory}/fsl_ifc.c (98%)
 rename {arch/powerpc/include/asm = include/linux}/fsl_ifc.h (100%)

diff --git a/Documentation/devicetree/bindings/powerpc/fsl/ifc.txt 
b/Documentation/devicetree/bindings/memory-controllers/fsl/ifc.txt
similarity index 100%
rename from Documentation/devicetree/bindings/powerpc/fsl/ifc.txt
rename to Documentation/devicetree/bindings/memory-controllers/fsl/ifc.txt
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 6ca5d5c..3f868f5 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -728,10 +728,6 @@ config FSL_LBC
  controller.  Also contains some common code used by
  drivers for specific local bus peripherals.
 
-config FSL_IFC
-   bool
-depends on FSL_SOC
-
 config FSL_GTM
bool
depends on PPC_83xx || QUICC_ENGINE || CPM2
diff --git a/arch/powerpc/sysdev/Makefile b/arch/powerpc/sysdev/Makefile
index f67ac90..afbcc37 100644
--- a/arch/powerpc/sysdev/Makefile
+++ b/arch/powerpc/sysdev/Makefile
@@ -21,7 +21,6 @@ obj-$(CONFIG_FSL_SOC) += fsl_soc.o fsl_mpic_err.o
 obj-$(CONFIG_FSL_PCI)  += fsl_pci.o $(fsl-msi-obj-y)
 obj-$(CONFIG_FSL_PMC)  += fsl_pmc.o
 obj-$(CONFIG_FSL_LBC)  += fsl_lbc.o
-obj-$(CONFIG_FSL_IFC)  += fsl_ifc.o
 obj-$(CONFIG_FSL_GTM)  += fsl_gtm.o
 obj-$(CONFIG_FSL_85XX_CACHE_SRAM)  += fsl_85xx_l2ctlr.o 
fsl_85xx_cache_sram.o
 obj-$(CONFIG_SIMPLE_GPIO)  += simple_gpio.o
diff --git a/drivers/memory/Kconfig b/drivers/memory/Kconfig
index 29a11db..3176866 100644
--- a/drivers/memory/Kconfig
+++ b/drivers/memory/Kconfig
@@ -50,4 +50,12 @@ config TEGRA30_MC
  analysis, especially for IOMMU/SMMU(System Memory Management
  Unit) module.
 
+config FSL_IFC
+   bool Freescale Integrated Flash Controller
+   depends on FSL_SOC
+   help
+ This driver is for the Integrated Flash Controller Controller(IFC)
+ module available in Freescale SoCs. This controller allows to handle 
flash
+ devices such as NOR, NAND, FPGA and ASIC etc
+
 endif
diff --git a/drivers/memory/Makefile b/drivers/memory/Makefile
index 969d923..f2bf25c 100644
--- a/drivers/memory/Makefile
+++ b/drivers/memory/Makefile
@@ -6,6 +6,7 @@ ifeq ($(CONFIG_DDR),y)
 obj-$(CONFIG_OF)   += of_memory.o
 endif
 obj-$(CONFIG_TI_EMIF)  += emif.o
+obj-$(CONFIG_FSL_IFC)  += fsl_ifc.o
 obj-$(CONFIG_MVEBU_DEVBUS) += mvebu-devbus.o
 obj-$(CONFIG_TEGRA20_MC)   += tegra20-mc.o
 obj-$(CONFIG_TEGRA30_MC)   += tegra30-mc.o
diff --git a/arch/powerpc/sysdev/fsl_ifc.c b/drivers/memory/fsl_ifc.c
similarity index 98%
rename from arch/powerpc/sysdev/fsl_ifc.c
rename to drivers/memory/fsl_ifc.c
index fbc885b..3d5d792 100644
--- a/arch/powerpc/sysdev/fsl_ifc.c
+++ b/drivers/memory/fsl_ifc.c
@@ -29,8 +29,8 @@
 #include linux/of.h
 #include linux/of_device.h
 #include linux/platform_device.h
+#include linux/fsl_ifc.h
 #include asm/prom.h
-#include asm/fsl_ifc.h
 
 struct fsl_ifc_ctrl *fsl_ifc_ctrl_dev;
 EXPORT_SYMBOL(fsl_ifc_ctrl_dev);
@@ -298,7 +298,11 @@ static struct platform_driver fsl_ifc_ctrl_driver = {
.remove  = fsl_ifc_ctrl_remove,
 };
 
-module_platform_driver(fsl_ifc_ctrl_driver);
+static int __init fsl_ifc_init(void)
+{
+   return platform_driver_register(fsl_ifc_ctrl_driver);
+}
+subsys_initcall(fsl_ifc_init);

[PATCH 2/2][v7] powerpc/config: Enable memory driver

2014-01-27 Thread Prabhakar Kushwaha
As Freescale IFC controller has been moved to driver to driver/memory.

So enable memory driver in powerpc config

Signed-off-by: Prabhakar Kushwaha prabha...@freescale.com
---
 Based upon git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc.git
 Branch next

 Changes for v2: Sending as it is
 Changes for v3: Sending as it is
 Changes for v4: Rebased to 
git://git.kernel.org/pub/scm/linux/kernel/git/scottwood/linux.git
 changes for v5:
- Rebased to branch next of 
git://git.kernel.org/pub/scm/linux/kernel/git/scottwood/linux.git
 Changes for v6: Sending as it is
 Changes for v7: Sending as it is

 arch/powerpc/configs/corenet32_smp_defconfig |1 +
 arch/powerpc/configs/corenet64_smp_defconfig |1 +
 arch/powerpc/configs/mpc85xx_defconfig   |1 +
 arch/powerpc/configs/mpc85xx_smp_defconfig   |1 +
 4 files changed, 4 insertions(+)

diff --git a/arch/powerpc/configs/corenet32_smp_defconfig 
b/arch/powerpc/configs/corenet32_smp_defconfig
index bbd794d..087d437 100644
--- a/arch/powerpc/configs/corenet32_smp_defconfig
+++ b/arch/powerpc/configs/corenet32_smp_defconfig
@@ -142,6 +142,7 @@ CONFIG_RTC_DRV_DS3232=y
 CONFIG_RTC_DRV_CMOS=y
 CONFIG_UIO=y
 CONFIG_STAGING=y
+CONFIG_MEMORY=y
 CONFIG_VIRT_DRIVERS=y
 CONFIG_FSL_HV_MANAGER=y
 CONFIG_EXT2_FS=y
diff --git a/arch/powerpc/configs/corenet64_smp_defconfig 
b/arch/powerpc/configs/corenet64_smp_defconfig
index 63508dd..25b03f8 100644
--- a/arch/powerpc/configs/corenet64_smp_defconfig
+++ b/arch/powerpc/configs/corenet64_smp_defconfig
@@ -129,6 +129,7 @@ CONFIG_EDAC=y
 CONFIG_EDAC_MM_EDAC=y
 CONFIG_DMADEVICES=y
 CONFIG_FSL_DMA=y
+CONFIG_MEMORY=y
 CONFIG_EXT2_FS=y
 CONFIG_EXT3_FS=y
 CONFIG_ISO9660_FS=m
diff --git a/arch/powerpc/configs/mpc85xx_defconfig 
b/arch/powerpc/configs/mpc85xx_defconfig
index 83d3550..cba638c 100644
--- a/arch/powerpc/configs/mpc85xx_defconfig
+++ b/arch/powerpc/configs/mpc85xx_defconfig
@@ -216,6 +216,7 @@ CONFIG_RTC_DRV_CMOS=y
 CONFIG_RTC_DRV_DS1307=y
 CONFIG_DMADEVICES=y
 CONFIG_FSL_DMA=y
+CONFIG_MEMORY=y
 # CONFIG_NET_DMA is not set
 CONFIG_EXT2_FS=y
 CONFIG_EXT3_FS=y
diff --git a/arch/powerpc/configs/mpc85xx_smp_defconfig 
b/arch/powerpc/configs/mpc85xx_smp_defconfig
index 4b68629..e315b8a 100644
--- a/arch/powerpc/configs/mpc85xx_smp_defconfig
+++ b/arch/powerpc/configs/mpc85xx_smp_defconfig
@@ -217,6 +217,7 @@ CONFIG_RTC_DRV_CMOS=y
 CONFIG_RTC_DRV_DS1307=y
 CONFIG_DMADEVICES=y
 CONFIG_FSL_DMA=y
+CONFIG_MEMORY=y
 # CONFIG_NET_DMA is not set
 CONFIG_EXT2_FS=y
 CONFIG_EXT3_FS=y
-- 
1.7.9.5



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


Re: Please pull 'next' branch of 5xxx tree

2014-01-27 Thread Anatolij Gustschin
Hi Ben !

On Wed, 15 Jan 2014 22:18:59 +0100
Anatolij Gustschin ag...@denx.de wrote:

 Hi Ben !
 
 please pull mpc5xxx patches for v3.14:

Ping.

 Switch mpc512x to the common clock framework and adapt mpc512x
 drivers to use the new clock driver. Old PPC_CLOCK code is
 removed entirely since there are no users any more.
 
 All these patches have been in linux-next for more then
 two weeks now.
 
 Thanks,
 Anatolij
 
 The following changes since commit dece8ada993e1764a115bdff0f1eaa5fc8dc:
 
   Merge branch 'merge' into next (2013-12-30 15:19:31 +1100)
 
 are available in the git repository at:
 
 
   git://git.denx.de/linux-2.6-agust.git next
 
 for you to fetch changes up to bc75059422338197ce487d338ac9c898761e1e61:
 
   powerpc/512x: dts: add MPC5125 clock specs (2014-01-12 18:59:50 +0100)
 
 
 Gerhard Sittig (20):
   dts: mpc512x: introduce dt-bindings/clock/ header
   dts: mpc512x: add clock related device tree specs
   clk: mpc512x: introduce COMMON_CLK for MPC512x (disabled)
   clk: mpc512x: add backwards compat to the CCF code
   dts: mpc512x: add clock specs for client lookups
   clk: mpc5xxx: switch to COMMON_CLK, retire PPC_CLOCK
   spi: mpc512x: adjust to OF based clock lookup
   serial: mpc512x: adjust for OF based clock lookup
   serial: mpc512x: setup the PSC FIFO clock as well
   USB: fsl-mph-dr-of: adjust for OF based clock lookup
   mtd: mpc5121_nfc: adjust for OF based clock lookup
   fsl-viu: adjust for OF based clock lookup
   net: can: mscan: adjust to common clock support for mpc512x
   net: can: mscan: remove non-CCF code for MPC512x
   powerpc/mpc512x: improve DIU related clock setup
   clk: mpc512x: remove migration support workarounds
   powerpc/512x: clk: minor comment updates
   powerpc/512x: clk: enforce even SDHC divider values
   powerpc/512x: clk: support MPC5121/5123/5125 SoC variants
   powerpc/512x: dts: add MPC5125 clock specs
 
  arch/powerpc/Kconfig  |5 -
  arch/powerpc/boot/dts/ac14xx.dts  |7 +
  arch/powerpc/boot/dts/mpc5121.dtsi|  113 ++-
  arch/powerpc/boot/dts/mpc5125twr.dts  |   53 +-
  arch/powerpc/include/asm/clk_interface.h  |   20 -
  arch/powerpc/include/asm/mpc5121.h|7 +-
  arch/powerpc/kernel/Makefile  |1 -
  arch/powerpc/kernel/clock.c   |   82 --
  arch/powerpc/platforms/512x/Kconfig   |2 +-
  arch/powerpc/platforms/512x/Makefile  |3 +-
  arch/powerpc/platforms/512x/clock-commonclk.c | 1221 
 +
  arch/powerpc/platforms/512x/clock.c   |  754 ---
  arch/powerpc/platforms/512x/mpc512x_shared.c  |  169 ++--
  arch/powerpc/platforms/52xx/Kconfig   |2 +-
  drivers/media/platform/fsl-viu.c  |2 +-
  drivers/mtd/nand/mpc5121_nfc.c|2 +-
  drivers/net/can/mscan/mpc5xxx_can.c   |  270 +++---
  drivers/spi/spi-mpc512x-psc.c |   26 +-
  drivers/tty/serial/mpc52xx_uart.c |   90 +-
  drivers/usb/host/fsl-mph-dr-of.c  |   13 +-
  include/dt-bindings/clock/mpc512x-clock.h |   76 ++
  include/linux/clk-provider.h  |   16 +
  22 files changed, 1840 insertions(+), 1094 deletions(-)
  delete mode 100644 arch/powerpc/include/asm/clk_interface.h
  delete mode 100644 arch/powerpc/kernel/clock.c
  create mode 100644 arch/powerpc/platforms/512x/clock-commonclk.c
  delete mode 100644 arch/powerpc/platforms/512x/clock.c
  create mode 100644 include/dt-bindings/clock/mpc512x-clock.h
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: Please pull 'next' branch of 5xxx tree

2014-01-27 Thread Benjamin Herrenschmidt
On Tue, 2014-01-28 at 06:46 +0100, Anatolij Gustschin wrote:
 Hi Ben !
 
 On Wed, 15 Jan 2014 22:18:59 +0100
 Anatolij Gustschin ag...@denx.de wrote:
 
  Hi Ben !
  
  please pull mpc5xxx patches for v3.14:
 
 Ping.

Oops, you sent that while I was on vacation and I missed it.

Next time, try to send your pull request earlier if possible, I'd like
to have most stuff together before -rc5. I'll try to send this one to
Linus after he has pulled my current one.

Cheers,
Ben.

  Switch mpc512x to the common clock framework and adapt mpc512x
  drivers to use the new clock driver. Old PPC_CLOCK code is
  removed entirely since there are no users any more.
  
  All these patches have been in linux-next for more then
  two weeks now.
  
  Thanks,
  Anatolij
  
  The following changes since commit dece8ada993e1764a115bdff0f1eaa5fc8dc:
  
Merge branch 'merge' into next (2013-12-30 15:19:31 +1100)
  
  are available in the git repository at:
  
  
git://git.denx.de/linux-2.6-agust.git next
  
  for you to fetch changes up to bc75059422338197ce487d338ac9c898761e1e61:
  
powerpc/512x: dts: add MPC5125 clock specs (2014-01-12 18:59:50 +0100)
  
  
  Gerhard Sittig (20):
dts: mpc512x: introduce dt-bindings/clock/ header
dts: mpc512x: add clock related device tree specs
clk: mpc512x: introduce COMMON_CLK for MPC512x (disabled)
clk: mpc512x: add backwards compat to the CCF code
dts: mpc512x: add clock specs for client lookups
clk: mpc5xxx: switch to COMMON_CLK, retire PPC_CLOCK
spi: mpc512x: adjust to OF based clock lookup
serial: mpc512x: adjust for OF based clock lookup
serial: mpc512x: setup the PSC FIFO clock as well
USB: fsl-mph-dr-of: adjust for OF based clock lookup
mtd: mpc5121_nfc: adjust for OF based clock lookup
fsl-viu: adjust for OF based clock lookup
net: can: mscan: adjust to common clock support for mpc512x
net: can: mscan: remove non-CCF code for MPC512x
powerpc/mpc512x: improve DIU related clock setup
clk: mpc512x: remove migration support workarounds
powerpc/512x: clk: minor comment updates
powerpc/512x: clk: enforce even SDHC divider values
powerpc/512x: clk: support MPC5121/5123/5125 SoC variants
powerpc/512x: dts: add MPC5125 clock specs
  
   arch/powerpc/Kconfig  |5 -
   arch/powerpc/boot/dts/ac14xx.dts  |7 +
   arch/powerpc/boot/dts/mpc5121.dtsi|  113 ++-
   arch/powerpc/boot/dts/mpc5125twr.dts  |   53 +-
   arch/powerpc/include/asm/clk_interface.h  |   20 -
   arch/powerpc/include/asm/mpc5121.h|7 +-
   arch/powerpc/kernel/Makefile  |1 -
   arch/powerpc/kernel/clock.c   |   82 --
   arch/powerpc/platforms/512x/Kconfig   |2 +-
   arch/powerpc/platforms/512x/Makefile  |3 +-
   arch/powerpc/platforms/512x/clock-commonclk.c | 1221 
  +
   arch/powerpc/platforms/512x/clock.c   |  754 ---
   arch/powerpc/platforms/512x/mpc512x_shared.c  |  169 ++--
   arch/powerpc/platforms/52xx/Kconfig   |2 +-
   drivers/media/platform/fsl-viu.c  |2 +-
   drivers/mtd/nand/mpc5121_nfc.c|2 +-
   drivers/net/can/mscan/mpc5xxx_can.c   |  270 +++---
   drivers/spi/spi-mpc512x-psc.c |   26 +-
   drivers/tty/serial/mpc52xx_uart.c |   90 +-
   drivers/usb/host/fsl-mph-dr-of.c  |   13 +-
   include/dt-bindings/clock/mpc512x-clock.h |   76 ++
   include/linux/clk-provider.h  |   16 +
   22 files changed, 1840 insertions(+), 1094 deletions(-)
   delete mode 100644 arch/powerpc/include/asm/clk_interface.h
   delete mode 100644 arch/powerpc/kernel/clock.c
   create mode 100644 arch/powerpc/platforms/512x/clock-commonclk.c
   delete mode 100644 arch/powerpc/platforms/512x/clock.c
   create mode 100644 include/dt-bindings/clock/mpc512x-clock.h


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


Re: Pull request: scottwood/linux.git

2014-01-27 Thread Anatolij Gustschin
Hi Ben !

On Fri, 17 Jan 2014 19:22:36 -0600
Scott Wood scottw...@freescale.com wrote:

 This contains a fix for a chroma_defconfig build break that was
 introduced by e6500 tablewalk support, and a device tree binding patch
 that missed the previous pull request due to some last-minute polishing.

this one is still pending, too.

Thanks,

Anatolij

 The following changes since commit fac515db45207718168cb55ca4d0a390e43b61af:
 
   Merge remote-tracking branch 'scott/next' into next (2014-01-15 14:22:35 
 +1100)
 
 are available in the git repository at:
 
 
   git://git.kernel.org/pub/scm/linux/kernel/git/scottwood/linux.git next
 
 for you to fetch changes up to 4b3cbc82a04485f6400cb5b227798daaa8512a23:
 
   clk: corenet: Adds the clock binding (2014-01-17 19:01:27 -0600)
 
 
 Scott Wood (1):
   powerpc/booke64: Guard e6500 tlb handler with CONFIG_PPC_FSL_BOOK3E
 
 Tang Yuantian (1):
   clk: corenet: Adds the clock binding
 
  .../devicetree/bindings/clock/corenet-clock.txt| 134 
 +
  arch/powerpc/Kconfig   |   1 +
  arch/powerpc/mm/tlb_low_64e.S  |   3 +-
  arch/powerpc/mm/tlb_nohash.c   |   2 +
  4 files changed, 139 insertions(+), 1 deletion(-)
  create mode 100644 Documentation/devicetree/bindings/clock/corenet-clock.txt
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: Please pull 'next' branch of 5xxx tree

2014-01-27 Thread Anatolij Gustschin
On Tue, 28 Jan 2014 17:00:14 +1100
Benjamin Herrenschmidt b...@kernel.crashing.org wrote:

 On Tue, 2014-01-28 at 06:46 +0100, Anatolij Gustschin wrote:
  Hi Ben !
  
  On Wed, 15 Jan 2014 22:18:59 +0100
  Anatolij Gustschin ag...@denx.de wrote:
  
   Hi Ben !
   
   please pull mpc5xxx patches for v3.14:
  
  Ping.
 
 Oops, you sent that while I was on vacation and I missed it.
 
 Next time, try to send your pull request earlier if possible, I'd like
 to have most stuff together before -rc5. I'll try to send this one to
 Linus after he has pulled my current one.

Okay, I'll try to send it earlier next time.

Thanks,

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


[PATCH V3] POWERPC: BOOK3S: KVM: Use the saved dsisr and dar values on book3s 64

2014-01-27 Thread Aneesh Kumar K.V
Although it's optional IBM POWER cpus always had DAR value set on
alignment interrupt. So don't try to compute these values.

Signed-off-by: Aneesh Kumar K.V aneesh.ku...@linux.vnet.ibm.com
---
Changes from V2:
* Depend on cpu feature flag to decide whether to use fault_dsir or not

 arch/powerpc/include/asm/cputable.h|  1 +
 arch/powerpc/include/asm/disassemble.h | 34 +
 arch/powerpc/kernel/align.c| 34 +
 arch/powerpc/kernel/cputable.c | 15 +++-
 arch/powerpc/kvm/book3s_emulate.c  | 69 --
 5 files changed, 82 insertions(+), 71 deletions(-)

diff --git a/arch/powerpc/include/asm/cputable.h 
b/arch/powerpc/include/asm/cputable.h
index 0d4939ba48e7..1922dce6124d 100644
--- a/arch/powerpc/include/asm/cputable.h
+++ b/arch/powerpc/include/asm/cputable.h
@@ -555,6 +555,7 @@ static inline int cpu_has_feature(unsigned long feature)
 }
 
 #define HBP_NUM 1
+extern struct cpu_spec *find_cpuspec(unsigned int pvr);
 
 #endif /* !__ASSEMBLY__ */
 
diff --git a/arch/powerpc/include/asm/disassemble.h 
b/arch/powerpc/include/asm/disassemble.h
index 856f8deb557a..6330a61b875a 100644
--- a/arch/powerpc/include/asm/disassemble.h
+++ b/arch/powerpc/include/asm/disassemble.h
@@ -81,4 +81,38 @@ static inline unsigned int get_oc(u32 inst)
 {
return (inst  11)  0x7fff;
 }
+
+#define IS_XFORM(inst) (get_op(inst)  == 31)
+#define IS_DSFORM(inst)(get_op(inst) = 56)
+
+/*
+ * Create a DSISR value from the instruction
+ */
+static inline unsigned make_dsisr(unsigned instr)
+{
+   unsigned dsisr;
+
+
+   /* bits  6:15 -- 22:31 */
+   dsisr = (instr  0x03ff)  16;
+
+   if (IS_XFORM(instr)) {
+   /* bits 29:30 -- 15:16 */
+   dsisr |= (instr  0x0006)  14;
+   /* bit 25 --17 */
+   dsisr |= (instr  0x0040)  8;
+   /* bits 21:24 -- 18:21 */
+   dsisr |= (instr  0x0780)  3;
+   } else {
+   /* bit  5 --17 */
+   dsisr |= (instr  0x0400)  12;
+   /* bits  1: 4 -- 18:21 */
+   dsisr |= (instr  0x7800)  17;
+   /* bits 30:31 -- 12:13 */
+   if (IS_DSFORM(instr))
+   dsisr |= (instr  0x0003)  18;
+   }
+
+   return dsisr;
+}
 #endif /* __ASM_PPC_DISASSEMBLE_H__ */
diff --git a/arch/powerpc/kernel/align.c b/arch/powerpc/kernel/align.c
index de91f3ae631e..111d93ec7f34 100644
--- a/arch/powerpc/kernel/align.c
+++ b/arch/powerpc/kernel/align.c
@@ -25,14 +25,13 @@
 #include asm/cputable.h
 #include asm/emulated_ops.h
 #include asm/switch_to.h
+#include asm/disassemble.h
 
 struct aligninfo {
unsigned char len;
unsigned char flags;
 };
 
-#define IS_XFORM(inst) (((inst)  26) == 31)
-#define IS_DSFORM(inst)(((inst)  26) = 56)
 
 #define INVALID{ 0, 0 }
 
@@ -192,37 +191,6 @@ static struct aligninfo aligninfo[128] = {
 };
 
 /*
- * Create a DSISR value from the instruction
- */
-static inline unsigned make_dsisr(unsigned instr)
-{
-   unsigned dsisr;
-
-
-   /* bits  6:15 -- 22:31 */
-   dsisr = (instr  0x03ff)  16;
-
-   if (IS_XFORM(instr)) {
-   /* bits 29:30 -- 15:16 */
-   dsisr |= (instr  0x0006)  14;
-   /* bit 25 --17 */
-   dsisr |= (instr  0x0040)  8;
-   /* bits 21:24 -- 18:21 */
-   dsisr |= (instr  0x0780)  3;
-   } else {
-   /* bit  5 --17 */
-   dsisr |= (instr  0x0400)  12;
-   /* bits  1: 4 -- 18:21 */
-   dsisr |= (instr  0x7800)  17;
-   /* bits 30:31 -- 12:13 */
-   if (IS_DSFORM(instr))
-   dsisr |= (instr  0x0003)  18;
-   }
-
-   return dsisr;
-}
-
-/*
  * The dcbz (data cache block zero) instruction
  * gives an alignment fault if used on non-cacheable
  * memory.  We handle the fault mainly for the
diff --git a/arch/powerpc/kernel/cputable.c b/arch/powerpc/kernel/cputable.c
index 597d954e5860..b367f5b772f6 100644
--- a/arch/powerpc/kernel/cputable.c
+++ b/arch/powerpc/kernel/cputable.c
@@ -116,7 +116,7 @@ extern void __restore_cpu_e6500(void);
 PPC_FEATURE_BOOKE)
 #endif
 
-static struct cpu_spec __initdata cpu_specs[] = {
+static struct cpu_spec cpu_specs[] = {
 #ifdef CONFIG_PPC_BOOK3S_64
{   /* Power3 */
.pvr_mask   = 0x,
@@ -2258,3 +2258,16 @@ struct cpu_spec * __init identify_cpu(unsigned long 
offset, unsigned int pvr)
 
return NULL;
 }
+
+struct cpu_spec *find_cpuspec(unsigned int pvr)
+{
+   int i;
+   struct cpu_spec *s = cpu_specs;
+
+   for (i = 0; i  ARRAY_SIZE(cpu_specs); i++, s++) {
+   if ((pvr  s-pvr_mask) == s-pvr_value)
+   return s;
+   }
+   return NULL;
+}

[PATCH V3] KVM: PPC: BOOK3S: PR: Enable Little Endian PR guest

2014-01-27 Thread Aneesh Kumar K.V
This patch make sure we inherit the LE bit correctly in different case
so that we can run Little Endian distro in PR mode

Signed-off-by: Aneesh Kumar K.V aneesh.ku...@linux.vnet.ibm.com
---
Changes from V2:
 * Move H_SET_MODE to qemu


 arch/powerpc/include/asm/kvm_host.h |  1 +
 arch/powerpc/kernel/asm-offsets.c   |  1 +
 arch/powerpc/kvm/book3s_64_mmu.c|  2 +-
 arch/powerpc/kvm/book3s_pr.c| 32 +++-
 4 files changed, 34 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/include/asm/kvm_host.h 
b/arch/powerpc/include/asm/kvm_host.h
index 207b7826c9b1..f4be7be14330 100644
--- a/arch/powerpc/include/asm/kvm_host.h
+++ b/arch/powerpc/include/asm/kvm_host.h
@@ -550,6 +550,7 @@ struct kvm_vcpu_arch {
 #ifdef CONFIG_PPC_BOOK3S
ulong fault_dar;
u32 fault_dsisr;
+   unsigned long intr_msr;
 #endif
 
 #ifdef CONFIG_BOOKE
diff --git a/arch/powerpc/kernel/asm-offsets.c 
b/arch/powerpc/kernel/asm-offsets.c
index b754f629a177..7484676b8f25 100644
--- a/arch/powerpc/kernel/asm-offsets.c
+++ b/arch/powerpc/kernel/asm-offsets.c
@@ -518,6 +518,7 @@ int main(void)
DEFINE(VCPU_SLB_NR, offsetof(struct kvm_vcpu, arch.slb_nr));
DEFINE(VCPU_FAULT_DSISR, offsetof(struct kvm_vcpu, arch.fault_dsisr));
DEFINE(VCPU_FAULT_DAR, offsetof(struct kvm_vcpu, arch.fault_dar));
+   DEFINE(VCPU_INTR_MSR, offsetof(struct kvm_vcpu, arch.intr_msr));
DEFINE(VCPU_LAST_INST, offsetof(struct kvm_vcpu, arch.last_inst));
DEFINE(VCPU_TRAP, offsetof(struct kvm_vcpu, arch.trap));
DEFINE(VCPU_PTID, offsetof(struct kvm_vcpu, arch.ptid));
diff --git a/arch/powerpc/kvm/book3s_64_mmu.c b/arch/powerpc/kvm/book3s_64_mmu.c
index 83da1f868fd5..8231b83c493b 100644
--- a/arch/powerpc/kvm/book3s_64_mmu.c
+++ b/arch/powerpc/kvm/book3s_64_mmu.c
@@ -38,7 +38,7 @@
 
 static void kvmppc_mmu_book3s_64_reset_msr(struct kvm_vcpu *vcpu)
 {
-   kvmppc_set_msr(vcpu, MSR_SF);
+   kvmppc_set_msr(vcpu, vcpu-arch.intr_msr);
 }
 
 static struct kvmppc_slb *kvmppc_mmu_book3s_64_find_slbe(
diff --git a/arch/powerpc/kvm/book3s_pr.c b/arch/powerpc/kvm/book3s_pr.c
index eb070eb4da40..828056ec208f 100644
--- a/arch/powerpc/kvm/book3s_pr.c
+++ b/arch/powerpc/kvm/book3s_pr.c
@@ -263,7 +263,7 @@ static void kvmppc_recalc_shadow_msr(struct kvm_vcpu *vcpu)
ulong smsr = vcpu-arch.shared-msr;
 
/* Guest MSR values */
-   smsr = MSR_FE0 | MSR_FE1 | MSR_SF | MSR_SE | MSR_BE;
+   smsr = MSR_FE0 | MSR_FE1 | MSR_SF | MSR_SE | MSR_BE | MSR_LE;
/* Process MSR values */
smsr |= MSR_ME | MSR_RI | MSR_IR | MSR_DR | MSR_PR | MSR_EE;
/* External providers the guest reserved */
@@ -1178,6 +1178,15 @@ static int kvmppc_get_one_reg_pr(struct kvm_vcpu *vcpu, 
u64 id,
break;
}
 #endif /* CONFIG_VSX */
+   case KVM_REG_PPC_LPCR:
+   /*
+* We are only interested in the LPCR_ILE bit
+*/
+   if (vcpu-arch.intr_msr  MSR_LE)
+   *val = get_reg_val(id, LPCR_ILE);
+   else
+   *val = get_reg_val(id, 0);
+   break;
default:
r = -EINVAL;
break;
@@ -1186,6 +1195,23 @@ static int kvmppc_get_one_reg_pr(struct kvm_vcpu *vcpu, 
u64 id,
return r;
 }
 
+static void kvmppc_set_lpcr_pr(struct kvm_vcpu *vcpu, u64 new_lpcr)
+{
+   struct kvm *kvm = vcpu-kvm;
+   /*
+* If ILE (interrupt little-endian) has changed, update the
+* MSR_LE bit in the intr_msr for each vcpu in this vcore.
+*/
+   if ((new_lpcr  LPCR_ILE) != (vcpu-arch.intr_msr  MSR_LE)) {
+   mutex_lock(kvm-lock);
+   if (new_lpcr  LPCR_ILE)
+   vcpu-arch.intr_msr |= MSR_LE;
+   else
+   vcpu-arch.intr_msr = ~MSR_LE;
+   mutex_unlock(kvm-lock);
+   }
+}
+
 static int kvmppc_set_one_reg_pr(struct kvm_vcpu *vcpu, u64 id,
 union kvmppc_one_reg *val)
 {
@@ -1209,6 +1235,9 @@ static int kvmppc_set_one_reg_pr(struct kvm_vcpu *vcpu, 
u64 id,
break;
}
 #endif /* CONFIG_VSX */
+   case KVM_REG_PPC_LPCR:
+   kvmppc_set_lpcr_pr(vcpu, set_reg_val(id, *val));
+   break;
default:
r = -EINVAL;
break;
@@ -1261,6 +1290,7 @@ static struct kvm_vcpu *kvmppc_core_vcpu_create_pr(struct 
kvm *kvm,
vcpu-arch.pvr = 0x3C0301;
if (mmu_has_feature(MMU_FTR_1T_SEGMENT))
vcpu-arch.pvr = mfspr(SPRN_PVR);
+   vcpu-arch.intr_msr = MSR_SF;
 #else
/* default to book3s_32 (750) */
vcpu-arch.pvr = 0x84202;
-- 
1.8.5.3

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