From: Jan Kiszka <[email protected]>

Jailhouse does not need this workaround as it isolates secrets via
CPU and, thus, cell-private mappings. However, guests may request
control over the workaround. As it is per CPU, we can grant access.

Signed-off-by: Jan Kiszka <[email protected]>
---
 hypervisor/arch/arm-common/include/asm/percpu.h | 3 ++-
 hypervisor/arch/arm-common/smccc.c              | 9 ++++++++-
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/hypervisor/arch/arm-common/include/asm/percpu.h 
b/hypervisor/arch/arm-common/include/asm/percpu.h
index 4b37e1be..a3e38fa0 100644
--- a/hypervisor/arch/arm-common/include/asm/percpu.h
+++ b/hypervisor/arch/arm-common/include/asm/percpu.h
@@ -16,7 +16,8 @@
 #define STACK_SIZE                     PAGE_SIZE

 #define ARM_PERCPU_FIELDS                                              \
-       bool smccc_has_workaround_1;
+       bool smccc_has_workaround_1;                                    \
+       bool smccc_has_workaround_2;

 #define ARCH_PUBLIC_PERCPU_FIELDS                                      \
        unsigned long mpidr;                                            \
diff --git a/hypervisor/arch/arm-common/smccc.c 
b/hypervisor/arch/arm-common/smccc.c
index bdbb067e..363cda1a 100644
--- a/hypervisor/arch/arm-common/smccc.c
+++ b/hypervisor/arch/arm-common/smccc.c
@@ -44,8 +44,10 @@ void smccc_discover(void)
                return;

        ret = smc_arg1(SMCCC_ARCH_FEATURES, SMCCC_ARCH_WORKAROUND_1);
-
        this_cpu_data()->smccc_has_workaround_1 = ret >= ARM_SMCCC_SUCCESS;
+
+       ret = smc_arg1(SMCCC_ARCH_FEATURES, SMCCC_ARCH_WORKAROUND_2);
+       this_cpu_data()->smccc_has_workaround_2 = ret >= ARM_SMCCC_SUCCESS;
 }

 static inline long handle_arch_features(u32 id)
@@ -77,6 +79,11 @@ static enum trap_return handle_arch(struct trap_context *ctx)
                *ret = handle_arch_features(ctx->regs[1]);
                break;

+       case SMCCC_ARCH_WORKAROUND_2:
+               if (!this_cpu_data()->smccc_has_workaround_2)
+                       return ARM_SMCCC_NOT_SUPPORTED;
+               return smc_arg1(SMCCC_ARCH_WORKAROUND_2, ctx->regs[1]);
+
        default:
                panic_printk("Unhandled SMC arch trap %lx\n", *ret);
                return TRAP_UNHANDLED;
--
2.26.2

-- 
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].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jailhouse-dev/4d759c5d5634bdbd56ef1e463be5736bb5d7ef9a.1609752982.git.jan.kiszka%40web.de.

Reply via email to