From nobody Mon Sep 15 19:21:47 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4cQZf3539Lz67v0d; Mon, 15 Sep 2025 19:21:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R12" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4cQZf345BPz4LFK; Mon, 15 Sep 2025 19:21:47 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1757964107; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=XHEs5mNFC8dA8lfBSw9XW7yWKKK1FRGr2//cvKyjU64=; b=RGGnwIlvLba5c4j3wy1j8K033i03mpX57Zg64oCtaCDwfQiM34vSmKA6ciP5hiz9ZXFxFA pQTHCunA2ztbggQX8mUBRnvnieVdrS8QgBScllJPsYuQ5IQQC4F4Vtco6LO82T2Zn9Evo6 s5GeO13nnBgPa9yJCL/bUJhUgDnNKRMDkkrbYU1gUkF+FwBa2hFG7/BIR30j4Gwd6nxCmJ E1eJQ4ej63hHEEQOWu+BOSQVW5Py6ds5JdosLmpo6MU8RYZ2Kp/RZufSSQssHBc4LjOrwW A/d7erVv5/TWpf+QIHi9N4Zql2FVRQAsQhvevL1n+L3hOHthNtdQjMzmD0xgnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1757964107; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=XHEs5mNFC8dA8lfBSw9XW7yWKKK1FRGr2//cvKyjU64=; b=A5pDHKCTCXAWh+uJPIxww1k/Rzlr6mf1i2bvIIi9G54Cv930l/JBwK50vCEOVjjBWkchpj WbXHeXd8d4MVa3JVzeFytTeH78xaTmrOC2xq4hNJn5VTNLLyKtfYuw8663AUjLKxWowQTX 2K14H68jKjha25j3xlHFRpn9f8X12a/DGivlTmSxsv/ANDbdmsCoL81+uQhfOTyIDQw/3N E2nnAhtAbkk+76syauBIvkhqcKCDXQkUFdRr92XdHGPlaF1MBhfATxh1ky6NcWKvLepNqp bTreEK/keadGnVHnLFIO0fuPi4V0/kRH+8oOZI+mIKfx++SUX7IwDbNQ9+E/Lg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1757964107; a=rsa-sha256; cv=none; b=MnOaRLiE5f7eZA+jSjGDjv59/YN97HmaAoklUulv4YPN3hG7dD08Ofpm0shEGrg8KQUALo fsjhobHofpMEtWjJuMz7PC1b5THlho9dxc2L386rUvWfZFEEakVdoGJ0/DHUjiS3DtJp/f FxFFM6OSiJysbGQOjks0EnwSmZcYkns2fa5he29POUFa4h25h1kMzjSBVCNmhBmBnAhZTR t+d8hn9MnQOmBh4OuvRN5Jaf5GUG+feRTb0BnKRRuouc34/0B5BW6ju/QBsPugqjchCI56 PGKPF84VA1J/URRBHg3OzyXF2YVZiBrQ0yhF0LwhhpDQoQngEpceGtvr0lA/OA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4cQZf33b67z16y1; Mon, 15 Sep 2025 19:21:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 58FJLl1Y073278; Mon, 15 Sep 2025 19:21:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 58FJLlHh073275; Mon, 15 Sep 2025 19:21:47 GMT (envelope-from git) Date: Mon, 15 Sep 2025 19:21:47 GMT Message-Id: <202509151921.58FJLlHh073275@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mitchell Horne Subject: git: 4efc1b22aab1 - stable/14 - riscv: Fix SSTC extension support List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 4efc1b22aab1a15bff95012deb789696d71f97ec Auto-Submitted: auto-generated The branch stable/14 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=4efc1b22aab1a15bff95012deb789696d71f97ec commit 4efc1b22aab1a15bff95012deb789696d71f97ec Author: Ruslan Bukin AuthorDate: 2024-05-22 14:51:45 +0000 Commit: Mitchell Horne CommitDate: 2025-09-15 19:20:27 +0000 riscv: Fix SSTC extension support From the SSTC spec: "If the stimecmp (supervisor-mode timer compare) register is implemented, then STIP is read-only in mip and reflects the supervisor-level timer interrupt signal resulting from stimecmp. This timer interrupt signal is cleared by writing stimecmp with a value greater than the current time value." This fixes operation in Spike with sstc extension enabled. Example: spike --isa RV64IMAFDCH_zicntr_zihpm_sstc Reviewed by: mhorne Differential Revision: https://reviews.freebsd.org/D45226 (cherry picked from commit ddd0d4f4cd65341a07bb3bb833dee7982018fd60) --- sys/riscv/riscv/timer.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sys/riscv/riscv/timer.c b/sys/riscv/riscv/timer.c index e3d7fc87cea2..b4aa054cae9d 100644 --- a/sys/riscv/riscv/timer.c +++ b/sys/riscv/riscv/timer.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2015-2017 Ruslan Bukin + * Copyright (c) 2015-2024 Ruslan Bukin * All rights reserved. * * Portions of this software were developed by SRI International and the @@ -144,7 +144,10 @@ riscv_timer_intr(void *arg) sc = (struct riscv_timer_softc *)arg; - csr_clear(sip, SIP_STIP); + if (has_sstc) + csr_write(stimecmp, -1UL); + else + csr_clear(sip, SIP_STIP); if (sc->et.et_active) sc->et.et_event_cb(&sc->et, sc->et.et_arg);