LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH 1/4] pci/msi: Move "force_32bit_msi" flag from powerpc to generic pci_dev
From: Bjorn Helgaas @ 2014-10-01 20:33 UTC (permalink / raw)
  To: Benjamin Herrenschmidt
  Cc: linuxppc-dev, Dave Airlie, linux-pci, Anton Blanchard, Brian King,
	Yijing Wang, Takashi Iwai, Alex Deucher
In-Reply-To: <1412129363.4285.190.camel@pasglop>

On Wed, Oct 01, 2014 at 12:09:23PM +1000, Benjamin Herrenschmidt wrote:
> 
> Some devices have broken 64-bit MSI support which only support some
> address bits (40 to 48 typically). This doesn't work on some platforms
> such as POWER servers, so we need a quirk.
> 
> Currently we keep a flag in a powerpc specific data structure which we
> have per PCI device. However this is impractical as we really want the
> driver to set that flag appropriately (and the driver shouldn't touch
> that arch specific data structure).
> 
> It's also not unlikely that this limitation will affect other architectures
> in the long run so may as well be prepared for it.
> 
> So this moves the flag to struct pci_dev instead and adjusts the
> corresponding arch/powerpc code to look for it there. At this point,
> there is no attempt at making other architectures honor it just yet
> though from what I can tell, x86 seems to always use 32-bit addresses
> for MSIs.
> 
> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> CC: <stable@vger.kernel.org>
> ---
> 
> Note: CC'ing stable as I really want this to hit distros, without that
> (and the three subsequent patches), we crash during boot with a number
> of radeon cards on power machines.
> 
> Note2: Alex, we can wait for the response of the HW guys for which revisions
> actually need the quirk in hda_intel but I don't see a big risk or issue in
> just doing it for all AMD/ATI for now and fix that up later
> 
>  arch/powerpc/include/asm/pci-bridge.h     | 2 --
>  arch/powerpc/kernel/pci_64.c              | 5 +----
>  arch/powerpc/platforms/powernv/pci-ioda.c | 3 +--
>  arch/powerpc/platforms/powernv/pci.c      | 3 +--
>  arch/powerpc/platforms/pseries/msi.c      | 2 +-
>  include/linux/pci.h                       | 1 +
>  6 files changed, 5 insertions(+), 11 deletions(-)
> 
> diff --git a/arch/powerpc/include/asm/pci-bridge.h b/arch/powerpc/include/asm/pci-bridge.h
> index 4ca90a3..725247b 100644
> --- a/arch/powerpc/include/asm/pci-bridge.h
> +++ b/arch/powerpc/include/asm/pci-bridge.h
> @@ -159,8 +159,6 @@ struct pci_dn {
>  
>  	int	pci_ext_config_space;	/* for pci devices */
>  
> -	bool	force_32bit_msi;
> -
>  	struct	pci_dev *pcidev;	/* back-pointer to the pci device */
>  #ifdef CONFIG_EEH
>  	struct eeh_dev *edev;		/* eeh device */
> diff --git a/arch/powerpc/kernel/pci_64.c b/arch/powerpc/kernel/pci_64.c
> index 155013d..a6ce5fe 100644
> --- a/arch/powerpc/kernel/pci_64.c
> +++ b/arch/powerpc/kernel/pci_64.c
> @@ -269,10 +269,7 @@ EXPORT_SYMBOL(pcibus_to_node);
>  
>  static void quirk_radeon_32bit_msi(struct pci_dev *dev)
>  {
> -	struct pci_dn *pdn = pci_get_pdn(dev);
> -
> -	if (pdn)
> -		pdn->force_32bit_msi = true;
> +	dev->force_32bit_msi = true;
>  }
>  DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x68f2, quirk_radeon_32bit_msi);
>  DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0xaa68, quirk_radeon_32bit_msi);
> diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c
> index df241b1..9d98475 100644
> --- a/arch/powerpc/platforms/powernv/pci-ioda.c
> +++ b/arch/powerpc/platforms/powernv/pci-ioda.c
> @@ -1311,7 +1311,6 @@ static int pnv_pci_ioda_msi_setup(struct pnv_phb *phb, struct pci_dev *dev,
>  				  unsigned int is_64, struct msi_msg *msg)
>  {
>  	struct pnv_ioda_pe *pe = pnv_ioda_get_pe(dev);
> -	struct pci_dn *pdn = pci_get_pdn(dev);
>  	struct irq_data *idata;
>  	struct irq_chip *ichip;
>  	unsigned int xive_num = hwirq - phb->msi_base;
> @@ -1327,7 +1326,7 @@ static int pnv_pci_ioda_msi_setup(struct pnv_phb *phb, struct pci_dev *dev,
>  		return -ENXIO;
>  
>  	/* Force 32-bit MSI on some broken devices */
> -	if (pdn && pdn->force_32bit_msi)
> +	if (dev->force_32bit_msi)
>  		is_64 = 0;
>  
>  	/* Assign XIVE to PE */
> diff --git a/arch/powerpc/platforms/powernv/pci.c b/arch/powerpc/platforms/powernv/pci.c
> index b854b57..4e43a6f 100644
> --- a/arch/powerpc/platforms/powernv/pci.c
> +++ b/arch/powerpc/platforms/powernv/pci.c
> @@ -50,9 +50,8 @@ static int pnv_msi_check_device(struct pci_dev* pdev, int nvec, int type)
>  {
>  	struct pci_controller *hose = pci_bus_to_host(pdev->bus);
>  	struct pnv_phb *phb = hose->private_data;
> -	struct pci_dn *pdn = pci_get_pdn(pdev);
>  
> -	if (pdn && pdn->force_32bit_msi && !phb->msi32_support)
> +	if (pdev->force_32bit_msi && !phb->msi32_support)
>  		return -ENODEV;
>  
>  	return (phb && phb->msi_bmp.bitmap) ? 0 : -ENODEV;
> diff --git a/arch/powerpc/platforms/pseries/msi.c b/arch/powerpc/platforms/pseries/msi.c
> index 18ff462..b3f2c1a 100644
> --- a/arch/powerpc/platforms/pseries/msi.c
> +++ b/arch/powerpc/platforms/pseries/msi.c
> @@ -429,7 +429,7 @@ static int rtas_setup_msi_irqs(struct pci_dev *pdev, int nvec_in, int type)
>  	 */
>  again:
>  	if (type == PCI_CAP_ID_MSI) {
> -		if (pdn->force_32bit_msi) {
> +		if (pdev->force_32bit_msi) {
>  			rc = rtas_change_msi(pdn, RTAS_CHANGE_32MSI_FN, nvec);
>  			if (rc < 0) {
>  				/*
> diff --git a/include/linux/pci.h b/include/linux/pci.h
> index 96453f9..740cadd 100644
> --- a/include/linux/pci.h
> +++ b/include/linux/pci.h
> @@ -331,6 +331,7 @@ struct pci_dev {
>  	unsigned int	is_added:1;
>  	unsigned int	is_busmaster:1; /* device is busmaster */
>  	unsigned int	no_msi:1;	/* device may not use msi */
> +	unsigned int    force_32bit_msi:1;	/* Device has broken 64-bit MSIs */

I like the idea of handling this more generically, e.g., with a bit like
this in struct pci_dev (I'd probably name it something like "no_64bit_msi"
along the lines of your driver #defines).

What I don't like is that we haven't done anything to help other
architectures, because the only code that *looks* at this bit is in
arch/powerpc.  The next arch that tries to use 64-bit MSI addresses for
these devices will trip over the same problem.

Can we check in pci_enable_msi_range() and pci_enable_msix_range() whether
the MSI addresses allocated by the arch are too big, and fail the call if
they are?

Bjorn

>  	unsigned int	block_cfg_access:1;	/* config space access is blocked */
>  	unsigned int	broken_parity_status:1;	/* Device generates false positive parity */
>  	unsigned int	irq_reroute_variant:2;	/* device needs IRQ rerouting variant */
> 
> 
> 

^ permalink raw reply

* Re: [PATCH v2 0/3] powernv/cpuidle: Fastsleep workaround and fixes
From: Rafael J. Wysocki @ 2014-10-01 20:46 UTC (permalink / raw)
  To: Shreyas B. Prabhu
  Cc: Srivatsa S. Bhat, linux-pm, linux-kernel, Paul Mackerras,
	Preeti U. Murthy, linuxppc-dev
In-Reply-To: <1412149560-2953-1-git-send-email-shreyas@linux.vnet.ibm.com>

On Wednesday, October 01, 2014 01:15:57 PM Shreyas B. Prabhu wrote:
> Fast sleep is an idle state, where the core and the L1 and L2
> caches are brought down to a threshold voltage. This also means that
> the communication between L2 and L3 caches have to be fenced. However
> the current P8 chips have a bug wherein this fencing between L2 and
> L3 caches get delayed by a cpu cycle. This can delay L3 response to
> the other cpus if they request for data during this time. Thus they
> would fetch the same data from the memory which could lead to data
> corruption if L3 cache is not flushed. 
> 
> This series overcomes above problem in kernel.
> 
> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> Cc: Paul Mackerras <paulus@samba.org>
> Cc: Michael Ellerman <mpe@ellerman.id.au>
> Cc: Rafael J. Wysocki <rjw@rjwysocki.net>
> Cc: linux-pm@vger.kernel.org
> Cc: linuxppc-dev@lists.ozlabs.org
> Cc: Srivatsa S. Bhat <srivatsa@mit.edu>
> Cc: Preeti U. Murthy <preeti@linux.vnet.ibm.com>
> Cc: Vaidyanathan Srinivasan <svaidy@linux.vnet.ibm.com>
> 
> v2:
> Rebased on 3.17-rc7
> Split from 'powerpc/powernv: Support for fastsleep and winkle'
> 
> v1:
> https://lkml.org/lkml/2014/8/25/446
> 
> Preeti U Murthy (1):
>   powerpc/powernv/cpuidle: Add workaround to enable fastsleep
> 
> Shreyas B. Prabhu (1):
>   powerpc/kvm/book3s_hv: Enable CPUs to run guest after waking up from
>     fast-sleep
> 
> Srivatsa S. Bhat (1):
>   powerpc/powernv: Enable Offline CPUs to enter deep idle states
> 
>  arch/powerpc/include/asm/machdep.h             |   3 +
>  arch/powerpc/include/asm/opal.h                |   7 ++
>  arch/powerpc/include/asm/processor.h           |   4 +-
>  arch/powerpc/kernel/exceptions-64s.S           |  35 ++++----
>  arch/powerpc/kernel/idle.c                     |  19 ++++
>  arch/powerpc/kernel/idle_power7.S              |   2 +-
>  arch/powerpc/platforms/powernv/opal-wrappers.S |   1 +
>  arch/powerpc/platforms/powernv/powernv.h       |   7 ++
>  arch/powerpc/platforms/powernv/setup.c         | 118 +++++++++++++++++++++++++
>  arch/powerpc/platforms/powernv/smp.c           |  11 ++-
>  drivers/cpuidle/cpuidle-powernv.c              |  13 ++-
>  11 files changed, 194 insertions(+), 26 deletions(-)

[2/3] seems to be missig from the series.

Also, since that mostly modifies arch/powerpc, I think it should go through
that tree.  I'm fine with the cpuidle-powernv changes in [1/3] and [3/3].

-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.

^ permalink raw reply

* Re: [PATCH 3/4] sound/hda/radeon: Generalize 64-bit MSI quirks
From: Alex Deucher @ 2014-10-01 18:11 UTC (permalink / raw)
  To: Benjamin Herrenschmidt
  Cc: linuxppc-dev, Dave Airlie, Linux PCI, Anton Blanchard, Brian King,
	Yijing Wang, Takashi Iwai, Bjorn Helgaas
In-Reply-To: <1412129383.4285.193.camel@pasglop>

On Tue, Sep 30, 2014 at 10:09 PM, Benjamin Herrenschmidt
<benh@kernel.crashing.org> wrote:
> A number of radeon cards have a HW limitation causing them to be
> unable to generate the full 64-bit of address bits for MSIs. This
> breaks MSIs on some platforms such as POWER machines.
>
> We used to have a powerpc specific quirk to address that on a
> single card, but this doesn't scale very well, this is better
> put under control of the drivers who know precisely what a given
> HW revision can do.
>
> This moves the setting of the quirk flag to the HDA driver when
> detecting the radeon audio interface.
>
> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> CC: <stable@vger.kernel.org>

This only applies to pre Sea-Islands asics, same as the GPU side.

Alex

> ---
>  arch/powerpc/kernel/pci_64.c |  6 ------
>  sound/pci/hda/hda_intel.c    | 10 ++++++++--
>  sound/pci/hda/hda_priv.h     |  1 +
>  3 files changed, 9 insertions(+), 8 deletions(-)
>
> diff --git a/arch/powerpc/kernel/pci_64.c b/arch/powerpc/kernel/pci_64.c
> index 66e1cd0..b15194e 100644
> --- a/arch/powerpc/kernel/pci_64.c
> +++ b/arch/powerpc/kernel/pci_64.c
> @@ -266,9 +266,3 @@ int pcibus_to_node(struct pci_bus *bus)
>  }
>  EXPORT_SYMBOL(pcibus_to_node);
>  #endif
> -
> -static void quirk_radeon_32bit_msi(struct pci_dev *dev)
> -{
> -       dev->force_32bit_msi = true;
> -}
> -DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0xaa68, quirk_radeon_32bit_msi);
> diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
> index aa302fb..3e6d22d 100644
> --- a/sound/pci/hda/hda_intel.c
> +++ b/sound/pci/hda/hda_intel.c
> @@ -296,7 +296,8 @@ enum {
>
>  /* quirks for ATI/AMD HDMI */
>  #define AZX_DCAPS_PRESET_ATI_HDMI \
> -       (AZX_DCAPS_NO_TCSEL | AZX_DCAPS_SYNC_WRITE | AZX_DCAPS_POSFIX_LPIB)
> +       (AZX_DCAPS_NO_TCSEL | AZX_DCAPS_SYNC_WRITE | AZX_DCAPS_POSFIX_LPIB|\
> +        AZX_DCAPS_NO_MSI64)
>
>  /* quirks for Nvidia */
>  #define AZX_DCAPS_PRESET_NVIDIA \
> @@ -1505,9 +1506,14 @@ static int azx_first_init(struct azx *chip)
>                 return -ENXIO;
>         }
>
> -       if (chip->msi)
> +       if (chip->msi) {
> +               if (chip->driver_caps & AZX_DCAPS_NO_MSI64) {
> +                       dev_dbg(card->dev, "Disabling 64bit MSI\n");
> +                       pci->force_32bit_msi = true;
> +               }
>                 if (pci_enable_msi(pci) < 0)
>                         chip->msi = 0;
> +       }
>
>         if (azx_acquire_irq(chip, 0) < 0)
>                 return -EBUSY;
> diff --git a/sound/pci/hda/hda_priv.h b/sound/pci/hda/hda_priv.h
> index 949cd43..5016014 100644
> --- a/sound/pci/hda/hda_priv.h
> +++ b/sound/pci/hda/hda_priv.h
> @@ -171,6 +171,7 @@ enum { SDI0, SDI1, SDI2, SDI3, SDO0, SDO1, SDO2, SDO3 };
>  #define AZX_DCAPS_PM_RUNTIME   (1 << 26)       /* runtime PM support */
>  #define AZX_DCAPS_I915_POWERWELL (1 << 27)     /* HSW i915 powerwell support */
>  #define AZX_DCAPS_CORBRP_SELF_CLEAR (1 << 28)  /* CORBRP clears itself after reset */
> +#define AZX_DCAPS_NO_MSI64      (1 << 29)      /* Stick to 32-bit MSIs */
>
>  /* HD Audio class code */
>  #define PCI_CLASS_MULTIMEDIA_HD_AUDIO  0x0403
>
>
>

^ permalink raw reply

* Re: [PATCH 4/4] sounds/hda/radeon: Disable 64-bit DMA on radeon
From: Alex Deucher @ 2014-10-01 17:58 UTC (permalink / raw)
  To: Takashi Iwai
  Cc: linuxppc-dev, Dave Airlie, Brian King, Anton Blanchard,
	Yijing Wang, Linux PCI, Bjorn Helgaas
In-Reply-To: <s5hoatw42f6.wl-tiwai@suse.de>

On Wed, Oct 1, 2014 at 4:30 AM, Takashi Iwai <tiwai@suse.de> wrote:
> At Wed, 01 Oct 2014 10:09:28 +0200,
> Takashi Iwai wrote:
>>
>> At Wed, 01 Oct 2014 17:41:29 +1000,
>> Benjamin Herrenschmidt wrote:
>> >
>> > On Wed, 2014-10-01 at 09:38 +0200, Takashi Iwai wrote:
>> >
>> > > > diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
>> > > > index 3e6d22d..2b679d5 100644
>> > > > --- a/sound/pci/hda/hda_intel.c
>> > > > +++ b/sound/pci/hda/hda_intel.c
>> > > > @@ -297,7 +297,7 @@ enum {
>> > > >  /* quirks for ATI/AMD HDMI */
>> > > >  #define AZX_DCAPS_PRESET_ATI_HDMI \
>> > > >         (AZX_DCAPS_NO_TCSEL | AZX_DCAPS_SYNC_WRITE | AZX_DCAPS_POSFIX_LPIB|\
>> > > > -        AZX_DCAPS_NO_MSI64)
>> > > > +        AZX_DCAPS_NO_MSI64 | AZX_DCAPS_NO_64BIT)
>> > >
>> > > The only concern is that this will disable 64bit DMA also on x86 where
>> > > it has been working fine.  Can we add an ifdef CONFIG_PPC for this?
>> >
>> > I don't like that approach because technically the chip doesn't do
>> > 64-bit DMA ... it does something like 40 or 48 (might actually depend on
>> > the chip version) and for all I know it will break on future x86 with
>> > more memory or other platforms with similar address encodings as
>> > powerpc...
>> >
>> > The right thing might be to get the exact number of bits and do the
>> > appropriate dma_set_mask() like the graphics driver does, but that's a
>> > bit tricky unless we add a DMA mask field in that big array of chips in
>> > there...
>>
>> I think setting the dma mask explicitly would be a better approach
>> although it results in a bit bigger change.  At least, it would impact
>> less than forcing 32bit DMA, as most desktop machines have less than
>> 40bit address.  How about a patch like below?

Patch looks good.  Audio DMAs are limited to 40 bits, same as the GPU
side.  I'm still waiting to hear back on the MSIs for audio, but they
probably follow the GPU side, so I expect they should be fixed on Sea
Islands as well.

Alex


>
> Oops, it obviously doesn't work with AMD ID...  Fixed in below.
>
>
> Takashi
>
> -- 8< --
> From: Takashi Iwai <tiwai@suse.de>
> Subject: [PATCH v2] ALSA: hda - Limit 40bit DMA for AMD HDMI controllers
>
> AMD/ATI HDMI controller chip models, we already have a filter to lower
> to 32bit DMA, but the rest are supposed to be working with 64bit
> although the hardware doesn't really work with 63bit but only with 40
> or 48bit DMA.  In this patch, we take 40bit DMA for safety for the
> AMD/ATI controllers as the graphics drivers does.
>
> Signed-off-by: Takashi Iwai <tiwai@suse.de>
> ---
>  sound/pci/hda/hda_intel.c | 14 +++++++++++---
>  1 file changed, 11 insertions(+), 3 deletions(-)
>
> diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
> index aa302fb03fc5..99b367bd9b1b 100644
> --- a/sound/pci/hda/hda_intel.c
> +++ b/sound/pci/hda/hda_intel.c
> @@ -1482,6 +1482,7 @@ static int azx_first_init(struct azx *chip)
>         struct snd_card *card = chip->card;
>         int err;
>         unsigned short gcap;
> +       unsigned int dma_bits = 64;
>
>  #if BITS_PER_LONG != 64
>         /* Fix up base address on ULI M5461 */
> @@ -1518,9 +1519,14 @@ static int azx_first_init(struct azx *chip)
>         gcap = azx_readw(chip, GCAP);
>         dev_dbg(card->dev, "chipset global capabilities = 0x%x\n", gcap);
>
> +       /* AMD devices support 40 or 48bit DMA, take the safe one */
> +       if (chip->pci->vendor == PCI_VENDOR_ID_AMD)
> +               dma_bits = 40;
> +
>         /* disable SB600 64bit support for safety */
>         if (chip->pci->vendor == PCI_VENDOR_ID_ATI) {
>                 struct pci_dev *p_smbus;
> +               dma_bits = 40;
>                 p_smbus = pci_get_device(PCI_VENDOR_ID_ATI,
>                                          PCI_DEVICE_ID_ATI_SBX00_SMBUS,
>                                          NULL);
> @@ -1550,9 +1556,11 @@ static int azx_first_init(struct azx *chip)
>         }
>
>         /* allow 64bit DMA address if supported by H/W */
> -       if ((gcap & AZX_GCAP_64OK) && !pci_set_dma_mask(pci, DMA_BIT_MASK(64)))
> -               pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(64));
> -       else {
> +       if (!(gcap & AZX_GCAP_64OK))
> +               dma_bits = 32;
> +       if (!pci_set_dma_mask(pci, DMA_BIT_MASK(dma_bits))) {
> +               pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(dma_bits));
> +       } else {
>                 pci_set_dma_mask(pci, DMA_BIT_MASK(32));
>                 pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(32));
>         }
> --
> 2.1.0
>

^ permalink raw reply

* Re: [PATCH v4 01/10] tools/perf: support parsing parameterized events
From: Peter Zijlstra @ 2014-10-01 15:59 UTC (permalink / raw)
  To: Jiri Olsa
  Cc: ak, Michael Ellerman, linux-kernel, eranian, Paul Mackerras,
	Arnaldo Carvalho de Melo, dev, Sukadev Bhattiprolu, linuxppc-dev,
	Ingo Molnar, Anshuman Khandual
In-Reply-To: <20141001090627.GB5168@krava.brq.redhat.com>

On Wed, Oct 01, 2014 at 11:06:27AM +0200, Jiri Olsa wrote:
> On Thu, Sep 25, 2014 at 07:25:20PM -0700, Sukadev Bhattiprolu wrote:
> > Jiri Olsa [jolsa@redhat.com] wrote:
> > | On Wed, Sep 24, 2014 at 12:27:15PM -0700, Sukadev Bhattiprolu wrote:
> > | > From: Cody P Schafer <cody@linux.vnet.ibm.com>
> > | > 
> > | > Enable event specification like:
> > | > 
> > | > 	pmu/event_name,param1=0x1,param2=0x4/
> > | > 
> > | > Assuming that
> > | > 
> > | > 	/sys/bus/event_source/devices/pmu/events/event_name
> > | > 
> > | > Contains something like
> > | > 
> > | > 	param2=foo,bar=1,param1=baz
> > | 
> > | hum, so what happened to the '?' ... AFAIU from out last discussion,
> > | you wanted to mark terms which are mandatory and user must provide
> > | values for them.. and I thought the decision was to have following
> > | alias record:
> > | 
> > |   $ cat /sys/bus/event_source/devices/pmu/events/event_name
> > |   param2=?,bar=1,param1=?
> > | 
> > | while perf would scream if any of param1/2 wasnt filled like for:
> > |   pmu/event_name,param1=0x1/
> > 
> > Sorry, I meant to make perf list consistent with sysfs.
> > 
> > Consider these two sysfs entries:
> > 
> > 	$ cat HPM_0THRD_NON_IDLE_CCYC__PHYS_CORE 
> > 	domain=0x2,offset=0xe0,starting_index=core,lpar=0x0
> > 
> > 	$ cat HPM_0THRD_NON_IDLE_CCYC__VCPU_HOME_CORE 
> > 	domain=0x3,offset=0xe0,starting_index=vcpu,lpar=sibling_guest_id
> > 
> > In the first one, starting_index refers to a 'core' while in the second
> > it refers to a vcpu. This serves as a "hint" for the parameter's meaning.
> > 
> > By replacing both with 'starting_index=?' we lose that hint.
> > 
> > Should we fix both sysfs and 'perf list' to say
> > 
> > 	starting_index=?core 
> 
> Peter, Ingo,
> any opinions on this? Overall explanation is in here:
> http://marc.info/?l=linux-kernel&m=141158688307356&w=2

Consistency is good, and you indeed need to indicate it is a parameter.
I'm not entirely sure about ?core, but I suppose its easy to parse and
clear enough to read.

So the typical optional argument syntax would be like $arg or <type>
like. But overall I have no objection as long as you keep the lot
consistent and parsable.

^ permalink raw reply

* Re: [PATCH 00/20] powerpc: Convert power off logic to pm_power_off
From: Guenter Roeck @ 2014-10-01 15:54 UTC (permalink / raw)
  To: Alexander Graf
  Cc: Arnd Bergmann, Geoff Levand, Alistair Popple, Geert Uytterhoeven,
	Scott Wood, Anatolij Gustschin, linuxppc-dev@lists.ozlabs.org
In-Reply-To: <542C13FB.80608@suse.de>

On Wed, Oct 01, 2014 at 04:47:23PM +0200, Alexander Graf wrote:
> 
> 
> On 01.10.14 16:33, Geert Uytterhoeven wrote:
> > Hi Alex,
> > 
> > On Wed, Oct 1, 2014 at 3:27 PM, Alexander Graf <agraf@suse.de> wrote:
> >> The generic Linux framework to power off the machine is a function pointer
> >> called pm_power_off. The trick about this pointer is that device drivers can
> >> potentially implement it rather than board files.
> >>
> >> Today on PowerPC we set pm_power_off to invoke our generic full machine power
> >> off logic which then calls ppc_md.power_off to invoke machine specific power
> >> off.
> >>
> >> However, when we want to add a power off GPIO via the "gpio-poweroff" driver,
> >> this card house falls apart. That driver only registers itself if pm_power_off
> >> is NULL to ensure it doesn't override board specific logic. However, since we
> >> always set pm_power_off to the generic power off logic (which will just not
> >> power off the machine if no ppc_md.power_off call is implemented), we can't
> >> implement power off via the generic GPIO power off driver.
> >>
> >> To fix this up, let's get rid of the ppc_md.power_off logic and just always use
> >> pm_power_off as was intended. Then individual drivers such as the GPIO power off
> >> driver can implement power off logic via that function pointer.
> >>
> >> With this patch set applied and a few patches on top of QEMU that implement a
> >> power off GPIO on the virt e500 machine, I can successfully turn off my virtual
> >> machine after halt.
> > 
> > This is touching the same area as last night's
> > "[RFC PATCH 00/16] kernel: Add support for poweroff handler call chain"
> > https://lkml.org/lkml/2014/9/30/575
> 
> I agree, and I think your patch set is walking into a reasonable
> direction. However, I really think it should convert all users of
> pm_power_off - at which point you'll probably get to the same conclusion
> that ppc_md.power_off is a bad idea :).
> 
Yes, that would be the ultimate goal.

> So in a way, this patch set is semantically a prerequisite to the full
> conversion you'd probably like to do :).
> 
> Also, in your cover letter you describe that some methods power off the
> CPU power while others power off the system power. How do you
> distinguish between them with a call chain? You probably won't get
> around to trigger the system power off callback after the CPU power off
> callback ran ;).
> 
Those are examples. Don't get hung up on it. I may actually replace the
CPU example with something better in the next version; it is not really
a good example and may get people stuck on "why on earth would anyone want
or need a means to turn off the CPU power" instead of focusing on the problem
the patch set tries to solve.

The basic problem is that there can be different poweroff handlers,
some of which may not be available on some systems, and some may not
be as desirable as others for various reasons. The code registering
those poweroff handlers does not specify the poweroff method, but its 
priority. It would be up to the programmer (hopefully together with
the board designer) to determine which method should have higher priority.
Taking the above example, the callback to turn off CPU power would presumably
be one of last resort, and have a very low priority.

A better example may actually be patch 15/16 of the series. The affected
driver (drivers/power/reset/restart-poweroff.c) does not really power off
the system, but restarts it instead. Obviously that would only be a poweroff
handler of last resort, which should only be executed if no other means
to power off the system is available.

Thanks,
Guenter

^ permalink raw reply

* Re: [PATCH 00/20] powerpc: Convert power off logic to pm_power_off
From: Geert Uytterhoeven @ 2014-10-01 14:57 UTC (permalink / raw)
  To: Alexander Graf
  Cc: Arnd Bergmann, Geoff Levand, Alistair Popple, Scott Wood,
	Anatolij Gustschin, linuxppc-dev@lists.ozlabs.org, Guenter Roeck
In-Reply-To: <542C13FB.80608@suse.de>

On Wed, Oct 1, 2014 at 4:47 PM, Alexander Graf <agraf@suse.de> wrote:
>> This is touching the same area as last night's
>> "[RFC PATCH 00/16] kernel: Add support for poweroff handler call chain"
>> https://lkml.org/lkml/2014/9/30/575
>
> I agree, and I think your patch set is walking into a reasonable
> direction. However, I really think it should convert all users of
> pm_power_off - at which point you'll probably get to the same conclusion
> that ppc_md.power_off is a bad idea :).
>
> So in a way, this patch set is semantically a prerequisite to the full
> conversion you'd probably like to do :).
>
> Also, in your cover letter you describe that some methods power off the
> CPU power while others power off the system power. How do you
> distinguish between them with a call chain? You probably won't get
> around to trigger the system power off callback after the CPU power off
> callback ran ;).

I'll let G=C3=BCnther answer that...

Gr{oetje,eeting}s,

                        Geert

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

In personal conversations with technical people, I call myself a hacker. Bu=
t
when I'm talking to journalists I just say "programmer" or something like t=
hat.
                                -- Linus Torvalds

^ permalink raw reply

* Re: [PATCH 00/20] powerpc: Convert power off logic to pm_power_off
From: Alexander Graf @ 2014-10-01 14:47 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Arnd Bergmann, Geoff Levand, Alistair Popple, Scott Wood,
	Anatolij Gustschin, linuxppc-dev@lists.ozlabs.org, Guenter Roeck
In-Reply-To: <CAMuHMdWEN+q+s6ENoqqD8d0hy=hcZSiWzW3poJFBs8uEBGVuGg@mail.gmail.com>



On 01.10.14 16:33, Geert Uytterhoeven wrote:
> Hi Alex,
> 
> On Wed, Oct 1, 2014 at 3:27 PM, Alexander Graf <agraf@suse.de> wrote:
>> The generic Linux framework to power off the machine is a function pointer
>> called pm_power_off. The trick about this pointer is that device drivers can
>> potentially implement it rather than board files.
>>
>> Today on PowerPC we set pm_power_off to invoke our generic full machine power
>> off logic which then calls ppc_md.power_off to invoke machine specific power
>> off.
>>
>> However, when we want to add a power off GPIO via the "gpio-poweroff" driver,
>> this card house falls apart. That driver only registers itself if pm_power_off
>> is NULL to ensure it doesn't override board specific logic. However, since we
>> always set pm_power_off to the generic power off logic (which will just not
>> power off the machine if no ppc_md.power_off call is implemented), we can't
>> implement power off via the generic GPIO power off driver.
>>
>> To fix this up, let's get rid of the ppc_md.power_off logic and just always use
>> pm_power_off as was intended. Then individual drivers such as the GPIO power off
>> driver can implement power off logic via that function pointer.
>>
>> With this patch set applied and a few patches on top of QEMU that implement a
>> power off GPIO on the virt e500 machine, I can successfully turn off my virtual
>> machine after halt.
> 
> This is touching the same area as last night's
> "[RFC PATCH 00/16] kernel: Add support for poweroff handler call chain"
> https://lkml.org/lkml/2014/9/30/575

