mirror of
https://github.com/torvalds/linux.git
synced 2026-06-08 14:42:37 +02:00
selftests: kvm: fix state save/load on processors without XSAVE
[ Upstream commit 54577e5018 ]
state_test and smm_test are failing on older processors that do not
have xcr0. This is because on those processor KVM does provide
support for KVM_GET/SET_XSAVE (to avoid having to rely on the older
KVM_GET/SET_FPU) but not for KVM_GET/SET_XCRS.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
08c2052815
commit
6cb9f8d60f
|
|
@ -809,9 +809,11 @@ struct kvm_x86_state *vcpu_save_state(struct kvm_vm *vm, uint32_t vcpuid)
|
|||
TEST_ASSERT(r == 0, "Unexpected result from KVM_GET_XSAVE, r: %i",
|
||||
r);
|
||||
|
||||
r = ioctl(vcpu->fd, KVM_GET_XCRS, &state->xcrs);
|
||||
TEST_ASSERT(r == 0, "Unexpected result from KVM_GET_XCRS, r: %i",
|
||||
r);
|
||||
if (kvm_check_cap(KVM_CAP_XCRS)) {
|
||||
r = ioctl(vcpu->fd, KVM_GET_XCRS, &state->xcrs);
|
||||
TEST_ASSERT(r == 0, "Unexpected result from KVM_GET_XCRS, r: %i",
|
||||
r);
|
||||
}
|
||||
|
||||
r = ioctl(vcpu->fd, KVM_GET_SREGS, &state->sregs);
|
||||
TEST_ASSERT(r == 0, "Unexpected result from KVM_GET_SREGS, r: %i",
|
||||
|
|
@ -858,9 +860,11 @@ void vcpu_load_state(struct kvm_vm *vm, uint32_t vcpuid, struct kvm_x86_state *s
|
|||
TEST_ASSERT(r == 0, "Unexpected result from KVM_SET_XSAVE, r: %i",
|
||||
r);
|
||||
|
||||
r = ioctl(vcpu->fd, KVM_SET_XCRS, &state->xcrs);
|
||||
TEST_ASSERT(r == 0, "Unexpected result from KVM_SET_XCRS, r: %i",
|
||||
r);
|
||||
if (kvm_check_cap(KVM_CAP_XCRS)) {
|
||||
r = ioctl(vcpu->fd, KVM_SET_XCRS, &state->xcrs);
|
||||
TEST_ASSERT(r == 0, "Unexpected result from KVM_SET_XCRS, r: %i",
|
||||
r);
|
||||
}
|
||||
|
||||
r = ioctl(vcpu->fd, KVM_SET_SREGS, &state->sregs);
|
||||
TEST_ASSERT(r == 0, "Unexpected result from KVM_SET_SREGS, r: %i",
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user