wrong usage of MAX_DMA_ADDRESS in bootmem.h

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: lkml <linux-kernel@...>
Cc: Russell King - ARM Linux <linux@...>
Date: Tuesday, September 30, 2008 - 3:35 pm

I have implemented highmem for ARM.  To catch wrong usage of __pa() and 
__va() with out of range values, I added a range check when 
CONFIG_DEBUG_HIGHMEM is set.

One issue is that bootmem.h uses __pa(MAX_DMA_ADDRESS). However 
MAX_DMA_ADDRESS on ARM is defined as 0xffffffff because there is usually 
no restriction on the maximum DMA-able address.

RMK suggested that those places should be using ISA_DMA_THRESHOLD 
instead -- here's an excert of our conversation on this topic:


So what about this patch?

diff --git a/include/linux/bootmem.h b/include/linux/bootmem.h
index 95837bf..7a97ffe 100644
--- a/include/linux/bootmem.h
+++ b/include/linux/bootmem.h
@@ -96,21 +96,21 @@ extern void *__alloc_bootmem_low_node(pg_data_t *pgdat,
 				      unsigned long goal);
 #ifndef CONFIG_HAVE_ARCH_BOOTMEM_NODE
 #define alloc_bootmem(x) \
-	__alloc_bootmem(x, SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS))
+	__alloc_bootmem(x, SMP_CACHE_BYTES, ISA_DMA_THRESHOLD)
 #define alloc_bootmem_nopanic(x) \
-	__alloc_bootmem_nopanic(x, SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS))
+	__alloc_bootmem_nopanic(x, SMP_CACHE_BYTES, ISA_DMA_THRESHOLD)
 #define alloc_bootmem_low(x) \
 	__alloc_bootmem_low(x, SMP_CACHE_BYTES, 0)
 #define alloc_bootmem_pages(x) \
-	__alloc_bootmem(x, PAGE_SIZE, __pa(MAX_DMA_ADDRESS))
+	__alloc_bootmem(x, PAGE_SIZE, ISA_DMA_THRESHOLD)
 #define alloc_bootmem_pages_nopanic(x) \
-	__alloc_bootmem_nopanic(x, PAGE_SIZE, __pa(MAX_DMA_ADDRESS))
+	__alloc_bootmem_nopanic(x, PAGE_SIZE, ISA_DMA_THRESHOLD)
 #define alloc_bootmem_low_pages(x) \
 	__alloc_bootmem_low(x, PAGE_SIZE, 0)
 #define alloc_bootmem_node(pgdat, x) \
-	__alloc_bootmem_node(pgdat, x, SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS))
+	__alloc_bootmem_node(pgdat, x, SMP_CACHE_BYTES, ISA_DMA_THRESHOLD)
 #define alloc_bootmem_pages_node(pgdat, x) \
-	__alloc_bootmem_node(pgdat, x, PAGE_SIZE, __pa(MAX_DMA_ADDRESS))
+	__alloc_bootmem_node(pgdat, x, PAGE_SIZE, ISA_DMA_THRESHOLD)
 #define alloc_bootmem_low_pages_node(pgdat, x) \
 	__alloc_bootmem_low_node(pgdat, x, PAGE_SIZE, 0)
 #endif /* !CONFIG_HAVE_ARCH_BOOTMEM_NODE */
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
wrong usage of MAX_DMA_ADDRESS in bootmem.h, Nicolas Pitre, (Tue Sep 30, 3:35 pm)
Re: wrong usage of MAX_DMA_ADDRESS in bootmem.h, Christoph Lameter, (Tue Sep 30, 3:56 pm)
Re: wrong usage of MAX_DMA_ADDRESS in bootmem.h, Russell King - ARM Linux, (Tue Sep 30, 4:12 pm)
Re: wrong usage of MAX_DMA_ADDRESS in bootmem.h, Christoph Lameter, (Wed Oct 1, 8:07 am)
Re: wrong usage of MAX_DMA_ADDRESS in bootmem.h, Russell King - ARM Linux, (Wed Oct 1, 10:06 am)
Re: wrong usage of MAX_DMA_ADDRESS in bootmem.h, Christoph Lameter, (Wed Oct 1, 10:50 am)
Re: wrong usage of MAX_DMA_ADDRESS in bootmem.h, Russell King - ARM Linux, (Wed Oct 1, 11:02 am)
Re: wrong usage of MAX_DMA_ADDRESS in bootmem.h, Christoph Lameter, (Thu Oct 2, 12:49 pm)
Re: wrong usage of MAX_DMA_ADDRESS in bootmem.h, Russell King - ARM Linux, (Thu Oct 2, 3:06 pm)
Re: wrong usage of MAX_DMA_ADDRESS in bootmem.h, Nicolas Pitre, (Tue Sep 30, 5:09 pm)