Skip to content

Commit

Permalink
intel_adsp/ace: power: pad the hpsram_mask passed to power_down
Browse files Browse the repository at this point in the history
The power_down() function will lock dcache for the hpsram_mask
array. On some platforms, the dcache lock will fail if the array
is on cache line that can be used for window register context
saves.

Work around this by aligning and padding the hpsram_mask to cacheline
size.

(cherry picked from commit 2fcdbba)

Original-Link: thesofproject/sof#9268
Original-Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
GitOrigin-RevId: 2fcdbba
Cr-Build-Id: 8740088176811114337
Cr-Build-Url: https://cr-buildbucket.appspot.com/build/8740088176811114337
Copybot-Job-Name: zephyr-main-copybot-downstream
Change-Id: Ia4459bc8d6bbea78f2d1e4a4601d0396b2f3b7ef
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/zephyr/+/5776799
Tested-by: ChromeOS Prod (Robot) <chromeos-ci-prod@chromeos-bot.iam.gserviceaccount.com>
Commit-Queue: Jeremy Bettis <jbettis@chromium.org>
Tested-by: Jeremy Bettis <jbettis@chromium.org>
Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
  • Loading branch information
kv2019i authored and Chromeos LUCI committed Aug 9, 2024
1 parent 2e2ccf6 commit 2678171
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions soc/intel/intel_adsp/ace/power.c
Original file line number Diff line number Diff line change
Expand Up @@ -340,18 +340,20 @@ void pm_state_set(enum pm_state state, uint8_t substate_id)
sys_cache_data_flush_range((void *)imr_layout, sizeof(*imr_layout));
#endif /* CONFIG_ADSP_IMR_CONTEXT_SAVE */
#ifdef CONFIG_ADSP_POWER_DOWN_HPSRAM
/* This assumes a single HPSRAM segment */
static uint32_t hpsram_mask;
const int dcache_words = XCHAL_DCACHE_LINESIZE / sizeof(uint32_t);
uint32_t hpsram_mask[dcache_words] __aligned(XCHAL_DCACHE_LINESIZE);

hpsram_mask[0] = 0;
/* turn off all HPSRAM banks - get a full bitmap */
uint32_t ebb_banks = ace_hpsram_get_bank_count();
hpsram_mask = (1 << ebb_banks) - 1;
hpsram_mask[0] = (1 << ebb_banks) - 1;
#define HPSRAM_MASK_ADDR sys_cache_cached_ptr_get(&hpsram_mask)
#else
#define HPSRAM_MASK_ADDR NULL
#endif /* CONFIG_ADSP_POWER_DOWN_HPSRAM */
/* do power down - this function won't return */
ret = pm_device_runtime_put(INTEL_ADSP_HST_DOMAIN_DEV);
__ASSERT_NO_MSG(ret == 0);
/* do power down - this function won't return */
power_down(true, HPSRAM_MASK_ADDR, true);
} else {
power_gate_entry(cpu);
Expand Down

0 comments on commit 2678171

Please sign in to comment.