Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp1498350iog; Tue, 14 Jun 2022 07:16:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwUtrgqt8FTX2XCY1qxCG9/DbLq7avoHn3ZKjBj0plGKTZwCcK8sM9B588BBlbO4Z8cJko3 X-Received: by 2002:a63:4b20:0:b0:401:ae11:2593 with SMTP id y32-20020a634b20000000b00401ae112593mr4600750pga.375.1655216181418; Tue, 14 Jun 2022 07:16:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655216181; cv=none; d=google.com; s=arc-20160816; b=eHdkINLF/U0u4ZyY/DnVCVQMLjRpaUaa/mTlZOzRqX6BAhisO4YwsOi/+1AAMp72wk ZlXXPgcL6vBmr8LSgMh/HIF2fxTtR0i/acfERxY6AlcsB7q21+sebfEWpbt9spyaeUpS 0a+5qTpK1NqitvXnejZl8osTOQKeS1INy6x/6COsSsgxnzcvqBmmKGrE13aFdABuBL6R NUvufr1dZZjQYtZdjQ1Fl+VwImDlKTpDKwbUe6Ml9Kt/Q2/1Ak8oK4JMxjdcHtqrvO/q Hfy/T8nP39KztIVrUNvF4ACdDcW0A5WNKEQvtaeNdxHJDMY5tRyhkBr4kJ0y8J6k8XZH gOIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-language:content-transfer-encoding :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=wt50VBwjqpTS+/G8tO4GidOfAF7iUzFpw0Pr+oMctoQ=; b=B0J7gJJHDpzsWn4yLUxS8pLGoU/2KgjyZuLq5zZybgnbIXfBHeFiwH4cHNEnUxX4YO nex3b9PWHl2r7dVpsfMKwYi5TdIuQOjCXIaCNHO9pnGkmd8PgEwp0sYXxvUGoJy4Jw6D LkAwuyqezrhhys6Fq0H1/NKuVEeF3gnDp906gI0o+Q1tVpRJG1TTvQ5DeoWVOO5T1rSk tn1cQ0aY+7E7BRFGDzGUBGwEQMnPjkNSzC954ZD+1lOcYo+WgLQ6o1mE9e5eIVwlG91F QHPwoaQeuf+9xxZ1lgCAfkWGmGcnGNUIyDSuRoY29GKrWc3LkonRTzM/iMzxLISvPZMa 2Aig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=w17NCk5v; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h10-20020a170902b94a00b001569aeb7516si13064633pls.543.2022.06.14.07.15.42; Tue, 14 Jun 2022 07:16:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-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; dkim=pass header.i=@linaro.org header.s=google header.b=w17NCk5v; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236262AbiFNOMQ (ORCPT + 99 others); Tue, 14 Jun 2022 10:12:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54514 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235039AbiFNOMP (ORCPT ); Tue, 14 Jun 2022 10:12:15 -0400 Received: from mail-pl1-x62f.google.com (mail-pl1-x62f.google.com [IPv6:2607:f8b0:4864:20::62f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 478CA33884 for ; Tue, 14 Jun 2022 07:12:14 -0700 (PDT) Received: by mail-pl1-x62f.google.com with SMTP id d5so5250929plo.12 for ; Tue, 14 Jun 2022 07:12:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=wt50VBwjqpTS+/G8tO4GidOfAF7iUzFpw0Pr+oMctoQ=; b=w17NCk5v7hTrKT98JalJHGiwkZUnysDrIOt0xIL+ZfgmulN2Pe7Y44CgfGG9uiWDQf t4E+EOVCM04+uOCFXCRa7SS1ehi2ga6R8OqpTHT45228US8eYJ4w+wIIbwc9UIdi2Lf6 q7iU/oCE7khTKZk0S9NTDBXTOQcrOPEflJqIEmIaB0o+J8JOGvp//Wv9utdmXloEgDkY 0UEXuitlJReGMKuUpICVPV/DgSXwnVwIHtKQ3xm8ffsyJIQYFRDqQRRHooKvg80U4fdG G+eMNmTEaXA85UFcw6A1FGTbgP2hIKYKLBFTwzyopOTYKUAKWW/TzSVtM0VIU3CoNGAw L1/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=wt50VBwjqpTS+/G8tO4GidOfAF7iUzFpw0Pr+oMctoQ=; b=bIR4a0Qfv+g5tA7/rwYPUkaLe9GFYKBig1DbUHn3A5mDCvQBPVJijiV+jvUsh5ToRo SJaAsKJwLwW7fcJCs+Y4MJ7AEQx+RySd2P9LbAF91Eo/ZZQ9BDrD26v4iUKdlE3d2Qmo 9XIUP71BdRXbJvOG1kozY0CtHwblnd+4ViJer5cnT1FO2NebFUkM0iYpdHrxV6UtZgl3 WBAsFMqeMmvz1xdmkU5/g6UF97x96IhUCJs+98LB32ICndfTNlHzKN0YQ/ATSs7cbLC4 m0NROKRkuBXO0PRGYzdS9qoASwdh74lYzAn9xxIsOWgAJ3s+W/eGLDu5c3DfYxo6JaNS 2k7Q== X-Gm-Message-State: AJIora8j7tkmT7iNR04CBMhhjq8ZtKevYqLnYqESRfLiQQB7qjbXReJE SgXR7vLjhDM5xT5CK8wdGwCbFg== X-Received: by 2002:a17:902:eccd:b0:166:3e34:4d05 with SMTP id a13-20020a170902eccd00b001663e344d05mr4493060plh.75.1655215933716; Tue, 14 Jun 2022 07:12:13 -0700 (PDT) Received: from [10.20.0.186] ([199.101.192.9]) by smtp.gmail.com with ESMTPSA id v13-20020a637a0d000000b003fad46ceb85sm7920085pgc.7.2022.06.14.07.12.10 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 14 Jun 2022 07:12:13 -0700 (PDT) Subject: Re: [PATCH v2 3/3] crypto: hisilicon/qm - defining the device isolation strategy To: Kai Ye , gregkh@linuxfoundation.org, herbert@gondor.apana.org.au Cc: linuxarm@huawei.com, linux-kernel@vger.kernel.org, wangzhou1@hisilicon.com, linux-crypto@vger.kernel.org, linux-accelerators@lists.ozlabs.org References: <20220614122943.1406-1-yekai13@huawei.com> <20220614122943.1406-4-yekai13@huawei.com> From: Zhangfei Gao Message-ID: <82ce379f-73f4-0e57-ec32-e1ab1d3ef04d@linaro.org> Date: Tue, 14 Jun 2022 22:12:07 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20220614122943.1406-4-yekai13@huawei.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-Spam-Status: No, score=-3.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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: X-Mailing-List: linux-crypto@vger.kernel.org On 2022/6/14 下午8:29, Kai Ye via Linux-accelerators wrote: > Define the device isolation strategy by the device driver. if the > AER error frequency exceeds the value of setting for a certain > period of time, The device will not be available in user space. The VF > device use the PF device isolation strategy. All the hardware errors > are processed by PF driver. > > Signed-off-by: Kai Ye > --- > drivers/crypto/hisilicon/qm.c | 157 +++++++++++++++++++++++++++++++--- > include/linux/hisi_acc_qm.h | 9 ++ > 2 files changed, 152 insertions(+), 14 deletions(-) > > diff --git a/drivers/crypto/hisilicon/qm.c b/drivers/crypto/hisilicon/qm.c > index ad83c194d664..47c41fa52693 100644 > --- a/drivers/crypto/hisilicon/qm.c > +++ b/drivers/crypto/hisilicon/qm.c > @@ -12,7 +12,6 @@ > #include > #include > #include > -#include > #include > #include > #include > @@ -417,6 +416,16 @@ struct hisi_qm_resource { > struct list_head list; > }; > > +/** > + * struct qm_hw_err - structure of describes the device err > + * @list: hardware error list > + * @tick_stamp: timestamp when the error occurred > + */ > +struct qm_hw_err { > + struct list_head list; > + unsigned long long tick_stamp; > +}; > + > struct hisi_qm_hw_ops { > int (*get_vft)(struct hisi_qm *qm, u32 *base, u32 *number); > void (*qm_db)(struct hisi_qm *qm, u16 qn, > @@ -3278,6 +3287,7 @@ static int hisi_qm_uacce_get_queue(struct uacce_device *uacce, > qp->event_cb = qm_qp_event_notifier; > qp->pasid = arg; > qp->is_in_kernel = false; > + atomic_inc(&qm->uacce_ref); > > return 0; > } > @@ -3285,7 +3295,9 @@ static int hisi_qm_uacce_get_queue(struct uacce_device *uacce, > static void hisi_qm_uacce_put_queue(struct uacce_queue *q) > { > struct hisi_qp *qp = q->priv; > + struct hisi_qm *qm = qp->qm; > > + atomic_dec(&qm->uacce_ref); Can we use qm state or qp state instead? enum qm_state {         QM_INIT = 0,         QM_START,         QM_CLOSE,         QM_STOP, }; enum qp_state {         QP_INIT = 1,         QP_START,         QP_STOP,         QP_CLOSE, }; Thanks