Finally, report supported features to guests. This will only affect
non-root cells. The root-cell boots with absence of jailhouse and will,
thus, use the features it already discovered.

This is not the case for non-root cells. Report availability of
mitigations properly.

Signed-off-by: Ralf Ramsauer <[email protected]>
---
 hypervisor/arch/arm-common/smccc.c | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/hypervisor/arch/arm-common/smccc.c 
b/hypervisor/arch/arm-common/smccc.c
index 37c05b42..4d0392f9 100644
--- a/hypervisor/arch/arm-common/smccc.c
+++ b/hypervisor/arch/arm-common/smccc.c
@@ -47,6 +47,21 @@ void smccc_discover(void)
        this_cpu_data()->smccc_has_workaround_1 = ret >= ARM_SMCCC_SUCCESS;
 }
 
+static inline long handle_arch_features(u32 id)
+{
+       switch (id) {
+       case SMCCC_ARCH_FEATURES:
+               return ARM_SMCCC_SUCCESS;
+
+       case SMCCC_ARCH_WORKAROUND_1:
+               return this_cpu_data()->smccc_has_workaround_1 ?
+                       ARM_SMCCC_SUCCESS : ARM_SMCCC_NOT_SUPPORTED;
+
+       default:
+               return ARM_SMCCC_NOT_SUPPORTED;
+       }
+}
+
 static long handle_arch(struct trap_context *ctx)
 {
        u32 function_id = ctx->regs[0];
@@ -55,8 +70,9 @@ static long handle_arch(struct trap_context *ctx)
        case SMCCC_VERSION:
                return ARM_SMCCC_VERSION_1_1;
 
-       /* No features supported yet */
        case SMCCC_ARCH_FEATURES:
+               return handle_arch_features(ctx->regs[1]);
+
        default:
                return ARM_SMCCC_NOT_SUPPORTED;
        }
-- 
2.20.1

-- 
You received this message because you are subscribed to the Google Groups 
"Jailhouse" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to