Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1009795rwb; Tue, 29 Nov 2022 07:57:52 -0800 (PST) X-Google-Smtp-Source: AA0mqf7bg3d3h8EXp5CAZwSX3+yKJtklvVBoQ3XDZo9hRdh4fCZzqctkeRpSUPhNyh2kmKZJ1Bly X-Received: by 2002:a17:902:8e85:b0:189:8ec5:93fb with SMTP id bg5-20020a1709028e8500b001898ec593fbmr9287195plb.154.1669737472320; Tue, 29 Nov 2022 07:57:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669737472; cv=none; d=google.com; s=arc-20160816; b=sn/G/FTCXX0p+f9i/4LZ2CZ7zUf9z5ZIPQ2IXGwbTi/CqV0f2Ob8H+4N/RKztIXYUS 0s4hTTQndRZdwtmQrxd4hUYQWQuYJATbykC9SvC3Y/yJQip3Ok4fX48M0tNCNi/zJaZ7 AUSvCplSLsumaXPJjAyPRzE6wmDWcctm0YHmpE2D9RmXwvQ+Dv+coFYPDjdgk0VVyaeb BGCiBYl3/Dd+0UjUv3EycTZeXMT4SbnloEIGoE4mLocyNnv6fKVvVigHMeA0r+5br8r7 0aIBdaV1EwgJSQ43To1IPi4HNzz/1fozOkW0I2XxMVq085aHiyelRvApBpUAsvWL97sy jNog== 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=mJaAMZmtbmPKAvqjF4jZgmXF62Ofnfwqmy4EAUFwvCU=; b=BOuOfE0hkeKKISr/9WSjMuCIvrehz2S1jHHBsmJ0mML1oD2Nc1K6hESX3nllmc9ylj EqnJADrsarS7rgxHRuaoMLHpAzhPKiFT6Bf9sOvbsnhvnhPyjpg5b0TrheyUW+MxYdms 14+iKgWLaEhaMno9Wy3hUw9mg8GJGg1X6tW1EoiBfbTcTepoFH/PK05+2/MxvF83DYws 5KIlGJgRRqPIqR1WNxZJlJihE6cQQTKVxoNSNiVlvHRf7WczG4GtbPMiJyCh1PIbQ18E 5LsDYQiyTR54N6JxWkKfeakbpZJZ6DxsfP+Q8q74QkQd7kTPf+AJFKYkSaJabqZvGoxe VIiQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=BuSBcgVo; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k8-20020a170902ce0800b00188c5696683si15743919plg.188.2022.11.29.07.57.41; Tue, 29 Nov 2022 07:57:52 -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=@microchip.com header.s=mchp header.b=BuSBcgVo; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235514AbiK2Ogw (ORCPT + 84 others); Tue, 29 Nov 2022 09:36:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44662 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234686AbiK2Ogu (ORCPT ); Tue, 29 Nov 2022 09:36:50 -0500 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D64BC3AF; Tue, 29 Nov 2022 06:36:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1669732608; x=1701268608; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=joBDR/6R/yQ5IZXkVvlgcx/puPOD9ZA3pVYvhslPmAU=; b=BuSBcgVouqWF9EduZ6uA8/Pt7Cos6pQ3VYC/Q+vGV+OigBClAVySQ4fi w7lOnKWSOTEKJPeYSaO2f1/PegdQxEnAWVwus/38/ZbmbphG5298UekSm jKHO49AyIsQuTqzWEVfNc6X+oXcBT1jysfOPl9pN4xgtn7PRMy/LzfbOG HSirkf/ZcrkXJKuwQM4tQfZPiDRymRqqn8WmC920BNtNSGajwE/uvkCsd ilia0x2TsRHs+3brC4pAWfzZYxwjx4Woh0RoxfuwTBH8EFdMA80VONZsS 2MNBzr4nFl9G2rB0rqOKX85XyR/4x51z8LtwFUfMfw+XotB43JWkvTWCj A==; X-IronPort-AV: E=Sophos;i="5.96,203,1665471600"; d="scan'208";a="189175751" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa2.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 29 Nov 2022 07:36:47 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.12; Tue, 29 Nov 2022 07:36:47 -0700 Received: from wendy (10.10.115.15) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.12 via Frontend Transport; Tue, 29 Nov 2022 07:36:45 -0700 Date: Tue, 29 Nov 2022 14:36:26 +0000 From: Conor Dooley To: Anup Patel CC: Rob Herring , Krzysztof Kozlowski , Palmer Dabbelt , Paul Walmsley , Daniel Lezcano , Thomas Gleixner , Andrew Jones , Atish Patra , Samuel Holland , Anup Patel , , , Subject: Re: [PATCH v4 3/3] clocksource: timer-riscv: Set CLOCK_EVT_FEAT_C3STOP based on DT Message-ID: References: <20221129140313.886192-1-apatel@ventanamicro.com> <20221129140313.886192-4-apatel@ventanamicro.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20221129140313.886192-4-apatel@ventanamicro.com> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,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 Tue, Nov 29, 2022 at 07:33:13PM +0530, Anup Patel wrote: > We should set CLOCK_EVT_FEAT_C3STOP for a clock_event_device only > when riscv,timer-cant-wake-up DT property is present in the RISC-V > timer DT node. > > This way CLOCK_EVT_FEAT_C3STOP feature is set for clock_event_device > based on RISC-V platform capabilities rather than having it set for > all RISC-V platforms. > > Signed-off-by: Anup Patel I thought I had left an R-b on this one? Reviewed-by: Conor Dooley Also, I think that we need to backport *something* that disables C3STOP which is why I had suggested keeping the revert in place. Patch 1 of this series only solves the timer issues but does not restore sleep states to their prior behaviour, right? Either this patch or the revert needs to go to stable IMO. Thanks, Conor. > --- > drivers/clocksource/timer-riscv.c | 12 +++++++++++- > 1 file changed, 11 insertions(+), 1 deletion(-) > > diff --git a/drivers/clocksource/timer-riscv.c b/drivers/clocksource/timer-riscv.c > index 969a552da8d2..0c8bdd168a45 100644 > --- a/drivers/clocksource/timer-riscv.c > +++ b/drivers/clocksource/timer-riscv.c > @@ -28,6 +28,7 @@ > #include > > static DEFINE_STATIC_KEY_FALSE(riscv_sstc_available); > +static bool riscv_timer_cant_wake_cpu; > > static int riscv_clock_next_event(unsigned long delta, > struct clock_event_device *ce) > @@ -51,7 +52,7 @@ static int riscv_clock_next_event(unsigned long delta, > static unsigned int riscv_clock_event_irq; > static DEFINE_PER_CPU(struct clock_event_device, riscv_clock_event) = { > .name = "riscv_timer_clockevent", > - .features = CLOCK_EVT_FEAT_ONESHOT | CLOCK_EVT_FEAT_C3STOP, > + .features = CLOCK_EVT_FEAT_ONESHOT, > .rating = 100, > .set_next_event = riscv_clock_next_event, > }; > @@ -85,6 +86,8 @@ static int riscv_timer_starting_cpu(unsigned int cpu) > > ce->cpumask = cpumask_of(cpu); > ce->irq = riscv_clock_event_irq; > + if (riscv_timer_cant_wake_cpu) > + ce->features |= CLOCK_EVT_FEAT_C3STOP; > clockevents_config_and_register(ce, riscv_timebase, 100, 0x7fffffff); > > enable_percpu_irq(riscv_clock_event_irq, > @@ -139,6 +142,13 @@ static int __init riscv_timer_init_dt(struct device_node *n) > if (cpuid != smp_processor_id()) > return 0; > > + child = of_find_compatible_node(NULL, NULL, "riscv,timer"); > + if (child) { > + riscv_timer_cant_wake_cpu = of_property_read_bool(child, > + "riscv,timer-cant-wake-cpu"); > + of_node_put(child); > + } > + > domain = NULL; > child = of_get_compatible_child(n, "riscv,cpu-intc"); > if (!child) { > -- > 2.34.1 >