zephyr
zephyr copied to clipboard
mtl: drv: add HPSRAM memory save/restore to an external buffer
This PR adds a power flows to Intel MTL TLB driver It allows the driver to save the whole Translation Table as well as contents of memory banks to a designated address It is designed for memory content retention in an persistent storage during low power state
@andyross yes and no. The code is to be called at the very last moment before the device is switched off. All devices - including memory management, should be turned off at the moment. Even worse when restoring the memory - nothing is started yet, memory manager code may not be loaded. So I want to avoid any unnecessary calls, dependencies etc. and put the save/restore routines in the tlb driver.
Another reason - I really don't care for virtual memory mapping when saving the memory contents - all I need is save all used physical memory banks. The knowledge about usage of physical banks is locked in a TLB driver and only there.
@marcinszkudlinski @tmleman @dcpleung Ping? This seems to be ready to progress, but needs a rebases and rereview from you.
Please rebase first.
some additional changes are coming soon.
@marcinszkudlinski working on an update. Changing status to draft
D3 power flow for ACE soc added. Please review again
Last (I hope...) version. Changes since last review:
- compilation fixes
- cleaner and little bit updates definitions in adsp_memory.h
@ceolin can you please take a look?
Minor comment, other than that looks good.
Done, here we go again with (re) approvals...
The PR was approved previously couple of times. Please go ahead and merge it
commit c929bbcc58c545 fails like this:
sof/src/platform/intel/ace/lib/pm_runtime.c
In file included from zephyr/soc/xtensa/intel_adsp/ace/include/intel_ace15_mtpm/ace_v1x-regs.h:11,
from sof/src/platform/intel/ace/lib/pm_runtime.c:12:
zephyr/soc/xtensa/intel_adsp/ace/include/intel_ace15_mtpm/adsp_memory.h:43: error: "IMR_BOOT_LDR_MANIFEST_BASE" redefined [-Werror]
43 | #define IMR_BOOT_LDR_MANIFEST_BASE (L3_MEM_BASE_ADDR + IMR_BOOT_LDR_MANIFEST_OFFSET)
|
In file included from sof/zephyr/../src/../xtos/include/sof/lib/memory.h:11,
from sof/zephyr/../src/include/sof/sof.h:13,
from sof/zephyr/../src/../xtos/include/sof/lib/pm_runtime.h:19,
from sof/src/platform/intel/ace/lib/pm_runtime.c:5:
sof/zephyr/../src/platform/meteorlake/include/platform/lib/memory.h:52: note: this is the location of the previous definition
52 | #define IMR_BOOT_LDR_MANIFEST_BASE 0xA1042000
|
cc1: all warnings being treated as errors
Commit 84c09433b574 fails like this: https://github.com/thesofproject/sof/actions/runs/3519164758/jobs/5898821976
In file included from zephyr/soc/xtensa/intel_adsp/common/include/cpu_init.h:9,
from zephyr/soc/xtensa/intel_adsp/ace/power.c:9:
zephyr/soc/xtensa/intel_adsp/ace/power.c: In function 'pm_state_set':
zephyr/soc/xtensa/intel_adsp/ace/include/intel_ace15_mtpm/adsp_memory.h:18:22: error: passing argument 2 of 'memcpy' makes pointer from integer without a cast [-Werror=int-conversion]
18 | #define LP_SRAM_BASE (DT_REG_ADDR(DT_NODELABEL(sram1)))
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| |
| long long int
zephyr/soc/xtensa/intel_adsp/ace/power.c:236:56: note: in expansion of macro 'LP_SRAM_BASE'
236 | memcpy(global_imr_ram_storage, LP_SRAM_BASE, LP_SRAM_SIZE);
| ^~~~~~~~~~~~
In file included from zephyr/soc/xtensa/intel_adsp/common/include/soc.h:9,
from zephyr/include/zephyr/arch/xtensa/irq.h:60,
from zephyr/include/zephyr/arch/xtensa/arch.h:27,
from zephyr/include/zephyr/arch/cpu.h:27,
from zephyr/include/zephyr/kernel_includes.h:33,
from zephyr/include/zephyr/kernel.h:17,
from zephyr/soc/xtensa/intel_adsp/ace/power.c:6:
zephyr/lib/libc/minimal/include/string.h:42:63: note: expected 'const void * restrict' but argument is of type 'long long int'
42 | extern void *memcpy(void *ZRESTRICT d, const void *ZRESTRICT s,
| ~~~~~~~~~~~~~~~~~~~~~~^
zephyr/soc/xtensa/intel_adsp/ace/power.c: At top level:
zephyr/soc/xtensa/intel_adsp/ace/power.c:168:9: error: '_restore_core_context' is static but used in inline function 'power_off_exit' which is not static [-Werror]
168 | _restore_core_context();
| ^~~~~~~~~~~~~~~~~~~~~
zephyr/soc/xtensa/intel_adsp/ace/power.c: In function 'pm_state_imr_restore':
zephyr/soc/xtensa/intel_adsp/ace/power.c:198:1: error: 'noreturn' function does return [-Werror]
198 | }
| ^
cc1: all warnings being treated as errors
Just found https://github.com/thesofproject/sof/pull/6613, looks like a mutual dependency. Thank @marcinszkudlinski for linking the two.
EDIT: actually there's a fix submitted in #52477