~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/mips/kernel/fpu-probe.c

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /arch/mips/kernel/fpu-probe.c (Version linux-6.12-rc7) and /arch/mips/kernel/fpu-probe.c (Version linux-6.11.7)


  1 // SPDX-License-Identifier: GPL-2.0-or-later        1 // SPDX-License-Identifier: GPL-2.0-or-later
  2 /*                                                  2 /*
  3  * Processor capabilities determination functi      3  * Processor capabilities determination functions.
  4  *                                                  4  *
  5  * Copyright (C) xxxx  the Anonymous                5  * Copyright (C) xxxx  the Anonymous
  6  * Copyright (C) 1994 - 2006 Ralf Baechle           6  * Copyright (C) 1994 - 2006 Ralf Baechle
  7  * Copyright (C) 2003, 2004  Maciej W. Rozycki      7  * Copyright (C) 2003, 2004  Maciej W. Rozycki
  8  * Copyright (C) 2001, 2004, 2011, 2012  MIPS       8  * Copyright (C) 2001, 2004, 2011, 2012  MIPS Technologies, Inc.
  9  */                                                 9  */
 10                                                    10 
 11 #include <linux/init.h>                            11 #include <linux/init.h>
 12 #include <linux/kernel.h>                          12 #include <linux/kernel.h>
 13                                                    13 
 14 #include <asm/bugs.h>                              14 #include <asm/bugs.h>
 15 #include <asm/cpu.h>                               15 #include <asm/cpu.h>
 16 #include <asm/cpu-features.h>                      16 #include <asm/cpu-features.h>
 17 #include <asm/cpu-type.h>                          17 #include <asm/cpu-type.h>
 18 #include <asm/elf.h>                               18 #include <asm/elf.h>
 19 #include <asm/fpu.h>                               19 #include <asm/fpu.h>
 20 #include <asm/mipsregs.h>                          20 #include <asm/mipsregs.h>
 21                                                    21 
 22 #include "fpu-probe.h"                             22 #include "fpu-probe.h"
 23                                                    23 
 24 /*                                                 24 /*
 25  * Get the FPU Implementation/Revision.            25  * Get the FPU Implementation/Revision.
 26  */                                                26  */
 27 static inline unsigned long cpu_get_fpu_id(voi     27 static inline unsigned long cpu_get_fpu_id(void)
 28 {                                                  28 {
 29         unsigned long tmp, fpu_id;                 29         unsigned long tmp, fpu_id;
 30                                                    30 
 31         tmp = read_c0_status();                    31         tmp = read_c0_status();
 32         __enable_fpu(FPU_AS_IS);                   32         __enable_fpu(FPU_AS_IS);
 33         fpu_id = read_32bit_cp1_register(CP1_R     33         fpu_id = read_32bit_cp1_register(CP1_REVISION);
 34         write_c0_status(tmp);                      34         write_c0_status(tmp);
 35         return fpu_id;                             35         return fpu_id;
 36 }                                                  36 }
 37                                                    37 
 38 /*                                                 38 /*
 39  * Check if the CPU has an external FPU.           39  * Check if the CPU has an external FPU.
 40  */                                                40  */
 41 int __cpu_has_fpu(void)                            41 int __cpu_has_fpu(void)
 42 {                                                  42 {
 43         return (cpu_get_fpu_id() & FPIR_IMP_MA     43         return (cpu_get_fpu_id() & FPIR_IMP_MASK) != FPIR_IMP_NONE;
 44 }                                                  44 }
 45                                                    45 
 46 /*                                                 46 /*
 47  * Determine the FCSR mask for FPU hardware.       47  * Determine the FCSR mask for FPU hardware.
 48  */                                                48  */
 49 static inline void cpu_set_fpu_fcsr_mask(struc     49 static inline void cpu_set_fpu_fcsr_mask(struct cpuinfo_mips *c)
 50 {                                                  50 {
 51         unsigned long sr, mask, fcsr, fcsr0, f     51         unsigned long sr, mask, fcsr, fcsr0, fcsr1;
 52                                                    52 
 53         fcsr = c->fpu_csr31;                       53         fcsr = c->fpu_csr31;
 54         mask = FPU_CSR_ALL_X | FPU_CSR_ALL_E |     54         mask = FPU_CSR_ALL_X | FPU_CSR_ALL_E | FPU_CSR_ALL_S | FPU_CSR_RM;
 55                                                    55 
 56         sr = read_c0_status();                     56         sr = read_c0_status();
 57         __enable_fpu(FPU_AS_IS);                   57         __enable_fpu(FPU_AS_IS);
 58                                                    58 
 59         fcsr0 = fcsr & mask;                       59         fcsr0 = fcsr & mask;
 60         write_32bit_cp1_register(CP1_STATUS, f     60         write_32bit_cp1_register(CP1_STATUS, fcsr0);
 61         fcsr0 = read_32bit_cp1_register(CP1_ST     61         fcsr0 = read_32bit_cp1_register(CP1_STATUS);
 62                                                    62 
 63         fcsr1 = fcsr | ~mask;                      63         fcsr1 = fcsr | ~mask;
 64         write_32bit_cp1_register(CP1_STATUS, f     64         write_32bit_cp1_register(CP1_STATUS, fcsr1);
 65         fcsr1 = read_32bit_cp1_register(CP1_ST     65         fcsr1 = read_32bit_cp1_register(CP1_STATUS);
 66                                                    66 
 67         write_32bit_cp1_register(CP1_STATUS, f     67         write_32bit_cp1_register(CP1_STATUS, fcsr);
 68                                                    68 
 69         write_c0_status(sr);                       69         write_c0_status(sr);
 70                                                    70 
 71         c->fpu_msk31 = ~(fcsr0 ^ fcsr1) & ~mas     71         c->fpu_msk31 = ~(fcsr0 ^ fcsr1) & ~mask;
 72 }                                                  72 }
 73                                                    73 
 74 /*                                                 74 /*
 75  * Determine the IEEE 754 NaN encodings and AB     75  * Determine the IEEE 754 NaN encodings and ABS.fmt/NEG.fmt execution modes
 76  * supported by FPU hardware.                      76  * supported by FPU hardware.
 77  */                                                77  */
 78 static void cpu_set_fpu_2008(struct cpuinfo_mi     78 static void cpu_set_fpu_2008(struct cpuinfo_mips *c)
 79 {                                                  79 {
 80         if (c->isa_level & (MIPS_CPU_ISA_M32R1     80         if (c->isa_level & (MIPS_CPU_ISA_M32R1 | MIPS_CPU_ISA_M64R1 |
 81                             MIPS_CPU_ISA_M32R2     81                             MIPS_CPU_ISA_M32R2 | MIPS_CPU_ISA_M64R2 |
 82                             MIPS_CPU_ISA_M32R5     82                             MIPS_CPU_ISA_M32R5 | MIPS_CPU_ISA_M64R5 |
 83                             MIPS_CPU_ISA_M32R6     83                             MIPS_CPU_ISA_M32R6 | MIPS_CPU_ISA_M64R6)) {
 84                 unsigned long sr, fir, fcsr, f     84                 unsigned long sr, fir, fcsr, fcsr0, fcsr1;
 85                                                    85 
 86                 sr = read_c0_status();             86                 sr = read_c0_status();
 87                 __enable_fpu(FPU_AS_IS);           87                 __enable_fpu(FPU_AS_IS);
 88                                                    88 
 89                 fir = read_32bit_cp1_register(     89                 fir = read_32bit_cp1_register(CP1_REVISION);
 90                 if (fir & MIPS_FPIR_HAS2008) {     90                 if (fir & MIPS_FPIR_HAS2008) {
 91                         fcsr = read_32bit_cp1_     91                         fcsr = read_32bit_cp1_register(CP1_STATUS);
 92                                                    92 
 93                         /*                         93                         /*
 94                          * MAC2008 toolchain n     94                          * MAC2008 toolchain never landed in real world, so
 95                          * we're only testing      95                          * we're only testing whether it can be disabled and
 96                          *  don't try to enabl     96                          *  don't try to enabled it.
 97                          */                        97                          */
 98                         fcsr0 = fcsr & ~(FPU_C     98                         fcsr0 = fcsr & ~(FPU_CSR_ABS2008 | FPU_CSR_NAN2008 |
 99                                          FPU_C     99                                          FPU_CSR_MAC2008);
100                         write_32bit_cp1_regist    100                         write_32bit_cp1_register(CP1_STATUS, fcsr0);
101                         fcsr0 = read_32bit_cp1    101                         fcsr0 = read_32bit_cp1_register(CP1_STATUS);
102                                                   102 
103                         fcsr1 = fcsr | FPU_CSR    103                         fcsr1 = fcsr | FPU_CSR_ABS2008 | FPU_CSR_NAN2008;
104                         write_32bit_cp1_regist    104                         write_32bit_cp1_register(CP1_STATUS, fcsr1);
105                         fcsr1 = read_32bit_cp1    105                         fcsr1 = read_32bit_cp1_register(CP1_STATUS);
106                                                   106 
107                         write_32bit_cp1_regist    107                         write_32bit_cp1_register(CP1_STATUS, fcsr);
108                                                   108 
109                         if (c->isa_level & (MI    109                         if (c->isa_level & (MIPS_CPU_ISA_M32R2 |
110                                             MI    110                                             MIPS_CPU_ISA_M64R2)) {
111                                 /*                111                                 /*
112                                  * The bit for    112                                  * The bit for MAC2008 might be reused by R6
113                                  * in future,     113                                  * in future, so we only test for R2-R5.
114                                  */               114                                  */
115                                 if (fcsr0 & FP    115                                 if (fcsr0 & FPU_CSR_MAC2008)
116                                         c->opt    116                                         c->options |= MIPS_CPU_MAC_2008_ONLY;
117                         }                         117                         }
118                                                   118 
119                         if (!(fcsr0 & FPU_CSR_    119                         if (!(fcsr0 & FPU_CSR_NAN2008))
120                                 c->options |=     120                                 c->options |= MIPS_CPU_NAN_LEGACY;
121                         if (fcsr1 & FPU_CSR_NA    121                         if (fcsr1 & FPU_CSR_NAN2008)
122                                 c->options |=     122                                 c->options |= MIPS_CPU_NAN_2008;
123                                                   123 
124                         if ((fcsr0 ^ fcsr1) &     124                         if ((fcsr0 ^ fcsr1) & FPU_CSR_ABS2008)
125                                 c->fpu_msk31 &    125                                 c->fpu_msk31 &= ~FPU_CSR_ABS2008;
126                         else                      126                         else
127                                 c->fpu_csr31 |    127                                 c->fpu_csr31 |= fcsr & FPU_CSR_ABS2008;
128                                                   128 
129                         if ((fcsr0 ^ fcsr1) &     129                         if ((fcsr0 ^ fcsr1) & FPU_CSR_NAN2008)
130                                 c->fpu_msk31 &    130                                 c->fpu_msk31 &= ~FPU_CSR_NAN2008;
131                         else                      131                         else
132                                 c->fpu_csr31 |    132                                 c->fpu_csr31 |= fcsr & FPU_CSR_NAN2008;
133                 } else {                          133                 } else {
134                         c->options |= MIPS_CPU    134                         c->options |= MIPS_CPU_NAN_LEGACY;
135                 }                                 135                 }
136                                                   136 
137                 write_c0_status(sr);              137                 write_c0_status(sr);
138         } else {                                  138         } else {
139                 c->options |= MIPS_CPU_NAN_LEG    139                 c->options |= MIPS_CPU_NAN_LEGACY;
140         }                                         140         }
141 }                                                 141 }
142                                                   142 
143 /*                                                143 /*
144  * IEEE 754 conformance mode to use.  Affects     144  * IEEE 754 conformance mode to use.  Affects the NaN encoding and the
145  * ABS.fmt/NEG.fmt execution mode.                145  * ABS.fmt/NEG.fmt execution mode.
146  */                                               146  */
147 static enum { STRICT, EMULATED, LEGACY, STD200    147 static enum { STRICT, EMULATED, LEGACY, STD2008, RELAXED } ieee754 = STRICT;
148                                                   148 
149 /*                                                149 /*
150  * Set the IEEE 754 NaN encodings and the ABS.    150  * Set the IEEE 754 NaN encodings and the ABS.fmt/NEG.fmt execution modes
151  * to support by the FPU emulator according to    151  * to support by the FPU emulator according to the IEEE 754 conformance
152  * mode selected.  Note that "relaxed" straps     152  * mode selected.  Note that "relaxed" straps the emulator so that it
153  * allows 2008-NaN binaries even for legacy pr    153  * allows 2008-NaN binaries even for legacy processors.
154  */                                               154  */
155 static void cpu_set_nofpu_2008(struct cpuinfo_    155 static void cpu_set_nofpu_2008(struct cpuinfo_mips *c)
156 {                                                 156 {
157         c->options &= ~(MIPS_CPU_NAN_2008 | MI    157         c->options &= ~(MIPS_CPU_NAN_2008 | MIPS_CPU_NAN_LEGACY);
158         c->fpu_csr31 &= ~(FPU_CSR_ABS2008 | FP    158         c->fpu_csr31 &= ~(FPU_CSR_ABS2008 | FPU_CSR_NAN2008);
159         c->fpu_msk31 &= ~(FPU_CSR_ABS2008 | FP    159         c->fpu_msk31 &= ~(FPU_CSR_ABS2008 | FPU_CSR_NAN2008);
160                                                   160 
161         switch (ieee754) {                        161         switch (ieee754) {
162         case STRICT:                              162         case STRICT:
163         case EMULATED:                            163         case EMULATED:
164                 if (c->isa_level & (MIPS_CPU_I    164                 if (c->isa_level & (MIPS_CPU_ISA_M32R1 | MIPS_CPU_ISA_M64R1 |
165                                     MIPS_CPU_I    165                                     MIPS_CPU_ISA_M32R2 | MIPS_CPU_ISA_M64R2 |
166                                     MIPS_CPU_I    166                                     MIPS_CPU_ISA_M32R5 | MIPS_CPU_ISA_M64R5 |
167                                     MIPS_CPU_I    167                                     MIPS_CPU_ISA_M32R6 | MIPS_CPU_ISA_M64R6)) {
168                         c->options |= MIPS_CPU    168                         c->options |= MIPS_CPU_NAN_2008 | MIPS_CPU_NAN_LEGACY;
169                 } else {                          169                 } else {
170                         c->options |= MIPS_CPU    170                         c->options |= MIPS_CPU_NAN_LEGACY;
171                         c->fpu_msk31 |= FPU_CS    171                         c->fpu_msk31 |= FPU_CSR_ABS2008 | FPU_CSR_NAN2008;
172                 }                                 172                 }
173                 break;                            173                 break;
174         case LEGACY:                              174         case LEGACY:
175                 c->options |= MIPS_CPU_NAN_LEG    175                 c->options |= MIPS_CPU_NAN_LEGACY;
176                 c->fpu_msk31 |= FPU_CSR_ABS200    176                 c->fpu_msk31 |= FPU_CSR_ABS2008 | FPU_CSR_NAN2008;
177                 break;                            177                 break;
178         case STD2008:                             178         case STD2008:
179                 c->options |= MIPS_CPU_NAN_200    179                 c->options |= MIPS_CPU_NAN_2008;
180                 c->fpu_csr31 |= FPU_CSR_ABS200    180                 c->fpu_csr31 |= FPU_CSR_ABS2008 | FPU_CSR_NAN2008;
181                 c->fpu_msk31 |= FPU_CSR_ABS200    181                 c->fpu_msk31 |= FPU_CSR_ABS2008 | FPU_CSR_NAN2008;
182                 break;                            182                 break;
183         case RELAXED:                             183         case RELAXED:
184                 c->options |= MIPS_CPU_NAN_200    184                 c->options |= MIPS_CPU_NAN_2008 | MIPS_CPU_NAN_LEGACY;
185                 break;                            185                 break;
186         }                                         186         }
187 }                                                 187 }
188                                                   188 
189 /*                                                189 /*
190  * Override the IEEE 754 NaN encoding and ABS.    190  * Override the IEEE 754 NaN encoding and ABS.fmt/NEG.fmt execution mode
191  * according to the "ieee754=" parameter.         191  * according to the "ieee754=" parameter.
192  */                                               192  */
193 static void cpu_set_nan_2008(struct cpuinfo_mi    193 static void cpu_set_nan_2008(struct cpuinfo_mips *c)
194 {                                                 194 {
195         switch (ieee754) {                        195         switch (ieee754) {
196         case STRICT:                              196         case STRICT:
197                 mips_use_nan_legacy = !!cpu_ha    197                 mips_use_nan_legacy = !!cpu_has_nan_legacy;
198                 mips_use_nan_2008 = !!cpu_has_    198                 mips_use_nan_2008 = !!cpu_has_nan_2008;
199                 break;                            199                 break;
200         case LEGACY:                              200         case LEGACY:
201                 mips_use_nan_legacy = !!cpu_ha    201                 mips_use_nan_legacy = !!cpu_has_nan_legacy;
202                 mips_use_nan_2008 = !cpu_has_n    202                 mips_use_nan_2008 = !cpu_has_nan_legacy;
203                 break;                            203                 break;
204         case STD2008:                             204         case STD2008:
205                 mips_use_nan_legacy = !cpu_has    205                 mips_use_nan_legacy = !cpu_has_nan_2008;
206                 mips_use_nan_2008 = !!cpu_has_    206                 mips_use_nan_2008 = !!cpu_has_nan_2008;
207                 break;                            207                 break;
208         case EMULATED:                            208         case EMULATED:
209                 /* Pretend ABS2008/NAN2008 opt    209                 /* Pretend ABS2008/NAN2008 options are dynamic */
210                 c->fpu_msk31 &= ~(FPU_CSR_NAN2    210                 c->fpu_msk31 &= ~(FPU_CSR_NAN2008 | FPU_CSR_ABS2008);
211                 fallthrough;                      211                 fallthrough;
212         case RELAXED:                             212         case RELAXED:
213                 mips_use_nan_legacy = true;       213                 mips_use_nan_legacy = true;
214                 mips_use_nan_2008 = true;         214                 mips_use_nan_2008 = true;
215                 break;                            215                 break;
216         }                                         216         }
217 }                                                 217 }
218                                                   218 
219 /*                                                219 /*
220  * IEEE 754 NaN encoding and ABS.fmt/NEG.fmt e    220  * IEEE 754 NaN encoding and ABS.fmt/NEG.fmt execution mode override
221  * settings:                                      221  * settings:
222  *                                                222  *
223  * strict:  accept binaries that request a NaN    223  * strict:  accept binaries that request a NaN encoding supported by the FPU
224  * legacy:  only accept legacy-NaN binaries       224  * legacy:  only accept legacy-NaN binaries
225  * 2008:    only accept 2008-NaN binaries         225  * 2008:    only accept 2008-NaN binaries
226  * relaxed: accept any binaries regardless of     226  * relaxed: accept any binaries regardless of whether supported by the FPU
227  */                                               227  */
228 static int __init ieee754_setup(char *s)          228 static int __init ieee754_setup(char *s)
229 {                                                 229 {
230         if (!s)                                   230         if (!s)
231                 return -1;                        231                 return -1;
232         else if (!strcmp(s, "strict"))            232         else if (!strcmp(s, "strict"))
233                 ieee754 = STRICT;                 233                 ieee754 = STRICT;
234         else if (!strcmp(s, "emulated"))          234         else if (!strcmp(s, "emulated"))
235                 ieee754 = EMULATED;               235                 ieee754 = EMULATED;
236         else if (!strcmp(s, "legacy"))            236         else if (!strcmp(s, "legacy"))
237                 ieee754 = LEGACY;                 237                 ieee754 = LEGACY;
238         else if (!strcmp(s, "2008"))              238         else if (!strcmp(s, "2008"))
239                 ieee754 = STD2008;                239                 ieee754 = STD2008;
240         else if (!strcmp(s, "relaxed"))           240         else if (!strcmp(s, "relaxed"))
241                 ieee754 = RELAXED;                241                 ieee754 = RELAXED;
242         else                                      242         else
243                 return -1;                        243                 return -1;
244                                                   244 
245         if (!(boot_cpu_data.options & MIPS_CPU    245         if (!(boot_cpu_data.options & MIPS_CPU_FPU))
246                 cpu_set_nofpu_2008(&boot_cpu_d    246                 cpu_set_nofpu_2008(&boot_cpu_data);
247         cpu_set_nan_2008(&boot_cpu_data);         247         cpu_set_nan_2008(&boot_cpu_data);
248                                                   248 
249         return 0;                                 249         return 0;
250 }                                                 250 }
251                                                   251 
252 early_param("ieee754", ieee754_setup);            252 early_param("ieee754", ieee754_setup);
253                                                   253 
254 /*                                                254 /*
255  * Set the FIR feature flags for the FPU emula    255  * Set the FIR feature flags for the FPU emulator.
256  */                                               256  */
257 static void cpu_set_nofpu_id(struct cpuinfo_mi    257 static void cpu_set_nofpu_id(struct cpuinfo_mips *c)
258 {                                                 258 {
259         u32 value;                                259         u32 value;
260                                                   260 
261         value = 0;                                261         value = 0;
262         if (c->isa_level & (MIPS_CPU_ISA_M32R1    262         if (c->isa_level & (MIPS_CPU_ISA_M32R1 | MIPS_CPU_ISA_M64R1 |
263                             MIPS_CPU_ISA_M32R2    263                             MIPS_CPU_ISA_M32R2 | MIPS_CPU_ISA_M64R2 |
264                             MIPS_CPU_ISA_M32R5    264                             MIPS_CPU_ISA_M32R5 | MIPS_CPU_ISA_M64R5 |
265                             MIPS_CPU_ISA_M32R6    265                             MIPS_CPU_ISA_M32R6 | MIPS_CPU_ISA_M64R6))
266                 value |= MIPS_FPIR_D | MIPS_FP    266                 value |= MIPS_FPIR_D | MIPS_FPIR_S;
267         if (c->isa_level & (MIPS_CPU_ISA_M32R2    267         if (c->isa_level & (MIPS_CPU_ISA_M32R2 | MIPS_CPU_ISA_M64R2 |
268                             MIPS_CPU_ISA_M32R5    268                             MIPS_CPU_ISA_M32R5 | MIPS_CPU_ISA_M64R5 |
269                             MIPS_CPU_ISA_M32R6    269                             MIPS_CPU_ISA_M32R6 | MIPS_CPU_ISA_M64R6))
270                 value |= MIPS_FPIR_F64 | MIPS_    270                 value |= MIPS_FPIR_F64 | MIPS_FPIR_L | MIPS_FPIR_W;
271         if (c->options & MIPS_CPU_NAN_2008)       271         if (c->options & MIPS_CPU_NAN_2008)
272                 value |= MIPS_FPIR_HAS2008;       272                 value |= MIPS_FPIR_HAS2008;
273         c->fpu_id = value;                        273         c->fpu_id = value;
274 }                                                 274 }
275                                                   275 
276 /* Determined FPU emulator mask to use for the    276 /* Determined FPU emulator mask to use for the boot CPU with "nofpu".  */
277 static unsigned int mips_nofpu_msk31;             277 static unsigned int mips_nofpu_msk31;
278                                                   278 
279 /*                                                279 /*
280  * Set options for FPU hardware.                  280  * Set options for FPU hardware.
281  */                                               281  */
282 void cpu_set_fpu_opts(struct cpuinfo_mips *c)     282 void cpu_set_fpu_opts(struct cpuinfo_mips *c)
283 {                                                 283 {
284         c->fpu_id = cpu_get_fpu_id();             284         c->fpu_id = cpu_get_fpu_id();
285         mips_nofpu_msk31 = c->fpu_msk31;          285         mips_nofpu_msk31 = c->fpu_msk31;
286                                                   286 
287         if (c->isa_level & (MIPS_CPU_ISA_M32R1    287         if (c->isa_level & (MIPS_CPU_ISA_M32R1 | MIPS_CPU_ISA_M64R1 |
288                             MIPS_CPU_ISA_M32R2    288                             MIPS_CPU_ISA_M32R2 | MIPS_CPU_ISA_M64R2 |
289                             MIPS_CPU_ISA_M32R5    289                             MIPS_CPU_ISA_M32R5 | MIPS_CPU_ISA_M64R5 |
290                             MIPS_CPU_ISA_M32R6    290                             MIPS_CPU_ISA_M32R6 | MIPS_CPU_ISA_M64R6)) {
291                 if (c->fpu_id & MIPS_FPIR_3D)     291                 if (c->fpu_id & MIPS_FPIR_3D)
292                         c->ases |= MIPS_ASE_MI    292                         c->ases |= MIPS_ASE_MIPS3D;
293                 if (c->fpu_id & MIPS_FPIR_UFRP    293                 if (c->fpu_id & MIPS_FPIR_UFRP)
294                         c->options |= MIPS_CPU    294                         c->options |= MIPS_CPU_UFR;
295                 if (c->fpu_id & MIPS_FPIR_FREP    295                 if (c->fpu_id & MIPS_FPIR_FREP)
296                         c->options |= MIPS_CPU    296                         c->options |= MIPS_CPU_FRE;
297         }                                         297         }
298                                                   298 
299         cpu_set_fpu_fcsr_mask(c);                 299         cpu_set_fpu_fcsr_mask(c);
300         cpu_set_fpu_2008(c);                      300         cpu_set_fpu_2008(c);
301         cpu_set_nan_2008(c);                      301         cpu_set_nan_2008(c);
302 }                                                 302 }
303                                                   303 
304 /*                                                304 /*
305  * Set options for the FPU emulator.              305  * Set options for the FPU emulator.
306  */                                               306  */
307 void cpu_set_nofpu_opts(struct cpuinfo_mips *c    307 void cpu_set_nofpu_opts(struct cpuinfo_mips *c)
308 {                                                 308 {
309         c->options &= ~MIPS_CPU_FPU;              309         c->options &= ~MIPS_CPU_FPU;
310         c->fpu_msk31 = mips_nofpu_msk31;          310         c->fpu_msk31 = mips_nofpu_msk31;
311                                                   311 
312         cpu_set_nofpu_2008(c);                    312         cpu_set_nofpu_2008(c);
313         cpu_set_nan_2008(c);                      313         cpu_set_nan_2008(c);
314         cpu_set_nofpu_id(c);                      314         cpu_set_nofpu_id(c);
315 }                                                 315 }
316                                                   316 
317 int mips_fpu_disabled;                            317 int mips_fpu_disabled;
318                                                   318 
319 static int __init fpu_disable(char *s)            319 static int __init fpu_disable(char *s)
320 {                                                 320 {
321         cpu_set_nofpu_opts(&boot_cpu_data);       321         cpu_set_nofpu_opts(&boot_cpu_data);
322         mips_fpu_disabled = 1;                    322         mips_fpu_disabled = 1;
323                                                   323 
324         return 1;                                 324         return 1;
325 }                                                 325 }
326                                                   326 
327 __setup("nofpu", fpu_disable);                    327 __setup("nofpu", fpu_disable);
328                                                   328 
329                                                   329 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php