SPMD: Add support for SPCI_ID_GET
This patch introduces the `SPCI_ID_GET` interface which will return the ID of the calling SPCI component. Returns 0 for requests from the non-secure world and the SPCI component ID as specified in the manifest for secure world requests. Change-Id: Icf81eb1d0e1d7d5c521571e04972b6e2d356e0d1 Signed-off-by: Max Shvetsov <maksims.svecovs@arm.com> Signed-off-by: Marc Bonnici <marc.bonnici@arm.com>
This commit is contained in:
parent
f9ea3a6291
commit
ac03ac5ebb
|
@ -43,6 +43,11 @@ typedef struct spm_core_manifest_sect_attribute {
|
||||||
*/
|
*/
|
||||||
uint32_t binary_size;
|
uint32_t binary_size;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* ID of the SPMD (mandatory)
|
||||||
|
*/
|
||||||
|
uint16_t spmc_id;
|
||||||
|
|
||||||
} spmc_manifest_sect_attribute_t;
|
} spmc_manifest_sect_attribute_t;
|
||||||
|
|
||||||
#endif /* SPMC_MANIFEST_H */
|
#endif /* SPMC_MANIFEST_H */
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
compatible = "spci-core-manifest-1.0";
|
compatible = "spci-core-manifest-1.0";
|
||||||
|
|
||||||
attribute {
|
attribute {
|
||||||
|
spmc_id = <0x8000>;
|
||||||
maj_ver = <0x0>;
|
maj_ver = <0x0>;
|
||||||
min_ver = <0x9>;
|
min_ver = <0x9>;
|
||||||
exec_state = <0x0>;
|
exec_state = <0x0>;
|
||||||
|
|
|
@ -37,6 +37,12 @@ static int manifest_parse_attribute(spmc_manifest_sect_attribute_t *attr,
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rc = fdtw_read_cells(fdt, node, "spmc_id", 1, &attr->spmc_id);
|
||||||
|
if (rc) {
|
||||||
|
ERROR("Missing SPMC ID in manifest.\n");
|
||||||
|
return -ENOENT;
|
||||||
|
}
|
||||||
|
|
||||||
rc = fdtw_read_cells(fdt, node, "exec_state", 1, &attr->exec_state);
|
rc = fdtw_read_cells(fdt, node, "exec_state", 1, &attr->exec_state);
|
||||||
if (rc)
|
if (rc)
|
||||||
NOTICE("Execution state not specified in SPM core manifest.\n");
|
NOTICE("Execution state not specified in SPM core manifest.\n");
|
||||||
|
@ -55,6 +61,7 @@ static int manifest_parse_attribute(spmc_manifest_sect_attribute_t *attr,
|
||||||
|
|
||||||
VERBOSE("SPM core manifest attribute section:\n");
|
VERBOSE("SPM core manifest attribute section:\n");
|
||||||
VERBOSE(" version: %x.%x\n", attr->major_version, attr->minor_version);
|
VERBOSE(" version: %x.%x\n", attr->major_version, attr->minor_version);
|
||||||
|
VERBOSE(" spmc_id: %x\n", attr->spmc_id);
|
||||||
VERBOSE(" binary_size: 0x%x\n", attr->binary_size);
|
VERBOSE(" binary_size: 0x%x\n", attr->binary_size);
|
||||||
VERBOSE(" load_address: 0x%llx\n", attr->load_address);
|
VERBOSE(" load_address: 0x%llx\n", attr->load_address);
|
||||||
VERBOSE(" entrypoint: 0x%llx\n", attr->entrypoint);
|
VERBOSE(" entrypoint: 0x%llx\n", attr->entrypoint);
|
||||||
|
|
|
@ -162,6 +162,16 @@ static int spmd_spmc_init(void *rd_base, size_t rd_size)
|
||||||
INFO("SPM core run time EL%x.\n",
|
INFO("SPM core run time EL%x.\n",
|
||||||
SPMD_SPM_AT_SEL2 ? MODE_EL2 : MODE_EL1);
|
SPMD_SPM_AT_SEL2 ? MODE_EL2 : MODE_EL1);
|
||||||
|
|
||||||
|
/* Validate the SPMC ID, Ensure high bit is set */
|
||||||
|
if (!(spmc_attrs.spmc_id >> SPMC_SECURE_ID_SHIFT) &
|
||||||
|
SPMC_SECURE_ID_MASK) {
|
||||||
|
WARN("Invalid ID (0x%x) for SPMC.\n",
|
||||||
|
spmc_attrs.spmc_id);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
INFO("SPMC ID %x.\n", spmc_attrs.spmc_id);
|
||||||
|
|
||||||
/* Validate the SPM core execution state */
|
/* Validate the SPM core execution state */
|
||||||
if ((spmc_attrs.exec_state != MODE_RW_64) &&
|
if ((spmc_attrs.exec_state != MODE_RW_64) &&
|
||||||
(spmc_attrs.exec_state != MODE_RW_32)) {
|
(spmc_attrs.exec_state != MODE_RW_32)) {
|
||||||
|
@ -436,6 +446,26 @@ uint64_t spmd_smc_handler(uint32_t smc_fid, uint64_t x1, uint64_t x2,
|
||||||
|
|
||||||
break; /* not reached */
|
break; /* not reached */
|
||||||
|
|
||||||
|
case SPCI_ID_GET:
|
||||||
|
/*
|
||||||
|
* Returns the ID of the calling SPCI component.
|
||||||
|
*/
|
||||||
|
if (!secure_origin) {
|
||||||
|
SMC_RET8(handle, SPCI_SUCCESS_SMC32,
|
||||||
|
SPCI_TARGET_INFO_MBZ, SPCI_NS_ENDPOINT_ID,
|
||||||
|
SPCI_PARAM_MBZ, SPCI_PARAM_MBZ,
|
||||||
|
SPCI_PARAM_MBZ, SPCI_PARAM_MBZ,
|
||||||
|
SPCI_PARAM_MBZ);
|
||||||
|
} else {
|
||||||
|
SMC_RET8(handle, SPCI_SUCCESS_SMC32,
|
||||||
|
SPCI_TARGET_INFO_MBZ, spmc_attrs.spmc_id,
|
||||||
|
SPCI_PARAM_MBZ, SPCI_PARAM_MBZ,
|
||||||
|
SPCI_PARAM_MBZ, SPCI_PARAM_MBZ,
|
||||||
|
SPCI_PARAM_MBZ);
|
||||||
|
}
|
||||||
|
|
||||||
|
break; /* not reached */
|
||||||
|
|
||||||
case SPCI_RX_RELEASE:
|
case SPCI_RX_RELEASE:
|
||||||
case SPCI_RXTX_MAP_SMC32:
|
case SPCI_RXTX_MAP_SMC32:
|
||||||
case SPCI_RXTX_MAP_SMC64:
|
case SPCI_RXTX_MAP_SMC64:
|
||||||
|
|
|
@ -54,6 +54,15 @@ typedef struct spmd_spm_core_context {
|
||||||
spmc_state_t state;
|
spmc_state_t state;
|
||||||
} spmd_spm_core_context_t;
|
} spmd_spm_core_context_t;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Reserve ID for NS physical SPCI Endpoint.
|
||||||
|
*/
|
||||||
|
#define SPCI_NS_ENDPOINT_ID U(0)
|
||||||
|
|
||||||
|
/* Mask and shift to check valid secure SPCI Endpoint ID. */
|
||||||
|
#define SPMC_SECURE_ID_MASK 0x1
|
||||||
|
#define SPMC_SECURE_ID_SHIFT 15
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Data structure used by the SPM dispatcher (SPMD) in EL3 to track sequence of
|
* Data structure used by the SPM dispatcher (SPMD) in EL3 to track sequence of
|
||||||
* SPCI calls from lower ELs.
|
* SPCI calls from lower ELs.
|
||||||
|
|
Loading…
Reference in New Issue