Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp2032453pxf; Sat, 27 Mar 2021 00:36:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxyTlVJP6xvPKUDWaWpEHAxviHwYNdI3i8c2R8gmIKa4Q8X41lQZ+8jNeAGvjeocw4tzkSE X-Received: by 2002:a17:907:50a1:: with SMTP id fv33mr1971209ejc.14.1616830561526; Sat, 27 Mar 2021 00:36:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616830561; cv=none; d=google.com; s=arc-20160816; b=xW1mupe92MdD6soz2ax82mHgjRLs16fgdYW0hRGGbV69h/U8vkV0tLz8Am+IHIY5UY LbYmG2kkitE+WbDnG7sitSqbDdqGgofKoh+38+2wfxOEJE8OJLCtdRkMFgF6tK2kRxf1 P12TbVn2Br1JwRxMeHSgTfVyGvCQoZ6c9N5x/k5yGz6Ped/E2ehnAydHH/ZLHr1kYkQn wgatFBG8pOW3iAoM47LanaXcAmBYBYy1hPHTbpjxJB8dvOtd/8clPjv2EcnvDFEXoDfe mDr8qiF/4aNH1yatQQSPgWxkgpGOcoJrQebJ69CkKoiRdCyBleYcOEVXpU+xOPW9x+pq H0rw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=w976SGH+6+EoiBADKYfgCVr30mt+lfRvS0mcHg+f+Wo=; b=RO9VdQ9kClHUXjTLH3sMQ/XsAuGWacj7/7rfYYrGSz86AcNvwAh4S6qHPnl81gGmR5 3yo+E5SE7eCHNvUnz9QGdz09wAWBbAHZ7NLgyzAN6O1DOcuXJ/qs77Blbm/5vb/js/df 5hIJ/i30P/oeNbc5pG5+phpWTCItaDP8X4MipJlqHEDH2H8W47EG4MXKrUKQd1P//CW5 pi4ATf1vIWLZaxmVgobNbHuHVdhsBD24QHINXkFyrilV5AxxRnBRpihLH3U+Uo6zpNYx QgZc1w+pFcaHzx2r++DNkohj9D/ctZVisBRLBAs36mG5aew4c+Xsty2Htu+gUSElIVEt piVg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t18si8844959edr.399.2021.03.27.00.35.38; Sat, 27 Mar 2021 00:36:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230503AbhC0Hb7 (ORCPT + 99 others); Sat, 27 Mar 2021 03:31:59 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:14158 "EHLO szxga04-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230236AbhC0Hbd (ORCPT ); Sat, 27 Mar 2021 03:31:33 -0400 Received: from DGGEMS406-HUB.china.huawei.com (unknown [172.30.72.58]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4F6r785BLhzndXB; Sat, 27 Mar 2021 15:28:52 +0800 (CST) Received: from localhost.localdomain (10.67.165.24) by DGGEMS406-HUB.china.huawei.com (10.3.19.206) with Microsoft SMTP Server id 14.3.498.0; Sat, 27 Mar 2021 15:31:21 +0800 From: Yang Shen To: , CC: , , Subject: [PATCH v2 4/4] crypto: hisilicon/zip - support new 'sqe' type in Kunpeng930 Date: Sat, 27 Mar 2021 15:28:48 +0800 Message-ID: <1616830128-46827-5-git-send-email-shenyang39@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1616830128-46827-1-git-send-email-shenyang39@huawei.com> References: <1616830128-46827-1-git-send-email-shenyang39@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.67.165.24] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org The Kunpeng930 changes some field meanings in 'sqe'. So add a new 'hisi_zip_sqe_ops' to describe the 'sqe' operations. Signed-off-by: Yang Shen --- drivers/crypto/hisilicon/zip/zip.h | 1 + drivers/crypto/hisilicon/zip/zip_crypto.c | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/drivers/crypto/hisilicon/zip/zip.h b/drivers/crypto/hisilicon/zip/zip.h index b4d3e03..517fdbd 100644 --- a/drivers/crypto/hisilicon/zip/zip.h +++ b/drivers/crypto/hisilicon/zip/zip.h @@ -75,6 +75,7 @@ struct hisi_zip_sqe { u32 dw23; u32 dw24; u32 dw25; + /* tag: in sqe type 3 */ u32 dw26; u32 dw27; u32 rsvd1[4]; diff --git a/drivers/crypto/hisilicon/zip/zip_crypto.c b/drivers/crypto/hisilicon/zip/zip_crypto.c index 466ebf1..9520a41 100644 --- a/drivers/crypto/hisilicon/zip/zip_crypto.c +++ b/drivers/crypto/hisilicon/zip/zip_crypto.c @@ -298,6 +298,11 @@ static void hisi_zip_fill_tag_v1(struct hisi_zip_sqe *sqe, struct hisi_zip_req * sqe->dw13 = req->req_id; } +static void hisi_zip_fill_tag_v2(struct hisi_zip_sqe *sqe, struct hisi_zip_req *req) +{ + sqe->dw26 = req->req_id; +} + static void hisi_zip_fill_sqe_type(struct hisi_zip_sqe *sqe, u8 sqe_type) { u32 val; @@ -380,6 +385,11 @@ static u32 hisi_zip_get_tag_v1(struct hisi_zip_sqe *sqe) return sqe->dw13; } +static u32 hisi_zip_get_tag_v2(struct hisi_zip_sqe *sqe) +{ + return sqe->dw26; +} + static u32 hisi_zip_get_status(struct hisi_zip_sqe *sqe) { return sqe->dw3 & HZIP_BD_STATUS_M; @@ -527,6 +537,19 @@ static const struct hisi_zip_sqe_ops hisi_zip_ops_v1 = { .get_dstlen = hisi_zip_get_dstlen, }; +static const struct hisi_zip_sqe_ops hisi_zip_ops_v2 = { + .sqe_type = 0x3, + .fill_addr = hisi_zip_fill_addr, + .fill_buf_size = hisi_zip_fill_buf_size, + .fill_buf_type = hisi_zip_fill_buf_type, + .fill_req_type = hisi_zip_fill_req_type, + .fill_tag = hisi_zip_fill_tag_v2, + .fill_sqe_type = hisi_zip_fill_sqe_type, + .get_tag = hisi_zip_get_tag_v2, + .get_status = hisi_zip_get_status, + .get_dstlen = hisi_zip_get_dstlen, +}; + static int hisi_zip_ctx_init(struct hisi_zip_ctx *hisi_zip_ctx, u8 req_type, int node) { struct hisi_qp *qps[HZIP_CTX_Q_NUM] = { NULL }; @@ -560,6 +583,8 @@ static int hisi_zip_ctx_init(struct hisi_zip_ctx *hisi_zip_ctx, u8 req_type, int if (hisi_zip->qm.ver < QM_HW_V3) hisi_zip_ctx->ops = &hisi_zip_ops_v1; + else + hisi_zip_ctx->ops = &hisi_zip_ops_v2; return 0; } -- 2.8.1