* Re: [PATCH] Audit: push audit success and retcode into arch ptrace.h
From: Eric Paris @ 2011-06-02 23:06 UTC (permalink / raw)
To: Richard Weinberger
Cc: linux-mips, linux-ia64, linux-sh, heiko.carstens, oleg, paulus,
hpa, sparclinux, linux-s390, x86, mingo, fenghua.yu,
user-mode-linux-devel, microblaze-uclinux, jdike, viro, tglx,
monstr, tony.luck, linux-kernel, ralf, lethal, schwidefsky,
linux390, akpm, linuxppc-dev, davem
In-Reply-To: <201106030032.17398.richard@nod.at>
On 06/02/2011 06:32 PM, Richard Weinberger wrote:
> Am Donnerstag 02 Juni 2011, 23:04:58 schrieb Eric Paris:
>> b/arch/um/sys-i386/shared/sysdep/ptrace.h index d50e62e..ef5c310 100644
>> --- a/arch/um/sys-i386/shared/sysdep/ptrace.h
>> +++ b/arch/um/sys-i386/shared/sysdep/ptrace.h
>> @@ -162,6 +162,7 @@ struct syscall_args {
>> #define UPT_ORIG_SYSCALL(r) UPT_EAX(r)
>> #define UPT_SYSCALL_NR(r) UPT_ORIG_EAX(r)
>> #define UPT_SYSCALL_RET(r) UPT_EAX(r)
>> +#define regs_return_value UPT_SYSCALL_RET
>
> This does not work at all.
> UPT_SYSCALL_RET expects something of type struct uml_pt_regs.
>
> #define regs_return_value REGS_EAX
> Would be correct. (For x86_64 it needs to be REGS_RAX)
>
> But there seems to be another problem.
> Why is pt_regs of type void *?
I was stupid and used #define's instead of static inlines. Sorry. I
wonder how many other arches I got that wrong, i'm sure others....
The code in arch/um/kernel/ptrace.c::syscall_trace() appeared to have a
uml_pt_regs instead of just pt_regs. Which was why audit_syscall_exit()
takes a void * instead of a pt_regs. We pass that right back to
regs_return_value(). I believe the correct code should be:
static inline long regs_return_value(struct uml_pt_regs *r)
{
return UPT_SYSCALL_RET(r);
}
>
> gcc complains:
> In file included from include/linux/fsnotify.h:15:0,
> from include/linux/security.h:26,
> from init/main.c:32:
> include/linux/audit.h: In function ‘audit_syscall_exit’:
> include/linux/audit.h:440:17: warning: dereferencing ‘void *’ pointer
> include/linux/audit.h:440:3: error: invalid use of void expression
> include/linux/audit.h:441:21: warning: dereferencing ‘void *’ pointer
> include/linux/audit.h:441:21: error: void value not ignored as it ought to be
>
> Thanks,
> //richard
^ permalink raw reply
* Re: [PATCH] Audit: push audit success and retcode into arch ptrace.h
From: Eric Paris @ 2011-06-02 23:07 UTC (permalink / raw)
To: Tony Luck
Cc: linux-mips, linux-ia64, linux-sh, heiko.carstens, oleg, paulus,
hpa, sparclinux, linux-s390, Richard Weinberger, x86, mingo,
fenghua.yu, user-mode-linux-devel, microblaze-uclinux, jdike,
viro, tglx, monstr, linux-kernel, ralf, lethal, schwidefsky,
linux390, akpm, linuxppc-dev, davem
In-Reply-To: <BANLkTik9kCs_06=7HKo44cWqpS0zB9fr+A@mail.gmail.com>
On 06/02/2011 07:00 PM, Tony Luck wrote:
>> But there seems to be another problem.
>> Why is pt_regs of type void *?
>>
>> gcc complains:
>> In file included from include/linux/fsnotify.h:15:0,
>> from include/linux/security.h:26,
>> from init/main.c:32:
>> include/linux/audit.h: In function ‘audit_syscall_exit’:
>> include/linux/audit.h:440:17: warning: dereferencing ‘void *’ pointer
>> include/linux/audit.h:440:3: error: invalid use of void expression
>> include/linux/audit.h:441:21: warning: dereferencing ‘void *’ pointer
>> include/linux/audit.h:441:21: error: void value not ignored as it ought to be
>
> Perhaps same issue on ia64 - but symptoms are different:
>
> CC crypto/cipher.o
> In file included from include/linux/fsnotify.h:15,
> from include/linux/security.h:26,
> from init/do_mounts.c:8:
> include/linux/audit.h: In function ‘audit_syscall_exit’:
> include/linux/audit.h:440: warning: dereferencing ‘void *’ pointer
> include/linux/audit.h:440: error: request for member ‘r10’ in
> something not a structure or union
> include/linux/audit.h:441: error: request for member ‘r10’ in
> something not a structure or union
> include/linux/audit.h:441: error: request for member ‘r8’ in something
> not a structure or union
> include/linux/audit.h:441: error: request for member ‘r8’ in something
> not a structure or union
> include/linux/audit.h:441: error: expected ‘;’ before ‘}’ token
> include/linux/audit.h:441: error: void value not ignored as it ought to be
I think it is the same problem. I'll redo the patch with typed static
inlines instead of #defines and all of this should hopefully work out.
-Eric
^ permalink raw reply
* Re: PROBLEM: 2.6.39 doesn’t boot on POWER MAC
From: Benjamin Herrenschmidt @ 2011-06-03 2:41 UTC (permalink / raw)
To: Giuliano Pochini; +Cc: linuxppc-dev, Andrey Gusev, paulus
In-Reply-To: <20110603000012.4ce5c45f@Jay>
On Fri, 2011-06-03 at 00:00 +0200, Giuliano Pochini wrote:
> On Sat, 28 May 2011 11:55:14 +0400
> Andrey Gusev <ronne@list.ru> wrote:
>
> > Hi!
> > A kernel 2.6.39 doesn't boot on my POWER MAC G4.
>
> Same problem with my dual-G4 MDD. A few more infos:
> The machine hangs just after the message "Returning from prom_init" (still
> in the OF screen).
> The kernel works fine with the option maxcpus=1, but it locks up as soon as
> I try to enable the second CPU with echo 1 > /sys.../online.
I just verified that current upstream 3.0-rc1+ does boot fine.
Cheers,
Ben.
^ permalink raw reply
* [PATCH] powerpc/85xx: fix race bug of calling request_irq after enable elbc interrupts
From: Shaohui Xie @ 2011-06-03 2:45 UTC (permalink / raw)
To: linuxppc-dev; +Cc: B07421, kumar.gala, Shaohui Xie
Signed-off-by: Shaohui Xie <Shaohui.Xie@freescale.com>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
---
arch/powerpc/sysdev/fsl_lbc.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/arch/powerpc/sysdev/fsl_lbc.c b/arch/powerpc/sysdev/fsl_lbc.c
index e0292c3..9e7cb19 100644
--- a/arch/powerpc/sysdev/fsl_lbc.c
+++ b/arch/powerpc/sysdev/fsl_lbc.c
@@ -200,9 +200,6 @@ static int __devinit fsl_lbc_ctrl_init(struct fsl_lbc_ctrl *ctrl,
out_be32(&lbc->lteccr, LTECCR_CLEAR);
out_be32(&lbc->ltedr, LTEDR_ENABLE);
- /* Enable interrupts for any detected events */
- out_be32(&lbc->lteir, LTEIR_ENABLE);
-
/* Set the monitor timeout value to the maximum for erratum A001 */
if (of_device_is_compatible(node, "fsl,elbc"))
clrsetbits_be32(&lbc->lbcr, LBCR_BMT, LBCR_BMTPS);
@@ -340,6 +337,9 @@ static int __devinit fsl_lbc_ctrl_probe(struct of_device *ofdev,
goto err;
}
+ /* Enable interrupts for any detected events */
+ out_be32(&fsl_lbc_ctrl_dev->regs->lteir, LTEIR_ENABLE);
+
return 0;
err:
--
1.6.4
^ permalink raw reply related
* Re: PROBLEM: 2.6.39 doesn’t boot on POWER MAC
From: Benjamin Herrenschmidt @ 2011-06-03 3:10 UTC (permalink / raw)
To: stable; +Cc: linuxppc-dev, Andrey Gusev, paulus
In-Reply-To: <1307068891.23876.2.camel@pasglop>
On Fri, 2011-06-03 at 12:41 +1000, Benjamin Herrenschmidt wrote:
> On Fri, 2011-06-03 at 00:00 +0200, Giuliano Pochini wrote:
> > On Sat, 28 May 2011 11:55:14 +0400
> > Andrey Gusev <ronne@list.ru> wrote:
> >
> > > Hi!
> > > A kernel 2.6.39 doesn't boot on my POWER MAC G4.
> >
> > Same problem with my dual-G4 MDD. A few more infos:
> > The machine hangs just after the message "Returning from prom_init" (still
> > in the OF screen).
> > The kernel works fine with the option maxcpus=1, but it locks up as soon as
> > I try to enable the second CPU with echo 1 > /sys.../online.
>
> I just verified that current upstream 3.0-rc1+ does boot fine.
The fix is:
c560bbceaf6b06e52f1ef20131b76a3fdc0a2c19
powerpc/4xx: Fix regression in SMP on 476
It looks like the regression wasn't specific to 476 but to all ppc
32-bit SMP setups. The bugs is specific to 2.6.39.
Greg, it should cherry-pick as-is but here's a copy in case you need it.
Cheers,
Ben.
>From c560bbceaf6b06e52f1ef20131b76a3fdc0a2c19 Mon Sep 17 00:00:00 2001
From: kerstin jonsson <kerstin.jonsson@ericsson.com>
Date: Tue, 17 May 2011 23:57:11 +0000
Subject: [PATCH] powerpc/4xx: Fix regression in SMP on 476
commit c56e58537d504706954a06570b4034c04e5b7500 breaks SMP support in PPC_47x chip.
secondary_ti must be set to current thread info before callin kick_cpu or else
start_secondary_47x will jump into void when trying to return to c-code.
In the current setup secondary_ti is initialized before the CPU idle task is started
and only the boot core will start. I am not sure this is the correct solution, but it
makes SMP possible in my chip.
Note! The HOTPLUG support probably need some fixing to, There is no trampoline code
available in head_44x.S - start_secondary_resume?
Signed-off-by: Kerstin Jonsson <kerstin.jonsson@ericsson.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---
arch/powerpc/kernel/smp.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
index cbdbb14..f2dcab7 100644
--- a/arch/powerpc/kernel/smp.c
+++ b/arch/powerpc/kernel/smp.c
@@ -410,8 +410,6 @@ int __cpuinit __cpu_up(unsigned int cpu)
{
int rc, c;
- secondary_ti = current_set[cpu];
-
if (smp_ops == NULL ||
(smp_ops->cpu_bootable && !smp_ops->cpu_bootable(cpu)))
return -EINVAL;
@@ -421,6 +419,8 @@ int __cpuinit __cpu_up(unsigned int cpu)
if (rc)
return rc;
+ secondary_ti = current_set[cpu];
+
/* Make sure callin-map entry is 0 (can be leftover a CPU
* hotplug
*/
^ permalink raw reply related
* Re: [stable] PROBLEM: 2.6.39 doesn’t boot on POWER MAC
From: Greg KH @ 2011-06-03 5:53 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: paulus, Andrey Gusev, linuxppc-dev, stable
In-Reply-To: <1307070645.23876.9.camel@pasglop>
On Fri, Jun 03, 2011 at 01:10:45PM +1000, Benjamin Herrenschmidt wrote:
> On Fri, 2011-06-03 at 12:41 +1000, Benjamin Herrenschmidt wrote:
> > On Fri, 2011-06-03 at 00:00 +0200, Giuliano Pochini wrote:
> > > On Sat, 28 May 2011 11:55:14 +0400
> > > Andrey Gusev <ronne@list.ru> wrote:
> > >
> > > > Hi!
> > > > A kernel 2.6.39 doesn't boot on my POWER MAC G4.
> > >
> > > Same problem with my dual-G4 MDD. A few more infos:
> > > The machine hangs just after the message "Returning from prom_init" (still
> > > in the OF screen).
> > > The kernel works fine with the option maxcpus=1, but it locks up as soon as
> > > I try to enable the second CPU with echo 1 > /sys.../online.
> >
> > I just verified that current upstream 3.0-rc1+ does boot fine.
>
> The fix is:
>
> c560bbceaf6b06e52f1ef20131b76a3fdc0a2c19
> powerpc/4xx: Fix regression in SMP on 476
>
> It looks like the regression wasn't specific to 476 but to all ppc
> 32-bit SMP setups. The bugs is specific to 2.6.39.
>
> Greg, it should cherry-pick as-is but here's a copy in case you need it.
Now applied, thanks.
greg k-h
^ permalink raw reply
* Re: [stable] [PATCH] 2.6.39 powerpc: Fix 32-bit SMP build
From: Greg KH @ 2011-06-03 5:56 UTC (permalink / raw)
To: Josh Boyer; +Cc: linuxppc-dev, stable
In-Reply-To: <20110530122621.GD2557@zod.rchland.ibm.com>
On Mon, May 30, 2011 at 08:26:21AM -0400, Josh Boyer wrote:
> Backport upstream commit 6de06f313a65d0ec
>
> Commit fa3f82c8bb7acb ("powerpc/smp: soft-replugged CPUs must go back to
> start_secondary") introduced start_secondary_resume to head_32.S, however
> it uses a 64-bit instruction which is not valid on 32-bit platforms. Use
> 'stw' instead.
>
> CC: stable@kernel.org
> Signed-off-by: Josh Boyer <jwboyer@linux.vnet.ibm.com>
This doesn't apply either:
patching file arch/powerpc/kernel/head_32.S
Hunk #1 FAILED at 896.
1 out of 1 hunk FAILED -- saving rejects to file arch/powerpc/kernel/head_32.S.rej
Please send something that at least applies, and hopefully builds...
greg k-h
^ permalink raw reply
* [PATCH] powerpc/85xx: Add P1010RDB board support
From: Prabhakar Kushwaha @ 2011-06-03 6:28 UTC (permalink / raw)
To: linuxppc-dev, devicetree-discuss
Cc: meet2prabhu, Poonam Aggrwal, Prabhakar Kushwaha
P1010RDB Overview
-----------------
1Gbyte DDR3 (on board DDR)
32Mbyte 16bit NOR flash
32Mbyte SLC NAND Flash
256 Kbit M24256 I2C EEPROM
128 Mbit SPI Flash memory
I2C Board 128x8 bit memory
SD/MMC connector to interface with the SD memory card
2 SATA interface
1 internal SATA connect to 2.5. 160G SATA2 HDD
1 eSATA connector to rear panel
USB 2.0
x1 USB 2.0 port: connected via a UTMI PHY to Mini-AB interface.
x1 USB 2.0 port: directly connected to Mini-AB interface Ethernet
eTSEC1: Connected to RGMII PHY VSC8641XKO
eTSEC2: Connected to SGMII PHY VSC8221
eTSEC3: Connected to SGMII PHY VSC8221 eCAN
Two DB-9 female connectors for Field bus interface UART
DUART interface: supports two UARTs up to 115200 bps for console display
Signed-off-by: Poonam Aggrwal <poonam.aggrwal@freescale.com>
Signed-off-by: Prabhakar Kushwaha <prabhakar@freescale.com>
---
Based upon http://git.kernel.org/pub/scm/linux/kernel/git/galak/powerpc.git (branch next)
arch/powerpc/boot/dts/p1010rdb.dts | 280 ++++++++++++++++++++++++
arch/powerpc/boot/dts/p1010si.dtsi | 376 ++++++++++++++++++++++++++++++++
arch/powerpc/configs/mpc85xx_defconfig | 1 +
arch/powerpc/platforms/85xx/Kconfig | 10 +
arch/powerpc/platforms/85xx/Makefile | 1 +
arch/powerpc/platforms/85xx/p1010rdb.c | 122 +++++++++++
6 files changed, 790 insertions(+), 0 deletions(-)
create mode 100644 arch/powerpc/boot/dts/p1010rdb.dts
create mode 100644 arch/powerpc/boot/dts/p1010si.dtsi
create mode 100644 arch/powerpc/platforms/85xx/p1010rdb.c
diff --git a/arch/powerpc/boot/dts/p1010rdb.dts b/arch/powerpc/boot/dts/p1010rdb.dts
new file mode 100644
index 0000000..6b33b73
--- /dev/null
+++ b/arch/powerpc/boot/dts/p1010rdb.dts
@@ -0,0 +1,280 @@
+/*
+ * P1010 RDB Device Tree Source
+ *
+ * Copyright 2011 Freescale Semiconductor Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ */
+
+/include/ "p1010si.dtsi"
+
+/ {
+ model = "fsl,P1010RDB";
+ compatible = "fsl,P1010RDB";
+
+ aliases {
+ serial0 = &serial0;
+ serial1 = &serial1;
+ ethernet0 = &enet0;
+ ethernet1 = &enet1;
+ ethernet2 = &enet2;
+ pci0 = &pci0;
+ pci1 = &pci1;
+ };
+
+ memory {
+ device_type = "memory";
+ };
+
+ ifc@ffe1e000 {
+ /* NOR, NAND Flashes and CPLD on board */
+ ranges = <0x0 0x0 0x0 0xee000000 0x02000000
+ 0x1 0x0 0x0 0xff800000 0x00010000
+ 0x3 0x0 0x0 0xffb00000 0x00000020>;
+
+ nor@0,0 {
+ #address-cells = <1>;
+ #size-cells = <1>;
+ compatible = "cfi-flash";
+ reg = <0x0 0x0 0x2000000>;
+ bank-width = <2>;
+ device-width = <1>;
+
+ partition@40000 {
+ /* 256KB for DTB Image */
+ reg = <0x00040000 0x00040000>;
+ label = "NOR DTB Image";
+ };
+
+ partition@80000 {
+ /* 7 MB for Linux Kernel Image */
+ reg = <0x00080000 0x00700000>;
+ label = "NOR Linux Kernel Image";
+ };
+
+ partition@800000 {
+ /* 20MB for JFFS2 based Root file System */
+ reg = <0x00800000 0x01400000>;
+ label = "NOR JFFS2 Root File System";
+ };
+
+ partition@1f00000 {
+ /* This location must not be altered */
+ /* 512KB for u-boot Bootloader Image */
+ /* 512KB for u-boot Environment Variables */
+ reg = <0x01f00000 0x00100000>;
+ label = "NOR U-Boot Image";
+ read-only;
+ };
+ };
+
+ nand@1,0 {
+ #address-cells = <1>;
+ #size-cells = <1>;
+ compatible = "fsl,ifc-nand";
+ reg = <0x1 0x0 0x10000>;
+
+ partition@0 {
+ /* This location must not be altered */
+ /* 1MB for u-boot Bootloader Image */
+ reg = <0x0 0x00100000>;
+ label = "NAND U-Boot Image";
+ read-only;
+ };
+
+ partition@100000 {
+ /* 1MB for DTB Image */
+ reg = <0x00100000 0x00100000>;
+ label = "NAND DTB Image";
+ };
+
+ partition@200000 {
+ /* 4MB for Linux Kernel Image */
+ reg = <0x00200000 0x00400000>;
+ label = "NAND Linux Kernel Image";
+ };
+
+ partition@600000 {
+ /* 4MB for Compressed Root file System Image */
+ reg = <0x00600000 0x00400000>;
+ label = "NAND Compressed RFS Image";
+ };
+
+ partition@a00000 {
+ /* 15MB for JFFS2 based Root file System */
+ reg = <0x00a00000 0x00f00000>;
+ label = "NAND JFFS2 Root File System";
+ };
+
+ partition@1900000 {
+ /* 7MB for User Area */
+ reg = <0x01900000 0x00700000>;
+ label = "NAND User area";
+ };
+ };
+
+ cpld@3,0 {
+ #address-cells = <1>;
+ #size-cells = <1>;
+ compatible = "fsl,p1010rdb-cpld";
+ reg = <0x3 0x0 0x0000020>;
+ bank-width = <1>;
+ device-width = <1>;
+ };
+ };
+
+ soc@ffe00000 {
+ spi@7000 {
+ flash@0 {
+ #address-cells = <1>;
+ #size-cells = <1>;
+ compatible = "spansion,s25sl12801";
+ reg = <0>;
+ spi-max-frequency = <50000000>;
+
+ partition@0 {
+ /* 1MB for u-boot Bootloader Image */
+ /* 1MB for Environment */
+ reg = <0x0 0x00100000>;
+ label = "SPI Flash U-Boot Image";
+ read-only;
+ };
+
+ partition@100000 {
+ /* 512KB for DTB Image */
+ reg = <0x00100000 0x00080000>;
+ label = "SPI Flash DTB Image";
+ };
+
+ partition@180000 {
+ /* 4MB for Linux Kernel Image */
+ reg = <0x00180000 0x00400000>;
+ label = "SPI Flash Linux Kernel Image";
+ };
+
+ partition@580000 {
+ /* 4MB for Compressed RFS Image */
+ reg = <0x00580000 0x00400000>;
+ label = "SPI Flash Compressed RFSImage";
+ };
+
+ partition@980000 {
+ /* 6.5MB for JFFS2 based RFS */
+ reg = <0x00980000 0x00680000>;
+ label = "SPI Flash JFFS2 RFS";
+ };
+ };
+ };
+
+ can0@1c000 {
+ fsl,flexcan-clock-source = "platform";
+ };
+
+ can1@1d000 {
+ fsl,flexcan-clock-source = "platform";
+ };
+
+ usb@22000 {
+ phy_type = "utmi";
+ };
+
+ mdio@24000 {
+ phy0: ethernet-phy@0 {
+ interrupt-parent = <&mpic>;
+ interrupts = <3 1>;
+ reg = <0x1>;
+ };
+
+ phy1: ethernet-phy@1 {
+ interrupt-parent = <&mpic>;
+ interrupts = <2 1>;
+ reg = <0x0>;
+ };
+
+ phy2: ethernet-phy@2 {
+ interrupt-parent = <&mpic>;
+ interrupts = <2 1>;
+ reg = <0x2>;
+ };
+ };
+
+ enet0: ethernet@b0000 {
+ phy-handle = <&phy0>;
+ phy-connection-type = "rgmii-id";
+ };
+
+ enet1: ethernet@b1000 {
+ phy-handle = <&phy1>;
+ tbi-handle = <&tbi0>;
+ phy-connection-type = "sgmii";
+ };
+
+ enet2: ethernet@b2000 {
+ phy-handle = <&phy2>;
+ tbi-handle = <&tbi1>;
+ phy-connection-type = "sgmii";
+ };
+ };
+
+ pci0: pcie@ffe09000 {
+ ranges = <0x2000000 0x0 0xa0000000 0 0xa0000000 0x0 0x20000000
+ 0x1000000 0x0 0x00000000 0 0xffc10000 0x0 0x10000>;
+ pcie@0 {
+ reg = <0x0 0x0 0x0 0x0 0x0>;
+ #interrupt-cells = <1>;
+ #size-cells = <2>;
+ #address-cells = <3>;
+ device_type = "pci";
+ interrupt-parent = <&mpic>;
+ interrupts = <16 2>;
+ interrupt-map-mask = <0xf800 0x0 0x0 0x7>;
+ interrupt-map = <
+ /* IDSEL 0x0 */
+ 0000 0x0 0x0 0x1 &mpic 0x4 0x1
+ 0000 0x0 0x0 0x2 &mpic 0x5 0x1
+ 0000 0x0 0x0 0x3 &mpic 0x6 0x1
+ 0000 0x0 0x0 0x4 &mpic 0x7 0x1
+ >;
+
+ ranges = <0x2000000 0x0 0xa0000000
+ 0x2000000 0x0 0xa0000000
+ 0x0 0x20000000
+
+ 0x1000000 0x0 0x0
+ 0x1000000 0x0 0x0
+ 0x0 0x100000>;
+ };
+ };
+
+ pci1: pcie@ffe0a000 {
+ ranges = <0x2000000 0x0 0x80000000 0 0x80000000 0x0 0x20000000
+ 0x1000000 0x0 0x00000000 0 0xffc00000 0x0 0x10000>;
+ pcie@0 {
+ reg = <0x0 0x0 0x0 0x0 0x0>;
+ #interrupt-cells = <1>;
+ #size-cells = <2>;
+ #address-cells = <3>;
+ device_type = "pci";
+ interrupt-parent = <&mpic>;
+ interrupts = <16 2>;
+ interrupt-map-mask = <0xf800 0x0 0x0 0x7>;
+ interrupt-map = <
+ /* IDSEL 0x0 */
+ 0000 0x0 0x0 0x1 &mpic 0x4 0x1
+ 0000 0x0 0x0 0x2 &mpic 0x5 0x1
+ 0000 0x0 0x0 0x3 &mpic 0x6 0x1
+ 0000 0x0 0x0 0x4 &mpic 0x7 0x1
+ >;
+ ranges = <0x2000000 0x0 0x80000000
+ 0x2000000 0x0 0x80000000
+ 0x0 0x20000000
+
+ 0x1000000 0x0 0x0
+ 0x1000000 0x0 0x0
+ 0x0 0x100000>;
+ };
+ };
+};
diff --git a/arch/powerpc/boot/dts/p1010si.dtsi b/arch/powerpc/boot/dts/p1010si.dtsi
new file mode 100644
index 0000000..7f51104
--- /dev/null
+++ b/arch/powerpc/boot/dts/p1010si.dtsi
@@ -0,0 +1,376 @@
+/*
+ * P1010si Device Tree Source
+ *
+ * Copyright 2011 Freescale Semiconductor Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ */
+
+/dts-v1/;
+/ {
+ compatible = "fsl,P1010";
+ #address-cells = <2>;
+ #size-cells = <2>;
+
+ cpus {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ PowerPC,P1010@0 {
+ device_type = "cpu";
+ reg = <0x0>;
+ next-level-cache = <&L2>;
+ };
+ };
+
+ ifc@ffe1e000 {
+ #address-cells = <2>;
+ #size-cells = <1>;
+ compatible = "fsl,ifc", "simple-bus";
+ reg = <0x0 0xffe1e000 0 0x2000>;
+ interrupts = <16 2 19 2>;
+ interrupt-parent = <&mpic>;
+ };
+
+ soc@ffe00000 {
+ #address-cells = <1>;
+ #size-cells = <1>;
+ device_type = "soc";
+ compatible = "fsl,p1010-immr", "simple-bus";
+ ranges = <0x0 0x0 0xffe00000 0x100000>;
+ bus-frequency = <0>; // Filled out by uboot.
+
+ ecm-law@0 {
+ compatible = "fsl,ecm-law";
+ reg = <0x0 0x1000>;
+ fsl,num-laws = <12>;
+ };
+
+ ecm@1000 {
+ compatible = "fsl,p1010-ecm", "fsl,ecm";
+ reg = <0x1000 0x1000>;
+ interrupts = <16 2>;
+ interrupt-parent = <&mpic>;
+ };
+
+ memory-controller@2000 {
+ compatible = "fsl,p1010-memory-controller";
+ reg = <0x2000 0x1000>;
+ interrupt-parent = <&mpic>;
+ interrupts = <16 2>;
+ };
+
+ i2c@3000 {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ cell-index = <0>;
+ compatible = "fsl-i2c";
+ reg = <0x3000 0x100>;
+ interrupts = <43 2>;
+ interrupt-parent = <&mpic>;
+ dfsrr;
+ };
+
+ i2c@3100 {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ cell-index = <1>;
+ compatible = "fsl-i2c";
+ reg = <0x3100 0x100>;
+ interrupts = <43 2>;
+ interrupt-parent = <&mpic>;
+ dfsrr;
+ };
+
+ serial0: serial@4500 {
+ cell-index = <0>;
+ device_type = "serial";
+ compatible = "ns16550";
+ reg = <0x4500 0x100>;
+ clock-frequency = <0>;
+ interrupts = <42 2>;
+ interrupt-parent = <&mpic>;
+ };
+
+ serial1: serial@4600 {
+ cell-index = <1>;
+ device_type = "serial";
+ compatible = "ns16550";
+ reg = <0x4600 0x100>;
+ clock-frequency = <0>;
+ interrupts = <42 2>;
+ interrupt-parent = <&mpic>;
+ };
+
+ spi@7000 {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ compatible = "fsl,mpc8536-espi";
+ reg = <0x7000 0x1000>;
+ interrupts = <59 0x2>;
+ interrupt-parent = <&mpic>;
+ fsl,espi-num-chipselects = <1>;
+ };
+
+ gpio: gpio-controller@f000 {
+ #gpio-cells = <2>;
+ compatible = "fsl,mpc8572-gpio";
+ reg = <0xf000 0x100>;
+ interrupts = <47 0x2>;
+ interrupt-parent = <&mpic>;
+ gpio-controller;
+ };
+
+ sata@18000 {
+ compatible = "fsl,pq-sata-v2";
+ reg = <0x18000 0x1000>;
+ cell-index = <1>;
+ interrupts = <74 0x2>;
+ interrupt-parent = <&mpic>;
+ };
+
+ sata@19000 {
+ compatible = "fsl,pq-sata-v2";
+ reg = <0x19000 0x1000>;
+ cell-index = <2>;
+ interrupts = <41 0x2>;
+ interrupt-parent = <&mpic>;
+ };
+
+ can0@1c000 {
+ compatible = "fsl,flexcan-v1.0";
+ reg = <0x1c000 0x1000>;
+ interrupts = <48 0x2>;
+ interrupt-parent = <&mpic>;
+ fsl,flexcan-clock-divider = <2>;
+ };
+
+ can1@1d000 {
+ compatible = "fsl,flexcan-v1.0";
+ reg = <0x1d000 0x1000>;
+ interrupts = <61 0x2>;
+ interrupt-parent = <&mpic>;
+ fsl,flexcan-clock-divider = <2>;
+ };
+
+ L2: l2-cache-controller@20000 {
+ compatible = "fsl,p1010-l2-cache-controller",
+ "fsl,p1014-l2-cache-controller";
+ reg = <0x20000 0x1000>;
+ cache-line-size = <32>; // 32 bytes
+ cache-size = <0x40000>; // L2,256K
+ interrupt-parent = <&mpic>;
+ interrupts = <16 2>;
+ };
+
+ dma@21300 {
+ #address-cells = <1>;
+ #size-cells = <1>;
+ compatible = "fsl,p1010-dma", "fsl,eloplus-dma";
+ reg = <0x21300 0x4>;
+ ranges = <0x0 0x21100 0x200>;
+ cell-index = <0>;
+ dma-channel@0 {
+ compatible = "fsl,p1010-dma-channel", "fsl,eloplus-dma-channel";
+ reg = <0x0 0x80>;
+ cell-index = <0>;
+ interrupt-parent = <&mpic>;
+ interrupts = <20 2>;
+ };
+ dma-channel@80 {
+ compatible = "fsl,p1010-dma-channel", "fsl,eloplus-dma-channel";
+ reg = <0x80 0x80>;
+ cell-index = <1>;
+ interrupt-parent = <&mpic>;
+ interrupts = <21 2>;
+ };
+ dma-channel@100 {
+ compatible = "fsl,p1010-dma-channel", "fsl,eloplus-dma-channel";
+ reg = <0x100 0x80>;
+ cell-index = <2>;
+ interrupt-parent = <&mpic>;
+ interrupts = <22 2>;
+ };
+ dma-channel@180 {
+ compatible = "fsl,p1010-dma-channel", "fsl,eloplus-dma-channel";
+ reg = <0x180 0x80>;
+ cell-index = <3>;
+ interrupt-parent = <&mpic>;
+ interrupts = <23 2>;
+ };
+ };
+
+ usb@22000 {
+ compatible = "fsl-usb2-dr";
+ reg = <0x22000 0x1000>;
+ #address-cells = <1>;
+ #size-cells = <0>;
+ interrupt-parent = <&mpic>;
+ interrupts = <28 0x2>;
+ dr_mode = "host";
+ };
+
+ mdio@24000 {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ compatible = "fsl,etsec2-mdio";
+ reg = <0x24000 0x1000 0xb0030 0x4>;
+ };
+
+ mdio@25000 {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ compatible = "fsl,etsec2-tbi";
+ reg = <0x25000 0x1000 0xb1030 0x4>;
+ tbi0: tbi-phy@11 {
+ reg = <0x11>;
+ device_type = "tbi-phy";
+ };
+ };
+
+ mdio@26000 {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ compatible = "fsl,etsec2-tbi";
+ reg = <0x26000 0x1000 0xb1030 0x4>;
+ tbi1: tbi-phy@11 {
+ reg = <0x11>;
+ device_type = "tbi-phy";
+ };
+ };
+
+ sdhci@2e000 {
+ compatible = "fsl,esdhc";
+ reg = <0x2e000 0x1000>;
+ interrupts = <72 0x8>;
+ interrupt-parent = <&mpic>;
+ /* Filled in by U-Boot */
+ clock-frequency = <0>;
+ fsl,sdhci-auto-cmd12;
+ };
+
+ enet0: ethernet@b0000 {
+ #address-cells = <1>;
+ #size-cells = <1>;
+ device_type = "network";
+ model = "eTSEC";
+ compatible = "fsl,etsec2";
+ fsl,num_rx_queues = <0x8>;
+ fsl,num_tx_queues = <0x8>;
+ local-mac-address = [ 00 00 00 00 00 00 ];
+ interrupt-parent = <&mpic>;
+
+ queue-group@0 {
+ #address-cells = <1>;
+ #size-cells = <1>;
+ reg = <0xb0000 0x1000>;
+ fsl,rx-bit-map = <0xff>;
+ fsl,tx-bit-map = <0xff>;
+ interrupts = <29 2 30 2 34 2>;
+ };
+
+ };
+
+ enet1: ethernet@b1000 {
+ #address-cells = <1>;
+ #size-cells = <1>;
+ device_type = "network";
+ model = "eTSEC";
+ compatible = "fsl,etsec2";
+ fsl,num_rx_queues = <0x8>;
+ fsl,num_tx_queues = <0x8>;
+ local-mac-address = [ 00 00 00 00 00 00 ];
+ interrupt-parent = <&mpic>;
+
+ queue-group@0 {
+ #address-cells = <1>;
+ #size-cells = <1>;
+ reg = <0xb1000 0x1000>;
+ fsl,rx-bit-map = <0xff>;
+ fsl,tx-bit-map = <0xff>;
+ interrupts = <35 2 36 2 40 2>;
+ };
+
+ };
+
+ enet2: ethernet@b2000 {
+ #address-cells = <1>;
+ #size-cells = <1>;
+ device_type = "network";
+ model = "eTSEC";
+ compatible = "fsl,etsec2";
+ fsl,num_rx_queues = <0x8>;
+ fsl,num_tx_queues = <0x8>;
+ local-mac-address = [ 00 00 00 00 00 00 ];
+ interrupt-parent = <&mpic>;
+
+ queue-group@0 {
+ #address-cells = <1>;
+ #size-cells = <1>;
+ reg = <0xb2000 0x1000>;
+ fsl,rx-bit-map = <0xff>;
+ fsl,tx-bit-map = <0xff>;
+ interrupts = <31 2 32 2 33 2>;
+ };
+
+ };
+
+ mpic: pic@40000 {
+ interrupt-controller;
+ #address-cells = <0>;
+ #interrupt-cells = <2>;
+ reg = <0x40000 0x40000>;
+ compatible = "chrp,open-pic";
+ device_type = "open-pic";
+ };
+
+ msi@41600 {
+ compatible = "fsl,p1010-msi", "fsl,mpic-msi";
+ reg = <0x41600 0x80>;
+ msi-available-ranges = <0 0x100>;
+ interrupts = <
+ 0xe0 0
+ 0xe1 0
+ 0xe2 0
+ 0xe3 0
+ 0xe4 0
+ 0xe5 0
+ 0xe6 0
+ 0xe7 0>;
+ interrupt-parent = <&mpic>;
+ };
+
+ global-utilities@e0000 { //global utilities block
+ compatible = "fsl,p1010-guts";
+ reg = <0xe0000 0x1000>;
+ fsl,has-rstcr;
+ };
+ };
+
+ pci0: pcie@ffe09000 {
+ compatible = "fsl,p1010-pcie", "fsl,qoriq-pcie-v2.3", "fsl,qoriq-pcie-v2.2";
+ device_type = "pci";
+ #size-cells = <2>;
+ #address-cells = <3>;
+ reg = <0 0xffe09000 0 0x1000>;
+ bus-range = <0 255>;
+ clock-frequency = <33333333>;
+ interrupt-parent = <&mpic>;
+ interrupts = <16 2>;
+ };
+
+ pci1: pcie@ffe0a000 {
+ compatible = "fsl,p1010-pcie", "fsl,qoriq-pcie-v2.3", "fsl,qoriq-pcie-v2.2";
+ device_type = "pci";
+ #size-cells = <2>;
+ #address-cells = <3>;
+ reg = <0 0xffe0a000 0 0x1000>;
+ bus-range = <0 255>;
+ clock-frequency = <33333333>;
+ interrupt-parent = <&mpic>;
+ interrupts = <16 2>;
+ };
+};
diff --git a/arch/powerpc/configs/mpc85xx_defconfig b/arch/powerpc/configs/mpc85xx_defconfig
index 96b89df..306f4a0 100644
--- a/arch/powerpc/configs/mpc85xx_defconfig
+++ b/arch/powerpc/configs/mpc85xx_defconfig
@@ -25,6 +25,7 @@ CONFIG_MPC85xx_MDS=y
CONFIG_MPC8536_DS=y
CONFIG_MPC85xx_DS=y
CONFIG_MPC85xx_RDB=y
+CONFIG_P1010_RDB=y
CONFIG_P1022_DS=y
CONFIG_SOCRATES=y
CONFIG_KSI8560=y
diff --git a/arch/powerpc/platforms/85xx/Kconfig b/arch/powerpc/platforms/85xx/Kconfig
index b6976e1..07a3d29 100644
--- a/arch/powerpc/platforms/85xx/Kconfig
+++ b/arch/powerpc/platforms/85xx/Kconfig
@@ -67,6 +67,16 @@ config MPC85xx_RDB
help
This option enables support for the MPC85xx RDB (P2020 RDB) board
+config P1010_RDB
+ bool "Freescale P1010RDB"
+ select DEFAULT_UIMAGE
+ help
+ This option enables support for the MPC85xx RDB (P1010 RDB) board
+
+ P1010RDB contains P1010Si, which provides CPU performance up to 800
+ MHz and 1600 DMIPS, additional functionality and faster interfaces
+ (DDR3/3L, SATA II, and PCI Express).
+
config P1022_DS
bool "Freescale P1022 DS"
select DEFAULT_UIMAGE
diff --git a/arch/powerpc/platforms/85xx/Makefile b/arch/powerpc/platforms/85xx/Makefile
index dd70db7..07b40bf 100644
--- a/arch/powerpc/platforms/85xx/Makefile
+++ b/arch/powerpc/platforms/85xx/Makefile
@@ -10,6 +10,7 @@ obj-$(CONFIG_MPC8536_DS) += mpc8536_ds.o
obj-$(CONFIG_MPC85xx_DS) += mpc85xx_ds.o
obj-$(CONFIG_MPC85xx_MDS) += mpc85xx_mds.o
obj-$(CONFIG_MPC85xx_RDB) += mpc85xx_rdb.o
+obj-$(CONFIG_P1010_RDB) += p1010rdb.o
obj-$(CONFIG_P1022_DS) += p1022_ds.o
obj-$(CONFIG_P3041_DS) += p3041_ds.o corenet_ds.o
obj-$(CONFIG_P4080_DS) += p4080_ds.o corenet_ds.o
diff --git a/arch/powerpc/platforms/85xx/p1010rdb.c b/arch/powerpc/platforms/85xx/p1010rdb.c
new file mode 100644
index 0000000..d7387fa
--- /dev/null
+++ b/arch/powerpc/platforms/85xx/p1010rdb.c
@@ -0,0 +1,122 @@
+/*
+ * P1010RDB Board Setup
+ *
+ * Copyright 2011 Freescale Semiconductor Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ */
+
+#include <linux/stddef.h>
+#include <linux/kernel.h>
+#include <linux/pci.h>
+#include <linux/delay.h>
+#include <linux/interrupt.h>
+#include <linux/of_platform.h>
+
+#include <asm/system.h>
+#include <asm/time.h>
+#include <asm/machdep.h>
+#include <asm/pci-bridge.h>
+#include <mm/mmu_decl.h>
+#include <asm/prom.h>
+#include <asm/udbg.h>
+#include <asm/mpic.h>
+
+#include <sysdev/fsl_soc.h>
+#include <sysdev/fsl_pci.h>
+
+void __init p1010_rdb_pic_init(void)
+{
+ struct mpic *mpic;
+ struct resource r;
+ struct device_node *np;
+
+ np = of_find_node_by_type(NULL, "open-pic");
+ if (np == NULL) {
+ printk(KERN_ERR "Could not find open-pic node\n");
+ return;
+ }
+
+ if (of_address_to_resource(np, 0, &r)) {
+ printk(KERN_ERR "Failed to map mpic register space\n");
+ of_node_put(np);
+ return;
+ }
+
+ mpic = mpic_alloc(np, r.start, MPIC_PRIMARY | MPIC_WANTS_RESET |
+ MPIC_BIG_ENDIAN | MPIC_BROKEN_FRR_NIRQS | MPIC_SINGLE_DEST_CPU,
+ 0, 256, " OpenPIC ");
+
+ BUG_ON(mpic == NULL);
+ of_node_put(np);
+
+ mpic_init(mpic);
+
+}
+
+
+/*
+ * Setup the architecture
+ */
+static void __init p1010_rdb_setup_arch(void)
+{
+#ifdef CONFIG_PCI
+ struct device_node *np;
+#endif
+
+ if (ppc_md.progress)
+ ppc_md.progress("p1010_rdb_setup_arch()", 0);
+
+#ifdef CONFIG_PCI
+ for_each_node_by_type(np, "pci") {
+ if (of_device_is_compatible(np, "fsl,p1010-pcie"))
+ fsl_add_bridge(np, 0);
+ }
+
+#endif
+
+ printk(KERN_INFO "P1010 RDB board from Freescale Semiconductor\n");
+}
+
+static struct of_device_id __initdata p1010rdb_ids[] = {
+ { .type = "soc", },
+ { .compatible = "soc", },
+ { .compatible = "simple-bus", },
+ {},
+};
+
+static int __init p1010rdb_publish_devices(void)
+{
+ return of_platform_bus_probe(NULL, p1010rdb_ids, NULL);
+}
+machine_device_initcall(p1010_rdb, p1010rdb_publish_devices);
+machine_arch_initcall(p1010_rdb, swiotlb_setup_bus_notifier);
+
+/*
+ * Called very early, device-tree isn't unflattened
+ */
+static int __init p1010_rdb_probe(void)
+{
+ unsigned long root = of_get_flat_dt_root();
+
+ if (of_flat_dt_is_compatible(root, "fsl,P1010RDB"))
+ return 1;
+ return 0;
+}
+
+define_machine(p1010_rdb) {
+ .name = "P1010 RDB",
+ .probe = p1010_rdb_probe,
+ .setup_arch = p1010_rdb_setup_arch,
+ .init_IRQ = p1010_rdb_pic_init,
+#ifdef CONFIG_PCI
+ .pcibios_fixup_bus = fsl_pcibios_fixup_bus,
+#endif
+ .get_irq = mpic_get_irq,
+ .restart = fsl_rstcr_restart,
+ .calibrate_decr = generic_calibrate_decr,
+ .progress = udbg_progress,
+};
--
1.7.3
^ permalink raw reply related
* Re: [PATCH] powerpc/85xx: fix race bug of calling request_irq after enable elbc interrupts
From: Kumar Gala @ 2011-06-03 7:57 UTC (permalink / raw)
To: Shaohui Xie; +Cc: B07421, linuxppc-dev
In-Reply-To: <1307069111-24459-1-git-send-email-Shaohui.Xie@freescale.com>
On Jun 2, 2011, at 9:45 PM, Shaohui Xie wrote:
> Signed-off-by: Shaohui Xie <Shaohui.Xie@freescale.com>
> Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
> ---
> arch/powerpc/sysdev/fsl_lbc.c | 6 +++---
> 1 files changed, 3 insertions(+), 3 deletions(-)
applied to merge
- k
^ permalink raw reply
* Re: [RFC][PATCH] Kexec support for PPC440x
From: Suzuki Poulose @ 2011-06-03 11:50 UTC (permalink / raw)
To: Sebastian Andrzej Siewior; +Cc: linux ppc dev, kexec@lists.infradead.org, lkml
In-Reply-To: <4DE72EFE.8080502@in.ibm.com>
On 06/02/11 12:04, Suzuki Poulose wrote:
> On 05/31/11 20:45, Sebastian Andrzej Siewior wrote:
>>
>> Suzuki Poulose wrote:
>>> Index: powerpc/arch/powerpc/kernel/44x_kexec_mapping.S
>>> ===================================================================
>>> --- /dev/null
>>> +++ powerpc/arch/powerpc/kernel/44x_kexec_mapping.S
>> ....
>>
>>> + *
>>> + */
>>> + bl nxtins /* Find our address */
>>> +nxtins: mflr r5 /* Make it accessible */
>>
>> Please don't mix labels and instructions.
> OK.
>>
>>> + tlbsx r23,0,r5 /* Find entry we are in */
>>
>> using tabs instead of spaces would make it look nice. Please also separate the arguments of the instruction i.e.
>> tlbsx r23, 0, r5
>
> Sure.
>>
>>
>>> Index: powerpc/arch/powerpc/kernel/misc_32.S
>>> ===================================================================
>>> --- powerpc.orig/arch/powerpc/kernel/misc_32.S
>>> +++ powerpc/arch/powerpc/kernel/misc_32.S
>>> @@ -736,6 +736,28 @@ relocate_new_kernel:
>>> mr r5, r31
>>>
>>> li r0, 0
>>> +#elif defined(CONFIG_44x) && !defined(CONFIG_47x)
>>> +
>>> + mr r29, r3
>>> + mr r30, r4
>>> + mr r31, r5
>>> +
>>> +#include "44x_kexec_mapping.S"
>>
>> The way you setup the 1:1 mapping should be close to what you are doing on
>> kernel entry.Isn't it possible to include the file here and in the entry
>> code?
> I will make this change and resend the patch.
I took a look at the way we do it at kernel entry. It looks more cleaner to leave
it untouched. Especially, when we add the support for 47x in the future, the code
will become more unreadable.
What do you think ?
Thanks
Suzuki
>
> Thanks
>
> Suzuki
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev
^ permalink raw reply
* Re: [stable] [PATCH] 2.6.39 powerpc: Fix 32-bit SMP build
From: Josh Boyer @ 2011-06-03 10:30 UTC (permalink / raw)
To: Greg KH; +Cc: linuxppc-dev, stable
In-Reply-To: <20110603055650.GB21323@kroah.com>
On Fri, Jun 03, 2011 at 02:56:50PM +0900, Greg KH wrote:
>On Mon, May 30, 2011 at 08:26:21AM -0400, Josh Boyer wrote:
>> Backport upstream commit 6de06f313a65d0ec
>>
>> Commit fa3f82c8bb7acb ("powerpc/smp: soft-replugged CPUs must go back to
>> start_secondary") introduced start_secondary_resume to head_32.S, however
>> it uses a 64-bit instruction which is not valid on 32-bit platforms. Use
>> 'stw' instead.
>>
>> CC: stable@kernel.org
>> Signed-off-by: Josh Boyer <jwboyer@linux.vnet.ibm.com>
>
>This doesn't apply either:
>
>patching file arch/powerpc/kernel/head_32.S
>Hunk #1 FAILED at 896.
>1 out of 1 hunk FAILED -- saving rejects to file arch/powerpc/kernel/head_32.S.rej
>
>Please send something that at least applies, and hopefully builds...
Odd. It was generated with git from 2.6.39 and it builds here. I'll
try and figure out what went wrong.
josh
^ permalink raw reply
* [PATCH v2] 2.6.39 powerpc: FIx 32-bit SMP build
From: Josh Boyer @ 2011-06-03 12:34 UTC (permalink / raw)
To: linuxppc-dev; +Cc: stable
Backport upstream commit 6de06f313a65d0ec
Commit fa3f82c8bb7acb ("powerpc/smp: soft-replugged CPUs must go back to
start_secondary") introduced start_secondary_resume to head_32.S, however
it uses a 64-bit instruction which is not valid on 32-bit platforms. Use
'stw' instead.
CC: stable@kernel.org
Signed-off-by: Josh Boyer <jwboyer@linux.vnet.ibm.com>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---
diff --git a/arch/powerpc/kernel/head_32.S b/arch/powerpc/kernel/head_32.S
index c5c24be..727f40a 100644
--- a/arch/powerpc/kernel/head_32.S
+++ b/arch/powerpc/kernel/head_32.S
@@ -896,7 +896,7 @@ _GLOBAL(start_secondary_resume)
rlwinm r1,r1,0,0,(31-THREAD_SHIFT) /* current_thread_info() */
addi r1,r1,THREAD_SIZE-STACK_FRAME_OVERHEAD
li r3,0
- std r3,0(r1) /* Zero the stack frame pointer */
+ stw r3,0(r1) /* Zero the stack frame pointer */
bl start_secondary
b .
#endif /* CONFIG_SMP */
^ permalink raw reply related
* Re: [RFC][PATCH] Kexec support for PPC440x
From: Sebastian Andrzej Siewior @ 2011-06-03 13:53 UTC (permalink / raw)
To: Suzuki Poulose; +Cc: linux ppc dev, kexec@lists.infradead.org, lkml
In-Reply-To: <4DE8CA76.2060303@in.ibm.com>
Suzuki Poulose wrote:
>>> The way you setup the 1:1 mapping should be close to what you are
>>> doing on
>>> kernel entry.Isn't it possible to include the file here and in the entry
>>> code?
>
>> I will make this change and resend the patch.
>
> I took a look at the way we do it at kernel entry. It looks more cleaner
> to leave
> it untouched. Especially, when we add the support for 47x in the future,
> the code
> will become more unreadable.
>
> What do you think ?
So the entry code has one 256MiB mapping, you need 8 of those. Entry goes
for TLB 63 and you need to be flexible and avoid TLB 63 :).
So after all you don't have that much in common with the entry code. If
you look at the FSL-book code then you will notice that I tried to share
some code.
I don't understand why you don't flip the address space bit. On fsl we
setup the tmp mapping in the "other address" space so we don't have two
mappings for the same address. The entry code could be doing this with STS
bit, I'm not sure.
If you want to keep your tiny mmu flip code instead of merging with the
entry code then please don't put it into a separate file. The only reason
why I did it, is to have the code once since I can't branch to it and I
wanted to share code.
>
> Thanks
>
> Suzuki
Sebastian
^ permalink raw reply
* Re: [PATCH 7/7] [v2] drivers/misc: introduce Freescale hypervisor management driver
From: Timur Tabi @ 2011-06-03 14:44 UTC (permalink / raw)
To: Arnd Bergmann
Cc: kumar.gala, linux-kernel, akpm, linux-console, greg, linuxppc-dev
In-Reply-To: <201106012340.14237.arnd@arndb.de>
Arnd Bergmann wrote:
> For an ioctl, please follow the normal pattern of defining a separate
> structure for each case, no union.
>
> You can use a void __user * in the common ioctl function, and pass that
> to the typed argument list in the specific functions.
I have a GPL question. This header file is currently licensed under the GPL v2
only. Does that mean that any application that includes this header file so
that it can talk to the driver/hypervisor also needs to be licensed under the GPL?
--
Timur Tabi
Linux kernel developer at Freescale
^ permalink raw reply
* Re: [BUG] rebuild_sched_domains considered dangerous
From: Peter Zijlstra @ 2011-06-03 14:47 UTC (permalink / raw)
To: Jesse Larrew
Cc: Martin Schwidefsky, linuxppc-dev, linux-kernel@vger.kernel.org
In-Reply-To: <4DCAB6B0.8020904@linux.vnet.ibm.com>
On Wed, 2011-05-11 at 11:17 -0500, Jesse Larrew wrote:
> > I would really like to see both patch-sets together. Also, I'm not
> at
> > all convinced its a sane thing to do. Pretty much all NUMA aware
> > software I know of assumes that CPU<->NODE relations are static,
> > breaking that in kernel renders all existing software broken.
> >=20
>=20
> I suspect that's true. Then again, shouldn't it be the capabilities of
> the hardware that dictates what the software does, rather than the
> other way around?=20
Wish that were true, we wouldn't be all constrained by all this legacy
software.. ;-)
Anyway, there's plenty of CPU<->NODE assumptions in the kernel as well,
fixing those will be 'interesting' at best, as for userspace, since its
a user-driven tool revamping the topology the user gets to keep the
pieces when he runs that while some NUMA aware proglet is running.
^ permalink raw reply
* Re: [PATCH 7/7] [v2] drivers/misc: introduce Freescale hypervisor management driver
From: Arnd Bergmann @ 2011-06-03 15:17 UTC (permalink / raw)
To: Timur Tabi
Cc: kumar.gala, linux-kernel, akpm, linux-console, greg, linuxppc-dev
In-Reply-To: <4DE8F347.9060104@freescale.com>
On Friday 03 June 2011, Timur Tabi wrote:
> Arnd Bergmann wrote:
> > For an ioctl, please follow the normal pattern of defining a separate
> > structure for each case, no union.
> >
> > You can use a void __user * in the common ioctl function, and pass that
> > to the typed argument list in the specific functions.
>
> I have a GPL question. This header file is currently licensed under the GPL v2
> only. Does that mean that any application that includes this header file so
> that it can talk to the driver/hypervisor also needs to be licensed under the GPL?
If you have a license question, ask your lawyer.
Common answers that you would hear are:
* User space interfaces of the kernel are excluded from the License by the
"normal system call" exception in linux/COPYING.
* If the header files only contain interfaces but no code, they are not
copyrighted.
* If you want to ship a copy of the file with a user space application source,
but have to make it available under multiple licenses to do that, e.g. dual
GPL/BSD.
Arnd
^ permalink raw reply
* Re: [PATCH 7/7] [v2] drivers/misc: introduce Freescale hypervisor management driver
From: Arnd Bergmann @ 2011-06-03 15:24 UTC (permalink / raw)
To: Timur Tabi
Cc: kumar.gala, linux-kernel, akpm, linux-console, greg, linuxppc-dev
In-Reply-To: <4DE8008E.9030008@freescale.com>
On Thursday 02 June 2011, Timur Tabi wrote:
> Arnd Bergmann wrote:
> > I think drivers/misc is not the right place for this, but I'm not completely
> > sure what is. drivers/firmware would be better at least, but virt/fsl might
> > also be ok.
>
> I don't think it's correct to think of a hypervisor as firmware, so I don't
> think drivers/firmware is better.
>
> I'm not sure that creating virt/fsl and putting the driver in there is a good
> idea, because it will be the only driver in that directory. Unlike KVM, this
> driver is just a collection of front-ends to our hypervisor API. The actual
> hypervisor is completely separate. That's why I put it in drivers/misc, because
> it's just a single driver with a miscellaneous collection of interfaces.
Ok, fair enough. If nobody has a strong preference any other way, just make it
drivers/firmware then.
> We also don't want to have any Kconfig options that "turn on" hypervisor
> support. I've intentionally made support for the hypervisor part of the normal
> platform code, and the device tree is used to determine whether that code is
> active or not.
>
> So virt/fsl seems like overkill to me.
Ok. Obviously, you still have the option to move the code later if you require
more interfaces to talk to your hypervisor, and then you can still add virt/fsl,
so no problem.
> > I'm not convinced that an ioctl interface is the right way to work with
> > device tree properties. A more natural way would be to export it as
> > a file system, or maybe as a flattened device tree blob (the latter option
> > would require changing the hypervisor interface, which might not be
> > possible).
>
> As Scott said, this is just a front-end to the hypervisor API, and we already
> have applications that depend on the ioctl interface. Considering that this
> driver is specific to the Freescale hypervisor, so I don't see any harm in using
> ioctls.
Good interface design is always important, one of the reasons is serving as
an example for other people doing similar drivers. There are a lot of
companies writing hypervisors and they all need interfaces like this.
> > For an ioctl, please follow the normal pattern of defining a separate
> > structure for each case, no union.
>
> Ok. This will break our existing applications, but it's a minor fix.
Ok. Better to break it now than accidentally break it later because of
some side-effect of a strange interface, e.g. when the union would change in
size.
Arnd
^ permalink raw reply
* Re: [PATCH 7/7] [v2] drivers/misc: introduce Freescale hypervisor management driver
From: Timur Tabi @ 2011-06-03 15:28 UTC (permalink / raw)
To: Arnd Bergmann
Cc: kumar.gala, linux-kernel, akpm, linux-console, greg, linuxppc-dev
In-Reply-To: <201106031724.44957.arnd@arndb.de>
Arnd Bergmann wrote:
>> > I don't think it's correct to think of a hypervisor as firmware, so I don't
>> > think drivers/firmware is better.
>> >
>> > I'm not sure that creating virt/fsl and putting the driver in there is a good
>> > idea, because it will be the only driver in that directory. Unlike KVM, this
>> > driver is just a collection of front-ends to our hypervisor API. The actual
>> > hypervisor is completely separate. That's why I put it in drivers/misc, because
>> > it's just a single driver with a miscellaneous collection of interfaces.
> Ok, fair enough. If nobody has a strong preference any other way, just make it
> drivers/firmware then.
Did you mean to say drivers/misc?
--
Timur Tabi
Linux kernel developer at Freescale
^ permalink raw reply
* Re: [PATCH 7/7] [v2] drivers/misc: introduce Freescale hypervisor management driver
From: Arnd Bergmann @ 2011-06-03 15:28 UTC (permalink / raw)
To: Scott Wood
Cc: greg, kumar.gala, linux-kernel, akpm, linux-console, linuxppc-dev,
Timur Tabi
In-Reply-To: <20110601172412.761ff799@schlenkerla.am.freescale.net>
On Thursday 02 June 2011, Scott Wood wrote:
> I wanted to have the hypervisor take an update dtb (we already have special
> meta-properties for things like deletion as part of the hv config
> mechanism). But others on the project wanted to keep it simple, and so
> get/set property it was. :-/
>
> It's unlikely to change at this point without a real need.
>
> As for a filesystem interface, it's not a good match either.
> You can't iterate over anything to read out the full tree from the hv.
kexec iterates over /proc/device-tree to create a dts blob.
> You can't delete anything.
rm, rmdir
> You can't create empty nodes.
mkdir
> The hv interface was meant to enable some specific management actions,
> rather than to provide general device tree access. This driver is a thin
> wrapper around the management hcalls.
A file system would be a slightly more abstract interface to do the
same thing, I gues.
> There would still be other ioctls needed for starting/stopping the
> partition, etc.
Right, although you could model them as a file interface as well.
KVMfs is one example doing that.
Arnd
^ permalink raw reply
* Re: [PATCH 7/7] [v2] drivers/misc: introduce Freescale hypervisor management driver
From: Scott Wood @ 2011-06-03 16:22 UTC (permalink / raw)
To: Arnd Bergmann
Cc: greg, kumar.gala, linux-kernel, akpm, linux-console, linuxppc-dev,
Timur Tabi
In-Reply-To: <201106031728.43707.arnd@arndb.de>
On Fri, 3 Jun 2011 17:28:43 +0200
Arnd Bergmann <arnd@arndb.de> wrote:
> On Thursday 02 June 2011, Scott Wood wrote:
> > I wanted to have the hypervisor take an update dtb (we already have special
> > meta-properties for things like deletion as part of the hv config
> > mechanism). But others on the project wanted to keep it simple, and so
> > get/set property it was. :-/
> >
> > It's unlikely to change at this point without a real need.
> >
> > As for a filesystem interface, it's not a good match either.
> > You can't iterate over anything to read out the full tree from the hv.
>
> kexec iterates over /proc/device-tree to create a dts blob.
That's irrelevant, because we're not talking about that device tree. We're
talking about the device tree of another hypervisor guest.
> > You can't delete anything.
>
> rm, rmdir
>
> > You can't create empty nodes.
>
> mkdir
I know how to operate a filesystem. You can't do these operations *on
another guest's device tree through the hv interface*.
> > There would still be other ioctls needed for starting/stopping the
> > partition, etc.
>
> Right, although you could model them as a file interface as well.
> KVMfs is one example doing that.
And what would be the benefit of this major restructuring and added
complexity?
-Scott
^ permalink raw reply
* Re: [patch 00/14] Sort out i8253 and PC speaker locking and headers
From: Ralf Baechle @ 2011-06-03 18:00 UTC (permalink / raw)
To: Gerhard Pircher
Cc: linux-arch, linux-mips, linux-kernel, linux-alpha,
Thomas Gleixner, linuxppc-dev
In-Reply-To: <20110602191119.302850@gmx.net>
On Thu, Jun 02, 2011 at 09:11:19PM +0200, Gerhard Pircher wrote:
> > #if defined(CONFIG_MIPS) || defined(CONFIG_X86)
> > /* Use the global PIT lock ! */
> > #include <asm/i8253.h>
> > #else
> > #include <asm/8253pit.h>
> > static DEFINE_RAW_SPINLOCK(i8253_lock);
> > #endif
> >
> > sound/drivers/pcsp/pcsp.h:
> >
> > #if defined(CONFIG_MIPS) || defined(CONFIG_X86)
> > /* Use the global PIT lock ! */
> > #include <asm/i8253.h>
> > #else
> > #include <asm/8253pit.h>
> > static DEFINE_RAW_SPINLOCK(i8253_lock);
> >
> > $ git grep -F pcsp.h sound/drivers/pcsp
> > sound/drivers/pcsp/pcsp.c:#include "pcsp.h"
> > sound/drivers/pcsp/pcsp_input.c:#include "pcsp.h"
> > sound/drivers/pcsp/pcsp_lib.c:#include "pcsp.h"
> > sound/drivers/pcsp/pcsp_mixer.c:#include "pcsp.h"
> > $ git grep -w i8253_lock sound/drivers/pcsp/
> > sound/drivers/pcsp/pcsp.h:static DEFINE_RAW_SPINLOCK(i8253_lock);
> > sound/drivers/pcsp/pcsp_input.c: raw_spin_lock_irqsave(&i8253_lock,
> > flags
> > sound/drivers/pcsp/pcsp_input.c:
> > raw_spin_unlock_irqrestore(&i8253_lock,
> > sound/drivers/pcsp/pcsp_lib.c: raw_spin_lock_irqsave(&i8253_lock,
> > flags
> > sound/drivers/pcsp/pcsp_lib.c:
> > raw_spin_unlock_irqrestore(&i8253_lock,
> > sound/drivers/pcsp/pcsp_lib.c: raw_spin_lock(&i8253_lock);
> > sound/drivers/pcsp/pcsp_lib.c: raw_spin_unlock(&i8253_lock);
> > sound/drivers/pcsp/pcsp_lib.c: raw_spin_lock(&i8253_lock);
> > sound/drivers/pcsp/pcsp_lib.c: raw_spin_unlock(&i8253_lock);
> >
> > Locks are great, everybody should have their own lock!
> >
> > $ find . -name 8253pit.h
> > ./arch/powerpc/include/asm/8253pit.h
> > ./arch/alpha/include/asm/8253pit.h
> > $ cat arch/*/include/asm/8253pit.h
> > /*
> > * 8253/8254 Programmable Interval Timer
> > */
> > /*
> > * 8253/8254 Programmable Interval Timer
> > */
> > $
> >
> > Eh...
> >
> > $ git grep -w PCSPKR_PLATFORM
> > arch/mips/Kconfig: select PCSPKR_PLATFORM
> > arch/mips/Kconfig: select PCSPKR_PLATFORM
> > arch/mips/Kconfig: select PCSPKR_PLATFORM
> > arch/powerpc/platforms/amigaone/Kconfig: select PCSPKR_PLATFORM
> > drivers/input/misc/Kconfig: depends on PCSPKR_PLATFORM
> > init/Kconfig:config PCSPKR_PLATFORM
> > sound/drivers/Kconfig: depends on PCSPKR_PLATFORM && X86 &&
> > HIGH_RES_TIMERS
> >
> > So the status is:
> >
> > Alpha: There is no PCSPKR_PLATFORM so while a platform device is
> > being installed no drivers will be built. I don't know
> > which Alpha platforms or even if all of Alpha should be
> > doing a PCSPKR_PLATFORM so I haven't even tried to sort
> > this.
> > ARM: No PC speaker supported, yeah :)
> > PowerPC: Should compile but the locking is wrong but only the
> > AmigaOne platforms should be affected.
> The Kconfig dependencies cleanup patch for CHRP, PSERIES, etc. should
> also apply to the AmigaOne. Can you resend it with a fix for the
> AmigaOne, or should I send a patch?
I can sort that; it's easy enough.
> I'll check next week, if the PC speaker is still working on my AmigaOne.
I can't imagine that it's going to break - the code is sorta simple ;-)
One obscurity I noticed is this bit in the amigaone.dts:
timer@40 {
// Also adds pcspkr to platform devices.
compatible = "pnpPNP,100";
reg = <1 0x00000040 0x00000020>;
};
Shouldn't that rather be something like the following?
pcspeaker@61 {
device_type = "sound";
compatible = "pnpPNP,800";
reg = <1 0x61 1>;
};
pnpPNP,100 is the i8253 timer as I understand and pnpPNP,800 the PC speaker.
If you interpret pnpPNP,100 to imply the presence of a PC speaker you can't
express a system that has a i8253 but no PCspeaker in a DT so maybe
amigaone.dts and arch/powerpc/kernel/setup-common.c should be changed to
use pnpPNP,800 instead?
Ralf
^ permalink raw reply
* Re: [rtc-linux] Re: [PATCH] Add support for pt7c4338 (rtc device) in rtc-ds1307 driver
From: Grant Likely @ 2011-06-03 18:03 UTC (permalink / raw)
To: Anton Vorontsov
Cc: a.zummo@towertech.it, rtc-linux@googlegroups.com,
p_gortmaker@yahoo.com, Jain Priyanka-B32167, Tabi Timur-B04825,
akpm@linux-foundation.org, linuxppc-dev@lists.ozlabs.org
In-Reply-To: <20110530165745.GA2758@oksana.dev.rtsoft.ru>
On Mon, May 30, 2011 at 08:57:45PM +0400, Anton Vorontsov wrote:
> On Mon, May 30, 2011 at 02:29:58PM +0000, Tabi Timur-B04825 wrote:
> > On Mon, May 30, 2011 at 3:24 AM, Wolfram Sang <w.sang@pengutronix.de> wrote:
> >
> > > The first place where this should be mentioned is the datasheet of the
> > > pt-chip, so you might ask the producer to add this information (don't
> > > expect much to happen, though).
> >
> > It's true that the data sheet does not mention that it's identical to
> > the DS1307, but that's still no excuse for not noticing it and writing
> > a whole driver for it. :-(
> >
> > > IIRC I asked you explicitly for the differences between the chips. If
> > > there are none, you can use the driver directly, right? :)
> >
> > Yes. The device tree node for the PT7C4338 device should just say
> >
> > /* The board has a PT7C4338, which is compatible with the DS1307 */
> > compatible = "dallas,ds1307";
>
> While it seems to be 100% compatible, there could be chip-specific
> bugs or some interesting features that are hidden behind "reserved"
> bits and registers.
>
> So I think device tree should not lie about the chip model. Doing
> 'compatible = "pericom,pt7c4338", "dallas,ds1307"' is perfectly fine.
Correct. It's fine (and encouraged) to claim compatibility, but the
node should always specify the exact part in the compatible list.
>
> Note that today the several compatible entries approach gives you
> almost nothing, as you will need to add pt7c4338 entry into the driver
> anyway.
>
> I tried to improve this, i.e. make linux do OF-matching on the most
> generic compatible entry (the last one):
>
> http://www.mail-archive.com/linuxppc-dev@lists.ozlabs.org/msg21196.html
>
> It was received coldly though:
>
> http://www.mail-archive.com/linuxppc-dev@lists.ozlabs.org/msg22041.html
> http://www.mail-archive.com/linuxppc-dev@lists.ozlabs.org/msg21273.html
On that note, device-tree-style of_match_table binding now works for
i2c devices, so the problems you were having with that thread should
now be solved.
The of_find_i2c_driver() approach was only ever a heuristic to get
things working in the short term. of_match_table is is better in the
long run.
g.
^ permalink raw reply
* Re: [patch 00/14] Sort out i8253 and PC speaker locking and headers
From: Gerhard Pircher @ 2011-06-03 19:22 UTC (permalink / raw)
To: Ralf Baechle
Cc: linux-arch, linux-mips, linux-kernel, linux-alpha, tglx,
linuxppc-dev
In-Reply-To: <20110603180038.GA13239@linux-mips.org>
-------- Original-Nachricht --------
> Datum: Fri, 3 Jun 2011 19:00:38 +0100
> Von: Ralf Baechle <ralf@linux-mips.org>
> An: Gerhard Pircher <gerhard_pircher@gmx.net>
> CC: linux-mips@linux-mips.org, linuxppc-dev@lists.ozlabs.org, linux-alpha@vger.kernel.org, linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org, Thomas Gleixner <tglx@linutronix.de>, Benjamin Herrenschmidt <benh@kernel.crashing.org>
> Betreff: Re: [patch 00/14] Sort out i8253 and PC speaker locking and headers
> On Thu, Jun 02, 2011 at 09:11:19PM +0200, Gerhard Pircher wrote:
>
> > > #if defined(CONFIG_MIPS) || defined(CONFIG_X86)
> > > /* Use the global PIT lock ! */
> > > #include <asm/i8253.h>
> > > #else
> > > #include <asm/8253pit.h>
> > > static DEFINE_RAW_SPINLOCK(i8253_lock);
> > > #endif
> > >
> > > sound/drivers/pcsp/pcsp.h:
> > >
> > > #if defined(CONFIG_MIPS) || defined(CONFIG_X86)
> > > /* Use the global PIT lock ! */
> > > #include <asm/i8253.h>
> > > #else
> > > #include <asm/8253pit.h>
> > > static DEFINE_RAW_SPINLOCK(i8253_lock);
> > >
> > > $ git grep -F pcsp.h sound/drivers/pcsp
> > > sound/drivers/pcsp/pcsp.c:#include "pcsp.h"
> > > sound/drivers/pcsp/pcsp_input.c:#include "pcsp.h"
> > > sound/drivers/pcsp/pcsp_lib.c:#include "pcsp.h"
> > > sound/drivers/pcsp/pcsp_mixer.c:#include "pcsp.h"
> > > $ git grep -w i8253_lock sound/drivers/pcsp/
> > > sound/drivers/pcsp/pcsp.h:static DEFINE_RAW_SPINLOCK(i8253_lock);
> > > sound/drivers/pcsp/pcsp_input.c:
> raw_spin_lock_irqsave(&i8253_lock,
> > > flags
> > > sound/drivers/pcsp/pcsp_input.c:
> > > raw_spin_unlock_irqrestore(&i8253_lock,
> > > sound/drivers/pcsp/pcsp_lib.c:
> raw_spin_lock_irqsave(&i8253_lock,
> > > flags
> > > sound/drivers/pcsp/pcsp_lib.c:
> > > raw_spin_unlock_irqrestore(&i8253_lock,
> > > sound/drivers/pcsp/pcsp_lib.c: raw_spin_lock(&i8253_lock);
> > > sound/drivers/pcsp/pcsp_lib.c: raw_spin_unlock(&i8253_lock);
> > > sound/drivers/pcsp/pcsp_lib.c: raw_spin_lock(&i8253_lock);
> > > sound/drivers/pcsp/pcsp_lib.c: raw_spin_unlock(&i8253_lock);
> > >
> > > Locks are great, everybody should have their own lock!
> > >
> > > $ find . -name 8253pit.h
> > > ./arch/powerpc/include/asm/8253pit.h
> > > ./arch/alpha/include/asm/8253pit.h
> > > $ cat arch/*/include/asm/8253pit.h
> > > /*
> > > * 8253/8254 Programmable Interval Timer
> > > */
> > > /*
> > > * 8253/8254 Programmable Interval Timer
> > > */
> > > $
> > >
> > > Eh...
> > >
> > > $ git grep -w PCSPKR_PLATFORM
> > > arch/mips/Kconfig: select PCSPKR_PLATFORM
> > > arch/mips/Kconfig: select PCSPKR_PLATFORM
> > > arch/mips/Kconfig: select PCSPKR_PLATFORM
> > > arch/powerpc/platforms/amigaone/Kconfig: select PCSPKR_PLATFORM
> > > drivers/input/misc/Kconfig: depends on PCSPKR_PLATFORM
> > > init/Kconfig:config PCSPKR_PLATFORM
> > > sound/drivers/Kconfig: depends on PCSPKR_PLATFORM && X86 &&
> > > HIGH_RES_TIMERS
> > >
> > > So the status is:
> > >
> > > Alpha: There is no PCSPKR_PLATFORM so while a platform device is
> > > being installed no drivers will be built. I don't know
> > > which Alpha platforms or even if all of Alpha should be
> > > doing a PCSPKR_PLATFORM so I haven't even tried to sort
> > > this.
> > > ARM: No PC speaker supported, yeah :)
> > > PowerPC: Should compile but the locking is wrong but only the
> > > AmigaOne platforms should be affected.
> > The Kconfig dependencies cleanup patch for CHRP, PSERIES, etc. should
> > also apply to the AmigaOne. Can you resend it with a fix for the
> > AmigaOne, or should I send a patch?
>
> I can sort that; it's easy enough.
Thanks a lot!
> > I'll check next week, if the PC speaker is still working on my
> > AmigaOne.
>
> I can't imagine that it's going to break - the code is sorta simple ;-)
That's true, but testing the most recent Linux kernel on the AmigaOne is
never wrong. :-)
> One obscurity I noticed is this bit in the amigaone.dts:
>
> timer@40 {
> // Also adds pcspkr to platform devices.
> compatible = "pnpPNP,100";
> reg = <1 0x00000040 0x00000020>;
> };
>
> Shouldn't that rather be something like the following?
>
> pcspeaker@61 {
> device_type = "sound";
> compatible = "pnpPNP,800";
> reg = <1 0x61 1>;
> };
>
> pnpPNP,100 is the i8253 timer as I understand and pnpPNP,800 the PC
> speaker.
> If you interpret pnpPNP,100 to imply the presence of a PC speaker you
> can't express a system that has a i8253 but no PCspeaker in a DT so
> maybe amigaone.dts and arch/powerpc/kernel/setup-common.c should be
> changed to use pnpPNP,800 instead?
That would be cleaner, but I guess it would break CHRP and PSERIES.
These platforms probably only provide a pnpPNP,100 entry in the device
tree (at least that's the case on the Pegasos2 CHRP machine AFAICT).
Gerhard
--
NEU: FreePhone - kostenlos mobil telefonieren!
Jetzt informieren: http://www.gmx.net/de/go/freephone
^ permalink raw reply
* [PATCH v4 11/13] powerpc: select HAVE_SECCOMP_FILTER and provide seccomp_execve
From: Will Drewry @ 2011-06-03 20:34 UTC (permalink / raw)
To: linux-kernel
Cc: Will Drewry, linuxppc-dev, jmorris, rostedt, tglx, Paul Mackerras,
kees.cook, paulmck, torvalds, mingo
In-Reply-To: <1307133252-23259-1-git-send-email-wad@chromium.org>
Facilitate the use of CONFIG_SECCOMP_FILTER by wrapping compatibility
system call numbering for execve and selecting HAVE_SECCOMP_FILTER.
Signed-off-by: Will Drewry <wad@chromium.org>
---
arch/powerpc/Kconfig | 1 +
arch/powerpc/include/asm/seccomp.h | 2 ++
2 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 8f4d50b..0bd4574 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -137,6 +137,7 @@ config PPC
select HAVE_HW_BREAKPOINT if PERF_EVENTS && PPC_BOOK3S_64
select HAVE_GENERIC_HARDIRQS
select HAVE_SPARSE_IRQ
+ select HAVE_SECCOMP_FILTER
select IRQ_PER_CPU
select GENERIC_IRQ_SHOW
select GENERIC_IRQ_SHOW_LEVEL
diff --git a/arch/powerpc/include/asm/seccomp.h b/arch/powerpc/include/asm/seccomp.h
index 00c1d91..3cb9cc1 100644
--- a/arch/powerpc/include/asm/seccomp.h
+++ b/arch/powerpc/include/asm/seccomp.h
@@ -7,10 +7,12 @@
#define __NR_seccomp_write __NR_write
#define __NR_seccomp_exit __NR_exit
#define __NR_seccomp_sigreturn __NR_rt_sigreturn
+#define __NR_seccomp_execve __NR_execve
#define __NR_seccomp_read_32 __NR_read
#define __NR_seccomp_write_32 __NR_write
#define __NR_seccomp_exit_32 __NR_exit
#define __NR_seccomp_sigreturn_32 __NR_sigreturn
+#define __NR_seccomp_execve_32 __NR_execve
#endif /* _ASM_POWERPC_SECCOMP_H */
--
1.7.0.4
^ permalink raw reply related
* [PATCH 7/7] [v3] drivers/misc: introduce Freescale hypervisor management driver
From: Timur Tabi @ 2011-06-03 20:47 UTC (permalink / raw)
To: alan, arnd, kumar.gala, benh, greg, akpm, linuxppc-dev,
linux-kernel, linux-console
The Freescale hypervisor management driver provides several services to
drivers and applications related to the Freescale hypervisor:
1. An ioctl interface for querying and managing partitions
2. A file interface to reading incoming doorbells
3. An interrupt handler for shutting down the partition upon receiving the
shutdown doorbell from a manager partition
4. An interface for receiving callbacks when a managed partition shuts down.
Signed-off-by: Timur Tabi <timur@freescale.com>
---
drivers/misc/Kconfig | 7 +
drivers/misc/Makefile | 1 +
drivers/misc/fsl_hypervisor.c | 954 ++++++++++++++++++++++++++++++++++++++++
include/linux/Kbuild | 1 +
include/linux/fsl_hypervisor.h | 214 +++++++++
5 files changed, 1177 insertions(+), 0 deletions(-)
create mode 100644 drivers/misc/fsl_hypervisor.c
create mode 100644 include/linux/fsl_hypervisor.h
diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
index d80dcde..3e016b3 100644
--- a/drivers/misc/Kconfig
+++ b/drivers/misc/Kconfig
@@ -216,6 +216,13 @@ config ENCLOSURE_SERVICES
driver (SCSI/ATA) which supports enclosures
or a SCSI enclosure device (SES) to use these services.
+config FSL_HV_MANAGER
+ tristate "Freescale hypervisor management driver"
+ depends on FSL_SOC
+ help
+ This driver allows applications to communicate with the Freescale
+ Hypervisor.
+
config SGI_XP
tristate "Support communication between SGI SSIs"
depends on NET
diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile
index 848e846..d93bd76 100644
--- a/drivers/misc/Makefile
+++ b/drivers/misc/Makefile
@@ -20,6 +20,7 @@ obj-$(CONFIG_SENSORS_BH1770) += bh1770glc.o
obj-$(CONFIG_SENSORS_APDS990X) += apds990x.o
obj-$(CONFIG_SGI_IOC4) += ioc4.o
obj-$(CONFIG_ENCLOSURE_SERVICES) += enclosure.o
+obj-$(CONFIG_FSL_HV_MANAGER) += fsl_hypervisor.o
obj-$(CONFIG_KGDB_TESTS) += kgdbts.o
obj-$(CONFIG_SGI_XP) += sgi-xp/
obj-$(CONFIG_SGI_GRU) += sgi-gru/
diff --git a/drivers/misc/fsl_hypervisor.c b/drivers/misc/fsl_hypervisor.c
new file mode 100644
index 0000000..64d38379
--- /dev/null
+++ b/drivers/misc/fsl_hypervisor.c
@@ -0,0 +1,954 @@
+/*
+ * Freescale Hypervisor Management Driver
+
+ * Copyright (C) 2008-2011 Freescale Semiconductor, Inc.
+ * Author: Timur Tabi <timur@freescale.com>
+ *
+ * This file is licensed under the terms of the GNU General Public License
+ * version 2. This program is licensed "as is" without any warranty of any
+ * kind, whether express or implied.
+ *
+ * This driver contains functions to support the Freescale hypervisor.
+ */
+
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/types.h>
+#include <linux/err.h>
+#include <linux/fs.h>
+#include <linux/miscdevice.h>
+#include <linux/mm.h>
+#include <linux/pagemap.h>
+#include <linux/slab.h>
+#include <linux/poll.h>
+#include <linux/of.h>
+#include <linux/reboot.h>
+#include <linux/uaccess.h>
+#include <linux/notifier.h>
+
+#include <linux/io.h>
+#include <asm/fsl_hcalls.h>
+
+#include <linux/fsl_hypervisor.h>
+
+static BLOCKING_NOTIFIER_HEAD(failover_subscribers);
+
+/*
+ * Ioctl interface for FSL_HV_IOCTL_PARTITION_RESTART
+ *
+ * Restart a running partition
+ */
+static long ioctl_restart(struct fsl_hv_ioctl_restart __user *p)
+{
+ struct fsl_hv_ioctl_restart param;
+
+ /* Get the parameters from the user */
+ if (copy_from_user(¶m, p, sizeof(struct fsl_hv_ioctl_restart)))
+ return -EFAULT;
+
+ param.ret = fh_partition_restart(param.partition);
+
+ if (copy_to_user(&p->ret, ¶m.ret, sizeof(__u32)))
+ return -EFAULT;
+
+ return 0;
+}
+
+/*
+ * Ioctl interface for FSL_HV_IOCTL_PARTITION_STATUS
+ *
+ * Query the status of a partition
+ */
+static long ioctl_status(struct fsl_hv_ioctl_status __user *p)
+{
+ struct fsl_hv_ioctl_status param;
+ u32 status;
+
+ /* Get the parameters from the user */
+ if (copy_from_user(¶m, p, sizeof(struct fsl_hv_ioctl_status)))
+ return -EFAULT;
+
+ param.ret = fh_partition_get_status(param.partition, &status);
+ if (!param.ret)
+ param.status = status;
+
+ if (copy_to_user(p, ¶m, sizeof(struct fsl_hv_ioctl_status)))
+ return -EFAULT;
+
+ return 0;
+}
+
+/*
+ * Ioctl interface for FSL_HV_IOCTL_PARTITION_START
+ *
+ * Start a stopped partition.
+ */
+static long ioctl_start(struct fsl_hv_ioctl_start __user *p)
+{
+ struct fsl_hv_ioctl_start param;
+
+ /* Get the parameters from the user */
+ if (copy_from_user(¶m, p, sizeof(struct fsl_hv_ioctl_start)))
+ return -EFAULT;
+
+ param.ret = fh_partition_start(param.partition, param.entry_point,
+ param.load);
+
+ if (copy_to_user(&p->ret, ¶m.ret, sizeof(__u32)))
+ return -EFAULT;
+
+ return 0;
+}
+
+/*
+ * Ioctl interface for FSL_HV_IOCTL_PARTITION_STOP
+ *
+ * Stop a running partition
+ */
+static long ioctl_stop(struct fsl_hv_ioctl_stop __user *p)
+{
+ struct fsl_hv_ioctl_stop param;
+
+ /* Get the parameters from the user */
+ if (copy_from_user(¶m, p, sizeof(struct fsl_hv_ioctl_stop)))
+ return -EFAULT;
+
+ param.ret = fh_partition_stop(param.partition);
+
+ if (copy_to_user(&p->ret, ¶m.ret, sizeof(__u32)))
+ return -EFAULT;
+
+ return 0;
+}
+
+/*
+ * Ioctl interface for FSL_HV_IOCTL_MEMCPY
+ *
+ * The FH_MEMCPY hypercall takes an array of address/address/size structures
+ * to represent the data being copied. As a convenience to the user, this
+ * ioctl takes a user-create buffer and a pointer to a guest physically
+ * contiguous buffer in the remote partition, and creates the
+ * address/address/size array for the hypercall.
+ */
+static long ioctl_memcpy(struct fsl_hv_ioctl_memcpy __user *p)
+{
+ struct fsl_hv_ioctl_memcpy param;
+
+ struct page **pages = NULL;
+ void *sg_list_unaligned = NULL;
+ struct fh_sg_list *sg_list = NULL;
+
+ unsigned int num_pages;
+ unsigned long lb_offset; /* Offset within a page of the local buffer */
+
+ unsigned int i;
+ long ret = 0;
+ int num_pinned; /* return value from get_user_pages() */
+ phys_addr_t remote_paddr; /* The next address in the remote buffer */
+ uint32_t count; /* The number of bytes left to copy */
+
+ /* Get the parameters from the user */
+ if (copy_from_user(¶m, p, sizeof(struct fsl_hv_ioctl_memcpy)))
+ return -EFAULT;
+
+ /* One partition must be local, the other must be remote. In other
+ words, if source and target are both -1, or are both not -1, then
+ return an error. */
+ if ((param.source == -1) == (param.target == -1))
+ return -EINVAL;
+
+ /*
+ * The array of pages returned by get_user_pages() covers only
+ * page-aligned memory. Since the user buffer is probably not
+ * page-aligned, we need to handle the discrepancy.
+ *
+ * We calculate the offset within a page of the S/G list, and make
+ * adjustments accordingly. This will result in a page list that looks
+ * like this:
+ *
+ * ---- <-- first page starts before the buffer
+ * | |
+ * |////|-> ----
+ * |////| | |
+ * ---- | |
+ * | |
+ * ---- | |
+ * |////| | |
+ * |////| | |
+ * |////| | |
+ * ---- | |
+ * | |
+ * ---- | |
+ * |////| | |
+ * |////| | |
+ * |////| | |
+ * ---- | |
+ * | |
+ * ---- | |
+ * |////| | |
+ * |////|-> ----
+ * | | <-- last page ends after the buffer
+ * ----
+ *
+ * The distance between the start of the first page and the start of the
+ * buffer is lb_offset. The hashed (///) areas are the parts of the
+ * page list that contain the actual buffer.
+ *
+ * The advantage of this approach is that the number of pages is
+ * equal to the number of entries in the S/G list that we give to the
+ * hypervisor.
+ */
+ lb_offset = param.local_vaddr & (PAGE_SIZE - 1);
+ num_pages = (param.count + lb_offset + PAGE_SIZE - 1) >> PAGE_SHIFT;
+
+ /* Allocate the buffers we need */
+
+ /* pages is an array of struct page pointers that's initialized by
+ get_user_pages() */
+ pages = kzalloc(num_pages * sizeof(struct page *), GFP_KERNEL);
+ if (!pages) {
+ pr_debug("fsl-hv: could not allocate page list\n");
+ return -ENOMEM;
+ }
+
+ /* sg_list is the list of fh_sg_list objects that we pass to the
+ hypervisor */
+ sg_list_unaligned = kmalloc(num_pages * sizeof(struct fh_sg_list) +
+ sizeof(struct fh_sg_list) - 1, GFP_KERNEL);
+ if (!sg_list_unaligned) {
+ pr_debug("fsl-hv: could not allocate S/G list\n");
+ ret = -ENOMEM;
+ goto exit;
+ }
+ sg_list = PTR_ALIGN(sg_list_unaligned, sizeof(struct fh_sg_list));
+
+ /* Get the physical addresses of the source buffer */
+ down_read(¤t->mm->mmap_sem);
+ num_pinned = get_user_pages(current, current->mm,
+ param.local_vaddr - lb_offset, num_pages,
+ (param.source == -1) ? READ : WRITE,
+ 0, pages, NULL);
+ up_read(¤t->mm->mmap_sem);
+
+ if (num_pinned != num_pages) {
+ /* get_user_pages() failed */
+ pr_debug("fsl-hv: could not lock source buffer\n");
+ ret = (num_pinned < 0) ? num_pinned : -EFAULT;
+ goto exit;
+ }
+
+ /*
+ * Build the fh_sg_list[] array. The first page is special
+ * because it's misaligned.
+ */
+ if (param.source == -1) {
+ sg_list[0].source = page_to_phys(pages[0]) + lb_offset;
+ sg_list[0].target = param.remote_paddr;
+ } else {
+ sg_list[0].source = param.remote_paddr;
+ sg_list[0].target = page_to_phys(pages[0]) + lb_offset;
+ }
+ sg_list[0].size = min_t(uint64_t, param.count, PAGE_SIZE - lb_offset);
+
+ remote_paddr = param.remote_paddr + sg_list[0].size;
+ count = param.count - sg_list[0].size;
+
+ for (i = 1; i < num_pages; i++) {
+ if (param.source == -1) {
+ /* local to remote */
+ sg_list[i].source = page_to_phys(pages[i]);
+ sg_list[i].target = remote_paddr;
+ } else {
+ /* remote to local */
+ sg_list[i].source = remote_paddr;
+ sg_list[i].target = page_to_phys(pages[i]);
+ }
+ sg_list[i].size = min_t(uint64_t, count, PAGE_SIZE);
+
+ remote_paddr += sg_list[i].size;
+ count -= sg_list[i].size;
+ }
+
+ param.ret = fh_partition_memcpy(param.source, param.target,
+ virt_to_phys(sg_list), num_pages);
+
+exit:
+ if (pages) {
+ for (i = 0; i < num_pages; i++)
+ if (pages[i])
+ put_page(pages[i]);
+ }
+
+ kfree(sg_list_unaligned);
+ kfree(pages);
+
+ if (!ret)
+ if (copy_to_user(&p->ret, ¶m.ret, sizeof(__u32)))
+ return -EFAULT;
+
+ return ret;
+}
+
+/*
+ * Ioctl interface for FSL_HV_IOCTL_DOORBELL
+ *
+ * Ring a doorbell
+ */
+static long ioctl_doorbell(struct fsl_hv_ioctl_doorbell __user *p)
+{
+ struct fsl_hv_ioctl_doorbell param;
+
+ /* Get the parameters from the user */
+ if (copy_from_user(¶m, p, sizeof(struct fsl_hv_ioctl_doorbell)))
+ return -EFAULT;
+
+ param.ret = ev_doorbell_send(param.doorbell);
+
+ if (copy_to_user(&p->ret, ¶m.ret, sizeof(__u32)))
+ return -EFAULT;
+
+ return 0;
+}
+
+static long ioctl_dtprop(struct fsl_hv_ioctl_prop __user *p, int set)
+{
+ struct fsl_hv_ioctl_prop param;
+ char __user *upath, *upropname;
+ void __user *upropval;
+ char *path = NULL, *propname = NULL;
+ void *propval = NULL;
+ int ret = 0;
+
+ /* Get the parameters from the user */
+ if (copy_from_user(¶m, p, sizeof(struct fsl_hv_ioctl_prop)))
+ return -EFAULT;
+
+ upath = (char __user *)(uintptr_t)param.path;
+ upropname = (char __user *)(uintptr_t)param.propname;
+ upropval = (void __user *)(uintptr_t)param.propval;
+
+ path = strndup_user(upath, FH_DTPROP_MAX_PATHLEN);
+ if (IS_ERR(path)) {
+ ret = PTR_ERR(path);
+ goto out;
+ }
+
+ propname = strndup_user(upropname, FH_DTPROP_MAX_PATHLEN);
+ if (IS_ERR(propname)) {
+ ret = PTR_ERR(propname);
+ goto out;
+ }
+
+ if (param.proplen > FH_DTPROP_MAX_PROPLEN) {
+ ret = -EINVAL;
+ goto out;
+ }
+
+ propval = kmalloc(param.proplen, GFP_KERNEL);
+ if (!propval) {
+ ret = -ENOMEM;
+ goto out;
+ }
+
+ if (set) {
+ if (copy_from_user(propval, upropval, param.proplen)) {
+ ret = -EFAULT;
+ goto out;
+ }
+
+ param.ret = fh_partition_set_dtprop(param.handle,
+ virt_to_phys(path),
+ virt_to_phys(propname),
+ virt_to_phys(propval),
+ param.proplen);
+ } else {
+ param.ret = fh_partition_get_dtprop(param.handle,
+ virt_to_phys(path),
+ virt_to_phys(propname),
+ virt_to_phys(propval),
+ ¶m.proplen);
+
+ if (param.ret == 0) {
+ if (copy_to_user(upropval, propval, param.proplen) ||
+ put_user(param.proplen, &p->proplen)) {
+ ret = -EFAULT;
+ goto out;
+ }
+ }
+ }
+
+ if (put_user(param.ret, &p->ret))
+ ret = -EFAULT;
+
+out:
+ kfree(path);
+ kfree(propval);
+ kfree(propname);
+
+ return ret;
+}
+
+/*
+ * Ioctl main entry point
+ */
+static long fsl_hv_ioctl(struct file *file, unsigned int cmd,
+ unsigned long argaddr)
+{
+ void __user *arg = (void __user *)argaddr;
+ long ret;
+ size_t size;
+
+ /* Make sure the application is called the right driver. */
+ if (_IOC_TYPE(cmd) != 0) {
+ pr_debug("fsl-hv: ioctl type %u should be 0\n", _IOC_TYPE(cmd));
+ return -EINVAL;
+ }
+
+ /* Make sure the application set the direction flag correctly. */
+ if (_IOC_DIR(cmd) != (_IOC_READ | _IOC_WRITE)) {
+ pr_debug("fsl-hv: ioctl direction should be _IOWR\n");
+ return -EINVAL;
+ }
+
+ /*
+ * Make sure the application is passing the right structure to us.
+ * For backwards compatibility with older applications, we only check
+ * if the size is too small, rather than unequal.
+ */
+
+ switch (_IOC_NR(cmd)) {
+ case FSL_HV_IOCTL_PARTITION_RESTART:
+ size = sizeof(struct fsl_hv_ioctl_restart);
+ if (_IOC_SIZE(cmd) < size)
+ goto size_error;
+ ret = ioctl_restart(arg);
+ break;
+ case FSL_HV_IOCTL_PARTITION_GET_STATUS:
+ size = sizeof(struct fsl_hv_ioctl_status);
+ if (_IOC_SIZE(cmd) < size)
+ goto size_error;
+ ret = ioctl_status(arg);
+ break;
+ case FSL_HV_IOCTL_PARTITION_START:
+ size = sizeof(struct fsl_hv_ioctl_start);
+ if (_IOC_SIZE(cmd) < size)
+ goto size_error;
+ ret = ioctl_start(arg);
+ break;
+ case FSL_HV_IOCTL_PARTITION_STOP:
+ size = sizeof(struct fsl_hv_ioctl_stop);
+ if (_IOC_SIZE(cmd) < size)
+ goto size_error;
+ ret = ioctl_stop(arg);
+ break;
+ case FSL_HV_IOCTL_MEMCPY:
+ size = sizeof(struct fsl_hv_ioctl_memcpy);
+ if (_IOC_SIZE(cmd) < size)
+ goto size_error;
+ ret = ioctl_memcpy(arg);
+ break;
+ case FSL_HV_IOCTL_DOORBELL:
+ size = sizeof(struct fsl_hv_ioctl_doorbell);
+ if (_IOC_SIZE(cmd) < size)
+ goto size_error;
+ ret = ioctl_doorbell(arg);
+ break;
+ case FSL_HV_IOCTL_GETPROP:
+ size = sizeof(struct fsl_hv_ioctl_prop);
+ if (_IOC_SIZE(cmd) < size)
+ goto size_error;
+ ret = ioctl_dtprop(arg, 0);
+ break;
+ case FSL_HV_IOCTL_SETPROP:
+ size = sizeof(struct fsl_hv_ioctl_prop);
+ if (_IOC_SIZE(cmd) < size)
+ goto size_error;
+ ret = ioctl_dtprop(arg, 1);
+ break;
+ default:
+ pr_debug("fsl-hv: unknown ioctl %u\n", _IOC_NR(cmd));
+ return -ENOTTY;
+ }
+
+ return ret;
+
+size_error:
+ pr_debug("fsl-hv: ioctl %u parameter size %u should be %zu\n",
+ _IOC_NR(cmd), _IOC_SIZE(cmd), size);
+ return -EINVAL;
+}
+
+/* Linked list of processes that have us open */
+static struct list_head db_list;
+
+/* spinlock for db_list */
+static DEFINE_SPINLOCK(db_list_lock);
+
+/* The size of the doorbell event queue. This must be a power of two. */
+#define QSIZE 16
+
+/* Returns the next head/tail pointer, wrapping around the queue if necessary */
+#define nextp(x) (((x) + 1) & (QSIZE - 1))
+
+/* Per-open data structure */
+struct doorbell_queue {
+ struct list_head list;
+ spinlock_t lock;
+ wait_queue_head_t wait;
+ unsigned int head;
+ unsigned int tail;
+ uint32_t q[QSIZE];
+};
+
+/* Linked list of ISRs that we registered */
+struct list_head isr_list;
+
+/* Per-ISR data structure */
+struct doorbell_isr {
+ struct list_head list;
+ unsigned int irq;
+ uint32_t doorbell; /* The doorbell handle */
+ uint32_t partition; /* The partition handle, if used */
+};
+
+/*
+ * Add a doorbell to all of the doorbell queues
+ */
+static void fsl_hv_queue_doorbell(uint32_t doorbell)
+{
+ struct doorbell_queue *dbq;
+ unsigned long flags;
+
+ /* Prevent another core from modifying db_list */
+ spin_lock_irqsave(&db_list_lock, flags);
+
+ list_for_each_entry(dbq, &db_list, list) {
+ if (dbq->head != nextp(dbq->tail)) {
+ dbq->q[dbq->tail] = doorbell;
+ /* This memory barrier eliminates the need to grab
+ * the spinlock for dbq. */
+ smp_wmb();
+ dbq->tail = nextp(dbq->tail);
+ wake_up_interruptible(&dbq->wait);
+ }
+ }
+
+ spin_unlock_irqrestore(&db_list_lock, flags);
+}
+
+/*
+ * Interrupt handler for all doorbells
+ *
+ * We use the same interrupt handler for all doorbells. Whenever a doorbell
+ * is rung, and we receive an interrupt, we just put the handle for that
+ * doorbell (passed to us as *data) into all of the queues.
+ */
+static irqreturn_t fsl_hv_isr(int irq, void *data)
+{
+ fsl_hv_queue_doorbell((uintptr_t) data);
+
+ return IRQ_HANDLED;
+}
+
+/*
+ * State change thread function
+ *
+ * The state change notification arrives in an interrupt, but we can't call
+ * blocking_notifier_call_chain() in an interrupt handler. We could call
+ * atomic_notifier_call_chain(), but that would require the clients' call-back
+ * function to run in interrupt context. Since we don't want to impose that
+ * restriction on the clients, we use a threaded IRQ to process the
+ * notification in kernel context.
+ */
+static irqreturn_t fsl_hv_state_change_thread(int irq, void *data)
+{
+ struct doorbell_isr *dbisr = data;
+
+ blocking_notifier_call_chain(&failover_subscribers, dbisr->partition,
+ NULL);
+
+ return IRQ_HANDLED;
+}
+
+/*
+ * Interrupt handler for state-change doorbells
+ */
+static irqreturn_t fsl_hv_state_change_isr(int irq, void *data)
+{
+ unsigned int status;
+ struct doorbell_isr *dbisr = data;
+ int ret;
+
+ /* It's still a doorbell, so add it to all the queues */
+ fsl_hv_queue_doorbell(dbisr->doorbell);
+
+ /* Determine the new state, and if it's stopped, notify the clients. */
+ ret = fh_partition_get_status(dbisr->partition, &status);
+ if (!ret && (status == FH_PARTITION_STOPPED))
+ return IRQ_WAKE_THREAD;
+
+ return IRQ_HANDLED;
+}
+
+/**
+ * fsl_hv_poll - returns a bitmask indicating whether a read will block
+ *
+ * @return unsigned int
+ */
+static unsigned int fsl_hv_poll(struct file *filp, struct poll_table_struct *p)
+{
+ struct doorbell_queue *dbq = filp->private_data;
+ unsigned long flags;
+ unsigned int mask;
+
+ spin_lock_irqsave(&dbq->lock, flags);
+
+ poll_wait(filp, &dbq->wait, p);
+ mask = (dbq->head == dbq->tail) ? 0 : (POLLIN | POLLRDNORM);
+
+ spin_unlock_irqrestore(&dbq->lock, flags);
+
+ return mask;
+}
+
+/**
+ * fsl_hv_read - return the handles for any incoming doorbells
+ *
+ * If there are doorbell handles in the queue for this open instance, then
+ * return them to the caller as an array of 32-bit integers. Otherwise,
+ * block until there is at least one handle to return.
+ */
+static ssize_t fsl_hv_read(struct file *filp, char __user *buf, size_t len,
+ loff_t *off)
+{
+ struct doorbell_queue *dbq = filp->private_data;
+ uint32_t __user *p = (uint32_t __user *) buf; /* for put_user() */
+ unsigned long flags;
+ ssize_t count = 0;
+
+ /* Make sure we stop when the user buffer is full. */
+ while (len >= sizeof(uint32_t)) {
+ uint32_t dbell; /* Local copy of doorbell queue data */
+
+ spin_lock_irqsave(&dbq->lock, flags);
+
+ /* If the queue is empty, then either we're done or we need
+ * to block. If the application specified O_NONBLOCK, then
+ * we return the appropriate error code.
+ */
+ if (dbq->head == dbq->tail) {
+ spin_unlock_irqrestore(&dbq->lock, flags);
+ if (count)
+ break;
+ if (filp->f_flags & O_NONBLOCK)
+ return -EAGAIN;
+ if (wait_event_interruptible(dbq->wait,
+ dbq->head != dbq->tail))
+ return -ERESTARTSYS;
+ continue;
+ }
+
+ /* Even though we have an smp_wmb() in the ISR, the core
+ * might speculatively execute the "dbell = ..." below while
+ * it's evaluating the if-statement above. In that case, the
+ * value put into dbell could be stale if the core accepts the
+ * speculation. To prevent that, we need a read memory barrier
+ * here as well.
+ */
+ smp_rmb();
+
+ /* Copy the data to a temporary local buffer, because
+ * we can't call copy_to_user() from inside a spinlock
+ */
+ dbell = dbq->q[dbq->head];
+ dbq->head = nextp(dbq->head);
+
+ spin_unlock_irqrestore(&dbq->lock, flags);
+
+ if (put_user(dbell, p))
+ return -EFAULT;
+ p++;
+ count += sizeof(uint32_t);
+ len -= sizeof(uint32_t);
+ }
+
+ return count;
+}
+
+/**
+ * fsl_hv_open - open the driver
+ *
+ * Open the driver and prepare for reading doorbells.
+ *
+ * Every time an application opens the driver, we create a doorbell queue
+ * for that file handle. This queue is used for any incoming doorbells.
+ */
+static int fsl_hv_open(struct inode *inode, struct file *filp)
+{
+ struct doorbell_queue *dbq;
+ unsigned long flags;
+ int ret = 0;
+
+ dbq = kzalloc(sizeof(struct doorbell_queue), GFP_KERNEL);
+ if (!dbq) {
+ pr_err("fsl-hv: out of memory\n");
+ return -ENOMEM;
+ }
+
+ spin_lock_init(&dbq->lock);
+ init_waitqueue_head(&dbq->wait);
+
+ spin_lock_irqsave(&db_list_lock, flags);
+ list_add(&dbq->list, &db_list);
+ spin_unlock_irqrestore(&db_list_lock, flags);
+
+ filp->private_data = dbq;
+
+ return ret;
+}
+
+/**
+ * fsl_hv_close - close the driver
+ */
+static int fsl_hv_close(struct inode *inode, struct file *filp)
+{
+ struct doorbell_queue *dbq = filp->private_data;
+ unsigned long flags;
+
+ int ret = 0;
+
+ spin_lock_irqsave(&db_list_lock, flags);
+ list_del(&dbq->list);
+ spin_unlock_irqrestore(&db_list_lock, flags);
+
+ kfree(dbq);
+
+ return ret;
+}
+
+static const struct file_operations fsl_hv_fops = {
+ .owner = THIS_MODULE,
+ .open = fsl_hv_open,
+ .release = fsl_hv_close,
+ .poll = fsl_hv_poll,
+ .read = fsl_hv_read,
+ .unlocked_ioctl = fsl_hv_ioctl,
+};
+
+static struct miscdevice fsl_hv_misc_dev = {
+ MISC_DYNAMIC_MINOR,
+ "fsl-hv",
+ &fsl_hv_fops
+};
+
+static irqreturn_t fsl_hv_shutdown_isr(int irq, void *data)
+{
+ orderly_poweroff(false);
+
+ return IRQ_HANDLED;
+}
+
+/**
+ * get_parent_handle -- returns the handle of the parent of the given node
+ *
+ * The handle is the value of the 'reg' property
+ */
+static int get_parent_handle(struct device_node *np)
+{
+ struct device_node *parent;
+ const uint32_t *prop;
+ int len;
+
+ parent = of_get_parent(np);
+ if (!parent)
+ /* It's not really possible for this to fail */
+ return -ENODEV;
+
+ prop = of_get_property(parent, "reg", &len);
+ of_node_put(parent);
+
+ if (!prop || (len != sizeof(uint32_t)))
+ /* This can happen only if the node is malformed */
+ return -ENODEV;
+
+ return *prop;
+}
+
+/**
+ * fsl_hv_failover_register -- register a callback for failover events
+ *
+ * This function is called by device drivers to register their callback
+ * functions for fail-over events.
+ */
+int fsl_hv_failover_register(struct notifier_block *nb)
+{
+ return blocking_notifier_chain_register(&failover_subscribers, nb);
+}
+EXPORT_SYMBOL(fsl_hv_failover_register);
+
+/**
+ * fsl_hv_failover_unregister -- unregister a callback for failover events
+ */
+int fsl_hv_failover_unregister(struct notifier_block *nb)
+{
+ return blocking_notifier_chain_unregister(&failover_subscribers, nb);
+}
+EXPORT_SYMBOL(fsl_hv_failover_unregister);
+
+/**
+ * has_fsl_hypervisor - return TRUE if we're running under FSL hypervisor
+ *
+ * This function checks to see if we're running under the Freescale
+ * hypervisor, and returns zero if we're not, or non-zero if we are.
+ *
+ * First, it checks if MSR[GS]==1, which means we're running under some
+ * hypervisor. Then it checks if there is a hypervisor node in the device
+ * tree. Currently, that means there needs to be a node in the root called
+ * "hypervisor" and which has a property named "fsl,hv-version".
+ */
+static int has_fsl_hypervisor(void)
+{
+ struct device_node *node;
+ int ret;
+
+ if (!(mfmsr() & MSR_GS))
+ return 0;
+
+ node = of_find_node_by_path("/hypervisor");
+ if (!node)
+ return 0;
+
+ ret = of_find_property(node, "fsl,hv-version", NULL) != NULL;
+
+ of_node_put(node);
+
+ return ret;
+}
+
+/**
+ * fsl_hypervisor_init: Freescale hypervisor management driver init
+ *
+ * This function is called when this module is loaded.
+ *
+ * Register ourselves as a miscellaneous driver. This will register the
+ * fops structure and create the right sysfs entries for udev.
+ */
+static int __init fsl_hypervisor_init(void)
+{
+ struct device_node *np;
+ struct doorbell_isr *dbisr, *n;
+ int ret;
+
+ pr_info("Freescale hypervisor management driver\n");
+
+ if (!has_fsl_hypervisor()) {
+ pr_info("fsl-hv: no hypervisor found\n");
+ return -ENODEV;
+ }
+
+ ret = misc_register(&fsl_hv_misc_dev);
+ if (ret) {
+ pr_err("fsl-hv: cannot register device\n");
+ return ret;
+ }
+
+ INIT_LIST_HEAD(&db_list);
+ INIT_LIST_HEAD(&isr_list);
+
+ for_each_compatible_node(np, NULL, "epapr,hv-receive-doorbell") {
+ unsigned int irq;
+ const uint32_t *handle;
+
+ handle = of_get_property(np, "interrupts", NULL);
+ irq = irq_of_parse_and_map(np, 0);
+ if (!handle || (irq == NO_IRQ)) {
+ pr_err("fsl-hv: no 'interrupts' property in %s node\n",
+ np->full_name);
+ continue;
+ }
+
+ dbisr = kzalloc(sizeof(*dbisr), GFP_KERNEL);
+ if (!dbisr)
+ goto out_of_memory;
+
+ dbisr->irq = irq;
+ dbisr->doorbell = *handle;
+
+ if (of_device_is_compatible(np, "fsl,hv-shutdown-doorbell")) {
+ /* The shutdown doorbell gets its own ISR */
+ ret = request_irq(irq, fsl_hv_shutdown_isr, 0,
+ np->name, NULL);
+ } else if (of_device_is_compatible(np,
+ "fsl,hv-state-change-doorbell")) {
+ /* The state change doorbell triggers a notification if
+ * the state of the managed partition changes to
+ * "stopped". We need a separate interrupt handler for
+ * that, and we also need to know the handle of the
+ * target partition, not just the handle of the
+ * doorbell.
+ */
+ dbisr->partition = ret = get_parent_handle(np);
+ if (ret < 0) {
+ pr_err("fsl-hv: node %s has missing or "
+ "malformed parent\n", np->full_name);
+ kfree(dbisr);
+ continue;
+ }
+ ret = request_threaded_irq(irq, fsl_hv_state_change_isr,
+ fsl_hv_state_change_thread,
+ 0, np->name, dbisr);
+ } else
+ ret = request_irq(irq, fsl_hv_isr, 0, np->name, dbisr);
+
+ if (ret < 0) {
+ pr_err("fsl-hv: could not request irq %u for node %s\n",
+ irq, np->full_name);
+ kfree(dbisr);
+ continue;
+ }
+
+ list_add(&dbisr->list, &isr_list);
+
+ pr_info("fsl-hv: registered handler for doorbell %u\n",
+ *handle);
+ }
+
+ return 0;
+
+out_of_memory:
+ list_for_each_entry_safe(dbisr, n, &isr_list, list) {
+ free_irq(dbisr->irq, dbisr);
+ list_del(&dbisr->list);
+ kfree(dbisr);
+ }
+
+ misc_deregister(&fsl_hv_misc_dev);
+
+ return -ENOMEM;
+}
+
+/**
+ * fsl_hypervisor_exit: Freescale hypervisor management driver termination
+ *
+ * This function is called when this driver is unloaded.
+ */
+static void __exit fsl_hypervisor_exit(void)
+{
+ struct doorbell_isr *dbisr, *n;
+
+ list_for_each_entry_safe(dbisr, n, &isr_list, list) {
+ free_irq(dbisr->irq, dbisr);
+ list_del(&dbisr->list);
+ kfree(dbisr);
+ }
+
+ misc_deregister(&fsl_hv_misc_dev);
+}
+
+module_init(fsl_hypervisor_init);
+module_exit(fsl_hypervisor_exit);
+
+MODULE_AUTHOR("Timur Tabi <timur@freescale.com>");
+MODULE_DESCRIPTION("Freescale hypervisor management driver");
+MODULE_LICENSE("GPL v2");
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index 75cf611..68c341a 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -134,6 +134,7 @@ header-y += firewire-cdev.h
header-y += firewire-constants.h
header-y += flat.h
header-y += fs.h
+header-y += fsl_hypervisor.h
header-y += fuse.h
header-y += futex.h
header-y += gameport.h
diff --git a/include/linux/fsl_hypervisor.h b/include/linux/fsl_hypervisor.h
new file mode 100644
index 0000000..4d1e11a
--- /dev/null
+++ b/include/linux/fsl_hypervisor.h
@@ -0,0 +1,214 @@
+/*
+ * Freescale hypervisor ioctl interface
+ *
+ * Copyright (C) 2008-2011 Freescale Semiconductor, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Freescale Semiconductor nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ *
+ * ALTERNATIVELY, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") as published by the Free Software
+ * Foundation, either version 2 of that License or (at your option) any
+ * later version.
+ *
+ * This software is provided by Freescale Semiconductor "as is" and any
+ * express or implied warranties, including, but not limited to, the implied
+ * warranties of merchantability and fitness for a particular purpose are
+ * disclaimed. In no event shall Freescale Semiconductor be liable for any
+ * direct, indirect, incidental, special, exemplary, or consequential damages
+ * (including, but not limited to, procurement of substitute goods or services;
+ * loss of use, data, or profits; or business interruption) however caused and
+ * on any theory of liability, whether in contract, strict liability, or tort
+ * (including negligence or otherwise) arising in any way out of the use of this
+ * software, even if advised of the possibility of such damage.
+ *
+ * This file is used by the Freescale hypervisor management driver. It can
+ * also be included by applications that need to communicate with the driver
+ * via the ioctl interface.
+ */
+
+#ifndef FSL_HYPERVISOR_H
+#define FSL_HYPERVISOR_H
+
+#include <linux/types.h>
+
+/**
+ * struct fsl_hv_ioctl_restart: restart a partition
+ * @ret: return error code from the hypervisor
+ * @partition: the ID of the partition to restart, or -1 for the
+ * calling partition
+ *
+ * Used by FSL_HV_IOCTL_PARTITION_RESTART
+ */
+struct fsl_hv_ioctl_restart {
+ __u32 ret;
+ __u32 partition;
+};
+
+/**
+ * struct fsl_hv_ioctl_status: get a partition's status
+ * @ret: return error code from the hypervisor
+ * @partition: the ID of the partition to query, or -1 for the
+ * calling partition
+ * @status: The returned status of the partition
+ *
+ * Used by FSL_HV_IOCTL_PARTITION_GET_STATUS
+ *
+ * Values of 'status':
+ * 0 = Stopped
+ * 1 = Running
+ * 2 = Starting
+ * 3 = Stopping
+ */
+struct fsl_hv_ioctl_status {
+ __u32 ret;
+ __u32 partition;
+ __u32 status;
+};
+
+/**
+ * struct fsl_hv_ioctl_start: start a partition
+ * @ret: return error code from the hypervisor
+ * @partition: the ID of the partition to control
+ * @entry_point: The offset within the guest IMA to start execution
+ * @load: If non-zero, reload the partition's images before starting
+ *
+ * Used by FSL_HV_IOCTL_PARTITION_START
+ */
+struct fsl_hv_ioctl_start {
+ __u32 ret;
+ __u32 partition;
+ __u32 entry_point;
+ __u32 load;
+};
+
+/**
+ * struct fsl_hv_ioctl_stop: stop a partition
+ * @ret: return error code from the hypervisor
+ * @partition: the ID of the partition to stop, or -1 for the calling
+ * partition
+ *
+ * Used by FSL_HV_IOCTL_PARTITION_STOP
+ */
+struct fsl_hv_ioctl_stop {
+ __u32 ret;
+ __u32 partition;
+};
+
+/**
+ * struct fsl_hv_ioctl_memcpy: copy memory between partitions
+ * @ret: return error code from the hypervisor
+ * @source: the partition ID of the source partition, or -1 for this
+ * partition
+ * @target: the partition ID of the target partition, or -1 for this
+ * partition
+ * @local_addr: user-space virtual address of a buffer in the local
+ * partition
+ * @remote_addr: guest physical address of a buffer in the
+ * remote partition
+ * @count: the number of bytes to copy. Both the local and remote
+ * buffers must be at least 'count' bytes long
+ *
+ * Used by FSL_HV_IOCTL_MEMCPY
+ *
+ * The 'local' partition is the partition that calls this ioctl. The
+ * 'remote' partition is a different partition. The data is copied from
+ * the 'source' paritition' to the 'target' partition.
+ *
+ * The buffer in the remote partition must be guest physically
+ * contiguous.
+ *
+ * This ioctl does not support copying memory between two remote
+ * partitions or within the same partition, so either 'source' or
+ * 'target' (but not both) must be -1. In other words, either
+ *
+ * source == local and target == remote
+ * or
+ * source == remote and target == local
+ */
+struct fsl_hv_ioctl_memcpy {
+ __u32 ret;
+ __u32 source;
+ __u32 target;
+ __u64 local_vaddr;
+ __u64 remote_paddr;
+ __u64 count;
+};
+
+/**
+ * struct fsl_hv_ioctl_doorbell: ring a doorbell
+ * @ret: return error code from the hypervisor
+ * @doorbell: the handle of the doorbell to ring doorbell
+ *
+ * Used by FSL_HV_IOCTL_DOORBELL
+ */
+struct fsl_hv_ioctl_doorbell {
+ __u32 ret;
+ __u32 doorbell;
+};
+
+/**
+ * struct fsl_hv_ioctl_prop: get/set a device tree property
+ * @ret: return error code from the hypervisor
+ * @handle: handle of partition whose tree to access
+ * @path: virtual address of path name of node to access
+ * @propname: virtual address of name of property to access
+ * @propval: virtual address of property data buffer
+ * @proplen: Size of property data buffer
+ *
+ * Used by FSL_HV_IOCTL_DOORBELL
+ */
+struct fsl_hv_ioctl_prop {
+ __u32 ret;
+ __u32 handle;
+ __u64 path;
+ __u64 propname;
+ __u64 propval;
+ __u32 proplen;
+};
+
+/*
+ * ioctl commands.
+ */
+enum {
+ FSL_HV_IOCTL_PARTITION_RESTART = 1, /* Boot another partition */
+ FSL_HV_IOCTL_PARTITION_GET_STATUS = 2, /* Boot another partition */
+ FSL_HV_IOCTL_PARTITION_START = 3, /* Boot another partition */
+ FSL_HV_IOCTL_PARTITION_STOP = 4, /* Stop this or another partition */
+ FSL_HV_IOCTL_MEMCPY = 5, /* Copy data from one partition to another */
+ FSL_HV_IOCTL_DOORBELL = 6, /* Ring a doorbell */
+
+ /* Get a property from another guest's device tree */
+ FSL_HV_IOCTL_GETPROP = 7,
+
+ /* Set a property in another guest's device tree */
+ FSL_HV_IOCTL_SETPROP = 8,
+};
+
+#ifdef __KERNEL__
+
+/**
+ * fsl_hv_event_register -- register a callback for failover events
+ *
+ * This function is called by device drivers to register their callback
+ * functions for fail-over events.
+ */
+int fsl_hv_failover_register(struct notifier_block *nb);
+
+/**
+ * fsl_hv_event_unregister -- unregister a callback for failover events
+ */
+int fsl_hv_failover_unregister(struct notifier_block *nb);
+
+#endif
+
+#endif
--
1.7.3.4
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox