* [PATCH 6/9] spi_mpc83xx: Split mpc83xx_spi_work() into two routines
From: Anton Vorontsov @ 2009-04-30 23:48 UTC (permalink / raw)
To: Kumar Gala
Cc: linuxppc-dev, Andrew Morton, David Brownell, linux-kernel,
spi-devel-general
In-Reply-To: <20090430234739.GA27709@oksana.dev.rtsoft.ru>
mpc83xx_spi_work() is quite large, with up to five indentation
levels and is quite difficult to read.
So, split the function in two parts:
1. mpc83xx_spi_work() now only traverse queued spi messages;
2. mpc83xx_spi_do_one_msg() only manages single messages.
There should be no functional changes.
Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
---
drivers/spi/spi_mpc83xx.c | 115 +++++++++++++++++++++++---------------------
1 files changed, 60 insertions(+), 55 deletions(-)
diff --git a/drivers/spi/spi_mpc83xx.c b/drivers/spi/spi_mpc83xx.c
index 40f7448..50112a5 100644
--- a/drivers/spi/spi_mpc83xx.c
+++ b/drivers/spi/spi_mpc83xx.c
@@ -350,71 +350,76 @@ static int mpc83xx_spi_bufs(struct spi_device *spi, struct spi_transfer *t)
return mpc83xx_spi->count;
}
-static void mpc83xx_spi_work(struct work_struct *work)
+static void mpc83xx_spi_do_one_msg(struct spi_message *m)
{
- struct mpc83xx_spi *mpc83xx_spi =
- container_of(work, struct mpc83xx_spi, work);
-
- spin_lock_irq(&mpc83xx_spi->lock);
- mpc83xx_spi->busy = 1;
- while (!list_empty(&mpc83xx_spi->queue)) {
- struct spi_message *m;
- struct spi_device *spi;
- struct spi_transfer *t = NULL;
- unsigned cs_change;
- int status, nsecs = 50;
-
- m = container_of(mpc83xx_spi->queue.next,
- struct spi_message, queue);
- list_del_init(&m->queue);
- spin_unlock_irq(&mpc83xx_spi->lock);
-
- spi = m->spi;
- cs_change = 1;
- status = 0;
- list_for_each_entry(t, &m->transfers, transfer_list) {
- if (t->bits_per_word || t->speed_hz) {
- /* Don't allow changes if CS is active */
- status = -EINVAL;
-
- if (cs_change)
- status = mpc83xx_spi_setup_transfer(spi, t);
- if (status < 0)
- break;
- }
-
- if (cs_change) {
- mpc83xx_spi_chipselect(spi, BITBANG_CS_ACTIVE);
- ndelay(nsecs);
- }
- cs_change = t->cs_change;
- if (t->len)
- status = mpc83xx_spi_bufs(spi, t);
- if (status) {
- status = -EMSGSIZE;
+ struct spi_device *spi = m->spi;
+ struct spi_transfer *t;
+ unsigned int cs_change;
+ const int nsecs = 50;
+ int status;
+
+ cs_change = 1;
+ status = 0;
+ list_for_each_entry(t, &m->transfers, transfer_list) {
+ if (t->bits_per_word || t->speed_hz) {
+ /* Don't allow changes if CS is active */
+ status = -EINVAL;
+
+ if (cs_change)
+ status = mpc83xx_spi_setup_transfer(spi, t);
+ if (status < 0)
break;
- }
- m->actual_length += t->len;
-
- if (t->delay_usecs)
- udelay(t->delay_usecs);
+ }
- if (cs_change) {
- ndelay(nsecs);
- mpc83xx_spi_chipselect(spi, BITBANG_CS_INACTIVE);
- ndelay(nsecs);
- }
+ if (cs_change) {
+ mpc83xx_spi_chipselect(spi, BITBANG_CS_ACTIVE);
+ ndelay(nsecs);
+ }
+ cs_change = t->cs_change;
+ if (t->len)
+ status = mpc83xx_spi_bufs(spi, t);
+ if (status) {
+ status = -EMSGSIZE;
+ break;
}
+ m->actual_length += t->len;
- m->status = status;
- m->complete(m->context);
+ if (t->delay_usecs)
+ udelay(t->delay_usecs);
- if (status || !cs_change) {
+ if (cs_change) {
ndelay(nsecs);
mpc83xx_spi_chipselect(spi, BITBANG_CS_INACTIVE);
+ ndelay(nsecs);
}
+ }
+
+ m->status = status;
+ m->complete(m->context);
+
+ if (status || !cs_change) {
+ ndelay(nsecs);
+ mpc83xx_spi_chipselect(spi, BITBANG_CS_INACTIVE);
+ }
+
+ mpc83xx_spi_setup_transfer(spi, NULL);
+}
+
+static void mpc83xx_spi_work(struct work_struct *work)
+{
+ struct mpc83xx_spi *mpc83xx_spi = container_of(work, struct mpc83xx_spi,
+ work);
+
+ spin_lock_irq(&mpc83xx_spi->lock);
+ mpc83xx_spi->busy = 1;
+ while (!list_empty(&mpc83xx_spi->queue)) {
+ struct spi_message *m = container_of(mpc83xx_spi->queue.next,
+ struct spi_message, queue);
+
+ list_del_init(&m->queue);
+ spin_unlock_irq(&mpc83xx_spi->lock);
- mpc83xx_spi_setup_transfer(spi, NULL);
+ mpc83xx_spi_do_one_msg(m);
spin_lock_irq(&mpc83xx_spi->lock);
}
--
1.6.2.2
^ permalink raw reply related
* [PATCH 5/9] spi_mpc83xx: Fix checkpatch issues
From: Anton Vorontsov @ 2009-04-30 23:48 UTC (permalink / raw)
To: Kumar Gala
Cc: linuxppc-dev, Andrew Morton, David Brownell, linux-kernel,
spi-devel-general
In-Reply-To: <20090430234739.GA27709@oksana.dev.rtsoft.ru>
Checkpatch is spitting errors when seeing the rename patch, so fix
the errors prior to moving.
Following errors and warnings were fixed:
WARNING: Use #include <linux/io.h> instead of <asm/io.h>
#1027: FILE: drivers/spi/spi_mpc8xxx.c:37:
+#include <asm/io.h>
ERROR: "foo * bar" should be "foo *bar"
#1111: FILE: drivers/spi/spi_mpc8xxx.c:121:
+static inline void mpc83xx_spi_write_reg(__be32 __iomem * reg, u32 val)
ERROR: "foo * bar" should be "foo *bar"
#1116: FILE: drivers/spi/spi_mpc8xxx.c:126:
+static inline u32 mpc83xx_spi_read_reg(__be32 __iomem * reg)
ERROR: "foo * bar" should be "foo *bar"
#1125: FILE: drivers/spi/spi_mpc8xxx.c:135:
+ type * rx = mpc83xx_spi->rx; \
ERROR: "foo * bar" should be "foo *bar"
#1135: FILE: drivers/spi/spi_mpc8xxx.c:145:
+ const type * tx = mpc83xx_spi->tx; \
WARNING: suspect code indent for conditional statements (16, 25)
#1504: FILE: drivers/spi/spi_mpc8xxx.c:514:
+ while (((event =
[...]
+ cpu_relax();
Following warnings were left over, since fixing them will
hurt the readability. We'd better fix them by lowering
the indentation level by splitting mpc83xx_spi_work function
into two parts.
WARNING: line over 80 characters
#1371: FILE: drivers/spi/spi_mpc8xxx.c:381:
+ status = mpc83xx_spi_setup_transfer(spi, t);
WARNING: line over 80 characters
#1392: FILE: drivers/spi/spi_mpc8xxx.c:402:
+ mpc83xx_spi_chipselect(spi, BITBANG_CS_INACTIVE);
Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
---
drivers/spi/spi_mpc83xx.c | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/spi/spi_mpc83xx.c b/drivers/spi/spi_mpc83xx.c
index d378d5e..40f7448 100644
--- a/drivers/spi/spi_mpc83xx.c
+++ b/drivers/spi/spi_mpc83xx.c
@@ -17,6 +17,7 @@
#include <linux/bug.h>
#include <linux/errno.h>
#include <linux/err.h>
+#include <linux/io.h>
#include <linux/completion.h>
#include <linux/interrupt.h>
#include <linux/delay.h>
@@ -34,7 +35,6 @@
#include <sysdev/fsl_soc.h>
#include <asm/irq.h>
-#include <asm/io.h>
/* SPI Controller registers */
struct mpc83xx_spi_reg {
@@ -118,12 +118,12 @@ struct spi_mpc83xx_cs {
u32 hw_mode; /* Holds HW mode register settings */
};
-static inline void mpc83xx_spi_write_reg(__be32 __iomem * reg, u32 val)
+static inline void mpc83xx_spi_write_reg(__be32 __iomem *reg, u32 val)
{
out_be32(reg, val);
}
-static inline u32 mpc83xx_spi_read_reg(__be32 __iomem * reg)
+static inline u32 mpc83xx_spi_read_reg(__be32 __iomem *reg)
{
return in_be32(reg);
}
@@ -132,7 +132,7 @@ static inline u32 mpc83xx_spi_read_reg(__be32 __iomem * reg)
static \
void mpc83xx_spi_rx_buf_##type(u32 data, struct mpc83xx_spi *mpc83xx_spi) \
{ \
- type * rx = mpc83xx_spi->rx; \
+ type *rx = mpc83xx_spi->rx; \
*rx++ = (type)(data >> mpc83xx_spi->rx_shift); \
mpc83xx_spi->rx = rx; \
}
@@ -142,7 +142,7 @@ static \
u32 mpc83xx_spi_tx_buf_##type(struct mpc83xx_spi *mpc83xx_spi) \
{ \
u32 data; \
- const type * tx = mpc83xx_spi->tx; \
+ const type *tx = mpc83xx_spi->tx; \
if (!tx) \
return 0; \
data = *tx++ << mpc83xx_spi->tx_shift; \
@@ -516,7 +516,7 @@ static irqreturn_t mpc83xx_spi_irq(s32 irq, void *context_data)
while (((event =
mpc83xx_spi_read_reg(&mpc83xx_spi->base->event)) &
SPIE_NF) == 0)
- cpu_relax();
+ cpu_relax();
mpc83xx_spi->count -= 1;
if (mpc83xx_spi->count) {
--
1.6.2.2
^ permalink raw reply related
* [PATCH 4/9] powerpc/86xx: Add MMC SPI support for MPC8610HPCD boards
From: Anton Vorontsov @ 2009-04-30 23:48 UTC (permalink / raw)
To: Kumar Gala
Cc: linuxppc-dev, Andrew Morton, David Brownell, linux-kernel,
spi-devel-general
In-Reply-To: <20090430234739.GA27709@oksana.dev.rtsoft.ru>
This patch adds spi and mmc-spi-slot nodes, plus a gpio-controller
for PIXIS' sdcsr bank that is used for managing SPI chip-select and
for reading card's states.
Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
---
arch/powerpc/boot/dts/mpc8610_hpcd.dts | 32 ++++++++++++++++++++++++++++
arch/powerpc/platforms/86xx/mpc8610_hpcd.c | 4 +++
2 files changed, 36 insertions(+), 0 deletions(-)
diff --git a/arch/powerpc/boot/dts/mpc8610_hpcd.dts b/arch/powerpc/boot/dts/mpc8610_hpcd.dts
index 1bd3ebe..dbb80f7 100644
--- a/arch/powerpc/boot/dts/mpc8610_hpcd.dts
+++ b/arch/powerpc/boot/dts/mpc8610_hpcd.dts
@@ -100,8 +100,18 @@
};
board-control@3,0 {
+ #address-cells = <1>;
+ #size-cells = <1>;
compatible = "fsl,fpga-pixis";
reg = <3 0 0x20>;
+ ranges = <0 3 0 0x20>;
+
+ sdcsr_pio: gpio-controller@a {
+ #gpio-cells = <2>;
+ compatible = "fsl,fpga-pixis-gpio-bank";
+ reg = <0xa 1>;
+ gpio-controller;
+ };
};
};
@@ -164,6 +174,28 @@
interrupt-parent = <&mpic>;
};
+ spi@7000 {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ compatible = "fsl,mpc8610-spi", "fsl,spi";
+ reg = <0x7000 0x40>;
+ cell-index = <0>;
+ interrupts = <59 2>;
+ interrupt-parent = <&mpic>;
+ mode = "cpu";
+ gpios = <&sdcsr_pio 7 0>;
+
+ mmc-slot@0 {
+ compatible = "fsl,mpc8610hpcd-mmc-slot",
+ "mmc-spi-slot";
+ reg = <0>;
+ gpios = <&sdcsr_pio 0 1 /* nCD */
+ &sdcsr_pio 1 0>; /* WP */
+ voltage-ranges = <3300 3300>;
+ spi-max-frequency = <50000000>;
+ };
+ };
+
display@2c000 {
compatible = "fsl,diu";
reg = <0x2c000 100>;
diff --git a/arch/powerpc/platforms/86xx/mpc8610_hpcd.c b/arch/powerpc/platforms/86xx/mpc8610_hpcd.c
index 3f49a6f..ce64572 100644
--- a/arch/powerpc/platforms/86xx/mpc8610_hpcd.c
+++ b/arch/powerpc/platforms/86xx/mpc8610_hpcd.c
@@ -38,6 +38,7 @@
#include <linux/of_platform.h>
#include <sysdev/fsl_pci.h>
#include <sysdev/fsl_soc.h>
+#include <sysdev/simple_gpio.h>
#include "mpc86xx.h"
@@ -52,6 +53,9 @@ static struct of_device_id __initdata mpc8610_ids[] = {
static int __init mpc8610_declare_of_platform_devices(void)
{
+ /* Firstly, register PIXIS GPIOs. */
+ simple_gpiochip_init("fsl,fpga-pixis-gpio-bank");
+
/* Without this call, the SSI device driver won't get probed. */
of_platform_bus_probe(NULL, mpc8610_ids, NULL);
--
1.6.2.2
^ permalink raw reply related
* [PATCH 3/9] spi_mpc83xx: Add small delay after asserting chip-select line
From: Anton Vorontsov @ 2009-04-30 23:48 UTC (permalink / raw)
To: Kumar Gala
Cc: linuxppc-dev, Andrew Morton, David Brownell, linux-kernel,
spi-devel-general
In-Reply-To: <20090430234739.GA27709@oksana.dev.rtsoft.ru>
This is needed for some underlaying GPIO controllers that may be
a bit slow, or if chip-select signal need some time to stabilize.
For what it's worth, we already have the similar delay for
chip-select de-assertion case.
Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
---
drivers/spi/spi_mpc83xx.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/drivers/spi/spi_mpc83xx.c b/drivers/spi/spi_mpc83xx.c
index 08b49d2..d378d5e 100644
--- a/drivers/spi/spi_mpc83xx.c
+++ b/drivers/spi/spi_mpc83xx.c
@@ -383,8 +383,10 @@ static void mpc83xx_spi_work(struct work_struct *work)
break;
}
- if (cs_change)
+ if (cs_change) {
mpc83xx_spi_chipselect(spi, BITBANG_CS_ACTIVE);
+ ndelay(nsecs);
+ }
cs_change = t->cs_change;
if (t->len)
status = mpc83xx_spi_bufs(spi, t);
--
1.6.2.2
^ permalink raw reply related
* [PATCH 2/9] spi_mpc83xx: Quieten down the "Requested speed is too low" message
From: Anton Vorontsov @ 2009-04-30 23:48 UTC (permalink / raw)
To: Kumar Gala
Cc: linuxppc-dev, Andrew Morton, David Brownell, linux-kernel,
spi-devel-general
In-Reply-To: <20090430234739.GA27709@oksana.dev.rtsoft.ru>
When a platform is running at high frequencies it's not always
possible to scale-down a frequency to a requested value, and using
mmc_spi driver this leads to the following printk flood during card
polling:
...
mmc_spi spi32766.0: Requested speed is too low: 400000 Hz. Will use
520828 Hz instead.
mmc_spi spi32766.0: Requested speed is too low: 400000 Hz. Will use
520828 Hz instead.
...
Fix this by using WARN_ONCE(), it's better than the flood, and also
better than turning dev_err() into dev_dbg(), since we actually want
to warn that some things may not work correctly.
Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
---
drivers/spi/spi_mpc83xx.c | 11 ++++++-----
1 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/drivers/spi/spi_mpc83xx.c b/drivers/spi/spi_mpc83xx.c
index f4573a9..08b49d2 100644
--- a/drivers/spi/spi_mpc83xx.c
+++ b/drivers/spi/spi_mpc83xx.c
@@ -14,6 +14,7 @@
#include <linux/init.h>
#include <linux/types.h>
#include <linux/kernel.h>
+#include <linux/bug.h>
#include <linux/errno.h>
#include <linux/err.h>
#include <linux/completion.h>
@@ -275,12 +276,12 @@ int mpc83xx_spi_setup_transfer(struct spi_device *spi, struct spi_transfer *t)
if ((mpc83xx_spi->spibrg / hz) > 64) {
cs->hw_mode |= SPMODE_DIV16;
pm = mpc83xx_spi->spibrg / (hz * 64);
- if (pm > 16) {
- dev_err(&spi->dev, "Requested speed is too "
- "low: %d Hz. Will use %d Hz instead.\n",
- hz, mpc83xx_spi->spibrg / 1024);
+
+ WARN_ONCE(pm > 16, "%s: Requested speed is too low: %d Hz. "
+ "Will use %d Hz instead.\n", dev_name(&spi->dev),
+ hz, mpc83xx_spi->spibrg / 1024);
+ if (pm > 16)
pm = 16;
- }
} else
pm = mpc83xx_spi->spibrg / (hz * 4);
if (pm)
--
1.6.2.2
^ permalink raw reply related
* [PATCH 1/9] spi_mpc83xx: Handles other Freescale processors
From: Anton Vorontsov @ 2009-04-30 23:48 UTC (permalink / raw)
To: Kumar Gala
Cc: linuxppc-dev, Andrew Morton, David Brownell, linux-kernel,
spi-devel-general
In-Reply-To: <20090430234739.GA27709@oksana.dev.rtsoft.ru>
With this patch we'll able to select spi_mpc83xx driver on the MPC86xx
platforms. Let the driver depend on FSL_SOC, so we don't have to worry
about Kconfig anymore.
Also remove the "experimental" dependency, the driver has been tested
to work on a various hardware, and surely not experimental anymore.
Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
---
drivers/spi/Kconfig | 14 ++++++--------
1 files changed, 6 insertions(+), 8 deletions(-)
diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig
index 83a185d..3c1845c 100644
--- a/drivers/spi/Kconfig
+++ b/drivers/spi/Kconfig
@@ -140,16 +140,14 @@ config SPI_MPC52xx_PSC
Controller in master SPI mode.
config SPI_MPC83xx
- tristate "Freescale MPC83xx/QUICC Engine SPI controller"
- depends on (PPC_83xx || QUICC_ENGINE) && EXPERIMENTAL
+ tristate "Freescale MPC8xxx SPI controller"
+ depends on FSL_SOC
help
- This enables using the Freescale MPC83xx and QUICC Engine SPI
- controllers in master mode.
+ This enables using the Freescale MPC8xxx SPI controllers in master
+ mode.
- Note, this driver uniquely supports the SPI controller on the MPC83xx
- family of PowerPC processors, plus processors with QUICC Engine
- technology. This driver uses a simple set of shift registers for data
- (opposed to the CPM based descriptor model).
+ This driver uses a simple set of shift registers for data (opposed
+ to the CPM based descriptor model).
config SPI_OMAP_UWIRE
tristate "OMAP1 MicroWire"
--
1.6.2.2
^ permalink raw reply related
* [PATCH 0/9] Some work for spi_mpc83xx driver, spi-mmc support for MPC8610HPCD
From: Anton Vorontsov @ 2009-04-30 23:47 UTC (permalink / raw)
To: Kumar Gala
Cc: linuxppc-dev, Andrew Morton, David Brownell, linux-kernel,
spi-devel-general
Hi all,
Here are few patches that are needed to support spi-mmc slot on
MPC8610HPCD PowerPC boards:
[1/9] spi_mpc83xx: Handles other Freescale processors
[2/9] spi_mpc83xx: Quieten down the "Requested speed is too low" message
[3/9] spi_mpc83xx: Add small delay after asserting chip-select line
[4/9] powerpc/86xx: Add MMC SPI support for MPC8610HPCD boards
The rest are cleanups, initially Kumar suggested to rename
spi_mpc83xx.c to spi_mpc8xxx.c, but checkpatch told me to fix
some other issues. So the following cleanups were prepared:
[5/9] spi_mpc83xx: Fix checkpatch issues
[6/9] spi_mpc83xx: Split mpc83xx_spi_work() into two routines
[7/9] spi_mpc83xx: Remove dead code
[8/9] spi_mpc83xx: Rename spi_83xx.c to spi_8xxx.c
[9/9] spi_mpc8xxx: s/83xx/8xxx/g
Thanks,
--
Anton Vorontsov
email: cbouatmailru@gmail.com
irc://irc.freenode.net/bd2
^ permalink raw reply
* Re: [PATCH] powerpc/pci: Move pseries code into pseries platform specific area
From: Michael Ellerman @ 2009-04-30 22:52 UTC (permalink / raw)
To: Kumar Gala; +Cc: linuxppc-dev, Paul Mackerras
In-Reply-To: <41163AE2-5EE9-4273-B2F2-373034AE4DC4@kernel.crashing.org>
[-- Attachment #1: Type: text/plain, Size: 1107 bytes --]
On Thu, 2009-04-30 at 10:35 -0500, Kumar Gala wrote:
> On Apr 30, 2009, at 9:49 AM, Michael Ellerman wrote:
>
> > On Thu, 2009-04-30 at 09:14 -0500, Kumar Gala wrote:
> >> There doesn't appear to be any specific reason that we need to
> >> setup the
> >> pseries specific notifier in generic arch pci code. Move it into
> >> pseries
> >> land.
> >
> > Yeah I guess. Although if some other platform ever wants to do PCI
> > hotplug it probably wants to call update_dn_pci_info() also.
>
> when that happens we can worry about, also the code I moved is pretty
> pseries specific (seeing as the event is called PSERIES_RECONFIG_ADD)
Yeah I agree.
> >> --- a/arch/powerpc/platforms/pseries/setup.c
> >> +++ b/arch/powerpc/platforms/pseries/setup.c
> >> @@ -254,6 +255,31 @@ static void __init pseries_discover_pic(void)
> >> " interrupt-controller\n");
> >> }
> >>
> >> +extern void * update_dn_pci_info(struct device_node *dn, void
> >> *data);
> >
> > Ahem :)
>
> Yeah, was being lazy. I'll move it into asm/pci-bridge.h
Please do :)
cheers
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply
* [PATCH] mpc52xx_psc_spi: Convert to cs_control callback
From: Anton Vorontsov @ 2009-04-30 22:31 UTC (permalink / raw)
To: Grant Likely
Cc: linuxppc-dev, Andrew Morton, David Brownell, spi-devel-general
mpc52xx_psc_spi driver is the last user of the legacy activate_cs
and deactivate_cs callbacks, so convert the driver to the cs_control
hook and remove the legacy callbacks from fsl_spi_platform_data
struct.
Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
---
drivers/spi/mpc52xx_psc_spi.c | 22 +++++++++-------------
include/linux/fsl_devices.h | 4 ----
2 files changed, 9 insertions(+), 17 deletions(-)
diff --git a/drivers/spi/mpc52xx_psc_spi.c b/drivers/spi/mpc52xx_psc_spi.c
index 68c77a9..e1901fd 100644
--- a/drivers/spi/mpc52xx_psc_spi.c
+++ b/drivers/spi/mpc52xx_psc_spi.c
@@ -13,6 +13,7 @@
#include <linux/module.h>
#include <linux/init.h>
+#include <linux/types.h>
#include <linux/errno.h>
#include <linux/interrupt.h>
#include <linux/of_platform.h>
@@ -30,8 +31,7 @@
struct mpc52xx_psc_spi {
/* fsl_spi_platform data */
- void (*activate_cs)(u8, u8);
- void (*deactivate_cs)(u8, u8);
+ void (*cs_control)(struct spi_device *spi, bool on);
u32 sysclk;
/* driver internal data */
@@ -111,18 +111,16 @@ static void mpc52xx_psc_spi_activate_cs(struct spi_device *spi)
out_be16((u16 __iomem *)&psc->ccr, ccr);
mps->bits_per_word = cs->bits_per_word;
- if (mps->activate_cs)
- mps->activate_cs(spi->chip_select,
- (spi->mode & SPI_CS_HIGH) ? 1 : 0);
+ if (mps->cs_control)
+ mps->cs_control(spi, (spi->mode & SPI_CS_HIGH) ? 1 : 0);
}
static void mpc52xx_psc_spi_deactivate_cs(struct spi_device *spi)
{
struct mpc52xx_psc_spi *mps = spi_master_get_devdata(spi->master);
- if (mps->deactivate_cs)
- mps->deactivate_cs(spi->chip_select,
- (spi->mode & SPI_CS_HIGH) ? 1 : 0);
+ if (mps->cs_control)
+ mps->cs_control(spi, (spi->mode & SPI_CS_HIGH) ? 0 : 1);
}
#define MPC52xx_PSC_BUFSIZE (MPC52xx_PSC_RFNUM_MASK + 1)
@@ -388,15 +386,13 @@ static int __init mpc52xx_psc_spi_do_probe(struct device *dev, u32 regaddr,
mps->irq = irq;
if (pdata == NULL) {
dev_warn(dev, "probe called without platform data, no "
- "(de)activate_cs function will be called\n");
- mps->activate_cs = NULL;
- mps->deactivate_cs = NULL;
+ "cs_control function will be called\n");
+ mps->cs_control = NULL;
mps->sysclk = 0;
master->bus_num = bus_num;
master->num_chipselect = 255;
} else {
- mps->activate_cs = pdata->activate_cs;
- mps->deactivate_cs = pdata->deactivate_cs;
+ mps->cs_control = pdata->cs_control;
mps->sysclk = pdata->sysclk;
master->bus_num = pdata->bus_num;
master->num_chipselect = pdata->max_chipselect;
diff --git a/include/linux/fsl_devices.h b/include/linux/fsl_devices.h
index 244677c..43fc95d 100644
--- a/include/linux/fsl_devices.h
+++ b/include/linux/fsl_devices.h
@@ -79,10 +79,6 @@ struct fsl_spi_platform_data {
u16 max_chipselect;
void (*cs_control)(struct spi_device *spi, bool on);
u32 sysclk;
-
- /* Legacy hooks, used by mpc52xx_psc_spi driver. */
- void (*activate_cs)(u8 cs, u8 polarity);
- void (*deactivate_cs)(u8 cs, u8 polarity);
};
struct mpc8xx_pcmcia_ops {
--
1.6.2.2
^ permalink raw reply related
* [PATCH] powerpc/fsl_soc: Remove mpc83xx_wdt_init, again
From: Anton Vorontsov @ 2009-04-30 22:27 UTC (permalink / raw)
To: Kumar Gala; +Cc: linuxppc-dev
commit b31a1d8b41513b96e9c7ec2f68c5734cef0b26a4 ("gianfar: Convert
gianfar to an of_platform_driver"), possibly due merge issues,
reintroduced completely unneded mpc83xx_wdt_init call, which
I removed some time ago in commit 20d38e01d48019c578ab0ec1464454c0
("powerpc/fsl_soc: remove mpc83xx_wdt code").
Remove it once again.
Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
---
arch/powerpc/sysdev/fsl_soc.c | 46 -----------------------------------------
1 files changed, 0 insertions(+), 46 deletions(-)
diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c
index afe8dbc..5c64ccd 100644
--- a/arch/powerpc/sysdev/fsl_soc.c
+++ b/arch/powerpc/sysdev/fsl_soc.c
@@ -208,52 +208,6 @@ static int __init of_add_fixed_phys(void)
arch_initcall(of_add_fixed_phys);
#endif /* CONFIG_FIXED_PHY */
-#ifdef CONFIG_PPC_83xx
-static int __init mpc83xx_wdt_init(void)
-{
- struct resource r;
- struct device_node *np;
- struct platform_device *dev;
- u32 freq = fsl_get_sys_freq();
- int ret;
-
- np = of_find_compatible_node(NULL, "watchdog", "mpc83xx_wdt");
-
- if (!np) {
- ret = -ENODEV;
- goto nodev;
- }
-
- memset(&r, 0, sizeof(r));
-
- ret = of_address_to_resource(np, 0, &r);
- if (ret)
- goto err;
-
- dev = platform_device_register_simple("mpc83xx_wdt", 0, &r, 1);
- if (IS_ERR(dev)) {
- ret = PTR_ERR(dev);
- goto err;
- }
-
- ret = platform_device_add_data(dev, &freq, sizeof(freq));
- if (ret)
- goto unreg;
-
- of_node_put(np);
- return 0;
-
-unreg:
- platform_device_unregister(dev);
-err:
- of_node_put(np);
-nodev:
- return ret;
-}
-
-arch_initcall(mpc83xx_wdt_init);
-#endif
-
static enum fsl_usb2_phy_modes determine_usb_phy(const char *phy_type)
{
if (!phy_type)
--
1.6.2.2
^ permalink raw reply related
* Re: Porting the ibm_newemac driver to use phylib (and other PHY/MAC questions)
From: Kyle Moffett @ 2009-04-30 22:21 UTC (permalink / raw)
To: Benjamin Herrenschmidt
Cc: netdev, Linux-Kernel@Vger. Kernel. Org, linuxppc-dev
In-Reply-To: <1241126291.29501.41.camel@pasglop>
On Thu, Apr 30, 2009 at 5:18 PM, Benjamin Herrenschmidt
<benh@kernel.crashing.org> wrote:
> Well... GPCS is indeed some kind of internal PHY if you like but it's
> not MDIO controlled and I don't really see a need to move it to the
> phylib as it's so specific to the NIC itself. But if you think it cleans
> the code up significantly... There are also some subtle differences in
> how the NIC is programmed when using GPCS vs. xMII
Ok, thanks, that's helpful information. Mainly I was trying to puzzle
out why the driver sometimes resets the GPCS and other times resets
the real PHY. It seems to be rather inconsistent when it resets
different devices. For instance, one of the Marvell PHY's init()
helper resets the PHY, which was getting in the way of me ensuring
that the init() helpers are called after every PHY reset (because I
need to reinitialize the state that just got erased by the reset).
The challenge is working out which of the implicit ordering is
required for correct operation and which is simply an artifact of the
current implementation.
>> I'm also curious about the intent of the "mdio_instance" pointer (IE:
>> the "mdio-device" property). =C2=A0Is that used when all the PHY devices
>> are attached to the MDIO bus of only one of the (multiple) emac
>> devices?
>
> It's common especially on older SoCs using EMAC to have only one of
> the EMAC instance with an MDIO bus for configuring the PHYs. This is one
> of the reasons why I have the mutex in the low level MDIO access
> routines since 2 EMACs can try to talk to the same MDIO, and this is the
> problem I had with phylib back then which was doing everything in atomic
> contexts.
Ok, good, the current mdiobus code seems to make handling this a good
deal easier.
>> What keeps the emac_instance pointed
>> to by the "mdio_instance" from going away while the other emac chipset
>> is using it?
>
> Nothing other than those are all in a SoC and so generally don't do
> hotplug, but I suppose that with things like kvm which could potentially
> hotplug devices between partitions, one would have to get a bit more
> careful.
Yeah, I was experimenting with fiddling with the bind/unbind files in
sysfs and determined that the device-removal code is completely
broken. As far as I can tell, any attempts to unregister one of the
emac devices cause an OOPS, even if it isn't used by another emac for
MDIO. I may just start by nuking the broken device-removal code
entirely, and re-implement it properly once the rework is done.
Thanks for the info!
Cheers,
Kyle Moffett
^ permalink raw reply
* Re: [BUG] 2.6.30-rc3: BUG triggered on some hugepage usages
From: Benjamin Herrenschmidt @ 2009-04-30 21:48 UTC (permalink / raw)
To: Mel Gorman; +Cc: linuxppc-dev, Linus Torvalds, Linux Kernel Mailing List
In-Reply-To: <20090430205919.GA24279@csn.ul.ie>
On Thu, 2009-04-30 at 21:59 +0100, Mel Gorman wrote:
> This patch fixes the problem by not asseting the PTE is locked for VMAs
> backed by huge pages.
Thanks, will apply.
Cheers,
Ben.
> Signed-off-by: Mel Gorman <mel@csn.ul.ie>
> ---
> arch/powerpc/mm/pgtable.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/arch/powerpc/mm/pgtable.c b/arch/powerpc/mm/pgtable.c
> index f5c6fd4..ae1d67c 100644
> --- a/arch/powerpc/mm/pgtable.c
> +++ b/arch/powerpc/mm/pgtable.c
> @@ -219,7 +219,8 @@ int ptep_set_access_flags(struct vm_area_struct *vma, unsigned long address,
> entry = do_dcache_icache_coherency(entry);
> changed = !pte_same(*(ptep), entry);
> if (changed) {
> - assert_pte_locked(vma->vm_mm, address);
> + if (!(vma->vm_flags & VM_HUGETLB))
> + assert_pte_locked(vma->vm_mm, address);
> __ptep_set_access_flags(ptep, entry);
> flush_tlb_page_nohash(vma, address);
> }
^ permalink raw reply
* Re: [RFC][PATCH] add support to ppc32 to "use" pci_dn
From: Benjamin Herrenschmidt @ 2009-04-30 21:44 UTC (permalink / raw)
To: Kumar Gala; +Cc: linuxppc-dev
In-Reply-To: <Pine.LNX.4.64.0904301604540.25174@localhost.localdomain>
On Thu, 2009-04-30 at 16:07 -0500, Kumar Gala wrote:
> Ben,
>
> This is my cut at unifying a bit of the ppc32 & ppc64 code. I don't
> specifically intend to use all the OF bits on ppc32, but getting some of
> the structures the same so the non-OF related foo can be common is my
> goal.
>
> This was all about trying to get pci_bus_to_hose() to be common.
I think a pre-req is to update the pci_dn code to use a similar
technique to ppc32 for linking the device nodes to the pci_dev's
(ie, walking level by level and only using the devfn and not the bus
number to go down in order to be agnostic to bus renumbering).
That way, you can completely switch over ppc32 to pci_dn incuding
pci_device_to_OF_node() etc... in one go.
Cheers,
Ben.
^ permalink raw reply
* Re: Porting the ibm_newemac driver to use phylib (and other PHY/MAC questions)
From: Benjamin Herrenschmidt @ 2009-04-30 21:18 UTC (permalink / raw)
To: Kyle Moffett; +Cc: netdev, Linux-Kernel@Vger. Kernel. Org, linuxppc-dev
In-Reply-To: <f73f7ab80904300804j1f847b70ha0fe3cda07249110@mail.gmail.com>
> Ok, I've made some progress in the port, but right now I'm trying to
> puzzle out what the "gpcs" bits in the code are. From the few
> publicly available docs and some mailing list posts, the gpcs address
> appears to be some kind of integrated virtual PHY used when 460GT-ish
> chips are communicating via an SGMII bus. My current plan of action
> is to separate the "gpcs" out into a separate PHY device controlled by
> the emac code.
Well... GPCS is indeed some kind of internal PHY if you like but it's
not MDIO controlled and I don't really see a need to move it to the
phylib as it's so specific to the NIC itself. But if you think it cleans
the code up significantly... There are also some subtle differences in
how the NIC is programmed when using GPCS vs. xMII
> I'm also curious about the intent of the "mdio_instance" pointer (IE:
> the "mdio-device" property). Is that used when all the PHY devices
> are attached to the MDIO bus of only one of the (multiple) emac
> devices?
It's common especially on older SoCs using EMAC to have only one of
the EMAC instance with an MDIO bus for configuring the PHYs. This is one
of the reasons why I have the mutex in the low level MDIO access
routines since 2 EMACs can try to talk to the same MDIO, and this is the
problem I had with phylib back then which was doing everything in atomic
contexts.
> What keeps the emac_instance pointed
> to by the "mdio_instance" from going away while the other emac chipset
> is using it?
Nothing other than those are all in a SoC and so generally don't do
hotplug, but I suppose that with things like kvm which could potentially
hotplug devices between partitions, one would have to get a bit more
careful.
> In either case, I plan to have the device actually holding the MDIO
> bus run the mdiobus_alloc() and mdiobus_register() functions, then the
> other emac instance will simply take a reference to that MDIO bus
> (which would also pin down the emac instance that owns it).
Sounds good at first.
Cheers,
Ben.
^ permalink raw reply
* Re: why does ppc64 require boards to call pci_devs_phb_init()?
From: Benjamin Herrenschmidt @ 2009-04-30 21:09 UTC (permalink / raw)
To: Kumar Gala; +Cc: Linuxppc-dev Development
In-Reply-To: <547963B5-28FB-4075-B39A-C99B28554E3F@kernel.crashing.org>
On Thu, 2009-04-30 at 13:04 -0500, Kumar Gala wrote:
> On Apr 30, 2009, at 10:37 AM, Kumar Gala wrote:
>
> > looking at merging this in w/ppc32 and wondering why board code has
> > to call pci_devs_phb_init() and not do it via pcibios_init()
> >
> > - k
>
> As I look at this a bit more, I'm thinking why don't we do:
>
> pci_devs_phb_init_dynamic() in pcibios_alloc_controller
>
> An add some code into pci_devs_phb_init_dynamic so we don't re-do
> update_dn_pci_info if dn->data is already set.
>
> I am not sure what impact this has ppc64 systems that call
> pci_devs_phb_init()
That would probably work, remains the reconfig notifier thing but that
can probably be moved to pseries platform.
Cheers,
Ben.
^ permalink raw reply
* Re: why does ppc64 require boards to call pci_devs_phb_init()?
From: Benjamin Herrenschmidt @ 2009-04-30 21:08 UTC (permalink / raw)
To: Kumar Gala; +Cc: Linuxppc-dev Development
In-Reply-To: <33403DE1-6AC2-49E9-9539-C520E4944D77@kernel.crashing.org>
On Thu, 2009-04-30 at 10:37 -0500, Kumar Gala wrote:
> looking at merging this in w/ppc32 and wondering why board code has to
> call pci_devs_phb_init() and not do it via pcibios_init()
As I said on IRC, not too sure at the moment, it could be due to some
ordering issues where pSeries needs the pci_dn's to be there before
pcibios_init(). We'll have to dig a bit on that one.
Cheers,
Ben.
^ permalink raw reply
* [RFC][PATCH] add support to ppc32 to "use" pci_dn
From: Kumar Gala @ 2009-04-30 21:07 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: linuxppc-dev
Ben,
This is my cut at unifying a bit of the ppc32 & ppc64 code. I don't
specifically intend to use all the OF bits on ppc32, but getting some of
the structures the same so the non-OF related foo can be common is my
goal.
This was all about trying to get pci_bus_to_hose() to be common.
- k
diff --git a/arch/powerpc/include/asm/pci-bridge.h b/arch/powerpc/include/asm/pci-bridge.h
index 84007af..6b523b9 100644
--- a/arch/powerpc/include/asm/pci-bridge.h
+++ b/arch/powerpc/include/asm/pci-bridge.h
@@ -149,13 +149,52 @@ struct pci_controller {
#endif /* CONFIG_PPC64 */
};
-#ifndef CONFIG_PPC64
+/*
+ * PCI stuff, for nodes representing PCI devices, pointed to
+ * by device_node->data.
+ */
+struct iommu_table;
+
+struct pci_dn {
+ int busno; /* pci bus number */
+ int devfn; /* pci device and function number */
+
+ struct pci_controller *phb; /* for pci devices */
+ struct iommu_table *iommu_table; /* for phb's or bridges */
+ struct device_node *node; /* back-pointer to the device_node */
+
+ int pci_ext_config_space; /* for pci devices */
+
+#ifdef CONFIG_EEH
+ struct pci_dev *pcidev; /* back-pointer to the pci device */
+ int class_code; /* pci device class */
+ int eeh_mode; /* See eeh.h for possible EEH_MODEs */
+ int eeh_config_addr;
+ int eeh_pe_config_addr; /* new-style partition endpoint address */
+ int eeh_check_count; /* # times driver ignored error */
+ int eeh_freeze_count; /* # times this device froze up. */
+ int eeh_false_positives; /* # times this device reported #ff's */
+ u32 config_space[16]; /* saved PCI config space */
+#endif
+};
+
+/* Get the pointer to a device_node's pci_dn */
+#define PCI_DN(dn) ((struct pci_dn *) (dn)->data)
+
+extern struct device_node *fetch_dev_dn(struct pci_dev *dev);
static inline struct pci_controller *pci_bus_to_host(const struct pci_bus *bus)
{
- return bus->sysdata;
+ struct device_node *busdn = bus->sysdata;
+
+ BUG_ON(busdn == NULL);
+ return PCI_DN(busdn)->phb;
}
+
+
+#ifndef CONFIG_PPC64
+
static inline int isa_vaddr_is_ioport(void __iomem *address)
{
/* No specific ISA handling on ppc32 at this stage, it
@@ -188,40 +227,6 @@ extern void setup_indirect_pci(struct pci_controller* hose,
extern void setup_grackle(struct pci_controller *hose);
#else /* CONFIG_PPC64 */
-/*
- * PCI stuff, for nodes representing PCI devices, pointed to
- * by device_node->data.
- */
-struct iommu_table;
-
-struct pci_dn {
- int busno; /* pci bus number */
- int devfn; /* pci device and function number */
-
- struct pci_controller *phb; /* for pci devices */
- struct iommu_table *iommu_table; /* for phb's or bridges */
- struct device_node *node; /* back-pointer to the device_node */
-
- int pci_ext_config_space; /* for pci devices */
-
-#ifdef CONFIG_EEH
- struct pci_dev *pcidev; /* back-pointer to the pci device */
- int class_code; /* pci device class */
- int eeh_mode; /* See eeh.h for possible EEH_MODEs */
- int eeh_config_addr;
- int eeh_pe_config_addr; /* new-style partition endpoint address */
- int eeh_check_count; /* # times driver ignored error */
- int eeh_freeze_count; /* # times this device froze up. */
- int eeh_false_positives; /* # times this device reported #ff's */
- u32 config_space[16]; /* saved PCI config space */
-#endif
-};
-
-/* Get the pointer to a device_node's pci_dn */
-#define PCI_DN(dn) ((struct pci_dn *) (dn)->data)
-
-extern struct device_node *fetch_dev_dn(struct pci_dev *dev);
-
/* Get a device_node from a pci_dev. This code must be fast except
* in the case where the sysdata is incorrect and needs to be fixed
* up (this will only happen once).
@@ -266,15 +271,6 @@ extern void pcibios_remove_pci_devices(struct pci_bus *bus);
/** Discover new pci devices under this bus, and add them */
extern void pcibios_add_pci_devices(struct pci_bus *bus);
-static inline struct pci_controller *pci_bus_to_host(const struct pci_bus *bus)
-{
- struct device_node *busdn = bus->sysdata;
-
- BUG_ON(busdn == NULL);
- return PCI_DN(busdn)->phb;
-}
-
-
extern void isa_bridge_find_early(struct pci_controller *hose);
static inline int isa_vaddr_is_ioport(void __iomem *address)
diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile
index 71901fb..eaddfd3 100644
--- a/arch/powerpc/kernel/Makefile
+++ b/arch/powerpc/kernel/Makefile
@@ -83,9 +83,9 @@ obj-$(CONFIG_KPROBES) += kprobes.o
obj-$(CONFIG_PPC_UDBG_16550) += legacy_serial.o udbg_16550.o
obj-$(CONFIG_STACKTRACE) += stacktrace.o
-pci64-$(CONFIG_PPC64) += pci_dn.o isa-bridge.o
+pci64-$(CONFIG_PPC64) += isa-bridge.o
obj-$(CONFIG_PCI) += pci_$(CONFIG_WORD_SIZE).o $(pci64-y) \
- pci-common.o
+ pci-common.o pci_dn.o
obj-$(CONFIG_PCI_MSI) += msi.o
obj-$(CONFIG_KEXEC) += machine_kexec.o crash.o \
machine_kexec_$(CONFIG_WORD_SIZE).o
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index 9c69e7e..3f2e6fa 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -91,6 +91,7 @@ struct pci_controller *pcibios_alloc_controller(struct device_node *dev)
spin_unlock(&hose_spinlock);
phb->dn = dev;
phb->is_dynamic = mem_init_done;
+ pci_devs_phb_init_dynamic(phb);
#ifdef CONFIG_PPC64
if (dev) {
int nid = of_node_to_nid(dev);
diff --git a/arch/powerpc/kernel/pci_32.c b/arch/powerpc/kernel/pci_32.c
index d473634..09eb7b6 100644
--- a/arch/powerpc/kernel/pci_32.c
+++ b/arch/powerpc/kernel/pci_32.c
@@ -385,7 +385,7 @@ static void __devinit pcibios_scan_phb(struct pci_controller *hose)
node ? node->full_name : "<NO NAME>");
/* Create an empty bus for the toplevel */
- bus = pci_create_bus(hose->parent, hose->first_busno, hose->ops, hose);
+ bus = pci_create_bus(hose->parent, hose->first_busno, hose->ops, node);
if (bus == NULL) {
printk(KERN_ERR "Failed to create bus for PCI domain %04x\n",
hose->global_number);
@@ -543,7 +543,7 @@ fake_pci_bus(struct pci_controller *hose, int busnr)
printk(KERN_ERR "Can't find hose for PCI bus %d!\n", busnr);
}
bus.number = busnr;
- bus.sysdata = hose;
+ bus.sysdata = hose->dn;
bus.ops = hose? hose->ops: &null_pci_ops;
return &bus;
}
diff --git a/arch/powerpc/kernel/pci_dn.c b/arch/powerpc/kernel/pci_dn.c
index d5e36e5..224406e 100644
--- a/arch/powerpc/kernel/pci_dn.c
+++ b/arch/powerpc/kernel/pci_dn.c
@@ -131,11 +131,13 @@ void __devinit pci_devs_phb_init_dynamic(struct pci_controller *phb)
struct pci_dn *pdn;
/* PHB nodes themselves must not match */
- update_dn_pci_info(dn, phb);
- pdn = dn->data;
- if (pdn) {
- pdn->devfn = pdn->busno = -1;
- pdn->phb = phb;
+ if (!dn->data) {
+ update_dn_pci_info(dn, phb);
+ pdn = dn->data;
+ if (pdn) {
+ pdn->devfn = pdn->busno = -1;
+ pdn->phb = phb;
+ }
}
/* Update dn->phb ptrs for new phb and children devices */
^ permalink raw reply related
* Re: [BUG] 2.6.30-rc3: BUG triggered on some hugepage usages
From: Mel Gorman @ 2009-04-30 20:59 UTC (permalink / raw)
To: Michael Ellerman; +Cc: linuxppc-dev, Linus Torvalds, Linux Kernel Mailing List
In-Reply-To: <1240586690.12551.31.camel@localhost>
On Sat, Apr 25, 2009 at 01:24:50AM +1000, Michael Ellerman wrote:
> On Fri, 2009-04-24 at 10:51 +0100, Mel Gorman wrote:
> > On Tue, Apr 21, 2009 at 08:27:57PM -0700, Linus Torvalds wrote:
> > > Another week, another -rc.
> > >
> >
> > I'm seeing some tests with sysbench+postgres+large pages fail on ppc64
> > although a very clear pattern is not forming as to what exactly is
> > causing it. However, the libhugetlbfs regression tests (make && make
> > func) are triggering the following oops when calling mlock() and so are
> > likely related.
> >
> > ------------[ cut here ]------------
> > kernel BUG at arch/powerpc/mm/pgtable.c:243!
> > Oops: Exception in kernel mode, sig: 5 [#1]
> > SMP NR_CPUS=128 NUMA pSeries
> > Modules linked in: dm_snapshot dm_mirror dm_region_hash dm_log qla2xxx
> > loop nfnetlink iptable_filter iptable_nat nf_nat ip_tables
> > nf_conntrack_ipv4 nf_defrag_ipv4 xt_state nf_conntrack ipt_REJECT
> > xt_tcpudp xt_limit ipt_LOG xt_pkttype x_tables
> > NIP: c00000000002becc LR: c00000000002c02c CTR: 0000000000000000
> > REGS: c0000000ea92b4c0 TRAP: 0700 Not tainted (2.6.30-rc3-autokern1)
> > MSR: 8000000000029032 <EE,ME,CE,IR,DR> CR: 28000484 XER: 20000020
> > TASK = c00000000395b660[7611] 'mlock' THREAD: c0000000ea928000 CPU: 3
> > GPR00: 0000000000000001 c0000000ea92b740 c0000000008ea170 c0000000ec7d4980
> > GPR04: 000000003f000000 c0000001e2278cf8 0000001900000393 0000000000000001
> > GPR08: f000000002bc0000 0000000000000000 0000000000000113 c0000001e2278c81
> > GPR12: 0000000044000482 c00000000093b880 0000000028004422 0000000000000000
> > GPR16: c0000000ea92bbf0 c0000000009f06f0 0000001900000113 c0000000ec7d4980
> > GPR20: 0000000000000000 f000000002bc0000 000000003f000000 c0000001e2278cf8
> > GPR24: c0000000eaa90bb0 0000000000000000 c0000000eaa90bb0 c0000000ea928000
> > GPR28: f000000002bc0000 0000001900000393 0000000000000001 c0000001e2278cf8
> > NIP [c00000000002becc] .assert_pte_locked+0x54/0x8c
> > LR [c00000000002c02c] .ptep_set_access_flags+0x50/0x8c
> > Call Trace:
> > [c0000000ea92b740] [c0000000eaa90bb0] 0xc0000000eaa90bb0 (unreliable)
> > [c0000000ea92b7d0] [c0000000000ed1b0] .hugetlb_cow+0xd4/0x654
> > [c0000000ea92b900] [c0000000000edbf0] .hugetlb_fault+0x4c0/0x708
> > [c0000000ea92b9f0] [c0000000000ee890] .follow_hugetlb_page+0x174/0x364
> > [c0000000ea92bae0] [c0000000000d8d30] .__get_user_pages+0x288/0x4c0
> > [c0000000ea92bbb0] [c0000000000da10c] .make_pages_present+0xa0/0xe0
> > [c0000000ea92bc40] [c0000000000db758] .mlock_fixup+0x90/0x228
> > [c0000000ea92bd00] [c0000000000dbb38] .do_mlock+0xc4/0x128
> > [c0000000ea92bda0] [c0000000000dbccc] .SyS_mlock+0xb0/0xec
> > [c0000000ea92be30] [c00000000000852c] syscall_exit+0x0/0x40
> > Instruction dump:
> > 0b000000 78892662 79291f24 7d69582a 7d600074 7800d182 0b000000 78895e62
> > 79291f24 7d29582a 7d200074 7800d182 <0b000000> 3c004000 3960ffff
> > 780007c6
> > ---[ end trace 36a7faa04fa9452b ]---
> >
> > This corresponds to
> >
> > #ifdef CONFIG_DEBUG_VM
> > void assert_pte_locked(struct mm_struct *mm, unsigned long addr)
> > {
> > pgd_t *pgd;
> > pud_t *pud;
> > pmd_t *pmd;
> >
> > if (mm == &init_mm)
> > return;
> > pgd = mm->pgd + pgd_index(addr);
> > BUG_ON(pgd_none(*pgd));
> > pud = pud_offset(pgd, addr);
> > BUG_ON(pud_none(*pud));
> > pmd = pmd_offset(pud, addr);
> > BUG_ON(!pmd_present(*pmd)); <----- THIS LINE
> > BUG_ON(!spin_is_locked(pte_lockptr(mm, pmd)));
> > }
> > #endif /* CONFIG_DEBUG_VM */
> >
> > This area was last changed by commit 8d30c14cab30d405a05f2aaceda1e9ad57800f36
> > in the 2.6.30-rc1 timeframe. I think there was another hugepage-related
> > problem with this patch but I can't remember what it was.
>
> It broke modules, but I don't remember anything hugepage related.
>
> So the code changed from:
>
> -#define ptep_set_access_flags(__vma, __address, __ptep, __entry, __dirty) \
> -({ \
> - int __changed = !pte_same(*(__ptep), __entry); \
> - if (__changed) { \
> - __ptep_set_access_flags(__ptep, __entry, __dirty); \
> - flush_tlb_page_nohash(__vma, __address); \
> - } \
> - __changed; \
> -})
>
> to:
>
> +int ptep_set_access_flags(struct vm_area_struct *vma, unsigned long address,
> + pte_t *ptep, pte_t entry, int dirty)
> +{
> + int changed;
> + if (!dirty && pte_need_exec_flush(entry, 0))
> + entry = do_dcache_icache_coherency(entry);
> + changed = !pte_same(*(ptep), entry);
> + if (changed) {
> + assert_pte_locked(vma->vm_mm, address);
> + __ptep_set_access_flags(ptep, entry);
> + flush_tlb_page_nohash(vma, address);
> + }
> + return changed;
> +}
>
> So the call to assert_pte_locked() is new. And it's never going to work
> for huge pages, the page table structure is different right?
Right
> Notice
> pte_update() checks (arch/powerpc/include/asm/pgtable-ppc64.h):
>
> 198 /* huge pages use the old page table lock */
> 199 if (!huge)
> 200 assert_pte_locked(mm, addr);
>
> But unlike pte_update() ptep_set_access_flags() has no way of knowing
> it's been called from huge_ptep_set_access_flags().
>
It does because it has the VMA. This patch fixes the problem for me. If it
looks ok, I'll resend to Paul Mackerras for the powerpc tree.
As Ben says, it doesn't explain the functional difficulties I had in
sysbench+postgres so I'll reinvestigate that.
==== CUT HERE ====
powerpc: Do not assert pte_locked for hugepage PTE entries
With CONFIG_DEBUG_VM, an assertion is made when changing the protection
flags of a PTE that the PTE is locked. Huge pages use a different pagetable
format and the assertion is bogus and will always trigger with a bug looking
something like
Unable to handle kernel paging request for data at address 0xf1a00235800006f8
Faulting instruction address: 0xc000000000034a80
Oops: Kernel access of bad area, sig: 11 [#1]
SMP NR_CPUS=32 NUMA Maple
Modules linked in: dm_snapshot dm_mirror dm_region_hash
dm_log dm_mod loop evdev ext3 jbd mbcache sg sd_mod ide_pci_generic
pata_amd ata_generic ipr libata tg3 libphy scsi_mod windfarm_pid
windfarm_smu_sat windfarm_max6690_sensor windfarm_lm75_sensor
windfarm_cpufreq_clamp windfarm_core i2c_powermac
NIP: c000000000034a80 LR: c000000000034b18 CTR: 0000000000000003
REGS: c000000003037600 TRAP: 0300 Not tainted (2.6.30-rc3-autokern1)
MSR: 9000000000009032 <EE,ME,IR,DR> CR: 28002484 XER: 200fffff
DAR: f1a00235800006f8, DSISR: 0000000040010000
TASK = c0000002e54cc740[2960] 'map_high_trunca' THREAD: c000000003034000 CPU: 2
GPR00: 4000000000000000 c000000003037880 c000000000895d30 c0000002e5a2e500
GPR04: 00000000a0000000 c0000002edc40880 0000005700000393 0000000000000001
GPR08: f000000011ac0000 01a00235800006e8 00000000000000f5 f1a00235800006e8
GPR12: 0000000028000484 c0000000008dd780 0000000000001000 0000000000000000
GPR16: fffffffffffff000 0000000000000000 00000000a0000000 c000000003037a20
GPR20: c0000002e5f4ece8 0000000000001000 c0000002edc40880 0000000000000000
GPR24: c0000002e5f4ece8 0000000000000000 00000000a0000000 c0000002e5f4ece8
GPR28: 0000005700000393 c0000002e5a2e500 00000000a0000000 c000000003037880
NIP [c000000000034a80] .assert_pte_locked+0xa4/0xd0
LR [c000000000034b18] .ptep_set_access_flags+0x6c/0xb4
Call Trace:
[c000000003037880] [c000000003037990] 0xc000000003037990 (unreliable)
[c000000003037910] [c000000000034b18] .ptep_set_access_flags+0x6c/0xb4
[c0000000030379b0] [c00000000014bef8] .hugetlb_cow+0x124/0x674
[c000000003037b00] [c00000000014c930] .hugetlb_fault+0x4e8/0x6f8
[c000000003037c00] [c00000000013443c] .handle_mm_fault+0xac/0x828
[c000000003037cf0] [c0000000000340a8] .do_page_fault+0x39c/0x584
[c000000003037e30] [c0000000000057b0] handle_page_fault+0x20/0x5c
Instruction dump:
7d29582a 7d200074 7800d182 0b000000 3c004000 3960ffff 780007c6 796b00c4
7d290214 7929a302 1d290068 7d6b4a14 <800b0010> 7c000074 7800d182 0b000000
This patch fixes the problem by not asseting the PTE is locked for VMAs
backed by huge pages.
Signed-off-by: Mel Gorman <mel@csn.ul.ie>
---
arch/powerpc/mm/pgtable.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/powerpc/mm/pgtable.c b/arch/powerpc/mm/pgtable.c
index f5c6fd4..ae1d67c 100644
--- a/arch/powerpc/mm/pgtable.c
+++ b/arch/powerpc/mm/pgtable.c
@@ -219,7 +219,8 @@ int ptep_set_access_flags(struct vm_area_struct *vma, unsigned long address,
entry = do_dcache_icache_coherency(entry);
changed = !pte_same(*(ptep), entry);
if (changed) {
- assert_pte_locked(vma->vm_mm, address);
+ if (!(vma->vm_flags & VM_HUGETLB))
+ assert_pte_locked(vma->vm_mm, address);
__ptep_set_access_flags(ptep, entry);
flush_tlb_page_nohash(vma, address);
}
^ permalink raw reply related
* Re: [PATCH 3/3] powerpc/86xx: Add MMC SPI support for MPC8610HPCD boards
From: Anton Vorontsov @ 2009-04-30 20:51 UTC (permalink / raw)
To: H. Peter Anvin; +Cc: linuxppc-dev, Andrew Morton, David Brownell, linux-kernel
In-Reply-To: <49D7FD94.2040001@zytor.com>
Sorry for the late response,
On Sat, Apr 04, 2009 at 05:38:44PM -0700, H. Peter Anvin wrote:
> Anton Vorontsov wrote:
> > This patch adds spi and mmc-spi-slot nodes, plus a gpio-controller
> > for PIXIS' sdcsr bank that is used for managing SPI chip-select and
> > for reading card's states.
> >
> > Note that spi-max-frequency is lowered since at high frequencies SD
> > cards don't work reliably (there is some problem with the chip select
> > line, it's probably quite slow because it's routed via PIXIS).
> >
> > Previously there was a work around: we didn't use chip-select line
> > at all, but some cards don't like that, so we'd better use the low
> > frequency.
> >
> > Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
>
> I have to admit being somewhat confused. The CS# line is pulled low and
> stays low for the duration of a command, so it shouldn't affect the SPI
> frequency, only the delay between commands.
Yes. Regarding delay between commands, inserting a 50 ns delay after
asserting CS makes the things work, so proves that PIXIS GPIO lines
are a bit slow and that causes SD malfunctions.
> You're saying "some cards don't like not using the CS# line" ... in
> particular, I know there are hardware devices which toggle the clock at
> low frequency (< 400 kHz) for a while (I think the minimum is 88 clocks
> or so) and then permanently assert the CS# line
Yes, but before that, CS should be de-asserted, otherwise things
won't work, like this:
mmc_spi spi32766.0: mmc_spi: power up (21)
mmc0: clock 400000Hz busmode 2 powermode 2 cs 1 Vdd 21 width 0 timing 0
mmc_spi spi32766.0: mmc_spi: power on (21)
mmc0: starting CMD0 arg 00000000 flags 000000c0
mmc_spi spi32766.0: mmc_spi: CMD0, resp R1
mmc0: req done (CMD0): 0: 00000001 00000000 00000000 00000000
mmc0: starting CMD8 arg 000001aa flags 000002f5
mmc_spi spi32766.0: mmc_spi: CMD8, resp R3/R4/R7
mmc_spi spi32766.0: ... CMD8 response SPI_R3/R4/R: resp 0017 ffffffff
mmc0: req done (CMD8): -22: 00000017 ffffffff 00000000 00000000
mmc0: starting CMD5 arg 00000000 flags 000002e1
mmc_spi spi32766.0: mmc_spi: CMD5, resp R3/R4/R7
mmc_spi spi32766.0: ... CMD5 response SPI_R3/R4/R: resp 0017 ffffffff
mmc0: req done (CMD5): -22: 00000017 ffffffff 00000000 00000000
mmc0: starting CMD55 arg 00000000 flags 000000f5
mmc_spi spi32766.0: mmc_spi: CMD55, resp R1
mmc_spi spi32766.0: ... CMD55 response SPI_R1: resp 0007 00000000
So we can't just assert the CS line, inserte SD card and expect
to work.
> before giving the
> starting CMD0. Even so, the CMD0 is supposed to be sent at < 400 kHz
> since the card will still be in open drain mode at that point.
> Does that disagree with your observations? If so, I'd be really
> interested to find out what you have seen in more detail, as it adds to
> the understanding of MMC/SD cards in the field.
With CS toggling enabled and without 50 ns delay after CS
assertion, everything is fine until we switch to high frequency:
mmc0: clock 25000000Hz busmode 2 powermode 2 cs 1 Vdd 20 width 0 timing 0
mmc_spi spi32766.0: mmc_spi: clock to 25000000 Hz, 0
mmc0: new SD card on SPI
mmc0: starting CMD16 arg 00000200 flags 00000095
mmc_spi spi32766.0: mmc_spi: CMD16, resp R1
mmc0: req done (CMD16): 0: 00000000 00000000 00000000 00000000
mmcblk0: mmc0:0000 SD01G 982 MiB
mmcblk0:<7>mmc0: starting CMD18 arg 00000000 flags 000000b5
mmc0: blksz 512 blocks 8 flags 00000200 tsac 100 ms nsac 0
mmc0: CMD12 arg 00000000 flags 0000049d
mmc_spi spi32766.0: mmc_spi: CMD18, resp R1
mmc_spi spi32766.0: mmc_spi: read block, 512 bytes
mmc_spi spi32766.0: mmc_spi: read block, 512 bytes
mmc_spi spi32766.0: read - crc error: crc_val=0x00ff, computed=0x0000 len=512
mmc_spi spi32766.0: read status -84
mmc_spi spi32766.0: mmc_spi: CMD12, resp R1B
Thanks,
--
Anton Vorontsov
email: cbouatmailru@gmail.com
irc://irc.freenode.net/bd2
^ permalink raw reply
* [PATCH v2 0/6] macros for section name cleanup
From: Tim Abbott @ 2009-04-30 19:54 UTC (permalink / raw)
To: Sam Ravnborg
Cc: linux-mips, linux-m68k, linux-ia64, linux-sh, Denys Vlasenko,
Greg Ungerer, Jeff Arnold, linuxppc-dev, Paul Mackerras,
H. Peter Anvin, sparclinux, Waseem Daher, linux-s390,
Jesper Nilsson, Yoshinori Sato, Helge Deller, Ingo Molnar,
Geert Uytterhoeven, microblaze-uclinux, Russell King,
user-mode-linux-devel, Heiko Carstens, Jeff Dike, dev-etrax,
Mikael Starvik, Tim Abbott, Cyrill Gorcunov, Michal Simek,
Richard Henderson, Chris Zankel, Bryan Wu, Tony Luck,
linux-parisc, Haavard Skinnemoen, Hirokazu Takata,
Linux kernel mailing list, Ralf Baechle, Anders Kaseorg,
Kyle McMartin, Paul Mundt, Thomas Gleixner, linux-alpha,
Martin Schwidefsky, uclinux-dist-devel, Linus Torvalds,
David S. Miller
(this patch series differs from v1 only in the CC list; some of the
architecture lists I sent the previous one to are moderated against
non-members; all replies should go to this version).
Here are the architecture-independent macro definitions needed for
to clean up the kernel's section names. The overall diffstat from
this section name cleanup project is:
96 files changed, 261 insertions(+), 503 deletions(-)
The decrease results from removing a lot of redundancy in the linker
scripts.
The long-term goal here is to add support for building the kernel with
-ffunction-sections -fdata-sections. This requires renaming all the
magic section names in the kernel of the form .text.foo, .data.foo,
.bss.foo, and .rodata.foo to not have collisions with sections
generated for code like:
static int nosave = 0; /* -fdata-sections places in .data.nosave */
static void head(); /* -ffunction-sections places in .text.head */
Sam Ravnborg proposed that rather than just renaming all the sections
outright, we should start by first getting more control over the
section names used in the kernel so that we can later rename sections
without touching too many files. These patch series implement that
cleanup. Later, there will be another patch series to actually rename
the sections.
I'm hoping we can get just these macro definitions into 2.6.30 so that
the arch maintainers don't have to grab the macro definitions for
their trees while reviewing the patches for 2.6.31.
Shortly, I'm going to send one patch series for each of the
architectures updating those architectures to use these new macros
(and otherwise cleaning up section names on those architectures).
-Tim Abbott
Tim Abbott (6):
Add new macros for page-aligned data and bss sections.
Add new NOSAVE_DATA linker script macro.
Add new CACHELINE_ALIGNED_DATA linker script macro.
Add new INIT_TASK_DATA() linker script macro.
Add new READ_MOSTLY_DATA(align) linker script macro.
Add support for __read_mostly to linux/cache.h
include/asm-generic/vmlinux.lds.h | 27 +++++++++++++++++++++++++++
include/linux/cache.h | 6 ++++++
include/linux/init_task.h | 3 +++
include/linux/linkage.h | 9 +++++++++
4 files changed, 45 insertions(+), 0 deletions(-)
^ permalink raw reply
* [PATCH v2 5/6] Add new READ_MOSTLY_DATA(align) linker script macro.
From: Tim Abbott @ 2009-04-30 19:54 UTC (permalink / raw)
To: Sam Ravnborg
Cc: linux-mips, linux-m68k, linux-ia64, linux-sh, Denys Vlasenko,
Greg Ungerer, Jeff Arnold, linuxppc-dev, Paul Mackerras,
H. Peter Anvin, sparclinux, Sam Ravnborg, Waseem Daher,
linux-s390, Jesper Nilsson, Yoshinori Sato, Helge Deller,
Ingo Molnar, Geert Uytterhoeven, microblaze-uclinux, Russell King,
user-mode-linux-devel, Heiko Carstens, Jeff Dike, dev-etrax,
Mikael Starvik, Tim Abbott, Cyrill Gorcunov, Michal Simek,
Richard Henderson, Chris Zankel, Bryan Wu, Tony Luck,
linux-parisc, Haavard Skinnemoen, Hirokazu Takata,
Linux kernel mailing list, Ralf Baechle, Anders Kaseorg,
Kyle McMartin, Paul Mundt, Thomas Gleixner, linux-alpha,
Martin Schwidefsky, uclinux-dist-devel, Linus Torvalds,
David S. Miller
In-Reply-To: <1241121253-32341-5-git-send-email-tabbott@mit.edu>
This patch is preparation for replacing most ".data.read_mostly" in
the kernel with macros, so that the section name can later be changed
without having to touch a lot of the kernel.
The long-term goal here is to be able to change the kernel's magic
section names to those that are compatible with -ffunction-sections
-fdata-sections. This requires renaming all magic sections with names
of the form ".data.foo".
Signed-off-by: Tim Abbott <tabbott@mit.edu>
Cc: Sam Ravnborg <sam@ravnborg.org>
---
include/asm-generic/vmlinux.lds.h | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index 4b020e8..a4b4f4a 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -139,6 +139,10 @@
. = ALIGN(alignment); \
*(.data.init_task)
+#define READ_MOSTLY_DATA(alignment) \
+ . = ALIGN(alignment); \
+ *(.data.read_mostly)
+
#define RO_DATA(align) \
. = ALIGN((align)); \
.rodata : AT(ADDR(.rodata) - LOAD_OFFSET) { \
--
1.6.2.1
^ permalink raw reply related
* [PATCH v2 1/6] Add new macros for page-aligned data and bss sections.
From: Tim Abbott @ 2009-04-30 19:54 UTC (permalink / raw)
To: Sam Ravnborg
Cc: linux-mips, linux-m68k, linux-ia64, linux-sh, Denys Vlasenko,
Greg Ungerer, Jeff Arnold, linuxppc-dev, Paul Mackerras,
H. Peter Anvin, sparclinux, Sam Ravnborg, Waseem Daher,
linux-s390, Jesper Nilsson, Yoshinori Sato, Helge Deller,
Ingo Molnar, Geert Uytterhoeven, microblaze-uclinux, Russell King,
user-mode-linux-devel, Heiko Carstens, Jeff Dike, dev-etrax,
Mikael Starvik, Tim Abbott, Cyrill Gorcunov, Michal Simek,
Richard Henderson, Chris Zankel, Bryan Wu, Tony Luck,
linux-parisc, Haavard Skinnemoen, Hirokazu Takata,
Linux kernel mailing list, Ralf Baechle, Anders Kaseorg,
Kyle McMartin, Paul Mundt, Thomas Gleixner, linux-alpha,
Martin Schwidefsky, uclinux-dist-devel, Linus Torvalds,
David S. Miller
In-Reply-To: <1241121253-32341-1-git-send-email-tabbott@mit.edu>
This patch is preparation for replacing most uses of
".bss.page_aligned" and ".data.page_aligned" in the kernel with
macros, so that the section name can later be changed without having
to touch a lot of the kernel.
The long-term goal here is to be able to change the kernel's magic
section names to those that are compatible with -ffunction-sections
-fdata-sections. This requires renaming all magic sections with names
of the form ".data.foo".
Signed-off-by: Tim Abbott <tabbott@mit.edu>
Cc: Sam Ravnborg <sam@ravnborg.org>
Acked-by: David Howells <dhowells@redhat.com>
---
include/asm-generic/vmlinux.lds.h | 8 ++++++++
include/linux/linkage.h | 9 +++++++++
2 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index 89853bc..3d88c87 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -116,6 +116,14 @@
FTRACE_EVENTS() \
TRACE_SYSCALLS()
+#define PAGE_ALIGNED_DATA \
+ . = ALIGN(PAGE_SIZE); \
+ *(.data.page_aligned)
+
+#define PAGE_ALIGNED_BSS \
+ . = ALIGN(PAGE_SIZE); \
+ *(.bss.page_aligned)
+
#define RO_DATA(align) \
. = ALIGN((align)); \
.rodata : AT(ADDR(.rodata) - LOAD_OFFSET) { \
diff --git a/include/linux/linkage.h b/include/linux/linkage.h
index fee9e59..af051fc 100644
--- a/include/linux/linkage.h
+++ b/include/linux/linkage.h
@@ -22,6 +22,15 @@
#define __page_aligned_bss __section(.bss.page_aligned) __aligned(PAGE_SIZE)
/*
+ * For assembly routines.
+ *
+ * Note when using these that you must specify the appropriate
+ * alignment directives yourself
+ */
+#define __PAGE_ALIGNED_DATA .section ".data.page_aligned", "aw", @progbits
+#define __PAGE_ALIGNED_BSS .section ".bss.page_aligned", "aw", @nobits
+
+/*
* This is used by architectures to keep arguments on the stack
* untouched by the compiler by keeping them live until the end.
* The argument stack may be owned by the assembly-language
--
1.6.2.1
^ permalink raw reply related
* [PATCH v2 2/6] Add new NOSAVE_DATA linker script macro.
From: Tim Abbott @ 2009-04-30 19:54 UTC (permalink / raw)
To: Sam Ravnborg
Cc: linux-mips, linux-m68k, linux-ia64, linux-sh, Denys Vlasenko,
Greg Ungerer, Jeff Arnold, linuxppc-dev, Paul Mackerras,
H. Peter Anvin, sparclinux, Sam Ravnborg, Waseem Daher,
linux-s390, Jesper Nilsson, Yoshinori Sato, Helge Deller,
Ingo Molnar, Geert Uytterhoeven, microblaze-uclinux, Russell King,
user-mode-linux-devel, Heiko Carstens, Jeff Dike, dev-etrax,
Mikael Starvik, Tim Abbott, Cyrill Gorcunov, Michal Simek,
Richard Henderson, Chris Zankel, Bryan Wu, Tony Luck,
linux-parisc, Haavard Skinnemoen, Hirokazu Takata,
Linux kernel mailing list, Ralf Baechle, Anders Kaseorg,
Kyle McMartin, Paul Mundt, Thomas Gleixner, linux-alpha,
Martin Schwidefsky, uclinux-dist-devel, Linus Torvalds,
David S. Miller
In-Reply-To: <1241121253-32341-2-git-send-email-tabbott@mit.edu>
This patch is preparation for replacing most ".data.nosave" in the
kernel with macros, so that the section name can later be changed
without having to touch a lot of the kernel.
The long-term goal here is to be able to change the kernel's magic
section names to those that are compatible with -ffunction-sections
-fdata-sections. This requires renaming all magic sections with names
of the form ".data.foo".
Signed-off-by: Tim Abbott <tabbott@mit.edu>
Cc: Sam Ravnborg <sam@ravnborg.org>
---
include/asm-generic/vmlinux.lds.h | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index 3d88c87..f5ebd2b 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -124,6 +124,13 @@
. = ALIGN(PAGE_SIZE); \
*(.bss.page_aligned)
+#define NOSAVE_DATA \
+ . = ALIGN(PAGE_SIZE); \
+ __nosave_begin = .; \
+ *(.data.nosave) \
+ . = ALIGN(PAGE_SIZE); \
+ __nosave_end = .;
+
#define RO_DATA(align) \
. = ALIGN((align)); \
.rodata : AT(ADDR(.rodata) - LOAD_OFFSET) { \
--
1.6.2.1
^ permalink raw reply related
* [PATCH v2 6/6] Add support for __read_mostly to linux/cache.h
From: Tim Abbott @ 2009-04-30 19:54 UTC (permalink / raw)
To: Sam Ravnborg
Cc: linux-mips, linux-m68k, linux-ia64, linux-sh, Denys Vlasenko,
Greg Ungerer, Jeff Arnold, linuxppc-dev, Paul Mackerras,
H. Peter Anvin, sparclinux, Waseem Daher, linux-s390,
Jesper Nilsson, Yoshinori Sato, Helge Deller, Ingo Molnar,
Geert Uytterhoeven, microblaze-uclinux, Russell King,
user-mode-linux-devel, Heiko Carstens, Jeff Dike, dev-etrax,
Mikael Starvik, Tim Abbott, Cyrill Gorcunov, Michal Simek,
Richard Henderson, Chris Zankel, Bryan Wu, Tony Luck,
linux-parisc, Haavard Skinnemoen, Hirokazu Takata,
Linux kernel mailing list, Ralf Baechle, Anders Kaseorg,
Kyle McMartin, Paul Mundt, Thomas Gleixner, linux-alpha,
Martin Schwidefsky, uclinux-dist-devel, Linus Torvalds,
David S. Miller
In-Reply-To: <1241121253-32341-6-git-send-email-tabbott@mit.edu>
Signed-off-by: Tim Abbott <tabbott@mit.edu>
---
include/linux/cache.h | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/include/linux/cache.h b/include/linux/cache.h
index 97e2488..99d8a6f 100644
--- a/include/linux/cache.h
+++ b/include/linux/cache.h
@@ -13,7 +13,13 @@
#endif
#ifndef __read_mostly
+#ifdef CONFIG_HAVE_READ_MOSTLY_DATA
+#define __read_mostly __attribute__((__section__(".data.read_mostly")))
+#define __READ_MOSTLY .section ".data.read_mostly", "aw"
+#else
#define __read_mostly
+#define __READ_MOSTLY
+#endif /* CONFIG_HAVE_READ_MOSTLY_DATA */
#endif
#ifndef ____cacheline_aligned
--
1.6.2.1
^ permalink raw reply related
* [PATCH v2 3/6] Add new CACHELINE_ALIGNED_DATA linker script macro.
From: Tim Abbott @ 2009-04-30 19:54 UTC (permalink / raw)
To: Sam Ravnborg
Cc: linux-mips, linux-m68k, linux-ia64, linux-sh, Denys Vlasenko,
Greg Ungerer, Jeff Arnold, linuxppc-dev, Paul Mackerras,
H. Peter Anvin, sparclinux, Sam Ravnborg, Waseem Daher,
linux-s390, Jesper Nilsson, Yoshinori Sato, Helge Deller,
Ingo Molnar, Geert Uytterhoeven, microblaze-uclinux, Russell King,
user-mode-linux-devel, Heiko Carstens, Jeff Dike, dev-etrax,
Mikael Starvik, Tim Abbott, Cyrill Gorcunov, Michal Simek,
Richard Henderson, Chris Zankel, Bryan Wu, Tony Luck,
linux-parisc, Haavard Skinnemoen, Hirokazu Takata,
Linux kernel mailing list, Ralf Baechle, Anders Kaseorg,
Kyle McMartin, Paul Mundt, Thomas Gleixner, linux-alpha,
Martin Schwidefsky, uclinux-dist-devel, Linus Torvalds,
David S. Miller
In-Reply-To: <1241121253-32341-3-git-send-email-tabbott@mit.edu>
This patch is preparation for replacing most ".data.cacheline_aligned"
in the kernel with macros, so that the section name can later be
changed without having to touch a lot of the kernel.
The long-term goal here is to be able to change the kernel's magic
section names to those that are compatible with -ffunction-sections
-fdata-sections. This requires renaming all magic sections with names
of the form ".data.foo".
Signed-off-by: Tim Abbott <tabbott@mit.edu>
Cc: Sam Ravnborg <sam@ravnborg.org>
---
include/asm-generic/vmlinux.lds.h | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index f5ebd2b..fa7801b 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -131,6 +131,10 @@
. = ALIGN(PAGE_SIZE); \
__nosave_end = .;
+#define CACHELINE_ALIGNED_DATA(alignment) \
+ . = ALIGN(alignment); \
+ *(.data.cacheline_aligned)
+
#define RO_DATA(align) \
. = ALIGN((align)); \
.rodata : AT(ADDR(.rodata) - LOAD_OFFSET) { \
--
1.6.2.1
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox