summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorBibo Mao <maobibo@loongson.cn>2026-02-06 09:27:47 +0800
committerHuacai Chen <chenhuacai@loongson.cn>2026-02-06 09:27:47 +0800
commitb1388a9598fbe77b193cbb8368eed46e982212c5 (patch)
tree0cdab9c5ed5a57632e48cb4c9576c59d09464b04 /arch
parent37da26e0e8396def86ff4ca70ece0a5f5619dbd4 (diff)
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>
Diffstat (limited to 'arch')
-rw-r--r--arch/loongarch/kvm/exit.c4
-rw-r--r--arch/loongarch/kvm/vcpu.c3
2 files changed, 3 insertions, 4 deletions
diff --git a/arch/loongarch/kvm/exit.c b/arch/loongarch/kvm/exit.c
index 74b427287e96..65ec10a7245a 100644
--- a/arch/loongarch/kvm/exit.c
+++ b/arch/loongarch/kvm/exit.c
@@ -820,8 +820,10 @@ static int kvm_handle_lasx_disabled(struct kvm_vcpu *vcpu, int ecode)
static int kvm_handle_lbt_disabled(struct kvm_vcpu *vcpu, int ecode)
{
- if (kvm_own_lbt(vcpu))
+ if (!kvm_guest_has_lbt(&vcpu->arch))
kvm_queue_exception(vcpu, EXCCODE_INE, 0);
+ else
+ kvm_own_lbt(vcpu);
return RESUME_GUEST;
}
diff --git a/arch/loongarch/kvm/vcpu.c b/arch/loongarch/kvm/vcpu.c
index 53d720a15617..07c427a5e156 100644
--- a/arch/loongarch/kvm/vcpu.c
+++ b/arch/loongarch/kvm/vcpu.c
@@ -1304,9 +1304,6 @@ int kvm_arch_vcpu_ioctl_set_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu)
#ifdef CONFIG_CPU_HAS_LBT
int kvm_own_lbt(struct kvm_vcpu *vcpu)
{
- if (!kvm_guest_has_lbt(&vcpu->arch))
- return -EINVAL;
-
preempt_disable();
if (!(vcpu->arch.aux_inuse & KVM_LARCH_LBT)) {
set_csr_euen(CSR_EUEN_LBTEN);