fix(simd): mask out SMCCC SVE hint bit
The SMCCC SVE hint bit is relevant to the SPMC when an SMC is propagated
from a caller in the normal world. For an SMC/HVC originating from a VM
or SP vCPU, mask out the SVE hint bit as Hafnium only supports context
switching Adv. SIMD for VM/SP vCPUs. There's no reason for a VM or SP
to set the hint bit as VMs/SPs do not support SVE/SME.
Change-Id: Ic1462816cecd953dba7589d511c43aca74c35cac
Signed-off-by: Olivier Deprez <olivier.deprez@arm.com>
diff --git a/src/arch/aarch64/hypervisor/handler.c b/src/arch/aarch64/hypervisor/handler.c
index 976fd09..cc3fa98 100644
--- a/src/arch/aarch64/hypervisor/handler.c
+++ b/src/arch/aarch64/hypervisor/handler.c
@@ -881,6 +881,9 @@
struct ffa_value args = arch_regs_get_args(&vcpu->regs);
struct vcpu *next = NULL;
+ /* Mask out SMCCC SVE hint bit from function id. */
+ args.func &= ~SMCCC_SVE_HINT_MASK;
+
if (hvc_smc_handler(args, vcpu, &next)) {
return next;
}
@@ -898,12 +901,14 @@
*/
struct vcpu *smc_handler_from_nwd(struct vcpu *vcpu)
{
- struct ffa_value args;
+ struct ffa_value args = arch_regs_get_args(&vcpu->regs);
struct vcpu *next = NULL;
plat_save_ns_simd_context(vcpu);
- args = arch_regs_get_args(&vcpu->regs);
+ /* Mask out SMCCC SVE hint bit from function id. */
+ args.func &= ~SMCCC_SVE_HINT_MASK;
+
if (hvc_smc_handler(args, vcpu, &next)) {
return next;
}
@@ -1087,6 +1092,9 @@
struct ffa_value args = arch_regs_get_args(&vcpu->regs);
struct vcpu *next = NULL;
+ /* Mask out SMCCC SVE hint bit from function id. */
+ args.func &= ~SMCCC_SVE_HINT_MASK;
+
if (hvc_smc_handler(args, vcpu, &next)) {
return next;
}