@@ -63,51 +63,11 @@ static int zynqmp_pm_ret_code(u32 ret_status)
}
}
-static noinline int do_fw_call_fail(u64 arg0, u64 arg1, u64 arg2,
- u32 *ret_payload)
-{
- return -ENODEV;
-}
-
-/*
- * PM function call wrapper
- * Invoke do_fw_call_smc or do_fw_call_hvc, depending on the configuration
- */
-static int (*do_fw_call)(u64, u64, u64, u32 *ret_payload) = do_fw_call_fail;
-
-/**
- * do_fw_call_smc() - Call system-level platform management layer (SMC)
- * @arg0: Argument 0 to SMC call
- * @arg1: Argument 1 to SMC call
- * @arg2: Argument 2 to SMC call
- * @ret_payload: Returned value array
- *
- * Invoke platform management function via SMC call (no hypervisor present).
- *
- * Return: Returns status, either success or error+reason
- */
-static noinline int do_fw_call_smc(u64 arg0, u64 arg1, u64 arg2,
- u32 *ret_payload)
-{
- struct arm_smccc_res res;
-
- arm_smccc_smc(arg0, arg1, arg2, 0, 0, 0, 0, 0, &res);
-
- if (ret_payload) {
- ret_payload[0] = lower_32_bits(res.a0);
- ret_payload[1] = upper_32_bits(res.a0);
- ret_payload[2] = lower_32_bits(res.a1);
- ret_payload[3] = upper_32_bits(res.a1);
- }
-
- return zynqmp_pm_ret_code((enum pm_ret_status)res.a0);
-}
-
/**
- * do_fw_call_hvc() - Call system-level platform management layer (HVC)
- * @arg0: Argument 0 to HVC call
- * @arg1: Argument 1 to HVC call
- * @arg2: Argument 2 to HVC call
+ * do_fw_call() - Call system-level platform management layer
+ * @arg0: Argument 0 to HVC/SMC call
+ * @arg1: Argument 1 to HVC/SMC call
+ * @arg2: Argument 2 to HVC/SMC call
* @ret_payload: Returned value array
*
* Invoke platform management function via HVC
@@ -116,12 +76,13 @@ static noinline int do_fw_call_smc(u64 arg0, u64 arg1, u64 arg2,
*
* Return: Returns status, either success or error+reason
*/
-static noinline int do_fw_call_hvc(u64 arg0, u64 arg1, u64 arg2,
- u32 *ret_payload)
+static noinline int do_fw_call(u64 arg0, u64 arg1, u64 arg2, u32 *ret_payload)
{
struct arm_smccc_res res;
- arm_smccc_hvc(arg0, arg1, arg2, 0, 0, 0, 0, 0, &res);
+ if (arm_smccc_1_0_invoke(arg0, arg1, arg2, 0, 0, 0, 0, 0, &res) ==
+ SMCCC_CONDUIT_NONE)
+ return -ENODEV;
if (ret_payload) {
ret_payload[0] = lower_32_bits(res.a0);
@@ -287,36 +248,6 @@ static int zynqmp_pm_get_trustzone_version(u32 *version)
return ret;
}
-/**
- * get_set_conduit_method() - Choose SMC or HVC based communication
- * @np: Pointer to the device_node structure
- *
- * Use SMC or HVC-based functions to communicate with EL2/EL3.
- *
- * Return: Returns 0 on success or error code
- */
-static int get_set_conduit_method(struct device_node *np)
-{
- const char *method;
-
- if (of_property_read_string(np, "method", &method)) {
- pr_warn("%s missing \"method\" property\n", __func__);
- return -ENXIO;
- }
-
- if (!strcmp("hvc", method)) {
- do_fw_call = do_fw_call_hvc;
- } else if (!strcmp("smc", method)) {
- do_fw_call = do_fw_call_smc;
- } else {
- pr_warn("%s Invalid \"method\" property: %s\n",
- __func__, method);
- return -EINVAL;
- }
-
- return 0;
-}
-
/**
* zynqmp_pm_query_data() - Get query data from firmware
* @qdata: Variable to the zynqmp_pm_query_data structure
@@ -790,7 +721,7 @@ static int zynqmp_firmware_probe(struct platform_device *pdev)
}
of_node_put(np);
- ret = get_set_conduit_method(dev->of_node);
+ ret = devm_arm_smccc_1_0_set_conduit(dev);
if (ret)
return ret;
Change Xilinx Zynmp driver to use Arm SMCCC v1.0 helper functions. Main functional change is that SMCCC conduit method for ZynqMP firmware must be consistent with conduit methods registered by PSCI device that is early probed in case the later is enabled. Another functional change is an additional info level trace emitted by the device probe sequence: "probing for conduit method from DT.". Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org> --- drivers/firmware/xilinx/zynqmp.c | 87 ++++---------------------------- 1 file changed, 9 insertions(+), 78 deletions(-)