From 911b1edba8d4085db32c966f9a04d1367c7d12d5 Mon Sep 17 00:00:00 2001 From: Xianglai Li Date: Thu, 9 Jan 2025 16:58:04 +0800 Subject: [PATCH] anolis: LoongArch: KVM: enable ptw for kvm ANBZ: #13344 Add the ptw feature bit to cpucfg Signed-off-by: Xianglai Li Link: https://gitee.com/anolis/cloud-kernel/pulls/4463 --- arch/loongarch/kvm/exit.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/loongarch/kvm/exit.c b/arch/loongarch/kvm/exit.c index 19cb22da35de..5579ee8afedc 100644 --- a/arch/loongarch/kvm/exit.c +++ b/arch/loongarch/kvm/exit.c @@ -44,6 +44,8 @@ static int kvm_emu_cpucfg(struct kvm_vcpu *vcpu, larch_inst inst) switch (index) { case 0 ... (KVM_MAX_CPUCFG_REGS - 1): vcpu->arch.gprs[rd] = vcpu->arch.cpucfg[index]; + if (cpu_has_ptw && (index == LOONGARCH_CPUCFG2)) + vcpu->arch.gprs[rd] |= CPUCFG2_PTW; break; case CPUCFG_KVM_SIG: /* CPUCFG emulation between 0x40000000 -- 0x400000ff */ -- Gitee