1 From 1c108eaeae73a504ac1b2d882bc1fefb91eecf17 Mon Sep 17 00:00:00 2001
2 From: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
3 Date: Wed, 11 Sep 2019 20:25:46 +0200
4 Subject: [PATCH] mm: refresh ZONE_DMA and ZONE_DMA32 comments in 'enum
7 commit 734f9246e791d8da278957b2c326d7709b2a97c0 upstream.
9 These zones usage has evolved with time and the comments were outdated.
10 This joins both ZONE_DMA and ZONE_DMA32 explanation and gives up to date
11 examples on how they are used on different architectures.
13 Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
14 Reviewed-by: Christoph Hellwig <hch@lst.de>
15 Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
16 Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
18 include/linux/mmzone.h | 45 ++++++++++++++++++++++++------------------
19 1 file changed, 26 insertions(+), 19 deletions(-)
21 --- a/include/linux/mmzone.h
22 +++ b/include/linux/mmzone.h
23 @@ -358,33 +358,40 @@ struct per_cpu_nodestat {
24 #endif /* !__GENERATING_BOUNDS.H */
27 -#ifdef CONFIG_ZONE_DMA
29 - * ZONE_DMA is used when there are devices that are not able
30 - * to do DMA to all of addressable memory (ZONE_NORMAL). Then we
31 - * carve out the portion of memory that is needed for these devices.
32 - * The range is arch specific.
36 - * Architecture Limit
37 - * ---------------------------
38 - * parisc, ia64, sparc <4G
41 - * alpha Unlimited or 0-16MB.
42 + * ZONE_DMA and ZONE_DMA32 are used when there are peripherals not able
43 + * to DMA to all of the addressable memory (ZONE_NORMAL).
44 + * On architectures where this area covers the whole 32 bit address
45 + * space ZONE_DMA32 is used. ZONE_DMA is left for the ones with smaller
46 + * DMA addressing constraints. This distinction is important as a 32bit
47 + * DMA mask is assumed when ZONE_DMA32 is defined. Some 64-bit
48 + * platforms may need both zones as they support peripherals with
49 + * different DMA addressing limitations.
53 + * - i386 and x86_64 have a fixed 16M ZONE_DMA and ZONE_DMA32 for the
54 + * rest of the lower 4G.
56 + * - arm only uses ZONE_DMA, the size, up to 4G, may vary depending on
57 + * the specific device.
59 + * - arm64 has a fixed 1G ZONE_DMA and ZONE_DMA32 for the rest of the
62 + * - powerpc only uses ZONE_DMA, the size, up to 2G, may vary
63 + * depending on the specific device.
65 - * i386, x86_64 and multiple other arches
67 + * - s390 uses ZONE_DMA fixed to the lower 2G.
69 + * - ia64 and riscv only use ZONE_DMA32.
71 + * - parisc uses neither.
73 +#ifdef CONFIG_ZONE_DMA
76 #ifdef CONFIG_ZONE_DMA32
78 - * x86_64 needs two ZONE_DMAs because it supports devices that are
79 - * only able to do DMA to the lower 16M but also 32 bit devices that
80 - * can only do DMA areas below 4G.