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 X-Spam-Level: X-Spam-Status: No, score=-17.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham 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 DFCF9C48BDF for ; Tue, 15 Jun 2021 14:01:04 +0000 (UTC) Received: from bombadil.infradead.org (unknown [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 9C9AC613D9 for ; Tue, 15 Jun 2021 14:01:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9C9AC613D9 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org 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: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=TRzdpldEeX6kvd7mXkL4wyIoKF0CMrRc4veIMW0DJsY=; b=KWU9yDaCtQWYgM 03l/2lOmFJN3OIKM6kd7d67ZEwxronlYTA37dehwoydv3ORxNWWjOeBlasbcurWtT2+k81N4WnFcw TiVtjc3+WwOrtvod1U+6grb8tPTrbGowXzegYMqRmXqQVC3E1Hvz5JroidwgRF5UTUNVcAlbNoTE/ xiZa6ku+IceogcJQvbYXEBdM6Lco4fO3SXyzdqsaGqhYree2ZBKXAXBUol1qRMomwLlbQUX3bbCGd hE2ROH0qy9idgDOlBopqpJMEMC/bMnrUZ2iHC47b0zTdvgh70YWB7FwqLUd59O3C0ED5RAqF2zfQz aaehzz8vCVad1jwez45Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lt9VO-000M2E-Hs; Tue, 15 Jun 2021 13:53:29 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lt9Fy-000DEY-5u for linux-arm-kernel@bombadil.infradead.org; Tue, 15 Jun 2021 13:37:30 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Transfer-Encoding:MIME-Version :References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=HGaCae65F0IteVVaD7oJqXUvkd87fY59nSawXoksDI8=; b=H3wGlCggp0lceN5NMkT3L5bW1B 9lqidR+FDlj8OYSFYoL3w0ehz+7ObOrVGyNkJMnevBGEknxhGN3NlbJuwviSNvlxG3gL8y6uw7gXc 6VSMM1dKabSviq1fcXSnTvQjADeLIotDS0KiraV25Ip6DzXsItTmBOJjxrQUa2TF2abxA7pLX0Gvo isMvH0E0o3guy01vkbN6OSDJFsXWJiws0HEyfDdS0ztLbSP58k4yL9eN2aadk5laie4IFngIlKB7S JUVNj7T1isNJc2mIa1GyPsVdv0jNevONsSkF96IH7OnEd9VEARiJXUieZmlqJHu0BDNkCPzxLZ36C r3JUg1bg==; Received: from mail.kernel.org ([198.145.29.99]) by desiato.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lt6zo-007lUT-EG for linux-arm-kernel@lists.infradead.org; Tue, 15 Jun 2021 11:12:50 +0000 Received: from disco-boy.misterjones.org (disco-boy.misterjones.org [51.254.78.96]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0F18361019; Tue, 15 Jun 2021 11:12:46 +0000 (UTC) Received: from [185.219.108.64] (helo=why.lan) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1lt6zs-007fRJ-G5; Tue, 15 Jun 2021 12:12:44 +0100 From: Marc Zyngier To: linux-arm-kernel@lists.infradead.org Cc: Lorenzo Pieralisi , Will Deacon , Catalin Marinas , Mark Rutland , Valentin Schneider , Alexandru Elisei , Sudeep Holla , Russell King , kernel-team@android.com Subject: [PATCH v2 4/4] arm64: suspend: Use cpuidle context helpers in cpu_suspend() Date: Tue, 15 Jun 2021 12:12:27 +0100 Message-Id: <20210615111227.2454465-5-maz@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210615111227.2454465-1-maz@kernel.org> References: <20210615111227.2454465-1-maz@kernel.org> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: linux-arm-kernel@lists.infradead.org, lorenzo.pieralisi@arm.com, will@kernel.org, catalin.marinas@arm.com, mark.rutland@arm.com, valentin.schneider@arm.com, alexandru.elisei@arm.com, sudeep.holla@arm.com, linux@armlinux.org.uk, kernel-team@android.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210615_121247_492767_D9E77020 X-CRM114-Status: GOOD ( 18.18 ) 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 Use cpuidle context helpers to switch to using DAIF.IF instead of PMR to mask interrupts, ensuring that we suspend with interrupts being able to reach the CPU interface. Signed-off-by: Marc Zyngier --- arch/arm64/kernel/suspend.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/arch/arm64/kernel/suspend.c b/arch/arm64/kernel/suspend.c index e3f72df9509d..938ce6fbee8a 100644 --- a/arch/arm64/kernel/suspend.c +++ b/arch/arm64/kernel/suspend.c @@ -7,6 +7,7 @@ #include #include #include +#include #include #include #include @@ -91,6 +92,7 @@ int cpu_suspend(unsigned long arg, int (*fn)(unsigned long)) int ret = 0; unsigned long flags; struct sleep_stack_data state; + struct arm_cpuidle_irq_context context; /* Report any MTE async fault before going to suspend */ mte_suspend_enter(); @@ -103,12 +105,18 @@ int cpu_suspend(unsigned long arg, int (*fn)(unsigned long)) flags = local_daif_save(); /* - * Function graph tracer state gets incosistent when the kernel + * Function graph tracer state gets inconsistent when the kernel * calls functions that never return (aka suspend finishers) hence * disable graph tracing during their execution. */ pause_graph_tracing(); + /* + * Switch to using DAIF.IF instead of PMR in order to reliably + * resume if we're using pseudo-NMIs. + */ + arm_cpuidle_save_irq_context(&context); + if (__cpu_suspend_enter(&state)) { /* Call the suspend finisher */ ret = fn(arg); @@ -126,6 +134,8 @@ int cpu_suspend(unsigned long arg, int (*fn)(unsigned long)) RCU_NONIDLE(__cpu_suspend_exit()); } + arm_cpuidle_restore_irq_context(&context); + unpause_graph_tracing(); /* -- 2.30.2 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel