From b8bcf1351d6d1260595f515ead22bc2abe4e08c8 Mon Sep 17 00:00:00 2001 From: Anton Moberg Date: Mon, 29 Mar 2021 10:02:25 +0200 Subject: MLBEDSW-4301 - Verification check custom_dma Added: custom_dma bit to config structs Added: hardware verification check for custom_dma Change-Id: I31dca56063b3ca773d02f0adf30d21facfd0b80d --- include/ethosu_device.h | 3 ++- include/ethosu_driver.h | 1 + src/ethosu55_interface.h | 7 ++++--- src/ethosu_device.c | 3 ++- src/ethosu_driver.c | 24 ++++++++++++++++++------ 5 files changed, 27 insertions(+), 11 deletions(-) diff --git a/include/ethosu_device.h b/include/ethosu_device.h index d9c233d..35f7924 100644 --- a/include/ethosu_device.h +++ b/include/ethosu_device.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2020 Arm Limited. All rights reserved. + * Copyright (c) 2019-2021 Arm Limited. All rights reserved. * * SPDX-License-Identifier: Apache-2.0 * @@ -87,6 +87,7 @@ struct ethosu_config uint32_t macs_per_cc; ///< MACs per clock cycle uint32_t cmd_stream_version; ///< NPU command stream version uint32_t shram_size; ///< SHRAM size + uint32_t custom_dma; ///< Custom DMA enabled }; }; diff --git a/include/ethosu_driver.h b/include/ethosu_driver.h index 4089932..96822e0 100644 --- a/include/ethosu_driver.h +++ b/include/ethosu_driver.h @@ -75,6 +75,7 @@ struct ethosu_version_config uint8_t macs_per_cc; uint8_t cmd_stream_version; uint8_t shram_size; + uint8_t custom_dma; }; struct ethosu_version diff --git a/src/ethosu55_interface.h b/src/ethosu55_interface.h index b6834a8..0d1ee6c 100644 --- a/src/ethosu55_interface.h +++ b/src/ethosu55_interface.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2020 Arm Limited. All rights reserved. + * Copyright (c) 2019-2021 Arm Limited. All rights reserved. * * SPDX-License-Identifier: Apache-2.0 * @@ -2254,8 +2254,9 @@ struct config_r // MACs/clock cycle. uint32_t cmd_stream_version : 4; // command stream version accepted by this NPU. uint32_t shram_size : 8; // Size in KB of SHRAM in the range 8 to 48. - uint32_t reserved0 : 12; - uint32_t product : 4; // Product configuration + uint32_t reserved0 : 11; + uint32_t custom_dma : 1; // Custom DMA enable bit. + uint32_t product : 4; // Product configuration }; uint32_t word; }; diff --git a/src/ethosu_device.c b/src/ethosu_device.c index f8250bc..1667325 100644 --- a/src/ethosu_device.c +++ b/src/ethosu_device.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2020 Arm Limited. All rights reserved. + * Copyright (c) 2019-2021 Arm Limited. All rights reserved. * * SPDX-License-Identifier: Apache-2.0 * @@ -91,6 +91,7 @@ enum ethosu_error_codes ethosu_get_config(struct ethosu_device *dev, struct etho config->macs_per_cc = cfg.macs_per_cc; config->cmd_stream_version = cfg.cmd_stream_version; config->shram_size = cfg.shram_size; + config->custom_dma = cfg.custom_dma; return ETHOSU_SUCCESS; } diff --git a/src/ethosu_driver.c b/src/ethosu_driver.c index 7b2a8ef..e99376a 100644 --- a/src/ethosu_driver.c +++ b/src/ethosu_driver.c @@ -124,7 +124,9 @@ struct opt_cfg_s uint32_t macs_per_cc : 4; uint32_t cmd_stream_version : 4; uint32_t shram_size : 8; - uint32_t reserved1 : 16; + uint32_t reserved0 : 11; + uint32_t custom_dma : 1; + uint32_t product : 4; }; uint32_t npu_cfg; }; @@ -352,6 +354,7 @@ int ethosu_get_version_v2(struct ethosu_driver *drv, struct ethosu_version *vers version->cfg.macs_per_cc = cfg.macs_per_cc; version->cfg.cmd_stream_version = cfg.cmd_stream_version; version->cfg.shram_size = cfg.shram_size; + version->cfg.custom_dma = cfg.custom_dma; } else { @@ -671,10 +674,11 @@ static int handle_optimizer_config(struct ethosu_driver *drv, struct opt_cfg_s * LOG_INFO("handle_optimizer_config:\n"); LOG_INFO("Optimizer release nbr: %d patch: %d\n", opt_cfg_p->da_data.rel_nbr, opt_cfg_p->da_data.patch_nbr); - LOG_INFO("Optimizer config cmd_stream_version: %d macs_per_cc: %d shram_size: %d\n", + LOG_INFO("Optimizer config cmd_stream_version: %d macs_per_cc: %d shram_size: %d custom_dma: %d\n", opt_cfg_p->cmd_stream_version, opt_cfg_p->macs_per_cc, - opt_cfg_p->shram_size); + opt_cfg_p->shram_size, + opt_cfg_p->custom_dma); LOG_INFO("Optimizer config Ethos-U version: %d.%d.%d\n", opt_cfg_p->arch_major_rev, opt_cfg_p->arch_minor_rev, @@ -682,17 +686,19 @@ static int handle_optimizer_config(struct ethosu_driver *drv, struct opt_cfg_s * (void)ethosu_get_config(&drv->dev, &cfg); (void)ethosu_get_id(&drv->dev, &id); - LOG_INFO("Ethos-U config cmd_stream_version: %" PRIu32 " macs_per_cc: %" PRIu32 " shram_size: %" PRIu32 "\n", + LOG_INFO("Ethos-U config cmd_stream_version: %" PRIu32 " macs_per_cc: %" PRIu32 " shram_size: %" PRIu32 + " custom_dma: %" PRIu32 "\n", cfg.cmd_stream_version, cfg.macs_per_cc, - cfg.shram_size); + cfg.shram_size, + cfg.custom_dma); LOG_INFO("Ethos-U version: %" PRIu32 ".%" PRIu32 ".%" PRIu32 "\n", id.arch_major_rev, id.arch_minor_rev, id.arch_patch_rev); if ((cfg.macs_per_cc != opt_cfg_p->macs_per_cc) || (cfg.shram_size != opt_cfg_p->shram_size) || - (cfg.cmd_stream_version != opt_cfg_p->cmd_stream_version)) + (cfg.cmd_stream_version != opt_cfg_p->cmd_stream_version) || (!cfg.custom_dma && opt_cfg_p->custom_dma)) { if (cfg.macs_per_cc != opt_cfg_p->macs_per_cc) { @@ -712,6 +718,12 @@ static int handle_optimizer_config(struct ethosu_driver *drv, struct opt_cfg_s * cfg.cmd_stream_version, opt_cfg_p->cmd_stream_version); } + if (!cfg.custom_dma && opt_cfg_p->custom_dma) + { + LOG_ERR("NPU config mismatch: npu.custom_dma=%" PRIu32 " optimize.custom_dma=%d\n", + cfg.custom_dma, + opt_cfg_p->custom_dma); + } return_code = -1; } -- cgit v1.2.1