Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp3596286imw; Mon, 18 Jul 2022 10:55:12 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vXJh2vN/glVmou+fN5sgTwqXIGcSOG+V2/6hPu08Cy8QLSlxio4BNdCxRQFL2pk69T9E1u X-Received: by 2002:a50:fa91:0:b0:43a:4f13:4767 with SMTP id w17-20020a50fa91000000b0043a4f134767mr39307349edr.10.1658166912636; Mon, 18 Jul 2022 10:55:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658166912; cv=none; d=google.com; s=arc-20160816; b=ONgkTDxwphkidg+rj+r2EBVj21Mlrfe6l9XfYjAQf4bi4oWOBqhdZie11G6QsA8WGH +dUYf34s2mw8diS+bnG4fuVkToVdF+UUpx1+5x/TkMUxUI6TjMtUgiu1fqM0FqrpOH5o 1dqOnvGT45/yBEjOolNoiVNGO9Ds3TgU3s3R3KVrO2hfFumxSg0mkmtHUwE7sYU3eWrd PN+6z9H9jjOrjvUTfFgTId/wJNlsRLjvoKTo4hmg1ymeIKdBxKafZNSQVRsr0IYsr0OP bEA/QWMjH7M0g8YNCJgchf7+Lm+KBbef6IFvP/pbLZz5UwlP2yvtbL5zmITPgI61DTTV Ua9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=kGv4Dzn3NGROuY+ZnagFOTMoVDNdaJpTmvteY9zyqDw=; b=fkkI1K7wCx2oVxWq4Kvl8zqWVyOORi4F4nsZddjC1krlDgF9qXXBQYORwJ7rIVJaSc mwcNWhE5gpToqg1ubuNTcYUWzz899qmLx3ARVOKnSkJEWJnGqhX3AhmSRPN7+kge/Ho0 xK61e198ZPZr5/fm4HzXC3jado9R11XOsYVbfu42BIx6eR+D02UTWUj9ZKNCIbQEHe1a MwrgfIbGXrw2MaClYZcqw1OaLeHANzPixzL/Zs6KJUE3K0vmsQHAdui0J/NfguJUAuy4 8mqpD0DDhZfokDiQmJ4Wu2xabXW7CFpqnsffB2bh+h6DYEDAU7NQa2o1NCixLyNGDzw9 y2gw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b=k7OtEKw8; 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 qk31-20020a1709077f9f00b0072b919c8216si19418471ejc.609.2022.07.18.10.54.48; Mon, 18 Jul 2022 10:55:12 -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=k7OtEKw8; 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 S235414AbiGRR1z (ORCPT + 99 others); Mon, 18 Jul 2022 13:27:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45518 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233707AbiGRR1y (ORCPT ); Mon, 18 Jul 2022 13:27:54 -0400 Received: from mail-ej1-x635.google.com (mail-ej1-x635.google.com [IPv6:2a00:1450:4864:20::635]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E30922C640 for ; Mon, 18 Jul 2022 10:27:52 -0700 (PDT) Received: by mail-ej1-x635.google.com with SMTP id mf4so22573003ejc.3 for ; Mon, 18 Jul 2022 10:27:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=kGv4Dzn3NGROuY+ZnagFOTMoVDNdaJpTmvteY9zyqDw=; b=k7OtEKw8ePt0J1gLOCtaDbhJFTnNEB9nIdz7gNXp+iOw2AbBV0Wss1w4VdVBKCfwaV sksMG9FHNQ8hNf8txKjO48pwrlEcbcGT1TQYDofR6d0i9AExPeHT6wROP3UiQnTjKaNr RRG9b7k+cRbjIH/kk4RzVRophBDuJiIBIAmYiHo+tVbqtn1yfapzRlKTTvL5La9+zKVK bVdbVZOgzSGligYwiFAgUtdcG/sy6R/jR8/qDcreQ90gvQkPkXDPMyAb7y6aj24OErz+ yvvk3pWoEfO1cbAv4EuHrxFtXo7d3P/FubxWcez8WiA3ZvV5QBgnuBKq8phcEImce+IN SQcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=kGv4Dzn3NGROuY+ZnagFOTMoVDNdaJpTmvteY9zyqDw=; b=rbFBl9H9zXZ82hiIKwxWl13Ags4NvBbnfABNHEMG2L+ugfMex5iA6k0yxDPZroSux0 KmJqArgY/0vKrNMUik8Wx19xCfIHE2lh+o6jV/P3FXRR8tlXS8ercW7gSGSwaDMD171r xydOO3kEDD4k2g+y+eL595bOaXOidDFBVL7oJywcLSo0Rb9fXVKAT5BRo8dCFhvjBtfh KoyL7mdVlHWly5KJv9zaOI0EhxvWi6obu3Rjnu6DhVtP9wIy1O71SKDFoBuaoL3DCq/T 2JSQ28fSZNp6ouM2RTuShX2xvvdQzAeyJxSsEathneTLJcUOXp2ULVTD+rLGoj7j6ANX 6vdQ== X-Gm-Message-State: AJIora9f+muvk9hxTjUaa9QzmRGXKEXALTJhD0D/O0SfVS3dkBnRRGXM hFEk9Qax1FdMh8bzpOt7CnKu1A== X-Received: by 2002:a17:906:ef8c:b0:72e:dd32:4163 with SMTP id ze12-20020a170906ef8c00b0072edd324163mr21073322ejb.430.1658165271505; Mon, 18 Jul 2022 10:27:51 -0700 (PDT) Received: from localhost (cst2-173-67.cust.vodafone.cz. [31.30.173.67]) by smtp.gmail.com with ESMTPSA id gr19-20020a170906e2d300b0072b592ee073sm5803535ejb.147.2022.07.18.10.27.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Jul 2022 10:27:51 -0700 (PDT) Date: Mon, 18 Jul 2022 19:27:50 +0200 From: Andrew Jones To: Anup Patel Cc: "Rafael J . Wysocki" , Daniel Lezcano , 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 Subject: Re: [PATCH] cpuidle: riscv-sbi: Fix CPU_PM_CPU_IDLE_ENTER_xyz() macro usage Message-ID: <20220718172750.fgncyl3egnrykt5a@kamzik> References: <20220718084553.2056169-1-apatel@ventanamicro.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220718084553.2056169-1-apatel@ventanamicro.com> 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 On Mon, Jul 18, 2022 at 02:15:53PM +0530, Anup Patel wrote: > 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 > Reviewed-by: Andrew Jones