From patchwork Wed Jun 30 16:24:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robin Gong X-Patchwork-Id: 12351563 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.2 required=3.0 tests=BAYES_00, DATE_IN_FUTURE_06_12,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 345CCC11F65 for ; Wed, 30 Jun 2021 08:10:05 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D207161D05 for ; Wed, 30 Jun 2021 08:10:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D207161D05 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=nxp.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=3EMXetAGHMPgYAS9LW5wsDsDe8BcjFdxN1cQC6F449Q=; b=OkOc4hpO4EcwpP 3fnLvilUQkiA4rFCqjK6IUHaMDShCQotFwUGHBkhcbYpjkPfkLHiivQZvi1GxMOIAQiTVJrckfqNE zfvG/BaqWTOwNNjYgqJwMknLKFfVxGCF5yJnOZQAo/7UFib4YXlyttuSSioiuw46O1WRq1oUHxTBd xBcYd0AtoXdRf4wO/1JB2LIHMaXQxNbjhyd3QuT5xs2gV87PN8528TGakNoW2/P7EGtYSindxq0QG 0SQ1jYI+85G/9FHFCLivA6sV3gqWXPgrCWaOr7a2C7yfBKkN2pUt6lI2YyNc60GriY7hnZDsWy4Gd qHZp0yeAoa46vpClj1LQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lyVGX-00DDuu-Su; Wed, 30 Jun 2021 08:08:14 +0000 Received: from mail-eopbgr140052.outbound.protection.outlook.com ([40.107.14.52] helo=EUR01-VE1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lyVGT-00DDtd-Ob for linux-arm-kernel@lists.infradead.org; Wed, 30 Jun 2021 08:08:11 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=U8cP8YnRq2naAV9f5ePqGiOL2aQktMGybj85JRQOlTuTXfGSakp4L2Jefb1b33BwNeWVgRha8T7vdJ09e08mpnIEoM8WTiyPD5dg/XCUE6a7wCXP53l8T+XZjGUJTkb4yDjD1jZY7CdDt5KWiKAPOdPjlUkuLDYKFX6D3lmnU7/MX242Qg/2DPzfsEw4WNS9oFHeYNK6D4cVqguGG2om5y68SL3l57ZCBHH/g0HwS8xlneIgR+k4eH9mN6SuvGJI7d9LKWo9f8meo9+Jzsevv5a7swKr6fUN7pCnoXIi+yJuS3NDkxVe7pmpoEBe0pdPo/8hWCRqDfkxDGPTIafjbw== 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-SenderADCheck; bh=pMqi8FQuXlEaH88O2RXuB7MEuqWSXnr2+JVhnly3stA=; b=LfrEhW6xUhhKCRuhrCb+eTZs4vSj4xsYn1gSd05j5yuOSIFlpIpWhYbM405guT7phg/afLjWTFgjzbCvGXDgMw7jDbzUU0VVPwXootE4QoqVWqWxT+aa6+AAF6tmeK/uMu9wxRMfoRxSs/L25mZM616VYtlEKgLwBZ8XrlYyZMKXE/+yi7lcDnG/CPG6GiyjhWH7pJRa7t8L6vaEMQtW2euARK5L6bBECrTb7Ebmfk0KDgN+kwUPVhMKEfxdR5SZpUpkVxlFbrUmi5tdFLae9hH55L/jXsIqqzN9MEiOw++vIuNoVBdObD5Zk16fse5JEHOUdgZUAMuEy8spNSyYPQ== 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=pMqi8FQuXlEaH88O2RXuB7MEuqWSXnr2+JVhnly3stA=; b=lgPYPwJ69xnRkF0/e2a7EWxXnmPzkU6As6Hg6TpOJLgkmvQZR+pPG3Ysl3l0DX6Q28EnoLkoA8TOJRSu9FQhzOheOKMTTktvOMS/+m8kQhNjNpS967FVniaV9/v/SskiDKqdtHGGwvF0VbyhmHc3IGVjApElc/2C7M9DqmLQhKs= Authentication-Results: gmail.com; dkim=none (message not signed) header.d=none;gmail.com; dmarc=none action=none header.from=nxp.com; Received: from VE1PR04MB6688.eurprd04.prod.outlook.com (2603:10a6:803:127::25) by VI1PR0402MB3342.eurprd04.prod.outlook.com (2603:10a6:803:11::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4264.26; Wed, 30 Jun 2021 08:07:58 +0000 Received: from VE1PR04MB6688.eurprd04.prod.outlook.com ([fe80::a978:6f38:2bce:9076]) by VE1PR04MB6688.eurprd04.prod.outlook.com ([fe80::a978:6f38:2bce:9076%5]) with mapi id 15.20.4287.023; Wed, 30 Jun 2021 08:07:58 +0000 From: Robin Gong To: jassisinghbrar@gmail.com, shawnguo@kernel.org, s.hauer@pengutronix.de, festevam@gmail.com Cc: kernel@pengutronix.de, linux-imx@nxp.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v1] mailbox: imx: fix crash in resume on i.mx8ulp Date: Thu, 1 Jul 2021 00:24:53 +0800 Message-Id: <1625070293-28641-1-git-send-email-yibin.gong@nxp.com> X-Mailer: git-send-email 2.7.4 X-Originating-IP: [119.31.174.66] X-ClientProxiedBy: SG2PR06CA0177.apcprd06.prod.outlook.com (2603:1096:1:1e::31) To VE1PR04MB6688.eurprd04.prod.outlook.com (2603:10a6:803:127::25) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from robin-OptiPlex-790.ap.freescale.net (119.31.174.66) by SG2PR06CA0177.apcprd06.prod.outlook.com (2603:1096:1:1e::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.4287.22 via Frontend Transport; Wed, 30 Jun 2021 08:07:55 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 922e86b9-9a01-47ae-1686-08d93b9e2c0e X-MS-TrafficTypeDiagnostic: VI1PR0402MB3342: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:101; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: pkys32pqe32EsAGUL0mApAd3n/HkXfnRgKEAK/il13kaJfKccYam2UILSYTLEDuXl9cmlvmvlHDaMhV2+uT0Yj44D6803OhxjlmcyEMtLORCpgxP5w49heTOS0IsQJXCE9JvoQJLlsPzVGmQtEXSwwPzdWQoWX8I3Z+v/wxTvm+pt30et3Hb2+T7O431twaUfuXWFHQFI378AOQQ+jphOtXqvjwJ1tSCJt7kXCVSin68k6IOwD7VHueYhqU8iAMhPga2QOA6g3clp0MXaC9mpQH/gt5/yEtA9Ea5v3qYaqjC2lug1j8G6+BrjVjmYP2EQCgj1ReAT78GuuVeKIJJ9bXPebg5YyBr8TVh7c4ZvDwLjxHMXvL9a2BdfDvRBbLDVXx/AveOPl7RMjgu86j1dvYn48D+zcGd52YmnAdWHMo8OFy0pw0t4M6mFnADclfLcSVZOn+TUytAYcTBPSMKLNLvfUfoyGLPXvpW+VrZASWWQRBbeQZnEuD7u5rYOZMnYayaeKe5nH1xy3z/xdaAAVNgiTv+ksDGzvy0xYpi9CBcrJEZAqoT0ejwh97nAqD7eEgelcsQLnVuWa3LTzwaFK8zM8rGjB1vYTGQcqesXEFXhAauNVVYh2LEVbp0g0PztigC90NgSl3WAartxg7Fkrp+zTZSAjuUg33CmZOAkylXhZCNSUKKfSHrlMPTiuevNYzrdW0BjCCPxFfT+KF3Hg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VE1PR04MB6688.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(396003)(136003)(346002)(39860400002)(376002)(366004)(6512007)(52116002)(26005)(66946007)(66556008)(66476007)(45080400002)(83380400001)(6506007)(15650500001)(2906002)(8676002)(8936002)(36756003)(5660300002)(38350700002)(38100700002)(16526019)(4326008)(86362001)(2616005)(478600001)(316002)(186003)(956004)(6486002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1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PLnbOXIs55UIj7+dr/IhRq6oKs4MbeBLKzB1hJT9WzWpcXUp/aehX6cDyMbtNXvtckkDjhdlnOYaKl5m57xgRTenR6taXgeMcQHqx9SRJloKarNogboeWNT3MoTinyy1K1wIDoOoPiR3F/hOYMlpWWgHuXM+zkTThiklyG79pkCvumEGcTPmYx9b8FH39g4SauQFJzbE3TG7loCStgXmZu2F8iDatM/Bgg3uKB7SZyuGnh4wjq4/m0lggVqgKCighf7J2FBlIIVkFZJbQSwDhppicCtExfzXjcakG4dvWZCXPw9V X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 922e86b9-9a01-47ae-1686-08d93b9e2c0e X-MS-Exchange-CrossTenant-AuthSource: VE1PR04MB6688.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Jun 2021 08:07:58.2576 (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: g/+39tuQ3QmJUO9O5+DzseID5f1R2n43yifVDVgCBymGRUJ2ZHGzxgS//7+Hb236SVXzjyoGBizmw6LCFsQKwQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0402MB3342 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210630_010809_851163_90997359 X-CRM114-Status: GOOD ( 11.89 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org check 'priv->clk' before 'imx_mu_read()' otherwise below crash may happen on i.mx8ulp, since clock maybe already disabled by runtime suspend. [ 79.155733] Internal error: synchronous external abort: 96000210 [#1] PREEMPT SMP [ 79.162979] Modules linked in: [ 79.165998] CPU: 0 PID: 460 Comm: sh Not tainted 5.10.35-00234-g0b4d749783dc-dirty #571 [ 79.173738] Hardware name: NXP i.MX8ULP EVK (DT) [ 79.178240] pstate: 60000005 (nZCv daif -PAN -UAO -TCO BTYPE=--) [ 79.184082] pc : imx_mu_resume_noirq+0x14/0x78 [ 79.188422] lr : dpm_run_callback.isra.0+0x38/0xd8 [ 79.193085] sp : ffff80001b63baa0 [ 79.196337] x29: ffff80001b63baa0 x28: 0000000000000000 [ 79.201512] x27: ffff800011bd9b30 x26: ffff80001157acd0 [ 79.206682] x25: ffff800011a210f4 x24: 00000012682e38d8 [ 79.211855] x23: 0000000000000000 x22: ffff800011b85000 [ 79.217023] x21: ffff00000425c810 x20: 0000000000000010 [ 79.222195] x19: ffff800010c79550 x18: 0000000000000010 [ 79.227368] x17: 0000000000000000 x16: 0000000000000000 [ 79.232539] x15: 0000006fb5d33a2c x14: 000000000000027a [ 79.237709] x13: 0000000000000303 x12: 0000000000000001 [ 79.242879] x11: 0000000000000040 x10: ffff000004424f80 [ 79.248050] x9 : ffff000004424f78 x8 : 0000000000000028 [ 79.253222] x7 : 0000000000000006 x6 : 0000000000000657 [ 79.258395] x5 : 0000000000000657 x4 : 0000000000000000 [ 79.263567] x3 : 0000000000000001 x2 : 0000000000000110 [ 79.268742] x1 : ffff0000054b8080 x0 : ffff80001af40110 [ 79.273915] Call trace: [ 79.276340] imx_mu_resume_noirq+0x14/0x78 [ 79.280345] device_resume_noirq+0x80/0x170 [ 79.284431] dpm_resume_noirq+0xb0/0x218 [ 79.288271] suspend_devices_and_enter+0x20c/0x5b8 [ 79.292938] pm_suspend+0x2ec/0x350 [ 79.296362] state_store+0x88/0x108 [ 79.299786] kobj_attr_store+0x14/0x28 [ 79.303460] sysfs_kf_write+0x40/0x50 [ 79.307046] kernfs_fop_write_iter+0x110/0x1a0 [ 79.311388] new_sync_write+0xe4/0x178 [ 79.315062] vfs_write+0x24c/0x380 [ 79.318404] ksys_write+0x68/0xf0 [ 79.321664] __arm64_sys_write+0x18/0x20 [ 79.325508] el0_svc_common.constprop.0+0x68/0x160 [ 79.330179] do_el0_svc+0x20/0x80 [ 79.333436] el0_svc+0x10/0x18 [ 79.336444] el0_sync_handler+0xa8/0xb0 [ 79.340200] el0_sync+0x140/0x180 [ 79.343463] Code: f94a9022 f9400420 b9403c42 8b020000 (b9400000) [ 79.349383] ---[ end trace 4af1de2c96411434 ]--- Signed-off-by: Robin Gong --- drivers/mailbox/imx-mailbox.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mailbox/imx-mailbox.c b/drivers/mailbox/imx-mailbox.c index 2543c7b6..848c0fe 100644 --- a/drivers/mailbox/imx-mailbox.c +++ b/drivers/mailbox/imx-mailbox.c @@ -620,7 +620,7 @@ static int __maybe_unused imx_mu_resume_noirq(struct device *dev) * send failed, may lead to system freeze. This issue * is observed by testing freeze mode suspend. */ - if (!imx_mu_read(priv, priv->dcfg->xCR) && !priv->clk) + if (!priv->clk && !imx_mu_read(priv, priv->dcfg->xCR)) imx_mu_write(priv, priv->xcr, priv->dcfg->xCR); return 0;