LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH/RFC] Rework ptep_set_access_flags and fix sun4c
From: Benjamin Herrenschmidt @ 2007-05-22 23:29 UTC (permalink / raw)
  To: David Miller
  Cc: mark, linux-mm, wli, linuxppc-dev, andrea, tcallawa, sparclinux,
	hugh, akpm
In-Reply-To: <20070522.145340.59657045.davem@davemloft.net>

On Tue, 2007-05-22 at 14:53 -0700, David Miller wrote:
> From: Mark Fortescue <mark@mtfhpc.demon.co.uk>
> Date: Tue, 22 May 2007 22:52:13 +0100 (BST)
> 
> > Hi Benjamin,
> > 
> > I have just tested this patch on my Sun4c Sparcstation 1 using my 2.6.20.9 
> > test kernel without any problems.
> > 
> > Thank you for the work.
> 
> Thanks for your testing.
> 
> Someone please merge this in once any remaining issues have
> been resolved :-)

I'll send a patch fixing the couple of x86/ia64 nits & my bad english
spelling (no, I don't happen to raise castrated rams) as soon as I reach
the office later today.

Cheers,
Ben.

^ permalink raw reply

* [PATCH] powerpc: publish 85xx soc dts entries as of_device on cds and ads platforms
From: Dave Jiang @ 2007-05-22 23:28 UTC (permalink / raw)
  To: paulus, galak; +Cc: linuxppc-dev, bluesmoke-devel

Publish the devices listed in dts under SOC as of_device just like what
mpc85xx_mds platforms do. The 85xx cds and ads platforms currently do not
export the devices in dts as of_device.

I need the memory controller, L2 cache-controller, and the PCI controller
published as of_device so the mpc85xx EDAC driver can claim them for usage.

The mpc85xx EDAC driver can be found at:
http://bluesmoke.sourceforge.net/

It's in development to be pushed into the kernel.

Signed-off-by: Dave Jiang <djiang@mvista.com>

---

 arch/powerpc/platforms/85xx/mpc85xx_ads.c |   19 +++++++++++++++++++
 arch/powerpc/platforms/85xx/mpc85xx_cds.c |   19 +++++++++++++++++++
 2 files changed, 38 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/platforms/85xx/mpc85xx_ads.c b/arch/powerpc/platforms/85xx/mpc85xx_ads.c
index 5d27621..217cc13 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_ads.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_ads.c
@@ -18,6 +18,8 @@
 #include <linux/delay.h>
 #include <linux/seq_file.h>
 
+#include <asm/of_device.h>
+#include <asm/of_platform.h>
 #include <asm/system.h>
 #include <asm/time.h>
 #include <asm/machdep.h>
@@ -277,6 +279,23 @@ static int __init mpc85xx_ads_probe(void)
         return of_flat_dt_is_compatible(root, "MPC85xxADS");
 }
 
+static struct of_device_id mpc85xx_ids[] = {
+	{ .type = "soc", },
+	{ .compatible = "soc", },
+	{},
+};
+
+static int __init mpc85xx_publish_devices(void)
+{
+	if (!machine_is(mpc85xx_ads))
+		return 0;
+
+	of_platform_bus_probe(NULL, mpc85xx_ids, NULL);
+
+	return 0;
+}
+device_initcall(mpc85xx_publish_devices);
+
 define_machine(mpc85xx_ads) {
 	.name			= "MPC85xx ADS",
 	.probe			= mpc85xx_ads_probe,
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_cds.c b/arch/powerpc/platforms/85xx/mpc85xx_cds.c
index 1490eb3..77ef0cf 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_cds.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_cds.c
@@ -26,6 +26,8 @@
 #include <linux/module.h>
 #include <linux/fsl_devices.h>
 
+#include <asm/of_device.h>
+#include <asm/of_platform.h>
 #include <asm/system.h>
 #include <asm/pgtable.h>
 #include <asm/page.h>
@@ -296,6 +298,23 @@ static int __init mpc85xx_cds_probe(void)
         return of_flat_dt_is_compatible(root, "MPC85xxCDS");
 }
 
+static struct of_device_id mpc85xx_ids[] = {
+	{ .type = "soc", },
+	{ .compatible = "soc", },
+	{},
+};
+
+static int __init mpc85xx_publish_devices(void)
+{
+	if (!machine_is(mpc85xx_cds))
+		return 0;
+
+	of_platform_bus_probe(NULL, mpc85xx_ids, NULL);
+
+	return 0;
+}
+device_initcall(mpc85xx_publish_devices);
+
 define_machine(mpc85xx_cds) {
 	.name		= "MPC85xx CDS",
 	.probe		= mpc85xx_cds_probe,

^ permalink raw reply related

* Re: [PATCH/RFC] Rework ptep_set_access_flags and fix sun4c
From: Benjamin Herrenschmidt @ 2007-05-22 23:28 UTC (permalink / raw)
  To: Mark Fortescue
  Cc: linux-mm, wli, linuxppc-dev, andrea, Tom "spot" Callaway,
	sparclinux, Hugh Dickins, akpm, David Miller
In-Reply-To: <Pine.LNX.4.61.0705222247010.5890@mtfhpc.demon.co.uk>

On Tue, 2007-05-22 at 22:52 +0100, Mark Fortescue wrote:
> Hi Benjamin,
> 
> I have just tested this patch on my Sun4c Sparcstation 1 using my 2.6.20.9 
> test kernel without any problems.
> 
> Thank you for the work.

Wow, there is more than one user of these still ! :-)

Cheers,
Ben.

^ permalink raw reply

* [PATCH] powerpc: setup Marvell mv64x60 platform devices for EDAC
From: Dave Jiang @ 2007-05-22 23:24 UTC (permalink / raw)
  To: paulus; +Cc: linuxppc-dev, dfarnsworth, bluesmoke-devel

Creating platform devices (memory controller, sram error registers, cpu error
registers, PCI error registers) for Error Detection and Correction (EDAC)
driver on the Marvell mv64x60 based platforms.

The platform devices allow the mv64x60 EDAC driver to detect errors from the
memory controller (ECC erorrs), SRAM controller, CPU data path error registers,
and PCI error registers. The errors are reported to syslog. Software ECC
scrubbing is provided. These replace the mv64x60 error handlers in the ppc branch
They are being moved to EDAC subsystem in order to centralize error reporting. 

The error reporting can be triggered via interrupts from the mv64x60 bridge chip
or via polling mechanism provided by the EDAC core code.

The mv64x60 EDAC driver can be found at:
http://bluesmoke.sourceforge.net/

It's in development to be pushed into the kernel.

Signed-off-by: Dave Jiang <djiang@mvista.com>

---

 arch/powerpc/sysdev/mv64x60_dev.c |  183 +++++++++++++++++++++++++++++++++++++
 1 files changed, 183 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/sysdev/mv64x60_dev.c b/arch/powerpc/sysdev/mv64x60_dev.c
index 4b0a9c8..ce37ab8 100644
--- a/arch/powerpc/sysdev/mv64x60_dev.c
+++ b/arch/powerpc/sysdev/mv64x60_dev.c
@@ -16,6 +16,7 @@
 #include <linux/platform_device.h>
 
 #include <asm/prom.h>
+#include <asm/io.h>
 
 /*
  * These functions provide the necessary setup for the mv64x60 drivers.
@@ -389,6 +390,154 @@ error:
 	return err;
 }
 
+/*
+ * Platform device setup for EDAC memory controller
+ */
+static int __init mv64x60_mem_ctrl_init(struct device_node *np, int id)
+{
+	struct resource r[2];
+	struct platform_device *pdev;
+	int ret;
+
+	memset(r, 0, sizeof(r));
+
+	ret = of_address_to_resource(np, 0, &r[0]);
+	if (ret)
+		goto err;
+
+	of_irq_to_resource(np, 0, &r[1]);
+
+	pdev = platform_device_register_simple("mv64x60_mc_err", id, r, 2);
+	if (IS_ERR(pdev))
+		return PTR_ERR(pdev);
+
+	return 0;
+
+err:
+	return ret;
+}
+
+/*
+ * Platform device setup for EDAC CPU errors
+ */
+static int __init mv64x60_cpu_error_init(struct device_node *np, int id)
+{
+	struct resource r[3];
+	struct platform_device *pdev;
+	int ret;
+
+	memset(r, 0, sizeof(r));
+
+	ret = of_address_to_resource(np, 0, &r[0]);
+	if (ret)
+		goto err;
+
+	ret = of_address_to_resource(np, 1, &r[1]);
+	if (ret)
+		goto err;
+
+	of_irq_to_resource(np, 0, &r[2]);
+
+	pdev = platform_device_register_simple("mv64x60_cpu_err", id, r, 3);
+	if (IS_ERR(pdev))
+		return PTR_ERR(pdev);
+
+	return 0;
+
+err:
+	return ret;
+}
+
+/*
+ * Platform device setup for EDAC SRAM errors
+ */
+static int __init mv64x60_sram_ctrl_init(struct device_node *np, int id)
+{
+	struct resource r[2];
+	struct platform_device *pdev;
+	int ret;
+
+	memset(r, 0, sizeof(r));
+
+	ret = of_address_to_resource(np, 0, &r[0]);
+	if (ret)
+		goto err;
+
+	of_irq_to_resource(np, 0, &r[1]);
+
+	pdev = platform_device_register_simple("mv64x60_sram_err", id, r, 2);
+	if (IS_ERR(pdev))
+		return PTR_ERR(pdev);
+
+	return 0;
+
+err:
+	return ret;
+}
+
+#ifdef CONFIG_PCI
+/*
+ * Bit 0 of MV64x60_PCIx_ERR_MASK does not exist on the 64360 and because of
+ * errata FEr-#11 and FEr-##16 for the 64460, it should be 0 on that chip as
+ * well.  IOW, don't set bit 0.
+ */
+#define MV64X60_PCIx_ERR_MASK_VAL	0x00a50c24
+
+/* Erratum FEr PCI-#16: clear bit 0 of PCI SERRn Mask reg. */
+static int __init mv64x60_pci_fixup(struct device_node *np)
+{
+	struct resource res;
+	void __iomem *pci_serr;
+	int ret;
+
+	ret = of_address_to_resource(np, 1, &res);
+	if (ret)
+		return ret;
+
+	pci_serr = ioremap(res.start, res.end - res.start + 1);
+	if (!pci_serr)
+		return -ENOMEM;
+
+	out_le32(pci_serr, in_le32(pci_serr) & ~0x1);
+	iounmap(pci_serr);
+
+	return 0;
+}
+
+/*
+ * Platform device setup for EDAC PCI errors
+ */
+static int __init mv64x60_pci_error_init(struct device_node *np, int id)
+{
+	struct resource r[2];
+	struct platform_device *pdev;
+	int ret;
+
+	memset(r, 0, sizeof(r));
+
+	ret = mv64x60_pci_fixup(np);
+	if (ret)
+		goto err;
+
+	ret = of_address_to_resource(np, 0, &r[0]);
+	if (ret)
+		goto err;
+
+	of_irq_to_resource(np, 0, &r[1]);
+
+	pdev = platform_device_register_simple("mv64x60_pci_err", id, r, 2);
+	if (IS_ERR(pdev)) {
+		ret = PTR_ERR(pdev);
+		goto err;
+	}
+
+	return 0;
+
+err:
+	return ret;
+}
+#endif	/* CONFIG_PCI */
+
 static int __init mv64x60_device_setup(void)
 {
 	struct device_node *np = NULL;
@@ -413,6 +562,40 @@ static int __init mv64x60_device_setup(void)
 		if ((err = mv64x60_i2c_device_setup(np, id)))
 			goto error;
 
+	for (id = 0;
+	     (np = of_find_compatible_node(np, 
+					   NULL, 
+					   "marvell,mv64x60-mem-ctrl"));
+	     id++)
+		if ((err = mv64x60_mem_ctrl_init(np, id)))
+			goto error;
+
+	for (id = 0;
+	     (np = of_find_compatible_node(np, 
+					   NULL, 
+					   "marvell,mv64x60-cpu-error"));
+	     id++)
+		if ((err = mv64x60_cpu_error_init(np, id)))
+			goto error;
+
+	for (id = 0;
+	     (np = of_find_compatible_node(np, 
+					   NULL, 
+					   "marvell,mv64x60-sram-ctrl"));
+	     id++)
+		if ((err = mv64x60_sram_ctrl_init(np, id)))
+			goto error;
+
+#ifdef CONFIG_PCI
+	for (id = 0;
+	     (np = of_find_compatible_node(np, 
+					   NULL, 
+					   "marvell,mv64x60-pci-error"));
+	     id++)
+		if ((err = mv64x60_pci_error_init(np, id)))
+			goto error;
+#endif
+
 	return 0;
 
 error:

^ permalink raw reply related

* [PATCH 3/10] spidernet: move a block of code around
From: Linas Vepstas @ 2007-05-22 23:21 UTC (permalink / raw)
  To: Jeff Garzik, Andrew Morton
  Cc: netdev, Florin Malita, cbe-oss-dev, linuxppc-dev
In-Reply-To: <20070522230942.GT5921@austin.ibm.com>


Put the enable and disable routines next to one-another, 
as this makes verifying thier symmetry that much easier.

Signed-off-by: Linas Vepstas <linas@austin.ibm.com>

----
 drivers/net/spider_net.c |   28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)

