From 198c718f4d589bda9bf9c1343c5561aeca1a7d53 Mon Sep 17 00:00:00 2001 From: Kai Vehmanen Date: Tue, 12 Nov 2024 10:44:27 +0200 Subject: [PATCH 1/3] zephyr: lib/cpu.h: remove dependency to platform layer Remove dependency to platform cpu.h layer for Zephyr targets. The lib/cpu.h is now common to all SOF targets when building for Zephyr. Add a note to PLATFORM_PRIMARY_CORE_ID documentation that "primary core" is a SOF/application convention and not visible in Zephyr OS interfaces. Core 0 is the boot core in Zephyr, so use this definition as PLATFORM_PRIMARY_CORE_ID for all SOF targets. This was already the case in all platform definitions, so no functional change. In SOF, the primary/secondary distinction is primarily used in IPC code, together with Zephyr CONFIG_SMP_BOOT_DELAY=y. Signed-off-by: Kai Vehmanen --- zephyr/include/sof/lib/cpu.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/zephyr/include/sof/lib/cpu.h b/zephyr/include/sof/lib/cpu.h index 349ad2af15d2..c23405e85121 100644 --- a/zephyr/include/sof/lib/cpu.h +++ b/zephyr/include/sof/lib/cpu.h @@ -14,7 +14,15 @@ #ifndef __SOF_LIB_CPU_H__ #define __SOF_LIB_CPU_H__ -#include +/** + * \brief Id of primary DSP core + * + * SOF IPC protocols make a distinction between primary + * and secondary cores. In Zephyr, primary core id concept + * is not present in public OS interface, but in implementation + * zero is the boot core (see z_smp_init() in Zephyr). + */ +#define PLATFORM_PRIMARY_CORE_ID 0 #if !defined(__ASSEMBLER__) && !defined(LINKER) From 634bd11984b8949e5a95aa568aa5c25ad89fb1f3 Mon Sep 17 00:00:00 2001 From: Kai Vehmanen Date: Tue, 12 Nov 2024 11:09:53 +0200 Subject: [PATCH 2/3] platform: Intel: remove lib/cpu.h cpu.h definition is no longer needed in platform definitions for SOF Zephyr builds. Remove for all Intel targets. Signed-off-by: Kai Vehmanen --- src/platform/ace30/include/platform/lib/cpu.h | 24 ----------------- src/platform/intel/ace/include/ace/lib/cpu.h | 25 ----------------- .../intel/cavs/include/cavs/lib/cpu.h | 27 ------------------- .../lunarlake/include/platform/lib/cpu.h | 24 ----------------- .../meteorlake/include/platform/lib/cpu.h | 24 ----------------- .../tigerlake/include/platform/lib/cpu.h | 26 ------------------ 6 files changed, 150 deletions(-) delete mode 100644 src/platform/ace30/include/platform/lib/cpu.h delete mode 100644 src/platform/intel/ace/include/ace/lib/cpu.h delete mode 100644 src/platform/intel/cavs/include/cavs/lib/cpu.h delete mode 100644 src/platform/lunarlake/include/platform/lib/cpu.h delete mode 100644 src/platform/meteorlake/include/platform/lib/cpu.h delete mode 100644 src/platform/tigerlake/include/platform/lib/cpu.h diff --git a/src/platform/ace30/include/platform/lib/cpu.h b/src/platform/ace30/include/platform/lib/cpu.h deleted file mode 100644 index 19590911ea99..000000000000 --- a/src/platform/ace30/include/platform/lib/cpu.h +++ /dev/null @@ -1,24 +0,0 @@ -/* SPDX-License-Identifier: BSD-3-Clause - * - * Copyright(c) 2022-2024 Intel Corporation. - */ - -/** - * \file - * \brief DSP core parameters. - */ - -#ifdef __SOF_LIB_CPU_H__ - -#ifndef __PLATFORM_LIB_CPU_H__ -#define __PLATFORM_LIB_CPU_H__ - -#include - -#endif /* __PLATFORM_LIB_CPU_H__ */ - -#else - -#error "This file shouldn't be included from outside of sof/lib/cpu.h" - -#endif /* __SOF_LIB_CPU_H__ */ diff --git a/src/platform/intel/ace/include/ace/lib/cpu.h b/src/platform/intel/ace/include/ace/lib/cpu.h deleted file mode 100644 index b4d0b88f112f..000000000000 --- a/src/platform/intel/ace/include/ace/lib/cpu.h +++ /dev/null @@ -1,25 +0,0 @@ -/* SPDX-License-Identifier: BSD-3-Clause - * - * Copyright(c) 2022 Intel Corporation. All rights reserved. - */ - -/** - * \file ace/lib/cpu.h - * \brief DSP parameters, common for cAVS platforms. - */ - -#ifdef __PLATFORM_LIB_CPU_H__ - -#ifndef __ACE_LIB_CPU_H__ -#define __ACE_LIB_CPU_H__ - -/** \brief Id of primary DSP core */ -#define PLATFORM_PRIMARY_CORE_ID 0 - -#endif /* __ACE_LIB_CPU_H__ */ - -#else - -#error "This file shouldn't be included from outside of platform/lib/cpu.h" - -#endif /* __PLATFORM_LIB_CPU_H__ */ diff --git a/src/platform/intel/cavs/include/cavs/lib/cpu.h b/src/platform/intel/cavs/include/cavs/lib/cpu.h deleted file mode 100644 index 6adf613271d0..000000000000 --- a/src/platform/intel/cavs/include/cavs/lib/cpu.h +++ /dev/null @@ -1,27 +0,0 @@ -/* SPDX-License-Identifier: BSD-3-Clause - * - * Copyright(c) 2019 Intel Corporation. All rights reserved. - * - * Author: Bartosz Kokoszko - */ - -/** - * \file cavs/lib/cpu.h - * \brief DSP parameters, common for cAVS platforms. - */ - -#ifdef __PLATFORM_LIB_CPU_H__ - -#ifndef __CAVS_LIB_CPU_H__ -#define __CAVS_LIB_CPU_H__ - -/** \brief Id of primary DSP core */ -#define PLATFORM_PRIMARY_CORE_ID 0 - -#endif /* __CAVS_LIB_CPU_H__ */ - -#else - -#error "This file shouldn't be included from outside of platform/lib/cpu.h" - -#endif /* __PLATFORM_LIB_CPU_H__ */ diff --git a/src/platform/lunarlake/include/platform/lib/cpu.h b/src/platform/lunarlake/include/platform/lib/cpu.h deleted file mode 100644 index 5abe9a99d57e..000000000000 --- a/src/platform/lunarlake/include/platform/lib/cpu.h +++ /dev/null @@ -1,24 +0,0 @@ -/* SPDX-License-Identifier: BSD-3-Clause - * - * Copyright(c) 2023 Intel Corporation. All rights reserved. - */ - -/** - * \file - * \brief DSP core parameters. - */ - -#ifdef __SOF_LIB_CPU_H__ - -#ifndef __PLATFORM_LIB_CPU_H__ -#define __PLATFORM_LIB_CPU_H__ - -#include - -#endif /* __PLATFORM_LIB_CPU_H__ */ - -#else - -#error "This file shouldn't be included from outside of sof/lib/cpu.h" - -#endif /* __SOF_LIB_CPU_H__ */ diff --git a/src/platform/meteorlake/include/platform/lib/cpu.h b/src/platform/meteorlake/include/platform/lib/cpu.h deleted file mode 100644 index 989fb61bf093..000000000000 --- a/src/platform/meteorlake/include/platform/lib/cpu.h +++ /dev/null @@ -1,24 +0,0 @@ -/* SPDX-License-Identifier: BSD-3-Clause - * - * Copyright(c) 2022 Intel Corporation. All rights reserved. - */ - -/** - * \file - * \brief DSP core parameters. - */ - -#ifdef __SOF_LIB_CPU_H__ - -#ifndef __PLATFORM_LIB_CPU_H__ -#define __PLATFORM_LIB_CPU_H__ - -#include - -#endif /* __PLATFORM_LIB_CPU_H__ */ - -#else - -#error "This file shouldn't be included from outside of sof/lib/cpu.h" - -#endif /* __SOF_LIB_CPU_H__ */ diff --git a/src/platform/tigerlake/include/platform/lib/cpu.h b/src/platform/tigerlake/include/platform/lib/cpu.h deleted file mode 100644 index 8cd110966e66..000000000000 --- a/src/platform/tigerlake/include/platform/lib/cpu.h +++ /dev/null @@ -1,26 +0,0 @@ -/* SPDX-License-Identifier: BSD-3-Clause - * - * Copyright(c) 2019 Intel Corporation. All rights reserved. - * - * Author: Tomasz Lauda - */ - -/** - * \file - * \brief DSP core parameters. - */ - -#ifdef __SOF_LIB_CPU_H__ - -#ifndef __PLATFORM_LIB_CPU_H__ -#define __PLATFORM_LIB_CPU_H__ - -#include - -#endif /* __PLATFORM_LIB_CPU_H__ */ - -#else - -#error "This file shouldn't be included from outside of sof/lib/cpu.h" - -#endif /* __SOF_LIB_CPU_H__ */ From b7598de57d66548f3291957722be1f8954ac9f9a Mon Sep 17 00:00:00 2001 From: Kai Vehmanen Date: Tue, 12 Nov 2024 11:26:24 +0200 Subject: [PATCH 3/3] platform: imx93_a55/imx95: remove lib/cpu.h Platform cpu.h no longer needed in Zephyr builds, so remove these files as obsolete. Signed-off-by: Kai Vehmanen --- .../imx93_a55/include/platform/lib/cpu.h | 23 ------------------- src/platform/imx95/include/platform/lib/cpu.h | 19 --------------- 2 files changed, 42 deletions(-) delete mode 100644 src/platform/imx93_a55/include/platform/lib/cpu.h delete mode 100644 src/platform/imx95/include/platform/lib/cpu.h diff --git a/src/platform/imx93_a55/include/platform/lib/cpu.h b/src/platform/imx93_a55/include/platform/lib/cpu.h deleted file mode 100644 index 7a92a59b574f..000000000000 --- a/src/platform/imx93_a55/include/platform/lib/cpu.h +++ /dev/null @@ -1,23 +0,0 @@ -/* SPDX-License-Identifier: BSD-3-Clause - * - * Copyright 2023 NXP - */ - -#ifdef __SOF_LIB_CPU_H__ - -#ifndef __PLATFORM_LIB_CPU_H__ -#define __PLATFORM_LIB_CPU_H__ - -/* note: although the core assigned to the inmate - * might not have the ID = 0 according to Linux, - * Zephyr will still index its cores starting from 0. - */ -#define PLATFORM_PRIMARY_CORE_ID 0 - -#endif /* __PLATFORM_LIB_CPU_H__ */ - -#else - -#error "This file shouldn't be included from outside of sof/lib/cpu.h" - -#endif /* __SOF_LIB_CPU_H__ */ diff --git a/src/platform/imx95/include/platform/lib/cpu.h b/src/platform/imx95/include/platform/lib/cpu.h deleted file mode 100644 index 54fd25cf4b37..000000000000 --- a/src/platform/imx95/include/platform/lib/cpu.h +++ /dev/null @@ -1,19 +0,0 @@ -/* SPDX-License-Identifier: BSD-3-Clause - * - * Copyright 2024 NXP - */ - -#ifdef __SOF_LIB_CPU_H__ - -#ifndef __PLATFORM_LIB_CPU_H__ -#define __PLATFORM_LIB_CPU_H__ - -#define PLATFORM_PRIMARY_CORE_ID 0 - -#endif /* __PLATFORM_LIB_CPU_H__ */ - -#else - -#error "This file shouldn't be included from outside of sof/lib/cpu.h" - -#endif /* __SOF_LIB_CPU_H__ */