* Re: [PATCH v5] ibm_newemac: Parameterize EMAC Multicast Match Handling
From: Benjamin Herrenschmidt @ 2008-07-07 6:43 UTC (permalink / raw)
To: Stefan Roese; +Cc: linuxppc-dev, Grant Erickson
In-Reply-To: <200807070829.17340.sr@denx.de>
On Mon, 2008-07-07 at 08:29 +0200, Stefan Roese wrote:
> > Did you have a chance to do a bit of regression testing "just in case" ?
>
> No, not yet. I'll try to do some tests this week.
Thanks !
Cheers,
Ben.
^ permalink raw reply
* Re: [PATCH 1/2] elf loader support for auxvec base platform string
From: Roland McGrath @ 2008-07-07 6:35 UTC (permalink / raw)
To: benh; +Cc: linuxppc-dev, Nathan Lynch, linux-kernel, Paul Mackerras
In-Reply-To: <1215411800.8970.91.camel@pasglop>
> I'm not sure... if ld.conf.d isn't parse of the kernel source tree then
> it -will- end in tears...
Of course, you should include the file you want people to install
as part of the kernel source or build. You can copy it into
place in make install or something if you like (convention is to
call it something.conf in /etc/ld.so.conf.d); then run ldconfig.
The x86-xen case has not bothered to include its one-line file as
such, just the comment in arch/x86/vdso/vdso32/note.S telling you
what it is.
Thanks,
Roland
^ permalink raw reply
* [PATCH] powerpc: Fix unterminated of_device_id array in legacy_serial.c
From: Benjamin Herrenschmidt @ 2008-07-07 6:39 UTC (permalink / raw)
To: Linus Torvalds; +Cc: linuxppc-dev
A recent patch to legacy_serial.c factored out some code by
using the of_match_node() facility to match a node against
an array of possible matches. However, the patch didn't properly
terminate the array causing potential crashes in cases where no
match is found. In addition, the name of the array was poorly
chosen for a static symbol making debugging harder.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---
Linus, any chance you can still stick that in .26 ?
arch/powerpc/kernel/legacy_serial.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
--- linux-work.orig/arch/powerpc/kernel/legacy_serial.c 2008-07-07 16:34:05.000000000 +1000
+++ linux-work/arch/powerpc/kernel/legacy_serial.c 2008-07-07 16:36:06.000000000 +1000
@@ -33,13 +33,14 @@ static struct legacy_serial_info {
phys_addr_t taddr;
} legacy_serial_infos[MAX_LEGACY_SERIAL_PORTS];
-static struct __initdata of_device_id parents[] = {
+static struct __initdata of_device_id legacy_serial_parents[] = {
{.type = "soc",},
{.type = "tsi-bridge",},
{.type = "opb", },
{.compatible = "ibm,opb",},
{.compatible = "simple-bus",},
{.compatible = "wrs,epld-localbus",},
+ {},
};
static unsigned int legacy_serial_count;
@@ -322,7 +323,7 @@ void __init find_legacy_serial_ports(voi
struct device_node *parent = of_get_parent(np);
if (!parent)
continue;
- if (of_match_node(parents, parent) != NULL) {
+ if (of_match_node(legacy_serial_parents, parent) != NULL) {
index = add_legacy_soc_port(np, np);
if (index >= 0 && np == stdout)
legacy_serial_console = index;
^ permalink raw reply
* Re: [PATCH] powerpc: reduce code duplication in legacy_serial, add UART parent types
From: Benjamin Herrenschmidt @ 2008-07-07 6:33 UTC (permalink / raw)
To: Kumar Gala; +Cc: scottwood, Paul Gortmaker, arnd, linuxppc-dev
In-Reply-To: <Pine.LNX.4.64.0801250216530.9153@blarg.am.freescale.net>
On Fri, 2008-01-25 at 02:17 -0600, Kumar Gala wrote:
> > The legacy_serial was treating each UART parent in a separate code block.
> > Rather than continue this trend for the new parent IDs, this condenses
> > all (soc, tsi, opb, plus two more new types) into one of_device_id array.
> > The new types are wrs,epld-localbus for the Wind River sbc8560, and a
> > more generic "simple-bus" as requested by Scott Wood.
> >
> > Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
> > ---
> > arch/powerpc/kernel/legacy_serial.c | 45 +++++++++++++---------------------
> > 1 files changed, 17 insertions(+), 28 deletions(-)
> >
> applied
(Catching that old patch on patchworks by accident)
Hrm... please next time don't take patches to generic stuff like
legacy_serial through your tree. This one has definitely not been
properly reviewed.
In this case, there are at least two problems with the patch:
- The parents array should be called something better, as-is, go figure
where you crashed when all you find is a symbol called "parents"
- The array isn't terminated (or did I miss something ?) which means
that non-matching parents will probably crash.
Ben.
^ permalink raw reply
* Re: [PATCH v5] ibm_newemac: Parameterize EMAC Multicast Match Handling
From: Stefan Roese @ 2008-07-07 6:29 UTC (permalink / raw)
To: linuxppc-dev, benh; +Cc: Grant Erickson
In-Reply-To: <1215410405.8970.84.camel@pasglop>
On Monday 07 July 2008, Benjamin Herrenschmidt wrote:
> On Mon, 2008-07-07 at 07:58 +0200, Stefan Roese wrote:
> > On Monday 07 July 2008, Grant Erickson wrote:
> > > Various instances of the EMAC core have varying: 1) number of address
> > > match slots, 2) width of the registers for handling address match
> > > slots, 3) number of registers for handling address match slots and 4)
> > > base offset for those registers.
> >
> > <snip>
> >
> > > Signed-off-by: Grant Erickson <gerickson@nuovations.com>
> >
> > Acked-by: Stefan Roese <sr@denx.de>
>
> Did you have a chance to do a bit of regression testing "just in case" ?
No, not yet. I'll try to do some tests this week.
Best regards,
Stefan
^ permalink raw reply
* Re: [patch 05/11] powerpc/cell: add spu aware cpufreq governor
From: Stephen Rothwell @ 2008-07-07 6:24 UTC (permalink / raw)
To: arnd; +Cc: Paul Mackerras, cbe-oss-dev, Christian Krafft, linuxppc-dev
In-Reply-To: <20080704190806.162475834@arndb.de>
[-- Attachment #1: Type: text/plain, Size: 990 bytes --]
Just a couple of trivial things.
On Fri, 04 Jul 2008 21:05:40 +0200 arnd@arndb.de wrote:
>
> + * (C) Copyright IBM Corporation 2006-2008
^^^
You should use ©.
> +#define POLL_TIME 100000 /* in us */
^
How about μ ?
> +struct spu_gov_info_struct {
> + unsigned long busy_spus; /* fixed-point */
> + struct cpufreq_policy *policy;
> + struct delayed_work work;
> + unsigned int poll_int; /* us */
And again.
> +static int calc_freq(struct spu_gov_info_struct *info)
> +{
> + int cpu;
> + int busy_spus;
> +
> + cpu = info->policy->cpu;
> + busy_spus = atomic_read(&cbe_spu_info[cpu_to_node(cpu)].busy_spus);
> +
> + CALC_LOAD(info->busy_spus, EXP, busy_spus * FIXED_1);
> + pr_debug(KERN_ERR "cpu %d: busy_spus=%d, info->busy_spus=%d\n", cpu, busy_spus, info->busy_spus);
Split this line.
--
Cheers,
Stephen Rothwell sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/
[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply
* Re: [PATCH 1/2] elf loader support for auxvec base platform string
From: Benjamin Herrenschmidt @ 2008-07-07 6:23 UTC (permalink / raw)
To: Roland McGrath; +Cc: linuxppc-dev, Nathan Lynch, linux-kernel, Paul Mackerras
In-Reply-To: <20080707061811.19989154246@magilla.localdomain>
On Sun, 2008-07-06 at 23:18 -0700, Roland McGrath wrote:
>
> Using dsocaps gives you the best of both worlds. You can freely choose
> new strings in the kernel without the ld.so code having to know about
> them (which is not true of AT_PLATFORM, but may be true of how you are
> thinking about "strings are nice"). You do have to map all the
> possibilities that a single kernel build can produce into distinct bits.
> But, there are 32 unallocated bits to start with. Moreover, those bit
> assignments are not part of any permanent ABI like bits in AT_* values.
> They just have to match up between this kernel build and the ld.conf.d
> file installed along with it--kernel hackers and kernel packagers have
> to coordinate, not kernel hackers and userland hackers.
I'm not sure... if ld.conf.d isn't parse of the kernel source tree then
it -will- end in tears...
Ben.
^ permalink raw reply
* Re: [PATCH v5] ibm_newemac: Parameterize EMAC Multicast Match Handling
From: Benjamin Herrenschmidt @ 2008-07-07 6:18 UTC (permalink / raw)
To: Jeff Garzik; +Cc: linuxppc-dev, sr, Grant Erickson
In-Reply-To: <1215387012-6464-1-git-send-email-gerickson@nuovations.com>
Hi Jeff !
If you are ok with this patch, I'll take it through the powerpc tree
since it changes all those device tree files.
Cheers,
Ben.
On Sun, 2008-07-06 at 16:30 -0700, Grant Erickson wrote:
> Various instances of the EMAC core have varying: 1) number of address
> match slots, 2) width of the registers for handling address match slots,
> 3) number of registers for handling address match slots and 4) base
> offset for those registers.
>
> As the driver stands today, it assumes that all EMACs have 4 IAHT and
> GAHT 32-bit registers, starting at offset 0x30 from the register base,
> with only 16-bits of each used for a total of 64 match slots.
>
> The 405EX(r) and 460EX now use the EMAC4SYNC core rather than the EMAC4
> core. This core has 8 IAHT and GAHT registers, starting at offset 0x80
> from the register base, with ALL 32-bits of each used for a total of
> 256 match slots.
>
> This adds a new compatible device tree entry "emac4sync" and a new,
> related feature flag "EMAC_FTR_EMAC4SYNC" along with a series of macros
> and inlines which supply the appropriate parameterized value based on
> the presence or absence of the EMAC4SYNC feature.
>
> The code has further been reworked where appropriate to use those macros
> and inlines.
>
> In addition, the register size passed to ioremap is now taken from the
> device tree:
>
> c4 for EMAC4SYNC cores
> 74 for EMAC4 cores
> 70 for EMAC cores
>
> rather than sizeof (emac_regs).
>
> Finally, the device trees have been updated with the appropriate compatible
> entries and resource sizes.
>
> This has been tested on an AMCC Haleakala board such that: 1) inbound
> ICMP requests to 'haleakala.local' via MDNS from both Mac OS X 10.4.11
> and Ubuntu 8.04 systems as well as 2) outbound ICMP requests from
> 'haleakala.local' to those same systems in the '.local' domain via MDNS
> now work.
>
> Signed-off-by: Grant Erickson <gerickson@nuovations.com>
> ---
> arch/powerpc/boot/dts/canyonlands.dts | 8 +-
> arch/powerpc/boot/dts/glacier.dts | 8 +-
> arch/powerpc/boot/dts/haleakala.dts | 4 +-
> arch/powerpc/boot/dts/katmai.dts | 2 +-
> arch/powerpc/boot/dts/kilauea.dts | 8 +-
> arch/powerpc/boot/dts/makalu.dts | 8 +-
> arch/powerpc/boot/dts/rainier.dts | 4 +-
> arch/powerpc/boot/dts/sequoia.dts | 4 +-
> arch/powerpc/boot/dts/taishan.dts | 8 +-
> drivers/net/ibm_newemac/core.c | 61 ++++++++++++++------
> drivers/net/ibm_newemac/core.h | 83 ++++++++++++++++++++++++++-
> drivers/net/ibm_newemac/debug.c | 52 +++++++++++++----
> drivers/net/ibm_newemac/emac.h | 101 ++++++++++++++++++++++----------
> 13 files changed, 259 insertions(+), 92 deletions(-)
>
> diff --git a/arch/powerpc/boot/dts/canyonlands.dts b/arch/powerpc/boot/dts/canyonlands.dts
> index 3963412..8b82d47 100644
> --- a/arch/powerpc/boot/dts/canyonlands.dts
> +++ b/arch/powerpc/boot/dts/canyonlands.dts
> @@ -264,7 +264,7 @@
>
> EMAC0: ethernet@ef600e00 {
> device_type = "network";
> - compatible = "ibm,emac-460ex", "ibm,emac4";
> + compatible = "ibm,emac-460ex", "ibm,emac4sync";
> interrupt-parent = <&EMAC0>;
> interrupts = <0 1>;
> #interrupt-cells = <1>;
> @@ -272,7 +272,7 @@
> #size-cells = <0>;
> interrupt-map = </*Status*/ 0 &UIC2 10 4
> /*Wake*/ 1 &UIC2 14 4>;
> - reg = <ef600e00 70>;
> + reg = <ef600e00 c4>;
> local-mac-address = [000000000000]; /* Filled in by U-Boot */
> mal-device = <&MAL0>;
> mal-tx-channel = <0>;
> @@ -293,7 +293,7 @@
>
> EMAC1: ethernet@ef600f00 {
> device_type = "network";
> - compatible = "ibm,emac-460ex", "ibm,emac4";
> + compatible = "ibm,emac-460ex", "ibm,emac4sync";
> interrupt-parent = <&EMAC1>;
> interrupts = <0 1>;
> #interrupt-cells = <1>;
> @@ -301,7 +301,7 @@
> #size-cells = <0>;
> interrupt-map = </*Status*/ 0 &UIC2 11 4
> /*Wake*/ 1 &UIC2 15 4>;
> - reg = <ef600f00 70>;
> + reg = <ef600f00 c4>;
> local-mac-address = [000000000000]; /* Filled in by U-Boot */
> mal-device = <&MAL0>;
> mal-tx-channel = <1>;
> diff --git a/arch/powerpc/boot/dts/glacier.dts b/arch/powerpc/boot/dts/glacier.dts
> index 0f2fc07..8ffde9b 100644
> --- a/arch/powerpc/boot/dts/glacier.dts
> +++ b/arch/powerpc/boot/dts/glacier.dts
> @@ -281,7 +281,7 @@
> #size-cells = <0>;
> interrupt-map = </*Status*/ 0 &UIC2 10 4
> /*Wake*/ 1 &UIC2 14 4>;
> - reg = <ef600e00 70>;
> + reg = <ef600e00 74>;
> local-mac-address = [000000000000]; /* Filled in by U-Boot */
> mal-device = <&MAL0>;
> mal-tx-channel = <0>;
> @@ -310,7 +310,7 @@
> #size-cells = <0>;
> interrupt-map = </*Status*/ 0 &UIC2 11 4
> /*Wake*/ 1 &UIC2 15 4>;
> - reg = <ef600f00 70>;
> + reg = <ef600f00 74>;
> local-mac-address = [000000000000]; /* Filled in by U-Boot */
> mal-device = <&MAL0>;
> mal-tx-channel = <1>;
> @@ -340,7 +340,7 @@
> #size-cells = <0>;
> interrupt-map = </*Status*/ 0 &UIC2 12 4
> /*Wake*/ 1 &UIC2 16 4>;
> - reg = <ef601100 70>;
> + reg = <ef601100 74>;
> local-mac-address = [000000000000]; /* Filled in by U-Boot */
> mal-device = <&MAL0>;
> mal-tx-channel = <2>;
> @@ -368,7 +368,7 @@
> #size-cells = <0>;
> interrupt-map = </*Status*/ 0 &UIC2 13 4
> /*Wake*/ 1 &UIC2 17 4>;
> - reg = <ef601200 70>;
> + reg = <ef601200 74>;
> local-mac-address = [000000000000]; /* Filled in by U-Boot */
> mal-device = <&MAL0>;
> mal-tx-channel = <3>;
> diff --git a/arch/powerpc/boot/dts/haleakala.dts b/arch/powerpc/boot/dts/haleakala.dts
> index b5d95ac..d131c00 100644
> --- a/arch/powerpc/boot/dts/haleakala.dts
> +++ b/arch/powerpc/boot/dts/haleakala.dts
> @@ -204,7 +204,7 @@
> EMAC0: ethernet@ef600900 {
> linux,network-index = <0>;
> device_type = "network";
> - compatible = "ibm,emac-405exr", "ibm,emac4";
> + compatible = "ibm,emac-405exr", "ibm,emac4sync";
> interrupt-parent = <&EMAC0>;
> interrupts = <0 1>;
> #interrupt-cells = <1>;
> @@ -212,7 +212,7 @@
> #size-cells = <0>;
> interrupt-map = </*Status*/ 0 &UIC0 18 4
> /*Wake*/ 1 &UIC1 1d 4>;
> - reg = <ef600900 70>;
> + reg = <ef600900 c4>;
> local-mac-address = [000000000000]; /* Filled in by U-Boot */
> mal-device = <&MAL0>;
> mal-tx-channel = <0>;
> diff --git a/arch/powerpc/boot/dts/katmai.dts b/arch/powerpc/boot/dts/katmai.dts
> index cc2873a..c91bb66 100644
> --- a/arch/powerpc/boot/dts/katmai.dts
> +++ b/arch/powerpc/boot/dts/katmai.dts
> @@ -206,7 +206,7 @@
> compatible = "ibm,emac-440spe", "ibm,emac4";
> interrupt-parent = <&UIC1>;
> interrupts = <1c 4 1d 4>;
> - reg = <10000800 70>;
> + reg = <10000800 74>;
> local-mac-address = [000000000000];
> mal-device = <&MAL0>;
> mal-tx-channel = <0>;
> diff --git a/arch/powerpc/boot/dts/kilauea.dts b/arch/powerpc/boot/dts/kilauea.dts
> index 48c9a6e..799592d 100644
> --- a/arch/powerpc/boot/dts/kilauea.dts
> +++ b/arch/powerpc/boot/dts/kilauea.dts
> @@ -205,7 +205,7 @@
> EMAC0: ethernet@ef600900 {
> linux,network-index = <0>;
> device_type = "network";
> - compatible = "ibm,emac-405ex", "ibm,emac4";
> + compatible = "ibm,emac-405ex", "ibm,emac4sync";
> interrupt-parent = <&EMAC0>;
> interrupts = <0 1>;
> #interrupt-cells = <1>;
> @@ -213,7 +213,7 @@
> #size-cells = <0>;
> interrupt-map = </*Status*/ 0 &UIC0 18 4
> /*Wake*/ 1 &UIC1 1d 4>;
> - reg = <ef600900 70>;
> + reg = <ef600900 c4>;
> local-mac-address = [000000000000]; /* Filled in by U-Boot */
> mal-device = <&MAL0>;
> mal-tx-channel = <0>;
> @@ -233,7 +233,7 @@
> EMAC1: ethernet@ef600a00 {
> linux,network-index = <1>;
> device_type = "network";
> - compatible = "ibm,emac-405ex", "ibm,emac4";
> + compatible = "ibm,emac-405ex", "ibm,emac4sync";
> interrupt-parent = <&EMAC1>;
> interrupts = <0 1>;
> #interrupt-cells = <1>;
> @@ -241,7 +241,7 @@
> #size-cells = <0>;
> interrupt-map = </*Status*/ 0 &UIC0 19 4
> /*Wake*/ 1 &UIC1 1f 4>;
> - reg = <ef600a00 70>;
> + reg = <ef600900 c4>;
> local-mac-address = [000000000000]; /* Filled in by U-Boot */
> mal-device = <&MAL0>;
> mal-tx-channel = <1>;
> diff --git a/arch/powerpc/boot/dts/makalu.dts b/arch/powerpc/boot/dts/makalu.dts
> index 84cc5e7..4295772 100644
> --- a/arch/powerpc/boot/dts/makalu.dts
> +++ b/arch/powerpc/boot/dts/makalu.dts
> @@ -205,7 +205,7 @@
> EMAC0: ethernet@ef600900 {
> linux,network-index = <0>;
> device_type = "network";
> - compatible = "ibm,emac-405ex", "ibm,emac4";
> + compatible = "ibm,emac-405ex", "ibm,emac4sync";
> interrupt-parent = <&EMAC0>;
> interrupts = <0 1>;
> #interrupt-cells = <1>;
> @@ -213,7 +213,7 @@
> #size-cells = <0>;
> interrupt-map = </*Status*/ 0 &UIC0 18 4
> /*Wake*/ 1 &UIC1 1d 4>;
> - reg = <ef600900 70>;
> + reg = <ef600900 c4>;
> local-mac-address = [000000000000]; /* Filled in by U-Boot */
> mal-device = <&MAL0>;
> mal-tx-channel = <0>;
> @@ -233,7 +233,7 @@
> EMAC1: ethernet@ef600a00 {
> linux,network-index = <1>;
> device_type = "network";
> - compatible = "ibm,emac-405ex", "ibm,emac4";
> + compatible = "ibm,emac-405ex", "ibm,emac4sync";
> interrupt-parent = <&EMAC1>;
> interrupts = <0 1>;
> #interrupt-cells = <1>;
> @@ -241,7 +241,7 @@
> #size-cells = <0>;
> interrupt-map = </*Status*/ 0 &UIC0 19 4
> /*Wake*/ 1 &UIC1 1f 4>;
> - reg = <ef600a00 70>;
> + reg = <ef600900 c4>;
> local-mac-address = [000000000000]; /* Filled in by U-Boot */
> mal-device = <&MAL0>;
> mal-tx-channel = <1>;
> diff --git a/arch/powerpc/boot/dts/rainier.dts b/arch/powerpc/boot/dts/rainier.dts
> index 6a8fa70..026c22c 100644
> --- a/arch/powerpc/boot/dts/rainier.dts
> +++ b/arch/powerpc/boot/dts/rainier.dts
> @@ -263,7 +263,7 @@
> #size-cells = <0>;
> interrupt-map = </*Status*/ 0 &UIC0 18 4
> /*Wake*/ 1 &UIC1 1d 4>;
> - reg = <ef600e00 70>;
> + reg = <ef600e00 74>;
> local-mac-address = [000000000000];
> mal-device = <&MAL0>;
> mal-tx-channel = <0>;
> @@ -292,7 +292,7 @@
> #size-cells = <0>;
> interrupt-map = </*Status*/ 0 &UIC0 19 4
> /*Wake*/ 1 &UIC1 1f 4>;
> - reg = <ef600f00 70>;
> + reg = <ef600f00 74>;
> local-mac-address = [000000000000];
> mal-device = <&MAL0>;
> mal-tx-channel = <1>;
> diff --git a/arch/powerpc/boot/dts/sequoia.dts b/arch/powerpc/boot/dts/sequoia.dts
> index 72d6756..8d66c99 100644
> --- a/arch/powerpc/boot/dts/sequoia.dts
> +++ b/arch/powerpc/boot/dts/sequoia.dts
> @@ -278,7 +278,7 @@
> #size-cells = <0>;
> interrupt-map = </*Status*/ 0 &UIC0 18 4
> /*Wake*/ 1 &UIC1 1d 4>;
> - reg = <ef600e00 70>;
> + reg = <ef600e00 74>;
> local-mac-address = [000000000000];
> mal-device = <&MAL0>;
> mal-tx-channel = <0>;
> @@ -307,7 +307,7 @@
> #size-cells = <0>;
> interrupt-map = </*Status*/ 0 &UIC0 19 4
> /*Wake*/ 1 &UIC1 1f 4>;
> - reg = <ef600f00 70>;
> + reg = <ef600f00 74>;
> local-mac-address = [000000000000];
> mal-device = <&MAL0>;
> mal-tx-channel = <1>;
> diff --git a/arch/powerpc/boot/dts/taishan.dts b/arch/powerpc/boot/dts/taishan.dts
> index e808e1c..f736d87 100644
> --- a/arch/powerpc/boot/dts/taishan.dts
> +++ b/arch/powerpc/boot/dts/taishan.dts
> @@ -258,7 +258,7 @@
> compatible = "ibm,emac-440gx", "ibm,emac4";
> interrupt-parent = <&UIC1>;
> interrupts = <1c 4 1d 4>;
> - reg = <40000800 70>;
> + reg = <40000800 74>;
> local-mac-address = [000000000000]; // Filled in by zImage
> mal-device = <&MAL0>;
> mal-tx-channel = <0>;
> @@ -278,7 +278,7 @@
> compatible = "ibm,emac-440gx", "ibm,emac4";
> interrupt-parent = <&UIC1>;
> interrupts = <1e 4 1f 4>;
> - reg = <40000900 70>;
> + reg = <40000900 74>;
> local-mac-address = [000000000000]; // Filled in by zImage
> mal-device = <&MAL0>;
> mal-tx-channel = <1>;
> @@ -298,7 +298,7 @@
> compatible = "ibm,emac-440gx", "ibm,emac4";
> interrupt-parent = <&UIC2>;
> interrupts = <0 4 1 4>;
> - reg = <40000c00 70>;
> + reg = <40000c00 74>;
> local-mac-address = [000000000000]; // Filled in by zImage
> mal-device = <&MAL0>;
> mal-tx-channel = <2>;
> @@ -322,7 +322,7 @@
> compatible = "ibm,emac-440gx", "ibm,emac4";
> interrupt-parent = <&UIC2>;
> interrupts = <2 4 3 4>;
> - reg = <40000e00 70>;
> + reg = <40000e00 74>;
> local-mac-address = [000000000000]; // Filled in by zImage
> mal-device = <&MAL0>;
> mal-tx-channel = <3>;
> diff --git a/drivers/net/ibm_newemac/core.c b/drivers/net/ibm_newemac/core.c
> index 5d2108c..ed24a1d 100644
> --- a/drivers/net/ibm_newemac/core.c
> +++ b/drivers/net/ibm_newemac/core.c
> @@ -363,25 +363,31 @@ static int emac_reset(struct emac_instance *dev)
>
> static void emac_hash_mc(struct emac_instance *dev)
> {
> - struct emac_regs __iomem *p = dev->emacp;
> - u16 gaht[4] = { 0 };
> + const int regs = EMAC_XAHT_REGS(dev);
> + u32 *gaht_base = emac_gaht_base(dev);
> + u32 gaht_temp[regs];
> struct dev_mc_list *dmi;
> + int i;
>
> DBG(dev, "hash_mc %d" NL, dev->ndev->mc_count);
>
> + memset(gaht_temp, 0, sizeof (gaht_temp));
> +
> for (dmi = dev->ndev->mc_list; dmi; dmi = dmi->next) {
> - int bit;
> + int slot, reg, mask;
> DBG2(dev, "mc %02x:%02x:%02x:%02x:%02x:%02x" NL,
> dmi->dmi_addr[0], dmi->dmi_addr[1], dmi->dmi_addr[2],
> dmi->dmi_addr[3], dmi->dmi_addr[4], dmi->dmi_addr[5]);
>
> - bit = 63 - (ether_crc(ETH_ALEN, dmi->dmi_addr) >> 26);
> - gaht[bit >> 4] |= 0x8000 >> (bit & 0x0f);
> + slot = EMAC_XAHT_CRC_TO_SLOT(dev, ether_crc(ETH_ALEN, dmi->dmi_addr));
> + reg = EMAC_XAHT_SLOT_TO_REG(dev, slot);
> + mask = EMAC_XAHT_SLOT_TO_MASK(dev, slot);
> +
> + gaht_temp[reg] |= mask;
> }
> - out_be32(&p->gaht1, gaht[0]);
> - out_be32(&p->gaht2, gaht[1]);
> - out_be32(&p->gaht3, gaht[2]);
> - out_be32(&p->gaht4, gaht[3]);
> +
> + for (i = 0; i < regs; i++)
> + out_be32(gaht_base + i, gaht_temp[i]);
> }
>
> static inline u32 emac_iff2rmr(struct net_device *ndev)
> @@ -398,7 +404,8 @@ static inline u32 emac_iff2rmr(struct net_device *ndev)
>
> if (ndev->flags & IFF_PROMISC)
> r |= EMAC_RMR_PME;
> - else if (ndev->flags & IFF_ALLMULTI || ndev->mc_count > 32)
> + else if (ndev->flags & IFF_ALLMULTI ||
> + (ndev->mc_count > EMAC_XAHT_SLOTS(dev)))
> r |= EMAC_RMR_PMME;
> else if (ndev->mc_count > 0)
> r |= EMAC_RMR_MAE;
> @@ -542,7 +549,7 @@ static int emac_configure(struct emac_instance *dev)
> /* Put some arbitrary OUI, Manuf & Rev IDs so we can
> * identify this GPCS PHY later.
> */
> - out_be32(&p->ipcr, 0xdeadbeef);
> + out_be32(&p->u1.emac4.ipcr, 0xdeadbeef);
> } else
> mr1 |= EMAC_MR1_MF_1000;
>
> @@ -2015,10 +2022,10 @@ static int emac_get_regs_len(struct emac_instance *dev)
> {
> if (emac_has_feature(dev, EMAC_FTR_EMAC4))
> return sizeof(struct emac_ethtool_regs_subhdr) +
> - EMAC4_ETHTOOL_REGS_SIZE;
> + EMAC4_ETHTOOL_REGS_SIZE(dev);
> else
> return sizeof(struct emac_ethtool_regs_subhdr) +
> - EMAC_ETHTOOL_REGS_SIZE;
> + EMAC_ETHTOOL_REGS_SIZE(dev);
> }
>
> static int emac_ethtool_get_regs_len(struct net_device *ndev)
> @@ -2045,12 +2052,12 @@ static void *emac_dump_regs(struct emac_instance *dev, void *buf)
> hdr->index = dev->cell_index;
> if (emac_has_feature(dev, EMAC_FTR_EMAC4)) {
> hdr->version = EMAC4_ETHTOOL_REGS_VER;
> - memcpy_fromio(hdr + 1, dev->emacp, EMAC4_ETHTOOL_REGS_SIZE);
> - return ((void *)(hdr + 1) + EMAC4_ETHTOOL_REGS_SIZE);
> + memcpy_fromio(hdr + 1, dev->emacp, EMAC4_ETHTOOL_REGS_SIZE(dev));
> + return ((void *)(hdr + 1) + EMAC4_ETHTOOL_REGS_SIZE(dev));
> } else {
> hdr->version = EMAC_ETHTOOL_REGS_VER;
> - memcpy_fromio(hdr + 1, dev->emacp, EMAC_ETHTOOL_REGS_SIZE);
> - return ((void *)(hdr + 1) + EMAC_ETHTOOL_REGS_SIZE);
> + memcpy_fromio(hdr + 1, dev->emacp, EMAC_ETHTOOL_REGS_SIZE(dev));
> + return ((void *)(hdr + 1) + EMAC_ETHTOOL_REGS_SIZE(dev));
> }
> }
>
> @@ -2540,7 +2547,9 @@ static int __devinit emac_init_config(struct emac_instance *dev)
> }
>
> /* Check EMAC version */
> - if (of_device_is_compatible(np, "ibm,emac4")) {
> + if (of_device_is_compatible(np, "ibm,emac4sync")) {
> + dev->features |= (EMAC_FTR_EMAC4 | EMAC_FTR_EMAC4SYNC);
> + } else if (of_device_is_compatible(np, "ibm,emac4")) {
> dev->features |= EMAC_FTR_EMAC4;
> if (of_device_is_compatible(np, "ibm,emac-440gx"))
> dev->features |= EMAC_FTR_440GX_PHY_CLK_FIX;
> @@ -2601,6 +2610,15 @@ static int __devinit emac_init_config(struct emac_instance *dev)
> }
> memcpy(dev->ndev->dev_addr, p, 6);
>
> + /* IAHT and GAHT filter parameterization */
> + if (emac_has_feature(dev, EMAC_FTR_EMAC4SYNC)) {
> + dev->xaht_slots_shift = EMAC4SYNC_XAHT_SLOTS_SHIFT;
> + dev->xaht_width_shift = EMAC4SYNC_XAHT_WIDTH_SHIFT;
> + } else {
> + dev->xaht_slots_shift = EMAC4_XAHT_SLOTS_SHIFT;
> + dev->xaht_width_shift = EMAC4_XAHT_WIDTH_SHIFT;
> + }
> +
> DBG(dev, "features : 0x%08x / 0x%08x\n", dev->features, EMAC_FTRS_POSSIBLE);
> DBG(dev, "tx_fifo_size : %d (%d gige)\n", dev->tx_fifo_size, dev->tx_fifo_size_gige);
> DBG(dev, "rx_fifo_size : %d (%d gige)\n", dev->rx_fifo_size, dev->rx_fifo_size_gige);
> @@ -2672,7 +2690,8 @@ static int __devinit emac_probe(struct of_device *ofdev,
> goto err_irq_unmap;
> }
> // TODO : request_mem_region
> - dev->emacp = ioremap(dev->rsrc_regs.start, sizeof(struct emac_regs));
> + dev->emacp = ioremap(dev->rsrc_regs.start,
> + dev->rsrc_regs.end - dev->rsrc_regs.start + 1);
> if (dev->emacp == NULL) {
> printk(KERN_ERR "%s: Can't map device registers!\n",
> np->full_name);
> @@ -2884,6 +2903,10 @@ static struct of_device_id emac_match[] =
> .type = "network",
> .compatible = "ibm,emac4",
> },
> + {
> + .type = "network",
> + .compatible = "ibm,emac4sync",
> + },
> {},
> };
>
> diff --git a/drivers/net/ibm_newemac/core.h b/drivers/net/ibm_newemac/core.h
> index 1683db9..70794cd 100644
> --- a/drivers/net/ibm_newemac/core.h
> +++ b/drivers/net/ibm_newemac/core.h
> @@ -235,6 +235,10 @@ struct emac_instance {
> u32 fifo_entry_size;
> u32 mal_burst_size; /* move to MAL ? */
>
> + /* IAHT and GAHT filter parameterization */
> + u32 xaht_slots_shift;
> + u32 xaht_width_shift;
> +
> /* Descriptor management
> */
> struct mal_descriptor *tx_desc;
> @@ -309,6 +313,10 @@ struct emac_instance {
> * Set if we need phy clock workaround for 440ep or 440gr
> */
> #define EMAC_FTR_440EP_PHY_CLK_FIX 0x00000100
> +/*
> + * The 405EX and 460EX contain the EMAC4SYNC core
> + */
> +#define EMAC_FTR_EMAC4SYNC 0x00000200
>
>
> /* Right now, we don't quite handle the always/possible masks on the
> @@ -320,7 +328,8 @@ enum {
>
> EMAC_FTRS_POSSIBLE =
> #ifdef CONFIG_IBM_NEW_EMAC_EMAC4
> - EMAC_FTR_EMAC4 | EMAC_FTR_HAS_NEW_STACR |
> + EMAC_FTR_EMAC4 | EMAC_FTR_EMAC4SYNC |
> + EMAC_FTR_HAS_NEW_STACR |
> EMAC_FTR_STACR_OC_INVERT | EMAC_FTR_440GX_PHY_CLK_FIX |
> #endif
> #ifdef CONFIG_IBM_NEW_EMAC_TAH
> @@ -342,6 +351,71 @@ static inline int emac_has_feature(struct emac_instance *dev,
> (EMAC_FTRS_POSSIBLE & dev->features & feature);
> }
>
> +/*
> + * Various instances of the EMAC core have varying 1) number of
> + * address match slots, 2) width of the registers for handling address
> + * match slots, 3) number of registers for handling address match
> + * slots and 4) base offset for those registers.
> + *
> + * These macros and inlines handle these differences based on
> + * parameters supplied by the device structure which are, in turn,
> + * initialized based on the "compatible" entry in the device tree.
> + */
> +
> +#define EMAC4_XAHT_SLOTS_SHIFT 6
> +#define EMAC4_XAHT_WIDTH_SHIFT 4
> +
> +#define EMAC4SYNC_XAHT_SLOTS_SHIFT 8
> +#define EMAC4SYNC_XAHT_WIDTH_SHIFT 5
> +
> +#define EMAC_XAHT_SLOTS(dev) (1 << (dev)->xaht_slots_shift)
> +#define EMAC_XAHT_WIDTH(dev) (1 << (dev)->xaht_width_shift)
> +#define EMAC_XAHT_REGS(dev) (1 << ((dev)->xaht_slots_shift - \
> + (dev)->xaht_width_shift))
> +
> +#define EMAC_XAHT_CRC_TO_SLOT(dev, crc) \
> + ((EMAC_XAHT_SLOTS(dev) - 1) - \
> + ((crc) >> ((sizeof (u32) * BITS_PER_BYTE) - \
> + (dev)->xaht_slots_shift)))
> +
> +#define EMAC_XAHT_SLOT_TO_REG(dev, slot) \
> + ((slot) >> (dev)->xaht_width_shift)
> +
> +#define EMAC_XAHT_SLOT_TO_MASK(dev, slot) \
> + ((u32)(1 << (EMAC_XAHT_WIDTH(dev) - 1)) >> \
> + ((slot) & (u32)(EMAC_XAHT_WIDTH(dev) - 1)))
> +
> +static inline u32 *emac_xaht_base(struct emac_instance *dev)
> +{
> + struct emac_regs __iomem *p = dev->emacp;
> + int offset;
> +
> + /* The first IAHT entry always is the base of the block of
> + * IAHT and GAHT registers.
> + */
> + if (emac_has_feature(dev, EMAC_FTR_EMAC4SYNC))
> + offset = offsetof(struct emac_regs, u1.emac4sync.iaht1);
> + else
> + offset = offsetof(struct emac_regs, u0.emac4.iaht1);
> +
> + return ((u32 *)((ptrdiff_t)p + offset));
> +}
> +
> +static inline u32 *emac_gaht_base(struct emac_instance *dev)
> +{
> + /* GAHT registers always come after an identical number of
> + * IAHT registers.
> + */
> + return (emac_xaht_base(dev) + EMAC_XAHT_REGS(dev));
> +}
> +
> +static inline u32 *emac_iaht_base(struct emac_instance *dev)
> +{
> + /* IAHT registers always come before an identical number of
> + * GAHT registers.
> + */
> + return (emac_xaht_base(dev));
> +}
>
> /* Ethtool get_regs complex data.
> * We want to get not just EMAC registers, but also MAL, ZMII, RGMII, TAH
> @@ -366,4 +440,11 @@ struct emac_ethtool_regs_subhdr {
> u32 index;
> };
>
> +#define EMAC_ETHTOOL_REGS_VER 0
> +#define EMAC_ETHTOOL_REGS_SIZE(dev) ((dev)->rsrc_regs.end - \
> + (dev)->rsrc_regs.start + 1)
> +#define EMAC4_ETHTOOL_REGS_VER 1
> +#define EMAC4_ETHTOOL_REGS_SIZE(dev) ((dev)->rsrc_regs.end - \
> + (dev)->rsrc_regs.start + 1)
> +
> #endif /* __IBM_NEWEMAC_CORE_H */
> diff --git a/drivers/net/ibm_newemac/debug.c b/drivers/net/ibm_newemac/debug.c
> index 86b756a..775c850 100644
> --- a/drivers/net/ibm_newemac/debug.c
> +++ b/drivers/net/ibm_newemac/debug.c
> @@ -67,29 +67,55 @@ static void emac_desc_dump(struct emac_instance *p)
> static void emac_mac_dump(struct emac_instance *dev)
> {
> struct emac_regs __iomem *p = dev->emacp;
> + const int xaht_regs = EMAC_XAHT_REGS(dev);
> + u32 *gaht_base = emac_gaht_base(dev);
> + u32 *iaht_base = emac_iaht_base(dev);
> + int emac4sync = emac_has_feature(dev, EMAC_FTR_EMAC4SYNC);
> + int n;
>
> printk("** EMAC %s registers **\n"
> "MR0 = 0x%08x MR1 = 0x%08x TMR0 = 0x%08x TMR1 = 0x%08x\n"
> "RMR = 0x%08x ISR = 0x%08x ISER = 0x%08x\n"
> - "IAR = %04x%08x VTPID = 0x%04x VTCI = 0x%04x\n"
> - "IAHT: 0x%04x 0x%04x 0x%04x 0x%04x "
> - "GAHT: 0x%04x 0x%04x 0x%04x 0x%04x\n"
> - "LSA = %04x%08x IPGVR = 0x%04x\n"
> - "STACR = 0x%08x TRTR = 0x%08x RWMR = 0x%08x\n"
> - "OCTX = 0x%08x OCRX = 0x%08x IPCR = 0x%08x\n",
> + "IAR = %04x%08x VTPID = 0x%04x VTCI = 0x%04x\n",
> dev->ofdev->node->full_name, in_be32(&p->mr0), in_be32(&p->mr1),
> in_be32(&p->tmr0), in_be32(&p->tmr1),
> in_be32(&p->rmr), in_be32(&p->isr), in_be32(&p->iser),
> in_be32(&p->iahr), in_be32(&p->ialr), in_be32(&p->vtpid),
> - in_be32(&p->vtci),
> - in_be32(&p->iaht1), in_be32(&p->iaht2), in_be32(&p->iaht3),
> - in_be32(&p->iaht4),
> - in_be32(&p->gaht1), in_be32(&p->gaht2), in_be32(&p->gaht3),
> - in_be32(&p->gaht4),
> + in_be32(&p->vtci)
> + );
> +
> + if (emac4sync)
> + printk("MAR = %04x%08x MMAR = %04x%08x\n",
> + in_be32(&p->u0.emac4sync.mahr),
> + in_be32(&p->u0.emac4sync.malr),
> + in_be32(&p->u0.emac4sync.mmahr),
> + in_be32(&p->u0.emac4sync.mmalr)
> + );
> +
> + for (n = 0; n < xaht_regs; n++)
> + printk("IAHT%02d = 0x%08x\n", n + 1, in_be32(iaht_base + n));
> +
> + for (n = 0; n < xaht_regs; n++)
> + printk("GAHT%02d = 0x%08x\n", n + 1, in_be32(gaht_base + n));
> +
> + printk("LSA = %04x%08x IPGVR = 0x%04x\n"
> + "STACR = 0x%08x TRTR = 0x%08x RWMR = 0x%08x\n"
> + "OCTX = 0x%08x OCRX = 0x%08x\n",
> in_be32(&p->lsah), in_be32(&p->lsal), in_be32(&p->ipgvr),
> in_be32(&p->stacr), in_be32(&p->trtr), in_be32(&p->rwmr),
> - in_be32(&p->octx), in_be32(&p->ocrx), in_be32(&p->ipcr)
> - );
> + in_be32(&p->octx), in_be32(&p->ocrx)
> + );
> +
> + if (!emac4sync) {
> + printk("IPCR = 0x%08x\n",
> + in_be32(&p->u1.emac4.ipcr)
> + );
> + } else {
> + printk("REVID = 0x%08x TPC = 0x%08x\n",
> + in_be32(&p->u1.emac4sync.revid),
> + in_be32(&p->u1.emac4sync.tpc)
> + );
> + }
>
> emac_desc_dump(dev);
> }
> diff --git a/drivers/net/ibm_newemac/emac.h b/drivers/net/ibm_newemac/emac.h
> index 91cb096..0afc2cf 100644
> --- a/drivers/net/ibm_newemac/emac.h
> +++ b/drivers/net/ibm_newemac/emac.h
> @@ -27,37 +27,80 @@
>
> #include <linux/types.h>
>
> -/* EMAC registers Write Access rules */
> +/* EMAC registers Write Access rules */
> struct emac_regs {
> - u32 mr0; /* special */
> - u32 mr1; /* Reset */
> - u32 tmr0; /* special */
> - u32 tmr1; /* special */
> - u32 rmr; /* Reset */
> - u32 isr; /* Always */
> - u32 iser; /* Reset */
> - u32 iahr; /* Reset, R, T */
> - u32 ialr; /* Reset, R, T */
> - u32 vtpid; /* Reset, R, T */
> - u32 vtci; /* Reset, R, T */
> - u32 ptr; /* Reset, T */
> - u32 iaht1; /* Reset, R */
> - u32 iaht2; /* Reset, R */
> - u32 iaht3; /* Reset, R */
> - u32 iaht4; /* Reset, R */
> - u32 gaht1; /* Reset, R */
> - u32 gaht2; /* Reset, R */
> - u32 gaht3; /* Reset, R */
> - u32 gaht4; /* Reset, R */
> + /* Common registers across all EMAC implementations. */
> + u32 mr0; /* Special */
> + u32 mr1; /* Reset */
> + u32 tmr0; /* Special */
> + u32 tmr1; /* Special */
> + u32 rmr; /* Reset */
> + u32 isr; /* Always */
> + u32 iser; /* Reset */
> + u32 iahr; /* Reset, R, T */
> + u32 ialr; /* Reset, R, T */
> + u32 vtpid; /* Reset, R, T */
> + u32 vtci; /* Reset, R, T */
> + u32 ptr; /* Reset, T */
> + union {
> + /* Registers unique to EMAC4 implementations */
> + struct {
> + u32 iaht1; /* Reset, R */
> + u32 iaht2; /* Reset, R */
> + u32 iaht3; /* Reset, R */
> + u32 iaht4; /* Reset, R */
> + u32 gaht1; /* Reset, R */
> + u32 gaht2; /* Reset, R */
> + u32 gaht3; /* Reset, R */
> + u32 gaht4; /* Reset, R */
> + } emac4;
> + /* Registers unique to EMAC4SYNC implementations */
> + struct {
> + u32 mahr; /* Reset, R, T */
> + u32 malr; /* Reset, R, T */
> + u32 mmahr; /* Reset, R, T */
> + u32 mmalr; /* Reset, R, T */
> + u32 rsvd0[4];
> + } emac4sync;
> + } u0;
> + /* Common registers across all EMAC implementations. */
> u32 lsah;
> u32 lsal;
> - u32 ipgvr; /* Reset, T */
> - u32 stacr; /* special */
> - u32 trtr; /* special */
> - u32 rwmr; /* Reset */
> + u32 ipgvr; /* Reset, T */
> + u32 stacr; /* Special */
> + u32 trtr; /* Special */
> + u32 rwmr; /* Reset */
> u32 octx;
> u32 ocrx;
> - u32 ipcr;
> + union {
> + /* Registers unique to EMAC4 implementations */
> + struct {
> + u32 ipcr;
> + } emac4;
> + /* Registers unique to EMAC4SYNC implementations */
> + struct {
> + u32 rsvd1;
> + u32 revid;
> + u32 rsvd2[2];
> + u32 iaht1; /* Reset, R */
> + u32 iaht2; /* Reset, R */
> + u32 iaht3; /* Reset, R */
> + u32 iaht4; /* Reset, R */
> + u32 iaht5; /* Reset, R */
> + u32 iaht6; /* Reset, R */
> + u32 iaht7; /* Reset, R */
> + u32 iaht8; /* Reset, R */
> + u32 gaht1; /* Reset, R */
> + u32 gaht2; /* Reset, R */
> + u32 gaht3; /* Reset, R */
> + u32 gaht4; /* Reset, R */
> + u32 gaht5; /* Reset, R */
> + u32 gaht6; /* Reset, R */
> + u32 gaht7; /* Reset, R */
> + u32 gaht8; /* Reset, R */
> + u32 tpc; /* Reset, T */
> + } emac4sync;
> + } u1;
> };
>
> /*
> @@ -73,12 +116,6 @@ struct emac_regs {
> #define PHY_MODE_RTBI 7
> #define PHY_MODE_SGMII 8
>
> -
> -#define EMAC_ETHTOOL_REGS_VER 0
> -#define EMAC_ETHTOOL_REGS_SIZE (sizeof(struct emac_regs) - sizeof(u32))
> -#define EMAC4_ETHTOOL_REGS_VER 1
> -#define EMAC4_ETHTOOL_REGS_SIZE sizeof(struct emac_regs)
> -
> /* EMACx_MR0 */
> #define EMAC_MR0_RXI 0x80000000
> #define EMAC_MR0_TXI 0x40000000
^ permalink raw reply
* Re: [PATCH 1/2] elf loader support for auxvec base platform string
From: Roland McGrath @ 2008-07-07 6:18 UTC (permalink / raw)
To: benh; +Cc: linuxppc-dev, Nathan Lynch, linux-kernel, Paul Mackerras
In-Reply-To: <1215409693.8970.79.camel@pasglop>
> Well, we use strings to represent the platforms already (ie, the actual
> CPU microarchitecture). Fitting those into bits would be annoying, it
Then use dsocaps.
> makes sense to have AT_BASE_PLATFORM to be the "base" variant of
> AT_PLATFORM.
I understand why you think so. But let's not be too abstract. The
purpose of the addition is to drive ld.so's selection of libraries, yes?
AT_PLATFORM is a lousy model. Handling it is clunky in glibc, because
we have to compare against all the known strings to turn it back into a
bit for the ld.so.cache bitmasks. We're not going to do the same for
AT_BASE_PLATFORM too, because it just sucks.
Using dsocaps gives you the best of both worlds. You can freely choose
new strings in the kernel without the ld.so code having to know about
them (which is not true of AT_PLATFORM, but may be true of how you are
thinking about "strings are nice"). You do have to map all the
possibilities that a single kernel build can produce into distinct bits.
But, there are 32 unallocated bits to start with. Moreover, those bit
assignments are not part of any permanent ABI like bits in AT_* values.
They just have to match up between this kernel build and the ld.conf.d
file installed along with it--kernel hackers and kernel packagers have
to coordinate, not kernel hackers and userland hackers.
Thanks,
Roland
^ permalink raw reply
* Re: [PATCH v5] ibm_newemac: Parameterize EMAC Multicast Match Handling
From: Benjamin Herrenschmidt @ 2008-07-07 6:00 UTC (permalink / raw)
To: Stefan Roese; +Cc: linuxppc-dev, Grant Erickson
In-Reply-To: <200807070758.45828.sr@denx.de>
On Mon, 2008-07-07 at 07:58 +0200, Stefan Roese wrote:
> On Monday 07 July 2008, Grant Erickson wrote:
> > Various instances of the EMAC core have varying: 1) number of address
> > match slots, 2) width of the registers for handling address match slots,
> > 3) number of registers for handling address match slots and 4) base
> > offset for those registers.
>
> <snip>
>
> > Signed-off-by: Grant Erickson <gerickson@nuovations.com>
>
> Acked-by: Stefan Roese <sr@denx.de>
Did you have a chance to do a bit of regression testing "just in case" ?
Appart from that, I'll sort out with Jeff which tree this will go
through.
Cheers,
Ben.
^ permalink raw reply
* Re: [PATCH v5] ibm_newemac: Parameterize EMAC Multicast Match Handling
From: Stefan Roese @ 2008-07-07 5:58 UTC (permalink / raw)
To: Grant Erickson; +Cc: linuxppc-dev
In-Reply-To: <1215387012-6464-1-git-send-email-gerickson@nuovations.com>
On Monday 07 July 2008, Grant Erickson wrote:
> Various instances of the EMAC core have varying: 1) number of address
> match slots, 2) width of the registers for handling address match slots,
> 3) number of registers for handling address match slots and 4) base
> offset for those registers.
<snip>
> Signed-off-by: Grant Erickson <gerickson@nuovations.com>
Acked-by: Stefan Roese <sr@denx.de>
Best regards,
Stefan
^ permalink raw reply
* Re: [patch 1/6] mm: Allow architectures to define additional protection bits
From: Benjamin Herrenschmidt @ 2008-07-07 5:52 UTC (permalink / raw)
To: Dave Kleikamp
Cc: Hugh Dickins, Andrew Morton, Linuxppc-dev, Paul Mackerras,
linux-mm
In-Reply-To: <1214920499.18690.10.camel@norville.austin.ibm.com>
On Tue, 2008-07-01 at 13:54 +0000, Dave Kleikamp wrote:
> On Tue, 2008-07-01 at 01:53 -0700, Andrew Morton wrote:
> > On Wed, 18 Jun 2008 17:32:55 -0500 shaggy@linux.vnet.ibm.com wrote:
> >
> > > This patch allows architectures to define functions to deal with
> > > additional protections bits for mmap() and mprotect().
> > >
> > > arch_calc_vm_prot_bits() maps additonal protection bits to vm_flags
> > > arch_vm_get_page_prot() maps additional vm_flags to the vma's vm_page_prot
> > > arch_validate_prot() checks for valid values of the protection bits
> >
> > It'd be simpler if Paul were to merge this. It doesn't conflict with
> > any pending work.
>
> That works for me. Paul, I'll send you an updated patchset.
Please, CC me as I'll handle this merge window.
> > Acked-by: Andrew Morton <akpm@linux-foundation.org>
> >
> > > Note: vm_get_page_prot() is now pretty ugly.
> >
> > It is. But afacit it generates the same code for non-powerpc.
> >
> > > Suggestions?
> >
> > nfi. Let us rub the Hugh-summoning lamp.
Didn't rub hard enough ? :-)
Cheers,
Ben.
> > > Signed-off-by: Dave Kleikamp <shaggy@linux.vnet.ibm.com>
> > > ---
> > >
> > > include/linux/mman.h | 28 +++++++++++++++++++++++++++-
> > > mm/mmap.c | 5 +++--
> > > mm/mprotect.c | 2 +-
> > > 3 files changed, 31 insertions(+), 4 deletions(-)
> > >
> > > Index: linux-2.6.26-rc5/include/linux/mman.h
> > > ===================================================================
> > > --- linux-2.6.26-rc5.orig/include/linux/mman.h
> > > +++ linux-2.6.26-rc5/include/linux/mman.h
> > > @@ -34,6 +34,31 @@ static inline void vm_unacct_memory(long
> > > }
> > >
> > > /*
> > > + * Allow architectures to handle additional protection bits
> > > + */
> > > +
> > > +#ifndef arch_calc_vm_prot_bits
> > > +#define arch_calc_vm_prot_bits(prot) 0
> > > +#endif
> > > +
> > > +#ifndef arch_vm_get_page_prot
> > > +#define arch_vm_get_page_prot(vm_flags) __pgprot(0)
> > > +#endif
> > > +
> > > +#ifndef arch_validate_prot
> > > +/*
> > > + * This is called from mprotect(). PROT_GROWSDOWN and PROT_GROWSUP have
> > > + * already been masked out.
> > > + *
> > > + * Returns true if the prot flags are valid
> > > + */
> > > +static inline int arch_validate_prot(unsigned long prot)
> > > +{
> > > + return (prot & ~(PROT_READ | PROT_WRITE | PROT_EXEC | PROT_SEM)) == 0;
> > > +}
> >
> > Officially we should now have
> >
> > #define arch_validate_prot arch_validate_prot
> >
> > here.
>
> No problem.
>
> > > +#endif
> > > +
> > > +/*
> > > * Optimisation macro. It is equivalent to:
> > > * (x & bit1) ? bit2 : 0
> > > * but this version is faster.
> > > @@ -51,7 +76,8 @@ calc_vm_prot_bits(unsigned long prot)
> > > {
> > > return _calc_vm_trans(prot, PROT_READ, VM_READ ) |
> > > _calc_vm_trans(prot, PROT_WRITE, VM_WRITE) |
> > > - _calc_vm_trans(prot, PROT_EXEC, VM_EXEC );
> > > + _calc_vm_trans(prot, PROT_EXEC, VM_EXEC) |
> > > + arch_calc_vm_prot_bits(prot);
> > > }
> > >
> > > /*
> > > Index: linux-2.6.26-rc5/mm/mmap.c
> > > ===================================================================
> > > --- linux-2.6.26-rc5.orig/mm/mmap.c
> > > +++ linux-2.6.26-rc5/mm/mmap.c
> > > @@ -72,8 +72,9 @@ pgprot_t protection_map[16] = {
> > >
> > > pgprot_t vm_get_page_prot(unsigned long vm_flags)
> > > {
> > > - return protection_map[vm_flags &
> > > - (VM_READ|VM_WRITE|VM_EXEC|VM_SHARED)];
> > > + return __pgprot(pgprot_val(protection_map[vm_flags &
> > > + (VM_READ|VM_WRITE|VM_EXEC|VM_SHARED)]) |
> > > + pgprot_val(arch_vm_get_page_prot(vm_flags)));
> > > }
> > > EXPORT_SYMBOL(vm_get_page_prot);
> > >
> > > Index: linux-2.6.26-rc5/mm/mprotect.c
> > > ===================================================================
> > > --- linux-2.6.26-rc5.orig/mm/mprotect.c
> > > +++ linux-2.6.26-rc5/mm/mprotect.c
> > > @@ -239,7 +239,7 @@ sys_mprotect(unsigned long start, size_t
> > > end = start + len;
> > > if (end <= start)
> > > return -ENOMEM;
> > > - if (prot & ~(PROT_READ | PROT_WRITE | PROT_EXEC | PROT_SEM))
> > > + if (!arch_validate_prot(prot))
> > > return -EINVAL;
> > >
> > > reqprot = prot;
> > >
> > > --
^ permalink raw reply
* Re: [PATCH 1/2] elf loader support for auxvec base platform string
From: Benjamin Herrenschmidt @ 2008-07-07 5:48 UTC (permalink / raw)
To: Roland McGrath; +Cc: linuxppc-dev, Nathan Lynch, linux-kernel, Paul Mackerras
In-Reply-To: <20080704021929.5E9EF1541F5@magilla.localdomain>
On Thu, 2008-07-03 at 19:19 -0700, Roland McGrath wrote:
> Why not just use ELF_HWCAP for this? It looks like powerpc only has 3 bits
> left there (keeping it to 32), but 3 is not 0. If not that, why not use
> dsocaps? That is, some magic in the vDSO, which glibc already supports on
> all machines where it uses the vDSO. (For how it works, see the use in
> arch/x86/vdso/vdso32/note.S for CONFIG_XEN.)
Well, we use strings to represent the platforms already (ie, the actual
CPU microarchitecture). Fitting those into bits would be annoying, it
makes sense to have AT_BASE_PLATFORM to be the "base" variant of
AT_PLATFORM.
_However_ there is a bug in that this patch adds an entry without
bumping the number of entries in the cached array (ie.
AT_VECTOR_SIZE_BASE needs to be updated).
Ben.
^ permalink raw reply
* Re: [patch 05/11] powerpc/cell: add spu aware cpufreq governor
From: Stephen Rothwell @ 2008-07-07 5:32 UTC (permalink / raw)
To: benh; +Cc: linuxppc-dev, Paul Mackerras, cbe-oss-dev, arnd, Christian Krafft
In-Reply-To: <1215408119.8970.67.camel@pasglop>
[-- Attachment #1: Type: text/plain, Size: 944 bytes --]
On Mon, 07 Jul 2008 15:21:59 +1000 Benjamin Herrenschmidt <benh@kernel.crashing.org> wrote:
>
> On Fri, 2008-07-04 at 21:05 +0200, arnd@arndb.de wrote:
> > plain text document attachment
> > (0005-powerpc-cell-add-spu-aware-cpufreq-governor.patch)
We probably don't need to know that :-)
> > This patch adds a cpufreq governor that takes the number of running spus
> > into account. It's very similar to the ondemand governor, but not as complex.
> > Instead of hacking spu load into the ondemand governor it might be easier to
> > have cpufreq accepting multiple governors per cpu in future.
> > Don't know if this is the right way, but it would keep the governors simple.
> >
> > Signed-off-by: Christian Krafft <krafft@de.ibm.com>
>
> Arnd, your S-O-B ?
And a leading From line if it was written by Christian.
--
Cheers,
Stephen Rothwell sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/
[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply
* Re: [patch 04/11] powerpc/spufs: add atomic busy_spus counter to struct cbe_spu_info
From: Stephen Rothwell @ 2008-07-07 5:30 UTC (permalink / raw)
To: benh; +Cc: linuxppc-dev, Paul Mackerras, cbe-oss-dev, arnd, Christian Krafft
In-Reply-To: <1215407941.8970.63.camel@pasglop>
[-- Attachment #1: Type: text/plain, Size: 916 bytes --]
On Mon, 07 Jul 2008 15:19:01 +1000 Benjamin Herrenschmidt <benh@kernel.crashing.org> wrote:
>
> On Fri, 2008-07-04 at 21:05 +0200, arnd@arndb.de wrote:
> > plain text document attachment
> > (0004-powerpc-spufs-add-atomic-busy_spus-counter-to-struc.patch)
> > As nr_active counter includes also spus waiting for syscalls to return
> > we need a seperate counter that only counts spus that are currently running
> > on spu side. This counter shall be used by a cpufreq governor that targets
> > a frequency dependent from the number of running spus.
> >
> > From: Maxim Shchetynin <maxim@de.ibm.com>
> > Signed-off-by: Christian Krafft <krafft@de.ibm.com>
>
> This needs your S-O-B, Arnd, and should go via jk.
And the From line should be the first so the Author is correctly
attributed.
--
Cheers,
Stephen Rothwell sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/
[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply
* Re: [patch 07/11] powerpc/dma: implement new dma_*map*_attrs() interfaces
From: Benjamin Herrenschmidt @ 2008-07-07 5:27 UTC (permalink / raw)
To: Geoff Levand; +Cc: Mark Nelson, linuxppc-dev, Paul Mackerras, cbe-oss-dev
In-Reply-To: <20080704190806.430190454@arndb.de>
On Fri, 2008-07-04 at 21:05 +0200, arnd@arndb.de wrote:
> plain text document attachment
> (0007-powerpc-dma-implement-new-dma_-map-_attrs-interfa.patch)
> Update powerpc to use the new dma_*map*_attrs() interfaces. In doing so
> update struct dma_mapping_ops to accept a struct dma_attrs and propagate
> these changes through to all users of the code (generic IOMMU and the
> 64bit DMA code, and the iseries and ps3 platform code).
>
> The old dma_*map_*() interfaces are reimplemented as calls to the
> corresponding new interfaces.
Geoff, I think the PS3 bits in this patch are ok but I'd like
you to double-check and send your ack if you think they are.
Cheers,
Ben.
> Signed-off-by: Mark Nelson <markn@au1.ibm.com>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> arch/powerpc/Kconfig | 1 +
> arch/powerpc/kernel/dma_64.c | 34 ++++++---
> arch/powerpc/kernel/ibmebus.c | 12 ++-
> arch/powerpc/kernel/iommu.c | 11 ++-
> arch/powerpc/platforms/iseries/iommu.c | 4 +-
> arch/powerpc/platforms/ps3/system-bus.c | 17 +++--
> include/asm-powerpc/dma-mapping.h | 116 +++++++++++++++++++++++--------
> include/asm-powerpc/iommu.h | 12 ++-
> 8 files changed, 144 insertions(+), 63 deletions(-)
>
> diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
> index f2a0f50..462c86a 100644
> --- a/arch/powerpc/Kconfig
> +++ b/arch/powerpc/Kconfig
> @@ -110,6 +110,7 @@ config PPC
> select HAVE_KPROBES
> select HAVE_KRETPROBES
> select HAVE_LMB
> + select HAVE_DMA_ATTRS
>
> config EARLY_PRINTK
> bool
> diff --git a/arch/powerpc/kernel/dma_64.c b/arch/powerpc/kernel/dma_64.c
> index 7397445..3ae0c35 100644
> --- a/arch/powerpc/kernel/dma_64.c
> +++ b/arch/powerpc/kernel/dma_64.c
> @@ -50,32 +50,38 @@ static void dma_iommu_free_coherent(struct device *dev, size_t size,
> */
> static dma_addr_t dma_iommu_map_single(struct device *dev, void *vaddr,
> size_t size,
> - enum dma_data_direction direction)
> + enum dma_data_direction direction,
> + struct dma_attrs *attrs)
> {
> return iommu_map_single(dev, dev->archdata.dma_data, vaddr, size,
> - device_to_mask(dev), direction);
> + device_to_mask(dev), direction, attrs);
> }
>
>
> static void dma_iommu_unmap_single(struct device *dev, dma_addr_t dma_handle,
> size_t size,
> - enum dma_data_direction direction)
> + enum dma_data_direction direction,
> + struct dma_attrs *attrs)
> {
> - iommu_unmap_single(dev->archdata.dma_data, dma_handle, size, direction);
> + iommu_unmap_single(dev->archdata.dma_data, dma_handle, size, direction,
> + attrs);
> }
>
>
> static int dma_iommu_map_sg(struct device *dev, struct scatterlist *sglist,
> - int nelems, enum dma_data_direction direction)
> + int nelems, enum dma_data_direction direction,
> + struct dma_attrs *attrs)
> {
> return iommu_map_sg(dev, dev->archdata.dma_data, sglist, nelems,
> - device_to_mask(dev), direction);
> + device_to_mask(dev), direction, attrs);
> }
>
> static void dma_iommu_unmap_sg(struct device *dev, struct scatterlist *sglist,
> - int nelems, enum dma_data_direction direction)
> + int nelems, enum dma_data_direction direction,
> + struct dma_attrs *attrs)
> {
> - iommu_unmap_sg(dev->archdata.dma_data, sglist, nelems, direction);
> + iommu_unmap_sg(dev->archdata.dma_data, sglist, nelems, direction,
> + attrs);
> }
>
> /* We support DMA to/from any memory page via the iommu */
> @@ -148,19 +154,22 @@ static void dma_direct_free_coherent(struct device *dev, size_t size,
>
> static dma_addr_t dma_direct_map_single(struct device *dev, void *ptr,
> size_t size,
> - enum dma_data_direction direction)
> + enum dma_data_direction direction,
> + struct dma_attrs *attrs)
> {
> return virt_to_abs(ptr) + get_dma_direct_offset(dev);
> }
>
> static void dma_direct_unmap_single(struct device *dev, dma_addr_t dma_addr,
> size_t size,
> - enum dma_data_direction direction)
> + enum dma_data_direction direction,
> + struct dma_attrs *attrs)
> {
> }
>
> static int dma_direct_map_sg(struct device *dev, struct scatterlist *sgl,
> - int nents, enum dma_data_direction direction)
> + int nents, enum dma_data_direction direction,
> + struct dma_attrs *attrs)
> {
> struct scatterlist *sg;
> int i;
> @@ -174,7 +183,8 @@ static int dma_direct_map_sg(struct device *dev, struct scatterlist *sgl,
> }
>
> static void dma_direct_unmap_sg(struct device *dev, struct scatterlist *sg,
> - int nents, enum dma_data_direction direction)
> + int nents, enum dma_data_direction direction,
> + struct dma_attrs *attrs)
> {
> }
>
> diff --git a/arch/powerpc/kernel/ibmebus.c b/arch/powerpc/kernel/ibmebus.c
> index 9971159..e3b1fcd 100644
> --- a/arch/powerpc/kernel/ibmebus.c
> +++ b/arch/powerpc/kernel/ibmebus.c
> @@ -82,7 +82,8 @@ static void ibmebus_free_coherent(struct device *dev,
> static dma_addr_t ibmebus_map_single(struct device *dev,
> void *ptr,
> size_t size,
> - enum dma_data_direction direction)
> + enum dma_data_direction direction,
> + struct dma_attrs *attrs)
> {
> return (dma_addr_t)(ptr);
> }
> @@ -90,14 +91,16 @@ static dma_addr_t ibmebus_map_single(struct device *dev,
> static void ibmebus_unmap_single(struct device *dev,
> dma_addr_t dma_addr,
> size_t size,
> - enum dma_data_direction direction)
> + enum dma_data_direction direction,
> + struct dma_attrs *attrs)
> {
> return;
> }
>
> static int ibmebus_map_sg(struct device *dev,
> struct scatterlist *sgl,
> - int nents, enum dma_data_direction direction)
> + int nents, enum dma_data_direction direction,
> + struct dma_attrs *attrs)
> {
> struct scatterlist *sg;
> int i;
> @@ -112,7 +115,8 @@ static int ibmebus_map_sg(struct device *dev,
>
> static void ibmebus_unmap_sg(struct device *dev,
> struct scatterlist *sg,
> - int nents, enum dma_data_direction direction)
> + int nents, enum dma_data_direction direction,
> + struct dma_attrs *attrs)
> {
> return;
> }
> diff --git a/arch/powerpc/kernel/iommu.c b/arch/powerpc/kernel/iommu.c
> index ccf00fe..8c68ee9 100644
> --- a/arch/powerpc/kernel/iommu.c
> +++ b/arch/powerpc/kernel/iommu.c
> @@ -269,7 +269,8 @@ static void iommu_free(struct iommu_table *tbl, dma_addr_t dma_addr,
>
> int iommu_map_sg(struct device *dev, struct iommu_table *tbl,
> struct scatterlist *sglist, int nelems,
> - unsigned long mask, enum dma_data_direction direction)
> + unsigned long mask, enum dma_data_direction direction,
> + struct dma_attrs *attrs)
> {
> dma_addr_t dma_next = 0, dma_addr;
> unsigned long flags;
> @@ -411,7 +412,8 @@ int iommu_map_sg(struct device *dev, struct iommu_table *tbl,
>
>
> void iommu_unmap_sg(struct iommu_table *tbl, struct scatterlist *sglist,
> - int nelems, enum dma_data_direction direction)
> + int nelems, enum dma_data_direction direction,
> + struct dma_attrs *attrs)
> {
> struct scatterlist *sg;
> unsigned long flags;
> @@ -553,7 +555,7 @@ void iommu_free_table(struct iommu_table *tbl, const char *node_name)
> */
> dma_addr_t iommu_map_single(struct device *dev, struct iommu_table *tbl,
> void *vaddr, size_t size, unsigned long mask,
> - enum dma_data_direction direction)
> + enum dma_data_direction direction, struct dma_attrs *attrs)
> {
> dma_addr_t dma_handle = DMA_ERROR_CODE;
> unsigned long uaddr;
> @@ -586,7 +588,8 @@ dma_addr_t iommu_map_single(struct device *dev, struct iommu_table *tbl,
> }
>
> void iommu_unmap_single(struct iommu_table *tbl, dma_addr_t dma_handle,
> - size_t size, enum dma_data_direction direction)
> + size_t size, enum dma_data_direction direction,
> + struct dma_attrs *attrs)
> {
> unsigned int npages;
>
> diff --git a/arch/powerpc/platforms/iseries/iommu.c b/arch/powerpc/platforms/iseries/iommu.c
> index 11fa3c7..ab5d868 100644
> --- a/arch/powerpc/platforms/iseries/iommu.c
> +++ b/arch/powerpc/platforms/iseries/iommu.c
> @@ -214,13 +214,13 @@ dma_addr_t iseries_hv_map(void *vaddr, size_t size,
> enum dma_data_direction direction)
> {
> return iommu_map_single(NULL, &vio_iommu_table, vaddr, size,
> - DMA_32BIT_MASK, direction);
> + DMA_32BIT_MASK, direction, NULL);
> }
>
> void iseries_hv_unmap(dma_addr_t dma_handle, size_t size,
> enum dma_data_direction direction)
> {
> - iommu_unmap_single(&vio_iommu_table, dma_handle, size, direction);
> + iommu_unmap_single(&vio_iommu_table, dma_handle, size, direction, NULL);
> }
>
> void __init iommu_vio_init(void)
> diff --git a/arch/powerpc/platforms/ps3/system-bus.c b/arch/powerpc/platforms/ps3/system-bus.c
> index 43c493f..526cf14 100644
> --- a/arch/powerpc/platforms/ps3/system-bus.c
> +++ b/arch/powerpc/platforms/ps3/system-bus.c
> @@ -550,7 +550,7 @@ static void ps3_free_coherent(struct device *_dev, size_t size, void *vaddr,
> */
>
> static dma_addr_t ps3_sb_map_single(struct device *_dev, void *ptr, size_t size,
> - enum dma_data_direction direction)
> + enum dma_data_direction direction, struct dma_attrs *attrs)
> {
> struct ps3_system_bus_device *dev = ps3_dev_to_system_bus_dev(_dev);
> int result;
> @@ -570,7 +570,8 @@ static dma_addr_t ps3_sb_map_single(struct device *_dev, void *ptr, size_t size,
>
> static dma_addr_t ps3_ioc0_map_single(struct device *_dev, void *ptr,
> size_t size,
> - enum dma_data_direction direction)
> + enum dma_data_direction direction,
> + struct dma_attrs *attrs)
> {
> struct ps3_system_bus_device *dev = ps3_dev_to_system_bus_dev(_dev);
> int result;
> @@ -603,7 +604,7 @@ static dma_addr_t ps3_ioc0_map_single(struct device *_dev, void *ptr,
> }
>
> static void ps3_unmap_single(struct device *_dev, dma_addr_t dma_addr,
> - size_t size, enum dma_data_direction direction)
> + size_t size, enum dma_data_direction direction, struct dma_attrs *attrs)
> {
> struct ps3_system_bus_device *dev = ps3_dev_to_system_bus_dev(_dev);
> int result;
> @@ -617,7 +618,7 @@ static void ps3_unmap_single(struct device *_dev, dma_addr_t dma_addr,
> }
>
> static int ps3_sb_map_sg(struct device *_dev, struct scatterlist *sgl,
> - int nents, enum dma_data_direction direction)
> + int nents, enum dma_data_direction direction, struct dma_attrs *attrs)
> {
> #if defined(CONFIG_PS3_DYNAMIC_DMA)
> BUG_ON("do");
> @@ -646,14 +647,15 @@ static int ps3_sb_map_sg(struct device *_dev, struct scatterlist *sgl,
>
> static int ps3_ioc0_map_sg(struct device *_dev, struct scatterlist *sg,
> int nents,
> - enum dma_data_direction direction)
> + enum dma_data_direction direction,
> + struct dma_attrs *attrs)
> {
> BUG();
> return 0;
> }
>
> static void ps3_sb_unmap_sg(struct device *_dev, struct scatterlist *sg,
> - int nents, enum dma_data_direction direction)
> + int nents, enum dma_data_direction direction, struct dma_attrs *attrs)
> {
> #if defined(CONFIG_PS3_DYNAMIC_DMA)
> BUG_ON("do");
> @@ -661,7 +663,8 @@ static void ps3_sb_unmap_sg(struct device *_dev, struct scatterlist *sg,
> }
>
> static void ps3_ioc0_unmap_sg(struct device *_dev, struct scatterlist *sg,
> - int nents, enum dma_data_direction direction)
> + int nents, enum dma_data_direction direction,
> + struct dma_attrs *attrs)
> {
> BUG();
> }
> diff --git a/include/asm-powerpc/dma-mapping.h b/include/asm-powerpc/dma-mapping.h
> index bbefb69..de13950 100644
> --- a/include/asm-powerpc/dma-mapping.h
> +++ b/include/asm-powerpc/dma-mapping.h
> @@ -13,6 +13,7 @@
> /* need struct page definitions */
> #include <linux/mm.h>
> #include <linux/scatterlist.h>
> +#include <linux/dma-attrs.h>
> #include <asm/io.h>
>
> #define DMA_ERROR_CODE (~(dma_addr_t)0x0)
> @@ -53,13 +54,17 @@ struct dma_mapping_ops {
> void (*free_coherent)(struct device *dev, size_t size,
> void *vaddr, dma_addr_t dma_handle);
> dma_addr_t (*map_single)(struct device *dev, void *ptr,
> - size_t size, enum dma_data_direction direction);
> + size_t size, enum dma_data_direction direction,
> + struct dma_attrs *attrs);
> void (*unmap_single)(struct device *dev, dma_addr_t dma_addr,
> - size_t size, enum dma_data_direction direction);
> + size_t size, enum dma_data_direction direction,
> + struct dma_attrs *attrs);
> int (*map_sg)(struct device *dev, struct scatterlist *sg,
> - int nents, enum dma_data_direction direction);
> + int nents, enum dma_data_direction direction,
> + struct dma_attrs *attrs);
> void (*unmap_sg)(struct device *dev, struct scatterlist *sg,
> - int nents, enum dma_data_direction direction);
> + int nents, enum dma_data_direction direction,
> + struct dma_attrs *attrs);
> int (*dma_supported)(struct device *dev, u64 mask);
> int (*set_dma_mask)(struct device *dev, u64 dma_mask);
> };
> @@ -109,6 +114,77 @@ static inline int dma_set_mask(struct device *dev, u64 dma_mask)
> return 0;
> }
>
> +static inline dma_addr_t dma_map_single_attrs(struct device *dev,
> + void *cpu_addr,
> + size_t size,
> + enum dma_data_direction direction,
> + struct dma_attrs *attrs)
> +{
> + struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
> +
> + BUG_ON(!dma_ops);
> + return dma_ops->map_single(dev, cpu_addr, size, direction, attrs);
> +}
> +
> +static inline void dma_unmap_single_attrs(struct device *dev,
> + dma_addr_t dma_addr,
> + size_t size,
> + enum dma_data_direction direction,
> + struct dma_attrs *attrs)
> +{
> + struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
> +
> + BUG_ON(!dma_ops);
> + dma_ops->unmap_single(dev, dma_addr, size, direction, attrs);
> +}
> +
> +static inline dma_addr_t dma_map_page_attrs(struct device *dev,
> + struct page *page,
> + unsigned long offset, size_t size,
> + enum dma_data_direction direction,
> + struct dma_attrs *attrs)
> +{
> + struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
> +
> + BUG_ON(!dma_ops);
> + return dma_ops->map_single(dev, page_address(page) + offset, size,
> + direction, attrs);
> +}
> +
> +static inline void dma_unmap_page_attrs(struct device *dev,
> + dma_addr_t dma_address,
> + size_t size,
> + enum dma_data_direction direction,
> + struct dma_attrs *attrs)
> +{
> + struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
> +
> + BUG_ON(!dma_ops);
> + dma_ops->unmap_single(dev, dma_address, size, direction, attrs);
> +}
> +
> +static inline int dma_map_sg_attrs(struct device *dev, struct scatterlist *sg,
> + int nents, enum dma_data_direction direction,
> + struct dma_attrs *attrs)
> +{
> + struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
> +
> + BUG_ON(!dma_ops);
> + return dma_ops->map_sg(dev, sg, nents, direction, attrs);
> +}
> +
> +static inline void dma_unmap_sg_attrs(struct device *dev,
> + struct scatterlist *sg,
> + int nhwentries,
> + enum dma_data_direction direction,
> + struct dma_attrs *attrs)
> +{
> + struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
> +
> + BUG_ON(!dma_ops);
> + dma_ops->unmap_sg(dev, sg, nhwentries, direction, attrs);
> +}
> +
> static inline void *dma_alloc_coherent(struct device *dev, size_t size,
> dma_addr_t *dma_handle, gfp_t flag)
> {
> @@ -131,63 +207,43 @@ static inline dma_addr_t dma_map_single(struct device *dev, void *cpu_addr,
> size_t size,
> enum dma_data_direction direction)
> {
> - struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
> -
> - BUG_ON(!dma_ops);
> - return dma_ops->map_single(dev, cpu_addr, size, direction);
> + return dma_map_single_attrs(dev, cpu_addr, size, direction, NULL);
> }
>
> static inline void dma_unmap_single(struct device *dev, dma_addr_t dma_addr,
> size_t size,
> enum dma_data_direction direction)
> {
> - struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
> -
> - BUG_ON(!dma_ops);
> - dma_ops->unmap_single(dev, dma_addr, size, direction);
> + dma_unmap_single_attrs(dev, dma_addr, size, direction, NULL);
> }
>
> static inline dma_addr_t dma_map_page(struct device *dev, struct page *page,
> unsigned long offset, size_t size,
> enum dma_data_direction direction)
> {
> - struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
> -
> - BUG_ON(!dma_ops);
> - return dma_ops->map_single(dev, page_address(page) + offset, size,
> - direction);
> + return dma_map_page_attrs(dev, page, offset, size, direction, NULL);
> }
>
> static inline void dma_unmap_page(struct device *dev, dma_addr_t dma_address,
> size_t size,
> enum dma_data_direction direction)
> {
> - struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
> -
> - BUG_ON(!dma_ops);
> - dma_ops->unmap_single(dev, dma_address, size, direction);
> + dma_unmap_page_attrs(dev, dma_address, size, direction, NULL);
> }
>
> static inline int dma_map_sg(struct device *dev, struct scatterlist *sg,
> int nents, enum dma_data_direction direction)
> {
> - struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
> -
> - BUG_ON(!dma_ops);
> - return dma_ops->map_sg(dev, sg, nents, direction);
> + return dma_map_sg_attrs(dev, sg, nents, direction, NULL);
> }
>
> static inline void dma_unmap_sg(struct device *dev, struct scatterlist *sg,
> int nhwentries,
> enum dma_data_direction direction)
> {
> - struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
> -
> - BUG_ON(!dma_ops);
> - dma_ops->unmap_sg(dev, sg, nhwentries, direction);
> + dma_unmap_sg_attrs(dev, sg, nhwentries, direction, NULL);
> }
>
> -
> /*
> * Available generic sets of operations
> */
> diff --git a/include/asm-powerpc/iommu.h b/include/asm-powerpc/iommu.h
> index 65f6682..51ecfef 100644
> --- a/include/asm-powerpc/iommu.h
> +++ b/include/asm-powerpc/iommu.h
> @@ -81,9 +81,11 @@ extern struct iommu_table *iommu_init_table(struct iommu_table * tbl,
>
> extern int iommu_map_sg(struct device *dev, struct iommu_table *tbl,
> struct scatterlist *sglist, int nelems,
> - unsigned long mask, enum dma_data_direction direction);
> + unsigned long mask, enum dma_data_direction direction,
> + struct dma_attrs *attrs);
> extern void iommu_unmap_sg(struct iommu_table *tbl, struct scatterlist *sglist,
> - int nelems, enum dma_data_direction direction);
> + int nelems, enum dma_data_direction direction,
> + struct dma_attrs *attrs);
>
> extern void *iommu_alloc_coherent(struct device *dev, struct iommu_table *tbl,
> size_t size, dma_addr_t *dma_handle,
> @@ -92,9 +94,11 @@ extern void iommu_free_coherent(struct iommu_table *tbl, size_t size,
> void *vaddr, dma_addr_t dma_handle);
> extern dma_addr_t iommu_map_single(struct device *dev, struct iommu_table *tbl,
> void *vaddr, size_t size, unsigned long mask,
> - enum dma_data_direction direction);
> + enum dma_data_direction direction,
> + struct dma_attrs *attrs);
> extern void iommu_unmap_single(struct iommu_table *tbl, dma_addr_t dma_handle,
> - size_t size, enum dma_data_direction direction);
> + size_t size, enum dma_data_direction direction,
> + struct dma_attrs *attrs);
>
> extern void iommu_init_early_pSeries(void);
> extern void iommu_init_early_iSeries(void);
> --
> 1.5.4.3
>
^ permalink raw reply
* Re: [patch 01/11] powerpc/cell: add support for power button of future IBM cell blades
From: Stephen Rothwell @ 2008-07-07 5:24 UTC (permalink / raw)
To: arnd; +Cc: Paul Mackerras, cbe-oss-dev, Christian Krafft, linuxppc-dev
In-Reply-To: <20080704190805.638836822@arndb.de>
[-- Attachment #1: Type: text/plain, Size: 1896 bytes --]
Hi Arnd,
On Fri, 04 Jul 2008 21:05:36 +0200 arnd@arndb.de wrote:
>
> This patch adds support for the power button on future IBM cell blades.
> It actually doesn't shut down the machine. Instead it exposes an
> input device /dev/input/event0 to userspace which sends KEY_POWER
> if power button has been pressed.
> haldaemon actually recognizes the button, so a plattform independent acpid
> replacement should handle it correctly.
>
> Signed-off-by: Christian Krafft <krafft@de.ibm.com>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Was this written by you or Christian?
> @@ -105,10 +110,21 @@ static int cbe_system_reset_exception(struct pt_regs *regs)
> */
> if (sysreset_hack && (cpu = smp_processor_id()) == 0) {
> pmd = cbe_get_cpu_pmd_regs(cpu);
> - if (in_be64(&pmd->ras_esc_0) & 0xffff) {
> + if (in_be64(&pmd->ras_esc_0) & 0x0000ffff) {
> out_be64(&pmd->ras_esc_0, 0);
> return 0;
> }
> + if (in_be64(&pmd->ras_esc_0) & 0x00010000) {
Do we really want to read that register twice? (Just asking, I don't
know how the hardware works ...) Also, do we want to recognise this bit
even if some lower order bits are set? (this code won't)
> +static int __init cbe_power_button_init(void)
> +{
> + int ret;
> + struct input_dev *dev;
> +
> + if (!sysreset_hack)
> + return 0;
> +
> + dev = input_allocate_device();
> + if (!dev) {
> + ret = -ENOMEM;
> + printk(KERN_ERR "%s: Not enough memory\n", __func__);
> + goto out;
> + }
Some white space damage here.
> + ret = input_register_device(dev);
> + if (ret) {
> + printk(KERN_ERR "%s: Failed to register device\n", __func__);
> + goto out_free_pdev;
> + }
And here.
--
Cheers,
Stephen Rothwell sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/
[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply
* Re: [patch 05/11] powerpc/cell: add spu aware cpufreq governor
From: Benjamin Herrenschmidt @ 2008-07-07 5:21 UTC (permalink / raw)
To: arnd; +Cc: linuxppc-dev, Paul Mackerras, cbe-oss-dev, Christian Krafft
In-Reply-To: <20080704190806.162475834@arndb.de>
On Fri, 2008-07-04 at 21:05 +0200, arnd@arndb.de wrote:
> plain text document attachment
> (0005-powerpc-cell-add-spu-aware-cpufreq-governor.patch)
> This patch adds a cpufreq governor that takes the number of running spus
> into account. It's very similar to the ondemand governor, but not as complex.
> Instead of hacking spu load into the ondemand governor it might be easier to
> have cpufreq accepting multiple governors per cpu in future.
> Don't know if this is the right way, but it would keep the governors simple.
>
> Signed-off-by: Christian Krafft <krafft@de.ibm.com>
Arnd, your S-O-B ?
Also, there's the question of whether this should also go in
drivers/cpufreq or not and should be reviewed by the cpufreq
maintainer (whoever that is), no ?
Cheers,
Ben.
> ---
> arch/powerpc/platforms/cell/Kconfig | 10 ++
> arch/powerpc/platforms/cell/Makefile | 1 +
> arch/powerpc/platforms/cell/cbe_spu_governor.c | 183 ++++++++++++++++++++++++
> 3 files changed, 194 insertions(+), 0 deletions(-)
> create mode 100644 arch/powerpc/platforms/cell/cbe_spu_governor.c
>
> diff --git a/arch/powerpc/platforms/cell/Kconfig b/arch/powerpc/platforms/cell/Kconfig
> index 3959fcf..2dfff9f 100644
> --- a/arch/powerpc/platforms/cell/Kconfig
> +++ b/arch/powerpc/platforms/cell/Kconfig
> @@ -107,6 +107,16 @@ config CBE_CPUFREQ_PMI
> processor will not only be able to run at lower speed,
> but also at lower core voltage.
>
> +config CBE_CPUFREQ_SPU_GOVERNOR
> + tristate "CBE frequency scaling based on SPU usage"
> + depends on SPU_FS
> + select CBE_CPUFREQ
> + default m
> + help
> + This governor checks for spu usage to adjust the cpu frequency.
> + If no spu is running on a given cpu, that cpu will be throttled to
> + the minimal possible frequency.
> +
> endmenu
>
> config OPROFILE_CELL
> diff --git a/arch/powerpc/platforms/cell/Makefile b/arch/powerpc/platforms/cell/Makefile
> index c2a7e4e..8be5158 100644
> --- a/arch/powerpc/platforms/cell/Makefile
> +++ b/arch/powerpc/platforms/cell/Makefile
> @@ -8,6 +8,7 @@ obj-$(CONFIG_CBE_THERM) += cbe_thermal.o
> obj-$(CONFIG_CBE_CPUFREQ_PMI) += cbe_cpufreq_pmi.o
> obj-$(CONFIG_CBE_CPUFREQ) += cbe-cpufreq.o
> cbe-cpufreq-y += cbe_cpufreq_pervasive.o cbe_cpufreq.o
> +obj-$(CONFIG_CBE_CPUFREQ_SPU_GOVERNOR) += cbe_spu_governor.o
>
> ifeq ($(CONFIG_SMP),y)
> obj-$(CONFIG_PPC_CELL_NATIVE) += smp.o
> diff --git a/arch/powerpc/platforms/cell/cbe_spu_governor.c b/arch/powerpc/platforms/cell/cbe_spu_governor.c
> new file mode 100644
> index 0000000..7e63009
> --- /dev/null
> +++ b/arch/powerpc/platforms/cell/cbe_spu_governor.c
> @@ -0,0 +1,183 @@
> +/*
> + * spu aware cpufreq governor for the cell processor
> + *
> + * (C) Copyright IBM Corporation 2006-2008
> + *
> + * Author: Christian Krafft <krafft@de.ibm.com>
> + *
> + * 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, 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., 675 Mass Ave, Cambridge, MA 02139, USA.
> + */
> +
> +#include <linux/cpufreq.h>
> +#include <linux/sched.h>
> +#include <linux/timer.h>
> +#include <linux/workqueue.h>
> +#include <asm/atomic.h>
> +#include <asm/machdep.h>
> +#include <asm/spu.h>
> +
> +#define POLL_TIME 100000 /* in us */
> +#define EXP 753 /* exp(-1) in fixed-point */
> +
> +struct spu_gov_info_struct {
> + unsigned long busy_spus; /* fixed-point */
> + struct cpufreq_policy *policy;
> + struct delayed_work work;
> + unsigned int poll_int; /* us */
> +};
> +static DEFINE_PER_CPU(struct spu_gov_info_struct, spu_gov_info);
> +
> +static struct workqueue_struct *kspugov_wq;
> +
> +static int calc_freq(struct spu_gov_info_struct *info)
> +{
> + int cpu;
> + int busy_spus;
> +
> + cpu = info->policy->cpu;
> + busy_spus = atomic_read(&cbe_spu_info[cpu_to_node(cpu)].busy_spus);
> +
> + CALC_LOAD(info->busy_spus, EXP, busy_spus * FIXED_1);
> + pr_debug(KERN_ERR "cpu %d: busy_spus=%d, info->busy_spus=%d\n", cpu, busy_spus, info->busy_spus);
> +
> + return info->policy->max * info->busy_spus / FIXED_1;
> +}
> +
> +static void spu_gov_work(struct work_struct *work)
> +{
> + struct spu_gov_info_struct *info;
> + int delay;
> + unsigned long target_freq;
> +
> + info = container_of(work, struct spu_gov_info_struct, work.work);
> +
> + /* after cancel_delayed_work_sync we unset info->policy */
> + BUG_ON(info->policy == NULL);
> +
> + target_freq = calc_freq(info);
> + __cpufreq_driver_target(info->policy, target_freq, CPUFREQ_RELATION_H);
> +
> + delay = usecs_to_jiffies(info->poll_int);
> + queue_delayed_work_on(info->policy->cpu, kspugov_wq, &info->work, delay);
> +}
> +
> +static void spu_gov_init_work(struct spu_gov_info_struct *info)
> +{
> + int delay = usecs_to_jiffies(info->poll_int);
> + INIT_DELAYED_WORK_DEFERRABLE(&info->work, spu_gov_work);
> + queue_delayed_work_on(info->policy->cpu, kspugov_wq, &info->work, delay);
> +}
> +
> +static void spu_gov_cancel_work(struct spu_gov_info_struct *info)
> +{
> + cancel_delayed_work_sync(&info->work);
> +}
> +
> +static int spu_gov_govern(struct cpufreq_policy *policy, unsigned int event)
> +{
> + unsigned int cpu = policy->cpu;
> + struct spu_gov_info_struct *info, *affected_info;
> + int i;
> + int ret = 0;
> +
> + info = &per_cpu(spu_gov_info, cpu);
> +
> + switch (event) {
> + case CPUFREQ_GOV_START:
> + if (!cpu_online(cpu)) {
> + printk(KERN_ERR "cpu %d is not online\n", cpu);
> + ret = -EINVAL;
> + break;
> + }
> +
> + if (!policy->cur) {
> + printk(KERN_ERR "no cpu specified in policy\n");
> + ret = -EINVAL;
> + break;
> + }
> +
> + /* initialize spu_gov_info for all affected cpus */
> + for_each_cpu_mask(i, policy->cpus) {
> + affected_info = &per_cpu(spu_gov_info, i);
> + affected_info->policy = policy;
> + }
> +
> + info->poll_int = POLL_TIME;
> +
> + /* setup timer */
> + spu_gov_init_work(info);
> +
> + break;
> +
> + case CPUFREQ_GOV_STOP:
> + /* cancel timer */
> + spu_gov_cancel_work(info);
> +
> + /* clean spu_gov_info for all affected cpus */
> + for_each_cpu_mask (i, policy->cpus) {
> + info = &per_cpu(spu_gov_info, i);
> + info->policy = NULL;
> + }
> +
> + break;
> + }
> +
> + return ret;
> +}
> +
> +static struct cpufreq_governor spu_governor = {
> + .name = "spu_governor",
> + .governor = spu_gov_govern,
> + .owner = THIS_MODULE,
> +};
> +
> +/*
> + * module init and destoy
> + */
> +
> +static int __init spu_gov_init(void)
> +{
> + int ret;
> +
> + kspugov_wq = create_workqueue("kspugov");
> + if (!kspugov_wq) {
> + printk(KERN_ERR "creation of kspugov failed\n");
> + ret = -EFAULT;
> + goto out;
> + }
> +
> + ret = cpufreq_register_governor(&spu_governor);
> + if (ret) {
> + printk(KERN_ERR "registration of governor failed\n");
> + destroy_workqueue(kspugov_wq);
> + goto out;
> + }
> +out:
> + return ret;
> +}
> +
> +static void __exit spu_gov_exit(void)
> +{
> + cpufreq_unregister_governor(&spu_governor);
> + destroy_workqueue(kspugov_wq);
> +}
> +
> +
> +module_init(spu_gov_init);
> +module_exit(spu_gov_exit);
> +
> +MODULE_LICENSE("GPL");
> +MODULE_AUTHOR("Christian Krafft <krafft@de.ibm.com>");
> +
> --
> 1.5.4.3
>
^ permalink raw reply
* Re: [patch 04/11] powerpc/spufs: add atomic busy_spus counter to struct cbe_spu_info
From: Benjamin Herrenschmidt @ 2008-07-07 5:19 UTC (permalink / raw)
To: arnd; +Cc: linuxppc-dev, Paul Mackerras, cbe-oss-dev, Christian Krafft
In-Reply-To: <20080704190806.032005145@arndb.de>
On Fri, 2008-07-04 at 21:05 +0200, arnd@arndb.de wrote:
> plain text document attachment
> (0004-powerpc-spufs-add-atomic-busy_spus-counter-to-struc.patch)
> As nr_active counter includes also spus waiting for syscalls to return
> we need a seperate counter that only counts spus that are currently running
> on spu side. This counter shall be used by a cpufreq governor that targets
> a frequency dependent from the number of running spus.
>
> From: Maxim Shchetynin <maxim@de.ibm.com>
> Signed-off-by: Christian Krafft <krafft@de.ibm.com>
This needs your S-O-B, Arnd, and should go via jk.
Cheers,
Ben.
> ---
> arch/powerpc/platforms/cell/spufs/sched.c | 6 ++++++
> include/asm-powerpc/spu.h | 1 +
> 2 files changed, 7 insertions(+), 0 deletions(-)
>
> diff --git a/arch/powerpc/platforms/cell/spufs/sched.c b/arch/powerpc/platforms/cell/spufs/sched.c
> index e929e70..be77910 100644
> --- a/arch/powerpc/platforms/cell/spufs/sched.c
> +++ b/arch/powerpc/platforms/cell/spufs/sched.c
> @@ -993,6 +993,7 @@ void spuctx_switch_state(struct spu_context *ctx,
> struct timespec ts;
> struct spu *spu;
> enum spu_utilization_state old_state;
> + int node;
>
> ktime_get_ts(&ts);
> curtime = timespec_to_ns(&ts);
> @@ -1014,6 +1015,11 @@ void spuctx_switch_state(struct spu_context *ctx,
> spu->stats.times[old_state] += delta;
> spu->stats.util_state = new_state;
> spu->stats.tstamp = curtime;
> + node = spu->node;
> + if (old_state == SPU_UTIL_USER)
> + atomic_dec(&cbe_spu_info[node].busy_spus);
> + if (new_state == SPU_UTIL_USER);
> + atomic_inc(&cbe_spu_info[node].busy_spus);
> }
> }
>
> diff --git a/include/asm-powerpc/spu.h b/include/asm-powerpc/spu.h
> index 99348c1..8b2eb04 100644
> --- a/include/asm-powerpc/spu.h
> +++ b/include/asm-powerpc/spu.h
> @@ -191,6 +191,7 @@ struct cbe_spu_info {
> struct list_head spus;
> int n_spus;
> int nr_active;
> + atomic_t busy_spus;
> atomic_t reserved_spus;
> };
>
> --
> 1.5.4.3
>
^ permalink raw reply
* Re: [patch 01/11] powerpc/cell: add support for power button of future IBM cell blades
From: Benjamin Herrenschmidt @ 2008-07-07 5:12 UTC (permalink / raw)
To: arnd; +Cc: linuxppc-dev, Paul Mackerras, cbe-oss-dev, Christian Krafft
In-Reply-To: <20080704190805.638836822@arndb.de>
On Fri, 2008-07-04 at 21:05 +0200, arnd@arndb.de wrote:
> plain text document attachment
> (0001-powerpc-cell-add-support-for-power-button-of-future.patch)
> This patch adds support for the power button on future IBM cell blades.
> It actually doesn't shut down the machine. Instead it exposes an
> input device /dev/input/event0 to userspace which sends KEY_POWER
> if power button has been pressed.
> haldaemon actually recognizes the button, so a plattform independent acpid
> replacement should handle it correctly.
>
> Signed-off-by: Christian Krafft <krafft@de.ibm.com>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
And what if CONFIG_INPUT=n or m ?
Cheers,
Ben.
> arch/powerpc/platforms/cell/pervasive.c | 70 ++++++++++++++++++++++++++++++-
> 1 files changed, 69 insertions(+), 1 deletions(-)
>
> diff --git a/arch/powerpc/platforms/cell/pervasive.c b/arch/powerpc/platforms/cell/pervasive.c
> index 8a3631c..e5bd08c 100644
> --- a/arch/powerpc/platforms/cell/pervasive.c
> +++ b/arch/powerpc/platforms/cell/pervasive.c
> @@ -24,8 +24,10 @@
> #undef DEBUG
>
> #include <linux/interrupt.h>
> +#include <linux/input.h>
> #include <linux/irq.h>
> #include <linux/percpu.h>
> +#include <linux/platform_device.h>
> #include <linux/types.h>
> #include <linux/kallsyms.h>
>
> @@ -40,6 +42,9 @@
>
> static int sysreset_hack;
>
> +static struct input_dev *button_dev;
> +static struct platform_device *button_pdev;
> +
> static void cbe_power_save(void)
> {
> unsigned long ctrl, thread_switch_control;
> @@ -105,10 +110,21 @@ static int cbe_system_reset_exception(struct pt_regs *regs)
> */
> if (sysreset_hack && (cpu = smp_processor_id()) == 0) {
> pmd = cbe_get_cpu_pmd_regs(cpu);
> - if (in_be64(&pmd->ras_esc_0) & 0xffff) {
> + if (in_be64(&pmd->ras_esc_0) & 0x0000ffff) {
> out_be64(&pmd->ras_esc_0, 0);
> return 0;
> }
> + if (in_be64(&pmd->ras_esc_0) & 0x00010000) {
> + out_be64(&pmd->ras_esc_0, 0);
> + if (!button_dev)
> + return 0;
> +
> + input_report_key(button_dev, KEY_POWER, 1);
> + input_sync(button_dev);
> + input_report_key(button_dev, KEY_POWER, 0);
> + input_sync(button_dev);
> + return 1;
> + }
> }
> break;
> #ifdef CONFIG_CBE_RAS
> @@ -155,3 +171,55 @@ void __init cbe_pervasive_init(void)
> ppc_md.power_save = cbe_power_save;
> ppc_md.system_reset_exception = cbe_system_reset_exception;
> }
> +
> +static int __init cbe_power_button_init(void)
> +{
> + int ret;
> + struct input_dev *dev;
> +
> + if (!sysreset_hack)
> + return 0;
> +
> + dev = input_allocate_device();
> + if (!dev) {
> + ret = -ENOMEM;
> + printk(KERN_ERR "%s: Not enough memory\n", __func__);
> + goto out;
> + }
> +
> + set_bit(EV_KEY, dev->evbit);
> + set_bit(KEY_POWER, dev->keybit);
> +
> + dev->name = "Power Button";
> + dev->id.bustype = BUS_HOST;
> +
> + /* this makes the button look like an acpi power button
> + * no clue whether anyone relies on that though */
> + dev->id.product = 0x02;
> + dev->phys = "LNXPWRBN/button/input0";
> +
> + button_pdev = platform_device_register_simple("power_button", 0, NULL, 0);
> + if (IS_ERR(button_pdev)) {
> + ret = PTR_ERR(button_pdev);
> + goto out_free_input;
> + }
> +
> + dev->dev.parent = &button_pdev->dev;
> +
> + ret = input_register_device(dev);
> + if (ret) {
> + printk(KERN_ERR "%s: Failed to register device\n", __func__);
> + goto out_free_pdev;
> + }
> +
> + button_dev = dev;
> + return ret;
> +
> +out_free_pdev:
> + platform_device_unregister(button_pdev);
> +out_free_input:
> + input_free_device(dev);
> +out:
> + return ret;
> +}
> +device_initcall(cbe_power_button_init);
> --
> 1.5.4.3
>
^ permalink raw reply
* Re: [PATCH] Power5,Power6 BSR driver
From: Benjamin Herrenschmidt @ 2008-07-07 4:59 UTC (permalink / raw)
To: Sonny Rao; +Cc: sonnyrao, paulus, Nathan Lynch, linuxppc-dev
In-Reply-To: <20080618065123.GB13318@localhost.localdomain>
> + cur->bsr_addr = reg[i * 2];
> + cur->bsr_len = reg[i * 2 + 1];
That's fishy... hand-reading of "reg" property without taking
into account the parent's #size-cells/#address-cells... can't you
use of_address_to_resource or something similar and carry a struct
resource around instead ?
In fact, same goes with the way you do num_bsr_devs = reg_len / 16.
You should rather use -another- property of well known lenght, or
get the #address/#size-cells of the parent and use those appropriately.
Cheers,
Ben.
^ permalink raw reply
* Re: the printk problem
From: Stephen Rothwell @ 2008-07-07 4:59 UTC (permalink / raw)
To: michael; +Cc: linuxppc-dev
In-Reply-To: <1215401298.9862.1.camel@localhost>
[-- Attachment #1: Type: text/plain, Size: 296 bytes --]
On Mon, 07 Jul 2008 13:28:18 +1000 Michael Ellerman <michael@ellerman.id.au> wrote:
>
> Wasn't that already merged via the trivial scheduler fixes tree or
> something? ;)
Not yet.
--
Cheers,
Stephen Rothwell sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/
[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply
* [PATCH] powerpc: Use new printk extension %pS to print symbols on oops
From: Benjamin Herrenschmidt @ 2008-07-07 3:44 UTC (permalink / raw)
To: linuxppc-dev; +Cc: Linus Torvalds
This changes the oops and backtrace code to use the new %pS
printk extension to print out symbols rather than manually
calling print_symbol.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
arch/powerpc/kernel/process.c | 14 +++++---------
1 file changed, 5 insertions(+), 9 deletions(-)
--- linux-work.orig/arch/powerpc/kernel/process.c 2008-07-07 10:16:53.000000000 +1000
+++ linux-work/arch/powerpc/kernel/process.c 2008-07-07 11:04:32.000000000 +1000
@@ -484,10 +484,8 @@ void show_regs(struct pt_regs * regs)
* Lookup NIP late so we have the best change of getting the
* above info out without failing
*/
- printk("NIP ["REG"] ", regs->nip);
- print_symbol("%s\n", regs->nip);
- printk("LR ["REG"] ", regs->link);
- print_symbol("%s\n", regs->link);
+ printk("NIP ["REG"] %pS\n", regs->nip, (void *)regs->nip);
+ printk("LR ["REG"] %pS\n", regs->link, (void *)regs->link);
#endif
show_stack(current, (unsigned long *) regs->gpr[1]);
if (!user_mode(regs))
@@ -971,8 +969,7 @@ void show_stack(struct task_struct *tsk,
newsp = stack[0];
ip = stack[STACK_FRAME_LR_SAVE];
if (!firstframe || ip != lr) {
- printk("["REG"] ["REG"] ", sp, ip);
- print_symbol("%s", ip);
+ printk("["REG"] ["REG"] %pS", sp, ip, (void *)ip);
if (firstframe)
printk(" (unreliable)");
printk("\n");
@@ -987,10 +984,9 @@ void show_stack(struct task_struct *tsk,
&& stack[STACK_FRAME_MARKER] == STACK_FRAME_REGS_MARKER) {
struct pt_regs *regs = (struct pt_regs *)
(sp + STACK_FRAME_OVERHEAD);
- printk("--- Exception: %lx", regs->trap);
- print_symbol(" at %s\n", regs->nip);
lr = regs->link;
- print_symbol(" LR = %s\n", lr);
+ printk("--- Exception: %lx at %pS\n LR = %pS\n",
+ regs->trap, (void *)regs->nip, (void *)lr);
firstframe = 1;
}
^ permalink raw reply
* Re: the printk problem
From: Benjamin Herrenschmidt @ 2008-07-07 3:43 UTC (permalink / raw)
To: Stephen Rothwell; +Cc: linuxppc-dev
In-Reply-To: <20080707132615.f6b6247b.sfr@canb.auug.org.au>
On Mon, 2008-07-07 at 13:26 +1000, Stephen Rothwell wrote:
> > Did a few tests and it seems to work. I'll stick a patch converting
> > powerpc to use %pS for oops display in -next.
>
> After you post it to linuxppc-dev and get review comments, of
> course ...
I though I did that already, looks like I didn't. Let me see what went
wrong..
> And after the patch to make %pS work goes in ...
Yup.
Ben.
^ permalink raw reply
* Re: the printk problem
From: Michael Ellerman @ 2008-07-07 3:28 UTC (permalink / raw)
To: Stephen Rothwell; +Cc: linuxppc-dev
In-Reply-To: <20080707132615.f6b6247b.sfr@canb.auug.org.au>
[-- Attachment #1: Type: text/plain, Size: 1379 bytes --]
On Mon, 2008-07-07 at 13:26 +1000, Stephen Rothwell wrote:
> On Mon, 07 Jul 2008 11:14:36 +1000 Benjamin Herrenschmidt <benh@kernel.crashing.org> wrote:
> >
> > On Fri, 2008-07-04 at 16:25 -0700, Linus Torvalds wrote:
> > >
> > > On Sat, 5 Jul 2008, Benjamin Herrenschmidt wrote:
> > > >
> > > > I'll give it a try using probe_kernel_address() instead on monday.
> > >
> > > Here's the updated patch which uses probe_kernel_address() instead (and
> > > moves the whole #ifdef mess out of the code that wants it and into a
> > > helper function - and maybe we should then put that helper into
> > > kallsyms.h, but that's a different issue).
> > >
> > > Still all happily untested, of course. And still with no actual users
> > > converted.
> >
> > Did a few tests and it seems to work. I'll stick a patch converting
> > powerpc to use %pS for oops display in -next.
>
> After you post it to linuxppc-dev and get review comments, of course ...
>
> And after the patch to make %pS work goes in ...
Wasn't that already merged via the trivial scheduler fixes tree or
something? ;)
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
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox