Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp3093790imw; Mon, 18 Jul 2022 01:52:53 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sHfEURxKkCK6ebRBs7TvecWy3aEwXKysw9yZ0r5UGhu54LIZLotfQBWUf00BY/t0ExcOW2 X-Received: by 2002:a05:6402:782:b0:43a:7387:39df with SMTP id d2-20020a056402078200b0043a738739dfmr36688938edy.251.1658134372902; Mon, 18 Jul 2022 01:52:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658134372; cv=none; d=google.com; s=arc-20160816; b=maCUcnd6QIr3l5V3rn9RFbDP7yDPy03c9uczmw230/7Krig1jH7uAA66opzrOE++UV VPXVJt04bVfAcO/vMI+UtkDlgyChc76iOfcu5y4Ck9W0a8fIifWOTw9yLVM/glD8bYow cqMNMNliZENpcOBYVpgetzBqd8BzHIdF9RNFrFfeTlJPvGw+Eur+K/Kt4qVFcKiNkiLD ZCIAQkKou1pGBA1xgCzbYKoZXa2L9IhKxFsncru/Xpbw53pAj6nYMfrNJXs7X78Tj3ir IPoTayKKDA26ypCwGnp+7NOAR8LKZrOjaGscg/Ak9dr9EZYMAlMgpJXRsjMDGQzvI0tI YfQQ== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=Y957zCpGlniV/Si1gB7hyzzV3GqFvEOSGpTrCkRJ3N4=; b=qMNJ33r6sXr8652upQgjIgpnHDWH0yDvbKNZka5K1kvNfkfj9q/oSIW6RvxK+O3sjn eSCZblv82MuWg0f14KkgpAVoaMLpAb0XQmx5/o6FN33raRyqGkCqhqLja39M+ZtJTaY2 bFpVpjGhdNGEoZIHGS2B2ossIEmqpUNpY/sEpT74CkllPzmfxCrh/JvPNAZ4vPw15YrI 9251ENaaps2M4fhQA2Lb0vfYm/kD+PCIBNA2/TM42aMbaaI30C0eSNR2C/KO2HR9pPTh 8fN90W3xBvb+saoqn5BjncshyxyG0MuYW2EGQo8ID0GFVeIjTYsGHX6Fj0XGSKE0dcfB o2pw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b=TS8oWTsN; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a1-20020a50c301000000b0043a6af70491si15243628edb.492.2022.07.18.01.52.27; Mon, 18 Jul 2022 01:52:52 -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=@ventanamicro.com header.s=google header.b=TS8oWTsN; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233960AbiGRIqf (ORCPT + 99 others); Mon, 18 Jul 2022 04:46:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51470 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233932AbiGRIqc (ORCPT ); Mon, 18 Jul 2022 04:46:32 -0400 Received: from mail-pj1-x1033.google.com (mail-pj1-x1033.google.com [IPv6:2607:f8b0:4864:20::1033]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0BFD7B6 for ; Mon, 18 Jul 2022 01:46:32 -0700 (PDT) Received: by mail-pj1-x1033.google.com with SMTP id y14-20020a17090a644e00b001ef775f7118so17531089pjm.2 for ; Mon, 18 Jul 2022 01:46:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Y957zCpGlniV/Si1gB7hyzzV3GqFvEOSGpTrCkRJ3N4=; b=TS8oWTsNuIKrdwz7CdqkNr+Kyt2Fkt1mCq4Ny+Vw68yXzZfoO6nk5PfGIF2Vslrs9Q EYzquS26tAqK23AjcRIws+7QPlLihZjNPF472zGRnEorq852UPp1qrL1WzeXhy5VU7/j 7JZxDDdj/8qS2cZBVMmkrUpIJUTd6SXj5fEWvo1MXFfovv6aivByO5jqhq7Jr0RHw5w9 qL13T/B01oDW0cpgjGtu+2p/4Y3Y+P7R5LCBTlnU8RuSEOppyblLrsuvMD3XtiNarh0B rRhKoA+ktuLOw4zwOCrhtwCxXMis2U5gYd0IaJBSll6lFTdH/O1pPkNhiyvDOI3aewKl EVcQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Y957zCpGlniV/Si1gB7hyzzV3GqFvEOSGpTrCkRJ3N4=; b=B+tO9uVjjAWhVjUTF4HKAx3moNlM32bFkYAOwx/ChoP3eMMj2PzkBgQMhT6xOGhCfG ph7DoDuIlpugHyuPlkvkN2oqMqAK7l40KiS0A5znh2an48gSSrg2L+r5sklNYk3Dg2O5 C5sIFKepuXZv/5PKvlKFmtqTOgDHNWtkAxllKKO32goPTtb8WLV49fXZBK6gxZ+ATKOt fB+Y32nbMu8FnXxizqkvldz5U/TvNXeYFXvQonQ9FWeRRf3C26nIY7XhtscmoJqrbbrV Ba4vXMWRzfvAP3HvB6ot65g9ZTtMKw3HRy/UR8mhXU/oW62PCmreqP3lZyZ/thHutaTv QQaA== X-Gm-Message-State: AJIora/WEyFgYktlcox+25XuHCyM5iZ9bK3khAAHHs+Xnf985Ux5DN4v 48vsGGIJW8YMDVwpjxXtzkz9Jg== X-Received: by 2002:a17:90b:4b50:b0:1f0:5643:fa5c with SMTP id mi16-20020a17090b4b5000b001f05643fa5cmr38855624pjb.131.1658133991458; Mon, 18 Jul 2022 01:46:31 -0700 (PDT) Received: from anup-ubuntu64-vm.. ([122.171.37.148]) by smtp.gmail.com with ESMTPSA id t6-20020a635f06000000b0040dffa7e3d7sm7556487pgb.16.2022.07.18.01.46.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Jul 2022 01:46:30 -0700 (PDT) From: Anup Patel To: "Rafael J . Wysocki" , Daniel Lezcano Cc: Palmer Dabbelt , Paul Walmsley , Ulf Hansson , Atish Patra , Alistair Francis , Anup Patel , linux-pm@vger.kernel.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, Anup Patel Subject: [PATCH] cpuidle: riscv-sbi: Fix CPU_PM_CPU_IDLE_ENTER_xyz() macro usage Date: Mon, 18 Jul 2022 14:15:53 +0530 Message-Id: <20220718084553.2056169-1-apatel@ventanamicro.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, 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 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 --- 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, -- 2.34.1