Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/nvme.c
Original file line number Diff line number Diff line change
Expand Up @@ -861,6 +861,15 @@ void nvme_ensure_shutdown(void)
nvme_asc = NULL;
}

/*
* Post-M4: this stage hasn't used NVMe and no earlier stage passed SART entries, so ANS is as an
* earlier stage left it. An older Stage 1 (nvme.adopt) leaves it running.
*/
bool nvme_post_m4_untouched(void)
{
return !nvme_initialized && !nvme_sart_saved_cnt && nvme_post_m4();
}

bool nvme_shutdown(void)
{
if (nvme_reboot_required) {
Expand Down
1 change: 1 addition & 0 deletions src/nvme.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ extern bool nvme_keep_running_for_linux;
bool nvme_shutdown(void);
/* Post-M4: how a stage that powered ANS off tells the next one to start it again. */
bool nvme_post_m4(void);
bool nvme_post_m4_untouched(void);
int nvme_sart_entries(struct sart_entry *entries, int max, bool *off);
char *nvme_sart_var(void);
bool nvme_set_sart_var(const char *val);
Expand Down
8 changes: 8 additions & 0 deletions src/payload.c
Original file line number Diff line number Diff line change
Expand Up @@ -527,6 +527,14 @@ int payload_run(void)
* link back up, and kboot_prepare_dt() passes the SART entries on.
*/
nvme_keep_running_for_linux = boot_spec != NULL;
/*
* T8132: an older Stage 1 (nvme.adopt) passes ANS on running, with no SART entries. If
* this stage hasn't used NVMe, nvme_shutdown() has nothing to power off and the payload
* would get that live session. Take it over first, so nvme_shutdown() powers ANS off and
* kboot_prepare_dt() passes the entries the payload needs to start it.
*/
if (!boot_spec && chip_id == T8132 && nvme_post_m4_untouched() && !nvme_init())
goto boot_failed;
if (!boot_spec && !nvme_shutdown())
goto boot_failed;
cpufreq_init();
Expand Down
2 changes: 2 additions & 0 deletions tests/python/test_m3_defaults_optout.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,8 @@ def harness():
static bool smp_is_alive(int cpu) { return false; }
static int smp_call_sync0(int cpu, void (*fn)(void)) { return 0; }
static void do_enable_tso(void) {}
static bool nvme_init(void) { return true; }
static bool nvme_post_m4_untouched(void) { return false; }
static bool nvme_shutdown(void) { return true; }
static bool nvme_keep_running_for_linux;
static bool nvme_set_sart_var(const char *v) { return true; }
Expand Down
Loading