Re: linux-next: powerpc build failure

2008-06-12 Thread Stephen Rothwell
On Thu, 12 Jun 2008 15:03:35 +0930 Alan Modra [EMAIL PROTECTED] wrote:

 On Thu, Jun 12, 2008 at 11:38:19AM +1000, Paul Mackerras wrote:
  Direct unconditional branches, including procedure calls, can only
  reach +/- 32MB from the address of the branch on powerpc.  So if the
  image grows to more than 32MB of text there is a problem unless the
  linker is smart enough to insert trampolines.  I don't know whether
  GNU ld is that smart.
 
 It is, but you need to pass --relax to enable generation of the
 trampolines.

So I tried this (added --relax to LDFLAGS_vmlinux if CONFIG FTRACE was
set) and got this;

/usr/bin/ld: --relax and -r may not be used together

So, I will disable FTRACE on powerpc for now by removing HAVE_FTRACE from
being selected in arch/powerpc/Kconfig.

-- 
Cheers,
Stephen Rothwell[EMAIL PROTECTED]
http://www.canb.auug.org.au/~sfr/


pgpJHcMNRkkt9.pgp
Description: PGP signature
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev

Re: linux-next: powerpc build failure

2008-06-12 Thread Ingo Molnar

* Stephen Rothwell [EMAIL PROTECTED] wrote:

  It is, but you need to pass --relax to enable generation of the 
  trampolines.
 
 So I tried this (added --relax to LDFLAGS_vmlinux if CONFIG FTRACE was 
 set) and got this;
 
 /usr/bin/ld: --relax and -r may not be used together
 
 So, I will disable FTRACE on powerpc for now by removing HAVE_FTRACE 
 from being selected in arch/powerpc/Kconfig.

ugh, please do that hack only privately in your allyesconfig testing and 
do not commit that change to linux-next!

It's not an ftrace bug, this problem is a limitation/bug of the powerpc 
architecture and it appears to me that any kernel feature that brings 
the allyesconfig text size above 32MB on powerpc will trigger this build 
failure.

A few months ago arch/x86 triggered an allyesconfig text size limitation 
at 40MB image size (on 64-bit) and we fixed it instead of disabling the 
feature/driver that happened to bring the image size above 40MB. See 
these commits:

 
 commit 88f3aec7afd9ae3e6f6d221801996b69aad1e3a4
 Author: Ingo Molnar [EMAIL PROTECTED]
 Date:   Thu Feb 21 11:04:11 2008 +0100

x86: fix spontaneous reboot with allyesconfig bzImage

 commit 85eb69a16aab5a394ce043c2131319eae35e6493
 Author: Ingo Molnar [EMAIL PROTECTED]
 Date:   Thu Feb 21 12:50:51 2008 +0100

x86: increase the kernel text limit to 512 MB
 

Ingo
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: linux-next: powerpc build failure

2008-06-12 Thread Stephen Rothwell
On Thu, 12 Jun 2008 17:05:05 +1000 Stephen Rothwell [EMAIL PROTECTED] wrote:

 So, I will disable FTRACE on powerpc for now by removing HAVE_FTRACE from
 being selected in arch/powerpc/Kconfig.

That got rid of the initial errors, but now it fails for relocations
on .memcmp and some others.

Next guess:  I have reverted commit
a7815807f749669d3e06529b2d448390f2ef0f9d (kbuild: simplify vmlinux link
stage) and powerpc allmodconfig builds again.  (even with FTRACE reenabled)

[For those that came in late (Sam):  a powerpc allyesconfig build was
getting errors like this:

net/ipx/af_ipx.c:1830: relocation truncated to fit: R_PPC64_REL24 against 
symbol `._mcount' defined in .text section in vmlinux.o

which I surmised was caused by ftrace adding -pg to KBUILD_CFLAGS.]

-- 
Cheers,
Stephen Rothwell[EMAIL PROTECTED]
http://www.canb.auug.org.au/~sfr/


pgpsSCcJtsOX9.pgp
Description: PGP signature
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev

Re: linux-next: powerpc build failure

2008-06-12 Thread Benjamin Herrenschmidt
On Thu, 2008-06-12 at 17:05 +1000, Stephen Rothwell wrote:
 So I tried this (added --relax to LDFLAGS_vmlinux if CONFIG FTRACE was
 set) and got this;
 
 /usr/bin/ld: --relax and -r may not be used together
 
 So, I will disable FTRACE on powerpc for now by removing HAVE_FTRACE
 from
 being selected in arch/powerpc/Kconfig.

So we completely lose ftrace for the sake of a config that nobody
sane ever uses (allyesconfig) ? :-)

Cheers,
Ben.


___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH REPOST] IB/ehca: In case of lost interrupts, trigger EOI to reenable interrupts

2008-06-12 Thread Benjamin Herrenschmidt
On Tue, 2008-06-10 at 16:44 +0200, Stefan Roscher wrote:
 During corner case testing, we noticed that some versions of ehca 
 do not properly transition to interrupt done in special load situations.
 This can be resolved by periodically triggering EOI through H_EOI, 
 if eqes are pending.
 
 Signed-off-by: Stefan Roscher [EMAIL PROTECTED]

This patch is fine with me as long as the FW/HW people can confirm that
calling spurrious EOI's like that will not affect other interrupts.

The side effect of writing 0xff to the xirr should be irrelevant as long as
this is not done from within a HW interrupt handler (timer interrupts or
softirqs are fine).

Due to the already incestuous relationship between HCA and the hypervisor,
I don't mind having the H call directly in the driver.

So as long as the FW/HW people are ok with that workaround, then it has
my ack as well.

Acked-by: Benjamin Herrenschmidt [EMAIL PROTECTED]
---



___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: linux-next: powerpc build failure

2008-06-12 Thread Stephen Rothwell
Hi Ingo,

On Thu, 12 Jun 2008 09:16:12 +0200 Ingo Molnar [EMAIL PROTECTED] wrote:

 ugh, please do that hack only privately in your allyesconfig testing and 
 do not commit that change to linux-next!

See my other email, I have removed the ftrace disabling patch and
reverted one of Sam Ravnborg's instead.

-- 
Cheers,
Stephen Rothwell[EMAIL PROTECTED]
http://www.canb.auug.org.au/~sfr/


pgpefqvJBYYC1.pgp
Description: PGP signature
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev

Re: [Cbe-oss-dev] [PATCH] powerpc/cell: disable ptcal in case of kdump reboot

2008-06-12 Thread Arnd Bergmann
On Wednesday 11 June 2008, Michael Ellerman wrote:
 On Wed, 2008-06-11 at 18:28 +0200, Arnd Bergmann wrote:
  We used to do this correctly in case of a user triggered
  kexec, but not for kdump.
 
 Used to?

Sorry, wrong wording. I meant without this patch, it's correct
for kexec.
 
  This patch disables ptcal from the cell specific
  machine_crash_shutdown() callback. 
 
 I'd rather you used the crash_shutdown_register() infrastructure Mikey
 added for EHEA - it's designed for just this sort of thing.

Thanks for pointing this out, I wasn't aware of that call.
New patch coming up.

Arnd 
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH] booting-without-of: add more bindings for FSL UPM driver

2008-06-12 Thread Wolfgang Grandegger
Segher Boessenkool wrote:
 +  - chip-delay : may specify a delay value in milliseconds.

 Delay for what?  The binding should say.  chip-delay is a bit
 too generic name as well, it could be more descriptive perhaps.

 The chip-delay property defines an appropriate maximum delay
 time (tR) required for read operations if the R/B pin is not
 connected.
 
 Yeah.  So please put that in the binding.
 
 Shouldn't this be a property of the NAND device anyway, not the
 NAND controller?

 Strictly speaking, it's a property of the NAND device. Therefore it
 should be inside the node [EMAIL PROTECTED], I thhink:

 +[EMAIL PROTECTED] {
 +#address-cells = 1;
 +#size-cells = 1;
 +chip-delay = 25; // in micro-seconds
 
 Something like that, yes.  You wrote milliseconds before; which is it?

Oops, it's in micro-seconds.

 And, a better property name, please.

Here is what we speak about (from the NAND chip manual):

  After a READ command is sent to the memory device, data is
   transferred from the memory array to the data register in tR.
   Typically tR is 25us. The READ STATUS (70h) command or the R/B#
   signal can be used to determine when the device is ready.

And in the NAND header file chip-delay is documented as shown below:

  chip_delay: [BOARDSPECIFIC] chip dependent delay for transfering data 
   from array to read regs (tR)

The name read-fetch-time sounds more reasonable too me, but English
is not my native language.

 Where should that be documented?
 
 In the binding for nand devices.  If there isn't any yet, it might be
 best to include that with the binding for your nand controller (i.e.,
 describe the whole sub node there).

OK, here is a my proposal:

x) Freescale Localbus UPM programmed to work with NAND flash

  Required properties:
  - compatible : fsl,upm-nand.
  - reg : should specify localbus chip select and size used for the chip.
  - fsl,upm-addr-offset : UPM pattern offset for the address latch.
  - fsl,upm-cmd-offset : UPM pattern offset for the command latch.
  - gpios : may specify optional GPIO connected to the Ready-Not-Busy pin.

  Each NAND flash device is represented as a sub-node of the UPM node.
  The nodes's name represents the name of the corresponding device.

  NAND flash properties:
  - compatible: not yet used.
  - read-fetch-delay: chip dependent delay for transfering data 
from array to read regs (tR) im micro-seconds.
 
  Each partition is represented as a sub-node of the NAND flash device.
  Each node's name represents the name of the corresponding partition
  of the NAND flash device.

  NAND flash partitions:
  - reg : The partition's offset and size within the flash bank.
  - label : (optional) The label / name for this flash partition.
If omitted, the label is taken from the node name (excluding
the unit address).
  - read-only : (optional) This parameter, if present, is a hint to
Linux that this flash partition should only be mounted
read-only.  This is usually used for flash partitions
containing early-boot firmware images or data which should not
be clobbered.
 
  Example:

[EMAIL PROTECTED],0 {
compatible = fsl,upm-nand;
reg = 1 0 1;
fsl,upm-addr-offset = 16;
fsl,upm-cmd-offset = 8;
gpios = qe_pio_e 18 0;

flash {
#address-cells = 1;
#size-cells = 1;
compatible = stmicro,NAND512W3A2BN6E;
read-fetch-delay = 25

[EMAIL PROTECTED] {
label = fs;
reg = 0 f8;
};

[EMAIL PROTECTED] {
label =firmware;
reg = f8 8;
read-only;
};
};
};

What do you think?

Wolfgang.

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [Cbe-oss-dev] [PATCH] powerpc/cell: disable ptcal in case of kdump reboot

2008-06-12 Thread Michael Neuling
In message [EMAIL PROTECTED] you wrote:
 On Wednesday 11 June 2008, Michael Ellerman wrote:
  On Wed, 2008-06-11 at 18:28 +0200, Arnd Bergmann wrote:
   We used to do this correctly in case of a user triggered
   kexec, but not for kdump.
  
  Used to?
 
 Sorry, wrong wording. I meant without this patch, it's correct
 for kexec.
  
   This patch disables ptcal from the cell specific
   machine_crash_shutdown() callback. 
  
  I'd rather you used the crash_shutdown_register() infrastructure Mikey
  added for EHEA - it's designed for just this sort of thing.
 
 Thanks for pointing this out, I wasn't aware of that call.
 New patch coming up.

In theory we can register lots of call backs but currently the maximum
is set to 1 through CRASH_HANDLER_MAX.  This is to discourage people
from using this infrastructure at all.

Unless there's some crazy arse company that's going to mix a CBE with an
eHEA, we are probably ok leaving this at 1.  Right?

Mikey
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: linux-next: powerpc build failure

2008-06-12 Thread Alan Modra
On Thu, Jun 12, 2008 at 05:05:05PM +1000, Stephen Rothwell wrote:
 /usr/bin/ld: --relax and -r may not be used together

Can't you arrange so that --relax is only used on the final link?  Of
course, if you have mashed all the input .text sections together with
ld -r, resulting in one monster .text then --relax quite likely
won't help.  ld can't break apart an input section to insert
trampolines in the middle.

-- 
Alan Modra
Australia Development Lab, IBM
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH REPOST] IB/ehca: In case of lost interrupts, trigger EOI to reenable interrupts

2008-06-12 Thread Paul Mackerras
Roland Dreier writes:

So just to be clear: this is a workaround for a hardware/firmware bug?
 
   Yes it is.
 
 OK, so paulus et al... does it seem like a good approach to call H_EOI
 from driver code (given that this driver makes tons of other hcalls)?

If this workaround is approved by the relevant hardware  firmware
folks, and demonstrably fixes the bug, then I am happy with it.

Paul.
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [Cbe-oss-dev] [PATCH] powerpc/cell: disable ptcal in case of kdump reboot

2008-06-12 Thread Michael Ellerman
On Thu, 2008-06-12 at 18:06 +1000, Michael Neuling wrote:
 In message [EMAIL PROTECTED] you wrote:
  On Wednesday 11 June 2008, Michael Ellerman wrote:
   On Wed, 2008-06-11 at 18:28 +0200, Arnd Bergmann wrote:
We used to do this correctly in case of a user triggered
kexec, but not for kdump.
   
   Used to?
  
  Sorry, wrong wording. I meant without this patch, it's correct
  for kexec.
   
This patch disables ptcal from the cell specific
machine_crash_shutdown() callback. 
   
   I'd rather you used the crash_shutdown_register() infrastructure Mikey
   added for EHEA - it's designed for just this sort of thing.
  
  Thanks for pointing this out, I wasn't aware of that call.
  New patch coming up.
 
 In theory we can register lots of call backs but currently the maximum
 is set to 1 through CRASH_HANDLER_MAX.  This is to discourage people
 from using this infrastructure at all.

Yeah true. In this case I think it's the less horrible solution to
something that's fundamentally kdump-unfriendly.

 Unless there's some crazy arse company that's going to mix a CBE with an
 eHEA, we are probably ok leaving this at 1.  Right?

No comment *cough*. I guess I'd say just increase it to 2 on the off
chance, can't hurt much.

cheers

-- 
Michael Ellerman
OzLabs, IBM Australia Development Lab

wwweb: http://michael.ellerman.id.au
phone: +61 2 6212 1183 (tie line 70 21183)

We do not inherit the earth from our ancestors,
we borrow it from our children. - S.M.A.R.T Person


signature.asc
Description: This is a digitally signed message part
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev

Merging seperate FDT-blobs?

2008-06-12 Thread Wolfram Sang
Hello,

a project I am working on consists of different hardware modules, which
can be combined in a lot of variations (not at runtime, though). As each
module shall contain an I2C-eeprom, the idea is now to put a fragment of
a FDT-blob into that EEPROM and let the bootloader combine these
fragments. Such an approach was also sketched by David Gibson recently.
(http://ozlabs.org/pipermail/linuxppc-dev/2008-February/051630.html)

(As a sidenote, I am not quite sure and could not find anything about
what the mentioned 'fdt_graft' should actually do, in my case something
like a 'fdt_add_blob_subnode' function would be sufficent, I guess.)

My question: Is there already an effort towards such an approach to
which I could contribute, or do I have to start from scratch?

Kind regards,

   Wolfram

-- 
  Dipl.-Ing. Wolfram Sang | http://www.pengutronix.de
 Pengutronix - Linux Solutions for Science and Industry


signature.asc
Description: Digital signature
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev

[patch 2/3] powerpc/pseries: call pseries_kexec_setup only on pseries

2008-06-12 Thread Arnd Bergmann
The pseries_kexec_setup function overwrites some ppc_md
pointers, so make sure it only gets called when running on
the right architecture.

Signed-off-by: Arnd Bergmann [EMAIL PROTECTED]
---
 arch/powerpc/platforms/pseries/kexec.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/powerpc/platforms/pseries/kexec.c 
b/arch/powerpc/platforms/pseries/kexec.c
index e9dd5fe..53cbd53 100644
--- a/arch/powerpc/platforms/pseries/kexec.c
+++ b/arch/powerpc/platforms/pseries/kexec.c
@@ -70,4 +70,4 @@ static int __init pseries_kexec_setup(void)
 
return 0;
 }
-__initcall(pseries_kexec_setup);
+machine_device_initcall(pseries, pseries_kexec_setup);
-- 
1.5.4.3

-- 

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[patch 0/3] disable ptcal in case of kdump reboot, v2

2008-06-12 Thread Arnd Bergmann
Ok, second try, this time using Mikey's crash_shutdown_register.

-- 

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[patch 3/3] powerpc/cell: disable ptcal in case of crash kdump

2008-06-12 Thread Arnd Bergmann
We need to disable ptcal before starting a new kernel
after a crash, in order to avoid overwriting data
in the kdump kernel.

Signed-off-by: Arnd Bergmann [EMAIL PROTECTED]
---
 arch/powerpc/platforms/cell/ras.c |   22 ++
 1 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/arch/powerpc/platforms/cell/ras.c 
b/arch/powerpc/platforms/cell/ras.c
index 655704a..505f9b9 100644
--- a/arch/powerpc/platforms/cell/ras.c
+++ b/arch/powerpc/platforms/cell/ras.c
@@ -17,6 +17,7 @@
 #include asm/reg.h
 #include asm/io.h
 #include asm/prom.h
+#include asm/kexec.h
 #include asm/machdep.h
 #include asm/rtas.h
 #include asm/cell-regs.h
@@ -226,6 +227,11 @@ static int cbe_ptcal_notify_reboot(struct notifier_block 
*nb,
return cbe_ptcal_disable();
 }
 
+static void cbe_ptcal_crash_shutdown(void)
+{
+   cbe_ptcal_disable();
+}
+
 static struct notifier_block cbe_ptcal_reboot_notifier = {
.notifier_call = cbe_ptcal_notify_reboot
 };
@@ -241,12 +247,20 @@ int __init cbe_ptcal_init(void)
return -ENODEV;
 
ret = register_reboot_notifier(cbe_ptcal_reboot_notifier);
-   if (ret) {
-   printk(KERN_ERR Can't disable PTCAL, so not enabling\n);
-   return ret;
-   }
+   if (ret)
+   goto out1;
+
+   ret = crash_shutdown_register(cbe_ptcal_crash_shutdown);
+   if (ret)
+   goto out2;
 
return cbe_ptcal_enable();
+
+out2:
+   unregister_reboot_notifier(cbe_ptcal_reboot_notifier);
+out1:
+   printk(KERN_ERR Can't disable PTCAL, so not enabling\n);
+   return ret;
 }
 
 arch_initcall(cbe_ptcal_init);
-- 
1.5.4.3

-- 

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[patch 1/3] powerpc: provide dummy crash_shutdown_register

2008-06-12 Thread Arnd Bergmann
When kexec is disabled, the crash_shutdown_{un,}register
functions are not available in the kernel.
This provides dummy inline functions for those so that
the callers don't have to worry about it.

Signed-off-by: Arnd Bergmann [EMAIL PROTECTED]
---
 include/asm-powerpc/kexec.h |   13 -
 1 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/include/asm-powerpc/kexec.h b/include/asm-powerpc/kexec.h
index 701857b..acdcdc6 100644
--- a/include/asm-powerpc/kexec.h
+++ b/include/asm-powerpc/kexec.h
@@ -34,6 +34,8 @@
 #ifndef __ASSEMBLY__
 #include linux/cpumask.h
 
+typedef void (*crash_shutdown_t)(void);
+
 #ifdef CONFIG_KEXEC
 
 #ifdef __powerpc64__
@@ -123,7 +125,6 @@ struct pt_regs;
 extern void default_machine_kexec(struct kimage *image);
 extern int default_machine_kexec_prepare(struct kimage *image);
 extern void default_machine_crash_shutdown(struct pt_regs *regs);
-typedef void (*crash_shutdown_t)(void);
 extern int crash_shutdown_register(crash_shutdown_t handler);
 extern int crash_shutdown_unregister(crash_shutdown_t handler);
 
@@ -143,6 +144,16 @@ static inline int overlaps_crashkernel(unsigned long 
start, unsigned long size)
 
 static inline void reserve_crashkernel(void) { ; }
 
+static inline int crash_shutdown_register(crash_shutdown_t handler)
+{
+   return 0;
+}
+
+static inline int crash_shutdown_unregister(crash_shutdown_t handler)
+{
+   return 0;
+}
+
 #endif /* CONFIG_KEXEC */
 #endif /* ! __ASSEMBLY__ */
 #endif /* __KERNEL__ */
-- 
1.5.4.3

-- 

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 4/3] powerpc: increase CRASH_HANDLER_MAX

2008-06-12 Thread Arnd Bergmann
There are now two potential callers of machine_crash_shutdown,
so increase the limit accordingly.

Signed-off-by: Arnd Bergmann [EMAIL PROTECTED]
---
 arch/powerpc/kernel/crash.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/powerpc/kernel/crash.c b/arch/powerpc/kernel/crash.c
index eae401d..0a8439a 100644
--- a/arch/powerpc/kernel/crash.c
+++ b/arch/powerpc/kernel/crash.c
@@ -48,7 +48,7 @@ int crashing_cpu = -1;
 static cpumask_t cpus_in_crash = CPU_MASK_NONE;
 cpumask_t cpus_in_sr = CPU_MASK_NONE;
 
-#define CRASH_HANDLER_MAX 1
+#define CRASH_HANDLER_MAX 2
 /* NULL terminated list of shutdown handles */
 static crash_shutdown_t crash_shutdown_handles[CRASH_HANDLER_MAX+1];
 static DEFINE_SPINLOCK(crash_handlers_lock);
-- 
1.5.4.3

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH REPOST] IB/ehca: In case of lost interrupts, trigger EOI to reenable interrupts

2008-06-12 Thread Paul Mackerras
Stefan Roscher writes:

 During corner case testing, we noticed that some versions of ehca 
 do not properly transition to interrupt done in special load situations.
 This can be resolved by periodically triggering EOI through H_EOI, 
 if eqes are pending.
 
 Signed-off-by: Stefan Roscher [EMAIL PROTECTED]

If this is OKed by the hypervisor team, then you can add:
Acked-by: Paul Mackerras [EMAIL PROTECTED]

Paul.
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH 2/2] Re-added support for FEC on MPC5121 from Freescale LTIB to current head

2008-06-12 Thread Kumar Gala


On Jun 12, 2008, at 6:45 AM, David Jander wrote:

Your commit message isn't exactly helpful as most people dont know  
what LTIB is and its not terribly relevant.  It just seems like you  
are adding support for the FEC on MPC5121 and this point.




Signed-off-by: David Jander [EMAIL PROTECTED]
---
arch/powerpc/platforms/Kconfig |2 +-
drivers/net/fec.h  |   43 
drivers/net/fs_enet/Kconfig|   22 +-
drivers/net/fs_enet/fs_enet-main.c |   76 +++ 
+++--

drivers/net/fs_enet/fs_enet.h  |   17 +---
drivers/net/fs_enet/mac-fec.c  |   22 +-
drivers/net/fs_enet/mii-fec.c  |   10 -
7 files changed, 167 insertions(+), 25 deletions(-)

diff --git a/arch/powerpc/platforms/Kconfig b/arch/powerpc/platforms/ 
Kconfig

index 87454c5..a96937f 100644
--- a/arch/powerpc/platforms/Kconfig
+++ b/arch/powerpc/platforms/Kconfig
@@ -288,7 +288,7 @@ config CPM2

config PPC_CPM_NEW_BINDING
bool
-   depends on CPM1 || CPM2
+   depends on CPM1 || CPM2 || FS_ENET_MPC5121_FEC
default y

config AXON_RAM
diff --git a/drivers/net/fec.h b/drivers/net/fec.h
index 292719d..5c9fe34 100644
--- a/drivers/net/fec.h
+++ b/drivers/net/fec.h
@@ -59,6 +59,7 @@ typedef struct fec {
} fec_t;

#else
+#if !defined(CONFIG_FS_ENET_MPC5121_FEC)

/*
 *  Define device register set address map.
@@ -97,6 +98,48 @@ typedef struct fec {
unsigned long   fec_fifo_ram[112];  /* FIFO RAM buffer */
} fec_t;

+#else /* CONFIG_FS_ENET_MPC5121_FEC */
+
+typedef struct fec {
+   u32 fec_reserved0;
+   u32 fec_ievent; /* Interrupt event reg */
+   u32 fec_imask;  /* Interrupt mask reg */
+   u32 fec_reserved1;
+   u32 fec_r_des_active;   /* Receive descriptor reg */
+   u32 fec_x_des_active;   /* Transmit descriptor reg */
+   u32 fec_reserved2[3];
+   u32 fec_ecntrl; /* Ethernet control reg */
+   u32 fec_reserved3[6];
+   u32 fec_mii_data;   /* MII manage frame reg */
+   u32 fec_mii_speed;  /* MII speed control reg */
+   u32 fec_reserved4[7];
+   u32 fec_mib_ctrlstat;   /* MIB control/status reg */
+   u32 fec_reserved5[7];
+   u32 fec_r_cntrl;/* Receive control reg */
+   u32 fec_reserved6[15];
+   u32 fec_x_cntrl;/* Transmit Control reg */
+   u32 fec_reserved7[7];
+   u32 fec_addr_low;   /* Low 32bits MAC address */
+   u32 fec_addr_high;  /* High 16bits MAC address */
+   u32 fec_opd;/* Opcode + Pause duration */
+   u32 fec_reserved8[10];
+   u32 fec_hash_table_high;/* High 32bits hash table */
+   u32 fec_hash_table_low; /* Low 32bits hash table */
+   u32 fec_grp_hash_table_high;/* High 32bits hash table */
+   u32 fec_grp_hash_table_low; /* Low 32bits hash table */
+   u32 fec_reserved9[7];
+   u32 fec_x_wmrk; /* FIFO transmit water mark */
+   u32 fec_reserved10;
+   u32 fec_r_bound;/* FIFO receive bound reg */
+   u32 fec_r_fstart;   /* FIFO receive start reg */
+   u32 fec_reserved11[11];
+   u32 fec_r_des_start;/* Receive descriptor ring */
+   u32 fec_x_des_start;/* Transmit descriptor ring */
+   u32 fec_r_buff_size;/* Maximum receive buff size */
+   u32 fec_dma_control;/* DMA Endian and other ctrl */
+} fec_t;
+
+#endif /* CONFIG_FS_ENET_MPC5121_FEC */
#endif /* CONFIG_M5272 */


I'm not exactly clear as to why this was done this way but this not  
acceptable as it means we can't build a multiplatform kernel that  
needs this driver.


I'm also not clear to me if the MPC5121 FEC is really the same device  
or close to it that it should be sharing this driver or have its own.


- k
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: MMIO and gcc re-ordering issue

2008-06-12 Thread Paul Mackerras
Nick Piggin writes:

 /* turn off LED */
 val64 = readq(bar0-adapter_control);
 val64 = val64 (~ADAPTER_LED_ON);
 writeq(val64, bar0-adapter_control);
 s2io_link(nic, LINK_DOWN);
 }
 clear_bit(__S2IO_STATE_LINK_TASK, (nic-state));
 
 Now I can't say definitively that this is going to be wrong on
 powerpc, because I don't know the code well enough. But I'd be
 90% sure that the unlock is not supposed to be visible to
 other CPUs before the writeqs are queued to the card. On x86 it
 wouldn't be.

Interestingly, there is also a store to cacheable memory
(nic-device_enabled_once), but no smp_wmb or equivalent before the
clear_bit.  So there are other potential problems here besides the I/O
related ones.

Anyway, I have done some tests on a dual G5 here with putting a sync
on both sides of the store in writel etc. (i.e. making readl/writel
strongly ordered w.r.t. everything else), and as you predicted, there
wasn't a noticeable performance degradation, at least not on the
couple of things I tried.  So I am now inclined to accept your
suggestion that we should do that.  I should probably do some similar
checks on POWER6 and a few other machines first, though.

Paul.
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 1/2] Added support for PRTLVT based boards (MPC5121)

2008-06-12 Thread David Jander
 Made MPC5121_ADS board support generic:
 Renamed arch/powerpc/platforms/512x/mpc5121_ads.c and added list of supported
 boards.
 For both MPC5121 ADS or PRTLVT support, just select MPC5121_GENERIC and use
 the corresponding device-tree.

Signed-off-by: David Jander [EMAIL PROTECTED]
---
 arch/powerpc/boot/dts/prtlvt.dts   |  272 
 arch/powerpc/platforms/512x/Kconfig|   14 +-
 arch/powerpc/platforms/512x/Makefile   |2 +-
 .../512x/{mpc5121_ads.c = mpc5121_generic.c}  |   38 ++-
 4 files changed, 307 insertions(+), 19 deletions(-)
 create mode 100644 arch/powerpc/boot/dts/prtlvt.dts
 rename arch/powerpc/platforms/512x/{mpc5121_ads.c = mpc5121_generic.c} (73%)

diff --git a/arch/powerpc/boot/dts/prtlvt.dts b/arch/powerpc/boot/dts/prtlvt.dts
new file mode 100644
index 000..a011c8c
--- /dev/null
+++ b/arch/powerpc/boot/dts/prtlvt.dts
@@ -0,0 +1,272 @@
+/*
+ * Device tree source for PRTLVT based boards, base on:
+ * MPC5121E MDS Device Tree Source
+ *
+ * Copyright 2007 Freescale Semiconductor Inc.
+ * Copyright 2008 Protonic Holland
+ *
+ * This program is free software; you can redistribute  it and/or modify it
+ * under  the terms of  the GNU General  Public License as published by the
+ * Free Software Foundation;  either version 2 of the  License, or (at your
+ * option) any later version.
+ */
+
+ /* compile with: ./dtc -p 10240 -R 20 -I dts -o prtlvt.dtb -O dtb -b 0 
dts/prtlvt.dts */
+
+/dts-v1/;
+
+/ {
+   model = prtlvt;
+   compatible = prt,prtlvt;
+   #address-cells = 1;
+   #size-cells = 1;
+
+   cpus {
+   #address-cells = 1;
+   #size-cells = 0;
+
+   PowerPC,[EMAIL PROTECTED] {
+   device_type = cpu;
+   reg = 0;
+   d-cache-line-size = 0x20; // 32 bytes
+   i-cache-line-size = 0x20; // 32 bytes
+   d-cache-size = 0x8000;// L1, 32K
+   i-cache-size = 0x8000;// L1, 32K
+   timebase-frequency = 5000;// 50 MHz (csb/4)
+   bus-frequency = 2;// 200 MHz csb bus
+   clock-frequency = 4;  // 400 MHz ppc core
+   };
+   };
+
+   memory {
+   device_type = memory;
+   reg = 0x 0x1000;  // 256MB at 0
+   };
+
+   [EMAIL PROTECTED] {
+   compatible = amd,s29gl256n, cfi-flash;
+   reg = 0xfe00 0x0200;
+   bank-width = 2;
+   #address-cells = 1;
+   #size-cells = 1;
+   [EMAIL PROTECTED] {
+   label = rootfs;
+   reg = 0x 0x0180;
+   };
+   [EMAIL PROTECTED] {
+   label =config0;
+   reg = 0x0180 0x0020;
+   };
+   [EMAIL PROTECTED] {
+   label =config1;
+   reg = 0x01a0 0x0020;
+   };
+   [EMAIL PROTECTED] {
+   label =kernel;
+   reg = 0x01c0 0x002e;
+   };
+   [EMAIL PROTECTED] {
+   label =devicetree;
+   reg = 0x01ee 0x0002;
+   };
+   [EMAIL PROTECTED] {
+   label =uboot;
+   reg = 0x01f0 0x0010;
+   };
+   };
+   
+   [EMAIL PROTECTED] {
+   compatible = fsl,mpc5121-immr, simple-bus;
+   #address-cells = 1;
+   #size-cells = 1;
+   #interrupt-cells = 2;
+   ranges = 0x0 0x8000 0x40;
+   reg = 0x8000 0x40;
+   bus-frequency = 6600; // 66 MHz ips bus
+
+
+   // IPIC
+   // interrupts cell = intr #, sense
+   // sense values match linux IORESOURCE_IRQ_* defines:
+   // sense == 8: Level, low assertion
+   // sense == 2: Edge, high-to-low change
+   //
+   ipic: [EMAIL PROTECTED] {
+   compatible = fsl,mpc5121-ipic, fsl,ipic;
+   interrupt-controller;
+   #address-cells = 0;
+   #interrupt-cells = 2;
+   reg = 0xc00 0x100;
+   };
+
+   // 512x PSCs are not 52xx PSCs compatible
+   // PSC0 serial port aka ttyPSC0
+   [EMAIL PROTECTED] {
+   device_type = serial;
+   compatible = fsl,mpc5121-psc-uart;
+   port-number = 0;
+   cell-index = 0;
+   reg = 0x11000 0x100;
+   interrupts = 0x28 0x8; // actually the fifo irq
+ 

[PATCH 2/2] Re-added support for FEC on MPC5121 from Freescale LTIB to current head

2008-06-12 Thread David Jander

Signed-off-by: David Jander [EMAIL PROTECTED]
---
 arch/powerpc/platforms/Kconfig |2 +-
 drivers/net/fec.h  |   43 
 drivers/net/fs_enet/Kconfig|   22 +-
 drivers/net/fs_enet/fs_enet-main.c |   76 ++--
 drivers/net/fs_enet/fs_enet.h  |   17 +---
 drivers/net/fs_enet/mac-fec.c  |   22 +-
 drivers/net/fs_enet/mii-fec.c  |   10 -
 7 files changed, 167 insertions(+), 25 deletions(-)

diff --git a/arch/powerpc/platforms/Kconfig b/arch/powerpc/platforms/Kconfig
index 87454c5..a96937f 100644
--- a/arch/powerpc/platforms/Kconfig
+++ b/arch/powerpc/platforms/Kconfig
@@ -288,7 +288,7 @@ config CPM2
 
 config PPC_CPM_NEW_BINDING
bool
-   depends on CPM1 || CPM2
+   depends on CPM1 || CPM2 || FS_ENET_MPC5121_FEC
default y
 
 config AXON_RAM
diff --git a/drivers/net/fec.h b/drivers/net/fec.h
index 292719d..5c9fe34 100644
--- a/drivers/net/fec.h
+++ b/drivers/net/fec.h
@@ -59,6 +59,7 @@ typedef struct fec {
 } fec_t;
 
 #else
+#if !defined(CONFIG_FS_ENET_MPC5121_FEC)
 
 /*
  * Define device register set address map.
@@ -97,6 +98,48 @@ typedef struct fec {
unsigned long   fec_fifo_ram[112];  /* FIFO RAM buffer */
 } fec_t;
 
+#else /* CONFIG_FS_ENET_MPC5121_FEC */
+
+typedef struct fec {
+   u32 fec_reserved0;
+   u32 fec_ievent; /* Interrupt event reg */
+   u32 fec_imask;  /* Interrupt mask reg */
+   u32 fec_reserved1;
+   u32 fec_r_des_active;   /* Receive descriptor reg */
+   u32 fec_x_des_active;   /* Transmit descriptor reg */
+   u32 fec_reserved2[3];
+   u32 fec_ecntrl; /* Ethernet control reg */
+   u32 fec_reserved3[6];
+   u32 fec_mii_data;   /* MII manage frame reg */
+   u32 fec_mii_speed;  /* MII speed control reg */
+   u32 fec_reserved4[7];
+   u32 fec_mib_ctrlstat;   /* MIB control/status reg */
+   u32 fec_reserved5[7];
+   u32 fec_r_cntrl;/* Receive control reg */
+   u32 fec_reserved6[15];
+   u32 fec_x_cntrl;/* Transmit Control reg */
+   u32 fec_reserved7[7];
+   u32 fec_addr_low;   /* Low 32bits MAC address */
+   u32 fec_addr_high;  /* High 16bits MAC address */
+   u32 fec_opd;/* Opcode + Pause duration */
+   u32 fec_reserved8[10];
+   u32 fec_hash_table_high;/* High 32bits hash table */
+   u32 fec_hash_table_low; /* Low 32bits hash table */
+   u32 fec_grp_hash_table_high;/* High 32bits hash table */
+   u32 fec_grp_hash_table_low; /* Low 32bits hash table */
+   u32 fec_reserved9[7];
+   u32 fec_x_wmrk; /* FIFO transmit water mark */
+   u32 fec_reserved10;
+   u32 fec_r_bound;/* FIFO receive bound reg */
+   u32 fec_r_fstart;   /* FIFO receive start reg */
+   u32 fec_reserved11[11];
+   u32 fec_r_des_start;/* Receive descriptor ring */
+   u32 fec_x_des_start;/* Transmit descriptor ring */
+   u32 fec_r_buff_size;/* Maximum receive buff size */
+   u32 fec_dma_control;/* DMA Endian and other ctrl */
+} fec_t;
+
+#endif /* CONFIG_FS_ENET_MPC5121_FEC */
 #endif /* CONFIG_M5272 */
 
 
diff --git a/drivers/net/fs_enet/Kconfig b/drivers/net/fs_enet/Kconfig
index 562ea68..5e2520b 100644
--- a/drivers/net/fs_enet/Kconfig
+++ b/drivers/net/fs_enet/Kconfig
@@ -1,9 +1,23 @@
 config FS_ENET
tristate Freescale Ethernet Driver
-   depends on CPM1 || CPM2
+   depends on CPM1 || CPM2 || FS_ENET_MPC5121_FEC
select MII
select PHYLIB
 
+config FS_ENET_MPC5121_FEC
+   bool Freescale MPC512x FEC driver
+   depends on PPC_MPC512x
+   select FS_ENET
+   select FS_ENET_HAS_FEC
+
+config FS_ENET_TX_ALIGN_WORKAROUND
+   bool MPC5121 FEC driver TX alignment workaround
+   depends on FS_ENET_MPC5121_FEC
+   help
+ Workaround for a problem with early Freescale MPC5121 chips.
+ If unsure say 'y'
+   default y
+
 config FS_ENET_HAS_SCC
bool Chip has an SCC usable for ethernet
depends on FS_ENET  (CPM1 || CPM2)
@@ -16,13 +30,15 @@ config FS_ENET_HAS_FCC
 
 config FS_ENET_HAS_FEC
bool Chip has an FEC usable for ethernet
-   depends on FS_ENET  CPM1
+   depends on FS_ENET  (CPM1 || FS_ENET_MPC5121_FEC)
select FS_ENET_MDIO_FEC
default y
 
+
 config FS_ENET_MDIO_FEC
tristate MDIO driver for FEC
-   depends on FS_ENET  CPM1
+   depends on FS_ENET  (CPM1 || FS_ENET_MPC5121_FEC)
+
 
 config FS_ENET_MDIO_FCC
tristate MDIO driver for FCC
diff --git a/drivers/net/fs_enet/fs_enet-main.c 
b/drivers/net/fs_enet/fs_enet-main.c
index 31c9693..54f0079 100644
--- a/drivers/net/fs_enet/fs_enet-main.c
+++ b/drivers/net/fs_enet/fs_enet-main.c
@@ -592,6 +592,31 @@ void fs_cleanup_bds(struct net_device *dev)
 
 

Re: [PATCH 1/5] powerpc: remove mpc8xx-ide driver

2008-06-12 Thread Kumar Gala


On Jun 10, 2008, at 2:01 PM, Bartlomiej Zolnierkiewicz wrote:



Hi,

On Tuesday 10 June 2008, [EMAIL PROTECTED] wrote:

This driver was only used by arch/ppc code and is obsolete
now with the move to common arch/powerpc code.

Cc: [EMAIL PROTECTED]
Cc: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
Signed-off-by: Arnd Bergmann [EMAIL PROTECTED]
---
drivers/ide/Kconfig  |   10 -
drivers/ide/ppc/Makefile |1 -
drivers/ide/ppc/mpc8xx.c |  847  
--

3 files changed, 0 insertions(+), 858 deletions(-)
delete mode 100644 drivers/ide/ppc/mpc8xx.c


Thanks, applied.

[ there is a couple of patches in IDE tree touching this driver so I  
needed
 to refresh the patch - IOW it now removes the freshest mpc8xx.c  
version ]


Paul/Kumar: I hope you are fine with this.


Acked-by: Kumar Gala [EMAIL PROTECTED]

- k

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: MMIO and gcc re-ordering issue

2008-06-12 Thread Nick Piggin
On Thursday 12 June 2008 22:14, Paul Mackerras wrote:
 Nick Piggin writes:
  /* turn off LED */
  val64 = readq(bar0-adapter_control);
  val64 = val64 (~ADAPTER_LED_ON);
  writeq(val64, bar0-adapter_control);
  s2io_link(nic, LINK_DOWN);
  }
  clear_bit(__S2IO_STATE_LINK_TASK, (nic-state));
 
  Now I can't say definitively that this is going to be wrong on
  powerpc, because I don't know the code well enough. But I'd be
  90% sure that the unlock is not supposed to be visible to
  other CPUs before the writeqs are queued to the card. On x86 it
  wouldn't be.

 Interestingly, there is also a store to cacheable memory
 (nic-device_enabled_once), but no smp_wmb or equivalent before the
 clear_bit.  So there are other potential problems here besides the I/O
 related ones.

Yeah there sure is. That sucks too, but we go one step at a time ;)
I think proposing a strong ordering between set_bit/clear_bit would
actually be quite noticable slowdown in core kernel code at this
point.

Which reminds me, I have been meaning to do another pass of test and
set bit / clear bit conversions to the _lock primitives...


 Anyway, I have done some tests on a dual G5 here with putting a sync
 on both sides of the store in writel etc. (i.e. making readl/writel
 strongly ordered w.r.t. everything else), and as you predicted, there
 wasn't a noticeable performance degradation, at least not on the
 couple of things I tried.  So I am now inclined to accept your
 suggestion that we should do that.  I should probably do some similar
 checks on POWER6 and a few other machines first, though.

Oh good, thanks for looking into it. I guess it might be a little more
noticable on bigger POWER systems. And I think we might even need to do
a PCI read after every writel on sn2 systems in order to get the
semantics I want.

I can't say it won't be noticable. But if we consider the number of
drivers (maybe one or two dozen well maintained ones), and number of
sites in each driver (maybe one or two submission and completion
fastpaths which should have a minimum of IO operations in each one)
that will have to be converted in order to get performance as good or
better than it is currently with relaxed accessors and weigh that
against all the places in those and every other crappy obscure
driver that we *won't* have to audit, I really think we end up with
a net win even with some short term pain.
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[GIT PULL] one kbuild fix for powerpc

2008-06-12 Thread Sam Ravnborg
Hi Linus.

Following fix has been late as I have been sloppy to look into this.
Kumar has patiently reminded me and tested the follwing fix.

I could have made the patch a few lines smaller - but decided to add
a helper function and moved the obvious candidates to the helper function.

Please pull from:

ssh://master.kernel.org/pub/scm/linux/kernel/git/sam/kbuild-fixes.git


Sam 


 scripts/mod/modpost.c |   26 +-
 1 files changed, 21 insertions(+), 5 deletions(-)


commit 82e93ceaa5b55a8eb2b9b5454b2904b60781c763
Author: Sam Ravnborg [EMAIL PROTECTED]
Date:   Thu Jun 12 15:02:55 2008 +0200

kbuild: ignore powerpc specific symbols in modpost

Kumar Gala [EMAIL PROTECTED] wrote:
We have a case in powerpc in which we want to link some library
routines with all module objects.  The routines are intended for
handling out-of-line function call register save/restore so having
them as EXPORT_SYMBOL() is counter productive (we do also need to
link the same library code into the kernel).

Without this patch a powerpc build would error out and fail
to build modules with the added register save/restore module.

There were two obvious solutions:
1) To link the .o file before the modpost stage
2) To ignore the symbols in modpost

Option 1) was ruled out because we do not have any separate
linking stage for single file modules.

This patch implements option 2 - and do so only for powerpc.

The symbols we ignore are all undefined symbols named:
_restgpr_*, _savegpr_*, _rest32gpr_*, _save32gpr_*

Signed-off-by: Sam Ravnborg [EMAIL PROTECTED]
Cc: Kumar Gala [EMAIL PROTECTED]
Cc: Paul Mackerras [EMAIL PROTECTED]

diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 508c589..b763aba 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -467,6 +467,26 @@ static void parse_elf_finish(struct elf_info *info)
release_file(info-hdr, info-size);
 }
 
+static int ignore_undef_symbol(struct elf_info *info, const char *symname)
+{
+   /* ignore __this_module, it will be resolved shortly */
+   if (strcmp(symname, MODULE_SYMBOL_PREFIX __this_module) == 0)
+   return 1;
+   /* ignore global offset table */
+   if (strcmp(symname, _GLOBAL_OFFSET_TABLE_) == 0)
+   return 1;
+   if (info-hdr-e_machine == EM_PPC)
+   /* Special register function linked on all modules during final 
link of .ko */
+   if (strncmp(symname, _restgpr_, sizeof(_restgpr_) - 1) == 0 
||
+   strncmp(symname, _savegpr_, sizeof(_savegpr_) - 1) == 0 
||
+   strncmp(symname, _rest32gpr_, sizeof(_rest32gpr_) - 1) 
== 0 ||
+   strncmp(symname, _save32gpr_, sizeof(_save32gpr_) - 1) 
== 0) {
+   return 1;
+   }
+   /* Do not ignore this symbol */
+   return 0;
+}
+
 #define CRC_PFX MODULE_SYMBOL_PREFIX __crc_
 #define KSYMTAB_PFX MODULE_SYMBOL_PREFIX __ksymtab_
 
@@ -493,11 +513,7 @@ static void handle_modversions(struct module *mod, struct 
elf_info *info,
if (ELF_ST_BIND(sym-st_info) != STB_GLOBAL 
ELF_ST_BIND(sym-st_info) != STB_WEAK)
break;
-   /* ignore global offset table */
-   if (strcmp(symname, _GLOBAL_OFFSET_TABLE_) == 0)
-   break;
-   /* ignore __this_module, it will be resolved shortly */
-   if (strcmp(symname, MODULE_SYMBOL_PREFIX __this_module) == 0)
+   if (ignore_undef_symbol(info, symname))
break;
 /* cope with newer glibc (2.3.4 or higher) STT_ definition in elf.h */
 #if defined(STT_REGISTER) || defined(STT_SPARC_REGISTER)
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH 2/2] Re-added support for FEC on MPC5121 from Freescale LTIB to current head

2008-06-12 Thread Grant Likely
On Thu, Jun 12, 2008 at 6:12 AM, Kumar Gala [EMAIL PROTECTED] wrote:

 On Jun 12, 2008, at 6:45 AM, David Jander wrote:

 Your commit message isn't exactly helpful as most people dont know what LTIB
 is and its not terribly relevant.  It just seems like you are adding support
 for the FEC on MPC5121 and this point.

Agreed.  Also, you need to CC: the netdev mailing list for network drivers.

 Signed-off-by: David Jander [EMAIL PROTECTED]
 ---
 arch/powerpc/platforms/Kconfig |2 +-
 drivers/net/fec.h  |   43 
 drivers/net/fs_enet/Kconfig|   22 +-
 drivers/net/fs_enet/fs_enet-main.c |   76
 ++--
 drivers/net/fs_enet/fs_enet.h  |   17 +---
 drivers/net/fs_enet/mac-fec.c  |   22 +-
 drivers/net/fs_enet/mii-fec.c  |   10 -
 7 files changed, 167 insertions(+), 25 deletions(-)

 diff --git a/arch/powerpc/platforms/Kconfig
 b/arch/powerpc/platforms/Kconfig
 index 87454c5..a96937f 100644
 --- a/arch/powerpc/platforms/Kconfig
 +++ b/arch/powerpc/platforms/Kconfig
 @@ -288,7 +288,7 @@ config CPM2

 config PPC_CPM_NEW_BINDING
bool
 -   depends on CPM1 || CPM2
 +   depends on CPM1 || CPM2 || FS_ENET_MPC5121_FEC
default y

 config AXON_RAM
 diff --git a/drivers/net/fec.h b/drivers/net/fec.h
 index 292719d..5c9fe34 100644
 --- a/drivers/net/fec.h
 +++ b/drivers/net/fec.h
 @@ -59,6 +59,7 @@ typedef struct fec {
 } fec_t;

 #else
 +#if !defined(CONFIG_FS_ENET_MPC5121_FEC)

 /*
  *  Define device register set address map.
 @@ -97,6 +98,48 @@ typedef struct fec {
unsigned long   fec_fifo_ram[112];  /* FIFO RAM buffer */
 } fec_t;

 +#else /* CONFIG_FS_ENET_MPC5121_FEC */
 +
 +typedef struct fec {
 +   u32 fec_reserved0;
 +   u32 fec_ievent; /* Interrupt event reg */
 +   u32 fec_imask;  /* Interrupt mask reg */
 +   u32 fec_reserved1;
 +   u32 fec_r_des_active;   /* Receive descriptor reg */
 +   u32 fec_x_des_active;   /* Transmit descriptor reg */
 +   u32 fec_reserved2[3];
 +   u32 fec_ecntrl; /* Ethernet control reg */
 +   u32 fec_reserved3[6];
 +   u32 fec_mii_data;   /* MII manage frame reg */
 +   u32 fec_mii_speed;  /* MII speed control reg */
 +   u32 fec_reserved4[7];
 +   u32 fec_mib_ctrlstat;   /* MIB control/status reg */
 +   u32 fec_reserved5[7];
 +   u32 fec_r_cntrl;/* Receive control reg */
 +   u32 fec_reserved6[15];
 +   u32 fec_x_cntrl;/* Transmit Control reg */
 +   u32 fec_reserved7[7];
 +   u32 fec_addr_low;   /* Low 32bits MAC address */
 +   u32 fec_addr_high;  /* High 16bits MAC address */
 +   u32 fec_opd;/* Opcode + Pause duration */
 +   u32 fec_reserved8[10];
 +   u32 fec_hash_table_high;/* High 32bits hash table */
 +   u32 fec_hash_table_low; /* Low 32bits hash table */
 +   u32 fec_grp_hash_table_high;/* High 32bits hash table */
 +   u32 fec_grp_hash_table_low; /* Low 32bits hash table */
 +   u32 fec_reserved9[7];
 +   u32 fec_x_wmrk; /* FIFO transmit water mark */
 +   u32 fec_reserved10;
 +   u32 fec_r_bound;/* FIFO receive bound reg */
 +   u32 fec_r_fstart;   /* FIFO receive start reg */
 +   u32 fec_reserved11[11];
 +   u32 fec_r_des_start;/* Receive descriptor ring */
 +   u32 fec_x_des_start;/* Transmit descriptor ring */
 +   u32 fec_r_buff_size;/* Maximum receive buff size */
 +   u32 fec_dma_control;/* DMA Endian and other ctrl */
 +} fec_t;
 +
 +#endif /* CONFIG_FS_ENET_MPC5121_FEC */
 #endif /* CONFIG_M5272 */

 I'm not exactly clear as to why this was done this way but this not
 acceptable as it means we can't build a multiplatform kernel that needs this
 driver.

 I'm also not clear to me if the MPC5121 FEC is really the same device or
 close to it that it should be sharing this driver or have its own.

Indeed.  If it is not easy to isolate the differences for runtime
binding then it may be best to just clone the driver as a starting
point and make the 5121 specific changes.

Cheers,
g.

-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 0/5] Kill CONFIG_PPC_CPM_NEW_BINDING

2008-06-12 Thread Kumar Gala
With arch/ppc gone we can get rid of CONFIG_PPC_CPM_NEW_BINDING.  These
should be pretty trivial.

These will go via my powerpc-next tree if no one has issues.

- k
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 1/5] cpm_uart: fix whitespace issues

2008-06-12 Thread Kumar Gala
Signed-off-by: Kumar Gala [EMAIL PROTECTED]
---
 drivers/serial/cpm_uart/cpm_uart.h  |8 
 drivers/serial/cpm_uart/cpm_uart_core.c |4 ++--
 drivers/serial/cpm_uart/cpm_uart_cpm1.c |2 +-
 drivers/serial/cpm_uart/cpm_uart_cpm1.h |2 +-
 drivers/serial/cpm_uart/cpm_uart_cpm2.c |6 +++---
 drivers/serial/cpm_uart/cpm_uart_cpm2.h |2 +-
 6 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/serial/cpm_uart/cpm_uart.h 
b/drivers/serial/cpm_uart/cpm_uart.h
index 0cc39f8..3d07bec 100644
--- a/drivers/serial/cpm_uart/cpm_uart.h
+++ b/drivers/serial/cpm_uart/cpm_uart.h
@@ -6,7 +6,7 @@
  *  Copyright (C) 2004 Freescale Semiconductor, Inc.
  *
  *  2006 (c) MontaVista Software, Inc.
- * Vitaly Bordug [EMAIL PROTECTED]
+ * Vitaly Bordug [EMAIL PROTECTED]
  *
  * This file is licensed under the terms of the GNU General Public License
  * version 2. This program is licensed as is without any warranty of any
@@ -28,7 +28,7 @@
 #define SERIAL_CPM_MAJOR   204
 #define SERIAL_CPM_MINOR   46
 
-#define IS_SMC(pinfo)  (pinfo-flags  FLAG_SMC)
+#define IS_SMC(pinfo)  (pinfo-flags  FLAG_SMC)
 #define IS_DISCARDING(pinfo)   (pinfo-flags  FLAG_DISCARDING)
 #define FLAG_DISCARDING0x0004  /* when set, don't discard */
 #define FLAG_SMC   0x0002
@@ -70,7 +70,7 @@ struct uart_cpm_port {
void(*set_lineif)(struct uart_cpm_port *);
u8  brg;
uint dp_addr;
-   void*mem_addr;
+   void*mem_addr;
dma_addr_t   dma_addr;
u32 mem_size;
/* helpers */
@@ -79,7 +79,7 @@ struct uart_cpm_port {
/* Keep track of 'odd' SMC2 wirings */
int is_portb;
/* wait on close if needed */
-   int wait_closing;
+   int wait_closing;
/* value to combine with opcode to form cpm command */
u32 command;
 };
diff --git a/drivers/serial/cpm_uart/cpm_uart_core.c 
b/drivers/serial/cpm_uart/cpm_uart_core.c
index a19dc7e..b0104ca 100644
--- a/drivers/serial/cpm_uart/cpm_uart_core.c
+++ b/drivers/serial/cpm_uart/cpm_uart_core.c
@@ -13,7 +13,7 @@
  *  Copyright (C) 2004, 2007 Freescale Semiconductor, Inc.
  *(C) 2004 Intracom, S.A.
  *(C) 2005-2006 MontaVista Software, Inc.
- * Vitaly Bordug [EMAIL PROTECTED]
+ * Vitaly Bordug [EMAIL PROTECTED]
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -1305,7 +1305,7 @@ static int __init cpm_uart_console_setup(struct console 
*co, char *options)
pdata = pdev-dev.platform_data;
if (pdata)
if (pdata-init_ioports)
-   pdata-init_ioports(pdata);
+   pdata-init_ioports(pdata);
 
cpm_uart_drv_get_platform_data(pdev, 1);
}
diff --git a/drivers/serial/cpm_uart/cpm_uart_cpm1.c 
b/drivers/serial/cpm_uart/cpm_uart_cpm1.c
index 74f1432..bec0c97 100644
--- a/drivers/serial/cpm_uart/cpm_uart_cpm1.c
+++ b/drivers/serial/cpm_uart/cpm_uart_cpm1.c
@@ -9,7 +9,7 @@
  *  Copyright (C) 2004 Freescale Semiconductor, Inc.
  *(C) 2004 Intracom, S.A.
  *(C) 2006 MontaVista Software, Inc.
- * Vitaly Bordug [EMAIL PROTECTED]
+ * Vitaly Bordug [EMAIL PROTECTED]
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
diff --git a/drivers/serial/cpm_uart/cpm_uart_cpm1.h 
b/drivers/serial/cpm_uart/cpm_uart_cpm1.h
index ddf46d3..b805698 100644
--- a/drivers/serial/cpm_uart/cpm_uart_cpm1.h
+++ b/drivers/serial/cpm_uart/cpm_uart_cpm1.h
@@ -2,7 +2,7 @@
  * linux/drivers/serial/cpm_uart/cpm_uart_cpm1.h
  *
  * Driver for CPM (SCC/SMC) serial ports
- * 
+ *
  * definitions for cpm1
  *
  */
diff --git a/drivers/serial/cpm_uart/cpm_uart_cpm2.c 
b/drivers/serial/cpm_uart/cpm_uart_cpm2.c
index bb862e2..e53524c 100644
--- a/drivers/serial/cpm_uart/cpm_uart_cpm2.c
+++ b/drivers/serial/cpm_uart/cpm_uart_cpm2.c
@@ -5,11 +5,11 @@
  *
  *  Maintainer: Kumar Gala ([EMAIL PROTECTED]) (CPM2)
  *  Pantelis Antoniou ([EMAIL PROTECTED]) (CPM1)
- * 
+ *
  *  Copyright (C) 2004 Freescale Semiconductor, Inc.
  *(C) 2004 Intracom, S.A.
  *(C) 2006 MontaVista Software, Inc.
- * Vitaly Bordug [EMAIL PROTECTED]
+ * Vitaly Bordug [EMAIL PROTECTED]
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -273,7 +273,7 @@ void scc4_lineif(struct uart_cpm_port *pinfo)
 #endif
 
 /*
- * Allocate DP-Ram and 

[PATCH 3/5] powerpc/cpm: Remove !CONFIG_PPC_CPM_NEW_BINDING code

2008-06-12 Thread Kumar Gala
Now that arch/ppc is gone we always define CONFIG_PPC_CPM_NEW_BINDING so
we can remove all the code associated with !CONFIG_PPC_CPM_NEW_BINDING.

Signed-off-by: Kumar Gala [EMAIL PROTECTED]
---
 include/asm-powerpc/cpm1.h |   20 
 include/asm-powerpc/cpm2.h |   26 --
 2 files changed, 0 insertions(+), 46 deletions(-)

diff --git a/include/asm-powerpc/cpm1.h b/include/asm-powerpc/cpm1.h
index 3df4396..2ff7987 100644
--- a/include/asm-powerpc/cpm1.h
+++ b/include/asm-powerpc/cpm1.h
@@ -42,35 +42,15 @@
 
 #define mk_cr_cmd(CH, CMD) ((CMD  8) | (CH  4))
 
-#ifndef CONFIG_PPC_CPM_NEW_BINDING
-/* The dual ported RAM is multi-functional.  Some areas can be (and are
- * being) used for microcode.  There is an area that can only be used
- * as data ram for buffer descriptors, which is all we use right now.
- * Currently the first 512 and last 256 bytes are used for microcode.
- */
-#define CPM_DATAONLY_BASE  ((uint)0x0800)
-#define CPM_DATAONLY_SIZE  ((uint)0x0700)
-#define CPM_DP_NOSPACE ((uint)0x7fff)
-#endif
-
 /* Export the base address of the communication processor registers
  * and dual port ram.
  */
 extern cpm8xx_t __iomem *cpmp; /* Pointer to comm processor */
 
-#ifdef CONFIG_PPC_CPM_NEW_BINDING
 #define cpm_dpalloc cpm_muram_alloc
 #define cpm_dpfree cpm_muram_free
 #define cpm_dpram_addr cpm_muram_addr
 #define cpm_dpram_phys cpm_muram_dma
-#else
-extern unsigned long cpm_dpalloc(uint size, uint align);
-extern int cpm_dpfree(unsigned long offset);
-extern unsigned long cpm_dpalloc_fixed(unsigned long offset, uint size, uint 
align);
-extern void cpm_dpdump(void);
-extern void *cpm_dpram_addr(unsigned long offset);
-extern uint cpm_dpram_phys(u8 *addr);
-#endif
 
 extern void cpm_setbrg(uint brg, uint rate);
 
diff --git a/include/asm-powerpc/cpm2.h b/include/asm-powerpc/cpm2.h
index 4c85ed9..2c7fd9c 100644
--- a/include/asm-powerpc/cpm2.h
+++ b/include/asm-powerpc/cpm2.h
@@ -78,24 +78,6 @@
 #define mk_cr_cmd(PG, SBC, MCN, OP) \
((PG  26) | (SBC  21) | (MCN  6) | OP)
 
-#ifndef CONFIG_PPC_CPM_NEW_BINDING
-/* Dual Port RAM addresses.  The first 16K is available for almost
- * any CPM use, so we put the BDs there.  The first 128 bytes are
- * used for SMC1 and SMC2 parameter RAM, so we start allocating
- * BDs above that.  All of this must change when we start
- * downloading RAM microcode.
- */
-#define CPM_DATAONLY_BASE  ((uint)128)
-#define CPM_DP_NOSPACE ((uint)0x7fff)
-#if defined(CONFIG_8272) || defined(CONFIG_MPC8555)
-#define CPM_DATAONLY_SIZE  ((uint)(8 * 1024) - CPM_DATAONLY_BASE)
-#define CPM_FCC_SPECIAL_BASE   ((uint)0x9000)
-#else
-#define CPM_DATAONLY_SIZE  ((uint)(16 * 1024) - CPM_DATAONLY_BASE)
-#define CPM_FCC_SPECIAL_BASE   ((uint)0xb000)
-#endif
-#endif
-
 /* The number of pages of host memory we allocate for CPM.  This is
  * done early in kernel initialization to get physically contiguous
  * pages.
@@ -107,17 +89,9 @@
  */
 extern cpm_cpm2_t __iomem *cpmp; /* Pointer to comm processor */
 
-#ifdef CONFIG_PPC_CPM_NEW_BINDING
 #define cpm_dpalloc cpm_muram_alloc
 #define cpm_dpfree cpm_muram_free
 #define cpm_dpram_addr cpm_muram_addr
-#else
-extern unsigned long cpm_dpalloc(uint size, uint align);
-extern int cpm_dpfree(unsigned long offset);
-extern unsigned long cpm_dpalloc_fixed(unsigned long offset, uint size, uint 
align);
-extern void cpm_dpdump(void);
-extern void *cpm_dpram_addr(unsigned long offset);
-#endif
 
 extern void cpm_setbrg(uint brg, uint rate);
 extern void cpm2_fastbrg(uint brg, uint rate, int div16);
-- 
1.5.5.1

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 5/5] powerpc: Remove Kconfig PPC_CPM_NEW_BINDING

2008-06-12 Thread Kumar Gala
With arch/ppc gone and all in kernel users of CONFIG_PPC_CPM_NEW_BINDING
fixed up we dont have need for the Kconfig option anymore.

Signed-off-by: Kumar Gala [EMAIL PROTECTED]
---
 arch/powerpc/platforms/85xx/Kconfig |1 -
 arch/powerpc/platforms/Kconfig  |5 -
 2 files changed, 0 insertions(+), 6 deletions(-)

diff --git a/arch/powerpc/platforms/85xx/Kconfig 
b/arch/powerpc/platforms/85xx/Kconfig
index 91d67ee..5627a4e 100644
--- a/arch/powerpc/platforms/85xx/Kconfig
+++ b/arch/powerpc/platforms/85xx/Kconfig
@@ -79,7 +79,6 @@ config TQM8548
help
  This option enables support for the TQ Components TQM8548 board.
select DEFAULT_UIMAGE
-   select PPC_CPM_NEW_BINDING
select TQM85xx
 
 config TQM8555
diff --git a/arch/powerpc/platforms/Kconfig b/arch/powerpc/platforms/Kconfig
index 87454c5..10efaf8 100644
--- a/arch/powerpc/platforms/Kconfig
+++ b/arch/powerpc/platforms/Kconfig
@@ -286,11 +286,6 @@ config CPM2
  you wish to build a kernel for a machine with a CPM2 coprocessor
  on it (826x, 827x, 8560).
 
-config PPC_CPM_NEW_BINDING
-   bool
-   depends on CPM1 || CPM2
-   default y
-
 config AXON_RAM
tristate Axon DDR2 memory device driver
depends on PPC_IBM_CELL_BLADE
-- 
1.5.5.1

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 2/5] cpm_uart: Remove !CONFIG_PPC_CPM_NEW_BINDING code

2008-06-12 Thread Kumar Gala
Now that arch/ppc is gone we always define CONFIG_PPC_CPM_NEW_BINDING so
we can remove all the code associated with !CONFIG_PPC_CPM_NEW_BINDING.

Signed-off-by: Kumar Gala [EMAIL PROTECTED]
---
 drivers/serial/cpm_uart/cpm_uart.h  |3 -
 drivers/serial/cpm_uart/cpm_uart_core.c |  371 +--
 drivers/serial/cpm_uart/cpm_uart_cpm1.c |  168 --
 drivers/serial/cpm_uart/cpm_uart_cpm1.h |   10 -
 drivers/serial/cpm_uart/cpm_uart_cpm2.c |  277 ---
 drivers/serial/cpm_uart/cpm_uart_cpm2.h |   10 -
 6 files changed, 1 insertions(+), 838 deletions(-)

diff --git a/drivers/serial/cpm_uart/cpm_uart.h 
b/drivers/serial/cpm_uart/cpm_uart.h
index 3d07bec..5c76e0a 100644
--- a/drivers/serial/cpm_uart/cpm_uart.h
+++ b/drivers/serial/cpm_uart/cpm_uart.h
@@ -84,9 +84,6 @@ struct uart_cpm_port {
u32 command;
 };
 
-#ifndef CONFIG_PPC_CPM_NEW_BINDING
-extern int cpm_uart_port_map[UART_NR];
-#endif
 extern int cpm_uart_nr;
 extern struct uart_cpm_port cpm_uart_ports[UART_NR];
 
diff --git a/drivers/serial/cpm_uart/cpm_uart_core.c 
b/drivers/serial/cpm_uart/cpm_uart_core.c
index b0104ca..43f58dc 100644
--- a/drivers/serial/cpm_uart/cpm_uart_core.c
+++ b/drivers/serial/cpm_uart/cpm_uart_core.c
@@ -42,6 +42,7 @@
 #include linux/bootmem.h
 #include linux/dma-mapping.h
 #include linux/fs_uart_pd.h
+#include linux/of_platform.h
 
 #include asm/io.h
 #include asm/irq.h
@@ -49,10 +50,6 @@
 #include asm/fs_pd.h
 #include asm/udbg.h
 
-#ifdef CONFIG_PPC_CPM_NEW_BINDING
-#include linux/of_platform.h
-#endif
-
 #if defined(CONFIG_SERIAL_CPM_CONSOLE)  defined(CONFIG_MAGIC_SYSRQ)
 #define SUPPORT_SYSRQ
 #endif
@@ -72,59 +69,6 @@ static void cpm_uart_initbd(struct uart_cpm_port *pinfo);
 
 /**/
 
-#ifndef CONFIG_PPC_CPM_NEW_BINDING
-/* Track which ports are configured as uarts */
-int cpm_uart_port_map[UART_NR];
-/* How many ports did we config as uarts */
-int cpm_uart_nr;
-
-/* Place-holder for board-specific stuff */
-struct platform_device* __attribute__ ((weak)) __init
-early_uart_get_pdev(int index)
-{
-   return NULL;
-}
-
-
-static void cpm_uart_count(void)
-{
-   cpm_uart_nr = 0;
-#ifdef CONFIG_SERIAL_CPM_SMC1
-   cpm_uart_port_map[cpm_uart_nr++] = UART_SMC1;
-#endif
-#ifdef CONFIG_SERIAL_CPM_SMC2
-   cpm_uart_port_map[cpm_uart_nr++] = UART_SMC2;
-#endif
-#ifdef CONFIG_SERIAL_CPM_SCC1
-   cpm_uart_port_map[cpm_uart_nr++] = UART_SCC1;
-#endif
-#ifdef CONFIG_SERIAL_CPM_SCC2
-   cpm_uart_port_map[cpm_uart_nr++] = UART_SCC2;
-#endif
-#ifdef CONFIG_SERIAL_CPM_SCC3
-   cpm_uart_port_map[cpm_uart_nr++] = UART_SCC3;
-#endif
-#ifdef CONFIG_SERIAL_CPM_SCC4
-   cpm_uart_port_map[cpm_uart_nr++] = UART_SCC4;
-#endif
-}
-
-/* Get UART number by its id */
-static int cpm_uart_id2nr(int id)
-{
-   int i;
-   if (id  UART_NR) {
-   for (i=0; iUART_NR; i++) {
-   if (cpm_uart_port_map[i] == id)
-   return i;
-   }
-   }
-
-   /* not found or invalid argument */
-   return -1;
-}
-#endif
-
 /*
  * Check, if transmit buffers are processed
 */
@@ -935,7 +879,6 @@ static struct uart_ops cpm_uart_pops = {
.verify_port= cpm_uart_verify_port,
 };
 
-#ifdef CONFIG_PPC_CPM_NEW_BINDING
 struct uart_cpm_port cpm_uart_ports[UART_NR];
 
 static int cpm_uart_init_port(struct device_node *np,
@@ -1012,153 +955,6 @@ out_mem:
return ret;
 }
 
-#else
-
-struct uart_cpm_port cpm_uart_ports[UART_NR] = {
-   [UART_SMC1] = {
-   .port = {
-   .irq= SMC1_IRQ,
-   .ops= cpm_uart_pops,
-   .iotype = UPIO_MEM,
-   .lock   = 
__SPIN_LOCK_UNLOCKED(cpm_uart_ports[UART_SMC1].port.lock),
-   },
-   .flags = FLAG_SMC,
-   .tx_nrfifos = TX_NUM_FIFO,
-   .tx_fifosize = TX_BUF_SIZE,
-   .rx_nrfifos = RX_NUM_FIFO,
-   .rx_fifosize = RX_BUF_SIZE,
-   .set_lineif = smc1_lineif,
-   },
-   [UART_SMC2] = {
-   .port = {
-   .irq= SMC2_IRQ,
-   .ops= cpm_uart_pops,
-   .iotype = UPIO_MEM,
-   .lock   = 
__SPIN_LOCK_UNLOCKED(cpm_uart_ports[UART_SMC2].port.lock),
-   },
-   .flags = FLAG_SMC,
-   .tx_nrfifos = TX_NUM_FIFO,
-   .tx_fifosize = TX_BUF_SIZE,
-   .rx_nrfifos = RX_NUM_FIFO,
-   .rx_fifosize = RX_BUF_SIZE,
-   .set_lineif = smc2_lineif,
-#ifdef CONFIG_SERIAL_CPM_ALT_SMC2
-   .is_portb = 1,
-#endif
-   },
-   [UART_SCC1] = {
-   .port = {
-   .irq= SCC1_IRQ,
-   .ops  

[PATCH 4/5] fs_enet: Remove !CONFIG_PPC_CPM_NEW_BINDING code

2008-06-12 Thread Kumar Gala
Now that arch/ppc is gone we always define CONFIG_PPC_CPM_NEW_BINDING so
we can remove all the code associated with !CONFIG_PPC_CPM_NEW_BINDING.

Also fixed some asm/of_platform.h to linux/of_platform.h (and of_device.h)

Signed-off-by: Kumar Gala [EMAIL PROTECTED]
---

Jeff, if this looks ok, its easier if this can go via the powerpc tree.

- k

 drivers/net/fs_enet/Makefile   |5 -
 drivers/net/fs_enet/fs_enet-main.c |  309 +---
 drivers/net/fs_enet/fs_enet.h  |4 -
 drivers/net/fs_enet/mac-fcc.c  |   67 +
 drivers/net/fs_enet/mac-fec.c  |   23 +---
 drivers/net/fs_enet/mac-scc.c  |   37 +
 drivers/net/fs_enet/mii-bitbang.c  |  107 -
 drivers/net/fs_enet/mii-fec.c  |  144 +-
 include/linux/fs_enet_pd.h |4 -
 9 files changed, 5 insertions(+), 695 deletions(-)

diff --git a/drivers/net/fs_enet/Makefile b/drivers/net/fs_enet/Makefile
index 1ffbe07..d4a305e 100644
--- a/drivers/net/fs_enet/Makefile
+++ b/drivers/net/fs_enet/Makefile
@@ -8,12 +8,7 @@ fs_enet-$(CONFIG_FS_ENET_HAS_SCC) += mac-scc.o
 fs_enet-$(CONFIG_FS_ENET_HAS_FEC) += mac-fec.o
 fs_enet-$(CONFIG_FS_ENET_HAS_FCC) += mac-fcc.o
 
-ifeq ($(CONFIG_PPC_CPM_NEW_BINDING),y)
 obj-$(CONFIG_FS_ENET_MDIO_FEC) += mii-fec.o
 obj-$(CONFIG_FS_ENET_MDIO_FCC) += mii-bitbang.o
-else
-fs_enet-$(CONFIG_FS_ENET_MDIO_FEC) += mii-fec.o
-fs_enet-$(CONFIG_FS_ENET_MDIO_FCC) += mii-bitbang.o
-endif
 
 fs_enet-objs := fs_enet-main.o $(fs_enet-m)
diff --git a/drivers/net/fs_enet/fs_enet-main.c 
b/drivers/net/fs_enet/fs_enet-main.c
index a5baaf5..a9f9aae 100644
--- a/drivers/net/fs_enet/fs_enet-main.c
+++ b/drivers/net/fs_enet/fs_enet-main.c
@@ -36,25 +36,18 @@
 #include linux/fs.h
 #include linux/platform_device.h
 #include linux/phy.h
+#include linux/of_platform.h
 
 #include linux/vmalloc.h
 #include asm/pgtable.h
 #include asm/irq.h
 #include asm/uaccess.h
 
-#ifdef CONFIG_PPC_CPM_NEW_BINDING
-#include asm/of_platform.h
-#endif
 
 #include fs_enet.h
 
 /*/
 
-#ifndef CONFIG_PPC_CPM_NEW_BINDING
-static char version[] __devinitdata =
-DRV_MODULE_NAME .c:v DRV_MODULE_VERSION  ( DRV_MODULE_RELDATE ) \n;
-#endif
-
 MODULE_AUTHOR(Pantelis Antoniou [EMAIL PROTECTED]);
 MODULE_DESCRIPTION(Freescale Ethernet Driver);
 MODULE_LICENSE(GPL);
@@ -957,190 +950,6 @@ static int fs_ioctl(struct net_device *dev, struct ifreq 
*rq, int cmd)
 extern int fs_mii_connect(struct net_device *dev);
 extern void fs_mii_disconnect(struct net_device *dev);
 
-#ifndef CONFIG_PPC_CPM_NEW_BINDING
-static struct net_device *fs_init_instance(struct device *dev,
-   struct fs_platform_info *fpi)
-{
-   struct net_device *ndev = NULL;
-   struct fs_enet_private *fep = NULL;
-   int privsize, i, r, err = 0, registered = 0;
-
-   fpi-fs_no = fs_get_id(fpi);
-   /* guard */
-   if ((unsigned int)fpi-fs_no = FS_MAX_INDEX)
-   return ERR_PTR(-EINVAL);
-
-   privsize = sizeof(*fep) + (sizeof(struct sk_buff **) *
-   (fpi-rx_ring + fpi-tx_ring));
-
-   ndev = alloc_etherdev(privsize);
-   if (!ndev) {
-   err = -ENOMEM;
-   goto err;
-   }
-
-   fep = netdev_priv(ndev);
-
-   fep-dev = dev;
-   dev_set_drvdata(dev, ndev);
-   fep-fpi = fpi;
-   if (fpi-init_ioports)
-   fpi-init_ioports((struct fs_platform_info *)fpi);
-
-#ifdef CONFIG_FS_ENET_HAS_FEC
-   if (fs_get_fec_index(fpi-fs_no) = 0)
-   fep-ops = fs_fec_ops;
-#endif
-
-#ifdef CONFIG_FS_ENET_HAS_SCC
-   if (fs_get_scc_index(fpi-fs_no) =0)
-   fep-ops = fs_scc_ops;
-#endif
-
-#ifdef CONFIG_FS_ENET_HAS_FCC
-   if (fs_get_fcc_index(fpi-fs_no) = 0)
-   fep-ops = fs_fcc_ops;
-#endif
-
-   if (fep-ops == NULL) {
-   printk(KERN_ERR DRV_MODULE_NAME
-  : %s No matching ops found (%d).\n,
-  ndev-name, fpi-fs_no);
-   err = -EINVAL;
-   goto err;
-   }
-
-   r = (*fep-ops-setup_data)(ndev);
-   if (r != 0) {
-   printk(KERN_ERR DRV_MODULE_NAME
-  : %s setup_data failed\n,
-   ndev-name);
-   err = r;
-   goto err;
-   }
-
-   /* point rx_skbuff, tx_skbuff */
-   fep-rx_skbuff = (struct sk_buff **)fep[1];
-   fep-tx_skbuff = fep-rx_skbuff + fpi-rx_ring;
-
-   /* init locks */
-   spin_lock_init(fep-lock);
-   spin_lock_init(fep-tx_lock);
-
-   /*
-* Set the Ethernet address.
-*/
-   for (i = 0; i  6; i++)
-   ndev-dev_addr[i] = fpi-macaddr[i];
-
-   r = (*fep-ops-allocate_bd)(ndev);
-
-   if (fep-ring_base == NULL) {
-   printk(KERN_ERR DRV_MODULE_NAME
-  : %s buffer descriptor alloc failed (%d).\n, 
ndev-name, r);
-   err = r;
- 

Re: [PATCH 1/2] Added support for PRTLVT based boards (MPC5121)

2008-06-12 Thread Grant Likely
Looking even better.  Just a few more comments.  I'll probably be able
to pick up the next one for inclusion in 2.6.27.

On Thu, Jun 12, 2008 at 5:44 AM, David Jander [EMAIL PROTECTED] wrote:
  Made MPC5121_ADS board support generic:
  Renamed arch/powerpc/platforms/512x/mpc5121_ads.c and added list of supported
  boards.
  For both MPC5121 ADS or PRTLVT support, just select MPC5121_GENERIC and use
  the corresponding device-tree.

 Signed-off-by: David Jander [EMAIL PROTECTED]
 ---
  arch/powerpc/boot/dts/prtlvt.dts   |  272 
 
  arch/powerpc/platforms/512x/Kconfig|   14 +-
  arch/powerpc/platforms/512x/Makefile   |2 +-
  .../512x/{mpc5121_ads.c = mpc5121_generic.c}  |   38 ++-
  4 files changed, 307 insertions(+), 19 deletions(-)
  create mode 100644 arch/powerpc/boot/dts/prtlvt.dts
  rename arch/powerpc/platforms/512x/{mpc5121_ads.c = mpc5121_generic.c} (73%)

 diff --git a/arch/powerpc/boot/dts/prtlvt.dts 
 b/arch/powerpc/boot/dts/prtlvt.dts
 new file mode 100644
 index 000..a011c8c
 --- /dev/null
 +++ b/arch/powerpc/boot/dts/prtlvt.dts
 @@ -0,0 +1,272 @@
 +/*
 + * Device tree source for PRTLVT based boards, base on:
 + * MPC5121E MDS Device Tree Source
 + *
 + * Copyright 2007 Freescale Semiconductor Inc.
 + * Copyright 2008 Protonic Holland
 + *
 + * This program is free software; you can redistribute  it and/or modify it
 + * under  the terms of  the GNU General  Public License as published by the
 + * Free Software Foundation;  either version 2 of the  License, or (at your
 + * option) any later version.
 + */
 +
 + /* compile with: ./dtc -p 10240 -R 20 -I dts -o prtlvt.dtb -O dtb -b 0 
 dts/prtlvt.dts */
 +
 +/dts-v1/;
 +
 +/ {
 +   model = prtlvt;
 +   compatible = prt,prtlvt;
 +   #address-cells = 1;
 +   #size-cells = 1;
 +
 +   cpus {
 +   #address-cells = 1;
 +   #size-cells = 0;
 +
 +   PowerPC,[EMAIL PROTECTED] {
 +   device_type = cpu;
 +   reg = 0;
 +   d-cache-line-size = 0x20; // 32 bytes
 +   i-cache-line-size = 0x20; // 32 bytes
 +   d-cache-size = 0x8000;// L1, 32K
 +   i-cache-size = 0x8000;// L1, 32K
 +   timebase-frequency = 5000;// 50 MHz (csb/4)
 +   bus-frequency = 2;// 200 MHz csb bus
 +   clock-frequency = 4;  // 400 MHz ppc core
 +   };
 +   };
 +
 +   memory {
 +   device_type = memory;
 +   reg = 0x 0x1000;  // 256MB at 0
 +   };
 +
 +   [EMAIL PROTECTED] {

There should probably be a node to describe the local bus that the
flash is attached to and this flash node should be a child of the bus.

 +   compatible = amd,s29gl256n, cfi-flash;
 +   reg = 0xfe00 0x0200;
 +   bank-width = 2;
 +   #address-cells = 1;
 +   #size-cells = 1;
 +   [EMAIL PROTECTED] {
 +   label = rootfs;
 +   reg = 0x 0x0180;
 +   };
 +   [EMAIL PROTECTED] {
 +   label =config0;
 +   reg = 0x0180 0x0020;
 +   };
 +   [EMAIL PROTECTED] {
 +   label =config1;
 +   reg = 0x01a0 0x0020;
 +   };
 +   [EMAIL PROTECTED] {
 +   label =kernel;
 +   reg = 0x01c0 0x002e;
 +   };
 +   [EMAIL PROTECTED] {
 +   label =devicetree;
 +   reg = 0x01ee 0x0002;
 +   };
 +   [EMAIL PROTECTED] {
 +   label =uboot;
 +   reg = 0x01f0 0x0010;
 +   };
 +   };

I'm still not all that keen on encoding the partition information into
the 'stock' device tree included with the kernel as it is more of a
configuration description that is more properly supplied by the
bootloader.  This is a debate that has been going back and forth over
the last few months, so there isn't a solid concensus yet, but my
preference is to remove or comment out the partition information for
now.

 +   [EMAIL PROTECTED] {
 +   compatible = fsl,mpc5121-i2c-ctrl;
 +   reg = 0x1760 0x8;
 +   };
 +
 +   [EMAIL PROTECTED] {

(nitpick) There is a recommended practice that says node names should
be generic as much as possible, so I think this should probably be
[EMAIL PROTECTED]  The compatible value is fine.

 +   [EMAIL PROTECTED] {
 +   compatible = fsl,mpc5121-fec;
 +   reg = 0x2800 0x800;
 +   

Re: [GIT PULL] one kbuild fix for powerpc

2008-06-12 Thread roel kluin
2008/6/12 Sam Ravnborg [EMAIL PROTECTED]:

 diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
 index 508c589..b763aba 100644
 --- a/scripts/mod/modpost.c
 +++ b/scripts/mod/modpost.c
 @@ -467,6 +467,26 @@ static void parse_elf_finish(struct elf_info *info)
release_file(info-hdr, info-size);
  }

 +static int ignore_undef_symbol(struct elf_info *info, const char *symname)
 +{
 +   /* ignore __this_module, it will be resolved shortly */
 +   if (strcmp(symname, MODULE_SYMBOL_PREFIX __this_module) == 0)
 +   return 1;
 +   /* ignore global offset table */
 +   if (strcmp(symname, _GLOBAL_OFFSET_TABLE_) == 0)
 +   return 1;
 +   if (info-hdr-e_machine == EM_PPC)
 +   /* Special register function linked on all modules during 
 final link of .ko */
 +   if (strncmp(symname, _restgpr_, sizeof(_restgpr_) - 1) == 
 0 ||
 +   strncmp(symname, _savegpr_, sizeof(_savegpr_) - 1) == 
 0 ||
 +   strncmp(symname, _rest32gpr_, sizeof(_rest32gpr_) - 
 1) == 0 ||
 +   strncmp(symname, _save32gpr_, sizeof(_save32gpr_) - 
 1) == 0) {
 +   return 1;
 +   }

Either the indentation is wrong, or you want to move the opening curly
bracket upwards.

 +   /* Do not ignore this symbol */
 +   return 0;
 +}
 +
  #define CRC_PFX MODULE_SYMBOL_PREFIX __crc_
  #define KSYMTAB_PFX MODULE_SYMBOL_PREFIX __ksymtab_

 @@ -493,11 +513,7 @@ static void handle_modversions(struct module *mod, 
 struct elf_info *info,
if (ELF_ST_BIND(sym-st_info) != STB_GLOBAL 
ELF_ST_BIND(sym-st_info) != STB_WEAK)
break;
 -   /* ignore global offset table */
 -   if (strcmp(symname, _GLOBAL_OFFSET_TABLE_) == 0)
 -   break;
 -   /* ignore __this_module, it will be resolved shortly */
 -   if (strcmp(symname, MODULE_SYMBOL_PREFIX __this_module) == 
 0)
 +   if (ignore_undef_symbol(info, symname))
break;
  /* cope with newer glibc (2.3.4 or higher) STT_ definition in elf.h */
  #if defined(STT_REGISTER) || defined(STT_SPARC_REGISTER)
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH] powerpc/4xx: Workaround for PPC440EPx/GRx PCI_28 Errata

2008-06-12 Thread Stefan Roese
On Wednesday 11 June 2008, Josh Boyer wrote:
 The 440EPx/GRx chips don't support PCI MRM commands.  Drivers determine
 this by looking for a zero value in the PCI cache line size register. 
 However, some drivers write to this register upon initialization.  This can
 cause MRMs to be used on these chips, which may cause deadlocks on PLB4.

 The workaround implemented here introduces a new indirect_type flag, called
 PPC_INDIRECT_TYPE_BROKEN_MRM.  This is set in the pci_controller structure
 in the pci fixup function for 4xx PCI bridges by determining if the bridge
 is compatible with 440EPx/GRx.  The flag is checked in the
 indirect_write_config function, and forces any writes to the
 PCI_CACHE_LINE_SIZE register to be zero, which will disable MRMs for these
 chips.

 A similar workaround has been tested by AMCC on various PCI cards, such as
 the Silicon Image ATA card and Intel E1000 GIGE card.  Hangs were seen with
 the Silicon Image card, and MRMs were seen on the bus with a PCI analyzer.
 With the workaround in place, the card functioned properly and only Memory
 Reads were seen on the bus with the analyzer.

 Signed-off-by: Josh Boyer [EMAIL PROTECTED]

Acked-by: Stefan Roese [EMAIL PROTECTED]

I manually applied your patch (since it doesn't apply clean as discussed on 
IRC) and tested it on my Sequoia with a modified PCI USB driver changing 
PCI_CACHE_LINE_SIZE.

Best regards,
Stefan
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [GIT PULL] one kbuild fix for powerpc

2008-06-12 Thread Sam Ravnborg
On Thu, Jun 12, 2008 at 04:03:54PM +0200, roel kluin wrote:
 2008/6/12 Sam Ravnborg [EMAIL PROTECTED]:
 
  diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
  index 508c589..b763aba 100644
  --- a/scripts/mod/modpost.c
  +++ b/scripts/mod/modpost.c
  @@ -467,6 +467,26 @@ static void parse_elf_finish(struct elf_info *info)
 release_file(info-hdr, info-size);
   }
 
  +static int ignore_undef_symbol(struct elf_info *info, const char *symname)
  +{
  +   /* ignore __this_module, it will be resolved shortly */
  +   if (strcmp(symname, MODULE_SYMBOL_PREFIX __this_module) == 0)
  +   return 1;
  +   /* ignore global offset table */
  +   if (strcmp(symname, _GLOBAL_OFFSET_TABLE_) == 0)
  +   return 1;
  +   if (info-hdr-e_machine == EM_PPC)
  +   /* Special register function linked on all modules during 
  final link of .ko */
  +   if (strncmp(symname, _restgpr_, sizeof(_restgpr_) - 1) 
  == 0 ||
  +   strncmp(symname, _savegpr_, sizeof(_savegpr_) - 1) 
  == 0 ||
  +   strncmp(symname, _rest32gpr_, sizeof(_rest32gpr_) - 
  1) == 0 ||
  +   strncmp(symname, _save32gpr_, sizeof(_save32gpr_) - 
  1) == 0) {
  +   return 1;
  +   }
 
 Either the indentation is wrong, or you want to move the opening curly
 bracket upwards.

Deleted brackets - they are not needed.
And updated kbuild-fixes.git

Sam
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


RE: [RFC] Kprobes for book-e

2008-06-12 Thread Sulibhavi, Madhvesh
Kumar Gala wrote Wednesday, June 11, 2008 8:36 PM
 To: Sulibhavi, Madhvesh
 Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]; 
 linuxppc-dev@ozlabs.org; Paul Mackerras
 Subject: Re: [RFC] Kprobes for book-e
 
...

 -
  arch/powerpc/kernel/kprobes.c |   35 ++ 
  +
  arch/powerpc/kernel/misc_32.S |2 +-
  arch/powerpc/kernel/traps.c   |   26 +-
  3 files changed, 57 insertions(+), 6 deletions(-)
 
 Your patch got line wrapped by your mailer.  Take a look at  
 Documentation/email-clients.tx

Yes, i need to correct my emailer (long pending)

 
  static void __kprobes prepare_singlestep(struct kprobe *p, struct
  pt_regs *regs)
  {
  +#ifdef CONFIG_BOOKE
  +   regs-msr = ~(MSR_EE); /* Turn off 'Externel Interrupt' bits */
  +   regs-msr = ~(MSR_CE); /* Turn off 'Critical Interrupt' bits */
  +   regs-msr |= MSR_DE;
 
 can we remove MSR_EE and MSR_CE here?

Ah! yes? interrupts are enabled while executing the trap
instruction in ppc unlike int3 of x86 where interupts are 
disabled. kprobe_handler already handles the reentrancy with 
nmissed count. I think this code can be removed and 
I will confirm after my test.


-Madhvesh


---
This email is confidential and intended only for the use of the individual or 
entity named above and may contain information that is privileged. If you are 
not the intended recipient, you are notified that any dissemination, 
distribution or copying of this email is strictly prohibited. If you have 
received this email in error, please notify us immediately by return email or 
telephone and destroy the original message. - This mail is sent via Sony Asia 
Pacific Mail Gateway.
---

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: MMIO and gcc re-ordering issue

2008-06-12 Thread Matthew Wilcox
On Thu, Jun 05, 2008 at 06:43:53PM +1000, Benjamin Herrenschmidt wrote:
 Note that the powerpc implementation currently clears the flag
 on spin_lock and tests it on unlock. We are considering changing
 that to not touch the flag on spin_lock and just clear it whenever
 we do a sync (ie, on unlock, on explicit mmiowb, and possibly even
 on readl's where we happen to do sync's).

Your current scheme sounds like it's broken for

spin_lock(a)
writel();
spin_lock(b);
spin_unlock(b);
spin_unlock(a);

-- 
Intel are signing my paycheques ... these opinions are still mine
Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours.  We can't possibly take such
a retrograde step.
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH] [8xx] powerpc: Add support for the MPC852 based mgsuvd board from keymile.

2008-06-12 Thread Scott Wood
On Thu, Jun 12, 2008 at 04:32:47AM +0400, Vitaly Bordug wrote:
 + interrupts = 0x0f 2;  /* decrementer 
 interrupt */

Interrupts should probably be decimal.

 + compatible = fsl,cpm1;

compatible = fsl,mpc852-cpm, fsl,cpm1.

 + command-proc = 0x9c0;

This is obsolete; there should be no remaining code that refers to it.

 + [EMAIL PROTECTED] {
 + #address-cells = 1;
 + #size-cells = 1;
 + ranges = 0 0x2000 0x2000;
 +
 + [EMAIL PROTECTED] {
 + compatible = fsl,cpm-muram-data;
 + reg = 0x800 0x1800;
 + };
 + };

The muram node itself should also have a compatible (fsl,cpm-muram).

 + clock-frequency = 0x3ef1480;

clock-frequency should be decimal (or better, filled in by u-boot).

 + CPM_PIC: [EMAIL PROTECTED] {
 + interrupt-controller;
 + #interrupt-cells = 1;
 + interrupts = 5 2 0 2 0x20 2;
 + interrupt-parent = PIC;
 + reg = 0x930 0x20;
 + compatible = fsl,cpm1-pic;

fsl,mpc852-cpm-pic, fsl,cpm1-pic.
Likewise elsewhere.

 + /* MON-1 */
 + [EMAIL PROTECTED] {
 + device_type = serial;
 + compatible = cpm_uart,
 +  fsl,cpm1-smc-uart;
 + model = SMC;
 + device-id = 1;
 + reg = 0xa80 0x10 0x3fc0 0x40;
 + interrupts = 4;
 + interrupt-parent = CPM_PIC;
 + fsl,cpm-brg = 1;
 + fsl,cpm-command = 0x0090;
 + current-speed = 0; /* Filled in by u-boot */
 + };
 +
 + [EMAIL PROTECTED] {
 + device_type = network;
 + compatible = fs_enet,
 +  fsl,cpm1-scc-enet;
 + model = SCC;
 + device-id = 3;

The cpm_uart and fs_enet compatible values, as well as the device-id
property and this usage of the model property, are obsolete and there should
be no code remaining that references it.

 + reg = 0xa40 0x18 0x3e00 0xb0;
 + mac-address = [ 00 00 00 00 00 00 ];  /* Filled 
 in by u-boot */

Should be local-mac-address.

 + fixed-link = 0 0 0x0a 0 0;

We should move the documentation for this out of the gianfar-specific
section of booting-without-of.txt.  Speed should be decimal.

 +config PPC_MGSUVD
 + bool MGSUVD
 + select CPM1
 + select PPC_CPM_NEW_BINDING

No need to explicitly select PPC_CPM_NEW_BINDING any more.

 +struct cpm_pin {
 + int port, pin, flags;
 +};

Only one tab, please.

 +static __initdata struct of_device_id of_bus_ids[] = {
 + { .name = soc, },
 + { .name = cpm, },
 + { .name = localbus, },
 + {},
 +};

Replace these with { .compatible = simple-bus }, and add simple-bus to the
dts where appropriate.

 +static int __init declare_of_platform_devices(void)
 +{
 + of_platform_bus_probe (NULL, of_bus_ids, NULL);
 + return 0;
 +}
 +machine_device_initcall(mgsuvd, declare_of_platform_devices);
 +
 +static int __init mgsuvd_probe(void)
 +{
 + unsigned long root = of_get_flat_dt_root ();
 + return of_flat_dt_is_compatible (root, keymile,mgsuvd);
 +}

No space between a function name and the arguments -- this isn't u-boot. :-)

 +define_machine(mgsuvd) {
 + .name   = MGSUVD,
 + .probe  = mgsuvd_probe,
 + .setup_arch = mgsuvd_setup_arch,
 + .init_IRQ   = mpc8xx_pics_init,
 + .get_irq= mpc8xx_get_irq,
 + .restart= mpc8xx_restart,
 + .calibrate_decr = mpc8xx_calibrate_decr,
 + .set_rtc_time   = mpc8xx_set_rtc_time,
 + .get_rtc_time   = mpc8xx_get_rtc_time,
 +};

This tab-alignment will look like hell if viewed with another tab size...

-Scott
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH] [82xx] powerpc: Add support for mpc8247 based board MGCOGE from keymile.

2008-06-12 Thread Scott Wood
On Thu, Jun 12, 2008 at 04:30:53AM +0400, Vitaly Bordug wrote:
 + muram {
 + #address-cells = 1;
 + #size-cells = 1;
 + ranges = 0 0 0x1;
 +
 + [EMAIL PROTECTED] {
 + compatible = fsl,cpm-muram-data;
 + reg = 0x80 0x1f80 0x9800 0x800;
 + };
 + };

fsl,cpm-muram compatible on the muram node.

 + /* Monitor port/SMC2 */
 + smc2: [EMAIL PROTECTED] {
 + device_type = serial;
 + compatible = fsl,mpc8247-smc-uart,
 +  fsl,cpm2-smc-uart;
 + reg = 0x11a90 0x20 0x88fc 0x02;
 + interrupts = 5 8;
 + interrupt-parent = PIC;
 + fsl,cpm-brg = 2;
 + fsl,cpm-command = 0x2120;
 + current-speed = 115200;
 + };

Shouldn't u-boot fill in the current speed?

-Scott
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: dtc: Add support for binary includes.

2008-06-12 Thread Scott Wood
On Wed, Jun 11, 2008 at 11:58:39AM +1000, David Gibson wrote:
 Scott's original patch does still have some implementation details I
 didn't like.  So in the interests of saving time, I've addressed some
 of those, added a testcase, and and now resubmitting my revised
 version of Scott's patch.

Acked-by: Scott Wood [EMAIL PROTECTED]

 -struct data data_copy_file(FILE *f, size_t len)
 +struct data data_copy_file(FILE *f, size_t maxlen)
  {
 - struct data d;
 + struct data d = empty_data;
 +
 + while (!feof(f)  (d.len  maxlen)) {
 + size_t chunksize, ret;
 +
 + if (maxlen == -1)
 + chunksize = 4096;
 + else
 + chunksize = maxlen - d.len;
 +
 + d = data_grow_for(d, chunksize);
 + ret = fread(d.val + d.len, 1, chunksize, f);
 +
 + if (ferror(f))
 + die(Error reading file into data: %s, 
 strerror(errno));

It'd be nice if we could keep the filename around for reporting here...

-Scott
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: linux-next: powerpc build failure

2008-06-12 Thread Sam Ravnborg
On Thu, Jun 12, 2008 at 05:24:03PM +1000, Stephen Rothwell wrote:
 On Thu, 12 Jun 2008 17:05:05 +1000 Stephen Rothwell [EMAIL PROTECTED] wrote:
 
  So, I will disable FTRACE on powerpc for now by removing HAVE_FTRACE from
  being selected in arch/powerpc/Kconfig.
 
 That got rid of the initial errors, but now it fails for relocations
 on .memcmp and some others.
 
 Next guess:  I have reverted commit
 a7815807f749669d3e06529b2d448390f2ef0f9d (kbuild: simplify vmlinux link
 stage) and powerpc allmodconfig builds again.  (even with FTRACE reenabled)
 
 [For those that came in late (Sam):  a powerpc allyesconfig build was
 getting errors like this:
 
 net/ipx/af_ipx.c:1830: relocation truncated to fit: R_PPC64_REL24 against 
 symbol `._mcount' defined in .text section in vmlinux.o
 
 which I surmised was caused by ftrace adding -pg to KBUILD_CFLAGS.]

