Message ID | 1400966481-14131-6-git-send-email-sjg@chromium.org |
---|---|
State | RFC |
Headers | show |
On Sat, May 24, 2014 at 4:21 PM, Simon Glass <sjg@chromium.org> wrote: > Drivers are supposed to be able to close down cleanly. To set a good example, > make sandbox shut down its driver model drivers and remove them before exit. Right. But we should be careful here... > It may be desirable to do the same more generally once driver model is more > widely-used. This could be done during bootm, before U-Boot jumps to the OS. > It seems far too early to make this change. Some drivers should probably NOT be shut down prior to bootm handing off to some other OS. It could be that their sole purpose for starting and running was to enable some continued driver state for the OS. I'm thinking of some clock, or PHY or maybe some aspect of the ARM SCU that should be "left running". So maybe if there is a general "shutdown" pass, there might be a need for a flag to indicate that it is/isn't OK to do so at OS-hand-off time. jdl
Hi Jon, On 27 May 2014 09:28, Jon Loeliger <loeliger@gmail.com> wrote: > On Sat, May 24, 2014 at 4:21 PM, Simon Glass <sjg@chromium.org> wrote: >> Drivers are supposed to be able to close down cleanly. To set a good example, >> make sandbox shut down its driver model drivers and remove them before exit. > > Right. But we should be careful here... > >> It may be desirable to do the same more generally once driver model is more >> widely-used. This could be done during bootm, before U-Boot jumps to the OS. >> It seems far too early to make this change. > > Some drivers should probably NOT be shut down prior to bootm handing > off to some other OS. It could be that their sole purpose for starting and > running was to enable some continued driver state for the OS. > > I'm thinking of some clock, or PHY or maybe some aspect of the ARM SCU > that should be "left running". > > So maybe if there is a general "shutdown" pass, there might be a need for > a flag to indicate that it is/isn't OK to do so at OS-hand-off time. Yes agreed. I think we can cross that bridge when we come to it though. So long as the drivers have a way of shutting down then we have at least encouraged driver authors to think about this issue. My concern was that in U-Boot people might think that the remove() method is a waste of time. Regards, Simon
diff --git a/arch/sandbox/cpu/cpu.c b/arch/sandbox/cpu/cpu.c index 3f4005b..1aa397c 100644 --- a/arch/sandbox/cpu/cpu.c +++ b/arch/sandbox/cpu/cpu.c @@ -4,6 +4,7 @@ */ #include <common.h> +#include <dm/root.h> #include <os.h> #include <asm/state.h> @@ -14,6 +15,9 @@ void reset_cpu(ulong ignored) if (state_uninit()) os_exit(2); + if (dm_uninit()) + os_exit(2); + /* This is considered normal termination for now */ os_exit(0); }
Drivers are supposed to be able to close down cleanly. To set a good example, make sandbox shut down its driver model drivers and remove them before exit. It may be desirable to do the same more generally once driver model is more widely-used. This could be done during bootm, before U-Boot jumps to the OS. It seems far too early to make this change. Signed-off-by: Simon Glass <sjg@chromium.org> --- arch/sandbox/cpu/cpu.c | 4 ++++ 1 file changed, 4 insertions(+)