Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp11892644rwl; Tue, 3 Jan 2023 06:18:08 -0800 (PST) X-Google-Smtp-Source: AMrXdXuOdrbn8Ko3EAk9TQ0+H/gHwY8uAWTwNzP3nW97cKxpoXVtzLz8NrKNu4m9+kKIcHsqpXG3 X-Received: by 2002:a17:903:110d:b0:192:8b0e:98e1 with SMTP id n13-20020a170903110d00b001928b0e98e1mr34506273plh.54.1672755488437; Tue, 03 Jan 2023 06:18:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672755488; cv=none; d=google.com; s=arc-20160816; b=B/BUYQUMrUhsVbBCrO9G3I7PyZMx86jDwUcZRxnS/ZaEhHcHtm8GNOUruGUw12svBE 07tJPp3VxP3qP0uFXFdNs41GYqI6eNqwCd1Q+swssBY8lNWG0pP09LX+GhfqoJIHMFym HMgqXyyObuKlCPeM4o02IOEu+ckJcVv3F93P0q72SeOBkIG7fS3162Im/+OznPpvEzuX 6rdPirS0EbnTl+j3iDDGYL03Us3/XB3TwPM738YeVIOVGMSCrXDyCs5PNy7BS4wR68jJ 0+Nl6SbM8bX274nth19mwumqnMQtVlRynkRHLXmu7/gyeisdpdsZyO5tJgqEDgCgEUKx haSA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=bVqqR8oYcz8ddBS+TT8ZlpXaMsGagFVr9rYdfxP/rIg=; b=chz2zHXi+9Fi0Y4lYWwKnm7auRRy5JShWPR41j7gvS0f65iTp+g+GFtgIIpQODLAGs KsgT8CNf47BMDkwZMBLODinDUiGeH7nWTvhwbNCCQ32DgCM/Efy5PBCSMj6q9UDZTRcO FCmcqDbzYA+KNGNS14ujGMsNKRxOHYCJunPMFzGMwUNbnohBd6twHqOKBWzqDoh8Yrvh VCUB0sU17VTA/q2N7oUx9ad2l6K3FGkjPP3Zj8smJ4OPF/CYbFZpo9EuQGUYJuTYwR2g 0DvXHHl95Dw2E6OVVWSexDswvIjWt4gX+DBIu+ghcv3IgQp165dA8gCvqbDXP4sndaSh BmuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b=kW8IcmMw; 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 r8-20020a170902be0800b00189d1d721c4si29309306pls.584.2023.01.03.06.17.50; Tue, 03 Jan 2023 06:18:08 -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=@ventanamicro.com header.s=google header.b=kW8IcmMw; 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 S237806AbjACOMF (ORCPT + 60 others); Tue, 3 Jan 2023 09:12:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58108 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237804AbjACOLb (ORCPT ); Tue, 3 Jan 2023 09:11:31 -0500 Received: from mail-pj1-x102c.google.com (mail-pj1-x102c.google.com [IPv6:2607:f8b0:4864:20::102c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 65A5010B67 for ; Tue, 3 Jan 2023 06:11:29 -0800 (PST) Received: by mail-pj1-x102c.google.com with SMTP id o31-20020a17090a0a2200b00223fedffb30so31203028pjo.3 for ; Tue, 03 Jan 2023 06:11:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=bVqqR8oYcz8ddBS+TT8ZlpXaMsGagFVr9rYdfxP/rIg=; b=kW8IcmMw6snEgGMOnD3J92gTuk6kXiuNTjEsajrxn76hj89qmb0gT/j1/qFeeaZcTK J7LFnoEKURv0KZL/X29slpZTSrySPN5sRBqG+GbClcwUnXFtzoS6NbTHnUJ8vGga4irf 9lxRXfjRRUsTze6dbDeO3NxWQPkVIvEoltyCBU1H9fZNrbEqGBmVyV/XBJpp3FSgVUTH Yil5BTK+LuQ0bQZ80GE9sQ//XmF1G1yIs+uwTCzAZyhAXRaLkvK+gWt2lO/sVASuB8KD qTS7RFi9IQW6i5O1skxC9zShTpxzBKgZj+Y6P81xB5o6I+lZJxTCH2jgccHosXEmTglz TJPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=bVqqR8oYcz8ddBS+TT8ZlpXaMsGagFVr9rYdfxP/rIg=; b=WLwO1GJRkrjKifikYdcIQayUSOEpwTvXqVAasGiMAK0rn8jf0vhkL6/XPvLrFIyUq7 +vX81tqiR52P8Eq2pCxlCk0haEkkUQdrrTpaE+JpD6J+P6ri0koajTJf3FYZZJyg1NRu wEMVcNnAfW+h/eH3EowCBNlhR2mC5U/l4bm/sAKCmnrUMprJ65Wl8LSRgqC0iHw0EJ9w 2Bd4DFp/NehA/hG7odMuhj0IcDDnMRa564NGtNe8hqIiG4AOKwSQ+YKy4hQL6HrM5T3L 0z6h2XnmX7+YfqpHUokL2kixb/ft6ZGNOLX1c3s0Ut3Md+NjmlxGIAgY+Ky0dSVltKXp D1BA== X-Gm-Message-State: AFqh2kqJr7RS3dEpxPdfyGkYwwZV1x3elQ47F2NiTdIAjq2iSQ6xeGjq XTZUyJjo+2TDOQMVvCMMw0MOI/YcNB92298K X-Received: by 2002:a17:902:7610:b0:192:751d:b2e4 with SMTP id k16-20020a170902761000b00192751db2e4mr28680533pll.48.1672755088680; Tue, 03 Jan 2023 06:11:28 -0800 (PST) Received: from anup-ubuntu-vm.localdomain ([171.76.85.241]) by smtp.gmail.com with ESMTPSA id l3-20020a170902e2c300b00192bf7eaf28sm6146117plc.286.2023.01.03.06.11.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Jan 2023 06:11:28 -0800 (PST) From: Anup Patel To: Rob Herring , Krzysztof Kozlowski , Palmer Dabbelt , Paul Walmsley , Daniel Lezcano , Thomas Gleixner Cc: Andrew Jones , Atish Patra , Samuel Holland , Conor Dooley , Anup Patel , devicetree@vger.kernel.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, Anup Patel , Palmer Dabbelt Subject: [PATCH v6 3/3] clocksource: timer-riscv: Set CLOCK_EVT_FEAT_C3STOP based on DT Date: Tue, 3 Jan 2023 19:41:02 +0530 Message-Id: <20230103141102.772228-4-apatel@ventanamicro.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230103141102.772228-1-apatel@ventanamicro.com> References: <20230103141102.772228-1-apatel@ventanamicro.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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=unavailable 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 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 | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/clocksource/timer-riscv.c b/drivers/clocksource/timer-riscv.c index a0d66fabf073..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) @@ -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