On Wed, Oct 3, 2018 at 2:27 PM, Jorge Ramirez-Ortiz jramirez@baylibre.com wrote:
I am upstreaming TF-A support for the Renesas R-car gen3 platforms [1].
In order to prevent the boot cpu from being switched off (hotpluged) I am having to work around the fact that OPTEE_OS does not support MIGRATE_INFO_TYPE or MIGRATE_INFO_UP_CPU.
Why should OP-TEE care about that?
Its SPD at TF-A level [2] returns that the TrustedOS if fully MP aware and has not special requirements for migration.
Isn't that true for upstream OP-TEE?
The work around I implemented (patch below and [3]) will query the platform whenever the opteed SPD indicates that it has no migration restrictions (which currently is always)
Is there any work ongoing on OPTEE_OS to support MIGRATE_INFO and update the TF-A SPD or am I missing some fundamental point?
No, there's no work ongoing in this area. Please elaborate on why this is needed.
Thanks, Jens
thanks Jorge
[1] https://github.com/ARM-software/arm-trusted-firmware/pull/1582 [2] https://github.com/ARM-software/arm-trusted-firmware/blob/master/services/sp... [3] https://github.com/ARM-software/arm-trusted-firmware/pull/1582/commits/9a7fe...
psci: implement platform hook to migrate_info
include/lib/psci/psci.h | 2 ++ lib/psci/psci_main.c | 35 ++++++++++++++++++++++++++++++++--- 2 files changed, 34 insertions(+), 3 deletions(-)
diff --git a/include/lib/psci/psci.h b/include/lib/psci/psci.h index b27e481..e705a81 100644 --- a/include/lib/psci/psci.h +++ b/include/lib/psci/psci.h @@ -322,12 +322,14 @@ typedef struct plat_psci_ops { int (*write_mem_protect)(int val); int (*system_reset2)(int is_vendor, int reset_type, u_register_t cookie);
int (*migrate_info)(u_register_t *mpidr);
} plat_psci_ops_t;
/*******************************************************************************
- Function & Data prototypes
******************************************************************************/ unsigned int psci_version(void); +int psci_migrate_info(u_register_t *mpidr); int psci_cpu_on(u_register_t target_cpu, uintptr_t entrypoint, u_register_t context_id); diff --git a/lib/psci/psci_main.c b/lib/psci/psci_main.c index fd822bc..ce5419a 100644 --- a/lib/psci/psci_main.c +++ b/lib/psci/psci_main.c @@ -44,6 +44,23 @@ int psci_cpu_on(u_register_t target_cpu, return psci_cpu_on_start(target_cpu, &ep); }
+int psci_platform_migrate_info(u_register_t *mpidr) +{
int rc;
if (psci_plat_pm_ops->migrate_info == NULL) {
/* no migrate restrictions */
return PSCI_TOS_NOT_PRESENT_MP;
}
rc = psci_plat_pm_ops->migrate_info(mpidr);
assert((rc == PSCI_TOS_UP_MIG_CAP) || (rc ==
PSCI_TOS_NOT_UP_MIG_CAP) ||
(rc == PSCI_TOS_NOT_PRESENT_MP) || (rc ==
PSCI_E_NOT_SUPPORTED));
return rc;
+}
unsigned int psci_version(void) { return PSCI_MAJOR_VER | PSCI_MINOR_VER; @@ -276,8 +293,14 @@ int psci_migrate(u_register_t target_cpu) int psci_migrate_info_type(void) { u_register_t resident_cpu_mpidr;
int rc;
rc = psci_spd_migrate_info(&resident_cpu_mpidr);
if ((rc != PSCI_TOS_NOT_UP_MIG_CAP) && (rc != PSCI_TOS_UP_MIG_CAP))
return psci_platform_migrate_info(NULL);
return rc;
return psci_spd_migrate_info(&resident_cpu_mpidr);
}
u_register_t psci_migrate_info_up_cpu(void) @@ -290,8 +313,14 @@ u_register_t psci_migrate_info_up_cpu(void) * psci_spd_migrate_info() returns. */ rc = psci_spd_migrate_info(&resident_cpu_mpidr);
if ((rc != PSCI_TOS_NOT_UP_MIG_CAP) && (rc != PSCI_TOS_UP_MIG_CAP))
return (u_register_t)(register_t) PSCI_E_INVALID_PARAMS;
if ((rc != PSCI_TOS_NOT_UP_MIG_CAP) && (rc != PSCI_TOS_UP_MIG_CAP))
{
rc = psci_platform_migrate_info(&resident_cpu_mpidr);
if ((rc != PSCI_TOS_NOT_UP_MIG_CAP) &&
(rc != PSCI_TOS_UP_MIG_CAP))
/* neither the SDP nor the platform have any
migration
restrictions: any core can be hotpluged */
return (u_register_t)(register_t)
PSCI_E_INVALID_PARAMS;
} return resident_cpu_mpidr;
}
2.7.4
Tee-dev mailing list Tee-dev@lists.linaro.org https://lists.linaro.org/mailman/listinfo/tee-dev