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 8650EC433FE for ; Fri, 4 Nov 2022 23:59:01 +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=IMwt5ukQDYsYKUsV0xFoPp/AQO/0FQJNvKJeH/GFOYI=; b=li3fcB+34fcC95 pA87hCci0QGf+tQSrh4L4RhFVPvzVRuYro+/08F+b7enH+sUcF9oBJDPecY+pcCAfUKQWyy3rRHse BEtIsuZX06zsbSpXSlECMW4xS/Fzq3FThpexPZ14IqwxlJ1BCuX7uXFZQ1rVGHED7PXeVT2gck3dr lEpK/hGk31l1byAbjUIVlYOuOEs4ilbR1A4Ves+yGtg5fNOpR4dqM2o/7iWMV6Eiag1KvVS6DaN5U 9dGmZW5j4m7LTAOYRJojhDijgju3BJqE6t/NZ8WGoDIkNnx+yOMtN61ExBR3PK+zK7jSbMuPbLdE3 VGuEohoYk88VJ69/l8PQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1or6ZM-005Xtq-U6; Fri, 04 Nov 2022 23:57:53 +0000 Received: from ams.source.kernel.org ([145.40.68.75]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1or6X3-005WiH-T7 for linux-arm-kernel@lists.infradead.org; Fri, 04 Nov 2022 23:55:31 +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 ams.source.kernel.org (Postfix) with ESMTPS id 852B2B83024; Fri, 4 Nov 2022 23:55:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 53C80C43140; Fri, 4 Nov 2022 23:55:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1667606127; bh=8SK00dQ3waIO6qHYXMv09d8xWyQMeJThE8XtYSBNPNY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IowfPSUcg1ppL85ct74q0zUXWOt4j+vZreY+1WzPfO4B8qxRT1oLV/i28I3kogsuv arAcKKvkevQkoOgzIjmk0qcMA2zCNzeSQswS8+grMrNwp+cpcZbhhmNWBM4pXy4OeM 4xbGHiFncAlYmTmRvpC7lYBfN+9oHs+V/yAL+7+vqv8N4grqNDq6PGAeKr3eXUc7xN 9SHX+iCN16Q5A1pAHUh6KFNkQ96nKqjDf5KgDeBsjte0sG54UGRhrvbYy+wdSM76sJ MjOb+3cE7eH/IziSvfZTp40hAXWmYqpWhEK6F4PNDLJcg6vJIiZDzICymb8j/5KHxW s95csEaKIaZBQ== 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 11/18] arm64/hibernate: Disable NMIs while hibernating Date: Fri, 4 Nov 2022 23:54:46 +0000 Message-Id: <20221104235453.870573-12-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=1572; i=broonie@kernel.org; h=from:subject; bh=8SK00dQ3waIO6qHYXMv09d8xWyQMeJThE8XtYSBNPNY=; b=owEBbQGS/pANAwAKASTWi3JdVIfQAcsmYgBjZaZGzLtq7kAX/ZK7YggTH7kgSfXLu9l4M4uMxum8 Nk5PLZ+JATMEAAEKAB0WIQSt5miqZ1cYtZ/in+ok1otyXVSH0AUCY2WmRgAKCRAk1otyXVSH0D8BB/ 9q1ssO0K3M+5UC2URn7Wo4opnW43XVU5NEbIt44ULHA1F/ZU2Z82CZKMJkfvu6bwtxvPmkcuBablV2 /9PHDObjpw9gyCmhvILYAwHgRYQUK7ptwS8MBghkGTn2nmbkiNdeoj03/U1yz/ynJVPJZLRRO9hDPQ c9EVQ6hnaNiTP2IhPCcBxJl7h/lnCMriPwauuc813hTXo8iX/A2S5zIIj5M7jWmiyCfTE9wjkAOst3 450GW6KKD9BA37B751LtYxzL21GGqgUElCsa7d+FnsdXWx9QNWG5ws3Go9DBc4drc4SkXkjBg+gr3u vznC3Rq1ckX0kjODQPqUlf0ewcf9Qn 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_111621_8E7918DF X-CRM114-Status: GOOD ( 15.11 ) 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 hibernation to ensure we preserve a consistent image, 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/hibernate.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/arch/arm64/kernel/hibernate.c b/arch/arm64/kernel/hibernate.c index af5df48ba915..71b8979eb2f2 100644 --- a/arch/arm64/kernel/hibernate.c +++ b/arch/arm64/kernel/hibernate.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -338,6 +339,14 @@ int swsusp_arch_suspend(void) 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); + if (__cpu_suspend_enter(&state)) { /* make the crash dump kernel image visible/saveable */ crash_prepare_suspend(); @@ -386,6 +395,9 @@ int swsusp_arch_suspend(void) spectre_v4_enable_mitigation(NULL); } + if (system_uses_nmi()) + sysreg_clear_set(sctlr_el1, 0, SCTLR_EL1_NMI); + local_daif_restore(flags); return ret; -- 2.30.2 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel