aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierre-Clément Tosi <ptosi@google.com>2022-07-05 14:58:46 +0100
committerPierre-Clément Tosi <ptosi@google.com>2022-07-06 08:54:10 +0000
commit68d130d44870f92cff60c7c8301f61086cae0930 (patch)
treeefe2cec8898021ecb30abb4b0948cc3b79d9cf2c
parent832bb389d82404285933a97cbf79d0080a3645d4 (diff)
downloadu-boot-68d130d44870f92cff60c7c8301f61086cae0930.tar.gz
ANDROID: pvmfw: Remove devices during cleanup
Specialize clean_before_linux() to actually ->remove() loaded device drivers before executing the payload. This is necessary in pvmfw to ensure that pages that were allocated and shared back with the host for the virtio virtqueue (see vring_create_virtqueue()) were properly unshared. Bug: 238163879 Change-Id: I36392d195408ea84267c7f483f749d7dead31be7 Signed-off-by: Pierre-Clément Tosi <ptosi@google.com> (cherry picked from commit c6825fafb6c43a6dec140de4b9fba631b163cae9)
-rw-r--r--board/android/pvmfw-arm64/pvmfw-arm64.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/board/android/pvmfw-arm64/pvmfw-arm64.c b/board/android/pvmfw-arm64/pvmfw-arm64.c
index 8be21ef1a5..4978bd1571 100644
--- a/board/android/pvmfw-arm64/pvmfw-arm64.c
+++ b/board/android/pvmfw-arm64/pvmfw-arm64.c
@@ -8,6 +8,7 @@
#include <common.h>
#include <cpu_func.h>
#include <dm.h>
+#include <dm/root.h>
#include <env.h>
#include <fdtdec.h>
#include <init.h>
@@ -77,6 +78,21 @@ static void *locate_bcc(size_t *size)
return (void *)ALIGN((uintptr_t)_end - gd->reloc_off, PAGE_SIZE);
}
+void board_cleanup_before_linux(void)
+{
+ /*
+ * The DM needs instantiated device drivers to be removed before the
+ * payload is executed for features such as DM_FLAG_ACTIVE_DMA and
+ * DM_FLAG_OS_PREPARE to work as expected.
+ *
+ * This is typically handled by the 'bootm' command (and friends) but
+ * those are made unavailable by pvmfw as it provides a fixed boot path
+ * and removes support for CLI. Therefore, it is necessary to manually
+ * handle it in cleanup_before_linux().
+ */
+ dm_remove_devices_flags(DM_REMOVE_ACTIVE_ALL);
+}
+
int board_run_command(const char *cmdline)
{
int err;