* Re: [PATCH] Fix interrupt distribution in ppc970
From: Mohan Kumar M @ 2007-06-04 10:54 UTC (permalink / raw)
To: Milton Miller; +Cc: ppcdev, kexec, Paul Mackerras
In-Reply-To: <ca045e7e6fde9345b3461214777d8102@bga.com>
Milton,
How about this patch?
=============================================================
In some of the PPC970 based systems, interrupt would be distributed to
offline cpus also even when booted with "maxcpus=1". So check whether
cpu online map and cpu present map are equal or not. If they are equal
default_distrib_server is used as interrupt server otherwise boot cpu
(default_server) used as interrupt server.
In addition to this, if an interrupt is assigned to a specific cpu (ie
smp affinity) and if that cpu is not online, the earlier code used to
return the default_distrib_server as interrupt server. This patch
introduces an additional paramter to the get_irq function ie
strict_check, based on this parameter, if the cpu is not online either
default_distrib_server or -1 is returned.
Cc: Milton Miller <miltonm@bga.com>,
Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Mohan Kumar M <mohan@in.ibm.com>
---
arch/powerpc/platforms/pseries/xics.c | 54 ++++++++++++++++++----------------
1 file changed, 29 insertions(+), 25 deletions(-)
Index: linux-2.6.21.1/arch/powerpc/platforms/pseries/xics.c
===================================================================
--- linux-2.6.21.1.orig/arch/powerpc/platforms/pseries/xics.c
+++ linux-2.6.21.1/arch/powerpc/platforms/pseries/xics.c
@@ -156,9 +156,9 @@ static inline void lpar_qirr_info(int n_
#ifdef CONFIG_SMP
-static int get_irq_server(unsigned int virq)
+static int get_irq_server(unsigned int virq, unsigned int strict_check)
{
- unsigned int server;
+ int server;
/* For the moment only implement delivery to all cpus or one cpu */
cpumask_t cpumask = irq_desc[virq].affinity;
cpumask_t tmp = CPU_MASK_NONE;
@@ -166,22 +166,24 @@ static int get_irq_server(unsigned int v
if (!distribute_irqs)
return default_server;
- if (cpus_equal(cpumask, CPU_MASK_ALL)) {
- server = default_distrib_server;
- } else {
+ if (!cpus_equal(cpumask, CPU_MASK_ALL)) {
cpus_and(tmp, cpu_online_map, cpumask);
- if (cpus_empty(tmp))
- server = default_distrib_server;
- else
- server = get_hard_smp_processor_id(first_cpu(tmp));
- }
+ server = first_cpu(tmp);
- return server;
+ if (server < NR_CPUS)
+ return get_hard_smp_processor_id(server);
+ else if (strict_check)
+ return -1;
+ }
+ if (cpus_equal(cpu_online_map, cpu_present_map))
+ return default_distrib_server;
+ else
+ return default_server;
}
#else
-static int get_irq_server(unsigned int virq)
+static int get_irq_server(unsigned int virq, unsigned int strict_check)
{
return default_server;
}
@@ -192,7 +194,7 @@ static void xics_unmask_irq(unsigned int
{
unsigned int irq;
int call_status;
- unsigned int server;
+ int server;
pr_debug("xics: unmask virq %d\n", virq);
@@ -201,7 +203,7 @@ static void xics_unmask_irq(unsigned int
if (irq == XICS_IPI || irq == XICS_IRQ_SPURIOUS)
return;
- server = get_irq_server(virq);
+ server = get_irq_server(virq, 0);
call_status = rtas_call(ibm_set_xive, 3, 1, NULL, irq, server,
DEFAULT_PRIORITY);
@@ -398,8 +400,7 @@ static void xics_set_affinity(unsigned i
unsigned int irq;
int status;
int xics_status[2];
- unsigned long newmask;
- cpumask_t tmp = CPU_MASK_NONE;
+ int irq_server;
irq = (unsigned int)irq_map[virq].hwirq;
if (irq == XICS_IPI || irq == XICS_IRQ_SPURIOUS)
@@ -413,18 +414,21 @@ static void xics_set_affinity(unsigned i
return;
}
- /* For the moment only implement delivery to all cpus or one cpu */
- if (cpus_equal(cpumask, CPU_MASK_ALL)) {
- newmask = default_distrib_server;
- } else {
- cpus_and(tmp, cpu_online_map, cpumask);
- if (cpus_empty(tmp))
- return;
- newmask = get_hard_smp_processor_id(first_cpu(tmp));
+ /*
+ * For the moment only implement delivery to all cpus or one cpu.
+ * Get current irq_server for the given irq
+ */
+ irq_server = get_irq_server(irq, 1);
+ if (irq_server == -1) {
+ char cpulist[128];
+ cpulist_scnprintf(cpulist, sizeof(cpulist), cpumask);
+ printk(KERN_WARNING "xics_set_affinity: No online cpus in "
+ "the mask %s for irq %d\n", cpulist, virq);
+ return;
}
status = rtas_call(ibm_set_xive, 3, 1, NULL,
- irq, newmask, xics_status[1]);
+ irq, irq_server, xics_status[1]);
if (status) {
printk(KERN_ERR "xics_set_affinity: irq=%u ibm,set-xive "
^ permalink raw reply
* Re: kexec on PS3
From: Michael Neuling @ 2007-06-04 10:50 UTC (permalink / raw)
To: Bernhard Walle; +Cc: linuxppc-dev, Stefan Assmann, kexec
In-Reply-To: <20070604095433.GB29457@suse.de>
> At http://www.powerdeveloper.org/platforms/cell/playstation there are
> some patches that are required for kexec-tools to use kdump on the
> Play Station 3. Wouldn't it make sense to merge them in kexec-tools
> testing?
Yes.
> kexec-tools-1.101-bootargs-align.patch is already discussed here in
> the thread "kexec ppc64: fix misaligned cmdline". But what about
> kexec-tools-1.101-ps3-rmo_top-max.patch and
> kexec-tools-1.101-align-dtstruct.patch?
This doesn't fix the problem mentioned by Milton.
> I'm not the author, and I don't know how to contact the author of that
> patches, but I'd like to see them in mainline kexec-tools.
Bugger. It would make sense to merge them, especially since they are
fixing generic powerpc problems.
If you can get a signed off by the author, that would be awesome!
Mikey
^ permalink raw reply
* Re: [PATCH] powerpc: Fix build on !CONFIG_IRQSTACKS
From: Segher Boessenkool @ 2007-06-04 10:42 UTC (permalink / raw)
To: Segher Boessenkool; +Cc: linuxppc-dev
In-Reply-To: <11809516982524-git-send-email-segher@kernel.crashing.org>
> arch/powerpc/kernel/irq.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
Ignore, local screw-up. Whoops.
Segher
^ permalink raw reply
* Re: [PATCH v2]: Fix e500 v2 core reboot bug
From: Segher Boessenkool @ 2007-06-04 10:37 UTC (permalink / raw)
To: Zang Roy-r61911; +Cc: linuxppc-dev list, Paul Mackerras
In-Reply-To: <1180947682.10048.23.camel@localhost.localdomain>
>>>> guts@e00000 {
>> If "guts" is some kind of official name (i.e., the
>> block is called that in the user manual), it looks
>> okay to me.
> No! It is not official name. It is provided by Kumar. It should be a
> abbr. standing for "Global Utilities" as far as my understand.
So the official name is "global utilities block"?
>> Otherwise, please change; in fact, just
>> change the name anyway (not the compatible), to
>> "shared-soc-regs" or something like that;
> I can not agree with you. "shared-soc-regs" can not describe the
> property of this kind of register.
> The official description for this set of registers:
>
> "The global utilities block controls power management, I/O device
> enabling, power-on-reset (POR) configuration monitoring,
> general-purpose
> I/O signal configuration, alternate function selection for multiplexed
> signals, and clock control.
>
> gub (Kumar's style?): global utilities block
> or
> global-uti-regs or global-uti (Segher's style?)
> may be better.
"global-utilities" sounds fine to me, although the
name doesn't actually say anything. Let's avoid
abbr.s unless they are very widely known.
>> "name"
>> should be descriptive (but terse).
>>
> Agree!
> But we should reach a agreement!
Nah, you guys just need to come up with a good name :-)
I would just call it "control" perhaps ;-)
It doesn't matter much, but "name" should be human-
readable, human-understandable, and short. A made-up
acronym doesn't work (although I like "guts", sure --
put it in your "compatible" property ;-) )
Segher
^ permalink raw reply
* Regarding MPC8560 porting
From: b.vigneshkumar @ 2007-06-04 10:03 UTC (permalink / raw)
To: linuxppc-embedded
[-- Attachment #1: Type: text/plain, Size: 287 bytes --]
Hi
I am using 2.6.21 linux kernel for porting to MPC8560. I want to set the
CCSRBAR value to 0xFDF0 0000.
But in the arch/powerpc/platforms/85xx/ location the mpc85xx file has
some thing like (get_immrbase() + MPC85xx_CPM_OFFSET)
So where do I set my CCSRBAR value.
Regards,
Vignesh
[-- Attachment #2: b.vigneshkumar.vcf --]
[-- Type: text/x-vcard, Size: 178 bytes --]
begin:vcard
fn:Vignesh Kumar Bagavathsingh
n:Bagavathsingh;Vignesh Kumar
email;internet:b.vigneshkumar@gdatech.com
tel;work:6513
tel;home:044-23773210
version:2.1
end:vcard
^ permalink raw reply
* Re: PATCH 19/21] powerpc: Merge creation of signal frame (#2)
From: Benjamin Herrenschmidt @ 2007-06-04 10:04 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: linuxppc-dev, Paul Mackerras, cbe-oss-dev
In-Reply-To: <20070604080126.GA19961@lst.de>
On Mon, 2007-06-04 at 10:01 +0200, Christoph Hellwig wrote:
> On Mon, Jun 04, 2007 at 05:22:48PM +1000, Benjamin Herrenschmidt wrote:
> > +/*
> > + * Allocate space for the signal frame
> > + */
> > +void __user * get_sigframe(struct k_sigaction *ka, struct pt_regs *regs,
> > + size_t frame_size)
>
> little style nitpick: no whitespace after the *, please.
Heh... just copy pasted what was there :-) I'll rip it out for the next
round :-)
> > +{
> > + unsigned long oldsp, newsp;
> > +
> > + /* Default to using normal stack */
> > + oldsp = regs->gpr[1];
> > +
> > + /* Check for alt stack */
> > + if ((ka->sa.sa_flags & SA_ONSTACK) &&
> > + current->sas_ss_size && !on_sig_stack(oldsp))
> > + oldsp = (current->sas_ss_sp + current->sas_ss_size);
> > +
> > + /* Get aligned frame */
> > + newsp = (oldsp - frame_size) & ~0xFUL;
> > +
> > + /* Check access */
> > + if (!access_ok(VERIFY_WRITE, (void __user *)newsp, oldsp - newsp))
> > + return NULL;
> > +
> > + return (void __user *)newsp;
> > +}
>
> The body also has some odd whitespace problems. I'd also make
> newsp a void __user variable to only do the cast once. In the end the
> function should looks something like:
Makes sense.
Thanks,
Ben.
^ permalink raw reply
* Re: [PATCH] kexec ppc64: fix misaligned cmdline
From: Michael Neuling @ 2007-06-04 9:42 UTC (permalink / raw)
To: Milton Miller; +Cc: linuxppc-dev, horms, kexec
In-Reply-To: <8f5d8a214e9042b0c556ac7256928a52@bga.com>
> While this appears to fix the stated problem, did you explore my
> suggestion of deleting and creating the property like we do for
> the initrd base and size?
Yeah, but it didn't seem "hapazard" enough for kexec. :-)
> Deleting and recreating should also handle the case of no boot-args in
> the original /chosen sub-tree (when the bootloader didn't (need to)
> supply a command line).
Yeah, we're screwed when the first boot has no bootargs.
Let me get the policy right. We blow away the old command line except
for the "root=blah" item. Correct?
Mikey
^ permalink raw reply
* Re: [PATCH] kexec ppc64: fix misaligned cmdline
From: Milton Miller @ 2007-06-04 9:22 UTC (permalink / raw)
To: Michael Neuling; +Cc: linuxppc-dev, horms, kexec
In-Reply-To: <25445.1180941825@neuling.org>
On Jun 4, 2007, at 2:23 AM, Michael Neuling wrote:
> If the cmdline changes between boots, we can get misalignment of the
> bootargs entry, which in turn corrupts our device tree blob and hence
> kills our kexec boot.
...
> - if ((len >= 8) && ((unsigned long)dt & 0x4))
> + if ((len >= 8) && ((unsigned long)dt & 0x4)){
> dt++;
> + dt_realigned = 1;
> + }
>
> fd = open(pathname, O_RDONLY);
> if (fd == -1)
> @@ -283,6 +286,8 @@ static void putprops(char *fn, struct di
> strcat(local_cmdline, " ");
> cmd_len = strlen(local_cmdline);
> cmd_len = cmd_len + 1;
> + if (dt_realigned && cmd_len < 8)
> + dt--;
>
While this appears to fix the stated problem, did you explore my
suggestion of deleting and creating the property like we do for
the initrd base and size?
Deleting and recreating should also handle the case of no
boot-args in the original /chosen sub-tree (when the bootloader
didn't (need to) supply a command line).
milton
^ permalink raw reply
* Re: [PATCH v2]: Fix e500 v2 core reboot bug
From: Zang Roy-r61911 @ 2007-06-04 9:01 UTC (permalink / raw)
To: Segher Boessenkool; +Cc: linuxppc-dev list, Paul Mackerras
In-Reply-To: <dc4e7ef8f03da79b9322f21b8b82c6d9@kernel.crashing.org>
On Mon, 2007-06-04 at 16:41, Segher Boessenkool wrote:
> >> After some discussion on IRC I think the following is the suggested
> >> node we should add in.
> >>
> >> guts@e00000 {
> >> compatible = "fsl,mpc8548-guts";
> >> reg = <e00000 1000>;
> > one more zero!
>
> Yeah.
>
> >> fsl,has-rstcr;
> >> };
>
> If "guts" is some kind of official name (i.e., the
> block is called that in the user manual), it looks
> okay to me.
No! It is not official name. It is provided by Kumar. It should be a
abbr. standing for "Global Utilities" as far as my understand.
> Otherwise, please change; in fact, just
> change the name anyway (not the compatible), to
> "shared-soc-regs" or something like that;
I can not agree with you. "shared-soc-regs" can not describe the
property of this kind of register.
The official description for this set of registers:
"The global utilities block controls power management, I/O device
enabling, power-on-reset (POR) configuration monitoring, general-purpose
I/O signal configuration, alternate function selection for multiplexed
signals, and clock control.
gub (Kumar's style?): global utilities block
or
global-uti-regs or global-uti (Segher's style?)
may be better.
> "name"
> should be descriptive (but terse).
>
Agree!
But we should reach a agreement!
Thanks.
Roy
^ permalink raw reply
* Re: [PATCH v2]: Fix e500 v2 core reboot bug
From: Segher Boessenkool @ 2007-06-04 8:41 UTC (permalink / raw)
To: Zang Roy-r61911; +Cc: linuxppc-dev list, Paul Mackerras
In-Reply-To: <1180945726.10048.0.camel@localhost.localdomain>
>> After some discussion on IRC I think the following is the suggested
>> node we should add in.
>>
>> guts@e00000 {
>> compatible = "fsl,mpc8548-guts";
>> reg = <e00000 1000>;
> one more zero!
Yeah.
>> fsl,has-rstcr;
>> };
If "guts" is some kind of official name (i.e., the
block is called that in the user manual), it looks
okay to me. Otherwise, please change; in fact, just
change the name anyway (not the compatible), to
"shared-soc-regs" or something like that; "name"
should be descriptive (but terse).
Segher
^ permalink raw reply
* Re: 2.6.22-rc3-mm1
From: Segher Boessenkool @ 2007-06-04 8:35 UTC (permalink / raw)
To: michael; +Cc: linuxppc-dev, Mariusz Kozlowski, Andrew Morton
In-Reply-To: <1180924186.5476.3.camel@concordia.ozlabs.ibm.com>
>> BTW. This is 'make allnoconfig && make' result:
>>
>> MODPOST vmlinux
>> ln: accessing `arch/powerpc/boot/zImage': No such file or directory
>> make[1]: *** [arch/powerpc/boot/zImage] Error 1
>> make: *** [zImage] Error 2
>
> If you check your .config I think you'll find you have none of the
> powerpc platforms selected, which means you don't get a zImage.
Which is simply a Makefile bug.
> And your
> kernel won't boot on any actual hardware either :)
I've never seen any allnoconfig kernel do that ;-)
> Perhaps one of the platforms should be the default if nothing else is
> selected, just so allnoconfig works.
Nah, just don't create the zImage link if $(image-y)
is empty.
Segher
^ permalink raw reply
* Re: [PATCH v2]: Fix e500 v2 core reboot bug
From: Zang Roy-r61911 @ 2007-06-04 8:28 UTC (permalink / raw)
To: Kumar Gala; +Cc: linuxppc-dev list, Paul Mackerras
In-Reply-To: <976AFF56-7590-46B9-ADCA-4FA6673D4C9B@kernel.crashing.org>
On Wed, 2007-05-30 at 21:49, Kumar Gala wrote:
> >>>>> I'm not terrible happy with blindly writing to rstcr.
> >>>>>
> >>>> I can understand you.
> >>>> But I jut want to make things simple and workable.
> >>>> Any idea?
> >>>
> >>> one idea would be for us to add a property on the soc node.
> >>> Something like has-rstcr or something similar in a guts node?
> >> I have seen your suggestion before to add a property in device
> tree.
> >> But I still think the current implementation is simple.
> >
> > While it simple you are depending on the fact that a given
> > implementation may or may not have something at the particular
> > offset. Who knows if 8599 or some future part could put the 'cause
> > my part to smoke and self-destruct' at the same offset in the
> > future :)
> >
> >> Anyway, I can try your suggestion.
> >
> > I'm thinking have a guts block and putting a property in it makes
> the
> > most sense.
>
> After some discussion on IRC I think the following is the suggested
> node we should add in.
>
> guts@e00000 {
> compatible = "fsl,mpc8548-guts";
> reg = <e00000 1000>;
one more zero!
> fsl,has-rstcr;
> };
^ permalink raw reply
* Re: [PATCH 2/8] Add uli1575 pci-bridge sector to MPC8641HPCN dts file.
From: Segher Boessenkool @ 2007-06-04 8:18 UTC (permalink / raw)
To: Olof Johansson; +Cc: Jon Loeliger, linuxppc-dev@ozlabs.org
In-Reply-To: <20070604001639.GA25972@lixom.net>
>> They aren't -that- good when you come out of the blue and don't know
>> where to start. I think a tutorial based on building a tree for an
>> example board step by step would be best.
>
> There seems to be two things that causes problems:
0) The lack of good, clear, exhaustive, and recipe-style
documentation.
> 1) People basing their new tree on an old example that's broken, and
> getting crap for that because it's not correct
Yeah.
> 2) Trying to add new devices that aren't in any trees already, and
> the near infinite discussions that then start.
This is a *good* thing (as long as it's productive) --
it simply is a lot of work to define a good device binding
for non-trivial devices.
> (2) I don't have a good solution for. Better documentation pointers
> would
> definitely be a help, but it's not the whole solution. I'd expect it to
> get better and better over time as there'll be less and less unmapped
> terrain, and better and better examples to use.
We can only hope :-)
Segher
^ permalink raw reply
* Re: ps3 64-bit kernel: patched prpmc2800.c (fwd)
From: Segher Boessenkool @ 2007-06-04 8:14 UTC (permalink / raw)
To: Mark A. Greer; +Cc: linuxppc-dev, Maik Nijhuis, Paul Mackerras
In-Reply-To: <20070603232529.GA24977@mag.az.mvista.com>
>> It is a binutils bug, and Alan Modra has a patch for it. In the
>> meantime the best thing would be to change that to
>>
>> rlwinm 10,10,0,17,15
>>
>> which is equivalent.
>
> Oops, I totally missed this thread. I'll whip up a patch for this on
> Monday.
Unless I'm mistaken, this bug doesn't exist in any released
version of binutils, so no kernel patch should be necessary
(people using a development version of binutils should just
upgrade to the latest, which has this fixed already).
Segher
^ permalink raw reply
* Re: [PATCH] powerpc: Create "rom" (MTD) device prpmc2800
From: Segher Boessenkool @ 2007-06-04 8:11 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: linuxppc-dev, linux-mtd, Milton Miller
In-Reply-To: <1180905120.31677.22.camel@localhost.localdomain>
> Regarding physical address ranges for the flash mapping, I suppose the
> best is to define a property for flash chips for it.
There is, namely "reg". How to best describe flash chips
interleaved on the bus is still an open problem. And things
like combining two sequential in address space flash chips
into a virtual one, or describing flash "partitions" doesn't
belong in the device tree at all; it is a policy thing, not
a hardware thing.
Segher
^ permalink raw reply
* Re: [PATCH] powerpc: Create "rom" (MTD) device prpmc2800
From: Segher Boessenkool @ 2007-06-04 8:07 UTC (permalink / raw)
To: Sergei Shtylyov; +Cc: linuxppc-dev, linux-mtd, Milton Miller
In-Reply-To: <466323EF.5040807@ru.mvista.com>
>>>> This has nothing to do with a "chip level", it is plain and
>>>> simply the most basic device tree stuff.
>
>>> If it was as "plain and simple" as you say, there would be
>>> nothing to argue about.
>
>> There isn't as far as I am concerned; the purpose and
>> meaning of the "compatible" property, as well as of any
>> other standard OF properties, is clear.
>
> Erm, concerning matching those with drivers it wasn't as clear that
> those props aren't the same as driver names b/c of the follwing
> passage in Generic Names:
[huge snip]
Please point out the exact passage you don't understand, and
what you don't understand about it, if you want any help.
>> Yes, the more complex (and sometimes insane) ways that
>> flash chips are connected to systems can be really hard
>> to describe properly. Which is why I don't even want
>> to make a "binding" for it (yet). It seems easy enough
>
> Neither do we. :-)
>
>> to do this for single flash chips (possibly direct-mapped)
>> though.
>
> Erm, FSL boards seem to generally have dual 16-bit NOR flash chips
> interleaved -- and that's seems quite a common case, not only in PPC
> world.
It's not all that common; I can see why it would be used on
flash controllers that handle a 32-bit bus only.
> Perhaps... those interleaved chips could really be merged
> (abstracted) into a single one, with the bus width being a sum of two?
Perhaps. It is a nasty situation, it'll take long hard
thinking to come up with a reasonably good solution.
>> Get the simple cases
>> (that actually are used in real life) right, first.
>
> We pursued this task exactly. Get it working, quick. :-)
That is something *TOTALLY DIFFERENT* and quite a bad plan
IMNSHO.
Segher
^ permalink raw reply
* Re: [PATCH] powerpc: Create "rom" (MTD) device prpmc2800
From: Segher Boessenkool @ 2007-06-04 8:02 UTC (permalink / raw)
To: Sergei Shtylyov; +Cc: ppcdev, linux-mtd, Milton Miller
In-Reply-To: <4663203F.30301@ru.mvista.com>
>> flash node obviously needs _some_ parent node though --
>> this is a tree after all.
>
> Yes, of course it always has a perent. The question is which parent
> it should be. :-)
Almosts always the correct choice is the physical
bridge/controller for the bus the flash sits on.
>> That is described in the "reg" property of the flash
>> node, just like for any other node.
>
> Ah. So simple. :-)
> What I failed to realize so far was that "ranges" imply 1:1 address
> correspondence. But not all is so simple, I'm afraid. The flash chips
> themselves could be connected to their bus in some weird fashion, I'm
> afraid
In that case it is not direct-mapped, you have no "ranges"
in the parent node, and the kernel driver for the parent
node will know how to access its child bus.
>> It seems we really need more howto-style docs...
>
> It may indeed be non-trivial task to find all the necessary specs
> besides 1285 itself -- I just happened to know where to grab them
> beforehand:
1275
> http://www.openbios.org/Bindings
There is only a subset there. http://playground.sun.com/1275/
is the canonical location; there is a bunch of good docs in
the Sun library thing too (search for "FCode" or "OpenBoot").
Much of that has to do with using real OF, but lots of it is
valid/useful for a bare device tree as well.
Segher
^ permalink raw reply
* Re: PATCH 19/21] powerpc: Merge creation of signal frame (#2)
From: Christoph Hellwig @ 2007-06-04 8:01 UTC (permalink / raw)
To: Benjamin Herrenschmidt
Cc: linuxppc-dev, Paul Mackerras, Christoph Hellwig, cbe-oss-dev
In-Reply-To: <1180941768.31677.50.camel@localhost.localdomain>
On Mon, Jun 04, 2007 at 05:22:48PM +1000, Benjamin Herrenschmidt wrote:
> +/*
> + * Allocate space for the signal frame
> + */
> +void __user * get_sigframe(struct k_sigaction *ka, struct pt_regs *regs,
> + size_t frame_size)
little style nitpick: no whitespace after the *, please.
> +{
> + unsigned long oldsp, newsp;
> +
> + /* Default to using normal stack */
> + oldsp = regs->gpr[1];
> +
> + /* Check for alt stack */
> + if ((ka->sa.sa_flags & SA_ONSTACK) &&
> + current->sas_ss_size && !on_sig_stack(oldsp))
> + oldsp = (current->sas_ss_sp + current->sas_ss_size);
> +
> + /* Get aligned frame */
> + newsp = (oldsp - frame_size) & ~0xFUL;
> +
> + /* Check access */
> + if (!access_ok(VERIFY_WRITE, (void __user *)newsp, oldsp - newsp))
> + return NULL;
> +
> + return (void __user *)newsp;
> +}
The body also has some odd whitespace problems. I'd also make
newsp a void __user variable to only do the cast once. In the end the
function should looks something like:
void __user *get_sigframe(struct k_sigaction *ka, struct pt_regs *regs,
size_t frame_size)
{
unsigned long oldsp;
void __user *newsp;
/* Check for alt stack */
if ((ka->sa.sa_flags & SA_ONSTACK) &&
current->sas_ss_size && !on_sig_stack(oldsp))
oldsp = (current->sas_ss_sp + current->sas_ss_size);
else
oldsp = regs->gpr[1];
/* Get aligned frame */
newsp = (void __user *)((oldsp - frame_size) & ~0xFUL);
/* Check access */
if (!access_ok(VERIFY_WRITE, newsp, oldsp - newsp))
return NULL;
return newsp;
}
^ permalink raw reply
* [PATCH] kexec ppc64: fix misaligned cmdline
From: Michael Neuling @ 2007-06-04 7:23 UTC (permalink / raw)
To: horms; +Cc: kexec, miltonm, linuxppc-dev
If the cmdline changes between boots, we can get misalignment of the
bootargs entry, which in turn corrupts our device tree blob and hence
kills our kexec boot.
Specifically, if the cmdline length was >= 8 before and the new cmdline
length is < 8, we can get corruption.
Signed-off-by: Michael Neuling <mikey@neuling.org>
---
kexec/arch/ppc64/fs2dt.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
Index: kexec-tools-testing/kexec/arch/ppc64/fs2dt.c
===================================================================
--- kexec-tools-testing.orig/kexec/arch/ppc64/fs2dt.c
+++ kexec-tools-testing/kexec/arch/ppc64/fs2dt.c
@@ -197,6 +197,7 @@ static void putprops(char *fn, struct di
struct dirent *dp;
int i = 0, fd, len;
struct stat statbuf;
+ int dt_realigned = 0;
for (i = 0; i < numlist; i++) {
dp = nlist[i];
@@ -243,8 +244,10 @@ static void putprops(char *fn, struct di
*dt++ = len;
*dt++ = propnum(fn);
- if ((len >= 8) && ((unsigned long)dt & 0x4))
+ if ((len >= 8) && ((unsigned long)dt & 0x4)){
dt++;
+ dt_realigned = 1;
+ }
fd = open(pathname, O_RDONLY);
if (fd == -1)
@@ -283,6 +286,8 @@ static void putprops(char *fn, struct di
strcat(local_cmdline, " ");
cmd_len = strlen(local_cmdline);
cmd_len = cmd_len + 1;
+ if (dt_realigned && cmd_len < 8)
+ dt--;
memcpy(dt, local_cmdline,cmd_len);
len = cmd_len;
*dt_len = cmd_len;
^ permalink raw reply
* PATCH 19/21] powerpc: Merge creation of signal frame (#2)
From: Benjamin Herrenschmidt @ 2007-06-04 7:22 UTC (permalink / raw)
To: linuxppc-dev; +Cc: Paul Mackerras, Christoph Hellwig, cbe-oss-dev
In-Reply-To: <20070604051559.3E8C1DDF43@ozlabs.org>
powerpc: Merge creation of signal frame
The code for creating signal frames was still duplicated and split
in strange ways between 32 and 64 bits, including the SA_ONSTACK
handling being in do_signal on 32 bits but inside handle_rt_signal
on 64 bits etc...
This moves the 64 bits get_sigframe() to the generic signal.c,
cleans it a bit, moves the access_ok() call done by all callers to
it as well, and adapts/cleanups the 3 different signal handling cases
to use that common function.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---
This one actually works :-)
Index: linux-cell/arch/powerpc/kernel/signal.c
===================================================================
--- linux-cell.orig/arch/powerpc/kernel/signal.c 2007-06-04 16:58:04.000000000 +1000
+++ linux-cell/arch/powerpc/kernel/signal.c 2007-06-04 17:06:29.000000000 +1000
@@ -11,6 +11,7 @@
#include <linux/ptrace.h>
#include <linux/signal.h>
+#include <asm/uaccess.h>
#include "signal.h"
@@ -27,6 +28,32 @@ static inline int is_32bit_task(void)
}
#endif
+/*
+ * Allocate space for the signal frame
+ */
+void __user * get_sigframe(struct k_sigaction *ka, struct pt_regs *regs,
+ size_t frame_size)
+{
+ unsigned long oldsp, newsp;
+
+ /* Default to using normal stack */
+ oldsp = regs->gpr[1];
+
+ /* Check for alt stack */
+ if ((ka->sa.sa_flags & SA_ONSTACK) &&
+ current->sas_ss_size && !on_sig_stack(oldsp))
+ oldsp = (current->sas_ss_sp + current->sas_ss_size);
+
+ /* Get aligned frame */
+ newsp = (oldsp - frame_size) & ~0xFUL;
+
+ /* Check access */
+ if (!access_ok(VERIFY_WRITE, (void __user *)newsp, oldsp - newsp))
+ return NULL;
+
+ return (void __user *)newsp;
+}
+
/*
* Restore the user process's signal mask
@@ -129,20 +156,12 @@ int do_signal(sigset_t *oldset, struct p
#endif
if (is32) {
- unsigned int newsp;
-
- if ((ka.sa.sa_flags & SA_ONSTACK) &&
- current->sas_ss_size && !on_sig_stack(regs->gpr[1]))
- newsp = current->sas_ss_sp + current->sas_ss_size;
- else
- newsp = regs->gpr[1];
-
if (ka.sa.sa_flags & SA_SIGINFO)
ret = handle_rt_signal32(signr, &ka, &info, oldset,
- regs, newsp);
+ regs);
else
ret = handle_signal32(signr, &ka, &info, oldset,
- regs, newsp);
+ regs);
#ifdef CONFIG_PPC64
} else {
ret = handle_rt_signal64(signr, &ka, &info, oldset, regs);
Index: linux-cell/arch/powerpc/kernel/signal.h
===================================================================
--- linux-cell.orig/arch/powerpc/kernel/signal.h 2007-06-04 16:58:04.000000000 +1000
+++ linux-cell/arch/powerpc/kernel/signal.h 2007-06-04 17:03:20.000000000 +1000
@@ -12,15 +12,17 @@
#define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP)))
+extern void __user * get_sigframe(struct k_sigaction *ka, struct pt_regs *regs,
+ size_t frame_size);
extern void restore_sigmask(sigset_t *set);
extern int handle_signal32(unsigned long sig, struct k_sigaction *ka,
siginfo_t *info, sigset_t *oldset,
- struct pt_regs *regs, unsigned long newsp);
+ struct pt_regs *regs);
extern int handle_rt_signal32(unsigned long sig, struct k_sigaction *ka,
siginfo_t *info, sigset_t *oldset,
- struct pt_regs *regs, unsigned long newsp);
+ struct pt_regs *regs);
extern int handle_rt_signal64(int signr, struct k_sigaction *ka,
siginfo_t *info, sigset_t *set,
Index: linux-cell/arch/powerpc/kernel/signal_32.c
===================================================================
--- linux-cell.orig/arch/powerpc/kernel/signal_32.c 2007-06-04 16:58:04.000000000 +1000
+++ linux-cell/arch/powerpc/kernel/signal_32.c 2007-06-04 17:14:20.000000000 +1000
@@ -282,14 +282,17 @@ long sys_sigaction(int sig, struct old_s
/*
* When we have signals to deliver, we set up on the
* user stack, going down from the original stack pointer:
- * a sigregs struct
+ * an ABI gap of 56 words
+ * an mcontext struct
* a sigcontext struct
* a gap of __SIGNAL_FRAMESIZE bytes
*
- * Each of these things must be a multiple of 16 bytes in size.
+ * Each of these things must be a multiple of 16 bytes in size. The following
+ * structure represent all of this except the __SIGNAL_FRAMESIZE gap
*
*/
-struct sigregs {
+struct sigframe {
+ struct sigcontext sctx; /* the sigcontext */
struct mcontext mctx; /* all the register values */
/*
* Programs using the rs6000/xcoff abi can save up to 19 gp
@@ -698,21 +701,16 @@ int compat_sys_sigaltstack(u32 __new, u3
*/
int handle_rt_signal32(unsigned long sig, struct k_sigaction *ka,
siginfo_t *info, sigset_t *oldset,
- struct pt_regs *regs, unsigned long newsp)
+ struct pt_regs *regs)
{
struct rt_sigframe __user *rt_sf;
struct mcontext __user *frame;
- unsigned long origsp = newsp;
+ unsigned long newsp = 0;
/* Set up Signal Frame */
/* Put a Real Time Context onto stack */
- newsp -= sizeof(*rt_sf);
- rt_sf = (struct rt_sigframe __user *)newsp;
-
- /* create a stack frame for the caller of the handler */
- newsp -= __SIGNAL_FRAMESIZE + 16;
-
- if (!access_ok(VERIFY_WRITE, (void __user *)newsp, origsp - newsp))
+ rt_sf = get_sigframe(ka, regs, sizeof(*rt_sf));
+ if (unlikely(rt_sf == NULL))
goto badframe;
/* Put the siginfo & fill in most of the ucontext */
@@ -742,8 +740,12 @@ int handle_rt_signal32(unsigned long sig
current->thread.fpscr.val = 0; /* turn off all fp exceptions */
+ /* create a stack frame for the caller of the handler */
+ newsp = ((unsigned long)rt_sf) - (__SIGNAL_FRAMESIZE + 16);
if (put_user(regs->gpr[1], (u32 __user *)newsp))
goto badframe;
+
+ /* Fill registers for signal handler */
regs->gpr[1] = newsp;
regs->gpr[3] = sig;
regs->gpr[4] = (unsigned long) &rt_sf->info;
@@ -988,26 +990,17 @@ int sys_debug_setcontext(struct ucontext
* OK, we're invoking a handler
*/
int handle_signal32(unsigned long sig, struct k_sigaction *ka,
- siginfo_t *info, sigset_t *oldset, struct pt_regs *regs,
- unsigned long newsp)
+ siginfo_t *info, sigset_t *oldset, struct pt_regs *regs)
{
struct sigcontext __user *sc;
- struct sigregs __user *frame;
- unsigned long origsp = newsp;
+ struct sigframe __user *frame;
+ unsigned long newsp = 0;
/* Set up Signal Frame */
- newsp -= sizeof(struct sigregs);
- frame = (struct sigregs __user *) newsp;
-
- /* Put a sigcontext on the stack */
- newsp -= sizeof(*sc);
- sc = (struct sigcontext __user *) newsp;
-
- /* create a stack frame for the caller of the handler */
- newsp -= __SIGNAL_FRAMESIZE;
-
- if (!access_ok(VERIFY_WRITE, (void __user *) newsp, origsp - newsp))
+ frame = get_sigframe(ka, regs, sizeof(*frame));
+ if (unlikely(frame == NULL))
goto badframe;
+ sc = (struct sigcontext __user *) &frame->sctx;
#if _NSIG != 64
#error "Please adjust handle_signal()"
@@ -1019,7 +1012,7 @@ int handle_signal32(unsigned long sig, s
#else
|| __put_user(oldset->sig[1], &sc->_unused[3])
#endif
- || __put_user(to_user_ptr(frame), &sc->regs)
+ || __put_user(to_user_ptr(&frame->mctx), &sc->regs)
|| __put_user(sig, &sc->signal))
goto badframe;
@@ -1035,8 +1028,11 @@ int handle_signal32(unsigned long sig, s
current->thread.fpscr.val = 0; /* turn off all fp exceptions */
+ /* create a stack frame for the caller of the handler */
+ newsp = ((unsigned long)frame) - __SIGNAL_FRAMESIZE;
if (put_user(regs->gpr[1], (u32 __user *)newsp))
goto badframe;
+
regs->gpr[1] = newsp;
regs->gpr[3] = sig;
regs->gpr[4] = (unsigned long) sc;
Index: linux-cell/arch/powerpc/kernel/signal_64.c
===================================================================
--- linux-cell.orig/arch/powerpc/kernel/signal_64.c 2007-06-04 16:58:04.000000000 +1000
+++ linux-cell/arch/powerpc/kernel/signal_64.c 2007-06-04 17:22:10.000000000 +1000
@@ -196,25 +196,6 @@ static long restore_sigcontext(struct pt
}
/*
- * Allocate space for the signal frame
- */
-static inline void __user * get_sigframe(struct k_sigaction *ka, struct pt_regs *regs,
- size_t frame_size)
-{
- unsigned long newsp;
-
- /* Default to using normal stack */
- newsp = regs->gpr[1];
-
- if ((ka->sa.sa_flags & SA_ONSTACK) && current->sas_ss_size) {
- if (! on_sig_stack(regs->gpr[1]))
- newsp = (current->sas_ss_sp + current->sas_ss_size);
- }
-
- return (void __user *)((newsp - frame_size) & -16ul);
-}
-
-/*
* Setup the trampoline code on the stack
*/
static long setup_trampoline(unsigned int syscall, unsigned int __user *tramp)
@@ -348,8 +329,7 @@ int handle_rt_signal64(int signr, struct
long err = 0;
frame = get_sigframe(ka, regs, sizeof(*frame));
-
- if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
+ if (unlikely(frame == NULL))
goto badframe;
err |= __put_user(&frame->info, &frame->pinfo);
@@ -386,7 +366,7 @@ int handle_rt_signal64(int signr, struct
funct_desc_ptr = (func_descr_t __user *) ka->sa.sa_handler;
/* Allocate a dummy caller frame for the signal handler. */
- newsp = (unsigned long)frame - __SIGNAL_FRAMESIZE;
+ newsp = ((unsigned long)frame) - __SIGNAL_FRAMESIZE;
err |= put_user(regs->gpr[1], (unsigned long __user *)newsp);
/* Set up "regs" so we "return" to the signal handler. */
^ permalink raw reply
* Re: [PATCH 0/21] This is my pending series for 2.6.23
From: Benjamin Herrenschmidt @ 2007-06-04 7:21 UTC (permalink / raw)
To: linuxppc-dev; +Cc: Paul Mackerras, Christoph Hellwig, cbe-oss-dev
In-Reply-To: <1180940405.31677.45.camel@localhost.localdomain>
On Mon, 2007-06-04 at 17:00 +1000, Benjamin Herrenschmidt wrote:
> And one of the signal changes is causing init to segv on my laptop,
> which I'm quite happy to blame on my signal frame allocation change.
> (Well, at least with the serie applied up to Christoph 3rd patch, it
> still boots). I'll debug that and post an updated patch.
Fixed... posting a replacement to patch 19/21 as a reply to the initial
patch email.
Ben.
^ permalink raw reply
* Re: [PATCH 14/21] powerpc: Make syscall restart code more common
From: Christoph Hellwig @ 2007-06-04 7:06 UTC (permalink / raw)
To: Benjamin Herrenschmidt
Cc: linuxppc-dev, Paul Mackerras, Christoph Hellwig, cbe-oss-dev
In-Reply-To: <20070604051554.2508FDDF58@ozlabs.org>
On Mon, Jun 04, 2007 at 03:15:49PM +1000, Benjamin Herrenschmidt wrote:
> This patch moves the code in signal_32.c and signal_64.c for handling
> syscall restart into a common signal.c file and converge around a single
> implementation that is based on the 32 bits one, using trap, ccr
> and r3 rather than the special "result" field for deciding what to do.
>
> The "result" field is now pretty much deprecated. We still set it for
> the sake of whatever might rely on it in userland but we no longer use
> it's content.
>
> This, along with a previous patch that enables ptracers to write to
> "trap" and "orig_r3" should allow gdb to properly handle syscall
> restarting.
>
> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> ---
>
> This is basically my initial patch as modified by Christoph Hellwig
> (hch, care to send a SOB ? :-)
Signed-off-by: Christoph Hellwig <hch@lst.de>
>
>
> arch/powerpc/kernel/Makefile | 3 +
> arch/powerpc/kernel/signal.c | 64 ++++++++++++++++++++++++++++++++++++++++
> arch/powerpc/kernel/signal.h | 16 ++++++++++
> arch/powerpc/kernel/signal_32.c | 28 ++---------------
> arch/powerpc/kernel/signal_64.c | 59 ++++--------------------------------
> 5 files changed, 93 insertions(+), 77 deletions(-)
>
> Index: linux-cell/arch/powerpc/kernel/signal_32.c
> ===================================================================
> --- linux-cell.orig/arch/powerpc/kernel/signal_32.c 2007-05-30 16:45:57.000000000 +1000
> +++ linux-cell/arch/powerpc/kernel/signal_32.c 2007-06-04 11:45:43.000000000 +1000
> @@ -51,6 +51,8 @@
> #include <asm/pgtable.h>
> #endif
>
> +#include "signal.h"
> +
> #undef DEBUG_SIG
>
> #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP)))
> @@ -1156,30 +1158,8 @@ int do_signal(sigset_t *oldset, struct p
> #ifdef CONFIG_PPC32
> no_signal:
> #endif
> - if (TRAP(regs) == 0x0C00 /* System Call! */
> - && regs->ccr & 0x10000000 /* error signalled */
> - && ((ret = regs->gpr[3]) == ERESTARTSYS
> - || ret == ERESTARTNOHAND || ret == ERESTARTNOINTR
> - || ret == ERESTART_RESTARTBLOCK)) {
> -
> - if (signr > 0
> - && (ret == ERESTARTNOHAND || ret == ERESTART_RESTARTBLOCK
> - || (ret == ERESTARTSYS
> - && !(ka.sa.sa_flags & SA_RESTART)))) {
> - /* make the system call return an EINTR error */
> - regs->result = -EINTR;
> - regs->gpr[3] = EINTR;
> - /* note that the cr0.SO bit is already set */
> - } else {
> - regs->nip -= 4; /* Back up & retry system call */
> - regs->result = 0;
> - regs->trap = 0;
> - if (ret == ERESTART_RESTARTBLOCK)
> - regs->gpr[0] = __NR_restart_syscall;
> - else
> - regs->gpr[3] = regs->orig_gpr3;
> - }
> - }
> + /* Is there any syscall restart business here ? */
> + check_syscall_restart(regs, &ka, signr > 0);
>
> if (signr == 0) {
> /* No signal to deliver -- put the saved sigmask back */
> Index: linux-cell/arch/powerpc/kernel/signal_64.c
> ===================================================================
> --- linux-cell.orig/arch/powerpc/kernel/signal_64.c 2007-05-30 16:45:57.000000000 +1000
> +++ linux-cell/arch/powerpc/kernel/signal_64.c 2007-06-04 11:45:43.000000000 +1000
> @@ -34,6 +34,8 @@
> #include <asm/syscalls.h>
> #include <asm/vdso.h>
>
> +#include "signal.h"
> +
> #define DEBUG_SIG 0
>
> #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP)))
> @@ -463,41 +465,6 @@ static int handle_signal(unsigned long s
> return ret;
> }
>
> -static inline void syscall_restart(struct pt_regs *regs, struct k_sigaction *ka)
> -{
> - switch ((int)regs->result) {
> - case -ERESTART_RESTARTBLOCK:
> - case -ERESTARTNOHAND:
> - /* ERESTARTNOHAND means that the syscall should only be
> - * restarted if there was no handler for the signal, and since
> - * we only get here if there is a handler, we dont restart.
> - */
> - regs->result = -EINTR;
> - regs->gpr[3] = EINTR;
> - regs->ccr |= 0x10000000;
> - break;
> - case -ERESTARTSYS:
> - /* ERESTARTSYS means to restart the syscall if there is no
> - * handler or the handler was registered with SA_RESTART
> - */
> - if (!(ka->sa.sa_flags & SA_RESTART)) {
> - regs->result = -EINTR;
> - regs->gpr[3] = EINTR;
> - regs->ccr |= 0x10000000;
> - break;
> - }
> - /* fallthrough */
> - case -ERESTARTNOINTR:
> - /* ERESTARTNOINTR means that the syscall should be
> - * called again after the signal handler returns.
> - */
> - regs->gpr[3] = regs->orig_gpr3;
> - regs->nip -= 4;
> - regs->result = 0;
> - break;
> - }
> -}
> -
> /*
> * Note that 'init' is a special process: it doesn't get signals it doesn't
> * want to handle. Thus you cannot kill init even with a SIGKILL even by
> @@ -522,13 +489,13 @@ int do_signal(sigset_t *oldset, struct p
> oldset = ¤t->blocked;
>
> signr = get_signal_to_deliver(&info, &ka, regs, NULL);
> +
> + /* Is there any syscall restart business here ? */
> + check_syscall_restart(regs, &ka, signr > 0);
> +
> if (signr > 0) {
> int ret;
>
> - /* Whee! Actually deliver the signal. */
> - if (TRAP(regs) == 0x0C00)
> - syscall_restart(regs, &ka);
> -
> /*
> * Reenable the DABR before delivering the signal to
> * user space. The DABR will have been cleared if it
> @@ -537,6 +504,7 @@ int do_signal(sigset_t *oldset, struct p
> if (current->thread.dabr)
> set_dabr(current->thread.dabr);
>
> + /* Whee! Actually deliver the signal. */
> ret = handle_signal(signr, &ka, &info, oldset, regs);
>
> /* If a signal was successfully delivered, the saved sigmask is in
> @@ -547,19 +515,6 @@ int do_signal(sigset_t *oldset, struct p
> return ret;
> }
>
> - if (TRAP(regs) == 0x0C00) { /* System Call! */
> - if ((int)regs->result == -ERESTARTNOHAND ||
> - (int)regs->result == -ERESTARTSYS ||
> - (int)regs->result == -ERESTARTNOINTR) {
> - regs->gpr[3] = regs->orig_gpr3;
> - regs->nip -= 4; /* Back up & retry system call */
> - regs->result = 0;
> - } else if ((int)regs->result == -ERESTART_RESTARTBLOCK) {
> - regs->gpr[0] = __NR_restart_syscall;
> - regs->nip -= 4;
> - regs->result = 0;
> - }
> - }
> /* No signal to deliver -- put the saved sigmask back */
> if (test_thread_flag(TIF_RESTORE_SIGMASK)) {
> clear_thread_flag(TIF_RESTORE_SIGMASK);
> Index: linux-cell/arch/powerpc/kernel/Makefile
> ===================================================================
> --- linux-cell.orig/arch/powerpc/kernel/Makefile 2007-06-04 11:16:01.000000000 +1000
> +++ linux-cell/arch/powerpc/kernel/Makefile 2007-06-04 11:16:16.000000000 +1000
> @@ -12,7 +12,8 @@ endif
>
> obj-y := semaphore.o cputable.o ptrace.o syscalls.o \
> irq.o align.o signal_32.o pmc.o vdso.o \
> - init_task.o process.o systbl.o idle.o
> + init_task.o process.o systbl.o idle.o \
> + signal.o
> obj-y += vdso32/
> obj-$(CONFIG_PPC64) += setup_64.o binfmt_elf32.o sys_ppc32.o \
> signal_64.o ptrace32.o \
> Index: linux-cell/arch/powerpc/kernel/signal.c
> ===================================================================
> --- /dev/null 1970-01-01 00:00:00.000000000 +0000
> +++ linux-cell/arch/powerpc/kernel/signal.c 2007-06-04 11:45:50.000000000 +1000
> @@ -0,0 +1,64 @@
> +/*
> + * Common signal handling code for both 32 and 64 bits
> + *
> + * Copyright (c) 2007 Benjamin Herrenschmidt, IBM Coproration
> + * Extracted from signal_32.c and signal_64.c
> + *
> + * This file is subject to the terms and conditions of the GNU General
> + * Public License. See the file README.legal in the main directory of
> + * this archive for more details.
> + */
> +
> +#include <linux/ptrace.h>
> +#include <linux/signal.h>
> +
> +void check_syscall_restart(struct pt_regs *regs, struct k_sigaction *ka,
> + int has_handler)
> +{
> + unsigned long ret = regs->gpr[3];
> + int restart = 1;
> +
> + /* syscall ? */
> + if (TRAP(regs) != 0x0C00)
> + return;
> +
> + /* error signalled ? */
> + if (!(regs->ccr & 0x10000000))
> + return;
> +
> + switch (ret) {
> + case ERESTART_RESTARTBLOCK:
> + case ERESTARTNOHAND:
> + /* ERESTARTNOHAND means that the syscall should only be
> + * restarted if there was no handler for the signal, and since
> + * we only get here if there is a handler, we dont restart.
> + */
> + restart = !has_handler;
> + break;
> + case ERESTARTSYS:
> + /* ERESTARTSYS means to restart the syscall if there is no
> + * handler or the handler was registered with SA_RESTART
> + */
> + restart = !has_handler || (ka->sa.sa_flags & SA_RESTART) != 0;
> + break;
> + case ERESTARTNOINTR:
> + /* ERESTARTNOINTR means that the syscall should be
> + * called again after the signal handler returns.
> + */
> + break;
> + default:
> + return;
> + }
> + if (restart) {
> + if (ret == ERESTART_RESTARTBLOCK)
> + regs->gpr[0] = __NR_restart_syscall;
> + else
> + regs->gpr[3] = regs->orig_gpr3;
> + regs->nip -= 4;
> + regs->result = 0;
> + } else {
> + regs->result = -EINTR;
> + regs->gpr[3] = EINTR;
> + regs->ccr |= 0x10000000;
> + }
> +}
> Index: linux-cell/arch/powerpc/kernel/signal.h
> ===================================================================
> --- /dev/null 1970-01-01 00:00:00.000000000 +0000
> +++ linux-cell/arch/powerpc/kernel/signal.h 2007-06-04 11:45:41.000000000 +1000
> @@ -0,0 +1,16 @@
> +/*
> + * Copyright (c) 2007 Benjamin Herrenschmidt, IBM Coproration
> + * Extracted from signal_32.c and signal_64.c
> + *
> + * This file is subject to the terms and conditions of the GNU General
> + * Public License. See the file README.legal in the main directory of
> + * this archive for more details.
> + */
> +
> +#ifndef _POWERPC_ARCH_SIGNAL_H
> +#define _POWERPC_ARCH_SIGNAL_H
> +
> +extern void check_syscall_restart(struct pt_regs *regs, struct k_sigaction *ka,
> + int has_handler);
> +
> +#endif /* _POWERPC_ARCH_SIGNAL_H */
---end quoted text---
^ permalink raw reply
* Re: [PATCH 0/21] This is my pending series for 2.6.23
From: Benjamin Herrenschmidt @ 2007-06-04 7:00 UTC (permalink / raw)
To: linuxppc-dev; +Cc: Paul Mackerras, Christoph Hellwig, cbe-oss-dev
In-Reply-To: <1180934134.603289.870346178920.qpush@grosgo>
On Mon, 2007-06-04 at 14:49 +1000, Benjamin Herrenschmidt wrote:
> It contains
>
> - My PCI IO allocation rework (the first patch changes generic code
> and is in -mm already)
>
> - spufs single step & capabilities support
>
> - my cleanup/merge of the ptrace code
>
> - patches from Christoph Hellwig and myself that fix and merge things
> in the signal handling code
>
> I'm still working on saving the top 32 bits of registers on 64 bits
> for signals, so that's not included here.
And one of the signal changes is causing init to segv on my laptop,
which I'm quite happy to blame on my signal frame allocation change.
(Well, at least with the serie applied up to Christoph 3rd patch, it
still boots). I'll debug that and post an updated patch.
Ben.
^ permalink raw reply
* Re: [PATCH 8/8] Wrote quirk_mpc8641_transparent() to initialize bridge resources.
From: Milton Miller @ 2007-06-04 5:55 UTC (permalink / raw)
To: Jon Loeliger; +Cc: ppcdev
In-Reply-To: <1180720142.14219.68.camel@ld0161-tx32>
> The 8641 RC poses as a transparent bridge, but does not implement the
> IO_BASE or IO_LIMIT registers in the config space. This means that
> the code which initializes the bridge resources ends up setting the
> IO resources erroneously.
>
> This change sets RC of mpc8641 to be a transparent bridge
> for legacy I/O access and initializes the RC bridge resources
> from the device tree.
>
> Note: The 0x7010 is the device ID of host bridge for MPC8641
> and 0x7011 is the device ID of host bridge fro MPC8641D.
>
...
>
> @@ -339,6 +403,8 @@ static void __devinit early_uli5249(struct pci_dev
> *dev)
> DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL, 0x1575, quirk_uli1575);
> DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL, 0x5288, quirk_uli5288);
> DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL, 0x5229, quirk_uli5229);
> +DECLARE_PCI_FIXUP_EARLY(0x1957, 0x7010, quirk_mpc8641_transparent);
> +DECLARE_PCI_FIXUP_EARLY(0x1957, 0x7011, quirk_mpc8641_transparent);
> DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_AL, 0x5249, early_uli5249);
> #endif /* CONFIG_PCI */
This is totally unreadable. include/linux/pci_ids.h exists for a
reason,
please use it. At least the vendor should be in there.
If you want to define the device id with the same naming convention
but in the local source file, I won't object.
Looking back at the rest of the patch:
>
> +#define GET_64BIT(prop, i) ((((u64) (prop)[(i)]) << 32) |
> (prop)[(i)+1])
Please use the (new) helper of_read_number in prom.h.
milton
PS: how about create instead of wrote in the subject?
^ permalink raw reply
* Re: [PATCH] [2.6.22] powerpc: uninline and export virq_to_hw()
From: Benjamin Herrenschmidt @ 2007-06-04 5:27 UTC (permalink / raw)
To: Olof Johansson; +Cc: linuxppc-dev, paulus
In-Reply-To: <20070604052707.GA27896@lixom.net>
On Mon, 2007-06-04 at 00:27 -0500, Olof Johansson wrote:
>
> > It's called in fairly hot IRQ code path (the PIC themselves use it)
> no ?
>
> I looked before I did the change. All of those open-code it.
Ah ok :-) Yeah, well, I remember open coding it when I wrote the PIC
code for virq's then somebody added virq_to_hw() :-)
Good to go then,
Cheers,
Ben.
^ permalink raw reply
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