diff options
author | Andre Przywara <andre.przywara@arm.com> | 2019-05-03 10:27:48 -0400 |
---|---|---|
committer | Marc Zyngier <marc.zyngier@arm.com> | 2019-07-05 08:56:27 -0400 |
commit | c118bbb52743df70e6297671606c1c08edc659fe (patch) | |
tree | 3058edcfc6f08fa7b68f9e5ff037c9dc219255a6 /virt | |
parent | 80f393a23be68e2f8a0f74258d6155438c200bbd (diff) |
arm64: KVM: Propagate full Spectre v2 workaround state to KVM guests
Recent commits added the explicit notion of "workaround not required" to
the state of the Spectre v2 (aka. BP_HARDENING) workaround, where we
just had "needed" and "unknown" before.
Export this knowledge to the rest of the kernel and enhance the existing
kvm_arm_harden_branch_predictor() to report this new state as well.
Export this new state to guests when they use KVM's firmware interface
emulation.
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Steven Price <steven.price@arm.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Diffstat (limited to 'virt')
-rw-r--r-- | virt/kvm/arm/psci.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/virt/kvm/arm/psci.c b/virt/kvm/arm/psci.c index be3c9cdca9f3..355b9e38a42d 100644 --- a/virt/kvm/arm/psci.c +++ b/virt/kvm/arm/psci.c | |||
@@ -401,8 +401,16 @@ int kvm_hvc_call_handler(struct kvm_vcpu *vcpu) | |||
401 | feature = smccc_get_arg1(vcpu); | 401 | feature = smccc_get_arg1(vcpu); |
402 | switch(feature) { | 402 | switch(feature) { |
403 | case ARM_SMCCC_ARCH_WORKAROUND_1: | 403 | case ARM_SMCCC_ARCH_WORKAROUND_1: |
404 | if (kvm_arm_harden_branch_predictor()) | 404 | switch (kvm_arm_harden_branch_predictor()) { |
405 | case KVM_BP_HARDEN_UNKNOWN: | ||
406 | break; | ||
407 | case KVM_BP_HARDEN_WA_NEEDED: | ||
405 | val = SMCCC_RET_SUCCESS; | 408 | val = SMCCC_RET_SUCCESS; |
409 | break; | ||
410 | case KVM_BP_HARDEN_NOT_REQUIRED: | ||
411 | val = SMCCC_RET_NOT_REQUIRED; | ||
412 | break; | ||
413 | } | ||
406 | break; | 414 | break; |
407 | case ARM_SMCCC_ARCH_WORKAROUND_2: | 415 | case ARM_SMCCC_ARCH_WORKAROUND_2: |
408 | switch (kvm_arm_have_ssbd()) { | 416 | switch (kvm_arm_have_ssbd()) { |