Re: [PATCH] Allow for arch-specific IOREMAP_MAX_ORDER

2005-09-06 Thread Deepak Saxena
On Aug 28 2005, at 18:39, Russell King was caught saying:
> On Wed, Aug 24, 2005 at 03:12:02PM -0700, Deepak Saxena wrote:
> > Version 6 of the ARM architecture introduces the concept of 16MB pages
> > (supersections) and 36-bit (40-bit actually, but nobody uses this)
> > physical addresses. 36-bit addressed memory and I/O and ARMv6 can
> > only be mapped using supersections and the requirement on these is
> > that both virtual and physical addresses be 16MB aligned.
> 
> Have we sorted out how we handle the issue of IO vs memory outside the
> normal 4GB?  We can only map one or other depending on how the domains
> are setup and get the correct permission behaviour.

That's an arch-specific issue that we'll have to handle in the ARM code
and really shouldn't impact this patch itself. FYI, all the 36-bit CPUs
I know of (from Intel) only have I/O above 4G.

~Deepak

-- 
Deepak Saxena - [EMAIL PROTECTED] - http://www.plexity.net

Even a stopped clock gives the right time twice a day.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] Allow for arch-specific IOREMAP_MAX_ORDER

2005-09-06 Thread Deepak Saxena
On Aug 28 2005, at 18:39, Russell King was caught saying:
 On Wed, Aug 24, 2005 at 03:12:02PM -0700, Deepak Saxena wrote:
  Version 6 of the ARM architecture introduces the concept of 16MB pages
  (supersections) and 36-bit (40-bit actually, but nobody uses this)
  physical addresses. 36-bit addressed memory and I/O and ARMv6 can
  only be mapped using supersections and the requirement on these is
  that both virtual and physical addresses be 16MB aligned.
 
 Have we sorted out how we handle the issue of IO vs memory outside the
 normal 4GB?  We can only map one or other depending on how the domains
 are setup and get the correct permission behaviour.

That's an arch-specific issue that we'll have to handle in the ARM code
and really shouldn't impact this patch itself. FYI, all the 36-bit CPUs
I know of (from Intel) only have I/O above 4G.

~Deepak

-- 
Deepak Saxena - [EMAIL PROTECTED] - http://www.plexity.net

Even a stopped clock gives the right time twice a day.
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] Allow for arch-specific IOREMAP_MAX_ORDER

2005-08-28 Thread Russell King
On Wed, Aug 24, 2005 at 03:12:02PM -0700, Deepak Saxena wrote:
> Version 6 of the ARM architecture introduces the concept of 16MB pages
> (supersections) and 36-bit (40-bit actually, but nobody uses this)
> physical addresses. 36-bit addressed memory and I/O and ARMv6 can
> only be mapped using supersections and the requirement on these is
> that both virtual and physical addresses be 16MB aligned.

Have we sorted out how we handle the issue of IO vs memory outside the
normal 4GB?  We can only map one or other depending on how the domains
are setup and get the correct permission behaviour.

-- 
Russell King
 Linux kernel2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 Serial core
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] Allow for arch-specific IOREMAP_MAX_ORDER

2005-08-28 Thread Russell King
On Wed, Aug 24, 2005 at 03:12:02PM -0700, Deepak Saxena wrote:
 Version 6 of the ARM architecture introduces the concept of 16MB pages
 (supersections) and 36-bit (40-bit actually, but nobody uses this)
 physical addresses. 36-bit addressed memory and I/O and ARMv6 can
 only be mapped using supersections and the requirement on these is
 that both virtual and physical addresses be 16MB aligned.

Have we sorted out how we handle the issue of IO vs memory outside the
normal 4GB?  We can only map one or other depending on how the domains
are setup and get the correct permission behaviour.

-- 
Russell King
 Linux kernel2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 Serial core
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] Allow for arch-specific IOREMAP_MAX_ORDER

2005-08-24 Thread Deepak Saxena
Version 6 of the ARM architecture introduces the concept of 16MB pages
(supersections) and 36-bit (40-bit actually, but nobody uses this)
physical addresses. 36-bit addressed memory and I/O and ARMv6 can
only be mapped using supersections and the requirement on these is
that both virtual and physical addresses be 16MB aligned. In trying
to add support for ioremap() of 36-bit I/O, we run into the issue that
get_vm_area() allows for a maximum of 512K alignment via the 
IOREMAP_MAX_ORDER constant. To work around this, we can:

- Allocate a larger VM area than needed (size + (1ul << IOREMAP_MAX_ORDER))
  and then align the pointer ourselves, but this ends up with 512K of 
  wasted VM per ioremap().

- Provide a new __get_vm_area_aligned() API and make __get_vm_area() sit
  on top of this. I did this and it works but I don't like the idea 
  adding another VM API just for this one case.

- My preferred solution which is to allow the architecture to override
  the IOREMAP_MAX_ORDER constant with it's own version. 

Signed-off-by: Deepak Saxena <[EMAIL PROTECTED]>

diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h
--- a/include/linux/vmalloc.h
+++ b/include/linux/vmalloc.h
@@ -10,6 +10,14 @@
 #define VM_MAP 0x0004  /* vmap()ed pages */
 /* bits [20..32] reserved for arch specific ioremap internals */
 
+/*
+ * Maximum alignment for ioremap() regions.
+ * Can be overriden by arch-specific value.
+ */
+#ifndef IOREMAP_MAX_ORDER
+#define IOREMAP_MAX_ORDER  (7 + PAGE_SHIFT)/* 128 pages */
+#endif
+
 struct vm_struct {
void*addr;
unsigned long   size;
diff --git a/mm/vmalloc.c b/mm/vmalloc.c
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -158,8 +158,6 @@ int map_vm_area(struct vm_struct *area, 
return err;
 }
 
-#define IOREMAP_MAX_ORDER  (7 + PAGE_SHIFT)/* 128 pages */
-
 struct vm_struct *__get_vm_area(unsigned long size, unsigned long flags,
unsigned long start, unsigned long end)
 {

-- 
Deepak Saxena - [EMAIL PROTECTED] - http://www.plexity.net

Even a stopped clock gives the right time twice a day.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] Allow for arch-specific IOREMAP_MAX_ORDER

2005-08-24 Thread Deepak Saxena
Version 6 of the ARM architecture introduces the concept of 16MB pages
(supersections) and 36-bit (40-bit actually, but nobody uses this)
physical addresses. 36-bit addressed memory and I/O and ARMv6 can
only be mapped using supersections and the requirement on these is
that both virtual and physical addresses be 16MB aligned. In trying
to add support for ioremap() of 36-bit I/O, we run into the issue that
get_vm_area() allows for a maximum of 512K alignment via the 
IOREMAP_MAX_ORDER constant. To work around this, we can:

- Allocate a larger VM area than needed (size + (1ul  IOREMAP_MAX_ORDER))
  and then align the pointer ourselves, but this ends up with 512K of 
  wasted VM per ioremap().

- Provide a new __get_vm_area_aligned() API and make __get_vm_area() sit
  on top of this. I did this and it works but I don't like the idea 
  adding another VM API just for this one case.

- My preferred solution which is to allow the architecture to override
  the IOREMAP_MAX_ORDER constant with it's own version. 

Signed-off-by: Deepak Saxena [EMAIL PROTECTED]

diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h
--- a/include/linux/vmalloc.h
+++ b/include/linux/vmalloc.h
@@ -10,6 +10,14 @@
 #define VM_MAP 0x0004  /* vmap()ed pages */
 /* bits [20..32] reserved for arch specific ioremap internals */
 
+/*
+ * Maximum alignment for ioremap() regions.
+ * Can be overriden by arch-specific value.
+ */
+#ifndef IOREMAP_MAX_ORDER
+#define IOREMAP_MAX_ORDER  (7 + PAGE_SHIFT)/* 128 pages */
+#endif
+
 struct vm_struct {
void*addr;
unsigned long   size;
diff --git a/mm/vmalloc.c b/mm/vmalloc.c
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -158,8 +158,6 @@ int map_vm_area(struct vm_struct *area, 
return err;
 }
 
-#define IOREMAP_MAX_ORDER  (7 + PAGE_SHIFT)/* 128 pages */
-
 struct vm_struct *__get_vm_area(unsigned long size, unsigned long flags,
unsigned long start, unsigned long end)
 {

-- 
Deepak Saxena - [EMAIL PROTECTED] - http://www.plexity.net

Even a stopped clock gives the right time twice a day.
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/