Index: netdev-2.6/drivers/net/spider_net.c
===================================================================
--- netdev-2.6.orig/drivers/net/spider_net.c	2007-05-22 18:03:24.000000000 -0500
+++ netdev-2.6/drivers/net/spider_net.c	2007-05-22 18:03:30.000000000 -0500
@@ -506,6 +506,20 @@ spider_net_enable_rxdmac(struct spider_n
 }
 
 /**
+ * spider_net_disable_rxdmac - disables the receive DMA controller
+ * @card: card structure
+ *
+ * spider_net_disable_rxdmac terminates processing on the DMA controller
+ * by turing off the DMA controller, with the force-end flag set.
+ */
+static inline void
+spider_net_disable_rxdmac(struct spider_net_card *card)
+{
+	spider_net_write_reg(card, SPIDER_NET_GDADMACCNTR,
+			     SPIDER_NET_DMA_RX_FEND_VALUE);
+}
+
+/**
  * spider_net_refill_rx_chain - refills descriptors/skbs in the rx chains
  * @card: card structure
  *
@@ -657,20 +671,6 @@ write_hash:
 }
 
 /**
- * spider_net_disable_rxdmac - disables the receive DMA controller
- * @card: card structure
- *
- * spider_net_disable_rxdmac terminates processing on the DMA controller by
- * turing off DMA and issueing a force end
- */
-static void
-spider_net_disable_rxdmac(struct spider_net_card *card)
-{
-	spider_net_write_reg(card, SPIDER_NET_GDADMACCNTR,
-			     SPIDER_NET_DMA_RX_FEND_VALUE);
-}
-
-/**
  * spider_net_prepare_tx_descr - fill tx descriptor with skb data
  * @card: card structure
  * @descr: descriptor structure to fill out

^ permalink raw reply

* Please pull powerpc.git master branch
From: Paul Mackerras @ 2007-05-22 23:18 UTC (permalink / raw)
  To: torvalds; +Cc: linuxppc-dev

Linus,

Please do:

git pull \
git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc.git master

to get some powerpc bug fixes, including one from Ben H that fixes an
error in our vmlinux.lds.S which is currently making our kernels
unbootable.

Thanks,
Paul.

 arch/powerpc/kernel/cputable.c    |    4 ++++
 arch/powerpc/kernel/pmc.c         |    6 +++---
 arch/powerpc/kernel/smp.c         |   34 ++++++++++++++++++----------------
 arch/powerpc/kernel/vmlinux.lds.S |    1 -
 arch/powerpc/mm/mem.c             |    9 +++++----
 5 files changed, 30 insertions(+), 24 deletions(-)

commit 5453e7723b95958f4591b2e0063573d8d53e7699
Author: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Date:   Tue May 22 16:25:51 2007 +1000

    [POWERPC] Fix warning in 32-bit builds with CONFIG_HIGHMEM
    
    Some missing fixup for the removal of 4 level fixup header.
    
    Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
    Signed-off-by: Paul Mackerras <paulus@samba.org>

commit 832a791c580a86cbeea5bb12a984d95b1f458539
Author: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Date:   Tue May 22 14:33:05 2007 +1000

    [POWERPC] Fix powerpc vmlinux.lds.S
    
    Sam's recent change in 7664709b44a13e2e0b545e2dd8e7b8797a1748dc
    broke things for us because we ended up with *(.text.*) before
    *(.text), whereas previously *(.text) was first.  This was
    important because the start of the text section contains the
    kernel entry point.
    
    In fact, we don't need that *(.text.*) thing anymore and it
    incorrectly matched .text.init.refok, thus putting it before
    .text. .. ouch !
    
    Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
    Signed-off-by: Paul Mackerras <paulus@samba.org>

commit 177e9ea49deea238f59bb0b1708cfc60b75828fb
Author: Anton Blanchard <anton@samba.org>
Date:   Sun May 20 03:13:43 2007 +1000

    [POWERPC] Fix typo: MMCR0_PMA0 != MMCR0_PMAO
    
    pmc.c has:
    
    #ifndef MMCR0_PMA0
    #define MMCR0_PMA0     0
    
    This one took a while to find.  Unfortunately its the wrong define
    (number 0 vs letter O). Its probably worth removing this override, since
    if our includes get screwed up we will have the same (hard to debug)
    failure.
    
    Fix it simply for now, so that we can backport to stable.
    
    Signed-off-by: Anton Blanchard <anton@samba.org>
    Signed-off-by: Paul Mackerras <paulus@samba.org>

commit 2fae4985a135ca5d7d9bba17d45d674c099621b4
Author: Anton Blanchard <anton@samba.org>
Date:   Sat May 19 15:22:41 2007 +1000

    [POWERPC] Add missing pmc_type fields in cpu_table
    
    A number of cpu_table entries were missing the pmc_type field,
    which means that the sysfs entries for the performance monitor
    counters don't get created.  This adds them.
    
    Signed-off-by: Anton Blanchard <anton@samba.org>
    Signed-off-by: Paul Mackerras <paulus@samba.org>

commit d3fdaed9e973687f088c9c156a6e20870386e0b7
Author: Hugh Dickins <hugh@veritas.com>
Date:   Sat May 19 02:47:01 2007 +1000

    [POWERPC] Fix smp_call_function to be preempt-safe
    
    smp_call_function_map() was not safe against preemption to another
    cpu: its test for removing self from map was outside the spinlock.
    Rearrange it a little to fix that.
    
    smp_call_function_single() was also wrong: now get_cpu() before
    excluding self, as other architectures do.
    
    Signed-off-by: Hugh Dickins <hugh@veritas.com>
    Signed-off-by: Paul Mackerras <paulus@samba.org>

^ permalink raw reply

* [PATCH 2/10] spidernet: beautify error messages
From: Linas Vepstas @ 2007-05-22 23:13 UTC (permalink / raw)
  To: Jeff Garzik, Andrew Morton
  Cc: netdev, Florin Malita, cbe-oss-dev, linuxppc-dev
In-Reply-To: <20070522230942.GT5921@austin.ibm.com>


Make error messages print which interface they apply to.

Signed-off-by: Linas Vepstas <linas@austin.ibm.com>

----
 drivers/net/spider_net.c |   10 ++++++----
 drivers/net/spider_net.h |    2 +-
 2 files changed, 7 insertions(+), 5 deletions(-)

Index: netdev-2.6/drivers/net/spider_net.c
===================================================================
--- netdev-2.6.orig/drivers/net/spider_net.c	2007-05-22 18:03:16.000000000 -0500
+++ netdev-2.6/drivers/net/spider_net.c	2007-05-22 18:03:24.000000000 -0500
@@ -434,7 +434,8 @@ spider_net_prepare_rx_descr(struct spide
 				      bufsize + SPIDER_NET_RXBUF_ALIGN - 1);
 	if (!descr->skb) {
 		if (netif_msg_rx_err(card) && net_ratelimit())
-			pr_err("Not enough memory to allocate rx buffer\n");
+			pr_err("%s: Not enough memory to allocate rx buffer\n",
+			    card->netdev->name);
 		card->spider_stats.alloc_rx_skb_error++;
 		return -ENOMEM;
 	}
@@ -455,7 +456,8 @@ spider_net_prepare_rx_descr(struct spide
 		dev_kfree_skb_any(descr->skb);
 		descr->skb = NULL;
 		if (netif_msg_rx_err(card) && net_ratelimit())
-			pr_err("Could not iommu-map rx buffer\n");
+			pr_err("%s: Could not iommu-map rx buffer\n",
+			      card->netdev->name);
 		card->spider_stats.rx_iommu_map_error++;
 		hwdescr->dmac_cmd_status = SPIDER_NET_DESCR_NOT_IN_USE;
 	} else {
@@ -1455,8 +1457,8 @@ spider_net_handle_error_irq(struct spide
 	case SPIDER_NET_GRFAFLLINT: /* fallthrough */
 	case SPIDER_NET_GRMFLLINT:
 		if (netif_msg_intr(card) && net_ratelimit())
-			pr_err("Spider RX RAM full, incoming packets "
-			       "might be discarded!\n");
+			pr_err("%s: Spider RX RAM full, incoming packets "
+			       "might be discarded!\n", card->netdev->name);
 		spider_net_rx_irq_off(card);
 		netif_rx_schedule(card->netdev);
 		show_error = 0;
Index: netdev-2.6/drivers/net/spider_net.h
===================================================================
--- netdev-2.6.orig/drivers/net/spider_net.h	2007-05-21 17:40:49.000000000 -0500
+++ netdev-2.6/drivers/net/spider_net.h	2007-05-22 18:03:24.000000000 -0500
@@ -25,7 +25,7 @@
 #ifndef _SPIDER_NET_H
 #define _SPIDER_NET_H
 
-#define VERSION "2.0 A"
+#define VERSION "2.0 B"
 
 #include "sungem_phy.h"
 

^ permalink raw reply

* [PATCH 1/10] spidernet: skb used after netif_receive_skb
From: Linas Vepstas @ 2007-05-22 23:09 UTC (permalink / raw)
  To: Jeff Garzik, Andrew Morton
  Cc: netdev, Florin Malita, cbe-oss-dev, linuxppc-dev

From: Florin Malita <fmalita@gmail.com>

The stats update code in spider_net_pass_skb_up() is touching the skb 
after it's been passed up to the stack. To avoid that, just update the 
stats first.

Signed-off-by: Florin Malita <fmalita@gmail.com>
Signed-off-by: Linas Vepstas <linas@austin.ibm.com>
----

 drivers/net/spider_net.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/spider_net.c b/drivers/net/spider_net.c
index 108adbf..1df2f0b 100644
Index: netdev-2.6/drivers/net/spider_net.c
===================================================================
--- netdev-2.6.orig/drivers/net/spider_net.c	2007-05-21 17:40:49.000000000 -0500
+++ netdev-2.6/drivers/net/spider_net.c	2007-05-22 18:03:16.000000000 -0500
@@ -1014,12 +1014,12 @@ spider_net_pass_skb_up(struct spider_net
 		 */
 	}
 
-	/* pass skb up to stack */
-	netif_receive_skb(skb);
-
 	/* update netdevice statistics */
 	card->netdev_stats.rx_packets++;
 	card->netdev_stats.rx_bytes += skb->len;
+
+	/* pass skb up to stack */
+	netif_receive_skb(skb);
 }
 
 #ifdef DEBUG

^ permalink raw reply

* Re: [PATCH/RFC] Rework ptep_set_access_flags and fix sun4c
From: Tom "spot" Callaway @ 2007-05-22 23:04 UTC (permalink / raw)
  To: Benjamin Herrenschmidt
  Cc: mark, linux-mm, wli, linuxppc-dev, andrea, sparclinux,
	Hugh Dickins, akpm, David Miller
In-Reply-To: <1179874748.32247.868.camel@localhost.localdomain>

On Wed, 2007-05-23 at 08:59 +1000, Benjamin Herrenschmidt wrote:

> Well, I don't know which is why I'm waiting for Tom Callaway to test.
> Davem mentioned update_mmu_cache only though when we discussed the
> problem initially.

Mark already tested it and said it worked for him. This is sufficient
for me, as I'm not sure how many Aurora sun4c users there actually are.
If the extra bit turns out to be needed, I can push an update.

~spot

^ permalink raw reply

* Re: Porting RapidIO from ppc arch to powerpc arch in support of MPC8641D
From: Arnd Bergmann @ 2007-05-22 23:05 UTC (permalink / raw)
  To: linuxppc-dev, pterry
In-Reply-To: <1179862732.25914.40.camel@pterry-fc6.micromemory.com>

On Tuesday 22 May 2007, Phil Terry wrote:
> Guys n Gals,
> 
> I'm new to this list so I hope this isn't the wrong place to be asking
> these questions.

Hi Phil,

It's the right place, welcome here!

> So I want to explain an overview of what I intend to do for this port
> and if anyone can either tell me where its already been done (yippee),
> tell me I'm on the right track (ok) or tell me I'm on the wrong track
> (bad) that would be great.

