From bc8edbe57c17d984368a3887c93f26a59fe1661f Mon Sep 17 00:00:00 2001 From: Md Golam Tanvir Zim Date: Thu, 27 Mar 2025 15:58:41 +0000 Subject: [PATCH 1/2] mod/scmi_perf: Remove unused function A left-over function from previous implementation of fast channel is removed which is neither built nor needed. Signed-off-by: Md Golam Tanvir Zim Change-Id: Ia02f8d06c9a97e6e377673f0da491863922fc208 --- module/scmi_perf/doc/perf_plugins_handler.md | 36 ------ module/scmi_perf/src/scmi_perf_fastchannels.c | 106 +----------------- 2 files changed, 1 insertion(+), 141 deletions(-) diff --git a/module/scmi_perf/doc/perf_plugins_handler.md b/module/scmi_perf/doc/perf_plugins_handler.md index eabc03f17..724f04c29 100644 --- a/module/scmi_perf/doc/perf_plugins_handler.md +++ b/module/scmi_perf/doc/perf_plugins_handler.md @@ -220,18 +220,6 @@ level/limits can be shared with the remaining plugins. ## Configuration Example 1 (plugin with physical/DVFS domains view) - static const struct mod_scmi_perf_domain_config domains[] = { - [DVFS_DOMAIN_0] = { - .fast_channels_addr_scp = (uint64_t[]) { ... }, - .fast_channels_addr_ap = (uint64_t[]) { ... }, - }, - ... - [DVFS_DOMAIN_n] = { - .fast_channels_addr_scp = (uint64_t[]) { ... }, - .fast_channels_addr_ap = (uint64_t[]) { ... }, - }, - }; - static const struct mod_scmi_plugin_config plugins_table[] = { [0] = { .id = FWK_ID_MODULE_INIT(FWK_MODULE_IDX_), @@ -252,15 +240,11 @@ level/limits can be shared with the remaining plugins. static const struct mod_scmi_perf_domain_config domains[] = { [SCMI_PERF_DOMAIN_0] = { - .fast_channels_addr_scp = (uint64_t[]) { ... }, - .fast_channels_addr_ap = (uint64_t[]) { ... }, .phy_group_id = FWK_ID_ELEMENT_INIT(FWK_MODULE_IDX_DVFS, DVFS_ELEMENT_IDX_0), }, ... [SCMI_PERF_DOMAIN_1] = { - .fast_channels_addr_scp = (uint64_t[]) { ... }, - .fast_channels_addr_ap = (uint64_t[]) { ... }, .phy_group_id = FWK_ID_ELEMENT_INIT(FWK_MODULE_IDX_DVFS, DVFS_ELEMENT_IDX_0), }, @@ -287,15 +271,11 @@ Note that a plugin in this case can choose either logical or physical view. static const struct mod_scmi_perf_domain_config domains[] = { [SCMI_PERF_DOMAIN_0] = { - .fast_channels_addr_scp = (uint64_t[]) { ... }, - .fast_channels_addr_ap = (uint64_t[]) { ... }, .phy_group_id = FWK_ID_ELEMENT_INIT(FWK_MODULE_IDX_DVFS, DVFS_ELEMENT_IDX_0), }, ... [SCMI_PERF_DOMAIN_1] = { - .fast_channels_addr_scp = (uint64_t[]) { ... }, - .fast_channels_addr_ap = (uint64_t[]) { ... }, .phy_group_id = FWK_ID_ELEMENT_INIT(FWK_MODULE_IDX_DVFS, DVFS_ELEMENT_IDX_0), }, @@ -306,13 +286,6 @@ required. ## Configuration Example 4 (2 plugins with physical domain view) - static const struct mod_scmi_perf_domain_config domains[] = { - [DVFS_DOMAIN_0] = { - .fast_channels_addr_scp = (uint64_t[]) { ... }, - .fast_channels_addr_ap = (uint64_t[]) { ... }, - }, - }; - static const struct mod_scmi_plugin_config plugins_table[] = { [0] = { .id = FWK_ID_MODULE_INIT(FWK_MODULE_IDX_), @@ -334,15 +307,6 @@ required. ## Configuration Example 5 (3 plugins with different domain view) - static const struct mod_scmi_perf_domain_config domains[] = { - [DVFS_DOMAIN_0] = { - .fast_channels_addr_scp = (uint64_t[]) { ... }, - .fast_channels_addr_ap = (uint64_t[]) { ... }, - }, - ... - [DVFS_DOMAIN_n] = { ... }, - }; - static const struct mod_scmi_plugin_config plugins_table[] = { [0] = { .id = FWK_ID_MODULE_INIT(FWK_MODULE_IDX_), diff --git a/module/scmi_perf/src/scmi_perf_fastchannels.c b/module/scmi_perf/src/scmi_perf_fastchannels.c index 98e982d5f..0f93286a7 100644 --- a/module/scmi_perf/src/scmi_perf_fastchannels.c +++ b/module/scmi_perf/src/scmi_perf_fastchannels.c @@ -1,6 +1,6 @@ /* * Arm SCP/MCP Software - * Copyright (c) 2015-2024, Arm Limited and Contributors. All rights reserved. + * Copyright (c) 2015-2025, Arm Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause * @@ -39,9 +39,6 @@ struct mod_scmi_perf_fc_ctx { uint32_t fast_channels_rate_limit; volatile uint32_t pending_req_count; - -#ifdef BUILD_HAS_SCMI_PERF_FAST_CHANNELS - /* * For a timer based fast channel interrupt type we must register * fast channel callback only once with the fast channel driver @@ -49,7 +46,6 @@ struct mod_scmi_perf_fc_ctx { * fast channel driver. */ bool callback_registered; -#endif }; static unsigned int fast_channel_elem_size[MOD_SCMI_PERF_FAST_CHANNEL_COUNT] = { @@ -77,8 +73,6 @@ static inline struct scmi_perf_domain_ctx *perf_fch_get_ctx(fwk_id_t domain_id) } #endif -#ifdef BUILD_HAS_SCMI_PERF_FAST_CHANNELS - static inline uint32_t *get_fc_set_level_addr(uint32_t domain_idx) { const struct scmi_perf_domain_ctx *domain_ctx; @@ -182,7 +176,6 @@ static int fch_context_init( return FWK_SUCCESS; } -#endif static inline void decrement_pending_req_count(void) { @@ -203,14 +196,12 @@ static inline void log_and_increment_pending_req_count(void) /* * SCMI Performance helpers */ -#ifdef BUILD_HAS_SCMI_PERF_FAST_CHANNELS bool perf_fch_domain_has_fastchannels(uint32_t domain_idx) { const struct mod_scmi_perf_domain_config *domain = &(*perf_fch_ctx.perf_ctx->config->domains)[domain_idx]; return domain->supports_fast_channels; } -#endif bool perf_fch_prot_msg_attributes_has_fastchannels( const struct scmi_protocol_message_attributes_a2p *parameters) @@ -232,7 +223,6 @@ static inline int respond_to_scmi( sizeof(return_values->status)); } -#ifdef BUILD_HAS_SCMI_PERF_FAST_CHANNELS int perf_fch_describe_fast_channels( fwk_id_t service_id, const uint32_t *payload) @@ -317,96 +307,6 @@ int perf_fch_describe_fast_channels( return respond_to_scmi(service_id, &return_values); } -#else -int perf_fch_describe_fast_channels( - fwk_id_t service_id, - const uint32_t *payload) -{ - const struct mod_scmi_perf_domain_config *domain; - const struct scmi_perf_describe_fc_a2p *parameters; - struct scmi_perf_describe_fc_p2a return_values = { - .status = (int32_t)SCMI_SUCCESS, - }; - uint32_t chan_size = 0, chan_index = 0; - enum scmi_perf_command_id message_id; - - parameters = (const struct scmi_perf_describe_fc_a2p *)payload; - - if (parameters->domain_id >= perf_fch_ctx.perf_ctx->domain_count) { - return_values.status = (int32_t)SCMI_NOT_FOUND; - - return respond_to_scmi(service_id, &return_values); - } - - domain = &(*perf_fch_ctx.perf_ctx->config->domains)[parameters->domain_id]; - - if (domain->fast_channels_addr_scp == NULL) { - return_values.status = (int32_t)SCMI_NOT_SUPPORTED; - - return respond_to_scmi(service_id, &return_values); - } - - if (parameters->message_id >= MOD_SCMI_PERF_COMMAND_COUNT) { - return_values.status = (int32_t)SCMI_NOT_FOUND; - - return respond_to_scmi(service_id, &return_values); - } - - message_id = (enum scmi_perf_command_id)parameters->message_id; - - switch (message_id) { - case MOD_SCMI_PERF_LEVEL_GET: - chan_index = (uint32_t)MOD_SCMI_PERF_FAST_CHANNEL_LEVEL_GET; - chan_size = - fast_channel_elem_size[MOD_SCMI_PERF_FAST_CHANNEL_LEVEL_GET]; - break; - - case MOD_SCMI_PERF_LEVEL_SET: - chan_index = (uint32_t)MOD_SCMI_PERF_FAST_CHANNEL_LEVEL_SET; - chan_size = - fast_channel_elem_size[MOD_SCMI_PERF_FAST_CHANNEL_LEVEL_SET]; - break; - - case MOD_SCMI_PERF_LIMITS_SET: - chan_index = (uint32_t)MOD_SCMI_PERF_FAST_CHANNEL_LIMIT_SET; - chan_size = - fast_channel_elem_size[MOD_SCMI_PERF_FAST_CHANNEL_LIMIT_SET]; - break; - - case MOD_SCMI_PERF_LIMITS_GET: - chan_index = (uint32_t)MOD_SCMI_PERF_FAST_CHANNEL_LIMIT_GET; - chan_size = - fast_channel_elem_size[MOD_SCMI_PERF_FAST_CHANNEL_LIMIT_GET]; - break; - - default: - return_values.status = (int32_t)SCMI_NOT_SUPPORTED; - break; - } - - /* Check for failed cases above */ - if (return_values.status != SCMI_SUCCESS) { - return respond_to_scmi(service_id, &return_values); - } - - if (domain->fast_channels_addr_ap == NULL || - domain->fast_channels_addr_ap[chan_index] == 0x0) { - return_values.status = (int32_t)SCMI_NOT_SUPPORTED; - - return respond_to_scmi(service_id, &return_values); - } - - return_values.attributes = 0; /* Doorbell not supported */ - return_values.rate_limit = perf_fch_ctx.fast_channels_rate_limit; - return_values.chan_addr_low = - (uint32_t)(domain->fast_channels_addr_ap[chan_index] & ~0UL); - return_values.chan_addr_high = - (uint32_t)(domain->fast_channels_addr_ap[chan_index] >> 32); - return_values.chan_size = chan_size; - - return respond_to_scmi(service_id, &return_values); -} -#endif #ifdef BUILD_HAS_SCMI_PERF_PLUGIN_HANDLER static void adjust_level_for_limits( @@ -657,7 +557,6 @@ int perf_fch_init( return FWK_SUCCESS; } -#ifdef BUILD_HAS_SCMI_PERF_FAST_CHANNELS int perf_fch_bind(fwk_id_t id, unsigned int round) { unsigned int domain_idx; @@ -684,13 +583,11 @@ int perf_fch_bind(fwk_id_t id, unsigned int round) return FWK_SUCCESS; } -#endif static void *get_fch_local_address( unsigned int domain_idx, unsigned int fch_idx) { -#ifdef BUILD_HAS_SCMI_PERF_FAST_CHANNELS const struct scmi_perf_fch_config *fch_config; struct fast_channel_ctx *fch_ctx; int status; @@ -705,7 +602,6 @@ static void *get_fch_local_address( } return (void *)fch_ctx->fch_address.local_view_address; -#endif } #ifdef BUILD_HAS_SCMI_PERF_PLUGIN_HANDLER -- GitLab From e407f54884e3c9853304cb5605e57171cd3170ed Mon Sep 17 00:00:00 2001 From: Md Golam Tanvir Zim Date: Thu, 27 Mar 2025 16:46:41 +0000 Subject: [PATCH 2/2] mod/scmi_perf: Remove unncessary variable from fast channel context A redundant element from scmi perf fast channel context is removed. Signed-off-by: Md Golam Tanvir Zim Change-Id: Ie22283a009e51c757ebf018e3636cb38533242de --- module/scmi_perf/src/scmi_perf_fastchannels.c | 5 ++--- .../test/fastchannels/mod_scmi_perf_fch_unit_test.c | 8 ++++---- .../test/plugins_handler/mod_scmi_perf_ph_unit_test.c | 3 +-- .../test/protocol/mod_scmi_perf_protocol_ops_unit_test.c | 3 +-- 4 files changed, 8 insertions(+), 11 deletions(-) diff --git a/module/scmi_perf/src/scmi_perf_fastchannels.c b/module/scmi_perf/src/scmi_perf_fastchannels.c index 0f93286a7..fc588f4e5 100644 --- a/module/scmi_perf/src/scmi_perf_fastchannels.c +++ b/module/scmi_perf/src/scmi_perf_fastchannels.c @@ -36,8 +36,6 @@ struct mod_scmi_perf_fc_ctx { struct mod_scmi_perf_private_api_perf_stub *api_fch_stub; const struct mod_timer_alarm_api *fc_alarm_api; - uint32_t fast_channels_rate_limit; - volatile uint32_t pending_req_count; /* * For a timer based fast channel interrupt type we must register @@ -298,7 +296,8 @@ int perf_fch_describe_fast_channels( } return_values.attributes = 0; /* Doorbell not supported */ - return_values.rate_limit = perf_fch_ctx.fast_channels_rate_limit; + return_values.rate_limit = + perf_fch_ctx.perf_ctx->config->fast_channels_rate_limit; return_values.chan_addr_low = (uint32_t)(fch_ctx->fch_address.target_view_address & ~0UL); return_values.chan_addr_high = diff --git a/module/scmi_perf/test/fastchannels/mod_scmi_perf_fch_unit_test.c b/module/scmi_perf/test/fastchannels/mod_scmi_perf_fch_unit_test.c index c19556a52..794e3bb14 100644 --- a/module/scmi_perf/test/fastchannels/mod_scmi_perf_fch_unit_test.c +++ b/module/scmi_perf/test/fastchannels/mod_scmi_perf_fch_unit_test.c @@ -1,6 +1,6 @@ /* * Arm SCP/MCP Software - * Copyright (c) 2022-2024, Arm Limited and Contributors. All rights reserved. + * Copyright (c) 2022-2025, Arm Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ @@ -68,7 +68,6 @@ void setUp(void) scmi_perf_ctx.domain_count = scmi_perf_ctx.config->perf_doms_count; perf_fch_ctx.perf_ctx = &scmi_perf_ctx; - perf_fch_ctx.fast_channels_rate_limit = SCMI_PERF_FC_MIN_RATE_LIMIT; to_protocol_api = &scmi_perf_mod_scmi_to_protocol_api; perf_prot_ctx.scmi_perf_ctx = &scmi_perf_ctx; @@ -521,7 +520,7 @@ void utest_perf_fch_init_success(void) int status; struct mod_scmi_perf_config config = { - .fast_channels_rate_limit = SCMI_PERF_FC_MIN_RATE_LIMIT / 2, + .fast_channels_rate_limit = SCMI_PERF_FC_MIN_RATE_LIMIT, }; perf_fch_ctx.perf_ctx->config = &config; @@ -531,7 +530,8 @@ void utest_perf_fch_init_success(void) TEST_ASSERT_EQUAL(&scmi_perf_ctx, perf_fch_ctx.perf_ctx); TEST_ASSERT_EQUAL(&api, perf_fch_ctx.api_fch_stub); TEST_ASSERT_EQUAL( - SCMI_PERF_FC_MIN_RATE_LIMIT, perf_fch_ctx.fast_channels_rate_limit); + SCMI_PERF_FC_MIN_RATE_LIMIT, + perf_fch_ctx.perf_ctx->config->fast_channels_rate_limit); } int scmi_perf_fch_test_main(void) diff --git a/module/scmi_perf/test/plugins_handler/mod_scmi_perf_ph_unit_test.c b/module/scmi_perf/test/plugins_handler/mod_scmi_perf_ph_unit_test.c index d547a7b36..3950c7231 100644 --- a/module/scmi_perf/test/plugins_handler/mod_scmi_perf_ph_unit_test.c +++ b/module/scmi_perf/test/plugins_handler/mod_scmi_perf_ph_unit_test.c @@ -1,6 +1,6 @@ /* * Arm SCP/MCP Software - * Copyright (c) 2022-2023, Arm Limited and Contributors. All rights reserved. + * Copyright (c) 2022-2025, Arm Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ @@ -133,7 +133,6 @@ void setUp(void) scmi_perf_ctx.domain_count = scmi_perf_ctx.config->perf_doms_count; perf_fch_ctx.perf_ctx = &scmi_perf_ctx; - perf_fch_ctx.fast_channels_rate_limit = SCMI_PERF_FC_MIN_RATE_LIMIT; perf_config.plugins_count = FWK_ARRAY_SIZE(plugins_table); diff --git a/module/scmi_perf/test/protocol/mod_scmi_perf_protocol_ops_unit_test.c b/module/scmi_perf/test/protocol/mod_scmi_perf_protocol_ops_unit_test.c index 1e4541a3a..cd54fa75b 100644 --- a/module/scmi_perf/test/protocol/mod_scmi_perf_protocol_ops_unit_test.c +++ b/module/scmi_perf/test/protocol/mod_scmi_perf_protocol_ops_unit_test.c @@ -1,6 +1,6 @@ /* * Arm SCP/MCP Software - * Copyright (c) 2022-2024, Arm Limited and Contributors. All rights reserved. + * Copyright (c) 2022-2025, Arm Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ @@ -81,7 +81,6 @@ void setUp(void) #ifdef BUILD_HAS_SCMI_PERF_FAST_CHANNELS perf_fch_ctx.perf_ctx = &scmi_perf_ctx; - perf_fch_ctx.fast_channels_rate_limit = SCMI_PERF_FC_MIN_RATE_LIMIT; #endif scmi_perf_ctx.dvfs_api = &dvfs_domain_api; -- GitLab