@@ -18,6 +18,7 @@
#include <xen/lib.h>
#include <xen/types.h>
#include <public/arch-arm/smccc.h>
+#include <asm/cpufeature.h>
#include <asm/monitor.h>
#include <asm/regs.h>
#include <asm/smccc.h>
@@ -93,8 +94,25 @@ static bool handle_arch(struct cpu_user_regs *regs)
return true;
case ARM_SMCCC_ARCH_FEATURES_FID:
- /* Nothing supported yet */
- set_user_reg(regs, 0, ARM_SMCCC_NOT_SUPPORTED);
+ {
+ uint32_t arch_func_id = get_user_reg(regs, 1);
+ int ret = ARM_SMCCC_NOT_SUPPORTED;
+
+ switch ( arch_func_id )
+ {
+ case ARM_SMCCC_ARCH_WORKAROUND_1_FID:
+ if ( cpus_have_cap(ARM_HARDEN_BRANCH_PREDICTOR) )
+ ret = 0;
+ break;
+ }
+
+ set_user_reg(regs, 0, ret);
+
+ return true;
+ }
+
+ case ARM_SMCCC_ARCH_WORKAROUND_1_FID:
+ /* No return value */
return true;
}
@@ -115,6 +115,12 @@ static inline uint32_t smccc_get_owner(register_t funcid)
ARM_SMCCC_OWNER_ARCH, \
0x1)
+#define ARM_SMCCC_ARCH_WORKAROUND_1_FID \
+ ARM_SMCCC_CALL_VAL(ARM_SMCCC_FAST_CALL, \
+ ARM_SMCCC_CONV_32, \
+ ARM_SMCCC_OWNER_ARCH, \
+ 0x8000)
+
/* SMCCC error codes */
#define ARM_SMCCC_ERR_UNKNOWN_FUNCTION (-1)
#define ARM_SMCCC_NOT_SUPPORTED (-1)