[PATCH v8 4/6] gpu: nova-core: use ENOTSUPP for unsupported GPUs, in all cases

John Hubbard posted 6 patches 2 months, 3 weeks ago
There is a newer version of this series
[PATCH v8 4/6] gpu: nova-core: use ENOTSUPP for unsupported GPUs, in all cases
Posted by John Hubbard 2 months, 3 weeks ago
Some places in the driver use ENODEV for unsupported GPUs, while others
use ENOTSUPP. ENOTSUPP is more accurate, so change the ENODEV instances
to ENOTSUPP.

Cc: Alexandre Courbot <acourbot@nvidia.com>
Cc: Danilo Krummrich <dakr@kernel.org>
Cc: Timur Tabi <ttabi@nvidia.com>
Cc: Joel Fernandes <joelagnelf@nvidia.com>
Signed-off-by: John Hubbard <jhubbard@nvidia.com>
---
 drivers/gpu/nova-core/gpu.rs | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/nova-core/gpu.rs b/drivers/gpu/nova-core/gpu.rs
index c1eca052968b..aa8e881dd474 100644
--- a/drivers/gpu/nova-core/gpu.rs
+++ b/drivers/gpu/nova-core/gpu.rs
@@ -62,7 +62,7 @@ impl TryFrom<u32> for Chipset {
             fn try_from(value: u32) -> Result<Self, Self::Error> {
                 match value {
                     $( $value => Ok(Chipset::$variant), )*
-                    _ => Err(ENODEV),
+                    _ => Err(ENOTSUPP),
                 }
             }
         }
@@ -143,7 +143,7 @@ fn try_from(value: u8) -> Result<Self> {
             0x16 => Ok(Self::Turing),
             0x17 => Ok(Self::Ampere),
             0x19 => Ok(Self::Ada),
-            _ => Err(ENODEV),
+            _ => Err(ENOTSUPP),
         }
     }
 }
-- 
2.51.2
Re: [PATCH v8 4/6] gpu: nova-core: use ENOTSUPP for unsupported GPUs, in all cases
Posted by Alexandre Courbot 2 months, 3 weeks ago
On Fri Nov 14, 2025 at 11:41 AM JST, John Hubbard wrote:
> Some places in the driver use ENODEV for unsupported GPUs, while others
> use ENOTSUPP. ENOTSUPP is more accurate, so change the ENODEV instances
> to ENOTSUPP.

Mmm actually I suspect we do want to return `ENODEV` in those cases, for
the driver core to interpret the error as "I reject this particular
device":

https://elixir.bootlin.com/linux/v6.13/source/drivers/base/dd.c#L588
Re: [PATCH v8 4/6] gpu: nova-core: use ENOTSUPP for unsupported GPUs, in all cases
Posted by John Hubbard 2 months, 3 weeks ago
On 11/14/25 7:03 AM, Alexandre Courbot wrote:
> On Fri Nov 14, 2025 at 11:41 AM JST, John Hubbard wrote:
>> Some places in the driver use ENODEV for unsupported GPUs, while others
>> use ENOTSUPP. ENOTSUPP is more accurate, so change the ENODEV instances
>> to ENOTSUPP.
> 
> Mmm actually I suspect we do want to return `ENODEV` in those cases, for
> the driver core to interpret the error as "I reject this particular
> device":
> 
> https://elixir.bootlin.com/linux/v6.13/source/drivers/base/dd.c#L588
> 

OK, so I guess I'll drop this patch and use ENODEV for this situation,
for now at least.

Later, separately, I might just go on a tiny crusade to improve the
driver base, such as:

diff --git a/drivers/base/dd.c b/drivers/base/dd.c
index 13ab98e033ea..100fd8886b8d 100644
--- a/drivers/base/dd.c
+++ b/drivers/base/dd.c
@@ -588,6 +588,7 @@ static int call_driver_probe(struct device *dev, const struct device_driver *drv
                dev_dbg(dev, "Driver %s requests probe deferral\n", drv->name);
                break;
        case -ENODEV:
+       case -ENOTSUPP:
        case -ENXIO:
                dev_dbg(dev, "probe with driver %s rejects match %d\n",
                        drv->name, ret);


thanks,
-- 
John Hubbard