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>
This commit is contained in:
committed by
Danilo Krummrich
parent
dd3933e9b5
commit
6783d3b085
@@ -1,6 +1,14 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
|
||||
use kernel::{auxiliary, bindings, c_str, device::Core, pci, prelude::*, sizes::SZ_16M, sync::Arc};
|
||||
use kernel::{
|
||||
auxiliary, c_str,
|
||||
device::Core,
|
||||
pci,
|
||||
pci::{Class, ClassMask, Vendor},
|
||||
prelude::*,
|
||||
sizes::SZ_16M,
|
||||
sync::Arc,
|
||||
};
|
||||
|
||||
use crate::gpu::Gpu;
|
||||
|
||||
@@ -18,10 +26,25 @@ kernel::pci_device_table!(
|
||||
PCI_TABLE,
|
||||
MODULE_PCI_TABLE,
|
||||
<NovaCore as pci::Driver>::IdInfo,
|
||||
[(
|
||||
pci::DeviceId::from_id(bindings::PCI_VENDOR_ID_NVIDIA, bindings::PCI_ANY_ID as u32),
|
||||
()
|
||||
)]
|
||||
[
|
||||
// Modern NVIDIA GPUs will show up as either VGA or 3D controllers.
|
||||
(
|
||||
pci::DeviceId::from_class_and_vendor(
|
||||
Class::DISPLAY_VGA,
|
||||
ClassMask::ClassSubclass,
|
||||
Vendor::NVIDIA
|
||||
),
|
||||
()
|
||||
),
|
||||
(
|
||||
pci::DeviceId::from_class_and_vendor(
|
||||
Class::DISPLAY_3D,
|
||||
ClassMask::ClassSubclass,
|
||||
Vendor::NVIDIA
|
||||
),
|
||||
()
|
||||
),
|
||||
]
|
||||
);
|
||||
|
||||
impl pci::Driver for NovaCore {
|
||||
|
||||
Reference in New Issue
Block a user