Nova-core must only bind to Physical Functions (PFs) and regular PCI devices, not to Virtual Functions (VFs) created through SR-IOV.
Detect VFs using the newly added is_virtfn() method, and leave them unclaimed. This allows a VFIO kernel module to claim the VFs instead. Signed-off-by: John Hubbard <[email protected]> --- drivers/gpu/nova-core/driver.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/gpu/nova-core/driver.rs b/drivers/gpu/nova-core/driver.rs index 5d23a91f51dd..004c15763694 100644 --- a/drivers/gpu/nova-core/driver.rs +++ b/drivers/gpu/nova-core/driver.rs @@ -54,6 +54,11 @@ impl pci::Driver for NovaCore { fn probe(pdev: &pci::Device<Core>, _info: &Self::IdInfo) -> Result<Pin<KBox<Self>>> { dev_dbg!(pdev.as_ref(), "Probe Nova Core GPU driver.\n"); + // NovaCore must only bind to Physical Functions (PFs), not Virtual Functions (VFs) + if pdev.is_virtfn() { + return Err(ENODEV); + } + pdev.enable_device_mem()?; pdev.set_master(); -- 2.51.0
