From nobody Wed May 22 16:06:52 2024
X-Original-To: dev-commits-src-main@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 4Vkx591NlJz5LxpT;
Wed, 22 May 2024 16:06:53 +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 "R3" (verified OK))
by mx1.freebsd.org (Postfix) with ESMTPS id 4Vkx590Pg1z4TJF;
Wed, 22 May 2024 16:06:53 +0000 (UTC)
(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
t=1716394013;
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=pE8yhvksUc1e0C6VLjxZXpaUitkD86oKte+VdwphOW8=;
b=A/X7T2H53gfsZCpnDroiIRHpXVzC4474I+TWcKxtYAkYSjNBrKqBGWrk5eTkgxXU+B0Ieq
jlew2ZNKo1K5XhJi811GqG8e1Le4Xlui85kmhr+mV4KK4dYd0CeBKqoAKQpCH7KJXdpvMB
k1MJ7sxm3f2cP17sjFfCWqc/t+inMkw7G2zlmg1mj4YVQp8J6bxjHHtzTucBc7TOfql/H4
dXDy9RvZsbHc7hISY8sTb359vguNlBv+XlEbn+Yf8u/1E8JeMK0hs+Yyt+SWcJLRdJz5XF
3/M3nTDG4w0Jwir2eJ+cbO5kqB2YbjWJ+qhFpgnIqRyyzU67UH4I/keN9sPOAw==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1716394013; a=rsa-sha256; cv=none;
b=uWhDjoi6CrF1qmeHzPHe8sylSDyQJ4rWwwdh6QpilgUSZP/BOMrxqMBLhfH3gZh2P7FkZa
Ym2Wr/VObZKwomWPzJJ5Kw/co0FcMotNnjpkvYdOEwU0pnzeeo1TPaqmTs0ztT8aVlrsa7
YC1e8ukWl6tm6LT+pjgMnBjSe0hkF3Vm1Lw6NiZ9rKvFnAkKHafJMqkjzbm2aP1txqfupf
nUPWYLxQ1HoTk5QLNootjOR3xPvx2HGwvDNvPEbP1NJIxJ12KJUFehNpOrDlub8X9d/qwc
ztKSn/sm4SfMl3V67ADzPlzgL/2jv7Lx9AGqJmUPiyRvl4sgTwdnBoIzKJyVoA==
ARC-Authentication-Results: i=1;
mx1.freebsd.org;
none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
s=dkim; t=1716394013;
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=pE8yhvksUc1e0C6VLjxZXpaUitkD86oKte+VdwphOW8=;
b=ldQDIv0pUPwaBTQzNu8liHDOZk02hiAXCM9ieQyWb0LJ0HRDv2RimbrIu0v2j2aKicCiYy
qz92a7+K1srHvhcSL0K5li3LoyG6LEs9TLCtyRw4hKhFcOlHspVYyKCjFp0JlP3KCbZY1G
geeFztpFxR6QvOXFoxj6xY2A+S/O8T2GngzogQzoUHrXW6SqB/QHLUrxS/CXA8zg6utjYD
zuw726OmCRe5GhMQaZqqNriTlluVMg+PNZIpnrKQv4MxQJFoqThYzEOVP1mj5qHRKIa1Hg
hmaxdumnTtIzXGlTjDdyPhSzt2acqx7T6KP+/YyhPqq9nhU36OsdkfEZF5OSEg==
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 4Vkx5900p5z1BR3;
Wed, 22 May 2024 16:06:53 +0000 (UTC)
(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 44MG6qAI072516;
Wed, 22 May 2024 16:06:52 GMT
(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 44MG6qXq072513;
Wed, 22 May 2024 16:06:52 GMT
(envelope-from git)
Date: Wed, 22 May 2024 16:06:52 GMT
Message-Id: <202405221606.44MG6qXq072513@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
dev-commits-src-main@FreeBSD.org
From: Ruslan Bukin
Subject: git: ddd0d4f4cd65 - main - riscv: Fix SSTC extension support
List-Id: Commit messages for the main branch of the src repository
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help:
List-Post:
List-Subscribe:
List-Unsubscribe:
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: br
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: ddd0d4f4cd65341a07bb3bb833dee7982018fd60
Auto-Submitted: auto-generated
The branch main has been updated by br:
URL: https://cgit.FreeBSD.org/src/commit/?id=ddd0d4f4cd65341a07bb3bb833dee7982018fd60
commit ddd0d4f4cd65341a07bb3bb833dee7982018fd60
Author: Ruslan Bukin
AuthorDate: 2024-05-22 14:51:45 +0000
Commit: Ruslan Bukin
CommitDate: 2024-05-22 15:44:03 +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
---
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 06806872d9fd..456dd463ab2a 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
@@ -143,7 +143,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);