I agree, and I think your patch set is walking into a reasonable
direction. However, I really think it should convert all users of
pm_power_off - at which point you'll probably get to the same conclusion
that ppc_md.power_off is a bad idea :).

So in a way, this patch set is semantically a prerequisite to the full
conversion you'd probably like to do :).

Also, in your cover letter you describe that some methods power off the
CPU power while others power off the system power. How do you
distinguish between them with a call chain? You probably won't get
around to trigger the system power off callback after the CPU power off
callback ran ;).


Alex

^ permalink raw reply

* Re: [PATCH 00/20] powerpc: Convert power off logic to pm_power_off
From: Geert Uytterhoeven @ 2014-10-01 14:33 UTC (permalink / raw)
  To: Alexander Graf
  Cc: Arnd Bergmann, Geoff Levand, Alistair Popple, Scott Wood,
	Anatolij Gustschin, linuxppc-dev@lists.ozlabs.org, Guenter Roeck
In-Reply-To: <1412170086-57971-1-git-send-email-agraf@suse.de>

Hi Alex,

On Wed, Oct 1, 2014 at 3:27 PM, Alexander Graf <agraf@suse.de> wrote:
> The generic Linux framework to power off the machine is a function pointer
> called pm_power_off. The trick about this pointer is that device drivers can
> potentially implement it rather than board files.
>
> Today on PowerPC we set pm_power_off to invoke our generic full machine power
> off logic which then calls ppc_md.power_off to invoke machine specific power
> off.
>
> However, when we want to add a power off GPIO via the "gpio-poweroff" driver,
> this card house falls apart. That driver only registers itself if pm_power_off
> is NULL to ensure it doesn't override board specific logic. However, since we
> always set pm_power_off to the generic power off logic (which will just not
> power off the machine if no ppc_md.power_off call is implemented), we can't
> implement power off via the generic GPIO power off driver.
>
> To fix this up, let's get rid of the ppc_md.power_off logic and just always use
> pm_power_off as was intended. Then individual drivers such as the GPIO power off
> driver can implement power off logic via that function pointer.
>
> With this patch set applied and a few patches on top of QEMU that implement a
> power off GPIO on the virt e500 machine, I can successfully turn off my virtual
> machine after halt.

