@@ -325,7 +325,7 @@ static inline void *aes_dma_calloc(size_t num, size_t size, uint32_t caps, size_
325
325
return heap_caps_aligned_calloc (DMA_DESC_MEM_ALIGN_SIZE , num , size , caps | MALLOC_CAP_DMA | MALLOC_CAP_8BIT );
326
326
}
327
327
328
- static inline esp_err_t dma_desc_link (crypto_dma_desc_t * dmadesc , size_t crypto_dma_desc_num , size_t cache_line_size )
328
+ static inline esp_err_t dma_desc_link (crypto_dma_desc_t * dmadesc , size_t crypto_dma_desc_num )
329
329
{
330
330
esp_err_t ret = ESP_OK ;
331
331
for (int i = 0 ; i < crypto_dma_desc_num ; i ++ ) {
@@ -334,7 +334,8 @@ static inline esp_err_t dma_desc_link(crypto_dma_desc_t *dmadesc, size_t crypto_
334
334
#if SOC_CACHE_INTERNAL_MEM_VIA_L1CACHE
335
335
/* Write back both input buffers and output buffers to clear any cache dirty bit if set
336
336
If we want to remove `ESP_CACHE_MSYNC_FLAG_UNALIGNED` aligned flag then we need to pass
337
- cache msync size = ALIGN_UP(dma_desc.size, cache_line_size), instead of dma_desc.size
337
+ cache msync size = ALIGN_UP(dma_desc.size, cache_line_size), where cache_line_size is the
338
+ the cache line size coressponding to the buffer that is being synced, instead of dma_desc.size
338
339
Keeping the `ESP_CACHE_MSYNC_FLAG_UNALIGNED` flag just because it should not look like
339
340
we are syncing extra bytes due to ALIGN_UP'ed size but just the number of bytes that
340
341
are needed in the operation. */
@@ -343,7 +344,7 @@ static inline esp_err_t dma_desc_link(crypto_dma_desc_t *dmadesc, size_t crypto_
343
344
return ret ;
344
345
}
345
346
}
346
- ret = esp_cache_msync (dmadesc , ALIGN_UP ( crypto_dma_desc_num * sizeof (crypto_dma_desc_t ), cache_line_size ), ESP_CACHE_MSYNC_FLAG_DIR_C2M );
347
+ ret = esp_cache_msync (dmadesc , crypto_dma_desc_num * sizeof (crypto_dma_desc_t ), ESP_CACHE_MSYNC_FLAG_DIR_C2M | ESP_CACHE_MSYNC_FLAG_UNALIGNED );
347
348
#else
348
349
}
349
350
#endif
@@ -470,7 +471,7 @@ static esp_err_t generate_descriptor_list(const uint8_t *buffer, const size_t le
470
471
populated_dma_descs += (unaligned_end_bytes ? 1 : 0 );
471
472
}
472
473
473
- if (dma_desc_link (dma_descriptors , dma_descs_needed , cache_line_size ) != ESP_OK ) {
474
+ if (dma_desc_link (dma_descriptors , dma_descs_needed ) != ESP_OK ) {
474
475
ESP_LOGE (TAG , "DMA descriptors cache sync C2M failed" );
475
476
return ESP_FAIL ;
476
477
}
0 commit comments