Message ID | 20221119095003.10802-1-qianweili@huawei.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp641708wrr; Sat, 19 Nov 2022 02:13:05 -0800 (PST) X-Google-Smtp-Source: AA0mqf7p5myrM3FaXNoEzBL6kwG3uDY0ev/ESxa8n9Axx8h4uFjeSsFgvWL+j5Owheo/6oF++JQU X-Received: by 2002:a05:6402:180f:b0:469:658:303b with SMTP id g15-20020a056402180f00b004690658303bmr6276320edy.207.1668852785577; Sat, 19 Nov 2022 02:13:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668852785; cv=none; d=google.com; s=arc-20160816; b=rXOGLh6znOP3toRiqUrTSxkGuJbZDMSkQMDffXkF/trN8uEDfA/cBrNGZfMdRDhh5b wiYcAmn0ZdLxdrIEn4ErzMyZal5gpy2eI+cm6t8Of0XWYWB9u8bzU9bJkVThp8Rw5g5w DW54XPvCuDT4YkmGKnipKXO5KF4q27zghgTZO6wPD2ZiobTTGI8tgQeSYinaD1f7OESJ VxI2RrE3MKke8PXFSVbi5yfpGj09TlI5J8SA7LDlq8pApT1yDkPDaRoH+2WgXQs8XoTY YI94CrFYhl3Ch+myIIAVC/VFc9jjpzM9GVwpGSHY174O1+H9/9PAHuINO761fvgEcqT8 qqUw== 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=lHQipsyHSMcpQupWUj9xoLyih8QH5SPQkQ2rCEMp04w=; b=PLe+eHlADRVWWtNolGfljF6vlBec+GNVGFMe+YRtp5yX74ySZk3QMWVxhrOb9gCUUC 66TxCOgXro70tFG5S/B7U1h983XgwMjR+FdoegOLr4h9H80z/oHIpOIO3lqtMJOAfrh8 i/42GS/yUkMQCKT0m7nBhcqUdu6LwKeJL0QRhwCSWUnHee38EfStfjFGLnuSzBuoNbzq kZfrMxYVbRzthu/sl6M6MV+hkiibhJvY5izIfvHES3j1dZQOmjOpzafsp92DanUP9T6s pylj0S5vJ8dBr7d9iHr00s2mpZkqTxxOIhEryiSzTEuIhlm5OAOWxpkbIQky6j1wz+lh reuw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t1-20020a170906268100b0073c0169863dsi4060267ejc.465.2022.11.19.02.12.40; Sat, 19 Nov 2022 02:13:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233069AbiKSJtq (ORCPT <rfc822;kkmonlee@gmail.com> + 99 others); Sat, 19 Nov 2022 04:49:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33566 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230244AbiKSJto (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Sat, 19 Nov 2022 04:49:44 -0500 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 452B375D8E; Sat, 19 Nov 2022 01:49:43 -0800 (PST) Received: from dggemv703-chm.china.huawei.com (unknown [172.30.72.53]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4NDph54zZVzFqQC; Sat, 19 Nov 2022 17:46:29 +0800 (CST) Received: from kwepemm600009.china.huawei.com (7.193.23.164) by dggemv703-chm.china.huawei.com (10.3.19.46) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Sat, 19 Nov 2022 17:49:41 +0800 Received: from localhost.localdomain (10.69.192.56) by kwepemm600009.china.huawei.com (7.193.23.164) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Sat, 19 Nov 2022 17:49:40 +0800 From: Weili Qian <qianweili@huawei.com> To: <herbert@gondor.apana.org.au> CC: <linux-kernel@vger.kernel.org>, <linux-crypto@vger.kernel.org>, <wangzhou1@hisilicon.com>, <liulongfang@huawei.com> Subject: [PATCH] crypto: hisilicon/qm - add device status check when start fails Date: Sat, 19 Nov 2022 17:50:03 +0800 Message-ID: <20221119095003.10802-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: dggems703-chm.china.huawei.com (10.3.19.180) To kwepemm600009.china.huawei.com (7.193.23.164) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749918978196937167?= X-GMAIL-MSGID: =?utf-8?q?1749918978196937167?= |
Series |
crypto: hisilicon/qm - add device status check when start fails
|
|
Commit Message
Weili Qian
Nov. 19, 2022, 9:50 a.m. UTC
In function 'hisi_qm_resume', if the device fails to be started,
directly returning error code will cause the device to be unavailable.
However, the failure may be caused by device error, which will be
reported to the driver, and driver can reset and restart device.
Therefore, check device status instead of returning error code
directly. Returns 0 if device error has occurred, otherwise returns
error code.
Signed-off-by: Weili Qian <qianweili@huawei.com>
---
drivers/crypto/hisilicon/qm.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
Comments
On Sat, Nov 19, 2022 at 05:50:03PM +0800, Weili Qian wrote: > In function 'hisi_qm_resume', if the device fails to be started, > directly returning error code will cause the device to be unavailable. > However, the failure may be caused by device error, which will be > reported to the driver, and driver can reset and restart device. > Therefore, check device status instead of returning error code > directly. Returns 0 if device error has occurred, otherwise returns > error code. > > Signed-off-by: Weili Qian <qianweili@huawei.com> > --- > drivers/crypto/hisilicon/qm.c | 10 ++++++++-- > 1 file changed, 8 insertions(+), 2 deletions(-) Patch applied. Thanks.
diff --git a/drivers/crypto/hisilicon/qm.c b/drivers/crypto/hisilicon/qm.c index 9072bee7336f..007ac7a69ce7 100644 --- a/drivers/crypto/hisilicon/qm.c +++ b/drivers/crypto/hisilicon/qm.c @@ -5468,8 +5468,14 @@ int hisi_qm_resume(struct device *dev) } ret = hisi_qm_start(qm); - if (ret) - pci_err(pdev, "failed to start qm(%d)\n", ret); + if (ret) { + if (qm_check_dev_error(qm)) { + pci_info(pdev, "failed to start qm due to device error, device will be reset!\n"); + return 0; + } + + pci_err(pdev, "failed to start qm(%d)!\n", ret); + } return ret; }