Skip to content

Commit ca12fd1

Browse files
lyakhcarlescufi
authored andcommitted
xtensa: intel_adsp: fix a cache handling error
.bss and .data are uncached in Zephyr builds for intel_adsp. No need to try to manipulate cache of objects in those sections. Signed-off-by: Guennadi Liakhovetski <[email protected]>
1 parent 75c2aeb commit ca12fd1

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

drivers/power_domain/power_domain_intel_adsp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ static int pd_intel_adsp_set_power_enable(struct pg_bits *bits, bool power_enabl
3939
extern uint32_t g_key_read_holder;
4040

4141
if (bits->SPA_bit == INTEL_ADSP_HST_DOMAIN_BIT) {
42-
volatile uint32_t *key_read_ptr = z_soc_uncached_ptr(&g_key_read_holder);
42+
volatile uint32_t *key_read_ptr = &g_key_read_holder;
4343
uint32_t key_value = *key_read_ptr;
4444

4545
if (key_value != INTEL_ADSP_ACE15_MAGIC_KEY)

soc/xtensa/intel_adsp/ace/multiprocessing.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include <zephyr/kernel.h>
99
#include <zephyr/sys/check.h>
1010
#include <zephyr/arch/cpu.h>
11+
#include <zephyr/arch/xtensa/arch.h>
1112
#include <zephyr/pm/pm.h>
1213
#include <zephyr/pm/device_runtime.h>
1314

@@ -27,8 +28,8 @@
2728
#define ACE_INTC_IRQ DT_IRQN(DT_NODELABEL(ace_intc))
2829

2930
#if CONFIG_ACE_VERSION_1_5
30-
__aligned(CONFIG_DCACHE_LINE_SIZE) uint32_t g_key_read_holder;
31-
__aligned(CONFIG_DCACHE_LINE_SIZE) unsigned int alignment_dummy[0];
31+
/* .bss is uncached, we further check it below */
32+
uint32_t g_key_read_holder;
3233
#endif /* CONFIG_ACE_VERSION_1_5 */
3334

3435
static void ipc_isr(void *arg)
@@ -93,8 +94,9 @@ void soc_mp_init(void)
9394
/* Set the core 0 active */
9495
soc_cpus_active[0] = true;
9596
#if CONFIG_ACE_VERSION_1_5
97+
__ASSERT(!arch_xtensa_is_ptr_cached(&g_key_read_holder),
98+
"g_key_read_holder must be uncached");
9699
g_key_read_holder = INTEL_ADSP_ACE15_MAGIC_KEY;
97-
sys_cache_data_flush_range(&g_key_read_holder, sizeof(g_key_read_holder));
98100
#endif /* CONFIG_ACE_VERSION_1_5 */
99101
}
100102

0 commit comments

Comments
 (0)