From nobody Thu Jun 23 18:16:09 2022 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 BA146876AE6; Thu, 23 Jun 2022 18:16:09 +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 4LTT2x2wCcz3Pb1; Thu, 23 Jun 2022 18:16:09 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1656008169; 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=+GyWLfoeDqC7dVnpBuM0/Uxb8Egp7WdmB4R7LTIA8yc=; b=KR6WVGGaBnqQyd3bnSJF6/QR6ehtPd4YpVrOIkUt7oasIOch6rdJKJa1BmK/32VPZLkAOE jxdl2AhGvAgCGTX2pYX6vjLRg18X3M+QcsHjhYLyRg92Nbj3rAIhsDRDyTrVOsgiNqIsHD FM78XBRUY593X4h9jQVknD3CsmJFphwdLK64muAoCSb+HQQ3zkWbvijp+a8lEx42/pNHcZ rL7KD+9xiIn8b2nr+/vOi3qkSPsdMTgZqgOy6uMEbwaDH8wWZWWDSCRg9q+LyMlbDIhCUl fKaefqbtavyIkMooTopfkwDx6mTeXayOlWVBu56S0b2s8YbbUI68R7oy5N6c1A== 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 2C9C020277; Thu, 23 Jun 2022 18:16:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 25NIG9OS014958; Thu, 23 Jun 2022 18:16:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 25NIG9xg014957; Thu, 23 Jun 2022 18:16:09 GMT (envelope-from git) Date: Thu, 23 Jun 2022 18:16:09 GMT Message-Id: <202206231816.25NIG9xg014957@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: b82f4170fca8 - main - riscv timer: remove intermediate helper 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: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: 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/main X-Git-Reftype: branch X-Git-Commit: b82f4170fca86e9b41b613715852d4f225b26e3a Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1656008169; 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=+GyWLfoeDqC7dVnpBuM0/Uxb8Egp7WdmB4R7LTIA8yc=; b=K3aH1xpNv81NJRdmapmaagCHFI031qKg7MlkERWWNcGc/AqUW8woiJbO5GgOyUmRVRaSpF sNDLkvWZ+kxuebVCOll7F4RsqV31xfsDyHYyxfey4gvQhRmRaUSpPojRSwdAbst3214nfy mCaRYVdDmIHJzU4VNfkN8Anrg0Uca0fbV0LyZor9bA/M1UOHCHnNyMuj8PXnT7LkJX2if0 izEKeuFmnqdm0K0jqsW3zZ1qaew0O8CWviFC0Url7b1+/VQaQzVruWRmCTY8XQ7rVTWldx 3sgk9jbGSHkc6f1ZDCNZlRTQ1eqBSBlPWFubi1n5qrw/fb0JO2TxczL3afMLHg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1656008169; a=rsa-sha256; cv=none; b=KD7/tg1gPj8sgVoOatFbjuL90stYTxozQ5jTjgiUQLHyo9IOzTNMgz+mx83E5qd5xT+EgS 3eiOqYNuRs7bLU98AR1M+GXinWg2+gaOpArPSVGIUhQb20xHREoCgcdjDGAuqNJpneu8Xq ZuDo9fHZMOknpc6H6M66l1H11A+/2WN4Q26XKtTHFG73GLR+c0HRQOTH3jNLfr0iC4BTWs AHkyQ5SJEc4RFNyQiGQOLmr57NIlG/6zhRv3V/FcW27XDPCMqzwWjWLFrqeH9oPjXiAcHB j30n/l1XHLLYDnX3yXCE2MZ/kDyocs2VTDGQkfiVv/HjCQTF1ZR3A6i7Er9XuQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=b82f4170fca86e9b41b613715852d4f225b26e3a commit b82f4170fca86e9b41b613715852d4f225b26e3a Author: Mitchell Horne AuthorDate: 2022-06-21 16:23:21 +0000 Commit: Mitchell Horne CommitDate: 2022-06-23 18:15:11 +0000 riscv timer: remove intermediate helper get_counts() doesn't do anything at the moment but return the result of get_cycles(), so remove it. For clarity, rename get_cycles() to get_timecount(); RISC-V defines separate time and cyclecount CSRs, so let's avoid confusing the two. They may be backed by the same underlying clock, but this is an implementation detail. MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D35461 --- sys/riscv/riscv/timer.c | 25 ++++++------------------- 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/sys/riscv/riscv/timer.c b/sys/riscv/riscv/timer.c index 5cdfe9cceb41..358b89e2be18 100644 --- a/sys/riscv/riscv/timer.c +++ b/sys/riscv/riscv/timer.c @@ -78,30 +78,17 @@ static struct timecounter riscv_timer_timecount = { }; static inline uint64_t -get_cycles(void) +get_timecount(void) { return (rdtime()); } -static long -get_counts(struct riscv_timer_softc *sc) -{ - uint64_t counts; - - counts = get_cycles(); - - return (counts); -} - static u_int -riscv_timer_tc_get_timecount(struct timecounter *tc) +riscv_timer_tc_get_timecount(struct timecounter *tc __unused) { - struct riscv_timer_softc *sc; - - sc = tc->tc_priv; - return (get_counts(sc)); + return (get_timecount()); } static uint32_t @@ -120,7 +107,7 @@ riscv_timer_et_start(struct eventtimer *et, sbintime_t first, sbintime_t period) if (first != 0) { counts = ((uint32_t)et->et_frequency * first) >> 32; - sbi_set_timer(get_cycles() + counts); + sbi_set_timer(get_timecount() + counts); csr_set(sie, SIE_STIE); return (0); @@ -286,10 +273,10 @@ DELAY(int usec) else counts = usec * counts_per_usec; - first = get_counts(riscv_timer_sc); + first = get_timecount(); while (counts > 0) { - last = get_counts(riscv_timer_sc); + last = get_timecount(); counts -= (int64_t)(last - first); first = last; }