* Re: [OT] write flash on MPC5200 board via jtag
From: WITTROCK @ 2008-07-23 12:21 UTC (permalink / raw)
To: linuxppc-embedded
In-Reply-To: <1216753011l.5683l.0l@antares>
I am using http://urjtag.org/ UrJtag to do accomplish this. I have used it
with both a Wiggler clone and an Altera UsbBlaster as the physical JTAG
interface on both a Linux and Windows (cygwin) host. The only problem is
that this approach is very slow, so I wrote a small (~8kb) "bootstrap"
program which is first put into flash. This small program then handles
programming u-boot to flash over a serial interface. Once u-boot is in
place, I use it to program the rest of flash.
Some JTAG tools actually place a small application in the target devices
ram, then this application allows much faster programming of an attached
flash device. This requires more information about the COP/BDM interface
than is published in the MPC5200B user manual or data sheet. I haven't used
the Abatron tools, so maybe they do this. In the case of UrJtag, it is
simply fiddling with bus signals using boundry scan, so it is excruciatingly
slow.
-WITTROCK
--
View this message in context: http://www.nabble.com/-OT--write-flash-on-MPC5200-board-via-jtag-tp18596887p18609501.html
Sent from the linuxppc-embedded mailing list archive at Nabble.com.
^ permalink raw reply
* Re: [RFC] 4xx hardware watchpoint support
From: Kumar Gala @ 2008-07-23 12:51 UTC (permalink / raw)
To: luisgpm; +Cc: ppc-dev, Paul Mackerras
In-Reply-To: <1216777678.5727.82.camel@gargoyle>
On Jul 22, 2008, at 8:47 PM, Luis Machado wrote:
> Hi,
>
>> That, or adding a small function to move the bits to the appropriate
>> registers (set_dbcr or set_dac_events).
>>
>>> Do you think it's worth to support this facility on 405's
>>> processors? If
>>> so, i'll gladly work on a solution to it.
>>
>> I would think so. There's really no difference from a userspace
>> perspective, so gdb watchpoints could be valuable there too. I'll
>> leave it up to you though.
>
> As the 440 support is ready and the 405 needs additional tweaking
> due to
> the use of DBCR1 instead of DBCR0 and due to a different position
> scheme
> of the DAC1R/DAC1W flags inside DBCR1, i'd say we should include this
> code and handle the 405 case later.
>
> We might have to handle it anyway if we're going to pursue the
> hardware
> breakpoint interface work in the future.
>
> I've fixed some formatting problems. Tested on a 440 Taishan board and
> on a PPC970. Both worked as they should. Ok?
I'd like to test this on some Freescale Book-e parts. Is there a gdb
patch or some user space ptrace test you have?
- k
^ permalink raw reply
* Re: how to allocate 9MB of memory in kernel ?
From: Alessandro Rubini @ 2008-07-23 12:47 UTC (permalink / raw)
To: misbah_khan; +Cc: linuxppc-embedded
In-Reply-To: <18605418.post@talk.nabble.com>
> If i allocate 9BM using vmalloc and remap to user space how should it
> address to the 9MB
> SDRAM contigues address which i need to map for user access ?
Use the nopage method and vmalloc_to_page in it.
I have an example in ftp://gnudd.com/pub/samplecode, in the
smallsample26 package, the module is "smallmmap.c" (I'm sure there are
simlilar examples elsewhere).
/alessandro
^ permalink raw reply
* Re: [alsa-devel] [PATCH 2/2] Allow a custom ASOC machine driver with soc-of-simple
From: Jon Smirl @ 2008-07-23 14:09 UTC (permalink / raw)
To: linuxppc-dev, alsa-devel, Grant Likely
In-Reply-To: <20080723105334.GC8377@sirena.org.uk>
On 7/23/08, Mark Brown <broonie@opensource.wolfsonmicro.com> wrote:
> On Tue, Jul 22, 2008 at 07:53:51PM -0400, Jon Smirl wrote:
>
> > Allow a custom ASOC machine driver with soc-of-simple
>
>
> As with the clocking configuration: this looks fine from an ASoC point
> of view but please fix the checkpatch warnings. However...
>
>
> > /* Only register the device if both the codec and platform have
> > * been registered */
> > - if ((!of_soc->device.codec_data) || (!of_soc->platform_node))
> > + if ((!of_soc->device.codec_data) || (!of_soc->platform_node) || !machine_name)
> > return;
>
>
> ...this doesn't just allow a custom machine driver, it requires that
> something configures at least the machine name. That's not a problem
> from the ASoC point of view but possibly from the PowerPC side?
You have to configure at least the name. Otherwise if the machine
driver is the last to register, how do you know to hold off the final
registration and wait for the machine driver to appear?
Or is it ok for me to change these after the platform device has been created?
of_soc->dai_link.ops = machine_ops;
of_soc->machine.name = machine_name;
I have to have the machine driver in order to control my external clock chips.
--
Jon Smirl
jonsmirl@gmail.com
^ permalink raw reply
* Re: [RFC] 4xx hardware watchpoint support
From: Christoph Hellwig @ 2008-07-23 14:23 UTC (permalink / raw)
To: Luis Machado; +Cc: ppc-dev, Paul Mackerras
In-Reply-To: <1216777678.5727.82.camel@gargoyle>
On Tue, Jul 22, 2008 at 10:47:58PM -0300, Luis Machado wrote:
> +void do_dabr(struct pt_regs *regs, unsigned long address,
> + unsigned long error_code)
> +{
> + siginfo_t info;
> +
> +#if !(defined(CONFIG_4xx) || defined(CONFIG_BOOKE))
> + if (notify_die(DIE_DABR_MATCH, "dabr_match", regs, error_code,
> + 11, SIGSEGV) == NOTIFY_STOP)
> + return;
> +
> + if (debugger_dabr_match(regs))
> + return;
> +
> + /* Clear the DAC and struct entries. One shot trigger. */
> +#else /* (defined(CONFIG_4xx) || defined(CONFIG_BOOKE)) */
> + mtspr(SPRN_DBCR0, mfspr(SPRN_DBCR0) & ~(DBSR_DAC1R | DBSR_DAC1W
> + | DBCR0_IDM));
> +#endif
Some comment, first the above negate conditional
looks rather ugly, I'd rather do a
#if defined(CONFIG_4xx) || defined(CONFIG_BOOKE)
dbcr0 case
#else
dabr case
#endif
second I wonder why we have the notify_die only for one case, that seems
rather odd. Looking further the notify_die is even more odd because
DIE_DABR_MATCH doesn't actually appear anywhere else in the kernel.
I'd suggest simply removing it.
> + /* For processors using DABR (i.e. 970), the bottom 3 bits are flags.
> + It was assumed, on previous implementations, that 3 bits were
> + passed together with the data address, fitting the design of the
> + DABR register, as follows:
> +
> + bit 0: Read flag
> + bit 1: Write flag
> + bit 2: Breakpoint translation
> +
> + Thus, we use them here as so. */
Can you redo this in the normal Linux comment style, ala:
/*
* For processors using DABR (i.e. 970), the bottom 3 bits are flags.
* It was assumed, on previous implementations, that 3 bits were
* passed together with the data address, fitting the design of the
* DABR register, as follows:
*
* bit 0: Read flag
* bit 1: Write flag
* bit 2: Breakpoint translation
*
* Thus, we use them here as so.
*/
and similar in few other places.
^ permalink raw reply
* arch/powerpc/kernel/stacktrace.c: Removed duplicated include
From: Huang Weiyi @ 2008-07-23 14:44 UTC (permalink / raw)
To: hch, paulus, benh; +Cc: linuxppc-dev
UmVtb3ZlZCBkdXBsaWNhdGVkIGluY2x1ZGUgZmlsZSA8bGludXgvbW9kdWxlLmg+IGluDQphcmNo
L3Bvd2VycGMva2VybmVsL3N0YWNrdHJhY2UuYy4NCg0KU2lnbmVkLW9mZi1ieTogSHVhbmcgV2Vp
eWkgPHdlaXlpLmh1YW5nQGdtYWlsLmNvbT4NCg0KZGlmZiAtLWdpdCBhL2FyY2gvcG93ZXJwYy9r
ZXJuZWwvc3RhY2t0cmFjZS5jIGIvYXJjaC9wb3dlcnBjL2tlcm5lbC9zdGFja3RyYWNlLmMNCmlu
ZGV4IGYyNTg5NjQuLmIwZGJiMWQgMTAwNjQ0DQotLS0gYS9hcmNoL3Bvd2VycGMva2VybmVsL3N0
YWNrdHJhY2UuYw0KKysrIGIvYXJjaC9wb3dlcnBjL2tlcm5lbC9zdGFja3RyYWNlLmMNCkBAIC0x
Myw3ICsxMyw2IEBADQogI2luY2x1ZGUgPGxpbnV4L21vZHVsZS5oPg0KICNpbmNsdWRlIDxsaW51
eC9zY2hlZC5oPg0KICNpbmNsdWRlIDxsaW51eC9zdGFja3RyYWNlLmg+DQotI2luY2x1ZGUgPGxp
bnV4L21vZHVsZS5oPg0KICNpbmNsdWRlIDxhc20vcHRyYWNlLmg+DQogI2luY2x1ZGUgPGFzbS9w
cm9jZXNzb3IuaD4NCg0K
^ permalink raw reply
* Re: PIXIS gpio controller and gpio flags
From: Anton Vorontsov @ 2008-07-23 14:56 UTC (permalink / raw)
To: Trent Piepho; +Cc: linuxppc-dev, linux-kernel
In-Reply-To: <Pine.LNX.4.64.0807211340460.26456@t2.domain.actdsltmp>
On Mon, Jul 21, 2008 at 02:12:20PM -0700, Trent Piepho wrote:
> On Mon, 21 Jul 2008, Anton Vorontsov wrote:
> > On Sat, Jul 19, 2008 at 02:08:01PM -0700, Trent Piepho wrote:
> >> It doesn't look like you have any way to unset the active low flag. What if
> >> I unload the leds-gpio driver (or another gpio user) and then try to use the
> >> gpio with something else? The active low flag is stuck on!
> >
> > Why would you want to unset the flags? It is specified in the device
> > tree, and can't be changed. Specifying different flags for the same GPIO
> > would be an error (plus, Linux forbids shared gpios, so you simply can't
> > specify one gpio for several devices).
>
> You can't use the same gpio for two different things at the same time, but you
> can load a driver, unload it, and then load another.
Hm.. yeah, this might happen. Now I tend to think that transparent
active-low handling wasn't that good idea after all. So, something like
of_gpio_is_active_low(device_node, gpioidx) should be implemented
instead. This function will parse the gpio's = <> flags. Please speak up
if you have any better ideas though.
Thanks for bringing this up,
--
Anton Vorontsov
email: cbouatmailru@gmail.com
irc://irc.freenode.net/bd2
^ permalink raw reply
* DTS configuration of external interrupts on 8347
From: Richard Whitlock @ 2008-07-23 14:58 UTC (permalink / raw)
To: linuxppc-dev
I have a small problem with a port of linux 2.6.26 to a custom board.
Our board is almost identical to the Analogue & Micro asp 8347 board, so
I'm using Kumar Gala's excellent fsl tree (thank you Kumar) as it
already has a defconfig for the asp.
Thanks also to Bryan O'Donoghue for pointing us in the direction of the
asp port in the first place.
The problem we have is I am unable to request an external interrupt. We
have an FPGA which has an interrupt line - HW IRQ_0, so thats linux IRQ 48.
I have added the following to the dts file:
fpgaKFAF@0xF8000000 {
interrupts = <48 8>;
interrupt-parent = <&ipic>;
}
but whenever I call request_irq() it returns -ENOSYS.
The driver loads fine, and the open function does very little - a call
to ioremap() - which works, and a call to request_irq() which does not.
Is there anything else I have to do to configure this interrupt?
Regards,
Richard.
^ permalink raw reply
* [PATCH 0/2][RT] powerpc - fix bug in irq reverse mapping radix tree
From: Sebastien Dugue @ 2008-07-23 14:59 UTC (permalink / raw)
To: Linux RT Users
Cc: Tim Chavez, linux-kernel, Jean Pierre Dion, linuxppc-dev, paulus,
Gilles Carry
Hi,
here are 2 patches for fixing the following bug occuring on IBM pSeries under
an RT kernel:
BUG: sleeping function called from invalid context swapper(1) at kernel/rtmutex.c:739
in_atomic():1 [00000002], irqs_disabled():1
Call Trace:
[c0000001e20f3340] [c000000000010370] .show_stack+0x70/0x1bc (unreliable)
[c0000001e20f33f0] [c000000000049380] .__might_sleep+0x11c/0x138
[c0000001e20f3470] [c0000000002a2f64] .__rt_spin_lock+0x3c/0x98
[c0000001e20f34f0] [c0000000000c3f20] .kmem_cache_alloc+0x68/0x184
[c0000001e20f3590] [c000000000193f3c] .radix_tree_node_alloc+0xf0/0x144
[c0000001e20f3630] [c000000000195190] .radix_tree_insert+0x18c/0x2fc
[c0000001e20f36f0] [c00000000000c710] .irq_radix_revmap+0x1a4/0x1e4
[c0000001e20f37b0] [c00000000003b3f0] .xics_startup+0x30/0x54
[c0000001e20f3840] [c00000000008b864] .setup_irq+0x26c/0x370
[c0000001e20f38f0] [c00000000008ba68] .request_irq+0x100/0x158
[c0000001e20f39a0] [c0000000001ee9c0] .hvc_open+0xb4/0x148
[c0000001e20f3a40] [c0000000001d72ec] .tty_open+0x200/0x368
[c0000001e20f3af0] [c0000000000ce928] .chrdev_open+0x1f4/0x25c
[c0000001e20f3ba0] [c0000000000c8bf0] .__dentry_open+0x188/0x2c8
[c0000001e20f3c50] [c0000000000c8dec] .do_filp_open+0x50/0x70
[c0000001e20f3d70] [c0000000000c8e8c] .do_sys_open+0x80/0x148
[c0000001e20f3e20] [c00000000000928c] .init_post+0x4c/0x100
[c0000001e20f3ea0] [c0000000003c0e0c] .kernel_init+0x428/0x478
[c0000001e20f3f90] [c000000000027448] .kernel_thread+0x4c/0x68
The root cause of this bug lies in the fact that the XICS interrupt controller
uses a radix tree for its reverse irq mapping and that we cannot allocate the tree
nodes (even GFP_ATOMIC) with preemption disabled.
In fact, we have 2 nested preemption disabling when we want to allocate
a new node:
- setup_irq() does a spin_lock_irqsave() before calling xics_startup() which
then calls irq_radix_revmap() to insert a new node in the tree
- irq_radix_revmap() also does a spin_lock_irqsave() (in irq_radix_wrlock())
before the radix_tree_insert()
The first patch moves the call to irq_radix_revmap() from xics_startup() out to
xics_host_map_direct() and xics_host_map_lpar() which are called with preemption
enabled.
The second patch is a little more involved in that it takes advantage of
the concurrent radix tree to simplify the locking requirements and allows
to allocate a new node outside a preemption disabled section.
I just hope I've correctly understood the concurrent radix trees semantic
and got the (absence of) locking right.
Sebastien.
^ permalink raw reply
* [PATCH 1/2][RT] powerpc - XICS: move the call to irq_radix_revmap from xics_startup to xics_host_map
From: Sebastien Dugue @ 2008-07-23 15:00 UTC (permalink / raw)
To: Linux RT Users
Cc: Tim Chavez, linux-kernel, Jean Pierre Dion, linuxppc-dev, paulus,
Gilles Carry
In-Reply-To: <20080723165932.57e3ada2@bull.net>
From: Sebastien Dugue <sebastien.dugue@bull.net>
Date: Tue, 22 Jul 2008 13:05:24 +0200
Subject: [PATCH][RT] powerpc - XICS: move the call to irq_radix_revmap from xics_startup to xics_host_map
This patch moves the insertion of an irq into the reverse mapping radix tree
from xics_startup() into xics_host_map().
The reason for this change is that xics_startup() is called with preemption
disabled (which is not the case for xics_host_map()) which is a problem under a
preempt-rt kernel as we cannot even allocate GFP_ATOMIC memory for the radix tree
nodes.
Signed-off-by: Sebastien Dugue <sebastien.dugue@bull.net>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Michael Ellerman <michael@ellerman.id.au>
---
arch/powerpc/platforms/pseries/xics.c | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
Index: linux-2.6.25.8-rt7/arch/powerpc/platforms/pseries/xics.c
===================================================================
--- linux-2.6.25.8-rt7.orig/arch/powerpc/platforms/pseries/xics.c
+++ linux-2.6.25.8-rt7/arch/powerpc/platforms/pseries/xics.c
@@ -311,12 +311,6 @@ static void xics_mask_irq(unsigned int v
static unsigned int xics_startup(unsigned int virq)
{
- unsigned int irq;
-
- /* force a reverse mapping of the interrupt so it gets in the cache */
- irq = (unsigned int)irq_map[virq].hwirq;
- irq_radix_revmap(xics_host, irq);
-
/* unmask it */
xics_unmask_irq(virq);
return 0;
@@ -529,8 +523,14 @@ static int xics_host_match(struct irq_ho
static int xics_host_map_direct(struct irq_host *h, unsigned int virq,
irq_hw_number_t hw)
{
+ unsigned int irq;
+
pr_debug("xics: map_direct virq %d, hwirq 0x%lx\n", virq, hw);
+ /* force a reverse mapping of the interrupt so it gets in the cache */
+ irq = (unsigned int)irq_map[virq].hwirq;
+ irq_radix_revmap(xics_host, irq);
+
get_irq_desc(virq)->status |= IRQ_LEVEL;
set_irq_chip_and_handler(virq, &xics_pic_direct, handle_fasteoi_irq);
return 0;
@@ -539,8 +539,14 @@ static int xics_host_map_direct(struct i
static int xics_host_map_lpar(struct irq_host *h, unsigned int virq,
irq_hw_number_t hw)
{
+ unsigned int irq;
+
pr_debug("xics: map_direct virq %d, hwirq 0x%lx\n", virq, hw);
+ /* force a reverse mapping of the interrupt so it gets in the cache */
+ irq = (unsigned int)irq_map[virq].hwirq;
+ irq_radix_revmap(xics_host, irq);
+
get_irq_desc(virq)->status |= IRQ_LEVEL;
set_irq_chip_and_handler(virq, &xics_pic_lpar, handle_fasteoi_irq);
return 0;
^ permalink raw reply
* [PATCH 2/2][RT] powerpc - Make the irq reverse mapping radix tree lockless
From: Sebastien Dugue @ 2008-07-23 15:01 UTC (permalink / raw)
To: Linux RT Users
Cc: Tim Chavez, linux-kernel, Jean Pierre Dion, linuxppc-dev, paulus,
Gilles Carry
In-Reply-To: <20080723165932.57e3ada2@bull.net>
From: Sebastien Dugue <sebastien.dugue@bull.net>
Date: Tue, 22 Jul 2008 11:56:41 +0200
Subject: [PATCH][RT] powerpc - Make the irq reverse mapping radix tree lockless
The radix tree used by interrupt controllers for their irq reverse mapping
(currently only the XICS found on pSeries) have a complex locking scheme
dating back to before the advent of the concurrent radix tree on preempt-rt.
Take advantage of this and of the fact that the items of the tree are
pointers to a static array (irq_map) elements which can never go under us
to simplify the locking.
Concurrency between readers and writers are handled by the intrinsic
properties of the concurrent radix tree. Concurrency between the tree
initialization which is done asynchronously with readers and writers access is
handled via an atomic variable (revmap_trees_allocated) set when the tree
has been initialized and checked before any reader or writer access just
like we used to check for tree.gfp_mask != 0 before.
Signed-off-by: Sebastien Dugue <sebastien.dugue@bull.net>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
---
arch/powerpc/kernel/irq.c | 102 ++++++++++++----------------------------------
1 file changed, 27 insertions(+), 75 deletions(-)
Index: linux-2.6.25.8-rt7/arch/powerpc/kernel/irq.c
===================================================================
--- linux-2.6.25.8-rt7.orig/arch/powerpc/kernel/irq.c
+++ linux-2.6.25.8-rt7/arch/powerpc/kernel/irq.c
@@ -403,8 +403,7 @@ void do_softirq(void)
static LIST_HEAD(irq_hosts);
static DEFINE_RAW_SPINLOCK(irq_big_lock);
-static DEFINE_PER_CPU(unsigned int, irq_radix_reader);
-static unsigned int irq_radix_writer;
+static atomic_t revmap_trees_allocated = ATOMIC_INIT(0);
struct irq_map_entry irq_map[NR_IRQS];
static unsigned int irq_virq_count = NR_IRQS;
static struct irq_host *irq_default_host;
@@ -547,57 +546,6 @@ void irq_set_virq_count(unsigned int cou
irq_virq_count = count;
}
-/* radix tree not lockless safe ! we use a brlock-type mecanism
- * for now, until we can use a lockless radix tree
- */
-static void irq_radix_wrlock(unsigned long *flags)
-{
- unsigned int cpu, ok;
-
- spin_lock_irqsave(&irq_big_lock, *flags);
- irq_radix_writer = 1;
- smp_mb();
- do {
- barrier();
- ok = 1;
- for_each_possible_cpu(cpu) {
- if (per_cpu(irq_radix_reader, cpu)) {
- ok = 0;
- break;
- }
- }
- if (!ok)
- cpu_relax();
- } while(!ok);
-}
-
-static void irq_radix_wrunlock(unsigned long flags)
-{
- smp_wmb();
- irq_radix_writer = 0;
- spin_unlock_irqrestore(&irq_big_lock, flags);
-}
-
-static void irq_radix_rdlock(unsigned long *flags)
-{
- local_irq_save(*flags);
- __get_cpu_var(irq_radix_reader) = 1;
- smp_mb();
- if (likely(irq_radix_writer == 0))
- return;
- __get_cpu_var(irq_radix_reader) = 0;
- smp_wmb();
- spin_lock(&irq_big_lock);
- __get_cpu_var(irq_radix_reader) = 1;
- spin_unlock(&irq_big_lock);
-}
-
-static void irq_radix_rdunlock(unsigned long flags)
-{
- __get_cpu_var(irq_radix_reader) = 0;
- local_irq_restore(flags);
-}
-
static int irq_setup_virq(struct irq_host *host, unsigned int virq,
irq_hw_number_t hwirq)
{
@@ -752,7 +700,6 @@ void irq_dispose_mapping(unsigned int vi
{
struct irq_host *host;
irq_hw_number_t hwirq;
- unsigned long flags;
if (virq == NO_IRQ)
return;
@@ -784,15 +731,20 @@ void irq_dispose_mapping(unsigned int vi
if (hwirq < host->revmap_data.linear.size)
host->revmap_data.linear.revmap[hwirq] = NO_IRQ;
break;
- case IRQ_HOST_MAP_TREE:
+ case IRQ_HOST_MAP_TREE: {
+ DEFINE_RADIX_TREE_CONTEXT(ctx, &host->revmap_data.tree);
+
/* Check if radix tree allocated yet */
- if (host->revmap_data.tree.gfp_mask == 0)
+ if (atomic_read(&revmap_trees_allocated) == 0)
break;
- irq_radix_wrlock(&flags);
- radix_tree_delete(&host->revmap_data.tree, hwirq);
- irq_radix_wrunlock(flags);
+
+ radix_tree_lock(&ctx);
+ radix_tree_delete(ctx.tree, hwirq);
+ radix_tree_unlock(&ctx);
+
break;
}
+ }
/* Destroy map */
smp_mb();
@@ -845,22 +797,20 @@ unsigned int irq_radix_revmap(struct irq
struct radix_tree_root *tree;
struct irq_map_entry *ptr;
unsigned int virq;
- unsigned long flags;
WARN_ON(host->revmap_type != IRQ_HOST_MAP_TREE);
- /* Check if the radix tree exist yet. We test the value of
- * the gfp_mask for that. Sneaky but saves another int in the
- * structure. If not, we fallback to slow mode
- */
- tree = &host->revmap_data.tree;
- if (tree->gfp_mask == 0)
+ /* Check if the radix tree exist yet. */
+ if (atomic_read(&revmap_trees_allocated) == 0)
return irq_find_mapping(host, hwirq);
- /* Now try to resolve */
- irq_radix_rdlock(&flags);
+ /*
+ * Now try to resolve
+ * No rcu_read_lock(ing) needed, the ptr returned can't go under us
+ * as it's referencing an entry in the static irq_map table.
+ */
+ tree = &host->revmap_data.tree;
ptr = radix_tree_lookup(tree, hwirq);
- irq_radix_rdunlock(flags);
/* Found it, return */
if (ptr) {
@@ -871,9 +821,10 @@ unsigned int irq_radix_revmap(struct irq
/* If not there, try to insert it */
virq = irq_find_mapping(host, hwirq);
if (virq != NO_IRQ) {
- irq_radix_wrlock(&flags);
- radix_tree_insert(tree, hwirq, &irq_map[virq]);
- irq_radix_wrunlock(flags);
+ DEFINE_RADIX_TREE_CONTEXT(ctx, tree);
+ radix_tree_lock(&ctx);
+ radix_tree_insert(ctx.tree, hwirq, &irq_map[virq]);
+ radix_tree_unlock(&ctx);
}
return virq;
}
@@ -984,14 +935,15 @@ void irq_early_init(void)
static int irq_late_init(void)
{
struct irq_host *h;
- unsigned long flags;
- irq_radix_wrlock(&flags);
list_for_each_entry(h, &irq_hosts, link) {
if (h->revmap_type == IRQ_HOST_MAP_TREE)
INIT_RADIX_TREE(&h->revmap_data.tree, GFP_ATOMIC);
}
- irq_radix_wrunlock(flags);
+
+ /* Make sure the radix trees inits are visible before setting the flag */
+ smp_mb();
+ atomic_set(&revmap_trees_allocated, 1);
return 0;
}
^ permalink raw reply
* Re: [alsa-devel] [PATCH 2/2] Allow a custom ASOC machine driver with soc-of-simple
From: Mark Brown @ 2008-07-23 15:14 UTC (permalink / raw)
To: Jon Smirl; +Cc: linuxppc-dev, alsa-devel
In-Reply-To: <9e4733910807230709l4249eaf6m750bad811342ba13@mail.gmail.com>
On Wed, Jul 23, 2008 at 10:09:01AM -0400, Jon Smirl wrote:
> On 7/23/08, Mark Brown <broonie@opensource.wolfsonmicro.com> wrote:
> > ...this doesn't just allow a custom machine driver, it requires that
> > something configures at least the machine name. That's not a problem
> > from the ASoC point of view but possibly from the PowerPC side?
> You have to configure at least the name. Otherwise if the machine
> driver is the last to register, how do you know to hold off the final
> registration and wait for the machine driver to appear?
I understand why you have made this change but it's a substantial change
which should at least be documented in the changelog (I'd expect to see
some mention of how this is supposed to be configured, for example).
I'd also expect something to handle the existing user.
Like I said, I'm not entirely sure that you're supposed to be using this
driver if you want a machine driver: this is a machine driver and I'm
not sure if it's supposed to cover all cases or not. Grant?
> Or is it ok for me to change these after the platform device has been created?
> of_soc->dai_link.ops = machine_ops;
> of_soc->machine.name = machine_name;
No.
^ permalink raw reply
* Re: [alsa-devel] [PATCH 2/2] Allow a custom ASOC machine driver with soc-of-simple
From: Jon Smirl @ 2008-07-23 15:16 UTC (permalink / raw)
To: Jon Smirl, linuxppc-dev, alsa-devel, Grant Likely
In-Reply-To: <20080723151431.GA22926@sirena.org.uk>
On 7/23/08, Mark Brown <broonie@opensource.wolfsonmicro.com> wrote:
> On Wed, Jul 23, 2008 at 10:09:01AM -0400, Jon Smirl wrote:
> > On 7/23/08, Mark Brown <broonie@opensource.wolfsonmicro.com> wrote:
>
>
> > > ...this doesn't just allow a custom machine driver, it requires that
> > > something configures at least the machine name. That's not a problem
> > > from the ASoC point of view but possibly from the PowerPC side?
>
> > You have to configure at least the name. Otherwise if the machine
> > driver is the last to register, how do you know to hold off the final
> > registration and wait for the machine driver to appear?
>
>
> I understand why you have made this change but it's a substantial change
> which should at least be documented in the changelog (I'd expect to see
> some mention of how this is supposed to be configured, for example).
> I'd also expect something to handle the existing user.
This is a modification to Grant's new driver. Grant is the only other user.
>
> Like I said, I'm not entirely sure that you're supposed to be using this
> driver if you want a machine driver: this is a machine driver and I'm
> not sure if it's supposed to cover all cases or not. Grant?
>
>
> > Or is it ok for me to change these after the platform device has been created?
> > of_soc->dai_link.ops = machine_ops;
> > of_soc->machine.name = machine_name;
>
>
> No.
>
--
Jon Smirl
jonsmirl@gmail.com
^ permalink raw reply
* [PATCH] libfdt: Fix 'make install' target handling of .h files.
From: Jon Loeliger @ 2008-07-23 15:20 UTC (permalink / raw)
To: linuxppc-dev
The definition of LIBFDT_INCLUDES was accidentally dropped.
Put it back and add srcdir prefix handling for it.
Signed-off-by: Jon Loeliger <jdl@freescale.com>
---
Makefile | 4 +++-
libfdt/Makefile.libfdt | 1 +
2 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/Makefile b/Makefile
index e871855..0222dc0 100644
--- a/Makefile
+++ b/Makefile
@@ -55,7 +55,7 @@ install: all
$(INSTALL) -d $(DESTDIR)$(LIBDIR)
$(INSTALL) -m 644 $(LIBFDT_lib) $(DESTDIR)$(LIBDIR)
$(INSTALL) -d $(DESTDIR)$(INCLUDEDIR)
- $(INSTALL) -m 644 $(addprefix $(LIBFDT_srcdir)/,$(LIBFDT_INCLUDES)) $(DESTDIR)$(INCLUDEDIR)
+ $(INSTALL) -m 644 $(LIBFDT_include) $(DESTDIR)$(INCLUDEDIR)
#
# Rules for versioning
@@ -140,6 +140,8 @@ endif
LIBFDT_objdir = libfdt
LIBFDT_srcdir = libfdt
LIBFDT_lib = $(LIBFDT_objdir)/libfdt.a
+LIBFDT_include = $(addprefix $(LIBFDT_srcdir)/,$(LIBFDT_INCLUDES))
+
include $(LIBFDT_srcdir)/Makefile.libfdt
.PHONY: libfdt
diff --git a/libfdt/Makefile.libfdt b/libfdt/Makefile.libfdt
index f4f495b..6c42acf 100644
--- a/libfdt/Makefile.libfdt
+++ b/libfdt/Makefile.libfdt
@@ -3,5 +3,6 @@
# This is not a complete Makefile of itself. Instead, it is designed to
# be easily embeddable into other systems of Makefiles.
#
+LIBFDT_INCLUDES = fdt.h libfdt.h
LIBFDT_SRCS = fdt.c fdt_ro.c fdt_wip.c fdt_sw.c fdt_rw.c fdt_strerror.c
LIBFDT_OBJS = $(LIBFDT_SRCS:%.c=%.o)
--
1.5.6.3.439.g1e10
^ permalink raw reply related
* Re: [alsa-devel] [PATCH 2/2] Allow a custom ASOC machine driver with soc-of-simple
From: Mark Brown @ 2008-07-23 15:36 UTC (permalink / raw)
To: Jon Smirl; +Cc: linuxppc-dev, alsa-devel
In-Reply-To: <9e4733910807230816m474af04ch9b6650cdbb96ffec@mail.gmail.com>
On Wed, Jul 23, 2008 at 11:16:17AM -0400, Jon Smirl wrote:
> On 7/23/08, Mark Brown <broonie@opensource.wolfsonmicro.com> wrote:
> > I'd also expect something to handle the existing user.
> This is a modification to Grant's new driver. Grant is the only other user.
Right, hence my use of the singular : ) . Since you are adding this new
of_snd_soc_register_machine() Grant's existing platform won't be calling
it yet and will therefore stop instantiating the ASoC subsystem until it
is changed to do so.
^ permalink raw reply
* Re: [RFC] 4xx hardware watchpoint support
From: Luis Machado @ 2008-07-23 14:42 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: ppc-dev, Paul Mackerras
In-Reply-To: <20080723142335.GA22767@lst.de>
> Some comment, first the above negate conditional
> looks rather ugly, I'd rather do a
>
> #if defined(CONFIG_4xx) || defined(CONFIG_BOOKE)
> dbcr0 case
> #else
> dabr case
> #endif
Yes, it makes sense. I'll switch it around.
> second I wonder why we have the notify_die only for one case, that seems
> rather odd. Looking further the notify_die is even more odd because
> DIE_DABR_MATCH doesn't actually appear anywhere else in the kernel.
> I'd suggest simply removing it.
DIE_DABR_MATCH doesn't appear anywhere else because there is only a
single function responsible for handling the DABR/DAC events on powerPC
with this modification. It would make sense to call this to both the
DAC/DABR cases though (i.e. taking it out of the #ifdef), what do you
think?
> Can you redo this in the normal Linux comment style, ala:
>
> /*
> * For processors using DABR (i.e. 970), the bottom 3 bits are flags.
> * It was assumed, on previous implementations, that 3 bits were
> * passed together with the data address, fitting the design of the
> * DABR register, as follows:
> *
> * bit 0: Read flag
> * bit 1: Write flag
> * bit 2: Breakpoint translation
> *
> * Thus, we use them here as so.
> */
>
> and similar in few other places.
Will do, thanks for reviewing this one.
Regards,
Luis
^ permalink raw reply
* Re: [RFC] 4xx hardware watchpoint support
From: Josh Boyer @ 2008-07-23 15:53 UTC (permalink / raw)
To: luisgpm; +Cc: ppc-dev, Paul Mackerras
In-Reply-To: <1216777678.5727.82.camel@gargoyle>
On Tue, 22 Jul 2008 22:47:58 -0300
Luis Machado <luisgpm@linux.vnet.ibm.com> wrote:
> Hi,
>
> > That, or adding a small function to move the bits to the appropriate
> > registers (set_dbcr or set_dac_events).
> >
> > > Do you think it's worth to support this facility on 405's processors? If
> > > so, i'll gladly work on a solution to it.
> >
> > I would think so. There's really no difference from a userspace
> > perspective, so gdb watchpoints could be valuable there too. I'll
> > leave it up to you though.
>
> As the 440 support is ready and the 405 needs additional tweaking due to
> the use of DBCR1 instead of DBCR0 and due to a different position scheme
> of the DAC1R/DAC1W flags inside DBCR1, i'd say we should include this
> code and handle the 405 case later.
That's fine with me, but I have one question below then.
> Index: linux-2.6.26/arch/powerpc/kernel/signal.c
> ===================================================================
> --- linux-2.6.26.orig/arch/powerpc/kernel/signal.c 2008-07-20 16:56:57.000000000 -0700
> +++ linux-2.6.26/arch/powerpc/kernel/signal.c 2008-07-22 16:47:22.000000000 -0700
> @@ -145,8 +145,12 @@
> * user space. The DABR will have been cleared if it
> * triggered inside the kernel.
> */
> - if (current->thread.dabr)
> + if (current->thread.dabr) {
> set_dabr(current->thread.dabr);
> +#if defined(CONFIG_40x) || defined(CONFIG_BOOKE)
> + mtspr(SPRN_DBCR0, current->thread.dbcr0);
> +#endif
Shouldn't this (and other places) be:
#if defined(CONFIG_44x) || defined(CONFIG_BOOKE)
if you are going to exclude 40x for now? Otherwise this is still
enabled on 405 and setting the wrong register.
josh
^ permalink raw reply
* Re: [RFC] 4xx hardware watchpoint support
From: Luis Machado @ 2008-07-23 16:10 UTC (permalink / raw)
To: Josh Boyer; +Cc: ppc-dev, Paul Mackerras, Christoph Hellwig
In-Reply-To: <20080723115321.53aa655b@zod.rchland.ibm.com>
On Wed, 2008-07-23 at 11:53 -0400, Josh Boyer wrote:
> Shouldn't this (and other places) be:
>
> #if defined(CONFIG_44x) || defined(CONFIG_BOOKE)
>
> if you are going to exclude 40x for now? Otherwise this is still
> enabled on 405 and setting the wrong register.
>
> josh
Yes, sorry. I wasn't aware of this specific define value. It makes
things easier to support 405's later.
Like so?
This addresses Christoph's comments as well.
Signed-off-by: Luis Machado <luisgpm@br.ibm.com>
Index: linux-2.6.26/arch/powerpc/kernel/entry_32.S
===================================================================
--- linux-2.6.26.orig/arch/powerpc/kernel/entry_32.S 2008-07-23 07:44:57.000000000 -0700
+++ linux-2.6.26/arch/powerpc/kernel/entry_32.S 2008-07-23 07:50:31.000000000 -0700
@@ -148,7 +148,7 @@
/* Check to see if the dbcr0 register is set up to debug. Use the
internal debug mode bit to do this. */
lwz r12,THREAD_DBCR0(r12)
- andis. r12,r12,DBCR0_IDM@h
+ andis. r12,r12,(DBCR0_IDM | DBSR_DAC1R | DBSR_DAC1W)@h
beq+ 3f
/* From user and task is ptraced - load up global dbcr0 */
li r12,-1 /* clear all pending debug events */
@@ -292,7 +292,7 @@
/* If the process has its own DBCR0 value, load it up. The internal
debug mode bit tells us that dbcr0 should be loaded. */
lwz r0,THREAD+THREAD_DBCR0(r2)
- andis. r10,r0,DBCR0_IDM@h
+ andis. r10,r0,(DBCR0_IDM | DBSR_DAC1R | DBSR_DAC1W)@h
bnel- load_dbcr0
#endif
#ifdef CONFIG_44x
@@ -720,7 +720,7 @@
/* Check whether this process has its own DBCR0 value. The internal
debug mode bit tells us that dbcr0 should be loaded. */
lwz r0,THREAD+THREAD_DBCR0(r2)
- andis. r10,r0,DBCR0_IDM@h
+ andis. r10,r0,(DBCR0_IDM | DBSR_DAC1R | DBSR_DAC1W)@h
bnel- load_dbcr0
#endif
Index: linux-2.6.26/arch/powerpc/kernel/process.c
===================================================================
--- linux-2.6.26.orig/arch/powerpc/kernel/process.c 2008-07-23 07:44:57.000000000 -0700
+++ linux-2.6.26/arch/powerpc/kernel/process.c 2008-07-23 07:50:31.000000000 -0700
@@ -47,6 +47,8 @@
#ifdef CONFIG_PPC64
#include <asm/firmware.h>
#endif
+#include <linux/kprobes.h>
+#include <linux/kdebug.h>
extern unsigned long _get_SP(void);
@@ -239,6 +241,35 @@
}
#endif /* CONFIG_SMP */
+void do_dabr(struct pt_regs *regs, unsigned long address,
+ unsigned long error_code)
+{
+ siginfo_t info;
+
+ if (notify_die(DIE_DABR_MATCH, "dabr_match", regs, error_code,
+ 11, SIGSEGV) == NOTIFY_STOP)
+ return;
+
+ if (debugger_dabr_match(regs))
+ return;
+
+ /* Clear the DAC and struct entries. One shot trigger */
+#if (defined(CONFIG_44x) || defined(CONFIG_BOOKE))
+ mtspr(SPRN_DBCR0, mfspr(SPRN_DBCR0) & ~(DBSR_DAC1R | DBSR_DAC1W
+ | DBCR0_IDM));
+#endif
+
+ /* Clear the DABR */
+ set_dabr(0);
+
+ /* Deliver the signal to userspace */
+ info.si_signo = SIGTRAP;
+ info.si_errno = 0;
+ info.si_code = TRAP_HWBKPT;
+ info.si_addr = (void __user *)address;
+ force_sig_info(SIGTRAP, &info, current);
+}
+
static DEFINE_PER_CPU(unsigned long, current_dabr);
int set_dabr(unsigned long dabr)
@@ -254,6 +285,11 @@
#if defined(CONFIG_PPC64) || defined(CONFIG_6xx)
mtspr(SPRN_DABR, dabr);
#endif
+
+#if defined(CONFIG_44x) || defined(CONFIG_BOOKE)
+ mtspr(SPRN_DAC1, dabr);
+#endif
+
return 0;
}
@@ -337,6 +373,12 @@
if (unlikely(__get_cpu_var(current_dabr) != new->thread.dabr))
set_dabr(new->thread.dabr);
+#if defined(CONFIG_44x) || defined(CONFIG_BOOKE)
+ /* If new thread DAC (HW breakpoint) is the same then leave it */
+ if (new->thread.dabr)
+ set_dabr(new->thread.dabr);
+#endif
+
new_thread = &new->thread;
old_thread = ¤t->thread;
@@ -525,6 +567,10 @@
if (current->thread.dabr) {
current->thread.dabr = 0;
set_dabr(0);
+
+#if defined(CONFIG_44x) || defined(CONFIG_BOOKE)
+ current->thread.dbcr0 &= ~(DBSR_DAC1R | DBSR_DAC1W);
+#endif
}
}
Index: linux-2.6.26/arch/powerpc/kernel/ptrace.c
===================================================================
--- linux-2.6.26.orig/arch/powerpc/kernel/ptrace.c 2008-07-23 07:44:57.000000000 -0700
+++ linux-2.6.26/arch/powerpc/kernel/ptrace.c 2008-07-23 07:53:45.000000000 -0700
@@ -703,7 +703,7 @@
if (regs != NULL) {
#if defined(CONFIG_40x) || defined(CONFIG_BOOKE)
- task->thread.dbcr0 = DBCR0_IDM | DBCR0_IC;
+ task->thread.dbcr0 |= DBCR0_IDM | DBCR0_IC;
regs->msr |= MSR_DE;
#else
regs->msr |= MSR_SE;
@@ -716,9 +716,16 @@
{
struct pt_regs *regs = task->thread.regs;
+
+#if defined(CONFIG_44x) || defined(CONFIG_BOOKE)
+ /* If DAC then do not single step, skip */
+ if (task->thread.dabr)
+ return;
+#endif
+
if (regs != NULL) {
#if defined(CONFIG_40x) || defined(CONFIG_BOOKE)
- task->thread.dbcr0 = 0;
+ task->thread.dbcr0 &= ~(DBCR0_IC | DBCR0_IDM);
regs->msr &= ~MSR_DE;
#else
regs->msr &= ~MSR_SE;
@@ -727,22 +734,75 @@
clear_tsk_thread_flag(task, TIF_SINGLESTEP);
}
-static int ptrace_set_debugreg(struct task_struct *task, unsigned long addr,
+int ptrace_set_debugreg(struct task_struct *task, unsigned long addr,
unsigned long data)
{
- /* We only support one DABR and no IABRS at the moment */
+ /* For ppc64 we support one DABR and no IABR's at the moment (ppc64).
+ * For embedded processors we support one DAC and no IAC's at the
+ * moment.
+ */
if (addr > 0)
return -EINVAL;
- /* The bottom 3 bits are flags */
if ((data & ~0x7UL) >= TASK_SIZE)
return -EIO;
- /* Ensure translation is on */
+#ifdef CONFIG_PPC64
+
+ /* For processors using DABR (i.e. 970), the bottom 3 bits are flags.
+ * It was assumed, on previous implementations, that 3 bits were
+ * passed together with the data address, fitting the design of the
+ * DABR register, as follows:
+ *
+ * bit 0: Read flag
+ * bit 1: Write flag
+ * bit 2: Breakpoint translation
+ *
+ * Thus, we use them here as so.
+ */
+
+ /* Ensure breakpoint translation bit is set */
if (data && !(data & DABR_TRANSLATION))
return -EIO;
+ /* Move contents to the DABR register */
task->thread.dabr = data;
+
+#endif
+#if defined(CONFIG_44x) || defined(CONFIG_BOOKE)
+
+ /* As described above, it was assumed 3 bits were passed with the data
+ * address, but we will assume only the mode bits will be passed
+ * as to not cause alignment restrictions for DAC-based processors.
+ */
+
+ /* DAC's hold the whole address without any mode flags */
+ task->thread.dabr = data & ~0x3UL;
+
+ if (task->thread.dabr == 0) {
+ task->thread.dbcr0 &= ~(DBSR_DAC1R | DBSR_DAC1W | DBCR0_IDM);
+ task->thread.regs->msr &= ~MSR_DE;
+ return 0;
+ }
+
+ /* Read or Write bits must be set */
+
+ if (!(data & 0x3UL))
+ return -EINVAL;
+
+ /* Set the Internal Debugging flag (IDM bit 1) for the DBCR0
+ register */
+ task->thread.dbcr0 = DBCR0_IDM;
+
+ /* Check for write and read flags and set DBCR0
+ accordingly */
+ if (data & 0x1UL)
+ task->thread.dbcr0 |= DBSR_DAC1R;
+ if (data & 0x2UL)
+ task->thread.dbcr0 |= DBSR_DAC1W;
+
+ task->thread.regs->msr |= MSR_DE;
+#endif
return 0;
}
Index: linux-2.6.26/arch/powerpc/kernel/signal.c
===================================================================
--- linux-2.6.26.orig/arch/powerpc/kernel/signal.c 2008-07-23 07:44:57.000000000 -0700
+++ linux-2.6.26/arch/powerpc/kernel/signal.c 2008-07-23 07:50:31.000000000 -0700
@@ -145,8 +145,12 @@
* user space. The DABR will have been cleared if it
* triggered inside the kernel.
*/
- if (current->thread.dabr)
+ if (current->thread.dabr) {
set_dabr(current->thread.dabr);
+#if defined(CONFIG_44x) || defined(CONFIG_BOOKE)
+ mtspr(SPRN_DBCR0, current->thread.dbcr0);
+#endif
+ }
if (is32) {
if (ka.sa.sa_flags & SA_SIGINFO)
Index: linux-2.6.26/arch/powerpc/kernel/traps.c
===================================================================
--- linux-2.6.26.orig/arch/powerpc/kernel/traps.c 2008-07-23 07:44:57.000000000 -0700
+++ linux-2.6.26/arch/powerpc/kernel/traps.c 2008-07-23 07:50:31.000000000 -0700
@@ -1067,6 +1067,22 @@
}
_exception(SIGTRAP, regs, TRAP_TRACE, regs->nip);
+ } else if (debug_status & (DBSR_DAC1R | DBSR_DAC1W)) {
+ regs->msr &= ~MSR_DE;
+
+ if (user_mode(regs)) {
+ current->thread.dbcr0 &= ~(DBSR_DAC1R | DBSR_DAC1W |
+ DBCR0_IDM);
+ } else {
+ /* Disable DAC interupts */
+ mtspr(SPRN_DBCR0, mfspr(SPRN_DBCR0) & ~(DBSR_DAC1R |
+ DBSR_DAC1W | DBCR0_IDM));
+
+ /* Clear the DAC event */
+ mtspr(SPRN_DBSR, (DBSR_DAC1R | DBSR_DAC1W));
+ }
+ /* Setup and send the trap to the handler */
+ do_dabr(regs, mfspr(SPRN_DAC1), debug_status);
}
}
#endif /* CONFIG_4xx || CONFIG_BOOKE */
Index: linux-2.6.26/arch/powerpc/mm/fault.c
===================================================================
--- linux-2.6.26.orig/arch/powerpc/mm/fault.c 2008-07-23 07:44:57.000000000 -0700
+++ linux-2.6.26/arch/powerpc/mm/fault.c 2008-07-23 07:50:31.000000000 -0700
@@ -100,31 +100,6 @@
return 0;
}
-#if !(defined(CONFIG_4xx) || defined(CONFIG_BOOKE))
-static void do_dabr(struct pt_regs *regs, unsigned long address,
- unsigned long error_code)
-{
- siginfo_t info;
-
- if (notify_die(DIE_DABR_MATCH, "dabr_match", regs, error_code,
- 11, SIGSEGV) == NOTIFY_STOP)
- return;
-
- if (debugger_dabr_match(regs))
- return;
-
- /* Clear the DABR */
- set_dabr(0);
-
- /* Deliver the signal to userspace */
- info.si_signo = SIGTRAP;
- info.si_errno = 0;
- info.si_code = TRAP_HWBKPT;
- info.si_addr = (void __user *)address;
- force_sig_info(SIGTRAP, &info, current);
-}
-#endif /* !(CONFIG_4xx || CONFIG_BOOKE)*/
-
/*
* For 600- and 800-family processors, the error_code parameter is DSISR
* for a data fault, SRR1 for an instruction fault. For 400-family processors
Index: linux-2.6.26/include/asm-powerpc/system.h
===================================================================
--- linux-2.6.26.orig/include/asm-powerpc/system.h 2008-07-23 07:44:57.000000000 -0700
+++ linux-2.6.26/include/asm-powerpc/system.h 2008-07-23 07:50:31.000000000 -0700
@@ -110,6 +110,8 @@
#endif
extern int set_dabr(unsigned long dabr);
+extern void do_dabr(struct pt_regs *regs, unsigned long address,
+ unsigned long error_code);
extern void print_backtrace(unsigned long *);
extern void show_regs(struct pt_regs * regs);
extern void flush_instruction_cache(void);
^ permalink raw reply
* Re: [RFC] 4xx hardware watchpoint support
From: Kumar Gala @ 2008-07-23 16:26 UTC (permalink / raw)
To: Josh Boyer; +Cc: ppc-dev, Paul Mackerras
In-Reply-To: <20080723115321.53aa655b@zod.rchland.ibm.com>
On Jul 23, 2008, at 10:53 AM, Josh Boyer wrote:
> On Tue, 22 Jul 2008 22:47:58 -0300
> Luis Machado <luisgpm@linux.vnet.ibm.com> wrote:
>
>> Hi,
>>
>>> That, or adding a small function to move the bits to the appropriate
>>> registers (set_dbcr or set_dac_events).
>>>
>>>> Do you think it's worth to support this facility on 405's
>>>> processors? If
>>>> so, i'll gladly work on a solution to it.
>>>
>>> I would think so. There's really no difference from a userspace
>>> perspective, so gdb watchpoints could be valuable there too. I'll
>>> leave it up to you though.
>>
>> As the 440 support is ready and the 405 needs additional tweaking
>> due to
>> the use of DBCR1 instead of DBCR0 and due to a different position
>> scheme
>> of the DAC1R/DAC1W flags inside DBCR1, i'd say we should include this
>> code and handle the 405 case later.
>
> That's fine with me, but I have one question below then.
>
>> Index: linux-2.6.26/arch/powerpc/kernel/signal.c
>> ===================================================================
>> --- linux-2.6.26.orig/arch/powerpc/kernel/signal.c 2008-07-20
>> 16:56:57.000000000 -0700
>> +++ linux-2.6.26/arch/powerpc/kernel/signal.c 2008-07-22
>> 16:47:22.000000000 -0700
>> @@ -145,8 +145,12 @@
>> * user space. The DABR will have been cleared if it
>> * triggered inside the kernel.
>> */
>> - if (current->thread.dabr)
>> + if (current->thread.dabr) {
>> set_dabr(current->thread.dabr);
>> +#if defined(CONFIG_40x) || defined(CONFIG_BOOKE)
>> + mtspr(SPRN_DBCR0, current->thread.dbcr0);
>> +#endif
>
> Shouldn't this (and other places) be:
>
> #if defined(CONFIG_44x) || defined(CONFIG_BOOKE)
>
> if you are going to exclude 40x for now? Otherwise this is still
> enabled on 405 and setting the wrong register.
if we are ignoring 40x this can just be CONFIG_BOOKE. CONFIG_44x sets
CONFIG_BOOKE.
- k
^ permalink raw reply
* Re: DTS configuration of external interrupts on 8347
From: Sean MacLennan @ 2008-07-23 17:13 UTC (permalink / raw)
To: richw; +Cc: linuxppc-dev, richard.whitlo
In-Reply-To: <4887471E.6070306@btconnect.com>
On Wed, 23 Jul 2008 15:58:38 +0100
"Richard Whitlock" <richard.whitlo@btconnect.com> wrote:
> I have a small problem with a port of linux 2.6.26 to a custom board.
> Our board is almost identical to the Analogue & Micro asp 8347 board,
> so I'm using Kumar Gala's excellent fsl tree (thank you Kumar) as it
> already has a defconfig for the asp.
> Thanks also to Bryan O'Donoghue for pointing us in the direction of
> the asp port in the first place.
>
> The problem we have is I am unable to request an external interrupt.
> We have an FPGA which has an interrupt line - HW IRQ_0, so thats
> linux IRQ 48. I have added the following to the dts file:
>
> fpgaKFAF@0xF8000000 {
> interrupts = <48 8>;
> interrupt-parent = <&ipic>;
> }
>
> but whenever I call request_irq() it returns -ENOSYS.
>
> The driver loads fine, and the open function does very little - a
> call to ioremap() - which works, and a call to request_irq() which
> does not. Is there anything else I have to do to configure this
> interrupt?
I don't think you have enough information in the dts. We do the same
thing on the warp (you can look at the warp.dts):
fpga@2,0 {
compatible = "pika,fpga";
reg = <0x00000002 0x00000000 0x00001000>;
interrupts = <0x18 0x8>;
interrupt-parent = <&UIC0>;
};
You need the compatible, maybe "kfaf,fpga", and I believe the reg entry
although you could try without it.
You then can use:
of_find_compatible_node
irq_of_parse_and_map
request_irq
platforms/44x/warp.c shows an example using the ad7414. Just change the
ad7414 string to your compatible string.
Cheers,
Sean
^ permalink raw reply
* Xilinx linux Wiki
From: Jacob Holladay Poteet @ 2008-07-23 18:17 UTC (permalink / raw)
To: linuxppc-dev
[-- Attachment #1: Type: text/plain, Size: 590 bytes --]
Hello All,
This message is an advertisement for the new Xilinx wiki at
http://xilinx.wikidot.com/ . I think this could be a useful and
longstanding resource that could help bring new members into the
Embedded Linux for Xilinx community rather quickly. Because this project
isn't completely within the focus of this mailing list I apologize; I
really believe that it may be of interest to many people that work here
though. If you have any comments on the place of a wiki like this or are
aware of any other community resources with active contributions, please
reply.
Thanks,
Jake Poteet
[-- Attachment #2: Type: text/html, Size: 880 bytes --]
^ permalink raw reply
* [PATCH 00/16 v4] powerpc: pSeries Cooperative Memory Overcommitment support
From: Robert Jennings @ 2008-07-23 18:19 UTC (permalink / raw)
To: paulus, benh; +Cc: Brian King, linuxppc-dev, David Darrington
This is version 4 of the full patchset pulling in all prior changes
posted to the list. Two patches sent separately to apply on top of the
prior set have been included in this set.
Cooperative Memory Overcommitment (CMO) is a pSeries platform feature
that enables the allocation of more memory to a set logical partitions
than is physically present. For example, a system with 16Gb of memory
can be configured to simultaneously run 3 logical partitions each with
8Gb of memory allocated to them.
The system firmware can page out memory as needed to meet the needs
of each partition. To minimize the effects of firmware paging memory,
the Collaborative Memory Manager (CMM) driver acts as a balloon driver
to work with firmware to provide memory ahead of any paging needs.
The OS is provided with an entitlement of IO memory for device drivers
to map. This amount varies with the number of virtual IO adapters
present and can change as devices are hot-plugged. The VIO bus code
distributes this memory to devices. Logical partitions supporting CMO
may only have virtual IO devices, physical devices are not supported.
Above the entitled level, IO mappings can fail and the IOMMU needed be
updated to handle this change.
Virtual IO adapters have been updated to handle DMA mapping failures and
to size their entitlement needs.
Platform support for for CMM and hot-plug entitlement events are also
included in the following patches.
The changes should have minimal impact to non-CMO enabled environments.
This patch set has been written against 2.6.26 and has been tested
at that level.
Regards,
Robert Jennings
^ permalink raw reply
* [PATCH 01/16 v4] powerpc: Remove extraneous error reporting for hcall failures in lparcfg
From: Robert Jennings @ 2008-07-23 18:25 UTC (permalink / raw)
To: paulus, benh; +Cc: Brian King, linuxppc-dev, David Darrington
In-Reply-To: <20080723181932.GC12905@linux.vnet.ibm.com>
=46rom: Nathan Fontenot <nfont@austin.ibm.com>
Remove the extraneous error reporting used when a hcall made from lparcfg f=
ails.
Signed-off-by: Nathan Fontenot <nfont@austin.ibm.com>
Signed-off-by: Robert Jennings <rcj@linux.vnet.ibm.com>
Acked-by: Paul Mackerras <paulus@samba.org>
---
arch/powerpc/kernel/lparcfg.c | 32 --------------------------------
1 file changed, 32 deletions(-)
Index: b/arch/powerpc/kernel/lparcfg.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- a/arch/powerpc/kernel/lparcfg.c
+++ b/arch/powerpc/kernel/lparcfg.c
@@ -129,33 +129,6 @@ static int iseries_lparcfg_data(struct s
/*
* Methods used to fetch LPAR data when running on a pSeries platform.
*/
-static void log_plpar_hcall_return(unsigned long rc, char *tag)
-{
- switch(rc) {
- case 0:
- return;
- case H_HARDWARE:
- printk(KERN_INFO "plpar-hcall (%s) "
- "Hardware fault\n", tag);
- return;
- case H_FUNCTION:
- printk(KERN_INFO "plpar-hcall (%s) "
- "Function not allowed\n", tag);
- return;
- case H_AUTHORITY:
- printk(KERN_INFO "plpar-hcall (%s) "
- "Not authorized to this function\n", tag);
- return;
- case H_PARAMETER:
- printk(KERN_INFO "plpar-hcall (%s) "
- "Bad parameter(s)\n",tag);
- return;
- default:
- printk(KERN_INFO "plpar-hcall (%s) "
- "Unexpected rc(0x%lx)\n", tag, rc);
- }
-}
-
/*
* H_GET_PPP hcall returns info in 4 parms.
* entitled_capacity,unallocated_capacity,
@@ -191,8 +164,6 @@ static unsigned int h_get_ppp(unsigned l
*aggregation =3D retbuf[2];
*resource =3D retbuf[3];
=20
- log_plpar_hcall_return(rc, "H_GET_PPP");
-
return rc;
}
=20
@@ -205,9 +176,6 @@ static void h_pic(unsigned long *pool_id
=20
*pool_idle_time =3D retbuf[0];
*num_procs =3D retbuf[1];
-
- if (rc !=3D H_AUTHORITY)
- log_plpar_hcall_return(rc, "H_PIC");
}
=20
#define SPLPAR_CHARACTERISTICS_TOKEN 20
^ permalink raw reply
* [PATCH 02/16 v4] powerpc: Split processor entitlement retrieval and gat
From: Robert Jennings @ 2008-07-23 18:25 UTC (permalink / raw)
To: paulus, benh; +Cc: Brian King, linuxppc-dev, David Darrington
In-Reply-To: <20080723181932.GC12905@linux.vnet.ibm.com>
hering to helper routines
=46rom: Nathan Fotenot <nfont@austin.ibm.com>
Split the retrieval and setting of processor entitlement and weight into
helper routines. This also removes the printing of the raw values
returned from h_get_ppp, the values are already parsed and printed.
Signed-off-by: Nathan Fontenot <nfont@austin.ibm.com>
Signed-off-by: Robert Jennings <rcj@linux.vnet.ibm.com>
---
Updated patch to remove checking the return code from the h_call for
H_PIC. This reverts the reporting back to its original state.
---
arch/powerpc/kernel/lparcfg.c | 166 ++++++++++++++++++++++---------------=
-----
1 file changed, 88 insertions(+), 78 deletions(-)
Index: b/arch/powerpc/kernel/lparcfg.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- a/arch/powerpc/kernel/lparcfg.c
+++ b/arch/powerpc/kernel/lparcfg.c
@@ -167,7 +167,8 @@ static unsigned int h_get_ppp(unsigned l
return rc;
}
=20
-static void h_pic(unsigned long *pool_idle_time, unsigned long *num_procs)
+static unsigned h_pic(unsigned long *pool_idle_time,
+ unsigned long *num_procs)
{
unsigned long rc;
unsigned long retbuf[PLPAR_HCALL_BUFSIZE];
@@ -176,6 +177,51 @@ static void h_pic(unsigned long *pool_id
=20
*pool_idle_time =3D retbuf[0];
*num_procs =3D retbuf[1];
+
+ return rc;
+}
+
+/*
+ * parse_ppp_data
+ * Parse out the data returned from h_get_ppp and h_pic
+ */
+static void parse_ppp_data(struct seq_file *m)
+{
+ unsigned long h_entitled, h_unallocated;
+ unsigned long h_aggregation, h_resource;
+ int rc;
+
+ rc =3D h_get_ppp(&h_entitled, &h_unallocated, &h_aggregation,
+ &h_resource);
+ if (rc)
+ return;
+
+ seq_printf(m, "partition_entitled_capacity=3D%ld\n", h_entitled);
+ seq_printf(m, "group=3D%ld\n", (h_aggregation >> 2 * 8) & 0xffff);
+ seq_printf(m, "system_active_processors=3D%ld\n",
+ (h_resource >> 0 * 8) & 0xffff);
+
+ /* pool related entries are apropriate for shared configs */
+ if (lppaca[0].shared_proc) {
+ unsigned long pool_idle_time, pool_procs;
+
+ seq_printf(m, "pool=3D%ld\n", (h_aggregation >> 0 * 8) & 0xffff);
+
+ /* report pool_capacity in percentage */
+ seq_printf(m, "pool_capacity=3D%ld\n",
+ ((h_resource >> 2 * 8) & 0xffff) * 100);
+
+ h_pic(&pool_idle_time, &pool_procs);
+ seq_printf(m, "pool_idle_time=3D%ld\n", pool_idle_time);
+ seq_printf(m, "pool_num_procs=3D%ld\n", pool_procs);
+ }
+
+ seq_printf(m, "unallocated_capacity_weight=3D%ld\n",
+ (h_resource >> 4 * 8) & 0xFF);
+
+ seq_printf(m, "capacity_weight=3D%ld\n", (h_resource >> 5 * 8) & 0xFF);
+ seq_printf(m, "capped=3D%ld\n", (h_resource >> 6 * 8) & 0x01);
+ seq_printf(m, "unallocated_capacity=3D%ld\n", h_unallocated);
}
=20
#define SPLPAR_CHARACTERISTICS_TOKEN 20
@@ -302,60 +348,11 @@ static int pseries_lparcfg_data(struct s
partition_active_processors =3D lparcfg_count_active_processors();
=20
if (firmware_has_feature(FW_FEATURE_SPLPAR)) {
- unsigned long h_entitled, h_unallocated;
- unsigned long h_aggregation, h_resource;
- unsigned long pool_idle_time, pool_procs;
- unsigned long purr;
-
- h_get_ppp(&h_entitled, &h_unallocated, &h_aggregation,
- &h_resource);
-
- seq_printf(m, "R4=3D0x%lx\n", h_entitled);
- seq_printf(m, "R5=3D0x%lx\n", h_unallocated);
- seq_printf(m, "R6=3D0x%lx\n", h_aggregation);
- seq_printf(m, "R7=3D0x%lx\n", h_resource);
-
- purr =3D get_purr();
-
/* this call handles the ibm,get-system-parameter contents */
parse_system_parameter_string(m);
+ parse_ppp_data(m);
=20
- seq_printf(m, "partition_entitled_capacity=3D%ld\n", h_entitled);
-
- seq_printf(m, "group=3D%ld\n", (h_aggregation >> 2 * 8) & 0xffff);
-
- seq_printf(m, "system_active_processors=3D%ld\n",
- (h_resource >> 0 * 8) & 0xffff);
-
- /* pool related entries are apropriate for shared configs */
- if (lppaca[0].shared_proc) {
-
- h_pic(&pool_idle_time, &pool_procs);
-
- seq_printf(m, "pool=3D%ld\n",
- (h_aggregation >> 0 * 8) & 0xffff);
-
- /* report pool_capacity in percentage */
- seq_printf(m, "pool_capacity=3D%ld\n",
- ((h_resource >> 2 * 8) & 0xffff) * 100);
-
- seq_printf(m, "pool_idle_time=3D%ld\n", pool_idle_time);
-
- seq_printf(m, "pool_num_procs=3D%ld\n", pool_procs);
- }
-
- seq_printf(m, "unallocated_capacity_weight=3D%ld\n",
- (h_resource >> 4 * 8) & 0xFF);
-
- seq_printf(m, "capacity_weight=3D%ld\n",
- (h_resource >> 5 * 8) & 0xFF);
-
- seq_printf(m, "capped=3D%ld\n", (h_resource >> 6 * 8) & 0x01);
-
- seq_printf(m, "unallocated_capacity=3D%ld\n", h_unallocated);
-
- seq_printf(m, "purr=3D%ld\n", purr);
-
+ seq_printf(m, "purr=3D%ld\n", get_purr());
} else { /* non SPLPAR case */
=20
seq_printf(m, "system_active_processors=3D%d\n",
@@ -382,6 +379,41 @@ static int pseries_lparcfg_data(struct s
return 0;
}
=20
+static ssize_t update_ppp(u64 *entitlement, u8 *weight)
+{
+ unsigned long current_entitled;
+ unsigned long dummy;
+ unsigned long resource;
+ u8 current_weight, new_weight;
+ u64 new_entitled;
+ ssize_t retval;
+
+ /* Get our current parameters */
+ retval =3D h_get_ppp(¤t_entitled, &dummy, &dummy, &resource);
+ if (retval)
+ return retval;
+
+ current_weight =3D (resource >> 5 * 8) & 0xFF;
+
+ if (entitlement) {
+ new_weight =3D current_weight;
+ new_entitled =3D *entitlement;
+ } else if (weight) {
+ new_weight =3D *weight;
+ new_entitled =3D current_entitled;
+ } else
+ return -EINVAL;
+
+ pr_debug("%s: current_entitled =3D %lu, current_weight =3D %u\n",
+ __FUNCTION__, current_entitled, current_weight);
+
+ pr_debug("%s: new_entitled =3D %lu, new_weight =3D %u\n",
+ __FUNCTION__, new_entitled, new_weight);
+
+ retval =3D plpar_hcall_norets(H_SET_PPP, new_entitled, new_weight);
+ return retval;
+}
+
/*
* Interface for changing system parameters (variable capacity weight
* and entitled capacity). Format of input is "param_name=3Dvalue";
@@ -399,12 +431,6 @@ static ssize_t lparcfg_write(struct file
char *tmp;
u64 new_entitled, *new_entitled_ptr =3D &new_entitled;
u8 new_weight, *new_weight_ptr =3D &new_weight;
-
- unsigned long current_entitled; /* parameters for h_get_ppp */
- unsigned long dummy;
- unsigned long resource;
- u8 current_weight;
-
ssize_t retval =3D -ENOMEM;
=20
if (!firmware_has_feature(FW_FEATURE_SPLPAR) ||
@@ -432,33 +458,17 @@ static ssize_t lparcfg_write(struct file
*new_entitled_ptr =3D (u64) simple_strtoul(tmp, &endp, 10);
if (endp =3D=3D tmp)
goto out;
- new_weight_ptr =3D ¤t_weight;
+
+ retval =3D update_ppp(new_entitled_ptr, NULL);
} else if (!strcmp(kbuf, "capacity_weight")) {
char *endp;
*new_weight_ptr =3D (u8) simple_strtoul(tmp, &endp, 10);
if (endp =3D=3D tmp)
goto out;
- new_entitled_ptr =3D ¤t_entitled;
- } else
- goto out;
=20
- /* Get our current parameters */
- retval =3D h_get_ppp(¤t_entitled, &dummy, &dummy, &resource);
- if (retval) {
- retval =3D -EIO;
+ retval =3D update_ppp(NULL, new_weight_ptr);
+ } else
goto out;
- }
-
- current_weight =3D (resource >> 5 * 8) & 0xFF;
-
- pr_debug("%s: current_entitled =3D %lu, current_weight =3D %u\n",
- __func__, current_entitled, current_weight);
-
- pr_debug("%s: new_entitled =3D %lu, new_weight =3D %u\n",
- __func__, *new_entitled_ptr, *new_weight_ptr);
-
- retval =3D plpar_hcall_norets(H_SET_PPP, *new_entitled_ptr,
- *new_weight_ptr);
=20
if (retval =3D=3D H_SUCCESS || retval =3D=3D H_CONSTRAINED) {
retval =3D count;
^ permalink raw reply
* [PATCH 03/16 v4] powerpc: Add memory entitlement capabilities to /proc/ppc64/lparcfg
From: Robert Jennings @ 2008-07-23 18:27 UTC (permalink / raw)
To: paulus, benh; +Cc: Brian King, linuxppc-dev, David Darrington
In-Reply-To: <20080723181932.GC12905@linux.vnet.ibm.com>
=46rom: Nathan Fontenot <nfont@austin.ibm.com>
Update /proc/ppc64/lparcfg to enable displaying of Cooperative Memory
Overcommitment statistics as reported by the H_GET_MPP hcall. This also
updates the lparcfg interface to allow setting memory entitlement and
weight.
Signed-off-by: Nathan Fontenot <nfont@austin.ibm.com>
Signed-off-by: Robert Jennings <rcj@linux.vnet.ibm.com>
---
Updated patch, increment the lparcfg module version number.
---
arch/powerpc/kernel/lparcfg.c | 121 +++++++++++++++++++++++++++++++++++++=
+++++
include/asm-powerpc/hvcall.h | 18 ++++++
2 files changed, 137 insertions(+), 2 deletions(-)
Index: b/arch/powerpc/kernel/lparcfg.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- a/arch/powerpc/kernel/lparcfg.c
+++ b/arch/powerpc/kernel/lparcfg.c
@@ -35,7 +35,7 @@
#include <asm/prom.h>
#include <asm/vdso_datapage.h>
=20
-#define MODULE_VERS "1.7"
+#define MODULE_VERS "1.8"
#define MODULE_NAME "lparcfg"
=20
/* #define LPARCFG_DEBUG */
@@ -129,6 +129,35 @@ static int iseries_lparcfg_data(struct s
/*
* Methods used to fetch LPAR data when running on a pSeries platform.
*/
+/**
+ * h_get_mpp
+ * H_GET_MPP hcall returns info in 7 parms
+ */
+int h_get_mpp(struct hvcall_mpp_data *mpp_data)
+{
+ int rc;
+ unsigned long retbuf[PLPAR_HCALL9_BUFSIZE];
+
+ rc =3D plpar_hcall9(H_GET_MPP, retbuf);
+
+ mpp_data->entitled_mem =3D retbuf[0];
+ mpp_data->mapped_mem =3D retbuf[1];
+
+ mpp_data->group_num =3D (retbuf[2] >> 2 * 8) & 0xffff;
+ mpp_data->pool_num =3D retbuf[2] & 0xffff;
+
+ mpp_data->mem_weight =3D (retbuf[3] >> 7 * 8) & 0xff;
+ mpp_data->unallocated_mem_weight =3D (retbuf[3] >> 6 * 8) & 0xff;
+ mpp_data->unallocated_entitlement =3D retbuf[3] & 0xffffffffffff;
+
+ mpp_data->pool_size =3D retbuf[4];
+ mpp_data->loan_request =3D retbuf[5];
+ mpp_data->backing_mem =3D retbuf[6];
+
+ return rc;
+}
+EXPORT_SYMBOL(h_get_mpp);
+
/*
* H_GET_PPP hcall returns info in 4 parms.
* entitled_capacity,unallocated_capacity,
@@ -224,6 +253,44 @@ static void parse_ppp_data(struct seq_fi
seq_printf(m, "unallocated_capacity=3D%ld\n", h_unallocated);
}
=20
+/**
+ * parse_mpp_data
+ * Parse out data returned from h_get_mpp
+ */
+static void parse_mpp_data(struct seq_file *m)
+{
+ struct hvcall_mpp_data mpp_data;
+ int rc;
+
+ rc =3D h_get_mpp(&mpp_data);
+ if (rc)
+ return;
+
+ seq_printf(m, "entitled_memory=3D%ld\n", mpp_data.entitled_mem);
+
+ if (mpp_data.mapped_mem !=3D -1)
+ seq_printf(m, "mapped_entitled_memory=3D%ld\n",
+ mpp_data.mapped_mem);
+
+ seq_printf(m, "entitled_memory_group_number=3D%d\n", mpp_data.group_num);
+ seq_printf(m, "entitled_memory_pool_number=3D%d\n", mpp_data.pool_num);
+
+ seq_printf(m, "entitled_memory_weight=3D%d\n", mpp_data.mem_weight);
+ seq_printf(m, "unallocated_entitled_memory_weight=3D%d\n",
+ mpp_data.unallocated_mem_weight);
+ seq_printf(m, "unallocated_io_mapping_entitlement=3D%ld\n",
+ mpp_data.unallocated_entitlement);
+
+ if (mpp_data.pool_size !=3D -1)
+ seq_printf(m, "entitled_memory_pool_size=3D%ld bytes\n",
+ mpp_data.pool_size);
+
+ seq_printf(m, "entitled_memory_loan_request=3D%ld\n",
+ mpp_data.loan_request);
+
+ seq_printf(m, "backing_memory=3D%ld bytes\n", mpp_data.backing_mem);
+}
+
#define SPLPAR_CHARACTERISTICS_TOKEN 20
#define SPLPAR_MAXLENGTH 1026*(sizeof(char))
=20
@@ -351,6 +418,7 @@ static int pseries_lparcfg_data(struct s
/* this call handles the ibm,get-system-parameter contents */
parse_system_parameter_string(m);
parse_ppp_data(m);
+ parse_mpp_data(m);
=20
seq_printf(m, "purr=3D%ld\n", get_purr());
} else { /* non SPLPAR case */
@@ -414,6 +482,43 @@ static ssize_t update_ppp(u64 *entitleme
return retval;
}
=20
+/**
+ * update_mpp
+ *
+ * Update the memory entitlement and weight for the partition. Caller must
+ * specify either a new entitlement or weight, not both, to be updated
+ * since the h_set_mpp call takes both entitlement and weight as parameter=
s.
+ */
+static ssize_t update_mpp(u64 *entitlement, u8 *weight)
+{
+ struct hvcall_mpp_data mpp_data;
+ u64 new_entitled;
+ u8 new_weight;
+ ssize_t rc;
+
+ rc =3D h_get_mpp(&mpp_data);
+ if (rc)
+ return rc;
+
+ if (entitlement) {
+ new_weight =3D mpp_data.mem_weight;
+ new_entitled =3D *entitlement;
+ } else if (weight) {
+ new_weight =3D *weight;
+ new_entitled =3D mpp_data.entitled_mem;
+ } else
+ return -EINVAL;
+
+ pr_debug("%s: current_entitled =3D %lu, current_weight =3D %u\n",
+ __FUNCTION__, mpp_data.entitled_mem, mpp_data.mem_weight);
+
+ pr_debug("%s: new_entitled =3D %lu, new_weight =3D %u\n",
+ __FUNCTION__, new_entitled, new_weight);
+
+ rc =3D plpar_hcall_norets(H_SET_MPP, new_entitled, new_weight);
+ return rc;
+}
+
/*
* Interface for changing system parameters (variable capacity weight
* and entitled capacity). Format of input is "param_name=3Dvalue";
@@ -467,6 +572,20 @@ static ssize_t lparcfg_write(struct file
goto out;
=20
retval =3D update_ppp(NULL, new_weight_ptr);
+ } else if (!strcmp(kbuf, "entitled_memory")) {
+ char *endp;
+ *new_entitled_ptr =3D (u64) simple_strtoul(tmp, &endp, 10);
+ if (endp =3D=3D tmp)
+ goto out;
+
+ retval =3D update_mpp(new_entitled_ptr, NULL);
+ } else if (!strcmp(kbuf, "entitled_memory_weight")) {
+ char *endp;
+ *new_weight_ptr =3D (u8) simple_strtoul(tmp, &endp, 10);
+ if (endp =3D=3D tmp)
+ goto out;
+
+ retval =3D update_mpp(NULL, new_weight_ptr);
} else
goto out;
=20
Index: b/include/asm-powerpc/hvcall.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- a/include/asm-powerpc/hvcall.h
+++ b/include/asm-powerpc/hvcall.h
@@ -210,7 +210,9 @@
#define H_JOIN 0x298
#define H_VASI_STATE 0x2A4
#define H_ENABLE_CRQ 0x2B0
-#define MAX_HCALL_OPCODE H_ENABLE_CRQ
+#define H_SET_MPP 0x2D0
+#define H_GET_MPP 0x2D4
+#define MAX_HCALL_OPCODE H_GET_MPP
=20
#ifndef __ASSEMBLY__
=20
@@ -270,6 +272,20 @@ struct hcall_stats {
};
#define HCALL_STAT_ARRAY_SIZE ((MAX_HCALL_OPCODE >> 2) + 1)
=20
+struct hvcall_mpp_data {
+ unsigned long entitled_mem;
+ unsigned long mapped_mem;
+ unsigned short group_num;
+ unsigned short pool_num;
+ unsigned char mem_weight;
+ unsigned char unallocated_mem_weight;
+ unsigned long unallocated_entitlement; /* value in bytes */
+ unsigned long pool_size;
+ signed long loan_request;
+ unsigned long backing_mem;
+};
+
+int h_get_mpp(struct hvcall_mpp_data *);
#endif /* __ASSEMBLY__ */
#endif /* __KERNEL__ */
#endif /* _ASM_POWERPC_HVCALL_H */
^ 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