Merge changes from topic "mb/tos-fw-config-load-refactor" into integration

* changes:
  feat(spmd): map SPMC manifest region as EL3_PAS
  feat(fvp): update device tree with load addresses of TOS_FW config
  refactor(fvp): rename the DTB info structure member
  feat(fconf): rename 'ns-load-address' to 'secondary-load-address'
This commit is contained in:
Sandrine Bailleux 2023-02-10 10:05:12 +01:00 committed by TrustedFirmware Code Review
commit af4fee04b9
7 changed files with 41 additions and 33 deletions

View file

@ -20,7 +20,9 @@ contains, and must be formed with the following fields:
- load-address [mandatory]
- value type: <u64>
- Physical loading base address of the configuration.
- Physical loading base address of the configuration.
If secondary-load-address is also provided (see below), then this is the
primary load address.
- max-size [mandatory]
- value type: <u32>
@ -30,10 +32,11 @@ contains, and must be formed with the following fields:
- value type: <u32>
- Image ID of the configuration.
- ns-load-address [optional]
- secondary-load-address [optional]
- value type: <u64>
- Physical loading base address of the configuration in the non-secure
memory.
Only needed by those configuration files which require being loaded
in secure memory (at load-address) as well as in non-secure memory
e.g. HW_CONFIG
- A platform uses this physical address to copy the configuration to
another location during the boot-flow.
--------------
*Copyright (c) 2023, Arm Limited and Contributors. All rights reserved.*

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2022, Arm Limited. All rights reserved.
* Copyright (c) 2019-2023, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@ -19,12 +19,11 @@ struct dyn_cfg_dtb_info_t {
uint32_t config_max_size;
unsigned int config_id;
/*
* Load address in non-secure memory. Only needed by those
* configuration files which require being loaded in secure
* memory (at config_addr) as well as in non-secure memory
* A platform uses this address to copy the configuration
* to another location during the boot-flow.
* - e.g. HW_CONFIG
*/
uintptr_t ns_config_addr;
uintptr_t secondary_config_addr;
};
unsigned int dyn_cfg_dtb_info_get_index(unsigned int config_id);
@ -32,7 +31,7 @@ struct dyn_cfg_dtb_info_t *dyn_cfg_dtb_info_getter(unsigned int config_id);
int fconf_populate_dtb_registry(uintptr_t config);
/* Set config information in global DTB array */
void set_config_info(uintptr_t config_addr, uintptr_t ns_config_addr,
void set_config_info(uintptr_t config_addr, uintptr_t secondary_config_addr,
uint32_t config_max_size,
unsigned int config_id);

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2022, Arm Limited. All rights reserved.
* Copyright (c) 2019-2023, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@ -31,7 +31,7 @@ static OBJECT_POOL_ARRAY(dtb_info_pool, dtb_infos);
* This function is used to alloc memory for config information from
* global pool and set the configuration information.
*/
void set_config_info(uintptr_t config_addr, uintptr_t ns_config_addr,
void set_config_info(uintptr_t config_addr, uintptr_t secondary_config_addr,
uint32_t config_max_size,
unsigned int config_id)
{
@ -39,7 +39,7 @@ void set_config_info(uintptr_t config_addr, uintptr_t ns_config_addr,
dtb_info = pool_alloc(&dtb_info_pool);
dtb_info->config_addr = config_addr;
dtb_info->ns_config_addr = ns_config_addr;
dtb_info->secondary_config_addr = secondary_config_addr;
dtb_info->config_max_size = config_max_size;
dtb_info->config_id = config_id;
}
@ -106,7 +106,7 @@ int fconf_populate_dtb_registry(uintptr_t config)
fdt_for_each_subnode(child, dtb, node) {
uint32_t config_max_size, config_id;
uintptr_t config_addr;
uintptr_t ns_config_addr = ~0UL;
uintptr_t secondary_config_addr = ~0UL;
uint64_t val64;
/* Read configuration dtb information */
@ -134,14 +134,16 @@ int fconf_populate_dtb_registry(uintptr_t config)
VERBOSE("\tmax-size = 0x%x\n", config_max_size);
VERBOSE("\tconfig-id = %u\n", config_id);
rc = fdt_read_uint64(dtb, child, "ns-load-address", &val64);
rc = fdt_read_uint64(dtb, child, "secondary-load-address",
&val64);
if (rc == 0) {
ns_config_addr = (uintptr_t)val64;
VERBOSE("\tns-load-address = %lx\n", ns_config_addr);
secondary_config_addr = (uintptr_t)val64;
VERBOSE("\tsecondary-load-address = %lx\n",
secondary_config_addr);
}
set_config_info(config_addr, ns_config_addr, config_max_size,
config_id);
set_config_info(config_addr, secondary_config_addr,
config_max_size, config_id);
}
if ((child < 0) && (child != -FDT_ERR_NOTFOUND)) {

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2022, Arm Limited. All rights reserved.
* Copyright (c) 2019-2023, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@ -22,7 +22,7 @@
load-address = <0x0 0x07f00000>;
max-size = <0x00100000>;
id = <HW_CONFIG_ID>;
ns-load-address = <0x0 0x82000000>;
secondary-load-address = <0x0 0x82000000>;
};
/*
@ -40,7 +40,11 @@
/* If required, SPD should enable loading of trusted OS fw config */
#if defined(SPD_tspd) || defined(SPD_spmd)
tos_fw-config {
load-address = <0x0 0x04001500>;
#if ENABLE_RME
secondary-load-address = <0x0 0x7e00000>;
#endif /* ENABLE_RME */
max-size = <0xB00>;
id = <TOS_FW_CONFIG_ID>;
};

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2013-2022, Arm Limited and Contributors. All rights reserved.
* Copyright (c) 2013-2023, Arm Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@ -82,7 +82,7 @@ struct bl_params *plat_get_next_bl_params(void)
assert(param_node != NULL);
/* Copy HW config from Secure address to NS address */
memcpy((void *)hw_config_info->ns_config_addr,
memcpy((void *)hw_config_info->secondary_config_addr,
(void *)hw_config_info->config_addr,
(size_t)param_node->image_info.image_size);
@ -91,14 +91,14 @@ struct bl_params *plat_get_next_bl_params(void)
* a possibility to use HW-config without cache and MMU enabled
* at BL33
*/
flush_dcache_range(hw_config_info->ns_config_addr,
flush_dcache_range(hw_config_info->secondary_config_addr,
param_node->image_info.image_size);
param_node = get_bl_mem_params_node(BL33_IMAGE_ID);
assert(param_node != NULL);
/* Update BL33's ep info with NS HW config address */
param_node->ep_info.args.arg1 = hw_config_info->ns_config_addr;
param_node->ep_info.args.arg1 = hw_config_info->secondary_config_addr;
#endif /* !BL2_AT_EL3 && !EL3_PAYLOAD_BASE */
return arm_bl_params;

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2013-2022, ARM Limited and Contributors. All rights reserved.
* Copyright (c) 2013-2023, Arm Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@ -45,8 +45,8 @@ void __init bl31_early_platform_setup2(u_register_t arg0,
*/
hw_config_info = FCONF_GET_PROPERTY(dyn_cfg, dtb, HW_CONFIG_ID);
assert(hw_config_info != NULL);
assert(hw_config_info->ns_config_addr != 0UL);
arg2 = hw_config_info->ns_config_addr;
assert(hw_config_info->secondary_config_addr != 0UL);
arg2 = hw_config_info->secondary_config_addr;
#endif /* !RESET_TO_BL31 && !BL2_AT_EL3 */
arm_bl31_early_platform_setup((void *)arg0, arg1, arg2, (void *)arg3);

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2020, Arm Limited. All rights reserved.
* Copyright (c) 2020-2023, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@ -150,7 +150,7 @@ int plat_spm_core_manifest_load(spmc_manifest_attribute_t *manifest,
rc = mmap_add_dynamic_region((unsigned long long)pm_base_align,
pm_base_align,
PAGE_SIZE,
MT_RO_DATA);
MT_RO_DATA | EL3_PAS);
if (rc != 0) {
ERROR("Error while mapping SPM Core manifest (%d).\n", rc);
return rc;