From: "Alexandre Courbot" <acourbot@nvidia.com>
To: "John Hubbard" <jhubbard@nvidia.com>
Cc: "Danilo Krummrich" <dakr@kernel.org>,
"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>,
"Will Pierce" <wpierce@nvidia.com>
Subject: Re: [PATCH v2 05/15] gpu: nova-core: add the per-architecture GIN CPU interrupt HAL
Date: Tue, 01 Sep 2026 10:15:20 +0900 [thread overview]
Message-ID: <DL3KYZGCCPTV.17HP77N1O650J@nvidia.com> (raw)
In-Reply-To: <20260829012243.496697-6-jhubbard@nvidia.com>
On Sat Aug 29, 2026 at 10:22 AM JST, John Hubbard wrote:
> GIN, the GPU Interrupt and Notification unit, is the GPU's interrupt
> controller. Each PCIe function has its own tree, whose leaf count
> depends on the GPU family.
>
> Message-signaled delivery stops after each edge until the CPU rearms it,
> and the rearm write differs by family and interrupt type:
>
> * Pre-Hopper MSI writes an EOI through the BAR0 PCI configuration
> space mirror.
>
> * MSI for Hopper and later cycles the TOP enable bits of every
> serviced subtree.
>
> * MSI-X on any family cycles the bits of the handler's own subtree.
The indentation of this bullet list is a bit unconventional for a kernel
git log (`*` typically starts at column 1).
<...>
> +impl PciIrqRearmMethod {
> + /// Performs this method's register write.
> + ///
> + /// `serviced` holds every subtree the driver services, and `subtree` is the one subtree the
> + /// calling handler serves. Each method uses whichever of the two its interrupt type delivers
> + /// on, so both are required.
> + pub(super) fn rearm(self, bar: Bar0<'_>, serviced: SubtreeSet, subtree: Subtree) {
> + let subtrees = match self {
> + // The written value is ignored, so any write rearms delivery.
> + Self::ConfigMirrorEoi => {
> + bar.write(regs::NV_XVE_CYA_2, 0u32.into());
> + return;
> + }
> + Self::TopEnableCycleServiced => serviced,
> + Self::TopEnableCycleSubtree => SubtreeSet::from(subtree),
> + };
> +
> + bar.write(
> + regs::NV_VIRTUAL_FUNCTION_PRIV_CPU_INTR_TOP_EN_CLEAR,
> + subtrees.into_raw().into(),
> + );
> + bar.write(
> + regs::NV_VIRTUAL_FUNCTION_PRIV_CPU_INTR_TOP_EN_SET,
> + subtrees.into_raw().into(),
> + );
With the typed register fields in patch 3, these can become:
bar.write_reg(
regs::NV_VIRTUAL_FUNCTION_PRIV_CPU_INTR_TOP_EN_CLEAR::zeroed().with_subtrees(subtrees),
);
bar.write_reg(
regs::NV_VIRTUAL_FUNCTION_PRIV_CPU_INTR_TOP_EN_SET::zeroed().with_subtrees(subtrees),
);
> + }
> +}
> +
> +/// Per-architecture properties of the GIN CPU interrupt tree.
> +///
> +/// The tree size and the method that rearms PCI interrupt delivery differ by family. The tree
> +/// walk, the vector encoding, and the read-and-clear sequence do not, and are in generic code.
The last sentence sounds a bit self-evident and unneeded.
> +///
> +/// See `Documentation/gpu/nova/core/interrupts.rst`.
> +pub(super) trait CpuInterruptHal {
> + /// Returns the number of leaves the CPU tree implements.
> + ///
> + /// [`LeafCount::subtree_set`] gives the subtrees behind them, and
> + /// [`LeafCount::vector_count`] the vectors they carry.
> + fn leaf_count(&self) -> LeafCount;
> +
> + /// Returns the method that rearms PCI interrupt delivery for `irq_type`.
> + ///
> + /// `None` means that `irq_type` needs no rearm write. That is the case for `INTx`, which is
> + /// level-triggered, and which nova-core does not allocate.
> + fn pci_irq_rearm_method(&self, irq_type: IrqType) -> Option<PciIrqRearmMethod>;
> +}
> +
> +/// Returns the [`CpuInterruptHal`] for `chipset`.
> +pub(super) fn cpu_interrupt_hal(chipset: Chipset) -> &'static dyn CpuInterruptHal {
> + match chipset.arch() {
> + Architecture::Turing | Architecture::Ampere | Architecture::Ada => tu102::TU102_HAL,
> + Architecture::Hopper | Architecture::BlackwellGB10x | Architecture::BlackwellGB20x => {
> + gh100::GH100_HAL
> + }
> + }
> +}
> diff --git a/drivers/gpu/nova-core/irq/hal/gh100.rs b/drivers/gpu/nova-core/irq/hal/gh100.rs
> new file mode 100644
> index 000000000000..32b9b4a01adb
> --- /dev/null
> +++ b/drivers/gpu/nova-core/irq/hal/gh100.rs
> @@ -0,0 +1,31 @@
> +// SPDX-License-Identifier: GPL-2.0
> +// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
> +
> +use kernel::pci::IrqType;
> +
> +use super::{
> + CpuInterruptHal,
> + LeafCount,
> + PciIrqRearmMethod, //
> +};
> +
> +/// GIN parameters for Hopper and Blackwell, which implement a 16-leaf CPU tree. Only 12 leaves
> +/// carry sources.
> +struct Gh100;
> +
> +impl CpuInterruptHal for Gh100 {
> + fn leaf_count(&self) -> LeafCount {
> + LeafCount::Sixteen
> + }
> +
> + fn pci_irq_rearm_method(&self, irq_type: IrqType) -> Option<PciIrqRearmMethod> {
> + match irq_type {
> + IrqType::Intx => None,
> + IrqType::Msi => Some(PciIrqRearmMethod::TopEnableCycleServiced),
> + IrqType::MsiX => Some(PciIrqRearmMethod::TopEnableCycleSubtree),
> + }
> + }
AFAIU we do not support INTx at all, right? In this case it just
shouldn't be handled here, and we could simplify this method to just
return `PciIrqRearmMethod`.
I suspect we are considering INTx because we work with the kernel's
`IrqType`, which includes it, and must make our match arms exhaustive.
Let's just use our own IRQ type for Nova:
pub(crate) enum MsiType {
Msi,
MsiX,
}
Then every instance of `IrqType` in the `irq` module can be replaced by
this one, and we don't need to care about INTx anymore. This method can
also just return a `PciIrqRearmMethod`.
You will probably need to include a `MsiType` into `SubtreeVectors` to
make its `irq_type` method work, but that's still better than having
code for managing an INTx variant that is dead code since it would have
failed at probe time anyway.
next prev parent reply other threads:[~2026-09-01 1:15 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-29 1:22 [PATCH v2 00/15] nova-core: GPU interrupt support and GSP event delivery John Hubbard
2026-08-29 1:22 ` [PATCH v2 01/15] rust: pci: declare IrqType and IrqTypes with impl_flags John Hubbard
2026-08-31 1:10 ` Alexandre Courbot
2026-08-29 1:22 ` [PATCH v2 02/15] rust: sync: completion: add wait_for_completion_timeout() John Hubbard
2026-08-31 1:10 ` Alexandre Courbot
2026-08-29 1:22 ` [PATCH v2 03/15] gpu: nova-core: add the GIN CPU interrupt tree and MSI EOI registers John Hubbard
2026-08-29 1:22 ` [PATCH v2 04/15] gpu: nova-core: add the GIN vector and subtree newtypes John Hubbard
2026-08-31 14:24 ` Alexandre Courbot
2026-09-01 13:16 ` Alexandre Courbot
2026-08-29 1:22 ` [PATCH v2 05/15] gpu: nova-core: add the per-architecture GIN CPU interrupt HAL John Hubbard
2026-09-01 1:15 ` Alexandre Courbot [this message]
2026-08-29 1:25 ` [PATCH v2 00/15] nova-core: GPU interrupt support and GSP event delivery John Hubbard
2026-08-29 1:35 ` John Hubbard
2026-08-29 1:33 ` [PATCH v2 06/15] gpu: nova-core: add the GIN interrupt tree and allocate its vectors John Hubbard
2026-09-01 7:03 ` Alexandre Courbot
2026-08-29 1:33 ` [PATCH v2 07/15] gpu: nova-core: add an interrupt delivery self-test John Hubbard
2026-09-01 12:52 ` Alexandre Courbot
2026-08-29 1:33 ` [PATCH v2 08/15] gpu: nova-core: dispatch GSP events instead of discarding them John Hubbard
2026-08-31 5:06 ` Alexandre Courbot
2026-08-29 1:33 ` [PATCH v2 09/15] gpu: nova-core: match GSP RPC replies by sequence, not just function John Hubbard
2026-08-31 1:09 ` Alexandre Courbot
2026-08-31 4:33 ` John Hubbard
2026-08-31 22:18 ` John Hubbard
2026-08-31 22:46 ` John Hubbard
2026-08-29 1:33 ` [PATCH v2 10/15] gpu: nova-core: recover the GSP receive path from corrupt framing John Hubbard
2026-08-31 5:35 ` Alexandre Courbot
2026-08-29 1:33 ` [PATCH v2 11/15] gpu: nova-core: bound a GSP wait by a single deadline John Hubbard
2026-08-31 6:04 ` Alexandre Courbot
2026-08-29 1:33 ` [PATCH v2 12/15] gpu: nova-core: drive GSP events with the SWGEN0 interrupt John Hubbard
2026-09-01 14:54 ` Alexandre Courbot
2026-09-01 15:08 ` Danilo Krummrich
2026-09-02 14:33 ` Alexandre Courbot
2026-09-03 3:06 ` John Hubbard
2026-08-29 1:33 ` [PATCH v2 13/15] gpu: nova-core: retrigger the GSP falcon and clear every latched cause John Hubbard
2026-09-02 15:00 ` Alexandre Courbot
2026-08-29 1:33 ` [PATCH v2 14/15] gpu: nova-core: add KUnit tests for the interrupt tree and HALs John Hubbard
2026-08-29 1:33 ` [PATCH v2 15/15] gpu: nova-core: document the GIN interrupt controller and GSP events John Hubbard
2026-09-02 15:07 ` Alexandre Courbot
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=DL3KYZGCCPTV.17HP77N1O650J@nvidia.com \
--to=acourbot@nvidia.com \
--cc=a.hindborg@kernel.org \
--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=jhubbard@nvidia.com \
--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=wpierce@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®