[lkml]   [2011]   [Mar]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
Subjectgeneric page.h problem
I'm working with a new architecture port (nommu) and was wanting to use
the generic page.h but there is a problem. I'm using CONFIG_FLATMEM with
a non-zero CONFIG_KERNEL_RAM_BASE_ADDRESS. The hardware uses this same
address to access RAM from code and for DMA purposes. The generic page.h

#define PAGE_OFFSET (0)

#ifndef __ASSEMBLY__

#define __va(x) ((void *)((unsigned long)(x) + PAGE_OFFSET))
#define __pa(x) ((unsigned long) (x) - PAGE_OFFSET)

The problem I have is that __va(x) and __pa(x) should do nothing on
this architecture. If I use the following, then everything seems to
work as it should.

diff --git a/include/asm-generic/page.h b/include/asm-generic/page.h
index 75fec18..4dc4a81 100644
--- a/include/asm-generic/page.h
+++ b/include/asm-generic/page.h
@@ -73,8 +73,8 @@ extern unsigned long memory_end;

#ifndef __ASSEMBLY__

-#define __va(x) ((void *)((unsigned long)(x) + PAGE_OFFSET))
-#define __pa(x) ((unsigned long) (x) - PAGE_OFFSET)
+#define __va(x) ((void *)((unsigned long) (x)))
+#define __pa(x) ((unsigned long) (x))

#define virt_to_pfn(kaddr) (__pa(kaddr) >> PAGE_SHIFT)
#define pfn_to_virt(pfn) __va((pfn) << PAGE_SHIFT)

Am I missing something here? The only other arch using the generic
page.h is blackfin, but it uses a zero PAGE_OFFSET, so my patch
would have no effect there.


 \ /
  Last update: 2011-03-23 20:15    [W:0.030 / U:3.480 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site