LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* Re: [alsa-devel] [PATCH V1 1/3] ASoC: fsl: Kconfig: remove dependence of SND_IMX_SOC for SND_SOC_IMX_PCM_DMA
From: Lars-Peter Clausen @ 2014-08-19  8:45 UTC (permalink / raw)
  To: Shengjiu Wang
  Cc: fabio.estevam, sfr, alsa-devel, arnd, shc_work, tiwai,
	linux-kernel, broonie, timur, lgirdwood, nicoleotsuka, Li.Xiubo,
	xobs, linuxppc-dev
In-Reply-To: <53F30C91.7080700@metafoo.de>

On 08/19/2014 10:36 AM, Lars-Peter Clausen wrote:
> On 08/19/2014 09:41 AM, Shengjiu Wang wrote:
>> On Mon, Aug 18, 2014 at 06:52:46PM +0200, Lars-Peter Clausen wrote:
>>> On 08/18/2014 10:38 AM, Shengjiu Wang wrote:
>>>> Build kernel with SND_SOC_IMC_PCM_DMA=m && SND_IMX_SOC=n leads the
>>>> following
>>>> error:
>>>>
>>>>     sound/built-in.o: In function `fsl_sai_probe':
>>>>>> fsl_sai.c:(.text+0x5f662): undefined reference to `imx_pcm_dma_init'
>>>>     sound/built-in.o: In function `fsl_esai_probe':
>>>>>> fsl_esai.c:(.text+0x6044b): undefined reference to `imx_pcm_dma_init'
>>>>
>>>> Most cpu driver in soc/fsl has use the function 'imx_pcm_dma_init' which is
>>>> defined in imx-pcm-dma.c, so need to select SND_SOC_IMX_PCM_DMA, but it
>>>> depends
>>>> on SND_IMX_SOC, if SND_IMX_SOC=n, then SND_SOC_IMX_PCM_DMA will not be
>>>> selected.
>>>> So remove the dependence of SND_IMX_SOC for SND_SOC_IMX_PCM_DMA.
>>>>
>>>> Reported-by: kbuild test robot <fengguang.wu@intel.com>
>>>> Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
>>>
>>> Those if conditions where just added[1] by Arnd to avoid other build
>>> failures. So just removing them again makes little sense.
>>>
>>> As far as I can see imx_pcm_dma_init() should be stubbed out when
>>> SND_SOC_IMX_PCM_DMA is not selected. So what's going on here?
>>>
>>> [1]
>>> http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=ff40260f79dc0436604452bccd449bffd25ebafb
>>>
>>>
>> Lars-Peter Clausen & Arnd
>>
>> The purpose of Arnd's patch is same with me, which is to resolve the build
>> error when SND_SOC_IMX_PCM_DMA=m & SND_SOC_FSL_SSI/SAI/ESAI/SPDIF=y, the
>> error is "undefined reference to `imx_pcm_dma_init'".
>> But Arnd's patch didn't involve this situation that SND_IMX_SOC=n &
>> SND_SOC_IMX_PCM_DMA=m.
>
> Having SND_SOC_IMX_PCM_DMA selected if SND_IMX_SOC is not selected makes no
> sense. I think the proper fix is to find out why it is selected and make
> sure that it is not selected when SND_IMX_SOC is not selected.


I guess the issue happens if SND_SOC_FSL_ASOC_CARD=m and 
SND_SOC_FSL_{ESAI,SAI,SSI}=y. In this case the fix is simply to drop the 
select SND_SOC_IMX_PCM_DMA from SND_SOC_FSL_ASOC_CARD.

- Lars

^ permalink raw reply

* Re: [alsa-devel] [PATCH V1 1/3] ASoC: fsl: Kconfig: remove dependence of SND_IMX_SOC for SND_SOC_IMX_PCM_DMA
From: Shengjiu Wang @ 2014-08-19  8:55 UTC (permalink / raw)
  To: Lars-Peter Clausen
  Cc: fabio.estevam, sfr, alsa-devel, arnd, shc_work, tiwai,
	linux-kernel, broonie, timur, lgirdwood, nicoleotsuka, Li.Xiubo,
	xobs, linuxppc-dev
In-Reply-To: <53F30E90.8080902@metafoo.de>

On Tue, Aug 19, 2014 at 10:45:04AM +0200, Lars-Peter Clausen wrote:
> On 08/19/2014 10:36 AM, Lars-Peter Clausen wrote:
> >On 08/19/2014 09:41 AM, Shengjiu Wang wrote:
> >>On Mon, Aug 18, 2014 at 06:52:46PM +0200, Lars-Peter Clausen wrote:
> >>>On 08/18/2014 10:38 AM, Shengjiu Wang wrote:
> >>>>Build kernel with SND_SOC_IMC_PCM_DMA=m && SND_IMX_SOC=n leads the
> >>>>following
> >>>>error:
> >>>>
> >>>>    sound/built-in.o: In function `fsl_sai_probe':
> >>>>>>fsl_sai.c:(.text+0x5f662): undefined reference to `imx_pcm_dma_init'
> >>>>    sound/built-in.o: In function `fsl_esai_probe':
> >>>>>>fsl_esai.c:(.text+0x6044b): undefined reference to `imx_pcm_dma_init'
> >>>>
> >>>>Most cpu driver in soc/fsl has use the function 'imx_pcm_dma_init' which is
> >>>>defined in imx-pcm-dma.c, so need to select SND_SOC_IMX_PCM_DMA, but it
> >>>>depends
> >>>>on SND_IMX_SOC, if SND_IMX_SOC=n, then SND_SOC_IMX_PCM_DMA will not be
> >>>>selected.
> >>>>So remove the dependence of SND_IMX_SOC for SND_SOC_IMX_PCM_DMA.
> >>>>
> >>>>Reported-by: kbuild test robot <fengguang.wu@intel.com>
> >>>>Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
> >>>
> >>>Those if conditions where just added[1] by Arnd to avoid other build
> >>>failures. So just removing them again makes little sense.
> >>>
> >>>As far as I can see imx_pcm_dma_init() should be stubbed out when
> >>>SND_SOC_IMX_PCM_DMA is not selected. So what's going on here?
> >>>
> >>>[1]
> >>>http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=ff40260f79dc0436604452bccd449bffd25ebafb
> >>>
> >>>
> >>Lars-Peter Clausen & Arnd
> >>
> >>The purpose of Arnd's patch is same with me, which is to resolve the build
> >>error when SND_SOC_IMX_PCM_DMA=m & SND_SOC_FSL_SSI/SAI/ESAI/SPDIF=y, the
> >>error is "undefined reference to `imx_pcm_dma_init'".
> >>But Arnd's patch didn't involve this situation that SND_IMX_SOC=n &
> >>SND_SOC_IMX_PCM_DMA=m.
> >
> >Having SND_SOC_IMX_PCM_DMA selected if SND_IMX_SOC is not selected makes no
> >sense. I think the proper fix is to find out why it is selected and make
> >sure that it is not selected when SND_IMX_SOC is not selected.
> 
> 
> I guess the issue happens if SND_SOC_FSL_ASOC_CARD=m and
> SND_SOC_FSL_{ESAI,SAI,SSI}=y. In this case the fix is simply to drop
> the select SND_SOC_IMX_PCM_DMA from SND_SOC_FSL_ASOC_CARD.
> 
> - Lars
>

Yes, you are right. Thanks. I will send another patch.

best regards
wang shengjiu 

^ permalink raw reply

* RE: [alsa-devel] [PATCH V1 1/3] ASoC: fsl: Kconfig: remove dependence of SND_IMX_SOC for SND_SOC_IMX_PCM_DMA
From: Li.Xiubo @ 2014-08-19  9:00 UTC (permalink / raw)
  To: shengjiu.wang@freescale.com
  Cc: Fabio.Estevam@freescale.com, sfr@canb.auug.org.au,
	alsa-devel@alsa-project.org, Lars-Peter Clausen, timur@tabi.org,
	arnd@arndb.de, shc_work@mail.ru, tiwai@suse.de,
	linux-kernel@vger.kernel.org, lgirdwood@gmail.com, perex@perex.cz,
	nicoleotsuka@gmail.com, broonie@kernel.org, xobs@kosagi.com,
	linuxppc-dev@lists.ozlabs.org
In-Reply-To: <20140819082108.GB5806@audiosh1>

How about the following :


diff --git a/sound/soc/fsl/Kconfig b/sound/soc/fsl/Kconfig
index 5ae777a..d42f18c 100644
--- a/sound/soc/fsl/Kconfig
+++ b/sound/soc/fsl/Kconfig
@@ -15,7 +15,7 @@ config SND_SOC_FSL_ASRC
 config SND_SOC_FSL_SAI
        tristate "Synchronous Audio Interface (SAI) module support"
        select REGMAP_MMIO
-       select SND_SOC_IMX_PCM_DMA if SND_IMX_SOC !=3D n
+       select SND_SOC_IMX_PCM_DMA
        select SND_SOC_GENERIC_DMAENGINE_PCM
        help
          Say Y if you want to add Synchronous Audio Interface (SAI)
@@ -25,7 +25,7 @@ config SND_SOC_FSL_SAI

 config SND_SOC_FSL_SSI
        tristate "Synchronous Serial Interface module support"
-       select SND_SOC_IMX_PCM_DMA if SND_IMX_SOC !=3D n
+       select SND_SOC_IMX_PCM_DMA
        select SND_SOC_IMX_PCM_FIQ if SND_IMX_SOC !=3D n && (MXC_TZIC || MX=
C_AVIC)
        select REGMAP_MMIO
        help
@@ -37,7 +37,7 @@ config SND_SOC_FSL_SSI
 config SND_SOC_FSL_SPDIF
        tristate "Sony/Philips Digital Interface module support"
        select REGMAP_MMIO
-       select SND_SOC_IMX_PCM_DMA if SND_IMX_SOC !=3D n
+       select SND_SOC_IMX_PCM_DMA
        select SND_SOC_IMX_PCM_FIQ if SND_IMX_SOC !=3D n && (MXC_TZIC || MX=
C_AVIC)
        help
          Say Y if you want to add Sony/Philips Digital Interface (SPDIF)
@@ -48,7 +48,7 @@ config SND_SOC_FSL_SPDIF
 config SND_SOC_FSL_ESAI
        tristate "Enhanced Serial Audio Interface (ESAI) module support"
        select REGMAP_MMIO
-       select SND_SOC_IMX_PCM_DMA if SND_IMX_SOC !=3D n
+       select SND_SOC_IMX_PCM_DMA
        help
          Say Y if you want to add Enhanced Synchronous Audio Interface
          (ESAI) support for the Freescale CPUs.
@@ -76,6 +76,7 @@ config SND_SOC_FSL_ASOC_CARD

 config SND_SOC_IMX_PCM_DMA
        tristate
+       depends on SND_IMX_SOC
        select SND_SOC_GENERIC_DMAENGINE_PCM

 config SND_SOC_IMX_AUDMUX

Thanks,


BRs
Xiubo



> -----Original Message-----
> From: Shengjiu Wang [mailto:shengjiu.wang@freescale.com]
> Sent: Tuesday, August 19, 2014 4:21 PM
> To: Xiubo Li-B47053
> Cc: Lars-Peter Clausen; lgirdwood@gmail.com; broonie@kernel.org;
> perex@perex.cz; tiwai@suse.de; nicoleotsuka@gmail.com; shc_work@mail.ru;
> Estevam Fabio-R49496; xobs@kosagi.com; arnd@arndb.de; sfr@canb.auug.org.a=
u;
> timur@tabi.org; alsa-devel@alsa-project.org; linuxppc-dev@lists.ozlabs.or=
g;
> linux-kernel@vger.kernel.org
> Subject: Re: [alsa-devel] [PATCH V1 1/3] ASoC: fsl: Kconfig: remove depen=
dence
> of SND_IMX_SOC for SND_SOC_IMX_PCM_DMA
>=20
> On Tue, Aug 19, 2014 at 04:13:15PM +0800, Xiubo Li-B47053 wrote:
> > > Subject: Re: [alsa-devel] [PATCH V1 1/3] ASoC: fsl: Kconfig: remove
> dependence
> > > of SND_IMX_SOC for SND_SOC_IMX_PCM_DMA
> > >
> > > On Mon, Aug 18, 2014 at 06:52:46PM +0200, Lars-Peter Clausen wrote:
> > > > On 08/18/2014 10:38 AM, Shengjiu Wang wrote:
> > > > >Build kernel with SND_SOC_IMC_PCM_DMA=3Dm && SND_IMX_SOC=3Dn leads=
 the
> > > following
> > > > >error:
> > > > >
> > > > >    sound/built-in.o: In function `fsl_sai_probe':
> > > > >>>fsl_sai.c:(.text+0x5f662): undefined reference to `imx_pcm_dma_i=
nit'
> > > > >    sound/built-in.o: In function `fsl_esai_probe':
> > > > >>>fsl_esai.c:(.text+0x6044b): undefined reference to `imx_pcm_dma_=
init'
> > > > >
> > > > >Most cpu driver in soc/fsl has use the function 'imx_pcm_dma_init'
> which is
> > > > >defined in imx-pcm-dma.c, so need to select SND_SOC_IMX_PCM_DMA, b=
ut it
> > > depends
> > > > >on SND_IMX_SOC, if SND_IMX_SOC=3Dn, then SND_SOC_IMX_PCM_DMA will =
not be
> > > > >selected.
> > > > >So remove the dependence of SND_IMX_SOC for SND_SOC_IMX_PCM_DMA.
> > > > >
> > > > >Reported-by: kbuild test robot <fengguang.wu@intel.com>
> > > > >Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
> > > >
> > > > Those if conditions where just added[1] by Arnd to avoid other buil=
d
> > > > failures. So just removing them again makes little sense.
> > > >
> > > > As far as I can see imx_pcm_dma_init() should be stubbed out when
> > > > SND_SOC_IMX_PCM_DMA is not selected. So what's going on here?
> > > >
> > > > [1]
> > >
> http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=
=3Dff40
> > > 260f79dc0436604452bccd449bffd25ebafb
> > > >
> > > Lars-Peter Clausen & Arnd
> > >
> > > The purpose of Arnd's patch is same with me, which is to resolve the =
build
> > > error when SND_SOC_IMX_PCM_DMA=3Dm & SND_SOC_FSL_SSI/SAI/ESAI/SPDIF=
=3Dy, the
> > > error is "undefined reference to `imx_pcm_dma_init'".
> > > But Arnd's patch didn't involve this situation that SND_IMX_SOC=3Dn &
> > > SND_SOC_IMX_PCM_DMA=3Dm.
> > >
> > > Currently I think out a solution for this issue is to change
> > >
> > > select SND_SOC_IMX_PCM_DMA if SND_IMX_SOC !=3D n
> > >
> > > to
> > >
> > > depends on SND_SOC_IMX_PCM_DMA !=3D m
> > >
> > > How do you think about this?
> > >
> >
> > What will happen if to build both SAI/ESAI and IMX_PCM_DMA as modules a=
t the
> same
> > time ?
> >
> > Thanks,
> >
> > BRs
> > Xiubo
>=20
> I didn't find error/warning when SAI/ESAI and IMX_PCM_DMA are as modules.=
 The
> build is successful.
>=20
> >
> >
> > > best regards
> > > Wang shengjiu

^ permalink raw reply related

* RE: [alsa-devel] [PATCH V1 1/3] ASoC: fsl: Kconfig: remove dependence of SND_IMX_SOC for SND_SOC_IMX_PCM_DMA
From: shengjiu.wang @ 2014-08-19  9:05 UTC (permalink / raw)
  To: Li.Xiubo@freescale.com
  Cc: Fabio.Estevam@freescale.com, sfr@canb.auug.org.au,
	alsa-devel@alsa-project.org, Lars-Peter Clausen, timur@tabi.org,
	arnd@arndb.de, shc_work@mail.ru, tiwai@suse.de,
	linux-kernel@vger.kernel.org, lgirdwood@gmail.com, perex@perex.cz,
	nicoleotsuka@gmail.com, broonie@kernel.org, xobs@kosagi.com,
	linuxppc-dev@lists.ozlabs.org
In-Reply-To: <3a0c98ca698e4d38b3e92f339049b883@BN1PR0301MB0609.namprd03.prod.outlook.com>

Hi Xiubo Li

     Lars-Peter has point out the root cause. It is caused by the SND_SOC_F=
SL_ASOC_CARD, which will select SND_SOC_IMX_PCM_DMA.

     Thank you very much anyway.

Best regards
Wang shengjiu

-----Original Message-----
From: Xiubo Li-B47053=20
Sent: Tuesday, August 19, 2014 5:00 PM
To: Wang Shengjiu-B02247
Cc: Lars-Peter Clausen; lgirdwood@gmail.com; broonie@kernel.org; perex@pere=
x.cz; tiwai@suse.de; nicoleotsuka@gmail.com; shc_work@mail.ru; Estevam Fabi=
o-R49496; xobs@kosagi.com; arnd@arndb.de; sfr@canb.auug.org.au; timur@tabi.=
org; alsa-devel@alsa-project.org; linuxppc-dev@lists.ozlabs.org; linux-kern=
el@vger.kernel.org
Subject: RE: [alsa-devel] [PATCH V1 1/3] ASoC: fsl: Kconfig: remove depende=
nce of SND_IMX_SOC for SND_SOC_IMX_PCM_DMA

How about the following :


diff --git a/sound/soc/fsl/Kconfig b/sound/soc/fsl/Kconfig index 5ae777a..d=
42f18c 100644
--- a/sound/soc/fsl/Kconfig
+++ b/sound/soc/fsl/Kconfig
@@ -15,7 +15,7 @@ config SND_SOC_FSL_ASRC  config SND_SOC_FSL_SAI
        tristate "Synchronous Audio Interface (SAI) module support"
        select REGMAP_MMIO
-       select SND_SOC_IMX_PCM_DMA if SND_IMX_SOC !=3D n
+       select SND_SOC_IMX_PCM_DMA
        select SND_SOC_GENERIC_DMAENGINE_PCM
        help
          Say Y if you want to add Synchronous Audio Interface (SAI) @@ -25=
,7 +25,7 @@ config SND_SOC_FSL_SAI

 config SND_SOC_FSL_SSI
        tristate "Synchronous Serial Interface module support"
-       select SND_SOC_IMX_PCM_DMA if SND_IMX_SOC !=3D n
+       select SND_SOC_IMX_PCM_DMA
        select SND_SOC_IMX_PCM_FIQ if SND_IMX_SOC !=3D n && (MXC_TZIC || MX=
C_AVIC)
        select REGMAP_MMIO
        help
@@ -37,7 +37,7 @@ config SND_SOC_FSL_SSI  config SND_SOC_FSL_SPDIF
        tristate "Sony/Philips Digital Interface module support"
        select REGMAP_MMIO
-       select SND_SOC_IMX_PCM_DMA if SND_IMX_SOC !=3D n
+       select SND_SOC_IMX_PCM_DMA
        select SND_SOC_IMX_PCM_FIQ if SND_IMX_SOC !=3D n && (MXC_TZIC || MX=
C_AVIC)
        help
          Say Y if you want to add Sony/Philips Digital Interface (SPDIF) @=
@ -48,7 +48,7 @@ config SND_SOC_FSL_SPDIF  config SND_SOC_FSL_ESAI
        tristate "Enhanced Serial Audio Interface (ESAI) module support"
        select REGMAP_MMIO
-       select SND_SOC_IMX_PCM_DMA if SND_IMX_SOC !=3D n
+       select SND_SOC_IMX_PCM_DMA
        help
          Say Y if you want to add Enhanced Synchronous Audio Interface
          (ESAI) support for the Freescale CPUs.
@@ -76,6 +76,7 @@ config SND_SOC_FSL_ASOC_CARD

 config SND_SOC_IMX_PCM_DMA
        tristate
+       depends on SND_IMX_SOC
        select SND_SOC_GENERIC_DMAENGINE_PCM

 config SND_SOC_IMX_AUDMUX

Thanks,


BRs
Xiubo



> -----Original Message-----
> From: Shengjiu Wang [mailto:shengjiu.wang@freescale.com]
> Sent: Tuesday, August 19, 2014 4:21 PM
> To: Xiubo Li-B47053
> Cc: Lars-Peter Clausen; lgirdwood@gmail.com; broonie@kernel.org;=20
> perex@perex.cz; tiwai@suse.de; nicoleotsuka@gmail.com;=20
> shc_work@mail.ru; Estevam Fabio-R49496; xobs@kosagi.com;=20
> arnd@arndb.de; sfr@canb.auug.org.au; timur@tabi.org;=20
> alsa-devel@alsa-project.org; linuxppc-dev@lists.ozlabs.org;=20
> linux-kernel@vger.kernel.org
> Subject: Re: [alsa-devel] [PATCH V1 1/3] ASoC: fsl: Kconfig: remove=20
> dependence of SND_IMX_SOC for SND_SOC_IMX_PCM_DMA
>=20
> On Tue, Aug 19, 2014 at 04:13:15PM +0800, Xiubo Li-B47053 wrote:
> > > Subject: Re: [alsa-devel] [PATCH V1 1/3] ASoC: fsl: Kconfig:=20
> > > remove
> dependence
> > > of SND_IMX_SOC for SND_SOC_IMX_PCM_DMA
> > >
> > > On Mon, Aug 18, 2014 at 06:52:46PM +0200, Lars-Peter Clausen wrote:
> > > > On 08/18/2014 10:38 AM, Shengjiu Wang wrote:
> > > > >Build kernel with SND_SOC_IMC_PCM_DMA=3Dm && SND_IMX_SOC=3Dn leads=
=20
> > > > >the
> > > following
> > > > >error:
> > > > >
> > > > >    sound/built-in.o: In function `fsl_sai_probe':
> > > > >>>fsl_sai.c:(.text+0x5f662): undefined reference to `imx_pcm_dma_i=
nit'
> > > > >    sound/built-in.o: In function `fsl_esai_probe':
> > > > >>>fsl_esai.c:(.text+0x6044b): undefined reference to `imx_pcm_dma_=
init'
> > > > >
> > > > >Most cpu driver in soc/fsl has use the function 'imx_pcm_dma_init'
> which is
> > > > >defined in imx-pcm-dma.c, so need to select=20
> > > > >SND_SOC_IMX_PCM_DMA, but it
> > > depends
> > > > >on SND_IMX_SOC, if SND_IMX_SOC=3Dn, then SND_SOC_IMX_PCM_DMA will=
=20
> > > > >not be selected.
> > > > >So remove the dependence of SND_IMX_SOC for SND_SOC_IMX_PCM_DMA.
> > > > >
> > > > >Reported-by: kbuild test robot <fengguang.wu@intel.com>
> > > > >Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
> > > >
> > > > Those if conditions where just added[1] by Arnd to avoid other=20
> > > > build failures. So just removing them again makes little sense.
> > > >
> > > > As far as I can see imx_pcm_dma_init() should be stubbed out=20
> > > > when SND_SOC_IMX_PCM_DMA is not selected. So what's going on here?
> > > >
> > > > [1]
> > >
> http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/
> ?id=3Dff40
> > > 260f79dc0436604452bccd449bffd25ebafb
> > > >
> > > Lars-Peter Clausen & Arnd
> > >
> > > The purpose of Arnd's patch is same with me, which is to resolve=20
> > > the build error when SND_SOC_IMX_PCM_DMA=3Dm &=20
> > > SND_SOC_FSL_SSI/SAI/ESAI/SPDIF=3Dy, the error is "undefined reference=
 to `imx_pcm_dma_init'".
> > > But Arnd's patch didn't involve this situation that SND_IMX_SOC=3Dn=20
> > > & SND_SOC_IMX_PCM_DMA=3Dm.
> > >
> > > Currently I think out a solution for this issue is to change
> > >
> > > select SND_SOC_IMX_PCM_DMA if SND_IMX_SOC !=3D n
> > >
> > > to
> > >
> > > depends on SND_SOC_IMX_PCM_DMA !=3D m
> > >
> > > How do you think about this?
> > >
> >
> > What will happen if to build both SAI/ESAI and IMX_PCM_DMA as=20
> > modules at the
> same
> > time ?
> >
> > Thanks,
> >
> > BRs
> > Xiubo
>=20
> I didn't find error/warning when SAI/ESAI and IMX_PCM_DMA are as=20
> modules. The build is successful.
>=20
> >
> >
> > > best regards
> > > Wang shengjiu

^ permalink raw reply

* Linux 3.16: all my drivers on SPI bus report WARNING: at drivers/base/dd.c:286
From: leroy christophe @ 2014-08-19  9:21 UTC (permalink / raw)
  To: linux-kernel@vger.kernel.org, LinuxPPC-dev, linux-spi

Since Linux 3.16, for all drivers tied to SPI bus, I get the following 
warning on a PowerPC 8xx.
It doesn't happen with Linux 3.15

What can be the reason / what should I look at ?

[    3.086957] device: 'spi32766.1': device_add
[    3.087179] bus: 'spi': add device spi32766.1
[    3.087653] bus: 'spi': driver_probe_device: matched device 
spi32766.1 with driver lm70
[    3.087743] bus: 'spi': really_probe: probing driver lm70 with device 
spi32766.1
[    3.088014] ------------[ cut here ]------------
[    3.092348] WARNING: at drivers/base/dd.c:286
[    3.096637] Modules linked in:
[    3.099697] CPU: 0 PID: 25 Comm: kworker/u2:1 Tainted: G W     
3.16.1-s3k-drv-999-svn5771_knld-999 #158
[    3.109610] Workqueue: deferwq deferred_probe_work_func
[    3.114736] task: c787f020 ti: c790c000 task.ti: c790c000
[    3.120062] NIP: c01df158 LR: c01df144 CTR: 00000000
[    3.124983] REGS: c790db30 TRAP: 0700   Tainted: G        W 
(3.16.1-s3k-drv-999-svn5771_knld-999)
[    3.134162] MSR: 00029032 <EE,ME,IR,DR,RI>  CR: 22002082 XER: 20000000
[    3.140703]
[    3.140703] GPR00: 00000001 c790dbe0 c787f020 00000044 00000054 
00000308 c056da0e 20737069
[    3.140703] GPR08: 33323736 000ebfe0 00000308 000ebfdf 22002082 
00000000 c046c5a0 c046c608
[    3.140703] GPR16: c046c614 c046c620 c046c62c c046c638 c046c648 
c046c654 c046c68c c046c6c4
[    3.140703] GPR24: 00000000 00000000 00000003 c0401aa0 c0596638 
c059662c c054e7a8 c7996800
[    3.170102] NIP [c01df158] driver_probe_device+0xf8/0x334
[    3.175431] LR [c01df144] driver_probe_device+0xe4/0x334
[    3.180633] Call Trace:
[    3.183093] [c790dbe0] [c01df144] driver_probe_device+0xe4/0x334 
(unreliable)
[    3.190147] [c790dc10] [c01dd15c] bus_for_each_drv+0x7c/0xc0
[    3.195741] [c790dc40] [c01df5fc] device_attach+0xcc/0xf8
[    3.201076] [c790dc60] [c01dd6d4] bus_probe_device+0xb4/0xc4
[    3.206666] [c790dc80] [c01db9f8] device_add+0x270/0x564
[    3.211923] [c790dcc0] [c0219e84] spi_add_device+0xc0/0x190
[    3.217427] [c790dce0] [c021a79c] spi_register_master+0x720/0x834
[    3.223455] [c790dd40] [c021cb48] of_fsl_spi_probe+0x55c/0x614
[    3.229234] [c790dda0] [c01e0d2c] platform_drv_probe+0x30/0x74
[    3.234987] [c790ddb0] [c01df18c] driver_probe_device+0x12c/0x334
[    3.241008] [c790dde0] [c01dd15c] bus_for_each_drv+0x7c/0xc0
[    3.246602] [c790de10] [c01df5fc] device_attach+0xcc/0xf8
[    3.251937] [c790de30] [c01dd6d4] bus_probe_device+0xb4/0xc4
[    3.257536] [c790de50] [c01de9d8] deferred_probe_work_func+0x98/0xe0
[    3.263816] [c790de70] [c00305b8] process_one_work+0x18c/0x440
[    3.269577] [c790dea0] [c0030a00] worker_thread+0x194/0x67c
[    3.275105] [c790def0] [c0039198] kthread+0xd0/0xe4
[    3.279911] [c790df40] [c000c6d0] ret_from_kernel_thread+0x5c/0x64
[    3.285970] Instruction dump:
[    3.288900] 80de0000 419e01d0 3b7b0038 3c60c046 7f65db78 38635264 
48211b99 813f00a0
[    3.296559] 381f00a0 7d290278 3169ffff 7c0b4910 <0f000000> 93df0044 
7fe3fb78 4bfffd4d
[    3.304401] ---[ end trace c75d3461bf9e2961 ]---
[    3.309598] device: 'hwmon1': device_add
[    3.310246] driver: 'lm70': driver_bound: bound to device 'spi32766.1'
[    3.310342] bus: 'spi': really_probe: bound device spi32766.1 to 
driver lm70

Christophe

^ permalink raw reply

* [PATCH V2] ASoC: fsl-asoc-card: move 'config SND_SOC_FSL_ASOC_CARD' to 'if SND_IMX_SOC'
From: Shengjiu Wang @ 2014-08-19  9:36 UTC (permalink / raw)
  To: lgirdwood, broonie, perex, tiwai, nicoleotsuka, Li.Xiubo,
	shc_work, fabio.estevam, shengjiu.wang, xobs, arnd, sfr, timur
  Cc: alsa-devel, linuxppc-dev, linux-kernel

Build kernel with SND_SOC_FSL_ASOC_CARD=m && SND_SOC_FSL_{SSI,SAI,ESAI}=y
leads the following error:

   sound/built-in.o: In function `fsl_sai_probe':
>> fsl_sai.c:(.text+0x5f662): undefined reference to `imx_pcm_dma_init'
   sound/built-in.o: In function `fsl_esai_probe':
>> fsl_esai.c:(.text+0x6044b): undefined reference to `imx_pcm_dma_init'

The config SND_SOC_FSL_ASOC_CARD is for IMX SOC, So move it under condition
of 'if SND_IMX_SOC'.

Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
---
 sound/soc/fsl/Kconfig |   34 +++++++++++++++++-----------------
 1 file changed, 17 insertions(+), 17 deletions(-)

diff --git a/sound/soc/fsl/Kconfig b/sound/soc/fsl/Kconfig
index 417ff70..9348fef 100644
--- a/sound/soc/fsl/Kconfig
+++ b/sound/soc/fsl/Kconfig
@@ -58,23 +58,6 @@ config SND_SOC_FSL_ESAI
 config SND_SOC_FSL_UTILS
 	tristate
 
-config SND_SOC_FSL_ASOC_CARD
-	tristate "Generic ASoC Sound Card with ASRC support"
-	depends on OF && I2C
-	select SND_SOC_IMX_AUDMUX
-	select SND_SOC_IMX_PCM_DMA
-	select SND_SOC_FSL_ESAI
-	select SND_SOC_FSL_SAI
-	select SND_SOC_FSL_SSI
-	select SND_SOC_CS42XX8_I2C
-	select SND_SOC_SGTL5000
-	select SND_SOC_WM8962
-	help
-	 ALSA SoC Audio support with ASRC feature for Freescale SoCs that have
-	 ESAI/SAI/SSI and connect with external CODECs such as WM8962, CS42888
-	 and SGTL5000.
-	 Say Y if you want to add support for Freescale Generic ASoC Sound Card.
-
 config SND_SOC_IMX_PCM_DMA
 	tristate
 	select SND_SOC_GENERIC_DMAENGINE_PCM
@@ -285,6 +268,23 @@ config SND_SOC_IMX_MC13783
 	select SND_SOC_MC13783
 	select SND_SOC_IMX_PCM_DMA
 
+config SND_SOC_FSL_ASOC_CARD
+	tristate "Generic ASoC Sound Card with ASRC support"
+	depends on OF && I2C
+	select SND_SOC_IMX_AUDMUX
+	select SND_SOC_IMX_PCM_DMA
+	select SND_SOC_FSL_ESAI
+	select SND_SOC_FSL_SAI
+	select SND_SOC_FSL_SSI
+	select SND_SOC_CS42XX8_I2C
+	select SND_SOC_SGTL5000
+	select SND_SOC_WM8962
+	help
+	 ALSA SoC Audio support with ASRC feature for Freescale SoCs that have
+	 ESAI/SAI/SSI and connect with external CODECs such as WM8962, CS42888
+	 and SGTL5000.
+	 Say Y if you want to add support for Freescale Generic ASoC Sound Card.
+
 endif # SND_IMX_SOC
 
 endmenu
-- 
1.7.9.5

^ permalink raw reply related

* Re: [alsa-devel] [PATCH V1 1/3] ASoC: fsl: Kconfig: remove dependence of SND_IMX_SOC for SND_SOC_IMX_PCM_DMA
From: Takashi Iwai @ 2014-08-19 10:35 UTC (permalink / raw)
  To: Li.Xiubo@freescale.com
  Cc: Fabio.Estevam@freescale.com, sfr@canb.auug.org.au,
	shengjiu.wang@freescale.com, Lars-Peter Clausen, timur@tabi.org,
	arnd@arndb.de, shc_work@mail.ru, linux-kernel@vger.kernel.org,
	lgirdwood@gmail.com, perex@perex.cz, nicoleotsuka@gmail.com,
	broonie@kernel.org, xobs@kosagi.com, alsa-devel@alsa-project.org,
	linuxppc-dev@lists.ozlabs.org
In-Reply-To: <3a0c98ca698e4d38b3e92f339049b883@BN1PR0301MB0609.namprd03.prod.outlook.com>

At Tue, 19 Aug 2014 09:00:06 +0000,
Li.Xiubo@freescale.com wrote:
> 
> How about the following :
> 
> 
> diff --git a/sound/soc/fsl/Kconfig b/sound/soc/fsl/Kconfig
> index 5ae777a..d42f18c 100644
> --- a/sound/soc/fsl/Kconfig
> +++ b/sound/soc/fsl/Kconfig
> @@ -15,7 +15,7 @@ config SND_SOC_FSL_ASRC
>  config SND_SOC_FSL_SAI
>         tristate "Synchronous Audio Interface (SAI) module support"
>         select REGMAP_MMIO
> -       select SND_SOC_IMX_PCM_DMA if SND_IMX_SOC != n
> +       select SND_SOC_IMX_PCM_DMA
>         select SND_SOC_GENERIC_DMAENGINE_PCM
>         help
>           Say Y if you want to add Synchronous Audio Interface (SAI)
> @@ -25,7 +25,7 @@ config SND_SOC_FSL_SAI
> 
>  config SND_SOC_FSL_SSI
>         tristate "Synchronous Serial Interface module support"
> -       select SND_SOC_IMX_PCM_DMA if SND_IMX_SOC != n
> +       select SND_SOC_IMX_PCM_DMA
>         select SND_SOC_IMX_PCM_FIQ if SND_IMX_SOC != n && (MXC_TZIC || MXC_AVIC)
>         select REGMAP_MMIO
>         help
> @@ -37,7 +37,7 @@ config SND_SOC_FSL_SSI
>  config SND_SOC_FSL_SPDIF
>         tristate "Sony/Philips Digital Interface module support"
>         select REGMAP_MMIO
> -       select SND_SOC_IMX_PCM_DMA if SND_IMX_SOC != n
> +       select SND_SOC_IMX_PCM_DMA
>         select SND_SOC_IMX_PCM_FIQ if SND_IMX_SOC != n && (MXC_TZIC || MXC_AVIC)
>         help
>           Say Y if you want to add Sony/Philips Digital Interface (SPDIF)
> @@ -48,7 +48,7 @@ config SND_SOC_FSL_SPDIF
>  config SND_SOC_FSL_ESAI
>         tristate "Enhanced Serial Audio Interface (ESAI) module support"
>         select REGMAP_MMIO
> -       select SND_SOC_IMX_PCM_DMA if SND_IMX_SOC != n
> +       select SND_SOC_IMX_PCM_DMA
>         help
>           Say Y if you want to add Enhanced Synchronous Audio Interface
>           (ESAI) support for the Freescale CPUs.
> @@ -76,6 +76,7 @@ config SND_SOC_FSL_ASOC_CARD
> 
>  config SND_SOC_IMX_PCM_DMA
>         tristate
> +       depends on SND_IMX_SOC
>         select SND_SOC_GENERIC_DMAENGINE_PCM
> 
>  config SND_SOC_IMX_AUDMUX

I see the problem has been addressed, so JFYI: a reverse selection
doesn't resolve "depends on".  It's a known shortcoming.  That is, a
selected item can select further others, but cannot depend on others.


Takashi

^ permalink raw reply

* Re: [alsa-devel] [PATCH V1 1/3] ASoC: fsl: Kconfig: remove dependence of SND_IMX_SOC for SND_SOC_IMX_PCM_DMA
From: Lars-Peter Clausen @ 2014-08-19 10:39 UTC (permalink / raw)
  To: Takashi Iwai, Li.Xiubo@freescale.com
  Cc: Fabio.Estevam@freescale.com, sfr@canb.auug.org.au,
	shengjiu.wang@freescale.com, timur@tabi.org, arnd@arndb.de,
	shc_work@mail.ru, linux-kernel@vger.kernel.org,
	lgirdwood@gmail.com, perex@perex.cz, nicoleotsuka@gmail.com,
	broonie@kernel.org, xobs@kosagi.com, alsa-devel@alsa-project.org,
	linuxppc-dev@lists.ozlabs.org
In-Reply-To: <s5hha184viu.wl-tiwai@suse.de>

On 08/19/2014 12:35 PM, Takashi Iwai wrote:
> At Tue, 19 Aug 2014 09:00:06 +0000,
> Li.Xiubo@freescale.com wrote:
>>
>> How about the following :
>>
>>
>> diff --git a/sound/soc/fsl/Kconfig b/sound/soc/fsl/Kconfig
>> index 5ae777a..d42f18c 100644
>> --- a/sound/soc/fsl/Kconfig
>> +++ b/sound/soc/fsl/Kconfig
>> @@ -15,7 +15,7 @@ config SND_SOC_FSL_ASRC
>>   config SND_SOC_FSL_SAI
>>          tristate "Synchronous Audio Interface (SAI) module support"
>>          select REGMAP_MMIO
>> -       select SND_SOC_IMX_PCM_DMA if SND_IMX_SOC != n
>> +       select SND_SOC_IMX_PCM_DMA
>>          select SND_SOC_GENERIC_DMAENGINE_PCM
>>          help
>>            Say Y if you want to add Synchronous Audio Interface (SAI)
>> @@ -25,7 +25,7 @@ config SND_SOC_FSL_SAI
>>
>>   config SND_SOC_FSL_SSI
>>          tristate "Synchronous Serial Interface module support"
>> -       select SND_SOC_IMX_PCM_DMA if SND_IMX_SOC != n
>> +       select SND_SOC_IMX_PCM_DMA
>>          select SND_SOC_IMX_PCM_FIQ if SND_IMX_SOC != n && (MXC_TZIC || MXC_AVIC)
>>          select REGMAP_MMIO
>>          help
>> @@ -37,7 +37,7 @@ config SND_SOC_FSL_SSI
>>   config SND_SOC_FSL_SPDIF
>>          tristate "Sony/Philips Digital Interface module support"
>>          select REGMAP_MMIO
>> -       select SND_SOC_IMX_PCM_DMA if SND_IMX_SOC != n
>> +       select SND_SOC_IMX_PCM_DMA
>>          select SND_SOC_IMX_PCM_FIQ if SND_IMX_SOC != n && (MXC_TZIC || MXC_AVIC)
>>          help
>>            Say Y if you want to add Sony/Philips Digital Interface (SPDIF)
>> @@ -48,7 +48,7 @@ config SND_SOC_FSL_SPDIF
>>   config SND_SOC_FSL_ESAI
>>          tristate "Enhanced Serial Audio Interface (ESAI) module support"
>>          select REGMAP_MMIO
>> -       select SND_SOC_IMX_PCM_DMA if SND_IMX_SOC != n
>> +       select SND_SOC_IMX_PCM_DMA
>>          help
>>            Say Y if you want to add Enhanced Synchronous Audio Interface
>>            (ESAI) support for the Freescale CPUs.
>> @@ -76,6 +76,7 @@ config SND_SOC_FSL_ASOC_CARD
>>
>>   config SND_SOC_IMX_PCM_DMA
>>          tristate
>> +       depends on SND_IMX_SOC
>>          select SND_SOC_GENERIC_DMAENGINE_PCM
>>
>>   config SND_SOC_IMX_AUDMUX
>
> I see the problem has been addressed, so JFYI: a reverse selection
> doesn't resolve "depends on".  It's a known shortcoming.  That is, a
> selected item can select further others, but cannot depend on others.

The item will still be selected regardless of its dependencies, but Kconfig 
will print a warning if one or more of the dependencies are not met along 
with the dependency chain that causes the warning. So you'll have a clue why 
things go wrong.

- Lars

^ permalink raw reply

* [PATCH 2/4] powerpc/fsl_msi: change the irq handler from chained to normal
From: Laurentiu Tudor @ 2014-08-19 11:25 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Scott Wood, Mihai Caraman, Laurentiu Tudor

As we do for other fsl-mpic related cascaded irqchips
(e.g. error ints, mpic timers), use a normal irq handler
for msi irqs too.
This brings some advantages such as mask/unmask/ack/eoi
and irq state taken care behind the scenes, kstats
updates a.s.o plus access to features provided by mpic,
such as affinity.

Signed-off-by: Laurentiu Tudor <Laurentiu.Tudor@freescale.com>
Cc: Scott Wood <scottwood@freescale.com>
Cc: Mihai Caraman <mihai.caraman@freescale.com>
---
 arch/powerpc/sysdev/fsl_msi.c | 56 ++++++++++++++-----------------------------
 1 file changed, 18 insertions(+), 38 deletions(-)

diff --git a/arch/powerpc/sysdev/fsl_msi.c b/arch/powerpc/sysdev/fsl_msi.c
index 05a0dd9..0cfc32a 100644
--- a/arch/powerpc/sysdev/fsl_msi.c
+++ b/arch/powerpc/sysdev/fsl_msi.c
@@ -18,6 +18,7 @@
 #include <linux/pci.h>
 #include <linux/slab.h>
 #include <linux/of_platform.h>
+#include <linux/interrupt.h>
 #include <sysdev/fsl_soc.h>
 #include <asm/prom.h>
 #include <asm/hw_irq.h>
@@ -241,40 +242,24 @@ out_free:
 	return rc;
 }
 
-static void fsl_msi_cascade(unsigned int irq, struct irq_desc *desc)
+static irqreturn_t fsl_msi_cascade(int irq, void *data)
 {
-	struct irq_chip *chip = irq_desc_get_chip(desc);
-	struct irq_data *idata = irq_desc_get_irq_data(desc);
 	unsigned int cascade_irq;
 	struct fsl_msi *msi_data;
 	int msir_index = -1;
 	u32 msir_value = 0;
 	u32 intr_index;
 	u32 have_shift = 0;
-	struct fsl_msi_cascade_data *cascade_data;
+	struct fsl_msi_cascade_data *cascade_data = data;
+	irqreturn_t ret = IRQ_NONE;
 
-	cascade_data = irq_get_handler_data(irq);
 	msi_data = cascade_data->msi_data;
 
-	raw_spin_lock(&desc->lock);
-	if ((msi_data->feature &  FSL_PIC_IP_MASK) == FSL_PIC_IP_IPIC) {
-		if (chip->irq_mask_ack)
-			chip->irq_mask_ack(idata);
-		else {
-			chip->irq_mask(idata);
-			chip->irq_ack(idata);
-		}
-	}
-
-	if (unlikely(irqd_irq_inprogress(idata)))
-		goto unlock;
-
 	msir_index = cascade_data->index;
 
 	if (msir_index >= NR_MSI_REG_MAX)
 		cascade_irq = NO_IRQ;
 
-	irqd_set_chained_irq_inprogress(idata);
 	switch (msi_data->feature & FSL_PIC_IP_MASK) {
 	case FSL_PIC_IP_MPIC:
 		msir_value = fsl_msi_read(msi_data->msi_regs,
@@ -303,25 +288,15 @@ static void fsl_msi_cascade(unsigned int irq, struct irq_desc *desc)
 		cascade_irq = irq_linear_revmap(msi_data->irqhost,
 				msi_hwirq(msi_data, msir_index,
 					  intr_index + have_shift));
-		if (cascade_irq != NO_IRQ)
+		if (cascade_irq != NO_IRQ) {
 			generic_handle_irq(cascade_irq);
+			ret = IRQ_HANDLED;
+		}
 		have_shift += intr_index + 1;
 		msir_value = msir_value >> (intr_index + 1);
 	}
-	irqd_clr_chained_irq_inprogress(idata);
 
-	switch (msi_data->feature & FSL_PIC_IP_MASK) {
-	case FSL_PIC_IP_MPIC:
-	case FSL_PIC_IP_VMPIC:
-		chip->irq_eoi(idata);
-		break;
-	case FSL_PIC_IP_IPIC:
-		if (!irqd_irq_disabled(idata) && chip->irq_unmask)
-			chip->irq_unmask(idata);
-		break;
-	}
-unlock:
-	raw_spin_unlock(&desc->lock);
+	return ret;
 }
 
 static int fsl_of_msi_remove(struct platform_device *ofdev)
@@ -336,9 +311,8 @@ static int fsl_of_msi_remove(struct platform_device *ofdev)
 			virq = msi->cascade_array[i]->virq;
 
 			BUG_ON(virq == NO_IRQ);
-			BUG_ON(msi->cascade_array[i] !=
-				irq_get_handler_data(virq));
 
+			free_irq(virq, msi->cascade_array[i]);
 			kfree(msi->cascade_array[i]);
 			irq_dispose_mapping(virq);
 		}
@@ -358,7 +332,7 @@ static int fsl_msi_setup_hwirq(struct fsl_msi *msi, struct platform_device *dev,
 			       int offset, int irq_index)
 {
 	struct fsl_msi_cascade_data *cascade_data = NULL;
-	int virt_msir, i;
+	int virt_msir, i, ret;
 
 	virt_msir = irq_of_parse_and_map(dev->dev.of_node, irq_index);
 	if (virt_msir == NO_IRQ) {
@@ -377,8 +351,14 @@ static int fsl_msi_setup_hwirq(struct fsl_msi *msi, struct platform_device *dev,
 	cascade_data->msi_data = msi;
 	cascade_data->virq = virt_msir;
 	msi->cascade_array[irq_index] = cascade_data;
-	irq_set_handler_data(virt_msir, cascade_data);
-	irq_set_chained_handler(virt_msir, fsl_msi_cascade);
+
+	ret = request_irq(virt_msir, fsl_msi_cascade, 0,
+			  "fsl-msi-cascade", cascade_data);
+	if (ret) {
+		dev_err(&dev->dev, "failed to request_irq(%d), ret = %d\n",
+			virt_msir, ret);
+		return ret;
+	}
 
 	/* Release the hwirqs corresponding to this MSI register */
 	for (i = 0; i < IRQS_PER_MSI_REG; i++)
-- 
1.9.2

^ permalink raw reply related

* [PATCH 1/4] powerpc/fsl_msi: reorganize structs to improve clarity and flexibility
From: Laurentiu Tudor @ 2014-08-19 11:25 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Scott Wood, Mihai Caraman, Laurentiu Tudor

Store cascade_data in an array inside the driver
data for later use.
Get rid of the msi_virq array since now we can
encapsulate the virqs in the cascade_data
directly and access them through the array
mentioned earlier.

Signed-off-by: Laurentiu Tudor <Laurentiu.Tudor@freescale.com>
Cc: Scott Wood <scottwood@freescale.com>
Cc: Mihai Caraman <mihai.caraman@freescale.com>
---
 arch/powerpc/sysdev/fsl_msi.c | 17 +++++++++++------
 arch/powerpc/sysdev/fsl_msi.h |  4 +++-
 2 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/arch/powerpc/sysdev/fsl_msi.c b/arch/powerpc/sysdev/fsl_msi.c
index 9fadc6e..05a0dd9 100644
--- a/arch/powerpc/sysdev/fsl_msi.c
+++ b/arch/powerpc/sysdev/fsl_msi.c
@@ -50,6 +50,7 @@ struct fsl_msi_feature {
 struct fsl_msi_cascade_data {
 	struct fsl_msi *msi_data;
 	int index;
+	int virq;
 };
 
 static inline u32 fsl_msi_read(u32 __iomem *base, unsigned int reg)
@@ -327,15 +328,18 @@ static int fsl_of_msi_remove(struct platform_device *ofdev)
 {
 	struct fsl_msi *msi = platform_get_drvdata(ofdev);
 	int virq, i;
-	struct fsl_msi_cascade_data *cascade_data;
 
 	if (msi->list.prev != NULL)
 		list_del(&msi->list);
 	for (i = 0; i < NR_MSI_REG_MAX; i++) {
-		virq = msi->msi_virqs[i];
-		if (virq != NO_IRQ) {
-			cascade_data = irq_get_handler_data(virq);
-			kfree(cascade_data);
+		if (msi->cascade_array[i]) {
+			virq = msi->cascade_array[i]->virq;
+
+			BUG_ON(virq == NO_IRQ);
+			BUG_ON(msi->cascade_array[i] !=
+				irq_get_handler_data(virq));
+
+			kfree(msi->cascade_array[i]);
 			irq_dispose_mapping(virq);
 		}
 	}
@@ -369,9 +373,10 @@ static int fsl_msi_setup_hwirq(struct fsl_msi *msi, struct platform_device *dev,
 		return -ENOMEM;
 	}
 	irq_set_lockdep_class(virt_msir, &fsl_msi_irq_class);
-	msi->msi_virqs[irq_index] = virt_msir;
 	cascade_data->index = offset;
 	cascade_data->msi_data = msi;
+	cascade_data->virq = virt_msir;
+	msi->cascade_array[irq_index] = cascade_data;
 	irq_set_handler_data(virt_msir, cascade_data);
 	irq_set_chained_handler(virt_msir, fsl_msi_cascade);
 
diff --git a/arch/powerpc/sysdev/fsl_msi.h b/arch/powerpc/sysdev/fsl_msi.h
index df9aa9f..420cfcb 100644
--- a/arch/powerpc/sysdev/fsl_msi.h
+++ b/arch/powerpc/sysdev/fsl_msi.h
@@ -27,6 +27,8 @@
 #define FSL_PIC_IP_IPIC   0x00000002
 #define FSL_PIC_IP_VMPIC  0x00000003
 
+struct fsl_msi_cascade_data;
+
 struct fsl_msi {
 	struct irq_domain *irqhost;
 
@@ -37,7 +39,7 @@ struct fsl_msi {
 	u32 srs_shift; /* Shift of the shared interrupt register select */
 	void __iomem *msi_regs;
 	u32 feature;
-	int msi_virqs[NR_MSI_REG_MAX];
+	struct fsl_msi_cascade_data *cascade_array[NR_MSI_REG_MAX];
 
 	struct msi_bitmap bitmap;
 
-- 
1.9.2

^ permalink raw reply related

* [PATCH 3/4] powerpc/fsl_msi: show more meaningful names in /proc/interrupts
From: Laurentiu Tudor @ 2014-08-19 11:25 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Scott Wood, Mihai Caraman, Laurentiu Tudor

Rename the irq controller associated with a MSI
interrupt to fsl-msi-<V>, where <V> is the virq
of the cascade irq backing up this MSI interrupt.
This way, one can set the affinity of a MSI
through the cascade irq associated with said MSI
interrupt.
Given this example /proc/interrupts snippet:

           CPU0       CPU1       CPU2       CPU3
 16:          0          0          0          0   OpenPIC    16 Edge      mpic-error-int
 17:          0          4          0          0  fsl-msi-224   0 Edge      eth0-rx-0
 18:          0          5          0          0  fsl-msi-225   1 Edge      eth0-tx-0
 19:          0          2          0          0  fsl-msi-226   2 Edge      eth0
 [...]
224:          0         11          0          0   OpenPIC   224 Edge      fsl-msi-cascade
225:          0          0          0          0   OpenPIC   225 Edge      fsl-msi-cascade
226:          0          0          0          0   OpenPIC   226 Edge      fsl-msi-cascade
 [...]

To change the affinity of MSI interrupt 17
(having the irq controller named "fsl-msi-224")
instead of writing /proc/irq/17/smp_affinity, use
the associated MSI cascade irq, in this case,
interrupt 224, e.g.:

   echo 6 > /proc/irq/224/smp_affinity

Note that a MSI cascade irq covers several MSI
interrupts, so changing the affinity on the
cascade will impact all of the associated MSI
interrupts.

Signed-off-by: Laurentiu Tudor <Laurentiu.Tudor@freescale.com>
Cc: Scott Wood <scottwood@freescale.com>
Cc: Mihai Caraman <mihai.caraman@freescale.com>
---
 arch/powerpc/sysdev/fsl_msi.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/sysdev/fsl_msi.c b/arch/powerpc/sysdev/fsl_msi.c
index 0cfc32a..e2ee226 100644
--- a/arch/powerpc/sysdev/fsl_msi.c
+++ b/arch/powerpc/sysdev/fsl_msi.c
@@ -19,6 +19,7 @@
 #include <linux/slab.h>
 #include <linux/of_platform.h>
 #include <linux/interrupt.h>
+#include <linux/seq_file.h>
 #include <sysdev/fsl_soc.h>
 #include <asm/prom.h>
 #include <asm/hw_irq.h>
@@ -67,11 +68,24 @@ static void fsl_msi_end_irq(struct irq_data *d)
 {
 }
 
+static void fsl_msi_print_chip(struct irq_data *irqd, struct seq_file *p)
+{
+	struct fsl_msi *msi_data = irqd->domain->host_data;
+	irq_hw_number_t hwirq = irqd_to_hwirq(irqd);
+	int cascade_virq, srs;
+
+	srs = (hwirq >> msi_data->srs_shift) & MSI_SRS_MASK;
+	cascade_virq = msi_data->cascade_array[srs]->virq;
+
+	seq_printf(p, " fsl-msi-%d", cascade_virq);
+}
+
+
 static struct irq_chip fsl_msi_chip = {
 	.irq_mask	= mask_msi_irq,
 	.irq_unmask	= unmask_msi_irq,
 	.irq_ack	= fsl_msi_end_irq,
-	.name		= "FSL-MSI",
+	.irq_print_chip = fsl_msi_print_chip,
 };
 
 static int fsl_msi_host_map(struct irq_domain *h, unsigned int virq,
-- 
1.9.2

^ permalink raw reply related

* [PATCH 4/4] powerpc/fsl_msi: spread msi ints across different MSIRs
From: Laurentiu Tudor @ 2014-08-19 11:25 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Scott Wood, Mihai Caraman, Laurentiu Tudor

Allocate msis such that each time a new
interrupt is requested, the SRS (MSIR
register select) to be used is allocated
in a round-robin fashion.
The end result is that the msi interrupts
will be spread across distinct MSIRs with
the main benefit that now users can set
affinity to each msi int through the mpic
irq backing up the MSIR register.
This is achieved with the help of a newly
introduced msi bitmap api that allows
specifying the starting point when
searching for a free msi interrupt.

Signed-off-by: Laurentiu Tudor <Laurentiu.Tudor@freescale.com>
Cc: Scott Wood <scottwood@freescale.com>
Cc: Mihai Caraman <mihai.caraman@freescale.com>
---
 arch/powerpc/include/asm/msi_bitmap.h |  2 ++
 arch/powerpc/sysdev/fsl_msi.c         | 31 ++++++++++++++++++++++++++++++-
 arch/powerpc/sysdev/fsl_msi.h         |  5 +++++
 arch/powerpc/sysdev/msi_bitmap.c      | 25 +++++++++++++++----------
 4 files changed, 52 insertions(+), 11 deletions(-)

diff --git a/arch/powerpc/include/asm/msi_bitmap.h b/arch/powerpc/include/asm/msi_bitmap.h
index 97ac3f4..96c2f95 100644
--- a/arch/powerpc/include/asm/msi_bitmap.h
+++ b/arch/powerpc/include/asm/msi_bitmap.h
@@ -25,6 +25,8 @@ int msi_bitmap_alloc_hwirqs(struct msi_bitmap *bmp, int num);
 void msi_bitmap_free_hwirqs(struct msi_bitmap *bmp, unsigned int offset,
 			    unsigned int num);
 void msi_bitmap_reserve_hwirq(struct msi_bitmap *bmp, unsigned int hwirq);
+int msi_bitmap_alloc_hwirqs_from_offset(struct msi_bitmap *bmp, int offset,
+					int num);
 
 int msi_bitmap_reserve_dt_hwirqs(struct msi_bitmap *bmp);
 
diff --git a/arch/powerpc/sysdev/fsl_msi.c b/arch/powerpc/sysdev/fsl_msi.c
index e2ee226..a0682fb 100644
--- a/arch/powerpc/sysdev/fsl_msi.c
+++ b/arch/powerpc/sysdev/fsl_msi.c
@@ -213,6 +213,8 @@ static int fsl_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type)
 		 * available interrupt.
 		 */
 		list_for_each_entry(msi_data, &msi_head, list) {
+			int off;
+
 			/*
 			 * If the PCI node has an fsl,msi property, then we
 			 * restrict our search to the corresponding MSI node.
@@ -224,7 +226,28 @@ static int fsl_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type)
 			if (phandle && (phandle != msi_data->phandle))
 				continue;
 
-			hwirq = msi_bitmap_alloc_hwirqs(&msi_data->bitmap, 1);
+			/*
+			 * Allocate the msi message so that it fits on distinct
+			 * MSIR registers. Obviously, since MSIR registers are
+			 * limited they will overlap at one point.
+			 *
+			 * Due to the format of the newly introduced MSIIR1 in
+			 * mpic 4.3, consecutive msi message values map to
+			 * distinct MSIRs, thus distinct msi irq cascades, so
+			 * nothing special needs to be done in this case.
+			 * On older mpic versions the chose distinct SRS
+			 * values by aligning the msi message value to the
+			 * SRS field shift.
+			 */
+			if (msi_data->feature & FSL_PIC_FTR_MPIC_4_3) {
+				off = 0;
+			} else {
+				off = (atomic_inc_return(&msi_data->msi_alloc_cnt) %
+					msi_data->msir_num);
+				off *= (1 << msi_data->srs_shift);
+			}
+			hwirq = msi_bitmap_alloc_hwirqs_from_offset(
+						&msi_data->bitmap, off, 1);
 			if (hwirq >= 0)
 				break;
 		}
@@ -464,12 +487,17 @@ static int fsl_of_msi_probe(struct platform_device *dev)
 		goto error_out;
 	}
 
+	atomic_set(&msi->msi_alloc_cnt, -1);
+
 	p = of_get_property(dev->dev.of_node, "msi-available-ranges", &len);
 
 	if (of_device_is_compatible(dev->dev.of_node, "fsl,mpic-msi-v4.3") ||
 	    of_device_is_compatible(dev->dev.of_node, "fsl,vmpic-msi-v4.3")) {
 		msi->srs_shift = MSIIR1_SRS_SHIFT;
 		msi->ibs_shift = MSIIR1_IBS_SHIFT;
+		msi->msir_num = NR_MSI_REG_MSIIR1;
+		msi->feature |= FSL_PIC_FTR_MPIC_4_3;
+
 		if (p)
 			dev_warn(&dev->dev, "%s: dose not support msi-available-ranges property\n",
 				__func__);
@@ -487,6 +515,7 @@ static int fsl_of_msi_probe(struct platform_device *dev)
 
 		msi->srs_shift = MSIIR_SRS_SHIFT;
 		msi->ibs_shift = MSIIR_IBS_SHIFT;
+		msi->msir_num = NR_MSI_REG_MSIIR;
 
 		if (p && len % (2 * sizeof(u32)) != 0) {
 			dev_err(&dev->dev, "%s: Malformed msi-available-ranges property\n",
diff --git a/arch/powerpc/sysdev/fsl_msi.h b/arch/powerpc/sysdev/fsl_msi.h
index 420cfcb..50ec4b0 100644
--- a/arch/powerpc/sysdev/fsl_msi.h
+++ b/arch/powerpc/sysdev/fsl_msi.h
@@ -15,6 +15,7 @@
 
 #include <linux/of.h>
 #include <asm/msi_bitmap.h>
+#include <asm/atomic.h>
 
 #define NR_MSI_REG_MSIIR	8  /* MSIIR can index 8 MSI registers */
 #define NR_MSI_REG_MSIIR1	16 /* MSIIR1 can index 16 MSI registers */
@@ -27,6 +28,8 @@
 #define FSL_PIC_IP_IPIC   0x00000002
 #define FSL_PIC_IP_VMPIC  0x00000003
 
+#define FSL_PIC_FTR_MPIC_4_3 0x00000010
+
 struct fsl_msi_cascade_data;
 
 struct fsl_msi {
@@ -37,6 +40,8 @@ struct fsl_msi {
 	u32 msiir_offset; /* Offset of MSIIR, relative to start of CCSR */
 	u32 ibs_shift; /* Shift of interrupt bit select */
 	u32 srs_shift; /* Shift of the shared interrupt register select */
+	u32 msir_num; /* Number of available MSIR regs */
+	atomic_t msi_alloc_cnt; /* Counter for MSI hwirq allocations */
 	void __iomem *msi_regs;
 	u32 feature;
 	struct fsl_msi_cascade_data *cascade_array[NR_MSI_REG_MAX];
diff --git a/arch/powerpc/sysdev/msi_bitmap.c b/arch/powerpc/sysdev/msi_bitmap.c
index 2ff6302..8b7d8fc 100644
--- a/arch/powerpc/sysdev/msi_bitmap.c
+++ b/arch/powerpc/sysdev/msi_bitmap.c
@@ -14,23 +14,28 @@
 #include <asm/msi_bitmap.h>
 #include <asm/setup.h>
 
-int msi_bitmap_alloc_hwirqs(struct msi_bitmap *bmp, int num)
+int msi_bitmap_alloc_hwirqs_from_offset(struct msi_bitmap *bmp, int offset,
+					int num)
 {
 	unsigned long flags;
-	int offset, order = get_count_order(num);
+	int index;
+	int order = get_count_order(num);
 
 	spin_lock_irqsave(&bmp->lock, flags);
-	/*
-	 * This is fast, but stricter than we need. We might want to add
-	 * a fallback routine which does a linear search with no alignment.
-	 */
-	offset = bitmap_find_free_region(bmp->bitmap, bmp->irq_count, order);
+	index = bitmap_find_next_zero_area(bmp->bitmap, bmp->irq_count,
+					   offset, num, (1 << order) - 1);
+	bitmap_set(bmp->bitmap, index, num);
 	spin_unlock_irqrestore(&bmp->lock, flags);
 
-	pr_debug("msi_bitmap: allocated 0x%x (2^%d) at offset 0x%x\n",
-		 num, order, offset);
+	pr_debug("msi_bitmap: found %d free bits starting from offset %d at index %d\n",
+		 num, offset, index);
 
-	return offset;
+	return index;
+}
+
+int msi_bitmap_alloc_hwirqs(struct msi_bitmap *bmp, int num)
+{
+	return msi_bitmap_alloc_hwirqs_from_offset(bmp, 0, num);
 }
 
 void msi_bitmap_free_hwirqs(struct msi_bitmap *bmp, unsigned int offset,
-- 
1.9.2

^ permalink raw reply related

* PCIe driver not working properly after upgrading to linux 3.8.13
From: Gokul C G @ 2014-08-19 14:43 UTC (permalink / raw)
  To: linux-pci; +Cc: meta-freescale, linuxppc-dev, djiang

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

HI,

I am facing problem with PCIE driver in new Linux kernel compiled for 
powerpc architecture (Big endian) ,freescales P2040 processor.I was 
using old kernel Linux version 3.0.48 previously and now updated to 
Linux version 3.8.13-rt9.After updating to the new kernel, PCIe device 
drivers not working properly and i am getting some error messages in the 
boot-up .My intention is to use   EXAR PCIe Multiport serial driver and 
add 8 serial ports in addition to 4 built in serial ports provided by 
P2040 processor. The PCIe driver form EXAR is compiled and  loaded as 
kernel module . The same was working with linux kernel 3.0.48 and 
following prints observed while loading kernel module.


linux 3.0.48 ,working insmod log

========================


Exar PCIe (XR17V35x) serial driver Revision: 1.2

0000:01:00.0: ttyXR0 at MMIO 0xc20000000 (irq = 41) is a XR17v35x

0000:01:00.0: ttyXR1 at MMIO 0xc20000400 (irq = 41) is a XR17v35x

0000:01:00.0: ttyXR2 at MMIO 0xc20000800 (irq = 41) is a XR17v35x

0000:01:00.0: ttyXR3 at MMIO 0xc20000c00 (irq = 41) is a XR17v35x

0000:01:00.0: ttyXR4 at MMIO 0xc20001000 (irq = 41) is a XR17v35x

0000:01:00.0: ttyXR5 at MMIO 0xc20001400 (irq = 41) is a XR17v35x

0000:01:00.0: ttyXR6 at MMIO 0xc20001800 (irq = 41) is a XR17v35x

0000:01:00.0: ttyXR7 at MMIO 0xc20001c00 (irq = 41) is a XR17v35x

After that  ttyXR0 to ttyXR7 (7 serial devices) will be displayed 
under*/dev*directory .

And following PCIe driver messages in*dmesg*(linux 3.0.48 ,working )

----------------------------------------------------------------------

EDAC PCI0: Giving out device to module 'MPC85xx_edac' controller 
'mpc85xx_pci_err': DEV 'ffe201000.pcie' (INTERRUPT)

MPC85xx_edac acquired irq 493 for PCI Err

MPC85xx_edac PCI err registered

PCI: Probing PCI hardware

pci 0000:00:00.0: ignoring class b20 (doesn't match header type 01)

PCIE error(s) detected

pci 0000:00:00.0: PCI bridge to [bus 01-ff]

PCIE ERR_DR register: 0x80020000

PCIE ERR_CAP_STAT register: 0x80000001

PCIE ERR_CAP_R0 register: 0x00000800

PCIE ERR_CAP_R1 register: 0x00000000

PCIE ERR_CAP_R2 register: 0x00000000

PCIE ERR_CAP_R3 register: 0x00000000

pci 0000:00:00.0: PCI bridge to [bus 01-01]

pci 0000:00:00.0:   bridge window [io 0xfdfea000-0xfdff9fff]

pci 0000:00:00.0:   bridge window [mem 0xc20000000-0xc3fffffff]

pci 0000:00:00.0:   bridge window [mem pref disabled]

bio: create slab <bio-0> at 0

But after upgrading kernel to 3.8.13 while inserting kernel module only 
following messages displayed and no ttyXR devices displayed under /dev 
directory .

Exar PCIe (XR17V35x) serial driver Revision: 1.2

no other messages

And following PCIe driver messages in*dmesg*(linux 3.8.13 ,not working )

----------------------------------------------------------------------

EDAC PCI0: Giving out device to module 'MPC85xx_edac' controller 
'mpc85xx_pci_err': DEV 'ffe201000.pcie' (INTERRUPT)

MPC85xx_edac acquired irq 481 for PCI Err

MPC85xx_edac PCI err registered

PCI: Probing PCI hardware

fsl-pci ffe201000.pcie: PCI host bridge to bus 0000:00

pci_bus 0000:00: root bus resource [io  0x0000-0xffff]

pci_bus 0000:00: root bus resource [mem 0xc20000000-0xc3fffffff] (bus 
address [0xe0000000-0xffffffff])

pci_bus 0000:00: root bus resource [bus 00-ff]

PCIE error(s) detected

PCIE ERR_DR register: 0x80020000

PCIE ERR_CAP_STAT register: 0x80000001

PCIE ERR_CAP_R0 register: 0x00000800

pci 0000:00:00.0: PCI bridge to [bus 01-ff]

PCIE ERR_CAP_R1 register: 0x00000000

PCIE ERR_CAP_R2 register: 0x00000000

PCIE ERR_CAP_R3 register: 0x00000000

PCI: Cannot allocate resource region 0 of device 0000:00:00.0, will remap

pci 0000:00:00.0: BAR 0: can't assign mem (size 0x1000000)

pci 0000:00:00.0: BAR 9: can't assign mem pref (size 0x200000)

pci 0000:00:00.0: PCI bridge to [bus 01]

pci 0000:00:00.0:   bridge window [io  0x0000-0xffff]

pci 0000:00:00.0:   bridge window [mem 0xc20000000-0xc3fffffff]



=========================



-----------

following lines are there in dts related to pci

   pcie@ffe200000 {

   reg = <0xf 0xfe200000 0x0 0x1000>;

   ranges = <0x2000000 0x0 0xe0000000 0xc 0x0 0x0 0x20000000 0x1000000 
0x0 0x0 0xf 0xf8000000 0x0 0x10000>;

   compatible = "fsl,p2041-pcie", "fsl,qoriq-pcie-v2.2";

   device_type = "pci";

   #size-cells = <0x2>;

   #address-cells = <0x3>;

   bus-range = <0x0 0xff>;

   clock-frequency = <0x1fca055>;

   interrupts = <0x10 0x2 0x1 0xf>;

          pcie@0 {

          ranges = <0x2000000 0x0 0xe0000000 0x2000000 0x0 0xe0000000 
0x0 0x20000000 0x1000000 0x0 0x0 0x1000000 0x0 0x0 0x0 0x10000>;

          reg = <0x0 0x0 0x0 0x0 0x0>;

          #interrupt-cells = <0x1>;

          #size-cells = <0x2>;

          #address-cells = <0x3>;

          device_type = "pci";

          interrupts = <0x10 0x2 0x1 0xf>;

          interrupt-map-mask = <0xf800 0x0 0x0 0x7>;

          interrupt-map = <0x0 0x0 0x0 0x1 0x1 0x28 0x1 0x0 0x0 0x0 0x0 
0x0 0x2 0x1 0x1 0x1 0x0 0x0 0x0 0x0 0x0 0x3 0x1 0x2 0x1 0x0 0x0 0x0 0x0 
0x0 0x4 0x1 0x3 0x1 0x0 0x0>;

          };

   };

   pcie@ffe201000 {

   reg = <0xf 0xfe201000 0x0 0x1000>;

   ranges = <0x2000000 0x0 0xe0000000 0xc 0x20000000 0x0 0x20000000 
0x1000000 0x0 0x0 0xf 0xf8010000 0x0 0x10000>;

   compatible = "fsl,p2041-pcie", "fsl,qoriq-pcie-v2.2";

   device_type = "pci";

   #size-cells = <0x2>;

   #address-cells = <0x3>;

   bus-range = <0x0 0xff>;

   clock-frequency = <0x1fca055>;

   interrupts = <0x10 0x2 0x1 0xe>;

       pcie@0 {

       ranges = <0x2000000 0x0 0xe0000000 0x2000000 0x0 0xe0000000 0x0 
0x20000000 0x1000000 0x0 0x0 0x1000000 0x0 0x0 0x0 0x10000>;

       reg = <0x0 0x0 0x0 0x0 0x0>;

       #interrupt-cells = <0x1>;

       #size-cells = <0x2>;

      #address-cells = <0x3>;

      device_type = "pci";

      interrupts = <0x10 0x2 0x1 0xe>;

      interrupt-map-mask = <0xf800 0x0 0x0 0x7>;

      interrupt-map = <0x0 0x0 0x0 0x1 0x1 0x29 0x1 0x0 0x0 0x0 0x0 0x0 
0x2 0x1 0x5 0x1 0x0 0x0 0x0 0x0 0x0 0x3 0x1 0x6 0x1 0x0 0x0 0x0 0x0 0x0 
0x4 0x1 0x7 0x1 0x0 0x0>;

      };

   };

   pcie@ffe202000 {

   reg = <0xf 0xfe202000 0x0 0x1000>;

   ranges = <0x2000000 0x0 0xe0000000 0xc 0x40000000 0x0 0x20000000 
0x1000000 0x0 0x0 0xf 0xf8020000 0x0 0x10000>;

   compatible = "fsl,p2041-pcie", "fsl,qoriq-pcie-v2.2";

   device_type = "pci";

   #size-cells = <0x2>;

   #address-cells = <0x3>;

   bus-range = <0x0 0xff>;

   clock-frequency = <0x1fca055>;

   interrupts = <0x10 0x2 0x1 0xd>;

      pcie@0 {

      ranges = <0x2000000 0x0 0xe0000000 0x2000000 0x0 0xe0000000 0x0 
0x20000000 0x1000000 0x0 0x0 0x1000000 0x0 0x0 0x0 0x10000>;

      reg = <0x0 0x0 0x0 0x0 0x0>;

      #interrupt-cells = <0x1>;

      #size-cells = <0x2>;

      #address-cells = <0x3>;

      device_type = "pci";

      interrupts = <0x10 0x2 0x1 0xd>;

      interrupt-map-mask = <0xf800 0x0 0x0 0x7>;

      interrupt-map = <0x0 0x0 0x0 0x1 0x1 0x2a 0x1 0x0 0x0 0x0 0x0 0x0 
0x2 0x1 0x9 0x1 0x0 0x0 0x0 0x0 0x0 0x3 0x1 0xa 0x1 0x0 0x0 0x0 0x0 0x0 
0x4 0x1 0xb 0x1 0x0 0x0>;

      };

   };

*
*

only address ffe201000 have PCIe card connected.


====================

here is the lspci output

---------------------------------

root@root:~#  lspci -vvv

00:00.0 Class 0604: 1957:0411

01:00.0 Class 0700: 13a8:0358

root@root:~#

make menuconfig compile time options for linux  :

---------------------------------------------------------------------

-*- Freescale Local Bus support

   ? ?                                           [ ] Enable stashing of 
FMAN write transactions for ethernet ports

   ? ?                                           -*- Datapath 
Acceleration Queue and Buffer management

   ? ?                                           [*] PCI support

   ? ?                                           [*] PCI Express support

   ? ?                                           < > PCI Express Hotplug 
driver

   ? ?                                           [*]   Root Port 
Advanced Error Reporting support

   ? ?                                           [ ]     PCI Express 
ECRC settings control

   ? ?                                           < >     PCIe AER error 
injector support

   ? ?                                           [ ]   PCI Express ASPM 
control

   ? ?                                           [*] Message Signaled 
Interrupts (MSI and MSI-X)

   ? ?                                           [*] PCI Debugging

   ? ?                                           [ ] Enable PCI resource 
re-allocation detection

   ? ?                                           < > PCI Stub driver

   ? ?                                           [ ] PCI IOV support

   ? ?                                           [ ] PCI PRI support

   ? ?                                           [ ] PCI PASID support

   ? ?                                           < > PCCard 
(PCMCIA/CardBus) support --->

   ? ?                                           <*> Support for PCI 
Hotplug --->

   ? ?                                           [ ] RapidIO support





I am using same device tree that i used with linux 3.0.48 .

I doubt there is basic problem with PCie driver provided with linux 3.8.x .

When I searched in this Google, I Could find that some people 
experienced some problem with PCIe driver in linux 3.8 after 
up-gradation of kernel.

Can anyone help me to get out this issue ?

Did any one faced same issue before?

-- 
Thanks & Regards
*Gokul C G *
Engineer Product Development

Phone 	 : +91-484 2861900
Mobile 	 :
Fax 	 : +91-484 2861900
Email 	 : gokul.g@kalkitech.in <mailto:gokul.g@kalkitech.in>
Web 	 : www.kalkitech.com <http://www.kalkitech.com>


<http://www.kalkitech.com>


"Disclaimer: This message is being sent from Kalki Communication Technologies
Pvt Ltd (KALKITECH). and may contain information which is confidential or 

privileged. If you are not the intended recipient, please advise the sender
immediately by reply e-mail and delete this message and any attachments 

without retaining a copy. Any unauthorized use of the content of this message
can expose the responsible party to civil and/or criminal penalties, 

and may constitute a more serious offense. Further the company does not accept
liability for any errors, omissions, viruses or computer problems 

experienced as a result of this transmission. If you have received this
message in error, notice is hereby given that no representation, contract or 

other binding obligation shall be created by this e-mail." 

[-- Attachment #2.1: Type: text/html, Size: 132208 bytes --]

[-- Attachment #2.2: Kalkitech_Logo_200.jpg --]
[-- Type: image/jpeg, Size: 12944 bytes --]

^ permalink raw reply

* Re: [PATCH V2] ASoC: fsl-asoc-card: move 'config SND_SOC_FSL_ASOC_CARD' to 'if SND_IMX_SOC'
From: Mark Brown @ 2014-08-19 16:12 UTC (permalink / raw)
  To: Shengjiu Wang
  Cc: fabio.estevam, sfr, alsa-devel, timur, arnd, shc_work, tiwai,
	linux-kernel, lgirdwood, perex, nicoleotsuka, Li.Xiubo, xobs,
	linuxppc-dev
In-Reply-To: <bfed4dfd3cf1ef134dac1f114f3d2b8cedf55c68.1408440952.git.shengjiu.wang@freescale.com>

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

On Tue, Aug 19, 2014 at 05:36:41PM +0800, Shengjiu Wang wrote:
> Build kernel with SND_SOC_FSL_ASOC_CARD=m && SND_SOC_FSL_{SSI,SAI,ESAI}=y
> leads the following error:

Applied, thanks.

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

^ permalink raw reply

* [PATCH] powerpc/pseries: Fix endian issues in memory hotplug
From: Thomas Falcon @ 2014-08-19 20:44 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: nfont, Thomas Falcon

Values acquired from Open Firmware are in 32-bit big endian format
and need to be handled on little endian architectures.  This patch
ensures values are in cpu endian when hotplugging memory.

Signed-off-by: Thomas Falcon <tlfalcon@linux.vnet.ibm.com>
---
 arch/powerpc/platforms/pseries/hotplug-memory.c | 36 +++++++++++++------------
 1 file changed, 19 insertions(+), 17 deletions(-)

diff --git a/arch/powerpc/platforms/pseries/hotplug-memory.c b/arch/powerpc/platforms/pseries/hotplug-memory.c
index c904583..17ee193 100644
--- a/arch/powerpc/platforms/pseries/hotplug-memory.c
+++ b/arch/powerpc/platforms/pseries/hotplug-memory.c
@@ -113,7 +113,7 @@ out:
 static int pseries_remove_mem_node(struct device_node *np)
 {
 	const char *type;
-	const unsigned int *regs;
+	const __be32 *regs;
 	unsigned long base;
 	unsigned int lmb_size;
 	int ret = -EINVAL;
@@ -132,8 +132,8 @@ static int pseries_remove_mem_node(struct device_node *np)
 	if (!regs)
 		return ret;
 
-	base = *(unsigned long *)regs;
-	lmb_size = regs[3];
+	base = be64_to_cpu(*(unsigned long *)regs);
+	lmb_size = be32_to_cpu(regs[3]);
 
 	pseries_remove_memblock(base, lmb_size);
 	return 0;
@@ -153,7 +153,7 @@ static inline int pseries_remove_mem_node(struct device_node *np)
 static int pseries_add_mem_node(struct device_node *np)
 {
 	const char *type;
-	const unsigned int *regs;
+	const __be32 *regs;
 	unsigned long base;
 	unsigned int lmb_size;
 	int ret = -EINVAL;
@@ -172,8 +172,8 @@ static int pseries_add_mem_node(struct device_node *np)
 	if (!regs)
 		return ret;
 
-	base = *(unsigned long *)regs;
-	lmb_size = regs[3];
+	base = be64_to_cpu(*(unsigned long *)regs);
+	lmb_size = be32_to_cpu(regs[3]);
 
 	/*
 	 * Update memory region to represent the memory add
@@ -187,14 +187,14 @@ static int pseries_update_drconf_memory(struct of_prop_reconfig *pr)
 	struct of_drconf_cell *new_drmem, *old_drmem;
 	unsigned long memblock_size;
 	u32 entries;
-	u32 *p;
+	__be32 *p;
 	int i, rc = -EINVAL;
 
 	memblock_size = pseries_memory_block_size();
 	if (!memblock_size)
 		return -EINVAL;
 
-	p = (u32 *) pr->old_prop->value;
+	p = (__be32 *) pr->old_prop->value;
 	if (!p)
 		return -EINVAL;
 
@@ -203,28 +203,30 @@ static int pseries_update_drconf_memory(struct of_prop_reconfig *pr)
 	 * entries. Get the niumber of entries and skip to the array of
 	 * of_drconf_cell's.
 	 */
-	entries = *p++;
+	entries = be32_to_cpu(*p++);
 	old_drmem = (struct of_drconf_cell *)p;
 
-	p = (u32 *)pr->prop->value;
+	p = (__be32 *)pr->prop->value;
 	p++;
 	new_drmem = (struct of_drconf_cell *)p;
 
 	for (i = 0; i < entries; i++) {
-		if ((old_drmem[i].flags & DRCONF_MEM_ASSIGNED) &&
-		    (!(new_drmem[i].flags & DRCONF_MEM_ASSIGNED))) {
-			rc = pseries_remove_memblock(old_drmem[i].base_addr,
+		if ((be32_to_cpu(old_drmem[i].flags) & DRCONF_MEM_ASSIGNED) &&
+		    (!(be32_to_cpu(new_drmem[i].flags) & DRCONF_MEM_ASSIGNED))) {
+			rc = pseries_remove_memblock(
+				be64_to_cpu(old_drmem[i].base_addr),
 						     memblock_size);
 			break;
-		} else if ((!(old_drmem[i].flags & DRCONF_MEM_ASSIGNED)) &&
-			   (new_drmem[i].flags & DRCONF_MEM_ASSIGNED)) {
-			rc = memblock_add(old_drmem[i].base_addr,
+		} else if ((!(be32_to_cpu(old_drmem[i].flags) &
+			    DRCONF_MEM_ASSIGNED)) &&
+			    (be32_to_cpu(new_drmem[i].flags) &
+			    DRCONF_MEM_ASSIGNED)) {
+			rc = memblock_add(be64_to_cpu(old_drmem[i].base_addr),
 					  memblock_size);
 			rc = (rc < 0) ? -EINVAL : 0;
 			break;
 		}
 	}
-
 	return rc;
 }
 
-- 
1.8.5.2

^ permalink raw reply related

* [PATCH] powerpc: Fix build failure when MEMORY_HOTPLUG=y
From: Pranith Kumar @ 2014-08-19 21:01 UTC (permalink / raw)
  To: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman,
	open list:LINUX FOR POWERPC..., open list
  Cc: Andew Morton

ARCH_ENABLE_MEMORY_HOTPLUG is enabled by default for powerpc. This causes build
failures when SPARSEMEM=n as memory hotplug needs definition which are defined
only when SPARSEMEM=y. The error is as follows:

arch/powerpc/platforms/pseries/hotplug-memory.c:27:31: error: 'SECTION_SIZE_BITS' undeclared (first use in this function)
arch/powerpc/platforms/pseries/hotplug-memory.c:27:31: note: each undeclared identifier is reported only once for each function it appears in
arch/powerpc/platforms/pseries/hotplug-memory.c: In function 'pseries_remove_memblock':
arch/powerpc/platforms/pseries/hotplug-memory.c:98:34: error: 'SECTION_SIZE_BITS' undeclared (first use in this function)
make[2]: *** [arch/powerpc/platforms/pseries/hotplug-memory.o] Error 1

Signed-off-by: Pranith Kumar <bobby.prani@gmail.com>
CC: Andew Morton <akpm@linux-foundation.org>
---
 arch/powerpc/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 9c1aa77..da16ffe 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -383,6 +383,7 @@ config ARCH_CPU_PROBE_RELEASE
 
 config ARCH_ENABLE_MEMORY_HOTPLUG
 	def_bool y
+	depends on SPARSEMEM
 
 config ARCH_HAS_WALK_MEMORY
 	def_bool y
-- 
1.9.1

^ permalink raw reply related

* [RFC PATCH] powerpc: Make SPU_FS depend on SPARSEMEM
From: Pranith Kumar @ 2014-08-19 21:16 UTC (permalink / raw)
  To: Arnd Bergmann, Benjamin Herrenschmidt, Paul Mackerras,
	Michael Ellerman, open list:CELL BROADBAND EN...,
	open list:CELL BROADBAND EN..., open list

SPU_FS unconditionally enables MEMORY_HOTPLUG, which will fail to build if
SPARSEMEM=n.

Make SPU_FS depend on SPARSEMEM so that hotplug-memory.c does not fail to
compile.

Signed-off-by: Pranith Kumar <bobby.prani@gmail.com>
---
 arch/powerpc/platforms/cell/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/platforms/cell/Kconfig b/arch/powerpc/platforms/cell/Kconfig
index 9978f59..832872e 100644
--- a/arch/powerpc/platforms/cell/Kconfig
+++ b/arch/powerpc/platforms/cell/Kconfig
@@ -60,7 +60,7 @@ menu "Cell Broadband Engine options"
 config SPU_FS
 	tristate "SPU file system"
 	default m
-	depends on PPC_CELL
+	depends on PPC_CELL && SPARSEMEM
 	select SPU_BASE
 	select MEMORY_HOTPLUG
 	help
-- 
1.9.1

^ permalink raw reply related

* Re: [PATCH V7 00/17] Enable SRIOV on POWER8
From: Bjorn Helgaas @ 2014-08-19 21:19 UTC (permalink / raw)
  To: Wei Yang; +Cc: benh, linux-pci, gwshan, qiudayu, yan, linuxppc-dev
In-Reply-To: <1406182947-11302-1-git-send-email-weiyang@linux.vnet.ibm.com>

On Thu, Jul 24, 2014 at 02:22:10PM +0800, Wei Yang wrote:
> This patch set enables the SRIOV on POWER8.
> 
> The gerneral idea is put each VF into one individual PE and allocate required
> resources like DMA/MSI.
> 
> One thing special for VF PE is we use M64BT to cover the IOV BAR. M64BT is one
> hardware on POWER platform to map MMIO address to PE. By using M64BT, we could
> map one individual VF to a VF PE, which introduce more flexiblity to users.
> 
> To achieve this effect, we need to do some hack on pci devices's resources.
> 1. Expand the IOV BAR properly.
>    Done by pnv_pci_ioda_fixup_iov_resources().
> 2. Shift the IOV BAR properly.
>    Done by pnv_pci_vf_resource_shift().
> 3. IOV BAR alignment is the total size instead of an individual size on
>    powernv platform.
>    Done by pnv_pcibios_sriov_resource_alignment().
> 4. Take the IOV BAR alignment into consideration in the sizing and assigning.
>    This is achieved by commit: "PCI: Take additional IOV BAR alignment in
>    sizing and assigning"
> 
> Test Environment:
>        The SRIOV device tested is Emulex Lancer and Mellanox ConnectX-3 on
>        POWER8.
> 
> Examples on pass through a VF to guest through vfio:
> 	1. install necessary modules
> 	   modprobe vfio
> 	   modprobe vfio-pci
> 	2. retrieve the iommu_group the device belongs to
> 	   readlink /sys/bus/pci/devices/0000:06:0d.0/iommu_group
> 	   ../../../../kernel/iommu_groups/26
> 	   This means it belongs to group 26
> 	3. see how many devices under this iommu_group
> 	   ls /sys/kernel/iommu_groups/26/devices/
> 	4. unbind the original driver and bind to vfio-pci driver
> 	   echo 0000:06:0d.0 > /sys/bus/pci/devices/0000:06:0d.0/driver/unbind
> 	   echo  1102 0002 > /sys/bus/pci/drivers/vfio-pci/new_id
> 	   Note: this should be done for each device in the same iommu_group
> 	5. Start qemu and pass device through vfio
> 	   /home/ywywyang/git/qemu-impreza/ppc64-softmmu/qemu-system-ppc64 \
> 		   -M pseries -m 2048 -enable-kvm -nographic \
> 		   -drive file=/home/ywywyang/kvm/fc19.img \
> 		   -monitor telnet:localhost:5435,server,nowait -boot cd \
> 		   -device "spapr-pci-vfio-host-bridge,id=CXGB3,iommu=26,index=6"
> 
> Verify this is the exact VF response:
> 	1. ping from a machine in the same subnet(the broadcast domain)
> 	2. run arp -n on this machine
> 	   9.115.251.20             ether   00:00:c9:df:ed:bf   C eth0
> 	3. ifconfig in the guest
> 	   # ifconfig eth1
> 	   eth1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
> 	        inet 9.115.251.20  netmask 255.255.255.0  broadcast 9.115.251.255
> 		inet6 fe80::200:c9ff:fedf:edbf  prefixlen 64  scopeid 0x20<link>
> 	        ether 00:00:c9:df:ed:bf  txqueuelen 1000 (Ethernet)
> 	        RX packets 175  bytes 13278 (12.9 KiB)
> 	        RX errors 0  dropped 0  overruns 0  frame 0
> 		TX packets 58  bytes 9276 (9.0 KiB)
> 	        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
> 	4. They have the same MAC address
> 
> 	Note: make sure you shutdown other network interfaces in guest.
> 
> ---
> v6 -> v7:
>    1. add IORESOURCE_ARCH flag for IOV BAR on powernv platform.
>    2. when IOV BAR has IORESOURCE_ARCH flag, the size is retrieved from
>       hardware directly. If not, calculate as usual.
>    3. reorder the patch set, group them by subsystem:
>       PCI, powerpc, powernv
>    4. rebase it on 3.16-rc6

This doesn't apply for me on v3.16-rc6:

  02:48:57 ~/linux$ stg rebase v3.16-rc6
  Checking for changes in the working directory ... done
  Rebasing to "v3.16-rc6" ... done
  No patches applied
  02:49:14 ~/linux$ stg import -M --sign m/wy
  Checking for changes in the working directory ... done
  Importing patch "pci-iov-export-interface-for" ... done
  Importing patch "pci-iov-get-vf-bar-size-from" ... done
  Importing patch "pci-add-weak" ... done
  Importing patch "pci-take-additional-iov-bar" ... done
  Importing patch "powerpc-pci-don-t-unset-pci" ... done
  Importing patch "powerpc-pci-define" ... done
  Importing patch "powrepc-pci-refactor-pci_dn" ... done
  Importing patch "powerpc-powernv-use-pci_dn-in" ... error: patch failed:
  arch/powerpc/platforms/powernv/pci.c:376
  error: arch/powerpc/platforms/powernv/pci.c: patch does not apply
  stg import: Diff does not apply cleanly

What am I missing?

I assume you intend these all to go through my tree just to keep them all
together.  The ideal rebase target for me would be v3.17-rc1.

Given the arch/powerpc parts, I'll want an ack from Ben.  I just chatted
with him about these, so I assume that's not a problem, but we should make
it explicit.

Bjorn

^ permalink raw reply

* [PATCH] powerpc: Make 256k pages depend on PPC32=n
From: Pranith Kumar @ 2014-08-19 21:36 UTC (permalink / raw)
  To: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman,
	open list:LINUX FOR POWERPC..., open list

256k pages are not tested on PPC32. On a randconfig I got the following error:

arch/powerpc/kernel/misc_32.S:1171: Error: operand out of range (0x0000000000010000 is not between 0xffffffffffff8000 and 0x0000000000007fff)

Disable 256K pages if PPC32=y

Signed-off-by: Pranith Kumar <bobby.prani@gmail.com>
---
 arch/powerpc/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index da16ffe..6cc518f 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -556,7 +556,7 @@ config PPC_64K_PAGES
 
 config PPC_256K_PAGES
 	bool "256k page size" if 44x
-	depends on !STDBINUTILS
+	depends on !PPC32 && !STDBINUTILS
 	help
 	  Make the page size 256k.
 
-- 
1.9.1

^ permalink raw reply related

* Re: [PATCH V7 01/17] PCI/IOV: Export interface for retrieve VF's BDF
From: Bjorn Helgaas @ 2014-08-19 21:37 UTC (permalink / raw)
  To: Wei Yang; +Cc: benh, linux-pci, gwshan, qiudayu, yan, linuxppc-dev
In-Reply-To: <1406182947-11302-2-git-send-email-weiyang@linux.vnet.ibm.com>

On Thu, Jul 24, 2014 at 02:22:11PM +0800, Wei Yang wrote:
> When implementing the SR-IOV on PowerNV platform, some resource reservation is
> needed for VFs which don't exist at the bootup stage. To do the match between
> resources and VFs, the code need to get the VF's BDF in advance.

Ben started explaining this whole hardware PE/VF/etc stuff to me, but it
hasn't all sunk in yet.  We need to describe it somewhere (it sounds pretty
involved, so maybe an extended description in Documentation/ would be
appropriate).

What I'm concerned about is that PCI resource assignment is a huge mess,
and this obviously complicates it even more.  That's necessary and OK, but
I want to at least preserve the possibility that somebody could rework it
to make it manageable, and that means we need to know what the special
constraints of PowerNV are.

Code question below.

> In this patch, it exports the interface to retrieve VF's BDF:
>    * Make the virtfn_bus as an interface
>    * Make the virtfn_devfn as an interface
>    * rename them with more specific name
>    * code cleanup in pci_sriov_resource_alignment()
> 
> Signed-off-by: Wei Yang <weiyang@linux.vnet.ibm.com>
> ---
>  drivers/pci/iov.c   |   26 +++++++-------------------
>  drivers/pci/pci.h   |   19 -------------------
>  include/linux/pci.h |   44 ++++++++++++++++++++++++++++++++++++++++++++
>  3 files changed, 51 insertions(+), 38 deletions(-)
> 
> diff --git a/drivers/pci/iov.c b/drivers/pci/iov.c
> index cb6f247..7566238 100644
> --- a/drivers/pci/iov.c
> +++ b/drivers/pci/iov.c
> @@ -19,18 +19,6 @@
>  
>  #define VIRTFN_ID_LEN	16
>  
> -static inline u8 virtfn_bus(struct pci_dev *dev, int id)
> -{
> -	return dev->bus->number + ((dev->devfn + dev->sriov->offset +
> -				    dev->sriov->stride * id) >> 8);
> -}
> -
> -static inline u8 virtfn_devfn(struct pci_dev *dev, int id)
> -{
> -	return (dev->devfn + dev->sriov->offset +
> -		dev->sriov->stride * id) & 0xff;
> -}
> -
>  static struct pci_bus *virtfn_add_bus(struct pci_bus *bus, int busnr)
>  {
>  	struct pci_bus *child;
> @@ -69,7 +57,7 @@ static int virtfn_add(struct pci_dev *dev, int id, int reset)
>  	struct pci_bus *bus;
>  
>  	mutex_lock(&iov->dev->sriov->lock);
> -	bus = virtfn_add_bus(dev->bus, virtfn_bus(dev, id));
> +	bus = virtfn_add_bus(dev->bus, pci_iov_virtfn_bus(dev, id));
>  	if (!bus)
>  		goto failed;
>  
> @@ -77,7 +65,7 @@ static int virtfn_add(struct pci_dev *dev, int id, int reset)
>  	if (!virtfn)
>  		goto failed0;
>  
> -	virtfn->devfn = virtfn_devfn(dev, id);
> +	virtfn->devfn = pci_iov_virtfn_devfn(dev, id);
>  	virtfn->vendor = dev->vendor;
>  	pci_read_config_word(dev, iov->pos + PCI_SRIOV_VF_DID, &virtfn->device);
>  	pci_setup_device(virtfn);
> @@ -140,8 +128,8 @@ static void virtfn_remove(struct pci_dev *dev, int id, int reset)
>  	struct pci_sriov *iov = dev->sriov;
>  
>  	virtfn = pci_get_domain_bus_and_slot(pci_domain_nr(dev->bus),
> -					     virtfn_bus(dev, id),
> -					     virtfn_devfn(dev, id));
> +					     pci_iov_virtfn_bus(dev, id),
> +					     pci_iov_virtfn_devfn(dev, id));
>  	if (!virtfn)
>  		return;
>  
> @@ -216,7 +204,7 @@ static int sriov_enable(struct pci_dev *dev, int nr_virtfn)
>  	iov->offset = offset;
>  	iov->stride = stride;
>  
> -	if (virtfn_bus(dev, nr_virtfn - 1) > dev->bus->busn_res.end) {
> +	if (pci_iov_virtfn_bus(dev, nr_virtfn - 1) > dev->bus->busn_res.end) {
>  		dev_err(&dev->dev, "SR-IOV: bus number out of range\n");
>  		return -ENOMEM;
>  	}
> @@ -516,7 +504,7 @@ resource_size_t pci_sriov_resource_alignment(struct pci_dev *dev, int resno)
>  	if (!reg)
>  		return 0;
>  
> -	 __pci_read_base(dev, type, &tmp, reg);
> +	__pci_read_base(dev, type, &tmp, reg);
>  	return resource_alignment(&tmp);
>  }
>  
> @@ -546,7 +534,7 @@ int pci_iov_bus_range(struct pci_bus *bus)
>  	list_for_each_entry(dev, &bus->devices, bus_list) {
>  		if (!dev->is_physfn)
>  			continue;
> -		busnr = virtfn_bus(dev, dev->sriov->total_VFs - 1);
> +		busnr = pci_iov_virtfn_bus(dev, dev->sriov->total_VFs - 1);
>  		if (busnr > max)
>  			max = busnr;
>  	}
> diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
> index 0601890..a3158b2 100644
> --- a/drivers/pci/pci.h
> +++ b/drivers/pci/pci.h
> @@ -221,25 +221,6 @@ static inline int pci_ari_enabled(struct pci_bus *bus)
>  void pci_reassigndev_resource_alignment(struct pci_dev *dev);
>  void pci_disable_bridge_window(struct pci_dev *dev);
>  
> -/* Single Root I/O Virtualization */
> -struct pci_sriov {
> -	int pos;		/* capability position */
> -	int nres;		/* number of resources */
> -	u32 cap;		/* SR-IOV Capabilities */
> -	u16 ctrl;		/* SR-IOV Control */
> -	u16 total_VFs;		/* total VFs associated with the PF */
> -	u16 initial_VFs;	/* initial VFs associated with the PF */
> -	u16 num_VFs;		/* number of VFs available */
> -	u16 offset;		/* first VF Routing ID offset */
> -	u16 stride;		/* following VF stride */
> -	u32 pgsz;		/* page size for BAR alignment */
> -	u8 link;		/* Function Dependency Link */
> -	u16 driver_max_VFs;	/* max num VFs driver supports */
> -	struct pci_dev *dev;	/* lowest numbered PF */
> -	struct pci_dev *self;	/* this PF */
> -	struct mutex lock;	/* lock for VF bus */
> -};
> -
>  #ifdef CONFIG_PCI_ATS
>  void pci_restore_ats_state(struct pci_dev *dev);
>  #else
> diff --git a/include/linux/pci.h b/include/linux/pci.h
> index 466bcd1..194db52 100644
> --- a/include/linux/pci.h
> +++ b/include/linux/pci.h
> @@ -245,6 +245,27 @@ struct pci_vpd;
>  struct pci_sriov;
>  struct pci_ats;
>  
> +/* Single Root I/O Virtualization */
> +struct pci_sriov {
> +	int pos;		/* capability position */
> +	int nres;		/* number of resources */
> +	u32 cap;		/* SR-IOV Capabilities */
> +	u16 ctrl;		/* SR-IOV Control */
> +	u16 total_VFs;		/* total VFs associated with the PF */
> +	u16 initial_VFs;	/* initial VFs associated with the PF */
> +	u16 num_VFs;		/* number of VFs available */
> +	u16 offset;		/* first VF Routing ID offset */
> +	u16 stride;		/* following VF stride */
> +	u32 pgsz;		/* page size for BAR alignment */
> +	u8 link;		/* Function Dependency Link */
> +	u16 driver_max_VFs;	/* max num VFs driver supports */
> +	struct pci_dev *dev;	/* lowest numbered PF */
> +	struct pci_dev *self;	/* this PF */
> +	struct mutex lock;	/* lock for VF bus */
> +	struct work_struct mtask; /* VF Migration task */
> +	u8 __iomem *mstate;	/* VF Migration State Array */
> +};
> +
>  /*
>   * The pci_dev structure is used to describe PCI devices.
>   */
> @@ -1616,6 +1637,21 @@ int pci_ext_cfg_avail(void);
>  void __iomem *pci_ioremap_bar(struct pci_dev *pdev, int bar);
>  
>  #ifdef CONFIG_PCI_IOV
> +static inline int pci_iov_virtfn_bus(struct pci_dev *dev, int id)
> +{
> +	if (!dev->is_physfn)
> +		return -EINVAL;
> +	return dev->bus->number + ((dev->devfn + dev->sriov->offset +
> +				    dev->sriov->stride * id) >> 8);
> +}
> +static inline int pci_iov_virtfn_devfn(struct pci_dev *dev, int id)
> +{
> +	if (!dev->is_physfn)
> +		return -EINVAL;
> +	return (dev->devfn + dev->sriov->offset +
> +		dev->sriov->stride * id) & 0xff;
> +}

Do these really need to be inline?  If they weren't inline, we wouldn't
have to move struct pci_sriov to the public header file.

> +
>  int pci_enable_sriov(struct pci_dev *dev, int nr_virtfn);
>  void pci_disable_sriov(struct pci_dev *dev);
>  int pci_num_vf(struct pci_dev *dev);
> @@ -1623,6 +1659,14 @@ int pci_vfs_assigned(struct pci_dev *dev);
>  int pci_sriov_set_totalvfs(struct pci_dev *dev, u16 numvfs);
>  int pci_sriov_get_totalvfs(struct pci_dev *dev);
>  #else
> +static inline int pci_iov_virtfn_bus(struct pci_dev *dev, int id)
> +{
> +	return -ENXIO;
> +}
> +static inline int pci_iov_virtfn_devfn(struct pci_dev *dev, int id)
> +{
> +	return -ENXIO;
> +}
>  static inline int pci_enable_sriov(struct pci_dev *dev, int nr_virtfn)
>  { return -ENODEV; }
>  static inline void pci_disable_sriov(struct pci_dev *dev) { }
> -- 
> 1.7.9.5
> 

^ permalink raw reply

* Re: [PATCH V7 02/17] PCI/IOV: Get VF BAR size from hardware directly when platform needs
From: Bjorn Helgaas @ 2014-08-19 21:44 UTC (permalink / raw)
  To: Wei Yang; +Cc: benh, linux-pci, gwshan, qiudayu, yan, linuxppc-dev
In-Reply-To: <1406182947-11302-3-git-send-email-weiyang@linux.vnet.ibm.com>

On Thu, Jul 24, 2014 at 02:22:12PM +0800, Wei Yang wrote:
> Current implementation calculates VF BAR size from dividing the total size of
> IOV BAR by total VF number. It won't work on PowerNV platform because we're
> going to expand IOV BAR size for finely alignment.
> 
> The patch enforces getting IOV BAR size from hardware and then calculate
> the VF BAR size based on that when platform wants so.
> 
> Signed-off-by: Wei Yang <weiyang@linux.vnet.ibm.com>
> ---
>  drivers/pci/iov.c      |   28 ++++++++++++++++++++++++----
>  include/linux/ioport.h |    1 +
>  2 files changed, 25 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/pci/iov.c b/drivers/pci/iov.c
> index 7566238..ef1c546 100644
> --- a/drivers/pci/iov.c
> +++ b/drivers/pci/iov.c
> @@ -55,6 +55,9 @@ static int virtfn_add(struct pci_dev *dev, int id, int reset)
>  	struct resource *res;
>  	struct pci_sriov *iov = dev->sriov;
>  	struct pci_bus *bus;
> +	struct resource tmp;
> +	enum pci_bar_type type;
> +	int reg;
>  
>  	mutex_lock(&iov->dev->sriov->lock);
>  	bus = virtfn_add_bus(dev->bus, pci_iov_virtfn_bus(dev, id));
> @@ -80,12 +83,29 @@ static int virtfn_add(struct pci_dev *dev, int id, int reset)
>  			continue;
>  		virtfn->resource[i].name = pci_name(virtfn);
>  		virtfn->resource[i].flags = res->flags;
> -		size = resource_size(res);
> -		do_div(size, iov->total_VFs);
> +		/* When res has IORESOURCE_ARCH, retrieve the IOV BAR size
> +		 * from hardware directly.
> +		 */
> +		if (res->flags & IORESOURCE_ARCH) {
> +			reg = pci_iov_resource_bar(dev, i + PCI_IOV_RESOURCES, &type);
> +			__pci_read_base(dev, type, &tmp, reg);
> +			size = resource_size(&tmp);
> +			/* When __pci_read_base fails, flags is set to 0.
> +			 * In this case, reset size to 0, which means the VF
> +			 * will not be enabled.
> +			 */
> +			if (!tmp.flags)
> +				size = 0;

I don't like the IORESOURCE_ARCH flag because it really doesn't have any
specific meaning.  You're using it to enable some arch-specific code here
for this specific case.  But there are any number of other places that
could do something similar, and there's no way to coordinate them all.

I'd rather have some sort of pcibios_*() hook here where powerpc could
override the default implementation.

> +		} else {
> +			size = resource_size(res);
> +			do_div(size, iov->total_VFs);
> +		}
>  		virtfn->resource[i].start = res->start + size * id;
>  		virtfn->resource[i].end = virtfn->resource[i].start + size - 1;
> -		rc = request_resource(res, &virtfn->resource[i]);
> -		BUG_ON(rc);
> +		if (resource_size(&virtfn->resource[i])) {
> +			rc = request_resource(res, &virtfn->resource[i]);
> +			BUG_ON(rc);
> +		}
>  	}
>  
>  	if (reset)
> diff --git a/include/linux/ioport.h b/include/linux/ioport.h
> index 5e3a906..de8b57c 100644
> --- a/include/linux/ioport.h
> +++ b/include/linux/ioport.h
> @@ -48,6 +48,7 @@ struct resource {
>  #define IORESOURCE_MEM_64	0x00100000
>  #define IORESOURCE_WINDOW	0x00200000	/* forwarded by bridge */
>  #define IORESOURCE_MUXED	0x00400000	/* Resource is software muxed */
> +#define IORESOURCE_ARCH		0x00800000	/* Resource arch tagged */
>
>  #define IORESOURCE_EXCLUSIVE	0x08000000	/* Userland may not map this resource */
>  #define IORESOURCE_DISABLED	0x10000000
> -- 
> 1.7.9.5
> 

^ permalink raw reply

* [PATCH 1/6] powerpc: Move adb symbol exports next to function definitions
From: Anton Blanchard @ 2014-08-19 22:00 UTC (permalink / raw)
  To: benh, paulus, mpe; +Cc: linuxppc-dev

Signed-off-by: Anton Blanchard <anton@samba.org>
---
 arch/powerpc/kernel/ppc_ksyms.c | 7 -------
 drivers/macintosh/adb.c         | 5 +++++
 2 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/arch/powerpc/kernel/ppc_ksyms.c b/arch/powerpc/kernel/ppc_ksyms.c
index 48d17d6f..351f447 100644
--- a/arch/powerpc/kernel/ppc_ksyms.c
+++ b/arch/powerpc/kernel/ppc_ksyms.c
@@ -128,13 +128,6 @@ EXPORT_SYMBOL(smp_hw_index);
 #endif
 #endif
 
-#ifdef CONFIG_ADB
-EXPORT_SYMBOL(adb_request);
-EXPORT_SYMBOL(adb_register);
-EXPORT_SYMBOL(adb_unregister);
-EXPORT_SYMBOL(adb_poll);
-EXPORT_SYMBOL(adb_try_handler_change);
-#endif /* CONFIG_ADB */
 #ifdef CONFIG_ADB_CUDA
 EXPORT_SYMBOL(cuda_request);
 EXPORT_SYMBOL(cuda_poll);
diff --git a/drivers/macintosh/adb.c b/drivers/macintosh/adb.c
index 9e9c567..226179b 100644
--- a/drivers/macintosh/adb.c
+++ b/drivers/macintosh/adb.c
@@ -411,6 +411,7 @@ adb_poll(void)
 		return;
 	adb_controller->poll();
 }
+EXPORT_SYMBOL(adb_poll);
 
 static void adb_sync_req_done(struct adb_request *req)
 {
@@ -460,6 +461,7 @@ adb_request(struct adb_request *req, void (*done)(struct adb_request *),
 
 	return rc;
 }
+EXPORT_SYMBOL(adb_request);
 
  /* Ultimately this should return the number of devices with
     the given default id.
@@ -495,6 +497,7 @@ adb_register(int default_id, int handler_id, struct adb_ids *ids,
 	mutex_unlock(&adb_handler_mutex);
 	return ids->nids;
 }
+EXPORT_SYMBOL(adb_register);
 
 int
 adb_unregister(int index)
@@ -516,6 +519,7 @@ adb_unregister(int index)
 	mutex_unlock(&adb_handler_mutex);
 	return ret;
 }
+EXPORT_SYMBOL(adb_unregister);
 
 void
 adb_input(unsigned char *buf, int nb, int autopoll)
@@ -582,6 +586,7 @@ adb_try_handler_change(int address, int new_id)
 	mutex_unlock(&adb_handler_mutex);
 	return ret;
 }
+EXPORT_SYMBOL(adb_try_handler_change);
 
 int
 adb_get_infos(int address, int *original_address, int *handler_id)
-- 
1.9.1

^ permalink raw reply related

* [PATCH 2/6] powerpc: Move via-cuda symbol exports next to function definitions
From: Anton Blanchard @ 2014-08-19 22:00 UTC (permalink / raw)
  To: benh, paulus, mpe; +Cc: linuxppc-dev
In-Reply-To: <1408485605-10490-1-git-send-email-anton@samba.org>

Signed-off-by: Anton Blanchard <anton@samba.org>
---
 arch/powerpc/kernel/ppc_ksyms.c | 4 ----
 drivers/macintosh/via-cuda.c    | 2 ++
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/arch/powerpc/kernel/ppc_ksyms.c b/arch/powerpc/kernel/ppc_ksyms.c
index 351f447..521291d 100644
--- a/arch/powerpc/kernel/ppc_ksyms.c
+++ b/arch/powerpc/kernel/ppc_ksyms.c
@@ -128,10 +128,6 @@ EXPORT_SYMBOL(smp_hw_index);
 #endif
 #endif
 
-#ifdef CONFIG_ADB_CUDA
-EXPORT_SYMBOL(cuda_request);
-EXPORT_SYMBOL(cuda_poll);
-#endif /* CONFIG_ADB_CUDA */
 EXPORT_SYMBOL(to_tm);
 
 #ifdef CONFIG_PPC32
diff --git a/drivers/macintosh/via-cuda.c b/drivers/macintosh/via-cuda.c
index d61f271..bad1813 100644
--- a/drivers/macintosh/via-cuda.c
+++ b/drivers/macintosh/via-cuda.c
@@ -379,6 +379,7 @@ cuda_request(struct adb_request *req, void (*done)(struct adb_request *),
     req->reply_expected = 1;
     return cuda_write(req);
 }
+EXPORT_SYMBOL(cuda_request);
 
 static int
 cuda_write(struct adb_request *req)
@@ -441,6 +442,7 @@ cuda_poll(void)
     if (cuda_irq)
 	enable_irq(cuda_irq);
 }
+EXPORT_SYMBOL(cuda_poll);
 
 static irqreturn_t
 cuda_interrupt(int irq, void *arg)
-- 
1.9.1

^ permalink raw reply related

* [PATCH 3/6] powerpc: Move more symbol exports next to function definitions
From: Anton Blanchard @ 2014-08-19 22:00 UTC (permalink / raw)
  To: benh, paulus, mpe; +Cc: linuxppc-dev
In-Reply-To: <1408485605-10490-1-git-send-email-anton@samba.org>

Signed-off-by: Anton Blanchard <anton@samba.org>
---
 arch/powerpc/kernel/ppc_ksyms.c    | 14 --------------
 arch/powerpc/kernel/process.c      |  2 ++
 arch/powerpc/kernel/setup-common.c |  3 +++
 arch/powerpc/kernel/time.c         |  1 +
 arch/powerpc/mm/hash_utils_64.c    |  1 +
 5 files changed, 7 insertions(+), 14 deletions(-)

diff --git a/arch/powerpc/kernel/ppc_ksyms.c b/arch/powerpc/kernel/ppc_ksyms.c
index 521291d..4a42a1f 100644
--- a/arch/powerpc/kernel/ppc_ksyms.c
+++ b/arch/powerpc/kernel/ppc_ksyms.c
@@ -5,7 +5,6 @@
 #include <linux/elfcore.h>
 #include <linux/string.h>
 #include <linux/interrupt.h>
-#include <linux/screen_info.h>
 #include <linux/vt_kern.h>
 #include <linux/nvram.h>
 #include <linux/irq.h>
@@ -96,8 +95,6 @@ EXPORT_SYMBOL(isa_mem_base);
 EXPORT_SYMBOL(pci_dram_offset);
 #endif /* CONFIG_PCI */
 
-EXPORT_SYMBOL(start_thread);
-
 #ifdef CONFIG_PPC_FPU
 EXPORT_SYMBOL(giveup_fpu);
 EXPORT_SYMBOL(load_fp_state);
@@ -109,7 +106,6 @@ EXPORT_SYMBOL(load_vr_state);
 EXPORT_SYMBOL(store_vr_state);
 #endif /* CONFIG_ALTIVEC */
 #ifdef CONFIG_VSX
-EXPORT_SYMBOL(giveup_vsx);
 EXPORT_SYMBOL_GPL(__giveup_vsx);
 #endif /* CONFIG_VSX */
 #ifdef CONFIG_SPE
@@ -128,8 +124,6 @@ EXPORT_SYMBOL(smp_hw_index);
 #endif
 #endif
 
-EXPORT_SYMBOL(to_tm);
-
 #ifdef CONFIG_PPC32
 long long __ashrdi3(long long, int);
 long long __ashldi3(long long, int);
@@ -150,10 +144,6 @@ EXPORT_SYMBOL(memmove);
 EXPORT_SYMBOL(memcmp);
 EXPORT_SYMBOL(memchr);
 
-#if defined(CONFIG_FB_VGA16_MODULE)
-EXPORT_SYMBOL(screen_info);
-#endif
-
 #ifdef CONFIG_PPC32
 EXPORT_SYMBOL(timer_interrupt);
 EXPORT_SYMBOL(tb_ticks_per_jiffy);
@@ -189,10 +179,6 @@ EXPORT_SYMBOL(__arch_hweight32);
 EXPORT_SYMBOL(__arch_hweight64);
 #endif
 
-#ifdef CONFIG_PPC_BOOK3S_64
-EXPORT_SYMBOL_GPL(mmu_psize_defs);
-#endif
-
 #ifdef CONFIG_EPAPR_PARAVIRT
 EXPORT_SYMBOL(epapr_hypercall_start);
 #endif
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index bf44ae9..aa1df89 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -228,6 +228,7 @@ void giveup_vsx(struct task_struct *tsk)
 	giveup_altivec_maybe_transactional(tsk);
 	__giveup_vsx(tsk);
 }
+EXPORT_SYMBOL(giveup_vsx);
 
 void flush_vsx_to_thread(struct task_struct *tsk)
 {
@@ -1316,6 +1317,7 @@ void start_thread(struct pt_regs *regs, unsigned long start, unsigned long sp)
 	current->thread.tm_tfiar = 0;
 #endif /* CONFIG_PPC_TRANSACTIONAL_MEM */
 }
+EXPORT_SYMBOL(start_thread);
 
 #define PR_FP_ALL_EXCEPT (PR_FP_EXC_DIV | PR_FP_EXC_OVF | PR_FP_EXC_UND \
 		| PR_FP_EXC_RES | PR_FP_EXC_INV)
diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c
index 1b0e260..c933acd 100644
--- a/arch/powerpc/kernel/setup-common.c
+++ b/arch/powerpc/kernel/setup-common.c
@@ -94,6 +94,9 @@ struct screen_info screen_info = {
 	.orig_video_isVGA = 1,
 	.orig_video_points = 16
 };
+#if defined(CONFIG_FB_VGA16_MODULE)
+EXPORT_SYMBOL(screen_info);
+#endif
 
 /* Variables required to store legacy IO irq routing */
 int of_i8042_kbd_irq;
diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c
index 368ab37..055558b 100644
--- a/arch/powerpc/kernel/time.c
+++ b/arch/powerpc/kernel/time.c
@@ -1024,6 +1024,7 @@ void to_tm(int tim, struct rtc_time * tm)
 	 */
 	GregorianDay(tm);
 }
+EXPORT_SYMBOL(to_tm);
 
 /*
  * Divide a 128-bit dividend by a 32-bit divisor, leaving a 128 bit
diff --git a/arch/powerpc/mm/hash_utils_64.c b/arch/powerpc/mm/hash_utils_64.c
index daee7f4..bc6cc2a 100644
--- a/arch/powerpc/mm/hash_utils_64.c
+++ b/arch/powerpc/mm/hash_utils_64.c
@@ -92,6 +92,7 @@ extern unsigned long dart_tablebase;
 
 static unsigned long _SDR1;
 struct mmu_psize_def mmu_psize_defs[MMU_PAGE_COUNT];
+EXPORT_SYMBOL_GPL(mmu_psize_defs);
 
 struct hash_pte *htab_address;
 unsigned long htab_size_bytes;
-- 
1.9.1

^ permalink raw reply related

* [PATCH 4/6] powerpc: Remove unused 32bit symbol exports
From: Anton Blanchard @ 2014-08-19 22:00 UTC (permalink / raw)
  To: benh, paulus, mpe; +Cc: linuxppc-dev
In-Reply-To: <1408485605-10490-1-git-send-email-anton@samba.org>

Signed-off-by: Anton Blanchard <anton@samba.org>
---
 arch/powerpc/kernel/ppc_ksyms.c | 16 ----------------
 1 file changed, 16 deletions(-)

diff --git a/arch/powerpc/kernel/ppc_ksyms.c b/arch/powerpc/kernel/ppc_ksyms.c
index 4a42a1f..ab4f0bc 100644
--- a/arch/powerpc/kernel/ppc_ksyms.c
+++ b/arch/powerpc/kernel/ppc_ksyms.c
@@ -45,26 +45,10 @@
 #include <asm/epapr_hcalls.h>
 
 #ifdef CONFIG_PPC32
-extern void transfer_to_handler(void);
-extern void do_IRQ(struct pt_regs *regs);
-extern void machine_check_exception(struct pt_regs *regs);
-extern void alignment_exception(struct pt_regs *regs);
-extern void program_check_exception(struct pt_regs *regs);
-extern void single_step_exception(struct pt_regs *regs);
-extern int sys_sigreturn(struct pt_regs *regs);
-
 EXPORT_SYMBOL(clear_pages);
 EXPORT_SYMBOL(ISA_DMA_THRESHOLD);
 EXPORT_SYMBOL(DMA_MODE_READ);
 EXPORT_SYMBOL(DMA_MODE_WRITE);
-
-EXPORT_SYMBOL(transfer_to_handler);
-EXPORT_SYMBOL(do_IRQ);
-EXPORT_SYMBOL(machine_check_exception);
-EXPORT_SYMBOL(alignment_exception);
-EXPORT_SYMBOL(program_check_exception);
-EXPORT_SYMBOL(single_step_exception);
-EXPORT_SYMBOL(sys_sigreturn);
 #endif
 
 #ifdef CONFIG_FUNCTION_TRACER
-- 
1.9.1

^ 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