From patchwork Sat Oct 22 07:26:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 7822 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1143033wrr; Sat, 22 Oct 2022 03:33:27 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5LQ+risMx6IbuNIOZKwGVIRAX4F8nVjZQd+7MfPOOgcMLzukKI0Uerf51Bs7yweLZRiH/I X-Received: by 2002:a17:906:6a17:b0:794:f0e8:1918 with SMTP id qw23-20020a1709066a1700b00794f0e81918mr13892471ejc.474.1666434807294; Sat, 22 Oct 2022 03:33:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666434807; cv=none; d=google.com; s=arc-20160816; b=IlldAzAIXDXNjoh/C8PWT7jaN4C0Y6coz/ab5vXIWSQvPlsO8Su89o5/8W0LUCpQ4H ki/nU8k9ACwoG9L9zCHpLmYAUKJoDgREFmRdwfXxuV4dArJdujDnGAqqFPmXiqemsetV c8cNDXx8lcd/Dh/DOT2DqpkVVd6/PYB/TeXsxGAhRNr8AhDwaGwkXohntI7qbb+c24gt 78HCqxPl6KTqJMbZklojeelVendVG/MUNAHKbvnIjPQco1QxJyr9cxiq3fPeN/b1Bsc4 kXDaLLeEGacdL0u0B2UrBMghbd6XUq9AgHNyNuvYHXEXaNa4jtQ7XewKmIi+OPTlHsny zIkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=1QOQ5NG5iPgRBrdDlsm5zTSP2UOmpOfM3EYQGq2yfR8=; b=IFb1slT70ZA73LVn+nN0EYJmTcnmNre8pgqZ5omlcJPd3Ye+Laal9WHv5f5nrCzuT0 4zdhrgJr/uprbsYv3A9bJCuZhDWXO7vh3KD5bW2/DapcxP0fT1NEQRRqhUCryISDOkJd k9WjxoveuaLzgN9TvSBjR4YFVExKv/2fy/x8wRd9K3pDdZWjAVD2Ek0/ic3dud4O0UfO CnpzX1n9ovjQHtXAZmBnAOn728UXK/NuO3IcAuzrQin2o8r0h0y2Vm73IpGBTEubCdMv 2jYUDDOG9IlyNhALydoYTlbG/xi/Pq/QvniYpGFoVQptfJ+ha0vELO/s1M63mArFV48f 8q8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=SV9MakjA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b2-20020aa7d482000000b00459060fcde3si19961291edr.202.2022.10.22.03.32.56; Sat, 22 Oct 2022 03:33:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=SV9MakjA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230057AbiJVKbm (ORCPT + 99 others); Sat, 22 Oct 2022 06:31:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54468 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230338AbiJVKbX (ORCPT ); Sat, 22 Oct 2022 06:31:23 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 772D62E00A7; Sat, 22 Oct 2022 02:47:16 -0700 (PDT) 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 5E4B2B82DF8; Sat, 22 Oct 2022 07:57:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 95811C433D6; Sat, 22 Oct 2022 07:57:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425426; bh=r0iJe32ob/GSHTmdUuVBkNeqx/9YvNjYROZ+D4DgXUg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SV9MakjAkT46H87yoXwgyrSHpLQ4n+HncD1PRp0hALX0Mn38tFXiCvMgowyfxiOiZ T6wnXRPq9c2Exn6kg4LXY8rBx/9srKBkpaPdCYO13ZwgexFpKggxgsfKUWPrAERgxZ ATOS1zBJ+nY5eBMNoJ+NZ1I/kCSOo/T6xpIuhKpQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Anup Patel , Andrew Jones , Palmer Dabbelt , Sasha Levin Subject: [PATCH 5.19 498/717] cpuidle: riscv-sbi: Fix CPU_PM_CPU_IDLE_ENTER_xyz() macro usage Date: Sat, 22 Oct 2022 09:26:17 +0200 Message-Id: <20221022072520.297041515@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747383544354952918?= X-GMAIL-MSGID: =?utf-8?q?1747383544354952918?= From: Anup Patel [ Upstream commit cfadbb9df8c4dc917787da4458327e5ec14743d4 ] Currently, we are using CPU_PM_CPU_IDLE_ENTER_PARAM() for all SBI HSM suspend types so retentive suspend types are also treated non-retentive and kernel will do redundant additional work for these states. The BIT[31] of SBI HSM suspend types allows us to differentiate between retentive and non-retentive suspend types so we should use this BIT to call appropriate CPU_PM_CPU_IDLE_ENTER_xyz() macro. Fixes: 6abf32f1d9c5 ("cpuidle: Add RISC-V SBI CPU idle driver") Signed-off-by: Anup Patel Link: https://lore.kernel.org/r/20220718084553.2056169-1-apatel@ventanamicro.com/ Reviewed-by: Andrew Jones Signed-off-by: Palmer Dabbelt Signed-off-by: Sasha Levin --- drivers/cpuidle/cpuidle-riscv-sbi.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/cpuidle/cpuidle-riscv-sbi.c b/drivers/cpuidle/cpuidle-riscv-sbi.c index 1151e5e2ba82..33c92fec4365 100644 --- a/drivers/cpuidle/cpuidle-riscv-sbi.c +++ b/drivers/cpuidle/cpuidle-riscv-sbi.c @@ -97,8 +97,13 @@ static int sbi_cpuidle_enter_state(struct cpuidle_device *dev, struct cpuidle_driver *drv, int idx) { u32 *states = __this_cpu_read(sbi_cpuidle_data.states); + u32 state = states[idx]; - return CPU_PM_CPU_IDLE_ENTER_PARAM(sbi_suspend, idx, states[idx]); + if (state & SBI_HSM_SUSP_NON_RET_BIT) + return CPU_PM_CPU_IDLE_ENTER_PARAM(sbi_suspend, idx, state); + else + return CPU_PM_CPU_IDLE_ENTER_RETENTION_PARAM(sbi_suspend, + idx, state); } static int __sbi_enter_domain_idle_state(struct cpuidle_device *dev,