23811e0b6e944ff950f32b0c9fe8f6243073ed37
[openwrt/staging/mans0n.git] /
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
5 zone_type'
6
7 commit 734f9246e791d8da278957b2c326d7709b2a97c0 upstream.
8
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.
12
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>
17 ---
18 include/linux/mmzone.h | 45 ++++++++++++++++++++++++------------------
19 1 file changed, 26 insertions(+), 19 deletions(-)
20
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 */
25
26 enum zone_type {
27 -#ifdef CONFIG_ZONE_DMA
28 /*
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.
33 - *
34 - * Some examples
35 - *
36 - * Architecture Limit
37 - * ---------------------------
38 - * parisc, ia64, sparc <4G
39 - * s390, powerpc <2G
40 - * arm Various
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.
50 + *
51 + * Some examples:
52 + *
53 + * - i386 and x86_64 have a fixed 16M ZONE_DMA and ZONE_DMA32 for the
54 + * rest of the lower 4G.
55 + *
56 + * - arm only uses ZONE_DMA, the size, up to 4G, may vary depending on
57 + * the specific device.
58 + *
59 + * - arm64 has a fixed 1G ZONE_DMA and ZONE_DMA32 for the rest of the
60 + * lower 4G.
61 + *
62 + * - powerpc only uses ZONE_DMA, the size, up to 2G, may vary
63 + * depending on the specific device.
64 *
65 - * i386, x86_64 and multiple other arches
66 - * <16M.
67 + * - s390 uses ZONE_DMA fixed to the lower 2G.
68 + *
69 + * - ia64 and riscv only use ZONE_DMA32.
70 + *
71 + * - parisc uses neither.
72 */
73 +#ifdef CONFIG_ZONE_DMA
74 ZONE_DMA,
75 #endif
76 #ifdef CONFIG_ZONE_DMA32
77 - /*
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.
81 - */
82 ZONE_DMA32,
83 #endif
84 /*