Add Linux ASMP support for MPC8641D]
Subsystems (3)
PATCH RESEND 1/2 Add Linux ASMP support for MPC8641D]
Kumar,
As I indicated on IRC to you a few days ago, here is a copy of the Asymmetric Multi-Processor support patch for 8641 HPCN. For completeness and reference, the corresponding U-Boot patch will be posted to the U-Boot list as well.
This patch is directly split in two due to apparently mailer issues with the full patch. Apologies if you have received this patch twice.
This is the first half of the patch, everything but the defconfig.
Thanks,
jdl
From: Haiying Wang <[email protected]>
Subject: [PATCH] Add Linux ASMP support for MPC8641D
Date: Mon, 26 Feb 2007 15:51:29 -0500
1. Both cores can use the same kernel image but use individual dts file.
2. mpc8641d_asmp_defconfig is the default config file for ASMP support
3. TSEC1/2, Uart0, PCIe are assigned to core0, TSEC3/4, Uart1 are assigned to core1.
--- arch/powerpc/boot/dts/mpc8641_core0.dts | 287 +++++++ arch/powerpc/boot/dts/mpc8641_core1.dts | 125 +++ arch/powerpc/configs/mpc8641d_asmp_defconfig | 1152 ++++++++++++++++++++++++++ arch/powerpc/platforms/86xx/Kconfig | 4 + arch/powerpc/platforms/86xx/mpc86xx_hpcn.c | 4 + arch/powerpc/sysdev/mpic.c | 41 +- drivers/net/gianfar.c | 24 + 7 files changed, 1635 insertions(+), 2 deletions(-)
arch/powerpc/boot/dts/mpc8641_core0.dts new file +287 -0
@@ -0,0 +1,287 @@ +/* + * MPC8641 HPCN Core0 Device Tree Source + * + * Copyright 2006-2007 Freescale Semiconductor Inc. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + */ + + +/ { + model = "MPC8641HPCN"; + compatible = "mpc86xx"; + #address-cells = <1>; + #size-cells = <1>; + + cpus { + #cpus = <1>; + #address-cells = <1>; + #size-cells = <0>; + + PowerPC,8641@0 { + device_type = "cpu"; + reg = <0>; + d-cache-line-size = <20>; // 32 bytes + i-cache-line-size = <20>; // 32 bytes + d-cache-size = <8000>; // L1, 32K + i-cache-size = <8000>; // L1, 32K + timebase-frequency = <0>; // 33 MHz, from uboot + bus-frequency = <0>; // From uboot + clock-frequency = <0>; // From uboot + 32-bit; + }; + }; + + memory { + device_type = "memory"; + reg = <00000000 10000000>; // 256M at 0x0 + }; + + soc8641@f8000000 { + #address-cells = <1>; + #size-cells = <1>; + #interrupt-cells = <1>; + device_type = "soc"; + ranges = <0 f8000000 00100000>; + reg = <f8000000 00100000>; // CCSRBAR 1M + bus-frequency = <0>; + + i2c@3000 { + device_type = "i2c"; + compatible = "fsl-i2c"; + reg = <3000 100>; + interrupts = <2b 2>; + interrupt-parent = <&mpic>; + dfsrr; + }; + + i2c@3100 { + device_type = "i2c"; + compatible = "fsl-i2c"; + reg = <3100 100>; + interrupts = <2b 2>; + interrupt-parent = <&mpic>; + dfsrr; + }; + + mdio@24520 { + #address-cells = <1>; + #size-cells = <0>; + device_type = "mdio"; + compatible = "gianfar"; + reg = <24520 20>; + phy0: ethernet-phy@0 { + interrupt-parent = <&mpic>; + interrupts = <4a 1>; + reg = <0>; + device_type = "ethernet-phy"; + }; + phy1: ethernet-phy@1 { + interrupt-parent = <&mpic>; + interrupts = <4a 1>; + reg = <1>; + device_type = "ethernet-phy"; + }; + }; + + ethernet@24000 { + #address-cells = <1>; + #size-cells = <0>; + device_type = "network"; + model = "TSEC"; + compatible = "gianfar"; + reg = <24000 1000>; + mac-address = [ 00 E0 0C 00 73 00 ]; + interrupts = <1d 2 1e 2 22 2>; + interrupt-parent = <&mpic>; + phy-handle = <&phy0>; + }; + + ethernet@25000 { + #address-cells = <1>; + #size-cells = <0>; + device_type = "network"; + model = "TSEC"; + compatible = "gianfar"; + reg = <25000 1000>; + mac-address = [ 00 E0 0C 00 73 01 ]; + interrupts = <23 2 24 2 28 2>; + interrupt-parent = <&mpic>; + phy-handle = <&phy1>; + }; + + serial@4500 { + device_type = "serial"; + compatible = "ns16550"; + reg = <4500 100>; + clock-frequency = <0>; + interrupts = <2a 2>; + interrupt-parent = <&mpic>; + }; + + pci@8000 { + compatible = "86xx"; + device_type = "pci"; + #interrupt-cells = <1>; + #size-cells = <2>; + #address-cells = <3>; + reg = <8000 1000>; + bus-range = <0 fe>; + ranges = <02000000 0 80000000 80000000 0 20000000 + 01000000 0 00000000 e2000000 0 00100000>; + clock-frequency = <1fca055>; + interrupt-parent = <&mpic>; + interrupts = <18 2>; + interrupt-map-mask = <f800 0 0 7>; + interrupt-map = < + /* IDSEL 0x11 */ + 8800 0 0 1 &i8259 3 2 + 8800 0 0 2 &i8259 4 2 + 8800 0 0 3 &i8259 5 2 + 8800 0 0 4 &i8259 6 2 + + /* IDSEL 0x12 */ + 9000 0 0 1 &i8259 4 2 + 9000 0 0 2 &i8259 5 2 + 9000 0 0 3 &i8259 6 2 + 9000 0 0 4 &i8259 3 2 + + /* IDSEL 0x13 */ + 9800 0 0 1 &i8259 0 0 + 9800 0 0 2 &i8259 0 0 + 9800 0 0 3 &i8259 0 0 + 9800 0 0 4 &i8259 0 0 + + /* IDSEL 0x14 */ + a000 0 0 1 &i8259 0 0 + a000 0 0 2 &i8259 0 0 + a000 0 0 3 &i8259 0 0 + a000 0 0 4 &i8259 0 0 + + /* IDSEL 0x15 */ + a800 0 0 1 &i8259 0 0 + a800 0 0 2 &i8259 0 0 + a800 0 0 3 &i8259 0 0 + a800 0 0 4 &i8259 0 0 + + /* IDSEL 0x16 */ + b000 0 0 1 &i8259 0 0 + b000 0 0 2 &i8259 0 0 + b000 0 0 3 &i8259 0 0 + b000 0 0 4 &i8259 0 0 + + /* IDSEL 0x17 */ + b800 0 0 1 &i8259 0 0 + b800 0 0 2 &i8259 0 0 + b800 0 0 3 &i8259 0 0 + b800 0 0 4 &i8259 0 0 + + /* IDSEL 0x18 */ + c000 0 0 1 &i8259 0 0 + c000 0 0 2 &i8259 0 0 + c000 0 0 3 &i8259 0 0 + c000 0 0 4 &i8259 0 0 + + /* IDSEL 0x19 */ + c800 0 0 1 &i8259 0 0 + c800 0 0 2 &i8259 0 0 + c800 0 0 3 &i8259 0 0 + c800 0 0 4 &i8259 0 0 + + /* IDSEL 0x1a */ + d000 0 0 1 &i8259 6 2 + d000 0 0 2 &i8259 3 2 + d000 0 0 3 &i8259 4 2 + d000 0 0 4 &i8259 5 2 + + + /* IDSEL 0x1b */ + d800 0 0 1 &i8259 5 2 + d800 0 0 2 &i8259 0 0 + d800 0 0 3 &i8259 0 0 + d800 0 0 4 &i8259 0 0 + + /* IDSEL 0x1c */ + e000 0 0 1 &i8259 9 2 + e000 0 0 2 &i8259 a 2 + e000 0 0 3 &i8259 c 2 + e000 0 0 4 &i8259 7 2 + + /* IDSEL 0x1d */ + e800 0 0 1 &i8259 9 2 + e800 0 0 2 &i8259 a 2 + e800 0 0 3 &i8259 b 2 + e800 0 0 4 &i8259 0 0 + + /* IDSEL 0x1e */ + f000 0 0 1 &i8259 c 2 + f000 0 0 2 &i8259 0 0 + f000 0 0 3 &i8259 0 0 + f000 0 0 4 &i8259 0 0 + + /* IDSEL 0x1f */ + f800 0 0 1 &i8259 6 2 + f800 0 0 2 &i8259 0 0 + f800 0 0 3 &i8259 0 0 + f800 0 0 4 &i8259 0 0 + >; + i8259: i8259@4d0 { + clock-frequency = <0>; + interrupt-controller; + device_type = "interrupt-controller"; + #address-cells = <0>; + #interrupt-cells = <2>; + built-in; + compatible = "chrp,iic"; + big-endian; + interrupts = <49 2>; + interrupt-parent = <&mpic>; + }; + + }; + + pci@9000 { + compatible = "86xx"; + device_type = "pci"; + #interrupt-cells = <1>; + #size-cells = <2>; + #address-cells = <3>; + reg = <9000 1000>; + bus-range = <0 ff>; + ranges = <02000000 0 a0000000 a0000000 0 20000000 + 01000000 0 00000000 e3000000 0 00100000>; + clock-frequency = <1fca055>; + interrupt-parent = <&mpic>; + interrupts = <19 2>; + interrupt-map-mask = <f800 0 0 7>; + interrupt-map = < + /* IDSEL 0x0 */ + 0000 0 0 1 &mpic 44 1 + 0000 0 0 2 &mpic 45 1 + 0000 0 0 3 &mpic 46 1 + 0000 0 0 4 &mpic 47 1 + >; + }; + + mpic: pic@40000 { + clock-frequency = <0>; + interrupt-controller; + #address-cells = <0>; + #interrupt-cells = <2>; + reg = <40000 40000>; + built-in; + compatible = "chrp,open-pic"; + device_type = "open-pic"; + big-endian; + interrupts = < + 18 2 49 2 19 2 + 2a 2 2b 2 4a 1 + 1d 2 1e 2 22 2 + 23 2 24 2 28 2 + >; + }; + }; +};
arch/powerpc/boot/dts/mpc8641_core1.dts new file +125 -0
125 lines not on this page · raw message
arch/powerpc/platforms/86xx/Kconfig +4 -0
@@ -30,4 +30,8 @@ config PPC_INDIRECT_PCI_BE depends on PPC_86xx default y +config ASMP + bool "Asynchronous SMP support" + depends on PPC_86xx + default n endmenu
arch/powerpc/platforms/86xx/mpc86xx_hpcn.c +4 -0
@@ -80,7 +80,11 @@ mpc86xx_hpcn_init_irq(void)/* Alloc mpic structure and per isu has 16 INT entries. */ mpic1 =mpic_alloc (np, res.start, +#ifdef CONFIG_ASMP +MPIC_PRIMARY |MPIC_BIG_ENDIAN , +#elseMPIC_PRIMARY |MPIC_WANTS_RESET |MPIC_BIG_ENDIAN , +#endif16 ,NR_IRQS -10 ," MPIC " );BUG_ON (mpic1 ==NULL );
arch/powerpc/sysdev/mpic.c +39 -2
71 lines not on this page · raw message
drivers/net/gianfar.c +24 -0
@@ -692,11 +692,21 @@ int startup_gfar(struct net_device *dev) priv->tx_bd_base = (struct txbd8 *) vaddr; +#ifdef CONFIG_ASMP +unsigned int pir; + pir =mfspr (SPRN_PIR ); +/* enet DMA only understands physical addresses */ +gfar_write (®s->tbase0, ((unsigned int )addr +0x10000000 * pir)); + +/* Start the rx descriptor ring where the tx ring leaves off */ + addr = addr +sizeof (struct txbd8 ) * priv->tx_ring_size +0x10000000 * pir; +#else /* enet DMA only understands physical addresses */ gfar_write (®s->tbase0, addr);/* Start the rx descriptor ring where the tx ring leaves off */ addr = addr +sizeof (struct txbd8 ) * priv->tx_ring_size; +#endif vaddr = vaddr +sizeof (struct txbd8 ) * priv->tx_ring_size; priv->rx_bd_base = (struct rxbd8 *) vaddr;gfar_write (®s->rbase0, addr);
@@ -1006,8 +1016,15 @@ static int gfar_start_xmit(struct sk_buff *skb, struct net_device *dev)/* Set buffer length and pointer */ txbdp->length = skb->len; +#ifdef CONFIG_ASMP +unsigned int pir; + pir =mfspr (SPRN_PIR ); + txbdp->bufPtr =dma_map_single (NULL , skb->data, + skb->len,DMA_TO_DEVICE ) +0x10000000 * pir; +#else txbdp->bufPtr =dma_map_single (NULL , skb->data, skb->len,DMA_TO_DEVICE ); +#endif /* Save the skb pointer so we can free it later */ priv->tx_skbuff[priv->skb_curtx] = skb;
@@ -1298,8 +1315,15 @@ struct sk_buff * gfar_new_skb(struct net_device *dev, struct rxbd8 *bdp) skb->dev = dev; +#ifdef CONFIG_ASMP +unsigned int pir; + pir =mfspr (SPRN_PIR ); + bdp->bufPtr =dma_map_single (NULL , skb->data, + priv->rx_buffer_size,DMA_FROM_DEVICE ) +0x10000000 * pir; +#else bdp->bufPtr =dma_map_single (NULL , skb->data, priv->rx_buffer_size,DMA_FROM_DEVICE ); +#endif bdp->length =0 ;
Quoted 7 lines · Jon Loeliger
Kumar,
As I indicated on IRC to you a few days ago, here is a copy of the Asymmetric Multi-Processor support patch for 8641 HPCN. For completeness and reference, the corresponding U-Boot patch will be posted to the U-Boot list as well.
Quoted 8 lines
This patch is directly split in two due to apparently mailer issues with the full patch. Apologies if you have received this patch twice.
This is the first half of the patch, everything but the defconfig.
Thanks,
jdl
This isn't nearly as much change as I was expecting :)
Can you elaborate on what the changes to mpic and gfar are doing.
I assume that memory is split between the two cores. So if you have 512M of memory 0-256 is for core0 and 256-512 for core1, or do you handle this some other way (excluding the magic hw hack for exception vectors)?
thanks
- k
Quoted 10 lines
arch/powerpc/boot/dts/mpc8641_core0.dts new file +9
-0+ mpic: pic@40000 { + clock-frequency =3D <0>; + interrupt-controller; + #address-cells =3D <0>; + #interrupt-cells =3D <2>; + reg =3D <40000 40000>; + built-in; + compatible =3D "chrp,open-pic"; + device_type =3D "open-pic";
arch/powerpc/boot/dts/mpc8641_core0.dts line 287
Quoted 10 lines
arch/powerpc/boot/dts/mpc8641_core0.dts new file +10
-0+ big-endian; + interrupts =3D < + 18 2 49 2 19 2 + 2a 2 2b 2 4a 1 + 1d 2 1e 2 22 2 + 23 2 24 2 28 2 + >; + }; + }; +};
I think using the 'interrupts' property in this way is bad. It's=20 being used to tell the pic which interrupts belong to it.=20
The problem is that the interrupts property is being overloaded and used for a completely different purpose than that which it was originally intended and documented. Interrupt controllers should not have an interrupts property.
The only reason I can see to do this is as a convenience to avoid
walking the device tree. The pic code should walk the device tree
to determine the irq numbers the running core.
Stuart
Quoted 24 lines · On Thu, Mar 22, 2007 at 08:32:33AM -0700, Yoder Stuart-B08248 wrote:
Quoted 10 lines
arch/powerpc/boot/dts/mpc8641_core0.dts new file +9
-0+ mpic: pic@40000 { + clock-frequency = <0>; + interrupt-controller; + #address-cells = <0>; + #interrupt-cells = <2>; + reg = <40000 40000>; + built-in; + compatible = "chrp,open-pic"; + device_type = "open-pic";arch/powerpc/boot/dts/mpc8641_core0.dts line 287
Quoted 10 lines
arch/powerpc/boot/dts/mpc8641_core0.dts new file +10
-0+ big-endian; + interrupts = < + 18 2 49 2 19 2 + 2a 2 2b 2 4a 1 + 1d 2 1e 2 22 2 + 23 2 24 2 28 2 + >; + }; + }; +};I think using the 'interrupts' property in this way is bad. It's being used to tell the pic which interrupts belong to it.
Quoted 8 lines
The problem is that the interrupts property is being overloaded and used for a completely different purpose than that which it was originally intended and documented. Interrupt controllers should not have an interrupts property.
The only reason I can see to do this is as a convenience to avoid
walking the device tree. The pic code should walk the device tree
to determine the irq numbers the running core.
Not speaking for the case of the freescale boards here, but not all interrupts are in the device tree, nor do they have to. Especially for PCI devices, etc.
This is quite a special case. Having a brand new property for it might be a good idea. It's a pretty big hack anyway, so adding another one to the device tree isn't that big a deal.
-Olof
Quoted 34 lines · Olof Johansson
Quoted 24 lines · On Thu, Mar 22, 2007 at 08:32:33AM -0700, Yoder Stuart-B08248 wrote:
Quoted 10 lines
arch/powerpc/boot/dts/mpc8641_core0.dts new file +9
-0+ mpic: pic@40000 { + clock-frequency = <0>; + interrupt-controller; + #address-cells = <0>; + #interrupt-cells = <2>; + reg = <40000 40000>; + built-in; + compatible = "chrp,open-pic"; + device_type = "open-pic";arch/powerpc/boot/dts/mpc8641_core0.dts line 287
Quoted 10 lines
arch/powerpc/boot/dts/mpc8641_core0.dts new file +10
-0+ big-endian; + interrupts = < + 18 2 49 2 19 2 + 2a 2 2b 2 4a 1 + 1d 2 1e 2 22 2 + 23 2 24 2 28 2 + >; + }; + }; +};I think using the 'interrupts' property in this way is bad. It's being used to tell the pic which interrupts belong to it.
Quoted 8 lines
The problem is that the interrupts property is being overloaded and used for a completely different purpose than that which it was originally intended and documented. Interrupt controllers should not have an interrupts property.
The only reason I can see to do this is as a convenience to avoid
walking the device tree. The pic code should walk the device tree
to determine the irq numbers the running core.
Quoted 7 lines
Not speaking for the case of the freescale boards here, but not all interrupts are in the device tree, nor do they have to. Especially for PCI devices, etc.
This is quite a special case. Having a brand new property for it might be a good idea. It's a pretty big hack anyway, so adding another one to the device tree isn't that big a deal.
I think the issue is you don't want the per interrupt registers initialized twice. Thus I suggest we just let set_irq_type handle it.
There is still an issue for shared interrupts, but I don't think you can solve that. W/o moving the interrupt processing to some common level.
- k
=20
Quoted 55 lines
-----Original Message-----
From: Kumar Gala [mailto:[email protected]]=20
Sent: Thursday, March 22, 2007 10:44 AM
To: Olof Johansson
Cc: Yoder Stuart-B08248; [email protected]
Subject: Re: [Fwd: [PATCH Resend 01/02] Add Linux ASMP=20 support for MPC8641D]
=20
=20
On Mar 22, 2007, at 10:51 AM, Olof Johansson wrote:
=20Quoted 30 lines · On Thu, Mar 22, 2007 at 08:32:33AM -0700, Yoder Stuart-B08248 wrote:
Quoted 29 lines
Quoted 10 lines
arch/powerpc/boot/dts/mpc8641_core0.dts new file +9
-0+ mpic: pic@40000 { + clock-frequency =3D <0>; + interrupt-controller; + #address-cells =3D <0>; + #interrupt-cells =3D <2>; + reg =3D <40000 40000>; + built-in; + compatible =3D "chrp,open-pic"; + device_type =3D "open-pic";arch/powerpc/boot/dts/mpc8641_core0.dts line 287
Quoted 10 lines
arch/powerpc/boot/dts/mpc8641_core0.dts new file +10
-0+ big-endian; + interrupts =3D < + 18 2 49 2 19 2 + 2a 2 2b 2 4a 1 + 1d 2 1e 2 22 2 + 23 2 24 2 28 2 + >; + }; + }; +};I think using the 'interrupts' property in this way is bad. It's being used to tell the pic which interrupts belong to it.
The problem is that the interrupts property is being overloaded and used for a completely different purpose than that which it was originally intended and documented. Interrupt controllers should not have an interrupts property.
Quoted 6 lines
Quoted 3 lines
The only reason I can see to do this is as a convenience to avoid
walking the device tree. The pic code should walk the device tree
to determine the irq numbers the running core.Not speaking for the case of the freescale boards here, but not all interrupts are in the device tree, nor do they have to.=20
Especially for
Quoted 3 lines
PCI devices, etc.
This is quite a special case. Having a brand new property=20
for it might
Quoted 3 lines
be a good idea. It's a pretty big hack anyway, so adding another =20 one to
the device tree isn't that big a deal.
Quoted 7 lines
=20
I think the issue is you don't want the per interrupt registers =20 initialized twice. Thus I suggest we just letset_irq_typehandle it. =20
There is still an issue for shared interrupts, but I don't think you =20 can solve that. W/o moving the interrupt processing to some common =20 level.
As I understand the patch, there are two DTS files once for each core and each having a partitioned set of devices for that core. In the=20 current patch the pic in each DTS has a unique 'interrupts' property.
This shouldn't be necessary-- to initialize the pic should simply be a matter of each core walking it's device tree, which only has the devices=20
assigned to it, and programming the pic appropriately. No registers
should be programmed twice.
Stuart
Quoted 69 lines · On Mar 22, 2007, at 10:58 AM, Yoder Stuart-B08248 wrote:
Quoted 58 lines
-----Original Message-----
From: Kumar Gala [mailto:[email protected]]
Sent: Thursday, March 22, 2007 10:44 AM
To: Olof Johansson
Cc: Yoder Stuart-B08248; [email protected]
Subject: Re: [Fwd: [PATCH Resend 01/02] Add Linux ASMP support for MPC8641D]Quoted 30 lines · Olof Johansson
Quoted 29 lines · On Thu, Mar 22, 2007 at 08:32:33AM -0700, Yoder Stuart-B08248 wrote:
Quoted 10 lines
arch/powerpc/boot/dts/mpc8641_core0.dts new file +9
-0+ mpic: pic@40000 { + clock-frequency = <0>; + interrupt-controller; + #address-cells = <0>; + #interrupt-cells = <2>; + reg = <40000 40000>; + built-in; + compatible = "chrp,open-pic"; + device_type = "open-pic";arch/powerpc/boot/dts/mpc8641_core0.dts line 287
Quoted 10 lines
arch/powerpc/boot/dts/mpc8641_core0.dts new file +10
-0+ big-endian; + interrupts = < + 18 2 49 2 19 2 + 2a 2 2b 2 4a 1 + 1d 2 1e 2 22 2 + 23 2 24 2 28 2 + >; + }; + }; +};I think using the 'interrupts' property in this way is bad. It's being used to tell the pic which interrupts belong to it.
The problem is that the interrupts property is being overloaded and used for a completely different purpose than that which it was originally intended and documented. Interrupt controllers should not have an interrupts property.
Quoted 6 lines
Quoted 3 lines
The only reason I can see to do this is as a convenience to avoid
walking the device tree. The pic code should walk the device tree
to determine the irq numbers the running core.Not speaking for the case of the freescale boards here, but not all interrupts are in the device tree, nor do they have to.
Especially for
Quoted 3 lines
PCI devices, etc.
This is quite a special case. Having a brand new property
for it might
Quoted 3 lines
be a good idea. It's a pretty big hack anyway, so adding another one to
the device tree isn't that big a deal.Quoted 6 lines
I think the issue is you don't want the per interrupt registers initialized twice. Thus I suggest we just let
set_irq_typehandle it.There is still an issue for shared interrupts, but I don't think you can solve that. W/o moving the interrupt processing to some common level.
As I understand the patch, there are two DTS files once for each core and each having a partitioned set of devices for that core. In the current patch the pic in each DTS has a unique 'interrupts' property.
Quoted 5 lines
This shouldn't be necessary-- to initialize the pic should simply be a matter of each core walking it's device tree, which only has the devices
assigned to it, and programming the pic appropriately. No registers
should be programmed twice.
If you look at what mpic_init() does you will see that the registers would be setup twice.
Also, you don't need to walk the device-tree at all. As Olof pointed out there maybe interrupts that are not described in the device tree. We can setup this information when you do a request_irq() -> set_irq_type().
If you aren't doing a request_irq() for the interrupt than it doesn't need to be setup. Additionally, you should only doing a request_irq() for an interrupt that is "owned" by that core.
- k
Quoted 4 lines
If you look at what
mpic_init()does you will see that the registers would be setup twice.
Quoted 8 lines
Also, you don't need to walk the device-tree at all. As Olof pointed out there maybe interrupts that are not described in the device tree. We can setup this information when you do a
request_irq()->set_irq_type().If you aren't doing a
request_irq()for the interrupt than it doesn't need to be setup. Additionally, you should only doing arequest_irq() for an interrupt that is "owned" by that core.
The need to have an MPIC shared by more than one cores is something that will be coming elsewhere too (can't give details...)
I think we should invent an MPIC specific property indicating that the MPIC is to be shared and indicating on one of the users that it's the "master" (the one doing the initial full setup, the others can then spin on some bit somewhere before going on, unless we decide such a shared setup, the PIC has to be pre-initialized by some firmware and we skip all inits in mpic) and indicating which sources belong to which users.
Ben.
Quoted 16 lines · Benjamin Herrenschmidt
Quoted 4 lines
If you look at what
mpic_init()does you will see that the registers would be setup twice.Quoted 8 lines
Also, you don't need to walk the device-tree at all. As Olof pointed out there maybe interrupts that are not described in the device tree. We can setup this information when you do a
request_irq()->set_irq_type().If you aren't doing a
request_irq()for the interrupt than it doesn't need to be setup. Additionally, you should only doing arequest_irq() for an interrupt that is "owned" by that core.The need to have an MPIC shared by more than one cores is something that will be coming elsewhere too (can't give details...)
Quoted 6 lines
I think we should invent an MPIC specific property indicating that the MPIC is to be shared and indicating on one of the users that it's the "master" (the one doing the initial full setup, the others can then spin on some bit somewhere before going on, unless we decide such a shared setup, the PIC has to be pre-initialized by some firmware and we skip all inits in mpic) and indicating which sources belong to which users.
I don't see why we need to do as much work as we do in mpic_init. We already set IRQ_VECTOR_PRI in mpic_set_irq_type() we could easily add setting IRQ_DESTINATION as well.
- k
Quoted 6 lines
I think we should invent an MPIC specific property indicating that the MPIC is to be shared and indicating on one of the users that it's the "master" (the one doing the initial full setup, the others can then spin on some bit somewhere before going on, unless we decide such a shared setup, the PIC has to be pre-initialized by some firmware and we skip all inits in mpic) and indicating which sources belong to which users.
There certainly are way more things then just the MPIC that both CPUs could do both only one should. And this is really the kernel's business, not something to pollute the device tree with -- well perhaps a global flag (in /chosen, perhaps) that says "this or that CPU initialises the shared resources".
It might make sense to have the firmware setup the devices on these strange strange boards, dunno -- let's worry about that if/when a board where someone wants that shows up :-)
Segher
Quoted 3 lines
This is quite a special case. Having a brand new property for it might be a good idea. It's a pretty big hack anyway, so adding another one to the device tree isn't that big a deal.
Yes please. If you must put this information in a property in the mpic node (I'm not convinced you should, but I haven't really looked at it either), please don't overload the existing "interrupts" semantics -- just use a different property name (and choose some descriptive new name, not something too generic).
Segher
Quoted 24 lines · On Mar 22, 2007, at 10:32 AM, Yoder Stuart-B08248 wrote:
Quoted 10 lines
arch/powerpc/boot/dts/mpc8641_core0.dts new file +9
-0+ mpic: pic@40000 { + clock-frequency = <0>; + interrupt-controller; + #address-cells = <0>; + #interrupt-cells = <2>; + reg = <40000 40000>; + built-in; + compatible = "chrp,open-pic"; + device_type = "open-pic";arch/powerpc/boot/dts/mpc8641_core0.dts line 287
Quoted 10 lines
arch/powerpc/boot/dts/mpc8641_core0.dts new file +10
-0+ big-endian; + interrupts = < + 18 2 49 2 19 2 + 2a 2 2b 2 4a 1 + 1d 2 1e 2 22 2 + 23 2 24 2 28 2 + >; + }; + }; +};I think using the 'interrupts' property in this way is bad. It's being used to tell the pic which interrupts belong to it.
Quoted 8 lines
The problem is that the interrupts property is being overloaded and used for a completely different purpose than that which it was originally intended and documented. Interrupt controllers should not have an interrupts property.
The only reason I can see to do this is as a convenience to avoid
walking the device tree. The pic code should walk the device tree
to determine the irq numbers the running core.
We could just add a flag to skip the initialization of these regs @ mpic_init and let set_irq_type do it.
- k
Milton Miller
NAKarch/powerpc/boot/dts/mpc8641_core0.dts line 23
Quoted 4 lines · Jon Loeliger
arch/powerpc/boot/dts/mpc8641_core0.dts new file +4
-0+ cpus { + #cpus = <1>; + #address-cells = <1>; +
#cpus is not needed, please remove.
Quoted 1 line
(quoted diff) +1
-0+ mpic: pic at 40000 {
..
Review
Quoted 2 lines
(quoted diff) +2
-0+ compatible = "chrp,open-pic"; + device_type = "open-pic";
Since its shared, we could add another type here to let us know. [and yes, the interrupts property here needs to become something else, probably with ranges in its name].
arch/powerpc/platforms/86xx/mpc86xx_hpcn.c mpc86xx_hpcn_init_irq(void) · line 87
Quoted 8 lines
arch/powerpc/platforms/86xx/mpc86xx_hpcn.c +4
-0/* Alloc mpic structure and per isu has 16 INT entries. */ mpic1 = mpic_alloc(np, res.start, +#ifdef CONFIG_ASMP + MPIC_PRIMARY | MPIC_BIG_ENDIAN, +#else MPIC_PRIMARY | MPIC_WANTS_RESET | MPIC_BIG_ENDIAN, +#endif
How about:
+#ifndef CONFIG_ASMP
+ MPIC_WANTS_RESET |
+#endif
MPIC_PRIMARY | MPIC_BIG_ENDIAN,
Just a suggestion.
Quoted 9 lines
arch/powerpc/sysdev/mpic.c +0
-1@@ -707,9 +707,15 @@ static void mpic_set_affinity(unsigned int irq, cpumask_t cpumask)cpumask_t tmp;cpus_and (tmp, cpumask, cpu_online_map); -
arch/powerpc/sysdev/mpic.c static void mpic_set_affinity(unsigned int irq, cpumask_t cpumask) · line 718
Quoted 10 lines
arch/powerpc/sysdev/mpic.c +8
-1+#ifdef CONFIG_ASMP +unsigned int pir; + pir =mfspr (SPRN_PIR ); +mpic_irq_write (src,MPIC_INFO (IRQ_DESTINATION ), +1 << pir); +#else mpic_irq_write (src,MPIC_INFO (IRQ_DESTINATION ), -mpic_physmask (cpus_addr (tmp)[0 ])); +mpic_physmask (cpus_addr (tmp)[0 ])); +#endif
NAK.
Don't use mfspr in mpic.c.
set hard_smp_processor_id() instead, mpic_physmask already uses it.
Quoted 7 lines
drivers/net/gianfar.c +0
-0@@ -692,11 +692,21 @@ int startup_gfar(struct net_device *dev) priv->tx_bd_base = (struct txbd8 *) vaddr;
drivers/net/gianfar.c int startup_gfar(struct net_device *dev) · line 703
Quoted 10 lines
drivers/net/gianfar.c +9
-0+#ifdef CONFIG_ASMP +unsigned int pir; + pir =mfspr (SPRN_PIR ); +/* enet DMA only understands physical addresses */ +gfar_write (®s->tbase0, ((unsigned int )addr +0x10000000 * pir)); + +/* Start the rx descriptor ring where the tx ring leaves off */ + addr = addr +sizeof (struct txbd8 ) * priv->tx_ring_size +0x10000000 * pir; +#else
Hard coded memory layout? In a driver? Really?
Use the dma_mapping api.
Store your kernel to physical offset in a memory location. Have the dma_mapping api add this offset.
milton