From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 37CF133A712; Fri, 9 Jan 2026 11:52:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767959525; cv=none; b=Bs2avjP5FIj7gr/PfEjbWqCsdWfuDj5BdhvND0z68+9KdA/2VHuQEvyF0H4IXZx7loXBJ89Lq38FkZtBLMsVKCDXKFOL6nKovO2ClLvSQTOebBgjkwaHPV/UCyhFJbatY9UKY8xYo60edIfPvdSRpXY/e7whYeAbQWSU2zH6jg4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767959525; c=relaxed/simple; bh=ejSRT2mux7Vf4r+HqxYoVp2bQSGcvpNxNbNR/IzrQ1E=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Flew+qyFZDn13Y6arbuN6Cbm7PUbfr0W2+uF/UmrnYkg2xVmRKawDV6DLQiNnh4CZjQWgf+YuPZkGJrQzMEZTGa66QUoOTIB0qasnKBRY9wyyFhhwfhqmrVHGK6aN5Nlv4AO/EfNH2RT5gAahr9uUOCFysuZ0bH5RBCEVICsW9E= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=enhryRnL; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="enhryRnL" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B7A8AC4CEF1; Fri, 9 Jan 2026 11:52:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1767959525; bh=ejSRT2mux7Vf4r+HqxYoVp2bQSGcvpNxNbNR/IzrQ1E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=enhryRnLx4qDOlXXfVjnZ4vGI2KqEqARL3oN+FbWF/DSylNN7zj2cmfNCtXAXvfEg HM7FwDTdQrwzYdtdTPiF1di2Rtz8pRbZdwOTubYdeIn02y80/PeErFFE07ILGe1+0C PEUAInhy6dngdcCphhuk1ETqv1ZqOKU4q0nFRYy0= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, nieweiqiang , Chenghai Huang , Herbert Xu , Sasha Levin Subject: [PATCH 6.6 083/737] crypto: hisilicon/qm - restore original qos values Date: Fri, 9 Jan 2026 12:33:42 +0100 Message-ID: <20260109112137.119035804@linuxfoundation.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260109112133.973195406@linuxfoundation.org> References: <20260109112133.973195406@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: nieweiqiang [ Upstream commit e7066160f5b4187ad9869b712fa7a35d3d5be6b9 ] When the new qos valus setting fails, restore to the original qos values. Fixes: 72b010dc33b9 ("crypto: hisilicon/qm - supports writing QoS int the host") Signed-off-by: nieweiqiang Signed-off-by: Chenghai Huang Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin --- drivers/crypto/hisilicon/qm.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/drivers/crypto/hisilicon/qm.c b/drivers/crypto/hisilicon/qm.c index a2c6b28f4b84b..2c0ca68914e2f 100644 --- a/drivers/crypto/hisilicon/qm.c +++ b/drivers/crypto/hisilicon/qm.c @@ -3555,6 +3555,7 @@ static int qm_clear_vft_config(struct hisi_qm *qm) static int qm_func_shaper_enable(struct hisi_qm *qm, u32 fun_index, u32 qos) { struct device *dev = &qm->pdev->dev; + struct qm_shaper_factor t_factor; u32 ir = qos * QM_QOS_RATE; int ret, total_vfs, i; @@ -3562,6 +3563,7 @@ static int qm_func_shaper_enable(struct hisi_qm *qm, u32 fun_index, u32 qos) if (fun_index > total_vfs) return -EINVAL; + memcpy(&t_factor, &qm->factor[fun_index], sizeof(t_factor)); qm->factor[fun_index].func_qos = qos; ret = qm_get_shaper_para(ir, &qm->factor[fun_index]); @@ -3575,11 +3577,21 @@ static int qm_func_shaper_enable(struct hisi_qm *qm, u32 fun_index, u32 qos) ret = qm_set_vft_common(qm, SHAPER_VFT, fun_index, i, 1); if (ret) { dev_err(dev, "type: %d, failed to set shaper vft!\n", i); - return -EINVAL; + goto back_func_qos; } } return 0; + +back_func_qos: + memcpy(&qm->factor[fun_index], &t_factor, sizeof(t_factor)); + for (i--; i >= ALG_TYPE_0; i--) { + ret = qm_set_vft_common(qm, SHAPER_VFT, fun_index, i, 1); + if (ret) + dev_err(dev, "failed to restore shaper vft during rollback!\n"); + } + + return -EINVAL; } static u32 qm_get_shaper_vft_qos(struct hisi_qm *qm, u32 fun_index) -- 2.51.0