[PATCH v1 2/7] gpu: nova-core: allocate PCI MSI vector during probe

From: Joel Fernandes

Date: Fri May 01 2026 - 17:00:10 EST


Allocate a single PCI MSI interrupt vector in the probe path.

Try MSI/MSI-X first. If that fails (possible in broken VFIO setups),
fall back to INTx with a dev_warn so the issue is visible in dmesg.
The allocation is devres-managed and automatically freed on unbind.

Signed-off-by: Joel Fernandes <joelagnelf@xxxxxxxxxx>
---
drivers/gpu/nova-core/gpu.rs | 7 +++++++
drivers/gpu/nova-core/irq.rs | 25 +++++++++++++++++++++++++
drivers/gpu/nova-core/nova_core.rs | 1 +
3 files changed, 33 insertions(+)
create mode 100644 drivers/gpu/nova-core/irq.rs

diff --git a/drivers/gpu/nova-core/gpu.rs b/drivers/gpu/nova-core/gpu.rs
index 659f6a24ee13..3ac9cb106bfd 100644
--- a/drivers/gpu/nova-core/gpu.rs
+++ b/drivers/gpu/nova-core/gpu.rs
@@ -11,6 +11,8 @@
sync::Arc, //
};

+use crate::irq;
+
use crate::{
bounded_enum,
driver::Bar0,
@@ -293,6 +295,11 @@ pub(crate) fn new<'a>(

_: { gsp.boot(pdev, bar, spec.chipset, gsp_falcon, sec2_falcon)? },

+ // Allocate a PCI interrupt vector.
+ _: {
+ let _irq_vector = irq::alloc_vector(pdev)?;
+ },
+
bar: devres_bar,
})
}
diff --git a/drivers/gpu/nova-core/irq.rs b/drivers/gpu/nova-core/irq.rs
new file mode 100644
index 000000000000..3a2a40519f11
--- /dev/null
+++ b/drivers/gpu/nova-core/irq.rs
@@ -0,0 +1,25 @@
+// SPDX-License-Identifier: GPL-2.0
+
+use kernel::{
+ device::Bound,
+ pci::{
+ self,
+ IrqType,
+ IrqTypes, //
+ },
+ prelude::*,
+};
+
+pub(crate) fn alloc_vector(pdev: &pci::Device<Bound>) -> Result<pci::IrqVector<'_>> {
+ let msi_types = IrqTypes::default().with(IrqType::Msi).with(IrqType::MsiX);
+
+ let irq_vectors = match pdev.alloc_irq_vectors(1, 1, msi_types) {
+ Ok(vecs) => vecs,
+ Err(_) => {
+ dev_warn!(pdev.as_ref(), "MSI not available, falling back to INTx\n");
+ pdev.alloc_irq_vectors(1, 1, IrqTypes::default().with(IrqType::Intx))?
+ }
+ };
+
+ Ok(*irq_vectors.start())
+}
diff --git a/drivers/gpu/nova-core/nova_core.rs b/drivers/gpu/nova-core/nova_core.rs
index 3a609f6937e4..837aa2d36a0e 100644
--- a/drivers/gpu/nova-core/nova_core.rs
+++ b/drivers/gpu/nova-core/nova_core.rs
@@ -19,6 +19,7 @@
mod firmware;
mod gpu;
mod gsp;
+mod irq;
#[macro_use]
mod num;
mod regs;
--
2.34.1