1
target-arm queue: mostly just cleanup/minor stuff, but this does
1
arm pullreq for rc1. All minor bugfixes, except for the sve-default-vector-length
2
include the raspi3 board model.
2
patches, which are somewhere between a bugfix and a new feature.
3
3
4
thanks
4
-- PMM
5
-- PMM
5
6
6
The following changes since commit 9f9c53368b219a9115eddb39f0ff5ad19c977134:
7
The following changes since commit c08ccd1b53f488ac86c1f65cf7623dc91acc249a:
7
8
8
Merge remote-tracking branch 'remotes/vivier/tags/m68k-for-2.12-pull-request' into staging (2018-02-15 10:14:11 +0000)
9
Merge remote-tracking branch 'remotes/rth-gitlab/tags/pull-tcg-20210726' into staging (2021-07-27 08:35:01 +0100)
9
10
10
are available in the Git repository at:
11
are available in the Git repository at:
11
12
12
git://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20180215
13
https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20210727
13
14
14
for you to fetch changes up to e545f0f9be1f9e60951017c1e6558216732cc14e:
15
for you to fetch changes up to e229a179a503f2aee43a76888cf12fbdfe8a3749:
15
16
16
target/arm: Implement v8M MSPLIM and PSPLIM registers (2018-02-15 13:48:11 +0000)
17
hw: aspeed_gpio: Fix memory size (2021-07-27 11:00:00 +0100)
17
18
18
----------------------------------------------------------------
19
----------------------------------------------------------------
19
target-arm queue:
20
target-arm queue:
20
* aspeed: code cleanup to use unimplemented_device
21
* hw/arm/smmuv3: Check 31st bit to see if CD is valid
21
* add 'raspi3' RaspberryPi 3 machine model
22
* qemu-options.hx: Fix formatting of -machine memory-backend option
22
* more SVE prep work
23
* hw: aspeed_gpio: Fix memory size
23
* v8M: add minor missing registers
24
* hw/arm/nseries: Display hexadecimal value with '0x' prefix
24
* v7M: fix bug where we weren't migrating v7m.other_sp
25
* Add sve-default-vector-length cpu property
25
* v7M: fix bugs in handling of interrupt registers for
26
* docs: Update path that mentions deprecated.rst
26
external interrupts beyond 32
27
* hw/intc/armv7m_nvic: for v8.1M VECTPENDING hides S exceptions from NS
28
* hw/intc/armv7m_nvic: Correct size of ICSR.VECTPENDING
29
* hw/intc/armv7m_nvic: ISCR.ISRPENDING is set for non-enabled pending interrupts
30
* target/arm: Report M-profile alignment faults correctly to the guest
31
* target/arm: Add missing 'return's after calling v7m_exception_taken()
32
* target/arm: Enforce that M-profile SP low 2 bits are always zero
27
33
28
----------------------------------------------------------------
34
----------------------------------------------------------------
29
Pekka Enberg (3):
35
Joe Komlodi (1):
30
bcm2836: Make CPU type configurable
36
hw/arm/smmuv3: Check 31st bit to see if CD is valid
31
raspi: Raspberry Pi 3 support
32
raspi: Add "raspi3" machine type
33
37
34
Peter Maydell (11):
38
Joel Stanley (1):
35
hw/intc/armv7m_nvic: Don't hardcode M profile ID registers in NVIC
39
hw: aspeed_gpio: Fix memory size
36
hw/intc/armv7m_nvic: Fix ICSR PENDNMISET/CLR handling
37
hw/intc/armv7m_nvic: Implement M profile cache maintenance ops
38
hw/intc/armv7m_nvic: Implement v8M CPPWR register
39
hw/intc/armv7m_nvic: Implement cache ID registers
40
hw/intc/armv7m_nvic: Implement SCR
41
target/arm: Implement writing to CONTROL_NS for v8M
42
hw/intc/armv7m_nvic: Fix byte-to-interrupt number conversions
43
target/arm: Add AIRCR to vmstate struct
44
target/arm: Migrate v7m.other_sp
45
target/arm: Implement v8M MSPLIM and PSPLIM registers
46
40
47
Philippe Mathieu-Daudé (2):
41
Mao Zhongyi (1):
48
hw/arm/aspeed: directly map the serial device to the system address space
42
docs: Update path that mentions deprecated.rst
49
hw/arm/aspeed: simplify using the 'unimplemented device' for aspeed_soc.io
50
43
51
Richard Henderson (5):
44
Peter Maydell (7):
52
target/arm: Remove ARM_CP_64BIT from ZCR_EL registers
45
qemu-options.hx: Fix formatting of -machine memory-backend option
53
target/arm: Enforce FP access to FPCR/FPSR
46
target/arm: Enforce that M-profile SP low 2 bits are always zero
54
target/arm: Suppress TB end for FPCR/FPSR
47
target/arm: Add missing 'return's after calling v7m_exception_taken()
55
target/arm: Enforce access to ZCR_EL at translation
48
target/arm: Report M-profile alignment faults correctly to the guest
56
target/arm: Handle SVE registers when using clear_vec_high
49
hw/intc/armv7m_nvic: ISCR.ISRPENDING is set for non-enabled pending interrupts
50
hw/intc/armv7m_nvic: Correct size of ICSR.VECTPENDING
51
hw/intc/armv7m_nvic: for v8.1M VECTPENDING hides S exceptions from NS
57
52
58
include/hw/arm/aspeed_soc.h | 1 -
53
Philippe Mathieu-Daudé (1):
59
include/hw/arm/bcm2836.h | 1 +
54
hw/arm/nseries: Display hexadecimal value with '0x' prefix
60
target/arm/cpu.h | 71 ++++++++++++-----
61
target/arm/internals.h | 6 ++
62
hw/arm/aspeed_soc.c | 35 ++-------
63
hw/arm/bcm2836.c | 17 +++--
64
hw/arm/raspi.c | 57 +++++++++++---
65
hw/intc/armv7m_nvic.c | 98 ++++++++++++++++++------
66
target/arm/cpu.c | 28 +++++++
67
target/arm/helper.c | 84 +++++++++++++++-----
68
target/arm/machine.c | 84 ++++++++++++++++++++
69
target/arm/translate-a64.c | 181 ++++++++++++++++++++------------------------
70
12 files changed, 452 insertions(+), 211 deletions(-)
71
55
56
Richard Henderson (3):
57
target/arm: Correctly bound length in sve_zcr_get_valid_len
58
target/arm: Export aarch64_sve_zcr_get_valid_len
59
target/arm: Add sve-default-vector-length cpu property
60
61
docs/system/arm/cpu-features.rst | 15 ++++++++++
62
configure | 2 +-
63
hw/arm/smmuv3-internal.h | 2 +-
64
target/arm/cpu.h | 5 ++++
65
target/arm/internals.h | 10 +++++++
66
hw/arm/nseries.c | 2 +-
67
hw/gpio/aspeed_gpio.c | 3 +-
68
hw/intc/armv7m_nvic.c | 40 +++++++++++++++++++--------
69
target/arm/cpu.c | 14 ++++++++--
70
target/arm/cpu64.c | 60 ++++++++++++++++++++++++++++++++++++++++
71
target/arm/gdbstub.c | 4 +++
72
target/arm/helper.c | 8 ++++--
73
target/arm/m_helper.c | 24 ++++++++++++----
74
target/arm/translate.c | 3 ++
75
target/i386/cpu.c | 2 +-
76
MAINTAINERS | 2 +-
77
qemu-options.hx | 30 +++++++++++---------
78
17 files changed, 183 insertions(+), 43 deletions(-)
79
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
From: Joe Komlodi <joe.komlodi@xilinx.com>
2
2
3
When storing to an AdvSIMD FP register, all of the high
3
The bit to see if a CD is valid is the last bit of the first word of the CD.
4
bits of the SVE register are zeroed. Therefore, call it
5
more often with is_q as a parameter.
6
4
7
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
5
Signed-off-by: Joe Komlodi <joe.komlodi@xilinx.com>
8
Message-id: 20180211205848.4568-6-richard.henderson@linaro.org
6
Message-id: 1626728232-134665-2-git-send-email-joe.komlodi@xilinx.com
9
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
7
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
---
9
---
12
target/arm/translate-a64.c | 162 +++++++++++++++++----------------------------
10
hw/arm/smmuv3-internal.h | 2 +-
13
1 file changed, 62 insertions(+), 100 deletions(-)
11
1 file changed, 1 insertion(+), 1 deletion(-)
14
12
15
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
13
diff --git a/hw/arm/smmuv3-internal.h b/hw/arm/smmuv3-internal.h
16
index XXXXXXX..XXXXXXX 100644
14
index XXXXXXX..XXXXXXX 100644
17
--- a/target/arm/translate-a64.c
15
--- a/hw/arm/smmuv3-internal.h
18
+++ b/target/arm/translate-a64.c
16
+++ b/hw/arm/smmuv3-internal.h
19
@@ -XXX,XX +XXX,XX @@ static TCGv_i32 read_fp_sreg(DisasContext *s, int reg)
17
@@ -XXX,XX +XXX,XX @@ static inline int pa_range(STE *ste)
20
return v;
18
21
}
19
/* CD fields */
22
20
23
+/* Clear the bits above an N-bit vector, for N = (is_q ? 128 : 64).
21
-#define CD_VALID(x) extract32((x)->word[0], 30, 1)
24
+ * If SVE is not enabled, then there are only 128 bits in the vector.
22
+#define CD_VALID(x) extract32((x)->word[0], 31, 1)
25
+ */
23
#define CD_ASID(x) extract32((x)->word[1], 16, 16)
26
+static void clear_vec_high(DisasContext *s, bool is_q, int rd)
24
#define CD_TTB(x, sel) \
27
+{
25
({ \
28
+ unsigned ofs = fp_reg_offset(s, rd, MO_64);
29
+ unsigned vsz = vec_full_reg_size(s);
30
+
31
+ if (!is_q) {
32
+ TCGv_i64 tcg_zero = tcg_const_i64(0);
33
+ tcg_gen_st_i64(tcg_zero, cpu_env, ofs + 8);
34
+ tcg_temp_free_i64(tcg_zero);
35
+ }
36
+ if (vsz > 16) {
37
+ tcg_gen_gvec_dup8i(ofs + 16, vsz - 16, vsz - 16, 0);
38
+ }
39
+}
40
+
41
static void write_fp_dreg(DisasContext *s, int reg, TCGv_i64 v)
42
{
43
- TCGv_i64 tcg_zero = tcg_const_i64(0);
44
+ unsigned ofs = fp_reg_offset(s, reg, MO_64);
45
46
- tcg_gen_st_i64(v, cpu_env, fp_reg_offset(s, reg, MO_64));
47
- tcg_gen_st_i64(tcg_zero, cpu_env, fp_reg_hi_offset(s, reg));
48
- tcg_temp_free_i64(tcg_zero);
49
+ tcg_gen_st_i64(v, cpu_env, ofs);
50
+ clear_vec_high(s, false, reg);
51
}
52
53
static void write_fp_sreg(DisasContext *s, int reg, TCGv_i32 v)
54
@@ -XXX,XX +XXX,XX @@ static void do_fp_ld(DisasContext *s, int destidx, TCGv_i64 tcg_addr, int size)
55
56
tcg_temp_free_i64(tmplo);
57
tcg_temp_free_i64(tmphi);
58
+
59
+ clear_vec_high(s, true, destidx);
60
}
61
62
/*
63
@@ -XXX,XX +XXX,XX @@ static void write_vec_element_i32(DisasContext *s, TCGv_i32 tcg_src,
64
}
65
}
66
67
-/* Clear the high 64 bits of a 128 bit vector (in general non-quad
68
- * vector ops all need to do this).
69
- */
70
-static void clear_vec_high(DisasContext *s, int rd)
71
-{
72
- TCGv_i64 tcg_zero = tcg_const_i64(0);
73
-
74
- write_vec_element(s, tcg_zero, rd, 1, MO_64);
75
- tcg_temp_free_i64(tcg_zero);
76
-}
77
-
78
/* Store from vector register to memory */
79
static void do_vec_st(DisasContext *s, int srcidx, int element,
80
TCGv_i64 tcg_addr, int size)
81
@@ -XXX,XX +XXX,XX @@ static void disas_ldst_multiple_struct(DisasContext *s, uint32_t insn)
82
/* For non-quad operations, setting a slice of the low
83
* 64 bits of the register clears the high 64 bits (in
84
* the ARM ARM pseudocode this is implicit in the fact
85
- * that 'rval' is a 64 bit wide variable). We optimize
86
- * by noticing that we only need to do this the first
87
- * time we touch a register.
88
+ * that 'rval' is a 64 bit wide variable).
89
+ * For quad operations, we might still need to zero the
90
+ * high bits of SVE. We optimize by noticing that we only
91
+ * need to do this the first time we touch a register.
92
*/
93
- if (!is_q && e == 0 && (r == 0 || xs == selem - 1)) {
94
- clear_vec_high(s, tt);
95
+ if (e == 0 && (r == 0 || xs == selem - 1)) {
96
+ clear_vec_high(s, is_q, tt);
97
}
98
}
99
tcg_gen_addi_i64(tcg_addr, tcg_addr, ebytes);
100
@@ -XXX,XX +XXX,XX @@ static void disas_ldst_single_struct(DisasContext *s, uint32_t insn)
101
write_vec_element(s, tcg_tmp, rt, 0, MO_64);
102
if (is_q) {
103
write_vec_element(s, tcg_tmp, rt, 1, MO_64);
104
- } else {
105
- clear_vec_high(s, rt);
106
}
107
tcg_temp_free_i64(tcg_tmp);
108
+ clear_vec_high(s, is_q, rt);
109
} else {
110
/* Load/store one element per register */
111
if (is_load) {
112
@@ -XXX,XX +XXX,XX @@ static void handle_vec_simd_sqshrn(DisasContext *s, bool is_scalar, bool is_q,
113
}
114
115
if (!is_q) {
116
- clear_vec_high(s, rd);
117
write_vec_element(s, tcg_final, rd, 0, MO_64);
118
} else {
119
write_vec_element(s, tcg_final, rd, 1, MO_64);
120
@@ -XXX,XX +XXX,XX @@ static void handle_vec_simd_sqshrn(DisasContext *s, bool is_scalar, bool is_q,
121
tcg_temp_free_i64(tcg_rd);
122
tcg_temp_free_i32(tcg_rd_narrowed);
123
tcg_temp_free_i64(tcg_final);
124
- return;
125
+
126
+ clear_vec_high(s, is_q, rd);
127
}
128
129
/* SQSHLU, UQSHL, SQSHL: saturating left shifts */
130
@@ -XXX,XX +XXX,XX @@ static void handle_simd_qshl(DisasContext *s, bool scalar, bool is_q,
131
tcg_temp_free_i64(tcg_op);
132
}
133
tcg_temp_free_i64(tcg_shift);
134
-
135
- if (!is_q) {
136
- clear_vec_high(s, rd);
137
- }
138
+ clear_vec_high(s, is_q, rd);
139
} else {
140
TCGv_i32 tcg_shift = tcg_const_i32(shift);
141
static NeonGenTwoOpEnvFn * const fns[2][2][3] = {
142
@@ -XXX,XX +XXX,XX @@ static void handle_simd_qshl(DisasContext *s, bool scalar, bool is_q,
143
}
144
tcg_temp_free_i32(tcg_shift);
145
146
- if (!is_q && !scalar) {
147
- clear_vec_high(s, rd);
148
+ if (!scalar) {
149
+ clear_vec_high(s, is_q, rd);
150
}
151
}
152
}
153
@@ -XXX,XX +XXX,XX @@ static void handle_simd_intfp_conv(DisasContext *s, int rd, int rn,
154
}
155
}
156
157
- if (!is_double && elements == 2) {
158
- clear_vec_high(s, rd);
159
- }
160
-
161
tcg_temp_free_i64(tcg_int);
162
tcg_temp_free_ptr(tcg_fpst);
163
tcg_temp_free_i32(tcg_shift);
164
+
165
+ clear_vec_high(s, elements << size == 16, rd);
166
}
167
168
/* UCVTF/SCVTF - Integer to FP conversion */
169
@@ -XXX,XX +XXX,XX @@ static void handle_simd_shift_fpint_conv(DisasContext *s, bool is_scalar,
170
write_vec_element(s, tcg_op, rd, pass, MO_64);
171
tcg_temp_free_i64(tcg_op);
172
}
173
- if (!is_q) {
174
- clear_vec_high(s, rd);
175
- }
176
+ clear_vec_high(s, is_q, rd);
177
} else {
178
int maxpass = is_scalar ? 1 : is_q ? 4 : 2;
179
for (pass = 0; pass < maxpass; pass++) {
180
@@ -XXX,XX +XXX,XX @@ static void handle_simd_shift_fpint_conv(DisasContext *s, bool is_scalar,
181
}
182
tcg_temp_free_i32(tcg_op);
183
}
184
- if (!is_q && !is_scalar) {
185
- clear_vec_high(s, rd);
186
+ if (!is_scalar) {
187
+ clear_vec_high(s, is_q, rd);
188
}
189
}
190
191
@@ -XXX,XX +XXX,XX @@ static void handle_3same_float(DisasContext *s, int size, int elements,
192
193
tcg_temp_free_ptr(fpst);
194
195
- if ((elements << size) < 4) {
196
- /* scalar, or non-quad vector op */
197
- clear_vec_high(s, rd);
198
- }
199
+ clear_vec_high(s, elements * (size ? 8 : 4) > 8, rd);
200
}
201
202
/* AdvSIMD scalar three same
203
@@ -XXX,XX +XXX,XX @@ static void handle_2misc_fcmp_zero(DisasContext *s, int opcode,
204
}
205
write_vec_element(s, tcg_res, rd, pass, MO_64);
206
}
207
- if (is_scalar) {
208
- clear_vec_high(s, rd);
209
- }
210
-
211
tcg_temp_free_i64(tcg_res);
212
tcg_temp_free_i64(tcg_zero);
213
tcg_temp_free_i64(tcg_op);
214
+
215
+ clear_vec_high(s, !is_scalar, rd);
216
} else {
217
TCGv_i32 tcg_op = tcg_temp_new_i32();
218
TCGv_i32 tcg_zero = tcg_const_i32(0);
219
@@ -XXX,XX +XXX,XX @@ static void handle_2misc_fcmp_zero(DisasContext *s, int opcode,
220
tcg_temp_free_i32(tcg_res);
221
tcg_temp_free_i32(tcg_zero);
222
tcg_temp_free_i32(tcg_op);
223
- if (!is_q && !is_scalar) {
224
- clear_vec_high(s, rd);
225
+ if (!is_scalar) {
226
+ clear_vec_high(s, is_q, rd);
227
}
228
}
229
230
@@ -XXX,XX +XXX,XX @@ static void handle_2misc_reciprocal(DisasContext *s, int opcode,
231
}
232
write_vec_element(s, tcg_res, rd, pass, MO_64);
233
}
234
- if (is_scalar) {
235
- clear_vec_high(s, rd);
236
- }
237
-
238
tcg_temp_free_i64(tcg_res);
239
tcg_temp_free_i64(tcg_op);
240
+ clear_vec_high(s, !is_scalar, rd);
241
} else {
242
TCGv_i32 tcg_op = tcg_temp_new_i32();
243
TCGv_i32 tcg_res = tcg_temp_new_i32();
244
@@ -XXX,XX +XXX,XX @@ static void handle_2misc_reciprocal(DisasContext *s, int opcode,
245
}
246
tcg_temp_free_i32(tcg_res);
247
tcg_temp_free_i32(tcg_op);
248
- if (!is_q && !is_scalar) {
249
- clear_vec_high(s, rd);
250
+ if (!is_scalar) {
251
+ clear_vec_high(s, is_q, rd);
252
}
253
}
254
tcg_temp_free_ptr(fpst);
255
@@ -XXX,XX +XXX,XX @@ static void handle_2misc_narrow(DisasContext *s, bool scalar,
256
write_vec_element_i32(s, tcg_res[pass], rd, destelt + pass, MO_32);
257
tcg_temp_free_i32(tcg_res[pass]);
258
}
259
- if (!is_q) {
260
- clear_vec_high(s, rd);
261
- }
262
+ clear_vec_high(s, is_q, rd);
263
}
264
265
/* Remaining saturating accumulating ops */
266
@@ -XXX,XX +XXX,XX @@ static void handle_2misc_satacc(DisasContext *s, bool is_scalar, bool is_u,
267
}
268
write_vec_element(s, tcg_rd, rd, pass, MO_64);
269
}
270
- if (is_scalar) {
271
- clear_vec_high(s, rd);
272
- }
273
-
274
tcg_temp_free_i64(tcg_rd);
275
tcg_temp_free_i64(tcg_rn);
276
+ clear_vec_high(s, !is_scalar, rd);
277
} else {
278
TCGv_i32 tcg_rn = tcg_temp_new_i32();
279
TCGv_i32 tcg_rd = tcg_temp_new_i32();
280
@@ -XXX,XX +XXX,XX @@ static void handle_2misc_satacc(DisasContext *s, bool is_scalar, bool is_u,
281
}
282
write_vec_element_i32(s, tcg_rd, rd, pass, MO_32);
283
}
284
-
285
- if (!is_q) {
286
- clear_vec_high(s, rd);
287
- }
288
-
289
tcg_temp_free_i32(tcg_rd);
290
tcg_temp_free_i32(tcg_rn);
291
+ clear_vec_high(s, is_q, rd);
292
}
293
}
294
295
@@ -XXX,XX +XXX,XX @@ static void handle_vec_simd_shri(DisasContext *s, bool is_q, bool is_u,
296
tcg_temp_free_i64(tcg_round);
297
298
done:
299
- if (!is_q) {
300
- clear_vec_high(s, rd);
301
- }
302
+ clear_vec_high(s, is_q, rd);
303
}
304
305
static void gen_shl8_ins_i64(TCGv_i64 d, TCGv_i64 a, int64_t shift)
306
@@ -XXX,XX +XXX,XX @@ static void handle_vec_simd_shrn(DisasContext *s, bool is_q,
307
}
308
309
if (!is_q) {
310
- clear_vec_high(s, rd);
311
write_vec_element(s, tcg_final, rd, 0, MO_64);
312
} else {
313
write_vec_element(s, tcg_final, rd, 1, MO_64);
314
}
315
-
316
if (round) {
317
tcg_temp_free_i64(tcg_round);
318
}
319
tcg_temp_free_i64(tcg_rn);
320
tcg_temp_free_i64(tcg_rd);
321
tcg_temp_free_i64(tcg_final);
322
- return;
323
+
324
+ clear_vec_high(s, is_q, rd);
325
}
326
327
328
@@ -XXX,XX +XXX,XX @@ static void handle_3rd_narrowing(DisasContext *s, int is_q, int is_u, int size,
329
write_vec_element_i32(s, tcg_res[pass], rd, pass + part, MO_32);
330
tcg_temp_free_i32(tcg_res[pass]);
331
}
332
- if (!is_q) {
333
- clear_vec_high(s, rd);
334
- }
335
+ clear_vec_high(s, is_q, rd);
336
}
337
338
static void handle_pmull_64(DisasContext *s, int is_q, int rd, int rn, int rm)
339
@@ -XXX,XX +XXX,XX @@ static void handle_simd_3same_pair(DisasContext *s, int is_q, int u, int opcode,
340
write_vec_element_i32(s, tcg_res[pass], rd, pass, MO_32);
341
tcg_temp_free_i32(tcg_res[pass]);
342
}
343
- if (!is_q) {
344
- clear_vec_high(s, rd);
345
- }
346
+ clear_vec_high(s, is_q, rd);
347
}
348
349
if (fpst) {
350
@@ -XXX,XX +XXX,XX @@ static void disas_simd_3same_int(DisasContext *s, uint32_t insn)
351
tcg_temp_free_i32(tcg_op2);
352
}
353
}
354
-
355
- if (!is_q) {
356
- clear_vec_high(s, rd);
357
- }
358
+ clear_vec_high(s, is_q, rd);
359
}
360
361
/* AdvSIMD three same
362
@@ -XXX,XX +XXX,XX @@ static void handle_rev(DisasContext *s, int opcode, bool u,
363
write_vec_element(s, tcg_tmp, rd, i, grp_size);
364
tcg_temp_free_i64(tcg_tmp);
365
}
366
- if (!is_q) {
367
- clear_vec_high(s, rd);
368
- }
369
+ clear_vec_high(s, is_q, rd);
370
} else {
371
int revmask = (1 << grp_size) - 1;
372
int esize = 8 << size;
373
@@ -XXX,XX +XXX,XX @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn)
374
tcg_temp_free_i32(tcg_op);
375
}
376
}
377
- if (!is_q) {
378
- clear_vec_high(s, rd);
379
- }
380
+ clear_vec_high(s, is_q, rd);
381
382
if (need_rmode) {
383
gen_helper_set_rmode(tcg_rmode, tcg_rmode, cpu_env);
384
@@ -XXX,XX +XXX,XX @@ static void disas_simd_indexed(DisasContext *s, uint32_t insn)
385
tcg_temp_free_i64(tcg_res);
386
}
387
388
- if (is_scalar) {
389
- clear_vec_high(s, rd);
390
- }
391
-
392
tcg_temp_free_i64(tcg_idx);
393
+ clear_vec_high(s, !is_scalar, rd);
394
} else if (!is_long) {
395
/* 32 bit floating point, or 16 or 32 bit integer.
396
* For the 16 bit scalar case we use the usual Neon helpers and
397
@@ -XXX,XX +XXX,XX @@ static void disas_simd_indexed(DisasContext *s, uint32_t insn)
398
}
399
400
tcg_temp_free_i32(tcg_idx);
401
-
402
- if (!is_q) {
403
- clear_vec_high(s, rd);
404
- }
405
+ clear_vec_high(s, is_q, rd);
406
} else {
407
/* long ops: 16x16->32 or 32x32->64 */
408
TCGv_i64 tcg_res[2];
409
@@ -XXX,XX +XXX,XX @@ static void disas_simd_indexed(DisasContext *s, uint32_t insn)
410
}
411
tcg_temp_free_i64(tcg_idx);
412
413
- if (is_scalar) {
414
- clear_vec_high(s, rd);
415
- }
416
+ clear_vec_high(s, !is_scalar, rd);
417
} else {
418
TCGv_i32 tcg_idx = tcg_temp_new_i32();
419
420
--
26
--
421
2.16.1
27
2.20.1
422
28
423
29
diff view generated by jsdifflib
1
In commit abc24d86cc0364f we accidentally broke migration of
1
The documentation of the -machine memory-backend has some minor
2
the stack pointer value for the mode (process, handler) the CPU
2
formatting errors:
3
is not currently running as. (The commit correctly removed the
3
* Misindentation of the initial line meant that the whole option
4
no-longer-used v7m.current_sp flag from the VMState but also
4
section is incorrectly indented in the HTML output compared to
5
deleted the still very much in use v7m.other_sp SP value field.)
5
the other -machine options
6
* The examples weren't indented, which meant that they were formatted
7
as plain run-on text including outputting the "::" as text.
8
* The a) b) list has no rst-format markup so it is rendered as
9
a single run-on paragraph
6
10
7
Add a subsection to migrate it again. (We don't need to care
11
Fix the formatting.
8
about trying to retain compatibility with pre-abc24d86cc0364f
9
versions of QEMU, because that commit bumped the version_id
10
and we've since bumped it again a couple of times.)
11
12
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
14
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
14
Message-id: 20180209165810.6668-11-peter.maydell@linaro.org
15
Message-id: 20210719105257.3599-1-peter.maydell@linaro.org
15
---
16
---
16
target/arm/machine.c | 11 +++++++++++
17
qemu-options.hx | 30 +++++++++++++++++-------------
17
1 file changed, 11 insertions(+)
18
1 file changed, 17 insertions(+), 13 deletions(-)
18
19
19
diff --git a/target/arm/machine.c b/target/arm/machine.c
20
diff --git a/qemu-options.hx b/qemu-options.hx
20
index XXXXXXX..XXXXXXX 100644
21
index XXXXXXX..XXXXXXX 100644
21
--- a/target/arm/machine.c
22
--- a/qemu-options.hx
22
+++ b/target/arm/machine.c
23
+++ b/qemu-options.hx
23
@@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_m_scr = {
24
@@ -XXX,XX +XXX,XX @@ SRST
24
}
25
Enables or disables ACPI Heterogeneous Memory Attribute Table
25
};
26
(HMAT) support. The default is off.
26
27
27
+static const VMStateDescription vmstate_m_other_sp = {
28
- ``memory-backend='id'``
28
+ .name = "cpu/m/other-sp",
29
+ ``memory-backend='id'``
29
+ .version_id = 1,
30
An alternative to legacy ``-mem-path`` and ``mem-prealloc`` options.
30
+ .minimum_version_id = 1,
31
Allows to use a memory backend as main RAM.
31
+ .fields = (VMStateField[]) {
32
32
+ VMSTATE_UINT32(env.v7m.other_sp, ARMCPU),
33
For example:
33
+ VMSTATE_END_OF_LIST()
34
::
34
+ }
35
- -object memory-backend-file,id=pc.ram,size=512M,mem-path=/hugetlbfs,prealloc=on,share=on
35
+};
36
- -machine memory-backend=pc.ram
37
- -m 512M
36
+
38
+
37
static const VMStateDescription vmstate_m = {
39
+ -object memory-backend-file,id=pc.ram,size=512M,mem-path=/hugetlbfs,prealloc=on,share=on
38
.name = "cpu/m",
40
+ -machine memory-backend=pc.ram
39
.version_id = 4,
41
+ -m 512M
40
@@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_m = {
42
41
&vmstate_m_faultmask_primask,
43
Migration compatibility note:
42
&vmstate_m_csselr,
44
- a) as backend id one shall use value of 'default-ram-id', advertised by
43
&vmstate_m_scr,
45
- machine type (available via ``query-machines`` QMP command), if migration
44
+ &vmstate_m_other_sp,
46
- to/from old QEMU (<5.0) is expected.
45
NULL
47
- b) for machine types 4.0 and older, user shall
46
}
48
- use ``x-use-canonical-path-for-ramblock-id=off`` backend option
47
};
49
- if migration to/from old QEMU (<5.0) is expected.
50
+
51
+ * as backend id one shall use value of 'default-ram-id', advertised by
52
+ machine type (available via ``query-machines`` QMP command), if migration
53
+ to/from old QEMU (<5.0) is expected.
54
+ * for machine types 4.0 and older, user shall
55
+ use ``x-use-canonical-path-for-ramblock-id=off`` backend option
56
+ if migration to/from old QEMU (<5.0) is expected.
57
+
58
For example:
59
::
60
- -object memory-backend-ram,id=pc.ram,size=512M,x-use-canonical-path-for-ramblock-id=off
61
- -machine memory-backend=pc.ram
62
- -m 512M
63
+
64
+ -object memory-backend-ram,id=pc.ram,size=512M,x-use-canonical-path-for-ramblock-id=off
65
+ -machine memory-backend=pc.ram
66
+ -m 512M
67
ERST
68
69
HXCOMM Deprecated by -machine
48
--
70
--
49
2.16.1
71
2.20.1
50
72
51
73
diff view generated by jsdifflib
1
The v8M architecture includes hardware support for enforcing
1
For M-profile, unlike A-profile, the low 2 bits of SP are defined to be
2
stack pointer limits. We don't implement this behaviour yet,
2
RES0H, which is to say that they must be hardwired to zero so that
3
but provide the MSPLIM and PSPLIM stack pointer limit registers
3
guest attempts to write non-zero values to them are ignored.
4
as reads-as-written, so that when we do implement the checks
4
5
in future this won't break guest migration.
5
Implement this behaviour by masking out the low bits:
6
* for writes to r13 by the gdbstub
7
* for writes to any of the various flavours of SP via MSR
8
* for writes to r13 via store_reg() in generated code
9
10
Note that all the direct uses of cpu_R[] in translate.c are in places
11
where the register is definitely not r13 (usually because that has
12
been checked for as an UNDEFINED or UNPREDICTABLE case and handled as
13
UNDEF).
14
15
All the other writes to regs[13] in C code are either:
16
* A-profile only code
17
* writes of values we can guarantee to be aligned, such as
18
- writes of previous-SP-value plus or minus a 4-aligned constant
19
- writes of the value in an SP limit register (which we already
20
enforce to be aligned)
6
21
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
22
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
23
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
9
Message-id: 20180209165810.6668-12-peter.maydell@linaro.org
24
Message-id: 20210723162146.5167-2-peter.maydell@linaro.org
10
---
25
---
11
target/arm/cpu.h | 2 ++
26
target/arm/gdbstub.c | 4 ++++
12
target/arm/helper.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++
27
target/arm/m_helper.c | 14 ++++++++------
13
target/arm/machine.c | 21 +++++++++++++++++++++
28
target/arm/translate.c | 3 +++
14
3 files changed, 69 insertions(+)
29
3 files changed, 15 insertions(+), 6 deletions(-)
15
30
16
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
31
diff --git a/target/arm/gdbstub.c b/target/arm/gdbstub.c
17
index XXXXXXX..XXXXXXX 100644
32
index XXXXXXX..XXXXXXX 100644
18
--- a/target/arm/cpu.h
33
--- a/target/arm/gdbstub.c
19
+++ b/target/arm/cpu.h
34
+++ b/target/arm/gdbstub.c
20
@@ -XXX,XX +XXX,XX @@ typedef struct CPUARMState {
35
@@ -XXX,XX +XXX,XX @@ int arm_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n)
21
uint32_t secure; /* Is CPU in Secure state? (not guest visible) */
36
22
uint32_t csselr[M_REG_NUM_BANKS];
37
if (n < 16) {
23
uint32_t scr[M_REG_NUM_BANKS];
38
/* Core integer register. */
24
+ uint32_t msplim[M_REG_NUM_BANKS];
39
+ if (n == 13 && arm_feature(env, ARM_FEATURE_M)) {
25
+ uint32_t psplim[M_REG_NUM_BANKS];
40
+ /* M profile SP low bits are always 0 */
26
} v7m;
41
+ tmp &= ~3;
27
42
+ }
28
/* Information associated with an exception about to be taken:
43
env->regs[n] = tmp;
29
diff --git a/target/arm/helper.c b/target/arm/helper.c
44
return 4;
45
}
46
diff --git a/target/arm/m_helper.c b/target/arm/m_helper.c
30
index XXXXXXX..XXXXXXX 100644
47
index XXXXXXX..XXXXXXX 100644
31
--- a/target/arm/helper.c
48
--- a/target/arm/m_helper.c
32
+++ b/target/arm/helper.c
49
+++ b/target/arm/m_helper.c
33
@@ -XXX,XX +XXX,XX @@ uint32_t HELPER(v7m_mrs)(CPUARMState *env, uint32_t reg)
34
return 0;
35
}
36
return env->v7m.other_ss_psp;
37
+ case 0x8a: /* MSPLIM_NS */
38
+ if (!env->v7m.secure) {
39
+ return 0;
40
+ }
41
+ return env->v7m.msplim[M_REG_NS];
42
+ case 0x8b: /* PSPLIM_NS */
43
+ if (!env->v7m.secure) {
44
+ return 0;
45
+ }
46
+ return env->v7m.psplim[M_REG_NS];
47
case 0x90: /* PRIMASK_NS */
48
if (!env->v7m.secure) {
49
return 0;
50
@@ -XXX,XX +XXX,XX @@ uint32_t HELPER(v7m_mrs)(CPUARMState *env, uint32_t reg)
51
return v7m_using_psp(env) ? env->v7m.other_sp : env->regs[13];
52
case 9: /* PSP */
53
return v7m_using_psp(env) ? env->regs[13] : env->v7m.other_sp;
54
+ case 10: /* MSPLIM */
55
+ if (!arm_feature(env, ARM_FEATURE_V8)) {
56
+ goto bad_reg;
57
+ }
58
+ return env->v7m.msplim[env->v7m.secure];
59
+ case 11: /* PSPLIM */
60
+ if (!arm_feature(env, ARM_FEATURE_V8)) {
61
+ goto bad_reg;
62
+ }
63
+ return env->v7m.psplim[env->v7m.secure];
64
case 16: /* PRIMASK */
65
return env->v7m.primask[env->v7m.secure];
66
case 17: /* BASEPRI */
67
@@ -XXX,XX +XXX,XX @@ uint32_t HELPER(v7m_mrs)(CPUARMState *env, uint32_t reg)
68
case 19: /* FAULTMASK */
69
return env->v7m.faultmask[env->v7m.secure];
70
default:
71
+ bad_reg:
72
qemu_log_mask(LOG_GUEST_ERROR, "Attempt to read unknown special"
73
" register %d\n", reg);
74
return 0;
75
@@ -XXX,XX +XXX,XX @@ void HELPER(v7m_msr)(CPUARMState *env, uint32_t maskreg, uint32_t val)
50
@@ -XXX,XX +XXX,XX @@ void HELPER(v7m_msr)(CPUARMState *env, uint32_t maskreg, uint32_t val)
76
}
77
env->v7m.other_ss_psp = val;
78
return;
79
+ case 0x8a: /* MSPLIM_NS */
80
+ if (!env->v7m.secure) {
81
+ return;
82
+ }
83
+ env->v7m.msplim[M_REG_NS] = val & ~7;
84
+ return;
85
+ case 0x8b: /* PSPLIM_NS */
86
+ if (!env->v7m.secure) {
87
+ return;
88
+ }
89
+ env->v7m.psplim[M_REG_NS] = val & ~7;
90
+ return;
91
case 0x90: /* PRIMASK_NS */
92
if (!env->v7m.secure) {
51
if (!env->v7m.secure) {
93
return;
52
return;
53
}
54
- env->v7m.other_ss_msp = val;
55
+ env->v7m.other_ss_msp = val & ~3;
56
return;
57
case 0x89: /* PSP_NS */
58
if (!env->v7m.secure) {
59
return;
60
}
61
- env->v7m.other_ss_psp = val;
62
+ env->v7m.other_ss_psp = val & ~3;
63
return;
64
case 0x8a: /* MSPLIM_NS */
65
if (!env->v7m.secure) {
94
@@ -XXX,XX +XXX,XX @@ void HELPER(v7m_msr)(CPUARMState *env, uint32_t maskreg, uint32_t val)
66
@@ -XXX,XX +XXX,XX @@ void HELPER(v7m_msr)(CPUARMState *env, uint32_t maskreg, uint32_t val)
95
env->v7m.other_sp = val;
67
68
limit = is_psp ? env->v7m.psplim[false] : env->v7m.msplim[false];
69
70
+ val &= ~0x3;
71
+
72
if (val < limit) {
73
raise_exception_ra(env, EXCP_STKOF, 0, 1, GETPC());
74
}
75
@@ -XXX,XX +XXX,XX @@ void HELPER(v7m_msr)(CPUARMState *env, uint32_t maskreg, uint32_t val)
76
break;
77
case 8: /* MSP */
78
if (v7m_using_psp(env)) {
79
- env->v7m.other_sp = val;
80
+ env->v7m.other_sp = val & ~3;
81
} else {
82
- env->regs[13] = val;
83
+ env->regs[13] = val & ~3;
96
}
84
}
97
break;
85
break;
98
+ case 10: /* MSPLIM */
86
case 9: /* PSP */
99
+ if (!arm_feature(env, ARM_FEATURE_V8)) {
87
if (v7m_using_psp(env)) {
100
+ goto bad_reg;
88
- env->regs[13] = val;
101
+ }
89
+ env->regs[13] = val & ~3;
102
+ env->v7m.msplim[env->v7m.secure] = val & ~7;
90
} else {
103
+ break;
91
- env->v7m.other_sp = val;
104
+ case 11: /* PSPLIM */
92
+ env->v7m.other_sp = val & ~3;
105
+ if (!arm_feature(env, ARM_FEATURE_V8)) {
93
}
106
+ goto bad_reg;
107
+ }
108
+ env->v7m.psplim[env->v7m.secure] = val & ~7;
109
+ break;
110
case 16: /* PRIMASK */
111
env->v7m.primask[env->v7m.secure] = val & 1;
112
break;
94
break;
113
@@ -XXX,XX +XXX,XX @@ void HELPER(v7m_msr)(CPUARMState *env, uint32_t maskreg, uint32_t val)
95
case 10: /* MSPLIM */
114
env->v7m.control[env->v7m.secure] |= val & R_V7M_CONTROL_NPRIV_MASK;
96
diff --git a/target/arm/translate.c b/target/arm/translate.c
115
break;
116
default:
117
+ bad_reg:
118
qemu_log_mask(LOG_GUEST_ERROR, "Attempt to write unknown special"
119
" register %d\n", reg);
120
return;
121
diff --git a/target/arm/machine.c b/target/arm/machine.c
122
index XXXXXXX..XXXXXXX 100644
97
index XXXXXXX..XXXXXXX 100644
123
--- a/target/arm/machine.c
98
--- a/target/arm/translate.c
124
+++ b/target/arm/machine.c
99
+++ b/target/arm/translate.c
125
@@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_m_other_sp = {
100
@@ -XXX,XX +XXX,XX @@ void store_reg(DisasContext *s, int reg, TCGv_i32 var)
101
*/
102
tcg_gen_andi_i32(var, var, s->thumb ? ~1 : ~3);
103
s->base.is_jmp = DISAS_JUMP;
104
+ } else if (reg == 13 && arm_dc_feature(s, ARM_FEATURE_M)) {
105
+ /* For M-profile SP bits [1:0] are always zero */
106
+ tcg_gen_andi_i32(var, var, ~3);
126
}
107
}
127
};
108
tcg_gen_mov_i32(cpu_R[reg], var);
128
109
tcg_temp_free_i32(var);
129
+static bool m_v8m_needed(void *opaque)
130
+{
131
+ ARMCPU *cpu = opaque;
132
+ CPUARMState *env = &cpu->env;
133
+
134
+ return arm_feature(env, ARM_FEATURE_M) && arm_feature(env, ARM_FEATURE_V8);
135
+}
136
+
137
+static const VMStateDescription vmstate_m_v8m = {
138
+ .name = "cpu/m/v8m",
139
+ .version_id = 1,
140
+ .minimum_version_id = 1,
141
+ .needed = m_v8m_needed,
142
+ .fields = (VMStateField[]) {
143
+ VMSTATE_UINT32_ARRAY(env.v7m.msplim, ARMCPU, M_REG_NUM_BANKS),
144
+ VMSTATE_UINT32_ARRAY(env.v7m.psplim, ARMCPU, M_REG_NUM_BANKS),
145
+ VMSTATE_END_OF_LIST()
146
+ }
147
+};
148
+
149
static const VMStateDescription vmstate_m = {
150
.name = "cpu/m",
151
.version_id = 4,
152
@@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_m = {
153
&vmstate_m_csselr,
154
&vmstate_m_scr,
155
&vmstate_m_other_sp,
156
+ &vmstate_m_v8m,
157
NULL
158
}
159
};
160
--
110
--
161
2.16.1
111
2.20.1
162
112
163
113
diff view generated by jsdifflib
1
In commit commit 3b2e934463121 we added support for the AIRCR
1
In do_v7m_exception_exit(), we perform various checks as part of
2
register holding state, but forgot to add it to the vmstate
2
performing the exception return. If one of these checks fails, the
3
structs. Since it only holds r/w state if the security extension
3
architecture requires that we take an appropriate exception on the
4
is implemented, we can just add it to vmstate_m_security.
4
existing stackframe. We implement this by calling
5
v7m_exception_taken() to set up to take the new exception, and then
6
immediately returning from do_v7m_exception_exit() without proceeding
7
any further with the unstack-and-exception-return process.
8
9
In a couple of checks that are new in v8.1M, we forgot the "return"
10
statement, with the effect that if bad code in the guest tripped over
11
these checks we would set up to take a UsageFault exception but then
12
blunder on trying to also unstack and return from the original
13
exception, with the probable result that the guest would crash.
14
15
Add the missing return statements.
5
16
6
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
17
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
18
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
8
Message-id: 20180209165810.6668-10-peter.maydell@linaro.org
19
Message-id: 20210723162146.5167-3-peter.maydell@linaro.org
9
---
20
---
10
target/arm/machine.c | 4 ++++
21
target/arm/m_helper.c | 2 ++
11
1 file changed, 4 insertions(+)
22
1 file changed, 2 insertions(+)
12
23
13
diff --git a/target/arm/machine.c b/target/arm/machine.c
24
diff --git a/target/arm/m_helper.c b/target/arm/m_helper.c
14
index XXXXXXX..XXXXXXX 100644
25
index XXXXXXX..XXXXXXX 100644
15
--- a/target/arm/machine.c
26
--- a/target/arm/m_helper.c
16
+++ b/target/arm/machine.c
27
+++ b/target/arm/m_helper.c
17
@@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_m_security = {
28
@@ -XXX,XX +XXX,XX @@ static void do_v7m_exception_exit(ARMCPU *cpu)
18
VMSTATE_VALIDATE("SAU_RNR is valid", sau_rnr_vmstate_validate),
29
qemu_log_mask(CPU_LOG_INT, "...taking UsageFault on existing "
19
VMSTATE_UINT32(env.sau.ctrl, ARMCPU),
30
"stackframe: NSACR prevents clearing FPU registers\n");
20
VMSTATE_UINT32(env.v7m.scr[M_REG_S], ARMCPU),
31
v7m_exception_taken(cpu, excret, true, false);
21
+ /* AIRCR is not secure-only, but our implementation is R/O if the
32
+ return;
22
+ * security extension is unimplemented, so we migrate it here.
33
} else if (!cpacr_pass) {
23
+ */
34
armv7m_nvic_set_pending(env->nvic, ARMV7M_EXCP_USAGE,
24
+ VMSTATE_UINT32(env.v7m.aircr, ARMCPU),
35
exc_secure);
25
VMSTATE_END_OF_LIST()
36
@@ -XXX,XX +XXX,XX @@ static void do_v7m_exception_exit(ARMCPU *cpu)
26
}
37
qemu_log_mask(CPU_LOG_INT, "...taking UsageFault on existing "
27
};
38
"stackframe: CPACR prevents clearing FPU registers\n");
39
v7m_exception_taken(cpu, excret, true, false);
40
+ return;
41
}
42
}
43
/* Clear s0..s15, FPSCR and VPR */
28
--
44
--
29
2.16.1
45
2.20.1
30
46
31
47
diff view generated by jsdifflib
1
In commit 50f11062d4c896 we added support for MSR/MRS access
1
For M-profile, we weren't reporting alignment faults triggered by the
2
to the NS banked special registers, but we forgot to implement
2
generic TCG code correctly to the guest. These get passed into
3
the support for writing to CONTROL_NS. Correct the omission.
3
arm_v7m_cpu_do_interrupt() as an EXCP_DATA_ABORT with an A-profile
4
style exception.fsr value of 1. We didn't check for this, and so
5
they fell through into the default of "assume this is an MPU fault"
6
and were reported to the guest as a data access violation MPU fault.
7
8
Report these alignment faults as UsageFaults which set the UNALIGNED
9
bit in the UFSR.
4
10
5
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
12
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
7
Message-id: 20180209165810.6668-8-peter.maydell@linaro.org
13
Message-id: 20210723162146.5167-4-peter.maydell@linaro.org
8
---
14
---
9
target/arm/helper.c | 10 ++++++++++
15
target/arm/m_helper.c | 8 ++++++++
10
1 file changed, 10 insertions(+)
16
1 file changed, 8 insertions(+)
11
17
12
diff --git a/target/arm/helper.c b/target/arm/helper.c
18
diff --git a/target/arm/m_helper.c b/target/arm/m_helper.c
13
index XXXXXXX..XXXXXXX 100644
19
index XXXXXXX..XXXXXXX 100644
14
--- a/target/arm/helper.c
20
--- a/target/arm/m_helper.c
15
+++ b/target/arm/helper.c
21
+++ b/target/arm/m_helper.c
16
@@ -XXX,XX +XXX,XX @@ void HELPER(v7m_msr)(CPUARMState *env, uint32_t maskreg, uint32_t val)
22
@@ -XXX,XX +XXX,XX @@ void arm_v7m_cpu_do_interrupt(CPUState *cs)
23
env->v7m.sfsr |= R_V7M_SFSR_LSERR_MASK;
24
break;
25
case EXCP_UNALIGNED:
26
+ /* Unaligned faults reported by M-profile aware code */
27
armv7m_nvic_set_pending(env->nvic, ARMV7M_EXCP_USAGE, env->v7m.secure);
28
env->v7m.cfsr[env->v7m.secure] |= R_V7M_CFSR_UNALIGNED_MASK;
29
break;
30
@@ -XXX,XX +XXX,XX @@ void arm_v7m_cpu_do_interrupt(CPUState *cs)
17
}
31
}
18
env->v7m.faultmask[M_REG_NS] = val & 1;
32
armv7m_nvic_set_pending(env->nvic, ARMV7M_EXCP_BUS, false);
19
return;
33
break;
20
+ case 0x94: /* CONTROL_NS */
34
+ case 0x1: /* Alignment fault reported by generic code */
21
+ if (!env->v7m.secure) {
35
+ qemu_log_mask(CPU_LOG_INT,
22
+ return;
36
+ "...really UsageFault with UFSR.UNALIGNED\n");
23
+ }
37
+ env->v7m.cfsr[env->v7m.secure] |= R_V7M_CFSR_UNALIGNED_MASK;
24
+ write_v7m_control_spsel_for_secstate(env,
38
+ armv7m_nvic_set_pending(env->nvic, ARMV7M_EXCP_USAGE,
25
+ val & R_V7M_CONTROL_SPSEL_MASK,
39
+ env->v7m.secure);
26
+ M_REG_NS);
40
+ break;
27
+ env->v7m.control[M_REG_NS] &= ~R_V7M_CONTROL_NPRIV_MASK;
41
default:
28
+ env->v7m.control[M_REG_NS] |= val & R_V7M_CONTROL_NPRIV_MASK;
42
/*
29
+ return;
43
* All other FSR values are either MPU faults or "can't happen
30
case 0x98: /* SP_NS */
31
{
32
/* This gives the non-secure SP selected based on whether we're
33
--
44
--
34
2.16.1
45
2.20.1
35
46
36
47
diff view generated by jsdifflib
1
The Coprocessor Power Control Register (CPPWR) is new in v8M.
1
The ISCR.ISRPENDING bit is set when an external interrupt is pending.
2
It allows software to control whether coprocessors are allowed
2
This is true whether that external interrupt is enabled or not.
3
to power down and lose their state. QEMU doesn't have any
3
This means that we can't use 's->vectpending == 0' as a shortcut to
4
notion of power control, so we choose the IMPDEF option of
4
"ISRPENDING is zero", because s->vectpending indicates only the
5
making the whole register RAZ/WI (indicating that no coprocessors
5
highest priority pending enabled interrupt.
6
can ever power down and lose state).
6
7
Remove the incorrect optimization so that if there is no pending
8
enabled interrupt we fall through to scanning through the whole
9
interrupt array.
7
10
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
12
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
10
Message-id: 20180209165810.6668-5-peter.maydell@linaro.org
13
Message-id: 20210723162146.5167-5-peter.maydell@linaro.org
11
---
14
---
12
hw/intc/armv7m_nvic.c | 14 ++++++++++++++
15
hw/intc/armv7m_nvic.c | 9 ++++-----
13
1 file changed, 14 insertions(+)
16
1 file changed, 4 insertions(+), 5 deletions(-)
14
17
15
diff --git a/hw/intc/armv7m_nvic.c b/hw/intc/armv7m_nvic.c
18
diff --git a/hw/intc/armv7m_nvic.c b/hw/intc/armv7m_nvic.c
16
index XXXXXXX..XXXXXXX 100644
19
index XXXXXXX..XXXXXXX 100644
17
--- a/hw/intc/armv7m_nvic.c
20
--- a/hw/intc/armv7m_nvic.c
18
+++ b/hw/intc/armv7m_nvic.c
21
+++ b/hw/intc/armv7m_nvic.c
19
@@ -XXX,XX +XXX,XX @@ static uint32_t nvic_readl(NVICState *s, uint32_t offset, MemTxAttrs attrs)
22
@@ -XXX,XX +XXX,XX @@ static bool nvic_isrpending(NVICState *s)
20
switch (offset) {
23
{
21
case 4: /* Interrupt Control Type. */
24
int irq;
22
return ((s->num_irq - NVIC_FIRST_IRQ) / 32) - 1;
25
23
+ case 0xc: /* CPPWR */
26
- /* We can shortcut if the highest priority pending interrupt
24
+ if (!arm_feature(&cpu->env, ARM_FEATURE_V8)) {
27
- * happens to be external or if there is nothing pending.
25
+ goto bad_offset;
28
+ /*
26
+ }
29
+ * We can shortcut if the highest priority pending interrupt
27
+ /* We make the IMPDEF choice that nothing can ever go into a
30
+ * happens to be external; if not we need to check the whole
28
+ * non-retentive power state, which allows us to RAZ/WI this.
31
+ * vectors[] array.
29
+ */
32
*/
30
+ return 0;
33
if (s->vectpending > NVIC_FIRST_IRQ) {
31
case 0x380 ... 0x3bf: /* NVIC_ITNS<n> */
34
return true;
32
{
35
}
33
int startvec = 8 * (offset - 0x380) + NVIC_FIRST_IRQ;
36
- if (s->vectpending == 0) {
34
@@ -XXX,XX +XXX,XX @@ static void nvic_writel(NVICState *s, uint32_t offset, uint32_t value,
37
- return false;
35
ARMCPU *cpu = s->cpu;
38
- }
36
39
37
switch (offset) {
40
for (irq = NVIC_FIRST_IRQ; irq < s->num_irq; irq++) {
38
+ case 0xc: /* CPPWR */
41
if (s->vectors[irq].pending) {
39
+ if (!arm_feature(&cpu->env, ARM_FEATURE_V8)) {
40
+ goto bad_offset;
41
+ }
42
+ /* Make the IMPDEF choice to RAZ/WI this. */
43
+ break;
44
case 0x380 ... 0x3bf: /* NVIC_ITNS<n> */
45
{
46
int startvec = 8 * (offset - 0x380) + NVIC_FIRST_IRQ;
47
--
42
--
48
2.16.1
43
2.20.1
49
44
50
45
diff view generated by jsdifflib
1
The PENDNMISET/CLR bits in the ICSR should be RAZ/WI from
1
The VECTPENDING field in the ICSR is 9 bits wide, in bits [20:12] of
2
NonSecure state if the AIRCR.BFHFNMINS bit is zero. We had
2
the register. We were incorrectly masking it to 8 bits, so it would
3
misimplemented this as making the bits RAZ/WI from both
3
report the wrong value if the pending exception was greater than 256.
4
Secure and NonSecure states. Fix this bug by checking
4
Fix the bug.
5
attrs.secure so that Secure code can pend and unpend NMIs.
6
5
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
7
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
9
Message-id: 20180209165810.6668-3-peter.maydell@linaro.org
8
Message-id: 20210723162146.5167-6-peter.maydell@linaro.org
10
---
9
---
11
hw/intc/armv7m_nvic.c | 6 +++---
10
hw/intc/armv7m_nvic.c | 2 +-
12
1 file changed, 3 insertions(+), 3 deletions(-)
11
1 file changed, 1 insertion(+), 1 deletion(-)
13
12
14
diff --git a/hw/intc/armv7m_nvic.c b/hw/intc/armv7m_nvic.c
13
diff --git a/hw/intc/armv7m_nvic.c b/hw/intc/armv7m_nvic.c
15
index XXXXXXX..XXXXXXX 100644
14
index XXXXXXX..XXXXXXX 100644
16
--- a/hw/intc/armv7m_nvic.c
15
--- a/hw/intc/armv7m_nvic.c
17
+++ b/hw/intc/armv7m_nvic.c
16
+++ b/hw/intc/armv7m_nvic.c
18
@@ -XXX,XX +XXX,XX @@ static uint32_t nvic_readl(NVICState *s, uint32_t offset, MemTxAttrs attrs)
17
@@ -XXX,XX +XXX,XX @@ static uint32_t nvic_readl(NVICState *s, uint32_t offset, MemTxAttrs attrs)
19
}
18
/* VECTACTIVE */
20
}
19
val = cpu->env.v7m.exception;
21
/* NMIPENDSET */
20
/* VECTPENDING */
22
- if ((cpu->env.v7m.aircr & R_V7M_AIRCR_BFHFNMINS_MASK) &&
21
- val |= (s->vectpending & 0xff) << 12;
23
- s->vectors[ARMV7M_EXCP_NMI].pending) {
22
+ val |= (s->vectpending & 0x1ff) << 12;
24
+ if ((attrs.secure || (cpu->env.v7m.aircr & R_V7M_AIRCR_BFHFNMINS_MASK))
23
/* ISRPENDING - set if any external IRQ is pending */
25
+ && s->vectors[ARMV7M_EXCP_NMI].pending) {
24
if (nvic_isrpending(s)) {
26
val |= (1 << 31);
25
val |= (1 << 22);
27
}
28
/* ISRPREEMPT: RES0 when halting debug not implemented */
29
@@ -XXX,XX +XXX,XX @@ static void nvic_writel(NVICState *s, uint32_t offset, uint32_t value,
30
break;
31
}
32
case 0xd04: /* Interrupt Control State (ICSR) */
33
- if (cpu->env.v7m.aircr & R_V7M_AIRCR_BFHFNMINS_MASK) {
34
+ if (attrs.secure || cpu->env.v7m.aircr & R_V7M_AIRCR_BFHFNMINS_MASK) {
35
if (value & (1 << 31)) {
36
armv7m_nvic_set_pending(s, ARMV7M_EXCP_NMI, false);
37
} else if (value & (1 << 30) &&
38
--
26
--
39
2.16.1
27
2.20.1
40
28
41
29
diff view generated by jsdifflib
1
M profile cores have a similar setup for cache ID registers
1
In Arm v8.1M the VECTPENDING field in the ICSR has new behaviour: if
2
to A profile:
2
the register is accessed NonSecure and the highest priority pending
3
* Cache Level ID Register (CLIDR) is a fixed value
3
enabled exception (that would be returned in the VECTPENDING field)
4
* Cache Type Register (CTR) is a fixed value
4
targets Secure, then the VECTPENDING field must read 1 rather than
5
* Cache Size ID Registers (CCSIDR) are a bank of registers;
5
the exception number of the pending exception. Implement this.
6
which one you see is selected by the Cache Size Selection
7
Register (CSSELR)
8
9
The only difference is that they're in the NVIC memory mapped
10
register space rather than being coprocessor registers.
11
Implement the M profile view of them.
12
13
Since neither Cortex-M3 nor Cortex-M4 implement caches,
14
we don't need to update their init functions and can leave
15
the ctr/clidr/ccsidr[] fields in their ARMCPU structs at zero.
16
Newer cores (like the Cortex-M33) will want to be able to
17
set these ID registers to non-zero values, though.
18
6
19
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
20
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
8
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
21
Message-id: 20180209165810.6668-6-peter.maydell@linaro.org
9
Message-id: 20210723162146.5167-7-peter.maydell@linaro.org
22
---
10
---
23
target/arm/cpu.h | 26 ++++++++++++++++++++++++++
11
hw/intc/armv7m_nvic.c | 31 ++++++++++++++++++++++++-------
24
hw/intc/armv7m_nvic.c | 16 ++++++++++++++++
12
1 file changed, 24 insertions(+), 7 deletions(-)
25
target/arm/machine.c | 36 ++++++++++++++++++++++++++++++++++++
26
3 files changed, 78 insertions(+)
27
13
28
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
29
index XXXXXXX..XXXXXXX 100644
30
--- a/target/arm/cpu.h
31
+++ b/target/arm/cpu.h
32
@@ -XXX,XX +XXX,XX @@ typedef struct CPUARMState {
33
uint32_t faultmask[M_REG_NUM_BANKS];
34
uint32_t aircr; /* only holds r/w state if security extn implemented */
35
uint32_t secure; /* Is CPU in Secure state? (not guest visible) */
36
+ uint32_t csselr[M_REG_NUM_BANKS];
37
} v7m;
38
39
/* Information associated with an exception about to be taken:
40
@@ -XXX,XX +XXX,XX @@ FIELD(V7M_MPU_CTRL, ENABLE, 0, 1)
41
FIELD(V7M_MPU_CTRL, HFNMIENA, 1, 1)
42
FIELD(V7M_MPU_CTRL, PRIVDEFENA, 2, 1)
43
44
+/* v7M CLIDR bits */
45
+FIELD(V7M_CLIDR, CTYPE_ALL, 0, 21)
46
+FIELD(V7M_CLIDR, LOUIS, 21, 3)
47
+FIELD(V7M_CLIDR, LOC, 24, 3)
48
+FIELD(V7M_CLIDR, LOUU, 27, 3)
49
+FIELD(V7M_CLIDR, ICB, 30, 2)
50
+
51
+FIELD(V7M_CSSELR, IND, 0, 1)
52
+FIELD(V7M_CSSELR, LEVEL, 1, 3)
53
+/* We use the combination of InD and Level to index into cpu->ccsidr[];
54
+ * define a mask for this and check that it doesn't permit running off
55
+ * the end of the array.
56
+ */
57
+FIELD(V7M_CSSELR, INDEX, 0, 4)
58
+
59
+QEMU_BUILD_BUG_ON(ARRAY_SIZE(((ARMCPU *)0)->ccsidr) <= R_V7M_CSSELR_INDEX_MASK);
60
+
61
/* If adding a feature bit which corresponds to a Linux ELF
62
* HWCAP bit, remember to update the feature-bit-to-hwcap
63
* mapping in linux-user/elfload.c:get_elf_hwcap().
64
@@ -XXX,XX +XXX,XX @@ static inline int arm_debug_target_el(CPUARMState *env)
65
}
66
}
67
68
+static inline bool arm_v7m_csselr_razwi(ARMCPU *cpu)
69
+{
70
+ /* If all the CLIDR.Ctypem bits are 0 there are no caches, and
71
+ * CSSELR is RAZ/WI.
72
+ */
73
+ return (cpu->clidr & R_V7M_CLIDR_CTYPE_ALL_MASK) != 0;
74
+}
75
+
76
static inline bool aa64_generate_debug_exceptions(CPUARMState *env)
77
{
78
if (arm_is_secure(env)) {
79
diff --git a/hw/intc/armv7m_nvic.c b/hw/intc/armv7m_nvic.c
14
diff --git a/hw/intc/armv7m_nvic.c b/hw/intc/armv7m_nvic.c
80
index XXXXXXX..XXXXXXX 100644
15
index XXXXXXX..XXXXXXX 100644
81
--- a/hw/intc/armv7m_nvic.c
16
--- a/hw/intc/armv7m_nvic.c
82
+++ b/hw/intc/armv7m_nvic.c
17
+++ b/hw/intc/armv7m_nvic.c
83
@@ -XXX,XX +XXX,XX @@ static uint32_t nvic_readl(NVICState *s, uint32_t offset, MemTxAttrs attrs)
18
@@ -XXX,XX +XXX,XX @@ void armv7m_nvic_acknowledge_irq(void *opaque)
84
return cpu->id_isar4;
19
nvic_irq_update(s);
85
case 0xd74: /* ISAR5. */
20
}
86
return cpu->id_isar5;
21
87
+ case 0xd78: /* CLIDR */
22
+static bool vectpending_targets_secure(NVICState *s)
88
+ return cpu->clidr;
23
+{
89
+ case 0xd7c: /* CTR */
24
+ /* Return true if s->vectpending targets Secure state */
90
+ return cpu->ctr;
25
+ if (s->vectpending_is_s_banked) {
91
+ case 0xd80: /* CSSIDR */
26
+ return true;
92
+ {
93
+ int idx = cpu->env.v7m.csselr[attrs.secure] & R_V7M_CSSELR_INDEX_MASK;
94
+ return cpu->ccsidr[idx];
95
+ }
27
+ }
96
+ case 0xd84: /* CSSELR */
28
+ return !exc_is_banked(s->vectpending) &&
97
+ return cpu->env.v7m.csselr[attrs.secure];
29
+ exc_targets_secure(s, s->vectpending);
98
/* TODO: Implement debug registers. */
99
case 0xd90: /* MPU_TYPE */
100
/* Unified MPU; if the MPU is not present this value is zero */
101
@@ -XXX,XX +XXX,XX @@ static void nvic_writel(NVICState *s, uint32_t offset, uint32_t value,
102
qemu_log_mask(LOG_UNIMP,
103
"NVIC: Aux fault status registers unimplemented\n");
104
break;
105
+ case 0xd84: /* CSSELR */
106
+ if (!arm_v7m_csselr_razwi(cpu)) {
107
+ cpu->env.v7m.csselr[attrs.secure] = value & R_V7M_CSSELR_INDEX_MASK;
108
+ }
109
+ break;
110
case 0xd90: /* MPU_TYPE */
111
return; /* RO */
112
case 0xd94: /* MPU_CTRL */
113
diff --git a/target/arm/machine.c b/target/arm/machine.c
114
index XXXXXXX..XXXXXXX 100644
115
--- a/target/arm/machine.c
116
+++ b/target/arm/machine.c
117
@@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_m_faultmask_primask = {
118
}
119
};
120
121
+/* CSSELR is in a subsection because we didn't implement it previously.
122
+ * Migration from an old implementation will leave it at zero, which
123
+ * is OK since the only CPUs in the old implementation make the
124
+ * register RAZ/WI.
125
+ * Since there was no version of QEMU which implemented the CSSELR for
126
+ * just non-secure, we transfer both banks here rather than putting
127
+ * the secure banked version in the m-security subsection.
128
+ */
129
+static bool csselr_vmstate_validate(void *opaque, int version_id)
130
+{
131
+ ARMCPU *cpu = opaque;
132
+
133
+ return cpu->env.v7m.csselr[M_REG_NS] <= R_V7M_CSSELR_INDEX_MASK
134
+ && cpu->env.v7m.csselr[M_REG_S] <= R_V7M_CSSELR_INDEX_MASK;
135
+}
30
+}
136
+
31
+
137
+static bool m_csselr_needed(void *opaque)
32
void armv7m_nvic_get_pending_irq_info(void *opaque,
138
+{
33
int *pirq, bool *ptargets_secure)
139
+ ARMCPU *cpu = opaque;
34
{
140
+
35
@@ -XXX,XX +XXX,XX @@ void armv7m_nvic_get_pending_irq_info(void *opaque,
141
+ return !arm_v7m_csselr_razwi(cpu);
36
142
+}
37
assert(pending > ARMV7M_EXCP_RESET && pending < s->num_irq);
143
+
38
144
+static const VMStateDescription vmstate_m_csselr = {
39
- if (s->vectpending_is_s_banked) {
145
+ .name = "cpu/m/csselr",
40
- targets_secure = true;
146
+ .version_id = 1,
41
- } else {
147
+ .minimum_version_id = 1,
42
- targets_secure = !exc_is_banked(pending) &&
148
+ .needed = m_csselr_needed,
43
- exc_targets_secure(s, pending);
149
+ .fields = (VMStateField[]) {
44
- }
150
+ VMSTATE_UINT32_ARRAY(env.v7m.csselr, ARMCPU, M_REG_NUM_BANKS),
45
+ targets_secure = vectpending_targets_secure(s);
151
+ VMSTATE_VALIDATE("CSSELR is valid", csselr_vmstate_validate),
46
152
+ VMSTATE_END_OF_LIST()
47
trace_nvic_get_pending_irq_info(pending, targets_secure);
153
+ }
48
154
+};
49
@@ -XXX,XX +XXX,XX @@ static uint32_t nvic_readl(NVICState *s, uint32_t offset, MemTxAttrs attrs)
155
+
50
/* VECTACTIVE */
156
static const VMStateDescription vmstate_m = {
51
val = cpu->env.v7m.exception;
157
.name = "cpu/m",
52
/* VECTPENDING */
158
.version_id = 4,
53
- val |= (s->vectpending & 0x1ff) << 12;
159
@@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_m = {
54
+ if (s->vectpending) {
160
},
55
+ /*
161
.subsections = (const VMStateDescription*[]) {
56
+ * From v8.1M VECTPENDING must read as 1 if accessed as
162
&vmstate_m_faultmask_primask,
57
+ * NonSecure and the highest priority pending and enabled
163
+ &vmstate_m_csselr,
58
+ * exception targets Secure.
164
NULL
59
+ */
165
}
60
+ int vp = s->vectpending;
166
};
61
+ if (!attrs.secure && arm_feature(&cpu->env, ARM_FEATURE_V8_1M) &&
62
+ vectpending_targets_secure(s)) {
63
+ vp = 1;
64
+ }
65
+ val |= (vp & 0x1ff) << 12;
66
+ }
67
/* ISRPENDING - set if any external IRQ is pending */
68
if (nvic_isrpending(s)) {
69
val |= (1 << 22);
167
--
70
--
168
2.16.1
71
2.20.1
169
72
170
73
diff view generated by jsdifflib
1
From: Pekka Enberg <penberg@iki.fi>
1
From: Mao Zhongyi <maozhongyi@cmss.chinamobile.com>
2
2
3
This patch adds Raspberry Pi 3 support to hw/arm/raspi.c. The
3
Missed in commit f3478392 "docs: Move deprecation, build
4
differences to Pi 2 are:
4
and license info out of system/"
5
5
6
- Firmware address
6
Signed-off-by: Mao Zhongyi <maozhongyi@cmss.chinamobile.com>
7
- Board ID
8
- Board revision
9
10
The CPU is different too, but that's going to be configured as part of
11
the machine default CPU when we introduce a new machine type.
12
13
The patch was written from scratch by me but the logic is similar to
14
Zoltán Baldaszti's previous work, which I used as a reference (with
15
permission from the author):
16
17
https://github.com/bztsrc/qemu-raspi3
18
19
Signed-off-by: Pekka Enberg <penberg@iki.fi>
20
[PMM: fixed trailing whitespace on one line]
21
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
7
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
8
Message-id: 20210723065828.1336760-1-maozhongyi@cmss.chinamobile.com
22
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
23
---
10
---
24
hw/arm/raspi.c | 31 +++++++++++++++++++++----------
11
configure | 2 +-
25
1 file changed, 21 insertions(+), 10 deletions(-)
12
target/i386/cpu.c | 2 +-
13
MAINTAINERS | 2 +-
14
3 files changed, 3 insertions(+), 3 deletions(-)
26
15
27
diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c
16
diff --git a/configure b/configure
17
index XXXXXXX..XXXXXXX 100755
18
--- a/configure
19
+++ b/configure
20
@@ -XXX,XX +XXX,XX @@ fi
21
22
if test -n "${deprecated_features}"; then
23
echo "Warning, deprecated features enabled."
24
- echo "Please see docs/system/deprecated.rst"
25
+ echo "Please see docs/about/deprecated.rst"
26
echo " features: ${deprecated_features}"
27
fi
28
29
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
28
index XXXXXXX..XXXXXXX 100644
30
index XXXXXXX..XXXXXXX 100644
29
--- a/hw/arm/raspi.c
31
--- a/target/i386/cpu.c
30
+++ b/hw/arm/raspi.c
32
+++ b/target/i386/cpu.c
31
@@ -XXX,XX +XXX,XX @@
33
@@ -XXX,XX +XXX,XX @@ static const X86CPUDefinition builtin_x86_defs[] = {
32
* Rasperry Pi 2 emulation Copyright (c) 2015, Microsoft
34
* none", but this is just for compatibility while libvirt isn't
33
* Written by Andrew Baumann
35
* adapted to resolve CPU model versions before creating VMs.
34
*
36
* See "Runnability guarantee of CPU models" at
35
+ * Raspberry Pi 3 emulation Copyright (c) 2018 Zoltán Baldaszti
37
- * docs/system/deprecated.rst.
36
+ * Upstream code cleanup (c) 2018 Pekka Enberg
38
+ * docs/about/deprecated.rst.
37
+ *
38
* This code is licensed under the GNU GPLv2 and later.
39
*/
39
*/
40
40
X86CPUVersion default_cpu_version = 1;
41
@@ -XXX,XX +XXX,XX @@
41
42
#define SMPBOOT_ADDR 0x300 /* this should leave enough space for ATAGS */
42
diff --git a/MAINTAINERS b/MAINTAINERS
43
#define MVBAR_ADDR 0x400 /* secure vectors */
43
index XXXXXXX..XXXXXXX 100644
44
#define BOARDSETUP_ADDR (MVBAR_ADDR + 0x20) /* board setup code */
44
--- a/MAINTAINERS
45
-#define FIRMWARE_ADDR 0x8000 /* Pi loads kernel.img here by default */
45
+++ b/MAINTAINERS
46
+#define FIRMWARE_ADDR_2 0x8000 /* Pi 2 loads kernel.img here by default */
46
@@ -XXX,XX +XXX,XX @@ F: contrib/gitdm/*
47
+#define FIRMWARE_ADDR_3 0x80000 /* Pi 3 loads kernel.img here by default */
47
48
48
Incompatible changes
49
/* Table of Linux board IDs for different Pi versions */
49
R: libvir-list@redhat.com
50
-static const int raspi_boardid[] = {[1] = 0xc42, [2] = 0xc43};
50
-F: docs/system/deprecated.rst
51
+static const int raspi_boardid[] = {[1] = 0xc42, [2] = 0xc43, [3] = 0xc44};
51
+F: docs/about/deprecated.rst
52
52
53
typedef struct RasPiState {
53
Build System
54
BCM2836State soc;
54
------------
55
@@ -XXX,XX +XXX,XX @@ static void setup_boot(MachineState *machine, int version, size_t ram_size)
56
binfo.secure_board_setup = true;
57
binfo.secure_boot = true;
58
59
- /* Pi2 requires SMP setup */
60
- if (version == 2) {
61
+ /* Pi2 and Pi3 requires SMP setup */
62
+ if (version >= 2) {
63
binfo.smp_loader_start = SMPBOOT_ADDR;
64
binfo.write_secondary_boot = write_smpboot;
65
binfo.secondary_cpu_reset_hook = reset_secondary;
66
@@ -XXX,XX +XXX,XX @@ static void setup_boot(MachineState *machine, int version, size_t ram_size)
67
* the normal Linux boot process
68
*/
69
if (machine->firmware) {
70
+ hwaddr firmware_addr = version == 3 ? FIRMWARE_ADDR_3 : FIRMWARE_ADDR_2;
71
/* load the firmware image (typically kernel.img) */
72
- r = load_image_targphys(machine->firmware, FIRMWARE_ADDR,
73
- ram_size - FIRMWARE_ADDR);
74
+ r = load_image_targphys(machine->firmware, firmware_addr,
75
+ ram_size - firmware_addr);
76
if (r < 0) {
77
error_report("Failed to load firmware from %s", machine->firmware);
78
exit(1);
79
}
80
81
- binfo.entry = FIRMWARE_ADDR;
82
+ binfo.entry = firmware_addr;
83
binfo.firmware_loaded = true;
84
} else {
85
binfo.kernel_filename = machine->kernel_filename;
86
@@ -XXX,XX +XXX,XX @@ static void setup_boot(MachineState *machine, int version, size_t ram_size)
87
arm_load_kernel(ARM_CPU(first_cpu), &binfo);
88
}
89
90
-static void raspi2_init(MachineState *machine)
91
+static void raspi_init(MachineState *machine, int version)
92
{
93
RasPiState *s = g_new0(RasPiState, 1);
94
uint32_t vcram_size;
95
@@ -XXX,XX +XXX,XX @@ static void raspi2_init(MachineState *machine)
96
&error_abort);
97
object_property_set_int(OBJECT(&s->soc), smp_cpus, "enabled-cpus",
98
&error_abort);
99
- object_property_set_int(OBJECT(&s->soc), 0xa21041, "board-rev",
100
+ int board_rev = version == 3 ? 0xa02082 : 0xa21041;
101
+ object_property_set_int(OBJECT(&s->soc), board_rev, "board-rev",
102
&error_abort);
103
object_property_set_bool(OBJECT(&s->soc), true, "realized", &error_abort);
104
105
@@ -XXX,XX +XXX,XX @@ static void raspi2_init(MachineState *machine)
106
107
vcram_size = object_property_get_uint(OBJECT(&s->soc), "vcram-size",
108
&error_abort);
109
- setup_boot(machine, 2, machine->ram_size - vcram_size);
110
+ setup_boot(machine, version, machine->ram_size - vcram_size);
111
+}
112
+
113
+static void raspi2_init(MachineState *machine)
114
+{
115
+ raspi_init(machine, 2);
116
}
117
118
static void raspi2_machine_init(MachineClass *mc)
119
--
55
--
120
2.16.1
56
2.20.1
121
57
122
58
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
From: Richard Henderson <richard.henderson@linaro.org>
2
2
3
Nothing in either register affects the TB.
3
Currently, our only caller is sve_zcr_len_for_el, which has
4
already masked the length extracted from ZCR_ELx, so the
5
masking done here is a nop. But we will shortly have uses
6
from other locations, where the length will be unmasked.
7
8
Saturate the length to ARM_MAX_VQ instead of truncating to
9
the low 4 bits.
4
10
5
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
11
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
6
Message-id: 20180211205848.4568-4-richard.henderson@linaro.org
7
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
12
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
13
Message-id: 20210723203344.968563-2-richard.henderson@linaro.org
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
14
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
---
15
---
10
target/arm/helper.c | 4 ++--
16
target/arm/helper.c | 4 +++-
11
1 file changed, 2 insertions(+), 2 deletions(-)
17
1 file changed, 3 insertions(+), 1 deletion(-)
12
18
13
diff --git a/target/arm/helper.c b/target/arm/helper.c
19
diff --git a/target/arm/helper.c b/target/arm/helper.c
14
index XXXXXXX..XXXXXXX 100644
20
index XXXXXXX..XXXXXXX 100644
15
--- a/target/arm/helper.c
21
--- a/target/arm/helper.c
16
+++ b/target/arm/helper.c
22
+++ b/target/arm/helper.c
17
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v8_cp_reginfo[] = {
23
@@ -XXX,XX +XXX,XX @@ static uint32_t sve_zcr_get_valid_len(ARMCPU *cpu, uint32_t start_len)
18
.writefn = aa64_daif_write, .resetfn = arm_cp_reset_ignore },
24
{
19
{ .name = "FPCR", .state = ARM_CP_STATE_AA64,
25
uint32_t end_len;
20
.opc0 = 3, .opc1 = 3, .opc2 = 0, .crn = 4, .crm = 4,
26
21
- .access = PL0_RW, .type = ARM_CP_FPU,
27
- end_len = start_len &= 0xf;
22
+ .access = PL0_RW, .type = ARM_CP_FPU | ARM_CP_SUPPRESS_TB_END,
28
+ start_len = MIN(start_len, ARM_MAX_VQ - 1);
23
.readfn = aa64_fpcr_read, .writefn = aa64_fpcr_write },
29
+ end_len = start_len;
24
{ .name = "FPSR", .state = ARM_CP_STATE_AA64,
30
+
25
.opc0 = 3, .opc1 = 3, .opc2 = 1, .crn = 4, .crm = 4,
31
if (!test_bit(start_len, cpu->sve_vq_map)) {
26
- .access = PL0_RW, .type = ARM_CP_FPU,
32
end_len = find_last_bit(cpu->sve_vq_map, start_len);
27
+ .access = PL0_RW, .type = ARM_CP_FPU | ARM_CP_SUPPRESS_TB_END,
33
assert(end_len < start_len);
28
.readfn = aa64_fpsr_read, .writefn = aa64_fpsr_write },
29
{ .name = "DCZID_EL0", .state = ARM_CP_STATE_AA64,
30
.opc0 = 3, .opc1 = 3, .opc2 = 7, .crn = 0, .crm = 0,
31
--
34
--
32
2.16.1
35
2.20.1
33
36
34
37
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
From: Richard Henderson <richard.henderson@linaro.org>
2
2
3
This also makes sure that we get the correct ordering of
3
Rename from sve_zcr_get_valid_len and make accessible
4
SVE vs FP exceptions.
4
from outside of helper.c.
5
5
6
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
6
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
7
Message-id: 20180211205848.4568-5-richard.henderson@linaro.org
8
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
7
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
8
Message-id: 20210723203344.968563-3-richard.henderson@linaro.org
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
---
10
---
11
target/arm/cpu.h | 3 ++-
11
target/arm/internals.h | 10 ++++++++++
12
target/arm/internals.h | 6 ++++++
12
target/arm/helper.c | 4 ++--
13
target/arm/helper.c | 22 ++++------------------
13
2 files changed, 12 insertions(+), 2 deletions(-)
14
target/arm/translate-a64.c | 16 ++++++++++++++++
15
4 files changed, 28 insertions(+), 19 deletions(-)
16
14
17
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
18
index XXXXXXX..XXXXXXX 100644
19
--- a/target/arm/cpu.h
20
+++ b/target/arm/cpu.h
21
@@ -XXX,XX +XXX,XX @@ static inline uint64_t cpreg_to_kvm_id(uint32_t cpregid)
22
#define ARM_CP_DC_ZVA (ARM_CP_SPECIAL | 0x0500)
23
#define ARM_LAST_SPECIAL ARM_CP_DC_ZVA
24
#define ARM_CP_FPU 0x1000
25
+#define ARM_CP_SVE 0x2000
26
/* Used only as a terminator for ARMCPRegInfo lists */
27
#define ARM_CP_SENTINEL 0xffff
28
/* Mask of only the flag bits in a type field */
29
-#define ARM_CP_FLAG_MASK 0x10ff
30
+#define ARM_CP_FLAG_MASK 0x30ff
31
32
/* Valid values for ARMCPRegInfo state field, indicating which of
33
* the AArch32 and AArch64 execution states this register is visible in.
34
diff --git a/target/arm/internals.h b/target/arm/internals.h
15
diff --git a/target/arm/internals.h b/target/arm/internals.h
35
index XXXXXXX..XXXXXXX 100644
16
index XXXXXXX..XXXXXXX 100644
36
--- a/target/arm/internals.h
17
--- a/target/arm/internals.h
37
+++ b/target/arm/internals.h
18
+++ b/target/arm/internals.h
38
@@ -XXX,XX +XXX,XX @@ enum arm_exception_class {
19
@@ -XXX,XX +XXX,XX @@ void arm_translate_init(void);
39
EC_AA64_HVC = 0x16,
20
void arm_cpu_synchronize_from_tb(CPUState *cs, const TranslationBlock *tb);
40
EC_AA64_SMC = 0x17,
21
#endif /* CONFIG_TCG */
41
EC_SYSTEMREGISTERTRAP = 0x18,
22
42
+ EC_SVEACCESSTRAP = 0x19,
23
+/**
43
EC_INSNABORT = 0x20,
24
+ * aarch64_sve_zcr_get_valid_len:
44
EC_INSNABORT_SAME_EL = 0x21,
25
+ * @cpu: cpu context
45
EC_PCALIGNMENT = 0x22,
26
+ * @start_len: maximum len to consider
46
@@ -XXX,XX +XXX,XX @@ static inline uint32_t syn_fp_access_trap(int cv, int cond, bool is_16bit)
27
+ *
47
| (cv << 24) | (cond << 20);
28
+ * Return the maximum supported sve vector length <= @start_len.
48
}
29
+ * Note that both @start_len and the return value are in units
49
30
+ * of ZCR_ELx.LEN, so the vector bit length is (x + 1) * 128.
50
+static inline uint32_t syn_sve_access_trap(void)
31
+ */
51
+{
32
+uint32_t aarch64_sve_zcr_get_valid_len(ARMCPU *cpu, uint32_t start_len);
52
+ return EC_SVEACCESSTRAP << ARM_EL_EC_SHIFT;
33
53
+}
34
enum arm_fprounding {
54
+
35
FPROUNDING_TIEEVEN,
55
static inline uint32_t syn_insn_abort(int same_el, int ea, int s1ptw, int fsc)
56
{
57
return (EC_INSNABORT << ARM_EL_EC_SHIFT) | (same_el << ARM_EL_EC_SHIFT)
58
diff --git a/target/arm/helper.c b/target/arm/helper.c
36
diff --git a/target/arm/helper.c b/target/arm/helper.c
59
index XXXXXXX..XXXXXXX 100644
37
index XXXXXXX..XXXXXXX 100644
60
--- a/target/arm/helper.c
38
--- a/target/arm/helper.c
61
+++ b/target/arm/helper.c
39
+++ b/target/arm/helper.c
62
@@ -XXX,XX +XXX,XX @@ static int sve_exception_el(CPUARMState *env)
40
@@ -XXX,XX +XXX,XX @@ int sve_exception_el(CPUARMState *env, int el)
63
return 0;
41
return 0;
64
}
42
}
65
43
66
-static CPAccessResult zcr_access(CPUARMState *env, const ARMCPRegInfo *ri,
44
-static uint32_t sve_zcr_get_valid_len(ARMCPU *cpu, uint32_t start_len)
67
- bool isread)
45
+uint32_t aarch64_sve_zcr_get_valid_len(ARMCPU *cpu, uint32_t start_len)
68
-{
46
{
69
- switch (sve_exception_el(env)) {
47
uint32_t end_len;
70
- case 3:
48
71
- return CP_ACCESS_TRAP_EL3;
49
@@ -XXX,XX +XXX,XX @@ uint32_t sve_zcr_len_for_el(CPUARMState *env, int el)
72
- case 2:
50
zcr_len = MIN(zcr_len, 0xf & (uint32_t)env->vfp.zcr_el[3]);
73
- return CP_ACCESS_TRAP_EL2;
51
}
74
- case 1:
52
75
- return CP_ACCESS_TRAP;
53
- return sve_zcr_get_valid_len(cpu, zcr_len);
76
- }
54
+ return aarch64_sve_zcr_get_valid_len(cpu, zcr_len);
77
- return CP_ACCESS_OK;
55
}
78
-}
56
79
-
80
static void zcr_write(CPUARMState *env, const ARMCPRegInfo *ri,
57
static void zcr_write(CPUARMState *env, const ARMCPRegInfo *ri,
81
uint64_t value)
82
{
83
@@ -XXX,XX +XXX,XX @@ static void zcr_write(CPUARMState *env, const ARMCPRegInfo *ri,
84
static const ARMCPRegInfo zcr_el1_reginfo = {
85
.name = "ZCR_EL1", .state = ARM_CP_STATE_AA64,
86
.opc0 = 3, .opc1 = 0, .crn = 1, .crm = 2, .opc2 = 0,
87
- .access = PL1_RW, .accessfn = zcr_access,
88
+ .access = PL1_RW, .type = ARM_CP_SVE | ARM_CP_FPU,
89
.fieldoffset = offsetof(CPUARMState, vfp.zcr_el[1]),
90
.writefn = zcr_write, .raw_writefn = raw_write
91
};
92
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo zcr_el1_reginfo = {
93
static const ARMCPRegInfo zcr_el2_reginfo = {
94
.name = "ZCR_EL2", .state = ARM_CP_STATE_AA64,
95
.opc0 = 3, .opc1 = 4, .crn = 1, .crm = 2, .opc2 = 0,
96
- .access = PL2_RW, .accessfn = zcr_access,
97
+ .access = PL2_RW, .type = ARM_CP_SVE | ARM_CP_FPU,
98
.fieldoffset = offsetof(CPUARMState, vfp.zcr_el[2]),
99
.writefn = zcr_write, .raw_writefn = raw_write
100
};
101
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo zcr_el2_reginfo = {
102
static const ARMCPRegInfo zcr_no_el2_reginfo = {
103
.name = "ZCR_EL2", .state = ARM_CP_STATE_AA64,
104
.opc0 = 3, .opc1 = 4, .crn = 1, .crm = 2, .opc2 = 0,
105
- .access = PL2_RW,
106
+ .access = PL2_RW, .type = ARM_CP_SVE | ARM_CP_FPU,
107
.readfn = arm_cp_read_zero, .writefn = arm_cp_write_ignore
108
};
109
110
static const ARMCPRegInfo zcr_el3_reginfo = {
111
.name = "ZCR_EL3", .state = ARM_CP_STATE_AA64,
112
.opc0 = 3, .opc1 = 6, .crn = 1, .crm = 2, .opc2 = 0,
113
- .access = PL3_RW, .accessfn = zcr_access,
114
+ .access = PL3_RW, .type = ARM_CP_SVE | ARM_CP_FPU,
115
.fieldoffset = offsetof(CPUARMState, vfp.zcr_el[3]),
116
.writefn = zcr_write, .raw_writefn = raw_write
117
};
118
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
119
index XXXXXXX..XXXXXXX 100644
120
--- a/target/arm/translate-a64.c
121
+++ b/target/arm/translate-a64.c
122
@@ -XXX,XX +XXX,XX @@ static inline bool fp_access_check(DisasContext *s)
123
return false;
124
}
125
126
+/* Check that SVE access is enabled. If it is, return true.
127
+ * If not, emit code to generate an appropriate exception and return false.
128
+ */
129
+static inline bool sve_access_check(DisasContext *s)
130
+{
131
+ if (s->sve_excp_el) {
132
+ gen_exception_insn(s, 4, EXCP_UDEF, syn_sve_access_trap(),
133
+ s->sve_excp_el);
134
+ return false;
135
+ }
136
+ return true;
137
+}
138
+
139
/*
140
* This utility function is for doing register extension with an
141
* optional shift. You will likely want to pass a temporary for the
142
@@ -XXX,XX +XXX,XX @@ static void handle_sys(DisasContext *s, uint32_t insn, bool isread,
143
default:
144
break;
145
}
146
+ if ((ri->type & ARM_CP_SVE) && !sve_access_check(s)) {
147
+ return;
148
+ }
149
if ((ri->type & ARM_CP_FPU) && !fp_access_check(s)) {
150
return;
151
}
152
--
58
--
153
2.16.1
59
2.20.1
154
60
155
61
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
From: Richard Henderson <richard.henderson@linaro.org>
2
2
3
Mirror the behavour of /proc/sys/abi/sve_default_vector_length
4
under the real linux kernel. We have no way of passing along
5
a real default across exec like the kernel can, but this is a
6
decent way of adjusting the startup vector length of a process.
7
8
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/482
3
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
9
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
4
Message-id: 20180211205848.4568-3-richard.henderson@linaro.org
5
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
10
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
11
Message-id: 20210723203344.968563-4-richard.henderson@linaro.org
12
[PMM: tweaked docs formatting, document -1 special-case,
13
added fixup patch from RTH mentioning QEMU's maximum veclen.]
6
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
14
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7
---
15
---
8
target/arm/cpu.h | 35 ++++++++++++++++++-----------------
16
docs/system/arm/cpu-features.rst | 15 ++++++++
9
target/arm/helper.c | 6 ++++--
17
target/arm/cpu.h | 5 +++
10
target/arm/translate-a64.c | 3 +++
18
target/arm/cpu.c | 14 ++++++--
11
3 files changed, 25 insertions(+), 19 deletions(-)
19
target/arm/cpu64.c | 60 ++++++++++++++++++++++++++++++++
20
4 files changed, 92 insertions(+), 2 deletions(-)
12
21
22
diff --git a/docs/system/arm/cpu-features.rst b/docs/system/arm/cpu-features.rst
23
index XXXXXXX..XXXXXXX 100644
24
--- a/docs/system/arm/cpu-features.rst
25
+++ b/docs/system/arm/cpu-features.rst
26
@@ -XXX,XX +XXX,XX @@ verbose command lines. However, the recommended way to select vector
27
lengths is to explicitly enable each desired length. Therefore only
28
example's (1), (4), and (6) exhibit recommended uses of the properties.
29
30
+SVE User-mode Default Vector Length Property
31
+--------------------------------------------
32
+
33
+For qemu-aarch64, the cpu property ``sve-default-vector-length=N`` is
34
+defined to mirror the Linux kernel parameter file
35
+``/proc/sys/abi/sve_default_vector_length``. The default length, ``N``,
36
+is in units of bytes and must be between 16 and 8192.
37
+If not specified, the default vector length is 64.
38
+
39
+If the default length is larger than the maximum vector length enabled,
40
+the actual vector length will be reduced. Note that the maximum vector
41
+length supported by QEMU is 256.
42
+
43
+If this property is set to ``-1`` then the default vector length
44
+is set to the maximum possible length.
13
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
45
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
14
index XXXXXXX..XXXXXXX 100644
46
index XXXXXXX..XXXXXXX 100644
15
--- a/target/arm/cpu.h
47
--- a/target/arm/cpu.h
16
+++ b/target/arm/cpu.h
48
+++ b/target/arm/cpu.h
17
@@ -XXX,XX +XXX,XX @@ static inline uint64_t cpreg_to_kvm_id(uint32_t cpregid)
49
@@ -XXX,XX +XXX,XX @@ struct ARMCPU {
50
/* Used to set the maximum vector length the cpu will support. */
51
uint32_t sve_max_vq;
52
53
+#ifdef CONFIG_USER_ONLY
54
+ /* Used to set the default vector length at process start. */
55
+ uint32_t sve_default_vq;
56
+#endif
57
+
58
/*
59
* In sve_vq_map each set bit is a supported vector length of
60
* (bit-number + 1) * 16 bytes, i.e. each bit number + 1 is the vector
61
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
62
index XXXXXXX..XXXXXXX 100644
63
--- a/target/arm/cpu.c
64
+++ b/target/arm/cpu.c
65
@@ -XXX,XX +XXX,XX @@ static void arm_cpu_reset(DeviceState *dev)
66
env->cp15.cpacr_el1 = deposit64(env->cp15.cpacr_el1, 16, 2, 3);
67
/* with reasonable vector length */
68
if (cpu_isar_feature(aa64_sve, cpu)) {
69
- env->vfp.zcr_el[1] = MIN(cpu->sve_max_vq - 1, 3);
70
+ env->vfp.zcr_el[1] =
71
+ aarch64_sve_zcr_get_valid_len(cpu, cpu->sve_default_vq - 1);
72
}
73
/*
74
* Enable TBI0 but not TBI1.
75
@@ -XXX,XX +XXX,XX @@ static void arm_cpu_initfn(Object *obj)
76
QLIST_INIT(&cpu->pre_el_change_hooks);
77
QLIST_INIT(&cpu->el_change_hooks);
78
79
-#ifndef CONFIG_USER_ONLY
80
+#ifdef CONFIG_USER_ONLY
81
+# ifdef TARGET_AARCH64
82
+ /*
83
+ * The linux kernel defaults to 512-bit vectors, when sve is supported.
84
+ * See documentation for /proc/sys/abi/sve_default_vector_length, and
85
+ * our corresponding sve-default-vector-length cpu property.
86
+ */
87
+ cpu->sve_default_vq = 4;
88
+# endif
89
+#else
90
/* Our inbound IRQ and FIQ lines */
91
if (kvm_enabled()) {
92
/* VIRQ and VFIQ are unused with KVM but we add them to maintain
93
diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c
94
index XXXXXXX..XXXXXXX 100644
95
--- a/target/arm/cpu64.c
96
+++ b/target/arm/cpu64.c
97
@@ -XXX,XX +XXX,XX @@ static void cpu_arm_set_sve(Object *obj, bool value, Error **errp)
98
cpu->isar.id_aa64pfr0 = t;
18
}
99
}
19
100
20
/* ARMCPRegInfo type field bits. If the SPECIAL bit is set this is a
101
+#ifdef CONFIG_USER_ONLY
21
- * special-behaviour cp reg and bits [15..8] indicate what behaviour
102
+/* Mirror linux /proc/sys/abi/sve_default_vector_length. */
22
+ * special-behaviour cp reg and bits [11..8] indicate what behaviour
103
+static void cpu_arm_set_sve_default_vec_len(Object *obj, Visitor *v,
23
* it has. Otherwise it is a simple cp reg, where CONST indicates that
104
+ const char *name, void *opaque,
24
* TCG can assume the value to be constant (ie load at translate time)
105
+ Error **errp)
25
* and 64BIT indicates a 64 bit wide coprocessor register. SUPPRESS_TB_END
106
+{
26
@@ -XXX,XX +XXX,XX @@ static inline uint64_t cpreg_to_kvm_id(uint32_t cpregid)
107
+ ARMCPU *cpu = ARM_CPU(obj);
27
* need to be surrounded by gen_io_start()/gen_io_end(). In particular,
108
+ int32_t default_len, default_vq, remainder;
28
* registers which implement clocks or timers require this.
109
+
29
*/
110
+ if (!visit_type_int32(v, name, &default_len, errp)) {
30
-#define ARM_CP_SPECIAL 1
31
-#define ARM_CP_CONST 2
32
-#define ARM_CP_64BIT 4
33
-#define ARM_CP_SUPPRESS_TB_END 8
34
-#define ARM_CP_OVERRIDE 16
35
-#define ARM_CP_ALIAS 32
36
-#define ARM_CP_IO 64
37
-#define ARM_CP_NO_RAW 128
38
-#define ARM_CP_NOP (ARM_CP_SPECIAL | (1 << 8))
39
-#define ARM_CP_WFI (ARM_CP_SPECIAL | (2 << 8))
40
-#define ARM_CP_NZCV (ARM_CP_SPECIAL | (3 << 8))
41
-#define ARM_CP_CURRENTEL (ARM_CP_SPECIAL | (4 << 8))
42
-#define ARM_CP_DC_ZVA (ARM_CP_SPECIAL | (5 << 8))
43
-#define ARM_LAST_SPECIAL ARM_CP_DC_ZVA
44
+#define ARM_CP_SPECIAL 0x0001
45
+#define ARM_CP_CONST 0x0002
46
+#define ARM_CP_64BIT 0x0004
47
+#define ARM_CP_SUPPRESS_TB_END 0x0008
48
+#define ARM_CP_OVERRIDE 0x0010
49
+#define ARM_CP_ALIAS 0x0020
50
+#define ARM_CP_IO 0x0040
51
+#define ARM_CP_NO_RAW 0x0080
52
+#define ARM_CP_NOP (ARM_CP_SPECIAL | 0x0100)
53
+#define ARM_CP_WFI (ARM_CP_SPECIAL | 0x0200)
54
+#define ARM_CP_NZCV (ARM_CP_SPECIAL | 0x0300)
55
+#define ARM_CP_CURRENTEL (ARM_CP_SPECIAL | 0x0400)
56
+#define ARM_CP_DC_ZVA (ARM_CP_SPECIAL | 0x0500)
57
+#define ARM_LAST_SPECIAL ARM_CP_DC_ZVA
58
+#define ARM_CP_FPU 0x1000
59
/* Used only as a terminator for ARMCPRegInfo lists */
60
-#define ARM_CP_SENTINEL 0xffff
61
+#define ARM_CP_SENTINEL 0xffff
62
/* Mask of only the flag bits in a type field */
63
-#define ARM_CP_FLAG_MASK 0xff
64
+#define ARM_CP_FLAG_MASK 0x10ff
65
66
/* Valid values for ARMCPRegInfo state field, indicating which of
67
* the AArch32 and AArch64 execution states this register is visible in.
68
diff --git a/target/arm/helper.c b/target/arm/helper.c
69
index XXXXXXX..XXXXXXX 100644
70
--- a/target/arm/helper.c
71
+++ b/target/arm/helper.c
72
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v8_cp_reginfo[] = {
73
.writefn = aa64_daif_write, .resetfn = arm_cp_reset_ignore },
74
{ .name = "FPCR", .state = ARM_CP_STATE_AA64,
75
.opc0 = 3, .opc1 = 3, .opc2 = 0, .crn = 4, .crm = 4,
76
- .access = PL0_RW, .readfn = aa64_fpcr_read, .writefn = aa64_fpcr_write },
77
+ .access = PL0_RW, .type = ARM_CP_FPU,
78
+ .readfn = aa64_fpcr_read, .writefn = aa64_fpcr_write },
79
{ .name = "FPSR", .state = ARM_CP_STATE_AA64,
80
.opc0 = 3, .opc1 = 3, .opc2 = 1, .crn = 4, .crm = 4,
81
- .access = PL0_RW, .readfn = aa64_fpsr_read, .writefn = aa64_fpsr_write },
82
+ .access = PL0_RW, .type = ARM_CP_FPU,
83
+ .readfn = aa64_fpsr_read, .writefn = aa64_fpsr_write },
84
{ .name = "DCZID_EL0", .state = ARM_CP_STATE_AA64,
85
.opc0 = 3, .opc1 = 3, .opc2 = 7, .crn = 0, .crm = 0,
86
.access = PL0_R, .type = ARM_CP_NO_RAW,
87
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
88
index XXXXXXX..XXXXXXX 100644
89
--- a/target/arm/translate-a64.c
90
+++ b/target/arm/translate-a64.c
91
@@ -XXX,XX +XXX,XX @@ static void handle_sys(DisasContext *s, uint32_t insn, bool isread,
92
default:
93
break;
94
}
95
+ if ((ri->type & ARM_CP_FPU) && !fp_access_check(s)) {
96
+ return;
111
+ return;
97
+ }
112
+ }
98
113
+
99
if ((tb_cflags(s->base.tb) & CF_USE_ICOUNT) && (ri->type & ARM_CP_IO)) {
114
+ /* Undocumented, but the kernel allows -1 to indicate "maximum". */
100
gen_io_start();
115
+ if (default_len == -1) {
116
+ cpu->sve_default_vq = ARM_MAX_VQ;
117
+ return;
118
+ }
119
+
120
+ default_vq = default_len / 16;
121
+ remainder = default_len % 16;
122
+
123
+ /*
124
+ * Note that the 512 max comes from include/uapi/asm/sve_context.h
125
+ * and is the maximum architectural width of ZCR_ELx.LEN.
126
+ */
127
+ if (remainder || default_vq < 1 || default_vq > 512) {
128
+ error_setg(errp, "cannot set sve-default-vector-length");
129
+ if (remainder) {
130
+ error_append_hint(errp, "Vector length not a multiple of 16\n");
131
+ } else if (default_vq < 1) {
132
+ error_append_hint(errp, "Vector length smaller than 16\n");
133
+ } else {
134
+ error_append_hint(errp, "Vector length larger than %d\n",
135
+ 512 * 16);
136
+ }
137
+ return;
138
+ }
139
+
140
+ cpu->sve_default_vq = default_vq;
141
+}
142
+
143
+static void cpu_arm_get_sve_default_vec_len(Object *obj, Visitor *v,
144
+ const char *name, void *opaque,
145
+ Error **errp)
146
+{
147
+ ARMCPU *cpu = ARM_CPU(obj);
148
+ int32_t value = cpu->sve_default_vq * 16;
149
+
150
+ visit_type_int32(v, name, &value, errp);
151
+}
152
+#endif
153
+
154
void aarch64_add_sve_properties(Object *obj)
155
{
156
uint32_t vq;
157
@@ -XXX,XX +XXX,XX @@ void aarch64_add_sve_properties(Object *obj)
158
object_property_add(obj, name, "bool", cpu_arm_get_sve_vq,
159
cpu_arm_set_sve_vq, NULL, NULL);
160
}
161
+
162
+#ifdef CONFIG_USER_ONLY
163
+ /* Mirror linux /proc/sys/abi/sve_default_vector_length. */
164
+ object_property_add(obj, "sve-default-vector-length", "int32",
165
+ cpu_arm_get_sve_default_vec_len,
166
+ cpu_arm_set_sve_default_vec_len, NULL, NULL);
167
+#endif
168
}
169
170
void arm_cpu_pauth_finalize(ARMCPU *cpu, Error **errp)
101
--
171
--
102
2.16.1
172
2.20.1
103
173
104
174
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
2
2
3
(qemu) info mtree
4
address-space: cpu-memory-0
5
0000000000000000-ffffffffffffffff (prio 0, i/o): system
6
0000000000000000-0000000007ffffff (prio 0, rom): aspeed.boot_rom
7
000000001e600000-000000001e7fffff (prio -1, i/o): aspeed_soc.io
8
- 000000001e784000-000000001e78401f (prio 0, i/o): serial
9
000000001e620000-000000001e6200ff (prio 0, i/o): aspeed.smc.ast2500-fmc
10
000000001e630000-000000001e6300ff (prio 0, i/o): aspeed.smc.ast2500-spi1
11
[...]
12
000000001e720000-000000001e728fff (prio 0, ram): aspeed.sram
13
000000001e782000-000000001e782fff (prio 0, i/o): aspeed.timer
14
+ 000000001e784000-000000001e78401f (prio 0, i/o): serial
15
000000001e785000-000000001e78501f (prio 0, i/o): aspeed.wdt
16
000000001e785020-000000001e78503f (prio 0, i/o): aspeed.wdt
17
18
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
3
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
19
Reviewed-by: Cédric Le Goater <clg@kaod.org>
4
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
20
Reviewed-by: Andrew Jeffery <andrew@aj.id.au>
5
Message-id: 20210726150953.1218690-1-f4bug@amsat.org
21
Message-id: 20180209085755.30414-2-f4bug@amsat.org
22
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
23
---
7
---
24
hw/arm/aspeed_soc.c | 3 ++-
8
hw/arm/nseries.c | 2 +-
25
1 file changed, 2 insertions(+), 1 deletion(-)
9
1 file changed, 1 insertion(+), 1 deletion(-)
26
10
27
diff --git a/hw/arm/aspeed_soc.c b/hw/arm/aspeed_soc.c
11
diff --git a/hw/arm/nseries.c b/hw/arm/nseries.c
28
index XXXXXXX..XXXXXXX 100644
12
index XXXXXXX..XXXXXXX 100644
29
--- a/hw/arm/aspeed_soc.c
13
--- a/hw/arm/nseries.c
30
+++ b/hw/arm/aspeed_soc.c
14
+++ b/hw/arm/nseries.c
31
@@ -XXX,XX +XXX,XX @@ static void aspeed_soc_realize(DeviceState *dev, Error **errp)
15
@@ -XXX,XX +XXX,XX @@ static uint32_t mipid_txrx(void *opaque, uint32_t cmd, int len)
32
/* UART - attach an 8250 to the IO space as our UART5 */
16
default:
33
if (serial_hds[0]) {
17
bad_cmd:
34
qemu_irq uart5 = qdev_get_gpio_in(DEVICE(&s->vic), uart_irqs[4]);
18
qemu_log_mask(LOG_GUEST_ERROR,
35
- serial_mm_init(&s->iomem, ASPEED_SOC_UART_5_BASE, 2,
19
- "%s: unknown command %02x\n", __func__, s->cmd);
36
+ serial_mm_init(get_system_memory(),
20
+ "%s: unknown command 0x%02x\n", __func__, s->cmd);
37
+ ASPEED_SOC_IOMEM_BASE + ASPEED_SOC_UART_5_BASE, 2,
21
break;
38
uart5, 38400, serial_hds[0], DEVICE_LITTLE_ENDIAN);
39
}
22
}
40
23
41
--
24
--
42
2.16.1
25
2.20.1
43
26
44
27
diff view generated by jsdifflib
Deleted patch
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
2
1
3
(qemu) info mtree
4
address-space: cpu-memory-0
5
0000000000000000-ffffffffffffffff (prio 0, i/o): system
6
0000000000000000-0000000007ffffff (prio 0, rom): aspeed.boot_rom
7
- 000000001e600000-000000001e7fffff (prio -1, i/o): aspeed_soc.io
8
+ 000000001e600000-000000001e7fffff (prio -1000, i/o): aspeed_soc.io
9
000000001e620000-000000001e6200ff (prio 0, i/o): aspeed.smc.ast2500-fmc
10
000000001e630000-000000001e6300ff (prio 0, i/o): aspeed.smc.ast2500-spi1
11
000000001e631000-000000001e6310ff (prio 0, i/o): aspeed.smc.ast2500-spi2
12
13
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
14
Reviewed-by: Cédric Le Goater <clg@kaod.org>
15
Reviewed-by: Andrew Jeffery <andrew@aj.id.au>
16
Message-id: 20180209085755.30414-3-f4bug@amsat.org
17
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
18
---
19
include/hw/arm/aspeed_soc.h | 1 -
20
hw/arm/aspeed_soc.c | 32 +++-----------------------------
21
2 files changed, 3 insertions(+), 30 deletions(-)
22
23
diff --git a/include/hw/arm/aspeed_soc.h b/include/hw/arm/aspeed_soc.h
24
index XXXXXXX..XXXXXXX 100644
25
--- a/include/hw/arm/aspeed_soc.h
26
+++ b/include/hw/arm/aspeed_soc.h
27
@@ -XXX,XX +XXX,XX @@ typedef struct AspeedSoCState {
28
29
/*< public >*/
30
ARMCPU cpu;
31
- MemoryRegion iomem;
32
MemoryRegion sram;
33
AspeedVICState vic;
34
AspeedTimerCtrlState timerctrl;
35
diff --git a/hw/arm/aspeed_soc.c b/hw/arm/aspeed_soc.c
36
index XXXXXXX..XXXXXXX 100644
37
--- a/hw/arm/aspeed_soc.c
38
+++ b/hw/arm/aspeed_soc.c
39
@@ -XXX,XX +XXX,XX @@
40
#include "qemu-common.h"
41
#include "cpu.h"
42
#include "exec/address-spaces.h"
43
+#include "hw/misc/unimp.h"
44
#include "hw/arm/aspeed_soc.h"
45
#include "hw/char/serial.h"
46
#include "qemu/log.h"
47
@@ -XXX,XX +XXX,XX @@ static const AspeedSoCInfo aspeed_socs[] = {
48
},
49
};
50
51
-/*
52
- * IO handlers: simply catch any reads/writes to IO addresses that aren't
53
- * handled by a device mapping.
54
- */
55
-
56
-static uint64_t aspeed_soc_io_read(void *p, hwaddr offset, unsigned size)
57
-{
58
- qemu_log_mask(LOG_UNIMP, "%s: 0x%" HWADDR_PRIx " [%u]\n",
59
- __func__, offset, size);
60
- return 0;
61
-}
62
-
63
-static void aspeed_soc_io_write(void *opaque, hwaddr offset, uint64_t value,
64
- unsigned size)
65
-{
66
- qemu_log_mask(LOG_UNIMP, "%s: 0x%" HWADDR_PRIx " <- 0x%" PRIx64 " [%u]\n",
67
- __func__, offset, value, size);
68
-}
69
-
70
-static const MemoryRegionOps aspeed_soc_io_ops = {
71
- .read = aspeed_soc_io_read,
72
- .write = aspeed_soc_io_write,
73
- .endianness = DEVICE_LITTLE_ENDIAN,
74
-};
75
-
76
static void aspeed_soc_init(Object *obj)
77
{
78
AspeedSoCState *s = ASPEED_SOC(obj);
79
@@ -XXX,XX +XXX,XX @@ static void aspeed_soc_realize(DeviceState *dev, Error **errp)
80
Error *err = NULL, *local_err = NULL;
81
82
/* IO space */
83
- memory_region_init_io(&s->iomem, NULL, &aspeed_soc_io_ops, NULL,
84
- "aspeed_soc.io", ASPEED_SOC_IOMEM_SIZE);
85
- memory_region_add_subregion_overlap(get_system_memory(),
86
- ASPEED_SOC_IOMEM_BASE, &s->iomem, -1);
87
+ create_unimplemented_device("aspeed_soc.io",
88
+ ASPEED_SOC_IOMEM_BASE, ASPEED_SOC_IOMEM_SIZE);
89
90
/* CPU */
91
object_property_set_bool(OBJECT(&s->cpu), true, "realized", &err);
92
--
93
2.16.1
94
95
diff view generated by jsdifflib
1
From: Pekka Enberg <penberg@iki.fi>
1
From: Joel Stanley <joel@jms.id.au>
2
2
3
This patch adds a "cpu-type" property to BCM2836 SoC in preparation for
3
The macro used to calculate the maximum memory size of the MMIO region
4
reusing the code for the Raspberry Pi 3, which has a different processor
4
had a mistake, causing all GPIO models to create a mapping of 0x9D8.
5
model.
5
The intent was to have it be 0x9D8 - 0x800.
6
6
7
Signed-off-by: Pekka Enberg <penberg@iki.fi>
7
This extra size doesn't matter on ast2400 and ast2500, which have a 4KB
8
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
8
region set aside for the GPIO controller.
9
10
On the ast2600 the 3.3V and 1.8V GPIO controllers are 2KB apart, so the
11
regions would overlap. Worse was the 1.8V controller would map over the
12
top of the following peripheral, which happens to be the RTC.
13
14
The mmio region used by each device is a maximum of 2KB, so avoid the
15
calculations and hard code this as the maximum.
16
17
Fixes: 36d737ee82b2 ("hw/gpio: Add in AST2600 specific implementation")
18
Signed-off-by: Joel Stanley <joel@jms.id.au>
19
Reviewed-by: Rashmica Gupta <rashmica.g@gmail.com>
20
Reviewed-by: Cédric Le Goater <clg@kaod.org>
21
Message-id: 20210713065854.134634-2-joel@jms.id.au
22
[PMM: fix autocorrect error in commit message]
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
23
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
---
24
---
11
include/hw/arm/bcm2836.h | 1 +
25
hw/gpio/aspeed_gpio.c | 3 +--
12
hw/arm/bcm2836.c | 17 +++++++++--------
26
1 file changed, 1 insertion(+), 2 deletions(-)
13
hw/arm/raspi.c | 3 +++
14
3 files changed, 13 insertions(+), 8 deletions(-)
15
27
16
diff --git a/include/hw/arm/bcm2836.h b/include/hw/arm/bcm2836.h
28
diff --git a/hw/gpio/aspeed_gpio.c b/hw/gpio/aspeed_gpio.c
17
index XXXXXXX..XXXXXXX 100644
29
index XXXXXXX..XXXXXXX 100644
18
--- a/include/hw/arm/bcm2836.h
30
--- a/hw/gpio/aspeed_gpio.c
19
+++ b/include/hw/arm/bcm2836.h
31
+++ b/hw/gpio/aspeed_gpio.c
20
@@ -XXX,XX +XXX,XX @@ typedef struct BCM2836State {
21
DeviceState parent_obj;
22
/*< public >*/
23
24
+ char *cpu_type;
25
uint32_t enabled_cpus;
26
27
ARMCPU cpus[BCM2836_NCPUS];
28
diff --git a/hw/arm/bcm2836.c b/hw/arm/bcm2836.c
29
index XXXXXXX..XXXXXXX 100644
30
--- a/hw/arm/bcm2836.c
31
+++ b/hw/arm/bcm2836.c
32
@@ -XXX,XX +XXX,XX @@
32
@@ -XXX,XX +XXX,XX @@
33
static void bcm2836_init(Object *obj)
33
#define GPIO_1_8V_MEM_SIZE 0x9D8
34
#define GPIO_1_8V_REG_ARRAY_SIZE ((GPIO_1_8V_MEM_SIZE - \
35
GPIO_1_8V_REG_OFFSET) >> 2)
36
-#define GPIO_MAX_MEM_SIZE MAX(GPIO_3_6V_MEM_SIZE, GPIO_1_8V_MEM_SIZE)
37
38
static int aspeed_evaluate_irq(GPIOSets *regs, int gpio_prev_high, int gpio)
34
{
39
{
35
BCM2836State *s = BCM2836(obj);
40
@@ -XXX,XX +XXX,XX @@ static void aspeed_gpio_realize(DeviceState *dev, Error **errp)
36
- int n;
41
}
37
-
42
38
- for (n = 0; n < BCM2836_NCPUS; n++) {
43
memory_region_init_io(&s->iomem, OBJECT(s), &aspeed_gpio_ops, s,
39
- object_initialize(&s->cpus[n], sizeof(s->cpus[n]),
44
- TYPE_ASPEED_GPIO, GPIO_MAX_MEM_SIZE);
40
- "cortex-a15-" TYPE_ARM_CPU);
45
+ TYPE_ASPEED_GPIO, 0x800);
41
- object_property_add_child(obj, "cpu[*]", OBJECT(&s->cpus[n]),
46
42
- &error_abort);
47
sysbus_init_mmio(sbd, &s->iomem);
43
- }
44
45
object_initialize(&s->control, sizeof(s->control), TYPE_BCM2836_CONTROL);
46
object_property_add_child(obj, "control", OBJECT(&s->control), NULL);
47
@@ -XXX,XX +XXX,XX @@ static void bcm2836_realize(DeviceState *dev, Error **errp)
48
49
/* common peripherals from bcm2835 */
50
51
+ obj = OBJECT(dev);
52
+ for (n = 0; n < BCM2836_NCPUS; n++) {
53
+ object_initialize(&s->cpus[n], sizeof(s->cpus[n]),
54
+ s->cpu_type);
55
+ object_property_add_child(obj, "cpu[*]", OBJECT(&s->cpus[n]),
56
+ &error_abort);
57
+ }
58
+
59
obj = object_property_get_link(OBJECT(dev), "ram", &err);
60
if (obj == NULL) {
61
error_setg(errp, "%s: required ram link not found: %s",
62
@@ -XXX,XX +XXX,XX @@ static void bcm2836_realize(DeviceState *dev, Error **errp)
63
}
48
}
64
65
static Property bcm2836_props[] = {
66
+ DEFINE_PROP_STRING("cpu-type", BCM2836State, cpu_type),
67
DEFINE_PROP_UINT32("enabled-cpus", BCM2836State, enabled_cpus, BCM2836_NCPUS),
68
DEFINE_PROP_END_OF_LIST()
69
};
70
diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c
71
index XXXXXXX..XXXXXXX 100644
72
--- a/hw/arm/raspi.c
73
+++ b/hw/arm/raspi.c
74
@@ -XXX,XX +XXX,XX @@ static void raspi2_init(MachineState *machine)
75
/* Setup the SOC */
76
object_property_add_const_link(OBJECT(&s->soc), "ram", OBJECT(&s->ram),
77
&error_abort);
78
+ object_property_set_str(OBJECT(&s->soc), machine->cpu_type, "cpu-type",
79
+ &error_abort);
80
object_property_set_int(OBJECT(&s->soc), smp_cpus, "enabled-cpus",
81
&error_abort);
82
object_property_set_int(OBJECT(&s->soc), 0xa21041, "board-rev",
83
@@ -XXX,XX +XXX,XX @@ static void raspi2_machine_init(MachineClass *mc)
84
mc->no_parallel = 1;
85
mc->no_floppy = 1;
86
mc->no_cdrom = 1;
87
+ mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-a15");
88
mc->max_cpus = BCM2836_NCPUS;
89
mc->min_cpus = BCM2836_NCPUS;
90
mc->default_cpus = BCM2836_NCPUS;
91
--
49
--
92
2.16.1
50
2.20.1
93
51
94
52
diff view generated by jsdifflib
Deleted patch
1
From: Pekka Enberg <penberg@iki.fi>
2
1
3
This patch adds a "raspi3" machine type, which can now be selected as
4
the machine to run on by users via the "-M" command line option to QEMU.
5
6
The machine type does *not* ignore memory transaction failures so we
7
likely need to add some dummy devices later when people run something
8
more complicated than what I'm using for testing.
9
10
Signed-off-by: Pekka Enberg <penberg@iki.fi>
11
[PMM: added #ifdef TARGET_AARCH64 so we don't provide the 64-bit
12
board in the 32-bit only arm-softmmu build.]
13
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
14
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
15
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
16
---
17
hw/arm/raspi.c | 23 +++++++++++++++++++++++
18
1 file changed, 23 insertions(+)
19
20
diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c
21
index XXXXXXX..XXXXXXX 100644
22
--- a/hw/arm/raspi.c
23
+++ b/hw/arm/raspi.c
24
@@ -XXX,XX +XXX,XX @@ static void raspi2_machine_init(MachineClass *mc)
25
mc->ignore_memory_transaction_failures = true;
26
};
27
DEFINE_MACHINE("raspi2", raspi2_machine_init)
28
+
29
+#ifdef TARGET_AARCH64
30
+static void raspi3_init(MachineState *machine)
31
+{
32
+ raspi_init(machine, 3);
33
+}
34
+
35
+static void raspi3_machine_init(MachineClass *mc)
36
+{
37
+ mc->desc = "Raspberry Pi 3";
38
+ mc->init = raspi3_init;
39
+ mc->block_default_type = IF_SD;
40
+ mc->no_parallel = 1;
41
+ mc->no_floppy = 1;
42
+ mc->no_cdrom = 1;
43
+ mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-a53");
44
+ mc->max_cpus = BCM2836_NCPUS;
45
+ mc->min_cpus = BCM2836_NCPUS;
46
+ mc->default_cpus = BCM2836_NCPUS;
47
+ mc->default_ram_size = 1024 * 1024 * 1024;
48
+}
49
+DEFINE_MACHINE("raspi3", raspi3_machine_init)
50
+#endif
51
--
52
2.16.1
53
54
diff view generated by jsdifflib
Deleted patch
1
From: Richard Henderson <richard.henderson@linaro.org>
2
1
3
Because they are ARM_CP_STATE_AA64, ARM_CP_64BIT is implied.
4
5
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
6
Message-id: 20180211205848.4568-2-richard.henderson@linaro.org
7
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
---
10
target/arm/helper.c | 8 ++++----
11
1 file changed, 4 insertions(+), 4 deletions(-)
12
13
diff --git a/target/arm/helper.c b/target/arm/helper.c
14
index XXXXXXX..XXXXXXX 100644
15
--- a/target/arm/helper.c
16
+++ b/target/arm/helper.c
17
@@ -XXX,XX +XXX,XX @@ static void zcr_write(CPUARMState *env, const ARMCPRegInfo *ri,
18
static const ARMCPRegInfo zcr_el1_reginfo = {
19
.name = "ZCR_EL1", .state = ARM_CP_STATE_AA64,
20
.opc0 = 3, .opc1 = 0, .crn = 1, .crm = 2, .opc2 = 0,
21
- .access = PL1_RW, .accessfn = zcr_access, .type = ARM_CP_64BIT,
22
+ .access = PL1_RW, .accessfn = zcr_access,
23
.fieldoffset = offsetof(CPUARMState, vfp.zcr_el[1]),
24
.writefn = zcr_write, .raw_writefn = raw_write
25
};
26
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo zcr_el1_reginfo = {
27
static const ARMCPRegInfo zcr_el2_reginfo = {
28
.name = "ZCR_EL2", .state = ARM_CP_STATE_AA64,
29
.opc0 = 3, .opc1 = 4, .crn = 1, .crm = 2, .opc2 = 0,
30
- .access = PL2_RW, .accessfn = zcr_access, .type = ARM_CP_64BIT,
31
+ .access = PL2_RW, .accessfn = zcr_access,
32
.fieldoffset = offsetof(CPUARMState, vfp.zcr_el[2]),
33
.writefn = zcr_write, .raw_writefn = raw_write
34
};
35
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo zcr_el2_reginfo = {
36
static const ARMCPRegInfo zcr_no_el2_reginfo = {
37
.name = "ZCR_EL2", .state = ARM_CP_STATE_AA64,
38
.opc0 = 3, .opc1 = 4, .crn = 1, .crm = 2, .opc2 = 0,
39
- .access = PL2_RW, .type = ARM_CP_64BIT,
40
+ .access = PL2_RW,
41
.readfn = arm_cp_read_zero, .writefn = arm_cp_write_ignore
42
};
43
44
static const ARMCPRegInfo zcr_el3_reginfo = {
45
.name = "ZCR_EL3", .state = ARM_CP_STATE_AA64,
46
.opc0 = 3, .opc1 = 6, .crn = 1, .crm = 2, .opc2 = 0,
47
- .access = PL3_RW, .accessfn = zcr_access, .type = ARM_CP_64BIT,
48
+ .access = PL3_RW, .accessfn = zcr_access,
49
.fieldoffset = offsetof(CPUARMState, vfp.zcr_el[3]),
50
.writefn = zcr_write, .raw_writefn = raw_write
51
};
52
--
53
2.16.1
54
55
diff view generated by jsdifflib
Deleted patch
1
Instead of hardcoding the values of M profile ID registers in the
2
NVIC, use the fields in the CPU struct. This will allow us to
3
give different M profile CPU types different ID register values.
4
1
5
This commit includes the addition of the missing ID_ISAR5,
6
which exists as RES0 in both v7M and v8M.
7
8
(The values of the ID registers might be wrong for the M4 --
9
this commit leaves the behaviour there unchanged.)
10
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
13
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
14
Message-id: 20180209165810.6668-2-peter.maydell@linaro.org
15
---
16
hw/intc/armv7m_nvic.c | 30 ++++++++++++++++--------------
17
target/arm/cpu.c | 28 ++++++++++++++++++++++++++++
18
2 files changed, 44 insertions(+), 14 deletions(-)
19
20
diff --git a/hw/intc/armv7m_nvic.c b/hw/intc/armv7m_nvic.c
21
index XXXXXXX..XXXXXXX 100644
22
--- a/hw/intc/armv7m_nvic.c
23
+++ b/hw/intc/armv7m_nvic.c
24
@@ -XXX,XX +XXX,XX @@ static uint32_t nvic_readl(NVICState *s, uint32_t offset, MemTxAttrs attrs)
25
"Aux Fault status registers unimplemented\n");
26
return 0;
27
case 0xd40: /* PFR0. */
28
- return 0x00000030;
29
- case 0xd44: /* PRF1. */
30
- return 0x00000200;
31
+ return cpu->id_pfr0;
32
+ case 0xd44: /* PFR1. */
33
+ return cpu->id_pfr1;
34
case 0xd48: /* DFR0. */
35
- return 0x00100000;
36
+ return cpu->id_dfr0;
37
case 0xd4c: /* AFR0. */
38
- return 0x00000000;
39
+ return cpu->id_afr0;
40
case 0xd50: /* MMFR0. */
41
- return 0x00000030;
42
+ return cpu->id_mmfr0;
43
case 0xd54: /* MMFR1. */
44
- return 0x00000000;
45
+ return cpu->id_mmfr1;
46
case 0xd58: /* MMFR2. */
47
- return 0x00000000;
48
+ return cpu->id_mmfr2;
49
case 0xd5c: /* MMFR3. */
50
- return 0x00000000;
51
+ return cpu->id_mmfr3;
52
case 0xd60: /* ISAR0. */
53
- return 0x01141110;
54
+ return cpu->id_isar0;
55
case 0xd64: /* ISAR1. */
56
- return 0x02111000;
57
+ return cpu->id_isar1;
58
case 0xd68: /* ISAR2. */
59
- return 0x21112231;
60
+ return cpu->id_isar2;
61
case 0xd6c: /* ISAR3. */
62
- return 0x01111110;
63
+ return cpu->id_isar3;
64
case 0xd70: /* ISAR4. */
65
- return 0x01310102;
66
+ return cpu->id_isar4;
67
+ case 0xd74: /* ISAR5. */
68
+ return cpu->id_isar5;
69
/* TODO: Implement debug registers. */
70
case 0xd90: /* MPU_TYPE */
71
/* Unified MPU; if the MPU is not present this value is zero */
72
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
73
index XXXXXXX..XXXXXXX 100644
74
--- a/target/arm/cpu.c
75
+++ b/target/arm/cpu.c
76
@@ -XXX,XX +XXX,XX @@ static void cortex_m3_initfn(Object *obj)
77
set_feature(&cpu->env, ARM_FEATURE_M);
78
cpu->midr = 0x410fc231;
79
cpu->pmsav7_dregion = 8;
80
+ cpu->id_pfr0 = 0x00000030;
81
+ cpu->id_pfr1 = 0x00000200;
82
+ cpu->id_dfr0 = 0x00100000;
83
+ cpu->id_afr0 = 0x00000000;
84
+ cpu->id_mmfr0 = 0x00000030;
85
+ cpu->id_mmfr1 = 0x00000000;
86
+ cpu->id_mmfr2 = 0x00000000;
87
+ cpu->id_mmfr3 = 0x00000000;
88
+ cpu->id_isar0 = 0x01141110;
89
+ cpu->id_isar1 = 0x02111000;
90
+ cpu->id_isar2 = 0x21112231;
91
+ cpu->id_isar3 = 0x01111110;
92
+ cpu->id_isar4 = 0x01310102;
93
+ cpu->id_isar5 = 0x00000000;
94
}
95
96
static void cortex_m4_initfn(Object *obj)
97
@@ -XXX,XX +XXX,XX @@ static void cortex_m4_initfn(Object *obj)
98
set_feature(&cpu->env, ARM_FEATURE_THUMB_DSP);
99
cpu->midr = 0x410fc240; /* r0p0 */
100
cpu->pmsav7_dregion = 8;
101
+ cpu->id_pfr0 = 0x00000030;
102
+ cpu->id_pfr1 = 0x00000200;
103
+ cpu->id_dfr0 = 0x00100000;
104
+ cpu->id_afr0 = 0x00000000;
105
+ cpu->id_mmfr0 = 0x00000030;
106
+ cpu->id_mmfr1 = 0x00000000;
107
+ cpu->id_mmfr2 = 0x00000000;
108
+ cpu->id_mmfr3 = 0x00000000;
109
+ cpu->id_isar0 = 0x01141110;
110
+ cpu->id_isar1 = 0x02111000;
111
+ cpu->id_isar2 = 0x21112231;
112
+ cpu->id_isar3 = 0x01111110;
113
+ cpu->id_isar4 = 0x01310102;
114
+ cpu->id_isar5 = 0x00000000;
115
}
116
117
static void arm_v7m_class_init(ObjectClass *oc, void *data)
118
--
119
2.16.1
120
121
diff view generated by jsdifflib
Deleted patch
1
For M profile cores, cache maintenance operations are done by
2
writing to special registers in the system register space.
3
For QEMU, cache operations are always NOPs, since we don't
4
implement the cache. Implementing these explicitly avoids
5
a spurious LOG_GUEST_ERROR when the guest uses them.
6
1
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
9
Message-id: 20180209165810.6668-4-peter.maydell@linaro.org
10
---
11
hw/intc/armv7m_nvic.c | 12 ++++++++++++
12
1 file changed, 12 insertions(+)
13
14
diff --git a/hw/intc/armv7m_nvic.c b/hw/intc/armv7m_nvic.c
15
index XXXXXXX..XXXXXXX 100644
16
--- a/hw/intc/armv7m_nvic.c
17
+++ b/hw/intc/armv7m_nvic.c
18
@@ -XXX,XX +XXX,XX @@ static void nvic_writel(NVICState *s, uint32_t offset, uint32_t value,
19
}
20
break;
21
}
22
+ case 0xf50: /* ICIALLU */
23
+ case 0xf58: /* ICIMVAU */
24
+ case 0xf5c: /* DCIMVAC */
25
+ case 0xf60: /* DCISW */
26
+ case 0xf64: /* DCCMVAU */
27
+ case 0xf68: /* DCCMVAC */
28
+ case 0xf6c: /* DCCSW */
29
+ case 0xf70: /* DCCIMVAC */
30
+ case 0xf74: /* DCCISW */
31
+ case 0xf78: /* BPIALL */
32
+ /* Cache and branch predictor maintenance: for QEMU these always NOP */
33
+ break;
34
default:
35
bad_offset:
36
qemu_log_mask(LOG_GUEST_ERROR,
37
--
38
2.16.1
39
40
diff view generated by jsdifflib
Deleted patch
1
We were previously making the system control register (SCR)
2
just RAZ/WI. Although we don't implement the functionality
3
this register controls, we should at least provide the state,
4
including the banked state for v8M.
5
1
6
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
8
Message-id: 20180209165810.6668-7-peter.maydell@linaro.org
9
---
10
target/arm/cpu.h | 7 +++++++
11
hw/intc/armv7m_nvic.c | 12 ++++++++----
12
target/arm/machine.c | 12 ++++++++++++
13
3 files changed, 27 insertions(+), 4 deletions(-)
14
15
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
16
index XXXXXXX..XXXXXXX 100644
17
--- a/target/arm/cpu.h
18
+++ b/target/arm/cpu.h
19
@@ -XXX,XX +XXX,XX @@ typedef struct CPUARMState {
20
uint32_t aircr; /* only holds r/w state if security extn implemented */
21
uint32_t secure; /* Is CPU in Secure state? (not guest visible) */
22
uint32_t csselr[M_REG_NUM_BANKS];
23
+ uint32_t scr[M_REG_NUM_BANKS];
24
} v7m;
25
26
/* Information associated with an exception about to be taken:
27
@@ -XXX,XX +XXX,XX @@ FIELD(V7M_CCR, STKALIGN, 9, 1)
28
FIELD(V7M_CCR, DC, 16, 1)
29
FIELD(V7M_CCR, IC, 17, 1)
30
31
+/* V7M SCR bits */
32
+FIELD(V7M_SCR, SLEEPONEXIT, 1, 1)
33
+FIELD(V7M_SCR, SLEEPDEEP, 2, 1)
34
+FIELD(V7M_SCR, SLEEPDEEPS, 3, 1)
35
+FIELD(V7M_SCR, SEVONPEND, 4, 1)
36
+
37
/* V7M AIRCR bits */
38
FIELD(V7M_AIRCR, VECTRESET, 0, 1)
39
FIELD(V7M_AIRCR, VECTCLRACTIVE, 1, 1)
40
diff --git a/hw/intc/armv7m_nvic.c b/hw/intc/armv7m_nvic.c
41
index XXXXXXX..XXXXXXX 100644
42
--- a/hw/intc/armv7m_nvic.c
43
+++ b/hw/intc/armv7m_nvic.c
44
@@ -XXX,XX +XXX,XX @@ static uint32_t nvic_readl(NVICState *s, uint32_t offset, MemTxAttrs attrs)
45
}
46
return val;
47
case 0xd10: /* System Control. */
48
- /* TODO: Implement SLEEPONEXIT. */
49
- return 0;
50
+ return cpu->env.v7m.scr[attrs.secure];
51
case 0xd14: /* Configuration Control. */
52
/* The BFHFNMIGN bit is the only non-banked bit; we
53
* keep it in the non-secure copy of the register.
54
@@ -XXX,XX +XXX,XX @@ static void nvic_writel(NVICState *s, uint32_t offset, uint32_t value,
55
}
56
break;
57
case 0xd10: /* System Control. */
58
- /* TODO: Implement control registers. */
59
- qemu_log_mask(LOG_UNIMP, "NVIC: SCR unimplemented\n");
60
+ /* We don't implement deep-sleep so these bits are RAZ/WI.
61
+ * The other bits in the register are banked.
62
+ * QEMU's implementation ignores SEVONPEND and SLEEPONEXIT, which
63
+ * is architecturally permitted.
64
+ */
65
+ value &= ~(R_V7M_SCR_SLEEPDEEP_MASK | R_V7M_SCR_SLEEPDEEPS_MASK);
66
+ cpu->env.v7m.scr[attrs.secure] = value;
67
break;
68
case 0xd14: /* Configuration Control. */
69
/* Enforce RAZ/WI on reserved and must-RAZ/WI bits */
70
diff --git a/target/arm/machine.c b/target/arm/machine.c
71
index XXXXXXX..XXXXXXX 100644
72
--- a/target/arm/machine.c
73
+++ b/target/arm/machine.c
74
@@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_m_csselr = {
75
}
76
};
77
78
+static const VMStateDescription vmstate_m_scr = {
79
+ .name = "cpu/m/scr",
80
+ .version_id = 1,
81
+ .minimum_version_id = 1,
82
+ .fields = (VMStateField[]) {
83
+ VMSTATE_UINT32(env.v7m.scr[M_REG_NS], ARMCPU),
84
+ VMSTATE_END_OF_LIST()
85
+ }
86
+};
87
+
88
static const VMStateDescription vmstate_m = {
89
.name = "cpu/m",
90
.version_id = 4,
91
@@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_m = {
92
.subsections = (const VMStateDescription*[]) {
93
&vmstate_m_faultmask_primask,
94
&vmstate_m_csselr,
95
+ &vmstate_m_scr,
96
NULL
97
}
98
};
99
@@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_m_security = {
100
VMSTATE_UINT32(env.sau.rnr, ARMCPU),
101
VMSTATE_VALIDATE("SAU_RNR is valid", sau_rnr_vmstate_validate),
102
VMSTATE_UINT32(env.sau.ctrl, ARMCPU),
103
+ VMSTATE_UINT32(env.v7m.scr[M_REG_S], ARMCPU),
104
VMSTATE_END_OF_LIST()
105
}
106
};
107
--
108
2.16.1
109
110
diff view generated by jsdifflib
Deleted patch
1
In many of the NVIC registers relating to interrupts, we
2
have to convert from a byte offset within a register set
3
into the number of the first interrupt which is affected.
4
We were getting this wrong for:
5
* reads of NVIC_ISPR<n>, NVIC_ISER<n>, NVIC_ICPR<n>, NVIC_ICER<n>,
6
NVIC_IABR<n> -- in all these cases we were missing the "* 8"
7
needed to convert from the byte offset to the interrupt number
8
(since all these registers use one bit per interrupt)
9
* writes of NVIC_IPR<n> had the opposite problem of a spurious
10
"* 8" (since these registers use one byte per interrupt)
11
1
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
14
Message-id: 20180209165810.6668-9-peter.maydell@linaro.org
15
---
16
hw/intc/armv7m_nvic.c | 8 ++++----
17
1 file changed, 4 insertions(+), 4 deletions(-)
18
19
diff --git a/hw/intc/armv7m_nvic.c b/hw/intc/armv7m_nvic.c
20
index XXXXXXX..XXXXXXX 100644
21
--- a/hw/intc/armv7m_nvic.c
22
+++ b/hw/intc/armv7m_nvic.c
23
@@ -XXX,XX +XXX,XX @@ static MemTxResult nvic_sysreg_read(void *opaque, hwaddr addr,
24
/* fall through */
25
case 0x180 ... 0x1bf: /* NVIC Clear enable */
26
val = 0;
27
- startvec = offset - 0x180 + NVIC_FIRST_IRQ; /* vector # */
28
+ startvec = 8 * (offset - 0x180) + NVIC_FIRST_IRQ; /* vector # */
29
30
for (i = 0, end = size * 8; i < end && startvec + i < s->num_irq; i++) {
31
if (s->vectors[startvec + i].enabled &&
32
@@ -XXX,XX +XXX,XX @@ static MemTxResult nvic_sysreg_read(void *opaque, hwaddr addr,
33
/* fall through */
34
case 0x280 ... 0x2bf: /* NVIC Clear pend */
35
val = 0;
36
- startvec = offset - 0x280 + NVIC_FIRST_IRQ; /* vector # */
37
+ startvec = 8 * (offset - 0x280) + NVIC_FIRST_IRQ; /* vector # */
38
for (i = 0, end = size * 8; i < end && startvec + i < s->num_irq; i++) {
39
if (s->vectors[startvec + i].pending &&
40
(attrs.secure || s->itns[startvec + i])) {
41
@@ -XXX,XX +XXX,XX @@ static MemTxResult nvic_sysreg_read(void *opaque, hwaddr addr,
42
break;
43
case 0x300 ... 0x33f: /* NVIC Active */
44
val = 0;
45
- startvec = offset - 0x300 + NVIC_FIRST_IRQ; /* vector # */
46
+ startvec = 8 * (offset - 0x300) + NVIC_FIRST_IRQ; /* vector # */
47
48
for (i = 0, end = size * 8; i < end && startvec + i < s->num_irq; i++) {
49
if (s->vectors[startvec + i].active &&
50
@@ -XXX,XX +XXX,XX @@ static MemTxResult nvic_sysreg_write(void *opaque, hwaddr addr,
51
case 0x300 ... 0x33f: /* NVIC Active */
52
return MEMTX_OK; /* R/O */
53
case 0x400 ... 0x5ef: /* NVIC Priority */
54
- startvec = 8 * (offset - 0x400) + NVIC_FIRST_IRQ; /* vector # */
55
+ startvec = (offset - 0x400) + NVIC_FIRST_IRQ; /* vector # */
56
57
for (i = 0; i < size && startvec + i < s->num_irq; i++) {
58
if (attrs.secure || s->itns[startvec + i]) {
59
--
60
2.16.1
61
62
diff view generated by jsdifflib