aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Burton <paul.burton@mips.com>2017-06-12 14:54:23 -0400
committerPaul Burton <paul.burton@mips.com>2018-07-24 17:09:13 -0400
commit93e01942a6eb1ce730b42158d0d6c6531fe29ca0 (patch)
tree000cbf6bc7b216cb325f613c3174a2196bf96970
parentc24f5762d374b7f2aae31b7a393bdfa66ed06d8b (diff)
MIPS: Hardcode cpu_has_* where known at compile time due to ISA
Many architectural features have over time moved from being optional to either be required or removed by newer architecture releases. This means that in many cases we can know at compile time whether a feature will be supported or not purely due to the knowledge we have about the ISA the kernel build is targeting. This patch introduces a bunch of utility macros for checking for supported options, ASEs & combinations of those with ISA revisions. It then makes use of these in the default definitions of cpu_has_* macros. The result is that many of the macros become compile-time constant, allowing more optimisation opportunities for the compiler - particularly with kernels built for later ISA revisions. To demonstrate the effect of this patch, the following table shows the size in bytes of the kernel binary as reported by scripts/bloat-o-meter for v4.12-rc4 maltasmvp_defconfig kernels with & without this patch. A variant of maltasmvp_defconfig with CONFIG_CPU_MIPS32_R6 selected is also shown, to demonstrate that MIPSr6 systems benefit more due to extra features becoming required by that architecture revision. Builds of pistachio_defconfig are also shown, as although this is a MIPSr2 platform it doesn't hardcode any features in a machine-specific cpu-feature-overrides.h, which allows it to gain more from this patch than the equivalent Malta r2 build. Config | Before | After | Change ----------------|---------|---------|--------- maltasmvp | 7248316 | 7247714 | -602 maltasmvp + r6 | 6955595 | 6950777 | -4818 pistachio | 8650977 | 8363898 | -287079 Signed-off-by: Paul Burton <paul.burton@mips.com> Patchwork: https://patchwork.linux-mips.org/patch/16360/ Cc: Joshua Kinard <kumba@gentoo.org> Cc: Ralf Baechle <ralf@linux-mips.org> Cc: linux-mips@linux-mips.org
-rw-r--r--arch/mips/include/asm/cpu-features.h176
1 files changed, 107 insertions, 69 deletions
diff --git a/arch/mips/include/asm/cpu-features.h b/arch/mips/include/asm/cpu-features.h
index 9cdb4e4ce258..0edba3e75747 100644
--- a/arch/mips/include/asm/cpu-features.h
+++ b/arch/mips/include/asm/cpu-features.h
@@ -14,39 +14,77 @@
14#include <asm/isa-rev.h> 14#include <asm/isa-rev.h>
15#include <cpu-feature-overrides.h> 15#include <cpu-feature-overrides.h>
16 16
17#define __ase(ase) (cpu_data[0].ases & (ase))
18#define __opt(opt) (cpu_data[0].options & (opt))
19
20/*
21 * Check if MIPS_ISA_REV is >= isa *and* an option or ASE is detected during
22 * boot (typically by cpu_probe()).
23 *
24 * Note that these should only be used in cases where a kernel built for an
25 * older ISA *cannot* run on a CPU which supports the feature in question. For
26 * example this may be used for features introduced with MIPSr6, since a kernel
27 * built for an older ISA cannot run on a MIPSr6 CPU. This should not be used
28 * for MIPSr2 features however, since a MIPSr1 or earlier kernel might run on a
29 * MIPSr2 CPU.
30 */
31#define __isa_ge_and_ase(isa, ase) ((MIPS_ISA_REV >= (isa)) && __ase(ase))
32#define __isa_ge_and_opt(isa, opt) ((MIPS_ISA_REV >= (isa)) && __opt(opt))
33
34/*
35 * Check if MIPS_ISA_REV is >= isa *or* an option or ASE is detected during
36 * boot (typically by cpu_probe()).
37 *
38 * These are for use with features that are optional up until a particular ISA
39 * revision & then become required.
40 */
41#define __isa_ge_or_ase(isa, ase) ((MIPS_ISA_REV >= (isa)) || __ase(ase))
42#define __isa_ge_or_opt(isa, opt) ((MIPS_ISA_REV >= (isa)) || __opt(opt))
43
44/*
45 * Check if MIPS_ISA_REV is < isa *and* an option or ASE is detected during
46 * boot (typically by cpu_probe()).
47 *
48 * These are for use with features that are optional up until a particular ISA
49 * revision & are then removed - ie. no longer present in any CPU implementing
50 * the given ISA revision.
51 */
52#define __isa_lt_and_ase(isa, ase) ((MIPS_ISA_REV < (isa)) && __ase(ase))
53#define __isa_lt_and_opt(isa, opt) ((MIPS_ISA_REV < (isa)) && __opt(opt))
54
17/* 55/*
18 * SMP assumption: Options of CPU 0 are a superset of all processors. 56 * SMP assumption: Options of CPU 0 are a superset of all processors.
19 * This is true for all known MIPS systems. 57 * This is true for all known MIPS systems.
20 */ 58 */
21#ifndef cpu_has_tlb 59#ifndef cpu_has_tlb
22#define cpu_has_tlb (cpu_data[0].options & MIPS_CPU_TLB) 60#define cpu_has_tlb __opt(MIPS_CPU_TLB)
23#endif 61#endif
24#ifndef cpu_has_ftlb 62#ifndef cpu_has_ftlb
25#define cpu_has_ftlb (cpu_data[0].options & MIPS_CPU_FTLB) 63#define cpu_has_ftlb __opt(MIPS_CPU_FTLB)
26#endif 64#endif
27#ifndef cpu_has_tlbinv 65#ifndef cpu_has_tlbinv
28#define cpu_has_tlbinv (cpu_data[0].options & MIPS_CPU_TLBINV) 66#define cpu_has_tlbinv __opt(MIPS_CPU_TLBINV)
29#endif 67#endif
30#ifndef cpu_has_segments 68#ifndef cpu_has_segments
31#define cpu_has_segments (cpu_data[0].options & MIPS_CPU_SEGMENTS) 69#define cpu_has_segments __opt(MIPS_CPU_SEGMENTS)
32#endif 70#endif
33#ifndef cpu_has_eva 71#ifndef cpu_has_eva
34#define cpu_has_eva (cpu_data[0].options & MIPS_CPU_EVA) 72#define cpu_has_eva __opt(MIPS_CPU_EVA)
35#endif 73#endif
36#ifndef cpu_has_htw 74#ifndef cpu_has_htw
37#define cpu_has_htw (cpu_data[0].options & MIPS_CPU_HTW) 75#define cpu_has_htw __opt(MIPS_CPU_HTW)
38#endif 76#endif
39#ifndef cpu_has_ldpte 77#ifndef cpu_has_ldpte
40#define cpu_has_ldpte (cpu_data[0].options & MIPS_CPU_LDPTE) 78#define cpu_has_ldpte __opt(MIPS_CPU_LDPTE)
41#endif 79#endif
42#ifndef cpu_has_rixiex 80#ifndef cpu_has_rixiex
43#define cpu_has_rixiex (cpu_data[0].options & MIPS_CPU_RIXIEX) 81#define cpu_has_rixiex __isa_ge_or_opt(6, MIPS_CPU_RIXIEX)
44#endif 82#endif
45#ifndef cpu_has_maar 83#ifndef cpu_has_maar
46#define cpu_has_maar (cpu_data[0].options & MIPS_CPU_MAAR) 84#define cpu_has_maar __opt(MIPS_CPU_MAAR)
47#endif 85#endif
48#ifndef cpu_has_rw_llb 86#ifndef cpu_has_rw_llb
49#define cpu_has_rw_llb (cpu_data[0].options & MIPS_CPU_RW_LLB) 87#define cpu_has_rw_llb __isa_ge_or_opt(6, MIPS_CPU_RW_LLB)
50#endif 88#endif
51 89
52/* 90/*
@@ -59,18 +97,18 @@
59#define cpu_has_3kex (!cpu_has_4kex) 97#define cpu_has_3kex (!cpu_has_4kex)
60#endif 98#endif
61#ifndef cpu_has_4kex 99#ifndef cpu_has_4kex
62#define cpu_has_4kex (cpu_data[0].options & MIPS_CPU_4KEX) 100#define cpu_has_4kex __isa_ge_or_opt(1, MIPS_CPU_4KEX)
63#endif 101#endif
64#ifndef cpu_has_3k_cache 102#ifndef cpu_has_3k_cache
65#define cpu_has_3k_cache (cpu_data[0].options & MIPS_CPU_3K_CACHE) 103#define cpu_has_3k_cache __isa_lt_and_opt(1, MIPS_CPU_3K_CACHE)
66#endif 104#endif
67#define cpu_has_6k_cache 0 105#define cpu_has_6k_cache 0
68#define cpu_has_8k_cache 0 106#define cpu_has_8k_cache 0
69#ifndef cpu_has_4k_cache 107#ifndef cpu_has_4k_cache
70#define cpu_has_4k_cache (cpu_data[0].options & MIPS_CPU_4K_CACHE) 108#define cpu_has_4k_cache __isa_ge_or_opt(1, MIPS_CPU_4K_CACHE)
71#endif 109#endif
72#ifndef cpu_has_tx39_cache 110#ifndef cpu_has_tx39_cache
73#define cpu_has_tx39_cache (cpu_data[0].options & MIPS_CPU_TX39_CACHE) 111#define cpu_has_tx39_cache __opt(MIPS_CPU_TX39_CACHE)
74#endif 112#endif
75#ifndef cpu_has_octeon_cache 113#ifndef cpu_has_octeon_cache
76#define cpu_has_octeon_cache 0 114#define cpu_has_octeon_cache 0
@@ -83,92 +121,92 @@
83#define raw_cpu_has_fpu cpu_has_fpu 121#define raw_cpu_has_fpu cpu_has_fpu
84#endif 122#endif
85#ifndef cpu_has_32fpr 123#ifndef cpu_has_32fpr
86#define cpu_has_32fpr (cpu_data[0].options & MIPS_CPU_32FPR) 124#define cpu_has_32fpr __isa_ge_or_opt(1, MIPS_CPU_32FPR)
87#endif 125#endif
88#ifndef cpu_has_counter 126#ifndef cpu_has_counter
89#define cpu_has_counter (cpu_data[0].options & MIPS_CPU_COUNTER) 127#define cpu_has_counter __opt(MIPS_CPU_COUNTER)
90#endif 128#endif
91#ifndef cpu_has_watch 129#ifndef cpu_has_watch
92#define cpu_has_watch (cpu_data[0].options & MIPS_CPU_WATCH) 130#define cpu_has_watch __opt(MIPS_CPU_WATCH)
93#endif 131#endif
94#ifndef cpu_has_divec 132#ifndef cpu_has_divec
95#define cpu_has_divec (cpu_data[0].options & MIPS_CPU_DIVEC) 133#define cpu_has_divec __isa_ge_or_opt(1, MIPS_CPU_DIVEC)
96#endif 134#endif
97#ifndef cpu_has_vce 135#ifndef cpu_has_vce
98#define cpu_has_vce (cpu_data[0].options & MIPS_CPU_VCE) 136#define cpu_has_vce __opt(MIPS_CPU_VCE)
99#endif 137#endif
100#ifndef cpu_has_cache_cdex_p 138#ifndef cpu_has_cache_cdex_p
101#define cpu_has_cache_cdex_p (cpu_data[0].options & MIPS_CPU_CACHE_CDEX_P) 139#define cpu_has_cache_cdex_p __opt(MIPS_CPU_CACHE_CDEX_P)
102#endif 140#endif
103#ifndef cpu_has_cache_cdex_s 141#ifndef cpu_has_cache_cdex_s
104#define cpu_has_cache_cdex_s (cpu_data[0].options & MIPS_CPU_CACHE_CDEX_S) 142#define cpu_has_cache_cdex_s __opt(MIPS_CPU_CACHE_CDEX_S)
105#endif 143#endif
106#ifndef cpu_has_prefetch 144#ifndef cpu_has_prefetch
107#define cpu_has_prefetch (cpu_data[0].options & MIPS_CPU_PREFETCH) 145#define cpu_has_prefetch __isa_ge_or_opt(1, MIPS_CPU_PREFETCH)
108#endif 146#endif
109#ifndef cpu_has_mcheck 147#ifndef cpu_has_mcheck
110#define cpu_has_mcheck (cpu_data[0].options & MIPS_CPU_MCHECK) 148#define cpu_has_mcheck __isa_ge_or_opt(1, MIPS_CPU_MCHECK)
111#endif 149#endif
112#ifndef cpu_has_ejtag 150#ifndef cpu_has_ejtag
113#define cpu_has_ejtag (cpu_data[0].options & MIPS_CPU_EJTAG) 151#define cpu_has_ejtag __opt(MIPS_CPU_EJTAG)
114#endif 152#endif
115#ifndef cpu_has_llsc 153#ifndef cpu_has_llsc
116#define cpu_has_llsc (cpu_data[0].options & MIPS_CPU_LLSC) 154#define cpu_has_llsc __isa_ge_or_opt(1, MIPS_CPU_LLSC)
117#endif 155#endif
118#ifndef cpu_has_bp_ghist 156#ifndef cpu_has_bp_ghist
119#define cpu_has_bp_ghist (cpu_data[0].options & MIPS_CPU_BP_GHIST) 157#define cpu_has_bp_ghist __opt(MIPS_CPU_BP_GHIST)
120#endif 158#endif
121#ifndef kernel_uses_llsc 159#ifndef kernel_uses_llsc
122#define kernel_uses_llsc cpu_has_llsc 160#define kernel_uses_llsc cpu_has_llsc
123#endif 161#endif
124#ifndef cpu_has_guestctl0ext 162#ifndef cpu_has_guestctl0ext
125#define cpu_has_guestctl0ext (cpu_data[0].options & MIPS_CPU_GUESTCTL0EXT) 163#define cpu_has_guestctl0ext __opt(MIPS_CPU_GUESTCTL0EXT)
126#endif 164#endif
127#ifndef cpu_has_guestctl1 165#ifndef cpu_has_guestctl1
128#define cpu_has_guestctl1 (cpu_data[0].options & MIPS_CPU_GUESTCTL1) 166#define cpu_has_guestctl1 __opt(MIPS_CPU_GUESTCTL1)
129#endif 167#endif
130#ifndef cpu_has_guestctl2 168#ifndef cpu_has_guestctl2
131#define cpu_has_guestctl2 (cpu_data[0].options & MIPS_CPU_GUESTCTL2) 169#define cpu_has_guestctl2 __opt(MIPS_CPU_GUESTCTL2)
132#endif 170#endif
133#ifndef cpu_has_guestid 171#ifndef cpu_has_guestid
134#define cpu_has_guestid (cpu_data[0].options & MIPS_CPU_GUESTID) 172#define cpu_has_guestid __opt(MIPS_CPU_GUESTID)
135#endif 173#endif
136#ifndef cpu_has_drg 174#ifndef cpu_has_drg
137#define cpu_has_drg (cpu_data[0].options & MIPS_CPU_DRG) 175#define cpu_has_drg __opt(MIPS_CPU_DRG)
138#endif 176#endif
139#ifndef cpu_has_mips16 177#ifndef cpu_has_mips16
140#define cpu_has_mips16 (cpu_data[0].ases & MIPS_ASE_MIPS16) 178#define cpu_has_mips16 __isa_lt_and_ase(6, MIPS_ASE_MIPS16)
141#endif 179#endif
142#ifndef cpu_has_mips16e2 180#ifndef cpu_has_mips16e2
143#define cpu_has_mips16e2 (cpu_data[0].ases & MIPS_ASE_MIPS16E2) 181#define cpu_has_mips16e2 __isa_lt_and_ase(6, MIPS_ASE_MIPS16E2)
144#endif 182#endif
145#ifndef cpu_has_mdmx 183#ifndef cpu_has_mdmx
146#define cpu_has_mdmx (cpu_data[0].ases & MIPS_ASE_MDMX) 184#define cpu_has_mdmx __isa_lt_and_ase(6, MIPS_ASE_MDMX)
147#endif 185#endif
148#ifndef cpu_has_mips3d 186#ifndef cpu_has_mips3d
149#define cpu_has_mips3d (cpu_data[0].ases & MIPS_ASE_MIPS3D) 187#define cpu_has_mips3d __isa_lt_and_ase(6, MIPS_ASE_MIPS3D)
150#endif 188#endif
151#ifndef cpu_has_smartmips 189#ifndef cpu_has_smartmips
152#define cpu_has_smartmips (cpu_data[0].ases & MIPS_ASE_SMARTMIPS) 190#define cpu_has_smartmips __isa_lt_and_ase(6, MIPS_ASE_SMARTMIPS)
153#endif 191#endif
154 192
155#ifndef cpu_has_rixi 193#ifndef cpu_has_rixi
156#define cpu_has_rixi (cpu_data[0].options & MIPS_CPU_RIXI) 194#define cpu_has_rixi __isa_ge_or_opt(6, MIPS_CPU_RIXI)
157#endif 195#endif
158 196
159#ifndef cpu_has_mmips 197#ifndef cpu_has_mmips
160# ifdef CONFIG_SYS_SUPPORTS_MICROMIPS 198# ifdef CONFIG_SYS_SUPPORTS_MICROMIPS
161# define cpu_has_mmips (cpu_data[0].options & MIPS_CPU_MICROMIPS) 199# define cpu_has_mmips __opt(MIPS_CPU_MICROMIPS)
162# else 200# else
163# define cpu_has_mmips 0 201# define cpu_has_mmips 0
164# endif 202# endif
165#endif 203#endif
166 204
167#ifndef cpu_has_lpa 205#ifndef cpu_has_lpa
168#define cpu_has_lpa (cpu_data[0].options & MIPS_CPU_LPA) 206#define cpu_has_lpa __opt(MIPS_CPU_LPA)
169#endif 207#endif
170#ifndef cpu_has_mvh 208#ifndef cpu_has_mvh
171#define cpu_has_mvh (cpu_data[0].options & MIPS_CPU_MVH) 209#define cpu_has_mvh __opt(MIPS_CPU_MVH)
172#endif 210#endif
173#ifndef cpu_has_xpa 211#ifndef cpu_has_xpa
174#define cpu_has_xpa (cpu_has_lpa && cpu_has_mvh) 212#define cpu_has_xpa (cpu_has_lpa && cpu_has_mvh)
@@ -338,32 +376,32 @@
338#endif 376#endif
339 377
340#ifndef cpu_has_dsp 378#ifndef cpu_has_dsp
341#define cpu_has_dsp (cpu_data[0].ases & MIPS_ASE_DSP) 379#define cpu_has_dsp __ase(MIPS_ASE_DSP)
342#endif 380#endif
343 381
344#ifndef cpu_has_dsp2 382#ifndef cpu_has_dsp2
345#define cpu_has_dsp2 (cpu_data[0].ases & MIPS_ASE_DSP2P) 383#define cpu_has_dsp2 __ase(MIPS_ASE_DSP2P)
346#endif 384#endif
347 385
348#ifndef cpu_has_dsp3 386#ifndef cpu_has_dsp3
349#define cpu_has_dsp3 (cpu_data[0].ases & MIPS_ASE_DSP3) 387#define cpu_has_dsp3 __ase(MIPS_ASE_DSP3)
350#endif 388#endif
351 389
352#ifndef cpu_has_mipsmt 390#ifndef cpu_has_mipsmt
353#define cpu_has_mipsmt (cpu_data[0].ases & MIPS_ASE_MIPSMT) 391#define cpu_has_mipsmt __isa_lt_and_ase(6, MIPS_ASE_MIPSMT)
354#endif 392#endif
355 393
356#ifndef cpu_has_vp 394#ifndef cpu_has_vp
357#define cpu_has_vp (cpu_data[0].options & MIPS_CPU_VP) 395#define cpu_has_vp __isa_ge_and_opt(6, MIPS_CPU_VP)
358#endif 396#endif
359 397
360#ifndef cpu_has_userlocal 398#ifndef cpu_has_userlocal
361#define cpu_has_userlocal (cpu_data[0].options & MIPS_CPU_ULRI) 399#define cpu_has_userlocal __isa_ge_or_opt(6, MIPS_CPU_ULRI)
362#endif 400#endif
363 401
364#ifdef CONFIG_32BIT 402#ifdef CONFIG_32BIT
365# ifndef cpu_has_nofpuex 403# ifndef cpu_has_nofpuex
366# define cpu_has_nofpuex (cpu_data[0].options & MIPS_CPU_NOFPUEX) 404# define cpu_has_nofpuex __isa_lt_and_opt(1, MIPS_CPU_NOFPUEX)
367# endif 405# endif
368# ifndef cpu_has_64bits 406# ifndef cpu_has_64bits
369# define cpu_has_64bits (cpu_data[0].isa_level & MIPS_CPU_ISA_64BIT) 407# define cpu_has_64bits (cpu_data[0].isa_level & MIPS_CPU_ISA_64BIT)
@@ -405,19 +443,19 @@
405#endif 443#endif
406 444
407#if defined(CONFIG_CPU_MIPSR2_IRQ_VI) && !defined(cpu_has_vint) 445#if defined(CONFIG_CPU_MIPSR2_IRQ_VI) && !defined(cpu_has_vint)
408# define cpu_has_vint (cpu_data[0].options & MIPS_CPU_VINT) 446# define cpu_has_vint __opt(MIPS_CPU_VINT)
409#elif !defined(cpu_has_vint) 447#elif !defined(cpu_has_vint)
410# define cpu_has_vint 0 448# define cpu_has_vint 0
411#endif 449#endif
412 450
413#if defined(CONFIG_CPU_MIPSR2_IRQ_EI) && !defined(cpu_has_veic) 451#if defined(CONFIG_CPU_MIPSR2_IRQ_EI) && !defined(cpu_has_veic)
414# define cpu_has_veic (cpu_data[0].options & MIPS_CPU_VEIC) 452# define cpu_has_veic __opt(MIPS_CPU_VEIC)
415#elif !defined(cpu_has_veic) 453#elif !defined(cpu_has_veic)
416# define cpu_has_veic 0 454# define cpu_has_veic 0
417#endif 455#endif
418 456
419#ifndef cpu_has_inclusive_pcaches 457#ifndef cpu_has_inclusive_pcaches
420#define cpu_has_inclusive_pcaches (cpu_data[0].options & MIPS_CPU_INCLUSIVE_CACHES) 458#define cpu_has_inclusive_pcaches __opt(MIPS_CPU_INCLUSIVE_CACHES)
421#endif 459#endif
422 460
423#ifndef cpu_dcache_line_size 461#ifndef cpu_dcache_line_size
@@ -438,63 +476,63 @@
438#endif 476#endif
439 477
440#ifndef cpu_has_perf_cntr_intr_bit 478#ifndef cpu_has_perf_cntr_intr_bit
441#define cpu_has_perf_cntr_intr_bit (cpu_data[0].options & MIPS_CPU_PCI) 479#define cpu_has_perf_cntr_intr_bit __opt(MIPS_CPU_PCI)
442#endif 480#endif
443 481
444#ifndef cpu_has_vz 482#ifndef cpu_has_vz
445#define cpu_has_vz (cpu_data[0].ases & MIPS_ASE_VZ) 483#define cpu_has_vz __ase(MIPS_ASE_VZ)
446#endif 484#endif
447 485
448#if defined(CONFIG_CPU_HAS_MSA) && !defined(cpu_has_msa) 486#if defined(CONFIG_CPU_HAS_MSA) && !defined(cpu_has_msa)
449# define cpu_has_msa (cpu_data[0].ases & MIPS_ASE_MSA) 487# define cpu_has_msa __ase(MIPS_ASE_MSA)
450#elif !defined(cpu_has_msa) 488#elif !defined(cpu_has_msa)
451# define cpu_has_msa 0 489# define cpu_has_msa 0
452#endif 490#endif
453 491
454#ifndef cpu_has_ufr 492#ifndef cpu_has_ufr
455# define cpu_has_ufr (cpu_data[0].options & MIPS_CPU_UFR) 493# define cpu_has_ufr __opt(MIPS_CPU_UFR)
456#endif 494#endif
457 495
458#ifndef cpu_has_fre 496#ifndef cpu_has_fre
459# define cpu_has_fre (cpu_data[0].options & MIPS_CPU_FRE) 497# define cpu_has_fre __opt(MIPS_CPU_FRE)
460#endif 498#endif
461 499
462#ifndef cpu_has_cdmm 500#ifndef cpu_has_cdmm
463# define cpu_has_cdmm (cpu_data[0].options & MIPS_CPU_CDMM) 501# define cpu_has_cdmm __opt(MIPS_CPU_CDMM)
464#endif 502#endif
465 503
466#ifndef cpu_has_small_pages 504#ifndef cpu_has_small_pages
467# define cpu_has_small_pages (cpu_data[0].options & MIPS_CPU_SP) 505# define cpu_has_small_pages __opt(MIPS_CPU_SP)
468#endif 506#endif
469 507
470#ifndef cpu_has_nan_legacy 508#ifndef cpu_has_nan_legacy
471#define cpu_has_nan_legacy (cpu_data[0].options & MIPS_CPU_NAN_LEGACY) 509#define cpu_has_nan_legacy __isa_lt_and_opt(6, MIPS_CPU_NAN_LEGACY)
472#endif 510#endif
473#ifndef cpu_has_nan_2008 511#ifndef cpu_has_nan_2008
474#define cpu_has_nan_2008 (cpu_data[0].options & MIPS_CPU_NAN_2008) 512#define cpu_has_nan_2008 __isa_ge_or_opt(6, MIPS_CPU_NAN_2008)
475#endif 513#endif
476 514
477#ifndef cpu_has_ebase_wg 515#ifndef cpu_has_ebase_wg
478# define cpu_has_ebase_wg (cpu_data[0].options & MIPS_CPU_EBASE_WG) 516# define cpu_has_ebase_wg __opt(MIPS_CPU_EBASE_WG)
479#endif 517#endif
480 518
481#ifndef cpu_has_badinstr 519#ifndef cpu_has_badinstr
482# define cpu_has_badinstr (cpu_data[0].options & MIPS_CPU_BADINSTR) 520# define cpu_has_badinstr __isa_ge_or_opt(6, MIPS_CPU_BADINSTR)
483#endif 521#endif
484 522
485#ifndef cpu_has_badinstrp 523#ifndef cpu_has_badinstrp
486# define cpu_has_badinstrp (cpu_data[0].options & MIPS_CPU_BADINSTRP) 524# define cpu_has_badinstrp __isa_ge_or_opt(6, MIPS_CPU_BADINSTRP)
487#endif 525#endif
488 526
489#ifndef cpu_has_contextconfig 527#ifndef cpu_has_contextconfig
490# define cpu_has_contextconfig (cpu_data[0].options & MIPS_CPU_CTXTC) 528# define cpu_has_contextconfig __opt(MIPS_CPU_CTXTC)
491#endif 529#endif
492 530
493#ifndef cpu_has_perf 531#ifndef cpu_has_perf
494# define cpu_has_perf (cpu_data[0].options & MIPS_CPU_PERF) 532# define cpu_has_perf __opt(MIPS_CPU_PERF)
495#endif 533#endif
496 534
497#if defined(CONFIG_SMP) && (MIPS_ISA_REV >= 6) 535#ifdef CONFIG_SMP
498/* 536/*
499 * Some systems share FTLB RAMs between threads within a core (siblings in 537 * Some systems share FTLB RAMs between threads within a core (siblings in
500 * kernel parlance). This means that FTLB entries may become invalid at almost 538 * kernel parlance). This means that FTLB entries may become invalid at almost
@@ -507,7 +545,7 @@
507 */ 545 */
508# ifndef cpu_has_shared_ftlb_ram 546# ifndef cpu_has_shared_ftlb_ram
509# define cpu_has_shared_ftlb_ram \ 547# define cpu_has_shared_ftlb_ram \
510 (current_cpu_data.options & MIPS_CPU_SHARED_FTLB_RAM) 548 __isa_ge_and_opt(6, MIPS_CPU_SHARED_FTLB_RAM)
511# endif 549# endif
512 550
513/* 551/*
@@ -524,9 +562,9 @@
524 */ 562 */
525# ifndef cpu_has_shared_ftlb_entries 563# ifndef cpu_has_shared_ftlb_entries
526# define cpu_has_shared_ftlb_entries \ 564# define cpu_has_shared_ftlb_entries \
527 (current_cpu_data.options & MIPS_CPU_SHARED_FTLB_ENTRIES) 565 __isa_ge_and_opt(6, MIPS_CPU_SHARED_FTLB_ENTRIES)
528# endif 566# endif
529#endif /* SMP && MIPS_ISA_REV >= 6 */ 567#endif /* SMP */
530 568
531#ifndef cpu_has_shared_ftlb_ram 569#ifndef cpu_has_shared_ftlb_ram
532# define cpu_has_shared_ftlb_ram 0 570# define cpu_has_shared_ftlb_ram 0
@@ -537,7 +575,7 @@
537 575
538#ifdef CONFIG_MIPS_MT_SMP 576#ifdef CONFIG_MIPS_MT_SMP
539# define cpu_has_mipsmt_pertccounters \ 577# define cpu_has_mipsmt_pertccounters \
540 (cpu_data[0].options & MIPS_CPU_MT_PER_TC_PERF_COUNTERS) 578 __isa_lt_and_opt(6, MIPS_CPU_MT_PER_TC_PERF_COUNTERS)
541#else 579#else
542# define cpu_has_mipsmt_pertccounters 0 580# define cpu_has_mipsmt_pertccounters 0
543#endif /* CONFIG_MIPS_MT_SMP */ 581#endif /* CONFIG_MIPS_MT_SMP */