I do not get if this was fixed by the revert of the kbuild patch or
this was a ftrace bug?

I have the following pending (awaiting testing feedback from Jeff Dike).

Sam

diff --git a/arch/um/Makefile b/arch/um/Makefile
index 06cbc09..4eb0b07 100644
--- a/arch/um/Makefile
+++ b/arch/um/Makefile
@@ -104,7 +104,7 @@ archprepare: $(ARCH_SYMLINKS) 
$(ARCH_DIR)/include/user_constants.h
 prepare: $(ARCH_DIR)/include/kern_constants.h
 
 LINK-$(CONFIG_LD_SCRIPT_STATIC) += -static
-LINK-$(CONFIG_LD_SCRIPT_DYN) += -rpath /lib -rpath /usr/lib
+LINK-$(CONFIG_LD_SCRIPT_DYN) += -L/lib -L/usr/lib
 
 CFLAGS_NO_HARDENING := $(call cc-option, -fno-PIC,) $(call cc-option, 
-fno-pic,) \
$(call cc-option, -fno-stack-protector,) \
@@ -118,7 +118,13 @@ CPPFLAGS_vmlinux.lds = -U$(SUBARCH) -DSTART=$(START) 
-DELF_ARCH=$(ELF_ARCH) \
 
 # The wrappers will select whether using malloc or the kernel allocator.
 LDFLAGS_vmlinux := $(LINK-y) --wrap malloc --wrap free --wrap calloc
