Skip to content

Commit a75718a

Browse files
ttabiGnurou
authored andcommitted
gpu: nova-core: add NV_PFALCON_FALCON_ENGINE::reset_engine()
Add a method for the NV_PFALCON_FALCON_ENGINE register that reset the Falcon, and update the reset_eng() HAL functions to use it. Signed-off-by: Timur Tabi <ttabi@nvidia.com> Reviewed-by: Gary Guo <gary@garyguo.net> Acked-by: Danilo Krummrich <dakr@kernel.org> Link: https://patch.msgid.link/20260122222848.2555890-9-ttabi@nvidia.com Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
1 parent 954b38f commit a75718a

3 files changed

Lines changed: 20 additions & 17 deletions

File tree

drivers/gpu/nova-core/falcon/hal/ga102.rs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ use kernel::{
66
device,
77
io::poll::read_poll_timeout,
88
prelude::*,
9-
time::delay::fsleep,
109
time::Delta, //
1110
};
1211

@@ -147,13 +146,7 @@ impl<E: FalconEngine> FalconHal<E> for Ga102<E> {
147146
Delta::from_micros(150),
148147
);
149148

150-
regs::NV_PFALCON_FALCON_ENGINE::update(bar, &E::ID, |v| v.set_reset(true));
151-
152-
// TIMEOUT: falcon engine should not take more than 10us to reset.
153-
fsleep(Delta::from_micros(10));
154-
155-
regs::NV_PFALCON_FALCON_ENGINE::update(bar, &E::ID, |v| v.set_reset(false));
156-
149+
regs::NV_PFALCON_FALCON_ENGINE::reset_engine::<E>(bar);
157150
self.reset_wait_mem_scrubbing(bar)?;
158151

159152
Ok(())

drivers/gpu/nova-core/falcon/hal/tu102.rs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ use core::marker::PhantomData;
55
use kernel::{
66
io::poll::read_poll_timeout,
77
prelude::*,
8-
time::delay::fsleep,
98
time::Delta, //
109
};
1110

@@ -65,13 +64,7 @@ impl<E: FalconEngine> FalconHal<E> for Tu102<E> {
6564
}
6665

6766
fn reset_eng(&self, bar: &Bar0) -> Result {
68-
regs::NV_PFALCON_FALCON_ENGINE::update(bar, &E::ID, |v| v.set_reset(true));
69-
70-
// TIMEOUT: falcon engine should not take more than 10us to reset.
71-
fsleep(Delta::from_micros(10));
72-
73-
regs::NV_PFALCON_FALCON_ENGINE::update(bar, &E::ID, |v| v.set_reset(false));
74-
67+
regs::NV_PFALCON_FALCON_ENGINE::reset_engine::<E>(bar);
7568
self.reset_wait_mem_scrubbing(bar)?;
7669

7770
Ok(())

drivers/gpu/nova-core/regs.rs

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,18 @@
77
#[macro_use]
88
pub(crate) mod macros;
99

10-
use kernel::prelude::*;
10+
use kernel::{
11+
prelude::*,
12+
time, //
13+
};
1114

1215
use crate::{
16+
driver::Bar0,
1317
falcon::{
1418
DmaTrfCmdSize,
1519
FalconCoreRev,
1620
FalconCoreRevSubversion,
21+
FalconEngine,
1722
FalconFbifMemType,
1823
FalconFbifTarget,
1924
FalconMem,
@@ -365,6 +370,18 @@ register!(NV_PFALCON_FALCON_ENGINE @ PFalconBase[0x000003c0] {
365370
0:0 reset as bool;
366371
});
367372

373+
impl NV_PFALCON_FALCON_ENGINE {
374+
/// Resets the falcon
375+
pub(crate) fn reset_engine<E: FalconEngine>(bar: &Bar0) {
376+
Self::read(bar, &E::ID).set_reset(true).write(bar, &E::ID);
377+
378+
// TIMEOUT: falcon engine should not take more than 10us to reset.
379+
time::delay::fsleep(time::Delta::from_micros(10));
380+
381+
Self::read(bar, &E::ID).set_reset(false).write(bar, &E::ID);
382+
}
383+
}
384+
368385
register!(NV_PFALCON_FBIF_TRANSCFG @ PFalconBase[0x00000600[8]] {
369386
1:0 target as u8 ?=> FalconFbifTarget;
370387
2:2 mem_type as bool => FalconFbifMemType;

0 commit comments

Comments
 (0)