This is touching the same area as last night's
"[RFC PATCH 00/16] kernel: Add support for poweroff handler call chain"
https://lkml.org/lkml/2014/9/30/575

Gr{oetje,eeting}s,

                        Geert

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

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply

* [PATCH 19/20] powerpc/pseries: Use pm_power_off rather than ppc_md.power_off
From: Alexander Graf @ 2014-10-01 13:28 UTC (permalink / raw)
  To: linuxppc-dev
  Cc: Arnd Bergmann, Geoff Levand, Alistair Popple, Scott Wood,
	Anatolij Gustschin
In-Reply-To: <1412170086-57971-1-git-send-email-agraf@suse.de>

The generic power off callback is pm_power_off. Use that one rather than
the powerpc specific ppc_md.power_off.

Signed-off-by: Alexander Graf <agraf@suse.de>
---
 arch/powerpc/platforms/pseries/setup.c | 59 +++++++++++++++++-----------------
 1 file changed, 30 insertions(+), 29 deletions(-)

diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c
index e724d31..981e9ee 100644
--- a/arch/powerpc/platforms/pseries/setup.c
+++ b/arch/powerpc/platforms/pseries/setup.c
@@ -460,6 +460,34 @@ static long pseries_little_endian_exceptions(void)
 }
 #endif
 
+/**
+ * pSeries_power_off - tell firmware about how to power off the system.
+ *
+ * This function calls either the power-off rtas token in normal cases
+ * or the ibm,power-off-ups token (if present & requested) in case of
+ * a power failure. If power-off token is used, power on will only be
+ * possible with power button press. If ibm,power-off-ups token is used
+ * it will allow auto poweron after power is restored.
+ */
+static void pSeries_power_off(void)
+{
+	int rc;
+	int rtas_poweroff_ups_token = rtas_token("ibm,power-off-ups");
+
+	if (rtas_flash_term_hook)
+		rtas_flash_term_hook(SYS_POWER_OFF);
+
+	if (rtas_poweron_auto == 0 ||
+		rtas_poweroff_ups_token == RTAS_UNKNOWN_SERVICE) {
+		rc = rtas_call(rtas_token("power-off"), 2, 1, NULL, -1, -1);
+		printk(KERN_INFO "RTAS power-off returned %d\n", rc);
+	} else {
+		rc = rtas_call(rtas_poweroff_ups_token, 0, 1, NULL);
+		printk(KERN_INFO "RTAS ibm,power-off-ups returned %d\n", rc);
+	}
+	for (;;);
+}
+
 static void __init pSeries_setup_arch(void)
 {
 	set_arch_panic_timeout(10, ARCH_PANIC_TIMEOUT);
@@ -504,6 +532,8 @@ static void __init pSeries_setup_arch(void)
 				"%ld\n", rc);
 		}
 	}
+
+	pm_power_off = pSeries_power_off;
 }
 
 static int __init pSeries_init_panel(void)
@@ -754,34 +784,6 @@ static int pSeries_pci_probe_mode(struct pci_bus *bus)
 	return PCI_PROBE_NORMAL;
 }
 
-/**
- * pSeries_power_off - tell firmware about how to power off the system.
- *
- * This function calls either the power-off rtas token in normal cases
- * or the ibm,power-off-ups token (if present & requested) in case of
- * a power failure. If power-off token is used, power on will only be
- * possible with power button press. If ibm,power-off-ups token is used
- * it will allow auto poweron after power is restored.
- */
-static void pSeries_power_off(void)
-{
-	int rc;
-	int rtas_poweroff_ups_token = rtas_token("ibm,power-off-ups");
-
-	if (rtas_flash_term_hook)
-		rtas_flash_term_hook(SYS_POWER_OFF);
-
-	if (rtas_poweron_auto == 0 ||
-		rtas_poweroff_ups_token == RTAS_UNKNOWN_SERVICE) {
-		rc = rtas_call(rtas_token("power-off"), 2, 1, NULL, -1, -1);
-		printk(KERN_INFO "RTAS power-off returned %d\n", rc);
-	} else {
-		rc = rtas_call(rtas_poweroff_ups_token, 0, 1, NULL);
-		printk(KERN_INFO "RTAS ibm,power-off-ups returned %d\n", rc);
-	}
-	for (;;);
-}
-
 #ifndef CONFIG_PCI
 void pSeries_final_fixup(void) { }
 #endif
@@ -796,7 +798,6 @@ define_machine(pseries) {
 	.pcibios_fixup		= pSeries_final_fixup,
 	.pci_probe_mode		= pSeries_pci_probe_mode,
 	.restart		= rtas_restart,
-	.power_off		= pSeries_power_off,
 	.halt			= rtas_halt,
 	.panic			= rtas_os_term,
 	.get_boot_time		= rtas_get_boot_time,
-- 
1.8.1.4

^ permalink raw reply related

* [PATCH 16/20] powerpc/powermac: Use pm_power_off rather than ppc_md.power_off
From: Alexander Graf @ 2014-10-01 13:28 UTC (permalink / raw)
  To: linuxppc-dev
  Cc: Arnd Bergmann, Geoff Levand, Alistair Popple, Scott Wood,
	Anatolij Gustschin
In-Reply-To: <1412170086-57971-1-git-send-email-agraf@suse.de>

The generic power off callback is pm_power_off. Use that one rather than
the powerpc specific ppc_md.power_off.

Signed-off-by: Alexander Graf <agraf@suse.de>
---
 arch/powerpc/platforms/powermac/setup.c | 147 ++++++++++++++++----------------
 1 file changed, 74 insertions(+), 73 deletions(-)

diff --git a/arch/powerpc/platforms/powermac/setup.c b/arch/powerpc/platforms/powermac/setup.c
index 141f8899..d3b0a87 100644
--- a/arch/powerpc/platforms/powermac/setup.c
+++ b/arch/powerpc/platforms/powermac/setup.c
@@ -274,6 +274,78 @@ static void __init l2cr_init(void)
 }
 #endif
 
+#ifdef CONFIG_ADB_CUDA
+static void cuda_restart(void)
+{
+	struct adb_request req;
+
+	cuda_request(&req, NULL, 2, CUDA_PACKET, CUDA_RESET_SYSTEM);
+	for (;;)
+		cuda_poll();
+}
+
+static void cuda_shutdown(void)
+{
+	struct adb_request req;
+
+	cuda_request(&req, NULL, 2, CUDA_PACKET, CUDA_POWERDOWN);
+	for (;;)
+		cuda_poll();
+}
+
+#else
+#define cuda_restart()
+#define cuda_shutdown()
+#endif
+
+#ifndef CONFIG_ADB_PMU
+#define pmu_restart()
+#define pmu_shutdown()
+#endif
+
+#ifndef CONFIG_PMAC_SMU
+#define smu_restart()
+#define smu_shutdown()
+#endif
+
+static void pmac_restart(char *cmd)
+{
+	switch (sys_ctrler) {
+	case SYS_CTRLER_CUDA:
+		cuda_restart();
+		break;
+	case SYS_CTRLER_PMU:
+		pmu_restart();
+		break;
+	case SYS_CTRLER_SMU:
+		smu_restart();
+		break;
+	default: ;
+	}
+}
+
+static void pmac_power_off(void)
+{
+	switch (sys_ctrler) {
+	case SYS_CTRLER_CUDA:
+		cuda_shutdown();
+		break;
+	case SYS_CTRLER_PMU:
+		pmu_shutdown();
+		break;
+	case SYS_CTRLER_SMU:
+		smu_shutdown();
+		break;
+	default: ;
+	}
+}
+
+static void
+pmac_halt(void)
+{
+	pmac_power_off();
+}
+
 static void __init pmac_setup_arch(void)
 {
 	struct device_node *cpu, *ic;
@@ -341,6 +413,8 @@ static void __init pmac_setup_arch(void)
 		__adb_probe_sync = 1;
 	}
 #endif /* CONFIG_ADB */
+
+	pm_power_off = pmac_power_off;
 }
 
 #ifdef CONFIG_SCSI
@@ -382,78 +456,6 @@ void __init_refok note_bootable_part(dev_t dev, int part, int goodness)
 	current_root_goodness = goodness;
 }
 
-#ifdef CONFIG_ADB_CUDA
-static void cuda_restart(void)
-{
-	struct adb_request req;
-
-	cuda_request(&req, NULL, 2, CUDA_PACKET, CUDA_RESET_SYSTEM);
-	for (;;)
-		cuda_poll();
-}
-
-static void cuda_shutdown(void)
-{
-	struct adb_request req;
-
-	cuda_request(&req, NULL, 2, CUDA_PACKET, CUDA_POWERDOWN);
-	for (;;)
-		cuda_poll();
-}
-
-#else
-#define cuda_restart()
-#define cuda_shutdown()
-#endif
-
-#ifndef CONFIG_ADB_PMU
-#define pmu_restart()
-#define pmu_shutdown()
-#endif
-
-#ifndef CONFIG_PMAC_SMU
-#define smu_restart()
-#define smu_shutdown()
-#endif
-
-static void pmac_restart(char *cmd)
-{
-	switch (sys_ctrler) {
-	case SYS_CTRLER_CUDA:
-		cuda_restart();
-		break;
-	case SYS_CTRLER_PMU:
-		pmu_restart();
-		break;
-	case SYS_CTRLER_SMU:
-		smu_restart();
-		break;
-	default: ;
-	}
-}
-
-static void pmac_power_off(void)
-{
-	switch (sys_ctrler) {
-	case SYS_CTRLER_CUDA:
-		cuda_shutdown();
-		break;
-	case SYS_CTRLER_PMU:
-		pmu_shutdown();
-		break;
-	case SYS_CTRLER_SMU:
-		smu_shutdown();
-		break;
-	default: ;
-	}
-}
-
-static void
-pmac_halt(void)
-{
-	pmac_power_off();
-}
-
 /* 
  * Early initialization.
  */
@@ -663,7 +665,6 @@ define_machine(powermac) {
 	.get_irq		= NULL,	/* changed later */
 	.pci_irq_fixup		= pmac_pci_irq_fixup,
 	.restart		= pmac_restart,
-	.power_off		= pmac_power_off,
 	.halt			= pmac_halt,
 	.time_init		= pmac_time_init,
 	.get_boot_time		= pmac_get_boot_time,
-- 
1.8.1.4

^ permalink raw reply related

* [PATCH 10/20] powerpc/cell: Use pm_power_off rather than ppc_md.power_off
From: Alexander Graf @ 2014-10-01 13:27 UTC (permalink / raw)
  To: linuxppc-dev
  Cc: Arnd Bergmann, Geoff Levand, Alistair Popple, Scott Wood,
	Anatolij Gustschin
In-Reply-To: <1412170086-57971-1-git-send-email-agraf@suse.de>

The generic power off callback is pm_power_off. Use that one rather than
the powerpc specific ppc_md.power_off.

Signed-off-by: Alexander Graf <agraf@suse.de>
---
 arch/powerpc/platforms/cell/setup.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/platforms/cell/setup.c b/arch/powerpc/platforms/cell/setup.c
index 6ae25fb..b6a27d7 100644
--- a/arch/powerpc/platforms/cell/setup.c
+++ b/arch/powerpc/platforms/cell/setup.c
@@ -248,6 +248,7 @@ static void __init cell_setup_arch(void)
 #endif
 
 	mmio_nvram_init();
+	pm_power_off = rtas_power_off;
 }
 
 static int __init cell_probe(void)
@@ -269,7 +270,6 @@ define_machine(cell) {
 	.setup_arch		= cell_setup_arch,
 	.show_cpuinfo		= cell_show_cpuinfo,
 	.restart		= rtas_restart,
-	.power_off		= rtas_power_off,
 	.halt			= rtas_halt,
 	.get_boot_time		= rtas_get_boot_time,
 	.get_rtc_time		= rtas_get_rtc_time,
-- 
1.8.1.4

^ permalink raw reply related

* [PATCH 20/20] powerpc: Remove ppc_md.power_off
From: Alexander Graf @ 2014-10-01 13:28 UTC (permalink / raw)
  To: linuxppc-dev
  Cc: Arnd Bergmann, Geoff Levand, Alistair Popple, Scott Wood,
	Anatolij Gustschin
In-Reply-To: <1412170086-57971-1-git-send-email-agraf@suse.de>

Now that we have all implementations of ppc_md.power_off converted to
pm_power_off we can remove the ppc_md variant.

While at it, also set the default for pm_power_off to NULL so that non
machine drivers can implement overrides.

Signed-off-by: Alexander Graf <agraf@suse.de>
---
 arch/powerpc/include/asm/machdep.h | 1 -
 arch/powerpc/kernel/setup-common.c | 6 ++----
 arch/powerpc/xmon/xmon.c           | 2 --
 3 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/arch/powerpc/include/asm/machdep.h b/arch/powerpc/include/asm/machdep.h
index b125cea..10dc008 100644
--- a/arch/powerpc/include/asm/machdep.h
+++ b/arch/powerpc/include/asm/machdep.h
@@ -144,7 +144,6 @@ struct machdep_calls {
 #endif
 
 	void		(*restart)(char *cmd);
-	void		(*power_off)(void);
 	void		(*halt)(void);
 	void		(*panic)(char *str);
 	void		(*cpu_die)(void);
diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c
index 5dfcb28..58a260f 100644
--- a/arch/powerpc/kernel/setup-common.c
+++ b/arch/powerpc/kernel/setup-common.c
@@ -138,9 +138,7 @@ void machine_restart(char *cmd)
 void machine_power_off(void)
 {
 	machine_shutdown();
-	if (ppc_md.power_off)
-		ppc_md.power_off();
-	if (pm_power_off != machine_power_off)
+	if (pm_power_off)
 		pm_power_off();
 #ifdef CONFIG_SMP
 	smp_send_stop();
@@ -152,7 +150,7 @@ 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;
+void (*pm_power_off)(void);
 EXPORT_SYMBOL_GPL(pm_power_off);
 
 void machine_halt(void)
diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
index 531f649..506d256 100644
--- a/arch/powerpc/xmon/xmon.c
+++ b/arch/powerpc/xmon/xmon.c
@@ -981,8 +981,6 @@ static void bootcmds(void)
 	else if (cmd == 'h')
 		ppc_md.halt();
 	else if (cmd == 'p')
-		if (ppc_md.power_off)
-			ppc_md.power_off();
 		if (pm_power_off)
 			pm_power_off();
 }
-- 
1.8.1.4

^ permalink raw reply related

* [PATCH 12/20] powerpc/6xx/gamecube: Use pm_power_off rather than ppc_md.power_off
From: Alexander Graf @ 2014-10-01 13:27 UTC (permalink / raw)
  To: linuxppc-dev
  Cc: Arnd Bergmann, Geoff Levand, Alistair Popple, Scott Wood,
	Anatolij Gustschin
In-Reply-To: <1412170086-57971-1-git-send-email-agraf@suse.de>

The generic power off callback is pm_power_off. Use that one rather than
the powerpc specific ppc_md.power_off.

Signed-off-by: Alexander Graf <agraf@suse.de>
---
 arch/powerpc/platforms/embedded6xx/gamecube.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/platforms/embedded6xx/gamecube.c b/arch/powerpc/platforms/embedded6xx/gamecube.c
index a138e14..3ee7a8b 100644
--- a/arch/powerpc/platforms/embedded6xx/gamecube.c
+++ b/arch/powerpc/platforms/embedded6xx/gamecube.c
@@ -67,6 +67,8 @@ static int __init gamecube_probe(void)
 	if (!of_flat_dt_is_compatible(dt_root, "nintendo,gamecube"))
 		return 0;
 
+	pm_power_off = gamecube_power_off;
+
 	return 1;
 }
 
@@ -80,7 +82,6 @@ define_machine(gamecube) {
 	.probe			= gamecube_probe,
 	.init_early		= gamecube_init_early,
 	.restart		= gamecube_restart,
-	.power_off		= gamecube_power_off,
 	.halt			= gamecube_halt,
 	.init_IRQ		= flipper_pic_probe,
 	.get_irq		= flipper_pic_get_irq,
-- 
1.8.1.4

^ permalink raw reply related

* [PATCH 14/20] powerpc/6xx/wii: Use pm_power_off rather than ppc_md.power_off
From: Alexander Graf @ 2014-10-01 13:28 UTC (permalink / raw)
  To: linuxppc-dev
  Cc: Arnd Bergmann, Geoff Levand, Alistair Popple, Scott Wood,
	Anatolij Gustschin
In-Reply-To: <1412170086-57971-1-git-send-email-agraf@suse.de>

The generic power off callback is pm_power_off. Use that one rather than
the powerpc specific ppc_md.power_off.

Signed-off-by: Alexander Graf <agraf@suse.de>
---
 arch/powerpc/platforms/embedded6xx/wii.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/platforms/embedded6xx/wii.c b/arch/powerpc/platforms/embedded6xx/wii.c
index 6d8dadf..24d656d 100644
--- a/arch/powerpc/platforms/embedded6xx/wii.c
+++ b/arch/powerpc/platforms/embedded6xx/wii.c
@@ -158,6 +158,8 @@ static void __init wii_setup_arch(void)
 		clrbits32(hw_gpio + HW_GPIO_OUT(0),
 			  HW_GPIO_SLOT_LED | HW_GPIO_SENSOR_BAR);
 	}
+
+	pm_power_off = wii_power_off;
 }
 
 static void wii_restart(char *cmd)
