Skip to content

Commit b1388a9

Browse files
bibo-maochenhuacai
authored andcommitted
LoongArch: KVM: Move LBT capability check in exception handler
Like FPU exception handler, check LBT capability in the LBT exception handler rather than function kvm_own_lbt(). Signed-off-by: Bibo Mao <maobibo@loongson.cn> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
1 parent 37da26e commit b1388a9

2 files changed

Lines changed: 3 additions & 4 deletions

File tree

arch/loongarch/kvm/exit.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -820,8 +820,10 @@ static int kvm_handle_lasx_disabled(struct kvm_vcpu *vcpu, int ecode)
820820

821821
static int kvm_handle_lbt_disabled(struct kvm_vcpu *vcpu, int ecode)
822822
{
823-
if (kvm_own_lbt(vcpu))
823+
if (!kvm_guest_has_lbt(&vcpu->arch))
824824
kvm_queue_exception(vcpu, EXCCODE_INE, 0);
825+
else
826+
kvm_own_lbt(vcpu);
825827

826828
return RESUME_GUEST;
827829
}

arch/loongarch/kvm/vcpu.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1304,9 +1304,6 @@ int kvm_arch_vcpu_ioctl_set_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu)
13041304
#ifdef CONFIG_CPU_HAS_LBT
13051305
int kvm_own_lbt(struct kvm_vcpu *vcpu)
13061306
{
1307-
if (!kvm_guest_has_lbt(&vcpu->arch))
1308-
return -EINVAL;
1309-
13101307
preempt_disable();
13111308
if (!(vcpu->arch.aux_inuse & KVM_LARCH_LBT)) {
13121309
set_csr_euen(CSR_EUEN_LBTEN);

0 commit comments

Comments
 (0)