mtl: soc: TLB driver provides required size of L3 storage buffer

TLB driver knows the required number of bytes for HPSRAM
storage during power off state.

Signed-off-by: Marcin Szkudlinski <marcin.szkudlinski@intel.com>
This commit is contained in:
Marcin Szkudlinski 2022-10-25 10:02:12 +02:00 committed by Anas Nashif
commit 84c09433b5
2 changed files with 20 additions and 1 deletions

View file

@ -817,8 +817,20 @@ __imr void adsp_mm_restore_context(void *storage_buffer)
/* HPSRAM memory is restored */ /* HPSRAM memory is restored */
} }
static uint32_t adsp_mm_get_storage_size(void)
{
/*
* FIXME - currently the function returns a maximum possible size of the buffer
* as L3 memory is generally a huge area its OK (and fast)
* in future the function may go through the mapping and calculate a required size
*/
return L2_SRAM_SIZE + TLB_SIZE + (L2_SRAM_PAGES_NUM * sizeof(void *))
+ sizeof(void *);
}
static const struct intel_adsp_tlb_api adsp_tlb_api_func = { static const struct intel_adsp_tlb_api adsp_tlb_api_func = {
.save_context = adsp_mm_save_context .save_context = adsp_mm_save_context,
.get_storage_size = adsp_mm_get_storage_size
}; };
DEVICE_DT_DEFINE(DT_INST(0, intel_adsp_mtl_tlb), DEVICE_DT_DEFINE(DT_INST(0, intel_adsp_mtl_tlb),

View file

@ -26,6 +26,12 @@
*/ */
typedef void (*mm_save_context)(void *storage_buffer); typedef void (*mm_save_context)(void *storage_buffer);
/*
* This function will return a required size of storage buffer needed to perform context save
*
*/
typedef uint32_t (*mm_get_storage_size)(void);
/* /*
* This function will restore the contents and power state of the physical memory banks * This function will restore the contents and power state of the physical memory banks
* and recreate physical to virtual mappings * and recreate physical to virtual mappings
@ -40,6 +46,7 @@ void adsp_mm_restore_context(void *storage_buffer);
struct intel_adsp_tlb_api { struct intel_adsp_tlb_api {
mm_save_context save_context; mm_save_context save_context;
mm_get_storage_size get_storage_size;
}; };
#endif /* ZEPHYR_INCLUDE_DRIVERS_INTEL_ADSP_MTL_TLB */ #endif /* ZEPHYR_INCLUDE_DRIVERS_INTEL_ADSP_MTL_TLB */