From patchwork Mon Nov 21 20:56:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Palmer Dabbelt X-Patchwork-Id: 24012 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp1830267wrr; Mon, 21 Nov 2022 13:00:46 -0800 (PST) X-Google-Smtp-Source: AA0mqf71Kn9GcIRuMCqKE9JpnWia3xt+RL0+hgwnUS30wdjVwamJ220tWL8+Jl5+WrDicxY1Olhn X-Received: by 2002:a17:907:7650:b0:781:e568:294f with SMTP id kj16-20020a170907765000b00781e568294fmr2995458ejc.447.1669064445964; Mon, 21 Nov 2022 13:00:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669064445; cv=none; d=google.com; s=arc-20160816; b=rkZGHOA6t3wbqM0O5O/qs294W4m+danpQARcGn4klSyYHlfifxahBzSqaa3d3EAsz5 hpzoGtrqgjhChAWm4+r19oCmRkBaEF8Kx8x+cFe6mTI8bqnU7uLOZUcBSqPtysqFrcwg aFFY38PDnYPTU9aTaC/GdcM9HmJrmds+WmEyHsRnoE4iMcAvwQOHvOMFEMDUTfiG8W+e RAeMvCBSbhvCA3TWyErAb8/dn78gGCsaBkI/tx1wkyDCpFvn4RP1m/0PiYkQifl13VhE bxqBBhxAZ3i7szOtHxcJW/rbEFFlM1oKsxrjXr12++Og8iqS+dccXhNiuKdTqw0abBF5 hW8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:from:cc:content-transfer-encoding :mime-version:message-id:date:subject:dkim-signature; bh=a+8s62R9vB+JzHkkOoet6Cx6GWbxqA3eYfIMwlFnB9o=; b=m1DQ7aOfhhI71Lf0mtopVUav6BpmcXdWb4hDKKDv/PNdh8yFwLyBEG+e/nPWyGUq4L iooJ3ynLEgk87TOSHoPR39b5HRgBcAK4zRwY0nHwovKxXY4HToBOiCEaNF2bBfBD2OgJ 9bNkfnh3itSXw4ommYwNSPMeYtbVrmRsvs8QwKyS963Z4dCDVGuabfTIBdjdaDGaBPKT NUEKUhH5JVMCoqhqHGPj6yCTppid7y9Iug0FHhTtJRaxNmMpF2Q+ywyxzvI9gQo+N1Fk hEoA13fa2ZlTvHST0NpE9ID3AeHxH2IhV03Lbo5s3K+53VkoATKVznaii1RJhvrJnLt1 Cscg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rivosinc-com.20210112.gappssmtp.com header.s=20210112 header.b=fniv4c5W; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id xa11-20020a170906fd8b00b007306ac0faa0si3779793ejb.615.2022.11.21.13.00.20; Mon, 21 Nov 2022 13:00:45 -0800 (PST) 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=@rivosinc-com.20210112.gappssmtp.com header.s=20210112 header.b=fniv4c5W; 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 S230202AbiKUU5X (ORCPT + 99 others); Mon, 21 Nov 2022 15:57:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56000 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230148AbiKUU5R (ORCPT ); Mon, 21 Nov 2022 15:57:17 -0500 Received: from mail-pl1-x62e.google.com (mail-pl1-x62e.google.com [IPv6:2607:f8b0:4864:20::62e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1ABE2D92EF for ; Mon, 21 Nov 2022 12:57:17 -0800 (PST) Received: by mail-pl1-x62e.google.com with SMTP id b21so11680163plc.9 for ; Mon, 21 Nov 2022 12:57:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20210112.gappssmtp.com; s=20210112; h=to:from:cc:content-transfer-encoding:mime-version:message-id:date :subject:from:to:cc:subject:date:message-id:reply-to; bh=a+8s62R9vB+JzHkkOoet6Cx6GWbxqA3eYfIMwlFnB9o=; b=fniv4c5WvNO/fe0wN9wrXEKEfDwyhJUrFdsvKJuO4y8MLgjdPfrmtbqzVu9910adRx JhWCrZzOw5Y4TMTcRNRUMinuR1pTJc07Ab2uIsBTenDVRwIWcSufF0FviArIpiMuWU+P IPtgSPdMeOKp463RZepfWc5GcgnQ1IXwCnXW25wm8eXMbmVuzAGpXvLVDLRyyao1O19g TSpEVqACWSznUcJxTOOQQB2Hl65J4fAhUqLmy4Dld6xq7YGsBTKCXVwuBv4u7AMIz7/t DTzDtC7BTLu1NCSJNGzUlPFc5UqYceYH3rDOtzavepUkuWizF7c6H8sq7yXjv7CjjjEH Xoaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:from:cc:content-transfer-encoding:mime-version:message-id:date :subject:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=a+8s62R9vB+JzHkkOoet6Cx6GWbxqA3eYfIMwlFnB9o=; b=1qP5BmzmNpkvXDRZgrOVVE59tb81icoE8hc6E+BM/JxDjAmaTznzeeah2Y58lPAwQ6 LISQB+nln0rATEMPycZiSlX9avUhRcokROkgHiBYZWMiAfc0s7H9Ei+DClVDV2EL3BkN BgQ4ctLTPBzvUNxwpBCXY44ecxGUS0xQI4QBV601YnNdealShspE2Z0qXPsPCxIM8Lyh G4Mcju0PX15nu/DFkbraXSi2BVtnVXjfQpy6t2nH8LKhlq8AJ9lzxaU4+jicLztvgFFG 1tjSFlgaIE4s/Slzn54AW/+wz/2bIUgMOb4Y7VkGMZXQvEziaQV9TN8h8WJb36CLof4U VrfQ== X-Gm-Message-State: ANoB5pnYBVCxJrFUP7atlQhek1eRPd7SolGIJKGyOWK7IsC9h+y5vU0N 4YdkVM5IrALFeaJ9gIu0tphA5Q== X-Received: by 2002:a17:90b:3c0d:b0:20d:478a:9d75 with SMTP id pb13-20020a17090b3c0d00b0020d478a9d75mr28239558pjb.149.1669064236510; Mon, 21 Nov 2022 12:57:16 -0800 (PST) Received: from localhost ([50.221.140.188]) by smtp.gmail.com with ESMTPSA id b10-20020a170902650a00b0016d773aae60sm4937091plk.19.2022.11.21.12.57.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Nov 2022 12:57:16 -0800 (PST) Subject: [PATCH] cpuidle: riscv-sbi: Stop using non-retentive suspend Date: Mon, 21 Nov 2022 12:56:47 -0800 Message-Id: <20221121205647.23343-1-palmer@rivosinc.com> X-Mailer: git-send-email 2.38.1 MIME-Version: 1.0 Cc: anup@brainfault.org, rafael@kernel.org, daniel.lezcano@linaro.org, Paul Walmsley , Palmer Dabbelt , aou@eecs.berkeley.edu, linux-pm@vger.kernel.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, linux@rivosinc.com, Palmer Dabbelt From: Palmer Dabbelt To: Conor Dooley X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750140920056635343?= X-GMAIL-MSGID: =?utf-8?q?1750140920056635343?= From: Palmer Dabbelt As per [1], whether or not the core can wake up from non-retentive suspend is a platform-specific detail. We don't have any way to encode that, so just stop using them until we've sorted that out. Link: https://github.com/riscv-non-isa/riscv-sbi-doc/issues/98#issuecomment-1288564687 Fixes: 6abf32f1d9c5 ("cpuidle: Add RISC-V SBI CPU idle driver") Signed-off-by: Palmer Dabbelt Acked-by: Conor Dooley --- This should allow us to revert 232ccac1bd9b ("clocksource/drivers/riscv: Events are stopped during CPU suspend"), which fixes suspend on the D1 but breaks timers everywhere. --- drivers/cpuidle/cpuidle-riscv-sbi.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/cpuidle/cpuidle-riscv-sbi.c b/drivers/cpuidle/cpuidle-riscv-sbi.c index 05fe2902df9a..9d1063a54495 100644 --- a/drivers/cpuidle/cpuidle-riscv-sbi.c +++ b/drivers/cpuidle/cpuidle-riscv-sbi.c @@ -214,6 +214,17 @@ static bool sbi_suspend_state_is_valid(u32 state) if (state > SBI_HSM_SUSPEND_NON_RET_DEFAULT && state < SBI_HSM_SUSPEND_NON_RET_PLATFORM) return false; + + /* + * Whether or not RISC-V systems deliver interrupts to harts in a + * non-retentive suspend state is a platform-specific detail. This can + * leave the hart unable to wake up, so just mark these states as + * unsupported until we have a mechanism to expose these + * platform-specific details to Linux. + */ + if (state & SBI_HSM_SUSP_NON_RET_BIT) + return false; + return true; }