[PATCH] LoongArch: Expose LBT features in cpuinfo and ELF HWCAP

WANG Xuerui posted 1 patch 3 years, 5 months ago
arch/loongarch/kernel/cpu-probe.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
[PATCH] LoongArch: Expose LBT features in cpuinfo and ELF HWCAP
Posted by WANG Xuerui 3 years, 5 months ago
From: WANG Xuerui <git@xen0n.name>

Although proper context switching support for LBT is not present yet,
this fixes an apparent oversight where other similarly not-yet-supported
features e.g. LSX, LASX, Crypto, or LVZ are being reported but the LBT
ones are not.

Fixes: 628c3bb40e9a ("LoongArch: Add boot and setup routines")
Signed-off-by: WANG Xuerui <git@xen0n.name>
Cc: loongarch@lists.linux.dev
Cc: linux-kernel@vger.kernel.org
---
 arch/loongarch/kernel/cpu-probe.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/arch/loongarch/kernel/cpu-probe.c b/arch/loongarch/kernel/cpu-probe.c
index 529ab8f44ec6..82de5264d2c9 100644
--- a/arch/loongarch/kernel/cpu-probe.c
+++ b/arch/loongarch/kernel/cpu-probe.c
@@ -123,6 +123,18 @@ static void cpu_probe_common(struct cpuinfo_loongarch *c)
 		c->options |= LOONGARCH_CPU_LVZ;
 		elf_hwcap |= HWCAP_LOONGARCH_LVZ;
 	}
+	if (config & CPUCFG2_X86BT) {
+		c->options |= LOONGARCH_CPU_LBT_X86;
+		elf_hwcap |= HWCAP_LOONGARCH_LBT_X86;
+	}
+	if (config & CPUCFG2_ARMBT) {
+		c->options |= LOONGARCH_CPU_LBT_ARM;
+		elf_hwcap |= HWCAP_LOONGARCH_LBT_ARM;
+	}
+	if (config & CPUCFG2_MIPSBT) {
+		c->options |= LOONGARCH_CPU_LBT_MIPS;
+		elf_hwcap |= HWCAP_LOONGARCH_LBT_MIPS;
+	}
 
 	config = read_cpucfg(LOONGARCH_CPUCFG6);
 	if (config & CPUCFG6_PMP)
-- 
2.38.0