Lines Matching full:ss
3 * sun8i-ss-hash.c - hardware cryptographic offloader for
27 #include "sun8i-ss.h"
41 dev_err(tfmctx->ss->dev, "shash digest error ret=%d\n", ret); in sun8i_ss_hashkey()
103 op->ss = algt->ss; in sun8i_ss_hash_init_tfm()
109 dev_err(algt->ss->dev, "Fallback driver could no be loaded\n"); in sun8i_ss_hash_init_tfm()
123 err = pm_runtime_get_sync(op->ss->dev); in sun8i_ss_hash_init_tfm()
128 pm_runtime_put_noidle(op->ss->dev); in sun8i_ss_hash_init_tfm()
141 pm_runtime_put_sync_suspend(tfmctx->ss->dev); in sun8i_ss_hash_exit_tfm()
281 static int sun8i_ss_run_hash_task(struct sun8i_ss_dev *ss, in sun8i_ss_run_hash_task() argument
290 ss->flows[flow].stat_req++; in sun8i_ss_run_hash_task()
305 mutex_lock(&ss->mlock); in sun8i_ss_run_hash_task()
308 writel(rctx->t_dst[i - 1].addr, ss->base + SS_KEY_ADR_REG); in sun8i_ss_run_hash_task()
309 writel(rctx->t_dst[i - 1].addr, ss->base + SS_IV_ADR_REG); in sun8i_ss_run_hash_task()
312 dev_dbg(ss->dev, in sun8i_ss_run_hash_task()
318 writel(rctx->t_src[i].addr, ss->base + SS_SRC_ADR_REG); in sun8i_ss_run_hash_task()
319 writel(rctx->t_dst[i].addr, ss->base + SS_DST_ADR_REG); in sun8i_ss_run_hash_task()
320 writel(rctx->t_src[i].len, ss->base + SS_LEN_ADR_REG); in sun8i_ss_run_hash_task()
321 writel(BIT(0) | BIT(1), ss->base + SS_INT_CTL_REG); in sun8i_ss_run_hash_task()
323 reinit_completion(&ss->flows[flow].complete); in sun8i_ss_run_hash_task()
324 ss->flows[flow].status = 0; in sun8i_ss_run_hash_task()
327 writel(v, ss->base + SS_CTL_REG); in sun8i_ss_run_hash_task()
328 mutex_unlock(&ss->mlock); in sun8i_ss_run_hash_task()
329 wait_for_completion_interruptible_timeout(&ss->flows[flow].complete, in sun8i_ss_run_hash_task()
331 if (ss->flows[flow].status == 0) { in sun8i_ss_run_hash_task()
332 dev_err(ss->dev, "DMA timeout for %s\n", name); in sun8i_ss_run_hash_task()
367 /* SS can operate hash only on full block size in sun8i_ss_hash_need_fallback()
368 * since SS support only MD5,sha1,sha224 and sha256, blocksize in sun8i_ss_hash_need_fallback()
395 struct sun8i_ss_dev *ss; in sun8i_ss_hash_digest() local
403 ss = algt->ss; in sun8i_ss_hash_digest()
405 e = sun8i_ss_get_engine_number(ss); in sun8i_ss_hash_digest()
407 engine = ss->flows[e].engine; in sun8i_ss_hash_digest()
471 * Send the data of the request to the SS along with an extra SG with padding
481 struct sun8i_ss_dev *ss; in sun8i_ss_hash_run() local
499 ss = algt->ss; in sun8i_ss_hash_run()
505 result = ss->flows[rctx->flow].result; in sun8i_ss_hash_run()
506 pad = ss->flows[rctx->flow].pad; in sun8i_ss_hash_run()
518 rctx->method = ss->variant->alg_hash[algt->ss_algo_id]; in sun8i_ss_hash_run()
520 nr_sgs = dma_map_sg(ss->dev, areq->src, sg_nents(areq->src), DMA_TO_DEVICE); in sun8i_ss_hash_run()
522 dev_err(ss->dev, "Invalid sg number %d\n", nr_sgs); in sun8i_ss_hash_run()
527 addr_res = dma_map_single(ss->dev, result, digestsize, DMA_FROM_DEVICE); in sun8i_ss_hash_run()
528 if (dma_mapping_error(ss->dev, addr_res)) { in sun8i_ss_hash_run()
529 dev_err(ss->dev, "DMA map dest\n"); in sun8i_ss_hash_run()
560 dev_err(ss->dev, "remaining len %d\n", len); in sun8i_ss_hash_run()
579 addr_xpad = dma_map_single(ss->dev, tfmctx->ipad, bs, DMA_TO_DEVICE); in sun8i_ss_hash_run()
580 err = dma_mapping_error(ss->dev, addr_xpad); in sun8i_ss_hash_run()
582 dev_err(ss->dev, "Fail to create DMA mapping of ipad\n"); in sun8i_ss_hash_run()
600 addr_res = dma_map_single(ss->dev, result, digestsize, DMA_FROM_DEVICE); in sun8i_ss_hash_run()
601 if (dma_mapping_error(ss->dev, addr_res)) { in sun8i_ss_hash_run()
602 dev_err(ss->dev, "Fail to create DMA mapping of result\n"); in sun8i_ss_hash_run()
606 addr_xpad = dma_map_single(ss->dev, tfmctx->opad, bs, DMA_TO_DEVICE); in sun8i_ss_hash_run()
607 err = dma_mapping_error(ss->dev, addr_xpad); in sun8i_ss_hash_run()
609 dev_err(ss->dev, "Fail to create DMA mapping of opad\n"); in sun8i_ss_hash_run()
639 addr_pad = dma_map_single(ss->dev, pad, j * 4, DMA_TO_DEVICE); in sun8i_ss_hash_run()
640 if (dma_mapping_error(ss->dev, addr_pad)) { in sun8i_ss_hash_run()
641 dev_err(ss->dev, "DMA error on padding SG\n"); in sun8i_ss_hash_run()
650 err = sun8i_ss_run_hash_task(ss, rctx, crypto_tfm_alg_name(areq->base.tfm)); in sun8i_ss_hash_run()
677 dma_unmap_single(ss->dev, addr_pad, j * 4, DMA_TO_DEVICE); in sun8i_ss_hash_run()
681 dma_unmap_single(ss->dev, addr_xpad, bs, DMA_TO_DEVICE); in sun8i_ss_hash_run()
683 dma_unmap_single(ss->dev, addr_res, digestsize, DMA_FROM_DEVICE); in sun8i_ss_hash_run()
686 dma_unmap_sg(ss->dev, areq->src, sg_nents(areq->src), in sun8i_ss_hash_run()