@@ -226,7 +228,6 @@ define_machine(wii) {
 	.init_early		= wii_init_early,
 	.setup_arch		= wii_setup_arch,
 	.restart		= wii_restart,
-	.power_off		= wii_power_off,
 	.halt			= wii_halt,
 	.init_IRQ		= wii_pic_probe,
 	.get_irq		= flipper_pic_get_irq,
-- 
1.8.1.4

^ permalink raw reply related

* [PATCH 00/20] powerpc: Convert power off logic to pm_power_off
From: Alexander Graf @ 2014-10-01 13:27 UTC (permalink / raw)
  To: linuxppc-dev
  Cc: Arnd Bergmann, Geoff Levand, Alistair Popple, Scott Wood,
	Anatolij Gustschin

The generic Linux framework to power off the machine is a function pointer
called pm_power_off. The trick about this pointer is that device drivers can
potentially implement it rather than board files.

Today on PowerPC we set pm_power_off to invoke our generic full machine power
off logic which then calls ppc_md.power_off to invoke machine specific power
off.

However, when we want to add a power off GPIO via the "gpio-poweroff" driver,
this card house falls apart. That driver only registers itself if pm_power_off
is NULL to ensure it doesn't override board specific logic. However, since we
always set pm_power_off to the generic power off logic (which will just not
power off the machine if no ppc_md.power_off call is implemented), we can't
implement power off via the generic GPIO power off driver.

To fix this up, let's get rid of the ppc_md.power_off logic and just always use
pm_power_off as was intended. Then individual drivers such as the GPIO power off
driver can implement power off logic via that function pointer.

With this patch set applied and a few patches on top of QEMU that implement a
power off GPIO on the virt e500 machine, I can successfully turn off my virtual
machine after halt.


Alex

Alexander Graf (20):
  powerpc: Support override of pm_power_off
  powerpc/xmon: Support either ppc_md.power_off or pm_power_off
  powerpc/47x: Use pm_power_off rather than ppc_md.power_off
  powerpc/52xx/efika: Use pm_power_off rather than ppc_md.power_off
  powerpc/mpc8349emitx: Use pm_power_off rather than ppc_md.power_off
  powerpc/corenet: Use pm_power_off rather than ppc_md.power_off
  powerpc/85xx/sgy_cts1000: Use pm_power_off rather than
    ppc_md.power_off
  powerpc/celleb: Use pm_power_off rather than ppc_md.power_off
  powerpc/cell/qpace: Use pm_power_off rather than ppc_md.power_off
  powerpc/cell: Use pm_power_off rather than ppc_md.power_off
  powerpc/chrp: Use pm_power_off rather than ppc_md.power_off
  powerpc/6xx/gamecube: Use pm_power_off rather than ppc_md.power_off
  powerpc/6xx/linkstation: Use pm_power_off rather than ppc_md.power_off
  powerpc/6xx/wii: Use pm_power_off rather than ppc_md.power_off
  powerpc/maple: Use pm_power_off rather than ppc_md.power_off
  powerpc/powermac: Use pm_power_off rather than ppc_md.power_off
  powerpc/powernv: Use pm_power_off rather than ppc_md.power_off
  powerpc/ps3: Use pm_power_off rather than ppc_md.power_off
  powerpc/pseries: Use pm_power_off rather than ppc_md.power_off
  powerpc: Remove ppc_md.power_off

 arch/powerpc/include/asm/machdep.h               |   1 -
 arch/powerpc/kernel/setup-common.c               |   6 +-
 arch/powerpc/platforms/44x/ppc476.c              |   2 +-
 arch/powerpc/platforms/52xx/efika.c              |   3 +-
 arch/powerpc/platforms/83xx/mcu_mpc8349emitx.c   |   8 +-
 arch/powerpc/platforms/85xx/corenet_generic.c    |   2 +-
 arch/powerpc/platforms/85xx/sgy_cts1000.c        |   4 +-
 arch/powerpc/platforms/cell/celleb_setup.c       |   4 +-
 arch/powerpc/platforms/cell/qpace_setup.c        |   3 +-
 arch/powerpc/platforms/cell/setup.c              |   2 +-
 arch/powerpc/platforms/chrp/setup.c              |   3 +-
 arch/powerpc/platforms/embedded6xx/gamecube.c    |   3 +-
 arch/powerpc/platforms/embedded6xx/linkstation.c |   3 +-
 arch/powerpc/platforms/embedded6xx/wii.c         |   3 +-
 arch/powerpc/platforms/maple/setup.c             |   4 +-
 arch/powerpc/platforms/powermac/setup.c          | 147 ++++++++++++-----------
 arch/powerpc/platforms/powernv/setup.c           |   4 +-
 arch/powerpc/platforms/ps3/setup.c               |   3 +-
 arch/powerpc/platforms/pseries/setup.c           |  59 ++++-----
 arch/powerpc/sysdev/fsl_soc.c                    |   2 +-
 arch/powerpc/xmon/xmon.c                         |   3 +-
 21 files changed, 139 insertions(+), 130 deletions(-)

-- 
1.8.1.4

^ permalink raw reply

* [PATCH 18/20] powerpc/ps3: Use pm_power_off rather than ppc_md.power_off
From: Alexander Graf @ 2014-10-01 13:28 UTC (permalink / raw)
  To: linuxppc-dev
  Cc: Arnd Bergmann, Geoff Levand, Alistair Popple, Scott Wood,
	Anatolij Gustschin
In-Reply-To: <1412170086-57971-1-git-send-email-agraf@suse.de>

The generic power off callback is pm_power_off. Use that one rather than
the powerpc specific ppc_md.power_off.

Signed-off-by: Alexander Graf <agraf@suse.de>
---
 arch/powerpc/platforms/ps3/setup.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/platforms/ps3/setup.c b/arch/powerpc/platforms/ps3/setup.c
index 3f509f8..ce3b455 100644
--- a/arch/powerpc/platforms/ps3/setup.c
+++ b/arch/powerpc/platforms/ps3/setup.c
@@ -223,6 +223,8 @@ static void __init ps3_setup_arch(void)
 	ppc_md.power_save = ps3_power_save;
 	ps3_os_area_init();
 
+	pm_power_off = ps3_power_off;
+
 	DBG(" <- %s:%d\n", __func__, __LINE__);
 }
 
@@ -278,7 +280,6 @@ define_machine(ps3) {
 	.calibrate_decr			= ps3_calibrate_decr,
 	.progress			= ps3_progress,
 	.restart			= ps3_restart,
-	.power_off			= ps3_power_off,
 	.halt				= ps3_halt,
 #if defined(CONFIG_KEXEC)
 	.kexec_cpu_down			= ps3_kexec_cpu_down,
-- 
1.8.1.4

^ permalink raw reply related

* [PATCH 17/20] powerpc/powernv: Use pm_power_off rather than ppc_md.power_off
From: Alexander Graf @ 2014-10-01 13:28 UTC (permalink / raw)
  To: linuxppc-dev
  Cc: Arnd Bergmann, Geoff Levand, Alistair Popple, Scott Wood,
	Anatolij Gustschin
In-Reply-To: <1412170086-57971-1-git-send-email-agraf@suse.de>

The generic power off callback is pm_power_off. Use that one rather than
the powerpc specific ppc_md.power_off.

Signed-off-by: Alexander Graf <agraf@suse.de>
---
 arch/powerpc/platforms/powernv/setup.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/platforms/powernv/setup.c b/arch/powerpc/platforms/powernv/setup.c
index 5a0e2dc..60d137b 100644
--- a/arch/powerpc/platforms/powernv/setup.c
+++ b/arch/powerpc/platforms/powernv/setup.c
@@ -260,7 +260,7 @@ static void __init pnv_setup_machdep_opal(void)
 	ppc_md.get_rtc_time = opal_get_rtc_time;
 	ppc_md.set_rtc_time = opal_set_rtc_time;
 	ppc_md.restart = pnv_restart;
-	ppc_md.power_off = pnv_power_off;
+	pm_power_off = pnv_power_off;
 	ppc_md.halt = pnv_halt;
 	ppc_md.machine_check_exception = opal_machine_check;
 	ppc_md.mce_check_early_recovery = opal_mce_check_early_recovery;
@@ -277,7 +277,7 @@ static void __init pnv_setup_machdep_rtas(void)
 		ppc_md.set_rtc_time = rtas_set_rtc_time;
 	}
 	ppc_md.restart = rtas_restart;
-	ppc_md.power_off = rtas_power_off;
+	pm_power_off = rtas_power_off;
 	ppc_md.halt = rtas_halt;
 }
 #endif /* CONFIG_PPC_POWERNV_RTAS */
-- 
1.8.1.4

^ permalink raw reply related

* [PATCH 15/20] powerpc/maple: Use pm_power_off rather than ppc_md.power_off
From: Alexander Graf @ 2014-10-01 13:28 UTC (permalink / raw)
  To: linuxppc-dev
  Cc: Arnd Bergmann, Geoff Levand, Alistair Popple, Scott Wood,
	Anatolij Gustschin
In-Reply-To: <1412170086-57971-1-git-send-email-agraf@suse.de>

The generic power off callback is pm_power_off. Use that one rather than
the powerpc specific ppc_md.power_off.

Signed-off-by: Alexander Graf <agraf@suse.de>
---
 arch/powerpc/platforms/maple/setup.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/platforms/maple/setup.c b/arch/powerpc/platforms/maple/setup.c
index cb1b0b3..34a08db 100644
--- a/arch/powerpc/platforms/maple/setup.c
+++ b/arch/powerpc/platforms/maple/setup.c
@@ -169,7 +169,7 @@ static void __init maple_use_rtas_reboot_and_halt_if_present(void)
 	if (rtas_service_present("system-reboot") &&
 	    rtas_service_present("power-off")) {
 		ppc_md.restart = rtas_restart;
-		ppc_md.power_off = rtas_power_off;
+		pm_power_off = rtas_power_off;
 		ppc_md.halt = rtas_halt;
 	}
 }
@@ -189,6 +189,7 @@ void __init maple_setup_arch(void)
 #ifdef CONFIG_DUMMY_CONSOLE
 	conswitchp = &dummy_con;
 #endif
+	pm_power_off = maple_power_off;
 	maple_use_rtas_reboot_and_halt_if_present();
 
 	printk(KERN_DEBUG "Using native/NAP idle loop\n");
