* Re: [PATCH] ppc44x:PHY fixup for USB on canyonlands board
From: Josh Boyer @ 2010-11-10 14:19 UTC (permalink / raw)
To: Rupjyoti Sarmah; +Cc: linuxppc-dev, rsarmah, linux-kernel
In-Reply-To: <201011101137.oAABbFoc015547@amcc.com>
On Wed, Nov 10, 2010 at 05:07:15PM +0530, Rupjyoti Sarmah wrote:
>This fix is a reset for USB PHY that requires some amount of time for power to be stable on Canyonlands.
>
>Signed-off-by: Rupjyoti Sarmah <rsarmah@apm.com>
>---
> arch/powerpc/boot/dts/canyonlands.dts | 11 ++++
> arch/powerpc/platforms/44x/44x.h | 5 ++
> arch/powerpc/platforms/44x/Kconfig | 7 ++
> arch/powerpc/platforms/44x/Makefile | 1 +
> arch/powerpc/platforms/44x/ppc44x_fixup.c | 90 +++++++++++++++++++++++++++++
> 5 files changed, 114 insertions(+), 0 deletions(-)
> create mode 100644 arch/powerpc/platforms/44x/ppc44x_fixup.c
Is this just for canyonlands? If so, it's probably better off in a
caynonlands specific file, or a function that gets called in the common
platform file if the model matches canyonlands. It seems a bit overkill
to introduce an entire new file and Kconfig option for this.
>
>diff --git a/arch/powerpc/boot/dts/canyonlands.dts b/arch/powerpc/boot/dts/canyonlands.dts
>index a303703..d6e9ba2 100644
>--- a/arch/powerpc/boot/dts/canyonlands.dts
>+++ b/arch/powerpc/boot/dts/canyonlands.dts
>@@ -171,6 +171,11 @@
> 0x5 0x4>; /* AHBDMA */
> };
>
>+ CPLD: cpld@e1000000 {
>+ compatible = "apm, ppc460ex-bcsr";
>+ reg = <4 0xe1000000 0x9>;
>+ };
Normally we don't leave a space in compatible properties.
>+
> POB0: opb {
> compatible = "ibm,opb-460ex", "ibm,opb";
> #address-cells = <1>;
>@@ -320,6 +325,12 @@
> interrupts = <0x3 0x4>;
> };
>
>+ GPIO0: gpio@ef600b00 {
>+ compatible = "apm,ppc44x-gpio-base";
>+ reg = <0xef600b00 0x00000048>;
>+ gpio-controller;
>+ };
We already have "ibm,ppc4xx-gpio" as an established compatible field for
4xx GPIO. As far as I know, this is not a different kind of GPIO
controller than what is found on the other boards, so we should stick
with the existing property.
>+
> ZMII0: emac-zmii@ef600d00 {
> compatible = "ibm,zmii-460ex", "ibm,zmii";
> reg = <0xef600d00 0x0000000c>;
>diff --git a/arch/powerpc/platforms/44x/44x.h b/arch/powerpc/platforms/44x/44x.h
>index dbc4d2b..bc2ab7a 100644
>--- a/arch/powerpc/platforms/44x/44x.h
>+++ b/arch/powerpc/platforms/44x/44x.h
>@@ -4,4 +4,9 @@
> extern u8 as1_readb(volatile u8 __iomem *addr);
> extern void as1_writeb(u8 data, volatile u8 __iomem *addr);
>
>+#define BCSR_USB_EN 0x11
>+#define GPIO0_OSRH 0xC
>+#define GPIO0_TSRH 0x14
>+#define GPIO0_ISR1H 0x34
>+
> #endif /* __POWERPC_PLATFORMS_44X_44X_H */
>diff --git a/arch/powerpc/platforms/44x/Kconfig b/arch/powerpc/platforms/44x/Kconfig
>index 0f979c5..9ca4aaa 100644
>--- a/arch/powerpc/platforms/44x/Kconfig
>+++ b/arch/powerpc/platforms/44x/Kconfig
>@@ -117,12 +117,19 @@ config CANYONLANDS
> default n
> select PPC44x_SIMPLE
> select 460EX
>+ select 44X_FIXUP
> select PCI
> select PPC4xx_PCI_EXPRESS
> select IBM_NEW_EMAC_RGMII
> select IBM_NEW_EMAC_ZMII
> help
> This option enables support for the AMCC PPC460EX evaluation board.
>+config 44X_FIXUP
>+ bool "4xx_fixup"
>+ depends on 44x
>+ default n
>+ help
>+ This option enables supporting APM PPC4XX based evaluation board fixups.
>
> config GLACIER
> bool "Glacier"
>diff --git a/arch/powerpc/platforms/44x/Makefile b/arch/powerpc/platforms/44x/Makefile
>index 82ff326..d4bfb97 100644
>--- a/arch/powerpc/platforms/44x/Makefile
>+++ b/arch/powerpc/platforms/44x/Makefile
>@@ -1,6 +1,7 @@
> obj-$(CONFIG_44x) := misc_44x.o idle.o
> obj-$(CONFIG_PPC44x_SIMPLE) += ppc44x_simple.o
> obj-$(CONFIG_EBONY) += ebony.o
>+obj-$(CONFIG_44X_FIXUP) += ppc44x_fixup.o
> obj-$(CONFIG_SAM440EP) += sam440ep.o
> obj-$(CONFIG_WARP) += warp.o
> obj-$(CONFIG_XILINX_VIRTEX_5_FXT) += virtex.o
>diff --git a/arch/powerpc/platforms/44x/ppc44x_fixup.c b/arch/powerpc/platforms/44x/ppc44x_fixup.c
>new file mode 100644
>index 0000000..4e254eb
>--- /dev/null
>+++ b/arch/powerpc/platforms/44x/ppc44x_fixup.c
>@@ -0,0 +1,90 @@
>+/*
>+ * This contain fixup code for Applied Micro ppc44x series of processors.
>+ *
>+ * Copyright (c) 2010, Applied Micro Circuits Corporation
>+ * Author: Rupjyoti Sarmah <rsarmah@apm.com>
>+ *
>+ * This program is free software; you can redistribute it and/or
>+ * modify it under the terms of the GNU General Public License as
>+ * published by the Free Software Foundation; either version 2 of
>+ * the License, or (at your option) any later version.
>+ *
>+ * This program is distributed in the hope that it will be useful,
>+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
>+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
>+ * GNU General Public License for more details.
>+ *
>+ * You should have received a copy of the GNU General Public License
>+ * along with this program; if not, write to the Free Software
>+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
>+ * MA 02111-1307 USA
>+ *
>+ */
>+
>+#include <linux/kernel.h>
>+#include <linux/init.h>
>+#include <linux/io.h>
>+#include <linux/of.h>
>+#include "44x.h"
>+
>+/* PHY fixup code on Canyonlands kit. */
>+
>+static int __init ppc460ex_canyonlands_fixup(void)
>+{
>+ u8 __iomem *bcsr ;
>+ void __iomem *vaddr;
>+ struct device_node *np;
>+ u32 val ;
>+
>+ np = of_find_compatible_node(NULL, NULL, "apm, ppc460ex-bcsr");
>+ if (!np) {
>+ printk(KERN_ERR "failed did not find apm, ppc460ex bcsr node\n");
>+ return -ENODEV;
>+ }
Nit: the indentation on that brace is off.
>+
>+ bcsr = of_iomap(np, 0);
>+ of_node_put(np);
>+
>+ if (!bcsr) {
>+ printk(KERN_CRIT "Could not remap bcsr\n");
>+ return -ENODEV;
>+ }
>+
>+ clrbits8(&bcsr[7], BCSR_USB_EN);
>+ udelay(100000);
>+
>+ setbits8(&bcsr[7], BCSR_USB_EN);
>+ udelay(100000);
>+
>+ clrbits8(&bcsr[7], BCSR_USB_EN);
>+ udelay(100000);
>+
>+ np = of_find_compatible_node(NULL, NULL, "apm,ppc44x-gpio-base");
>+
>+ /* configure multiplexed gpio16 and gpio19 */
>+
>+ vaddr = of_iomap(np, 0);
>+ if (!vaddr) {
>+ printk(KERN_CRIT "Could not get gpio node address\n");
>+ return -ENODEV;
>+ }
If this fails, but the bcsr search works, what happens? Possibly
nothing, but I wonder if the search for both nodes should be done before
actually touching the hardware.
>+
>+ /* configure gpio16 and gpio19 as alternate1 */
>+
>+ /* GPIO0_ISR1H for alternate 1 settings */
>+ val = in_be32(vaddr + GPIO0_ISR1H);
>+ out_be32((vaddr + GPIO0_ISR1H), val | 0x4200000);
>+
>+ /* GPIO0_OSRH for alternate 1 settings */
>+ val = in_be32(vaddr + GPIO0_OSRH);
>+ out_be32((vaddr + GPIO0_OSRH), val | 0x42000000);
>+
>+ /* GPIO0_TSRH for alternate 1 settings */
>+ val = in_be32(vaddr + GPIO0_TSRH);
>+ out_be32((vaddr + GPIO0_TSRH), val | 0x42000000);
>+ of_node_put(np);
>+ return 0;
>+
>+}
>+arch_initcall(ppc460ex_canyonlands_fixup);
With this being an arch_initcall, it will get called for every kind of
platform in a multi-board kernel. Another reason to only call it from a
board specific probe function if it really is canyonlands specific.
josh
^ permalink raw reply
* [PATCH] ppc44x:PHY fixup for USB on canyonlands board
From: Rupjyoti Sarmah @ 2010-11-10 11:37 UTC (permalink / raw)
To: linuxppc-dev, linux-kernel; +Cc: rsarmah
This fix is a reset for USB PHY that requires some amount of time for power to be stable on Canyonlands.
Signed-off-by: Rupjyoti Sarmah <rsarmah@apm.com>
---
arch/powerpc/boot/dts/canyonlands.dts | 11 ++++
arch/powerpc/platforms/44x/44x.h | 5 ++
arch/powerpc/platforms/44x/Kconfig | 7 ++
arch/powerpc/platforms/44x/Makefile | 1 +
arch/powerpc/platforms/44x/ppc44x_fixup.c | 90 +++++++++++++++++++++++++++++
5 files changed, 114 insertions(+), 0 deletions(-)
create mode 100644 arch/powerpc/platforms/44x/ppc44x_fixup.c
diff --git a/arch/powerpc/boot/dts/canyonlands.dts b/arch/powerpc/boot/dts/canyonlands.dts
index a303703..d6e9ba2 100644
--- a/arch/powerpc/boot/dts/canyonlands.dts
+++ b/arch/powerpc/boot/dts/canyonlands.dts
@@ -171,6 +171,11 @@
0x5 0x4>; /* AHBDMA */
};
+ CPLD: cpld@e1000000 {
+ compatible = "apm, ppc460ex-bcsr";
+ reg = <4 0xe1000000 0x9>;
+ };
+
POB0: opb {
compatible = "ibm,opb-460ex", "ibm,opb";
#address-cells = <1>;
@@ -320,6 +325,12 @@
interrupts = <0x3 0x4>;
};
+ GPIO0: gpio@ef600b00 {
+ compatible = "apm,ppc44x-gpio-base";
+ reg = <0xef600b00 0x00000048>;
+ gpio-controller;
+ };
+
ZMII0: emac-zmii@ef600d00 {
compatible = "ibm,zmii-460ex", "ibm,zmii";
reg = <0xef600d00 0x0000000c>;
diff --git a/arch/powerpc/platforms/44x/44x.h b/arch/powerpc/platforms/44x/44x.h
index dbc4d2b..bc2ab7a 100644
--- a/arch/powerpc/platforms/44x/44x.h
+++ b/arch/powerpc/platforms/44x/44x.h
@@ -4,4 +4,9 @@
extern u8 as1_readb(volatile u8 __iomem *addr);
extern void as1_writeb(u8 data, volatile u8 __iomem *addr);
+#define BCSR_USB_EN 0x11
+#define GPIO0_OSRH 0xC
+#define GPIO0_TSRH 0x14
+#define GPIO0_ISR1H 0x34
+
#endif /* __POWERPC_PLATFORMS_44X_44X_H */
diff --git a/arch/powerpc/platforms/44x/Kconfig b/arch/powerpc/platforms/44x/Kconfig
index 0f979c5..9ca4aaa 100644
--- a/arch/powerpc/platforms/44x/Kconfig
+++ b/arch/powerpc/platforms/44x/Kconfig
@@ -117,12 +117,19 @@ config CANYONLANDS
default n
select PPC44x_SIMPLE
select 460EX
+ select 44X_FIXUP
select PCI
select PPC4xx_PCI_EXPRESS
select IBM_NEW_EMAC_RGMII
select IBM_NEW_EMAC_ZMII
help
This option enables support for the AMCC PPC460EX evaluation board.
+config 44X_FIXUP
+ bool "4xx_fixup"
+ depends on 44x
+ default n
+ help
+ This option enables supporting APM PPC4XX based evaluation board fixups.
config GLACIER
bool "Glacier"
diff --git a/arch/powerpc/platforms/44x/Makefile b/arch/powerpc/platforms/44x/Makefile
index 82ff326..d4bfb97 100644
--- a/arch/powerpc/platforms/44x/Makefile
+++ b/arch/powerpc/platforms/44x/Makefile
@@ -1,6 +1,7 @@
obj-$(CONFIG_44x) := misc_44x.o idle.o
obj-$(CONFIG_PPC44x_SIMPLE) += ppc44x_simple.o
obj-$(CONFIG_EBONY) += ebony.o
+obj-$(CONFIG_44X_FIXUP) += ppc44x_fixup.o
obj-$(CONFIG_SAM440EP) += sam440ep.o
obj-$(CONFIG_WARP) += warp.o
obj-$(CONFIG_XILINX_VIRTEX_5_FXT) += virtex.o
diff --git a/arch/powerpc/platforms/44x/ppc44x_fixup.c b/arch/powerpc/platforms/44x/ppc44x_fixup.c
new file mode 100644
index 0000000..4e254eb
--- /dev/null
+++ b/arch/powerpc/platforms/44x/ppc44x_fixup.c
@@ -0,0 +1,90 @@
+/*
+ * This contain fixup code for Applied Micro ppc44x series of processors.
+ *
+ * Copyright (c) 2010, Applied Micro Circuits Corporation
+ * Author: Rupjyoti Sarmah <rsarmah@apm.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ */
+
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/io.h>
+#include <linux/of.h>
+#include "44x.h"
+
+/* PHY fixup code on Canyonlands kit. */
+
+static int __init ppc460ex_canyonlands_fixup(void)
+{
+ u8 __iomem *bcsr ;
+ void __iomem *vaddr;
+ struct device_node *np;
+ u32 val ;
+
+ np = of_find_compatible_node(NULL, NULL, "apm, ppc460ex-bcsr");
+ if (!np) {
+ printk(KERN_ERR "failed did not find apm, ppc460ex bcsr node\n");
+ return -ENODEV;
+ }
+
+ bcsr = of_iomap(np, 0);
+ of_node_put(np);
+
+ if (!bcsr) {
+ printk(KERN_CRIT "Could not remap bcsr\n");
+ return -ENODEV;
+ }
+
+ clrbits8(&bcsr[7], BCSR_USB_EN);
+ udelay(100000);
+
+ setbits8(&bcsr[7], BCSR_USB_EN);
+ udelay(100000);
+
+ clrbits8(&bcsr[7], BCSR_USB_EN);
+ udelay(100000);
+
+ np = of_find_compatible_node(NULL, NULL, "apm,ppc44x-gpio-base");
+
+ /* configure multiplexed gpio16 and gpio19 */
+
+ vaddr = of_iomap(np, 0);
+ if (!vaddr) {
+ printk(KERN_CRIT "Could not get gpio node address\n");
+ return -ENODEV;
+ }
+
+ /* configure gpio16 and gpio19 as alternate1 */
+
+ /* GPIO0_ISR1H for alternate 1 settings */
+ val = in_be32(vaddr + GPIO0_ISR1H);
+ out_be32((vaddr + GPIO0_ISR1H), val | 0x4200000);
+
+ /* GPIO0_OSRH for alternate 1 settings */
+ val = in_be32(vaddr + GPIO0_OSRH);
+ out_be32((vaddr + GPIO0_OSRH), val | 0x42000000);
+
+ /* GPIO0_TSRH for alternate 1 settings */
+ val = in_be32(vaddr + GPIO0_TSRH);
+ out_be32((vaddr + GPIO0_TSRH), val | 0x42000000);
+ of_node_put(np);
+ return 0;
+
+}
+arch_initcall(ppc460ex_canyonlands_fixup);
+
--
1.5.6.3
^ permalink raw reply related
* Re: [PATCH V2 3/3] powerpc: Disable VPHN polling during a suspend operation
From: Michael Ellerman @ 2010-11-10 0:58 UTC (permalink / raw)
To: Jesse Larrew; +Cc: markn, pmac, tbreeds, lkessler, mjwolf, linuxppc-dev
In-Reply-To: <20101109232514.17098.84090.sendpatchset@manic8ball.ltc.austin.ibm.com>
[-- Attachment #1: Type: text/plain, Size: 689 bytes --]
On Tue, 2010-11-09 at 16:25 -0700, Jesse Larrew wrote:
> From: Jesse Larrew <jlarrew@linux.vnet.ibm.com>
>
> Tie the polling mechanism into the ibm,suspend-me rtas call to
> stop/restart polling before/after a suspend, hibernate, migrate,
> or checkpoint restart operation. This ensures that the system has a
> chance to disable the polling if the partition is migrated to a system
> that does not support VPHN (and vice versa).
I never got round to replying to you about my comments did I. This looks
good, in particular you're right about the error path in
__rtas_suspend_last_cpu(), I was getting muddled trying to read the code
while mentally adding the diff.
cheers
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply
* [PATCH V2 3/3] powerpc: Disable VPHN polling during a suspend operation
From: Jesse Larrew @ 2010-11-09 23:25 UTC (permalink / raw)
To: linuxppc-dev; +Cc: markn, pmac, tbreeds, lkessler, Jesse Larrew, mjwolf
In-Reply-To: <20101109232436.17098.20055.sendpatchset@manic8ball.ltc.austin.ibm.com>
From: Jesse Larrew <jlarrew@linux.vnet.ibm.com>
Tie the polling mechanism into the ibm,suspend-me rtas call to
stop/restart polling before/after a suspend, hibernate, migrate,
or checkpoint restart operation. This ensures that the system has a
chance to disable the polling if the partition is migrated to a system
that does not support VPHN (and vice versa).
Signed-off-by: Jesse Larrew <jlarrew@linux.vnet.ibm.com>
---
arch/powerpc/include/asm/topology.h | 10 ++++++++++
arch/powerpc/kernel/rtas.c | 3 +++
2 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/arch/powerpc/include/asm/topology.h b/arch/powerpc/include/asm/topology.h
index afe4aaa..aed188b 100644
--- a/arch/powerpc/include/asm/topology.h
+++ b/arch/powerpc/include/asm/topology.h
@@ -93,6 +93,8 @@ extern void __init dump_numa_cpu_topology(void);
extern int sysfs_add_device_to_node(struct sys_device *dev, int nid);
extern void sysfs_remove_device_from_node(struct sys_device *dev, int nid);
+extern int start_topology_update(void);
+extern int stop_topology_update(void);
#else
static inline void dump_numa_cpu_topology(void) {}
@@ -107,6 +109,14 @@ static inline void sysfs_remove_device_from_node(struct sys_device *dev,
{
}
+static inline int start_topology_update(void)
+{
+ return 0;
+}
+static inline int stop_topology_update(void)
+{
+ return 0;
+}
#endif /* CONFIG_NUMA */
#include <asm-generic/topology.h>
diff --git a/arch/powerpc/kernel/rtas.c b/arch/powerpc/kernel/rtas.c
index 8fe8bc6..2097f2b 100644
--- a/arch/powerpc/kernel/rtas.c
+++ b/arch/powerpc/kernel/rtas.c
@@ -41,6 +41,7 @@
#include <asm/atomic.h>
#include <asm/time.h>
#include <asm/mmu.h>
+#include <asm/topology.h>
struct rtas_t rtas = {
.lock = __ARCH_SPIN_LOCK_UNLOCKED
@@ -713,6 +714,7 @@ static int __rtas_suspend_last_cpu(struct rtas_suspend_me_data *data, int wake_w
int cpu;
slb_set_size(SLB_MIN_SIZE);
+ stop_topology_update();
printk(KERN_DEBUG "calling ibm,suspend-me on cpu %i\n", smp_processor_id());
while (rc == H_MULTI_THREADS_ACTIVE && !atomic_read(&data->done) &&
@@ -728,6 +730,7 @@ static int __rtas_suspend_last_cpu(struct rtas_suspend_me_data *data, int wake_w
rc = atomic_read(&data->error);
atomic_set(&data->error, rc);
+ start_topology_update();
if (wake_when_done) {
atomic_set(&data->done, 1);
--
1.7.2.3
^ permalink raw reply related
* [PATCH V2 1/3] powerpc: Add VPHN firmware feature
From: Jesse Larrew @ 2010-11-09 23:24 UTC (permalink / raw)
To: linuxppc-dev; +Cc: markn, pmac, tbreeds, lkessler, Jesse Larrew, mjwolf
In-Reply-To: <20101109232436.17098.20055.sendpatchset@manic8ball.ltc.austin.ibm.com>
From: Jesse Larrew <jlarrew@linux.vnet.ibm.com>
This simple patch adds the firmware feature for VPHN to the firmware
features bitmask.
Signed-off-by: Jesse Larrew <jlarrew@linux.vnet.ibm.com>
---
arch/powerpc/include/asm/firmware.h | 3 ++-
arch/powerpc/include/asm/hvcall.h | 3 ++-
arch/powerpc/platforms/pseries/firmware.c | 1 +
3 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/arch/powerpc/include/asm/firmware.h b/arch/powerpc/include/asm/firmware.h
index 20778a4..4ef662e 100644
--- a/arch/powerpc/include/asm/firmware.h
+++ b/arch/powerpc/include/asm/firmware.h
@@ -46,6 +46,7 @@
#define FW_FEATURE_PS3_LV1 ASM_CONST(0x0000000000800000)
#define FW_FEATURE_BEAT ASM_CONST(0x0000000001000000)
#define FW_FEATURE_CMO ASM_CONST(0x0000000002000000)
+#define FW_FEATURE_VPHN ASM_CONST(0x0000000004000000)
#ifndef __ASSEMBLY__
@@ -59,7 +60,7 @@ enum {
FW_FEATURE_VIO | FW_FEATURE_RDMA | FW_FEATURE_LLAN |
FW_FEATURE_BULK_REMOVE | FW_FEATURE_XDABR |
FW_FEATURE_MULTITCE | FW_FEATURE_SPLPAR | FW_FEATURE_LPAR |
- FW_FEATURE_CMO,
+ FW_FEATURE_CMO | FW_FEATURE_VPHN,
FW_FEATURE_PSERIES_ALWAYS = 0,
FW_FEATURE_ISERIES_POSSIBLE = FW_FEATURE_ISERIES | FW_FEATURE_LPAR,
FW_FEATURE_ISERIES_ALWAYS = FW_FEATURE_ISERIES | FW_FEATURE_LPAR,
diff --git a/arch/powerpc/include/asm/hvcall.h b/arch/powerpc/include/asm/hvcall.h
index de03ca5..6de1e5f 100644
--- a/arch/powerpc/include/asm/hvcall.h
+++ b/arch/powerpc/include/asm/hvcall.h
@@ -232,7 +232,8 @@
#define H_GET_EM_PARMS 0x2B8
#define H_SET_MPP 0x2D0
#define H_GET_MPP 0x2D4
-#define MAX_HCALL_OPCODE H_GET_MPP
+#define H_HOME_NODE_ASSOCIATIVITY 0x2EC
+#define MAX_HCALL_OPCODE H_HOME_NODE_ASSOCIATIVITY
#ifndef __ASSEMBLY__
diff --git a/arch/powerpc/platforms/pseries/firmware.c b/arch/powerpc/platforms/pseries/firmware.c
index 0a14d8c..0b0eff0 100644
--- a/arch/powerpc/platforms/pseries/firmware.c
+++ b/arch/powerpc/platforms/pseries/firmware.c
@@ -55,6 +55,7 @@ firmware_features_table[FIRMWARE_MAX_FEATURES] = {
{FW_FEATURE_XDABR, "hcall-xdabr"},
{FW_FEATURE_MULTITCE, "hcall-multi-tce"},
{FW_FEATURE_SPLPAR, "hcall-splpar"},
+ {FW_FEATURE_VPHN, "hcall-vphn"},
};
/* Build up the firmware features bitmask using the contents of
--
1.7.2.3
^ permalink raw reply related
* [PATCH V2 2/3] powerpc: Poll VPA for topology changes and update NUMA maps
From: Jesse Larrew @ 2010-11-09 23:25 UTC (permalink / raw)
To: linuxppc-dev; +Cc: markn, pmac, tbreeds, lkessler, Jesse Larrew, mjwolf
In-Reply-To: <20101109232436.17098.20055.sendpatchset@manic8ball.ltc.austin.ibm.com>
From: Jesse Larrew <jlarrew@linux.vnet.ibm.com>
This patch sets a timer during boot that will periodically poll the
associativity change counters in the VPA. When a change in
associativity is detected, it retrieves the new associativity domain
information via the H_HOME_NODE_ASSOCIATIVITY hcall and updates the
NUMA node maps and sysfs entries accordingly. Note that since the
ibm,associativity device tree property does not exist on configurations
with both NUMA and SPLPAR enabled, no device tree updates are necessary.
Signed-off-by: Jesse Larrew <jlarrew@linux.vnet.ibm.com>
---
arch/powerpc/include/asm/lppaca.h | 5 +-
arch/powerpc/mm/numa.c | 274 +++++++++++++++++++++++++++++++++++--
2 files changed, 268 insertions(+), 11 deletions(-)
diff --git a/arch/powerpc/include/asm/lppaca.h b/arch/powerpc/include/asm/lppaca.h
index 7f5e0fe..380d48b 100644
--- a/arch/powerpc/include/asm/lppaca.h
+++ b/arch/powerpc/include/asm/lppaca.h
@@ -62,7 +62,10 @@ struct lppaca {
volatile u32 dyn_pir; // Dynamic ProcIdReg value x20-x23
u32 dsei_data; // DSEI data x24-x27
u64 sprg3; // SPRG3 value x28-x2F
- u8 reserved3[80]; // Reserved x30-x7F
+ u8 reserved3[40]; // Reserved x30-x57
+ volatile u8 vphn_assoc_counts[8]; // Virtual processor home node
+ // associativity change counters x58-x5F
+ u8 reserved4[32]; // Reserved x60-x7F
//=============================================================================
// CACHE_LINE_2 0x0080 - 0x00FF Contains local read-write data
diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
index 74505b2..db6308c 100644
--- a/arch/powerpc/mm/numa.c
+++ b/arch/powerpc/mm/numa.c
@@ -20,10 +20,14 @@
#include <linux/memblock.h>
#include <linux/of.h>
#include <linux/pfn.h>
+#include <linux/cpuset.h>
+#include <linux/node.h>
#include <asm/sparsemem.h>
#include <asm/prom.h>
#include <asm/system.h>
#include <asm/smp.h>
+#include <asm/firmware.h>
+#include <asm/paca.h>
static int numa_enabled = 1;
@@ -246,32 +250,41 @@ static void initialize_distance_lookup_table(int nid,
/* Returns nid in the range [0..MAX_NUMNODES-1], or -1 if no useful numa
* info is found.
*/
-static int of_node_to_nid_single(struct device_node *device)
+static int associativity_to_nid(const unsigned int *associativity)
{
int nid = -1;
- const unsigned int *tmp;
if (min_common_depth == -1)
goto out;
- tmp = of_get_associativity(device);
- if (!tmp)
- goto out;
-
- if (tmp[0] >= min_common_depth)
- nid = tmp[min_common_depth];
+ if (associativity[0] >= min_common_depth)
+ nid = associativity[min_common_depth];
/* POWER4 LPAR uses 0xffff as invalid node */
if (nid == 0xffff || nid >= MAX_NUMNODES)
nid = -1;
- if (nid > 0 && tmp[0] >= distance_ref_points_depth)
- initialize_distance_lookup_table(nid, tmp);
+ if (nid > 0 && associativity[0] >= distance_ref_points_depth)
+ initialize_distance_lookup_table(nid, associativity);
out:
return nid;
}
+/* Returns the nid associated with the given device tree node,
+ * or -1 if not found.
+ */
+static int of_node_to_nid_single(struct device_node *device)
+{
+ int nid = -1;
+ const unsigned int *tmp;
+
+ tmp = of_get_associativity(device);
+ if (tmp)
+ nid = associativity_to_nid(tmp);
+ return nid;
+}
+
/* Walk the device tree upwards, looking for an associativity id */
int of_node_to_nid(struct device_node *device)
{
@@ -1248,3 +1261,244 @@ int hot_add_scn_to_nid(unsigned long scn_addr)
}
#endif /* CONFIG_MEMORY_HOTPLUG */
+
+/* Vrtual Processor Home Node (VPHN) support */
+#define VPHN_NR_CHANGE_CTRS (8)
+static u8 vphn_cpu_change_counts[NR_CPUS][VPHN_NR_CHANGE_CTRS];
+static cpumask_t cpu_associativity_changes_mask;
+static void topology_work_fn(struct work_struct *work);
+static DECLARE_WORK(topology_work, topology_work_fn);
+static void topology_timer_fn(unsigned long ignored);
+static struct timer_list topology_timer =
+ TIMER_INITIALIZER(topology_timer_fn, 0, 0);
+
+static void set_topology_timer(void);
+int stop_topology_update(void);
+
+/*
+ * Store the current values of the associativity change counters in the
+ * hypervisor.
+ */
+static void setup_cpu_associativity_change_counters(void)
+{
+ int cpu = 0;
+
+ for_each_possible_cpu(cpu) {
+ int i = 0;
+ u8 *counts = vphn_cpu_change_counts[cpu];
+ volatile u8 *hypervisor_counts = lppaca[cpu].vphn_assoc_counts;
+
+ for (i = 0; i < VPHN_NR_CHANGE_CTRS; i++) {
+ counts[i] = hypervisor_counts[i];
+ }
+ }
+
+ return;
+}
+
+/*
+ * The hypervisor maintains a set of 8 associativity change counters in
+ * the VPA of each cpu that correspond to the associativity levels in the
+ * ibm,associativity-reference-points property. When an associativity
+ * level changes, the corresponding counter is incremented.
+ *
+ * Set a bit in cpu_associativity_changes_mask for each cpu whose home
+ * node associativity levels have changed.
+ */
+static void update_cpu_associativity_changes_mask(void)
+{
+ int cpu = 0;
+ cpumask_t *changes = &cpu_associativity_changes_mask;
+
+ cpumask_clear(changes);
+
+ for_each_possible_cpu(cpu) {
+ int i;
+ u8 *counts = vphn_cpu_change_counts[cpu];
+ volatile u8 *hypervisor_counts = lppaca[cpu].vphn_assoc_counts;
+
+ for (i = 0; i < VPHN_NR_CHANGE_CTRS; i++) {
+ if (hypervisor_counts[i] > counts[i]) {
+ counts[i] = hypervisor_counts[i];
+
+ if (!(cpumask_test_cpu(cpu, changes)))
+ cpumask_set_cpu(cpu, changes);
+ }
+ }
+ }
+
+ return;
+}
+
+/* 6 64-bit registers unpacked into 12 32-bit associativity values */
+#define VPHN_ASSOC_BUFSIZE (6*sizeof(u64)/sizeof(u32))
+
+/*
+ * Convert the associativity domain numbers returned from the hypervisor
+ * to the sequence they would appear in the ibm,associativity property.
+ */
+static int vphn_unpack_associativity(const long *packed, unsigned int *unpacked)
+{
+ int i = 0;
+ int nr_assoc_doms = 0;
+ const u16 *field = (const u16*) packed;
+
+#define VPHN_FIELD_UNUSED (0xffff)
+#define VPHN_FIELD_MSB (0x8000)
+#define VPHN_FIELD_MASK (~VPHN_FIELD_MSB)
+
+ for (i = 0; i < VPHN_ASSOC_BUFSIZE; i++) {
+ if (*field == VPHN_FIELD_UNUSED) {
+ /* All significant fields processed, and remaining
+ * fields contain the reserved value of all 1's.
+ * Just store them.
+ */
+ unpacked[i] = *((u32*)field);
+ field += 2;
+ }
+ else if (*field & VPHN_FIELD_MSB) {
+ /* Data is in the lower 15 bits of this field */
+ unpacked[i] = *field & VPHN_FIELD_MASK;
+ field++;
+ nr_assoc_doms++;
+ }
+ else {
+ /* Data is in the lower 15 bits of this field
+ * concatenated with the next 16 bit field
+ */
+ unpacked[i] = *((u32*)field);
+ field += 2;
+ nr_assoc_doms++;
+ }
+ }
+
+ return nr_assoc_doms;
+}
+
+/*
+ * Retrieve the new associativity information for a virtual processor's
+ * home node.
+ */
+static long hcall_vphn(unsigned long cpu, unsigned int *associativity)
+{
+ long rc = 0;
+ long retbuf[PLPAR_HCALL9_BUFSIZE] = {0};
+ u64 flags = 1;
+ int hwcpu = get_hard_smp_processor_id(cpu);
+
+ rc = plpar_hcall9(H_HOME_NODE_ASSOCIATIVITY, retbuf, flags, hwcpu);
+ vphn_unpack_associativity(retbuf, associativity);
+
+ return rc;
+}
+
+static long
+vphn_get_associativity(unsigned long cpu, unsigned int *associativity)
+{
+ long rc = 0;
+
+ rc = hcall_vphn(cpu, associativity);
+
+ switch (rc) {
+ case H_FUNCTION:
+ printk(KERN_INFO
+ "VPHN is not supported. Disabling polling...\n");
+ stop_topology_update();
+ break;
+ case H_HARDWARE:
+ printk(KERN_ERR
+ "hcall_vphn() experienced a hardware fault "
+ "preventing VPHN. Disabling polling...\n");
+ stop_topology_update();
+ }
+
+ return rc;
+}
+
+/*
+ * Update the node maps and sysfs entries for each cpu whose home node
+ * has changed.
+ */
+int arch_update_cpu_topology(void)
+{
+ int cpu = 0, nid = 0, old_nid = 0;
+ unsigned int associativity[VPHN_ASSOC_BUFSIZE] = {0};
+ struct sys_device *sysdev = NULL;
+
+ for_each_cpu_mask(cpu, cpu_associativity_changes_mask) {
+ vphn_get_associativity(cpu, associativity);
+ nid = associativity_to_nid(associativity);
+
+ if (nid < 0 || !node_online(nid))
+ nid = first_online_node;
+
+ old_nid = numa_cpu_lookup_table[cpu];
+
+ /* Disable hotplug while we update the cpu
+ * masks and sysfs.
+ */
+ get_online_cpus();
+ unregister_cpu_under_node(cpu, old_nid);
+ unmap_cpu_from_node(cpu);
+ map_cpu_to_node(cpu, nid);
+ register_cpu_under_node(cpu, nid);
+ put_online_cpus();
+
+ sysdev = get_cpu_sysdev(cpu);
+ if (sysdev)
+ kobject_uevent(&sysdev->kobj, KOBJ_CHANGE);
+ }
+
+ return 1;
+}
+
+static void topology_work_fn(struct work_struct *work)
+{
+ rebuild_sched_domains();
+}
+
+void topology_schedule_update(void)
+{
+ schedule_work(&topology_work);
+}
+
+static void topology_timer_fn(unsigned long ignored)
+{
+ update_cpu_associativity_changes_mask();
+ if (!cpumask_empty(&cpu_associativity_changes_mask))
+ topology_schedule_update();
+ set_topology_timer();
+}
+
+static void set_topology_timer(void)
+{
+ topology_timer.data = 0;
+ topology_timer.expires = jiffies + 60 * HZ;
+ add_timer(&topology_timer);
+}
+
+/*
+ * Start polling for VPHN associativity changes.
+ */
+int start_topology_update(void)
+{
+ int rc = 0;
+
+ if (firmware_has_feature(FW_FEATURE_VPHN)) {
+ setup_cpu_associativity_change_counters();
+ init_timer_deferrable(&topology_timer);
+ set_topology_timer();
+ rc = 1;
+ }
+
+ return rc;
+}
+__initcall(start_topology_update);
+
+/*
+ * Disable polling for VPHN associativity changes.
+ */
+int stop_topology_update(void)
+{
+ return del_timer(&topology_timer);
+}
--
1.7.2.3
^ permalink raw reply related
* [PATCH V2 0/3][RFC] Add Support for Virtual Processor Home Node (VPHN)
From: Jesse Larrew @ 2010-11-09 23:24 UTC (permalink / raw)
To: linuxppc-dev; +Cc: markn, pmac, tbreeds, lkessler, Jesse Larrew, mjwolf
From: Jesse Larrew <jlarrew@linux.vnet.ibm.com>
The SPLPAR option allows the platform to dispatch virtual processors on
physical processors that, due to the variable nature of work loads, are
temporarily free, thus improving the utilization of computing resources.
However, SPLPAR implies inconsistent mapping of virtual to physical
processors, thus defeating resource allocation software that attempts to
optimize performance on platforms that implement the NUMA option.
To bridge the gap between these two options, the VPHN option maintains a
substantially consistent mapping of a given virtual processor to a physical
processor or set of processors within a given associativity domain. When
allocating computing resources, the kernel can take advantage of this
statistically consistent mapping to improve processing performance.
VPHN mappings are substantially consistent but not static. For any given
dispatch cycle, a best effort is made by the hypervisor to dispatch the
virtual processor on a physical processor within a targeted associativity
domain (the virtual processor's home node). However, if processing capacity
within the home node is not available, some other physical processor is
assigned to meet the processing capacity entitlement. From time to time,
to optimize the total platform performance, it may be necessary for the
platform to change the home node of a given virtual processor.
The Virtual Processor Home Node feature addresses this by adding the
H_HOME_NODE_ASSOCIATIVITY hcall to retrieve the current associativity
domain information directly from the hypervisor for a given virtual
processor's home node. It also exposes a set of associativity change
counters in the Virtual Processor Area (VPA) of each processor to indicate
when associativity changes occur.
This patch set sets a timer during boot that will periodically poll the
associativity change counters. When a change in associativity is detected,
it retrieves the new associativity domain information via the
H_HOME_NODE_ASSOCIATIVITY hcall and updates the NUMA node maps and sysfs
entries accordingly. The polling mechanism is also tied into the
ibm,suspend-me rtas call to stop/restart polling before/after a suspend,
hibernate, migrate, or checkpoint restart operation.
This patch set applies to v2.6.36 and includes the following:
[PATCH 1/3] powerpc: Add VPHN firmware feature
[PATCH 2/3] powerpc: Poll VPA for topology changes and update NUMA maps
[PATCH 3/3] powerpc: Disable VPHN polling during a suspend operation
Changes since V1:
* topology.h: Removed unrelated comments added in V1.
* numa.c: Renamed init_topology_update() to start_topology_update() and
removed the __init attribute.
* topology.h: Fixed the inlined definitions of start_topology_update()
and stop_topology_update().
* rtas.c: Removed the "generic" pre_suspend_work() and
post_suspend_work() functions. Proper notifier chains will be added
in a future patch.
Signed-off-by: Jesse Larrew <jlarrew@linux.vnet.ibm.com>
---
arch/powerpc/include/asm/firmware.h | 3 +-
arch/powerpc/include/asm/hvcall.h | 3 +-
arch/powerpc/include/asm/lppaca.h | 5 +-
arch/powerpc/include/asm/topology.h | 10 +
arch/powerpc/kernel/rtas.c | 3 +
arch/powerpc/mm/numa.c | 274 +++++++++++++++++++++++++++-
arch/powerpc/platforms/pseries/firmware.c | 1 +
7 files changed, 286 insertions(+), 13 deletions(-)
^ permalink raw reply
* Re: INFO: task snmpd:398 blocked for more than 120 seconds.
From: Joakim Tjernlund @ 2010-11-09 12:30 UTC (permalink / raw)
To: Norbert van Bolhuis; +Cc: linuxppc-dev, David Laight
In-Reply-To: <4CD918C2.4090400@aimvalley.nl>
Norbert van Bolhuis <nvbolhuis@aimvalley.nl> wrote on 2010/11/09 10:47:46:
>
> Joakim Tjernlund wrote:
> >>> I can't make out what is causing this hang every now an then:
> >>>
> >>> INFO: task snmpd:398 blocked for more than 120 seconds.
> >> My problem with that 'error' message is that there is no way
> >> for a driver to disable it on a per-process basis.
> >> We have some processes whose 'normal state' is to sleep
> >> uninterruptibly in the kernel. Shutdown is handled by
> >> an explicit request (not by sending a signal).
> >> The processes could be kernel worker threads (except that
> >> is is ~impossible to handle them exiting from a loadble
> >> kernel module) so are actually children of a daemon sat
> >> inside an ioctl() request that never terminates!
> >>
> >> However, on the face of it, your case does look as though
> >> the mutex is fubar'ed.
> >>
> >> Might be worth (somehow) dumping the mutex state.
> >
> > ehh, it is locked, isn't it? How to find who locked it
> > and forgot to release it?
> >
>
> You could add show_state to check_hung_task
>
> It worked for me while solving some (application) task hangups.
Will have a look at that too, thanks.
Meanwhile i have tried to turn on various LOCK debug and
that results in an unbootable kernel.
Somewhere the dev. tree. gets mangled and it happens when
DEBUG_LOCK_ALLOC is set.
Don't know why and I must move on.
Someone else might want to try if DEBUG_LOCK_ALLOC works
on embedded ppc boards, especially 83xx.
Jocke
^ permalink raw reply
* Re: INFO: task snmpd:398 blocked for more than 120 seconds.
From: Norbert van Bolhuis @ 2010-11-09 9:47 UTC (permalink / raw)
To: Joakim Tjernlund; +Cc: linuxppc-dev, David Laight
In-Reply-To: <OF068D03E2.B4929626-ONC12577D5.0056CBDF-C12577D5.00571CBD@transmode.se>
Joakim Tjernlund wrote:
>>> I can't make out what is causing this hang every now an then:
>>>
>>> INFO: task snmpd:398 blocked for more than 120 seconds.
>> My problem with that 'error' message is that there is no way
>> for a driver to disable it on a per-process basis.
>> We have some processes whose 'normal state' is to sleep
>> uninterruptibly in the kernel. Shutdown is handled by
>> an explicit request (not by sending a signal).
>> The processes could be kernel worker threads (except that
>> is is ~impossible to handle them exiting from a loadble
>> kernel module) so are actually children of a daemon sat
>> inside an ioctl() request that never terminates!
>>
>> However, on the face of it, your case does look as though
>> the mutex is fubar'ed.
>>
>> Might be worth (somehow) dumping the mutex state.
>
> ehh, it is locked, isn't it? How to find who locked it
> and forgot to release it?
>
You could add show_state to check_hung_task
It worked for me while solving some (application) task hangups.
---
N. van Bolhuis.
^ permalink raw reply
* Re: [PATCH] powerpc: Add jump label support
From: Michael Ellerman @ 2010-11-09 4:02 UTC (permalink / raw)
To: Steven Rostedt
Cc: Stephen Rothwell, Kumar Gala, jbaron, linux-kernel, linuxppc-dev,
Anton Blanchard, David S. Miller
In-Reply-To: <1289274119.12418.79.camel@gandalf.stny.rr.com>
[-- Attachment #1: Type: text/plain, Size: 698 bytes --]
On Mon, 2010-11-08 at 22:41 -0500, Steven Rostedt wrote:
> On Tue, 2010-11-09 at 14:33 +1100, Michael Ellerman wrote:
>
> > > You don't need this protection in a file that is not exported to user
> > > space.
> >
> > Ah true. I'll respin after I've heard if anyone has tested it :)
>
> Don't wait for me. I'm stuck debugging some other crap. Getting a 4.5
> PPC compiler working is very low on my priority list, unfortunately. :-(
No worries, testing is for sissies anyway.
There are 4.5.0 crosses on kernel.org, I think they're the same as the
ones I'm using, which seem to work on powerpc at least.
http://kernel.org/pub/tools/crosstool/files/bin/x86_64/4.5.0/
cheers
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply
* Re: [PATCH] powerpc: Add jump label support
From: Steven Rostedt @ 2010-11-09 3:41 UTC (permalink / raw)
To: michael
Cc: Stephen Rothwell, Kumar Gala, jbaron, linux-kernel, linuxppc-dev,
Anton Blanchard, David S. Miller
In-Reply-To: <1289273608.21111.194.camel@concordia>
On Tue, 2010-11-09 at 14:33 +1100, Michael Ellerman wrote:
> > You don't need this protection in a file that is not exported to user
> > space.
>
> Ah true. I'll respin after I've heard if anyone has tested it :)
Don't wait for me. I'm stuck debugging some other crap. Getting a 4.5
PPC compiler working is very low on my priority list, unfortunately. :-(
-- Steve
^ permalink raw reply
* Re: [PATCH] powerpc: Add jump label support
From: Michael Ellerman @ 2010-11-09 3:33 UTC (permalink / raw)
To: Stephen Rothwell
Cc: Kumar Gala, jbaron, linux-kernel, rostedt, linuxppc-dev,
Anton Blanchard, David S. Miller
In-Reply-To: <20101109133517.b6be28bf.sfr@canb.auug.org.au>
[-- Attachment #1: Type: text/plain, Size: 1091 bytes --]
On Tue, 2010-11-09 at 13:35 +1100, Stephen Rothwell wrote:
> Hi Michael,
>
> Just a trivial note ...
>
> On Mon, 8 Nov 2010 15:12:46 +1100 (EST) Michael Ellerman <michael@ellerman.id.au> wrote:
> >
> > diff --git a/arch/powerpc/include/asm/jump_label.h b/arch/powerpc/include/asm/jump_label.h
> > new file mode 100644
> > index 0000000..feffb86
> > --- /dev/null
> > +++ b/arch/powerpc/include/asm/jump_label.h
> > @@ -0,0 +1,46 @@
> > +#ifndef _ASM_POWERPC_JUMP_LABEL_H
> > +#define _ASM_POWERPC_JUMP_LABEL_H
> > +
> > +/*
> > + * Copyright 2010 Michael Ellerman, IBM Corp.
> > + *
> > + * 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.
> > + */
> > +
> > +#ifdef __KERNEL__
>
> You don't need this protection in a file that is not exported to user
> space.
Ah true. I'll respin after I've heard if anyone has tested it :)
cheers
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply
* Re: [PATCH] powerpc: Add jump label support
From: Michael Ellerman @ 2010-11-09 3:33 UTC (permalink / raw)
To: Steven Rostedt
Cc: Kumar Gala, linux-kernel, David S.Miller, linuxppc-dev,
Anton Blanchard, jbaron
In-Reply-To: <1289225915.12418.2.camel@gandalf.stny.rr.com>
[-- Attachment #1: Type: text/plain, Size: 913 bytes --]
On Mon, 2010-11-08 at 09:18 -0500, Steven Rostedt wrote:
> On Mon, 2010-11-08 at 15:12 +1100, Michael Ellerman wrote:
> > This patch adds support for the new "jump label" feature.
>
> Darn it! I wanted to port this!!!
>
> ;-)
Sorry! I've been locked in a dark room for ages and this was a nice
chance to work on some upstream code for a change :)
> > Built for 64 & 32 bit, tested on 64 bit. Survives a kernel build under
> > perf with all tracepoints enabled, and manual inspection of the patched
> > code looks right. But still, lightly tested, YMMV.
> >
> > Unlike x86 and sparc we just merrily patch the code with no locks etc,
> > as far as I know this is safe, but I'm not really sure what the x86/sparc
> > code is protecting against so maybe it's not.
>
> Thanks, I'll give it a test on my electra as soon as I get a gcc 4.5.1
> cross compiler working.
Thanks.
cheers
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply
* [PATCH] powerpc: Consolidate obj-y assignments
From: Michael Ellerman @ 2010-11-09 3:31 UTC (permalink / raw)
To: linuxppc-dev
No need to have three of them.
Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
---
arch/powerpc/kernel/Makefile | 9 ++++-----
1 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile
index 36c30f3..3bb2a3e 100644
--- a/arch/powerpc/kernel/Makefile
+++ b/arch/powerpc/kernel/Makefile
@@ -29,8 +29,10 @@ endif
obj-y := cputable.o ptrace.o syscalls.o \
irq.o align.o signal_32.o pmc.o vdso.o \
init_task.o process.o systbl.o idle.o \
- signal.o sysfs.o cacheinfo.o
-obj-y += vdso32/
+ signal.o sysfs.o cacheinfo.o time.o \
+ prom.o traps.o setup-common.o \
+ udbg.o misc.o io.o dma.o \
+ misc_$(CONFIG_WORD_SIZE).o vdso32/
obj-$(CONFIG_PPC64) += setup_64.o sys_ppc32.o \
signal_64.o ptrace32.o \
paca.o nvram_64.o firmware.o
@@ -80,9 +82,6 @@ extra-$(CONFIG_FSL_BOOKE) := head_fsl_booke.o
extra-$(CONFIG_8xx) := head_8xx.o
extra-y += vmlinux.lds
-obj-y += time.o prom.o traps.o setup-common.o \
- udbg.o misc.o io.o dma.o \
- misc_$(CONFIG_WORD_SIZE).o
obj-$(CONFIG_PPC32) += entry_32.o setup_32.o
obj-$(CONFIG_PPC64) += dma-iommu.o iommu.o
obj-$(CONFIG_KGDB) += kgdb.o
--
1.7.1
^ permalink raw reply related
* Re: [PATCH] powerpc: Add jump label support
From: Stephen Rothwell @ 2010-11-09 2:35 UTC (permalink / raw)
To: Michael Ellerman
Cc: Kumar Gala, jbaron, linux-kernel, rostedt, linuxppc-dev,
Anton Blanchard, David S. Miller
In-Reply-To: <45fbc3cd7f6ce404d1e25bf01695fb629d86189d.1289189560.git.michael@ellerman.id.au>
[-- Attachment #1: Type: text/plain, Size: 1002 bytes --]
Hi Michael,
Just a trivial note ...
On Mon, 8 Nov 2010 15:12:46 +1100 (EST) Michael Ellerman <michael@ellerman.id.au> wrote:
>
> diff --git a/arch/powerpc/include/asm/jump_label.h b/arch/powerpc/include/asm/jump_label.h
> new file mode 100644
> index 0000000..feffb86
> --- /dev/null
> +++ b/arch/powerpc/include/asm/jump_label.h
> @@ -0,0 +1,46 @@
> +#ifndef _ASM_POWERPC_JUMP_LABEL_H
> +#define _ASM_POWERPC_JUMP_LABEL_H
> +
> +/*
> + * Copyright 2010 Michael Ellerman, IBM Corp.
> + *
> + * 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.
> + */
> +
> +#ifdef __KERNEL__
You don't need this protection in a file that is not exported to user
space.
--
Cheers,
Stephen Rothwell sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/
[-- Attachment #2: Type: application/pgp-signature, Size: 490 bytes --]
^ permalink raw reply
* Re: [PATCH] powerpc: Consolidate obj-y assignments
From: Michael Ellerman @ 2010-11-09 1:25 UTC (permalink / raw)
To: Peter Korsgaard; +Cc: linuxppc-dev
In-Reply-To: <87y694z3b8.fsf@macbook.be.48ers.dk>
[-- Attachment #1: Type: text/plain, Size: 681 bytes --]
On Mon, 2010-11-08 at 08:23 +0100, Peter Korsgaard wrote:
> >>>>> "Michael" == Michael Ellerman <michael@ellerman.id.au> writes:
>
> Michael> No need to have three of them.
> Michael> Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
> Michael> ---
> Michael> arch/powerpc/kernel/Makefile | 9 ++++-----
> Michael> 1 files changed, 4 insertions(+), 5 deletions(-)
>
> Michael> - signal.o sysfs.o cacheinfo.o
> Michael> -obj-y += vdso32/
> Michael> + signal.o sysfs.o cacheinfo.o time.o \
> Michael> + time.o prom.o traps.o setup-common.o \
>
> You have time.o twice.
Yeah, it makes the kernel run twice as fast.
cheers
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply
* [PATCH 01/17][trivial] powerpc: Remove unnecessary casts of void ptr returning alloc function return values
From: Jesper Juhl @ 2010-11-08 23:07 UTC (permalink / raw)
To: linux-kernel; +Cc: linuxppc-dev, trivial, Paul Mackerras
Hi,
The [vk][cmz]alloc(_node) family of functions return void pointers which
it's completely unnecessary/pointless to cast to other pointer types since
that happens implicitly.
This patch removes such casts from arch/powerpc/
Signed-off-by: Jesper Juhl <jj@chaosbits.net>
---
pgtable_32.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/powerpc/mm/pgtable_32.c b/arch/powerpc/mm/pgtable_32.c
index a87ead0..d1833ed 100644
--- a/arch/powerpc/mm/pgtable_32.c
+++ b/arch/powerpc/mm/pgtable_32.c
@@ -78,7 +78,7 @@ pgd_t *pgd_alloc(struct mm_struct *mm)
/* pgdir take page or two with 4K pages and a page fraction otherwise */
#ifndef CONFIG_PPC_4K_PAGES
- ret = (pgd_t *)kzalloc(1 << PGDIR_ORDER, GFP_KERNEL);
+ ret = kzalloc(1 << PGDIR_ORDER, GFP_KERNEL);
#else
ret = (pgd_t *)__get_free_pages(GFP_KERNEL|__GFP_ZERO,
PGDIR_ORDER - PAGE_SHIFT);
--
Jesper Juhl <jj@chaosbits.net> http://www.chaosbits.net/
Don't top-post http://www.catb.org/~esr/jargon/html/T/top-post.html
Plain text mails only, please.
^ permalink raw reply related
* Re: PowerMac8600 help ...
From: Benjamin Herrenschmidt @ 2010-11-08 22:31 UTC (permalink / raw)
To: kevin diggs; +Cc: Linuxppc-dev
In-Reply-To: <AANLkTiksY8x7XOifU3FAAPpCa_h4oEBmqu_a0vjRE5h5@mail.gmail.com>
On Mon, 2010-11-08 at 10:43 -0600, kevin diggs wrote:
>
> Sorry for the noise but I am having trouble getting the latest kernel
> built for a PowerMac8600 with a 750GX processor card. If this is not
> an appropriate topic for the list please tell me (and hopefully point
> me in the correct direction).
>
> I have narrowed the problem down to the compiler. YDL 4.0 is installed
> on the machine. The stock compiler is 3.3.3. That version can NOT
> build past 2.6.28. I built 3.4.6, (the latest 3 series I could find).
> It can NOT build later kernel versions either. It can build Firefox
> 2.0.0.15pre, including powerpc thin lock support. Running it now.
>
> I then tried 4.3.5. This will build the kernel. But the resulting
> kernel will NOT run. A firefox built with 4.3.5 also will not run. Or
> if it runs it crashes often (http://abcnews.com).
>
> What really puzzles me is I used the same basic compiler boot
> strapping (3.3.3 to build 3.4.6, 3.4.6 to build 4.3.5) on a GiGE. That
> machine is now running 2.6.36.
>
> The CFLAGS used were: "-O2 -mcpu=7450 -mmultiple -mstring" for the
> GiGE (dual 7455s). Substitute 750 for the 8600.
>
> Any suggestions would be appreciated.
This is odd... I wonder if your 8600 is having some memory problems ?
Have you tried using the kernel/firefox built with 4.3.5 on the GigE and
booting them on the 8600 ?
3.x are ancient but I would expect 4.3.x to work just fine
Cheers,
Ben.
^ permalink raw reply
* Re: [RFC PATCH 0/7 v2] ppc: enable dynamic dma window support
From: Nishanth Aravamudan @ 2010-11-08 19:42 UTC (permalink / raw)
To: sonnyrao, miltonm, Benjamin Herrenschmidt, Paul Mackerras,
Grant Likely, linuxppc-dev
In-Reply-To: <1288150518-4026-1-git-send-email-nacc@us.ibm.com>
Hi all,
On 26.10.2010 [20:35:10 -0700], Nishanth Aravamudan wrote:
> The following series, which builds upon the series of cleanups I posted
> on 9/15 and 10/18 as "ppc iommu cleanups", enables the pseries firmware
> feature dynamic dma windows. This feature will allow future devices to
> have a 64-bit DMA mapping covering all memory, coexisting with a smaller
> IOMMU window in 32-bit PCI space
Was ping'ing on this changeset. If there are no objections, I will
repost it without the RFC tag asking Ben to merge it.
Thanks,
Nish
> Changes from v1 to v2:
>
> Fixed numerous bugs/issues found in testing.
> Reworked to be based off platform hook dma_set_mask().
>
> Nishanth Aravamudan (7):
> macio: ensure all dma routines get copied over
> ppc: add memory_hotplug_max
> ppc: do not search for dma-window property on dlpar remove
> ppc: checking for pdn->parent is redundant
> ppc/iommu: do not need to check for dma_window == NULL
> ppc/iommu: pass phb only to iommu_table_setparms_lpar
> ppc: add dynamic dma window support
>
> arch/powerpc/include/asm/device.h | 6 +
> arch/powerpc/include/asm/mmzone.h | 5 +
> arch/powerpc/mm/numa.c | 26 ++
> arch/powerpc/platforms/pseries/iommu.c | 600 ++++++++++++++++++++++++++++++--
> drivers/macintosh/macio_asic.c | 7 +-
> 5 files changed, 619 insertions(+), 25 deletions(-)
>
>
--
Nishanth Aravamudan <nacc@us.ibm.com>
IBM Linux Technology Center
^ permalink raw reply
* Re: INFO: task snmpd:398 blocked for more than 120 seconds.
From: Joakim Tjernlund @ 2010-11-08 18:22 UTC (permalink / raw)
Cc: linuxppc-dev
In-Reply-To: <OF5A1033A2.48B05F1F-ONC12577D5.00605774-C12577D5.00606A22@transmode.se>
>
> linuxppc-dev-bounces+joakim.tjernlund=transmode.se@lists.ozlabs.org wrote on 2010/11/08 16:05:30:
>
> > From: Joakim Tjernlund <joakim.tjernlund@transmode.se>
> > To: linuxppc-dev@ozlabs.org
> > Date: 2010/11/08 16:12
> > Subject: INFO: task snmpd:398 blocked for more than 120 seconds.
> > Sent by: linuxppc-dev-bounces+joakim.tjernlund=transmode.se@lists.ozlabs.org
> >
> >
> > I can't make out what is causing this hang every now an then:
> >
> > INFO: task snmpd:398 blocked for more than 120 seconds.
> > "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
> > snmpd D 0fad1760 0 398 1 0x00000000
> > Call Trace:
> > [c7b5fc70] [c7a49a80] 0xc7a49a80 (unreliable)
> > [c7b5fd30] [c0008608] __switch_to+0x4c/0x6c
> > [c7b5fd40] [c028fed4] schedule+0x184/0x310
> > [c7b5fd70] [c0290e5c] __mutex_lock_slowpath+0xa4/0x150
> > [c7b5fdb0] [c0290c50] mutex_lock+0x44/0x48
> > [c7b5fdc0] [c01eb5b0] rtnl_lock+0x18/0x28
> > [c7b5fdd0] [c01df6c4] dev_ioctl+0x2b4/0x764
> > [c7b5fe60] [c01cafc8] sock_ioctl+0x18c/0x2a0
> > [c7b5fe80] [c009a16c] vfs_ioctl+0xcc/0xe0
> > [c7b5fea0] [c009a998] do_vfs_ioctl+0xc4/0x79c
> > [c7b5ff10] [c009b0b0] sys_ioctl+0x40/0x74
> > [c7b5ff40] [c00117c4] ret_from_syscall+0x0/0x38
> >
> > The dev_ioctl is in SIOCGIFCONF:
> > int dev_ioctl(struct net *net, unsigned int cmd, void __user *arg)
> > {
> > struct ifreq ifr;
> > int ret;
> > char *colon;
> >
> > /* One special case: SIOCGIFCONF takes ifconf argument
> > and requires shared lock, because it sleeps writing
> > to user space.
> > */
> >
> > if (cmd == SIOCGIFCONF) {
> > rtnl_lock();
> > ret = dev_ifconf(net, (char __user *) arg);
> > rtnl_unlock();
> > return ret;
> > }
> >
> > Any ideas? Kernel is 2.6.35
>
> I tried PROVE_LOCKING but now my kernel doesn't boot at all :)
>
> Something goes very wrong in arch/powerpc/kernel/prom.c:694
> 694 memblock_reserve(PHYSICAL_START, __pa(klimit) - PHYSICAL_START);
>
> (gdb) print klimit
> $8 = 0xc08c9000
>
> What is klimit and can I do something about it?
>
> kernel 2.6.35 on a mpc8321
That was not quite right, turns out that early_init_devtree(*params)
points to a memory that has been zeroed:
print initial_boot_params
$3 = (struct boot_param_header *) 0xc07fa000
Above matches what u-boot writes:
Booting kernel from Legacy Image at 00200000 ...
Image Name: oskernel02a:p1a:99
Created: 2010-11-08 18:09:28 UTC
Image Type: PowerPC Linux Kernel Image (gzip compressed)
Data Size: 1898430 Bytes = 1.8 MB
Load Address: 00000000
Entry Point: 00000000
Verifying Checksum ... OK
## Flattened Device Tree blob at 07fdebb0
Booting using the fdt blob at 0x7fdebb0
Uncompressing Kernel Image ... OK
Loading Device Tree to 007fa000, end 007ff327 ... OK
(gdb) print *initial_boot_params
$4 = {magic = 0x0, totalsize = 0x0, off_dt_struct = 0x0, off_dt_strings = 0x0,
off_mem_rsvmap = 0x0, version = 0x0, last_comp_version = 0x0,
boot_cpuid_phys = 0x0, dt_strings_size = 0x0, dt_struct_size = 0x0}
Jocke
^ permalink raw reply
* Re: INFO: task snmpd:398 blocked for more than 120 seconds.
From: Joakim Tjernlund @ 2010-11-08 17:33 UTC (permalink / raw)
Cc: linuxppc-dev
In-Reply-To: <OF385C74E5.E81887CB-ONC12577D5.00527686-C12577D5.0052E6B5@transmode.se>
linuxppc-dev-bounces+joakim.tjernlund=transmode.se@lists.ozlabs.org wrote on 2010/11/08 16:05:30:
> From: Joakim Tjernlund <joakim.tjernlund@transmode.se>
> To: linuxppc-dev@ozlabs.org
> Date: 2010/11/08 16:12
> Subject: INFO: task snmpd:398 blocked for more than 120 seconds.
> Sent by: linuxppc-dev-bounces+joakim.tjernlund=transmode.se@lists.ozlabs.org
>
>
> I can't make out what is causing this hang every now an then:
>
> INFO: task snmpd:398 blocked for more than 120 seconds.
> "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
> snmpd D 0fad1760 0 398 1 0x00000000
> Call Trace:
> [c7b5fc70] [c7a49a80] 0xc7a49a80 (unreliable)
> [c7b5fd30] [c0008608] __switch_to+0x4c/0x6c
> [c7b5fd40] [c028fed4] schedule+0x184/0x310
> [c7b5fd70] [c0290e5c] __mutex_lock_slowpath+0xa4/0x150
> [c7b5fdb0] [c0290c50] mutex_lock+0x44/0x48
> [c7b5fdc0] [c01eb5b0] rtnl_lock+0x18/0x28
> [c7b5fdd0] [c01df6c4] dev_ioctl+0x2b4/0x764
> [c7b5fe60] [c01cafc8] sock_ioctl+0x18c/0x2a0
> [c7b5fe80] [c009a16c] vfs_ioctl+0xcc/0xe0
> [c7b5fea0] [c009a998] do_vfs_ioctl+0xc4/0x79c
> [c7b5ff10] [c009b0b0] sys_ioctl+0x40/0x74
> [c7b5ff40] [c00117c4] ret_from_syscall+0x0/0x38
>
> The dev_ioctl is in SIOCGIFCONF:
> int dev_ioctl(struct net *net, unsigned int cmd, void __user *arg)
> {
> struct ifreq ifr;
> int ret;
> char *colon;
>
> /* One special case: SIOCGIFCONF takes ifconf argument
> and requires shared lock, because it sleeps writing
> to user space.
> */
>
> if (cmd == SIOCGIFCONF) {
> rtnl_lock();
> ret = dev_ifconf(net, (char __user *) arg);
> rtnl_unlock();
> return ret;
> }
>
> Any ideas? Kernel is 2.6.35
I tried PROVE_LOCKING but now my kernel doesn't boot at all :)
Something goes very wrong in arch/powerpc/kernel/prom.c:694
694 memblock_reserve(PHYSICAL_START, __pa(klimit) - PHYSICAL_START);
(gdb) print klimit
$8 = 0xc08c9000
What is klimit and can I do something about it?
kernel 2.6.35 on a mpc8321
^ permalink raw reply
* PowerMac8600 help ...
From: kevin diggs @ 2010-11-08 16:43 UTC (permalink / raw)
To: Linuxppc-dev
Hi,
Sorry for the noise but I am having trouble getting the latest kernel
built for a PowerMac8600 with a 750GX processor card. If this is not
an appropriate topic for the list please tell me (and hopefully point
me in the correct direction).
I have narrowed the problem down to the compiler. YDL 4.0 is installed
on the machine. The stock compiler is 3.3.3. That version can NOT
build past 2.6.28. I built 3.4.6, (the latest 3 series I could find).
It can NOT build later kernel versions either. It can build Firefox
2.0.0.15pre, including powerpc thin lock support. Running it now.
I then tried 4.3.5. This will build the kernel. But the resulting
kernel will NOT run. A firefox built with 4.3.5 also will not run. Or
if it runs it crashes often (http://abcnews.com).
What really puzzles me is I used the same basic compiler boot
strapping (3.3.3 to build 3.4.6, 3.4.6 to build 4.3.5) on a GiGE. That
machine is now running 2.6.36.
The CFLAGS used were: "-O2 -mcpu=7450 -mmultiple -mstring" for the
GiGE (dual 7455s). Substitute 750 for the 8600.
Any suggestions would be appreciated.
Thanks!
kevin
P.S.: Why does this program work:
int main(int argc, char *argv[])
{
unsigned int pvr;
// asm("mfspr %0,22\n"
asm("mfspr %0,287\n"
:"=r" (pvr)
);
printf("pvr is 0x%x\n",pvr);
}
>From what I have read, access to the pvr is restricted? strace does
not show an illegal instruction trap for SPRN_PVR.
^ permalink raw reply
* Better performance when CONFIG_DEBUG_KERNEL is on
From: Jean-Michel Hautbois @ 2010-11-08 16:00 UTC (permalink / raw)
To: linuxppc-dev
Hi everybody,
I am using a mpc5200 chip with a linux 2.6.33.7-rt29.
I am using the ELDK toolchain :
ppc_6xx-gcc -v
Target: powerpc-linux
Configured with:
/opt/eldk/build/ppc-2008-04-01/work/usr/src/denx/BUILD/crosstool-0.43/build/gcc-4.2.2-glibc-20070515T2025-eldk/powerpc-linux/gcc-4.2.2/configure
--target=powerpc-linux --host=i686-host_pc-linux-gnu
--prefix=/var/tmp/eldk.UZpAG7/usr/crosstool/gcc-4.2.2-glibc-20070515T2025-eldk/powerpc-linux
--disable-hosted-libstdcxx
--with-headers=/var/tmp/eldk.UZpAG7/usr/crosstool/gcc-4.2.2-glibc-20070515T2025-eldk/powerpc-linux/powerpc-linux/include
--with-local-prefix=/var/tmp/eldk.UZpAG7/usr/crosstool/gcc-4.2.2-glibc-20070515T2025-eldk/powerpc-linux/powerpc-linux
--disable-nls --enable-threads=posix --enable-symvers=gnu
--enable-__cxa_atexit --enable-languages=c,c++,java --enable-shared
--enable-c99 --enable-long-long --without-x
Thread model: posix
gcc version 4.2.2
When I have the CONFIG_DEBUG_KERNEL flag, the latencies I am mesuring
are better than when the flag is off.
And the jitter is lower...
I must tell I am confused. I have no explanation about that, except
maybe optimisations which would be different when the -g flag is
added...
If any of you has an idea, I am looking forward for your response :).
Thanks in advance,
Best Regards.
JM
^ permalink raw reply
* RE: INFO: task snmpd:398 blocked for more than 120 seconds.
From: Joakim Tjernlund @ 2010-11-08 15:51 UTC (permalink / raw)
To: David Laight; +Cc: linuxppc-dev
In-Reply-To: <AE90C24D6B3A694183C094C60CF0A2F6D8AB9A@saturn3.aculab.com>
>
> > I can't make out what is causing this hang every now an then:
> >
> > INFO: task snmpd:398 blocked for more than 120 seconds.
>
> My problem with that 'error' message is that there is no way
> for a driver to disable it on a per-process basis.
> We have some processes whose 'normal state' is to sleep
> uninterruptibly in the kernel. Shutdown is handled by
> an explicit request (not by sending a signal).
> The processes could be kernel worker threads (except that
> is is ~impossible to handle them exiting from a loadble
> kernel module) so are actually children of a daemon sat
> inside an ioctl() request that never terminates!
>
> However, on the face of it, your case does look as though
> the mutex is fubar'ed.
>
> Might be worth (somehow) dumping the mutex state.
ehh, it is locked, isn't it? How to find who locked it
and forgot to release it?
Jocke
^ permalink raw reply
* RE: INFO: task snmpd:398 blocked for more than 120 seconds.
From: David Laight @ 2010-11-08 15:19 UTC (permalink / raw)
To: linuxppc-dev
In-Reply-To: <OF385C74E5.E81887CB-ONC12577D5.00527686-C12577D5.0052E6B5@transmode.se>
=20
> I can't make out what is causing this hang every now an then:
>=20
> INFO: task snmpd:398 blocked for more than 120 seconds.
My problem with that 'error' message is that there is no way
for a driver to disable it on a per-process basis.
We have some processes whose 'normal state' is to sleep
uninterruptibly in the kernel. Shutdown is handled by
an explicit request (not by sending a signal).
The processes could be kernel worker threads (except that
is is ~impossible to handle them exiting from a loadble
kernel module) so are actually children of a daemon sat
inside an ioctl() request that never terminates!
However, on the face of it, your case does look as though
the mutex is fubar'ed.
Might be worth (somehow) dumping the mutex state.
David
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox