From: kernel test robot <lkp@intel.com>
To: Alison Wang <alison.wang@nxp.com>,
gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org
Cc: oe-kbuild-all@lists.linux.dev, leoyang.li@nxp.com,
xuelin.shi@nxp.com, xiaofeng.ren@nxp.com, feng.guo@nxp.com,
Alison Wang <alison.wang@nxp.com>
Subject: Re: [PATCH 1/8] ethosu: Add Arm Ethos-U driver
Date: Sat, 17 Jun 2023 01:16:10 +0800 [thread overview]
Message-ID: <202306170138.BFDQ7A7K-lkp@intel.com> (raw)
In-Reply-To: <20230616055913.2360-2-alison.wang@nxp.com>
Hi Alison,
kernel test robot noticed the following build warnings:
[auto build test WARNING on soc/for-next]
[also build test WARNING on linus/master v6.4-rc6 next-20230616]
[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/Alison-Wang/ethosu-Add-Arm-Ethos-U-driver/20230616-141036
base: https://git.kernel.org/pub/scm/linux/kernel/git/soc/soc.git for-next
patch link: https://lore.kernel.org/r/20230616055913.2360-2-alison.wang%40nxp.com
patch subject: [PATCH 1/8] ethosu: Add Arm Ethos-U driver
config: i386-allyesconfig (https://download.01.org/0day-ci/archive/20230617/202306170138.BFDQ7A7K-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce: (https://download.01.org/0day-ci/archive/20230617/202306170138.BFDQ7A7K-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/202306170138.BFDQ7A7K-lkp@intel.com/
All warnings (new ones prefixed by >>):
In file included from include/linux/printk.h:564,
from include/linux/kernel.h:30,
from arch/x86/include/asm/percpu.h:27,
from arch/x86/include/asm/preempt.h:6,
from include/linux/preempt.h:78,
from include/linux/spinlock.h:56,
from include/linux/kref.h:16,
from drivers/firmware/ethosu/ethosu_buffer.h:28,
from drivers/firmware/ethosu/ethosu_buffer.c:25:
drivers/firmware/ethosu/ethosu_buffer.c: In function 'ethosu_buffer_dma_ranges':
>> drivers/firmware/ethosu/ethosu_buffer.c:108:30: warning: format '%llx' expects argument of type 'long long unsigned int', but argument 4 has type 'dma_addr_t' {aka 'unsigned int'} [-Wformat=]
108 | dev_dbg(dev, "daddr=0x%llx, paddr=0x%llx, size=0x%llx\n",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/dynamic_debug.h:222:29: note: in definition of macro '__dynamic_func_call_cls'
222 | func(&id, ##__VA_ARGS__); \
| ^~~~~~~~~~~
include/linux/dynamic_debug.h:248:9: note: in expansion of macro '_dynamic_func_call_cls'
248 | _dynamic_func_call_cls(_DPRINTK_CLASS_DFLT, fmt, func, ##__VA_ARGS__)
| ^~~~~~~~~~~~~~~~~~~~~~
include/linux/dynamic_debug.h:271:9: note: in expansion of macro '_dynamic_func_call'
271 | _dynamic_func_call(fmt, __dynamic_dev_dbg, \
| ^~~~~~~~~~~~~~~~~~
include/linux/dev_printk.h:155:9: note: in expansion of macro 'dynamic_dev_dbg'
155 | dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
| ^~~~~~~~~~~~~~~
include/linux/dev_printk.h:155:30: note: in expansion of macro 'dev_fmt'
155 | dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
| ^~~~~~~
drivers/firmware/ethosu/ethosu_buffer.c:108:17: note: in expansion of macro 'dev_dbg'
108 | dev_dbg(dev, "daddr=0x%llx, paddr=0x%llx, size=0x%llx\n",
| ^~~~~~~
drivers/firmware/ethosu/ethosu_buffer.c:108:42: note: format string is defined here
108 | dev_dbg(dev, "daddr=0x%llx, paddr=0x%llx, size=0x%llx\n",
| ~~~^
| |
| long long unsigned int
| %x
drivers/firmware/ethosu/ethosu_buffer.c:108:30: warning: format '%llx' expects argument of type 'long long unsigned int', but argument 5 has type 'dma_addr_t' {aka 'unsigned int'} [-Wformat=]
108 | dev_dbg(dev, "daddr=0x%llx, paddr=0x%llx, size=0x%llx\n",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/dynamic_debug.h:222:29: note: in definition of macro '__dynamic_func_call_cls'
222 | func(&id, ##__VA_ARGS__); \
| ^~~~~~~~~~~
include/linux/dynamic_debug.h:248:9: note: in expansion of macro '_dynamic_func_call_cls'
248 | _dynamic_func_call_cls(_DPRINTK_CLASS_DFLT, fmt, func, ##__VA_ARGS__)
| ^~~~~~~~~~~~~~~~~~~~~~
include/linux/dynamic_debug.h:271:9: note: in expansion of macro '_dynamic_func_call'
271 | _dynamic_func_call(fmt, __dynamic_dev_dbg, \
| ^~~~~~~~~~~~~~~~~~
include/linux/dev_printk.h:155:9: note: in expansion of macro 'dynamic_dev_dbg'
155 | dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
| ^~~~~~~~~~~~~~~
include/linux/dev_printk.h:155:30: note: in expansion of macro 'dev_fmt'
155 | dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
| ^~~~~~~
drivers/firmware/ethosu/ethosu_buffer.c:108:17: note: in expansion of macro 'dev_dbg'
108 | dev_dbg(dev, "daddr=0x%llx, paddr=0x%llx, size=0x%llx\n",
| ^~~~~~~
drivers/firmware/ethosu/ethosu_buffer.c:108:56: note: format string is defined here
108 | dev_dbg(dev, "daddr=0x%llx, paddr=0x%llx, size=0x%llx\n",
| ~~~^
| |
| long long unsigned int
| %x
drivers/firmware/ethosu/ethosu_buffer.c:108:30: warning: format '%llx' expects argument of type 'long long unsigned int', but argument 6 has type 'dma_addr_t' {aka 'unsigned int'} [-Wformat=]
108 | dev_dbg(dev, "daddr=0x%llx, paddr=0x%llx, size=0x%llx\n",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/dynamic_debug.h:222:29: note: in definition of macro '__dynamic_func_call_cls'
222 | func(&id, ##__VA_ARGS__); \
| ^~~~~~~~~~~
include/linux/dynamic_debug.h:248:9: note: in expansion of macro '_dynamic_func_call_cls'
248 | _dynamic_func_call_cls(_DPRINTK_CLASS_DFLT, fmt, func, ##__VA_ARGS__)
| ^~~~~~~~~~~~~~~~~~~~~~
include/linux/dynamic_debug.h:271:9: note: in expansion of macro '_dynamic_func_call'
271 | _dynamic_func_call(fmt, __dynamic_dev_dbg, \
| ^~~~~~~~~~~~~~~~~~
include/linux/dev_printk.h:155:9: note: in expansion of macro 'dynamic_dev_dbg'
155 | dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
| ^~~~~~~~~~~~~~~
include/linux/dev_printk.h:155:30: note: in expansion of macro 'dev_fmt'
155 | dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
| ^~~~~~~
drivers/firmware/ethosu/ethosu_buffer.c:108:17: note: in expansion of macro 'dev_dbg'
108 | dev_dbg(dev, "daddr=0x%llx, paddr=0x%llx, size=0x%llx\n",
| ^~~~~~~
drivers/firmware/ethosu/ethosu_buffer.c:108:69: note: format string is defined here
108 | dev_dbg(dev, "daddr=0x%llx, paddr=0x%llx, size=0x%llx\n",
| ~~~^
| |
| long long unsigned int
| %x
In file included from include/linux/device.h:15,
from include/linux/mailbox_client.h:11,
from drivers/firmware/ethosu/ethosu_mailbox.h:30,
from drivers/firmware/ethosu/ethosu_device.h:29,
from drivers/firmware/ethosu/ethosu_buffer.c:27:
drivers/firmware/ethosu/ethosu_buffer.c: In function 'ethosu_buffer_create':
drivers/firmware/ethosu/ethosu_buffer.c:253:18: warning: format '%llx' expects argument of type 'long long unsigned int', but argument 6 has type 'dma_addr_t' {aka 'unsigned int'} [-Wformat=]
253 | "Buffer create. handle=0x%pK, capacity=%zu, cpu_addr=0x%pK, dma_addr=0x%llx, dma_addr_orig=0x%llx, phys_addr=0x%llx\n",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/dev_printk.h:110:30: note: in definition of macro 'dev_printk_index_wrap'
110 | _p_func(dev, fmt, ##__VA_ARGS__); \
| ^~~
include/linux/dev_printk.h:150:58: note: in expansion of macro 'dev_fmt'
150 | dev_printk_index_wrap(_dev_info, KERN_INFO, dev, dev_fmt(fmt), ##__VA_ARGS__)
| ^~~~~~~
drivers/firmware/ethosu/ethosu_buffer.c:252:9: note: in expansion of macro 'dev_info'
252 | dev_info(buf->edev->dev,
| ^~~~~~~~
drivers/firmware/ethosu/ethosu_buffer.c:253:92: note: format string is defined here
253 | "Buffer create. handle=0x%pK, capacity=%zu, cpu_addr=0x%pK, dma_addr=0x%llx, dma_addr_orig=0x%llx, phys_addr=0x%llx\n",
| ~~~^
| |
| long long unsigned int
| %x
drivers/firmware/ethosu/ethosu_buffer.c:253:18: warning: format '%llx' expects argument of type 'long long unsigned int', but argument 7 has type 'dma_addr_t' {aka 'unsigned int'} [-Wformat=]
253 | "Buffer create. handle=0x%pK, capacity=%zu, cpu_addr=0x%pK, dma_addr=0x%llx, dma_addr_orig=0x%llx, phys_addr=0x%llx\n",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/dev_printk.h:110:30: note: in definition of macro 'dev_printk_index_wrap'
110 | _p_func(dev, fmt, ##__VA_ARGS__); \
| ^~~
include/linux/dev_printk.h:150:58: note: in expansion of macro 'dev_fmt'
150 | dev_printk_index_wrap(_dev_info, KERN_INFO, dev, dev_fmt(fmt), ##__VA_ARGS__)
| ^~~~~~~
drivers/firmware/ethosu/ethosu_buffer.c:252:9: note: in expansion of macro 'dev_info'
252 | dev_info(buf->edev->dev,
| ^~~~~~~~
drivers/firmware/ethosu/ethosu_buffer.c:253:114: note: format string is defined here
253 | "Buffer create. handle=0x%pK, capacity=%zu, cpu_addr=0x%pK, dma_addr=0x%llx, dma_addr_orig=0x%llx, phys_addr=0x%llx\n",
| ~~~^
| |
| long long unsigned int
| %x
>> drivers/firmware/ethosu/ethosu_buffer.c:253:18: warning: format '%llx' expects argument of type 'long long unsigned int', but argument 8 has type 'phys_addr_t' {aka 'unsigned int'} [-Wformat=]
253 | "Buffer create. handle=0x%pK, capacity=%zu, cpu_addr=0x%pK, dma_addr=0x%llx, dma_addr_orig=0x%llx, phys_addr=0x%llx\n",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/dev_printk.h:110:30: note: in definition of macro 'dev_printk_index_wrap'
110 | _p_func(dev, fmt, ##__VA_ARGS__); \
| ^~~
include/linux/dev_printk.h:150:58: note: in expansion of macro 'dev_fmt'
150 | dev_printk_index_wrap(_dev_info, KERN_INFO, dev, dev_fmt(fmt), ##__VA_ARGS__)
| ^~~~~~~
drivers/firmware/ethosu/ethosu_buffer.c:252:9: note: in expansion of macro 'dev_info'
252 | dev_info(buf->edev->dev,
| ^~~~~~~~
drivers/firmware/ethosu/ethosu_buffer.c:253:132: note: format string is defined here
253 | "Buffer create. handle=0x%pK, capacity=%zu, cpu_addr=0x%pK, dma_addr=0x%llx, dma_addr_orig=0x%llx, phys_addr=0x%llx\n",
| ~~~^
| |
| long long unsigned int
| %x
vim +108 drivers/firmware/ethosu/ethosu_buffer.c
59
60 /****************************************************************************
61 * Functions
62 ****************************************************************************/
63
64 /*
65 * The 'dma-ranges' device tree property for shared dma memory does not seem
66 * to be fully supported for coherent memory. Therefor we apply the DMA range
67 * offset ourselves.
68 */
69 static dma_addr_t ethosu_buffer_dma_ranges(struct device *dev,
70 dma_addr_t dma_addr,
71 size_t dma_buf_size)
72 {
73 struct device_node *node = dev->of_node;
74 const __be32 *ranges;
75 int len;
76 int naddr;
77 int nsize;
78 int inc;
79 int i;
80
81 if (!node)
82 return dma_addr;
83
84 /* Get the #address-cells and #size-cells properties */
85 naddr = of_n_addr_cells(node);
86 nsize = of_n_size_cells(node);
87
88 /* Read the 'dma-ranges' property */
89 ranges = of_get_property(node, "dma-ranges", &len);
90 if (!ranges || len <= 0)
91 return dma_addr;
92
93 dev_dbg(dev, "ranges=%p, len=%d, naddr=%d, nsize=%d\n",
94 ranges, len, naddr, nsize);
95
96 len /= sizeof(*ranges);
97 inc = naddr + naddr + nsize;
98
99 for (i = 0; (i + inc) <= len; i += inc) {
100 dma_addr_t daddr;
101 dma_addr_t paddr;
102 dma_addr_t size;
103
104 daddr = of_read_number(&ranges[i], naddr);
105 paddr = of_read_number(&ranges[i + naddr], naddr);
106 size = of_read_number(&ranges[i + naddr + naddr], nsize);
107
> 108 dev_dbg(dev, "daddr=0x%llx, paddr=0x%llx, size=0x%llx\n",
109 daddr, paddr, size);
110
111 if (dma_addr >= paddr &&
112 (dma_addr + dma_buf_size) < (paddr + size))
113 return dma_addr + daddr - paddr;
114 }
115
116 return dma_addr;
117 }
118
119 static bool ethosu_buffer_verify(struct file *file)
120 {
121 return file->f_op == ðosu_buffer_fops;
122 }
123
124 static void ethosu_buffer_destroy(struct kref *kref)
125 {
126 struct ethosu_buffer *buf =
127 container_of(kref, struct ethosu_buffer, kref);
128
129 dev_info(buf->edev->dev, "Buffer destroy. handle=0x%pK\n", buf);
130
131 dma_free_coherent(buf->edev->dev, buf->capacity, buf->cpu_addr,
132 buf->dma_addr_orig);
133 devm_kfree(buf->edev->dev, buf);
134 }
135
136 static int ethosu_buffer_release(struct inode *inode,
137 struct file *file)
138 {
139 struct ethosu_buffer *buf = file->private_data;
140
141 dev_info(buf->edev->dev, "Buffer release. handle=0x%pK\n", buf);
142
143 ethosu_buffer_put(buf);
144
145 return 0;
146 }
147
148 static int ethosu_buffer_mmap(struct file *file,
149 struct vm_area_struct *vma)
150 {
151 struct ethosu_buffer *buf = file->private_data;
152 int ret;
153
154 dev_info(buf->edev->dev, "Buffer mmap. handle=0x%pK\n", buf);
155
156 ret = dma_mmap_coherent(buf->edev->dev, vma, buf->cpu_addr,
157 buf->dma_addr_orig,
158 buf->capacity);
159
160 return ret;
161 }
162
163 static long ethosu_buffer_ioctl(struct file *file,
164 unsigned int cmd,
165 unsigned long arg)
166 {
167 struct ethosu_buffer *buf = file->private_data;
168 void __user *udata = (void __user *)arg;
169 int ret = -EINVAL;
170
171 ret = mutex_lock_interruptible(&buf->edev->mutex);
172 if (ret)
173 return ret;
174
175 dev_info(buf->edev->dev, "Ioctl. cmd=%u, arg=%lu\n", cmd, arg);
176
177 switch (cmd) {
178 case ETHOSU_IOCTL_BUFFER_SET: {
179 struct ethosu_uapi_buffer uapi;
180
181 if (copy_from_user(&uapi, udata, sizeof(uapi)))
182 break;
183
184 dev_info(buf->edev->dev,
185 "Ioctl: Buffer set. size=%u, offset=%u\n",
186 uapi.size, uapi.offset);
187
188 ret = ethosu_buffer_resize(buf, uapi.size, uapi.offset);
189 break;
190 }
191 case ETHOSU_IOCTL_BUFFER_GET: {
192 struct ethosu_uapi_buffer uapi;
193
194 uapi.size = buf->size;
195 uapi.offset = buf->offset;
196
197 dev_info(buf->edev->dev,
198 "Ioctl: Buffer get. size=%u, offset=%u\n",
199 uapi.size, uapi.offset);
200
201 if (copy_to_user(udata, &uapi, sizeof(uapi)))
202 break;
203
204 ret = 0;
205 break;
206 }
207 default: {
208 dev_err(buf->edev->dev, "Invalid ioctl. cmd=%u, arg=%lu",
209 cmd, arg);
210 break;
211 }
212 }
213
214 mutex_unlock(&buf->edev->mutex);
215
216 return ret;
217 }
218
219 int ethosu_buffer_create(struct ethosu_device *edev,
220 size_t capacity)
221 {
222 struct ethosu_buffer *buf;
223 int ret = -ENOMEM;
224
225 buf = devm_kzalloc(edev->dev, sizeof(*buf), GFP_KERNEL);
226 if (!buf)
227 return -ENOMEM;
228
229 buf->edev = edev;
230 buf->capacity = capacity;
231 buf->offset = 0;
232 buf->size = 0;
233 kref_init(&buf->kref);
234
235 buf->cpu_addr = dma_alloc_coherent(buf->edev->dev, capacity,
236 &buf->dma_addr_orig, GFP_KERNEL);
237 if (!buf->cpu_addr)
238 goto free_buf;
239
240 buf->dma_addr = ethosu_buffer_dma_ranges(buf->edev->dev,
241 buf->dma_addr_orig,
242 buf->capacity);
243
244 ret = anon_inode_getfd("ethosu-buffer", ðosu_buffer_fops, buf,
245 O_RDWR | O_CLOEXEC);
246 if (ret < 0)
247 goto free_dma;
248
249 buf->file = fget(ret);
250 fput(buf->file);
251
252 dev_info(buf->edev->dev,
> 253 "Buffer create. handle=0x%pK, capacity=%zu, cpu_addr=0x%pK, dma_addr=0x%llx, dma_addr_orig=0x%llx, phys_addr=0x%llx\n",
254 buf, capacity, buf->cpu_addr, buf->dma_addr,
255 buf->dma_addr_orig, virt_to_phys(buf->cpu_addr));
256
257 return ret;
258
259 free_dma:
260 dma_free_coherent(buf->edev->dev, buf->capacity, buf->cpu_addr,
261 buf->dma_addr_orig);
262
263 free_buf:
264 devm_kfree(buf->edev->dev, buf);
265
266 return ret;
267 }
268
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
WARNING: multiple messages have this Message-ID (diff)
From: kernel test robot <lkp@intel.com>
To: Alison Wang <alison.wang@nxp.com>,
gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org
Cc: oe-kbuild-all@lists.linux.dev, leoyang.li@nxp.com,
xuelin.shi@nxp.com, xiaofeng.ren@nxp.com, feng.guo@nxp.com,
Alison Wang <alison.wang@nxp.com>
Subject: Re: [PATCH 1/8] ethosu: Add Arm Ethos-U driver
Date: Sat, 17 Jun 2023 01:16:10 +0800 [thread overview]
Message-ID: <202306170138.BFDQ7A7K-lkp@intel.com> (raw)
In-Reply-To: <20230616055913.2360-2-alison.wang@nxp.com>
Hi Alison,
kernel test robot noticed the following build warnings:
[auto build test WARNING on soc/for-next]
[also build test WARNING on linus/master v6.4-rc6 next-20230616]
[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/Alison-Wang/ethosu-Add-Arm-Ethos-U-driver/20230616-141036
base: https://git.kernel.org/pub/scm/linux/kernel/git/soc/soc.git for-next
patch link: https://lore.kernel.org/r/20230616055913.2360-2-alison.wang%40nxp.com
patch subject: [PATCH 1/8] ethosu: Add Arm Ethos-U driver
config: i386-allyesconfig (https://download.01.org/0day-ci/archive/20230617/202306170138.BFDQ7A7K-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce: (https://download.01.org/0day-ci/archive/20230617/202306170138.BFDQ7A7K-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/202306170138.BFDQ7A7K-lkp@intel.com/
All warnings (new ones prefixed by >>):
In file included from include/linux/printk.h:564,
from include/linux/kernel.h:30,
from arch/x86/include/asm/percpu.h:27,
from arch/x86/include/asm/preempt.h:6,
from include/linux/preempt.h:78,
from include/linux/spinlock.h:56,
from include/linux/kref.h:16,
from drivers/firmware/ethosu/ethosu_buffer.h:28,
from drivers/firmware/ethosu/ethosu_buffer.c:25:
drivers/firmware/ethosu/ethosu_buffer.c: In function 'ethosu_buffer_dma_ranges':
>> drivers/firmware/ethosu/ethosu_buffer.c:108:30: warning: format '%llx' expects argument of type 'long long unsigned int', but argument 4 has type 'dma_addr_t' {aka 'unsigned int'} [-Wformat=]
108 | dev_dbg(dev, "daddr=0x%llx, paddr=0x%llx, size=0x%llx\n",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/dynamic_debug.h:222:29: note: in definition of macro '__dynamic_func_call_cls'
222 | func(&id, ##__VA_ARGS__); \
| ^~~~~~~~~~~
include/linux/dynamic_debug.h:248:9: note: in expansion of macro '_dynamic_func_call_cls'
248 | _dynamic_func_call_cls(_DPRINTK_CLASS_DFLT, fmt, func, ##__VA_ARGS__)
| ^~~~~~~~~~~~~~~~~~~~~~
include/linux/dynamic_debug.h:271:9: note: in expansion of macro '_dynamic_func_call'
271 | _dynamic_func_call(fmt, __dynamic_dev_dbg, \
| ^~~~~~~~~~~~~~~~~~
include/linux/dev_printk.h:155:9: note: in expansion of macro 'dynamic_dev_dbg'
155 | dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
| ^~~~~~~~~~~~~~~
include/linux/dev_printk.h:155:30: note: in expansion of macro 'dev_fmt'
155 | dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
| ^~~~~~~
drivers/firmware/ethosu/ethosu_buffer.c:108:17: note: in expansion of macro 'dev_dbg'
108 | dev_dbg(dev, "daddr=0x%llx, paddr=0x%llx, size=0x%llx\n",
| ^~~~~~~
drivers/firmware/ethosu/ethosu_buffer.c:108:42: note: format string is defined here
108 | dev_dbg(dev, "daddr=0x%llx, paddr=0x%llx, size=0x%llx\n",
| ~~~^
| |
| long long unsigned int
| %x
drivers/firmware/ethosu/ethosu_buffer.c:108:30: warning: format '%llx' expects argument of type 'long long unsigned int', but argument 5 has type 'dma_addr_t' {aka 'unsigned int'} [-Wformat=]
108 | dev_dbg(dev, "daddr=0x%llx, paddr=0x%llx, size=0x%llx\n",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/dynamic_debug.h:222:29: note: in definition of macro '__dynamic_func_call_cls'
222 | func(&id, ##__VA_ARGS__); \
| ^~~~~~~~~~~
include/linux/dynamic_debug.h:248:9: note: in expansion of macro '_dynamic_func_call_cls'
248 | _dynamic_func_call_cls(_DPRINTK_CLASS_DFLT, fmt, func, ##__VA_ARGS__)
| ^~~~~~~~~~~~~~~~~~~~~~
include/linux/dynamic_debug.h:271:9: note: in expansion of macro '_dynamic_func_call'
271 | _dynamic_func_call(fmt, __dynamic_dev_dbg, \
| ^~~~~~~~~~~~~~~~~~
include/linux/dev_printk.h:155:9: note: in expansion of macro 'dynamic_dev_dbg'
155 | dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
| ^~~~~~~~~~~~~~~
include/linux/dev_printk.h:155:30: note: in expansion of macro 'dev_fmt'
155 | dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
| ^~~~~~~
drivers/firmware/ethosu/ethosu_buffer.c:108:17: note: in expansion of macro 'dev_dbg'
108 | dev_dbg(dev, "daddr=0x%llx, paddr=0x%llx, size=0x%llx\n",
| ^~~~~~~
drivers/firmware/ethosu/ethosu_buffer.c:108:56: note: format string is defined here
108 | dev_dbg(dev, "daddr=0x%llx, paddr=0x%llx, size=0x%llx\n",
| ~~~^
| |
| long long unsigned int
| %x
drivers/firmware/ethosu/ethosu_buffer.c:108:30: warning: format '%llx' expects argument of type 'long long unsigned int', but argument 6 has type 'dma_addr_t' {aka 'unsigned int'} [-Wformat=]
108 | dev_dbg(dev, "daddr=0x%llx, paddr=0x%llx, size=0x%llx\n",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/dynamic_debug.h:222:29: note: in definition of macro '__dynamic_func_call_cls'
222 | func(&id, ##__VA_ARGS__); \
| ^~~~~~~~~~~
include/linux/dynamic_debug.h:248:9: note: in expansion of macro '_dynamic_func_call_cls'
248 | _dynamic_func_call_cls(_DPRINTK_CLASS_DFLT, fmt, func, ##__VA_ARGS__)
| ^~~~~~~~~~~~~~~~~~~~~~
include/linux/dynamic_debug.h:271:9: note: in expansion of macro '_dynamic_func_call'
271 | _dynamic_func_call(fmt, __dynamic_dev_dbg, \
| ^~~~~~~~~~~~~~~~~~
include/linux/dev_printk.h:155:9: note: in expansion of macro 'dynamic_dev_dbg'
155 | dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
| ^~~~~~~~~~~~~~~
include/linux/dev_printk.h:155:30: note: in expansion of macro 'dev_fmt'
155 | dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
| ^~~~~~~
drivers/firmware/ethosu/ethosu_buffer.c:108:17: note: in expansion of macro 'dev_dbg'
108 | dev_dbg(dev, "daddr=0x%llx, paddr=0x%llx, size=0x%llx\n",
| ^~~~~~~
drivers/firmware/ethosu/ethosu_buffer.c:108:69: note: format string is defined here
108 | dev_dbg(dev, "daddr=0x%llx, paddr=0x%llx, size=0x%llx\n",
| ~~~^
| |
| long long unsigned int
| %x
In file included from include/linux/device.h:15,
from include/linux/mailbox_client.h:11,
from drivers/firmware/ethosu/ethosu_mailbox.h:30,
from drivers/firmware/ethosu/ethosu_device.h:29,
from drivers/firmware/ethosu/ethosu_buffer.c:27:
drivers/firmware/ethosu/ethosu_buffer.c: In function 'ethosu_buffer_create':
drivers/firmware/ethosu/ethosu_buffer.c:253:18: warning: format '%llx' expects argument of type 'long long unsigned int', but argument 6 has type 'dma_addr_t' {aka 'unsigned int'} [-Wformat=]
253 | "Buffer create. handle=0x%pK, capacity=%zu, cpu_addr=0x%pK, dma_addr=0x%llx, dma_addr_orig=0x%llx, phys_addr=0x%llx\n",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/dev_printk.h:110:30: note: in definition of macro 'dev_printk_index_wrap'
110 | _p_func(dev, fmt, ##__VA_ARGS__); \
| ^~~
include/linux/dev_printk.h:150:58: note: in expansion of macro 'dev_fmt'
150 | dev_printk_index_wrap(_dev_info, KERN_INFO, dev, dev_fmt(fmt), ##__VA_ARGS__)
| ^~~~~~~
drivers/firmware/ethosu/ethosu_buffer.c:252:9: note: in expansion of macro 'dev_info'
252 | dev_info(buf->edev->dev,
| ^~~~~~~~
drivers/firmware/ethosu/ethosu_buffer.c:253:92: note: format string is defined here
253 | "Buffer create. handle=0x%pK, capacity=%zu, cpu_addr=0x%pK, dma_addr=0x%llx, dma_addr_orig=0x%llx, phys_addr=0x%llx\n",
| ~~~^
| |
| long long unsigned int
| %x
drivers/firmware/ethosu/ethosu_buffer.c:253:18: warning: format '%llx' expects argument of type 'long long unsigned int', but argument 7 has type 'dma_addr_t' {aka 'unsigned int'} [-Wformat=]
253 | "Buffer create. handle=0x%pK, capacity=%zu, cpu_addr=0x%pK, dma_addr=0x%llx, dma_addr_orig=0x%llx, phys_addr=0x%llx\n",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/dev_printk.h:110:30: note: in definition of macro 'dev_printk_index_wrap'
110 | _p_func(dev, fmt, ##__VA_ARGS__); \
| ^~~
include/linux/dev_printk.h:150:58: note: in expansion of macro 'dev_fmt'
150 | dev_printk_index_wrap(_dev_info, KERN_INFO, dev, dev_fmt(fmt), ##__VA_ARGS__)
| ^~~~~~~
drivers/firmware/ethosu/ethosu_buffer.c:252:9: note: in expansion of macro 'dev_info'
252 | dev_info(buf->edev->dev,
| ^~~~~~~~
drivers/firmware/ethosu/ethosu_buffer.c:253:114: note: format string is defined here
253 | "Buffer create. handle=0x%pK, capacity=%zu, cpu_addr=0x%pK, dma_addr=0x%llx, dma_addr_orig=0x%llx, phys_addr=0x%llx\n",
| ~~~^
| |
| long long unsigned int
| %x
>> drivers/firmware/ethosu/ethosu_buffer.c:253:18: warning: format '%llx' expects argument of type 'long long unsigned int', but argument 8 has type 'phys_addr_t' {aka 'unsigned int'} [-Wformat=]
253 | "Buffer create. handle=0x%pK, capacity=%zu, cpu_addr=0x%pK, dma_addr=0x%llx, dma_addr_orig=0x%llx, phys_addr=0x%llx\n",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/dev_printk.h:110:30: note: in definition of macro 'dev_printk_index_wrap'
110 | _p_func(dev, fmt, ##__VA_ARGS__); \
| ^~~
include/linux/dev_printk.h:150:58: note: in expansion of macro 'dev_fmt'
150 | dev_printk_index_wrap(_dev_info, KERN_INFO, dev, dev_fmt(fmt), ##__VA_ARGS__)
| ^~~~~~~
drivers/firmware/ethosu/ethosu_buffer.c:252:9: note: in expansion of macro 'dev_info'
252 | dev_info(buf->edev->dev,
| ^~~~~~~~
drivers/firmware/ethosu/ethosu_buffer.c:253:132: note: format string is defined here
253 | "Buffer create. handle=0x%pK, capacity=%zu, cpu_addr=0x%pK, dma_addr=0x%llx, dma_addr_orig=0x%llx, phys_addr=0x%llx\n",
| ~~~^
| |
| long long unsigned int
| %x
vim +108 drivers/firmware/ethosu/ethosu_buffer.c
59
60 /****************************************************************************
61 * Functions
62 ****************************************************************************/
63
64 /*
65 * The 'dma-ranges' device tree property for shared dma memory does not seem
66 * to be fully supported for coherent memory. Therefor we apply the DMA range
67 * offset ourselves.
68 */
69 static dma_addr_t ethosu_buffer_dma_ranges(struct device *dev,
70 dma_addr_t dma_addr,
71 size_t dma_buf_size)
72 {
73 struct device_node *node = dev->of_node;
74 const __be32 *ranges;
75 int len;
76 int naddr;
77 int nsize;
78 int inc;
79 int i;
80
81 if (!node)
82 return dma_addr;
83
84 /* Get the #address-cells and #size-cells properties */
85 naddr = of_n_addr_cells(node);
86 nsize = of_n_size_cells(node);
87
88 /* Read the 'dma-ranges' property */
89 ranges = of_get_property(node, "dma-ranges", &len);
90 if (!ranges || len <= 0)
91 return dma_addr;
92
93 dev_dbg(dev, "ranges=%p, len=%d, naddr=%d, nsize=%d\n",
94 ranges, len, naddr, nsize);
95
96 len /= sizeof(*ranges);
97 inc = naddr + naddr + nsize;
98
99 for (i = 0; (i + inc) <= len; i += inc) {
100 dma_addr_t daddr;
101 dma_addr_t paddr;
102 dma_addr_t size;
103
104 daddr = of_read_number(&ranges[i], naddr);
105 paddr = of_read_number(&ranges[i + naddr], naddr);
106 size = of_read_number(&ranges[i + naddr + naddr], nsize);
107
> 108 dev_dbg(dev, "daddr=0x%llx, paddr=0x%llx, size=0x%llx\n",
109 daddr, paddr, size);
110
111 if (dma_addr >= paddr &&
112 (dma_addr + dma_buf_size) < (paddr + size))
113 return dma_addr + daddr - paddr;
114 }
115
116 return dma_addr;
117 }
118
119 static bool ethosu_buffer_verify(struct file *file)
120 {
121 return file->f_op == ðosu_buffer_fops;
122 }
123
124 static void ethosu_buffer_destroy(struct kref *kref)
125 {
126 struct ethosu_buffer *buf =
127 container_of(kref, struct ethosu_buffer, kref);
128
129 dev_info(buf->edev->dev, "Buffer destroy. handle=0x%pK\n", buf);
130
131 dma_free_coherent(buf->edev->dev, buf->capacity, buf->cpu_addr,
132 buf->dma_addr_orig);
133 devm_kfree(buf->edev->dev, buf);
134 }
135
136 static int ethosu_buffer_release(struct inode *inode,
137 struct file *file)
138 {
139 struct ethosu_buffer *buf = file->private_data;
140
141 dev_info(buf->edev->dev, "Buffer release. handle=0x%pK\n", buf);
142
143 ethosu_buffer_put(buf);
144
145 return 0;
146 }
147
148 static int ethosu_buffer_mmap(struct file *file,
149 struct vm_area_struct *vma)
150 {
151 struct ethosu_buffer *buf = file->private_data;
152 int ret;
153
154 dev_info(buf->edev->dev, "Buffer mmap. handle=0x%pK\n", buf);
155
156 ret = dma_mmap_coherent(buf->edev->dev, vma, buf->cpu_addr,
157 buf->dma_addr_orig,
158 buf->capacity);
159
160 return ret;
161 }
162
163 static long ethosu_buffer_ioctl(struct file *file,
164 unsigned int cmd,
165 unsigned long arg)
166 {
167 struct ethosu_buffer *buf = file->private_data;
168 void __user *udata = (void __user *)arg;
169 int ret = -EINVAL;
170
171 ret = mutex_lock_interruptible(&buf->edev->mutex);
172 if (ret)
173 return ret;
174
175 dev_info(buf->edev->dev, "Ioctl. cmd=%u, arg=%lu\n", cmd, arg);
176
177 switch (cmd) {
178 case ETHOSU_IOCTL_BUFFER_SET: {
179 struct ethosu_uapi_buffer uapi;
180
181 if (copy_from_user(&uapi, udata, sizeof(uapi)))
182 break;
183
184 dev_info(buf->edev->dev,
185 "Ioctl: Buffer set. size=%u, offset=%u\n",
186 uapi.size, uapi.offset);
187
188 ret = ethosu_buffer_resize(buf, uapi.size, uapi.offset);
189 break;
190 }
191 case ETHOSU_IOCTL_BUFFER_GET: {
192 struct ethosu_uapi_buffer uapi;
193
194 uapi.size = buf->size;
195 uapi.offset = buf->offset;
196
197 dev_info(buf->edev->dev,
198 "Ioctl: Buffer get. size=%u, offset=%u\n",
199 uapi.size, uapi.offset);
200
201 if (copy_to_user(udata, &uapi, sizeof(uapi)))
202 break;
203
204 ret = 0;
205 break;
206 }
207 default: {
208 dev_err(buf->edev->dev, "Invalid ioctl. cmd=%u, arg=%lu",
209 cmd, arg);
210 break;
211 }
212 }
213
214 mutex_unlock(&buf->edev->mutex);
215
216 return ret;
217 }
218
219 int ethosu_buffer_create(struct ethosu_device *edev,
220 size_t capacity)
221 {
222 struct ethosu_buffer *buf;
223 int ret = -ENOMEM;
224
225 buf = devm_kzalloc(edev->dev, sizeof(*buf), GFP_KERNEL);
226 if (!buf)
227 return -ENOMEM;
228
229 buf->edev = edev;
230 buf->capacity = capacity;
231 buf->offset = 0;
232 buf->size = 0;
233 kref_init(&buf->kref);
234
235 buf->cpu_addr = dma_alloc_coherent(buf->edev->dev, capacity,
236 &buf->dma_addr_orig, GFP_KERNEL);
237 if (!buf->cpu_addr)
238 goto free_buf;
239
240 buf->dma_addr = ethosu_buffer_dma_ranges(buf->edev->dev,
241 buf->dma_addr_orig,
242 buf->capacity);
243
244 ret = anon_inode_getfd("ethosu-buffer", ðosu_buffer_fops, buf,
245 O_RDWR | O_CLOEXEC);
246 if (ret < 0)
247 goto free_dma;
248
249 buf->file = fget(ret);
250 fput(buf->file);
251
252 dev_info(buf->edev->dev,
> 253 "Buffer create. handle=0x%pK, capacity=%zu, cpu_addr=0x%pK, dma_addr=0x%llx, dma_addr_orig=0x%llx, phys_addr=0x%llx\n",
254 buf, capacity, buf->cpu_addr, buf->dma_addr,
255 buf->dma_addr_orig, virt_to_phys(buf->cpu_addr));
256
257 return ret;
258
259 free_dma:
260 dma_free_coherent(buf->edev->dev, buf->capacity, buf->cpu_addr,
261 buf->dma_addr_orig);
262
263 free_buf:
264 devm_kfree(buf->edev->dev, buf);
265
266 return ret;
267 }
268
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2023-06-16 17:16 UTC|newest]
Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-16 5:59 [PATCH 0/8] ethosu: Add Arm Ethos-U driver Alison Wang
2023-06-16 5:59 ` Alison Wang
2023-06-16 5:59 ` [PATCH 1/8] " Alison Wang
2023-06-16 5:59 ` Alison Wang
2023-06-16 6:25 ` Greg KH
2023-06-16 6:25 ` Greg KH
2023-06-16 8:28 ` [EXT] " Alison Wang
2023-06-16 8:28 ` Alison Wang
2023-06-16 15:08 ` Andrew Lunn
2023-06-16 15:08 ` Andrew Lunn
2023-07-06 6:01 ` Alison Wang
2023-07-06 6:01 ` Alison Wang
2023-06-16 6:26 ` Greg KH
2023-06-16 6:26 ` Greg KH
2023-06-16 8:28 ` [EXT] " Alison Wang
2023-06-16 8:28 ` Alison Wang
2023-06-16 10:42 ` kernel test robot
2023-06-16 10:42 ` kernel test robot
2023-06-16 15:49 ` Robin Murphy
2023-06-16 15:49 ` Robin Murphy
2023-06-16 17:16 ` kernel test robot [this message]
2023-06-16 17:16 ` kernel test robot
2023-06-24 18:30 ` kernel test robot
2023-06-24 18:30 ` kernel test robot
2023-06-16 5:59 ` [PATCH 2/8] ethosu: Use RPMsg messaging protocol based on i.MX Rpmsg implementation Alison Wang
2023-06-16 5:59 ` Alison Wang
2023-06-16 5:59 ` [PATCH 3/8] ethosu: Add inference type option for model and op Alison Wang
2023-06-16 5:59 ` Alison Wang
2023-06-16 5:59 ` [PATCH 4/8] ethosu: Add suspend/resume power management Alison Wang
2023-06-16 5:59 ` Alison Wang
2023-06-16 5:59 ` [PATCH 5/8] ethosu: Use ids for identifying messages sent to Ethos-U firmware Alison Wang
2023-06-16 5:59 ` Alison Wang
2023-06-16 5:59 ` [PATCH 6/8] ethosu: Add core message about network info Alison Wang
2023-06-16 5:59 ` Alison Wang
2023-06-16 5:59 ` [PATCH 7/8] ethosu: Add core message about inference cancellation Alison Wang
2023-06-16 5:59 ` Alison Wang
2023-06-16 16:13 ` kernel test robot
2023-06-16 16:13 ` kernel test robot
2023-06-16 5:59 ` [PATCH 8/8] ethosu: Add rwlock when alloc and remove msg id Alison Wang
2023-06-16 5:59 ` Alison Wang
2023-06-16 6:22 ` [PATCH 0/8] ethosu: Add Arm Ethos-U driver Greg KH
2023-06-16 6:22 ` Greg KH
2023-06-16 8:26 ` [EXT] " Alison Wang
2023-06-16 8:26 ` Alison Wang
2023-06-16 9:04 ` Greg KH
2023-06-16 9:04 ` Greg KH
2023-06-16 10:47 ` Alison Wang
2023-06-16 10:47 ` Alison Wang
2023-06-16 11:11 ` Greg KH
2023-06-16 11:11 ` Greg KH
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=202306170138.BFDQ7A7K-lkp@intel.com \
--to=lkp@intel.com \
--cc=alison.wang@nxp.com \
--cc=feng.guo@nxp.com \
--cc=gregkh@linuxfoundation.org \
--cc=leoyang.li@nxp.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=oe-kbuild-all@lists.linux.dev \
--cc=xiaofeng.ren@nxp.com \
--cc=xuelin.shi@nxp.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.