From f7e407a0fe58d76d54e3d1f9d2cb117036cd095b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Per=20=C3=85strand?= Date: Fri, 23 Oct 2020 21:25:05 +0200 Subject: Add PMU config to inference creation Add PMU configuration information to inference creation. Change-Id: Id8a69517a5d3e4822dbaf46f76cadb2700b3d981 --- kernel/uapi/ethosu.h | 49 ++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 44 insertions(+), 5 deletions(-) (limited to 'kernel/uapi/ethosu.h') diff --git a/kernel/uapi/ethosu.h b/kernel/uapi/ethosu.h index d790db4..8f870c9 100644 --- a/kernel/uapi/ethosu.h +++ b/kernel/uapi/ethosu.h @@ -49,11 +49,15 @@ struct ethosu_uapi_network_create) #define ETHOSU_IOCTL_INFERENCE_CREATE ETHOSU_IOR(0x30, \ struct ethosu_uapi_inference_create) -#define ETHOSU_IOCTL_INFERENCE_STATUS ETHOSU_IO(0x31) +#define ETHOSU_IOCTL_INFERENCE_STATUS ETHOSU_IOR(0x31, \ + struct ethosu_uapi_result_status) /* Maximum number of IFM/OFM file descriptors per network */ #define ETHOSU_FD_MAX 16 +/* Maximum number of PMUs available */ +#define ETHOSU_PMU_EVENT_MAX 4 + /**************************************************************************** * Types ****************************************************************************/ @@ -94,6 +98,27 @@ struct ethosu_uapi_network_create { __u32 fd; }; +/** + * struct ethosu_uapi_pmu_config - Configure performance counters + * @events: Array of counters to configure, set to non-zero for + * each counter to enable corresponding event. + * @cycle_count: Set to enable the cycle counter. + */ +struct ethosu_uapi_pmu_config { + __u32 events[ETHOSU_PMU_EVENT_MAX]; + __u32 cycle_count; +}; + +/** + * struct ethosu_uapi_pmu_counts - Status of performance counters + * @events: Count for respective configured events. + * @cycle_count: Count for cycle counter. + */ +struct ethosu_uapi_pmu_counts { + __u32 events[ETHOSU_PMU_EVENT_MAX]; + __u64 cycle_count; +}; + /** * struct ethosu_uapi_inference_create - Create network request * @ifm_count: Number of IFM file descriptors @@ -102,10 +127,24 @@ struct ethosu_uapi_network_create { * @ofm_fd: OFM buffer file descriptors */ struct ethosu_uapi_inference_create { - __u32 ifm_count; - __u32 ifm_fd[ETHOSU_FD_MAX]; - __u32 ofm_count; - __u32 ofm_fd[ETHOSU_FD_MAX]; + __u32 ifm_count; + __u32 ifm_fd[ETHOSU_FD_MAX]; + __u32 ofm_count; + __u32 ofm_fd[ETHOSU_FD_MAX]; + struct ethosu_uapi_pmu_config pmu_config; +}; + +/** + * struct ethosu_uapi_result_status - Status of inference + * @status Status of run inference. + * @pmu_config Configured performance counters. + * @pmu_count Perfomance counters values, when status is + * ETHOSU_UAPI_STATUS_OK. + */ +struct ethosu_uapi_result_status { + enum ethosu_uapi_status status; + struct ethosu_uapi_pmu_config pmu_config; + struct ethosu_uapi_pmu_counts pmu_count; }; #endif -- cgit v1.2.1