Received: by 2002:ac0:e34a:0:0:0:0:0 with SMTP id g10csp232474imn; Wed, 27 Jul 2022 04:55:11 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vEwA1z8VRFloTaL2NDT8dCTjvmVhdQU0RKIJzWlh+2h4VNSAOdEZaWQr0a73q6rbbI5pK5 X-Received: by 2002:a05:6402:3302:b0:43c:33eb:79fb with SMTP id e2-20020a056402330200b0043c33eb79fbmr10662571eda.281.1658922911653; Wed, 27 Jul 2022 04:55:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658922911; cv=none; d=google.com; s=arc-20160816; b=obEAiql6h3akp3T+i57dFtocHKL2ka/Gq/DYhVFpmbR78fVwhDb0eCA0bMviqkhdXe 6C3m7Efo4MV71+jtGL6jl0a3OpC1b247Tw3IBRp2x7lMtK9uFQZInGI9NZEhlP8FcNXw Ro3EQphbycdmBQh/hUHO3+kBv8VTEyCuK5KSNaNJd7TSSk5dW8R4jJ47GpBhzP+4ue5h LAt8cXkH+T5fD6cd5W8LiBpR4HhiswvpFQeo4vY7PGdjxGGA76osMloIXke3K1jgpsYC Zw3R6e4ycHpoUaO2+fykrsOxGfkw9pZiTtyaZoI7vxNoyhG6Tcb+LHu8eGJdhMlWI1DZ b02g== 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=ZDeYW4AY28vTxurFqUXv3ebNyVNdEODpLRCvig5J+Z8=; b=HtKsttMj3E+D7TTMDH3gHJydGXYbG8uDdM/0Kcq2wt1dlT6UsozXNl/bHNiGdU/K5f 3B8MSblvr+vdBiqk3tMGgGLF8WdB+xDxt+dwCXXri5VsitY4852HJoGobDeuT6eoda19 rBff9Sa0IkDRv9tQoAlfR0lktTEgqSLKTUzp1HdFj733sJuCdjJ2sQly+T6XXF6ZyLMj nUqkVGsglfOhxVh1rQhSnyJT1j/ebvmziBM4tdH/uHOIT4yvg3npZhh3EQdFpLL7ASZE pbZpuRsnxcVO2aIrUQbuzoQf8WLVH+GxYTfNzZTtA2z+wXWFz7O7gc4Zb8R9lShAJqnV OesA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b=aqjEe3mv; 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 qb29-20020a1709077e9d00b0072f25c0af43si18729900ejc.576.2022.07.27.04.54.46; Wed, 27 Jul 2022 04:55:11 -0700 (PDT) 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=aqjEe3mv; 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 S232319AbiG0Lo1 (ORCPT + 99 others); Wed, 27 Jul 2022 07:44:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33150 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232433AbiG0LoF (ORCPT ); Wed, 27 Jul 2022 07:44:05 -0400 Received: from mail-pg1-x534.google.com (mail-pg1-x534.google.com [IPv6:2607:f8b0:4864:20::534]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D3EA14A812 for ; Wed, 27 Jul 2022 04:44:04 -0700 (PDT) Received: by mail-pg1-x534.google.com with SMTP id q22so10545649pgt.9 for ; Wed, 27 Jul 2022 04:44:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ZDeYW4AY28vTxurFqUXv3ebNyVNdEODpLRCvig5J+Z8=; b=aqjEe3mvrZ/sXf2TJhUGnviXYa1l1LYvbO7SQNCsbRoBm0VTSB5S/Vn+NZ3BombPyd c/hYAThtpLetobdizee3fkOS/RlfZitV1e4eh2Sk4CmKvhXeGs41oltsGCrZGXrdUf48 KqR1b30FD6/M8sVRF0rEJQ51pt9SPXLoBxvDhX4eVN/KXOe2sdLQPZNBb9CRlQ/bPmuo Wp4KqHYcaAC+mWT20tlu1Bk2gicSXZDrADeE+ruejivezkjr9GXD9SOCjeCwsDvBrAAh sQUbAXEjW9hO/WPRC9DvATAtc4z6/vfE48At2mxmtoyzPv5qgLh6b7VpH8SrqxlEuomp YRPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ZDeYW4AY28vTxurFqUXv3ebNyVNdEODpLRCvig5J+Z8=; b=r2K+PqylP2Kt7KJTBZFlUltfdYVpoDpf77UtvSew9LP2zL2Km48XR++ylSW6KMdPOZ S46b5OA1FGv9IaJ6WDmWbtP5D8TYs7Tp324UmYfzmtDhxokDP3PCnLbuEFZE/w4gKre8 uW2Z/ynFXjzk1iSGxIl1v6TymUue2OasbOrz9OsIpcVr+sdQ0pPPAmYbNoyNoOP0DIBc WHScp5TyVvkkMRnUZBzFt8N2SNBTqnCe8D5CTxvsBJxstC62CtjYyl88Ph22E3IIdTh9 Y8PQPQZeMU3jHuwlet3zDxPs0WWCy/oTOd5xf5m/By61Z4xAb8S/Zd73znKSfJ2rU305 YEmg== X-Gm-Message-State: AJIora+VtbjgKirgarpMT3w8bGk71VPE71Gf19si692gvVc+GTXz7bCC VtW2YBZd9dp4H2USxATkHXzcAg== X-Received: by 2002:a63:fd4f:0:b0:41b:539b:ba8e with SMTP id m15-20020a63fd4f000000b0041b539bba8emr812287pgj.17.1658922244094; Wed, 27 Jul 2022 04:44:04 -0700 (PDT) Received: from anup-ubuntu64-vm.. ([171.76.87.63]) by smtp.gmail.com with ESMTPSA id o8-20020a170902d4c800b0016be9fa6807sm13486685plg.284.2022.07.27.04.43.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Jul 2022 04:44:03 -0700 (PDT) From: Anup Patel To: Rob Herring , Krzysztof Kozlowski , Palmer Dabbelt , Paul Walmsley , Daniel Lezcano , Thomas Gleixner Cc: Andrew Jones , Atish Patra , Samuel Holland , Anup Patel , devicetree@vger.kernel.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, Anup Patel Subject: [PATCH v2 2/2] clocksource: timer-riscv: Set CLOCK_EVT_FEAT_C3STOP based on DT property Date: Wed, 27 Jul 2022 17:13:02 +0530 Message-Id: <20220727114302.302201-3-apatel@ventanamicro.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220727114302.302201-1-apatel@ventanamicro.com> References: <20220727114302.302201-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=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 We should set CLOCK_EVT_FEAT_C3STOP for a clock_event_device only when riscv,timer-can-wake-cpu DT property is not present for the corresponding CPU. 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 --- drivers/clocksource/timer-riscv.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/clocksource/timer-riscv.c b/drivers/clocksource/timer-riscv.c index 593d5a957b69..92a0b9832d8c 100644 --- a/drivers/clocksource/timer-riscv.c +++ b/drivers/clocksource/timer-riscv.c @@ -34,7 +34,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, }; @@ -65,9 +65,13 @@ static struct clocksource riscv_clocksource = { static int riscv_timer_starting_cpu(unsigned int cpu) { struct clock_event_device *ce = per_cpu_ptr(&riscv_clock_event, cpu); + struct device_node *np = of_get_cpu_node(cpu, NULL); ce->cpumask = cpumask_of(cpu); ce->irq = riscv_clock_event_irq; + if (!of_property_read_bool(np, "riscv,timer-can-wake-cpu")) + ce->features |= CLOCK_EVT_FEAT_C3STOP; + of_node_put(np); clockevents_config_and_register(ce, riscv_timebase, 100, 0x7fffffff); enable_percpu_irq(riscv_clock_event_irq, -- 2.34.1