1
0
mirror of https://git.yoctoproject.org/meta-arm synced 2026-05-07 04:58:57 +00:00

arm-bsp/scp-firmware: add patches related to MPMM for TC0

This commits updates the SHA of SCP-firmware and include required
patches to build SCP firmware with experimental features
MPMM/POWER/PERFORMANCE for TC0 platform.

Signed-off-by: Arunachalam Ganapathy <arunachalam.ganapathy@arm.com>
Change-Id: I263b484a467636154b70805f920bb53c6fe2026c
Signed-off-by: Jon Mason <jon.mason@arm.com>
This commit is contained in:
Arunachalam Ganapathy
2022-02-23 17:12:51 +00:00
committed by Jon Mason
parent 3c16dbc0c6
commit 185746b66a
5 changed files with 487 additions and 1 deletions
@@ -0,0 +1,65 @@
From 33a2173e13453ecc4f766f0e69302524401df1b0 Mon Sep 17 00:00:00 2001
From: Arunachalam Ganapathy <arunachalam.ganapathy@arm.com>
Date: Mon, 14 Feb 2022 08:28:46 +0000
Subject: [PATCH 1/4] tc0: fix sensor data api call
Signed-off-by: Arunachalam Ganapathy <arunachalam.ganapathy@arm.com>
Change-Id: I827abeeac8317e4dd466cc0c4d493cdc90e7e39d
Upstream-Status: Pending [Not submitted to upstream yet]
---
module/thermal_mgmt/src/mod_thermal_mgmt.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/module/thermal_mgmt/src/mod_thermal_mgmt.c b/module/thermal_mgmt/src/mod_thermal_mgmt.c
index dbd45c74..6e2ff5ba 100644
--- a/module/thermal_mgmt/src/mod_thermal_mgmt.c
+++ b/module/thermal_mgmt/src/mod_thermal_mgmt.c
@@ -20,7 +20,7 @@
#include <fwk_mm.h>
#include <fwk_module.h>
#include <fwk_status.h>
-#include <fwk_thread.h>
+#include <fwk_core.h>
#include <stdint.h>
#include <stdlib.h>
@@ -372,7 +372,7 @@ static int read_temperature(void)
.id = mod_thermal_event_id_read_temp,
};
- return fwk_thread_put_event(&event);
+ return fwk_put_event(&event);
#else
int status;
uint64_t value;
@@ -574,22 +574,22 @@ static int thermal_mgmt_process_event(
struct fwk_event *resp_event)
{
struct mod_sensor_event_params *params;
- uint64_t value;
+ struct mod_sensor_data ms_data;
int status;
if (fwk_id_is_equal(event->id, mod_thermal_event_id_read_temp)) {
/* Temperature-reading event */
status =
- mod_ctx.sensor_api->get_value(mod_ctx.config->sensor_id, &value);
+ mod_ctx.sensor_api->get_data(mod_ctx.config->sensor_id, &ms_data);
if (status == FWK_SUCCESS) {
- mod_ctx.cur_temp = (uint32_t)value;
+ mod_ctx.cur_temp = (uint32_t)ms_data.value;
}
} else if (fwk_id_is_equal(event->id, mod_sensor_event_id_read_request)) {
/* Response event from Sensor HAL */
params = (struct mod_sensor_event_params *)event->params;
- if (params->status == FWK_SUCCESS) {
- mod_ctx.cur_temp = (uint32_t)params->value;
+ if (params->sensor_data->status == FWK_SUCCESS) {
+ mod_ctx.cur_temp = (uint32_t)params->sensor_data->value;
status = FWK_SUCCESS;
} else {
status = FWK_E_DEVICE;
--
2.30.2
@@ -0,0 +1,92 @@
From 736bd8aeceefd474c15a97e4a4ec99f07ef9a82c Mon Sep 17 00:00:00 2001
From: Arunachalam Ganapathy <arunachalam.ganapathy@arm.com>
Date: Fri, 11 Feb 2022 18:28:43 +0000
Subject: [PATCH 2/4] tc0: fix mpmm config
Do not enable MPMM in standard features set.
Signed-off-by: Arunachalam Ganapathy <arunachalam.ganapathy@arm.com>
Change-Id: I7b273a2055452e2e8cd78a0d932514a6f2947ec5
Upstream-Status: Pending [Not submitted to upstream yet]
---
product/tc0/scp_ramfw/config_mpmm.c | 15 ---------------
1 file changed, 15 deletions(-)
diff --git a/product/tc0/scp_ramfw/config_mpmm.c b/product/tc0/scp_ramfw/config_mpmm.c
index 3bfe99d3..13d866a5 100644
--- a/product/tc0/scp_ramfw/config_mpmm.c
+++ b/product/tc0/scp_ramfw/config_mpmm.c
@@ -27,7 +27,6 @@ enum core_pd_idx {
CORE7_IDX
};
-#if defined(PLATFORM_VARIANT) && (PLATFORM_VARIANT == TC0_VARIANT_STD)
static struct mod_mpmm_pct_table k_pct[] = {
{ .cores_online = 4,
.default_perf_limit = 1153 * 1000000UL,
@@ -115,7 +114,6 @@ static struct mod_mpmm_pct_table m_pct[] = {
},
} },
};
-#endif
static struct mod_mpmm_pct_table m_elp_pct[] = {
{ .cores_online = 1,
@@ -132,7 +130,6 @@ static struct mod_mpmm_pct_table m_elp_pct[] = {
} },
};
-#if defined(PLATFORM_VARIANT) && (PLATFORM_VARIANT == TC0_VARIANT_STD)
static const struct mod_mpmm_core_config k_core_config[] = {
[0] = {
.pd_id = FWK_ID_ELEMENT_INIT(FWK_MODULE_IDX_POWER_DOMAIN, CORE0_IDX),
@@ -180,7 +177,6 @@ static const struct mod_mpmm_core_config m_core_config[] = {
.core_starts_online = false,
},
};
-#endif
static const struct mod_mpmm_core_config m_elp_core_config[] = {
[0] = {
@@ -191,7 +187,6 @@ static const struct mod_mpmm_core_config m_elp_core_config[] = {
},
};
-#if defined(PLATFORM_VARIANT) && (PLATFORM_VARIANT == TC0_VARIANT_STD)
static const struct mod_mpmm_domain_config k_domain_conf[] = {
[0] = {
.perf_id = FWK_ID_ELEMENT_INIT(
@@ -219,7 +214,6 @@ static const struct mod_mpmm_domain_config m_domain_conf[] = {
},
[1] = {0},
};
-#endif
static const struct mod_mpmm_domain_config m_elp_domain_conf[] = {
[0] = {
@@ -236,14 +230,6 @@ static const struct mod_mpmm_domain_config m_elp_domain_conf[] = {
};
static const struct fwk_element element_table[] = {
-#if defined(PLATFORM_VARIANT) && (PLATFORM_VARIANT == TC0_VAR_EXPERIMENT_POWER)
- [0] = {
- .name = "MPMM_MATTERHORN_ELP_ARM_ELEM",
- .sub_element_count = 1,
- .data = m_elp_domain_conf,
- },
- [1] = { 0 },
-#else
[0] = {
.name = "MPMM_KLEIN_ELEM",
.sub_element_count = 4,
@@ -260,7 +246,6 @@ static const struct fwk_element element_table[] = {
.data = m_elp_domain_conf,
},
[3] = { 0 },
-#endif
};
static const struct fwk_element *mpmm_get_element_table(fwk_id_t module_id)
--
2.30.2
@@ -0,0 +1,202 @@
From 50e63f11762348bcd95d809af248f620f03d9ce4 Mon Sep 17 00:00:00 2001
From: Arunachalam Ganapathy <arunachalam.ganapathy@arm.com>
Date: Fri, 11 Feb 2022 18:16:54 +0000
Subject: [PATCH 3/4] tc0: rename platform variant to platform feature set
THe PLATFORM_VARIANT flag was added to differentiate the software
features enabled in SCP firmware. But this flag misleads to a new
variant of same platform. This commits renames PLATFORM_VARIANT to
PLATFORM_FEATURE_SET
Signed-off-by: Arunachalam Ganapathy <arunachalam.ganapathy@arm.com>
Change-Id: I93c0bc3e11fe18192bb8246df851345bdc473974
Upstream-Status: Pending [Not submitted to upstream yet]
---
product/tc0/doc/{variants.md => features.md} | 28 +++++++++-----------
product/tc0/scp_ramfw/CMakeLists.txt | 26 +++---------------
product/tc0/scp_ramfw/Firmware.cmake | 2 +-
product/tc0/scp_ramfw/config_scmi_perf.c | 8 +++---
product/tc0/scp_romfw/CMakeLists.txt | 6 ++---
product/tc0/scp_romfw/Firmware.cmake | 2 +-
6 files changed, 25 insertions(+), 47 deletions(-)
rename product/tc0/doc/{variants.md => features.md} (77%)
diff --git a/product/tc0/doc/variants.md b/product/tc0/doc/features.md
similarity index 77%
rename from product/tc0/doc/variants.md
rename to product/tc0/doc/features.md
index fbf616db..3ef520e2 100644
--- a/product/tc0/doc/variants.md
+++ b/product/tc0/doc/features.md
@@ -1,4 +1,4 @@
-# TC0 Platform Variants
+# TC0 Platform Features
Copyright (c) 2022, Arm Limited. All rights reserved.
@@ -7,30 +7,27 @@ Copyright (c) 2022, Arm Limited. All rights reserved.
Documentation for TC0 platform can be found at [1].
+### Standard
+
+The standard build provides all the features described in [1].
+For this default features, it's not required to provide any extra parameters in
+the build commands.
+
+### MPMM/Power/Performance (Experimental)
+
For the purpose of experimenting some of the software features that have been
-introduced in SCP-firmware a new variant of TC0 has been created.
-The variant(s) can be chosen at build time by adding:
+introduced in SCP-firmware of TC0. This can be enabled at build time, by adding:
```sh
make -f Makefile.cmake \
PRODUCT=tc0 \
MODE=<debug,release> \
- EXTRA_CONFIG_ARGS+=-DSCP_PLATFORM_VARIANT=<0,1>
+ EXTRA_CONFIG_ARGS+=-DSCP_PLATFORM_FEATURE_SET=1
```
-
-### Variant 0 (Standard build)
-
-The standard build provides all the features described in [1].
-For this default variant, it's not required to provide any extra parameters in
-the build commands.
-
-
-### Variant 1 (Power/Performance testing)
-
-This variant adds support for the following software features:
+This adds support for the following software features:
- Traffic Cop
- MPMM (Maximum Power Mitigation Mechanism)
- Thermal Management
@@ -63,7 +60,6 @@ Once built, the features above will act as:
## Limitations
-- The "variant" option is available only with the CMake build.
- The Thermal functionality is limited at this time cause the constant
temperature being sampled.
diff --git a/product/tc0/scp_ramfw/CMakeLists.txt b/product/tc0/scp_ramfw/CMakeLists.txt
index 96310320..ce3178ee 100644
--- a/product/tc0/scp_ramfw/CMakeLists.txt
+++ b/product/tc0/scp_ramfw/CMakeLists.txt
@@ -11,25 +11,13 @@
add_executable(tc0-bl2)
+set(SCP_PLATFORM_FEATURE_SET ${SCP_PLATFORM_FEATURE_SET_INIT} CACHE STRING "1")
-# SCP_PLATFORM_VARIANT options:
-# - 'TC0_VARIANT_STD' for TC0 standard build
-# - 'TC0_VAR_EXPERIMENT_POWER' for TC0 with power/performance plugins used for
-# evaluation purposes
-
-
-target_compile_definitions(tc0-bl2 PUBLIC -DTC0_VARIANT_STD=0)
-target_compile_definitions(tc0-bl2 PUBLIC -DTC0_VAR_EXPERIMENT_POWER=1)
-
-
-set(SCP_PLATFORM_VARIANT ${SCP_PLATFORM_VARIANT_INIT} CACHE STRING "1")
-
-
-if (SCP_PLATFORM_VARIANT STREQUAL "1")
- message(NOTICE "SCP_PLATFORM_VARIANT set to EXPERIMENT_POWER (tc0-bl2)\n")
+if (SCP_PLATFORM_FEATURE_SET STREQUAL "1")
+ message(NOTICE "TC0 platform features MPMM/POWER/PERFORMANCE is experimental (tc0-bl2)\n")
target_compile_definitions(tc0-bl2
- PUBLIC -DPLATFORM_VARIANT=TC0_VAR_EXPERIMENT_POWER)
+ PUBLIC -DTC0_FEATURES_MPMM_POWER_PERF)
set(SCP_ENABLE_PLUGIN_HANDLER TRUE PARENT_SCOPE)
set(SCP_ENABLE_FAST_CHANNELS TRUE PARENT_SCOPE)
@@ -56,12 +44,6 @@ if (SCP_PLATFORM_VARIANT STREQUAL "1")
list(PREPEND SCP_MODULE_PATHS
"${CMAKE_CURRENT_LIST_DIR}/../module/tc0_power_model")
target_sources(tc0-bl2 PRIVATE "config_tc0_power_model.c")
-
-else()
- message(NOTICE "SCP_PLATFORM_VARIANT set to STANDARD (tc0-bl2)\n")
-
- target_compile_definitions(tc0-bl2
- PUBLIC -DPLATFORM_VARIANT=TC0_VARIANT_STD)
endif()
diff --git a/product/tc0/scp_ramfw/Firmware.cmake b/product/tc0/scp_ramfw/Firmware.cmake
index 11d8eaab..4a555296 100644
--- a/product/tc0/scp_ramfw/Firmware.cmake
+++ b/product/tc0/scp_ramfw/Firmware.cmake
@@ -27,7 +27,7 @@ set(SCP_ENABLE_FAST_CHANNELS_INIT FALSE)
set(SCP_ENABLE_PLUGIN_HANDLER_INIT FALSE)
-set(SCP_PLATFORM_VARIANT_INIT 0)
+set(SCP_PLATFORM_FEATURE_SET_INIT 0)
set(SCP_ARCHITECTURE "armv7-m")
diff --git a/product/tc0/scp_ramfw/config_scmi_perf.c b/product/tc0/scp_ramfw/config_scmi_perf.c
index a4a47b3a..3e91939a 100644
--- a/product/tc0/scp_ramfw/config_scmi_perf.c
+++ b/product/tc0/scp_ramfw/config_scmi_perf.c
@@ -129,7 +129,7 @@ static const struct mod_scmi_perf_domain_config domains[] = {
},
};
-#if defined(PLATFORM_VARIANT) && (PLATFORM_VARIANT == TC0_VAR_EXPERIMENT_POWER)
+#ifdef TC0_FEATURES_MPMM_POWER_PERF
static const struct mod_scmi_plugin_config plugins_table[] = {
[0] = {
.id = FWK_ID_MODULE_INIT(FWK_MODULE_IDX_TRAFFIC_COP),
@@ -156,9 +156,9 @@ const struct fwk_module_config config_scmi_perf = {
#else
.fast_channels_alarm_id = FWK_ID_NONE_INIT,
#endif
-#if defined(PLATFORM_VARIANT) && (PLATFORM_VARIANT == TC0_VAR_EXPERIMENT_POWER)
- .plugins = plugins_table,
- .plugins_count = FWK_ARRAY_SIZE(plugins_table),
+#ifdef TC0_FEATURES_MPMM_POWER_PERF
+ .plugins = plugins_table,
+ .plugins_count = FWK_ARRAY_SIZE(plugins_table),
#endif
})
};
diff --git a/product/tc0/scp_romfw/CMakeLists.txt b/product/tc0/scp_romfw/CMakeLists.txt
index f9f40ad3..09cd2f5d 100644
--- a/product/tc0/scp_romfw/CMakeLists.txt
+++ b/product/tc0/scp_romfw/CMakeLists.txt
@@ -48,6 +48,6 @@ target_include_directories(tc0-bl1
PUBLIC $<TARGET_PROPERTY:cmsis::core-m,INTERFACE_INCLUDE_DIRECTORIES>)
cmake_dependent_option(
- SCP_PLATFORM_VARIANT "Choose platform software variant?"
- "${SCP_PLATFORM_VARIANT_INIT}" "DEFINED SCP_PLATFORM_VARIANT_INIT"
- "${SCP_PLATFORM_VARIANT}")
+ SCP_PLATFORM_FEATURE_SET "Choose platform software features?"
+ "${SCP_PLATFORM_FEATURE_SET_INIT}" "DEFINED SCP_PLATFORM_FEATURE_SET_INIT"
+ "${SCP_PLATFORM_FEATURE_SET}")
diff --git a/product/tc0/scp_romfw/Firmware.cmake b/product/tc0/scp_romfw/Firmware.cmake
index ab4468be..e1360159 100644
--- a/product/tc0/scp_romfw/Firmware.cmake
+++ b/product/tc0/scp_romfw/Firmware.cmake
@@ -21,7 +21,7 @@ set(SCP_ENABLE_NOTIFICATIONS_INIT TRUE)
set(SCP_ENABLE_IPO_INIT FALSE)
-set(SCP_PLATFORM_VARIANT_INIT 0)
+set(SCP_PLATFORM_FEATURE_SET_INIT 0)
set(SCP_ARCHITECTURE "armv7-m")
--
2.30.2
@@ -0,0 +1,114 @@
From 3e737dd47b228bdeffb06e39bffec7a4a436b244 Mon Sep 17 00:00:00 2001
From: Arunachalam Ganapathy <arunachalam.ganapathy@arm.com>
Date: Wed, 9 Feb 2022 16:02:10 +0000
Subject: [PATCH 4/4] tc0: support platform feature set options in firmware.mk
Support existing platform feature set options that is in cmake to
firmware.mk. Two feature set for TC0 are
0. Standard
1. MPMM/Power/Performance (Experimental)
Build option to select the feature set is using:
make PRODUCT=tc0 MODE=<debug,release> SCP_PLATFORM_FEATURE_SET=<0,1>
The default value is set to 0 (Standard).
Refer product/tc0/doc/features.md for more details.
Signed-off-by: Arunachalam Ganapathy <arunachalam.ganapathy@arm.com>
Change-Id: I4028686a8f8461e0e2c29e15d5e52eb1d37ca60a
Upstream-Status: Pending [Not submitted to upstream yet]
---
product/tc0/scp_ramfw/firmware.mk | 41 +++++++++++++++++++++++++++++--
product/tc0/scp_romfw/firmware.mk | 12 +++++++++
2 files changed, 51 insertions(+), 2 deletions(-)
diff --git a/product/tc0/scp_ramfw/firmware.mk b/product/tc0/scp_ramfw/firmware.mk
index ec6e6679..d7515f5b 100644
--- a/product/tc0/scp_ramfw/firmware.mk
+++ b/product/tc0/scp_ramfw/firmware.mk
@@ -9,8 +9,24 @@ BS_FIRMWARE_CPU := cortex-m3
BS_FIRMWARE_HAS_NOTIFICATION := yes
BS_FIRMWARE_HAS_RESOURCE_PERMISSIONS := yes
BS_FIRMWARE_USE_NEWLIB_NANO_SPECS := yes
-BS_FIRMWARE_HAS_FAST_CHANNELS := no
-BS_FIRMWARE_HAS_PERF_PLUGIN_HANDLER := no
+
+DEFAULT_SCP_PLATFORM_FEATURE_SET := 0
+
+export SCP_PLATFORM_FEATURE_SET ?= $(DEFAULT_SCP_PLATFORM_FEATURE_SET)
+ifneq ($(filter-out 0 1, $(SCP_PLATFORM_FEATURE_SET)),)
+ $(error "Invalid for SCP_PLATFORM_FEATURE_SET parameter. Valid options are \
+ 0 or 1. Aborting...")
+endif
+
+ifeq ($(SCP_PLATFORM_FEATURE_SET),0)
+ BS_FIRMWARE_HAS_PERF_PLUGIN_HANDLER := no
+ BS_FIRMWARE_HAS_FAST_CHANNELS := no
+else
+ DEFINES += TC0_FEATURES_MPMM_POWER_PERF
+ BS_FIRMWARE_HAS_PERF_PLUGIN_HANDLER := yes
+ BS_FIRMWARE_HAS_FAST_CHANNELS := yes
+ $(info "TC0 platform features POWER/PERFORMANCE is experimental")
+endif
BS_FIRMWARE_MODULES := \
armv7m_mpu \
@@ -44,6 +60,16 @@ ifeq ($(BS_FIRMWARE_HAS_RESOURCE_PERMISSIONS),yes)
BS_FIRMWARE_MODULES += resource_perms
endif
+ifeq ($(SCP_PLATFORM_FEATURE_SET),1)
+BS_FIRMWARE_MODULES += \
+ traffic_cop \
+ mpmm \
+ sensor \
+ reg_sensor \
+ thermal_mgmt \
+ tc0_power_model
+endif
+
BS_FIRMWARE_SOURCES := \
config_system_power.c \
config_armv7m_mpu.c \
@@ -75,4 +101,15 @@ ifeq ($(BS_FIRMWARE_HAS_RESOURCE_PERMISSIONS),yes)
BS_FIRMWARE_SOURCES += config_resource_perms.c
endif
+ifeq ($(SCP_PLATFORM_FEATURE_SET),1)
+ BS_FIRMWARE_SOURCES += \
+ config_traffic_cop.c \
+ config_mpmm.c \
+ config_sensor.c \
+ config_reg_sensor.c \
+ config_thermal_mgmt.c \
+ config_tc0_power_model.c
+endif
+
+
include $(BS_DIR)/firmware.mk
diff --git a/product/tc0/scp_romfw/firmware.mk b/product/tc0/scp_romfw/firmware.mk
index 9977712f..0012b9fa 100644
--- a/product/tc0/scp_romfw/firmware.mk
+++ b/product/tc0/scp_romfw/firmware.mk
@@ -9,6 +9,18 @@ BS_FIRMWARE_CPU := cortex-m3
BS_FIRMWARE_HAS_NOTIFICATION := yes
BS_FIRMWARE_USE_NEWLIB_NANO_SPECS := yes
+DEFAULT_SCP_PLATFORM_FEATURE_SET := 0
+
+export SCP_PLATFORM_FEATURE_SET ?= $(DEFAULT_SCP_PLATFORM_FEATURE_SET)
+ifneq ($(filter-out 0 1, $(SCP_PLATFORM_FEATURE_SET)),)
+ $(error "Invalid for SCP_PLATFORM_FEATURE_SET parameter. Valid options are \
+ 0 or 1. Aborting...")
+endif
+
+ifeq ($(SCP_PLATFORM_FEATURE_SET),1)
+ $(info "TC0 platform features POWER/PERFORMANCE is experimental")
+endif
+
BS_FIRMWARE_MODULE_HEADERS_ONLY := \
power_domain \
timer
--
2.30.2
@@ -1,4 +1,17 @@
# TC0 specific SCP configuration
# TC specific SCP configuration
# Intermediate SHA with 2.9 baseline version
# This has support for SCP features MPMM/POWER/PERFORMANCE for TC0
SRCREV = "027b567fde5e3767fb1678bda28cf59fa7aac06d"
PV = "2.9+git${SRCPV}"
FILESEXTRAPATHS:prepend := "${THISDIR}/files/tc:"
SRC_URI:append:tc = " \
file://0001-tc0-fix-sensor-data-api-call.patch \
file://0002-tc0-fix-mpmm-config.patch \
file://0003-tc0-rename-platform-variant-to-platform-feature-set.patch \
file://0004-tc0-support-platform-feature-set-options-in-firmware.patch \
"
COMPATIBLE_MACHINE = "(tc?)"