From mboxrd@z Thu Jan 1 00:00:00 1970 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 70E2AC4332F for ; Fri, 4 Nov 2022 23:59:39 +0000 (UTC) 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:References:In-Reply-To: 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: List-Owner; bh=aMaz6mQiyextTDvJb4S3EaSN2CSWw+mlJLGC8K7ZsKo=; b=4zRDF4hRBUGadC oPmU6eLdHFWS3riRxkAqG/2P3SSioI7BvpYzwCWmSJLElY+ZHH6ecHdLY+IUiaucXX9n+gRvq9x77 6IBZo0V3x2GQPwG0995nmTCP1X0F1YBPZhN2ivk8X0sVpq+Pl7hIGxKvotoYR5GdLzarFB789axFO wD6/SXxw0WC09VNc2hMXQ91lnRYVJdArftUyh7YJYTnfmUff4oNDQ6fTu8vJSzVLxmAnW8/5qfFtg Qy/ECP21IGzZxy19MURxVXEuYfBa+fRfBH8fmvYAbx24Y8/CZjtJT9qGPAeprA3qMrHuc1juIAPUv hVlCC+2mhExxgncHXC1A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1or6Zw-005YC8-No; Fri, 04 Nov 2022 23:58:29 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1or6X4-005Wj1-N6 for linux-arm-kernel@lists.infradead.org; Fri, 04 Nov 2022 23:55:32 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3D19162282; Fri, 4 Nov 2022 23:55:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B019CC43470; Fri, 4 Nov 2022 23:55:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1667606129; bh=fzzlxjTMf6ah+S8/q1xQUnJfKULeCO7xhKrVv9AJElw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KwBGCL9qmcOP+zOW7PYri978YdU0QWBA5rAtY27IZUohK9zDcTU/Hv7/GbrkAypUA z02KZ0+3X7ns6V8/aM9o3oz+wUEDifW8cadYrzc62q1xOKRFXF3X2w24RtPG9Ag/j+ hUWBQN+YrDXefeRGGf1mXf6eK7Nz8CE92/7E81OhDm3D2znGgp68kcU0UCswvlEToP uMojeJdYZZqLiD/r+/OuLxHIePC4k7n70i1KZ0QJaacoFoeiuq8R+d6T5CTQxggcK9 Nu6gjKYHSZG+Fbwc6sBw428mnhawkb6OuIVElP5StYh1SjG0HvmzHn0o2wGwgJ0QFr AdmxWXxbEidaQ== From: Mark Brown To: Catalin Marinas , Will Deacon , Marc Zyngier Cc: Lorenzo Pieralisi , Mark Rutland , Sami Mujawar , Thomas Gleixner , linux-arm-kernel@lists.infradead.org, Mark Brown Subject: [PATCH v1 12/18] arm64/suspend: Disable NMIs while suspending Date: Fri, 4 Nov 2022 23:54:47 +0000 Message-Id: <20221104235453.870573-13-broonie@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221104235453.870573-1-broonie@kernel.org> References: <20221104235453.870573-1-broonie@kernel.org> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1517; i=broonie@kernel.org; h=from:subject; bh=fzzlxjTMf6ah+S8/q1xQUnJfKULeCO7xhKrVv9AJElw=; b=owEBbQGS/pANAwAKASTWi3JdVIfQAcsmYgBjZaZHIVc7B8UcdRRp/V4ABKvenUN7nBIAkclkIsV1 LCZewjqJATMEAAEKAB0WIQSt5miqZ1cYtZ/in+ok1otyXVSH0AUCY2WmRwAKCRAk1otyXVSH0AsvB/ 96o0C+lkLQTQsXUbdBKFSzS8BPvnEwlaoFjDLNlrSuZcx9lnwLDsfe8vrSVRfhuaaW6PdvLVNoyd2T Slfqmyc4LrKYKq7RDdwAaBdZ6q+mEcmpFFsnoMhAPZuKtM/bcT4fpp7PCC9bR81vrncXddBvTE0mg0 EiJtq+2xB60CEkgoEi+AyNoUYeOkh7LIYXkeQlkvSY+cYy/Vc2jAc9dVNG+oMT4P0f8af4fLBwpfdf WxiSt2vNoSdvcNeuc2l6tD/OLcIN4gzwSLbZk7CblHEvm5iivRvmubd9pU5g9VufJnTq/GpR5/sC3T vXfSHGRk7WFAcOVeiNeX6o0N6cGDXR X-Developer-Key: i=broonie@kernel.org; a=openpgp; fpr=3F2568AAC26998F9E813A1C5C3F436CA30F5D8EB X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221104_165530_810136_7A43D2EF X-CRM114-Status: GOOD ( 15.31 ) 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org We disable interrupts during the final stages of suspend to ensure we don't have any code changing state, ensure that NMIs are also masked. Rather than masking using ALLINT.ALLINT do this by disabling NMIs in SCTLR so that we don't need to worry about an additional optionally present register in the assembly sections of code. Signed-off-by: Mark Brown --- arch/arm64/kernel/suspend.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/arch/arm64/kernel/suspend.c b/arch/arm64/kernel/suspend.c index 8b02d310838f..e209ad091648 100644 --- a/arch/arm64/kernel/suspend.c +++ b/arch/arm64/kernel/suspend.c @@ -105,6 +105,14 @@ int cpu_suspend(unsigned long arg, int (*fn)(unsigned long)) */ flags = local_daif_save(); + /* + * Disable NMIs in SCTLR rather than masking ALLINT so we + * don't have to worry about the state of the FEAT_NMI + * specific register in the asm code. + */ + if (system_uses_nmi()) + sysreg_clear_set(sctlr_el1, SCTLR_EL1_NMI, 0); + /* * Function graph tracer state gets inconsistent when the kernel * calls functions that never return (aka suspend finishers) hence @@ -139,6 +147,9 @@ int cpu_suspend(unsigned long arg, int (*fn)(unsigned long)) unpause_graph_tracing(); + if (system_uses_nmi()) + sysreg_clear_set(sctlr_el1, 0, SCTLR_EL1_NMI); + /* * Restore pstate flags. OS lock and mdscr have been already * restored, so from this point onwards, debugging is fully -- 2.30.2 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel