Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp2727892ybh; Fri, 24 Jul 2020 23:10:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzN7lStLP6sJIaAapCAvmUd92P/vhGEcmTARtRL0KkAcL8Rt3ScNDOOvcFkRx+voHx9hgwi X-Received: by 2002:a17:906:c453:: with SMTP id ck19mr12053796ejb.185.1595657411014; Fri, 24 Jul 2020 23:10:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595657411; cv=none; d=google.com; s=arc-20160816; b=CBRbXP8hICmy1G7pHdb41IXBc5lmFPHhaqsafZ5eGV4wPsoWJVW45qX33E5omk6Y75 PBGSYVIN1rvhx+BmQE4YyqNRFU+ibdgx1tr1bRFgDRvqcHOqYrKIm6fnJKPlOiWwYafb joiXsuybdCdSmkELWwollTdPK9M795UBvYAiXZDKXtVfPo5GAaidXF51bCF6pptDK9Oj SyLrvhNQ24jhSjRM+6eHVAaCcKfow2yFeD6BwoYK3m3TyQDSzlO6b8Gjg/EGqZITunll SECGvVPkgk1N6SOfxsfn8pZjAqY3qkGDDuCZBPoa9GxxCZmiXSUgHuYZ69CVz2AyESX7 5K5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=FiVa3n3DrpwHm3pP+0Iwp8p5DNDgaymGbSTn86thi0M=; b=wFMXtdnYBU8HqLGP/6VsKdqeQe3SOXtUxqe4VZ9q+rfcjUpwp0V3y9Xc13P5NKX8SI mAqMzVa5ZjB3iQCoEAMRi6+b08NIbGenmDUNpGWPcOFhILfmtG5O8/wGH7boPY0WPIy7 G3t7J+dxxzWrCwGDm8QPfBogF3zzS9wwlrUaI9Q/8rXH9VnLYLwvqBsGdtoJwMHx8vqU M1fWImk+gJotFT12qvyjYq6FtFMXxzINwO0rRf6M1O11MH7MG7XxaBMK/hB/O1fObHPo 45azRsDmQVdFFhC2BVU/cp/CdRRxISRoCJXoFWiCIJQ0BcIAu9XyoIR+osA6YmRrEsv5 9Btw== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h24si1749854edv.128.2020.07.24.23.09.32; Fri, 24 Jul 2020 23:10:11 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726674AbgGYGJb (ORCPT + 99 others); Sat, 25 Jul 2020 02:09:31 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:33166 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726273AbgGYGJb (ORCPT ); Sat, 25 Jul 2020 02:09:31 -0400 Received: from DGGEMS402-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 90B9B8DFA25E9798270F; Sat, 25 Jul 2020 14:09:28 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by DGGEMS402-HUB.china.huawei.com (10.3.19.202) with Microsoft SMTP Server id 14.3.487.0; Sat, 25 Jul 2020 14:09:20 +0800 From: Yang Shen To: , CC: , , , Subject: [PATCH 1/4] crypto: hisilicon/zip - fix the uncleared debug registers Date: Sat, 25 Jul 2020 14:06:47 +0800 Message-ID: <1595657210-3964-2-git-send-email-shenyang39@huawei.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1595657210-3964-1-git-send-email-shenyang39@huawei.com> References: <1595657210-3964-1-git-send-email-shenyang39@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.69.192.56] X-CFilter-Loop: Reflected Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org From: Hao Fang ZIP debug registers aren't cleared even if its driver is removed, so add a clearing operation when remove driver. Signed-off-by: Hao Fang Signed-off-by: Yang Shen Reviewed-by: Zhou Wang --- drivers/crypto/hisilicon/zip/zip_main.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/drivers/crypto/hisilicon/zip/zip_main.c b/drivers/crypto/hisilicon/zip/zip_main.c index 8bbae28..cc4a829 100644 --- a/drivers/crypto/hisilicon/zip/zip_main.c +++ b/drivers/crypto/hisilicon/zip/zip_main.c @@ -91,6 +91,11 @@ #define HZIP_SQE_MASK_OFFSET 64 #define HZIP_SQE_MASK_LEN 48 +#define HZIP_CNT_CLR_CE_EN BIT(0) +#define HZIP_RO_CNT_CLR_CE_EN BIT(2) +#define HZIP_RD_CNT_CLR_CE_EN (HZIP_CNT_CLR_CE_EN | \ + HZIP_RO_CNT_CLR_CE_EN) + static const char hisi_zip_name[] = "hisi_zip"; static struct dentry *hzip_debugfs_root; @@ -606,10 +611,23 @@ static int hisi_zip_debugfs_init(struct hisi_qm *qm) return ret; } +/* hisi_zip_debug_regs_clear() - clear the zip debug regs */ static void hisi_zip_debug_regs_clear(struct hisi_qm *qm) { + int i, j; + + /* clear current_qm */ writel(0x0, qm->io_base + QM_DFX_MB_CNT_VF); writel(0x0, qm->io_base + QM_DFX_DB_CNT_VF); + + /* enable register read_clear bit */ + writel(HZIP_RD_CNT_CLR_CE_EN, qm->io_base + HZIP_SOFT_CTRL_CNT_CLR_CE); + for (i = 0; i < ARRAY_SIZE(core_offsets); i++) + for (j = 0; j < ARRAY_SIZE(hzip_dfx_regs); j++) + readl(qm->io_base + core_offsets[i] + + hzip_dfx_regs[j].offset); + + /* disable register read_clear bit */ writel(0x0, qm->io_base + HZIP_SOFT_CTRL_CNT_CLR_CE); hisi_qm_debug_regs_clear(qm); -- 2.7.4