-KBUILD_VMLINUX_EXTRA := -lutil
+KBUILD_VMLINUX_EXTRA := \
+$(shell $(CC) -print-file-name=crt1.o)\
+$(shell $(CC) -print-file-name=crti.o)\
+$(shell $(CC) -print-file-name=libgcc_s.so)   \
+$(shell $(CC) -print-file-name=ld-linux.so.2) \
+$(shell $(CC) -print-file-name=libutil.so)\
+$(shell $(CC) -print-file-name=libc.so)
 
 # When cleaning we don't include .config, so we don't include
 # TT or skas makefiles and don't clean skas_ptregs.h.
diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh
index b9ecff5..e8fc6ab 100644
--- a/scripts/link-vmlinux.sh
+++ b/scripts/link-vmlinux.sh
@@ -95,8 +95,7 @@ mksysmap()
 tell LD vmlinux.o
 ${LD} ${LDFLAGS} ${LDFLAGS_vmlinux} -r -o vmlinux.o  \
${KBUILD_VMLINUX_INIT}   \
---start-group ${KBUILD_VMLINUX_MAIN} --end-group \
-   ${KBUILD_VMLINUX_EXTRA}
+--start-group ${KBUILD_VMLINUX_MAIN} --end-group
 
 # modpost vmlinux.o
 ${MAKE} -f ${srctree}/scripts/Makefile.modpost vmlinux.o
@@ -121,19 +120,19 @@ fi
 
 # First stage of fully linked vmlinux
 tell LD ${VMLINUX}
-${LD} ${LDFLAGS} ${LDFLAGS_vmlinux} -o ${VMLINUX} \
-  -T ${KBUILD_VMLINUX_LDS} vmlinux.o
+${LD} ${LDFLAGS} ${LDFLAGS_vmlinux} ${KBUILD_VMLINUX_EXTRA} \
+-o ${VMLINUX} -T ${KBUILD_VMLINUX_LDS} vmlinux.o
 
 if [ ${CONFIG_KALLSYMS} = y ]; then
 
# Do an extra pass to link in kallsyms data
${NM} -n .tmp_vmlinux | scripts/kallsyms  .tmp_kallsyms.S
-${CC} ${KBUILD_AFLAGS} ${KBUILD_CPPFLAGS} -c -o .tmp_kallsyms.o \
- .tmp_kallsyms.S
+${CC} ${KBUILD_AFLAGS} ${AFLAGS_KERNEL} ${KBUILD_CPPFLAGS} -c \
+ -o .tmp_kallsyms.o .tmp_kallsyms.S
 # link in kalll symbols
tell LD vmlinux
-${LD} ${LDFLAGS} ${LDFLAGS_vmlinux} -o vmlinux \
- -T ${KBUILD_VMLINUX_LDS} vmlinux.o .tmp_kallsyms.o
+${LD} ${LDFLAGS} ${LDFLAGS_vmlinux} ${KBUILD_VMLINUX_EXTRA} \
+ -o vmlinux -T ${KBUILD_VMLINUX_LDS} vmlinux.o .tmp_kallsyms.o
 fi
 
 tell SYSMAP System.map
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[RFC PATCH 1/2] Merge options into CONFIG_HUGETLB

2008-06-12 Thread Adam Litke
Merge CONFIG_HUGETLB_PAGE and CONFIG_HUGETLBFS into one new config option:
CONFIG_HUGETLB.  CONFIG_HUGETLB_PAGE is aliased to the value of
CONFIG_HUGETLBFS, so one option can be removed without any effect.  This change
is pretty mechanical, but a little extra verification from arch maintainers
would be very helpful.  Thanks.

Signed-off-by: Adam Litke [EMAIL PROTECTED]

--

 Documentation/vm/hugetlbpage.txt   |6 ++
 arch/arm/mm/consistent.c   |2 +-
 arch/avr32/mm/dma-coherent.c   |2 +-
 arch/ia64/Kconfig  |8 
 arch/ia64/kernel/ivt.S |6 +++---
 arch/ia64/kernel/sys_ia64.c|2 +-
 arch/ia64/mm/Makefile  |2 +-
 arch/ia64/mm/init.c|2 +-
 arch/powerpc/Kconfig   |2 +-
 arch/powerpc/mm/Makefile   |2 +-
 arch/powerpc/mm/hash_utils_64.c|   10 +-
 arch/powerpc/mm/init_64.c  |2 +-
 arch/powerpc/mm/tlb_64.c   |2 +-
 arch/powerpc/platforms/Kconfig.cputype |2 +-
 arch/s390/mm/Makefile  |2 +-
 arch/sh/mm/Kconfig |2 +-
 arch/sh/mm/Makefile_32 |2 +-
 arch/sh/mm/Makefile_64 |2 +-
 arch/sparc64/Kconfig   |2 +-
 arch/sparc64/kernel/sun4v_tlb_miss.S   |2 +-
 arch/sparc64/kernel/tsb.S  |4 ++--
 arch/sparc64/mm/Makefile   |2 +-
 arch/sparc64/mm/fault.c|4 ++--
 arch/sparc64/mm/init.c |2 +-
 arch/sparc64/mm/tsb.c  |   14 +++---
 arch/x86/mm/Makefile   |2 +-
 fs/Kconfig |5 +
 fs/Makefile|2 +-
 fs/hugetlbfs/Makefile  |2 +-
 include/asm-ia64/mmu_context.h |2 +-
 include/asm-ia64/page.h|6 +++---
 include/asm-ia64/pgtable.h |2 +-
 include/asm-mn10300/page.h |2 +-
 include/asm-parisc/page.h  |2 +-
 include/asm-powerpc/mmu-hash64.h   |4 ++--
 include/asm-powerpc/page_64.h  |6 +++---
 include/asm-powerpc/pgtable-ppc64.h|2 +-
 include/asm-sh/page.h  |2 +-
 include/asm-sparc64/mmu.h  |2 +-
 include/asm-sparc64/mmu_context.h  |2 +-
 include/asm-sparc64/page.h |2 +-
 include/asm-sparc64/pgtable.h  |2 +-
 include/asm-x86/page_32.h  |2 +-
 include/linux/hugetlb.h|   12 ++--
 include/linux/pageblock-flags.h|6 +++---
 include/linux/vmstat.h |2 +-
 kernel/sysctl.c|2 +-
 mm/Makefile|2 +-
 mm/mempolicy.c |4 ++--
 mm/vmstat.c|2 +-
 50 files changed, 81 insertions(+), 86 deletions(-)

diff --git a/Documentation/vm/hugetlbpage.txt b/Documentation/vm/hugetlbpage.txt
index 3102b81..53604e9 100644
--- a/Documentation/vm/hugetlbpage.txt
+++ b/Documentation/vm/hugetlbpage.txt
@@ -13,10 +13,8 @@ This optimization is more critical now as bigger and bigger 
physical memories
 Users can use the huge page support in Linux kernel by either using the mmap
 system call or standard SYSv shared memory system calls (shmget, shmat).
 
-First the Linux kernel needs to be built with the CONFIG_HUGETLBFS
-(present under File systems) and CONFIG_HUGETLB_PAGE (selected
-automatically when CONFIG_HUGETLBFS is selected) configuration
-options.
+First the Linux kernel needs to be built with the CONFIG_HUGETLB
+(present under File systems) configuration option.
 
 The kernel built with hugepage support should show the number of configured
 hugepages in the system by running the cat /proc/meminfo command.
diff --git a/arch/arm/mm/consistent.c b/arch/arm/mm/consistent.c
index 333a82a..5931192 100644
--- a/arch/arm/mm/consistent.c
+++ b/arch/arm/mm/consistent.c
@@ -140,7 +140,7 @@ static struct vm_region *vm_region_find(struct vm_region 
*head, unsigned long ad
return c;
 }
 
-#ifdef CONFIG_HUGETLB_PAGE
+#ifdef CONFIG_HUGETLB
 #error ARM Coherent DMA allocator does not (yet) support huge TLB
 #endif
 
diff --git a/arch/avr32/mm/dma-coherent.c b/arch/avr32/mm/dma-coherent.c
index 6d8c794..0cf57c6 100644
--- a/arch/avr32/mm/dma-coherent.c
+++ b/arch/avr32/mm/dma-coherent.c
@@ -45,7 +45,7 @@ static struct page *__dma_alloc(struct device *dev, size_t 
size,
 * with __GFP_COMP being passed to split_page() which cannot
 * handle them.  The real problem is that this flag probably
 * should be 0 on AVR32 as it is not supported on this
-* platform--see CONFIG_HUGETLB_PAGE. */
+* platform--see CONFIG_HUGETLB. */
gfp = ~(__GFP_COMP);
 
size = PAGE_ALIGN(size);
diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig
index 

Using DMA interrupt on MPC8313

2008-06-12 Thread Ron Madrid
I'm trying to write a driver that would make use of the DMA on the MPC8313.  
I'm attempting to
register the interrupt with request_irq but it is not passing.  Is there 
something that I need to
do before I call request_irq, maybe in the dts or somewhere else?

Ron
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [RFC PATCH 2/2] Update defconfigs for CONFIG_HUGETLB

2008-06-12 Thread Adrian Bunk
On Thu, Jun 12, 2008 at 02:55:45PM -0400, Adam Litke wrote:
 Update all defconfigs that specify a default configuration for hugetlbfs.
 There is now only one option: CONFIG_HUGETLB.  Replace the old
 CONFIG_HUGETLB_PAGE and CONFIG_HUGETLBFS options with the new one.  I found no
 cases where CONFIG_HUGETLBFS and CONFIG_HUGETLB_PAGE had different values so
 this patch is large but completely mechanical:
...
  335 files changed, 335 insertions(+), 385 deletions(-)
...

Please don't do this kind of patches - it doesn't bring any advantage 
but can create tons of patch conflicts.

The next time a defconfig gets updated it will anyway automatically be 
fixed, and for defconfigs that aren't updated it doesn't create any 
problems to keep them as they are today until they might one day get 
updated.

cu
Adrian

-- 

   Is there not promise of rain? Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
   Only a promise, Lao Er said.
   Pearl S. Buck - Dragon Seed

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: Using DMA interrupt on MPC8313

2008-06-12 Thread Ron Madrid
Well in that case wouldn't I need to use the fsldma driver?  Or is dmaengine a 
generic dma driver?

Ron
--- Kumar Gala [EMAIL PROTECTED] wrote:

 
 On Jun 12, 2008, at 2:35 PM, Ron Madrid wrote:
 
  I'm trying to write a driver that would make use of the DMA on the  
  MPC8313.  I'm attempting to
  register the interrupt with request_irq but it is not passing.  Is  
  there something that I need to
  do before I call request_irq, maybe in the dts or somewhere else?
 
 
 any reason you aren't using the dmaengine driver?
 
 - k
 

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH] powerpc/4xx: Workaround for PPC440EPx/GRx PCI_28 Errata

2008-06-12 Thread Josh Boyer
On Thu, 12 Jun 2008 16:24:13 +0200
Stefan Roese [EMAIL PROTECTED] wrote:

 On Wednesday 11 June 2008, Josh Boyer wrote:
  The 440EPx/GRx chips don't support PCI MRM commands.  Drivers determine
  this by looking for a zero value in the PCI cache line size register. 
  However, some drivers write to this register upon initialization.  This can
  cause MRMs to be used on these chips, which may cause deadlocks on PLB4.
 
  The workaround implemented here introduces a new indirect_type flag, called
  PPC_INDIRECT_TYPE_BROKEN_MRM.  This is set in the pci_controller structure
  in the pci fixup function for 4xx PCI bridges by determining if the bridge
  is compatible with 440EPx/GRx.  The flag is checked in the
  indirect_write_config function, and forces any writes to the
  PCI_CACHE_LINE_SIZE register to be zero, which will disable MRMs for these
  chips.
 
  A similar workaround has been tested by AMCC on various PCI cards, such as
  the Silicon Image ATA card and Intel E1000 GIGE card.  Hangs were seen with
  the Silicon Image card, and MRMs were seen on the bus with a PCI analyzer.
  With the workaround in place, the card functioned properly and only Memory
  Reads were seen on the bus with the analyzer.
 
  Signed-off-by: Josh Boyer [EMAIL PROTECTED]
 
 Acked-by: Stefan Roese [EMAIL PROTECTED]
 
 I manually applied your patch (since it doesn't apply clean as discussed on 
 IRC) and tested it on my Sequoia with a modified PCI USB driver changing 
 PCI_CACHE_LINE_SIZE.

Thanks.  I blame git for being dumb.  I guess I'll have to switch to
using git-format-patch instead of quilt.

In the meantime, I'll queue this up for .27.

josh
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH 1/5] powerpc: remove mpc8xx-ide driver

2008-06-12 Thread Arnd Bergmann
On Thursday 12 June 2008, Kumar Gala wrote:
 
 On Jun 10, 2008, at 2:01 PM, Bartlomiej Zolnierkiewicz wrote:
  Thanks, applied.
 
 Acked-by: Kumar Gala [EMAIL PROTECTED]

Ok, I've updated my git tree again, to remove this one and
the commproc.h changes that have gone into the m68k-nommu
tree.

The patches remain now, and are still available for powerpc-next at

git://git.kernel.org/pub/scm/linux/kernel/git/arnd/playground.git 
ppc-removal-more

Arnd 

---
commit 2c2732c402532e6be26d58f38abd39f56070d569
Author: Arnd Bergmann [EMAIL PROTECTED]
Date:   Tue Jun 10 15:55:40 2008 +0200

powerpc/mtd: remove dead platform specific maps

It is no longer possible to select compilation of these
drivers with arch/powerpc, so the code should be removed.

New platforms should use physmap_of.

Cc: [EMAIL PROTECTED]
Cc: David Woodhouse [EMAIL PROTECTED]
Signed-off-by: Arnd Bergmann [EMAIL PROTECTED]

 drivers/mtd/maps/Kconfig|   57 
 drivers/mtd/maps/Makefile   |6 -
 drivers/mtd/maps/mbx860.c   |  100 -
 drivers/mtd/maps/ocotea.c   |  154 -
 drivers/mtd/maps/redwood.c  |  176 ---
 drivers/mtd/maps/rpxlite.c  |   66 -
 drivers/mtd/maps/tqm8xxl.c  |  261 ---
 drivers/mtd/maps/wr_sbc82xx_flash.c |  180 
 8 files changed, 0 insertions(+), 1000 deletions(-)

commit 41f911f000f3935ba85adb571cb9eb54ee9bed68
Author: Arnd Bergmann [EMAIL PROTECTED]
Date:   Tue Jun 10 15:45:11 2008 +0200

powerpc: remove references to dead platforms

The SPRUCE, LOPEC, SANDPOINT, PPC_GEN550 and PPLUS Kconfig
symbols were only defined for platforms in arch/ppc that are
no longer there with arch/powerpc. All compile time
switches based on these symbols can now be removed.

Cc: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Cc: Vitaly Bordug [EMAIL PROTECTED]
Signed-off-by: Arnd Bergmann [EMAIL PROTECTED]

 arch/powerpc/Kconfig  |4 -
 arch/powerpc/Kconfig.debug|2 +-
 drivers/ide/pci/sl82c105.c|4 -
 drivers/input/serio/i8042-ppcio.h |   75 
 drivers/net/Kconfig   |3 +-
 drivers/net/fec.c |   35 +-
 drivers/net/smc91x.h  |   37 +--
 drivers/pcmcia/m8xx_pcmcia.c  |  136 -
 include/asm-powerpc/ide.h |   12 ---
 9 files changed, 4 insertions(+), 304 deletions(-)

commit d790ca4b21f14ee1943d9193808f3b8a980b650e
Author: Arnd Bergmann [EMAIL PROTECTED]
Date:   Tue Jun 10 15:32:56 2008 +0200

powerpc: remove hdpu drivers

The CONFIG_HDPU option is gone with the removal of arch/ppc,
so the drivers have become dead code that can be removed.

Signed-off-by: Arnd Bergmann [EMAIL PROTECTED]

 drivers/misc/Makefile |1 -
 drivers/misc/hdpuftrs/Makefile|1 -
 drivers/misc/hdpuftrs/hdpu_cpustate.c |  249 -
 drivers/misc/hdpuftrs/hdpu_nexus.c|  150 
 4 files changed, 0 insertions(+), 401 deletions(-)

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 1/2][FOR 2.6.26][POWERPC] Fix bootwrapper builds with newer gcc versions

2008-06-12 Thread Kumar Gala
GCC 4.4.x looks to be adding support for generating out-of-line register
saves/restores based on:

http://gcc.gnu.org/ml/gcc-patches/2008-04/msg01678.html

