Lines Matching refs:se

26 	struct tegra_se *se;  member
43 struct tegra_se *se; member
67 struct tegra_se *se; member
206 struct tegra_se *se = ctx->se; in tegra_aes_prep_cmd() local
207 u32 *cpuvaddr = se->cmdbuf->addr; in tegra_aes_prep_cmd()
222 cpuvaddr[i++] = se_host1x_opcode_incr_w(se->hw->regs->linear_ctr); in tegra_aes_prep_cmd()
227 cpuvaddr[i++] = se_host1x_opcode_nonincr(se->hw->regs->last_blk, 1); in tegra_aes_prep_cmd()
231 cpuvaddr[i++] = se_host1x_opcode_incr(se->hw->regs->config, 6); in tegra_aes_prep_cmd()
244 cpuvaddr[i++] = se_host1x_opcode_nonincr(se->hw->regs->op, 1); in tegra_aes_prep_cmd()
250 host1x_uclass_incr_syncpt_indx_f(se->syncpt_id); in tegra_aes_prep_cmd()
252 dev_dbg(se->dev, "cfg %#x crypto cfg %#x\n", rctx->config, rctx->crypto_config); in tegra_aes_prep_cmd()
262 struct tegra_se *se = ctx->se; in tegra_aes_do_one_req() local
266 rctx->datbuf.buf = dma_alloc_coherent(se->dev, SE_AES_BUFLEN, in tegra_aes_do_one_req()
285 ret = tegra_se_host1x_submit(se, cmdlen); in tegra_aes_do_one_req()
292 dma_free_coherent(ctx->se->dev, SE_AES_BUFLEN, in tegra_aes_do_one_req()
295 crypto_finalize_skcipher_request(se->engine, req, ret); in tegra_aes_do_one_req()
313 ctx->se = se_alg->se_dev; in tegra_aes_cra_init()
320 dev_err(ctx->se->dev, "invalid algorithm\n"); in tegra_aes_cra_init()
334 tegra_key_invalidate(ctx->se, ctx->key1_id, ctx->alg); in tegra_aes_cra_exit()
337 tegra_key_invalidate(ctx->se, ctx->key2_id, ctx->alg); in tegra_aes_cra_exit()
346 dev_dbg(ctx->se->dev, "invalid key length (%d)\n", keylen); in tegra_aes_setkey()
350 return tegra_key_submit(ctx->se, key, keylen, ctx->alg, &ctx->key1_id); in tegra_aes_setkey()
362 dev_dbg(ctx->se->dev, "invalid key length (%d)\n", keylen); in tegra_xts_setkey()
366 ret = tegra_key_submit(ctx->se, key, len, in tegra_xts_setkey()
371 return tegra_key_submit(ctx->se, key + len, len, in tegra_xts_setkey()
435 dev_dbg(ctx->se->dev, "invalid length (%d)", req->cryptlen); in tegra_aes_crypt()
439 dev_dbg(ctx->se->dev, "invalid length (%d)", req->cryptlen); in tegra_aes_crypt()
454 return crypto_transfer_skcipher_request_to_engine(ctx->se->engine, req); in tegra_aes_crypt()
561 struct tegra_se *se = ctx->se; in tegra_gmac_prep_cmd() local
562 u32 *cpuvaddr = se->cmdbuf->addr; in tegra_gmac_prep_cmd()
574 cpuvaddr[i++] = se_host1x_opcode_nonincr(se->hw->regs->last_blk, 1); in tegra_gmac_prep_cmd()
578 cpuvaddr[i++] = se_host1x_opcode_incr(se->hw->regs->config, 4); in tegra_gmac_prep_cmd()
585 cpuvaddr[i++] = se_host1x_opcode_nonincr(se->hw->regs->op, 1); in tegra_gmac_prep_cmd()
592 host1x_uclass_incr_syncpt_indx_f(se->syncpt_id); in tegra_gmac_prep_cmd()
601 struct tegra_se *se = ctx->se; in tegra_gcm_crypt_prep_cmd() local
602 u32 *cpuvaddr = se->cmdbuf->addr, op; in tegra_gcm_crypt_prep_cmd()
624 cpuvaddr[i++] = se_host1x_opcode_incr_w(se->hw->regs->linear_ctr); in tegra_gcm_crypt_prep_cmd()
628 cpuvaddr[i++] = se_host1x_opcode_nonincr(se->hw->regs->last_blk, 1); in tegra_gcm_crypt_prep_cmd()
632 cpuvaddr[i++] = se_host1x_opcode_incr(se->hw->regs->config, 6); in tegra_gcm_crypt_prep_cmd()
646 cpuvaddr[i++] = se_host1x_opcode_nonincr(se->hw->regs->op, 1); in tegra_gcm_crypt_prep_cmd()
651 host1x_uclass_incr_syncpt_indx_f(se->syncpt_id); in tegra_gcm_crypt_prep_cmd()
653 dev_dbg(se->dev, "cfg %#x crypto cfg %#x\n", rctx->config, rctx->crypto_config); in tegra_gcm_crypt_prep_cmd()
657 static int tegra_gcm_prep_final_cmd(struct tegra_se *se, u32 *cpuvaddr, in tegra_gcm_prep_final_cmd() argument
672 cpuvaddr[i++] = se_host1x_opcode_incr(se->hw->regs->aad_len, 2); in tegra_gcm_prep_final_cmd()
676 cpuvaddr[i++] = se_host1x_opcode_incr(se->hw->regs->cryp_msg_len, 2); in tegra_gcm_prep_final_cmd()
681 cpuvaddr[i++] = se_host1x_opcode_incr_w(se->hw->regs->linear_ctr); in tegra_gcm_prep_final_cmd()
685 cpuvaddr[i++] = se_host1x_opcode_incr(se->hw->regs->config, 6); in tegra_gcm_prep_final_cmd()
696 cpuvaddr[i++] = se_host1x_opcode_nonincr(se->hw->regs->op, 1); in tegra_gcm_prep_final_cmd()
701 host1x_uclass_incr_syncpt_indx_f(se->syncpt_id); in tegra_gcm_prep_final_cmd()
703 dev_dbg(se->dev, "cfg %#x crypto cfg %#x\n", rctx->config, rctx->crypto_config); in tegra_gcm_prep_final_cmd()
710 struct tegra_se *se = ctx->se; in tegra_gcm_do_gmac() local
722 return tegra_se_host1x_submit(se, cmdlen); in tegra_gcm_do_gmac()
727 struct tegra_se *se = ctx->se; in tegra_gcm_do_crypt() local
739 ret = tegra_se_host1x_submit(se, cmdlen); in tegra_gcm_do_crypt()
752 struct tegra_se *se = ctx->se; in tegra_gcm_do_final() local
753 u32 *cpuvaddr = se->cmdbuf->addr; in tegra_gcm_do_final()
761 cmdlen = tegra_gcm_prep_final_cmd(se, cpuvaddr, rctx); in tegra_gcm_do_final()
762 ret = tegra_se_host1x_submit(se, cmdlen); in tegra_gcm_do_final()
776 static int tegra_gcm_do_verify(struct tegra_se *se, struct tegra_aead_reqctx *rctx) in tegra_gcm_do_verify() argument
808 struct tegra_se *se = ctx->se; in tegra_cbcmac_prep_cmd() local
809 u32 *cpuvaddr = se->cmdbuf->addr; in tegra_cbcmac_prep_cmd()
813 cpuvaddr[i++] = se_host1x_opcode_nonincr(se->hw->regs->last_blk, 1); in tegra_cbcmac_prep_cmd()
816 cpuvaddr[i++] = se_host1x_opcode_incr(se->hw->regs->config, 6); in tegra_cbcmac_prep_cmd()
828 cpuvaddr[i++] = se_host1x_opcode_nonincr(se->hw->regs->op, 1); in tegra_cbcmac_prep_cmd()
834 host1x_uclass_incr_syncpt_indx_f(se->syncpt_id); in tegra_cbcmac_prep_cmd()
843 struct tegra_se *se = ctx->se; in tegra_ctr_prep_cmd() local
844 u32 *cpuvaddr = se->cmdbuf->addr; in tegra_ctr_prep_cmd()
847 cpuvaddr[i++] = se_host1x_opcode_incr_w(se->hw->regs->linear_ctr); in tegra_ctr_prep_cmd()
851 cpuvaddr[i++] = se_host1x_opcode_nonincr(se->hw->regs->last_blk, 1); in tegra_ctr_prep_cmd()
853 cpuvaddr[i++] = se_host1x_opcode_incr(se->hw->regs->config, 6); in tegra_ctr_prep_cmd()
867 cpuvaddr[i++] = se_host1x_opcode_nonincr(se->hw->regs->op, 1); in tegra_ctr_prep_cmd()
873 host1x_uclass_incr_syncpt_indx_f(se->syncpt_id); in tegra_ctr_prep_cmd()
875 dev_dbg(se->dev, "cfg %#x crypto cfg %#x\n", in tegra_ctr_prep_cmd()
883 struct tegra_se *se = ctx->se; in tegra_ccm_do_cbcmac() local
894 return tegra_se_host1x_submit(se, cmdlen); in tegra_ccm_do_cbcmac()
1000 static int tegra_ccm_mac_result(struct tegra_se *se, struct tegra_aead_reqctx *rctx) in tegra_ccm_mac_result() argument
1007 result[i] = readl(se->base + se->hw->regs->result + (i * 4)); in tegra_ccm_mac_result()
1010 writel(0, se->base + se->hw->regs->result + (i * 4)); in tegra_ccm_mac_result()
1023 static int tegra_ccm_ctr_result(struct tegra_se *se, struct tegra_aead_reqctx *rctx) in tegra_ccm_ctr_result() argument
1041 struct tegra_se *se = ctx->se; in tegra_ccm_compute_auth() local
1064 return tegra_ccm_mac_result(se, rctx); in tegra_ccm_compute_auth()
1069 struct tegra_se *se = ctx->se; in tegra_ccm_do_ctr() local
1101 ret = tegra_se_host1x_submit(se, cmdlen); in tegra_ccm_do_ctr()
1105 return tegra_ccm_ctr_result(se, rctx); in tegra_ccm_do_ctr()
1108 static int tegra_ccm_crypt_init(struct aead_request *req, struct tegra_se *se, in tegra_ccm_crypt_init() argument
1134 writel(0, se->base + se->hw->regs->result + (i * 4)); in tegra_ccm_crypt_init()
1145 struct tegra_se *se = ctx->se; in tegra_ccm_do_one_req() local
1149 rctx->inbuf.buf = dma_alloc_coherent(ctx->se->dev, SE_AES_BUFLEN, in tegra_ccm_do_one_req()
1156 rctx->outbuf.buf = dma_alloc_coherent(ctx->se->dev, SE_AES_BUFLEN, in tegra_ccm_do_one_req()
1165 ret = tegra_ccm_crypt_init(req, se, rctx); in tegra_ccm_do_one_req()
1198 dma_free_coherent(ctx->se->dev, SE_AES_BUFLEN, in tegra_ccm_do_one_req()
1202 dma_free_coherent(ctx->se->dev, SE_AES_BUFLEN, in tegra_ccm_do_one_req()
1205 crypto_finalize_aead_request(ctx->se->engine, req, ret); in tegra_ccm_do_one_req()
1219 rctx->inbuf.buf = dma_alloc_coherent(ctx->se->dev, SE_AES_BUFLEN, in tegra_gcm_do_one_req()
1226 rctx->outbuf.buf = dma_alloc_coherent(ctx->se->dev, SE_AES_BUFLEN, in tegra_gcm_do_one_req()
1268 ret = tegra_gcm_do_verify(ctx->se, rctx); in tegra_gcm_do_one_req()
1271 dma_free_coherent(ctx->se->dev, SE_AES_BUFLEN, in tegra_gcm_do_one_req()
1275 dma_free_coherent(ctx->se->dev, SE_AES_BUFLEN, in tegra_gcm_do_one_req()
1279 crypto_finalize_aead_request(ctx->se->engine, req, ret); in tegra_gcm_do_one_req()
1298 ctx->se = se_alg->se_dev; in tegra_aead_cra_init()
1303 dev_err(ctx->se->dev, "invalid algorithm\n"); in tegra_aead_cra_init()
1353 tegra_key_invalidate(ctx->se, ctx->key_id, ctx->alg); in tegra_aead_cra_exit()
1364 return crypto_transfer_aead_request_to_engine(ctx->se->engine, req); in tegra_aead_crypt()
1383 dev_dbg(ctx->se->dev, "invalid key length (%d)\n", keylen); in tegra_aead_setkey()
1387 return tegra_key_submit(ctx->se, key, keylen, ctx->alg, &ctx->key_id); in tegra_aead_setkey()
1394 struct tegra_se *se = ctx->se; in tegra_cmac_prep_cmd() local
1395 u32 *cpuvaddr = se->cmdbuf->addr, op; in tegra_cmac_prep_cmd()
1413 cpuvaddr[i++] = se_host1x_opcode_incr_w(se->hw->regs->linear_ctr); in tegra_cmac_prep_cmd()
1419 cpuvaddr[i++] = se_host1x_opcode_nonincr(se->hw->regs->last_blk, 1); in tegra_cmac_prep_cmd()
1423 cpuvaddr[i++] = se_host1x_opcode_incr(se->hw->regs->config, 6); in tegra_cmac_prep_cmd()
1434 cpuvaddr[i++] = se_host1x_opcode_nonincr(se->hw->regs->op, 1); in tegra_cmac_prep_cmd()
1439 host1x_uclass_incr_syncpt_indx_f(se->syncpt_id); in tegra_cmac_prep_cmd()
1444 static void tegra_cmac_copy_result(struct tegra_se *se, struct tegra_cmac_reqctx *rctx) in tegra_cmac_copy_result() argument
1449 rctx->result[i] = readl(se->base + se->hw->regs->result + (i * 4)); in tegra_cmac_copy_result()
1452 static void tegra_cmac_paste_result(struct tegra_se *se, struct tegra_cmac_reqctx *rctx) in tegra_cmac_paste_result() argument
1458 se->base + se->hw->regs->result + (i * 4)); in tegra_cmac_paste_result()
1466 struct tegra_se *se = ctx->se; in tegra_cmac_do_update() local
1521 tegra_cmac_paste_result(ctx->se, rctx); in tegra_cmac_do_update()
1525 ret = tegra_se_host1x_submit(se, cmdlen); in tegra_cmac_do_update()
1532 tegra_cmac_copy_result(ctx->se, rctx); in tegra_cmac_do_update()
1542 struct tegra_se *se = ctx->se; in tegra_cmac_do_final() local
1558 ret = tegra_se_host1x_submit(se, cmdlen); in tegra_cmac_do_final()
1564 result[i] = readl(se->base + se->hw->regs->result + (i * 4)); in tegra_cmac_do_final()
1567 writel(0, se->base + se->hw->regs->result + (i * 4)); in tegra_cmac_do_final()
1570 dma_free_coherent(se->dev, SE_SHA_BUFLEN, in tegra_cmac_do_final()
1572 dma_free_coherent(se->dev, crypto_ahash_blocksize(tfm) * 2, in tegra_cmac_do_final()
1583 struct tegra_se *se = ctx->se; in tegra_cmac_do_one_req() local
1596 crypto_finalize_hash_request(se->engine, req, ret); in tegra_cmac_do_one_req()
1609 dev_warn(ctx->se->dev, "failed to allocate fallback for %s\n", algname); in tegra_cmac_init_fallback()
1634 ctx->se = se_alg->se_dev; in tegra_cmac_cra_init()
1639 dev_err(ctx->se->dev, "invalid algorithm\n"); in tegra_cmac_cra_init()
1657 tegra_key_invalidate(ctx->se, ctx->key_id, ctx->alg); in tegra_cmac_cra_exit()
1665 struct tegra_se *se = ctx->se; in tegra_cmac_init() local
1674 rctx->residue.buf = dma_alloc_coherent(se->dev, rctx->blk_size * 2, in tegra_cmac_init()
1681 rctx->datbuf.buf = dma_alloc_coherent(se->dev, SE_SHA_BUFLEN, in tegra_cmac_init()
1690 writel(0, se->base + se->hw->regs->result + (i * 4)); in tegra_cmac_init()
1695 dma_free_coherent(se->dev, rctx->blk_size, rctx->residue.buf, in tegra_cmac_init()
1707 dev_dbg(ctx->se->dev, "invalid key length (%d)\n", keylen); in tegra_cmac_setkey()
1714 return tegra_key_submit(ctx->se, key, keylen, ctx->alg, &ctx->key_id); in tegra_cmac_setkey()
1725 return crypto_transfer_hash_request_to_engine(ctx->se->engine, req); in tegra_cmac_update()
1736 return crypto_transfer_hash_request_to_engine(ctx->se->engine, req); in tegra_cmac_final()
1747 return crypto_transfer_hash_request_to_engine(ctx->se->engine, req); in tegra_cmac_finup()
1759 return crypto_transfer_hash_request_to_engine(ctx->se->engine, req); in tegra_cmac_digest()
1857 int tegra_init_aes(struct tegra_se *se) in tegra_init_aes() argument
1864 se->manifest = tegra_aes_kac_manifest; in tegra_init_aes()
1868 tegra_aes_algs[i].se_dev = se; in tegra_init_aes()
1872 dev_err(se->dev, "failed to register %s\n", in tegra_init_aes()
1880 tegra_aead_algs[i].se_dev = se; in tegra_init_aes()
1884 dev_err(se->dev, "failed to register %s\n", in tegra_init_aes()
1892 tegra_cmac_algs[i].se_dev = se; in tegra_init_aes()
1896 dev_err(se->dev, "failed to register %s\n", in tegra_init_aes()
1921 void tegra_deinit_aes(struct tegra_se *se) in tegra_deinit_aes() argument