Skip to content

Commit f28abb9

Browse files
committed
LoongArch: Clarify 3 MSG interrupt features
LoongArch's MSG interrupt features are used across multiple subsystems. Clarify these features to avoid misuse, existing users will be adjusted if necessary. MSGINT: Infrastructure, means the CPU core supports message interupts. Indicated by CPUCFG1.MSGINT. AVECINT: AVEC interrupt controller based on MSGINT, means the CPU chip supports direct message interrupts. Indicated by IOCSR.FEATURES.DMSI. REDIRECTINT: REDIRECT interrupt controller based on MSGINT and AVECINT, means the CPU chip supports redirect message interrupts. Indicated by IOCSR.FEATURES.RMSI. For example: Loongson-3A5000/3C5000 doesn't support MSGINT/AVECINT/REDIRECTINT; Loongson-3A6000 supports MSGINT but doesn't support AVECINT/REDIRECTINT; Loongson-3C6000 supports MSGINT/AVECINT/REDIRECTINT. Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
1 parent fe4b3a3 commit f28abb9

4 files changed

Lines changed: 12 additions & 1 deletion

File tree

arch/loongarch/include/asm/cpu-features.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@
6767
#define cpu_has_hypervisor cpu_opt(LOONGARCH_CPU_HYPERVISOR)
6868
#define cpu_has_ptw cpu_opt(LOONGARCH_CPU_PTW)
6969
#define cpu_has_lspw cpu_opt(LOONGARCH_CPU_LSPW)
70+
#define cpu_has_msgint cpu_opt(LOONGARCH_CPU_MSGINT)
7071
#define cpu_has_avecint cpu_opt(LOONGARCH_CPU_AVECINT)
72+
#define cpu_has_redirectint cpu_opt(LOONGARCH_CPU_REDIRECTINT)
7173

7274
#endif /* __ASM_CPU_FEATURES_H */

arch/loongarch/include/asm/cpu.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,9 @@ enum cpu_type_enum {
101101
#define CPU_FEATURE_HYPERVISOR 26 /* CPU has hypervisor (running in VM) */
102102
#define CPU_FEATURE_PTW 27 /* CPU has hardware page table walker */
103103
#define CPU_FEATURE_LSPW 28 /* CPU has LSPW (lddir/ldpte instructions) */
104-
#define CPU_FEATURE_AVECINT 29 /* CPU has AVEC interrupt */
104+
#define CPU_FEATURE_MSGINT 29 /* CPU has MSG interrupt */
105+
#define CPU_FEATURE_AVECINT 30 /* CPU has AVEC interrupt */
106+
#define CPU_FEATURE_REDIRECTINT 31 /* CPU has interrupt remapping */
105107

106108
#define LOONGARCH_CPU_CPUCFG BIT_ULL(CPU_FEATURE_CPUCFG)
107109
#define LOONGARCH_CPU_LAM BIT_ULL(CPU_FEATURE_LAM)
@@ -132,6 +134,8 @@ enum cpu_type_enum {
132134
#define LOONGARCH_CPU_HYPERVISOR BIT_ULL(CPU_FEATURE_HYPERVISOR)
133135
#define LOONGARCH_CPU_PTW BIT_ULL(CPU_FEATURE_PTW)
134136
#define LOONGARCH_CPU_LSPW BIT_ULL(CPU_FEATURE_LSPW)
137+
#define LOONGARCH_CPU_MSGINT BIT_ULL(CPU_FEATURE_MSGINT)
135138
#define LOONGARCH_CPU_AVECINT BIT_ULL(CPU_FEATURE_AVECINT)
139+
#define LOONGARCH_CPU_REDIRECTINT BIT_ULL(CPU_FEATURE_REDIRECTINT)
136140

137141
#endif /* _ASM_CPU_H */

arch/loongarch/include/asm/loongarch.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1137,6 +1137,7 @@
11371137
#define IOCSRF_FLATMODE BIT_ULL(10)
11381138
#define IOCSRF_VM BIT_ULL(11)
11391139
#define IOCSRF_AVEC BIT_ULL(15)
1140+
#define IOCSRF_REDIRECT BIT_ULL(16)
11401141

11411142
#define LOONGARCH_IOCSR_VENDOR 0x10
11421143

arch/loongarch/kernel/cpu-probe.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,8 @@ static void cpu_probe_common(struct cpuinfo_loongarch *c)
157157
c->options |= LOONGARCH_CPU_TLB;
158158
if (config & CPUCFG1_IOCSR)
159159
c->options |= LOONGARCH_CPU_IOCSR;
160+
if (config & CPUCFG1_MSGINT)
161+
c->options |= LOONGARCH_CPU_MSGINT;
160162
if (config & CPUCFG1_UAL) {
161163
c->options |= LOONGARCH_CPU_UAL;
162164
elf_hwcap |= HWCAP_LOONGARCH_UAL;
@@ -331,6 +333,8 @@ static inline void cpu_probe_loongson(struct cpuinfo_loongarch *c, unsigned int
331333
c->options |= LOONGARCH_CPU_EIODECODE;
332334
if (config & IOCSRF_AVEC)
333335
c->options |= LOONGARCH_CPU_AVECINT;
336+
if (config & IOCSRF_REDIRECT)
337+
c->options |= LOONGARCH_CPU_REDIRECTINT;
334338
if (config & IOCSRF_VM)
335339
c->options |= LOONGARCH_CPU_HYPERVISOR;
336340
}

0 commit comments

Comments
 (0)