From patchwork Mon Feb 13 18:26:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tip-bot2 for Thomas Gleixner X-Patchwork-Id: 56427 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2502105wrn; Mon, 13 Feb 2023 10:28:53 -0800 (PST) X-Google-Smtp-Source: AK7set8SfMlvgf2cz7HQx1DQkNxdQVJyt/ZTQQvNvvnb9EqFHqug14rVICxs3DX+89Pl1MyZF6M8 X-Received: by 2002:a17:907:217c:b0:87b:7c1d:e02b with SMTP id rl28-20020a170907217c00b0087b7c1de02bmr23773571ejb.36.1676312932948; Mon, 13 Feb 2023 10:28:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676312932; cv=none; d=google.com; s=arc-20160816; b=rk2/h9zv/sw1LMiiYuPxEIAPzCEgG3f4+78vvnDkWtFRhrZ78ZV5bf/zvHS2Qv9epi u5ONyS1tv8j9UKuaj/VBE5/2FHcaVYn1KtfJz819dCjDykj6yt436Kx5PN8mv8L1OWER UNTqThDNNfzu9sw52S25nWx9lFx2h0YZqnlQ0qFXKYuX6lTTL7BDmvEo43czk+tWKGT6 h5DMZAuW5y68ZxZj7Q8u62ztRiEhZCtNEevcvwDDD0Oiu26jp9YRK+AnVaIow0JU4dWa wRtV7gOftJVqA04jdkAJ41fA+DxSbvg1voxQIewG/7iLwsdJY4XrLk4pJuwAgYD0IfXX i4hA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=RxZ6aEw3H1EuT2X6ppE3XEZQ1Z1VXyr9nlIu9qn19Qc=; b=AR9UVW4jGEfmOwMG/0W3+vvVwHGmn9EWsAu64LivysJ/hs8FAxEgIvo/3vfoIOuenE 7sT2nQIV352OAVTw6tkTcJ3PcT/Lx3xdyHnfiCW+t9VCSRm11ml1qbniwvIW6HpXvYAg F5U7K8G/58CJxRhOhTF/kwhESOXE0deQG4rlfvdFhIeycglLEwGamAVVdeOODmjs89uq RqLx/OXPPqIRqntvh25o9rgn094zY5O7zsykVMi900cyXg96ZinqSJXXKlTErVyw0RaF 3Zrnbb6jNbvI2Ha+/TWtZXqrNZlPUCm8NGC4cAWY0o7QdS7xhEkw8kSgWR9Hxjdv6Zz/ geIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=iLaTSgQY; dkim=neutral (no key) header.i=@linutronix.de; 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=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 11-20020a17090602cb00b008a99f26d242si17484235ejk.416.2023.02.13.10.28.30; Mon, 13 Feb 2023 10:28: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=@linutronix.de header.s=2020 header.b=iLaTSgQY; dkim=neutral (no key) header.i=@linutronix.de; 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=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231186AbjBMS0i (ORCPT + 99 others); Mon, 13 Feb 2023 13:26:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46614 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229554AbjBMS00 (ORCPT ); Mon, 13 Feb 2023 13:26:26 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 52198729D; Mon, 13 Feb 2023 10:26:24 -0800 (PST) Date: Mon, 13 Feb 2023 18:26:22 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1676312782; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=RxZ6aEw3H1EuT2X6ppE3XEZQ1Z1VXyr9nlIu9qn19Qc=; b=iLaTSgQYQET1J7W4wFNlcu0sfv2//HPknQ7hXje8H8+Oc3vRfutPtQmCaKh6nKseuFu9+L St7GJjbiJJ/LcUM0M2m9ldPqGaV/odJ/uFXqgeVe+MzAijEVLY/VzTJguC8IktU78DfBzQ +AXkiufO417wPkM8qWuCeI6CbcNjhV6bRcpKAjL8iMh2Izt5c94w8xOGIOVTdKoAbfM6ad 80o2Z9qKOfdvzZPMjvevZIb8PKOfGjD6wfvRtxaiYbyQv2OTjoNOyHCeY58Z4BImc6aGvZ LsLhYIkJVlacGqL03HE/LX/4gBW49VE/2TFKOVNXd7mvJU2CrJznWpdbUbdrFg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1676312782; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=RxZ6aEw3H1EuT2X6ppE3XEZQ1Z1VXyr9nlIu9qn19Qc=; b=SX24IGfI5Ake/fd0DDZE0y/CdLn2+nlRBOspAThuExdM49VdMl0IURXm0myiVO4d3U3zeu l28bPq97Q7WbHQBw== From: "tip-bot2 for Matt Evans" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: timers/core] clocksource/drivers/riscv: Patch riscv_clock_next_event() jump before first use Cc: Matt Evans , Palmer Dabbelt , Anup Patel , Daniel Lezcano , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: References: MIME-Version: 1.0 Message-ID: <167631278248.4906.12382142113673648566.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757741509902941950?= X-GMAIL-MSGID: =?utf-8?q?1757741509902941950?= The following commit has been merged into the timers/core branch of tip: Commit-ID: 225b9596cb0227c1c1b1e4a836dad43595c3e61a Gitweb: https://git.kernel.org/tip/225b9596cb0227c1c1b1e4a836dad43595c3e61a Author: Matt Evans AuthorDate: Wed, 01 Feb 2023 19:49:42 Committer: Daniel Lezcano CommitterDate: Mon, 13 Feb 2023 13:10:17 +01:00 clocksource/drivers/riscv: Patch riscv_clock_next_event() jump before first use A static key is used to select between SBI and Sstc timer usage in riscv_clock_next_event(), but currently the direction is resolved after cpuhp_setup_state() is called (which sets the next event). The first event will therefore fall through the sbi_set_timer() path; this breaks Sstc-only systems. So, apply the jump patching before first use. Fixes: 9f7a8ff6391f ("RISC-V: Prefer sstc extension if available") Signed-off-by: Matt Evans Reviewed-by: Palmer Dabbelt Acked-by: Palmer Dabbelt Reviewed-by: Anup Patel Link: https://lore.kernel.org/r/CDDAB2D0-264E-42F3-8E31-BA210BEB8EC1@rivosinc.com Signed-off-by: Daniel Lezcano --- drivers/clocksource/timer-riscv.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/clocksource/timer-riscv.c b/drivers/clocksource/timer-riscv.c index d8cb629..5f0f10c 100644 --- a/drivers/clocksource/timer-riscv.c +++ b/drivers/clocksource/timer-riscv.c @@ -192,6 +192,11 @@ static int __init riscv_timer_init_dt(struct device_node *n) return error; } + if (riscv_isa_extension_available(NULL, SSTC)) { + pr_info("Timer interrupt in S-mode is available via sstc extension\n"); + static_branch_enable(&riscv_sstc_available); + } + error = cpuhp_setup_state(CPUHP_AP_RISCV_TIMER_STARTING, "clockevents/riscv/timer:starting", riscv_timer_starting_cpu, riscv_timer_dying_cpu); @@ -199,11 +204,6 @@ static int __init riscv_timer_init_dt(struct device_node *n) pr_err("cpu hp setup state failed for RISCV timer [%d]\n", error); - if (riscv_isa_extension_available(NULL, SSTC)) { - pr_info("Timer interrupt in S-mode is available via sstc extension\n"); - static_branch_enable(&riscv_sstc_available); - } - return error; }