From 8991eed7439cb565da505a2bf88e9ac87ad79c1c Mon Sep 17 00:00:00 2001 From: Soby Mathew Date: Thu, 23 Oct 2014 10:35:34 +0100 Subject: Rework the PSCI migrate APIs This patch reworks the PSCI MIGRATE, MIGRATE_INFO_TYPE and MIGRATE_INFO_UP_CPU support for Trusted Firmware. The implementation does the appropriate validation of parameters and invokes the appropriate hook exported by the SPD. The TSP is a MP Trusted OS. Hence the ability to actually migrate a Trusted OS has not been implemented. The corresponding function is not populated in the spd_pm_hooks structure for the TSPD. The `spd_pm_ops_t` has undergone changes with this patch. SPD PORTS MAY NEED TO BE UPDATED. Fixes ARM-software/tf-issues#249 Change-Id: Iabd87521bf7c530a5e4506b6d3bfd4f1bf87604f --- services/std_svc/psci/psci_common.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'services/std_svc/psci/psci_common.c') diff --git a/services/std_svc/psci/psci_common.c b/services/std_svc/psci/psci_common.c index d8c8618f..898a343d 100644 --- a/services/std_svc/psci/psci_common.c +++ b/services/std_svc/psci/psci_common.c @@ -561,6 +561,29 @@ void psci_register_spd_pm_hook(const spd_pm_ops_t *pm) psci_spd_pm = pm; } +/******************************************************************************* + * This function invokes the migrate info hook in the spd_pm_ops. It performs + * the necessary return value validation. If the Secure Payload is UP and + * migrate capable, it returns the mpidr of the CPU on which the Secure payload + * is resident through the mpidr parameter. Else the value of the parameter on + * return is undefined. + ******************************************************************************/ +int psci_spd_migrate_info(uint64_t *mpidr) +{ + int rc; + + if (!psci_spd_pm || !psci_spd_pm->svc_migrate_info) + return PSCI_E_NOT_SUPPORTED; + + rc = psci_spd_pm->svc_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; +} + + /******************************************************************************* * This function prints the state of all affinity instances present in the * system -- cgit From 90e8258eec95bcad556426597489a34208232e39 Mon Sep 17 00:00:00 2001 From: Soby Mathew Date: Wed, 7 Jan 2015 11:10:22 +0000 Subject: Implement PSCI_FEATURES API This patch implements the PSCI_FEATURES function which is a mandatory API in the PSCI 1.0 specification. A capability variable is constructed during initialization by examining the plat_pm_ops and spd_pm_ops exported by the platform and the Secure Payload Dispatcher. This is used by the PSCI FEATURES function to determine which PSCI APIs are supported by the platform. Change-Id: I147ffc1bd5d90b469bd3cc4bbe0a20e95c247df7 --- services/std_svc/psci/psci_common.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'services/std_svc/psci/psci_common.c') diff --git a/services/std_svc/psci/psci_common.c b/services/std_svc/psci/psci_common.c index 898a343d..a31643e4 100644 --- a/services/std_svc/psci/psci_common.c +++ b/services/std_svc/psci/psci_common.c @@ -558,7 +558,15 @@ void psci_afflvl_power_on_finish(int start_afflvl, ******************************************************************************/ void psci_register_spd_pm_hook(const spd_pm_ops_t *pm) { + assert(pm); psci_spd_pm = pm; + + if (pm->svc_migrate) + psci_caps |= define_psci_cap(PSCI_MIG_AARCH64); + + if (pm->svc_migrate_info) + psci_caps |= define_psci_cap(PSCI_MIG_INFO_UP_CPU_AARCH64) + | define_psci_cap(PSCI_MIG_INFO_TYPE); } /******************************************************************************* -- cgit