1 /* SPDX-License-Identifier: GPL-2.0-only OR MIT */ 2 /* Copyright 2024-2025 Tomeu Vizoso <tomeu@tomeuvizoso.net> */ 3 /* Copyright 2025 Arm, Ltd. */ 4 5 #ifndef __ETHOSU_JOB_H__ 6 #define __ETHOSU_JOB_H__ 7 8 #include <linux/kref.h> 9 #include <drm/gpu_scheduler.h> 10 11 struct ethosu_device; 12 struct ethosu_file_priv; 13 14 struct ethosu_job { 15 struct drm_sched_job base; 16 struct ethosu_device *dev; 17 18 struct drm_gem_object *cmd_bo; 19 struct drm_gem_object *region_bo[NPU_BASEP_REGION_MAX]; 20 u8 region_bo_num[NPU_BASEP_REGION_MAX]; 21 u8 region_cnt; 22 u32 sram_size; 23 24 /* Fence to be signaled by drm-sched once its done with the job */ 25 struct dma_fence *inference_done_fence; 26 27 /* Fence to be signaled by IRQ handler when the job is complete. */ 28 struct dma_fence *done_fence; 29 30 struct kref refcount; 31 }; 32 33 int ethosu_ioctl_submit(struct drm_device *dev, void *data, struct drm_file *file); 34 35 int ethosu_job_init(struct ethosu_device *dev); 36 void ethosu_job_fini(struct ethosu_device *dev); 37 int ethosu_job_open(struct ethosu_file_priv *ethosu_priv); 38 void ethosu_job_close(struct ethosu_file_priv *ethosu_priv); 39 40 #endif 41