On 11/23/26 9:50 PM, Dave Airlie via B4 Relay wrote:
> From: Dave Airlie <[email protected]>
...
> diff --git a/drivers/gpu/nova-core/driver.rs b/drivers/gpu/nova-core/driver.rs
> index d6bc972d47c7..e89967ef0cd5 100644
> --- a/drivers/gpu/nova-core/driver.rs
> +++ b/drivers/gpu/nova-core/driver.rs
> @@ -105,6 +105,10 @@ fn probe<'bound>(
>          dev_dbg!(pdev, "Probe Nova Core GPU driver.\n");
>  
>          try_pin_init!(NovaCore {
> +            _: {
> +                crate::NovaCoreModule::check_bind_allowed(pdev)?;

This runs before Nova has read the Chipset. The PCI ID table matches
every NVIDIA VGA and 3D controller, so pre-Turing GPUs go through this
check too. That leads to the problem below, in the dev_info!() message.

> +            },
> +
>              _: {
>                  pdev.enable_device_mem()?;
>                  pdev.set_master();
> diff --git a/drivers/gpu/nova-core/nova_core.rs 
> b/drivers/gpu/nova-core/nova_core.rs
> index 84f777844592..483e5c1d427b 100644
> --- a/drivers/gpu/nova-core/nova_core.rs
> +++ b/drivers/gpu/nova-core/nova_core.rs
> @@ -68,6 +68,25 @@ pub(crate) fn debugfs_data<'a>(_dev: &'a 
> device::Device<device::Bound>) -> &'a D
>      }
>  }
>  
> +impl NovaCoreModule {
> +    /// Check whether nova-core is allowed to bind to GPUs.
> +    ///
> +    /// Binding needs to be requested explicitly, either through the
> +    /// NOVA_CORE_BIND_GSP Kconfig option or the `bind_gsp` module parameter.
> +    /// Otherwise, NVIDIA GPUs are left to other drivers, such as nouveau.
> +    pub(crate) fn check_bind_allowed(pdev: &pci::Device<device::Core<'_>>) 
> -> Result {
> +        if crate::module_parameters::bind_gsp.value() {
> +            return Ok(());
> +        }
> +
> +        dev_info!(
> +            pdev,
> +            "Not binding to GPU; enable with CONFIG_NOVA_CORE_BIND_GSP=y or 
> nova-core.bind_gsp=1\n"

This advice is wrong for pre-Turing GPUs. In other words, if someone boots
with bind_gsp *not* set on pre-Turing, they will see the above dmesg
output, but setting bind_gsp will not cause anything to start working,
because Nova doesn't support those GPUs.

Maybe the simplest fix is to change the print message to make a much
narrower claim. Something like this, in the same form as nouveau's
message in patch 1:

    "Not binding to GPU (bind_gsp=0)\n"

Doing the check later, after getting the Chipset/ChipID, would also avoid
the problem, and it is the order that nouveau uses in patch 1. However,
I'm not sure it's worth the extra code. The device has to be enabled and
BAR0 mapped before the Chipset can be read, so a declined probe has to
disable the device again. And rust/kernel/pci.rs has no
pci_disable_device() wrapper yet.


thanks,
-- 
John Hubbard

Reply via email to