File Index
Files and directories
Sign in
FILE

cpu-features.h

File preview with syntax highlighting.

linux-6.19.14/arch/loongarch/include/asm/cpu-features.h C
 1/* SPDX-License-Identifier: GPL-2.0 */
 2/*
 3 * Copyright (C) 2020-2022 Loongson Technology Corporation Limited
 4 *
 5 * Derived from MIPS:
 6 * Copyright (C) 2003, 2004 Ralf Baechle
 7 * Copyright (C) 2004  Maciej W. Rozycki
 8 */
 9#ifndef __ASM_CPU_FEATURES_H
10#define __ASM_CPU_FEATURES_H
11
12#include <asm/cpu.h>
13#include <asm/cpu-info.h>
14
15#define cpu_opt(opt)			(cpu_data[0].options & (opt))
16#define cpu_has(feat)			(cpu_data[0].options & BIT_ULL(feat))
17
18#define cpu_has_loongarch		(cpu_has_loongarch32 | cpu_has_loongarch64)
19#define cpu_has_loongarch32		(cpu_data[0].isa_level & LOONGARCH_CPU_ISA_32BIT)
20#define cpu_has_loongarch64		(cpu_data[0].isa_level & LOONGARCH_CPU_ISA_64BIT)
21
22#ifdef CONFIG_32BIT
23# define cpu_vabits			31
24# define cpu_pabits			31
25#endif
26
27#ifdef CONFIG_64BIT
28# define cpu_vabits			cpu_data[0].vabits
29# define cpu_pabits			cpu_data[0].pabits
30#endif
31
32/*
33 * SMP assumption: Options of CPU 0 are a superset of all processors.
34 * This is true for all known LoongArch systems.
35 */
36#define cpu_has_cpucfg		cpu_opt(LOONGARCH_CPU_CPUCFG)
37#define cpu_has_lam		cpu_opt(LOONGARCH_CPU_LAM)
38#define cpu_has_ual		cpu_opt(LOONGARCH_CPU_UAL)
39#define cpu_has_fpu		cpu_opt(LOONGARCH_CPU_FPU)
40#define cpu_has_lsx		cpu_opt(LOONGARCH_CPU_LSX)
41#define cpu_has_lasx		cpu_opt(LOONGARCH_CPU_LASX)
42#define cpu_has_crc32		cpu_opt(LOONGARCH_CPU_CRC32)
43#define cpu_has_complex		cpu_opt(LOONGARCH_CPU_COMPLEX)
44#define cpu_has_crypto		cpu_opt(LOONGARCH_CPU_CRYPTO)
45#define cpu_has_lvz		cpu_opt(LOONGARCH_CPU_LVZ)
46#define cpu_has_lbt_x86		cpu_opt(LOONGARCH_CPU_LBT_X86)
47#define cpu_has_lbt_arm		cpu_opt(LOONGARCH_CPU_LBT_ARM)
48#define cpu_has_lbt_mips	cpu_opt(LOONGARCH_CPU_LBT_MIPS)
49#define cpu_has_lbt		(cpu_has_lbt_x86|cpu_has_lbt_arm|cpu_has_lbt_mips)
50#define cpu_has_csr		cpu_opt(LOONGARCH_CPU_CSR)
51#define cpu_has_iocsr		cpu_opt(LOONGARCH_CPU_IOCSR)
52#define cpu_has_tlb		cpu_opt(LOONGARCH_CPU_TLB)
53#define cpu_has_watch		cpu_opt(LOONGARCH_CPU_WATCH)
54#define cpu_has_vint		cpu_opt(LOONGARCH_CPU_VINT)
55#define cpu_has_csripi		cpu_opt(LOONGARCH_CPU_CSRIPI)
56#define cpu_has_extioi		cpu_opt(LOONGARCH_CPU_EXTIOI)
57#define cpu_has_prefetch	cpu_opt(LOONGARCH_CPU_PREFETCH)
58#define cpu_has_pmp		cpu_opt(LOONGARCH_CPU_PMP)
59#define cpu_has_perf		cpu_opt(LOONGARCH_CPU_PMP)
60#define cpu_has_scalefreq	cpu_opt(LOONGARCH_CPU_SCALEFREQ)
61#define cpu_has_flatmode	cpu_opt(LOONGARCH_CPU_FLATMODE)
62#define cpu_has_eiodecode	cpu_opt(LOONGARCH_CPU_EIODECODE)
63#define cpu_has_guestid		cpu_opt(LOONGARCH_CPU_GUESTID)
64#define cpu_has_hypervisor	cpu_opt(LOONGARCH_CPU_HYPERVISOR)
65#define cpu_has_ptw		cpu_opt(LOONGARCH_CPU_PTW)
66#define cpu_has_lspw		cpu_opt(LOONGARCH_CPU_LSPW)
67#define cpu_has_msgint		cpu_opt(LOONGARCH_CPU_MSGINT)
68#define cpu_has_avecint		cpu_opt(LOONGARCH_CPU_AVECINT)
69#define cpu_has_redirectint	cpu_opt(LOONGARCH_CPU_REDIRECTINT)
70
71#endif /* __ASM_CPU_FEATURES_H */
~/ Read-only file preview.