On Thu, Jan 26, 2006 at 02:03:46PM -0600, Jon Mason
wrote:> On Thu, Jan 26, 2006 at 10:19:20AM +0900, Isaku Yamahata wrote:
> >
> > made MAX_DMADOM_PFN page size aware.
> > 4K page size was assumed, however it is not true for xen/ia64.
> > It should also be possible for arch dependent code to override it.
> >
> > # HG changeset patch
> > # User yamahata@valinux.co.jp
> > # Node ID 0c2b703c79333c01e4cccef1fbac1d01c6c7daa7
> > # Parent 5b004f4e76cf90ef6f7155a4822e63b9e33cf7d8
> > made MAX_DMADOM_PFN aware of page size.
> > 4K page size was assumed. It is not true for xen/ia64 by default.
> > It should also be possible for arch dependent code to override it.
> >
> > Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
> >
> > diff -r 5b004f4e76cf -r 0c2b703c7933 xen/common/page_alloc.c
> > --- a/xen/common/page_alloc.c Wed Jan 25 23:35:22 2006 +0100
> > +++ b/xen/common/page_alloc.c Thu Jan 26 10:09:39 2006 +0900
> > @@ -216,7 +216,9 @@
> > #define NR_ZONES 3
> >
> >
> > -#define MAX_DMADOM_PFN 0x7FFFFUL /* 31 addressable bits */
> > +#ifndef MAX_DMADOM_PFN /* arch-depedent code can override */
> > +#define MAX_DMADOM_PFN (0x7FFFFFFFUL >> PAGE_SHIFT) /* 31
addressable bits */
> > +#endif
> > #define pfn_dom_zone_type(_pfn) \
> > (((_pfn) <= MAX_DMADOM_PFN) ? MEMZONE_DMADOM : MEMZONE_DOM)
>
> Why only 31bits?
>
> Also, wouldn''t it be better to define this in <asm/dma.h>?
x86-64 added
> similar #defines to include/asm-x86_64/dma.h relatively recently (see
> MAX_DMA32_PFN). This would be a good model to follow.
I added asm-xxx/dma.h to each archs and moved
MAX_DMADOM_PFN definition to these files.
But I left the value as it was.
(I only did compile tests for x86_32 and ia64.)
Is this patch acceptable or should I refine more?
# HG changeset patch
# User yamahata@valinux.co.jp
# Node ID 322423fd19f90adeea2dfe248b794d53de3cbb81
# Parent 2add7a26253079c1d9d6ba87a37aa72c89358a06
made MAX_DMADOM_PFN page size aware and arch dependent.
4K page size was assumed, however it is not true for xen/ia64.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
diff -r 2add7a262530 -r 322423fd19f9 xen/common/page_alloc.c
--- a/xen/common/page_alloc.c Fri Jan 27 16:17:38 2006 +0100
+++ b/xen/common/page_alloc.c Mon Jan 30 11:56:52 2006 +0900
@@ -33,6 +33,7 @@
#include <xen/shadow.h>
#include <xen/domain_page.h>
#include <asm/page.h>
+#include <asm/dma.h>
/*
* Comma-separated list of hexadecimal page numbers containing bad bytes.
@@ -216,7 +217,6 @@
#define NR_ZONES 3
-#define MAX_DMADOM_PFN 0x7FFFFUL /* 31 addressable bits */
#define pfn_dom_zone_type(_pfn) \
(((_pfn) <= MAX_DMADOM_PFN) ? MEMZONE_DMADOM : MEMZONE_DOM)
diff -r 2add7a262530 -r 322423fd19f9 xen/include/asm-ia64/linux-xen/asm/dma.h
--- /dev/null Thu Jan 1 00:00:00 1970 +0000
+++ b/xen/include/asm-ia64/linux-xen/asm/dma.h Mon Jan 30 11:56:52 2006 +0900
@@ -0,0 +1,25 @@
+#ifndef _ASM_IA64_DMA_H
+#define _ASM_IA64_DMA_H
+
+/*
+ * Copyright (C) 1998-2002 Hewlett-Packard Co
+ * David Mosberger-Tang <davidm@hpl.hp.com>
+ */
+
+#include <linux/config.h>
+
+#include <asm/io.h> /* need byte IO */
+
+extern unsigned long MAX_DMA_ADDRESS;
+
+#ifdef CONFIG_PCI
+ extern int isa_dma_bridge_buggy;
+#else
+# define isa_dma_bridge_buggy (0)
+#endif
+
+#define free_dma(x)
+
+#define MAX_DMADOM_PFN (0x7FFFFFFFUL >> PAGE_SHIFT) /* 31 addressable
bits */
+
+#endif /* _ASM_IA64_DMA_H */
diff -r 2add7a262530 -r 322423fd19f9 xen/include/asm-x86/dma.h
--- /dev/null Thu Jan 1 00:00:00 1970 +0000
+++ b/xen/include/asm-x86/dma.h Mon Jan 30 11:56:52 2006 +0900
@@ -0,0 +1,16 @@
+/*
+ * dma.h
+ */
+
+#ifndef _ASM_X86_DMA_H
+#define _ASM_X86_DMA_H
+
+#include <asm/page.h>
+
+#if defined(__i386__)
+# include <asm/x86_32/dma.h>
+#elif defined(__x86_64__)
+# include <asm/x86_64/dma.h>
+#endif
+
+#endif /* _ASM_X86_DMA_H */
diff -r 2add7a262530 -r 322423fd19f9 xen/include/asm-x86/x86_32/dma.h
--- /dev/null Thu Jan 1 00:00:00 1970 +0000
+++ b/xen/include/asm-x86/x86_32/dma.h Mon Jan 30 11:56:52 2006 +0900
@@ -0,0 +1,10 @@
+/*
+ * x86_32/dma.h
+ */
+
+#ifndef _ASM_X86_32_DMA_H
+#define _ASM_X86_32_DMA_H
+
+#define MAX_DMADOM_PFN (0x7FFFFFFFUL >> PAGE_SHIFT) /* 31 addressable
bits */
+
+#endif /* _ASM_X86_32_DMA_H */
diff -r 2add7a262530 -r 322423fd19f9 xen/include/asm-x86/x86_64/dma.h
--- /dev/null Thu Jan 1 00:00:00 1970 +0000
+++ b/xen/include/asm-x86/x86_64/dma.h Mon Jan 30 11:56:52 2006 +0900
@@ -0,0 +1,10 @@
+/*
+ * x86_64/dma.h
+ */
+
+#ifndef _ASM_X86_64_DMA_H
+#define _ASM_X86_64_DMA_H
+
+#define MAX_DMADOM_PFN (0x7FFFFFFFUL >> PAGE_SHIFT) /* 31 addressable
bits */
+
+#endif /* _ASM_X86_64_DMA_H */
diff -r 2add7a262530 -r 322423fd19f9 xen/include/asm-ia64/linux/asm/dma.h
--- a/xen/include/asm-ia64/linux/asm/dma.h Fri Jan 27 16:17:38 2006 +0100
+++ /dev/null Thu Jan 1 00:00:00 1970 +0000
@@ -1,23 +0,0 @@
-#ifndef _ASM_IA64_DMA_H
-#define _ASM_IA64_DMA_H
-
-/*
- * Copyright (C) 1998-2002 Hewlett-Packard Co
- * David Mosberger-Tang <davidm@hpl.hp.com>
- */
-
-#include <linux/config.h>
-
-#include <asm/io.h> /* need byte IO */
-
-extern unsigned long MAX_DMA_ADDRESS;
-
-#ifdef CONFIG_PCI
- extern int isa_dma_bridge_buggy;
-#else
-# define isa_dma_bridge_buggy (0)
-#endif
-
-#define free_dma(x)
-
-#endif /* _ASM_IA64_DMA_H */
--
yamahata
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel