From dc18ceaa54957d5ac05292b363a5ac6fe479f409 Mon Sep 17 00:00:00 2001 From: Mikael Olsson Date: Fri, 16 Feb 2024 11:04:46 +0100 Subject: Add NPU device type to capabilities In preparation to support the Linux kernel driver directly managing the NPU without a subsystem. A NPU device type has been added to the capabilities to be able to specify what kind of NPU is used. Change-Id: I45345b7d75d234f821d70b858453d3af2a99194e Signed-off-by: Mikael Olsson --- kernel/include/uapi/ethosu.h | 15 +++++++++++++++ kernel/rpmsg/ethosu_rpmsg_capabilities.c | 1 + 2 files changed, 16 insertions(+) (limited to 'kernel') diff --git a/kernel/include/uapi/ethosu.h b/kernel/include/uapi/ethosu.h index 58b9c34..699ef7e 100644 --- a/kernel/include/uapi/ethosu.h +++ b/kernel/include/uapi/ethosu.h @@ -193,16 +193,31 @@ struct ethosu_uapi_device_hw_id { __u32 arch_major_rev; }; +/** + * enum ethosu_dev_type - NPU device type + * @ETHOSU_DEV_UNKNOWN: Unknown NPU device type + * @ETHOSU_DEV_SUBSYSTEM: NPU managed by a subsystem communicated with via a + * mailbox + * @ETHOSU_DEV_DIRECT: NPU directly managed by the kernel driver + */ +enum ethosu_dev_type { + ETHOSU_DEV_UNKNOWN = 0, + ETHOSU_DEV_SUBSYSTEM, + ETHOSU_DEV_DIRECT, +}; + /** * struct ethosu_uapi_device_hw_cfg - Device hardware configuration * @macs_per_cc: MACs per clock cycle * @cmd_stream_version: NPU command stream version * @custom_dma: Custom DMA enabled + * @type: NPU device type */ struct ethosu_uapi_device_hw_cfg { __u32 macs_per_cc; __u32 cmd_stream_version; __u32 custom_dma; + __u32 type; }; /** diff --git a/kernel/rpmsg/ethosu_rpmsg_capabilities.c b/kernel/rpmsg/ethosu_rpmsg_capabilities.c index 3c21d3e..30a9aef 100644 --- a/kernel/rpmsg/ethosu_rpmsg_capabilities.c +++ b/kernel/rpmsg/ethosu_rpmsg_capabilities.c @@ -97,6 +97,7 @@ void ethosu_capability_rsp(struct ethosu_rpmsg_mailbox *mailbox, cap->uapi->hw_cfg.macs_per_cc = rsp->macs_per_cc; cap->uapi->hw_cfg.cmd_stream_version = rsp->cmd_stream_version; cap->uapi->hw_cfg.custom_dma = rsp->custom_dma; + cap->uapi->hw_cfg.type = ETHOSU_DEV_SUBSYSTEM; cap->errno = 0; complete(&cap->done); -- cgit v1.2.1