[PATCH] virtio: ignore ENODEV for boot device hunting

Ludwig Nussel ludwig.nussel at siemens.com
Thu Apr 30 11:01:48 CEST 2026


On 4/29/26 16:20, Simon Glass wrote:
> [...]
>> diff --git a/drivers/virtio/virtio-uclass.c b/drivers/virtio/virtio-uclass.c
>> @@ -382,7 +382,7 @@ static int virtio_bootdev_hunt(struct bootdev_hunter *info, bool show)
>>        ret = uclass_probe_all(UCLASS_VIRTIO);
>> -     if (ret && ret != -ENOENT)
>> +     if (ret && ret != -ENOENT && ret != -ENODEV)
>>                return log_msg_ret('vir', ret);
> 
> I don't think this is the right layer. uclass_probe_all() walks every
> device in the uclass and returns whichever error came back last, so a
> single bogus mmio slot poisons the result for every other working
> virtio device. -ENXIO is also returned from virtio_mmio_probe() for an
> unsupported version and would still bail out here, which is
> inconsistent with what you are trying to achieve.
> 
> As I understand it, the placeholder/empty mmio slots should not be
> reaching probe at all, i.e. the bind step should reject them - or
> virtio_mmio_probe() should keep returning 0 for the 'no device
> present' case (wrong magic, ID 0) and let DM treat that as nothing to
> probe. The unsupported-version case is the only real error.
> 
> Could you take another look at 70101c3217ae and see whether the fix
> belongs there (or in the bind path) instead?

I don't know the first thing about that :) Naively changing the function 
to be called in bind() instead makes u-boot crash. It would be possible 
to change the return value in the probe function to ENOENT instead.
The driver claims to be ported from Linux. In Linux the return value in 
question is ENODEV though.

Maybe it makes sense to make virtio_bootdev_hunt() ignore all errors 
instead?

cu
Ludwig

-- 
Ludwig Nussel
Siemens AG
www.siemens.com


More information about the U-Boot mailing list