From: "Danilo Krummrich" <dakr@kernel.org>
To: "Dave Airlie via B4 Relay" <devnull+airlied.redhat.com@kernel.org>
Cc: <airlied@redhat.com>, "Andreas Hindborg" <a.hindborg@kernel.org>,
"Boqun Feng" <boqun@kernel.org>,
"FUJITA Tomonori" <fujita.tomonori@gmail.com>,
"Lyude Paul" <lyude@redhat.com>, "Gary Guo" <gary@garyguo.net>,
"Alexandre Courbot" <acourbot@nvidia.com>,
<rust-for-linux@vger.kernel.org>, <nova-gpu@lists.linux.dev>
Subject: Re: [PATCH 2/2] gpu: nova-core: add support for GPU timer block.
Date: Mon, 26 Oct 2026 13:33:48 +0100 [thread overview]
Message-ID: <DMERUEZT5R3O.2K65JB1FXYVR4@kernel.org> (raw)
In-Reply-To: <20261026-drm-rust-next-v1-2-14a4ae469175@redhat.com>
On Mon Oct 26, 2026 at 3:56 AM CET, Dave Airlie via B4 Relay wrote:
> diff --git a/drivers/gpu/nova-core/regs.rs b/drivers/gpu/nova-core/regs.rs
> index 88662da634dc..d5c67625b561 100644
> --- a/drivers/gpu/nova-core/regs.rs
> +++ b/drivers/gpu/nova-core/regs.rs
> @@ -419,6 +419,24 @@ pub(crate) fn mem_scrubbing_done(self) -> bool {
> }
> }
>
> +// PTIMER
> +
> +register! {
> + base: NovaRegisters;
> +
> + pub(crate) NV_PTIMER_TIME_PRIV_LEVEL_MASK(u32) @ 0x00009430 {
> + 4:4 level0 => bool;
> + }
> +
> + pub(crate) NV_PTIMER_TIME_0(u32) @ 0x00009400 {
> + 31:5 nsec;
> + }
> +
> + pub(crate) NV_PTIMER_TIME_1(u32) @ 0x00009410 {
> + 28:0 nsec;
> + }
> +}
> +
> // The modules below provide registers that are not identical on all supported chips. They should
> // only be used in HAL modules.
>
> @@ -520,6 +538,28 @@ pub(crate) mod gh100 {
> 31:0 fsp_boot_complete;
> }
> }
> +
> + // PGC6/TIMER
> + register! {
> + base: NovaRegisters;
> +
> + pub(crate) NV_PGC6_SCI_SEC_TIMER_TIME_0(u32) @ 0x00118f54 {
> + 31:5 nsec;
> + }
> +
> + pub(crate) NV_PGC6_SCI_SEC_TIMER_TIME_1(u32) @ 0x00118f58 {
> + 28:0 nsec;
> + }
> +
> + pub(crate) NV_PGC6_SCI_SYS_TIMER_OFFSET_0(u32) @ 0x00118df4 {
> + 0:0 update;
> + 31:5 nsec;
> + }
> +
> + pub(crate) NV_PGC6_SCI_SYS_TIMER_OFFSET_1(u32) @ 0x00118df8 {
> + 28:0 nsec;
> + }
> + }
> }
Timer specific register definitions should go into the timer module.
> +#[pin_data]
Why is this #[pin_data]?
> +pub(crate) struct Timer {
> + chipset: Chipset,
Why does this carry the Chipset?
> + sys_timer_offset_ns: i64,
> +}
More generally, what's the purpose of this struct? What does it represent?
Nothing seems to tie this object to a particular GPU or prevents constructing
multiple instances for the same GPU.
It also doesn't seem to provide any access to the underlying HAL's functions?
> +impl Timer {
> + pub(crate) fn new(bar: Bar0<'_>, chipset: Chipset) -> Result<Self> {
> + Ok(Self {
> + chipset,
> + sys_timer_offset_ns: hal::timer_hal(chipset).init(chipset, bar)?,
> + })
> + }
> +
> + #[expect(dead_code)]
> + pub(crate) fn sys_timer_offset_ns(&self) -> i64 {
> + self.sys_timer_offset_ns
> + }
What do we need this method for?
> +}
> +
> +pub(crate) fn get_cpu_time_ns() -> i64 {
> + Instant::<Monotonic>::now().as_nanos()
> +}
I don't think this helper adds much value, let's just make users call
Instant::<Monotonic>::now().as_nanos() themselves.
prev parent reply other threads:[~2026-10-26 12:33 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-26 2:56 [PATCH 0/2] nova-core: add initial support for gpu timer Dave Airlie
2026-10-26 2:56 ` Dave Airlie via B4 Relay
2026-10-26 2:56 ` [PATCH 1/2] rust/timer: expose as_nanos for clock sources Dave Airlie
2026-10-26 2:56 ` Dave Airlie via B4 Relay
2026-10-26 10:09 ` Andreas Hindborg
2026-10-26 19:04 ` Danilo Krummrich
2026-10-26 2:56 ` [PATCH 2/2] gpu: nova-core: add support for GPU timer block Dave Airlie
2026-10-26 2:56 ` Dave Airlie via B4 Relay
2026-10-26 9:07 ` sashiko-bot
2026-10-26 12:33 ` Danilo Krummrich [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=DMERUEZT5R3O.2K65JB1FXYVR4@kernel.org \
--to=dakr@kernel.org \
--cc=a.hindborg@kernel.org \
--cc=acourbot@nvidia.com \
--cc=airlied@redhat.com \
--cc=boqun@kernel.org \
--cc=devnull+airlied.redhat.com@kernel.org \
--cc=fujita.tomonori@gmail.com \
--cc=gary@garyguo.net \
--cc=lyude@redhat.com \
--cc=nova-gpu@lists.linux.dev \
--cc=rust-for-linux@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.