Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp479105rwb; Thu, 1 Dec 2022 04:49:01 -0800 (PST) X-Google-Smtp-Source: AA0mqf55KyoCddcXxX0w51N0YyOc7u7bpxJh0C7NB8YFGSjG4zQKzOBgQjFJq6p1frrClbPUxlLY X-Received: by 2002:a17:90a:d918:b0:219:3e68:1d03 with SMTP id c24-20020a17090ad91800b002193e681d03mr19531777pjv.77.1669898941360; Thu, 01 Dec 2022 04:49:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669898941; cv=none; d=google.com; s=arc-20160816; b=c9QcKSimNqedCB96LVqTHPJcjffWkzjtvM7yIxNS+WCxBLpJfAUAQz9Wg1vrAGuohJ usyR72IhxnywhfT8dSLZbbO0ydOK/9pqKmpf5z5oqknBH+CDDZKqSxL5/h/1IlZ//IaF 6lwJu+sn+qslbaaHtzyrBJqTVoq1sW1SVv0ogcY9PugGBWuvf9+KDCm2yEDu2HyWuvli OEIGvleI1fSG+Q2tujUWQ4/NmwIu3zt++Lbc3GogRFB+053ZI8LdLbnP8z/7gSLjIhA0 KnUGam2Wd2s8rIzHc/neCJad/6NlEZ9g9PFWR92qTSiRUFPGsGUOxwgoEFIfSRdnb4DT eVZg== 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=6S7naxVeL+Tq1XdOeQt8X5QpTYGWrVZhiHOlENIaVW4=; b=RYK9JkhQEGs2SrGvkEnFCvWpFH8EY73E/ehrbjucy0x/ShPBJzT1G0m4rnHvySnDKD B9o9+IpvtBHSh3K5Qs7G0puAme2xmnA4FPWW4q1Hm0WVTrvIf2h8y+oxZ3OtHiShv2CF p7CH8dLa2MZNx+eq27hJj4+42I5XF0c8Kjgd18zwFWuGfK5CsHrRxHJ+Co2Hhroz1KCE vHq6lcaLQu1xRWxI8PsFBeOLMlgmBN/kNETN0JXa25G2B/gFSrtySXRxZMVzUjSbWZs8 7XKvlrGdbNXc8Tq0MeWUmihY/5xGalEEMeLKpNyqm8PZSa7LUCMKM+RUZawHGIfJQLXK WfQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b=ODFqGsjS; 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 n27-20020aa7985b000000b0056dc342ea54si4280968pfq.206.2022.12.01.04.48.50; Thu, 01 Dec 2022 04:49:01 -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=ODFqGsjS; 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 S230266AbiLAMke (ORCPT + 82 others); Thu, 1 Dec 2022 07:40:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52222 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231477AbiLAMk3 (ORCPT ); Thu, 1 Dec 2022 07:40:29 -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 3B37EBA0A6 for ; Thu, 1 Dec 2022 04:40:21 -0800 (PST) Received: by mail-pj1-x102c.google.com with SMTP id u15-20020a17090a3fcf00b002191825cf02so1916548pjm.2 for ; Thu, 01 Dec 2022 04:40:21 -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=6S7naxVeL+Tq1XdOeQt8X5QpTYGWrVZhiHOlENIaVW4=; b=ODFqGsjSBR77IhnwGSMqT5Cedqv+o+83HTdoL9r+54VqgGotTXmXpohITgE49F7wSd Tkur0/NYoqgk92i4gk54CRC/pqYBBmM2Zbo6r10FLJYhD2qqf8jup2GHELUwP4gwflmR zHYM7ShhCJW76jq1Qu2vQBginDdz04Pbwt71TzSOIEVOWuPV44OgVizwpklWWnB7e+Y5 D4+z2VkQ+x3EEWAciK1knsKdG5FhwxYEmrPWeSjvn7rHX4xtesNCG3kcL9kYwyxbC5ya FHhXlzp0mt54IMjKmv9qfrLyPhAifG9KdRWdez3fjVDG0RQP0zP5aj9Gdf9VUb814ry7 1cfA== 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=6S7naxVeL+Tq1XdOeQt8X5QpTYGWrVZhiHOlENIaVW4=; b=tOyoPHnHd2giSZmDqP4RsQMJ5TdEzaR9ko6b/BBHu/2hQvCX70k+842xmLNldYX9TC GHRAo/ICBrx9izoCtbN+2rj5nO5kZujf8CrnAy19EfonXtP9oQx7lvUdKWn3QPScUiUf h29QDF4S8WrdWWp6idu9toirRGhfckfZyXKgZQEfI3tnmQM2B2LUtqUSflFi5rL2E+HE MW1iz1vxwI/XxA3TqlUGys32pUeDLXqjqJ4JfUu1LY+3sESdO5bWYWfRONXElanmYDej ePtHd2r8BG24QJ5M235yb35BdGcTY+tfQosoxp+K+1o2HPEjOUCPotZ2IiWi/1TZJLPt oSVw== X-Gm-Message-State: ANoB5pnxE58TclhTrtc1QSlx55HiRjFre1HO1HHYdkplZrod3ygrM4VU Jq1Y9JKA4K4Bl3XG70/pjVyPnA== X-Received: by 2002:a17:902:ec01:b0:186:878e:3b0d with SMTP id l1-20020a170902ec0100b00186878e3b0dmr47042474pld.149.1669898420501; Thu, 01 Dec 2022 04:40:20 -0800 (PST) Received: from anup-ubuntu-vm.localdomain ([171.76.81.69]) by smtp.gmail.com with ESMTPSA id b65-20020a62cf44000000b0056f0753390csm3246981pfg.96.2022.12.01.04.40.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Dec 2022 04:40:20 -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 v5 3/3] clocksource: timer-riscv: Set CLOCK_EVT_FEAT_C3STOP based on DT Date: Thu, 1 Dec 2022 18:09:54 +0530 Message-Id: <20221201123954.1111603-4-apatel@ventanamicro.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221201123954.1111603-1-apatel@ventanamicro.com> References: <20221201123954.1111603-1-apatel@ventanamicro.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=1.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Level: * 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 | 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, .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