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,URIBL_BLOCKED,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 E44B9C47082 for ; Tue, 8 Jun 2021 17:29:37 +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 B30A661377 for ; Tue, 8 Jun 2021 17:29:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B30A661377 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=5OO09oRGzkMa/CNdHXWGjv0LdXUYX98a9z/B+9JIK/Y=; b=ir2pyRw6vrx4Dk 9GvLiedDJHk0dYtlvx1fpJXtqLY6yxhfnCSJDFAyVsvsJTwkOqf6wrME/DR95+8S7KvWKR8qTIGhh BymDhNBdvMDhR/qV+qD625PtoSYz8+Lmzq7t3b6SnvYv3M+wFRuvoC9LxTvW0ecJXHkB0WcTGAcvu D+EEHtL5gHtSJVK5dhNK3DOI0veM9ql+poaUJkoLbuM05CIS0HJhxFp8sw12DzVeYxyLHipFacpSw UNiwttAo+kZTaLnOd4lFEyAf/BtCV0cVdUQkNwqPQqD0DTymxNmhq08EXp8rZ1p+5sdYpzS6Z/4gF K6HPCs6ezunNF0BjL5+A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lqfWN-009jGO-Fo; Tue, 08 Jun 2021 17:28:11 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lqfVj-009j8X-Qk for linux-arm-kernel@lists.infradead.org; Tue, 08 Jun 2021 17:27:33 +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 9FBFA61375; Tue, 8 Jun 2021 17:27:31 +0000 (UTC) Received: from 78.163-31-62.static.virginmediabusiness.co.uk ([62.31.163.78] 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 1lqfVi-006Gb4-0k; Tue, 08 Jun 2021 18:27:30 +0100 From: Marc Zyngier To: linux-arm-kernel@lists.infradead.org Cc: Lorenzo Pieralisi , Will Deacon , Catalin Marinas , Mark Rutland , Valentin Schneider , Alexandru Elisei , Russell King , kernel-team@android.com Subject: [PATCH 3/3] PSCI: Use cpuidle context helpers in psci_cpu_suspend_enter() Date: Tue, 8 Jun 2021 18:27:15 +0100 Message-Id: <20210608172715.2396787-4-maz@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210608172715.2396787-1-maz@kernel.org> References: <20210608172715.2396787-1-maz@kernel.org> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 62.31.163.78 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, 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-20210608_102731_899740_AC4D65A2 X-CRM114-Status: GOOD ( 12.71 ) 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 The PSCI CPU suspend code isn't aware of the PMR vs DAIF game, resulting in a system that locks up if entering CPU suspend with GICv3 pNMI enabled. To save the day, teach the suspend code about our new cpuidle context helpers, which will do everything that's required just like the usual WFI cpuidle code. This fixes my Altra system, which would otherwise lock-up at boot time when booted with irqchip.gicv3_pseudo_nmi=1. Signed-off-by: Marc Zyngier --- drivers/firmware/psci/psci.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/firmware/psci/psci.c b/drivers/firmware/psci/psci.c index 3c1c5daf6df2..d10675bdd9d0 100644 --- a/drivers/firmware/psci/psci.c +++ b/drivers/firmware/psci/psci.c @@ -333,13 +333,18 @@ static int psci_suspend_finisher(unsigned long state) int psci_cpu_suspend_enter(u32 state) { + struct arm_cpuidle_context context; int ret; + arm_cpuidle_save_context(&context); + if (!psci_power_state_loses_context(state)) ret = psci_ops.cpu_suspend(state, 0); else ret = cpu_suspend(state, psci_suspend_finisher); + arm_cpuidle_restore_context(&context); + return ret; } #endif -- 2.30.2 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel