mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-03-22 07:27:12 +08:00
LoongArch: KVM: Move LASX capability check in exception handler
Like FPU exception handler, check LASX capability in the LASX exception handler rather than function kvm_own_lasx(). Since LASX capability in the function kvm_guest_has_lasx() implies FPU and LSX capability, only checking kvm_guest_has_lasx() is OK here. Signed-off-by: Bibo Mao <maobibo@loongson.cn> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
This commit is contained in:
@@ -810,8 +810,10 @@ static int kvm_handle_lsx_disabled(struct kvm_vcpu *vcpu, int ecode)
|
||||
*/
|
||||
static int kvm_handle_lasx_disabled(struct kvm_vcpu *vcpu, int ecode)
|
||||
{
|
||||
if (kvm_own_lasx(vcpu))
|
||||
if (!kvm_guest_has_lasx(&vcpu->arch))
|
||||
kvm_queue_exception(vcpu, EXCCODE_INE, 0);
|
||||
else
|
||||
kvm_own_lasx(vcpu);
|
||||
|
||||
return RESUME_GUEST;
|
||||
}
|
||||
|
||||
@@ -1409,9 +1409,6 @@ int kvm_own_lsx(struct kvm_vcpu *vcpu)
|
||||
/* Enable LASX and restore context */
|
||||
int kvm_own_lasx(struct kvm_vcpu *vcpu)
|
||||
{
|
||||
if (!kvm_guest_has_fpu(&vcpu->arch) || !kvm_guest_has_lsx(&vcpu->arch) || !kvm_guest_has_lasx(&vcpu->arch))
|
||||
return -EINVAL;
|
||||
|
||||
preempt_disable();
|
||||
|
||||
kvm_check_fcsr(vcpu, vcpu->arch.fpu.fcsr);
|
||||
|
||||
Reference in New Issue
Block a user