mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/chenhuacai/linux-loongson
synced 2025-09-02 16:44:59 +00:00
crypto: hisilicon - fix the check on dma address
System may be able to get physical address of zero if not reserved by firmware. The dma address obtained by 'dma_alloc_coherent' is valid, since already checking cpu va before, so do not check again. Signed-off-by: Hui Tang <tanghui20@huawei.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
parent
ed48466d3f
commit
a9214b0b6e
@ -298,8 +298,6 @@ static void hpre_hw_data_clr_all(struct hpre_ctx *ctx,
|
|||||||
dma_addr_t tmp;
|
dma_addr_t tmp;
|
||||||
|
|
||||||
tmp = le64_to_cpu(sqe->in);
|
tmp = le64_to_cpu(sqe->in);
|
||||||
if (unlikely(!tmp))
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (src) {
|
if (src) {
|
||||||
if (req->src)
|
if (req->src)
|
||||||
@ -309,8 +307,6 @@ static void hpre_hw_data_clr_all(struct hpre_ctx *ctx,
|
|||||||
}
|
}
|
||||||
|
|
||||||
tmp = le64_to_cpu(sqe->out);
|
tmp = le64_to_cpu(sqe->out);
|
||||||
if (unlikely(!tmp))
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (req->dst) {
|
if (req->dst) {
|
||||||
if (dst)
|
if (dst)
|
||||||
@ -1358,15 +1354,11 @@ static void hpre_ecdh_hw_data_clr_all(struct hpre_ctx *ctx,
|
|||||||
dma_addr_t dma;
|
dma_addr_t dma;
|
||||||
|
|
||||||
dma = le64_to_cpu(sqe->in);
|
dma = le64_to_cpu(sqe->in);
|
||||||
if (unlikely(!dma))
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (src && req->src)
|
if (src && req->src)
|
||||||
dma_free_coherent(dev, ctx->key_sz << 2, req->src, dma);
|
dma_free_coherent(dev, ctx->key_sz << 2, req->src, dma);
|
||||||
|
|
||||||
dma = le64_to_cpu(sqe->out);
|
dma = le64_to_cpu(sqe->out);
|
||||||
if (unlikely(!dma))
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (req->dst)
|
if (req->dst)
|
||||||
dma_free_coherent(dev, ctx->key_sz << 1, req->dst, dma);
|
dma_free_coherent(dev, ctx->key_sz << 1, req->dst, dma);
|
||||||
@ -1657,15 +1649,11 @@ static void hpre_curve25519_hw_data_clr_all(struct hpre_ctx *ctx,
|
|||||||
dma_addr_t dma;
|
dma_addr_t dma;
|
||||||
|
|
||||||
dma = le64_to_cpu(sqe->in);
|
dma = le64_to_cpu(sqe->in);
|
||||||
if (unlikely(!dma))
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (src && req->src)
|
if (src && req->src)
|
||||||
dma_free_coherent(dev, ctx->key_sz, req->src, dma);
|
dma_free_coherent(dev, ctx->key_sz, req->src, dma);
|
||||||
|
|
||||||
dma = le64_to_cpu(sqe->out);
|
dma = le64_to_cpu(sqe->out);
|
||||||
if (unlikely(!dma))
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (req->dst)
|
if (req->dst)
|
||||||
dma_free_coherent(dev, ctx->key_sz, req->dst, dma);
|
dma_free_coherent(dev, ctx->key_sz, req->dst, dma);
|
||||||
|
@ -2681,7 +2681,7 @@ static int __hisi_qm_start(struct hisi_qm *qm)
|
|||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
WARN_ON(!qm->qdma.dma);
|
WARN_ON(!qm->qdma.va);
|
||||||
|
|
||||||
if (qm->fun_type == QM_HW_PF) {
|
if (qm->fun_type == QM_HW_PF) {
|
||||||
ret = qm_dev_mem_reset(qm);
|
ret = qm_dev_mem_reset(qm);
|
||||||
|
@ -708,12 +708,6 @@ static int sec_cipher_pbuf_map(struct sec_ctx *ctx, struct sec_req *req,
|
|||||||
}
|
}
|
||||||
|
|
||||||
c_req->c_in_dma = qp_ctx->res[req_id].pbuf_dma;
|
c_req->c_in_dma = qp_ctx->res[req_id].pbuf_dma;
|
||||||
|
|
||||||
if (!c_req->c_in_dma) {
|
|
||||||
dev_err(dev, "fail to set pbuffer address!\n");
|
|
||||||
return -ENOMEM;
|
|
||||||
}
|
|
||||||
|
|
||||||
c_req->c_out_dma = c_req->c_in_dma;
|
c_req->c_out_dma = c_req->c_in_dma;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user