LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH V4] ASoC: fsl_ssi: refine ipg clock usage in this module
From: Shengjiu Wang @ 2014-09-16  2:13 UTC (permalink / raw)
  To: timur, nicoleotsuka, Li.Xiubo, lgirdwood, broonie, perex, tiwai,
	mpa
  Cc: alsa-devel, linuxppc-dev, linux-kernel

Check if ipg clock is in clock-names property, then we can move the
ipg clock enable and disable operation to startup and shutdown, that
is only enable ipg clock when ssi is working and keep clock is disabled
when ssi is in idle.
But when the checking is failed, remain the clock control as before.

Tested-by: Markus Pargmann <mpa@pengutronix.de>
Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
---
v4 change log:
fix the code indent issue.

 sound/soc/fsl/fsl_ssi.c |   53 ++++++++++++++++++++++++++++++++++++++++-------
 1 file changed, 45 insertions(+), 8 deletions(-)

diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c
index 2fc3e66..16a1361 100644
--- a/sound/soc/fsl/fsl_ssi.c
+++ b/sound/soc/fsl/fsl_ssi.c
@@ -169,6 +169,7 @@ struct fsl_ssi_private {
 	u8 i2s_mode;
 	bool use_dma;
 	bool use_dual_fifo;
+	bool has_ipg_clk_name;
 	unsigned int fifo_depth;
 	struct fsl_ssi_rxtx_reg_val rxtx_reg_val;
 
@@ -530,6 +531,11 @@ static int fsl_ssi_startup(struct snd_pcm_substream *substream,
 	struct snd_soc_pcm_runtime *rtd = substream->private_data;
 	struct fsl_ssi_private *ssi_private =
 		snd_soc_dai_get_drvdata(rtd->cpu_dai);
+	int ret;
+
+	ret = clk_prepare_enable(ssi_private->clk);
+	if (ret)
+		return ret;
 
 	/* When using dual fifo mode, it is safer to ensure an even period
 	 * size. If appearing to an odd number while DMA always starts its
@@ -544,6 +550,21 @@ static int fsl_ssi_startup(struct snd_pcm_substream *substream,
 }
 
 /**
+ * fsl_ssi_shutdown: shutdown the SSI
+ *
+ */
+static void fsl_ssi_shutdown(struct snd_pcm_substream *substream,
+				struct snd_soc_dai *dai)
+{
+	struct snd_soc_pcm_runtime *rtd = substream->private_data;
+	struct fsl_ssi_private *ssi_private =
+		snd_soc_dai_get_drvdata(rtd->cpu_dai);
+
+	clk_disable_unprepare(ssi_private->clk);
+
+}
+
+/**
  * fsl_ssi_set_bclk - configure Digital Audio Interface bit clock
  *
  * Note: This function can be only called when using SSI as DAI master
@@ -1043,6 +1064,7 @@ static int fsl_ssi_dai_probe(struct snd_soc_dai *dai)
 
 static const struct snd_soc_dai_ops fsl_ssi_dai_ops = {
 	.startup	= fsl_ssi_startup,
+	.shutdown       = fsl_ssi_shutdown,
 	.hw_params	= fsl_ssi_hw_params,
 	.hw_free	= fsl_ssi_hw_free,
 	.set_fmt	= fsl_ssi_set_dai_fmt,
@@ -1168,17 +1190,22 @@ static int fsl_ssi_imx_probe(struct platform_device *pdev,
 	u32 dmas[4];
 	int ret;
 
-	ssi_private->clk = devm_clk_get(&pdev->dev, NULL);
+	if (ssi_private->has_ipg_clk_name)
+		ssi_private->clk = devm_clk_get(&pdev->dev, "ipg");
+	else
+		ssi_private->clk = devm_clk_get(&pdev->dev, NULL);
 	if (IS_ERR(ssi_private->clk)) {
 		ret = PTR_ERR(ssi_private->clk);
 		dev_err(&pdev->dev, "could not get clock: %d\n", ret);
 		return ret;
 	}
 
-	ret = clk_prepare_enable(ssi_private->clk);
-	if (ret) {
-		dev_err(&pdev->dev, "clk_prepare_enable failed: %d\n", ret);
-		return ret;
+	if (!ssi_private->has_ipg_clk_name) {
+		ret = clk_prepare_enable(ssi_private->clk);
+		if (ret) {
+			dev_err(&pdev->dev, "clk_prepare_enable failed: %d\n", ret);
+			return ret;
+		}
 	}
 
 	/* For those SLAVE implementations, we ingore non-baudclk cases
@@ -1236,8 +1263,9 @@ static int fsl_ssi_imx_probe(struct platform_device *pdev,
 	return 0;
 
 error_pcm:
-	clk_disable_unprepare(ssi_private->clk);
 
+	if (!ssi_private->has_ipg_clk_name)
+		clk_disable_unprepare(ssi_private->clk);
 	return ret;
 }
 
@@ -1246,7 +1274,8 @@ static void fsl_ssi_imx_clean(struct platform_device *pdev,
 {
 	if (!ssi_private->use_dma)
 		imx_pcm_fiq_exit(pdev);
-	clk_disable_unprepare(ssi_private->clk);
+	if (!ssi_private->has_ipg_clk_name)
+		clk_disable_unprepare(ssi_private->clk);
 }
 
 static int fsl_ssi_probe(struct platform_device *pdev)
@@ -1321,8 +1350,16 @@ static int fsl_ssi_probe(struct platform_device *pdev)
 		return -ENOMEM;
 	}
 
-	ssi_private->regs = devm_regmap_init_mmio(&pdev->dev, iomem,
+	ret = of_property_match_string(np, "clock-names", "ipg");
+	if (ret < 0) {
+		ssi_private->has_ipg_clk_name = false;
+		ssi_private->regs = devm_regmap_init_mmio(&pdev->dev, iomem,
 			&fsl_ssi_regconfig);
+	} else {
+		ssi_private->has_ipg_clk_name = true;
+		ssi_private->regs = devm_regmap_init_mmio_clk(&pdev->dev,
+			"ipg", iomem, &fsl_ssi_regconfig);
+	}
 	if (IS_ERR(ssi_private->regs)) {
 		dev_err(&pdev->dev, "Failed to init register map\n");
 		return PTR_ERR(ssi_private->regs);
-- 
1.7.9.5

^ permalink raw reply related

* Re: [PATCH] powerpc/eeh: Fix kernel crash when passing through VF
From: Michael Ellerman @ 2014-09-16  4:03 UTC (permalink / raw)
  To: Wei Yang; +Cc: linuxppc-dev, gwshan
In-Reply-To: <1410768481-27325-1-git-send-email-weiyang@linux.vnet.ibm.com>

On Mon, 2014-09-15 at 16:08 +0800, Wei Yang wrote:
> This patch introduces a marco to convert eeh_dev to eeh_pe. By doing so, it
> will prevent converting with NULL pointer.
> 
> Signed-off-by: Wei Yang <weiyang@linux.vnet.ibm.com>
> Acked-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
> 
> V2 -> V3:
>    1. rebased on 3.17-rc4
>    2. introduce a marco
>    3. use this marco in several other places

Macro :)

> diff --git a/arch/powerpc/kernel/eeh.c b/arch/powerpc/kernel/eeh.c
> index 59a64f8..0f1b637 100644
> --- a/arch/powerpc/kernel/eeh.c
> +++ b/arch/powerpc/kernel/eeh.c
> @@ -410,7 +410,7 @@ int eeh_dev_check_failure(struct eeh_dev *edev)
>  	}
>  	dn = eeh_dev_to_of_node(edev);
>  	dev = eeh_dev_to_pci_dev(edev);
> -	pe = edev->pe;
> +	pe = eeh_dev_to_pe(edev);

This looks good, but ..

> diff --git a/include/linux/pci.h b/include/linux/pci.h
> index fd03e819..9656f92 100644
> --- a/include/linux/pci.h
> +++ b/include/linux/pci.h
> @@ -1824,6 +1824,11 @@ static inline struct eeh_dev *pci_dev_to_eeh_dev(struct pci_dev *pdev)
>  {
>  	return pdev->dev.archdata.edev;
>  }
> +
> +static inline struct eeh_pe *eeh_dev_to_pe(struct eeh_dev* edev)
> +{
> +	return edev ? edev->pe : NULL;
> +}
>  #endif

Why is it in linux/pci.h ? It's powerpc specific, it should be in arch/powerpc/include/asm/pci.h

cheers

^ permalink raw reply

* Re: [PATCH] powerpc: Fix build failure
From: Alistair Popple @ 2014-09-16  4:12 UTC (permalink / raw)
  To: Pranith Kumar; +Cc: open list, Paul Mackerras, open list:LINUX FOR POWERPC...
In-Reply-To: <1408626271-13519-1-git-send-email-bobby.prani@gmail.com>

Thanks for fixing these!

Acked-by: Alistair Popple <alistair@popple.id.au>

On Thu, 21 Aug 2014 09:04:31 Pranith Kumar wrote:
> Fix the following build failure
> 
> drivers/built-in.o: In function `nhi_init':
> nhi.c:(.init.text+0x63390): undefined reference to `ehci_init_driver'
> 
> by adding a dependency on USB_EHCI_HCD which supplies the
> ehci_init_driver().
> 
> Also we need to depend on USB_OHCI_HCD similarly
> 
> Signed-off-by: Pranith Kumar <bobby.prani@gmail.com>
> ---
>  arch/powerpc/platforms/44x/Kconfig | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/powerpc/platforms/44x/Kconfig
> b/arch/powerpc/platforms/44x/Kconfig index 4d88f6a..3e7deb2 100644
> --- a/arch/powerpc/platforms/44x/Kconfig
> +++ b/arch/powerpc/platforms/44x/Kconfig
> @@ -216,8 +216,8 @@ config AKEBONO
>  	select IBM_EMAC_EMAC4
>  	select IBM_EMAC_RGMII_WOL
>  	select USB
> -	select USB_OHCI_HCD_PLATFORM
> -	select USB_EHCI_HCD_PLATFORM
> +	select USB_OHCI_HCD_PLATFORM if USB_OHCI_HCD
> +	select USB_EHCI_HCD_PLATFORM if USB_EHCI_HCD
>  	select MMC_SDHCI
>  	select MMC_SDHCI_PLTFM
>  	select MMC_SDHCI_OF_476GTR

^ permalink raw reply

* Re: [PATCH] powerpc: Fix build failure when CONFIG_USB=y
From: Alistair Popple @ 2014-09-16  4:12 UTC (permalink / raw)
  To: Pranith Kumar; +Cc: open list, Paul Mackerras, open list:LINUX FOR POWERPC...
In-Reply-To: <1408626964-31554-1-git-send-email-bobby.prani@gmail.com>

Thanks for fixing these!

Acked-by: Alistair Popple <alistair@popple.id.au>

On Thu, 21 Aug 2014 09:16:04 Pranith Kumar wrote:
> We are enabling USB unconditionally which results in following build failure
> 
> drivers/built-in.o: In function `tb_drom_read':
> (.text+0x1b62b70): undefined reference to `usb_speed_string'
> make: *** [vmlinux] Error
> 
> Enable USB only if USB_SUPPORT is set to avoid such failures
> 
> Signed-off-by: Pranith Kumar <bobby.prani@gmail.com>
> ---
>  arch/powerpc/platforms/44x/Kconfig | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/powerpc/platforms/44x/Kconfig
> b/arch/powerpc/platforms/44x/Kconfig index 3e7deb2..82f2da2 100644
> --- a/arch/powerpc/platforms/44x/Kconfig
> +++ b/arch/powerpc/platforms/44x/Kconfig
> @@ -215,7 +215,7 @@ config AKEBONO
>  	select NET_VENDOR_IBM
>  	select IBM_EMAC_EMAC4
>  	select IBM_EMAC_RGMII_WOL
> -	select USB
> +	select USB if USB_SUPPORT
>  	select USB_OHCI_HCD_PLATFORM if USB_OHCI_HCD
>  	select USB_EHCI_HCD_PLATFORM if USB_EHCI_HCD
>  	select MMC_SDHCI

^ permalink raw reply

* Re: Data Cache Push Parity Error
From: Scott Wood @ 2014-09-16  4:23 UTC (permalink / raw)
  To: Jay_Chen; +Cc: linuxppc-dev
In-Reply-To: <5538ce4d2de54f2fb7a29a66b33d70b0@HQMBS02.alphanetworks.com>

On Mon, 2014-09-15 at 08:15 +0000, Jay_Chen@alphanetworks.com wrote:
> Hi all,
> 
>  
> 
> I am using P2020 with Linux kernel 3.8.13.
> 
> Sometimes my system encounters machine check exception and it shows
> “Caused by (from MCSR=20000000): Data Cache Push Parity Error”.
> 
> Could anyone show me some hints to dig into this issue? Any comment is
> welcome.
> 
> Thanks in advance.

I suggest contacting Freescale support about this
(support@freescale.com) -- I don't think this is the type of error that
you'd normally see from software misbehavior.

-Scott

^ permalink raw reply

* Re: [PATCH v1 15/21] Powerpc/MSI: Use MSI chip framework to configure MSI/MSI-X irq
From: Michael Ellerman @ 2014-09-16  5:28 UTC (permalink / raw)
  To: Yijing Wang
  Cc: linux-mips, linux-ia64, linux-pci, Xinwei Hu, sparclinux,
	linux-arch, linux-s390, Russell King, Joerg Roedel, x86,
	Sebastian Ott, xen-devel, arnab.basu, Arnd Bergmann,
	Konrad Rzeszutek Wilk, Chris Metcalf, Bjorn Helgaas,
	Thomas Gleixner, linux-arm-kernel, Bharat.Bhushan, Tony Luck,
	Ralf Baechle, iommu, Wuyun, linuxppc-dev, David S. Miller
In-Reply-To: <1409911806-10519-16-git-send-email-wangyijing@huawei.com>

On Fri, 2014-09-05 at 18:10 +0800, Yijing Wang wrote:
> Use MSI chip framework instead of arch MSI functions to configure
> MSI/MSI-X irq. So we can manage MSI/MSI-X irq in a unified framework.
> 
> Signed-off-by: Yijing Wang <wangyijing@huawei.com>

This looks fine and seems to boot OK.

Acked-by: Michael Ellerman <mpe@ellerman.id.au> (powerpc)

cheers

^ permalink raw reply

* Re: [PATCH v1 15/21] Powerpc/MSI: Use MSI chip framework to configure MSI/MSI-X irq
From: Yijing Wang @ 2014-09-16  5:40 UTC (permalink / raw)
  To: Michael Ellerman
  Cc: linux-mips, linux-ia64, linux-pci, Xinwei Hu, sparclinux,
	linux-arch, linux-s390, Russell King, Joerg Roedel, x86,
	Sebastian Ott, xen-devel, arnab.basu, Arnd Bergmann,
	Konrad Rzeszutek Wilk, Chris Metcalf, Bjorn Helgaas,
	Thomas Gleixner, linux-arm-kernel, Bharat.Bhushan, Tony Luck,
	Ralf Baechle, iommu, Wuyun, linuxppc-dev, David S. Miller
In-Reply-To: <1410845317.12488.2.camel@concordia>

On 2014/9/16 13:28, Michael Ellerman wrote:
> On Fri, 2014-09-05 at 18:10 +0800, Yijing Wang wrote:
>> Use MSI chip framework instead of arch MSI functions to configure
>> MSI/MSI-X irq. So we can manage MSI/MSI-X irq in a unified framework.
>>
>> Signed-off-by: Yijing Wang <wangyijing@huawei.com>
> 
> This looks fine and seems to boot OK.
> 
> Acked-by: Michael Ellerman <mpe@ellerman.id.au> (powerpc)

Thanks very much!

> 
> cheers
> 
> 
> 
> .
> 


-- 
Thanks!
Yijing

^ permalink raw reply

* Re: [PATCH] powerpc/eeh: Fix kernel crash when passing through VF
From: Wei Yang @ 2014-09-16  6:02 UTC (permalink / raw)
  To: Michael Ellerman; +Cc: Wei Yang, linuxppc-dev, gwshan
In-Reply-To: <1410840236.12488.1.camel@concordia>

On Tue, Sep 16, 2014 at 02:03:56PM +1000, Michael Ellerman wrote:
>On Mon, 2014-09-15 at 16:08 +0800, Wei Yang wrote:
>> This patch introduces a marco to convert eeh_dev to eeh_pe. By doing so, it
>> will prevent converting with NULL pointer.
>> 
>> Signed-off-by: Wei Yang <weiyang@linux.vnet.ibm.com>
>> Acked-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
>> 
>> V2 -> V3:
>>    1. rebased on 3.17-rc4
>>    2. introduce a marco
>>    3. use this marco in several other places
>
>Macro :)

:-)

>
>> diff --git a/arch/powerpc/kernel/eeh.c b/arch/powerpc/kernel/eeh.c
>> index 59a64f8..0f1b637 100644
>> --- a/arch/powerpc/kernel/eeh.c
>> +++ b/arch/powerpc/kernel/eeh.c
>> @@ -410,7 +410,7 @@ int eeh_dev_check_failure(struct eeh_dev *edev)
>>  	}
>>  	dn = eeh_dev_to_of_node(edev);
>>  	dev = eeh_dev_to_pci_dev(edev);
>> -	pe = edev->pe;
>> +	pe = eeh_dev_to_pe(edev);
>
>This looks good, but ..
>
>> diff --git a/include/linux/pci.h b/include/linux/pci.h
>> index fd03e819..9656f92 100644
>> --- a/include/linux/pci.h
>> +++ b/include/linux/pci.h
>> @@ -1824,6 +1824,11 @@ static inline struct eeh_dev *pci_dev_to_eeh_dev(struct pci_dev *pdev)
>>  {
>>  	return pdev->dev.archdata.edev;
>>  }
>> +
>> +static inline struct eeh_pe *eeh_dev_to_pe(struct eeh_dev* edev)
>> +{
>> +	return edev ? edev->pe : NULL;
>> +}
>>  #endif
>
>Why is it in linux/pci.h ? It's powerpc specific, it should be in arch/powerpc/include/asm/pci.h
>

Good question, let me move to powerpc directory and have a try.

>cheers
>

-- 
Richard Yang
Help you, Help me

^ permalink raw reply

* Re: [PATCH v2 5/5] MSI: Use __read_msi_msg() instead of read_msi_msg()
From: Michael Ellerman @ 2014-09-16  6:34 UTC (permalink / raw)
  To: Yijing Wang; +Cc: Bjorn Helgaas, linux-pci, linuxppc-dev
In-Reply-To: <1408694880-8260-6-git-send-email-wangyijing@huawei.com>

On Fri, 2014-08-22 at 16:08 +0800, Yijing Wang wrote:
> Read_msi_msg() only be called in rtas_setup_msi_irqs(),
> use __read_msi_msg() instead of read_msi_msg for
> simplification. And rename __read_msi_msg() to
> read_msi_msg().
> 
> Signed-off-by: Yijing Wang <wangyijing@huawei.com>
> CC: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> CC: linuxppc-dev@lists.ozlabs.org

LGTM.

Acked-by: Michael Ellerman <mpe@ellerman.id.au> (powerpc)

cheers

^ permalink raw reply

* Re: [PATCH v2 5/5] MSI: Use __read_msi_msg() instead of read_msi_msg()
From: Yijing Wang @ 2014-09-16  6:47 UTC (permalink / raw)
  To: Michael Ellerman; +Cc: Bjorn Helgaas, linux-pci, linuxppc-dev
In-Reply-To: <1410849257.12488.3.camel@concordia>

On 2014/9/16 14:34, Michael Ellerman wrote:
> On Fri, 2014-08-22 at 16:08 +0800, Yijing Wang wrote:
>> Read_msi_msg() only be called in rtas_setup_msi_irqs(),
>> use __read_msi_msg() instead of read_msi_msg for
>> simplification. And rename __read_msi_msg() to
>> read_msi_msg().
>>
>> Signed-off-by: Yijing Wang <wangyijing@huawei.com>
>> CC: Benjamin Herrenschmidt <benh@kernel.crashing.org>
>> CC: linuxppc-dev@lists.ozlabs.org
> 
> LGTM.
> 
> Acked-by: Michael Ellerman <mpe@ellerman.id.au> (powerpc)

Thanks!

> 
> cheers
> 
> 
> 
> 


-- 
Thanks!
Yijing

^ permalink raw reply

* Re: [PATCH v2 2/2] pseries: Fix endian issues in cpu hot-removal
From: Michael Ellerman @ 2014-09-16  7:00 UTC (permalink / raw)
  To: Bharata B Rao; +Cc: linuxppc-dev, Thomas Falcon
In-Reply-To: <CAGZKiBoaXLc3dKGu5HGbU57+Lvi1KDUX=EYoi54PjYmEUjVUDg@mail.gmail.com>

On Mon, 2014-09-15 at 12:16 +0530, Bharata B Rao wrote:
> On Sat, Sep 13, 2014 at 12:41 AM, Thomas Falcon
> <tlfalcon@linux.vnet.ibm.com> wrote:
> >
> > diff --git a/arch/powerpc/platforms/pseries/dlpar.c b/arch/powerpc/platforms/pseries/dlpar.c
> > index 9e9f30b2..343dfdf 100644
> > --- a/arch/powerpc/platforms/pseries/dlpar.c
> > +++ b/arch/powerpc/platforms/pseries/dlpar.c
> > @@ -496,15 +498,15 @@ out:
> >  static ssize_t dlpar_cpu_release(const char *buf, size_t count)
> >  {
> >         struct device_node *dn;
> > -       const u32 *drc_index;
> > +       const u32 drc_index;
> >         int rc;
> >
> >         dn = of_find_node_by_path(buf);
> >         if (!dn)
> >                 return -EINVAL;
> >
> > -       drc_index = of_get_property(dn, "ibm,my-drc-index", NULL);
> > -       if (!drc_index) {
> > +       rc = of_property_read_u32(dn, "ibm,my-drc-index", &drc_index);
> 
> Use of const for drc_index causes compilation problems.

Yes that's clearly wrong.

Please fix and retest.

cheers

^ permalink raw reply

* Re: [PATCH] powerpc/eeh: Fix kernel crash when passing through VF
From: Gavin Shan @ 2014-09-16  7:14 UTC (permalink / raw)
  To: Wei Yang; +Cc: linuxppc-dev, gwshan
In-Reply-To: <20140916060218.GA20909@richard>

On Tue, Sep 16, 2014 at 02:02:18PM +0800, Wei Yang wrote:
>On Tue, Sep 16, 2014 at 02:03:56PM +1000, Michael Ellerman wrote:
>>On Mon, 2014-09-15 at 16:08 +0800, Wei Yang wrote:
>>> This patch introduces a marco to convert eeh_dev to eeh_pe. By doing so, it
>>> will prevent converting with NULL pointer.
>>> 
>>> Signed-off-by: Wei Yang <weiyang@linux.vnet.ibm.com>
>>> Acked-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
>>> 
>>> V2 -> V3:
>>>    1. rebased on 3.17-rc4
>>>    2. introduce a marco
>>>    3. use this marco in several other places
>>
>>Macro :)
>
>:-)
>
>>
>>> diff --git a/arch/powerpc/kernel/eeh.c b/arch/powerpc/kernel/eeh.c
>>> index 59a64f8..0f1b637 100644
>>> --- a/arch/powerpc/kernel/eeh.c
>>> +++ b/arch/powerpc/kernel/eeh.c
>>> @@ -410,7 +410,7 @@ int eeh_dev_check_failure(struct eeh_dev *edev)
>>>  	}
>>>  	dn = eeh_dev_to_of_node(edev);
>>>  	dev = eeh_dev_to_pci_dev(edev);
>>> -	pe = edev->pe;
>>> +	pe = eeh_dev_to_pe(edev);
>>
>>This looks good, but ..
>>
>>> diff --git a/include/linux/pci.h b/include/linux/pci.h
>>> index fd03e819..9656f92 100644
>>> --- a/include/linux/pci.h
>>> +++ b/include/linux/pci.h
>>> @@ -1824,6 +1824,11 @@ static inline struct eeh_dev *pci_dev_to_eeh_dev(struct pci_dev *pdev)
>>>  {
>>>  	return pdev->dev.archdata.edev;
>>>  }
>>> +
>>> +static inline struct eeh_pe *eeh_dev_to_pe(struct eeh_dev* edev)
>>> +{
>>> +	return edev ? edev->pe : NULL;
>>> +}
>>>  #endif
>>
>>Why is it in linux/pci.h ? It's powerpc specific, it should be in arch/powerpc/include/asm/pci.h
>>
>
>Good question, let me move to powerpc directory and have a try.
>

It would be part of arch/powerpc/include/asm/eeh.h :-)

Thanks,
Gavin

>>cheers
>>
>
>-- 
>Richard Yang
>Help you, Help me

^ permalink raw reply

* Re: [PATCH v1 03/21] MSI: Remove the redundant irq_set_chip_data()
From: Lucas Stach @ 2014-09-16 10:29 UTC (permalink / raw)
  To: Yijing Wang
  Cc: linux-mips, linux-ia64, linux-pci, Bharat.Bhushan, sparclinux,
	linux-arch, linux-s390, Russell King, Joerg Roedel, x86,
	Sebastian Ott, xen-devel, arnab.basu, Arnd Bergmann,
	Konrad Rzeszutek Wilk, Chris Metcalf, Bjorn Helgaas,
	Thomas Gleixner, linux-arm-kernel, Xinwei Hu, Tony Luck,
	Ralf Baechle, iommu, Wuyun, linuxppc-dev, David S. Miller
In-Reply-To: <541792C0.9090303@huawei.com>

Am Dienstag, den 16.09.2014, 09:30 +0800 schrieb Yijing Wang:
> On 2014/9/15 22:00, Lucas Stach wrote:
> > Am Freitag, den 05.09.2014, 18:09 +0800 schrieb Yijing Wang:
> >> Currently, pcie-designware, pcie-rcar, pci-tegra drivers
> >> use irq chip_data to save the msi_chip pointer. They
> >> already call irq_set_chip_data() in their own MSI irq map
> >> functions. So irq_set_chip_data() in arch_setup_msi_irq()
> >> is useless.
> >>
> >> Signed-off-by: Yijing Wang <wangyijing@huawei.com>
> >> ---
> >>  drivers/pci/msi.c |    2 --
> >>  1 files changed, 0 insertions(+), 2 deletions(-)
> >>
> >> diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
> >> index f6cb317..d547f7f 100644
> >> --- a/drivers/pci/msi.c
> >> +++ b/drivers/pci/msi.c
> >> @@ -41,8 +41,6 @@ int __weak arch_setup_msi_irq(struct pci_dev *dev, struct msi_desc *desc)
> >>  	if (err < 0)
> >>  		return err;
> >>  
> >> -	irq_set_chip_data(desc->irq, chip);
> >> -
> >>  	return 0;
> >>  }
> >>  
> > 
> > arch_teardown_msi_irq() expects to find the msi_chip in the irq
> > chip_data field. As this means drivers don't have any reasonable other
> > possibility to stuff things into this field, I think it would make sense
> > to do the cleanup the other way around: keep the irq_set_chip_data
> > arch_setup_msi_irq() and rip it out of the individual drivers.
> 
> Hi Lucas, thanks for your review and comments!
> irq_set_chip_data() should not be placed in MSI core functions, because other arch like x86,
> use irq_data->chip_data to stores irq_cfg. So how to set the chip_data is arch dependent.
> And this series is mainly to use MSI chip framework in all platforms.
> Currently, only ARM platform MSI drivers use the chip_data to store msi_chip, and the drivers call
> irq_set_chip_data() in their driver already. So I thought we should clean up it in MSI core code.
> 
Okay I see your point, so the cleanup done this way is okay.

But then this still introduces a problem: arch_teardown_msi_irq()
expects to find the msi_chip in the chip_data field, which is okay for
all ARM PCI host drivers, but not for other arch MSI chips.

You fix this by completely removing arch_teardown_msi_irq() at the end
of the series, but this still has the potential to introduce issues for
other arches than ARM within the series. So this patch should include a
change to replace the line

struct msi_chip *chip = irq_get_chip_data(irq);

with something that doesn't rely on the msi_chip being in the irq
chip_data field.

Regards,
Lucas

-- 
Pengutronix e.K.             | Lucas Stach                 |
Industrial Linux Solutions   | http://www.pengutronix.de/  |

^ permalink raw reply

* Re: [PATCH v1 03/21] MSI: Remove the redundant irq_set_chip_data()
From: Yijing Wang @ 2014-09-16 10:37 UTC (permalink / raw)
  To: Lucas Stach
  Cc: linux-mips, linux-ia64, linux-pci, Bharat.Bhushan, sparclinux,
	linux-arch, linux-s390, Russell King, Joerg Roedel, x86,
	Sebastian Ott, xen-devel, arnab.basu, Arnd Bergmann,
	Konrad Rzeszutek Wilk, Chris Metcalf, Bjorn Helgaas,
	Thomas Gleixner, linux-arm-kernel, Xinwei Hu, Tony Luck,
	Ralf Baechle, iommu, Wuyun, linuxppc-dev, David S. Miller
In-Reply-To: <1410863349.2746.5.camel@pengutronix.de>

>>> arch_teardown_msi_irq() expects to find the msi_chip in the irq
>>> chip_data field. As this means drivers don't have any reasonable other
>>> possibility to stuff things into this field, I think it would make sense
>>> to do the cleanup the other way around: keep the irq_set_chip_data
>>> arch_setup_msi_irq() and rip it out of the individual drivers.
>>
>> Hi Lucas, thanks for your review and comments!
>> irq_set_chip_data() should not be placed in MSI core functions, because other arch like x86,
>> use irq_data->chip_data to stores irq_cfg. So how to set the chip_data is arch dependent.
>> And this series is mainly to use MSI chip framework in all platforms.
>> Currently, only ARM platform MSI drivers use the chip_data to store msi_chip, and the drivers call
>> irq_set_chip_data() in their driver already. So I thought we should clean up it in MSI core code.
>>
> Okay I see your point, so the cleanup done this way is okay.
> 
> But then this still introduces a problem: arch_teardown_msi_irq()
> expects to find the msi_chip in the chip_data field, which is okay for
> all ARM PCI host drivers, but not for other arch MSI chips.
> 
> You fix this by completely removing arch_teardown_msi_irq() at the end
> of the series, but this still has the potential to introduce issues for
> other arches than ARM within the series. So this patch should include a
> change to replace the line
> 
> struct msi_chip *chip = irq_get_chip_data(irq);
> 
> with something that doesn't rely on the msi_chip being in the irq
> chip_data field.

OK, I will update arch_teardown_msi_irq() in this patch, thanks!

Thanks!
Yijing.

> 
> Regards,
> Lucas
> 


-- 
Thanks!
Yijing

^ permalink raw reply

* Re: [PATCH v1 16/21] s390/MSI: Use MSI chip framework to configure MSI/MSI-X irq
From: Sebastian Ott @ 2014-09-16 11:35 UTC (permalink / raw)
  To: Yijing Wang
  Cc: linux-mips, linux-ia64, linux-pci, Bharat.Bhushan, sparclinux,
	linux-arch, linux-s390, Russell King, Joerg Roedel, x86,
	xen-devel, arnab.basu, Arnd Bergmann, Konrad Rzeszutek Wilk,
	Chris Metcalf, Bjorn Helgaas, Thomas Gleixner, linux-arm-kernel,
	Xinwei Hu, Tony Luck, Ralf Baechle, iommu, Wuyun, linuxppc-dev,
	David S. Miller
In-Reply-To: <1409911806-10519-17-git-send-email-wangyijing@huawei.com>

Hello,

On Fri, 5 Sep 2014, Yijing Wang wrote:
> Use MSI chip framework instead of arch MSI functions to configure
> MSI/MSI-X irq. So we can manage MSI/MSI-X irq in a unified framework.
> 
> Signed-off-by: Yijing Wang <wangyijing@huawei.com>
> ---
>  arch/s390/pci/pci.c |   18 ++++++++++++++----
>  1 files changed, 14 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/s390/pci/pci.c b/arch/s390/pci/pci.c
> index 2fa7b14..da5316e 100644
> --- a/arch/s390/pci/pci.c
> +++ b/arch/s390/pci/pci.c
> @@ -358,7 +358,7 @@ static void zpci_irq_handler(struct airq_struct *airq)
>  	}
>  }
> 
> -int arch_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type)
> +int zpci_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type)
>  {
>  	struct zpci_dev *zdev = get_zdev(pdev);
>  	unsigned int hwirq, msi_vecs;
> @@ -434,7 +434,7 @@ out:
>  	return rc;
>  }
> 
> -void arch_teardown_msi_irqs(struct pci_dev *pdev)
> +static void zpci_teardown_msi_irqs(struct pci_dev *pdev)
>  {
>  	struct zpci_dev *zdev = get_zdev(pdev);
>  	struct msi_desc *msi;
> @@ -448,9 +448,9 @@ void arch_teardown_msi_irqs(struct pci_dev *pdev)
>  	/* Release MSI interrupts */
>  	list_for_each_entry(msi, &pdev->msi_list, list) {
>  		if (msi->msi_attrib.is_msix)
> -			default_msix_mask_irq(msi, 1);
> +			__msix_mask_irq(msi, 1);
>  		else
> -			default_msi_mask_irq(msi, 1, 1);
> +			__msi_mask_irq(msi, 1, 1);

The default_msi_mask_irq to __msi_mask_irq renaming is hidden in your
patch "x86/xen/MSI: Eliminate arch_msix_mask_irq() and arch_msi_mask_irq()"

This means that between that patch and this one s390 will not compile.
Could you please move this hunk to the other patch or even make an extra
patch with the renaming. Other than that:

Acked-by: Sebastian Ott <sebott@linux.vnet.ibm.com>

Regards,
Sebastian

>  		irq_set_msi_desc(msi->irq, NULL);
>  		irq_free_desc(msi->irq);
>  		msi->msg.address_lo = 0;
> @@ -464,6 +464,16 @@ void arch_teardown_msi_irqs(struct pci_dev *pdev)
>  	airq_iv_free_bit(zpci_aisb_iv, zdev->aisb);
>  }
> 
> +static struct msi_chip zpci_msi_chip = {
> +	.setup_irqs = zpci_setup_msi_irqs,
> +	.teardown_irqs = zpci_teardown_msi_irqs,
> +};
> +
> +struct msi_chip *arch_find_msi_chip(struct pci_dev *dev)
> +{
> +	return &zpci_msi_chip;
> +}
> +
>  static void zpci_map_resources(struct zpci_dev *zdev)
>  {
>  	struct pci_dev *pdev = zdev->pdev;
> -- 
> 1.7.1
> 
> 

^ permalink raw reply

* [PATCH] ASoC: fsl_spdif: don't change the root clock rate of spdif in driver
From: Shengjiu Wang @ 2014-09-16 11:46 UTC (permalink / raw)
  To: timur, nicoleotsuka, Li.Xiubo, lgirdwood, broonie, perex, tiwai
  Cc: alsa-devel, linuxppc-dev, linux-kernel

The spdif root clock may be used by other module or defined with
CLK_SET_RATE_GATE, so we can't change the clock rate in driver.
In this patch remove the clk_set_rate and clk_round_rate to protect the
clock.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
---
 sound/soc/fsl/fsl_spdif.c |   24 ++----------------------
 1 file changed, 2 insertions(+), 22 deletions(-)

diff --git a/sound/soc/fsl/fsl_spdif.c b/sound/soc/fsl/fsl_spdif.c
index 70acfe4..f2e4595 100644
--- a/sound/soc/fsl/fsl_spdif.c
+++ b/sound/soc/fsl/fsl_spdif.c
@@ -377,7 +377,6 @@ static int spdif_set_sample_rate(struct snd_pcm_substream *substream,
 	unsigned long csfs = 0;
 	u32 stc, mask, rate;
 	u8 clk, txclk_df, sysclk_df;
-	int ret;
 
 	switch (sample_rate) {
 	case 32000:
@@ -419,21 +418,6 @@ static int spdif_set_sample_rate(struct snd_pcm_substream *substream,
 
 	sysclk_df = spdif_priv->sysclk_df[rate];
 
-	/* Don't mess up the clocks from other modules */
-	if (clk != STC_TXCLK_SPDIF_ROOT)
-		goto clk_set_bypass;
-
-	/*
-	 * The S/PDIF block needs a clock of 64 * fs * txclk_df.
-	 * So request 64 * fs * (txclk_df + 1) to get rounded.
-	 */
-	ret = clk_set_rate(spdif_priv->txclk[rate], 64 * sample_rate * (txclk_df + 1));
-	if (ret) {
-		dev_err(&pdev->dev, "failed to set tx clock rate\n");
-		return ret;
-	}
-
-clk_set_bypass:
 	dev_dbg(&pdev->dev, "expected clock rate = %d\n",
 			(64 * sample_rate * txclk_df * sysclk_df));
 	dev_dbg(&pdev->dev, "actual clock rate = %ld\n",
@@ -1056,7 +1040,7 @@ static u32 fsl_spdif_txclk_caldiv(struct fsl_spdif_priv *spdif_priv,
 {
 	const u32 rate[] = { 32000, 44100, 48000, 96000, 192000 };
 	bool is_sysclk = clk == spdif_priv->sysclk;
-	u64 rate_ideal, rate_actual, sub;
+	u64 rate_actual, sub;
 	u32 sysclk_dfmin, sysclk_dfmax;
 	u32 txclk_df, sysclk_df, arate;
 
@@ -1066,11 +1050,7 @@ static u32 fsl_spdif_txclk_caldiv(struct fsl_spdif_priv *spdif_priv,
 
 	for (sysclk_df = sysclk_dfmin; sysclk_df <= sysclk_dfmax; sysclk_df++) {
 		for (txclk_df = 1; txclk_df <= 128; txclk_df++) {
-			rate_ideal = rate[index] * (txclk_df + 1) * 64;
-			if (round)
-				rate_actual = clk_round_rate(clk, rate_ideal);
-			else
-				rate_actual = clk_get_rate(clk);
+			rate_actual = clk_get_rate(clk);
 
 			arate = rate_actual / 64;
 			arate /= txclk_df * sysclk_df;
-- 
1.7.9.5

^ permalink raw reply related

* Re: [PATCH 1/4] powerpc: Make a bunch of things static
From: Nathan Fontenot @ 2014-09-16 12:56 UTC (permalink / raw)
  To: Anton Blanchard, benh, paulus, mpe; +Cc: linuxppc-dev
In-Reply-To: <1408488921-19187-1-git-send-email-anton@samba.org>

On 08/19/2014 05:55 PM, Anton Blanchard wrote:
> Signed-off-by: Anton Blanchard <anton@samba.org>
> ---
>  arch/powerpc/kernel/hw_breakpoint.c       |  2 +-
>  arch/powerpc/kernel/nvram_64.c            |  2 +-
>  arch/powerpc/kernel/pci-common.c          |  2 +-
>  arch/powerpc/kernel/pci_of_scan.c         |  2 +-
>  arch/powerpc/kernel/prom.c                |  5 +++--
>  arch/powerpc/kernel/ptrace.c              |  2 +-
>  arch/powerpc/kernel/rtasd.c               |  2 +-
>  arch/powerpc/kernel/time.c                |  4 ++--
>  arch/powerpc/lib/feature-fixups.c         |  2 +-
>  arch/powerpc/mm/hash_utils_64.c           |  2 +-
>  arch/powerpc/mm/pgtable.c                 |  2 +-
>  arch/powerpc/perf/core-book3s.c           | 18 +++++++++---------
>  arch/powerpc/platforms/powernv/eeh-ioda.c |  4 ++--
>  arch/powerpc/platforms/powernv/pci-ioda.c |  6 +++---
>  arch/powerpc/platforms/powernv/setup.c    |  2 +-
>  arch/powerpc/platforms/powernv/smp.c      |  2 +-
>  arch/powerpc/platforms/pseries/dlpar.c    |  4 ++--
>  arch/powerpc/platforms/pseries/nvram.c    | 12 +++++++-----
>  arch/powerpc/platforms/pseries/ras.c      |  2 +-
>  arch/powerpc/platforms/pseries/setup.c    |  2 +-
>  arch/powerpc/sysdev/mpic.c                |  2 +-
>  arch/powerpc/sysdev/msi_bitmap.c          |  6 +++---
>  22 files changed, 45 insertions(+), 42 deletions(-)
> 
> diff --git a/arch/powerpc/kernel/hw_breakpoint.c b/arch/powerpc/kernel/hw_breakpoint.c
> index 0bb5918..1f7d84e 100644
> --- a/arch/powerpc/kernel/hw_breakpoint.c
> +++ b/arch/powerpc/kernel/hw_breakpoint.c
> @@ -293,7 +293,7 @@ out:
>  /*
>   * Handle single-step exceptions following a DABR hit.
>   */
> -int __kprobes single_step_dabr_instruction(struct die_args *args)
> +static int __kprobes single_step_dabr_instruction(struct die_args *args)
>  {
>  	struct pt_regs *regs = args->regs;
>  	struct perf_event *bp = NULL;
> diff --git a/arch/powerpc/kernel/nvram_64.c b/arch/powerpc/kernel/nvram_64.c
> index 28b898e..34f7c9b 100644
> --- a/arch/powerpc/kernel/nvram_64.c
> +++ b/arch/powerpc/kernel/nvram_64.c
> @@ -567,7 +567,7 @@ static int __init nvram_init(void)
>    	return rc;
>  }
>  
> -void __exit nvram_cleanup(void)
> +static void __exit nvram_cleanup(void)
>  {
>          misc_deregister( &nvram_dev );
>  }
> diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
> index b2814e2..bd84771 100644
> --- a/arch/powerpc/kernel/pci-common.c
> +++ b/arch/powerpc/kernel/pci-common.c
> @@ -1140,7 +1140,7 @@ static int reparent_resources(struct resource *parent,
>   *	    as well.
>   */
>  
> -void pcibios_allocate_bus_resources(struct pci_bus *bus)
> +static void pcibios_allocate_bus_resources(struct pci_bus *bus)
>  {
>  	struct pci_bus *b;
>  	int i;
> diff --git a/arch/powerpc/kernel/pci_of_scan.c b/arch/powerpc/kernel/pci_of_scan.c
> index 44562aa..e6245e9 100644
> --- a/arch/powerpc/kernel/pci_of_scan.c
> +++ b/arch/powerpc/kernel/pci_of_scan.c
> @@ -38,7 +38,7 @@ static u32 get_int_prop(struct device_node *np, const char *name, u32 def)
>   * @addr0: value of 1st cell of a device tree PCI address.
>   * @bridge: Set this flag if the address is from a bridge 'ranges' property
>   */
> -unsigned int pci_parse_of_flags(u32 addr0, int bridge)
> +static unsigned int pci_parse_of_flags(u32 addr0, int bridge)
>  {
>  	unsigned int flags = 0;
>  
> diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
> index 1a3b105..6d8c4cb 100644
> --- a/arch/powerpc/kernel/prom.c
> +++ b/arch/powerpc/kernel/prom.c
> @@ -386,8 +386,9 @@ static int __init early_init_dt_scan_cpus(unsigned long node,
>  	return 0;
>  }
>  
> -int __init early_init_dt_scan_chosen_ppc(unsigned long node, const char *uname,
> -					 int depth, void *data)
> +static int __init early_init_dt_scan_chosen_ppc(unsigned long node,
> +						const char *uname,
> +						int depth, void *data)
>  {
>  	const unsigned long *lprop; /* All these set by kernel, so no need to convert endian */
>  
> diff --git a/arch/powerpc/kernel/ptrace.c b/arch/powerpc/kernel/ptrace.c
> index 2e3d2bf..cdb404e 100644
> --- a/arch/powerpc/kernel/ptrace.c
> +++ b/arch/powerpc/kernel/ptrace.c
> @@ -932,7 +932,7 @@ void ptrace_triggered(struct perf_event *bp,
>  }
>  #endif /* CONFIG_HAVE_HW_BREAKPOINT */
>  
> -int ptrace_set_debugreg(struct task_struct *task, unsigned long addr,
> +static int ptrace_set_debugreg(struct task_struct *task, unsigned long addr,
>  			       unsigned long data)
>  {
>  #ifdef CONFIG_HAVE_HW_BREAKPOINT
> diff --git a/arch/powerpc/kernel/rtasd.c b/arch/powerpc/kernel/rtasd.c
> index e736387..5a2c049 100644
> --- a/arch/powerpc/kernel/rtasd.c
> +++ b/arch/powerpc/kernel/rtasd.c
> @@ -286,7 +286,7 @@ static void prrn_work_fn(struct work_struct *work)
>  
>  static DECLARE_WORK(prrn_work, prrn_work_fn);
>  
> -void prrn_schedule_update(u32 scope)
> +static void prrn_schedule_update(u32 scope)
>  {
>  	flush_work(&prrn_work);
>  	prrn_update_scope = scope;
> diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c
> index 368ab37..f6b3430 100644
> --- a/arch/powerpc/kernel/time.c
> +++ b/arch/powerpc/kernel/time.c
> @@ -479,7 +479,7 @@ void arch_irq_work_raise(void)
>  
>  #endif /* CONFIG_IRQ_WORK */
>  
> -void __timer_interrupt(void)
> +static void __timer_interrupt(void)
>  {
>  	struct pt_regs *regs = get_irq_regs();
>  	u64 *next_tb = &__get_cpu_var(decrementers_next_tb);
> @@ -643,7 +643,7 @@ static int __init get_freq(char *name, int cells, unsigned long *val)
>  	return found;
>  }
>  
> -void start_cpu_decrementer(void)
> +static void start_cpu_decrementer(void)
>  {
>  #if defined(CONFIG_BOOKE) || defined(CONFIG_40x)
>  	/* Clear any pending timer interrupts */
> diff --git a/arch/powerpc/lib/feature-fixups.c b/arch/powerpc/lib/feature-fixups.c
> index 7a8a748..7ce3870 100644
> --- a/arch/powerpc/lib/feature-fixups.c
> +++ b/arch/powerpc/lib/feature-fixups.c
> @@ -164,7 +164,7 @@ static long calc_offset(struct fixup_entry *entry, unsigned int *p)
>  	return (unsigned long)p - (unsigned long)entry;
>  }
>  
> -void test_basic_patching(void)
> +static void test_basic_patching(void)
>  {
>  	extern unsigned int ftr_fixup_test1;
>  	extern unsigned int end_ftr_fixup_test1;
> diff --git a/arch/powerpc/mm/hash_utils_64.c b/arch/powerpc/mm/hash_utils_64.c
> index daee7f4..18df45f 100644
> --- a/arch/powerpc/mm/hash_utils_64.c
> +++ b/arch/powerpc/mm/hash_utils_64.c
> @@ -867,7 +867,7 @@ unsigned int hash_page_do_lazy_icache(unsigned int pp, pte_t pte, int trap)
>  }
>  
>  #ifdef CONFIG_PPC_MM_SLICES
> -unsigned int get_paca_psize(unsigned long addr)
> +static unsigned int get_paca_psize(unsigned long addr)
>  {
>  	u64 lpsizes;
>  	unsigned char *hpsizes;
> diff --git a/arch/powerpc/mm/pgtable.c b/arch/powerpc/mm/pgtable.c
> index c695943..c90e602 100644
> --- a/arch/powerpc/mm/pgtable.c
> +++ b/arch/powerpc/mm/pgtable.c
> @@ -48,7 +48,7 @@ static inline int pte_looks_normal(pte_t pte)
>  	    (_PAGE_PRESENT | _PAGE_USER);
>  }
>  
> -struct page * maybe_pte_to_page(pte_t pte)
> +static struct page *maybe_pte_to_page(pte_t pte)
>  {
>  	unsigned long pfn = pte_pfn(pte);
>  	struct page *page;
> diff --git a/arch/powerpc/perf/core-book3s.c b/arch/powerpc/perf/core-book3s.c
> index b7cd00b..a6995d4 100644
> --- a/arch/powerpc/perf/core-book3s.c
> +++ b/arch/powerpc/perf/core-book3s.c
> @@ -59,9 +59,9 @@ struct cpu_hw_events {
>  	struct	perf_branch_entry	bhrb_entries[BHRB_MAX_ENTRIES];
>  };
>  
> -DEFINE_PER_CPU(struct cpu_hw_events, cpu_hw_events);
> +static DEFINE_PER_CPU(struct cpu_hw_events, cpu_hw_events);
>  
> -struct power_pmu *ppmu;
> +static struct power_pmu *ppmu;
>  
>  /*
>   * Normally, to ignore kernel events we set the FCS (freeze counters
> @@ -124,7 +124,7 @@ static unsigned long ebb_switch_in(bool ebb, struct cpu_hw_events *cpuhw)
>  
>  static inline void power_pmu_bhrb_enable(struct perf_event *event) {}
>  static inline void power_pmu_bhrb_disable(struct perf_event *event) {}
> -void power_pmu_flush_branch_stack(void) {}
> +static void power_pmu_flush_branch_stack(void) {}
>  static inline void power_pmu_bhrb_read(struct cpu_hw_events *cpuhw) {}
>  static void pmao_restore_workaround(bool ebb) { }
>  #endif /* CONFIG_PPC32 */
> @@ -375,7 +375,7 @@ static void power_pmu_bhrb_disable(struct perf_event *event)
>  /* Called from ctxsw to prevent one process's branch entries to
>   * mingle with the other process's entries during context switch.
>   */
> -void power_pmu_flush_branch_stack(void)
> +static void power_pmu_flush_branch_stack(void)
>  {
>  	if (ppmu->bhrb_nr)
>  		power_pmu_bhrb_reset();
> @@ -408,7 +408,7 @@ static __u64 power_pmu_bhrb_to(u64 addr)
>  }
>  
>  /* Processing BHRB entries */
> -void power_pmu_bhrb_read(struct cpu_hw_events *cpuhw)
> +static void power_pmu_bhrb_read(struct cpu_hw_events *cpuhw)
>  {
>  	u64 val;
>  	u64 addr;
> @@ -1573,7 +1573,7 @@ static void power_pmu_stop(struct perf_event *event, int ef_flags)
>   * Set the flag to make pmu::enable() not perform the
>   * schedulability test, it will be performed at commit time
>   */
> -void power_pmu_start_txn(struct pmu *pmu)
> +static void power_pmu_start_txn(struct pmu *pmu)
>  {
>  	struct cpu_hw_events *cpuhw = &__get_cpu_var(cpu_hw_events);
>  
> @@ -1587,7 +1587,7 @@ void power_pmu_start_txn(struct pmu *pmu)
>   * Clear the flag and pmu::enable() will perform the
>   * schedulability test.
>   */
> -void power_pmu_cancel_txn(struct pmu *pmu)
> +static void power_pmu_cancel_txn(struct pmu *pmu)
>  {
>  	struct cpu_hw_events *cpuhw = &__get_cpu_var(cpu_hw_events);
>  
> @@ -1600,7 +1600,7 @@ void power_pmu_cancel_txn(struct pmu *pmu)
>   * Perform the group schedulability test as a whole
>   * Return 0 if success
>   */
> -int power_pmu_commit_txn(struct pmu *pmu)
> +static int power_pmu_commit_txn(struct pmu *pmu)
>  {
>  	struct cpu_hw_events *cpuhw;
>  	long i, n;
> @@ -1888,7 +1888,7 @@ ssize_t power_events_sysfs_show(struct device *dev,
>  	return sprintf(page, "event=0x%02llx\n", pmu_attr->id);
>  }
>  
> -struct pmu power_pmu = {
> +static struct pmu power_pmu = {
>  	.pmu_enable	= power_pmu_enable,
>  	.pmu_disable	= power_pmu_disable,
>  	.event_init	= power_pmu_event_init,
> diff --git a/arch/powerpc/platforms/powernv/eeh-ioda.c b/arch/powerpc/platforms/powernv/eeh-ioda.c
> index c945bed..df5c2cc 100644
> --- a/arch/powerpc/platforms/powernv/eeh-ioda.c
> +++ b/arch/powerpc/platforms/powernv/eeh-ioda.c
> @@ -628,8 +628,8 @@ static int ioda_eeh_reset(struct eeh_pe *pe, int option)
>   * Retrieve error log, which contains log from device driver
>   * and firmware.
>   */
> -int ioda_eeh_get_log(struct eeh_pe *pe, int severity,
> -		     char *drv_log, unsigned long len)
> +static int ioda_eeh_get_log(struct eeh_pe *pe, int severity,
> +			    char *drv_log, unsigned long len)
>  {
>  	pnv_pci_dump_phb_diag_data(pe->phb, pe->data);
>  
> diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c
> index df241b1..4441bfa 100644
> --- a/arch/powerpc/platforms/powernv/pci-ioda.c
> +++ b/arch/powerpc/platforms/powernv/pci-ioda.c
> @@ -385,7 +385,7 @@ static void pnv_ioda_freeze_pe(struct pnv_phb *phb, int pe_no)
>  	}
>  }
>  
> -int pnv_ioda_unfreeze_pe(struct pnv_phb *phb, int pe_no, int opt)
> +static int pnv_ioda_unfreeze_pe(struct pnv_phb *phb, int pe_no, int opt)
>  {
>  	struct pnv_ioda_pe *pe, *slave;
>  	s64 rc;
> @@ -1631,8 +1631,8 @@ static void pnv_pci_ioda_shutdown(struct pnv_phb *phb)
>  		       OPAL_ASSERT_RESET);
>  }
>  
> -void __init pnv_pci_init_ioda_phb(struct device_node *np,
> -				  u64 hub_id, int ioda_type)
> +static void __init pnv_pci_init_ioda_phb(struct device_node *np,
> +					 u64 hub_id, int ioda_type)
>  {
>  	struct pci_controller *hose;
>  	struct pnv_phb *phb;
> diff --git a/arch/powerpc/platforms/powernv/setup.c b/arch/powerpc/platforms/powernv/setup.c
> index 5a0e2dc..bb1fc9b 100644
> --- a/arch/powerpc/platforms/powernv/setup.c
> +++ b/arch/powerpc/platforms/powernv/setup.c
> @@ -307,7 +307,7 @@ static int __init pnv_probe(void)
>   * Returns the cpu frequency for 'cpu' in Hz. This is used by
>   * /proc/cpuinfo
>   */
> -unsigned long pnv_get_proc_freq(unsigned int cpu)
> +static unsigned long pnv_get_proc_freq(unsigned int cpu)
>  {
>  	unsigned long ret_freq;
>  
> diff --git a/arch/powerpc/platforms/powernv/smp.c b/arch/powerpc/platforms/powernv/smp.c
> index 5fcfcf4..b73adc5 100644
> --- a/arch/powerpc/platforms/powernv/smp.c
> +++ b/arch/powerpc/platforms/powernv/smp.c
> @@ -54,7 +54,7 @@ static void pnv_smp_setup_cpu(int cpu)
>  #endif
>  }
>  
> -int pnv_smp_kick_cpu(int nr)
> +static int pnv_smp_kick_cpu(int nr)
>  {
>  	unsigned int pcpu = get_hard_smp_processor_id(nr);
>  	unsigned long start_here =
> diff --git a/arch/powerpc/platforms/pseries/dlpar.c b/arch/powerpc/platforms/pseries/dlpar.c
> index a2450b8..d37ba4f 100644
> --- a/arch/powerpc/platforms/pseries/dlpar.c
> +++ b/arch/powerpc/platforms/pseries/dlpar.c
> @@ -312,7 +312,7 @@ int dlpar_detach_node(struct device_node *dn)
>  #define ISOLATE			0
>  #define UNISOLATE		1
>  
> -int dlpar_acquire_drc(u32 drc_index)
> +static int dlpar_acquire_drc(u32 drc_index)
>  {
>  	int dr_status, rc;
>  
> @@ -334,7 +334,7 @@ int dlpar_acquire_drc(u32 drc_index)
>  	return 0;
>  }
>  
> -int dlpar_release_drc(u32 drc_index)
> +static int dlpar_release_drc(u32 drc_index)
>  {
>  	int dr_status, rc;

Anton, if you're going to do a v2 of these patches you could leave out
the routines in dlpar.c. I just sent a patch out that exports these two
functions for memory hotplug updates.

-Nathan

>  
> diff --git a/arch/powerpc/platforms/pseries/nvram.c b/arch/powerpc/platforms/pseries/nvram.c
> index 0cc240b..11a3b61 100644
> --- a/arch/powerpc/platforms/pseries/nvram.c
> +++ b/arch/powerpc/platforms/pseries/nvram.c
> @@ -276,8 +276,10 @@ static ssize_t pSeries_nvram_get_size(void)
>   * sequence #: The unique sequence # for each event. (until it wraps)
>   * error log: The error log from event_scan
>   */
> -int nvram_write_os_partition(struct nvram_os_partition *part, char * buff,
> -		int length, unsigned int err_type, unsigned int error_log_cnt)
> +static int nvram_write_os_partition(struct nvram_os_partition *part,
> +				    char *buff, int length,
> +				    unsigned int err_type,
> +				    unsigned int error_log_cnt)
>  {
>  	int rc;
>  	loff_t tmp_index;
> @@ -330,9 +332,9 @@ int nvram_write_error_log(char * buff, int length,
>   *
>   * Reads nvram partition for at most 'length'
>   */
> -int nvram_read_partition(struct nvram_os_partition *part, char *buff,
> -			int length, unsigned int *err_type,
> -			unsigned int *error_log_cnt)
> +static int nvram_read_partition(struct nvram_os_partition *part, char *buff,
> +				int length, unsigned int *err_type,
> +				unsigned int *error_log_cnt)
>  {
>  	int rc;
>  	loff_t tmp_index;
> diff --git a/arch/powerpc/platforms/pseries/ras.c b/arch/powerpc/platforms/pseries/ras.c
> index dff05b9..5a4d0fc 100644
> --- a/arch/powerpc/platforms/pseries/ras.c
> +++ b/arch/powerpc/platforms/pseries/ras.c
> @@ -126,7 +126,7 @@ struct epow_errorlog {
>  #define EPOW_MAIN_ENCLOSURE		5
>  #define EPOW_POWER_OFF			7
>  
> -void rtas_parse_epow_errlog(struct rtas_error_log *log)
> +static void rtas_parse_epow_errlog(struct rtas_error_log *log)
>  {
>  	struct pseries_errorlog *pseries_log;
>  	struct epow_errorlog *epow_log;
> diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c
> index cfe8a63..bbe0e91 100644
> --- a/arch/powerpc/platforms/pseries/setup.c
> +++ b/arch/powerpc/platforms/pseries/setup.c
> @@ -562,7 +562,7 @@ void pSeries_coalesce_init(void)
>   * fw_cmo_feature_init - FW_FEATURE_CMO is not stored in ibm,hypertas-functions,
>   * handle that here. (Stolen from parse_system_parameter_string)
>   */
> -void pSeries_cmo_feature_init(void)
> +static void pSeries_cmo_feature_init(void)
>  {
>  	char *ptr, *key, *value, *end;
>  	int call_status;
> diff --git a/arch/powerpc/sysdev/mpic.c b/arch/powerpc/sysdev/mpic.c
> index be33c97..89cec0e 100644
> --- a/arch/powerpc/sysdev/mpic.c
> +++ b/arch/powerpc/sysdev/mpic.c
> @@ -960,7 +960,7 @@ void mpic_set_vector(unsigned int virq, unsigned int vector)
>  	mpic_irq_write(src, MPIC_INFO(IRQ_VECTOR_PRI), vecpri);
>  }
>  
> -void mpic_set_destination(unsigned int virq, unsigned int cpuid)
> +static void mpic_set_destination(unsigned int virq, unsigned int cpuid)
>  {
>  	struct mpic *mpic = mpic_from_irq(virq);
>  	unsigned int src = virq_to_hw(virq);
> diff --git a/arch/powerpc/sysdev/msi_bitmap.c b/arch/powerpc/sysdev/msi_bitmap.c
> index 2ff6302..a7c7a9f 100644
> --- a/arch/powerpc/sysdev/msi_bitmap.c
> +++ b/arch/powerpc/sysdev/msi_bitmap.c
> @@ -143,7 +143,7 @@ void msi_bitmap_free(struct msi_bitmap *bmp)
>  #define check(x)	\
>  	if (!(x)) printk("msi_bitmap: test failed at line %d\n", __LINE__);
>  
> -void __init test_basics(void)
> +static void __init test_basics(void)
>  {
>  	struct msi_bitmap bmp;
>  	int i, size = 512;
> @@ -188,7 +188,7 @@ void __init test_basics(void)
>  	kfree(bmp.bitmap);
>  }
>  
> -void __init test_of_node(void)
> +static void __init test_of_node(void)
>  {
>  	u32 prop_data[] = { 10, 10, 25, 3, 40, 1, 100, 100, 200, 20 };
>  	const char *expected_str = "0-9,20-24,28-39,41-99,220-255";
> @@ -236,7 +236,7 @@ void __init test_of_node(void)
>  	kfree(bmp.bitmap);
>  }
>  
> -int __init msi_bitmap_selftest(void)
> +static int __init msi_bitmap_selftest(void)
>  {
>  	printk(KERN_DEBUG "Running MSI bitmap self-tests ...\n");
>  
> 

^ permalink raw reply

* Re: [PATCH] ASoC: fsl_spdif: don't change the root clock rate of spdif in driver
From: Nicolin Chen @ 2014-09-16 18:19 UTC (permalink / raw)
  To: Shengjiu Wang, shawn.guo
  Cc: alsa-devel, lgirdwood, tiwai, Li.Xiubo, timur, perex, broonie,
	linuxppc-dev, linux-kernel
In-Reply-To: <1410867994-32138-1-git-send-email-shengjiu.wang@freescale.com>

On Tue, Sep 16, 2014 at 07:46:34PM +0800, Shengjiu Wang wrote:
> The spdif root clock may be used by other module or defined with
> CLK_SET_RATE_GATE, so we can't change the clock rate in driver.
> In this patch remove the clk_set_rate and clk_round_rate to protect the
> clock.

It's a quite convenient and conservative way to remove the clock
dealing code in the driver, however, it may result less flexible
functionalities.

The reason why I left the clk_set_rate() in the driver is to hope
we may find a better way to tackle those tough situations. For IP
itself, it doesn't matter if the clock the SoC provides to it is
being shared by other modules or not.

So I think, if it's a shared clock, we should not define it as a
rate-changeable one in the SoC level, as we might still have some
SoCs provide a dedicated clock to S/PDIF so as to get the maximum
range of clock support for users.

@Shawn
Sorry to involve you in this topic. I'm not so sure if we can do
this in the clock driver so that the clock rate would be fixed
even if the driver is trying to change it. If we can, I think we
may use a better solution here instead.

Thank you
Nicolin

^ permalink raw reply

* Re: [PATCH] ASoC: fsl_spdif: don't change the root clock rate of spdif in driver
From: Mark Brown @ 2014-09-16 18:32 UTC (permalink / raw)
  To: Nicolin Chen
  Cc: Shengjiu Wang, alsa-devel, lgirdwood, tiwai, linux-kernel, timur,
	perex, Li.Xiubo, linuxppc-dev, shawn.guo
In-Reply-To: <20140916180028.GA6784@Asurada>

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

On Tue, Sep 16, 2014 at 11:19:28AM -0700, Nicolin Chen wrote:

> So I think, if it's a shared clock, we should not define it as a
> rate-changeable one in the SoC level, as we might still have some
> SoCs provide a dedicated clock to S/PDIF so as to get the maximum
> range of clock support for users.

> @Shawn
> Sorry to involve you in this topic. I'm not so sure if we can do
> this in the clock driver so that the clock rate would be fixed
> even if the driver is trying to change it. If we can, I think we
> may use a better solution here instead.

I tend to agree here.  My first thought here is that we should have
support in the clock API for constraining clocks in the clock API so we
can still set the clock where there's a possibility to do that.  Not
trivail to implement though.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply

* Re: [RFC PATCH] powerpc/numa: add ability to disable and debug topology updates
From: Nathan Fontenot @ 2014-09-16 19:42 UTC (permalink / raw)
  To: Nishanth Aravamudan, Benjamin Herrenschmidt; +Cc: linuxppc-dev, Paul Mackerras
In-Reply-To: <20140909200913.GG22906@linux.vnet.ibm.com>



On 09/09/2014 03:09 PM, Nishanth Aravamudan wrote:
> We have hit a few customer issues with the topology update code (VPHN
> and PRRN). It would be nice to be able to debug the notifications coming
> from the hypervisor in both cases to the LPAR, as well as to disable
> reacting to the notifications, to narrow down the source of the
> problems. Add a basic level of such functionality, similar to the numa=
> command-line parameter.
> 
> Signed-off-by: Nishanth Aravamudan <nacc@linux.vnet.ibm.com>
> ---
> This is pretty rough, but has been useful in the field already. I'm not
> sure if more information would be useful than this basic amount.
> 
> diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
> index 5ae8608ca9f5..6e3b9e3a2ab4 100644
> --- a/Documentation/kernel-parameters.txt
> +++ b/Documentation/kernel-parameters.txt
> @@ -3370,6 +3370,13 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
>  			e.g. base its process migration decisions on it.
>  			Default is on.
>  
> +	topology_updates= [KNL, PPC, NUMA]
> +			Format: {off | debug}
> +			Specify if the kernel should ignore (off) or
> +			emit more information (debug) when the
> +			hypervisor sends NUMA topology updates to an
> +			LPAR.
> +
>  	tp720=		[HW,PS2]
>  
>  	tpm_suspend_pcr=[HW,TPM]
> diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
> index d7737a542fd7..72c5ad313cbe 100644
> --- a/arch/powerpc/mm/numa.c
> +++ b/arch/powerpc/mm/numa.c
> @@ -1160,6 +1160,28 @@ static int __init early_numa(char *p)
>  }
>  early_param("numa", early_numa);
>  
> +static int topology_updates_enabled = 1;
> +static int topology_updates_debug = 0;
> +
> +static int __init early_topology_updates(char *p)
> +{
> +	if (!p)
> +		return 0;
> +
> +	if (strstr(p, "off")) {
> +		printk(KERN_INFO "Disabling topology updates\n");
> +		topology_updates_enabled = 0;
> +	}
> +
> +	if (strstr(p, "debug")) {
> +		printk(KERN_INFO "Enabling topology updates debug\n");
> +		topology_updates_debug = 1;
> +	}
> +
> +	return 0;
> +}
> +early_param("topology_updates", early_topology_updates);
> +
>  #ifdef CONFIG_MEMORY_HOTPLUG
>  /*
>   * Find the node associated with a hot added memory section for
> @@ -1546,6 +1568,9 @@ int arch_update_cpu_topology(void)
>  	struct device *dev;
>  	int weight, new_nid, i = 0;
>  
> +	if (!topology_updates_enabled)
> +		return 0;
> +
>  	weight = cpumask_weight(&cpu_associativity_changes_mask);
>  	if (!weight)
>  		return 0;
> @@ -1610,6 +1635,25 @@ int arch_update_cpu_topology(void)
>  	 *
>  	 * And for the similar reason, we will skip all the following updating.
>  	 */
> +
> +	if (topology_updates_debug) {
> +		char *buf = kmalloc_array(NR_CPUS*5, sizeof(char), GFP_KERNEL);
> +		cpumask_scnprintf(buf, NR_CPUS*5, &updated_cpus);
> +		printk(KERN_DEBUG "Topology update for the following CPUs:\n");
> +		printk(KERN_DEBUG " %s\n", buf);
> +		printk(KERN_DEBUG "cpumask_weight(&updated_cpus)) = %u\n",
> +						cpumask_weight(&updated_cpus));
> +
> +		if (cpumask_weight(&updated_cpus)) {
> +			for (ud = &updates[0]; ud; ud = ud->next) {
> +				printk(KERN_DEBUG "cpu %d moving from node %d "
> +						  "to %d\n", ud->cpu,
> +						  ud->old_nid, ud->new_nid);
> +			}
> +		}
> +		kfree(buf);
> +	}
> +
>  	if (!cpumask_weight(&updated_cpus))
>  		goto out;
>  
> @@ -1807,8 +1851,10 @@ static const struct file_operations topology_ops = {
>  
>  static int topology_update_init(void)
>  {
> -	start_topology_update();
> -	proc_create("powerpc/topology_updates", 0644, NULL, &topology_ops);
> +	if (topology_updates_enabled) {
> +		start_topology_update();
> +		proc_create("powerpc/topology_updates", 0644, NULL, &topology_ops);
> +	}
>  

Is there any reason you would want to enable topology updates at some
later point?

If so you could still create the /proc file and update it to set
topology_updates_enabled appropriately in start_topology_update()
and stop_topology_update().

-Nathan

>  	return 0;
>  }
> 
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev
> 

^ permalink raw reply

* Re: [RFC PATCH] powerpc/numa: add ability to disable and debug topology updates
From: Nishanth Aravamudan @ 2014-09-16 20:10 UTC (permalink / raw)
  To: Nathan Fontenot; +Cc: Paul Mackerras, linuxppc-dev
In-Reply-To: <5418929C.4050401@linux.vnet.ibm.com>

On 16.09.2014 [14:42:20 -0500], Nathan Fontenot wrote:
> 
> 
> On 09/09/2014 03:09 PM, Nishanth Aravamudan wrote:
> > We have hit a few customer issues with the topology update code (VPHN
> > and PRRN). It would be nice to be able to debug the notifications coming
> > from the hypervisor in both cases to the LPAR, as well as to disable
> > reacting to the notifications, to narrow down the source of the
> > problems. Add a basic level of such functionality, similar to the numa=
> > command-line parameter.
> > 
> > Signed-off-by: Nishanth Aravamudan <nacc@linux.vnet.ibm.com>
> > ---
> > This is pretty rough, but has been useful in the field already. I'm not
> > sure if more information would be useful than this basic amount.
> > 
> > diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
> > index 5ae8608ca9f5..6e3b9e3a2ab4 100644
> > --- a/Documentation/kernel-parameters.txt
> > +++ b/Documentation/kernel-parameters.txt
> > @@ -3370,6 +3370,13 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
> >  			e.g. base its process migration decisions on it.
> >  			Default is on.
> >  
> > +	topology_updates= [KNL, PPC, NUMA]
> > +			Format: {off | debug}
> > +			Specify if the kernel should ignore (off) or
> > +			emit more information (debug) when the
> > +			hypervisor sends NUMA topology updates to an
> > +			LPAR.
> > +
> >  	tp720=		[HW,PS2]
> >  
> >  	tpm_suspend_pcr=[HW,TPM]
> > diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
> > index d7737a542fd7..72c5ad313cbe 100644
> > --- a/arch/powerpc/mm/numa.c
> > +++ b/arch/powerpc/mm/numa.c
> > @@ -1160,6 +1160,28 @@ static int __init early_numa(char *p)
> >  }
> >  early_param("numa", early_numa);
> >  
> > +static int topology_updates_enabled = 1;
> > +static int topology_updates_debug = 0;
> > +
> > +static int __init early_topology_updates(char *p)
> > +{
> > +	if (!p)
> > +		return 0;
> > +
> > +	if (strstr(p, "off")) {
> > +		printk(KERN_INFO "Disabling topology updates\n");
> > +		topology_updates_enabled = 0;
> > +	}
> > +
> > +	if (strstr(p, "debug")) {
> > +		printk(KERN_INFO "Enabling topology updates debug\n");
> > +		topology_updates_debug = 1;
> > +	}
> > +
> > +	return 0;
> > +}
> > +early_param("topology_updates", early_topology_updates);
> > +
> >  #ifdef CONFIG_MEMORY_HOTPLUG
> >  /*
> >   * Find the node associated with a hot added memory section for
> > @@ -1546,6 +1568,9 @@ int arch_update_cpu_topology(void)
> >  	struct device *dev;
> >  	int weight, new_nid, i = 0;
> >  
> > +	if (!topology_updates_enabled)
> > +		return 0;
> > +
> >  	weight = cpumask_weight(&cpu_associativity_changes_mask);
> >  	if (!weight)
> >  		return 0;
> > @@ -1610,6 +1635,25 @@ int arch_update_cpu_topology(void)
> >  	 *
> >  	 * And for the similar reason, we will skip all the following updating.
> >  	 */
> > +
> > +	if (topology_updates_debug) {
> > +		char *buf = kmalloc_array(NR_CPUS*5, sizeof(char), GFP_KERNEL);
> > +		cpumask_scnprintf(buf, NR_CPUS*5, &updated_cpus);
> > +		printk(KERN_DEBUG "Topology update for the following CPUs:\n");
> > +		printk(KERN_DEBUG " %s\n", buf);
> > +		printk(KERN_DEBUG "cpumask_weight(&updated_cpus)) = %u\n",
> > +						cpumask_weight(&updated_cpus));
> > +
> > +		if (cpumask_weight(&updated_cpus)) {
> > +			for (ud = &updates[0]; ud; ud = ud->next) {
> > +				printk(KERN_DEBUG "cpu %d moving from node %d "
> > +						  "to %d\n", ud->cpu,
> > +						  ud->old_nid, ud->new_nid);
> > +			}
> > +		}
> > +		kfree(buf);
> > +	}
> > +
> >  	if (!cpumask_weight(&updated_cpus))
> >  		goto out;
> >  
> > @@ -1807,8 +1851,10 @@ static const struct file_operations topology_ops = {
> >  
> >  static int topology_update_init(void)
> >  {
> > -	start_topology_update();
> > -	proc_create("powerpc/topology_updates", 0644, NULL, &topology_ops);
> > +	if (topology_updates_enabled) {
> > +		start_topology_update();
> > +		proc_create("powerpc/topology_updates", 0644, NULL, &topology_ops);
> > +	}
> >  
> 
> Is there any reason you would want to enable topology updates at some
> later point?
> 
> If so you could still create the /proc file and update it to set
> topology_updates_enabled appropriately in start_topology_update()
> and stop_topology_update().

Oh, that's a good point! I'll adjust the patch accordingly (disable at
boot, leave the run-time twiddle).

-Nish

^ permalink raw reply

* [PATCH 0/3] pseries: Make CPU hotplug and hotremove endian safe
From: Thomas Falcon @ 2014-09-16 20:15 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: nfont, bharata, Thomas Falcon

This patchset ensures that cpu hotplugging and hotremoval are 
compatible with both big and little endian architectures.  

Bharata B Rao (1):
  pseries: Make CPU hotplug path endian safe

Thomas Falcon (2):
  pseries: Fix endian issues in onlining cpu threads
  pseries: Fix endian issues in cpu hot-removal

 arch/powerpc/platforms/pseries/dlpar.c       | 50 +++++++++++++++-------------
 arch/powerpc/platforms/pseries/hotplug-cpu.c | 14 ++++----
 arch/powerpc/platforms/pseries/pseries.h     |  3 +-
 3 files changed, 37 insertions(+), 30 deletions(-)

-- 
1.8.5.2

^ permalink raw reply

* [PATCH v2 1/3] pseries: Make CPU hotplug path endian safe
From: Thomas Falcon @ 2014-09-16 20:15 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: nfont, bharata, Thomas Falcon
In-Reply-To: <1410898547-12296-1-git-send-email-tlfalcon@linux.vnet.ibm.com>

From: Bharata B Rao <bharata@linux.vnet.ibm.com>

- ibm,rtas-configure-connector should treat the RTAS data as big endian.
- Treat ibm,ppc-interrupt-server#s as big-endian when setting
  smp_processor_id during hotplug.

Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com>
Signed-off-by: Thomas Falcon <tlfalcon@linux.vnet.ibm.com>
---

Changes in v2:
- Don't convert drc_index to BE in dlpar_configure_connector() but instead
  convert in the caller dlpar_cpu_probe() so that migration path isn't
  affected.
- Mark members of cc_workarea struct as __be32 instead of u32 (Thomas)
- Based on top of Thomas Falcon's two patches.
  (http://patchwork.ozlabs.org/patch/388767/)

v1: http://patchwork.ozlabs.org/patch/386216/

 arch/powerpc/platforms/pseries/dlpar.c       | 22 +++++++++++-----------
 arch/powerpc/platforms/pseries/hotplug-cpu.c |  4 ++--
 arch/powerpc/platforms/pseries/pseries.h     |  3 ++-
 3 files changed, 15 insertions(+), 14 deletions(-)

diff --git a/arch/powerpc/platforms/pseries/dlpar.c b/arch/powerpc/platforms/pseries/dlpar.c
index a2450b8..5acbe59 100644
--- a/arch/powerpc/platforms/pseries/dlpar.c
+++ b/arch/powerpc/platforms/pseries/dlpar.c
@@ -24,11 +24,11 @@
 #include <asm/rtas.h>
 
 struct cc_workarea {
-	u32	drc_index;
-	u32	zero;
-	u32	name_offset;
-	u32	prop_length;
-	u32	prop_offset;
+	__be32	drc_index;
+	__be32	zero;
+	__be32	name_offset;
+	__be32	prop_length;
+	__be32	prop_offset;
 };
 
 void dlpar_free_cc_property(struct property *prop)
@@ -48,11 +48,11 @@ static struct property *dlpar_parse_cc_property(struct cc_workarea *ccwa)
 	if (!prop)
 		return NULL;
 
-	name = (char *)ccwa + ccwa->name_offset;
+	name = (char *)ccwa + be32_to_cpu(ccwa->name_offset);
 	prop->name = kstrdup(name, GFP_KERNEL);
 
-	prop->length = ccwa->prop_length;
-	value = (char *)ccwa + ccwa->prop_offset;
+	prop->length = be32_to_cpu(ccwa->prop_length);
+	value = (char *)ccwa + be32_to_cpu(ccwa->prop_offset);
 	prop->value = kmemdup(value, prop->length, GFP_KERNEL);
 	if (!prop->value) {
 		dlpar_free_cc_property(prop);
@@ -78,7 +78,7 @@ static struct device_node *dlpar_parse_cc_node(struct cc_workarea *ccwa,
 	if (!dn)
 		return NULL;
 
-	name = (char *)ccwa + ccwa->name_offset;
+	name = (char *)ccwa + be32_to_cpu(ccwa->name_offset);
 	dn->full_name = kasprintf(GFP_KERNEL, "%s/%s", path, name);
 	if (!dn->full_name) {
 		kfree(dn);
@@ -125,7 +125,7 @@ void dlpar_free_cc_nodes(struct device_node *dn)
 #define CALL_AGAIN	-2
 #define ERR_CFG_USE     -9003
 
-struct device_node *dlpar_configure_connector(u32 drc_index,
+struct device_node *dlpar_configure_connector(__be32 drc_index,
 					      struct device_node *parent)
 {
 	struct device_node *dn;
@@ -411,7 +411,7 @@ static ssize_t dlpar_cpu_probe(const char *buf, size_t count)
 	if (!parent)
 		return -ENODEV;
 
-	dn = dlpar_configure_connector(drc_index, parent);
+	dn = dlpar_configure_connector(cpu_to_be32(drc_index), parent);
 	if (!dn)
 		return -EINVAL;
 
diff --git a/arch/powerpc/platforms/pseries/hotplug-cpu.c b/arch/powerpc/platforms/pseries/hotplug-cpu.c
index 20d6297..447f8c6 100644
--- a/arch/powerpc/platforms/pseries/hotplug-cpu.c
+++ b/arch/powerpc/platforms/pseries/hotplug-cpu.c
@@ -247,7 +247,7 @@ static int pseries_add_processor(struct device_node *np)
 	unsigned int cpu;
 	cpumask_var_t candidate_mask, tmp;
 	int err = -ENOSPC, len, nthreads, i;
-	const u32 *intserv;
+	const __be32 *intserv;
 
 	intserv = of_get_property(np, "ibm,ppc-interrupt-server#s", &len);
 	if (!intserv)
@@ -293,7 +293,7 @@ static int pseries_add_processor(struct device_node *np)
 	for_each_cpu(cpu, tmp) {
 		BUG_ON(cpu_present(cpu));
 		set_cpu_present(cpu, true);
-		set_hard_smp_processor_id(cpu, *intserv++);
+		set_hard_smp_processor_id(cpu, be32_to_cpu(*intserv++));
 	}
 	err = 0;
 out_unlock:
diff --git a/arch/powerpc/platforms/pseries/pseries.h b/arch/powerpc/platforms/pseries/pseries.h
index 361add6..1796c54 100644
--- a/arch/powerpc/platforms/pseries/pseries.h
+++ b/arch/powerpc/platforms/pseries/pseries.h
@@ -56,7 +56,8 @@ extern void hvc_vio_init_early(void);
 /* Dynamic logical Partitioning/Mobility */
 extern void dlpar_free_cc_nodes(struct device_node *);
 extern void dlpar_free_cc_property(struct property *);
-extern struct device_node *dlpar_configure_connector(u32, struct device_node *);
+extern struct device_node *dlpar_configure_connector(__be32,
+						struct device_node *);
 extern int dlpar_attach_node(struct device_node *);
 extern int dlpar_detach_node(struct device_node *);
 
-- 
1.8.5.2

^ permalink raw reply related

* [PATCH v2 2/3] pseries: Fix endian issues in onlining cpu threads
From: Thomas Falcon @ 2014-09-16 20:15 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: nfont, bharata, Thomas Falcon
In-Reply-To: <1410898547-12296-1-git-send-email-tlfalcon@linux.vnet.ibm.com>

The ibm,ppc-interrupt-server#s property is in big endian format.
These values need to be converted when used by little endian
architectures.

Signed-off-by: Thomas Falcon <tlfalcon@linux.vnet.ibm.com>
---
Changes in v2:

 Followed suggestions from Michael Ellerman
   conversion of intserv values occur once
---
 arch/powerpc/platforms/pseries/dlpar.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/platforms/pseries/dlpar.c b/arch/powerpc/platforms/pseries/dlpar.c
index 5acbe59..187e4eb 100644
--- a/arch/powerpc/platforms/pseries/dlpar.c
+++ b/arch/powerpc/platforms/pseries/dlpar.c
@@ -363,7 +363,8 @@ static int dlpar_online_cpu(struct device_node *dn)
 	int rc = 0;
 	unsigned int cpu;
 	int len, nthreads, i;
-	const u32 *intserv;
+	const __be32 *intserv;
+	u32 thread;
 
 	intserv = of_get_property(dn, "ibm,ppc-interrupt-server#s", &len);
 	if (!intserv)
@@ -373,8 +374,9 @@ static int dlpar_online_cpu(struct device_node *dn)
 
 	cpu_maps_update_begin();
 	for (i = 0; i < nthreads; i++) {
+		thread = be32_to_cpu(intserv[i]);
 		for_each_present_cpu(cpu) {
-			if (get_hard_smp_processor_id(cpu) != intserv[i])
+			if (get_hard_smp_processor_id(cpu) != thread)
 				continue;
 			BUG_ON(get_cpu_current_state(cpu)
 					!= CPU_STATE_OFFLINE);
@@ -388,7 +390,7 @@ static int dlpar_online_cpu(struct device_node *dn)
 		}
 		if (cpu == num_possible_cpus())
 			printk(KERN_WARNING "Could not find cpu to online "
-			       "with physical id 0x%x\n", intserv[i]);
+			       "with physical id 0x%x\n", thread);
 	}
 	cpu_maps_update_done();
 
-- 
1.8.5.2

^ permalink raw reply related

* [PATCH v3 3/3] pseries: Fix endian issues in cpu hot-removal
From: Thomas Falcon @ 2014-09-16 20:15 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: nfont, bharata, Thomas Falcon
In-Reply-To: <1410898547-12296-1-git-send-email-tlfalcon@linux.vnet.ibm.com>

When removing a cpu, this patch makes sure that values
gotten from or passed to firmware are in the correct
endian format.

Signed-off-by: Thomas Falcon <tlfalcon@linux.vnet.ibm.com>
---
Changes in v3:

 drc_index in dlpar_cpu_release is no longer const to
 fix compilation error found by Bharata Rao
---
 arch/powerpc/platforms/pseries/dlpar.c       | 20 +++++++++++---------
 arch/powerpc/platforms/pseries/hotplug-cpu.c | 10 ++++++----
 2 files changed, 17 insertions(+), 13 deletions(-)

diff --git a/arch/powerpc/platforms/pseries/dlpar.c b/arch/powerpc/platforms/pseries/dlpar.c
index 187e4eb..0fad5b6 100644
--- a/arch/powerpc/platforms/pseries/dlpar.c
+++ b/arch/powerpc/platforms/pseries/dlpar.c
@@ -444,7 +444,8 @@ static int dlpar_offline_cpu(struct device_node *dn)
 	int rc = 0;
 	unsigned int cpu;
 	int len, nthreads, i;
-	const u32 *intserv;
+	const __be32 *intserv;
+	u32 thread;
 
 	intserv = of_get_property(dn, "ibm,ppc-interrupt-server#s", &len);
 	if (!intserv)
@@ -454,8 +455,9 @@ static int dlpar_offline_cpu(struct device_node *dn)
 
 	cpu_maps_update_begin();
 	for (i = 0; i < nthreads; i++) {
+		thread = be32_to_cpu(intserv[i]);
 		for_each_present_cpu(cpu) {
-			if (get_hard_smp_processor_id(cpu) != intserv[i])
+			if (get_hard_smp_processor_id(cpu) != thread)
 				continue;
 
 			if (get_cpu_current_state(cpu) == CPU_STATE_OFFLINE)
@@ -477,14 +479,14 @@ static int dlpar_offline_cpu(struct device_node *dn)
 			 * Upgrade it's state to CPU_STATE_OFFLINE.
 			 */
 			set_preferred_offline_state(cpu, CPU_STATE_OFFLINE);
-			BUG_ON(plpar_hcall_norets(H_PROD, intserv[i])
+			BUG_ON(plpar_hcall_norets(H_PROD, thread)
 								!= H_SUCCESS);
 			__cpu_die(cpu);
 			break;
 		}
 		if (cpu == num_possible_cpus())
 			printk(KERN_WARNING "Could not find cpu to offline "
-			       "with physical id 0x%x\n", intserv[i]);
+			       "with physical id 0x%x\n", thread);
 	}
 	cpu_maps_update_done();
 
@@ -496,15 +498,15 @@ out:
 static ssize_t dlpar_cpu_release(const char *buf, size_t count)
 {
 	struct device_node *dn;
-	const u32 *drc_index;
+	u32 drc_index;
 	int rc;
 
 	dn = of_find_node_by_path(buf);
 	if (!dn)
 		return -EINVAL;
 
-	drc_index = of_get_property(dn, "ibm,my-drc-index", NULL);
-	if (!drc_index) {
+	rc = of_property_read_u32(dn, "ibm,my-drc-index", &drc_index);
+	if (rc) {
 		of_node_put(dn);
 		return -EINVAL;
 	}
@@ -515,7 +517,7 @@ static ssize_t dlpar_cpu_release(const char *buf, size_t count)
 		return -EINVAL;
 	}
 
-	rc = dlpar_release_drc(*drc_index);
+	rc = dlpar_release_drc(drc_index);
 	if (rc) {
 		of_node_put(dn);
 		return rc;
@@ -523,7 +525,7 @@ static ssize_t dlpar_cpu_release(const char *buf, size_t count)
 
 	rc = dlpar_detach_node(dn);
 	if (rc) {
-		dlpar_acquire_drc(*drc_index);
+		dlpar_acquire_drc(drc_index);
 		return rc;
 	}
 
diff --git a/arch/powerpc/platforms/pseries/hotplug-cpu.c b/arch/powerpc/platforms/pseries/hotplug-cpu.c
index 447f8c6..5c375f9 100644
--- a/arch/powerpc/platforms/pseries/hotplug-cpu.c
+++ b/arch/powerpc/platforms/pseries/hotplug-cpu.c
@@ -90,7 +90,7 @@ static void rtas_stop_self(void)
 {
 	static struct rtas_args args = {
 		.nargs = 0,
-		.nret = 1,
+		.nret = cpu_to_be32(1),
 		.rets = &args.args[0],
 	};
 
@@ -312,7 +312,8 @@ static void pseries_remove_processor(struct device_node *np)
 {
 	unsigned int cpu;
 	int len, nthreads, i;
-	const u32 *intserv;
+	const __be32 *intserv;
+	u32 thread;
 
 	intserv = of_get_property(np, "ibm,ppc-interrupt-server#s", &len);
 	if (!intserv)
@@ -322,8 +323,9 @@ static void pseries_remove_processor(struct device_node *np)
 
 	cpu_maps_update_begin();
 	for (i = 0; i < nthreads; i++) {
+		thread = be32_to_cpu(intserv[i]);
 		for_each_present_cpu(cpu) {
-			if (get_hard_smp_processor_id(cpu) != intserv[i])
+			if (get_hard_smp_processor_id(cpu) != thread)
 				continue;
 			BUG_ON(cpu_online(cpu));
 			set_cpu_present(cpu, false);
@@ -332,7 +334,7 @@ static void pseries_remove_processor(struct device_node *np)
 		}
 		if (cpu >= nr_cpu_ids)
 			printk(KERN_WARNING "Could not find cpu to remove "
-			       "with physical id 0x%x\n", intserv[i]);
+			       "with physical id 0x%x\n", thread);
 	}
 	cpu_maps_update_done();
 }
-- 
1.8.5.2

^ 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