[PATCH 04/17] gpu: nova-core: allocate PCI MSI vector during probe
From: John Hubbard
Date: Fri Aug 07 2026 - 23:12:38 EST
From: Joel Fernandes <joelagnelf@xxxxxxxxxx>
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.
Reviewed-by: Will Pierce <wpierce@xxxxxxxxxx>
Signed-off-by: Joel Fernandes <joelagnelf@xxxxxxxxxx>
Signed-off-by: John Hubbard <jhubbard@xxxxxxxxxx>
---
drivers/gpu/nova-core/gpu.rs | 6 ++++++
drivers/gpu/nova-core/irq.rs | 26 ++++++++++++++++++++++++++
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 42a4cd7971fa..5efeba056f1b 100644
--- a/drivers/gpu/nova-core/gpu.rs
+++ b/drivers/gpu/nova-core/gpu.rs
@@ -29,6 +29,7 @@
Gsp,
GspBootContext, //
},
+ irq,
regs,
vgpu::VgpuManager, //
};
@@ -386,6 +387,11 @@ pub(crate) fn new(
})?,
}),
+ // Allocate a PCI interrupt vector.
+ _: {
+ let _irq_vector = irq::alloc_vector(pdev)?;
+ },
+
gsp_static_info: {
// Obtain and display basic GPU information.
let info = gsp_resources.gsp.get_static_info(bar)?;
diff --git a/drivers/gpu/nova-core/irq.rs b/drivers/gpu/nova-core/irq.rs
new file mode 100644
index 000000000000..48900c734cb6
--- /dev/null
+++ b/drivers/gpu/nova-core/irq.rs
@@ -0,0 +1,26 @@
+// SPDX-License-Identifier: GPL-2.0
+// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
+
+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))?
+ }
+ };
+
+ irq_vectors.vector(0)
+}
diff --git a/drivers/gpu/nova-core/nova_core.rs b/drivers/gpu/nova-core/nova_core.rs
index 35a8b1214b0e..68b5abfe494d 100644
--- a/drivers/gpu/nova-core/nova_core.rs
+++ b/drivers/gpu/nova-core/nova_core.rs
@@ -17,6 +17,7 @@
mod fsp;
mod gpu;
mod gsp;
+mod irq;
mod mctp;
#[macro_use]
mod num;
--
2.55.0