Lines Matching full:ss

3  * sun8i-ss-hash.c - hardware cryptographic offloader for
22 #include "sun8i-ss.h"
46 dev_err(tfmctx->ss->dev, "shash init error ret=%d\n", ret); in sun8i_ss_hashkey()
51 dev_err(tfmctx->ss->dev, "shash finup error\n"); in sun8i_ss_hashkey()
120 op->ss = algt->ss; in sun8i_ss_hash_crainit()
130 dev_err(algt->ss->dev, "Fallback driver could no be loaded\n"); in sun8i_ss_hash_crainit()
143 err = pm_runtime_get_sync(op->ss->dev); in sun8i_ss_hash_crainit()
148 pm_runtime_put_noidle(op->ss->dev); in sun8i_ss_hash_crainit()
161 pm_runtime_put_sync_suspend(tfmctx->ss->dev); in sun8i_ss_hash_craexit()
290 static int sun8i_ss_run_hash_task(struct sun8i_ss_dev *ss, in sun8i_ss_run_hash_task() argument
299 ss->flows[flow].stat_req++; in sun8i_ss_run_hash_task()
314 mutex_lock(&ss->mlock); in sun8i_ss_run_hash_task()
317 writel(rctx->t_dst[i - 1].addr, ss->base + SS_KEY_ADR_REG); in sun8i_ss_run_hash_task()
318 writel(rctx->t_dst[i - 1].addr, ss->base + SS_IV_ADR_REG); in sun8i_ss_run_hash_task()
321 dev_dbg(ss->dev, in sun8i_ss_run_hash_task()
327 writel(rctx->t_src[i].addr, ss->base + SS_SRC_ADR_REG); in sun8i_ss_run_hash_task()
328 writel(rctx->t_dst[i].addr, ss->base + SS_DST_ADR_REG); in sun8i_ss_run_hash_task()
329 writel(rctx->t_src[i].len, ss->base + SS_LEN_ADR_REG); in sun8i_ss_run_hash_task()
330 writel(BIT(0) | BIT(1), ss->base + SS_INT_CTL_REG); in sun8i_ss_run_hash_task()
332 reinit_completion(&ss->flows[flow].complete); in sun8i_ss_run_hash_task()
333 ss->flows[flow].status = 0; in sun8i_ss_run_hash_task()
336 writel(v, ss->base + SS_CTL_REG); in sun8i_ss_run_hash_task()
337 mutex_unlock(&ss->mlock); in sun8i_ss_run_hash_task()
338 wait_for_completion_interruptible_timeout(&ss->flows[flow].complete, in sun8i_ss_run_hash_task()
340 if (ss->flows[flow].status == 0) { in sun8i_ss_run_hash_task()
341 dev_err(ss->dev, "DMA timeout for %s\n", name); in sun8i_ss_run_hash_task()
376 /* SS can operate hash only on full block size in sun8i_ss_hash_need_fallback()
377 * since SS support only MD5,sha1,sha224 and sha256, blocksize in sun8i_ss_hash_need_fallback()
404 struct sun8i_ss_dev *ss; in sun8i_ss_hash_digest() local
412 ss = algt->ss; in sun8i_ss_hash_digest()
414 e = sun8i_ss_get_engine_number(ss); in sun8i_ss_hash_digest()
416 engine = ss->flows[e].engine; in sun8i_ss_hash_digest()
480 * Send the data of the request to the SS along with an extra SG with padding
490 struct sun8i_ss_dev *ss; in sun8i_ss_hash_run() local
508 ss = algt->ss; in sun8i_ss_hash_run()
514 result = ss->flows[rctx->flow].result; in sun8i_ss_hash_run()
515 pad = ss->flows[rctx->flow].pad; in sun8i_ss_hash_run()
527 rctx->method = ss->variant->alg_hash[algt->ss_algo_id]; in sun8i_ss_hash_run()
529 nr_sgs = dma_map_sg(ss->dev, areq->src, sg_nents(areq->src), DMA_TO_DEVICE); in sun8i_ss_hash_run()
531 dev_err(ss->dev, "Invalid sg number %d\n", nr_sgs); in sun8i_ss_hash_run()
536 addr_res = dma_map_single(ss->dev, result, digestsize, DMA_FROM_DEVICE); in sun8i_ss_hash_run()
537 if (dma_mapping_error(ss->dev, addr_res)) { in sun8i_ss_hash_run()
538 dev_err(ss->dev, "DMA map dest\n"); in sun8i_ss_hash_run()
569 dev_err(ss->dev, "remaining len %d\n", len); in sun8i_ss_hash_run()
588 addr_xpad = dma_map_single(ss->dev, tfmctx->ipad, bs, DMA_TO_DEVICE); in sun8i_ss_hash_run()
589 err = dma_mapping_error(ss->dev, addr_xpad); in sun8i_ss_hash_run()
591 dev_err(ss->dev, "Fail to create DMA mapping of ipad\n"); in sun8i_ss_hash_run()
609 addr_res = dma_map_single(ss->dev, result, digestsize, DMA_FROM_DEVICE); in sun8i_ss_hash_run()
610 if (dma_mapping_error(ss->dev, addr_res)) { in sun8i_ss_hash_run()
611 dev_err(ss->dev, "Fail to create DMA mapping of result\n"); in sun8i_ss_hash_run()
615 addr_xpad = dma_map_single(ss->dev, tfmctx->opad, bs, DMA_TO_DEVICE); in sun8i_ss_hash_run()
616 err = dma_mapping_error(ss->dev, addr_xpad); in sun8i_ss_hash_run()
618 dev_err(ss->dev, "Fail to create DMA mapping of opad\n"); in sun8i_ss_hash_run()
648 addr_pad = dma_map_single(ss->dev, pad, j * 4, DMA_TO_DEVICE); in sun8i_ss_hash_run()
649 if (dma_mapping_error(ss->dev, addr_pad)) { in sun8i_ss_hash_run()
650 dev_err(ss->dev, "DMA error on padding SG\n"); in sun8i_ss_hash_run()
659 err = sun8i_ss_run_hash_task(ss, rctx, crypto_tfm_alg_name(areq->base.tfm)); in sun8i_ss_hash_run()
686 dma_unmap_single(ss->dev, addr_pad, j * 4, DMA_TO_DEVICE); in sun8i_ss_hash_run()
690 dma_unmap_single(ss->dev, addr_xpad, bs, DMA_TO_DEVICE); in sun8i_ss_hash_run()
692 dma_unmap_single(ss->dev, addr_res, digestsize, DMA_FROM_DEVICE); in sun8i_ss_hash_run()
695 dma_unmap_sg(ss->dev, areq->src, sg_nents(areq->src), in sun8i_ss_hash_run()