@@ -325,7 +326,6 @@ define_machine(maple) {
 	.pci_irq_fixup		= maple_pci_irq_fixup,
 	.pci_get_legacy_ide_irq	= maple_pci_get_legacy_ide_irq,
 	.restart		= maple_restart,
-	.power_off		= maple_power_off,
 	.halt			= maple_halt,
        	.get_boot_time		= maple_get_boot_time,
        	.set_rtc_time		= maple_set_rtc_time,
-- 
1.8.1.4

^ permalink raw reply related

* [PATCH 11/20] powerpc/chrp: Use pm_power_off rather than ppc_md.power_off
From: Alexander Graf @ 2014-10-01 13:27 UTC (permalink / raw)
  To: linuxppc-dev
  Cc: Arnd Bergmann, Geoff Levand, Alistair Popple, Scott Wood,
	Anatolij Gustschin
In-Reply-To: <1412170086-57971-1-git-send-email-agraf@suse.de>

The generic power off callback is pm_power_off. Use that one rather than
the powerpc specific ppc_md.power_off.

Signed-off-by: Alexander Graf <agraf@suse.de>
---
 arch/powerpc/platforms/chrp/setup.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/platforms/chrp/setup.c b/arch/powerpc/platforms/chrp/setup.c
index 7044fd3..f9ad816 100644
--- a/arch/powerpc/platforms/chrp/setup.c
+++ b/arch/powerpc/platforms/chrp/setup.c
@@ -356,6 +356,8 @@ void __init chrp_setup_arch(void)
 
 	pci_create_OF_bus_map();
 
+	pm_power_off = rtas_power_off,
+
 	/*
 	 * Print the banner, then scroll down so boot progress
 	 * can be printed.  -- Cort
@@ -597,7 +599,6 @@ define_machine(chrp) {
 	.show_cpuinfo		= chrp_show_cpuinfo,
 	.init_IRQ		= chrp_init_IRQ,
 	.restart		= rtas_restart,
-	.power_off		= rtas_power_off,
 	.halt			= rtas_halt,
 	.time_init		= chrp_time_init,
 	.set_rtc_time		= chrp_set_rtc_time,
-- 
1.8.1.4

^ permalink raw reply related

* [PATCH 01/20] powerpc: Support override of pm_power_off
From: Alexander Graf @ 2014-10-01 13:27 UTC (permalink / raw)
  To: linuxppc-dev
  Cc: Arnd Bergmann, Geoff Levand, Alistair Popple, Scott Wood,
	Anatolij Gustschin
In-Reply-To: <1412170086-57971-1-git-send-email-agraf@suse.de>

The pm_power_off callback is what drivers are supposed to modify when they
implement power off support for the system.

Support a modified callback on powerpc. That way power off support code can
now either override ppc_md.power_off or pm_power_off.

Signed-off-by: Alexander Graf <agraf@suse.de>
---
 arch/powerpc/kernel/setup-common.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c
index 1b0e260..5dfcb28 100644
--- a/arch/powerpc/kernel/setup-common.c
+++ b/arch/powerpc/kernel/setup-common.c
@@ -140,6 +140,8 @@ void machine_power_off(void)
 	machine_shutdown();
 	if (ppc_md.power_off)
 		ppc_md.power_off();
+	if (pm_power_off != machine_power_off)
+		pm_power_off();
 #ifdef CONFIG_SMP
 	smp_send_stop();
 #endif
-- 
1.8.1.4

^ permalink raw reply related

* [PATCH 09/20] powerpc/cell/qpace: Use pm_power_off rather than ppc_md.power_off
From: Alexander Graf @ 2014-10-01 13:27 UTC (permalink / raw)
  To: linuxppc-dev
  Cc: Arnd Bergmann, Geoff Levand, Alistair Popple, Scott Wood,
	Anatolij Gustschin
In-Reply-To: <1412170086-57971-1-git-send-email-agraf@suse.de>

The generic power off callback is pm_power_off. Use that one rather than
the powerpc specific ppc_md.power_off.

Signed-off-by: Alexander Graf <agraf@suse.de>
---
 arch/powerpc/platforms/cell/qpace_setup.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/platforms/cell/qpace_setup.c b/arch/powerpc/platforms/cell/qpace_setup.c
index 6e3409d..8488094 100644
--- a/arch/powerpc/platforms/cell/qpace_setup.c
+++ b/arch/powerpc/platforms/cell/qpace_setup.c
@@ -117,6 +117,8 @@ static void __init qpace_setup_arch(void)
 #ifdef CONFIG_DUMMY_CONSOLE
 	conswitchp = &dummy_con;
 #endif
+
+	pm_power_off = rtas_power_off;
 }
 
 static int __init qpace_probe(void)
@@ -137,7 +139,6 @@ define_machine(qpace) {
 	.setup_arch		= qpace_setup_arch,
 	.show_cpuinfo		= qpace_show_cpuinfo,
 	.restart		= rtas_restart,
-	.power_off		= rtas_power_off,
 	.halt			= rtas_halt,
 	.get_boot_time		= rtas_get_boot_time,
 	.get_rtc_time		= rtas_get_rtc_time,
-- 
1.8.1.4

^ permalink raw reply related

* [PATCH 06/20] powerpc/corenet: Use pm_power_off rather than ppc_md.power_off
From: Alexander Graf @ 2014-10-01 13:27 UTC (permalink / raw)
  To: linuxppc-dev
  Cc: Arnd Bergmann, Geoff Levand, Alistair Popple, Scott Wood,
	Anatolij Gustschin
In-Reply-To: <1412170086-57971-1-git-send-email-agraf@suse.de>

The generic power off callback is pm_power_off. Use that one rather than
the powerpc specific ppc_md.power_off.

Signed-off-by: Alexander Graf <agraf@suse.de>
---
 arch/powerpc/platforms/85xx/corenet_generic.c | 2 +-
 arch/powerpc/sysdev/fsl_soc.c                 | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/platforms/85xx/corenet_generic.c b/arch/powerpc/platforms/85xx/corenet_generic.c
index d22dd85..89fd568 100644
--- a/arch/powerpc/platforms/85xx/corenet_generic.c
+++ b/arch/powerpc/platforms/85xx/corenet_generic.c
@@ -156,7 +156,7 @@ static int __init corenet_generic_probe(void)
 
 			ppc_md.get_irq = ehv_pic_get_irq;
 			ppc_md.restart = fsl_hv_restart;
-			ppc_md.power_off = fsl_hv_halt;
+			pm_power_off = fsl_hv_halt;
 			ppc_md.halt = fsl_hv_halt;
 #ifdef CONFIG_SMP
 			/*
diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c
index ffd1169..1e04568 100644
--- a/arch/powerpc/sysdev/fsl_soc.c
+++ b/arch/powerpc/sysdev/fsl_soc.c
@@ -238,7 +238,7 @@ void fsl_hv_restart(char *cmd)
 /*
  * Halt the current partition
  *
- * This function should be assigned to the ppc_md.power_off and ppc_md.halt
+ * This function should be assigned to the pm_power_off and ppc_md.halt
  * function pointers, to shut down the partition when we're running under
  * the Freescale hypervisor.
  */
-- 
1.8.1.4

^ permalink raw reply related

* [PATCH 13/20] powerpc/6xx/linkstation: Use pm_power_off rather than ppc_md.power_off
From: Alexander Graf @ 2014-10-01 13:27 UTC (permalink / raw)
  To: linuxppc-dev
  Cc: Arnd Bergmann, Geoff Levand, Alistair Popple, Scott Wood,
	Anatolij Gustschin
In-Reply-To: <1412170086-57971-1-git-send-email-agraf@suse.de>

The generic power off callback is pm_power_off. Use that one rather than
the powerpc specific ppc_md.power_off.

Signed-off-by: Alexander Graf <agraf@suse.de>
---
 arch/powerpc/platforms/embedded6xx/linkstation.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/platforms/embedded6xx/linkstation.c b/arch/powerpc/platforms/embedded6xx/linkstation.c
index 455e7c08..e397e36 100644
--- a/arch/powerpc/platforms/embedded6xx/linkstation.c
+++ b/arch/powerpc/platforms/embedded6xx/linkstation.c
@@ -70,6 +70,8 @@ static void __init linkstation_setup_arch(void)
 	for_each_compatible_node(np, "pci", "mpc10x-pci")
 		linkstation_add_bridge(np);
 
+	pm_power_off = linkstation_power_off;
+
 	printk(KERN_INFO "BUFFALO Network Attached Storage Series\n");
 	printk(KERN_INFO "(C) 2002-2005 BUFFALO INC.\n");
 }
@@ -158,7 +160,6 @@ define_machine(linkstation){
 	.show_cpuinfo 		= linkstation_show_cpuinfo,
 	.get_irq 		= mpic_get_irq,
 	.restart 		= linkstation_restart,
-	.power_off 		= linkstation_power_off,
 	.halt	 		= linkstation_halt,
 	.calibrate_decr 	= generic_calibrate_decr,
 };
-- 
1.8.1.4

^ permalink raw reply related

* [PATCH 02/20] powerpc/xmon: Support either ppc_md.power_off or pm_power_off
From: Alexander Graf @ 2014-10-01 13:27 UTC (permalink / raw)
  To: linuxppc-dev
  Cc: Arnd Bergmann, Geoff Levand, Alistair Popple, Scott Wood,
	Anatolij Gustschin
In-Reply-To: <1412170086-57971-1-git-send-email-agraf@suse.de>

Xmon can manually turn off the machine. We now have 2 code paths for this:

  1) ppc_md.power_off
  2) pm_power_off

This patch allows xmon to support both and makes sure it graciously allows
a path to not be implemented.

Signed-off-by: Alexander Graf <agraf@suse.de>
---
 arch/powerpc/xmon/xmon.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
index b988b5a..531f649 100644
--- a/arch/powerpc/xmon/xmon.c
+++ b/arch/powerpc/xmon/xmon.c
@@ -981,7 +981,10 @@ static void bootcmds(void)
 	else if (cmd == 'h')
 		ppc_md.halt();
 	else if (cmd == 'p')
-		ppc_md.power_off();
+		if (ppc_md.power_off)
+			ppc_md.power_off();
+		if (pm_power_off)
+			pm_power_off();
 }
 
 static int cpu_cmd(void)
-- 
1.8.1.4

^ permalink raw reply related


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