* Re: [ewg] Re: [PATCH 2.6.31] ehca: Tolerate dynamic memory operations and huge pages
From: Alexander Schmidt @ 2009-06-17 6:41 UTC (permalink / raw)
To: Roland Dreier; +Cc: linuxppc-dev, Hoang-Nam Nguyen, raisch, linux-kernel, ewg
In-Reply-To: <adazlc8w45c.fsf@cisco.com>
On Tue, 16 Jun 2009 09:10:39 -0700
Roland Dreier <rdreier@cisco.com> wrote:
>
> > Yeah, the notifier code remains untouched as we still do not allow dynamic
> > memory operations _while_ our module is loaded. The patch allows the driver to
> > cope with DMEM operations that happened before the module was loaded, which
> > might result in a non-contiguous memory layout. When the driver registers
> > its global memory region in the system, the memory layout must be considered.
> >
> > We chose the term "toleration" instead of "support" to illustrate this.
>
> I see. So things just silently broke in some cases when the driver was
> loaded after operations you didn't tolerate?
>
> Anyway, thanks for the explanation.
Well, things did not break silently. The registration of the MR failed with
an error code which was reported to userspace.
Will you push the patch for .31 or .32?
Thanks,
Alex
^ permalink raw reply
* Re: [PATCH] mpc5xxx_get_bus_frequency(): use common code on MPC512x and MPC52xx
From: Grant Likely @ 2009-06-17 6:21 UTC (permalink / raw)
To: Wolfgang Denk; +Cc: linuxppc-dev
In-Reply-To: <fa686aa40906162314p3e308bc4j2420a5f5570d5ae@mail.gmail.com>
On Wed, Jun 17, 2009 at 12:14 AM, Grant Likely<grant.likely@secretlab.ca> w=
rote:
> On Thu, Jun 11, 2009 at 2:19 PM, Wolfgang Denk<wd@denx.de> wrote:
>> So far, MPC512x used mpc512x_find_ips_freq() to get the bus frequency,
>> while MPC52xx used mpc52xx_find_ipb_freq(). =A0Despite the different
>> clock names (IPS vs. IPB) the code was identical.
>>
>> Use common code for both processor families.
>>
>> Signed-off-by: Wolfgang Denk <wd@denx.de>
>> Cc: Grant Likely <grant.likely@secretlab.ca>
>> Cc: Kumar Gala <galak@kernel.crashing.org>
>
> You probably already know this, but this patch doesn't apply against
> mainline, so I won't merge for 2.6.31.
Never mind; I'm smoking something. The patch applies fine.
g.
--=20
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
^ permalink raw reply
* Re: [PATCH] mpc5xxx_get_bus_frequency(): use common code on MPC512x and MPC52xx
From: Grant Likely @ 2009-06-17 6:14 UTC (permalink / raw)
To: Wolfgang Denk; +Cc: linuxppc-dev
In-Reply-To: <1244751543-21977-1-git-send-email-wd@denx.de>
On Thu, Jun 11, 2009 at 2:19 PM, Wolfgang Denk<wd@denx.de> wrote:
> So far, MPC512x used mpc512x_find_ips_freq() to get the bus frequency,
> while MPC52xx used mpc52xx_find_ipb_freq(). =A0Despite the different
> clock names (IPS vs. IPB) the code was identical.
>
> Use common code for both processor families.
>
> Signed-off-by: Wolfgang Denk <wd@denx.de>
> Cc: Grant Likely <grant.likely@secretlab.ca>
> Cc: Kumar Gala <galak@kernel.crashing.org>
You probably already know this, but this patch doesn't apply against
mainline, so I won't merge for 2.6.31.
g.
> ---
>
> This patch is not only intended to avoid code duplication, but it
> will be needed in a following patch that fixes a MII speed
> miscalculation in drivers/net/fs_enet/mii-fec.c - this patch allows
> for a clean solution that works both on MPC512x and MPC52x systems.
>
> =A0arch/powerpc/include/asm/mpc512x.h =A0 =A0 =A0 =A0 =A0 | =A0 22 ------=
-----------
> =A0arch/powerpc/include/asm/mpc52xx.h =A0 =A0 =A0 =A0 =A0 | =A0 =A02 +-
> =A0arch/powerpc/include/asm/mpc5xxx.h =A0 =A0 =A0 =A0 =A0 | =A0 22 ++++++=
+++++++++++
> =A0arch/powerpc/platforms/512x/clock.c =A0 =A0 =A0 =A0 =A0| =A0 =A02 +-
> =A0arch/powerpc/platforms/512x/mpc512x.h =A0 =A0 =A0 =A0| =A0 =A01 -
> =A0arch/powerpc/platforms/512x/mpc512x_shared.c | =A0 23 ----------------=
--
> =A0arch/powerpc/platforms/52xx/mpc52xx_common.c | =A0 32 +---------------=
---------
> =A0arch/powerpc/sysdev/Makefile =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 | =A0 =A0=
3 ++
> =A0arch/powerpc/sysdev/mpc5xxx_clocks.c =A0 =A0 =A0 =A0 | =A0 33 ++++++++=
++++++++++++++++++
> =A0drivers/ata/pata_mpc52xx.c =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 | =A0 =
=A02 +-
> =A0drivers/i2c/busses/i2c-mpc.c =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 | =A0 =A0=
2 +-
> =A0drivers/net/fec_mpc52xx.c =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0| =A0=
=A02 +-
> =A0drivers/net/fec_mpc52xx_phy.c =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0| =A0 =A0=
2 +-
> =A0drivers/serial/mpc52xx_uart.c =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0| =A0 =A0=
5 +--
> =A0drivers/watchdog/mpc5200_wdt.c =A0 =A0 =A0 =A0 =A0 =A0 =A0 | =A0 =A02 =
+-
> =A015 files changed, 68 insertions(+), 87 deletions(-)
> =A0delete mode 100644 arch/powerpc/include/asm/mpc512x.h
> =A0create mode 100644 arch/powerpc/include/asm/mpc5xxx.h
> =A0create mode 100644 arch/powerpc/sysdev/mpc5xxx_clocks.c
>
> diff --git a/arch/powerpc/include/asm/mpc512x.h b/arch/powerpc/include/as=
m/mpc512x.h
> deleted file mode 100644
> index c48a165..0000000
> --- a/arch/powerpc/include/asm/mpc512x.h
> +++ /dev/null
> @@ -1,22 +0,0 @@
> -/*
> - * Copyright (C) 2007 Freescale Semiconductor, Inc. All rights reserved.
> - *
> - * Author: John Rigby, <jrigby@freescale.com>, Friday Apr 13 2007
> - *
> - * Description:
> - * MPC5121 Prototypes and definitions
> - *
> - * This 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.
> - *
> - */
> -
> -#ifndef __ASM_POWERPC_MPC512x_H__
> -#define __ASM_POWERPC_MPC512x_H__
> -
> -extern unsigned long mpc512x_find_ips_freq(struct device_node *node);
> -
> -#endif /* __ASM_POWERPC_MPC512x_H__ */
> -
> diff --git a/arch/powerpc/include/asm/mpc52xx.h b/arch/powerpc/include/as=
m/mpc52xx.h
> index 52e049c..1b4f697 100644
> --- a/arch/powerpc/include/asm/mpc52xx.h
> +++ b/arch/powerpc/include/asm/mpc52xx.h
> @@ -16,6 +16,7 @@
> =A0#ifndef __ASSEMBLY__
> =A0#include <asm/types.h>
> =A0#include <asm/prom.h>
> +#include <asm/mpc5xxx.h>
> =A0#endif /* __ASSEMBLY__ */
>
> =A0#include <linux/suspend.h>
> @@ -268,7 +269,6 @@ struct mpc52xx_intr {
> =A0#ifndef __ASSEMBLY__
>
> =A0/* mpc52xx_common.c */
> -extern unsigned int mpc52xx_find_ipb_freq(struct device_node *node);
> =A0extern void mpc5200_setup_xlb_arbiter(void);
> =A0extern void mpc52xx_declare_of_platform_devices(void);
> =A0extern void mpc52xx_map_common_devices(void);
> diff --git a/arch/powerpc/include/asm/mpc5xxx.h b/arch/powerpc/include/as=
m/mpc5xxx.h
> new file mode 100644
> index 0000000..5ce9c5f
> --- /dev/null
> +++ b/arch/powerpc/include/asm/mpc5xxx.h
> @@ -0,0 +1,22 @@
> +/*
> + * Copyright (C) 2007 Freescale Semiconductor, Inc. All rights reserved.
> + *
> + * Author: John Rigby, <jrigby@freescale.com>, Friday Apr 13 2007
> + *
> + * Description:
> + * MPC5xxx Prototypes and definitions
> + *
> + * This 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.
> + *
> + */
> +
> +#ifndef __ASM_POWERPC_MPC5xxx_H__
> +#define __ASM_POWERPC_MPC5xxx_H__
> +
> +extern unsigned long mpc5xxx_get_bus_frequency(struct device_node *node)=
;
> +
> +#endif /* __ASM_POWERPC_MPC5xxx_H__ */
> +
> diff --git a/arch/powerpc/platforms/512x/clock.c b/arch/powerpc/platforms=
/512x/clock.c
> index 1bcff94..f4c4c6f 100644
> --- a/arch/powerpc/platforms/512x/clock.c
> +++ b/arch/powerpc/platforms/512x/clock.c
> @@ -24,7 +24,7 @@
> =A0#include <linux/io.h>
>
> =A0#include <linux/of_platform.h>
> -#include <asm/mpc512x.h>
> +#include <asm/mpc5xxx.h>
> =A0#include <asm/clk_interface.h>
>
> =A0#undef CLK_DEBUG
> diff --git a/arch/powerpc/platforms/512x/mpc512x.h b/arch/powerpc/platfor=
ms/512x/mpc512x.h
> index 9c03693..22a5352 100644
> --- a/arch/powerpc/platforms/512x/mpc512x.h
> +++ b/arch/powerpc/platforms/512x/mpc512x.h
> @@ -11,7 +11,6 @@
>
> =A0#ifndef __MPC512X_H__
> =A0#define __MPC512X_H__
> -extern unsigned long mpc512x_find_ips_freq(struct device_node *node);
> =A0extern void __init mpc512x_init_IRQ(void);
> =A0void __init mpc512x_declare_of_platform_devices(void);
> =A0#endif =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 /* __MPC512X_H_=
_ */
> diff --git a/arch/powerpc/platforms/512x/mpc512x_shared.c b/arch/powerpc/=
platforms/512x/mpc512x_shared.c
> index d8cd579..434d683 100644
> --- a/arch/powerpc/platforms/512x/mpc512x_shared.c
> +++ b/arch/powerpc/platforms/512x/mpc512x_shared.c
> @@ -24,29 +24,6 @@
>
> =A0#include "mpc512x.h"
>
> -unsigned long
> -mpc512x_find_ips_freq(struct device_node *node)
> -{
> - =A0 =A0 =A0 struct device_node *np;
> - =A0 =A0 =A0 const unsigned int *p_ips_freq =3D NULL;
> -
> - =A0 =A0 =A0 of_node_get(node);
> - =A0 =A0 =A0 while (node) {
> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 p_ips_freq =3D of_get_property(node, "bus-f=
requency", NULL);
> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (p_ips_freq)
> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 break;
> -
> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 np =3D of_get_parent(node);
> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 of_node_put(node);
> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 node =3D np;
> - =A0 =A0 =A0 }
> - =A0 =A0 =A0 if (node)
> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 of_node_put(node);
> -
> - =A0 =A0 =A0 return p_ips_freq ? *p_ips_freq : 0;
> -}
> -EXPORT_SYMBOL(mpc512x_find_ips_freq);
> -
> =A0void __init mpc512x_init_IRQ(void)
> =A0{
> =A0 =A0 =A0 =A0struct device_node *np;
> diff --git a/arch/powerpc/platforms/52xx/mpc52xx_common.c b/arch/powerpc/=
platforms/52xx/mpc52xx_common.c
> index 8e3dd5a..a46bad0 100644
> --- a/arch/powerpc/platforms/52xx/mpc52xx_common.c
> +++ b/arch/powerpc/platforms/52xx/mpc52xx_common.c
> @@ -47,36 +47,6 @@ static DEFINE_SPINLOCK(mpc52xx_lock);
> =A0static struct mpc52xx_gpt __iomem *mpc52xx_wdt;
> =A0static struct mpc52xx_cdm __iomem *mpc52xx_cdm;
>
> -/**
> - * =A0 =A0 mpc52xx_find_ipb_freq - Find the IPB bus frequency for a devi=
ce
> - * =A0 =A0 @node: =A0device node
> - *
> - * =A0 =A0 Returns IPB bus frequency, or 0 if the bus frequency cannot b=
e found.
> - */
> -unsigned int
> -mpc52xx_find_ipb_freq(struct device_node *node)
> -{
> - =A0 =A0 =A0 struct device_node *np;
> - =A0 =A0 =A0 const unsigned int *p_ipb_freq =3D NULL;
> -
> - =A0 =A0 =A0 of_node_get(node);
> - =A0 =A0 =A0 while (node) {
> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 p_ipb_freq =3D of_get_property(node, "bus-f=
requency", NULL);
> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (p_ipb_freq)
> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 break;
> -
> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 np =3D of_get_parent(node);
> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 of_node_put(node);
> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 node =3D np;
> - =A0 =A0 =A0 }
> - =A0 =A0 =A0 if (node)
> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 of_node_put(node);
> -
> - =A0 =A0 =A0 return p_ipb_freq ? *p_ipb_freq : 0;
> -}
> -EXPORT_SYMBOL(mpc52xx_find_ipb_freq);
> -
> -
> =A0/*
> =A0* Configure the XLB arbiter settings to match what Linux expects.
> =A0*/
> @@ -221,7 +191,7 @@ unsigned int mpc52xx_get_xtal_freq(struct device_node=
*node)
> =A0 =A0 =A0 =A0if (!mpc52xx_cdm)
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0return 0;
>
> - =A0 =A0 =A0 freq =3D mpc52xx_find_ipb_freq(node);
> + =A0 =A0 =A0 freq =3D mpc5xxx_get_bus_frequency(node);
> =A0 =A0 =A0 =A0if (!freq)
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0return 0;
>
> diff --git a/arch/powerpc/sysdev/Makefile b/arch/powerpc/sysdev/Makefile
> index b33b28a..2a1df88 100644
> --- a/arch/powerpc/sysdev/Makefile
> +++ b/arch/powerpc/sysdev/Makefile
> @@ -47,6 +47,9 @@ obj-$(CONFIG_PPC_DCR) =A0 =A0 =A0 =A0 +=3D dcr.o
> =A0obj-$(CONFIG_8xx) =A0 =A0 =A0 =A0 =A0 =A0 =A0+=3D mpc8xx_pic.o cpm1.o
> =A0obj-$(CONFIG_UCODE_PATCH) =A0 =A0 =A0+=3D micropatch.o
>
> +obj-$(CONFIG_PPC_MPC512x) =A0 =A0 =A0+=3D mpc5xxx_clocks.o
> +obj-$(CONFIG_PPC_MPC52xx) =A0 =A0 =A0+=3D mpc5xxx_clocks.o
> +
> =A0ifeq ($(CONFIG_SUSPEND),y)
> =A0obj-$(CONFIG_6xx) =A0 =A0 =A0 =A0 =A0 =A0 =A0+=3D 6xx-suspend.o
> =A0endif
> diff --git a/arch/powerpc/sysdev/mpc5xxx_clocks.c b/arch/powerpc/sysdev/m=
pc5xxx_clocks.c
> new file mode 100644
> index 0000000..34e12f9
> --- /dev/null
> +++ b/arch/powerpc/sysdev/mpc5xxx_clocks.c
> @@ -0,0 +1,33 @@
> +/**
> + * =A0 =A0 mpc5xxx_get_bus_frequency - Find the bus frequency for a devi=
ce
> + * =A0 =A0 @node: =A0device node
> + *
> + * =A0 =A0 Returns bus frequency (IPS on MPC512x, IPB on MPC52xx),
> + * =A0 =A0 or 0 if the bus frequency cannot be found.
> + */
> +
> +#include <linux/kernel.h>
> +#include <linux/of_platform.h>
> +
> +unsigned int
> +mpc5xxx_get_bus_frequency(struct device_node *node)
> +{
> + =A0 =A0 =A0 struct device_node *np;
> + =A0 =A0 =A0 const unsigned int *p_bus_freq =3D NULL;
> +
> + =A0 =A0 =A0 of_node_get(node);
> + =A0 =A0 =A0 while (node) {
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 p_bus_freq =3D of_get_property(node, "bus-f=
requency", NULL);
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (p_bus_freq)
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 break;
> +
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 np =3D of_get_parent(node);
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 of_node_put(node);
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 node =3D np;
> + =A0 =A0 =A0 }
> + =A0 =A0 =A0 if (node)
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 of_node_put(node);
> +
> + =A0 =A0 =A0 return p_bus_freq ? *p_bus_freq : 0;
> +}
> +EXPORT_SYMBOL(mpc5xxx_get_bus_frequency);
> diff --git a/drivers/ata/pata_mpc52xx.c b/drivers/ata/pata_mpc52xx.c
> index 68d27bc..2bc2dbe 100644
> --- a/drivers/ata/pata_mpc52xx.c
> +++ b/drivers/ata/pata_mpc52xx.c
> @@ -694,7 +694,7 @@ mpc52xx_ata_probe(struct of_device *op, const struct =
of_device_id *match)
> =A0 =A0 =A0 =A0struct bcom_task *dmatsk =3D NULL;
>
> =A0 =A0 =A0 =A0/* Get ipb frequency */
> - =A0 =A0 =A0 ipb_freq =3D mpc52xx_find_ipb_freq(op->node);
> + =A0 =A0 =A0 ipb_freq =3D mpc5xxx_get_bus_frequency(op->node);
> =A0 =A0 =A0 =A0if (!ipb_freq) {
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0dev_err(&op->dev, "could not determine IPB=
bus frequency\n");
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0return -ENODEV;
> diff --git a/drivers/i2c/busses/i2c-mpc.c b/drivers/i2c/busses/i2c-mpc.c
> index dd778d7..d325e86 100644
> --- a/drivers/i2c/busses/i2c-mpc.c
> +++ b/drivers/i2c/busses/i2c-mpc.c
> @@ -197,7 +197,7 @@ int mpc_i2c_get_fdr_52xx(struct device_node *node, u3=
2 clock, int prescaler)
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0return -EINVAL;
>
> =A0 =A0 =A0 =A0/* Determine divider value */
> - =A0 =A0 =A0 divider =3D mpc52xx_find_ipb_freq(node) / clock;
> + =A0 =A0 =A0 divider =3D mpc5xxx_get_bus_frequency(node) / clock;
>
> =A0 =A0 =A0 =A0/*
> =A0 =A0 =A0 =A0 * We want to choose an FDR/DFSR that generates an I2C bus=
speed that
> diff --git a/drivers/net/fec_mpc52xx.c b/drivers/net/fec_mpc52xx.c
> index 8bbe7f6..5ddf033 100644
> --- a/drivers/net/fec_mpc52xx.c
> +++ b/drivers/net/fec_mpc52xx.c
> @@ -1006,7 +1006,7 @@ mpc52xx_fec_probe(struct of_device *op, const struc=
t of_device_id *match)
> =A0 =A0 =A0 =A0priv->phy_addr =3D FEC5200_PHYADDR_NONE;
> =A0 =A0 =A0 =A0priv->speed =3D 100;
> =A0 =A0 =A0 =A0priv->duplex =3D DUPLEX_HALF;
> - =A0 =A0 =A0 priv->phy_speed =3D ((mpc52xx_find_ipb_freq(op->node) >> 20=
) / 5) << 1;
> + =A0 =A0 =A0 priv->phy_speed =3D ((mpc5xxx_get_bus_frequency(op->node) >=
> 20) / 5) << 1;
>
> =A0 =A0 =A0 =A0/* the 7-wire property means don't use MII mode */
> =A0 =A0 =A0 =A0if (of_find_property(op->node, "fsl,7-wire-mode", NULL))
> diff --git a/drivers/net/fec_mpc52xx_phy.c b/drivers/net/fec_mpc52xx_phy.=
c
> index dd9bfa4..176e9b8 100644
> --- a/drivers/net/fec_mpc52xx_phy.c
> +++ b/drivers/net/fec_mpc52xx_phy.c
> @@ -120,7 +120,7 @@ static int mpc52xx_fec_mdio_probe(struct of_device *o=
f,
>
> =A0 =A0 =A0 =A0/* set MII speed */
> =A0 =A0 =A0 =A0out_be32(&priv->regs->mii_speed,
> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 ((mpc52xx_find_ipb_freq(of->node) >> 20) / =
5) << 1);
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 ((mpc5xxx_get_bus_frequency(of->node) >> 20=
) / 5) << 1);
>
> =A0 =A0 =A0 =A0err =3D mdiobus_register(bus);
> =A0 =A0 =A0 =A0if (err)
> diff --git a/drivers/serial/mpc52xx_uart.c b/drivers/serial/mpc52xx_uart.=
c
> index b3feb61..abbd146 100644
> --- a/drivers/serial/mpc52xx_uart.c
> +++ b/drivers/serial/mpc52xx_uart.c
> @@ -76,7 +76,6 @@
> =A0#include <linux/of_platform.h>
>
> =A0#include <asm/mpc52xx.h>
> -#include <asm/mpc512x.h>
> =A0#include <asm/mpc52xx_psc.h>
>
> =A0#if defined(CONFIG_SERIAL_MPC52xx_CONSOLE) && defined(CONFIG_MAGIC_SYS=
RQ)
> @@ -254,7 +253,7 @@ static unsigned long mpc52xx_getuartclk(void *p)
> =A0 =A0 =A0 =A0 * but the generic serial code assumes 16
> =A0 =A0 =A0 =A0 * so return ipb freq / 2
> =A0 =A0 =A0 =A0 */
> - =A0 =A0 =A0 return mpc52xx_find_ipb_freq(p) / 2;
> + =A0 =A0 =A0 return mpc5xxx_get_bus_frequency(p) / 2;
> =A0}
>
> =A0static struct psc_ops mpc52xx_psc_ops =3D {
> @@ -391,7 +390,7 @@ static void mpc512x_psc_cw_restore_ints(struct uart_p=
ort *port)
>
> =A0static unsigned long mpc512x_getuartclk(void *p)
> =A0{
> - =A0 =A0 =A0 return mpc512x_find_ips_freq(p);
> + =A0 =A0 =A0 return mpc5xxx_get_bus_frequency(p);
> =A0}
>
> =A0static struct psc_ops mpc512x_psc_ops =3D {
> diff --git a/drivers/watchdog/mpc5200_wdt.c b/drivers/watchdog/mpc5200_wd=
t.c
> index 465fe36..fa9c47c 100644
> --- a/drivers/watchdog/mpc5200_wdt.c
> +++ b/drivers/watchdog/mpc5200_wdt.c
> @@ -188,7 +188,7 @@ static int mpc5200_wdt_probe(struct of_device *op,
> =A0 =A0 =A0 =A0if (!wdt)
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0return -ENOMEM;
>
> - =A0 =A0 =A0 wdt->ipb_freq =3D mpc52xx_find_ipb_freq(op->node);
> + =A0 =A0 =A0 wdt->ipb_freq =3D mpc5xxx_get_bus_frequency(op->node);
>
> =A0 =A0 =A0 =A0err =3D of_address_to_resource(op->node, 0, &wdt->mem);
> =A0 =A0 =A0 =A0if (err)
> --
> 1.6.0.6
>
>
--=20
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
^ permalink raw reply
* Re: [PATCH 1/3 v3] mtd: physmap_of: Add multiple regions and concatenation support
From: Grant Likely @ 2009-06-17 5:53 UTC (permalink / raw)
To: Stefan Roese, David Woodhouse; +Cc: linuxppc-dev, devicetree-discuss, linux-mtd
In-Reply-To: <fa686aa40904160646v75a98e02s446fd89c08cfebae@mail.gmail.com>
On Thu, Apr 16, 2009 at 7:46 AM, Grant Likely<grant.likely@secretlab.ca> wr=
ote:
> On Thu, Apr 16, 2009 at 7:37 AM, Stefan Roese <sr@denx.de> wrote:
>> On Thursday 16 April 2009, Grant Likely wrote:
>>> > Signed-off-by: Stefan Roese <sr@denx.de>
>>> > Reviewd-by: Grant Likely <grant.likely@secretlab.ca>
>>>
>>> Yup, still looks good to me. =A0What boards has this been tested on?
>>
>> I tested this version on PPC405EX Kilauea equipped only one "standard"
>> Spansion S29GL512 NOR chip. And a slightly modified version on an MPC836=
0
>> board (kmeter1) which is equipped with the Intel P30 part mentioned in t=
he
>> bindings description. Slightly modified since this board support is not =
yet
>> pushed upstream and currently using v2.6.28 (physmap_of.c has received m=
inor
>> modifications after 2.6.28 release).
>
> Okay. =A0It will be good to get this one into -next for some testing
> exposure. =A0Unless he asks me to do otherwise, I'll leave this one to
> David to pick up.
David, what's the status of this patch? Will it be merged for 2.6.31?
g.
--=20
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
^ permalink raw reply
* Re: [Patch 2/6] Introduce PPC64 specific Hardware Breakpoint interfaces
From: David Gibson @ 2009-06-17 4:45 UTC (permalink / raw)
To: K.Prasad
Cc: Michael Neuling, Benjamin Herrenschmidt, linuxppc-dev, paulus,
Alan Stern, Roland McGrath
In-Reply-To: <20090615071828.GA7608@in.ibm.com>
On Mon, Jun 15, 2009 at 12:48:28PM +0530, K.Prasad wrote:
> On Mon, Jun 15, 2009 at 04:40:45PM +1000, David Gibson wrote:
> > On Wed, Jun 10, 2009 at 12:13:49PM +0530, K.Prasad wrote:
> > > On Fri, Jun 05, 2009 at 03:11:58PM +1000, David Gibson wrote:
> > > > On Wed, Jun 03, 2009 at 10:05:11PM +0530, K.Prasad wrote:
> > >
> > > > > + else {
> > > > > + /*
> > > > > + * This exception is triggered not because of a memory access on
> > > > > + * the monitored variable but in the double-word address range
> > > > > + * in which it is contained. We will consume this exception,
> > > > > + * considering it as 'noise'.
> > > > > + */
> > > > > + rc = NOTIFY_STOP;
> > > > > + goto out;
> > > > > + }
> > > > > + is_one_shot = (bp->triggered == ptrace_triggered) ? 1 : 0;
> > > >
> > > > Ouch, explicitly special-casing ptrace_triggered is pretty nasty.
> > > > Since the bp_info is already arch specific, maybe it should include a
> > > > flag to indicate whether the breakpoint is one-shot or not.
> > > >
> > >
> > > The reason to check for ptrace_triggered is to contain the one-shot
> > > behaviour only to ptrace (thus retaining the semantics) and not to extend
> > > them to all user-space requests through
> > > register_user_hw_breakpoint().
> >
> > Right, but couldn't you implement that withing ptrace_triggered
> > itself, without a special test here, by having it cancel the
> > breakpoint.
>
> A special check (either using the callback routine as above, or using a
> special flag) will be required in hw_breakpoint_handler() to enable
> early return (without single-stepping). I'm not sure if I got your
> suggestion right, and let me know if you think so.
Well.. you could also recheck after calling triggered whether the
breakpoint is still in existence. So cancelling the breakpoint in
triggered would.
Or you could change the signature for the triggered function, so it
returns whether to leave the breakpoint active or not. That would
have some advantages you could easily implement either one-shot,
continuous or N-shot, or keep firing until some specific event
behaviour from within the triggered function.
But all that's a bit moot, because of the fact that you try to make
the TRAP timing consistent (before or after execution of triggering
instruction) but you don't do so for a general triggered hook.
> > > A one-shot behaviour for all user-space requests would create more work
> > > for the user-space programs (such as re-registration) and will leave open
> > > a small window of opportunity for debug register grabbing by kernel-space
> > > requests.
> > >
> > > So, in effect a request through register_user_hw_breakpoint() interface
> > > will behave as under:
> > > - Single-step over the causative instruction that triggered the
> > > breakpoint exception handler.
> > > - Deliver the SIGTRAP signal to user-space after executing the causative
> > > instruction.
> > >
> > > This behaviour is in consonance with that of kernel-space requests and
> > > those on x86 processors, and helps define a consistent behaviour across
> > > architectures for user-space.
> > >
> > > Let me know what you think on the same.
> >
> > I certainly see the value in consistent semantics across archs.
> > However, I can also see uses for the powerpc trap-before-execute
> > behaviour. That's why I'm suggesting it might be worth having an
> > arch-specific flag.
> >
> > [snip]
>
> So, you suggest that the 'one-shot' behaviour should be driven by
> user-request and not just confined to ptrace? (The default behaviour for
> all breakpoints-minus-ptrace will remain 'continuous' though).
Not one-shot behaviour as such, but whether the trigger fires before
or after execution of the triggering instruction. The complication is
that combining fire-before semantics with continuous firing becomes
tricky.
> It can be implemented through an additional flag in 'struct
> arch_hw_breakpoint'. I can send a new version 7 of the patchset with this
> change (with the hope that the version 6 of the patchset looks fine in
> its present form!). Meanwhile, we'd like to know what uses you see in
> addition to the present one if the one-shot behaviour is made
> user-defined. Are those uses beyond what can be achieved through the
> present ptrace interface?
>
> > > > > +int __kprobes single_step_dabr_instruction(struct die_args *args)
> > > > > +{
> > > > > + struct pt_regs *regs = args->regs;
> > > > > + int cpu = get_cpu();
> > > > > + int ret = NOTIFY_DONE;
> > > > > + siginfo_t info;
> > > > > + unsigned long this_dabr_data = per_cpu(dabr_data, cpu);
> > > > > +
> > > > > + /*
> > > > > + * Check if we are single-stepping as a result of a
> > > > > + * previous HW Breakpoint exception
> > > > > + */
> > > > > + if (this_dabr_data == 0)
> > > > > + goto out;
> > > > > +
> > > > > + regs->msr &= ~MSR_SE;
> > > > > + /* Deliver signal to user-space */
> > > > > + if (this_dabr_data < TASK_SIZE) {
> > > > > + info.si_signo = SIGTRAP;
> > > > > + info.si_errno = 0;
> > > > > + info.si_code = TRAP_HWBKPT;
> > > > > + info.si_addr = (void __user *)(per_cpu(dabr_data, cpu));
> > > > > + force_sig_info(SIGTRAP, &info, current);
> > > >
> > > > Uh.. I recall mentioning in my previous review that in order to match
> > > > previous behaviour we need to deliver the userspace signal *before*
> > > > stepping over the breakpointed instruction, rather than after (which
> > > > I guess is why breakpoints are one-shot in the old scheme).
> > >
> > > This code would implement the behaviour as stated in the comment for
> > > user-space requests above.
> >
> > And you're relying on the old trap-sending code in do_dabr for ptrace
> > requests?
>
> Yes.
Yeah, since you're taking over the whole breakpoint infrastructure, I
really think you should rewrite do_dabr completely as part of your code.
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
^ permalink raw reply
* Re: [Patch 4/6] Modify process and processor handling code to recognise hardware debug registers
From: David Gibson @ 2009-06-17 4:14 UTC (permalink / raw)
To: K.Prasad
Cc: Michael Neuling, Benjamin Herrenschmidt, linuxppc-dev, paulus,
Alan Stern, Roland McGrath
In-Reply-To: <20090610090818.GE14478@in.ibm.com>
On Wed, Jun 10, 2009 at 02:38:18PM +0530, K.Prasad wrote:
> Modify process handling code to recognise hardware debug registers during copy
> and flush operations. Introduce a new TIF_DEBUG task flag to indicate a
> process's use of debug register. Load the debug register values into a
> new CPU during initialisation.
>
> Signed-off-by: K.Prasad <prasad@linux.vnet.ibm.com>
> ---
> arch/powerpc/kernel/process.c | 15 +++++++++++++++
> arch/powerpc/kernel/smp.c | 2 ++
> 2 files changed, 17 insertions(+)
>
> Index: linux-2.6-tip.hbkpt/arch/powerpc/kernel/process.c
> ===================================================================
> --- linux-2.6-tip.hbkpt.orig/arch/powerpc/kernel/process.c
> +++ linux-2.6-tip.hbkpt/arch/powerpc/kernel/process.c
> @@ -50,6 +50,7 @@
> #include <asm/syscalls.h>
> #ifdef CONFIG_PPC64
> #include <asm/firmware.h>
> +#include <asm/hw_breakpoint.h>
> #endif
> #include <linux/kprobes.h>
> #include <linux/kdebug.h>
> @@ -254,8 +255,10 @@ void do_dabr(struct pt_regs *regs, unsig
> 11, SIGSEGV) == NOTIFY_STOP)
> return;
>
> +#ifndef CONFIG_PPC64
> if (debugger_dabr_match(regs))
> return;
> +#endif
Won't this disable the check for breakpoints set by xmon - but I don't
see anything in this patch series to convert xmon to use the new
breakpoint interface instead.
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
^ permalink raw reply
* Re: [Patch 5/6] Modify Data storage exception code to recognise DABR match first
From: David Gibson @ 2009-06-17 4:13 UTC (permalink / raw)
To: K.Prasad
Cc: Michael Neuling, Benjamin Herrenschmidt, linuxppc-dev, paulus,
Alan Stern, Roland McGrath
In-Reply-To: <20090610090824.GF14478@in.ibm.com>
On Wed, Jun 10, 2009 at 02:38:24PM +0530, K.Prasad wrote:
> Modify Data storage exception code to first lookout for a DABR match before
> recognising a kprobe or xmon exception.
>
> Signed-off-by: K.Prasad <prasad@linux.vnet.ibm.com>
> ---
> arch/powerpc/mm/fault.c | 14 ++++++--------
> 1 file changed, 6 insertions(+), 8 deletions(-)
>
> Index: linux-2.6-tip.hbkpt/arch/powerpc/mm/fault.c
> ===================================================================
> --- linux-2.6-tip.hbkpt.orig/arch/powerpc/mm/fault.c
> +++ linux-2.6-tip.hbkpt/arch/powerpc/mm/fault.c
> @@ -136,6 +136,12 @@ int __kprobes do_page_fault(struct pt_re
> error_code &= 0x48200000;
> else
> is_write = error_code & DSISR_ISSTORE;
> +
> + if (error_code & DSISR_DABRMATCH) {
> + /* DABR match */
> + do_dabr(regs, address, error_code);
> + return 0;
> + }
Again, given the amount of work you're doing on all the breakpoint
paths, I really think you should be rewriting do_dabr(), not just
hooking in around it.
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
^ permalink raw reply
* Re: [Patch 2/6] Introduce PPC64 specific Hardware Breakpoint interfaces
From: David Gibson @ 2009-06-17 4:32 UTC (permalink / raw)
To: K.Prasad
Cc: Michael Neuling, Benjamin Herrenschmidt, linuxppc-dev, paulus,
Alan Stern, Roland McGrath
In-Reply-To: <20090610090806.GC14478@in.ibm.com>
On Wed, Jun 10, 2009 at 02:38:06PM +0530, K.Prasad wrote:
> Introduce PPC64 implementation for the generic hardware breakpoint interfaces
> defined in kernel/hw_breakpoint.c. Enable the HAVE_HW_BREAKPOINT flag and the
> Makefile.
[snip]
> +void arch_update_kernel_hw_breakpoint(void *unused)
> +{
> + struct hw_breakpoint *bp;
> +
> + /* Check if there is nothing to update */
> + if (hbp_kernel_pos == HBP_NUM)
> + return;
> +
> + per_cpu(this_hbp_kernel[hbp_kernel_pos], get_cpu()) = bp =
> + hbp_kernel[hbp_kernel_pos];
> + if (bp == NULL)
> + kdabr = 0;
> + else
> + kdabr = (bp->info.address & ~HW_BREAKPOINT_ALIGN) |
> + bp->info.type | DABR_TRANSLATION;
> + set_dabr(kdabr);
> + put_cpu_no_resched();
> +}
> +
> +/*
> + * Install the thread breakpoints in their debug registers.
> + */
> +void arch_install_thread_hw_breakpoint(struct task_struct *tsk)
> +{
> + set_dabr(tsk->thread.dabr);
> +}
> +
> +/*
> + * Clear the DABR which contains the thread-specific breakpoint address
> + */
> +void arch_uninstall_thread_hw_breakpoint()
> +{
> + set_dabr(0);
> +}
> +
> +/*
> + * Store a breakpoint's encoded address, length, and type.
> + */
> +int arch_store_info(struct hw_breakpoint *bp, struct task_struct *tsk)
> +{
> + /* Symbol names from user-space are rejected */
> + if (tsk) {
> + if (bp->info.name)
> + return -EINVAL;
> + else
> + return 0;
> + }
> + /*
> + * User-space requests will always have the address field populated
> + * For kernel-addresses, either the address or symbol name can be
> + * specified.
> + */
> + if (bp->info.name)
> + bp->info.address = (unsigned long)
> + kallsyms_lookup_name(bp->info.name);
> + if (bp->info.address)
> + if (kallsyms_lookup_size_offset(bp->info.address,
> + &(bp->info.symbolsize), NULL))
> + return 0;
> + return -EINVAL;
> +}
> +
> +/*
> + * Validate the arch-specific HW Breakpoint register settings
> + */
> +int arch_validate_hwbkpt_settings(struct hw_breakpoint *bp,
> + struct task_struct *tsk)
> +{
> + int is_kernel, ret = -EINVAL;
> +
> + if (!bp)
> + return ret;
> +
> + switch (bp->info.type) {
> + case HW_BREAKPOINT_READ:
> + case HW_BREAKPOINT_WRITE:
> + case HW_BREAKPOINT_RW:
> + break;
> + default:
> + return ret;
> + }
> +
> + if (bp->triggered)
> + ret = arch_store_info(bp, tsk);
Under what circumstances would triggered be NULL? It's not clear to
me that you wouldn't still need arch_store_info() in this case.
> +
> + is_kernel = is_kernel_addr(bp->info.address);
> + if ((tsk && is_kernel) || (!tsk && !is_kernel))
> + return -EINVAL;
> +
> + return ret;
> +}
> +
> +void arch_update_user_hw_breakpoint(int pos, struct task_struct *tsk)
> +{
> + struct thread_struct *thread = &(tsk->thread);
> + struct hw_breakpoint *bp = thread->hbp[0];
> +
> + if (bp)
> + thread->dabr = (bp->info.address & ~HW_BREAKPOINT_ALIGN) |
> + bp->info.type | DABR_TRANSLATION;
> + else
> + thread->dabr = 0;
> +}
> +
> +void arch_flush_thread_hw_breakpoint(struct task_struct *tsk)
> +{
> + struct thread_struct *thread = &(tsk->thread);
> +
> + thread->dabr = 0;
> +}
> +
> +/*
> + * Handle debug exception notifications.
> + */
> +int __kprobes hw_breakpoint_handler(struct die_args *args)
> +{
> + int rc = NOTIFY_STOP;
> + struct hw_breakpoint *bp;
> + struct pt_regs *regs = args->regs;
> + unsigned long dar = regs->dar;
> + int cpu, is_one_shot, stepped = 1;
> +
> + /* Disable breakpoints during exception handling */
> + set_dabr(0);
> +
> + cpu = get_cpu();
> + /* Determine whether kernel- or user-space address is the trigger */
> + bp = (hbp_kernel_pos == HBP_NUM) ? current->thread.hbp[0] :
> + per_cpu(this_hbp_kernel[0], cpu);
> + /*
> + * bp can be NULL due to lazy debug register switching
> + * or due to the delay between updates of hbp_kernel_pos
> + * and this_hbp_kernel.
> + */
> + if (!bp)
> + goto out;
> +
> + is_one_shot = (bp->triggered == ptrace_triggered) ? 1 : 0;
> + per_cpu(dabr_data, cpu) = (hbp_kernel_pos == HBP_NUM) ?
> + current->thread.dabr : kdabr;
> +
> + /* Verify if dar lies within the address range occupied by the symbol
> + * being watched. Since we cannot get the symbol size for
> + * user-space requests we skip this check in that case
> + */
> + if ((hbp_kernel_pos == 0) &&
> + !((bp->info.address <= dar) &&
> + (dar <= (bp->info.address + bp->info.symbolsize))))
> + /*
> + * This exception is triggered not because of a memory access on
> + * the monitored variable but in the double-word address range
> + * in which it is contained. We will consume this exception,
> + * considering it as 'noise'.
> + */
> + goto out;
> +
> + (bp->triggered)(bp, regs);
So this confuses me. You go to great efforts to step over the
instruction to generate a SIGTRAP after the instruction, for
consistency with x86. But that SIGTRAP is *never* used, since the
only way to set userspace breakpoints is through ptrace at the moment.
At the same time, the triggered function is called here before the
instruction is executed, so not consistent with x86 anyway.
It just seems strange to me that sending a SIGTRAP is a special case
anyway. Why can't sending a SIGTRAP be just a particular triggered
function.
> + /*
> + * Ptrace expects the HW Breakpoints to be one-shot. We will return
> + * NOTIFY_DONE without restoring DABR with the breakpoint address. The
> + * downstream code will generate SIGTRAP to the process
> + */
> + if (is_one_shot) {
> + rc = NOTIFY_DONE;
> + goto out;
> + }
> +
> + stepped = emulate_step(regs, regs->nip);
> + /*
> + * Single-step the causative instruction manually if
> + * emulate_step() could not execute it
> + */
> + if (stepped == 0) {
> + regs->msr |= MSR_SE;
> + goto out;
> + }
> + set_dabr(per_cpu(dabr_data, cpu));
> +
> +out:
> + /* Enable pre-emption only if single-stepping is finished */
> + if (stepped) {
> + per_cpu(dabr_data, cpu) = 0;
> + put_cpu_no_resched();
> + }
> + return rc;
> +}
> +
> +/*
> + * Handle single-step exceptions following a DABR hit.
> + */
> +int __kprobes single_step_dabr_instruction(struct die_args *args)
> +{
> + struct pt_regs *regs = args->regs;
> + int cpu = get_cpu();
> + int ret = NOTIFY_DONE;
> + siginfo_t info;
> + unsigned long this_dabr_data = per_cpu(dabr_data, cpu);
> +
> + /*
> + * Check if we are single-stepping as a result of a
> + * previous HW Breakpoint exception
> + */
> + if (this_dabr_data == 0)
> + goto out;
> +
> + regs->msr &= ~MSR_SE;
> + /* Deliver signal to user-space */
> + if (this_dabr_data < TASK_SIZE) {
> + info.si_signo = SIGTRAP;
> + info.si_errno = 0;
> + info.si_code = TRAP_HWBKPT;
> + info.si_addr = (void __user *)(per_cpu(dabr_data, cpu));
> + force_sig_info(SIGTRAP, &info, current);
> + }
> +
> + set_dabr(this_dabr_data);
> + per_cpu(dabr_data, cpu) = 0;
> + ret = NOTIFY_STOP;
> + /*
> + * If single-stepped after hw_breakpoint_handler(), pre-emption is
> + * already disabled.
> + */
> + put_cpu_no_resched();
> +
> +out:
> + /*
> + * A put_cpu_no_resched() call is required to complement the get_cpu()
> + * call used initially
> + */
> + put_cpu_no_resched();
> + return ret;
> +}
> +
> +/*
> + * Handle debug exception notifications.
> + */
> +int __kprobes hw_breakpoint_exceptions_notify(
> + struct notifier_block *unused, unsigned long val, void *data)
> +{
> + int ret = NOTIFY_DONE;
> +
> + switch (val) {
> + case DIE_DABR_MATCH:
> + ret = hw_breakpoint_handler(data);
> + break;
> + case DIE_SSTEP:
> + ret = single_step_dabr_instruction(data);
> + break;
> + }
> +
> + return ret;
> +}
> Index: linux-2.6-tip.hbkpt/arch/powerpc/kernel/ptrace.c
> ===================================================================
> --- linux-2.6-tip.hbkpt.orig/arch/powerpc/kernel/ptrace.c
> +++ linux-2.6-tip.hbkpt/arch/powerpc/kernel/ptrace.c
> @@ -735,6 +735,10 @@ void user_disable_single_step(struct tas
> clear_tsk_thread_flag(task, TIF_SINGLESTEP);
> }
>
> +void ptrace_triggered(struct hw_breakpoint *bp, struct pt_regs *regs)
> +{
> +}
> +
> int ptrace_set_debugreg(struct task_struct *task, unsigned long addr,
> unsigned long data)
> {
>
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev
>
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
^ permalink raw reply
* linux-next: kvm/powerpc tree build failure
From: Stephen Rothwell @ 2009-06-17 5:04 UTC (permalink / raw)
To: Avi Kivity, Benjamin Herrenschmidt; +Cc: linuxppc-dev, linux-next, linux-kernel
Hi Avi, Ben,
Today's linux-next build (powerpc ppc44x_defconfig) failed like this:
cc1: warnings being treated as errors
arch/powerpc/kvm/../../../virt/kvm/kvm_main.c: In function '__kvm_set_memory_region':
arch/powerpc/kvm/../../../virt/kvm/kvm_main.c:1178: error: integer overflow in expression
Probably caused by commit ac04527f7947020c5890090b2ac87af4e98d977e ("KVM:
Disable large pages on misaligned memory slots"). The build fails because
arch/powerpc is now being built (mostly) with -Werror.
arch/powerpc/include/asm/kvm_host.h:#define KVM_PAGES_PER_HPAGE (1<<31)
this needs to be (1UL << 31) or ((unsigned int)1 << 31).
I applied the following patch for today.
From: Stephen Rothwell <sfr@canb.auug.org.au>
Date: Wed, 17 Jun 2009 14:57:29 +1000
Subject: [PATCH] kvm/powerpc: make 32 bit constant unsigned long
KVM_PAGES_PER_HPAGE needs to be unsigned long since its value is 2^31.
Eliminates this compiler warning:
arch/powerpc/kvm/../../../virt/kvm/kvm_main.c:1178: error: integer overflow in expression
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
arch/powerpc/include/asm/kvm_host.h | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/arch/powerpc/include/asm/kvm_host.h b/arch/powerpc/include/asm/kvm_host.h
index 3625424..d4caa61 100644
--- a/arch/powerpc/include/asm/kvm_host.h
+++ b/arch/powerpc/include/asm/kvm_host.h
@@ -34,7 +34,7 @@
#define KVM_COALESCED_MMIO_PAGE_OFFSET 1
/* We don't currently support large pages. */
-#define KVM_PAGES_PER_HPAGE (1<<31)
+#define KVM_PAGES_PER_HPAGE (1UL << 31)
struct kvm;
struct kvm_run;
--
1.6.3.1
--
Cheers,
Stephen Rothwell sfr@canb.auug.org.au
^ permalink raw reply related
* Re: Warning in block code
From: Jens Axboe @ 2009-06-17 4:36 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: linuxppc-dev list
In-Reply-To: <1245202783.21602.5.camel@pasglop>
On Wed, Jun 17 2009, Benjamin Herrenschmidt wrote:
> Hoy !
>
> I see that:
>
> block/blk-settings.c: In function ???blk_set_default_limits???:
> block/blk-settings.c:115: warning: large integer implicitly truncated to unsigned type
>
> Comes from
>
> lim->bounce_pfn = BLK_BOUNCE_ANY;
>
> With BLK_BOUNCE_ANY being a
>
> include/linux/blkdev.h:#define BLK_BOUNCE_ANY (-1ULL)
>
> And struct queue_limit.bounce_pfn is:
>
> unsigned long bounce_pfn;
>
> (The warning is fishy as both quantities are unsigned, but there -is-
> truncation happening here).
Should be safe to just make it -1UL now.
--
Jens Axboe
^ permalink raw reply
* Re: mm: Move pgtable_cache_init() earlier
From: Pekka Enberg @ 2009-06-17 4:16 UTC (permalink / raw)
To: Benjamin Herrenschmidt
Cc: linuxppc-dev list, linux-mm, Linus Torvalds, David S. Miller,
Chris Zankel
In-Reply-To: <1245210519.21602.16.camel@pasglop>
Hi Ben,
On Wed, Jun 17, 2009 at 6:48 AM, Benjamin
Herrenschmidt<benh@kernel.crashing.org> wrote:
> Some architectures need to initialize SLAB caches to be able
> to allocate page tables. They do that from pgtable_cache_init()
> so the later should be called earlier now, best is before
> vmalloc_init().
>
> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Looks good to me!
Acked-by: Pekka Enberg <penberg@cs.helsinki.fi>
^ permalink raw reply
* mm: Move pgtable_cache_init() earlier
From: Benjamin Herrenschmidt @ 2009-06-17 3:48 UTC (permalink / raw)
To: Linus Torvalds; +Cc: linuxppc-dev list, linux-mm, David S. Miller, Chris Zankel
Some architectures need to initialize SLAB caches to be able
to allocate page tables. They do that from pgtable_cache_init()
so the later should be called earlier now, best is before
vmalloc_init().
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---
Note: Only powerpc, sparc and xtensa use this and only to
call kmem_cache_create() so with a bit of luck it should
just work...
Index: linux-work/init/main.c
===================================================================
--- linux-work.orig/init/main.c 2009-06-17 13:41:33.000000000 +1000
+++ linux-work/init/main.c 2009-06-17 13:41:45.000000000 +1000
@@ -546,6 +546,7 @@ static void __init mm_init(void)
page_cgroup_init_flatmem();
mem_init();
kmem_cache_init();
+ pgtable_cache_init();
vmalloc_init();
}
@@ -684,7 +685,6 @@ asmlinkage void __init start_kernel(void
late_time_init();
calibrate_delay();
pidmap_init();
- pgtable_cache_init();
anon_vma_init();
#ifdef CONFIG_X86
if (efi_enabled)
^ permalink raw reply
* [PATCH 3/3] powerpc/pasemi: Use raw spinlock in SMP TB sync
From: Benjamin Herrenschmidt @ 2009-06-17 2:42 UTC (permalink / raw)
To: linuxppc-dev
spin_lock() can hang if called while the timebase is frozen,
so use a raw lock instead, also disable interrupts while
at it.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---
arch/powerpc/platforms/pasemi/setup.c | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
--- linux-work.orig/arch/powerpc/platforms/pasemi/setup.c 2009-06-17 12:13:33.000000000 +1000
+++ linux-work/arch/powerpc/platforms/pasemi/setup.c 2009-06-17 12:15:01.000000000 +1000
@@ -71,20 +71,25 @@ static void pas_restart(char *cmd)
}
#ifdef CONFIG_SMP
-static DEFINE_SPINLOCK(timebase_lock);
+static raw_spinlock_t timebase_lock;
static unsigned long timebase;
static void __devinit pas_give_timebase(void)
{
- spin_lock(&timebase_lock);
+ unsigned long flags;
+
+ local_irq_save(flags);
+ hard_irq_disable();
+ __raw_spin_lock(&timebase_lock);
mtspr(SPRN_TBCTL, TBCTL_FREEZE);
isync();
timebase = get_tb();
- spin_unlock(&timebase_lock);
+ __raw_spin_unlock(&timebase_lock);
while (timebase)
barrier();
mtspr(SPRN_TBCTL, TBCTL_RESTART);
+ local_irq_restore(flags);
}
static void __devinit pas_take_timebase(void)
@@ -92,10 +97,10 @@ static void __devinit pas_take_timebase(
while (!timebase)
smp_rmb();
- spin_lock(&timebase_lock);
+ __raw_spin_lock(&timebase_lock);
set_tb(timebase >> 32, timebase & 0xffffffff);
timebase = 0;
- spin_unlock(&timebase_lock);
+ __raw_spin_unlock(&timebase_lock);
}
struct smp_ops_t pas_smp_ops = {
^ permalink raw reply
* [PATCH 2/3] powerpc: Use one common impl. of RTAS timebase sync and use raw spinlock
From: Benjamin Herrenschmidt @ 2009-06-17 2:42 UTC (permalink / raw)
To: linuxppc-dev
Several platforms use their own copy of what is essentially the same code,
using RTAS to synchronize the timebases when bringing up new CPUs. This
moves it all into a single common implementation and additionally
turns the spinlock into a raw spinlock since the former can rely on
the timebase not being frozen when spinlock debugging is enabled, and finally
masks interrupts while the timebase is disabled.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---
arch/powerpc/include/asm/rtas.h | 3 +++
arch/powerpc/kernel/rtas.c | 31 +++++++++++++++++++++++++++++++
arch/powerpc/platforms/cell/smp.c | 30 ++----------------------------
arch/powerpc/platforms/chrp/smp.c | 30 ++----------------------------
arch/powerpc/platforms/pseries/smp.c | 30 ++----------------------------
5 files changed, 40 insertions(+), 84 deletions(-)
--- linux-work.orig/arch/powerpc/platforms/cell/smp.c 2009-06-17 11:56:31.000000000 +1000
+++ linux-work/arch/powerpc/platforms/cell/smp.c 2009-06-17 11:56:42.000000000 +1000
@@ -36,7 +36,6 @@
#include <asm/prom.h>
#include <asm/smp.h>
#include <asm/paca.h>
-#include <asm/time.h>
#include <asm/machdep.h>
#include <asm/cputable.h>
#include <asm/firmware.h>
@@ -140,31 +139,6 @@ static void __devinit smp_cell_setup_cpu
mtspr(SPRN_DABRX, DABRX_KERNEL | DABRX_USER);
}
-static DEFINE_SPINLOCK(timebase_lock);
-static unsigned long timebase = 0;
-
-static void __devinit cell_give_timebase(void)
-{
- spin_lock(&timebase_lock);
- rtas_call(rtas_token("freeze-time-base"), 0, 1, NULL);
- timebase = get_tb();
- spin_unlock(&timebase_lock);
-
- while (timebase)
- barrier();
- rtas_call(rtas_token("thaw-time-base"), 0, 1, NULL);
-}
-
-static void __devinit cell_take_timebase(void)
-{
- while (!timebase)
- barrier();
- spin_lock(&timebase_lock);
- set_tb(timebase >> 32, timebase & 0xffffffff);
- timebase = 0;
- spin_unlock(&timebase_lock);
-}
-
static void __devinit smp_cell_kick_cpu(int nr)
{
BUG_ON(nr < 0 || nr >= NR_CPUS);
@@ -224,8 +198,8 @@ void __init smp_init_cell(void)
/* Non-lpar has additional take/give timebase */
if (rtas_token("freeze-time-base") != RTAS_UNKNOWN_SERVICE) {
- smp_ops->give_timebase = cell_give_timebase;
- smp_ops->take_timebase = cell_take_timebase;
+ smp_ops->give_timebase = rtas_give_timebase;
+ smp_ops->take_timebase = rtas_take_timebase;
}
DBG(" <- smp_init_cell()\n");
Index: linux-work/arch/powerpc/platforms/chrp/smp.c
===================================================================
--- linux-work.orig/arch/powerpc/platforms/chrp/smp.c 2009-06-17 11:56:31.000000000 +1000
+++ linux-work/arch/powerpc/platforms/chrp/smp.c 2009-06-17 11:56:42.000000000 +1000
@@ -26,7 +26,6 @@
#include <asm/io.h>
#include <asm/prom.h>
#include <asm/smp.h>
-#include <asm/time.h>
#include <asm/machdep.h>
#include <asm/mpic.h>
#include <asm/rtas.h>
@@ -45,37 +44,12 @@ static void __devinit smp_chrp_setup_cpu
static DEFINE_SPINLOCK(timebase_lock);
static unsigned int timebase_upper = 0, timebase_lower = 0;
-void __devinit smp_chrp_give_timebase(void)
-{
- spin_lock(&timebase_lock);
- rtas_call(rtas_token("freeze-time-base"), 0, 1, NULL);
- timebase_upper = get_tbu();
- timebase_lower = get_tbl();
- spin_unlock(&timebase_lock);
-
- while (timebase_upper || timebase_lower)
- barrier();
- rtas_call(rtas_token("thaw-time-base"), 0, 1, NULL);
-}
-
-void __devinit smp_chrp_take_timebase(void)
-{
- while (!(timebase_upper || timebase_lower))
- barrier();
- spin_lock(&timebase_lock);
- set_tb(timebase_upper, timebase_lower);
- timebase_upper = 0;
- timebase_lower = 0;
- spin_unlock(&timebase_lock);
- printk("CPU %i taken timebase\n", smp_processor_id());
-}
-
/* CHRP with openpic */
struct smp_ops_t chrp_smp_ops = {
.message_pass = smp_mpic_message_pass,
.probe = smp_mpic_probe,
.kick_cpu = smp_chrp_kick_cpu,
.setup_cpu = smp_chrp_setup_cpu,
- .give_timebase = smp_chrp_give_timebase,
- .take_timebase = smp_chrp_take_timebase,
+ .give_timebase = rtas_give_timebase,
+ .take_timebase = rtas_take_timebase,
};
Index: linux-work/arch/powerpc/platforms/pseries/smp.c
===================================================================
--- linux-work.orig/arch/powerpc/platforms/pseries/smp.c 2009-06-17 11:56:31.000000000 +1000
+++ linux-work/arch/powerpc/platforms/pseries/smp.c 2009-06-17 11:56:42.000000000 +1000
@@ -35,7 +35,6 @@
#include <asm/prom.h>
#include <asm/smp.h>
#include <asm/paca.h>
-#include <asm/time.h>
#include <asm/machdep.h>
#include <asm/cputable.h>
#include <asm/firmware.h>
@@ -118,31 +117,6 @@ static void __devinit smp_xics_setup_cpu
}
#endif /* CONFIG_XICS */
-static DEFINE_SPINLOCK(timebase_lock);
-static unsigned long timebase = 0;
-
-static void __devinit pSeries_give_timebase(void)
-{
- spin_lock(&timebase_lock);
- rtas_call(rtas_token("freeze-time-base"), 0, 1, NULL);
- timebase = get_tb();
- spin_unlock(&timebase_lock);
-
- while (timebase)
- barrier();
- rtas_call(rtas_token("thaw-time-base"), 0, 1, NULL);
-}
-
-static void __devinit pSeries_take_timebase(void)
-{
- while (!timebase)
- barrier();
- spin_lock(&timebase_lock);
- set_tb(timebase >> 32, timebase & 0xffffffff);
- timebase = 0;
- spin_unlock(&timebase_lock);
-}
-
static void __devinit smp_pSeries_kick_cpu(int nr)
{
BUG_ON(nr < 0 || nr >= NR_CPUS);
@@ -209,8 +183,8 @@ static void __init smp_init_pseries(void
/* Non-lpar has additional take/give timebase */
if (rtas_token("freeze-time-base") != RTAS_UNKNOWN_SERVICE) {
- smp_ops->give_timebase = pSeries_give_timebase;
- smp_ops->take_timebase = pSeries_take_timebase;
+ smp_ops->give_timebase = rtas_give_timebase;
+ smp_ops->take_timebase = rtas_take_timebase;
}
pr_debug(" <- smp_init_pSeries()\n");
Index: linux-work/arch/powerpc/include/asm/rtas.h
===================================================================
--- linux-work.orig/arch/powerpc/include/asm/rtas.h 2009-06-17 11:56:31.000000000 +1000
+++ linux-work/arch/powerpc/include/asm/rtas.h 2009-06-17 11:56:42.000000000 +1000
@@ -245,5 +245,8 @@ static inline u32 rtas_config_addr(int b
(devfn << 8) | (reg & 0xff);
}
+extern void __cpuinit rtas_give_timebase(void);
+extern void __cpuinit rtas_take_timebase(void);
+
#endif /* __KERNEL__ */
#endif /* _POWERPC_RTAS_H */
Index: linux-work/arch/powerpc/kernel/rtas.c
===================================================================
--- linux-work.orig/arch/powerpc/kernel/rtas.c 2009-06-17 11:56:31.000000000 +1000
+++ linux-work/arch/powerpc/kernel/rtas.c 2009-06-17 11:59:58.000000000 +1000
@@ -38,6 +38,7 @@
#include <asm/syscalls.h>
#include <asm/smp.h>
#include <asm/atomic.h>
+#include <asm/time.h>
struct rtas_t rtas = {
.lock = __RAW_SPIN_LOCK_UNLOCKED
@@ -971,3 +972,33 @@ int __init early_init_dt_scan_rtas(unsig
/* break now */
return 1;
}
+
+static raw_spinlock_t timebase_lock;
+static u64 timebase = 0;
+
+void __cpuinit rtas_give_timebase(void)
+{
+ unsigned long flags;
+
+ local_irq_save(flags);
+ hard_irq_disable();
+ __raw_spin_lock(&timebase_lock);
+ rtas_call(rtas_token("freeze-time-base"), 0, 1, NULL);
+ timebase = get_tb();
+ __raw_spin_unlock(&timebase_lock);
+
+ while (timebase)
+ barrier();
+ rtas_call(rtas_token("thaw-time-base"), 0, 1, NULL);
+ local_irq_restore(flags);
+}
+
+void __cpuinit rtas_take_timebase(void)
+{
+ while (!timebase)
+ barrier();
+ __raw_spin_lock(&timebase_lock);
+ set_tb(timebase >> 32, timebase & 0xffffffff);
+ timebase = 0;
+ __raw_spin_unlock(&timebase_lock);
+}
^ permalink raw reply
* [PATCH 1/3] powerpc/rtas: Turn rtas lock into a raw spinlock
From: Benjamin Herrenschmidt @ 2009-06-17 2:42 UTC (permalink / raw)
To: linuxppc-dev
RTAS currently uses a normal spinlock. However it can be called from
contexts where this is not necessarily a good idea. For example, it
can be called while syncing timebases, with the core timebase being
frozen. Unfortunately, that will deadlock in case of lock contention
when spinlock debugging is enabled as the spin lock debugging code
will try to use __delay() which ... relies on the timebase being
enabled.
Also RTAS can be used in some low level IRQ handling code path so it
may as well be a raw spinlock for -rt sake.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---
arch/powerpc/include/asm/rtas.h | 2 +-
arch/powerpc/kernel/rtas.c | 38 +++++++++++++++++++++++++++++---------
2 files changed, 30 insertions(+), 10 deletions(-)
--- linux-work.orig/arch/powerpc/include/asm/rtas.h 2009-06-10 16:09:36.000000000 +1000
+++ linux-work/arch/powerpc/include/asm/rtas.h 2009-06-10 16:40:50.000000000 +1000
@@ -58,7 +58,7 @@ struct rtas_t {
unsigned long entry; /* physical address pointer */
unsigned long base; /* physical address pointer */
unsigned long size;
- spinlock_t lock;
+ raw_spinlock_t lock;
struct rtas_args args;
struct device_node *dev; /* virtual address pointer */
};
Index: linux-work/arch/powerpc/kernel/rtas.c
===================================================================
--- linux-work.orig/arch/powerpc/kernel/rtas.c 2009-06-10 16:09:36.000000000 +1000
+++ linux-work/arch/powerpc/kernel/rtas.c 2009-06-10 16:40:50.000000000 +1000
@@ -40,7 +40,7 @@
#include <asm/atomic.h>
struct rtas_t rtas = {
- .lock = SPIN_LOCK_UNLOCKED
+ .lock = __RAW_SPIN_LOCK_UNLOCKED
};
EXPORT_SYMBOL(rtas);
@@ -67,6 +67,28 @@ unsigned long rtas_rmo_buf;
void (*rtas_flash_term_hook)(int);
EXPORT_SYMBOL(rtas_flash_term_hook);
+/* RTAS use home made raw locking instead of spin_lock_irqsave
+ * because those can be called from within really nasty contexts
+ * such as having the timebase stopped which would lockup with
+ * normal locks and spinlock debugging enabled
+ */
+static unsigned long lock_rtas(void)
+{
+ unsigned long flags;
+
+ local_irq_save(flags);
+ preempt_disable();
+ __raw_spin_lock_flags(&rtas.lock, flags);
+ return flags;
+}
+
+static void unlock_rtas(unsigned long flags)
+{
+ __raw_spin_unlock(&rtas.lock);
+ local_irq_restore(flags);
+ preempt_enable();
+}
+
/*
* call_rtas_display_status and call_rtas_display_status_delay
* are designed only for very early low-level debugging, which
@@ -79,7 +101,7 @@ static void call_rtas_display_status(cha
if (!rtas.base)
return;
- spin_lock_irqsave(&rtas.lock, s);
+ s = lock_rtas();
args->token = 10;
args->nargs = 1;
@@ -89,7 +111,7 @@ static void call_rtas_display_status(cha
enter_rtas(__pa(args));
- spin_unlock_irqrestore(&rtas.lock, s);
+ unlock_rtas(s);
}
static void call_rtas_display_status_delay(char c)
@@ -411,8 +433,7 @@ int rtas_call(int token, int nargs, int
if (!rtas.entry || token == RTAS_UNKNOWN_SERVICE)
return -1;
- /* Gotta do something different here, use global lock for now... */
- spin_lock_irqsave(&rtas.lock, s);
+ s = lock_rtas();
rtas_args = &rtas.args;
rtas_args->token = token;
@@ -439,8 +460,7 @@ int rtas_call(int token, int nargs, int
outputs[i] = rtas_args->rets[i+1];
ret = (nret > 0)? rtas_args->rets[0]: 0;
- /* Gotta do something different here, use global lock for now... */
- spin_unlock_irqrestore(&rtas.lock, s);
+ unlock_rtas(s);
if (buff_copy) {
log_error(buff_copy, ERR_TYPE_RTAS_LOG, 0);
@@ -837,7 +857,7 @@ asmlinkage int ppc_rtas(struct rtas_args
buff_copy = get_errorlog_buffer();
- spin_lock_irqsave(&rtas.lock, flags);
+ flags = lock_rtas();
rtas.args = args;
enter_rtas(__pa(&rtas.args));
@@ -848,7 +868,7 @@ asmlinkage int ppc_rtas(struct rtas_args
if (args.rets[0] == -1)
errbuf = __fetch_rtas_last_error(buff_copy);
- spin_unlock_irqrestore(&rtas.lock, flags);
+ unlock_rtas(flags);
if (buff_copy) {
if (errbuf)
^ permalink raw reply
* Re: [PATCH] powerpc: Update Warp defconfig
From: Sean MacLennan @ 2009-06-17 2:04 UTC (permalink / raw)
To: linuxppc-dev
In-Reply-To: <20090616112435.20f7b3d9@lappy.seanm.ca>
On Tue, 16 Jun 2009 11:24:35 -0400
Sean MacLennan <smaclennan@pikatech.com> wrote:
> I forgot to include the defconfig in the last set of patches. So you
> don't get to use the shiny new LEDS driver on the warp unless you turn
> it on.
>
> Enabling hotplug is also very important since we have moved to udev on
> the warp.
>
> Like most defconfig patches, most of the changes are just the normal
> kernel changes, not warp specific.
>
> If it is too early, and we want to hold off until say rc4 with
> defconfigs I have no problem with that. I have tried to outline all
> the changes we specifically made. If anybody sees any bad choices with
> options, let me know!
>
> Cheers,
> Sean
>
> * Enable GPIO LEDS
> * Enable LED triggers
> * Move to slub
> * Enable hotplug
> * Enable timestamps on printks
> * Enable UBIFS
Oops, missed an important option in the list:
* Enable in kernel config
If you use Pika's development environment (PADS), you need this
enabled. We use the config to enable certain features, mainly udev.
Without this config, we will assume you have an old Pika kernel without
new features.
Cheers,
Sean
^ permalink raw reply
* [PATCH 2/2] powerpc/440: Fix warning early debug code
From: Benjamin Herrenschmidt @ 2009-06-17 1:55 UTC (permalink / raw)
To: linuxppc-dev
The function udbg_44x_as1_flush() has the wrong prototype causing
a warning when enabling 440 early debug.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---
arch/powerpc/kernel/udbg_16550.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- linux-work.orig/arch/powerpc/kernel/udbg_16550.c 2009-06-17 11:52:05.000000000 +1000
+++ linux-work/arch/powerpc/kernel/udbg_16550.c 2009-06-17 11:52:08.000000000 +1000
@@ -219,7 +219,7 @@ void udbg_init_pas_realmode(void)
#ifdef CONFIG_PPC_EARLY_DEBUG_44x
#include <platforms/44x/44x.h>
-static int udbg_44x_as1_flush(void)
+static void udbg_44x_as1_flush(void)
{
if (udbg_comport) {
while ((as1_readb(&udbg_comport->lsr) & LSR_THRE) == 0)
^ permalink raw reply
* [PATCH 1/2] powerpc/of: Fix usage of dev_set_name() in of_device_alloc()
From: Benjamin Herrenschmidt @ 2009-06-17 1:55 UTC (permalink / raw)
To: linuxppc-dev
dev_set_name() takes a format string, so use it properly and avoid
a warning with recent gcc's
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---
arch/powerpc/kernel/of_device.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- linux-work.orig/arch/powerpc/kernel/of_device.c 2009-06-17 11:34:54.000000000 +1000
+++ linux-work/arch/powerpc/kernel/of_device.c 2009-06-17 11:35:04.000000000 +1000
@@ -76,7 +76,7 @@ struct of_device *of_device_alloc(struct
dev->dev.archdata.of_node = np;
if (bus_id)
- dev_set_name(&dev->dev, bus_id);
+ dev_set_name(&dev->dev, "%s", bus_id);
else
of_device_make_bus_id(dev);
^ permalink raw reply
* Warning in block code
From: Benjamin Herrenschmidt @ 2009-06-17 1:39 UTC (permalink / raw)
To: Jens Axboe; +Cc: linuxppc-dev list
Hoy !
I see that:
block/blk-settings.c: In function ‘blk_set_default_limits’:
block/blk-settings.c:115: warning: large integer implicitly truncated to unsigned type
Comes from
lim->bounce_pfn = BLK_BOUNCE_ANY;
With BLK_BOUNCE_ANY being a
include/linux/blkdev.h:#define BLK_BOUNCE_ANY (-1ULL)
And struct queue_limit.bounce_pfn is:
unsigned long bounce_pfn;
(The warning is fishy as both quantities are unsigned, but there -is- truncation
happening here).
Cheers,
Ben.
^ permalink raw reply
* Re: PowerPC PCI DMA issues (prefetch/coherency?)
From: Leon Woestenberg @ 2009-06-17 1:13 UTC (permalink / raw)
To: Benjamin Herrenschmidt
Cc: arnd, linux-kernel, FUJITA Tomonori, scottwood, chris.pringle,
linuxppc-dev
In-Reply-To: <1245200912.21602.2.camel@pasglop>
Hello Benjamin,
On Wed, Jun 17, 2009 at 3:08 AM, Benjamin
Herrenschmidt<benh@kernel.crashing.org> wrote:
> On Wed, 2009-06-17 at 02:56 +0200, Leon Woestenberg wrote:
>> I use pci_map_sg(), have the device perform either DMA master reads or
>> writes to the bus address using PCIe.
>> After that, I use pci_unmap_sg().
>>
>> My assumption is that pci_unmap_sg() either makes the cache coherent
>> or invalidated and thus I do not need to take further actions.
>> This is on a MPC83xx or 85xx system.
>>
>> Is this assumption correct?
>
> It is, as far as I understand things :-) Those APIs are fun.
>
> You should only need the explicit sync calls if you are going to peek or
> poke at the DMA mapped memory before you unmap it.
>
Thanks, then at least I understand things in the corr^H^H^H^Hsame way :-)
And btw, I hadn't seen any data mismatch yet.
Regards,
--
Leon 'likewise' Woestenberg
^ permalink raw reply
* Re: PowerPC PCI DMA issues (prefetch/coherency?)
From: Benjamin Herrenschmidt @ 2009-06-17 1:08 UTC (permalink / raw)
To: Leon Woestenberg
Cc: arnd, linux-kernel, FUJITA Tomonori, scottwood, chris.pringle,
linuxppc-dev
In-Reply-To: <c384c5ea0906161756j4b701abfj2a8908b9c93ddd04@mail.gmail.com>
On Wed, 2009-06-17 at 02:56 +0200, Leon Woestenberg wrote:
> I use pci_map_sg(), have the device perform either DMA master reads or
> writes to the bus address using PCIe.
> After that, I use pci_unmap_sg().
>
> My assumption is that pci_unmap_sg() either makes the cache coherent
> or invalidated and thus I do not need to take further actions.
> This is on a MPC83xx or 85xx system.
>
> Is this assumption correct?
It is, as far as I understand things :-) Those APIs are fun.
You should only need the explicit sync calls if you are going to peek or
poke at the DMA mapped memory before you unmap it.
Cheers,
Ben.
^ permalink raw reply
* Re: PowerPC PCI DMA issues (prefetch/coherency?)
From: Benjamin Herrenschmidt @ 2009-06-17 1:07 UTC (permalink / raw)
To: FUJITA Tomonori
Cc: scottwood, chris.pringle, linuxppc-dev, linux-kernel, arnd
In-Reply-To: <20090617093654B.fujita.tomonori@lab.ntt.co.jp>
On Wed, 2009-06-17 at 09:37 +0900, FUJITA Tomonori wrote:
>
> dma_cache_sync is supposed to be used only with the buffers that
> dma_alloc_noncoherent() returns. On architecutures that maps
> dma_alloc_noncoherent to dma_alloc_coherent, dma_cache_sync() is
> supposed to be NOP.
>
Or at least a sync() on powerpc but yeah, I see. We should probably do
that.
Cheers,
Ben.
^ permalink raw reply
* Re: [PATCH] RFC: powerpc: expose the multi-bit ops that underlie single-bit ops.
From: Stephen Rothwell @ 2009-06-17 1:07 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: linuxppc-dev, Geoff Thorpe
In-Reply-To: <1245188026.14036.17.camel@pasglop>
[-- Attachment #1: Type: text/plain, Size: 1098 bytes --]
On Wed, 17 Jun 2009 07:33:46 +1000 Benjamin Herrenschmidt <benh@kernel.crashing.org> wrote:
>
> You can also go totally mad and generate the whole function (both -s and
> non -s variants) from one macro but I wouldn't go that far :-)
Please don't (unless you keep the function names intact), it makes
finding the function with grep almost impossible ...
> > Also - any opinion on whether the same re-factoring of the asm-generic
> > versions should be undertaken? I'm not looking to bite off more than I
> > can chew, but I don't know if it's frowned upon to make powerpc-only
> > extensions to the API. And if you think an asm-generic patch makes
> > sense, could that be taken via linuxppc-dev too or does it need to go
> > elsewhere?
>
> I'm not people care -that- much :-) You can always try and post it to
> lkml (maybe linux-arch too) and see what comes back... but let's finish
> the powerpc variant first :-)
Also, we have an asm-generic maintainer now ...
--
Cheers,
Stephen Rothwell sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/
[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply
* Re: PowerPC PCI DMA issues (prefetch/coherency?)
From: Leon Woestenberg @ 2009-06-17 0:56 UTC (permalink / raw)
To: FUJITA Tomonori
Cc: arnd, linux-kernel, scottwood, chris.pringle, linuxppc-dev
In-Reply-To: <20090617093654B.fujita.tomonori@lab.ntt.co.jp>
Hello all,
On Wed, Jun 17, 2009 at 2:37 AM, FUJITA
Tomonori<fujita.tomonori@lab.ntt.co.jp> wrote:
> On Wed, 17 Jun 2009 10:18:45 +1000
> Benjamin Herrenschmidt <benh@kernel.crashing.org> wrote:
>
>> On Tue, 2009-06-16 at 20:02 +0200, Arnd Bergmann wrote:
>> > On Tuesday 16 June 2009, Scott Wood wrote:
>> > > > If the
>> > > > device is the only one, you can also use dma_alloc_noncoherent() and
>> > > > flush explicitly with dma_cache_sync().
>> > >
>> > > I don't see how that would help -- aren't those also controlled by
>> > > CONFIG_NOT_COHERENT_CACHE?
>> >
>> > Ah, yes you are right. PowerPC implements dma_alloc_noncoherent as
>> > dma_alloc_coherent, so dma_cache_sync() is actually a NOP (or should be).
>>
>> But we still need to sync the result of dma_map_* when used multiple
>> times for a single mapping.
>
> We have dma_sync_{single|sg}_for_{cpu|device} API for the above
> purpose.
>
> dma_cache_sync is supposed to be used only with the buffers that
> dma_alloc_noncoherent() returns. On architecutures that maps
> dma_alloc_noncoherent to dma_alloc_coherent, dma_cache_sync() is
> supposed to be NOP.
This discussion raised some doubt with me about my use case:
I my case (note I am not the poster) I am using (what LDD3 calls)
streaming mappings:
I use pci_map_sg(), have the device perform either DMA master reads or
writes to the bus address using PCIe.
After that, I use pci_unmap_sg().
My assumption is that pci_unmap_sg() either makes the cache coherent
or invalidated and thus I do not need to take further actions.
This is on a MPC83xx or 85xx system.
Is this assumption correct?
Regards,
Leon/
--
Leon
^ permalink raw reply
* Re: PowerPC PCI DMA issues (prefetch/coherency?)
From: FUJITA Tomonori @ 2009-06-17 0:37 UTC (permalink / raw)
To: benh; +Cc: scottwood, chris.pringle, linuxppc-dev, linux-kernel, arnd
In-Reply-To: <1245197925.21602.0.camel@pasglop>
On Wed, 17 Jun 2009 10:18:45 +1000
Benjamin Herrenschmidt <benh@kernel.crashing.org> wrote:
> On Tue, 2009-06-16 at 20:02 +0200, Arnd Bergmann wrote:
> > On Tuesday 16 June 2009, Scott Wood wrote:
> > > > If the
> > > > device is the only one, you can also use dma_alloc_noncoherent() and
> > > > flush explicitly with dma_cache_sync().
> > >
> > > I don't see how that would help -- aren't those also controlled by
> > > CONFIG_NOT_COHERENT_CACHE?
> >
> > Ah, yes you are right. PowerPC implements dma_alloc_noncoherent as
> > dma_alloc_coherent, so dma_cache_sync() is actually a NOP (or should be).
>
> But we still need to sync the result of dma_map_* when used multiple
> times for a single mapping.
We have dma_sync_{single|sg}_for_{cpu|device} API for the above
purpose.
dma_cache_sync is supposed to be used only with the buffers that
dma_alloc_noncoherent() returns. On architecutures that maps
dma_alloc_noncoherent to dma_alloc_coherent, dma_cache_sync() is
supposed to be NOP.
^ 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