Don't modify the FID when forwarding SMCs.
If the VM called as 32-bit, it should be forwarded as such. The same
goes for 64-bit. The causes problems when the target doesn't accept both
versions.
Change-Id: I229b489030bf84a0093254acda224645746600e0
diff --git a/src/arch/aarch64/hypervisor/handler.c b/src/arch/aarch64/hypervisor/handler.c
index 0658051..4f4ec44 100644
--- a/src/arch/aarch64/hypervisor/handler.c
+++ b/src/arch/aarch64/hypervisor/handler.c
@@ -263,9 +263,9 @@
uint32_t client_id = vcpu->vm->id;
if (smc_check_client_privileges(vcpu)) {
- *ret = smc64(func, vcpu->regs.r[1], vcpu->regs.r[2],
- vcpu->regs.r[3], vcpu->regs.r[4], vcpu->regs.r[5],
- vcpu->regs.r[6], client_id);
+ *ret = smc_forward(func, vcpu->regs.r[1], vcpu->regs.r[2],
+ vcpu->regs.r[3], vcpu->regs.r[4],
+ vcpu->regs.r[5], vcpu->regs.r[6], client_id);
return true;
}
diff --git a/src/arch/aarch64/smc.c b/src/arch/aarch64/smc.c
index cb49389..7772fdf 100644
--- a/src/arch/aarch64/smc.c
+++ b/src/arch/aarch64/smc.c
@@ -18,24 +18,28 @@
#include <stdint.h>
-smc_res_t smc32_internal(uint32_t func, uint32_t arg0, uint32_t arg1,
- uint32_t arg2, uint32_t arg3, uint32_t arg4,
- uint32_t arg5, uint32_t caller_id);
+smc_res_t smc_internal(uint32_t func, uint64_t arg0, uint64_t arg1,
+ uint64_t arg2, uint64_t arg3, uint64_t arg4,
+ uint64_t arg5, uint32_t caller_id);
smc_res_t smc32(uint32_t func, uint32_t arg0, uint32_t arg1, uint32_t arg2,
uint32_t arg3, uint32_t arg4, uint32_t arg5, uint32_t caller_id)
{
- return smc32_internal(func | SMCCC_32_BIT, arg0, arg1, arg2, arg3, arg4,
- arg5, caller_id);
+ return smc_internal(func | SMCCC_32_BIT, arg0, arg1, arg2, arg3, arg4,
+ arg5, caller_id);
}
-smc_res_t smc64_internal(uint32_t func, uint64_t arg0, uint64_t arg1,
- uint64_t arg2, uint64_t arg3, uint64_t arg4,
- uint64_t arg5, uint32_t caller_id);
-
smc_res_t smc64(uint32_t func, uint64_t arg0, uint64_t arg1, uint64_t arg2,
uint64_t arg3, uint64_t arg4, uint64_t arg5, uint32_t caller_id)
{
- return smc64_internal(func | SMCCC_64_BIT, arg0, arg1, arg2, arg3, arg4,
- arg5, caller_id);
+ return smc_internal(func | SMCCC_64_BIT, arg0, arg1, arg2, arg3, arg4,
+ arg5, caller_id);
+}
+
+smc_res_t smc_forward(uint32_t func, uint64_t arg0, uint64_t arg1,
+ uint64_t arg2, uint64_t arg3, uint64_t arg4,
+ uint64_t arg5, uint32_t caller_id)
+{
+ return smc_internal(func, arg0, arg1, arg2, arg3, arg4, arg5,
+ caller_id);
}
diff --git a/src/arch/aarch64/smc.h b/src/arch/aarch64/smc.h
index 96d7f20..93847fa 100644
--- a/src/arch/aarch64/smc.h
+++ b/src/arch/aarch64/smc.h
@@ -61,3 +61,7 @@
smc_res_t smc64(uint32_t func, uint64_t arg0, uint64_t arg1, uint64_t arg2,
uint64_t arg3, uint64_t arg4, uint64_t arg5,
uint32_t caller_id);
+
+smc_res_t smc_forward(uint32_t func, uint64_t arg0, uint64_t arg1,
+ uint64_t arg2, uint64_t arg3, uint64_t arg4,
+ uint64_t arg5, uint32_t caller_id);
diff --git a/src/arch/aarch64/smc_internal.S b/src/arch/aarch64/smc_internal.S
index c49e6cd..093fade 100644
--- a/src/arch/aarch64/smc_internal.S
+++ b/src/arch/aarch64/smc_internal.S
@@ -14,12 +14,10 @@
* limitations under the License.
*/
-.section .text.smc, "ax"
-.global smc32_internal
-.global smc64_internal
+.section .text.smc_internal, "ax"
+.global smc_internal
-smc32_internal:
-smc64_internal:
+smc_internal:
str x8, [sp, #-16] ! /* AArch64 stack pointer alignment is 16 bytes */
smc #0
ldr x8, [sp], #16