All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mb862xxfb: use CONFIG_OF instead of CONFIG_PPC_OF
       [not found] <20090511222702.352192505@arndb.de>
@ 2009-05-11 22:37 ` Arnd Bergmann
  2009-05-13 12:25   ` Anatolij Gustschin
  2009-05-11 22:38 ` [PATCH] ata: libata depends on HAS_DMA Arnd Bergmann
                   ` (9 subsequent siblings)
  10 siblings, 1 reply; 86+ messages in thread
From: Arnd Bergmann @ 2009-05-11 22:37 UTC (permalink / raw)
  To: linux-kernel, Anatolij Gustschin; +Cc: Andrew Morton, David S. Miller

With this change, the driver builds fine on Microblaze, which
helps allyesconfig compile tests.

I did not test sparc, but the change should have the same effect there.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/video/mb862xx/mb862xxfb.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/video/mb862xx/mb862xxfb.c 
b/drivers/video/mb862xx/mb862xxfb.c
index fb64234..a28e3cf 100644
--- a/drivers/video/mb862xx/mb862xxfb.c
+++ b/drivers/video/mb862xx/mb862xxfb.c
@@ -19,7 +19,7 @@
 #include <linux/init.h>
 #include <linux/interrupt.h>
 #include <linux/pci.h>
-#if defined(CONFIG_PPC_OF)
+#if defined(CONFIG_OF)
 #include <linux/of_platform.h>
 #endif
 #include "mb862xxfb.h"
-- 

^ permalink raw reply related	[flat|nested] 86+ messages in thread

* [PATCH] ata: libata depends on HAS_DMA
       [not found] <20090511222702.352192505@arndb.de>
  2009-05-11 22:37 ` [PATCH] mb862xxfb: use CONFIG_OF instead of CONFIG_PPC_OF Arnd Bergmann
@ 2009-05-11 22:38 ` Arnd Bergmann
  2009-05-12  0:58   ` Jeff Garzik
  2009-05-12  8:06   ` Alan Cox
  2009-05-11 22:40 ` [PATCH] scsi: libsas " Arnd Bergmann
                   ` (8 subsequent siblings)
  10 siblings, 2 replies; 86+ messages in thread
From: Arnd Bergmann @ 2009-05-11 22:38 UTC (permalink / raw)
  To: linux-kernel, Jeff Garzik, linux-ide

libata uses the DMA mapping API, so it cannot be built
on architectures that don't have DMA support.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/ata/Kconfig |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig
index 9120717..f076268 100644
--- a/drivers/ata/Kconfig
+++ b/drivers/ata/Kconfig
@@ -4,7 +4,7 @@
 
 menuconfig ATA
 	tristate "Serial ATA (prod) and Parallel ATA (experimental) drivers"
-	depends on HAS_IOMEM
+	depends on HAS_IOMEM && HAS_DMA
 	depends on BLOCK
 	depends on !(M32R || M68K) || BROKEN
 	select SCSI
-- 
1.6.0.4

-- 



^ permalink raw reply related	[flat|nested] 86+ messages in thread

* [PATCH] scsi: libsas depends on HAS_DMA
       [not found] <20090511222702.352192505@arndb.de>
  2009-05-11 22:37 ` [PATCH] mb862xxfb: use CONFIG_OF instead of CONFIG_PPC_OF Arnd Bergmann
  2009-05-11 22:38 ` [PATCH] ata: libata depends on HAS_DMA Arnd Bergmann
@ 2009-05-11 22:40 ` Arnd Bergmann
  2009-05-11 22:50   ` James Bottomley
  2009-05-11 22:43 ` [PATCH] arm: rename CLOCK_TICK_RATE to ARM_TICK_RATE Arnd Bergmann
                   ` (7 subsequent siblings)
  10 siblings, 1 reply; 86+ messages in thread
From: Arnd Bergmann @ 2009-05-11 22:40 UTC (permalink / raw)
  To: James E.J. Bottomley; +Cc: linux-kernel, linux-scsi

libsas uses the DMA mapping API, so it cannot be
built on architectures that don't support DMA.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/scsi/libsas/Kconfig |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/scsi/libsas/Kconfig b/drivers/scsi/libsas/Kconfig
index 18f33cd..59e00fa 100644
--- a/drivers/scsi/libsas/Kconfig
+++ b/drivers/scsi/libsas/Kconfig
@@ -24,7 +24,7 @@
 
 config SCSI_SAS_LIBSAS
 	tristate "SAS Domain Transport Attributes"
-	depends on SCSI
+	depends on SCSI && HAS_DMA
 	select SCSI_SAS_ATTRS
 	help
 	  This provides transport specific helpers for SAS drivers which
-- 
1.6.0.4

-- 



^ permalink raw reply related	[flat|nested] 86+ messages in thread

* [PATCH] arm: rename CLOCK_TICK_RATE to ARM_TICK_RATE
       [not found] <20090511222702.352192505@arndb.de>
                   ` (2 preceding siblings ...)
  2009-05-11 22:40 ` [PATCH] scsi: libsas " Arnd Bergmann
@ 2009-05-11 22:43 ` Arnd Bergmann
  2009-05-11 23:11   ` [PATCH v2] " Arnd Bergmann
  2009-05-13 17:11   ` [PATCH] " Arnd Bergmann
  2009-05-11 22:50 ` [PATCH] x86: use PIT_TICK_RATE consistently Arnd Bergmann
                   ` (6 subsequent siblings)
  10 siblings, 2 replies; 86+ messages in thread
From: Arnd Bergmann @ 2009-05-11 22:43 UTC (permalink / raw)
  To: Russell King, linux-kernel, linux-arch; +Cc: Alan Cox

Most of the users of CLOCK_TICK_RATE in the kernel outside
of ARM assume that it refers to the i8253 base frequency
of 1.193182 Mhz, while in ARM it actually is the clock
frequency of the timer.

By renaming it to ARM_TICK_RATE for all arm specific
device drivers, we can hopefully reduce the amount
of confusion slightly.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/arm/mach-aaec2000/include/mach/timex.h   |    2 +-
 arch/arm/mach-at91/include/mach/timex.h       |   16 ++++++++--------
 arch/arm/mach-clps711x/include/mach/timex.h   |    2 +-
 arch/arm/mach-clps711x/time.c                 |    2 +-
 arch/arm/mach-davinci/include/mach/timex.h    |    2 +-
 arch/arm/mach-ebsa110/include/mach/timex.h    |    2 +-
 arch/arm/mach-ep93xx/core.c                   |    2 +-
 arch/arm/mach-ep93xx/include/mach/timex.h     |    2 +-
 arch/arm/mach-footbridge/include/mach/timex.h |    4 ++--
 arch/arm/mach-gemini/include/mach/timex.h     |    2 +-
 arch/arm/mach-h720x/include/mach/timex.h      |    2 +-
 arch/arm/mach-imx/include/mach/timex.h        |    2 +-
 arch/arm/mach-integrator/include/mach/timex.h |    2 +-
 arch/arm/mach-iop13xx/include/mach/timex.h    |    2 +-
 arch/arm/mach-iop32x/include/mach/timex.h     |    2 +-
 arch/arm/mach-iop33x/include/mach/timex.h     |    2 +-
 arch/arm/mach-ixp2000/include/mach/timex.h    |    2 +-
 arch/arm/mach-ixp23xx/core.c                  |    2 +-
 arch/arm/mach-ixp23xx/include/mach/timex.h    |    2 +-
 arch/arm/mach-ixp4xx/include/mach/timex.h     |    4 ++--
 arch/arm/mach-kirkwood/include/mach/timex.h   |    2 +-
 arch/arm/mach-ks8695/include/mach/timex.h     |    2 +-
 arch/arm/mach-ks8695/time.c                   |    6 +++---
 arch/arm/mach-l7200/include/mach/timex.h      |    2 +-
 arch/arm/mach-lh7a40x/include/mach/timex.h    |    4 ++--
 arch/arm/mach-loki/include/mach/timex.h       |    2 +-
 arch/arm/mach-mmp/include/mach/timex.h        |    2 +-
 arch/arm/mach-mmp/time.c                      |    6 +++---
 arch/arm/mach-msm/include/mach/timex.h        |    2 +-
 arch/arm/mach-mv78xx0/include/mach/timex.h    |    2 +-
 arch/arm/mach-netx/include/mach/timex.h       |    2 +-
 arch/arm/mach-netx/time.c                     |    4 ++--
 arch/arm/mach-ns9xxx/include/mach/timex.h     |    4 ++--
 arch/arm/mach-orion5x/include/mach/timex.h    |    2 +-
 arch/arm/mach-pnx4008/include/mach/timex.h    |    2 +-
 arch/arm/mach-pxa/include/mach/timex.h        |   10 +++++-----
 arch/arm/mach-realview/include/mach/timex.h   |    2 +-
 arch/arm/mach-rpc/include/mach/timex.h        |    2 +-
 arch/arm/mach-s3c24a0/include/mach/timex.h    |    2 +-
 arch/arm/mach-sa1100/include/mach/timex.h     |    2 +-
 arch/arm/mach-sa1100/time.c                   |    2 +-
 arch/arm/mach-shark/include/mach/timex.h      |    2 +-
 arch/arm/mach-versatile/include/mach/timex.h  |    2 +-
 arch/arm/mach-w90x900/include/mach/timex.h    |    4 ++--
 arch/arm/plat-mxc/include/mach/timex.h        |    6 +++---
 arch/arm/plat-omap/include/mach/timex.h       |    6 +++---
 arch/arm/plat-s3c/include/mach/timex.h        |    4 ++--
 drivers/rtc/rtc-pxa.c                         |    2 +-
 drivers/serial/serial_ks8695.c                |    2 +-
 drivers/watchdog/davinci_wdt.c                |    4 ++--
 drivers/watchdog/ks8695_wdt.c                 |    2 +-
 51 files changed, 78 insertions(+), 78 deletions(-)

diff --git a/arch/arm/mach-aaec2000/include/mach/timex.h b/arch/arm/mach-
aaec2000/include/mach/timex.h
index 6c8edf4..80d82de 100644
--- a/arch/arm/mach-aaec2000/include/mach/timex.h
+++ b/arch/arm/mach-aaec2000/include/mach/timex.h
@@ -13,6 +13,6 @@
 #ifndef __ASM_ARCH_TIMEX_H
 #define __ASM_ARCH_TIMEX_H
 
-#define CLOCK_TICK_RATE		508000
+#define ARM_TICK_RATE		508000
 
 #endif /* __ASM_ARCH_TIMEX_H */
diff --git a/arch/arm/mach-at91/include/mach/timex.h b/arch/arm/mach-
at91/include/mach/timex.h
index d84c994..86215f1 100644
--- a/arch/arm/mach-at91/include/mach/timex.h
+++ b/arch/arm/mach-at91/include/mach/timex.h
@@ -25,7 +25,7 @@
 
 #if defined(CONFIG_ARCH_AT91RM9200)
 
-#define CLOCK_TICK_RATE		(AT91_SLOW_CLOCK)
+#define ARM_TICK_RATE		(AT91_SLOW_CLOCK)
 
 #elif defined(CONFIG_ARCH_AT91SAM9260)
 
@@ -35,12 +35,12 @@
 #define AT91SAM9_MASTER_CLOCK	99300000
 #endif
 
-#define CLOCK_TICK_RATE		(AT91SAM9_MASTER_CLOCK/16)
+#define ARM_TICK_RATE		(AT91SAM9_MASTER_CLOCK/16)
 
 #elif defined(CONFIG_ARCH_AT91SAM9261)
 
 #define AT91SAM9_MASTER_CLOCK	99300000
-#define CLOCK_TICK_RATE		(AT91SAM9_MASTER_CLOCK/16)
+#define ARM_TICK_RATE		(AT91SAM9_MASTER_CLOCK/16)
 
 #elif defined(CONFIG_ARCH_AT91SAM9263)
 
@@ -50,27 +50,27 @@
 #define AT91SAM9_MASTER_CLOCK	99959500
 #endif
 
-#define CLOCK_TICK_RATE		(AT91SAM9_MASTER_CLOCK/16)
+#define ARM_TICK_RATE		(AT91SAM9_MASTER_CLOCK/16)
 
 #elif defined(CONFIG_ARCH_AT91SAM9RL)
 
 #define AT91SAM9_MASTER_CLOCK	100000000
-#define CLOCK_TICK_RATE		(AT91SAM9_MASTER_CLOCK/16)
+#define ARM_TICK_RATE		(AT91SAM9_MASTER_CLOCK/16)
 
 #elif defined(CONFIG_ARCH_AT91SAM9G20)
 
 #define AT91SAM9_MASTER_CLOCK	132096000
-#define CLOCK_TICK_RATE		(AT91SAM9_MASTER_CLOCK/16)
+#define ARM_TICK_RATE		(AT91SAM9_MASTER_CLOCK/16)
 
 #elif defined(CONFIG_ARCH_AT91CAP9)
 
 #define AT91CAP9_MASTER_CLOCK	100000000
-#define CLOCK_TICK_RATE		(AT91CAP9_MASTER_CLOCK/16)
+#define ARM_TICK_RATE		(AT91CAP9_MASTER_CLOCK/16)
 
 #elif defined(CONFIG_ARCH_AT91X40)
 
 #define AT91X40_MASTER_CLOCK	40000000
-#define CLOCK_TICK_RATE		(AT91X40_MASTER_CLOCK)
+#define ARM_TICK_RATE		(AT91X40_MASTER_CLOCK)
 
 #endif
 
diff --git a/arch/arm/mach-clps711x/include/mach/timex.h b/arch/arm/mach-
clps711x/include/mach/timex.h
index ac8823c..0965041 100644
--- a/arch/arm/mach-clps711x/include/mach/timex.h
+++ b/arch/arm/mach-clps711x/include/mach/timex.h
@@ -20,4 +20,4 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-#define CLOCK_TICK_RATE 512000
+#define ARM_TICK_RATE 512000
diff --git a/arch/arm/mach-clps711x/time.c b/arch/arm/mach-clps711x/time.c
index d581ef0..e5daed0 100644
--- a/arch/arm/mach-clps711x/time.c
+++ b/arch/arm/mach-clps711x/time.c
@@ -34,7 +34,7 @@
 /*
  * gettimeoffset() returns time since last timer tick, in usecs.
  *
- * 'LATCH' is hwclock ticks (see CLOCK_TICK_RATE in timex.h) per jiffy.
+ * 'LATCH' is hwclock ticks (see ARM_TICK_RATE in timex.h) per jiffy.
  * 'tick' is usecs per jiffy.
  */
 static unsigned long clps711x_gettimeoffset(void)
diff --git a/arch/arm/mach-davinci/include/mach/timex.h b/arch/arm/mach-
davinci/include/mach/timex.h
index 5282756..38314d3 100644
--- a/arch/arm/mach-davinci/include/mach/timex.h
+++ b/arch/arm/mach-davinci/include/mach/timex.h
@@ -12,6 +12,6 @@
 #define __ASM_ARCH_TIMEX_H
 
 /* The source frequency for the timers is the 27MHz clock */
-#define CLOCK_TICK_RATE 27000000
+#define ARM_TICK_RATE 27000000
 
 #endif /* __ASM_ARCH_TIMEX_H__ */
diff --git a/arch/arm/mach-ebsa110/include/mach/timex.h b/arch/arm/mach-
ebsa110/include/mach/timex.h
index 4fb43b2..e0e6623 100644
--- a/arch/arm/mach-ebsa110/include/mach/timex.h
+++ b/arch/arm/mach-ebsa110/include/mach/timex.h
@@ -15,5 +15,5 @@
  * This is therefore not used to calculate the
  * divisor.
  */
-#define CLOCK_TICK_RATE		47894000
+#define ARM_TICK_RATE		47894000
 
diff --git a/arch/arm/mach-ep93xx/core.c b/arch/arm/mach-ep93xx/core.c
index ae24486..22279b6 100644
--- a/arch/arm/mach-ep93xx/core.c
+++ b/arch/arm/mach-ep93xx/core.c
@@ -98,7 +98,7 @@ void __init ep93xx_map_io(void)
  */
 static unsigned int last_jiffy_time;
 
-#define TIMER4_TICKS_PER_JIFFY		((CLOCK_TICK_RATE + (HZ/2)) / HZ)
+#define TIMER4_TICKS_PER_JIFFY		((ARM_TICK_RATE + (HZ/2)) / HZ)
 
 static irqreturn_t ep93xx_timer_interrupt(int irq, void *dev_id)
 {
diff --git a/arch/arm/mach-ep93xx/include/mach/timex.h b/arch/arm/mach-
ep93xx/include/mach/timex.h
index 6b3503b..d157204 100644
--- a/arch/arm/mach-ep93xx/include/mach/timex.h
+++ b/arch/arm/mach-ep93xx/include/mach/timex.h
@@ -2,4 +2,4 @@
  * arch/arm/mach-ep93xx/include/mach/timex.h
  */
 
-#define CLOCK_TICK_RATE		983040
+#define ARM_TICK_RATE		983040
diff --git a/arch/arm/mach-footbridge/include/mach/timex.h b/arch/arm/mach-
footbridge/include/mach/timex.h
index d0fea9d..20534ac 100644
--- a/arch/arm/mach-footbridge/include/mach/timex.h
+++ b/arch/arm/mach-footbridge/include/mach/timex.h
@@ -12,7 +12,7 @@
 
 /*
  * We assume a constant here; this satisfies the maths in linux/timex.h
- * and linux/time.h.  CLOCK_TICK_RATE is actually system dependent, but
+ * and linux/time.h.  ARM_TICK_RATE is actually system dependent, but
  * this must be a constant.
  */
-#define CLOCK_TICK_RATE		(50000000/16)
+#define ARM_TICK_RATE		(50000000/16)
diff --git a/arch/arm/mach-gemini/include/mach/timex.h b/arch/arm/mach-
gemini/include/mach/timex.h
index dc5690b..b0eec31 100644
--- a/arch/arm/mach-gemini/include/mach/timex.h
+++ b/arch/arm/mach-gemini/include/mach/timex.h
@@ -10,4 +10,4 @@
  */
 
 /* When AHB bus frequency is 150MHz */
-#define CLOCK_TICK_RATE	38000000
+#define ARM_TICK_RATE	38000000
diff --git a/arch/arm/mach-h720x/include/mach/timex.h b/arch/arm/mach-
h720x/include/mach/timex.h
index 3f2f447..ebe075c 100644
--- a/arch/arm/mach-h720x/include/mach/timex.h
+++ b/arch/arm/mach-h720x/include/mach/timex.h
@@ -10,6 +10,6 @@
 #ifndef __ASM_ARCH_TIMEX
 #define __ASM_ARCH_TIMEX
 
-#define CLOCK_TICK_RATE		3686400
+#define ARM_TICK_RATE		3686400
 
 #endif
diff --git a/arch/arm/mach-imx/include/mach/timex.h b/arch/arm/mach-
imx/include/mach/timex.h
index e22ba78..1e1ef9c 100644
--- a/arch/arm/mach-imx/include/mach/timex.h
+++ b/arch/arm/mach-imx/include/mach/timex.h
@@ -21,6 +21,6 @@
 #ifndef __ASM_ARCH_TIMEX_H
 #define __ASM_ARCH_TIMEX_H
 
-#define CLOCK_TICK_RATE		(16000000)
+#define ARM_TICK_RATE		(16000000)
 
 #endif
diff --git a/arch/arm/mach-integrator/include/mach/timex.h b/arch/arm/mach-
integrator/include/mach/timex.h
index 1dcb420..4c06d90 100644
--- a/arch/arm/mach-integrator/include/mach/timex.h
+++ b/arch/arm/mach-integrator/include/mach/timex.h
@@ -23,4 +23,4 @@
 /*
  * ??
  */
-#define CLOCK_TICK_RATE		(50000000 / 16)
+#define ARM_TICK_RATE		(50000000 / 16)
diff --git a/arch/arm/mach-iop13xx/include/mach/timex.h b/arch/arm/mach-
iop13xx/include/mach/timex.h
index 45fb274..4e8d4e6 100644
--- a/arch/arm/mach-iop13xx/include/mach/timex.h
+++ b/arch/arm/mach-iop13xx/include/mach/timex.h
@@ -1 +1 @@
-#define CLOCK_TICK_RATE (100 * HZ)
+#define ARM_TICK_RATE (100 * HZ)
diff --git a/arch/arm/mach-iop32x/include/mach/timex.h b/arch/arm/mach-
iop32x/include/mach/timex.h
index 7262ab8..5ead7ca 100644
--- a/arch/arm/mach-iop32x/include/mach/timex.h
+++ b/arch/arm/mach-iop32x/include/mach/timex.h
@@ -3,4 +3,4 @@
  *
  * IOP32x architecture timex specifications
  */
-#define CLOCK_TICK_RATE		(100 * HZ)
+#define ARM_TICK_RATE		(100 * HZ)
diff --git a/arch/arm/mach-iop33x/include/mach/timex.h b/arch/arm/mach-
iop33x/include/mach/timex.h
index 54c5890..e925e77 100644
--- a/arch/arm/mach-iop33x/include/mach/timex.h
+++ b/arch/arm/mach-iop33x/include/mach/timex.h
@@ -3,4 +3,4 @@
  *
  * IOP3xx architecture timex specifications
  */
-#define CLOCK_TICK_RATE		(100 * HZ)
+#define ARM_TICK_RATE		(100 * HZ)
diff --git a/arch/arm/mach-ixp2000/include/mach/timex.h b/arch/arm/mach-
ixp2000/include/mach/timex.h
index 835e659..479cbab 100644
--- a/arch/arm/mach-ixp2000/include/mach/timex.h
+++ b/arch/arm/mach-ixp2000/include/mach/timex.h
@@ -8,6 +8,6 @@
 /*
  * Default clock is 50MHz APB, but platform code can override this
  */
-#define CLOCK_TICK_RATE	50000000
+#define ARM_TICK_RATE	50000000
 
 
diff --git a/arch/arm/mach-ixp23xx/core.c b/arch/arm/mach-ixp23xx/core.c
index aa4c442..aed022b 100644
--- a/arch/arm/mach-ixp23xx/core.c
+++ b/arch/arm/mach-ixp23xx/core.c
@@ -329,7 +329,7 @@ void __init ixp23xx_init_irq(void)
 /*************************************************************************
  * Timer-tick functions for IXP23xx
  *************************************************************************/
-#define CLOCK_TICKS_PER_USEC	(CLOCK_TICK_RATE / USEC_PER_SEC)
+#define CLOCK_TICKS_PER_USEC	(ARM_TICK_RATE / USEC_PER_SEC)
 
 static unsigned long next_jiffy_time;
 
diff --git a/arch/arm/mach-ixp23xx/include/mach/timex.h b/arch/arm/mach-
ixp23xx/include/mach/timex.h
index e341e9c..c84435b 100644
--- a/arch/arm/mach-ixp23xx/include/mach/timex.h
+++ b/arch/arm/mach-ixp23xx/include/mach/timex.h
@@ -4,4 +4,4 @@
  * XScale architecture timex specifications
  */
 
-#define CLOCK_TICK_RATE 75000000
+#define ARM_TICK_RATE 75000000
diff --git a/arch/arm/mach-ixp4xx/include/mach/timex.h b/arch/arm/mach-
ixp4xx/include/mach/timex.h
index 89ce3ee..1f5c87b 100644
--- a/arch/arm/mach-ixp4xx/include/mach/timex.h
+++ b/arch/arm/mach-ixp4xx/include/mach/timex.h
@@ -7,9 +7,9 @@
 
 /*
  * We use IXP425 General purpose timer for our timer needs, it runs at 
- * 66.66... MHz. We do a convulted calculation of CLOCK_TICK_RATE b/c the
+ * 66.66... MHz. We do a convulted calculation of ARM_TICK_RATE b/c the
  * timer register ignores the bottom 2 bits of the LATCH value.
  */
 #define FREQ 66666666
-#define CLOCK_TICK_RATE (((FREQ / HZ & ~IXP4XX_OST_RELOAD_MASK) + 1) * HZ)
+#define ARM_TICK_RATE (((FREQ / HZ & ~IXP4XX_OST_RELOAD_MASK) + 1) * HZ)
 
diff --git a/arch/arm/mach-kirkwood/include/mach/timex.h b/arch/arm/mach-
kirkwood/include/mach/timex.h
index c923cd1..67d1e54 100644
--- a/arch/arm/mach-kirkwood/include/mach/timex.h
+++ b/arch/arm/mach-kirkwood/include/mach/timex.h
@@ -6,5 +6,5 @@
  * warranty of any kind, whether express or implied.
  */
 
-#define CLOCK_TICK_RATE		(100 * HZ)
+#define ARM_TICK_RATE		(100 * HZ)
 
diff --git a/arch/arm/mach-ks8695/include/mach/timex.h b/arch/arm/mach-
ks8695/include/mach/timex.h
index 4682e35..83e971b 100644
--- a/arch/arm/mach-ks8695/include/mach/timex.h
+++ b/arch/arm/mach-ks8695/include/mach/timex.h
@@ -15,6 +15,6 @@
 #define __ASM_ARCH_TIMEX_H
 
 /* timers are derived from MCLK, which is 25MHz */
-#define CLOCK_TICK_RATE 25000000
+#define ARM_TICK_RATE 25000000
 
 #endif
diff --git a/arch/arm/mach-ks8695/time.c b/arch/arm/mach-ks8695/time.c
index 69c072c..c51fe85 100644
--- a/arch/arm/mach-ks8695/time.c
+++ b/arch/arm/mach-ks8695/time.c
@@ -55,11 +55,11 @@ static unsigned long ks8695_gettimeoffset (void)
 	} while (elapsed > tick2);
 
 	/* Convert to number of ticks expired (not remaining) */
-	elapsed = (CLOCK_TICK_RATE / HZ) - elapsed;
+	elapsed = (ARM_TICK_RATE / HZ) - elapsed;
 
 	/* Is interrupt pending?  If so, then timer has been reloaded already. */
 	if (intpending)
-		elapsed += (CLOCK_TICK_RATE / HZ);
+		elapsed += (ARM_TICK_RATE / HZ);
 
 	/* Convert ticks to usecs */
 	return (unsigned long)(elapsed * (tick_nsec / 1000)) / LATCH;
@@ -82,7 +82,7 @@ static struct irqaction ks8695_timer_irq = {
 
 static void ks8695_timer_setup(void)
 {
-	unsigned long tmout = CLOCK_TICK_RATE / HZ;
+	unsigned long tmout = ARM_TICK_RATE / HZ;
 	unsigned long tmcon;
 
 	/* disable timer1 */
diff --git a/arch/arm/mach-l7200/include/mach/timex.h b/arch/arm/mach-
l7200/include/mach/timex.h
index ffc96a6..b7ed766 100644
--- a/arch/arm/mach-l7200/include/mach/timex.h
+++ b/arch/arm/mach-l7200/include/mach/timex.h
@@ -17,4 +17,4 @@
  *       rate. The value of HZ in 'param.h' must also
  *       be changed to match below.
  */
-#define CLOCK_TICK_RATE		128
+#define ARM_TICK_RATE		128
diff --git a/arch/arm/mach-lh7a40x/include/mach/timex.h b/arch/arm/mach-
lh7a40x/include/mach/timex.h
index 08028ce..87d3657 100644
--- a/arch/arm/mach-lh7a40x/include/mach/timex.h
+++ b/arch/arm/mach-lh7a40x/include/mach/timex.h
@@ -10,8 +10,8 @@
 
 #include <mach/constants.h>
 
-#define CLOCK_TICK_RATE		(PLL_CLOCK/6/16)
+#define ARM_TICK_RATE		(PLL_CLOCK/6/16)
 
 /*
-#define CLOCK_TICK_RATE		3686400
+#define ARM_TICK_RATE		3686400
 */
diff --git a/arch/arm/mach-loki/include/mach/timex.h b/arch/arm/mach-
loki/include/mach/timex.h
index 9df2109..640b53a 100644
--- a/arch/arm/mach-loki/include/mach/timex.h
+++ b/arch/arm/mach-loki/include/mach/timex.h
@@ -6,6 +6,6 @@
  * warranty of any kind, whether express or implied.
  */
 
-#define CLOCK_TICK_RATE		(100 * HZ)
+#define ARM_TICK_RATE		(100 * HZ)
 
 #define LOKI_TCLK		180000000
diff --git a/arch/arm/mach-mmp/include/mach/timex.h b/arch/arm/mach-
mmp/include/mach/timex.h
index 6cebbd0..dcf8e87 100644
--- a/arch/arm/mach-mmp/include/mach/timex.h
+++ b/arch/arm/mach-mmp/include/mach/timex.h
@@ -6,4 +6,4 @@
  * published by the Free Software Foundation.
  */
 
-#define CLOCK_TICK_RATE		3250000
+#define ARM_TICK_RATE		3250000
diff --git a/arch/arm/mach-mmp/time.c b/arch/arm/mach-mmp/time.c
index b03a6ed..c85c1e1 100644
--- a/arch/arm/mach-mmp/time.c
+++ b/arch/arm/mach-mmp/time.c
@@ -183,14 +183,14 @@ void __init timer_init(int irq)
 {
 	timer_config();
 
-	set_tcr2ns_scale(CLOCK_TICK_RATE);
+	set_tcr2ns_scale(ARM_TICK_RATE);
 
-	ckevt.mult = div_sc(CLOCK_TICK_RATE, NSEC_PER_SEC, ckevt.shift);
+	ckevt.mult = div_sc(ARM_TICK_RATE, NSEC_PER_SEC, ckevt.shift);
 	ckevt.max_delta_ns = clockevent_delta2ns(MAX_DELTA, &ckevt);
 	ckevt.min_delta_ns = clockevent_delta2ns(MIN_DELTA, &ckevt);
 	ckevt.cpumask = cpumask_of(0);
 
-	cksrc.mult = clocksource_hz2mult(CLOCK_TICK_RATE, cksrc.shift);
+	cksrc.mult = clocksource_hz2mult(ARM_TICK_RATE, cksrc.shift);
 
 	setup_irq(irq, &timer_irq);
 
diff --git a/arch/arm/mach-msm/include/mach/timex.h b/arch/arm/mach-
msm/include/mach/timex.h
index a62e6b2..4bf65ab 100644
--- a/arch/arm/mach-msm/include/mach/timex.h
+++ b/arch/arm/mach-msm/include/mach/timex.h
@@ -16,6 +16,6 @@
 #ifndef __ASM_ARCH_MSM_TIMEX_H
 #define __ASM_ARCH_MSM_TIMEX_H
 
-#define CLOCK_TICK_RATE		1000000
+#define ARM_TICK_RATE		1000000
 
 #endif
diff --git a/arch/arm/mach-mv78xx0/include/mach/timex.h b/arch/arm/mach-
mv78xx0/include/mach/timex.h
index 0e8c443..c074de8 100644
--- a/arch/arm/mach-mv78xx0/include/mach/timex.h
+++ b/arch/arm/mach-mv78xx0/include/mach/timex.h
@@ -6,4 +6,4 @@
  * warranty of any kind, whether express or implied.
  */
 
-#define CLOCK_TICK_RATE		(100 * HZ)
+#define ARM_TICK_RATE		(100 * HZ)
diff --git a/arch/arm/mach-netx/include/mach/timex.h b/arch/arm/mach-
netx/include/mach/timex.h
index 1120dd0..ea1aa8f 100644
--- a/arch/arm/mach-netx/include/mach/timex.h
+++ b/arch/arm/mach-netx/include/mach/timex.h
@@ -17,4 +17,4 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-#define CLOCK_TICK_RATE 100000000
+#define ARM_TICK_RATE 100000000
diff --git a/arch/arm/mach-netx/time.c b/arch/arm/mach-netx/time.c
index 82801db..85b0969 100644
--- a/arch/arm/mach-netx/time.c
+++ b/arch/arm/mach-netx/time.c
@@ -152,10 +152,10 @@ static void __init netx_timer_init(void)
 			NETX_GPIO_COUNTER_CTRL(TIMER_CLOCKSOURCE));
 
 	clocksource_netx.mult =
-		clocksource_hz2mult(CLOCK_TICK_RATE, clocksource_netx.shift);
+		clocksource_hz2mult(ARM_TICK_RATE, clocksource_netx.shift);
 	clocksource_register(&clocksource_netx);
 
-	netx_clockevent.mult = div_sc(CLOCK_TICK_RATE, NSEC_PER_SEC,
+	netx_clockevent.mult = div_sc(ARM_TICK_RATE, NSEC_PER_SEC,
 			netx_clockevent.shift);
 	netx_clockevent.max_delta_ns =
 		clockevent_delta2ns(0xfffffffe, &netx_clockevent);
diff --git a/arch/arm/mach-ns9xxx/include/mach/timex.h b/arch/arm/mach-
ns9xxx/include/mach/timex.h
index 734a8d8..9cd49e8 100644
--- a/arch/arm/mach-ns9xxx/include/mach/timex.h
+++ b/arch/arm/mach-ns9xxx/include/mach/timex.h
@@ -12,9 +12,9 @@
 #define __ASM_ARCH_TIMEX_H
 
 /*
- * value for CLOCK_TICK_RATE stolen from arch/arm/mach-
s3c2410/include/mach/timex.h.
+ * value for ARM_TICK_RATE stolen from arch/arm/mach-
s3c2410/include/mach/timex.h.
  * See there for an explanation.
  */
-#define CLOCK_TICK_RATE         12000000
+#define ARM_TICK_RATE         12000000
 
 #endif /* ifndef __ASM_ARCH_TIMEX_H */
diff --git a/arch/arm/mach-orion5x/include/mach/timex.h b/arch/arm/mach-
orion5x/include/mach/timex.h
index 4c69820..957c434 100644
--- a/arch/arm/mach-orion5x/include/mach/timex.h
+++ b/arch/arm/mach-orion5x/include/mach/timex.h
@@ -8,4 +8,4 @@
  * warranty of any kind, whether express or implied.
  */
 
-#define CLOCK_TICK_RATE		(100 * HZ)
+#define ARM_TICK_RATE		(100 * HZ)
diff --git a/arch/arm/mach-pnx4008/include/mach/timex.h b/arch/arm/mach-
pnx4008/include/mach/timex.h
index 5ff0196..b0faff3 100644
--- a/arch/arm/mach-pnx4008/include/mach/timex.h
+++ b/arch/arm/mach-pnx4008/include/mach/timex.h
@@ -17,7 +17,7 @@
 #include <linux/io.h>
 #include <mach/hardware.h>
 
-#define CLOCK_TICK_RATE		1000000
+#define ARM_TICK_RATE		1000000
 
 #define TICKS2USECS(x)	(x)
 
diff --git a/arch/arm/mach-pxa/include/mach/timex.h b/arch/arm/mach-
pxa/include/mach/timex.h
index af6760a..337fdac 100644
--- a/arch/arm/mach-pxa/include/mach/timex.h
+++ b/arch/arm/mach-pxa/include/mach/timex.h
@@ -10,7 +10,7 @@
  * published by the Free Software Foundation.
  */
 
-/* Various drivers are still using the constant of CLOCK_TICK_RATE, for
+/* Various drivers are still using the constant of ARM_TICK_RATE, for
  * those drivers to at least work, the definition is provided here.
  *
  * NOTE: this is no longer accurate when multiple processors and boards
@@ -21,14 +21,14 @@
 
 #if defined(CONFIG_PXA25x)
 /* PXA250/210 timer base */
-#define CLOCK_TICK_RATE 3686400
+#define ARM_TICK_RATE 3686400
 #elif defined(CONFIG_PXA27x)
 /* PXA27x timer base */
 #ifdef CONFIG_MACH_MAINSTONE
-#define CLOCK_TICK_RATE 3249600
+#define ARM_TICK_RATE 3249600
 #else
-#define CLOCK_TICK_RATE 3250000
+#define ARM_TICK_RATE 3250000
 #endif
 #else
-#define CLOCK_TICK_RATE 3250000
+#define ARM_TICK_RATE 3250000
 #endif
diff --git a/arch/arm/mach-realview/include/mach/timex.h b/arch/arm/mach-
realview/include/mach/timex.h
index 4eeb069..adcfee9 100644
--- a/arch/arm/mach-realview/include/mach/timex.h
+++ b/arch/arm/mach-realview/include/mach/timex.h
@@ -20,4 +20,4 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-#define CLOCK_TICK_RATE		(50000000 / 16)
+#define ARM_TICK_RATE		(50000000 / 16)
diff --git a/arch/arm/mach-rpc/include/mach/timex.h b/arch/arm/mach-
rpc/include/mach/timex.h
index dd75e73..3518567 100644
--- a/arch/arm/mach-rpc/include/mach/timex.h
+++ b/arch/arm/mach-rpc/include/mach/timex.h
@@ -13,5 +13,5 @@
 /*
  * On the RiscPC, the clock ticks at 2MHz.
  */
-#define CLOCK_TICK_RATE		2000000
+#define ARM_TICK_RATE		2000000
 
diff --git a/arch/arm/mach-s3c24a0/include/mach/timex.h b/arch/arm/mach-
s3c24a0/include/mach/timex.h
index 9857342..cb00161 100644
--- a/arch/arm/mach-s3c24a0/include/mach/timex.h
+++ b/arch/arm/mach-s3c24a0/include/mach/timex.h
@@ -13,6 +13,6 @@
 #ifndef __ASM_ARCH_TIMEX_H
 #define __ASM_ARCH_TIMEX_H
 
-#define CLOCK_TICK_RATE 12000000
+#define ARM_TICK_RATE 12000000
 
 #endif /* __ASM_ARCH_TIMEX_H */
diff --git a/arch/arm/mach-sa1100/include/mach/timex.h b/arch/arm/mach-
sa1100/include/mach/timex.h
index 7a5d017..d3a4fd0 100644
--- a/arch/arm/mach-sa1100/include/mach/timex.h
+++ b/arch/arm/mach-sa1100/include/mach/timex.h
@@ -9,4 +9,4 @@
 /*
  * SA1100 timer
  */
-#define CLOCK_TICK_RATE		3686400
+#define ARM_TICK_RATE		3686400
diff --git a/arch/arm/mach-sa1100/time.c b/arch/arm/mach-sa1100/time.c
index 711c029..a561628 100644
--- a/arch/arm/mach-sa1100/time.c
+++ b/arch/arm/mach-sa1100/time.c
@@ -112,7 +112,7 @@ static void __init sa1100_timer_init(void)
 	ckevt_sa1100_osmr0.cpumask = cpumask_of(0);
 
 	cksrc_sa1100_oscr.mult =
-		clocksource_hz2mult(CLOCK_TICK_RATE, cksrc_sa1100_oscr.shift);
+		clocksource_hz2mult(ARM_TICK_RATE, cksrc_sa1100_oscr.shift);
 
 	setup_irq(IRQ_OST0, &sa1100_timer_irq);
 
diff --git a/arch/arm/mach-shark/include/mach/timex.h b/arch/arm/mach-
shark/include/mach/timex.h
index bb6eeae..d32920d 100644
--- a/arch/arm/mach-shark/include/mach/timex.h
+++ b/arch/arm/mach-shark/include/mach/timex.h
@@ -4,4 +4,4 @@
  * by Alexander Schulz
  */
 
-#define CLOCK_TICK_RATE 1193180
+#define ARM_TICK_RATE 1193180
diff --git a/arch/arm/mach-versatile/include/mach/timex.h b/arch/arm/mach-
versatile/include/mach/timex.h
index 426199b..07176df 100644
--- a/arch/arm/mach-versatile/include/mach/timex.h
+++ b/arch/arm/mach-versatile/include/mach/timex.h
@@ -20,4 +20,4 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-#define CLOCK_TICK_RATE		(50000000 / 16)
+#define ARM_TICK_RATE		(50000000 / 16)
diff --git a/arch/arm/mach-w90x900/include/mach/timex.h b/arch/arm/mach-
w90x900/include/mach/timex.h
index 164dce0..906fb72 100644
--- a/arch/arm/mach-w90x900/include/mach/timex.h
+++ b/arch/arm/mach-w90x900/include/mach/timex.h
@@ -18,8 +18,8 @@
 #ifndef __ASM_ARCH_TIMEX_H
 #define __ASM_ARCH_TIMEX_H
 
-/* CLOCK_TICK_RATE Now, I don't use it. */
+/* ARM_TICK_RATE Now, I don't use it. */
 
-#define CLOCK_TICK_RATE 15000000
+#define ARM_TICK_RATE 15000000
 
 #endif /* __ASM_ARCH_TIMEX_H */
diff --git a/arch/arm/plat-mxc/include/mach/timex.h b/arch/arm/plat-
mxc/include/mach/timex.h
index 07b4a73..4f8919d 100644
--- a/arch/arm/plat-mxc/include/mach/timex.h
+++ b/arch/arm/plat-mxc/include/mach/timex.h
@@ -21,11 +21,11 @@
 #define __ASM_ARCH_MXC_TIMEX_H__
 
 #if defined CONFIG_ARCH_MX1
-#define CLOCK_TICK_RATE		16000000
+#define ARM_TICK_RATE		16000000
 #elif defined CONFIG_ARCH_MX2
-#define CLOCK_TICK_RATE		13300000
+#define ARM_TICK_RATE		13300000
 #elif defined CONFIG_ARCH_MX3
-#define CLOCK_TICK_RATE		16625000
+#define ARM_TICK_RATE		16625000
 #endif
 
 #endif				/* __ASM_ARCH_MXC_TIMEX_H__ */
diff --git a/arch/arm/plat-omap/include/mach/timex.h b/arch/arm/plat-
omap/include/mach/timex.h
index 6d35767..d572956 100644
--- a/arch/arm/plat-omap/include/mach/timex.h
+++ b/arch/arm/plat-omap/include/mach/timex.h
@@ -30,12 +30,12 @@
 
 /*
  * OMAP 32KHz timer updates time one jiffie at a time from a secondary timer,
- * and that's why the CLOCK_TICK_RATE is not 32768.
+ * and that's why the ARM_TICK_RATE is not 32768.
  */
 #ifdef CONFIG_OMAP_32K_TIMER
-#define CLOCK_TICK_RATE		(CONFIG_OMAP_32K_TIMER_HZ)
+#define ARM_TICK_RATE		(CONFIG_OMAP_32K_TIMER_HZ)
 #else
-#define CLOCK_TICK_RATE		(HZ * 100000UL)
+#define ARM_TICK_RATE		(HZ * 100000UL)
 #endif
 
 #endif /* __ASM_ARCH_OMAP_TIMEX_H */
diff --git a/arch/arm/plat-s3c/include/mach/timex.h b/arch/arm/plat-
s3c/include/mach/timex.h
index 2a425ed..a32574a 100644
--- a/arch/arm/plat-s3c/include/mach/timex.h
+++ b/arch/arm/plat-s3c/include/mach/timex.h
@@ -13,14 +13,14 @@
 #ifndef __ASM_ARCH_TIMEX_H
 #define __ASM_ARCH_TIMEX_H
 
-/* CLOCK_TICK_RATE needs to be evaluatable by the cpp, so making it
+/* ARM_TICK_RATE needs to be evaluatable by the cpp, so making it
  * a variable is useless. It seems as long as we make our timers an
  * exact multiple of HZ, any value that makes a 1->1 correspondence
  * for the time conversion functions to/from jiffies is acceptable.
 */
 
 
-#define CLOCK_TICK_RATE 12000000
+#define ARM_TICK_RATE 12000000
 
 
 #endif /* __ASM_ARCH_TIMEX_H */
diff --git a/drivers/rtc/rtc-pxa.c b/drivers/rtc/rtc-pxa.c
index bb8cc05..22133f4 100644
--- a/drivers/rtc/rtc-pxa.c
+++ b/drivers/rtc/rtc-pxa.c
@@ -29,7 +29,7 @@
 
 #include <mach/hardware.h>
 
-#define TIMER_FREQ		CLOCK_TICK_RATE
+#define TIMER_FREQ		ARM_TICK_RATE
 #define RTC_DEF_DIVIDER		(32768 - 1)
 #define RTC_DEF_TRIM		0
 #define MAXFREQ_PERIODIC	1000
diff --git a/drivers/serial/serial_ks8695.c b/drivers/serial/serial_ks8695.c
index 998e89d..5d66a2f 100644
--- a/drivers/serial/serial_ks8695.c
+++ b/drivers/serial/serial_ks8695.c
@@ -549,7 +549,7 @@ static struct uart_port ks8695uart_ports[SERIAL_KS8695_NR] 
= {
 		.mapbase	= KS8695_UART_VA,
 		.iotype		= SERIAL_IO_MEM,
 		.irq		= KS8695_IRQ_UART_TX,
-		.uartclk	= CLOCK_TICK_RATE * 16,
+		.uartclk	= ARM_TICK_RATE * 16,
 		.fifosize	= 16,
 		.ops		= &ks8695uart_pops,
 		.flags		= ASYNC_BOOT_AUTOCONF,
diff --git a/drivers/watchdog/davinci_wdt.c b/drivers/watchdog/davinci_wdt.c
index c51d0b0..de7f784 100644
--- a/drivers/watchdog/davinci_wdt.c
+++ b/drivers/watchdog/davinci_wdt.c
@@ -99,9 +99,9 @@ static void wdt_enable(void)
 	iowrite32(0, wdt_base + TIM12);
 	iowrite32(0, wdt_base + TIM34);
 	/* set timeout period */
-	timer_margin = (((u64)heartbeat * CLOCK_TICK_RATE) & 0xffffffff);
+	timer_margin = (((u64)heartbeat * ARM_TICK_RATE) & 0xffffffff);
 	iowrite32(timer_margin, wdt_base + PRD12);
-	timer_margin = (((u64)heartbeat * CLOCK_TICK_RATE) >> 32);
+	timer_margin = (((u64)heartbeat * ARM_TICK_RATE) >> 32);
 	iowrite32(timer_margin, wdt_base + PRD34);
 	/* enable run continuously */
 	iowrite32(ENAMODE12_PERIODIC, wdt_base + TCR);
diff --git a/drivers/watchdog/ks8695_wdt.c b/drivers/watchdog/ks8695_wdt.c
index ae38321..4594e93 100644
--- a/drivers/watchdog/ks8695_wdt.c
+++ b/drivers/watchdog/ks8695_wdt.c
@@ -66,7 +66,7 @@ static inline void ks8695_wdt_stop(void)
 static inline void ks8695_wdt_start(void)
 {
 	unsigned long tmcon;
-	unsigned long tval = wdt_time * CLOCK_TICK_RATE;
+	unsigned long tval = wdt_time * ARM_TICK_RATE;
 
 	spin_lock(&ks8695_lock);
 	/* disable timer0 */
-- 
1.6.0.4

-- 



^ permalink raw reply related	[flat|nested] 86+ messages in thread

* [PATCH] x86: use PIT_TICK_RATE consistently
       [not found] <20090511222702.352192505@arndb.de>
                   ` (3 preceding siblings ...)
  2009-05-11 22:43 ` [PATCH] arm: rename CLOCK_TICK_RATE to ARM_TICK_RATE Arnd Bergmann
@ 2009-05-11 22:50 ` Arnd Bergmann
  2009-05-11 23:05   ` Arnd Bergmann
  2009-05-11 22:55   ` Arnd Bergmann
                   ` (5 subsequent siblings)
  10 siblings, 1 reply; 86+ messages in thread
From: Arnd Bergmann @ 2009-05-11 22:50 UTC (permalink / raw)
  To: Thomas Gleixner, John Stultz, Dmitry Torokhov, Takashi Iwai,
	Jaroslav Kysela
  Cc: linux-kernel, x86

On x86, the CLOCK_TICK_RATE is defined in terms of PIT_TICK_RATE,
from the original i8253 PIT frequency. Change all users to
refer to PIT_TICK_RATE directly, in order to reduce the number
of overloaded meanings for CLOCK_TICK_RATE.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/x86/include/asm/mach_timer.h |    2 +-
 arch/x86/kernel/i8253.c           |    4 ++--
 arch/x86/kernel/tsc.c             |    4 ++--
 drivers/clocksource/acpi_pm.c     |    2 +-
 drivers/input/joystick/analog.c   |    2 +-
 sound/oss/pas2_pcm.c              |    8 ++++----
 6 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/arch/x86/include/asm/mach_timer.h 
b/arch/x86/include/asm/mach_timer.h
index 8537285..88d0c3c 100644
--- a/arch/x86/include/asm/mach_timer.h
+++ b/arch/x86/include/asm/mach_timer.h
@@ -15,7 +15,7 @@
 
 #define CALIBRATE_TIME_MSEC 30 /* 30 msecs */
 #define CALIBRATE_LATCH	\
-	((CLOCK_TICK_RATE * CALIBRATE_TIME_MSEC + 1000/2)/1000)
+	((PIT_TICK_RATE * CALIBRATE_TIME_MSEC + 1000/2)/1000)
 
 static inline void mach_prepare_counter(void)
 {
diff --git a/arch/x86/kernel/i8253.c b/arch/x86/kernel/i8253.c
index c2e0bb0..5b0ef4e 100644
--- a/arch/x86/kernel/i8253.c
+++ b/arch/x86/kernel/i8253.c
@@ -115,7 +115,7 @@ void __init setup_pit_timer(void)
 	 * IO_APIC has been initialized.
 	 */
 	pit_ce.cpumask = cpumask_of(smp_processor_id());
-	pit_ce.mult = div_sc(CLOCK_TICK_RATE, NSEC_PER_SEC, pit_ce.shift);
+	pit_ce.mult = div_sc(PIT_TICK_RATE, NSEC_PER_SEC, pit_ce.shift);
 	pit_ce.max_delta_ns = clockevent_delta2ns(0x7FFF, &pit_ce);
 	pit_ce.min_delta_ns = clockevent_delta2ns(0xF, &pit_ce);
 
@@ -223,7 +223,7 @@ static int __init init_pit_clocksource(void)
 	    pit_ce.mode != CLOCK_EVT_MODE_PERIODIC)
 		return 0;
 
-	pit_cs.mult = clocksource_hz2mult(CLOCK_TICK_RATE, pit_cs.shift);
+	pit_cs.mult = clocksource_hz2mult(PIT_TICK_RATE, pit_cs.shift);
 
 	return clocksource_register(&pit_cs);
 }
diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c
index d57de05..d1cb3e5 100644
--- a/arch/x86/kernel/tsc.c
+++ b/arch/x86/kernel/tsc.c
@@ -172,11 +172,11 @@ static unsigned long calc_pmtimer_ref(u64 deltatsc, u64 
pm1, u64 pm2)
 }
 
 #define CAL_MS		10
-#define CAL_LATCH	(CLOCK_TICK_RATE / (1000 / CAL_MS))
+#define CAL_LATCH	(PIT_TICK_RATE / (1000 / CAL_MS))
 #define CAL_PIT_LOOPS	1000
 
 #define CAL2_MS		50
-#define CAL2_LATCH	(CLOCK_TICK_RATE / (1000 / CAL2_MS))
+#define CAL2_LATCH	(PIT_TICK_RATE / (1000 / CAL2_MS))
 #define CAL2_PIT_LOOPS	5000
 
 
diff --git a/drivers/clocksource/acpi_pm.c b/drivers/clocksource/acpi_pm.c
index 40bd8c6..8e4c896 100644
--- a/drivers/clocksource/acpi_pm.c
+++ b/drivers/clocksource/acpi_pm.c
@@ -145,7 +145,7 @@ DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_SERVERWORKS, 
PCI_DEVICE_ID_SERVERWORKS_LE,
 #ifndef CONFIG_X86_64
 #include <asm/mach_timer.h>
 #define PMTMR_EXPECTED_RATE \
-  ((CALIBRATE_LATCH * (PMTMR_TICKS_PER_SEC >> 10)) / (CLOCK_TICK_RATE>>10))
+  ((CALIBRATE_LATCH * (PMTMR_TICKS_PER_SEC >> 10)) / (PIT_TICK_RATE>>10))
 /*
  * Some boards have the PMTMR running way too fast. We check
  * the PMTMR rate against PIT channel 2 to catch these cases.
diff --git a/drivers/input/joystick/analog.c b/drivers/input/joystick/analog.c
index 356b3a2..3f99867 100644
--- a/drivers/input/joystick/analog.c
+++ b/drivers/input/joystick/analog.c
@@ -139,7 +139,7 @@ struct analog_port {
 #include <asm/i8253.h>
 
 #define GET_TIME(x)	do { if (cpu_has_tsc) rdtscl(x); else x = get_time_pit(); 
} while (0)
-#define DELTA(x,y)	(cpu_has_tsc ? ((y) - (x)) : ((x) - (y) + ((x) < (y) ? 
CLOCK_TICK_RATE / HZ : 0)))
+#define DELTA(x,y)	(cpu_has_tsc ? ((y) - (x)) : ((x) - (y) + ((x) < (y) ? 
PIT_TICK_RATE / HZ : 0)))
 #define TIME_NAME	(cpu_has_tsc?"TSC":"PIT")
 static unsigned int get_time_pit(void)
 {
diff --git a/sound/oss/pas2_pcm.c b/sound/oss/pas2_pcm.c
index 36c3ea6..0891e3b 100644
--- a/sound/oss/pas2_pcm.c
+++ b/sound/oss/pas2_pcm.c
@@ -63,13 +63,13 @@ static int pcm_set_speed(int arg)
 
 	if (pcm_channels & 2)
 	{
-		foo = ((CLOCK_TICK_RATE / 2) + (arg / 2)) / arg;
-		arg = ((CLOCK_TICK_RATE / 2) + (foo / 2)) / foo;
+		foo = ((PIT_TICK_RATE / 2) + (arg / 2)) / arg;
+		arg = ((PIT_TICK_RATE / 2) + (foo / 2)) / foo;
 	}
 	else
 	{
-		foo = (CLOCK_TICK_RATE + (arg / 2)) / arg;
-		arg = (CLOCK_TICK_RATE + (foo / 2)) / foo;
+		foo = (PIT_TICK_RATE + (arg / 2)) / arg;
+		arg = (PIT_TICK_RATE + (foo / 2)) / foo;
 	}
 
 	pcm_speed = arg;
-- 
1.6.0.4

-- 



^ permalink raw reply related	[flat|nested] 86+ messages in thread

* Re: [PATCH] scsi: libsas depends on HAS_DMA
  2009-05-11 22:40 ` [PATCH] scsi: libsas " Arnd Bergmann
@ 2009-05-11 22:50   ` James Bottomley
  2009-05-11 22:59     ` James Bottomley
  0 siblings, 1 reply; 86+ messages in thread
From: James Bottomley @ 2009-05-11 22:50 UTC (permalink / raw)
  To: Arnd Bergmann; +Cc: linux-kernel, linux-scsi

On Mon, 2009-05-11 at 22:40 +0000, Arnd Bergmann wrote:
> libsas uses the DMA mapping API, so it cannot be
> built on architectures that don't support DMA.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  drivers/scsi/libsas/Kconfig |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/scsi/libsas/Kconfig b/drivers/scsi/libsas/Kconfig
> index 18f33cd..59e00fa 100644
> --- a/drivers/scsi/libsas/Kconfig
> +++ b/drivers/scsi/libsas/Kconfig
> @@ -24,7 +24,7 @@
>  
>  config SCSI_SAS_LIBSAS
>  	tristate "SAS Domain Transport Attributes"
> -	depends on SCSI
> +	depends on SCSI && HAS_DMA

Our unfortunate Kconfig system can cause problems if you do this:
SCSI_SAS_LIBSAS is used as a select for drivers that need it, so either
they'd need to select this themselves, or you need some other solution.

James



^ permalink raw reply	[flat|nested] 86+ messages in thread

* [PATCH] move PIT_TICK_RATE to linux/timex.h
       [not found] <20090511222702.352192505@arndb.de>
@ 2009-05-11 22:55   ` Arnd Bergmann
  2009-05-11 22:38 ` [PATCH] ata: libata depends on HAS_DMA Arnd Bergmann
                     ` (9 subsequent siblings)
  10 siblings, 0 replies; 86+ messages in thread
From: Arnd Bergmann @ 2009-05-11 22:55 UTC (permalink / raw)
  To: linux-arch, x86, Richard Henderson, Ralf Baechle, Takashi Iwai,
	Dmitry Torokhov, Ingo Molnar, Andrew Morton
  Cc: linux-kernel, Alan Cox

PIT_TICK_RATE is currently defined in four architectures,
but in three different places. While linux/timex.h is not
the perfect place for it, it is still a reasonable replacement
for those drivers that traditionally use asm/timex.h to
get CLOCK_TICK_RATE and expect it to be the PIT frequency.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/alpha/include/asm/8253pit.h   |    7 -------
 arch/alpha/kernel/sys_ruffian.c    |    1 +
 arch/mips/include/asm/i8253.h      |    2 --
 arch/powerpc/include/asm/8253pit.h |    7 -------
 arch/x86/include/asm/timex.h       |    4 +---
 arch/x86/kernel/i8253.c            |    1 +
 arch/x86/kernel/tsc.c              |    1 +
 drivers/clocksource/acpi_pm.c      |    1 +
 drivers/input/joystick/analog.c    |    2 +-
 drivers/input/misc/pcspkr.c        |    1 +
 include/linux/timex.h              |    3 +++
 sound/drivers/pcsp/pcsp.h          |    1 +
 sound/oss/pas2_pcm.c               |    2 +-
 13 files changed, 12 insertions(+), 21 deletions(-)

diff --git a/arch/alpha/include/asm/8253pit.h 
b/arch/alpha/include/asm/8253pit.h
index fef5c14..a71c9c1 100644
--- a/arch/alpha/include/asm/8253pit.h
+++ b/arch/alpha/include/asm/8253pit.h
@@ -1,10 +1,3 @@
 /*
  * 8253/8254 Programmable Interval Timer
  */
-
-#ifndef _8253PIT_H
-#define _8253PIT_H
-
-#define PIT_TICK_RATE 	1193180UL
-
-#endif
diff --git a/arch/alpha/kernel/sys_ruffian.c b/arch/alpha/kernel/sys_ruffian.c
index f15a329..d9f9cfe 100644
--- a/arch/alpha/kernel/sys_ruffian.c
+++ b/arch/alpha/kernel/sys_ruffian.c
@@ -14,6 +14,7 @@
 #include <linux/sched.h>
 #include <linux/pci.h>
 #include <linux/ioport.h>
+#include <linux/timex.h>
 #include <linux/init.h>
 
 #include <asm/ptrace.h>
diff --git a/arch/mips/include/asm/i8253.h b/arch/mips/include/asm/i8253.h
index 5dabc87..032ca73 100644
--- a/arch/mips/include/asm/i8253.h
+++ b/arch/mips/include/asm/i8253.h
@@ -12,8 +12,6 @@
 #define PIT_CH0			0x40
 #define PIT_CH2			0x42
 
-#define PIT_TICK_RATE		1193182UL
-
 extern spinlock_t i8253_lock;
 
 extern void setup_pit_timer(void);
diff --git a/arch/powerpc/include/asm/8253pit.h 
b/arch/powerpc/include/asm/8253pit.h
index b70d6e5..a71c9c1 100644
--- a/arch/powerpc/include/asm/8253pit.h
+++ b/arch/powerpc/include/asm/8253pit.h
@@ -1,10 +1,3 @@
-#ifndef _ASM_POWERPC_8253PIT_H
-#define _ASM_POWERPC_8253PIT_H
-
 /*
  * 8253/8254 Programmable Interval Timer
  */
-
-#define PIT_TICK_RATE	1193182UL
-
-#endif	/* _ASM_POWERPC_8253PIT_H */
diff --git a/arch/x86/include/asm/timex.h b/arch/x86/include/asm/timex.h
index b5c9d45..1375cfc 100644
--- a/arch/x86/include/asm/timex.h
+++ b/arch/x86/include/asm/timex.h
@@ -4,9 +4,7 @@
 #include <asm/processor.h>
 #include <asm/tsc.h>
 
-/* The PIT ticks at this frequency (in HZ): */
-#define PIT_TICK_RATE		1193182
-
+/* Assume we use the PIT time source for the clock tick */
 #define CLOCK_TICK_RATE		PIT_TICK_RATE
 
 #define ARCH_HAS_READ_CURRENT_TIMER
diff --git a/arch/x86/kernel/i8253.c b/arch/x86/kernel/i8253.c
index 5b0ef4e..3e5ec80 100644
--- a/arch/x86/kernel/i8253.c
+++ b/arch/x86/kernel/i8253.c
@@ -7,6 +7,7 @@
 #include <linux/spinlock.h>
 #include <linux/jiffies.h>
 #include <linux/module.h>
+#include <linux/timex.h>
 #include <linux/delay.h>
 #include <linux/init.h>
 #include <linux/io.h>
diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c
index d1cb3e5..5c627ff 100644
--- a/arch/x86/kernel/tsc.c
+++ b/arch/x86/kernel/tsc.c
@@ -9,6 +9,7 @@
 #include <linux/delay.h>
 #include <linux/clocksource.h>
 #include <linux/percpu.h>
+#include <linux/timex.h>
 
 #include <asm/hpet.h>
 #include <asm/timer.h>
diff --git a/drivers/clocksource/acpi_pm.c b/drivers/clocksource/acpi_pm.c
index 8e4c896..f6d351c 100644
--- a/drivers/clocksource/acpi_pm.c
+++ b/drivers/clocksource/acpi_pm.c
@@ -18,6 +18,7 @@
 
 #include <linux/acpi_pmtmr.h>
 #include <linux/clocksource.h>
+#include <linux/timex.h>
 #include <linux/errno.h>
 #include <linux/init.h>
 #include <linux/pci.h>
diff --git a/drivers/input/joystick/analog.c b/drivers/input/joystick/analog.c
index 3f99867..5776f72 100644
--- a/drivers/input/joystick/analog.c
+++ b/drivers/input/joystick/analog.c
@@ -35,7 +35,7 @@
 #include <linux/input.h>
 #include <linux/gameport.h>
 #include <linux/jiffies.h>
-#include <asm/timex.h>
+#include <linux/timex.h>
 
 #define DRIVER_DESC	"Analog joystick and gamepad driver"
 
diff --git a/drivers/input/misc/pcspkr.c b/drivers/input/misc/pcspkr.c
index d6a30ce..6d67af5 100644
--- a/drivers/input/misc/pcspkr.c
+++ b/drivers/input/misc/pcspkr.c
@@ -17,6 +17,7 @@
 #include <linux/init.h>
 #include <linux/input.h>
 #include <linux/platform_device.h>
+#include <linux/timex.h>
 #include <asm/io.h>
 
 MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>");
diff --git a/include/linux/timex.h b/include/linux/timex.h
index aa3475f..66cbf74 100644
--- a/include/linux/timex.h
+++ b/include/linux/timex.h
@@ -260,6 +260,9 @@ extern int do_adjtimex(struct timex *);
 
 int read_current_timer(unsigned long *timer_val);
 
+/* The clock frequency of the i8253/i8254 PIT */
+#define PIT_TICK_RATE 1193182ul
+
 #endif /* KERNEL */
 
 #endif /* LINUX_TIMEX_H */
diff --git a/sound/drivers/pcsp/pcsp.h b/sound/drivers/pcsp/pcsp.h
index cdef266..174dd2f 100644
--- a/sound/drivers/pcsp/pcsp.h
+++ b/sound/drivers/pcsp/pcsp.h
@@ -10,6 +10,7 @@
 #define __PCSP_H__
 
 #include <linux/hrtimer.h>
+#include <linux/timex.h>
 #if defined(CONFIG_MIPS) || defined(CONFIG_X86)
 /* Use the global PIT lock ! */
 #include <asm/i8253.h>
diff --git a/sound/oss/pas2_pcm.c b/sound/oss/pas2_pcm.c
index 0891e3b..6f13ab4 100644
--- a/sound/oss/pas2_pcm.c
+++ b/sound/oss/pas2_pcm.c
@@ -17,7 +17,7 @@
 
 #include <linux/init.h>
 #include <linux/spinlock.h>
-#include <asm/timex.h>
+#include <linux/timex.h>
 #include "sound_config.h"
 
 #include "pas2.h"
-- 
1.6.0.4

-- 




^ permalink raw reply related	[flat|nested] 86+ messages in thread

* [PATCH] move PIT_TICK_RATE to linux/timex.h
@ 2009-05-11 22:55   ` Arnd Bergmann
  0 siblings, 0 replies; 86+ messages in thread
From: Arnd Bergmann @ 2009-05-11 22:55 UTC (permalink / raw)
  To: linux-arch, x86, Richard Henderson, Ralf Baechle, Takashi Iwai,
	Dmitry Torokhov
  Cc: linux-kernel, Alan Cox

PIT_TICK_RATE is currently defined in four architectures,
but in three different places. While linux/timex.h is not
the perfect place for it, it is still a reasonable replacement
for those drivers that traditionally use asm/timex.h to
get CLOCK_TICK_RATE and expect it to be the PIT frequency.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/alpha/include/asm/8253pit.h   |    7 -------
 arch/alpha/kernel/sys_ruffian.c    |    1 +
 arch/mips/include/asm/i8253.h      |    2 --
 arch/powerpc/include/asm/8253pit.h |    7 -------
 arch/x86/include/asm/timex.h       |    4 +---
 arch/x86/kernel/i8253.c            |    1 +
 arch/x86/kernel/tsc.c              |    1 +
 drivers/clocksource/acpi_pm.c      |    1 +
 drivers/input/joystick/analog.c    |    2 +-
 drivers/input/misc/pcspkr.c        |    1 +
 include/linux/timex.h              |    3 +++
 sound/drivers/pcsp/pcsp.h          |    1 +
 sound/oss/pas2_pcm.c               |    2 +-
 13 files changed, 12 insertions(+), 21 deletions(-)

diff --git a/arch/alpha/include/asm/8253pit.h 
b/arch/alpha/include/asm/8253pit.h
index fef5c14..a71c9c1 100644
--- a/arch/alpha/include/asm/8253pit.h
+++ b/arch/alpha/include/asm/8253pit.h
@@ -1,10 +1,3 @@
 /*
  * 8253/8254 Programmable Interval Timer
  */
-
-#ifndef _8253PIT_H
-#define _8253PIT_H
-
-#define PIT_TICK_RATE 	1193180UL
-
-#endif
diff --git a/arch/alpha/kernel/sys_ruffian.c b/arch/alpha/kernel/sys_ruffian.c
index f15a329..d9f9cfe 100644
--- a/arch/alpha/kernel/sys_ruffian.c
+++ b/arch/alpha/kernel/sys_ruffian.c
@@ -14,6 +14,7 @@
 #include <linux/sched.h>
 #include <linux/pci.h>
 #include <linux/ioport.h>
+#include <linux/timex.h>
 #include <linux/init.h>
 
 #include <asm/ptrace.h>
diff --git a/arch/mips/include/asm/i8253.h b/arch/mips/include/asm/i8253.h
index 5dabc87..032ca73 100644
--- a/arch/mips/include/asm/i8253.h
+++ b/arch/mips/include/asm/i8253.h
@@ -12,8 +12,6 @@
 #define PIT_CH0			0x40
 #define PIT_CH2			0x42
 
-#define PIT_TICK_RATE		1193182UL
-
 extern spinlock_t i8253_lock;
 
 extern void setup_pit_timer(void);
diff --git a/arch/powerpc/include/asm/8253pit.h 
b/arch/powerpc/include/asm/8253pit.h
index b70d6e5..a71c9c1 100644
--- a/arch/powerpc/include/asm/8253pit.h
+++ b/arch/powerpc/include/asm/8253pit.h
@@ -1,10 +1,3 @@
-#ifndef _ASM_POWERPC_8253PIT_H
-#define _ASM_POWERPC_8253PIT_H
-
 /*
  * 8253/8254 Programmable Interval Timer
  */
-
-#define PIT_TICK_RATE	1193182UL
-
-#endif	/* _ASM_POWERPC_8253PIT_H */
diff --git a/arch/x86/include/asm/timex.h b/arch/x86/include/asm/timex.h
index b5c9d45..1375cfc 100644
--- a/arch/x86/include/asm/timex.h
+++ b/arch/x86/include/asm/timex.h
@@ -4,9 +4,7 @@
 #include <asm/processor.h>
 #include <asm/tsc.h>
 
-/* The PIT ticks at this frequency (in HZ): */
-#define PIT_TICK_RATE		1193182
-
+/* Assume we use the PIT time source for the clock tick */
 #define CLOCK_TICK_RATE		PIT_TICK_RATE
 
 #define ARCH_HAS_READ_CURRENT_TIMER
diff --git a/arch/x86/kernel/i8253.c b/arch/x86/kernel/i8253.c
index 5b0ef4e..3e5ec80 100644
--- a/arch/x86/kernel/i8253.c
+++ b/arch/x86/kernel/i8253.c
@@ -7,6 +7,7 @@
 #include <linux/spinlock.h>
 #include <linux/jiffies.h>
 #include <linux/module.h>
+#include <linux/timex.h>
 #include <linux/delay.h>
 #include <linux/init.h>
 #include <linux/io.h>
diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c
index d1cb3e5..5c627ff 100644
--- a/arch/x86/kernel/tsc.c
+++ b/arch/x86/kernel/tsc.c
@@ -9,6 +9,7 @@
 #include <linux/delay.h>
 #include <linux/clocksource.h>
 #include <linux/percpu.h>
+#include <linux/timex.h>
 
 #include <asm/hpet.h>
 #include <asm/timer.h>
diff --git a/drivers/clocksource/acpi_pm.c b/drivers/clocksource/acpi_pm.c
index 8e4c896..f6d351c 100644
--- a/drivers/clocksource/acpi_pm.c
+++ b/drivers/clocksource/acpi_pm.c
@@ -18,6 +18,7 @@
 
 #include <linux/acpi_pmtmr.h>
 #include <linux/clocksource.h>
+#include <linux/timex.h>
 #include <linux/errno.h>
 #include <linux/init.h>
 #include <linux/pci.h>
diff --git a/drivers/input/joystick/analog.c b/drivers/input/joystick/analog.c
index 3f99867..5776f72 100644
--- a/drivers/input/joystick/analog.c
+++ b/drivers/input/joystick/analog.c
@@ -35,7 +35,7 @@
 #include <linux/input.h>
 #include <linux/gameport.h>
 #include <linux/jiffies.h>
-#include <asm/timex.h>
+#include <linux/timex.h>
 
 #define DRIVER_DESC	"Analog joystick and gamepad driver"
 
diff --git a/drivers/input/misc/pcspkr.c b/drivers/input/misc/pcspkr.c
index d6a30ce..6d67af5 100644
--- a/drivers/input/misc/pcspkr.c
+++ b/drivers/input/misc/pcspkr.c
@@ -17,6 +17,7 @@
 #include <linux/init.h>
 #include <linux/input.h>
 #include <linux/platform_device.h>
+#include <linux/timex.h>
 #include <asm/io.h>
 
 MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>");
diff --git a/include/linux/timex.h b/include/linux/timex.h
index aa3475f..66cbf74 100644
--- a/include/linux/timex.h
+++ b/include/linux/timex.h
@@ -260,6 +260,9 @@ extern int do_adjtimex(struct timex *);
 
 int read_current_timer(unsigned long *timer_val);
 
+/* The clock frequency of the i8253/i8254 PIT */
+#define PIT_TICK_RATE 1193182ul
+
 #endif /* KERNEL */
 
 #endif /* LINUX_TIMEX_H */
diff --git a/sound/drivers/pcsp/pcsp.h b/sound/drivers/pcsp/pcsp.h
index cdef266..174dd2f 100644
--- a/sound/drivers/pcsp/pcsp.h
+++ b/sound/drivers/pcsp/pcsp.h
@@ -10,6 +10,7 @@
 #define __PCSP_H__
 
 #include <linux/hrtimer.h>
+#include <linux/timex.h>
 #if defined(CONFIG_MIPS) || defined(CONFIG_X86)
 /* Use the global PIT lock ! */
 #include <asm/i8253.h>
diff --git a/sound/oss/pas2_pcm.c b/sound/oss/pas2_pcm.c
index 0891e3b..6f13ab4 100644
--- a/sound/oss/pas2_pcm.c
+++ b/sound/oss/pas2_pcm.c
@@ -17,7 +17,7 @@
 
 #include <linux/init.h>
 #include <linux/spinlock.h>
-#include <asm/timex.h>
+#include <linux/timex.h>
 #include "sound_config.h"
 
 #include "pas2.h"
-- 
1.6.0.4

-- 

^ permalink raw reply related	[flat|nested] 86+ messages in thread

* [PATCH] mips: use PIT_TICK_RATE in i8253
       [not found] <20090511222702.352192505@arndb.de>
                   ` (5 preceding siblings ...)
  2009-05-11 22:55   ` Arnd Bergmann
@ 2009-05-11 22:57 ` Arnd Bergmann
  2009-05-11 22:58 ` [PATCH] input: use PIT_TICK_RATE in vt beep ioctl Arnd Bergmann
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 86+ messages in thread
From: Arnd Bergmann @ 2009-05-11 22:57 UTC (permalink / raw)
  To: linux-kernel, Ralf Baechle

Using PIT_TICK_RATE instead of CLOCK_TICK_RATE allows
us to later change CLOCK_TICK_RATE to a more sensible
time base value for platforms that do not base their
system timer off an i8253.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/mips/kernel/i8253.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/mips/kernel/i8253.c b/arch/mips/kernel/i8253.c
index ed20e7f..3545419 100644
--- a/arch/mips/kernel/i8253.c
+++ b/arch/mips/kernel/i8253.c
@@ -8,6 +8,7 @@
 #include <linux/jiffies.h>
 #include <linux/module.h>
 #include <linux/spinlock.h>
+#include <linux/timex.h>
 
 #include <asm/delay.h>
 #include <asm/i8253.h>
@@ -115,7 +116,7 @@ void __init setup_pit_timer(void)
 	 * IO_APIC has been initialized.
 	 */
 	cd->cpumask = cpumask_of(cpu);
-	clockevent_set_clock(cd, CLOCK_TICK_RATE);
+	clockevent_set_clock(cd, PIT_TICK_RATE);
 	cd->max_delta_ns = clockevent_delta2ns(0x7FFF, cd);
 	cd->min_delta_ns = clockevent_delta2ns(0xF, cd);
 	clockevents_register_device(cd);
@@ -203,7 +204,7 @@ static int __init init_pit_clocksource(void)
 	if (num_possible_cpus() > 1) /* PIT does not scale! */
 		return 0;
 
-	clocksource_pit.mult = clocksource_hz2mult(CLOCK_TICK_RATE, 20);
+	clocksource_pit.mult = clocksource_hz2mult(PIT_TICK_RATE, 20);
 	return clocksource_register(&clocksource_pit);
 }
 arch_initcall(init_pit_clocksource);
-- 
1.6.0.4

-- 



^ permalink raw reply related	[flat|nested] 86+ messages in thread

* [PATCH] input: use PIT_TICK_RATE in vt beep ioctl
       [not found] <20090511222702.352192505@arndb.de>
                   ` (6 preceding siblings ...)
  2009-05-11 22:57 ` [PATCH] mips: use PIT_TICK_RATE in i8253 Arnd Bergmann
@ 2009-05-11 22:58 ` Arnd Bergmann
  2009-05-12  9:31   ` Alan Cox
  2009-05-11 22:59 ` [PATCH] x86: fix ktermios-termio conversion Arnd Bergmann
                   ` (2 subsequent siblings)
  10 siblings, 1 reply; 86+ messages in thread
From: Arnd Bergmann @ 2009-05-11 22:58 UTC (permalink / raw)
  To: linux-kernel, Alan Cox; +Cc: Dmitry Torokhov, linux-input

The KIOCSOUND and KDMKTONE ioctls are based on the
CLOCK_TICK_RATE, which is architecture and sometimes
configuration specific.

In practice, most user applications assume that it
is actually defined as the i8253 PIT base clock of
1193182 Hz, which is true on some architectures
but not on others.

This patch makes the vt code use the PIT frequency
on all architectures, which is much more well-defined.
It will change the behavior of user applications
sending the beep ioctl on all architectures that
define CLOCK_TICK_RATE different from PIT_TICK_RATE.

Hopefully, this change will make the frequency correct
in more cases than it will make it incorrect.

This patch depends on "move PIT_TICK_RATE to linux/timex.h"
in order to build on architectures that previously did not
define PIT_TICK_RATE.

Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: linux-input@vger.kernel.org
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/char/vt_ioctl.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/char/vt_ioctl.c b/drivers/char/vt_ioctl.c
index e6ce632..00f96b6 100644
--- a/drivers/char/vt_ioctl.c
+++ b/drivers/char/vt_ioctl.c
@@ -404,7 +404,7 @@ int vt_ioctl(struct tty_struct *tty, struct file * file,
 		   supported and somehow separate the historic advertised
 		   tick rate from any real one */
 		if (arg)
-			arg = CLOCK_TICK_RATE / arg;
+			arg = PIT_TICK_RATE / arg;
 		kd_mksound(arg, 0);
 		break;
 
@@ -424,7 +424,7 @@ int vt_ioctl(struct tty_struct *tty, struct file * file,
 		   supported and somehow separate the historic advertised
 		   tick rate from any real one */
 		if (count)
-			count = CLOCK_TICK_RATE / count;
+			count = PIT_TICK_RATE / count;
 		kd_mksound(count, ticks);
 		break;
 	}
-- 
1.6.0.4

-- 



^ permalink raw reply related	[flat|nested] 86+ messages in thread

* [PATCH] x86: fix ktermios-termio conversion
       [not found] <20090511222702.352192505@arndb.de>
                   ` (7 preceding siblings ...)
  2009-05-11 22:58 ` [PATCH] input: use PIT_TICK_RATE in vt beep ioctl Arnd Bergmann
@ 2009-05-11 22:59 ` Arnd Bergmann
  2009-05-11 23:19   ` [PATCH v2] " Arnd Bergmann
  2009-05-11 23:02 ` [PATCH] ipc: use __ARCH_WANT_IPC_PARSE_VERSION in ipc/util.h Arnd Bergmann
  2009-05-11 23:03 ` [PATCH] syscalls.h add the missing sys_pipe2 declaration Arnd Bergmann
  10 siblings, 1 reply; 86+ messages in thread
From: Arnd Bergmann @ 2009-05-11 22:59 UTC (permalink / raw)
  To: x86; +Cc: linux-kernel, Remis Lima Baima

The operation with the variable 'c_line' was missing in the function
'user_termio_to_kernel_termios'. Also the casting '*(unsigned short *)'
in the macro 'SET_LOW_TERMIOS_BITS' was a bit 'unhealthy'. So the macro
was removed and the function was changed to be like in other archs
(e.g. h8300, m68k, sparc) that have a more elegant solution.

In the function 'kernel_termios_to_user_termio' the return values of
the functions calls 'put_user' and 'copy_to_user' were not being
checked.

Signed-off-by: Remis Lima Baima <remis.developer@googlemail.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/x86/include/asm/termios.h |   54 +++++++++++++++++++++++++++------------
 1 files changed, 37 insertions(+), 17 deletions(-)

diff --git a/arch/x86/include/asm/termios.h b/arch/x86/include/asm/termios.h
index f729563..47420df 100644
--- a/arch/x86/include/asm/termios.h
+++ b/arch/x86/include/asm/termios.h
@@ -54,20 +54,37 @@ struct termio {
 /*
  * Translate a "termio" structure into a "termios". Ugh.
  */
-#define SET_LOW_TERMIOS_BITS(termios, termio, x) { \
-	unsigned short __tmp; \
-	get_user(__tmp,&(termio)->x); \
-	*(unsigned short *) &(termios)->x = __tmp; \
-}
-
 static inline int user_termio_to_kernel_termios(struct ktermios *termios,
 						struct termio __user *termio)
 {
-	SET_LOW_TERMIOS_BITS(termios, termio, c_iflag);
-	SET_LOW_TERMIOS_BITS(termios, termio, c_oflag);
-	SET_LOW_TERMIOS_BITS(termios, termio, c_cflag);
-	SET_LOW_TERMIOS_BITS(termios, termio, c_lflag);
-	return copy_from_user(termios->c_cc, termio->c_cc, NCC);
+	unsigned short tmp;
+
+	if (get_user(tmp, &termio->c_iflag) < 0)
+		goto fault;
+	termios->c_iflag = (0xffff0000 & termios->c_iflag) | tmp;
+
+	if (get_user(tmp, &termio->c_oflag) < 0)
+		goto fault;
+	termios->c_oflag = (0xffff0000 & termios->c_oflag) | tmp;
+
+	if (get_user(tmp, &termio->c_cflag) < 0)
+		goto fault;
+	termios->c_cflag = (0xffff0000 & termios->c_cflag) | tmp;
+
+	if (get_user(tmp, &termio->c_lflag) < 0)
+		goto fault;
+	termios->c_lflag = (0xffff0000 & termios->c_lflag) | tmp;
+
+	if (get_user(termios->c_line, &termio->c_line) < 0)
+		goto fault;
+
+	if (copy_from_user(termios->c_cc, termio->c_cc, NCC) != 0)
+		goto fault;
+
+	return 0;
+
+ fault:
+	return -EFAULT;
 }
 
 /*
@@ -76,12 +93,15 @@ static inline int user_termio_to_kernel_termios(struct 
ktermios *termios,
 static inline int kernel_termios_to_user_termio(struct termio __user *termio,
 					    struct ktermios *termios)
 {
-	put_user((termios)->c_iflag, &(termio)->c_iflag);
-	put_user((termios)->c_oflag, &(termio)->c_oflag);
-	put_user((termios)->c_cflag, &(termio)->c_cflag);
-	put_user((termios)->c_lflag, &(termio)->c_lflag);
-	put_user((termios)->c_line,  &(termio)->c_line);
-	return copy_to_user((termio)->c_cc, (termios)->c_cc, NCC);
+	if (put_user(termios->c_iflag, &termio->c_iflag) < 0 ||
+	    put_user(termios->c_oflag, &termio->c_oflag) < 0 ||
+	    put_user(termios->c_cflag, &termio->c_cflag) < 0 ||
+	    put_user(termios->c_lflag, &termio->c_lflag) < 0 ||
+	    put_user(termios->c_line,  &termio->c_line) < 0 ||
+	    copy_to_user(termio->c_cc, termios->c_cc, NCC) != 0)
+		return -EFAULT;
+
+	return 0;
 }
 
 static inline int user_termios_to_kernel_termios(struct ktermios *k,
-- 
1.6.0.4

-- 




^ permalink raw reply related	[flat|nested] 86+ messages in thread

* Re: [PATCH] scsi: libsas depends on HAS_DMA
  2009-05-11 22:50   ` James Bottomley
@ 2009-05-11 22:59     ` James Bottomley
  2009-05-11 23:16       ` Arnd Bergmann
  0 siblings, 1 reply; 86+ messages in thread
From: James Bottomley @ 2009-05-11 22:59 UTC (permalink / raw)
  To: Arnd Bergmann; +Cc: linux-kernel, linux-scsi

On Mon, 2009-05-11 at 22:50 +0000, James Bottomley wrote:
> On Mon, 2009-05-11 at 22:40 +0000, Arnd Bergmann wrote:
> > libsas uses the DMA mapping API, so it cannot be
> > built on architectures that don't support DMA.
> > 
> > Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> > ---
> >  drivers/scsi/libsas/Kconfig |    2 +-
> >  1 files changed, 1 insertions(+), 1 deletions(-)
> > 
> > diff --git a/drivers/scsi/libsas/Kconfig b/drivers/scsi/libsas/Kconfig
> > index 18f33cd..59e00fa 100644
> > --- a/drivers/scsi/libsas/Kconfig
> > +++ b/drivers/scsi/libsas/Kconfig
> > @@ -24,7 +24,7 @@
> >  
> >  config SCSI_SAS_LIBSAS
> >  	tristate "SAS Domain Transport Attributes"
> > -	depends on SCSI
> > +	depends on SCSI && HAS_DMA
> 
> Our unfortunate Kconfig system can cause problems if you do this:
> SCSI_SAS_LIBSAS is used as a select for drivers that need it, so either
> they'd need to select this themselves, or you need some other solution.

Actually, looking at this further, the problem is only in the ata
compatibility layer because of the way libata does dma mapping on behalf
of drivers, so the solution below (just disable SATA support if HAS_DMA
isn't defined) will work without requiring select dependency
modification.

James

---

diff --git a/drivers/scsi/libsas/Kconfig b/drivers/scsi/libsas/Kconfig
index 18f33cd..f462a0e 100644
--- a/drivers/scsi/libsas/Kconfig
+++ b/drivers/scsi/libsas/Kconfig
@@ -33,6 +33,7 @@ config SCSI_SAS_LIBSAS
 config SCSI_SAS_ATA
 	bool "ATA support for libsas (requires libata)"
 	depends on SCSI_SAS_LIBSAS
+	depends on HAS_DMA
 	depends on ATA = y || ATA = SCSI_SAS_LIBSAS
 	help
 		Builds in ATA support into libsas.  Will necessitate



^ permalink raw reply related	[flat|nested] 86+ messages in thread

* [PATCH] ipc: use __ARCH_WANT_IPC_PARSE_VERSION in ipc/util.h
       [not found] <20090511222702.352192505@arndb.de>
                   ` (8 preceding siblings ...)
  2009-05-11 22:59 ` [PATCH] x86: fix ktermios-termio conversion Arnd Bergmann
@ 2009-05-11 23:02 ` Arnd Bergmann
  2009-05-12  0:19   ` Serge E. Hallyn
  2009-05-11 23:03 ` [PATCH] syscalls.h add the missing sys_pipe2 declaration Arnd Bergmann
  10 siblings, 1 reply; 86+ messages in thread
From: Arnd Bergmann @ 2009-05-11 23:02 UTC (permalink / raw)
  To: linux-kernel, Serge E. Hallyn, Cedric Le Goater, Andrew Morton

The definition of ipc_parse_version depends on
__ARCH_WANT_IPC_PARSE_VERSION, but the header file
declares it conditionally based on the architecture.

Use the macro consistently to make it easier to add
new architectures.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 ipc/util.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/ipc/util.h b/ipc/util.h
index 1187332..f9fe90e 100644
--- a/ipc/util.h
+++ b/ipc/util.h
@@ -128,7 +128,7 @@ void ipc_update_perm(struct ipc64_perm *in, struct kern_ipc_perm *out);
 struct kern_ipc_perm *ipcctl_pre_down(struct ipc_ids *ids, int id, int cmd,
 				      struct ipc64_perm *perm, int extra_perm);
 
-#if defined(__ia64__) || defined(__x86_64__) || defined(__hppa__) || defined(__XTENSA__)
+#ifndef __ARCH_WANT_IPC_PARSE_VERSION
   /* On IA-64, we always use the "64-bit version" of the IPC structures.  */ 
 # define ipc_parse_version(cmd)	IPC_64
 #else
-- 
1.6.0.4

-- 



^ permalink raw reply related	[flat|nested] 86+ messages in thread

* [PATCH] syscalls.h add the missing sys_pipe2 declaration
       [not found] <20090511222702.352192505@arndb.de>
                   ` (9 preceding siblings ...)
  2009-05-11 23:02 ` [PATCH] ipc: use __ARCH_WANT_IPC_PARSE_VERSION in ipc/util.h Arnd Bergmann
@ 2009-05-11 23:03 ` Arnd Bergmann
  2009-05-11 23:08   ` Arnd Bergmann
  10 siblings, 1 reply; 86+ messages in thread
From: Arnd Bergmann @ 2009-05-11 23:03 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel, Ulrich Drepper

In order to build the generic syscall table, we need a declaration
for every system call. sys_pipe2 was added without a proper declaration,
so add this to syscalls.h now.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 include/linux/syscalls.h |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index 40617c1..3052084 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -433,6 +433,7 @@ asmlinkage long sys_fcntl(unsigned int fd, unsigned int 
cmd, unsigned long arg);
 asmlinkage long sys_fcntl64(unsigned int fd,
 				unsigned int cmd, unsigned long arg);
 #endif
+asmlinkage long sys_pipe2(int __user *fildes, int flags);
 asmlinkage long sys_dup(unsigned int fildes);
 asmlinkage long sys_dup2(unsigned int oldfd, unsigned int newfd);
 asmlinkage long sys_dup3(unsigned int oldfd, unsigned int newfd, int flags);
-- 
1.6.0.4

-- 



^ permalink raw reply related	[flat|nested] 86+ messages in thread

* Re: [PATCH] x86: use PIT_TICK_RATE consistently
  2009-05-11 22:50 ` [PATCH] x86: use PIT_TICK_RATE consistently Arnd Bergmann
@ 2009-05-11 23:05   ` Arnd Bergmann
  0 siblings, 0 replies; 86+ messages in thread
From: Arnd Bergmann @ 2009-05-11 23:05 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: John Stultz, Dmitry Torokhov, Takashi Iwai, Jaroslav Kysela,
	linux-kernel, x86

>From 5939f98adbf5ae727f0d3fa708247fc855f49dd2 Mon Sep 17 00:00:00 2001
From: Arnd Bergmann <arnd@arndb.de>
Date: Sun, 3 May 2009 22:42:56 +0000
Subject: [PATCH] x86: use PIT_TICK_RATE consistently

On x86, the CLOCK_TICK_RATE is defined in terms of PIT_TICK_RATE,
from the original i8253 PIT frequency. Change all users to
refer to PIT_TICK_RATE directly, in order to reduce the number
of overloaded meanings for CLOCK_TICK_RATE.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---

resend without wordwrap...

 arch/x86/include/asm/mach_timer.h |    2 +-
 arch/x86/kernel/i8253.c           |    4 ++--
 arch/x86/kernel/tsc.c             |    4 ++--
 drivers/clocksource/acpi_pm.c     |    2 +-
 drivers/input/joystick/analog.c   |    2 +-
 sound/oss/pas2_pcm.c              |    8 ++++----
 6 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/arch/x86/include/asm/mach_timer.h b/arch/x86/include/asm/mach_timer.h
index 8537285..88d0c3c 100644
--- a/arch/x86/include/asm/mach_timer.h
+++ b/arch/x86/include/asm/mach_timer.h
@@ -15,7 +15,7 @@
 
 #define CALIBRATE_TIME_MSEC 30 /* 30 msecs */
 #define CALIBRATE_LATCH	\
-	((CLOCK_TICK_RATE * CALIBRATE_TIME_MSEC + 1000/2)/1000)
+	((PIT_TICK_RATE * CALIBRATE_TIME_MSEC + 1000/2)/1000)
 
 static inline void mach_prepare_counter(void)
 {
diff --git a/arch/x86/kernel/i8253.c b/arch/x86/kernel/i8253.c
index c2e0bb0..5b0ef4e 100644
--- a/arch/x86/kernel/i8253.c
+++ b/arch/x86/kernel/i8253.c
@@ -115,7 +115,7 @@ void __init setup_pit_timer(void)
 	 * IO_APIC has been initialized.
 	 */
 	pit_ce.cpumask = cpumask_of(smp_processor_id());
-	pit_ce.mult = div_sc(CLOCK_TICK_RATE, NSEC_PER_SEC, pit_ce.shift);
+	pit_ce.mult = div_sc(PIT_TICK_RATE, NSEC_PER_SEC, pit_ce.shift);
 	pit_ce.max_delta_ns = clockevent_delta2ns(0x7FFF, &pit_ce);
 	pit_ce.min_delta_ns = clockevent_delta2ns(0xF, &pit_ce);
 
@@ -223,7 +223,7 @@ static int __init init_pit_clocksource(void)
 	    pit_ce.mode != CLOCK_EVT_MODE_PERIODIC)
 		return 0;
 
-	pit_cs.mult = clocksource_hz2mult(CLOCK_TICK_RATE, pit_cs.shift);
+	pit_cs.mult = clocksource_hz2mult(PIT_TICK_RATE, pit_cs.shift);
 
 	return clocksource_register(&pit_cs);
 }
diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c
index d57de05..d1cb3e5 100644
--- a/arch/x86/kernel/tsc.c
+++ b/arch/x86/kernel/tsc.c
@@ -172,11 +172,11 @@ static unsigned long calc_pmtimer_ref(u64 deltatsc, u64 pm1, u64 pm2)
 }
 
 #define CAL_MS		10
-#define CAL_LATCH	(CLOCK_TICK_RATE / (1000 / CAL_MS))
+#define CAL_LATCH	(PIT_TICK_RATE / (1000 / CAL_MS))
 #define CAL_PIT_LOOPS	1000
 
 #define CAL2_MS		50
-#define CAL2_LATCH	(CLOCK_TICK_RATE / (1000 / CAL2_MS))
+#define CAL2_LATCH	(PIT_TICK_RATE / (1000 / CAL2_MS))
 #define CAL2_PIT_LOOPS	5000
 
 
diff --git a/drivers/clocksource/acpi_pm.c b/drivers/clocksource/acpi_pm.c
index 40bd8c6..8e4c896 100644
--- a/drivers/clocksource/acpi_pm.c
+++ b/drivers/clocksource/acpi_pm.c
@@ -145,7 +145,7 @@ DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_LE,
 #ifndef CONFIG_X86_64
 #include <asm/mach_timer.h>
 #define PMTMR_EXPECTED_RATE \
-  ((CALIBRATE_LATCH * (PMTMR_TICKS_PER_SEC >> 10)) / (CLOCK_TICK_RATE>>10))
+  ((CALIBRATE_LATCH * (PMTMR_TICKS_PER_SEC >> 10)) / (PIT_TICK_RATE>>10))
 /*
  * Some boards have the PMTMR running way too fast. We check
  * the PMTMR rate against PIT channel 2 to catch these cases.
diff --git a/drivers/input/joystick/analog.c b/drivers/input/joystick/analog.c
index 356b3a2..3f99867 100644
--- a/drivers/input/joystick/analog.c
+++ b/drivers/input/joystick/analog.c
@@ -139,7 +139,7 @@ struct analog_port {
 #include <asm/i8253.h>
 
 #define GET_TIME(x)	do { if (cpu_has_tsc) rdtscl(x); else x = get_time_pit(); } while (0)
-#define DELTA(x,y)	(cpu_has_tsc ? ((y) - (x)) : ((x) - (y) + ((x) < (y) ? CLOCK_TICK_RATE / HZ : 0)))
+#define DELTA(x,y)	(cpu_has_tsc ? ((y) - (x)) : ((x) - (y) + ((x) < (y) ? PIT_TICK_RATE / HZ : 0)))
 #define TIME_NAME	(cpu_has_tsc?"TSC":"PIT")
 static unsigned int get_time_pit(void)
 {
diff --git a/sound/oss/pas2_pcm.c b/sound/oss/pas2_pcm.c
index 36c3ea6..0891e3b 100644
--- a/sound/oss/pas2_pcm.c
+++ b/sound/oss/pas2_pcm.c
@@ -63,13 +63,13 @@ static int pcm_set_speed(int arg)
 
 	if (pcm_channels & 2)
 	{
-		foo = ((CLOCK_TICK_RATE / 2) + (arg / 2)) / arg;
-		arg = ((CLOCK_TICK_RATE / 2) + (foo / 2)) / foo;
+		foo = ((PIT_TICK_RATE / 2) + (arg / 2)) / arg;
+		arg = ((PIT_TICK_RATE / 2) + (foo / 2)) / foo;
 	}
 	else
 	{
-		foo = (CLOCK_TICK_RATE + (arg / 2)) / arg;
-		arg = (CLOCK_TICK_RATE + (foo / 2)) / foo;
+		foo = (PIT_TICK_RATE + (arg / 2)) / arg;
+		arg = (PIT_TICK_RATE + (foo / 2)) / foo;
 	}
 
 	pcm_speed = arg;
-- 
1.6.0.4



^ permalink raw reply related	[flat|nested] 86+ messages in thread

* [PATCH] syscalls.h add the missing sys_pipe2 declaration
  2009-05-11 23:03 ` [PATCH] syscalls.h add the missing sys_pipe2 declaration Arnd Bergmann
@ 2009-05-11 23:08   ` Arnd Bergmann
  0 siblings, 0 replies; 86+ messages in thread
From: Arnd Bergmann @ 2009-05-11 23:08 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel, Ulrich Drepper

In order to build the generic syscall table, we need a declaration
for every system call. sys_pipe2 was added without a proper declaration,
so add this to syscalls.h now.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
re-sent without the wordwrap...

 include/linux/syscalls.h |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index 40617c1..3052084 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -433,6 +433,7 @@ asmlinkage long sys_fcntl(unsigned int fd, unsigned int cmd, unsigned long arg);
 asmlinkage long sys_fcntl64(unsigned int fd,
 				unsigned int cmd, unsigned long arg);
 #endif
+asmlinkage long sys_pipe2(int __user *fildes, int flags);
 asmlinkage long sys_dup(unsigned int fildes);
 asmlinkage long sys_dup2(unsigned int oldfd, unsigned int newfd);
 asmlinkage long sys_dup3(unsigned int oldfd, unsigned int newfd, int flags);
-- 
1.6.0.4


^ permalink raw reply related	[flat|nested] 86+ messages in thread

* [PATCH v2] arm: rename CLOCK_TICK_RATE to ARM_TICK_RATE
  2009-05-11 22:43 ` [PATCH] arm: rename CLOCK_TICK_RATE to ARM_TICK_RATE Arnd Bergmann
@ 2009-05-11 23:11   ` Arnd Bergmann
  2009-05-13 17:11   ` [PATCH] " Arnd Bergmann
  1 sibling, 0 replies; 86+ messages in thread
From: Arnd Bergmann @ 2009-05-11 23:11 UTC (permalink / raw)
  To: Russell King; +Cc: linux-kernel, linux-arch, Alan Cox

Most of the users of CLOCK_TICK_RATE in the kernel outside
of ARM assume that it refers to the i8253 base frequency
of 1.193182 Mhz, while in ARM it actually is the clock
frequency of the timer.

By renaming it to ARM_TICK_RATE for all arm specific
device drivers, we can hopefully reduce the amount
of confusion slightly.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
--

re-sent without the wordwrap...

 arch/arm/mach-aaec2000/include/mach/timex.h   |    2 +-
 arch/arm/mach-at91/include/mach/timex.h       |   16 ++++++++--------
 arch/arm/mach-clps711x/include/mach/timex.h   |    2 +-
 arch/arm/mach-clps711x/time.c                 |    2 +-
 arch/arm/mach-davinci/include/mach/timex.h    |    2 +-
 arch/arm/mach-ebsa110/include/mach/timex.h    |    2 +-
 arch/arm/mach-ep93xx/core.c                   |    2 +-
 arch/arm/mach-ep93xx/include/mach/timex.h     |    2 +-
 arch/arm/mach-footbridge/include/mach/timex.h |    4 ++--
 arch/arm/mach-gemini/include/mach/timex.h     |    2 +-
 arch/arm/mach-h720x/include/mach/timex.h      |    2 +-
 arch/arm/mach-imx/include/mach/timex.h        |    2 +-
 arch/arm/mach-integrator/include/mach/timex.h |    2 +-
 arch/arm/mach-iop13xx/include/mach/timex.h    |    2 +-
 arch/arm/mach-iop32x/include/mach/timex.h     |    2 +-
 arch/arm/mach-iop33x/include/mach/timex.h     |    2 +-
 arch/arm/mach-ixp2000/include/mach/timex.h    |    2 +-
 arch/arm/mach-ixp23xx/core.c                  |    2 +-
 arch/arm/mach-ixp23xx/include/mach/timex.h    |    2 +-
 arch/arm/mach-ixp4xx/include/mach/timex.h     |    4 ++--
 arch/arm/mach-kirkwood/include/mach/timex.h   |    2 +-
 arch/arm/mach-ks8695/include/mach/timex.h     |    2 +-
 arch/arm/mach-ks8695/time.c                   |    6 +++---
 arch/arm/mach-l7200/include/mach/timex.h      |    2 +-
 arch/arm/mach-lh7a40x/include/mach/timex.h    |    4 ++--
 arch/arm/mach-loki/include/mach/timex.h       |    2 +-
 arch/arm/mach-mmp/include/mach/timex.h        |    2 +-
 arch/arm/mach-mmp/time.c                      |    6 +++---
 arch/arm/mach-msm/include/mach/timex.h        |    2 +-
 arch/arm/mach-mv78xx0/include/mach/timex.h    |    2 +-
 arch/arm/mach-netx/include/mach/timex.h       |    2 +-
 arch/arm/mach-netx/time.c                     |    4 ++--
 arch/arm/mach-ns9xxx/include/mach/timex.h     |    4 ++--
 arch/arm/mach-orion5x/include/mach/timex.h    |    2 +-
 arch/arm/mach-pnx4008/include/mach/timex.h    |    2 +-
 arch/arm/mach-pxa/include/mach/timex.h        |   10 +++++-----
 arch/arm/mach-realview/include/mach/timex.h   |    2 +-
 arch/arm/mach-rpc/include/mach/timex.h        |    2 +-
 arch/arm/mach-s3c24a0/include/mach/timex.h    |    2 +-
 arch/arm/mach-sa1100/include/mach/timex.h     |    2 +-
 arch/arm/mach-sa1100/time.c                   |    2 +-
 arch/arm/mach-shark/include/mach/timex.h      |    2 +-
 arch/arm/mach-versatile/include/mach/timex.h  |    2 +-
 arch/arm/mach-w90x900/include/mach/timex.h    |    4 ++--
 arch/arm/plat-mxc/include/mach/timex.h        |    6 +++---
 arch/arm/plat-omap/include/mach/timex.h       |    6 +++---
 arch/arm/plat-s3c/include/mach/timex.h        |    4 ++--
 drivers/rtc/rtc-pxa.c                         |    2 +-
 drivers/serial/serial_ks8695.c                |    2 +-
 drivers/watchdog/davinci_wdt.c                |    4 ++--
 drivers/watchdog/ks8695_wdt.c                 |    2 +-
 51 files changed, 78 insertions(+), 78 deletions(-)

diff --git a/arch/arm/mach-aaec2000/include/mach/timex.h b/arch/arm/mach-aaec2000/include/mach/timex.h
index 6c8edf4..80d82de 100644
--- a/arch/arm/mach-aaec2000/include/mach/timex.h
+++ b/arch/arm/mach-aaec2000/include/mach/timex.h
@@ -13,6 +13,6 @@
 #ifndef __ASM_ARCH_TIMEX_H
 #define __ASM_ARCH_TIMEX_H
 
-#define CLOCK_TICK_RATE		508000
+#define ARM_TICK_RATE		508000
 
 #endif /* __ASM_ARCH_TIMEX_H */
diff --git a/arch/arm/mach-at91/include/mach/timex.h b/arch/arm/mach-at91/include/mach/timex.h
index d84c994..86215f1 100644
--- a/arch/arm/mach-at91/include/mach/timex.h
+++ b/arch/arm/mach-at91/include/mach/timex.h
@@ -25,7 +25,7 @@
 
 #if defined(CONFIG_ARCH_AT91RM9200)
 
-#define CLOCK_TICK_RATE		(AT91_SLOW_CLOCK)
+#define ARM_TICK_RATE		(AT91_SLOW_CLOCK)
 
 #elif defined(CONFIG_ARCH_AT91SAM9260)
 
@@ -35,12 +35,12 @@
 #define AT91SAM9_MASTER_CLOCK	99300000
 #endif
 
-#define CLOCK_TICK_RATE		(AT91SAM9_MASTER_CLOCK/16)
+#define ARM_TICK_RATE		(AT91SAM9_MASTER_CLOCK/16)
 
 #elif defined(CONFIG_ARCH_AT91SAM9261)
 
 #define AT91SAM9_MASTER_CLOCK	99300000
-#define CLOCK_TICK_RATE		(AT91SAM9_MASTER_CLOCK/16)
+#define ARM_TICK_RATE		(AT91SAM9_MASTER_CLOCK/16)
 
 #elif defined(CONFIG_ARCH_AT91SAM9263)
 
@@ -50,27 +50,27 @@
 #define AT91SAM9_MASTER_CLOCK	99959500
 #endif
 
-#define CLOCK_TICK_RATE		(AT91SAM9_MASTER_CLOCK/16)
+#define ARM_TICK_RATE		(AT91SAM9_MASTER_CLOCK/16)
 
 #elif defined(CONFIG_ARCH_AT91SAM9RL)
 
 #define AT91SAM9_MASTER_CLOCK	100000000
-#define CLOCK_TICK_RATE		(AT91SAM9_MASTER_CLOCK/16)
+#define ARM_TICK_RATE		(AT91SAM9_MASTER_CLOCK/16)
 
 #elif defined(CONFIG_ARCH_AT91SAM9G20)
 
 #define AT91SAM9_MASTER_CLOCK	132096000
-#define CLOCK_TICK_RATE		(AT91SAM9_MASTER_CLOCK/16)
+#define ARM_TICK_RATE		(AT91SAM9_MASTER_CLOCK/16)
 
 #elif defined(CONFIG_ARCH_AT91CAP9)
 
 #define AT91CAP9_MASTER_CLOCK	100000000
-#define CLOCK_TICK_RATE		(AT91CAP9_MASTER_CLOCK/16)
+#define ARM_TICK_RATE		(AT91CAP9_MASTER_CLOCK/16)
 
 #elif defined(CONFIG_ARCH_AT91X40)
 
 #define AT91X40_MASTER_CLOCK	40000000
-#define CLOCK_TICK_RATE		(AT91X40_MASTER_CLOCK)
+#define ARM_TICK_RATE		(AT91X40_MASTER_CLOCK)
 
 #endif
 
diff --git a/arch/arm/mach-clps711x/include/mach/timex.h b/arch/arm/mach-clps711x/include/mach/timex.h
index ac8823c..0965041 100644
--- a/arch/arm/mach-clps711x/include/mach/timex.h
+++ b/arch/arm/mach-clps711x/include/mach/timex.h
@@ -20,4 +20,4 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-#define CLOCK_TICK_RATE 512000
+#define ARM_TICK_RATE 512000
diff --git a/arch/arm/mach-clps711x/time.c b/arch/arm/mach-clps711x/time.c
index d581ef0..e5daed0 100644
--- a/arch/arm/mach-clps711x/time.c
+++ b/arch/arm/mach-clps711x/time.c
@@ -34,7 +34,7 @@
 /*
  * gettimeoffset() returns time since last timer tick, in usecs.
  *
- * 'LATCH' is hwclock ticks (see CLOCK_TICK_RATE in timex.h) per jiffy.
+ * 'LATCH' is hwclock ticks (see ARM_TICK_RATE in timex.h) per jiffy.
  * 'tick' is usecs per jiffy.
  */
 static unsigned long clps711x_gettimeoffset(void)
diff --git a/arch/arm/mach-davinci/include/mach/timex.h b/arch/arm/mach-davinci/include/mach/timex.h
index 5282756..38314d3 100644
--- a/arch/arm/mach-davinci/include/mach/timex.h
+++ b/arch/arm/mach-davinci/include/mach/timex.h
@@ -12,6 +12,6 @@
 #define __ASM_ARCH_TIMEX_H
 
 /* The source frequency for the timers is the 27MHz clock */
-#define CLOCK_TICK_RATE 27000000
+#define ARM_TICK_RATE 27000000
 
 #endif /* __ASM_ARCH_TIMEX_H__ */
diff --git a/arch/arm/mach-ebsa110/include/mach/timex.h b/arch/arm/mach-ebsa110/include/mach/timex.h
index 4fb43b2..e0e6623 100644
--- a/arch/arm/mach-ebsa110/include/mach/timex.h
+++ b/arch/arm/mach-ebsa110/include/mach/timex.h
@@ -15,5 +15,5 @@
  * This is therefore not used to calculate the
  * divisor.
  */
-#define CLOCK_TICK_RATE		47894000
+#define ARM_TICK_RATE		47894000
 
diff --git a/arch/arm/mach-ep93xx/core.c b/arch/arm/mach-ep93xx/core.c
index ae24486..22279b6 100644
--- a/arch/arm/mach-ep93xx/core.c
+++ b/arch/arm/mach-ep93xx/core.c
@@ -98,7 +98,7 @@ void __init ep93xx_map_io(void)
  */
 static unsigned int last_jiffy_time;
 
-#define TIMER4_TICKS_PER_JIFFY		((CLOCK_TICK_RATE + (HZ/2)) / HZ)
+#define TIMER4_TICKS_PER_JIFFY		((ARM_TICK_RATE + (HZ/2)) / HZ)
 
 static irqreturn_t ep93xx_timer_interrupt(int irq, void *dev_id)
 {
diff --git a/arch/arm/mach-ep93xx/include/mach/timex.h b/arch/arm/mach-ep93xx/include/mach/timex.h
index 6b3503b..d157204 100644
--- a/arch/arm/mach-ep93xx/include/mach/timex.h
+++ b/arch/arm/mach-ep93xx/include/mach/timex.h
@@ -2,4 +2,4 @@
  * arch/arm/mach-ep93xx/include/mach/timex.h
  */
 
-#define CLOCK_TICK_RATE		983040
+#define ARM_TICK_RATE		983040
diff --git a/arch/arm/mach-footbridge/include/mach/timex.h b/arch/arm/mach-footbridge/include/mach/timex.h
index d0fea9d..20534ac 100644
--- a/arch/arm/mach-footbridge/include/mach/timex.h
+++ b/arch/arm/mach-footbridge/include/mach/timex.h
@@ -12,7 +12,7 @@
 
 /*
  * We assume a constant here; this satisfies the maths in linux/timex.h
- * and linux/time.h.  CLOCK_TICK_RATE is actually system dependent, but
+ * and linux/time.h.  ARM_TICK_RATE is actually system dependent, but
  * this must be a constant.
  */
-#define CLOCK_TICK_RATE		(50000000/16)
+#define ARM_TICK_RATE		(50000000/16)
diff --git a/arch/arm/mach-gemini/include/mach/timex.h b/arch/arm/mach-gemini/include/mach/timex.h
index dc5690b..b0eec31 100644
--- a/arch/arm/mach-gemini/include/mach/timex.h
+++ b/arch/arm/mach-gemini/include/mach/timex.h
@@ -10,4 +10,4 @@
  */
 
 /* When AHB bus frequency is 150MHz */
-#define CLOCK_TICK_RATE	38000000
+#define ARM_TICK_RATE	38000000
diff --git a/arch/arm/mach-h720x/include/mach/timex.h b/arch/arm/mach-h720x/include/mach/timex.h
index 3f2f447..ebe075c 100644
--- a/arch/arm/mach-h720x/include/mach/timex.h
+++ b/arch/arm/mach-h720x/include/mach/timex.h
@@ -10,6 +10,6 @@
 #ifndef __ASM_ARCH_TIMEX
 #define __ASM_ARCH_TIMEX
 
-#define CLOCK_TICK_RATE		3686400
+#define ARM_TICK_RATE		3686400
 
 #endif
diff --git a/arch/arm/mach-imx/include/mach/timex.h b/arch/arm/mach-imx/include/mach/timex.h
index e22ba78..1e1ef9c 100644
--- a/arch/arm/mach-imx/include/mach/timex.h
+++ b/arch/arm/mach-imx/include/mach/timex.h
@@ -21,6 +21,6 @@
 #ifndef __ASM_ARCH_TIMEX_H
 #define __ASM_ARCH_TIMEX_H
 
-#define CLOCK_TICK_RATE		(16000000)
+#define ARM_TICK_RATE		(16000000)
 
 #endif
diff --git a/arch/arm/mach-integrator/include/mach/timex.h b/arch/arm/mach-integrator/include/mach/timex.h
index 1dcb420..4c06d90 100644
--- a/arch/arm/mach-integrator/include/mach/timex.h
+++ b/arch/arm/mach-integrator/include/mach/timex.h
@@ -23,4 +23,4 @@
 /*
  * ??
  */
-#define CLOCK_TICK_RATE		(50000000 / 16)
+#define ARM_TICK_RATE		(50000000 / 16)
diff --git a/arch/arm/mach-iop13xx/include/mach/timex.h b/arch/arm/mach-iop13xx/include/mach/timex.h
index 45fb274..4e8d4e6 100644
--- a/arch/arm/mach-iop13xx/include/mach/timex.h
+++ b/arch/arm/mach-iop13xx/include/mach/timex.h
@@ -1 +1 @@
-#define CLOCK_TICK_RATE (100 * HZ)
+#define ARM_TICK_RATE (100 * HZ)
diff --git a/arch/arm/mach-iop32x/include/mach/timex.h b/arch/arm/mach-iop32x/include/mach/timex.h
index 7262ab8..5ead7ca 100644
--- a/arch/arm/mach-iop32x/include/mach/timex.h
+++ b/arch/arm/mach-iop32x/include/mach/timex.h
@@ -3,4 +3,4 @@
  *
  * IOP32x architecture timex specifications
  */
-#define CLOCK_TICK_RATE		(100 * HZ)
+#define ARM_TICK_RATE		(100 * HZ)
diff --git a/arch/arm/mach-iop33x/include/mach/timex.h b/arch/arm/mach-iop33x/include/mach/timex.h
index 54c5890..e925e77 100644
--- a/arch/arm/mach-iop33x/include/mach/timex.h
+++ b/arch/arm/mach-iop33x/include/mach/timex.h
@@ -3,4 +3,4 @@
  *
  * IOP3xx architecture timex specifications
  */
-#define CLOCK_TICK_RATE		(100 * HZ)
+#define ARM_TICK_RATE		(100 * HZ)
diff --git a/arch/arm/mach-ixp2000/include/mach/timex.h b/arch/arm/mach-ixp2000/include/mach/timex.h
index 835e659..479cbab 100644
--- a/arch/arm/mach-ixp2000/include/mach/timex.h
+++ b/arch/arm/mach-ixp2000/include/mach/timex.h
@@ -8,6 +8,6 @@
 /*
  * Default clock is 50MHz APB, but platform code can override this
  */
-#define CLOCK_TICK_RATE	50000000
+#define ARM_TICK_RATE	50000000
 
 
diff --git a/arch/arm/mach-ixp23xx/core.c b/arch/arm/mach-ixp23xx/core.c
index aa4c442..aed022b 100644
--- a/arch/arm/mach-ixp23xx/core.c
+++ b/arch/arm/mach-ixp23xx/core.c
@@ -329,7 +329,7 @@ void __init ixp23xx_init_irq(void)
 /*************************************************************************
  * Timer-tick functions for IXP23xx
  *************************************************************************/
-#define CLOCK_TICKS_PER_USEC	(CLOCK_TICK_RATE / USEC_PER_SEC)
+#define CLOCK_TICKS_PER_USEC	(ARM_TICK_RATE / USEC_PER_SEC)
 
 static unsigned long next_jiffy_time;
 
diff --git a/arch/arm/mach-ixp23xx/include/mach/timex.h b/arch/arm/mach-ixp23xx/include/mach/timex.h
index e341e9c..c84435b 100644
--- a/arch/arm/mach-ixp23xx/include/mach/timex.h
+++ b/arch/arm/mach-ixp23xx/include/mach/timex.h
@@ -4,4 +4,4 @@
  * XScale architecture timex specifications
  */
 
-#define CLOCK_TICK_RATE 75000000
+#define ARM_TICK_RATE 75000000
diff --git a/arch/arm/mach-ixp4xx/include/mach/timex.h b/arch/arm/mach-ixp4xx/include/mach/timex.h
index 89ce3ee..1f5c87b 100644
--- a/arch/arm/mach-ixp4xx/include/mach/timex.h
+++ b/arch/arm/mach-ixp4xx/include/mach/timex.h
@@ -7,9 +7,9 @@
 
 /*
  * We use IXP425 General purpose timer for our timer needs, it runs at 
- * 66.66... MHz. We do a convulted calculation of CLOCK_TICK_RATE b/c the
+ * 66.66... MHz. We do a convulted calculation of ARM_TICK_RATE b/c the
  * timer register ignores the bottom 2 bits of the LATCH value.
  */
 #define FREQ 66666666
-#define CLOCK_TICK_RATE (((FREQ / HZ & ~IXP4XX_OST_RELOAD_MASK) + 1) * HZ)
+#define ARM_TICK_RATE (((FREQ / HZ & ~IXP4XX_OST_RELOAD_MASK) + 1) * HZ)
 
diff --git a/arch/arm/mach-kirkwood/include/mach/timex.h b/arch/arm/mach-kirkwood/include/mach/timex.h
index c923cd1..67d1e54 100644
--- a/arch/arm/mach-kirkwood/include/mach/timex.h
+++ b/arch/arm/mach-kirkwood/include/mach/timex.h
@@ -6,5 +6,5 @@
  * warranty of any kind, whether express or implied.
  */
 
-#define CLOCK_TICK_RATE		(100 * HZ)
+#define ARM_TICK_RATE		(100 * HZ)
 
diff --git a/arch/arm/mach-ks8695/include/mach/timex.h b/arch/arm/mach-ks8695/include/mach/timex.h
index 4682e35..83e971b 100644
--- a/arch/arm/mach-ks8695/include/mach/timex.h
+++ b/arch/arm/mach-ks8695/include/mach/timex.h
@@ -15,6 +15,6 @@
 #define __ASM_ARCH_TIMEX_H
 
 /* timers are derived from MCLK, which is 25MHz */
-#define CLOCK_TICK_RATE 25000000
+#define ARM_TICK_RATE 25000000
 
 #endif
diff --git a/arch/arm/mach-ks8695/time.c b/arch/arm/mach-ks8695/time.c
index 69c072c..c51fe85 100644
--- a/arch/arm/mach-ks8695/time.c
+++ b/arch/arm/mach-ks8695/time.c
@@ -55,11 +55,11 @@ static unsigned long ks8695_gettimeoffset (void)
 	} while (elapsed > tick2);
 
 	/* Convert to number of ticks expired (not remaining) */
-	elapsed = (CLOCK_TICK_RATE / HZ) - elapsed;
+	elapsed = (ARM_TICK_RATE / HZ) - elapsed;
 
 	/* Is interrupt pending?  If so, then timer has been reloaded already. */
 	if (intpending)
-		elapsed += (CLOCK_TICK_RATE / HZ);
+		elapsed += (ARM_TICK_RATE / HZ);
 
 	/* Convert ticks to usecs */
 	return (unsigned long)(elapsed * (tick_nsec / 1000)) / LATCH;
@@ -82,7 +82,7 @@ static struct irqaction ks8695_timer_irq = {
 
 static void ks8695_timer_setup(void)
 {
-	unsigned long tmout = CLOCK_TICK_RATE / HZ;
+	unsigned long tmout = ARM_TICK_RATE / HZ;
 	unsigned long tmcon;
 
 	/* disable timer1 */
diff --git a/arch/arm/mach-l7200/include/mach/timex.h b/arch/arm/mach-l7200/include/mach/timex.h
index ffc96a6..b7ed766 100644
--- a/arch/arm/mach-l7200/include/mach/timex.h
+++ b/arch/arm/mach-l7200/include/mach/timex.h
@@ -17,4 +17,4 @@
  *       rate. The value of HZ in 'param.h' must also
  *       be changed to match below.
  */
-#define CLOCK_TICK_RATE		128
+#define ARM_TICK_RATE		128
diff --git a/arch/arm/mach-lh7a40x/include/mach/timex.h b/arch/arm/mach-lh7a40x/include/mach/timex.h
index 08028ce..87d3657 100644
--- a/arch/arm/mach-lh7a40x/include/mach/timex.h
+++ b/arch/arm/mach-lh7a40x/include/mach/timex.h
@@ -10,8 +10,8 @@
 
 #include <mach/constants.h>
 
-#define CLOCK_TICK_RATE		(PLL_CLOCK/6/16)
+#define ARM_TICK_RATE		(PLL_CLOCK/6/16)
 
 /*
-#define CLOCK_TICK_RATE		3686400
+#define ARM_TICK_RATE		3686400
 */
diff --git a/arch/arm/mach-loki/include/mach/timex.h b/arch/arm/mach-loki/include/mach/timex.h
index 9df2109..640b53a 100644
--- a/arch/arm/mach-loki/include/mach/timex.h
+++ b/arch/arm/mach-loki/include/mach/timex.h
@@ -6,6 +6,6 @@
  * warranty of any kind, whether express or implied.
  */
 
-#define CLOCK_TICK_RATE		(100 * HZ)
+#define ARM_TICK_RATE		(100 * HZ)
 
 #define LOKI_TCLK		180000000
diff --git a/arch/arm/mach-mmp/include/mach/timex.h b/arch/arm/mach-mmp/include/mach/timex.h
index 6cebbd0..dcf8e87 100644
--- a/arch/arm/mach-mmp/include/mach/timex.h
+++ b/arch/arm/mach-mmp/include/mach/timex.h
@@ -6,4 +6,4 @@
  * published by the Free Software Foundation.
  */
 
-#define CLOCK_TICK_RATE		3250000
+#define ARM_TICK_RATE		3250000
diff --git a/arch/arm/mach-mmp/time.c b/arch/arm/mach-mmp/time.c
index b03a6ed..c85c1e1 100644
--- a/arch/arm/mach-mmp/time.c
+++ b/arch/arm/mach-mmp/time.c
@@ -183,14 +183,14 @@ void __init timer_init(int irq)
 {
 	timer_config();
 
-	set_tcr2ns_scale(CLOCK_TICK_RATE);
+	set_tcr2ns_scale(ARM_TICK_RATE);
 
-	ckevt.mult = div_sc(CLOCK_TICK_RATE, NSEC_PER_SEC, ckevt.shift);
+	ckevt.mult = div_sc(ARM_TICK_RATE, NSEC_PER_SEC, ckevt.shift);
 	ckevt.max_delta_ns = clockevent_delta2ns(MAX_DELTA, &ckevt);
 	ckevt.min_delta_ns = clockevent_delta2ns(MIN_DELTA, &ckevt);
 	ckevt.cpumask = cpumask_of(0);
 
-	cksrc.mult = clocksource_hz2mult(CLOCK_TICK_RATE, cksrc.shift);
+	cksrc.mult = clocksource_hz2mult(ARM_TICK_RATE, cksrc.shift);
 
 	setup_irq(irq, &timer_irq);
 
diff --git a/arch/arm/mach-msm/include/mach/timex.h b/arch/arm/mach-msm/include/mach/timex.h
index a62e6b2..4bf65ab 100644
--- a/arch/arm/mach-msm/include/mach/timex.h
+++ b/arch/arm/mach-msm/include/mach/timex.h
@@ -16,6 +16,6 @@
 #ifndef __ASM_ARCH_MSM_TIMEX_H
 #define __ASM_ARCH_MSM_TIMEX_H
 
-#define CLOCK_TICK_RATE		1000000
+#define ARM_TICK_RATE		1000000
 
 #endif
diff --git a/arch/arm/mach-mv78xx0/include/mach/timex.h b/arch/arm/mach-mv78xx0/include/mach/timex.h
index 0e8c443..c074de8 100644
--- a/arch/arm/mach-mv78xx0/include/mach/timex.h
+++ b/arch/arm/mach-mv78xx0/include/mach/timex.h
@@ -6,4 +6,4 @@
  * warranty of any kind, whether express or implied.
  */
 
-#define CLOCK_TICK_RATE		(100 * HZ)
+#define ARM_TICK_RATE		(100 * HZ)
diff --git a/arch/arm/mach-netx/include/mach/timex.h b/arch/arm/mach-netx/include/mach/timex.h
index 1120dd0..ea1aa8f 100644
--- a/arch/arm/mach-netx/include/mach/timex.h
+++ b/arch/arm/mach-netx/include/mach/timex.h
@@ -17,4 +17,4 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-#define CLOCK_TICK_RATE 100000000
+#define ARM_TICK_RATE 100000000
diff --git a/arch/arm/mach-netx/time.c b/arch/arm/mach-netx/time.c
index 82801db..85b0969 100644
--- a/arch/arm/mach-netx/time.c
+++ b/arch/arm/mach-netx/time.c
@@ -152,10 +152,10 @@ static void __init netx_timer_init(void)
 			NETX_GPIO_COUNTER_CTRL(TIMER_CLOCKSOURCE));
 
 	clocksource_netx.mult =
-		clocksource_hz2mult(CLOCK_TICK_RATE, clocksource_netx.shift);
+		clocksource_hz2mult(ARM_TICK_RATE, clocksource_netx.shift);
 	clocksource_register(&clocksource_netx);
 
-	netx_clockevent.mult = div_sc(CLOCK_TICK_RATE, NSEC_PER_SEC,
+	netx_clockevent.mult = div_sc(ARM_TICK_RATE, NSEC_PER_SEC,
 			netx_clockevent.shift);
 	netx_clockevent.max_delta_ns =
 		clockevent_delta2ns(0xfffffffe, &netx_clockevent);
diff --git a/arch/arm/mach-ns9xxx/include/mach/timex.h b/arch/arm/mach-ns9xxx/include/mach/timex.h
index 734a8d8..9cd49e8 100644
--- a/arch/arm/mach-ns9xxx/include/mach/timex.h
+++ b/arch/arm/mach-ns9xxx/include/mach/timex.h
@@ -12,9 +12,9 @@
 #define __ASM_ARCH_TIMEX_H
 
 /*
- * value for CLOCK_TICK_RATE stolen from arch/arm/mach-s3c2410/include/mach/timex.h.
+ * value for ARM_TICK_RATE stolen from arch/arm/mach-s3c2410/include/mach/timex.h.
  * See there for an explanation.
  */
-#define CLOCK_TICK_RATE         12000000
+#define ARM_TICK_RATE         12000000
 
 #endif /* ifndef __ASM_ARCH_TIMEX_H */
diff --git a/arch/arm/mach-orion5x/include/mach/timex.h b/arch/arm/mach-orion5x/include/mach/timex.h
index 4c69820..957c434 100644
--- a/arch/arm/mach-orion5x/include/mach/timex.h
+++ b/arch/arm/mach-orion5x/include/mach/timex.h
@@ -8,4 +8,4 @@
  * warranty of any kind, whether express or implied.
  */
 
-#define CLOCK_TICK_RATE		(100 * HZ)
+#define ARM_TICK_RATE		(100 * HZ)
diff --git a/arch/arm/mach-pnx4008/include/mach/timex.h b/arch/arm/mach-pnx4008/include/mach/timex.h
index 5ff0196..b0faff3 100644
--- a/arch/arm/mach-pnx4008/include/mach/timex.h
+++ b/arch/arm/mach-pnx4008/include/mach/timex.h
@@ -17,7 +17,7 @@
 #include <linux/io.h>
 #include <mach/hardware.h>
 
-#define CLOCK_TICK_RATE		1000000
+#define ARM_TICK_RATE		1000000
 
 #define TICKS2USECS(x)	(x)
 
diff --git a/arch/arm/mach-pxa/include/mach/timex.h b/arch/arm/mach-pxa/include/mach/timex.h
index af6760a..337fdac 100644
--- a/arch/arm/mach-pxa/include/mach/timex.h
+++ b/arch/arm/mach-pxa/include/mach/timex.h
@@ -10,7 +10,7 @@
  * published by the Free Software Foundation.
  */
 
-/* Various drivers are still using the constant of CLOCK_TICK_RATE, for
+/* Various drivers are still using the constant of ARM_TICK_RATE, for
  * those drivers to at least work, the definition is provided here.
  *
  * NOTE: this is no longer accurate when multiple processors and boards
@@ -21,14 +21,14 @@
 
 #if defined(CONFIG_PXA25x)
 /* PXA250/210 timer base */
-#define CLOCK_TICK_RATE 3686400
+#define ARM_TICK_RATE 3686400
 #elif defined(CONFIG_PXA27x)
 /* PXA27x timer base */
 #ifdef CONFIG_MACH_MAINSTONE
-#define CLOCK_TICK_RATE 3249600
+#define ARM_TICK_RATE 3249600
 #else
-#define CLOCK_TICK_RATE 3250000
+#define ARM_TICK_RATE 3250000
 #endif
 #else
-#define CLOCK_TICK_RATE 3250000
+#define ARM_TICK_RATE 3250000
 #endif
diff --git a/arch/arm/mach-realview/include/mach/timex.h b/arch/arm/mach-realview/include/mach/timex.h
index 4eeb069..adcfee9 100644
--- a/arch/arm/mach-realview/include/mach/timex.h
+++ b/arch/arm/mach-realview/include/mach/timex.h
@@ -20,4 +20,4 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-#define CLOCK_TICK_RATE		(50000000 / 16)
+#define ARM_TICK_RATE		(50000000 / 16)
diff --git a/arch/arm/mach-rpc/include/mach/timex.h b/arch/arm/mach-rpc/include/mach/timex.h
index dd75e73..3518567 100644
--- a/arch/arm/mach-rpc/include/mach/timex.h
+++ b/arch/arm/mach-rpc/include/mach/timex.h
@@ -13,5 +13,5 @@
 /*
  * On the RiscPC, the clock ticks at 2MHz.
  */
-#define CLOCK_TICK_RATE		2000000
+#define ARM_TICK_RATE		2000000
 
diff --git a/arch/arm/mach-s3c24a0/include/mach/timex.h b/arch/arm/mach-s3c24a0/include/mach/timex.h
index 9857342..cb00161 100644
--- a/arch/arm/mach-s3c24a0/include/mach/timex.h
+++ b/arch/arm/mach-s3c24a0/include/mach/timex.h
@@ -13,6 +13,6 @@
 #ifndef __ASM_ARCH_TIMEX_H
 #define __ASM_ARCH_TIMEX_H
 
-#define CLOCK_TICK_RATE 12000000
+#define ARM_TICK_RATE 12000000
 
 #endif /* __ASM_ARCH_TIMEX_H */
diff --git a/arch/arm/mach-sa1100/include/mach/timex.h b/arch/arm/mach-sa1100/include/mach/timex.h
index 7a5d017..d3a4fd0 100644
--- a/arch/arm/mach-sa1100/include/mach/timex.h
+++ b/arch/arm/mach-sa1100/include/mach/timex.h
@@ -9,4 +9,4 @@
 /*
  * SA1100 timer
  */
-#define CLOCK_TICK_RATE		3686400
+#define ARM_TICK_RATE		3686400
diff --git a/arch/arm/mach-sa1100/time.c b/arch/arm/mach-sa1100/time.c
index 711c029..a561628 100644
--- a/arch/arm/mach-sa1100/time.c
+++ b/arch/arm/mach-sa1100/time.c
@@ -112,7 +112,7 @@ static void __init sa1100_timer_init(void)
 	ckevt_sa1100_osmr0.cpumask = cpumask_of(0);
 
 	cksrc_sa1100_oscr.mult =
-		clocksource_hz2mult(CLOCK_TICK_RATE, cksrc_sa1100_oscr.shift);
+		clocksource_hz2mult(ARM_TICK_RATE, cksrc_sa1100_oscr.shift);
 
 	setup_irq(IRQ_OST0, &sa1100_timer_irq);
 
diff --git a/arch/arm/mach-shark/include/mach/timex.h b/arch/arm/mach-shark/include/mach/timex.h
index bb6eeae..d32920d 100644
--- a/arch/arm/mach-shark/include/mach/timex.h
+++ b/arch/arm/mach-shark/include/mach/timex.h
@@ -4,4 +4,4 @@
  * by Alexander Schulz
  */
 
-#define CLOCK_TICK_RATE 1193180
+#define ARM_TICK_RATE 1193180
diff --git a/arch/arm/mach-versatile/include/mach/timex.h b/arch/arm/mach-versatile/include/mach/timex.h
index 426199b..07176df 100644
--- a/arch/arm/mach-versatile/include/mach/timex.h
+++ b/arch/arm/mach-versatile/include/mach/timex.h
@@ -20,4 +20,4 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-#define CLOCK_TICK_RATE		(50000000 / 16)
+#define ARM_TICK_RATE		(50000000 / 16)
diff --git a/arch/arm/mach-w90x900/include/mach/timex.h b/arch/arm/mach-w90x900/include/mach/timex.h
index 164dce0..906fb72 100644
--- a/arch/arm/mach-w90x900/include/mach/timex.h
+++ b/arch/arm/mach-w90x900/include/mach/timex.h
@@ -18,8 +18,8 @@
 #ifndef __ASM_ARCH_TIMEX_H
 #define __ASM_ARCH_TIMEX_H
 
-/* CLOCK_TICK_RATE Now, I don't use it. */
+/* ARM_TICK_RATE Now, I don't use it. */
 
-#define CLOCK_TICK_RATE 15000000
+#define ARM_TICK_RATE 15000000
 
 #endif /* __ASM_ARCH_TIMEX_H */
diff --git a/arch/arm/plat-mxc/include/mach/timex.h b/arch/arm/plat-mxc/include/mach/timex.h
index 07b4a73..4f8919d 100644
--- a/arch/arm/plat-mxc/include/mach/timex.h
+++ b/arch/arm/plat-mxc/include/mach/timex.h
@@ -21,11 +21,11 @@
 #define __ASM_ARCH_MXC_TIMEX_H__
 
 #if defined CONFIG_ARCH_MX1
-#define CLOCK_TICK_RATE		16000000
+#define ARM_TICK_RATE		16000000
 #elif defined CONFIG_ARCH_MX2
-#define CLOCK_TICK_RATE		13300000
+#define ARM_TICK_RATE		13300000
 #elif defined CONFIG_ARCH_MX3
-#define CLOCK_TICK_RATE		16625000
+#define ARM_TICK_RATE		16625000
 #endif
 
 #endif				/* __ASM_ARCH_MXC_TIMEX_H__ */
diff --git a/arch/arm/plat-omap/include/mach/timex.h b/arch/arm/plat-omap/include/mach/timex.h
index 6d35767..d572956 100644
--- a/arch/arm/plat-omap/include/mach/timex.h
+++ b/arch/arm/plat-omap/include/mach/timex.h
@@ -30,12 +30,12 @@
 
 /*
  * OMAP 32KHz timer updates time one jiffie at a time from a secondary timer,
- * and that's why the CLOCK_TICK_RATE is not 32768.
+ * and that's why the ARM_TICK_RATE is not 32768.
  */
 #ifdef CONFIG_OMAP_32K_TIMER
-#define CLOCK_TICK_RATE		(CONFIG_OMAP_32K_TIMER_HZ)
+#define ARM_TICK_RATE		(CONFIG_OMAP_32K_TIMER_HZ)
 #else
-#define CLOCK_TICK_RATE		(HZ * 100000UL)
+#define ARM_TICK_RATE		(HZ * 100000UL)
 #endif
 
 #endif /* __ASM_ARCH_OMAP_TIMEX_H */
diff --git a/arch/arm/plat-s3c/include/mach/timex.h b/arch/arm/plat-s3c/include/mach/timex.h
index 2a425ed..a32574a 100644
--- a/arch/arm/plat-s3c/include/mach/timex.h
+++ b/arch/arm/plat-s3c/include/mach/timex.h
@@ -13,14 +13,14 @@
 #ifndef __ASM_ARCH_TIMEX_H
 #define __ASM_ARCH_TIMEX_H
 
-/* CLOCK_TICK_RATE needs to be evaluatable by the cpp, so making it
+/* ARM_TICK_RATE needs to be evaluatable by the cpp, so making it
  * a variable is useless. It seems as long as we make our timers an
  * exact multiple of HZ, any value that makes a 1->1 correspondence
  * for the time conversion functions to/from jiffies is acceptable.
 */
 
 
-#define CLOCK_TICK_RATE 12000000
+#define ARM_TICK_RATE 12000000
 
 
 #endif /* __ASM_ARCH_TIMEX_H */
diff --git a/drivers/rtc/rtc-pxa.c b/drivers/rtc/rtc-pxa.c
index bb8cc05..22133f4 100644
--- a/drivers/rtc/rtc-pxa.c
+++ b/drivers/rtc/rtc-pxa.c
@@ -29,7 +29,7 @@
 
 #include <mach/hardware.h>
 
-#define TIMER_FREQ		CLOCK_TICK_RATE
+#define TIMER_FREQ		ARM_TICK_RATE
 #define RTC_DEF_DIVIDER		(32768 - 1)
 #define RTC_DEF_TRIM		0
 #define MAXFREQ_PERIODIC	1000
diff --git a/drivers/serial/serial_ks8695.c b/drivers/serial/serial_ks8695.c
index 998e89d..5d66a2f 100644
--- a/drivers/serial/serial_ks8695.c
+++ b/drivers/serial/serial_ks8695.c
@@ -549,7 +549,7 @@ static struct uart_port ks8695uart_ports[SERIAL_KS8695_NR] = {
 		.mapbase	= KS8695_UART_VA,
 		.iotype		= SERIAL_IO_MEM,
 		.irq		= KS8695_IRQ_UART_TX,
-		.uartclk	= CLOCK_TICK_RATE * 16,
+		.uartclk	= ARM_TICK_RATE * 16,
 		.fifosize	= 16,
 		.ops		= &ks8695uart_pops,
 		.flags		= ASYNC_BOOT_AUTOCONF,
diff --git a/drivers/watchdog/davinci_wdt.c b/drivers/watchdog/davinci_wdt.c
index c51d0b0..de7f784 100644
--- a/drivers/watchdog/davinci_wdt.c
+++ b/drivers/watchdog/davinci_wdt.c
@@ -99,9 +99,9 @@ static void wdt_enable(void)
 	iowrite32(0, wdt_base + TIM12);
 	iowrite32(0, wdt_base + TIM34);
 	/* set timeout period */
-	timer_margin = (((u64)heartbeat * CLOCK_TICK_RATE) & 0xffffffff);
+	timer_margin = (((u64)heartbeat * ARM_TICK_RATE) & 0xffffffff);
 	iowrite32(timer_margin, wdt_base + PRD12);
-	timer_margin = (((u64)heartbeat * CLOCK_TICK_RATE) >> 32);
+	timer_margin = (((u64)heartbeat * ARM_TICK_RATE) >> 32);
 	iowrite32(timer_margin, wdt_base + PRD34);
 	/* enable run continuously */
 	iowrite32(ENAMODE12_PERIODIC, wdt_base + TCR);
diff --git a/drivers/watchdog/ks8695_wdt.c b/drivers/watchdog/ks8695_wdt.c
index ae38321..4594e93 100644
--- a/drivers/watchdog/ks8695_wdt.c
+++ b/drivers/watchdog/ks8695_wdt.c
@@ -66,7 +66,7 @@ static inline void ks8695_wdt_stop(void)
 static inline void ks8695_wdt_start(void)
 {
 	unsigned long tmcon;
-	unsigned long tval = wdt_time * CLOCK_TICK_RATE;
+	unsigned long tval = wdt_time * ARM_TICK_RATE;
 
 	spin_lock(&ks8695_lock);
 	/* disable timer0 */
-- 
1.6.0.4


^ permalink raw reply related	[flat|nested] 86+ messages in thread

* Re: [PATCH] scsi: libsas depends on HAS_DMA
  2009-05-11 22:59     ` James Bottomley
@ 2009-05-11 23:16       ` Arnd Bergmann
  0 siblings, 0 replies; 86+ messages in thread
From: Arnd Bergmann @ 2009-05-11 23:16 UTC (permalink / raw)
  To: James Bottomley; +Cc: linux-kernel, linux-scsi

On Monday 11 May 2009 22:59:44 James Bottomley wrote:
> Actually, looking at this further, the problem is only in the ata
> compatibility layer because of the way libata does dma mapping on behalf
> of drivers, so the solution below (just disable SATA support if HAS_DMA
> isn't defined) will work without requiring select dependency
> modification.

Ah, in that case, the patch should not be needed at all, because
SCSI_SAS_ATA already depends on ATA, and I also submitted a patch
to make ATA depend on HAS_DMA.

Thanks for looking at it.

	Arnd <><

^ permalink raw reply	[flat|nested] 86+ messages in thread

* [PATCH v2] x86: fix ktermios-termio conversion
  2009-05-11 22:59 ` [PATCH] x86: fix ktermios-termio conversion Arnd Bergmann
@ 2009-05-11 23:19   ` Arnd Bergmann
  2009-05-12  7:55     ` Ingo Molnar
  0 siblings, 1 reply; 86+ messages in thread
From: Arnd Bergmann @ 2009-05-11 23:19 UTC (permalink / raw)
  To: x86; +Cc: linux-kernel, Remis Lima Baima

The operation with the variable 'c_line' was missing in the function
'user_termio_to_kernel_termios'. Also the casting '*(unsigned short *)'
in the macro 'SET_LOW_TERMIOS_BITS' was a bit 'unhealthy'. So the macro
was removed and the function was changed to be like in other archs
(e.g. h8300, m68k, sparc) that have a more elegant solution.

In the function 'kernel_termios_to_user_termio' the return values of
the functions calls 'put_user' and 'copy_to_user' were not being
checked.

Signed-off-by: Remis Lima Baima <remis.developer@googlemail.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---

initial patch was wordwrapped, resend

 arch/x86/include/asm/termios.h |   54 +++++++++++++++++++++++++++------------
 1 files changed, 37 insertions(+), 17 deletions(-)

diff --git a/arch/x86/include/asm/termios.h b/arch/x86/include/asm/termios.h
index f729563..47420df 100644
--- a/arch/x86/include/asm/termios.h
+++ b/arch/x86/include/asm/termios.h
@@ -54,20 +54,37 @@ struct termio {
 /*
  * Translate a "termio" structure into a "termios". Ugh.
  */
-#define SET_LOW_TERMIOS_BITS(termios, termio, x) { \
-	unsigned short __tmp; \
-	get_user(__tmp,&(termio)->x); \
-	*(unsigned short *) &(termios)->x = __tmp; \
-}
-
 static inline int user_termio_to_kernel_termios(struct ktermios *termios,
 						struct termio __user *termio)
 {
-	SET_LOW_TERMIOS_BITS(termios, termio, c_iflag);
-	SET_LOW_TERMIOS_BITS(termios, termio, c_oflag);
-	SET_LOW_TERMIOS_BITS(termios, termio, c_cflag);
-	SET_LOW_TERMIOS_BITS(termios, termio, c_lflag);
-	return copy_from_user(termios->c_cc, termio->c_cc, NCC);
+	unsigned short tmp;
+
+	if (get_user(tmp, &termio->c_iflag) < 0)
+		goto fault;
+	termios->c_iflag = (0xffff0000 & termios->c_iflag) | tmp;
+
+	if (get_user(tmp, &termio->c_oflag) < 0)
+		goto fault;
+	termios->c_oflag = (0xffff0000 & termios->c_oflag) | tmp;
+
+	if (get_user(tmp, &termio->c_cflag) < 0)
+		goto fault;
+	termios->c_cflag = (0xffff0000 & termios->c_cflag) | tmp;
+
+	if (get_user(tmp, &termio->c_lflag) < 0)
+		goto fault;
+	termios->c_lflag = (0xffff0000 & termios->c_lflag) | tmp;
+
+	if (get_user(termios->c_line, &termio->c_line) < 0)
+		goto fault;
+
+	if (copy_from_user(termios->c_cc, termio->c_cc, NCC) != 0)
+		goto fault;
+
+	return 0;
+
+ fault:
+	return -EFAULT;
 }
 
 /*
@@ -76,12 +93,15 @@ static inline int user_termio_to_kernel_termios(struct ktermios *termios,
 static inline int kernel_termios_to_user_termio(struct termio __user *termio,
 					    struct ktermios *termios)
 {
-	put_user((termios)->c_iflag, &(termio)->c_iflag);
-	put_user((termios)->c_oflag, &(termio)->c_oflag);
-	put_user((termios)->c_cflag, &(termio)->c_cflag);
-	put_user((termios)->c_lflag, &(termio)->c_lflag);
-	put_user((termios)->c_line,  &(termio)->c_line);
-	return copy_to_user((termio)->c_cc, (termios)->c_cc, NCC);
+	if (put_user(termios->c_iflag, &termio->c_iflag) < 0 ||
+	    put_user(termios->c_oflag, &termio->c_oflag) < 0 ||
+	    put_user(termios->c_cflag, &termio->c_cflag) < 0 ||
+	    put_user(termios->c_lflag, &termio->c_lflag) < 0 ||
+	    put_user(termios->c_line,  &termio->c_line) < 0 ||
+	    copy_to_user(termio->c_cc, termios->c_cc, NCC) != 0)
+		return -EFAULT;
+
+	return 0;
 }
 
 static inline int user_termios_to_kernel_termios(struct ktermios *k,
-- 
1.6.0.4


^ permalink raw reply related	[flat|nested] 86+ messages in thread

* Re: [PATCH] move PIT_TICK_RATE to linux/timex.h
  2009-05-11 22:55   ` Arnd Bergmann
  (?)
@ 2009-05-12  0:01   ` Andrew Morton
  2009-05-12  0:36     ` Arnd Bergmann
  -1 siblings, 1 reply; 86+ messages in thread
From: Andrew Morton @ 2009-05-12  0:01 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: linux-arch, x86, rth, ralf, tiwai, dmitry.torokhov, mingo,
	linux-kernel, alan

On Mon, 11 May 2009 22:55:36 +0000
Arnd Bergmann <arnd@arndb.de> wrote:

> PIT_TICK_RATE is currently defined in four architectures,
> but in three different places. While linux/timex.h is not
> the perfect place for it, it is still a reasonable replacement
> for those drivers that traditionally use asm/timex.h to
> get CLOCK_TICK_RATE and expect it to be the PIT frequency.
>
> ...
>
> -#define PIT_TICK_RATE 	1193180UL
> -#define PIT_TICK_RATE		1193182UL
> -#define PIT_TICK_RATE	1193182UL
> -#define PIT_TICK_RATE		1193182
> +#define PIT_TICK_RATE 1193182ul

So the type got changed in arch/x86/include/asm/timex.h.  Did you check
whether that changes anything? I did a quick check and didn't see any
obvious problems..


^ permalink raw reply	[flat|nested] 86+ messages in thread

* Re: [PATCH] ipc: use __ARCH_WANT_IPC_PARSE_VERSION in ipc/util.h
  2009-05-11 23:02 ` [PATCH] ipc: use __ARCH_WANT_IPC_PARSE_VERSION in ipc/util.h Arnd Bergmann
@ 2009-05-12  0:19   ` Serge E. Hallyn
  0 siblings, 0 replies; 86+ messages in thread
From: Serge E. Hallyn @ 2009-05-12  0:19 UTC (permalink / raw)
  To: Arnd Bergmann; +Cc: linux-kernel, Cedric Le Goater, Andrew Morton

Quoting Arnd Bergmann (arnd@arndb.de):
> The definition of ipc_parse_version depends on
> __ARCH_WANT_IPC_PARSE_VERSION, but the header file
> declares it conditionally based on the architecture.
> 
> Use the macro consistently to make it easier to add
> new architectures.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Makes sense!

Acked-by: Serge Hallyn <serue@us.ibm.com>

thanks,
-serge

> ---
>  ipc/util.h |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/ipc/util.h b/ipc/util.h
> index 1187332..f9fe90e 100644
> --- a/ipc/util.h
> +++ b/ipc/util.h
> @@ -128,7 +128,7 @@ void ipc_update_perm(struct ipc64_perm *in, struct kern_ipc_perm *out);
>  struct kern_ipc_perm *ipcctl_pre_down(struct ipc_ids *ids, int id, int cmd,
>  				      struct ipc64_perm *perm, int extra_perm);
> 
> -#if defined(__ia64__) || defined(__x86_64__) || defined(__hppa__) || defined(__XTENSA__)
> +#ifndef __ARCH_WANT_IPC_PARSE_VERSION
>    /* On IA-64, we always use the "64-bit version" of the IPC structures.  */ 
>  # define ipc_parse_version(cmd)	IPC_64
>  #else
> -- 
> 1.6.0.4
> 
> -- 
> 

^ permalink raw reply	[flat|nested] 86+ messages in thread

* Re: [PATCH] move PIT_TICK_RATE to linux/timex.h
  2009-05-12  0:01   ` Andrew Morton
@ 2009-05-12  0:36     ` Arnd Bergmann
  0 siblings, 0 replies; 86+ messages in thread
From: Arnd Bergmann @ 2009-05-12  0:36 UTC (permalink / raw)
  To: Andrew Morton
  Cc: linux-arch, x86, rth, ralf, tiwai, dmitry.torokhov, mingo,
	linux-kernel, alan

On Tuesday 12 May 2009, Andrew Morton wrote:
> So the type got changed in arch/x86/include/asm/timex.h.  Did you check
> whether that changes anything? I did a quick check and didn't see any
> obvious problems..

I did not check if the object file changes, just checked that the
macro is not used in assembly code, which would break.

Note that for Alpha, the actual value changed from 1193182UL to
1193180UL. This is unlikely to make a difference, and probably
can only improve accuracy. There was a discussion on the correct
value of CLOCK_TICK_RATE a few years ago, after which every existing
instance was getting changed to 1193182. According to the specification,
it should be 1193181.818181...

	Arnd <><

^ permalink raw reply	[flat|nested] 86+ messages in thread

* Re: [PATCH] ata: libata depends on HAS_DMA
  2009-05-11 22:38 ` [PATCH] ata: libata depends on HAS_DMA Arnd Bergmann
@ 2009-05-12  0:58   ` Jeff Garzik
  2009-05-12 12:40     ` Arnd Bergmann
  2009-05-12  8:06   ` Alan Cox
  1 sibling, 1 reply; 86+ messages in thread
From: Jeff Garzik @ 2009-05-12  0:58 UTC (permalink / raw)
  To: Arnd Bergmann; +Cc: linux-kernel, linux-ide

Arnd Bergmann wrote:
> libata uses the DMA mapping API, so it cannot be built
> on architectures that don't have DMA support.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  drivers/ata/Kconfig |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig
> index 9120717..f076268 100644
> --- a/drivers/ata/Kconfig
> +++ b/drivers/ata/Kconfig
> @@ -4,7 +4,7 @@
>  
>  menuconfig ATA
>  	tristate "Serial ATA (prod) and Parallel ATA (experimental) drivers"
> -	depends on HAS_IOMEM
> +	depends on HAS_IOMEM && HAS_DMA
>  	depends on BLOCK
>  	depends on !(M32R || M68K) || BROKEN

What specifically is breaking?

Ideally we should be able to work with PIO-only...

	JEff





^ permalink raw reply	[flat|nested] 86+ messages in thread

* Re: [PATCH v2] x86: fix ktermios-termio conversion
  2009-05-11 23:19   ` [PATCH v2] " Arnd Bergmann
@ 2009-05-12  7:55     ` Ingo Molnar
  2009-05-12  9:04       ` Arnd Bergmann
  0 siblings, 1 reply; 86+ messages in thread
From: Ingo Molnar @ 2009-05-12  7:55 UTC (permalink / raw)
  To: Arnd Bergmann; +Cc: x86, linux-kernel, Remis Lima Baima


* Arnd Bergmann <arnd@arndb.de> wrote:

> The operation with the variable 'c_line' was missing in the function
> 'user_termio_to_kernel_termios'. Also the casting '*(unsigned short *)'
> in the macro 'SET_LOW_TERMIOS_BITS' was a bit 'unhealthy'. So the macro
> was removed and the function was changed to be like in other archs
> (e.g. h8300, m68k, sparc) that have a more elegant solution.
> 
> In the function 'kernel_termios_to_user_termio' the return values of
> the functions calls 'put_user' and 'copy_to_user' were not being
> checked.
> 
> Signed-off-by: Remis Lima Baima <remis.developer@googlemail.com>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> 
> initial patch was wordwrapped, resend
> 
>  arch/x86/include/asm/termios.h |   54 +++++++++++++++++++++++++++------------
>  1 files changed, 37 insertions(+), 17 deletions(-)
> 
> diff --git a/arch/x86/include/asm/termios.h b/arch/x86/include/asm/termios.h
> index f729563..47420df 100644
> --- a/arch/x86/include/asm/termios.h
> +++ b/arch/x86/include/asm/termios.h
> @@ -54,20 +54,37 @@ struct termio {
>  /*
>   * Translate a "termio" structure into a "termios". Ugh.
>   */
> -#define SET_LOW_TERMIOS_BITS(termios, termio, x) { \
> -	unsigned short __tmp; \
> -	get_user(__tmp,&(termio)->x); \
> -	*(unsigned short *) &(termios)->x = __tmp; \
> -}
> -
>  static inline int user_termio_to_kernel_termios(struct ktermios *termios,
>  						struct termio __user *termio)
>  {
> -	SET_LOW_TERMIOS_BITS(termios, termio, c_iflag);
> -	SET_LOW_TERMIOS_BITS(termios, termio, c_oflag);
> -	SET_LOW_TERMIOS_BITS(termios, termio, c_cflag);
> -	SET_LOW_TERMIOS_BITS(termios, termio, c_lflag);
> -	return copy_from_user(termios->c_cc, termio->c_cc, NCC);
> +	unsigned short tmp;
> +
> +	if (get_user(tmp, &termio->c_iflag) < 0)
> +		goto fault;
> +	termios->c_iflag = (0xffff0000 & termios->c_iflag) | tmp;
> +
> +	if (get_user(tmp, &termio->c_oflag) < 0)
> +		goto fault;
> +	termios->c_oflag = (0xffff0000 & termios->c_oflag) | tmp;
> +
> +	if (get_user(tmp, &termio->c_cflag) < 0)
> +		goto fault;
> +	termios->c_cflag = (0xffff0000 & termios->c_cflag) | tmp;
> +
> +	if (get_user(tmp, &termio->c_lflag) < 0)
> +		goto fault;
> +	termios->c_lflag = (0xffff0000 & termios->c_lflag) | tmp;
> +
> +	if (get_user(termios->c_line, &termio->c_line) < 0)
> +		goto fault;
> +
> +	if (copy_from_user(termios->c_cc, termio->c_cc, NCC) != 0)
> +		goto fault;

Hm, that looks a bit ugly and it also adds 150 bytes of bloat to the 
kernel:

drivers/char/tty_ioctl.o:

   text	   data	    bss	    dec	    hex	filename
   4704	      0	      0	   4704	   1260	tty_ioctl.o.before
   4841	      0	      0	   4841	   12e9	tty_ioctl.o.after

(64-bit 'make defconfig', on latest tip:master)

	Ingo

^ permalink raw reply	[flat|nested] 86+ messages in thread

* Re: [PATCH] ata: libata depends on HAS_DMA
  2009-05-11 22:38 ` [PATCH] ata: libata depends on HAS_DMA Arnd Bergmann
  2009-05-12  0:58   ` Jeff Garzik
@ 2009-05-12  8:06   ` Alan Cox
  2009-05-12  9:23       ` Arnd Bergmann
  1 sibling, 1 reply; 86+ messages in thread
From: Alan Cox @ 2009-05-12  8:06 UTC (permalink / raw)
  To: Arnd Bergmann; +Cc: linux-kernel, Jeff Garzik, linux-ide

On Mon, 11 May 2009 22:38:55 +0000
Arnd Bergmann <arnd@arndb.de> wrote:

> libata uses the DMA mapping API, so it cannot be built
> on architectures that don't have DMA support.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Nakked-by: Alan Cox <alan@linux.intel.com>

Almost every PATA adapter can fall back to PIO, many are PIO only. We
need a rather cleaner way to sort this.

^ permalink raw reply	[flat|nested] 86+ messages in thread

* Re: [PATCH v2] x86: fix ktermios-termio conversion
  2009-05-12  7:55     ` Ingo Molnar
@ 2009-05-12  9:04       ` Arnd Bergmann
  2009-05-12  9:10         ` Ingo Molnar
  2009-05-12  9:17         ` Alan Cox
  0 siblings, 2 replies; 86+ messages in thread
From: Arnd Bergmann @ 2009-05-12  9:04 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: x86, linux-kernel, Remis Lima Baima

On Tuesday 12 May 2009, Ingo Molnar wrote:
> Hm, that looks a bit ugly and it also adds 150 bytes of bloat to the 
> kernel:
> 
> drivers/char/tty_ioctl.o:
> 
>    text    data     bss     dec     hex filename
>    4704       0       0    4704    1260 tty_ioctl.o.before
>    4841       0       0    4841    12e9 tty_ioctl.o.after

It's easy to go back to a macro (or replace it by another inline
function if you prefer that stylistically) to make it look
nicer.

Regarding the bloat, I'm still looking for a better version.
The code I posted is basically what is in asm-generic/termios.h
traditionally, so at least I'm reasonably confident that it
is correct, while the x86 version currently fails to return
-EFAULT on incorrect pointers and misses c_line changes.

I now tried this version, which theoretically should be
fairly compact on most architectures:

static inline int set_low_termios_bits(unsigned int *termios,
			const short __user *termio)
{
	unsigned short tmp;
	int ret;

	ret = __get_user(tmp, termio);
	*termios = (0xffff0000 & *termios) | tmp;

	return ret;
}

/*
 * Translate a "termio" structure into a "termios". Ugh.
 */
static inline int user_termio_to_kernel_termios(struct ktermios *termios,
						const struct termio __user *termio)
{
	if (access_ok(VERIFY_READ, termio, sizeof (*termio)))
		return -EFAULT;

	return set_low_termios_bits(&termios->c_iflag, &termio->c_iflag) |
	       set_low_termios_bits(&termios->c_oflag, &termio->c_oflag) |
	       set_low_termios_bits(&termios->c_cflag, &termio->c_cflag) |
	       set_low_termios_bits(&termios->c_lflag, &termio->c_lflag) |
	       __get_user(termios->c_line, &termio->c_line) |
	       (__copy_from_user(termios->c_cc, termio->c_cc, NCC)
				? -EFAULT : 0);
}

/*
 * Translate a "termios" structure into a "termio". Ugh.
 */
static inline int kernel_termios_to_user_termio(struct termio __user *termio,
						struct ktermios *termios)
{
	if (access_ok(VERIFY_WRITE, termio, sizeof (*termio)))
		return -EFAULT;

	return __put_user(termios->c_iflag, &termio->c_iflag) |
	       __put_user(termios->c_oflag, &termio->c_oflag) |
	       __put_user(termios->c_cflag, &termio->c_cflag) |
	       __put_user(termios->c_lflag, &termio->c_lflag) |
	       __put_user(termios->c_line,  &termio->c_line) |
	       (__copy_to_user(termio->c_cc, termios->c_cc, NCC)
				? -EFAULT : 0);
}

Unfortunately, this is even more code on x86, where get_user/put_user
is out-of-line, while __get_user/__put_user is inline and produces
fixup code.
The best I could come up with is somewhat slower but also shorter:

static inline int set_low_termios_bits(unsigned int *termios,
			const short __user *termio)
{
	unsigned short tmp;
	int ret;

	ret = get_user(tmp, termio);
	*termios = (0xffff0000 & *termios) | tmp;

	return ret;
}

/*
 * Translate a "termio" structure into a "termios". Ugh.
 */
static inline int user_termio_to_kernel_termios(struct ktermios *termios,
						const struct termio __user *termio)
{
	return (set_low_termios_bits(&termios->c_iflag, &termio->c_iflag) ||
		set_low_termios_bits(&termios->c_oflag, &termio->c_oflag) ||
		set_low_termios_bits(&termios->c_cflag, &termio->c_cflag) ||
		set_low_termios_bits(&termios->c_lflag, &termio->c_lflag) ||
		get_user(termios->c_line, &termio->c_line) ||
		copy_from_user(termios->c_cc, termio->c_cc, NCC))
				? -EFAULT : 0;
}

/*
 * Translate a "termios" structure into a "termio". Ugh.
 */
static inline int kernel_termios_to_user_termio(struct termio __user *termio,
						struct ktermios *termios)
{
	return put_user(termios->c_iflag, &termio->c_iflag) ||
	       put_user(termios->c_oflag, &termio->c_oflag) ||
	       put_user(termios->c_cflag, &termio->c_cflag) ||
	       put_user(termios->c_lflag, &termio->c_lflag) ||
	       put_user(termios->c_line,  &termio->c_line) ||
	       (copy_to_user(termio->c_cc, termios->c_cc, NCC))
				? -EFAULT : 0;
}

If you think that looks better, I can send another patch. I have
not tested this code functionally though.

	Arnd <><

^ permalink raw reply	[flat|nested] 86+ messages in thread

* Re: [PATCH v2] x86: fix ktermios-termio conversion
  2009-05-12  9:04       ` Arnd Bergmann
@ 2009-05-12  9:10         ` Ingo Molnar
  2009-05-12  9:21           ` Alan Cox
  2009-05-12 11:42           ` [PATCH v2] " Arnd Bergmann
  2009-05-12  9:17         ` Alan Cox
  1 sibling, 2 replies; 86+ messages in thread
From: Ingo Molnar @ 2009-05-12  9:10 UTC (permalink / raw)
  To: Arnd Bergmann; +Cc: x86, linux-kernel, Remis Lima Baima


* Arnd Bergmann <arnd@arndb.de> wrote:

> On Tuesday 12 May 2009, Ingo Molnar wrote:
> > Hm, that looks a bit ugly and it also adds 150 bytes of bloat to the 
> > kernel:
> > 
> > drivers/char/tty_ioctl.o:
> > 
> >    text    data     bss     dec     hex filename
> >    4704       0       0    4704    1260 tty_ioctl.o.before
> >    4841       0       0    4841    12e9 tty_ioctl.o.after
> 
> It's easy to go back to a macro (or replace it by another inline 
> function if you prefer that stylistically) to make it look nicer.

no, we shouldnt go back to a macro.

> Regarding the bloat, I'm still looking for a better version. The 
> code I posted is basically what is in asm-generic/termios.h 
> traditionally, so at least I'm reasonably confident that it is 
> correct, while the x86 version currently fails to return -EFAULT 
> on incorrect pointers and misses c_line changes.
> 
> I now tried this version, which theoretically should be fairly 
> compact on most architectures:
> 
> static inline int set_low_termios_bits(unsigned int *termios,
> 			const short __user *termio)
> {
> 	unsigned short tmp;
> 	int ret;
> 
> 	ret = __get_user(tmp, termio);
> 	*termios = (0xffff0000 & *termios) | tmp;
> 
> 	return ret;
> }
> 
> /*
>  * Translate a "termio" structure into a "termios". Ugh.
>  */
> static inline int user_termio_to_kernel_termios(struct ktermios *termios,
> 						const struct termio __user *termio)
> {
> 	if (access_ok(VERIFY_READ, termio, sizeof (*termio)))
> 		return -EFAULT;
> 
> 	return set_low_termios_bits(&termios->c_iflag, &termio->c_iflag) |
> 	       set_low_termios_bits(&termios->c_oflag, &termio->c_oflag) |
> 	       set_low_termios_bits(&termios->c_cflag, &termio->c_cflag) |
> 	       set_low_termios_bits(&termios->c_lflag, &termio->c_lflag) |
> 	       __get_user(termios->c_line, &termio->c_line) |
> 	       (__copy_from_user(termios->c_cc, termio->c_cc, NCC)
> 				? -EFAULT : 0);
> }
> 
> /*
>  * Translate a "termios" structure into a "termio". Ugh.
>  */
> static inline int kernel_termios_to_user_termio(struct termio __user *termio,
> 						struct ktermios *termios)
> {
> 	if (access_ok(VERIFY_WRITE, termio, sizeof (*termio)))
> 		return -EFAULT;
> 
> 	return __put_user(termios->c_iflag, &termio->c_iflag) |
> 	       __put_user(termios->c_oflag, &termio->c_oflag) |
> 	       __put_user(termios->c_cflag, &termio->c_cflag) |
> 	       __put_user(termios->c_lflag, &termio->c_lflag) |
> 	       __put_user(termios->c_line,  &termio->c_line) |
> 	       (__copy_to_user(termio->c_cc, termios->c_cc, NCC)
> 				? -EFAULT : 0);
> }
> 
> Unfortunately, this is even more code on x86, where get_user/put_user
> is out-of-line, while __get_user/__put_user is inline and produces
> fixup code.
> The best I could come up with is somewhat slower but also shorter:
> 
> static inline int set_low_termios_bits(unsigned int *termios,
> 			const short __user *termio)
> {
> 	unsigned short tmp;
> 	int ret;
> 
> 	ret = get_user(tmp, termio);
> 	*termios = (0xffff0000 & *termios) | tmp;
> 
> 	return ret;
> }
> 
> /*
>  * Translate a "termio" structure into a "termios". Ugh.
>  */
> static inline int user_termio_to_kernel_termios(struct ktermios *termios,
> 						const struct termio __user *termio)
> {
> 	return (set_low_termios_bits(&termios->c_iflag, &termio->c_iflag) ||
> 		set_low_termios_bits(&termios->c_oflag, &termio->c_oflag) ||
> 		set_low_termios_bits(&termios->c_cflag, &termio->c_cflag) ||
> 		set_low_termios_bits(&termios->c_lflag, &termio->c_lflag) ||
> 		get_user(termios->c_line, &termio->c_line) ||
> 		copy_from_user(termios->c_cc, termio->c_cc, NCC))
> 				? -EFAULT : 0;
> }
> 
> /*
>  * Translate a "termios" structure into a "termio". Ugh.
>  */
> static inline int kernel_termios_to_user_termio(struct termio __user *termio,
> 						struct ktermios *termios)
> {
> 	return put_user(termios->c_iflag, &termio->c_iflag) ||
> 	       put_user(termios->c_oflag, &termio->c_oflag) ||
> 	       put_user(termios->c_cflag, &termio->c_cflag) ||
> 	       put_user(termios->c_lflag, &termio->c_lflag) ||
> 	       put_user(termios->c_line,  &termio->c_line) ||
> 	       (copy_to_user(termio->c_cc, termios->c_cc, NCC))
> 				? -EFAULT : 0;
> }
> 
> If you think that looks better, I can send another patch. I have 
> not tested this code functionally though.

hm, on x86 you could use get_user_try / get_user_ex() / 
get_user_catch() approach to linearize the dependencies and reduce 
register pressure.

	Ingo

^ permalink raw reply	[flat|nested] 86+ messages in thread

* Re: [PATCH v2] x86: fix ktermios-termio conversion
  2009-05-12  9:04       ` Arnd Bergmann
  2009-05-12  9:10         ` Ingo Molnar
@ 2009-05-12  9:17         ` Alan Cox
  1 sibling, 0 replies; 86+ messages in thread
From: Alan Cox @ 2009-05-12  9:17 UTC (permalink / raw)
  To: Arnd Bergmann; +Cc: Ingo Molnar, x86, linux-kernel, Remis Lima Baima

> I now tried this version, which theoretically should be
> fairly compact on most architectures:

We don't really need to inline any of this btw - its an back compat
obscure path so its not performance relevant at all.

We probably should fix c_line but the rest is hardly worth the bother.

^ permalink raw reply	[flat|nested] 86+ messages in thread

* Re: [PATCH v2] x86: fix ktermios-termio conversion
  2009-05-12  9:10         ` Ingo Molnar
@ 2009-05-12  9:21           ` Alan Cox
  2009-05-12  9:26             ` Ingo Molnar
  2009-05-12 11:42           ` [PATCH v2] " Arnd Bergmann
  1 sibling, 1 reply; 86+ messages in thread
From: Alan Cox @ 2009-05-12  9:21 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: Arnd Bergmann, x86, linux-kernel, Remis Lima Baima

> hm, on x86 you could use get_user_try / get_user_ex() / 
> get_user_catch() approach to linearize the dependencies and reduce 
> register pressure.

It used *once*, in a path that is never executed except by some ancient
binaries. It isn't worth the effort.

^ permalink raw reply	[flat|nested] 86+ messages in thread

* Re: [PATCH] ata: libata depends on HAS_DMA
  2009-05-12  8:06   ` Alan Cox
@ 2009-05-12  9:23       ` Arnd Bergmann
  0 siblings, 0 replies; 86+ messages in thread
From: Arnd Bergmann @ 2009-05-12  9:23 UTC (permalink / raw)
  To: Alan Cox
  Cc: linux-kernel, Jeff Garzik, linux-ide, takata, geert, linux-m68k, ysato

On Tuesday 12 May 2009, Alan Cox wrote:
> Nakked-by: Alan Cox <alan@linux.intel.com>
> 
> Almost every PATA adapter can fall back to PIO, many are PIO only. We
> need a rather cleaner way to sort this.

Currently, the only architectures that don't set HAS_DMA are h8300, m32r
m68k (except SUN3 and Coldfire), microblaze and s390.
s390 will never get it, microblaze is currently implementing dma-mapping.h.

The other three are still using drivers/ide instead of drivers/ata.

One way to fix this would be to implement dma-mapping.h in h8300, m32r and
m68k and leave !HAS_DMA as the obscure s390 case (this one already can't
use ATA because of !HAS_MMIO).

The other way would be to add some #ifdef CONFIG_HAS_DMA in libata-core.c
and sas_ata.c.

	Arnd <><

	Arnd <><


^ permalink raw reply	[flat|nested] 86+ messages in thread

* Re: [PATCH] ata: libata depends on HAS_DMA
@ 2009-05-12  9:23       ` Arnd Bergmann
  0 siblings, 0 replies; 86+ messages in thread
From: Arnd Bergmann @ 2009-05-12  9:23 UTC (permalink / raw)
  To: Alan Cox
  Cc: linux-kernel, Jeff Garzik, linux-ide, takata, geert, linux-m68k, ysato

On Tuesday 12 May 2009, Alan Cox wrote:
> Nakked-by: Alan Cox <alan@linux.intel.com>
> 
> Almost every PATA adapter can fall back to PIO, many are PIO only. We
> need a rather cleaner way to sort this.

Currently, the only architectures that don't set HAS_DMA are h8300, m32r
m68k (except SUN3 and Coldfire), microblaze and s390.
s390 will never get it, microblaze is currently implementing dma-mapping.h.

The other three are still using drivers/ide instead of drivers/ata.

One way to fix this would be to implement dma-mapping.h in h8300, m32r and
m68k and leave !HAS_DMA as the obscure s390 case (this one already can't
use ATA because of !HAS_MMIO).

The other way would be to add some #ifdef CONFIG_HAS_DMA in libata-core.c
and sas_ata.c.

	Arnd <><

	Arnd <><


^ permalink raw reply	[flat|nested] 86+ messages in thread

* Re: [PATCH v2] x86: fix ktermios-termio conversion
  2009-05-12  9:21           ` Alan Cox
@ 2009-05-12  9:26             ` Ingo Molnar
  2009-05-12 10:05               ` Alan Cox
  0 siblings, 1 reply; 86+ messages in thread
From: Ingo Molnar @ 2009-05-12  9:26 UTC (permalink / raw)
  To: Alan Cox; +Cc: Arnd Bergmann, x86, linux-kernel, Remis Lima Baima


* Alan Cox <alan@lxorguk.ukuu.org.uk> wrote:

> > hm, on x86 you could use get_user_try / get_user_ex() / 
> > get_user_catch() approach to linearize the dependencies and 
> > reduce register pressure.
> 
> It used *once*, in a path that is never executed except by some 
> ancient binaries. It isn't worth the effort.

i know, and i tested the patch so i know what effects it has.

I never made any argument about inlining, it's obviously correct to 
have a use-once function inline.

My argument was very simple: the patch causes +150 bytes of bloat. 
The try/ex/catch method can help reduce register pressure and can 
reducethe size of code quite visibly.

	Ingo

^ permalink raw reply	[flat|nested] 86+ messages in thread

* Re: [PATCH] input: use PIT_TICK_RATE in vt beep ioctl
  2009-05-11 22:58 ` [PATCH] input: use PIT_TICK_RATE in vt beep ioctl Arnd Bergmann
@ 2009-05-12  9:31   ` Alan Cox
  0 siblings, 0 replies; 86+ messages in thread
From: Alan Cox @ 2009-05-12  9:31 UTC (permalink / raw)
  To: Arnd Bergmann; +Cc: linux-kernel, Dmitry Torokhov, linux-input

> This patch depends on "move PIT_TICK_RATE to linux/timex.h"
> in order to build on architectures that previously did not
> define PIT_TICK_RATE.
> 
> Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> Cc: linux-input@vger.kernel.org
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Acked-by: Alan Cox <alan@linux.intel.com>

I think this is probably the lesser of the evils here.

^ permalink raw reply	[flat|nested] 86+ messages in thread

* Re: [PATCH v2] x86: fix ktermios-termio conversion
  2009-05-12  9:26             ` Ingo Molnar
@ 2009-05-12 10:05               ` Alan Cox
  2009-05-12 10:15                 ` Ingo Molnar
  2009-05-12 11:33                 ` [PATCH v3] " Arnd Bergmann
  0 siblings, 2 replies; 86+ messages in thread
From: Alan Cox @ 2009-05-12 10:05 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: Arnd Bergmann, x86, linux-kernel, Remis Lima Baima

> My argument was very simple: the patch causes +150 bytes of bloat. 
> The try/ex/catch method can help reduce register pressure and can 
> reducethe size of code quite visibly.

My argument is even simpler - its not worth the effort in the first place.

I'm sure you could use the same time to shave 150 bytes and a few clocks
of a path that actually gets executed.

Arnd - can you send me a diff that keeps the existing horrible macro
version, the existing __put_user usage and just fixes c_line ? It's
worked for 15 years, its not worth the time being fancy with it.

Alan

^ permalink raw reply	[flat|nested] 86+ messages in thread

* Re: [PATCH v2] x86: fix ktermios-termio conversion
  2009-05-12 10:05               ` Alan Cox
@ 2009-05-12 10:15                 ` Ingo Molnar
  2009-05-12 11:33                 ` [PATCH v3] " Arnd Bergmann
  1 sibling, 0 replies; 86+ messages in thread
From: Ingo Molnar @ 2009-05-12 10:15 UTC (permalink / raw)
  To: Alan Cox; +Cc: Arnd Bergmann, x86, linux-kernel, Remis Lima Baima


* Alan Cox <alan@lxorguk.ukuu.org.uk> wrote:

> > My argument was very simple: the patch causes +150 bytes of 
> > bloat. The try/ex/catch method can help reduce register pressure 
> > and can reducethe size of code quite visibly.
> 
> My argument is even simpler - its not worth the effort in the 
> first place.
> 
> I'm sure you could use the same time to shave 150 bytes and a few 
> clocks of a path that actually gets executed.

This is about kernel image size as well. This version of the patch 
bloats the kernel. The death of a thousand cuts ...

> Arnd - can you send me a diff that keeps the existing horrible 
> macro version, the existing __put_user usage and just fixes c_line 
> ? It's worked for 15 years, its not worth the time being fancy 
> with it.

Agreed.

	Ingo

^ permalink raw reply	[flat|nested] 86+ messages in thread

* [PATCH v3] x86: fix ktermios-termio conversion
  2009-05-12 10:05               ` Alan Cox
  2009-05-12 10:15                 ` Ingo Molnar
@ 2009-05-12 11:33                 ` Arnd Bergmann
  1 sibling, 0 replies; 86+ messages in thread
From: Arnd Bergmann @ 2009-05-12 11:33 UTC (permalink / raw)
  To: Alan Cox; +Cc: Ingo Molnar, x86, linux-kernel, Remis Lima Baima

The legacy TCSETA{,W,F} ioctls failed to set the termio->c_line field
on x86. This adds a missing get_user.

The same ioctls also fail to report faulting user pointers, which
we keep ignoring.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---

On Tuesday 12 May 2009, Alan Cox wrote:
> Arnd - can you send me a diff that keeps the existing horrible macro
> version, the existing __put_user usage and just fixes c_line ? It's
> worked for 15 years, its not worth the time being fancy with it.

I should probably have made my intention clearer. I'm sitting on a
series of patches [1] that generalize a lot of headers by making an
asm-generic version and falling back on this in all architectures that
have the same code.

The x86 SET_LOW_TERMIOS_BITS macro, besides its own stylistic problems,
only works on little-endian architectures and generates compiler warnings
on architectures on which get_user returns 'int __must_check'.
My asm-generic version fixes this by using the architecture independent
code I posted in this thread.

One of my later patches removes all x86 specific headers that are identical
to the asm-generic version. The termios.h header is almost identical,
so I first wanted to submit the patch to make it actually the same.

	Arnd <><

[1] git.kernel.org:/pub/scm/linux/kernel/git/arnd/asm-generic.git

diff --git a/arch/x86/include/asm/termios.h b/arch/x86/include/asm/termios.h
index f729563..c4ee805 100644
--- a/arch/x86/include/asm/termios.h
+++ b/arch/x86/include/asm/termios.h
@@ -67,6 +67,7 @@ static inline int user_termio_to_kernel_termios(struct ktermios *termios,
 	SET_LOW_TERMIOS_BITS(termios, termio, c_oflag);
 	SET_LOW_TERMIOS_BITS(termios, termio, c_cflag);
 	SET_LOW_TERMIOS_BITS(termios, termio, c_lflag);
+	get_user(termios->c_line, &termio->c_line);
 	return copy_from_user(termios->c_cc, termio->c_cc, NCC);
 }
 

^ permalink raw reply related	[flat|nested] 86+ messages in thread

* Re: [PATCH v2] x86: fix ktermios-termio conversion
  2009-05-12  9:10         ` Ingo Molnar
  2009-05-12  9:21           ` Alan Cox
@ 2009-05-12 11:42           ` Arnd Bergmann
  1 sibling, 0 replies; 86+ messages in thread
From: Arnd Bergmann @ 2009-05-12 11:42 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: x86, linux-kernel, Remis Lima Baima, linux-arch

On Tuesday 12 May 2009, Ingo Molnar wrote:
> hm, on x86 you could use get_user_try / get_user_ex() / 
> get_user_catch() approach to linearize the dependencies and reduce 
> register pressure.

Yes, but that would not help my intention of making the file more
generic. The x86 code was copied into a number of architectures, and
at least arm, m32r, parisc, sh and xtensa have big-endian configurations
where the implementation is wrong.

I only realized that while writing this email though and I guess I
need to fix those as well now ;-) 

	Arnd <><

^ permalink raw reply	[flat|nested] 86+ messages in thread

* Re: [PATCH] ata: libata depends on HAS_DMA
  2009-05-12  0:58   ` Jeff Garzik
@ 2009-05-12 12:40     ` Arnd Bergmann
  2009-05-12 13:05         ` Arnd Bergmann
  0 siblings, 1 reply; 86+ messages in thread
From: Arnd Bergmann @ 2009-05-12 12:40 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: linux-kernel, linux-ide

On Tuesday 12 May 2009, Jeff Garzik wrote:
> > --- a/drivers/ata/Kconfig
> > +++ b/drivers/ata/Kconfig
> > @@ -4,7 +4,7 @@
> >  
> >  menuconfig ATA
> >       tristate "Serial ATA (prod) and Parallel ATA (experimental) drivers"
> > -     depends on HAS_IOMEM
> > +     depends on HAS_IOMEM && HAS_DMA
> >       depends on BLOCK
> >       depends on !(M32R || M68K) || BROKEN
> 
> What specifically is breaking?
> 
> Ideally we should be able to work with PIO-only...

CONFIG_HAS_DMA is not set on architectures that are missing
asm/dma-mapping.h or fall back to asm-generic/dma-mapping-broken.h.

In the latter case, you get a link error:
drivers/built-in.o: In function `sas_issue_ata_cmd':
/home/arnd/linux/linux-2.6/drivers/scsi/libsas/sas_ata.c(.text+0x33c50): undefined reference to `dma_map_sg'
/home/arnd/linux/linux-2.6/drivers/scsi/libsas/sas_ata.c(.text+0x33ef0): undefined reference to `dma_unmap_sg'
drivers/built-in.o: In function `ata_sg_clean':
/home/arnd/linux/linux-2.6/drivers/ata/libata-core.c(.text+0x37d18): undefined reference to `dma_unmap_sg'
drivers/built-in.o: In function `ata_qc_issue':
/home/arnd/linux/linux-2.6/drivers/ata/libata-core.c(.text+0x38774): undefined reference to `dma_map_sg'
drivers/built-in.o: In function `ata_port_start':
/home/arnd/linux/linux-2.6/drivers/ata/libata-core.c(.text+0x3bf0c): undefined reference to `dmam_alloc_coherent'

A slightly less naive (but still suboptimal) fix would be the patch below.
I could not find an easy way to force all devices to use PIO, this
patch would simply fail if someone tried to set a DMA mode.

	Arnd <><

--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -4629,6 +4629,7 @@ static unsigned int ata_dev_init_params(struct ata_device *dev,
  */
 void ata_sg_clean(struct ata_queued_cmd *qc)
 {
+#ifdef CONFIG_HAS_DMA
 	struct ata_port *ap = qc->ap;
 	struct scatterlist *sg = qc->sg;
 	int dir = qc->dma_dir;
@@ -4642,6 +4643,7 @@ void ata_sg_clean(struct ata_queued_cmd *qc)
 
 	qc->flags &= ~ATA_QCFLAG_DMAMAP;
 	qc->sg = NULL;
+#endif /* CONFIG_HAS_DMA */
 }
 
 /**
@@ -4743,6 +4745,7 @@ void ata_sg_init(struct ata_queued_cmd *qc, struct scatterlist *sg,
  */
 static int ata_sg_setup(struct ata_queued_cmd *qc)
 {
+#ifdef CONFIG_HAS_DMA
 	struct ata_port *ap = qc->ap;
 	unsigned int n_elem;
 
@@ -4758,6 +4761,10 @@ static int ata_sg_setup(struct ata_queued_cmd *qc)
 	qc->flags |= ATA_QCFLAG_DMAMAP;
 
 	return 0;
+#else
+	DPRINTK("attempted to use DMA on incompatible architecture\n");
+	return -EINVAL;
+#endif /* CONFIG_HAS_DMA */
 }
 
 /**
@@ -5450,8 +5457,12 @@ int ata_port_start(struct ata_port *ap)
 {
 	struct device *dev = ap->dev;
 
+#ifdef CONFIG_HAS_DMA
 	ap->prd = dmam_alloc_coherent(dev, ATA_PRD_TBL_SZ, &ap->prd_dma,
 				      GFP_KERNEL);
+#else
+	ap->prd = devres_alloc(dev, ATA_PRD_TBL_SZ, GFP_KERNEL);
+#endif /* CONFIG_HAS_DMA */
 	if (!ap->prd)
 		return -ENOMEM;
 
diff --git a/drivers/scsi/libsas/Kconfig b/drivers/scsi/libsas/Kconfig
index 59e00fa..e00271f 100644
--- a/drivers/scsi/libsas/Kconfig
+++ b/drivers/scsi/libsas/Kconfig
@@ -34,6 +34,7 @@ config SCSI_SAS_ATA
 	bool "ATA support for libsas (requires libata)"
 	depends on SCSI_SAS_LIBSAS
 	depends on ATA = y || ATA = SCSI_SAS_LIBSAS
+	depends on HAS_DMA
 	help
 		Builds in ATA support into libsas.  Will necessitate
 		the loading of libata along with libsas.

^ permalink raw reply related	[flat|nested] 86+ messages in thread

* Re: [PATCH] ata: libata depends on HAS_DMA
  2009-05-12 12:40     ` Arnd Bergmann
@ 2009-05-12 13:05         ` Arnd Bergmann
  0 siblings, 0 replies; 86+ messages in thread
From: Arnd Bergmann @ 2009-05-12 13:05 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: linux-kernel, linux-ide

On Tuesday 12 May 2009, Arnd Bergmann wrote:
> +#ifdef CONFIG_HAS_DMA
>         ap->prd = dmam_alloc_coherent(dev, ATA_PRD_TBL_SZ, &ap->prd_dma,
>                                       GFP_KERNEL);
> +#else
> +       ap->prd = devres_alloc(dev, ATA_PRD_TBL_SZ, GFP_KERNEL);
> +#endif /* CONFIG_HAS_DMA */
>         if (!ap->prd)
>                 return -ENOMEM;

this should have been devm_kzalloc, not devres_alloc.

	Arnd <><

^ permalink raw reply	[flat|nested] 86+ messages in thread

* Re: [PATCH] ata: libata depends on HAS_DMA
@ 2009-05-12 13:05         ` Arnd Bergmann
  0 siblings, 0 replies; 86+ messages in thread
From: Arnd Bergmann @ 2009-05-12 13:05 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: linux-kernel, linux-ide

On Tuesday 12 May 2009, Arnd Bergmann wrote:> +#ifdef CONFIG_HAS_DMA>         ap->prd = dmam_alloc_coherent(dev, ATA_PRD_TBL_SZ, &ap->prd_dma,>                                       GFP_KERNEL);> +#else> +       ap->prd = devres_alloc(dev, ATA_PRD_TBL_SZ, GFP_KERNEL);> +#endif /* CONFIG_HAS_DMA */>         if (!ap->prd)>                 return -ENOMEM;
this should have been devm_kzalloc, not devres_alloc.
	Arnd <><ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dʇڙë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥

^ permalink raw reply	[flat|nested] 86+ messages in thread

* Re: [PATCH] ata: libata depends on HAS_DMA
  2009-05-12  9:23       ` Arnd Bergmann
@ 2009-05-13  3:30         ` Brad Boyer
  -1 siblings, 0 replies; 86+ messages in thread
From: Brad Boyer @ 2009-05-13  3:30 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Alan Cox, linux-kernel, Jeff Garzik, linux-ide, takata, geert,
	linux-m68k, ysato

On Tue, May 12, 2009 at 11:23:20AM +0200, Arnd Bergmann wrote:
> Currently, the only architectures that don't set HAS_DMA are h8300, m32r
> m68k (except SUN3 and Coldfire), microblaze and s390.
> s390 will never get it, microblaze is currently implementing dma-mapping.h.
> 
> The other three are still using drivers/ide instead of drivers/ata.
> 
> One way to fix this would be to implement dma-mapping.h in h8300, m32r and
> m68k and leave !HAS_DMA as the obscure s390 case (this one already can't
> use ATA because of !HAS_MMIO).

If I'm reading the m68k code correctly, SUN3 is the one that doesn't have
DMA. It is implemented on any m68k with a standard Motorola MMU. It might
be possible to get the DMA code working on a sun3, but I doubt they ever
have IDE hardware.

	Brad Boyer
	flar@allandria.com


^ permalink raw reply	[flat|nested] 86+ messages in thread

* Re: [PATCH] ata: libata depends on HAS_DMA
@ 2009-05-13  3:30         ` Brad Boyer
  0 siblings, 0 replies; 86+ messages in thread
From: Brad Boyer @ 2009-05-13  3:30 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Alan Cox, linux-kernel, Jeff Garzik, linux-ide, takata, geert,
	linux-m68k, ysato

On Tue, May 12, 2009 at 11:23:20AM +0200, Arnd Bergmann wrote:
> Currently, the only architectures that don't set HAS_DMA are h8300, m32r
> m68k (except SUN3 and Coldfire), microblaze and s390.
> s390 will never get it, microblaze is currently implementing dma-mapping.h.
> 
> The other three are still using drivers/ide instead of drivers/ata.
> 
> One way to fix this would be to implement dma-mapping.h in h8300, m32r and
> m68k and leave !HAS_DMA as the obscure s390 case (this one already can't
> use ATA because of !HAS_MMIO).

If I'm reading the m68k code correctly, SUN3 is the one that doesn't have
DMA. It is implemented on any m68k with a standard Motorola MMU. It might
be possible to get the DMA code working on a sun3, but I doubt they ever
have IDE hardware.

	Brad Boyer
	flar@allandria.com


^ permalink raw reply	[flat|nested] 86+ messages in thread

* Re: [PATCH] ata: libata depends on HAS_DMA
  2009-05-13  3:30         ` Brad Boyer
@ 2009-05-13  4:12           ` Michael Schmitz
  -1 siblings, 0 replies; 86+ messages in thread
From: Michael Schmitz @ 2009-05-13  4:12 UTC (permalink / raw)
  To: Brad Boyer
  Cc: Arnd Bergmann, Alan Cox, linux-kernel, Jeff Garzik, linux-ide,
	takata, geert, linux-m68k, ysato

Hi,

> > Currently, the only architectures that don't set HAS_DMA are h8300, m32r
> > m68k (except SUN3 and Coldfire), microblaze and s390.
> > s390 will never get it, microblaze is currently implementing dma-mapping.h.
> > 
> > The other three are still using drivers/ide instead of drivers/ata.
> > 
> > One way to fix this would be to implement dma-mapping.h in h8300, m32r and
> > m68k and leave !HAS_DMA as the obscure s390 case (this one already can't
> > use ATA because of !HAS_MMIO).
> 
> If I'm reading the m68k code correctly, SUN3 is the one that doesn't have
> DMA. It is implemented on any m68k with a standard Motorola MMU. It might
> be possible to get the DMA code working on a sun3, but I doubt they ever
> have IDE hardware.

The Atari IDE interface does not use DMA. I don't see what addition of DMA 
mapping for IDE would achieve. 

If it doesn't interfere with plain PIO mode, fine. 

	Michael


^ permalink raw reply	[flat|nested] 86+ messages in thread

* Re: [PATCH] ata: libata depends on HAS_DMA
@ 2009-05-13  4:12           ` Michael Schmitz
  0 siblings, 0 replies; 86+ messages in thread
From: Michael Schmitz @ 2009-05-13  4:12 UTC (permalink / raw)
  To: Brad Boyer
  Cc: Arnd Bergmann, Alan Cox, linux-kernel, Jeff Garzik, linux-ide,
	takata, geert, linux-m68k, ysato

Hi,

> > Currently, the only architectures that don't set HAS_DMA are h8300, m32r
> > m68k (except SUN3 and Coldfire), microblaze and s390.
> > s390 will never get it, microblaze is currently implementing dma-mapping.h.
> > 
> > The other three are still using drivers/ide instead of drivers/ata.
> > 
> > One way to fix this would be to implement dma-mapping.h in h8300, m32r and
> > m68k and leave !HAS_DMA as the obscure s390 case (this one already can't
> > use ATA because of !HAS_MMIO).
> 
> If I'm reading the m68k code correctly, SUN3 is the one that doesn't have
> DMA. It is implemented on any m68k with a standard Motorola MMU. It might
> be possible to get the DMA code working on a sun3, but I doubt they ever
> have IDE hardware.

The Atari IDE interface does not use DMA. I don't see what addition of DMA 
mapping for IDE would achieve. 

If it doesn't interfere with plain PIO mode, fine. 

	Michael


^ permalink raw reply	[flat|nested] 86+ messages in thread

* Re: [PATCH] ata: libata depends on HAS_DMA
  2009-05-13  3:30         ` Brad Boyer
  (?)
@ 2009-05-13  4:12         ` Michael Schmitz
  -1 siblings, 0 replies; 86+ messages in thread
From: Michael Schmitz @ 2009-05-13  4:12 UTC (permalink / raw)
  To: Brad Boyer
  Cc: Arnd Bergmann, Alan Cox, linux-kernel, Jeff Garzik, linux-ide,
	takata, geert, linux-m68k, ysato

Hi,

> > Currently, the only architectures that don't set HAS_DMA are h8300, m32r
> > m68k (except SUN3 and Coldfire), microblaze and s390.
> > s390 will never get it, microblaze is currently implementing dma-mapping.h.
> > 
> > The other three are still using drivers/ide instead of drivers/ata.
> > 
> > One way to fix this would be to implement dma-mapping.h in h8300, m32r and
> > m68k and leave !HAS_DMA as the obscure s390 case (this one already can't
> > use ATA because of !HAS_MMIO).
> 
> If I'm reading the m68k code correctly, SUN3 is the one that doesn't have
> DMA. It is implemented on any m68k with a standard Motorola MMU. It might
> be possible to get the DMA code working on a sun3, but I doubt they ever
> have IDE hardware.

The Atari IDE interface does not use DMA. I don't see what addition of DMA 
mapping for IDE would achieve. 

If it doesn't interfere with plain PIO mode, fine. 

	Michael


^ permalink raw reply	[flat|nested] 86+ messages in thread

* Re: [PATCH] ata: libata depends on HAS_DMA
  2009-05-13  4:12           ` Michael Schmitz
@ 2009-05-13  4:34             ` Brad Boyer
  -1 siblings, 0 replies; 86+ messages in thread
From: Brad Boyer @ 2009-05-13  4:34 UTC (permalink / raw)
  To: Michael Schmitz
  Cc: Arnd Bergmann, Alan Cox, linux-kernel, Jeff Garzik, linux-ide,
	takata, geert, linux-m68k, ysato

On Wed, May 13, 2009 at 06:12:31AM +0200, Michael Schmitz wrote:
> The Atari IDE interface does not use DMA. I don't see what addition of DMA 
> mapping for IDE would achieve. 

The macide driver doesn't support anything with DMA hardware either. In
fact, no m68k Macintosh has both DMA capability and an IDE controller.
However, we do support the basic DMA routines on the main m68k platforms.
It's just not used for IDE. I think the proposed change was to require
that the DMA routines be present, not that the IDE ports actually have
to have a DMA capability.

> If it doesn't interfere with plain PIO mode, fine. 

I agree. There definitely needs to still be support for IDE ports that
don't have DMA capability.

	Brad Boyer
	flar@allandria.com


^ permalink raw reply	[flat|nested] 86+ messages in thread

* Re: [PATCH] ata: libata depends on HAS_DMA
@ 2009-05-13  4:34             ` Brad Boyer
  0 siblings, 0 replies; 86+ messages in thread
From: Brad Boyer @ 2009-05-13  4:34 UTC (permalink / raw)
  To: Michael Schmitz
  Cc: Arnd Bergmann, Alan Cox, linux-kernel, Jeff Garzik, linux-ide,
	takata, geert, linux-m68k, ysato

On Wed, May 13, 2009 at 06:12:31AM +0200, Michael Schmitz wrote:
> The Atari IDE interface does not use DMA. I don't see what addition of DMA 
> mapping for IDE would achieve. 

The macide driver doesn't support anything with DMA hardware either. In
fact, no m68k Macintosh has both DMA capability and an IDE controller.
However, we do support the basic DMA routines on the main m68k platforms.
It's just not used for IDE. I think the proposed change was to require
that the DMA routines be present, not that the IDE ports actually have
to have a DMA capability.

> If it doesn't interfere with plain PIO mode, fine. 

I agree. There definitely needs to still be support for IDE ports that
don't have DMA capability.

	Brad Boyer
	flar@allandria.com


^ permalink raw reply	[flat|nested] 86+ messages in thread

* Re: [PATCH] ata: libata depends on HAS_DMA
  2009-05-13  4:34             ` Brad Boyer
  (?)
@ 2009-05-13  8:51             ` Alan Cox
  2009-05-13  8:55               ` Geert Uytterhoeven
  2009-05-13 23:57               ` Robert Hancock
  -1 siblings, 2 replies; 86+ messages in thread
From: Alan Cox @ 2009-05-13  8:51 UTC (permalink / raw)
  To: Brad Boyer
  Cc: Michael Schmitz, Arnd Bergmann, linux-kernel, Jeff Garzik,
	linux-ide, takata, geert, linux-m68k, ysato

> > If it doesn't interfere with plain PIO mode, fine. 
> 
> I agree. There definitely needs to still be support for IDE ports that
> don't have DMA capability.

There is - it's just if the platform doesn't implement the dma_* APIs you
get a problem.

Alan

^ permalink raw reply	[flat|nested] 86+ messages in thread

* Re: [PATCH] ata: libata depends on HAS_DMA
  2009-05-13  8:51             ` Alan Cox
@ 2009-05-13  8:55               ` Geert Uytterhoeven
  2009-05-13 23:57               ` Robert Hancock
  1 sibling, 0 replies; 86+ messages in thread
From: Geert Uytterhoeven @ 2009-05-13  8:55 UTC (permalink / raw)
  To: Alan Cox
  Cc: Brad Boyer, Michael Schmitz, Arnd Bergmann, linux-kernel,
	Jeff Garzik, linux-ide, takata, linux-m68k, ysato

On Wed, May 13, 2009 at 10:51, Alan Cox <alan@lxorguk.ukuu.org.uk> wrote:
>> > If it doesn't interfere with plain PIO mode, fine.
>>
>> I agree. There definitely needs to still be support for IDE ports that
>> don't have DMA capability.
>
> There is - it's just if the platform doesn't implement the dma_* APIs you
> get a problem.

Note that there are other things missing on m68k and m32r, that's why
Al added the

| depends on !(M32R || M68K) || BROKEN

commit 9317fd4c60962d3a9423b5f9bb5d1b10cf8a0699
Author: Al Viro <viro@ftp.linux.org.uk>
Date:   Sun Sep 24 23:40:00 2006 +0100

    [PATCH] libata won't build on m68k and m32r

    no ioread*(), for one thing

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds

^ permalink raw reply	[flat|nested] 86+ messages in thread

* Re: [PATCH] ata: libata depends on HAS_DMA
  2009-05-13  3:30         ` Brad Boyer
@ 2009-05-13 10:39           ` Arnd Bergmann
  -1 siblings, 0 replies; 86+ messages in thread
From: Arnd Bergmann @ 2009-05-13 10:39 UTC (permalink / raw)
  To: Brad Boyer
  Cc: Alan Cox, linux-kernel, Jeff Garzik, linux-ide, takata, geert,
	linux-m68k, ysato

On Wednesday 13 May 2009, Brad Boyer wrote:
> If I'm reading the m68k code correctly, SUN3 is the one that doesn't have
> DMA. It is implemented on any m68k with a standard Motorola MMU. It might
> be possible to get the DMA code working on a sun3, but I doubt they ever
> have IDE hardware.

Yes, that's right, I misread the Kconfig logic.

In m68nommu, there are also Dragonball and MC68360 that are supported
but don't support the DMA API right now. Is that a real limitation, or
could those potentially have ATA ports?

	Arnd <><

^ permalink raw reply	[flat|nested] 86+ messages in thread

* Re: [PATCH] ata: libata depends on HAS_DMA
@ 2009-05-13 10:39           ` Arnd Bergmann
  0 siblings, 0 replies; 86+ messages in thread
From: Arnd Bergmann @ 2009-05-13 10:39 UTC (permalink / raw)
  To: Brad Boyer
  Cc: Alan Cox, linux-kernel, Jeff Garzik, linux-ide, takata, geert,
	linux-m68k, ysato

On Wednesday 13 May 2009, Brad Boyer wrote:
> If I'm reading the m68k code correctly, SUN3 is the one that doesn't have
> DMA. It is implemented on any m68k with a standard Motorola MMU. It might
> be possible to get the DMA code working on a sun3, but I doubt they ever
> have IDE hardware.

Yes, that's right, I misread the Kconfig logic.

In m68nommu, there are also Dragonball and MC68360 that are supported
but don't support the DMA API right now. Is that a real limitation, or
could those potentially have ATA ports?

	Arnd <><

^ permalink raw reply	[flat|nested] 86+ messages in thread

* Re: [PATCH] ata: libata depends on HAS_DMA
  2009-05-13  3:30         ` Brad Boyer
                           ` (3 preceding siblings ...)
  (?)
@ 2009-05-13 10:39         ` Arnd Bergmann
  -1 siblings, 0 replies; 86+ messages in thread
From: Arnd Bergmann @ 2009-05-13 10:39 UTC (permalink / raw)
  To: Brad Boyer
  Cc: Alan Cox, linux-kernel, Jeff Garzik, linux-ide, takata, geert,
	linux-m68k, ysato

On Wednesday 13 May 2009, Brad Boyer wrote:
> If I'm reading the m68k code correctly, SUN3 is the one that doesn't have
> DMA. It is implemented on any m68k with a standard Motorola MMU. It might
> be possible to get the DMA code working on a sun3, but I doubt they ever
> have IDE hardware.

Yes, that's right, I misread the Kconfig logic.

In m68nommu, there are also Dragonball and MC68360 that are supported
but don't support the DMA API right now. Is that a real limitation, or
could those potentially have ATA ports?

	Arnd <><

^ permalink raw reply	[flat|nested] 86+ messages in thread

* Re: [PATCH] mb862xxfb: use CONFIG_OF instead of CONFIG_PPC_OF
  2009-05-11 22:37 ` [PATCH] mb862xxfb: use CONFIG_OF instead of CONFIG_PPC_OF Arnd Bergmann
@ 2009-05-13 12:25   ` Anatolij Gustschin
  0 siblings, 0 replies; 86+ messages in thread
From: Anatolij Gustschin @ 2009-05-13 12:25 UTC (permalink / raw)
  To: Arnd Bergmann; +Cc: linux-kernel, Andrew Morton, David S. Miller

Arnd Bergmann wrote:

> With this change, the driver builds fine on Microblaze, which
> helps allyesconfig compile tests.

This patch is okay, just tested it. So
Acked-by: Anatolij Gustschin <agust@denx.de>

> I did not test sparc, but the change should have the same effect there.

unfortunately, OF platform part of this driver doesn't build on sparc
as there is no of_address_to_resource() and no NO_IRQ in sparc code.
There was an attempt to fix it by restricting the build of this part
to PPC, see http://lkml.org/lkml/2009/1/11/376

I will rebase the above mentioned patch by Julian Calaby and resubmit
soon. Thanks.

> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  drivers/video/mb862xx/mb862xxfb.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/video/mb862xx/mb862xxfb.c 
> b/drivers/video/mb862xx/mb862xxfb.c
> index fb64234..a28e3cf 100644
> --- a/drivers/video/mb862xx/mb862xxfb.c
> +++ b/drivers/video/mb862xx/mb862xxfb.c
> @@ -19,7 +19,7 @@
>  #include <linux/init.h>
>  #include <linux/interrupt.h>
>  #include <linux/pci.h>
> -#if defined(CONFIG_PPC_OF)
> +#if defined(CONFIG_OF)
>  #include <linux/of_platform.h>
>  #endif
>  #include "mb862xxfb.h"

^ permalink raw reply	[flat|nested] 86+ messages in thread

* Re: [PATCH] arm: rename CLOCK_TICK_RATE to ARM_TICK_RATE
  2009-05-11 22:43 ` [PATCH] arm: rename CLOCK_TICK_RATE to ARM_TICK_RATE Arnd Bergmann
  2009-05-11 23:11   ` [PATCH v2] " Arnd Bergmann
@ 2009-05-13 17:11   ` Arnd Bergmann
  1 sibling, 0 replies; 86+ messages in thread
From: Arnd Bergmann @ 2009-05-13 17:11 UTC (permalink / raw)
  To: Russell King; +Cc: linux-kernel, linux-arch, Alan Cox

On Tuesday 12 May 2009, Arnd Bergmann wrote:
> Most of the users of CLOCK_TICK_RATE in the kernel outside
> of ARM assume that it refers to the i8253 base frequency
> of 1.193182 Mhz, while in ARM it actually is the clock
> frequency of the timer.
> 
> By renaming it to ARM_TICK_RATE for all arm specific
> device drivers, we can hopefully reduce the amount
> of confusion slightly.

My patch was missing one important change to make this
a nonintrusive change:

--- a/arch/arm/include/asm/timex.h
+++ b/arch/arm/include/asm/timex.h
@@ -14,6 +14,8 @@
 
 #include <mach/timex.h>
 
+#define CLOCK_TICK_RATE ARM_TICK_RATE
+
 typedef unsigned long cycles_t;
 
 static inline cycles_t get_cycles (void)

	Arnd <><

^ permalink raw reply	[flat|nested] 86+ messages in thread

* Re: [PATCH] ata: libata depends on HAS_DMA
  2009-05-13  8:51             ` Alan Cox
  2009-05-13  8:55               ` Geert Uytterhoeven
@ 2009-05-13 23:57               ` Robert Hancock
  2009-05-14  0:18                 ` FUJITA Tomonori
  1 sibling, 1 reply; 86+ messages in thread
From: Robert Hancock @ 2009-05-13 23:57 UTC (permalink / raw)
  To: Alan Cox
  Cc: Brad Boyer, Michael Schmitz, Arnd Bergmann, linux-kernel,
	Jeff Garzik, linux-ide, takata, geert, linux-m68k, ysato

Alan Cox wrote:
>>> If it doesn't interfere with plain PIO mode, fine. 
>> I agree. There definitely needs to still be support for IDE ports that
>> don't have DMA capability.
> 
> There is - it's just if the platform doesn't implement the dma_* APIs you
> get a problem.

Wouldn't the easiest solution be to just dummy out the DMA API calls on 
this platform to always fail? That would fix these compile problems..

^ permalink raw reply	[flat|nested] 86+ messages in thread

* Re: [PATCH] ata: libata depends on HAS_DMA
  2009-05-13 23:57               ` Robert Hancock
@ 2009-05-14  0:18                 ` FUJITA Tomonori
  2009-05-15  5:31                   ` Tejun Heo
  0 siblings, 1 reply; 86+ messages in thread
From: FUJITA Tomonori @ 2009-05-14  0:18 UTC (permalink / raw)
  To: hancockrwd
  Cc: alan, flar, schmitz, arnd, linux-kernel, jgarzik, linux-ide,
	takata, geert, linux-m68k, ysato

On Wed, 13 May 2009 17:57:14 -0600
Robert Hancock <hancockrwd@gmail.com> wrote:

> Alan Cox wrote:
> >>> If it doesn't interfere with plain PIO mode, fine. 
> >> I agree. There definitely needs to still be support for IDE ports that
> >> don't have DMA capability.
> > 
> > There is - it's just if the platform doesn't implement the dma_* APIs you
> > get a problem.
> 
> Wouldn't the easiest solution be to just dummy out the DMA API calls on 
> this platform to always fail? That would fix these compile problems..

Can libata call dma_supported() per device to decide DMA or PIO mode?
Then, we can solve this problem by add dummy DMA API (just calls BUG)
on such architectures, without Kconfig magic or adding ifdef (like the
old ide stack does), I think.

^ permalink raw reply	[flat|nested] 86+ messages in thread

* Re: [PATCH] ata: libata depends on HAS_DMA
  2009-05-14  0:18                 ` FUJITA Tomonori
@ 2009-05-15  5:31                   ` Tejun Heo
  2009-05-15 11:16                       ` Arnd Bergmann
  0 siblings, 1 reply; 86+ messages in thread
From: Tejun Heo @ 2009-05-15  5:31 UTC (permalink / raw)
  To: FUJITA Tomonori
  Cc: hancockrwd, alan, flar, schmitz, arnd, linux-kernel, jgarzik,
	linux-ide, takata, geert, linux-m68k, ysato

FUJITA Tomonori wrote:
> On Wed, 13 May 2009 17:57:14 -0600
> Robert Hancock <hancockrwd@gmail.com> wrote:
> 
>> Alan Cox wrote:
>>>>> If it doesn't interfere with plain PIO mode, fine. 
>>>> I agree. There definitely needs to still be support for IDE ports that
>>>> don't have DMA capability.
>>> There is - it's just if the platform doesn't implement the dma_* APIs you
>>> get a problem.
>> Wouldn't the easiest solution be to just dummy out the DMA API calls on 
>> this platform to always fail? That would fix these compile problems..
> 
> Can libata call dma_supported() per device to decide DMA or PIO mode?
> Then, we can solve this problem by add dummy DMA API (just calls BUG)
> on such architectures, without Kconfig magic or adding ifdef (like the
> old ide stack does), I think.

Sure it can.  Which specific drivers are we talking about?

Thanks.

-- 
tejun

^ permalink raw reply	[flat|nested] 86+ messages in thread

* Re: [PATCH] ata: libata depends on HAS_DMA
  2009-05-15  5:31                   ` Tejun Heo
@ 2009-05-15 11:16                       ` Arnd Bergmann
  0 siblings, 0 replies; 86+ messages in thread
From: Arnd Bergmann @ 2009-05-15 11:16 UTC (permalink / raw)
  To: Tejun Heo
  Cc: FUJITA Tomonori, hancockrwd, alan, flar, schmitz, linux-kernel,
	jgarzik, linux-ide, takata, geert, linux-m68k, ysato

On Friday 15 May 2009, Tejun Heo wrote:
> FUJITA Tomonori wrote:
> > Can libata call dma_supported() per device to decide DMA or PIO mode?
> > Then, we can solve this problem by add dummy DMA API (just calls BUG)
> > on such architectures, without Kconfig magic or adding ifdef (like the
> > old ide stack does), I think.

That would be the !CONFIG_PCI half of the old
include/asm-generic/dma-mapping.h file that you just removed,
right?

In general, I'd prefer keeping the asm-generic/dma-mapping-broken.h
implementation that gives us a compile-time error, but maybe there
is an even better option based on the mn10300 implementation which
basically pretends everything works with just page_to_phys() mappings.

> Sure it can.  Which specific drivers are we talking about?

The main problem is libata-core.c, which references DMA mapping
API calls that are only implemented on architectures setting
CONFIG_HAS_DMA.

	Arnd <><
--
To unsubscribe from this list: send the line "unsubscribe linux-m68k" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 86+ messages in thread

* Re: [PATCH] ata: libata depends on HAS_DMA
@ 2009-05-15 11:16                       ` Arnd Bergmann
  0 siblings, 0 replies; 86+ messages in thread
From: Arnd Bergmann @ 2009-05-15 11:16 UTC (permalink / raw)
  To: Tejun Heo
  Cc: FUJITA Tomonori, hancockrwd, alan, flar, schmitz, linux-kernel,
	jgarzik, linux-ide, takata, geert, linux-m68k, ysato

On Friday 15 May 2009, Tejun Heo wrote:
> FUJITA Tomonori wrote:
> > Can libata call dma_supported() per device to decide DMA or PIO mode?
> > Then, we can solve this problem by add dummy DMA API (just calls BUG)
> > on such architectures, without Kconfig magic or adding ifdef (like the
> > old ide stack does), I think.

That would be the !CONFIG_PCI half of the old
include/asm-generic/dma-mapping.h file that you just removed,
right?

In general, I'd prefer keeping the asm-generic/dma-mapping-broken.h
implementation that gives us a compile-time error, but maybe there
is an even better option based on the mn10300 implementation which
basically pretends everything works with just page_to_phys() mappings.

> Sure it can.  Which specific drivers are we talking about?

The main problem is libata-core.c, which references DMA mapping
API calls that are only implemented on architectures setting
CONFIG_HAS_DMA.

	Arnd <><

^ permalink raw reply	[flat|nested] 86+ messages in thread

* Re: [PATCH] ata: libata depends on HAS_DMA
  2009-05-15 11:16                       ` Arnd Bergmann
  (?)
@ 2009-05-15 11:21                       ` Tejun Heo
  2009-05-15 11:55                         ` Arnd Bergmann
  -1 siblings, 1 reply; 86+ messages in thread
From: Tejun Heo @ 2009-05-15 11:21 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: FUJITA Tomonori, hancockrwd, alan, flar, schmitz, linux-kernel,
	jgarzik, linux-ide, takata, geert, linux-m68k, ysato

Hello,

Arnd Bergmann wrote:
> On Friday 15 May 2009, Tejun Heo wrote:
>> FUJITA Tomonori wrote:
>>> Can libata call dma_supported() per device to decide DMA or PIO mode?
>>> Then, we can solve this problem by add dummy DMA API (just calls BUG)
>>> on such architectures, without Kconfig magic or adding ifdef (like the
>>> old ide stack does), I think.
> 
> That would be the !CONFIG_PCI half of the old
> include/asm-generic/dma-mapping.h file that you just removed,
> right?
> 
> In general, I'd prefer keeping the asm-generic/dma-mapping-broken.h
> implementation that gives us a compile-time error, but maybe there
> is an even better option based on the mn10300 implementation which
> basically pretends everything works with just page_to_phys() mappings.

Don't know much history here but I don't wanna sprinkle ifdefs around
in libata so I would much prefer dummy implementation which doesn't
fail compile.

>> Sure it can.  Which specific drivers are we talking about?
> 
> The main problem is libata-core.c, which references DMA mapping
> API calls that are only implemented on architectures setting
> CONFIG_HAS_DMA.

Yeah, sure, libata-core is used by every driver but I was wondering
whether only SFF drivers are of interest or there are others.

Thanks.

-- 
tejun

^ permalink raw reply	[flat|nested] 86+ messages in thread

* Re: [PATCH] ata: libata depends on HAS_DMA
  2009-05-15 11:21                       ` Tejun Heo
@ 2009-05-15 11:55                         ` Arnd Bergmann
  2009-05-17  9:00                           ` Robert Hancock
  0 siblings, 1 reply; 86+ messages in thread
From: Arnd Bergmann @ 2009-05-15 11:55 UTC (permalink / raw)
  To: Tejun Heo
  Cc: FUJITA Tomonori, hancockrwd, alan, flar, schmitz, linux-kernel,
	jgarzik, linux-ide, takata, geert, linux-m68k, ysato

On Friday 15 May 2009, Tejun Heo wrote:
> Don't know much history here but I don't wanna sprinkle ifdefs around
> in libata so I would much prefer dummy implementation which doesn't
> fail compile.

My original patch did that by adding 'depends on HAS_DMA'.

The only architectures that don't have that are m68k, m32r,
h8300, s390 and microblaze. More research has shown that
they all found a different way to disable the ATA drivers
already, except microblaze.

Alan, you objected the patch initially (and loudly), but
maybe you can reconsider this. The only actual effect
that my patch has is to allow an allyesconfig build on
microblaze and that will implement dma-mapping.h in the
next version.

All existing architectures do not care at all about this
change, unless I'm missing something.

Besides, all the other users of the DMA mapping API
also depend on CONFIG_HAS_DMA.

	Arnd <><

^ permalink raw reply	[flat|nested] 86+ messages in thread

* Re: [PATCH] ata: libata depends on HAS_DMA
  2009-05-15 11:55                         ` Arnd Bergmann
@ 2009-05-17  9:00                           ` Robert Hancock
  2009-05-17 19:38                             ` Arnd Bergmann
  0 siblings, 1 reply; 86+ messages in thread
From: Robert Hancock @ 2009-05-17  9:00 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Tejun Heo, FUJITA Tomonori, alan, flar, schmitz, linux-kernel,
	jgarzik, linux-ide, takata, geert, linux-m68k, ysato

Arnd Bergmann wrote:
> On Friday 15 May 2009, Tejun Heo wrote:
>> Don't know much history here but I don't wanna sprinkle ifdefs around
>> in libata so I would much prefer dummy implementation which doesn't
>> fail compile.
> 
> My original patch did that by adding 'depends on HAS_DMA'.
> 
> The only architectures that don't have that are m68k, m32r,
> h8300, s390 and microblaze. More research has shown that
> they all found a different way to disable the ATA drivers
> already, except microblaze.
> 
> Alan, you objected the patch initially (and loudly), but
> maybe you can reconsider this. The only actual effect
> that my patch has is to allow an allyesconfig build on
> microblaze and that will implement dma-mapping.h in the
> next version.
> 
> All existing architectures do not care at all about this
> change, unless I'm missing something.
> 
> Besides, all the other users of the DMA mapping API
> also depend on CONFIG_HAS_DMA.

Yes, it fixes the compile problem by preventing libata from being 
compiled at all. But the point is that libata should be able to work 
without DMA support.

^ permalink raw reply	[flat|nested] 86+ messages in thread

* Re: [PATCH] ata: libata depends on HAS_DMA
  2009-05-17  9:00                           ` Robert Hancock
@ 2009-05-17 19:38                             ` Arnd Bergmann
  2009-05-17 20:05                               ` Jeff Garzik
  0 siblings, 1 reply; 86+ messages in thread
From: Arnd Bergmann @ 2009-05-17 19:38 UTC (permalink / raw)
  To: Robert Hancock
  Cc: Tejun Heo, FUJITA Tomonori, alan, flar, schmitz, linux-kernel,
	jgarzik, linux-ide, takata, geert, linux-m68k, ysato

On Sunday 17 May 2009, Robert Hancock wrote:
> Arnd Bergmann wrote:
> > On Friday 15 May 2009, Tejun Heo wrote:
> >> Don't know much history here but I don't wanna sprinkle ifdefs around
> >> in libata so I would much prefer dummy implementation which doesn't
> >> fail compile.
> > 
> > My original patch did that by adding 'depends on HAS_DMA'.
> > 
> > The only architectures that don't have that are m68k, m32r,
> > h8300, s390 and microblaze. More research has shown that
> > they all found a different way to disable the ATA drivers
> > already, except microblaze.
> > 
> > Alan, you objected the patch initially (and loudly), but
> > maybe you can reconsider this. The only actual effect
> > that my patch has is to allow an allyesconfig build on
> > microblaze and that will implement dma-mapping.h in the
> > next version.
> > 
> > All existing architectures do not care at all about this
> > change, unless I'm missing something.
> > 
> > Besides, all the other users of the DMA mapping API
> > also depend on CONFIG_HAS_DMA.
> 
> Yes, it fixes the compile problem by preventing libata from being 
> compiled at all. But the point is that libata should be able to work 
> without DMA support.

Please reread my explanations above and your own reply from 
last thursday. The case is entirely theoretical, as all platforms
(except microblaze, which is getting fixed) either set HAS_DMA or
don't allow building ATA drivers anyway. Platforms that don't support
DMA can just define CONFIG_HAS_DMA and do what you suggested:

On Thursday 14 May 2009, Robert Hancock wrote:
> Wouldn't the easiest solution be to just dummy out the DMA API calls on 
> this platform to always fail? That would fix these compile problems..

	Arnd <><

^ permalink raw reply	[flat|nested] 86+ messages in thread

* Re: [PATCH] ata: libata depends on HAS_DMA
  2009-05-17 19:38                             ` Arnd Bergmann
@ 2009-05-17 20:05                               ` Jeff Garzik
  2009-05-17 22:45                                 ` [PATCH] asm-generic: add a dma-mapping.h file Arnd Bergmann
  0 siblings, 1 reply; 86+ messages in thread
From: Jeff Garzik @ 2009-05-17 20:05 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Robert Hancock, Tejun Heo, FUJITA Tomonori, alan, flar, schmitz,
	linux-kernel, linux-ide, takata, geert, linux-m68k, ysato

Arnd Bergmann wrote:
> On Sunday 17 May 2009, Robert Hancock wrote:
> Please reread my explanations above and your own reply from 
> last thursday. The case is entirely theoretical, as all platforms
> (except microblaze, which is getting fixed) either set HAS_DMA or
> don't allow building ATA drivers anyway. Platforms that don't support
> DMA can just define CONFIG_HAS_DMA and do what you suggested:
> 
> On Thursday 14 May 2009, Robert Hancock wrote:
>> Wouldn't the easiest solution be to just dummy out the DMA API calls on 
>> this platform to always fail? That would fix these compile problems..


That's what needs to happen.  We provide no-op functions for e.g. PCI 
and x86 DMI, for platforms where this support does not exist.

Pretty much all architectures support some form of ATA.  m68k, m32r, 
h8300 and microblaze all have IDE interface, which means that libata 
needs to work on that platform.

The only !ATA arch in the entire kernel is s390, AFAICT.

	Jeff




^ permalink raw reply	[flat|nested] 86+ messages in thread

* [PATCH] asm-generic: add a dma-mapping.h file
  2009-05-17 20:05                               ` Jeff Garzik
@ 2009-05-17 22:45                                 ` Arnd Bergmann
  2009-05-18  6:03                                     ` Geert Uytterhoeven
                                                     ` (2 more replies)
  0 siblings, 3 replies; 86+ messages in thread
From: Arnd Bergmann @ 2009-05-17 22:45 UTC (permalink / raw)
  To: Jeff Garzik
  Cc: Robert Hancock, Tejun Heo, FUJITA Tomonori, alan, flar, schmitz,
	linux-kernel, linux-ide, takata, geert, linux-m68k, ysato

h8300 and m32r currently do not provide a DMA mapping API
and therefore cannot use the ATA drivers. This adds a
generic version of dma-mapping.h for architectures that
have none or very minimal actual support for DMA in hardware
and makes the two architectures use it.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
On Sunday 17 May 2009 20:05:54 Jeff Garzik wrote:

> That's what needs to happen.  We provide no-op functions for e.g. PCI 
> and x86 DMI, for platforms where this support does not exist.
> 
> Pretty much all architectures support some form of ATA.  m68k, m32r, 
> h8300 and microblaze all have IDE interface, which means that libata 
> needs to work on that platform.
> 
> The only !ATA arch in the entire kernel is s390, AFAICT.

m68k only defines NO_DMA for Sun3 and Dragonball. Sun3 does
not have ATA, Dragonball could probably just enable HAS_DMA.

---
 arch/h8300/Kconfig                   |    2 +-
 arch/h8300/include/asm/dma-mapping.h |    1 +
 arch/m32r/Kconfig                    |    2 +-
 arch/m32r/include/asm/dma-mapping.h  |    1 +
 include/asm-generic/dma-mapping.h    |  399 ++++++++++++++++++++++++++++++++++
 5 files changed, 403 insertions(+), 2 deletions(-)
 create mode 100644 arch/h8300/include/asm/dma-mapping.h
 create mode 100644 arch/m32r/include/asm/dma-mapping.h
 create mode 100644 include/asm-generic/dma-mapping.h

diff --git a/arch/h8300/Kconfig b/arch/h8300/Kconfig
index 9420648..36a037d 100644
--- a/arch/h8300/Kconfig
+++ b/arch/h8300/Kconfig
@@ -74,7 +74,7 @@ config NO_IOPORT
 	def_bool y
 
 config NO_DMA
-	def_bool y
+	def_bool n
 
 config ISA
 	bool
diff --git a/arch/h8300/include/asm/dma-mapping.h b/arch/h8300/include/asm/dma-mapping.h
new file mode 100644
index 0000000..e7e1690
--- /dev/null
+++ b/arch/h8300/include/asm/dma-mapping.h
@@ -0,0 +1 @@
+#include <asm-generic/dma-mapping.h>
diff --git a/arch/m32r/Kconfig b/arch/m32r/Kconfig
index cabba33..57ad603 100644
--- a/arch/m32r/Kconfig
+++ b/arch/m32r/Kconfig
@@ -35,7 +35,7 @@ config NO_IOPORT
 	def_bool y
 
 config NO_DMA
-	def_bool y
+	def_bool n
 
 config HZ
 	int
diff --git a/arch/m32r/include/asm/dma-mapping.h b/arch/m32r/include/asm/dma-mapping.h
new file mode 100644
index 0000000..e7e1690
--- /dev/null
+++ b/arch/m32r/include/asm/dma-mapping.h
@@ -0,0 +1 @@
+#include <asm-generic/dma-mapping.h>
diff --git a/include/asm-generic/dma-mapping.h b/include/asm-generic/dma-mapping.h
new file mode 100644
index 0000000..5a14fed
--- /dev/null
+++ b/include/asm-generic/dma-mapping.h
@@ -0,0 +1,399 @@
+#ifndef _ASM_GENERIC_DMA_MAPPING_H
+#define _ASM_GENERIC_DMA_MAPPING_H
+/*
+ * This provides a no-op variant of the DMA mapping API,
+ * for use by architectures that do not actually support
+ * DMA, or that are fully consistent and linear-mapped
+ * in their DMA implementation.
+ */
+
+#include <asm/scatterlist.h>
+
+/*
+ * If any driver asks for DMA, it's not supported.
+ */
+#ifndef dma_supported
+static inline int
+dma_supported(struct device *dev, u64 mask)
+{
+	return 0;
+}
+#endif
+
+#ifndef dma_set_mask
+static inline int
+dma_set_mask(struct device *dev, u64 dma_mask)
+{
+	if (!dev->dma_mask || !dma_supported(dev, dma_mask))
+		return -EIO;
+
+	*dev->dma_mask = dma_mask;
+	return 0;
+}
+#endif
+
+/**
+ * dma_alloc_coherent - allocate consistent memory for DMA
+ * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices
+ * @size: required memory size
+ * @handle: bus-specific DMA address
+ *
+ * Allocate some uncached, unbuffered memory for a device for
+ * performing DMA.  This function allocates pages, and will
+ * return the CPU-viewed address, and sets @handle to be the
+ * device-viewed address.
+ */
+#ifndef dma_alloc_coherent
+static inline void *
+dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle,
+		   gfp_t flag)
+{
+	void *virt = kmalloc(size, flag);
+	*dma_handle = virt_to_phys(virt);
+
+	return virt;
+}
+#endif
+
+/**
+ * dma_free_coherent - free memory allocated by dma_alloc_coherent
+ * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices
+ * @size: size of memory originally requested in dma_alloc_coherent
+ * @cpu_addr: CPU-view address returned from dma_alloc_coherent
+ * @handle: device-view address returned from dma_alloc_coherent
+ *
+ * Free (and unmap) a DMA buffer previously allocated by
+ * dma_alloc_coherent().
+ *
+ * References to memory and mappings associated with cpu_addr/handle
+ * during and after this call executing are illegal.
+ */
+#ifndef dma_free_coherent
+static inline void
+dma_free_coherent(struct device *dev, size_t size, void *cpu_addr,
+		  dma_addr_t dma_handle)
+{
+	kfree(cpu_addr);
+}
+#endif
+
+#ifndef dma_alloc_noncoherent
+static inline void *
+dma_alloc_noncoherent(struct device *dev, size_t size, dma_addr_t *dma_handle,
+		   gfp_t flag)
+{
+	return dma_alloc_coherent(dev, size, dma_handle, flag);
+}
+#endif
+
+#ifndef dma_free_noncoherent
+static inline void
+dma_free_noncoherent(struct device *dev, size_t size, void *cpu_addr,
+		  dma_addr_t dma_handle)
+{
+	return dma_free_coherent(dev, size, cpu_addr, dma_handle);
+}
+#endif
+
+/**
+ * dma_map_single - map a single buffer for streaming DMA
+ * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices
+ * @cpu_addr: CPU direct mapped address of buffer
+ * @size: size of buffer to map
+ * @dir: DMA transfer direction
+ *
+ * Ensure that any data held in the cache is appropriately discarded
+ * or written back.
+ *
+ * The device owns this memory once this call has completed.  The CPU
+ * can regain ownership by calling dma_unmap_single() or dma_sync_single().
+ */
+#ifndef dma_map_single
+static inline dma_addr_t
+dma_map_single(struct device *dev, void *cpu_addr, size_t size,
+	       enum dma_data_direction direction)
+{
+	return virt_to_phys(cpu_addr);
+}
+#endif
+
+/**
+ * dma_unmap_single - unmap a single buffer previously mapped
+ * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices
+ * @handle: DMA address of buffer
+ * @size: size of buffer to map
+ * @dir: DMA transfer direction
+ *
+ * Unmap a single streaming mode DMA translation.  The handle and size
+ * must match what was provided in the previous dma_map_single() call.
+ * All other usages are undefined.
+ *
+ * After this call, reads by the CPU to the buffer are guaranteed to see
+ * whatever the device wrote there.
+ */
+#ifndef dma_unmap_single
+static inline void
+dma_unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size,
+		 enum dma_data_direction direction)
+{
+}
+#endif
+
+/**
+ * dma_map_page - map a portion of a page for streaming DMA
+ * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices
+ * @page: page that buffer resides in
+ * @offset: offset into page for start of buffer
+ * @size: size of buffer to map
+ * @dir: DMA transfer direction
+ *
+ * Ensure that any data held in the cache is appropriately discarded
+ * or written back.
+ *
+ * The device owns this memory once this call has completed.  The CPU
+ * can regain ownership by calling dma_unmap_page() or dma_sync_single().
+ */
+#ifndef dma_map_page
+static inline dma_addr_t
+dma_map_page(struct device *dev, struct page *page,
+	     unsigned long offset, size_t size,
+	     enum dma_data_direction direction)
+{
+	return dma_map_single(dev, page_to_virt(page), size, direction);
+}
+#endif
+
+/**
+ * dma_unmap_page - unmap a buffer previously mapped through dma_map_page()
+ * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices
+ * @handle: DMA address of buffer
+ * @size: size of buffer to map
+ * @dir: DMA transfer direction
+ *
+ * Unmap a single streaming mode DMA translation.  The handle and size
+ * must match what was provided in the previous dma_map_single() call.
+ * All other usages are undefined.
+ *
+ * After this call, reads by the CPU to the buffer are guaranteed to see
+ * whatever the device wrote there.
+ */
+#ifndef dma_unmap_page
+static inline void
+dma_unmap_page(struct device *dev, dma_addr_t dma_address, size_t size,
+	       enum dma_data_direction direction)
+{
+	dma_unmap_single(dev, dma_address, size, direction);
+}
+#endif
+
+/**
+ * dma_map_sg - map a set of SG buffers for streaming mode DMA
+ * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices
+ * @sg: list of buffers
+ * @nents: number of buffers to map
+ * @dir: DMA transfer direction
+ *
+ * Map a set of buffers described by scatterlist in streaming
+ * mode for DMA.  This is the scatter-gather version of the
+ * above pci_map_single interface.  Here the scatter gather list
+ * elements are each tagged with the appropriate dma address
+ * and length.  They are obtained via sg_dma_{address,length}(SG).
+ *
+ * NOTE: An implementation may be able to use a smaller number of
+ *       DMA address/length pairs than there are SG table elements.
+ *       (for example via virtual mapping capabilities)
+ *       The routine returns the number of addr/length pairs actually
+ *       used, at most nents.
+ *
+ * Device ownership issues as mentioned above for pci_map_single are
+ * the same here.
+ */
+#ifndef dma_map_sg
+static inline int
+dma_map_sg(struct device *dev, struct scatterlist *sgl, int nents,
+	   enum dma_data_direction direction)
+{
+	struct scatterlist *sg;
+	int i;
+
+        for_each_sg(sgl, sg, nents, i) {
+                sg->dma_address = sg_phys(sg);
+                sg->dma_length = sg->length;
+        }
+
+	return nents;
+}
+#endif
+
+/**
+ * dma_unmap_sg - unmap a set of SG buffers mapped by dma_map_sg
+ * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices
+ * @sg: list of buffers
+ * @nents: number of buffers to map
+ * @dir: DMA transfer direction
+ *
+ * Unmap a set of streaming mode DMA translations.
+ * Again, CPU read rules concerning calls here are the same as for
+ * pci_unmap_single() above.
+ */
+#ifndef dma_unmap_sg
+static inline void
+dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nhwentries,
+	     enum dma_data_direction direction)
+{
+}
+#endif
+
+/**
+ * dma_sync_single_for_cpu
+ * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices
+ * @handle: DMA address of buffer
+ * @size: size of buffer to map
+ * @dir: DMA transfer direction
+ *
+ * Make physical memory consistent for a single streaming mode DMA
+ * translation after a transfer.
+ *
+ * If you perform a dma_map_single() but wish to interrogate the
+ * buffer using the cpu, yet do not wish to teardown the DMA mapping,
+ * you must call this function before doing so.  At the next point you
+ * give the DMA address back to the card, you must first perform a
+ * dma_sync_single_for_device, and then the device again owns the
+ * buffer.
+ */
+#ifndef dma_sync_single_for_cpu
+static inline void
+dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle,
+			 size_t size, enum dma_data_direction direction)
+{
+}
+#endif
+
+/**
+ * dma_sync_single_for_device
+ * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices
+ * @handle: DMA address of buffer
+ * @size: size of buffer to map
+ * @dir: DMA transfer direction
+ *
+ * Make physical memory consistent for a single streaming mode DMA
+ * translation before a transfer.
+ */
+#ifndef dma_sync_single_for_cpu
+static inline void
+dma_sync_single_for_device(struct device *dev, dma_addr_t dma_handle,
+			 size_t size, enum dma_data_direction direction)
+{
+	return dma_sync_single_for_cpu(dev, dma_handle, size, direction);
+}
+#endif
+
+#ifndef dma_sync_single_range_for_cpu
+static inline void
+dma_sync_single_range_for_cpu(struct device *dev, dma_addr_t dma_handle,
+			      unsigned long offset, size_t size,
+			      enum dma_data_direction direction)
+{
+	dma_sync_single_for_cpu(dev, dma_handle, offset+size, direction);
+}
+#endif
+
+#ifndef dma_sync_single_range_for_device
+static inline void
+dma_sync_single_range_for_device(struct device *dev, dma_addr_t dma_handle,
+				 unsigned long offset, size_t size,
+				 enum dma_data_direction direction)
+{
+	dma_sync_single_for_device(dev, dma_handle, offset+size, direction);
+}
+#endif
+
+/**
+ * dma_sync_sg_for_cpu
+ * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices
+ * @sg: list of buffers
+ * @nents: number of buffers to map
+ * @dir: DMA transfer direction
+ *
+ * Make physical memory consistent for a set of streaming
+ * mode DMA translations after a transfer.
+ *
+ * The same as dma_sync_single_for_cpu but for a
+ * scatter-gather list, same rules and usage.
+ */
+#ifndef dma_sync_sg_for_cpu
+static inline void
+dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sgl,
+		 int nelems, enum dma_data_direction direction)
+{
+	struct scatterlist *sg;
+	int i;
+
+        for_each_sg(sgl, sg, nelems, i) {
+		dma_sync_single_for_cpu(dev, sg->dma_address,
+			 sg->dma_length, direction);
+        }
+}
+#endif
+
+/**
+ * dma_sync_sg_for_device
+ * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices
+ * @sg: list of buffers
+ * @nents: number of buffers to map
+ * @dir: DMA transfer direction
+ *
+ * Make physical memory consistent for a set of streaming
+ * mode DMA translations before a transfer.
+ *
+ * The same as dma_sync_single_for_device but for a
+ * scatter-gather list, same rules and usage.
+ */
+#ifndef dma_sync_sg_for_device
+static inline void
+dma_sync_sg_for_device(struct device *dev, struct scatterlist *sgl,
+		 int nelems, enum dma_data_direction direction)
+{
+	struct scatterlist *sg;
+	int i;
+
+        for_each_sg(sgl, sg, nelems, i) {
+		dma_sync_single_for_device(dev, sg->dma_address,
+			 sg->dma_length, direction);
+        }
+}
+#endif
+
+#ifndef dma_is_consistent
+static inline int
+dma_is_consistent(struct device *dev, dma_addr_t dma_handle)
+{
+	return 1;
+}
+#endif
+
+#ifndef dma_get_cache_alignment
+static inline int
+dma_get_cache_alignment(void)
+{
+	return 1;
+}
+#endif
+
+#ifndef dma_mapping_error
+static inline int
+dma_mapping_error(struct device *dev, dma_addr_t dma_handle)
+{
+	return 0;
+}
+#endif
+
+#ifndef dma_cache_sync
+static inline void
+dma_cache_sync(struct device *dev, void *vaddr, size_t size,
+	       enum dma_data_direction direction)
+{
+}
+#endif
+
+#endif
-- 
1.6.0.4


^ permalink raw reply related	[flat|nested] 86+ messages in thread

* Re: [PATCH] asm-generic: add a dma-mapping.h file
  2009-05-17 22:45                                 ` [PATCH] asm-generic: add a dma-mapping.h file Arnd Bergmann
@ 2009-05-18  6:03                                     ` Geert Uytterhoeven
  2009-05-18 10:45                                   ` FUJITA Tomonori
  2009-05-18 22:54                                   ` Jeff Garzik
  2 siblings, 0 replies; 86+ messages in thread
From: Geert Uytterhoeven @ 2009-05-18  6:03 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Jeff Garzik, Robert Hancock, Tejun Heo, FUJITA Tomonori, alan,
	flar, schmitz, linux-kernel, linux-ide, takata, linux-m68k,
	ysato

On Mon, May 18, 2009 at 00:45, Arnd Bergmann <arnd@arndb.de> wrote:
> --- /dev/null
> +++ b/include/asm-generic/dma-mapping.h
> @@ -0,0 +1,399 @@
> +#ifndef _ASM_GENERIC_DMA_MAPPING_H
> +#define _ASM_GENERIC_DMA_MAPPING_H
> +/*
> + * This provides a no-op variant of the DMA mapping API,
> + * for use by architectures that do not actually support
> + * DMA, or that are fully consistent and linear-mapped
> + * in their DMA implementation.
> + */
> +
> +#include <asm/scatterlist.h>
> +
> +/*
> + * If any driver asks for DMA, it's not supported.
> + */
> +#ifndef dma_supported
> +static inline int
> +dma_supported(struct device *dev, u64 mask)
> +{
> +       return 0;
> +}
> +#endif
> +
> +#ifndef dma_set_mask
> +static inline int
> +dma_set_mask(struct device *dev, u64 dma_mask)
> +{
> +       if (!dev->dma_mask || !dma_supported(dev, dma_mask))
> +               return -EIO;
> +
> +       *dev->dma_mask = dma_mask;
> +       return 0;
> +}
> +#endif
> +
> +/**
> + * dma_alloc_coherent - allocate consistent memory for DMA
> + * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices
> + * @size: required memory size
> + * @handle: bus-specific DMA address
> + *
> + * Allocate some uncached, unbuffered memory for a device for
> + * performing DMA.  This function allocates pages, and will
> + * return the CPU-viewed address, and sets @handle to be the
> + * device-viewed address.
> + */
> +#ifndef dma_alloc_coherent
> +static inline void *
> +dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle,
> +                  gfp_t flag)
> +{
> +       void *virt = kmalloc(size, flag);

kmalloc() may fail.

> +       *dma_handle = virt_to_phys(virt);

Not all variants of virt_to_phys() may handle the NULL case very well.
I took a statistically invalid sample: some just cast to unsigned
long, other subtract PAGE_OFFSET.

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe linux-m68k" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 86+ messages in thread

* Re: [PATCH] asm-generic: add a dma-mapping.h file
@ 2009-05-18  6:03                                     ` Geert Uytterhoeven
  0 siblings, 0 replies; 86+ messages in thread
From: Geert Uytterhoeven @ 2009-05-18  6:03 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Jeff Garzik, Robert Hancock, Tejun Heo, FUJITA Tomonori, alan,
	flar, schmitz, linux-kernel, linux-ide, takata, linux-m68k,
	ysato

On Mon, May 18, 2009 at 00:45, Arnd Bergmann <arnd@arndb.de> wrote:
> --- /dev/null
> +++ b/include/asm-generic/dma-mapping.h
> @@ -0,0 +1,399 @@
> +#ifndef _ASM_GENERIC_DMA_MAPPING_H
> +#define _ASM_GENERIC_DMA_MAPPING_H
> +/*
> + * This provides a no-op variant of the DMA mapping API,
> + * for use by architectures that do not actually support
> + * DMA, or that are fully consistent and linear-mapped
> + * in their DMA implementation.
> + */
> +
> +#include <asm/scatterlist.h>
> +
> +/*
> + * If any driver asks for DMA, it's not supported.
> + */
> +#ifndef dma_supported
> +static inline int
> +dma_supported(struct device *dev, u64 mask)
> +{
> +       return 0;
> +}
> +#endif
> +
> +#ifndef dma_set_mask
> +static inline int
> +dma_set_mask(struct device *dev, u64 dma_mask)
> +{
> +       if (!dev->dma_mask || !dma_supported(dev, dma_mask))
> +               return -EIO;
> +
> +       *dev->dma_mask = dma_mask;
> +       return 0;
> +}
> +#endif
> +
> +/**
> + * dma_alloc_coherent - allocate consistent memory for DMA
> + * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices
> + * @size: required memory size
> + * @handle: bus-specific DMA address
> + *
> + * Allocate some uncached, unbuffered memory for a device for
> + * performing DMA.  This function allocates pages, and will
> + * return the CPU-viewed address, and sets @handle to be the
> + * device-viewed address.
> + */
> +#ifndef dma_alloc_coherent
> +static inline void *
> +dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle,
> +                  gfp_t flag)
> +{
> +       void *virt = kmalloc(size, flag);

kmalloc() may fail.

> +       *dma_handle = virt_to_phys(virt);

Not all variants of virt_to_phys() may handle the NULL case very well.
I took a statistically invalid sample: some just cast to unsigned
long, other subtract PAGE_OFFSET.

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds

^ permalink raw reply	[flat|nested] 86+ messages in thread

* Re: [PATCH] asm-generic: add a dma-mapping.h file
  2009-05-18  6:03                                     ` Geert Uytterhoeven
  (?)
@ 2009-05-18  8:28                                     ` Arnd Bergmann
  -1 siblings, 0 replies; 86+ messages in thread
From: Arnd Bergmann @ 2009-05-18  8:28 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Jeff Garzik, Robert Hancock, Tejun Heo, FUJITA Tomonori, alan,
	flar, schmitz, linux-kernel, linux-ide, takata, linux-m68k,
	ysato

On Monday 18 May 2009, Geert Uytterhoeven wrote:

> > +#ifndef dma_alloc_coherent
> > +static inline void *
> > +dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle,
> > +                  gfp_t flag)
> > +{
> > +       void *virt = kmalloc(size, flag);
> 
> kmalloc() may fail.
> 
> > +       *dma_handle = virt_to_phys(virt);
> 
> Not all variants of virt_to_phys() may handle the NULL case very well.
> I took a statistically invalid sample: some just cast to unsigned
> long, other subtract PAGE_OFFSET.

Right. It should not really hurt, because all users need to check virt
before using dma_handle, but I can fix it just to be sure.

I'll wait for comments from Fujita Tomonori and others before I repost.

	Arnd <><

^ permalink raw reply	[flat|nested] 86+ messages in thread

* Re: [PATCH] asm-generic: add a dma-mapping.h file
  2009-05-17 22:45                                 ` [PATCH] asm-generic: add a dma-mapping.h file Arnd Bergmann
  2009-05-18  6:03                                     ` Geert Uytterhoeven
@ 2009-05-18 10:45                                   ` FUJITA Tomonori
  2009-05-18 14:45                                     ` Arnd Bergmann
  2009-05-18 22:54                                   ` Jeff Garzik
  2 siblings, 1 reply; 86+ messages in thread
From: FUJITA Tomonori @ 2009-05-18 10:45 UTC (permalink / raw)
  To: arnd
  Cc: jgarzik, hancockrwd, htejun, fujita.tomonori, alan, flar,
	schmitz, linux-kernel, linux-ide, takata, geert, linux-m68k,
	ysato

On Sun, 17 May 2009 22:45:21 +0000
Arnd Bergmann <arnd@arndb.de> wrote:

> h8300 and m32r currently do not provide a DMA mapping API
> and therefore cannot use the ATA drivers. This adds a
> generic version of dma-mapping.h for architectures that
> have none or very minimal actual support for DMA in hardware
> and makes the two architectures use it.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> On Sunday 17 May 2009 20:05:54 Jeff Garzik wrote:
> 
> > That's what needs to happen.  We provide no-op functions for e.g. PCI 
> > and x86 DMI, for platforms where this support does not exist.
> > 
> > Pretty much all architectures support some form of ATA.  m68k, m32r, 
> > h8300 and microblaze all have IDE interface, which means that libata 
> > needs to work on that platform.
> > 
> > The only !ATA arch in the entire kernel is s390, AFAICT.
> 
> m68k only defines NO_DMA for Sun3 and Dragonball. Sun3 does
> not have ATA, Dragonball could probably just enable HAS_DMA.
> 
> ---
>  arch/h8300/Kconfig                   |    2 +-
>  arch/h8300/include/asm/dma-mapping.h |    1 +
>  arch/m32r/Kconfig                    |    2 +-
>  arch/m32r/include/asm/dma-mapping.h  |    1 +
>  include/asm-generic/dma-mapping.h    |  399 ++++++++++++++++++++++++++++++++++
>  5 files changed, 403 insertions(+), 2 deletions(-)
>  create mode 100644 arch/h8300/include/asm/dma-mapping.h
>  create mode 100644 arch/m32r/include/asm/dma-mapping.h
>  create mode 100644 include/asm-generic/dma-mapping.h
> 
> diff --git a/arch/h8300/Kconfig b/arch/h8300/Kconfig
> index 9420648..36a037d 100644
> --- a/arch/h8300/Kconfig
> +++ b/arch/h8300/Kconfig
> @@ -74,7 +74,7 @@ config NO_IOPORT
>  	def_bool y
>  
>  config NO_DMA
> -	def_bool y
> +	def_bool n
>  
>  config ISA
>  	bool
> diff --git a/arch/h8300/include/asm/dma-mapping.h b/arch/h8300/include/asm/dma-mapping.h
> new file mode 100644
> index 0000000..e7e1690
> --- /dev/null
> +++ b/arch/h8300/include/asm/dma-mapping.h
> @@ -0,0 +1 @@
> +#include <asm-generic/dma-mapping.h>
> diff --git a/arch/m32r/Kconfig b/arch/m32r/Kconfig
> index cabba33..57ad603 100644
> --- a/arch/m32r/Kconfig
> +++ b/arch/m32r/Kconfig
> @@ -35,7 +35,7 @@ config NO_IOPORT
>  	def_bool y
>  
>  config NO_DMA
> -	def_bool y
> +	def_bool n
>  
>  config HZ
>  	int
> diff --git a/arch/m32r/include/asm/dma-mapping.h b/arch/m32r/include/asm/dma-mapping.h
> new file mode 100644
> index 0000000..e7e1690
> --- /dev/null
> +++ b/arch/m32r/include/asm/dma-mapping.h
> @@ -0,0 +1 @@
> +#include <asm-generic/dma-mapping.h>
> diff --git a/include/asm-generic/dma-mapping.h b/include/asm-generic/dma-mapping.h
> new file mode 100644
> index 0000000..5a14fed
> --- /dev/null
> +++ b/include/asm-generic/dma-mapping.h
> @@ -0,0 +1,399 @@
> +#ifndef _ASM_GENERIC_DMA_MAPPING_H
> +#define _ASM_GENERIC_DMA_MAPPING_H
> +/*
> + * This provides a no-op variant of the DMA mapping API,
> + * for use by architectures that do not actually support
> + * DMA, or that are fully consistent and linear-mapped
> + * in their DMA implementation.
> + */
> +
> +#include <asm/scatterlist.h>
> +
> +/*
> + * If any driver asks for DMA, it's not supported.
> + */
> +#ifndef dma_supported
> +static inline int
> +dma_supported(struct device *dev, u64 mask)
> +{
> +	return 0;
> +}
> +#endif

NACK'ed, sorry.

- these idndef tricks are really ugly and wrong.

- these functions are not generic at all.

- it's confusing to have two ways to handle this issue;
dma-mapping-broken.h and dma-mapping.h.

^ permalink raw reply	[flat|nested] 86+ messages in thread

* Re: [PATCH] ata: libata depends on HAS_DMA
  2009-05-15 11:16                       ` Arnd Bergmann
  (?)
  (?)
@ 2009-05-18 10:45                       ` FUJITA Tomonori
  -1 siblings, 0 replies; 86+ messages in thread
From: FUJITA Tomonori @ 2009-05-18 10:45 UTC (permalink / raw)
  To: arnd
  Cc: htejun, fujita.tomonori, hancockrwd, alan, flar, schmitz,
	linux-kernel, jgarzik, linux-ide, takata, geert, linux-m68k,
	ysato

On Fri, 15 May 2009 13:16:30 +0200
Arnd Bergmann <arnd@arndb.de> wrote:

> On Friday 15 May 2009, Tejun Heo wrote:
> > FUJITA Tomonori wrote:
> > > Can libata call dma_supported() per device to decide DMA or PIO mode?
> > > Then, we can solve this problem by add dummy DMA API (just calls BUG)
> > > on such architectures, without Kconfig magic or adding ifdef (like the
> > > old ide stack does), I think.
> 
> That would be the !CONFIG_PCI half of the old
> include/asm-generic/dma-mapping.h file that you just removed,
> right?

No.

The old include/asm-generic/dma-mapping.h is a workaround for lazy
architecture maintainers who have not converted pci_* API to dma_*
API.

^ permalink raw reply	[flat|nested] 86+ messages in thread

* Re: [PATCH] asm-generic: add a dma-mapping.h file
  2009-05-18 10:45                                   ` FUJITA Tomonori
@ 2009-05-18 14:45                                     ` Arnd Bergmann
  2009-05-18 22:44                                       ` FUJITA Tomonori
  0 siblings, 1 reply; 86+ messages in thread
From: Arnd Bergmann @ 2009-05-18 14:45 UTC (permalink / raw)
  To: FUJITA Tomonori
  Cc: jgarzik, hancockrwd, htejun, alan, flar, schmitz, linux-kernel,
	linux-ide, takata, geert, linux-m68k, ysato

On Monday 18 May 2009, FUJITA Tomonori wrote:
> 
> NACK'ed, sorry.

I had no idea how hard it would get to fix a simple
allyesconfig build error. This is the third time
that a new approach to getting ATA to build on all
platforms is gets a NAK...

> - these idndef tricks are really ugly and wrong.
> - these functions are not generic at all.

I was trying to do two things at once:

- provide a default implementation for each function
  that an architecture can override, therefore the
  #ifdef magic.
- Have a minimal working implementation of the API
  that at least makes sense for architectures that
  do not support DMA, but want to share some of the
  code.

Ten of the existing architectures simply try do a
linear mapping, and that should easily be possible
in a generic way not too different from what I posted.
Would you agree to a patch that works with the same
code on e.g. arm, microblaze, mn10300 and sh and
uses only a few #ifdefs?

> - it's confusing to have two ways to handle this issue;
> dma-mapping-broken.h and dma-mapping.h.

We actually already have three ways to handle this right
now:

- dma-mapping-broken.h:
  only used on Sun3 m68k, i.e. not interesting any more,
  plus it does not solve the question of how to build
  ATA drivers on architectures without DMA.
- selecting NO_DMA:
  This works fine for everything except ATA. All other
  drivers using dma-mapping.h either depend on HAS_DMA
  or sprinkle their files with #ifdef.
- adding a bogus dma-mapping.h: cris, um and microblaze
  currently set HAS_DMA but add a dma-mapping.h that
  allows stuff to compile but cannot actually work.

I think that dma-mapping-broken.h has served its purpose
and we should now have two implementations in asm-generic,
the one you posted recently for ia64, x86, parisc, powerpc
and sparc64 and one for all architectures that only have
linear mappings. The version I posted is certainly not
generic enough for those, but I can keep improving it.

	Arnd <><

^ permalink raw reply	[flat|nested] 86+ messages in thread

* Re: [PATCH] asm-generic: add a dma-mapping.h file
  2009-05-18 14:45                                     ` Arnd Bergmann
@ 2009-05-18 22:44                                       ` FUJITA Tomonori
  2009-05-19 16:22                                         ` Arnd Bergmann
  0 siblings, 1 reply; 86+ messages in thread
From: FUJITA Tomonori @ 2009-05-18 22:44 UTC (permalink / raw)
  To: arnd
  Cc: fujita.tomonori, jgarzik, hancockrwd, htejun, alan, flar,
	schmitz, linux-kernel, linux-ide, takata, geert, linux-m68k,
	ysato

On Mon, 18 May 2009 16:45:24 +0200
Arnd Bergmann <arnd@arndb.de> wrote:

> On Monday 18 May 2009, FUJITA Tomonori wrote:
> > 
> > NACK'ed, sorry.
> 
> I had no idea how hard it would get to fix a simple
> allyesconfig build error. This is the third time
> that a new approach to getting ATA to build on all
> platforms is gets a NAK...
> 
> > - these idndef tricks are really ugly and wrong.
> > - these functions are not generic at all.
> 
> I was trying to do two things at once:
> 
> - provide a default implementation for each function
>   that an architecture can override, therefore the
>   #ifdef magic.

I know what you tried with #ifdef but having something like '#define
dma_map_sg' in arch's dma-mapping.h is unacceptable.


> - Have a minimal working implementation of the API
>   that at least makes sense for architectures that
>   do not support DMA, but want to share some of the
>   code.

Well, it might make sense but we don't call architectures that don't
support DMA 'generic'.


> Ten of the existing architectures simply try do a
> linear mapping, and that should easily be possible
> in a generic way not too different from what I posted.

Your proposal doesn't work with arch/x86/kernel/pci-nommu.c, which
is trying a linear mapping, what you are talking about.


> Would you agree to a patch that works with the same
> code on e.g. arm, microblaze, mn10300 and sh and
> uses only a few #ifdefs?

Having such helper for a linear mapping might be helpful but your
approach is wrong.


^ permalink raw reply	[flat|nested] 86+ messages in thread

* Re: [PATCH] asm-generic: add a dma-mapping.h file
  2009-05-17 22:45                                 ` [PATCH] asm-generic: add a dma-mapping.h file Arnd Bergmann
  2009-05-18  6:03                                     ` Geert Uytterhoeven
  2009-05-18 10:45                                   ` FUJITA Tomonori
@ 2009-05-18 22:54                                   ` Jeff Garzik
  2009-05-18 23:22                                     ` FUJITA Tomonori
  2 siblings, 1 reply; 86+ messages in thread
From: Jeff Garzik @ 2009-05-18 22:54 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Robert Hancock, Tejun Heo, FUJITA Tomonori, alan, flar, schmitz,
	linux-kernel, linux-ide, takata, geert, linux-m68k, ysato

Arnd Bergmann wrote:
> h8300 and m32r currently do not provide a DMA mapping API
> and therefore cannot use the ATA drivers. This adds a
> generic version of dma-mapping.h for architectures that
> have none or very minimal actual support for DMA in hardware
> and makes the two architectures use it.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> On Sunday 17 May 2009 20:05:54 Jeff Garzik wrote:
> 
>> That's what needs to happen.  We provide no-op functions for e.g. PCI 
>> and x86 DMI, for platforms where this support does not exist.
>>
>> Pretty much all architectures support some form of ATA.  m68k, m32r, 
>> h8300 and microblaze all have IDE interface, which means that libata 
>> needs to work on that platform.
>>
>> The only !ATA arch in the entire kernel is s390, AFAICT.
> 
> m68k only defines NO_DMA for Sun3 and Dragonball. Sun3 does
> not have ATA, Dragonball could probably just enable HAS_DMA.
> 
> ---
>  arch/h8300/Kconfig                   |    2 +-
>  arch/h8300/include/asm/dma-mapping.h |    1 +
>  arch/m32r/Kconfig                    |    2 +-
>  arch/m32r/include/asm/dma-mapping.h  |    1 +
>  include/asm-generic/dma-mapping.h    |  399 ++++++++++++++++++++++++++++++++++
>  5 files changed, 403 insertions(+), 2 deletions(-)
>  create mode 100644 arch/h8300/include/asm/dma-mapping.h
>  create mode 100644 arch/m32r/include/asm/dma-mapping.h
>  create mode 100644 include/asm-generic/dma-mapping.h

My main comment is a bit non-specific...   I tend to think that all 
no-dma platforms should provide an API whose implementation always 
returns errors, e.g. an inlined version of dma-mapping-broken.h.

That sort of setup permits the compiler's dead code elimination to work 
on these no-dma platforms, while not crapping up the libata code with a 
bunch of ifdefs.

	Jeff





^ permalink raw reply	[flat|nested] 86+ messages in thread

* Re: [PATCH] asm-generic: add a dma-mapping.h file
  2009-05-18 22:54                                   ` Jeff Garzik
@ 2009-05-18 23:22                                     ` FUJITA Tomonori
  0 siblings, 0 replies; 86+ messages in thread
From: FUJITA Tomonori @ 2009-05-18 23:22 UTC (permalink / raw)
  To: jgarzik
  Cc: arnd, hancockrwd, htejun, fujita.tomonori, alan, flar, schmitz,
	linux-kernel, linux-ide, takata, geert, linux-m68k, ysato

On Mon, 18 May 2009 18:54:49 -0400
Jeff Garzik <jgarzik@pobox.com> wrote:

> Arnd Bergmann wrote:
> > h8300 and m32r currently do not provide a DMA mapping API
> > and therefore cannot use the ATA drivers. This adds a
> > generic version of dma-mapping.h for architectures that
> > have none or very minimal actual support for DMA in hardware
> > and makes the two architectures use it.
> > 
> > Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> > ---
> > On Sunday 17 May 2009 20:05:54 Jeff Garzik wrote:
> > 
> >> That's what needs to happen.  We provide no-op functions for e.g. PCI 
> >> and x86 DMI, for platforms where this support does not exist.
> >>
> >> Pretty much all architectures support some form of ATA.  m68k, m32r, 
> >> h8300 and microblaze all have IDE interface, which means that libata 
> >> needs to work on that platform.
> >>
> >> The only !ATA arch in the entire kernel is s390, AFAICT.
> > 
> > m68k only defines NO_DMA for Sun3 and Dragonball. Sun3 does
> > not have ATA, Dragonball could probably just enable HAS_DMA.
> > 
> > ---
> >  arch/h8300/Kconfig                   |    2 +-
> >  arch/h8300/include/asm/dma-mapping.h |    1 +
> >  arch/m32r/Kconfig                    |    2 +-
> >  arch/m32r/include/asm/dma-mapping.h  |    1 +
> >  include/asm-generic/dma-mapping.h    |  399 ++++++++++++++++++++++++++++++++++
> >  5 files changed, 403 insertions(+), 2 deletions(-)
> >  create mode 100644 arch/h8300/include/asm/dma-mapping.h
> >  create mode 100644 arch/m32r/include/asm/dma-mapping.h
> >  create mode 100644 include/asm-generic/dma-mapping.h
> 
> My main comment is a bit non-specific...   I tend to think that all 
> no-dma platforms should provide an API whose implementation always 
> returns errors, e.g. an inlined version of dma-mapping-broken.h.
> 
> That sort of setup permits the compiler's dead code elimination to work 
> on these no-dma platforms, while not crapping up the libata code with a 
> bunch of ifdefs.

Just adding one ifdef to libata.h works? What libata needs is just
wrapping dma_map_sg and dma_unmap_sg like the old ide stack does.

I'm not against the idea of an inlined version of dma-mapping-broken.h
but having two ways to handle this issue is a bit confusing; so far
what we done to handle this problem is using NO_DMA, like SCSI-ml
does, not putting the dma code in non-architecture code and having
something like scsi_lib_dma.c.

Is it theoretically correct that the dma mapping API lives in low
level drivers instead of libata-core (like how SCSI-ml does)?

^ permalink raw reply	[flat|nested] 86+ messages in thread

* Re: [PATCH] asm-generic: add a dma-mapping.h file
  2009-05-18 22:44                                       ` FUJITA Tomonori
@ 2009-05-19 16:22                                         ` Arnd Bergmann
  2009-05-19 17:01                                           ` Grant Grundler
  2009-05-22 12:12                                           ` FUJITA Tomonori
  0 siblings, 2 replies; 86+ messages in thread
From: Arnd Bergmann @ 2009-05-19 16:22 UTC (permalink / raw)
  To: FUJITA Tomonori
  Cc: jgarzik, hancockrwd, htejun, alan, flar, schmitz, linux-kernel,
	linux-ide, takata, geert, linux-m68k, ysato

On Tuesday 19 May 2009, FUJITA Tomonori wrote:
> > Would you agree to a patch that works with the same
> > code on e.g. arm, microblaze, mn10300 and sh and
> > uses only a few #ifdefs?
> 
> Having such helper for a linear mapping might be helpful but your
> approach is wrong.

Do you like this approach better? I've merged a few architectures
that were relatively simple. This file should be usable by all
architectures that have a linear mapping and are either fully coherent
(like cris) or just require flushing the dcache when passing a
buffer to the device.

It's become pretty obvious where some of my bugs were in the previous
code, I hopefully did better this time and maybe you find the rest.
I've also added the dma debugging stuff in here and fixed a number
of bugs in all the different architectures on the way, but I can
send separate patches for those before doing the merge.

I've also tried merging frv and m68k, but they have some peculiarities
that made it slightly harder.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>

 include/asm-generic/dma-mapping-linear.h |  391 +++++++++++++++++++++++++++++
 arch/avr32/include/asm/dma-mapping.h     |  408 ++++---------------------------
 arch/blackfin/include/asm/dma-mapping.h  |  118 +-------
 arch/cris/include/asm/dma-mapping.h      |  194 +-------------
 arch/mn10300/include/asm/dma-mapping.h   |  266 ++------------------
 arch/sh/include/asm/dma-mapping.h        |  258 ++-----------------
 arch/xtensa/include/asm/dma-mapping.h    |  220 +++-------------
 7 files changed, 606 insertions(+), 1249 deletions(-)

diff --git a/include/asm-generic/dma-mapping-linear.h b/include/asm-generic/dma-mapping-linear.h
new file mode 100644
index 0000000..13f37db
--- /dev/null
+++ b/include/asm-generic/dma-mapping-linear.h
@@ -0,0 +1,391 @@
+#ifndef __ASM_GENERIC_DMA_MAPPING_H
+#define __ASM_GENERIC_DMA_MAPPING_H
+
+#include <linux/mm.h>
+#include <linux/device.h>
+#include <linux/dma-debug.h>
+#include <linux/scatterlist.h>
+#include <asm/cacheflush.h>
+#include <asm/io.h>
+
+#ifdef CONFIG_DMA_COHERENT
+/*
+ * An architecture should override these if it needs to
+ * perform cache flushes before passing bus addresses
+ * to a device.
+ * It can either do a full flush in dma_coherent_dev
+ * and return 1 from there, or implement more specific
+ * synchronization in dma_cache_sync, which will be
+ * applied separately to each sg element.
+ */
+static inline int
+dma_coherent_dev(struct device *dev)
+{
+	return 1;
+}
+
+static inline void
+dma_cache_sync(struct device *dev, void *cpu_addr, size_t size,
+	       enum dma_data_direction direction)
+{
+}
+
+/**
+ * dma_alloc_coherent - allocate consistent memory for DMA
+ * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices
+ * @size: required memory size
+ * @handle: bus-specific DMA address
+ *
+ * Allocate some uncached, unbuffered memory for a device for
+ * performing DMA.  This function allocates pages, and will
+ * return the CPU-viewed address, and sets @handle to be the
+ * device-viewed address.
+ */
+void *dma_alloc_coherent(struct device *dev, size_t size,
+				dma_addr_t *dma_handle, gfp_t flag)
+{
+	void *ret;
+	struct page *page;
+	int node = dev_to_node(dev);
+
+	/* ignore region specifiers */
+	flag  &= ~(__GFP_HIGHMEM);
+
+	page = alloc_pages_node(node, flag, get_order(size));
+	if (page == NULL)
+		return NULL;
+	ret = page_address(page);
+	memset(ret, 0, size);
+	*dma_handle = virt_to_abs(ret) + get_dma_direct_offset(dev);
+
+	return ret;
+}
+
+/**
+ * dma_free_coherent - free memory allocated by dma_alloc_coherent
+ * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices
+ * @size: size of memory originally requested in dma_alloc_coherent
+ * @cpu_addr: CPU-view address returned from dma_alloc_coherent
+ * @handle: device-view address returned from dma_alloc_coherent
+ *
+ * Free (and unmap) a DMA buffer previously allocated by
+ * dma_alloc_coherent().
+ *
+ * References to memory and mappings associated with cpu_addr/handle
+ * during and after this call executing are illegal.
+ */
+void dma_free_coherent(struct device *dev, size_t size,
+			      void *vaddr, dma_addr_t dma_handle)
+{
+	free_pages((unsigned long)vaddr, get_order(size));
+}
+#else
+extern void *
+dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle,
+		   gfp_t flag);
+
+extern void
+dma_free_coherent(struct device *dev, size_t size, void *cpu_addr,
+		  dma_addr_t dma_handle);
+#endif
+
+#define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f)
+#define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h)
+
+/**
+ * dma_map_single - map a single buffer for streaming DMA
+ * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices
+ * @cpu_addr: CPU direct mapped address of buffer
+ * @size: size of buffer to map
+ * @dir: DMA transfer direction
+ *
+ * Ensure that any data held in the cache is appropriately discarded
+ * or written back.
+ *
+ * The device owns this memory once this call has completed.  The CPU
+ * can regain ownership by calling dma_unmap_single() or dma_sync_single().
+ */
+static inline dma_addr_t
+dma_map_single(struct device *dev, void *ptr, size_t size,
+	       enum dma_data_direction direction)
+{
+	dma_addr_t dma_addr = virt_to_bus(ptr);
+	BUG_ON(!valid_dma_direction(direction));
+
+	if (!dma_coherent_dev(dev))
+		dma_cache_sync(dev, ptr, size, direction);
+
+	debug_dma_map_page(dev, virt_to_page(ptr),
+			   (unsigned long)ptr & ~PAGE_MASK, size,
+			   direction, dma_addr, true);
+
+	return dma_addr;
+}
+
+/**
+ * dma_unmap_single - unmap a single buffer previously mapped
+ * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices
+ * @handle: DMA address of buffer
+ * @size: size of buffer to map
+ * @dir: DMA transfer direction
+ *
+ * Unmap a single streaming mode DMA translation.  The handle and size
+ * must match what was provided in the previous dma_map_single() call.
+ * All other usages are undefined.
+ *
+ * After this call, reads by the CPU to the buffer are guaranteed to see
+ * whatever the device wrote there.
+ */
+static inline void
+dma_unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size,
+		 enum dma_data_direction direction)
+{
+	debug_dma_unmap_page(dev, dma_addr, size, direction, true);
+}
+
+/**
+ * dma_map_sg - map a set of SG buffers for streaming mode DMA
+ * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices
+ * @sg: list of buffers
+ * @nents: number of buffers to map
+ * @dir: DMA transfer direction
+ *
+ * Map a set of buffers described by scatterlist in streaming
+ * mode for DMA.  This is the scatter-gather version of the
+ * above pci_map_single interface.  Here the scatter gather list
+ * elements are each tagged with the appropriate dma address
+ * and length.  They are obtained via sg_dma_{address,length}(SG).
+ *
+ * NOTE: An implementation may be able to use a smaller number of
+ *       DMA address/length pairs than there are SG table elements.
+ *       (for example via virtual mapping capabilities)
+ *       The routine returns the number of addr/length pairs actually
+ *       used, at most nents.
+ *
+ * Device ownership issues as mentioned above for pci_map_single are
+ * the same here.
+ */
+static inline int
+dma_map_sg(struct device *dev, struct scatterlist *sglist, int nents,
+	   enum dma_data_direction direction)
+{
+	struct scatterlist *sg;
+	int i, sync;
+
+	BUG_ON(!valid_dma_direction(direction));
+	WARN_ON(nents == 0 || sglist[0].length == 0);
+
+	sync = !dma_coherent_dev(dev);
+
+	for_each_sg(sglist, sg, nents, i) {
+		BUG_ON(!sg_page(sg));
+
+		sg->dma_address = page_to_bus(sg_page(sg)) + sg->offset;
+		sg_dma_len(sg) = sg->length;
+		if (sync)
+			dma_cache_sync(dev, sg_virt(sg), sg->length, direction);
+	}
+
+	debug_dma_map_sg(dev, sg, nents, i, direction);
+
+	return nents;
+}
+
+/**
+ * dma_unmap_sg - unmap a set of SG buffers mapped by dma_map_sg
+ * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices
+ * @sg: list of buffers
+ * @nents: number of buffers to map
+ * @dir: DMA transfer direction
+ *
+ * Unmap a set of streaming mode DMA translations.
+ * Again, CPU read rules concerning calls here are the same as for
+ * pci_unmap_single() above.
+ */
+static inline void
+dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nhwentries,
+	     enum dma_data_direction direction)
+{
+	debug_dma_unmap_sg(dev, sg, nhwentries, direction);
+}
+
+/**
+ * dma_map_page - map a portion of a page for streaming DMA
+ * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices
+ * @page: page that buffer resides in
+ * @offset: offset into page for start of buffer
+ * @size: size of buffer to map
+ * @dir: DMA transfer direction
+ *
+ * Ensure that any data held in the cache is appropriately discarded
+ * or written back.
+ *
+ * The device owns this memory once this call has completed.  The CPU
+ * can regain ownership by calling dma_unmap_page() or dma_sync_single().
+ */
+static inline dma_addr_t
+dma_map_page(struct device *dev, struct page *page, unsigned long offset,
+	     size_t size, enum dma_data_direction direction)
+{
+	return dma_map_single(dev, page_address(page) + offset,
+			      size, direction);
+}
+
+/**
+ * dma_unmap_page - unmap a buffer previously mapped through dma_map_page()
+ * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices
+ * @handle: DMA address of buffer
+ * @size: size of buffer to map
+ * @dir: DMA transfer direction
+ *
+ * Unmap a single streaming mode DMA translation.  The handle and size
+ * must match what was provided in the previous dma_map_single() call.
+ * All other usages are undefined.
+ *
+ * After this call, reads by the CPU to the buffer are guaranteed to see
+ * whatever the device wrote there.
+ */
+static inline void
+dma_unmap_page(struct device *dev, dma_addr_t dma_address, size_t size,
+	       enum dma_data_direction direction)
+{
+	dma_unmap_single(dev, dma_address, size, direction);
+}
+
+/**
+ * dma_sync_single_for_cpu
+ * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices
+ * @handle: DMA address of buffer
+ * @size: size of buffer to map
+ * @dir: DMA transfer direction
+ *
+ * Make physical memory consistent for a single streaming mode DMA
+ * translation after a transfer.
+ *
+ * If you perform a dma_map_single() but wish to interrogate the
+ * buffer using the cpu, yet do not wish to teardown the DMA mapping,
+ * you must call this function before doing so.  At the next point you
+ * give the DMA address back to the card, you must first perform a
+ * dma_sync_single_for_device, and then the device again owns the
+ * buffer.
+ */
+static inline void
+dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle, size_t size,
+			enum dma_data_direction direction)
+{
+	debug_dma_sync_single_for_cpu(dev, dma_handle, size, direction);
+}
+
+static inline void
+dma_sync_single_range_for_cpu(struct device *dev, dma_addr_t dma_handle,
+			      unsigned long offset, size_t size,
+			      enum dma_data_direction direction)
+{
+	debug_dma_sync_single_range_for_cpu(dev, dma_handle,
+					    offset, size, direction);
+}
+
+/**
+ * dma_sync_sg_for_cpu
+ * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices
+ * @sg: list of buffers
+ * @nents: number of buffers to map
+ * @dir: DMA transfer direction
+ *
+ * Make physical memory consistent for a set of streaming
+ * mode DMA translations after a transfer.
+ *
+ * The same as dma_sync_single_for_* but for a scatter-gather list,
+ * same rules and usage.
+ */
+static inline void
+dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int nents,
+		    enum dma_data_direction direction)
+{
+	debug_dma_sync_sg_for_cpu(dev, sg, nents, direction);
+}
+
+static inline void
+dma_sync_single_for_device(struct device *dev, dma_addr_t dma_handle,
+			   size_t size, enum dma_data_direction direction)
+{
+	if (!dma_coherent_dev(dev))
+		dma_cache_sync(dev, bus_to_virt(dma_handle), size, direction);
+	debug_dma_sync_single_for_device(dev, dma_handle, size, direction);
+}
+
+static inline void
+dma_sync_single_range_for_device(struct device *dev, dma_addr_t dma_handle,
+				 unsigned long offset, size_t size,
+				 enum dma_data_direction direction)
+{
+	if (!dma_coherent_dev(dev))
+		dma_cache_sync(dev, bus_to_virt(dma_handle), size, direction);
+	debug_dma_sync_single_range_for_device(dev, dma_handle,
+					       offset, size, direction);
+}
+
+static inline void
+dma_sync_sg_for_device(struct device *dev, struct scatterlist *sglist,
+		       int nents, enum dma_data_direction direction)
+{
+	struct scatterlist *sg;
+	int i;
+
+	if (!dma_coherent_dev(dev))
+		for_each_sg(sglist, sg, nents, i)
+			dma_cache_sync(dev, sg_virt(sg), sg->length, direction);
+
+	debug_dma_sync_sg_for_device(dev, sg, nents, direction);
+}
+
+static inline int
+dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
+{
+	return 0;
+}
+
+/*
+ * Return whether the given device DMA address mask can be supported
+ * properly.  For example, if your device can only drive the low 24-bits
+ * during bus mastering, then you would pass 0x00ffffff as the mask
+ * to this function.
+ */
+static inline int
+dma_supported(struct device *dev, u64 mask)
+{
+	/*
+	 * we fall back to GFP_DMA when the mask isn't all 1s,
+	 * so we can't guarantee allocations that must be
+	 * within a tighter range than GFP_DMA.
+	 */
+	if (mask < 0x00ffffff)
+		return 0;
+
+	return 1;
+}
+
+static inline int
+dma_set_mask(struct device *dev, u64 dma_mask)
+{
+	if (!dev->dma_mask || !dma_supported(dev, dma_mask))
+		return -EIO;
+
+	*dev->dma_mask = dma_mask;
+
+	return 0;
+}
+
+static inline int
+dma_get_cache_alignment(void)
+{
+	return L1_CACHE_BYTES;
+}
+
+static inline int
+dma_is_consistent(struct device *dev, dma_addr_t dma_addr)
+{
+	return dma_coherent_dev(dev);
+}
+
+#endif /* __ASM_GENERIC_DMA_MAPPING_H */
diff --git a/arch/avr32/include/asm/dma-mapping.h b/arch/avr32/include/asm/dma-mapping.h
dissimilarity index 86%
index 0399359..b1d73fb 100644
--- a/arch/avr32/include/asm/dma-mapping.h
+++ b/arch/avr32/include/asm/dma-mapping.h
@@ -1,349 +1,59 @@
-#ifndef __ASM_AVR32_DMA_MAPPING_H
-#define __ASM_AVR32_DMA_MAPPING_H
-
-#include <linux/mm.h>
-#include <linux/device.h>
-#include <linux/scatterlist.h>
-#include <asm/processor.h>
-#include <asm/cacheflush.h>
-#include <asm/io.h>
-
-extern void dma_cache_sync(struct device *dev, void *vaddr, size_t size,
-	int direction);
-
-/*
- * Return whether the given device DMA address mask can be supported
- * properly.  For example, if your device can only drive the low 24-bits
- * during bus mastering, then you would pass 0x00ffffff as the mask
- * to this function.
- */
-static inline int dma_supported(struct device *dev, u64 mask)
-{
-	/* Fix when needed. I really don't know of any limitations */
-	return 1;
-}
-
-static inline int dma_set_mask(struct device *dev, u64 dma_mask)
-{
-	if (!dev->dma_mask || !dma_supported(dev, dma_mask))
-		return -EIO;
-
-	*dev->dma_mask = dma_mask;
-	return 0;
-}
-
-/*
- * dma_map_single can't fail as it is implemented now.
- */
-static inline int dma_mapping_error(struct device *dev, dma_addr_t addr)
-{
-	return 0;
-}
-
-/**
- * dma_alloc_coherent - allocate consistent memory for DMA
- * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices
- * @size: required memory size
- * @handle: bus-specific DMA address
- *
- * Allocate some uncached, unbuffered memory for a device for
- * performing DMA.  This function allocates pages, and will
- * return the CPU-viewed address, and sets @handle to be the
- * device-viewed address.
- */
-extern void *dma_alloc_coherent(struct device *dev, size_t size,
-				dma_addr_t *handle, gfp_t gfp);
-
-/**
- * dma_free_coherent - free memory allocated by dma_alloc_coherent
- * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices
- * @size: size of memory originally requested in dma_alloc_coherent
- * @cpu_addr: CPU-view address returned from dma_alloc_coherent
- * @handle: device-view address returned from dma_alloc_coherent
- *
- * Free (and unmap) a DMA buffer previously allocated by
- * dma_alloc_coherent().
- *
- * References to memory and mappings associated with cpu_addr/handle
- * during and after this call executing are illegal.
- */
-extern void dma_free_coherent(struct device *dev, size_t size,
-			      void *cpu_addr, dma_addr_t handle);
-
-/**
- * dma_alloc_writecombine - allocate write-combining memory for DMA
- * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices
- * @size: required memory size
- * @handle: bus-specific DMA address
- *
- * Allocate some uncached, buffered memory for a device for
- * performing DMA.  This function allocates pages, and will
- * return the CPU-viewed address, and sets @handle to be the
- * device-viewed address.
- */
-extern void *dma_alloc_writecombine(struct device *dev, size_t size,
-				    dma_addr_t *handle, gfp_t gfp);
-
-/**
- * dma_free_coherent - free memory allocated by dma_alloc_writecombine
- * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices
- * @size: size of memory originally requested in dma_alloc_writecombine
- * @cpu_addr: CPU-view address returned from dma_alloc_writecombine
- * @handle: device-view address returned from dma_alloc_writecombine
- *
- * Free (and unmap) a DMA buffer previously allocated by
- * dma_alloc_writecombine().
- *
- * References to memory and mappings associated with cpu_addr/handle
- * during and after this call executing are illegal.
- */
-extern void dma_free_writecombine(struct device *dev, size_t size,
-				  void *cpu_addr, dma_addr_t handle);
-
-/**
- * dma_map_single - map a single buffer for streaming DMA
- * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices
- * @cpu_addr: CPU direct mapped address of buffer
- * @size: size of buffer to map
- * @dir: DMA transfer direction
- *
- * Ensure that any data held in the cache is appropriately discarded
- * or written back.
- *
- * The device owns this memory once this call has completed.  The CPU
- * can regain ownership by calling dma_unmap_single() or dma_sync_single().
- */
-static inline dma_addr_t
-dma_map_single(struct device *dev, void *cpu_addr, size_t size,
-	       enum dma_data_direction direction)
-{
-	dma_cache_sync(dev, cpu_addr, size, direction);
-	return virt_to_bus(cpu_addr);
-}
-
-/**
- * dma_unmap_single - unmap a single buffer previously mapped
- * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices
- * @handle: DMA address of buffer
- * @size: size of buffer to map
- * @dir: DMA transfer direction
- *
- * Unmap a single streaming mode DMA translation.  The handle and size
- * must match what was provided in the previous dma_map_single() call.
- * All other usages are undefined.
- *
- * After this call, reads by the CPU to the buffer are guaranteed to see
- * whatever the device wrote there.
- */
-static inline void
-dma_unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size,
-		 enum dma_data_direction direction)
-{
-
-}
-
-/**
- * dma_map_page - map a portion of a page for streaming DMA
- * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices
- * @page: page that buffer resides in
- * @offset: offset into page for start of buffer
- * @size: size of buffer to map
- * @dir: DMA transfer direction
- *
- * Ensure that any data held in the cache is appropriately discarded
- * or written back.
- *
- * The device owns this memory once this call has completed.  The CPU
- * can regain ownership by calling dma_unmap_page() or dma_sync_single().
- */
-static inline dma_addr_t
-dma_map_page(struct device *dev, struct page *page,
-	     unsigned long offset, size_t size,
-	     enum dma_data_direction direction)
-{
-	return dma_map_single(dev, page_address(page) + offset,
-			      size, direction);
-}
-
-/**
- * dma_unmap_page - unmap a buffer previously mapped through dma_map_page()
- * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices
- * @handle: DMA address of buffer
- * @size: size of buffer to map
- * @dir: DMA transfer direction
- *
- * Unmap a single streaming mode DMA translation.  The handle and size
- * must match what was provided in the previous dma_map_single() call.
- * All other usages are undefined.
- *
- * After this call, reads by the CPU to the buffer are guaranteed to see
- * whatever the device wrote there.
- */
-static inline void
-dma_unmap_page(struct device *dev, dma_addr_t dma_address, size_t size,
-	       enum dma_data_direction direction)
-{
-	dma_unmap_single(dev, dma_address, size, direction);
-}
-
-/**
- * dma_map_sg - map a set of SG buffers for streaming mode DMA
- * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices
- * @sg: list of buffers
- * @nents: number of buffers to map
- * @dir: DMA transfer direction
- *
- * Map a set of buffers described by scatterlist in streaming
- * mode for DMA.  This is the scatter-gather version of the
- * above pci_map_single interface.  Here the scatter gather list
- * elements are each tagged with the appropriate dma address
- * and length.  They are obtained via sg_dma_{address,length}(SG).
- *
- * NOTE: An implementation may be able to use a smaller number of
- *       DMA address/length pairs than there are SG table elements.
- *       (for example via virtual mapping capabilities)
- *       The routine returns the number of addr/length pairs actually
- *       used, at most nents.
- *
- * Device ownership issues as mentioned above for pci_map_single are
- * the same here.
- */
-static inline int
-dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
-	   enum dma_data_direction direction)
-{
-	int i;
-
-	for (i = 0; i < nents; i++) {
-		char *virt;
-
-		sg[i].dma_address = page_to_bus(sg_page(&sg[i])) + sg[i].offset;
-		virt = sg_virt(&sg[i]);
-		dma_cache_sync(dev, virt, sg[i].length, direction);
-	}
-
-	return nents;
-}
-
-/**
- * dma_unmap_sg - unmap a set of SG buffers mapped by dma_map_sg
- * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices
- * @sg: list of buffers
- * @nents: number of buffers to map
- * @dir: DMA transfer direction
- *
- * Unmap a set of streaming mode DMA translations.
- * Again, CPU read rules concerning calls here are the same as for
- * pci_unmap_single() above.
- */
-static inline void
-dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nhwentries,
-	     enum dma_data_direction direction)
-{
-
-}
-
-/**
- * dma_sync_single_for_cpu
- * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices
- * @handle: DMA address of buffer
- * @size: size of buffer to map
- * @dir: DMA transfer direction
- *
- * Make physical memory consistent for a single streaming mode DMA
- * translation after a transfer.
- *
- * If you perform a dma_map_single() but wish to interrogate the
- * buffer using the cpu, yet do not wish to teardown the DMA mapping,
- * you must call this function before doing so.  At the next point you
- * give the DMA address back to the card, you must first perform a
- * dma_sync_single_for_device, and then the device again owns the
- * buffer.
- */
-static inline void
-dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle,
-			size_t size, enum dma_data_direction direction)
-{
-	/*
-	 * No need to do anything since the CPU isn't supposed to
-	 * touch this memory after we flushed it at mapping- or
-	 * sync-for-device time.
-	 */
-}
-
-static inline void
-dma_sync_single_for_device(struct device *dev, dma_addr_t dma_handle,
-			   size_t size, enum dma_data_direction direction)
-{
-	dma_cache_sync(dev, bus_to_virt(dma_handle), size, direction);
-}
-
-static inline void
-dma_sync_single_range_for_cpu(struct device *dev, dma_addr_t dma_handle,
-			      unsigned long offset, size_t size,
-			      enum dma_data_direction direction)
-{
-	/* just sync everything, that's all the pci API can do */
-	dma_sync_single_for_cpu(dev, dma_handle, offset+size, direction);
-}
-
-static inline void
-dma_sync_single_range_for_device(struct device *dev, dma_addr_t dma_handle,
-				 unsigned long offset, size_t size,
-				 enum dma_data_direction direction)
-{
-	/* just sync everything, that's all the pci API can do */
-	dma_sync_single_for_device(dev, dma_handle, offset+size, direction);
-}
-
-/**
- * dma_sync_sg_for_cpu
- * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices
- * @sg: list of buffers
- * @nents: number of buffers to map
- * @dir: DMA transfer direction
- *
- * Make physical memory consistent for a set of streaming
- * mode DMA translations after a transfer.
- *
- * The same as dma_sync_single_for_* but for a scatter-gather list,
- * same rules and usage.
- */
-static inline void
-dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg,
-		    int nents, enum dma_data_direction direction)
-{
-	/*
-	 * No need to do anything since the CPU isn't supposed to
-	 * touch this memory after we flushed it at mapping- or
-	 * sync-for-device time.
-	 */
-}
-
-static inline void
-dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg,
-		       int nents, enum dma_data_direction direction)
-{
-	int i;
-
-	for (i = 0; i < nents; i++) {
-		dma_cache_sync(dev, sg_virt(&sg[i]), sg[i].length, direction);
-	}
-}
-
-/* Now for the API extensions over the pci_ one */
-
-#define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f)
-#define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h)
-
-static inline int dma_is_consistent(struct device *dev, dma_addr_t dma_addr)
-{
-	return 1;
-}
-
-static inline int dma_get_cache_alignment(void)
-{
-	return boot_cpu_data.dcache.linesz;
-}
-
-#endif /* __ASM_AVR32_DMA_MAPPING_H */
+#ifndef __ASM_AVR32_DMA_MAPPING_H
+#define __ASM_AVR32_DMA_MAPPING_H
+
+#include <linux/mm.h>
+#include <linux/device.h>
+#include <linux/scatterlist.h>
+#include <asm/processor.h>
+#include <asm/cacheflush.h>
+#include <asm/io.h>
+
+static inline int
+dma_coherent_dev(struct device *dev)
+{
+	return 0;
+}
+
+extern void
+dma_cache_sync(struct device *dev, void *cpu_addr, size_t size,
+	       enum dma_data_direction direction);
+
+static inline int
+dma_get_cache_alignment(void)
+{
+	return boot_cpu_data.dcache.linesz;
+}
+
+/**
+ * dma_alloc_writecombine - allocate write-combining memory for DMA
+ * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices
+ * @size: required memory size
+ * @handle: bus-specific DMA address
+ *
+ * Allocate some uncached, buffered memory for a device for
+ * performing DMA.  This function allocates pages, and will
+ * return the CPU-viewed address, and sets @handle to be the
+ * device-viewed address.
+ */
+extern void *dma_alloc_writecombine(struct device *dev, size_t size,
+				    dma_addr_t *handle, gfp_t gfp);
+
+/**
+ * dma_free_writecombine - free memory allocated by dma_alloc_writecombine
+ * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices
+ * @size: size of memory originally requested in dma_alloc_writecombine
+ * @cpu_addr: CPU-view address returned from dma_alloc_writecombine
+ * @handle: device-view address returned from dma_alloc_writecombine
+ *
+ * Free (and unmap) a DMA buffer previously allocated by
+ * dma_alloc_writecombine().
+ *
+ * References to memory and mappings associated with cpu_addr/handle
+ * during and after this call executing are illegal.
+ */
+extern void dma_free_writecombine(struct device *dev, size_t size,
+				  void *cpu_addr, dma_addr_t handle);
+
+#include <asm-generic/dma-mapping-linear.h>
+
+#endif /* __ASM_AVR32_DMA_MAPPING_H */
diff --git a/arch/blackfin/include/asm/dma-mapping.h b/arch/blackfin/include/asm/dma-mapping.h
dissimilarity index 95%
index d7d9148..169d82d 100644
--- a/arch/blackfin/include/asm/dma-mapping.h
+++ b/arch/blackfin/include/asm/dma-mapping.h
@@ -1,98 +1,20 @@
-#ifndef _BLACKFIN_DMA_MAPPING_H
-#define _BLACKFIN_DMA_MAPPING_H
-
-#include <asm/scatterlist.h>
-
-void dma_alloc_init(unsigned long start, unsigned long end);
-void *dma_alloc_coherent(struct device *dev, size_t size,
-			 dma_addr_t *dma_handle, gfp_t gfp);
-void dma_free_coherent(struct device *dev, size_t size, void *vaddr,
-		       dma_addr_t dma_handle);
-
-/*
- * Now for the API extensions over the pci_ one
- */
-#define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f)
-#define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h)
-
-static inline
-int dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
-{
-	return 0;
-}
-
-/*
- * Map a single buffer of the indicated size for DMA in streaming mode.
- * The 32-bit bus address to use is returned.
- *
- * Once the device is given the dma address, the device owns this memory
- * until either pci_unmap_single or pci_dma_sync_single is performed.
- */
-extern dma_addr_t dma_map_single(struct device *dev, void *ptr, size_t size,
-				 enum dma_data_direction direction);
-
-static inline dma_addr_t
-dma_map_page(struct device *dev, struct page *page,
-	     unsigned long offset, size_t size,
-	     enum dma_data_direction dir)
-{
-	return dma_map_single(dev, page_address(page) + offset, size, dir);
-}
-
-/*
- * Unmap a single streaming mode DMA translation.  The dma_addr and size
- * must match what was provided for in a previous pci_map_single call.  All
- * other usages are undefined.
- *
- * After this call, reads by the cpu to the buffer are guarenteed to see
- * whatever the device wrote there.
- */
-extern void dma_unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size,
-			  enum dma_data_direction direction);
-
-static inline void
-dma_unmap_page(struct device *dev, dma_addr_t dma_addr, size_t size,
-	       enum dma_data_direction dir)
-{
-	dma_unmap_single(dev, dma_addr, size, dir);
-}
-
-/*
- * Map a set of buffers described by scatterlist in streaming
- * mode for DMA.  This is the scather-gather version of the
- * above pci_map_single interface.  Here the scatter gather list
- * elements are each tagged with the appropriate dma address
- * and length.  They are obtained via sg_dma_{address,length}(SG).
- *
- * NOTE: An implementation may be able to use a smaller number of
- *       DMA address/length pairs than there are SG table elements.
- *       (for example via virtual mapping capabilities)
- *       The routine returns the number of addr/length pairs actually
- *       used, at most nents.
- *
- * Device ownership issues as mentioned above for pci_map_single are
- * the same here.
- */
-extern int dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
-		      enum dma_data_direction direction);
-
-/*
- * Unmap a set of streaming mode DMA translations.
- * Again, cpu read rules concerning calls here are the same as for
- * pci_unmap_single() above.
- */
-extern void dma_unmap_sg(struct device *dev, struct scatterlist *sg,
-		      int nhwentries, enum dma_data_direction direction);
-
-static inline void dma_sync_single_for_cpu(struct device *dev,
-					dma_addr_t handle, size_t size,
-					enum dma_data_direction dir)
-{
-}
-
-static inline void dma_sync_single_for_device(struct device *dev,
-					dma_addr_t handle, size_t size,
-					enum dma_data_direction dir)
-{
-}
-#endif				/* _BLACKFIN_DMA_MAPPING_H */
+#ifndef _BLACKFIN_DMA_MAPPING_H
+#define _BLACKFIN_DMA_MAPPING_H
+
+static inline int
+dma_coherent_dev(struct device *dev)
+{
+	return 0;
+}
+
+static inline void
+dma_cache_sync(struct device *dev, void *cpu_addr, size_t size,
+	       enum dma_data_direction direction)
+{
+}
+
+extern void dma_alloc_init(unsigned long start, unsigned long end);
+
+#include <asm-generic/dma-mapping-linear.h>
+
+#endif				/* _BLACKFIN_DMA_MAPPING_H */
diff --git a/arch/cris/include/asm/dma-mapping.h b/arch/cris/include/asm/dma-mapping.h
dissimilarity index 91%
index da8ef8e..75c837e 100644
--- a/arch/cris/include/asm/dma-mapping.h
+++ b/arch/cris/include/asm/dma-mapping.h
@@ -1,170 +1,24 @@
-/* DMA mapping. Nothing tricky here, just virt_to_phys */
-
-#ifndef _ASM_CRIS_DMA_MAPPING_H
-#define _ASM_CRIS_DMA_MAPPING_H
-
-#include <linux/mm.h>
-#include <linux/kernel.h>
-
-#include <asm/cache.h>
-#include <asm/io.h>
-#include <asm/scatterlist.h>
-
-#define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f)
-#define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h)
-
-#ifdef CONFIG_PCI
-#include <asm-generic/dma-coherent.h>
-
-void *dma_alloc_coherent(struct device *dev, size_t size,
-			   dma_addr_t *dma_handle, gfp_t flag);
-
-void dma_free_coherent(struct device *dev, size_t size,
-			 void *vaddr, dma_addr_t dma_handle);
-#else
-static inline void *
-dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle,
-                   gfp_t flag)
-{
-        BUG();
-        return NULL;
-}
-
-static inline void
-dma_free_coherent(struct device *dev, size_t size, void *cpu_addr,
-                    dma_addr_t dma_handle)
-{
-        BUG();
-}
-#endif
-static inline dma_addr_t
-dma_map_single(struct device *dev, void *ptr, size_t size,
-	       enum dma_data_direction direction)
-{
-	BUG_ON(direction == DMA_NONE);
-	return virt_to_phys(ptr);
-}
-
-static inline void
-dma_unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size,
-		 enum dma_data_direction direction)
-{
-	BUG_ON(direction == DMA_NONE);
-}
-
-static inline int
-dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
-	   enum dma_data_direction direction)
-{
-	printk("Map sg\n");
-	return nents;
-}
-
-static inline dma_addr_t
-dma_map_page(struct device *dev, struct page *page, unsigned long offset,
-	     size_t size, enum dma_data_direction direction)
-{
-	BUG_ON(direction == DMA_NONE);
-	return page_to_phys(page) + offset;
-}
-
-static inline void
-dma_unmap_page(struct device *dev, dma_addr_t dma_address, size_t size,
-	       enum dma_data_direction direction)
-{
-	BUG_ON(direction == DMA_NONE);
-}
-
-
-static inline void
-dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nhwentries,
-	     enum dma_data_direction direction)
-{
-	BUG_ON(direction == DMA_NONE);
-}
-
-static inline void
-dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle, size_t size,
-			enum dma_data_direction direction)
-{
-}
-
-static inline void
-dma_sync_single_for_device(struct device *dev, dma_addr_t dma_handle, size_t size,
-			enum dma_data_direction direction)
-{
-}
-
-static inline void
-dma_sync_single_range_for_cpu(struct device *dev, dma_addr_t dma_handle,
-			      unsigned long offset, size_t size,
-			      enum dma_data_direction direction)
-{
-}
-
-static inline void
-dma_sync_single_range_for_device(struct device *dev, dma_addr_t dma_handle,
-				 unsigned long offset, size_t size,
-				 enum dma_data_direction direction)
-{
-}
-
-static inline void
-dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int nelems,
-		    enum dma_data_direction direction)
-{
-}
-
-static inline void
-dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg, int nelems,
-		    enum dma_data_direction direction)
-{
-}
-
-static inline int
-dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
-{
-	return 0;
-}
-
-static inline int
-dma_supported(struct device *dev, u64 mask)
-{
-        /*
-         * we fall back to GFP_DMA when the mask isn't all 1s,
-         * so we can't guarantee allocations that must be
-         * within a tighter range than GFP_DMA..
-         */
-        if(mask < 0x00ffffff)
-                return 0;
-
-	return 1;
-}
-
-static inline int
-dma_set_mask(struct device *dev, u64 mask)
-{
-	if(!dev->dma_mask || !dma_supported(dev, mask))
-		return -EIO;
-
-	*dev->dma_mask = mask;
-
-	return 0;
-}
-
-static inline int
-dma_get_cache_alignment(void)
-{
-	return (1 << INTERNODE_CACHE_SHIFT);
-}
-
-#define dma_is_consistent(d, h)	(1)
-
-static inline void
-dma_cache_sync(struct device *dev, void *vaddr, size_t size,
-	       enum dma_data_direction direction)
-{
-}
-
-
-#endif
+#ifndef _ASM_CRIS_DMA_MAPPING_H
+#define _ASM_CRIS_DMA_MAPPING_H
+
+#include <linux/mm.h>
+#include <linux/kernel.h>
+
+#include <asm/cache.h>
+#include <asm/io.h>
+#include <asm/scatterlist.h>
+#include <asm-generic/dma-mapping-linear.h>
+
+#ifdef CONFIG_PCI
+#include <asm-generic/dma-coherent.h>
+#endif
+
+static inline int
+cris_dma_get_cache_alignment(void)
+{
+	return (1 << INTERNODE_CACHE_SHIFT);
+}
+
+#define dma_get_cache_alignment cris_dma_get_cache_alignment
+
+#endif
diff --git a/arch/mn10300/include/asm/dma-mapping.h b/arch/mn10300/include/asm/dma-mapping.h
dissimilarity index 90%
index ccae8f6..d888fd1 100644
--- a/arch/mn10300/include/asm/dma-mapping.h
+++ b/arch/mn10300/include/asm/dma-mapping.h
@@ -1,234 +1,32 @@
-/* DMA mapping routines for the MN10300 arch
- *
- * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
- * Written by David Howells (dhowells@redhat.com)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public Licence
- * as published by the Free Software Foundation; either version
- * 2 of the Licence, or (at your option) any later version.
- */
-#ifndef _ASM_DMA_MAPPING_H
-#define _ASM_DMA_MAPPING_H
-
-#include <linux/mm.h>
-#include <linux/scatterlist.h>
-
-#include <asm/cache.h>
-#include <asm/io.h>
-
-extern void *dma_alloc_coherent(struct device *dev, size_t size,
-				dma_addr_t *dma_handle, int flag);
-
-extern void dma_free_coherent(struct device *dev, size_t size,
-			      void *vaddr, dma_addr_t dma_handle);
-
-#define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent((d), (s), (h), (f))
-#define dma_free_noncoherent(d, s, v, h)  dma_free_coherent((d), (s), (v), (h))
-
-/*
- * Map a single buffer of the indicated size for DMA in streaming mode.  The
- * 32-bit bus address to use is returned.
- *
- * Once the device is given the dma address, the device owns this memory until
- * either pci_unmap_single or pci_dma_sync_single is performed.
- */
-static inline
-dma_addr_t dma_map_single(struct device *dev, void *ptr, size_t size,
-			  enum dma_data_direction direction)
-{
-	BUG_ON(direction == DMA_NONE);
-	mn10300_dcache_flush_inv();
-	return virt_to_bus(ptr);
-}
-
-/*
- * Unmap a single streaming mode DMA translation.  The dma_addr and size must
- * match what was provided for in a previous pci_map_single call.  All other
- * usages are undefined.
- *
- * After this call, reads by the cpu to the buffer are guarenteed to see
- * whatever the device wrote there.
- */
-static inline
-void dma_unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size,
-		      enum dma_data_direction direction)
-{
-	BUG_ON(direction == DMA_NONE);
-}
-
-/*
- * Map a set of buffers described by scatterlist in streaming mode for DMA.
- * This is the scather-gather version of the above pci_map_single interface.
- * Here the scatter gather list elements are each tagged with the appropriate
- * dma address and length.  They are obtained via sg_dma_{address,length}(SG).
- *
- * NOTE: An implementation may be able to use a smaller number of DMA
- *       address/length pairs than there are SG table elements.  (for example
- *       via virtual mapping capabilities) The routine returns the number of
- *       addr/length pairs actually used, at most nents.
- *
- * Device ownership issues as mentioned above for pci_map_single are the same
- * here.
- */
-static inline
-int dma_map_sg(struct device *dev, struct scatterlist *sglist, int nents,
-	       enum dma_data_direction direction)
-{
-	struct scatterlist *sg;
-	int i;
-
-	BUG_ON(!valid_dma_direction(direction));
-	WARN_ON(nents == 0 || sglist[0].length == 0);
-
-	for_each_sg(sglist, sg, nents, i) {
-		BUG_ON(!sg_page(sg));
-
-		sg->dma_address = sg_phys(sg);
-	}
-
-	mn10300_dcache_flush_inv();
-	return nents;
-}
-
-/*
- * Unmap a set of streaming mode DMA translations.
- * Again, cpu read rules concerning calls here are the same as for
- * pci_unmap_single() above.
- */
-static inline
-void dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nhwentries,
-		  enum dma_data_direction direction)
-{
-	BUG_ON(!valid_dma_direction(direction));
-}
-
-/*
- * pci_{map,unmap}_single_page maps a kernel page to a dma_addr_t. identical
- * to pci_map_single, but takes a struct page instead of a virtual address
- */
-static inline
-dma_addr_t dma_map_page(struct device *dev, struct page *page,
-			unsigned long offset, size_t size,
-			enum dma_data_direction direction)
-{
-	BUG_ON(direction == DMA_NONE);
-	return page_to_bus(page) + offset;
-}
-
-static inline
-void dma_unmap_page(struct device *dev, dma_addr_t dma_address, size_t size,
-		    enum dma_data_direction direction)
-{
-	BUG_ON(direction == DMA_NONE);
-}
-
-/*
- * Make physical memory consistent for a single streaming mode DMA translation
- * after a transfer.
- *
- * If you perform a pci_map_single() but wish to interrogate the buffer using
- * the cpu, yet do not wish to teardown the PCI dma mapping, you must call this
- * function before doing so.  At the next point you give the PCI dma address
- * back to the card, the device again owns the buffer.
- */
-static inline
-void dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle,
-			     size_t size, enum dma_data_direction direction)
-{
-}
-
-static inline
-void dma_sync_single_for_device(struct device *dev, dma_addr_t dma_handle,
-				size_t size, enum dma_data_direction direction)
-{
-	mn10300_dcache_flush_inv();
-}
-
-static inline
-void dma_sync_single_range_for_cpu(struct device *dev, dma_addr_t dma_handle,
-				   unsigned long offset, size_t size,
-				   enum dma_data_direction direction)
-{
-}
-
-static inline void
-dma_sync_single_range_for_device(struct device *dev, dma_addr_t dma_handle,
-				 unsigned long offset, size_t size,
-				 enum dma_data_direction direction)
-{
-	mn10300_dcache_flush_inv();
-}
-
-
-/*
- * Make physical memory consistent for a set of streaming mode DMA translations
- * after a transfer.
- *
- * The same as pci_dma_sync_single but for a scatter-gather list, same rules
- * and usage.
- */
-static inline
-void dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg,
-			 int nelems, enum dma_data_direction direction)
-{
-}
-
-static inline
-void dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg,
-			    int nelems, enum dma_data_direction direction)
-{
-	mn10300_dcache_flush_inv();
-}
-
-static inline
-int dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
-{
-	return 0;
-}
-
-/*
- * Return whether the given PCI device DMA address mask can be supported
- * properly.  For example, if your device can only drive the low 24-bits during
- * PCI bus mastering, then you would pass 0x00ffffff as the mask to this
- * function.
- */
-static inline
-int dma_supported(struct device *dev, u64 mask)
-{
-	/*
-	 * we fall back to GFP_DMA when the mask isn't all 1s, so we can't
-	 * guarantee allocations that must be within a tighter range than
-	 * GFP_DMA
-	 */
-	if (mask < 0x00ffffff)
-		return 0;
-	return 1;
-}
-
-static inline
-int dma_set_mask(struct device *dev, u64 mask)
-{
-	if (!dev->dma_mask || !dma_supported(dev, mask))
-		return -EIO;
-
-	*dev->dma_mask = mask;
-	return 0;
-}
-
-static inline
-int dma_get_cache_alignment(void)
-{
-	return 1 << L1_CACHE_SHIFT;
-}
-
-#define dma_is_consistent(d)	(1)
-
-static inline
-void dma_cache_sync(void *vaddr, size_t size,
-		    enum dma_data_direction direction)
-{
-	mn10300_dcache_flush_inv();
-}
-
-#endif
+/* DMA mapping routines for the MN10300 arch
+ *
+ * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
+ * Written by David Howells (dhowells@redhat.com)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public Licence
+ * as published by the Free Software Foundation; either version
+ * 2 of the Licence, or (at your option) any later version.
+ */
+#ifndef _ASM_DMA_MAPPING_H
+#define _ASM_DMA_MAPPING_H
+
+#include <linux/mm.h>
+#include <asm/cache.h>
+#include <asm/io.h>
+static inline int
+dma_coherent_dev(struct device *dev)
+{
+	return 0;
+}
+
+static inline void
+dma_cache_sync(struct device *dev, void *cpu_addr, size_t size,
+	       enum dma_data_direction direction)
+{
+	mn10300_dcache_flush_inv();
+}
+
+#include <asm-generic/dma-mapping-linear.h>
+
+#endif
diff --git a/arch/sh/include/asm/dma-mapping.h b/arch/sh/include/asm/dma-mapping.h
dissimilarity index 87%
index ea9d4f4..6b0361c 100644
--- a/arch/sh/include/asm/dma-mapping.h
+++ b/arch/sh/include/asm/dma-mapping.h
@@ -1,219 +1,39 @@
-#ifndef __ASM_SH_DMA_MAPPING_H
-#define __ASM_SH_DMA_MAPPING_H
-
-#include <linux/mm.h>
-#include <linux/scatterlist.h>
-#include <linux/dma-debug.h>
-#include <asm/cacheflush.h>
-#include <asm/io.h>
-#include <asm-generic/dma-coherent.h>
-
-extern struct bus_type pci_bus_type;
-
-#define dma_supported(dev, mask)	(1)
-
-static inline int dma_set_mask(struct device *dev, u64 mask)
-{
-	if (!dev->dma_mask || !dma_supported(dev, mask))
-		return -EIO;
-
-	*dev->dma_mask = mask;
-
-	return 0;
-}
-
-void *dma_alloc_coherent(struct device *dev, size_t size,
-			 dma_addr_t *dma_handle, gfp_t flag);
-
-void dma_free_coherent(struct device *dev, size_t size,
-		       void *vaddr, dma_addr_t dma_handle);
-
-void dma_cache_sync(struct device *dev, void *vaddr, size_t size,
-		    enum dma_data_direction dir);
-
-#define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f)
-#define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h)
-#define dma_is_consistent(d, h) (1)
-
-static inline dma_addr_t dma_map_single(struct device *dev,
-					void *ptr, size_t size,
-					enum dma_data_direction dir)
-{
-	dma_addr_t addr = virt_to_phys(ptr);
-
-#if defined(CONFIG_PCI) && !defined(CONFIG_SH_PCIDMA_NONCOHERENT)
-	if (dev->bus == &pci_bus_type)
-		return addr;
-#endif
-	dma_cache_sync(dev, ptr, size, dir);
-
-	debug_dma_map_page(dev, virt_to_page(ptr),
-			   (unsigned long)ptr & ~PAGE_MASK, size,
-			   dir, addr, true);
-
-	return addr;
-}
-
-static inline void dma_unmap_single(struct device *dev, dma_addr_t addr,
-				    size_t size, enum dma_data_direction dir)
-{
-	debug_dma_unmap_page(dev, addr, size, dir, true);
-}
-
-static inline int dma_map_sg(struct device *dev, struct scatterlist *sg,
-			     int nents, enum dma_data_direction dir)
-{
-	int i;
-
-	for (i = 0; i < nents; i++) {
-#if !defined(CONFIG_PCI) || defined(CONFIG_SH_PCIDMA_NONCOHERENT)
-		dma_cache_sync(dev, sg_virt(&sg[i]), sg[i].length, dir);
-#endif
-		sg[i].dma_address = sg_phys(&sg[i]);
-		sg[i].dma_length = sg[i].length;
-	}
-
-	debug_dma_map_sg(dev, sg, nents, i, dir);
-
-	return nents;
-}
-
-static inline void dma_unmap_sg(struct device *dev, struct scatterlist *sg,
-				int nents, enum dma_data_direction dir)
-{
-	debug_dma_unmap_sg(dev, sg, nents, dir);
-}
-
-static inline dma_addr_t dma_map_page(struct device *dev, struct page *page,
-				      unsigned long offset, size_t size,
-				      enum dma_data_direction dir)
-{
-	return dma_map_single(dev, page_address(page) + offset, size, dir);
-}
-
-static inline void dma_unmap_page(struct device *dev, dma_addr_t dma_address,
-				  size_t size, enum dma_data_direction dir)
-{
-	dma_unmap_single(dev, dma_address, size, dir);
-}
-
-static inline void dma_sync_single(struct device *dev, dma_addr_t dma_handle,
-				   size_t size, enum dma_data_direction dir)
-{
-#if defined(CONFIG_PCI) && !defined(CONFIG_SH_PCIDMA_NONCOHERENT)
-	if (dev->bus == &pci_bus_type)
-		return;
-#endif
-	dma_cache_sync(dev, phys_to_virt(dma_handle), size, dir);
-}
-
-static inline void dma_sync_single_range(struct device *dev,
-					 dma_addr_t dma_handle,
-					 unsigned long offset, size_t size,
-					 enum dma_data_direction dir)
-{
-#if defined(CONFIG_PCI) && !defined(CONFIG_SH_PCIDMA_NONCOHERENT)
-	if (dev->bus == &pci_bus_type)
-		return;
-#endif
-	dma_cache_sync(dev, phys_to_virt(dma_handle) + offset, size, dir);
-}
-
-static inline void dma_sync_sg(struct device *dev, struct scatterlist *sg,
-			       int nelems, enum dma_data_direction dir)
-{
-	int i;
-
-	for (i = 0; i < nelems; i++) {
-#if !defined(CONFIG_PCI) || defined(CONFIG_SH_PCIDMA_NONCOHERENT)
-		dma_cache_sync(dev, sg_virt(&sg[i]), sg[i].length, dir);
-#endif
-		sg[i].dma_address = sg_phys(&sg[i]);
-		sg[i].dma_length = sg[i].length;
-	}
-}
-
-static inline void dma_sync_single_for_cpu(struct device *dev,
-					   dma_addr_t dma_handle, size_t size,
-					   enum dma_data_direction dir)
-{
-	dma_sync_single(dev, dma_handle, size, dir);
-	debug_dma_sync_single_for_cpu(dev, dma_handle, size, dir);
-}
-
-static inline void dma_sync_single_for_device(struct device *dev,
-					      dma_addr_t dma_handle,
-					      size_t size,
-					      enum dma_data_direction dir)
-{
-	dma_sync_single(dev, dma_handle, size, dir);
-	debug_dma_sync_single_for_device(dev, dma_handle, size, dir);
-}
-
-static inline void dma_sync_single_range_for_cpu(struct device *dev,
-						 dma_addr_t dma_handle,
-						 unsigned long offset,
-						 size_t size,
-						 enum dma_data_direction direction)
-{
-	dma_sync_single_for_cpu(dev, dma_handle+offset, size, direction);
-	debug_dma_sync_single_range_for_cpu(dev, dma_handle,
-					    offset, size, direction);
-}
-
-static inline void dma_sync_single_range_for_device(struct device *dev,
-						    dma_addr_t dma_handle,
-						    unsigned long offset,
-						    size_t size,
-						    enum dma_data_direction direction)
-{
-	dma_sync_single_for_device(dev, dma_handle+offset, size, direction);
-	debug_dma_sync_single_range_for_device(dev, dma_handle,
-					       offset, size, direction);
-}
-
-
-static inline void dma_sync_sg_for_cpu(struct device *dev,
-				       struct scatterlist *sg, int nelems,
-				       enum dma_data_direction dir)
-{
-	dma_sync_sg(dev, sg, nelems, dir);
-	debug_dma_sync_sg_for_cpu(dev, sg, nelems, dir);
-}
-
-static inline void dma_sync_sg_for_device(struct device *dev,
-					  struct scatterlist *sg, int nelems,
-					  enum dma_data_direction dir)
-{
-	dma_sync_sg(dev, sg, nelems, dir);
-	debug_dma_sync_sg_for_device(dev, sg, nelems, dir);
-}
-
-static inline int dma_get_cache_alignment(void)
-{
-	/*
-	 * Each processor family will define its own L1_CACHE_SHIFT,
-	 * L1_CACHE_BYTES wraps to this, so this is always safe.
-	 */
-	return L1_CACHE_BYTES;
-}
-
-static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
-{
-	return dma_addr == 0;
-}
-
-#define ARCH_HAS_DMA_DECLARE_COHERENT_MEMORY
-
-extern int
-dma_declare_coherent_memory(struct device *dev, dma_addr_t bus_addr,
-			    dma_addr_t device_addr, size_t size, int flags);
-
-extern void
-dma_release_declared_memory(struct device *dev);
-
-extern void *
-dma_mark_declared_memory_occupied(struct device *dev,
-				  dma_addr_t device_addr, size_t size);
-
-#endif /* __ASM_SH_DMA_MAPPING_H */
+#ifndef __ASM_SH_DMA_MAPPING_H
+#define __ASM_SH_DMA_MAPPING_H
+
+#include <linux/mm.h>
+#include <linux/scatterlist.h>
+#include <linux/dma-debug.h>
+#include <asm/cacheflush.h>
+#include <asm/io.h>
+#include <asm-generic/dma-coherent.h>
+
+static inline int dma_coherent_dev(struct device *dev)
+{
+#if defined(CONFIG_PCI) && !defined(CONFIG_SH_PCIDMA_NONCOHERENT)
+	if (dev->bus == &pci_bus_type)
+		return 1;
+#endif
+	return 0;
+}
+
+extern void
+dma_cache_sync(struct device *dev, void *cpu_addr, size_t size,
+	       enum dma_data_direction direction);
+
+#include <asm-generic/dma-mapping-linear.h>
+
+extern void
+dma_release_declared_memory(struct device *dev);
+
+extern void *
+dma_mark_declared_memory_occupied(struct device *dev,
+				  dma_addr_t device_addr, size_t size);
+
+#define ARCH_HAS_DMA_DECLARE_COHERENT_MEMORY
+
+extern int
+dma_declare_coherent_memory(struct device *dev, dma_addr_t bus_addr,
+			    dma_addr_t device_addr, size_t size, int flags);
+
+#endif /* __ASM_SH_DMA_MAPPING_H */
diff --git a/arch/xtensa/include/asm/dma-mapping.h b/arch/xtensa/include/asm/dma-mapping.h
dissimilarity index 82%
index 51882ae..4134617 100644
--- a/arch/xtensa/include/asm/dma-mapping.h
+++ b/arch/xtensa/include/asm/dma-mapping.h
@@ -1,179 +1,41 @@
-/*
- * include/asm-xtensa/dma-mapping.h
- *
- * This file is subject to the terms and conditions of the GNU General Public
- * License.  See the file "COPYING" in the main directory of this archive
- * for more details.
- *
- * Copyright (C) 2003 - 2005 Tensilica Inc.
- */
-
-#ifndef _XTENSA_DMA_MAPPING_H
-#define _XTENSA_DMA_MAPPING_H
-
-#include <asm/cache.h>
-#include <asm/io.h>
-#include <linux/mm.h>
-#include <linux/scatterlist.h>
-
-/*
- * DMA-consistent mapping functions.
- */
-
-extern void *consistent_alloc(int, size_t, dma_addr_t, unsigned long);
-extern void consistent_free(void*, size_t, dma_addr_t);
-extern void consistent_sync(void*, size_t, int);
-
-#define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f)
-#define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h)
-
-void *dma_alloc_coherent(struct device *dev, size_t size,
-			   dma_addr_t *dma_handle, gfp_t flag);
-
-void dma_free_coherent(struct device *dev, size_t size,
-			 void *vaddr, dma_addr_t dma_handle);
-
-static inline dma_addr_t
-dma_map_single(struct device *dev, void *ptr, size_t size,
-	       enum dma_data_direction direction)
-{
-	BUG_ON(direction == DMA_NONE);
-	consistent_sync(ptr, size, direction);
-	return virt_to_phys(ptr);
-}
-
-static inline void
-dma_unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size,
-		 enum dma_data_direction direction)
-{
-	BUG_ON(direction == DMA_NONE);
-}
-
-static inline int
-dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
-	   enum dma_data_direction direction)
-{
-	int i;
-
-	BUG_ON(direction == DMA_NONE);
-
-	for (i = 0; i < nents; i++, sg++ ) {
-		BUG_ON(!sg_page(sg));
-
-		sg->dma_address = sg_phys(sg);
-		consistent_sync(sg_virt(sg), sg->length, direction);
-	}
-
-	return nents;
-}
-
-static inline dma_addr_t
-dma_map_page(struct device *dev, struct page *page, unsigned long offset,
-	     size_t size, enum dma_data_direction direction)
-{
-	BUG_ON(direction == DMA_NONE);
-	return (dma_addr_t)(page_to_pfn(page)) * PAGE_SIZE + offset;
-}
-
-static inline void
-dma_unmap_page(struct device *dev, dma_addr_t dma_address, size_t size,
-	       enum dma_data_direction direction)
-{
-	BUG_ON(direction == DMA_NONE);
-}
-
-
-static inline void
-dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nhwentries,
-	     enum dma_data_direction direction)
-{
-	BUG_ON(direction == DMA_NONE);
-}
-
-static inline void
-dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle, size_t size,
-		enum dma_data_direction direction)
-{
-	consistent_sync((void *)bus_to_virt(dma_handle), size, direction);
-}
-
-static inline void
-dma_sync_single_for_device(struct device *dev, dma_addr_t dma_handle, size_t size,
-		enum dma_data_direction direction)
-{
-	consistent_sync((void *)bus_to_virt(dma_handle), size, direction);
-}
-
-static inline void
-dma_sync_single_range_for_cpu(struct device *dev, dma_addr_t dma_handle,
-		      unsigned long offset, size_t size,
-		      enum dma_data_direction direction)
-{
-
-	consistent_sync((void *)bus_to_virt(dma_handle)+offset,size,direction);
-}
-
-static inline void
-dma_sync_single_range_for_device(struct device *dev, dma_addr_t dma_handle,
-		      unsigned long offset, size_t size,
-		      enum dma_data_direction direction)
-{
-
-	consistent_sync((void *)bus_to_virt(dma_handle)+offset,size,direction);
-}
-static inline void
-dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int nelems,
-		 enum dma_data_direction dir)
-{
-	int i;
-	for (i = 0; i < nelems; i++, sg++)
-		consistent_sync(sg_virt(sg), sg->length, dir);
-}
-
-static inline void
-dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg, int nelems,
-		 enum dma_data_direction dir)
-{
-	int i;
-	for (i = 0; i < nelems; i++, sg++)
-		consistent_sync(sg_virt(sg), sg->length, dir);
-}
-static inline int
-dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
-{
-	return 0;
-}
-
-static inline int
-dma_supported(struct device *dev, u64 mask)
-{
-	return 1;
-}
-
-static inline int
-dma_set_mask(struct device *dev, u64 mask)
-{
-	if(!dev->dma_mask || !dma_supported(dev, mask))
-		return -EIO;
-
-	*dev->dma_mask = mask;
-
-	return 0;
-}
-
-static inline int
-dma_get_cache_alignment(void)
-{
-	return L1_CACHE_BYTES;
-}
-
-#define dma_is_consistent(d, h)	(1)
-
-static inline void
-dma_cache_sync(struct device *dev, void *vaddr, size_t size,
-	       enum dma_data_direction direction)
-{
-	consistent_sync(vaddr, size, direction);
-}
-
-#endif	/* _XTENSA_DMA_MAPPING_H */
+/*
+ * include/asm-xtensa/dma-mapping.h
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Copyright (C) 2003 - 2005 Tensilica Inc.
+ */
+
+#ifndef _XTENSA_DMA_MAPPING_H
+#define _XTENSA_DMA_MAPPING_H
+
+#include <asm/cache.h>
+#include <asm/io.h>
+#include <linux/mm.h>
+
+/*
+ * DMA-consistent mapping functions.
+ */
+
+extern void *consistent_alloc(int, size_t, dma_addr_t, unsigned long);
+extern void consistent_free(void*, size_t, dma_addr_t);
+extern void consistent_sync(void*, size_t, int);
+
+static inline int
+dma_coherent_dev(struct device *dev)
+{
+	return 0;
+}
+
+static inline void
+dma_cache_sync(struct device *dev, void *cpu_addr, size_t size,
+	       enum dma_data_direction direction)
+{
+	consistent_sync(cpu_addr, size, direction);
+}
+
+#include <asm-generic/dma-mapping-linear.h>
+
+#endif	/* _XTENSA_DMA_MAPPING_H */


^ permalink raw reply related	[flat|nested] 86+ messages in thread

* Re: [PATCH] asm-generic: add a dma-mapping.h file
  2009-05-19 16:22                                         ` Arnd Bergmann
@ 2009-05-19 17:01                                           ` Grant Grundler
  2009-05-19 17:40                                             ` Arnd Bergmann
  2009-05-22 12:12                                           ` FUJITA Tomonori
  1 sibling, 1 reply; 86+ messages in thread
From: Grant Grundler @ 2009-05-19 17:01 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: FUJITA Tomonori, jgarzik, hancockrwd, htejun, alan, flar,
	schmitz, linux-kernel, linux-ide, takata, geert, linux-m68k,
	ysato

On Tue, May 19, 2009 at 9:22 AM, Arnd Bergmann <arnd@arndb.de> wrote:
> On Tuesday 19 May 2009, FUJITA Tomonori wrote:
>> > Would you agree to a patch that works with the same
>> > code on e.g. arm, microblaze, mn10300 and sh and
>> > uses only a few #ifdefs?
>>
>> Having such helper for a linear mapping might be helpful but your
>> approach is wrong.
>
> Do you like this approach better? I've merged a few architectures
> that were relatively simple. This file should be usable by all
> architectures that have a linear mapping and are either fully coherent
> (like cris) or just require flushing the dcache when passing a
> buffer to the device.

I've reviewed the first bit and it looks fine (so far to me).
Two related bugs:
1) dma_alloc_coherent() is not respecting the coherent_dma_mask field
in device.h:struct device.
2) dma_map_single() is not respecting dma_mask in struct pci_dev (and
pointer from struct device).

...
> +/**
> + * dma_alloc_coherent - allocate consistent memory for DMA
> + * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices
> + * @size: required memory size
> + * @handle: bus-specific DMA address
> + *
> + * Allocate some uncached, unbuffered memory for a device for
> + * performing DMA.  This function allocates pages, and will
> + * return the CPU-viewed address, and sets @handle to be the
> + * device-viewed address.

Key here is the DMA is coherent, bi-directional, and the DMA address fit in
the coherent_dma_mask. "uncached/unbuffered" is one way of doing this and
is how we've implemented "DMA coherency" on parisc platforms that don't
have an IOMMU (which all have PA1.1 CPUs) - see arch/parisc/kernel/pci-dma.c

And I'll confess pci-dma.c doesn't implement support for coherent_dma_mask .
AFAIK, the targeted platforms have < 4GB of RAM and only PCI devices.
ISA support is completely missing and is the only case this class of machines
need coherent_dma_mask support.

More comments on how DMA works for PARISC in
arch/parisc/include/asm/dma-mapping.h

hth,
grant

^ permalink raw reply	[flat|nested] 86+ messages in thread

* Re: [PATCH] asm-generic: add a dma-mapping.h file
  2009-05-19 17:01                                           ` Grant Grundler
@ 2009-05-19 17:40                                             ` Arnd Bergmann
  2009-05-19 18:08                                                 ` Grant Grundler
  0 siblings, 1 reply; 86+ messages in thread
From: Arnd Bergmann @ 2009-05-19 17:40 UTC (permalink / raw)
  To: Grant Grundler
  Cc: FUJITA Tomonori, jgarzik, hancockrwd, htejun, alan, flar,
	schmitz, linux-kernel, linux-ide, takata, geert, linux-m68k,
	ysato

On Tuesday 19 May 2009 17:01:27 Grant Grundler wrote:
> On Tue, May 19, 2009 at 9:22 AM, Arnd Bergmann <arnd@arndb.de> wrote:
> I've reviewed the first bit and it looks fine (so far to me).
> Two related bugs:
> 1) dma_alloc_coherent() is not respecting the coherent_dma_mask field
> in device.h:struct device.

Hmm, I've taken that function unchanged from powerpc. I guess that means
that powerpc is broken  here as well, right?

> 2) dma_map_single() is not respecting dma_mask in struct pci_dev (and
> pointer from struct device).

What should it do with the mask? All the architectures I've looked
at as well as arch/parisc/kernel/pci-dma.c ignore it.
Should dma_map_* just fail in case of an address exceeding dma_mask?

> > +/**
> > + * dma_alloc_coherent - allocate consistent memory for DMA
> > + * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices
> > + * @size: required memory size
> > + * @handle: bus-specific DMA address
> > + *
> > + * Allocate some uncached, unbuffered memory for a device for
> > + * performing DMA.  This function allocates pages, and will
> > + * return the CPU-viewed address, and sets @handle to be the
> > + * device-viewed address.
> 
> Key here is the DMA is coherent, bi-directional, and the DMA address fit in
> the coherent_dma_mask. "uncached/unbuffered" is one way of doing this and
> is how we've implemented "DMA coherency" on parisc platforms that don't
> have an IOMMU (which all have PA1.1 CPUs) - see arch/parisc/kernel/pci-dma.c

All the architectures I've looked at come with their own version of _alloc_coherent
that works in similar ways to allocate an uncached mapping. Now that you
mention this, I realize that there is a bug on cris, which after my patch either
has two conflicting implementations of dma_{alloc,free}_coherent, or
is missing the dma_coherent_dev() function that is hidden inside of the
same #ifdef. The one in arch/cris/arch-v32/drivers/pci/dma.c does seem
to be correct though.

	Arnd <><

^ permalink raw reply	[flat|nested] 86+ messages in thread

* Re: [PATCH] asm-generic: add a dma-mapping.h file
  2009-05-19 17:40                                             ` Arnd Bergmann
@ 2009-05-19 18:08                                                 ` Grant Grundler
  0 siblings, 0 replies; 86+ messages in thread
From: Grant Grundler @ 2009-05-19 18:08 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: FUJITA Tomonori, jgarzik, hancockrwd, htejun, alan, flar,
	schmitz, linux-kernel, linux-ide, takata, geert, linux-m68k,
	ysato

On Tue, May 19, 2009 at 10:40 AM, Arnd Bergmann <arnd@arndb.de> wrote:
> On Tuesday 19 May 2009 17:01:27 Grant Grundler wrote:
>> On Tue, May 19, 2009 at 9:22 AM, Arnd Bergmann <arnd@arndb.de> wrote:
>> I've reviewed the first bit and it looks fine (so far to me).
>> Two related bugs:
>> 1) dma_alloc_coherent() is not respecting the coherent_dma_mask field
>> in device.h:struct device.
>
> Hmm, I've taken that function unchanged from powerpc. I guess that means
> that powerpc is broken  here as well, right?

Not necessarily. It might work fine for the subset of machines that
use that code.
But generic code should use the masks - even if they are set to ~0UL.

>> 2) dma_map_single() is not respecting dma_mask in struct pci_dev (and
>> pointer from struct device).
>
> What should it do with the mask?

Verify or enforce that the physical memory is allocated from a memory
pool suitable for
use by that device. If any bits "stick out" from the address (vs the
mask), the device
won't be able to DMA to that address and very likely truncate the address.

By default the PCI dma_mask is 32-bits. Drivers that can support more
than 32-bits
(some PCI, most PCI-X and all PCI-E devices) will be calling pci_set_dma_mask()
and pci_set_coherent_dma_mask() or the equivalent DMA API call.


> All the architectures I've looked
> at as well as arch/parisc/kernel/pci-dma.c ignore it.

pci-dma.c ignores it for the same reason it ignores coherent_dma_mask.
None of those parisc machines have host memory at a physical address that is NOT
reachable via DMA by *all* known/supported devices.

Maybe it's ok and we just need a comment stating the constraints of
the generic code.

And there must be some way (e.g. dma_support()) to verify the highest physical
memory location is reachable by the given device. So that would be another way
to enforce the mask.

> Should dma_map_* just fail in case of an address exceeding dma_mask?

That would probably be correct behavior too. But my gut feeling is we don't want
the device driver module to load unless we know the device can DMA to
any possible host memory location handed to dma_map_single().
My preference is the initialization path fail first. dma_alloc_coherent()
is generally in the initialization path after the drivers call pci_set*mask().


>
>> > +/**
>> > + * dma_alloc_coherent - allocate consistent memory for DMA
>> > + * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices
>> > + * @size: required memory size
>> > + * @handle: bus-specific DMA address
>> > + *
>> > + * Allocate some uncached, unbuffered memory for a device for
>> > + * performing DMA.  This function allocates pages, and will
>> > + * return the CPU-viewed address, and sets @handle to be the
>> > + * device-viewed address.
>>
>> Key here is the DMA is coherent, bi-directional, and the DMA address fit in
>> the coherent_dma_mask. "uncached/unbuffered" is one way of doing this and
>> is how we've implemented "DMA coherency" on parisc platforms that don't
>> have an IOMMU (which all have PA1.1 CPUs) - see arch/parisc/kernel/pci-dma.c
>
> All the architectures I've looked at come with their own version of _alloc_coherent
> that works in similar ways to allocate an uncached mapping.

That's what I expected. I'm pretty sure parisc could use a generic
implementation
for PA7100LC and PA7300LC CPUs (other parisc CPUs/memory controllers don't
support uncached mappings to host memory). So we would need run-time detection
and set dma_ops appropriately.

> Now that you
> mention this, I realize that there is a bug on cris, which after my patch either
> has two conflicting implementations of dma_{alloc,free}_coherent, or
> is missing the dma_coherent_dev() function that is hidden inside of the
> same #ifdef. The one in arch/cris/arch-v32/drivers/pci/dma.c does seem
> to be correct though.

Ok - cool!

thanks,
grant
--
To unsubscribe from this list: send the line "unsubscribe linux-m68k" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 86+ messages in thread

* Re: [PATCH] asm-generic: add a dma-mapping.h file
@ 2009-05-19 18:08                                                 ` Grant Grundler
  0 siblings, 0 replies; 86+ messages in thread
From: Grant Grundler @ 2009-05-19 18:08 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: FUJITA Tomonori, jgarzik, hancockrwd, htejun, alan, flar,
	schmitz, linux-kernel, linux-ide, takata, geert, linux-m68k,
	ysato

On Tue, May 19, 2009 at 10:40 AM, Arnd Bergmann <arnd@arndb.de> wrote:
> On Tuesday 19 May 2009 17:01:27 Grant Grundler wrote:
>> On Tue, May 19, 2009 at 9:22 AM, Arnd Bergmann <arnd@arndb.de> wrote:
>> I've reviewed the first bit and it looks fine (so far to me).
>> Two related bugs:
>> 1) dma_alloc_coherent() is not respecting the coherent_dma_mask field
>> in device.h:struct device.
>
> Hmm, I've taken that function unchanged from powerpc. I guess that means
> that powerpc is broken  here as well, right?

Not necessarily. It might work fine for the subset of machines that
use that code.
But generic code should use the masks - even if they are set to ~0UL.

>> 2) dma_map_single() is not respecting dma_mask in struct pci_dev (and
>> pointer from struct device).
>
> What should it do with the mask?

Verify or enforce that the physical memory is allocated from a memory
pool suitable for
use by that device. If any bits "stick out" from the address (vs the
mask), the device
won't be able to DMA to that address and very likely truncate the address.

By default the PCI dma_mask is 32-bits. Drivers that can support more
than 32-bits
(some PCI, most PCI-X and all PCI-E devices) will be calling pci_set_dma_mask()
and pci_set_coherent_dma_mask() or the equivalent DMA API call.


> All the architectures I've looked
> at as well as arch/parisc/kernel/pci-dma.c ignore it.

pci-dma.c ignores it for the same reason it ignores coherent_dma_mask.
None of those parisc machines have host memory at a physical address that is NOT
reachable via DMA by *all* known/supported devices.

Maybe it's ok and we just need a comment stating the constraints of
the generic code.

And there must be some way (e.g. dma_support()) to verify the highest physical
memory location is reachable by the given device. So that would be another way
to enforce the mask.

> Should dma_map_* just fail in case of an address exceeding dma_mask?

That would probably be correct behavior too. But my gut feeling is we don't want
the device driver module to load unless we know the device can DMA to
any possible host memory location handed to dma_map_single().
My preference is the initialization path fail first. dma_alloc_coherent()
is generally in the initialization path after the drivers call pci_set*mask().


>
>> > +/**
>> > + * dma_alloc_coherent - allocate consistent memory for DMA
>> > + * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices
>> > + * @size: required memory size
>> > + * @handle: bus-specific DMA address
>> > + *
>> > + * Allocate some uncached, unbuffered memory for a device for
>> > + * performing DMA.  This function allocates pages, and will
>> > + * return the CPU-viewed address, and sets @handle to be the
>> > + * device-viewed address.
>>
>> Key here is the DMA is coherent, bi-directional, and the DMA address fit in
>> the coherent_dma_mask. "uncached/unbuffered" is one way of doing this and
>> is how we've implemented "DMA coherency" on parisc platforms that don't
>> have an IOMMU (which all have PA1.1 CPUs) - see arch/parisc/kernel/pci-dma.c
>
> All the architectures I've looked at come with their own version of _alloc_coherent
> that works in similar ways to allocate an uncached mapping.

That's what I expected. I'm pretty sure parisc could use a generic
implementation
for PA7100LC and PA7300LC CPUs (other parisc CPUs/memory controllers don't
support uncached mappings to host memory). So we would need run-time detection
and set dma_ops appropriately.

> Now that you
> mention this, I realize that there is a bug on cris, which after my patch either
> has two conflicting implementations of dma_{alloc,free}_coherent, or
> is missing the dma_coherent_dev() function that is hidden inside of the
> same #ifdef. The one in arch/cris/arch-v32/drivers/pci/dma.c does seem
> to be correct though.

Ok - cool!

thanks,
grant

^ permalink raw reply	[flat|nested] 86+ messages in thread

* Re: [PATCH] asm-generic: add a dma-mapping.h file
  2009-05-19 16:22                                         ` Arnd Bergmann
  2009-05-19 17:01                                           ` Grant Grundler
@ 2009-05-22 12:12                                           ` FUJITA Tomonori
  2009-05-22 14:07                                             ` Arnd Bergmann
  1 sibling, 1 reply; 86+ messages in thread
From: FUJITA Tomonori @ 2009-05-22 12:12 UTC (permalink / raw)
  To: arnd
  Cc: fujita.tomonori, jgarzik, hancockrwd, htejun, alan, flar,
	schmitz, linux-kernel, linux-ide, takata, geert, linux-m68k,
	ysato

On Tue, 19 May 2009 18:22:47 +0200
Arnd Bergmann <arnd@arndb.de> wrote:

> On Tuesday 19 May 2009, FUJITA Tomonori wrote:
> > > Would you agree to a patch that works with the same
> > > code on e.g. arm, microblaze, mn10300 and sh and
> > > uses only a few #ifdefs?
> > 
> > Having such helper for a linear mapping might be helpful but your
> > approach is wrong.
> 
> Do you like this approach better? I've merged a few architectures
> that were relatively simple. This file should be usable by all
> architectures that have a linear mapping and are either fully coherent
> (like cris) or just require flushing the dcache when passing a
> buffer to the device.
> 
> It's become pretty obvious where some of my bugs were in the previous
> code, I hopefully did better this time and maybe you find the rest.
> I've also added the dma debugging stuff in here and fixed a number
> of bugs in all the different architectures on the way, but I can
> send separate patches for those before doing the merge.
> 
> I've also tried merging frv and m68k, but they have some peculiarities
> that made it slightly harder.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> 
>  include/asm-generic/dma-mapping-linear.h |  391 +++++++++++++++++++++++++++++
>  arch/avr32/include/asm/dma-mapping.h     |  408 ++++---------------------------
>  arch/blackfin/include/asm/dma-mapping.h  |  118 +-------
>  arch/cris/include/asm/dma-mapping.h      |  194 +-------------
>  arch/mn10300/include/asm/dma-mapping.h   |  266 ++------------------
>  arch/sh/include/asm/dma-mapping.h        |  258 ++-----------------
>  arch/xtensa/include/asm/dma-mapping.h    |  220 +++-------------
>  7 files changed, 606 insertions(+), 1249 deletions(-)
> 
> diff --git a/include/asm-generic/dma-mapping-linear.h b/include/asm-generic/dma-mapping-linear.h
> new file mode 100644
> index 0000000..13f37db
> --- /dev/null
> +++ b/include/asm-generic/dma-mapping-linear.h
> @@ -0,0 +1,391 @@
> +#ifndef __ASM_GENERIC_DMA_MAPPING_H
> +#define __ASM_GENERIC_DMA_MAPPING_H
> +
> +#include <linux/mm.h>
> +#include <linux/device.h>
> +#include <linux/dma-debug.h>
> +#include <linux/scatterlist.h>
> +#include <asm/cacheflush.h>
> +#include <asm/io.h>
> +
> +#ifdef CONFIG_DMA_COHERENT
> +/*
> + * An architecture should override these if it needs to
> + * perform cache flushes before passing bus addresses
> + * to a device.
> + * It can either do a full flush in dma_coherent_dev
> + * and return 1 from there, or implement more specific
> + * synchronization in dma_cache_sync, which will be
> + * applied separately to each sg element.
> + */
> +static inline int
> +dma_coherent_dev(struct device *dev)
> +{
> +	return 1;
> +}
> +
> +static inline void
> +dma_cache_sync(struct device *dev, void *cpu_addr, size_t size,
> +	       enum dma_data_direction direction)
> +{
> +}
> +
> +/**
> + * dma_alloc_coherent - allocate consistent memory for DMA
> + * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices
> + * @size: required memory size
> + * @handle: bus-specific DMA address
> + *
> + * Allocate some uncached, unbuffered memory for a device for
> + * performing DMA.  This function allocates pages, and will
> + * return the CPU-viewed address, and sets @handle to be the
> + * device-viewed address.
> + */
> +void *dma_alloc_coherent(struct device *dev, size_t size,
> +				dma_addr_t *dma_handle, gfp_t flag)
> +{
> +	void *ret;
> +	struct page *page;
> +	int node = dev_to_node(dev);
> +
> +	/* ignore region specifiers */
> +	flag  &= ~(__GFP_HIGHMEM);
> +
> +	page = alloc_pages_node(node, flag, get_order(size));
> +	if (page == NULL)
> +		return NULL;
> +	ret = page_address(page);
> +	memset(ret, 0, size);
> +	*dma_handle = virt_to_abs(ret) + get_dma_direct_offset(dev);
> +
> +	return ret;
> +}

I don't think that this works for all architectures because a returned
buffer of alloc_pages_node might not be DMA-capable. Needs to use the
coherent_dma_mask here. See x86's dma_alloc_coherent and Alpha's
pci-noop.c (there might be other examples).

I think that having a generic header for simple mapping functions
(dma_map_single, dma_map_page, dma_map_sg, etc) would be useful but
I'm not sure if we can't have a generic version of
dma_alloc_coherent. There are lots of architectures that do
architecture-specific things. For example, you replaced avr32
dma-mapping.h except for dma_alloc_coherent, which seems to be can't
be generic.

BTW, it looks odd to add dma_debug to dma_map_single, etc but not
dma_alloc_coherent. ;)


^ permalink raw reply	[flat|nested] 86+ messages in thread

* Re: [PATCH] asm-generic: add a dma-mapping.h file
  2009-05-22 12:12                                           ` FUJITA Tomonori
@ 2009-05-22 14:07                                             ` Arnd Bergmann
  2009-05-22 14:38                                               ` FUJITA Tomonori
  0 siblings, 1 reply; 86+ messages in thread
From: Arnd Bergmann @ 2009-05-22 14:07 UTC (permalink / raw)
  To: FUJITA Tomonori
  Cc: jgarzik, hancockrwd, htejun, alan, flar, schmitz, linux-kernel,
	linux-ide, takata, geert, linux-m68k, ysato, Grant Grundler

On Friday 22 May 2009, FUJITA Tomonori wrote:
> I don't think that this works for all architectures because a returned
> buffer of alloc_pages_node might not be DMA-capable. Needs to use the
> coherent_dma_mask here. See x86's dma_alloc_coherent and Alpha's
> pci-noop.c (there might be other examples).

Right, Grant also made the same comment.

> I think that having a generic header for simple mapping functions
> (dma_map_single, dma_map_page, dma_map_sg, etc) would be useful but
> I'm not sure if we can't have a generic version of
> dma_alloc_coherent.
>
> There are lots of architectures that do 
> architecture-specific things. For example, you replaced avr32
> dma-mapping.h except for dma_alloc_coherent, which seems to be can't
> be generic.

I agree that it won't be fully generic, because all architectures
with non-coherent DMA will have to do architecture specific setup
to get uncached mappings here. I believe that it can be generic
enough to support all architectures that have a cache-coherent PCI
bus, hence the #ifdef CONFIG_DMA_COHERENT around this function.

E.g. cris could use a one-line redirect to
asm-generic/dma-mapping-linear.h if it did not have the
special dma_get_cache_alignment function. I still would
like to find a better way to handle this one than to
redefine the function.

> BTW, it looks odd to add dma_debug to dma_map_single, etc but not
> dma_alloc_coherent. ;)

hehe, sure. I copied the dma_debug stuff from sh, the comments
from avr32 and the dma_alloc_coherent implementation from powerpc,
so I missed this one.

Thanks for the review.

	Arnd <><

^ permalink raw reply	[flat|nested] 86+ messages in thread

* Re: [PATCH] asm-generic: add a dma-mapping.h file
  2009-05-22 14:07                                             ` Arnd Bergmann
@ 2009-05-22 14:38                                               ` FUJITA Tomonori
  2009-05-22 15:05                                                 ` Arnd Bergmann
  0 siblings, 1 reply; 86+ messages in thread
From: FUJITA Tomonori @ 2009-05-22 14:38 UTC (permalink / raw)
  To: arnd
  Cc: fujita.tomonori, jgarzik, hancockrwd, htejun, alan, flar,
	schmitz, linux-kernel, linux-ide, takata, geert, linux-m68k,
	ysato, grundler

On Fri, 22 May 2009 16:07:32 +0200
Arnd Bergmann <arnd@arndb.de> wrote:

> On Friday 22 May 2009, FUJITA Tomonori wrote:
> > I don't think that this works for all architectures because a returned
> > buffer of alloc_pages_node might not be DMA-capable. Needs to use the
> > coherent_dma_mask here. See x86's dma_alloc_coherent and Alpha's
> > pci-noop.c (there might be other examples).
> 
> Right, Grant also made the same comment.
> 
> > I think that having a generic header for simple mapping functions
> > (dma_map_single, dma_map_page, dma_map_sg, etc) would be useful but
> > I'm not sure if we can't have a generic version of
> > dma_alloc_coherent.
> >
> > There are lots of architectures that do 
> > architecture-specific things. For example, you replaced avr32
> > dma-mapping.h except for dma_alloc_coherent, which seems to be can't
> > be generic.
> 
> I agree that it won't be fully generic, because all architectures
> with non-coherent DMA will have to do architecture specific setup
> to get uncached mappings here. I believe that it can be generic
> enough to support all architectures that have a cache-coherent PCI
> bus, hence the #ifdef CONFIG_DMA_COHERENT around this function.

I'm not sure. And only mips internally uses CONFIG_DMA_COHERENT.

The reason why many architectures need architecture-specific
alloc_coherent() is not about coherent or not.


I like a new helper header file having only generic functions without
any ifdef.


> E.g. cris could use a one-line redirect to
> asm-generic/dma-mapping-linear.h if it did not have the
> special dma_get_cache_alignment function. I still would
> like to find a better way to handle this one than to
> redefine the function.
> 
> > BTW, it looks odd to add dma_debug to dma_map_single, etc but not
> > dma_alloc_coherent. ;)
> 
> hehe, sure. I copied the dma_debug stuff from sh, the comments
> from avr32 and the dma_alloc_coherent implementation from powerpc,
> so I missed this one.
> 
> Thanks for the review.
> 
> 	Arnd <><
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 86+ messages in thread

* Re: [PATCH] asm-generic: add a dma-mapping.h file
  2009-05-22 14:38                                               ` FUJITA Tomonori
@ 2009-05-22 15:05                                                 ` Arnd Bergmann
  2009-05-26  4:36                                                   ` FUJITA Tomonori
  0 siblings, 1 reply; 86+ messages in thread
From: Arnd Bergmann @ 2009-05-22 15:05 UTC (permalink / raw)
  To: FUJITA Tomonori
  Cc: jgarzik, hancockrwd, htejun, alan, flar, schmitz, linux-kernel,
	linux-ide, takata, geert, linux-m68k, ysato, grundler

On Friday 22 May 2009, FUJITA Tomonori wrote:
> I'm not sure. And only mips internally uses CONFIG_DMA_COHERENT.
> 
> The reason why many architectures need architecture-specific
> alloc_coherent() is not about coherent or not.
> 
> I like a new helper header file having only generic functions without
> any ifdef.

Ok, fair enough. Fixing dma_alloc_coherent to handle
coherent_dma_mask and debug_dma correctly would also
make it even bigger, and it was already doing more than
you'd want from a commonly used inline function.
It may be useful to put it into kernel/dma-coherent.c
under an #ifdef, but I'll leave this one alone for now.

I'll leave dma_alloc_coherent and dma_free_coherent
as extern declarations then, and leave out the
simple dma_coherent_dev() and dma_cache_sync() that
all architectures would need to override.

dma_get_cache_alignment() is still less generic than
the other functions, as this is still architecture
specific. Should I leave that out as well then?

One more idea I had was to rename all the functions in
this file from dma_* to dma_linear_*. This would mean
that all architectures using it would still need to
do something like #define dma_map_sg dma_linear_map_sg
for each function they want to use but can easily chose
to provide their own ones for those they need different.

It might also help architectures that work with dma_ops,
which could then define their own
struct dma_ops dma_ops_linear = {
	.map_single = dma_linear_map_single,
	.map_sg = dma_linear_map_sg,
	...
};

Would you prefer me to do it this way, or just keep the
standard function names as in the current patch?

	Arnd <><

^ permalink raw reply	[flat|nested] 86+ messages in thread

* Re: [PATCH] asm-generic: add a dma-mapping.h file
  2009-05-22 15:05                                                 ` Arnd Bergmann
@ 2009-05-26  4:36                                                   ` FUJITA Tomonori
  2009-05-26 12:35                                                     ` Arnd Bergmann
  0 siblings, 1 reply; 86+ messages in thread
From: FUJITA Tomonori @ 2009-05-26  4:36 UTC (permalink / raw)
  To: arnd
  Cc: fujita.tomonori, jgarzik, hancockrwd, htejun, alan, flar,
	schmitz, linux-kernel, linux-ide, takata, geert, linux-m68k,
	ysato, grundler

On Fri, 22 May 2009 17:05:53 +0200
Arnd Bergmann <arnd@arndb.de> wrote:

> On Friday 22 May 2009, FUJITA Tomonori wrote:
> > I'm not sure. And only mips internally uses CONFIG_DMA_COHERENT.
> > 
> > The reason why many architectures need architecture-specific
> > alloc_coherent() is not about coherent or not.
> > 
> > I like a new helper header file having only generic functions without
> > any ifdef.
> 
> Ok, fair enough. Fixing dma_alloc_coherent to handle
> coherent_dma_mask and debug_dma correctly would also
> make it even bigger, and it was already doing more than
> you'd want from a commonly used inline function.
> It may be useful to put it into kernel/dma-coherent.c
> under an #ifdef, but I'll leave this one alone for now.

Adding #ifdef into kernel/dma-coherent.c is ugly.


> I'll leave dma_alloc_coherent and dma_free_coherent
> as extern declarations then, and leave out the
> simple dma_coherent_dev() and dma_cache_sync() that
> all architectures would need to override.

Right, needs to leave the functions that architectures need to
override.


> dma_get_cache_alignment() is still less generic than
> the other functions, as this is still architecture
> specific. Should I leave that out as well then?

Yes, I think that only adding generic functions is a better
approach. Overriding with #ifdef is really ugly.


> One more idea I had was to rename all the functions in
> this file from dma_* to dma_linear_*. This would mean
> that all architectures using it would still need to
> do something like #define dma_map_sg dma_linear_map_sg
> for each function they want to use but can easily chose
> to provide their own ones for those they need different.
> 
> It might also help architectures that work with dma_ops,
> which could then define their own
> struct dma_ops dma_ops_linear = {
> 	.map_single = dma_linear_map_single,
> 	.map_sg = dma_linear_map_sg,
> 	...
> };

To me, looks like this just makes things complicated needlessly. But
I'm not in a position to ACK or NACK this. it's better to ask
architecture maintainers.


> Would you prefer me to do it this way, or just keep the
> standard function names as in the current patch?

^ permalink raw reply	[flat|nested] 86+ messages in thread

* Re: [PATCH] asm-generic: add a dma-mapping.h file
  2009-05-26  4:36                                                   ` FUJITA Tomonori
@ 2009-05-26 12:35                                                     ` Arnd Bergmann
  2009-05-27  3:58                                                       ` FUJITA Tomonori
  0 siblings, 1 reply; 86+ messages in thread
From: Arnd Bergmann @ 2009-05-26 12:35 UTC (permalink / raw)
  To: FUJITA Tomonori, linux-kernel

On Tuesday 26 May 2009, FUJITA Tomonori wrote:
> > dma_get_cache_alignment() is still less generic than
> > the other functions, as this is still architecture
> > specific. Should I leave that out as well then?
> 
> Yes, I think that only adding generic functions is a better
> approach. Overriding with #ifdef is really ugly.
> 

Ok, will do.

[trimming Cc list a bit, as the subject has changed]

Could you be more specific as to why you think the #ifdef
in this file is ugly? I agree that we should always avoid
#ifdef in a device driver file or around the usage of an
API, but we use it everywhere when defining an optional
API, e.g.

#ifdef CONFIG_DMA_API_DEBUG
extern void dma_debug_add_bus(struct bus_type *bus);
#else
static inline void dma_debug_add_bus(struct bus_type *bus)
{
{
#endif

or

#ifndef clear_user_highpage
static inline void clear_user_highpage(struct page *page, unsigned long vaddr)
{
	void *addr = kmap_atomic(page, KM_USER0);
	clear_user_page(addr, vaddr, page);
	kunmap_atomic(addr, KM_USER0);
}
#endif

This has always made a lot of sense to me when you are defining
something that you want to become a No-op in certain configurations
or that only needs special handling in a few cases. IIRC, Linus
has stated that he prefers the second of the two styles above when
you have the choice, which is why I started out that way, while
for the dma_debug stuff, the CONFIG_ symbol clearly makes sense.

	Arnd <><

^ permalink raw reply	[flat|nested] 86+ messages in thread

* Re: [PATCH] asm-generic: add a dma-mapping.h file
  2009-05-26 12:35                                                     ` Arnd Bergmann
@ 2009-05-27  3:58                                                       ` FUJITA Tomonori
  0 siblings, 0 replies; 86+ messages in thread
From: FUJITA Tomonori @ 2009-05-27  3:58 UTC (permalink / raw)
  To: arnd; +Cc: fujita.tomonori, linux-kernel

On Tue, 26 May 2009 13:35:41 +0100
Arnd Bergmann <arnd@arndb.de> wrote:

> On Tuesday 26 May 2009, FUJITA Tomonori wrote:
> > > dma_get_cache_alignment() is still less generic than
> > > the other functions, as this is still architecture
> > > specific. Should I leave that out as well then?
> > 
> > Yes, I think that only adding generic functions is a better
> > approach. Overriding with #ifdef is really ugly.
> > 
> 
> Ok, will do.
> 
> [trimming Cc list a bit, as the subject has changed]
> 
> Could you be more specific as to why you think the #ifdef
> in this file is ugly? I agree that we should always avoid
> #ifdef in a device driver file or around the usage of an
> API, but we use it everywhere when defining an optional

Seems that people think regard #ifdef in *.c bad, I think.


> API, e.g.
> 
> #ifdef CONFIG_DMA_API_DEBUG
> extern void dma_debug_add_bus(struct bus_type *bus);
> #else
> static inline void dma_debug_add_bus(struct bus_type *bus)
> {
> {
> #endif

This example is inappropriate; a different way to use #ifdef.

This just ensures that dma_debug_add_bus() is available even if
CONFIG_DMA_API_DEBUG is disabled.

It's completely different from a way how you use #ifdef.


> #ifndef clear_user_highpage
> static inline void clear_user_highpage(struct page *page, unsigned long vaddr)
> {
> 	void *addr = kmap_atomic(page, KM_USER0);
> 	clear_user_page(addr, vaddr, page);
> 	kunmap_atomic(addr, KM_USER0);
> }
> #endif

#define clear_user_highpage(page,vaddr)		\
	 __cpu_clear_user_highpage(page, vaddr)

Personally, I don't fancy this style but it's a matter of taste, I
guess.


> This has always made a lot of sense to me when you are defining
> something that you want to become a No-op in certain configurations
> or that only needs special handling in a few cases. IIRC, Linus
> has stated that he prefers the second of the two styles above when
> you have the choice, which is why I started out that way, while
> for the dma_debug stuff, the CONFIG_ symbol clearly makes sense.
> 
> 	Arnd <><
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 86+ messages in thread

end of thread, other threads:[~2009-05-27  3:59 UTC | newest]

Thread overview: 86+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20090511222702.352192505@arndb.de>
2009-05-11 22:37 ` [PATCH] mb862xxfb: use CONFIG_OF instead of CONFIG_PPC_OF Arnd Bergmann
2009-05-13 12:25   ` Anatolij Gustschin
2009-05-11 22:38 ` [PATCH] ata: libata depends on HAS_DMA Arnd Bergmann
2009-05-12  0:58   ` Jeff Garzik
2009-05-12 12:40     ` Arnd Bergmann
2009-05-12 13:05       ` Arnd Bergmann
2009-05-12 13:05         ` Arnd Bergmann
2009-05-12  8:06   ` Alan Cox
2009-05-12  9:23     ` Arnd Bergmann
2009-05-12  9:23       ` Arnd Bergmann
2009-05-13  3:30       ` Brad Boyer
2009-05-13  3:30         ` Brad Boyer
2009-05-13  4:12         ` Michael Schmitz
2009-05-13  4:12         ` Michael Schmitz
2009-05-13  4:12           ` Michael Schmitz
2009-05-13  4:34           ` Brad Boyer
2009-05-13  4:34             ` Brad Boyer
2009-05-13  8:51             ` Alan Cox
2009-05-13  8:55               ` Geert Uytterhoeven
2009-05-13 23:57               ` Robert Hancock
2009-05-14  0:18                 ` FUJITA Tomonori
2009-05-15  5:31                   ` Tejun Heo
2009-05-15 11:16                     ` Arnd Bergmann
2009-05-15 11:16                       ` Arnd Bergmann
2009-05-15 11:21                       ` Tejun Heo
2009-05-15 11:55                         ` Arnd Bergmann
2009-05-17  9:00                           ` Robert Hancock
2009-05-17 19:38                             ` Arnd Bergmann
2009-05-17 20:05                               ` Jeff Garzik
2009-05-17 22:45                                 ` [PATCH] asm-generic: add a dma-mapping.h file Arnd Bergmann
2009-05-18  6:03                                   ` Geert Uytterhoeven
2009-05-18  6:03                                     ` Geert Uytterhoeven
2009-05-18  8:28                                     ` Arnd Bergmann
2009-05-18 10:45                                   ` FUJITA Tomonori
2009-05-18 14:45                                     ` Arnd Bergmann
2009-05-18 22:44                                       ` FUJITA Tomonori
2009-05-19 16:22                                         ` Arnd Bergmann
2009-05-19 17:01                                           ` Grant Grundler
2009-05-19 17:40                                             ` Arnd Bergmann
2009-05-19 18:08                                               ` Grant Grundler
2009-05-19 18:08                                                 ` Grant Grundler
2009-05-22 12:12                                           ` FUJITA Tomonori
2009-05-22 14:07                                             ` Arnd Bergmann
2009-05-22 14:38                                               ` FUJITA Tomonori
2009-05-22 15:05                                                 ` Arnd Bergmann
2009-05-26  4:36                                                   ` FUJITA Tomonori
2009-05-26 12:35                                                     ` Arnd Bergmann
2009-05-27  3:58                                                       ` FUJITA Tomonori
2009-05-18 22:54                                   ` Jeff Garzik
2009-05-18 23:22                                     ` FUJITA Tomonori
2009-05-18 10:45                       ` [PATCH] ata: libata depends on HAS_DMA FUJITA Tomonori
2009-05-13 10:39         ` Arnd Bergmann
2009-05-13 10:39           ` Arnd Bergmann
2009-05-13 10:39         ` Arnd Bergmann
2009-05-11 22:40 ` [PATCH] scsi: libsas " Arnd Bergmann
2009-05-11 22:50   ` James Bottomley
2009-05-11 22:59     ` James Bottomley
2009-05-11 23:16       ` Arnd Bergmann
2009-05-11 22:43 ` [PATCH] arm: rename CLOCK_TICK_RATE to ARM_TICK_RATE Arnd Bergmann
2009-05-11 23:11   ` [PATCH v2] " Arnd Bergmann
2009-05-13 17:11   ` [PATCH] " Arnd Bergmann
2009-05-11 22:50 ` [PATCH] x86: use PIT_TICK_RATE consistently Arnd Bergmann
2009-05-11 23:05   ` Arnd Bergmann
2009-05-11 22:55 ` [PATCH] move PIT_TICK_RATE to linux/timex.h Arnd Bergmann
2009-05-11 22:55   ` Arnd Bergmann
2009-05-12  0:01   ` Andrew Morton
2009-05-12  0:36     ` Arnd Bergmann
2009-05-11 22:57 ` [PATCH] mips: use PIT_TICK_RATE in i8253 Arnd Bergmann
2009-05-11 22:58 ` [PATCH] input: use PIT_TICK_RATE in vt beep ioctl Arnd Bergmann
2009-05-12  9:31   ` Alan Cox
2009-05-11 22:59 ` [PATCH] x86: fix ktermios-termio conversion Arnd Bergmann
2009-05-11 23:19   ` [PATCH v2] " Arnd Bergmann
2009-05-12  7:55     ` Ingo Molnar
2009-05-12  9:04       ` Arnd Bergmann
2009-05-12  9:10         ` Ingo Molnar
2009-05-12  9:21           ` Alan Cox
2009-05-12  9:26             ` Ingo Molnar
2009-05-12 10:05               ` Alan Cox
2009-05-12 10:15                 ` Ingo Molnar
2009-05-12 11:33                 ` [PATCH v3] " Arnd Bergmann
2009-05-12 11:42           ` [PATCH v2] " Arnd Bergmann
2009-05-12  9:17         ` Alan Cox
2009-05-11 23:02 ` [PATCH] ipc: use __ARCH_WANT_IPC_PARSE_VERSION in ipc/util.h Arnd Bergmann
2009-05-12  0:19   ` Serge E. Hallyn
2009-05-11 23:03 ` [PATCH] syscalls.h add the missing sys_pipe2 declaration Arnd Bergmann
2009-05-11 23:08   ` Arnd Bergmann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.