Kristofer Jonsson | 116a635 | 2020-08-20 17:25:23 +0200 | [diff] [blame] | 1 | /* |
Kristofer Jonsson | 3c6a260 | 2022-03-10 11:17:29 +0100 | [diff] [blame] | 2 | * Copyright (c) 2020,2022 Arm Limited. |
Kristofer Jonsson | 116a635 | 2020-08-20 17:25:23 +0200 | [diff] [blame] | 3 | * |
| 4 | * This program is free software and is provided to you under the terms of the |
| 5 | * GNU General Public License version 2 as published by the Free Software |
| 6 | * Foundation, and any use by you of this program is subject to the terms |
| 7 | * of such GNU licence. |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | * GNU General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU General Public License |
| 15 | * along with this program; if not, you can access it online at |
| 16 | * http://www.gnu.org/licenses/gpl-2.0.html. |
| 17 | * |
| 18 | * SPDX-License-Identifier: GPL-2.0-only |
| 19 | */ |
| 20 | |
| 21 | /**************************************************************************** |
| 22 | * Includes |
| 23 | ****************************************************************************/ |
| 24 | |
| 25 | #include "ethosu_inference.h" |
| 26 | |
| 27 | #include "ethosu_buffer.h" |
| 28 | #include "ethosu_core_interface.h" |
| 29 | #include "ethosu_device.h" |
| 30 | #include "ethosu_network.h" |
Kristofer Jonsson | 116a635 | 2020-08-20 17:25:23 +0200 | [diff] [blame] | 31 | |
| 32 | #include <linux/anon_inodes.h> |
| 33 | #include <linux/file.h> |
| 34 | #include <linux/fs.h> |
| 35 | #include <linux/poll.h> |
| 36 | |
| 37 | /**************************************************************************** |
| 38 | * Variables |
| 39 | ****************************************************************************/ |
| 40 | |
| 41 | static int ethosu_inference_release(struct inode *inode, |
| 42 | struct file *file); |
| 43 | |
| 44 | static unsigned int ethosu_inference_poll(struct file *file, |
| 45 | poll_table *wait); |
| 46 | |
| 47 | static long ethosu_inference_ioctl(struct file *file, |
| 48 | unsigned int cmd, |
| 49 | unsigned long arg); |
| 50 | |
| 51 | static const struct file_operations ethosu_inference_fops = { |
| 52 | .release = ðosu_inference_release, |
| 53 | .poll = ðosu_inference_poll, |
| 54 | .unlocked_ioctl = ðosu_inference_ioctl, |
| 55 | #ifdef CONFIG_COMPAT |
| 56 | .compat_ioctl = ðosu_inference_ioctl, |
| 57 | #endif |
| 58 | }; |
| 59 | |
| 60 | /**************************************************************************** |
| 61 | * Functions |
| 62 | ****************************************************************************/ |
| 63 | |
| 64 | static const char *status_to_string(const enum ethosu_uapi_status status) |
| 65 | { |
| 66 | switch (status) { |
| 67 | case ETHOSU_UAPI_STATUS_OK: { |
| 68 | return "Ok"; |
| 69 | } |
| 70 | case ETHOSU_UAPI_STATUS_ERROR: { |
| 71 | return "Error"; |
| 72 | } |
| 73 | default: { |
| 74 | return "Unknown"; |
| 75 | } |
| 76 | } |
| 77 | } |
| 78 | |
| 79 | static int ethosu_inference_send(struct ethosu_inference *inf) |
| 80 | { |
| 81 | int ret; |
| 82 | |
Kristofer Jonsson | 116a635 | 2020-08-20 17:25:23 +0200 | [diff] [blame] | 83 | inf->status = ETHOSU_UAPI_STATUS_ERROR; |
| 84 | |
Kristofer Jonsson | b74492c | 2020-09-10 13:26:01 +0200 | [diff] [blame] | 85 | ret = ethosu_mailbox_inference(&inf->edev->mailbox, inf, |
| 86 | inf->ifm_count, inf->ifm, |
| 87 | inf->ofm_count, inf->ofm, |
Per Åstrand | f7e407a | 2020-10-23 21:25:05 +0200 | [diff] [blame] | 88 | inf->net->buf, |
Kristofer Jonsson | 35de9e6 | 2022-03-08 13:25:45 +0100 | [diff] [blame] | 89 | inf->net->index, |
Per Åstrand | f7e407a | 2020-10-23 21:25:05 +0200 | [diff] [blame] | 90 | inf->pmu_event_config, |
| 91 | ETHOSU_PMU_EVENT_MAX, |
| 92 | inf->pmu_cycle_counter_enable); |
Kristofer Jonsson | 116a635 | 2020-08-20 17:25:23 +0200 | [diff] [blame] | 93 | if (ret) |
| 94 | return ret; |
| 95 | |
Kristofer Jonsson | 116a635 | 2020-08-20 17:25:23 +0200 | [diff] [blame] | 96 | ethosu_inference_get(inf); |
| 97 | |
| 98 | return 0; |
| 99 | } |
| 100 | |
Kristofer Jonsson | 442fefb | 2022-03-17 17:15:52 +0100 | [diff] [blame^] | 101 | static void ethosu_inference_fail(struct ethosu_mailbox_msg *msg) |
Kristofer Jonsson | 116a635 | 2020-08-20 17:25:23 +0200 | [diff] [blame] | 102 | { |
Kristofer Jonsson | 442fefb | 2022-03-17 17:15:52 +0100 | [diff] [blame^] | 103 | struct ethosu_inference *inf = |
| 104 | container_of(msg, typeof(*inf), msg); |
| 105 | int ret; |
Kristofer Jonsson | 116a635 | 2020-08-20 17:25:23 +0200 | [diff] [blame] | 106 | |
Kristofer Jonsson | 442fefb | 2022-03-17 17:15:52 +0100 | [diff] [blame^] | 107 | /* Decrement reference count if inference was pending reponse */ |
| 108 | if (!inf->done) { |
| 109 | ret = ethosu_inference_put(inf); |
| 110 | if (ret) |
| 111 | return; |
Kristofer Jonsson | 116a635 | 2020-08-20 17:25:23 +0200 | [diff] [blame] | 112 | } |
| 113 | |
Kristofer Jonsson | 442fefb | 2022-03-17 17:15:52 +0100 | [diff] [blame^] | 114 | /* Fail inference and wake up any waiting process */ |
| 115 | inf->status = ETHOSU_UAPI_STATUS_ERROR; |
| 116 | inf->done = true; |
| 117 | wake_up_interruptible(&inf->waitq); |
| 118 | } |
| 119 | |
| 120 | static int ethosu_inference_resend(struct ethosu_mailbox_msg *msg) |
| 121 | { |
| 122 | struct ethosu_inference *inf = |
| 123 | container_of(msg, typeof(*inf), msg); |
| 124 | int ret; |
| 125 | |
| 126 | /* Don't resend request if response has already been received */ |
| 127 | if (inf->done) |
| 128 | return 0; |
| 129 | |
| 130 | /* Decrement reference count for pending request */ |
| 131 | ret = ethosu_inference_put(inf); |
| 132 | if (ret) |
| 133 | return 0; |
| 134 | |
| 135 | /* Resend request */ |
| 136 | ret = ethosu_inference_send(inf); |
| 137 | if (ret) |
| 138 | return ret; |
| 139 | |
| 140 | return 0; |
Kristofer Jonsson | 116a635 | 2020-08-20 17:25:23 +0200 | [diff] [blame] | 141 | } |
| 142 | |
| 143 | static bool ethosu_inference_verify(struct file *file) |
| 144 | { |
| 145 | return file->f_op == ðosu_inference_fops; |
| 146 | } |
| 147 | |
| 148 | static void ethosu_inference_kref_destroy(struct kref *kref) |
| 149 | { |
| 150 | struct ethosu_inference *inf = |
| 151 | container_of(kref, struct ethosu_inference, kref); |
| 152 | |
| 153 | dev_info(inf->edev->dev, |
| 154 | "Inference destroy. handle=0x%pK, status=%d\n", |
| 155 | inf, inf->status); |
| 156 | |
Kristofer Jonsson | 442fefb | 2022-03-17 17:15:52 +0100 | [diff] [blame^] | 157 | list_del(&inf->msg.list); |
Kristofer Jonsson | b74492c | 2020-09-10 13:26:01 +0200 | [diff] [blame] | 158 | |
| 159 | while (inf->ifm_count-- > 0) |
| 160 | ethosu_buffer_put(inf->ifm[inf->ifm_count]); |
| 161 | |
| 162 | while (inf->ofm_count-- > 0) |
| 163 | ethosu_buffer_put(inf->ofm[inf->ofm_count]); |
| 164 | |
Kristofer Jonsson | 116a635 | 2020-08-20 17:25:23 +0200 | [diff] [blame] | 165 | ethosu_network_put(inf->net); |
| 166 | devm_kfree(inf->edev->dev, inf); |
| 167 | } |
| 168 | |
| 169 | static int ethosu_inference_release(struct inode *inode, |
| 170 | struct file *file) |
| 171 | { |
| 172 | struct ethosu_inference *inf = file->private_data; |
| 173 | |
| 174 | dev_info(inf->edev->dev, |
| 175 | "Inference release. handle=0x%pK, status=%d\n", |
| 176 | inf, inf->status); |
| 177 | |
| 178 | ethosu_inference_put(inf); |
| 179 | |
| 180 | return 0; |
| 181 | } |
| 182 | |
| 183 | static unsigned int ethosu_inference_poll(struct file *file, |
| 184 | poll_table *wait) |
| 185 | { |
| 186 | struct ethosu_inference *inf = file->private_data; |
| 187 | int ret = 0; |
| 188 | |
| 189 | poll_wait(file, &inf->waitq, wait); |
| 190 | |
Kristofer Jonsson | 442fefb | 2022-03-17 17:15:52 +0100 | [diff] [blame^] | 191 | if (inf->done) |
Kristofer Jonsson | 116a635 | 2020-08-20 17:25:23 +0200 | [diff] [blame] | 192 | ret |= POLLIN; |
| 193 | |
| 194 | return ret; |
| 195 | } |
| 196 | |
| 197 | static long ethosu_inference_ioctl(struct file *file, |
| 198 | unsigned int cmd, |
| 199 | unsigned long arg) |
| 200 | { |
| 201 | struct ethosu_inference *inf = file->private_data; |
Per Åstrand | f7e407a | 2020-10-23 21:25:05 +0200 | [diff] [blame] | 202 | void __user *udata = (void __user *)arg; |
| 203 | int ret; |
Kristofer Jonsson | 116a635 | 2020-08-20 17:25:23 +0200 | [diff] [blame] | 204 | |
| 205 | ret = mutex_lock_interruptible(&inf->edev->mutex); |
| 206 | if (ret) |
| 207 | return ret; |
| 208 | |
| 209 | dev_info(inf->edev->dev, "Ioctl: cmd=%u, arg=%lu\n", cmd, arg); |
| 210 | |
| 211 | switch (cmd) { |
| 212 | case ETHOSU_IOCTL_INFERENCE_STATUS: { |
Per Åstrand | f7e407a | 2020-10-23 21:25:05 +0200 | [diff] [blame] | 213 | struct ethosu_uapi_result_status uapi; |
| 214 | int i; |
| 215 | |
| 216 | uapi.status = inf->status; |
| 217 | |
| 218 | for (i = 0; i < ETHOSU_PMU_EVENT_MAX; i++) { |
| 219 | uapi.pmu_config.events[i] = |
| 220 | inf->pmu_event_config[i]; |
| 221 | uapi.pmu_count.events[i] = |
| 222 | inf->pmu_event_count[i]; |
| 223 | } |
| 224 | |
| 225 | uapi.pmu_config.cycle_count = inf->pmu_cycle_counter_enable; |
| 226 | uapi.pmu_count.cycle_count = inf->pmu_cycle_counter_count; |
Kristofer Jonsson | 116a635 | 2020-08-20 17:25:23 +0200 | [diff] [blame] | 227 | |
| 228 | dev_info(inf->edev->dev, |
| 229 | "Ioctl: Inference status. status=%s (%d)\n", |
Per Åstrand | f7e407a | 2020-10-23 21:25:05 +0200 | [diff] [blame] | 230 | status_to_string(uapi.status), uapi.status); |
| 231 | |
| 232 | ret = copy_to_user(udata, &uapi, sizeof(uapi)) ? -EFAULT : 0; |
| 233 | |
Kristofer Jonsson | 116a635 | 2020-08-20 17:25:23 +0200 | [diff] [blame] | 234 | break; |
| 235 | } |
| 236 | default: { |
| 237 | dev_err(inf->edev->dev, "Invalid ioctl. cmd=%u, arg=%lu", |
| 238 | cmd, arg); |
| 239 | break; |
| 240 | } |
| 241 | } |
| 242 | |
| 243 | mutex_unlock(&inf->edev->mutex); |
| 244 | |
| 245 | return ret; |
| 246 | } |
| 247 | |
| 248 | int ethosu_inference_create(struct ethosu_device *edev, |
| 249 | struct ethosu_network *net, |
| 250 | struct ethosu_uapi_inference_create *uapi) |
| 251 | { |
| 252 | struct ethosu_inference *inf; |
Kristofer Jonsson | b74492c | 2020-09-10 13:26:01 +0200 | [diff] [blame] | 253 | uint32_t i; |
Kristofer Jonsson | 116a635 | 2020-08-20 17:25:23 +0200 | [diff] [blame] | 254 | int fd; |
| 255 | int ret = -ENOMEM; |
| 256 | |
| 257 | inf = devm_kzalloc(edev->dev, sizeof(*inf), GFP_KERNEL); |
| 258 | if (!inf) |
| 259 | return -ENOMEM; |
| 260 | |
| 261 | inf->edev = edev; |
| 262 | inf->net = net; |
Kristofer Jonsson | 442fefb | 2022-03-17 17:15:52 +0100 | [diff] [blame^] | 263 | inf->done = false; |
Kristofer Jonsson | 116a635 | 2020-08-20 17:25:23 +0200 | [diff] [blame] | 264 | inf->status = ETHOSU_UAPI_STATUS_ERROR; |
| 265 | kref_init(&inf->kref); |
| 266 | init_waitqueue_head(&inf->waitq); |
Kristofer Jonsson | 442fefb | 2022-03-17 17:15:52 +0100 | [diff] [blame^] | 267 | inf->msg.fail = ethosu_inference_fail; |
| 268 | inf->msg.resend = ethosu_inference_resend; |
Kristofer Jonsson | 116a635 | 2020-08-20 17:25:23 +0200 | [diff] [blame] | 269 | |
Kristofer Jonsson | b74492c | 2020-09-10 13:26:01 +0200 | [diff] [blame] | 270 | /* Get pointer to IFM buffers */ |
| 271 | for (i = 0; i < uapi->ifm_count; i++) { |
| 272 | inf->ifm[i] = ethosu_buffer_get_from_fd(uapi->ifm_fd[i]); |
| 273 | if (IS_ERR(inf->ifm[i])) { |
| 274 | ret = PTR_ERR(inf->ifm[i]); |
| 275 | goto put_ifm; |
| 276 | } |
| 277 | |
| 278 | inf->ifm_count++; |
Kristofer Jonsson | 116a635 | 2020-08-20 17:25:23 +0200 | [diff] [blame] | 279 | } |
| 280 | |
| 281 | /* Get pointer to OFM buffer */ |
Kristofer Jonsson | b74492c | 2020-09-10 13:26:01 +0200 | [diff] [blame] | 282 | for (i = 0; i < uapi->ofm_count; i++) { |
| 283 | inf->ofm[i] = ethosu_buffer_get_from_fd(uapi->ofm_fd[i]); |
| 284 | if (IS_ERR(inf->ofm[i])) { |
| 285 | ret = PTR_ERR(inf->ofm[i]); |
| 286 | goto put_ofm; |
| 287 | } |
| 288 | |
| 289 | inf->ofm_count++; |
Kristofer Jonsson | 116a635 | 2020-08-20 17:25:23 +0200 | [diff] [blame] | 290 | } |
| 291 | |
Per Åstrand | f7e407a | 2020-10-23 21:25:05 +0200 | [diff] [blame] | 292 | /* Configure PMU and cycle counter */ |
| 293 | dev_info(inf->edev->dev, |
| 294 | "Configuring events for PMU. events=[%u, %u, %u, %u]\n", |
| 295 | uapi->pmu_config.events[0], uapi->pmu_config.events[1], |
| 296 | uapi->pmu_config.events[2], uapi->pmu_config.events[3]); |
| 297 | |
| 298 | /* Configure events and reset count for all events */ |
| 299 | for (i = 0; i < ETHOSU_PMU_EVENT_MAX; i++) { |
| 300 | inf->pmu_event_config[i] = uapi->pmu_config.events[i]; |
| 301 | inf->pmu_event_count[i] = 0; |
| 302 | } |
| 303 | |
| 304 | if (uapi->pmu_config.cycle_count) |
| 305 | dev_info(inf->edev->dev, "Enabling cycle counter\n"); |
| 306 | |
| 307 | /* Configure cycle counter and reset any previous count */ |
| 308 | inf->pmu_cycle_counter_enable = uapi->pmu_config.cycle_count; |
| 309 | inf->pmu_cycle_counter_count = 0; |
| 310 | |
Kristofer Jonsson | 116a635 | 2020-08-20 17:25:23 +0200 | [diff] [blame] | 311 | /* Increment network reference count */ |
| 312 | ethosu_network_get(net); |
| 313 | |
| 314 | /* Create file descriptor */ |
| 315 | ret = fd = anon_inode_getfd("ethosu-inference", ðosu_inference_fops, |
| 316 | inf, O_RDWR | O_CLOEXEC); |
| 317 | if (ret < 0) |
| 318 | goto put_net; |
| 319 | |
| 320 | /* Store pointer to file structure */ |
| 321 | inf->file = fget(ret); |
| 322 | fput(inf->file); |
| 323 | |
Kristofer Jonsson | 442fefb | 2022-03-17 17:15:52 +0100 | [diff] [blame^] | 324 | /* Add inference to pending list */ |
| 325 | list_add(&inf->msg.list, &edev->mailbox.pending_list); |
Kristofer Jonsson | 116a635 | 2020-08-20 17:25:23 +0200 | [diff] [blame] | 326 | |
| 327 | /* Send inference request to Arm Ethos-U subsystem */ |
| 328 | (void)ethosu_inference_send(inf); |
| 329 | |
| 330 | dev_info(edev->dev, "Inference create. handle=0x%pK, fd=%d", |
| 331 | inf, fd); |
| 332 | |
| 333 | return fd; |
| 334 | |
| 335 | put_net: |
| 336 | ethosu_network_put(inf->net); |
Kristofer Jonsson | b74492c | 2020-09-10 13:26:01 +0200 | [diff] [blame] | 337 | |
| 338 | put_ofm: |
| 339 | while (inf->ofm_count-- > 0) |
| 340 | ethosu_buffer_put(inf->ofm[inf->ofm_count]); |
Kristofer Jonsson | 116a635 | 2020-08-20 17:25:23 +0200 | [diff] [blame] | 341 | |
| 342 | put_ifm: |
Kristofer Jonsson | b74492c | 2020-09-10 13:26:01 +0200 | [diff] [blame] | 343 | while (inf->ifm_count-- > 0) |
| 344 | ethosu_buffer_put(inf->ifm[inf->ifm_count]); |
Kristofer Jonsson | 116a635 | 2020-08-20 17:25:23 +0200 | [diff] [blame] | 345 | |
Kristofer Jonsson | 116a635 | 2020-08-20 17:25:23 +0200 | [diff] [blame] | 346 | devm_kfree(edev->dev, inf); |
| 347 | |
| 348 | return ret; |
| 349 | } |
| 350 | |
| 351 | struct ethosu_inference *ethosu_inference_get_from_fd(int fd) |
| 352 | { |
| 353 | struct ethosu_inference *inf; |
| 354 | struct file *file; |
| 355 | |
| 356 | file = fget(fd); |
| 357 | if (!file) |
| 358 | return ERR_PTR(-EINVAL); |
| 359 | |
| 360 | if (!ethosu_inference_verify(file)) { |
| 361 | fput(file); |
| 362 | |
| 363 | return ERR_PTR(-EINVAL); |
| 364 | } |
| 365 | |
| 366 | inf = file->private_data; |
| 367 | ethosu_inference_get(inf); |
| 368 | fput(file); |
| 369 | |
| 370 | return inf; |
| 371 | } |
| 372 | |
| 373 | void ethosu_inference_get(struct ethosu_inference *inf) |
| 374 | { |
| 375 | kref_get(&inf->kref); |
| 376 | } |
| 377 | |
Kristofer Jonsson | 442fefb | 2022-03-17 17:15:52 +0100 | [diff] [blame^] | 378 | int ethosu_inference_put(struct ethosu_inference *inf) |
Kristofer Jonsson | 116a635 | 2020-08-20 17:25:23 +0200 | [diff] [blame] | 379 | { |
Kristofer Jonsson | 442fefb | 2022-03-17 17:15:52 +0100 | [diff] [blame^] | 380 | return kref_put(&inf->kref, ðosu_inference_kref_destroy); |
Kristofer Jonsson | 116a635 | 2020-08-20 17:25:23 +0200 | [diff] [blame] | 381 | } |
| 382 | |
| 383 | void ethosu_inference_rsp(struct ethosu_device *edev, |
| 384 | struct ethosu_core_inference_rsp *rsp) |
| 385 | { |
| 386 | struct ethosu_inference *inf = |
| 387 | (struct ethosu_inference *)rsp->user_arg; |
| 388 | int ret; |
Per Åstrand | f7e407a | 2020-10-23 21:25:05 +0200 | [diff] [blame] | 389 | int i; |
Kristofer Jonsson | 116a635 | 2020-08-20 17:25:23 +0200 | [diff] [blame] | 390 | |
Kristofer Jonsson | 442fefb | 2022-03-17 17:15:52 +0100 | [diff] [blame^] | 391 | ret = ethosu_mailbox_find(&edev->mailbox, &inf->msg); |
Kristofer Jonsson | 116a635 | 2020-08-20 17:25:23 +0200 | [diff] [blame] | 392 | if (ret) { |
| 393 | dev_warn(edev->dev, |
| 394 | "Handle not found in inference list. handle=0x%p\n", |
| 395 | rsp); |
| 396 | |
| 397 | return; |
| 398 | } |
| 399 | |
Kristofer Jonsson | b74492c | 2020-09-10 13:26:01 +0200 | [diff] [blame] | 400 | if (rsp->status == ETHOSU_CORE_STATUS_OK && |
| 401 | inf->ofm_count <= ETHOSU_CORE_BUFFER_MAX) { |
| 402 | uint32_t i; |
| 403 | |
Kristofer Jonsson | 116a635 | 2020-08-20 17:25:23 +0200 | [diff] [blame] | 404 | inf->status = ETHOSU_UAPI_STATUS_OK; |
| 405 | |
Kristofer Jonsson | b74492c | 2020-09-10 13:26:01 +0200 | [diff] [blame] | 406 | for (i = 0; i < inf->ofm_count; i++) { |
| 407 | struct ethosu_buffer *ofm = inf->ofm[i]; |
| 408 | |
| 409 | ret = ethosu_buffer_resize( |
| 410 | ofm, ofm->size + rsp->ofm_size[i], |
| 411 | ofm->offset); |
| 412 | if (ret) |
| 413 | inf->status = ETHOSU_UAPI_STATUS_ERROR; |
| 414 | } |
Kristofer Jonsson | 116a635 | 2020-08-20 17:25:23 +0200 | [diff] [blame] | 415 | } else { |
| 416 | inf->status = ETHOSU_UAPI_STATUS_ERROR; |
| 417 | } |
| 418 | |
Per Åstrand | f7e407a | 2020-10-23 21:25:05 +0200 | [diff] [blame] | 419 | for (i = 0; i < ETHOSU_CORE_PMU_MAX; i++) { |
| 420 | inf->pmu_event_config[i] = rsp->pmu_event_config[i]; |
| 421 | inf->pmu_event_count[i] = rsp->pmu_event_count[i]; |
| 422 | } |
| 423 | |
| 424 | inf->pmu_cycle_counter_enable = rsp->pmu_cycle_counter_enable; |
| 425 | inf->pmu_cycle_counter_count = rsp->pmu_cycle_counter_count; |
| 426 | |
| 427 | dev_info(edev->dev, |
Jonny Svärd | 9d8d92c | 2020-12-10 11:33:19 +0100 | [diff] [blame] | 428 | "PMU events. config=[%u, %u, %u, %u], count=[%u, %u, %u, %u]\n", |
| 429 | inf->pmu_event_config[0], inf->pmu_event_config[1], |
| 430 | inf->pmu_event_config[2], inf->pmu_event_config[3], |
| 431 | inf->pmu_event_count[0], inf->pmu_event_count[1], |
| 432 | inf->pmu_event_count[2], inf->pmu_event_count[3]); |
Per Åstrand | f7e407a | 2020-10-23 21:25:05 +0200 | [diff] [blame] | 433 | |
| 434 | dev_info(edev->dev, |
| 435 | "PMU cycle counter. enable=%u, count=%llu\n", |
| 436 | inf->pmu_cycle_counter_enable, |
| 437 | inf->pmu_cycle_counter_count); |
Kristofer Jonsson | 442fefb | 2022-03-17 17:15:52 +0100 | [diff] [blame^] | 438 | |
| 439 | inf->done = true; |
Kristofer Jonsson | 116a635 | 2020-08-20 17:25:23 +0200 | [diff] [blame] | 440 | wake_up_interruptible(&inf->waitq); |
| 441 | |
| 442 | ethosu_inference_put(inf); |
| 443 | } |