[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20260203033131.3372834-4-maobibo@loongson.cn>
Date: Tue, 3 Feb 2026 11:31:30 +0800
From: Bibo Mao <maobibo@...ngson.cn>
To: Huacai Chen <chenhuacai@...nel.org>,
WANG Xuerui <kernel@...0n.name>,
Tianrui Zhao <zhaotianrui@...ngson.cn>
Cc: loongarch@...ts.linux.dev,
linux-kernel@...r.kernel.org,
kvm@...r.kernel.org
Subject: [PATCH v3 3/4] LoongArch: KVM: Move LBT capability checking in LBT exception handler
Like FPU exception handler, check LBT capability in LBT exception
handler rather than function kvm_own_lbt().
Signed-off-by: Bibo Mao <maobibo@...ngson.cn>
---
arch/loongarch/kvm/exit.c | 4 +++-
arch/loongarch/kvm/vcpu.c | 3 ---
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 d91a1160a309..995461d724b5 100644
--- a/arch/loongarch/kvm/vcpu.c
+++ b/arch/loongarch/kvm/vcpu.c
@@ -1286,9 +1286,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);
--
2.39.3
Powered by blists - more mailing lists