I think you are on the right track. It depends a lot on what degree of
probing is possible on rapidio. For most of the bus types that we have
recently added, like plb5 or siliconbackplane, this would be "not at all",
but the code in drivers/rapidio suggests that this one is doing
it correctly and it allows you to probe every device on the bus as long
as you can find the bus controller.

> So I'm taking the boot/dts/mpc8641_hpcn.dts and producing a new
> mpc8641D_umem.dts with the following addition to the soc.
> 
> srio@c0000 {
>                 device_type = "srio";
>                 compatible = "86xx,85xx";
> 		reg = <c0000 20000>;
> 		law = <400000000 e00000000>;
> 		dbells = <0 ffff>;
> 		mboxs = <0 4>;
>                 interrupt-parent = <&mpic>;
>                 interrupts = <30 1 31 1 32 1 35 1 36 1 37 1 38 1>;
>               };
>
> where law is the 36-bit start/end address of the law for rapidio (yes I
> do want to use 36-bit addressing as well but thats another story),
> dbells is the range of doorbells to use and mboxs is the range of
> mailboxes.

This sounds like the "law" should actually be part of the reg property,
and both should be relative to the parent bus. The way you define
"reg" seems to be relative to some register area, which is not how
it's meant (depends on the parent of the srio device).

I would guess that the reg property should look more like

	reg = <0 abc0000 0 20000 /* regs_win */
	        4 0 0 400000	 /* maint_win */
		4 400000 0 10000 /* dbell_win */
		4 0 a 0>; /* all the law area */

If you want to describe the control registers being mapped at
0x000000000abc0000 and the law area at 0x0000000400000000, in the
global 36 bit address space, and the registers you want to
ioremap.

With this, your code can be simplified to
	regs_win = of_iomap(node, 0);
	maint_win = of_iomap(node, 1);
	dbell_wind = of_iomap(node, 2);

Since the law appears to define the address space for any
devices behind the rapidio bridge, it might also be an option
to define a "ranges" property that sets up a mapping between
addresses on the two sides of the bridge, like

     #address-cells <2>; /* 64 bit addresses behind the bridge */
     #size-cells <2>; /* 64 bit address length behind the bridge */
     ranges <0 0 4 0 a 0>; /* bus address 0 gets mapped to host
            address 400000000, length a00000000 */

This would be the only way if you wanted to describe rapidio
devices as child nodes, but if you don't do that, there may not
really be much value-add over simply defining a reg property.

What about the hdid? There is currently code that scans the kernel
command line for this, which would make it a candidate to get
written into the device tree by the boot wrapper instead.

> Then I can copy the old ppc/kernel/rio.c to powerpc/kernel/rio.c and
> change...
> 
> void platform_rio_init(void)
> {
> 	struct device_node *np;
> 	if ( (np = of_find_compatible_node(np, "srio", "86xx")) != NULL ) {
> 		mpc86xx_rio_setup(np);
> 	}
> 	else {
> 		printk(KERN_INFO "RIO: No platform_rio_init() present in dts\n");
> 	}
> }
> 
> with mpc86xx_rio_setup being the old mpc85xx_rio_setup from
> ppc/syslib/ppc85xx_rio.c modified to extract the laws, doorbell
> resources, mailboxes etc, from the of_get_property instead of
> hard-coding them.

There is no point in scanning all the device tree yourself for this,
just make sure you have the rapidio device in a place that gets
automatically scanned with of_platform_bus_probe at boot time,
and then register an of_platform_driver that matches your
compatible property.

The code from platform_rio_init then gets converted to the
->probe method of the of_platform_driver.
 
> /* void mpc86xx_rio_setup(int law_start, int law_size) */
> 
> void mpc86xx_rio_setup(struct device_node *np)
> {
> 	...
> 
> 	/*port->iores.start = law_start;*/
>         port->iores.start = of_get_number(of_get_propert(np,"laws"));

of_address_to_resource(np, 4, &port->iores);

> 	...
> 	/* mpc86xx_rio_doorbell_init(port); */
> 	mpc86xx_rio_doorbell_init(np,port);
> 
> }
> etc, etc.
> 
> Then I should pass np into the various setup routines as above so that
> they can find the interrupts, etc.
> 
> Is this the right kind of flavor or have I misunderstood how the dtb
> stuff is supposed to integrate with the susbsys_initcall stuff.

the thing you are missing is probably the of_platform_driver. Your
driver should have something like

static struct of_device_id mpc85xx_rio_ids[] = {
	{ .compatible = "fsl,8641d-rapidio", .data = RIO_8641 },
	{ .compatible = "fsl,8540-rapidio", .data = RIO_8540 },
	{ },
};
static struct of_platform_driver mpc85xx_rio_driver = {
	.name = "mpc85xx_rio",
	.match_table = &mpc85xx_rio_ids,
	.probe = mpc85xx_rio_probe,
};
static int __init mpc85xx_rio_init(void)
{
	return of_register_platform_driver(&mpc85xx_rio_driver);
}
subsys_initcall(mpc85xx_rio_init);

> I'm assuming we are supposed to do away with all the CONFIG_RAPIDIO,
> CONFIG_MPCxyz etc so that the kernel is driven by the dtb?

CONFIG_RAPIDIO is still needed to determine whether the code gets compiled
in, but you should make sure that there is no harm in enabling it
on a platform that doesn't actually have rapidio devices.

	Arnd <><

^ permalink raw reply

* Re: [PATCH/RFC] Rework ptep_set_access_flags and fix sun4c
From: Benjamin Herrenschmidt @ 2007-05-22 22:59 UTC (permalink / raw)
  To: Hugh Dickins
  Cc: mark, linux-mm, wli, linuxppc-dev, andrea,
	Tom "spot" Callaway, sparclinux, akpm, David Miller
In-Reply-To: <Pine.LNX.4.64.0705221738020.22822@blonde.wat.veritas.com>


> Looks pretty good to me.
> 
> There was a minor build error in x86 (see below), and ia64 is missing
> (again see below).  I've now built and am running this on x86, x86_64
> and powerpc64; but I'm very unlikely to be doing anything which
> actually tickles these changes, or Andrea's original handle_pte_fault
> optimization.

Ok.

> Would the "__changed && __dirty" architectures (x86, x86_64, ia64)
> be better off saying __changed = __dirty && pte_same?  I doubt it's
> worth bothering about.

I'd say let gcc figure it out :-)

> You've updated do_wp_page to do "if (ptep_set_access_flags(...",
> but not updated set_huge_ptep_writable in the same way: I'd have
> thought you'd either leave both alone, or update them both: any
> reason for one not the other?  But again, not really an issue.

Nah, I must have missed set_huge_ptep_writable(). I don't think the wp
code path matters much anyway, it's likely to always be different.

> These changes came about because the sun4c needs to update_mmu_cache
> even in the pte_same case: might it also need to flush_tlb_page then?

Well, I don't know which is why I'm waiting for Tom Callaway to test.
Davem mentioned update_mmu_cache only though when we discussed the
problem initially.

