Workarounds for Spectre variant 2 or 4 vulnerabilities require some help from the firmware, so KVM implements an interface to provide that for guests. When such a guest is migrated, we want to make sure we don't loose the protection the guest relies on. This introduces two new firmware registers in KVM's GET/SET_ONE_REG interface, so userland can save the level of protection implemented by the hypervisor and used by the guest. Upon restoring these registers, we make sure we don't downgrade and reject any values that would mean weaker protection. There is some table in the code to describe the valid combinations. Patch 1 implements the two firmware registers, patch 2 adds the documentation. This solution is using two hardcoded firmware registers for that. Not sure if we should introduce something based on SMCCC instead, which would allow us to report implementation of any SMCCC based service in a generic way, or if this would be too generic. ARM(32) is a bit of a pain (again), as the firmware register interface is shared, but 32-bit does not implement all the workarounds. For now I stuffed two wrappers into kvm_emulate.h, which doesn't sound like the best solution. Happy to hear about better ideas. This has been tested with a hack to allow faking the protection level via a debugfs knob, then saving/restoring via some userland tool calling the GET_ONE_REG/SET_ONE_REG ioctls. Please have a look and comment! Cheers, Andre Andre Przywara (2): KVM: arm/arm64: Add save/restore support for firmware workaround state KVM: doc: add API documentation on the KVM_REG_ARM_WORKAROUNDS register Documentation/virtual/kvm/arm/psci.txt | 20 ++++ arch/arm/include/asm/kvm_emulate.h | 10 ++ arch/arm/include/uapi/asm/kvm.h | 9 ++ arch/arm64/include/asm/kvm_emulate.h | 14 +++ arch/arm64/include/uapi/asm/kvm.h | 9 ++ virt/kvm/arm/psci.c | 138 ++++++++++++++++++++++++- 6 files changed, 198 insertions(+), 2 deletions(-) -- 2.17.1 _______________________________________________ kvmarm mailing list kvmarm@xxxxxxxxxxxxxxxxxxxxx https://lists.cs.columbia.edu/mailman/listinfo/kvmarm