BACKPORT: x86: add cache-as-ram migration option
There are some boards that do a significant amount of work after cache-as-ram is torn down but before ramstage is loaded. For example, using vboot to verify the ramstage is one such operation. However, there are pieces of code that are executed that reference global variables that are linked in the cache-as-ram region. If those variables are referenced after cache-as-ram is torn down then the values observed will most likely be incorrect. Therefore provide a Kconfig option to select cache-as-ram migration to memory using cbmem. This option is named CAR_MIGRATION. When enabled, the address of cache-as-ram variables may be obtained dynamically. Additionally, when cache-as-ram migration occurs the cache-as-ram data region for global variables is copied into cbmem. There are also automatic callbacks for other modules to perform their own migration, if necessary. BUG=chrome-os-partner:19342 BRANCH=none TEST=Built and booted. Noted that CAR values are not read incorrectly. Change-Id: Ie0104a6e24cc6430a575ee3691671900c36db0d9 Signed-off-by: Aaron Durbin <adurbin@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/51386 Reviewed-by: Stefan Reinauer <reinauer@google.com>
This commit is contained in:
parent
3593f8f1ef
commit
2e9e50142f
10 changed files with 168 additions and 0 deletions
|
|
@ -22,6 +22,7 @@
|
|||
#include <bootstate.h>
|
||||
#include <cbmem.h>
|
||||
#include <console/console.h>
|
||||
#include <cpu/x86/car.h>
|
||||
#if CONFIG_HAVE_ACPI_RESUME && !defined(__PRE_RAM__)
|
||||
#include <arch/acpi.h>
|
||||
#endif
|
||||
|
|
@ -228,6 +229,9 @@ int cbmem_initialize(void)
|
|||
#ifndef __PRE_RAM__
|
||||
cbmem_arch_init();
|
||||
#endif
|
||||
/* Migrate cache-as-ram variables. */
|
||||
car_migrate_variables();
|
||||
|
||||
return rv;
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@ static struct cbmem_id_to_name {
|
|||
{ CBMEM_ID_RAMSTAGE_CACHE, "RAMSTAGE $ " },
|
||||
{ CBMEM_ID_ROOT, "CBMEM ROOT " },
|
||||
{ CBMEM_ID_VBOOT_HANDOFF, "VBOOT " },
|
||||
{ CBMEM_ID_CAR_GLOBALS, "CAR GLOBALS" },
|
||||
};
|
||||
|
||||
void cbmem_print_entry(int n, u32 id, u64 base, u64 size)
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@
|
|||
#include <cbmem.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <cpu/x86/car.h>
|
||||
#if CONFIG_HAVE_ACPI_RESUME && !defined(__PRE_RAM__)
|
||||
#include <arch/acpi.h>
|
||||
#endif
|
||||
|
|
@ -182,12 +183,17 @@ void cbmem_initialize_empty(void)
|
|||
root, root->max_entries);
|
||||
|
||||
cbmem_arch_init();
|
||||
|
||||
/* Migrate cache-as-ram variables. */
|
||||
car_migrate_variables();
|
||||
}
|
||||
|
||||
static inline int cbmem_fail_recovery(void)
|
||||
{
|
||||
cbmem_initialize_empty();
|
||||
cbmem_handle_acpi_resume();
|
||||
/* Migrate cache-as-ram variables. */
|
||||
car_migrate_variables();
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
@ -256,6 +262,9 @@ int cbmem_initialize(void)
|
|||
|
||||
cbmem_arch_init();
|
||||
|
||||
/* Migrate cache-as-ram variables. */
|
||||
car_migrate_variables();
|
||||
|
||||
/* Recovery successful. */
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue