LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH] cpuidle/powernv: Populate cpuidle state details by querying the device-tree
From: Lorenzo Pieralisi @ 2014-10-24 14:30 UTC (permalink / raw)
  To: Preeti U Murthy
  Cc: linux-pm@vger.kernel.org, rjw@rjwysocki.net,
	shreyas@linux.vnet.ibm.com, linuxppc-dev@lists.ozlabs.org
In-Reply-To: <20141014075259.11810.50996.stgit@preeti.in.ibm.com>

On Tue, Oct 14, 2014 at 08:53:00AM +0100, Preeti U Murthy wrote:
> We hard code the metrics relevant for cpuidle states in the kernel today.
> Instead pick them up from the device tree so that they remain relevant
> and updated for the system that the kernel is running on.
> 
> Cc: linux-pm@vger.kernel.org
> Cc: Rafael J. Wysocki <rjw@rjwysocki.net>
> Cc: devicetree@vger.kernel.org
> Cc: linuxppc-dev@lists.ozlabs.org
> Cc: Michael Ellerman <mpe@ellerman.id.au>
> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> Signed-off-by: Preeti U. Murthy <preeti@linux.vnet.ibm.com>
> Signed-off-by: Shreyas B. Prabhu <shreyas@linux.vnet.ibm.com>
> ---
> 
>  drivers/cpuidle/cpuidle-powernv.c |   27 ++++++++++++++++++++++-----
>  1 file changed, 22 insertions(+), 5 deletions(-)

Device tree properties should be documented, and these bindings are
getting very similar to the ones I have just completed for ARM,
I wonder whether we should take the generic bits out of ARM bindings (ie
exit_latency) and make those available to other architectures.

Thanks,
Lorenzo

> 
> diff --git a/drivers/cpuidle/cpuidle-powernv.c b/drivers/cpuidle/cpuidle-powernv.c
> index fa79392..b57681d 100644
> --- a/drivers/cpuidle/cpuidle-powernv.c
> +++ b/drivers/cpuidle/cpuidle-powernv.c
> @@ -165,7 +165,8 @@ static int powernv_add_idle_states(void)
>  	int nr_idle_states = 1; /* Snooze */
>  	int dt_idle_states;
>  	const __be32 *idle_state_flags;
> -	u32 len_flags, flags;
> +	const __be32 *idle_state_latency;
> +	u32 len_flags, flags, latency_ns;
>  	int i;
>  
>  	/* Currently we have snooze statically defined */
> @@ -182,18 +183,32 @@ static int powernv_add_idle_states(void)
>  		return nr_idle_states;
>  	}
>  
> +	idle_state_latency = of_get_property(power_mgt,
> +			"ibm,cpu-idle-state-latencies-ns", NULL);
> +	if (!idle_state_latency) {
> +		pr_warn("DT-PowerMgmt: missing ibm,cpu-idle-state-latencies-ns\n");
> +		return nr_idle_states;
> +	}
> +
>  	dt_idle_states = len_flags / sizeof(u32);
>  
>  	for (i = 0; i < dt_idle_states; i++) {
>  
>  		flags = be32_to_cpu(idle_state_flags[i]);
> +
> +		/* Cpuidle accepts exit_latency in us and we estimate
> +		 * target residency to be 10x exit_latency
> +		 */
> +		latency_ns = be32_to_cpu(idle_state_latency[i]);
>  		if (flags & IDLE_USE_INST_NAP) {
>  			/* Add NAP state */
>  			strcpy(powernv_states[nr_idle_states].name, "Nap");
>  			strcpy(powernv_states[nr_idle_states].desc, "Nap");
>  			powernv_states[nr_idle_states].flags = CPUIDLE_FLAG_TIME_VALID;
> -			powernv_states[nr_idle_states].exit_latency = 10;
> -			powernv_states[nr_idle_states].target_residency = 100;
> +			powernv_states[nr_idle_states].exit_latency =
> +					((unsigned int)latency_ns) / 1000;
> +			powernv_states[nr_idle_states].target_residency =
> +					((unsigned int)latency_ns / 100);
>  			powernv_states[nr_idle_states].enter = &nap_loop;
>  			nr_idle_states++;
>  		}
> @@ -204,8 +219,10 @@ static int powernv_add_idle_states(void)
>  			strcpy(powernv_states[nr_idle_states].desc, "FastSleep");
>  			powernv_states[nr_idle_states].flags =
>  				CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_TIMER_STOP;
> -			powernv_states[nr_idle_states].exit_latency = 300;
> -			powernv_states[nr_idle_states].target_residency = 1000000;
> +			powernv_states[nr_idle_states].exit_latency =
> +					((unsigned int)latency_ns) / 1000;
> +			powernv_states[nr_idle_states].target_residency =
> +					((unsigned int)latency_ns / 100);
>  			powernv_states[nr_idle_states].enter = &fastsleep_loop;
>  			nr_idle_states++;
>  		}
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-pm" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

^ permalink raw reply

* Re: [PATCH] ucc_geth: invalid rx checksum error values
From: Jianhua Xie @ 2014-10-24 12:11 UTC (permalink / raw)
  To: Kokoris, Ioannis, linux-kernel@vger.kernel.org,
	linuxppc-dev@lists.ozlabs.org
  Cc: Zhao Qiang, netdev, Timur Tabi
In-Reply-To: <FDB831DFAAC88B42A50BA37D1BC5E13A29C63D1F@MCHP03MSX.global-ad.net>

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

Hi Ioannis ,

Thank you very much for finding and reporting the issue.
I help to broadcast to netdev mailing-list.

Thanks & Best Regards,
Jianhua

在 2014年10月22日 21:07, Kokoris, Ioannis 写道:
> Hi,
>
> The value in QE UCC ethernet interfaces shows random values:
>
> # ethtool -S eth0
> NIC statistics:
>       ...
>       rx-ip-checksum-errors: 3933892214
>
> The problem is located in a mismatch between the rx_fw_stat_gstrings fields
> - used in ucc_geth_ethtool - and the ucc_geth_rx_firmware_statistics_pram
> fields - used in ucc_geth.
> Although the QE UCC Ethernet Controller includes the Rx checksum error
> counter in the 'Rx firmware counters', the related field is missing from the
> ucc_geth driver.
> After adding the RxChecksumError field in
> ucc_geth_rx_firmware_statistics_pram structure the counter works fine.
>
>
>
> Signed-off-by: Ioannis Kokkoris <ioannis.kokoris@unify.com>
>
>
> diff -Nru a/drivers/net/ethernet/freescale/ucc_geth.h
> b/drivers/net/ethernet/freescale/ucc_geth.h
> --- a/drivers/net/ethernet/freescale/ucc_geth.h 2014-10-22
> 15:19:16.000000000 +0300
> +++ b/drivers/net/ethernet/freescale/ucc_geth.h 2014-10-22
> 15:24:39.000000000 +0300
> @@ -541,6 +541,8 @@
>                                     replaced */
>          u32 insertvlan;         /* total frames that had their VLAN tag
>                                     inserted */
> +       u32 checksumerr;        /* total frames that have IP Checksum Error
> +                                */
>   } __packed;
>
>   struct ucc_geth_rx_interrupt_coalescing_entry {
>
>
>
> Best Regards,
> Ioannis
>
>
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev


[-- Attachment #2: Type: text/html, Size: 2488 bytes --]

^ permalink raw reply

* Re: [PATCH v2 08/47] kernel: Move pm_power_off to common code
From: Lennox Wu @ 2014-10-24 10:03 UTC (permalink / raw)
  Cc: linux-mips@linux-mips.org, linux-ia64@vger.kernel.org, linux-sh,
	linux@lists.openrisc.net, sparclinux@vger.kernel.org,
	linux-s390@vger.kernel.org, linux-am33-list@redhat.com,
	linux-c6x-dev@linux-c6x.org, linux-hexagon@vger.kernel.org,
	x86@kernel.org, xen-devel, linux-xtensa@linux-xtensa.org,
	user-mode-linux-devel@lists.sourceforge.net, linux-pm,
	adi-buildroot-devel@lists.sourceforge.net,
	linux-m68k@lists.linux-m68k.org,
	user-mode-linux-user@lists.sourceforge.net,
	linux-metag@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-parisc@vger.kernel.org, linux-cris-kernel@axis.com,
	open list, linux-alpha@vger.kernel.org, linux390@de.ibm.com,
	linuxppc-dev@lists.ozlabs.org
In-Reply-To: <1413864783-3271-9-git-send-email-linux@roeck-us.net>

Acked-by: Lennox Wu <lennox.wu@gmail.com>

2014-10-21 12:12 GMT+08:00 Guenter Roeck <linux@roeck-us.net>:
> pm_power_off is defined for all architectures. Move it to common code.
>
> Have all architectures call do_kernel_power_off instead of pm_power_off.
> Some architectures point pm_power_off to machine_power_off. For those,
> call do_kernel_power_off from machine_power_off instead.
>
> Acked-by: David Vrabel <david.vrabel@citrix.com>
> Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
> Acked-by: Hirokazu Takata <takata@linux-m32r.org>
> Acked-by: Jesper Nilsson <jesper.nilsson@axis.com>
> Acked-by: Max Filippov <jcmvbkbc@gmail.com>
> Acked-by: Rafael J. Wysocki <rjw@rjwysocki.net>
> Acked-by: Richard Weinberger <richard@nod.at>
> Acked-by: Xuetao Guan <gxt@mprc.pku.edu.cn>
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
> ---
> v2:
> - do_kernel_poweroff -> do_kernel_power_off
> - have_kernel_poweroff -> have_kernel_power_off
>
>  arch/alpha/kernel/process.c        |  9 +++------
>  arch/arc/kernel/reset.c            |  5 +----
>  arch/arm/kernel/process.c          |  5 +----
>  arch/arm64/kernel/process.c        |  5 +----
>  arch/avr32/kernel/process.c        |  6 +-----
>  arch/blackfin/kernel/process.c     |  3 ---
>  arch/blackfin/kernel/reboot.c      |  2 ++
>  arch/c6x/kernel/process.c          |  9 +--------
>  arch/cris/kernel/process.c         |  4 +---
>  arch/frv/kernel/process.c          |  5 ++---
>  arch/hexagon/kernel/reset.c        |  5 ++---
>  arch/ia64/kernel/process.c         |  5 +----
>  arch/m32r/kernel/process.c         |  8 ++++----
>  arch/m68k/kernel/process.c         |  6 +-----
>  arch/metag/kernel/process.c        |  6 +-----
>  arch/microblaze/kernel/process.c   |  3 ---
>  arch/microblaze/kernel/reset.c     |  1 +
>  arch/mips/kernel/reset.c           |  6 +-----
>  arch/mn10300/kernel/process.c      |  8 ++------
>  arch/openrisc/kernel/process.c     |  8 +++++---
>  arch/parisc/kernel/process.c       |  8 ++++----
>  arch/powerpc/kernel/setup-common.c |  6 +++---
>  arch/s390/kernel/setup.c           |  8 ++------
>  arch/score/kernel/process.c        |  8 ++++----
>  arch/sh/kernel/reboot.c            |  6 +-----
>  arch/sparc/kernel/process_32.c     | 10 ++--------
>  arch/sparc/kernel/reboot.c         |  8 ++------
>  arch/tile/kernel/reboot.c          |  7 +++----
>  arch/um/kernel/reboot.c            |  2 --
>  arch/unicore32/kernel/process.c    |  9 +--------
>  arch/x86/kernel/reboot.c           | 11 +++--------
>  arch/x86/xen/enlighten.c           |  3 +--
>  arch/xtensa/kernel/process.c       |  4 ----
>  drivers/parisc/power.c             |  3 +--
>  kernel/power/poweroff_handler.c    |  8 ++++++++
>  kernel/reboot.c                    |  4 ++--
>  36 files changed, 68 insertions(+), 146 deletions(-)
>
> diff --git a/arch/alpha/kernel/process.c b/arch/alpha/kernel/process.c
> index 1941a07..81c43f8 100644
> --- a/arch/alpha/kernel/process.c
> +++ b/arch/alpha/kernel/process.c
> @@ -24,6 +24,7 @@
>  #include <linux/vt.h>
>  #include <linux/mman.h>
>  #include <linux/elfcore.h>
> +#include <linux/pm.h>
>  #include <linux/reboot.h>
>  #include <linux/tty.h>
>  #include <linux/console.h>
> @@ -40,12 +41,6 @@
>  #include "proto.h"
>  #include "pci_impl.h"
>
> -/*
> - * Power off function, if any
> - */
> -void (*pm_power_off)(void) = machine_power_off;
> -EXPORT_SYMBOL(pm_power_off);
> -
>  #ifdef CONFIG_ALPHA_WTINT
>  /*
>   * Sleep the CPU.
> @@ -184,6 +179,8 @@ machine_halt(void)
>  void
>  machine_power_off(void)
>  {
> +       do_kernel_power_off();
> +
>         common_shutdown(LINUX_REBOOT_CMD_POWER_OFF, NULL);
>  }
>
> diff --git a/arch/arc/kernel/reset.c b/arch/arc/kernel/reset.c
> index 2768fa1..0758d9d 100644
> --- a/arch/arc/kernel/reset.c
> +++ b/arch/arc/kernel/reset.c
> @@ -26,9 +26,6 @@ void machine_restart(char *__unused)
>
>  void machine_power_off(void)
>  {
> -       /* FIXME ::  power off ??? */
> +       do_kernel_power_off();
>         machine_halt();
>  }
> -
> -void (*pm_power_off) (void) = NULL;
> -EXPORT_SYMBOL(pm_power_off);
> diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c
> index fe972a2..aa3f656 100644
> --- a/arch/arm/kernel/process.c
> +++ b/arch/arm/kernel/process.c
> @@ -117,8 +117,6 @@ void soft_restart(unsigned long addr)
>  /*
>   * Function pointers to optional machine specific functions
>   */
> -void (*pm_power_off)(void);
> -EXPORT_SYMBOL(pm_power_off);
>
>  void (*arm_pm_restart)(enum reboot_mode reboot_mode, const char *cmd);
>
> @@ -205,8 +203,7 @@ void machine_power_off(void)
>         local_irq_disable();
>         smp_send_stop();
>
> -       if (pm_power_off)
> -               pm_power_off();
> +       do_kernel_power_off();
>  }
>
>  /*
> diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c
> index c3065db..46a483a 100644
> --- a/arch/arm64/kernel/process.c
> +++ b/arch/arm64/kernel/process.c
> @@ -68,8 +68,6 @@ void soft_restart(unsigned long addr)
>  /*
>   * Function pointers to optional machine specific functions
>   */
> -void (*pm_power_off)(void);
> -EXPORT_SYMBOL_GPL(pm_power_off);
>
>  void (*arm_pm_restart)(enum reboot_mode reboot_mode, const char *cmd);
>
> @@ -129,8 +127,7 @@ void machine_power_off(void)
>  {
>         local_irq_disable();
>         smp_send_stop();
> -       if (pm_power_off)
> -               pm_power_off();
> +       do_kernel_power_off();
>  }
>
>  /*
> diff --git a/arch/avr32/kernel/process.c b/arch/avr32/kernel/process.c
> index 42a53e74..529c1f6 100644
> --- a/arch/avr32/kernel/process.c
> +++ b/arch/avr32/kernel/process.c
> @@ -23,9 +23,6 @@
>
>  #include <mach/pm.h>
>
> -void (*pm_power_off)(void);
> -EXPORT_SYMBOL(pm_power_off);
> -
>  /*
>   * This file handles the architecture-dependent parts of process handling..
>   */
> @@ -48,8 +45,7 @@ void machine_halt(void)
>
>  void machine_power_off(void)
>  {
> -       if (pm_power_off)
> -               pm_power_off();
> +       do_kernel_power_off();
>  }
>
>  void machine_restart(char *cmd)
> diff --git a/arch/blackfin/kernel/process.c b/arch/blackfin/kernel/process.c
> index 4aa5545..812dd83 100644
> --- a/arch/blackfin/kernel/process.c
> +++ b/arch/blackfin/kernel/process.c
> @@ -39,9 +39,6 @@ int nr_l1stack_tasks;
>  void *l1_stack_base;
>  unsigned long l1_stack_len;
>
> -void (*pm_power_off)(void) = NULL;
> -EXPORT_SYMBOL(pm_power_off);
> -
>  /*
>   * The idle loop on BFIN
>   */
> diff --git a/arch/blackfin/kernel/reboot.c b/arch/blackfin/kernel/reboot.c
> index c4f50a3..387d610 100644
> --- a/arch/blackfin/kernel/reboot.c
> +++ b/arch/blackfin/kernel/reboot.c
> @@ -7,6 +7,7 @@
>   */
>
>  #include <linux/interrupt.h>
> +#include <linux/pm.h>
>  #include <asm/bfin-global.h>
>  #include <asm/reboot.h>
>  #include <asm/bfrom.h>
> @@ -106,6 +107,7 @@ void machine_halt(void)
>  __attribute__((weak))
>  void native_machine_power_off(void)
>  {
> +       do_kernel_power_off();
>         idle_with_irq_disabled();
>  }
>
> diff --git a/arch/c6x/kernel/process.c b/arch/c6x/kernel/process.c
> index 57d2ea8..edf7e5a 100644
> --- a/arch/c6x/kernel/process.c
> +++ b/arch/c6x/kernel/process.c
> @@ -27,12 +27,6 @@ void (*c6x_halt)(void);
>  extern asmlinkage void ret_from_fork(void);
>  extern asmlinkage void ret_from_kernel_thread(void);
>
> -/*
> - * power off function, if any
> - */
> -void (*pm_power_off)(void);
> -EXPORT_SYMBOL(pm_power_off);
> -
>  void arch_cpu_idle(void)
>  {
>         unsigned long tmp;
> @@ -73,8 +67,7 @@ void machine_halt(void)
>
>  void machine_power_off(void)
>  {
> -       if (pm_power_off)
> -               pm_power_off();
> +       do_kernel_power_off();
>         halt_loop();
>  }
>
> diff --git a/arch/cris/kernel/process.c b/arch/cris/kernel/process.c
> index b78498e..9ebd76b 100644
> --- a/arch/cris/kernel/process.c
> +++ b/arch/cris/kernel/process.c
> @@ -31,9 +31,6 @@
>
>  extern void default_idle(void);
>
> -void (*pm_power_off)(void);
> -EXPORT_SYMBOL(pm_power_off);
> -
>  void arch_cpu_idle(void)
>  {
>         default_idle();
> @@ -60,6 +57,7 @@ void machine_halt(void)
>
>  void machine_power_off(void)
>  {
> +       do_kernel_power_off();
>  }
>
>  /*
> diff --git a/arch/frv/kernel/process.c b/arch/frv/kernel/process.c
> index 5d40aeb77..502dabb 100644
> --- a/arch/frv/kernel/process.c
> +++ b/arch/frv/kernel/process.c
> @@ -42,9 +42,6 @@ asmlinkage void ret_from_kernel_thread(void);
>
>  #include <asm/pgalloc.h>
>
> -void (*pm_power_off)(void);
> -EXPORT_SYMBOL(pm_power_off);
> -
>  static void core_sleep_idle(void)
>  {
>  #ifdef LED_DEBUG_SLEEP
> @@ -107,6 +104,8 @@ void machine_power_off(void)
>         gdbstub_exit(0);
>  #endif
>
> +       do_kernel_power_off();
> +
>         for (;;);
>  }
>
> diff --git a/arch/hexagon/kernel/reset.c b/arch/hexagon/kernel/reset.c
> index 76483c1..6f607b6 100644
> --- a/arch/hexagon/kernel/reset.c
> +++ b/arch/hexagon/kernel/reset.c
> @@ -16,11 +16,13 @@
>   * 02110-1301, USA.
>   */
>
> +#include <linux/pm.h>
>  #include <linux/smp.h>
>  #include <asm/hexagon_vm.h>
>
>  void machine_power_off(void)
>  {
> +       do_kernel_power_off();
>         smp_send_stop();
>         __vmstop();
>  }
> @@ -32,6 +34,3 @@ void machine_halt(void)
>  void machine_restart(char *cmd)
>  {
>  }
> -
> -void (*pm_power_off)(void) = NULL;
> -EXPORT_SYMBOL(pm_power_off);
> diff --git a/arch/ia64/kernel/process.c b/arch/ia64/kernel/process.c
> index b515149..88121a2 100644
> --- a/arch/ia64/kernel/process.c
> +++ b/arch/ia64/kernel/process.c
> @@ -57,8 +57,6 @@ void (*ia64_mark_idle)(int);
>
>  unsigned long boot_option_idle_override = IDLE_NO_OVERRIDE;
>  EXPORT_SYMBOL(boot_option_idle_override);
> -void (*pm_power_off) (void);
> -EXPORT_SYMBOL(pm_power_off);
>
>  void
>  ia64_do_show_stack (struct unw_frame_info *info, void *arg)
> @@ -675,8 +673,7 @@ machine_halt (void)
>  void
>  machine_power_off (void)
>  {
> -       if (pm_power_off)
> -               pm_power_off();
> +       do_kernel_power_off();
>         machine_halt();
>  }
>
> diff --git a/arch/m32r/kernel/process.c b/arch/m32r/kernel/process.c
> index e69221d..65a037e 100644
> --- a/arch/m32r/kernel/process.c
> +++ b/arch/m32r/kernel/process.c
> @@ -23,6 +23,7 @@
>  #include <linux/fs.h>
>  #include <linux/slab.h>
>  #include <linux/module.h>
> +#include <linux/pm.h>
>  #include <linux/ptrace.h>
>  #include <linux/unistd.h>
>  #include <linux/hardirq.h>
> @@ -44,9 +45,6 @@ unsigned long thread_saved_pc(struct task_struct *tsk)
>         return tsk->thread.lr;
>  }
>
> -void (*pm_power_off)(void) = NULL;
> -EXPORT_SYMBOL(pm_power_off);
> -
>  void machine_restart(char *__unused)
>  {
>  #if defined(CONFIG_PLAT_MAPPI3)
> @@ -67,7 +65,9 @@ void machine_halt(void)
>
>  void machine_power_off(void)
>  {
> -       /* M32R_FIXME */
> +       do_kernel_power_off();
> +       for (;;)
> +               ;
>  }
>
>  void show_regs(struct pt_regs * regs)
> diff --git a/arch/m68k/kernel/process.c b/arch/m68k/kernel/process.c
> index afe3d6e..bbc0a63 100644
> --- a/arch/m68k/kernel/process.c
> +++ b/arch/m68k/kernel/process.c
> @@ -78,14 +78,10 @@ void machine_halt(void)
>
>  void machine_power_off(void)
>  {
> -       if (pm_power_off)
> -               pm_power_off();
> +       do_kernel_power_off();
>         for (;;);
>  }
>
> -void (*pm_power_off)(void) = machine_power_off;
> -EXPORT_SYMBOL(pm_power_off);
> -
>  void show_regs(struct pt_regs * regs)
>  {
>         printk("\n");
> diff --git a/arch/metag/kernel/process.c b/arch/metag/kernel/process.c
> index 483dff9..8d95773 100644
> --- a/arch/metag/kernel/process.c
> +++ b/arch/metag/kernel/process.c
> @@ -67,9 +67,6 @@ void arch_cpu_idle_dead(void)
>  }
>  #endif
>
> -void (*pm_power_off)(void);
> -EXPORT_SYMBOL(pm_power_off);
> -
>  void (*soc_restart)(char *cmd);
>  void (*soc_halt)(void);
>
> @@ -90,8 +87,7 @@ void machine_halt(void)
>
>  void machine_power_off(void)
>  {
> -       if (pm_power_off)
> -               pm_power_off();
> +       do_kernel_power_off();
>         smp_send_stop();
>         hard_processor_halt(HALT_OK);
>  }
> diff --git a/arch/microblaze/kernel/process.c b/arch/microblaze/kernel/process.c
> index b2dd371..0ebca36 100644
> --- a/arch/microblaze/kernel/process.c
> +++ b/arch/microblaze/kernel/process.c
> @@ -44,9 +44,6 @@ void show_regs(struct pt_regs *regs)
>                                 regs->msr, regs->ear, regs->esr, regs->fsr);
>  }
>
> -void (*pm_power_off)(void) = NULL;
> -EXPORT_SYMBOL(pm_power_off);
> -
>  void flush_thread(void)
>  {
>  }
> diff --git a/arch/microblaze/kernel/reset.c b/arch/microblaze/kernel/reset.c
> index fbe58c6..2c6b32c 100644
> --- a/arch/microblaze/kernel/reset.c
> +++ b/arch/microblaze/kernel/reset.c
> @@ -103,6 +103,7 @@ void machine_halt(void)
>  void machine_power_off(void)
>  {
>         pr_notice("Machine power off...\n");
> +       do_kernel_power_off();
>         while (1)
>                 ;
>  }
> diff --git a/arch/mips/kernel/reset.c b/arch/mips/kernel/reset.c
> index 07fc524..09e74d2 100644
> --- a/arch/mips/kernel/reset.c
> +++ b/arch/mips/kernel/reset.c
> @@ -21,9 +21,6 @@
>   */
>  void (*_machine_restart)(char *command);
>  void (*_machine_halt)(void);
> -void (*pm_power_off)(void);
> -
> -EXPORT_SYMBOL(pm_power_off);
>
>  void machine_restart(char *command)
>  {
> @@ -39,6 +36,5 @@ void machine_halt(void)
>
>  void machine_power_off(void)
>  {
> -       if (pm_power_off)
> -               pm_power_off();
> +       do_kernel_power_off();
>  }
> diff --git a/arch/mn10300/kernel/process.c b/arch/mn10300/kernel/process.c
> index 3707da5..c78b2eb 100644
> --- a/arch/mn10300/kernel/process.c
> +++ b/arch/mn10300/kernel/process.c
> @@ -20,6 +20,7 @@
>  #include <linux/user.h>
>  #include <linux/interrupt.h>
>  #include <linux/delay.h>
> +#include <linux/pm.h>
>  #include <linux/reboot.h>
>  #include <linux/percpu.h>
>  #include <linux/err.h>
> @@ -45,12 +46,6 @@ unsigned long thread_saved_pc(struct task_struct *tsk)
>  }
>
>  /*
> - * power off function, if any
> - */
> -void (*pm_power_off)(void);
> -EXPORT_SYMBOL(pm_power_off);
> -
> -/*
>   * On SMP it's slightly faster (but much more power-consuming!)
>   * to poll the ->work.need_resched flag instead of waiting for the
>   * cross-CPU IPI to arrive. Use this option with caution.
> @@ -93,6 +88,7 @@ void machine_power_off(void)
>  #ifdef CONFIG_KERNEL_DEBUGGER
>         gdbstub_exit(0);
>  #endif
> +       do_kernel_power_off();
>  }
>
>  void show_regs(struct pt_regs *regs)
> diff --git a/arch/openrisc/kernel/process.c b/arch/openrisc/kernel/process.c
> index 386af25..494afd2 100644
> --- a/arch/openrisc/kernel/process.c
> +++ b/arch/openrisc/kernel/process.c
> @@ -25,6 +25,7 @@
>  #include <linux/kernel.h>
>  #include <linux/module.h>
>  #include <linux/mm.h>
> +#include <linux/pm.h>
>  #include <linux/stddef.h>
>  #include <linux/unistd.h>
>  #include <linux/ptrace.h>
> @@ -51,7 +52,7 @@
>   */
>  struct thread_info *current_thread_info_set[NR_CPUS] = { &init_thread_info, };
>
> -void machine_restart(void)
> +void machine_restart(char *cmd)
>  {
>         printk(KERN_INFO "*** MACHINE RESTART ***\n");
>         __asm__("l.nop 1");
> @@ -72,11 +73,12 @@ void machine_halt(void)
>  void machine_power_off(void)
>  {
>         printk(KERN_INFO "*** MACHINE POWER OFF ***\n");
> +
> +       do_kernel_power_off();
> +
>         __asm__("l.nop 1");
>  }
>
> -void (*pm_power_off) (void) = machine_power_off;
> -
>  /*
>   * When a process does an "exec", machine state like FPU and debug
>   * registers need to be reset.  This is a hook function for that.
> diff --git a/arch/parisc/kernel/process.c b/arch/parisc/kernel/process.c
> index 0bbbf0d..3f5d14a 100644
> --- a/arch/parisc/kernel/process.c
> +++ b/arch/parisc/kernel/process.c
> @@ -41,6 +41,7 @@
>  #include <linux/fs.h>
>  #include <linux/module.h>
>  #include <linux/personality.h>
> +#include <linux/pm.h>
>  #include <linux/ptrace.h>
>  #include <linux/sched.h>
>  #include <linux/slab.h>
> @@ -133,7 +134,9 @@ void machine_power_off(void)
>         pdc_soft_power_button(0);
>
>         pdc_chassis_send_status(PDC_CHASSIS_DIRECT_SHUTDOWN);
> -
> +
> +       do_kernel_power_off();
> +
>         /* It seems we have no way to power the system off via
>          * software. The user has to press the button himself. */
>
> @@ -141,9 +144,6 @@ void machine_power_off(void)
>                "Please power this system off now.");
>  }
>
> -void (*pm_power_off)(void) = machine_power_off;
> -EXPORT_SYMBOL(pm_power_off);
> -
>  /*
>   * Free current thread data structures etc..
>   */
> diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c
> index 1362cd6..5b7a851 100644
> --- a/arch/powerpc/kernel/setup-common.c
> +++ b/arch/powerpc/kernel/setup-common.c
> @@ -141,6 +141,9 @@ void machine_power_off(void)
>         machine_shutdown();
>         if (ppc_md.power_off)
>                 ppc_md.power_off();
> +
> +       do_kernel_power_off();
> +
>  #ifdef CONFIG_SMP
>         smp_send_stop();
>  #endif
> @@ -151,9 +154,6 @@ void machine_power_off(void)
>  /* Used by the G5 thermal driver */
>  EXPORT_SYMBOL_GPL(machine_power_off);
>
> -void (*pm_power_off)(void) = machine_power_off;
> -EXPORT_SYMBOL_GPL(pm_power_off);
> -
>  void machine_halt(void)
>  {
>         machine_shutdown();
> diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c
> index e80d9ff..267e025 100644
> --- a/arch/s390/kernel/setup.c
> +++ b/arch/s390/kernel/setup.c
> @@ -263,13 +263,9 @@ void machine_power_off(void)
>                  */
>                 console_unblank();
>         _machine_power_off();
> -}
>
> -/*
> - * Dummy power off function.
> - */
> -void (*pm_power_off)(void) = machine_power_off;
> -EXPORT_SYMBOL_GPL(pm_power_off);
> +       do_kernel_power_off();
> +}
>
>  static int __init early_parse_mem(char *p)
>  {
> diff --git a/arch/score/kernel/process.c b/arch/score/kernel/process.c
> index a1519ad3..b76ea67 100644
> --- a/arch/score/kernel/process.c
> +++ b/arch/score/kernel/process.c
> @@ -29,9 +29,6 @@
>  #include <linux/pm.h>
>  #include <linux/rcupdate.h>
>
> -void (*pm_power_off)(void);
> -EXPORT_SYMBOL(pm_power_off);
> -
>  /* If or when software machine-restart is implemented, add code here. */
>  void machine_restart(char *command) {}
>
> @@ -39,7 +36,10 @@ void machine_restart(char *command) {}
>  void machine_halt(void) {}
>
>  /* If or when software machine-power-off is implemented, add code here. */
> -void machine_power_off(void) {}
> +void machine_power_off(void)
> +{
> +       do_kernel_power_off();
> +}
>
>  void ret_from_fork(void);
>  void ret_from_kernel_thread(void);
> diff --git a/arch/sh/kernel/reboot.c b/arch/sh/kernel/reboot.c
> index 04afe5b..065de12 100644
> --- a/arch/sh/kernel/reboot.c
> +++ b/arch/sh/kernel/reboot.c
> @@ -11,9 +11,6 @@
>  #include <asm/tlbflush.h>
>  #include <asm/traps.h>
>
> -void (*pm_power_off)(void);
> -EXPORT_SYMBOL(pm_power_off);
> -
>  #ifdef CONFIG_SUPERH32
>  static void watchdog_trigger_immediate(void)
>  {
> @@ -51,8 +48,7 @@ static void native_machine_shutdown(void)
>
>  static void native_machine_power_off(void)
>  {
> -       if (pm_power_off)
> -               pm_power_off();
> +       do_kernel_power_off();
>  }
>
>  static void native_machine_halt(void)
> diff --git a/arch/sparc/kernel/process_32.c b/arch/sparc/kernel/process_32.c
> index 50e7b62..cb8148a 100644
> --- a/arch/sparc/kernel/process_32.c
> +++ b/arch/sparc/kernel/process_32.c
> @@ -48,14 +48,6 @@
>   */
>  void (*sparc_idle)(void);
>
> -/*
> - * Power-off handler instantiation for pm.h compliance
> - * This is done via auxio, but could be used as a fallback
> - * handler when auxio is not present-- unused for now...
> - */
> -void (*pm_power_off)(void) = machine_power_off;
> -EXPORT_SYMBOL(pm_power_off);
> -
>  /*
>   * sysctl - toggle power-off restriction for serial console
>   * systems in machine_power_off()
> @@ -112,6 +104,8 @@ void machine_power_off(void)
>                 sbus_writeb(power_register, auxio_power_register);
>         }
>
> +       do_kernel_power_off();
> +
>         machine_halt();
>  }
>
> diff --git a/arch/sparc/kernel/reboot.c b/arch/sparc/kernel/reboot.c
> index eba7d91..3c0bb03 100644
> --- a/arch/sparc/kernel/reboot.c
> +++ b/arch/sparc/kernel/reboot.c
> @@ -16,17 +16,13 @@
>   */
>  int scons_pwroff = 1;
>
> -/* This isn't actually used, it exists merely to satisfy the
> - * reference in kernel/sys.c
> - */
> -void (*pm_power_off)(void) = machine_power_off;
> -EXPORT_SYMBOL(pm_power_off);
> -
>  void machine_power_off(void)
>  {
>         if (strcmp(of_console_device->type, "serial") || scons_pwroff)
>                 prom_halt_power_off();
>
> +       do_kernel_power_off();
> +
>         prom_halt();
>  }
>
> diff --git a/arch/tile/kernel/reboot.c b/arch/tile/kernel/reboot.c
> index 6c5d2c0..8ff4a7f 100644
> --- a/arch/tile/kernel/reboot.c
> +++ b/arch/tile/kernel/reboot.c
> @@ -36,6 +36,9 @@ void machine_power_off(void)
>  {
>         arch_local_irq_disable_all();
>         smp_send_stop();
> +
> +       do_kernel_power_off();
> +
>         hv_power_off();
>  }
>
> @@ -45,7 +48,3 @@ void machine_restart(char *cmd)
>         smp_send_stop();
>         hv_restart((HV_VirtAddr) "vmlinux", (HV_VirtAddr) cmd);
>  }
> -
> -/* No interesting distinction to be made here. */
> -void (*pm_power_off)(void) = NULL;
> -EXPORT_SYMBOL(pm_power_off);
> diff --git a/arch/um/kernel/reboot.c b/arch/um/kernel/reboot.c
> index ced8903..a82ef28 100644
> --- a/arch/um/kernel/reboot.c
> +++ b/arch/um/kernel/reboot.c
> @@ -11,8 +11,6 @@
>  #include <os.h>
>  #include <skas.h>
>
> -void (*pm_power_off)(void);
> -
>  static void kill_off_processes(void)
>  {
>         if (proc_mm)
> diff --git a/arch/unicore32/kernel/process.c b/arch/unicore32/kernel/process.c
> index b008e99..9490dd5 100644
> --- a/arch/unicore32/kernel/process.c
> +++ b/arch/unicore32/kernel/process.c
> @@ -56,16 +56,9 @@ void machine_halt(void)
>         gpio_set_value(GPO_SOFT_OFF, 0);
>  }
>
> -/*
> - * Function pointers to optional machine specific functions
> - */
> -void (*pm_power_off)(void) = NULL;
> -EXPORT_SYMBOL(pm_power_off);
> -
>  void machine_power_off(void)
>  {
> -       if (pm_power_off)
> -               pm_power_off();
> +       do_kernel_power_off();
>         machine_halt();
>  }
>
> diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c
> index 17962e6..5c09e28 100644
> --- a/arch/x86/kernel/reboot.c
> +++ b/arch/x86/kernel/reboot.c
> @@ -30,12 +30,6 @@
>  #include <asm/x86_init.h>
>  #include <asm/efi.h>
>
> -/*
> - * Power off function, if any
> - */
> -void (*pm_power_off)(void);
> -EXPORT_SYMBOL(pm_power_off);
> -
>  static const struct desc_ptr no_idt = {};
>
>  /*
> @@ -647,11 +641,12 @@ static void native_machine_halt(void)
>
>  static void native_machine_power_off(void)
>  {
> -       if (pm_power_off) {
> +       if (have_kernel_power_off()) {
>                 if (!reboot_force)
>                         machine_shutdown();
> -               pm_power_off();
> +               do_kernel_power_off();
>         }
> +
>         /* A fallback in case there is no PM info available */
>         tboot_shutdown(TB_SHUTDOWN_HALT);
>  }
> diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
> index 1a3f044..c2c1d74 100644
> --- a/arch/x86/xen/enlighten.c
> +++ b/arch/x86/xen/enlighten.c
> @@ -1320,8 +1320,7 @@ static void xen_machine_halt(void)
>
>  static void xen_machine_power_off(void)
>  {
> -       if (pm_power_off)
> -               pm_power_off();
> +       do_kernel_power_off();
>         xen_reboot(SHUTDOWN_poweroff);
>  }
>
> diff --git a/arch/xtensa/kernel/process.c b/arch/xtensa/kernel/process.c
> index 1c85323..c487296 100644
> --- a/arch/xtensa/kernel/process.c
> +++ b/arch/xtensa/kernel/process.c
> @@ -49,10 +49,6 @@ extern void ret_from_kernel_thread(void);
>
>  struct task_struct *current_set[NR_CPUS] = {&init_task, };
>
> -void (*pm_power_off)(void) = NULL;
> -EXPORT_SYMBOL(pm_power_off);
> -
> -
>  #if XTENSA_HAVE_COPROCESSORS
>
>  void coprocessor_release_all(struct thread_info *ti)
> diff --git a/drivers/parisc/power.c b/drivers/parisc/power.c
> index ef31b77..f10cf92 100644
> --- a/drivers/parisc/power.c
> +++ b/drivers/parisc/power.c
> @@ -95,8 +95,7 @@ static void process_shutdown(void)
>                 /* send kill signal */
>                 if (kill_cad_pid(SIGINT, 1)) {
>                         /* just in case killing init process failed */
> -                       if (pm_power_off)
> -                               pm_power_off();
> +                       kernel_power_off();
>                 }
>         }
>  }
> diff --git a/kernel/power/poweroff_handler.c b/kernel/power/poweroff_handler.c
> index aeb4736..37f0b88 100644
> --- a/kernel/power/poweroff_handler.c
> +++ b/kernel/power/poweroff_handler.c
> @@ -22,6 +22,12 @@
>  #include <linux/types.h>
>
>  /*
> + * If set, calling this function will power off the system immediately.
> + */
> +void (*pm_power_off)(void);
> +EXPORT_SYMBOL(pm_power_off);
> +
> +/*
>   *     Notifier list for kernel code which wants to be called
>   *     to power off the system.
>   */
> @@ -236,6 +242,8 @@ EXPORT_SYMBOL(devm_register_power_off_handler);
>  void do_kernel_power_off(void)
>  {
>         spin_lock(&power_off_handler_lock);
> +       if (pm_power_off)
> +               pm_power_off();
>         raw_notifier_call_chain(&power_off_handler_list, 0, NULL);
>         spin_unlock(&power_off_handler_lock);
>  }
> diff --git a/kernel/reboot.c b/kernel/reboot.c
> index 5925f5a..0930851 100644
> --- a/kernel/reboot.c
> +++ b/kernel/reboot.c
> @@ -306,9 +306,9 @@ SYSCALL_DEFINE4(reboot, int, magic1, int, magic2, unsigned int, cmd,
>                 return ret;
>
>         /* Instead of trying to make the power_off code look like
> -        * halt when pm_power_off is not set do it the easy way.
> +        * halt when no poweroff handler exists do it the easy way.
>          */
> -       if ((cmd == LINUX_REBOOT_CMD_POWER_OFF) && !pm_power_off)
> +       if (cmd == LINUX_REBOOT_CMD_POWER_OFF && !have_kernel_power_off())
>                 cmd = LINUX_REBOOT_CMD_HALT;
>
>         mutex_lock(&reboot_mutex);
> --
> 1.9.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

^ permalink raw reply

* Re: [PATCH v2 08/47] kernel: Move pm_power_off to common code
From: James Hogan @ 2014-10-24  9:47 UTC (permalink / raw)
  To: Guenter Roeck, linux-kernel
  Cc: linux-mips, linux-m68k, linux-ia64, linux-sh, linux, sparclinux,
	linux-s390, linux-am33-list, linux-c6x-dev, linux-hexagon, x86,
	xen-devel, linux-xtensa, user-mode-linux-devel, linux-pm,
	adi-buildroot-devel, user-mode-linux-user, linux-metag,
	linux-arm-kernel, linux-parisc, linux-cris-kernel, linux-alpha,
	linux390, linuxppc-dev
In-Reply-To: <1413864783-3271-9-git-send-email-linux@roeck-us.net>

Hi Guenter,

On 21/10/14 05:12, Guenter Roeck wrote:
> pm_power_off is defined for all architectures. Move it to common code.
> 
> Have all architectures call do_kernel_power_off instead of pm_power_off.
> Some architectures point pm_power_off to machine_power_off. For those,
> call do_kernel_power_off from machine_power_off instead.
> 
> Acked-by: David Vrabel <david.vrabel@citrix.com>
> Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
> Acked-by: Hirokazu Takata <takata@linux-m32r.org>
> Acked-by: Jesper Nilsson <jesper.nilsson@axis.com>
> Acked-by: Max Filippov <jcmvbkbc@gmail.com>
> Acked-by: Rafael J. Wysocki <rjw@rjwysocki.net>
> Acked-by: Richard Weinberger <richard@nod.at>
> Acked-by: Xuetao Guan <gxt@mprc.pku.edu.cn>

For metag:
Acked-by: James Hogan <james.hogan@imgtec.com>

Thanks
James

> diff --git a/arch/metag/kernel/process.c b/arch/metag/kernel/process.c
> index 483dff9..8d95773 100644
> --- a/arch/metag/kernel/process.c
> +++ b/arch/metag/kernel/process.c
> @@ -67,9 +67,6 @@ void arch_cpu_idle_dead(void)
>  }
>  #endif
>  
> -void (*pm_power_off)(void);
> -EXPORT_SYMBOL(pm_power_off);
> -
>  void (*soc_restart)(char *cmd);
>  void (*soc_halt)(void);
>  
> @@ -90,8 +87,7 @@ void machine_halt(void)
>  
>  void machine_power_off(void)
>  {
> -	if (pm_power_off)
> -		pm_power_off();
> +	do_kernel_power_off();
>  	smp_send_stop();
>  	hard_processor_halt(HALT_OK);
>  }

