mirror of
https://github.com/torvalds/linux.git
synced 2026-05-27 16:44:58 +02:00
LoongArch: KVM: Move LSX capability check in exception handler
Like FPU exception handler, check LSX capability in the LSX exception handler rather than function kvm_own_lsx(). Since LSX capability in the function kvm_guest_has_lsx() implies FPU capability, only checking kvm_guest_has_lsx() is OK here. Signed-off-by: Bibo Mao <maobibo@loongson.cn> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
This commit is contained in:
parent
c5cb12b81a
commit
89b5dc5397
|
|
@ -792,8 +792,10 @@ static long kvm_save_notify(struct kvm_vcpu *vcpu)
|
|||
*/
|
||||
static int kvm_handle_lsx_disabled(struct kvm_vcpu *vcpu, int ecode)
|
||||
{
|
||||
if (kvm_own_lsx(vcpu))
|
||||
if (!kvm_guest_has_lsx(&vcpu->arch))
|
||||
kvm_queue_exception(vcpu, EXCCODE_INE, 0);
|
||||
else
|
||||
kvm_own_lsx(vcpu);
|
||||
|
||||
return RESUME_GUEST;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1376,9 +1376,6 @@ void kvm_own_fpu(struct kvm_vcpu *vcpu)
|
|||
/* Enable LSX and restore context */
|
||||
int kvm_own_lsx(struct kvm_vcpu *vcpu)
|
||||
{
|
||||
if (!kvm_guest_has_fpu(&vcpu->arch) || !kvm_guest_has_lsx(&vcpu->arch))
|
||||
return -EINVAL;
|
||||
|
||||
preempt_disable();
|
||||
|
||||
/* Enable LSX for guest */
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user