Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1375586rwb; Thu, 1 Dec 2022 16:47:27 -0800 (PST) X-Google-Smtp-Source: AA0mqf4pPUa/cyOA4P1Kk/p3OboeocTXBn+4RpBhWlfvYS3aTN9UalMJSmwOQcQIbQRCG4S37Uze X-Received: by 2002:a17:90a:5a41:b0:219:41ef:a812 with SMTP id m1-20020a17090a5a4100b0021941efa812mr21202006pji.153.1669942047502; Thu, 01 Dec 2022 16:47:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669942047; cv=none; d=google.com; s=arc-20160816; b=Rf2+oeWMlVjwsF6tbNcnxJq5AQiOZOGXrgMRuuoGfIwLeSAJysshcNmKD/E2zu9FHr taWjUIMn+6l4u2cnHRGI6HaWugPlnyjOIGX5o6I8mpIMb8dVXsGK+JdnyD39fF0czAOa BqIABQti5c0jXiK9ehw1A8+oh4X+mXY+yo02f8nh7z+Yn1pnXPBgiZx1o4MsZ2bIQN0h oaBVV5CBTdz8YX/daXJUB0RQflv93Z4BjQGxBUpmcVAO0PvNQTS//56T9CTDcRc2U1NM PJpEpBT2dUoXX1F1+1qc5CHIOoITt3wtyOL6HADIMZ/3GEmSfMpc88GDDEiIPYA/PDkG evzA== 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; bh=nkJj63AQ5n6QH7dnwOSIpJeyXYTYjMm/XE9Let7JGVs=; b=wv01P6YuaIexJWRTupe7UMvJTEOjVORS7pRAM6nU6sBD2Ew9ESd8I7CabIxS9zOAcQ 0o96FBsu6PMM/e5H2vU1DVX+2OE51Oo/kk68+mnDH3KFT5FJR7Zb1ALZmRh6q0RFS/Ze JQaokZFSyft0BnLcl/3+vVmkwlui1+z5s6dZ/mgE6p8iv4NudkOrfzs0iMkgQSaAUt81 QZBPBG6K+3zL/xX4A5w3WGj5D2szx1ErLOf3g0btWAjEZ4CPHPDOUeCU7GZTNLSMGgfv irf7FcMEG0gjlqLXA1Enen9KtfdgD4F6ManXChR9VwnFpld5xAtjuIBsULxTEI3a5tXU JEiQ== ARC-Authentication-Results: i=1; mx.google.com; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l16-20020a170903245000b00174ea015ee8si6587258pls.592.2022.12.01.16.47.17; Thu, 01 Dec 2022 16:47:27 -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; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231452AbiLBAGW (ORCPT + 81 others); Thu, 1 Dec 2022 19:06:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39068 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231928AbiLBAGH (ORCPT ); Thu, 1 Dec 2022 19:06:07 -0500 Received: from mail-oa1-f42.google.com (mail-oa1-f42.google.com [209.85.160.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AAB4BC82E0; Thu, 1 Dec 2022 16:06:05 -0800 (PST) Received: by mail-oa1-f42.google.com with SMTP id 586e51a60fabf-1322d768ba7so4017693fac.5; Thu, 01 Dec 2022 16:06:05 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=nkJj63AQ5n6QH7dnwOSIpJeyXYTYjMm/XE9Let7JGVs=; b=zdlPZZ0HP3xMP1U9VIsNVgOvXAWVTvZzNgpu5e87nG064NvoJVuomC8Mt7umppjnJJ WHM5+HMNN5DvQrdo+/q4+VAe561mFVihZK0I+15izE1Ma8/xeFf1zG1ML38RA8wzzuH2 kECybBNk6+qhrIV7xUofBemuCyCYfGnOb+Kh++QCbWXS092TDHlqafhwHgwxIDhVWRsf 8yP3oeiqtgkz/zrLSk6GqD6p5vbhejGjZ7umNnHZFyBHIYNlysY1+K4t/IKVWlvVK2qt kOUMExfhjgBSCpJl3BzfsD9HlCwKpJ/xe0mSj8SYqNBVA10FWVXvTKuhPleHUV/O1smc +BzQ== X-Gm-Message-State: ANoB5pmBemSUfMdUG2a/M6YYNKi9BHBeQd9vKzeoIhf7ahFlwfjR7VJV 5mFBSB0z1VfHKKgwoR3hHQ== X-Received: by 2002:a05:6871:4684:b0:141:c076:de4c with SMTP id ni4-20020a056871468400b00141c076de4cmr42017933oab.248.1669939564797; Thu, 01 Dec 2022 16:06:04 -0800 (PST) Received: from robh_at_kernel.org (66-90-144-107.dyn.grandenetworks.net. [66.90.144.107]) by smtp.gmail.com with ESMTPSA id 76-20020a9d0852000000b0066e3cebb7a7sm2681131oty.78.2022.12.01.16.06.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Dec 2022 16:06:04 -0800 (PST) Received: (nullmailer pid 1730725 invoked by uid 1000); Fri, 02 Dec 2022 00:06:03 -0000 Date: Thu, 1 Dec 2022 18:06:03 -0600 From: Rob Herring To: Anup Patel Cc: Krzysztof Kozlowski , Palmer Dabbelt , Paul Walmsley , Daniel Lezcano , Thomas Gleixner , Andrew Jones , Atish Patra , Samuel Holland , Conor Dooley , Anup Patel , devicetree@vger.kernel.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, Palmer Dabbelt Subject: Re: [PATCH v5 3/3] clocksource: timer-riscv: Set CLOCK_EVT_FEAT_C3STOP based on DT Message-ID: <20221202000603.GA1720201-robh@kernel.org> References: <20221201123954.1111603-1-apatel@ventanamicro.com> <20221201123954.1111603-4-apatel@ventanamicro.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221201123954.1111603-4-apatel@ventanamicro.com> X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS autolearn=no 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 Thu, Dec 01, 2022 at 06:09:54PM +0530, Anup Patel wrote: > We should set CLOCK_EVT_FEAT_C3STOP for a clock_event_device only > when riscv,timer-cannot-wake-cpu 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 > Reviewed-by: Conor Dooley > Acked-by: Palmer Dabbelt > --- > 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..1b4b36df5484 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_cannot_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, A platform that depended on CLOCK_EVT_FEAT_C3STOP being set will break with this change because its existing DT will not have the new property. It needs to be the other way around which would effectively be the existing 'always-on' property. > .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_cannot_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_cannot_wake_cpu = of_property_read_bool(child, > + "riscv,timer-cannot-wake-cpu"); > + of_node_put(child); > + } > + > domain = NULL; > child = of_get_compatible_child(n, "riscv,cpu-intc"); > if (!child) { > -- > 2.34.1 > >