2024-05-13 01:12:56

by Bibo Mao

[permalink] [raw]
Subject: [PATCH 2/3] LoongArch: KVM: Add LBT feature detection with cpucfg

Loongson Binary Translation (LBT) feature is defined in register
cpucfg2. Here LBT capability detection for VM is added.

Signed-off-by: Bibo Mao <[email protected]>
---
arch/loongarch/kvm/vcpu.c | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/arch/loongarch/kvm/vcpu.c b/arch/loongarch/kvm/vcpu.c
index d93ec21269da..b2856539368a 100644
--- a/arch/loongarch/kvm/vcpu.c
+++ b/arch/loongarch/kvm/vcpu.c
@@ -532,6 +532,12 @@ static int _kvm_get_cpucfg_mask(int id, u64 *v)
*v |= CPUCFG2_LSX;
if (cpu_has_lasx)
*v |= CPUCFG2_LASX;
+ if (cpu_has_lbt_x86)
+ *v |= CPUCFG2_X86BT;
+ if (cpu_has_lbt_arm)
+ *v |= CPUCFG2_ARMBT;
+ if (cpu_has_lbt_mips)
+ *v |= CPUCFG2_MIPSBT;

return 0;
case LOONGARCH_CPUCFG3:
--
2.39.3