meson: target
[qemu.git] / target / arm / cpu_tcg.c
1 /*
2 * QEMU ARM TCG CPUs.
3 *
4 * Copyright (c) 2012 SUSE LINUX Products GmbH
5 *
6 * This code is licensed under the GNU GPL v2 or later.
7 *
8 * SPDX-License-Identifier: GPL-2.0-or-later
9 */
10
11 #include "qemu/osdep.h"
12 #include "cpu.h"
13 #include "internals.h"
14
15 /* CPU models. These are not needed for the AArch64 linux-user build. */
16 #if !defined(CONFIG_USER_ONLY) || !defined(TARGET_AARCH64)
17
18 static bool arm_v7m_cpu_exec_interrupt(CPUState *cs, int interrupt_request)
19 {
20 CPUClass *cc = CPU_GET_CLASS(cs);
21 ARMCPU *cpu = ARM_CPU(cs);
22 CPUARMState *env = &cpu->env;
23 bool ret = false;
24
25 /*
26 * ARMv7-M interrupt masking works differently than -A or -R.
27 * There is no FIQ/IRQ distinction. Instead of I and F bits
28 * masking FIQ and IRQ interrupts, an exception is taken only
29 * if it is higher priority than the current execution priority
30 * (which depends on state like BASEPRI, FAULTMASK and the
31 * currently active exception).
32 */
33 if (interrupt_request & CPU_INTERRUPT_HARD
34 && (armv7m_nvic_can_take_pending_exception(env->nvic))) {
35 cs->exception_index = EXCP_IRQ;
36 cc->do_interrupt(cs);
37 ret = true;
38 }
39 return ret;
40 }
41
42 static void arm926_initfn(Object *obj)
43 {
44 ARMCPU *cpu = ARM_CPU(obj);
45
46 cpu->dtb_compatible = "arm,arm926";
47 set_feature(&cpu->env, ARM_FEATURE_V5);
48 set_feature(&cpu->env, ARM_FEATURE_DUMMY_C15_REGS);
49 set_feature(&cpu->env, ARM_FEATURE_CACHE_TEST_CLEAN);
50 cpu->midr = 0x41069265;
51 cpu->reset_fpsid = 0x41011090;
52 cpu->ctr = 0x1dd20d2;
53 cpu->reset_sctlr = 0x00090078;
54
55 /*
56 * ARMv5 does not have the ID_ISAR registers, but we can still
57 * set the field to indicate Jazelle support within QEMU.
58 */
59 cpu->isar.id_isar1 = FIELD_DP32(cpu->isar.id_isar1, ID_ISAR1, JAZELLE, 1);
60 /*
61 * Similarly, we need to set MVFR0 fields to enable vfp and short vector
62 * support even though ARMv5 doesn't have this register.
63 */
64 cpu->isar.mvfr0 = FIELD_DP32(cpu->isar.mvfr0, MVFR0, FPSHVEC, 1);
65 cpu->isar.mvfr0 = FIELD_DP32(cpu->isar.mvfr0, MVFR0, FPSP, 1);
66 cpu->isar.mvfr0 = FIELD_DP32(cpu->isar.mvfr0, MVFR0, FPDP, 1);
67 }
68
69 static void arm946_initfn(Object *obj)
70 {
71 ARMCPU *cpu = ARM_CPU(obj);
72
73 cpu->dtb_compatible = "arm,arm946";
74 set_feature(&cpu->env, ARM_FEATURE_V5);
75 set_feature(&cpu->env, ARM_FEATURE_PMSA);
76 set_feature(&cpu->env, ARM_FEATURE_DUMMY_C15_REGS);
77 cpu->midr = 0x41059461;
78 cpu->ctr = 0x0f004006;
79 cpu->reset_sctlr = 0x00000078;
80 }
81
82 static void arm1026_initfn(Object *obj)
83 {
84 ARMCPU *cpu = ARM_CPU(obj);
85
86 cpu->dtb_compatible = "arm,arm1026";
87 set_feature(&cpu->env, ARM_FEATURE_V5);
88 set_feature(&cpu->env, ARM_FEATURE_AUXCR);
89 set_feature(&cpu->env, ARM_FEATURE_DUMMY_C15_REGS);
90 set_feature(&cpu->env, ARM_FEATURE_CACHE_TEST_CLEAN);
91 cpu->midr = 0x4106a262;
92 cpu->reset_fpsid = 0x410110a0;
93 cpu->ctr = 0x1dd20d2;
94 cpu->reset_sctlr = 0x00090078;
95 cpu->reset_auxcr = 1;
96
97 /*
98 * ARMv5 does not have the ID_ISAR registers, but we can still
99 * set the field to indicate Jazelle support within QEMU.
100 */
101 cpu->isar.id_isar1 = FIELD_DP32(cpu->isar.id_isar1, ID_ISAR1, JAZELLE, 1);
102 /*
103 * Similarly, we need to set MVFR0 fields to enable vfp and short vector
104 * support even though ARMv5 doesn't have this register.
105 */
106 cpu->isar.mvfr0 = FIELD_DP32(cpu->isar.mvfr0, MVFR0, FPSHVEC, 1);
107 cpu->isar.mvfr0 = FIELD_DP32(cpu->isar.mvfr0, MVFR0, FPSP, 1);
108 cpu->isar.mvfr0 = FIELD_DP32(cpu->isar.mvfr0, MVFR0, FPDP, 1);
109
110 {
111 /* The 1026 had an IFAR at c6,c0,0,1 rather than the ARMv6 c6,c0,0,2 */
112 ARMCPRegInfo ifar = {
113 .name = "IFAR", .cp = 15, .crn = 6, .crm = 0, .opc1 = 0, .opc2 = 1,
114 .access = PL1_RW,
115 .fieldoffset = offsetof(CPUARMState, cp15.ifar_ns),
116 .resetvalue = 0
117 };
118 define_one_arm_cp_reg(cpu, &ifar);
119 }
120 }
121
122 static void arm1136_r2_initfn(Object *obj)
123 {
124 ARMCPU *cpu = ARM_CPU(obj);
125 /*
126 * What qemu calls "arm1136_r2" is actually the 1136 r0p2, ie an
127 * older core than plain "arm1136". In particular this does not
128 * have the v6K features.
129 * These ID register values are correct for 1136 but may be wrong
130 * for 1136_r2 (in particular r0p2 does not actually implement most
131 * of the ID registers).
132 */
133
134 cpu->dtb_compatible = "arm,arm1136";
135 set_feature(&cpu->env, ARM_FEATURE_V6);
136 set_feature(&cpu->env, ARM_FEATURE_DUMMY_C15_REGS);
137 set_feature(&cpu->env, ARM_FEATURE_CACHE_DIRTY_REG);
138 set_feature(&cpu->env, ARM_FEATURE_CACHE_BLOCK_OPS);
139 cpu->midr = 0x4107b362;
140 cpu->reset_fpsid = 0x410120b4;
141 cpu->isar.mvfr0 = 0x11111111;
142 cpu->isar.mvfr1 = 0x00000000;
143 cpu->ctr = 0x1dd20d2;
144 cpu->reset_sctlr = 0x00050078;
145 cpu->id_pfr0 = 0x111;
146 cpu->id_pfr1 = 0x1;
147 cpu->isar.id_dfr0 = 0x2;
148 cpu->id_afr0 = 0x3;
149 cpu->isar.id_mmfr0 = 0x01130003;
150 cpu->isar.id_mmfr1 = 0x10030302;
151 cpu->isar.id_mmfr2 = 0x01222110;
152 cpu->isar.id_isar0 = 0x00140011;
153 cpu->isar.id_isar1 = 0x12002111;
154 cpu->isar.id_isar2 = 0x11231111;
155 cpu->isar.id_isar3 = 0x01102131;
156 cpu->isar.id_isar4 = 0x141;
157 cpu->reset_auxcr = 7;
158 }
159
160 static void arm1136_initfn(Object *obj)
161 {
162 ARMCPU *cpu = ARM_CPU(obj);
163
164 cpu->dtb_compatible = "arm,arm1136";
165 set_feature(&cpu->env, ARM_FEATURE_V6K);
166 set_feature(&cpu->env, ARM_FEATURE_V6);
167 set_feature(&cpu->env, ARM_FEATURE_DUMMY_C15_REGS);
168 set_feature(&cpu->env, ARM_FEATURE_CACHE_DIRTY_REG);
169 set_feature(&cpu->env, ARM_FEATURE_CACHE_BLOCK_OPS);
170 cpu->midr = 0x4117b363;
171 cpu->reset_fpsid = 0x410120b4;
172 cpu->isar.mvfr0 = 0x11111111;
173 cpu->isar.mvfr1 = 0x00000000;
174 cpu->ctr = 0x1dd20d2;
175 cpu->reset_sctlr = 0x00050078;
176 cpu->id_pfr0 = 0x111;
177 cpu->id_pfr1 = 0x1;
178 cpu->isar.id_dfr0 = 0x2;
179 cpu->id_afr0 = 0x3;
180 cpu->isar.id_mmfr0 = 0x01130003;
181 cpu->isar.id_mmfr1 = 0x10030302;
182 cpu->isar.id_mmfr2 = 0x01222110;
183 cpu->isar.id_isar0 = 0x00140011;
184 cpu->isar.id_isar1 = 0x12002111;
185 cpu->isar.id_isar2 = 0x11231111;
186 cpu->isar.id_isar3 = 0x01102131;
187 cpu->isar.id_isar4 = 0x141;
188 cpu->reset_auxcr = 7;
189 }
190
191 static void arm1176_initfn(Object *obj)
192 {
193 ARMCPU *cpu = ARM_CPU(obj);
194
195 cpu->dtb_compatible = "arm,arm1176";
196 set_feature(&cpu->env, ARM_FEATURE_V6K);
197 set_feature(&cpu->env, ARM_FEATURE_VAPA);
198 set_feature(&cpu->env, ARM_FEATURE_DUMMY_C15_REGS);
199 set_feature(&cpu->env, ARM_FEATURE_CACHE_DIRTY_REG);
200 set_feature(&cpu->env, ARM_FEATURE_CACHE_BLOCK_OPS);
201 set_feature(&cpu->env, ARM_FEATURE_EL3);
202 cpu->midr = 0x410fb767;
203 cpu->reset_fpsid = 0x410120b5;
204 cpu->isar.mvfr0 = 0x11111111;
205 cpu->isar.mvfr1 = 0x00000000;
206 cpu->ctr = 0x1dd20d2;
207 cpu->reset_sctlr = 0x00050078;
208 cpu->id_pfr0 = 0x111;
209 cpu->id_pfr1 = 0x11;
210 cpu->isar.id_dfr0 = 0x33;
211 cpu->id_afr0 = 0;
212 cpu->isar.id_mmfr0 = 0x01130003;
213 cpu->isar.id_mmfr1 = 0x10030302;
214 cpu->isar.id_mmfr2 = 0x01222100;
215 cpu->isar.id_isar0 = 0x0140011;
216 cpu->isar.id_isar1 = 0x12002111;
217 cpu->isar.id_isar2 = 0x11231121;
218 cpu->isar.id_isar3 = 0x01102131;
219 cpu->isar.id_isar4 = 0x01141;
220 cpu->reset_auxcr = 7;
221 }
222
223 static void arm11mpcore_initfn(Object *obj)
224 {
225 ARMCPU *cpu = ARM_CPU(obj);
226
227 cpu->dtb_compatible = "arm,arm11mpcore";
228 set_feature(&cpu->env, ARM_FEATURE_V6K);
229 set_feature(&cpu->env, ARM_FEATURE_VAPA);
230 set_feature(&cpu->env, ARM_FEATURE_MPIDR);
231 set_feature(&cpu->env, ARM_FEATURE_DUMMY_C15_REGS);
232 cpu->midr = 0x410fb022;
233 cpu->reset_fpsid = 0x410120b4;
234 cpu->isar.mvfr0 = 0x11111111;
235 cpu->isar.mvfr1 = 0x00000000;
236 cpu->ctr = 0x1d192992; /* 32K icache 32K dcache */
237 cpu->id_pfr0 = 0x111;
238 cpu->id_pfr1 = 0x1;
239 cpu->isar.id_dfr0 = 0;
240 cpu->id_afr0 = 0x2;
241 cpu->isar.id_mmfr0 = 0x01100103;
242 cpu->isar.id_mmfr1 = 0x10020302;
243 cpu->isar.id_mmfr2 = 0x01222000;
244 cpu->isar.id_isar0 = 0x00100011;
245 cpu->isar.id_isar1 = 0x12002111;
246 cpu->isar.id_isar2 = 0x11221011;
247 cpu->isar.id_isar3 = 0x01102131;
248 cpu->isar.id_isar4 = 0x141;
249 cpu->reset_auxcr = 1;
250 }
251
252 static void cortex_m0_initfn(Object *obj)
253 {
254 ARMCPU *cpu = ARM_CPU(obj);
255 set_feature(&cpu->env, ARM_FEATURE_V6);
256 set_feature(&cpu->env, ARM_FEATURE_M);
257
258 cpu->midr = 0x410cc200;
259 }
260
261 static void cortex_m3_initfn(Object *obj)
262 {
263 ARMCPU *cpu = ARM_CPU(obj);
264 set_feature(&cpu->env, ARM_FEATURE_V7);
265 set_feature(&cpu->env, ARM_FEATURE_M);
266 set_feature(&cpu->env, ARM_FEATURE_M_MAIN);
267 cpu->midr = 0x410fc231;
268 cpu->pmsav7_dregion = 8;
269 cpu->id_pfr0 = 0x00000030;
270 cpu->id_pfr1 = 0x00000200;
271 cpu->isar.id_dfr0 = 0x00100000;
272 cpu->id_afr0 = 0x00000000;
273 cpu->isar.id_mmfr0 = 0x00000030;
274 cpu->isar.id_mmfr1 = 0x00000000;
275 cpu->isar.id_mmfr2 = 0x00000000;
276 cpu->isar.id_mmfr3 = 0x00000000;
277 cpu->isar.id_isar0 = 0x01141110;
278 cpu->isar.id_isar1 = 0x02111000;
279 cpu->isar.id_isar2 = 0x21112231;
280 cpu->isar.id_isar3 = 0x01111110;
281 cpu->isar.id_isar4 = 0x01310102;
282 cpu->isar.id_isar5 = 0x00000000;
283 cpu->isar.id_isar6 = 0x00000000;
284 }
285
286 static void cortex_m4_initfn(Object *obj)
287 {
288 ARMCPU *cpu = ARM_CPU(obj);
289
290 set_feature(&cpu->env, ARM_FEATURE_V7);
291 set_feature(&cpu->env, ARM_FEATURE_M);
292 set_feature(&cpu->env, ARM_FEATURE_M_MAIN);
293 set_feature(&cpu->env, ARM_FEATURE_THUMB_DSP);
294 cpu->midr = 0x410fc240; /* r0p0 */
295 cpu->pmsav7_dregion = 8;
296 cpu->isar.mvfr0 = 0x10110021;
297 cpu->isar.mvfr1 = 0x11000011;
298 cpu->isar.mvfr2 = 0x00000000;
299 cpu->id_pfr0 = 0x00000030;
300 cpu->id_pfr1 = 0x00000200;
301 cpu->isar.id_dfr0 = 0x00100000;
302 cpu->id_afr0 = 0x00000000;
303 cpu->isar.id_mmfr0 = 0x00000030;
304 cpu->isar.id_mmfr1 = 0x00000000;
305 cpu->isar.id_mmfr2 = 0x00000000;
306 cpu->isar.id_mmfr3 = 0x00000000;
307 cpu->isar.id_isar0 = 0x01141110;
308 cpu->isar.id_isar1 = 0x02111000;
309 cpu->isar.id_isar2 = 0x21112231;
310 cpu->isar.id_isar3 = 0x01111110;
311 cpu->isar.id_isar4 = 0x01310102;
312 cpu->isar.id_isar5 = 0x00000000;
313 cpu->isar.id_isar6 = 0x00000000;
314 }
315
316 static void cortex_m7_initfn(Object *obj)
317 {
318 ARMCPU *cpu = ARM_CPU(obj);
319
320 set_feature(&cpu->env, ARM_FEATURE_V7);
321 set_feature(&cpu->env, ARM_FEATURE_M);
322 set_feature(&cpu->env, ARM_FEATURE_M_MAIN);
323 set_feature(&cpu->env, ARM_FEATURE_THUMB_DSP);
324 cpu->midr = 0x411fc272; /* r1p2 */
325 cpu->pmsav7_dregion = 8;
326 cpu->isar.mvfr0 = 0x10110221;
327 cpu->isar.mvfr1 = 0x12000011;
328 cpu->isar.mvfr2 = 0x00000040;
329 cpu->id_pfr0 = 0x00000030;
330 cpu->id_pfr1 = 0x00000200;
331 cpu->isar.id_dfr0 = 0x00100000;
332 cpu->id_afr0 = 0x00000000;
333 cpu->isar.id_mmfr0 = 0x00100030;
334 cpu->isar.id_mmfr1 = 0x00000000;
335 cpu->isar.id_mmfr2 = 0x01000000;
336 cpu->isar.id_mmfr3 = 0x00000000;
337 cpu->isar.id_isar0 = 0x01101110;
338 cpu->isar.id_isar1 = 0x02112000;
339 cpu->isar.id_isar2 = 0x20232231;
340 cpu->isar.id_isar3 = 0x01111131;
341 cpu->isar.id_isar4 = 0x01310132;
342 cpu->isar.id_isar5 = 0x00000000;
343 cpu->isar.id_isar6 = 0x00000000;
344 }
345
346 static void cortex_m33_initfn(Object *obj)
347 {
348 ARMCPU *cpu = ARM_CPU(obj);
349
350 set_feature(&cpu->env, ARM_FEATURE_V8);
351 set_feature(&cpu->env, ARM_FEATURE_M);
352 set_feature(&cpu->env, ARM_FEATURE_M_MAIN);
353 set_feature(&cpu->env, ARM_FEATURE_M_SECURITY);
354 set_feature(&cpu->env, ARM_FEATURE_THUMB_DSP);
355 cpu->midr = 0x410fd213; /* r0p3 */
356 cpu->pmsav7_dregion = 16;
357 cpu->sau_sregion = 8;
358 cpu->isar.mvfr0 = 0x10110021;
359 cpu->isar.mvfr1 = 0x11000011;
360 cpu->isar.mvfr2 = 0x00000040;
361 cpu->id_pfr0 = 0x00000030;
362 cpu->id_pfr1 = 0x00000210;
363 cpu->isar.id_dfr0 = 0x00200000;
364 cpu->id_afr0 = 0x00000000;
365 cpu->isar.id_mmfr0 = 0x00101F40;
366 cpu->isar.id_mmfr1 = 0x00000000;
367 cpu->isar.id_mmfr2 = 0x01000000;
368 cpu->isar.id_mmfr3 = 0x00000000;
369 cpu->isar.id_isar0 = 0x01101110;
370 cpu->isar.id_isar1 = 0x02212000;
371 cpu->isar.id_isar2 = 0x20232232;
372 cpu->isar.id_isar3 = 0x01111131;
373 cpu->isar.id_isar4 = 0x01310132;
374 cpu->isar.id_isar5 = 0x00000000;
375 cpu->isar.id_isar6 = 0x00000000;
376 cpu->clidr = 0x00000000;
377 cpu->ctr = 0x8000c000;
378 }
379
380 static const ARMCPRegInfo cortexr5_cp_reginfo[] = {
381 /* Dummy the TCM region regs for the moment */
382 { .name = "ATCM", .cp = 15, .opc1 = 0, .crn = 9, .crm = 1, .opc2 = 0,
383 .access = PL1_RW, .type = ARM_CP_CONST },
384 { .name = "BTCM", .cp = 15, .opc1 = 0, .crn = 9, .crm = 1, .opc2 = 1,
385 .access = PL1_RW, .type = ARM_CP_CONST },
386 { .name = "DCACHE_INVAL", .cp = 15, .opc1 = 0, .crn = 15, .crm = 5,
387 .opc2 = 0, .access = PL1_W, .type = ARM_CP_NOP },
388 REGINFO_SENTINEL
389 };
390
391 static void cortex_r5_initfn(Object *obj)
392 {
393 ARMCPU *cpu = ARM_CPU(obj);
394
395 set_feature(&cpu->env, ARM_FEATURE_V7);
396 set_feature(&cpu->env, ARM_FEATURE_V7MP);
397 set_feature(&cpu->env, ARM_FEATURE_PMSA);
398 set_feature(&cpu->env, ARM_FEATURE_PMU);
399 cpu->midr = 0x411fc153; /* r1p3 */
400 cpu->id_pfr0 = 0x0131;
401 cpu->id_pfr1 = 0x001;
402 cpu->isar.id_dfr0 = 0x010400;
403 cpu->id_afr0 = 0x0;
404 cpu->isar.id_mmfr0 = 0x0210030;
405 cpu->isar.id_mmfr1 = 0x00000000;
406 cpu->isar.id_mmfr2 = 0x01200000;
407 cpu->isar.id_mmfr3 = 0x0211;
408 cpu->isar.id_isar0 = 0x02101111;
409 cpu->isar.id_isar1 = 0x13112111;
410 cpu->isar.id_isar2 = 0x21232141;
411 cpu->isar.id_isar3 = 0x01112131;
412 cpu->isar.id_isar4 = 0x0010142;
413 cpu->isar.id_isar5 = 0x0;
414 cpu->isar.id_isar6 = 0x0;
415 cpu->mp_is_up = true;
416 cpu->pmsav7_dregion = 16;
417 define_arm_cp_regs(cpu, cortexr5_cp_reginfo);
418 }
419
420 static void cortex_r5f_initfn(Object *obj)
421 {
422 ARMCPU *cpu = ARM_CPU(obj);
423
424 cortex_r5_initfn(obj);
425 cpu->isar.mvfr0 = 0x10110221;
426 cpu->isar.mvfr1 = 0x00000011;
427 }
428
429 static void ti925t_initfn(Object *obj)
430 {
431 ARMCPU *cpu = ARM_CPU(obj);
432 set_feature(&cpu->env, ARM_FEATURE_V4T);
433 set_feature(&cpu->env, ARM_FEATURE_OMAPCP);
434 cpu->midr = ARM_CPUID_TI925T;
435 cpu->ctr = 0x5109149;
436 cpu->reset_sctlr = 0x00000070;
437 }
438
439 static void sa1100_initfn(Object *obj)
440 {
441 ARMCPU *cpu = ARM_CPU(obj);
442
443 cpu->dtb_compatible = "intel,sa1100";
444 set_feature(&cpu->env, ARM_FEATURE_STRONGARM);
445 set_feature(&cpu->env, ARM_FEATURE_DUMMY_C15_REGS);
446 cpu->midr = 0x4401A11B;
447 cpu->reset_sctlr = 0x00000070;
448 }
449
450 static void sa1110_initfn(Object *obj)
451 {
452 ARMCPU *cpu = ARM_CPU(obj);
453 set_feature(&cpu->env, ARM_FEATURE_STRONGARM);
454 set_feature(&cpu->env, ARM_FEATURE_DUMMY_C15_REGS);
455 cpu->midr = 0x6901B119;
456 cpu->reset_sctlr = 0x00000070;
457 }
458
459 static void pxa250_initfn(Object *obj)
460 {
461 ARMCPU *cpu = ARM_CPU(obj);
462
463 cpu->dtb_compatible = "marvell,xscale";
464 set_feature(&cpu->env, ARM_FEATURE_V5);
465 set_feature(&cpu->env, ARM_FEATURE_XSCALE);
466 cpu->midr = 0x69052100;
467 cpu->ctr = 0xd172172;
468 cpu->reset_sctlr = 0x00000078;
469 }
470
471 static void pxa255_initfn(Object *obj)
472 {
473 ARMCPU *cpu = ARM_CPU(obj);
474
475 cpu->dtb_compatible = "marvell,xscale";
476 set_feature(&cpu->env, ARM_FEATURE_V5);
477 set_feature(&cpu->env, ARM_FEATURE_XSCALE);
478 cpu->midr = 0x69052d00;
479 cpu->ctr = 0xd172172;
480 cpu->reset_sctlr = 0x00000078;
481 }
482
483 static void pxa260_initfn(Object *obj)
484 {
485 ARMCPU *cpu = ARM_CPU(obj);
486
487 cpu->dtb_compatible = "marvell,xscale";
488 set_feature(&cpu->env, ARM_FEATURE_V5);
489 set_feature(&cpu->env, ARM_FEATURE_XSCALE);
490 cpu->midr = 0x69052903;
491 cpu->ctr = 0xd172172;
492 cpu->reset_sctlr = 0x00000078;
493 }
494
495 static void pxa261_initfn(Object *obj)
496 {
497 ARMCPU *cpu = ARM_CPU(obj);
498
499 cpu->dtb_compatible = "marvell,xscale";
500 set_feature(&cpu->env, ARM_FEATURE_V5);
501 set_feature(&cpu->env, ARM_FEATURE_XSCALE);
502 cpu->midr = 0x69052d05;
503 cpu->ctr = 0xd172172;
504 cpu->reset_sctlr = 0x00000078;
505 }
506
507 static void pxa262_initfn(Object *obj)
508 {
509 ARMCPU *cpu = ARM_CPU(obj);
510
511 cpu->dtb_compatible = "marvell,xscale";
512 set_feature(&cpu->env, ARM_FEATURE_V5);
513 set_feature(&cpu->env, ARM_FEATURE_XSCALE);
514 cpu->midr = 0x69052d06;
515 cpu->ctr = 0xd172172;
516 cpu->reset_sctlr = 0x00000078;
517 }
518
519 static void pxa270a0_initfn(Object *obj)
520 {
521 ARMCPU *cpu = ARM_CPU(obj);
522
523 cpu->dtb_compatible = "marvell,xscale";
524 set_feature(&cpu->env, ARM_FEATURE_V5);
525 set_feature(&cpu->env, ARM_FEATURE_XSCALE);
526 set_feature(&cpu->env, ARM_FEATURE_IWMMXT);
527 cpu->midr = 0x69054110;
528 cpu->ctr = 0xd172172;
529 cpu->reset_sctlr = 0x00000078;
530 }
531
532 static void pxa270a1_initfn(Object *obj)
533 {
534 ARMCPU *cpu = ARM_CPU(obj);
535
536 cpu->dtb_compatible = "marvell,xscale";
537 set_feature(&cpu->env, ARM_FEATURE_V5);
538 set_feature(&cpu->env, ARM_FEATURE_XSCALE);
539 set_feature(&cpu->env, ARM_FEATURE_IWMMXT);
540 cpu->midr = 0x69054111;
541 cpu->ctr = 0xd172172;
542 cpu->reset_sctlr = 0x00000078;
543 }
544
545 static void pxa270b0_initfn(Object *obj)
546 {
547 ARMCPU *cpu = ARM_CPU(obj);
548
549 cpu->dtb_compatible = "marvell,xscale";
550 set_feature(&cpu->env, ARM_FEATURE_V5);
551 set_feature(&cpu->env, ARM_FEATURE_XSCALE);
552 set_feature(&cpu->env, ARM_FEATURE_IWMMXT);
553 cpu->midr = 0x69054112;
554 cpu->ctr = 0xd172172;
555 cpu->reset_sctlr = 0x00000078;
556 }
557
558 static void pxa270b1_initfn(Object *obj)
559 {
560 ARMCPU *cpu = ARM_CPU(obj);
561
562 cpu->dtb_compatible = "marvell,xscale";
563 set_feature(&cpu->env, ARM_FEATURE_V5);
564 set_feature(&cpu->env, ARM_FEATURE_XSCALE);
565 set_feature(&cpu->env, ARM_FEATURE_IWMMXT);
566 cpu->midr = 0x69054113;
567 cpu->ctr = 0xd172172;
568 cpu->reset_sctlr = 0x00000078;
569 }
570
571 static void pxa270c0_initfn(Object *obj)
572 {
573 ARMCPU *cpu = ARM_CPU(obj);
574
575 cpu->dtb_compatible = "marvell,xscale";
576 set_feature(&cpu->env, ARM_FEATURE_V5);
577 set_feature(&cpu->env, ARM_FEATURE_XSCALE);
578 set_feature(&cpu->env, ARM_FEATURE_IWMMXT);
579 cpu->midr = 0x69054114;
580 cpu->ctr = 0xd172172;
581 cpu->reset_sctlr = 0x00000078;
582 }
583
584 static void pxa270c5_initfn(Object *obj)
585 {
586 ARMCPU *cpu = ARM_CPU(obj);
587
588 cpu->dtb_compatible = "marvell,xscale";
589 set_feature(&cpu->env, ARM_FEATURE_V5);
590 set_feature(&cpu->env, ARM_FEATURE_XSCALE);
591 set_feature(&cpu->env, ARM_FEATURE_IWMMXT);
592 cpu->midr = 0x69054117;
593 cpu->ctr = 0xd172172;
594 cpu->reset_sctlr = 0x00000078;
595 }
596
597 static void arm_v7m_class_init(ObjectClass *oc, void *data)
598 {
599 ARMCPUClass *acc = ARM_CPU_CLASS(oc);
600 CPUClass *cc = CPU_CLASS(oc);
601
602 acc->info = data;
603 #ifndef CONFIG_USER_ONLY
604 cc->do_interrupt = arm_v7m_cpu_do_interrupt;
605 #endif
606
607 cc->cpu_exec_interrupt = arm_v7m_cpu_exec_interrupt;
608 cc->gdb_core_xml_file = "arm-m-profile.xml";
609 }
610
611 static const ARMCPUInfo arm_tcg_cpus[] = {
612 { .name = "arm926", .initfn = arm926_initfn },
613 { .name = "arm946", .initfn = arm946_initfn },
614 { .name = "arm1026", .initfn = arm1026_initfn },
615 /*
616 * What QEMU calls "arm1136-r2" is actually the 1136 r0p2, i.e. an
617 * older core than plain "arm1136". In particular this does not
618 * have the v6K features.
619 */
620 { .name = "arm1136-r2", .initfn = arm1136_r2_initfn },
621 { .name = "arm1136", .initfn = arm1136_initfn },
622 { .name = "arm1176", .initfn = arm1176_initfn },
623 { .name = "arm11mpcore", .initfn = arm11mpcore_initfn },
624 { .name = "cortex-m0", .initfn = cortex_m0_initfn,
625 .class_init = arm_v7m_class_init },
626 { .name = "cortex-m3", .initfn = cortex_m3_initfn,
627 .class_init = arm_v7m_class_init },
628 { .name = "cortex-m4", .initfn = cortex_m4_initfn,
629 .class_init = arm_v7m_class_init },
630 { .name = "cortex-m7", .initfn = cortex_m7_initfn,
631 .class_init = arm_v7m_class_init },
632 { .name = "cortex-m33", .initfn = cortex_m33_initfn,
633 .class_init = arm_v7m_class_init },
634 { .name = "cortex-r5", .initfn = cortex_r5_initfn },
635 { .name = "cortex-r5f", .initfn = cortex_r5f_initfn },
636 { .name = "ti925t", .initfn = ti925t_initfn },
637 { .name = "sa1100", .initfn = sa1100_initfn },
638 { .name = "sa1110", .initfn = sa1110_initfn },
639 { .name = "pxa250", .initfn = pxa250_initfn },
640 { .name = "pxa255", .initfn = pxa255_initfn },
641 { .name = "pxa260", .initfn = pxa260_initfn },
642 { .name = "pxa261", .initfn = pxa261_initfn },
643 { .name = "pxa262", .initfn = pxa262_initfn },
644 /* "pxa270" is an alias for "pxa270-a0" */
645 { .name = "pxa270", .initfn = pxa270a0_initfn },
646 { .name = "pxa270-a0", .initfn = pxa270a0_initfn },
647 { .name = "pxa270-a1", .initfn = pxa270a1_initfn },
648 { .name = "pxa270-b0", .initfn = pxa270b0_initfn },
649 { .name = "pxa270-b1", .initfn = pxa270b1_initfn },
650 { .name = "pxa270-c0", .initfn = pxa270c0_initfn },
651 { .name = "pxa270-c5", .initfn = pxa270c5_initfn },
652 };
653
654 static void arm_tcg_cpu_register_types(void)
655 {
656 size_t i;
657
658 for (i = 0; i < ARRAY_SIZE(arm_tcg_cpus); ++i) {
659 arm_cpu_register(&arm_tcg_cpus[i]);
660 }
661 }
662
663 type_init(arm_tcg_cpu_register_types)
664
665 #endif /* !CONFIG_USER_ONLY || !TARGET_AARCH64 */