efi: Call bootm_disable_interrupts earlier in efi_exit_boot_services
authorTom Rini <trini@konsulko.com>
Fri, 19 Nov 2021 21:33:04 +0000 (16:33 -0500)
committerHeinrich Schuchardt <heinrich.schuchardt@canonical.com>
Fri, 26 Nov 2021 20:30:59 +0000 (21:30 +0100)
commit3f73e79de83ecc78b9a9c823b8118ab1fba63b0a
treed3b80228bd654900749464871e8bac3ff5b1f10f
parent2ad8d0cb950da2233a2ec030533f4e54c6d04126
efi: Call bootm_disable_interrupts earlier in efi_exit_boot_services

If we look at the path that bootm/booti take when preparing to boot the
OS, we see that as part of (or prior to calling do_bootm_states,
explicitly) the process, bootm_disable_interrupts() is called prior to
announce_and_cleanup() which is where udc_disconnect() /
board_quiesce_devices() / dm_remove_devices_flags() are called from.  In
the EFI path, these are called afterwards.  In efi_exit_boot_services()
however we have been calling bootm_disable_interrupts() after the above
functions, as part of ensuring that we disable interrupts as required
by the spec.  However, bootm_disable_interrupts() is also where we go
and call usb_stop().  While this has been fine before, on the TI J721E
platform this leads us to an exception.  This exception seems likely to
be the case that we're trying to stop devices that we have already
disabled clocks for.  The most direct way to handle this particular
problem is to make EFI behave like the do_bootm_states() process and
ensure we call bootm_disable_interrupts() prior to ending up in
usb_stop().

Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
Cc: Simon Glass <sjg@chromium.org>
Suggested-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
lib/efi_loader/efi_boottime.c