> >  #define  __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS
> >  #define ptep_set_access_flags(vma, address, ptep, entry, dirty)		\
> > -do {									\
> > -	if (dirty) {							\
> > +({									\
> > +	int __changed = !pte_same(*(__ptep), __entry);			\
> 
> That just needs to be:
> 
>   +	int __changed = !pte_same(*(ptep), entry);			\

Ah yes, sorry about that. I need to setup an x86 toolchain somewhere :-)

> Here's what I think the ia64 hunk would be, unbuilt and untested.

Ok.

I'll respin a patch later today.

Cheers,
Ben.

^ permalink raw reply

* Re: fsl booke MM vs. SMP questions
From: Benjamin Herrenschmidt @ 2007-05-22 22:42 UTC (permalink / raw)
  To: Dave Liu; +Cc: ppc-dev, Paul Mackerras, Kumar Gala
In-Reply-To: <1179831375.3827.4.camel@localhost.localdomain>

On Tue, 2007-05-22 at 18:56 +0800, Dave Liu wrote:
> On Tue, 2007-05-22 at 13:09 +1000, Benjamin Herrenschmidt wrote:
> > In the end, the best solution might still be to simply not do any of
> > this and instead send an IPI on invalidations. That's the method used by
> > most architectures in linux (if not all) that do software TLB load on
> > SMP. Basically, the invalidate code path then does:
> > 
> > 	- Update the linux PTE
> > 	- write barrier
> > 	- send IPI interrupt to all CPUs in mm->cpu_vm_mask
> > 	- local TLB flush
> > 
> > And the IPI does a local TLB flush on all affected CPUs.
> 
> How to avoid IPI interrupt missing if the IPI interrupt is edge-
> triggered?
> 
> or How to make sure TLB flushed on the else all affected CPUs?

The IPIs should be buffered by the PIC ... delivered only once but
still. Also, IPI handling in linux is synchronous, there is an ack to
wait for the remote function to complete.

Ben.

^ permalink raw reply

* Re: [PATCH/RFC] Rework ptep_set_access_flags and fix sun4c
From: David Miller @ 2007-05-22 21:53 UTC (permalink / raw)
  To: mark; +Cc: linux-mm, wli, linuxppc-dev, andrea, tcallawa, sparclinux, hugh,
	akpm
In-Reply-To: <Pine.LNX.4.61.0705222247010.5890@mtfhpc.demon.co.uk>

From: Mark Fortescue <mark@mtfhpc.demon.co.uk>
Date: Tue, 22 May 2007 22:52:13 +0100 (BST)

> Hi Benjamin,
> 
> I have just tested this patch on my Sun4c Sparcstation 1 using my 2.6.20.9 
> test kernel without any problems.
> 
> Thank you for the work.

Thanks for your testing.

Someone please merge this in once any remaining issues have
been resolved :-)

^ permalink raw reply

* Re: [PATCH/RFC] Rework ptep_set_access_flags and fix sun4c
From: Mark Fortescue @ 2007-05-22 21:52 UTC (permalink / raw)
  To: Benjamin Herrenschmidt
  Cc: linux-mm, wli, linuxppc-dev, andrea, Tom "spot" Callaway,
	sparclinux, Hugh Dickins, akpm, David Miller
In-Reply-To: <1179815339.32247.799.camel@localhost.localdomain>

Hi Benjamin,

I have just tested this patch on my Sun4c Sparcstation 1 using my 2.6.20.9 
test kernel without any problems.

Thank you for the work.

Regards
 	Mark Fortescue.

On Tue, 22 May 2007, Benjamin Herrenschmidt wrote:

> This patch reworks ptep_set_access_flags() and the callers so that the
> comparison to the old PTE is done inside that function, which then
> returns wether an update_mmu_cache() is needed. That allows fixing
> the sun4c situation where update_mmu_cache() needs to be forced,
> always.
>
> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> ---
>
> Ok, so that's only compile tested on sparc32 and powerpc 32 bits, boot
> tested on powerpc64 and not tested on others (I could use some help
> testing x86, x86_64 and s390 who also have their own implementations).
>
> Index: linux-work/include/asm-generic/pgtable.h
> ===================================================================
> --- linux-work.orig/include/asm-generic/pgtable.h	2007-05-22 15:04:45.000000000 +1000
> +++ linux-work/include/asm-generic/pgtable.h	2007-05-22 15:32:21.000000000 +1000
> @@ -27,13 +27,20 @@ do {				  					\
>  * Largely same as above, but only sets the access flags (dirty,
>  * accessed, and writable). Furthermore, we know it always gets set
>  * to a "more permissive" setting, which allows most architectures
> - * to optimize this.
> + * to optimize this. We return wether the PTE actually changed, which
> + * in turn instructs the caller to do things like update__mmu_cache.
> + * This used to be done in the caller, but sparc needs minor faults to
> + * force that call on sun4c so we changed this macro slightly
>  */
> #define ptep_set_access_flags(__vma, __address, __ptep, __entry, __dirty) \
> -do {				  					  \
> -	set_pte_at((__vma)->vm_mm, (__address), __ptep, __entry);	  \
> -	flush_tlb_page(__vma, __address);				  \
> -} while (0)
> +({									  \
> +	int __changed = !pte_same(*(__ptep), __entry);			  \
> +	if (__changed) {						  \
> +		set_pte_at((__vma)->vm_mm, (__address), __ptep, __entry); \
> +		flush_tlb_page(__vma, __address);			  \
> +	}								  \
> +	__changed;							  \
> +})
> #endif
>
> #ifndef __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG
> Index: linux-work/include/asm-powerpc/pgtable-ppc64.h
> ===================================================================
> --- linux-work.orig/include/asm-powerpc/pgtable-ppc64.h	2007-05-22 15:04:45.000000000 +1000
> +++ linux-work/include/asm-powerpc/pgtable-ppc64.h	2007-05-22 15:27:21.000000000 +1000
> @@ -413,10 +413,14 @@ static inline void __ptep_set_access_fla
> 	:"cc");
> }
> #define  ptep_set_access_flags(__vma, __address, __ptep, __entry, __dirty) \
> -	do {								   \
> -		__ptep_set_access_flags(__ptep, __entry, __dirty);	   \
> -		flush_tlb_page_nohash(__vma, __address);	       	   \
> -	} while(0)
> +({									   \
> +	int __changed = !pte_same(*(__ptep), __entry);			   \
> +	if (__changed) {						   \
> +		__ptep_set_access_flags(__ptep, __entry, __dirty);    	   \
> +		flush_tlb_page_nohash(__vma, __address);		   \
> +	}								   \
> +	__changed;							   \
> +})
>
> /*
>  * Macro to mark a page protection value as "uncacheable".
> Index: linux-work/mm/memory.c
> ===================================================================
> --- linux-work.orig/mm/memory.c	2007-05-22 15:04:45.000000000 +1000
> +++ linux-work/mm/memory.c	2007-05-22 15:38:19.000000000 +1000
> @@ -1691,9 +1691,10 @@ static int do_wp_page(struct mm_struct *
> 		flush_cache_page(vma, address, pte_pfn(orig_pte));
> 		entry = pte_mkyoung(orig_pte);
> 		entry = maybe_mkwrite(pte_mkdirty(entry), vma);
> -		ptep_set_access_flags(vma, address, page_table, entry, 1);
> -		update_mmu_cache(vma, address, entry);
> -		lazy_mmu_prot_update(entry);
> +		if (ptep_set_access_flags(vma, address, page_table, entry,1)) {
> +			update_mmu_cache(vma, address, entry);
> +			lazy_mmu_prot_update(entry);
> +		}
> 		ret |= VM_FAULT_WRITE;
> 		goto unlock;
> 	}
> @@ -2525,10 +2526,9 @@ static inline int handle_pte_fault(struc
> 		pte_t *pte, pmd_t *pmd, int write_access)
> {
> 	pte_t entry;
> -	pte_t old_entry;
> 	spinlock_t *ptl;
>
> -	old_entry = entry = *pte;
> +	entry = *pte;
> 	if (!pte_present(entry)) {
> 		if (pte_none(entry)) {
> 			if (vma->vm_ops) {
> @@ -2561,8 +2561,7 @@ static inline int handle_pte_fault(struc
> 		entry = pte_mkdirty(entry);
> 	}
> 	entry = pte_mkyoung(entry);
> -	if (!pte_same(old_entry, entry)) {
> -		ptep_set_access_flags(vma, address, pte, entry, write_access);
> +	if (ptep_set_access_flags(vma, address, pte, entry, write_access)) {
> 		update_mmu_cache(vma, address, entry);
> 		lazy_mmu_prot_update(entry);
> 	} else {
> Index: linux-work/include/asm-powerpc/pgtable-ppc32.h
> ===================================================================
> --- linux-work.orig/include/asm-powerpc/pgtable-ppc32.h	2007-05-22 15:04:45.000000000 +1000
> +++ linux-work/include/asm-powerpc/pgtable-ppc32.h	2007-05-22 15:26:07.000000000 +1000
> @@ -673,10 +673,14 @@ static inline void __ptep_set_access_fla
> }
>
> #define  ptep_set_access_flags(__vma, __address, __ptep, __entry, __dirty) \
> -	do {								   \
> -		__ptep_set_access_flags(__ptep, __entry, __dirty);	   \
> -		flush_tlb_page_nohash(__vma, __address);	       	   \
> -	} while(0)
> +({									   \
> +	int __changed = !pte_same(*(__ptep), __entry);			   \
> +	if (__changed) {						   \
> +		__ptep_set_access_flags(__ptep, __entry, __dirty);    	   \
> +		flush_tlb_page_nohash(__vma, __address);		   \
> +	}								   \
> +	__changed;							   \
> +})
>
> /*
>  * Macro to mark a page protection value as "uncacheable".
> Index: linux-work/include/asm-i386/pgtable.h
> ===================================================================
> --- linux-work.orig/include/asm-i386/pgtable.h	2007-05-22 15:06:17.000000000 +1000
> +++ linux-work/include/asm-i386/pgtable.h	2007-05-22 15:16:11.000000000 +1000
> @@ -285,13 +285,15 @@ static inline pte_t native_local_ptep_ge
>  */
> #define  __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS
> #define ptep_set_access_flags(vma, address, ptep, entry, dirty)		\
> -do {									\
> -	if (dirty) {							\
> +({									\
> +	int __changed = !pte_same(*(__ptep), __entry);			\
> +	if (__changed && dirty) {					\
> 		(ptep)->pte_low = (entry).pte_low;			\
> 		pte_update_defer((vma)->vm_mm, (address), (ptep));	\
> 		flush_tlb_page(vma, address);				\
> 	}								\
> -} while (0)
> +	__changed;							\
> +})
>
> #define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_DIRTY
> #define ptep_test_and_clear_dirty(vma, addr, ptep) ({			\
> Index: linux-work/include/asm-ppc/pgtable.h
> ===================================================================
> --- linux-work.orig/include/asm-ppc/pgtable.h	2007-05-22 15:25:58.000000000 +1000
> +++ linux-work/include/asm-ppc/pgtable.h	2007-05-22 15:26:08.000000000 +1000
> @@ -694,10 +694,14 @@ static inline void __ptep_set_access_fla
> }
>
> #define  ptep_set_access_flags(__vma, __address, __ptep, __entry, __dirty) \
> -	do {								   \
> -		__ptep_set_access_flags(__ptep, __entry, __dirty);	   \
> -		flush_tlb_page_nohash(__vma, __address);	       	   \
> -	} while(0)
> +({									   \
> +	int __changed = !pte_same(*(__ptep), __entry);			   \
> +	if (__changed) {						   \
> +		__ptep_set_access_flags(__ptep, __entry, __dirty);    	   \
> +		flush_tlb_page_nohash(__vma, __address);		   \
> +	}								   \
> +	__changed;							   \
> +})
>
> /*
>  * Macro to mark a page protection value as "uncacheable".
> Index: linux-work/include/asm-s390/pgtable.h
> ===================================================================
> --- linux-work.orig/include/asm-s390/pgtable.h	2007-05-22 15:16:48.000000000 +1000
> +++ linux-work/include/asm-s390/pgtable.h	2007-05-22 15:20:16.000000000 +1000
> @@ -744,7 +744,12 @@ ptep_establish(struct vm_area_struct *vm
> }
>
> #define ptep_set_access_flags(__vma, __address, __ptep, __entry, __dirty) \
> -	ptep_establish(__vma, __address, __ptep, __entry)
> +({									  \
> +	int __changed = !pte_same(*(__ptep), __entry);			  \
> +	if (__changed)							  \
> +		ptep_establish(__vma, __address, __ptep, __entry);	  \
> +	__changed;							  \
> +})
>
> /*
>  * Test and clear dirty bit in storage key.
> Index: linux-work/include/asm-sparc/pgtable.h
> ===================================================================
> --- linux-work.orig/include/asm-sparc/pgtable.h	2007-05-22 15:30:48.000000000 +1000
> +++ linux-work/include/asm-sparc/pgtable.h	2007-05-22 15:35:56.000000000 +1000
> @@ -446,6 +446,17 @@ extern int io_remap_pfn_range(struct vm_
> #define GET_IOSPACE(pfn)		(pfn >> (BITS_PER_LONG - 4))
> #define GET_PFN(pfn)			(pfn & 0x0fffffffUL)
>
> +#define __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS
> +#define ptep_set_access_flags(__vma, __address, __ptep, __entry, __dirty) \
> +({									  \
> +	int __changed = !pte_same(*(__ptep), __entry);			  \
> +	if (__changed) {						  \
> +		set_pte_at((__vma)->vm_mm, (__address), __ptep, __entry); \
> +		flush_tlb_page(__vma, __address);			  \
> +	}								  \
> +	(sparc_cpu_model == sun4c) || __changed;			  \
> +})
> +
> #include <asm-generic/pgtable.h>
>
> #endif /* !(__ASSEMBLY__) */
> Index: linux-work/include/asm-x86_64/pgtable.h
> ===================================================================
> --- linux-work.orig/include/asm-x86_64/pgtable.h	2007-05-22 15:20:40.000000000 +1000
> +++ linux-work/include/asm-x86_64/pgtable.h	2007-05-22 15:21:52.000000000 +1000
> @@ -395,12 +395,14 @@ static inline pte_t pte_modify(pte_t pte
>  * bit at the same time. */
> #define  __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS
> #define ptep_set_access_flags(__vma, __address, __ptep, __entry, __dirty) \
> -	do {								  \
> -		if (__dirty) {						  \
> -			set_pte(__ptep, __entry);			  \
> -			flush_tlb_page(__vma, __address);		  \
> -		}							  \
> -	} while (0)
> +({									  \
> +	int __changed = !pte_same(*(__ptep), __entry);			  \
> +	if (__changed && __dirty) {					  \
> +		set_pte(__ptep, __entry);			  	  \
> +		flush_tlb_page(__vma, __address);		  	  \
> +	}								  \
> +	__changed;							  \
> +})
>
> /* Encode and de-code a swap entry */
> #define __swp_type(x)			(((x).val >> 1) & 0x3f)
>
>
>

^ permalink raw reply

* Re: [PATCH 10/13] mpc83xx: Power Management support
From: Scott Wood @ 2007-05-22 21:16 UTC (permalink / raw)
  To: Guennadi Liakhovetski; +Cc: linuxppc-dev
In-Reply-To: <Pine.LNX.4.60.0705222301070.4243@poirot.grange>

Guennadi Liakhovetski wrote:
>>+	/* There can only be one fsl,mpc83xx-pmc device in the system;
>>+	 * it is assumed that it is the one that the pmc driver matches.
>>+	 */
>>+	if (of_device_is_compatible(sleep_controller, "fsl,mpc83xx-pmc")) {
>>+		sleep->sccr_mask = sleepdata[1];
>>+		ret = 0;
>>+	}
> 
> 
> Just wondering - do we really want to special-case 83xx-pmc here? What 
> when / if further "sleep controllers" get implemented? Shouldn't this be 
> some callback?

The quick and ugly thing would be more if checks.  The ideal solution 
would be a mechanism to look up a device by phandle, returning an ops 
struct corresponding to the requested class (if the device supports it).

> BTW, do we have an interface similar to platform-driver/device for of? 
> Like of_driver/device. This would be a use case for it. Just register a 
> of_driver, which would trigger a dt-scan (just a find_compatible), calling 
> driver's probe()... Would it make sense?

See asm-powerpc/of_platform.h.  However, that won't help find the driver 
  you need to talk to if all you have is a phandle.

-Scott

^ permalink raw reply

* Re: [PATCH 10/13] mpc83xx: Power Management support
From: Guennadi Liakhovetski @ 2007-05-22 21:08 UTC (permalink / raw)
  To: Scott Wood; +Cc: linuxppc-dev
In-Reply-To: <20070507182955.GI26920@ld0162-tx32.am.freescale.net>

On Mon, 7 May 2007, Scott Wood wrote:

> diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c
> index 3b99433..1fd9f51 100644
> --- a/arch/powerpc/sysdev/fsl_soc.c
> +++ b/arch/powerpc/sysdev/fsl_soc.c
> @@ -138,6 +138,33 @@ u32 get_baudrate(void)
>  EXPORT_SYMBOL(get_baudrate);
>  #endif /* CONFIG_CPM2 */
>  
> +int fsl_sleep_init(struct fsl_sleep_platform_data *sleep,
> +                   struct device_node *node)
> +{
> +	int proplen, ret = -ENODEV;
> +	const u32 *sleepdata = of_get_property(node, "sleep", &proplen);
> +	struct device_node *sleep_controller;
> +
> +	if (!sleepdata || proplen != 8)
> +		return -ENODEV;
> +
> +	sleep_controller = of_find_node_by_phandle(sleepdata[0]);
> +	if (!sleep_controller)
> +		return -ENODEV;
> +
> +	/* There can only be one fsl,mpc83xx-pmc device in the system;
> +	 * it is assumed that it is the one that the pmc driver matches.
> +	 */
> +	if (of_device_is_compatible(sleep_controller, "fsl,mpc83xx-pmc")) {
> +		sleep->sccr_mask = sleepdata[1];
> +		ret = 0;
> +	}

Just wondering - do we really want to special-case 83xx-pmc here? What 
when / if further "sleep controllers" get implemented? Shouldn't this be 
some callback?

BTW, do we have an interface similar to platform-driver/device for of? 
Like of_driver/device. This would be a use case for it. Just register a 
of_driver, which would trigger a dt-scan (just a find_compatible), calling 
driver's probe()... Would it make sense?

Thanks
Guennadi
---
Guennadi Liakhovetski

^ permalink raw reply

* Re: [PATCH 2/5] Add uli1575 pci-bridge sector to MPC8641HPCN dts file.
From: xianghua xiao @ 2007-05-22 20:37 UTC (permalink / raw)
  To: Zhang Wei; +Cc: linuxppc-dev, paulus
In-Reply-To: <1179805110272-git-send-email-wei.zhang@freescale.com>

where is the new uli1575 node referred except for this added snippet?
thanks,
xianghua

Zhang Wei wrote:

>Add uli1575 pci-bridge sector. It fixes the issue of ULI1575 not found on rev.2 board.
>
>Signed-off-by: Zhang Wei <wei.zhang@freescale.com>
>---
> arch/powerpc/boot/dts/mpc8641_hpcn.dts      |    6 ++++++
> arch/powerpc/boot/dts/mpc8641_hpcn_srio.dts |    6 ++++++
> 2 files changed, 12 insertions(+), 0 deletions(-)
>
>diff --git a/arch/powerpc/boot/dts/mpc8641_hpcn.dts b/arch/powerpc/boot/dts/mpc8641_hpcn.dts
>index 260b264..04626b1 100644
>--- a/arch/powerpc/boot/dts/mpc8641_hpcn.dts
>+++ b/arch/powerpc/boot/dts/mpc8641_hpcn.dts
>@@ -297,6 +297,12 @@
> 				interrupts = <49 2>;
> 				interrupt-parent = <&mpic>;
> 			};
>+			uli1575: uli1575@100 {
>+				reg = <0 0 0 0 0>;
>+				pci_bridge@200 {
>+					reg = <0 0 0 0 0>;
>+				};
>+			};
> 
> 		};
> 
>  
>

^ permalink raw reply

* Re: [PATCH] powerpc: Fix powerpc vmlinux.lds.S
From: Kim Phillips @ 2007-05-22 20:24 UTC (permalink / raw)
  To: will_schmidt; +Cc: paulus, linuxppc-dev
In-Reply-To: <1179846105.16032.75.camel@farscape.rchland.ibm.com>

On Tue, 22 May 2007 10:01:44 -0500
Will Schmidt <will_schmidt@vnet.ibm.com> wrote:

> On Tue, 2007-22-05 at 14:33 +1000, Benjamin Herrenschmidt wrote:
> > Sam's recent changes broke things for us, some stuff sneaked in before
> > the entry point. In fact, we don't need that *(.text.*) thing anymore
> > and it incorrectly matched .text.init.refok, thus putting it
> > before .text. .. ouch !
> 
> ..  Which manifests itself on some systems as a hang after 
> "returning from prom_init".  
> 
> 
> > Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> 
> Applying this makes my systems happy again... :-)
> 
same here.

