Received: by 2002:a05:7412:a9a2:b0:e2:908c:2ebd with SMTP id o34csp1688217rdh; Sat, 28 Oct 2023 03:23:19 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGQVa8WhC1sBnvRNLZkdiX9L5DeyY3QuQfLNrAerkPZJSJeNbnX5Yi9CLrwdWPYOOTQsqk4 X-Received: by 2002:a17:902:d4cb:b0:1c4:3294:74ca with SMTP id o11-20020a170902d4cb00b001c4329474camr5366228plg.17.1698488599246; Sat, 28 Oct 2023 03:23:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698488599; cv=none; d=google.com; s=arc-20160816; b=ZSzA8TzJW8nbFqZBYCzvfPAYWfPIO23yBCkG8McRqQhFBiaz9o+tbrpEMvp/fSXsp1 zcBduxIYRLbmQqAyVobMcO+mHyL67FkM36SifVCsHgO36Pswrl2ioxgjml5lnKCB1qjn ocUFaHa142c6Y7F2Zj5MemLr6k3L4V0IUoMGmja/t8N85w9Y1CijDnYh4ebo0LUwsHEb 2D0vIiXNIDC6CpdMVu4RiDIHWRcH9286AelQuojl2Ti5TQxpeOKFnc9D7GRAl9CPUZiv 0tA1foKRFfUUT++YFH/Nl9PnlXM66xk+36fiB5z9XlF0ebBC9/YtSb9ODvSQej+erYxa kz5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=Ry+/skJOOtwtPS/dCWukGcc2pULdt4tgrLGsfXJApuE=; fh=NUAlJo3HXSCQJJ3D0jNblauZVXsBmhXHFqwj3slIsi4=; b=kcmMzqU56FmkvYMSUCcame8oxAZq65CRwIj/hg9BTuD3JvEwfLTyhs/qY4ExCe1VYh k1tdcSmBsgI2zOoYU9PIPZRA8EdIUSfEG1VMmdktJjON3FrNPZKpyhJ1knKBCHw3Wj/h p17SnpcvrrAtJnWguMA4bFKB2MKRWnQZlwcvUUbUcVstOPQdz8s7b/FQfBy5Jn7l+rQg AxiGY0ZPEH10+e/2PO8cqRYDlodmg6l9YPuATzUbTOnOaeQp1bBBJVExA56gudVNF6iE utWgYHr6E4A59AI1i1C6zUtneTiT38NZFmIrLdsIJ+MTHgKRVK2g65mUuS9mdtVdnb47 LCCA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id h17-20020a170902f2d100b001cbd8dafabfsi2333734plc.567.2023.10.28.03.23.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 Oct 2023 03:23:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id D4CC18057E7F; Sat, 28 Oct 2023 03:23:15 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229774AbjJ1KWm (ORCPT + 99 others); Sat, 28 Oct 2023 06:22:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59430 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229736AbjJ1KWl (ORCPT ); Sat, 28 Oct 2023 06:22:41 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 26FAFE5; Sat, 28 Oct 2023 03:22:38 -0700 (PDT) Received: from kwepemm000009.china.huawei.com (unknown [172.30.72.53]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4SHb7m371wzpWWH; Sat, 28 Oct 2023 18:17:40 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by kwepemm000009.china.huawei.com (7.193.23.227) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Sat, 28 Oct 2023 18:22:35 +0800 From: Weili Qian To: CC: , , , Weili Qian Subject: [PATCH] crypto: hisilicon/qm - print device abnormal information Date: Sat, 28 Oct 2023 18:22:44 +0800 Message-ID: <20231028102244.43918-1-qianweili@huawei.com> X-Mailer: git-send-email 2.33.0 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.69.192.56] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To kwepemm000009.china.huawei.com (7.193.23.227) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Sat, 28 Oct 2023 03:23:16 -0700 (PDT) When device is abnormal and reports abnormal interrupt event to driver, the driver can print device information for error analysis. This patch adds some device error-related information output after the device reports an abnormal interrupt. Signed-off-by: Weili Qian --- drivers/crypto/hisilicon/qm.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/drivers/crypto/hisilicon/qm.c b/drivers/crypto/hisilicon/qm.c index 18599f3634c3..4d91a249be74 100644 --- a/drivers/crypto/hisilicon/qm.c +++ b/drivers/crypto/hisilicon/qm.c @@ -129,16 +129,21 @@ #define QM_FIFO_OVERFLOW_TYPE 0xc0 #define QM_FIFO_OVERFLOW_TYPE_SHIFT 6 #define QM_FIFO_OVERFLOW_VF 0x3f +#define QM_FIFO_OVERFLOW_QP_SHIFT 16 #define QM_ABNORMAL_INF01 0x100014 #define QM_DB_TIMEOUT_TYPE 0xc0 #define QM_DB_TIMEOUT_TYPE_SHIFT 6 #define QM_DB_TIMEOUT_VF 0x3f +#define QM_DB_TIMEOUT_QP_SHIFT 16 +#define QM_ABNORMAL_INF02 0x100018 +#define QM_AXI_POISON_ERR BIT(22) #define QM_RAS_CE_ENABLE 0x1000ec #define QM_RAS_FE_ENABLE 0x1000f0 #define QM_RAS_NFE_ENABLE 0x1000f4 #define QM_RAS_CE_THRESHOLD 0x1000f8 #define QM_RAS_CE_TIMES_PER_IRQ 1 #define QM_OOO_SHUTDOWN_SEL 0x1040f8 +#define QM_AXI_RRESP_ERR BIT(0) #define QM_ECC_MBIT BIT(2) #define QM_DB_TIMEOUT BIT(10) #define QM_OF_FIFO_OF BIT(11) @@ -1406,7 +1411,7 @@ static void qm_log_hw_error(struct hisi_qm *qm, u32 error_status) { const struct hisi_qm_hw_error *err; struct device *dev = &qm->pdev->dev; - u32 reg_val, type, vf_num; + u32 reg_val, type, vf_num, qp_id; int i; for (i = 0; i < ARRAY_SIZE(qm_hw_error); i++) { @@ -1422,19 +1427,24 @@ static void qm_log_hw_error(struct hisi_qm *qm, u32 error_status) type = (reg_val & QM_DB_TIMEOUT_TYPE) >> QM_DB_TIMEOUT_TYPE_SHIFT; vf_num = reg_val & QM_DB_TIMEOUT_VF; - dev_err(dev, "qm %s doorbell timeout in function %u\n", - qm_db_timeout[type], vf_num); + qp_id = reg_val >> QM_DB_TIMEOUT_QP_SHIFT; + dev_err(dev, "qm %s doorbell timeout in function %u qp %u\n", + qm_db_timeout[type], vf_num, qp_id); } else if (err->int_msk & QM_OF_FIFO_OF) { reg_val = readl(qm->io_base + QM_ABNORMAL_INF00); type = (reg_val & QM_FIFO_OVERFLOW_TYPE) >> QM_FIFO_OVERFLOW_TYPE_SHIFT; vf_num = reg_val & QM_FIFO_OVERFLOW_VF; - + qp_id = reg_val >> QM_FIFO_OVERFLOW_QP_SHIFT; if (type < ARRAY_SIZE(qm_fifo_overflow)) - dev_err(dev, "qm %s fifo overflow in function %u\n", - qm_fifo_overflow[type], vf_num); + dev_err(dev, "qm %s fifo overflow in function %u qp %u\n", + qm_fifo_overflow[type], vf_num, qp_id); else dev_err(dev, "unknown error type\n"); + } else if (err->int_msk & QM_AXI_RRESP_ERR) { + reg_val = readl(qm->io_base + QM_ABNORMAL_INF02); + if (reg_val & QM_AXI_POISON_ERR) + dev_err(dev, "qm axi poison error happened\n"); } } } -- 2.33.0