Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

gpu: nova-core: avoid probing non-display/compute PCI functions

NovaCore has so far been too imprecise about figuring out if .probe()
has found a supported PCI PF (Physical Function). By that I mean:
.probe() sets up BAR0 (which involves a lot of very careful devres and
Device<Bound> details behind the scenes). And then if it is dealing with
a non-supported device such as the .1 audio PF on many GPUs, it fails
out due to an unexpected BAR0 size. We have been fortunate that the BAR0
sizes are different.

Really, we should be filtering on PCI class ID instead. These days I
think we can confidently pick out Nova's supported PF's via PCI class
ID. And if not, then we'll revisit.

The approach here is to filter on "Display VGA" or "Display 3D", which
is how PCI class IDs express "this is a modern GPU's PF".

Cc: Danilo Krummrich <dakr@kernel.org>
Cc: Elle Rhumsaa <elle@weathered-steel.dev>
Reviewed-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: John Hubbard <jhubbard@nvidia.com>
Link: https://lore.kernel.org/r/20250829223632.144030-5-jhubbard@nvidia.com
Signed-off-by: Danilo Krummrich <dakr@kernel.org>

authored by

John Hubbard and committed by
Danilo Krummrich
6783d3b0 dd3933e9

+28 -5
+28 -5
drivers/gpu/nova-core/driver.rs
··· 1 1 // SPDX-License-Identifier: GPL-2.0 2 2 3 - use kernel::{auxiliary, bindings, c_str, device::Core, pci, prelude::*, sizes::SZ_16M, sync::Arc}; 3 + use kernel::{ 4 + auxiliary, c_str, 5 + device::Core, 6 + pci, 7 + pci::{Class, ClassMask, Vendor}, 8 + prelude::*, 9 + sizes::SZ_16M, 10 + sync::Arc, 11 + }; 4 12 5 13 use crate::gpu::Gpu; 6 14 ··· 26 18 PCI_TABLE, 27 19 MODULE_PCI_TABLE, 28 20 <NovaCore as pci::Driver>::IdInfo, 29 - [( 30 - pci::DeviceId::from_id(bindings::PCI_VENDOR_ID_NVIDIA, bindings::PCI_ANY_ID as u32), 31 - () 32 - )] 21 + [ 22 + // Modern NVIDIA GPUs will show up as either VGA or 3D controllers. 23 + ( 24 + pci::DeviceId::from_class_and_vendor( 25 + Class::DISPLAY_VGA, 26 + ClassMask::ClassSubclass, 27 + Vendor::NVIDIA 28 + ), 29 + () 30 + ), 31 + ( 32 + pci::DeviceId::from_class_and_vendor( 33 + Class::DISPLAY_3D, 34 + ClassMask::ClassSubclass, 35 + Vendor::NVIDIA 36 + ), 37 + () 38 + ), 39 + ] 33 40 ); 34 41 35 42 impl pci::Driver for NovaCore {