Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp4877193rwb; Mon, 21 Nov 2022 13:11:51 -0800 (PST) X-Google-Smtp-Source: AA0mqf6t1P0w4vZ0HflpzUfaMp4Pu4BXhg7AZKvHYFvKmvkPvbqKh5OadWyJtuobsGSzAojSGcxC X-Received: by 2002:a17:90b:48c8:b0:20b:16bc:8493 with SMTP id li8-20020a17090b48c800b0020b16bc8493mr22544301pjb.210.1669065110776; Mon, 21 Nov 2022 13:11:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669065110; cv=none; d=google.com; s=arc-20160816; b=CFYT6SdbiDiO4Ol0lOFzN/ZQCcz4TbaPD8Rnz1LkUix9Y8eTTfjxfZ5nmRY+XBnMnx 6+YNDPzH+Rq+kH67wDOfIe/0NZ/OnwBfaBSZ8dPXLBD8eE7HHiHQl4zExNw0Nf85u+1R EbTfl43fh7w/HCw9KW3tm5Kw9LMKdXb1rxGAKqeQnnyQ9SuZGuFYh7UH6OKywj51AlN4 UnJw1bKQBUVnY7yp2CCXQ015FKj2aQxUmoUt22qWTNizWtNq1Cw0UAJiWgv+IFMcwIzT WYxx9axZhdvEfMZMx1O0nyA02jVA9JBwKqPHNCvnTUaxpwepHU7/7y0SYwPQljMioPOk UbnQ== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r22-20020a63ec56000000b004769983b39asi12466382pgj.667.2022.11.21.13.11.37; Mon, 21 Nov 2022 13:11:50 -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 + 91 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 Content-Transfer-Encoding: 8bit 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 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 --- 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; } -- 2.38.1