From: John Hubbard <jhubbard@nvidia.com>
To: Danilo Krummrich <dakr@kernel.org>,
Alexandre Courbot <acourbot@nvidia.com>
Cc: "Timur Tabi" <ttabi@nvidia.com>,
"Alistair Popple" <apopple@nvidia.com>,
"Eliot Courtney" <ecourtney@nvidia.com>,
"Zhi Wang" <zhiw@nvidia.com>, "David Airlie" <airlied@gmail.com>,
"Simona Vetter" <simona@ffwll.ch>,
"Bjorn Helgaas" <bhelgaas@google.com>,
"Miguel Ojeda" <ojeda@kernel.org>,
"Alex Gaynor" <alex.gaynor@gmail.com>,
"Boqun Feng" <boqun.feng@gmail.com>,
"Gary Guo" <gary@garyguo.net>,
"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
"Benno Lossin" <lossin@kernel.org>,
"Andreas Hindborg" <a.hindborg@kernel.org>,
"Alice Ryhl" <aliceryhl@google.com>,
"Trevor Gross" <tmgross@umich.edu>,
nova-gpu@lists.linux.dev, LKML <linux-kernel@vger.kernel.org>,
"John Hubbard" <jhubbard@nvidia.com>
Subject: [PATCH v5 12/15] gpu: nova-core: add the falcon interrupt registers and HAL methods
Date: Tue, 29 Sep 2026 20:41:45 -0700 [thread overview]
Message-ID: <20260930034148.590687-13-jhubbard@nvidia.com> (raw)
In-Reply-To: <20260930034148.590687-1-jhubbard@nvidia.com>
A falcon latches each interrupt cause that is raised in its IRQSTAT
register. On a RISC-V falcon, each cause is routed either to the host,
meaning the CPU, or to the falcon's own core, and two routing registers
hold that routing. The falcon signals the interrupt tree only when its
set of host-routed causes goes from empty to non-empty, so a handler
that clears the tree leaf while a cause is still latched has to write
INTR_RETRIGGER, which makes the falcon re-emit its causes. Turing
falcons have no INTR_RETRIGGER, and the routing registers have
different offsets from GA102 on.
Add IRQSTAT, INTR_RETRIGGER, and the two routing registers, the last at
both sets of offsets, and add two falcon HAL methods: one intersects an
IRQSTAT value with the routing registers, and one retriggers the
falcon, or does nothing on Turing. GA100 keeps the Turing HAL, as it
does for boot, and the retrigger register is a property of that HAL's
instance.
The two methods have no user yet.
Assisted-by: LLM
Signed-off-by: John Hubbard <jhubbard@nvidia.com>
---
drivers/gpu/nova-core/falcon/hal.rs | 21 ++++++-
drivers/gpu/nova-core/falcon/hal/ga102.rs | 16 ++++++
drivers/gpu/nova-core/falcon/hal/tu102.rs | 51 ++++++++++++++++-
drivers/gpu/nova-core/regs.rs | 69 +++++++++++++++++++++++
4 files changed, 154 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/nova-core/falcon/hal.rs b/drivers/gpu/nova-core/falcon/hal.rs
index 7e532889a1f4..2f02da52334e 100644
--- a/drivers/gpu/nova-core/falcon/hal.rs
+++ b/drivers/gpu/nova-core/falcon/hal.rs
@@ -12,6 +12,7 @@
Architecture,
Chipset, //
},
+ regs,
};
mod ga102;
@@ -70,6 +71,24 @@ fn signature_reg_fuse_version(
/// these. For anything above, the PIO registers appear to be masked to the CPU, so DMA is the
/// only usable method.
fn load_method(&self) -> LoadMethod;
+
+ /// Returns the causes in `latched` that are routed to the host, meaning the CPU, rather than
+ /// to the falcon's own RISC-V core.
+ ///
+ /// The causes routed to the core belong to the firmware running on it, and the host does not
+ /// service them.
+ #[expect(dead_code)]
+ fn host_routed_causes(
+ &self,
+ falcon: &Falcon<'_, E>,
+ latched: regs::NV_PFALCON_FALCON_IRQSTAT,
+ ) -> regs::NV_PFALCON_FALCON_IRQSTAT;
+
+ /// Retriggers the falcon, which then re-emits its host-routed causes into the interrupt tree.
+ ///
+ /// Turing falcons have no retrigger register, so on Turing this does nothing.
+ #[expect(dead_code)]
+ fn retrigger(&self, falcon: &Falcon<'_, E>);
}
/// Returns a boxed falcon HAL adequate for `chipset`.
@@ -86,7 +105,7 @@ pub(super) fn falcon_hal<E: FalconEngine + 'static>(
}
// GA100 boots like Turing so use Turing HAL
Architecture::Ampere if chipset == Chipset::GA100 => {
- KBox::new(tu102::Tu102::<E>::new(), GFP_KERNEL)? as KBox<dyn FalconHal<E>>
+ KBox::new(tu102::Tu102::<E>::ga100(), GFP_KERNEL)? as KBox<dyn FalconHal<E>>
}
Architecture::Ampere
| Architecture::Ada
diff --git a/drivers/gpu/nova-core/falcon/hal/ga102.rs b/drivers/gpu/nova-core/falcon/hal/ga102.rs
index f9a8444cf840..b0eb1901d213 100644
--- a/drivers/gpu/nova-core/falcon/hal/ga102.rs
+++ b/drivers/gpu/nova-core/falcon/hal/ga102.rs
@@ -169,4 +169,20 @@ fn reset_eng(&self, falcon: &Falcon<'_, E>) -> Result {
fn load_method(&self) -> LoadMethod {
LoadMethod::Dma
}
+
+ fn host_routed_causes(
+ &self,
+ falcon: &Falcon<'_, E>,
+ latched: regs::NV_PFALCON_FALCON_IRQSTAT,
+ ) -> regs::NV_PFALCON_FALCON_IRQSTAT {
+ let pfalcon2 = falcon.pfalcon2;
+ let mask = pfalcon2.read(regs::ga102::NV_PRISCV_RISCV_IRQMASK).value();
+ let dest = pfalcon2.read(regs::ga102::NV_PRISCV_RISCV_IRQDEST).value();
+
+ regs::NV_PFALCON_FALCON_IRQSTAT::from(latched.into_raw() & mask & dest)
+ }
+
+ fn retrigger(&self, falcon: &Falcon<'_, E>) {
+ super::tu102::retrigger_ga100(falcon);
+ }
}
diff --git a/drivers/gpu/nova-core/falcon/hal/tu102.rs b/drivers/gpu/nova-core/falcon/hal/tu102.rs
index 7fc6e83c2566..bd66b7759ea6 100644
--- a/drivers/gpu/nova-core/falcon/hal/tu102.rs
+++ b/drivers/gpu/nova-core/falcon/hal/tu102.rs
@@ -5,6 +5,7 @@
use kernel::{
io::{
poll::read_poll_timeout,
+ register::Array,
Io, //
},
prelude::*,
@@ -23,14 +24,42 @@
use super::FalconHal;
-pub(super) struct Tu102<E: FalconEngine>(PhantomData<E>);
+/// The falcon HAL for Turing and GA100. GA100 boots like a Turing, but unlike Turing, it has a
+/// retrigger register.
+pub(super) struct Tu102<E: FalconEngine> {
+ /// If `true`, the falcons have `NV_PFALCON_FALCON_INTR_RETRIGGER`.
+ #[expect(dead_code)]
+ has_intr_retrigger: bool,
+ _engine: PhantomData<E>,
+}
impl<E: FalconEngine> Tu102<E> {
+ /// Returns the HAL of Turing falcons.
pub(super) fn new() -> Self {
- Self(PhantomData)
+ Self {
+ has_intr_retrigger: false,
+ _engine: PhantomData,
+ }
+ }
+
+ /// Returns the HAL of GA100 falcons: the Turing HAL, with the retrigger register.
+ pub(super) fn ga100() -> Self {
+ Self {
+ has_intr_retrigger: true,
+ _engine: PhantomData,
+ }
}
}
+/// Writes `NV_PFALCON_FALCON_INTR_RETRIGGER`.
+#[expect(dead_code)]
+pub(super) fn retrigger_ga100<E: FalconEngine>(falcon: &Falcon<'_, E>) {
+ falcon.pfalcon.write(
+ Array::at(0),
+ regs::NV_PFALCON_FALCON_INTR_RETRIGGER::zeroed().with_trigger(true),
+ );
+}
+
impl<E: FalconEngine> FalconHal<E> for Tu102<E> {
fn select_core(&self, _falcon: &Falcon<'_, E>) -> Result {
Ok(())
@@ -79,4 +108,22 @@ fn reset_eng(&self, falcon: &Falcon<'_, E>) -> Result {
fn load_method(&self) -> LoadMethod {
LoadMethod::Pio
}
+
+ fn host_routed_causes(
+ &self,
+ falcon: &Falcon<'_, E>,
+ latched: regs::NV_PFALCON_FALCON_IRQSTAT,
+ ) -> regs::NV_PFALCON_FALCON_IRQSTAT {
+ let pfalcon2 = falcon.pfalcon2;
+ let mask = pfalcon2.read(regs::tu102::NV_PRISCV_RISCV_IRQMASK).value();
+ let dest = pfalcon2.read(regs::tu102::NV_PRISCV_RISCV_IRQDEST).value();
+
+ regs::NV_PFALCON_FALCON_IRQSTAT::from(latched.into_raw() & mask & dest)
+ }
+
+ fn retrigger(&self, falcon: &Falcon<'_, E>) {
+ if self.has_intr_retrigger {
+ retrigger_ga100(falcon);
+ }
+ }
}
diff --git a/drivers/gpu/nova-core/regs.rs b/drivers/gpu/nova-core/regs.rs
index 9978fb2803b0..88662da634dc 100644
--- a/drivers/gpu/nova-core/regs.rs
+++ b/drivers/gpu/nova-core/regs.rs
@@ -124,11 +124,25 @@ pub(crate) fn usable_fb_size(self) -> u64 {
register! {
base: PFalconRegisters;
+ /// Clears the latch of every cause whose bit is written as `1`. Write-only.
+ ///
+ /// The write ends the latch and not the source, so a cause driven from outside the falcon
+ /// stays set. "Retriggering a falcon" in `Documentation/gpu/nova/core/interrupts.rst` names
+ /// those causes.
pub(crate) NV_PFALCON_FALCON_IRQSCLR(u32) @ 0x00000004 {
6:6 swgen0 => bool;
4:4 halt => bool;
}
+ /// Interrupt causes latched in the falcon, one bit per cause, whichever target each is routed
+ /// to.
+ ///
+ /// The causes routed to the host are the ones also set in `NV_PRISCV_RISCV_IRQMASK` and
+ /// `NV_PRISCV_RISCV_IRQDEST`.
+ pub(crate) NV_PFALCON_FALCON_IRQSTAT(u32) @ 0x00000008 {
+ 6:6 swgen0 => bool;
+ }
+
pub(crate) NV_PFALCON_FALCON_MAILBOX0(u32) @ 0x00000040 {
31:0 value => u32;
}
@@ -256,6 +270,16 @@ pub(crate) fn usable_fb_size(self) -> u64 {
0:0 reset => bool;
}
+ /// Makes the falcon re-emit its host-routed causes into the interrupt tree. Write-only.
+ ///
+ /// Present from GA100 on. See "Retriggering a falcon" in
+ /// `Documentation/gpu/nova/core/interrupts.rst`.
+ ///
+ /// The hardware headers declare two elements, and OpenRM writes only the first.
+ pub(crate) NV_PFALCON_FALCON_INTR_RETRIGGER(u32)[2] @ 0x000003e8 {
+ 0:0 trigger => bool;
+ }
+
pub(crate) NV_PFALCON_FBIF_TRANSCFG(u32)[8] @ 0x00000600 {
2:2 mem_type => FalconFbifMemType;
1:0 target ?=> FalconFbifTarget;
@@ -414,6 +438,29 @@ pub(crate) mod gm107 {
}
}
+pub(crate) mod tu102 {
+ use kernel::io::register;
+
+ use crate::falcon::PFalcon2Registers;
+
+ // The RISC-V interrupt routing registers, at the offsets that Turing and GA100 use.
+
+ register! {
+ base: PFalcon2Registers;
+
+ /// Enabled causes, one bit per cause. Read-only to the host.
+ pub(crate) NV_PRISCV_RISCV_IRQMASK(u32) @ 0x000002b4 {
+ 31:0 value => u32;
+ }
+
+ /// Causes routed to the host, one bit per cause. A clear bit routes the cause to the
+ /// RISC-V core.
+ pub(crate) NV_PRISCV_RISCV_IRQDEST(u32) @ 0x000002b8 {
+ 31:0 value => u32;
+ }
+ }
+}
+
pub(crate) mod ga100 {
use kernel::io::register;
@@ -430,6 +477,28 @@ pub(crate) mod ga100 {
}
}
+pub(crate) mod ga102 {
+ use kernel::io::register;
+
+ use crate::falcon::PFalcon2Registers;
+
+ // The RISC-V interrupt routing registers, at the offsets that GA102 and later use.
+
+ register! {
+ base: PFalcon2Registers;
+
+ /// Same as [`super::tu102::NV_PRISCV_RISCV_IRQMASK`], at the GA102 offset.
+ pub(crate) NV_PRISCV_RISCV_IRQMASK(u32) @ 0x00000528 {
+ 31:0 value => u32;
+ }
+
+ /// Same as [`super::tu102::NV_PRISCV_RISCV_IRQDEST`], at the GA102 offset.
+ pub(crate) NV_PRISCV_RISCV_IRQDEST(u32) @ 0x0000052c {
+ 31:0 value => u32;
+ }
+ }
+}
+
pub(crate) const NV_THERM_I2CS_SCRATCH_FSP_BOOT_COMPLETE_STATUS_SUCCESS: u32 = 0xff;
pub(crate) mod gh100 {
--
2.55.0
next prev parent reply other threads:[~2026-09-30 3:43 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-30 3:41 [PATCH v5 00/15] nova-core: GPU interrupt support and GSP event delivery John Hubbard
2026-09-30 3:41 ` [PATCH v5 01/15] rust: pci: declare IrqType and IrqTypes with impl_flags John Hubbard
2026-09-30 3:41 ` [PATCH v5 02/15] rust: sync: completion: add wait_for_completion_timeout() John Hubbard
2026-09-30 3:59 ` sashiko-bot
2026-09-30 3:41 ` [PATCH v5 03/15] gpu: nova-core: add the GIN vector, leaf and subtree types John Hubbard
2026-09-30 3:41 ` [PATCH v5 04/15] gpu: nova-core: add the GIN CPU interrupt tree and MSI EOI registers John Hubbard
2026-09-30 3:41 ` [PATCH v5 05/15] gpu: nova-core: add the per-architecture GIN CPU interrupt HAL John Hubbard
2026-09-30 3:41 ` [PATCH v5 06/15] gpu: nova-core: add the GIN interrupt tree and allocate its vectors John Hubbard
2026-09-30 3:41 ` [PATCH v5 07/15] gpu: nova-core: wait for GFW boot in probe, not in the Gpu constructor John Hubbard
2026-09-30 3:41 ` [PATCH v5 08/15] gpu: nova-core: add an interrupt delivery self-test John Hubbard
2026-09-30 3:41 ` [PATCH v5 09/15] gpu: nova-core: log GSP events instead of discarding them John Hubbard
2026-09-30 3:41 ` [PATCH v5 10/15] gpu: nova-core: return ENOMSG for an unmatched GSP message John Hubbard
2026-09-30 3:41 ` [PATCH v5 11/15] gpu: nova-core: bound a GSP wait by a single deadline John Hubbard
2026-09-30 3:41 ` John Hubbard [this message]
2026-09-30 3:41 ` [PATCH v5 13/15] gpu: nova-core: service GSP events from the SWGEN0 interrupt John Hubbard
2026-09-30 3:41 ` [PATCH v5 14/15] gpu: nova-core: add KUnit tests for the interrupt tree John Hubbard
2026-09-30 3:41 ` [PATCH v5 15/15] gpu: nova-core: document the GIN interrupt controller and GSP events John Hubbard
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=20260930034148.590687-13-jhubbard@nvidia.com \
--to=jhubbard@nvidia.com \
--cc=a.hindborg@kernel.org \
--cc=acourbot@nvidia.com \
--cc=airlied@gmail.com \
--cc=alex.gaynor@gmail.com \
--cc=aliceryhl@google.com \
--cc=apopple@nvidia.com \
--cc=bhelgaas@google.com \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun.feng@gmail.com \
--cc=dakr@kernel.org \
--cc=ecourtney@nvidia.com \
--cc=gary@garyguo.net \
--cc=linux-kernel@vger.kernel.org \
--cc=lossin@kernel.org \
--cc=nova-gpu@lists.linux.dev \
--cc=ojeda@kernel.org \
--cc=simona@ffwll.ch \
--cc=tmgross@umich.edu \
--cc=ttabi@nvidia.com \
--cc=zhiw@nvidia.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®