MAX_DMADOM_PFN
PATCH 1/1 MAX_DMADOM_PFN
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 [email protected]
# 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.
xen/common/page_alloc.c +3 -1
@@ -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)
Signature · 1 line
yamahata
# HG changeset patch
# User [email protected]
# 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.
xen/common/page_alloc.c +3 -1
@@ -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)
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Quoted 19 lines · Isaku Yamahata
made
MAX_DMADOM_PFNpage 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 [email protected]
# Node ID0c2b703c79333c01e4cccef1fbac1d01c6c7daa7
# Parent5b004f4e76cf90ef6f7155a4822e63b9e33cf7d8
madeMAX_DMADOM_PFNaware 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 <[email protected]>diff -r
5b004f4e76cf-r0c2b703c7933xen/common/page_alloc.c
xen/common/page_alloc.c line 223
Quoted 9 lines
xen/common/page_alloc.c +3
-1@@ -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.
Thanks,
Jon
Quoted 34 lines
xen/common/page_alloc.c +0
-1--yamahata
# HG changeset patch
# User [email protected]
# Node ID0c2b703c79333c01e4cccef1fbac1d01c6c7daa7
# Parent5b004f4e76cf90ef6f7155a4822e63b9e33cf7d8
madeMAX_DMADOM_PFNaware 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 <[email protected]>diff -r
5b004f4e76cf-r0c2b703c7933xen/common/page_alloc.cxen/common/page_alloc.c +3
-1@@ -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)_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Quoted 32 lines · Jon Mason
Quoted 19 lines · Isaku Yamahata
made
MAX_DMADOM_PFNpage 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 [email protected]
# Node ID0c2b703c79333c01e4cccef1fbac1d01c6c7daa7
# Parent5b004f4e76cf90ef6f7155a4822e63b9e33cf7d8
madeMAX_DMADOM_PFNaware 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 <[email protected]>diff -r
5b004f4e76cf-r0c2b703c7933xen/common/page_alloc.cxen/common/page_alloc.c line 223
Quoted 9 lines
xen/common/page_alloc.c +3
-1@@ -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?
Quoted 3 lines
Also, wouldn't it be better to define this in <
asm/dma.h>? x86-64 added similar #defines toinclude/asm-x86_64/dma.hrelatively recently (seeMAX_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 [email protected]
# 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.
xen/common/page_alloc.c +1 -1
@@ -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)
xen/include/asm-ia64/linux-xen/asm/dma.h new file +25 -0
@@ -0,0 +1,25 @@ +#ifndef _ASM_IA64_DMA_H +#define _ASM_IA64_DMA_H + +/* +* Copyright (C) 1998-2002 Hewlett-Packard Co +* David Mosberger-Tang <[email protected]> +*/ + +#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 */
xen/include/asm-x86/dma.h new file +16 -0
@@ -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 */
xen/include/asm-x86/x86_32/dma.h new file +10 -0
@@ -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 */
xen/include/asm-x86/x86_64/dma.h new file +10 -0
@@ -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 */
xen/include/asm-ia64/linux/asm/dma.h deleted +0 -23
@@ -1,23 +0,0 @@ -#ifndef _ASM_IA64_DMA_H -#define _ASM_IA64_DMA_H - -/* -* Copyright (C) 1998-2002 Hewlett-Packard Co -* David Mosberger-Tang <[email protected]> -*/ - -#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 */
Signature · 1 line
yamahata
# HG changeset patch
# User [email protected]
# 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.
xen/common/page_alloc.c +1 -1
@@ -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)
xen/include/asm-ia64/linux-xen/asm/dma.h new file +25 -0
@@ -0,0 +1,25 @@ +#ifndef _ASM_IA64_DMA_H +#define _ASM_IA64_DMA_H + +/* +* Copyright (C) 1998-2002 Hewlett-Packard Co +* David Mosberger-Tang <[email protected]> +*/ + +#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 */
xen/include/asm-x86/dma.h new file +16 -0
@@ -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 */
xen/include/asm-x86/x86_32/dma.h new file +10 -0
@@ -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 */
xen/include/asm-x86/x86_64/dma.h new file +10 -0
@@ -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 */
xen/include/asm-ia64/linux/asm/dma.h deleted +0 -23
@@ -1,23 +0,0 @@ -#ifndef _ASM_IA64_DMA_H -#define _ASM_IA64_DMA_H - -/* -* Copyright (C) 1998-2002 Hewlett-Packard Co -* David Mosberger-Tang <[email protected]> -*/ - -#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 */
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Quoted 6 lines · Isaku Yamahata
I added
asm-xxx/dma.hto each archs and movedMAX_DMADOM_PFNdefinition to these files. But I left the value as it was.
(I only did compile tests forx86_32and ia64.)Is this patch acceptable or should I refine more?
I don't want Linux-style dma.h in Xen, since Xen really knows nothing about DMA. :-)
I think MAX_DMADOM_PFN has a limited life ahead of it (I'd like to push address-width awareness into the core of the allocator at some point). So I'll just move MAX_DMADOM_PFN to asm/config.h, then you ia64 guys can change it as you wish.
-- Keir