* Re: [PATCH] powerpc: provide __bswapdi2
From: David Woodhouse @ 2013-05-13 10:33 UTC (permalink / raw)
To: Michael Neuling; +Cc: linuxppc-dev, viro
In-Reply-To: <9813.1368428999@ale.ozlabs.ibm.com>
[-- Attachment #1: Type: text/plain, Size: 1092 bytes --]
On Mon, 2013-05-13 at 17:09 +1000, Michael Neuling wrote:
>
> This doesn't work for me but the below does:
...
>
> stolen from GCC -02 output of:
> unsigned long long __bswapdi2(unsigned long long x)
Hm, so was mine:
[dwmw2@i7 ~]$ powerpc64-linux-gnu-gcc -O2 -S -o- bswapdi2.c -m32
.file "bswapdi2.c"
.section ".text"
.align 2
.p2align 4,,15
.globl __bswapdi2
.type __bswapdi2, @function
__bswapdi2:
rlwinm 10,4,8,0xffffffff
rlwinm 11,3,8,0xffffffff
rlwimi 10,4,24,0,7
rlwimi 11,3,24,0,7
rlwimi 10,4,24,16,23
rlwimi 11,3,24,16,23
mr 4,11
mr 3,10
blr
.size __bswapdi2,.-__bswapdi2
.ident "GCC: (GNU) 4.7.2 20121105 (Red Hat 4.7.2-2.aa.20121114svn)"
On Mon, 2013-05-13 at 09:33 +0200, Gabriel Paubert wrote:
> Actually, I'd swap the two mr instructions to never
> have an instruction that uses the result from the
> previous one.
Bad GCC. No biscuit.
Should we file a PR?
--
David Woodhouse Open Source Technology Centre
David.Woodhouse@intel.com Intel Corporation
[-- Attachment #2: smime.p7s --]
[-- Type: application/x-pkcs7-signature, Size: 5745 bytes --]
^ permalink raw reply
* Re: [PATCH] powerpc: provide __bswapdi2
From: David Woodhouse @ 2013-05-13 10:38 UTC (permalink / raw)
To: Michael Neuling; +Cc: linuxppc-dev, viro
In-Reply-To: <1368441187.24723.38.camel@i7.infradead.org>
[-- Attachment #1: Type: text/plain, Size: 1308 bytes --]
On Mon, 2013-05-13 at 11:33 +0100, David Woodhouse wrote:
>
> On Mon, 2013-05-13 at 09:33 +0200, Gabriel Paubert wrote:
> > Actually, I'd swap the two mr instructions to never
> > have an instruction that uses the result from the
> > previous one.
>
> Bad GCC. No biscuit.
>
> Should we file a PR?
Maybe not. If you tell it to tune for an in-order machine like Cell, it
swaps them round. Although now I'm confused about which of POWER[567]
were in-order:
[dwmw2@i7 ~]$ powerpc64-linux-gnu-gcc -O2 -S -o- bswapdi2.c -m32 | grep -B1 mr
rlwimi 11,3,24,16,23
mr 4,11
mr 3,10
[dwmw2@i7 ~]$ powerpc64-linux-gnu-gcc -O2 -S -o- bswapdi2.c -m32 -mtune=cell | grep -B1 mr
rlwimi 11,3,24,16,23
mr 3,10
mr 4,11
[dwmw2@i7 ~]$ powerpc64-linux-gnu-gcc -O2 -S -o- bswapdi2.c -m32 -mtune=power5 | grep -B1 mr
rlwimi 11,3,24,16,23
mr 3,10
mr 4,11
[dwmw2@i7 ~]$ powerpc64-linux-gnu-gcc -O2 -S -o- bswapdi2.c -m32 -mtune=power6 | grep -B1 mr
rlwimi 11,3,24,16,23
mr 4,11
mr 3,10
[dwmw2@i7 ~]$ powerpc64-linux-gnu-gcc -O2 -S -o- bswapdi2.c -m32 -mtune=power7 | grep -B1 mr
rlwimi 11,3,24,16,23
mr 4,11
mr 3,10
--
David Woodhouse Open Source Technology Centre
David.Woodhouse@intel.com Intel Corporation
[-- Attachment #2: smime.p7s --]
[-- Type: application/x-pkcs7-signature, Size: 5745 bytes --]
^ permalink raw reply
* [PATCH 0/1] powerpc: Fix irq_set_affinity() return values
From: Alexander Gordeev @ 2013-05-13 10:57 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: linuxppc-dev, linux-kernel
Hi Ben,
This fix is trivial. Just compile-tested it.
Alexander Gordeev (1):
powerpc: Fix irq_set_affinity() return values
arch/powerpc/platforms/wsp/ics.c | 2 +-
arch/powerpc/sysdev/ehv_pic.c | 2 +-
arch/powerpc/sysdev/mpic.c | 2 +-
arch/powerpc/sysdev/xics/ics-opal.c | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
--
1.7.7.6
--
Regards,
Alexander Gordeev
agordeev@redhat.com
^ permalink raw reply
* [PATCH 1/1] powerpc: Fix irq_set_affinity() return values
From: Alexander Gordeev @ 2013-05-13 10:57 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: linuxppc-dev, linux-kernel
Signed-off-by: Alexander Gordeev <agordeev@redhat.com>
---
arch/powerpc/platforms/wsp/ics.c | 2 +-
arch/powerpc/sysdev/ehv_pic.c | 2 +-
arch/powerpc/sysdev/mpic.c | 2 +-
arch/powerpc/sysdev/xics/ics-opal.c | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/arch/powerpc/platforms/wsp/ics.c b/arch/powerpc/platforms/wsp/ics.c
index 97fe82e..2d3b1dd 100644
--- a/arch/powerpc/platforms/wsp/ics.c
+++ b/arch/powerpc/platforms/wsp/ics.c
@@ -361,7 +361,7 @@ static int wsp_chip_set_affinity(struct irq_data *d,
xive = xive_set_server(xive, get_irq_server(ics, hw_irq));
wsp_ics_set_xive(ics, hw_irq, xive);
- return 0;
+ return IRQ_SET_MASK_OK;
}
static struct irq_chip wsp_irq_chip = {
diff --git a/arch/powerpc/sysdev/ehv_pic.c b/arch/powerpc/sysdev/ehv_pic.c
index 6e0e100..9cd0e60 100644
--- a/arch/powerpc/sysdev/ehv_pic.c
+++ b/arch/powerpc/sysdev/ehv_pic.c
@@ -81,7 +81,7 @@ int ehv_pic_set_affinity(struct irq_data *d, const struct cpumask *dest,
ev_int_set_config(src, config, prio, cpuid);
spin_unlock_irqrestore(&ehv_pic_lock, flags);
- return 0;
+ return IRQ_SET_MASK_OK;
}
static unsigned int ehv_pic_type_to_vecpri(unsigned int type)
diff --git a/arch/powerpc/sysdev/mpic.c b/arch/powerpc/sysdev/mpic.c
index d30e6a6..20f6625 100644
--- a/arch/powerpc/sysdev/mpic.c
+++ b/arch/powerpc/sysdev/mpic.c
@@ -836,7 +836,7 @@ int mpic_set_affinity(struct irq_data *d, const struct cpumask *cpumask,
mpic_physmask(mask));
}
- return 0;
+ return IRQ_SET_MASK_OK;
}
static unsigned int mpic_type_to_vecpri(struct mpic *mpic, unsigned int type)
diff --git a/arch/powerpc/sysdev/xics/ics-opal.c b/arch/powerpc/sysdev/xics/ics-opal.c
index f7e8609..39d7221 100644
--- a/arch/powerpc/sysdev/xics/ics-opal.c
+++ b/arch/powerpc/sysdev/xics/ics-opal.c
@@ -148,7 +148,7 @@ static int ics_opal_set_affinity(struct irq_data *d,
__func__, d->irq, hw_irq, server, rc);
return -1;
}
- return 0;
+ return IRQ_SET_MASK_OK;
}
static struct irq_chip ics_opal_irq_chip = {
--
1.7.7.6
--
Regards,
Alexander Gordeev
agordeev@redhat.com
^ permalink raw reply related
* Re: [PATCH] powerpc: provide __bswapdi2
From: Joakim Tjernlund @ 2013-05-13 10:51 UTC (permalink / raw)
To: David Woodhouse; +Cc: linuxppc-dev, Michael Neuling, viro
In-Reply-To: <1368441493.24723.41.camel@i7.infradead.org>
"Linuxppc-dev"
<linuxppc-dev-bounces+joakim.tjernlund=transmode.se@lists.ozlabs.org>
wrote 2013/05/13 12:38:13:
>
> On Mon, 2013-05-13 at 11:33 +0100, David Woodhouse wrote:
> >
> > On Mon, 2013-05-13 at 09:33 +0200, Gabriel Paubert wrote:
> > > Actually, I'd swap the two mr instructions to never
> > > have an instruction that uses the result from the
> > > previous one.
> >
> > Bad GCC. No biscuit.
> >
> > Should we file a PR?
>
> Maybe not. If you tell it to tune for an in-order machine like Cell, it
> swaps them round. Although now I'm confused about which of POWER[567]
> were in-order:
>
> [dwmw2@i7 ~]$ powerpc64-linux-gnu-gcc -O2 -S -o- bswapdi2.c -m32 | grep
-B1 mr
> rlwimi 11,3,24,16,23
> mr 4,11
> mr 3,10
> [dwmw2@i7 ~]$ powerpc64-linux-gnu-gcc -O2 -S -o- bswapdi2.c -m32
-mtune=cell | grep -B1 mr
> rlwimi 11,3,24,16,23
> mr 3,10
> mr 4,11
> [dwmw2@i7 ~]$ powerpc64-linux-gnu-gcc -O2 -S -o- bswapdi2.c -m32
-mtune=power5 | grep -B1 mr
> rlwimi 11,3,24,16,23
> mr 3,10
> mr 4,11
> [dwmw2@i7 ~]$ powerpc64-linux-gnu-gcc -O2 -S -o- bswapdi2.c -m32
-mtune=power6 | grep -B1 mr
> rlwimi 11,3,24,16,23
> mr 4,11
> mr 3,10
> [dwmw2@i7 ~]$ powerpc64-linux-gnu-gcc -O2 -S -o- bswapdi2.c -m32
-mtune=power7 | grep -B1 mr
> rlwimi 11,3,24,16,23
> mr 4,11
> mr 3,10
A bit rusty on the ppc asm but can you not remove the mr completely:
rlwimi 10,4,24,16,23
rlwimi 11,3,24,16,23
mr 4,11
mr 3,10
to
rlwimi 4,4,24,16,23
rlwimi 3,3,24,16,23
Jocke
^ permalink raw reply
* Re: [PATCH] powerpc: provide __bswapdi2
From: Joakim Tjernlund @ 2013-05-13 11:12 UTC (permalink / raw)
Cc: linuxppc-dev, Michael Neuling, David Woodhouse, viro
In-Reply-To: <OFF1D09F16.1BCB0BD6-ONC1257B6A.003B73C6-C1257B6A.003BB127@transmode.se>
"Linuxppc-dev"
<linuxppc-dev-bounces+joakim.tjernlund=transmode.se@lists.ozlabs.org>
wrote on 2013/05/13 12:51:59:
>
> "Linuxppc-dev"
> <linuxppc-dev-bounces+joakim.tjernlund=transmode.se@lists.ozlabs.org>
> wrote 2013/05/13 12:38:13:
> >
> > On Mon, 2013-05-13 at 11:33 +0100, David Woodhouse wrote:
> > >
> > > On Mon, 2013-05-13 at 09:33 +0200, Gabriel Paubert wrote:
> > > > Actually, I'd swap the two mr instructions to never
> > > > have an instruction that uses the result from the
> > > > previous one.
> > >
> > > Bad GCC. No biscuit.
> > >
> > > Should we file a PR?
> >
> > Maybe not. If you tell it to tune for an in-order machine like Cell,
it
> > swaps them round. Although now I'm confused about which of POWER[567]
> > were in-order:
> >
> > [dwmw2@i7 ~]$ powerpc64-linux-gnu-gcc -O2 -S -o- bswapdi2.c -m32 |
grep
> -B1 mr
> > rlwimi 11,3,24,16,23
> > mr 4,11
> > mr 3,10
> > [dwmw2@i7 ~]$ powerpc64-linux-gnu-gcc -O2 -S -o- bswapdi2.c -m32
> -mtune=cell | grep -B1 mr
> > rlwimi 11,3,24,16,23
> > mr 3,10
> > mr 4,11
> > [dwmw2@i7 ~]$ powerpc64-linux-gnu-gcc -O2 -S -o- bswapdi2.c -m32
> -mtune=power5 | grep -B1 mr
> > rlwimi 11,3,24,16,23
> > mr 3,10
> > mr 4,11
> > [dwmw2@i7 ~]$ powerpc64-linux-gnu-gcc -O2 -S -o- bswapdi2.c -m32
> -mtune=power6 | grep -B1 mr
> > rlwimi 11,3,24,16,23
> > mr 4,11
> > mr 3,10
> > [dwmw2@i7 ~]$ powerpc64-linux-gnu-gcc -O2 -S -o- bswapdi2.c -m32
> -mtune=power7 | grep -B1 mr
> > rlwimi 11,3,24,16,23
> > mr 4,11
> > mr 3,10
>
> A bit rusty on the ppc asm but can you not remove the mr completely:
> rlwimi 10,4,24,16,23
> rlwimi 11,3,24,16,23
> mr 4,11
> mr 3,10
> to
> rlwimi 4,4,24,16,23
> rlwimi 3,3,24,16,23
Oops, that got twisted. Forget my comment.
^ permalink raw reply
* Re: [RFC] device-tree.git automatic sync from linux.git
From: Ian Campbell @ 2013-05-13 11:59 UTC (permalink / raw)
To: monstr@monstr.eu
Cc: linux-mips@linux-mips.org, linux-c6x-dev@linux-c6x.org,
Arnd Bergmann, linux-xtensa@linux-xtensa.org,
microblaze-uclinux@itee.uq.edu.au, x86@kernel.org,
linux-kernel@vger.kernel.org, Rob Herring,
linux@lists.openrisc.net, Olof Johansson,
linuxppc-dev@lists.ozlabs.org,
linux-arm-kernel@lists.infradead.org
In-Reply-To: <5190900D.5020408@monstr.eu>
On Mon, 2013-05-13 at 08:02 +0100, Michal Simek wrote:
> Just small overview it is a Xilinx soft core cpu where you can even setup
> some parameters for core itself - multiplier, divider, BS, fpu, cache sizes, etc.
> You have to also compose the whole system and every platform/configuration is different
> because you can setup addresses, IP on the bus, IRQs, etc.
> Based on this configuration we have created tcl script which is able to generate
> DTS directly from Xilinx design tool and it is working quite well for several years
> and everybody just use it without any problem.
That sounds very neat!
Does this tcl script live in the kernel tree? If so would you think it
would make sense for it to also migrate to device-tree.git? I'm not at
all sure if that makes sense but if you think it does please let me know
which paths need top be carried over.
> As you see in your repo there is only one microblaze DTS which is for one of mine
> ancient configuration which none used.
> It means from microblaze point of view we can simple remove it from mainline kernel
> because it is useless.
That will then naturally get propagated over to device-tree.git.
> I also care about arm zynq platform where situation is partially different because
> zynq is fixed block but you can add others thing to programmable logic.
> It means for zynq case we are almost in the same situation where every zynq based
> platform is using different configuration and that's why fpgas are so great.
>
> It means for zynq case everybody will need different DTS but will be just good
> to describe or show binding.
> Currently we have just one dts for zc702 xilinx reference board.
>
> Let's move to my point.
> Based on our experience all xilinx boards don't depend on any dts in the linux kernel
> and our users just understand the reason why they should use our tcl script for
> DTS generation.
>
> Back to your point about moving DTSes out of the kernel.
I suppose you are now commenting on the Phase II bit where maintenance
of the DTS moves out of linux.git into device-tree.git, rather than
Phase I work, which is creating a split repo which is automatically
synchronised from linux.git but maintenance remains in linux.git, i.e.
what I'm doing here.
> For microblaze - no problem
> just do it. For arm zynq this is more problematic because there is weird binding
> for ARM. For example PMU which is out of bus and should be probably in cpu node.
> Also scu devices, scutimers, watchdog which lie on the bus for our case and we
> need to use PPI interrupt cpu mask. Different clock binding, maybe pinmux binding, etc.
>
> It means from my point of view if binding is correct, no problem to move it
> out of the kernel. If a kernel patch change binding, it is worth for me to change
> dts in the kernel too to reflect this change and track this change too.
> My proposal is, let's clean all DTSes in the arm kernel that all platform use
> the same binding where all platforms are just correctly described.
AIUI this split/move isn't intended to change the existing policy, which
is already that DTS files are supposed to remain compatible across
kernel versions and that "flag days" are to be avoided. The split is
supposed to make it harder (if not impossible) to accidentally break
that policy.
On the other hand I suppose there is an argument to be made for clearing
up the cruft *before* making the split.
Ultimately I think this will be up to Grant & co.
> The reaching this point I would suggest that for arm, arm-soc maintainers should
> keep eyes on any dts binding change and all these changes require ACK from Rob or Grant
> (like device-tree maintainers).
Yes, once we move onto Phase II I don't expect it will end up being me
that is the DTS maintainer -- I expect the maintenance will remain with
those who take care of it in linux.git today.
My involvement in Phase I is really just to help out with the transition
(ulterior motive: the Xen project would also like to use these DTS
files...) not to perform a "land grab" or take over maintenance etc. I
certainly don't think I am the right person to become the long term
maintainer of device-tree.git!
Ian.
^ permalink raw reply
* Re: [PATCH] powerpc: provide __bswapdi2
From: Gabriel Paubert @ 2013-05-13 13:12 UTC (permalink / raw)
To: David Woodhouse; +Cc: linuxppc-dev, Michael Neuling, viro
In-Reply-To: <1368441493.24723.41.camel@i7.infradead.org>
On Mon, May 13, 2013 at 11:38:13AM +0100, David Woodhouse wrote:
> On Mon, 2013-05-13 at 11:33 +0100, David Woodhouse wrote:
> >
> > On Mon, 2013-05-13 at 09:33 +0200, Gabriel Paubert wrote:
> > > Actually, I'd swap the two mr instructions to never
> > > have an instruction that uses the result from the
> > > previous one.
> >
> > Bad GCC. No biscuit.
> >
> > Should we file a PR?
>
> Maybe not. If you tell it to tune for an in-order machine like Cell, it
> swaps them round. Although now I'm confused about which of POWER[567]
> were in-order:
It was Power6 IIRC. On this kind of fine point, don't rely too much
on what GCC produces.
>
> [dwmw2@i7 ~]$ powerpc64-linux-gnu-gcc -O2 -S -o- bswapdi2.c -m32 | grep -B1 mr
> rlwimi 11,3,24,16,23
> mr 4,11
> mr 3,10
> [dwmw2@i7 ~]$ powerpc64-linux-gnu-gcc -O2 -S -o- bswapdi2.c -m32 -mtune=cell | grep -B1 mr
> rlwimi 11,3,24,16,23
> mr 3,10
> mr 4,11
> [dwmw2@i7 ~]$ powerpc64-linux-gnu-gcc -O2 -S -o- bswapdi2.c -m32 -mtune=power5 | grep -B1 mr
> rlwimi 11,3,24,16,23
> mr 3,10
> mr 4,11
> [dwmw2@i7 ~]$ powerpc64-linux-gnu-gcc -O2 -S -o- bswapdi2.c -m32 -mtune=power6 | grep -B1 mr
> rlwimi 11,3,24,16,23
> mr 4,11
> mr 3,10
> [dwmw2@i7 ~]$ powerpc64-linux-gnu-gcc -O2 -S -o- bswapdi2.c -m32 -mtune=power7 | grep -B1 mr
> rlwimi 11,3,24,16,23
> mr 4,11
> mr 3,10
I don't know of any processor in which putting the mr 3,10 first can cause stalls, so
even a generic tuning should put it first.
Gabriel
^ permalink raw reply
* Re: [PATCH 1/4] powerpc/book3e: introduce external_input_edge exception handler for 64bit kernel
From: Scott Wood @ 2013-05-13 15:47 UTC (permalink / raw)
To: Kevin Hao; +Cc: linuxppc
In-Reply-To: <1368314784-971-2-git-send-email-haokexin@gmail.com>
On 05/11/2013 06:26:21 PM, Kevin Hao wrote:
> In the external proxy facility mode, the interrupt is automatically
> acknowledged with the same effect as reading the IACK register. So
> this makes external input interrupt more like edge sensitive. That
> means we can leave the irq hard enabled when it occurs with irq soft
> disabled just like the dec and doorbell interrupt. But the External
> Proxy Register(EPR) is only considered valid from the time that the
> external interrupt occurs until MSR[EE] is set to 1. So we have to
> save the EPR before irq hard enabled.
Is it really worth it? Are you having a real-world problem with =20
profilability as things stand, that this resolves? We should already =20
be no worse off than non-external-proxy hardware...
-Scott=
^ permalink raw reply
* Re: [RFC] device-tree.git automatic sync from linux.git
From: Michal Simek @ 2013-05-13 15:59 UTC (permalink / raw)
To: Ian Campbell
Cc: linux-mips@linux-mips.org, linux-c6x-dev@linux-c6x.org,
Arnd Bergmann, linux-xtensa@linux-xtensa.org,
microblaze-uclinux@itee.uq.edu.au, x86@kernel.org,
linux-kernel@vger.kernel.org, Rob Herring,
linux@lists.openrisc.net, Olof Johansson,
linuxppc-dev@lists.ozlabs.org,
linux-arm-kernel@lists.infradead.org
In-Reply-To: <1368446352.537.81.camel@zakaz.uk.xensource.com>
[-- Attachment #1: Type: text/plain, Size: 5878 bytes --]
On 05/13/2013 01:59 PM, Ian Campbell wrote:
> On Mon, 2013-05-13 at 08:02 +0100, Michal Simek wrote:
>> Just small overview it is a Xilinx soft core cpu where you can even setup
>> some parameters for core itself - multiplier, divider, BS, fpu, cache sizes, etc.
>> You have to also compose the whole system and every platform/configuration is different
>> because you can setup addresses, IP on the bus, IRQs, etc.
>> Based on this configuration we have created tcl script which is able to generate
>> DTS directly from Xilinx design tool and it is working quite well for several years
>> and everybody just use it without any problem.
>
> That sounds very neat!
>
> Does this tcl script live in the kernel tree? If so would you think it
> would make sense for it to also migrate to device-tree.git? I'm not at
> all sure if that makes sense but if you think it does please let me know
> which paths need top be carried over.
No. This script is here.
https://github.com/Xilinx/device-tree/tree/master-next
It is tightly connected to Xilinx design tool that's why I don't think it is useful
to add it to any other tree.
>> As you see in your repo there is only one microblaze DTS which is for one of mine
>> ancient configuration which none used.
>> It means from microblaze point of view we can simple remove it from mainline kernel
>> because it is useless.
>
> That will then naturally get propagated over to device-tree.git.
I will think about it for a while and probably just remove it through my microblaze tree.
>> I also care about arm zynq platform where situation is partially different because
>> zynq is fixed block but you can add others thing to programmable logic.
>> It means for zynq case we are almost in the same situation where every zynq based
>> platform is using different configuration and that's why fpgas are so great.
>>
>> It means for zynq case everybody will need different DTS but will be just good
>> to describe or show binding.
>> Currently we have just one dts for zc702 xilinx reference board.
>>
>> Let's move to my point.
>> Based on our experience all xilinx boards don't depend on any dts in the linux kernel
>> and our users just understand the reason why they should use our tcl script for
>> DTS generation.
>>
>> Back to your point about moving DTSes out of the kernel.
>
> I suppose you are now commenting on the Phase II bit where maintenance
> of the DTS moves out of linux.git into device-tree.git, rather than
> Phase I work, which is creating a split repo which is automatically
> synchronised from linux.git but maintenance remains in linux.git, i.e.
> what I'm doing here.
ok.
>> For microblaze - no problem
>> just do it. For arm zynq this is more problematic because there is weird binding
>> for ARM. For example PMU which is out of bus and should be probably in cpu node.
>> Also scu devices, scutimers, watchdog which lie on the bus for our case and we
>> need to use PPI interrupt cpu mask. Different clock binding, maybe pinmux binding, etc.
>>
>> It means from my point of view if binding is correct, no problem to move it
>> out of the kernel. If a kernel patch change binding, it is worth for me to change
>> dts in the kernel too to reflect this change and track this change too.
>> My proposal is, let's clean all DTSes in the arm kernel that all platform use
>> the same binding where all platforms are just correctly described.
>
> AIUI this split/move isn't intended to change the existing policy, which
> is already that DTS files are supposed to remain compatible across
> kernel versions and that "flag days" are to be avoided. The split is
> supposed to make it harder (if not impossible) to accidentally break
> that policy.
>
> On the other hand I suppose there is an argument to be made for clearing
> up the cruft *before* making the split.
>
> Ultimately I think this will be up to Grant & co.
ok.
>> The reaching this point I would suggest that for arm, arm-soc maintainers should
>> keep eyes on any dts binding change and all these changes require ACK from Rob or Grant
>> (like device-tree maintainers).
>
> Yes, once we move onto Phase II I don't expect it will end up being me
> that is the DTS maintainer -- I expect the maintenance will remain with
> those who take care of it in linux.git today.
>
> My involvement in Phase I is really just to help out with the transition
> (ulterior motive: the Xen project would also like to use these DTS
> files...) not to perform a "land grab" or take over maintenance etc. I
> certainly don't think I am the right person to become the long term
> maintainer of device-tree.git!
Ok. I see you point right now in connection to different project where
your Phase I make more sense.
Our flow, because of a lot of flexibility in fpga word, is more based on DTS which
we don't have in hand and everyone has to maintain it.
Starting to using not correct DTSes by another project will be problematic.
It is good step but it suggests that they can start to use it but one change
in the kernel binging will caused that it breaks another project.
From my point of view this Phase I is good to do for DTSes which are correct.
Then another project can be sure that they won't change a lot.
I have the same experience with our DTS driven Qemu that it works when description
is stable but till that time it is just pain because you need to be sure
that all binding changes are also done in Qemu.
Thanks,
Michal
--
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/
Maintainer of Linux kernel - Xilinx Zynq ARM architecture
Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 263 bytes --]
^ permalink raw reply
* [PATCH v2, part 1 3/9] PCI: Convert alloc_pci_dev(void) to pci_alloc_dev(bus) instead
From: Jiang Liu @ 2013-05-13 16:08 UTC (permalink / raw)
To: Bjorn Helgaas, Yinghai Lu
Cc: Neela Syam Kolli, sparclinux, Toshi Kani, Jiang Liu, linux-scsi,
David Airlie, Greg Kroah-Hartman, linuxppc-dev, linux-kernel,
James E.J. Bottomley, Rafael J . Wysocki, Yijing Wang, linux-pci,
Gu Zheng, Paul Mackerras, Andrew Morton, Myron Stowe,
David S. Miller, Jiang Liu
In-Reply-To: <1368461313-4371-1-git-send-email-jiang.liu@huawei.com>
From: Gu Zheng <guz.fnst@cn.fujitsu.com>
<marker to prevent gmail from removing below "From:">
From: Gu Zheng <guz.fnst@cn.fujitsu.com>
Use the new pci_alloc_dev(bus) to replace the existing using of
alloc_pci_dev(void).
v2:
Follow Bjorn's correction to move pci_bus_put() to
pci_release_dev() instead.
Signed-off-by: Gu Zheng <guz.fnst@cn.fujitsu.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: David Airlie <airlied@linux.ie>
Cc: Neela Syam Kolli <megaraidlinux@lsi.com>
Cc: "James E.J. Bottomley" <JBottomley@parallels.com>
Cc: Yinghai Lu <yinghai@kernel.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: linuxppc-dev@lists.ozlabs.org
Cc: linux-kernel@vger.kernel.org
Cc: sparclinux@vger.kernel.org
Cc: linux-pci@vger.kernel.org
Cc: linux-scsi@vger.kernel.org
Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
---
arch/powerpc/kernel/pci_of_scan.c | 3 +--
arch/sparc/kernel/pci.c | 3 +--
drivers/char/agp/alpha-agp.c | 2 +-
drivers/char/agp/parisc-agp.c | 2 +-
drivers/pci/iov.c | 8 +++++---
drivers/pci/probe.c | 4 ++--
drivers/scsi/megaraid.c | 2 +-
7 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/arch/powerpc/kernel/pci_of_scan.c b/arch/powerpc/kernel/pci_of_scan.c
index 2a67e9b..24d01c4 100644
--- a/arch/powerpc/kernel/pci_of_scan.c
+++ b/arch/powerpc/kernel/pci_of_scan.c
@@ -128,7 +128,7 @@ struct pci_dev *of_create_pci_dev(struct device_node *node,
const char *type;
struct pci_slot *slot;
- dev = alloc_pci_dev();
+ dev = pci_alloc_dev(bus);
if (!dev)
return NULL;
type = of_get_property(node, "device_type", NULL);
@@ -137,7 +137,6 @@ struct pci_dev *of_create_pci_dev(struct device_node *node,
pr_debug(" create device, devfn: %x, type: %s\n", devfn, type);
- dev->bus = bus;
dev->dev.of_node = of_node_get(node);
dev->dev.parent = bus->bridge;
dev->dev.bus = &pci_bus_type;
diff --git a/arch/sparc/kernel/pci.c b/arch/sparc/kernel/pci.c
index baf4366..e5871fb 100644
--- a/arch/sparc/kernel/pci.c
+++ b/arch/sparc/kernel/pci.c
@@ -254,7 +254,7 @@ static struct pci_dev *of_create_pci_dev(struct pci_pbm_info *pbm,
const char *type;
u32 class;
- dev = alloc_pci_dev();
+ dev = pci_alloc_dev(bus);
if (!dev)
return NULL;
@@ -281,7 +281,6 @@ static struct pci_dev *of_create_pci_dev(struct pci_pbm_info *pbm,
printk(" create device, devfn: %x, type: %s\n",
devfn, type);
- dev->bus = bus;
dev->sysdata = node;
dev->dev.parent = bus->bridge;
dev->dev.bus = &pci_bus_type;
diff --git a/drivers/char/agp/alpha-agp.c b/drivers/char/agp/alpha-agp.c
index dd84af4..199b8e9 100644
--- a/drivers/char/agp/alpha-agp.c
+++ b/drivers/char/agp/alpha-agp.c
@@ -174,7 +174,7 @@ alpha_core_agp_setup(void)
/*
* Build a fake pci_dev struct
*/
- pdev = alloc_pci_dev();
+ pdev = pci_alloc_dev(NULL);
if (!pdev)
return -ENOMEM;
pdev->vendor = 0xffff;
diff --git a/drivers/char/agp/parisc-agp.c b/drivers/char/agp/parisc-agp.c
index 94821ab..bf5d247 100644
--- a/drivers/char/agp/parisc-agp.c
+++ b/drivers/char/agp/parisc-agp.c
@@ -333,7 +333,7 @@ parisc_agp_setup(void __iomem *ioc_hpa, void __iomem *lba_hpa)
struct agp_bridge_data *bridge;
int error = 0;
- fake_bridge_dev = alloc_pci_dev();
+ fake_bridge_dev = pci_alloc_dev(NULL);
if (!fake_bridge_dev) {
error = -ENOMEM;
goto fail;
diff --git a/drivers/pci/iov.c b/drivers/pci/iov.c
index ee599f2..24134cd 100644
--- a/drivers/pci/iov.c
+++ b/drivers/pci/iov.c
@@ -75,18 +75,20 @@ static int virtfn_add(struct pci_dev *dev, int id, int reset)
struct pci_dev *virtfn;
struct resource *res;
struct pci_sriov *iov = dev->sriov;
+ struct pci_bus *bus;
- virtfn = alloc_pci_dev();
+ virtfn = pci_alloc_dev(NULL);
if (!virtfn)
return -ENOMEM;
mutex_lock(&iov->dev->sriov->lock);
- virtfn->bus = virtfn_add_bus(dev->bus, virtfn_bus(dev, id));
- if (!virtfn->bus) {
+ bus = virtfn_add_bus(dev->bus, virtfn_bus(dev, id));
+ if (!bus) {
kfree(virtfn);
mutex_unlock(&iov->dev->sriov->lock);
return -ENOMEM;
}
+ virtfn->bus = pci_bus_get(bus);
virtfn->devfn = virtfn_devfn(dev, id);
virtfn->vendor = dev->vendor;
pci_read_config_word(dev, iov->pos + PCI_SRIOV_VF_DID, &virtfn->device);
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 4f0bc0a..bc075a3 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -1131,6 +1131,7 @@ static void pci_release_dev(struct device *dev)
struct pci_dev *pci_dev;
pci_dev = to_pci_dev(dev);
+ pci_bus_put(pci_dev->bus);
pci_release_capabilities(pci_dev);
pci_release_of_node(pci_dev);
kfree(pci_dev);
@@ -1269,11 +1270,10 @@ static struct pci_dev *pci_scan_device(struct pci_bus *bus, int devfn)
if (!pci_bus_read_dev_vendor_id(bus, devfn, &l, 60*1000))
return NULL;
- dev = alloc_pci_dev();
+ dev = pci_alloc_dev(bus);
if (!dev)
return NULL;
- dev->bus = bus;
dev->devfn = devfn;
dev->vendor = l & 0xffff;
dev->device = (l >> 16) & 0xffff;
diff --git a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c
index 9504ec0..e1660ca 100644
--- a/drivers/scsi/megaraid.c
+++ b/drivers/scsi/megaraid.c
@@ -2025,7 +2025,7 @@ megaraid_abort_and_reset(adapter_t *adapter, Scsi_Cmnd *cmd, int aor)
static inline int
make_local_pdev(adapter_t *adapter, struct pci_dev **pdev)
{
- *pdev = alloc_pci_dev();
+ *pdev = pci_alloc_dev(NULL);
if( *pdev == NULL ) return -1;
--
1.8.1.2
^ permalink raw reply related
* Re: [PATCH] powerpc: provide __bswapdi2
From: Segher Boessenkool @ 2013-05-13 16:47 UTC (permalink / raw)
To: David Woodhouse; +Cc: linuxppc-dev, Anton Blanchard, viro, Alan Modra
In-Reply-To: <1368440850.24723.32.camel@i7.infradead.org>
>> I did a little digging, and it looks like gcc-4.4 will emit
>> __bswapdi2
>> calls. Support in rs6000.md appeared 2009-06-25.
>
> That's where it was seen. I don't have anything that ancient any
> more so
> it didn't show up in my testing, but Al saw it on a Debian system.
It should never happen on 32-bit -- it is broken into two bswapsi's --
although, old compiler, who knows. Lack of testing makes some people
nervous though ;-)
Segher
^ permalink raw reply
* Re: [PATCH] powerpc: provide __bswapdi2
From: Segher Boessenkool @ 2013-05-13 16:55 UTC (permalink / raw)
To: David Woodhouse; +Cc: linuxppc-dev, Michael Neuling, viro
In-Reply-To: <1368441187.24723.38.camel@i7.infradead.org>
> rlwinm 10,4,8,0xffffffff
> rlwinm 11,3,8,0xffffffff
> rlwimi 10,4,24,0,7
> rlwimi 11,3,24,0,7
> rlwimi 10,4,24,16,23
> rlwimi 11,3,24,16,23
> mr 4,11
> mr 3,10
>> Actually, I'd swap the two mr instructions to never
>> have an instruction that uses the result from the
>> previous one.
>
> Bad GCC. No biscuit.
>
> Should we file a PR?
This is scheduled just fine. Every pair of instructions here can
execute together (on most CPUs, if not all); all instructions after
it are dependent on previous instructions. There also is no issue
(group) restriction that makes this scheduling suboptimal afaics.
Segher
^ permalink raw reply
* Re: [PATCH v2, part 1 3/9] PCI: Convert alloc_pci_dev(void) to pci_alloc_dev(bus) instead
From: Yinghai Lu @ 2013-05-13 17:23 UTC (permalink / raw)
To: Jiang Liu
Cc: Neela Syam Kolli, sparclinux@vger.kernel.org, Toshi Kani,
Jiang Liu, Linux-Scsi, David Airlie, Greg Kroah-Hartman,
linuxppc-dev, Linux Kernel Mailing List, James E.J. Bottomley,
Rafael J . Wysocki, Gu Zheng, Yijing Wang,
linux-pci@vger.kernel.org, Bjorn Helgaas, Paul Mackerras,
Andrew Morton, Myron Stowe, David S. Miller
In-Reply-To: <1368461313-4371-4-git-send-email-jiang.liu@huawei.com>
On Mon, May 13, 2013 at 9:08 AM, Jiang Liu <liuj97@gmail.com> wrote:
> From: Gu Zheng <guz.fnst@cn.fujitsu.com>
> diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
> index 4f0bc0a..bc075a3 100644
> --- a/drivers/pci/probe.c
> +++ b/drivers/pci/probe.c
> @@ -1131,6 +1131,7 @@ static void pci_release_dev(struct device *dev)
> struct pci_dev *pci_dev;
>
> pci_dev = to_pci_dev(dev);
> + pci_bus_put(pci_dev->bus);
> pci_release_capabilities(pci_dev);
> pci_release_of_node(pci_dev);
> kfree(pci_dev);
> @@ -1269,11 +1270,10 @@ static struct pci_dev *pci_scan_device(struct pci_bus *bus, int devfn)
> if (!pci_bus_read_dev_vendor_id(bus, devfn, &l, 60*1000))
> return NULL;
>
> - dev = alloc_pci_dev();
> + dev = pci_alloc_dev(bus);
> if (!dev)
> return NULL;
>
> - dev->bus = bus;
> dev->devfn = devfn;
> dev->vendor = l & 0xffff;
> dev->device = (l >> 16) & 0xffff;
in pci_setup_device() fail path, it release the ref to that bus.
Yinghai
^ permalink raw reply
* Re: [PATCH v3] clk: add PowerPC corenet clock driver support
From: Mike Turquette @ 2013-05-13 19:25 UTC (permalink / raw)
To: Yuantian.Tang
Cc: ulf.hansson, linux-doc, viresh.kumar, devicetree-discuss,
linux-kernel, Tang Yuantian, shawn.guo, linuxppc-dev,
linus.walleij
In-Reply-To: <1365497187-8305-1-git-send-email-Yuantian.Tang@freescale.com>
Quoting Yuantian.Tang@freescale.com (2013-04-09 01:46:26)
> From: Tang Yuantian <yuantian.tang@freescale.com>
> =
> This adds the clock driver for Freescale PowerPC corenet
> series SoCs using common clock infrastructure.
> =
> Signed-off-by: Tang Yuantian <Yuantian.Tang@freescale.com>
> Signed-off-by: Li Yang <leoli@freescale.com>
Patch #1 looks good to me. I've taken it into clk-next for now, but by
aware that I'll be rebasing that branch until at least -rc3 comes out,
so don't use it for a stable branch.
I did not take in patch #2, I guess you'll send that through a PPC tree?
Regards,
Mike
> ---
> v3:
> - remove the module author and description
> v2:
> - add the document for device tree clock bindings
> =
> arch/powerpc/platforms/Kconfig.cputype | 1 +
> drivers/clk/Kconfig | 7 +
> drivers/clk/Makefile | 1 +
> drivers/clk/clk-ppc-corenet.c | 280 +++++++++++++++++++++++++++=
++++++
> 4 files changed, 289 insertions(+)
> create mode 100644 drivers/clk/clk-ppc-corenet.c
> =
> diff --git a/arch/powerpc/platforms/Kconfig.cputype b/arch/powerpc/platfo=
rms/Kconfig.cputype
> index 18e3b76..cf065b8 100644
> --- a/arch/powerpc/platforms/Kconfig.cputype
> +++ b/arch/powerpc/platforms/Kconfig.cputype
> @@ -158,6 +158,7 @@ config E500
> config PPC_E500MC
> bool "e500mc Support"
> select PPC_FPU
> + select COMMON_CLK
> depends on E500
> help
> This must be enabled for running on e500mc (and derivatives
> diff --git a/drivers/clk/Kconfig b/drivers/clk/Kconfig
> index a47e6ee..6e2fd9c 100644
> --- a/drivers/clk/Kconfig
> +++ b/drivers/clk/Kconfig
> @@ -63,6 +63,13 @@ config CLK_TWL6040
> McPDM. McPDM module is using the external bit clock on the McPD=
M bus
> as functional clock.
> =
> +config CLK_PPC_CORENET
> + bool "Clock driver for PowerPC corenet platforms"
> + depends on PPC_E500MC && OF
> + ---help---
> + This adds the clock driver support for Freescale PowerPC corenet
> + platforms using common clock framework.
> +
> endmenu
> =
> source "drivers/clk/mvebu/Kconfig"
> diff --git a/drivers/clk/Makefile b/drivers/clk/Makefile
> index 300d477..6720319 100644
> --- a/drivers/clk/Makefile
> +++ b/drivers/clk/Makefile
> @@ -34,3 +34,4 @@ obj-$(CONFIG_X86) +=3D x86/
> obj-$(CONFIG_COMMON_CLK_WM831X) +=3D clk-wm831x.o
> obj-$(CONFIG_COMMON_CLK_MAX77686) +=3D clk-max77686.o
> obj-$(CONFIG_CLK_TWL6040) +=3D clk-twl6040.o
> +obj-$(CONFIG_CLK_PPC_CORENET) +=3D clk-ppc-corenet.o
> diff --git a/drivers/clk/clk-ppc-corenet.c b/drivers/clk/clk-ppc-corenet.c
> new file mode 100644
> index 0000000..a2d483f
> --- /dev/null
> +++ b/drivers/clk/clk-ppc-corenet.c
> @@ -0,0 +1,280 @@
> +/*
> + * Copyright 2013 Freescale Semiconductor, Inc.
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2 as
> + * published by the Free Software Foundation.
> + *
> + * clock driver for Freescale PowerPC corenet SoCs.
> + */
> +#include <linux/clk-provider.h>
> +#include <linux/io.h>
> +#include <linux/kernel.h>
> +#include <linux/module.h>
> +#include <linux/of_platform.h>
> +#include <linux/of.h>
> +#include <linux/slab.h>
> +
> +struct cmux_clk {
> + struct clk_hw hw;
> + void __iomem *reg;
> + u32 flags;
> +};
> +
> +#define PLL_KILL BIT(31)
> +#define CLKSEL_SHIFT 27
> +#define CLKSEL_ADJUST BIT(0)
> +#define to_cmux_clk(p) container_of(p, struct cmux_clk, hw)
> +
> +static void __iomem *base;
> +static unsigned int clocks_per_pll;
> +
> +static int cmux_set_parent(struct clk_hw *hw, u8 idx)
> +{
> + struct cmux_clk *clk =3D to_cmux_clk(hw);
> + u32 clksel;
> +
> + clksel =3D ((idx / clocks_per_pll) << 2) + idx % clocks_per_pll;
> + if (clk->flags & CLKSEL_ADJUST)
> + clksel +=3D 8;
> + clksel =3D (clksel & 0xf) << CLKSEL_SHIFT;
> + iowrite32be(clksel, clk->reg);
> +
> + return 0;
> +}
> +
> +static u8 cmux_get_parent(struct clk_hw *hw)
> +{
> + struct cmux_clk *clk =3D to_cmux_clk(hw);
> + u32 clksel;
> +
> + clksel =3D ioread32be(clk->reg);
> + clksel =3D (clksel >> CLKSEL_SHIFT) & 0xf;
> + if (clk->flags & CLKSEL_ADJUST)
> + clksel -=3D 8;
> + clksel =3D (clksel >> 2) * clocks_per_pll + clksel % 4;
> +
> + return clksel;
> +}
> +
> +const struct clk_ops cmux_ops =3D {
> + .get_parent =3D cmux_get_parent,
> + .set_parent =3D cmux_set_parent,
> +};
> +
> +static void __init core_mux_init(struct device_node *np)
> +{
> + struct clk *clk;
> + struct clk_init_data init;
> + struct cmux_clk *cmux_clk;
> + struct device_node *node;
> + int rc, count, i;
> + u32 offset;
> + const char *clk_name;
> + const char **parent_names;
> +
> + rc =3D of_property_read_u32(np, "reg", &offset);
> + if (rc) {
> + pr_err("%s: could not get reg property\n", np->name);
> + return;
> + }
> +
> + /* get the input clock source count */
> + count =3D of_property_count_strings(np, "clock-names");
> + if (count < 0) {
> + pr_err("%s: get clock count error\n", np->name);
> + return;
> + }
> + parent_names =3D kzalloc((sizeof(char *) * count), GFP_KERNEL);
> + if (!parent_names) {
> + pr_err("%s: could not allocate parent_names\n", __func__);
> + return;
> + }
> +
> + for (i =3D 0; i < count; i++)
> + parent_names[i] =3D of_clk_get_parent_name(np, i);
> +
> + cmux_clk =3D kzalloc(sizeof(struct cmux_clk), GFP_KERNEL);
> + if (!cmux_clk) {
> + pr_err("%s: could not allocate cmux_clk\n", __func__);
> + goto err_name;
> + }
> + cmux_clk->reg =3D base + offset;
> +
> + node =3D of_find_compatible_node(NULL, NULL, "fsl,p4080-clockgen"=
);
> + if (node && (offset >=3D 0x80))
> + cmux_clk->flags =3D CLKSEL_ADJUST;
> +
> + rc =3D of_property_read_string_index(np, "clock-output-names",
> + 0, &clk_name);
> + if (rc) {
> + pr_err("%s: read clock names error\n", np->name);
> + goto err_clk;
> + }
> +
> + init.name =3D clk_name;
> + init.ops =3D &cmux_ops;
> + init.parent_names =3D parent_names;
> + init.num_parents =3D count;
> + init.flags =3D 0;
> + cmux_clk->hw.init =3D &init;
> +
> + clk =3D clk_register(NULL, &cmux_clk->hw);
> + if (IS_ERR(clk)) {
> + pr_err("%s: could not register clock\n", clk_name);
> + goto err_clk;
> + }
> +
> + rc =3D of_clk_add_provider(np, of_clk_src_simple_get, clk);
> + if (rc) {
> + pr_err("Could not register clock provider for node:%s\n",
> + np->name);
> + goto err_clk;
> + }
> + goto err_name;
> +
> +err_clk:
> + kfree(cmux_clk);
> +err_name:
> + /* free *_names because they are reallocated when registered */
> + kfree(parent_names);
> +}
> +
> +static void __init core_pll_init(struct device_node *np)
> +{
> + u32 offset, mult;
> + int i, rc, count;
> + const char *clk_name, *parent_name;
> + struct clk_onecell_data *onecell_data;
> + struct clk **subclks;
> +
> + rc =3D of_property_read_u32(np, "reg", &offset);
> + if (rc) {
> + pr_err("%s: could not get reg property\n", np->name);
> + return;
> + }
> +
> + /* get the multiple of PLL */
> + mult =3D ioread32be(base + offset);
> +
> + /* check if this PLL is disabled */
> + if (mult & PLL_KILL) {
> + pr_debug("PLL:%s is disabled\n", np->name);
> + return;
> + }
> + mult =3D (mult >> 1) & 0x3f;
> +
> + parent_name =3D of_clk_get_parent_name(np, 0);
> + if (!parent_name) {
> + pr_err("PLL: %s must have a parent\n", np->name);
> + return;
> + }
> +
> + count =3D of_property_count_strings(np, "clock-output-names");
> + if (count < 0 || count > 4) {
> + pr_err("%s: clock is not supported\n", np->name);
> + return;
> + }
> +
> + /* output clock number per PLL */
> + clocks_per_pll =3D count;
> +
> + subclks =3D kzalloc(sizeof(struct clk *) * count, GFP_KERNEL);
> + if (!subclks) {
> + pr_err("%s: could not allocate subclks\n", __func__);
> + return;
> + }
> +
> + onecell_data =3D kzalloc(sizeof(struct clk_onecell_data), GFP_KER=
NEL);
> + if (!onecell_data) {
> + pr_err("%s: could not allocate onecell_data\n", __func__);
> + goto err_clks;
> + }
> +
> + for (i =3D 0; i < count; i++) {
> + rc =3D of_property_read_string_index(np, "clock-output-na=
mes",
> + i, &clk_name);
> + if (rc) {
> + pr_err("%s: could not get clock names\n", np->nam=
e);
> + goto err_cell;
> + }
> +
> + /*
> + * when count =3D=3D 4, there are 4 output clocks:
> + * /1, /2, /3, /4 respectively
> + * when count < 4, there are at least 2 output clocks:
> + * /1, /2, (/4, if count =3D=3D 3) respectively.
> + */
> + if (count =3D=3D 4)
> + subclks[i] =3D clk_register_fixed_factor(NULL, cl=
k_name,
> + parent_name, 0, mult, 1 + i);
> + else
> +
> + subclks[i] =3D clk_register_fixed_factor(NULL, cl=
k_name,
> + parent_name, 0, mult, 1 << i);
> +
> + if (IS_ERR(subclks[i])) {
> + pr_err("%s: could not register clock\n", clk_name=
);
> + goto err_cell;
> + }
> + }
> +
> + onecell_data->clks =3D subclks;
> + onecell_data->clk_num =3D count;
> +
> + rc =3D of_clk_add_provider(np, of_clk_src_onecell_get, onecell_da=
ta);
> + if (rc) {
> + pr_err("Could not register clk provider for node:%s\n",
> + np->name);
> + goto err_cell;
> + }
> +
> + return;
> +err_cell:
> + kfree(onecell_data);
> +err_clks:
> + kfree(subclks);
> +}
> +
> +static const struct of_device_id clk_match[] __initconst =3D {
> + { .compatible =3D "fixed-clock", .data =3D of_fixed_clk_setup, },
> + { .compatible =3D "fsl,core-pll-clock", .data =3D core_pll_init, =
},
> + { .compatible =3D "fsl,core-mux-clock", .data =3D core_mux_init, =
},
> + {}
> +};
> +
> +static int __init ppc_corenet_clk_probe(struct platform_device *pdev)
> +{
> + struct device_node *np;
> +
> + np =3D pdev->dev.of_node;
> + base =3D of_iomap(np, 0);
> + if (!base) {
> + dev_err(&pdev->dev, "iomap error\n");
> + return -ENOMEM;
> + }
> + of_clk_init(clk_match);
> +
> + return 0;
> +}
> +
> +static const struct of_device_id ppc_clk_ids[] __initconst =3D {
> + { .compatible =3D "fsl,qoriq-clockgen-1.0", },
> + { .compatible =3D "fsl,qoriq-clockgen-2", },
> + {}
> +};
> +
> +static struct platform_driver ppc_corenet_clk_driver =3D {
> + .driver =3D {
> + .name =3D "ppc_corenet_clock",
> + .owner =3D THIS_MODULE,
> + .of_match_table =3D ppc_clk_ids,
> + },
> + .probe =3D ppc_corenet_clk_probe,
> +};
> +
> +static int __init ppc_corenet_clk_init(void)
> +{
> + return platform_driver_register(&ppc_corenet_clk_driver);
> +}
> +subsys_initcall(ppc_corenet_clk_init);
> -- =
> 1.8.0
^ permalink raw reply
* [PATCH RFC] power/mpc85xx: Add delay after enabling I2C master
From: York Sun @ 2013-05-13 21:27 UTC (permalink / raw)
To: albrecht.dress; +Cc: linuxppc-dev
Erratum A-006037 indicates I2C controller executes the write to I2CCR only
after it sees SCL idle for 64K cycle of internal I2C controller clocks. If
during this waiting period, I2C controller is disabled (I2CCR[MEN] set to
0), then the controller could end in bad state, and hang the future access
to I2C register.
The mpc_i2c_fixup() function tries to recover the bus from a stalled state
where the 9th clock pulse wasn't generated. However, this workaround
disables and enables I2C controller without meeting waiting requirement of
this erratum.
This erratum applies to some 85xx SoCs. It is safe to apply to all of them
for mpc_i2c_fixup().
Signed-off-by: York Sun <yorksun@freescale.com>
---
I'd like to get rid of the #ifdef if mpc5121 is OK with the longer delay.
drivers/i2c/busses/i2c-mpc.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/drivers/i2c/busses/i2c-mpc.c b/drivers/i2c/busses/i2c-mpc.c
index a69459e..3e540ca 100644
--- a/drivers/i2c/busses/i2c-mpc.c
+++ b/drivers/i2c/busses/i2c-mpc.c
@@ -105,7 +105,12 @@ static irqreturn_t mpc_i2c_isr(int irq, void *dev_id)
static void mpc_i2c_fixup(struct mpc_i2c *i2c)
{
int k;
- u32 delay_val = 1000000 / i2c->real_clk + 1;
+ u32 delay_val;
+#ifdef CONFIG_PPC_85xx
+ delay_val = 65536 / (fsl_get_sys_freq() / 2000000); /* 64K cycle */
+#else
+ delay_val = 1000000 / i2c->real_clk + 1;
+#endif
if (delay_val < 2)
delay_val = 2;
@@ -115,7 +120,11 @@ static void mpc_i2c_fixup(struct mpc_i2c *i2c)
writeccr(i2c, CCR_MSTA | CCR_MTX | CCR_MEN);
udelay(delay_val);
writeccr(i2c, CCR_MEN);
+#ifdef CONFIG_PPC_85xx
+ udelay(delay_val);
+#else
udelay(delay_val << 1);
+#endif
}
}
--
1.7.9.5
^ permalink raw reply related
* [PATCH] powerpc/booke64: fix kernel hangs at kernel_dbg_exc
From: Scott Wood @ 2013-05-14 0:14 UTC (permalink / raw)
To: Kumar Gala; +Cc: Scott Wood, linuxppc-dev
MSR_DE is not cleared on entry to the kernel, and we don't clear it
explicitly outside of debug code. If we have MSR_DE set in
prime_debug_regs(), and the new thread has events enabled in DBCR0
(e.g. ICMP is set in thread->dbsr0, even though it was cleared in the
real DBCR0 when the thread got scheduled out), we'll end up taking a
debug exception in the kernel when DBCR0 is loaded. DSRR0 will not
point to an exception vector, and the kernel ends up hanging at
kernel_dbg_exc. Fix this by always clearing MSR_DE when we load new
debug state.
Another observed source of kernel_dbg_exc hangs is with the branch
taken event. If this event is active, but we take a non-debug trap
(e.g. a TLB miss or an asynchronous interrupt) before the next branch.
We end up taking a branch-taken debug exception on the initial branch
instruction of the exception vector, but because the debug exception is
DBSR_BT rather than DBSR_IC we branch to kernel_dbg_exc before even
checking the DSRR0 address. Fix this by checking for DBSR_BT as well
as DBSR_IC, which is what 32-bit does and what the comments suggest was
intended in the 64-bit code as well.
Signed-off-by: Scott Wood <scottwood@freescale.com>
---
arch/powerpc/kernel/exceptions-64e.S | 8 ++++----
arch/powerpc/kernel/process.c | 7 +++++++
2 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/arch/powerpc/kernel/exceptions-64e.S b/arch/powerpc/kernel/exceptions-64e.S
index 42a756e..645170a 100644
--- a/arch/powerpc/kernel/exceptions-64e.S
+++ b/arch/powerpc/kernel/exceptions-64e.S
@@ -489,7 +489,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC)
*/
mfspr r14,SPRN_DBSR /* check single-step/branch taken */
- andis. r15,r14,DBSR_IC@h
+ andis. r15,r14,(DBSR_IC|DBSR_BT)@h
beq+ 1f
LOAD_REG_IMMEDIATE(r14,interrupt_base_book3e)
@@ -500,7 +500,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC)
bge+ cr1,1f
/* here it looks like we got an inappropriate debug exception. */
- lis r14,DBSR_IC@h /* clear the IC event */
+ lis r14,(DBSR_IC|DBSR_BT)@h /* clear the event */
rlwinm r11,r11,0,~MSR_DE /* clear DE in the CSRR1 value */
mtspr SPRN_DBSR,r14
mtspr SPRN_CSRR1,r11
@@ -555,7 +555,7 @@ kernel_dbg_exc:
*/
mfspr r14,SPRN_DBSR /* check single-step/branch taken */
- andis. r15,r14,DBSR_IC@h
+ andis. r15,r14,(DBSR_IC|DBSR_BT)@h
beq+ 1f
LOAD_REG_IMMEDIATE(r14,interrupt_base_book3e)
@@ -566,7 +566,7 @@ kernel_dbg_exc:
bge+ cr1,1f
/* here it looks like we got an inappropriate debug exception. */
- lis r14,DBSR_IC@h /* clear the IC event */
+ lis r14,(DBSR_IC|DBSR_BT)@h /* clear the event */
rlwinm r11,r11,0,~MSR_DE /* clear DE in the DSRR1 value */
mtspr SPRN_DBSR,r14
mtspr SPRN_DSRR1,r11
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index ceb4e7b..912fe3c 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -339,6 +339,13 @@ static void set_debug_reg_defaults(struct thread_struct *thread)
static void prime_debug_regs(struct thread_struct *thread)
{
+ /*
+ * We could have inherited MSR_DE from userspace, since
+ * it doesn't get cleared on exception entry. Make sure
+ * MSR_DE is clear before we enable any debug events.
+ */
+ mtmsr(mfmsr() & ~MSR_DE);
+
mtspr(SPRN_IAC1, thread->iac1);
mtspr(SPRN_IAC2, thread->iac2);
#if CONFIG_PPC_ADV_DEBUG_IACS > 2
--
1.7.10.4
^ permalink raw reply related
* Re: [PATCH] powerpc: provide __bswapdi2
From: Stephen Rothwell @ 2013-05-14 1:09 UTC (permalink / raw)
To: Michael Neuling; +Cc: linuxppc-dev, David Woodhouse, viro
In-Reply-To: <9813.1368428999@ale.ozlabs.ibm.com>
[-- Attachment #1: Type: text/plain, Size: 1000 bytes --]
Hi Mikey,
On Mon, 13 May 2013 17:09:59 +1000 Michael Neuling <mikey@neuling.org> wrote:
>
> This doesn't work for me but the below does:
>
> _GLOBAL(__bswapdi2)
> rotlwi r9,r4,8
> rotlwi r10,r3,8
> rlwimi r9,r4,24,0,7
> rlwimi r10,r3,24,0,7
> rlwimi r9,r4,24,16,23
> rlwimi r10,r3,24,16,23
> mr r4,r10
> mr r3,r9
> blr
>
> stolen from GCC -02 output of:
> unsigned long long __bswapdi2(unsigned long long x)
> {
> return ((x & 0x00000000000000ffULL) << 56) |
> ((x & 0x000000000000ff00ULL) << 40) |
> ((x & 0x0000000000ff0000ULL) << 24) |
> ((x & 0x00000000ff000000ULL) << 8) |
> ((x & 0x000000ff00000000ULL) >> 8) |
> ((x & 0x0000ff0000000000ULL) >> 24) |
> ((x & 0x00ff000000000000ULL) >> 40) |
> ((x & 0xff00000000000000ULL) >> 56);
> }
So, if we are just stealing the output of gcc, why not just use the C
version (at least for 32 bit)?
--
Cheers,
Stephen Rothwell sfr@canb.auug.org.au
[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply
* Re: [PATCH] powerpc: provide __bswapdi2
From: Michael Neuling @ 2013-05-14 1:25 UTC (permalink / raw)
To: Stephen Rothwell; +Cc: Linux PPC dev, David Woodhouse, viro
In-Reply-To: <20130514110924.091b7177d22d69e19478a134@canb.auug.org.au>
[-- Attachment #1: Type: text/plain, Size: 1201 bytes --]
On 14 May 2013 11:09, "Stephen Rothwell" <sfr@canb.auug.org.au> wrote:
>
> Hi Mikey,
>
> On Mon, 13 May 2013 17:09:59 +1000 Michael Neuling <mikey@neuling.org>
wrote:
> >
> > This doesn't work for me but the below does:
> >
> > _GLOBAL(__bswapdi2)
> > rotlwi r9,r4,8
> > rotlwi r10,r3,8
> > rlwimi r9,r4,24,0,7
> > rlwimi r10,r3,24,0,7
> > rlwimi r9,r4,24,16,23
> > rlwimi r10,r3,24,16,23
> > mr r4,r10
> > mr r3,r9
> > blr
> >
> > stolen from GCC -02 output of:
> > unsigned long long __bswapdi2(unsigned long long x)
> > {
> > return ((x & 0x00000000000000ffULL) << 56) |
> > ((x & 0x000000000000ff00ULL) << 40) |
> > ((x & 0x0000000000ff0000ULL) << 24) |
> > ((x & 0x00000000ff000000ULL) << 8) |
> > ((x & 0x000000ff00000000ULL) >> 8) |
> > ((x & 0x0000ff0000000000ULL) >> 24) |
> > ((x & 0x00ff000000000000ULL) >> 40) |
> > ((x & 0xff00000000000000ULL) >> 56);
> > }
>
> So, if we are just stealing the output of gcc, why not just use the C
> version (at least for 32 bit)?
Woodhouse: can we just do this?
Mikey
[-- Attachment #2: Type: text/html, Size: 1793 bytes --]
^ permalink raw reply
* Re: [PATCH 1/4] powerpc/book3e: introduce external_input_edge exception handler for 64bit kernel
From: Kevin Hao @ 2013-05-14 2:03 UTC (permalink / raw)
To: Scott Wood; +Cc: linuxppc
In-Reply-To: <1368460037.8202.8@snotra>
[-- Attachment #1: Type: text/plain, Size: 1403 bytes --]
On Mon, May 13, 2013 at 10:47:17AM -0500, Scott Wood wrote:
> On 05/11/2013 06:26:21 PM, Kevin Hao wrote:
> >In the external proxy facility mode, the interrupt is automatically
> >acknowledged with the same effect as reading the IACK register. So
> >this makes external input interrupt more like edge sensitive. That
> >means we can leave the irq hard enabled when it occurs with irq soft
> >disabled just like the dec and doorbell interrupt. But the External
> >Proxy Register(EPR) is only considered valid from the time that the
> >external interrupt occurs until MSR[EE] is set to 1. So we have to
> >save the EPR before irq hard enabled.
>
> Is it really worth it?
Maybe. :-)
Compare with the current kernel:
* The overhead is that we need additional load & store the contents of
the EPR from/to PACA.
* The bonus is we keep the irq hard enabled when a external interrupt occurs
with irq soft-disabled. As I know we should leave the irq hard enabled as
much as possible. This is also the primary reason that we introduce the
Lazy EE.
> Are you having a real-world problem with
> profilability as things stand, that this resolves?
No.
> We should
> already be no worse off than non-external-proxy hardware...
Yes, I agree. But we can leverage the advantage of external proxy and
make it even more better.
Thanks,
Kevin
>
> -Scott
[-- Attachment #2: Type: application/pgp-signature, Size: 490 bytes --]
^ permalink raw reply
* [RFC PATCH v4 0/5] powerpc: Support context tracking for Power pSeries
From: Li Zhong @ 2013-05-14 2:16 UTC (permalink / raw)
To: linux-kernel; +Cc: Li Zhong, fweisbec, paulus, paulmck, linuxppc-dev
These patches try to support context tracking for Power arch, beginning with
64-bit pSeries. The codes are ported from that of the x86_64, and in each
patch, I listed the corresponding patch for x86.
v4:
fixed some cosmetic issues suggested by Ben.
Li Zhong (5):
powerpc: Syscall hooks for context tracking subsystem
powerpc: Exception hooks for context tracking subsystem
powerpc: Exit user context on notify resume
powerpc: Use the new schedule_user API on userspace preemption
powerpc: select HAVE_CONTEXT_TRACKING for pSeries
arch/powerpc/include/asm/context_tracking.h | 10 ++++
arch/powerpc/include/asm/thread_info.h | 7 ++-
arch/powerpc/kernel/entry_64.S | 3 +-
arch/powerpc/kernel/ptrace.c | 5 ++
arch/powerpc/kernel/signal.c | 5 ++
arch/powerpc/kernel/traps.c | 80 +++++++++++++++++++--------
arch/powerpc/mm/fault.c | 41 +++++++++-----
arch/powerpc/mm/hash_utils_64.c | 36 +++++++++---
arch/powerpc/platforms/pseries/Kconfig | 1 +
9 files changed, 140 insertions(+), 48 deletions(-)
create mode 100644 arch/powerpc/include/asm/context_tracking.h
--
1.7.9.5
^ permalink raw reply
* [RFC PATCH v4 1/5] powerpc: Syscall hooks for context tracking subsystem
From: Li Zhong @ 2013-05-14 2:16 UTC (permalink / raw)
To: linux-kernel; +Cc: Li Zhong, fweisbec, paulus, paulmck, linuxppc-dev
In-Reply-To: <1368497804-21706-1-git-send-email-zhong@linux.vnet.ibm.com>
This is the syscall slow path hooks for context tracking subsystem,
corresponding to
[PATCH] x86: Syscall hooks for userspace RCU extended QS
commit bf5a3c13b939813d28ce26c01425054c740d6731
TIF_MEMDIE is moved to the second 16-bits (with value 17), as it seems there
is no asm code using it. TIF_NOHZ is added to _TIF_SYCALL_T_OR_A, so it is
better for it to be in the same 16 bits with others in the group, so in the
asm code, andi. with this group could work.
Signed-off-by: Li Zhong <zhong@linux.vnet.ibm.com>
Acked-by: Frederic Weisbecker <fweisbec@gmail.com>
---
arch/powerpc/include/asm/thread_info.h | 7 +++++--
arch/powerpc/kernel/ptrace.c | 5 +++++
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/arch/powerpc/include/asm/thread_info.h b/arch/powerpc/include/asm/thread_info.h
index 8ceea14..ba7b197 100644
--- a/arch/powerpc/include/asm/thread_info.h
+++ b/arch/powerpc/include/asm/thread_info.h
@@ -97,7 +97,7 @@ static inline struct thread_info *current_thread_info(void)
#define TIF_PERFMON_CTXSW 6 /* perfmon needs ctxsw calls */
#define TIF_SYSCALL_AUDIT 7 /* syscall auditing active */
#define TIF_SINGLESTEP 8 /* singlestepping active */
-#define TIF_MEMDIE 9 /* is terminating due to OOM killer */
+#define TIF_NOHZ 9 /* in adaptive nohz mode */
#define TIF_SECCOMP 10 /* secure computing */
#define TIF_RESTOREALL 11 /* Restore all regs (implies NOERROR) */
#define TIF_NOERROR 12 /* Force successful syscall return */
@@ -106,6 +106,7 @@ static inline struct thread_info *current_thread_info(void)
#define TIF_SYSCALL_TRACEPOINT 15 /* syscall tracepoint instrumentation */
#define TIF_EMULATE_STACK_STORE 16 /* Is an instruction emulation
for stack store? */
+#define TIF_MEMDIE 17 /* is terminating due to OOM killer */
/* as above, but as bit values */
#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
@@ -124,8 +125,10 @@ static inline struct thread_info *current_thread_info(void)
#define _TIF_UPROBE (1<<TIF_UPROBE)
#define _TIF_SYSCALL_TRACEPOINT (1<<TIF_SYSCALL_TRACEPOINT)
#define _TIF_EMULATE_STACK_STORE (1<<TIF_EMULATE_STACK_STORE)
+#define _TIF_NOHZ (1<<TIF_NOHZ)
#define _TIF_SYSCALL_T_OR_A (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT | \
- _TIF_SECCOMP | _TIF_SYSCALL_TRACEPOINT)
+ _TIF_SECCOMP | _TIF_SYSCALL_TRACEPOINT | \
+ _TIF_NOHZ)
#define _TIF_USER_WORK_MASK (_TIF_SIGPENDING | _TIF_NEED_RESCHED | \
_TIF_NOTIFY_RESUME | _TIF_UPROBE)
diff --git a/arch/powerpc/kernel/ptrace.c b/arch/powerpc/kernel/ptrace.c
index 3b14d32..98c2fc1 100644
--- a/arch/powerpc/kernel/ptrace.c
+++ b/arch/powerpc/kernel/ptrace.c
@@ -32,6 +32,7 @@
#include <trace/syscall.h>
#include <linux/hw_breakpoint.h>
#include <linux/perf_event.h>
+#include <linux/context_tracking.h>
#include <asm/uaccess.h>
#include <asm/page.h>
@@ -1788,6 +1789,8 @@ long do_syscall_trace_enter(struct pt_regs *regs)
{
long ret = 0;
+ user_exit();
+
secure_computing_strict(regs->gpr[0]);
if (test_thread_flag(TIF_SYSCALL_TRACE) &&
@@ -1832,4 +1835,6 @@ void do_syscall_trace_leave(struct pt_regs *regs)
step = test_thread_flag(TIF_SINGLESTEP);
if (step || test_thread_flag(TIF_SYSCALL_TRACE))
tracehook_report_syscall_exit(regs, step);
+
+ user_enter();
}
--
1.7.9.5
^ permalink raw reply related
* [RFC PATCH v4 2/5] powerpc: Exception hooks for context tracking subsystem
From: Li Zhong @ 2013-05-14 2:16 UTC (permalink / raw)
To: linux-kernel; +Cc: Li Zhong, fweisbec, paulus, paulmck, linuxppc-dev
In-Reply-To: <1368497804-21706-1-git-send-email-zhong@linux.vnet.ibm.com>
This is the exception hooks for context tracking subsystem, including
data access, program check, single step, instruction breakpoint, machine check,
alignment, fp unavailable, altivec assist, unknown exception, whose handlers
might use RCU.
This patch corresponds to
[PATCH] x86: Exception hooks for userspace RCU extended QS
commit 6ba3c97a38803883c2eee489505796cb0a727122
But after the exception handling moved to generic code, and some changes in
following two commits:
56dd9470d7c8734f055da2a6bac553caf4a468eb
context_tracking: Move exception handling to generic code
6c1e0256fad84a843d915414e4b5973b7443d48d
context_tracking: Restore correct previous context state on exception exit
it is able for exception hooks to use the generic code above instead of a
redundant arch implementation.
Signed-off-by: Li Zhong <zhong@linux.vnet.ibm.com>
---
arch/powerpc/kernel/traps.c | 80 ++++++++++++++++++++++++++++-----------
arch/powerpc/mm/fault.c | 41 +++++++++++++-------
arch/powerpc/mm/hash_utils_64.c | 36 +++++++++++++-----
3 files changed, 112 insertions(+), 45 deletions(-)
diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c
index 83efa2f..a7a648f 100644
--- a/arch/powerpc/kernel/traps.c
+++ b/arch/powerpc/kernel/traps.c
@@ -35,6 +35,7 @@
#include <linux/kdebug.h>
#include <linux/debugfs.h>
#include <linux/ratelimit.h>
+#include <linux/context_tracking.h>
#include <asm/emulated_ops.h>
#include <asm/pgtable.h>
@@ -667,6 +668,7 @@ int machine_check_generic(struct pt_regs *regs)
void machine_check_exception(struct pt_regs *regs)
{
+ enum ctx_state prev_state = exception_enter();
int recover = 0;
__get_cpu_var(irq_stat).mce_exceptions++;
@@ -683,7 +685,7 @@ void machine_check_exception(struct pt_regs *regs)
recover = cur_cpu_spec->machine_check(regs);
if (recover > 0)
- return;
+ goto bail;
#if defined(CONFIG_8xx) && defined(CONFIG_PCI)
/* the qspan pci read routines can cause machine checks -- Cort
@@ -693,20 +695,23 @@ void machine_check_exception(struct pt_regs *regs)
* -- BenH
*/
bad_page_fault(regs, regs->dar, SIGBUS);
- return;
+ goto bail;
#endif
if (debugger_fault_handler(regs))
- return;
+ goto bail;
if (check_io_access(regs))
- return;
+ goto bail;
die("Machine check", regs, SIGBUS);
/* Must die if the interrupt is not recoverable */
if (!(regs->msr & MSR_RI))
panic("Unrecoverable Machine check");
+
+bail:
+ exception_exit(prev_state);
}
void SMIException(struct pt_regs *regs)
@@ -716,20 +721,29 @@ void SMIException(struct pt_regs *regs)
void unknown_exception(struct pt_regs *regs)
{
+ enum ctx_state prev_state = exception_enter();
+
printk("Bad trap at PC: %lx, SR: %lx, vector=%lx\n",
regs->nip, regs->msr, regs->trap);
_exception(SIGTRAP, regs, 0, 0);
+
+ exception_exit(prev_state);
}
void instruction_breakpoint_exception(struct pt_regs *regs)
{
+ enum ctx_state prev_state = exception_enter();
+
if (notify_die(DIE_IABR_MATCH, "iabr_match", regs, 5,
5, SIGTRAP) == NOTIFY_STOP)
- return;
+ goto bail;
if (debugger_iabr_match(regs))
- return;
+ goto bail;
_exception(SIGTRAP, regs, TRAP_BRKPT, regs->nip);
+
+bail:
+ exception_exit(prev_state);
}
void RunModeException(struct pt_regs *regs)
@@ -739,15 +753,20 @@ void RunModeException(struct pt_regs *regs)
void __kprobes single_step_exception(struct pt_regs *regs)
{
+ enum ctx_state prev_state = exception_enter();
+
clear_single_step(regs);
if (notify_die(DIE_SSTEP, "single_step", regs, 5,
5, SIGTRAP) == NOTIFY_STOP)
- return;
+ goto bail;
if (debugger_sstep(regs))
- return;
+ goto bail;
_exception(SIGTRAP, regs, TRAP_TRACE, regs->nip);
+
+bail:
+ exception_exit(prev_state);
}
/*
@@ -1005,6 +1024,7 @@ int is_valid_bugaddr(unsigned long addr)
void __kprobes program_check_exception(struct pt_regs *regs)
{
+ enum ctx_state prev_state = exception_enter();
unsigned int reason = get_reason(regs);
extern int do_mathemu(struct pt_regs *regs);
@@ -1014,26 +1034,26 @@ void __kprobes program_check_exception(struct pt_regs *regs)
if (reason & REASON_FP) {
/* IEEE FP exception */
parse_fpe(regs);
- return;
+ goto bail;
}
if (reason & REASON_TRAP) {
/* Debugger is first in line to stop recursive faults in
* rcu_lock, notify_die, or atomic_notifier_call_chain */
if (debugger_bpt(regs))
- return;
+ goto bail;
/* trap exception */
if (notify_die(DIE_BPT, "breakpoint", regs, 5, 5, SIGTRAP)
== NOTIFY_STOP)
- return;
+ goto bail;
if (!(regs->msr & MSR_PR) && /* not user-mode */
report_bug(regs->nip, regs) == BUG_TRAP_TYPE_WARN) {
regs->nip += 4;
- return;
+ goto bail;
}
_exception(SIGTRAP, regs, TRAP_BRKPT, regs->nip);
- return;
+ goto bail;
}
#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
if (reason & REASON_TM) {
@@ -1049,7 +1069,7 @@ void __kprobes program_check_exception(struct pt_regs *regs)
if (!user_mode(regs) &&
report_bug(regs->nip, regs) == BUG_TRAP_TYPE_WARN) {
regs->nip += 4;
- return;
+ goto bail;
}
/* If usermode caused this, it's done something illegal and
* gets a SIGILL slap on the wrist. We call it an illegal
@@ -1059,7 +1079,7 @@ void __kprobes program_check_exception(struct pt_regs *regs)
*/
if (user_mode(regs)) {
_exception(SIGILL, regs, ILL_ILLOPN, regs->nip);
- return;
+ goto bail;
} else {
printk(KERN_EMERG "Unexpected TM Bad Thing exception "
"at %lx (msr 0x%x)\n", regs->nip, reason);
@@ -1083,16 +1103,16 @@ void __kprobes program_check_exception(struct pt_regs *regs)
switch (do_mathemu(regs)) {
case 0:
emulate_single_step(regs);
- return;
+ goto bail;
case 1: {
int code = 0;
code = __parse_fpscr(current->thread.fpscr.val);
_exception(SIGFPE, regs, code, regs->nip);
- return;
+ goto bail;
}
case -EFAULT:
_exception(SIGSEGV, regs, SEGV_MAPERR, regs->nip);
- return;
+ goto bail;
}
/* fall through on any other errors */
#endif /* CONFIG_MATH_EMULATION */
@@ -1103,10 +1123,10 @@ void __kprobes program_check_exception(struct pt_regs *regs)
case 0:
regs->nip += 4;
emulate_single_step(regs);
- return;
+ goto bail;
case -EFAULT:
_exception(SIGSEGV, regs, SEGV_MAPERR, regs->nip);
- return;
+ goto bail;
}
}
@@ -1114,10 +1134,14 @@ void __kprobes program_check_exception(struct pt_regs *regs)
_exception(SIGILL, regs, ILL_PRVOPC, regs->nip);
else
_exception(SIGILL, regs, ILL_ILLOPC, regs->nip);
+
+bail:
+ exception_exit(prev_state);
}
void alignment_exception(struct pt_regs *regs)
{
+ enum ctx_state prev_state = exception_enter();
int sig, code, fixed = 0;
/* We restore the interrupt state now */
@@ -1131,7 +1155,7 @@ void alignment_exception(struct pt_regs *regs)
if (fixed == 1) {
regs->nip += 4; /* skip over emulated instruction */
emulate_single_step(regs);
- return;
+ goto bail;
}
/* Operand address was bad */
@@ -1146,6 +1170,9 @@ void alignment_exception(struct pt_regs *regs)
_exception(sig, regs, code, regs->dar);
else
bad_page_fault(regs, regs->dar, sig);
+
+bail:
+ exception_exit(prev_state);
}
void StackOverflow(struct pt_regs *regs)
@@ -1174,23 +1201,32 @@ void trace_syscall(struct pt_regs *regs)
void kernel_fp_unavailable_exception(struct pt_regs *regs)
{
+ enum ctx_state prev_state = exception_enter();
+
printk(KERN_EMERG "Unrecoverable FP Unavailable Exception "
"%lx at %lx\n", regs->trap, regs->nip);
die("Unrecoverable FP Unavailable Exception", regs, SIGABRT);
+
+ exception_exit(prev_state);
}
void altivec_unavailable_exception(struct pt_regs *regs)
{
+ enum ctx_state prev_state = exception_enter();
+
if (user_mode(regs)) {
/* A user program has executed an altivec instruction,
but this kernel doesn't support altivec. */
_exception(SIGILL, regs, ILL_ILLOPC, regs->nip);
- return;
+ goto bail;
}
printk(KERN_EMERG "Unrecoverable VMX/Altivec Unavailable Exception "
"%lx at %lx\n", regs->trap, regs->nip);
die("Unrecoverable VMX/Altivec Unavailable Exception", regs, SIGABRT);
+
+bail:
+ exception_exit(prev_state);
}
void vsx_unavailable_exception(struct pt_regs *regs)
diff --git a/arch/powerpc/mm/fault.c b/arch/powerpc/mm/fault.c
index 229951f..8726779 100644
--- a/arch/powerpc/mm/fault.c
+++ b/arch/powerpc/mm/fault.c
@@ -32,6 +32,7 @@
#include <linux/perf_event.h>
#include <linux/magic.h>
#include <linux/ratelimit.h>
+#include <linux/context_tracking.h>
#include <asm/firmware.h>
#include <asm/page.h>
@@ -196,6 +197,7 @@ static int mm_fault_error(struct pt_regs *regs, unsigned long addr, int fault)
int __kprobes do_page_fault(struct pt_regs *regs, unsigned long address,
unsigned long error_code)
{
+ enum ctx_state prev_state = exception_enter();
struct vm_area_struct * vma;
struct mm_struct *mm = current->mm;
unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE;
@@ -204,6 +206,7 @@ int __kprobes do_page_fault(struct pt_regs *regs, unsigned long address,
int trap = TRAP(regs);
int is_exec = trap == 0x400;
int fault;
+ int rc = 0;
#if !(defined(CONFIG_4xx) || defined(CONFIG_BOOKE))
/*
@@ -230,28 +233,30 @@ int __kprobes do_page_fault(struct pt_regs *regs, unsigned long address,
* look at it
*/
if (error_code & ICSWX_DSI_UCT) {
- int rc = acop_handle_fault(regs, address, error_code);
+ rc = acop_handle_fault(regs, address, error_code);
if (rc)
- return rc;
+ goto bail;
}
#endif /* CONFIG_PPC_ICSWX */
if (notify_page_fault(regs))
- return 0;
+ goto bail;
if (unlikely(debugger_fault_handler(regs)))
- return 0;
+ goto bail;
/* On a kernel SLB miss we can only check for a valid exception entry */
- if (!user_mode(regs) && (address >= TASK_SIZE))
- return SIGSEGV;
+ if (!user_mode(regs) && (address >= TASK_SIZE)) {
+ rc = SIGSEGV;
+ goto bail;
+ }
#if !(defined(CONFIG_4xx) || defined(CONFIG_BOOKE) || \
defined(CONFIG_PPC_BOOK3S_64))
if (error_code & DSISR_DABRMATCH) {
/* breakpoint match */
do_break(regs, address, error_code);
- return 0;
+ goto bail;
}
#endif
@@ -260,8 +265,10 @@ int __kprobes do_page_fault(struct pt_regs *regs, unsigned long address,
local_irq_enable();
if (in_atomic() || mm == NULL) {
- if (!user_mode(regs))
- return SIGSEGV;
+ if (!user_mode(regs)) {
+ rc = SIGSEGV;
+ goto bail;
+ }
/* in_atomic() in user mode is really bad,
as is current->mm == NULL. */
printk(KERN_EMERG "Page fault in user mode with "
@@ -417,9 +424,11 @@ good_area:
*/
fault = handle_mm_fault(mm, vma, address, flags);
if (unlikely(fault & (VM_FAULT_RETRY|VM_FAULT_ERROR))) {
- int rc = mm_fault_error(regs, address, fault);
+ rc = mm_fault_error(regs, address, fault);
if (rc >= MM_FAULT_RETURN)
- return rc;
+ goto bail;
+ else
+ rc = 0;
}
/*
@@ -454,7 +463,7 @@ good_area:
}
up_read(&mm->mmap_sem);
- return 0;
+ goto bail;
bad_area:
up_read(&mm->mmap_sem);
@@ -463,7 +472,7 @@ bad_area_nosemaphore:
/* User mode accesses cause a SIGSEGV */
if (user_mode(regs)) {
_exception(SIGSEGV, regs, code, address);
- return 0;
+ goto bail;
}
if (is_exec && (error_code & DSISR_PROTFAULT))
@@ -471,7 +480,11 @@ bad_area_nosemaphore:
" page (%lx) - exploit attempt? (uid: %d)\n",
address, from_kuid(&init_user_ns, current_uid()));
- return SIGSEGV;
+ rc = SIGSEGV;
+
+bail:
+ exception_exit(prev_state);
+ return rc;
}
diff --git a/arch/powerpc/mm/hash_utils_64.c b/arch/powerpc/mm/hash_utils_64.c
index 88ac0ee..e303a6d 100644
--- a/arch/powerpc/mm/hash_utils_64.c
+++ b/arch/powerpc/mm/hash_utils_64.c
@@ -33,6 +33,7 @@
#include <linux/init.h>
#include <linux/signal.h>
#include <linux/memblock.h>
+#include <linux/context_tracking.h>
#include <asm/processor.h>
#include <asm/pgtable.h>
@@ -954,6 +955,7 @@ void hash_failure_debug(unsigned long ea, unsigned long access,
*/
int hash_page(unsigned long ea, unsigned long access, unsigned long trap)
{
+ enum ctx_state prev_state = exception_enter();
pgd_t *pgdir;
unsigned long vsid;
struct mm_struct *mm;
@@ -973,7 +975,8 @@ int hash_page(unsigned long ea, unsigned long access, unsigned long trap)
mm = current->mm;
if (! mm) {
DBG_LOW(" user region with no mm !\n");
- return 1;
+ rc = 1;
+ goto bail;
}
psize = get_slice_psize(mm, ea);
ssize = user_segment_size(ea);
@@ -992,19 +995,23 @@ int hash_page(unsigned long ea, unsigned long access, unsigned long trap)
/* Not a valid range
* Send the problem up to do_page_fault
*/
- return 1;
+ rc = 1;
+ goto bail;
}
DBG_LOW(" mm=%p, mm->pgdir=%p, vsid=%016lx\n", mm, mm->pgd, vsid);
/* Bad address. */
if (!vsid) {
DBG_LOW("Bad address!\n");
- return 1;
+ rc = 1;
+ goto bail;
}
/* Get pgdir */
pgdir = mm->pgd;
- if (pgdir == NULL)
- return 1;
+ if (pgdir == NULL) {
+ rc = 1;
+ goto bail;
+ }
/* Check CPU locality */
tmp = cpumask_of(smp_processor_id());
@@ -1027,7 +1034,8 @@ int hash_page(unsigned long ea, unsigned long access, unsigned long trap)
ptep = find_linux_pte_or_hugepte(pgdir, ea, &hugeshift);
if (ptep == NULL || !pte_present(*ptep)) {
DBG_LOW(" no PTE !\n");
- return 1;
+ rc = 1;
+ goto bail;
}
/* Add _PAGE_PRESENT to the required access perm */
@@ -1038,13 +1046,16 @@ int hash_page(unsigned long ea, unsigned long access, unsigned long trap)
*/
if (access & ~pte_val(*ptep)) {
DBG_LOW(" no access !\n");
- return 1;
+ rc = 1;
+ goto bail;
}
#ifdef CONFIG_HUGETLB_PAGE
- if (hugeshift)
- return __hash_page_huge(ea, access, vsid, ptep, trap, local,
+ if (hugeshift) {
+ rc = __hash_page_huge(ea, access, vsid, ptep, trap, local,
ssize, hugeshift, psize);
+ goto bail;
+ }
#endif /* CONFIG_HUGETLB_PAGE */
#ifndef CONFIG_PPC_64K_PAGES
@@ -1124,6 +1135,9 @@ int hash_page(unsigned long ea, unsigned long access, unsigned long trap)
pte_val(*(ptep + PTRS_PER_PTE)));
#endif
DBG_LOW(" -> rc=%d\n", rc);
+
+bail:
+ exception_exit(prev_state);
return rc;
}
EXPORT_SYMBOL_GPL(hash_page);
@@ -1259,6 +1273,8 @@ void flush_hash_range(unsigned long number, int local)
*/
void low_hash_fault(struct pt_regs *regs, unsigned long address, int rc)
{
+ enum ctx_state prev_state = exception_enter();
+
if (user_mode(regs)) {
#ifdef CONFIG_PPC_SUBPAGE_PROT
if (rc == -2)
@@ -1268,6 +1284,8 @@ void low_hash_fault(struct pt_regs *regs, unsigned long address, int rc)
_exception(SIGBUS, regs, BUS_ADRERR, address);
} else
bad_page_fault(regs, address, SIGBUS);
+
+ exception_exit(prev_state);
}
long hpte_insert_repeating(unsigned long hash, unsigned long vpn,
--
1.7.9.5
^ permalink raw reply related
* [RFC PATCH v4 3/5] powerpc: Exit user context on notify resume
From: Li Zhong @ 2013-05-14 2:16 UTC (permalink / raw)
To: linux-kernel; +Cc: Li Zhong, fweisbec, paulus, paulmck, linuxppc-dev
In-Reply-To: <1368497804-21706-1-git-send-email-zhong@linux.vnet.ibm.com>
This patch allows RCU usage in do_notify_resume, e.g. signal handling.
It corresponds to
[PATCH] x86: Exit RCU extended QS on notify resume
commit edf55fda35c7dc7f2d9241c3abaddaf759b457c6
Signed-off-by: Li Zhong <zhong@linux.vnet.ibm.com>
---
arch/powerpc/kernel/signal.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/arch/powerpc/kernel/signal.c b/arch/powerpc/kernel/signal.c
index cf12eae..d63b502 100644
--- a/arch/powerpc/kernel/signal.c
+++ b/arch/powerpc/kernel/signal.c
@@ -13,6 +13,7 @@
#include <linux/signal.h>
#include <linux/uprobes.h>
#include <linux/key.h>
+#include <linux/context_tracking.h>
#include <asm/hw_breakpoint.h>
#include <asm/uaccess.h>
#include <asm/unistd.h>
@@ -159,6 +160,8 @@ static int do_signal(struct pt_regs *regs)
void do_notify_resume(struct pt_regs *regs, unsigned long thread_info_flags)
{
+ user_exit();
+
if (thread_info_flags & _TIF_UPROBE)
uprobe_notify_resume(regs);
@@ -169,4 +172,6 @@ void do_notify_resume(struct pt_regs *regs, unsigned long thread_info_flags)
clear_thread_flag(TIF_NOTIFY_RESUME);
tracehook_notify_resume(regs);
}
+
+ user_enter();
}
--
1.7.9.5
^ permalink raw reply related
* [RFC PATCH v4 4/5] powerpc: Use the new schedule_user API on userspace preemption
From: Li Zhong @ 2013-05-14 2:16 UTC (permalink / raw)
To: linux-kernel; +Cc: Li Zhong, fweisbec, paulus, paulmck, linuxppc-dev
In-Reply-To: <1368497804-21706-1-git-send-email-zhong@linux.vnet.ibm.com>
This patch corresponds to
[PATCH] x86: Use the new schedule_user API on userspace preemption
commit 0430499ce9d78691f3985962021b16bf8f8a8048
Signed-off-by: Li Zhong <zhong@linux.vnet.ibm.com>
---
arch/powerpc/include/asm/context_tracking.h | 10 ++++++++++
arch/powerpc/kernel/entry_64.S | 3 ++-
2 files changed, 12 insertions(+), 1 deletion(-)
create mode 100644 arch/powerpc/include/asm/context_tracking.h
diff --git a/arch/powerpc/include/asm/context_tracking.h b/arch/powerpc/include/asm/context_tracking.h
new file mode 100644
index 0000000..b6f5a33
--- /dev/null
+++ b/arch/powerpc/include/asm/context_tracking.h
@@ -0,0 +1,10 @@
+#ifndef _ASM_POWERPC_CONTEXT_TRACKING_H
+#define _ASM_POWERPC_CONTEXT_TRACKING_H
+
+#ifdef CONFIG_CONTEXT_TRACKING
+#define SCHEDULE_USER bl .schedule_user
+#else
+#define SCHEDULE_USER bl .schedule
+#endif
+
+#endif
diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S
index 915fbb4..d418977 100644
--- a/arch/powerpc/kernel/entry_64.S
+++ b/arch/powerpc/kernel/entry_64.S
@@ -33,6 +33,7 @@
#include <asm/irqflags.h>
#include <asm/ftrace.h>
#include <asm/hw_irq.h>
+#include <asm/context_tracking.h>
/*
* System calls.
@@ -634,7 +635,7 @@ _GLOBAL(ret_from_except_lite)
andi. r0,r4,_TIF_NEED_RESCHED
beq 1f
bl .restore_interrupts
- bl .schedule
+ SCHEDULE_USER
b .ret_from_except_lite
1: bl .save_nvgprs
--
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