> Acked-by:  Will Schmidt <will_schmidt@vnet.ibm.com>
> 
Acked-by:  Kim Phillips <kim.phillips@freescale.com>

Kim

^ permalink raw reply

* Re: [PATCH] Performance Stats: Kernel patch
From: Andrew Morton @ 2007-05-22 20:08 UTC (permalink / raw)
  To: Maxim Uvarov; +Cc: linuxppc-dev, LKML
In-Reply-To: <20070522171950.23728.95735.stgit@localhost.localdomain>

On Tue, 22 May 2007 17:19:52 +0000
Maxim Uvarov <muvarov@ru.mvista.com> wrote:

> Sorry for bothering you. I know you are very busy but could 
> you please tell me what is situation of this patch?

I'd like to add the context-switch accounting to the taskstats payload.

As we'd then need to uprev the taskstats payload and version it makes sense
to have a look around, see if there's anything else which should be in
there but got missed.



I don't think we can accept the number-of-syscalls accounting feature.  It
adds a memory increment into the kernel's number-one hotpath.  Something
which people like to obsessively microbenchmark.

And as I said earlier, a 32-bit counter can be overflowed in mere seconds,
so that needs to become 64-bit, in which case we add a memory increment and
a test-n-branch to that hottest path.


There _is_ some cumulative overhead here, and I don't see how the value of
the syscall counter can justify it.

^ permalink raw reply

* Re: Porting RapidIO from ppc arch to powerpc arch in support of MPC8641D
From: Timur Tabi @ 2007-05-22 20:09 UTC (permalink / raw)
  To: pterry; +Cc: linuxppc-dev
In-Reply-To: <1179862732.25914.40.camel@pterry-fc6.micromemory.com>

Phil Terry wrote:

> 
> srio@c0000 {
>                 device_type = "srio";
>                 compatible = "86xx,85xx";
> 		reg = <c0000 20000>;
> 		law = <400000000 e00000000>;
> 		dbells = <0 ffff>;
> 		mboxs = <0 4>;
>                 interrupt-parent = <&mpic>;
>                 interrupts = <30 1 31 1 32 1 35 1 36 1 37 1 38 1>;
>               };
> 
> where law is the 36-bit start/end address of the law for rapidio (yes I

Generally, the LAWs are configured in the bootloader, which is normally U-Boot.



-- 
Timur Tabi
Linux Kernel Developer @ Freescale

^ permalink raw reply

* Re: Porting RapidIO from ppc arch to powerpc arch in support of MPC8641D
From: Segher Boessenkool @ 2007-05-22 20:08 UTC (permalink / raw)
  To: pterry; +Cc: linuxppc-dev
In-Reply-To: <1179862732.25914.40.camel@pterry-fc6.micromemory.com>

> srio@c0000 {

Isn't there a nicer name, like "rapidio"?

>                 device_type = "srio";

No device_type please.

>                 compatible = "86xx,85xx";

compatible = "fsl,8641d-rapidio", "fsl,8540-rapidio";
and the latter only if the 8641d can actually be driven
as-if it were a 8540.

> 		reg = <c0000 20000>;
> 		law = <400000000 e00000000>;

What does "law" mean?  Please use a better name.  And
you write this as <4 0 e 0>.

> 		dbells = <0 ffff>;

"doorbells"

> 		mboxs = <0 4>;

"mailboxes"

> I'm
> assuming we are supposed to do away with all the CONFIG_RAPIDIO,

You still need config options to enable support for
rapidio etc.  The DTB is used at runtime to detect
what devices are actually there.

> btw how to I get the dtc to accept 36-bit numbers as above for laws?

The numbers inside < > are 32-bit integers.  64-bit
numbers are encoded as a pair of these.

> and am I allowed to invent properties like this or is there some keeper
> of the property names who I should genuflect before?

It would be nice to have a proper device binding for
rapidio, just like for PCI etc.  Since there isn't one
yet, try to invent one that would work for _all_ rapidio
hosts, so there won't be too many changes needed if
later a more generic device binding evolves.

Don't worry about it too much, just use common sense,
and you'll end up with an ad-hoc binding for this device
only that will work just fine; do the generic thing
later, when you have at least a chance to get it right ;-)


Segher

^ permalink raw reply

* Re: [PATCH/RFC] Rework ptep_set_access_flags and fix sun4c
From: Hugh Dickins @ 2007-05-22 17:04 UTC (permalink / raw)
  To: Benjamin Herrenschmidt
  Cc: mark, linux-mm, wli, linuxppc-dev, andrea,
	Tom "spot" Callaway, sparclinux, akpm, David Miller
In-Reply-To: <1179815339.32247.799.camel@localhost.localdomain>

On Tue, 22 May 2007, Benjamin Herrenschmidt wrote:

> This patch reworks ptep_set_access_flags() and the callers so that the
> comparison to the old PTE is done inside that function, which then
> returns wether an update_mmu_cache() is needed. That allows fixing
> the sun4c situation where update_mmu_cache() needs to be forced,
> always.
> 
> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> ---
> 
> Ok, so that's only compile tested on sparc32 and powerpc 32 bits, boot
> tested on powerpc64 and not tested on others (I could use some help
> testing x86, x86_64 and s390 who also have their own implementations).

Looks pretty good to me.

There was a minor build error in x86 (see below), and ia64 is missing
(again see below).  I've now built and am running this on x86, x86_64
and powerpc64; but I'm very unlikely to be doing anything which
actually tickles these changes, or Andrea's original handle_pte_fault
optimization.

Would the "__changed && __dirty" architectures (x86, x86_64, ia64)
be better off saying __changed = __dirty && pte_same?  I doubt it's
worth bothering about.

You've updated do_wp_page to do "if (ptep_set_access_flags(...",
but not updated set_huge_ptep_writable in the same way: I'd have
thought you'd either leave both alone, or update them both: any
reason for one not the other?  But again, not really an issue.

These changes came about because the sun4c needs to update_mmu_cache
even in the pte_same case: might it also need to flush_tlb_page then?


> --- linux-work.orig/include/asm-generic/pgtable.h	2007-05-22 15:04:45.000000000 +1000
> +++ linux-work/include/asm-generic/pgtable.h	2007-05-22 15:32:21.000000000 +1000
> @@ -27,13 +27,20 @@ do {				  					\
>   * Largely same as above, but only sets the access flags (dirty,
>   * accessed, and writable). Furthermore, we know it always gets set
>   * to a "more permissive" setting, which allows most architectures
> - * to optimize this.
> + * to optimize this. We return wether the PTE actually changed, which

                                  whether

> + * in turn instructs the caller to do things like update__mmu_cache.

                                                     update_mmu_cache.

> + * This used to be done in the caller, but sparc needs minor faults to
> + * force that call on sun4c so we changed this macro slightly
>   */

> --- linux-work.orig/include/asm-i386/pgtable.h	2007-05-22 15:06:17.000000000 +1000
> +++ linux-work/include/asm-i386/pgtable.h	2007-05-22 15:16:11.000000000 +1000
> @@ -285,13 +285,15 @@ static inline pte_t native_local_ptep_ge
>   */
>  #define  __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS
>  #define ptep_set_access_flags(vma, address, ptep, entry, dirty)		\
> -do {									\
> -	if (dirty) {							\
> +({									\
> +	int __changed = !pte_same(*(__ptep), __entry);			\

That just needs to be:

  +	int __changed = !pte_same(*(ptep), entry);			\

> +	if (__changed && dirty) {					\
>  		(ptep)->pte_low = (entry).pte_low;			\
>  		pte_update_defer((vma)->vm_mm, (address), (ptep));	\
>  		flush_tlb_page(vma, address);				\
>  	}								\
> -} while (0)
> +	__changed;							\
> +})

Here's what I think the ia64 hunk would be, unbuilt and untested.

--- linux-work.orig/include/asm-ia64/pgtable.h	2007-05-13 05:41:00.000000000 +0100
+++ linux-work/include/asm-ia64/pgtable.h	2007-05-22 17:33:58.000000000 +0100
@@ -533,16 +533,23 @@ extern void lazy_mmu_prot_update (pte_t 
  * daccess_bit in ivt.S).
  */
 #ifdef CONFIG_SMP
-# define ptep_set_access_flags(__vma, __addr, __ptep, __entry, __safely_writable)	\
-do {											\
-	if (__safely_writable) {							\
-		set_pte(__ptep, __entry);						\
-		flush_tlb_page(__vma, __addr);						\
-	}										\
-} while (0)
+# define ptep_set_access_flags(__vma, __addr, __ptep, __entry, __safely_writable) \
+({									\
+	int __changed = !pte_same(*(__ptep), __entry);			\
+	if (__changed && __safely_writable) {				\
+		set_pte(__ptep, __entry);				\
+		flush_tlb_page(__vma, __addr);				\
+	}								\
+	__changed;							\
+})
 #else
-# define ptep_set_access_flags(__vma, __addr, __ptep, __entry, __safely_writable)	\
-	ptep_establish(__vma, __addr, __ptep, __entry)
+# define ptep_set_access_flags(__vma, __addr, __ptep, __entry, __safely_writable) \
+({									\
+	int __changed = !pte_same(*(__ptep), __entry);			\
+	if (__changed)							\
+		ptep_establish(__vma, __addr, __ptep, __entry);		\
+	__changed;							\
+})
 #endif
 
 #  ifdef CONFIG_VIRTUAL_MEM_MAP

^ permalink raw reply

* Porting RapidIO from ppc arch to powerpc arch in support of MPC8641D
From: Phil Terry @ 2007-05-22 19:38 UTC (permalink / raw)
  To: linuxppc-dev

Guys n Gals,

I'm new to this list so I hope this isn't the wrong place to be asking
these questions.

I'm using the MPC8641D in a Serial RapidIO backplane chassis design.

My last foray into kernel development (privately in an embedded company)
was back in 2.6.9 to 2.6.11 days for a MPC8540 so be gentle with me if
I've missed something in the intervening kernels. I've tried to catch up
as best I can with the archives.

So I thought it would be a simple task of taking Matt Porter's ppc rio
stuff and porting it to powerpc but then I discovered this dts/open
firmware thingy...

So I want to explain an overview of what I intend to do for this port
and if anyone can either tell me where its already been done (yippee),
tell me I'm on the right track (ok) or tell me I'm on the wrong track
(bad) that would be great.

So I'm taking the boot/dts/mpc8641_hpcn.dts and producing a new
mpc8641D_umem.dts with the following addition to the soc.

srio@c0000 {
                device_type = "srio";
                compatible = "86xx,85xx";
		reg = <c0000 20000>;
		law = <400000000 e00000000>;
		dbells = <0 ffff>;
		mboxs = <0 4>;
                interrupt-parent = <&mpic>;
                interrupts = <30 1 31 1 32 1 35 1 36 1 37 1 38 1>;
              };

where law is the 36-bit start/end address of the law for rapidio (yes I
do want to use 36-bit addressing as well but thats another story),
dbells is the range of doorbells to use and mboxs is the range of
mailboxes.

Then I can copy the old ppc/kernel/rio.c to powerpc/kernel/rio.c and
change...

void platform_rio_init(void)
{
	struct device_node *np;
	if ( (np = of_find_compatible_node(np, "srio", "86xx")) != NULL ) {
		mpc86xx_rio_setup(np);
	}
	else {
		printk(KERN_INFO "RIO: No platform_rio_init() present in dts\n");
	}
}

with mpc86xx_rio_setup being the old mpc85xx_rio_setup from
ppc/syslib/ppc85xx_rio.c modified to extract the laws, doorbell
resources, mailboxes etc, from the of_get_property instead of
hard-coding them.

/* void mpc86xx_rio_setup(int law_start, int law_size) */

void mpc86xx_rio_setup(struct device_node *np)
{
	...

	/*port->iores.start = law_start;*/
        port->iores.start = of_get_number(of_get_propert(np,"laws"));
	
	...
	/* mpc86xx_rio_doorbell_init(port); */
	mpc86xx_rio_doorbell_init(np,port);

}
etc, etc.

Then I should pass np into the various setup routines as above so that
they can find the interrupts, etc.

Is this the right kind of flavor or have I misunderstood how the dtb
stuff is supposed to integrate with the susbsys_initcall stuff. I'm
assuming we are supposed to do away with all the CONFIG_RAPIDIO,
CONFIG_MPCxyz etc so that the kernel is driven by the dtb?

Any pointers gratefully accepted.

Cheers
Phil

btw how to I get the dtc to accept 36-bit numbers as above for laws?
and am I allowed to invent properties like this or is there some keeper
of the property names who I should genuflect before?

^ permalink raw reply

* anyone have a good config file for a taiga/hpc2 with a 7448?
From: Leisner, Martin @ 2007-05-22 18:41 UTC (permalink / raw)
  To: linuxppc-embedded

Before I tried to do one myself, I figured I'd bounce it off to see if
anyone has a working
.config (the newer kernel, the better).

marty

^ permalink raw reply

* Re: [PATCH] powerpc 2.6.21-rt6: revert spider_net
From: Thomas Gleixner @ 2007-05-22 18:52 UTC (permalink / raw)
  To: Linas Vepstas; +Cc: mingo, linux-kernel, linuxppc-dev
In-Reply-To: <20070522184632.GL5921@austin.ibm.com>

On Tue, 2007-05-22 at 13:46 -0500, Linas Vepstas wrote:
> On Tue, May 22, 2007 at 08:53:32PM +0900, Tsutomu OWA wrote:
> > 
> > Hi Ingo and Thomas,
> >
> > To revert spider_net.c to original one as it turns out that the patch 
> 
> As the spidernet maintainer, I had not forwarded the previous patch
> upstream; it should not have been applied.

Linas,

that's against preempt-rt, where we picked up owa-sans patch.

Thanks,

	tglx

^ permalink raw reply


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