Message ID | 20240126235425.12233-31-quic_obabatun@quicinc.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Dynamic allocation of reserved_mem array. | expand |
Hi Oreoluwa, kernel test robot noticed the following build warnings: [auto build test WARNING on robh/for-next] [also build test WARNING on arm64/for-next/core vgupta-arc/for-curr powerpc/next powerpc/fixes jcmvbkbc-xtensa/xtensa-for-next linus/master v6.8-rc1 next-20240125] [cannot apply to vgupta-arc/for-next] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Oreoluwa-Babatunde/of-reserved_mem-Change-the-order-that-reserved_mem-regions-are-stored/20240127-081735 base: https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next patch link: https://lore.kernel.org/r/20240126235425.12233-31-quic_obabatun%40quicinc.com patch subject: [PATCH 30/46] of: reserved_mem: Add code to use unflattened DT for reserved_mem nodes config: i386-randconfig-061-20240127 (https://download.01.org/0day-ci/archive/20240128/202401281219.iIhqs1Si-lkp@intel.com/config) compiler: gcc-12 (Debian 12.2.0-14) 12.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240128/202401281219.iIhqs1Si-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202401281219.iIhqs1Si-lkp@intel.com/ sparse warnings: (new ones prefixed by >>) >> drivers/of/of_reserved_mem.c:111:18: sparse: sparse: incompatible types for operation (<): drivers/of/of_reserved_mem.c:111:18: sparse: struct device_node *[assigned] node drivers/of/of_reserved_mem.c:111:18: sparse: int vim +111 drivers/of/of_reserved_mem.c 98 99 /* 100 * Save the reserved_mem reg nodes in the reserved_mem array 101 */ 102 static void __init dt_scan_reserved_mem_reg_nodes(void) 103 { 104 int t_len = (dt_root_addr_cells + dt_root_size_cells) * sizeof(__be32); 105 struct device_node *node, *child; 106 phys_addr_t base, size; 107 const __be32 *prop; 108 int len; 109 110 node = of_find_node_by_path("/reserved-memory"); > 111 if (node < 0) { 112 pr_err("Reserved memory: Did not find reserved-memory node\n"); 113 return; 114 } 115 116 for_each_child_of_node(node, child) { 117 const char *uname; 118 struct reserved_mem *rmem; 119 120 if (!of_device_is_available(child)) 121 continue; 122 123 prop = of_get_property(child, "reg", &len); 124 if (!prop) { 125 rmem = of_reserved_mem_lookup(child); 126 if (rmem) 127 rmem->dev_node = child; 128 continue; 129 } 130 131 uname = of_node_full_name(child); 132 if (len && len % t_len != 0) { 133 pr_err("Reserved memory: invalid reg property in '%s', skipping node.\n", 134 uname); 135 continue; 136 } 137 138 base = dt_mem_next_cell(dt_root_addr_cells, &prop); 139 size = dt_mem_next_cell(dt_root_size_cells, &prop); 140 141 if (size) 142 fdt_reserved_mem_save_node(child, uname, base, size); 143 } 144 } 145
Hi Oreoluwa,
kernel test robot noticed the following build warnings:
[auto build test WARNING on robh/for-next]
[also build test WARNING on arm64/for-next/core vgupta-arc/for-curr powerpc/next powerpc/fixes jcmvbkbc-xtensa/xtensa-for-next linus/master v6.8-rc1 next-20240125]
[cannot apply to vgupta-arc/for-next]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Oreoluwa-Babatunde/of-reserved_mem-Change-the-order-that-reserved_mem-regions-are-stored/20240127-081735
base: https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next
patch link: https://lore.kernel.org/r/20240126235425.12233-31-quic_obabatun%40quicinc.com
patch subject: [PATCH 30/46] of: reserved_mem: Add code to use unflattened DT for reserved_mem nodes
config: arm-randconfig-r133-20240127 (https://download.01.org/0day-ci/archive/20240128/202401281304.tsu89Kcm-lkp@intel.com/config)
compiler: arm-linux-gnueabi-gcc (GCC) 13.2.0
reproduce: (https://download.01.org/0day-ci/archive/20240128/202401281304.tsu89Kcm-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202401281304.tsu89Kcm-lkp@intel.com/
sparse warnings: (new ones prefixed by >>)
>> kernel/dma/coherent.c:371:34: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned long node @@ got struct device_node *node @@
kernel/dma/coherent.c:371:34: sparse: expected unsigned long node
kernel/dma/coherent.c:371:34: sparse: got struct device_node *node
kernel/dma/coherent.c:378:33: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned long node @@ got struct device_node *node @@
kernel/dma/coherent.c:378:33: sparse: expected unsigned long node
kernel/dma/coherent.c:378:33: sparse: got struct device_node *node
vim +371 kernel/dma/coherent.c
7bfa5ab6fa1b18 drivers/base/dma-coherent.c Marek Szyprowski 2014-10-13 362
7bfa5ab6fa1b18 drivers/base/dma-coherent.c Marek Szyprowski 2014-10-13 363 static int __init rmem_dma_setup(struct reserved_mem *rmem)
7bfa5ab6fa1b18 drivers/base/dma-coherent.c Marek Szyprowski 2014-10-13 364 {
b81d457b174810 kernel/dma/coherent.c Oreoluwa Babatunde 2024-01-26 365 struct device_node *node = rmem->dev_node;
7bfa5ab6fa1b18 drivers/base/dma-coherent.c Marek Szyprowski 2014-10-13 366
b81d457b174810 kernel/dma/coherent.c Oreoluwa Babatunde 2024-01-26 367 if (of_get_property(node, "reusable", NULL))
7bfa5ab6fa1b18 drivers/base/dma-coherent.c Marek Szyprowski 2014-10-13 368 return -EINVAL;
7bfa5ab6fa1b18 drivers/base/dma-coherent.c Marek Szyprowski 2014-10-13 369
7bfa5ab6fa1b18 drivers/base/dma-coherent.c Marek Szyprowski 2014-10-13 370 #ifdef CONFIG_ARM
7bfa5ab6fa1b18 drivers/base/dma-coherent.c Marek Szyprowski 2014-10-13 @371 if (!of_get_flat_dt_prop(node, "no-map", NULL)) {
7bfa5ab6fa1b18 drivers/base/dma-coherent.c Marek Szyprowski 2014-10-13 372 pr_err("Reserved memory: regions without no-map are not yet supported\n");
7bfa5ab6fa1b18 drivers/base/dma-coherent.c Marek Szyprowski 2014-10-13 373 return -EINVAL;
7bfa5ab6fa1b18 drivers/base/dma-coherent.c Marek Szyprowski 2014-10-13 374 }
70d6aa0ecfed25 kernel/dma/coherent.c Christoph Hellwig 2021-06-24 375 #endif
93228b44c33a57 drivers/base/dma-coherent.c Vladimir Murzin 2017-06-26 376
Hi Oreoluwa,
kernel test robot noticed the following build warnings:
[auto build test WARNING on robh/for-next]
[also build test WARNING on arm64/for-next/core vgupta-arc/for-curr powerpc/next powerpc/fixes jcmvbkbc-xtensa/xtensa-for-next linus/master v6.8-rc2 next-20240129]
[cannot apply to vgupta-arc/for-next]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Oreoluwa-Babatunde/of-reserved_mem-Change-the-order-that-reserved_mem-regions-are-stored/20240127-081735
base: https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next
patch link: https://lore.kernel.org/r/20240126235425.12233-31-quic_obabatun%40quicinc.com
patch subject: [PATCH 30/46] of: reserved_mem: Add code to use unflattened DT for reserved_mem nodes
config: i386-randconfig-141-20240128 (https://download.01.org/0day-ci/archive/20240130/202401300258.xkXVxP8C-lkp@intel.com/config)
compiler: clang version 17.0.6 (https://github.com/llvm/llvm-project 6009708b4367171ccdbf4b5905cb6a803753fe18)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202401300258.xkXVxP8C-lkp@intel.com/
smatch warnings:
drivers/of/of_reserved_mem.c:111 dt_scan_reserved_mem_reg_nodes() warn: unsigned 'node' is never less than zero.
vim +/node +111 drivers/of/of_reserved_mem.c
98
99 /*
100 * Save the reserved_mem reg nodes in the reserved_mem array
101 */
102 static void __init dt_scan_reserved_mem_reg_nodes(void)
103 {
104 int t_len = (dt_root_addr_cells + dt_root_size_cells) * sizeof(__be32);
105 struct device_node *node, *child;
106 phys_addr_t base, size;
107 const __be32 *prop;
108 int len;
109
110 node = of_find_node_by_path("/reserved-memory");
> 111 if (node < 0) {
112 pr_err("Reserved memory: Did not find reserved-memory node\n");
113 return;
114 }
115
116 for_each_child_of_node(node, child) {
117 const char *uname;
118 struct reserved_mem *rmem;
119
120 if (!of_device_is_available(child))
121 continue;
122
123 prop = of_get_property(child, "reg", &len);
124 if (!prop) {
125 rmem = of_reserved_mem_lookup(child);
126 if (rmem)
127 rmem->dev_node = child;
128 continue;
129 }
130
131 uname = of_node_full_name(child);
132 if (len && len % t_len != 0) {
133 pr_err("Reserved memory: invalid reg property in '%s', skipping node.\n",
134 uname);
135 continue;
136 }
137
138 base = dt_mem_next_cell(dt_root_addr_cells, &prop);
139 size = dt_mem_next_cell(dt_root_size_cells, &prop);
140
141 if (size)
142 fdt_reserved_mem_save_node(child, uname, base, size);
143 }
144 }
145
Hi Oreoluwa,
kernel test robot noticed the following build warnings:
[auto build test WARNING on robh/for-next]
[also build test WARNING on arm64/for-next/core vgupta-arc/for-curr powerpc/next powerpc/fixes jcmvbkbc-xtensa/xtensa-for-next linus/master v6.8-rc2 next-20240131]
[cannot apply to vgupta-arc/for-next]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Oreoluwa-Babatunde/of-reserved_mem-Change-the-order-that-reserved_mem-regions-are-stored/20240127-081735
base: https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next
patch link: https://lore.kernel.org/r/20240126235425.12233-31-quic_obabatun%40quicinc.com
patch subject: [PATCH 30/46] of: reserved_mem: Add code to use unflattened DT for reserved_mem nodes
config: i386-randconfig-141-20240128 (https://download.01.org/0day-ci/archive/20240201/202402010140.VrsPYn0W-lkp@intel.com/config)
compiler: clang version 17.0.6 (https://github.com/llvm/llvm-project 6009708b4367171ccdbf4b5905cb6a803753fe18)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202402010140.VrsPYn0W-lkp@intel.com/
smatch warnings:
drivers/of/of_reserved_mem.c:111 dt_scan_reserved_mem_reg_nodes() warn: unsigned 'node' is never less than zero.
vim +/node +111 drivers/of/of_reserved_mem.c
98
99 /*
100 * Save the reserved_mem reg nodes in the reserved_mem array
101 */
102 static void __init dt_scan_reserved_mem_reg_nodes(void)
103 {
104 int t_len = (dt_root_addr_cells + dt_root_size_cells) * sizeof(__be32);
105 struct device_node *node, *child;
106 phys_addr_t base, size;
107 const __be32 *prop;
108 int len;
109
110 node = of_find_node_by_path("/reserved-memory");
> 111 if (node < 0) {
112 pr_err("Reserved memory: Did not find reserved-memory node\n");
113 return;
114 }
115
116 for_each_child_of_node(node, child) {
117 const char *uname;
118 struct reserved_mem *rmem;
119
120 if (!of_device_is_available(child))
121 continue;
122
123 prop = of_get_property(child, "reg", &len);
124 if (!prop) {
125 rmem = of_reserved_mem_lookup(child);
126 if (rmem)
127 rmem->dev_node = child;
128 continue;
129 }
130
131 uname = of_node_full_name(child);
132 if (len && len % t_len != 0) {
133 pr_err("Reserved memory: invalid reg property in '%s', skipping node.\n",
134 uname);
135 continue;
136 }
137
138 base = dt_mem_next_cell(dt_root_addr_cells, &prop);
139 size = dt_mem_next_cell(dt_root_size_cells, &prop);
140
141 if (size)
142 fdt_reserved_mem_save_node(child, uname, base, size);
143 }
144 }
145
diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c index ebd2fa9e0114..2bc01ffdabfe 100644 --- a/drivers/of/fdt.c +++ b/drivers/of/fdt.c @@ -558,55 +558,6 @@ static int __init __reserved_mem_check_root(unsigned long node) return 0; } -/* - * Save the reserved_mem reg nodes in the reserved_mem array - */ -void __init fdt_scan_reserved_mem_reg_nodes(void) - -{ - int t_len = (dt_root_addr_cells + dt_root_size_cells) * sizeof(__be32); - const void *fdt = initial_boot_params; - phys_addr_t base, size; - const __be32 *prop; - int node, child; - int len; - - node = fdt_path_offset(fdt, "/reserved-memory"); - if (node < 0) { - pr_err("Reserved memory: Did not find reserved-memory node\n"); - return; - } - - if (__reserved_mem_check_root(node) != 0) { - pr_err("Reserved memory: unsupported node format, ignoring\n"); - return; - } - - fdt_for_each_subnode(child, fdt, node) { - const char *uname; - - prop = of_get_flat_dt_prop(child, "reg", &len); - if (!prop) - continue; - - if (!of_fdt_device_is_available(fdt, child)) - continue; - - uname = fdt_get_name(fdt, child, NULL); - if (len && len % t_len != 0) { - pr_err("Reserved memory: invalid reg property in '%s', skipping node.\n", - uname); - continue; - } - - base = dt_mem_next_cell(dt_root_addr_cells, &prop); - size = dt_mem_next_cell(dt_root_size_cells, &prop); - - if (size) - fdt_reserved_mem_save_node(child, uname, base, size); - } -} - /* * fdt_scan_reserved_mem() - scan a single FDT node for reserved memory. */ diff --git a/drivers/of/of_private.h b/drivers/of/of_private.h index c338e1c019c7..f7da22108e7a 100644 --- a/drivers/of/of_private.h +++ b/drivers/of/of_private.h @@ -177,7 +177,7 @@ static inline struct device_node *__of_get_dma_parent(const struct device_node * #endif void update_reserved_mem_max_cnt(int max_count); -void fdt_reserved_mem_save_node(unsigned long node, const char *uname, - phys_addr_t base, phys_addr_t size); +void fdt_reserved_mem_save_node(struct device_node *node, const char *uname, + phys_addr_t base, phys_addr_t size); #endif /* _LINUX_OF_PRIVATE_H */ diff --git a/drivers/of/of_reserved_mem.c b/drivers/of/of_reserved_mem.c index 419b062cb41f..645b02e27492 100644 --- a/drivers/of/of_reserved_mem.c +++ b/drivers/of/of_reserved_mem.c @@ -96,11 +96,58 @@ static int alloc_reserved_mem_array(void) return -1; } +/* + * Save the reserved_mem reg nodes in the reserved_mem array + */ +static void __init dt_scan_reserved_mem_reg_nodes(void) +{ + int t_len = (dt_root_addr_cells + dt_root_size_cells) * sizeof(__be32); + struct device_node *node, *child; + phys_addr_t base, size; + const __be32 *prop; + int len; + + node = of_find_node_by_path("/reserved-memory"); + if (node < 0) { + pr_err("Reserved memory: Did not find reserved-memory node\n"); + return; + } + + for_each_child_of_node(node, child) { + const char *uname; + struct reserved_mem *rmem; + + if (!of_device_is_available(child)) + continue; + + prop = of_get_property(child, "reg", &len); + if (!prop) { + rmem = of_reserved_mem_lookup(child); + if (rmem) + rmem->dev_node = child; + continue; + } + + uname = of_node_full_name(child); + if (len && len % t_len != 0) { + pr_err("Reserved memory: invalid reg property in '%s', skipping node.\n", + uname); + continue; + } + + base = dt_mem_next_cell(dt_root_addr_cells, &prop); + size = dt_mem_next_cell(dt_root_size_cells, &prop); + + if (size) + fdt_reserved_mem_save_node(child, uname, base, size); + } +} + /* * fdt_reserved_mem_save_node() - save fdt node for second pass initialization */ -void __init fdt_reserved_mem_save_node(unsigned long node, const char *uname, - phys_addr_t base, phys_addr_t size) +void __init fdt_reserved_mem_save_node(struct device_node *node, const char *uname, + phys_addr_t base, phys_addr_t size) { struct reserved_mem *rmem = &reserved_mem[reserved_mem_count]; @@ -109,7 +156,7 @@ void __init fdt_reserved_mem_save_node(unsigned long node, const char *uname, return; } - rmem->fdt_node = node; + rmem->dev_node = node; rmem->name = uname; rmem->base = base; rmem->size = size; @@ -252,7 +299,7 @@ int __init __reserved_mem_alloc_size(unsigned long node, const char *uname) uname, (unsigned long)(size / SZ_1M)); return -ENOMEM; } - fdt_reserved_mem_save_node(node, uname, base, size); + fdt_reserved_mem_save_node(NULL, uname, base, size); return 0; } @@ -272,7 +319,7 @@ static int __init __reserved_mem_init_node(struct reserved_mem *rmem) reservedmem_of_init_fn initfn = i->data; const char *compat = i->compatible; - if (!of_flat_dt_is_compatible(rmem->fdt_node, compat)) + if (!of_device_is_compatible(rmem->dev_node, compat)) continue; ret = initfn(rmem); @@ -305,11 +352,6 @@ static int __init __rmem_cmp(const void *a, const void *b) if (ra->size > rb->size) return 1; - if (ra->fdt_node < rb->fdt_node) - return -1; - if (ra->fdt_node > rb->fdt_node) - return 1; - return 0; } @@ -351,23 +393,23 @@ void __init fdt_init_reserved_mem(void) if (ret) pr_err("Failed to allocate memory for reserved_mem array with err: %d", ret); - fdt_scan_reserved_mem_reg_nodes(); + dt_scan_reserved_mem_reg_nodes(); /* check for overlapping reserved regions */ __rmem_check_for_overlap(); for (i = 0; i < reserved_mem_count; i++) { struct reserved_mem *rmem = &reserved_mem[i]; - unsigned long node = rmem->fdt_node; + struct device_node *node = rmem->dev_node; int len; const __be32 *prop; int err = 0; bool nomap; - nomap = of_get_flat_dt_prop(node, "no-map", NULL) != NULL; - prop = of_get_flat_dt_prop(node, "phandle", &len); + nomap = of_get_property(node, "no-map", NULL) != NULL; + prop = of_get_property(node, "phandle", &len); if (!prop) - prop = of_get_flat_dt_prop(node, "linux,phandle", &len); + prop = of_get_property(node, "linux,phandle", &len); if (prop) rmem->phandle = of_read_number(prop, len/4); @@ -383,7 +425,7 @@ void __init fdt_init_reserved_mem(void) } else { phys_addr_t end = rmem->base + rmem->size - 1; bool reusable = - (of_get_flat_dt_prop(node, "reusable", NULL)) != NULL; + (of_get_property(node, "reusable", NULL)) != NULL; pr_info("%pa..%pa (%lu KiB) %s %s %s\n", &rmem->base, &end, (unsigned long)(rmem->size / SZ_1K), diff --git a/include/linux/of_fdt.h b/include/linux/of_fdt.h index 9b85bbc5d9f5..fb7b437141bd 100644 --- a/include/linux/of_fdt.h +++ b/include/linux/of_fdt.h @@ -73,7 +73,6 @@ extern int early_init_dt_scan_root(void); extern bool early_init_dt_scan(void *params); extern bool early_init_dt_verify(void *params); extern void early_init_dt_scan_nodes(void); -extern void fdt_scan_reserved_mem_reg_nodes(void); extern const char *of_flat_dt_get_machine_name(void); extern const void *of_flat_dt_match_machine(const void *default_match, diff --git a/include/linux/of_reserved_mem.h b/include/linux/of_reserved_mem.h index 2a3178920bae..e92babd669c2 100644 --- a/include/linux/of_reserved_mem.h +++ b/include/linux/of_reserved_mem.h @@ -10,7 +10,7 @@ struct reserved_mem_ops; struct reserved_mem { const char *name; - unsigned long fdt_node; + struct device_node *dev_node; unsigned long phandle; const struct reserved_mem_ops *ops; phys_addr_t base; diff --git a/kernel/dma/coherent.c b/kernel/dma/coherent.c index ff5683a57f77..5ab26fe11c29 100644 --- a/kernel/dma/coherent.c +++ b/kernel/dma/coherent.c @@ -362,9 +362,9 @@ static const struct reserved_mem_ops rmem_dma_ops = { static int __init rmem_dma_setup(struct reserved_mem *rmem) { - unsigned long node = rmem->fdt_node; + struct device_node *node = rmem->dev_node; - if (of_get_flat_dt_prop(node, "reusable", NULL)) + if (of_get_property(node, "reusable", NULL)) return -EINVAL; #ifdef CONFIG_ARM diff --git a/kernel/dma/contiguous.c b/kernel/dma/contiguous.c index f005c66f378c..b54cf128a9d9 100644 --- a/kernel/dma/contiguous.c +++ b/kernel/dma/contiguous.c @@ -462,8 +462,8 @@ static const struct reserved_mem_ops rmem_cma_ops = { static int __init rmem_cma_setup(struct reserved_mem *rmem) { - unsigned long node = rmem->fdt_node; - bool default_cma = of_get_flat_dt_prop(node, "linux,cma-default", NULL); + struct device_node *node = rmem->dev_node; + bool default_cma = of_get_property(node, "linux,cma-default", NULL); struct cma *cma; int err; @@ -473,8 +473,8 @@ static int __init rmem_cma_setup(struct reserved_mem *rmem) return -EBUSY; } - if (!of_get_flat_dt_prop(node, "reusable", NULL) || - of_get_flat_dt_prop(node, "no-map", NULL)) + if (!of_get_property(node, "reusable", NULL) || + of_get_property(node, "no-map", NULL)) return -EINVAL; if (!IS_ALIGNED(rmem->base | rmem->size, CMA_MIN_ALIGNMENT_BYTES)) { diff --git a/kernel/dma/swiotlb.c b/kernel/dma/swiotlb.c index b079a9a8e087..ea1f734c8c35 100644 --- a/kernel/dma/swiotlb.c +++ b/kernel/dma/swiotlb.c @@ -1732,12 +1732,12 @@ static const struct reserved_mem_ops rmem_swiotlb_ops = { static int __init rmem_swiotlb_setup(struct reserved_mem *rmem) { - unsigned long node = rmem->fdt_node; + struct device_node *node = rmem->dev_node; - if (of_get_flat_dt_prop(node, "reusable", NULL) || - of_get_flat_dt_prop(node, "linux,cma-default", NULL) || - of_get_flat_dt_prop(node, "linux,dma-default", NULL) || - of_get_flat_dt_prop(node, "no-map", NULL)) + if (of_get_property(node, "reusable", NULL) || + of_get_property(node, "linux,cma-default", NULL) || + of_get_property(node, "linux,dma-default", NULL) || + of_get_property(node, "no-map", NULL)) return -EINVAL; rmem->ops = &rmem_swiotlb_ops;
The unflattened devicetree APIs are available to be used not long after the processing is done for the reserved memory regions on some architectures, and is available even before that on other architectures. Therefore, use the unflattened devicetree APIs to process and store information for the reserved memory regions. Using the unflattened devicetree APIs is more efficient than using the flattened devicetree APIs. Signed-off-by: Oreoluwa Babatunde <quic_obabatun@quicinc.com> --- drivers/of/fdt.c | 49 ---------------------- drivers/of/of_private.h | 4 +- drivers/of/of_reserved_mem.c | 74 ++++++++++++++++++++++++++------- include/linux/of_fdt.h | 1 - include/linux/of_reserved_mem.h | 2 +- kernel/dma/coherent.c | 4 +- kernel/dma/contiguous.c | 8 ++-- kernel/dma/swiotlb.c | 10 ++--- 8 files changed, 72 insertions(+), 80 deletions(-)