On Wed Nov 11, 2026 at 2:23 PM JST, Dave Airlie via B4 Relay wrote:
> From: Dave Airlie <[email protected]>
>
> This is needed to calculate the system timer offset that is passed
> to GSP init.
>
> 2 HALs exist:
>
> a) tu102 is the gv100 path from open-gpu, the priv level is checked
> and the cpu time is written to the gpu timer. no offset is used.
>
> b) gh100 is for hopper+
> This is the gh100 path from open-gpu, where the secure system
> timer is read, the offset is calculated.
> The offset is written to hw offset registers, except on the
> original gh100 where a workaround is needed for older FSP versions.
>
> Signed-off-by: Dave Airlie <[email protected]>

Reviewed-by: Alexandre Courbot <[email protected]>

One last nit (which can be addressed upon applying) below.

<...>
> diff --git a/drivers/gpu/nova-core/timer/hal/tu102.rs 
> b/drivers/gpu/nova-core/timer/hal/tu102.rs
> new file mode 100644
> index 000000000000..93fe17990ec8
> --- /dev/null
> +++ b/drivers/gpu/nova-core/timer/hal/tu102.rs
> @@ -0,0 +1,49 @@
> +// SPDX-License-Identifier: GPL-2.0
> +
> +use super::TimerHal;
> +
> +use kernel::{
> +    device,
> +    io::Io,
> +    prelude::*,
> +    time::*, //
> +};
> +
> +use crate::{
> +    driver::Bar0,
> +    fsp::Fsp,
> +    timer::regs::*, //
> +};
> +
> +/// Timer HAL for Turing, Ampere, Ada
> +struct Tu102;
> +
> +fn set_time(bar: Bar0<'_>, time_ns: u64) -> Result {
> +    if !bar.read(NV_PTIMER_TIME_PRIV_LEVEL_MASK).level0() {
> +        return Err(EINVAL);
> +    }
> +    bar.write_reg(NV_PTIMER_TIME_1::from_nsec(time_ns));
> +    bar.write_reg(NV_PTIMER_TIME_0::from_nsec(time_ns));
> +    Ok(())
> +}
> +
> +impl TimerHal for Tu102 {
> +    fn setup(
> +        &self,
> +        dev: &device::Device<device::Bound>,
> +        bar: Bar0<'_>,
> +        _fsp: Option<&Fsp<'_>>,
> +    ) -> Result<u64> {
> +        // The OpenRM driver uses wall clock time here not monotonic
> +        let sys_time_ns = Instant::<RealTime>::now().as_nanos();
> +
> +        // CAST: realtime system time can't be negative.
> +        // not setting the timer isn't fatal, just log.
> +        let _ = set_time(bar, sys_time_ns as u64)
> +            .inspect_err(|e| dev_err!(dev, "timer block failed to 
> initialise: {:?}", e));

Missing `\n` at the end of the error message.

Reply via email to