diff options
author | Marc Zyngier <maz@kernel.org> | 2023-04-05 13:48:58 +0200 |
---|---|---|
committer | Marc Zyngier <maz@kernel.org> | 2023-04-05 20:20:23 +0200 |
commit | 0e5c9a9d6548e9b178d4696c696ae4a21c39ae58 (patch) | |
tree | edaae95c99c0540db8de44a759e8f5242be57e68 /arch/arm64/include | |
parent | KVM: selftests: Add test for SMCCC filter (diff) | |
download | linux-0e5c9a9d6548e9b178d4696c696ae4a21c39ae58.tar.xz linux-0e5c9a9d6548e9b178d4696c696ae4a21c39ae58.zip |
KVM: arm64: Expose SMC/HVC width to userspace
When returning to userspace to handle a SMCCC call, we consistently
set PC to point to the instruction immediately after the HVC/SMC.
However, should userspace need to know the exact address of the
trapping instruction, it needs to know about the *size* of that
instruction. For AArch64, this is pretty easy. For AArch32, this
is a bit more funky, as Thumb has 16bit encodings for both HVC
and SMC.
Expose this to userspace with a new flag that directly derives
from ESR_EL2.IL. Also update the documentation to reflect the PC
state at the point of exit.
Finally, this fixes a small buglet where the hypercall.{args,ret}
fields would not be cleared on exit, and could contain some
random junk.
Reviewed-by: Oliver Upton <oliver.upton@linux.dev>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/86pm8iv8tj.wl-maz@kernel.org
Diffstat (limited to 'arch/arm64/include')
-rw-r--r-- | arch/arm64/include/uapi/asm/kvm.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/arch/arm64/include/uapi/asm/kvm.h b/arch/arm64/include/uapi/asm/kvm.h index 3dcfa4bfdf83..b1c1edf85480 100644 --- a/arch/arm64/include/uapi/asm/kvm.h +++ b/arch/arm64/include/uapi/asm/kvm.h @@ -491,7 +491,8 @@ struct kvm_smccc_filter { }; /* arm64-specific KVM_EXIT_HYPERCALL flags */ -#define KVM_HYPERCALL_EXIT_SMC (1U << 0) +#define KVM_HYPERCALL_EXIT_SMC (1U << 0) +#define KVM_HYPERCALL_EXIT_16BIT (1U << 1) #endif |