LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* Re: [RFC,PATCH 1/7 v2] Add a common struct clk
From: Ben Dooks @ 2010-01-12 14:24 UTC (permalink / raw)
  To: Russell King - ARM Linux
  Cc: Francesco VIRLINZI, Jeremy Kerr, linuxppc-dev, linux-kernel,
	linux-arm-kernel
In-Reply-To: <20100112090149.GB26435@n2100.arm.linux.org.uk>

On Tue, Jan 12, 2010 at 09:01:49AM +0000, Russell King - ARM Linux wrote:
> On Tue, Jan 12, 2010 at 09:48:44AM +0100, Francesco VIRLINZI wrote:
> > Hi Jeremy
> > In November I already sent a proposal on
> >  a generic linux clk framework.
> > On that I would suggest:
> >
> >>
> >> +struct clk {
> >> +	const struct clk_operations *ops;
> >>    
> >            spinlock_t lock;
> >            const char *name;
> >            int id;
> 
> Name and ID are totally pointless, unless you insist on using the clk
> API in the wrong way (like S3C does.)

I do intend to change the clock lookup on the Samsung series, but we're
currently in the process of trying to do a whole pile of work on not
only adding new SoCs but also cleaning up the existing support and making
a whole pile of code common to all the Samsung SoC family.

I never got the time to go throughly through Francesco's clock framework
but it seemed rathe rcomplicated for our current requirements and also
had a whole pile of style problems that made it really difficult to read.

-- 
Ben

Q:      What's a light-year?
A:      One-third less calories than a regular year.

^ permalink raw reply

* Re: [PATCH-V3] mpc8xxx_gpio: add interrupt support
From: Peter Korsgaard @ 2010-01-12 16:24 UTC (permalink / raw)
  To: avorontsov; +Cc: linuxppc-dev
In-Reply-To: <1262883466-29371-1-git-send-email-jacmet@sunsite.dk>

>>>>> Peter Korsgaard <jacmet@sunsite.dk> writes:

Hi,

Anton, any comments on this?

 > Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
 > ---
 > Changes since v1:
 > - Document OF binding for IRQ as requested by Kumar.

 > Changes since v2:
 > - Fix xlate prototype mismatch warning (intspec should be const)

 >  .../powerpc/dts-bindings/fsl/8xxx_gpio.txt         |   22 +++-
 >  arch/powerpc/sysdev/mpc8xxx_gpio.c                 |  147 ++++++++++++++++++++
 >  2 files changed, 168 insertions(+), 1 deletions(-)

 > diff --git a/Documentation/powerpc/dts-bindings/fsl/8xxx_gpio.txt b/Documentation/powerpc/dts-bindings/fsl/8xxx_gpio.txt
 > index d015dce..b0019eb 100644
 > --- a/Documentation/powerpc/dts-bindings/fsl/8xxx_gpio.txt
 > +++ b/Documentation/powerpc/dts-bindings/fsl/8xxx_gpio.txt
 > @@ -11,7 +11,7 @@ Required properties:
 >    83xx, "fsl,mpc8572-gpio" for 85xx and "fsl,mpc8610-gpio" for 86xx.
 >  - #gpio-cells : Should be two. The first cell is the pin number and the
 >    second cell is used to specify optional parameters (currently unused).
 > - - interrupts : Interrupt mapping for GPIO IRQ (currently unused).
 > + - interrupts : Interrupt mapping for GPIO IRQ.
 >   - interrupt-parent : Phandle for the interrupt controller that
 >     services interrupts for this device.
 >  - gpio-controller : Marks the port as GPIO controller.
 > @@ -38,3 +38,23 @@ Example of gpio-controller nodes for a MPC8347 SoC:
 
 >  See booting-without-of.txt for details of how to specify GPIO
 >  information for devices.
 > +
 > +To use GPIO pins as interrupt sources for peripherals, specify the
 > +GPIO controller as the interrupt parent and define GPIO number +
 > +trigger mode using the interrupts property, which is defined like
 > +this:
 > +
 > +interrupts = <number trigger>, where:
 > + - number: GPIO pin (0..31)
 > + - trigger: trigger mode:
 > +	2 = trigger on falling edge
 > +	3 = trigger on both edges
 > +
 > +Example of device using this is:
 > +
 > +	funkyfpga@0 {
 > +		compatible = "funky-fpga";
 > +		...
 > +		interrupts = <4 3>;
 > +		interrupt-parent = <&gpio1>;
 > +	};
 > diff --git a/arch/powerpc/sysdev/mpc8xxx_gpio.c b/arch/powerpc/sysdev/mpc8xxx_gpio.c
 > index ee1c0e1..1bd930e 100644
 > --- a/arch/powerpc/sysdev/mpc8xxx_gpio.c
 > +++ b/arch/powerpc/sysdev/mpc8xxx_gpio.c
 > @@ -15,6 +15,7 @@
 >  #include <linux/of.h>
 >  #include <linux/of_gpio.h>
 >  #include <linux/gpio.h>
 > +#include <linux/irq.h>
 
 >  #define MPC8XXX_GPIO_PINS	32
 
 > @@ -34,6 +35,7 @@ struct mpc8xxx_gpio_chip {
 >  	 * open drain mode safely
 >  	 */
 >  	u32 data;
 > +	struct irq_host *irq;
 >  };
 
 >  static inline u32 mpc8xxx_gpio2mask(unsigned int gpio)
 > @@ -127,12 +129,136 @@ static int mpc8xxx_gpio_dir_out(struct gpio_chip *gc, unsigned int gpio, int val
 >  	return 0;
 >  }
 
 > +static int mpc8xxx_gpio_to_irq(struct gpio_chip *gc, unsigned offset)
 > +{
 > +	struct of_mm_gpio_chip *mm = to_of_mm_gpio_chip(gc);
 > +	struct mpc8xxx_gpio_chip *mpc8xxx_gc = to_mpc8xxx_gpio_chip(mm);
 > +
 > +	if (mpc8xxx_gc->irq && offset < MPC8XXX_GPIO_PINS)
 > +		return irq_create_mapping(mpc8xxx_gc->irq, offset);
 > +	else
 > +		return -ENXIO;
 > +}
 > +
 > +static void mpc8xxx_gpio_irq_cascade(unsigned int irq, struct irq_desc *desc)
 > +{
 > +	struct mpc8xxx_gpio_chip *mpc8xxx_gc = get_irq_desc_data(desc);
 > +	struct of_mm_gpio_chip *mm = &mpc8xxx_gc->mm_gc;
 > +	unsigned int mask;
 > +
 > +	mask = in_be32(mm->regs + GPIO_IER) & in_be32(mm->regs + GPIO_IMR);
 > +	if (mask)
 > +		generic_handle_irq(irq_linear_revmap(mpc8xxx_gc->irq,
 > +						     32 - ffs(mask)));
 > +}
 > +
 > +static void mpc8xxx_irq_unmask(unsigned int virq)
 > +{
 > +	struct mpc8xxx_gpio_chip *mpc8xxx_gc = get_irq_chip_data(virq);
 > +	struct of_mm_gpio_chip *mm = &mpc8xxx_gc->mm_gc;
 > +	unsigned long flags;
 > +
 > +	spin_lock_irqsave(&mpc8xxx_gc->lock, flags);
 > +
 > +	setbits32(mm->regs + GPIO_IMR, mpc8xxx_gpio2mask(virq_to_hw(virq)));
 > +
 > +	spin_unlock_irqrestore(&mpc8xxx_gc->lock, flags);
 > +}
 > +
 > +static void mpc8xxx_irq_mask(unsigned int virq)
 > +{
 > +	struct mpc8xxx_gpio_chip *mpc8xxx_gc = get_irq_chip_data(virq);
 > +	struct of_mm_gpio_chip *mm = &mpc8xxx_gc->mm_gc;
 > +	unsigned long flags;
 > +
 > +	spin_lock_irqsave(&mpc8xxx_gc->lock, flags);
 > +
 > +	clrbits32(mm->regs + GPIO_IMR, mpc8xxx_gpio2mask(virq_to_hw(virq)));
 > +
 > +	spin_unlock_irqrestore(&mpc8xxx_gc->lock, flags);
 > +}
 > +
 > +static void mpc8xxx_irq_ack(unsigned int virq)
 > +{
 > +	struct mpc8xxx_gpio_chip *mpc8xxx_gc = get_irq_chip_data(virq);
 > +	struct of_mm_gpio_chip *mm = &mpc8xxx_gc->mm_gc;
 > +
 > +	out_be32(mm->regs + GPIO_IER, mpc8xxx_gpio2mask(virq_to_hw(virq)));
 > +}
 > +
 > +static int mpc8xxx_irq_set_type(unsigned int virq, unsigned int flow_type)
 > +{
 > +	struct mpc8xxx_gpio_chip *mpc8xxx_gc = get_irq_chip_data(virq);
 > +	struct of_mm_gpio_chip *mm = &mpc8xxx_gc->mm_gc;
 > +	unsigned long flags;
 > +
 > +	switch (flow_type) {
 > +	case IRQ_TYPE_EDGE_FALLING:
 > +		spin_lock_irqsave(&mpc8xxx_gc->lock, flags);
 > +		setbits32(mm->regs + GPIO_ICR,
 > +			  mpc8xxx_gpio2mask(virq_to_hw(virq)));
 > +		spin_unlock_irqrestore(&mpc8xxx_gc->lock, flags);
 > +		break;
 > +
 > +	case IRQ_TYPE_EDGE_BOTH:
 > +		spin_lock_irqsave(&mpc8xxx_gc->lock, flags);
 > +		clrbits32(mm->regs + GPIO_ICR,
 > +			  mpc8xxx_gpio2mask(virq_to_hw(virq)));
 > +		spin_unlock_irqrestore(&mpc8xxx_gc->lock, flags);
 > +		break;
 > +
 > +	default:
 > +		return -EINVAL;
 > +	}
 > +
 > +	return 0;
 > +}
 > +
 > +static struct irq_chip mpc8xxx_irq_chip = {
 > +	.name		= "mpc8xxx-gpio",
 > +	.unmask		= mpc8xxx_irq_unmask,
 > +	.mask		= mpc8xxx_irq_mask,
 > +	.ack		= mpc8xxx_irq_ack,
 > +	.set_type	= mpc8xxx_irq_set_type,
 > +};
 > +
 > +static int mpc8xxx_gpio_irq_map(struct irq_host *h, unsigned int virq,
 > +				irq_hw_number_t hw)
 > +{
 > +	set_irq_chip_data(virq, h->host_data);
 > +	set_irq_chip_and_handler(virq, &mpc8xxx_irq_chip, handle_level_irq);
 > +	set_irq_type(virq, IRQ_TYPE_NONE);
 > +
 > +	return 0;
 > +}
 > +
 > +static int mpc8xxx_gpio_irq_xlate(struct irq_host *h, struct device_node *ct,
 > +				  const u32 *intspec, unsigned int intsize,
 > +				  irq_hw_number_t *out_hwirq,
 > +				  unsigned int *out_flags)
 > +
 > +{
 > +	/* interrupt sense values coming from the device tree equal either
 > +	 * EDGE_FALLING or EDGE_BOTH
 > +	 */
 > +	*out_hwirq = intspec[0];
 > +	*out_flags = intspec[1];
 > +
 > +	return 0;
 > +}
 > +
 > +static struct irq_host_ops mpc8xxx_gpio_irq_ops = {
 > +	.map	= mpc8xxx_gpio_irq_map,
 > +	.xlate	= mpc8xxx_gpio_irq_xlate,
 > +};
 > +
 >  static void __init mpc8xxx_add_controller(struct device_node *np)
 >  {
 >  	struct mpc8xxx_gpio_chip *mpc8xxx_gc;
 >  	struct of_mm_gpio_chip *mm_gc;
 >  	struct of_gpio_chip *of_gc;
 >  	struct gpio_chip *gc;
 > +	unsigned hwirq;
 >  	int ret;
 
 >  	mpc8xxx_gc = kzalloc(sizeof(*mpc8xxx_gc), GFP_KERNEL);
 > @@ -157,11 +283,32 @@ static void __init mpc8xxx_add_controller(struct device_node *np)
 >  	else
 > 		gc->get = mpc8xxx_gpio_get;
 > 	gc->set = mpc8xxx_gpio_set;
 > +	gc->to_irq = mpc8xxx_gpio_to_irq;
 
 >  	ret = of_mm_gpiochip_add(np, mm_gc);
 >  	if (ret)
 >  		goto err;
 
 > +	hwirq = irq_of_parse_and_map(np, 0);
 > +	if (hwirq == NO_IRQ)
 > +		goto skip_irq;
 > +
 > +	mpc8xxx_gc->irq =
 > +		irq_alloc_host(np, IRQ_HOST_MAP_LINEAR, MPC8XXX_GPIO_PINS,
 > +			       &mpc8xxx_gpio_irq_ops, MPC8XXX_GPIO_PINS);
 > +	if (!mpc8xxx_gc->irq)
 > +		goto skip_irq;
 > +
 > +	mpc8xxx_gc->irq->host_data = mpc8xxx_gc;
 > +
 > +	/* ack and mask all irqs */
 > +	out_be32(mm_gc->regs + GPIO_IER, 0xffffffff);
 > +	out_be32(mm_gc->regs + GPIO_IMR, 0);
 > +
 > +	set_irq_data(hwirq, mpc8xxx_gc);
 > +	set_irq_chained_handler(hwirq, mpc8xxx_gpio_irq_cascade);
 > +
 > +skip_irq:
 >  	return;
 
 >  err:
 > -- 
 > 1.6.5


-- 
Bye, Peter Korsgaard

^ permalink raw reply

* Re: [RFC,PATCH 3/7 v2] arm/versatile: use generic struct clk
From: Russell King - ARM Linux @ 2010-01-12 16:25 UTC (permalink / raw)
  To: Jeremy Kerr; +Cc: linuxppc-dev, linux-kernel, linux-arm-kernel
In-Reply-To: <1263279511.161193.484965724912.3.gpush@pororo>

On Tue, Jan 12, 2010 at 05:58:31PM +1100, Jeremy Kerr wrote:
> diff --git a/arch/arm/common/clkdev.c b/arch/arm/common/clkdev.c
> index aae5bc0..71e7596 100644
> --- a/arch/arm/common/clkdev.c
> +++ b/arch/arm/common/clkdev.c
> @@ -85,11 +85,13 @@ struct clk *clk_get(struct device *dev, const char *con_id)
>  }
>  EXPORT_SYMBOL(clk_get);
>  
> +#ifndef CONFIG_USE_COMMON_STRUCT_CLK
>  void clk_put(struct clk *clk)
>  {
>  	__clk_put(clk);
>  }
>  EXPORT_SYMBOL(clk_put);
> +#endif /* CONFIG_USE_COMMON_STRUCT_CLK */

This doesn't make any sense.  What are you trying to do here?

The get/put operations go together as one logical set - that's why you
get both if you're using clkdev, and why you're asked to implement both
__clk_get() and __clk_put() in arch code to do whatever's necessary
with the clock.

Let me guess, and say that clk_put() is not a release method.  It's a
method for drivers to say "I'm done with this clock" and for the arch
code to reverse the effects of __clk_get()/clk_get().

Currently, its only user is to balance module counts.

^ permalink raw reply

* Re: kernel panic on MPC8323 custom board
From: Dario Presti @ 2010-01-12 16:31 UTC (permalink / raw)
  To: linuxppc-dev
In-Reply-To: <27128312.post@talk.nabble.com>




Dario Presti wrote:
> 
> 
> But still hte mapping is not showed on boot, it seems to not read yet the
> blob node. The boot-log is:
> 
> 

Ok now mapping woks fine. The error was in .dts file, changing

flash@fc000000 {
		device_type = "rom";
		compatible = "cfi-flash";

in 

flash@fc000000 { 		
		device_type = "rom";
		compatible = "direct-mapped";

The partitioning works fine, but there is still kernel panic.

The boot log is:

U-Boot 1.3.2 (Jan  8 2010 - 12:57:17) MPC83XX

Reset Status:

CPU:   e300c2, MPC8321E, Rev: 11 at 333.333 MHz, CSB:  133 MHz
Board: Freescale MPC8323ERDB
I2C:   ready
DRAM:  64 MB
FLASH: 64 MB
In:    serial
Out:   serial
Err:   serial
Net:   FSL UEC0, FSL UEC1
Hit any key to stop autoboot:  0
Scanning PCI devices on bus 0
BusDevFun  VendorId   DeviceId   Device Class       Sub-Class
_____________________________________________________________
00.00.00   0x1957     0x00a6     Processor               0x20
## Booting image at fc100000 ...
   Image Name:   Linux-2.6.20.6-rt8
   Image Type:   PowerPC Linux Kernel Image (gzip compressed)
   Data Size:    1507732 Bytes =  1.4 MB
   Load Address: 00000000
   Entry Point:  00000000
   Verifying Checksum ... OK
   Uncompressing Kernel Image ... OK
   Booting using the fdt at 0xfc080000
   Loading Device Tree to 00785000, end 007ff11f ... OK
Using MPC832x RDB machine description
Linux version 2.6.20.6-rt8 (cubit@cubit-laptop) (gcc version 4.2.3 (Sourcery
G++ Lite 4.2-171)) #13 PREEMPT Tue Jan 12 16:47:14 CET 2010
setup_arch: bootmem
mpc832x_rdb_setup_arch()
Found MPC83xx PCI host bridge at 0x00000000e0008500. Firmware bus number:
0->0
pio-handle not available
arch: exit
Zone PFN ranges:
  DMA             0 ->    16384
  Normal      16384 ->    16384
early_node_map[1] active PFN ranges
    0:        0 ->    16384
Real-Time Preemption Support (C) 2004-2007 Ingo Molnar
Built 1 zonelists.  Total pages: 16256
Kernel command line: root=/dev/mtdblock4 rootfstype=jffs2 rw console=ttyS0,
38400
WARNING: experimental RCU implementation.
IPIC (128 IRQ sources) at fdefb700
QEIC (64 IRQ sources) at fdefa080
PID hash table entries: 256 (order: 8, 1024 bytes)

Using MPC832x RDB machine description
Linux version 2.6.20.6-rt8 (cubit@cubit-laptop) (gcc version 4.2.3 (Sourcery
G++ Lite 4.2-171)) #13 PREEMPT Tue Jan 12 16:47:14 CET 2010
Found MPC83xx PCI host bridge at 0x00000000e0008500. Firmware bus number:
0->0
pio-handle not available
Zone PFN ranges:
  DMA             0 ->    16384
  Normal      16384 ->    16384
early_node_map[1] active PFN ranges
    0:        0 ->    16384
Real-Time Preemption Support (C) 2004-2007 Ingo Molnar
Built 1 zonelists.  Total pages: 16256
Kernel command line: root=/dev/mtdblock4 rootfstype=jffs2 rw console=ttyS0,
38400
WARNING: experimental RCU implementation.
IPIC (128 IRQ sources) at fdefb700
QEIC (64 IRQ sources) at fdefa080
PID hash table entries: 256 (order: 8, 1024 bytes)
Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
Memory: 61176k/65536k available (2860k kernel code, 4292k reserved, 180k
data, 109k bss, 132k init)
Mount-cache hash table entries: 512
NET: Registered protocol family 16
PCI: Probing PCI hardware
Generic PHY: Registered new driver
SCSI subsystem initialized
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
NET: Registered protocol family 2
IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
TCP established hash table entries: 2048 (order: 4, 65536 bytes)
TCP bind hash table entries: 1024 (order: 2, 28672 bytes)
TCP: Hash tables configured (established 2048 bind 1024)
TCP reno registered
NTFS driver 2.1.28 [Flags: R/O].
JFFS2 version 2.2. (NAND) (SUMMARY)  (C) 2001-2006 Red Hat, Inc.
fuse init (API version 7.8)
JFS: nTxBlock = 478, nTxLock = 3827
io scheduler noop registered
io scheduler anticipatory registered (default)
io scheduler deadline registered
io scheduler cfq registered
Generic RTC Driver v1.07
WDT driver for MPC83xx initialized. mode:reset timeout=65535 (32 seconds)
Serial: 8250/16550 driver $Revision: 1.90 $ 4 ports, IRQ sharing disabled
serial8250.0: ttyS0 at MMIO 0xe0004500 (irq = 16) is a 16550A
serial8250.0: ttyS1 at MMIO 0xe0004600 (irq = 17) is a 16550A
RAMDISK driver initialized: 16 RAM disks of 32768K size 1024 blocksize
loop: loaded (max 8 devices)
ucc_tdm: Freescale QE UCC TDM Driver
config_tdm Delay for Legerity!
tdm_start 16-bit linear pcm mode active with slots 0 & 2
tdm_start UCC based TDM enabled
ucc_tdm_probe UCC based tdm module installed
UCC Ethernet Controller MII Bus: probed
ucc_geth: QE UCC Gigabit Ethernet Controller
ucc_geth: UCC2 at 0xe0103000 (irq = 20)
eth0: MTU=1500 (frame
size=1518,rx_buffer_size=1536,truesize=1792,sk_buff=160)
ucc_geth: UCC3 at 0xe0102200 (irq = 34)
eth1: MTU=1500 (frame
size=1518,rx_buffer_size=1536,truesize=1792,sk_buff=160)
SKB Handler initialized(max=64)
ICPlus IP175C: Registered new driver
flash: Found 1 x16 devices at 0x0 in 16-bit bank
 Amd/Fujitsu Extended Query Table at 0x0040
flash: CFI does not contain boot bank location. Assuming top.
number of CFI chips: 1
cfi_cmdset_0002: Disabling erase-suspend-program due to code brokenness.
RedBoot partition parsing not available
physmap-flash flash: Using OF partition information
Creating 4 MTD partitions on "flash":
0x00000000-0x00080000 : "U-Boot"
0x00080000-0x00100000 : "dtb"
0x00100000-0x00300000 : "Kernel"
0x00300000-0x01000000 : "rootfs"
block2mtd: version $Revision: 1.30 $
e01004c0.spi: MPC83xx SPI Controller driver at 0xc50aa4c0 (irq = 21)
usbmon: debugfs is not available
Initializing USB Mass Storage driver...
usbcore: registered new interface driver usb-storage
USB Mass Storage support registered.
i2c /dev entries driver
TCP cubic registered
NET: Registered protocol family 1
NET: Registered protocol family 17
No filesystem could mount root, tried: <6>Time: timebase clocksource has
been installed.
 jffs2
Kernel panic - not syncing: VFS: Unable to mount root fs on
unknown-block(0,0)
Call Trace:
[C03BBE70] [C000819C]  (unreliable)
[C03BBEB0] [C0026AB0]
[C03BBF00] [C02AAB98]
[C03BBF50] [C02AADEC]
[C03BBF70] [C0003B04]
[C03BBFF0] [C00102BC]
 <0>Rebooting in 180 seconds..

But still unable to mount root...any suggestion?

Thanks

Dario
-- 
View this message in context: http://old.nabble.com/kernel-panic-on-MPC8323-custom-board-tp27059752p27130293.html
Sent from the linuxppc-dev mailing list archive at Nabble.com.

^ permalink raw reply

* Re: [PATCH-V3] mpc8xxx_gpio: add interrupt support
From: Anton Vorontsov @ 2010-01-12 16:25 UTC (permalink / raw)
  To: Peter Korsgaard; +Cc: linuxppc-dev
In-Reply-To: <87skabqok5.fsf@macbook.be.48ers.dk>

On Tue, Jan 12, 2010 at 05:24:10PM +0100, Peter Korsgaard wrote:
> >>>>> Peter Korsgaard <jacmet@sunsite.dk> writes:
> 
> Hi,
> 
> Anton, any comments on this?
> 
>  > Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>

Acked-by: Anton Vorontsov <avorontsov@ru.mvista.com>

Thanks!

-- 
Anton Vorontsov
email: cbouatmailru@gmail.com
irc://irc.freenode.net/bd2

^ permalink raw reply

* Re: Sleep-capable GPIO slave-selects on MPC52xx?
From: Bill Gatliff @ 2010-01-12 16:50 UTC (permalink / raw)
  To: linuxppc-dev
In-Reply-To: <4B4B866B.10207@billgatliff.com>

Bill Gatliff wrote:
>
> It looks like the current version of the MPC52xx SPI driver won't work
> with sleep-capable GPIOs for slave-selects.  In particular, it looks
> like mpc52xx_spi_fsmstate_transfer() is an interrupt handler that calls
> mpc52xx_spi_chipsel(), which itself calls gpio_set_value().  Or, at
> least my kernel thinks so, since I get a barrage of oops-type output
> screaming at me whenever I hit the SPI device.  :)
>
> Am I missing something, or is this a known (or at least now-identified)
> limitation of the current mpc52xx_spi.c?
>   

So, nobody has any feedback on this?  :)

Would using a threaded handler for the SPI interrupts be likely to work
here?


b.g.

-- 
Bill Gatliff
Embedded systems training and consulting
http://billgatliff.com
bgat@billgatliff.com

^ permalink raw reply

* Re: [PATCH] proc_devtree: fix THIS_MODULE without module.h
From: Alexey Dobriyan @ 2010-01-12 17:41 UTC (permalink / raw)
  To: Grant Likely; +Cc: Jeremy Kerr, linuxppc-dev
In-Reply-To: <fa686aa41001111458g5975e055ga4c7cd830fff1906@mail.gmail.com>

On Mon, Jan 11, 2010 at 03:58:47PM -0700, Grant Likely wrote:
> On Sat, Jan 9, 2010 at 4:01 AM, Alexey Dobriyan <adobriyan@gmail.com> wrote:
> > I'd say, remove .owner line.
> > It definitely not needed in non-modular code.
> 
> No.  Jeremy's fix is the better one.  Having the .owner line doesn't
> cost anything and it is better to have it populated; even if only as
> an example.

Core proc code doesn't use it anymore.

^ permalink raw reply

* Re: [PATCH] Make cpu hotplug driver lock part of ppc_md
From: Nathan Fontenot @ 2010-01-12 19:34 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: linuxppc-dev, Andreas Schwab
In-Reply-To: <1263262996.724.176.camel@pasglop>

Benjamin Herrenschmidt wrote:
>> The intention of the cpu_hotplug_driver_locks to add additional serialization
>> during cpu hotplug operations.  For pseries this is used during DLPAR of cpu
>> operations so that cpu hotplug actions cannot be initiated whiloe a DLPAR
>> operation is in flight.  For example, during DLPAR add we take the lock while
>> acquiring the cpu from firmware and updating the device tree with the new
>> cpu information, after which we hotplug add the cpu to the system.  
>>
>> There is nothing harmless about taking the lock on all platforms, I was just
>> trying to avoid taking the lock if the additional serialization is not needed.
>>
>>> If so, you could just make the mutex available to all powerpc code, and
>>> rename it, and then we wouldn't need all this jiggery pokery just to
>>> take & release a lock.
>> I can make the lock available to all powerpc code and not go through the
>> ppc_md struct, it makes no difference to me personally.  Of course this would
>> make all that fun pokery jiggery go away :)
> 
> Yeah, Michael is right, just make it global to powerpc, it should make
> things simpler.

Sounds good, I'll get a patch out to do this.

-Nathan

^ permalink raw reply

* Re: [PATCH] powerpc/4xx: Add support for type 1 pci transactions on 4xx boards
From: Benjamin Herrenschmidt @ 2010-01-12 23:18 UTC (permalink / raw)
  To: Stef van Os; +Cc: linuxppc-dev, Felix Radensky, Stefan Roese, Feng Kan
In-Reply-To: <4CD35CD1F8085945B597F80EEC89421303B8AD11@exc01.bk.prodrive.nl>

On Tue, 2010-01-12 at 15:09 +0100, Stef van Os wrote:
> This patch adds type 1 PCI transactions to 4xx PCI code, enabling the
> discovery of
> devices behind a PCI bridge.

Your patch appears word wrapped and whitespace damaged...

I'll fix it up manually this time around but please check your mailer
setup :-)

Cheers,
Ben.
 
> Signed-off-by: Stef van Os <stef.van.os@gmail.com>
> ---
>  arch/powerpc/sysdev/ppc4xx_pci.c |    6 ++++--
>  1 files changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/powerpc/sysdev/ppc4xx_pci.c
> b/arch/powerpc/sysdev/ppc4xx_pci.c
> index 6ff9d71..370cc1c 100644
> --- a/arch/powerpc/sysdev/ppc4xx_pci.c
> +++ b/arch/powerpc/sysdev/ppc4xx_pci.c
> @@ -363,7 +363,8 @@ static void __init ppc4xx_probe_pci_bridge(struct
> device_node *np)
>         hose->last_busno = bus_range ? bus_range[1] : 0xff;
> 
>         /* Setup config space */
> -       setup_indirect_pci(hose, rsrc_cfg.start, rsrc_cfg.start + 0x4,
> 0);
> +       setup_indirect_pci(hose, rsrc_cfg.start, rsrc_cfg.start + 0x4,
> +                                       PPC_INDIRECT_TYPE_SET_CFG_TYPE);
> 
>         /* Disable all windows */
>         writel(0, reg + PCIL0_PMM0MA);
> @@ -569,7 +570,8 @@ static void __init ppc4xx_probe_pcix_bridge(struct
> device_node *np)
>         hose->last_busno = bus_range ? bus_range[1] : 0xff;
> 
>         /* Setup config space */
> -       setup_indirect_pci(hose, rsrc_cfg.start, rsrc_cfg.start + 0x4,
> 0);
> +       setup_indirect_pci(hose, rsrc_cfg.start, rsrc_cfg.start + 0x4,
> +                                       PPC_INDIRECT_TYPE_SET_CFG_TYPE);
> 
>         /* Disable all windows */
>         writel(0, reg + PCIX0_POM0SA);
> 
> 
> Disclaimer: The information contained in this email, including any attachments is 
> confidential and is for the sole use of the intended recipient(s). Any unauthorized 
> review, use, disclosure or distribution is prohibited. If you are not the intended 
> recipient, please notify the sender immediately by replying to this message and 
> destroy all copies of this message and any attachments.

^ permalink raw reply

* Re: [RFC,PATCH 0/7 v2] Common struct clk implementation
From: Jeremy Kerr @ 2010-01-13  1:17 UTC (permalink / raw)
  To: linux-arm-kernel; +Cc: linuxppc-dev, Russell King - ARM Linux, linux-kernel
In-Reply-To: <20100112091324.GC26435@n2100.arm.linux.org.uk>

Hi Russell,

> But the point I was trying to convey is that OMAP doesn't work with
> _either_ a pure operations struct _or_ a bunch of per-clock function
> pointers - it currently uses a mixture of the two.

With the common clk, you can do exactly that:

struct clk_foo {
	/* ->ops provides functions common to clk_foo */
	struct clk;

	/* provides a function for only this clock */
	int (*single_clock_func)(struct clk_foo *);
}

The only real difference is that the public API is provided through struct =
clk=20
rather than redefined clk_* functions; whatever is implementing the clock-
type-specific struct clk can add whatever fields necessary.

=46rom your earlier mail about sizes on omap:

> There are two function pointers in the struct clk which would be
> identical to the versions proposed in this generic struct clk.
> There's a total of 219 clk structures in OMAP3.  So, 219 * (4 + 8)
> =3D 2628.  Switching OMAP means 219 * (4 + 32) =3D 7884, which is an
> increase in overhead of 3x.

But we also can reduce the size of the struct clk in most cases; I believe =
the=20
separate clk_operations in v2 of this series will help with this.

Taking OMAP3 for example (I'm not very familiar with that platform, so am=20
basing this on a brief look through the clock code), the first step to a=20
common clk port would be to wrap the existing struct clk:

struct clk_omap {
	struct clk			clk;
	struct list_head		node;
	const struct clkops	*ops;
    [...]
};

and define the clk_operations to be the current omap clk_* functions.

This results in one extra pointer per clock, plus the clk_operations, so 90=
8=20
bytes (4 * 219 + 32) overhead.

Next, we can start removing fields that are not used by all clocks; the fix=
ed=20
top-level clocks would be a good start; it looks like we can represent thos=
e=20
with a:

struct clk_omap_fixed {
	struct clk	clk;
	char			*name;
	unsigned long	rate;
}

[For these fixed clocks, we don't need to propagate changes to children, he=
nce=20
I'm assuming no child/sibling members]

The original struct clk is 96 bytes; clk_omap_fixed is 12, but we still nee=
d=20
one clk_operations (32 bytes). Since there are 8 of these, we save 640 byte=
s=20
((96 - 12) * 8 - 32).

If we then take the 'follow parent' clocks, it looks like we can represent=
=20
those with something like:

struct clk_omap_followparent =3D {
	struct clk	clk;
	char			*name;
	struct clk	*parent;
	struct list_head children, siblings;
	unsigned long	rate;
	void __iomem	*enable_reg;
	__u8			enable_bit;
	char			*clkdm_name;
	int			flags;
};

This would be 48 bytes, there are 140 of these, saving 6688 bytes ( (96 - 4=
8)=20
* 140 - 32).

Now, we could stop here, or keep looking for common usage patterns of struc=
t=20
clk to find cases where creating another clock type makes sense.

I know I've only looked at the easy OMAP cases here, but the principle stil=
l=20
applies: keep the original struct clk around as a fallback, but use the=20
smaller struct clks where possible.

Cheers,


Jeremy

^ permalink raw reply

* [PATCH] zlib: Fix build of powerpc boot wrapper
From: Benjamin Herrenschmidt @ 2010-01-13  5:19 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: linuxppc-dev, linux-kernel@vger.kernel.org

Commit ac4c2a3bbe5db5fc570b1d0ee1e474db7cb22585 broke the build
of all powerpc boot wrappers.

It attempts to add an include of autoconf.h but used the wrong
path for it. It also adds -D__KERNEL__ to our boot wrapper, both
things that we pretty much didn't do on purpose so far.

We want our boot wrapper to remain independent enough of the kernel
for various reasons, one of them being that you can "wrap" an existing
kernel at distro install time which allows to ship one kernel image
and a set of boot wrappers for different platforms, the wrappers
don't have to be built out of the same kernel build tree.

It's also incorrect to do what the patch does in our boot environment
since we may not have a proper alignment exception handler which means
we may not be able to fixup the few cases where an unaligned access will
need SW emulation (depends on the core variant, could be when crossing
page or segment boundaries for example).

This patch fixes it by putting the old code back in and using the
new "fancy" variant only when CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS
is set, which happens not to be set on powerpc since we don't include
autoconf.h. It also reverts the changes to our boot wrapper Makefile.

This means that x86 should, afaik, keep the optimisations since its
boot wrapper does include autoconf.h and define __KERNEL__ (though I
doubt they make that much different outside of slow embedded processors).

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---

Linus, if you don't like the approach, then please just revert
ac4c2a3bbe5db5fc570b1d0ee1e474db7cb22585 for now.

Cheers,
Ben.

 arch/powerpc/boot/Makefile |    4 +---
 lib/zlib_inflate/inffast.c |   32 ++++++++++++++++++++++++++++++--
 2 files changed, 31 insertions(+), 5 deletions(-)



diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
index 826a30a..bb2465b 100644
--- a/arch/powerpc/boot/Makefile
+++ b/arch/powerpc/boot/Makefile
@@ -20,7 +20,7 @@
 all: $(obj)/zImage
 
 BOOTCFLAGS    := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
-		 -fno-strict-aliasing -Os -msoft-float -pipe -D__KERNEL__\
+		 -fno-strict-aliasing -Os -msoft-float -pipe \
 		 -fomit-frame-pointer -fno-builtin -fPIC -nostdinc \
 		 -isystem $(shell $(CROSS32CC) -print-file-name=include)
 BOOTAFLAGS	:= -D__ASSEMBLY__ $(BOOTCFLAGS) -traditional -nostdinc
@@ -34,8 +34,6 @@ BOOTCFLAGS	+= -fno-stack-protector
 endif
 
 BOOTCFLAGS	+= -I$(obj) -I$(srctree)/$(obj)
-BOOTCFLAGS	+= -include include/linux/autoconf.h -Iarch/powerpc/include
-BOOTCFLAGS	+= -Iinclude
 
 DTS_FLAGS	?= -p 1024
 
diff --git a/lib/zlib_inflate/inffast.c b/lib/zlib_inflate/inffast.c
index 05e1559..215447c 100644
--- a/lib/zlib_inflate/inffast.c
+++ b/lib/zlib_inflate/inffast.c
@@ -4,12 +4,25 @@
  */
 
 #include <linux/zutil.h>
-#include <asm/unaligned.h>
-#include <asm/byteorder.h>
 #include "inftrees.h"
 #include "inflate.h"
 #include "inffast.h"
 
+/* Only do the unaligned "Faster" variant when
+ * CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS is set
+ *
+ * On powerpc, it won't be as we don't include autoconf.h
+ * automatically for the boot wrapper, which is intended as
+ * we run in an environment where we may not be able to deal
+ * with (even rare) alignment faults. In addition, we do not
+ * define __KERNEL__ for arch/powerpc/boot unlike x86
+ */
+
+#ifdef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS
+#include <asm/unaligned.h>
+#include <asm/byteorder.h>
+#endif
+
 #ifndef ASMINF
 
 /* Allow machine dependent optimization for post-increment or pre-increment.
@@ -243,6 +256,7 @@ void inflate_fast(z_streamp strm, unsigned start)
                     }
                 }
                 else {
+#ifdef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS
 		    unsigned short *sout;
 		    unsigned long loops;
 
@@ -284,6 +298,20 @@ void inflate_fast(z_streamp strm, unsigned start)
 		    }
 		    if (len & 1)
 			PUP(out) = PUP(from);
+#else /* CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS */
+                    from = out - dist;          /* copy direct from output */
+                    do {                        /* minimum length is three */
+			 PUP(out) = PUP(from);
+			 PUP(out) = PUP(from);
+			 PUP(out) = PUP(from);
+			 len -= 3;
+                    } while (len > 2);
+                    if (len) {
+			 PUP(out) = PUP(from);
+			 if (len > 1)
+			     PUP(out) = PUP(from);
+                    }
+#endif /* !CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS */
                 }
             }
             else if ((op & 64) == 0) {          /* 2nd level distance code */

^ permalink raw reply related

* Re: [PATCH] of/flattree: use callback to setup initrd from /chosen
From: Grant Likely @ 2010-01-13  6:43 UTC (permalink / raw)
  To: michael; +Cc: microblaze-uclinux, Jeremy Kerr, linuxppc-dev, devicetree-discuss
In-Reply-To: <1261487856.10767.128.camel@concordia>

On Tue, Dec 22, 2009 at 6:17 AM, Michael Ellerman
<michael@ellerman.id.au> wrote:
> On Tue, 2009-12-22 at 18:54 +0800, Jeremy Kerr wrote:
>> Hi Michael,
>>
>> > > =A0void early_init_dt_setup_initrd_arch(unsigned long start,
>> > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 unsi=
gned long end);
>> >
>> > arch_early_init_dt_setup_initrd() makes more sense to me, but ..
>>
>> <foo>_arch has been the general convention for arch-specific hooks in
>> drivers/of/.
>
> Yuck, doh, guess I should have read those patches before they went in :)

It's not necessarily permanent.  My first goal is to get the common
code merged.  Then I want to look closely at it for patterns and
refactor how the common code calls out to arch specific hooks (or
maybe turn it around and have arch code calling out to the common
bits).

>
>> > > +#ifdef CONFIG_BLK_DEV_INITRD
>> > > +void __init early_init_dt_setup_initrd_arch(unsigned long start,
>> > > + =A0 =A0 =A0 =A0 unsigned long end)
>> > > +{
>> > > + initrd_start =3D (unsigned long)__va(start);
>> > > + initrd_end =3D (unsigned long)__va(end);
>> > > + initrd_below_start_ok =3D 1;
>> > > +}
>> > > +#endif
>> >
>> > Given you have two identical implementations why not make that the
>> > default and make it weak, and let ARM override it.
>>
>> Yeah, that would be good too; just been avoiding weak as a potential sou=
rce of
>> magic voodoo complexity. Grant - up to you on this one.
>
> Yeah, depends on what toolchains you're supporting, modern ones should
> be OK but it can be troublesome.

I'll look at this.

g.


--=20
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

^ permalink raw reply

* [PATCH 1/1] powerpc/iseries: Initialise on-stack completion
From: Michael Ellerman @ 2010-01-13  7:10 UTC (permalink / raw)
  To: linuxppc-dev

get_viotape_info() declares a vio_waitevent on the stack, which
contains a completion, but never initialises the completion.

I have no idea how this ever worked, and on recent kernels it causes
an oops in handle_tape_event() when we access the non-initialised
completion.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
---
 arch/powerpc/platforms/iseries/vio.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/platforms/iseries/vio.c b/arch/powerpc/platforms/iseries/vio.c
index 657b72f..2aa8b56 100644
--- a/arch/powerpc/platforms/iseries/vio.c
+++ b/arch/powerpc/platforms/iseries/vio.c
@@ -474,6 +474,8 @@ static void __init get_viotape_info(struct device_node *vio_root)
 	struct vio_waitevent we;
 	int ret;
 
+	init_completion(&we.com);
+
 	ret = viopath_open(viopath_hostLp, viomajorsubtype_tape, 2);
 	if (ret) {
 		printk(KERN_WARNING "get_viotape_info: "
-- 
1.6.3.3

^ permalink raw reply related

* [PATCH] lmb: Add lmb_free()
From: Michael Ellerman @ 2010-01-13  7:25 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: sparclinux, microblaze-uclinux, linux-sh

We can free memory allocated with lmb_alloc() by removing it from the
list of reserved LMBs. Rework lmb_remove() to allow that possibility
and add lmb_free() which exploits it.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
---
 include/linux/lmb.h |    1 +
 lib/lmb.c           |   13 +++++++++++--
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/include/linux/lmb.h b/include/linux/lmb.h
index ef82b8f..f3d1433 100644
--- a/include/linux/lmb.h
+++ b/include/linux/lmb.h
@@ -42,6 +42,7 @@ extern void __init lmb_init(void);
 extern void __init lmb_analyze(void);
 extern long lmb_add(u64 base, u64 size);
 extern long lmb_remove(u64 base, u64 size);
+extern long __init lmb_free(u64 base, u64 size);
 extern long __init lmb_reserve(u64 base, u64 size);
 extern u64 __init lmb_alloc_nid(u64 size, u64 align, int nid,
 				u64 (*nid_range)(u64, u64, int *));
diff --git a/lib/lmb.c b/lib/lmb.c
index 9cee171..cdeb284 100644
--- a/lib/lmb.c
+++ b/lib/lmb.c
@@ -205,9 +205,8 @@ long lmb_add(u64 base, u64 size)
 
 }
 
-long lmb_remove(u64 base, u64 size)
+static long __lmb_remove(struct lmb_region *rgn, u64 base, u64 size)
 {
-	struct lmb_region *rgn = &(lmb.memory);
 	u64 rgnbegin, rgnend;
 	u64 end = base + size;
 	int i;
@@ -254,6 +253,16 @@ long lmb_remove(u64 base, u64 size)
 	return lmb_add_region(rgn, end, rgnend - end);
 }
 
+long lmb_remove(u64 base, u64 size)
+{
+	return __lmb_remove(&(lmb.memory), base, size);
+}
+
+long __init lmb_free(u64 base, u64 size)
+{
+	return __lmb_remove(&(lmb.reserved), base, size);
+}
+
 long __init lmb_reserve(u64 base, u64 size)
 {
 	struct lmb_region *_rgn = &lmb.reserved;
-- 
1.6.3.3

^ permalink raw reply related

* [RFC/PATCH] powerpc: Dynamically allocate pacas
From: Michael Ellerman @ 2010-01-13  7:37 UTC (permalink / raw)
  To: linuxppc-dev

On 64-bit kernels we currently have a 512 byte struct paca_struct for
each cpu (usually just called "the paca"). Currently they are statically
allocated, which means a kernel built for a large number of cpus will
waste a lot of space if it's booted on a machine with few cpus.

We can avoid that by only allocating the number of pacas we need at
boot. However this is complicated by the fact that we need to access
the paca before we know how many cpus there are in the system.

The solution is to dynamically allocate enough space for NR_CPUS pacas,
but then later in boot when we know how many cpus we have, we free any
unused pacas.

Lightly booted on Legacy iSeries & pSeries LPAR.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
---
 arch/powerpc/include/asm/paca.h            |    8 ++-
 arch/powerpc/kernel/head_64.S              |    6 +-
 arch/powerpc/kernel/paca.c                 |   93 +++++++++++++++++++++-------
 arch/powerpc/kernel/prom.c                 |    2 +
 arch/powerpc/kernel/setup-common.c         |    2 +
 arch/powerpc/kernel/setup_64.c             |   12 ++--
 arch/powerpc/platforms/iseries/exception.S |   25 +++++---
 7 files changed, 106 insertions(+), 42 deletions(-)

diff --git a/arch/powerpc/include/asm/paca.h b/arch/powerpc/include/asm/paca.h
index 5e9b4ef..41e0f17 100644
--- a/arch/powerpc/include/asm/paca.h
+++ b/arch/powerpc/include/asm/paca.h
@@ -14,6 +14,7 @@
 #define _ASM_POWERPC_PACA_H
 #ifdef __KERNEL__
 
+#include <linux/init.h>
 #include <asm/types.h>
 #include <asm/lppaca.h>
 #include <asm/mmu.h>
@@ -140,8 +141,11 @@ struct paca_struct {
 #endif
 };
 
-extern struct paca_struct paca[];
-extern void initialise_pacas(void);
+extern struct paca_struct *paca;
+extern __initdata struct paca_struct boot_paca;
+extern void allocate_pacas(void);
+extern void initialise_paca(struct paca_struct *new_paca, int cpu);
+extern void free_unused_pacas(void);
 
 #endif /* __KERNEL__ */
 #endif /* _ASM_POWERPC_PACA_H */
diff --git a/arch/powerpc/kernel/head_64.S b/arch/powerpc/kernel/head_64.S
index 9258074..b24b700 100644
--- a/arch/powerpc/kernel/head_64.S
+++ b/arch/powerpc/kernel/head_64.S
@@ -219,7 +219,8 @@ generic_secondary_common_init:
 	 * physical cpu id in r24, we need to search the pacas to find
 	 * which logical id maps to our physical one.
 	 */
-	LOAD_REG_ADDR(r13, paca)	/* Get base vaddr of paca array	 */
+	LOAD_REG_ADDR(r13, paca)	/* Load paca pointer		 */
+	ld	r13,0(r13)		/* Get base vaddr of paca array	 */
 	li	r5,0			/* logical cpu id                */
 1:	lhz	r6,PACAHWCPUID(r13)	/* Load HW procid from paca      */
 	cmpw	r6,r24			/* Compare to our id             */
@@ -536,7 +537,8 @@ _GLOBAL(pmac_secondary_start)
 	mtmsrd	r3			/* RI on */
 
 	/* Set up a paca value for this processor. */
-	LOAD_REG_ADDR(r4,paca)		/* Get base vaddr of paca array	*/
+	LOAD_REG_ADDR(r4,paca)		/* Load paca pointer		*/
+	ld	r4,0(r4)		/* Get base vaddr of paca array	*/
 	mulli	r13,r24,PACA_SIZE	/* Calculate vaddr of right paca */
 	add	r13,r13,r4		/* for this processor.		*/
 	mtspr	SPRN_SPRG_PACA,r13	/* Save vaddr of paca in an SPRG*/
diff --git a/arch/powerpc/kernel/paca.c b/arch/powerpc/kernel/paca.c
index d16b1ea..0c40c6f 100644
--- a/arch/powerpc/kernel/paca.c
+++ b/arch/powerpc/kernel/paca.c
@@ -9,11 +9,15 @@
 
 #include <linux/threads.h>
 #include <linux/module.h>
+#include <linux/lmb.h>
 
+#include <asm/firmware.h>
 #include <asm/lppaca.h>
 #include <asm/paca.h>
 #include <asm/sections.h>
 #include <asm/pgtable.h>
+#include <asm/iseries/lpar_map.h>
+#include <asm/iseries/hv_types.h>
 
 /* This symbol is provided by the linker - let it fill in the paca
  * field correctly */
@@ -70,37 +74,82 @@ struct slb_shadow slb_shadow[] __cacheline_aligned = {
  * processors.  The processor VPD array needs one entry per physical
  * processor (not thread).
  */
-struct paca_struct paca[NR_CPUS];
+struct paca_struct *paca;
 EXPORT_SYMBOL(paca);
 
-void __init initialise_pacas(void)
-{
-	int cpu;
+struct paca_struct boot_paca;
 
-	/* The TOC register (GPR2) points 32kB into the TOC, so that 64kB
-	 * of the TOC can be addressed using a single machine instruction.
-	 */
+void __init initialise_paca(struct paca_struct *new_paca, int cpu)
+{
+       /* The TOC register (GPR2) points 32kB into the TOC, so that 64kB
+	* of the TOC can be addressed using a single machine instruction.
+	*/
 	unsigned long kernel_toc = (unsigned long)(&__toc_start) + 0x8000UL;
 
-	/* Can't use for_each_*_cpu, as they aren't functional yet */
-	for (cpu = 0; cpu < NR_CPUS; cpu++) {
-		struct paca_struct *new_paca = &paca[cpu];
-
 #ifdef CONFIG_PPC_BOOK3S
-		new_paca->lppaca_ptr = &lppaca[cpu];
+	new_paca->lppaca_ptr = &lppaca[cpu];
 #else
-		new_paca->kernel_pgd = swapper_pg_dir;
+	new_paca->kernel_pgd = swapper_pg_dir;
 #endif
-		new_paca->lock_token = 0x8000;
-		new_paca->paca_index = cpu;
-		new_paca->kernel_toc = kernel_toc;
-		new_paca->kernelbase = (unsigned long) _stext;
-		new_paca->kernel_msr = MSR_KERNEL;
-		new_paca->hw_cpu_id = 0xffff;
-		new_paca->__current = &init_task;
+	new_paca->lock_token = 0x8000;
+	new_paca->paca_index = cpu;
+	new_paca->kernel_toc = kernel_toc;
+	new_paca->kernelbase = (unsigned long) _stext;
+	new_paca->kernel_msr = MSR_KERNEL;
+	new_paca->hw_cpu_id = 0xffff;
+	new_paca->__current = &init_task;
 #ifdef CONFIG_PPC_STD_MMU_64
-		new_paca->slb_shadow_ptr = &slb_shadow[cpu];
+	new_paca->slb_shadow_ptr = &slb_shadow[cpu];
 #endif /* CONFIG_PPC_STD_MMU_64 */
+}
+
+static int __initdata paca_size;
+
+void __init allocate_pacas(void)
+{
+	int nr_cpus, cpu, limit;
+
+	/*
+	 * We can't take SLB misses on the paca, and we want to access them
+	 * in real mode, so allocate them within the RMA and also within
+	 * the first segment. On iSeries they must be within the area mapped
+	 * by the HV, which is HvPagesToMap * HVPAGESIZE bytes.
+	 */
+	limit = min(0x10000000ULL, lmb.rmo_size);
+	if (firmware_has_feature(FW_FEATURE_ISERIES))
+		limit = min(limit, HvPagesToMap * HVPAGESIZE);
+
+	nr_cpus = NR_CPUS;
+	/* On iSeries we know we can never have more than 64 cpus */
+	if (firmware_has_feature(FW_FEATURE_ISERIES))
+		nr_cpus = min(64, nr_cpus);
+
+	paca_size = PAGE_ALIGN(sizeof(struct paca_struct) * nr_cpus);
+
+	paca = __va(lmb_alloc_base(paca_size, PAGE_SIZE, limit));
+	memset(paca, 0, paca_size);
+
+	printk(KERN_DEBUG "Allocated %u bytes for %d pacas at %p\n",
+		paca_size, nr_cpus, paca);
+
+	/* Can't use for_each_*_cpu, as they aren't functional yet */
+	for (cpu = 0; cpu < nr_cpus; cpu++)
+		initialise_paca(&paca[cpu], cpu);
+}
+
+void __init free_unused_pacas(void)
+{
+	int new_size;
+
+	new_size = PAGE_ALIGN(sizeof(struct paca_struct) * num_possible_cpus());
+
+	if (new_size >= paca_size)
+		return;
+
+	lmb_free(__pa(paca) + new_size, paca_size - new_size);
+
+	printk(KERN_DEBUG "Freed %u bytes for unused pacas\n",
+		paca_size - new_size);
 
-	}
+	paca_size = new_size;
 }
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index 4ec3008..50c3c55 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -1224,6 +1224,8 @@ void __init early_init_devtree(void *params)
 	 * FIXME .. and the initrd too? */
 	move_device_tree();
 
+	allocate_pacas();
+
 	DBG("Scanning CPUs ...\n");
 
 	/* Retreive CPU related informations from the flat tree
diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c
index 03dd6a2..5df0f6a 100644
--- a/arch/powerpc/kernel/setup-common.c
+++ b/arch/powerpc/kernel/setup-common.c
@@ -493,6 +493,8 @@ void __init smp_setup_cpu_maps(void)
 	 * here will have to be reworked
 	 */
 	cpu_init_thread_core_maps(nthreads);
+
+	free_unused_pacas();
 }
 #endif /* CONFIG_SMP */
 
diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c
index 6568406..6354739 100644
--- a/arch/powerpc/kernel/setup_64.c
+++ b/arch/powerpc/kernel/setup_64.c
@@ -144,9 +144,9 @@ early_param("smt-enabled", early_smt_enabled);
 #endif /* CONFIG_SMP */
 
 /* Put the paca pointer into r13 and SPRG_PACA */
-void __init setup_paca(int cpu)
+static void __init setup_paca(struct paca_struct *new_paca)
 {
-	local_paca = &paca[cpu];
+	local_paca = new_paca;
 	mtspr(SPRN_SPRG_PACA, local_paca);
 #ifdef CONFIG_PPC_BOOK3E
 	mtspr(SPRN_SPRG_TLB_EXFRAME, local_paca->extlb);
@@ -176,14 +176,12 @@ void __init early_setup(unsigned long dt_ptr)
 {
 	/* -------- printk is _NOT_ safe to use here ! ------- */
 
-	/* Fill in any unititialised pacas */
-	initialise_pacas();
-
 	/* Identify CPU type */
 	identify_cpu(0, mfspr(SPRN_PVR));
 
 	/* Assume we're on cpu 0 for now. Don't write to the paca yet! */
-	setup_paca(0);
+	initialise_paca(&boot_paca, 0);
+	setup_paca(&boot_paca);
 
 	/* Initialize lockdep early or else spinlocks will blow */
 	lockdep_init();
@@ -203,7 +201,7 @@ void __init early_setup(unsigned long dt_ptr)
 	early_init_devtree(__va(dt_ptr));
 
 	/* Now we know the logical id of our boot cpu, setup the paca. */
-	setup_paca(boot_cpuid);
+	setup_paca(&paca[boot_cpuid]);
 
 	/* Fix up paca fields required for the boot cpu */
 	get_paca()->cpu_start = 1;
diff --git a/arch/powerpc/platforms/iseries/exception.S b/arch/powerpc/platforms/iseries/exception.S
index 5369653..fba5bf9 100644
--- a/arch/powerpc/platforms/iseries/exception.S
+++ b/arch/powerpc/platforms/iseries/exception.S
@@ -43,17 +43,14 @@ system_reset_iSeries:
 	LOAD_REG_ADDR(r23, alpaca)
 	li	r0,ALPACA_SIZE
 	sub	r23,r13,r23
-	divdu	r23,r23,r0		/* r23 has cpu number */
-	LOAD_REG_ADDR(r13, paca)
-	mulli	r0,r23,PACA_SIZE
-	add	r13,r13,r0
-	mtspr	SPRN_SPRG_PACA,r13	/* Save it away for the future */
-	mfmsr	r24
-	ori	r24,r24,MSR_RI
-	mtmsrd	r24			/* RI on */
-	mr	r24,r23
+	divdu	r24,r23,r0		/* r24 has cpu number */
 	cmpwi	0,r24,0			/* Are we processor 0? */
 	bne	1f
+	LOAD_REG_ADDR(r13, boot_paca)
+	mtspr	SPRN_SPRG_PACA,r13	/* Save it away for the future */
+	mfmsr	r23
+	ori	r23,r23,MSR_RI
+	mtmsrd	r23			/* RI on */
 	b	.__start_initialization_iSeries	/* Start up the first processor */
 1:	mfspr	r4,SPRN_CTRLF
 	li	r5,CTRL_RUNLATCH	/* Turn off the run light */
@@ -86,6 +83,16 @@ system_reset_iSeries:
 #endif
 
 2:
+	/* Load our paca now that it's been allocated */
+	LOAD_REG_ADDR(r13, paca)
+	ld	r13,0(r13)
+	mulli	r0,r24,PACA_SIZE
+	add	r13,r13,r0
+	mtspr	SPRN_SPRG_PACA,r13	/* Save it away for the future */
+	mfmsr	r23
+	ori	r23,r23,MSR_RI
+	mtmsrd	r23			/* RI on */
+
 	HMT_LOW
 #ifdef CONFIG_SMP
 	lbz	r23,PACAPROCSTART(r13)	/* Test if this processor
-- 
1.6.3.3

^ permalink raw reply related

* Re: [PATCH] of/flattree: use callback to setup initrd from /chosen
From: Michael Ellerman @ 2010-01-13 11:03 UTC (permalink / raw)
  To: Grant Likely
  Cc: microblaze-uclinux, Jeremy Kerr, linuxppc-dev, devicetree-discuss
In-Reply-To: <fa686aa41001122243v31e25e9et5db40b4f7ea8a56f@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1070 bytes --]

On Tue, 2010-01-12 at 23:43 -0700, Grant Likely wrote:
> On Tue, Dec 22, 2009 at 6:17 AM, Michael Ellerman
> <michael@ellerman.id.au> wrote:
> > On Tue, 2009-12-22 at 18:54 +0800, Jeremy Kerr wrote:
> >> Hi Michael,
> >>
> >> > >  void early_init_dt_setup_initrd_arch(unsigned long start,
> >> > >                                 unsigned long end);
> >> >
> >> > arch_early_init_dt_setup_initrd() makes more sense to me, but ..
> >>
> >> <foo>_arch has been the general convention for arch-specific hooks in
> >> drivers/of/.
> >
> > Yuck, doh, guess I should have read those patches before they went in :)
> 
> It's not necessarily permanent.  My first goal is to get the common
> code merged.  Then I want to look closely at it for patterns and
> refactor how the common code calls out to arch specific hooks (or
> maybe turn it around and have arch code calling out to the common
> bits).

Sure, no biggy. There is lots of precedent for arch hooks to be called
arch_foo() or topic_arch_foo(), but it's not the end of the world.

cheers



[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply

* Re: [PATCH 1/1] powerpc/iseries: Initialise on-stack completion
From: Stephen Rothwell @ 2010-01-13 14:27 UTC (permalink / raw)
  To: Michael Ellerman; +Cc: linuxppc-dev
In-Reply-To: <d44faed85b5e101743bcb1a5e8a0df8487830654.1263366655.git.michael@ellerman.id.au>

[-- Attachment #1: Type: text/plain, Size: 637 bytes --]

Hi Michael,

On Wed, 13 Jan 2010 18:10:56 +1100 (EST) Michael Ellerman <michael@ellerman.id.au> wrote:
>
> get_viotape_info() declares a vio_waitevent on the stack, which
> contains a completion, but never initialises the completion.
> 
> I have no idea how this ever worked, and on recent kernels it causes
> an oops in handle_tape_event() when we access the non-initialised
> completion.
> 
> Signed-off-by: Michael Ellerman <michael@ellerman.id.au>

*blush*

Acked-by: Stephen Rothwell <sfr@canb.auug.org.au>

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

[-- Attachment #2: Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply

* xilinx-pci driver and pci in general
From: Michal Simek @ 2010-01-13 15:23 UTC (permalink / raw)
  To: Grant Likely, linuxppc-dev, benh, thunderbird2k, John Williams,
	Arnd Bergmann, LKML

Hi guys,

We (John and partially I) did initial support for pci on Microblaze.
It is based on powerpc files and almost everything is the same.
There are some small differences which could be easily removed that's 
why I think that will be good to move that file to any generic location.
That's why I would like to know your opinion about this step.
If you don't like or prefer we will add that modified versions to 
arch/microblaze and in future we can merge them and move to any other 
location.

Affected files: xilinx-pci.c, pci_32.c pci-common.c, indirect_pci.c and 
some headers.


The main problems are:
ppc use ppc_md struct which we don't have it on Microblaze.
xilinx-pci driver uses exclude_device function. This function is used in 
indirect_pci.c too. There could be a way to move that function directly 
to pci_controller structure which could be useful for other controllers 
too. What do you think?

Then there are some other ppc_md. calling like pcibios_after_init which
if I see correctly not used for ppc too.

The next thing is that some files contains asm/machdep.h which could be 
added to asm/pci-bridge.h and the same is for asm/ppc-pci.h

Files contains CONFIG_PPC_OF and we would like to use only CONFIG_OF.
I remember any discuss around but not sure what was the conclusion on 
powerpc.

Part of headers are the same that's why there will be a space to move 
them to asm-generic.
Anyway: I look at your dma-mapping.h and you can use 
asm-generic/dma-mapping-common.h as I am using.


Then I have some question about EARLY_PCI_OP in ppc_32.c. Is there any 
reason to use early_##rw##_config_##size fucntions instead of proper 
pci_bus_##rw##_config_##size functions?
There is one comment that these functions are used before PCI scanning 
is done but there are used the same function as are in driver/pci/access.c.
Is there any "secret" reason to do it in this way?


Thanks for this early discuss. I would like to hear your opinion and 
then I will choose solution how to add our pci support to mainline.

Thanks,
Michal

-- 
Michal Simek, Ing. (M.Eng)
PetaLogix - Linux Solutions for a Reconfigurable World
w: www.petalogix.com p: +61-7-30090663,+42-0-721842854 f: +61-7-30090663

^ permalink raw reply

* Re: [PATCH]: powerpc: Fix build breakage due to incorrect location of autoconf.h
From: Kumar Gala @ 2010-01-13 18:54 UTC (permalink / raw)
  To: Joakim Tjernlund
  Cc: Stephen Rothwell, Roel Kluin, linuxppc-dev@ozlabs.org list,
	Richard Purdie, Anton Blanchard, Andrew Morton, David Woodhouse
In-Reply-To: <OFF0BABDB9.D573B5F9-ONC12576A9.0041BA69-C12576A9.0041D76A@transmode.se>


On Jan 12, 2010, at 5:59 AM, Joakim Tjernlund wrote:

>>=20
>> Hi Anton,
>>=20
>> On Tue, 12 Jan 2010 13:21:51 +1100 Anton Blanchard <anton@samba.org> =
wrote:
>>>=20
>>> commit ac4c2a3bbe5db5fc570b1d0ee1e474db7cb22585 (zlib: optimize =
inffast when
>>> copying direct from output) referenced include/linux/autoconf.h =
which
>>> is now called include/generated/autoconf.h.
>>=20
>> Even with this fix, you cannot build with a separate object =
directory.
>> See my other posting "linux-next: origin tree build failure" ...
>> --
>=20
> How does this work for you?
>=20
>> =46rom 044f40d169bf5fe189d5cb058f56b7cd72675ca4 Mon Sep 17 00:00:00 =
2001
> From: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>
> Date: Tue, 12 Jan 2010 11:20:36 +0100
> Subject: [PATCH] powerpc: Fix build breakage due to incorrect location =
of autoconf.h
>=20
> commit ac4c2a3bbe5db5fc570b1d0ee1e474db7cb22585 (zlib: optimize =
inffast when
> copying direct from output) referenced include/linux/autoconf.h which
> is now called include/generated/autoconf.h.
> Also, -I include paths needs to be prefixed with $(srctree)
>=20
> Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>
> ---
> arch/powerpc/boot/Makefile |    4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
>=20
> diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
> index 826a30a..79ebd6f 100644
> --- a/arch/powerpc/boot/Makefile
> +++ b/arch/powerpc/boot/Makefile
> @@ -34,8 +34,8 @@ BOOTCFLAGS	+=3D -fno-stack-protector
> endif
>=20
> BOOTCFLAGS	+=3D -I$(obj) -I$(srctree)/$(obj)
> -BOOTCFLAGS	+=3D -include include/linux/autoconf.h =
-Iarch/powerpc/include
> -BOOTCFLAGS	+=3D -Iinclude
> +BOOTCFLAGS	+=3D -include include/generated/autoconf.h
> +BOOTCFLAGS	+=3D -I$(srctree)/arch/powerpc/include =
-I$(srctree)/include
>=20
> DTS_FLAGS	?=3D -p 1024
>=20

Ack, this works for me (seeing as -rc4 doesn't generate uImages w/o it =
:)

- k=

^ permalink raw reply

* Re: [PATCH]: powerpc: Fix build breakage due to incorrect location of autoconf.h
From: Benjamin Herrenschmidt @ 2010-01-13 20:02 UTC (permalink / raw)
  To: Kumar Gala
  Cc: Stephen Rothwell, Roel Kluin, linuxppc-dev@ozlabs.org list,
	Richard Purdie, Anton Blanchard, Andrew Morton, David Woodhouse
In-Reply-To: <FB3DFBD5-9976-4D03-828A-EB4E6E08DAA4@kernel.crashing.org>

On Wed, 2010-01-13 at 12:54 -0600, Kumar Gala wrote:

> > 
> > BOOTCFLAGS	+= -I$(obj) -I$(srctree)/$(obj)
> > -BOOTCFLAGS	+= -include include/linux/autoconf.h -Iarch/powerpc/include
> > -BOOTCFLAGS	+= -Iinclude
> > +BOOTCFLAGS	+= -include include/generated/autoconf.h
> > +BOOTCFLAGS	+= -I$(srctree)/arch/powerpc/include -I$(srctree)/include
> > 
> > DTS_FLAGS	?= -p 1024
> > 
> 
> Ack, this works for me (seeing as -rc4 doesn't generate uImages w/o it :)
> 

I sent a different patch to Linus yesterday for that.

Cheers,
Ben.

^ permalink raw reply

* [PATCH] powerpc: Replace per_cpu(, smp_processor_id()) with __get_cpu_var()
From: Anton Blanchard @ 2010-01-13 22:04 UTC (permalink / raw)
  To: benh; +Cc: linuxppc-dev


The cputime code has a few places that do per_cpu(, smp_processor_id()).
Replace them with __get_cpu_var().

Signed-off-by: Anton Blanchard <anton@samba.org>
---

Index: linux-cpumask/arch/powerpc/include/asm/cputime.h
===================================================================
--- linux-cpumask.orig/arch/powerpc/include/asm/cputime.h	2010-01-13 08:57:32.634007010 +1100
+++ linux-cpumask/arch/powerpc/include/asm/cputime.h	2010-01-13 08:58:45.265253809 +1100
@@ -73,10 +73,9 @@ static inline unsigned long cputime_to_j
 static inline cputime_t cputime_to_scaled(const cputime_t ct)
 {
 	if (cpu_has_feature(CPU_FTR_SPURR) &&
-	    per_cpu(cputime_last_delta, smp_processor_id()))
-		return ct *
-			per_cpu(cputime_scaled_last_delta, smp_processor_id())/
-			per_cpu(cputime_last_delta, smp_processor_id());
+	    __get_cpu_var(cputime_last_delta))
+		return ct * __get_cpu_var(cputime_scaled_last_delta) /
+			    __get_cpu_var(cputime_last_delta);
 	return ct;
 }
 
Index: linux-cpumask/arch/powerpc/kernel/time.c
===================================================================
--- linux-cpumask.orig/arch/powerpc/kernel/time.c	2010-01-13 08:57:32.714003980 +1100
+++ linux-cpumask/arch/powerpc/kernel/time.c	2010-01-13 08:58:45.265253809 +1100
@@ -265,8 +265,8 @@ void account_system_vtime(struct task_st
 		account_system_time(tsk, 0, delta, deltascaled);
 	else
 		account_idle_time(delta);
-	per_cpu(cputime_last_delta, smp_processor_id()) = delta;
-	per_cpu(cputime_scaled_last_delta, smp_processor_id()) = deltascaled;
+	__get_cpu_var(cputime_last_delta) = delta;
+	__get_cpu_var(cputime_scaled_last_delta) = deltascaled;
 	local_irq_restore(flags);
 }
 EXPORT_SYMBOL_GPL(account_system_vtime);

^ permalink raw reply

* Re: [RFC/PATCH] powerpc: Dynamically allocate pacas
From: Michael Neuling @ 2010-01-14  0:26 UTC (permalink / raw)
  To: Michael Ellerman; +Cc: linuxppc-dev
In-Reply-To: <39fb8f1aeab9940b86c940b9a5f8e6bd41ec316c.1263368253.git.michael@ellerman.id.au>

> On 64-bit kernels we currently have a 512 byte struct paca_struct for
> each cpu (usually just called "the paca"). Currently they are statically
> allocated, which means a kernel built for a large number of cpus will
> waste a lot of space if it's booted on a machine with few cpus.
> 
> We can avoid that by only allocating the number of pacas we need at
> boot. However this is complicated by the fact that we need to access
> the paca before we know how many cpus there are in the system.
> 
> The solution is to dynamically allocate enough space for NR_CPUS pacas,
> but then later in boot when we know how many cpus we have, we free any
> unused pacas.
> 
> Lightly booted on Legacy iSeries & pSeries LPAR.
> 
> Signed-off-by: Michael Ellerman <michael@ellerman.id.au>

Nice!

<snip>

> +	lmb_free(__pa(paca) + new_size, paca_size - new_size);

You didn't explicitly mention this above but this depends on your
lmb_free patch...

FYI boots bare metal

Mikey

^ permalink raw reply

* Re: [RFC/PATCH] powerpc: Dynamically allocate pacas
From: Michael Ellerman @ 2010-01-14  0:30 UTC (permalink / raw)
  To: Michael Neuling; +Cc: linuxppc-dev
In-Reply-To: <23306.1263428782@neuling.org>

[-- Attachment #1: Type: text/plain, Size: 1163 bytes --]

On Thu, 2010-01-14 at 11:26 +1100, Michael Neuling wrote:
> > On 64-bit kernels we currently have a 512 byte struct paca_struct for
> > each cpu (usually just called "the paca"). Currently they are statically
> > allocated, which means a kernel built for a large number of cpus will
> > waste a lot of space if it's booted on a machine with few cpus.
> > 
> > We can avoid that by only allocating the number of pacas we need at
> > boot. However this is complicated by the fact that we need to access
> > the paca before we know how many cpus there are in the system.
> > 
> > The solution is to dynamically allocate enough space for NR_CPUS pacas,
> > but then later in boot when we know how many cpus we have, we free any
> > unused pacas.
> > 
> > Lightly booted on Legacy iSeries & pSeries LPAR.
> > 
> > Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
> 
> Nice!
> 
> <snip>
> 
> > +	lmb_free(__pa(paca) + new_size, paca_size - new_size);
> 
> You didn't explicitly mention this above but this depends on your
> lmb_free patch...

Ah yes, good point :)

> FYI boots bare metal

Sweet! Thanks for testing.

cheers


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply

* Re: xilinx-pci driver and pci in general
From: Benjamin Herrenschmidt @ 2010-01-14  2:07 UTC (permalink / raw)
  To: michal.simek
  Cc: Arnd Bergmann, thunderbird2k, LKML, linuxppc-dev, John Williams
In-Reply-To: <4B4DE58D.10008@petalogix.com>

On Wed, 2010-01-13 at 16:23 +0100, Michal Simek wrote:

> The main problems are:
> ppc use ppc_md struct which we don't have it on Microblaze.
> xilinx-pci driver uses exclude_device function. This function is used in 
> indirect_pci.c too. There could be a way to move that function directly 
> to pci_controller structure which could be useful for other controllers 
> too. What do you think?
> 
> Then there are some other ppc_md. calling like pcibios_after_init which
> if I see correctly not used for ppc too.

We may not be using after_init() anymore in which case you are welcome
to send a patch to remove it :-)

As for the others, well ... maybe you can do wrappers for these that
call into ppc_md. on powerpc and into some kind of arch_pci_ops. that
the platform provides on microblaze ?

I'm not sure moving them into the pci_controller is the best way to go
there.

> The next thing is that some files contains asm/machdep.h which could be 
> added to asm/pci-bridge.h and the same is for asm/ppc-pci.h

Yeah, moving includes like that is ok.

> Files contains CONFIG_PPC_OF and we would like to use only CONFIG_OF.
> I remember any discuss around but not sure what was the conclusion on 
> powerpc.

I think that should be allright, Grant, any objection there ?

> Part of headers are the same that's why there will be a space to move 
> them to asm-generic.

If you can convince other archs that it makes sense to do so ? :-)

> Anyway: I look at your dma-mapping.h and you can use 
> asm-generic/dma-mapping-common.h as I am using.

Not just quite yet, there's still some stuff we need to cleanup with
the !coherent cases.

> Then I have some question about EARLY_PCI_OP in ppc_32.c. Is there any 
> reason to use early_##rw##_config_##size fucntions instead of proper 
> pci_bus_##rw##_config_##size functions?
> There is one comment that these functions are used before PCI scanning 
> is done but there are used the same function as are in driver/pci/access.c.
> Is there any "secret" reason to do it in this way?

Well, first of all, those aren't ppc32 only anymore, they are in
pci-common.c now. Then, if you look at them you'll notice that
they are just a wrapper on top of pci_bus_* which uses a fake
pci_bus structure. IE. They are meant to be used in very early
arch fixup code at a time when we may not even have the struct
pci_bus at hand. Their use is pretty rare though, maybe we -could-
get rid of them at some stage by moving some of that fixup code.

> Thanks for this early discuss. I would like to hear your opinion and 
> then I will choose solution how to add our pci support to mainline.

Cheers,
Ben.

^ permalink raw reply

* [PATCH] Wire up recvmmsg syscall
From: Benjamin Herrenschmidt @ 2010-01-14  4:11 UTC (permalink / raw)
  To: linuxppc-dev


Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---
 arch/powerpc/include/asm/systbl.h |    2 ++
 arch/powerpc/include/asm/unistd.h |    3 ++-
 2 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/arch/powerpc/include/asm/systbl.h b/arch/powerpc/include/asm/systbl.h
index 07d2d19..0e92c23 100644
--- a/arch/powerpc/include/asm/systbl.h
+++ b/arch/powerpc/include/asm/systbl.h
@@ -326,3 +326,5 @@ SYSCALL_SPU(perf_event_open)
 COMPAT_SYS_SPU(preadv)
 COMPAT_SYS_SPU(pwritev)
 COMPAT_SYS(rt_tgsigqueueinfo)
+COMPAT_SYS_SPU(recvmmsg)
+
diff --git a/arch/powerpc/include/asm/unistd.h b/arch/powerpc/include/asm/unistd.h
index f6ca761..bbf2ee9 100644
--- a/arch/powerpc/include/asm/unistd.h
+++ b/arch/powerpc/include/asm/unistd.h
@@ -345,10 +345,11 @@
 #define __NR_preadv		320
 #define __NR_pwritev		321
 #define __NR_rt_tgsigqueueinfo	322
+#define __NR_recvmmsg		323
 
 #ifdef __KERNEL__
 
-#define __NR_syscalls		323
+#define __NR_syscalls		324
 
 #define __NR__exit __NR_exit
 #define NR_syscalls	__NR_syscalls
-- 
1.6.3.3

^ permalink raw reply related


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox