From nobody Thu Apr 2 18:47:52 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DE60531AAAF; Wed, 11 Mar 2026 13:27:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773235634; cv=none; b=Jym+0/dMi/ve3xv56QhOfCXmWMrHJPJABTNzmksr/JQ7e1Sz4jseKLlmcUmt49KbC23b+CIFXeiX+6pAc1JNz5kTLghdWgoFOA8wSDz36muFnxPmkDhmdV5KUJLHOnmjgJeFc8nc/zpKxIZpkmdG7MileVvTd3UsvsuKhhNeQng= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773235634; c=relaxed/simple; bh=41IZMqDKuz/6MXeNloPVlflrmSHQD4lgmzdF8Vzr3C4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=fDyDrqwsST7kxiJJ7PGbW2/YkccsHqvQFQkl5tIkdRu/hYQkA3TiDtg5VTbqNf507lxw/znym9ZBLBJ/kP3DyABZ7jwoQBrgHisHrxwZyM4QAR4zJaDJ1ps2ZwMscyWELomACtalq1Gckvq3M6mtqbngDSs+2fnW/xFlWcHZ5yc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Wg/z9oGZ; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Wg/z9oGZ" Received: by smtp.kernel.org (Postfix) with ESMTPS id AB58FC2BCB0; Wed, 11 Mar 2026 13:27:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1773235634; bh=41IZMqDKuz/6MXeNloPVlflrmSHQD4lgmzdF8Vzr3C4=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=Wg/z9oGZMQ8Upk/M9sxd5UvjPLn3ccHGiMNUqptULOJmMxWo/9iPpOxqM/oNjprSR XLmF4iO9tjRGo1ITdUgB3Mk8bdYTH6ya9EUi7i3yzyS66JwM4UVFKzR/eK95uIsFXC EWDLYNwQEPjawSucVdg7VP9/PNXVATwDn30CH2zaPs4tXzKonOUVXcufMY4f4pydtV HRYtrPvfXRGx7/09B1kWB5vVian6MwsHH4G9DNLMA7/iSTzJDHWnj6rGmF3mDxeSqs HeqRljlRq6yH1tDKnWx8hoiiCV5ulpCTWFxSRKSwMqai6ItkfVzilB5YCIVNVEP4Eu AswkVwvkivFhw== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9C9561125808; Wed, 11 Mar 2026 13:27:14 +0000 (UTC) From: Aleksa Paunovic via B4 Relay Date: Wed, 11 Mar 2026 14:26:56 +0100 Subject: [PATCH v7 2/3] riscv: clocksource: Add readq options to clocksource mmio Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260311-riscv-time-mmio-v7-2-016845a0f808@htecgroup.com> References: <20260311-riscv-time-mmio-v7-0-016845a0f808@htecgroup.com> In-Reply-To: <20260311-riscv-time-mmio-v7-0-016845a0f808@htecgroup.com> To: Daniel Lezcano , Thomas Gleixner , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexandre Ghiti , Paul Walmsley , John Stultz , Stephen Boyd , Vivian Wang Cc: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-riscv@lists.infradead.org, Djordje Todorovic , Aleksa Paunovic , Chao-ying Fu X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1773235633; l=1888; i=aleksa.paunovic@htecgroup.com; s=20250806; h=from:subject:message-id; bh=Jv3vpBN1+Uh24vJH4CQZDSOQFXoXTNQJWJ4G2f0Tyms=; b=Wm4pnQNuSaGPFUBpuq6TtRUM/iSnjVcf5KngdyLUNX4MMZ1f/TyMH1XPBLeEXuSw7VHoGZkdj 61dIQnhqjloANjTX9T3btPV0/UEGZ1kT1f/te1W2lVdqHqZ3+XBWhnj X-Developer-Key: i=aleksa.paunovic@htecgroup.com; a=ed25519; pk=Dn4KMnDdgyhlXJNspQQrlHJ04i7/irG29p2H27Avd+8= X-Endpoint-Received: by B4 Relay for aleksa.paunovic@htecgroup.com/20250806 with auth_id=476 X-Original-From: Aleksa Paunovic Reply-To: aleksa.paunovic@htecgroup.com From: Aleksa Paunovic Add read functions for 64-bit register size to the generic mmio clocksource, covering both up and down counters. Signed-off-by: Aleksa Paunovic --- drivers/clocksource/mmio.c | 14 ++++++++++++++ include/linux/clocksource.h | 4 ++++ 2 files changed, 18 insertions(+) diff --git a/drivers/clocksource/mmio.c b/drivers/clocksource/mmio.c index 9de75153183124cc8997c6ab61d0c01d9b2637bc..6329d8ce2c0911b5c6de34346b5= ca8de40b93099 100644 --- a/drivers/clocksource/mmio.c +++ b/drivers/clocksource/mmio.c @@ -17,6 +17,20 @@ static inline struct clocksource_mmio *to_mmio_clksrc(st= ruct clocksource *c) return container_of(c, struct clocksource_mmio, clksrc); } =20 +#if defined(readq_relaxed) + +u64 clocksource_mmio_readq_up(struct clocksource *c) +{ + return (u64)readq_relaxed(to_mmio_clksrc(c)->reg); +} + +u64 clocksource_mmio_readq_down(struct clocksource *c) +{ + return ~(u64)readq_relaxed(to_mmio_clksrc(c)->reg) & c->mask; +} + +#endif + u64 clocksource_mmio_readl_up(struct clocksource *c) { return (u64)readl_relaxed(to_mmio_clksrc(c)->reg); diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h index 65b7c41471c390463770c2da13694e58e83b84ea..df8ea45ec60a28e0276020cb95a= b5328bec89879 100644 --- a/include/linux/clocksource.h +++ b/include/linux/clocksource.h @@ -276,6 +276,10 @@ static inline void clocksource_arch_init(struct clocks= ource *cs) { } =20 extern int timekeeping_notify(struct clocksource *clock); =20 +#if defined(readq_relaxed) +extern u64 clocksource_mmio_readq_up(struct clocksource *c); +extern u64 clocksource_mmio_readq_down(struct clocksource *c); +#endif extern u64 clocksource_mmio_readl_up(struct clocksource *); extern u64 clocksource_mmio_readl_down(struct clocksource *); extern u64 clocksource_mmio_readw_up(struct clocksource *); --=20 2.43.0