This breaks the bootwrapper as we'd need to link with libgcc to get the
implementation of the register save/restores.

To workaround this issue, we just stole the save/restore code from gcc
and simplified it down for our needs (integer only).

Signed-off-by: Kumar Gala [EMAIL PROTECTED]
---

Paul, now that we have Sam's commit:

kbuild: ignore powerpc specific symbols in modpost

in Linus's tree can you pick these two patches up and send them upstream
for 2.6.26 (as well as my for-2.6.26 tree).

- k

 arch/powerpc/boot/Makefile|2 +-
 arch/powerpc/boot/crtsavres.S |  233 +
 2 files changed, 234 insertions(+), 1 deletions(-)
 create mode 100644 arch/powerpc/boot/crtsavres.S

diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
index d53b84e..1cee2f9 100644
--- a/arch/powerpc/boot/Makefile
+++ b/arch/powerpc/boot/Makefile
@@ -51,7 +51,7 @@ $(addprefix $(obj)/,$(zlib) gunzip_util.o main.o): \
$(addprefix $(obj)/,$(zliblinuxheader)) $(addprefix 
$(obj)/,$(zlibheader))

 src-libfdt := fdt.c fdt_ro.c fdt_wip.c fdt_sw.c fdt_rw.c fdt_strerror.c
-src-wlib := string.S crt0.S stdio.c main.c \
+src-wlib := string.S crt0.S crtsavres.S stdio.c main.c \
$(addprefix libfdt/,$(src-libfdt)) libfdt-wrapper.c \
ns16550.c serial.c simple_alloc.c div64.S util.S \
gunzip_util.c elf_util.c $(zlib) devtree.c oflib.c ofconsole.c \
diff --git a/arch/powerpc/boot/crtsavres.S b/arch/powerpc/boot/crtsavres.S
new file mode 100644
index 000..f3d9b35
--- /dev/null
+++ b/arch/powerpc/boot/crtsavres.S
@@ -0,0 +1,233 @@
+/*
+ * Special support for eabi and SVR4
+ *
+ *   Copyright (C) 1995, 1996, 1998, 2000, 2001 Free Software Foundation, Inc.
+ *   Copyright 2008 Freescale Semiconductor, Inc.
+ *   Written By Michael Meissner
+ *
+ * Based on gcc/config/rs6000/crtsavres.asm from gcc
+ *
+ * This file is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2, or (at your option) any
+ * later version.
+ *
+ * In addition to the permissions in the GNU General Public License, the
+ * Free Software Foundation gives you unlimited permission to link the
+ * compiled version of this file with other programs, and to distribute
+ * those programs without any restriction coming from the use of this
+ * file.  (The General Public License restrictions do apply in other
+ * respects; for example, they cover modification of the file, and
+ * distribution when not linked into another program.)
+ *
+ * This file is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; see the file COPYING.  If not, write to
+ * the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ *As a special exception, if you link this library with files
+ *compiled with GCC to produce an executable, this does not cause
+ *the resulting executable to be covered by the GNU General Public License.
+ *This exception does not however invalidate any other reasons why
+ *the executable file might be covered by the GNU General Public License.
+ */
+
+   .file   crtsavres.S
+   .section .text
+
+/* On PowerPC64 Linux, these functions are provided by the linker.  */
+#ifndef __powerpc64__
+
+#define _GLOBAL(name) \
+   .type name,@function; \
+   .globl name; \
+name:
+
+/* Routines for saving integer registers, called by the compiler.  */
+/* Called with r11 pointing to the stack header word of the caller of the */
+/* function, just beyond the end of the integer save area.  */
+
+_GLOBAL(_savegpr_14)
+_GLOBAL(_save32gpr_14)
+   stw 14,-72(11)  /* save gp registers */
+_GLOBAL(_savegpr_15)
+_GLOBAL(_save32gpr_15)
+   stw 15,-68(11)
+_GLOBAL(_savegpr_16)
+_GLOBAL(_save32gpr_16)
+   stw 16,-64(11)
+_GLOBAL(_savegpr_17)
+_GLOBAL(_save32gpr_17)
+   stw 17,-60(11)
+_GLOBAL(_savegpr_18)
+_GLOBAL(_save32gpr_18)
+   stw 18,-56(11)
+_GLOBAL(_savegpr_19)
+_GLOBAL(_save32gpr_19)
+   stw 19,-52(11)
+_GLOBAL(_savegpr_20)
+_GLOBAL(_save32gpr_20)
+   stw 20,-48(11)
+_GLOBAL(_savegpr_21)
+_GLOBAL(_save32gpr_21)
+   stw 21,-44(11)
+_GLOBAL(_savegpr_22)
+_GLOBAL(_save32gpr_22)
+   stw 22,-40(11)
+_GLOBAL(_savegpr_23)
+_GLOBAL(_save32gpr_23)
+   stw 23,-36(11)
+_GLOBAL(_savegpr_24)
+_GLOBAL(_save32gpr_24)
+   stw 24,-32(11)
+_GLOBAL(_savegpr_25)
+_GLOBAL(_save32gpr_25)
+

[PATCH 2/2][FOR 2.6.26][POWERPC] Fix -Os kernel builds with newer gcc versions

2008-06-12 Thread Kumar Gala
GCC 4.4.x looks to be adding support for generating out-of-line register
saves/restores based on:

http://gcc.gnu.org/ml/gcc-patches/2008-04/msg01678.html

This breaks the kernel if we enable CONFIG_CC_OPTIMIZE_FOR_SIZE.  To fix
this we add the use the save/restore code from gcc and simplified it down
for our needs (integer only).

Additionally, we have to link this code into each module.  The other
solution was to add EXPORT_SYMBOL() which meant going through the
trampoline which seemed nonsensical for these out-of-line routines.

Finally, we add some checks to prom_init_check.sh to ignore the
out-of-line save/restore functions.

Signed-off-by: Kumar Gala [EMAIL PROTECTED]
---
 arch/powerpc/Makefile  |2 +
 arch/powerpc/kernel/prom_init_check.sh |   14 ++
 arch/powerpc/lib/Makefile  |2 +-
 arch/powerpc/lib/crtsavres.S   |  229 
 4 files changed, 246 insertions(+), 1 deletions(-)
 create mode 100644 arch/powerpc/lib/crtsavres.S

diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
index 9dcdc03..d3779a8 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -96,6 +96,8 @@ endif
 else
KBUILD_CFLAGS += $(call cc-option,-mtune=power4)
 endif
+else
+LDFLAGS_MODULE += arch/powerpc/lib/crtsavres.o
 endif

 ifeq ($(CONFIG_TUNE_CELL),y)
diff --git a/arch/powerpc/kernel/prom_init_check.sh 
b/arch/powerpc/kernel/prom_init_check.sh
index 31729a9..2c7e8e8 100644
--- a/arch/powerpc/kernel/prom_init_check.sh
+++ b/arch/powerpc/kernel/prom_init_check.sh
@@ -48,6 +48,20 @@ do
fi
done

+   # ignore register save/restore funcitons
+   if [ ${UNDEF:0:9} = _restgpr_ ]; then
+   OK=1
+   fi
+   if [ ${UNDEF:0:11} = _rest32gpr_ ]; then
+   OK=1
+   fi
+   if [ ${UNDEF:0:9} = _savegpr_ ]; then
+   OK=1
+   fi
+   if [ ${UNDEF:0:11} = _save32gpr_ ]; then
+   OK=1
+   fi
+
if [ $OK -eq 0 ]; then
ERROR=1
echo Error: External symbol '$UNDEF' referenced \
diff --git a/arch/powerpc/lib/Makefile b/arch/powerpc/lib/Makefile
index c71d37d..e522b06 100644
--- a/arch/powerpc/lib/Makefile
+++ b/arch/powerpc/lib/Makefile
@@ -9,7 +9,7 @@ endif
 ifeq ($(CONFIG_PPC_MERGE),y)
 obj-y  := string.o alloc.o \
   checksum_$(CONFIG_WORD_SIZE).o
-obj-$(CONFIG_PPC32)+= div64.o copy_32.o
+obj-$(CONFIG_PPC32)+= div64.o copy_32.o crtsavres.o
 obj-$(CONFIG_HAS_IOMEM)+= devres.o
 endif

diff --git a/arch/powerpc/lib/crtsavres.S b/arch/powerpc/lib/crtsavres.S
new file mode 100644
index 000..70a9cd8
--- /dev/null
+++ b/arch/powerpc/lib/crtsavres.S
@@ -0,0 +1,229 @@
+/*
+ * Special support for eabi and SVR4
+ *
+ *   Copyright (C) 1995, 1996, 1998, 2000, 2001 Free Software Foundation, Inc.
+ *   Copyright 2008 Freescale Semiconductor, Inc.
+ *   Written By Michael Meissner
+ *
+ * Based on gcc/config/rs6000/crtsavres.asm from gcc
+ *
+ * This file is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2, or (at your option) any
+ * later version.
+ *
+ * In addition to the permissions in the GNU General Public License, the
+ * Free Software Foundation gives you unlimited permission to link the
+ * compiled version of this file with other programs, and to distribute
+ * those programs without any restriction coming from the use of this
+ * file.  (The General Public License restrictions do apply in other
+ * respects; for example, they cover modification of the file, and
+ * distribution when not linked into another program.)
+ *
+ * This file is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; see the file COPYING.  If not, write to
+ * the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ *As a special exception, if you link this library with files
+ *compiled with GCC to produce an executable, this does not cause
+ *the resulting executable to be covered by the GNU General Public License.
+ *This exception does not however invalidate any other reasons why
+ *the executable file might be covered by the GNU General Public License.
+ */
+
+#include asm/ppc_asm.h
+
+   .file   crtsavres.S
+   .section .text
+
+#ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
+
+/* Routines for saving integer registers, called by the compiler.  */
+/* Called with r11 pointing to the stack header word of the caller of the */
+/* function, just beyond the end of the integer save area.  */
+
+_GLOBAL(_savegpr_14)

[PATCH 00/19] powerpc: pSeries Cooperative Memory Overcommitment support

2008-06-12 Thread Robert Jennings
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-rc5 and has been tested
at that level.

Regards,
Robert Jennings
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 01/19] powerpc: Remove extraneous error reporting for hcall failures in lparcfg

2008-06-12 Thread Robert Jennings
From: Nathan Fontenot [EMAIL PROTECTED]

Remove the extraneous error reporting used when a hcall made from lparcfg fails.

Signed-off-by: Nathan Fontenot [EMAIL PROTECTED]

---
 arch/powerpc/kernel/lparcfg.c |   32 
 1 file changed, 32 deletions(-)

Index: b/arch/powerpc/kernel/lparcfg.c
===
--- 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 = retbuf[2];
*resource = retbuf[3];
 
-   log_plpar_hcall_return(rc, H_GET_PPP);
-
return rc;
 }
 
@@ -205,9 +176,6 @@ static void h_pic(unsigned long *pool_id
 
*pool_idle_time = retbuf[0];
*num_procs = retbuf[1];
-
-   if (rc != H_AUTHORITY)
-   log_plpar_hcall_return(rc, H_PIC);
 }
 
 #define SPLPAR_CHARACTERISTICS_TOKEN 20
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 02/19] powerpc: Split processor entitlement retrieval and gathering to helper routines

2008-06-12 Thread Robert Jennings
From: Nathan Fotenot [EMAIL PROTECTED]

Split the retreival and setting of processor entitlement and weight into
helper routines.

Signed-off-by: Nathan Fotenot [EMAIL PROTECTED]

---
 arch/powerpc/kernel/lparcfg.c |  163 ++
 1 file changed, 86 insertions(+), 77 deletions(-)

Index: b/arch/powerpc/kernel/lparcfg.c
===
--- 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;
 }
 
-static void h_pic(unsigned long *pool_idle_time, unsigned long *num_procs)
+static unsigned int h_pic(unsigned long *pool_idle_time,
+ unsigned long *num_procs)
 {
unsigned long rc;
unsigned long retbuf[PLPAR_HCALL_BUFSIZE];
@@ -176,6 +177,53 @@ static void h_pic(unsigned long *pool_id
 
*pool_idle_time = retbuf[0];
*num_procs = 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 = h_get_ppp(h_entitled, h_unallocated, h_aggregation,
+  h_resource);
+   if (rc)
+   return;
+
+   seq_printf(m, partition_entitled_capacity=%ld\n, h_entitled);
+   seq_printf(m, group=%ld\n, (h_aggregation  2 * 8)  0x);
+   seq_printf(m, system_active_processors=%ld\n,
+  (h_resource  0 * 8)  0x);
+
+   /* pool related entries are apropriate for shared configs */
+   if (lppaca[0].shared_proc) {
+   unsigned long pool_idle_time, pool_procs;
+
+   seq_printf(m, pool=%ld\n, (h_aggregation  0 * 8)  0x);
+
+   /* report pool_capacity in percentage */
+   seq_printf(m, pool_capacity=%ld\n,
+  ((h_resource  2 * 8)  0x) * 100);
+
+   rc = h_pic(pool_idle_time, pool_procs);
+   if (! rc) {
+   seq_printf(m, pool_idle_time=%ld\n, pool_idle_time);
+   seq_printf(m, pool_num_procs=%ld\n, pool_procs);
+   }
+   }
+
+   seq_printf(m, unallocated_capacity_weight=%ld\n,
+  (h_resource  4 * 8)  0xFF);
+
+   seq_printf(m, capacity_weight=%ld\n, (h_resource  5 * 8)  0xFF);
+   seq_printf(m, capped=%ld\n, (h_resource  6 * 8)  0x01);
+   seq_printf(m, unallocated_capacity=%ld\n, h_unallocated);
 }
 
 #define SPLPAR_CHARACTERISTICS_TOKEN 20
@@ -302,59 +350,11 @@ static int pseries_lparcfg_data(struct s
partition_active_processors = lparcfg_count_active_processors();
 
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=0x%lx\n, h_entitled);
-   seq_printf(m, R5=0x%lx\n, h_unallocated);
-   seq_printf(m, R6=0x%lx\n, h_aggregation);
-   seq_printf(m, R7=0x%lx\n, h_resource);
-
-   purr = get_purr();
-
/* this call handles the ibm,get-system-parameter contents */
parse_system_parameter_string(m);
+   parse_ppp_data(m);
 
-   seq_printf(m, partition_entitled_capacity=%ld\n, h_entitled);
-
-   seq_printf(m, group=%ld\n, (h_aggregation  2 * 8)  0x);
-
-   seq_printf(m, system_active_processors=%ld\n,
-  (h_resource  0 * 8)  0x);
-
-   /* pool related entries are apropriate for shared configs */
-   if (lppaca[0].shared_proc) {
-
-   h_pic(pool_idle_time, pool_procs);
-
-   seq_printf(m, pool=%ld\n,
-  (h_aggregation  0 * 8)  0x);
-
-   /* report pool_capacity in percentage */
-   seq_printf(m, pool_capacity=%ld\n,
-  ((h_resource  2 * 8)  0x) * 100);
-
-   seq_printf(m, pool_idle_time=%ld\n, pool_idle_time);
-
-   seq_printf(m, pool_num_procs=%ld\n, pool_procs);
-   }
-
-   seq_printf(m, unallocated_capacity_weight=%ld\n,
-  (h_resource  4 * 8)  0xFF);
-
-   seq_printf(m, capacity_weight=%ld\n,
-  (h_resource  5 * 8)  0xFF);
-
-   seq_printf(m, capped=%ld\n, (h_resource  6 * 8)  0x01);
-
-   seq_printf(m, unallocated_capacity=%ld\n, h_unallocated);
-
-   seq_printf(m, 

[PATCH 03/19] powerpc: Add memory entitlement capabilities to /proc/ppc64/lparcfg

2008-06-12 Thread Robert Jennings
From: Nathan Fontenot [EMAIL PROTECTED]

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 [EMAIL PROTECTED]

---
 arch/powerpc/kernel/lparcfg.c |  139 +++---
 include/asm-powerpc/hvcall.h  |   18 +
 2 files changed, 147 insertions(+), 10 deletions(-)

Index: b/arch/powerpc/kernel/lparcfg.c
===
--- a/arch/powerpc/kernel/lparcfg.c
+++ b/arch/powerpc/kernel/lparcfg.c
@@ -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_HCALL_BUFSIZE];
+
+   rc = plpar_hcall(H_GET_MPP, retbuf);
+
+   mpp_data-entitled_mem = retbuf[0];
+   mpp_data-mapped_mem = retbuf[1];
+
+   mpp_data-group_num = (retbuf[2]  2 * 8)  0x;
+   mpp_data-pool_num = retbuf[2]  0x;
+
+   mpp_data-mem_weight = (retbuf[3]  7 * 8)  0xff;
+   mpp_data-unallocated_mem_weight = (retbuf[3]  6 * 8)  0xff;
+   mpp_data-unallocated_entitlement = retbuf[3]  0x;
+
+   mpp_data-pool_size = retbuf[4];
+   mpp_data-loan_request = retbuf[5];
+   mpp_data-backing_mem = retbuf[6];
+
+   return rc;
+}
+EXPORT_SYMBOL(h_get_mpp);
+
 /*
  * H_GET_PPP hcall returns info in 4 parms.
  *  entitled_capacity,unallocated_capacity,
@@ -226,6 +255,44 @@ static void parse_ppp_data(struct seq_fi
seq_printf(m, unallocated_capacity=%ld\n, h_unallocated);
 }
 
+/**
+ * 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 = h_get_mpp(mpp_data);
+   if (rc)
+   return;
+
+   seq_printf(m, entitled_memory=%ld\n, mpp_data.entitled_mem);
+
+   if (mpp_data.mapped_mem != -1)
+   seq_printf(m, mapped_entitled_memory=%ld\n,
+  mpp_data.mapped_mem);
+
+   seq_printf(m, entitled_memory_group_number=%d\n, mpp_data.group_num);
+   seq_printf(m, entitled_memory_pool_number=%d\n, mpp_data.pool_num);
+
+   seq_printf(m, entitled_memory_weight=%d\n, mpp_data.mem_weight);
+   seq_printf(m, unallocated_entitled_memory_weight=%d\n,
+  mpp_data.unallocated_mem_weight);
+   seq_printf(m, unallocated_io_mapping_entitlement=%ld\n,
+  mpp_data.unallocated_entitlement);
+
+   if (mpp_data.pool_size != -1)
+   seq_printf(m, entitled_memory_pool_size=%ld bytes\n,
+  mpp_data.pool_size);
+
+   seq_printf(m, entitled_memory_loan_request=%ld\n,
+  mpp_data.loan_request);
+
+   seq_printf(m, backing_memory=%ld bytes\n, mpp_data.backing_mem);
+}
+
 #define SPLPAR_CHARACTERISTICS_TOKEN 20
 #define SPLPAR_MAXLENGTH 1026*(sizeof(char))
 
@@ -353,6 +420,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);
 
seq_printf(m, purr=%ld\n, get_purr());
 
@@ -382,12 +450,13 @@ static int pseries_lparcfg_data(struct s
return 0;
 }
 
-static ssize_t update_ppp(u64 *new_entitled, u8 *new_weight)
+static ssize_t update_ppp(u64 *entitlement, u8 *weight)
 {
unsigned long current_entitled;
unsigned long dummy;
unsigned long resource;
-   u8 current_weight;
+   u8 current_weight, new_weight;
+   u64 new_entitled;
ssize_t retval;
 
/* Get our current parameters */
@@ -397,22 +466,60 @@ static ssize_t update_ppp(u64 *new_entit
 
current_weight = (resource  5 * 8)  0xFF;
 
-   if (new_entitled)
-   *new_weight = current_weight;
-
-   if (new_weight)
-   *new_entitled = current_entitled;
+   if (entitlement) {
+   new_weight = current_weight;
+   new_entitled = *entitlement;
+   } else {
+   new_weight = *weight;
+   new_entitled = current_entitled;
+   }
 
pr_debug(%s: current_entitled = %lu, current_weight = %u\n,
 __FUNCTION__, current_entitled, current_weight);
 
pr_debug(%s: new_entitled = %lu, new_weight = %u\n,
-__FUNCTION__, *new_entitled, *new_weight);
+__FUNCTION__, new_entitled, new_weight);
 
-   retval = plpar_hcall_norets(H_SET_PPP, *new_entitled, *new_weight);
+   retval = plpar_hcall_norets(H_SET_PPP, new_entitled, new_weight);
return retval;
 }
 

[PATCH 04/19] powerpc: Split retrieval of processor entitlement data into a helper routine

2008-06-12 Thread Robert Jennings
From: Nathan Fontenot [EMAIL PROTECTED]

Split the retrieval of processor entitlement data returned in the H_GET_PPP
hcall into its own helper routine.

Signed-off-by: Nathan Fontenot [EMAIL PROTECTED]

---
 arch/powerpc/kernel/lparcfg.c |   80 --
 1 file changed, 45 insertions(+), 35 deletions(-)

Index: b/arch/powerpc/kernel/lparcfg.c
===
--- a/arch/powerpc/kernel/lparcfg.c
+++ b/arch/powerpc/kernel/lparcfg.c
@@ -158,6 +158,18 @@ int h_get_mpp(struct hvcall_mpp_data *mp
 }
 EXPORT_SYMBOL(h_get_mpp);
 
+struct hvcall_ppp_data {
+   u64 entitlement;
+   u64 unallocated_entitlement;
+   u16 group_num;
+   u16 pool_num;
+   u8  capped;
+   u8  weight;
+   u8  unallocated_weight;
+   u16 active_procs_in_pool;
+   u16 active_system_procs;
+};
+
 /*
  * H_GET_PPP hcall returns info in 4 parms.
  *  entitled_capacity,unallocated_capacity,
@@ -178,20 +190,24 @@ EXPORT_SYMBOL(h_get_mpp);
  *   - Active processors in Physical Processor Pool.
  *    - Processors active on platform.
  */
-static unsigned int h_get_ppp(unsigned long *entitled,
- unsigned long *unallocated,
- unsigned long *aggregation,
- unsigned long *resource)
+static unsigned int h_get_ppp(struct hvcall_ppp_data *ppp_data)
 {
unsigned long rc;
unsigned long retbuf[PLPAR_HCALL_BUFSIZE];
 
rc = plpar_hcall(H_GET_PPP, retbuf);
 
-   *entitled = retbuf[0];
-   *unallocated = retbuf[1];
-   *aggregation = retbuf[2];
-   *resource = retbuf[3];
+   ppp_data-entitlement = retbuf[0];
+   ppp_data-unallocated_entitlement = retbuf[1];
+
+   ppp_data-group_num = (retbuf[2]  2 * 8)  0x;
+   ppp_data-pool_num = retbuf[2]  0x;
+
+   ppp_data-capped = (retbuf[3]  6 * 8)  0x01;
+   ppp_data-weight = (retbuf[3]  5 * 8)  0xff;
+   ppp_data-unallocated_weight = (retbuf[3]  4 * 8)  0xff;
+   ppp_data-active_procs_in_pool = (retbuf[3]  2 * 8)  0x;
+   ppp_data-active_system_procs = retbuf[3]  0x;
 
return rc;
 }