^ permalink raw reply

* Re: [PATCH v2 08/47] kernel: Move pm_power_off to common code
From: Lennox Wu @ 2014-10-24 10:02 UTC (permalink / raw)
  Cc: linux-mips@linux-mips.org, linux-ia64@vger.kernel.org, linux-sh,
	linux@lists.openrisc.net, sparclinux@vger.kernel.org,
	linux-s390@vger.kernel.org, linux-am33-list@redhat.com,
	linux-c6x-dev@linux-c6x.org, linux-hexagon@vger.kernel.org,
	x86@kernel.org, xen-devel, linux-xtensa@linux-xtensa.org,
	user-mode-linux-devel@lists.sourceforge.net, linux-pm,
	adi-buildroot-devel@lists.sourceforge.net,
	linux-m68k@lists.linux-m68k.org,
	user-mode-linux-user@lists.sourceforge.net,
	linux-metag@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-parisc@vger.kernel.org, linux-cris-kernel@axis.com,
	open list, linux-alpha@vger.kernel.org, linux390@de.ibm.com,
	linuxppc-dev@lists.ozlabs.org
In-Reply-To: <1413864783-3271-9-git-send-email-linux@roeck-us.net>

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

Acked-by: Lennox Wu <lennox.wu@gmail.com>

2014-10-21 12:12 GMT+08:00 Guenter Roeck <linux@roeck-us.net>:

