[U-Boot] Feedback: Device probe during boot

Hello Maintainer/Owners,
Please provide your valuable input
Referring '[PATCH] drivers: serial: probe all serial devices' email regarding unified way to probe device during boot using DM model
I would like to take this thread forward and request your time to help identify the design framework
1. In dm_init(), * Identify the class of devices to be probed * Call dm_set_uclass_autoprobe(enum uclass_id, bool) 2. In core file on every device class * uclass_next_device() to iterate through next device
There would be config option to choose probe all devices or not
Let me know your time if I can schedule skype session for further discussion
NOTE: Attaching previous threads discussed on this issue
Regards,
Vabhav

Dear Vabhav,
In message VI1PR04MB480059394276E5984161DD12F3CF0@VI1PR04MB4800.eurprd04.prod.outlook.com you wrote:
Referring '[PATCH] drivers: serial: probe all serial devices' email regarding unified way to probe device during boot using DM model
I would like to take this thread forward and request your time to help identify the design framework
- In dm_init(),
- Identify the class of devices to be probed
- Call dm_set_uclass_autoprobe(enum uclass_id, bool)
- In core file on every device class
- uclass_next_device() to iterate through next device
This design is inherently wrong. As explained multiple times before, probing for all possible devices just costs a lot of resources (boot time, memory) for no good. U-Boot uses lazy initialization - only when a device is really accessed, it will be initialized.
This is the way it has been designed so far, and I see no reason to change this design principle. If there are drivers where this does not work for some reason, then these drivers shall be fixed / improved.
There would be config option to choose probe all devices or not
Can you please explain which use case you see where the blind initialization of all devices would be needed, no matter if they are used at all or not? I cannot think of any such case.
And we have plenty example of "commercial" boot loaders which spend some 20+ seconds just to enumerate all devices on all available USB busses even if USB is not used at all for booting. This is NOT the way to go!
Let me know your time if I can schedule skype session for further discussion
Please understand that U-Boot discussionis taking place here on the mailing list. We do not use skype at all.
Thanks!
Wolfgang Denk

Hi Vabhav,
On 2 November 2018 at 02:28, Vabhav Sharma vabhav.sharma@nxp.com wrote:
Hello Maintainer/Owners,
Please provide your valuable input
Referring ‘[PATCH] drivers: serial: probe all serial devices’ email regarding unified way to probe device during boot using DM model
I would like to take this thread forward and request your time to help identify the design framework
In dm_init(),
Identify the class of devices to be probed Call dm_set_uclass_autoprobe(enum uclass_id, bool)
In core file on every device class
uclass_next_device() to iterate through next device
There would be config option to choose probe all devices or not
Let me know your time if I can schedule skype session for further discussion
I think here you are referring to things like PCI, where we must probe the buses to discover devices that would otherwise not even be visible, and that could not be used or even probed? E.g. some x86 boards need PCI even just to get a serial UART.
I think PCI is the main example I can think of. But there might be other buses on some systems which are known to hold core devices.
As Wolfgang says, this is not something we should enable by default, or use for all uclasses. But some boards / archs do need this, I think. For example see this line:
arch/x86/cpu/ivybridge/cpu.c: ret = uclass_get_device(UCLASS_PCI, 0, &bus);
This probes PCI so that other devices become visible. We could use your feature instead, and in fact enable it for all x86 boards.
So I think the function you describe seems reasonable. It could be called in the board_init() function perhaps? If you add it, please do add documentation too.
[...]
Regards, Simon
participants (3)
-
Simon Glass
-
Vabhav Sharma
-
Wolfgang Denk