From patchwork Tue Aug 8 10:55:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Meenakshi Aggarwal X-Patchwork-Id: 13346247 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 28770C001DB for ; Tue, 8 Aug 2023 16:09:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231992AbjHHQJs (ORCPT ); Tue, 8 Aug 2023 12:09:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32902 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231799AbjHHQHw (ORCPT ); Tue, 8 Aug 2023 12:07:52 -0400 Received: from EUR02-DB5-obe.outbound.protection.outlook.com (mail-db5eur02on2043.outbound.protection.outlook.com [40.107.249.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D51D376A2; Tue, 8 Aug 2023 08:46:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UmNJvy3cHPp3VCGnc2totBIUx8ve43xsQbI6nUKU24trIEA2O1Z5UmKXga1254ZtYLtdg3IjCRufN2QvUYEVl8PvRO2oHnQdN4U5k8a2ptx+Km0f8QlInaxvasrK0DDJnd6AI3AUxpbjm6DXVNq6LJfp1ns/KCKo/ttSMxgPhPH/NAj/+B6T7EaNlk5G0BxA/3bZT9JxaHCTrbWkFLEPLtZoiQzl8nDgjeraER/+b5/dQ6xI8Eqa67FYY8SL4agAyYZR9EZxP1b8gADvq8kHTHoZiIqH4te46oyVnxkibZEElEMRHwqiKFMEh+zPxcFu2wdl8DcKrVm/PwcZ3TiLJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=tah8vgUSjzEQgngPQ60IeoDkd+XR0LPGIuYXlb19fQ4=; b=dZLaWaiGYqXPRPV7eqMQJJTDnMF8zEiSDQLyj8g9DKvdE/FoQng5UnVuTQeWa1Bu9CGVLSLFPRDixReL5fFXNgiMRABbHVCN7zAYdoCWh74/MMiGzICZfQ6wnzab9P2//niakOSqWSQXilyG+D4rOTg5dImIIO3k/TpyZT8CPQs2H39IYUwaD7H069KLg+/SeWlEkDt1Sxi0R/X9zckf6lnR+G1y1ZOKvkwh6h1RQ+CBjki1tSZtfUYZwqsgjPKmkBbFwvrsx5wj63Z/kdpIpdI6nrd2GSSMf2xzZrdlp2BPoA+UfYmU/8Jn7g6HNPxFu9F2oUbH+WCmUav/WWVdPw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=tah8vgUSjzEQgngPQ60IeoDkd+XR0LPGIuYXlb19fQ4=; b=FUOCt2v/6Jzj+sXcbySnM1ofip7xEhUNZpN163ee4ZoRtD1/MXNgAqLrJyIE8oOSu1g3cJpSRFwm5o4eSg6rBfioVSrKfOELkXHRZat7kVgqRMHeNd51gDnmpNItyoNW+H3qjYMT/0p2KJeVZHyOr9Bn1p0qE3m2iHGEYcC+wXI= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from DU0PR04MB9563.eurprd04.prod.outlook.com (2603:10a6:10:314::7) by AS8PR04MB8101.eurprd04.prod.outlook.com (2603:10a6:20b:3f6::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6652.27; Tue, 8 Aug 2023 10:55:46 +0000 Received: from DU0PR04MB9563.eurprd04.prod.outlook.com ([fe80::15ed:8451:b0a2:ec64]) by DU0PR04MB9563.eurprd04.prod.outlook.com ([fe80::15ed:8451:b0a2:ec64%4]) with mapi id 15.20.6652.026; Tue, 8 Aug 2023 10:55:46 +0000 From: meenakshi.aggarwal@nxp.com To: horia.geanta@nxp.com, V.sethi@nxp.com, pankaj.gupta@nxp.com, gaurav.jain@nxp.com, herbert@gondor.apana.org.au, davem@davemloft.net, linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Meenakshi Aggarwal Subject: [PATCH] crypto: caam/jr - fix shared IRQ line handling Date: Tue, 8 Aug 2023 12:55:27 +0200 Message-Id: <20230808105527.1707039-3-meenakshi.aggarwal@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230808105527.1707039-1-meenakshi.aggarwal@nxp.com> References: <20230808105527.1707039-1-meenakshi.aggarwal@nxp.com> X-ClientProxiedBy: AM0PR04CA0028.eurprd04.prod.outlook.com (2603:10a6:208:122::41) To DU0PR04MB9563.eurprd04.prod.outlook.com (2603:10a6:10:314::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU0PR04MB9563:EE_|AS8PR04MB8101:EE_ X-MS-Office365-Filtering-Correlation-Id: fd287d85-d8fa-47d1-6173-08db97fe051f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: lTxMyPg2U+1RLeL84ktvucdEzs0djYGL1qqUvn3AyjPLNtMkFqo7YFt8jRvNktWOTOteTwzx2ifdq95f7rNNKymEEHGIyEyYTFevgvGzY92ycMaMuOzhevrqPMCQTCT1HMGZlQV2prb7A+9zLRdCG4sTrl7wkDMVWzFBOHKaLpBcXX4+UYxadY+urqUMoJCej95G5FUjNbMm4rSBjDQVgYhdsLRbSnTtCKgkVjQlUNz+TUkx8qu9DSQ5fkiFwJ/QUNXTZwUYPt7odxJKEoaLMPqYeN/rOtt69vizIRJwR1itDFEcY2Gb+sSD4czi+W4LxuA3CSenynTRvs2JL328KY6yywHR/xKikXwzMqCRbUwRDwSaoCI6G95UdON/OZ4+GPo9T85df4JWuT4wYMwGClE2A5CLchvlajYyC/P75H05+LkC+/HLEqFpoYp0BXWbiVqjgE6e72tDTnWIM6PXtcAHpU1EeAl5cRwwpKcnBUMQIiCFwmLlmgfx1HQb6bLYtqWtu9XsSdGsN+PxVf89UvxVihYolQ8h58rS9kDLqNEvlBbdkYDN5l1JtQ9922ZUMBGC3uvz13AX2XvUJVd6gSF8oJCxhE+7nlbgBNZ1WIBRzCQtrcW90u3/8aYynQ8D X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DU0PR04MB9563.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(366004)(39860400002)(376002)(396003)(136003)(346002)(1800799003)(186006)(451199021)(2616005)(6486002)(478600001)(83380400001)(66556008)(9686003)(6512007)(26005)(6506007)(1076003)(66476007)(41300700001)(8676002)(316002)(52116002)(8936002)(66946007)(2906002)(4326008)(6666004)(36756003)(38100700002)(38350700002)(86362001)(5660300002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?XzdvY5qAXPrWtQB5a0VSjwWo8Q/C?= =?utf-8?q?3z3cbhoUgG/cwI5Tof830JMevI2bMv7zE9l06ZcjmtRzEJ3Wrq+JDQrHvWZDCDnSz?= =?utf-8?q?ax+0EseMBcnKDLUbgiCvP3TnxcbyMXw/zh2LH0EJaAVJ80tVFx+a5rt5G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mtDf6pr/n?= =?utf-8?q?ynxgiqeYxVLjhwG1svCq4YAWEVSVpttgeocpA3ntxUUXBJIcXm5FSGH5k5XBC+3uE?= =?utf-8?q?AtM+56/sNPeUBwNiBfd3gEzuoP7xwqr/stjvfhrM+hYGyvp+LYg9jebUyU5kCoX8K?= =?utf-8?q?6at4cJHVVwFm9n9sMFPL6LHYrV7Dfk0c0NTtmtdhvT1m7RSfti80LxIZtHmDiS4iw?= =?utf-8?q?3Mc0vot7dfze0xSyGpLvQMSvdAlHz7cctjx5dkUdmwdis6d41BaHC7rV3+tl/zD//?= =?utf-8?q?KsdHsEEVVMZdgtaZ6Cf6KSanqd52eAarFxD5O/5KLoyrnnBmTgCgMsQUgfghhsXHH?= =?utf-8?q?rTfpkOhfHNE23dgALSe2uHdfPweziuP0YC7LnqrcoISjQoCrC/t7A3d5qSJo462Vt?= =?utf-8?q?vjYalnh1fHj+CkId9jb1Gp41+LLmdE1O0svSizAeBeUYL/XOi6jEQCZn1uelWUytq?= =?utf-8?q?b3rJy+qqOsBa8+rWNf8mqU2IBbhyTqQjZDko3tV3UZ19h+lfC53V5l6g0fy+nj+6i?= =?utf-8?q?KMeBbsilZg/xq4cBqMvvBOwpNMdwYh25Yw=3D=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: fd287d85-d8fa-47d1-6173-08db97fe051f X-MS-Exchange-CrossTenant-AuthSource: DU0PR04MB9563.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Aug 2023 10:55:46.8257 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: YGyQ21yD4/br2/5RMNUHEF1gVhwz3mcybMsK9/h4mZ9soPZvhg1V0CRHavB5kk7fKaeDBMkx+P8mFxLC3S+CEEzFV8bvCNHvH3tVHX2p0w0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8101 Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org From: Horia Geantă There are cases when the interrupt status register (JRINTR) is non-zero, even though: 1. An interrupt was generated, but it was masked OR 2. There was no interrupt generated at all for the corresponding job ring. 1. The case when interrupt is masked (JRCFGR_LS[IMSK]=1b'1) while other events have happened and are being accounted for, e.g. -JRINTR[HALT]=2b'10 - input job ring underwent a flush of all on-going jobs and processing of still-existing jobs (sitting in the ring) has been halted -JRINTR[HALT]=2b'01 - input job ring is currently undergoing a flush -JRINTR[ENTER_FAIL]=1b'1 - SecMon / SNVS transitioned to FAIL MODE It doesn't matter whether these events would assert the interrupt signal or not, interrupt is anyhow masked. 2. The case when interrupt is not masked (JRCFGR_LS[IMSK]=1b'0), however the events accounted for in JRINTR do not generate interrupts, e.g.: -JRINTR[HALT]=2b'01 -JRINTR[ENTER_FAIL]=1b'1 and JRCFGR_MS[FAIL_MODE]=1b'0 Currently in these cases, when the JR interrupt handler is invoked (as a consequence of JR sharing the interrupt line with other devices - e.g. the two JRs on i.MX7ULP) it continues execution instead of returning IRQ_NONE. This could lead to situations like interrupt handler clearing JRINTR (and thus also the JRINTR[HALT] field) while corresponding job ring is suspended and then that job ring failing on resume path, due to expecting JRINTR[HALT]=b'10 and reading instead JRINTR[HALT]=b'00. Fix this by checking status of JRINTR[JRI] in the JR interrupt handler. If JRINTR[JRI]=1b'0, there was no interrupt generated for this JR and handler must return IRQ_NONE. Signed-off-by: Horia Geantă Signed-off-by: Meenakshi Aggarwal Reviewed-by: Gaurav Jain --- drivers/crypto/caam/jr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/crypto/caam/jr.c b/drivers/crypto/caam/jr.c index 5507d5d34a4c..07ec2f27cc68 100644 --- a/drivers/crypto/caam/jr.c +++ b/drivers/crypto/caam/jr.c @@ -232,7 +232,7 @@ static irqreturn_t caam_jr_interrupt(int irq, void *st_dev) * tasklet if jobs done. */ irqstate = rd_reg32(&jrp->rregs->jrintstatus); - if (!irqstate) + if (!(irqstate & JRINT_JR_INT)) return IRQ_NONE; /*