From bf7ae6313fbbc024ecf3c1177f007a8152c36b73 Mon Sep 17 00:00:00 2001 From: Bhavik Patel Date: Thu, 11 Jun 2020 21:00:16 +0200 Subject: Move command stream and base address alignment checks Moving the alignment checks for command stream and base addresses to handle_command_stream(). This is done so that applications which directly call ethosu_run_command_stream(), and don't have command stream & base addresses properly aligned can still run the command stream. Change-Id: Ie02e9952af027e3017e53ea7217698a33a33b418 --- src/ethosu_device.c | 23 ----------------------- 1 file changed, 23 deletions(-) (limited to 'src/ethosu_device.c') diff --git a/src/ethosu_device.c b/src/ethosu_device.c index d6360f4..7df8b6f 100644 --- a/src/ethosu_device.c +++ b/src/ethosu_device.c @@ -19,13 +19,10 @@ #include "ethosu_common.h" #include -#include -#include #include #define MASK_0_31_BITS 0xFFFFFFFF #define MASK_32_47_BITS 0xFFFF00000000 -#define MASK_16_BYTE_ALIGN 0xF #define BASEP_OFFSET 4 #define REG_OFFSET 4 #define BYTES_1KB 1024 @@ -92,26 +89,6 @@ enum ethosu_error_codes ethosu_run_command_stream(const uint8_t *cmd_stream_ptr, ASSERT(num_base_addr <= ETHOSU_DRIVER_BASEP_INDEXES); - if (0 != ((ptrdiff_t)cmd_stream_ptr & MASK_16_BYTE_ALIGN)) - { - LOG_ERR("Error: Command stream addr %p not aligned to 16 bytes\n", cmd_stream_ptr); - return ETHOSU_INVALID_PARAM; - } - - bool base_addr_invalid = false; - for (int i = 0; i < num_base_addr; i++) - { - if (0 != (base_addr[i] & MASK_16_BYTE_ALIGN)) - { - LOG_ERR("Error: Base addr %d: %p not aligned to 16 bytes\n", i, (void *)(base_addr[i])); - base_addr_invalid = true; - } - } - if (base_addr_invalid) - { - return ETHOSU_INVALID_PARAM; - } - qbase0 = ((uint64_t)cmd_stream_ptr) & MASK_0_31_BITS; qbase1 = (((uint64_t)cmd_stream_ptr) & MASK_32_47_BITS) >> 32; qsize = cms_length; -- cgit v1.2.1