* Re: [PATCH] powerpc: thp: Use tlbiel wherever possible
From: Michael Neuling @ 2014-08-06 23:12 UTC (permalink / raw)
To: Aneesh Kumar K.V; +Cc: paulus, linuxppc-dev
In-Reply-To: <8738d965hf.fsf@linux.vnet.ibm.com>
On Wed, 2014-08-06 at 20:16 +0530, Aneesh Kumar K.V wrote:
> "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com> writes:
>=20
> > If we know that user address space has never executed on other cpus
> > we could use tlbiel.
> >
> > Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
>=20
> Now checking against flush_hash_page, I am wondering whether I need to ha=
ndle
> transcational memory in case of tlbiel ? Michael, can you let me know if
> this is needed ?
Yeah, you do need to add something. =20
local tlbie won't abort the transaction (broadcast will abort), so you
need to do a explicit tabort if there is an active transaction, to make
sure the transaction is doomed.
Mikey
^ permalink raw reply
* Re: [PATCH] powerpc: Add POWER8 features to CPU_FTRS_POSSIBLE/ALWAYS
From: Michael Neuling @ 2014-08-06 23:21 UTC (permalink / raw)
To: Michael Ellerman; +Cc: linuxppc-dev, Joel Stanley
In-Reply-To: <1407303737-29529-1-git-send-email-mpe@ellerman.id.au>
On Wed, 2014-08-06 at 15:42 +1000, Michael Ellerman wrote:
> We have been a bit slack about updating the CPU_FTRS_POSSIBLE and
> CPU_FTRS_ALWAYS masks. When we added POWER8, and also POWER8E we forgot
> to update the ALWAYS mask. And when we added POWER8_DD1 we forgot to
> update both the POSSIBLE and ALWAYS masks.
>=20
> Luckily this hasn't caused any actual bugs AFAICS. Failing to update the
> ALWAYS mask just forgoes a potential optimisation opportunity. Failing
> to update the POSSIBLE mask for POWER8_DD1 is also OK because it only
> removes a bit rather than adding any.
>=20
> Regardless they should all be in both masks so as to avoid any future
> bugs when the set of ALWAYS/POSSIBLE bits changes, or the masks
> themselves change.
>=20
> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
CCing Joel but FWIW
Acked-by: Michael Neuling <mikey@neuling.org>
> ---
> arch/powerpc/include/asm/cputable.h | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>=20
> diff --git a/arch/powerpc/include/asm/cputable.h b/arch/powerpc/include/a=
sm/cputable.h
> index af5598688daf..d696eeb2def0 100644
> --- a/arch/powerpc/include/asm/cputable.h
> +++ b/arch/powerpc/include/asm/cputable.h
> @@ -458,7 +458,8 @@ extern const char *powerpc_base_platform;
> #define CPU_FTRS_POSSIBLE \
> (CPU_FTRS_POWER4 | CPU_FTRS_PPC970 | CPU_FTRS_POWER5 | \
> CPU_FTRS_POWER6 | CPU_FTRS_POWER7 | CPU_FTRS_POWER8E | \
> - CPU_FTRS_POWER8 | CPU_FTRS_CELL | CPU_FTRS_PA6T | CPU_FTR_VSX)
> + CPU_FTRS_POWER8 | CPU_FTRS_POWER8_DD1 | CPU_FTRS_CELL | \
> + CPU_FTRS_PA6T | CPU_FTR_VSX)
> #endif
> #else
> enum {
> @@ -508,7 +509,8 @@ enum {
> #define CPU_FTRS_ALWAYS \
> (CPU_FTRS_POWER4 & CPU_FTRS_PPC970 & CPU_FTRS_POWER5 & \
> CPU_FTRS_POWER6 & CPU_FTRS_POWER7 & CPU_FTRS_CELL & \
> - CPU_FTRS_PA6T & CPU_FTRS_POSSIBLE)
> + CPU_FTRS_PA6T & CPU_FTRS_POWER8 & CPU_FTRS_POWER8E & \
> + CPU_FTRS_POWER8_DD1 & CPU_FTRS_POSSIBLE)
> #endif
> #else
> enum {
^ permalink raw reply
* Re: [3.13.y.z extended stable] Patch "locking/mutex: Disable optimistic spinning on some architectures" has been added to staging queue
From: Kamal Mostafa @ 2014-08-07 1:55 UTC (permalink / raw)
To: Davidlohr Bueso, Andev
Cc: Peter Zijlstra, Catalin Marinas, Will Deacon, James Bottomley,
sparclinux, Ingo Molnar, Russell King, James E.J. Bottomley,
Linus Torvalds, kernel-team, Paul McKenney, James Hogan,
Chris Metcalf, Mikulas Patocka, John David Anglin,
linux-arm-kernel, Jason Low, Waiman Long, Vineet Gupta, LKML,
linuxppc-dev, David Miller
In-Reply-To: <1407360614.3395.2.camel@buesod1.americas.hpqcorp.net>
> On Wed, 2014-08-06 at 17:25 -0400, Andev wrote:
> > On Wed, Aug 6, 2014 at 4:54 PM, Kamal Mostafa <kamal@canonical.com> wrote:
> > > This is a note to let you know that I have just added a patch titled
> > >
> > > locking/mutex: Disable optimistic spinning on some architectures
> > >
> > > to the linux-3.13.y-queue branch of the 3.13.y.z extended stable tree
> > > which can be found at:
> > >
> > > http://kernel.ubuntu.com/git?p=ubuntu/linux.git;a=shortlog;h=refs/heads/linux-3.13.y-queue
> > >
> > > This patch is scheduled to be released in version 3.13.11.6.
> > >
> >
> > This patch is specifically for parisc, sparc32, tile32, metag-lock1,
> > arc-!llsc and hexagon none of which Ubuntu supports.
> >
> > Why are you backporting this patch?
On Wed, 2014-08-06 at 14:30 -0700, Davidlohr Bueso wrote:
> Well 3.13.y.z isn't an Ubuntu kernel, its upstream, and those archs
> *are* supported.
Davidlohr's answer is correct: This is not an "Ubuntu kernel".
3.13.y.z is an "extended stable" kernel which follows the same rules as
the kernel.org official stable kernels. It contains no Ubuntu-specific
patches, and supports the same arch's as mainline.
More details about this and the other Canonical-funded-and-hosted
"extended stable" kernel versions is available here:
> For more information about the 3.13.y.z tree, see
> https://wiki.ubuntu.com/Kernel/Dev/ExtendedStable
-Kamal
^ permalink raw reply
* Re: [PATCH] powerpc: Add POWER8 features to CPU_FTRS_POSSIBLE/ALWAYS
From: Joel Stanley @ 2014-08-07 1:59 UTC (permalink / raw)
To: Michael Ellerman; +Cc: linuxppc-dev, Michael Neuling
In-Reply-To: <1407303737-29529-1-git-send-email-mpe@ellerman.id.au>
On Wed, Aug 6, 2014 at 3:12 PM, Michael Ellerman <mpe@ellerman.id.au> wrote:
> We have been a bit slack about updating the CPU_FTRS_POSSIBLE and
> CPU_FTRS_ALWAYS masks. When we added POWER8, and also POWER8E we forgot
> to update the ALWAYS mask. And when we added POWER8_DD1 we forgot to
> update both the POSSIBLE and ALWAYS masks.
>
> Luckily this hasn't caused any actual bugs AFAICS. Failing to update the
> ALWAYS mask just forgoes a potential optimisation opportunity. Failing
> to update the POSSIBLE mask for POWER8_DD1 is also OK because it only
> removes a bit rather than adding any.
>
> Regardless they should all be in both masks so as to avoid any future
> bugs when the set of ALWAYS/POSSIBLE bits changes, or the masks
> themselves change.
>
> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Thanks for catching that.
Acked-by: Joel Stanley <joel@jms.id.au>
^ permalink raw reply
* Re: [3.13.y.z extended stable] Patch "locking/mutex: Disable optimistic spinning on some architectures" has been added to staging queue
From: Andev @ 2014-08-07 2:00 UTC (permalink / raw)
To: Kamal Mostafa
Cc: Peter Zijlstra, Catalin Marinas, Will Deacon, James Bottomley,
Davidlohr Bueso, sparclinux, Ingo Molnar, Russell King,
James E.J. Bottomley, Linus Torvalds, kernel-team, Paul McKenney,
James Hogan, Chris Metcalf, Mikulas Patocka, John David Anglin,
linux-arm-kernel, Jason Low, Waiman Long, Vineet Gupta, LKML,
linuxppc-dev, David Miller
In-Reply-To: <1407376502.12474.64.camel@fourier>
On Wed, Aug 6, 2014 at 9:55 PM, Kamal Mostafa <kamal@canonical.com> wrote:
>
> On Wed, 2014-08-06 at 14:30 -0700, Davidlohr Bueso wrote:
>> Well 3.13.y.z isn't an Ubuntu kernel, its upstream, and those archs
>> *are* supported.
>
> Davidlohr's answer is correct: This is not an "Ubuntu kernel".
>
> 3.13.y.z is an "extended stable" kernel which follows the same rules as
> the kernel.org official stable kernels. It contains no Ubuntu-specific
> patches, and supports the same arch's as mainline.
>
> More details about this and the other Canonical-funded-and-hosted
> "extended stable" kernel versions is available here:
>
>> For more information about the 3.13.y.z tree, see
>> https://wiki.ubuntu.com/Kernel/Dev/ExtendedStable
OK, thank you for clarification. I was unsure as this is not hosted on
kernel.org, I thought it was a Ubuntu specific kernel.
So we have the following stable kernels as of now:
3.10, 3.12, 3.13, 3.14, 3.15(for a few days), 3.16!
Interesting.
--
Andev
^ permalink raw reply
* Re: [PATCH v3 4/4] drivers/vfio: Enable VFIO if EEH is not supported
From: Gavin Shan @ 2014-08-07 2:10 UTC (permalink / raw)
To: Alexey Kardashevskiy; +Cc: Alex Williamson, linuxppc-dev, Gavin Shan, kvm
In-Reply-To: <53E22827.2000204@ozlabs.ru>
On Wed, Aug 06, 2014 at 11:05:43PM +1000, Alexey Kardashevskiy wrote:
>On 08/06/2014 10:50 PM, Alex Williamson wrote:
>> On Wed, 2014-08-06 at 19:49 +1000, Gavin Shan wrote:
>>> From: Alexey Kardashevskiy <aik@ozlabs.ru>
>>>
>>> The existing vfio_pci_open() fails upon error returned from
>>> vfio_spapr_pci_eeh_open(), which breaks POWER7's P5IOC2 PHB
>>> support which this patch brings back.
>>>
>>> The patch fixes the issue by dropping the return value of
>>> vfio_spapr_pci_eeh_open().
>>>
>>> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
>>> Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
>>> ---
>>> v3: Drop return value of vfio_spapr_pci_eeh_open()
>>> ---
>>> drivers/vfio/pci/vfio_pci.c | 6 +-----
>>> drivers/vfio/vfio_spapr_eeh.c | 4 ++--
>>> include/linux/vfio.h | 5 ++---
>>> 3 files changed, 5 insertions(+), 10 deletions(-)
>>>
>>> diff --git a/drivers/vfio/pci/vfio_pci.c b/drivers/vfio/pci/vfio_pci.c
>>> index e2ee80f..32d69c8 100644
>>> --- a/drivers/vfio/pci/vfio_pci.c
>>> +++ b/drivers/vfio/pci/vfio_pci.c
>>> @@ -178,11 +178,7 @@ static int vfio_pci_open(void *device_data)
>>> if (ret)
>>> goto error;
>>>
>>> - ret = vfio_spapr_pci_eeh_open(vdev->pdev);
>>> - if (ret) {
>>> - vfio_pci_disable(vdev);
>>> - goto error;
>>> - }
>>> + vfio_spapr_pci_eeh_open(vdev->pdev);
>>> }
>>>
>>> return 0;
>>> diff --git a/drivers/vfio/vfio_spapr_eeh.c b/drivers/vfio/vfio_spapr_eeh.c
>>> index 4779cac..86dfceb 100644
>>> --- a/drivers/vfio/vfio_spapr_eeh.c
>>> +++ b/drivers/vfio/vfio_spapr_eeh.c
>>> @@ -19,9 +19,9 @@
>>> #define DRIVER_DESC "VFIO IOMMU SPAPR EEH"
>>>
>>> /* We might build address mapping here for "fast" path later */
>>> -int vfio_spapr_pci_eeh_open(struct pci_dev *pdev)
>>> +void vfio_spapr_pci_eeh_open(struct pci_dev *pdev)
>>> {
>>> - return eeh_dev_open(pdev);
>>> + eeh_dev_open(pdev);
>>
>> Wasn't there some intent to provide a warning message, that would now be
>> done here? Has that idea been dropped?
>
>
>Comrade Gavin just forgot it :)
>
>Gavin, please add it. Thanks!
>
Sure, I'll add following warning message in eeh_dev_open() in
separate patch in v4 in case nobody objects.
int eeh_dev_open(struct pci_dev *pdev)
{
:
/* No EEH device or PE ? */
edev = pci_dev_to_eeh_dev(pdev);
if (!edev || !edev->pe) {
pr_warn_once("%s: Device %s not supported\n",
__func__, pci_name(pdev));
goto out;
}
:
}
Thanks,
Gavin
>
>
>>
>>> }
>>> EXPORT_SYMBOL_GPL(vfio_spapr_pci_eeh_open);
>>>
>>> diff --git a/include/linux/vfio.h b/include/linux/vfio.h
>>> index 224128a..d320411 100644
>>> --- a/include/linux/vfio.h
>>> +++ b/include/linux/vfio.h
>>> @@ -100,15 +100,14 @@ extern long vfio_external_check_extension(struct vfio_group *group,
>>>
>>> struct pci_dev;
>>> #ifdef CONFIG_EEH
>>> -extern int vfio_spapr_pci_eeh_open(struct pci_dev *pdev);
>>> +extern void vfio_spapr_pci_eeh_open(struct pci_dev *pdev);
>>> extern void vfio_spapr_pci_eeh_release(struct pci_dev *pdev);
>>> extern long vfio_spapr_iommu_eeh_ioctl(struct iommu_group *group,
>>> unsigned int cmd,
>>> unsigned long arg);
>>> #else
>>> -static inline int vfio_spapr_pci_eeh_open(struct pci_dev *pdev)
>>> +static inline void vfio_spapr_pci_eeh_open(struct pci_dev *pdev)
>>> {
>>> - return 0;
>>> }
>>>
>>> static inline void vfio_spapr_pci_eeh_release(struct pci_dev *pdev)
>>
>>
>>
>
>
>--
>Alexey
>
^ permalink raw reply
* Re: [PATCH v3 4/4] drivers/vfio: Enable VFIO if EEH is not supported
From: Gavin Shan @ 2014-08-07 2:46 UTC (permalink / raw)
To: Gavin Shan; +Cc: Alexey Kardashevskiy, Alex Williamson, linuxppc-dev, kvm
In-Reply-To: <20140807021007.GA5230@shangw>
On Thu, Aug 07, 2014 at 12:10:07PM +1000, Gavin Shan wrote:
>On Wed, Aug 06, 2014 at 11:05:43PM +1000, Alexey Kardashevskiy wrote:
>>On 08/06/2014 10:50 PM, Alex Williamson wrote:
>>> On Wed, 2014-08-06 at 19:49 +1000, Gavin Shan wrote:
>>>> From: Alexey Kardashevskiy <aik@ozlabs.ru>
>>>>
>>>> The existing vfio_pci_open() fails upon error returned from
>>>> vfio_spapr_pci_eeh_open(), which breaks POWER7's P5IOC2 PHB
>>>> support which this patch brings back.
>>>>
>>>> The patch fixes the issue by dropping the return value of
>>>> vfio_spapr_pci_eeh_open().
>>>>
>>>> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
>>>> Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
>>>> ---
>>>> v3: Drop return value of vfio_spapr_pci_eeh_open()
>>>> ---
>>>> drivers/vfio/pci/vfio_pci.c | 6 +-----
>>>> drivers/vfio/vfio_spapr_eeh.c | 4 ++--
>>>> include/linux/vfio.h | 5 ++---
>>>> 3 files changed, 5 insertions(+), 10 deletions(-)
>>>>
>>>> diff --git a/drivers/vfio/pci/vfio_pci.c b/drivers/vfio/pci/vfio_pci.c
>>>> index e2ee80f..32d69c8 100644
>>>> --- a/drivers/vfio/pci/vfio_pci.c
>>>> +++ b/drivers/vfio/pci/vfio_pci.c
>>>> @@ -178,11 +178,7 @@ static int vfio_pci_open(void *device_data)
>>>> if (ret)
>>>> goto error;
>>>>
>>>> - ret = vfio_spapr_pci_eeh_open(vdev->pdev);
>>>> - if (ret) {
>>>> - vfio_pci_disable(vdev);
>>>> - goto error;
>>>> - }
>>>> + vfio_spapr_pci_eeh_open(vdev->pdev);
>>>> }
>>>>
>>>> return 0;
>>>> diff --git a/drivers/vfio/vfio_spapr_eeh.c b/drivers/vfio/vfio_spapr_eeh.c
>>>> index 4779cac..86dfceb 100644
>>>> --- a/drivers/vfio/vfio_spapr_eeh.c
>>>> +++ b/drivers/vfio/vfio_spapr_eeh.c
>>>> @@ -19,9 +19,9 @@
>>>> #define DRIVER_DESC "VFIO IOMMU SPAPR EEH"
>>>>
>>>> /* We might build address mapping here for "fast" path later */
>>>> -int vfio_spapr_pci_eeh_open(struct pci_dev *pdev)
>>>> +void vfio_spapr_pci_eeh_open(struct pci_dev *pdev)
>>>> {
>>>> - return eeh_dev_open(pdev);
>>>> + eeh_dev_open(pdev);
>>>
>>> Wasn't there some intent to provide a warning message, that would now be
>>> done here? Has that idea been dropped?
>>
>>
>>Comrade Gavin just forgot it :)
>>
>>Gavin, please add it. Thanks!
>>
>
>Sure, I'll add following warning message in eeh_dev_open() in
>separate patch in v4 in case nobody objects.
>
>int eeh_dev_open(struct pci_dev *pdev)
>{
> :
> /* No EEH device or PE ? */
> edev = pci_dev_to_eeh_dev(pdev);
> if (!edev || !edev->pe) {
> pr_warn_once("%s: Device %s not supported\n",
> __func__, pci_name(pdev));
> goto out;
> }
> :
>}
>
Well, I added the warning message in eeh_dev_open() and sending "v4" out.
Thanks,
Gavin
>
>>
>>
>>>
>>>> }
>>>> EXPORT_SYMBOL_GPL(vfio_spapr_pci_eeh_open);
>>>>
>>>> diff --git a/include/linux/vfio.h b/include/linux/vfio.h
>>>> index 224128a..d320411 100644
>>>> --- a/include/linux/vfio.h
>>>> +++ b/include/linux/vfio.h
>>>> @@ -100,15 +100,14 @@ extern long vfio_external_check_extension(struct vfio_group *group,
>>>>
>>>> struct pci_dev;
>>>> #ifdef CONFIG_EEH
>>>> -extern int vfio_spapr_pci_eeh_open(struct pci_dev *pdev);
>>>> +extern void vfio_spapr_pci_eeh_open(struct pci_dev *pdev);
>>>> extern void vfio_spapr_pci_eeh_release(struct pci_dev *pdev);
>>>> extern long vfio_spapr_iommu_eeh_ioctl(struct iommu_group *group,
>>>> unsigned int cmd,
>>>> unsigned long arg);
>>>> #else
>>>> -static inline int vfio_spapr_pci_eeh_open(struct pci_dev *pdev)
>>>> +static inline void vfio_spapr_pci_eeh_open(struct pci_dev *pdev)
>>>> {
>>>> - return 0;
>>>> }
>>>>
>>>> static inline void vfio_spapr_pci_eeh_release(struct pci_dev *pdev)
>>>
>>>
>>>
>>
>>
>>--
>>Alexey
>>
^ permalink raw reply
* [PATCH v4 2/5] powerpc/eeh: Add warning message in eeh_dev_open()
From: Gavin Shan @ 2014-08-07 2:47 UTC (permalink / raw)
To: linuxppc-dev; +Cc: aik, alex.williamson, Gavin Shan, kvm
In-Reply-To: <1407379640-13065-1-git-send-email-gwshan@linux.vnet.ibm.com>
The patch adds one warning message in eeh_dev_open() in case the
PCI device can't be marked as passed through.
Suggested-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
---
arch/powerpc/kernel/eeh.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/arch/powerpc/kernel/eeh.c b/arch/powerpc/kernel/eeh.c
index 59a64f8..5d73a49 100644
--- a/arch/powerpc/kernel/eeh.c
+++ b/arch/powerpc/kernel/eeh.c
@@ -1162,8 +1162,11 @@ int eeh_dev_open(struct pci_dev *pdev)
/* No EEH device or PE ? */
edev = pci_dev_to_eeh_dev(pdev);
- if (!edev || !edev->pe)
+ if (!edev || !edev->pe) {
+ pr_warn_once("%s: PCI device %s not supported\n",
+ __func__, pci_name(pdev));
goto out;
+ }
/* Increase PE's pass through count */
atomic_inc(&edev->pe->pass_dev_cnt);
--
1.8.3.2
^ permalink raw reply related
* [PATCH v4 0/5] drivers/vfio: EEH Compile and compatibility
From: Gavin Shan @ 2014-08-07 2:47 UTC (permalink / raw)
To: linuxppc-dev; +Cc: aik, alex.williamson, Gavin Shan, kvm
The patchset is mainly for fixing errors from building VFIO compoments
as dynamic modules. PATCH[4/4] allows VFIO can be used though EEH fails
to initialize for VFIO PCI devices.
Alexey Kardashevskiy (2):
drivers/vfio: Allow EEH to be built as module
drivers/vfio: Enable VFIO if EEH is not supported
Gavin Shan (3):
powerpc/eeh: Export eeh_iommu_group_to_pe()
powerpc/eeh: Add warning message in eeh_dev_open()
drivers/vfio: Fix EEH build error
arch/powerpc/kernel/eeh.c | 6 +++++-
drivers/vfio/Kconfig | 6 ++++++
drivers/vfio/Makefile | 2 +-
drivers/vfio/pci/vfio_pci.c | 6 +-----
drivers/vfio/vfio_spapr_eeh.c | 17 +++++++++++++++--
include/linux/vfio.h | 6 +++---
6 files changed, 31 insertions(+), 12 deletions(-)
--=20
1.8.3.2
^ permalink raw reply
* [PATCH v4 4/5] drivers/vfio: Allow EEH to be built as module
From: Gavin Shan @ 2014-08-07 2:47 UTC (permalink / raw)
To: linuxppc-dev; +Cc: aik, alex.williamson, Gavin Shan, kvm
In-Reply-To: <1407379640-13065-1-git-send-email-gwshan@linux.vnet.ibm.com>
From: Alexey Kardashevskiy <aik@ozlabs.ru>
This adds necessary declarations to the SPAPR VFIO EEH module,
otherwise multiple dynamic linker errors reported:
vfio_spapr_eeh: Unknown symbol eeh_pe_set_option (err 0)
vfio_spapr_eeh: Unknown symbol eeh_pe_configure (err 0)
vfio_spapr_eeh: Unknown symbol eeh_pe_reset (err 0)
vfio_spapr_eeh: Unknown symbol eeh_pe_get_state (err 0)
vfio_spapr_eeh: Unknown symbol eeh_iommu_group_to_pe (err 0)
vfio_spapr_eeh: Unknown symbol eeh_dev_open (err 0)
vfio_spapr_eeh: Unknown symbol eeh_pe_set_option (err 0)
vfio_spapr_eeh: Unknown symbol eeh_pe_configure (err 0)
vfio_spapr_eeh: Unknown symbol eeh_pe_reset (err 0)
vfio_spapr_eeh: Unknown symbol eeh_pe_get_state (err 0)
vfio_spapr_eeh: Unknown symbol eeh_iommu_group_to_pe (err 0)
vfio_spapr_eeh: Unknown symbol eeh_dev_open (err 0)
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
---
drivers/vfio/vfio_spapr_eeh.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/drivers/vfio/vfio_spapr_eeh.c b/drivers/vfio/vfio_spapr_eeh.c
index 949f98e..4779cac 100644
--- a/drivers/vfio/vfio_spapr_eeh.c
+++ b/drivers/vfio/vfio_spapr_eeh.c
@@ -9,10 +9,15 @@
* published by the Free Software Foundation.
*/
+#include <linux/module.h>
#include <linux/uaccess.h>
#include <linux/vfio.h>
#include <asm/eeh.h>
+#define DRIVER_VERSION "0.1"
+#define DRIVER_AUTHOR "Gavin Shan, IBM Corporation"
+#define DRIVER_DESC "VFIO IOMMU SPAPR EEH"
+
/* We might build address mapping here for "fast" path later */
int vfio_spapr_pci_eeh_open(struct pci_dev *pdev)
{
@@ -88,3 +93,8 @@ long vfio_spapr_iommu_eeh_ioctl(struct iommu_group *group,
return ret;
}
EXPORT_SYMBOL(vfio_spapr_iommu_eeh_ioctl);
+
+MODULE_VERSION(DRIVER_VERSION);
+MODULE_LICENSE("GPL v2");
+MODULE_AUTHOR(DRIVER_AUTHOR);
+MODULE_DESCRIPTION(DRIVER_DESC);
--
1.8.3.2
^ permalink raw reply related
* [PATCH v4 5/5] drivers/vfio: Enable VFIO if EEH is not supported
From: Gavin Shan @ 2014-08-07 2:47 UTC (permalink / raw)
To: linuxppc-dev; +Cc: aik, alex.williamson, Gavin Shan, kvm
In-Reply-To: <1407379640-13065-1-git-send-email-gwshan@linux.vnet.ibm.com>
From: Alexey Kardashevskiy <aik@ozlabs.ru>
The existing vfio_pci_open() fails upon error returned from
vfio_spapr_pci_eeh_open(), which breaks POWER7's P5IOC2 PHB
support which this patch brings back.
The patch fixes the issue by dropping the return value of
vfio_spapr_pci_eeh_open().
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
---
v3: Drop return value of vfio_spapr_pci_eeh_open()
v4: Add warning message in eeh_dev_open() in PATCH[2/5]
---
drivers/vfio/pci/vfio_pci.c | 6 +-----
drivers/vfio/vfio_spapr_eeh.c | 4 ++--
include/linux/vfio.h | 5 ++---
3 files changed, 5 insertions(+), 10 deletions(-)
diff --git a/drivers/vfio/pci/vfio_pci.c b/drivers/vfio/pci/vfio_pci.c
index e2ee80f..32d69c8 100644
--- a/drivers/vfio/pci/vfio_pci.c
+++ b/drivers/vfio/pci/vfio_pci.c
@@ -178,11 +178,7 @@ static int vfio_pci_open(void *device_data)
if (ret)
goto error;
- ret = vfio_spapr_pci_eeh_open(vdev->pdev);
- if (ret) {
- vfio_pci_disable(vdev);
- goto error;
- }
+ vfio_spapr_pci_eeh_open(vdev->pdev);
}
return 0;
diff --git a/drivers/vfio/vfio_spapr_eeh.c b/drivers/vfio/vfio_spapr_eeh.c
index 4779cac..86dfceb 100644
--- a/drivers/vfio/vfio_spapr_eeh.c
+++ b/drivers/vfio/vfio_spapr_eeh.c
@@ -19,9 +19,9 @@
#define DRIVER_DESC "VFIO IOMMU SPAPR EEH"
/* We might build address mapping here for "fast" path later */
-int vfio_spapr_pci_eeh_open(struct pci_dev *pdev)
+void vfio_spapr_pci_eeh_open(struct pci_dev *pdev)
{
- return eeh_dev_open(pdev);
+ eeh_dev_open(pdev);
}
EXPORT_SYMBOL_GPL(vfio_spapr_pci_eeh_open);
diff --git a/include/linux/vfio.h b/include/linux/vfio.h
index 224128a..d320411 100644
--- a/include/linux/vfio.h
+++ b/include/linux/vfio.h
@@ -100,15 +100,14 @@ extern long vfio_external_check_extension(struct vfio_group *group,
struct pci_dev;
#ifdef CONFIG_EEH
-extern int vfio_spapr_pci_eeh_open(struct pci_dev *pdev);
+extern void vfio_spapr_pci_eeh_open(struct pci_dev *pdev);
extern void vfio_spapr_pci_eeh_release(struct pci_dev *pdev);
extern long vfio_spapr_iommu_eeh_ioctl(struct iommu_group *group,
unsigned int cmd,
unsigned long arg);
#else
-static inline int vfio_spapr_pci_eeh_open(struct pci_dev *pdev)
+static inline void vfio_spapr_pci_eeh_open(struct pci_dev *pdev)
{
- return 0;
}
static inline void vfio_spapr_pci_eeh_release(struct pci_dev *pdev)
--
1.8.3.2
^ permalink raw reply related
* [PATCH v4 1/5] powerpc/eeh: Export eeh_iommu_group_to_pe()
From: Gavin Shan @ 2014-08-07 2:47 UTC (permalink / raw)
To: linuxppc-dev; +Cc: aik, alex.williamson, Gavin Shan, kvm
In-Reply-To: <1407379640-13065-1-git-send-email-gwshan@linux.vnet.ibm.com>
The function is used by VFIO driver, which might be built as a
dynamic module. So it should be exported.
Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
---
arch/powerpc/kernel/eeh.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/powerpc/kernel/eeh.c b/arch/powerpc/kernel/eeh.c
index 6043879..59a64f8 100644
--- a/arch/powerpc/kernel/eeh.c
+++ b/arch/powerpc/kernel/eeh.c
@@ -1254,6 +1254,7 @@ struct eeh_pe *eeh_iommu_group_to_pe(struct iommu_group *group)
return edev->pe;
}
+EXPORT_SYMBOL_GPL(eeh_iommu_group_to_pe);
#endif /* CONFIG_IOMMU_API */
--
1.8.3.2
^ permalink raw reply related
* [PATCH v4 3/5] drivers/vfio: Fix EEH build error
From: Gavin Shan @ 2014-08-07 2:47 UTC (permalink / raw)
To: linuxppc-dev; +Cc: aik, alex.williamson, Gavin Shan, kvm
In-Reply-To: <1407379640-13065-1-git-send-email-gwshan@linux.vnet.ibm.com>
The VFIO related components could be built as dynamic modules.
Unfortunately, CONFIG_EEH can't be configured to "m". The patch
fixes the build errors when configuring VFIO related components
as dynamic modules as follows:
CC [M] drivers/vfio/vfio_iommu_spapr_tce.o
In file included from drivers/vfio/vfio.c:33:0:
include/linux/vfio.h:101:43: warning: =E2=80=98struct pci_dev=E2=80=99 de=
clared \
inside parameter list [enabled by default]
:
WRAP arch/powerpc/boot/zImage.pseries
WRAP arch/powerpc/boot/zImage.maple
WRAP arch/powerpc/boot/zImage.pmac
WRAP arch/powerpc/boot/zImage.epapr
MODPOST 1818 modules
ERROR: ".vfio_spapr_iommu_eeh_ioctl" [drivers/vfio/vfio_iommu_spapr_tce.k=
o]\
undefined!
ERROR: ".vfio_spapr_pci_eeh_open" [drivers/vfio/pci/vfio-pci.ko] undefine=
d!
ERROR: ".vfio_spapr_pci_eeh_release" [drivers/vfio/pci/vfio-pci.ko] undef=
ined!
Reported-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
---
v3: Introduce CONFIG_VFIO_SPAPR_EEH and add "struct pci_dev" in vfio.h
v2: remove #include <linux/pci.h> from vfio.c
---
drivers/vfio/Kconfig | 6 ++++++
drivers/vfio/Makefile | 2 +-
drivers/vfio/vfio_spapr_eeh.c | 3 +++
include/linux/vfio.h | 1 +
4 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/drivers/vfio/Kconfig b/drivers/vfio/Kconfig
index af7b204..d8c5763 100644
--- a/drivers/vfio/Kconfig
+++ b/drivers/vfio/Kconfig
@@ -8,11 +8,17 @@ config VFIO_IOMMU_SPAPR_TCE
depends on VFIO && SPAPR_TCE_IOMMU
default n
=20
+config VFIO_SPAPR_EEH
+ tristate
+ depends on EEH && VFIO_IOMMU_SPAPR_TCE
+ default n
+
menuconfig VFIO
tristate "VFIO Non-Privileged userspace driver framework"
depends on IOMMU_API
select VFIO_IOMMU_TYPE1 if X86
select VFIO_IOMMU_SPAPR_TCE if (PPC_POWERNV || PPC_PSERIES)
+ select VFIO_SPAPR_EEH if (PPC_POWERNV || PPC_PSERIES)
select ANON_INODES
help
VFIO provides a framework for secure userspace device drivers.
diff --git a/drivers/vfio/Makefile b/drivers/vfio/Makefile
index 50e30bc..0b035b1 100644
--- a/drivers/vfio/Makefile
+++ b/drivers/vfio/Makefile
@@ -1,5 +1,5 @@
obj-$(CONFIG_VFIO) +=3D vfio.o
obj-$(CONFIG_VFIO_IOMMU_TYPE1) +=3D vfio_iommu_type1.o
obj-$(CONFIG_VFIO_IOMMU_SPAPR_TCE) +=3D vfio_iommu_spapr_tce.o
-obj-$(CONFIG_EEH) +=3D vfio_spapr_eeh.o
+obj-$(CONFIG_VFIO_SPAPR_EEH) +=3D vfio_spapr_eeh.o
obj-$(CONFIG_VFIO_PCI) +=3D pci/
diff --git a/drivers/vfio/vfio_spapr_eeh.c b/drivers/vfio/vfio_spapr_eeh.=
c
index f834b4c..949f98e 100644
--- a/drivers/vfio/vfio_spapr_eeh.c
+++ b/drivers/vfio/vfio_spapr_eeh.c
@@ -18,11 +18,13 @@ int vfio_spapr_pci_eeh_open(struct pci_dev *pdev)
{
return eeh_dev_open(pdev);
}
+EXPORT_SYMBOL_GPL(vfio_spapr_pci_eeh_open);
=20
void vfio_spapr_pci_eeh_release(struct pci_dev *pdev)
{
eeh_dev_release(pdev);
}
+EXPORT_SYMBOL_GPL(vfio_spapr_pci_eeh_release);
=20
long vfio_spapr_iommu_eeh_ioctl(struct iommu_group *group,
unsigned int cmd, unsigned long arg)
@@ -85,3 +87,4 @@ long vfio_spapr_iommu_eeh_ioctl(struct iommu_group *gro=
up,
=20
return ret;
}
+EXPORT_SYMBOL(vfio_spapr_iommu_eeh_ioctl);
diff --git a/include/linux/vfio.h b/include/linux/vfio.h
index 25a0fbd..224128a 100644
--- a/include/linux/vfio.h
+++ b/include/linux/vfio.h
@@ -98,6 +98,7 @@ extern int vfio_external_user_iommu_id(struct vfio_grou=
p *group);
extern long vfio_external_check_extension(struct vfio_group *group,
unsigned long arg);
=20
+struct pci_dev;
#ifdef CONFIG_EEH
extern int vfio_spapr_pci_eeh_open(struct pci_dev *pdev);
extern void vfio_spapr_pci_eeh_release(struct pci_dev *pdev);
--=20
1.8.3.2
^ permalink raw reply related
* [PATCH] powerpc: Fix warnings about right shift count
From: Nick Krause @ 2014-08-07 3:46 UTC (permalink / raw)
To: Benjamin Herrenschmidt, Paul Mackerras, Cédric Le Goater,
open list:LINUX FOR POWERPC..., open list
Fix warnings like the following using upper_32_bits(), discussed after mail with
someone on kernelnewbies
arch/powerpc/boot/addnote.c:183:3: warning: right shift count >= width of type
arch/powerpc/boot/addnote.c:188:3: warning: right shift count >= width of type
arch/powerpc/boot/addnote.c:206:3: warning: right shift count >= width of type
arch/powerpc/boot/addnote.c:211:3: warning: right shift count >= width of type
Signed-off-by: Nick Krause <xerofoify@gmail.com>
---
arch/powerpc/boot/addnote.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/arch/powerpc/boot/addnote.c b/arch/powerpc/boot/addnote.c
index 9d9f6f3..4611c12 100644
--- a/arch/powerpc/boot/addnote.c
+++ b/arch/powerpc/boot/addnote.c
@@ -72,7 +72,7 @@ static int e_class = ELFCLASS32;
#define PUT_16BE(off, v)(buf[off] = ((v) >> 8) & 0xff, \
buf[(off) + 1] = (v) & 0xff)
#define PUT_32BE(off, v)(PUT_16BE((off), (v) >> 16L), PUT_16BE((off) + 2, (v)))
-#define PUT_64BE(off, v)((PUT_32BE((off), (v) >> 32L), \
+#define PUT_64BE(off, v)((PUT_32BE((off), upper_32_bits(v)), \
PUT_32BE((off) + 4, (v))))
#define GET_16LE(off) ((buf[off]) + (buf[(off)+1] << 8))
@@ -82,7 +82,8 @@ static int e_class = ELFCLASS32;
#define PUT_16LE(off, v) (buf[off] = (v) & 0xff, \
buf[(off) + 1] = ((v) >> 8) & 0xff)
#define PUT_32LE(off, v) (PUT_16LE((off), (v)), PUT_16LE((off) + 2, (v) >> 16L))
-#define PUT_64LE(off, v) (PUT_32LE((off), (v)), PUT_32LE((off) + 4, (v) >> 32L))
+#define PUT_64LE(off, v) (PUT_32LE((off), (v)), PUT_32LE((off) + 4, \
+ upper_32_bits(v)))
#define GET_16(off) (e_data == ELFDATA2MSB ? GET_16BE(off) : GET_16LE(off))
#define GET_32(off) (e_data == ELFDATA2MSB ? GET_32BE(off) : GET_32LE(off))
--
2.0.1
^ permalink raw reply related
* Re: [alsa-devel] [PATCH V1 1/2] ASoC: fsl: esai: refine esai for tdm support
From: Nicolin Chen @ 2014-08-07 4:26 UTC (permalink / raw)
To: Shengjiu Wang
Cc: fabio.estevam, alsa-devel, timur, arnd, shc_work, tiwai, Li.Xiubo,
lgirdwood, perex, nicoleotsuka, broonie, linuxppc-dev,
linux-kernel
In-Reply-To: <e68d8fbaaed7000b13688b0f1757b5b9557889d7.1407320232.git.shengjiu.wang@freescale.com>
About the title, please follow the old pattern:
ASoC: fsl_esai: Refine....
You can get the history from 'git log --oneline sound/soc/fsl/fsl_esai.c'
On Wed, Aug 06, 2014 at 06:23:03PM +0800, Shengjiu Wang wrote:
> Add parameter for slots, and caculate the number of TX/RX pins and bclk with
> slots. Then driver will be compatible with slots > 2 in TDM mode.
Hmm...although I totally understand what the patch's exactly improving,
I suggest to describe more so that other people can get a quick idea
even without looking at the code, like what the original driver lacks
or what's the problem of the original design, how this patch fulfills
this feature and why some change have to be done, those change in the
header file for example.
> Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
> ---
> sound/soc/fsl/fsl_esai.c | 10 +++++++---
> sound/soc/fsl/fsl_esai.h | 8 ++++----
> 2 files changed, 11 insertions(+), 7 deletions(-)
>
> diff --git a/sound/soc/fsl/fsl_esai.c b/sound/soc/fsl/fsl_esai.c
> index 72d154e..89aa531 100644
> --- a/sound/soc/fsl/fsl_esai.c
> +++ b/sound/soc/fsl/fsl_esai.c
> @@ -56,6 +56,7 @@ struct fsl_esai {
> struct clk *fsysclk;
> u32 fifo_depth;
> u32 slot_width;
> + u32 slots;
> u32 hck_rate[2];
> u32 sck_rate[2];
> bool hck_dir[2];
Please append a description for the new member to the existing comments
above the structure define.
> @@ -363,6 +364,7 @@ static int fsl_esai_set_dai_tdm_slot(struct snd_soc_dai *dai, u32 tx_mask,
> ESAI_xSMB_xS_MASK, ESAI_xSMB_xS(rx_mask));
>
> esai_priv->slot_width = slot_width;
> + esai_priv->slots = slots;
I prefer not to add indentation here, even thought this doesn't hurt.
Just...If there's going to be a subsequent patch adding a new member
assignment whose name's longer than slot_width, the style'll be broken
as well. For example:
esai_priv->slot_width = slot_width;
esai_priv->slots = slots;
esai_priv->slot_samplebit = slots;
The indentation for the 'slots' will look abnormal.
>
> return 0;
> }
> @@ -510,10 +512,11 @@ static int fsl_esai_hw_params(struct snd_pcm_substream *substream,
> bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
> u32 width = snd_pcm_format_width(params_format(params));
> u32 channels = params_channels(params);
> + u32 pin = DIV_ROUND_UP(channels, esai_priv->slots);
This may cause a 'Division by zero' here. The 'slots' is only assigned
in set_dai_tdm_slot(). As default, a machine driver who does not call
set_dai_tdm_slot() will get a zero slot. We must give 'slots' a default
value (2 for example) somewhere during initialization.
And another personal suggestion -- using name 'pins' might be better.
Thank you Shengjiu,
Nicolin
^ permalink raw reply
* [git pull] Please pull powerpc.git next branch
From: Benjamin Herrenschmidt @ 2014-08-07 5:08 UTC (permalink / raw)
To: Linus Torvalds; +Cc: linuxppc-dev, Linux Kernel list
Hi Linus !
First an apology ... a lot of the stuff in there was only very recently
committed. This is not the normal process. I'm at fault here, my only
excuse is having been insanely swamped with other things. That's one of
the reasons for co-opting Michael as co-maintainer, to help with
avoiding that sort of trainwreck in the future.
The redeeming thing (if any) is that most of the patches were actually
reviewed on patchwork for a while, went through several iterations, and
in some cases fairly well tested in other places. Additionally the bulk
of the "new" stuff is fairly platform specific with little risk of
negatively impacting integration with other things.
There's the VFIO bit that doesn't fit in that category, but I gave Alex
the heads up already, he will probably send you some additional bits on
top of it before the end of this week.
Now for the content: This is the powerpc new goodies for 3.17. The short
story:
The biggest bit is Michael removing all of pre-POWER4 processor support
from the 64-bit kernel. POWER3 and rs64. This gets rid of a ton of old
cruft that has been bitrotting in a long while. It was broken for quite
a few versions already and nobody noticed. Nobody uses those machines
anymore. While at it, he cleaned up a bunch of old dusty cabinets,
getting rid of a skeletton or two.
Then, we have some base VFIO support for KVM, which allows assigning of
PCI devices to KVM guests, support for large 64-bit BARs on "powernv"
platforms, support for HMI (Hardware Management Interrupts) on those
same platforms, some sparse-vmemmap improvements (for memory hotplug),
There is the usual batch of Freescale embedded updates (summary in the
merge commit) and fixes here or there, I think that's it for the
highlights.
Cheers,
Ben.
The following changes since commit 6f5405bc2ee0102bb3856e2cdea64ff415db2e0c:
powerpc: use _GLOBAL_TOC for memmove (2014-07-22 15:56:04 +1000)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc.git next
for you to fetch changes up to 537e5400a0a05c4efe70e7b372c19cfcd0179362:
powerpc/eeh: Export eeh_iommu_group_to_pe() (2014-08-07 13:00:02 +1000)
----------------------------------------------------------------
Alexey Kardashevskiy (4):
powerpc/powernv: Use it_page_shift for TCE invalidation
powerpc/powernv: Use it_page_shift in TCE build
powerpc/powernv: Add a page size parameter to pnv_pci_setup_iommu_table()
powerpc/iommu: Fix comments with it_page_shift
Andrey Utkin (1):
powerpc/mm/numa: Fix break placement
Andy Fleming (1):
powerpc/e6500: Add support for hardware threads
Anton Blanchard (3):
powerpc/pseries: Use jump labels for hcall tracepoints
powerpc/pseries: Optimise hcall tracepoints
powernv: Add OPAL tracepoints
Benjamin Herrenschmidt (5):
Merge branch 'merge' into next
Merge branch 'merge' into next
Add Michael Ellerman as powerpc co-maintainer
Merge remote-tracking branch 'scott/next' into next
powerpc/eeh: Add missing #ifdef CONFIG_IOMMU_API
Bharat Bhushan (1):
booke/powerpc: define wimge shift mask to fix compilation error
Brian W Hart (1):
powerpc/powernv: Update dev->dma_mask in pci_set_dma_mask() path
Chunhe Lan (2):
t4240/dts: Enable third elo3 DMA engine support
powerpc/85xx: Add T4240RDB board support
Gavin Shan (17):
powerpc/eeh: Avoid event on passed PE
powerpc/eeh: EEH support for VFIO PCI device
drivers/vfio: EEH support for VFIO PCI device
powerpc/powernv: Fix IOMMU table for VFIO dev
powerpc/eeh: Fetch IOMMU table in reliable way
powerpc/eeh: Refactor EEH flag accessors
powerpc/eeh: Selectively enable IO for error log
powerpc/eeh: Reduce lines of log dump
powerpc/eeh: Replace pr_warning() with pr_warn()
powerpc/eeh: Make diag-data not endian dependent
powerpc/eeh: Aux PE data for error log
powerpc/powernv: Allow to freeze PE
powerpc/powernv: Split ioda_eeh_get_state()
powerpc/powernv: Handle compound PE
powerpc/powernv: Handle compound PE for EEH
powerpc/powernv: Handle compound PE in config accessors
powerpc/eeh: Export eeh_iommu_group_to_pe()
Guo Chao (1):
powerpc/powernv: Enable M64 aperatus for PHB3
Himangi Saraogi (2):
powerpc/mpic_msgr: Use kcalloc and correct the argument to sizeof
powerpc/fsl-pci: Correct use of ! and &
Laurentiu TUDOR (1):
powerpc/85xx: drop hypervisor specific board compatibles
Laurentiu Tudor (1):
powerpc/booke64: wrap tlb lock and search in htw miss with FTR_SMT
Li Zhong (4):
powerpc: implement vmemmap_list_free()
powerpc: implement vmemmap_remove_mapping() for BOOK3S
powerpc: implement vmemmap_free()
powerpc: start loop at section start of start in vmemmap_populated()
Lucas Tanure (1):
powerpc: Fix wrong defintion in boot/io.h
Madhusudanan Kandasamy (1):
powerpc: Fail remap_4k_pfn() if PFN doesn't fit inside PTE
Mahesh Salgaonkar (4):
powerpc/book3s: Add basic infrastructure to handle HMI in Linux.
powerpc/powernv: Invoke opal call to handle hmi.
powerpc/book3s: handle HMIs for cpus in nap mode.
powerpc/book3s: Fix endianess issue for HMI handling on napping cpus.
Marcelo Tosatti (1):
MAINTAINERS: Update PPC 8xx entry
Michael Ellerman (32):
powerpc/perf: Fix MMCR2 handling for EBB
powerpc: Use standard macros for sys_sigpending() & sys_old_getrlimit()
powerpc: Drop support for pre-POWER4 cpus
powerpc: Remove STAB code
powerpc: Remove MMU_FTR_SLB
powerpc: Pull out ksp_vsid logic into a helper
powerpc: Remove CONFIG_POWER3
powerpc: Remove oprofile RS64 support
powerpc: Remove power3 from comments
powerpc: Remove CONFIG_POWER4
powerpc: Remove CLASSIC_PPC
powerpc: Move bad_stack() below the fwnmi_data_area
powerpc: Update comments in irqflags.h
powerpc: Document register clobbering in EXCEPTION_COMMON()
powerpc: Remove misleading DISABLE_INTS
powerpc: Add machine_early_initcall()
powerpc/powernv: Switch powernv drivers to use machine_xxx_initcall()
powerpc/pseries: Switch pseries drivers to use machine_xxx_initcall()
powerpc: Document how we set AIL on guest kernels
selftests/powerpc: Don't ignore errors from sub Makefiles
selftests/powerpc: Fix parse_proc_maps()
selftests/powerpc: Move core_busy_loop() into asm
selftests/powerpc: Add test of L3 bank handling
selftests/powerpc: Count instructions under scheduler pressure
selftests/powerpc: Count more instructions & use decimal
selftests/powerpc: Dump MMCR2 as part of the EBB HW state
selftests/powerpc: Add cycles test with MMCR2 handling
selftests/powerpc: Add a routine for retrieving an AUXV entry
selftests/powerpc: Add test of per-event excludes
powerpc/perf: Clear all MMCR settings before calling compute_mmcr()
powerpc/perf: Pass the struct perf_events down to compute_mmcr()
powerpc/perf: Add per-event excludes on Power8
Mike Qiu (2):
powerpc/eeh: sysfs entries lost
powerpc/eeh: Wrong place to call pci_get_slot()
Paul Mackerras (1):
powerpc: Reduce scariness of interrupt frames in stack traces
Priyanka Jain (1):
powerpc/85xx: Add binding for CPLD
Scott Wood (10):
powerpc/e6500: hw tablewalk: clear TID in kernel indirect entries
powerpc/e6500: hw tablewalk: fix recursive tlb lock on cpu 0
powerpc/e500mc: Fix wrong value of MCSR_L2MMU_MHIT
MAINTAINERS: Update Linux for Freescale PowerPC
pcmcia: Remove m8xx_pcmcia driver
powerpc/8xx: Remove empty asm/mpc8xx.h
powerpc/booke: Define MSR bits the same way as reg.h
powerpc/e6500: Work around erratum A-008139
memory: Freescale CoreNet Coherency Fabric error reporting driver
powerpc/64e: Add __ref to early_alloc_pgtable()
Shengzhou Liu (4):
powerpc/defconfig: update RTC support
powerpc/fsl-booke: Add support for T2080/T2081 SoC
powerpc/fsl-booke: Add initial T208x QDS board support
powerpc/t2080rdb: Add T2080RDB board support
Thomas Falcon (1):
powerpc: Fix endianness of flash_block_list in rtas_flash
Tyrel Datwyler (1):
powerpc/pci: Reorder pci bus/bridge unregistration during PHB removal
Vaidyanathan Srinivasan (2):
powerpc/cpufreq: Add pr_warn() on OPAL firmware failures
powerpc/cpuidle: Fix parsing of idle state flags from device-tree
Valentin Longchamp (1):
powerpc/mpc85xx: fix fsl/p2041-post.dtsi clockgen mux2
Vasant Hegde (1):
powerpc/powernv: Change BUG_ON to WARN_ON in elog code
Wladislav Wiebe (1):
powerpc/traps/e500: fix misleading error output
.../devicetree/bindings/powerpc/fsl/board.txt | 16 +
Documentation/vfio.txt | 87 +-
MAINTAINERS | 4 +-
arch/powerpc/boot/dts/fsl/p2041si-post.dtsi | 1 +
arch/powerpc/boot/dts/fsl/t2080si-post.dtsi | 69 ++
arch/powerpc/boot/dts/fsl/t2081si-post.dtsi | 435 ++++++++
arch/powerpc/boot/dts/fsl/t208xsi-pre.dtsi | 99 ++
arch/powerpc/boot/dts/fsl/t4240si-post.dtsi | 1 +
arch/powerpc/boot/dts/fsl/t4240si-pre.dtsi | 1 +
arch/powerpc/boot/dts/t2080qds.dts | 57 +
arch/powerpc/boot/dts/t2080rdb.dts | 57 +
arch/powerpc/boot/dts/t2081qds.dts | 46 +
arch/powerpc/boot/dts/t208xqds.dtsi | 239 ++++
arch/powerpc/boot/dts/t208xrdb.dtsi | 184 +++
arch/powerpc/boot/dts/t4240rdb.dts | 186 ++++
arch/powerpc/boot/io.h | 2 +-
arch/powerpc/configs/corenet32_smp_defconfig | 4 +-
arch/powerpc/configs/corenet64_smp_defconfig | 5 +
arch/powerpc/configs/mpc85xx_defconfig | 3 +
arch/powerpc/configs/mpc85xx_smp_defconfig | 3 +
arch/powerpc/include/asm/cputable.h | 31 +-
arch/powerpc/include/asm/eeh.h | 62 +-
arch/powerpc/include/asm/exception-64s.h | 14 +-
arch/powerpc/include/asm/fs_pd.h | 1 -
arch/powerpc/include/asm/hardirq.h | 1 +
arch/powerpc/include/asm/hw_irq.h | 1 +
arch/powerpc/include/asm/irqflags.h | 8 +-
arch/powerpc/include/asm/jump_label.h | 9 +
arch/powerpc/include/asm/kvm_asm.h | 1 +
arch/powerpc/include/asm/machdep.h | 5 +
arch/powerpc/include/asm/mmu-hash64.h | 22 -
arch/powerpc/include/asm/mmu.h | 8 +-
arch/powerpc/include/asm/mmu_context.h | 6 +-
arch/powerpc/include/asm/mpc85xx.h | 2 +
arch/powerpc/include/asm/mpc8xx.h | 12 -
arch/powerpc/include/asm/opal.h | 194 ++--
arch/powerpc/include/asm/oprofile_impl.h | 1 -
arch/powerpc/include/asm/paca.h | 5 +-
arch/powerpc/include/asm/perf_event_server.h | 5 +-
arch/powerpc/include/asm/ppc-opcode.h | 9 +
arch/powerpc/include/asm/pte-fsl-booke.h | 2 +
arch/powerpc/include/asm/pte-hash64-64k.h | 5 +-
arch/powerpc/include/asm/reg.h | 2 +-
arch/powerpc/include/asm/reg_booke.h | 57 +-
arch/powerpc/include/asm/systbl.h | 4 +-
arch/powerpc/include/asm/trace.h | 45 +
arch/powerpc/kernel/asm-offsets.c | 2 -
arch/powerpc/kernel/cputable.c | 94 +-
arch/powerpc/kernel/eeh.c | 366 +++++-
arch/powerpc/kernel/eeh_cache.c | 9 +-
arch/powerpc/kernel/eeh_dev.c | 3 +-
arch/powerpc/kernel/eeh_driver.c | 16 +-
arch/powerpc/kernel/eeh_pe.c | 86 +-
arch/powerpc/kernel/entry_64.S | 13 +-
arch/powerpc/kernel/exceptions-64s.S | 361 +++---
arch/powerpc/kernel/head_64.S | 30 +-
arch/powerpc/kernel/idle_power7.S | 69 +-
arch/powerpc/kernel/iommu.c | 4 +-
arch/powerpc/kernel/irq.c | 14 +
arch/powerpc/kernel/process.c | 34 +-
arch/powerpc/kernel/prom.c | 11 +-
arch/powerpc/kernel/rtas_flash.c | 6 +-
arch/powerpc/kernel/setup-common.c | 6 +-
arch/powerpc/kernel/setup_64.c | 15 +-
arch/powerpc/kernel/systbl.S | 3 -
arch/powerpc/kernel/traps.c | 26 +-
arch/powerpc/kvm/book3s_hv_rmhandlers.S | 6 +
arch/powerpc/lib/copyuser_64.S | 3 +-
arch/powerpc/mm/Makefile | 4 +-
arch/powerpc/mm/hash_utils_64.c | 26 +-
arch/powerpc/mm/init_64.c | 132 ++-
arch/powerpc/mm/mmu_context_hash32.c | 2 +-
arch/powerpc/mm/numa.c | 2 +-
arch/powerpc/mm/pgtable_32.c | 2 +-
arch/powerpc/mm/pgtable_64.c | 2 +-
arch/powerpc/mm/ppc_mmu_32.c | 2 +-
arch/powerpc/mm/stab.c | 286 -----
arch/powerpc/mm/tlb_low_64e.S | 69 +-
arch/powerpc/oprofile/Makefile | 2 +-
arch/powerpc/oprofile/common.c | 3 -
arch/powerpc/oprofile/op_model_rs64.c | 222 ----
arch/powerpc/perf/core-book3s.c | 73 +-
arch/powerpc/perf/mpc7450-pmu.c | 5 +-
arch/powerpc/perf/power4-pmu.c | 2 +-
arch/powerpc/perf/power5+-pmu.c | 2 +-
arch/powerpc/perf/power5-pmu.c | 2 +-
arch/powerpc/perf/power6-pmu.c | 2 +-
arch/powerpc/perf/power7-pmu.c | 2 +-
arch/powerpc/perf/power8-pmu.c | 27 +-
arch/powerpc/perf/ppc970-pmu.c | 2 +-
arch/powerpc/platforms/85xx/Kconfig | 2 +-
arch/powerpc/platforms/85xx/corenet_generic.c | 53 +-
arch/powerpc/platforms/85xx/smp.c | 44 +
arch/powerpc/platforms/8xx/m8xx_setup.c | 3 -
arch/powerpc/platforms/8xx/mpc885ads_setup.c | 62 --
arch/powerpc/platforms/8xx/tqm8xx_setup.c | 1 -
arch/powerpc/platforms/Kconfig.cputype | 18 +-
arch/powerpc/platforms/powermac/Kconfig | 2 +-
arch/powerpc/platforms/powermac/feature.c | 42 +-
arch/powerpc/platforms/powernv/Makefile | 3 +-
arch/powerpc/platforms/powernv/eeh-ioda.c | 393 ++++---
arch/powerpc/platforms/powernv/eeh-powernv.c | 55 +-
arch/powerpc/platforms/powernv/opal-async.c | 3 +-
arch/powerpc/platforms/powernv/opal-elog.c | 4 +-
arch/powerpc/platforms/powernv/opal-hmi.c | 188 ++++
arch/powerpc/platforms/powernv/opal-lpc.c | 2 +-
.../powerpc/platforms/powernv/opal-memory-errors.c | 3 +-
arch/powerpc/platforms/powernv/opal-tracepoints.c | 84 ++
arch/powerpc/platforms/powernv/opal-wrappers.S | 117 +-
arch/powerpc/platforms/powernv/opal-xscom.c | 2 +-
arch/powerpc/platforms/powernv/opal.c | 52 +-
arch/powerpc/platforms/powernv/pci-ioda.c | 499 ++++++++-
arch/powerpc/platforms/powernv/pci-p5ioc2.c | 3 +-
arch/powerpc/platforms/powernv/pci.c | 169 ++-
arch/powerpc/platforms/powernv/pci.h | 25 +-
arch/powerpc/platforms/powernv/rng.c | 2 +-
arch/powerpc/platforms/powernv/setup.c | 2 +
arch/powerpc/platforms/pseries/dtl.c | 3 +-
arch/powerpc/platforms/pseries/eeh_pseries.c | 40 +-
arch/powerpc/platforms/pseries/hvCall.S | 172 ++-
arch/powerpc/platforms/pseries/hvCall_inst.c | 3 +-
arch/powerpc/platforms/pseries/lpar.c | 30 +-
arch/powerpc/platforms/pseries/mobility.c | 3 +-
arch/powerpc/platforms/pseries/msi.c | 4 +-
arch/powerpc/platforms/pseries/pci_dlpar.c | 4 +-
arch/powerpc/platforms/pseries/power.c | 5 +-
arch/powerpc/platforms/pseries/ras.c | 2 +-
arch/powerpc/platforms/pseries/reconfig.c | 5 +-
arch/powerpc/platforms/pseries/rng.c | 2 +-
arch/powerpc/platforms/pseries/setup.c | 2 +-
arch/powerpc/platforms/pseries/suspend.c | 5 +-
arch/powerpc/sysdev/fsl_pci.c | 4 +-
arch/powerpc/sysdev/micropatch.c | 1 -
arch/powerpc/sysdev/mpic_msgr.c | 2 +-
arch/powerpc/xmon/xmon.c | 34 +-
drivers/cpufreq/powernv-cpufreq.c | 18 +-
drivers/cpuidle/cpuidle-powernv.c | 16 +-
drivers/memory/Kconfig | 10 +
drivers/memory/Makefile | 1 +
drivers/memory/fsl-corenet-cf.c | 251 +++++
drivers/net/ethernet/freescale/fs_enet/mac-fec.c | 1 -
drivers/net/ethernet/freescale/fs_enet/mac-scc.c | 1 -
drivers/pcmcia/Kconfig | 10 -
drivers/pcmcia/Makefile | 1 -
drivers/pcmcia/m8xx_pcmcia.c | 1168 --------------------
drivers/vfio/Makefile | 1 +
drivers/vfio/pci/vfio_pci.c | 18 +-
drivers/vfio/vfio_iommu_spapr_tce.c | 17 +-
drivers/vfio/vfio_spapr_eeh.c | 87 ++
include/linux/vfio.h | 23 +
include/uapi/linux/vfio.h | 34 +
tools/testing/selftests/powerpc/Makefile | 10 +-
tools/testing/selftests/powerpc/pmu/Makefile | 19 +-
.../selftests/powerpc/pmu/count_instructions.c | 30 +-
tools/testing/selftests/powerpc/pmu/ebb/Makefile | 5 +-
.../testing/selftests/powerpc/pmu/ebb/busy_loop.S | 271 +++++
.../powerpc/pmu/ebb/cycles_with_mmcr2_test.c | 91 ++
tools/testing/selftests/powerpc/pmu/ebb/ebb.c | 261 +----
tools/testing/selftests/powerpc/pmu/ebb/ebb.h | 1 -
tools/testing/selftests/powerpc/pmu/l3_bank_test.c | 48 +
tools/testing/selftests/powerpc/pmu/lib.c | 50 +-
tools/testing/selftests/powerpc/pmu/lib.h | 1 +
.../selftests/powerpc/pmu/per_event_excludes.c | 114 ++
163 files changed, 5483 insertions(+), 3288 deletions(-)
create mode 100644 arch/powerpc/boot/dts/fsl/t2080si-post.dtsi
create mode 100644 arch/powerpc/boot/dts/fsl/t2081si-post.dtsi
create mode 100644 arch/powerpc/boot/dts/fsl/t208xsi-pre.dtsi
create mode 100644 arch/powerpc/boot/dts/t2080qds.dts
create mode 100644 arch/powerpc/boot/dts/t2080rdb.dts
create mode 100644 arch/powerpc/boot/dts/t2081qds.dts
create mode 100644 arch/powerpc/boot/dts/t208xqds.dtsi
create mode 100644 arch/powerpc/boot/dts/t208xrdb.dtsi
create mode 100644 arch/powerpc/boot/dts/t4240rdb.dts
delete mode 100644 arch/powerpc/include/asm/mpc8xx.h
delete mode 100644 arch/powerpc/mm/stab.c
delete mode 100644 arch/powerpc/oprofile/op_model_rs64.c
create mode 100644 arch/powerpc/platforms/powernv/opal-hmi.c
create mode 100644 arch/powerpc/platforms/powernv/opal-tracepoints.c
create mode 100644 drivers/memory/fsl-corenet-cf.c
delete mode 100644 drivers/pcmcia/m8xx_pcmcia.c
create mode 100644 drivers/vfio/vfio_spapr_eeh.c
create mode 100644 tools/testing/selftests/powerpc/pmu/ebb/busy_loop.S
create mode 100644 tools/testing/selftests/powerpc/pmu/ebb/cycles_with_mmcr2_test.c
create mode 100644 tools/testing/selftests/powerpc/pmu/l3_bank_test.c
create mode 100644 tools/testing/selftests/powerpc/pmu/per_event_excludes.c
^ permalink raw reply
* [PATCH 1/2] powerpc: Add smp_mb() to arch_spin_is_locked()
From: Michael Ellerman @ 2014-08-07 5:36 UTC (permalink / raw)
To: linuxppc-dev; +Cc: paulmck, Anton Blanchard
The kernel defines the function spin_is_locked(), which can be used to
check if a spinlock is currently locked.
Using spin_is_locked() on a lock you don't hold is obviously racy. That
is, even though you may observe that the lock is unlocked, it may become
locked at any time.
There is (at least) one exception to that, which is if two locks are
used as a pair, and the holder of each checks the status of the other
before doing any update.
Assuming *A and *B are two locks, and *COUNTER is a shared non-atomic
value:
The first CPU does:
spin_lock(*A)
if spin_is_locked(*B)
# nothing
else
smp_mb()
LOAD r = *COUNTER
r++
STORE *COUNTER = r
spin_unlock(*A)
And the second CPU does:
spin_lock(*B)
if spin_is_locked(*A)
# nothing
else
smp_mb()
LOAD r = *COUNTER
r++
STORE *COUNTER = r
spin_unlock(*B)
Although this is a strange locking construct, it should work.
It seems to be understood, but not documented, that spin_is_locked() is
not a memory barrier, so in the examples above and below the caller
inserts its own memory barrier before acting on the result of
spin_is_locked().
For now we assume spin_is_locked() is implemented as below, and we break
it out in our examples:
bool spin_is_locked(*LOCK) {
LOAD l = *LOCK
return l.locked
}
Our intuition is that there should be no problem even if the two code
sequences run simultaneously such as:
CPU 0 CPU 1
==================================================
spin_lock(*A) spin_lock(*B)
LOAD b = *B LOAD a = *A
if b.locked # true if a.locked # true
# nothing # nothing
spin_unlock(*A) spin_unlock(*B)
If one CPU gets the lock before the other then it will do the update and
the other CPU will back off:
CPU 0 CPU 1
==================================================
spin_lock(*A)
LOAD b = *B
spin_lock(*B)
if b.locked # false LOAD a = *A
else if a.locked # true
smp_mb() # nothing
LOAD r1 = *COUNTER spin_unlock(*B)
r1++
STORE *COUNTER = r1
spin_unlock(*A)
However in reality spin_lock() itself is not indivisible. On powerpc we
implement it as a load-and-reserve and store-conditional.
Ignoring the retry logic for the lost reservation case, it boils down to:
spin_lock(*LOCK) {
LOAD l = *LOCK
l.locked = true
STORE *LOCK = l
ACQUIRE_BARRIER
}
The ACQUIRE_BARRIER is required to give spin_lock() ACQUIRE semantics as
defined in memory-barriers.txt:
This acts as a one-way permeable barrier. It guarantees that all
memory operations after the ACQUIRE operation will appear to happen
after the ACQUIRE operation with respect to the other components of
the system.
On modern powerpc systems we use lwsync for ACQUIRE_BARRIER. lwsync is
also know as "lightweight sync", or "sync 1".
As described in Power ISA v2.07 section B.2.1.1, in this scenario the
lwsync is not the barrier itself. It instead causes the LOAD of *LOCK to
act as the barrier, preventing any loads or stores in the locked region
from occurring prior to the load of *LOCK.
Whether this behaviour is in accordance with the definition of ACQUIRE
semantics in memory-barriers.txt is open to discussion, we may switch to
a different barrier in future.
What this means in practice is that the following can occur:
CPU 0 CPU 1
==================================================
LOAD a = *A LOAD b = *B
a.locked = true b.locked = true
LOAD b = *B LOAD a = *A
STORE *A = a STORE *B = b
if b.locked # false if a.locked # false
else else
smp_mb() smp_mb()
LOAD r1 = *COUNTER LOAD r2 = *COUNTER
r1++ r2++
STORE *COUNTER = r1
STORE *COUNTER = r2 # Lost update
spin_unlock(*A) spin_unlock(*B)
That is, the load of *B can occur prior to the store that makes *A
visibly locked. And similarly for CPU 1. The result is both CPUs hold
their lock and believe the other lock is unlocked.
The easiest fix for this is to add a full memory barrier to the start of
spin_is_locked(), so adding to our previous definition would give us:
bool spin_is_locked(*LOCK) {
smp_mb()
LOAD l = *LOCK
return l.locked
}
The new barrier orders the store to the lock we are locking vs the load
of the other lock:
CPU 0 CPU 1
==================================================
LOAD a = *A LOAD b = *B
a.locked = true b.locked = true
STORE *A = a STORE *B = b
smp_mb() smp_mb()
LOAD b = *B LOAD a = *A
if b.locked # true if a.locked # true
# nothing # nothing
spin_unlock(*A) spin_unlock(*B)
Although the above example is theoretical, there is code similar to this
example in sem_lock() in ipc/sem.c. This commit in addition to the next
commit appears to be a fix for crashes we are seeing in that code where
we believe this race happens in practice.
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
---
arch/powerpc/include/asm/spinlock.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/powerpc/include/asm/spinlock.h b/arch/powerpc/include/asm/spinlock.h
index 35aa339410bd..4dbe072eecbe 100644
--- a/arch/powerpc/include/asm/spinlock.h
+++ b/arch/powerpc/include/asm/spinlock.h
@@ -61,6 +61,7 @@ static __always_inline int arch_spin_value_unlocked(arch_spinlock_t lock)
static inline int arch_spin_is_locked(arch_spinlock_t *lock)
{
+ smp_mb();
return !arch_spin_value_unlocked(*lock);
}
--
1.9.1
^ permalink raw reply related
* [PATCH 2/2] powerpc: Add smp_mb()s to arch_spin_unlock_wait()
From: Michael Ellerman @ 2014-08-07 5:36 UTC (permalink / raw)
To: linuxppc-dev; +Cc: paulmck, Anton Blanchard
In-Reply-To: <1407389778-6793-1-git-send-email-mpe@ellerman.id.au>
Similar to the previous commit which described why we need to add a
barrier to arch_spin_is_locked(), we have a similar problem with
spin_unlock_wait().
We need a barrier on entry to ensure any spinlock we have previously
taken is visibly locked prior to the load of lock->slock.
It's also not clear if spin_unlock_wait() is intended to have ACQUIRE
semantics. For now be conservative and add a barrier on exit to give it
ACQUIRE semantics.
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
---
arch/powerpc/lib/locks.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/arch/powerpc/lib/locks.c b/arch/powerpc/lib/locks.c
index 0c9c8d7d0734..170a0346f756 100644
--- a/arch/powerpc/lib/locks.c
+++ b/arch/powerpc/lib/locks.c
@@ -70,12 +70,16 @@ void __rw_yield(arch_rwlock_t *rw)
void arch_spin_unlock_wait(arch_spinlock_t *lock)
{
+ smp_mb();
+
while (lock->slock) {
HMT_low();
if (SHARED_PROCESSOR)
__spin_yield(lock);
}
HMT_medium();
+
+ smp_mb();
}
EXPORT_SYMBOL(arch_spin_unlock_wait);
--
1.9.1
^ permalink raw reply related
* Re: [PATCH] powerpc: thp: Use tlbiel wherever possible
From: Aneesh Kumar K.V @ 2014-08-07 6:04 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: Michael Neuling, paulus, linuxppc-dev
In-Reply-To: <1407357040.3073.93.camel@pasglop>
Benjamin Herrenschmidt <benh@kernel.crashing.org> writes:
> On Wed, 2014-08-06 at 20:16 +0530, Aneesh Kumar K.V wrote:
>> "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com> writes:
>>
>> > If we know that user address space has never executed on other cpus
>> > we could use tlbiel.
>> >
>> > Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
>>
>> Now checking against flush_hash_page, I am wondering whether I need to handle
>> transcational memory in case of tlbiel ? Michael, can you let me know if
>> this is needed ?
>
> Also, beware that we have code that sets "tlbiel" in the page definition
> array to 0 on all but 4k and 64k pages...
>
Ok we use base page size to determine whether we can use tlbiel or not.
static inline void tlbie(unsigned long vpn, int psize, int apsize,
int ssize, int local)
{
....
if (use_local)
use_local = mmu_psize_defs[psize].tlbiel;
With that we should be ok, because we are using 4k and 64k base page
size and we have
/*
* We don't know for sure what's up with tlbiel, so
* for now we only set it for 4K and 64K pages
*/
if (base_idx == MMU_PAGE_4K || base_idx == MMU_PAGE_64K)
def->tlbiel = 1;
else
def->tlbiel = 0;
-aneesh
^ permalink raw reply
* [PATCH] powerpc/mm: Unindent htab_dt_scan_page_sizes()
From: Michael Ellerman @ 2014-08-07 7:26 UTC (permalink / raw)
To: linuxppc-dev
We can unindent the bulk of htab_dt_scan_page_sizes() by returning early
if the property is not found. That is nice in and of itself, but also
has the advantage of making it clear that we always return success once
we have found the ibm,segment-page-sizes property.
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
---
arch/powerpc/mm/hash_utils_64.c | 121 ++++++++++++++++++++--------------------
1 file changed, 60 insertions(+), 61 deletions(-)
diff --git a/arch/powerpc/mm/hash_utils_64.c b/arch/powerpc/mm/hash_utils_64.c
index 6b7c1c824cf9..8fccc71d472f 100644
--- a/arch/powerpc/mm/hash_utils_64.c
+++ b/arch/powerpc/mm/hash_utils_64.c
@@ -333,70 +333,69 @@ static int __init htab_dt_scan_page_sizes(unsigned long node,
return 0;
prop = of_get_flat_dt_prop(node, "ibm,segment-page-sizes", &size);
- if (prop != NULL) {
- pr_info("Page sizes from device-tree:\n");
- size /= 4;
- cur_cpu_spec->mmu_features &= ~(MMU_FTR_16M_PAGE);
- while(size > 0) {
- unsigned int base_shift = be32_to_cpu(prop[0]);
- unsigned int slbenc = be32_to_cpu(prop[1]);
- unsigned int lpnum = be32_to_cpu(prop[2]);
- struct mmu_psize_def *def;
- int idx, base_idx;
-
- size -= 3; prop += 3;
- base_idx = get_idx_from_shift(base_shift);
- if (base_idx < 0) {
- /*
- * skip the pte encoding also
- */
- prop += lpnum * 2; size -= lpnum * 2;
+ if (!prop)
+ return 0;
+
+ pr_info("Page sizes from device-tree:\n");
+ size /= 4;
+ cur_cpu_spec->mmu_features &= ~(MMU_FTR_16M_PAGE);
+ while(size > 0) {
+ unsigned int base_shift = be32_to_cpu(prop[0]);
+ unsigned int slbenc = be32_to_cpu(prop[1]);
+ unsigned int lpnum = be32_to_cpu(prop[2]);
+ struct mmu_psize_def *def;
+ int idx, base_idx;
+
+ size -= 3; prop += 3;
+ base_idx = get_idx_from_shift(base_shift);
+ if (base_idx < 0) {
+ /* skip the pte encoding also */
+ prop += lpnum * 2; size -= lpnum * 2;
+ continue;
+ }
+ def = &mmu_psize_defs[base_idx];
+ if (base_idx == MMU_PAGE_16M)
+ cur_cpu_spec->mmu_features |= MMU_FTR_16M_PAGE;
+
+ def->shift = base_shift;
+ if (base_shift <= 23)
+ def->avpnm = 0;
+ else
+ def->avpnm = (1 << (base_shift - 23)) - 1;
+ def->sllp = slbenc;
+ /*
+ * We don't know for sure what's up with tlbiel, so
+ * for now we only set it for 4K and 64K pages
+ */
+ if (base_idx == MMU_PAGE_4K || base_idx == MMU_PAGE_64K)
+ def->tlbiel = 1;
+ else
+ def->tlbiel = 0;
+
+ while (size > 0 && lpnum) {
+ unsigned int shift = be32_to_cpu(prop[0]);
+ int penc = be32_to_cpu(prop[1]);
+
+ prop += 2; size -= 2;
+ lpnum--;
+
+ idx = get_idx_from_shift(shift);
+ if (idx < 0)
continue;
- }
- def = &mmu_psize_defs[base_idx];
- if (base_idx == MMU_PAGE_16M)
- cur_cpu_spec->mmu_features |= MMU_FTR_16M_PAGE;
-
- def->shift = base_shift;
- if (base_shift <= 23)
- def->avpnm = 0;
- else
- def->avpnm = (1 << (base_shift - 23)) - 1;
- def->sllp = slbenc;
- /*
- * We don't know for sure what's up with tlbiel, so
- * for now we only set it for 4K and 64K pages
- */
- if (base_idx == MMU_PAGE_4K || base_idx == MMU_PAGE_64K)
- def->tlbiel = 1;
- else
- def->tlbiel = 0;
-
- while (size > 0 && lpnum) {
- unsigned int shift = be32_to_cpu(prop[0]);
- int penc = be32_to_cpu(prop[1]);
-
- prop += 2; size -= 2;
- lpnum--;
-
- idx = get_idx_from_shift(shift);
- if (idx < 0)
- continue;
-
- if (penc == -1)
- pr_err("Invalid penc for base_shift=%d "
- "shift=%d\n", base_shift, shift);
-
- def->penc[idx] = penc;
- pr_info("base_shift=%d: shift=%d, sllp=0x%04lx,"
- " avpnm=0x%08lx, tlbiel=%d, penc=%d\n",
- base_shift, shift, def->sllp,
- def->avpnm, def->tlbiel, def->penc[idx]);
- }
+
+ if (penc == -1)
+ pr_err("Invalid penc for base_shift=%d "
+ "shift=%d\n", base_shift, shift);
+
+ def->penc[idx] = penc;
+ pr_info("base_shift=%d: shift=%d, sllp=0x%04lx,"
+ " avpnm=0x%08lx, tlbiel=%d, penc=%d\n",
+ base_shift, shift, def->sllp,
+ def->avpnm, def->tlbiel, def->penc[idx]);
}
- return 1;
}
- return 0;
+
+ return 1;
}
#ifdef CONFIG_HUGETLB_PAGE
--
1.9.1
^ permalink raw reply related
* Re: mm: BUG in unmap_page_range
From: Aneesh Kumar K.V @ 2014-08-07 8:40 UTC (permalink / raw)
To: Mel Gorman
Cc: Rik van Riel, linuxppc-dev, Peter Zijlstra, Johannes Weiner,
Hugh Dickins, LKML, Cyrill Gorcunov, linux-mm@kvack.org,
Sasha Levin, Dave Jones, Andrew Morton, Kirill A. Shutemov
In-Reply-To: <20140806102316.GX10819@suse.de>
Mel Gorman <mgorman@suse.de> writes:
> On Wed, Aug 06, 2014 at 12:44:45PM +0530, Aneesh Kumar K.V wrote:
>> > -#define pmd_mknonnuma pmd_mknonnuma
>> > -static inline pmd_t pmd_mknonnuma(pmd_t pmd)
>> > +/*
>> > + * Generic NUMA pte helpers expect pteval_t and pmdval_t types to exist
>> > + * which was inherited from x86. For the purposes of powerpc pte_basic_t is
>> > + * equivalent
>> > + */
>> > +#define pteval_t pte_basic_t
>> > +#define pmdval_t pmd_t
>> > +static inline pteval_t pte_flags(pte_t pte)
>> > {
>> > - return pte_pmd(pte_mknonnuma(pmd_pte(pmd)));
>> > + return pte_val(pte) & PAGE_PROT_BITS;
>>
>> PAGE_PROT_BITS don't get the _PAGE_NUMA and _PAGE_PRESENT. I will have
>> to check further to find out why the mask doesn't include
>> _PAGE_PRESENT.
>>
>
> Dumb of me, not sure how I managed that. For the purposes of what is required
> it doesn't matter what PAGE_PROT_BITS does. It is clearer if there is a mask
> that defines what bits are of interest to the generic helpers which is what
> this version attempts to do. It's not tested on powerpc at all
> unfortunately.
Boot tested on ppc64.
# grep numa /proc/vmstat
numa_hit 156722
numa_miss 0
numa_foreign 0
numa_interleave 6365
numa_local 153457
numa_other 3265
numa_pte_updates 169
numa_huge_pte_updates 0
numa_hint_faults 150
numa_hint_faults_local 138
numa_pages_migrated 10
>
> ---8<---
> mm: Remove misleading ARCH_USES_NUMA_PROT_NONE
>
> ARCH_USES_NUMA_PROT_NONE was defined for architectures that implemented
> _PAGE_NUMA using _PROT_NONE. This saved using an additional PTE bit and
> relied on the fact that PROT_NONE vmas were skipped by the NUMA hinting
> fault scanner. This was found to be conceptually confusing with a lot of
> implicit assumptions and it was asked that an alternative be found.
>
> Commit c46a7c81 "x86: define _PAGE_NUMA by reusing software bits on the
> PMD and PTE levels" redefined _PAGE_NUMA on x86 to be one of the swap
> PTE bits and shrunk the maximum possible swap size but it did not go far
> enough. There are no architectures that reuse _PROT_NONE as _PROT_NUMA
> but the relics still exist.
>
> This patch removes ARCH_USES_NUMA_PROT_NONE and removes some unnecessary
> duplication in powerpc vs the generic implementation by defining the types
> the core NUMA helpers expected to exist from x86 with their ppc64 equivalent.
> This necessitated that a PTE bit mask be created that identified the bits
> that distinguish present from NUMA pte entries but it is expected this
> will only differ between arches based on _PAGE_PROTNONE. The naming for
> the generic helpers was taken from x86 originally but ppc64 has types that
> are equivalent for the purposes of the helper so they are mapped instead
> of duplicating code.
>
> Signed-off-by: Mel Gorman <mgorman@suse.de>
> ---
> arch/powerpc/include/asm/pgtable.h | 57 ++++++++---------------------------
> arch/powerpc/include/asm/pte-common.h | 5 +++
> arch/x86/Kconfig | 1 -
> arch/x86/include/asm/pgtable_types.h | 7 +++++
> include/asm-generic/pgtable.h | 27 ++++++-----------
> init/Kconfig | 11 -------
> 6 files changed, 33 insertions(+), 75 deletions(-)
>
> diff --git a/arch/powerpc/include/asm/pgtable.h b/arch/powerpc/include/asm/pgtable.h
> index d98c1ec..beeb09e 100644
> --- a/arch/powerpc/include/asm/pgtable.h
> +++ b/arch/powerpc/include/asm/pgtable.h
> @@ -38,10 +38,9 @@ static inline int pte_none(pte_t pte) { return (pte_val(pte) & ~_PTE_NONE_MASK)
> static inline pgprot_t pte_pgprot(pte_t pte) { return __pgprot(pte_val(pte) & PAGE_PROT_BITS); }
>
> #ifdef CONFIG_NUMA_BALANCING
> -
> static inline int pte_present(pte_t pte)
> {
> - return pte_val(pte) & (_PAGE_PRESENT | _PAGE_NUMA);
> + return pte_val(pte) & _PAGE_NUMA_MASK;
> }
>
> #define pte_present_nonuma pte_present_nonuma
> @@ -50,37 +49,6 @@ static inline int pte_present_nonuma(pte_t pte)
> return pte_val(pte) & (_PAGE_PRESENT);
> }
>
> -#define pte_numa pte_numa
> -static inline int pte_numa(pte_t pte)
> -{
> - return (pte_val(pte) &
> - (_PAGE_NUMA|_PAGE_PRESENT)) == _PAGE_NUMA;
> -}
> -
> -#define pte_mknonnuma pte_mknonnuma
> -static inline pte_t pte_mknonnuma(pte_t pte)
> -{
> - pte_val(pte) &= ~_PAGE_NUMA;
> - pte_val(pte) |= _PAGE_PRESENT | _PAGE_ACCESSED;
> - return pte;
> -}
> -
> -#define pte_mknuma pte_mknuma
> -static inline pte_t pte_mknuma(pte_t pte)
> -{
> - /*
> - * We should not set _PAGE_NUMA on non present ptes. Also clear the
> - * present bit so that hash_page will return 1 and we collect this
> - * as numa fault.
> - */
> - if (pte_present(pte)) {
> - pte_val(pte) |= _PAGE_NUMA;
> - pte_val(pte) &= ~_PAGE_PRESENT;
> - } else
> - VM_BUG_ON(1);
> - return pte;
> -}
> -
> #define ptep_set_numa ptep_set_numa
> static inline void ptep_set_numa(struct mm_struct *mm, unsigned long addr,
> pte_t *ptep)
> @@ -92,12 +60,6 @@ static inline void ptep_set_numa(struct mm_struct *mm, unsigned long addr,
> return;
> }
>
> -#define pmd_numa pmd_numa
> -static inline int pmd_numa(pmd_t pmd)
> -{
> - return pte_numa(pmd_pte(pmd));
> -}
> -
> #define pmdp_set_numa pmdp_set_numa
> static inline void pmdp_set_numa(struct mm_struct *mm, unsigned long addr,
> pmd_t *pmdp)
> @@ -109,16 +71,21 @@ static inline void pmdp_set_numa(struct mm_struct *mm, unsigned long addr,
> return;
> }
>
> -#define pmd_mknonnuma pmd_mknonnuma
> -static inline pmd_t pmd_mknonnuma(pmd_t pmd)
> +/*
> + * Generic NUMA pte helpers expect pteval_t and pmdval_t types to exist
> + * which was inherited from x86. For the purposes of powerpc pte_basic_t and
> + * pmd_t are equivalent
> + */
> +#define pteval_t pte_basic_t
> +#define pmdval_t pmd_t
> +static inline pteval_t ptenuma_flags(pte_t pte)
> {
> - return pte_pmd(pte_mknonnuma(pmd_pte(pmd)));
> + return pte_val(pte) & _PAGE_NUMA_MASK;
> }
>
> -#define pmd_mknuma pmd_mknuma
> -static inline pmd_t pmd_mknuma(pmd_t pmd)
> +static inline pmdval_t pmdnuma_flags(pte_t pte)
> {
> - return pte_pmd(pte_mknuma(pmd_pte(pmd)));
> + return pmd_val(pte) & _PAGE_NUMA_MASK;
> }
>
> # else
....
> --- a/include/asm-generic/pgtable.h
> +++ b/include/asm-generic/pgtable.h
> @@ -660,11 +660,12 @@ static inline int pmd_trans_unstable(pmd_t *pmd)
> }
>
> #ifdef CONFIG_NUMA_BALANCING
> -#ifdef CONFIG_ARCH_USES_NUMA_PROT_NONE
> /*
> - * _PAGE_NUMA works identical to _PAGE_PROTNONE (it's actually the
> - * same bit too). It's set only when _PAGE_PRESET is not set and it's
> - * never set if _PAGE_PRESENT is set.
> + * _PAGE_NUMA distinguishes between an unmapped page table entry, an entry that
> + * is protected for PROT_NONE and a NUMA hinting fault entry. If the
> + * architecture defines __PAGE_PROTNONE then it should take that into account
> + * but those that do not can rely on the fact that the NUMA hinting scanner
> + * skips inaccessible VMAs.
> *
> * pte/pmd_present() returns true if pte/pmd_numa returns true. Page
> * fault triggers on those regions if pte/pmd_numa returns true
> @@ -673,16 +674,14 @@ static inline int pmd_trans_unstable(pmd_t *pmd)
> #ifndef pte_numa
> static inline int pte_numa(pte_t pte)
> {
> - return (pte_flags(pte) &
> - (_PAGE_NUMA|_PAGE_PROTNONE|_PAGE_PRESENT)) == _PAGE_NUMA;
> + return (ptenuma_flags(pte) & _PAGE_NUMA_MASK) == _PAGE_NUMA;
> }
Can we avoid & _PAGE_NUMA_MASK ?. I understand that you need that for
x86 because you have
#define ptenuma_flags pte_flags
But on ppc64 you already have
static inline pteval_t ptenuma_flags(pte_t pte)
{
return pte_val(pte) & _PAGE_NUMA_MASK;
}
-aneesh
^ permalink raw reply
* RE: qe: move qe from arch/powerpc to drivers
From: qiang.zhao @ 2014-08-07 9:15 UTC (permalink / raw)
To: Scott Wood; +Cc: linuxppc-dev@lists.ozlabs.org, Xiaobo Xie
In-Reply-To: <1407356142.7427.41.camel@snotra.buserror.net>
T24gVGh1LCBBdWcgNywgMjAxNCBhdCA0OjE2IEFNLCBXb29kIFNjb3R0IHdyb3RlOg0KDQoNCj4g
LS0tLS1PcmlnaW5hbCBNZXNzYWdlLS0tLS0NCj4gRnJvbTogV29vZCBTY290dC1CMDc0MjENCj4g
U2VudDogVGh1cnNkYXksIEF1Z3VzdCAwNywgMjAxNCA0OjE2IEFNDQo+IFRvOiBaaGFvIFFpYW5n
LUI0NTQ3NQ0KPiBDYzogbGludXhwcGMtZGV2QGxpc3RzLm96bGFicy5vcmc7IFhpZSBYaWFvYm8t
UjYzMDYxDQo+IFN1YmplY3Q6IFJlOiBxZTogbW92ZSBxZSBmcm9tIGFyY2gvcG93ZXJwYyB0byBk
cml2ZXJzDQo+IA0KPiBPbiBXZWQsIDIwMTQtMDgtMDYgYXQgMDM6NTMgLTA1MDAsIFpoYW8gUWlh
bmctQjQ1NDc1IHdyb3RlOg0KPiA+IE9uIFdlZCwgSnVsIDMwLCAyMDE0IGF0IDA4OjE5IEFNLCBX
b29kIFNjb3R0IHdyb3RlOg0KPiA+DQo+ID4NCj4gPiA+IC0tLS0tT3JpZ2luYWwgTWVzc2FnZS0t
LS0tDQo+ID4gPiBGcm9tOiBXb29kIFNjb3R0LUIwNzQyMQ0KPiA+ID4gU2VudDogV2VkbmVzZGF5
LCBKdWx5IDMwLCAyMDE0IDg6MTkgQU0NCj4gPiA+IFRvOiBaaGFvIFFpYW5nLUI0NTQ3NQ0KPiA+
ID4gQ2M6IGxpbnV4cHBjLWRldkBsaXN0cy5vemxhYnMub3JnOyBXb29kIFNjb3R0LUIwNzQyMTsg
WGllDQo+ID4gPiBYaWFvYm8tUjYzMDYxDQo+ID4gPiBTdWJqZWN0OiBSZTogcWU6IG1vdmUgcWUg
ZnJvbSBhcmNoL3Bvd2VycGMgdG8gZHJpdmVycw0KPiA+ID4NCj4gPiA+IE9uIFR1ZSwgSnVuIDI0
LCAyMDE0IGF0IDExOjMxOjUyQU0gKzA4MDAsIFpoYW8gUWlhbmcgd3JvdGU6DQo+ID4gPiA+IGxz
MSBoYXMgcWUgYW5kIGxzMSBoYXMgYXJtIGNwdS4NCj4gPiA+ID4gbW92ZSBxZSBmcm9tIGFyY2gv
cG93ZXJwYyB0byBkcml2ZXJzLg0KPiA+ID4gPg0KPiA+ID4gPiBTaWduZWQtb2ZmLWJ5OiBaaGFv
IFFpYW5nIDxCNDU0NzVAZnJlZXNjYWxlLmNvbT4NCj4gPiA+DQo+ID4gPiBUaGlzIGlzIGEgdmVy
eSB0ZXJzZSBjaGFuZ2Vsb2cuICBFeHBsYWluIG1vcmUgYWJvdXQgd2hhdCBRRSBpcywgYW5kDQo+
ID4gPiB3aGF0IHRoaXMgcGF0Y2ggYWNjb21wbGlzaGVzIChpdCBkb2Vzbid0IHNlZW0gdG8gZ2V0
IHJpZCBvZiB0aGUgUFBDDQo+ID4gPiBkZXBlbmRlbmN5LCBqdXN0IG1vdmluZyBjb2RlIGF0IHRo
aXMgc3RhZ2UpDQo+ID4gPg0KPiA+ID4gSSBkb24ndCBzZWUgYSBNQUlOVEFJTkVSUyB1cGRhdGUg
Zm9yIHRoZSBuZXcgcGF0aC4gIFdobyBpcyBnb2luZyB0bw0KPiA+ID4gbWFpbnRhaW4gaXQ/DQo+
ID4gPg0KPiA+ID4gSSBkb24ndCB0aGluayBkcml2ZXJzL3FlIGlzIHRoZSByaWdodCBwbGFjZSBm
b3IgaXQuICBEaXJlY3Rvcmllcw0KPiA+ID4gZGlyZWN0bHkgdW5kZXIgZHJpdmVycy8gdGVuZCB0
byBiZSBmb3IgY2xhc3NlcyBvZiBkZXZpY2VzLCBub3QNCj4gPiA+IGluc3RhbmNlcy4gIEluIGFu
eSBjYXNlLCBMS01MIHNob3VsZCBiZSBDQ2VkIHdoZW4gY3JlYXRpbmcgYSBuZXcNCj4gPiA+IGRp
cmVjdG9yeSBkaXJlY3RseSB1bmRlciBkcml2ZXJzLyBvciB1bmRlciBhIHN1YmRpcmVjdG9yeSBv
Zg0KPiA+ID4gZHJpdmVycy8gdGhhdCBkb2Vzbid0IGhhdmUgaXRzIG93biBtYWlsaW5nIGxpc3Qu
DQo+ID4NCj4gPiBTbyB3aGljaCBkaXJlY3RvcnkgZG8geW91IHJlY29tbWVuZD8NCj4gDQo+IGRy
aXZlcnMvc29jLw0KPiANCj4gPiBBY3R1YWxseSBxZSBpcyBhIGtpbmQgb2YgSVAgYmxvY2ssIHNv
IGluIG15IG9waW5pb24sIGl0IGlzIHByb3BlciB0bw0KPiBwdXQgaXQgdW5kZXIgZHJpdmVyLyhq
dXN0IGluIG15IG9waW5pb24pLg0KPiANCj4gTm8sIGl0IGlzbid0IGEgdHlwZSBvZiBkZXZpY2Ug
KGUuZy4gImV0aGVybmV0IiBvciAidHR5IikuICBJdCdzIGFuDQo+IGFiYnJldmlhdGlvbiBvZiBh
IHRyYWRlbWFyayBmb3IgYSBzcGVjaWZpYyBtdWx0aXB1cnBvc2UgSS9PIGFyY2hpdGVjdHVyZS4N
Cg0KU28gd2hpY2ggZGlyZWN0b3J5IGRvIHlvdSByZWNvbW1lbmTvvJ8NCg0KPiANCj4gLVNjb3R0
DQo+IA0KUmVnYXJkcywNClpoYW8gUWlhbmcNCg==
^ permalink raw reply
* [PATCH V2 0/2] refine esai for tdm support
From: Shengjiu Wang @ 2014-08-07 9:33 UTC (permalink / raw)
To: broonie, lgirdwood, timur, perex, tiwai, nicoleotsuka, Li.Xiubo,
shc_work, fabio.estevam, arnd
Cc: alsa-devel, linuxppc-dev, linux-kernel
These patchs is to refine esai for tdm support.
Changes for V2
- update the comments according the reviewer's suggestion
- add init value for slots and change pin to pins.
Shengjiu Wang (2):
ASoC: fsl_esai: refine esai for TDM support
Revert "ASoC: fsl-esai: Add .xlate_tdm_slot_mask() support."
sound/soc/fsl/Kconfig | 1 -
sound/soc/fsl/fsl_esai.c | 16 +++++++++++-----
sound/soc/fsl/fsl_esai.h | 8 ++++----
3 files changed, 15 insertions(+), 10 deletions(-)
--
1.7.9.5
^ permalink raw reply
* [PATCH V2 1/2] ASoC: fsl_esai: refine esai for TDM support
From: Shengjiu Wang @ 2014-08-07 9:33 UTC (permalink / raw)
To: broonie, lgirdwood, timur, perex, tiwai, nicoleotsuka, Li.Xiubo,
shc_work, fabio.estevam, arnd
Cc: alsa-devel, linuxppc-dev, linux-kernel
In-Reply-To: <cover.1407403727.git.shengjiu.wang@freescale.com>
Original driver didn't store the number of slots, just fix the slot number
to 2, use this default number to calculate bclk and pins for TX/RX.
In this patch, add one parameter for slots, and update the calculation of
bclk and pins of TX/RX. Then driver will be compatible with slots > 2 in
TDM mode.
Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
---
sound/soc/fsl/fsl_esai.c | 14 +++++++++++---
sound/soc/fsl/fsl_esai.h | 8 ++++----
2 files changed, 15 insertions(+), 7 deletions(-)
diff --git a/sound/soc/fsl/fsl_esai.c b/sound/soc/fsl/fsl_esai.c
index 72d154e..f252370 100644
--- a/sound/soc/fsl/fsl_esai.c
+++ b/sound/soc/fsl/fsl_esai.c
@@ -38,6 +38,7 @@
* @fsysclk: system clock source to derive HCK, SCK and FS
* @fifo_depth: depth of tx/rx FIFO
* @slot_width: width of each DAI slot
+ * @slots: number of slots
* @hck_rate: clock rate of desired HCKx clock
* @sck_rate: clock rate of desired SCKx clock
* @hck_dir: the direction of HCKx pads
@@ -56,6 +57,7 @@ struct fsl_esai {
struct clk *fsysclk;
u32 fifo_depth;
u32 slot_width;
+ u32 slots;
u32 hck_rate[2];
u32 sck_rate[2];
bool hck_dir[2];
@@ -363,6 +365,7 @@ static int fsl_esai_set_dai_tdm_slot(struct snd_soc_dai *dai, u32 tx_mask,
ESAI_xSMB_xS_MASK, ESAI_xSMB_xS(rx_mask));
esai_priv->slot_width = slot_width;
+ esai_priv->slots = slots;
return 0;
}
@@ -510,10 +513,11 @@ static int fsl_esai_hw_params(struct snd_pcm_substream *substream,
bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
u32 width = snd_pcm_format_width(params_format(params));
u32 channels = params_channels(params);
+ u32 pins = DIV_ROUND_UP(channels, esai_priv->slots);
u32 bclk, mask, val;
int ret;
- bclk = params_rate(params) * esai_priv->slot_width * 2;
+ bclk = params_rate(params) * esai_priv->slot_width * esai_priv->slots;
ret = fsl_esai_set_bclk(dai, tx, bclk);
if (ret)
@@ -530,7 +534,7 @@ static int fsl_esai_hw_params(struct snd_pcm_substream *substream,
mask = ESAI_xFCR_xFR_MASK | ESAI_xFCR_xWA_MASK | ESAI_xFCR_xFWM_MASK |
(tx ? ESAI_xFCR_TE_MASK | ESAI_xFCR_TIEN : ESAI_xFCR_RE_MASK);
val = ESAI_xFCR_xWA(width) | ESAI_xFCR_xFWM(esai_priv->fifo_depth) |
- (tx ? ESAI_xFCR_TE(channels) | ESAI_xFCR_TIEN : ESAI_xFCR_RE(channels));
+ (tx ? ESAI_xFCR_TE(pins) | ESAI_xFCR_TIEN : ESAI_xFCR_RE(pins));
regmap_update_bits(esai_priv->regmap, REG_ESAI_xFCR(tx), mask, val);
@@ -565,6 +569,7 @@ static int fsl_esai_trigger(struct snd_pcm_substream *substream, int cmd,
struct fsl_esai *esai_priv = snd_soc_dai_get_drvdata(dai);
bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
u8 i, channels = substream->runtime->channels;
+ u32 pins = DIV_ROUND_UP(channels, esai_priv->slots);
switch (cmd) {
case SNDRV_PCM_TRIGGER_START:
@@ -579,7 +584,7 @@ static int fsl_esai_trigger(struct snd_pcm_substream *substream, int cmd,
regmap_update_bits(esai_priv->regmap, REG_ESAI_xCR(tx),
tx ? ESAI_xCR_TE_MASK : ESAI_xCR_RE_MASK,
- tx ? ESAI_xCR_TE(channels) : ESAI_xCR_RE(channels));
+ tx ? ESAI_xCR_TE(pins) : ESAI_xCR_RE(pins));
break;
case SNDRV_PCM_TRIGGER_SUSPEND:
case SNDRV_PCM_TRIGGER_STOP:
@@ -783,6 +788,9 @@ static int fsl_esai_probe(struct platform_device *pdev)
/* Set a default slot size */
esai_priv->slot_width = 32;
+ /* Set a default slot number */
+ esai_priv->slots = 2;
+
/* Set a default master/slave state */
esai_priv->slave_mode = true;
diff --git a/sound/soc/fsl/fsl_esai.h b/sound/soc/fsl/fsl_esai.h
index 75e1403..91a550f 100644
--- a/sound/soc/fsl/fsl_esai.h
+++ b/sound/soc/fsl/fsl_esai.h
@@ -130,8 +130,8 @@
#define ESAI_xFCR_RE_WIDTH 4
#define ESAI_xFCR_TE_MASK (((1 << ESAI_xFCR_TE_WIDTH) - 1) << ESAI_xFCR_xE_SHIFT)
#define ESAI_xFCR_RE_MASK (((1 << ESAI_xFCR_RE_WIDTH) - 1) << ESAI_xFCR_xE_SHIFT)
-#define ESAI_xFCR_TE(x) ((ESAI_xFCR_TE_MASK >> (ESAI_xFCR_TE_WIDTH - ((x + 1) >> 1))) & ESAI_xFCR_TE_MASK)
-#define ESAI_xFCR_RE(x) ((ESAI_xFCR_RE_MASK >> (ESAI_xFCR_RE_WIDTH - ((x + 1) >> 1))) & ESAI_xFCR_RE_MASK)
+#define ESAI_xFCR_TE(x) ((ESAI_xFCR_TE_MASK >> (ESAI_xFCR_TE_WIDTH - x)) & ESAI_xFCR_TE_MASK)
+#define ESAI_xFCR_RE(x) ((ESAI_xFCR_RE_MASK >> (ESAI_xFCR_RE_WIDTH - x)) & ESAI_xFCR_RE_MASK)
#define ESAI_xFCR_xFR_SHIFT 1
#define ESAI_xFCR_xFR_MASK (1 << ESAI_xFCR_xFR_SHIFT)
#define ESAI_xFCR_xFR (1 << ESAI_xFCR_xFR_SHIFT)
@@ -272,8 +272,8 @@
#define ESAI_xCR_RE_WIDTH 4
#define ESAI_xCR_TE_MASK (((1 << ESAI_xCR_TE_WIDTH) - 1) << ESAI_xCR_xE_SHIFT)
#define ESAI_xCR_RE_MASK (((1 << ESAI_xCR_RE_WIDTH) - 1) << ESAI_xCR_xE_SHIFT)
-#define ESAI_xCR_TE(x) ((ESAI_xCR_TE_MASK >> (ESAI_xCR_TE_WIDTH - ((x + 1) >> 1))) & ESAI_xCR_TE_MASK)
-#define ESAI_xCR_RE(x) ((ESAI_xCR_RE_MASK >> (ESAI_xCR_RE_WIDTH - ((x + 1) >> 1))) & ESAI_xCR_RE_MASK)
+#define ESAI_xCR_TE(x) ((ESAI_xCR_TE_MASK >> (ESAI_xCR_TE_WIDTH - x)) & ESAI_xCR_TE_MASK)
+#define ESAI_xCR_RE(x) ((ESAI_xCR_RE_MASK >> (ESAI_xCR_RE_WIDTH - x)) & ESAI_xCR_RE_MASK)
/*
* Transmit Clock Control Register -- REG_ESAI_TCCR 0xD8
--
1.7.9.5
^ permalink raw reply related
* [PATCH V2 2/2] Revert "ASoC: fsl-esai: Add .xlate_tdm_slot_mask() support."
From: Shengjiu Wang @ 2014-08-07 9:33 UTC (permalink / raw)
To: broonie, lgirdwood, timur, perex, tiwai, nicoleotsuka, Li.Xiubo,
shc_work, fabio.estevam, arnd
Cc: alsa-devel, linuxppc-dev, linux-kernel
In-Reply-To: <cover.1407403727.git.shengjiu.wang@freescale.com>
This reverts commit a603c8ee526f5ea9ad9b40710308766299ad8a69.
fsl_asoc_xlate_tdm_slot_mask() will invert the mask, which isn't fit for
esai. The default function snd_soc_xlate_tdm_slot_mask() is ok for esai.
Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
---
sound/soc/fsl/Kconfig | 1 -
sound/soc/fsl/fsl_esai.c | 2 --
2 files changed, 3 deletions(-)
diff --git a/sound/soc/fsl/Kconfig b/sound/soc/fsl/Kconfig
index f54a8fc..f3012b6 100644
--- a/sound/soc/fsl/Kconfig
+++ b/sound/soc/fsl/Kconfig
@@ -49,7 +49,6 @@ 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_FSL_UTILS
help
Say Y if you want to add Enhanced Synchronous Audio Interface
(ESAI) support for the Freescale CPUs.
diff --git a/sound/soc/fsl/fsl_esai.c b/sound/soc/fsl/fsl_esai.c
index f252370..b2f6b3e 100644
--- a/sound/soc/fsl/fsl_esai.c
+++ b/sound/soc/fsl/fsl_esai.c
@@ -18,7 +18,6 @@
#include "fsl_esai.h"
#include "imx-pcm.h"
-#include "fsl_utils.h"
#define FSL_ESAI_RATES SNDRV_PCM_RATE_8000_192000
#define FSL_ESAI_FORMATS (SNDRV_PCM_FMTBIT_S8 | \
@@ -612,7 +611,6 @@ static struct snd_soc_dai_ops fsl_esai_dai_ops = {
.hw_params = fsl_esai_hw_params,
.set_sysclk = fsl_esai_set_dai_sysclk,
.set_fmt = fsl_esai_set_dai_fmt,
- .xlate_tdm_slot_mask = fsl_asoc_xlate_tdm_slot_mask,
.set_tdm_slot = fsl_esai_set_dai_tdm_slot,
};
--
1.7.9.5
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox