LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] kexec/ppc64: Switch to a static PACA on the way out
From: Matt Evans @ 2010-07-07  8:40 UTC (permalink / raw)
  To: miltonm, linuxppc-dev

With dynamic PACAs, the kexecing CPU's PACA won't lie within the kernel
static data and there is a chance that something may stomp it when preparing
to kexec.  This patch switches this final CPU to a static PACA just before
we pull the switch.

Signed-off-by: Matt Evans <matt@ozlabs.org>
---
 arch/powerpc/kernel/machine_kexec_64.c |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/kernel/machine_kexec_64.c b/arch/powerpc/kernel/machine_kexec_64.c
index 040bd1d..1348e84 100644
--- a/arch/powerpc/kernel/machine_kexec_64.c
+++ b/arch/powerpc/kernel/machine_kexec_64.c
@@ -253,6 +253,12 @@ static void kexec_prepare_cpus(void)
 static union thread_union kexec_stack __init_task_data =
 	{ };
 
+/*
+ * For similar reasons to the stack above, the kexecing CPU needs to be on a
+ * static PACA; we switch to kexec_paca.
+ */
+struct paca_struct kexec_paca;
+
 /* Our assembly helper, in kexec_stub.S */
 extern NORET_TYPE void kexec_sequence(void *newstack, unsigned long start,
 					void *image, void *control,
@@ -280,6 +286,19 @@ void default_machine_kexec(struct kimage *image)
 	kexec_stack.thread_info.task = current_thread_info()->task;
 	kexec_stack.thread_info.flags = 0;
 
+	/* We need a static PACA, too; copy this CPU's PACA over and switch to
+	 * it.  Also make the SLB cache look invalid as it may have been touched
+	 * by an IRQ before we switch to it.
+	 */
+	memcpy(&kexec_paca, get_paca(), sizeof(struct paca_struct));
+	kexec_paca.slb_cache_ptr = SLB_CACHE_ENTRIES+1;
+	/* 'local_paca' boils down to GPR13 */
+	local_paca = &kexec_paca;
+
+	/* XXX: If anyone does 'dynamic lppacas' this will also need to be
+	 * switched to a static version!
+	 */
+
 	/* Some things are best done in assembly.  Finding globals with
 	 * a toc is easier in C, so pass in what we can.
 	 */
-- 
1.6.3.3

^ permalink raw reply related

* Re: [PATCH V5] powerpc/mpc512x: Add gpio driver
From: Peter Korsgaard @ 2010-07-07 11:28 UTC (permalink / raw)
  To: Anatolij Gustschin
  Cc: linuxppc-dev, Wolfgang Denk, Detlev Zundel, Matthias Fuchs
In-Reply-To: <1276245337-22897-1-git-send-email-agust@denx.de>

>>>>> "Anatolij" == Anatolij Gustschin <agust@denx.de> writes:

Hi,

Old mail, I know ..

 Anatolij> From: Matthias Fuchs <matthias.fuchs@esd.eu>
 Anatolij> This patch adds a gpio driver for MPC512X PowerPCs.

 Anatolij> It has been tested on our CAN-CBX-CPU5201 module that
 Anatolij> uses a MPC5121 CPU. This platform comes with a couple of
 Anatolij> LEDs and configuration switches that have been used for testing.

 Anatolij> After change to the of-gpio api the reworked driver has been
 Anatolij> tested on pdm360ng board with some configuration switches.

This looks very similar to the existing
arch/powerpc/sysdev/mpc8xxx_gpio.c - Couldn't we just add 5121 support
there instead?

 Anatolij> +struct mpc512x_gpio_regs {
 Anatolij> +	u32 gpdir;
 Anatolij> +	u32 gpodr;
 Anatolij> +	u32 gpdat;
 Anatolij> +	u32 gpier;
 Anatolij> +	u32 gpimr;
 Anatolij> +	u32 gpicr1;
 Anatolij> +	u32 gpicr2;
 Anatolij> +};

-- 
Bye, Peter Korsgaard

^ permalink raw reply

* [PATCH] mpc52xx_gpio: support MPC52xx simple interrupt GPIO
From: Roman Fietze @ 2010-07-07 11:32 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: linuxppc-dev

Hello Sascha, hello List Members,

I could not find a way to access the MPC5200(B) simple interrupt pins
using the 52xx platform GPIO driver. So I added the simple interrupt
pins when the mpc5200-gpio is probed. Is there something I overlooked?
If not, here's the patch.


=46rom 749b58686384275d253eeca8f3f0bd7a12daebe2 Mon Sep 17 00:00:00 2001
=46rom: Roman Fietze <roman.fietze@telemotive.de>
Date: Wed, 7 Jul 2010 13:21:12 +0200
Subject: [PATCH] mpc52xx_gpio: support MPC52xx simple interrupt GPIO

Add two OF GPIO chips when probing fsl,mpc5200-gpio, one for the 32
simple GPIO pins and one for the 8 simple interrupt GPIO pins.

The current order of driver registrations will cause the simple
interrupt GPIO pin numbers be below the ones of the simple GPIO pins,
so current code will not have to be changed, except if there are more
GPIO pins with dynamic pin numbers registered after the platform
driver.

Signed-off-by: Roman Fietze <roman.fietze@telemotive.de>
=2D--
 arch/powerpc/platforms/52xx/mpc52xx_gpio.c |  128=20
+++++++++++++++++++++++++++-
 1 files changed, 126 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/platforms/52xx/mpc52xx_gpio.c=20
b/arch/powerpc/platforms/52xx/mpc52xx_gpio.c
index fda7c2a..d0a9fce 100644
=2D-- a/arch/powerpc/platforms/52xx/mpc52xx_gpio.c
+++ b/arch/powerpc/platforms/52xx/mpc52xx_gpio.c
@@ -308,7 +308,107 @@ mpc52xx_simple_gpio_dir_out(struct gpio_chip *gc,=20
unsigned int gpio, int val)
 	return 0;
 }
=20
=2Dstatic int __devinit mpc52xx_simple_gpiochip_probe(struct of_device *ofd=
ev,
+/*
+ * GPIO LIB API implementation for simple interrupt GPIOs
+ *
+ * There's a maximum of 8 simple interrupt GPIOs. Which of these are
+ * available for use depends on your board setup.  The numbering
+ * reflects the bit numbering in the port registers:
+ *
+ *  0.. 3 > ETH_16..ETH_13
+ *  4     > USB1_9
+ *  5     > PSC3_8
+ *  6.. 7 > PSC3_5..PSC3_4
+ */
+static int mpc52xx_sint_gpio_get(struct gpio_chip *gc, unsigned int gpio)
+{
+	struct of_mm_gpio_chip *mm_gc =3D to_of_mm_gpio_chip(gc);
+	struct mpc52xx_gpio __iomem *regs =3D mm_gc->regs;
+	unsigned int ret;
+
+	ret =3D (in_8(&regs->sint_ival) >> (7 - gpio)) & 1;
+
+	return ret;
+}
+
+static inline void
+__mpc52xx_sint_gpio_set(struct gpio_chip *gc, unsigned int gpio, int val)
+{
+	struct of_mm_gpio_chip *mm_gc =3D to_of_mm_gpio_chip(gc);
+	struct mpc52xx_gpiochip *chip =3D container_of(mm_gc,
+						     struct mpc52xx_gpiochip,=20
mmchip);
+	struct mpc52xx_gpio __iomem *regs =3D mm_gc->regs;
+
+	if (val)
+		chip->shadow_dvo |=3D 1 << (7 - gpio);
+	else
+		chip->shadow_dvo &=3D ~(1 << (7 - gpio));
+	out_8(&regs->sint_dvo, chip->shadow_dvo);
+}
+
+static void
+mpc52xx_sint_gpio_set(struct gpio_chip *gc, unsigned int gpio, int val)
+{
+	unsigned long flags;
+
+	spin_lock_irqsave(&gpio_lock, flags);
+
+	__mpc52xx_sint_gpio_set(gc, gpio, val);
+
+	spin_unlock_irqrestore(&gpio_lock, flags);
+}
+
+static int mpc52xx_sint_gpio_dir_in(struct gpio_chip *gc, unsigned int gpi=
o)
+{
+	struct of_mm_gpio_chip *mm_gc =3D to_of_mm_gpio_chip(gc);
+	struct mpc52xx_gpiochip *chip =3D container_of(mm_gc,
+						     struct mpc52xx_gpiochip,=20
mmchip);
+	struct mpc52xx_gpio __iomem *regs =3D mm_gc->regs;
+	unsigned long flags;
+
+	spin_lock_irqsave(&gpio_lock, flags);
+
+	/* set the direction */
+	chip->shadow_ddr &=3D ~(1 << (7 - gpio));
+	out_8(&regs->sint_ddr, chip->shadow_ddr);
+
+	/* and enable the pin */
+	chip->shadow_gpioe |=3D 1 << (7 - gpio);
+	out_8(&regs->sint_gpioe, chip->shadow_gpioe);
+
+	spin_unlock_irqrestore(&gpio_lock, flags);
+
+	return 0;
+}
+
+static int
+mpc52xx_sint_gpio_dir_out(struct gpio_chip *gc, unsigned int gpio, int val)
+{
+	struct of_mm_gpio_chip *mm_gc =3D to_of_mm_gpio_chip(gc);
+	struct mpc52xx_gpiochip *chip =3D container_of(mm_gc,
+						     struct mpc52xx_gpiochip,=20
mmchip);
+	struct mpc52xx_gpio __iomem *regs =3D mm_gc->regs;
+	unsigned long flags;
+
+	spin_lock_irqsave(&gpio_lock, flags);
+
+	/* First set initial value */
+	__mpc52xx_sint_gpio_set(gc, gpio, val);
+
+	/* Then set direction */
+	chip->shadow_ddr |=3D 1 << (7 - gpio);
+	out_8(&regs->sint_ddr, chip->shadow_ddr);
+
+	/* Finally enable the pin */
+	chip->shadow_gpioe |=3D 1 << (7 - gpio);
+	out_8(&regs->sint_gpioe, chip->shadow_gpioe);
+
+	spin_unlock_irqrestore(&gpio_lock, flags);
+
+	return 0;
+}
+
+static int __devinit mpc52xx_simple_sint_gpiochip_probe(struct of_device=20
*ofdev,
 					const struct of_device_id *match)
 {
 	struct mpc52xx_gpiochip *chip;
@@ -316,6 +416,7 @@ static int __devinit mpc52xx_simple_gpiochip_probe(stru=
ct=20
of_device *ofdev,
 	struct mpc52xx_gpio __iomem *regs;
 	int ret;
=20
+	/* simple GPIO */
 	chip =3D kzalloc(sizeof(*chip), GFP_KERNEL);
 	if (!chip)
 		return -ENOMEM;
@@ -338,6 +439,29 @@ static int __devinit mpc52xx_simple_gpiochip_probe(str=
uct=20
of_device *ofdev,
 	chip->shadow_ddr =3D in_be32(&regs->simple_ddr);
 	chip->shadow_dvo =3D in_be32(&regs->simple_dvo);
=20
+	/* simple interrupt GPIO */
+	chip =3D kzalloc(sizeof(*chip), GFP_KERNEL);
+	if (!chip)
+		return -ENOMEM;
+
+	ofchip =3D &chip->mmchip.of_gc;
+
+	ofchip->gpio_cells          =3D 2;
+	ofchip->gc.ngpio            =3D 8;
+	ofchip->gc.direction_input  =3D mpc52xx_sint_gpio_dir_in;
+	ofchip->gc.direction_output =3D mpc52xx_sint_gpio_dir_out;
+	ofchip->gc.get              =3D mpc52xx_sint_gpio_get;
+	ofchip->gc.set              =3D mpc52xx_sint_gpio_set;
+
+	ret =3D of_mm_gpiochip_add(ofdev->node, &chip->mmchip);
+	if (ret)
+		return ret;
+
+	regs =3D chip->mmchip.regs;
+	chip->shadow_gpioe =3D in_8(&regs->sint_gpioe);
+	chip->shadow_ddr =3D in_8(&regs->sint_ddr);
+	chip->shadow_dvo =3D in_8(&regs->sint_dvo);
+
 	return 0;
 }
=20
@@ -351,7 +475,7 @@ static const struct of_device_id=20
mpc52xx_simple_gpiochip_match[] =3D {
 static struct of_platform_driver mpc52xx_simple_gpiochip_driver =3D {
 	.name =3D "gpio",
 	.match_table =3D mpc52xx_simple_gpiochip_match,
=2D	.probe =3D mpc52xx_simple_gpiochip_probe,
+	.probe =3D mpc52xx_simple_sint_gpiochip_probe,
 	.remove =3D mpc52xx_gpiochip_remove,
 };
=20
=2D-=20
1.7.1


=2D-=20
Roman Fietze              Telemotive AG Buero Muehlhausen
Breitwiesen                             73347 Muehlhausen
Tel.: +49(0)7335/18493-45        http://www.telemotive.de

^ permalink raw reply

* Re: kernel boot stuck at udbg_putc_cpm()
From: Scott Wood @ 2010-07-07 15:42 UTC (permalink / raw)
  To: Shawn Jin; +Cc: ppcdev
In-Reply-To: <AANLkTimUxcsTMXNPOFfJxybp8u7Wv7Mt_nhW1EE01RqG@mail.gmail.com>

On Tue, 6 Jul 2010 17:17:16 -0700
Shawn Jin <shawnxjin@gmail.com> wrote:

> >> That was it. The value @0xfa203bf8 is 0x20000001. The kernel
> >> certainly moved forward till it stuck at the new place
> >> cpm_uart_initbd() as shown below.
> >
> > Do you get any output from the serial port? =A0I'd have expected
> > something by the time you get to cpm_uart_initbd() -- in fact, the
> > early output will have been shut down by then to make room for the
> > real serial driver.
>=20
> Nothing new on the serial port. :-( Is the interrupt enabled during
> the early debug stage? I'm not sure if the interrupt controller is set
> properly in DTS. The same MPC875 settings are copied from the
> adder875-uboot.dts.

Interrupts are not used for the early serial output.

>=20
>     Memory <- <0x0 0x8000000> (128MB)
>     ENET0: local-mac-address <- 00:09:9b:01:58:64
>     CPU clock-frequency <- 0x7270e00 (120MHz)
>     CPU timebase-frequency <- 0x393870 (4MHz)
>     CPU bus-frequency <- 0x3938700 (60MHz)
>=20
>     zImage starting: loaded at 0x00400000 (sp: 0x07d1ccd0)
>     Allocating 0x186bdd bytes for kernel ...
>     gunzipping (0x00000000 <- 0x0040c000:0x00591c30)...done 0x173b18
> bytes
>=20
>     Linux/PowerPC load: root=3D/dev/ram
>     Finalizing device tree... flat tree at 0x59e300
>=20
> Here is the kernel log buf dump. Anything suspicious?

Nope, looks normal.

-Scott

^ permalink raw reply

* Problems mapping OCM memory from 460EX to user space
From: ayman @ 2010-07-07 19:48 UTC (permalink / raw)
  To: linuxppc-dev

I've got an issue with the new rev B 460EX processors that I am trying to isolate.
(Rev A worked fine).  In order to do that, I am trying to modify my driver to 
map the OCM (on chip memory) from the 460EX to user space so that the rest of the
application and codebase don't really know the difference.

My driver implements the mmap and this works fine when I point it to areas of 
memory that have been setup with kmalloc.  My sequence is basically kmalloc, 
adjust for page boundaries, and then remap_pfn_range.  For regular DRAM this 
works fine.

Now I want to modfiy it to use OCM.  I've modified the code to use ioremap so 
that the driver has access to the memory. This seems to work.  But the kernel 
gives a register dump when I call 

#define PLB_OCM_BASE_ADDR        0x400040000ull
...

static int mapper_mmap(struct file *fip, struct vm_area_struct *vma)
{
  int rc;
  
  /* 
   * make sure to allocate the proper number of pages when using
   * mmap.  We check it for correctness here.
   */
  
  unsigned long len = vma->vm_end - vma->vm_start;

  /* if user tries to map bigger space than we have, error */
 if (PAGE_COUNT * PAGE_SIZE < len) 
    return -EIO;

 rc = io_remap_pfn_range(vma, PLB_OCM_BASE_ADDR>>PAGE_SHIFT, vma->vm_start, len, vma->vm_page_prot);

#if 0
  /* map the physical area into one buffer */
  rc = remap_pfn_range(vma, vma->vm_start, 
		       virt_to_phys( (void*)km.pal)>>PAGE_SHIFT,
		       len,
		       vma->vm_page_prot);
#endif

  MDEBUG("Mapped %ld bytes at virt address 0x%lx to mapper file descriptor...\n", len, vma->vm_start);

  /* return an error to the caller if remap fails */
  return (rc < 0 ? rc : 0);

}

The "#if 0" code is the working code for using DRAM.  MDEBUG is just a printk.

I am fairly certain the physical address is correct, I've verified that the
TLB entries in u-boot look ok.  Any tips on how to make this work?

Thanks

^ permalink raw reply

* [PATCH 2/2] powerpc/booke: Enable building of a crash dump kernel
From: Matthew McClintock @ 2010-07-07 20:51 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Matthew McClintock, kumar.gala
In-Reply-To: <1278535881-6463-1-git-send-email-msm@freescale.com>

Enable building crash dump kernel as well as expose the flat
device tree for kexec to update to boot the crash kernel
---
 arch/powerpc/Kconfig       |    2 +-
 arch/powerpc/kernel/prom.c |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 042f2f0..0b60c57 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -368,7 +368,7 @@ config KEXEC
 
 config CRASH_DUMP
 	bool "Build a kdump crash kernel"
-	depends on PPC64 || 6xx
+	depends on PPC64 || 6xx || FSL_BOOKE
 	select RELOCATABLE if PPC64
 	help
 	  Build a kernel suitable for use as a kdump capture kernel.
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index 05131d6..fd9359a 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -892,7 +892,7 @@ struct device_node *of_get_cpu_node(int cpu, unsigned int *thread)
 }
 EXPORT_SYMBOL(of_get_cpu_node);
 
-#if defined(CONFIG_DEBUG_FS) && defined(DEBUG)
+#if defined(CONFIG_DEBUG_FS) && (defined(DEBUG) || defined(CONFIG_KEXEC))
 static struct debugfs_blob_wrapper flat_dt_blob;
 
 static int __init export_flat_device_tree(void)
-- 
1.6.6.1

^ permalink raw reply related

* [PATCH 1/2] powerpc/crashdump: Fix issues with kexec and 36bit physical addr
From: Matthew McClintock @ 2010-07-07 20:51 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Matthew McClintock, kumar.gala

Fix sizes of variables so correct values are exported via /proc.
Cast variable in comparison to avoid compiler error.

Signed-off-by: Matthew McClintock <msm@freescale.com>
---
 arch/powerpc/kernel/crash_dump.c    |    4 ++--
 arch/powerpc/kernel/machine_kexec.c |    4 +++-
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/kernel/crash_dump.c b/arch/powerpc/kernel/crash_dump.c
index 5fb667a..71cadde 100644
--- a/arch/powerpc/kernel/crash_dump.c
+++ b/arch/powerpc/kernel/crash_dump.c
@@ -128,9 +128,9 @@ ssize_t copy_oldmem_page(unsigned long pfn, char *buf,
 	if (!csize)
 		return 0;
 
-	csize = min(csize, PAGE_SIZE);
+	csize = min(csize, (size_t)PAGE_SIZE);
 
-	if (pfn < max_pfn) {
+	if ((min_low_pfn < pfn) && (pfn < max_pfn)) {
 		vaddr = __va(pfn << PAGE_SHIFT);
 		csize = copy_oldmem_vaddr(vaddr, buf, csize, offset, userbuf);
 	} else {
diff --git a/arch/powerpc/kernel/machine_kexec.c b/arch/powerpc/kernel/machine_kexec.c
index bb3d893..ec7f054 100644
--- a/arch/powerpc/kernel/machine_kexec.c
+++ b/arch/powerpc/kernel/machine_kexec.c
@@ -145,6 +145,7 @@ int overlaps_crashkernel(unsigned long start, unsigned long size)
 
 /* Values we need to export to the second kernel via the device tree. */
 static unsigned long kernel_end;
+static unsigned long crashk_start;
 static unsigned long crashk_size;
 
 static struct property kernel_end_prop = {
@@ -156,7 +157,7 @@ static struct property kernel_end_prop = {
 static struct property crashk_base_prop = {
 	.name = "linux,crashkernel-base",
 	.length = sizeof(unsigned long),
-	.value = &crashk_res.start,
+	.value = &crashk_start,
 };
 
 static struct property crashk_size_prop = {
@@ -180,6 +181,7 @@ static void __init export_crashk_values(struct device_node *node)
 		prom_remove_property(node, prop);
 
 	if (crashk_res.start != 0) {
+		crashk_start = crashk_res.start;
 		prom_add_property(node, &crashk_base_prop);
 		crashk_size = crashk_res.end - crashk_res.start + 1;
 		prom_add_property(node, &crashk_size_prop);
-- 
1.6.6.1

^ permalink raw reply related

* [PATCH 06/18] spufs: use llseek in all file operations
From: Arnd Bergmann @ 2010-07-07 21:40 UTC (permalink / raw)
  To: linux-kernel
  Cc: Arnd Bergmann, Frederic Weisbecker, linuxppc-dev, Jeremy Kerr,
	John Kacur, Christoph Hellwig
In-Reply-To: <1278538820-1392-1-git-send-email-arnd@arndb.de>

The default for llseek is changing, so we need
explicit operations everywhere.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Cc: Jeremy Kerr <jk@ozlabs.org>
Cc: linuxppc-dev@ozlabs.org
---
 arch/powerpc/platforms/cell/spufs/file.c |   24 +++++++++++++++++++++---
 1 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/platforms/cell/spufs/file.c b/arch/powerpc/platforms/cell/spufs/file.c
index 1a40da9..d2980bd 100644
--- a/arch/powerpc/platforms/cell/spufs/file.c
+++ b/arch/powerpc/platforms/cell/spufs/file.c
@@ -154,6 +154,7 @@ static const struct file_operations __fops = {				\
 	.release = spufs_attr_release,					\
 	.read	 = spufs_attr_read,					\
 	.write	 = spufs_attr_write,					\
+	.llseek  = generic_file_llseek,					\
 };
 
 
@@ -521,6 +522,7 @@ static const struct file_operations spufs_cntl_fops = {
 	.release = spufs_cntl_release,
 	.read = simple_attr_read,
 	.write = simple_attr_write,
+	.llseek	= generic_file_llseek,
 	.mmap = spufs_cntl_mmap,
 };
 
@@ -714,6 +716,7 @@ static ssize_t spufs_mbox_read(struct file *file, char __user *buf,
 static const struct file_operations spufs_mbox_fops = {
 	.open	= spufs_pipe_open,
 	.read	= spufs_mbox_read,
+	.llseek	= no_llseek,
 };
 
 static ssize_t spufs_mbox_stat_read(struct file *file, char __user *buf,
@@ -743,6 +746,7 @@ static ssize_t spufs_mbox_stat_read(struct file *file, char __user *buf,
 static const struct file_operations spufs_mbox_stat_fops = {
 	.open	= spufs_pipe_open,
 	.read	= spufs_mbox_stat_read,
+	.llseek = no_llseek,
 };
 
 /* low-level ibox access function */
@@ -863,6 +867,7 @@ static const struct file_operations spufs_ibox_fops = {
 	.read	= spufs_ibox_read,
 	.poll	= spufs_ibox_poll,
 	.fasync	= spufs_ibox_fasync,
+	.llseek = no_llseek,
 };
 
 static ssize_t spufs_ibox_stat_read(struct file *file, char __user *buf,
@@ -890,6 +895,7 @@ static ssize_t spufs_ibox_stat_read(struct file *file, char __user *buf,
 static const struct file_operations spufs_ibox_stat_fops = {
 	.open	= spufs_pipe_open,
 	.read	= spufs_ibox_stat_read,
+	.llseek = no_llseek,
 };
 
 /* low-level mailbox write */
@@ -1011,6 +1017,7 @@ static const struct file_operations spufs_wbox_fops = {
 	.write	= spufs_wbox_write,
 	.poll	= spufs_wbox_poll,
 	.fasync	= spufs_wbox_fasync,
+	.llseek = no_llseek,
 };
 
 static ssize_t spufs_wbox_stat_read(struct file *file, char __user *buf,
@@ -1038,6 +1045,7 @@ static ssize_t spufs_wbox_stat_read(struct file *file, char __user *buf,
 static const struct file_operations spufs_wbox_stat_fops = {
 	.open	= spufs_pipe_open,
 	.read	= spufs_wbox_stat_read,
+	.llseek = no_llseek,
 };
 
 static int spufs_signal1_open(struct inode *inode, struct file *file)
@@ -1166,6 +1174,7 @@ static const struct file_operations spufs_signal1_fops = {
 	.read = spufs_signal1_read,
 	.write = spufs_signal1_write,
 	.mmap = spufs_signal1_mmap,
+	.llseek = no_llseek,
 };
 
 static const struct file_operations spufs_signal1_nosched_fops = {
@@ -1173,6 +1182,7 @@ static const struct file_operations spufs_signal1_nosched_fops = {
 	.release = spufs_signal1_release,
 	.write = spufs_signal1_write,
 	.mmap = spufs_signal1_mmap,
+	.llseek = no_llseek,
 };
 
 static int spufs_signal2_open(struct inode *inode, struct file *file)
@@ -1305,6 +1315,7 @@ static const struct file_operations spufs_signal2_fops = {
 	.read = spufs_signal2_read,
 	.write = spufs_signal2_write,
 	.mmap = spufs_signal2_mmap,
+	.llseek = no_llseek,
 };
 
 static const struct file_operations spufs_signal2_nosched_fops = {
@@ -1312,6 +1323,7 @@ static const struct file_operations spufs_signal2_nosched_fops = {
 	.release = spufs_signal2_release,
 	.write = spufs_signal2_write,
 	.mmap = spufs_signal2_mmap,
+	.llseek = no_llseek,
 };
 
 /*
@@ -1451,6 +1463,7 @@ static const struct file_operations spufs_mss_fops = {
 	.open	 = spufs_mss_open,
 	.release = spufs_mss_release,
 	.mmap	 = spufs_mss_mmap,
+	.llseek  = no_llseek,
 };
 
 static int
@@ -1508,6 +1521,7 @@ static const struct file_operations spufs_psmap_fops = {
 	.open	 = spufs_psmap_open,
 	.release = spufs_psmap_release,
 	.mmap	 = spufs_psmap_mmap,
+	.llseek  = no_llseek,
 };
 
 
@@ -1871,6 +1885,7 @@ static const struct file_operations spufs_mfc_fops = {
 	.fsync	 = spufs_mfc_fsync,
 	.fasync	 = spufs_mfc_fasync,
 	.mmap	 = spufs_mfc_mmap,
+	.llseek  = no_llseek,
 };
 
 static int spufs_npc_set(void *data, u64 val)
@@ -2111,7 +2126,7 @@ static ssize_t spufs_mbox_info_read(struct file *file, char __user *buf,
 static const struct file_operations spufs_mbox_info_fops = {
 	.open = spufs_info_open,
 	.read = spufs_mbox_info_read,
-	.llseek  = generic_file_llseek,
+	.llseek = no_llseek,
 };
 
 static ssize_t __spufs_ibox_info_read(struct spu_context *ctx,
@@ -2151,7 +2166,7 @@ static ssize_t spufs_ibox_info_read(struct file *file, char __user *buf,
 static const struct file_operations spufs_ibox_info_fops = {
 	.open = spufs_info_open,
 	.read = spufs_ibox_info_read,
-	.llseek  = generic_file_llseek,
+	.llseek = no_llseek,
 };
 
 static ssize_t __spufs_wbox_info_read(struct spu_context *ctx,
@@ -2194,7 +2209,7 @@ static ssize_t spufs_wbox_info_read(struct file *file, char __user *buf,
 static const struct file_operations spufs_wbox_info_fops = {
 	.open = spufs_info_open,
 	.read = spufs_wbox_info_read,
-	.llseek  = generic_file_llseek,
+	.llseek = no_llseek,
 };
 
 static ssize_t __spufs_dma_info_read(struct spu_context *ctx,
@@ -2246,6 +2261,7 @@ static ssize_t spufs_dma_info_read(struct file *file, char __user *buf,
 static const struct file_operations spufs_dma_info_fops = {
 	.open = spufs_info_open,
 	.read = spufs_dma_info_read,
+	.llseek = no_llseek,
 };
 
 static ssize_t __spufs_proxydma_info_read(struct spu_context *ctx,
@@ -2299,6 +2315,7 @@ static ssize_t spufs_proxydma_info_read(struct file *file, char __user *buf,
 static const struct file_operations spufs_proxydma_info_fops = {
 	.open = spufs_info_open,
 	.read = spufs_proxydma_info_read,
+	.llseek = no_llseek,
 };
 
 static int spufs_show_tid(struct seq_file *s, void *private)
@@ -2585,6 +2602,7 @@ static const struct file_operations spufs_switch_log_fops = {
 	.read		= spufs_switch_log_read,
 	.poll		= spufs_switch_log_poll,
 	.release	= spufs_switch_log_release,
+	.llseek		= no_llseek,
 };
 
 /**
-- 
1.7.1

^ permalink raw reply related

* Re: [PATCH 1/2] edac: mpc85xx: Fix MPC85xx dependency
From: Andrew Morton @ 2010-07-07 21:45 UTC (permalink / raw)
  To: Anton Vorontsov
  Cc: Peter Tyser, linux-kernel, Dave Jiang, linuxppc-dev,
	Doug Thompson
In-Reply-To: <20100702124111.GA23320@oksana.dev.rtsoft.ru>

On Fri, 2 Jul 2010 16:41:11 +0400
Anton Vorontsov <avorontsov@mvista.com> wrote:

> Since commit 5753c082f66eca5be81f6bda85c1718c5eea6ada ("powerpc/85xx:
> Kconfig cleanup"), there is no MPC85xx Kconfig symbol anymore, so the
> driver became non-selectable.

hm.  5753c082f66eca5be81f6bda85c1718c5eea6ada got merged into mainline
six months ago.  How come nobody noticed?

> This patch fixes the issue by switching to PPC_85xx symbol.
> 
> Signed-off-by: Anton Vorontsov <avorontsov@mvista.com>
> ---
>  drivers/edac/Kconfig |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/edac/Kconfig b/drivers/edac/Kconfig
> index aedef79..0d2f9db 100644
> --- a/drivers/edac/Kconfig
> +++ b/drivers/edac/Kconfig
> @@ -209,7 +209,7 @@ config EDAC_I5100
>  
>  config EDAC_MPC85XX
>  	tristate "Freescale MPC83xx / MPC85xx"
> -	depends on EDAC_MM_EDAC && FSL_SOC && (PPC_83xx || MPC85xx)
> +	depends on EDAC_MM_EDAC && FSL_SOC && (PPC_83xx || PPC_85xx)
>  	help
>  	  Support for error detection and correction on the Freescale
>  	  MPC8349, MPC8560, MPC8540, MPC8548

I suppose we shold scoot this into 2.6.35 and mark it for -stable
backporting.  All very odd.

^ permalink raw reply

* [PATCHv2 1/2] powerpc: Migration code reorganization / hibernation prep
From: Brian King @ 2010-07-07 22:31 UTC (permalink / raw)
  To: benh; +Cc: brking, linuxppc-dev


Partition hibernation will use some of the same code as is
currently used for Live Partition Migration. This function
further abstracts this code such that code outside of rtas.c
can utilize it. It also changes the error field in the suspend
me data structure to be an atomic type, since it is set and
checked on different cpus without any barriers or locking.

Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
---

 arch/powerpc/include/asm/hvcall.h |    1 
 arch/powerpc/include/asm/rtas.h   |   10 +++
 arch/powerpc/kernel/rtas.c        |  105 +++++++++++++++++++++++++-------------
 3 files changed, 81 insertions(+), 35 deletions(-)

diff -puN arch/powerpc/include/asm/rtas.h~powerpc_rtas_hibernate_prep arch/powerpc/include/asm/rtas.h
--- linux-2.6/arch/powerpc/include/asm/rtas.h~powerpc_rtas_hibernate_prep	2010-06-16 13:49:29.000000000 -0500
+++ linux-2.6-bjking1/arch/powerpc/include/asm/rtas.h	2010-06-16 13:49:29.000000000 -0500
@@ -63,6 +63,14 @@ struct rtas_t {
 	struct device_node *dev;	/* virtual address pointer */
 };
 
+struct rtas_suspend_me_data {
+	atomic_t working; /* number of cpus accessing this struct */
+	atomic_t done;
+	int token; /* ibm,suspend-me */
+	atomic_t error;
+	struct completion *complete; /* wait on this until working == 0 */
+};
+
 /* RTAS event classes */
 #define RTAS_INTERNAL_ERROR		0x80000000 /* set bit 0 */
 #define RTAS_EPOW_WARNING		0x40000000 /* set bit 1 */
@@ -174,6 +182,8 @@ extern int rtas_set_indicator(int indica
 extern int rtas_set_indicator_fast(int indicator, int index, int new_value);
 extern void rtas_progress(char *s, unsigned short hex);
 extern void rtas_initialize(void);
+extern int rtas_suspend_cpu(struct rtas_suspend_me_data *data);
+extern int rtas_suspend_last_cpu(struct rtas_suspend_me_data *data);
 
 struct rtc_time;
 extern unsigned long rtas_get_boot_time(void);
diff -puN arch/powerpc/kernel/rtas.c~powerpc_rtas_hibernate_prep arch/powerpc/kernel/rtas.c
--- linux-2.6/arch/powerpc/kernel/rtas.c~powerpc_rtas_hibernate_prep	2010-06-16 13:49:29.000000000 -0500
+++ linux-2.6-bjking1/arch/powerpc/kernel/rtas.c	2010-06-16 15:29:44.000000000 -0500
@@ -47,14 +47,6 @@ struct rtas_t rtas = {
 };
 EXPORT_SYMBOL(rtas);
 
-struct rtas_suspend_me_data {
-	atomic_t working; /* number of cpus accessing this struct */
-	atomic_t done;
-	int token; /* ibm,suspend-me */
-	int error;
-	struct completion *complete; /* wait on this until working == 0 */
-};
-
 DEFINE_SPINLOCK(rtas_data_buf_lock);
 EXPORT_SYMBOL(rtas_data_buf_lock);
 
@@ -714,14 +706,53 @@ void rtas_os_term(char *str)
 
 static int ibm_suspend_me_token = RTAS_UNKNOWN_SERVICE;
 #ifdef CONFIG_PPC_PSERIES
-static void rtas_percpu_suspend_me(void *info)
+static int __rtas_suspend_last_cpu(struct rtas_suspend_me_data *data, int wake_when_done)
+{
+	u16 slb_size = mmu_slb_size;
+	int rc = H_MULTI_THREADS_ACTIVE;
+	int cpu;
+
+	slb_set_size(SLB_MIN_SIZE);
+	printk(KERN_DEBUG "calling ibm,suspend-me on cpu %i\n", smp_processor_id());
+
+	while (rc == H_MULTI_THREADS_ACTIVE && !atomic_read(&data->done) &&
+	       !atomic_read(&data->error))
+		rc = rtas_call(data->token, 0, 1, NULL);
+
+	if (rc || atomic_read(&data->error)) {
+		printk(KERN_DEBUG "ibm,suspend-me returned %d\n", rc);
+		slb_set_size(slb_size);
+	}
+
+	if (atomic_read(&data->error))
+		rc = atomic_read(&data->error);
+
+	atomic_set(&data->error, rc);
+
+	if (wake_when_done) {
+		atomic_set(&data->done, 1);
+
+		for_each_online_cpu(cpu)
+			plpar_hcall_norets(H_PROD, get_hard_smp_processor_id(cpu));
+	}
+
+	if (atomic_dec_return(&data->working) == 0)
+		complete(data->complete);
+
+	return rc;
+}
+
+int rtas_suspend_last_cpu(struct rtas_suspend_me_data *data)
+{
+	atomic_inc(&data->working);
+	return __rtas_suspend_last_cpu(data, 0);
+}
+
+static int __rtas_suspend_cpu(struct rtas_suspend_me_data *data, int wake_when_done)
 {
 	long rc = H_SUCCESS;
 	unsigned long msr_save;
-	u16 slb_size = mmu_slb_size;
 	int cpu;
-	struct rtas_suspend_me_data *data =
-		(struct rtas_suspend_me_data *)info;
 
 	atomic_inc(&data->working);
 
@@ -729,7 +760,7 @@ static void rtas_percpu_suspend_me(void
 	msr_save = mfmsr();
 	mtmsr(msr_save & ~(MSR_EE));
 
-	while (rc == H_SUCCESS && !atomic_read(&data->done))
+	while (rc == H_SUCCESS && !atomic_read(&data->done) && !atomic_read(&data->error))
 		rc = plpar_hcall_norets(H_JOIN);
 
 	mtmsr(msr_save);
@@ -741,33 +772,37 @@ static void rtas_percpu_suspend_me(void
 		/* All other cpus are in H_JOIN, this cpu does
 		 * the suspend.
 		 */
-		slb_set_size(SLB_MIN_SIZE);
-		printk(KERN_DEBUG "calling ibm,suspend-me on cpu %i\n",
-		       smp_processor_id());
-		data->error = rtas_call(data->token, 0, 1, NULL);
-
-		if (data->error) {
-			printk(KERN_DEBUG "ibm,suspend-me returned %d\n",
-			       data->error);
-			slb_set_size(slb_size);
-		}
+		return __rtas_suspend_last_cpu(data, wake_when_done);
 	} else {
 		printk(KERN_ERR "H_JOIN on cpu %i failed with rc = %ld\n",
 		       smp_processor_id(), rc);
-		data->error = rc;
+		atomic_set(&data->error, rc);
 	}
 
-	atomic_set(&data->done, 1);
+	if (wake_when_done) {
+		atomic_set(&data->done, 1);
 
-	/* This cpu did the suspend or got an error; in either case,
-	 * we need to prod all other other cpus out of join state.
-	 * Extra prods are harmless.
-	 */
-	for_each_online_cpu(cpu)
-		plpar_hcall_norets(H_PROD, get_hard_smp_processor_id(cpu));
+		/* This cpu did the suspend or got an error; in either case,
+		 * we need to prod all other other cpus out of join state.
+		 * Extra prods are harmless.
+		 */
+		for_each_online_cpu(cpu)
+			plpar_hcall_norets(H_PROD, get_hard_smp_processor_id(cpu));
+	}
 out:
 	if (atomic_dec_return(&data->working) == 0)
 		complete(data->complete);
+	return rc;
+}
+
+int rtas_suspend_cpu(struct rtas_suspend_me_data *data)
+{
+	return __rtas_suspend_cpu(data, 0);
+}
+
+static void rtas_percpu_suspend_me(void *info)
+{
+	__rtas_suspend_cpu((struct rtas_suspend_me_data *)info, 1);
 }
 
 static int rtas_ibm_suspend_me(struct rtas_args *args)
@@ -802,22 +837,22 @@ static int rtas_ibm_suspend_me(struct rt
 
 	atomic_set(&data.working, 0);
 	atomic_set(&data.done, 0);
+	atomic_set(&data.error, 0);
 	data.token = rtas_token("ibm,suspend-me");
-	data.error = 0;
 	data.complete = &done;
 
 	/* Call function on all CPUs.  One of us will make the
 	 * rtas call
 	 */
 	if (on_each_cpu(rtas_percpu_suspend_me, &data, 0))
-		data.error = -EINVAL;
+		atomic_set(&data.error, -EINVAL);
 
 	wait_for_completion(&done);
 
-	if (data.error != 0)
+	if (atomic_read(&data.error) != 0)
 		printk(KERN_ERR "Error doing global join\n");
 
-	return data.error;
+	return atomic_read(&data.error);
 }
 #else /* CONFIG_PPC_PSERIES */
 static int rtas_ibm_suspend_me(struct rtas_args *args)
diff -puN arch/powerpc/include/asm/hvcall.h~powerpc_rtas_hibernate_prep arch/powerpc/include/asm/hvcall.h
--- linux-2.6/arch/powerpc/include/asm/hvcall.h~powerpc_rtas_hibernate_prep	2010-06-16 13:49:29.000000000 -0500
+++ linux-2.6-bjking1/arch/powerpc/include/asm/hvcall.h	2010-06-16 13:49:29.000000000 -0500
@@ -74,6 +74,7 @@
 #define H_NOT_ENOUGH_RESOURCES -44
 #define H_R_STATE       -45
 #define H_RESCINDEND    -46
+#define H_MULTI_THREADS_ACTIVE -9005
 
 
 /* Long Busy is a condition that can be returned by the firmware
_

^ permalink raw reply

* [PATCHv2 2/2] powerpc: Partition hibernation support
From: Brian King @ 2010-07-07 22:31 UTC (permalink / raw)
  To: benh; +Cc: brking, linuxppc-dev


Enables support for HMC initiated partition hibernation. This is
a firmware assisted hibernation, since the firmware handles writing
the memory out to disk, along with other partition information,
so we just mimic suspend to ram.

Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
---

 arch/powerpc/Kconfig                         |    2 
 arch/powerpc/include/asm/machdep.h           |    1 
 arch/powerpc/platforms/pseries/Makefile      |    4 
 arch/powerpc/platforms/pseries/hotplug-cpu.c |    3 
 arch/powerpc/platforms/pseries/suspend.c     |  214 +++++++++++++++++++++++++++
 5 files changed, 223 insertions(+), 1 deletion(-)

diff -puN /dev/null arch/powerpc/platforms/pseries/suspend.c
--- /dev/null	2009-12-15 17:58:07.000000000 -0600
+++ linux-2.6-bjking1/arch/powerpc/platforms/pseries/suspend.c	2010-06-16 13:49:30.000000000 -0500
@@ -0,0 +1,214 @@
+/*
+  * Copyright (C) 2010 Brian King IBM Corporation
+  *
+  * This program is free software; you can redistribute it and/or modify
+  * it under the terms of the GNU General Public License as published by
+  * the Free Software Foundation; either version 2 of the License, or
+  * (at your option) any later version.
+  *
+  * This program is distributed in the hope that it will be useful,
+  * but WITHOUT ANY WARRANTY; without even the implied warranty of
+  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  * GNU General Public License for more details.
+  *
+  * You should have received a copy of the GNU General Public License
+  * along with this program; if not, write to the Free Software
+  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+  */
+
+#include <linux/delay.h>
+#include <linux/suspend.h>
+#include <asm/firmware.h>
+#include <asm/hvcall.h>
+#include <asm/machdep.h>
+#include <asm/mmu.h>
+#include <asm/rtas.h>
+
+static u64 stream_id;
+static struct sys_device suspend_sysdev;
+static DECLARE_COMPLETION(suspend_work);
+static struct rtas_suspend_me_data suspend_data;
+static atomic_t suspending;
+
+/**
+ * pseries_suspend_begin - First phase of hibernation
+ *
+ * Check to ensure we are in a valid state to hibernate
+ *
+ * Return value:
+ * 	0 on success / other on failure
+ **/
+static int pseries_suspend_begin(suspend_state_t state)
+{
+	long vasi_state, rc;
+	unsigned long retbuf[PLPAR_HCALL_BUFSIZE];
+
+	/* Make sure the state is valid */
+	rc = plpar_hcall(H_VASI_STATE, retbuf, stream_id);
+
+	vasi_state = retbuf[0];
+
+	if (rc) {
+		pr_err("pseries_suspend_begin: vasi_state returned %ld\n",rc);
+		return rc;
+	} else if (vasi_state == H_VASI_ENABLED) {
+		return -EAGAIN;
+	} else if (vasi_state != H_VASI_SUSPENDING) {
+		pr_err("pseries_suspend_begin: vasi_state returned state %ld\n",
+		       vasi_state);
+		return -EIO;
+	}
+
+	return 0;
+}
+
+/**
+ * pseries_suspend_cpu - Suspend a single CPU
+ *
+ * Makes the H_JOIN call to suspend the CPU
+ *
+ **/
+static int pseries_suspend_cpu(void)
+{
+	if (atomic_read(&suspending))
+		return rtas_suspend_cpu(&suspend_data);
+	return 0;
+}
+
+/**
+ * pseries_suspend_enter - Final phase of hibernation
+ *
+ * Return value:
+ * 	0 on success / other on failure
+ **/
+static int pseries_suspend_enter(suspend_state_t state)
+{
+	int rc = rtas_suspend_last_cpu(&suspend_data);
+
+	atomic_set(&suspending, 0);
+	atomic_set(&suspend_data.done, 1);
+	return rc;
+}
+
+/**
+ * pseries_prepare_late - Prepare to suspend all other CPUs
+ *
+ * Return value:
+ * 	0 on success / other on failure
+ **/
+static int pseries_prepare_late(void)
+{
+	atomic_set(&suspending, 1);
+	atomic_set(&suspend_data.working, 0);
+	atomic_set(&suspend_data.done, 0);
+	atomic_set(&suspend_data.error, 0);
+	suspend_data.complete = &suspend_work;
+	INIT_COMPLETION(suspend_work);
+	return 0;
+}
+
+/**
+ * store_hibernate - Initiate partition hibernation
+ * @classdev:	sysdev class struct
+ * @attr:		class device attribute struct
+ * @buf:		buffer
+ * @count:		buffer size
+ *
+ * Write the stream ID received from the HMC to this file
+ * to trigger hibernating the partition
+ *
+ * Return value:
+ * 	number of bytes printed to buffer / other on failure
+ **/
+static ssize_t store_hibernate(struct sysdev_class *classdev,
+			       struct sysdev_class_attribute *attr,
+			       const char *buf, size_t count)
+{
+	int rc;
+
+	if (!capable(CAP_SYS_ADMIN))
+		return -EPERM;
+
+	stream_id = simple_strtoul(buf, NULL, 16);
+
+	do {
+		rc = pseries_suspend_begin(PM_SUSPEND_MEM);
+		if (rc == -EAGAIN)
+			ssleep(1);
+	} while (rc == -EAGAIN);
+
+	if (!rc)
+		rc = pm_suspend(PM_SUSPEND_MEM);
+
+	stream_id = 0;
+
+	if (!rc)
+		rc = count;
+	return rc;
+}
+
+static SYSDEV_CLASS_ATTR(hibernate, S_IWUSR, NULL, store_hibernate);
+
+static struct sysdev_class suspend_sysdev_class = {
+	.name = "power",
+};
+
+static struct platform_suspend_ops pseries_suspend_ops = {
+	.valid		= suspend_valid_only_mem,
+	.begin		= pseries_suspend_begin,
+	.prepare_late	= pseries_prepare_late,
+	.enter		= pseries_suspend_enter,
+};
+
+/**
+ * pseries_suspend_sysfs_register - Register with sysfs
+ *
+ * Return value:
+ * 	0 on success / other on failure
+ **/
+static int pseries_suspend_sysfs_register(struct sys_device *sysdev)
+{
+	int rc;
+
+	if ((rc = sysdev_class_register(&suspend_sysdev_class)))
+		return rc;
+
+	sysdev->id = 0;
+	sysdev->cls = &suspend_sysdev_class;
+
+	if ((rc = sysdev_class_create_file(&suspend_sysdev_class, &attr_hibernate)))
+		goto class_unregister;
+
+	return 0;
+
+class_unregister:
+	sysdev_class_unregister(&suspend_sysdev_class);
+	return rc;
+}
+
+/**
+ * pseries_suspend_init - initcall for pSeries suspend
+ *
+ * Return value:
+ * 	0 on success / other on failure
+ **/
+static int __init pseries_suspend_init(void)
+{
+	int rc;
+
+	if (!machine_is(pseries) || !firmware_has_feature(FW_FEATURE_LPAR))
+		return 0;
+
+	suspend_data.token = rtas_token("ibm,suspend-me");
+	if (suspend_data.token == RTAS_UNKNOWN_SERVICE)
+		return 0;
+
+	if ((rc = pseries_suspend_sysfs_register(&suspend_sysdev)))
+		return rc;
+
+	ppc_md.suspend_disable_cpu = pseries_suspend_cpu;
+	suspend_set_ops(&pseries_suspend_ops);
+	return 0;
+}
+
+__initcall(pseries_suspend_init);
diff -puN arch/powerpc/Kconfig~powerpc_allarch_pseries_hibernation arch/powerpc/Kconfig
--- linux-2.6/arch/powerpc/Kconfig~powerpc_allarch_pseries_hibernation	2010-06-16 13:49:30.000000000 -0500
+++ linux-2.6-bjking1/arch/powerpc/Kconfig	2010-06-16 13:49:30.000000000 -0500
@@ -218,7 +218,7 @@ config ARCH_HIBERNATION_POSSIBLE
 config ARCH_SUSPEND_POSSIBLE
 	def_bool y
 	depends on ADB_PMU || PPC_EFIKA || PPC_LITE5200 || PPC_83xx || \
-		   PPC_85xx || PPC_86xx
+		   PPC_85xx || PPC_86xx || PPC_PSERIES
 
 config PPC_DCR_NATIVE
 	bool
diff -puN arch/powerpc/platforms/pseries/Makefile~powerpc_allarch_pseries_hibernation arch/powerpc/platforms/pseries/Makefile
--- linux-2.6/arch/powerpc/platforms/pseries/Makefile~powerpc_allarch_pseries_hibernation	2010-06-16 13:49:30.000000000 -0500
+++ linux-2.6-bjking1/arch/powerpc/platforms/pseries/Makefile	2010-06-16 13:49:30.000000000 -0500
@@ -26,3 +26,7 @@ obj-$(CONFIG_HCALL_STATS)	+= hvCall_inst
 obj-$(CONFIG_PHYP_DUMP)	+= phyp_dump.o
 obj-$(CONFIG_CMM)		+= cmm.o
 obj-$(CONFIG_DTL)		+= dtl.o
+
+ifeq ($(CONFIG_PPC_PSERIES),y)
+obj-$(CONFIG_SUSPEND)		+= suspend.o
+endif
diff -puN arch/powerpc/include/asm/machdep.h~powerpc_allarch_pseries_hibernation arch/powerpc/include/asm/machdep.h
--- linux-2.6/arch/powerpc/include/asm/machdep.h~powerpc_allarch_pseries_hibernation	2010-06-16 13:49:30.000000000 -0500
+++ linux-2.6-bjking1/arch/powerpc/include/asm/machdep.h	2010-06-16 13:49:30.000000000 -0500
@@ -266,6 +266,7 @@ struct machdep_calls {
 	void (*suspend_disable_irqs)(void);
 	void (*suspend_enable_irqs)(void);
 #endif
+	int (*suspend_disable_cpu)(void);
 
 #ifdef CONFIG_ARCH_CPU_PROBE_RELEASE
 	ssize_t (*cpu_probe)(const char *, size_t);
diff -puN arch/powerpc/platforms/pseries/hotplug-cpu.c~powerpc_allarch_pseries_hibernation arch/powerpc/platforms/pseries/hotplug-cpu.c
--- linux-2.6/arch/powerpc/platforms/pseries/hotplug-cpu.c~powerpc_allarch_pseries_hibernation	2010-06-16 13:49:30.000000000 -0500
+++ linux-2.6-bjking1/arch/powerpc/platforms/pseries/hotplug-cpu.c	2010-06-16 13:49:30.000000000 -0500
@@ -116,6 +116,9 @@ static void pseries_mach_cpu_die(void)
 
 	if (get_preferred_offline_state(cpu) == CPU_STATE_INACTIVE) {
 		set_cpu_current_state(cpu, CPU_STATE_INACTIVE);
+		if (ppc_md.suspend_disable_cpu)
+			ppc_md.suspend_disable_cpu();
+
 		cede_latency_hint = 2;
 
 		get_lppaca()->idle = 1;
_

^ permalink raw reply

* Re: [PATCH 06/18] spufs: use llseek in all file operations
From: Jeremy Kerr @ 2010-07-08  1:15 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: John Kacur, Frederic Weisbecker, linux-kernel, linuxppc-dev,
	Christoph Hellwig
In-Reply-To: <1278538820-1392-7-git-send-email-arnd@arndb.de>

Hi Arnd,

> The default for llseek is changing, so we need
> explicit operations everywhere.

Looks good, but:

> @@ -2151,7 +2166,7 @@ static ssize_t spufs_ibox_info_read(struct file *file, char __user *buf,
>  static const struct file_operations spufs_ibox_info_fops = {
>  	.open = spufs_info_open,
>  	.read = spufs_ibox_info_read,
> -	.llseek  = generic_file_llseek,
> +	.llseek = no_llseek,
>  };
> 
>  static ssize_t __spufs_wbox_info_read(struct spu_context *ctx,
> @@ -2194,7 +2209,7 @@ static ssize_t spufs_wbox_info_read(struct file *file, char __user *buf,
>  static const struct file_operations spufs_wbox_info_fops = {
>  	.open = spufs_info_open,
>  	.read = spufs_wbox_info_read,
> -	.llseek  = generic_file_llseek,
> +	.llseek = no_llseek,
>  };
> 

Why the change in behaviour for the mbox info files?

Cheers,


Jeremy

^ permalink raw reply

* Re: [PATCH 1/2] edac: mpc85xx: Fix MPC85xx dependency
From: Anton Vorontsov @ 2010-07-08  4:56 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Peter Tyser, linux-kernel, Dave Jiang, linuxppc-dev,
	Doug Thompson
In-Reply-To: <20100707144502.22b91374.akpm@linux-foundation.org>

On Wed, Jul 07, 2010 at 02:45:02PM -0700, Andrew Morton wrote:
> On Fri, 2 Jul 2010 16:41:11 +0400
> Anton Vorontsov <avorontsov@mvista.com> wrote:
> 
> > Since commit 5753c082f66eca5be81f6bda85c1718c5eea6ada ("powerpc/85xx:
> > Kconfig cleanup"), there is no MPC85xx Kconfig symbol anymore, so the
> > driver became non-selectable.
> 
> hm.  5753c082f66eca5be81f6bda85c1718c5eea6ada got merged into mainline
> six months ago.  How come nobody noticed?

Dunno. Well, it's hard to notice these sorts of things until
somebody actually needs this driver on MPC85xx platform. :-)

> > This patch fixes the issue by switching to PPC_85xx symbol.
> > 
> > Signed-off-by: Anton Vorontsov <avorontsov@mvista.com>
> > ---
[...]
> > -	depends on EDAC_MM_EDAC && FSL_SOC && (PPC_83xx || MPC85xx)
> > +	depends on EDAC_MM_EDAC && FSL_SOC && (PPC_83xx || PPC_85xx)
> >  	help
> >  	  Support for error detection and correction on the Freescale
> >  	  MPC8349, MPC8560, MPC8540, MPC8548
> 
> I suppose we shold scoot this into 2.6.35 and mark it for -stable
> backporting.  All very odd.

Yeah, -stable 2.6.{33,34} sounds good.

Thanks.

^ permalink raw reply

* Re: [PATCH] Add cmd64x IDE driver to default pmac32 config
From: Benjamin Herrenschmidt @ 2010-07-08  5:00 UTC (permalink / raw)
  To: lawrence rust; +Cc: linuxppc-dev
In-Reply-To: <1278181316.3232.45.camel@gagarin>

On Sat, 2010-07-03 at 20:21 +0200, lawrence rust wrote:
> The Blue/White Apple PowerMac G3 and early G4's use a cmd64x compatible
> IDE disk controller.  E.g. lspci shows...
> 
> 01:01.0 IDE interface: Silicon Image, Inc. PCI0646 (rev 07)
> 
> Unfortunately the default pmac32 configuration does not include this
> driver and so PowerMac G3's can't load a root filesystem.  This is an
> issue on a least Ubuntu since version 9.04, which uses the default
> config as a starting point.
> 
> Signed-off-by: Lawrence Rust <lawrence at softsystem.co.uk>

Shouldn't we just switch the whole thing to libata now anyways ?

Cheers,
Ben.

> diff -uprN a/arch/powerpc/configs/pmac32_defconfig b/arch/powerpc/configs/pmac32_defconfig 
> --- a/arch/powerpc/configs/pmac32_defconfig	2010-05-16 23:17:36.000000000 +0200
> +++ b/arch/powerpc/configs/pmac32_defconfig	2010-07-03 20:11:10.000000000 +0200
> @@ -738,7 +738,7 @@ CONFIG_BLK_DEV_IDEDMA_PCI=y
>  # CONFIG_BLK_DEV_AEC62XX is not set
>  # CONFIG_BLK_DEV_ALI15X3 is not set
>  # CONFIG_BLK_DEV_AMD74XX is not set
> -# CONFIG_BLK_DEV_CMD64X is not set
> +CONFIG_BLK_DEV_CMD64X=y
>  # CONFIG_BLK_DEV_TRIFLEX is not set
>  # CONFIG_BLK_DEV_CS5520 is not set
>  # CONFIG_BLK_DEV_CS5530 is not set
> 
> 
> 
> 
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev

^ permalink raw reply

* Re: [PATCH] arch/powerpc/lib/copy_32.S: Use alternate memcpy for MPC512x and MPC52xx
From: Benjamin Herrenschmidt @ 2010-07-08  5:10 UTC (permalink / raw)
  To: Steve Deiters; +Cc: linuxppc-dev
In-Reply-To: <181804936ABC2349BE503168465576460F272CA4@exchserver.basler.com>

On Tue, 2010-06-29 at 11:04 -0500, Steve Deiters wrote:
> These processors will corrupt data if accessing the local bus with
> unaligned
> addresses. This version fixes the typical case of copying from Flash on
> the
> local bus by keeping the source address always aligned.

Shouldn't this be solved by using memcpy_to/fromio ?

Cheers,
Ben.

> Signed-off-by: Steve Deiters <SteveDeiters@basler.com>
> ---
>  arch/powerpc/lib/copy_32.S |   56
> ++++++++++++++++++++++++++++++++++++++++++++
>  1 files changed, 56 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/powerpc/lib/copy_32.S b/arch/powerpc/lib/copy_32.S
> index 74a7f41..42e7df5 100644
> --- a/arch/powerpc/lib/copy_32.S
> +++ b/arch/powerpc/lib/copy_32.S
> @@ -226,6 +226,60 @@ _GLOBAL(memmove)
>  	bgt	backwards_memcpy
>  	/* fall through */
>  
> +#if defined(CONFIG_PPC_MPC512x) || defined(CONFIG_PPC_MPC52xx)
> +
> +/*
> + * Alternate memcpy for MPC512x and MPC52xx to guarantee source
> + * address is always aligned to prevent corruption issues when
> + * copying unaligned from the local bus. This only fixes the usage
> + * when copying from the local bus (e.g. Flash) and will not fix
> + * issues copying to the local bus
> + */
> +_GLOBAL(memcpy)
> +	srwi.	r7,r5,3
> +	addi	r6,r3,-4
> +	addi	r4,r4,-4
> +	beq	2f			/* if less than 8 bytes to do */
> +	andi.	r0,r4,3			/* get src word aligned */
> +	mtctr	r7
> +	bne	5f
> +1:	lwz	r7,4(r4)
> +	lwzu	r8,8(r4)
> +	stw	r7,4(r6)
> +	stwu	r8,8(r6)
> +	bdnz	1b
> +	andi.	r5,r5,7
> +2:	cmplwi	0,r5,4
> +	blt	3f
> +	andi.	r0,r4,3
> +	bne	3f
> +	lwzu	r0,4(r4)
> +	addi	r5,r5,-4
> +	stwu	r0,4(r6)
> +3:	cmpwi	0,r5,0
> +	beqlr
> +	mtctr	r5
> +	addi	r4,r4,3
> +	addi	r6,r6,3
> +4:	lbzu	r0,1(r4)
> +	stbu	r0,1(r6)
> +	bdnz	4b
> +	blr
> +5:	subfic	r0,r0,4
> +	mtctr	r0
> +6:	lbz	r7,4(r4)
> +	addi	r4,r4,1
> +	stb	r7,4(r6)
> +	addi	r6,r6,1
> +	bdnz	6b
> +	subf	r5,r0,r5
> +	rlwinm.	r7,r5,32-3,3,31
> +	beq	2b
> +	mtctr	r7
> +	b	1b
> +
> +#else
> +
>  _GLOBAL(memcpy)
>  	srwi.	r7,r5,3
>  	addi	r6,r3,-4
> @@ -267,6 +321,8 @@ _GLOBAL(memcpy)
>  	mtctr	r7
>  	b	1b
>  
> +#endif
> +
>  _GLOBAL(backwards_memcpy)
>  	rlwinm.	r7,r5,32-3,3,31		/* r0 = r5 >> 3 */
>  	add	r6,r3,r5

^ permalink raw reply

* Re: [PATCH] arch/powerpc/lib/copy_32.S: Use alternate memcpy for MPC512x and MPC52xx
From: Grant Likely @ 2010-07-08  5:38 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: Steve Deiters, linuxppc-dev
In-Reply-To: <1278565845.28659.75.camel@pasglop>

On Wed, Jul 7, 2010 at 11:10 PM, Benjamin Herrenschmidt
<benh@kernel.crashing.org> wrote:
> On Tue, 2010-06-29 at 11:04 -0500, Steve Deiters wrote:
>> These processors will corrupt data if accessing the local bus with
>> unaligned
>> addresses. This version fixes the typical case of copying from Flash on
>> the
>> local bus by keeping the source address always aligned.
>
> Shouldn't this be solved by using memcpy_to/fromio ?

Maybe.  plain memcpy() access to anything localbus-attached on the
mpc5xxx is the wrong thing to do.  memcpy_to/fromio might do the right
thing; but the caller must understand the limitations of the localplus
bus.  The byte-wise alignment that memcpy_to/fromio() does may not
work (depending on configuration).

Steve, what code is doing a memcpy from flash?

g.

^ permalink raw reply

* Re: [PATCH] Adjust arch/powerpc inline asms for recent gcc change
From: Benjamin Herrenschmidt @ 2010-07-08  6:08 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: linuxppc-dev, Paul Mackerras
In-Reply-To: <20100625095606.GG12443@tyan-ft48-01.lab.bos.redhat.com>

On Fri, 2010-06-25 at 11:56 +0200, Jakub Jelinek wrote:

>  static inline void sync(void)
> diff --git a/arch/powerpc/include/asm/atomic.h b/arch/powerpc/include/asm/atomic.h
> index b8f152e..288d8b2 100644
> --- a/arch/powerpc/include/asm/atomic.h
> +++ b/arch/powerpc/include/asm/atomic.h
> @@ -19,14 +19,14 @@ static __inline__ int atomic_read(const atomic_t *v)
>  {
>  	int t;
>  
> -	__asm__ __volatile__("lwz%U1%X1 %0,%1" : "=r"(t) : "m"(v->counter));
> +	__asm__ __volatile__("lwz%U1%X1 %0,%1" : "=r"(t) : "m<>"(v->counter));
>  
>  	return t;
>  }
>  

This gives me:

/home/benh/linux-powerpc-test/arch/powerpc/kernel/time.c: In function ‘timer_interrupt’:
/home/benh/linux-powerpc-test/arch/powerpc/include/asm/atomic.h:22: error: ‘asm’ operand has impossible constraints
make[2]: *** [arch/powerpc/kernel/time.o] Error 1

$ gcc --version
gcc (Debian 4.4.4-1) 4.4.4


Cheers,
Ben.

^ permalink raw reply

* Re: [PATCH 1/2] mtd: m25p80: Fix false-positive probing
From: Artem Bityutskiy @ 2010-07-08  5:57 UTC (permalink / raw)
  To: Anton Vorontsov
  Cc: David Brownell, Mike Frysinger, Barry Song, linux-kernel,
	linuxppc-dev, linux-mtd, uclinux-dist-devel, Andrew Morton,
	David Woodhouse
In-Reply-To: <20100622165734.GA20699@oksana.dev.rtsoft.ru>

On Tue, 2010-06-22 at 20:57 +0400, Anton Vorontsov wrote:
> Since commit 18c6182bae0acca220ed6611f741034d563cd19f ("Rework
> probing/JEDEC code"), m25p80 driver successfully registers chips
> even if JEDEC probing fails.
> 
> This was needed to support non-JEDEC flashes. Though, it appears
> that some platforms (e.g. blackfin bf533 stamp[1]) used the old
> behavior to detect if there's any flash connected, so the driver
> have to fail on JEDEC probing errors.
> 
> This patch restores the old behavior for JEDEC flashes, and adds
> "-nonjedec" SPI device IDs for M25Pxx flashes, so that the kernel
> still supports non-JEDEC flashes.
> 
> [1] http://blackfin.uclinux.org/gf/project/uclinux-dist/tracker/?action=TrackerItemEdit&tracker_item_id=5975
> 
> Reported-by: Mingquan Pan
> Reported-by: Barry Song <21cnbao@gmail.com>
> Signed-off-by: Anton Vorontsov <avorontsov@mvista.com>
> ---

Pushed both patches to my l2-mtd-2.6.git / dunno, added Mike's ack.

-- 
Best Regards,
Artem Bityutskiy (Артём Битюцкий)

^ permalink raw reply

* Re: [PATCH] Add cmd64x IDE driver to default pmac32 config
From: lawrence rust @ 2010-07-08  6:18 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: linuxppc-dev
In-Reply-To: <1278565221.28659.74.camel@pasglop>

On Thu, 2010-07-08 at 15:00 +1000, Benjamin Herrenschmidt wrote:
> On Sat, 2010-07-03 at 20:21 +0200, lawrence rust wrote:
> > The Blue/White Apple PowerMac G3 and early G4's use a cmd64x compatible
> > IDE disk controller.  E.g. lspci shows...
> > 
> > 01:01.0 IDE interface: Silicon Image, Inc. PCI0646 (rev 07)
> > 
> > Unfortunately the default pmac32 configuration does not include this
> > driver and so PowerMac G3's can't load a root filesystem.  This is an
> > issue on a least Ubuntu since version 9.04, which uses the default
> > config as a starting point.
> > 
> > Signed-off-by: Lawrence Rust <lawrence at softsystem.co.uk>
> 
> Shouldn't we just switch the whole thing to libata now anyways ?

Sure. it would be preferable but unfortunately the PowerMac on-board IDE
controller (CONFIG_BLK_DEV_IDE_PMAC), used for the DVD drive on B/W
G3's, doesn't have a PATA equivalent.  So it's pragmatic (until the IDE
code is removed) to use the IDE cmd64x driver to minimise kernel code
size.

A minor correction to my previous post, the first version of Ubuntu to
suffer from this problem was 9.10.

-- Lawrence
> 
> Cheers,
> Ben.
> 
> > diff -uprN a/arch/powerpc/configs/pmac32_defconfig b/arch/powerpc/configs/pmac32_defconfig 
> > --- a/arch/powerpc/configs/pmac32_defconfig	2010-05-16 23:17:36.000000000 +0200
> > +++ b/arch/powerpc/configs/pmac32_defconfig	2010-07-03 20:11:10.000000000 +0200
> > @@ -738,7 +738,7 @@ CONFIG_BLK_DEV_IDEDMA_PCI=y
> >  # CONFIG_BLK_DEV_AEC62XX is not set
> >  # CONFIG_BLK_DEV_ALI15X3 is not set
> >  # CONFIG_BLK_DEV_AMD74XX is not set
> > -# CONFIG_BLK_DEV_CMD64X is not set
> > +CONFIG_BLK_DEV_CMD64X=y
> >  # CONFIG_BLK_DEV_TRIFLEX is not set
> >  # CONFIG_BLK_DEV_CS5520 is not set
> >  # CONFIG_BLK_DEV_CS5530 is not set
> > 
> > 
> > 
> > 
> > _______________________________________________
> > Linuxppc-dev mailing list
> > Linuxppc-dev@lists.ozlabs.org
> > https://lists.ozlabs.org/listinfo/linuxppc-dev
> 
> 


-- 
-- Lawrence Rust

^ permalink raw reply

* Re: [PATCH] Add cmd64x IDE driver to default pmac32 config
From: Benjamin Herrenschmidt @ 2010-07-08  6:30 UTC (permalink / raw)
  To: lawrence rust; +Cc: linuxppc-dev
In-Reply-To: <1278569907.1411.19.camel@gagarin>

On Thu, 2010-07-08 at 08:18 +0200, lawrence rust wrote:
> 
> Sure. it would be preferable but unfortunately the PowerMac on-board IDE
> controller (CONFIG_BLK_DEV_IDE_PMAC), used for the DVD drive on B/W
> G3's, doesn't have a PATA equivalent.  So it's pragmatic (until the IDE
> code is removed) to use the IDE cmd64x driver to minimise kernel code
> size.

Sure it does nowadays: drivers/ata/pata_macio.c :-)

I merged that upstream in december last year, so it didn't make 2.6.32
which your distro probably uses, but it is in .33 and later.

> A minor correction to my previous post, the first version of Ubuntu to
> suffer from this problem was 9.10. 

Cheers,
Ben.

^ permalink raw reply

* [PATCH v2] powerpc/kexec: Switch to a static PACA on the way out
From: Matt Evans @ 2010-07-08  7:55 UTC (permalink / raw)
  To: Milton Miller, linuxppc-dev

With dynamic PACAs, the kexecing CPU's PACA won't lie within the kernel
static data and there is a chance that something may stomp it when preparing
to kexec.  This patch switches this final CPU to a static PACA just before
we pull the switch.

Signed-off-by: Matt Evans <matt@ozlabs.org>
---
v2:	Changes from Milton's review:
	- Use setup_paca() and move from setup_64.c,
	- SLB cache inval. not required,
	- Adjust 'paca' (oops..), and
	- Poison data_offset/per_cpu_offset

 arch/powerpc/include/asm/paca.h        |    2 +-
 arch/powerpc/kernel/machine_kexec_64.c |   20 ++++++++++++++++++++
 arch/powerpc/kernel/paca.c             |   10 ++++++++++
 arch/powerpc/kernel/setup_64.c         |   10 ----------
 4 files changed, 31 insertions(+), 11 deletions(-)

diff --git a/arch/powerpc/include/asm/paca.h b/arch/powerpc/include/asm/paca.h
index 8ce7963..1ff6662 100644
--- a/arch/powerpc/include/asm/paca.h
+++ b/arch/powerpc/include/asm/paca.h
@@ -146,7 +146,7 @@ struct paca_struct {
 extern struct paca_struct *paca;
 extern __initdata struct paca_struct boot_paca;
 extern void initialise_paca(struct paca_struct *new_paca, int cpu);
-
+extern void setup_paca(struct paca_struct *new_paca);
 extern void allocate_pacas(void);
 extern void free_unused_pacas(void);
 
diff --git a/arch/powerpc/kernel/machine_kexec_64.c b/arch/powerpc/kernel/machine_kexec_64.c
index 26f9900..c4d0123 100644
--- a/arch/powerpc/kernel/machine_kexec_64.c
+++ b/arch/powerpc/kernel/machine_kexec_64.c
@@ -273,6 +273,12 @@ static void kexec_prepare_cpus(void)
 static union thread_union kexec_stack __init_task_data =
 	{ };
 
+/*
+ * For similar reasons to the stack above, the kexecing CPU needs to be on a
+ * static PACA; we switch to kexec_paca.
+ */
+struct paca_struct kexec_paca;
+
 /* Our assembly helper, in kexec_stub.S */
 extern NORET_TYPE void kexec_sequence(void *newstack, unsigned long start,
 					void *image, void *control,
@@ -300,6 +306,20 @@ void default_machine_kexec(struct kimage *image)
 	kexec_stack.thread_info.task = current_thread_info()->task;
 	kexec_stack.thread_info.flags = 0;
 
+	/* We need a static PACA, too; copy this CPU's PACA over and switch to
+	 * it.  Also poison per_cpu_offset to catch anyone using non-static
+	 * data.
+	 */
+	memcpy(&kexec_paca, get_paca(), sizeof(struct paca_struct));
+	kexec_paca.data_offset = 0xedeaddeadeeeeeeeUL;
+	paca = (struct paca_struct *)RELOC_HIDE(&kexec_paca, 0) -
+		kexec_paca.paca_index;
+	setup_paca(&kexec_paca);
+
+	/* XXX: If anyone does 'dynamic lppacas' this will also need to be
+	 * switched to a static version!
+	 */
+
 	/* Some things are best done in assembly.  Finding globals with
 	 * a toc is easier in C, so pass in what we can.
 	 */
diff --git a/arch/powerpc/kernel/paca.c b/arch/powerpc/kernel/paca.c
index f88acf0..3db8d64 100644
--- a/arch/powerpc/kernel/paca.c
+++ b/arch/powerpc/kernel/paca.c
@@ -105,6 +105,16 @@ void __init initialise_paca(struct paca_struct *new_paca, int cpu)
 #endif /* CONFIG_PPC_STD_MMU_64 */
 }
 
+/* Put the paca pointer into r13 and SPRG_PACA */
+void setup_paca(struct paca_struct *new_paca)
+{
+	local_paca = new_paca;
+	mtspr(SPRN_SPRG_PACA, local_paca);
+#ifdef CONFIG_PPC_BOOK3E
+	mtspr(SPRN_SPRG_TLB_EXFRAME, local_paca->extlb);
+#endif
+}
+
 static int __initdata paca_size;
 
 void __init allocate_pacas(void)
diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c
index f3fb5a7..6efbed4 100644
--- a/arch/powerpc/kernel/setup_64.c
+++ b/arch/powerpc/kernel/setup_64.c
@@ -142,16 +142,6 @@ early_param("smt-enabled", early_smt_enabled);
 #define check_smt_enabled()
 #endif /* CONFIG_SMP */
 
-/* Put the paca pointer into r13 and SPRG_PACA */
-static void __init setup_paca(struct paca_struct *new_paca)
-{
-	local_paca = new_paca;
-	mtspr(SPRN_SPRG_PACA, local_paca);
-#ifdef CONFIG_PPC_BOOK3E
-	mtspr(SPRN_SPRG_TLB_EXFRAME, local_paca->extlb);
-#endif
-}
-
 /*
  * Early initialization entry point. This is called by head.S
  * with MMU translation disabled. We rely on the "feature" of
-- 
1.6.3.3

^ permalink raw reply related

* [git pull] Please pull powerpc.git merge branch
From: Benjamin Herrenschmidt @ 2010-07-08  8:19 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: linuxppc-dev list, Andrew Morton, Linux Kernel list

Hi Linus !

Here are a few powerpc nits and bits still for 2.6.35. Mostly simple/trivial
stuff and some gcc-4.5 related fixes.

Thanks !

Cheers,
Ben.

The following changes since commit 2aa72f612144a0a7d4b0b22ae7c122692ac6a013:
  Linus Torvalds (1):
        Merge git://git.kernel.org/.../davem/net-2.6

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc.git merge

Anton Blanchard (1):
      powerpc: Linux cannot run with 0 cores

Denis Kirjanov (1):
      powerpc/iseries: Fix possible null pointer dereference in iSeries_pcibios_fixup_resources

Johannes Berg (1):
      powerpc: Fix logic error in fixup_irqs

Matt Evans (1):
      powerpc/perf_event: Fix for power_pmu_disable()

Paul E. McKenney (1):
      powerpc: Fix default_machine_crash_shutdown #ifdef botch

Sam Ravnborg (1):
      powerpc: Fix userspace build of ptrace.h

Stephen Rothwell (3):
      powerpc: Fix module building for gcc 4.5 and 64 bit
      powerpc: Fix compile errors in prom_init_check for gcc 4.5
      powerpc: Fix feature-fixup tests for gcc 4.5

Yang Li (1):
      powerpc: Disable SPARSE_IRQ by default

 arch/powerpc/Kconfig                   |    4 +-
 arch/powerpc/Makefile                  |    4 +-
 arch/powerpc/include/asm/ptrace.h      |   32 ++++-----
 arch/powerpc/kernel/crash.c            |    2 +-
 arch/powerpc/kernel/irq.c              |    5 +-
 arch/powerpc/kernel/perf_event.c       |    5 +-
 arch/powerpc/kernel/prom_init.c        |    2 +-
 arch/powerpc/kernel/prom_init_check.sh |    6 ++
 arch/powerpc/lib/Makefile              |    4 +-
 arch/powerpc/lib/crtsavres.S           |  129 ++++++++++++++++++++++++++++++++
 arch/powerpc/lib/feature-fixups.c      |   17 ++--
 arch/powerpc/platforms/iseries/pci.c   |    6 +-
 scripts/mod/modpost.c                  |    5 +
 13 files changed, 184 insertions(+), 37 deletions(-)
 

^ permalink raw reply

* Re: [PATCH] Add cmd64x IDE driver to default pmac32 config
From: lawrence rust @ 2010-07-08  9:01 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: linuxppc-dev
In-Reply-To: <1278570620.28659.79.camel@pasglop>

On Thu, 2010-07-08 at 16:30 +1000, Benjamin Herrenschmidt wrote:
> On Thu, 2010-07-08 at 08:18 +0200, lawrence rust wrote:
> > 
> > Sure. it would be preferable but unfortunately the PowerMac on-board IDE
> > controller (CONFIG_BLK_DEV_IDE_PMAC), used for the DVD drive on B/W
> > G3's, doesn't have a PATA equivalent.  So it's pragmatic (until the IDE
> > code is removed) to use the IDE cmd64x driver to minimise kernel code
> > size.
> 
> Sure it does nowadays: drivers/ata/pata_macio.c :-)
> 
> I merged that upstream in december last year, so it didn't make 2.6.32
> which your distro probably uses, but it is in .33 and later.

OK I see that - good news.  However, for the moment I believe that it's
safer to stay with IDE.  It's the smallest of changes but the wholesale
move to libata could well break numerous system install scripts - e.g.
for yaboot.

-- Lawrence

^ permalink raw reply

* Re: [1/2] powerpc/crashdump: Fix issues with kexec and 36bit physical addr
From: Milton Miller @ 2010-07-08  9:07 UTC (permalink / raw)
  To: Matthew McClintock; +Cc: kumar.gala, linuxppc-dev
In-Reply-To: <1278535881-6463-1-git-send-email-msm@freescale.com>

On Wed, 07 Jul 2010 around 10:51:20 -0000 Matthew McClintock wrote:
> 
> Fix sizes of variables so correct values are exported via /proc.
> Cast variable in comparison to avoid compiler error.
> 
> Signed-off-by: Matthew McClintock <msm@freescale.com>
> 
>  
> -	csize = min(csize, PAGE_SIZE);
> +	csize = min(csize, (size_t)PAGE_SIZE);

no use min_t

>  
> -	if (pfn < max_pfn) {
> +	if ((min_low_pfn < pfn) && (pfn < max_pfn)) {
>  		vaddr = __va(pfn << PAGE_SHIFT);
>  		csize = copy_oldmem_vaddr(vaddr, buf, csize, offset, userbuf);
>  	} else {
> diff --git a/arch/powerpc/kernel/machine_kexec.c b/arch/powerpc/kernel/machine_kexec.c
> index bb3d893..ec7f054 100644
> --- a/arch/powerpc/kernel/machine_kexec.c
> +++ b/arch/powerpc/kernel/machine_kexec.c
> @@ -145,6 +145,7 @@ int overlaps_crashkernel(unsigned long start, unsigned long size)
>  
>  /* Values we need to export to the second kernel via the device tree. */
>  static unsigned long kernel_end;
> +static unsigned long crashk_start;
>  static unsigned long crashk_size;
>  
>  static struct property kernel_end_prop = {
> @@ -156,7 +157,7 @@ static struct property kernel_end_prop = {
>  static struct property crashk_base_prop = {
>  	.name = "linux,crashkernel-base",
>  	.length = sizeof(unsigned long),
> -	.value = &crashk_res.start,
> +	.value = &crashk_start,
>  };
>  

This is wrong, its truncating the start and size.

Change the variables to be physaddr_t and the length to be sizeof(physaddr_t).

Since these properites only contain one variable, the number of cells
can be inferred from the property size like we do for reading the initrd-size.

Technically they should be an array of be32 but we can make that a comment.

By the way, why does 32 bit care about the running kernel's size? aka
linux,kernel-end?  64 bit book 3S needs it because we use mmu hooks
to copy the pages to their destination, but I thought ppc32 was using
a relocatable copy routine.  Are we missing the code to create
temp ref tlbs on the fly for book 3E?

>  static struct property crashk_size_prop = {
> @@ -180,6 +181,7 @@ static void __init export_crashk_values(struct device_node *node)
>  		prom_remove_property(node, prop);
>  
>  	if (crashk_res.start != 0) {
> +		crashk_start = crashk_res.start;
>  		prom_add_property(node, &crashk_base_prop);
>  		crashk_size = crashk_res.end - crashk_res.start + 1;
>  		prom_add_property(node, &crashk_size_prop);

I guess we use the reuse of the resources varables, but such is
common code vs userspace.

milton

^ permalink raw reply

* Re: [PATCH] Add cmd64x IDE driver to default pmac32 config
From: Benjamin Herrenschmidt @ 2010-07-08 10:49 UTC (permalink / raw)
  To: lawrence rust; +Cc: linuxppc-dev
In-Reply-To: <1278579667.2850.5.camel@gagarin>

On Thu, 2010-07-08 at 11:01 +0200, lawrence rust wrote:
> On Thu, 2010-07-08 at 16:30 +1000, Benjamin Herrenschmidt wrote:
> > On Thu, 2010-07-08 at 08:18 +0200, lawrence rust wrote:
> > > 
> > > Sure. it would be preferable but unfortunately the PowerMac on-board IDE
> > > controller (CONFIG_BLK_DEV_IDE_PMAC), used for the DVD drive on B/W
> > > G3's, doesn't have a PATA equivalent.  So it's pragmatic (until the IDE
> > > code is removed) to use the IDE cmd64x driver to minimise kernel code
> > > size.
> > 
> > Sure it does nowadays: drivers/ata/pata_macio.c :-)
> > 
> > I merged that upstream in december last year, so it didn't make 2.6.32
> > which your distro probably uses, but it is in .33 and later.
> 
> OK I see that - good news.  However, for the moment I believe that it's
> safer to stay with IDE.  It's the smallest of changes but the wholesale
> move to libata could well break numerous system install scripts - e.g.
> for yaboot.

Well, distros have moved over mostly... I don't think keeping the
defaults to the old stuff upstream is going to help getting things like
yaboot fixed. I'll talk to Tony see what the situation there is
tomorrow, but I'd rather fix yaboot and switch the default over.

Ben.

^ permalink raw reply


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