Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp2283465ybl; Sun, 19 Jan 2020 23:31:01 -0800 (PST) X-Google-Smtp-Source: APXvYqyJDb0XOr10E0uUW2AR0FRJ4tE4hvcbjTNfZ3Eq3mdDoptGEUGYtwzUZ4BE2J3o6G2u0ZWS X-Received: by 2002:a9d:60c4:: with SMTP id b4mr15313669otk.166.1579505460931; Sun, 19 Jan 2020 23:31:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579505460; cv=none; d=google.com; s=arc-20160816; b=UPe2/GbiiSxepQJhyU1x+EJ4wL2AYi2YxVkhQCYX2hHLj+o9qWDdSIChfdS9OBR5xS 1wIF7le1WDNtdfkYx+Tju1dF6u3brXBWAbRe/VxXgjhPwy5zJEK9Wx/01pImhby6q9LI QqbYYqT6o49myFR22mBRwgCLSmMMExbmKv5jmVGJemWTEs2PjxcFQWKOD1z+nO4z5QS4 hzMWhxeNhouiNs6oJoraZNk7zhQfEYPRu1UkS2YJINaLf0m2KfSqD0r34BdzIWDA+vpf mMFfEE88hfrHLeRjdkHqYEEE+u9ox2r/a63BHI9PzwTcZWNXY+lSOKfkIK9QGDtN5R8a GndA== 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=Iw+GI6dDfc+dEore/afSxEQ1CSwAkaQ+ls8VJhssJHw=; b=Rq6MCyutYXCVrKczJDZ5t/juIbb1NJAkVTzesF4teS5ikc2n4U5bCV3ndDllWGa5pE x5m/2I3h7R9D76w8WMuYfOJApDiVzkRY84X8lTHbmulwOnsYIok1RPReFXO96tih6JBA nyFnluTKZ7cGjFKItysVeg8abZwFwufWj8e111biq4ixUg99MqMBa54lOBMTkdKLQrVl GtlUwsRUWDwj3js59FGQdu2hYwxLQL/Sb/Qk47nsATYyCTHpKrp0IuRq8RBbkpjdEF5b RILTyHl/sBIC8F6P7wIkB6dBsKDH3jkycS1Zqn5+sT6TfPuZOTFNH8jj2xZjH8boDbV+ 7S5A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r82si16474823oia.36.2020.01.19.23.30.25; Sun, 19 Jan 2020 23:31:00 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726619AbgATHaY (ORCPT + 99 others); Mon, 20 Jan 2020 02:30:24 -0500 Received: from szxga06-in.huawei.com ([45.249.212.32]:43072 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726089AbgATHaY (ORCPT ); Mon, 20 Jan 2020 02:30:24 -0500 Received: from DGGEMS407-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id C58CA76E02C39FD2C868; Mon, 20 Jan 2020 15:30:22 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by DGGEMS407-HUB.china.huawei.com (10.3.19.207) with Microsoft SMTP Server id 14.3.439.0; Mon, 20 Jan 2020 15:30:12 +0800 From: Shukun Tan To: , CC: , Subject: [PATCH 4/4] crypto: hisilicon: Fix duplicate print when qm occur multiple errors Date: Mon, 20 Jan 2020 15:30:09 +0800 Message-ID: <1579505409-3776-5-git-send-email-tanshukun1@huawei.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1579505409-3776-1-git-send-email-tanshukun1@huawei.com> References: <1579505409-3776-1-git-send-email-tanshukun1@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 If all possible errors occurs at the same time, the error_status will be all 1s. The doorbell timeout error and FIFO overflow error will be print in each cycle, which should be print just once. Signed-off-by: Shukun Tan Reviewed-by: Zhou Wang --- drivers/crypto/hisilicon/qm.c | 59 ++++++++++++++++++++----------------------- 1 file changed, 28 insertions(+), 31 deletions(-) diff --git a/drivers/crypto/hisilicon/qm.c b/drivers/crypto/hisilicon/qm.c index 2c0e22f..79f84dc6 100644 --- a/drivers/crypto/hisilicon/qm.c +++ b/drivers/crypto/hisilicon/qm.c @@ -1019,41 +1019,38 @@ static void qm_hw_error_uninit_v2(struct hisi_qm *qm) static void qm_log_hw_error(struct hisi_qm *qm, u32 error_status) { - const struct hisi_qm_hw_error *err = qm_hw_error; + const struct hisi_qm_hw_error *err; struct device *dev = &qm->pdev->dev; u32 reg_val, type, vf_num; + int i; - while (err->msg) { - if (err->int_msk & error_status) { - dev_err(dev, "%s [error status=0x%x] found\n", - err->msg, err->int_msk); - - if (error_status & QM_DB_TIMEOUT) { - reg_val = readl(qm->io_base + - QM_ABNORMAL_INF01); - 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); - } - - if (error_status & 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; - - if (type < ARRAY_SIZE(qm_fifo_overflow)) - dev_err(dev, "qm %s fifo overflow in function %u\n", - qm_fifo_overflow[type], - vf_num); - else - dev_err(dev, "unknown error type\n"); - } + for (i = 0; i < ARRAY_SIZE(qm_hw_error); i++) { + err = &qm_hw_error[i]; + if (!(err->int_msk & error_status)) + continue; + + dev_err(dev, "%s [error status=0x%x] found\n", + err->msg, err->int_msk); + + if (err->int_msk & QM_DB_TIMEOUT) { + reg_val = readl(qm->io_base + QM_ABNORMAL_INF01); + 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); + } 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; + + if (type < ARRAY_SIZE(qm_fifo_overflow)) + dev_err(dev, "qm %s fifo overflow in function %u\n", + qm_fifo_overflow[type], vf_num); + else + dev_err(dev, "unknown error type\n"); } - err++; } } -- 2.7.4