> pm_power_off is defined for all architectures. Move it to common code.
>
> Have all architectures call do_kernel_power_off instead of pm_power_off.
> Some architectures point pm_power_off to machine_power_off. For those,
> call do_kernel_power_off from machine_power_off instead.
>
> Acked-by: David Vrabel <david.vrabel@citrix.com>
> Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
> Acked-by: Hirokazu Takata <takata@linux-m32r.org>
> Acked-by: Jesper Nilsson <jesper.nilsson@axis.com>
> Acked-by: Max Filippov <jcmvbkbc@gmail.com>
> Acked-by: Rafael J. Wysocki <rjw@rjwysocki.net>
> Acked-by: Richard Weinberger <richard@nod.at>
> Acked-by: Xuetao Guan <gxt@mprc.pku.edu.cn>
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
> ---
> v2:
> - do_kernel_poweroff -> do_kernel_power_off
> - have_kernel_poweroff -> have_kernel_power_off
>
>  arch/alpha/kernel/process.c        |  9 +++------
>  arch/arc/kernel/reset.c            |  5 +----
>  arch/arm/kernel/process.c          |  5 +----
>  arch/arm64/kernel/process.c        |  5 +----
>  arch/avr32/kernel/process.c        |  6 +-----
>  arch/blackfin/kernel/process.c     |  3 ---
>  arch/blackfin/kernel/reboot.c      |  2 ++
>  arch/c6x/kernel/process.c          |  9 +--------
>  arch/cris/kernel/process.c         |  4 +---
>  arch/frv/kernel/process.c          |  5 ++---
>  arch/hexagon/kernel/reset.c        |  5 ++---
>  arch/ia64/kernel/process.c         |  5 +----
>  arch/m32r/kernel/process.c         |  8 ++++----
>  arch/m68k/kernel/process.c         |  6 +-----
>  arch/metag/kernel/process.c        |  6 +-----
>  arch/microblaze/kernel/process.c   |  3 ---
>  arch/microblaze/kernel/reset.c     |  1 +
>  arch/mips/kernel/reset.c           |  6 +-----
>  arch/mn10300/kernel/process.c      |  8 ++------
>  arch/openrisc/kernel/process.c     |  8 +++++---
>  arch/parisc/kernel/process.c       |  8 ++++----
>  arch/powerpc/kernel/setup-common.c |  6 +++---
>  arch/s390/kernel/setup.c           |  8 ++------
>  arch/score/kernel/process.c        |  8 ++++----
>  arch/sh/kernel/reboot.c            |  6 +-----
>  arch/sparc/kernel/process_32.c     | 10 ++--------
>  arch/sparc/kernel/reboot.c         |  8 ++------
>  arch/tile/kernel/reboot.c          |  7 +++----
>  arch/um/kernel/reboot.c            |  2 --
>  arch/unicore32/kernel/process.c    |  9 +--------
>  arch/x86/kernel/reboot.c           | 11 +++--------
>  arch/x86/xen/enlighten.c           |  3 +--
>  arch/xtensa/kernel/process.c       |  4 ----
>  drivers/parisc/power.c             |  3 +--
>  kernel/power/poweroff_handler.c    |  8 ++++++++
>  kernel/reboot.c                    |  4 ++--
>  36 files changed, 68 insertions(+), 146 deletions(-)
>
> diff --git a/arch/alpha/kernel/process.c b/arch/alpha/kernel/process.c
> index 1941a07..81c43f8 100644
> --- a/arch/alpha/kernel/process.c
> +++ b/arch/alpha/kernel/process.c
> @@ -24,6 +24,7 @@
>  #include <linux/vt.h>
>  #include <linux/mman.h>
>  #include <linux/elfcore.h>
> +#include <linux/pm.h>
>  #include <linux/reboot.h>
>  #include <linux/tty.h>
>  #include <linux/console.h>
> @@ -40,12 +41,6 @@
>  #include "proto.h"
>  #include "pci_impl.h"
>
> -/*
> - * Power off function, if any
> - */
> -void (*pm_power_off)(void) = machine_power_off;
> -EXPORT_SYMBOL(pm_power_off);
> -
>  #ifdef CONFIG_ALPHA_WTINT
>  /*
>   * Sleep the CPU.
> @@ -184,6 +179,8 @@ machine_halt(void)
>  void
>  machine_power_off(void)
>  {
> +       do_kernel_power_off();
> +
>         common_shutdown(LINUX_REBOOT_CMD_POWER_OFF, NULL);
>  }
>
> diff --git a/arch/arc/kernel/reset.c b/arch/arc/kernel/reset.c
> index 2768fa1..0758d9d 100644
> --- a/arch/arc/kernel/reset.c
> +++ b/arch/arc/kernel/reset.c
> @@ -26,9 +26,6 @@ void machine_restart(char *__unused)
>
>  void machine_power_off(void)
>  {
> -       /* FIXME ::  power off ??? */
> +       do_kernel_power_off();
>         machine_halt();
>  }
> -
> -void (*pm_power_off) (void) = NULL;
> -EXPORT_SYMBOL(pm_power_off);
> diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c
> index fe972a2..aa3f656 100644
> --- a/arch/arm/kernel/process.c
> +++ b/arch/arm/kernel/process.c
> @@ -117,8 +117,6 @@ void soft_restart(unsigned long addr)
>  /*
>   * Function pointers to optional machine specific functions
>   */
> -void (*pm_power_off)(void);
> -EXPORT_SYMBOL(pm_power_off);
>
>  void (*arm_pm_restart)(enum reboot_mode reboot_mode, const char *cmd);
>
> @@ -205,8 +203,7 @@ void machine_power_off(void)
>         local_irq_disable();
>         smp_send_stop();
>
> -       if (pm_power_off)
> -               pm_power_off();
> +       do_kernel_power_off();
>  }
>
>  /*
> diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c
> index c3065db..46a483a 100644
> --- a/arch/arm64/kernel/process.c
> +++ b/arch/arm64/kernel/process.c
> @@ -68,8 +68,6 @@ void soft_restart(unsigned long addr)
>  /*
>   * Function pointers to optional machine specific functions
>   */
> -void (*pm_power_off)(void);
> -EXPORT_SYMBOL_GPL(pm_power_off);
>
>  void (*arm_pm_restart)(enum reboot_mode reboot_mode, const char *cmd);
>
> @@ -129,8 +127,7 @@ void machine_power_off(void)
>  {
>         local_irq_disable();
>         smp_send_stop();
> -       if (pm_power_off)
> -               pm_power_off();
> +       do_kernel_power_off();
>  }
>
>  /*
> diff --git a/arch/avr32/kernel/process.c b/arch/avr32/kernel/process.c
> index 42a53e74..529c1f6 100644
> --- a/arch/avr32/kernel/process.c
> +++ b/arch/avr32/kernel/process.c
> @@ -23,9 +23,6 @@
>
>  #include <mach/pm.h>
>
> -void (*pm_power_off)(void);
> -EXPORT_SYMBOL(pm_power_off);
> -
>  /*
>   * This file handles the architecture-dependent parts of process
> handling..
>   */
> @@ -48,8 +45,7 @@ void machine_halt(void)
>
>  void machine_power_off(void)
>  {
> -       if (pm_power_off)
> -               pm_power_off();
> +       do_kernel_power_off();
>  }
>
>  void machine_restart(char *cmd)
> diff --git a/arch/blackfin/kernel/process.c
> b/arch/blackfin/kernel/process.c
> index 4aa5545..812dd83 100644
> --- a/arch/blackfin/kernel/process.c
> +++ b/arch/blackfin/kernel/process.c
> @@ -39,9 +39,6 @@ int nr_l1stack_tasks;
>  void *l1_stack_base;
>  unsigned long l1_stack_len;
>
> -void (*pm_power_off)(void) = NULL;
> -EXPORT_SYMBOL(pm_power_off);
> -
>  /*
>   * The idle loop on BFIN
>   */
> diff --git a/arch/blackfin/kernel/reboot.c b/arch/blackfin/kernel/reboot.c
> index c4f50a3..387d610 100644
> --- a/arch/blackfin/kernel/reboot.c
> +++ b/arch/blackfin/kernel/reboot.c
> @@ -7,6 +7,7 @@
>   */
>
>  #include <linux/interrupt.h>
> +#include <linux/pm.h>
>  #include <asm/bfin-global.h>
>  #include <asm/reboot.h>
>  #include <asm/bfrom.h>
> @@ -106,6 +107,7 @@ void machine_halt(void)
>  __attribute__((weak))
>  void native_machine_power_off(void)
>  {
> +       do_kernel_power_off();
>         idle_with_irq_disabled();
>  }
>
> diff --git a/arch/c6x/kernel/process.c b/arch/c6x/kernel/process.c
> index 57d2ea8..edf7e5a 100644
> --- a/arch/c6x/kernel/process.c
> +++ b/arch/c6x/kernel/process.c
> @@ -27,12 +27,6 @@ void (*c6x_halt)(void);
>  extern asmlinkage void ret_from_fork(void);
>  extern asmlinkage void ret_from_kernel_thread(void);
>
> -/*
> - * power off function, if any
> - */
> -void (*pm_power_off)(void);
> -EXPORT_SYMBOL(pm_power_off);
> -
>  void arch_cpu_idle(void)
>  {
>         unsigned long tmp;
> @@ -73,8 +67,7 @@ void machine_halt(void)
>
>  void machine_power_off(void)
>  {
> -       if (pm_power_off)
> -               pm_power_off();
> +       do_kernel_power_off();
>         halt_loop();
>  }
>
> diff --git a/arch/cris/kernel/process.c b/arch/cris/kernel/process.c
> index b78498e..9ebd76b 100644
> --- a/arch/cris/kernel/process.c
> +++ b/arch/cris/kernel/process.c
> @@ -31,9 +31,6 @@
>
>  extern void default_idle(void);
>
> -void (*pm_power_off)(void);
> -EXPORT_SYMBOL(pm_power_off);
> -
>  void arch_cpu_idle(void)
>  {
>         default_idle();
> @@ -60,6 +57,7 @@ void machine_halt(void)
>
>  void machine_power_off(void)
>  {
> +       do_kernel_power_off();
>  }
>
>  /*
> diff --git a/arch/frv/kernel/process.c b/arch/frv/kernel/process.c
> index 5d40aeb77..502dabb 100644
> --- a/arch/frv/kernel/process.c
> +++ b/arch/frv/kernel/process.c
> @@ -42,9 +42,6 @@ asmlinkage void ret_from_kernel_thread(void);
>
>  #include <asm/pgalloc.h>
>
> -void (*pm_power_off)(void);
> -EXPORT_SYMBOL(pm_power_off);
> -
>  static void core_sleep_idle(void)
>  {
>  #ifdef LED_DEBUG_SLEEP
> @@ -107,6 +104,8 @@ void machine_power_off(void)
>         gdbstub_exit(0);
>  #endif
>
> +       do_kernel_power_off();
> +
>         for (;;);
>  }
>
> diff --git a/arch/hexagon/kernel/reset.c b/arch/hexagon/kernel/reset.c
> index 76483c1..6f607b6 100644
> --- a/arch/hexagon/kernel/reset.c
> +++ b/arch/hexagon/kernel/reset.c
> @@ -16,11 +16,13 @@
>   * 02110-1301, USA.
>   */
>
> +#include <linux/pm.h>
>  #include <linux/smp.h>
>  #include <asm/hexagon_vm.h>
>
>  void machine_power_off(void)
>  {
> +       do_kernel_power_off();
>         smp_send_stop();
>         __vmstop();
>  }
> @@ -32,6 +34,3 @@ void machine_halt(void)
>  void machine_restart(char *cmd)
>  {
>  }
> -
> -void (*pm_power_off)(void) = NULL;
> -EXPORT_SYMBOL(pm_power_off);
> diff --git a/arch/ia64/kernel/process.c b/arch/ia64/kernel/process.c
> index b515149..88121a2 100644
> --- a/arch/ia64/kernel/process.c
> +++ b/arch/ia64/kernel/process.c
> @@ -57,8 +57,6 @@ void (*ia64_mark_idle)(int);
>
>  unsigned long boot_option_idle_override = IDLE_NO_OVERRIDE;
>  EXPORT_SYMBOL(boot_option_idle_override);
> -void (*pm_power_off) (void);
> -EXPORT_SYMBOL(pm_power_off);
>
>  void
>  ia64_do_show_stack (struct unw_frame_info *info, void *arg)
> @@ -675,8 +673,7 @@ machine_halt (void)
>  void
>  machine_power_off (void)
>  {
> -       if (pm_power_off)
> -               pm_power_off();
> +       do_kernel_power_off();
>         machine_halt();
>  }
>
> diff --git a/arch/m32r/kernel/process.c b/arch/m32r/kernel/process.c
> index e69221d..65a037e 100644
> --- a/arch/m32r/kernel/process.c
> +++ b/arch/m32r/kernel/process.c
> @@ -23,6 +23,7 @@
>  #include <linux/fs.h>
>  #include <linux/slab.h>
>  #include <linux/module.h>
> +#include <linux/pm.h>
>  #include <linux/ptrace.h>
>  #include <linux/unistd.h>
>  #include <linux/hardirq.h>
> @@ -44,9 +45,6 @@ unsigned long thread_saved_pc(struct task_struct *tsk)
>         return tsk->thread.lr;
>  }
>
> -void (*pm_power_off)(void) = NULL;
> -EXPORT_SYMBOL(pm_power_off);
> -
>  void machine_restart(char *__unused)
>  {
>  #if defined(CONFIG_PLAT_MAPPI3)
> @@ -67,7 +65,9 @@ void machine_halt(void)
>
>  void machine_power_off(void)
>  {
> -       /* M32R_FIXME */
> +       do_kernel_power_off();
> +       for (;;)
> +               ;
>  }
>
>  void show_regs(struct pt_regs * regs)
> diff --git a/arch/m68k/kernel/process.c b/arch/m68k/kernel/process.c
> index afe3d6e..bbc0a63 100644
> --- a/arch/m68k/kernel/process.c
> +++ b/arch/m68k/kernel/process.c
> @@ -78,14 +78,10 @@ void machine_halt(void)
>
>  void machine_power_off(void)
>  {
> -       if (pm_power_off)
> -               pm_power_off();
> +       do_kernel_power_off();
>         for (;;);
>  }
>
> -void (*pm_power_off)(void) = machine_power_off;
> -EXPORT_SYMBOL(pm_power_off);
> -
>  void show_regs(struct pt_regs * regs)
>  {
>         printk("\n");
> diff --git a/arch/metag/kernel/process.c b/arch/metag/kernel/process.c
> index 483dff9..8d95773 100644
> --- a/arch/metag/kernel/process.c
> +++ b/arch/metag/kernel/process.c
> @@ -67,9 +67,6 @@ void arch_cpu_idle_dead(void)
>  }
>  #endif
>
> -void (*pm_power_off)(void);
> -EXPORT_SYMBOL(pm_power_off);
> -
>  void (*soc_restart)(char *cmd);
>  void (*soc_halt)(void);
>
> @@ -90,8 +87,7 @@ void machine_halt(void)
>
>  void machine_power_off(void)
>  {
> -       if (pm_power_off)
> -               pm_power_off();
> +       do_kernel_power_off();
>         smp_send_stop();
>         hard_processor_halt(HALT_OK);
>  }
> diff --git a/arch/microblaze/kernel/process.c
> b/arch/microblaze/kernel/process.c
> index b2dd371..0ebca36 100644
> --- a/arch/microblaze/kernel/process.c
> +++ b/arch/microblaze/kernel/process.c
> @@ -44,9 +44,6 @@ void show_regs(struct pt_regs *regs)
>                                 regs->msr, regs->ear, regs->esr,
> regs->fsr);
>  }
>
> -void (*pm_power_off)(void) = NULL;
> -EXPORT_SYMBOL(pm_power_off);
> -
>  void flush_thread(void)
>  {
>  }
> diff --git a/arch/microblaze/kernel/reset.c
> b/arch/microblaze/kernel/reset.c
> index fbe58c6..2c6b32c 100644
> --- a/arch/microblaze/kernel/reset.c
> +++ b/arch/microblaze/kernel/reset.c
> @@ -103,6 +103,7 @@ void machine_halt(void)
>  void machine_power_off(void)
>  {
>         pr_notice("Machine power off...\n");
> +       do_kernel_power_off();
>         while (1)
>                 ;
>  }
> diff --git a/arch/mips/kernel/reset.c b/arch/mips/kernel/reset.c
> index 07fc524..09e74d2 100644
> --- a/arch/mips/kernel/reset.c
> +++ b/arch/mips/kernel/reset.c
> @@ -21,9 +21,6 @@
>   */
>  void (*_machine_restart)(char *command);
>  void (*_machine_halt)(void);
> -void (*pm_power_off)(void);
> -
> -EXPORT_SYMBOL(pm_power_off);
>
>  void machine_restart(char *command)
>  {
> @@ -39,6 +36,5 @@ void machine_halt(void)
>
>  void machine_power_off(void)
>  {
> -       if (pm_power_off)
> -               pm_power_off();
> +       do_kernel_power_off();
>  }
> diff --git a/arch/mn10300/kernel/process.c b/arch/mn10300/kernel/process.c
> index 3707da5..c78b2eb 100644
> --- a/arch/mn10300/kernel/process.c
> +++ b/arch/mn10300/kernel/process.c
> @@ -20,6 +20,7 @@
>  #include <linux/user.h>
>  #include <linux/interrupt.h>
>  #include <linux/delay.h>
> +#include <linux/pm.h>
>  #include <linux/reboot.h>
>  #include <linux/percpu.h>
>  #include <linux/err.h>
> @@ -45,12 +46,6 @@ unsigned long thread_saved_pc(struct task_struct *tsk)
>  }
>
>  /*
> - * power off function, if any
> - */
> -void (*pm_power_off)(void);
> -EXPORT_SYMBOL(pm_power_off);
> -
> -/*
>   * On SMP it's slightly faster (but much more power-consuming!)
>   * to poll the ->work.need_resched flag instead of waiting for the
>   * cross-CPU IPI to arrive. Use this option with caution.
> @@ -93,6 +88,7 @@ void machine_power_off(void)
>  #ifdef CONFIG_KERNEL_DEBUGGER
>         gdbstub_exit(0);
>  #endif
> +       do_kernel_power_off();
>  }
>
>  void show_regs(struct pt_regs *regs)
> diff --git a/arch/openrisc/kernel/process.c
> b/arch/openrisc/kernel/process.c
> index 386af25..494afd2 100644
> --- a/arch/openrisc/kernel/process.c
> +++ b/arch/openrisc/kernel/process.c
> @@ -25,6 +25,7 @@
>  #include <linux/kernel.h>
>  #include <linux/module.h>
>  #include <linux/mm.h>
> +#include <linux/pm.h>
>  #include <linux/stddef.h>
>  #include <linux/unistd.h>
>  #include <linux/ptrace.h>
> @@ -51,7 +52,7 @@
>   */
>  struct thread_info *current_thread_info_set[NR_CPUS] = {
> &init_thread_info, };
>
> -void machine_restart(void)
> +void machine_restart(char *cmd)
>  {
>         printk(KERN_INFO "*** MACHINE RESTART ***\n");
>         __asm__("l.nop 1");
> @@ -72,11 +73,12 @@ void machine_halt(void)
>  void machine_power_off(void)
>  {
>         printk(KERN_INFO "*** MACHINE POWER OFF ***\n");
> +
> +       do_kernel_power_off();
> +
>         __asm__("l.nop 1");
>  }
>
> -void (*pm_power_off) (void) = machine_power_off;
> -
>  /*
>   * When a process does an "exec", machine state like FPU and debug
>   * registers need to be reset.  This is a hook function for that.
> diff --git a/arch/parisc/kernel/process.c b/arch/parisc/kernel/process.c
> index 0bbbf0d..3f5d14a 100644
> --- a/arch/parisc/kernel/process.c
> +++ b/arch/parisc/kernel/process.c
> @@ -41,6 +41,7 @@
>  #include <linux/fs.h>
>  #include <linux/module.h>
>  #include <linux/personality.h>
> +#include <linux/pm.h>
>  #include <linux/ptrace.h>
>  #include <linux/sched.h>
>  #include <linux/slab.h>
> @@ -133,7 +134,9 @@ void machine_power_off(void)
>         pdc_soft_power_button(0);
>
>         pdc_chassis_send_status(PDC_CHASSIS_DIRECT_SHUTDOWN);
> -
> +
> +       do_kernel_power_off();
> +
>         /* It seems we have no way to power the system off via
>          * software. The user has to press the button himself. */
>
> @@ -141,9 +144,6 @@ void machine_power_off(void)
>                "Please power this system off now.");
>  }
>
> -void (*pm_power_off)(void) = machine_power_off;
> -EXPORT_SYMBOL(pm_power_off);
> -
>  /*
>   * Free current thread data structures etc..
>   */
> diff --git a/arch/powerpc/kernel/setup-common.c
> b/arch/powerpc/kernel/setup-common.c
> index 1362cd6..5b7a851 100644
> --- a/arch/powerpc/kernel/setup-common.c
> +++ b/arch/powerpc/kernel/setup-common.c
> @@ -141,6 +141,9 @@ void machine_power_off(void)
>         machine_shutdown();
>         if (ppc_md.power_off)
>                 ppc_md.power_off();
> +
> +       do_kernel_power_off();
> +
>  #ifdef CONFIG_SMP
>         smp_send_stop();
>  #endif
> @@ -151,9 +154,6 @@ void machine_power_off(void)
>  /* Used by the G5 thermal driver */
>  EXPORT_SYMBOL_GPL(machine_power_off);
>
> -void (*pm_power_off)(void) = machine_power_off;
> -EXPORT_SYMBOL_GPL(pm_power_off);
> -
>  void machine_halt(void)
>  {
>         machine_shutdown();
> diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c
> index e80d9ff..267e025 100644
> --- a/arch/s390/kernel/setup.c
> +++ b/arch/s390/kernel/setup.c
> @@ -263,13 +263,9 @@ void machine_power_off(void)
>                  */
>                 console_unblank();
>         _machine_power_off();
> -}
>
> -/*
> - * Dummy power off function.
> - */
> -void (*pm_power_off)(void) = machine_power_off;
> -EXPORT_SYMBOL_GPL(pm_power_off);
> +       do_kernel_power_off();
> +}
>
>  static int __init early_parse_mem(char *p)
>  {
> diff --git a/arch/score/kernel/process.c b/arch/score/kernel/process.c
> index a1519ad3..b76ea67 100644
> --- a/arch/score/kernel/process.c
> +++ b/arch/score/kernel/process.c
> @@ -29,9 +29,6 @@
>  #include <linux/pm.h>
>  #include <linux/rcupdate.h>
>
> -void (*pm_power_off)(void);
> -EXPORT_SYMBOL(pm_power_off);
> -
>  /* If or when software machine-restart is implemented, add code here. */
>  void machine_restart(char *command) {}
>
> @@ -39,7 +36,10 @@ void machine_restart(char *command) {}
>  void machine_halt(void) {}
>
>  /* If or when software machine-power-off is implemented, add code here. */
> -void machine_power_off(void) {}
> +void machine_power_off(void)
> +{
> +       do_kernel_power_off();
> +}
>
>  void ret_from_fork(void);
>  void ret_from_kernel_thread(void);
> diff --git a/arch/sh/kernel/reboot.c b/arch/sh/kernel/reboot.c
> index 04afe5b..065de12 100644
> --- a/arch/sh/kernel/reboot.c
> +++ b/arch/sh/kernel/reboot.c
> @@ -11,9 +11,6 @@
>  #include <asm/tlbflush.h>
>  #include <asm/traps.h>
>
> -void (*pm_power_off)(void);
> -EXPORT_SYMBOL(pm_power_off);
> -
>  #ifdef CONFIG_SUPERH32
>  static void watchdog_trigger_immediate(void)
>  {
> @@ -51,8 +48,7 @@ static void native_machine_shutdown(void)
>
>  static void native_machine_power_off(void)
>  {
> -       if (pm_power_off)
> -               pm_power_off();
> +       do_kernel_power_off();
>  }
>
>  static void native_machine_halt(void)
> diff --git a/arch/sparc/kernel/process_32.c
> b/arch/sparc/kernel/process_32.c
> index 50e7b62..cb8148a 100644
> --- a/arch/sparc/kernel/process_32.c
> +++ b/arch/sparc/kernel/process_32.c
> @@ -48,14 +48,6 @@
>   */
>  void (*sparc_idle)(void);
>
> -/*
> - * Power-off handler instantiation for pm.h compliance
> - * This is done via auxio, but could be used as a fallback
> - * handler when auxio is not present-- unused for now...
> - */
> -void (*pm_power_off)(void) = machine_power_off;
> -EXPORT_SYMBOL(pm_power_off);
> -
>  /*
>   * sysctl - toggle power-off restriction for serial console
>   * systems in machine_power_off()
> @@ -112,6 +104,8 @@ void machine_power_off(void)
>                 sbus_writeb(power_register, auxio_power_register);
>         }
>
> +       do_kernel_power_off();
> +
>         machine_halt();
>  }
>
> diff --git a/arch/sparc/kernel/reboot.c b/arch/sparc/kernel/reboot.c
> index eba7d91..3c0bb03 100644
> --- a/arch/sparc/kernel/reboot.c
> +++ b/arch/sparc/kernel/reboot.c
> @@ -16,17 +16,13 @@
>   */
>  int scons_pwroff = 1;
>
> -/* This isn't actually used, it exists merely to satisfy the
> - * reference in kernel/sys.c
> - */
> -void (*pm_power_off)(void) = machine_power_off;
> -EXPORT_SYMBOL(pm_power_off);
> -
>  void machine_power_off(void)
>  {
>         if (strcmp(of_console_device->type, "serial") || scons_pwroff)
>                 prom_halt_power_off();
>
> +       do_kernel_power_off();
> +
>         prom_halt();
>  }
>
> diff --git a/arch/tile/kernel/reboot.c b/arch/tile/kernel/reboot.c
> index 6c5d2c0..8ff4a7f 100644
> --- a/arch/tile/kernel/reboot.c
> +++ b/arch/tile/kernel/reboot.c
> @@ -36,6 +36,9 @@ void machine_power_off(void)
>  {
>         arch_local_irq_disable_all();
>         smp_send_stop();
> +
> +       do_kernel_power_off();
> +
>         hv_power_off();
>  }
>
> @@ -45,7 +48,3 @@ void machine_restart(char *cmd)
>         smp_send_stop();
>         hv_restart((HV_VirtAddr) "vmlinux", (HV_VirtAddr) cmd);
>  }
> -
> -/* No interesting distinction to be made here. */
> -void (*pm_power_off)(void) = NULL;
> -EXPORT_SYMBOL(pm_power_off);
> diff --git a/arch/um/kernel/reboot.c b/arch/um/kernel/reboot.c
> index ced8903..a82ef28 100644
> --- a/arch/um/kernel/reboot.c
> +++ b/arch/um/kernel/reboot.c
> @@ -11,8 +11,6 @@
>  #include <os.h>
>  #include <skas.h>
>
> -void (*pm_power_off)(void);
> -
>  static void kill_off_processes(void)
>  {
>         if (proc_mm)
> diff --git a/arch/unicore32/kernel/process.c
> b/arch/unicore32/kernel/process.c
> index b008e99..9490dd5 100644
> --- a/arch/unicore32/kernel/process.c
> +++ b/arch/unicore32/kernel/process.c
> @@ -56,16 +56,9 @@ void machine_halt(void)
>         gpio_set_value(GPO_SOFT_OFF, 0);
>  }
>
> -/*
> - * Function pointers to optional machine specific functions
> - */
> -void (*pm_power_off)(void) = NULL;
> -EXPORT_SYMBOL(pm_power_off);
> -
>  void machine_power_off(void)
>  {
> -       if (pm_power_off)
> -               pm_power_off();
> +       do_kernel_power_off();
>         machine_halt();
>  }
>
> diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c
> index 17962e6..5c09e28 100644
> --- a/arch/x86/kernel/reboot.c
> +++ b/arch/x86/kernel/reboot.c
> @@ -30,12 +30,6 @@
>  #include <asm/x86_init.h>
>  #include <asm/efi.h>
>
> -/*
> - * Power off function, if any
> - */
> -void (*pm_power_off)(void);
> -EXPORT_SYMBOL(pm_power_off);
> -
>  static const struct desc_ptr no_idt = {};
>
>  /*
> @@ -647,11 +641,12 @@ static void native_machine_halt(void)
>
>  static void native_machine_power_off(void)
>  {
> -       if (pm_power_off) {
> +       if (have_kernel_power_off()) {
>                 if (!reboot_force)
>                         machine_shutdown();
> -               pm_power_off();
> +               do_kernel_power_off();
>         }
> +
>         /* A fallback in case there is no PM info available */
>         tboot_shutdown(TB_SHUTDOWN_HALT);
>  }
> diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
> index 1a3f044..c2c1d74 100644
> --- a/arch/x86/xen/enlighten.c
> +++ b/arch/x86/xen/enlighten.c
> @@ -1320,8 +1320,7 @@ static void xen_machine_halt(void)
>
>  static void xen_machine_power_off(void)
>  {
> -       if (pm_power_off)
> -               pm_power_off();
> +       do_kernel_power_off();
>         xen_reboot(SHUTDOWN_poweroff);
>  }
>
> diff --git a/arch/xtensa/kernel/process.c b/arch/xtensa/kernel/process.c
> index 1c85323..c487296 100644
> --- a/arch/xtensa/kernel/process.c
> +++ b/arch/xtensa/kernel/process.c
> @@ -49,10 +49,6 @@ extern void ret_from_kernel_thread(void);
>
>  struct task_struct *current_set[NR_CPUS] = {&init_task, };
>
> -void (*pm_power_off)(void) = NULL;
> -EXPORT_SYMBOL(pm_power_off);
> -
> -
>  #if XTENSA_HAVE_COPROCESSORS
>
>  void coprocessor_release_all(struct thread_info *ti)
> diff --git a/drivers/parisc/power.c b/drivers/parisc/power.c
> index ef31b77..f10cf92 100644
> --- a/drivers/parisc/power.c
> +++ b/drivers/parisc/power.c
> @@ -95,8 +95,7 @@ static void process_shutdown(void)
>                 /* send kill signal */
>                 if (kill_cad_pid(SIGINT, 1)) {
>                         /* just in case killing init process failed */
> -                       if (pm_power_off)
> -                               pm_power_off();
> +                       kernel_power_off();
>                 }
>         }
>  }
> diff --git a/kernel/power/poweroff_handler.c
> b/kernel/power/poweroff_handler.c
> index aeb4736..37f0b88 100644
> --- a/kernel/power/poweroff_handler.c
> +++ b/kernel/power/poweroff_handler.c
> @@ -22,6 +22,12 @@
>  #include <linux/types.h>
>
>  /*
> + * If set, calling this function will power off the system immediately.
> + */
> +void (*pm_power_off)(void);
> +EXPORT_SYMBOL(pm_power_off);
> +
> +/*
>   *     Notifier list for kernel code which wants to be called
>   *     to power off the system.
>   */
> @@ -236,6 +242,8 @@ EXPORT_SYMBOL(devm_register_power_off_handler);
>  void do_kernel_power_off(void)
>  {
>         spin_lock(&power_off_handler_lock);
> +       if (pm_power_off)
> +               pm_power_off();
>         raw_notifier_call_chain(&power_off_handler_list, 0, NULL);
>         spin_unlock(&power_off_handler_lock);
>  }
> diff --git a/kernel/reboot.c b/kernel/reboot.c
> index 5925f5a..0930851 100644
> --- a/kernel/reboot.c
> +++ b/kernel/reboot.c
> @@ -306,9 +306,9 @@ SYSCALL_DEFINE4(reboot, int, magic1, int, magic2,
> unsigned int, cmd,
>                 return ret;
>
>         /* Instead of trying to make the power_off code look like
> -        * halt when pm_power_off is not set do it the easy way.
> +        * halt when no poweroff handler exists do it the easy way.
>          */
> -       if ((cmd == LINUX_REBOOT_CMD_POWER_OFF) && !pm_power_off)
> +       if (cmd == LINUX_REBOOT_CMD_POWER_OFF && !have_kernel_power_off())
>                 cmd = LINUX_REBOOT_CMD_HALT;
>
>         mutex_lock(&reboot_mutex);
> --
> 1.9.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
>

[-- Attachment #2: Type: text/html, Size: 32003 bytes --]

^ permalink raw reply

* Re: [PATCH 3/4] dt/bindings: Introduce the FSL QorIQ DPAA QMan
From: Emil Medve @ 2014-10-24  9:53 UTC (permalink / raw)
  To: Mark Rutland
  Cc: devicetree@vger.kernel.org, Pawel Moll,
	ijc+devicetree@hellion.org.uk, Geoff.Thorpe@freescale.com,
	corbet@lwn.net, linux-doc@vger.kernel.org,
	linuxppc-dev@ozlabs.org, robh+dt@kernel.org, galak@codeaurora.org,
	scottwood@freescale.com
In-Reply-To: <20141023112628.GC13690@leverpostej>

Hello Mark,


On 10/23/2014 06:26 AM, Mark Rutland wrote:
>>>> +- clocks
>>>> +	Usage:		See clock-bindings.txt and qoriq-clock.txt
>>>> +	Value type:	<prop-encoded-array>
>>>> +	Definition:	Half of the platform clock
>>>> +
>>>
>>> I don't understand the description here. What is the clock from the PoV
>>> of the QMan? Which input line on the QMan is this clock attached to?
>>>
>>> Is there only one clock input? Or jsut one that you need to manage at
>>> the moment?
>>
>> As part of the programming model (QoS features specifically) QMan needs
>> to know its clock speed. Prior to the existence of the
>> clock-bindings.txt, a "static" clock-frequency property was/is used
>> convey such information. Using clock-binding.txt to describe the
>> clocking hierarchy in the SoC makes it easier with DFS, power
>> management, etc.
> 
> Ok. My concern is the phrase "Half of the platform clock" is meaingless.
> The property contains a phandle + clock-specifier pair that describe a
> single input clock by reference (some bindings just say "clock
> reference" for that, which is fine). This is not "half" of any
> particular clock.
> 
> The description of the clock should describe what it logically is from
> the PoV of the consumer (i.e. _this_ device) rather than the provider.
> To me "platform clock" sounds like a description of the provider. Is
> there a name for the clock input line on this device?
> 
> Is there only a single clock input? Or just one that you care about at
> the moment?

This is the reference clock for QMan and is the only input clock. It's
derived form the platform PLL/clock and its frequency/speed is half of
the platform PLL. I'll update its description


Cheers,

^ permalink raw reply

* Re: [PATCH 2/4] dt/bindings: Introduce the FSL QorIQ DPAA BMan portal(s)
From: Emil Medve @ 2014-10-24  9:26 UTC (permalink / raw)
  To: Mark Rutland
  Cc: devicetree@vger.kernel.org, Pawel Moll,
	ijc+devicetree@hellion.org.uk, Geoff.Thorpe@freescale.com,
	corbet@lwn.net, linux-doc@vger.kernel.org,
	linuxppc-dev@ozlabs.org, robh+dt@kernel.org, galak@codeaurora.org,
	scottwood@freescale.com
In-Reply-To: <20141023111622.GB13690@leverpostej>

Hello Mark,


On 10/23/2014 06:16 AM, Mark Rutland wrote:
>>>> +NOTE:	The bindings described in this document are preliminary and subject to
>>>> +	change
>>>
>>> While we've tried that elsewhere, unstable DT bindings have been shown
>>> to be a major source of pain.
>>
>> Agreed
>>
>>> I'd feel rather uncomfortable accepting a
>>> binding that we already believe to be insufficient to describe the
>>> hardware.
>>>
>>> What do you expect to change?
>>
>> Related bindings seem incomplete. As such, the PAMU binding (pamu.txt)
>> covers incompletely a dynamic LIODN assignment/programming model. The
>> current driver uses a static assignment scheme that the binding needs to
>> include. I also suspect that once the driver starts supporting the
>> dynamic LIODN assignment/programming we might find some wrinkles
> 
> Ok. Given that the driver doesn't seem to be in mainline (per a quick
> grep), just put "DO NOT MERGE" or something like that in the commit
> message. Once this is merged you're going to need to support it.

We have a driver and once the bindings get accepted we'll (update the
driver as needed and) post the code


Cheers,

^ permalink raw reply

* Re: [PATCH V2 1/2] mm: Update generic gup implementation to handle hugepage directory
From: Steve Capper @ 2014-10-24  8:33 UTC (permalink / raw)
  To: Benjamin Herrenschmidt
  Cc: Andrea Arcangeli, linux-arch@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	Aneesh Kumar K.V, Johannes Weiner, akpm@linux-foundation.org,
	linuxppc-dev, David Miller
In-Reply-To: <1414107635.364.91.camel@pasglop>

On 24 October 2014 00:40, Benjamin Herrenschmidt
<benh@kernel.crashing.org> wrote:
> On Thu, 2014-10-23 at 18:40 -0400, David Miller wrote:
>> Hey guys, was looking over the generic GUP while working on a sparc64
>> issue and I noticed that you guys do speculative page gets, and after
>> talking with Johannes Weiner (CC:'d) about this we don't see how it
>> could be necessary.
>>
>> If interrupts are disabled during the page table scan (which they
>> are), no IPI tlb flushes can arrive.  Therefore any removal from the
>> page tables is guarded by interrupts being re-enabled.  And as a
>> result, page counts of pages we see in the page tables must always
>> have a count > 0.
>>
>> x86 does direct atomic_add() on &page->_count because of this
>> invariant and I would rather see the generic version do this too.
>
> This is of course only true of archs who use IPIs for TLB flushes, so if
> we are going down the path of not being speculative, powerpc would have
> to go back to doing its own since our broadcast TLB flush means we
> aren't protected (we are only protected vs. the page tables themselves
> being freed since we do that via sched RCU).
>
> AFAIK, ARM also broadcasts TLB flushes...

Indeed, for most ARM cores we have hardware TLB broadcasts, thus we
need the speculative path.

>
> Another option would be to make the generic code use something defined
> by the arch to decide whether to use speculative get or
> not. I like the idea of keeping the bulk of that code generic...

It would be nice to have the code generalised further.
In addition to the speculative/atomic helpers the implementation would
need to be renamed from GENERIC_RCU_GUP to GENERIC_GUP.
The other noteworthy assumption made in the RCU GUP is that pte's can
be read atomically. For x86 this isn't true when running with 64-bit
pte's, thus a helper would be needed.

Cheers,
-- 
Steve

^ permalink raw reply

* Re: [PATCH V2 1/2] mm: Update generic gup implementation to handle hugepage directory
From: David Miller @ 2014-10-24  3:55 UTC (permalink / raw)
  To: benh
  Cc: aarcange, linux-arch, steve.capper, linux-kernel, linux-mm,
	aneesh.kumar, hannes, akpm, linuxppc-dev
In-Reply-To: <1414107635.364.91.camel@pasglop>

From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Date: Fri, 24 Oct 2014 10:40:35 +1100

> Another option would be to make the generic code use something defined
> by the arch to decide whether to use speculative get or
> not. I like the idea of keeping the bulk of that code generic...

Me too.  We could have inlines that do either speculative or
non-speculative gets on the pages in some header file and hide
the ifdefs in there.

^ permalink raw reply

* Re: [PATCH V2 1/2] mm: Update generic gup implementation to handle hugepage directory
From: Benjamin Herrenschmidt @ 2014-10-23 23:40 UTC (permalink / raw)
  To: David Miller
  Cc: aarcange, linux-arch, steve.capper, linux-kernel, linux-mm,
	aneesh.kumar, hannes, akpm, linuxppc-dev
In-Reply-To: <20141023.184035.388557314666522484.davem@davemloft.net>

On Thu, 2014-10-23 at 18:40 -0400, David Miller wrote:
> Hey guys, was looking over the generic GUP while working on a sparc64
> issue and I noticed that you guys do speculative page gets, and after
> talking with Johannes Weiner (CC:'d) about this we don't see how it
> could be necessary.
> 
> If interrupts are disabled during the page table scan (which they
> are), no IPI tlb flushes can arrive.  Therefore any removal from the
> page tables is guarded by interrupts being re-enabled.  And as a
> result, page counts of pages we see in the page tables must always
> have a count > 0.
> 
> x86 does direct atomic_add() on &page->_count because of this
> invariant and I would rather see the generic version do this too.

This is of course only true of archs who use IPIs for TLB flushes, so if
we are going down the path of not being speculative, powerpc would have
to go back to doing its own since our broadcast TLB flush means we
aren't protected (we are only protected vs. the page tables themselves
being freed since we do that via sched RCU).

AFAIK, ARM also broadcasts TLB flushes...

Another option would be to make the generic code use something defined
by the arch to decide whether to use speculative get or
not. I like the idea of keeping the bulk of that code generic...

Cheers,
Ben.

> --
> To unsubscribe, send a message with 'unsubscribe linux-mm' in
> the body to majordomo@kvack.org.  For more info on Linux MM,
> see: http://www.linux-mm.org/ .
> Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply

* Re: [PATCH V2 1/2] mm: Update generic gup implementation to handle hugepage directory
From: David Miller @ 2014-10-23 22:40 UTC (permalink / raw)
  To: akpm
  Cc: aarcange, linux-arch, steve.capper, hannes, linux-kernel,
	linux-mm, aneesh.kumar, linuxppc-dev
In-Reply-To: <20141022160224.9c2268795e55d5a2eff5b94d@linux-foundation.org>


Hey guys, was looking over the generic GUP while working on a sparc64
issue and I noticed that you guys do speculative page gets, and after
talking with Johannes Weiner (CC:'d) about this we don't see how it
could be necessary.

If interrupts are disabled during the page table scan (which they
are), no IPI tlb flushes can arrive.  Therefore any removal from the
page tables is guarded by interrupts being re-enabled.  And as a
result, page counts of pages we see in the page tables must always
have a count > 0.

x86 does direct atomic_add() on &page->_count because of this
invariant and I would rather see the generic version do this too.

^ permalink raw reply

* [PATCH v2] powernv/iommu: disable IOMMU bypass with param iommu=nobypass
From: Thadeu Lima de Souza Cascardo @ 2014-10-23 21:19 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Thadeu Lima de Souza Cascardo, linux-kernel, gwshan, corbet

When IOMMU bypass is enabled, a PCI device can read and write memory
that was not mapped by the driver without causing an EEH. That might
cause memory corruption, for example.

When we disable bypass, DMA reads and writes to addresses not mapped by
the IOMMU will cause an EEH, allowing us to debug such issues.

Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@linux.vnet.ibm.com>
Reviewed-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
---
 Documentation/kernel-parameters.txt       |    2 ++
 arch/powerpc/platforms/powernv/pci-ioda.c |   24 +++++++++++++++++++++++-
 2 files changed, 25 insertions(+), 1 deletions(-)

diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index 988160a..b03322a 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -1454,6 +1454,8 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
 		forcesac
 		soft
 		pt		[x86, IA-64]
+		nobypass	[PPC/POWERNV]
+			Disable IOMMU bypass, using IOMMU for PCI devices.
 
 
 	io7=		[HW] IO7 for Marvel based alpha systems
diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c
index 468a0f2..a7d2f32 100644
--- a/arch/powerpc/platforms/powernv/pci-ioda.c
+++ b/arch/powerpc/platforms/powernv/pci-ioda.c
@@ -75,6 +75,27 @@ static void pe_level_printk(const struct pnv_ioda_pe *pe, const char *level,
 #define pe_info(pe, fmt, ...)					\
 	pe_level_printk(pe, KERN_INFO, fmt, ##__VA_ARGS__)
 
+static bool pnv_iommu_bypass_disabled __read_mostly;
+
+static int __init iommu_setup(char *str)
+{
+	if (!str)
+		return -EINVAL;
+	while (*str) {
+		if (!strncmp(str, "nobypass", 8)) {
+			pnv_iommu_bypass_disabled = true;
+			pr_info("PowerNV: IOMMU bypass window disabled.\n");
+		}
+		str += strcspn(str, ",");
+		if (*str == ',')
+			str++;
+	}
+
+	return 0;
+}
+
+early_param("iommu", iommu_setup);
+
 /*
  * stdcix is only supposed to be used in hypervisor real mode as per
  * the architecture spec
@@ -1243,7 +1264,8 @@ static void pnv_pci_ioda2_setup_dma_pe(struct pnv_phb *phb,
 		pnv_ioda_setup_bus_dma(pe, pe->pbus, true);
 
 	/* Also create a bypass window */
-	pnv_pci_ioda2_setup_bypass_pe(phb, pe);
+	if (!pnv_iommu_bypass_disabled)
+		pnv_pci_ioda2_setup_bypass_pe(phb, pe);
 	return;
 fail:
 	if (pe->tce32_seg >= 0)
-- 
1.7.1

^ permalink raw reply related

* RE: [PATCH 2/4] dt/bindings: Introduce the FSL QorIQ DPAA BMan portal(s)
From: Geoff Thorpe @ 2014-10-23 13:28 UTC (permalink / raw)
  To: Mark Rutland, Emilian Medve
  Cc: devicetree@vger.kernel.org, Pawel Moll,
	ijc+devicetree@hellion.org.uk, corbet@lwn.net,
	linux-doc@vger.kernel.org, linuxppc-dev@ozlabs.org,
	robh+dt@kernel.org, galak@codeaurora.org, Scott Wood
In-Reply-To: <20141023111622.GB13690@leverpostej>

SGksDQoNCkxlYXBpbmcgaW4gaGVyZSBhIGxpdHRsZSBhZnRlciB0aGUgZmFjdCwgdG8gYWRkIGEg
Yml0IG9mIGJhY2tncm91bmQgaW5mbyBvbiB0aGUgaGFyZHdhcmUgaW4gY2FzZSBpdCBoZWxwcy4N
Cg0KPiAtLS0tLU9yaWdpbmFsIE1lc3NhZ2UtLS0tLQ0KPiBGcm9tOiBNYXJrIFJ1dGxhbmQgW21h
aWx0bzptYXJrLnJ1dGxhbmRAYXJtLmNvbV0NCj4gU2VudDogT2N0b2Jlci0yMy0xNCA3OjE2IEFN
DQo+IFRvOiBNZWR2ZSBFbWlsaWFuLUVNTUVEVkUxDQo+IA0KPiBPbiBXZWQsIE9jdCAyMiwgMjAx
NCBhdCAwOTowNDo1NFBNICswMTAwLCBFbWlsIE1lZHZlIHdyb3RlOg0KPiA+IEhlbGxvIE1hcmss
DQo+ID4NCj4gPg0KPiA+IFRoYW5rcyBmb3IgaGF2aW5nIGEgbG9vayBhdCB0aGlzDQo+ID4NCj4g
PiBPbiAxMC8yMi8yMDE0IDA5OjI5IEFNLCBNYXJrIFJ1dGxhbmQgd3JvdGU6DQo+ID4gPiBPbiBX
ZWQsIE9jdCAyMiwgMjAxNCBhdCAwMzowOTozMFBNICswMTAwLCBFbWlsIE1lZHZlIHdyb3RlOg0K
PiA+ID4+IFBvcnRhbHMgYXJlIHVzZWQgYnkgc29mdHdhcmUgcnVubmluZyBvbiBwcm9jZXNzb3Ig
Y29yZXMsDQo+IGFjY2VsZXJhdG9ycyBhbmQNCj4gPiA+PiBuZXR3b3JrIGludGVyZmFjZXMgdG8g
Y29tbXVuaWNhdGUgd2l0aCB0aGUgQk1hbg0KPiA+ID4NCj4gPiA+IFdoYXQgZXhhY3RseSBpcyBh
IHBvcnRhbD8NCj4gPiA+DQo+ID4gPiBJcyBpdCBhIHJlZ2lvbiBvZiBzaGFyZWQgbWVtb3J5PyBB
IGRldmljZT8NCg0KSnVzdCB0byBzdXBwbGVtZW50IHdoYXQgRW1pbCBhbHJlYWR5IG1lbnRpb25l
ZCwgdGhlIHBvcnRhbHMgZWFjaCBjb250YWluIHR3byBtZW1vcnktbWFwcGVkIHJlZ2lvbnMgYW5k
IGEgc2luZ2xlIGludGVycnVwdC4gT25lIG9mIHRoZSByZWdpb25zIGlzIGEgY29udmVudGlvbmFs
IDRLIHBhZ2Ugb2YgMzItYml0IGNhY2hlLWluaGliaXRlZCByZWdpc3RlcnMgKGFuZCB0aGlzIGlu
Y2x1ZGVzIGFsbCB0aGUgY29udHJvbHMgYW5kIHN0YXR1cyBmb3IgdGhlIHBvcnRhbCdzIGludGVy
cnVwdCBsaW5lLCB3aGljaCBjb252ZXlzIGEgdmFyaWV0eSBvZiBpbmRpdmlkdWFsbHktY29uZmln
dXJhYmxlIGludGVycnVwdCBzb3VyY2UgY29uZGl0aW9ucykuIFRoZSBvdGhlciByZWdpb24gaXMg
YSAxNksgY2FjaGUtZW5hYmxlZCBzcGFjZSwgc28gdGhlICJyZWdpc3RlcnMiIGFyZSBjYWNoZWxp
bmUgd2lkdGggLSBpbnRlcmFjdGlvbiB3aXRoIHRoaXMgcmVsaWVzIG9uIGNhY2hlbGluZSBtYW5p
cHVsYXRpb24gaW5zdHJ1Y3Rpb25zIChmbHVzaGluZywgcHJlZmV0Y2hpbmcsIGV0YyksIGFuZCBp
biBzb21lIGNvbmZpZ3VyYXRpb25zIGhhcmR3YXJlIHdpbGwgaW5pdGlhdGUgc3Rhc2hpbmcgKGNh
Y2hlLXdhcm1pbmcpIGZvciBzb21lIG9mIHRob3NlIGNhY2hlbGluZXMsIHdoaWNoIGlzIG9uZSBv
ZiB0aGUgcmVhc29ucyB0aGF0IHRoZXNlIHBvcnRhbHMgaGF2ZSAiTElPRE4iIGluZm9ybWF0aW9u
IGNvbmZpZ3VyZWQgaW50byB0aGVtIChzdGFzaGluZyB0cmFuc2FjdGlvbnMgZ28gdGhyb3VnaCB0
aGUgSU9NTVUpLiBUaGUgb3RoZXIgcmVhc29uIGZvciBMSU9ETi9JT01NVSBjb250ZXh0IGlzIHRo
YXQgYWxsIHRoZSBhY2NlbGVyYXRvciBhbmQgbmV0d29ya2luZyBmdW5jdGlvbnMgYWNjZXNzZWQg
dmlhIGEgcG9ydGFsIHdpbGwgYmUgc3ViamVjdGVkIHRvIHRoZSBJT01NVSBjb250ZXh0IGluZm8g
b2YgdGhhdCBwb3J0YWwuIEluIHRoaXMgd2F5LCBhIHBvcnRhbCB0aGF0IGlzIG1hcHBlZC91c2Vk
IGJ5IGEgZ2l2ZW4gc29mdHdhcmUgY29udGV4dCBjYW4gYmUgc2V0dXAgc3VjaCB0aGF0IERNQSBn
ZW5lcmF0ZWQgYnkgaXRzIGhhcmR3YXJlIGludGVyYWN0aW9ucyB3aWxsIHJlc3BlY3QgdGhlIHNh
bWUgZ3Vlc3QtcGh5c2ljYWwgdHJhbnNsYXRpb25zIGFuZCByZXN0cmljdGlvbnMgYXMgYXBwbHkg
dG8gdGhlIHNvZnR3YXJlIGNvbnRleHQgaXRzZWxmLg0KDQpCVFcsIGEgc3Vic2V0IG9mIHRoZSBD
Q1NSIHJlZ2lzdGVycyBmb3IgdGhlIFFNYW4gYW5kIEJNYW4gYmxvY2tzIGFyZSB1c2VkIHRvIGNv
bmZpZ3VyZSB0aGVzZSBMSU9ETi9JT01NVSBhdHRyaWJ1dGVzIG9mIHRoZSBwb3J0YWxzLCBhcyBv
cHBvc2VkIHRvIHRob3NlIGF0dHJpYnV0ZXMgYmVpbmcgZXhwb3NlZCBpbiB0aGUgcmVnaXN0ZXIg
c3BhY2Ugb2YgdGhlIHBvcnRhbHMgdGhlbXNlbHZlcy4gSW4gdGhpcyB3YXksIHRoZSB1c2VyIG9m
IGEgbWVtb3J5LW1hcHBlZCBwb3J0YWwgY2Fubm90IHNldCB0aGVpciBvd24gTElPRE4vSU9NTVUg
YXR0cmlidXRlcywgdGhhdCBkZWNpc2lvbiBiZWxvbmdzIHRvIHdob2V2ZXIgdHdpZGRsZXMgd2l0
aCBDQ1NSLg0KDQo+ID4gR2l2ZW4gdGhlIGRlc2NyaXB0aW9uIGFib3ZlLCBzdXJlbHkgeW91IG5l
ZWQgdG8ga25vdyB3aGF0IHRoZQ0KPiBwb3J0YWwgaXMNCj4gPiA+IHVzZWQgZm9yPyBPciBpcyB0
aGF0IHF1ZXJpZWQgZnJvbSB0aGUgcG9ydGFsPw0KPiA+DQo+ID4gV2UgZG9uJ3QgbmVlZC93YW50
IHRvIGluY2x1ZGUgc3VjaCBpbmZvcm1hdGlvbiBpbiB0aGUgRFQuIFBvcnRhbHMNCj4gYXJlDQo+
ID4gImFsbG9jYXRlZCIgZHluYW1pY2FsbHkgYW5kIHVzZWQgYnkgdGhlIHJlc3BlY3RpdmUgY29u
dGV4dA0KPiANCj4gT2suIFNvIHRoZXkgaGF2ZSBubyBmaXhlZCBwdXJwb3NlIGFuZCBzb2Z0d2Fy
ZSBhbGxvY2F0ZXMgYXMgbmVjZXNzYXJ5Pw0KPiBUaGVyZSBhcmUgbm8gY29uc3RyYWludHMgb24g
aG93IGVhY2ggcG9ydGFsIG1heSBiZSB1c2VkLCBvciB3aGljaA0KPiBwb3J0YWwNCj4gYW5vdGhl
ciBhZ2V0biBtaWdodCB1c2U/DQoNClllcywgcHJlY2lzZWx5LiBUaGV5J3JlIGludGVyY2hhbmdl
YWJsZSB3aW5kb3dzL2NvbnRleHRzIGludG8gdGhlIGhhcmR3YXJlLCBmb3IgaXNzdWluZyB2YXJp
b3VzIGtpbmRzIG9mIGNvbW1hbmRzIGFuZCBvYnRhaW5pbmcgdmFyaW91cyBraW5kcyBvZiByZXN1
bHRzL3N0YXR1cy4gVGhlIFNvQyBwcm92aWRlcyBhIGNlcnRhaW4gbnVtYmVyIG9mIHRoZXNlIHBv
cnRhbHMsIGFuZCBzb2Z0d2FyZSBjYW4gYWxsb2NhdGUgdGhlbSBvdXQgYW5kIGNvbmZpZ3VyZSB0
aGVtIGluIHdoYXRldmVyIG1hbm5lciAoc3RhdGljLCBkeW5hbWljLCAuLi4pLiBCZWNhdXNlIG9m
IHRoZSBDQ1NSLWNvbnRyb2xsZWQgTElPRE4vSU9NTVUgcG9ydGFsIGF0dHJpYnV0ZXMsIHR3byBw
b3J0YWxzIGNhbiBiZSBzZXQgdXAgdG8gaGF2ZSBkaWZmZXJlbnQgImFjY2VzcyIgYW5kIG9wZXJh
dGUgaW4gZGlmZmVyZW50IGNvbnRleHRzIChlZy4gYXBwcywgdmlydHVhbCBtYWNoaW5lcyksIGJ1
dCB0aGF0IGlzIGRldGVybWluZWQgYnkgY29udHJvbCBzb2Z0d2FyZSAoa2VybmVsIGRyaXZlcikg
Y29uZmlndXJhdGlvbiBvZiB0aG9zZSBwb3J0YWxzIGJlZm9yZSB0aGVpciB1c2UuIEluIHNob3J0
LCB0aGVyZSdzIG5vdGhpbmcgaW50cmluc2ljIHRvIHRoZSBwb3J0YWxzIChpZS4gZnJvbSBhIGhh
cmR3YXJlIHBlcnNwZWN0aXZlKSB0aGF0IGRpc3Rpbmd1aXNoZXMgdGhlbSBvciBwcmVkZXRlcm1p
bmVzIHRoZWlyIHVzZS4NCg0KQ2hlZXJzLA0KR2VvZmYNCg0KDQo=

^ permalink raw reply

* RE: [PATCH 3/4] dt/bindings: Introduce the FSL QorIQ DPAA QMan
From: Geoff Thorpe @ 2014-10-23 13:51 UTC (permalink / raw)
  To: Mark Rutland, Emilian Medve
  Cc: devicetree@vger.kernel.org, Pawel Moll,
	ijc+devicetree@hellion.org.uk, corbet@lwn.net,
	linux-doc@vger.kernel.org, linuxppc-dev@ozlabs.org,
	robh+dt@kernel.org, galak@codeaurora.org, Scott Wood
In-Reply-To: <20141023112628.GC13690@leverpostej>

VGhvdWdodCBJJ2QgY29tbWVudCB0b28gb24gdGhlIGludGVycnVwdCBxdWVzdGlvbiBmb3IgdGhl
IGJsb2NrLWxldmVsIChub3QgcG9ydGFsLWxldmVsKSBub2RlOw0KDQo+IC0tLS0tT3JpZ2luYWwg
TWVzc2FnZS0tLS0tDQo+IEZyb206IE1hcmsgUnV0bGFuZCBbbWFpbHRvOm1hcmsucnV0bGFuZEBh
cm0uY29tXQ0KPiBTZW50OiBPY3RvYmVyLTIzLTE0IDc6MjYgQU0NCj4gVG86IE1lZHZlIEVtaWxp
YW4tRU1NRURWRTENCj4gDQo+IFsuLi5dDQo+IA0KPiA+ID4gWW91IGFsc28gc2VlbSB0byBoYXZl
IGFuIGludGVycnVwdCBpbiB0aGUgZXhhbXBsZS4gSG93IG1hbnkgZG8geW91DQo+ID4gPiBleHBl
Y3QsIGFuZCB3aGF0IGFyZSB0aGVpciB0aGVpciBsb2dpY2FsIGZ1bmN0aW9ucz8NCj4gPg0KPiA+
IFRoYXQncyB0aGUgZXJyb3IgaW50ZXJydXB0IGFuZCBob3BlZnVsbHkgaXQgbmV2ZXIgdHJpZ2dl
cnMuIEkgZGlkbid0DQo+IGFkZA0KPiA+IFttYW55XSB3b3JkcyBhYm91dCBpdCBhcyBpdCdzIGEg
c3RhbmRhcmQgcHJvcGVydHkNCj4gDQo+IFdoaWxlIHRoZSBpbnRlcnJ1cHRzIHByb3BlcnR5IGlz
IHN0YW5kYXJkLCBpdCBpcyBvbmx5IHN0YW5kYXJkIGluIHRoZQ0KPiBzZW5zZSB0aGF0IHRoZSBu
YW1lIGFuZCBmb3JtYXQgYXJlIHN0YW5kYXJkLiBOb3QgZXZlcnkgYmlkbmluZyBoYXMgYW4NCj4g
aW50ZXJydXB0cyBwcm9wZXJ0eSwgYW5kIHRoZSBzZXQgb2YgaW50ZXJydXB0cyBkZXNjcmliZWQg
YXJlIHNwZWNpZmljDQo+IHRvDQo+IHRoZSBiaW5kaW5nLiBQbGVhc2UgZGVzY3JpYmUgdGhlIHNl
dCBvZiBpbnRlcnJ1cHRzIHlvdSBleHBlY3QuDQo+IA0KPiBEb2VzIHRoZSBkZXZpY2Ugb25seSBo
YXZlIHRoZSBlcnJvciBpbnRlcnJ1cHQsIG9yIGlzIHRoYXQgdGhlIG9ubHkNCj4gaW50ZXJydXB0
IHlvdSBjYXJlIGFib3V0Pw0KDQpTbyBhcyB3aXRoIHRoZSBwb3J0YWxzLCB0aGUgYmxvY2tzIHRo
ZW1zZWx2ZXMgZWFjaCBoYXZlIGEgc2luZ2xlIGludGVycnVwdCBsaW5lLCBidXQgYSBudW1iZXIg
b2YgdGhlIChDQ1NSKSByZWdpc3RlcnMgYXJlIHJlbGF0ZWQgdG8gdGhhdCBpbnRlcnJ1cHQgdG8g
Y2FwdHVyZSB0aGUgY29kZXMgYW5kIGF0dHJpYnV0ZXMgb2YgdGhlIHZhcmlvdXMgZXJyb3IgY29u
ZGl0aW9ucyBiZWluZyByZXBvcnRlZCwgYmVjYXVzZSBhIHdpZGUgdmFyaWV0eSBvZiBldmVudHMg
YW5kIGluZm9ybWF0aW9uIGNhbiBiZSBjb252ZXllZCB0aHJvdWdoIHRoYXQgaW50ZXJydXB0IGxp
bmUuIEluIGdlbmVyYWwsIHllcywgdGhpcyBpbnRlcnJ1cHQgbGluZSBpcyBvbmx5IGZvciAiZXJy
b3JzIiwgYnV0IHNvbWUgZXJyb3JzIGFyZSBtb3JlIGVxdWFsIHRoYW4gb3RoZXJzLiBFZy4gdGhl
cmUgaXMgdGhlIHVzdWFsIGNsYXNzIG9mIGNhdGFzdHJvcGhpYyBETUEtZmFpbHVyZSwgRUNDLCBo
YXJkd2FyZS1pbnRlcm5hbC1pbmNvbnNpc3RlbmN5IHR5cGVzIG9mIGVycm9ycyB0aGF0IGRldmlj
ZXMgdGVuZCB0byBzaG91dCBhYm91dC4gQnV0IHRoZXJlIGFyZSBhbHNvIHRocmVzaG9sZC1iYXNl
ZCAicmVzb3VyY2Ugc3RhcnZhdGlvbiIgdHlwZXMgb2YgImVycm9ycyIgdG9vLCB3aGljaCBhcmUg
bm90IHJlYWxseSBlcnJvcnMgcGVyIHNlLCB1bmxlc3MgdGhlIHN5c3RlbSBjb25maWd1cmF0aW9u
IGFuZCB1c2UtY2FzZSBpcyBleHBsaWNpdGx5IGVuZ2luZWVyZWQgYW5kIGNvbnN0cmFpbmVkIHN1
Y2ggdGhhdCB0aGUgdGhyZXNob2xkcyBzaG91bGRuJ3QgZXZlciBnZXQgdHJpcHBlZC4NCg0KU28g
dGhlIGhhbmRsaW5nIG9mIHRoZSBpbnRlcnJ1cHQgaW52b2x2ZXMgaW50ZXJyb2dhdGluZyByZWdp
c3RlcnMgdG8gY2xhc3NpZnkgdGhlIHdoeSwgaG93LCBhbmQgd2hhdCwgYW5kIHRoZSByZWFjdGlv
biB0byBpdCAod2hldGhlciBhIHdyaXRlLXRvLWNsZWFyIGlzIG5lZWRlZCwgd2hldGhlciBpdCBz
aG91bGQgYmUgbWFza2VkLCB3aGV0aGVyIGZ1bmN0aW9uYWxpdHkgc2hvdWxkIGJlIGhhbHRlZCwg
Li4uKSBpcyBhbHNvIGEgZmFpcmx5IGVsYWJvcmF0ZSBxdWVzdGlvbi4NCg0KSSBkb24ndCBrbm93
IHdoYXQgdGhlIGV4cGVjdGF0aW9ucyBhcmUgZm9yIHRoZXNlICJiaW5kaW5ncyIgZG9jcywgYnV0
IHRoZSByZXF1ZXN0IHRvICJkZXNjcmliZSB0aGUgc2V0IG9mIGludGVycnVwdHMgeW91IGV4cGVj
dCIgZG9lcyByaXNrIG9wZW5pbmcgYSBmYWlybHkgZWxhYm9yYXRlIGNhbiBvZiB3b3JtcyAodGhh
dCBtYXkgYmUgYmV0dGVyIGNvbmZpbmVkIHRvIHRoZSBkcml2ZXIpLiBVbmxlc3MgSSBtaXN1bmRl
cnN0b29kIHRoZSByZXF1ZXN0LCB3aGljaCBpcyBhbHdheXMgcXVpdGUgcG9zc2libGUgYmVmb3Jl
IG15IHNlY29uZCBjb2ZmZWUuLi4NCg0KQ2hlZXJzLA0KR2VvZmYNCg0KDQo=

^ permalink raw reply

* Re: [PATCH] drivers: depend on instead of select BACKLIGHT_CLASS_DEVICE and ACPI_VIDEO
From: Tomi Valkeinen @ 2014-10-23 11:38 UTC (permalink / raw)
  To: Daniel Vetter
  Cc: Jean-Christophe Plagniol-Villard, linux-fbdev, Jingoo Han,
	Daniel Drake, Jens Frederich, Jani Nikula, Greg Kroah-Hartman,
	Jon Nettleton, linux-usb, linux-kernel, dri-devel,
	platform-driver-x86, Lee Jones, Randy Dunlap, Daniel Vetter,
	Darren Hart, Bryan Wu, linuxppc-dev, Laurent Pinchart
In-Reply-To: <20141023081034.GA26941@phenom.ffwll.local>

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

On 23/10/14 11:10, Daniel Vetter wrote:

> If we want to make BACKLIGHT_CLASS_DEVICE into a library thing then I
> guess we could do that, but we must then also drag it out of all the other
> meta options to make sure it's always available. No need I think to ditch

BACKLIGHT_CLASS_DEVICE only depends on HAS_IOMEM and
BACKLIGHT_LCD_SUPPORT so there are no other meta options to avoid.
HAS_IOMEM comes from drivers/video/Kconfig's "Graphics support", and I
guess we can ignore it.

> the entire BACKLIGHT_LCD_SUPPORT meta option. And then everyone could
> select it.

I don't quite understand what purpose does BACKLIGHT_LCD_SUPPORT serve.
It doesn't enable any code, it just opens up new Kconfig options. Why
can't the Kconfig options be always available? It's just another option
to 'select', without any reason I can see.

 Tomi



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply

* Re: [PATCH 3/4] dt/bindings: Introduce the FSL QorIQ DPAA QMan
From: Mark Rutland @ 2014-10-23 11:26 UTC (permalink / raw)
  To: Emil Medve
  Cc: devicetree@vger.kernel.org, Pawel Moll,
	ijc+devicetree@hellion.org.uk, Geoff.Thorpe@freescale.com,
	corbet@lwn.net, linux-doc@vger.kernel.org,
	linuxppc-dev@ozlabs.org, robh+dt@kernel.org, galak@codeaurora.org,
	scottwood@freescale.com
In-Reply-To: <54480DF8.3070604@Freescale.com>

[...]

> >> +QMan Node
> >> +
> >> +PROPERTIES
> >> +
> >> +- compatible
> >> +	Usage:		Required
> >> +	Value type:	<stringlist>
> >> +	Definition:	Must include "fsl,qman"
> >> +			May include "fsl,<SoC>-qman"
> >> +
> >> +- reg
> >> +	Usage:		Required
> >> +	Value type:	<prop-encoded-array>
> >> +	Definition:	Registers region within the CCSR address space
> >> +
> >> +- fsl,liodn
> >> +	Usage:		See pamu.txt
> >> +	Value type:	<prop-encoded-array>
> >> +	Definition:	PAMU property used for static LIODN assignment
> >> +
> >> +- fsl,iommu-parent
> >> +	Usage:		See pamu.txt
> >> +	Value type:	<phandle>
> >> +	Definition:	PAMU property used for dynamic LIODN assignment
> >> +
> >> +	For additional details about the PAMU/LIODN binding(s) see pamu.txt
> > 
> > This is not present in the example. Is this always required?
> 
> Sort of. Initial hardware (and current documentation) programming
> suggestion was to configure all the PAMU instances the same way
> regardless of what devices were behind them. Given the PAMU internal
> caches sizes, this proved suboptimal from a performance perspective so
> we're trying to discover/describe/use the PAMU topology
> 
> fsl,liodn is part of the undocumented static LIODN assignment binding
> that the current PAMU driver uses. If fsl,iommu-parent is present,
> fsl,liodn can be ignored and the LIODN can be assigned dynamically
> and/or programmed only in the relevant PAMU instance

Ok.

> >> +
> >> +- clocks
> >> +	Usage:		See clock-bindings.txt and qoriq-clock.txt
> >> +	Value type:	<prop-encoded-array>
> >> +	Definition:	Half of the platform clock
> >> +
> > 
> > I don't understand the description here. What is the clock from the PoV
> > of the QMan? Which input line on the QMan is this clock attached to?
> > 
> > Is there only one clock input? Or jsut one that you need to manage at
> > the moment?
> 
> As part of the programming model (QoS features specifically) QMan needs
> to know its clock speed. Prior to the existence of the
> clock-bindings.txt, a "static" clock-frequency property was/is used
> convey such information. Using clock-binding.txt to describe the
> clocking hierarchy in the SoC makes it easier with DFS, power
> management, etc.

Ok. My concern is the phrase "Half of the platform clock" is meaingless.
The property contains a phandle + clock-specifier pair that describe a
single input clock by reference (some bindings just say "clock
reference" for that, which is fine). This is not "half" of any
particular clock.

The description of the clock should describe what it logically is from
the PoV of the consumer (i.e. _this_ device) rather than the provider.
To me "platform clock" sounds like a description of the provider. Is
there a name for the clock input line on this device?

Is there only a single clock input? Or just one that you care about at
the moment?

> The platform clock/PLL binding is part of qoriq-clock.txt
> 
> > You also seem to have an interrupt in the example. How many do you
> > expect, and what are their their logical functions?
> 
> That's the error interrupt and hopefully it never triggers. I didn't add
> [many] words about it as it's a standard property

While the interrupts property is standard, it is only standard in the
sense that the name and format are standard. Not every bidning has an
interrupts property, and the set of interrupts described are specific to
the binding. Please describe the set of interrupts you expect.

Does the device only have the error interrupt, or is that the only
interrupt you care about?

> >> +QMan Private Memory Nodes
> >> +
> >> +QMan requires two contiguous range of physical memory used for the backing store
> >> +for QMan Frame Queue Descriptor and Packed Frame Descriptor Record. This memory
> >> +is reserved/allocated as a nodes under the /reserved-memory node
> >> +
> >> +The QMan FQD memory node must be named "qman-fqd"
> >> +
> >> +PROPERTIES
> >> +
> >> +- compatible
> >> +	Usage:		required
> >> +	Value type:	<stringlist>
> >> +	Definition:	Must inclide "fsl,qman-fqd"
> >> +
> >> +The QMan PFDR memory node must be named "qman-pfdr"
> >> +
> >> +PROPERTIES
> >> +
> >> +- compatible
> >> +	Usage:		required
> >> +	Value type:	<stringlist>
> >> +	Definition:	Must inclide "fsl,qman-pfdr"
> >> +
> >> +The following constraints are relevant to the FQD and PFDR private memory:
> >> +	- The size must be 2^(size + 1), with size = 11..29. That is 4 KiB to
> >> +	  1 GiB
> >> +	- The alignment must be a muliptle of the memory size
> >> +
> >> +The size of the FQD and PFDP must be chosen by observing the hardware features
> >> +configured via the RCW and that are relevant to a specific board (e.g. number of
> >> +MAC(s) pinned-out, number of offline/host command FMan ports, etc.). The size
> >> +configured in the DT must reflect the hardware capabilities and not the specific
> >> +needs of an application
> >> +
> >> +If the memory reserved in the device tree proves to be larger then the needs of
> >> +the application a QMan driver may provide a method to release the extra memory
> >> +back to the OS
> > 
> > Driver details should be unimportant to the binding. This sentence can
> > disappear.
> 
> I'm trying to discourage reserved-memory nodes to be used to "optimize"
> the memory allocation/usage. If it comes to it, I can drop this sentence

I think it would be preferable to do so.

Thanks,
Mark.

^ permalink raw reply

* Re: [PATCH 2/4] dt/bindings: Introduce the FSL QorIQ DPAA BMan portal(s)
From: Mark Rutland @ 2014-10-23 11:16 UTC (permalink / raw)
  To: Emil Medve
  Cc: devicetree@vger.kernel.org, Pawel Moll,
	ijc+devicetree@hellion.org.uk, Geoff.Thorpe@freescale.com,
	corbet@lwn.net, linux-doc@vger.kernel.org,
	linuxppc-dev@ozlabs.org, robh+dt@kernel.org, galak@codeaurora.org,
	scottwood@freescale.com
In-Reply-To: <54480DE6.4090604@Freescale.com>

On Wed, Oct 22, 2014 at 09:04:54PM +0100, Emil Medve wrote:
> Hello Mark,
> 
> 
> Thanks for having a look at this
> 
> On 10/22/2014 09:29 AM, Mark Rutland wrote:
> > On Wed, Oct 22, 2014 at 03:09:30PM +0100, Emil Medve wrote:
> >> Portals are used by software running on processor cores, accelerators and
> >> network interfaces to communicate with the BMan
> > 
> > What exactly is a portal?
> > 
> > Is it a region of shared memory? A device?
> 
> In a nutshell a (software, i.e. processor core accessible) portal is a
> memory mapped interface to the B/QMan that allows low latency, lock-less
> interaction by logically separated units of software. The original
> intent was to have one affine portal per core. As of now we're
> sprinkling portals to use from various (core affine) contexts:
> hypervisor, guests, user-space, containers, etc.
> 
> I'll make the definition more palatable in the next round

Thanks,

> > I only received emails 2 and 3 of this series, so I'm lacking the
> > context necessary to understand the bindings.
> 
> Some bubble in the pipe... As of now they all seem to have hit the
> e-mail list(s), patchwork and hopefully your Inbox

They've all come through now, yes.

I'd expected to see the relevant code too -- in isolation the bindings
are somewhat difficult to grok.

> 
> >> Signed-off-by: Emil Medve <Emilian.Medve@Freescale.com>
> >> Change-Id: I6d245ffc14ba3d0e91d403ac7c3b91b75a9e6a95
> >> ---
> >>  .../bindings/powerpc/fsl/bman-portals.txt          | 50 ++++++++++++++++++++++
> >>  1 file changed, 50 insertions(+)
> >>  create mode 100644 Documentation/devicetree/bindings/powerpc/fsl/bman-portals.txt
> >>
> >> diff --git a/Documentation/devicetree/bindings/powerpc/fsl/bman-portals.txt b/Documentation/devicetree/bindings/powerpc/fsl/bman-portals.txt
> >> new file mode 100644
> >> index 0000000..40e607e
> >> --- /dev/null
> >> +++ b/Documentation/devicetree/bindings/powerpc/fsl/bman-portals.txt
> >> @@ -0,0 +1,50 @@
> >> +QorIQ DPAA Buffer Manager Portals Device Tree Binding
> >> +
> >> +Copyright (C) 2008 - 2014 Freescale Semiconductor Inc.
> >> +
> >> +CONTENTS
> >> +
> >> +	- BMan Portal
> >> +	- Example
> >> +
> >> +NOTE:	The bindings described in this document are preliminary and subject to
> >> +	change
> > 
> > While we've tried that elsewhere, unstable DT bindings have been shown
> > to be a major source of pain.
> 
> Agreed
> 
> > I'd feel rather uncomfortable accepting a
> > binding that we already believe to be insufficient to describe the
> > hardware.
> > 
> > What do you expect to change?
> 
> Related bindings seem incomplete. As such, the PAMU binding (pamu.txt)
> covers incompletely a dynamic LIODN assignment/programming model. The
> current driver uses a static assignment scheme that the binding needs to
> include. I also suspect that once the driver starts supporting the
> dynamic LIODN assignment/programming we might find some wrinkles

Ok. Given that the driver doesn't seem to be in mainline (per a quick
grep), just put "DO NOT MERGE" or something like that in the commit
message. Once this is merged you're going to need to support it.

> >> +BMan Portal Node
> >> +
> >> +PROPERTIES
> >> +
> >> +- compatible
> >> +	Usage:		Required
> >> +	Value type:	<stringlist>
> >> +	Definition:	Must include "fsl,bman-portal-<hardware revision>"
> >> +			May include "fsl,<SoC>-bman-portal" or "fsl,bman-portal"
> >> +
> >> +- reg
> >> +	Usage:		Required
> >> +	Value type:	<prop-encoded-array>
> >> +	Definition:	Two regions. The first is the cache-enabled region of
> >> +			the portal. The second is the cache-inhibited region of
> >> +			the portal
> >> +
> >> +EXAMPLE
> >> +
> >> +The example below shows a (P4080) BMan portals container/bus node with two portals
> > 
> > Is there any particular reason to place these under a simple-bus?
> 
> I think they fit the ePAPR definition for simple-bus container. They can
> be accessed directly and can be used independently. What are you suggesting?
> 
> >> +
> >> +	bman-portals@ff4000000 {
> >> +		#address-cells = <1>;
> >> +		#size-cells = <1>;
> >> +		compatible = "simple-bus";
> >> +		ranges = <0 0xf 0xf4000000 0x200000>;
> >> +
> >> +		bman-portal@0 {
> >> +			compatible = "fsl,bman-portal-1.0.0", "fsl,bman-portal";
> >> +			reg = <0x0 0x4000 0x100000 0x1000>;
> > 
> > It would be easier to read is each entry had its own set of brackets.
> > Initially this looked to me like a single 64-bit address/size pair.
> 
> Something like <>, <>?

So here we'd have:

	reg = <0x000000 0x4000>,
	      <0x100000 0x1000>;

> It doesn't seem widely used but I agree is more readable. I can
> include it in the the next spin

Thanks.

> 
> >> +			interrupts = <105 2 0 0>;
> >> +		};
> > 
> > Given the description above, surely you need to know what the portal is
> > used for? Or is that queried from the portal?
> 
> We don't need/want to include such information in the DT. Portals are
> "allocated" dynamically and used by the respective context

Ok. So they have no fixed purpose and software allocates as necessary?
There are no constraints on how each portal may be used, or which portal
another agetn might use?

Thanks,
Mark.

^ permalink raw reply

* Re: [PATCH] drivers: depend on instead of select BACKLIGHT_CLASS_DEVICE and ACPI_VIDEO
From: Daniel Vetter @ 2014-10-23  8:10 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Jean-Christophe Plagniol-Villard, linux-fbdev, Jingoo Han,
	Daniel Drake, Jens Frederich, Jani Nikula, Greg Kroah-Hartman,
	Jon Nettleton, linux-usb, linux-kernel, dri-devel,
	platform-driver-x86, Lee Jones, Randy Dunlap, Daniel Vetter,
	Darren Hart, Bryan Wu, linuxppc-dev, Laurent Pinchart
In-Reply-To: <54476492.6090105@ti.com>

On Wed, Oct 22, 2014 at 11:02:26AM +0300, Tomi Valkeinen wrote:
> On 18/10/14 00:13, Jani Nikula wrote:
> > Documentation/kbuild/kconfig-language.txt warns to use select with care,
> > and in general use select only for non-visible symbols and for symbols
> > with no dependencies, because select will force a symbol to a value
> > without visiting the dependencies.
> > 
> > Select has become particularly problematic, interdependently, with the
> > BACKLIGHT_CLASS_DEVICE and ACPI_VIDEO configs. For example:
> > 
> > scripts/kconfig/conf --randconfig Kconfig
> > KCONFIG_SEED=0x48312B00
> > warning: (DRM_RADEON && DRM_NOUVEAU && DRM_I915 && DRM_GMA500 &&
> > DRM_SHMOBILE && DRM_TILCDC && FB_BACKLIGHT && FB_MX3 && USB_APPLEDISPLAY
> > && FB_OLPC_DCON && ASUS_LAPTOP && SONY_LAPTOP && THINKPAD_ACPI &&
> > EEEPC_LAPTOP && ACPI_CMPC && SAMSUNG_Q10) selects BACKLIGHT_CLASS_DEVICE
> > which has unmet direct dependencies (HAS_IOMEM && BACKLIGHT_LCD_SUPPORT)
> > warning: (DRM_RADEON && DRM_NOUVEAU && DRM_I915 && DRM_GMA500 &&
> > DRM_SHMOBILE && DRM_TILCDC && FB_BACKLIGHT && FB_MX3 && USB_APPLEDISPLAY
> > && FB_OLPC_DCON && ASUS_LAPTOP && SONY_LAPTOP && THINKPAD_ACPI &&
> > EEEPC_LAPTOP && ACPI_CMPC && SAMSUNG_Q10) selects BACKLIGHT_CLASS_DEVICE
> > which has unmet direct dependencies (HAS_IOMEM && BACKLIGHT_LCD_SUPPORT)
> > 
> > With tristates it's possible to end up selecting FOO=y depending on
> > BAR=m in the config, which gets discovered at build time, not config
> > time, like reported in the thread referenced below.
> > 
> > Do the following to fix the dependencies:
> > 
> > * Depend on instead of select BACKLIGHT_CLASS_DEVICE everywhere. Drop
> >   select BACKLIGHT_LCD_SUPPORT in such cases, as it's a dependency of
> >   BACKLIGHT_CLASS_DEVICE.
> > 
> > * Remove config FB_BACKLIGHT altogether, and replace it with a
> >   dependency on BACKLIGHT_CLASS_DEVICE. All configs selecting
> >   FB_BACKLIGHT select or depend on FB anyway, so we can simplify.
> > 
> > * Depend on (ACPI && ACPI_VIDEO) || ACPI=n in several places instead of
> >   selecting ACPI_VIDEO and a number of its dependencies if ACPI is
> >   enabled. This is tied to backlight, as ACPI_VIDEO depends on
> >   BACKLIGHT_CLASS_DEVICE.
> > 
> > * Replace a couple of select INPUT/VT with depends as it seemed to be
> >   necessary.
> 
> While doing 'depends on' instead of 'select' is an "easy" fix for this,
> I do dislike it quite a bit. It's a major pain to go around the kernel
> config, trying to find all the dependencies that a particular driver
> wants. If I need fb-foobar, I should just be able to enable it, instead
> of first searching and selecting its minor dependencies individually.
> 
> So, not a NACK, but a "isn't there an another way to fix this?".
> 
> Looking at backlight... BACKLIGHT_LCD_SUPPORT seems to be a "meta"
> option, it only enables a Kconfig submenu.
> 
> So I think we could just remove the whole BACKLIGHT_LCD_SUPPORT option.
> But if we do that, all the items in drivers/video/backlight/Kconfig with
> default 'y' or 'm' would get enabled by default, so I think we should
> remove the 'default's from that file. That makes sense in any case, as I
> don't see why "HP Jornada 700 series LCD Driver" should be "default y".
> 
> BACKLIGHT_CLASS_DEVICE doesn't depend on anything except
> BACKLIGHT_LCD_SUPPORT, so after removing BACKLIGHT_LCD_SUPPORT it should
> be safe to 'select' BACKLIGHT_CLASS_DEVICE.
> 
> BACKLIGHT_CLASS_DEVICE could be made a hidden option, and the drivers in
> drivers/video/backlight/Kconfig which are under BACKLIGHT_CLASS_DEVICE
> could be made to select BACKLIGHT_CLASS_DEVICE instead.
> 
> That doesn't exactly fix anything, but I think it makes sense as
> BACKLIGHT_CLASS_DEVICE is something that's selected from all around the
> kernel, so it should be a selectable "library" instead of a Kconfig menu
> option.
> 
> I didn't look at the ACPI_VIDEO side, so no idea how messy that is.

If we want to make BACKLIGHT_CLASS_DEVICE into a library thing then I
guess we could do that, but we must then also drag it out of all the other
meta options to make sure it's always available. No need I think to ditch
the entire BACKLIGHT_LCD_SUPPORT meta option. And then everyone could
select it.

The problem is if you mix depends and select Kconfig falls over and starts
to see loops where there are none. So you really can't ever mix them for
the same symbol.

I think if we get the BACKLIGHT_CLASS_DEVICE out of the picture with that
ACPI_VIDEO should be fixable with some

	select ACPI_VIDEO if ACPI

or so. Currently that doesn't work because of the backlight class knob and
select being broken.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

^ permalink raw reply

* Re: [PATCH V2 1/2] mm: Update generic gup implementation to handle hugepage directory
From: Aneesh Kumar K.V @ 2014-10-23  8:08 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Andrea Arcangeli, linux-arch, Steve Capper, linux-kernel,
	linux-mm, linuxppc-dev
In-Reply-To: <20141022160224.9c2268795e55d5a2eff5b94d@linux-foundation.org>

Andrew Morton <akpm@linux-foundation.org> writes:

> On Fri, 17 Oct 2014 10:08:06 +0530 "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com> wrote:
>
>> Update generic gup implementation with powerpc specific details.
>> On powerpc at pmd level we can have hugepte, normal pmd pointer
>> or a pointer to the hugepage directory.
>> 
>> ...
>>
>> --- a/arch/arm/include/asm/pgtable.h
>> +++ b/arch/arm/include/asm/pgtable.h
>> @@ -181,6 +181,8 @@ extern pgd_t swapper_pg_dir[PTRS_PER_PGD];
>>  /* to find an entry in a kernel page-table-directory */
>>  #define pgd_offset_k(addr)	pgd_offset(&init_mm, addr)
>>  
>> +#define pgd_huge(pgd)		(0)
>> +
>>  #define pmd_none(pmd)		(!pmd_val(pmd))
>>  #define pmd_present(pmd)	(pmd_val(pmd))
>>  
>> diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h
>> index cefd3e825612..ed8f42497ac4 100644
>> --- a/arch/arm64/include/asm/pgtable.h
>> +++ b/arch/arm64/include/asm/pgtable.h
>> @@ -464,6 +464,8 @@ static inline pmd_t pmd_modify(pmd_t pmd, pgprot_t newprot)
>>  extern pgd_t swapper_pg_dir[PTRS_PER_PGD];
>>  extern pgd_t idmap_pg_dir[PTRS_PER_PGD];
>>  
>> +#define pgd_huge(pgd)		(0)
>> +
>
> So only arm, arm64 and powerpc implement CONFIG_HAVE_GENERIC_RCU_GUP
> and only powerpc impements pgd_huge().
>
> Could we get a bit of documentation in place for pgd_huge() so that
> people who aren't familiar with powerpc can understand what's going
> on?


I ended up moving that to include/linux/hugetlb.h with the below
comments added. Let me know if the below is ok 

/*
 * hugepages at page global directory. If arch support
 * hugepages at pgd level, they need to define this.
 */
#ifndef pgd_huge
#define pgd_huge(x)	0
#endif

#ifndef is_hugepd
/*
 * Some architectures requires a hugepage directory format that is
 * required to support multiple hugepage sizes. For example
 * a4fe3ce7699bfe1bd88f816b55d42d8fe1dac655 introduced the same
 * on powerpc. This allows for a more flexible hugepage pagetable
 * layout.
 */
typedef struct { unsigned long pd; } hugepd_t;
#define is_hugepd(hugepd) (0)
#define __hugepd(x) ((hugepd_t) { (x) })
static inline int gup_huge_pd(hugepd_t hugepd, unsigned long addr,
			      unsigned pdshift, unsigned long end,
			      int write, struct page **pages, int *nr)
{
	return 0;
}
#else
extern int gup_huge_pd(hugepd_t hugepd, unsigned long addr,
		       unsigned pdshift, unsigned long end,
		       int write, struct page **pages, int *nr);
#endif


-aneesh

^ permalink raw reply

* Re: [PATCH v3 00/27] Use MSI chip framework to configure MSI/MSI-X in all platforms
From: Yijing Wang @ 2014-10-23  7:45 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: linux-mips, linux-ia64, linux-pci, Bharat.Bhushan, Thierry Reding,
	sparclinux, linux-arch, linux-s390, Russell King, Joerg Roedel,
	x86, Sebastian Ott, xen-devel, arnab.basu, Liviu Dudau,
	Arnd Bergmann, Konrad Rzeszutek Wilk, Chris Metcalf,
	Thomas Gleixner, linux-arm-kernel, Thomas Petazzoni, Xinwei Hu,
	Tony Luck, Sergei Shtylyov, linux-kernel, Ralf Baechle, iommu,
	David Vrabel, Wuyun, linuxppc-dev, David S. Miller, Lucas Stach
In-Reply-To: <20141023054326.GF4795@google.com>

>> v1->v2:
>> Add a patch to make s390 MSI code build happy between patch "x86/xen/MSI: E.."
>> and "s390/MSI: Use MSI..". Fix several typo problems found by Lucas.
>>
>> RFC->v1: 
>> Updated "[patch 4/21] x86/xen/MSI: Eliminate...", export msi_chip instead
>> of #ifdef to fix MSI bug in xen running in x86. 
>> Rename arch_get_match_msi_chip() to arch_find_msi_chip().
>> Drop use struct device as the msi_chip argument, we will do that
>> later in another patchset.
>>
>> Yijing Wang (27):
> 
> This is a lot of stuff, and it's not all related, so putting it all
> together in one series makes it hard for me to deal with it.
> 
>>   MSI: Remove the redundant irq_set_chip_data()

OK, will post it out separately.

> 
> This doesn't seem related to eliminating weak functions.
> 
>>   x86/xen/MSI: Eliminate arch_msix_mask_irq() and arch_msi_mask_irq()
>>   s390/MSI: Use __msi_mask_irq() instead of default_msi_mask_irq()

Will update your comments and post these together.

> 
> These two seem to go together.
> 
>>   arm/MSI: Save MSI chip in pci_sys_data
>>   PCI: tegra: Save msi chip in pci_sys_data
>>   PCI: designware: Save msi chip in pci_sys_data
>>   PCI: rcar: Save msi chip in pci_sys_data
>>   PCI: mvebu: Save msi chip in pci_sys_data
>>   arm/PCI: Clean unused pcibios_add_bus() and pcibios_remove_bus()
>>   PCI/MSI: Remove useless bus->msi assignment
> 
> These seem to go together (it'd be nice if they were all capitalized the
> same).

OK, will update the titles and post together.

> 
> I don't like the "msi_chip" name because the "chip" part doesn't convey
> much information, other than telling us that apparently some sort of
> semiconductor integrated circuit is involved.  I sort of assumed that
> much :)

I think so, msi_chip easily make me confuse with x86 irq_chip msi_chip.

> 
> Something like "msi_controller" would be more descriptive since we're
> talking about an interrupt controller that accepts writes from a device and
> turns them into CPU interrupts, e.g., a LAPIC.

Hm, it's a better one, arm also use "msi-controller" to represent the msi related
object in DTS file.


> 
>>   PCI/MSI: Refactor struct msi_chip to make it become more common
>>   x86/MSI: Use MSI chip framework to configure MSI/MSI-X irq
>>   x86/xen/MSI: Use MSI chip framework to configure MSI/MSI-X irq
>>   Irq_remapping/MSI: Use MSI chip framework to configure MSI/MSI-X irq
>>   x86/MSI: Remove unused MSI weak arch functions
>>   Mips/MSI: Save msi chip in pci sysdata
>>   MIPS/Octeon/MSI: Use MSI chip framework to configure MSI/MSI-X irq
>>   MIPS/Xlp: Remove the dead function destroy_irq() to fix build error
>>   MIPS/Xlp/MSI: Use MSI chip framework to configure MSI/MSI-X irq
>>   MIPS/Xlr/MSI: Use MSI chip framework to configure MSI/MSI-X irq
>>   Powerpc/MSI: Use MSI chip framework to configure MSI/MSI-X irq
>>   s390/MSI: Use MSI chip framework to configure MSI/MSI-X irq
>>   arm/iop13xx/MSI: Use MSI chip framework to configure MSI/MSI-X irq
>>   IA64/MSI: Use MSI chip framework to configure MSI/MSI-X irq
>>   Sparc/MSI: Use MSI chip framework to configure MSI/MSI-X irq
>>   tile/MSI: Use MSI chip framework to configure MSI/MSI-X irq
>>   PCI/MSI: Clean up unused MSI arch functions
>>
>>  arch/arm/include/asm/mach/pci.h                 |   10 +-
>>  arch/arm/include/asm/pci.h                      |    9 ++
>>  arch/arm/kernel/bios32.c                        |   19 +---
>>  arch/arm/mach-iop13xx/include/mach/pci.h        |    4 +
>>  arch/arm/mach-iop13xx/iq81340mc.c               |    3 +
>>  arch/arm/mach-iop13xx/iq81340sc.c               |    5 +-
>>  arch/arm/mach-iop13xx/msi.c                     |   11 ++-
>>  arch/ia64/include/asm/pci.h                     |   10 ++
>>  arch/ia64/kernel/msi_ia64.c                     |   14 ++-
>>  arch/ia64/pci/pci.c                             |    1 +
>>  arch/mips/include/asm/netlogic/xlp-hal/pcibus.h |    1 +
>>  arch/mips/include/asm/octeon/pci-octeon.h       |    4 +
>>  arch/mips/include/asm/pci.h                     |   14 +++
>>  arch/mips/pci/msi-octeon.c                      |   31 +++---
>>  arch/mips/pci/msi-xlp.c                         |   15 ++-
>>  arch/mips/pci/pci-octeon.c                      |    3 +
>>  arch/mips/pci/pci-xlp.c                         |    3 +
>>  arch/mips/pci/pci-xlr.c                         |   17 +++-
>>  arch/powerpc/include/asm/pci-bridge.h           |   15 +++
>>  arch/powerpc/kernel/msi.c                       |   12 ++-
>>  arch/powerpc/kernel/pci-common.c                |    3 +
>>  arch/s390/include/asm/pci.h                     |    9 ++
>>  arch/s390/pci/pci.c                             |   16 ++-
>>  arch/sparc/kernel/pci.c                         |   14 ++-
>>  arch/sparc/kernel/pci_impl.h                    |   12 ++
>>  arch/tile/include/asm/pci.h                     |   10 ++
>>  arch/tile/kernel/pci_gx.c                       |   13 ++-
>>  arch/x86/include/asm/pci.h                      |   18 +++-
>>  arch/x86/include/asm/x86_init.h                 |    7 --
>>  arch/x86/kernel/apic/io_apic.c                  |   12 ++-
>>  arch/x86/kernel/x86_init.c                      |   34 ------
>>  arch/x86/pci/acpi.c                             |    1 +
>>  arch/x86/pci/common.c                           |    3 +
>>  arch/x86/pci/xen.c                              |   72 +++++++------
>>  drivers/iommu/irq_remapping.c                   |   13 ++-
>>  drivers/pci/host/pci-mvebu.c                    |   10 +--
>>  drivers/pci/host/pci-tegra.c                    |   13 +--
>>  drivers/pci/host/pcie-designware.c              |   15 +--
>>  drivers/pci/host/pcie-rcar.c                    |   13 +--
>>  drivers/pci/msi.c                               |  133 ++++++++++-------------
>>  drivers/pci/probe.c                             |    1 -
>>  include/linux/msi.h                             |   24 ++---
>>  include/linux/pci.h                             |    1 +
>>  43 files changed, 379 insertions(+), 269 deletions(-)
> 
> Huh.  I was hoping this was going to simplify things, and maybe it does
> somehow, but it's unfortunate that it adds 110 lines of code overall.  Does
> that seem right to you?  Why does it add code?

I filter out these patches which add code.

[PATCH v3 04/27] arm/MSI: Save MSI chip in pci_sys_data
 5 files changed, 33 insertions(+), 0 deletions(-)
Insertions code mainly to introduce arch specific pci_msi_chip() to extract msi_chip from pci_sys_data, and temporary #ifdef

[PATCH v3 11/27] PCI/MSI: Refactor struct msi_chip to make it become more common
 2 files changed, 19 insertions(+), 0 deletions(-)
Insertions here is to add msi ops like restore, teardown to msi_chip.

[PATCH v3 12/27] x86/MSI: Use MSI chip framework to configure MSI/MSI-X irq
 4 files changed, 36 insertions(+), 0 deletions(-)
Arch specific pci_msi_chip() and declaration of msi_chip in x86, also some temporary code to compile ok.

[PATCH v3 13/27] x86/xen/MSI: Use MSI chip framework to configure MSI/MSI-X irq
 1 files changed, 39 insertions(+), 19 deletions(-)
To avoid call default_teardown_msi_irq(), copy the default_teardown_msi_irq() code in this file.

[PATCH v3 16/27] Mips/MSI: Save msi chip in pci sysdata
 1 files changed, 14 insertions(+), 0 deletions(-)
Arch specific pci_msi_chip() and some #ifdef code

[PATCH v3 17/27] MIPS/Octeon/MSI: Use MSI chip framework to configure MSI/MSI-X irq
 3 files changed, 25 insertions(+), 13 deletions(-)

Archs Use msi chip framework to configure MSI/MSI-x
 3 files changed, 13 insertions(+), 2 deletions(-)
 1 files changed, 15 insertions(+), 2 deletions(-)
 3 files changed, 28 insertions(+), 2 deletions(-)
 2 files changed, 19 insertions(+), 2 deletions(-)
 4 files changed, 20 insertions(+), 3 deletions(-)
 3 files changed, 21 insertions(+), 4 deletions(-)
 2 files changed, 24 insertions(+), 2 deletions(-)
 2 files changed, 21 insertions(+), 2 deletions(-)

So the most adding code is to introduce arch specific pci_msi_chip(), this one will be removed after we make
pci_host_bridge generic and save msi_chip in it. There are also lots of #ifdef in arm code for msi_chip.

> 
> Who do you want to apply this?  I can take it if that makes the most sense,

I hope you can apply this.

> but I'd like acks from the architecture folks for their pieces, and
> especially one from Thomas for the overall direction and the x86 parts.

OK.

> 
> If you want me to take this, can you refresh it to be based on v3.18-rc1?
> I tried to apply it on v3.18-rc1, but [15/27] didn't apply because of
> conflicts in arch/x86/kernel/apic/io_apic.c.

OK.

> 
> I'll look at these more tomorrow, I'm getting bleary-eyed tonight.

Thanks for your review and comments very much!

Thanks!
Yijing.

> 
> Bjorn
> 
> .
> 


-- 
Thanks!
Yijing

^ permalink raw reply

* Re: [PATCH v3 10/27] PCI/MSI: Remove useless bus->msi assignment
From: Yijing Wang @ 2014-10-23  6:40 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: linux-mips, linux-ia64, linux-pci, Bharat.Bhushan, Thierry Reding,
	sparclinux, linux-arch, linux-s390, Russell King, Joerg Roedel,
	x86, Sebastian Ott, xen-devel, arnab.basu, Liviu Dudau,
	Arnd Bergmann, Konrad Rzeszutek Wilk, Chris Metcalf,
	Thomas Gleixner, linux-arm-kernel, Thomas Petazzoni, Xinwei Hu,
	Tony Luck, Sergei Shtylyov, linux-kernel, Ralf Baechle, iommu,
	David Vrabel, Wuyun, linuxppc-dev, David S. Miller, Lucas Stach
In-Reply-To: <20141023054121.GE11770@google.com>

On 2014/10/23 13:41, Bjorn Helgaas wrote:
> On Wed, Oct 15, 2014 at 11:06:58AM +0800, Yijing Wang wrote:
>> Now msi chip is saved in pci_sys_data in arm,
>> we could clean the bus->msi assignment in
>> pci core.
>>
>> Signed-off-by: Yijing Wang <wangyijing@huawei.com>
>> CC: Thierry Reding <thierry.reding@gmail.com>
>> CC: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
>> ---
>>  drivers/pci/probe.c |    1 -
>>  1 files changed, 0 insertions(+), 1 deletions(-)
>>
>> diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
>> index efa48dc..98bf4c3 100644
>> --- a/drivers/pci/probe.c
>> +++ b/drivers/pci/probe.c
>> @@ -682,7 +682,6 @@ static struct pci_bus *pci_alloc_child_bus(struct pci_bus *parent,
>>  
>>  	child->parent = parent;
>>  	child->ops = parent->ops;
>> -	child->msi = parent->msi;
> 
> This needs an explanation of why ARM was the only arch to depend on this.

OK, will add explanation in next version.

> 
>>  	child->sysdata = parent->sysdata;
>>  	child->bus_flags = parent->bus_flags;
>>  
>> -- 
>> 1.7.1
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-pci" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> .
> 


-- 
Thanks!
Yijing

^ permalink raw reply

* Re: [PATCH v3 09/27] arm/PCI: Clean unused pcibios_add_bus() and pcibios_remove_bus()
From: Yijing Wang @ 2014-10-23  6:39 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: linux-mips, linux-ia64, linux-pci, Bharat.Bhushan, Thierry Reding,
	sparclinux, linux-arch, linux-s390, Russell King, Joerg Roedel,
	x86, Sebastian Ott, xen-devel, arnab.basu, Liviu Dudau,
	Arnd Bergmann, Konrad Rzeszutek Wilk, Chris Metcalf,
	Thomas Gleixner, linux-arm-kernel, Thomas Petazzoni, Xinwei Hu,
	Tony Luck, Sergei Shtylyov, linux-kernel, Ralf Baechle, iommu,
	David Vrabel, Wuyun, linuxppc-dev, David S. Miller, Lucas Stach
In-Reply-To: <20141023053858.GD11770@google.com>

>>  /*
>>   * Swizzle the device pin each time we cross a bridge.  If a platform does
>>   * not provide a swizzle function, we perform the standard PCI swizzling.
>> @@ -478,8 +464,6 @@ static void pcibios_init_hw(struct device *parent, struct hw_pci *hw,
>>  		sys->swizzle = hw->swizzle;
>>  		sys->map_irq = hw->map_irq;
>>  		sys->align_resource = hw->align_resource;
>> -		sys->add_bus = hw->add_bus;
>> -		sys->remove_bus = hw->remove_bus;
>>  		INIT_LIST_HEAD(&sys->resources);
>>  
>>  		if (hw->private_data)
> 
> What do the core changes below have to do with the ARM changes above?
> They should be a separate patch unless they can't be separated.

Hm, it's not the thing have to do, because the changes below is only used by arm arch, so I put it here
together. It's ok to split the core changes out to another one.

> 
>> diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
>> index f11108c..56e54ad 100644
>> --- a/drivers/pci/msi.c
>> +++ b/drivers/pci/msi.c
>> @@ -32,12 +32,10 @@ int pci_msi_ignore_mask;
>>  
>>  int __weak arch_setup_msi_irq(struct pci_dev *dev, struct msi_desc *desc)
>>  {
>> -	struct msi_chip *chip = dev->bus->msi;
>> +	struct msi_chip *chip;
>>  	int err;
>>  
>> -	if (!chip)
>> -		chip = pci_msi_chip(dev->bus);
>> -
>> +	chip = pci_msi_chip(dev->bus);
>>  	if (!chip || !chip->setup_irq)
>>  		return -EINVAL;
>>  
>> @@ -51,10 +49,7 @@ int __weak arch_setup_msi_irq(struct pci_dev *dev, struct msi_desc *desc)
>>  void __weak arch_teardown_msi_irq(unsigned int irq)
>>  {
>>  	struct msi_desc *entry = irq_get_msi_desc(irq);
>> -	struct msi_chip *chip = entry->dev->bus->msi;
>> -
>> -	if (!chip)
>> -		chip = pci_msi_chip(entry->dev->bus);
>> +	struct msi_chip *chip = pci_msi_chip(entry->dev->bus);
>>  
>>  	if (!chip || !chip->teardown_irq)
>>  		return;
>> -- 
>> 1.7.1
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-pci" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> .
> 


-- 
Thanks!
Yijing

^ permalink raw reply

* Re: [PATCH v3 04/27] arm/MSI: Save MSI chip in pci_sys_data
From: Yijing Wang @ 2014-10-23  6:32 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: linux-mips, linux-ia64, linux-pci, Bharat.Bhushan, Thierry Reding,
	sparclinux, linux-arch, linux-s390, Russell King, Joerg Roedel,
	x86, Sebastian Ott, xen-devel, arnab.basu, Liviu Dudau,
	Arnd Bergmann, Konrad Rzeszutek Wilk, Chris Metcalf,
	Thomas Gleixner, linux-arm-kernel, Thomas Petazzoni, Xinwei Hu,
	Tony Luck, Sergei Shtylyov, linux-kernel, Ralf Baechle, iommu,
	David Vrabel, Wuyun, linuxppc-dev, David S. Miller, Lucas Stach
In-Reply-To: <20141023053555.GC11770@google.com>

>> diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
>> index 22e413c..f11108c 100644
>> --- a/drivers/pci/msi.c
>> +++ b/drivers/pci/msi.c
>> @@ -35,6 +35,9 @@ int __weak arch_setup_msi_irq(struct pci_dev *dev, struct msi_desc *desc)
>>  	struct msi_chip *chip = dev->bus->msi;
>>  	int err;
>>  
>> +	if (!chip)
>> +		chip = pci_msi_chip(dev->bus);
>> +
>>  	if (!chip || !chip->setup_irq)
>>  		return -EINVAL;
>>  
>> @@ -50,6 +53,9 @@ void __weak arch_teardown_msi_irq(unsigned int irq)
>>  	struct msi_desc *entry = irq_get_msi_desc(irq);
>>  	struct msi_chip *chip = entry->dev->bus->msi;
>>  
>> +	if (!chip)
>> +		chip = pci_msi_chip(entry->dev->bus);
>> +
>>  	if (!chip || !chip->teardown_irq)
>>  		return;
>>  
>> diff --git a/include/linux/pci.h b/include/linux/pci.h
>> index 9cd2721..7a48b40 100644
>> --- a/include/linux/pci.h
>> +++ b/include/linux/pci.h
>> @@ -1433,6 +1433,15 @@ static inline int pci_get_new_domain_nr(void) { return -ENOSYS; }
>>  
>>  #include <asm/pci.h>
>>  
>> +/* Just avoid compile error, will be clean up later */
>> +#ifdef CONFIG_PCI_MSI
>> +
>> +#ifndef pci_msi_chip
>> +#define pci_msi_chip(bus)	NULL
>> +#endif
>> +#endif
> 
> I don't like the mixture of ARM changes and PCI core changes in the same
> patch.  Can you split this into a core patch that does something like this:
> 
>   struct msi_chip * __weak pcibios_msi_controller(struct pci_bus *bus)
>   {
>     return NULL;
>   }
> 
>   struct msi_chip *pci_msi_controller(struct pci_bus *bus)
>   {
>     msi_chip *controller = bus->msi;
> 
>     if (controller)
>       return controller;
>     return pcibios_msi_controller(bus);
>   }
> 
> followed by an ARM patch that puts the msi_chip pointer in struct hw_pci
> and implements pcibios_msi_controller()?

OK, I will split it in half.

> 
> I know you're trying to *remove* weak functions, and this adds one, but
> this section of the series is more about getting rid of the ARM
> pcibios_add_bus() because all it was used for was setting the bus->msi
> pointer.

Yes, agree.

> 
> Eventually we might have a way to stash an MSI controller pointer in the
> generic pci_host_bridge struct, and then the pcibios_msi_controller()
> interface could go away.

Yep, I am doing the work to make a generic pci_host_bridge, and try to rip it out from
pci_create_root_bus, that's also a large changes across many archs.

> 
>> +
>>  /* these helpers provide future and backwards compatibility
>>   * for accessing popular PCI BAR info */
>>  #define pci_resource_start(dev, bar)	((dev)->resource[(bar)].start)
>> -- 
>> 1.7.1
>>
> 
> .
> 


-- 
Thanks!
Yijing

^ permalink raw reply

* Re: [PATCH v3 05/27] PCI: tegra: Save msi chip in pci_sys_data
From: Yijing Wang @ 2014-10-23  6:23 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: linux-mips, linux-ia64, linux-pci, Bharat.Bhushan, Thierry Reding,
	sparclinux, linux-arch, linux-s390, Russell King, Joerg Roedel,
	x86, Sebastian Ott, xen-devel, arnab.basu, Liviu Dudau,
	Arnd Bergmann, Konrad Rzeszutek Wilk, Chris Metcalf,
	Thomas Gleixner, linux-arm-kernel, Thomas Petazzoni, Xinwei Hu,
	Tony Luck, Sergei Shtylyov, linux-kernel, Ralf Baechle, iommu,
	David Vrabel, Wuyun, linuxppc-dev, David S. Miller, Lucas Stach
In-Reply-To: <20141023051831.GB11770@google.com>

On 2014/10/23 13:18, Bjorn Helgaas wrote:
> On Wed, Oct 15, 2014 at 11:06:53AM +0800, Yijing Wang wrote:
>> Save msi chip in pci_sys_data instead of assign
>> msi chip to every pci bus in .add_bus().
>>
>> Signed-off-by: Yijing Wang <wangyijing@huawei.com>
>> ---
>>  drivers/pci/host/pci-tegra.c |   13 +++----------
>>  1 files changed, 3 insertions(+), 10 deletions(-)
>>
>> diff --git a/drivers/pci/host/pci-tegra.c b/drivers/pci/host/pci-tegra.c
>> index 3d43874..5af0525 100644
>> --- a/drivers/pci/host/pci-tegra.c
>> +++ b/drivers/pci/host/pci-tegra.c
>> @@ -694,15 +694,6 @@ static int tegra_pcie_map_irq(const struct pci_dev *pdev, u8 slot, u8 pin)
>>  	return irq;
>>  }
>>  
>> -static void tegra_pcie_add_bus(struct pci_bus *bus)
>> -{
>> -	if (IS_ENABLED(CONFIG_PCI_MSI)) {
>> -		struct tegra_pcie *pcie = sys_to_pcie(bus->sysdata);
>> -
>> -		bus->msi = &pcie->msi.chip;
>> -	}
>> -}
>> -
>>  static struct pci_bus *tegra_pcie_scan_bus(int nr, struct pci_sys_data *sys)
>>  {
>>  	struct tegra_pcie *pcie = sys_to_pcie(sys);
>> @@ -1881,11 +1872,13 @@ static int tegra_pcie_enable(struct tegra_pcie *pcie)
>>  
>>  	memset(&hw, 0, sizeof(hw));
>>  
>> +#ifdef CONFIG_PCI_MSI
>> +	hw.msi_chip = &pcie->msi.chip;
>> +#endif
> 
> Why did you use "#ifdef CONFIG_PCI_MSI" instead of the
> "IS_ENABLED(CONFIG_PCI_MSI)" used previously?

Just personal habit. :)

> 
> It's true that CONFIG_PCI_MSI will never be a tristate symbol, so we don't
> really *need* the extra smarts of IS_ENABLED(), but I'm fairly sympathetic
> to James' argument [1] that we should just use IS_ENABLED() all the time
> because it's simpler overall.
> 
> If you want to change the #ifdef to IS_ENABLED(), that should be a separate
> patch from your msi_chip change, and we can debate the merits of that by
> itself.
> 
> [1] http://lkml.iu.edu//hypermail/linux/kernel/1204.3/00081.html

Hi Bjorn, thanks for your guidance. I will use IS_ENABLED() instead of #ifdef for simplification
in a separate patch.

> 
>>  	hw.nr_controllers = 1;
>>  	hw.private_data = (void **)&pcie;
>>  	hw.setup = tegra_pcie_setup;
>>  	hw.map_irq = tegra_pcie_map_irq;
>> -	hw.add_bus = tegra_pcie_add_bus;
>>  	hw.scan = tegra_pcie_scan_bus;
>>  	hw.ops = &tegra_pcie_ops;
>>  
>> -- 
>> 1.7.1
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>> Please read the FAQ at  http://www.tux.org/lkml/
> 
> .
> 


-- 
Thanks!
Yijing

^ permalink raw reply

* Re: [PATCH v3 00/27] Use MSI chip framework to configure MSI/MSI-X in all platforms
From: Bjorn Helgaas @ 2014-10-23  5:43 UTC (permalink / raw)
  To: Yijing Wang
  Cc: linux-mips, linux-ia64, linux-pci, Bharat.Bhushan, Thierry Reding,
	sparclinux, linux-arch, linux-s390, Russell King, Joerg Roedel,
	x86, Sebastian Ott, xen-devel, arnab.basu, Liviu Dudau,
	Arnd Bergmann, Konrad Rzeszutek Wilk, Chris Metcalf,
	Thomas Gleixner, linux-arm-kernel, Thomas Petazzoni, Xinwei Hu,
	Tony Luck, Sergei Shtylyov, linux-kernel, Ralf Baechle, iommu,
	David Vrabel, Wuyun, linuxppc-dev, David S. Miller, Lucas Stach
In-Reply-To: <1413342435-7876-1-git-send-email-wangyijing@huawei.com>

On Wed, Oct 15, 2014 at 11:06:48AM +0800, Yijing Wang wrote:
> Now there are a lot of weak arch functions in MSI code.
> Thierry Reding Introduced MSI chip framework to configure MSI/MSI-X in arm,
> that's a better solution than overriding lots of existing weak arch functionsin. 
> This series use MSI chip framework to refactor MSI code across all platforms 
> to eliminate weak arch functions. Then all MSI irqs will be managed in a 
> unified framework. Because this series changed a lot of ARCH MSI code, 
> so tests in the related platforms are warmly welcomed!
> 
> And you may access it at:
> https://github.com/YijingWang/msi-chip-v3.git master
> 
> v2->v3:
> 1. For patch "x86/xen/MSI: Eliminate...", introduce a new global flag "pci_msi_ignore_mask"
> to control the msi mask instead of replacing the irqchip->mask with nop function,
> the latter method has problem pointed out by Konrad Rzeszutek Wilk.
> 2. Save msi chip in arch pci sysdata instead of associating msi chip to pci bus.
> Because pci devices under same host share the same msi chip, so I think associate
> msi chip to pci host/pci sysdata is better than to bother every pci bus/devices.
> A better solution suggested by Liviu is to rip out pci_host_bridge from pci_create_root_bus(), 
> then we can save some pci host common attributes like domain_nr, msi_chip, resources,
> into the generic pci_host_bridge. Because this changes to pci host bridge is also 
> a large series, so I think we should go step by step, I will try to post it in another
> series later.
> 4. Clean up arm pcibios_add_bus() and pcibios_remove_bus() which were used to associate
> msi chip to pci bus.
> 
> v1->v2:
> Add a patch to make s390 MSI code build happy between patch "x86/xen/MSI: E.."
> and "s390/MSI: Use MSI..". Fix several typo problems found by Lucas.
> 
> RFC->v1: 
> Updated "[patch 4/21] x86/xen/MSI: Eliminate...", export msi_chip instead
> of #ifdef to fix MSI bug in xen running in x86. 
> Rename arch_get_match_msi_chip() to arch_find_msi_chip().
> Drop use struct device as the msi_chip argument, we will do that
> later in another patchset.
> 
> Yijing Wang (27):

This is a lot of stuff, and it's not all related, so putting it all
together in one series makes it hard for me to deal with it.

>   MSI: Remove the redundant irq_set_chip_data()

This doesn't seem related to eliminating weak functions.

>   x86/xen/MSI: Eliminate arch_msix_mask_irq() and arch_msi_mask_irq()
>   s390/MSI: Use __msi_mask_irq() instead of default_msi_mask_irq()

These two seem to go together.

>   arm/MSI: Save MSI chip in pci_sys_data
>   PCI: tegra: Save msi chip in pci_sys_data
>   PCI: designware: Save msi chip in pci_sys_data
>   PCI: rcar: Save msi chip in pci_sys_data
>   PCI: mvebu: Save msi chip in pci_sys_data
>   arm/PCI: Clean unused pcibios_add_bus() and pcibios_remove_bus()
>   PCI/MSI: Remove useless bus->msi assignment

These seem to go together (it'd be nice if they were all capitalized the
same).

I don't like the "msi_chip" name because the "chip" part doesn't convey
much information, other than telling us that apparently some sort of
semiconductor integrated circuit is involved.  I sort of assumed that
much :)

Something like "msi_controller" would be more descriptive since we're
talking about an interrupt controller that accepts writes from a device and
turns them into CPU interrupts, e.g., a LAPIC.

>   PCI/MSI: Refactor struct msi_chip to make it become more common
>   x86/MSI: Use MSI chip framework to configure MSI/MSI-X irq
>   x86/xen/MSI: Use MSI chip framework to configure MSI/MSI-X irq
>   Irq_remapping/MSI: Use MSI chip framework to configure MSI/MSI-X irq
>   x86/MSI: Remove unused MSI weak arch functions
>   Mips/MSI: Save msi chip in pci sysdata
>   MIPS/Octeon/MSI: Use MSI chip framework to configure MSI/MSI-X irq
>   MIPS/Xlp: Remove the dead function destroy_irq() to fix build error
>   MIPS/Xlp/MSI: Use MSI chip framework to configure MSI/MSI-X irq
>   MIPS/Xlr/MSI: Use MSI chip framework to configure MSI/MSI-X irq
>   Powerpc/MSI: Use MSI chip framework to configure MSI/MSI-X irq
>   s390/MSI: Use MSI chip framework to configure MSI/MSI-X irq
>   arm/iop13xx/MSI: Use MSI chip framework to configure MSI/MSI-X irq
>   IA64/MSI: Use MSI chip framework to configure MSI/MSI-X irq
>   Sparc/MSI: Use MSI chip framework to configure MSI/MSI-X irq
>   tile/MSI: Use MSI chip framework to configure MSI/MSI-X irq
>   PCI/MSI: Clean up unused MSI arch functions
> 
>  arch/arm/include/asm/mach/pci.h                 |   10 +-
>  arch/arm/include/asm/pci.h                      |    9 ++
>  arch/arm/kernel/bios32.c                        |   19 +---
>  arch/arm/mach-iop13xx/include/mach/pci.h        |    4 +
>  arch/arm/mach-iop13xx/iq81340mc.c               |    3 +
>  arch/arm/mach-iop13xx/iq81340sc.c               |    5 +-
>  arch/arm/mach-iop13xx/msi.c                     |   11 ++-
>  arch/ia64/include/asm/pci.h                     |   10 ++
>  arch/ia64/kernel/msi_ia64.c                     |   14 ++-
>  arch/ia64/pci/pci.c                             |    1 +
>  arch/mips/include/asm/netlogic/xlp-hal/pcibus.h |    1 +
>  arch/mips/include/asm/octeon/pci-octeon.h       |    4 +
>  arch/mips/include/asm/pci.h                     |   14 +++
>  arch/mips/pci/msi-octeon.c                      |   31 +++---
>  arch/mips/pci/msi-xlp.c                         |   15 ++-
>  arch/mips/pci/pci-octeon.c                      |    3 +
>  arch/mips/pci/pci-xlp.c                         |    3 +
>  arch/mips/pci/pci-xlr.c                         |   17 +++-
>  arch/powerpc/include/asm/pci-bridge.h           |   15 +++
>  arch/powerpc/kernel/msi.c                       |   12 ++-
>  arch/powerpc/kernel/pci-common.c                |    3 +
>  arch/s390/include/asm/pci.h                     |    9 ++
>  arch/s390/pci/pci.c                             |   16 ++-
>  arch/sparc/kernel/pci.c                         |   14 ++-
>  arch/sparc/kernel/pci_impl.h                    |   12 ++
>  arch/tile/include/asm/pci.h                     |   10 ++
>  arch/tile/kernel/pci_gx.c                       |   13 ++-
>  arch/x86/include/asm/pci.h                      |   18 +++-
>  arch/x86/include/asm/x86_init.h                 |    7 --
>  arch/x86/kernel/apic/io_apic.c                  |   12 ++-
>  arch/x86/kernel/x86_init.c                      |   34 ------
>  arch/x86/pci/acpi.c                             |    1 +
>  arch/x86/pci/common.c                           |    3 +
>  arch/x86/pci/xen.c                              |   72 +++++++------
>  drivers/iommu/irq_remapping.c                   |   13 ++-
>  drivers/pci/host/pci-mvebu.c                    |   10 +--
>  drivers/pci/host/pci-tegra.c                    |   13 +--
>  drivers/pci/host/pcie-designware.c              |   15 +--
>  drivers/pci/host/pcie-rcar.c                    |   13 +--
>  drivers/pci/msi.c                               |  133 ++++++++++-------------
>  drivers/pci/probe.c                             |    1 -
>  include/linux/msi.h                             |   24 ++---
>  include/linux/pci.h                             |    1 +
>  43 files changed, 379 insertions(+), 269 deletions(-)

Huh.  I was hoping this was going to simplify things, and maybe it does
somehow, but it's unfortunate that it adds 110 lines of code overall.  Does
that seem right to you?  Why does it add code?

Who do you want to apply this?  I can take it if that makes the most sense,
but I'd like acks from the architecture folks for their pieces, and
especially one from Thomas for the overall direction and the x86 parts.

If you want me to take this, can you refresh it to be based on v3.18-rc1?
I tried to apply it on v3.18-rc1, but [15/27] didn't apply because of
conflicts in arch/x86/kernel/apic/io_apic.c.

I'll look at these more tomorrow, I'm getting bleary-eyed tonight.

Bjorn

^ permalink raw reply


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