From 40edd3864fb2e4a40ac932f7058b8ac04ea93e35 Mon Sep 17 00:00:00 2001 From: Aaron Durbin Date: Fri, 19 Sep 2014 17:08:20 -0500 Subject: arm64: fix smc bugs in secmon Two things: 1. Not returning once setting the return state. 2. mempcy(x, y, ARRAY_SIZE(x)) is not memcpy(x, y, sizeof(x)) With these 2 changes arguments and results are being processed correctly. BUG=chrome-os-partner:32112 BRANCH=None TEST=Built and brought up SMP using PSCI. Change-Id: If76a207e1a434a4c08faaa535f069d7386481e9e Signed-off-by: Patrick Georgi Original-Commit-Id: 42d540afd4e6ea2b34cf3632ad2c683fcaa063c8 Original-Change-Id: I656b9c11e3bc07cc1664789a600eb88afd639f93 Original-Signed-off-by: Aaron Durbin Original-Reviewed-on: https://chromium-review.googlesource.com/218847 Original-Reviewed-by: Furquan Shaikh Reviewed-on: http://review.coreboot.org/9094 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer --- src/arch/arm64/armv8/secmon/smc.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/arch/arm64') diff --git a/src/arch/arm64/armv8/secmon/smc.c b/src/arch/arm64/armv8/secmon/smc.c index 3bb52f0311..8aa6d41e7d 100644 --- a/src/arch/arm64/armv8/secmon/smc.c +++ b/src/arch/arm64/armv8/secmon/smc.c @@ -84,7 +84,7 @@ int smc_register_range(uint32_t min, uint32_t max, int (*h)(struct smc_call *)) static int smc_cleanup(struct exc_state *state, struct smc_call *smc, int ret) { - memcpy(&state->regs.x, &smc->results, ARRAY_SIZE(smc->results)); + memcpy(&state->regs.x, &smc->results, sizeof(smc->results)); return ret; } @@ -103,15 +103,15 @@ static int smc_handler(struct exc_state *state, uint64_t vector_id) uint32_t esr; struct smc_range *r; - memcpy(&smc->args, &state->regs.x, ARRAY_SIZE(smc->args)); - memcpy(&smc->results, &state->regs.x, ARRAY_SIZE(smc->results)); + memcpy(&smc->args, &state->regs.x, sizeof(smc->args)); + memcpy(&smc->results, &state->regs.x, sizeof(smc->results)); esr = raw_read_esr_el3(); exception_class = (esr >> 26) & 0x3f; /* No support for 32-bit SMC calls. */ if (exception_class == EC_SMC32) - smc_return_with_error(state, smc); + return smc_return_with_error(state, smc); /* Check to ensure this is an SMC from aarch64. */ if (exception_class != EC_SMC64) @@ -119,7 +119,7 @@ static int smc_handler(struct exc_state *state, uint64_t vector_id) /* Ensure immediate value is 0. */ if ((esr & 0xffff) != 0) - smc_return_with_error(state, smc); + return smc_return_with_error(state, smc); r = smc_handler_by_function(smc_function_id(smc)); -- cgit v1.2.3