@@ -216,29 +232,27 @@ static unsigned int h_pic(unsigned long 
  */
 static void parse_ppp_data(struct seq_file *m)
 {
-   unsigned long h_entitled, h_unallocated;
-   unsigned long h_aggregation, h_resource;
+   struct hvcall_ppp_data ppp_data;
int rc;
 
-   rc = h_get_ppp(h_entitled, h_unallocated, h_aggregation,
-  h_resource);
+   rc = h_get_ppp(ppp_data);
if (rc)
return;
 
-   seq_printf(m, partition_entitled_capacity=%ld\n, h_entitled);
-   seq_printf(m, group=%ld\n, (h_aggregation  2 * 8)  0x);
-   seq_printf(m, system_active_processors=%ld\n,
-  (h_resource  0 * 8)  0x);
+   seq_printf(m, partition_entitled_capacity=%ld\n,
+  ppp_data.entitlement);
+   seq_printf(m, group=%d\n, ppp_data.group_num);
+   seq_printf(m, system_active_processors=%d\n,
+  ppp_data.active_system_procs);
 
/* pool related entries are apropriate for shared configs */
if (lppaca[0].shared_proc) {
unsigned long pool_idle_time, pool_procs;
 
-   seq_printf(m, pool=%ld\n, (h_aggregation  0 * 8)  0x);
+   seq_printf(m, pool=%d\n, ppp_data.pool_num);
 
/* report pool_capacity in percentage */
-   seq_printf(m, pool_capacity=%ld\n,
-  ((h_resource  2 * 8)  0x) * 100);
+   seq_printf(m, pool_capacity=%d\n, ppp_data.group_num * 100);
 
rc = h_pic(pool_idle_time, pool_procs);
if (! rc) {
@@ -247,12 +261,12 @@ static void parse_ppp_data(struct seq_fi
}
}
 
-   seq_printf(m, unallocated_capacity_weight=%ld\n,
-  (h_resource  4 * 8)  0xFF);
-
-   seq_printf(m, capacity_weight=%ld\n, (h_resource  5 * 8)  0xFF);
-   seq_printf(m, capped=%ld\n, (h_resource  6 * 8)  0x01);
-   seq_printf(m, unallocated_capacity=%ld\n, h_unallocated);
+   seq_printf(m, unallocated_capacity_weight=%d\n,
+  ppp_data.unallocated_weight);
+   seq_printf(m, capacity_weight=%d\n, ppp_data.weight);
+   seq_printf(m, capped=%d\n, ppp_data.capped);
+   seq_printf(m, unallocated_capacity=%ld\n,
+  ppp_data.unallocated_entitlement);
 }
 
 /**
@@ -452,30 +466,26 @@ static int pseries_lparcfg_data(struct s
 
 static ssize_t update_ppp(u64 *entitlement, u8 *weight)
 {
-   unsigned long current_entitled;
-   unsigned long dummy;
-   unsigned long resource;
-   u8 current_weight, new_weight;
+   struct hvcall_ppp_data ppp_data;
+   u8 new_weight;
u64 new_entitled;
ssize_t retval;
 
/* 

[PATCH 05/19] powerpc: Enable CMO feature during platform setup

2008-06-12 Thread Robert Jennings
From: Robert Jennings [EMAIL PROTECTED]

For Cooperative Memory Overcommitment (CMO), set the FW_FEATURE_CMO
flag in powerpc_firmware_features from the rtas ibm,get-system-parameters
table prior to calling iommu_init_early_pSeries.

With this, any CMO specific functionality can be controlled by checking:
 firmware_has_feature(FW_FEATURE_CMO)

Signed-off-by: Robert Jennings [EMAIL PROTECTED]

---
 arch/powerpc/platforms/pseries/setup.c |   71 +
 include/asm-powerpc/firmware.h |3 +
 2 files changed, 73 insertions(+), 1 deletion(-)

Index: b/arch/powerpc/platforms/pseries/setup.c
===
--- a/arch/powerpc/platforms/pseries/setup.c
+++ b/arch/powerpc/platforms/pseries/setup.c
@@ -314,6 +314,76 @@ static int pseries_set_xdabr(unsigned lo
H_DABRX_KERNEL | H_DABRX_USER);
 }
 
+#define CMO_CHARACTERISTICS_TOKEN 44
+#define CMO_MAXLENGTH 1026
+
+/**
+ * fw_cmo_feature_init - FW_FEATURE_CMO is not stored in 
ibm,hypertas-functions,
+ * handle that here. (Stolen from parse_system_parameter_string)
+ */
+void pSeries_cmo_feature_init(void)
+{
+   char *ptr, *key, *value, *end;
+   int call_status;
+   int PrPSP = -1;
+   int SecPSP = -1;
+
+   pr_debug( - fw_cmo_feature_init()\n);
+   spin_lock(rtas_data_buf_lock);
+   memset(rtas_data_buf, 0, RTAS_DATA_BUF_SIZE);
+   call_status = rtas_call(rtas_token(ibm,get-system-parameter), 3, 1,
+   NULL,
+   CMO_CHARACTERISTICS_TOKEN,
+   __pa(rtas_data_buf),
+   RTAS_DATA_BUF_SIZE);
+
+   if (call_status != 0) {
+   spin_unlock(rtas_data_buf_lock);
+   pr_debug(CMO not available\n);
+   pr_debug( - fw_cmo_feature_init()\n);
+   return;
+   }
+
+   end = rtas_data_buf + CMO_MAXLENGTH - 2;
+   ptr = rtas_data_buf + 2;/* step over strlen value */
+   key = value = ptr;
+
+   while (*ptr  (ptr = end)) {
+   /* Separate the key and value by replacing '=' with '\0' and
+* point the value at the string after the '='
+*/
+   if (ptr[0] == '=') {
+   ptr[0] = '\0';
+   value = ptr + 1;
+   } else if (ptr[0] == '\0' || ptr[0] == ',') {
+   /* Terminate the string containing the key/value pair */
+   ptr[0] = '\0';
+
+   if (key == value) {
+   pr_debug(Malformed key/value pair\n);
+   /* Never found a '=', end processing */
+   break;
+   }
+
+   if (0 == strcmp(key, PrPSP))
+   PrPSP = simple_strtoul(value, NULL, 10);
+   else if (0 == strcmp(key, SecPSP))
+   SecPSP = simple_strtoul(value, NULL, 10);
+   value = key = ptr + 1;
+   }
+   ptr++;
+   }
+
+   if (PrPSP != -1 || SecPSP != -1) {
+   pr_info(CMO enabled\n);
+   pr_debug(CMO enabled, PrPSP=%d, SecPSP=%d\n, PrPSP, SecPSP);
+   powerpc_firmware_features |= FW_FEATURE_CMO;
+   } else
+   pr_debug(CMO not enabled, PrPSP=%d, SecPSP=%d\n, PrPSP, 
SecPSP);
+   spin_unlock(rtas_data_buf_lock);
+   pr_debug( - fw_cmo_feature_init()\n);
+}
+
 /*
  * Early initialization.  Relocation is on but do not reference unbolted pages
  */
@@ -329,6 +399,7 @@ static void __init pSeries_init_early(vo
else if (firmware_has_feature(FW_FEATURE_XDABR))
ppc_md.set_dabr = pseries_set_xdabr;
 
+   pSeries_cmo_feature_init();
iommu_init_early_pSeries();
 
pr_debug( - pSeries_init_early()\n);
Index: b/include/asm-powerpc/firmware.h
===
--- a/include/asm-powerpc/firmware.h
+++ b/include/asm-powerpc/firmware.h
@@ -45,6 +45,7 @@
 #define FW_FEATURE_PS3_LV1 ASM_CONST(0x0080)
 #define FW_FEATURE_BEATASM_CONST(0x0100)
 #define FW_FEATURE_BULK_REMOVE ASM_CONST(0x0200)
+#define FW_FEATURE_CMO ASM_CONST(0x0400)
 
 #ifndef __ASSEMBLY__
 
@@ -57,7 +58,7 @@ enum {
FW_FEATURE_MIGRATE | FW_FEATURE_PERFMON | FW_FEATURE_CRQ |
FW_FEATURE_VIO | FW_FEATURE_RDMA | FW_FEATURE_LLAN |
FW_FEATURE_BULK | FW_FEATURE_XDABR | FW_FEATURE_MULTITCE |
-   FW_FEATURE_SPLPAR | FW_FEATURE_LPAR,
+   FW_FEATURE_SPLPAR | FW_FEATURE_LPAR | FW_FEATURE_CMO,
FW_FEATURE_PSERIES_ALWAYS = 0,
FW_FEATURE_ISERIES_POSSIBLE = FW_FEATURE_ISERIES | FW_FEATURE_LPAR,
FW_FEATURE_ISERIES_ALWAYS = FW_FEATURE_ISERIES | 

[PATCH 06/19] powerpc: Utilities to set firmware page state

2008-06-12 Thread Robert Jennings
From: Brian King [EMAIL PROTECTED]

Newer versions of firmware support page states, which are used by the
collaborative memory manager (future patch) to loan pages to the
hypervisor for use by other partitions.

Signed-off-by: Brian King [EMAIL PROTECTED]

---

 arch/powerpc/platforms/pseries/plpar_wrappers.h |   10 ++
 include/asm-powerpc/hvcall.h|5 +
 2 files changed, 15 insertions(+)

Index: b/arch/powerpc/platforms/pseries/plpar_wrappers.h
===
--- a/arch/powerpc/platforms/pseries/plpar_wrappers.h
+++ b/arch/powerpc/platforms/pseries/plpar_wrappers.h
@@ -42,6 +42,16 @@ static inline long register_slb_shadow(u
return vpa_call(0x3, cpu, vpa);
 }
 
+static inline long plpar_page_set_loaned(unsigned long vpa)
+{
+   return plpar_hcall_norets(H_PAGE_INIT, H_PAGE_SET_LOANED, vpa, 0);
+}
+
+static inline long plpar_page_set_active(unsigned long vpa)
+{
+   return plpar_hcall_norets(H_PAGE_INIT, H_PAGE_SET_ACTIVE, vpa, 0);
+}
+
 extern void vpa_init(int cpu);
 
 static inline long plpar_pte_enter(unsigned long flags,
Index: b/include/asm-powerpc/hvcall.h
===
--- a/include/asm-powerpc/hvcall.h
+++ b/include/asm-powerpc/hvcall.h
@@ -92,6 +92,11 @@
 #define H_EXACT(1UL(63-24))  /* Use exact PTE or 
return H_PTEG_FULL */
 #define H_R_XLATE  (1UL(63-25))  /* include a valid logical page 
num in the pte if the valid bit is set */
 #define H_READ_4   (1UL(63-26))  /* Return 4 PTEs */
+#define H_PAGE_STATE_CHANGE(1UL(63-28))
+#define H_PAGE_UNUSED  ((1UL(63-29)) | (1UL(63-30)))
+#define H_PAGE_SET_UNUSED  (H_PAGE_STATE_CHANGE | H_PAGE_UNUSED)
+#define H_PAGE_SET_LOANED  (H_PAGE_SET_UNUSED | (1UL(63-31)))
+#define H_PAGE_SET_ACTIVE  H_PAGE_STATE_CHANGE
 #define H_AVPN (1UL(63-32))  /* An avpn is provided as a 
sanity test */
 #define H_ANDCOND  (1UL(63-33))
 #define H_ICACHE_INVALIDATE(1UL(63-40))  /* icbi, etc.  (ignored for IO 
pages) */
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 07/19] powerpc: Add collaborative memory manager

2008-06-12 Thread Robert Jennings
From: Brian King [EMAIL PROTECTED]

Adds a collaborative memory manager, which acts as a simple balloon driver
for System p machines that support cooperative memory overcommitment
(CMO).

Signed-off-by: Brian King [EMAIL PROTECTED]

---

 arch/powerpc/platforms/pseries/Kconfig  |   11 +
 arch/powerpc/platforms/pseries/Makefile |1 +
 arch/powerpc/platforms/pseries/cmm.c|  470 
 3 files changed, 482 insertions(+)

Index: b/arch/powerpc/platforms/pseries/Kconfig
===
--- a/arch/powerpc/platforms/pseries/Kconfig
+++ b/arch/powerpc/platforms/pseries/Kconfig
@@ -39,3 +39,14 @@ config PPC_PSERIES_DEBUG
depends on PPC_PSERIES  PPC_EARLY_DEBUG
bool Enable extra debug logging in platforms/pseries
default y
+
+config CMM
+   tristate Collaborative memory management
+   depends on PPC_PSERIES
+   help
+ Select this option, if you want to enable the kernel interface
+ to reduce the memory size of the system. This is accomplished
+ by allocating pages of memory and put them on hold. This only
+ makes sense for a system running in an LPAR where the unused pages
+ will be reused for other LPARs. The interface allows firmware to
+ balance memory across many LPARs.
Index: b/arch/powerpc/platforms/pseries/Makefile
===
--- a/arch/powerpc/platforms/pseries/Makefile
+++ b/arch/powerpc/platforms/pseries/Makefile
@@ -24,3 +24,4 @@ obj-$(CONFIG_HVC_CONSOLE) += hvconsole.o
 obj-$(CONFIG_HVCS) += hvcserver.o
 obj-$(CONFIG_HCALL_STATS)  += hvCall_inst.o
 obj-$(CONFIG_PHYP_DUMP)+= phyp_dump.o
+obj-$(CONFIG_CMM)  += cmm.o
Index: b/arch/powerpc/platforms/pseries/cmm.c
===
--- /dev/null
+++ b/arch/powerpc/platforms/pseries/cmm.c
@@ -0,0 +1,470 @@
+/*
+ * arch/powerpc/mm/cmm.c
+ *
+ * Collaborative memory management interface.
+ *
+ * Copyright (C) 2008 IBM Corporation
+ * Author(s): Brian King ([EMAIL PROTECTED]),
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ */
+
+#include linux/ctype.h
+#include linux/delay.h
+#include linux/errno.h
+#include linux/fs.h
+#include linux/init.h
+#include linux/kthread.h
+#include linux/module.h
+#include linux/oom.h
+#include linux/sched.h
+#include linux/stringify.h
+#include linux/swap.h
+#include linux/sysdev.h
+#include asm/firmware.h
+#include asm/hvcall.h
+#include asm/mmu.h
+#include asm/pgalloc.h
+#include asm/uaccess.h
+
+#include plpar_wrappers.h
+
+#define CMM_DRIVER_VERSION 1.0.0
+#define CMM_DEFAULT_DELAY  1
+#define CMM_DEBUG  0
+#define CMM_DISABLE0
+#define CMM_OOM_KB 1024
+#define CMM_MIN_MEM_MB 256
+#define KB2PAGES(_p)   ((_p)(PAGE_SHIFT-10))
+#define PAGES2KB(_p)   ((_p)(PAGE_SHIFT-10))
+
+static unsigned int delay = CMM_DEFAULT_DELAY;
+static unsigned int oom_kb = CMM_OOM_KB;
+static unsigned int cmm_debug = CMM_DEBUG;
+static unsigned int cmm_disabled = CMM_DISABLE;
+static unsigned long min_mem_mb = CMM_MIN_MEM_MB;
+static struct sys_device cmm_sysdev;
+
+MODULE_AUTHOR(Brian King [EMAIL PROTECTED]);
+MODULE_DESCRIPTION(IBM System p Collaborative Memory Manager);
+MODULE_LICENSE(GPL);
+MODULE_VERSION(CMM_DRIVER_VERSION);
+
+module_param_named(delay, delay, uint, S_IRUGO | S_IWUSR);
+MODULE_PARM_DESC(delay, Delay (in seconds) between polls to query hypervisor 
paging requests. 
+[Default= __stringify(CMM_DEFAULT_DELAY) ]);
+module_param_named(oom_kb, oom_kb, uint, S_IRUGO | S_IWUSR);
+MODULE_PARM_DESC(oom_kb, Amount of memory in kb to free on OOM. 
+[Default= __stringify(CMM_OOM_KB) ]);
+module_param_named(min_mem_mb, min_mem_mb, ulong, S_IRUGO | S_IWUSR);
+MODULE_PARM_DESC(min_mem_mb, Minimum amount of memory (in MB) to not balloon. 

+[Default= __stringify(CMM_MIN_MEM_MB) ]);
+module_param_named(debug, cmm_debug, uint, S_IRUGO | S_IWUSR);
+MODULE_PARM_DESC(debug, Enable module debugging logging. Set to 1 to enable. 
+[Default= __stringify(CMM_DEBUG) ]);
+
+#define CMM_NR_PAGES ((PAGE_SIZE - sizeof(void *) - 

[PATCH 08/19] powerpc: Do not probe PCI buses or eBus devices if CMO is enabled

2008-06-12 Thread Robert Jennings
From: Brian King [EMAIL PROTECTED]

The Cooperative Memory Overcommit (CMO) on System p does not currently
support native PCI devices or eBus devices when enabled. Prevent
PCI bus probe and eBus device probe if the feature is enabled.

Signed-off-by: Brian King [EMAIL PROTECTED]

---

 arch/powerpc/kernel/ibmebus.c  |6 ++
 arch/powerpc/platforms/pseries/setup.c |4 
 2 files changed, 10 insertions(+)

Index: b/arch/powerpc/kernel/ibmebus.c
===
--- a/arch/powerpc/kernel/ibmebus.c
+++ b/arch/powerpc/kernel/ibmebus.c
@@ -45,6 +45,7 @@
 #include linux/of_platform.h
 #include asm/ibmebus.h
 #include asm/abs_addr.h
+#include asm/firmware.h
 
 static struct device ibmebus_bus_device = { /* fake parent device */
.bus_id = ibmebus,
@@ -332,6 +333,11 @@ static int __init ibmebus_bus_init(void)
 {
int err;
 
+   if (firmware_has_feature(FW_FEATURE_CMO)) {
+   printk(KERN_WARNING Not probing eBus since CMO is enabled\n);
+   return 0;
+   }
+
printk(KERN_INFO IBM eBus Device Driver\n);
 
err = of_bus_type_init(ibmebus_bus_type, ibmebus);
Index: b/arch/powerpc/platforms/pseries/setup.c
===
--- a/arch/powerpc/platforms/pseries/setup.c
+++ b/arch/powerpc/platforms/pseries/setup.c
@@ -539,6 +539,10 @@ static void pseries_shared_idle_sleep(vo
 
 static int pSeries_pci_probe_mode(struct pci_bus *bus)
 {
+   if (firmware_has_feature(FW_FEATURE_CMO)) {
+   dev_warn(bus-dev, Not probing PCI bus since CMO is 
enabled\n);
+   return PCI_PROBE_NONE;
+   }
if (firmware_has_feature(FW_FEATURE_LPAR))
return PCI_PROBE_DEVTREE;
return PCI_PROBE_NORMAL;
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 09/19] powerpc: Add CMO paging statistics

2008-06-12 Thread Robert Jennings
From: Brian King [EMAIL PROTECTED]

With the addition of Cooperative Memory Overcommitment (CMO) support
for IBM Power Systems, two fields have been added to the VPA to report
paging statistics. Add support in lparcfg to report them to userspace.

Signed-off-by: Brian King [EMAIL PROTECTED]

---

 arch/powerpc/kernel/lparcfg.c |   20 
 include/asm-powerpc/lppaca.h  |5 -
 2 files changed, 24 insertions(+), 1 deletion(-)

Index: b/arch/powerpc/kernel/lparcfg.c
===
--- a/arch/powerpc/kernel/lparcfg.c
+++ b/arch/powerpc/kernel/lparcfg.c
@@ -410,6 +410,25 @@ static int lparcfg_count_active_processo
return count;
 }
 
+static void pseries_cmo_data(struct seq_file *m)
+{
+   int cpu;
+   unsigned long cmo_faults = 0;
+   unsigned long cmo_fault_time = 0;
+
+   if (!firmware_has_feature(FW_FEATURE_CMO))
+   return;
+
+   for_each_possible_cpu(cpu) {
+   cmo_faults += lppaca[cpu].cmo_faults;
+   cmo_fault_time += lppaca[cpu].cmo_fault_time;
+   }
+
+   seq_printf(m, cmo_faults=%lu\n, cmo_faults);
+   seq_printf(m, cmo_fault_time_usec=%lu\n,
+  cmo_fault_time / tb_ticks_per_usec);
+}
+
 static int pseries_lparcfg_data(struct seq_file *m, void *v)
 {
int partition_potential_processors;
@@ -435,6 +454,7 @@ static int pseries_lparcfg_data(struct s
parse_system_parameter_string(m);
parse_ppp_data(m);
parse_mpp_data(m);
+   pseries_cmo_data(m);
 
seq_printf(m, purr=%ld\n, get_purr());
 
Index: b/include/asm-powerpc/lppaca.h
===
--- a/include/asm-powerpc/lppaca.h
+++ b/include/asm-powerpc/lppaca.h
@@ -125,7 +125,10 @@ struct lppaca {
// NOTE: This value will ALWAYS be zero for dedicated processors and
// will NEVER be zero for shared processors (ie, initialized to a 1).
volatile u32 yield_count;   // PLIC increments each dispatchx00-x03
-   u8  reserved6[124]; // Reserved x04-x7F
+   u32 reserved6;
+   volatile u64 cmo_faults;// CMO page fault count x08-x0F
+   volatile u64 cmo_fault_time;// CMO page fault time  x10-x17
+   u8  reserved7[104]; // Reserved x18-x7F
 
 //=
 // CACHE_LINE_4-5 0x0180 - 0x027F Contains PMC interrupt data
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 10/19] [repost] powerpc: move get_longbusy_msecs out of ehca/ehea

2008-06-12 Thread Robert Jennings
From: Robert Jennings [EMAIL PROTECTED]

In support of Cooperative Memory Overcommitment (CMO) this moves
get_longbusy_msecs() out of the ehca and ehea drivers and into the 
architecture's hvcall header as plpar_get_longbusy_msecs.  Some firmware
calls made in pSeries platform iommu code will need to share this
functionality.

Signed-off-by: Robert Jennings [EMAIL PROTECTED]

---

I missed copying netdev on this patch the first time.

 drivers/infiniband/hw/ehca/hcp_if.c |   24 ++--
 drivers/net/ehea/ehea_phyp.c|4 ++--
 drivers/net/ehea/ehea_phyp.h|   20 
 include/asm-powerpc/hvcall.h|   27 +++
 4 files changed, 31 insertions(+), 44 deletions(-)

Index: b/drivers/infiniband/hw/ehca/hcp_if.c
===
--- a/drivers/infiniband/hw/ehca/hcp_if.c
+++ b/drivers/infiniband/hw/ehca/hcp_if.c
@@ -90,26 +90,6 @@
 
 static DEFINE_SPINLOCK(hcall_lock);
 
-static u32 get_longbusy_msecs(int longbusy_rc)
-{
-   switch (longbusy_rc) {
-   case H_LONG_BUSY_ORDER_1_MSEC:
-   return 1;
-   case H_LONG_BUSY_ORDER_10_MSEC:
-   return 10;
-   case H_LONG_BUSY_ORDER_100_MSEC:
-   return 100;
-   case H_LONG_BUSY_ORDER_1_SEC:
-   return 1000;
-   case H_LONG_BUSY_ORDER_10_SEC:
-   return 1;
-   case H_LONG_BUSY_ORDER_100_SEC:
-   return 10;
-   default:
-   return 1;
-   }
-}
-
 static long ehca_plpar_hcall_norets(unsigned long opcode,
unsigned long arg1,
unsigned long arg2,
@@ -139,7 +119,7 @@ static long ehca_plpar_hcall_norets(unsi
spin_unlock_irqrestore(hcall_lock, flags);
 
if (H_IS_LONG_BUSY(ret)) {
-   sleep_msecs = get_longbusy_msecs(ret);
+   sleep_msecs = plpar_get_longbusy_msecs(ret);
msleep_interruptible(sleep_msecs);
continue;
}
@@ -192,7 +172,7 @@ static long ehca_plpar_hcall9(unsigned l
spin_unlock_irqrestore(hcall_lock, flags);
 
if (H_IS_LONG_BUSY(ret)) {
-   sleep_msecs = get_longbusy_msecs(ret);
+   sleep_msecs = plpar_get_longbusy_msecs(ret);
msleep_interruptible(sleep_msecs);
continue;
}
Index: b/drivers/net/ehea/ehea_phyp.c
===
--- a/drivers/net/ehea/ehea_phyp.c
+++ b/drivers/net/ehea/ehea_phyp.c
@@ -61,7 +61,7 @@ static long ehea_plpar_hcall_norets(unsi
 arg5, arg6, arg7);
 
if (H_IS_LONG_BUSY(ret)) {
-   sleep_msecs = get_longbusy_msecs(ret);
+   sleep_msecs = plpar_get_longbusy_msecs(ret);
msleep_interruptible(sleep_msecs);
continue;
}
@@ -102,7 +102,7 @@ static long ehea_plpar_hcall9(unsigned l
   arg6, arg7, arg8, arg9);
 
if (H_IS_LONG_BUSY(ret)) {
-   sleep_msecs = get_longbusy_msecs(ret);
+   sleep_msecs = plpar_get_longbusy_msecs(ret);
msleep_interruptible(sleep_msecs);
continue;
}
Index: b/drivers/net/ehea/ehea_phyp.h
===
--- a/drivers/net/ehea/ehea_phyp.h
+++ b/drivers/net/ehea/ehea_phyp.h
@@ -40,26 +40,6 @@
  * hcp_*  - structures, variables and functions releated to Hypervisor Calls
  */
 
-static inline u32 get_longbusy_msecs(int long_busy_ret_code)
-{
-   switch (long_busy_ret_code) {
-   case H_LONG_BUSY_ORDER_1_MSEC:
-   return 1;
-   case H_LONG_BUSY_ORDER_10_MSEC:
-   return 10;
-   case H_LONG_BUSY_ORDER_100_MSEC:
-   return 100;
-   case H_LONG_BUSY_ORDER_1_SEC:
-   return 1000;
-   case H_LONG_BUSY_ORDER_10_SEC:
-   return 1;
-   case H_LONG_BUSY_ORDER_100_SEC:
-   return 10;
-   default:
-   return 1;
-   }
-}
-
 /* Number of pages which can be registered at once by H_REGISTER_HEA_RPAGES */
 #define EHEA_MAX_RPAGE 512
 
Index: b/include/asm-powerpc/hvcall.h
===
--- a/include/asm-powerpc/hvcall.h
+++ b/include/asm-powerpc/hvcall.h
@@ -222,6 +222,33 @@
 #ifndef __ASSEMBLY__
 
 /**
+ * plpar_get_longbusy_msecs: - Return number of msecs for H_LONG_BUSY* response
+ * @long_busy_ret_code: The H_LONG_BUSY_* constant to process
+ *
+ * This returns the number of msecs that corresponds to an H_LONG_BUSY_*
+ * response from a plpar_hcall.  If there 

[PATCH 11/19] powerpc: iommu enablement for CMO

2008-06-12 Thread Robert Jennings
From: Robert Jennings [EMAIL PROTECTED]

To support Cooperative Memory Overcommitment (CMO), we need to check
for failure and busy responses from some of the tce hcalls.

These changes for the pseries platform affect the powerpc architecture;
patches for the other affected platforms are included in this patch.

pSeries platform IOMMU code changes:
 * platform TCE functions must handle H_NOT_ENOUGH_RESOURCES errors.
 * platform TCE functions must retry when H_LONG_BUSY_* is returned.
 * platform TCE functions must return error when H_NOT_ENOUGH_RESOURCES
   encountered.

Architecture IOMMU code changes:
 * Calls to ppc_md.tce_build need to check return values and return 
   DMA_MAPPING_ERROR

Architecture changes:
 * struct machdep_calls for tce_build*_pSeriesLP functions need to change
   to indicate failure
 * all other platforms will need updates to iommu functions to match the new
   calling semantics; they will return 0 on success.  The other platforms
   default configs have been built, but no further testing was performed.

Signed-off-by: Robert Jennings [EMAIL PROTECTED]

---
 arch/powerpc/kernel/iommu.c|   71 +--
 arch/powerpc/platforms/cell/iommu.c|3 +
 arch/powerpc/platforms/iseries/iommu.c |3 +
 arch/powerpc/platforms/pasemi/iommu.c  |3 +
 arch/powerpc/platforms/pseries/iommu.c |   76 -
 arch/powerpc/sysdev/dart_iommu.c   |3 +
 include/asm-powerpc/machdep.h  |2 
 7 files changed, 139 insertions(+), 22 deletions(-)

Index: b/arch/powerpc/kernel/iommu.c
===
--- a/arch/powerpc/kernel/iommu.c
+++ b/arch/powerpc/kernel/iommu.c
@@ -183,6 +183,49 @@ static unsigned long iommu_range_alloc(s
return n;
 }
 
+/** iommu_undo - Clear iommu_table bits without calling platform tce_free.
+ *
+ * @tbl - struct iommu_table to alter
+ * @dma_addr - DMA address to free entries for
+ * @npages - number of pages to free entries for
+ *
+ * This is the same as __iommu_free without the call to ppc_md.tce_free();
+ *
+ * To clean up after ppc_md.tce_build() errors we need to clear bits
+ * in the table without calling the ppc_md.tce_free() method; calling
+ * ppc_md.tce_free() could alter entries that were not touched due to a
+ * premature failure in ppc_md.tce_build().
+ *
+ * The ppc_md.tce_build() needs to perform its own clean up prior to
+ * returning its error.
+ */
+static void iommu_undo(struct iommu_table *tbl, dma_addr_t dma_addr,
+unsigned int npages)
+{
+   unsigned long entry, free_entry;
+
+   entry = dma_addr  IOMMU_PAGE_SHIFT;
+   free_entry = entry - tbl-it_offset;
+
+   if (((free_entry + npages)  tbl-it_size) ||
+   (entry  tbl-it_offset)) {
+   if (printk_ratelimit()) {
+   printk(KERN_INFO iommu_undo: invalid entry\n);
+   printk(KERN_INFO \tentry= 0x%lx\n, entry);
+   printk(KERN_INFO \tdma_addr = 0x%lx\n, (u64)dma_addr);
+   printk(KERN_INFO \tTable= 0x%lx\n, (u64)tbl);
+   printk(KERN_INFO \tbus# = 0x%lx\n, tbl-it_busno);
+   printk(KERN_INFO \tsize = 0x%lx\n, tbl-it_size);
+   printk(KERN_INFO \tstartOff = 0x%lx\n, 
tbl-it_offset);
+   printk(KERN_INFO \tindex= 0x%lx\n, tbl-it_index);
+   WARN_ON(1);
+   }
+   return;
+   }
+
+   iommu_area_free(tbl-it_map, free_entry, npages);
+}
+
 static dma_addr_t iommu_alloc(struct device *dev, struct iommu_table *tbl,
  void *page, unsigned int npages,
  enum dma_data_direction direction,
@@ -190,6 +233,7 @@ static dma_addr_t iommu_alloc(struct dev
 {
unsigned long entry, flags;
dma_addr_t ret = DMA_ERROR_CODE;
+   int rc;
 
spin_lock_irqsave((tbl-it_lock), flags);
 
@@ -204,9 +248,20 @@ static dma_addr_t iommu_alloc(struct dev
ret = entry  IOMMU_PAGE_SHIFT;/* Set the return dma address */
 
/* Put the TCEs in the HW table */
-   ppc_md.tce_build(tbl, entry, npages, (unsigned long)page  
IOMMU_PAGE_MASK,
-direction);
+   rc = ppc_md.tce_build(tbl, entry, npages,
+ (unsigned long)page  IOMMU_PAGE_MASK, direction);
 
+   /* ppc_md.tce_build() only returns non-zero for transient errors.
+* Clean up the table bitmap in this case and return
+* DMA_ERROR_CODE. For all other errors the functionality is
+* not altered.
+*/
+   if (unlikely(rc)) {
+   iommu_undo(tbl, ret, npages);
+
+   spin_unlock_irqrestore((tbl-it_lock), flags);
+   return DMA_ERROR_CODE;
+   }
 
/* Flush/invalidate TLB caches if necessary */
if (ppc_md.tce_flush)
@@ 

[PATCH 12/19] powerpc: vio bus support for CMO

2008-06-12 Thread Robert Jennings
From: Robert Jennings [EMAIL PROTECTED]

Enable bus level entitled memory accounting for Cooperative Memory
Overcommitment (CMO) environments.  The normal code path should not
be affected.

The following changes are made that the VIO bus layer for CMO:
 * add IO memory accounting per device structure.
 * add IO memory entitlement query function to driver structure.
 * during vio bus probe, if CMO is enabled, check that driver has
   memory entitlement query function defined.  Fail if function not defined.
 * fail to register driver if io entitlement function not defined.
 * create set of dma_ops at vio level for CMO that will track allocations
   and return DMA failures once entitlement is reached.  Entitlement will
   limited by overall system entitlement.  Devices will have a reserved
   quanity of memory that is guaranteed, the rest can be used as available.
 * expose entitlement, current allocation, desired allocation, and the
   allocation error counter for devices to the user through sysfs
 * provide mechanism for changing a device's desired entitlement at run time
   for devices as an exported function and sysfs tunable
 * track any DMA failures for entitled IO memory for each vio device.
 * check entitlement against available system entitlement on device add
 * track entitlement metrics (high water mark, current usage)
 * provide function to reset high water mark
 * provide minimum and desired entitlement numbers at a bus level
 * provide drivers with a minimum guaranteed entitlement
 * balance available entitlement between devices to satisfy their needs
 * handle system entitlement changes and device hotplug

Signed-off-by: Robert Jennings [EMAIL PROTECTED]

---
 arch/powerpc/kernel/vio.c |  958 ++
 include/asm-powerpc/vio.h |   30 +
 2 files changed, 981 insertions(+), 7 deletions(-)

Index: b/arch/powerpc/kernel/vio.c
===
--- a/arch/powerpc/kernel/vio.c
+++ b/arch/powerpc/kernel/vio.c
@@ -1,11 +1,12 @@
 /*
  * IBM PowerPC Virtual I/O Infrastructure Support.
  *
- *Copyright (c) 2003-2005 IBM Corp.
+ *Copyright (c) 2003,2008 IBM Corp.
  * Dave Engebretsen [EMAIL PROTECTED]
  * Santiago Leon [EMAIL PROTECTED]
  * Hollis Blanchard [EMAIL PROTECTED]
  * Stephen Rothwell
+ * Robert Jennings [EMAIL PROTECTED]
  *
  *  This program is free software; you can redistribute it and/or
  *  modify it under the terms of the GNU General Public License
@@ -46,6 +47,561 @@ static struct vio_dev vio_bus_device  = 
.dev.bus = vio_bus_type,
 };
 
+/**
+ * vio_cmo_pool - A pool of IO memory for CMO use
+ *
+ * @size: The size of the pool in bytes
+ * @free: The amount of free memory in the pool
+ */
+struct vio_cmo_pool {
+   size_t size;
+   size_t free;
+};
+
+/* How many ms to delay queued balance work */
+#define VIO_CMO_BALANCE_DELAY 100
+
+/* Portion out IO memory to CMO devices by this chunk size */
+#define VIO_CMO_BALANCE_CHUNK 131072
+
+/**
+ * vio_cmo_dev_entry - A device that is CMO-enabled and requires entitlement
+ *
+ * @vio_dev: struct vio_dev pointer
+ * @list: pointer to other devices on bus that are being tracked
+ */
+struct vio_cmo_dev_entry {
+   struct vio_dev *viodev;
+   struct list_head list;
+};
+
+/**
+ * vio_cmo - VIO bus accounting structure for CMO entitlement
+ *
+ * @lock: spinlock for entire structure
+ * @balance_q: work queue for balancing system entitlement
+ * @device_list: list of CMO-enabled devices requiring entitlement
+ * @entitled: total system entitlement in bytes
+ * @reserve: pool of memory from which devices reserve entitlement, incl. spare
+ * @excess: pool of excess entitlement not needed for device reserves or spare
+ * @spare: IO memory for device hotplug functionality
+ * @min: minimum necessary for system operation
+ * @desired: desired memory for system operation
+ * @curr: bytes currently allocated
+ * @high: high water mark for IO data usage
+ */
+struct vio_cmo {
+   spinlock_t lock;
+   struct delayed_work balance_q;
+   struct list_head device_list;
+   size_t entitled;
+   struct vio_cmo_pool reserve;
+   struct vio_cmo_pool excess;
+   size_t spare;
+   size_t min;
+   size_t desired;
+   size_t curr;
+   size_t high;
+} vio_cmo;
+
+/**
+ * vio_cmo_OF_devices - Count the number of OF devices that have DMA windows
+ */
+static int vio_cmo_num_OF_devs(void)
+{
+   struct device_node *node_vroot;
+   int count = 0;
+
+   /*
+* Count the number of vdevice entries with an
+* ibm,my-dma-window OF property
+*/
+   node_vroot = of_find_node_by_name(NULL, vdevice);
+   if (node_vroot) {
+   struct device_node *of_node;
+   struct property *prop;
+
+   for (of_node = node_vroot-child; of_node != NULL;
+   of_node = of_node-sibling) {
+

[PATCH 13/19] powerpc: Verify CMO memory entitlement updates with virtual I/O

2008-06-12 Thread Robert Jennings
From: Nathan Fontenot [EMAIL PROTECTED]

Verify memory entitlement updates can be handled by vio.

Signed-off-by: Nathan Fontenot [EMAIL PROTECTED]

---
 arch/powerpc/kernel/lparcfg.c |   10 ++
 1 file changed, 10 insertions(+)

Index: b/arch/powerpc/kernel/lparcfg.c
===
--- a/arch/powerpc/kernel/lparcfg.c
+++ b/arch/powerpc/kernel/lparcfg.c
@@ -34,6 +34,7 @@
 #include asm/time.h
 #include asm/prom.h
 #include asm/vdso_datapage.h
+#include asm/vio.h
 
 #define MODULE_VERS 1.7
 #define MODULE_NAME lparcfg
@@ -528,6 +529,15 @@ static ssize_t update_mpp(u64 *entitleme
u8 new_weight;
ssize_t rc;
 
+   if (entitlement) {
+   /* Check with vio to ensure the new memory entitlement
+* can be handled.
+*/
+   rc = vio_cmo_entitlement_update(*entitlement);
+   if (rc)
+   return rc;
+   }
+
rc = h_get_mpp(mpp_data);
if (rc)
return rc;
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 14/19] powerpc: hvc enablement for CMO

2008-06-12 Thread Robert Jennings
From: Robert Jennings [EMAIL PROTECTED]

Define a get_io_entitlement function so that it can function in a
Cooperative Memory Overcommitment (CMO) environment (it returns 0 to
indicate that no IO entitlement is required, as the driver does not
perform DMA operations).

Signed-off-by: Robert Jennings [EMAIL PROTECTED]

---
 drivers/char/hvc_vio.c |6 ++
 1 file changed, 6 insertions(+)

Index: b/drivers/char/hvc_vio.c
===
--- a/drivers/char/hvc_vio.c
+++ b/drivers/char/hvc_vio.c
@@ -82,6 +82,11 @@ static struct hv_ops hvc_get_put_ops = {
.put_chars = hvc_put_chars,
 };
 
+unsigned long hvc_io_entitlement(struct vio_dev *vdev)
+{
+   return 0;
+}
+
 static int __devinit hvc_vio_probe(struct vio_dev *vdev,
const struct vio_device_id *id)
 {
@@ -111,6 +116,7 @@ static struct vio_driver hvc_vio_driver 
.id_table   = hvc_driver_table,
.probe  = hvc_vio_probe,
.remove = hvc_vio_remove,
+   .get_io_entitlement = hvc_io_entitlement,
.driver = {
.name   = hvc_driver_name,
.owner  = THIS_MODULE,
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 15/19] powerpc: hvcs enablement for CMO

2008-06-12 Thread Robert Jennings
From: Robert Jennings [EMAIL PROTECTED]

Define a get_io_entitlement function so that it can function in a
Cooperative Memory Overcommitment (CMO) environment (it returns 0 to
indicate that no IO entitlement is required, as the driver does not
perform DMA operations).

Signed-off-by: Robert Jennings [EMAIL PROTECTED]

---
 drivers/char/hvcs.c |6 ++
 1 file changed, 6 insertions(+)

Index: b/drivers/char/hvcs.c
===
--- a/drivers/char/hvcs.c
+++ b/drivers/char/hvcs.c
@@ -756,6 +756,11 @@ static int hvcs_get_index(void)
return -1;
 }
 
+unsigned long hvcs_get_io_entitlement(struct vio_dev *vdev)
+{
+   return 0;
+}
+
 static int __devinit hvcs_probe(
struct vio_dev *dev,
const struct vio_device_id *id)
@@ -869,6 +874,7 @@ static struct vio_driver hvcs_vio_driver
.id_table   = hvcs_driver_table,
.probe  = hvcs_probe,
.remove = hvcs_remove,
+   .get_io_entitlement = hvcs_get_io_entitlement,
.driver = {
.name   = hvcs_driver_name,
.owner  = THIS_MODULE,
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 16/19] ibmveth: Automatically enable larger rx buffer pools for larger mtu

2008-06-12 Thread Robert Jennings
From: Santiago Leon [EMAIL PROTECTED]

Activates larger rx buffer pools when the MTU is changed to a larger
value.  This patch de-activates the large rx buffer pools when the MTU
changes to a smaller value.

Signed-off-by: Santiago Leon [EMAIL PROTECTED]

---

 drivers/net/ibmveth.c |   20 +---
 1 file changed, 13 insertions(+), 7 deletions(-)

Index: b/drivers/net/ibmveth.c
===
--- a/drivers/net/ibmveth.c
+++ b/drivers/net/ibmveth.c
@@ -1054,7 +1054,6 @@ static int ibmveth_change_mtu(struct net
 {
struct ibmveth_adapter *adapter = dev-priv;
int new_mtu_oh = new_mtu + IBMVETH_BUFF_OH;
-   int reinit = 0;
int i, rc;
 
if (new_mtu  IBMVETH_MAX_MTU)
@@ -1067,15 +1066,21 @@ static int ibmveth_change_mtu(struct net
if (i == IbmVethNumBufferPools)
return -EINVAL;
 
+   /* Deactivate all the buffer pools so that the next loop can activate
+  only the buffer pools necessary to hold the new MTU */
+   for(i = 0; iIbmVethNumBufferPools; i++)
+   if (adapter-rx_buff_pool[i].active) {
+   ibmveth_free_buffer_pool(adapter,
+adapter-rx_buff_pool[i]);
+   adapter-rx_buff_pool[i].active = 0;
+   }
+
/* Look for an active buffer pool that can hold the new MTU */
for(i = 0; iIbmVethNumBufferPools; i++) {
-   if (!adapter-rx_buff_pool[i].active) {
-   adapter-rx_buff_pool[i].active = 1;
-   reinit = 1;
-   }
+   adapter-rx_buff_pool[i].active = 1;
 
if (new_mtu_oh  adapter-rx_buff_pool[i].buff_size) {
-   if (reinit  netif_running(adapter-netdev)) {
+   if (netif_running(adapter-netdev)) {
adapter-pool_config = 1;
ibmveth_close(adapter-netdev);
adapter-pool_config = 0;
@@ -1402,14 +1407,15 @@ const char * buf, size_t count)
return -EPERM;
}
 
-   pool-active = 0;
if (netif_running(netdev)) {
adapter-pool_config = 1;
ibmveth_close(netdev);
+   pool-active = 0;
adapter-pool_config = 0;
if ((rc = ibmveth_open(netdev)))
return rc;
}
+   pool-active = 0;
}
} else if (attr == veth_num_attr) {
if (value = 0 || value  IBMVETH_MAX_POOL_COUNT)
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 17/19] ibmveth: enable driver for CMO

2008-06-12 Thread Robert Jennings
From: Robert Jennings [EMAIL PROTECTED]

Enable ibmveth for Cooperative Memory Overcommitment (CMO).  For this driver
it means calculating a desired amount of IO memory based on the current MTU
and updating this value with the bus when MTU changes occur.  Because DMA
mappings can fail, we have added a bounce buffer for temporary cases where
the driver can not map IO memory for the buffer pool.

The following changes are made to enable the driver for CMO:
 * DMA mapping errors will not result in error messages if entitlement has
   been exceeded and resources were not available.
 * DMA mapping errors are handled gracefully, ibmveth_replenish_buffer_pool()
   is corrected to check the return from dma_map_single and fail gracefully.
 * The driver will have a get_io_entitlement function defined to function
   in a CMO environment.
 * When the MTU is changed, the driver will update the device IO entitlement

Signed-off-by: Robert Jennings [EMAIL PROTECTED]
Signed-off-by: Brian King [EMAIL PROTECTED]
Signed-off-by: Santiago Leon [EMAIL PROTECTED]

---

 drivers/net/ibmveth.c |  169 --
 drivers/net/ibmveth.h |5 +
 2 files changed, 140 insertions(+), 34 deletions(-)

Index: b/drivers/net/ibmveth.c
===
--- a/drivers/net/ibmveth.c
+++ b/drivers/net/ibmveth.c
@@ -33,6 +33,7 @@
 */
 
 #include linux/module.h
+#include linux/moduleparam.h
 #include linux/types.h
 #include linux/errno.h
 #include linux/ioport.h
@@ -52,7 +53,9 @@
 #include asm/hvcall.h
 #include asm/atomic.h
 #include asm/vio.h
+#include asm/iommu.h
 #include asm/uaccess.h
+#include asm/firmware.h
 #include linux/seq_file.h
 
 #include ibmveth.h
@@ -94,8 +97,10 @@ static void ibmveth_proc_register_adapte
 static void ibmveth_proc_unregister_adapter(struct ibmveth_adapter *adapter);
 static irqreturn_t ibmveth_interrupt(int irq, void *dev_instance);
 static void ibmveth_rxq_harvest_buffer(struct ibmveth_adapter *adapter);
+static unsigned long ibmveth_get_io_entitlement(struct vio_dev *vdev);
 static struct kobj_type ktype_veth_pool;
 
+
 #ifdef CONFIG_PROC_FS
 #define IBMVETH_PROC_DIR ibmveth
 static struct proc_dir_entry *ibmveth_proc_dir;
@@ -226,16 +231,16 @@ static void ibmveth_replenish_buffer_poo
u32 i;
u32 count = pool-size - atomic_read(pool-available);
u32 buffers_added = 0;
+   struct sk_buff *skb;
+   unsigned int free_index, index;
+   u64 correlator;
+   unsigned long lpar_rc;
+   dma_addr_t dma_addr;
 
mb();
 
for(i = 0; i  count; ++i) {
-   struct sk_buff *skb;
-   unsigned int free_index, index;
-   u64 correlator;
union ibmveth_buf_desc desc;
-   unsigned long lpar_rc;
-   dma_addr_t dma_addr;
 
skb = alloc_skb(pool-buff_size, GFP_ATOMIC);
 
@@ -255,6 +260,9 @@ static void ibmveth_replenish_buffer_poo
dma_addr = dma_map_single(adapter-vdev-dev, skb-data,
pool-buff_size, DMA_FROM_DEVICE);
 
+   if (dma_mapping_error(dma_addr))
+   goto failure;
+
pool-free_map[free_index] = IBM_VETH_INVALID_MAP;
pool-dma_addr[index] = dma_addr;
pool-skbuff[index] = skb;
@@ -267,20 +275,9 @@ static void ibmveth_replenish_buffer_poo
 
lpar_rc = h_add_logical_lan_buffer(adapter-vdev-unit_address, 
desc.desc);
 
-   if(lpar_rc != H_SUCCESS) {
-   pool-free_map[free_index] = index;
-   pool-skbuff[index] = NULL;
-   if (pool-consumer_index == 0)
-   pool-consumer_index = pool-size - 1;
-   else
-   pool-consumer_index--;
-   dma_unmap_single(adapter-vdev-dev,
-   pool-dma_addr[index], pool-buff_size,
-   DMA_FROM_DEVICE);
-   dev_kfree_skb_any(skb);
-   adapter-replenish_add_buff_failure++;
-   break;
-   } else {
+   if (lpar_rc != H_SUCCESS)
+   goto failure;
+   else {
buffers_added++;
adapter-replenish_add_buff_success++;
}
@@ -288,6 +285,24 @@ static void ibmveth_replenish_buffer_poo
 
mb();
atomic_add(buffers_added, (pool-available));
+   return;
+
+failure:
+   pool-free_map[free_index] = index;
+   pool-skbuff[index] = NULL;
+   if (pool-consumer_index == 0)
+   pool-consumer_index = pool-size - 1;
+   else
+   pool-consumer_index--;
+   if (!dma_mapping_error(dma_addr))
+   dma_unmap_single(adapter-vdev-dev,
+

[PATCH 18/19] ibmvscsi: driver enablement for CMO

2008-06-12 Thread Robert Jennings
From: Robert Jennings [EMAIL PROTECTED]

Enable the driver to function in a Cooperative Memory Overcommitment (CMO)
environment.

The following changes are made to enable the driver for CMO:
 * DMA mapping errors will not result in error messages if entitlement has
   been exceeded and resources were not available.
 * The driver has a get_io_entitlement function defined to function
   in a CMO environment. It will indicate how much IO memory it would like
   to function.

Signed-off-by: Robert Jennings [EMAIL PROTECTED]

---
 drivers/scsi/ibmvscsi/ibmvscsi.c |   46 +--
 drivers/scsi/ibmvscsi/ibmvscsi.h |2 ++
 2 files changed, 41 insertions(+), 7 deletions(-)

Index: b/drivers/scsi/ibmvscsi/ibmvscsi.c
===
--- a/drivers/scsi/ibmvscsi/ibmvscsi.c
+++ b/drivers/scsi/ibmvscsi/ibmvscsi.c
@@ -72,6 +72,8 @@
 #include linux/delay.h
 #include asm/firmware.h
 #include asm/vio.h
+#include asm/firmware.h
+#include asm/iommu.h
 #include scsi/scsi.h
 #include scsi/scsi_cmnd.h
 #include scsi/scsi_host.h
@@ -426,8 +428,10 @@ static int map_sg_data(struct scsi_cmnd 
   SG_ALL * sizeof(struct 
srp_direct_buf),
   evt_struct-ext_list_token, 0);
if (!evt_struct-ext_list) {
-   sdev_printk(KERN_ERR, cmd-device,
-   Can't allocate memory for indirect 
table\n);
+   if (!firmware_has_feature(FW_FEATURE_CMO))
+   sdev_printk(KERN_ERR, cmd-device,
+   Can't allocate memory 
+   for indirect table\n);
return 0;
}
}
@@ -743,7 +747,9 @@ static int ibmvscsi_queuecommand(struct 
srp_cmd-lun = ((u64) lun)  48;
 
if (!map_data_for_srp_cmd(cmnd, evt_struct, srp_cmd, hostdata-dev)) {
-   sdev_printk(KERN_ERR, cmnd-device, couldn't convert cmd to 
srp_cmd\n);
+   if (!firmware_has_feature(FW_FEATURE_CMO))
+   sdev_printk(KERN_ERR, cmnd-device,
+   couldn't convert cmd to srp_cmd\n);
free_event_struct(hostdata-pool, evt_struct);
return SCSI_MLQUEUE_HOST_BUSY;
}
@@ -855,7 +861,10 @@ static void send_mad_adapter_info(struct
DMA_BIDIRECTIONAL);
 
if (dma_mapping_error(req-buffer)) {
-   dev_err(hostdata-dev, Unable to map request_buffer for 
adapter_info!\n);
+   if (!firmware_has_feature(FW_FEATURE_CMO))
+   dev_err(hostdata-dev,
+   Unable to map request_buffer for 
+   adapter_info!\n);
free_event_struct(hostdata-pool, evt_struct);
return;
}
@@ -1400,7 +1409,9 @@ static int ibmvscsi_do_host_config(struc
DMA_BIDIRECTIONAL);
 
if (dma_mapping_error(host_config-buffer)) {
-   dev_err(hostdata-dev, dma_mapping error getting host 
config\n);
+   if (!firmware_has_feature(FW_FEATURE_CMO))
+   dev_err(hostdata-dev,
+   dma_mapping error getting host config\n);
free_event_struct(hostdata-pool, evt_struct);
return -1;
}
@@ -1604,7 +1615,7 @@ static struct scsi_host_template driver_
.eh_host_reset_handler = ibmvscsi_eh_host_reset_handler,
.slave_configure = ibmvscsi_slave_configure,
.change_queue_depth = ibmvscsi_change_queue_depth,
-   .cmd_per_lun = 16,
+   .cmd_per_lun = IBMVSCSI_CMDS_PER_LUN_DEFAULT,
.can_queue = IBMVSCSI_MAX_REQUESTS_DEFAULT,
.this_id = -1,
.sg_tablesize = SG_ALL,
@@ -1613,6 +1624,26 @@ static struct scsi_host_template driver_
 };
 
 /**
+ * ibmvscsi_get_io_entitlement - Calculate IO entitlement needed by the driver
+ *
+ * @vdev: struct vio_dev for the device whose entitlement is to be returned
+ *
+ * Return value:
+ * Number of bytes of IO data the driver will need to perform well.
+ */
+static unsigned long ibmvscsi_get_io_entitlement(struct vio_dev *vdev)
+{
+   /* iu_storage data allocated in initialize_event_pool */
+   unsigned long io_entitlement = max_requests * sizeof(union viosrp_iu);
+
+   /* add io space for sg data */
+   io_entitlement += (IBMVSCSI_MAX_SECTORS_DEFAULT *
+IBMVSCSI_CMDS_PER_LUN_DEFAULT);
+
+   return IOMMU_PAGE_ALIGN(io_entitlement);
+}
+
+/**
  * Called by bus code for each adapter
  */
 static int ibmvscsi_probe(struct vio_dev *vdev, const struct vio_device_id *id)
@@ -1641,7 +1672,7 @@ static int ibmvscsi_probe(struct vio_dev
hostdata-host = host;
hostdata-dev = dev;
   

[PATCH 19/19] powerpc: Update arch vector to indicate support for CMO

2008-06-12 Thread Robert Jennings
From: Nathan Fontenot [EMAIL PROTECTED]

Update the architecture vector to indicate that Cooperative Memory
Overcommitment is supported.

This is the last patch in the series.  Committing it will signal to 
the platform firmware is CMO enabled.

Signed-off-by: Nathan Fontenot [EMAIL PROTECTED]

---

 arch/powerpc/kernel/prom_init.c |5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

Index: b/arch/powerpc/kernel/prom_init.c
===
--- a/arch/powerpc/kernel/prom_init.c
+++ b/arch/powerpc/kernel/prom_init.c
@@ -642,6 +642,7 @@ static void __init early_cmdline_parse(v
 #else
 #define OV5_MSI0x00
 #endif /* CONFIG_PCI_MSI */
+#define OV5_CMO0x80/* Cooperative Memory 
Overcommitment */
 
 /*
  * The architecture vector has an array of PVR mask/value pairs,
@@ -684,10 +685,12 @@ static unsigned char ibm_architecture_ve
0,  /* don't halt */
 
/* option vector 5: PAPR/OF options */
-   3 - 2,  /* length */
+   5 - 2,  /* length */
0,  /* don't ignore, don't halt */
OV5_LPAR | OV5_SPLPAR | OV5_LARGE_PAGES | OV5_DRCONF_MEMORY |
OV5_DONATE_DEDICATE_CPU | OV5_MSI,
+   0,
+   OV5_CMO,
 };
 
 /* Old method - ELF header with PT_NOTE sections */
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: Using DMA interrupt on MPC8313

2008-06-12 Thread Kumar Gala
The dmaengine provides a generic set of APIs w/a FSL dma backend.  It  
might be the case that your need of dma doesnt fit into the current  
set of APIs.


- k

On Jun 12, 2008, at 3:04 PM, Ron Madrid wrote:

Well in that case wouldn't I need to use the fsldma driver?  Or is  
dmaengine a generic dma driver?


Ron
--- Kumar Gala [EMAIL PROTECTED] wrote:



On Jun 12, 2008, at 2:35 PM, Ron Madrid wrote:


I'm trying to write a driver that would make use of the DMA on the
MPC8313.  I'm attempting to
register the interrupt with request_irq but it is not passing.  Is
there something that I need to
do before I call request_irq, maybe in the dts or somewhere else?



any reason you aren't using the dmaengine driver?

- k



___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 1/7] ide-pmac: bugfix for media-bay support rework

2008-06-12 Thread Bartlomiej Zolnierkiewicz
Fix bug introduced by:

commit 2dde7861afa23cd59db83515cb0b810b92b220aa
Author: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
Date:   Fri Apr 18 00:46:23 2008 +0200

ide: rework PowerMac media-bay support (take 2)
...

[ Yeah, I suck. ]

bay-cd_index shouldn't be changed if IDE devices are not present
or retry operations won't happen.

Cc: Benjamin Herrenschmidt [EMAIL PROTECTED]
Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
first three patches are meant for 2.6.26, the rest for 2.6.27

drivers/macintosh/mediabay.c |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Index: b/drivers/macintosh/mediabay.c
===
--- a/drivers/macintosh/mediabay.c
+++ b/drivers/macintosh/mediabay.c
@@ -556,7 +556,8 @@ static void media_bay_step(int i)
printk(mediabay %d, registering IDE...\n, i);
pmu_suspend();
ide_port_scan(bay-cd_port);
-   bay-cd_index = bay-cd_port-index;
+   if (bay-cd_port-present)
+   bay-cd_index = bay-cd_port-index;
pmu_resume();
}
if (bay-cd_index == -1) {
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 2/7] ide-pmac: add -cable_detect method

2008-06-12 Thread Bartlomiej Zolnierkiewicz
Add -cable_detect method and remove no longer needed pmif-cable_80 flag
(there is also no need to mask -udma_mask now).

This fixes:

- forced ignoring of cable detection (needed for some CF devices  debug)

- cable detection for warm-plug

Cc: Benjamin Herrenschmidt [EMAIL PROTECTED]
Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ppc/pmac.c |   55 +++--
 1 file changed, 31 insertions(+), 24 deletions(-)

Index: b/drivers/ide/ppc/pmac.c
===
--- a/drivers/ide/ppc/pmac.c
+++ b/drivers/ide/ppc/pmac.c
@@ -57,7 +57,6 @@ typedef struct pmac_ide_hwif {
int irq;
int kind;
int aapl_bus_id;
-   unsignedcable_80 : 1;
unsignedmediabay : 1;
unsignedbroken_dma : 1;
unsignedbroken_dma_warn : 1;
@@ -915,10 +914,40 @@ pmac_ide_do_resume(ide_hwif_t *hwif)
return 0;
 }
 
+static u8 pmac_ide_cable_detect(ide_hwif_t *hwif)
+{
+   pmac_ide_hwif_t *pmif = (pmac_ide_hwif_t *)ide_get_hwifdata(hwif);
+   struct device_node *np = pmif-node;
+   const char *cable = of_get_property(np, cable-type, NULL);
+
+   /* Get cable type from device-tree. */
+   if (cable  !strncmp(cable, 80-, 3))
+   return ATA_CBL_PATA80;
+
+   /*
+* G5's seem to have incorrect cable type in device-tree.
+* Let's assume they have a 80 conductor cable, this seem
+* to be always the case unless the user mucked around.
+*/
+   if (of_device_is_compatible(np, K2-UATA) ||
+   of_device_is_compatible(np, shasta-ata))
+   return ATA_CBL_PATA80;
+
+   return ATA_CBL_PATA40;
+}
+
 static const struct ide_port_ops pmac_ide_ata6_port_ops = {
.set_pio_mode   = pmac_ide_set_pio_mode,
.set_dma_mode   = pmac_ide_set_dma_mode,
.selectproc = pmac_ide_kauai_selectproc,
+   .cable_detect   = pmac_ide_cable_detect,
+};
+
+static const struct ide_port_ops pmac_ide_ata4_port_ops = {
+   .set_pio_mode   = pmac_ide_set_pio_mode,
+   .set_dma_mode   = pmac_ide_set_dma_mode,
+   .selectproc = pmac_ide_selectproc,
+   .cable_detect   = pmac_ide_cable_detect,
 };
 
 static const struct ide_port_ops pmac_ide_port_ops = {
@@ -959,7 +988,6 @@ pmac_ide_setup_device(pmac_ide_hwif_t *p
u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
struct ide_port_info d = pmac_port_info;
 
-   pmif-cable_80 = 0;
pmif-broken_dma = pmif-broken_dma_warn = 0;
if (of_device_is_compatible(np, shasta-ata)) {
pmif-kind = controller_sh_ata6;
@@ -976,6 +1004,7 @@ pmac_ide_setup_device(pmac_ide_hwif_t *p
} else if (of_device_is_compatible(np, keylargo-ata)) {
if (strcmp(np-name, ata-4) == 0) {
pmif-kind = controller_kl_ata4;
+   d.port_ops = pmac_ide_ata4_port_ops;
d.udma_mask = ATA_UDMA4;
} else
pmif-kind = controller_kl_ata3;
@@ -989,22 +1018,6 @@ pmac_ide_setup_device(pmac_ide_hwif_t *p
bidp = of_get_property(np, AAPL,bus-id, NULL);
pmif-aapl_bus_id =  bidp ? *bidp : 0;
 
-   /* Get cable type from device-tree */
-   if (pmif-kind == controller_kl_ata4 || pmif-kind == controller_un_ata6
-   || pmif-kind == controller_k2_ata6
-   || pmif-kind == controller_sh_ata6) {
-   const char* cable = of_get_property(np, cable-type, NULL);
-   if (cable  !strncmp(cable, 80-, 3))
-   pmif-cable_80 = 1;
-   }
-   /* G5's seem to have incorrect cable type in device-tree. Let's assume
-* they have a 80 conductor cable, this seem to be always the case 
unless
-* the user mucked around
-*/
-   if (of_device_is_compatible(np, K2-UATA) ||
-   of_device_is_compatible(np, shasta-ata))
-   pmif-cable_80 = 1;
-
/* On Kauai-type controllers, we make sure the FCR is correct */
if (pmif-kauai_fcr)
writel(KAUAI_FCR_UATA_MAGIC |
@@ -1050,7 +1063,6 @@ pmac_ide_setup_device(pmac_ide_hwif_t *p
 
hwif-hwif_data = pmif;
ide_init_port_hw(hwif, hw);
-   hwif-cbl = pmif-cable_80 ? ATA_CBL_PATA80 : ATA_CBL_PATA40;
 
printk(KERN_INFO ide%d: Found Apple %s controller, bus ID %d%s, irq 
%d\n,
   hwif-index, model_name[pmif-kind], pmif-aapl_bus_id,
@@ -1067,11 +1079,6 @@ pmac_ide_setup_device(pmac_ide_hwif_t *p
}
}
 
-#ifdef CONFIG_BLK_DEV_IDEDMA_PMAC
-   if (pmif-cable_80 == 0)
-   d.udma_mask = ATA_UDMA2;
-#endif
-
idx[0] = hwif-index;
 

[PATCH 3/7] ide-pmac: remove bogus comment about pmac_ide_setup_device()

2008-06-12 Thread Bartlomiej Zolnierkiewicz
Cc: Benjamin Herrenschmidt [EMAIL PROTECTED]
Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ppc/pmac.c |5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

Index: b/drivers/ide/ppc/pmac.c
===
--- a/drivers/ide/ppc/pmac.c
+++ b/drivers/ide/ppc/pmac.c
@@ -975,10 +975,7 @@ static const struct ide_port_info pmac_p
 
 /*
  * Setup, register  probe an IDE channel driven by this driver, this is
- * called by one of the 2 probe functions (macio or PCI). Note that a channel
- * that ends up beeing free of any device is not kept around by this driver
- * (it is kept in 2.4). This introduce an interface numbering change on some
- * rare machines unfortunately, but it's better this way.
+ * called by one of the 2 probe functions (macio or PCI).
  */
 static int __devinit
 pmac_ide_setup_device(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif, hw_regs_t *hw)
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 5/7] ide-pmac: store pmif instead of hwif in -driver_data

2008-06-12 Thread Bartlomiej Zolnierkiewicz
* Pass pmif instead of hwif to pmac_ide_do_{suspend,resume}().

* Store pmif instead of hwif in -driver_data.

* Use dev_get_drvdata() instead of -hwif_data to obtain pmif.

There should be no functional changes caused by this patch.

Cc: Benjamin Herrenschmidt [EMAIL PROTECTED]
Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ppc/pmac.c |   93 -
 1 file changed, 55 insertions(+), 38 deletions(-)

Index: b/drivers/ide/ppc/pmac.c
===
--- a/drivers/ide/ppc/pmac.c
+++ b/drivers/ide/ppc/pmac.c
@@ -424,7 +424,9 @@ static void pmac_ide_kauai_selectproc(id
 static void
 pmac_ide_selectproc(ide_drive_t *drive)
 {
-   pmac_ide_hwif_t* pmif = (pmac_ide_hwif_t *)HWIF(drive)-hwif_data;
+   ide_hwif_t *hwif = drive-hwif;
+   pmac_ide_hwif_t *pmif =
+   (pmac_ide_hwif_t *)dev_get_drvdata(hwif-gendev.parent);
 
if (pmif == NULL)
return;
@@ -444,7 +446,9 @@ pmac_ide_selectproc(ide_drive_t *drive)
 static void
 pmac_ide_kauai_selectproc(ide_drive_t *drive)
 {
-   pmac_ide_hwif_t* pmif = (pmac_ide_hwif_t *)HWIF(drive)-hwif_data;
+   ide_hwif_t *hwif = drive-hwif;
+   pmac_ide_hwif_t *pmif =
+   (pmac_ide_hwif_t *)dev_get_drvdata(hwif-gendev.parent);
 
if (pmif == NULL)
return;
@@ -465,7 +469,9 @@ pmac_ide_kauai_selectproc(ide_drive_t *d
 static void
 pmac_ide_do_update_timings(ide_drive_t *drive)
 {
-   pmac_ide_hwif_t* pmif = (pmac_ide_hwif_t *)HWIF(drive)-hwif_data;
+   ide_hwif_t *hwif = drive-hwif;
+   pmac_ide_hwif_t *pmif =
+   (pmac_ide_hwif_t *)dev_get_drvdata(hwif-gendev.parent);
 
if (pmif == NULL)
return;
@@ -493,11 +499,13 @@ static void pmac_outbsync(ide_hwif_t *hw
 static void
 pmac_ide_set_pio_mode(ide_drive_t *drive, const u8 pio)
 {
+   ide_hwif_t *hwif = drive-hwif;
+   pmac_ide_hwif_t *pmif =
+   (pmac_ide_hwif_t *)dev_get_drvdata(hwif-gendev.parent);
struct ide_timing *tim = ide_timing_find_mode(XFER_PIO_0 + pio);
u32 *timings, t;
unsigned accessTicks, recTicks;
unsigned accessTime, recTime;
-   pmac_ide_hwif_t* pmif = (pmac_ide_hwif_t *)HWIF(drive)-hwif_data;
unsigned int cycle_time;
 
if (pmif == NULL)
@@ -778,9 +786,11 @@ set_timings_mdma(ide_drive_t *drive, int
 
 static void pmac_ide_set_dma_mode(ide_drive_t *drive, const u8 speed)
 {
+   ide_hwif_t *hwif = drive-hwif;
+   pmac_ide_hwif_t *pmif =
+   (pmac_ide_hwif_t *)dev_get_drvdata(hwif-gendev.parent);
int unit = (drive-select.b.unit  0x01);
int ret = 0;
-   pmac_ide_hwif_t* pmif = (pmac_ide_hwif_t *)HWIF(drive)-hwif_data;
u32 *timings, *timings2, tl[2];
 
timings = pmif-timings[unit];
@@ -852,11 +862,8 @@ sanitize_timings(pmac_ide_hwif_t *pmif)
 /* Suspend call back, should be called after the child devices
  * have actually been suspended
  */
-static int
-pmac_ide_do_suspend(ide_hwif_t *hwif)
+static int pmac_ide_do_suspend(pmac_ide_hwif_t *pmif)
 {
-   pmac_ide_hwif_t *pmif = (pmac_ide_hwif_t *)hwif-hwif_data;
-   
/* We clear the timings */
pmif-timings[0] = 0;
pmif-timings[1] = 0;
@@ -884,11 +891,8 @@ pmac_ide_do_suspend(ide_hwif_t *hwif)
 /* Resume call back, should be called before the child devices
  * are resumed
  */
-static int
-pmac_ide_do_resume(ide_hwif_t *hwif)
+static int pmac_ide_do_resume(pmac_ide_hwif_t *pmif)
 {
-   pmac_ide_hwif_t *pmif = (pmac_ide_hwif_t *)hwif-hwif_data;
-   
/* Hard reset  re-enable controller (do we really need to reset ? 
-BenH) */
if (!pmif-mediabay) {
ppc_md.feature_call(PMAC_FTR_IDE_RESET, pmif-node, 
pmif-aapl_bus_id, 1);
@@ -916,7 +920,8 @@ pmac_ide_do_resume(ide_hwif_t *hwif)
 
 static u8 pmac_ide_cable_detect(ide_hwif_t *hwif)
 {
-   pmac_ide_hwif_t *pmif = (pmac_ide_hwif_t *)ide_get_hwifdata(hwif);
+   pmac_ide_hwif_t *pmif =
+   (pmac_ide_hwif_t *)drv_get_drvdata(hwif-gendev.parent);
struct device_node *np = pmif-node;
const char *cable = of_get_property(np, cable-type, NULL);
 
@@ -1054,7 +1059,6 @@ pmac_ide_setup_device(pmac_ide_hwif_t *p
default_hwif_mmiops(hwif);
hwif-OUTBSYNC = pmac_outbsync;
 
-   hwif-hwif_data = pmif;
ide_init_port_hw(hwif, hw);
 
printk(KERN_INFO ide%d: Found Apple %s controller, bus ID %d%s, irq 
%d\n,
@@ -1162,7 +1166,7 @@ pmac_ide_macio_attach(struct macio_dev *
} else
pmif-dma_regs = NULL;
 #endif /* CONFIG_BLK_DEV_IDEDMA_PMAC */
-   dev_set_drvdata(mdev-ofdev.dev, hwif);
+   dev_set_drvdata(mdev-ofdev.dev, pmif);
 
memset(hw, 0, sizeof(hw));
pmac_ide_init_ports(hw, pmif-regbase);
@@ -1193,12 +1197,13 @@ out_free_pmif:
 static int
 pmac_ide_macio_suspend(struct 

[PATCH 6/7] ide-pmac: add -init_dev method

2008-06-12 Thread Bartlomiej Zolnierkiewicz
There should be no functional changes caused by this patch.

Cc: Benjamin Herrenschmidt [EMAIL PROTECTED]
Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ppc/pmac.c |   27 ++-
 1 file changed, 18 insertions(+), 9 deletions(-)

Index: b/drivers/ide/ppc/pmac.c
===
--- a/drivers/ide/ppc/pmac.c
+++ b/drivers/ide/ppc/pmac.c
@@ -941,7 +941,23 @@ static u8 pmac_ide_cable_detect(ide_hwif
return ATA_CBL_PATA40;
 }
 
+static void pmac_ide_init_dev(ide_drive_t *drive)
+{
+   ide_hwif_t *hwif = drive-hwif;
+   pmac_ide_hwif_t *pmif =
+   (pmac_ide_hwif_t *)drv_get_drvdata(hwif-gendev.parent);
+
+   if (pmif-mediabay) {
+#ifdef CONFIG_PMAC_MEDIABAY
+   if (check_media_bay(np-parent, MB_CD) == -ENODEV)
+   return;
+#endif
+   drive-noprobe = 1;
+   }
+}
+
 static const struct ide_port_ops pmac_ide_ata6_port_ops = {
+   .init_dev   = pmac_ide_init_dev,
.set_pio_mode   = pmac_ide_set_pio_mode,
.set_dma_mode   = pmac_ide_set_dma_mode,
.selectproc = pmac_ide_kauai_selectproc,
@@ -949,6 +965,7 @@ static const struct ide_port_ops pmac_id
 };
 
 static const struct ide_port_ops pmac_ide_ata4_port_ops = {
+   .init_dev   = pmac_ide_init_dev,
.set_pio_mode   = pmac_ide_set_pio_mode,
.set_dma_mode   = pmac_ide_set_dma_mode,
.selectproc = pmac_ide_selectproc,
@@ -956,6 +973,7 @@ static const struct ide_port_ops pmac_id
 };
 
 static const struct ide_port_ops pmac_ide_port_ops = {
+   .init_dev   = pmac_ide_init_dev,
.set_pio_mode   = pmac_ide_set_pio_mode,
.set_dma_mode   = pmac_ide_set_dma_mode,
.selectproc = pmac_ide_selectproc,
@@ -1065,15 +1083,6 @@ pmac_ide_setup_device(pmac_ide_hwif_t *p
   hwif-index, model_name[pmif-kind], pmif-aapl_bus_id,
   pmif-mediabay ?  (mediabay) : , hwif-irq);
 
-   if (pmif-mediabay) {
-#ifdef CONFIG_PMAC_MEDIABAY
-   if (check_media_bay(np-parent, MB_CD) == -ENODEV)
-   break;
-#endif
-   hwif-drives[0].noprobe = 1;
-   hwif-drives[1].noprobe = 1;
-   }
-
idx[0] = hwif-index;
 
ide_device_add(idx, d);
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 7/7] ide-pmac: move ide_find_port() call to pmac_ide_setup_device()

2008-06-12 Thread Bartlomiej Zolnierkiewicz
Move ide_find_port() call to pmac_ide_setup_device().

While at it:

- fix return value (s/-ENODEV/-ENOENT/)

- add DRV_NAME define and use it to set name field of pmac_port_info

- use ide_find_port_slot() instead of ide_find_port()

- remove superfluous error message (ide_find_port_slot() takes care of it)

- drop IDE interface number from driver banner message (but include bus type)

Cc: Benjamin Herrenschmidt [EMAIL PROTECTED]
Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ppc/pmac.c |   42 --
 1 file changed, 16 insertions(+), 26 deletions(-)

Index: b/drivers/ide/ppc/pmac.c
===
--- a/drivers/ide/ppc/pmac.c
+++ b/drivers/ide/ppc/pmac.c
@@ -48,6 +48,8 @@
 #include asm/mediabay.h
 #endif
 
+#define DRV_NAME ide-pmac
+
 #undef IDE_PMAC_DEBUG
 
 #define DMA_WAIT_TIMEOUT   50
@@ -982,6 +984,7 @@ static const struct ide_port_ops pmac_id
 static const struct ide_dma_ops pmac_dma_ops;
 
 static const struct ide_port_info pmac_port_info = {
+   .name   = DRV_NAME,
.init_dma   = pmac_ide_init_dma,
.chipset= ide_pmac,
 #ifdef CONFIG_BLK_DEV_IDEDMA_PMAC
@@ -1000,11 +1003,11 @@ static const struct ide_port_info pmac_p
  * Setup, register  probe an IDE channel driven by this driver, this is
  * called by one of the 2 probe functions (macio or PCI).
  */
-static int __devinit
-pmac_ide_setup_device(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif, hw_regs_t *hw)
+static int __devinit pmac_ide_setup_device(pmac_ide_hwif_t *pmif, hw_regs_t 
*hw)
 {
struct device_node *np = pmif-node;
const int *bidp;
+   ide_hwif_t *hwif;
u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
struct ide_port_info d = pmac_port_info;
 
@@ -1073,16 +1076,21 @@ pmac_ide_setup_device(pmac_ide_hwif_t *p
msleep(jiffies_to_msecs(IDE_WAKEUP_DELAY));
}
 
+   printk(KERN_INFO DRV_NAME : Found Apple %s controller (%s), 
+bus ID %d%s, irq %d\n, model_name[pmif-kind],
+pmif-mdev ? MacIO : PCI, pmif-aapl_bus_id,
+pmif-mediabay ?  (mediabay) : , hw.irq);
+
+   hwif = ide_find_port_slot(d);
+   if (hwif == NULL)
+   return -ENOENT;
+
/* Setup MMIO ops */
default_hwif_mmiops(hwif);
hwif-OUTBSYNC = pmac_outbsync;
 
ide_init_port_hw(hwif, hw);
 
-   printk(KERN_INFO ide%d: Found Apple %s controller, bus ID %d%s, irq 
%d\n,
-  hwif-index, model_name[pmif-kind], pmif-aapl_bus_id,
-  pmif-mediabay ?  (mediabay) : , hwif-irq);
-
idx[0] = hwif-index;
 
ide_device_add(idx, d);
@@ -1112,7 +1120,6 @@ pmac_ide_macio_attach(struct macio_dev *
 {
void __iomem *base;
unsigned long regbase;
-   ide_hwif_t *hwif;
pmac_ide_hwif_t *pmif;
int irq, rc;
hw_regs_t hw;
@@ -1121,14 +1128,6 @@ pmac_ide_macio_attach(struct macio_dev *
if (pmif == NULL)
return -ENOMEM;
 
-   hwif = ide_find_port();
-   if (hwif == NULL) {
-   printk(KERN_ERR ide-pmac: MacIO interface attach with no 
slot\n);
-   printk(KERN_ERR   %s\n, mdev-ofdev.node-full_name);
-   rc = -ENODEV;
-   goto out_free_pmif;
-   }
-
if (macio_resource_count(mdev) == 0) {
printk(KERN_WARNING ide-pmac: no address for %s\n,
mdev-ofdev.node-full_name);
@@ -1183,7 +1182,7 @@ pmac_ide_macio_attach(struct macio_dev *
hw.dev = mdev-bus-pdev-dev;
hw.parent = mdev-ofdev.dev;
 
-   rc = pmac_ide_setup_device(pmif, hwif, hw);
+   rc = pmac_ide_setup_device(pmif, hw);
if (rc != 0) {
/* The inteface is released to the common IDE layer */
dev_set_drvdata(mdev-ofdev.dev, NULL);
@@ -1242,7 +1241,6 @@ pmac_ide_macio_resume(struct macio_dev *
 static int __devinit
 pmac_ide_pci_attach(struct pci_dev *pdev, const struct pci_device_id *id)
 {
-   ide_hwif_t *hwif;
struct device_node *np;
pmac_ide_hwif_t *pmif;
void __iomem *base;
@@ -1260,14 +1258,6 @@ pmac_ide_pci_attach(struct pci_dev *pdev
if (pmif == NULL)
return -ENOMEM;
 
-   hwif = ide_find_port();
-   if (hwif == NULL) {
-   printk(KERN_ERR ide-pmac: PCI interface attach with no 
slot\n);
-   printk(KERN_ERR   %s\n, np-full_name);
-   rc = -ENODEV;
-   goto out_free_pmif;
-   }
-
if (pci_enable_device(pdev)) {
printk(KERN_WARNING ide-pmac: Can't enable PCI device for 
%s\n, np-full_name);
@@ -1304,7 +1294,7 @@ pmac_ide_pci_attach(struct pci_dev *pdev
hw.irq = pdev-irq;
hw.dev = pdev-dev;
 
-   rc = 

Re: dtc: Add support for binary includes.

2008-06-12 Thread David Gibson
On Thu, Jun 12, 2008 at 11:43:22AM -0500, Scott Wood wrote:
 On Wed, Jun 11, 2008 at 11:58:39AM +1000, David Gibson wrote:
  Scott's original patch does still have some implementation details I
  didn't like.  So in the interests of saving time, I've addressed some
  of those, added a testcase, and and now resubmitting my revised
  version of Scott's patch.
 
 Acked-by: Scott Wood [EMAIL PROTECTED]
 
  -struct data data_copy_file(FILE *f, size_t len)
  +struct data data_copy_file(FILE *f, size_t maxlen)
   {
  -   struct data d;
  +   struct data d = empty_data;
  +
  +   while (!feof(f)  (d.len  maxlen)) {
  +   size_t chunksize, ret;
  +
  +   if (maxlen == -1)
  +   chunksize = 4096;
  +   else
  +   chunksize = maxlen - d.len;
  +
  +   d = data_grow_for(d, chunksize);
  +   ret = fread(d.val + d.len, 1, chunksize, f);
  +
  +   if (ferror(f))
  +   die(Error reading file into data: %s, 
  strerror(errno));
 
 It'd be nice if we could keep the filename around for reporting here...

It would.  Well, I've been intending to clean up the input file
handling in several ways already, I'll see if that can be worked in.

-- 
David Gibson| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au  | minimalist, thank you.  NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: MMIO and gcc re-ordering issue

2008-06-12 Thread Benjamin Herrenschmidt
On Thu, 2008-06-12 at 09:07 -0600, Matthew Wilcox wrote:
 On Thu, Jun 05, 2008 at 06:43:53PM +1000, Benjamin Herrenschmidt wrote:
  Note that the powerpc implementation currently clears the flag
  on spin_lock and tests it on unlock. We are considering changing
  that to not touch the flag on spin_lock and just clear it whenever
  we do a sync (ie, on unlock, on explicit mmiowb, and possibly even
  on readl's where we happen to do sync's).
 
 Your current scheme sounds like it's broken for
 
 spin_lock(a)
 writel();
 spin_lock(b);
 spin_unlock(b);
 spin_unlock(a);

Which is why we are considering changing it :-)

But as Paulus said before, he did some measurement and we came to the
conclusion that (pending more measurements on a wider range of HW) we
may as well drop the whole scheme and make writel fully synchronous
instead.

Then, we can get some nice weakly ordered accessors and start adding
them with appropriate explicit barriers to the hot path of perf.
critical drivers we care about.

Cheers,
Ben.



___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH 02/19] powerpc: Split processor entitlement retrieval and gathering to helper routines

2008-06-12 Thread Stephen Rothwell
Hi Robert,

On Thu, 12 Jun 2008 17:08:58 -0500 Robert Jennings [EMAIL PROTECTED] wrote:

 - seq_printf(m, R4=0x%lx\n, h_entitled);
 - seq_printf(m, R5=0x%lx\n, h_unallocated);
 - seq_printf(m, R6=0x%lx\n, h_aggregation);
 - seq_printf(m, R7=0x%lx\n, h_resource);

This changes a user visible interface by removing the above.  I don't
know if this matters (probably not), but it should be mentioned in the
changelog.

 + if (new_entitled)
 + *new_weight = current_weight;
 +
 + if (new_weight)
 + *new_entitled = current_entitled;

These look fishy - checking one pointer for NULL and then updating via
the other pointer.

-- 
Cheers,
Stephen Rothwell[EMAIL PROTECTED]
http://www.canb.auug.org.au/~sfr/


pgpy042zLW0E2.pgp
Description: PGP signature
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev

Re: [PATCH 11/19] powerpc: iommu enablement for CMO

2008-06-12 Thread Olof Johansson
Hi,

Some comments and questions below.


-Olof

On Thu, Jun 12, 2008 at 05:19:36PM -0500, Robert Jennings wrote:
 Index: b/arch/powerpc/kernel/iommu.c
 ===
 --- a/arch/powerpc/kernel/iommu.c
 +++ b/arch/powerpc/kernel/iommu.c
 @@ -183,6 +183,49 @@ static unsigned long iommu_range_alloc(s
   return n;
  }
  
 +/** iommu_undo - Clear iommu_table bits without calling platform tce_free.
 + *
 + * @tbl - struct iommu_table to alter
 + * @dma_addr - DMA address to free entries for
 + * @npages - number of pages to free entries for
 + *
 + * This is the same as __iommu_free without the call to ppc_md.tce_free();

__iommu_free has the __ prepended to indicate that it's not locking.
Since this does the same, please keep the __. Also see comments below.

 + *
 + * To clean up after ppc_md.tce_build() errors we need to clear bits
 + * in the table without calling the ppc_md.tce_free() method; calling
 + * ppc_md.tce_free() could alter entries that were not touched due to a
 + * premature failure in ppc_md.tce_build().
 + *
 + * The ppc_md.tce_build() needs to perform its own clean up prior to
 + * returning its error.
 + */
 +static void iommu_undo(struct iommu_table *tbl, dma_addr_t dma_addr,
 +  unsigned int npages)
 +{
 + unsigned long entry, free_entry;
 +
 + entry = dma_addr  IOMMU_PAGE_SHIFT;
 + free_entry = entry - tbl-it_offset;
 +
 + if (((free_entry + npages)  tbl-it_size) ||
 + (entry  tbl-it_offset)) {
 + if (printk_ratelimit()) {
 + printk(KERN_INFO iommu_undo: invalid entry\n);
 + printk(KERN_INFO \tentry= 0x%lx\n, entry);
 + printk(KERN_INFO \tdma_addr = 0x%lx\n, (u64)dma_addr);
 + printk(KERN_INFO \tTable= 0x%lx\n, (u64)tbl);
 + printk(KERN_INFO \tbus# = 0x%lx\n, tbl-it_busno);
 + printk(KERN_INFO \tsize = 0x%lx\n, tbl-it_size);
 + printk(KERN_INFO \tstartOff = 0x%lx\n, 
 tbl-it_offset);
 + printk(KERN_INFO \tindex= 0x%lx\n, tbl-it_index);
 + WARN_ON(1);
 + }
 + return;
 + }
 +
 + iommu_area_free(tbl-it_map, free_entry, npages);
 +}

Ick, This should just be refactored to reuse code together with
iommu_free() instead of duplicating it. Also, the error checking
shouldn't be needed here.

Actually, is there harm in calling tce_free for these cases anyway? I'm
guessing it's not a performance critical path.

 @@ -275,7 +330,7 @@ int iommu_map_sg(struct device *dev, str
   dma_addr_t dma_next = 0, dma_addr;
   unsigned long flags;
   struct scatterlist *s, *outs, *segstart;
 - int outcount, incount, i;
 + int outcount, incount, i, rc = 0;
   unsigned int align;
   unsigned long handle;
   unsigned int max_seg_size;
 @@ -336,7 +391,10 @@ int iommu_map_sg(struct device *dev, str
   npages, entry, dma_addr);
  
   /* Insert into HW table */
 - ppc_md.tce_build(tbl, entry, npages, vaddr  IOMMU_PAGE_MASK, 
 direction);
 + rc = ppc_md.tce_build(tbl, entry, npages,
 +   vaddr  IOMMU_PAGE_MASK, direction);
 + if(unlikely(rc))
 + goto failure;
  
   /* If we are in an open segment, try merging */
   if (segstart != s) {
 @@ -399,7 +457,10 @@ int iommu_map_sg(struct device *dev, str
  
   vaddr = s-dma_address  IOMMU_PAGE_MASK;
   npages = iommu_num_pages(s-dma_address, s-dma_length);
 - __iommu_free(tbl, vaddr, npages);
 + if (!rc)
 + __iommu_free(tbl, vaddr, npages);
 + else
 + iommu_undo(tbl, vaddr, npages);

'rc' is a quite generic name to carry state this far away from where
it's set. Either a more descriptive name (build_fail, whatever), or if
the above is true, just call __iommu_free here as well.

 -static void tce_build_pSeriesLP(struct iommu_table *tbl, long tcenum,
 +static void tce_free_pSeriesLP(struct iommu_table*, long, long);
 +static void tce_freemulti_pSeriesLP(struct iommu_table*, long, long);
 +
 +static int tce_build_pSeriesLP(struct iommu_table *tbl, long tcenum,
   long npages, unsigned long uaddr,
   enum dma_data_direction direction)
  {
 - u64 rc;
 + u64 rc = 0;
   u64 proto_tce, tce;
   u64 rpn;
 + int sleep_msecs, ret = 0;
 + long tcenum_start = tcenum, npages_start = npages;
  
   rpn = (virt_to_abs(uaddr))  TCE_SHIFT;
   proto_tce = TCE_PCI_READ;
 @@ -108,7 +115,21 @@ static void tce_build_pSeriesLP(struct i
  
   while (npages--) {
   tce = proto_tce | (rpn  TCE_RPN_MASK)  TCE_RPN_SHIFT;
 - 

Re: dtc: Add support for binary includes.

2008-06-12 Thread David Gibson
On Thu, Jun 12, 2008 at 07:46:48PM -0500, Jon Loeliger wrote:
 David Gibson wrote:

 It'd be nice if we could keep the filename around for reporting here...

 It would.  Well, I've been intending to clean up the input file
 handling in several ways already, I'll see if that can be worked in.



 With Scott's ACK on this, I intend commit David's patch.
 So if you adjust the input file reporting here, please
 do it as an additional patch.

Oh, yes.  That was always my intention.

 And for the record, I will also make an official tagged
 release just after any such cleanup patch appears, or
 in the next couple days, whichever comes first.

Ok.  I doubt I'll have that cleanup done in the next couple of days.
It can wait until after the tag.

-- 
David Gibson| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au  | minimalist, thank you.  NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH 1/2] Added support for PRTLVT based boards (MPC5121)

2008-06-12 Thread David Gibson
On Thu, Jun 12, 2008 at 08:10:47AM -0600, Grant Likely wrote:
[snip]
  +   [EMAIL PROTECTED] {
  +   compatible = fsl,mpc5121-i2c-ctrl;
  +   reg = 0x1760 0x8;
  +   };
  +
  +   [EMAIL PROTECTED] {
 
 (nitpick) There is a recommended practice that says node names should
 be generic as much as possible, so I think this should probably be
 [EMAIL PROTECTED]  The compatible value is fine.

If this is a video display device, the recommended generic name is
[EMAIL PROTECTED], not [EMAIL PROTECTED].

-- 
David Gibson| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au  | minimalist, thank you.  NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: Merging seperate FDT-blobs?

2008-06-12 Thread David Gibson
On Thu, Jun 12, 2008 at 11:04:33AM +0200, Wolfram Sang wrote:
 Hello,
 
 a project I am working on consists of different hardware modules, which
 can be combined in a lot of variations (not at runtime, though). As each
 module shall contain an I2C-eeprom, the idea is now to put a fragment of
 a FDT-blob into that EEPROM and let the bootloader combine these
 fragments. Such an approach was also sketched by David Gibson recently.
 (http://ozlabs.org/pipermail/linuxppc-dev/2008-February/051630.html)
 
 (As a sidenote, I am not quite sure and could not find anything about
 what the mentioned 'fdt_graft' should actually do, in my case something
 like a 'fdt_add_blob_subnode' function would be sufficent, I guess.)

fdt_add_blob_subnode() sounds like it would do the same thing as I
envisaged fdt_graft() doing.

 My question: Is there already an effort towards such an approach to
 which I could contribute, or do I have to start from scratch?

I don't know of anyone who's implemented this specifically, but if you
do get there first, please do it on top of libfdt.

-- 
David Gibson| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au  | minimalist, thank you.  NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson


signature.asc
Description: Digital signature
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev

Re: [PATCH 12/19] powerpc: vio bus support for CMO

2008-06-12 Thread Stephen Rothwell
Hi Robert,

Firstly, can all this new stuff be ifdef'ed out if not needed as the
vio infrastructure is also used on legacy iSeries and this adds quite a
bit of stuff that won't ever be used there.

On Thu, 12 Jun 2008 17:19:59 -0500 Robert Jennings [EMAIL PROTECTED] wrote:

 +static int vio_cmo_num_OF_devs(void)
 +{
 + struct device_node *node_vroot;
 + int count = 0;
 +
 + /*
 +  * Count the number of vdevice entries with an
 +  * ibm,my-dma-window OF property
 +  */
 + node_vroot = of_find_node_by_name(NULL, vdevice);
 + if (node_vroot) {
 + struct device_node *of_node;
 + struct property *prop;
 +
 + for (of_node = node_vroot-child; of_node != NULL;
 + of_node = of_node-sibling) {

Use:
for_each_child_of_node(node_vroot, of_node) {


-- 
Cheers,
Stephen Rothwell[EMAIL PROTECTED]
http://www.canb.auug.org.au/~sfr/


pgpU9rH40jVeP.pgp
Description: PGP signature
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev

Re: [PATCH 16/19] ibmveth: Automatically enable larger rx buffer pools for larger mtu

2008-06-12 Thread Stephen Rothwell
Hi Robert,

On Thu, 12 Jun 2008 17:22:49 -0500 Robert Jennings [EMAIL PROTECTED] wrote:

 + /* Deactivate all the buffer pools so that the next loop can activate
 +only the buffer pools necessary to hold the new MTU */
 + for(i = 0; iIbmVethNumBufferPools; i++)

Please uses spaces after for and around binary operators.

-- 
Cheers,
Stephen Rothwell[EMAIL PROTECTED]
http://www.canb.auug.org.au/~sfr/


pgpKzB6R8jSbE.pgp
Description: PGP signature
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev

Re: [PATCH 17/19] ibmveth: enable driver for CMO

2008-06-12 Thread Stephen Rothwell
Hi Robert,

On Thu, 12 Jun 2008 17:23:11 -0500 Robert Jennings [EMAIL PROTECTED] wrote:

 + if(adapter-bounce_buffer != NULL) {

Space after if.  Here and elsewhere.

-- 
Cheers,
Stephen Rothwell[EMAIL PROTECTED]
http://www.canb.auug.org.au/~sfr/


pgphvgXx9uuaX.pgp
Description: PGP signature
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev