diff options
author | Anurag Koul <anurag.koul@arm.com> | 2020-08-19 09:29:31 +0100 |
---|---|---|
committer | jimqui01 <54316584+jimqui01@users.noreply.github.com> | 2020-09-15 17:03:53 +0100 |
commit | bb3bd8a3374e981f84dc2c43dcc3e1f003696a35 (patch) | |
tree | 744c8157e4926fb9f14c91af8c974c920beeee25 /product/morello | |
parent | c34cd4a9e9b97a56d3292614320ee9703d2e443d (diff) |
morello: add scmi resource permission module config
Change-Id: Idd19ca56f5a80cfef7aa4f8bd6b58b4e5f75fdff
Signed-off-by: Anurag Koul <anurag.koul@arm.com>
Diffstat (limited to 'product/morello')
-rw-r--r-- | product/morello/include/morello_scp_scmi.h | 1 | ||||
-rw-r--r-- | product/morello/scp_ramfw_fvp/config_resource_perms.c | 132 | ||||
-rw-r--r-- | product/morello/scp_ramfw_fvp/firmware.mk | 6 |
3 files changed, 137 insertions, 2 deletions
diff --git a/product/morello/include/morello_scp_scmi.h b/product/morello/include/morello_scp_scmi.h index 7bdb2ee2..6605474f 100644 --- a/product/morello/include/morello_scp_scmi.h +++ b/product/morello/include/morello_scp_scmi.h @@ -17,6 +17,7 @@ enum scp_morello_scmi_agent_id { SCP_SCMI_AGENT_ID_OSPM = 1, SCP_SCMI_AGENT_ID_PSCI, SCP_SCMI_AGENT_ID_MCP, + SCP_SCMI_AGENT_ID_COUNT }; /* SCMI service indexes */ diff --git a/product/morello/scp_ramfw_fvp/config_resource_perms.c b/product/morello/scp_ramfw_fvp/config_resource_perms.c new file mode 100644 index 00000000..f5f94916 --- /dev/null +++ b/product/morello/scp_ramfw_fvp/config_resource_perms.c @@ -0,0 +1,132 @@ +/* + * Arm SCP/MCP Software + * Copyright (c) 2019-2020, Arm Limited and Contributors. All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#include "morello_scp_scmi.h" + +#include <mod_resource_perms.h> +#include <mod_scmi_std.h> + +#include <fwk_element.h> +#include <fwk_id.h> +#include <fwk_macros.h> +#include <fwk_module.h> +#include <fwk_module_idx.h> + +/*! + * If the agent wants to modify permissions at run-time these tables + * must be allocated in writable memory. + */ + +#define AGENT_IDX(agent_id) (agent_id - 1) + +static struct mod_res_agent_protocol_permissions agent_protocol_permissions[] = + { + [AGENT_IDX(SCP_SCMI_AGENT_ID_OSPM)] = + { + .protocols = MOD_RES_PERMS_SCMI_ALL_PROTOCOLS_ALLOWED, + }, + + /* PSCI agent has no access to clock, perf and sensor protocol */ + [AGENT_IDX(SCP_SCMI_AGENT_ID_PSCI)] = + { + .protocols = MOD_RES_PERMS_SCMI_CLOCK_PROTOCOL_DENIED | + MOD_RES_PERMS_SCMI_PERF_PROTOCOL_DENIED | + MOD_RES_PERMS_SCMI_SENSOR_PROTOCOL_DENIED, + }, + }; + +/* + * Messages have an index offset from 0x3 as all agents can access + * the VERSION/ATTRIBUTES/MSG_ATTRIBUTES messages for all + * protocols, hence message 0x3 maps to bit[0], message 0x4 maps + * to bit[1], etc. + */ +static struct mod_res_agent_msg_permissions + agent_msg_permissions[] = + { + [AGENT_IDX(SCP_SCMI_AGENT_ID_OSPM)] = + { + /* Example, Base, disable unused msg 12 */ + .messages[MOD_RES_PERMS_SCMI_BASE_MESSAGE_IDX] = 0x0, + /* Power Domain */ + .messages[MOD_RES_PERMS_SCMI_POWER_DOMAIN_MESSAGE_IDX] = + 0x0, + /* System Power Domain */ + .messages[MOD_RES_PERMS_SCMI_SYS_POWER_MESSAGE_IDX] = 0x0, + /* Performance */ + .messages[MOD_RES_PERMS_SCMI_PERF_MESSAGE_IDX] = 0x0, + /* + * TODO: access to CONFIG_SET required? + */ + .messages[MOD_RES_PERMS_SCMI_CLOCK_MESSAGE_IDX] = + MOD_RES_PERMS_ACCESS_DENIED + << (MOD_SCMI_CLOCK_CONFIG_SET - + MOD_SCMI_CLOCK_ATTRIBUTES), + /* Sensors */ + .messages[MOD_RES_PERMS_SCMI_SENSOR_MESSAGE_IDX] = 0x0, + /* Reset Domains */ + .messages[MOD_RES_PERMS_SCMI_RESET_DOMAIN_MESSAGE_IDX] = + 0x0, + }, + [AGENT_IDX(SCP_SCMI_AGENT_ID_PSCI)] = + { + .messages[0] = 0x0, /* Base */ + .messages[1] = 0x0, /* Power Domain */ + .messages[2] = 0x0, /* System Power Domain */ + .messages[3] = + ((1 + << (MOD_SCMI_PERF_DOMAIN_ATTRIBUTES - + MOD_SCMI_PERF_DOMAIN_ATTRIBUTES)) | + /* DESCRIBE_LEVELS is required for some reason ... */ + (0 + << (MOD_SCMI_PERF_DESCRIBE_LEVELS - + MOD_SCMI_PERF_DOMAIN_ATTRIBUTES)) | + (1 + << (MOD_SCMI_PERF_LIMITS_SET - + MOD_SCMI_PERF_DOMAIN_ATTRIBUTES)) | + (1 + << (MOD_SCMI_PERF_LIMITS_GET - + MOD_SCMI_PERF_DOMAIN_ATTRIBUTES)) | + (1 + << (MOD_SCMI_PERF_LEVEL_SET - + MOD_SCMI_PERF_DOMAIN_ATTRIBUTES)) | + (1 + << (MOD_SCMI_PERF_LEVEL_GET - + MOD_SCMI_PERF_DOMAIN_ATTRIBUTES)) | + (1 + << (MOD_SCMI_PERF_NOTIFY_LIMITS - + MOD_SCMI_PERF_DOMAIN_ATTRIBUTES)) | + (1 + << (MOD_SCMI_PERF_NOTIFY_LEVEL - + MOD_SCMI_PERF_DOMAIN_ATTRIBUTES)) | + (1 + << (MOD_SCMI_PERF_DESCRIBE_FAST_CHANNEL - + MOD_SCMI_PERF_DOMAIN_ATTRIBUTES))), + /* + * TODO: access to CONFIG_SET required? + */ + .messages[4] = + (1 + << (MOD_SCMI_CLOCK_CONFIG_SET - + MOD_SCMI_CLOCK_ATTRIBUTES)), + .messages[5] = 0x0, /* Sensors */ + }, + }; + +static struct mod_res_agent_permission agent_permissions = { + .agent_protocol_permissions = agent_protocol_permissions, + .agent_msg_permissions = agent_msg_permissions, +}; + +struct fwk_module_config config_resource_perms = { + .data = + &(struct mod_res_resource_perms_config){ + .agent_permissions = (uintptr_t)&agent_permissions, + .agent_count = SCP_SCMI_AGENT_ID_COUNT, + .protocol_count = 6, + }, +}; diff --git a/product/morello/scp_ramfw_fvp/firmware.mk b/product/morello/scp_ramfw_fvp/firmware.mk index 73e76c1e..8742c615 100644 --- a/product/morello/scp_ramfw_fvp/firmware.mk +++ b/product/morello/scp_ramfw_fvp/firmware.mk @@ -43,7 +43,8 @@ BS_FIRMWARE_MODULES := \ mock_psu \ dvfs \ scmi_perf \ - morello_system + morello_system \ + resource_perms BS_FIRMWARE_SOURCES := \ rtx_config.c \ @@ -75,5 +76,6 @@ BS_FIRMWARE_SOURCES := \ config_mock_psu.c \ config_dvfs.c \ config_scmi_perf.c \ - config_apcontext.c + config_apcontext.c \ + config_resource_perms.c include $(BS_DIR)/firmware.mk |