1
The following changes since commit ad1b4ec39caa5b3f17cbd8160283a03a3dcfe2ae:
1
Hi; here's an arm pullreq. The big bits here are Fabiano's
2
CONFIG_TCG=n patches and my set that deprecate -singlestep;
3
other than that there's a collection of smaller bugfixes.
2
4
3
Merge remote-tracking branch 'remotes/kraxel/tags/input-20180515-pull-request' into staging (2018-05-15 12:50:06 +0100)
5
thanks
6
-- PMM
7
8
The following changes since commit 7c18f2d663521f1b31b821a13358ce38075eaf7d:
9
10
Merge tag 'for-upstream' of https://gitlab.com/bonzini/qemu into staging (2023-04-29 23:07:17 +0100)
4
11
5
are available in the Git repository at:
12
are available in the Git repository at:
6
13
7
git://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20180515
14
https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20230502-1
8
15
9
for you to fetch changes up to ae7651804748c6b479d5ae09aeac4edb9c44f76e:
16
for you to fetch changes up to 0ab99e4252f21550f2c16f859cbcdd3cced9f8bf:
10
17
11
tcg: Optionally log FPU state in TCG -d cpu logging (2018-05-15 14:58:44 +0100)
18
hw/net/allwinner-sun8i-emac: Correctly byteswap descriptor fields (2023-05-02 13:10:42 +0100)
12
19
13
----------------------------------------------------------------
20
----------------------------------------------------------------
14
target-arm queue:
21
* Support building Arm targets with CONFIG_TCG=no (ie KVM only)
15
* Fix coverity nit in int_to_float code
22
* hw/net: npcm7xx_emc: set MAC in register space
16
* Don't set Invalid for float-to-int(MAXINT)
23
* hw/arm/bcm2835_property: Implement "get command line" message
17
* Fix fp_status_f16 tininess before rounding
24
* Deprecate the '-singlestep' command line option in favour of
18
* Add various missing insns from the v8.2-FP16 extension
25
'-one-insn-per-tb' and '-accel one-insn-per-tb=on'
19
* Fix sqrt_f16 exception raising
26
* Deprecate 'singlestep' member of QMP StatusInfo struct
20
* sdcard: Correct CRC16 offset in sd_function_switch()
27
* docs/about/deprecated.rst: Add "since 7.1" tag to dtb-kaslr-seed deprecation
21
* tcg: Optionally log FPU state in TCG -d cpu logging
28
* hw/net/msf2-emac: Don't modify descriptor in-place in emac_store_desc()
29
* raspi, aspeed: Write bootloader code correctly on big-endian hosts
30
* hw/intc/allwinner-a10-pic: Fix bug on big-endian hosts
31
* Fix bug in A32 ERET on big-endian hosts that caused guest crash
32
* hw/sd/allwinner-sdhost: Correctly byteswap descriptor fields
33
* hw/net/allwinner-sun8i-emac: Correctly byteswap descriptor fields
22
34
23
----------------------------------------------------------------
35
----------------------------------------------------------------
24
Alex Bennée (5):
36
Claudio Fontana (1):
25
fpu/softfloat: int_to_float ensure r fully initialised
37
target/arm: move cpu_tcg to tcg/cpu32.c
26
target/arm: Implement FCMP for fp16
27
target/arm: Implement FCSEL for fp16
28
target/arm: Implement FMOV (immediate) for fp16
29
target/arm: Fix sqrt_f16 exception raising
30
38
31
Peter Maydell (3):
39
Cédric Le Goater (2):
32
fpu/softfloat: Don't set Invalid for float-to-int(MAXINT)
40
hw/arm/boot: Make write_bootloader() public as arm_write_bootloader()
33
target/arm: Fix fp_status_f16 tininess before rounding
41
hw/arm/aspeed: Use arm_write_bootloader() to write the bootloader
34
tcg: Optionally log FPU state in TCG -d cpu logging
42
43
Daniel Bertalan (1):
44
hw/arm/bcm2835_property: Implement "get command line" message
45
46
Fabiano Rosas (11):
47
target/arm: Move cortex sysregs into a separate file
48
target/arm: Remove dead code from cpu_max_set_sve_max_vq
49
target/arm: Extract TCG -cpu max code into a function
50
target/arm: Do not expose all -cpu max features to qtests
51
target/arm: Move 64-bit TCG CPUs into tcg/
52
tests/qtest: Adjust and document query-cpu-model-expansion test for arm
53
tests/qtest: Fix tests when no KVM or TCG are present
54
tests/avocado: Pass parameters to migration test
55
arm/Kconfig: Always select SEMIHOSTING when TCG is present
56
arm/Kconfig: Do not build TCG-only boards on a KVM-only build
57
tests/qtest: Restrict tpm-tis-i2c-test to CONFIG_TCG
58
59
Patrick Venture (1):
60
hw/net: npcm7xx_emc: set MAC in register space
61
62
Peter Maydell (18):
63
make one-insn-per-tb an accel option
64
softmmu: Don't use 'singlestep' global in QMP and HMP commands
65
accel/tcg: Use one_insn_per_tb global instead of old singlestep global
66
linux-user: Add '-one-insn-per-tb' option equivalent to '-singlestep'
67
bsd-user: Add '-one-insn-per-tb' option equivalent to '-singlestep'
68
Document that -singlestep command line option is deprecated
69
accel/tcg: Report one-insn-per-tb in 'info jit', not 'info status'
70
hmp: Add 'one-insn-per-tb' command equivalent to 'singlestep'
71
qapi/run-state.json: Fix missing newline at end of file
72
qmp: Deprecate 'singlestep' member of StatusInfo
73
docs/about/deprecated.rst: Add "since 7.1" tag to dtb-kaslr-seed deprecation
74
hw/net/msf2-emac: Don't modify descriptor in-place in emac_store_desc()
75
hw/arm/raspi: Use arm_write_bootloader() to write boot code
76
hw/intc/allwinner-a10-pic: Don't use set_bit()/clear_bit()
77
target/arm: Define and use new load_cpu_field_low32()
78
target/arm: Add compile time asserts to load/store_cpu_field macros
79
hw/sd/allwinner-sdhost: Correctly byteswap descriptor fields
80
hw/net/allwinner-sun8i-emac: Correctly byteswap descriptor fields
35
81
36
Philippe Mathieu-Daudé (1):
82
Philippe Mathieu-Daudé (1):
37
sdcard: Correct CRC16 offset in sd_function_switch()
83
gitlab-ci: Check building KVM-only aarch64 target
38
84
39
Richard Henderson (7):
85
docs/about/deprecated.rst | 43 +-
40
target/arm: Implement FMOV (general) for fp16
86
docs/user/main.rst | 14 +-
41
target/arm: Early exit after unallocated_encoding in disas_fp_int_conv
87
configs/devices/aarch64-softmmu/default.mak | 4 -
42
target/arm: Implement FCVT (scalar, integer) for fp16
88
configs/devices/arm-softmmu/default.mak | 39 --
43
target/arm: Implement FCVT (scalar, fixed-point) for fp16
89
qapi/run-state.json | 16 +-
44
target/arm: Introduce and use read_fp_hreg
90
accel/tcg/internal.h | 2 +
45
target/arm: Implement FP data-processing (2 source) for fp16
91
include/exec/cpu-common.h | 2 -
46
target/arm: Implement FP data-processing (3 source) for fp16
92
include/hw/arm/boot.h | 49 ++
93
include/hw/misc/bcm2835_property.h | 1 +
94
include/monitor/hmp.h | 2 +-
95
target/arm/cpregs.h | 6 +
96
target/arm/internals.h | 10 +-
97
target/arm/translate-a32.h | 24 +-
98
accel/tcg/cpu-exec.c | 2 +-
99
accel/tcg/monitor.c | 14 +
100
accel/tcg/tcg-all.c | 23 +
101
bsd-user/main.c | 14 +-
102
hw/arm/aspeed.c | 38 +-
103
hw/arm/bcm2835_peripherals.c | 2 +
104
hw/arm/bcm2836.c | 2 +
105
hw/arm/boot.c | 35 +-
106
hw/arm/raspi.c | 66 +-
107
hw/arm/virt.c | 6 +-
108
hw/intc/allwinner-a10-pic.c | 7 +-
109
hw/misc/bcm2835_property.c | 13 +-
110
hw/net/allwinner-sun8i-emac.c | 22 +-
111
hw/net/msf2-emac.c | 16 +-
112
hw/net/npcm7xx_emc.c | 32 +-
113
hw/sd/allwinner-sdhost.c | 31 +-
114
linux-user/main.c | 18 +-
115
softmmu/globals.c | 1 -
116
softmmu/runstate-hmp-cmds.c | 25 +-
117
softmmu/runstate.c | 10 +-
118
softmmu/vl.c | 17 +-
119
target/arm/cortex-regs.c | 69 ++
120
target/arm/cpu64.c | 702 +-------------------
121
target/arm/{cpu_tcg.c => tcg/cpu32.c} | 72 +-
122
target/arm/tcg/cpu64.c | 723 +++++++++++++++++++++
123
target/arm/tcg/translate.c | 4 +-
124
tests/qtest/arm-cpu-features.c | 20 +-
125
tests/qtest/bios-tables-test.c | 11 +-
126
tests/qtest/boot-serial-test.c | 5 +
127
tests/qtest/migration-test.c | 9 +-
128
tests/qtest/pxe-test.c | 8 +-
129
tests/qtest/test-hmp.c | 1 +
130
tests/qtest/vmgenid-test.c | 9 +-
131
.gitlab-ci.d/crossbuilds.yml | 11 +
132
.../custom-runners/ubuntu-22.04-aarch64.yml | 4 -
133
hmp-commands.hx | 25 +-
134
hw/arm/Kconfig | 43 +-
135
qemu-options.hx | 12 +-
136
target/arm/Kconfig | 7 +
137
target/arm/meson.build | 2 +-
138
target/arm/tcg/meson.build | 2 +
139
tcg/tci/README | 2 +-
140
tests/avocado/migration.py | 83 ++-
141
tests/qtest/meson.build | 3 +-
142
57 files changed, 1449 insertions(+), 984 deletions(-)
143
create mode 100644 target/arm/cortex-regs.c
144
rename target/arm/{cpu_tcg.c => tcg/cpu32.c} (93%)
145
create mode 100644 target/arm/tcg/cpu64.c
47
146
48
include/qemu/log.h | 1 +
49
target/arm/helper-a64.h | 2 +
50
target/arm/helper.h | 6 +
51
accel/tcg/cpu-exec.c | 9 +-
52
fpu/softfloat.c | 6 +-
53
hw/sd/sd.c | 2 +-
54
target/arm/cpu.c | 2 +
55
target/arm/helper-a64.c | 10 ++
56
target/arm/helper.c | 38 +++-
57
target/arm/translate-a64.c | 421 ++++++++++++++++++++++++++++++++++++++-------
58
util/log.c | 2 +
59
11 files changed, 428 insertions(+), 71 deletions(-)
60
diff view generated by jsdifflib
New patch
1
1
From: Fabiano Rosas <farosas@suse.de>
2
3
The file cpu_tcg.c is about to be moved into the tcg/ directory, so
4
move the register definitions into a new file.
5
6
Also move the function declaration to the more appropriate cpregs.h.
7
8
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
9
Signed-off-by: Fabiano Rosas <farosas@suse.de>
10
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
11
Message-id: 20230426180013.14814-2-farosas@suse.de
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
---
14
target/arm/cpregs.h | 6 ++++
15
target/arm/internals.h | 6 ----
16
target/arm/cortex-regs.c | 69 ++++++++++++++++++++++++++++++++++++++++
17
target/arm/cpu64.c | 1 +
18
target/arm/cpu_tcg.c | 59 ----------------------------------
19
target/arm/meson.build | 1 +
20
6 files changed, 77 insertions(+), 65 deletions(-)
21
create mode 100644 target/arm/cortex-regs.c
22
23
diff --git a/target/arm/cpregs.h b/target/arm/cpregs.h
24
index XXXXXXX..XXXXXXX 100644
25
--- a/target/arm/cpregs.h
26
+++ b/target/arm/cpregs.h
27
@@ -XXX,XX +XXX,XX @@ static inline bool arm_cpreg_in_idspace(const ARMCPRegInfo *ri)
28
ri->crn, ri->crm);
29
}
30
31
+#ifdef CONFIG_USER_ONLY
32
+static inline void define_cortex_a72_a57_a53_cp_reginfo(ARMCPU *cpu) { }
33
+#else
34
+void define_cortex_a72_a57_a53_cp_reginfo(ARMCPU *cpu);
35
+#endif
36
+
37
#endif /* TARGET_ARM_CPREGS_H */
38
diff --git a/target/arm/internals.h b/target/arm/internals.h
39
index XXXXXXX..XXXXXXX 100644
40
--- a/target/arm/internals.h
41
+++ b/target/arm/internals.h
42
@@ -XXX,XX +XXX,XX @@ uint32_t arm_v7m_mrs_control(CPUARMState *env, uint32_t secure);
43
uint32_t *arm_v7m_get_sp_ptr(CPUARMState *env, bool secure,
44
bool threadmode, bool spsel);
45
46
-#ifdef CONFIG_USER_ONLY
47
-static inline void define_cortex_a72_a57_a53_cp_reginfo(ARMCPU *cpu) { }
48
-#else
49
-void define_cortex_a72_a57_a53_cp_reginfo(ARMCPU *cpu);
50
-#endif
51
-
52
bool el_is_in_host(CPUARMState *env, int el);
53
54
void aa32_max_features(ARMCPU *cpu);
55
diff --git a/target/arm/cortex-regs.c b/target/arm/cortex-regs.c
56
new file mode 100644
57
index XXXXXXX..XXXXXXX
58
--- /dev/null
59
+++ b/target/arm/cortex-regs.c
60
@@ -XXX,XX +XXX,XX @@
61
+/*
62
+ * ARM Cortex-A registers
63
+ *
64
+ * This code is licensed under the GNU GPL v2 or later.
65
+ *
66
+ * SPDX-License-Identifier: GPL-2.0-or-later
67
+ */
68
+
69
+#include "qemu/osdep.h"
70
+#include "cpu.h"
71
+#include "cpregs.h"
72
+
73
+
74
+static uint64_t l2ctlr_read(CPUARMState *env, const ARMCPRegInfo *ri)
75
+{
76
+ ARMCPU *cpu = env_archcpu(env);
77
+
78
+ /* Number of cores is in [25:24]; otherwise we RAZ */
79
+ return (cpu->core_count - 1) << 24;
80
+}
81
+
82
+static const ARMCPRegInfo cortex_a72_a57_a53_cp_reginfo[] = {
83
+ { .name = "L2CTLR_EL1", .state = ARM_CP_STATE_AA64,
84
+ .opc0 = 3, .opc1 = 1, .crn = 11, .crm = 0, .opc2 = 2,
85
+ .access = PL1_RW, .readfn = l2ctlr_read,
86
+ .writefn = arm_cp_write_ignore },
87
+ { .name = "L2CTLR",
88
+ .cp = 15, .opc1 = 1, .crn = 9, .crm = 0, .opc2 = 2,
89
+ .access = PL1_RW, .readfn = l2ctlr_read,
90
+ .writefn = arm_cp_write_ignore },
91
+ { .name = "L2ECTLR_EL1", .state = ARM_CP_STATE_AA64,
92
+ .opc0 = 3, .opc1 = 1, .crn = 11, .crm = 0, .opc2 = 3,
93
+ .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 },
94
+ { .name = "L2ECTLR",
95
+ .cp = 15, .opc1 = 1, .crn = 9, .crm = 0, .opc2 = 3,
96
+ .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 },
97
+ { .name = "L2ACTLR", .state = ARM_CP_STATE_BOTH,
98
+ .opc0 = 3, .opc1 = 1, .crn = 15, .crm = 0, .opc2 = 0,
99
+ .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 },
100
+ { .name = "CPUACTLR_EL1", .state = ARM_CP_STATE_AA64,
101
+ .opc0 = 3, .opc1 = 1, .crn = 15, .crm = 2, .opc2 = 0,
102
+ .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 },
103
+ { .name = "CPUACTLR",
104
+ .cp = 15, .opc1 = 0, .crm = 15,
105
+ .access = PL1_RW, .type = ARM_CP_CONST | ARM_CP_64BIT, .resetvalue = 0 },
106
+ { .name = "CPUECTLR_EL1", .state = ARM_CP_STATE_AA64,
107
+ .opc0 = 3, .opc1 = 1, .crn = 15, .crm = 2, .opc2 = 1,
108
+ .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 },
109
+ { .name = "CPUECTLR",
110
+ .cp = 15, .opc1 = 1, .crm = 15,
111
+ .access = PL1_RW, .type = ARM_CP_CONST | ARM_CP_64BIT, .resetvalue = 0 },
112
+ { .name = "CPUMERRSR_EL1", .state = ARM_CP_STATE_AA64,
113
+ .opc0 = 3, .opc1 = 1, .crn = 15, .crm = 2, .opc2 = 2,
114
+ .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 },
115
+ { .name = "CPUMERRSR",
116
+ .cp = 15, .opc1 = 2, .crm = 15,
117
+ .access = PL1_RW, .type = ARM_CP_CONST | ARM_CP_64BIT, .resetvalue = 0 },
118
+ { .name = "L2MERRSR_EL1", .state = ARM_CP_STATE_AA64,
119
+ .opc0 = 3, .opc1 = 1, .crn = 15, .crm = 2, .opc2 = 3,
120
+ .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 },
121
+ { .name = "L2MERRSR",
122
+ .cp = 15, .opc1 = 3, .crm = 15,
123
+ .access = PL1_RW, .type = ARM_CP_CONST | ARM_CP_64BIT, .resetvalue = 0 },
124
+};
125
+
126
+void define_cortex_a72_a57_a53_cp_reginfo(ARMCPU *cpu)
127
+{
128
+ define_arm_cp_regs(cpu, cortex_a72_a57_a53_cp_reginfo);
129
+}
130
diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c
131
index XXXXXXX..XXXXXXX 100644
132
--- a/target/arm/cpu64.c
133
+++ b/target/arm/cpu64.c
134
@@ -XXX,XX +XXX,XX @@
135
#include "qapi/visitor.h"
136
#include "hw/qdev-properties.h"
137
#include "internals.h"
138
+#include "cpregs.h"
139
140
static void aarch64_a35_initfn(Object *obj)
141
{
142
diff --git a/target/arm/cpu_tcg.c b/target/arm/cpu_tcg.c
143
index XXXXXXX..XXXXXXX 100644
144
--- a/target/arm/cpu_tcg.c
145
+++ b/target/arm/cpu_tcg.c
146
@@ -XXX,XX +XXX,XX @@ void aa32_max_features(ARMCPU *cpu)
147
cpu->isar.id_dfr0 = t;
148
}
149
150
-#ifndef CONFIG_USER_ONLY
151
-static uint64_t l2ctlr_read(CPUARMState *env, const ARMCPRegInfo *ri)
152
-{
153
- ARMCPU *cpu = env_archcpu(env);
154
-
155
- /* Number of cores is in [25:24]; otherwise we RAZ */
156
- return (cpu->core_count - 1) << 24;
157
-}
158
-
159
-static const ARMCPRegInfo cortex_a72_a57_a53_cp_reginfo[] = {
160
- { .name = "L2CTLR_EL1", .state = ARM_CP_STATE_AA64,
161
- .opc0 = 3, .opc1 = 1, .crn = 11, .crm = 0, .opc2 = 2,
162
- .access = PL1_RW, .readfn = l2ctlr_read,
163
- .writefn = arm_cp_write_ignore },
164
- { .name = "L2CTLR",
165
- .cp = 15, .opc1 = 1, .crn = 9, .crm = 0, .opc2 = 2,
166
- .access = PL1_RW, .readfn = l2ctlr_read,
167
- .writefn = arm_cp_write_ignore },
168
- { .name = "L2ECTLR_EL1", .state = ARM_CP_STATE_AA64,
169
- .opc0 = 3, .opc1 = 1, .crn = 11, .crm = 0, .opc2 = 3,
170
- .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 },
171
- { .name = "L2ECTLR",
172
- .cp = 15, .opc1 = 1, .crn = 9, .crm = 0, .opc2 = 3,
173
- .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 },
174
- { .name = "L2ACTLR", .state = ARM_CP_STATE_BOTH,
175
- .opc0 = 3, .opc1 = 1, .crn = 15, .crm = 0, .opc2 = 0,
176
- .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 },
177
- { .name = "CPUACTLR_EL1", .state = ARM_CP_STATE_AA64,
178
- .opc0 = 3, .opc1 = 1, .crn = 15, .crm = 2, .opc2 = 0,
179
- .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 },
180
- { .name = "CPUACTLR",
181
- .cp = 15, .opc1 = 0, .crm = 15,
182
- .access = PL1_RW, .type = ARM_CP_CONST | ARM_CP_64BIT, .resetvalue = 0 },
183
- { .name = "CPUECTLR_EL1", .state = ARM_CP_STATE_AA64,
184
- .opc0 = 3, .opc1 = 1, .crn = 15, .crm = 2, .opc2 = 1,
185
- .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 },
186
- { .name = "CPUECTLR",
187
- .cp = 15, .opc1 = 1, .crm = 15,
188
- .access = PL1_RW, .type = ARM_CP_CONST | ARM_CP_64BIT, .resetvalue = 0 },
189
- { .name = "CPUMERRSR_EL1", .state = ARM_CP_STATE_AA64,
190
- .opc0 = 3, .opc1 = 1, .crn = 15, .crm = 2, .opc2 = 2,
191
- .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 },
192
- { .name = "CPUMERRSR",
193
- .cp = 15, .opc1 = 2, .crm = 15,
194
- .access = PL1_RW, .type = ARM_CP_CONST | ARM_CP_64BIT, .resetvalue = 0 },
195
- { .name = "L2MERRSR_EL1", .state = ARM_CP_STATE_AA64,
196
- .opc0 = 3, .opc1 = 1, .crn = 15, .crm = 2, .opc2 = 3,
197
- .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 },
198
- { .name = "L2MERRSR",
199
- .cp = 15, .opc1 = 3, .crm = 15,
200
- .access = PL1_RW, .type = ARM_CP_CONST | ARM_CP_64BIT, .resetvalue = 0 },
201
-};
202
-
203
-void define_cortex_a72_a57_a53_cp_reginfo(ARMCPU *cpu)
204
-{
205
- define_arm_cp_regs(cpu, cortex_a72_a57_a53_cp_reginfo);
206
-}
207
-#endif /* !CONFIG_USER_ONLY */
208
-
209
/* CPU models. These are not needed for the AArch64 linux-user build. */
210
#if !defined(CONFIG_USER_ONLY) || !defined(TARGET_AARCH64)
211
212
diff --git a/target/arm/meson.build b/target/arm/meson.build
213
index XXXXXXX..XXXXXXX 100644
214
--- a/target/arm/meson.build
215
+++ b/target/arm/meson.build
216
@@ -XXX,XX +XXX,XX @@ arm_softmmu_ss.add(files(
217
'arch_dump.c',
218
'arm-powerctl.c',
219
'arm-qmp-cmds.c',
220
+ 'cortex-regs.c',
221
'machine.c',
222
'ptw.c',
223
))
224
--
225
2.34.1
226
227
diff view generated by jsdifflib
1
From: Alex Bennée <alex.bennee@linaro.org>
1
From: Fabiano Rosas <farosas@suse.de>
2
2
3
All the hard work is already done by vfp_expand_imm, we just need to
3
The sve-max-vq property has been removed from the -cpu max used with
4
make sure we pick up the correct size.
4
KVM, so code under kvm_enabled in cpu_max_set_sve_max_vq is not
5
reachable.
5
6
6
Cc: qemu-stable@nongnu.org
7
Fixes: 0baa21be49 ("target/arm: Make KVM -cpu max exactly like -cpu host")
7
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
8
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
8
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
9
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
9
Tested-by: Alex Bennée <alex.bennee@linaro.org>
10
Signed-off-by: Fabiano Rosas <farosas@suse.de>
10
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
11
Message-id: 20230426180013.14814-3-farosas@suse.de
11
Message-id: 20180512003217.9105-11-richard.henderson@linaro.org
12
[rth: Merge unallocated_encoding check with TCGMemOp conversion.]
13
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
14
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
15
---
13
---
16
target/arm/translate-a64.c | 20 +++++++++++++++++---
14
target/arm/cpu64.c | 6 ------
17
1 file changed, 17 insertions(+), 3 deletions(-)
15
1 file changed, 6 deletions(-)
18
16
19
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
17
diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c
20
index XXXXXXX..XXXXXXX 100644
18
index XXXXXXX..XXXXXXX 100644
21
--- a/target/arm/translate-a64.c
19
--- a/target/arm/cpu64.c
22
+++ b/target/arm/translate-a64.c
20
+++ b/target/arm/cpu64.c
23
@@ -XXX,XX +XXX,XX @@ static void disas_fp_imm(DisasContext *s, uint32_t insn)
21
@@ -XXX,XX +XXX,XX @@ static void cpu_max_set_sve_max_vq(Object *obj, Visitor *v, const char *name,
24
{
25
int rd = extract32(insn, 0, 5);
26
int imm8 = extract32(insn, 13, 8);
27
- int is_double = extract32(insn, 22, 2);
28
+ int type = extract32(insn, 22, 2);
29
uint64_t imm;
30
TCGv_i64 tcg_res;
31
+ TCGMemOp sz;
32
33
- if (is_double > 1) {
34
+ switch (type) {
35
+ case 0:
36
+ sz = MO_32;
37
+ break;
38
+ case 1:
39
+ sz = MO_64;
40
+ break;
41
+ case 3:
42
+ sz = MO_16;
43
+ if (arm_dc_feature(s, ARM_FEATURE_V8_FP16)) {
44
+ break;
45
+ }
46
+ /* fallthru */
47
+ default:
48
unallocated_encoding(s);
49
return;
22
return;
50
}
23
}
51
@@ -XXX,XX +XXX,XX @@ static void disas_fp_imm(DisasContext *s, uint32_t insn)
24
52
return;
25
- if (kvm_enabled() && !kvm_arm_sve_supported()) {
53
}
26
- error_setg(errp, "cannot set sve-max-vq");
54
27
- error_append_hint(errp, "SVE not supported by KVM on this host\n");
55
- imm = vfp_expand_imm(MO_32 + is_double, imm8);
28
- return;
56
+ imm = vfp_expand_imm(sz, imm8);
29
- }
57
30
-
58
tcg_res = tcg_const_i64(imm);
31
if (max_vq == 0 || max_vq > ARM_MAX_VQ) {
59
write_fp_dreg(s, rd, tcg_res);
32
error_setg(errp, "unsupported SVE vector length");
33
error_append_hint(errp, "Valid sve-max-vq in range [1-%d]\n",
60
--
34
--
61
2.17.0
35
2.34.1
62
36
63
37
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
From: Fabiano Rosas <farosas@suse.de>
2
2
3
We missed all of the scalar fp16 binary operations.
3
Introduce aarch64_max_tcg_initfn that contains the TCG-only part of
4
-cpu max configuration. We'll need that to be able to restrict this
5
code to a TCG-only config in the next patches.
4
6
5
Cc: qemu-stable@nongnu.org
7
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
6
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
8
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
7
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
9
Signed-off-by: Fabiano Rosas <farosas@suse.de>
8
Tested-by: Alex Bennée <alex.bennee@linaro.org>
10
Message-id: 20230426180013.14814-4-farosas@suse.de
9
Message-id: 20180512003217.9105-7-richard.henderson@linaro.org
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
---
12
---
12
target/arm/translate-a64.c | 65 ++++++++++++++++++++++++++++++++++++++
13
target/arm/cpu64.c | 32 ++++++++++++++++++--------------
13
1 file changed, 65 insertions(+)
14
1 file changed, 18 insertions(+), 14 deletions(-)
14
15
15
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
16
diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c
16
index XXXXXXX..XXXXXXX 100644
17
index XXXXXXX..XXXXXXX 100644
17
--- a/target/arm/translate-a64.c
18
--- a/target/arm/cpu64.c
18
+++ b/target/arm/translate-a64.c
19
+++ b/target/arm/cpu64.c
19
@@ -XXX,XX +XXX,XX @@ static void handle_fp_2src_double(DisasContext *s, int opcode,
20
@@ -XXX,XX +XXX,XX @@ static void aarch64_host_initfn(Object *obj)
20
tcg_temp_free_i64(tcg_res);
21
#endif
21
}
22
}
22
23
23
+/* Floating-point data-processing (2 source) - half precision */
24
-/* -cpu max: if KVM is enabled, like -cpu host (best possible with this host);
24
+static void handle_fp_2src_half(DisasContext *s, int opcode,
25
- * otherwise, a CPU with as many features enabled as our emulation supports.
25
+ int rd, int rn, int rm)
26
- * The version of '-cpu max' for qemu-system-arm is defined in cpu.c;
27
+/*
28
+ * -cpu max: a CPU with as many features enabled as our emulation supports.
29
+ * The version of '-cpu max' for qemu-system-arm is defined in cpu_tcg.c;
30
* this only needs to handle 64 bits.
31
*/
32
-static void aarch64_max_initfn(Object *obj)
33
+static void aarch64_max_tcg_initfn(Object *obj)
34
{
35
ARMCPU *cpu = ARM_CPU(obj);
36
uint64_t t;
37
uint32_t u;
38
39
- if (kvm_enabled() || hvf_enabled()) {
40
- /* With KVM or HVF, '-cpu max' is identical to '-cpu host' */
41
- aarch64_host_initfn(obj);
42
- return;
43
- }
44
-
45
- /* '-cpu max' for TCG: we currently do this as "A57 with extra things" */
46
-
47
- aarch64_a57_initfn(obj);
48
-
49
/*
50
* Reset MIDR so the guest doesn't mistake our 'max' CPU type for a real
51
* one and try to apply errata workarounds or use impdef features we
52
@@ -XXX,XX +XXX,XX @@ static void aarch64_max_initfn(Object *obj)
53
qdev_property_add_static(DEVICE(obj), &arm_cpu_lpa2_property);
54
}
55
56
+static void aarch64_max_initfn(Object *obj)
26
+{
57
+{
27
+ TCGv_i32 tcg_op1;
58
+ if (kvm_enabled() || hvf_enabled()) {
28
+ TCGv_i32 tcg_op2;
59
+ /* With KVM or HVF, '-cpu max' is identical to '-cpu host' */
29
+ TCGv_i32 tcg_res;
60
+ aarch64_host_initfn(obj);
30
+ TCGv_ptr fpst;
61
+ return;
31
+
32
+ tcg_res = tcg_temp_new_i32();
33
+ fpst = get_fpstatus_ptr(true);
34
+ tcg_op1 = read_fp_hreg(s, rn);
35
+ tcg_op2 = read_fp_hreg(s, rm);
36
+
37
+ switch (opcode) {
38
+ case 0x0: /* FMUL */
39
+ gen_helper_advsimd_mulh(tcg_res, tcg_op1, tcg_op2, fpst);
40
+ break;
41
+ case 0x1: /* FDIV */
42
+ gen_helper_advsimd_divh(tcg_res, tcg_op1, tcg_op2, fpst);
43
+ break;
44
+ case 0x2: /* FADD */
45
+ gen_helper_advsimd_addh(tcg_res, tcg_op1, tcg_op2, fpst);
46
+ break;
47
+ case 0x3: /* FSUB */
48
+ gen_helper_advsimd_subh(tcg_res, tcg_op1, tcg_op2, fpst);
49
+ break;
50
+ case 0x4: /* FMAX */
51
+ gen_helper_advsimd_maxh(tcg_res, tcg_op1, tcg_op2, fpst);
52
+ break;
53
+ case 0x5: /* FMIN */
54
+ gen_helper_advsimd_minh(tcg_res, tcg_op1, tcg_op2, fpst);
55
+ break;
56
+ case 0x6: /* FMAXNM */
57
+ gen_helper_advsimd_maxnumh(tcg_res, tcg_op1, tcg_op2, fpst);
58
+ break;
59
+ case 0x7: /* FMINNM */
60
+ gen_helper_advsimd_minnumh(tcg_res, tcg_op1, tcg_op2, fpst);
61
+ break;
62
+ case 0x8: /* FNMUL */
63
+ gen_helper_advsimd_mulh(tcg_res, tcg_op1, tcg_op2, fpst);
64
+ tcg_gen_xori_i32(tcg_res, tcg_res, 0x8000);
65
+ break;
66
+ default:
67
+ g_assert_not_reached();
68
+ }
62
+ }
69
+
63
+
70
+ write_fp_sreg(s, rd, tcg_res);
64
+ /* '-cpu max' for TCG: we currently do this as "A57 with extra things" */
71
+
65
+
72
+ tcg_temp_free_ptr(fpst);
66
+ aarch64_a57_initfn(obj);
73
+ tcg_temp_free_i32(tcg_op1);
67
+ aarch64_max_tcg_initfn(obj);
74
+ tcg_temp_free_i32(tcg_op2);
75
+ tcg_temp_free_i32(tcg_res);
76
+}
68
+}
77
+
69
+
78
/* Floating point data-processing (2 source)
70
static const ARMCPUInfo aarch64_cpus[] = {
79
* 31 30 29 28 24 23 22 21 20 16 15 12 11 10 9 5 4 0
71
{ .name = "cortex-a35", .initfn = aarch64_a35_initfn },
80
* +---+---+---+-----------+------+---+------+--------+-----+------+------+
72
{ .name = "cortex-a57", .initfn = aarch64_a57_initfn },
81
@@ -XXX,XX +XXX,XX @@ static void disas_fp_2src(DisasContext *s, uint32_t insn)
82
}
83
handle_fp_2src_double(s, opcode, rd, rn, rm);
84
break;
85
+ case 3:
86
+ if (!arm_dc_feature(s, ARM_FEATURE_V8_FP16)) {
87
+ unallocated_encoding(s);
88
+ return;
89
+ }
90
+ if (!fp_access_check(s)) {
91
+ return;
92
+ }
93
+ handle_fp_2src_half(s, opcode, rd, rn, rm);
94
+ break;
95
default:
96
unallocated_encoding(s);
97
}
98
--
73
--
99
2.17.0
74
2.34.1
100
75
101
76
diff view generated by jsdifflib
1
From: Alex Bennée <alex.bennee@linaro.org>
1
From: Fabiano Rosas <farosas@suse.de>
2
2
3
These were missed out from the rest of the half-precision work.
3
We're about to move the TCG-only -cpu max configuration code under
4
CONFIG_TCG. To be able to do that we need to make sure the qtests
5
still have some cpu configured even when no other accelerator is
6
available.
4
7
5
Cc: qemu-stable@nongnu.org
8
Delineate now what is used with TCG-only and what is also used with
6
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
9
qtests to make the subsequent patches cleaner.
7
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
10
8
Tested-by: Alex Bennée <alex.bennee@linaro.org>
11
Signed-off-by: Fabiano Rosas <farosas@suse.de>
9
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
12
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
10
Message-id: 20180512003217.9105-10-richard.henderson@linaro.org
13
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
11
[rth: Fix erroneous check vs type]
14
Message-id: 20230426180013.14814-5-farosas@suse.de
12
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
13
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
15
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
14
---
16
---
15
target/arm/translate-a64.c | 31 +++++++++++++++++++++++++------
17
target/arm/cpu64.c | 12 +++++++++---
16
1 file changed, 25 insertions(+), 6 deletions(-)
18
1 file changed, 9 insertions(+), 3 deletions(-)
17
19
18
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
20
diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c
19
index XXXXXXX..XXXXXXX 100644
21
index XXXXXXX..XXXXXXX 100644
20
--- a/target/arm/translate-a64.c
22
--- a/target/arm/cpu64.c
21
+++ b/target/arm/translate-a64.c
23
+++ b/target/arm/cpu64.c
22
@@ -XXX,XX +XXX,XX @@ static void disas_fp_csel(DisasContext *s, uint32_t insn)
24
@@ -XXX,XX +XXX,XX @@
23
unsigned int mos, type, rm, cond, rn, rd;
25
#include "qemu/module.h"
24
TCGv_i64 t_true, t_false, t_zero;
26
#include "sysemu/kvm.h"
25
DisasCompare64 c;
27
#include "sysemu/hvf.h"
26
+ TCGMemOp sz;
28
+#include "sysemu/qtest.h"
27
29
+#include "sysemu/tcg.h"
28
mos = extract32(insn, 29, 3);
30
#include "kvm_arm.h"
29
- type = extract32(insn, 22, 2); /* 0 = single, 1 = double */
31
#include "hvf_arm.h"
30
+ type = extract32(insn, 22, 2);
32
#include "qapi/visitor.h"
31
rm = extract32(insn, 16, 5);
33
@@ -XXX,XX +XXX,XX @@ static void aarch64_max_initfn(Object *obj)
32
cond = extract32(insn, 12, 4);
33
rn = extract32(insn, 5, 5);
34
rd = extract32(insn, 0, 5);
35
36
- if (mos || type > 1) {
37
+ if (mos) {
38
+ unallocated_encoding(s);
39
+ return;
40
+ }
41
+
42
+ switch (type) {
43
+ case 0:
44
+ sz = MO_32;
45
+ break;
46
+ case 1:
47
+ sz = MO_64;
48
+ break;
49
+ case 3:
50
+ sz = MO_16;
51
+ if (arm_dc_feature(s, ARM_FEATURE_V8_FP16)) {
52
+ break;
53
+ }
54
+ /* fallthru */
55
+ default:
56
unallocated_encoding(s);
57
return;
34
return;
58
}
35
}
59
@@ -XXX,XX +XXX,XX @@ static void disas_fp_csel(DisasContext *s, uint32_t insn)
36
60
return;
37
- /* '-cpu max' for TCG: we currently do this as "A57 with extra things" */
61
}
38
+ if (tcg_enabled() || qtest_enabled()) {
62
39
+ aarch64_a57_initfn(obj);
63
- /* Zero extend sreg inputs to 64 bits now. */
40
+ }
64
+ /* Zero extend sreg & hreg inputs to 64 bits now. */
41
65
t_true = tcg_temp_new_i64();
42
- aarch64_a57_initfn(obj);
66
t_false = tcg_temp_new_i64();
43
- aarch64_max_tcg_initfn(obj);
67
- read_vec_element(s, t_true, rn, 0, type ? MO_64 : MO_32);
44
+ /* '-cpu max' for TCG: we currently do this as "A57 with extra things" */
68
- read_vec_element(s, t_false, rm, 0, type ? MO_64 : MO_32);
45
+ if (tcg_enabled()) {
69
+ read_vec_element(s, t_true, rn, 0, sz);
46
+ aarch64_max_tcg_initfn(obj);
70
+ read_vec_element(s, t_false, rm, 0, sz);
47
+ }
71
48
}
72
a64_test_cc(&c, cond);
49
73
t_zero = tcg_const_i64(0);
50
static const ARMCPUInfo aarch64_cpus[] = {
74
@@ -XXX,XX +XXX,XX @@ static void disas_fp_csel(DisasContext *s, uint32_t insn)
75
tcg_temp_free_i64(t_false);
76
a64_free_cc(&c);
77
78
- /* Note that sregs write back zeros to the high bits,
79
+ /* Note that sregs & hregs write back zeros to the high bits,
80
and we've already done the zero-extension. */
81
write_fp_dreg(s, rd, t_true);
82
tcg_temp_free_i64(t_true);
83
--
51
--
84
2.17.0
52
2.34.1
85
53
86
54
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
From: Fabiano Rosas <farosas@suse.de>
2
2
3
Adding the fp16 moves to/from general registers.
3
Move the 64-bit CPUs that are TCG-only:
4
- cortex-a35
5
- cortex-a55
6
- cortex-a72
7
- cortex-a76
8
- a64fx
9
- neoverse-n1
4
10
5
Cc: qemu-stable@nongnu.org
11
Keep the CPUs that can be used with KVM:
6
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
12
- cortex-a57
7
Tested-by: Alex Bennée <alex.bennee@linaro.org>
13
- cortex-a53
8
Message-id: 20180512003217.9105-2-richard.henderson@linaro.org
14
- max
9
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
15
- host
16
17
Signed-off-by: Fabiano Rosas <farosas@suse.de>
18
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
19
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
20
Message-id: 20230426180013.14814-6-farosas@suse.de
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
21
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
---
22
---
12
target/arm/translate-a64.c | 21 +++++++++++++++++++++
23
target/arm/internals.h | 4 +
13
1 file changed, 21 insertions(+)
24
hw/arm/virt.c | 6 +-
25
target/arm/cpu64.c | 687 +-----------------------------
26
target/arm/{ => tcg}/cpu64.c | 782 +----------------------------------
27
target/arm/tcg/meson.build | 1 +
28
5 files changed, 14 insertions(+), 1466 deletions(-)
29
copy target/arm/{ => tcg}/cpu64.c (51%)
14
30
15
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
31
diff --git a/target/arm/internals.h b/target/arm/internals.h
16
index XXXXXXX..XXXXXXX 100644
32
index XXXXXXX..XXXXXXX 100644
17
--- a/target/arm/translate-a64.c
33
--- a/target/arm/internals.h
18
+++ b/target/arm/translate-a64.c
34
+++ b/target/arm/internals.h
19
@@ -XXX,XX +XXX,XX @@ static void handle_fmov(DisasContext *s, int rd, int rn, int type, bool itof)
35
@@ -XXX,XX +XXX,XX @@ void arm_cpu_sve_finalize(ARMCPU *cpu, Error **errp);
20
tcg_gen_st_i64(tcg_rn, cpu_env, fp_reg_hi_offset(s, rd));
36
void arm_cpu_sme_finalize(ARMCPU *cpu, Error **errp);
21
clear_vec_high(s, true, rd);
37
void arm_cpu_pauth_finalize(ARMCPU *cpu, Error **errp);
22
break;
38
void arm_cpu_lpa2_finalize(ARMCPU *cpu, Error **errp);
23
+ case 3:
39
+void aarch64_max_tcg_initfn(Object *obj);
24
+ /* 16 bit */
40
+void aarch64_add_pauth_properties(Object *obj);
25
+ tmp = tcg_temp_new_i64();
41
+void aarch64_add_sve_properties(Object *obj);
26
+ tcg_gen_ext16u_i64(tmp, tcg_rn);
42
+void aarch64_add_sme_properties(Object *obj);
27
+ write_fp_dreg(s, rd, tmp);
43
#endif
28
+ tcg_temp_free_i64(tmp);
44
29
+ break;
45
/* Read the CONTROL register as the MRS instruction would. */
30
+ default:
46
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
31
+ g_assert_not_reached();
47
index XXXXXXX..XXXXXXX 100644
32
}
48
--- a/hw/arm/virt.c
33
} else {
49
+++ b/hw/arm/virt.c
34
TCGv_i64 tcg_rd = cpu_reg(s, rd);
50
@@ -XXX,XX +XXX,XX @@ static const char *valid_cpus[] = {
35
@@ -XXX,XX +XXX,XX @@ static void handle_fmov(DisasContext *s, int rd, int rn, int type, bool itof)
51
ARM_CPU_TYPE_NAME("cortex-a7"),
36
/* 64 bits from top half */
52
#endif
37
tcg_gen_ld_i64(tcg_rd, cpu_env, fp_reg_hi_offset(s, rn));
53
ARM_CPU_TYPE_NAME("cortex-a15"),
38
break;
54
+#ifdef CONFIG_TCG
39
+ case 3:
55
ARM_CPU_TYPE_NAME("cortex-a35"),
40
+ /* 16 bit */
56
- ARM_CPU_TYPE_NAME("cortex-a53"),
41
+ tcg_gen_ld16u_i64(tcg_rd, cpu_env, fp_reg_offset(s, rn, MO_16));
57
ARM_CPU_TYPE_NAME("cortex-a55"),
42
+ break;
58
- ARM_CPU_TYPE_NAME("cortex-a57"),
43
+ default:
59
ARM_CPU_TYPE_NAME("cortex-a72"),
44
+ g_assert_not_reached();
60
ARM_CPU_TYPE_NAME("cortex-a76"),
45
}
61
ARM_CPU_TYPE_NAME("a64fx"),
62
ARM_CPU_TYPE_NAME("neoverse-n1"),
63
+#endif
64
+ ARM_CPU_TYPE_NAME("cortex-a53"),
65
+ ARM_CPU_TYPE_NAME("cortex-a57"),
66
ARM_CPU_TYPE_NAME("host"),
67
ARM_CPU_TYPE_NAME("max"),
68
};
69
diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c
70
index XXXXXXX..XXXXXXX 100644
71
--- a/target/arm/cpu64.c
72
+++ b/target/arm/cpu64.c
73
@@ -XXX,XX +XXX,XX @@
74
#include "internals.h"
75
#include "cpregs.h"
76
77
-static void aarch64_a35_initfn(Object *obj)
78
-{
79
- ARMCPU *cpu = ARM_CPU(obj);
80
-
81
- cpu->dtb_compatible = "arm,cortex-a35";
82
- set_feature(&cpu->env, ARM_FEATURE_V8);
83
- set_feature(&cpu->env, ARM_FEATURE_NEON);
84
- set_feature(&cpu->env, ARM_FEATURE_GENERIC_TIMER);
85
- set_feature(&cpu->env, ARM_FEATURE_AARCH64);
86
- set_feature(&cpu->env, ARM_FEATURE_CBAR_RO);
87
- set_feature(&cpu->env, ARM_FEATURE_EL2);
88
- set_feature(&cpu->env, ARM_FEATURE_EL3);
89
- set_feature(&cpu->env, ARM_FEATURE_PMU);
90
-
91
- /* From B2.2 AArch64 identification registers. */
92
- cpu->midr = 0x411fd040;
93
- cpu->revidr = 0;
94
- cpu->ctr = 0x84448004;
95
- cpu->isar.id_pfr0 = 0x00000131;
96
- cpu->isar.id_pfr1 = 0x00011011;
97
- cpu->isar.id_dfr0 = 0x03010066;
98
- cpu->id_afr0 = 0;
99
- cpu->isar.id_mmfr0 = 0x10201105;
100
- cpu->isar.id_mmfr1 = 0x40000000;
101
- cpu->isar.id_mmfr2 = 0x01260000;
102
- cpu->isar.id_mmfr3 = 0x02102211;
103
- cpu->isar.id_isar0 = 0x02101110;
104
- cpu->isar.id_isar1 = 0x13112111;
105
- cpu->isar.id_isar2 = 0x21232042;
106
- cpu->isar.id_isar3 = 0x01112131;
107
- cpu->isar.id_isar4 = 0x00011142;
108
- cpu->isar.id_isar5 = 0x00011121;
109
- cpu->isar.id_aa64pfr0 = 0x00002222;
110
- cpu->isar.id_aa64pfr1 = 0;
111
- cpu->isar.id_aa64dfr0 = 0x10305106;
112
- cpu->isar.id_aa64dfr1 = 0;
113
- cpu->isar.id_aa64isar0 = 0x00011120;
114
- cpu->isar.id_aa64isar1 = 0;
115
- cpu->isar.id_aa64mmfr0 = 0x00101122;
116
- cpu->isar.id_aa64mmfr1 = 0;
117
- cpu->clidr = 0x0a200023;
118
- cpu->dcz_blocksize = 4;
119
-
120
- /* From B2.4 AArch64 Virtual Memory control registers */
121
- cpu->reset_sctlr = 0x00c50838;
122
-
123
- /* From B2.10 AArch64 performance monitor registers */
124
- cpu->isar.reset_pmcr_el0 = 0x410a3000;
125
-
126
- /* From B2.29 Cache ID registers */
127
- cpu->ccsidr[0] = 0x700fe01a; /* 32KB L1 dcache */
128
- cpu->ccsidr[1] = 0x201fe00a; /* 32KB L1 icache */
129
- cpu->ccsidr[2] = 0x703fe03a; /* 512KB L2 cache */
130
-
131
- /* From B3.5 VGIC Type register */
132
- cpu->gic_num_lrs = 4;
133
- cpu->gic_vpribits = 5;
134
- cpu->gic_vprebits = 5;
135
- cpu->gic_pribits = 5;
136
-
137
- /* From C6.4 Debug ID Register */
138
- cpu->isar.dbgdidr = 0x3516d000;
139
- /* From C6.5 Debug Device ID Register */
140
- cpu->isar.dbgdevid = 0x00110f13;
141
- /* From C6.6 Debug Device ID Register 1 */
142
- cpu->isar.dbgdevid1 = 0x2;
143
-
144
- /* From Cortex-A35 SIMD and Floating-point Support r1p0 */
145
- /* From 3.2 AArch32 register summary */
146
- cpu->reset_fpsid = 0x41034043;
147
-
148
- /* From 2.2 AArch64 register summary */
149
- cpu->isar.mvfr0 = 0x10110222;
150
- cpu->isar.mvfr1 = 0x12111111;
151
- cpu->isar.mvfr2 = 0x00000043;
152
-
153
- /* These values are the same with A53/A57/A72. */
154
- define_cortex_a72_a57_a53_cp_reginfo(cpu);
155
-}
156
-
157
void arm_cpu_sve_finalize(ARMCPU *cpu, Error **errp)
158
{
159
/*
160
@@ -XXX,XX +XXX,XX @@ void arm_cpu_sve_finalize(ARMCPU *cpu, Error **errp)
161
cpu->sve_vq.map = vq_map;
162
}
163
164
-static void cpu_max_get_sve_max_vq(Object *obj, Visitor *v, const char *name,
165
- void *opaque, Error **errp)
166
-{
167
- ARMCPU *cpu = ARM_CPU(obj);
168
- uint32_t value;
169
-
170
- /* All vector lengths are disabled when SVE is off. */
171
- if (!cpu_isar_feature(aa64_sve, cpu)) {
172
- value = 0;
173
- } else {
174
- value = cpu->sve_max_vq;
175
- }
176
- visit_type_uint32(v, name, &value, errp);
177
-}
178
-
179
-static void cpu_max_set_sve_max_vq(Object *obj, Visitor *v, const char *name,
180
- void *opaque, Error **errp)
181
-{
182
- ARMCPU *cpu = ARM_CPU(obj);
183
- uint32_t max_vq;
184
-
185
- if (!visit_type_uint32(v, name, &max_vq, errp)) {
186
- return;
187
- }
188
-
189
- if (max_vq == 0 || max_vq > ARM_MAX_VQ) {
190
- error_setg(errp, "unsupported SVE vector length");
191
- error_append_hint(errp, "Valid sve-max-vq in range [1-%d]\n",
192
- ARM_MAX_VQ);
193
- return;
194
- }
195
-
196
- cpu->sve_max_vq = max_vq;
197
-}
198
-
199
/*
200
* Note that cpu_arm_{get,set}_vq cannot use the simpler
201
* object_property_add_bool interface because they make use of the
202
@@ -XXX,XX +XXX,XX @@ static void cpu_arm_get_default_vec_len(Object *obj, Visitor *v,
203
}
204
#endif
205
206
-static void aarch64_add_sve_properties(Object *obj)
207
+void aarch64_add_sve_properties(Object *obj)
208
{
209
ARMCPU *cpu = ARM_CPU(obj);
210
uint32_t vq;
211
@@ -XXX,XX +XXX,XX @@ static void aarch64_add_sve_properties(Object *obj)
212
#endif
213
}
214
215
-static void aarch64_add_sme_properties(Object *obj)
216
+void aarch64_add_sme_properties(Object *obj)
217
{
218
ARMCPU *cpu = ARM_CPU(obj);
219
uint32_t vq;
220
@@ -XXX,XX +XXX,XX @@ static Property arm_cpu_pauth_property =
221
static Property arm_cpu_pauth_impdef_property =
222
DEFINE_PROP_BOOL("pauth-impdef", ARMCPU, prop_pauth_impdef, false);
223
224
-static void aarch64_add_pauth_properties(Object *obj)
225
+void aarch64_add_pauth_properties(Object *obj)
226
{
227
ARMCPU *cpu = ARM_CPU(obj);
228
229
@@ -XXX,XX +XXX,XX @@ static void aarch64_add_pauth_properties(Object *obj)
46
}
230
}
47
}
231
}
48
@@ -XXX,XX +XXX,XX @@ static void disas_fp_int_conv(DisasContext *s, uint32_t insn)
232
49
case 0xa: /* 64 bit */
233
-static Property arm_cpu_lpa2_property =
50
case 0xd: /* 64 bit to top half of quad */
234
- DEFINE_PROP_BOOL("lpa2", ARMCPU, prop_lpa2, true);
51
break;
235
-
52
+ case 0x6: /* 16-bit float, 32-bit int */
236
void arm_cpu_lpa2_finalize(ARMCPU *cpu, Error **errp)
53
+ case 0xe: /* 16-bit float, 64-bit int */
237
{
54
+ if (arm_dc_feature(s, ARM_FEATURE_V8_FP16)) {
238
uint64_t t;
55
+ break;
239
@@ -XXX,XX +XXX,XX @@ static void aarch64_a53_initfn(Object *obj)
56
+ }
240
define_cortex_a72_a57_a53_cp_reginfo(cpu);
57
+ /* fallthru */
241
}
58
default:
242
59
/* all other sf/type/rmode combinations are invalid */
243
-static void aarch64_a55_initfn(Object *obj)
60
unallocated_encoding(s);
244
-{
245
- ARMCPU *cpu = ARM_CPU(obj);
246
-
247
- cpu->dtb_compatible = "arm,cortex-a55";
248
- set_feature(&cpu->env, ARM_FEATURE_V8);
249
- set_feature(&cpu->env, ARM_FEATURE_NEON);
250
- set_feature(&cpu->env, ARM_FEATURE_GENERIC_TIMER);
251
- set_feature(&cpu->env, ARM_FEATURE_AARCH64);
252
- set_feature(&cpu->env, ARM_FEATURE_CBAR_RO);
253
- set_feature(&cpu->env, ARM_FEATURE_EL2);
254
- set_feature(&cpu->env, ARM_FEATURE_EL3);
255
- set_feature(&cpu->env, ARM_FEATURE_PMU);
256
-
257
- /* Ordered by B2.4 AArch64 registers by functional group */
258
- cpu->clidr = 0x82000023;
259
- cpu->ctr = 0x84448004; /* L1Ip = VIPT */
260
- cpu->dcz_blocksize = 4; /* 64 bytes */
261
- cpu->isar.id_aa64dfr0 = 0x0000000010305408ull;
262
- cpu->isar.id_aa64isar0 = 0x0000100010211120ull;
263
- cpu->isar.id_aa64isar1 = 0x0000000000100001ull;
264
- cpu->isar.id_aa64mmfr0 = 0x0000000000101122ull;
265
- cpu->isar.id_aa64mmfr1 = 0x0000000010212122ull;
266
- cpu->isar.id_aa64mmfr2 = 0x0000000000001011ull;
267
- cpu->isar.id_aa64pfr0 = 0x0000000010112222ull;
268
- cpu->isar.id_aa64pfr1 = 0x0000000000000010ull;
269
- cpu->id_afr0 = 0x00000000;
270
- cpu->isar.id_dfr0 = 0x04010088;
271
- cpu->isar.id_isar0 = 0x02101110;
272
- cpu->isar.id_isar1 = 0x13112111;
273
- cpu->isar.id_isar2 = 0x21232042;
274
- cpu->isar.id_isar3 = 0x01112131;
275
- cpu->isar.id_isar4 = 0x00011142;
276
- cpu->isar.id_isar5 = 0x01011121;
277
- cpu->isar.id_isar6 = 0x00000010;
278
- cpu->isar.id_mmfr0 = 0x10201105;
279
- cpu->isar.id_mmfr1 = 0x40000000;
280
- cpu->isar.id_mmfr2 = 0x01260000;
281
- cpu->isar.id_mmfr3 = 0x02122211;
282
- cpu->isar.id_mmfr4 = 0x00021110;
283
- cpu->isar.id_pfr0 = 0x10010131;
284
- cpu->isar.id_pfr1 = 0x00011011;
285
- cpu->isar.id_pfr2 = 0x00000011;
286
- cpu->midr = 0x412FD050; /* r2p0 */
287
- cpu->revidr = 0;
288
-
289
- /* From B2.23 CCSIDR_EL1 */
290
- cpu->ccsidr[0] = 0x700fe01a; /* 32KB L1 dcache */
291
- cpu->ccsidr[1] = 0x200fe01a; /* 32KB L1 icache */
292
- cpu->ccsidr[2] = 0x703fe07a; /* 512KB L2 cache */
293
-
294
- /* From B2.96 SCTLR_EL3 */
295
- cpu->reset_sctlr = 0x30c50838;
296
-
297
- /* From B4.45 ICH_VTR_EL2 */
298
- cpu->gic_num_lrs = 4;
299
- cpu->gic_vpribits = 5;
300
- cpu->gic_vprebits = 5;
301
- cpu->gic_pribits = 5;
302
-
303
- cpu->isar.mvfr0 = 0x10110222;
304
- cpu->isar.mvfr1 = 0x13211111;
305
- cpu->isar.mvfr2 = 0x00000043;
306
-
307
- /* From D5.4 AArch64 PMU register summary */
308
- cpu->isar.reset_pmcr_el0 = 0x410b3000;
309
-}
310
-
311
-static void aarch64_a72_initfn(Object *obj)
312
-{
313
- ARMCPU *cpu = ARM_CPU(obj);
314
-
315
- cpu->dtb_compatible = "arm,cortex-a72";
316
- set_feature(&cpu->env, ARM_FEATURE_V8);
317
- set_feature(&cpu->env, ARM_FEATURE_NEON);
318
- set_feature(&cpu->env, ARM_FEATURE_GENERIC_TIMER);
319
- set_feature(&cpu->env, ARM_FEATURE_AARCH64);
320
- set_feature(&cpu->env, ARM_FEATURE_CBAR_RO);
321
- set_feature(&cpu->env, ARM_FEATURE_EL2);
322
- set_feature(&cpu->env, ARM_FEATURE_EL3);
323
- set_feature(&cpu->env, ARM_FEATURE_PMU);
324
- cpu->midr = 0x410fd083;
325
- cpu->revidr = 0x00000000;
326
- cpu->reset_fpsid = 0x41034080;
327
- cpu->isar.mvfr0 = 0x10110222;
328
- cpu->isar.mvfr1 = 0x12111111;
329
- cpu->isar.mvfr2 = 0x00000043;
330
- cpu->ctr = 0x8444c004;
331
- cpu->reset_sctlr = 0x00c50838;
332
- cpu->isar.id_pfr0 = 0x00000131;
333
- cpu->isar.id_pfr1 = 0x00011011;
334
- cpu->isar.id_dfr0 = 0x03010066;
335
- cpu->id_afr0 = 0x00000000;
336
- cpu->isar.id_mmfr0 = 0x10201105;
337
- cpu->isar.id_mmfr1 = 0x40000000;
338
- cpu->isar.id_mmfr2 = 0x01260000;
339
- cpu->isar.id_mmfr3 = 0x02102211;
340
- cpu->isar.id_isar0 = 0x02101110;
341
- cpu->isar.id_isar1 = 0x13112111;
342
- cpu->isar.id_isar2 = 0x21232042;
343
- cpu->isar.id_isar3 = 0x01112131;
344
- cpu->isar.id_isar4 = 0x00011142;
345
- cpu->isar.id_isar5 = 0x00011121;
346
- cpu->isar.id_aa64pfr0 = 0x00002222;
347
- cpu->isar.id_aa64dfr0 = 0x10305106;
348
- cpu->isar.id_aa64isar0 = 0x00011120;
349
- cpu->isar.id_aa64mmfr0 = 0x00001124;
350
- cpu->isar.dbgdidr = 0x3516d000;
351
- cpu->isar.dbgdevid = 0x01110f13;
352
- cpu->isar.dbgdevid1 = 0x2;
353
- cpu->isar.reset_pmcr_el0 = 0x41023000;
354
- cpu->clidr = 0x0a200023;
355
- cpu->ccsidr[0] = 0x701fe00a; /* 32KB L1 dcache */
356
- cpu->ccsidr[1] = 0x201fe012; /* 48KB L1 icache */
357
- cpu->ccsidr[2] = 0x707fe07a; /* 1MB L2 cache */
358
- cpu->dcz_blocksize = 4; /* 64 bytes */
359
- cpu->gic_num_lrs = 4;
360
- cpu->gic_vpribits = 5;
361
- cpu->gic_vprebits = 5;
362
- cpu->gic_pribits = 5;
363
- define_cortex_a72_a57_a53_cp_reginfo(cpu);
364
-}
365
-
366
-static void aarch64_a76_initfn(Object *obj)
367
-{
368
- ARMCPU *cpu = ARM_CPU(obj);
369
-
370
- cpu->dtb_compatible = "arm,cortex-a76";
371
- set_feature(&cpu->env, ARM_FEATURE_V8);
372
- set_feature(&cpu->env, ARM_FEATURE_NEON);
373
- set_feature(&cpu->env, ARM_FEATURE_GENERIC_TIMER);
374
- set_feature(&cpu->env, ARM_FEATURE_AARCH64);
375
- set_feature(&cpu->env, ARM_FEATURE_CBAR_RO);
376
- set_feature(&cpu->env, ARM_FEATURE_EL2);
377
- set_feature(&cpu->env, ARM_FEATURE_EL3);
378
- set_feature(&cpu->env, ARM_FEATURE_PMU);
379
-
380
- /* Ordered by B2.4 AArch64 registers by functional group */
381
- cpu->clidr = 0x82000023;
382
- cpu->ctr = 0x8444C004;
383
- cpu->dcz_blocksize = 4;
384
- cpu->isar.id_aa64dfr0 = 0x0000000010305408ull;
385
- cpu->isar.id_aa64isar0 = 0x0000100010211120ull;
386
- cpu->isar.id_aa64isar1 = 0x0000000000100001ull;
387
- cpu->isar.id_aa64mmfr0 = 0x0000000000101122ull;
388
- cpu->isar.id_aa64mmfr1 = 0x0000000010212122ull;
389
- cpu->isar.id_aa64mmfr2 = 0x0000000000001011ull;
390
- cpu->isar.id_aa64pfr0 = 0x1100000010111112ull; /* GIC filled in later */
391
- cpu->isar.id_aa64pfr1 = 0x0000000000000010ull;
392
- cpu->id_afr0 = 0x00000000;
393
- cpu->isar.id_dfr0 = 0x04010088;
394
- cpu->isar.id_isar0 = 0x02101110;
395
- cpu->isar.id_isar1 = 0x13112111;
396
- cpu->isar.id_isar2 = 0x21232042;
397
- cpu->isar.id_isar3 = 0x01112131;
398
- cpu->isar.id_isar4 = 0x00010142;
399
- cpu->isar.id_isar5 = 0x01011121;
400
- cpu->isar.id_isar6 = 0x00000010;
401
- cpu->isar.id_mmfr0 = 0x10201105;
402
- cpu->isar.id_mmfr1 = 0x40000000;
403
- cpu->isar.id_mmfr2 = 0x01260000;
404
- cpu->isar.id_mmfr3 = 0x02122211;
405
- cpu->isar.id_mmfr4 = 0x00021110;
406
- cpu->isar.id_pfr0 = 0x10010131;
407
- cpu->isar.id_pfr1 = 0x00010000; /* GIC filled in later */
408
- cpu->isar.id_pfr2 = 0x00000011;
409
- cpu->midr = 0x414fd0b1; /* r4p1 */
410
- cpu->revidr = 0;
411
-
412
- /* From B2.18 CCSIDR_EL1 */
413
- cpu->ccsidr[0] = 0x701fe01a; /* 64KB L1 dcache */
414
- cpu->ccsidr[1] = 0x201fe01a; /* 64KB L1 icache */
415
- cpu->ccsidr[2] = 0x707fe03a; /* 512KB L2 cache */
416
-
417
- /* From B2.93 SCTLR_EL3 */
418
- cpu->reset_sctlr = 0x30c50838;
419
-
420
- /* From B4.23 ICH_VTR_EL2 */
421
- cpu->gic_num_lrs = 4;
422
- cpu->gic_vpribits = 5;
423
- cpu->gic_vprebits = 5;
424
- cpu->gic_pribits = 5;
425
-
426
- /* From B5.1 AdvSIMD AArch64 register summary */
427
- cpu->isar.mvfr0 = 0x10110222;
428
- cpu->isar.mvfr1 = 0x13211111;
429
- cpu->isar.mvfr2 = 0x00000043;
430
-
431
- /* From D5.1 AArch64 PMU register summary */
432
- cpu->isar.reset_pmcr_el0 = 0x410b3000;
433
-}
434
-
435
-static void aarch64_a64fx_initfn(Object *obj)
436
-{
437
- ARMCPU *cpu = ARM_CPU(obj);
438
-
439
- cpu->dtb_compatible = "arm,a64fx";
440
- set_feature(&cpu->env, ARM_FEATURE_V8);
441
- set_feature(&cpu->env, ARM_FEATURE_NEON);
442
- set_feature(&cpu->env, ARM_FEATURE_GENERIC_TIMER);
443
- set_feature(&cpu->env, ARM_FEATURE_AARCH64);
444
- set_feature(&cpu->env, ARM_FEATURE_EL2);
445
- set_feature(&cpu->env, ARM_FEATURE_EL3);
446
- set_feature(&cpu->env, ARM_FEATURE_PMU);
447
- cpu->midr = 0x461f0010;
448
- cpu->revidr = 0x00000000;
449
- cpu->ctr = 0x86668006;
450
- cpu->reset_sctlr = 0x30000180;
451
- cpu->isar.id_aa64pfr0 = 0x0000000101111111; /* No RAS Extensions */
452
- cpu->isar.id_aa64pfr1 = 0x0000000000000000;
453
- cpu->isar.id_aa64dfr0 = 0x0000000010305408;
454
- cpu->isar.id_aa64dfr1 = 0x0000000000000000;
455
- cpu->id_aa64afr0 = 0x0000000000000000;
456
- cpu->id_aa64afr1 = 0x0000000000000000;
457
- cpu->isar.id_aa64mmfr0 = 0x0000000000001122;
458
- cpu->isar.id_aa64mmfr1 = 0x0000000011212100;
459
- cpu->isar.id_aa64mmfr2 = 0x0000000000001011;
460
- cpu->isar.id_aa64isar0 = 0x0000000010211120;
461
- cpu->isar.id_aa64isar1 = 0x0000000000010001;
462
- cpu->isar.id_aa64zfr0 = 0x0000000000000000;
463
- cpu->clidr = 0x0000000080000023;
464
- cpu->ccsidr[0] = 0x7007e01c; /* 64KB L1 dcache */
465
- cpu->ccsidr[1] = 0x2007e01c; /* 64KB L1 icache */
466
- cpu->ccsidr[2] = 0x70ffe07c; /* 8MB L2 cache */
467
- cpu->dcz_blocksize = 6; /* 256 bytes */
468
- cpu->gic_num_lrs = 4;
469
- cpu->gic_vpribits = 5;
470
- cpu->gic_vprebits = 5;
471
- cpu->gic_pribits = 5;
472
-
473
- /* The A64FX supports only 128, 256 and 512 bit vector lengths */
474
- aarch64_add_sve_properties(obj);
475
- cpu->sve_vq.supported = (1 << 0) /* 128bit */
476
- | (1 << 1) /* 256bit */
477
- | (1 << 3); /* 512bit */
478
-
479
- cpu->isar.reset_pmcr_el0 = 0x46014040;
480
-
481
- /* TODO: Add A64FX specific HPC extension registers */
482
-}
483
-
484
-static const ARMCPRegInfo neoverse_n1_cp_reginfo[] = {
485
- { .name = "ATCR_EL1", .state = ARM_CP_STATE_AA64,
486
- .opc0 = 3, .opc1 = 0, .crn = 15, .crm = 7, .opc2 = 0,
487
- .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 },
488
- { .name = "ATCR_EL2", .state = ARM_CP_STATE_AA64,
489
- .opc0 = 3, .opc1 = 4, .crn = 15, .crm = 7, .opc2 = 0,
490
- .access = PL2_RW, .type = ARM_CP_CONST, .resetvalue = 0 },
491
- { .name = "ATCR_EL3", .state = ARM_CP_STATE_AA64,
492
- .opc0 = 3, .opc1 = 6, .crn = 15, .crm = 7, .opc2 = 0,
493
- .access = PL3_RW, .type = ARM_CP_CONST, .resetvalue = 0 },
494
- { .name = "ATCR_EL12", .state = ARM_CP_STATE_AA64,
495
- .opc0 = 3, .opc1 = 5, .crn = 15, .crm = 7, .opc2 = 0,
496
- .access = PL2_RW, .type = ARM_CP_CONST, .resetvalue = 0 },
497
- { .name = "AVTCR_EL2", .state = ARM_CP_STATE_AA64,
498
- .opc0 = 3, .opc1 = 4, .crn = 15, .crm = 7, .opc2 = 1,
499
- .access = PL2_RW, .type = ARM_CP_CONST, .resetvalue = 0 },
500
- { .name = "CPUACTLR_EL1", .state = ARM_CP_STATE_AA64,
501
- .opc0 = 3, .opc1 = 0, .crn = 15, .crm = 1, .opc2 = 0,
502
- .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 },
503
- { .name = "CPUACTLR2_EL1", .state = ARM_CP_STATE_AA64,
504
- .opc0 = 3, .opc1 = 0, .crn = 15, .crm = 1, .opc2 = 1,
505
- .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 },
506
- { .name = "CPUACTLR3_EL1", .state = ARM_CP_STATE_AA64,
507
- .opc0 = 3, .opc1 = 0, .crn = 15, .crm = 1, .opc2 = 2,
508
- .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 },
509
- /*
510
- * Report CPUCFR_EL1.SCU as 1, as we do not implement the DSU
511
- * (and in particular its system registers).
512
- */
513
- { .name = "CPUCFR_EL1", .state = ARM_CP_STATE_AA64,
514
- .opc0 = 3, .opc1 = 0, .crn = 15, .crm = 0, .opc2 = 0,
515
- .access = PL1_R, .type = ARM_CP_CONST, .resetvalue = 4 },
516
- { .name = "CPUECTLR_EL1", .state = ARM_CP_STATE_AA64,
517
- .opc0 = 3, .opc1 = 0, .crn = 15, .crm = 1, .opc2 = 4,
518
- .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0x961563010 },
519
- { .name = "CPUPCR_EL3", .state = ARM_CP_STATE_AA64,
520
- .opc0 = 3, .opc1 = 6, .crn = 15, .crm = 8, .opc2 = 1,
521
- .access = PL3_RW, .type = ARM_CP_CONST, .resetvalue = 0 },
522
- { .name = "CPUPMR_EL3", .state = ARM_CP_STATE_AA64,
523
- .opc0 = 3, .opc1 = 6, .crn = 15, .crm = 8, .opc2 = 3,
524
- .access = PL3_RW, .type = ARM_CP_CONST, .resetvalue = 0 },
525
- { .name = "CPUPOR_EL3", .state = ARM_CP_STATE_AA64,
526
- .opc0 = 3, .opc1 = 6, .crn = 15, .crm = 8, .opc2 = 2,
527
- .access = PL3_RW, .type = ARM_CP_CONST, .resetvalue = 0 },
528
- { .name = "CPUPSELR_EL3", .state = ARM_CP_STATE_AA64,
529
- .opc0 = 3, .opc1 = 6, .crn = 15, .crm = 8, .opc2 = 0,
530
- .access = PL3_RW, .type = ARM_CP_CONST, .resetvalue = 0 },
531
- { .name = "CPUPWRCTLR_EL1", .state = ARM_CP_STATE_AA64,
532
- .opc0 = 3, .opc1 = 0, .crn = 15, .crm = 2, .opc2 = 7,
533
- .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 },
534
- { .name = "ERXPFGCDN_EL1", .state = ARM_CP_STATE_AA64,
535
- .opc0 = 3, .opc1 = 0, .crn = 15, .crm = 2, .opc2 = 2,
536
- .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 },
537
- { .name = "ERXPFGCTL_EL1", .state = ARM_CP_STATE_AA64,
538
- .opc0 = 3, .opc1 = 0, .crn = 15, .crm = 2, .opc2 = 1,
539
- .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 },
540
- { .name = "ERXPFGF_EL1", .state = ARM_CP_STATE_AA64,
541
- .opc0 = 3, .opc1 = 0, .crn = 15, .crm = 2, .opc2 = 0,
542
- .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 },
543
-};
544
-
545
-static void define_neoverse_n1_cp_reginfo(ARMCPU *cpu)
546
-{
547
- define_arm_cp_regs(cpu, neoverse_n1_cp_reginfo);
548
-}
549
-
550
-static void aarch64_neoverse_n1_initfn(Object *obj)
551
-{
552
- ARMCPU *cpu = ARM_CPU(obj);
553
-
554
- cpu->dtb_compatible = "arm,neoverse-n1";
555
- set_feature(&cpu->env, ARM_FEATURE_V8);
556
- set_feature(&cpu->env, ARM_FEATURE_NEON);
557
- set_feature(&cpu->env, ARM_FEATURE_GENERIC_TIMER);
558
- set_feature(&cpu->env, ARM_FEATURE_AARCH64);
559
- set_feature(&cpu->env, ARM_FEATURE_CBAR_RO);
560
- set_feature(&cpu->env, ARM_FEATURE_EL2);
561
- set_feature(&cpu->env, ARM_FEATURE_EL3);
562
- set_feature(&cpu->env, ARM_FEATURE_PMU);
563
-
564
- /* Ordered by B2.4 AArch64 registers by functional group */
565
- cpu->clidr = 0x82000023;
566
- cpu->ctr = 0x8444c004;
567
- cpu->dcz_blocksize = 4;
568
- cpu->isar.id_aa64dfr0 = 0x0000000110305408ull;
569
- cpu->isar.id_aa64isar0 = 0x0000100010211120ull;
570
- cpu->isar.id_aa64isar1 = 0x0000000000100001ull;
571
- cpu->isar.id_aa64mmfr0 = 0x0000000000101125ull;
572
- cpu->isar.id_aa64mmfr1 = 0x0000000010212122ull;
573
- cpu->isar.id_aa64mmfr2 = 0x0000000000001011ull;
574
- cpu->isar.id_aa64pfr0 = 0x1100000010111112ull; /* GIC filled in later */
575
- cpu->isar.id_aa64pfr1 = 0x0000000000000020ull;
576
- cpu->id_afr0 = 0x00000000;
577
- cpu->isar.id_dfr0 = 0x04010088;
578
- cpu->isar.id_isar0 = 0x02101110;
579
- cpu->isar.id_isar1 = 0x13112111;
580
- cpu->isar.id_isar2 = 0x21232042;
581
- cpu->isar.id_isar3 = 0x01112131;
582
- cpu->isar.id_isar4 = 0x00010142;
583
- cpu->isar.id_isar5 = 0x01011121;
584
- cpu->isar.id_isar6 = 0x00000010;
585
- cpu->isar.id_mmfr0 = 0x10201105;
586
- cpu->isar.id_mmfr1 = 0x40000000;
587
- cpu->isar.id_mmfr2 = 0x01260000;
588
- cpu->isar.id_mmfr3 = 0x02122211;
589
- cpu->isar.id_mmfr4 = 0x00021110;
590
- cpu->isar.id_pfr0 = 0x10010131;
591
- cpu->isar.id_pfr1 = 0x00010000; /* GIC filled in later */
592
- cpu->isar.id_pfr2 = 0x00000011;
593
- cpu->midr = 0x414fd0c1; /* r4p1 */
594
- cpu->revidr = 0;
595
-
596
- /* From B2.23 CCSIDR_EL1 */
597
- cpu->ccsidr[0] = 0x701fe01a; /* 64KB L1 dcache */
598
- cpu->ccsidr[1] = 0x201fe01a; /* 64KB L1 icache */
599
- cpu->ccsidr[2] = 0x70ffe03a; /* 1MB L2 cache */
600
-
601
- /* From B2.98 SCTLR_EL3 */
602
- cpu->reset_sctlr = 0x30c50838;
603
-
604
- /* From B4.23 ICH_VTR_EL2 */
605
- cpu->gic_num_lrs = 4;
606
- cpu->gic_vpribits = 5;
607
- cpu->gic_vprebits = 5;
608
- cpu->gic_pribits = 5;
609
-
610
- /* From B5.1 AdvSIMD AArch64 register summary */
611
- cpu->isar.mvfr0 = 0x10110222;
612
- cpu->isar.mvfr1 = 0x13211111;
613
- cpu->isar.mvfr2 = 0x00000043;
614
-
615
- /* From D5.1 AArch64 PMU register summary */
616
- cpu->isar.reset_pmcr_el0 = 0x410c3000;
617
-
618
- define_neoverse_n1_cp_reginfo(cpu);
619
-}
620
-
621
static void aarch64_host_initfn(Object *obj)
622
{
623
#if defined(CONFIG_KVM)
624
@@ -XXX,XX +XXX,XX @@ static void aarch64_host_initfn(Object *obj)
625
#endif
626
}
627
628
-/*
629
- * -cpu max: a CPU with as many features enabled as our emulation supports.
630
- * The version of '-cpu max' for qemu-system-arm is defined in cpu_tcg.c;
631
- * this only needs to handle 64 bits.
632
- */
633
-static void aarch64_max_tcg_initfn(Object *obj)
634
-{
635
- ARMCPU *cpu = ARM_CPU(obj);
636
- uint64_t t;
637
- uint32_t u;
638
-
639
- /*
640
- * Reset MIDR so the guest doesn't mistake our 'max' CPU type for a real
641
- * one and try to apply errata workarounds or use impdef features we
642
- * don't provide.
643
- * An IMPLEMENTER field of 0 means "reserved for software use";
644
- * ARCHITECTURE must be 0xf indicating "v7 or later, check ID registers
645
- * to see which features are present";
646
- * the VARIANT, PARTNUM and REVISION fields are all implementation
647
- * defined and we choose to define PARTNUM just in case guest
648
- * code needs to distinguish this QEMU CPU from other software
649
- * implementations, though this shouldn't be needed.
650
- */
651
- t = FIELD_DP64(0, MIDR_EL1, IMPLEMENTER, 0);
652
- t = FIELD_DP64(t, MIDR_EL1, ARCHITECTURE, 0xf);
653
- t = FIELD_DP64(t, MIDR_EL1, PARTNUM, 'Q');
654
- t = FIELD_DP64(t, MIDR_EL1, VARIANT, 0);
655
- t = FIELD_DP64(t, MIDR_EL1, REVISION, 0);
656
- cpu->midr = t;
657
-
658
- /*
659
- * We're going to set FEAT_S2FWB, which mandates that CLIDR_EL1.{LoUU,LoUIS}
660
- * are zero.
661
- */
662
- u = cpu->clidr;
663
- u = FIELD_DP32(u, CLIDR_EL1, LOUIS, 0);
664
- u = FIELD_DP32(u, CLIDR_EL1, LOUU, 0);
665
- cpu->clidr = u;
666
-
667
- t = cpu->isar.id_aa64isar0;
668
- t = FIELD_DP64(t, ID_AA64ISAR0, AES, 2); /* FEAT_PMULL */
669
- t = FIELD_DP64(t, ID_AA64ISAR0, SHA1, 1); /* FEAT_SHA1 */
670
- t = FIELD_DP64(t, ID_AA64ISAR0, SHA2, 2); /* FEAT_SHA512 */
671
- t = FIELD_DP64(t, ID_AA64ISAR0, CRC32, 1);
672
- t = FIELD_DP64(t, ID_AA64ISAR0, ATOMIC, 2); /* FEAT_LSE */
673
- t = FIELD_DP64(t, ID_AA64ISAR0, RDM, 1); /* FEAT_RDM */
674
- t = FIELD_DP64(t, ID_AA64ISAR0, SHA3, 1); /* FEAT_SHA3 */
675
- t = FIELD_DP64(t, ID_AA64ISAR0, SM3, 1); /* FEAT_SM3 */
676
- t = FIELD_DP64(t, ID_AA64ISAR0, SM4, 1); /* FEAT_SM4 */
677
- t = FIELD_DP64(t, ID_AA64ISAR0, DP, 1); /* FEAT_DotProd */
678
- t = FIELD_DP64(t, ID_AA64ISAR0, FHM, 1); /* FEAT_FHM */
679
- t = FIELD_DP64(t, ID_AA64ISAR0, TS, 2); /* FEAT_FlagM2 */
680
- t = FIELD_DP64(t, ID_AA64ISAR0, TLB, 2); /* FEAT_TLBIRANGE */
681
- t = FIELD_DP64(t, ID_AA64ISAR0, RNDR, 1); /* FEAT_RNG */
682
- cpu->isar.id_aa64isar0 = t;
683
-
684
- t = cpu->isar.id_aa64isar1;
685
- t = FIELD_DP64(t, ID_AA64ISAR1, DPB, 2); /* FEAT_DPB2 */
686
- t = FIELD_DP64(t, ID_AA64ISAR1, JSCVT, 1); /* FEAT_JSCVT */
687
- t = FIELD_DP64(t, ID_AA64ISAR1, FCMA, 1); /* FEAT_FCMA */
688
- t = FIELD_DP64(t, ID_AA64ISAR1, LRCPC, 2); /* FEAT_LRCPC2 */
689
- t = FIELD_DP64(t, ID_AA64ISAR1, FRINTTS, 1); /* FEAT_FRINTTS */
690
- t = FIELD_DP64(t, ID_AA64ISAR1, SB, 1); /* FEAT_SB */
691
- t = FIELD_DP64(t, ID_AA64ISAR1, SPECRES, 1); /* FEAT_SPECRES */
692
- t = FIELD_DP64(t, ID_AA64ISAR1, BF16, 1); /* FEAT_BF16 */
693
- t = FIELD_DP64(t, ID_AA64ISAR1, DGH, 1); /* FEAT_DGH */
694
- t = FIELD_DP64(t, ID_AA64ISAR1, I8MM, 1); /* FEAT_I8MM */
695
- cpu->isar.id_aa64isar1 = t;
696
-
697
- t = cpu->isar.id_aa64pfr0;
698
- t = FIELD_DP64(t, ID_AA64PFR0, FP, 1); /* FEAT_FP16 */
699
- t = FIELD_DP64(t, ID_AA64PFR0, ADVSIMD, 1); /* FEAT_FP16 */
700
- t = FIELD_DP64(t, ID_AA64PFR0, RAS, 2); /* FEAT_RASv1p1 + FEAT_DoubleFault */
701
- t = FIELD_DP64(t, ID_AA64PFR0, SVE, 1);
702
- t = FIELD_DP64(t, ID_AA64PFR0, SEL2, 1); /* FEAT_SEL2 */
703
- t = FIELD_DP64(t, ID_AA64PFR0, DIT, 1); /* FEAT_DIT */
704
- t = FIELD_DP64(t, ID_AA64PFR0, CSV2, 2); /* FEAT_CSV2_2 */
705
- t = FIELD_DP64(t, ID_AA64PFR0, CSV3, 1); /* FEAT_CSV3 */
706
- cpu->isar.id_aa64pfr0 = t;
707
-
708
- t = cpu->isar.id_aa64pfr1;
709
- t = FIELD_DP64(t, ID_AA64PFR1, BT, 1); /* FEAT_BTI */
710
- t = FIELD_DP64(t, ID_AA64PFR1, SSBS, 2); /* FEAT_SSBS2 */
711
- /*
712
- * Begin with full support for MTE. This will be downgraded to MTE=0
713
- * during realize if the board provides no tag memory, much like
714
- * we do for EL2 with the virtualization=on property.
715
- */
716
- t = FIELD_DP64(t, ID_AA64PFR1, MTE, 3); /* FEAT_MTE3 */
717
- t = FIELD_DP64(t, ID_AA64PFR1, RAS_FRAC, 0); /* FEAT_RASv1p1 + FEAT_DoubleFault */
718
- t = FIELD_DP64(t, ID_AA64PFR1, SME, 1); /* FEAT_SME */
719
- t = FIELD_DP64(t, ID_AA64PFR1, CSV2_FRAC, 0); /* FEAT_CSV2_2 */
720
- cpu->isar.id_aa64pfr1 = t;
721
-
722
- t = cpu->isar.id_aa64mmfr0;
723
- t = FIELD_DP64(t, ID_AA64MMFR0, PARANGE, 6); /* FEAT_LPA: 52 bits */
724
- t = FIELD_DP64(t, ID_AA64MMFR0, TGRAN16, 1); /* 16k pages supported */
725
- t = FIELD_DP64(t, ID_AA64MMFR0, TGRAN16_2, 2); /* 16k stage2 supported */
726
- t = FIELD_DP64(t, ID_AA64MMFR0, TGRAN64_2, 2); /* 64k stage2 supported */
727
- t = FIELD_DP64(t, ID_AA64MMFR0, TGRAN4_2, 2); /* 4k stage2 supported */
728
- t = FIELD_DP64(t, ID_AA64MMFR0, FGT, 1); /* FEAT_FGT */
729
- cpu->isar.id_aa64mmfr0 = t;
730
-
731
- t = cpu->isar.id_aa64mmfr1;
732
- t = FIELD_DP64(t, ID_AA64MMFR1, HAFDBS, 2); /* FEAT_HAFDBS */
733
- t = FIELD_DP64(t, ID_AA64MMFR1, VMIDBITS, 2); /* FEAT_VMID16 */
734
- t = FIELD_DP64(t, ID_AA64MMFR1, VH, 1); /* FEAT_VHE */
735
- t = FIELD_DP64(t, ID_AA64MMFR1, HPDS, 1); /* FEAT_HPDS */
736
- t = FIELD_DP64(t, ID_AA64MMFR1, LO, 1); /* FEAT_LOR */
737
- t = FIELD_DP64(t, ID_AA64MMFR1, PAN, 3); /* FEAT_PAN3 */
738
- t = FIELD_DP64(t, ID_AA64MMFR1, XNX, 1); /* FEAT_XNX */
739
- t = FIELD_DP64(t, ID_AA64MMFR1, ETS, 1); /* FEAT_ETS */
740
- t = FIELD_DP64(t, ID_AA64MMFR1, HCX, 1); /* FEAT_HCX */
741
- cpu->isar.id_aa64mmfr1 = t;
742
-
743
- t = cpu->isar.id_aa64mmfr2;
744
- t = FIELD_DP64(t, ID_AA64MMFR2, CNP, 1); /* FEAT_TTCNP */
745
- t = FIELD_DP64(t, ID_AA64MMFR2, UAO, 1); /* FEAT_UAO */
746
- t = FIELD_DP64(t, ID_AA64MMFR2, IESB, 1); /* FEAT_IESB */
747
- t = FIELD_DP64(t, ID_AA64MMFR2, VARANGE, 1); /* FEAT_LVA */
748
- t = FIELD_DP64(t, ID_AA64MMFR2, ST, 1); /* FEAT_TTST */
749
- t = FIELD_DP64(t, ID_AA64MMFR2, IDS, 1); /* FEAT_IDST */
750
- t = FIELD_DP64(t, ID_AA64MMFR2, FWB, 1); /* FEAT_S2FWB */
751
- t = FIELD_DP64(t, ID_AA64MMFR2, TTL, 1); /* FEAT_TTL */
752
- t = FIELD_DP64(t, ID_AA64MMFR2, BBM, 2); /* FEAT_BBM at level 2 */
753
- t = FIELD_DP64(t, ID_AA64MMFR2, EVT, 2); /* FEAT_EVT */
754
- t = FIELD_DP64(t, ID_AA64MMFR2, E0PD, 1); /* FEAT_E0PD */
755
- cpu->isar.id_aa64mmfr2 = t;
756
-
757
- t = cpu->isar.id_aa64zfr0;
758
- t = FIELD_DP64(t, ID_AA64ZFR0, SVEVER, 1);
759
- t = FIELD_DP64(t, ID_AA64ZFR0, AES, 2); /* FEAT_SVE_PMULL128 */
760
- t = FIELD_DP64(t, ID_AA64ZFR0, BITPERM, 1); /* FEAT_SVE_BitPerm */
761
- t = FIELD_DP64(t, ID_AA64ZFR0, BFLOAT16, 1); /* FEAT_BF16 */
762
- t = FIELD_DP64(t, ID_AA64ZFR0, SHA3, 1); /* FEAT_SVE_SHA3 */
763
- t = FIELD_DP64(t, ID_AA64ZFR0, SM4, 1); /* FEAT_SVE_SM4 */
764
- t = FIELD_DP64(t, ID_AA64ZFR0, I8MM, 1); /* FEAT_I8MM */
765
- t = FIELD_DP64(t, ID_AA64ZFR0, F32MM, 1); /* FEAT_F32MM */
766
- t = FIELD_DP64(t, ID_AA64ZFR0, F64MM, 1); /* FEAT_F64MM */
767
- cpu->isar.id_aa64zfr0 = t;
768
-
769
- t = cpu->isar.id_aa64dfr0;
770
- t = FIELD_DP64(t, ID_AA64DFR0, DEBUGVER, 9); /* FEAT_Debugv8p4 */
771
- t = FIELD_DP64(t, ID_AA64DFR0, PMUVER, 6); /* FEAT_PMUv3p5 */
772
- cpu->isar.id_aa64dfr0 = t;
773
-
774
- t = cpu->isar.id_aa64smfr0;
775
- t = FIELD_DP64(t, ID_AA64SMFR0, F32F32, 1); /* FEAT_SME */
776
- t = FIELD_DP64(t, ID_AA64SMFR0, B16F32, 1); /* FEAT_SME */
777
- t = FIELD_DP64(t, ID_AA64SMFR0, F16F32, 1); /* FEAT_SME */
778
- t = FIELD_DP64(t, ID_AA64SMFR0, I8I32, 0xf); /* FEAT_SME */
779
- t = FIELD_DP64(t, ID_AA64SMFR0, F64F64, 1); /* FEAT_SME_F64F64 */
780
- t = FIELD_DP64(t, ID_AA64SMFR0, I16I64, 0xf); /* FEAT_SME_I16I64 */
781
- t = FIELD_DP64(t, ID_AA64SMFR0, FA64, 1); /* FEAT_SME_FA64 */
782
- cpu->isar.id_aa64smfr0 = t;
783
-
784
- /* Replicate the same data to the 32-bit id registers. */
785
- aa32_max_features(cpu);
786
-
787
-#ifdef CONFIG_USER_ONLY
788
- /*
789
- * For usermode -cpu max we can use a larger and more efficient DCZ
790
- * blocksize since we don't have to follow what the hardware does.
791
- */
792
- cpu->ctr = 0x80038003; /* 32 byte I and D cacheline size, VIPT icache */
793
- cpu->dcz_blocksize = 7; /* 512 bytes */
794
-#endif
795
-
796
- cpu->sve_vq.supported = MAKE_64BIT_MASK(0, ARM_MAX_VQ);
797
- cpu->sme_vq.supported = SVE_VQ_POW2_MAP;
798
-
799
- aarch64_add_pauth_properties(obj);
800
- aarch64_add_sve_properties(obj);
801
- aarch64_add_sme_properties(obj);
802
- object_property_add(obj, "sve-max-vq", "uint32", cpu_max_get_sve_max_vq,
803
- cpu_max_set_sve_max_vq, NULL, NULL);
804
- qdev_property_add_static(DEVICE(obj), &arm_cpu_lpa2_property);
805
-}
806
-
807
static void aarch64_max_initfn(Object *obj)
808
{
809
if (kvm_enabled() || hvf_enabled()) {
810
@@ -XXX,XX +XXX,XX @@ static void aarch64_max_initfn(Object *obj)
811
}
812
813
static const ARMCPUInfo aarch64_cpus[] = {
814
- { .name = "cortex-a35", .initfn = aarch64_a35_initfn },
815
{ .name = "cortex-a57", .initfn = aarch64_a57_initfn },
816
{ .name = "cortex-a53", .initfn = aarch64_a53_initfn },
817
- { .name = "cortex-a55", .initfn = aarch64_a55_initfn },
818
- { .name = "cortex-a72", .initfn = aarch64_a72_initfn },
819
- { .name = "cortex-a76", .initfn = aarch64_a76_initfn },
820
- { .name = "a64fx", .initfn = aarch64_a64fx_initfn },
821
- { .name = "neoverse-n1", .initfn = aarch64_neoverse_n1_initfn },
822
{ .name = "max", .initfn = aarch64_max_initfn },
823
#if defined(CONFIG_KVM) || defined(CONFIG_HVF)
824
{ .name = "host", .initfn = aarch64_host_initfn },
825
diff --git a/target/arm/cpu64.c b/target/arm/tcg/cpu64.c
826
similarity index 51%
827
copy from target/arm/cpu64.c
828
copy to target/arm/tcg/cpu64.c
829
index XXXXXXX..XXXXXXX 100644
830
--- a/target/arm/cpu64.c
831
+++ b/target/arm/tcg/cpu64.c
832
@@ -XXX,XX +XXX,XX @@
833
/*
834
- * QEMU AArch64 CPU
835
+ * QEMU AArch64 TCG CPUs
836
*
837
* Copyright (c) 2013 Linaro Ltd
838
*
839
@@ -XXX,XX +XXX,XX @@
840
#include "qemu/osdep.h"
841
#include "qapi/error.h"
842
#include "cpu.h"
843
-#include "cpregs.h"
844
#include "qemu/module.h"
845
-#include "sysemu/kvm.h"
846
-#include "sysemu/hvf.h"
847
-#include "sysemu/qtest.h"
848
-#include "sysemu/tcg.h"
849
-#include "kvm_arm.h"
850
-#include "hvf_arm.h"
851
#include "qapi/visitor.h"
852
#include "hw/qdev-properties.h"
853
#include "internals.h"
854
@@ -XXX,XX +XXX,XX @@ static void aarch64_a35_initfn(Object *obj)
855
define_cortex_a72_a57_a53_cp_reginfo(cpu);
856
}
857
858
-void arm_cpu_sve_finalize(ARMCPU *cpu, Error **errp)
859
-{
860
- /*
861
- * If any vector lengths are explicitly enabled with sve<N> properties,
862
- * then all other lengths are implicitly disabled. If sve-max-vq is
863
- * specified then it is the same as explicitly enabling all lengths
864
- * up to and including the specified maximum, which means all larger
865
- * lengths will be implicitly disabled. If no sve<N> properties
866
- * are enabled and sve-max-vq is not specified, then all lengths not
867
- * explicitly disabled will be enabled. Additionally, all power-of-two
868
- * vector lengths less than the maximum enabled length will be
869
- * automatically enabled and all vector lengths larger than the largest
870
- * disabled power-of-two vector length will be automatically disabled.
871
- * Errors are generated if the user provided input that interferes with
872
- * any of the above. Finally, if SVE is not disabled, then at least one
873
- * vector length must be enabled.
874
- */
875
- uint32_t vq_map = cpu->sve_vq.map;
876
- uint32_t vq_init = cpu->sve_vq.init;
877
- uint32_t vq_supported;
878
- uint32_t vq_mask = 0;
879
- uint32_t tmp, vq, max_vq = 0;
880
-
881
- /*
882
- * CPU models specify a set of supported vector lengths which are
883
- * enabled by default. Attempting to enable any vector length not set
884
- * in the supported bitmap results in an error. When KVM is enabled we
885
- * fetch the supported bitmap from the host.
886
- */
887
- if (kvm_enabled()) {
888
- if (kvm_arm_sve_supported()) {
889
- cpu->sve_vq.supported = kvm_arm_sve_get_vls(CPU(cpu));
890
- vq_supported = cpu->sve_vq.supported;
891
- } else {
892
- assert(!cpu_isar_feature(aa64_sve, cpu));
893
- vq_supported = 0;
894
- }
895
- } else {
896
- vq_supported = cpu->sve_vq.supported;
897
- }
898
-
899
- /*
900
- * Process explicit sve<N> properties.
901
- * From the properties, sve_vq_map<N> implies sve_vq_init<N>.
902
- * Check first for any sve<N> enabled.
903
- */
904
- if (vq_map != 0) {
905
- max_vq = 32 - clz32(vq_map);
906
- vq_mask = MAKE_64BIT_MASK(0, max_vq);
907
-
908
- if (cpu->sve_max_vq && max_vq > cpu->sve_max_vq) {
909
- error_setg(errp, "cannot enable sve%d", max_vq * 128);
910
- error_append_hint(errp, "sve%d is larger than the maximum vector "
911
- "length, sve-max-vq=%d (%d bits)\n",
912
- max_vq * 128, cpu->sve_max_vq,
913
- cpu->sve_max_vq * 128);
914
- return;
915
- }
916
-
917
- if (kvm_enabled()) {
918
- /*
919
- * For KVM we have to automatically enable all supported unitialized
920
- * lengths, even when the smaller lengths are not all powers-of-two.
921
- */
922
- vq_map |= vq_supported & ~vq_init & vq_mask;
923
- } else {
924
- /* Propagate enabled bits down through required powers-of-two. */
925
- vq_map |= SVE_VQ_POW2_MAP & ~vq_init & vq_mask;
926
- }
927
- } else if (cpu->sve_max_vq == 0) {
928
- /*
929
- * No explicit bits enabled, and no implicit bits from sve-max-vq.
930
- */
931
- if (!cpu_isar_feature(aa64_sve, cpu)) {
932
- /* SVE is disabled and so are all vector lengths. Good. */
933
- return;
934
- }
935
-
936
- if (kvm_enabled()) {
937
- /* Disabling a supported length disables all larger lengths. */
938
- tmp = vq_init & vq_supported;
939
- } else {
940
- /* Disabling a power-of-two disables all larger lengths. */
941
- tmp = vq_init & SVE_VQ_POW2_MAP;
942
- }
943
- vq = ctz32(tmp) + 1;
944
-
945
- max_vq = vq <= ARM_MAX_VQ ? vq - 1 : ARM_MAX_VQ;
946
- vq_mask = MAKE_64BIT_MASK(0, max_vq);
947
- vq_map = vq_supported & ~vq_init & vq_mask;
948
-
949
- if (max_vq == 0 || vq_map == 0) {
950
- error_setg(errp, "cannot disable sve%d", vq * 128);
951
- error_append_hint(errp, "Disabling sve%d results in all "
952
- "vector lengths being disabled.\n",
953
- vq * 128);
954
- error_append_hint(errp, "With SVE enabled, at least one "
955
- "vector length must be enabled.\n");
956
- return;
957
- }
958
-
959
- max_vq = 32 - clz32(vq_map);
960
- vq_mask = MAKE_64BIT_MASK(0, max_vq);
961
- }
962
-
963
- /*
964
- * Process the sve-max-vq property.
965
- * Note that we know from the above that no bit above
966
- * sve-max-vq is currently set.
967
- */
968
- if (cpu->sve_max_vq != 0) {
969
- max_vq = cpu->sve_max_vq;
970
- vq_mask = MAKE_64BIT_MASK(0, max_vq);
971
-
972
- if (vq_init & ~vq_map & (1 << (max_vq - 1))) {
973
- error_setg(errp, "cannot disable sve%d", max_vq * 128);
974
- error_append_hint(errp, "The maximum vector length must be "
975
- "enabled, sve-max-vq=%d (%d bits)\n",
976
- max_vq, max_vq * 128);
977
- return;
978
- }
979
-
980
- /* Set all bits not explicitly set within sve-max-vq. */
981
- vq_map |= ~vq_init & vq_mask;
982
- }
983
-
984
- /*
985
- * We should know what max-vq is now. Also, as we're done
986
- * manipulating sve-vq-map, we ensure any bits above max-vq
987
- * are clear, just in case anybody looks.
988
- */
989
- assert(max_vq != 0);
990
- assert(vq_mask != 0);
991
- vq_map &= vq_mask;
992
-
993
- /* Ensure the set of lengths matches what is supported. */
994
- tmp = vq_map ^ (vq_supported & vq_mask);
995
- if (tmp) {
996
- vq = 32 - clz32(tmp);
997
- if (vq_map & (1 << (vq - 1))) {
998
- if (cpu->sve_max_vq) {
999
- error_setg(errp, "cannot set sve-max-vq=%d", cpu->sve_max_vq);
1000
- error_append_hint(errp, "This CPU does not support "
1001
- "the vector length %d-bits.\n", vq * 128);
1002
- error_append_hint(errp, "It may not be possible to use "
1003
- "sve-max-vq with this CPU. Try "
1004
- "using only sve<N> properties.\n");
1005
- } else {
1006
- error_setg(errp, "cannot enable sve%d", vq * 128);
1007
- if (vq_supported) {
1008
- error_append_hint(errp, "This CPU does not support "
1009
- "the vector length %d-bits.\n", vq * 128);
1010
- } else {
1011
- error_append_hint(errp, "SVE not supported by KVM "
1012
- "on this host\n");
1013
- }
1014
- }
1015
- return;
1016
- } else {
1017
- if (kvm_enabled()) {
1018
- error_setg(errp, "cannot disable sve%d", vq * 128);
1019
- error_append_hint(errp, "The KVM host requires all "
1020
- "supported vector lengths smaller "
1021
- "than %d bits to also be enabled.\n",
1022
- max_vq * 128);
1023
- return;
1024
- } else {
1025
- /* Ensure all required powers-of-two are enabled. */
1026
- tmp = SVE_VQ_POW2_MAP & vq_mask & ~vq_map;
1027
- if (tmp) {
1028
- vq = 32 - clz32(tmp);
1029
- error_setg(errp, "cannot disable sve%d", vq * 128);
1030
- error_append_hint(errp, "sve%d is required as it "
1031
- "is a power-of-two length smaller "
1032
- "than the maximum, sve%d\n",
1033
- vq * 128, max_vq * 128);
1034
- return;
1035
- }
1036
- }
1037
- }
1038
- }
1039
-
1040
- /*
1041
- * Now that we validated all our vector lengths, the only question
1042
- * left to answer is if we even want SVE at all.
1043
- */
1044
- if (!cpu_isar_feature(aa64_sve, cpu)) {
1045
- error_setg(errp, "cannot enable sve%d", max_vq * 128);
1046
- error_append_hint(errp, "SVE must be enabled to enable vector "
1047
- "lengths.\n");
1048
- error_append_hint(errp, "Add sve=on to the CPU property list.\n");
1049
- return;
1050
- }
1051
-
1052
- /* From now on sve_max_vq is the actual maximum supported length. */
1053
- cpu->sve_max_vq = max_vq;
1054
- cpu->sve_vq.map = vq_map;
1055
-}
1056
-
1057
static void cpu_max_get_sve_max_vq(Object *obj, Visitor *v, const char *name,
1058
void *opaque, Error **errp)
1059
{
1060
@@ -XXX,XX +XXX,XX @@ static void cpu_max_set_sve_max_vq(Object *obj, Visitor *v, const char *name,
1061
cpu->sve_max_vq = max_vq;
1062
}
1063
1064
-/*
1065
- * Note that cpu_arm_{get,set}_vq cannot use the simpler
1066
- * object_property_add_bool interface because they make use of the
1067
- * contents of "name" to determine which bit on which to operate.
1068
- */
1069
-static void cpu_arm_get_vq(Object *obj, Visitor *v, const char *name,
1070
- void *opaque, Error **errp)
1071
-{
1072
- ARMCPU *cpu = ARM_CPU(obj);
1073
- ARMVQMap *vq_map = opaque;
1074
- uint32_t vq = atoi(&name[3]) / 128;
1075
- bool sve = vq_map == &cpu->sve_vq;
1076
- bool value;
1077
-
1078
- /* All vector lengths are disabled when feature is off. */
1079
- if (sve
1080
- ? !cpu_isar_feature(aa64_sve, cpu)
1081
- : !cpu_isar_feature(aa64_sme, cpu)) {
1082
- value = false;
1083
- } else {
1084
- value = extract32(vq_map->map, vq - 1, 1);
1085
- }
1086
- visit_type_bool(v, name, &value, errp);
1087
-}
1088
-
1089
-static void cpu_arm_set_vq(Object *obj, Visitor *v, const char *name,
1090
- void *opaque, Error **errp)
1091
-{
1092
- ARMVQMap *vq_map = opaque;
1093
- uint32_t vq = atoi(&name[3]) / 128;
1094
- bool value;
1095
-
1096
- if (!visit_type_bool(v, name, &value, errp)) {
1097
- return;
1098
- }
1099
-
1100
- vq_map->map = deposit32(vq_map->map, vq - 1, 1, value);
1101
- vq_map->init |= 1 << (vq - 1);
1102
-}
1103
-
1104
-static bool cpu_arm_get_sve(Object *obj, Error **errp)
1105
-{
1106
- ARMCPU *cpu = ARM_CPU(obj);
1107
- return cpu_isar_feature(aa64_sve, cpu);
1108
-}
1109
-
1110
-static void cpu_arm_set_sve(Object *obj, bool value, Error **errp)
1111
-{
1112
- ARMCPU *cpu = ARM_CPU(obj);
1113
- uint64_t t;
1114
-
1115
- if (value && kvm_enabled() && !kvm_arm_sve_supported()) {
1116
- error_setg(errp, "'sve' feature not supported by KVM on this host");
1117
- return;
1118
- }
1119
-
1120
- t = cpu->isar.id_aa64pfr0;
1121
- t = FIELD_DP64(t, ID_AA64PFR0, SVE, value);
1122
- cpu->isar.id_aa64pfr0 = t;
1123
-}
1124
-
1125
-void arm_cpu_sme_finalize(ARMCPU *cpu, Error **errp)
1126
-{
1127
- uint32_t vq_map = cpu->sme_vq.map;
1128
- uint32_t vq_init = cpu->sme_vq.init;
1129
- uint32_t vq_supported = cpu->sme_vq.supported;
1130
- uint32_t vq;
1131
-
1132
- if (vq_map == 0) {
1133
- if (!cpu_isar_feature(aa64_sme, cpu)) {
1134
- cpu->isar.id_aa64smfr0 = 0;
1135
- return;
1136
- }
1137
-
1138
- /* TODO: KVM will require limitations via SMCR_EL2. */
1139
- vq_map = vq_supported & ~vq_init;
1140
-
1141
- if (vq_map == 0) {
1142
- vq = ctz32(vq_supported) + 1;
1143
- error_setg(errp, "cannot disable sme%d", vq * 128);
1144
- error_append_hint(errp, "All SME vector lengths are disabled.\n");
1145
- error_append_hint(errp, "With SME enabled, at least one "
1146
- "vector length must be enabled.\n");
1147
- return;
1148
- }
1149
- } else {
1150
- if (!cpu_isar_feature(aa64_sme, cpu)) {
1151
- vq = 32 - clz32(vq_map);
1152
- error_setg(errp, "cannot enable sme%d", vq * 128);
1153
- error_append_hint(errp, "SME must be enabled to enable "
1154
- "vector lengths.\n");
1155
- error_append_hint(errp, "Add sme=on to the CPU property list.\n");
1156
- return;
1157
- }
1158
- /* TODO: KVM will require limitations via SMCR_EL2. */
1159
- }
1160
-
1161
- cpu->sme_vq.map = vq_map;
1162
-}
1163
-
1164
-static bool cpu_arm_get_sme(Object *obj, Error **errp)
1165
-{
1166
- ARMCPU *cpu = ARM_CPU(obj);
1167
- return cpu_isar_feature(aa64_sme, cpu);
1168
-}
1169
-
1170
-static void cpu_arm_set_sme(Object *obj, bool value, Error **errp)
1171
-{
1172
- ARMCPU *cpu = ARM_CPU(obj);
1173
- uint64_t t;
1174
-
1175
- t = cpu->isar.id_aa64pfr1;
1176
- t = FIELD_DP64(t, ID_AA64PFR1, SME, value);
1177
- cpu->isar.id_aa64pfr1 = t;
1178
-}
1179
-
1180
-static bool cpu_arm_get_sme_fa64(Object *obj, Error **errp)
1181
-{
1182
- ARMCPU *cpu = ARM_CPU(obj);
1183
- return cpu_isar_feature(aa64_sme, cpu) &&
1184
- cpu_isar_feature(aa64_sme_fa64, cpu);
1185
-}
1186
-
1187
-static void cpu_arm_set_sme_fa64(Object *obj, bool value, Error **errp)
1188
-{
1189
- ARMCPU *cpu = ARM_CPU(obj);
1190
- uint64_t t;
1191
-
1192
- t = cpu->isar.id_aa64smfr0;
1193
- t = FIELD_DP64(t, ID_AA64SMFR0, FA64, value);
1194
- cpu->isar.id_aa64smfr0 = t;
1195
-}
1196
-
1197
-#ifdef CONFIG_USER_ONLY
1198
-/* Mirror linux /proc/sys/abi/{sve,sme}_default_vector_length. */
1199
-static void cpu_arm_set_default_vec_len(Object *obj, Visitor *v,
1200
- const char *name, void *opaque,
1201
- Error **errp)
1202
-{
1203
- uint32_t *ptr_default_vq = opaque;
1204
- int32_t default_len, default_vq, remainder;
1205
-
1206
- if (!visit_type_int32(v, name, &default_len, errp)) {
1207
- return;
1208
- }
1209
-
1210
- /* Undocumented, but the kernel allows -1 to indicate "maximum". */
1211
- if (default_len == -1) {
1212
- *ptr_default_vq = ARM_MAX_VQ;
1213
- return;
1214
- }
1215
-
1216
- default_vq = default_len / 16;
1217
- remainder = default_len % 16;
1218
-
1219
- /*
1220
- * Note that the 512 max comes from include/uapi/asm/sve_context.h
1221
- * and is the maximum architectural width of ZCR_ELx.LEN.
1222
- */
1223
- if (remainder || default_vq < 1 || default_vq > 512) {
1224
- ARMCPU *cpu = ARM_CPU(obj);
1225
- const char *which =
1226
- (ptr_default_vq == &cpu->sve_default_vq ? "sve" : "sme");
1227
-
1228
- error_setg(errp, "cannot set %s-default-vector-length", which);
1229
- if (remainder) {
1230
- error_append_hint(errp, "Vector length not a multiple of 16\n");
1231
- } else if (default_vq < 1) {
1232
- error_append_hint(errp, "Vector length smaller than 16\n");
1233
- } else {
1234
- error_append_hint(errp, "Vector length larger than %d\n",
1235
- 512 * 16);
1236
- }
1237
- return;
1238
- }
1239
-
1240
- *ptr_default_vq = default_vq;
1241
-}
1242
-
1243
-static void cpu_arm_get_default_vec_len(Object *obj, Visitor *v,
1244
- const char *name, void *opaque,
1245
- Error **errp)
1246
-{
1247
- uint32_t *ptr_default_vq = opaque;
1248
- int32_t value = *ptr_default_vq * 16;
1249
-
1250
- visit_type_int32(v, name, &value, errp);
1251
-}
1252
-#endif
1253
-
1254
-static void aarch64_add_sve_properties(Object *obj)
1255
-{
1256
- ARMCPU *cpu = ARM_CPU(obj);
1257
- uint32_t vq;
1258
-
1259
- object_property_add_bool(obj, "sve", cpu_arm_get_sve, cpu_arm_set_sve);
1260
-
1261
- for (vq = 1; vq <= ARM_MAX_VQ; ++vq) {
1262
- char name[8];
1263
- sprintf(name, "sve%d", vq * 128);
1264
- object_property_add(obj, name, "bool", cpu_arm_get_vq,
1265
- cpu_arm_set_vq, NULL, &cpu->sve_vq);
1266
- }
1267
-
1268
-#ifdef CONFIG_USER_ONLY
1269
- /* Mirror linux /proc/sys/abi/sve_default_vector_length. */
1270
- object_property_add(obj, "sve-default-vector-length", "int32",
1271
- cpu_arm_get_default_vec_len,
1272
- cpu_arm_set_default_vec_len, NULL,
1273
- &cpu->sve_default_vq);
1274
-#endif
1275
-}
1276
-
1277
-static void aarch64_add_sme_properties(Object *obj)
1278
-{
1279
- ARMCPU *cpu = ARM_CPU(obj);
1280
- uint32_t vq;
1281
-
1282
- object_property_add_bool(obj, "sme", cpu_arm_get_sme, cpu_arm_set_sme);
1283
- object_property_add_bool(obj, "sme_fa64", cpu_arm_get_sme_fa64,
1284
- cpu_arm_set_sme_fa64);
1285
-
1286
- for (vq = 1; vq <= ARM_MAX_VQ; vq <<= 1) {
1287
- char name[8];
1288
- sprintf(name, "sme%d", vq * 128);
1289
- object_property_add(obj, name, "bool", cpu_arm_get_vq,
1290
- cpu_arm_set_vq, NULL, &cpu->sme_vq);
1291
- }
1292
-
1293
-#ifdef CONFIG_USER_ONLY
1294
- /* Mirror linux /proc/sys/abi/sme_default_vector_length. */
1295
- object_property_add(obj, "sme-default-vector-length", "int32",
1296
- cpu_arm_get_default_vec_len,
1297
- cpu_arm_set_default_vec_len, NULL,
1298
- &cpu->sme_default_vq);
1299
-#endif
1300
-}
1301
-
1302
-void arm_cpu_pauth_finalize(ARMCPU *cpu, Error **errp)
1303
-{
1304
- int arch_val = 0, impdef_val = 0;
1305
- uint64_t t;
1306
-
1307
- /* Exit early if PAuth is enabled, and fall through to disable it */
1308
- if ((kvm_enabled() || hvf_enabled()) && cpu->prop_pauth) {
1309
- if (!cpu_isar_feature(aa64_pauth, cpu)) {
1310
- error_setg(errp, "'pauth' feature not supported by %s on this host",
1311
- kvm_enabled() ? "KVM" : "hvf");
1312
- }
1313
-
1314
- return;
1315
- }
1316
-
1317
- /* TODO: Handle HaveEnhancedPAC, HaveEnhancedPAC2, HaveFPAC. */
1318
- if (cpu->prop_pauth) {
1319
- if (cpu->prop_pauth_impdef) {
1320
- impdef_val = 1;
1321
- } else {
1322
- arch_val = 1;
1323
- }
1324
- } else if (cpu->prop_pauth_impdef) {
1325
- error_setg(errp, "cannot enable pauth-impdef without pauth");
1326
- error_append_hint(errp, "Add pauth=on to the CPU property list.\n");
1327
- }
1328
-
1329
- t = cpu->isar.id_aa64isar1;
1330
- t = FIELD_DP64(t, ID_AA64ISAR1, APA, arch_val);
1331
- t = FIELD_DP64(t, ID_AA64ISAR1, GPA, arch_val);
1332
- t = FIELD_DP64(t, ID_AA64ISAR1, API, impdef_val);
1333
- t = FIELD_DP64(t, ID_AA64ISAR1, GPI, impdef_val);
1334
- cpu->isar.id_aa64isar1 = t;
1335
-}
1336
-
1337
-static Property arm_cpu_pauth_property =
1338
- DEFINE_PROP_BOOL("pauth", ARMCPU, prop_pauth, true);
1339
-static Property arm_cpu_pauth_impdef_property =
1340
- DEFINE_PROP_BOOL("pauth-impdef", ARMCPU, prop_pauth_impdef, false);
1341
-
1342
-static void aarch64_add_pauth_properties(Object *obj)
1343
-{
1344
- ARMCPU *cpu = ARM_CPU(obj);
1345
-
1346
- /* Default to PAUTH on, with the architected algorithm on TCG. */
1347
- qdev_property_add_static(DEVICE(obj), &arm_cpu_pauth_property);
1348
- if (kvm_enabled() || hvf_enabled()) {
1349
- /*
1350
- * Mirror PAuth support from the probed sysregs back into the
1351
- * property for KVM or hvf. Is it just a bit backward? Yes it is!
1352
- * Note that prop_pauth is true whether the host CPU supports the
1353
- * architected QARMA5 algorithm or the IMPDEF one. We don't
1354
- * provide the separate pauth-impdef property for KVM or hvf,
1355
- * only for TCG.
1356
- */
1357
- cpu->prop_pauth = cpu_isar_feature(aa64_pauth, cpu);
1358
- } else {
1359
- qdev_property_add_static(DEVICE(obj), &arm_cpu_pauth_impdef_property);
1360
- }
1361
-}
1362
-
1363
static Property arm_cpu_lpa2_property =
1364
DEFINE_PROP_BOOL("lpa2", ARMCPU, prop_lpa2, true);
1365
1366
-void arm_cpu_lpa2_finalize(ARMCPU *cpu, Error **errp)
1367
-{
1368
- uint64_t t;
1369
-
1370
- /*
1371
- * We only install the property for tcg -cpu max; this is the
1372
- * only situation in which the cpu field can be true.
1373
- */
1374
- if (!cpu->prop_lpa2) {
1375
- return;
1376
- }
1377
-
1378
- t = cpu->isar.id_aa64mmfr0;
1379
- t = FIELD_DP64(t, ID_AA64MMFR0, TGRAN16, 2); /* 16k pages w/ LPA2 */
1380
- t = FIELD_DP64(t, ID_AA64MMFR0, TGRAN4, 1); /* 4k pages w/ LPA2 */
1381
- t = FIELD_DP64(t, ID_AA64MMFR0, TGRAN16_2, 3); /* 16k stage2 w/ LPA2 */
1382
- t = FIELD_DP64(t, ID_AA64MMFR0, TGRAN4_2, 3); /* 4k stage2 w/ LPA2 */
1383
- cpu->isar.id_aa64mmfr0 = t;
1384
-}
1385
-
1386
-static void aarch64_a57_initfn(Object *obj)
1387
-{
1388
- ARMCPU *cpu = ARM_CPU(obj);
1389
-
1390
- cpu->dtb_compatible = "arm,cortex-a57";
1391
- set_feature(&cpu->env, ARM_FEATURE_V8);
1392
- set_feature(&cpu->env, ARM_FEATURE_NEON);
1393
- set_feature(&cpu->env, ARM_FEATURE_GENERIC_TIMER);
1394
- set_feature(&cpu->env, ARM_FEATURE_AARCH64);
1395
- set_feature(&cpu->env, ARM_FEATURE_CBAR_RO);
1396
- set_feature(&cpu->env, ARM_FEATURE_EL2);
1397
- set_feature(&cpu->env, ARM_FEATURE_EL3);
1398
- set_feature(&cpu->env, ARM_FEATURE_PMU);
1399
- cpu->kvm_target = QEMU_KVM_ARM_TARGET_CORTEX_A57;
1400
- cpu->midr = 0x411fd070;
1401
- cpu->revidr = 0x00000000;
1402
- cpu->reset_fpsid = 0x41034070;
1403
- cpu->isar.mvfr0 = 0x10110222;
1404
- cpu->isar.mvfr1 = 0x12111111;
1405
- cpu->isar.mvfr2 = 0x00000043;
1406
- cpu->ctr = 0x8444c004;
1407
- cpu->reset_sctlr = 0x00c50838;
1408
- cpu->isar.id_pfr0 = 0x00000131;
1409
- cpu->isar.id_pfr1 = 0x00011011;
1410
- cpu->isar.id_dfr0 = 0x03010066;
1411
- cpu->id_afr0 = 0x00000000;
1412
- cpu->isar.id_mmfr0 = 0x10101105;
1413
- cpu->isar.id_mmfr1 = 0x40000000;
1414
- cpu->isar.id_mmfr2 = 0x01260000;
1415
- cpu->isar.id_mmfr3 = 0x02102211;
1416
- cpu->isar.id_isar0 = 0x02101110;
1417
- cpu->isar.id_isar1 = 0x13112111;
1418
- cpu->isar.id_isar2 = 0x21232042;
1419
- cpu->isar.id_isar3 = 0x01112131;
1420
- cpu->isar.id_isar4 = 0x00011142;
1421
- cpu->isar.id_isar5 = 0x00011121;
1422
- cpu->isar.id_isar6 = 0;
1423
- cpu->isar.id_aa64pfr0 = 0x00002222;
1424
- cpu->isar.id_aa64dfr0 = 0x10305106;
1425
- cpu->isar.id_aa64isar0 = 0x00011120;
1426
- cpu->isar.id_aa64mmfr0 = 0x00001124;
1427
- cpu->isar.dbgdidr = 0x3516d000;
1428
- cpu->isar.dbgdevid = 0x01110f13;
1429
- cpu->isar.dbgdevid1 = 0x2;
1430
- cpu->isar.reset_pmcr_el0 = 0x41013000;
1431
- cpu->clidr = 0x0a200023;
1432
- cpu->ccsidr[0] = 0x701fe00a; /* 32KB L1 dcache */
1433
- cpu->ccsidr[1] = 0x201fe012; /* 48KB L1 icache */
1434
- cpu->ccsidr[2] = 0x70ffe07a; /* 2048KB L2 cache */
1435
- cpu->dcz_blocksize = 4; /* 64 bytes */
1436
- cpu->gic_num_lrs = 4;
1437
- cpu->gic_vpribits = 5;
1438
- cpu->gic_vprebits = 5;
1439
- cpu->gic_pribits = 5;
1440
- define_cortex_a72_a57_a53_cp_reginfo(cpu);
1441
-}
1442
-
1443
-static void aarch64_a53_initfn(Object *obj)
1444
-{
1445
- ARMCPU *cpu = ARM_CPU(obj);
1446
-
1447
- cpu->dtb_compatible = "arm,cortex-a53";
1448
- set_feature(&cpu->env, ARM_FEATURE_V8);
1449
- set_feature(&cpu->env, ARM_FEATURE_NEON);
1450
- set_feature(&cpu->env, ARM_FEATURE_GENERIC_TIMER);
1451
- set_feature(&cpu->env, ARM_FEATURE_AARCH64);
1452
- set_feature(&cpu->env, ARM_FEATURE_CBAR_RO);
1453
- set_feature(&cpu->env, ARM_FEATURE_EL2);
1454
- set_feature(&cpu->env, ARM_FEATURE_EL3);
1455
- set_feature(&cpu->env, ARM_FEATURE_PMU);
1456
- cpu->kvm_target = QEMU_KVM_ARM_TARGET_CORTEX_A53;
1457
- cpu->midr = 0x410fd034;
1458
- cpu->revidr = 0x00000000;
1459
- cpu->reset_fpsid = 0x41034070;
1460
- cpu->isar.mvfr0 = 0x10110222;
1461
- cpu->isar.mvfr1 = 0x12111111;
1462
- cpu->isar.mvfr2 = 0x00000043;
1463
- cpu->ctr = 0x84448004; /* L1Ip = VIPT */
1464
- cpu->reset_sctlr = 0x00c50838;
1465
- cpu->isar.id_pfr0 = 0x00000131;
1466
- cpu->isar.id_pfr1 = 0x00011011;
1467
- cpu->isar.id_dfr0 = 0x03010066;
1468
- cpu->id_afr0 = 0x00000000;
1469
- cpu->isar.id_mmfr0 = 0x10101105;
1470
- cpu->isar.id_mmfr1 = 0x40000000;
1471
- cpu->isar.id_mmfr2 = 0x01260000;
1472
- cpu->isar.id_mmfr3 = 0x02102211;
1473
- cpu->isar.id_isar0 = 0x02101110;
1474
- cpu->isar.id_isar1 = 0x13112111;
1475
- cpu->isar.id_isar2 = 0x21232042;
1476
- cpu->isar.id_isar3 = 0x01112131;
1477
- cpu->isar.id_isar4 = 0x00011142;
1478
- cpu->isar.id_isar5 = 0x00011121;
1479
- cpu->isar.id_isar6 = 0;
1480
- cpu->isar.id_aa64pfr0 = 0x00002222;
1481
- cpu->isar.id_aa64dfr0 = 0x10305106;
1482
- cpu->isar.id_aa64isar0 = 0x00011120;
1483
- cpu->isar.id_aa64mmfr0 = 0x00001122; /* 40 bit physical addr */
1484
- cpu->isar.dbgdidr = 0x3516d000;
1485
- cpu->isar.dbgdevid = 0x00110f13;
1486
- cpu->isar.dbgdevid1 = 0x1;
1487
- cpu->isar.reset_pmcr_el0 = 0x41033000;
1488
- cpu->clidr = 0x0a200023;
1489
- cpu->ccsidr[0] = 0x700fe01a; /* 32KB L1 dcache */
1490
- cpu->ccsidr[1] = 0x201fe00a; /* 32KB L1 icache */
1491
- cpu->ccsidr[2] = 0x707fe07a; /* 1024KB L2 cache */
1492
- cpu->dcz_blocksize = 4; /* 64 bytes */
1493
- cpu->gic_num_lrs = 4;
1494
- cpu->gic_vpribits = 5;
1495
- cpu->gic_vprebits = 5;
1496
- cpu->gic_pribits = 5;
1497
- define_cortex_a72_a57_a53_cp_reginfo(cpu);
1498
-}
1499
-
1500
static void aarch64_a55_initfn(Object *obj)
1501
{
1502
ARMCPU *cpu = ARM_CPU(obj);
1503
@@ -XXX,XX +XXX,XX @@ static void aarch64_neoverse_n1_initfn(Object *obj)
1504
define_neoverse_n1_cp_reginfo(cpu);
1505
}
1506
1507
-static void aarch64_host_initfn(Object *obj)
1508
-{
1509
-#if defined(CONFIG_KVM)
1510
- ARMCPU *cpu = ARM_CPU(obj);
1511
- kvm_arm_set_cpu_features_from_host(cpu);
1512
- if (arm_feature(&cpu->env, ARM_FEATURE_AARCH64)) {
1513
- aarch64_add_sve_properties(obj);
1514
- aarch64_add_pauth_properties(obj);
1515
- }
1516
-#elif defined(CONFIG_HVF)
1517
- ARMCPU *cpu = ARM_CPU(obj);
1518
- hvf_arm_set_cpu_features_from_host(cpu);
1519
- aarch64_add_pauth_properties(obj);
1520
-#else
1521
- g_assert_not_reached();
1522
-#endif
1523
-}
1524
-
1525
/*
1526
* -cpu max: a CPU with as many features enabled as our emulation supports.
1527
* The version of '-cpu max' for qemu-system-arm is defined in cpu_tcg.c;
1528
* this only needs to handle 64 bits.
1529
*/
1530
-static void aarch64_max_tcg_initfn(Object *obj)
1531
+void aarch64_max_tcg_initfn(Object *obj)
1532
{
1533
ARMCPU *cpu = ARM_CPU(obj);
1534
uint64_t t;
1535
@@ -XXX,XX +XXX,XX @@ static void aarch64_max_tcg_initfn(Object *obj)
1536
qdev_property_add_static(DEVICE(obj), &arm_cpu_lpa2_property);
1537
}
1538
1539
-static void aarch64_max_initfn(Object *obj)
1540
-{
1541
- if (kvm_enabled() || hvf_enabled()) {
1542
- /* With KVM or HVF, '-cpu max' is identical to '-cpu host' */
1543
- aarch64_host_initfn(obj);
1544
- return;
1545
- }
1546
-
1547
- if (tcg_enabled() || qtest_enabled()) {
1548
- aarch64_a57_initfn(obj);
1549
- }
1550
-
1551
- /* '-cpu max' for TCG: we currently do this as "A57 with extra things" */
1552
- if (tcg_enabled()) {
1553
- aarch64_max_tcg_initfn(obj);
1554
- }
1555
-}
1556
-
1557
static const ARMCPUInfo aarch64_cpus[] = {
1558
{ .name = "cortex-a35", .initfn = aarch64_a35_initfn },
1559
- { .name = "cortex-a57", .initfn = aarch64_a57_initfn },
1560
- { .name = "cortex-a53", .initfn = aarch64_a53_initfn },
1561
{ .name = "cortex-a55", .initfn = aarch64_a55_initfn },
1562
{ .name = "cortex-a72", .initfn = aarch64_a72_initfn },
1563
{ .name = "cortex-a76", .initfn = aarch64_a76_initfn },
1564
{ .name = "a64fx", .initfn = aarch64_a64fx_initfn },
1565
{ .name = "neoverse-n1", .initfn = aarch64_neoverse_n1_initfn },
1566
- { .name = "max", .initfn = aarch64_max_initfn },
1567
-#if defined(CONFIG_KVM) || defined(CONFIG_HVF)
1568
- { .name = "host", .initfn = aarch64_host_initfn },
1569
-#endif
1570
-};
1571
-
1572
-static bool aarch64_cpu_get_aarch64(Object *obj, Error **errp)
1573
-{
1574
- ARMCPU *cpu = ARM_CPU(obj);
1575
-
1576
- return arm_feature(&cpu->env, ARM_FEATURE_AARCH64);
1577
-}
1578
-
1579
-static void aarch64_cpu_set_aarch64(Object *obj, bool value, Error **errp)
1580
-{
1581
- ARMCPU *cpu = ARM_CPU(obj);
1582
-
1583
- /* At this time, this property is only allowed if KVM is enabled. This
1584
- * restriction allows us to avoid fixing up functionality that assumes a
1585
- * uniform execution state like do_interrupt.
1586
- */
1587
- if (value == false) {
1588
- if (!kvm_enabled() || !kvm_arm_aarch32_supported()) {
1589
- error_setg(errp, "'aarch64' feature cannot be disabled "
1590
- "unless KVM is enabled and 32-bit EL1 "
1591
- "is supported");
1592
- return;
1593
- }
1594
- unset_feature(&cpu->env, ARM_FEATURE_AARCH64);
1595
- } else {
1596
- set_feature(&cpu->env, ARM_FEATURE_AARCH64);
1597
- }
1598
-}
1599
-
1600
-static void aarch64_cpu_finalizefn(Object *obj)
1601
-{
1602
-}
1603
-
1604
-static gchar *aarch64_gdb_arch_name(CPUState *cs)
1605
-{
1606
- return g_strdup("aarch64");
1607
-}
1608
-
1609
-static void aarch64_cpu_class_init(ObjectClass *oc, void *data)
1610
-{
1611
- CPUClass *cc = CPU_CLASS(oc);
1612
-
1613
- cc->gdb_read_register = aarch64_cpu_gdb_read_register;
1614
- cc->gdb_write_register = aarch64_cpu_gdb_write_register;
1615
- cc->gdb_num_core_regs = 34;
1616
- cc->gdb_core_xml_file = "aarch64-core.xml";
1617
- cc->gdb_arch_name = aarch64_gdb_arch_name;
1618
-
1619
- object_class_property_add_bool(oc, "aarch64", aarch64_cpu_get_aarch64,
1620
- aarch64_cpu_set_aarch64);
1621
- object_class_property_set_description(oc, "aarch64",
1622
- "Set on/off to enable/disable aarch64 "
1623
- "execution state ");
1624
-}
1625
-
1626
-static void aarch64_cpu_instance_init(Object *obj)
1627
-{
1628
- ARMCPUClass *acc = ARM_CPU_GET_CLASS(obj);
1629
-
1630
- acc->info->initfn(obj);
1631
- arm_cpu_post_init(obj);
1632
-}
1633
-
1634
-static void cpu_register_class_init(ObjectClass *oc, void *data)
1635
-{
1636
- ARMCPUClass *acc = ARM_CPU_CLASS(oc);
1637
-
1638
- acc->info = data;
1639
-}
1640
-
1641
-void aarch64_cpu_register(const ARMCPUInfo *info)
1642
-{
1643
- TypeInfo type_info = {
1644
- .parent = TYPE_AARCH64_CPU,
1645
- .instance_size = sizeof(ARMCPU),
1646
- .instance_init = aarch64_cpu_instance_init,
1647
- .class_size = sizeof(ARMCPUClass),
1648
- .class_init = info->class_init ?: cpu_register_class_init,
1649
- .class_data = (void *)info,
1650
- };
1651
-
1652
- type_info.name = g_strdup_printf("%s-" TYPE_ARM_CPU, info->name);
1653
- type_register(&type_info);
1654
- g_free((void *)type_info.name);
1655
-}
1656
-
1657
-static const TypeInfo aarch64_cpu_type_info = {
1658
- .name = TYPE_AARCH64_CPU,
1659
- .parent = TYPE_ARM_CPU,
1660
- .instance_size = sizeof(ARMCPU),
1661
- .instance_finalize = aarch64_cpu_finalizefn,
1662
- .abstract = true,
1663
- .class_size = sizeof(AArch64CPUClass),
1664
- .class_init = aarch64_cpu_class_init,
1665
};
1666
1667
static void aarch64_cpu_register_types(void)
1668
{
1669
size_t i;
1670
1671
- type_register_static(&aarch64_cpu_type_info);
1672
-
1673
for (i = 0; i < ARRAY_SIZE(aarch64_cpus); ++i) {
1674
aarch64_cpu_register(&aarch64_cpus[i]);
1675
}
1676
diff --git a/target/arm/tcg/meson.build b/target/arm/tcg/meson.build
1677
index XXXXXXX..XXXXXXX 100644
1678
--- a/target/arm/tcg/meson.build
1679
+++ b/target/arm/tcg/meson.build
1680
@@ -XXX,XX +XXX,XX @@ arm_ss.add(files(
1681
))
1682
1683
arm_ss.add(when: 'TARGET_AARCH64', if_true: files(
1684
+ 'cpu64.c',
1685
'translate-a64.c',
1686
'translate-sve.c',
1687
'translate-sme.c',
61
--
1688
--
62
2.17.0
1689
2.34.1
63
1690
64
1691
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
From: Fabiano Rosas <farosas@suse.de>
2
2
3
No sense in emitting code after the exception.
3
We're about to move the 32-bit CPUs under CONFIG_TCG, so adjust the
4
query-cpu-model-expansion test to check against the cortex-a7, which
5
is already under CONFIG_TCG. That allows the next patch to contain
6
only code movement. (All the test cares about is that the CPU type
7
it's checking is one which definitely doesn't work under KVM.)
4
8
5
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
9
While here add comments clarifying what we're testing.
6
Tested-by: Alex Bennée <alex.bennee@linaro.org>
10
7
Message-id: 20180512003217.9105-3-richard.henderson@linaro.org
11
Signed-off-by: Fabiano Rosas <farosas@suse.de>
12
Acked-by: Thomas Huth <thuth@redhat.com>
13
Message-id: 20230426180013.14814-7-farosas@suse.de
14
Suggested-by: Philippe Mathieu-Daudé <philmd@linaro.org>
8
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
15
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
16
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
---
17
---
11
target/arm/translate-a64.c | 2 +-
18
tests/qtest/arm-cpu-features.c | 20 +++++++++++++++++---
12
1 file changed, 1 insertion(+), 1 deletion(-)
19
1 file changed, 17 insertions(+), 3 deletions(-)
13
20
14
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
21
diff --git a/tests/qtest/arm-cpu-features.c b/tests/qtest/arm-cpu-features.c
15
index XXXXXXX..XXXXXXX 100644
22
index XXXXXXX..XXXXXXX 100644
16
--- a/target/arm/translate-a64.c
23
--- a/tests/qtest/arm-cpu-features.c
17
+++ b/target/arm/translate-a64.c
24
+++ b/tests/qtest/arm-cpu-features.c
18
@@ -XXX,XX +XXX,XX @@ static void disas_fp_int_conv(DisasContext *s, uint32_t insn)
25
@@ -XXX,XX +XXX,XX @@ static void test_query_cpu_model_expansion_kvm(const void *data)
19
default:
26
QDict *resp;
20
/* all other sf/type/rmode combinations are invalid */
27
char *error;
21
unallocated_encoding(s);
28
22
- break;
29
- assert_error(qts, "cortex-a15",
23
+ return;
30
- "We cannot guarantee the CPU type 'cortex-a15' works "
24
}
31
- "with KVM on this host", NULL);
25
32
+ /*
26
if (!fp_access_check(s)) {
33
+ * When using KVM, only the 'host' and 'max' CPU models are
34
+ * supported. Test that we're emitting a suitable error for
35
+ * unsupported CPU models.
36
+ */
37
+ if (qtest_has_accel("tcg")) {
38
+ assert_error(qts, "cortex-a7",
39
+ "We cannot guarantee the CPU type 'cortex-a7' works "
40
+ "with KVM on this host", NULL);
41
+ } else {
42
+ /*
43
+ * With a KVM-only build the 32-bit CPUs are not present.
44
+ */
45
+ assert_error(qts, "cortex-a7",
46
+ "The CPU type 'cortex-a7' is not a "
47
+ "recognized ARM CPU type", NULL);
48
+ }
49
50
assert_has_feature_enabled(qts, "host", "aarch64");
51
27
--
52
--
28
2.17.0
53
2.34.1
29
54
30
55
diff view generated by jsdifflib
New patch
1
From: Claudio Fontana <cfontana@suse.de>
1
2
3
move the module containing cpu models definitions
4
for 32bit TCG-only CPUs to tcg/ and rename it for clarity.
5
6
Signed-off-by: Claudio Fontana <cfontana@suse.de>
7
Signed-off-by: Fabiano Rosas <farosas@suse.de>
8
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
9
Acked-by: Thomas Huth <thuth@redhat.com>
10
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
11
Message-id: 20230426180013.14814-8-farosas@suse.de
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
---
14
hw/arm/virt.c | 2 --
15
target/arm/{cpu_tcg.c => tcg/cpu32.c} | 13 +++----------
16
target/arm/tcg/cpu64.c | 2 +-
17
target/arm/meson.build | 1 -
18
target/arm/tcg/meson.build | 1 +
19
5 files changed, 5 insertions(+), 14 deletions(-)
20
rename target/arm/{cpu_tcg.c => tcg/cpu32.c} (99%)
21
22
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
23
index XXXXXXX..XXXXXXX 100644
24
--- a/hw/arm/virt.c
25
+++ b/hw/arm/virt.c
26
@@ -XXX,XX +XXX,XX @@ static const int a15irqmap[] = {
27
static const char *valid_cpus[] = {
28
#ifdef CONFIG_TCG
29
ARM_CPU_TYPE_NAME("cortex-a7"),
30
-#endif
31
ARM_CPU_TYPE_NAME("cortex-a15"),
32
-#ifdef CONFIG_TCG
33
ARM_CPU_TYPE_NAME("cortex-a35"),
34
ARM_CPU_TYPE_NAME("cortex-a55"),
35
ARM_CPU_TYPE_NAME("cortex-a72"),
36
diff --git a/target/arm/cpu_tcg.c b/target/arm/tcg/cpu32.c
37
similarity index 99%
38
rename from target/arm/cpu_tcg.c
39
rename to target/arm/tcg/cpu32.c
40
index XXXXXXX..XXXXXXX 100644
41
--- a/target/arm/cpu_tcg.c
42
+++ b/target/arm/tcg/cpu32.c
43
@@ -XXX,XX +XXX,XX @@
44
/*
45
- * QEMU ARM TCG CPUs.
46
+ * QEMU ARM TCG-only CPUs.
47
*
48
* Copyright (c) 2012 SUSE LINUX Products GmbH
49
*
50
@@ -XXX,XX +XXX,XX @@
51
52
#include "qemu/osdep.h"
53
#include "cpu.h"
54
-#ifdef CONFIG_TCG
55
#include "hw/core/tcg-cpu-ops.h"
56
-#endif /* CONFIG_TCG */
57
#include "internals.h"
58
#include "target/arm/idau.h"
59
#if !defined(CONFIG_USER_ONLY)
60
@@ -XXX,XX +XXX,XX @@ void aa32_max_features(ARMCPU *cpu)
61
/* CPU models. These are not needed for the AArch64 linux-user build. */
62
#if !defined(CONFIG_USER_ONLY) || !defined(TARGET_AARCH64)
63
64
-#if !defined(CONFIG_USER_ONLY) && defined(CONFIG_TCG)
65
+#if !defined(CONFIG_USER_ONLY)
66
static bool arm_v7m_cpu_exec_interrupt(CPUState *cs, int interrupt_request)
67
{
68
CPUClass *cc = CPU_GET_CLASS(cs);
69
@@ -XXX,XX +XXX,XX @@ static bool arm_v7m_cpu_exec_interrupt(CPUState *cs, int interrupt_request)
70
}
71
return ret;
72
}
73
-#endif /* !CONFIG_USER_ONLY && CONFIG_TCG */
74
+#endif /* !CONFIG_USER_ONLY */
75
76
static void arm926_initfn(Object *obj)
77
{
78
@@ -XXX,XX +XXX,XX @@ static void pxa270c5_initfn(Object *obj)
79
cpu->reset_sctlr = 0x00000078;
80
}
81
82
-#ifdef CONFIG_TCG
83
static const struct TCGCPUOps arm_v7m_tcg_ops = {
84
.initialize = arm_translate_init,
85
.synchronize_from_tb = arm_cpu_synchronize_from_tb,
86
@@ -XXX,XX +XXX,XX @@ static const struct TCGCPUOps arm_v7m_tcg_ops = {
87
.debug_check_breakpoint = arm_debug_check_breakpoint,
88
#endif /* !CONFIG_USER_ONLY */
89
};
90
-#endif /* CONFIG_TCG */
91
92
static void arm_v7m_class_init(ObjectClass *oc, void *data)
93
{
94
@@ -XXX,XX +XXX,XX @@ static void arm_v7m_class_init(ObjectClass *oc, void *data)
95
CPUClass *cc = CPU_CLASS(oc);
96
97
acc->info = data;
98
-#ifdef CONFIG_TCG
99
cc->tcg_ops = &arm_v7m_tcg_ops;
100
-#endif /* CONFIG_TCG */
101
-
102
cc->gdb_core_xml_file = "arm-m-profile.xml";
103
}
104
105
diff --git a/target/arm/tcg/cpu64.c b/target/arm/tcg/cpu64.c
106
index XXXXXXX..XXXXXXX 100644
107
--- a/target/arm/tcg/cpu64.c
108
+++ b/target/arm/tcg/cpu64.c
109
@@ -XXX,XX +XXX,XX @@ static void aarch64_neoverse_n1_initfn(Object *obj)
110
111
/*
112
* -cpu max: a CPU with as many features enabled as our emulation supports.
113
- * The version of '-cpu max' for qemu-system-arm is defined in cpu_tcg.c;
114
+ * The version of '-cpu max' for qemu-system-arm is defined in cpu32.c;
115
* this only needs to handle 64 bits.
116
*/
117
void aarch64_max_tcg_initfn(Object *obj)
118
diff --git a/target/arm/meson.build b/target/arm/meson.build
119
index XXXXXXX..XXXXXXX 100644
120
--- a/target/arm/meson.build
121
+++ b/target/arm/meson.build
122
@@ -XXX,XX +XXX,XX @@ arm_ss.add(files(
123
'gdbstub.c',
124
'helper.c',
125
'vfp_helper.c',
126
- 'cpu_tcg.c',
127
))
128
arm_ss.add(zlib)
129
130
diff --git a/target/arm/tcg/meson.build b/target/arm/tcg/meson.build
131
index XXXXXXX..XXXXXXX 100644
132
--- a/target/arm/tcg/meson.build
133
+++ b/target/arm/tcg/meson.build
134
@@ -XXX,XX +XXX,XX @@ gen = [
135
arm_ss.add(gen)
136
137
arm_ss.add(files(
138
+ 'cpu32.c',
139
'translate.c',
140
'translate-m-nocp.c',
141
'translate-mve.c',
142
--
143
2.34.1
144
145
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
From: Fabiano Rosas <farosas@suse.de>
2
2
3
We missed all of the scalar fp16 fma operations.
3
It is possible to have a build with both TCG and KVM disabled due to
4
Xen requiring the i386 and x86_64 binaries to be present in an aarch64
5
host.
4
6
5
Cc: qemu-stable@nongnu.org
7
If we build with --disable-tcg on the aarch64 host, we will end-up
6
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
8
with a QEMU binary (x86) that does not support TCG nor KVM.
7
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
9
8
Tested-by: Alex Bennée <alex.bennee@linaro.org>
10
Skip tests that crash or hang in the above scenario. Do not include
9
Message-id: 20180512003217.9105-8-richard.henderson@linaro.org
11
any test cases if TCG and KVM are missing.
12
13
Make sure that calls to qtest_has_accel are placed after g_test_init
14
in similar fashion to commit ae4b01b349 ("tests: Ensure TAP version is
15
printed before other messages") to avoid TAP parsing errors.
16
17
Reviewed-by: Juan Quintela <quintela@redhat.com>
18
Reviewed-by: Thomas Huth <thuth@redhat.com>
19
Signed-off-by: Fabiano Rosas <farosas@suse.de>
20
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
21
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
22
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
23
Message-id: 20230426180013.14814-9-farosas@suse.de
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
24
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
---
25
---
12
target/arm/translate-a64.c | 48 ++++++++++++++++++++++++++++++++++++++
26
tests/qtest/bios-tables-test.c | 11 +++++++++--
13
1 file changed, 48 insertions(+)
27
tests/qtest/boot-serial-test.c | 5 +++++
28
tests/qtest/migration-test.c | 9 ++++++++-
29
tests/qtest/pxe-test.c | 8 +++++++-
30
tests/qtest/vmgenid-test.c | 9 +++++++--
31
5 files changed, 36 insertions(+), 6 deletions(-)
14
32
15
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
33
diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c
16
index XXXXXXX..XXXXXXX 100644
34
index XXXXXXX..XXXXXXX 100644
17
--- a/target/arm/translate-a64.c
35
--- a/tests/qtest/bios-tables-test.c
18
+++ b/target/arm/translate-a64.c
36
+++ b/tests/qtest/bios-tables-test.c
19
@@ -XXX,XX +XXX,XX @@ static void handle_fp_3src_double(DisasContext *s, bool o0, bool o1,
37
@@ -XXX,XX +XXX,XX @@ static void test_acpi_virt_oem_fields(void)
20
tcg_temp_free_i64(tcg_res);
38
int main(int argc, char *argv[])
21
}
39
{
22
40
const char *arch = qtest_get_arch();
23
+/* Floating-point data-processing (3 source) - half precision */
41
- const bool has_kvm = qtest_has_accel("kvm");
24
+static void handle_fp_3src_half(DisasContext *s, bool o0, bool o1,
42
- const bool has_tcg = qtest_has_accel("tcg");
25
+ int rd, int rn, int rm, int ra)
43
+ bool has_kvm, has_tcg;
26
+{
44
char *v_env = getenv("V");
27
+ TCGv_i32 tcg_op1, tcg_op2, tcg_op3;
45
int ret;
28
+ TCGv_i32 tcg_res = tcg_temp_new_i32();
46
29
+ TCGv_ptr fpst = get_fpstatus_ptr(true);
47
@@ -XXX,XX +XXX,XX @@ int main(int argc, char *argv[])
48
49
g_test_init(&argc, &argv, NULL);
50
51
+ has_kvm = qtest_has_accel("kvm");
52
+ has_tcg = qtest_has_accel("tcg");
30
+
53
+
31
+ tcg_op1 = read_fp_hreg(s, rn);
54
+ if (!has_tcg && !has_kvm) {
32
+ tcg_op2 = read_fp_hreg(s, rm);
55
+ g_test_skip("No KVM or TCG accelerator available");
33
+ tcg_op3 = read_fp_hreg(s, ra);
56
+ return 0;
34
+
35
+ /* These are fused multiply-add, and must be done as one
36
+ * floating point operation with no rounding between the
37
+ * multiplication and addition steps.
38
+ * NB that doing the negations here as separate steps is
39
+ * correct : an input NaN should come out with its sign bit
40
+ * flipped if it is a negated-input.
41
+ */
42
+ if (o1 == true) {
43
+ tcg_gen_xori_i32(tcg_op3, tcg_op3, 0x8000);
44
+ }
57
+ }
45
+
58
+
46
+ if (o0 != o1) {
59
if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) {
47
+ tcg_gen_xori_i32(tcg_op1, tcg_op1, 0x8000);
60
ret = boot_sector_init(disk);
61
if (ret) {
62
diff --git a/tests/qtest/boot-serial-test.c b/tests/qtest/boot-serial-test.c
63
index XXXXXXX..XXXXXXX 100644
64
--- a/tests/qtest/boot-serial-test.c
65
+++ b/tests/qtest/boot-serial-test.c
66
@@ -XXX,XX +XXX,XX @@ int main(int argc, char *argv[])
67
68
g_test_init(&argc, &argv, NULL);
69
70
+ if (!qtest_has_accel("tcg") && !qtest_has_accel("kvm")) {
71
+ g_test_skip("No KVM or TCG accelerator available");
72
+ return 0;
48
+ }
73
+ }
49
+
74
+
50
+ gen_helper_advsimd_muladdh(tcg_res, tcg_op1, tcg_op2, tcg_op3, fpst);
75
for (i = 0; tests[i].arch != NULL; i++) {
76
if (g_str_equal(arch, tests[i].arch) &&
77
qtest_has_machine(tests[i].machine)) {
78
diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c
79
index XXXXXXX..XXXXXXX 100644
80
--- a/tests/qtest/migration-test.c
81
+++ b/tests/qtest/migration-test.c
82
@@ -XXX,XX +XXX,XX @@ static bool kvm_dirty_ring_supported(void)
83
84
int main(int argc, char **argv)
85
{
86
- bool has_kvm;
87
+ bool has_kvm, has_tcg;
88
bool has_uffd;
89
const char *arch;
90
g_autoptr(GError) err = NULL;
91
@@ -XXX,XX +XXX,XX @@ int main(int argc, char **argv)
92
g_test_init(&argc, &argv, NULL);
93
94
has_kvm = qtest_has_accel("kvm");
95
+ has_tcg = qtest_has_accel("tcg");
51
+
96
+
52
+ write_fp_sreg(s, rd, tcg_res);
97
+ if (!has_tcg && !has_kvm) {
98
+ g_test_skip("No KVM or TCG accelerator available");
99
+ return 0;
100
+ }
53
+
101
+
54
+ tcg_temp_free_ptr(fpst);
102
has_uffd = ufd_version_check();
55
+ tcg_temp_free_i32(tcg_op1);
103
arch = qtest_get_arch();
56
+ tcg_temp_free_i32(tcg_op2);
104
57
+ tcg_temp_free_i32(tcg_op3);
105
diff --git a/tests/qtest/pxe-test.c b/tests/qtest/pxe-test.c
58
+ tcg_temp_free_i32(tcg_res);
106
index XXXXXXX..XXXXXXX 100644
59
+}
107
--- a/tests/qtest/pxe-test.c
108
+++ b/tests/qtest/pxe-test.c
109
@@ -XXX,XX +XXX,XX @@ int main(int argc, char *argv[])
110
int ret;
111
const char *arch = qtest_get_arch();
112
113
+ g_test_init(&argc, &argv, NULL);
60
+
114
+
61
/* Floating point data-processing (3 source)
115
+ if (!qtest_has_accel("tcg") && !qtest_has_accel("kvm")) {
62
* 31 30 29 28 24 23 22 21 20 16 15 14 10 9 5 4 0
116
+ g_test_skip("No KVM or TCG accelerator available");
63
* +---+---+---+-----------+------+----+------+----+------+------+------+
117
+ return 0;
64
@@ -XXX,XX +XXX,XX @@ static void disas_fp_3src(DisasContext *s, uint32_t insn)
118
+ }
65
}
119
+
66
handle_fp_3src_double(s, o0, o1, rd, rn, rm, ra);
120
ret = boot_sector_init(disk);
67
break;
121
if(ret)
68
+ case 3:
122
return ret;
69
+ if (!arm_dc_feature(s, ARM_FEATURE_V8_FP16)) {
123
70
+ unallocated_encoding(s);
124
- g_test_init(&argc, &argv, NULL);
71
+ return;
125
72
+ }
126
if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) {
73
+ if (!fp_access_check(s)) {
127
test_batch(x86_tests, false);
74
+ return;
128
diff --git a/tests/qtest/vmgenid-test.c b/tests/qtest/vmgenid-test.c
75
+ }
129
index XXXXXXX..XXXXXXX 100644
76
+ handle_fp_3src_half(s, o0, o1, rd, rn, rm, ra);
130
--- a/tests/qtest/vmgenid-test.c
77
+ break;
131
+++ b/tests/qtest/vmgenid-test.c
78
default:
132
@@ -XXX,XX +XXX,XX @@ int main(int argc, char **argv)
79
unallocated_encoding(s);
133
{
134
int ret;
135
136
+ g_test_init(&argc, &argv, NULL);
137
+
138
+ if (!qtest_has_accel("tcg") && !qtest_has_accel("kvm")) {
139
+ g_test_skip("No KVM or TCG accelerator available");
140
+ return 0;
141
+ }
142
+
143
ret = boot_sector_init(disk);
144
if (ret) {
145
return ret;
80
}
146
}
147
148
- g_test_init(&argc, &argv, NULL);
149
-
150
qtest_add_func("/vmgenid/vmgenid/set-guid",
151
vmgenid_set_guid_test);
152
qtest_add_func("/vmgenid/vmgenid/set-guid-auto",
81
--
153
--
82
2.17.0
154
2.34.1
83
155
84
156
diff view generated by jsdifflib
New patch
1
From: Fabiano Rosas <farosas@suse.de>
1
2
3
The migration tests are currently broken for an aarch64 host because
4
the tests pass no 'machine' and 'cpu' options on the QEMU command
5
line.
6
7
Add a separate class to each architecture so that we can specify
8
'machine' and 'cpu' options instead of relying on defaults.
9
10
Add a skip decorator to keep the current behavior of only running
11
migration tests when the qemu target matches the host architecture.
12
13
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
14
Signed-off-by: Fabiano Rosas <farosas@suse.de>
15
Message-id: 20230426180013.14814-10-farosas@suse.de
16
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
17
---
18
tests/avocado/migration.py | 83 +++++++++++++++++++++++++++++++++++---
19
1 file changed, 78 insertions(+), 5 deletions(-)
20
21
diff --git a/tests/avocado/migration.py b/tests/avocado/migration.py
22
index XXXXXXX..XXXXXXX 100644
23
--- a/tests/avocado/migration.py
24
+++ b/tests/avocado/migration.py
25
@@ -XXX,XX +XXX,XX @@
26
27
28
import tempfile
29
+import os
30
+
31
from avocado_qemu import QemuSystemTest
32
from avocado import skipUnless
33
34
@@ -XXX,XX +XXX,XX @@
35
from avocado.utils.path import find_command
36
37
38
-class Migration(QemuSystemTest):
39
+class MigrationTest(QemuSystemTest):
40
"""
41
:avocado: tags=migration
42
"""
43
@@ -XXX,XX +XXX,XX @@ def _get_free_port(self):
44
self.cancel('Failed to find a free port')
45
return port
46
47
-
48
- def test_migration_with_tcp_localhost(self):
49
+ def migration_with_tcp_localhost(self):
50
dest_uri = 'tcp:localhost:%u' % self._get_free_port()
51
self.do_migrate(dest_uri)
52
53
- def test_migration_with_unix(self):
54
+ def migration_with_unix(self):
55
with tempfile.TemporaryDirectory(prefix='socket_') as socket_path:
56
dest_uri = 'unix:%s/qemu-test.sock' % socket_path
57
self.do_migrate(dest_uri)
58
59
@skipUnless(find_command('nc', default=False), "'nc' command not found")
60
- def test_migration_with_exec(self):
61
+ def migration_with_exec(self):
62
"""The test works for both netcat-traditional and netcat-openbsd packages."""
63
free_port = self._get_free_port()
64
dest_uri = 'exec:nc -l localhost %u' % free_port
65
src_uri = 'exec:nc localhost %u' % free_port
66
self.do_migrate(dest_uri, src_uri)
67
+
68
+
69
+@skipUnless('aarch64' in os.uname()[4], "host != target")
70
+class Aarch64(MigrationTest):
71
+ """
72
+ :avocado: tags=arch:aarch64
73
+ :avocado: tags=machine:virt
74
+ :avocado: tags=cpu:max
75
+ """
76
+
77
+ def test_migration_with_tcp_localhost(self):
78
+ self.migration_with_tcp_localhost()
79
+
80
+ def test_migration_with_unix(self):
81
+ self.migration_with_unix()
82
+
83
+ def test_migration_with_exec(self):
84
+ self.migration_with_exec()
85
+
86
+
87
+@skipUnless('x86_64' in os.uname()[4], "host != target")
88
+class X86_64(MigrationTest):
89
+ """
90
+ :avocado: tags=arch:x86_64
91
+ :avocado: tags=machine:pc
92
+ :avocado: tags=cpu:qemu64
93
+ """
94
+
95
+ def test_migration_with_tcp_localhost(self):
96
+ self.migration_with_tcp_localhost()
97
+
98
+ def test_migration_with_unix(self):
99
+ self.migration_with_unix()
100
+
101
+ def test_migration_with_exec(self):
102
+ self.migration_with_exec()
103
+
104
+
105
+@skipUnless('ppc64le' in os.uname()[4], "host != target")
106
+class PPC64(MigrationTest):
107
+ """
108
+ :avocado: tags=arch:ppc64
109
+ :avocado: tags=machine:pseries
110
+ :avocado: tags=cpu:power9_v2.0
111
+ """
112
+
113
+ def test_migration_with_tcp_localhost(self):
114
+ self.migration_with_tcp_localhost()
115
+
116
+ def test_migration_with_unix(self):
117
+ self.migration_with_unix()
118
+
119
+ def test_migration_with_exec(self):
120
+ self.migration_with_exec()
121
+
122
+
123
+@skipUnless('s390x' in os.uname()[4], "host != target")
124
+class S390X(MigrationTest):
125
+ """
126
+ :avocado: tags=arch:s390x
127
+ :avocado: tags=machine:s390-ccw-virtio
128
+ :avocado: tags=cpu:qemu
129
+ """
130
+
131
+ def test_migration_with_tcp_localhost(self):
132
+ self.migration_with_tcp_localhost()
133
+
134
+ def test_migration_with_unix(self):
135
+ self.migration_with_unix()
136
+
137
+ def test_migration_with_exec(self):
138
+ self.migration_with_exec()
139
--
140
2.34.1
141
142
diff view generated by jsdifflib
New patch
1
From: Fabiano Rosas <farosas@suse.de>
1
2
3
We are about to enable the build without TCG, so CONFIG_SEMIHOSTING
4
and CONFIG_ARM_COMPATIBLE_SEMIHOSTING cannot be unconditionally set in
5
default.mak anymore. So reflect the change in a Kconfig.
6
7
Instead of using semihosting/Kconfig, use a target-specific file, so
8
that the change doesn't affect other architectures which might
9
implement semihosting in a way compatible with KVM.
10
11
The selection from ARM_v7M needs to be removed to avoid a cycle during
12
parsing.
13
14
Signed-off-by: Fabiano Rosas <farosas@suse.de>
15
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
16
Message-id: 20230426180013.14814-11-farosas@suse.de
17
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
18
---
19
configs/devices/arm-softmmu/default.mak | 2 --
20
hw/arm/Kconfig | 1 -
21
target/arm/Kconfig | 7 +++++++
22
3 files changed, 7 insertions(+), 3 deletions(-)
23
24
diff --git a/configs/devices/arm-softmmu/default.mak b/configs/devices/arm-softmmu/default.mak
25
index XXXXXXX..XXXXXXX 100644
26
--- a/configs/devices/arm-softmmu/default.mak
27
+++ b/configs/devices/arm-softmmu/default.mak
28
@@ -XXX,XX +XXX,XX @@ CONFIG_MICROBIT=y
29
CONFIG_FSL_IMX25=y
30
CONFIG_FSL_IMX7=y
31
CONFIG_FSL_IMX6UL=y
32
-CONFIG_SEMIHOSTING=y
33
-CONFIG_ARM_COMPATIBLE_SEMIHOSTING=y
34
CONFIG_ALLWINNER_H3=y
35
diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig
36
index XXXXXXX..XXXXXXX 100644
37
--- a/hw/arm/Kconfig
38
+++ b/hw/arm/Kconfig
39
@@ -XXX,XX +XXX,XX @@ config ARM_V7M
40
# currently v7M must be included in a TCG build due to translate.c
41
default y if TCG && (ARM || AARCH64)
42
select PTIMER
43
- select ARM_COMPATIBLE_SEMIHOSTING
44
45
config ALLWINNER_A10
46
bool
47
diff --git a/target/arm/Kconfig b/target/arm/Kconfig
48
index XXXXXXX..XXXXXXX 100644
49
--- a/target/arm/Kconfig
50
+++ b/target/arm/Kconfig
51
@@ -XXX,XX +XXX,XX @@ config ARM
52
config AARCH64
53
bool
54
select ARM
55
+
56
+# This config exists just so we can make SEMIHOSTING default when TCG
57
+# is selected without also changing it for other architectures.
58
+config ARM_SEMIHOSTING
59
+ bool
60
+ default y if TCG && ARM
61
+ select ARM_COMPATIBLE_SEMIHOSTING
62
--
63
2.34.1
diff view generated by jsdifflib
New patch
1
1
From: Fabiano Rosas <farosas@suse.de>
2
3
Move all the CONFIG_FOO=y from default.mak into "default y if TCG"
4
statements in Kconfig. That way they won't be selected when
5
CONFIG_TCG=n.
6
7
I'm leaving CONFIG_ARM_VIRT in default.mak because it allows us to
8
keep the two default.mak files not empty and keep aarch64-default.mak
9
including arm-default.mak. That way we don't surprise anyone that's
10
used to altering these files.
11
12
With this change we can start building with --disable-tcg.
13
14
Signed-off-by: Fabiano Rosas <farosas@suse.de>
15
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
16
Message-id: 20230426180013.14814-12-farosas@suse.de
17
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
18
---
19
configs/devices/aarch64-softmmu/default.mak | 4 --
20
configs/devices/arm-softmmu/default.mak | 37 ------------------
21
hw/arm/Kconfig | 42 ++++++++++++++++++++-
22
3 files changed, 41 insertions(+), 42 deletions(-)
23
24
diff --git a/configs/devices/aarch64-softmmu/default.mak b/configs/devices/aarch64-softmmu/default.mak
25
index XXXXXXX..XXXXXXX 100644
26
--- a/configs/devices/aarch64-softmmu/default.mak
27
+++ b/configs/devices/aarch64-softmmu/default.mak
28
@@ -XXX,XX +XXX,XX @@
29
30
# We support all the 32 bit boards so need all their config
31
include ../arm-softmmu/default.mak
32
-
33
-CONFIG_XLNX_ZYNQMP_ARM=y
34
-CONFIG_XLNX_VERSAL=y
35
-CONFIG_SBSA_REF=y
36
diff --git a/configs/devices/arm-softmmu/default.mak b/configs/devices/arm-softmmu/default.mak
37
index XXXXXXX..XXXXXXX 100644
38
--- a/configs/devices/arm-softmmu/default.mak
39
+++ b/configs/devices/arm-softmmu/default.mak
40
@@ -XXX,XX +XXX,XX @@
41
# CONFIG_TEST_DEVICES=n
42
43
CONFIG_ARM_VIRT=y
44
-CONFIG_CUBIEBOARD=y
45
-CONFIG_EXYNOS4=y
46
-CONFIG_HIGHBANK=y
47
-CONFIG_INTEGRATOR=y
48
-CONFIG_FSL_IMX31=y
49
-CONFIG_MUSICPAL=y
50
-CONFIG_MUSCA=y
51
-CONFIG_CHEETAH=y
52
-CONFIG_SX1=y
53
-CONFIG_NSERIES=y
54
-CONFIG_STELLARIS=y
55
-CONFIG_STM32VLDISCOVERY=y
56
-CONFIG_REALVIEW=y
57
-CONFIG_VERSATILE=y
58
-CONFIG_VEXPRESS=y
59
-CONFIG_ZYNQ=y
60
-CONFIG_MAINSTONE=y
61
-CONFIG_GUMSTIX=y
62
-CONFIG_SPITZ=y
63
-CONFIG_TOSA=y
64
-CONFIG_Z2=y
65
-CONFIG_NPCM7XX=y
66
-CONFIG_COLLIE=y
67
-CONFIG_ASPEED_SOC=y
68
-CONFIG_NETDUINO2=y
69
-CONFIG_NETDUINOPLUS2=y
70
-CONFIG_OLIMEX_STM32_H405=y
71
-CONFIG_MPS2=y
72
-CONFIG_RASPI=y
73
-CONFIG_DIGIC=y
74
-CONFIG_SABRELITE=y
75
-CONFIG_EMCRAFT_SF2=y
76
-CONFIG_MICROBIT=y
77
-CONFIG_FSL_IMX25=y
78
-CONFIG_FSL_IMX7=y
79
-CONFIG_FSL_IMX6UL=y
80
-CONFIG_ALLWINNER_H3=y
81
diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig
82
index XXXXXXX..XXXXXXX 100644
83
--- a/hw/arm/Kconfig
84
+++ b/hw/arm/Kconfig
85
@@ -XXX,XX +XXX,XX @@ config ARM_VIRT
86
87
config CHEETAH
88
bool
89
+ default y if TCG && ARM
90
select OMAP
91
select TSC210X
92
93
config CUBIEBOARD
94
bool
95
+ default y if TCG && ARM
96
select ALLWINNER_A10
97
98
config DIGIC
99
bool
100
+ default y if TCG && ARM
101
select PTIMER
102
select PFLASH_CFI02
103
104
config EXYNOS4
105
bool
106
+ default y if TCG && ARM
107
imply I2C_DEVICES
108
select A9MPCORE
109
select I2C
110
@@ -XXX,XX +XXX,XX @@ config EXYNOS4
111
112
config HIGHBANK
113
bool
114
+ default y if TCG && ARM
115
select A9MPCORE
116
select A15MPCORE
117
select AHCI
118
@@ -XXX,XX +XXX,XX @@ config HIGHBANK
119
120
config INTEGRATOR
121
bool
122
+ default y if TCG && ARM
123
select ARM_TIMER
124
select INTEGRATOR_DEBUG
125
select PL011 # UART
126
@@ -XXX,XX +XXX,XX @@ config INTEGRATOR
127
128
config MAINSTONE
129
bool
130
+ default y if TCG && ARM
131
select PXA2XX
132
select PFLASH_CFI01
133
select SMC91C111
134
135
config MUSCA
136
bool
137
+ default y if TCG && ARM
138
select ARMSSE
139
select PL011
140
select PL031
141
@@ -XXX,XX +XXX,XX @@ config MARVELL_88W8618
142
143
config MUSICPAL
144
bool
145
+ default y if TCG && ARM
146
select OR_IRQ
147
select BITBANG_I2C
148
select MARVELL_88W8618
149
@@ -XXX,XX +XXX,XX @@ config MUSICPAL
150
151
config NETDUINO2
152
bool
153
+ default y if TCG && ARM
154
select STM32F205_SOC
155
156
config NETDUINOPLUS2
157
bool
158
+ default y if TCG && ARM
159
select STM32F405_SOC
160
161
config OLIMEX_STM32_H405
162
bool
163
+ default y if TCG && ARM
164
select STM32F405_SOC
165
166
config NSERIES
167
bool
168
+ default y if TCG && ARM
169
select OMAP
170
select TMP105 # temperature sensor
171
select BLIZZARD # LCD/TV controller
172
@@ -XXX,XX +XXX,XX @@ config PXA2XX
173
174
config GUMSTIX
175
bool
176
+ default y if TCG && ARM
177
select PFLASH_CFI01
178
select SMC91C111
179
select PXA2XX
180
181
config TOSA
182
bool
183
+ default y if TCG && ARM
184
select ZAURUS # scoop
185
select MICRODRIVE
186
select PXA2XX
187
@@ -XXX,XX +XXX,XX @@ config TOSA
188
189
config SPITZ
190
bool
191
+ default y if TCG && ARM
192
select ADS7846 # touch-screen controller
193
select MAX111X # A/D converter
194
select WM8750 # audio codec
195
@@ -XXX,XX +XXX,XX @@ config SPITZ
196
197
config Z2
198
bool
199
+ default y if TCG && ARM
200
select PFLASH_CFI01
201
select WM8750
202
select PL011 # UART
203
@@ -XXX,XX +XXX,XX @@ config Z2
204
205
config REALVIEW
206
bool
207
+ default y if TCG && ARM
208
imply PCI_DEVICES
209
imply PCI_TESTDEV
210
imply I2C_DEVICES
211
@@ -XXX,XX +XXX,XX @@ config REALVIEW
212
213
config SBSA_REF
214
bool
215
+ default y if TCG && AARCH64
216
imply PCI_DEVICES
217
select AHCI
218
select ARM_SMMUV3
219
@@ -XXX,XX +XXX,XX @@ config SBSA_REF
220
221
config SABRELITE
222
bool
223
+ default y if TCG && ARM
224
select FSL_IMX6
225
select SSI_M25P80
226
227
config STELLARIS
228
bool
229
+ default y if TCG && ARM
230
imply I2C_DEVICES
231
select ARM_V7M
232
select CMSDK_APB_WATCHDOG
233
@@ -XXX,XX +XXX,XX @@ config STELLARIS
234
235
config STM32VLDISCOVERY
236
bool
237
+ default y if TCG && ARM
238
select STM32F100_SOC
239
240
config STRONGARM
241
@@ -XXX,XX +XXX,XX @@ config STRONGARM
242
243
config COLLIE
244
bool
245
+ default y if TCG && ARM
246
select PFLASH_CFI01
247
select ZAURUS # scoop
248
select STRONGARM
249
250
config SX1
251
bool
252
+ default y if TCG && ARM
253
select OMAP
254
255
config VERSATILE
256
bool
257
+ default y if TCG && ARM
258
select ARM_TIMER # sp804
259
select PFLASH_CFI01
260
select LSI_SCSI_PCI
261
@@ -XXX,XX +XXX,XX @@ config VERSATILE
262
263
config VEXPRESS
264
bool
265
+ default y if TCG && ARM
266
select A9MPCORE
267
select A15MPCORE
268
select ARM_MPTIMER
269
@@ -XXX,XX +XXX,XX @@ config VEXPRESS
270
271
config ZYNQ
272
bool
273
+ default y if TCG && ARM
274
select A9MPCORE
275
select CADENCE # UART
276
select PFLASH_CFI02
277
@@ -XXX,XX +XXX,XX @@ config ZYNQ
278
config ARM_V7M
279
bool
280
# currently v7M must be included in a TCG build due to translate.c
281
- default y if TCG && (ARM || AARCH64)
282
+ default y if TCG && ARM
283
select PTIMER
284
285
config ALLWINNER_A10
286
@@ -XXX,XX +XXX,XX @@ config ALLWINNER_A10
287
288
config ALLWINNER_H3
289
bool
290
+ default y if TCG && ARM
291
select ALLWINNER_A10_PIT
292
select ALLWINNER_SUN8I_EMAC
293
select ALLWINNER_I2C
294
@@ -XXX,XX +XXX,XX @@ config ALLWINNER_H3
295
296
config RASPI
297
bool
298
+ default y if TCG && ARM
299
select FRAMEBUFFER
300
select PL011 # UART
301
select SDHCI
302
@@ -XXX,XX +XXX,XX @@ config STM32F405_SOC
303
304
config XLNX_ZYNQMP_ARM
305
bool
306
+ default y if TCG && AARCH64
307
select AHCI
308
select ARM_GIC
309
select CADENCE
310
@@ -XXX,XX +XXX,XX @@ config XLNX_ZYNQMP_ARM
311
312
config XLNX_VERSAL
313
bool
314
+ default y if TCG && AARCH64
315
select ARM_GIC
316
select PL011
317
select CADENCE
318
@@ -XXX,XX +XXX,XX @@ config XLNX_VERSAL
319
320
config NPCM7XX
321
bool
322
+ default y if TCG && ARM
323
select A9MPCORE
324
select ADM1272
325
select ARM_GIC
326
@@ -XXX,XX +XXX,XX @@ config NPCM7XX
327
328
config FSL_IMX25
329
bool
330
+ default y if TCG && ARM
331
imply I2C_DEVICES
332
select IMX
333
select IMX_FEC
334
@@ -XXX,XX +XXX,XX @@ config FSL_IMX25
335
336
config FSL_IMX31
337
bool
338
+ default y if TCG && ARM
339
imply I2C_DEVICES
340
select SERIAL
341
select IMX
342
@@ -XXX,XX +XXX,XX @@ config FSL_IMX6
343
344
config ASPEED_SOC
345
bool
346
+ default y if TCG && ARM
347
select DS1338
348
select FTGMAC100
349
select I2C
350
@@ -XXX,XX +XXX,XX @@ config ASPEED_SOC
351
352
config MPS2
353
bool
354
+ default y if TCG && ARM
355
imply I2C_DEVICES
356
select ARMSSE
357
select LAN9118
358
@@ -XXX,XX +XXX,XX @@ config MPS2
359
360
config FSL_IMX7
361
bool
362
+ default y if TCG && ARM
363
imply PCI_DEVICES
364
imply TEST_DEVICES
365
imply I2C_DEVICES
366
@@ -XXX,XX +XXX,XX @@ config ARM_SMMUV3
367
368
config FSL_IMX6UL
369
bool
370
+ default y if TCG && ARM
371
imply I2C_DEVICES
372
select A15MPCORE
373
select IMX
374
@@ -XXX,XX +XXX,XX @@ config FSL_IMX6UL
375
376
config MICROBIT
377
bool
378
+ default y if TCG && ARM
379
select NRF51_SOC
380
381
config NRF51_SOC
382
@@ -XXX,XX +XXX,XX @@ config NRF51_SOC
383
384
config EMCRAFT_SF2
385
bool
386
+ default y if TCG && ARM
387
select MSF2
388
select SSI_M25P80
389
390
--
391
2.34.1
diff view generated by jsdifflib
New patch
1
From: Fabiano Rosas <farosas@suse.de>
1
2
3
The test set -accel tcg, so restrict it to when TCG is present.
4
5
Signed-off-by: Fabiano Rosas <farosas@suse.de>
6
Reviewed-by: Thomas Huth <thuth@redhat.com>
7
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
8
Message-id: 20230426180013.14814-13-farosas@suse.de
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
---
11
tests/qtest/meson.build | 3 ++-
12
1 file changed, 2 insertions(+), 1 deletion(-)
13
14
diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build
15
index XXXXXXX..XXXXXXX 100644
16
--- a/tests/qtest/meson.build
17
+++ b/tests/qtest/meson.build
18
@@ -XXX,XX +XXX,XX @@ qtests_aarch64 = \
19
['tpm-tis-device-test', 'tpm-tis-device-swtpm-test'] : []) + \
20
(config_all_devices.has_key('CONFIG_XLNX_ZYNQMP_ARM') ? ['xlnx-can-test', 'fuzz-xlnx-dp-test'] : []) + \
21
(config_all_devices.has_key('CONFIG_RASPI') ? ['bcm2835-dma-test'] : []) + \
22
- (config_all_devices.has_key('CONFIG_TPM_TIS_I2C') ? ['tpm-tis-i2c-test'] : []) + \
23
+ (config_all.has_key('CONFIG_TCG') and \
24
+ config_all_devices.has_key('CONFIG_TPM_TIS_I2C') ? ['tpm-tis-i2c-test'] : []) + \
25
['arm-cpu-features',
26
'numa-test',
27
'boot-serial-test',
28
--
29
2.34.1
diff view generated by jsdifflib
New patch
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
1
2
3
Add a manual new job to cross-build the aarch64 target with
4
only the KVM accelerator enabled (in particular, no TCG).
5
6
Re-enable running the similar job on the project Aarch64
7
custom runner.
8
9
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
10
Signed-off-by: Fabiano Rosas <farosas@suse.de>
11
Reviewed-by: Thomas Huth <thuth@redhat.com>
12
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
13
Message-id: 20230426180013.14814-14-farosas@suse.de
14
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
15
---
16
.gitlab-ci.d/crossbuilds.yml | 11 +++++++++++
17
.gitlab-ci.d/custom-runners/ubuntu-22.04-aarch64.yml | 4 ----
18
2 files changed, 11 insertions(+), 4 deletions(-)
19
20
diff --git a/.gitlab-ci.d/crossbuilds.yml b/.gitlab-ci.d/crossbuilds.yml
21
index XXXXXXX..XXXXXXX 100644
22
--- a/.gitlab-ci.d/crossbuilds.yml
23
+++ b/.gitlab-ci.d/crossbuilds.yml
24
@@ -XXX,XX +XXX,XX @@ cross-arm64-xen-only:
25
IMAGE: debian-arm64-cross
26
ACCEL: xen
27
EXTRA_CONFIGURE_OPTS: --disable-tcg --disable-kvm
28
+
29
+# Similar job is run by qemu-project's custom runner by default
30
+cross-arm64-kvm-only:
31
+ extends: .cross_accel_build_job
32
+ needs:
33
+ job: arm64-debian-cross-container
34
+ variables:
35
+ QEMU_JOB_OPTIONAL: 1
36
+ IMAGE: debian-arm64-cross
37
+ ACCEL: kvm
38
+ EXTRA_CONFIGURE_OPTS: --disable-tcg --disable-xen --without-default-devices
39
diff --git a/.gitlab-ci.d/custom-runners/ubuntu-22.04-aarch64.yml b/.gitlab-ci.d/custom-runners/ubuntu-22.04-aarch64.yml
40
index XXXXXXX..XXXXXXX 100644
41
--- a/.gitlab-ci.d/custom-runners/ubuntu-22.04-aarch64.yml
42
+++ b/.gitlab-ci.d/custom-runners/ubuntu-22.04-aarch64.yml
43
@@ -XXX,XX +XXX,XX @@ ubuntu-22.04-aarch64-notcg:
44
- aarch64
45
rules:
46
- if: '$CI_PROJECT_NAMESPACE == "qemu-project" && $CI_COMMIT_BRANCH =~ /^staging/'
47
- when: manual
48
- allow_failure: true
49
- if: "$AARCH64_RUNNER_AVAILABLE"
50
- when: manual
51
- allow_failure: true
52
script:
53
- mkdir build
54
- cd build
55
--
56
2.34.1
57
58
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
1
From: Patrick Venture <venture@google.com>
2
2
3
Per the Physical Layer Simplified Spec. "4.3.10.4 Switch Function Status":
3
The MAC address set from Qemu wasn't being saved into the register space.
4
4
5
The block length is predefined to 512 bits
5
Reviewed-by: Hao Wu <wuhaotsh@google.com>
6
6
Signed-off-by: Patrick Venture <venture@google.com>
7
and "4.10.2 SD Status":
7
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
8
9
The SD Status contains status bits that are related to the SD Memory Card
10
proprietary features and may be used for future application-specific usage.
11
The size of the SD Status is one data block of 512 bit. The content of this
12
register is transmitted to the Host over the DAT bus along with a 16-bit CRC.
13
14
Thus the 16-bit CRC goes at offset 64.
15
16
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
17
Message-id: 20180509060104.4458-3-f4bug@amsat.org
18
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
8
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
9
[PMM: moved variable declaration to top of function]
19
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
20
---
11
---
21
hw/sd/sd.c | 2 +-
12
hw/net/npcm7xx_emc.c | 32 +++++++++++++++++++++++++-------
22
1 file changed, 1 insertion(+), 1 deletion(-)
13
1 file changed, 25 insertions(+), 7 deletions(-)
23
14
24
diff --git a/hw/sd/sd.c b/hw/sd/sd.c
15
diff --git a/hw/net/npcm7xx_emc.c b/hw/net/npcm7xx_emc.c
25
index XXXXXXX..XXXXXXX 100644
16
index XXXXXXX..XXXXXXX 100644
26
--- a/hw/sd/sd.c
17
--- a/hw/net/npcm7xx_emc.c
27
+++ b/hw/sd/sd.c
18
+++ b/hw/net/npcm7xx_emc.c
28
@@ -XXX,XX +XXX,XX @@ static void sd_function_switch(SDState *sd, uint32_t arg)
19
@@ -XXX,XX +XXX,XX @@ static const char *emc_reg_name(int regno)
29
sd->data[14 + (i >> 1)] = new_func << ((i * 4) & 4);
20
30
}
21
static void emc_reset(NPCM7xxEMCState *emc)
31
memset(&sd->data[17], 0, 47);
22
{
32
- stw_be_p(sd->data + 65, sd_crc16(sd->data, 64));
23
+ uint32_t value;
33
+ stw_be_p(sd->data + 64, sd_crc16(sd->data, 64));
24
+
25
trace_npcm7xx_emc_reset(emc->emc_num);
26
27
memset(&emc->regs[0], 0, sizeof(emc->regs));
28
@@ -XXX,XX +XXX,XX @@ static void emc_reset(NPCM7xxEMCState *emc)
29
30
emc->tx_active = false;
31
emc->rx_active = false;
32
+
33
+ /* Set the MAC address in the register space. */
34
+ value = (emc->conf.macaddr.a[0] << 24) |
35
+ (emc->conf.macaddr.a[1] << 16) |
36
+ (emc->conf.macaddr.a[2] << 8) |
37
+ emc->conf.macaddr.a[3];
38
+ emc->regs[REG_CAMM_BASE] = value;
39
+
40
+ value = (emc->conf.macaddr.a[4] << 24) | (emc->conf.macaddr.a[5] << 16);
41
+ emc->regs[REG_CAML_BASE] = value;
34
}
42
}
35
43
36
static inline bool sd_wp_addr(SDState *sd, uint64_t addr)
44
static void npcm7xx_emc_reset(DeviceState *dev)
45
@@ -XXX,XX +XXX,XX @@ static bool emc_receive_filter1(NPCM7xxEMCState *emc, const uint8_t *buf,
46
}
47
case ETH_PKT_UCAST: {
48
bool matches;
49
+ uint32_t value;
50
+ struct MACAddr mac;
51
if (emc->regs[REG_CAMCMR] & REG_CAMCMR_AUP) {
52
return true;
53
}
54
+
55
+ value = emc->regs[REG_CAMM_BASE];
56
+ mac.a[0] = value >> 24;
57
+ mac.a[1] = value >> 16;
58
+ mac.a[2] = value >> 8;
59
+ mac.a[3] = value >> 0;
60
+ value = emc->regs[REG_CAML_BASE];
61
+ mac.a[4] = value >> 24;
62
+ mac.a[5] = value >> 16;
63
+
64
matches = ((emc->regs[REG_CAMCMR] & REG_CAMCMR_ECMP) &&
65
/* We only support one CAM register, CAM0. */
66
(emc->regs[REG_CAMEN] & (1 << 0)) &&
67
- memcmp(buf, emc->conf.macaddr.a, ETH_ALEN) == 0);
68
+ memcmp(buf, mac.a, ETH_ALEN) == 0);
69
if (emc->regs[REG_CAMCMR] & REG_CAMCMR_CCAM) {
70
*fail_reason = "MACADDR matched, comparison complemented";
71
return !matches;
72
@@ -XXX,XX +XXX,XX @@ static void npcm7xx_emc_write(void *opaque, hwaddr offset,
73
break;
74
case REG_CAMM_BASE + 0:
75
emc->regs[reg] = value;
76
- emc->conf.macaddr.a[0] = value >> 24;
77
- emc->conf.macaddr.a[1] = value >> 16;
78
- emc->conf.macaddr.a[2] = value >> 8;
79
- emc->conf.macaddr.a[3] = value >> 0;
80
break;
81
case REG_CAML_BASE + 0:
82
emc->regs[reg] = value;
83
- emc->conf.macaddr.a[4] = value >> 24;
84
- emc->conf.macaddr.a[5] = value >> 16;
85
break;
86
case REG_MCMDR: {
87
uint32_t prev;
37
--
88
--
38
2.17.0
89
2.34.1
39
90
40
91
diff view generated by jsdifflib
New patch
1
From: Daniel Bertalan <dani@danielbertalan.dev>
1
2
3
This query copies the kernel command line into the message buffer. It
4
was previously stubbed out to return empty, this commit makes it reflect
5
the arguments specified with `-append`.
6
7
I observed the following peculiarities on my Pi 3B+:
8
- If the buffer is shorter than the string, the response header gives
9
the full length, but no data is actually copied.
10
- No NUL terminator is added: even if the buffer is long enough to fit
11
one, the buffer's original contents are preserved past the string's
12
end.
13
- The VC firmware adds the following extra parameters beside the
14
user-supplied ones (via /boot/cmdline.txt): `video`, `vc_mem.mem_base`
15
and `vc_mem.mem_size`. This is currently not implemented in qemu.
16
17
Signed-off-by: Daniel Bertalan <dani@danielbertalan.dev>
18
Message-id: 20230425103250.56653-1-dani@danielbertalan.dev
19
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
20
[PMM: added comment about NUL and short-buffer behaviour]
21
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
22
---
23
include/hw/misc/bcm2835_property.h | 1 +
24
hw/arm/bcm2835_peripherals.c | 2 ++
25
hw/arm/bcm2836.c | 2 ++
26
hw/arm/raspi.c | 2 ++
27
hw/misc/bcm2835_property.c | 13 ++++++++++++-
28
5 files changed, 19 insertions(+), 1 deletion(-)
29
30
diff --git a/include/hw/misc/bcm2835_property.h b/include/hw/misc/bcm2835_property.h
31
index XXXXXXX..XXXXXXX 100644
32
--- a/include/hw/misc/bcm2835_property.h
33
+++ b/include/hw/misc/bcm2835_property.h
34
@@ -XXX,XX +XXX,XX @@ struct BCM2835PropertyState {
35
MACAddr macaddr;
36
uint32_t board_rev;
37
uint32_t addr;
38
+ char *command_line;
39
bool pending;
40
};
41
42
diff --git a/hw/arm/bcm2835_peripherals.c b/hw/arm/bcm2835_peripherals.c
43
index XXXXXXX..XXXXXXX 100644
44
--- a/hw/arm/bcm2835_peripherals.c
45
+++ b/hw/arm/bcm2835_peripherals.c
46
@@ -XXX,XX +XXX,XX @@ static void bcm2835_peripherals_init(Object *obj)
47
TYPE_BCM2835_PROPERTY);
48
object_property_add_alias(obj, "board-rev", OBJECT(&s->property),
49
"board-rev");
50
+ object_property_add_alias(obj, "command-line", OBJECT(&s->property),
51
+ "command-line");
52
53
object_property_add_const_link(OBJECT(&s->property), "fb",
54
OBJECT(&s->fb));
55
diff --git a/hw/arm/bcm2836.c b/hw/arm/bcm2836.c
56
index XXXXXXX..XXXXXXX 100644
57
--- a/hw/arm/bcm2836.c
58
+++ b/hw/arm/bcm2836.c
59
@@ -XXX,XX +XXX,XX @@ static void bcm2836_init(Object *obj)
60
TYPE_BCM2835_PERIPHERALS);
61
object_property_add_alias(obj, "board-rev", OBJECT(&s->peripherals),
62
"board-rev");
63
+ object_property_add_alias(obj, "command-line", OBJECT(&s->peripherals),
64
+ "command-line");
65
object_property_add_alias(obj, "vcram-size", OBJECT(&s->peripherals),
66
"vcram-size");
67
}
68
diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c
69
index XXXXXXX..XXXXXXX 100644
70
--- a/hw/arm/raspi.c
71
+++ b/hw/arm/raspi.c
72
@@ -XXX,XX +XXX,XX @@ static void raspi_machine_init(MachineState *machine)
73
object_property_add_const_link(OBJECT(&s->soc), "ram", OBJECT(machine->ram));
74
object_property_set_int(OBJECT(&s->soc), "board-rev", board_rev,
75
&error_abort);
76
+ object_property_set_str(OBJECT(&s->soc), "command-line",
77
+ machine->kernel_cmdline, &error_abort);
78
qdev_realize(DEVICE(&s->soc), NULL, &error_fatal);
79
80
/* Create and plug in the SD cards */
81
diff --git a/hw/misc/bcm2835_property.c b/hw/misc/bcm2835_property.c
82
index XXXXXXX..XXXXXXX 100644
83
--- a/hw/misc/bcm2835_property.c
84
+++ b/hw/misc/bcm2835_property.c
85
@@ -XXX,XX +XXX,XX @@ static void bcm2835_property_mbox_push(BCM2835PropertyState *s, uint32_t value)
86
break;
87
88
case 0x00050001: /* Get command line */
89
- resplen = 0;
90
+ /*
91
+ * We follow the firmware behaviour: no NUL terminator is
92
+ * written to the buffer, and if the buffer is too short
93
+ * we report the required length in the response header
94
+ * and copy nothing to the buffer.
95
+ */
96
+ resplen = strlen(s->command_line);
97
+ if (bufsize >= resplen)
98
+ address_space_write(&s->dma_as, value + 12,
99
+ MEMTXATTRS_UNSPECIFIED, s->command_line,
100
+ resplen);
101
break;
102
103
default:
104
@@ -XXX,XX +XXX,XX @@ static void bcm2835_property_realize(DeviceState *dev, Error **errp)
105
106
static Property bcm2835_property_props[] = {
107
DEFINE_PROP_UINT32("board-rev", BCM2835PropertyState, board_rev, 0),
108
+ DEFINE_PROP_STRING("command-line", BCM2835PropertyState, command_line),
109
DEFINE_PROP_END_OF_LIST()
110
};
111
112
--
113
2.34.1
diff view generated by jsdifflib
New patch
1
1
This commit adds 'one-insn-per-tb' as a property on the TCG
2
accelerator object, so you can enable it with
3
-accel tcg,one-insn-per-tb=on
4
5
It has the same behaviour as the existing '-singlestep' command line
6
option. We use a different name because 'singlestep' has always been
7
a confusing choice, because it doesn't have anything to do with
8
single-stepping the CPU. What it does do is force TCG emulation to
9
put one guest instruction in each TB, which can be useful in some
10
situations (such as analysing debug logs).
11
12
The existing '-singlestep' commandline options are decoupled from the
13
global 'singlestep' variable and instead now are syntactic sugar for
14
setting the accel property. (These can then go away after a
15
deprecation period.)
16
17
The global variable remains for the moment as:
18
* what the TCG code looks at to change its behaviour
19
* what HMP and QMP use to query and set the behaviour
20
21
In the following commits we'll clean those up to not directly
22
look at the global variable.
23
24
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
25
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
26
Message-id: 20230417164041.684562-2-peter.maydell@linaro.org
27
---
28
accel/tcg/tcg-all.c | 21 +++++++++++++++++++++
29
bsd-user/main.c | 8 ++++++--
30
linux-user/main.c | 8 ++++++--
31
softmmu/vl.c | 17 +++++++++++++++--
32
qemu-options.hx | 7 +++++++
33
5 files changed, 55 insertions(+), 6 deletions(-)
34
35
diff --git a/accel/tcg/tcg-all.c b/accel/tcg/tcg-all.c
36
index XXXXXXX..XXXXXXX 100644
37
--- a/accel/tcg/tcg-all.c
38
+++ b/accel/tcg/tcg-all.c
39
@@ -XXX,XX +XXX,XX @@ struct TCGState {
40
AccelState parent_obj;
41
42
bool mttcg_enabled;
43
+ bool one_insn_per_tb;
44
int splitwx_enabled;
45
unsigned long tb_size;
46
};
47
@@ -XXX,XX +XXX,XX @@ static void tcg_set_splitwx(Object *obj, bool value, Error **errp)
48
s->splitwx_enabled = value;
49
}
50
51
+static bool tcg_get_one_insn_per_tb(Object *obj, Error **errp)
52
+{
53
+ TCGState *s = TCG_STATE(obj);
54
+ return s->one_insn_per_tb;
55
+}
56
+
57
+static void tcg_set_one_insn_per_tb(Object *obj, bool value, Error **errp)
58
+{
59
+ TCGState *s = TCG_STATE(obj);
60
+ s->one_insn_per_tb = value;
61
+ /* For the moment, set the global also: this changes the behaviour */
62
+ singlestep = value;
63
+}
64
+
65
static int tcg_gdbstub_supported_sstep_flags(void)
66
{
67
/*
68
@@ -XXX,XX +XXX,XX @@ static void tcg_accel_class_init(ObjectClass *oc, void *data)
69
tcg_get_splitwx, tcg_set_splitwx);
70
object_class_property_set_description(oc, "split-wx",
71
"Map jit pages into separate RW and RX regions");
72
+
73
+ object_class_property_add_bool(oc, "one-insn-per-tb",
74
+ tcg_get_one_insn_per_tb,
75
+ tcg_set_one_insn_per_tb);
76
+ object_class_property_set_description(oc, "one-insn-per-tb",
77
+ "Only put one guest insn in each translation block");
78
}
79
80
static const TypeInfo tcg_accel_type = {
81
diff --git a/bsd-user/main.c b/bsd-user/main.c
82
index XXXXXXX..XXXXXXX 100644
83
--- a/bsd-user/main.c
84
+++ b/bsd-user/main.c
85
@@ -XXX,XX +XXX,XX @@
86
#include "target_arch_cpu.h"
87
88
int singlestep;
89
+static bool opt_one_insn_per_tb;
90
uintptr_t guest_base;
91
bool have_guest_base;
92
/*
93
@@ -XXX,XX +XXX,XX @@ int main(int argc, char **argv)
94
} else if (!strcmp(r, "seed")) {
95
seed_optarg = optarg;
96
} else if (!strcmp(r, "singlestep")) {
97
- singlestep = 1;
98
+ opt_one_insn_per_tb = true;
99
} else if (!strcmp(r, "strace")) {
100
do_strace = 1;
101
} else if (!strcmp(r, "trace")) {
102
@@ -XXX,XX +XXX,XX @@ int main(int argc, char **argv)
103
104
/* init tcg before creating CPUs and to get qemu_host_page_size */
105
{
106
- AccelClass *ac = ACCEL_GET_CLASS(current_accel());
107
+ AccelState *accel = current_accel();
108
+ AccelClass *ac = ACCEL_GET_CLASS(accel);
109
110
accel_init_interfaces(ac);
111
+ object_property_set_bool(OBJECT(accel), "one-insn-per-tb",
112
+ opt_one_insn_per_tb, &error_abort);
113
ac->init_machine(NULL);
114
}
115
cpu = cpu_create(cpu_type);
116
diff --git a/linux-user/main.c b/linux-user/main.c
117
index XXXXXXX..XXXXXXX 100644
118
--- a/linux-user/main.c
119
+++ b/linux-user/main.c
120
@@ -XXX,XX +XXX,XX @@ char *exec_path;
121
char real_exec_path[PATH_MAX];
122
123
int singlestep;
124
+static bool opt_one_insn_per_tb;
125
static const char *argv0;
126
static const char *gdbstub;
127
static envlist_t *envlist;
128
@@ -XXX,XX +XXX,XX @@ static void handle_arg_reserved_va(const char *arg)
129
130
static void handle_arg_singlestep(const char *arg)
131
{
132
- singlestep = 1;
133
+ opt_one_insn_per_tb = true;
134
}
135
136
static void handle_arg_strace(const char *arg)
137
@@ -XXX,XX +XXX,XX @@ int main(int argc, char **argv, char **envp)
138
139
/* init tcg before creating CPUs and to get qemu_host_page_size */
140
{
141
- AccelClass *ac = ACCEL_GET_CLASS(current_accel());
142
+ AccelState *accel = current_accel();
143
+ AccelClass *ac = ACCEL_GET_CLASS(accel);
144
145
accel_init_interfaces(ac);
146
+ object_property_set_bool(OBJECT(accel), "one-insn-per-tb",
147
+ opt_one_insn_per_tb, &error_abort);
148
ac->init_machine(NULL);
149
}
150
cpu = cpu_create(cpu_type);
151
diff --git a/softmmu/vl.c b/softmmu/vl.c
152
index XXXXXXX..XXXXXXX 100644
153
--- a/softmmu/vl.c
154
+++ b/softmmu/vl.c
155
@@ -XXX,XX +XXX,XX @@ static const char *log_file;
156
static bool list_data_dirs;
157
static const char *qtest_chrdev;
158
static const char *qtest_log;
159
+static bool opt_one_insn_per_tb;
160
161
static int has_defaults = 1;
162
static int default_serial = 1;
163
@@ -XXX,XX +XXX,XX @@ static int do_configure_accelerator(void *opaque, QemuOpts *opts, Error **errp)
164
qemu_opt_foreach(opts, accelerator_set_property,
165
accel,
166
&error_fatal);
167
-
168
+ /*
169
+ * If legacy -singlestep option is set, honour it for TCG and
170
+ * silently ignore for any other accelerator (which is how this
171
+ * option has always behaved).
172
+ */
173
+ if (opt_one_insn_per_tb) {
174
+ /*
175
+ * This will always succeed for TCG, and we want to ignore
176
+ * the error from trying to set a nonexistent property
177
+ * on any other accelerator.
178
+ */
179
+ object_property_set_bool(OBJECT(accel), "one-insn-per-tb", true, NULL);
180
+ }
181
ret = accel_init_machine(accel, current_machine);
182
if (ret < 0) {
183
if (!qtest_with_kvm || ret != -ENOENT) {
184
@@ -XXX,XX +XXX,XX @@ void qemu_init(int argc, char **argv)
185
qdict_put_str(machine_opts_dict, "firmware", optarg);
186
break;
187
case QEMU_OPTION_singlestep:
188
- singlestep = 1;
189
+ opt_one_insn_per_tb = true;
190
break;
191
case QEMU_OPTION_S:
192
autostart = 0;
193
diff --git a/qemu-options.hx b/qemu-options.hx
194
index XXXXXXX..XXXXXXX 100644
195
--- a/qemu-options.hx
196
+++ b/qemu-options.hx
197
@@ -XXX,XX +XXX,XX @@ DEF("accel", HAS_ARG, QEMU_OPTION_accel,
198
" igd-passthru=on|off (enable Xen integrated Intel graphics passthrough, default=off)\n"
199
" kernel-irqchip=on|off|split controls accelerated irqchip support (default=on)\n"
200
" kvm-shadow-mem=size of KVM shadow MMU in bytes\n"
201
+ " one-insn-per-tb=on|off (one guest instruction per TCG translation block)\n"
202
" split-wx=on|off (enable TCG split w^x mapping)\n"
203
" tb-size=n (TCG translation block cache size)\n"
204
" dirty-ring-size=n (KVM dirty ring GFN count, default 0)\n"
205
@@ -XXX,XX +XXX,XX @@ SRST
206
``kvm-shadow-mem=size``
207
Defines the size of the KVM shadow MMU.
208
209
+ ``one-insn-per-tb=on|off``
210
+ Makes the TCG accelerator put only one guest instruction into
211
+ each translation block. This slows down emulation a lot, but
212
+ can be useful in some situations, such as when trying to analyse
213
+ the logs produced by the ``-d`` option.
214
+
215
``split-wx=on|off``
216
Controls the use of split w^x mapping for the TCG code generation
217
buffer. Some operating systems require this to be enabled, and in
218
--
219
2.34.1
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
The HMP 'singlestep' command, the QMP 'query-status' command and the
2
HMP 'info status' command (which is just wrapping the QMP command
3
implementation) look at the 'singlestep' global variable. Make them
4
access the new TCG accelerator 'one-insn-per-tb' property instead.
2
5
3
Cc: qemu-stable@nongnu.org
6
This leaves the HMP and QMP command/field names and output strings
4
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
7
unchanged; we will clean that up later.
5
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8
6
Tested-by: Alex Bennée <alex.bennee@linaro.org>
7
Message-id: 20180512003217.9105-5-richard.henderson@linaro.org
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
11
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
12
Message-id: 20230417164041.684562-3-peter.maydell@linaro.org
9
---
13
---
10
target/arm/translate-a64.c | 17 +++++++++++++++--
14
softmmu/runstate-hmp-cmds.c | 18 ++++++++++++++++--
11
1 file changed, 15 insertions(+), 2 deletions(-)
15
softmmu/runstate.c | 10 +++++++++-
16
2 files changed, 25 insertions(+), 3 deletions(-)
12
17
13
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
18
diff --git a/softmmu/runstate-hmp-cmds.c b/softmmu/runstate-hmp-cmds.c
14
index XXXXXXX..XXXXXXX 100644
19
index XXXXXXX..XXXXXXX 100644
15
--- a/target/arm/translate-a64.c
20
--- a/softmmu/runstate-hmp-cmds.c
16
+++ b/target/arm/translate-a64.c
21
+++ b/softmmu/runstate-hmp-cmds.c
17
@@ -XXX,XX +XXX,XX @@ static void disas_fp_fixed_conv(DisasContext *s, uint32_t insn)
22
@@ -XXX,XX +XXX,XX @@
18
bool sf = extract32(insn, 31, 1);
23
#include "qapi/error.h"
19
bool itof;
24
#include "qapi/qapi-commands-run-state.h"
20
25
#include "qapi/qmp/qdict.h"
21
- if (sbit || (type > 1)
26
+#include "qemu/accel.h"
22
- || (!sf && scale < 32)) {
27
23
+ if (sbit || (!sf && scale < 32)) {
28
void hmp_info_status(Monitor *mon, const QDict *qdict)
24
+ unallocated_encoding(s);
29
{
30
@@ -XXX,XX +XXX,XX @@ void hmp_info_status(Monitor *mon, const QDict *qdict)
31
void hmp_singlestep(Monitor *mon, const QDict *qdict)
32
{
33
const char *option = qdict_get_try_str(qdict, "option");
34
+ AccelState *accel = current_accel();
35
+ bool newval;
36
+
37
+ if (!object_property_find(OBJECT(accel), "one-insn-per-tb")) {
38
+ monitor_printf(mon,
39
+ "This accelerator does not support setting one-insn-per-tb\n");
25
+ return;
40
+ return;
26
+ }
41
+ }
27
+
42
+
28
+ switch (type) {
43
if (!option || !strcmp(option, "on")) {
29
+ case 0: /* float32 */
44
- singlestep = 1;
30
+ case 1: /* float64 */
45
+ newval = true;
31
+ break;
46
} else if (!strcmp(option, "off")) {
32
+ case 3: /* float16 */
47
- singlestep = 0;
33
+ if (arm_dc_feature(s, ARM_FEATURE_V8_FP16)) {
48
+ newval = false;
34
+ break;
49
} else {
35
+ }
50
monitor_printf(mon, "unexpected option %s\n", option);
36
+ /* fallthru */
51
+ return;
37
+ default:
38
unallocated_encoding(s);
39
return;
40
}
52
}
53
+ /* If the property exists then setting it can never fail */
54
+ object_property_set_bool(OBJECT(accel), "one-insn-per-tb",
55
+ newval, &error_abort);
56
}
57
58
void hmp_watchdog_action(Monitor *mon, const QDict *qdict)
59
diff --git a/softmmu/runstate.c b/softmmu/runstate.c
60
index XXXXXXX..XXXXXXX 100644
61
--- a/softmmu/runstate.c
62
+++ b/softmmu/runstate.c
63
@@ -XXX,XX +XXX,XX @@
64
#include "qapi/error.h"
65
#include "qapi/qapi-commands-run-state.h"
66
#include "qapi/qapi-events-run-state.h"
67
+#include "qemu/accel.h"
68
#include "qemu/error-report.h"
69
#include "qemu/job.h"
70
#include "qemu/log.h"
71
@@ -XXX,XX +XXX,XX @@ bool runstate_needs_reset(void)
72
StatusInfo *qmp_query_status(Error **errp)
73
{
74
StatusInfo *info = g_malloc0(sizeof(*info));
75
+ AccelState *accel = current_accel();
76
77
+ /*
78
+ * We ignore errors, which will happen if the accelerator
79
+ * is not TCG. "singlestep" is meaningless for other accelerators,
80
+ * so we will set the StatusInfo field to false for those.
81
+ */
82
+ info->singlestep = object_property_get_bool(OBJECT(accel),
83
+ "one-insn-per-tb", NULL);
84
info->running = runstate_is_running();
85
- info->singlestep = singlestep;
86
info->status = current_run_state;
87
88
return info;
41
--
89
--
42
2.17.0
90
2.34.1
43
91
44
92
diff view generated by jsdifflib
1
Usually the logging of the CPU state produced by -d cpu is sufficient
1
The only place left that looks at the old 'singlestep' global
2
to diagnose problems, but sometimes you want to see the state of
2
variable is the TCG curr_cflags() function. Replace the old global
3
the floating point registers as well. We don't want to enable that
3
with a new 'one_insn_per_tb' which is defined in tcg-all.c and
4
by default as it adds a lot of extra data to the log; instead,
4
declared in accel/tcg/internal.h. This keeps it restricted to the
5
allow it to be optionally enabled via -d fpu.
5
TCG code, unlike 'singlestep' which was available to every file in
6
the system and defined in multiple different places for softmmu vs
7
linux-user vs bsd-user.
8
9
While we're making this change, use qatomic_read() and qatomic_set()
10
on the accesses to the new global, because TCG will read it without
11
holding a lock.
6
12
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
14
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
9
Message-id: 20180510130024.31678-1-peter.maydell@linaro.org
15
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
16
Message-id: 20230417164041.684562-4-peter.maydell@linaro.org
10
---
17
---
11
include/qemu/log.h | 1 +
18
accel/tcg/internal.h | 2 ++
12
accel/tcg/cpu-exec.c | 9 ++++++---
19
include/exec/cpu-common.h | 2 --
13
util/log.c | 2 ++
20
accel/tcg/cpu-exec.c | 2 +-
14
3 files changed, 9 insertions(+), 3 deletions(-)
21
accel/tcg/tcg-all.c | 6 ++++--
22
bsd-user/main.c | 1 -
23
linux-user/main.c | 1 -
24
softmmu/globals.c | 1 -
25
7 files changed, 7 insertions(+), 8 deletions(-)
15
26
16
diff --git a/include/qemu/log.h b/include/qemu/log.h
27
diff --git a/accel/tcg/internal.h b/accel/tcg/internal.h
17
index XXXXXXX..XXXXXXX 100644
28
index XXXXXXX..XXXXXXX 100644
18
--- a/include/qemu/log.h
29
--- a/accel/tcg/internal.h
19
+++ b/include/qemu/log.h
30
+++ b/accel/tcg/internal.h
20
@@ -XXX,XX +XXX,XX @@ static inline bool qemu_log_separate(void)
31
@@ -XXX,XX +XXX,XX @@ static inline target_ulong log_pc(CPUState *cpu, const TranslationBlock *tb)
21
#define CPU_LOG_PAGE (1 << 14)
32
extern int64_t max_delay;
22
/* LOG_TRACE (1 << 15) is defined in log-for-trace.h */
33
extern int64_t max_advance;
23
#define CPU_LOG_TB_OP_IND (1 << 16)
34
24
+#define CPU_LOG_TB_FPU (1 << 17)
35
+extern bool one_insn_per_tb;
25
36
+
26
/* Lock output for a series of related logs. Since this is not needed
37
#endif /* ACCEL_TCG_INTERNAL_H */
27
* for a single qemu_log / qemu_log_mask / qemu_log_mask_and_addr, we
38
diff --git a/include/exec/cpu-common.h b/include/exec/cpu-common.h
39
index XXXXXXX..XXXXXXX 100644
40
--- a/include/exec/cpu-common.h
41
+++ b/include/exec/cpu-common.h
42
@@ -XXX,XX +XXX,XX @@ int cpu_memory_rw_debug(CPUState *cpu, vaddr addr,
43
void *ptr, size_t len, bool is_write);
44
45
/* vl.c */
46
-extern int singlestep;
47
-
48
void list_cpus(void);
49
50
#endif /* CPU_COMMON_H */
28
diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c
51
diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c
29
index XXXXXXX..XXXXXXX 100644
52
index XXXXXXX..XXXXXXX 100644
30
--- a/accel/tcg/cpu-exec.c
53
--- a/accel/tcg/cpu-exec.c
31
+++ b/accel/tcg/cpu-exec.c
54
+++ b/accel/tcg/cpu-exec.c
32
@@ -XXX,XX +XXX,XX @@ static inline tcg_target_ulong cpu_tb_exec(CPUState *cpu, TranslationBlock *itb)
55
@@ -XXX,XX +XXX,XX @@ uint32_t curr_cflags(CPUState *cpu)
33
if (qemu_loglevel_mask(CPU_LOG_TB_CPU)
56
*/
34
&& qemu_log_in_addr_range(itb->pc)) {
57
if (unlikely(cpu->singlestep_enabled)) {
35
qemu_log_lock();
58
cflags |= CF_NO_GOTO_TB | CF_NO_GOTO_PTR | CF_SINGLE_STEP | 1;
36
+ int flags = 0;
59
- } else if (singlestep) {
37
+ if (qemu_loglevel_mask(CPU_LOG_TB_FPU)) {
60
+ } else if (qatomic_read(&one_insn_per_tb)) {
38
+ flags |= CPU_DUMP_FPU;
61
cflags |= CF_NO_GOTO_TB | 1;
39
+ }
62
} else if (qemu_loglevel_mask(CPU_LOG_TB_NOCHAIN)) {
40
#if defined(TARGET_I386)
63
cflags |= CF_NO_GOTO_TB;
41
- log_cpu_state(cpu, CPU_DUMP_CCOP);
64
diff --git a/accel/tcg/tcg-all.c b/accel/tcg/tcg-all.c
42
-#else
43
- log_cpu_state(cpu, 0);
44
+ flags |= CPU_DUMP_CCOP;
45
#endif
46
+ log_cpu_state(cpu, flags);
47
qemu_log_unlock();
48
}
49
#endif /* DEBUG_DISAS */
50
diff --git a/util/log.c b/util/log.c
51
index XXXXXXX..XXXXXXX 100644
65
index XXXXXXX..XXXXXXX 100644
52
--- a/util/log.c
66
--- a/accel/tcg/tcg-all.c
53
+++ b/util/log.c
67
+++ b/accel/tcg/tcg-all.c
54
@@ -XXX,XX +XXX,XX @@ const QEMULogItem qemu_log_items[] = {
68
@@ -XXX,XX +XXX,XX @@
55
"show trace before each executed TB (lots of logs)" },
69
#include "qapi/error.h"
56
{ CPU_LOG_TB_CPU, "cpu",
70
#include "qemu/error-report.h"
57
"show CPU registers before entering a TB (lots of logs)" },
71
#include "qemu/accel.h"
58
+ { CPU_LOG_TB_FPU, "fpu",
72
+#include "qemu/atomic.h"
59
+ "include FPU registers in the 'cpu' logging" },
73
#include "qapi/qapi-builtin-visit.h"
60
{ CPU_LOG_MMU, "mmu",
74
#include "qemu/units.h"
61
"log MMU-related activities" },
75
#if !defined(CONFIG_USER_ONLY)
62
{ CPU_LOG_PCALL, "pcall",
76
@@ -XXX,XX +XXX,XX @@ static void tcg_accel_instance_init(Object *obj)
77
}
78
79
bool mttcg_enabled;
80
+bool one_insn_per_tb;
81
82
static int tcg_init_machine(MachineState *ms)
83
{
84
@@ -XXX,XX +XXX,XX @@ static void tcg_set_one_insn_per_tb(Object *obj, bool value, Error **errp)
85
{
86
TCGState *s = TCG_STATE(obj);
87
s->one_insn_per_tb = value;
88
- /* For the moment, set the global also: this changes the behaviour */
89
- singlestep = value;
90
+ /* Set the global also: this changes the behaviour */
91
+ qatomic_set(&one_insn_per_tb, value);
92
}
93
94
static int tcg_gdbstub_supported_sstep_flags(void)
95
diff --git a/bsd-user/main.c b/bsd-user/main.c
96
index XXXXXXX..XXXXXXX 100644
97
--- a/bsd-user/main.c
98
+++ b/bsd-user/main.c
99
@@ -XXX,XX +XXX,XX @@
100
#include "host-os.h"
101
#include "target_arch_cpu.h"
102
103
-int singlestep;
104
static bool opt_one_insn_per_tb;
105
uintptr_t guest_base;
106
bool have_guest_base;
107
diff --git a/linux-user/main.c b/linux-user/main.c
108
index XXXXXXX..XXXXXXX 100644
109
--- a/linux-user/main.c
110
+++ b/linux-user/main.c
111
@@ -XXX,XX +XXX,XX @@
112
char *exec_path;
113
char real_exec_path[PATH_MAX];
114
115
-int singlestep;
116
static bool opt_one_insn_per_tb;
117
static const char *argv0;
118
static const char *gdbstub;
119
diff --git a/softmmu/globals.c b/softmmu/globals.c
120
index XXXXXXX..XXXXXXX 100644
121
--- a/softmmu/globals.c
122
+++ b/softmmu/globals.c
123
@@ -XXX,XX +XXX,XX @@ int vga_interface_type = VGA_NONE;
124
bool vga_interface_created;
125
Chardev *parallel_hds[MAX_PARALLEL_PORTS];
126
int win2k_install_hack;
127
-int singlestep;
128
int fd_bootchk = 1;
129
int graphic_rotate;
130
QEMUOptionRom option_rom[MAX_OPTION_ROMS];
63
--
131
--
64
2.17.0
132
2.34.1
65
133
66
134
diff view generated by jsdifflib
New patch
1
The '-singlestep' option is confusing, because it doesn't actually
2
have anything to do with single-stepping the CPU. What it does do
3
is force TCG emulation to put one guest instruction in each TB,
4
which can be useful in some situations.
1
5
6
Create a new command line argument -one-insn-per-tb, so we can
7
document that -singlestep is just a deprecated synonym for it,
8
and eventually perhaps drop it.
9
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
12
Reviewed-by: Warner Losh <imp@bsdimp.com>
13
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
14
Message-id: 20230417164041.684562-5-peter.maydell@linaro.org
15
---
16
docs/user/main.rst | 7 ++++++-
17
linux-user/main.c | 9 ++++++---
18
2 files changed, 12 insertions(+), 4 deletions(-)
19
20
diff --git a/docs/user/main.rst b/docs/user/main.rst
21
index XXXXXXX..XXXXXXX 100644
22
--- a/docs/user/main.rst
23
+++ b/docs/user/main.rst
24
@@ -XXX,XX +XXX,XX @@ Debug options:
25
``-g port``
26
Wait gdb connection to port
27
28
+``-one-insn-per-tb``
29
+ Run the emulation with one guest instruction per translation block.
30
+ This slows down emulation a lot, but can be useful in some situations,
31
+ such as when trying to analyse the logs produced by the ``-d`` option.
32
+
33
``-singlestep``
34
- Run the emulation in single step mode.
35
+ This is a deprecated synonym for the ``-one-insn-per-tb`` option.
36
37
Environment variables:
38
39
diff --git a/linux-user/main.c b/linux-user/main.c
40
index XXXXXXX..XXXXXXX 100644
41
--- a/linux-user/main.c
42
+++ b/linux-user/main.c
43
@@ -XXX,XX +XXX,XX @@ static void handle_arg_reserved_va(const char *arg)
44
reserved_va = val ? val - 1 : 0;
45
}
46
47
-static void handle_arg_singlestep(const char *arg)
48
+static void handle_arg_one_insn_per_tb(const char *arg)
49
{
50
opt_one_insn_per_tb = true;
51
}
52
@@ -XXX,XX +XXX,XX @@ static const struct qemu_argument arg_table[] = {
53
"logfile", "write logs to 'logfile' (default stderr)"},
54
{"p", "QEMU_PAGESIZE", true, handle_arg_pagesize,
55
"pagesize", "set the host page size to 'pagesize'"},
56
- {"singlestep", "QEMU_SINGLESTEP", false, handle_arg_singlestep,
57
- "", "run in singlestep mode"},
58
+ {"one-insn-per-tb",
59
+ "QEMU_ONE_INSN_PER_TB", false, handle_arg_one_insn_per_tb,
60
+ "", "run with one guest instruction per emulated TB"},
61
+ {"singlestep", "QEMU_SINGLESTEP", false, handle_arg_one_insn_per_tb,
62
+ "", "deprecated synonym for -one-insn-per-tb"},
63
{"strace", "QEMU_STRACE", false, handle_arg_strace,
64
"", "log system calls"},
65
{"seed", "QEMU_RAND_SEED", true, handle_arg_seed,
66
--
67
2.34.1
68
69
diff view generated by jsdifflib
New patch
1
The '-singlestep' option is confusing, because it doesn't actually
2
have anything to do with single-stepping the CPU. What it does do
3
is force TCG emulation to put one guest instruction in each TB,
4
which can be useful in some situations.
1
5
6
Create a new command line argument -one-insn-per-tb, so we can
7
document that -singlestep is just a deprecated synonym for it,
8
and eventually perhaps drop it.
9
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
Reviewed-by: Warner Losh <imp@bsdimp.com>
12
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
13
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
14
Message-id: 20230417164041.684562-6-peter.maydell@linaro.org
15
---
16
docs/user/main.rst | 7 ++++++-
17
bsd-user/main.c | 5 +++--
18
2 files changed, 9 insertions(+), 3 deletions(-)
19
20
diff --git a/docs/user/main.rst b/docs/user/main.rst
21
index XXXXXXX..XXXXXXX 100644
22
--- a/docs/user/main.rst
23
+++ b/docs/user/main.rst
24
@@ -XXX,XX +XXX,XX @@ Debug options:
25
``-p pagesize``
26
Act as if the host page size was 'pagesize' bytes
27
28
+``-one-insn-per-tb``
29
+ Run the emulation with one guest instruction per translation block.
30
+ This slows down emulation a lot, but can be useful in some situations,
31
+ such as when trying to analyse the logs produced by the ``-d`` option.
32
+
33
``-singlestep``
34
- Run the emulation in single step mode.
35
+ This is a deprecated synonym for the ``-one-insn-per-tb`` option.
36
diff --git a/bsd-user/main.c b/bsd-user/main.c
37
index XXXXXXX..XXXXXXX 100644
38
--- a/bsd-user/main.c
39
+++ b/bsd-user/main.c
40
@@ -XXX,XX +XXX,XX @@ static void usage(void)
41
"-d item1[,...] enable logging of specified items\n"
42
" (use '-d help' for a list of log items)\n"
43
"-D logfile write logs to 'logfile' (default stderr)\n"
44
- "-singlestep always run in singlestep mode\n"
45
+ "-one-insn-per-tb run with one guest instruction per emulated TB\n"
46
+ "-singlestep deprecated synonym for -one-insn-per-tb\n"
47
"-strace log system calls\n"
48
"-trace [[enable=]<pattern>][,events=<file>][,file=<file>]\n"
49
" specify tracing options\n"
50
@@ -XXX,XX +XXX,XX @@ int main(int argc, char **argv)
51
(void) envlist_unsetenv(envlist, "LD_PRELOAD");
52
} else if (!strcmp(r, "seed")) {
53
seed_optarg = optarg;
54
- } else if (!strcmp(r, "singlestep")) {
55
+ } else if (!strcmp(r, "singlestep") || !strcmp(r, "one-insn-per-tb")) {
56
opt_one_insn_per_tb = true;
57
} else if (!strcmp(r, "strace")) {
58
do_strace = 1;
59
--
60
2.34.1
61
62
diff view generated by jsdifflib
New patch
1
Document that the -singlestep command line option is now
2
deprecated, as it is replaced by either the TCG accelerator
3
property 'one-insn-per-tb' for system emulation or the new
4
'-one-insn-per-tb' option for usermode emulation, and remove
5
the only use of the deprecated syntax from a README.
1
6
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
9
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
10
Message-id: 20230417164041.684562-7-peter.maydell@linaro.org
11
---
12
docs/about/deprecated.rst | 16 ++++++++++++++++
13
qemu-options.hx | 5 +++--
14
tcg/tci/README | 2 +-
15
3 files changed, 20 insertions(+), 3 deletions(-)
16
17
diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst
18
index XXXXXXX..XXXXXXX 100644
19
--- a/docs/about/deprecated.rst
20
+++ b/docs/about/deprecated.rst
21
@@ -XXX,XX +XXX,XX @@ Use ``-machine acpi=off`` instead.
22
The HAXM project has been retired (see https://github.com/intel/haxm#status).
23
Use "whpx" (on Windows) or "hvf" (on macOS) instead.
24
25
+``-singlestep`` (since 8.1)
26
+'''''''''''''''''''''''''''
27
+
28
+The ``-singlestep`` option has been turned into an accelerator property,
29
+and given a name that better reflects what it actually does.
30
+Use ``-accel tcg,one-insn-per-tb=on`` instead.
31
+
32
+User-mode emulator command line arguments
33
+-----------------------------------------
34
+
35
+``-singlestep`` (since 8.1)
36
+'''''''''''''''''''''''''''
37
+
38
+The ``-singlestep`` option has been given a name that better reflects
39
+what it actually does. For both linux-user and bsd-user, use the
40
+new ``-one-insn-per-tb`` option instead.
41
42
QEMU Machine Protocol (QMP) commands
43
------------------------------------
44
diff --git a/qemu-options.hx b/qemu-options.hx
45
index XXXXXXX..XXXXXXX 100644
46
--- a/qemu-options.hx
47
+++ b/qemu-options.hx
48
@@ -XXX,XX +XXX,XX @@ SRST
49
ERST
50
51
DEF("singlestep", 0, QEMU_OPTION_singlestep, \
52
- "-singlestep always run in singlestep mode\n", QEMU_ARCH_ALL)
53
+ "-singlestep deprecated synonym for -accel tcg,one-insn-per-tb=on\n", QEMU_ARCH_ALL)
54
SRST
55
``-singlestep``
56
- Run the emulation in single step mode.
57
+ This is a deprecated synonym for the TCG accelerator property
58
+ ``one-insn-per-tb``.
59
ERST
60
61
DEF("preconfig", 0, QEMU_OPTION_preconfig, \
62
diff --git a/tcg/tci/README b/tcg/tci/README
63
index XXXXXXX..XXXXXXX 100644
64
--- a/tcg/tci/README
65
+++ b/tcg/tci/README
66
@@ -XXX,XX +XXX,XX @@ The only difference from running QEMU with TCI to running without TCI
67
should be speed. Especially during development of TCI, it was very
68
useful to compare runs with and without TCI. Create /tmp/qemu.log by
69
70
- qemu-system-i386 -d in_asm,op_opt,cpu -D /tmp/qemu.log -singlestep
71
+ qemu-system-i386 -d in_asm,op_opt,cpu -D /tmp/qemu.log -accel tcg,one-insn-per-tb=on
72
73
once with interpreter and once without interpreter and compare the resulting
74
qemu.log files. This is also useful to see the effects of additional
75
--
76
2.34.1
77
78
diff view generated by jsdifflib
New patch
1
Currently we report whether the TCG accelerator is in
2
'one-insn-per-tb' mode in the 'info status' output. This is a pretty
3
minor piece of TCG specific information, and we want to deprecate the
4
'singlestep' field of the associated QMP command. Move the
5
'one-insn-per-tb' reporting to 'info jit'.
1
6
7
We don't need a deprecate-and-drop period for this because the
8
HMP interface has no stability guarantees.
9
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
12
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
13
Message-id: 20230417164041.684562-8-peter.maydell@linaro.org
14
---
15
accel/tcg/monitor.c | 14 ++++++++++++++
16
softmmu/runstate-hmp-cmds.c | 5 ++---
17
2 files changed, 16 insertions(+), 3 deletions(-)
18
19
diff --git a/accel/tcg/monitor.c b/accel/tcg/monitor.c
20
index XXXXXXX..XXXXXXX 100644
21
--- a/accel/tcg/monitor.c
22
+++ b/accel/tcg/monitor.c
23
@@ -XXX,XX +XXX,XX @@
24
*/
25
26
#include "qemu/osdep.h"
27
+#include "qemu/accel.h"
28
#include "qapi/error.h"
29
#include "qapi/type-helpers.h"
30
#include "qapi/qapi-commands-machine.h"
31
@@ -XXX,XX +XXX,XX @@ static void dump_drift_info(GString *buf)
32
}
33
}
34
35
+static void dump_accel_info(GString *buf)
36
+{
37
+ AccelState *accel = current_accel();
38
+ bool one_insn_per_tb = object_property_get_bool(OBJECT(accel),
39
+ "one-insn-per-tb",
40
+ &error_fatal);
41
+
42
+ g_string_append_printf(buf, "Accelerator settings:\n");
43
+ g_string_append_printf(buf, "one-insn-per-tb: %s\n\n",
44
+ one_insn_per_tb ? "on" : "off");
45
+}
46
+
47
HumanReadableText *qmp_x_query_jit(Error **errp)
48
{
49
g_autoptr(GString) buf = g_string_new("");
50
@@ -XXX,XX +XXX,XX @@ HumanReadableText *qmp_x_query_jit(Error **errp)
51
return NULL;
52
}
53
54
+ dump_accel_info(buf);
55
dump_exec_info(buf);
56
dump_drift_info(buf);
57
58
diff --git a/softmmu/runstate-hmp-cmds.c b/softmmu/runstate-hmp-cmds.c
59
index XXXXXXX..XXXXXXX 100644
60
--- a/softmmu/runstate-hmp-cmds.c
61
+++ b/softmmu/runstate-hmp-cmds.c
62
@@ -XXX,XX +XXX,XX @@ void hmp_info_status(Monitor *mon, const QDict *qdict)
63
64
info = qmp_query_status(NULL);
65
66
- monitor_printf(mon, "VM status: %s%s",
67
- info->running ? "running" : "paused",
68
- info->singlestep ? " (single step mode)" : "");
69
+ monitor_printf(mon, "VM status: %s",
70
+ info->running ? "running" : "paused");
71
72
if (!info->running && info->status != RUN_STATE_PAUSED) {
73
monitor_printf(mon, " (%s)", RunState_str(info->status));
74
--
75
2.34.1
76
77
diff view generated by jsdifflib
New patch
1
The 'singlestep' HMP command is confusing, because it doesn't
2
actually have anything to do with single-stepping the CPU. What it
3
does do is force TCG emulation to put one guest instruction in each
4
TB, which can be useful in some situations.
1
5
6
Create a new HMP command 'one-insn-per-tb', so we can document that
7
'singlestep' is just a deprecated synonym for it, and eventually
8
perhaps drop it.
9
10
We aren't obliged to do deprecate-and-drop for HMP commands,
11
but it's easy enough to do so, so we do.
12
13
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
14
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
15
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
16
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
17
Message-id: 20230417164041.684562-9-peter.maydell@linaro.org
18
---
19
docs/about/deprecated.rst | 9 +++++++++
20
include/monitor/hmp.h | 2 +-
21
softmmu/runstate-hmp-cmds.c | 2 +-
22
tests/qtest/test-hmp.c | 1 +
23
hmp-commands.hx | 25 +++++++++++++++++++++----
24
5 files changed, 33 insertions(+), 6 deletions(-)
25
26
diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst
27
index XXXXXXX..XXXXXXX 100644
28
--- a/docs/about/deprecated.rst
29
+++ b/docs/about/deprecated.rst
30
@@ -XXX,XX +XXX,XX @@ accepted incorrect commands will return an error. Users should make sure that
31
all arguments passed to ``device_add`` are consistent with the documented
32
property types.
33
34
+Human Monitor Protocol (HMP) commands
35
+-------------------------------------
36
+
37
+``singlestep`` (since 8.1)
38
+''''''''''''''''''''''''''
39
+
40
+The ``singlestep`` command has been replaced by the ``one-insn-per-tb``
41
+command, which has the same behaviour but a less misleading name.
42
+
43
Host Architectures
44
------------------
45
46
diff --git a/include/monitor/hmp.h b/include/monitor/hmp.h
47
index XXXXXXX..XXXXXXX 100644
48
--- a/include/monitor/hmp.h
49
+++ b/include/monitor/hmp.h
50
@@ -XXX,XX +XXX,XX @@ void hmp_info_vcpu_dirty_limit(Monitor *mon, const QDict *qdict);
51
void hmp_human_readable_text_helper(Monitor *mon,
52
HumanReadableText *(*qmp_handler)(Error **));
53
void hmp_info_stats(Monitor *mon, const QDict *qdict);
54
-void hmp_singlestep(Monitor *mon, const QDict *qdict);
55
+void hmp_one_insn_per_tb(Monitor *mon, const QDict *qdict);
56
void hmp_watchdog_action(Monitor *mon, const QDict *qdict);
57
void hmp_pcie_aer_inject_error(Monitor *mon, const QDict *qdict);
58
void hmp_info_capture(Monitor *mon, const QDict *qdict);
59
diff --git a/softmmu/runstate-hmp-cmds.c b/softmmu/runstate-hmp-cmds.c
60
index XXXXXXX..XXXXXXX 100644
61
--- a/softmmu/runstate-hmp-cmds.c
62
+++ b/softmmu/runstate-hmp-cmds.c
63
@@ -XXX,XX +XXX,XX @@ void hmp_info_status(Monitor *mon, const QDict *qdict)
64
qapi_free_StatusInfo(info);
65
}
66
67
-void hmp_singlestep(Monitor *mon, const QDict *qdict)
68
+void hmp_one_insn_per_tb(Monitor *mon, const QDict *qdict)
69
{
70
const char *option = qdict_get_try_str(qdict, "option");
71
AccelState *accel = current_accel();
72
diff --git a/tests/qtest/test-hmp.c b/tests/qtest/test-hmp.c
73
index XXXXXXX..XXXXXXX 100644
74
--- a/tests/qtest/test-hmp.c
75
+++ b/tests/qtest/test-hmp.c
76
@@ -XXX,XX +XXX,XX @@ static const char *hmp_cmds[] = {
77
"o /w 0 0x1234",
78
"object_add memory-backend-ram,id=mem1,size=256M",
79
"object_del mem1",
80
+ "one-insn-per-tb on",
81
"pmemsave 0 4096 \"/dev/null\"",
82
"p $pc + 8",
83
"qom-list /",
84
diff --git a/hmp-commands.hx b/hmp-commands.hx
85
index XXXXXXX..XXXXXXX 100644
86
--- a/hmp-commands.hx
87
+++ b/hmp-commands.hx
88
@@ -XXX,XX +XXX,XX @@ SRST
89
only *tag* as parameter.
90
ERST
91
92
+ {
93
+ .name = "one-insn-per-tb",
94
+ .args_type = "option:s?",
95
+ .params = "[on|off]",
96
+ .help = "run emulation with one guest instruction per translation block",
97
+ .cmd = hmp_one_insn_per_tb,
98
+ },
99
+
100
+SRST
101
+``one-insn-per-tb [off]``
102
+ Run the emulation with one guest instruction per translation block.
103
+ This slows down emulation a lot, but can be useful in some situations,
104
+ such as when trying to analyse the logs produced by the ``-d`` option.
105
+ This only has an effect when using TCG, not with KVM or other accelerators.
106
+
107
+ If called with option off, the emulation returns to normal mode.
108
+ERST
109
+
110
{
111
.name = "singlestep",
112
.args_type = "option:s?",
113
.params = "[on|off]",
114
- .help = "run emulation in singlestep mode or switch to normal mode",
115
- .cmd = hmp_singlestep,
116
+ .help = "deprecated synonym for one-insn-per-tb",
117
+ .cmd = hmp_one_insn_per_tb,
118
},
119
120
SRST
121
``singlestep [off]``
122
- Run the emulation in single step mode.
123
- If called with option off, the emulation returns to normal mode.
124
+ This is a deprecated synonym for the one-insn-per-tb command.
125
ERST
126
127
{
128
--
129
2.34.1
130
131
diff view generated by jsdifflib
1
From: Alex Bennée <alex.bennee@linaro.org>
1
The run-state.json file is missing a trailing newline; add it.
2
2
3
Reported by Coverity (CID1390635). We ensure this for uint_to_float
3
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4
later on so we might as well mirror that.
5
6
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
7
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
4
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
8
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
5
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6
Message-id: 20230417164041.684562-10-peter.maydell@linaro.org
10
---
7
---
11
fpu/softfloat.c | 2 +-
8
qapi/run-state.json | 2 +-
12
1 file changed, 1 insertion(+), 1 deletion(-)
9
1 file changed, 1 insertion(+), 1 deletion(-)
13
10
14
diff --git a/fpu/softfloat.c b/fpu/softfloat.c
11
diff --git a/qapi/run-state.json b/qapi/run-state.json
15
index XXXXXXX..XXXXXXX 100644
12
index XXXXXXX..XXXXXXX 100644
16
--- a/fpu/softfloat.c
13
--- a/qapi/run-state.json
17
+++ b/fpu/softfloat.c
14
+++ b/qapi/run-state.json
18
@@ -XXX,XX +XXX,XX @@ FLOAT_TO_UINT(64, 64)
15
@@ -XXX,XX +XXX,XX @@
19
16
# Since: 7.2
20
static FloatParts int_to_float(int64_t a, float_status *status)
17
##
21
{
18
{ 'enum': 'NotifyVmexitOption',
22
- FloatParts r;
19
- 'data': [ 'run', 'internal-error', 'disable' ] }
23
+ FloatParts r = {};
20
\ No newline at end of file
24
if (a == 0) {
21
+ 'data': [ 'run', 'internal-error', 'disable' ] }
25
r.cls = float_class_zero;
26
r.sign = false;
27
--
22
--
28
2.17.0
23
2.34.1
29
24
30
25
diff view generated by jsdifflib
New patch
1
The 'singlestep' member of StatusInfo has never done what the QMP
2
documentation claims it does. What it actually reports is whether
3
TCG is working in "one guest instruction per translation block" mode.
1
4
5
We no longer need this field for the HMP 'info status' command, as
6
we've moved that information to 'info jit'. It seems unlikely that
7
anybody is monitoring the state of this obscure TCG setting via QMP,
8
especially since QMP provides no means for changing the setting. So
9
simply deprecate the field, without providing any replacement.
10
11
Until we do eventually delete the member, correct the misstatements
12
in the QAPI documentation about it.
13
14
If we do find that there are users for this, then the most likely way
15
we would provide replacement access to the information would be to
16
put the accelerator QOM object at a well-known path such as
17
/machine/accel, which could then be used with the existing qom-set
18
and qom-get commands.
19
20
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
21
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
22
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
23
Reviewed-by: Markus Armbruster <armbru@redhat.com>
24
Message-id: 20230417164041.684562-11-peter.maydell@linaro.org
25
---
26
docs/about/deprecated.rst | 14 ++++++++++++++
27
qapi/run-state.json | 14 +++++++++++---
28
2 files changed, 25 insertions(+), 3 deletions(-)
29
30
diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst
31
index XXXXXXX..XXXXXXX 100644
32
--- a/docs/about/deprecated.rst
33
+++ b/docs/about/deprecated.rst
34
@@ -XXX,XX +XXX,XX @@ accepted incorrect commands will return an error. Users should make sure that
35
all arguments passed to ``device_add`` are consistent with the documented
36
property types.
37
38
+``StatusInfo`` member ``singlestep`` (since 8.1)
39
+''''''''''''''''''''''''''''''''''''''''''''''''
40
+
41
+The ``singlestep`` member of the ``StatusInfo`` returned from the
42
+``query-status`` command is deprecated. This member has a confusing
43
+name and it never did what the documentation claimed or what its name
44
+suggests. We do not believe that anybody is actually using the
45
+information provided in this member.
46
+
47
+The information it reports is whether the TCG JIT is in "one
48
+instruction per translated block" mode (which can be set on the
49
+command line or via the HMP, but not via QMP). The information remains
50
+available via the HMP 'info jit' command.
51
+
52
Human Monitor Protocol (HMP) commands
53
-------------------------------------
54
55
diff --git a/qapi/run-state.json b/qapi/run-state.json
56
index XXXXXXX..XXXXXXX 100644
57
--- a/qapi/run-state.json
58
+++ b/qapi/run-state.json
59
@@ -XXX,XX +XXX,XX @@
60
#
61
# @running: true if all VCPUs are runnable, false if not runnable
62
#
63
-# @singlestep: true if VCPUs are in single-step mode
64
+# @singlestep: true if using TCG with one guest instruction
65
+# per translation block
66
#
67
# @status: the virtual machine @RunState
68
#
69
+# Features:
70
+# @deprecated: Member 'singlestep' is deprecated (with no replacement).
71
+#
72
# Since: 0.14
73
#
74
-# Notes: @singlestep is enabled through the GDB stub
75
+# Notes: @singlestep is enabled on the command line with
76
+# '-accel tcg,one-insn-per-tb=on', or with the HMP
77
+# 'one-insn-per-tb' command.
78
##
79
{ 'struct': 'StatusInfo',
80
- 'data': {'running': 'bool', 'singlestep': 'bool', 'status': 'RunState'} }
81
+ 'data': {'running': 'bool',
82
+ 'singlestep': { 'type': 'bool', 'features': [ 'deprecated' ]},
83
+ 'status': 'RunState'} }
84
85
##
86
# @query-status:
87
--
88
2.34.1
89
90
diff view generated by jsdifflib
New patch
1
In commit 5242876f37ca we deprecated the dtb-kaslr-seed property of
2
the virt board, but forgot the "since n.n" tag in the documentation
3
of this in deprecated.rst.
1
4
5
This deprecation note first appeared in the 7.1 release, so
6
retrospectively add the correct "since 7.1" annotation to it.
7
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
10
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
11
Message-id: 20230420122256.1023709-1-peter.maydell@linaro.org
12
---
13
docs/about/deprecated.rst | 4 ++--
14
1 file changed, 2 insertions(+), 2 deletions(-)
15
16
diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst
17
index XXXXXXX..XXXXXXX 100644
18
--- a/docs/about/deprecated.rst
19
+++ b/docs/about/deprecated.rst
20
@@ -XXX,XX +XXX,XX @@ Use the more generic event ``DEVICE_UNPLUG_GUEST_ERROR`` instead.
21
System emulator machines
22
------------------------
23
24
-Arm ``virt`` machine ``dtb-kaslr-seed`` property
25
-''''''''''''''''''''''''''''''''''''''''''''''''
26
+Arm ``virt`` machine ``dtb-kaslr-seed`` property (since 7.1)
27
+''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
28
29
The ``dtb-kaslr-seed`` property on the ``virt`` board has been
30
deprecated; use the new name ``dtb-randomness`` instead. The new name
31
--
32
2.34.1
33
34
diff view generated by jsdifflib
New patch
1
The msf2-emac ethernet controller has functions emac_load_desc() and
2
emac_store_desc() which read and write the in-memory descriptor
3
blocks and handle conversion between guest and host endianness.
1
4
5
As currently written, emac_store_desc() does the endianness
6
conversion in-place; this means that it effectively consumes the
7
input EmacDesc struct, because on a big-endian host the fields will
8
be overwritten with the little-endian versions of their values.
9
Unfortunately, in all the callsites the code continues to access
10
fields in the EmacDesc struct after it has called emac_store_desc()
11
-- specifically, it looks at the d.next field.
12
13
The effect of this is that on a big-endian host networking doesn't
14
work because the address of the next descriptor is corrupted.
15
16
We could fix this by making the callsite avoid using the struct; but
17
it's more robust to have emac_store_desc() leave its input alone.
18
19
(emac_load_desc() also does an in-place conversion, but here this is
20
fine, because the function is supposed to be initializing the
21
struct.)
22
23
Cc: qemu-stable@nongnu.org
24
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
25
Reviewed-by: Thomas Huth <thuth@redhat.com>
26
Message-id: 20230424151919.1333299-1-peter.maydell@linaro.org
27
---
28
hw/net/msf2-emac.c | 16 ++++++++++------
29
1 file changed, 10 insertions(+), 6 deletions(-)
30
31
diff --git a/hw/net/msf2-emac.c b/hw/net/msf2-emac.c
32
index XXXXXXX..XXXXXXX 100644
33
--- a/hw/net/msf2-emac.c
34
+++ b/hw/net/msf2-emac.c
35
@@ -XXX,XX +XXX,XX @@ static void emac_load_desc(MSF2EmacState *s, EmacDesc *d, hwaddr desc)
36
d->next = le32_to_cpu(d->next);
37
}
38
39
-static void emac_store_desc(MSF2EmacState *s, EmacDesc *d, hwaddr desc)
40
+static void emac_store_desc(MSF2EmacState *s, const EmacDesc *d, hwaddr desc)
41
{
42
- /* Convert from host endianness into LE. */
43
- d->pktaddr = cpu_to_le32(d->pktaddr);
44
- d->pktsize = cpu_to_le32(d->pktsize);
45
- d->next = cpu_to_le32(d->next);
46
+ EmacDesc outd;
47
+ /*
48
+ * Convert from host endianness into LE. We use a local struct because
49
+ * calling code may still want to look at the fields afterwards.
50
+ */
51
+ outd.pktaddr = cpu_to_le32(d->pktaddr);
52
+ outd.pktsize = cpu_to_le32(d->pktsize);
53
+ outd.next = cpu_to_le32(d->next);
54
55
- address_space_write(&s->dma_as, desc, MEMTXATTRS_UNSPECIFIED, d, sizeof *d);
56
+ address_space_write(&s->dma_as, desc, MEMTXATTRS_UNSPECIFIED, &outd, sizeof outd);
57
}
58
59
static void msf2_dma_tx(MSF2EmacState *s)
60
--
61
2.34.1
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
From: Cédric Le Goater <clg@kaod.org>
2
3
The arm boot.c code includes a utility function write_bootloader()
4
which assists in writing a boot-code fragment into guest memory,
5
including handling endianness and fixing it up with entry point
6
addresses and similar things. This is useful not just for the boot.c
7
code but also in board model code, so rename it to
8
arm_write_bootloader() and make it globally visible.
9
10
Since we are making it public, make its API a little neater: move the
11
AddressSpace* argument to be next to the hwaddr argument, and allow
12
the fixupcontext array to be const, since we never modify it in this
13
function.
2
14
3
Cc: qemu-stable@nongnu.org
15
Cc: qemu-stable@nongnu.org
4
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
16
Signed-off-by: Cédric Le Goater <clg@kaod.org>
5
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
17
Tested-by: Cédric Le Goater <clg@kaod.org>
6
Tested-by: Alex Bennée <alex.bennee@linaro.org>
18
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
7
Message-id: 20180512003217.9105-6-richard.henderson@linaro.org
19
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
20
Message-id: 20230424152717.1333930-2-peter.maydell@linaro.org
21
[PMM: Split out from another patch by Cédric, added doc comment]
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
22
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
---
23
---
10
target/arm/translate-a64.c | 30 ++++++++++++++----------------
24
include/hw/arm/boot.h | 49 +++++++++++++++++++++++++++++++++++++++++++
11
1 file changed, 14 insertions(+), 16 deletions(-)
25
hw/arm/boot.c | 35 +++++++------------------------
26
2 files changed, 57 insertions(+), 27 deletions(-)
12
27
13
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
28
diff --git a/include/hw/arm/boot.h b/include/hw/arm/boot.h
14
index XXXXXXX..XXXXXXX 100644
29
index XXXXXXX..XXXXXXX 100644
15
--- a/target/arm/translate-a64.c
30
--- a/include/hw/arm/boot.h
16
+++ b/target/arm/translate-a64.c
31
+++ b/include/hw/arm/boot.h
17
@@ -XXX,XX +XXX,XX @@ static TCGv_i32 read_fp_sreg(DisasContext *s, int reg)
32
@@ -XXX,XX +XXX,XX @@ void arm_write_secure_board_setup_dummy_smc(ARMCPU *cpu,
18
return v;
33
const struct arm_boot_info *info,
34
hwaddr mvbar_addr);
35
36
+typedef enum {
37
+ FIXUP_NONE = 0, /* do nothing */
38
+ FIXUP_TERMINATOR, /* end of insns */
39
+ FIXUP_BOARDID, /* overwrite with board ID number */
40
+ FIXUP_BOARD_SETUP, /* overwrite with board specific setup code address */
41
+ FIXUP_ARGPTR_LO, /* overwrite with pointer to kernel args */
42
+ FIXUP_ARGPTR_HI, /* overwrite with pointer to kernel args (high half) */
43
+ FIXUP_ENTRYPOINT_LO, /* overwrite with kernel entry point */
44
+ FIXUP_ENTRYPOINT_HI, /* overwrite with kernel entry point (high half) */
45
+ FIXUP_GIC_CPU_IF, /* overwrite with GIC CPU interface address */
46
+ FIXUP_BOOTREG, /* overwrite with boot register address */
47
+ FIXUP_DSB, /* overwrite with correct DSB insn for cpu */
48
+ FIXUP_MAX,
49
+} FixupType;
50
+
51
+typedef struct ARMInsnFixup {
52
+ uint32_t insn;
53
+ FixupType fixup;
54
+} ARMInsnFixup;
55
+
56
+/**
57
+ * arm_write_bootloader - write a bootloader to guest memory
58
+ * @name: name of the bootloader blob
59
+ * @as: AddressSpace to write the bootloader
60
+ * @addr: guest address to write it
61
+ * @insns: the blob to be loaded
62
+ * @fixupcontext: context to be used for any fixups in @insns
63
+ *
64
+ * Write a bootloader to guest memory at address @addr in the address
65
+ * space @as. @name is the name to use for the resulting ROM blob, so
66
+ * it should be unique in the system and reasonably identifiable for debugging.
67
+ *
68
+ * @insns must be an array of ARMInsnFixup structs, each of which has
69
+ * one 32-bit value to be written to the guest memory, and a fixup to be
70
+ * applied to the value. FIXUP_NONE (do nothing) is value 0, so effectively
71
+ * the fixup is optional when writing a struct initializer.
72
+ * The final entry in the array must be { 0, FIXUP_TERMINATOR }.
73
+ *
74
+ * All other supported fixup types have the semantics "ignore insn
75
+ * and instead use the value from the array element @fixupcontext[fixup]".
76
+ * The caller should therefore provide @fixupcontext as an array of
77
+ * size FIXUP_MAX whose elements have been initialized for at least
78
+ * the entries that @insns refers to.
79
+ */
80
+void arm_write_bootloader(const char *name,
81
+ AddressSpace *as, hwaddr addr,
82
+ const ARMInsnFixup *insns,
83
+ const uint32_t *fixupcontext);
84
+
85
#endif /* HW_ARM_BOOT_H */
86
diff --git a/hw/arm/boot.c b/hw/arm/boot.c
87
index XXXXXXX..XXXXXXX 100644
88
--- a/hw/arm/boot.c
89
+++ b/hw/arm/boot.c
90
@@ -XXX,XX +XXX,XX @@ AddressSpace *arm_boot_address_space(ARMCPU *cpu,
91
return cpu_get_address_space(cs, asidx);
19
}
92
}
20
93
21
+static TCGv_i32 read_fp_hreg(DisasContext *s, int reg)
94
-typedef enum {
22
+{
95
- FIXUP_NONE = 0, /* do nothing */
23
+ TCGv_i32 v = tcg_temp_new_i32();
96
- FIXUP_TERMINATOR, /* end of insns */
24
+
97
- FIXUP_BOARDID, /* overwrite with board ID number */
25
+ tcg_gen_ld16u_i32(v, cpu_env, fp_reg_offset(s, reg, MO_16));
98
- FIXUP_BOARD_SETUP, /* overwrite with board specific setup code address */
26
+ return v;
99
- FIXUP_ARGPTR_LO, /* overwrite with pointer to kernel args */
27
+}
100
- FIXUP_ARGPTR_HI, /* overwrite with pointer to kernel args (high half) */
28
+
101
- FIXUP_ENTRYPOINT_LO, /* overwrite with kernel entry point */
29
/* Clear the bits above an N-bit vector, for N = (is_q ? 128 : 64).
102
- FIXUP_ENTRYPOINT_HI, /* overwrite with kernel entry point (high half) */
30
* If SVE is not enabled, then there are only 128 bits in the vector.
103
- FIXUP_GIC_CPU_IF, /* overwrite with GIC CPU interface address */
31
*/
104
- FIXUP_BOOTREG, /* overwrite with boot register address */
32
@@ -XXX,XX +XXX,XX @@ static void disas_fp_csel(DisasContext *s, uint32_t insn)
105
- FIXUP_DSB, /* overwrite with correct DSB insn for cpu */
33
static void handle_fp_1src_half(DisasContext *s, int opcode, int rd, int rn)
106
- FIXUP_MAX,
107
-} FixupType;
108
-
109
-typedef struct ARMInsnFixup {
110
- uint32_t insn;
111
- FixupType fixup;
112
-} ARMInsnFixup;
113
-
114
static const ARMInsnFixup bootloader_aarch64[] = {
115
{ 0x580000c0 }, /* ldr x0, arg ; Load the lower 32-bits of DTB */
116
{ 0xaa1f03e1 }, /* mov x1, xzr */
117
@@ -XXX,XX +XXX,XX @@ static const ARMInsnFixup smpboot[] = {
118
{ 0, FIXUP_TERMINATOR }
119
};
120
121
-static void write_bootloader(const char *name, hwaddr addr,
122
- const ARMInsnFixup *insns, uint32_t *fixupcontext,
123
- AddressSpace *as)
124
+void arm_write_bootloader(const char *name,
125
+ AddressSpace *as, hwaddr addr,
126
+ const ARMInsnFixup *insns,
127
+ const uint32_t *fixupcontext)
34
{
128
{
35
TCGv_ptr fpst = NULL;
129
/* Fix up the specified bootloader fragment and write it into
36
- TCGv_i32 tcg_op = tcg_temp_new_i32();
130
* guest memory using rom_add_blob_fixed(). fixupcontext is
37
+ TCGv_i32 tcg_op = read_fp_hreg(s, rn);
131
@@ -XXX,XX +XXX,XX @@ static void default_write_secondary(ARMCPU *cpu,
38
TCGv_i32 tcg_res = tcg_temp_new_i32();
132
fixupcontext[FIXUP_DSB] = CP15_DSB_INSN;
39
40
- read_vec_element_i32(s, tcg_op, rn, 0, MO_16);
41
-
42
switch (opcode) {
43
case 0x0: /* FMOV */
44
tcg_gen_mov_i32(tcg_res, tcg_op);
45
@@ -XXX,XX +XXX,XX @@ static void disas_simd_scalar_three_reg_diff(DisasContext *s, uint32_t insn)
46
tcg_temp_free_i64(tcg_op2);
47
tcg_temp_free_i64(tcg_res);
48
} else {
49
- TCGv_i32 tcg_op1 = tcg_temp_new_i32();
50
- TCGv_i32 tcg_op2 = tcg_temp_new_i32();
51
+ TCGv_i32 tcg_op1 = read_fp_hreg(s, rn);
52
+ TCGv_i32 tcg_op2 = read_fp_hreg(s, rm);
53
TCGv_i64 tcg_res = tcg_temp_new_i64();
54
55
- read_vec_element_i32(s, tcg_op1, rn, 0, MO_16);
56
- read_vec_element_i32(s, tcg_op2, rm, 0, MO_16);
57
-
58
gen_helper_neon_mull_s16(tcg_res, tcg_op1, tcg_op2);
59
gen_helper_neon_addl_saturate_s32(tcg_res, cpu_env, tcg_res, tcg_res);
60
61
@@ -XXX,XX +XXX,XX @@ static void disas_simd_scalar_three_reg_same_fp16(DisasContext *s,
62
63
fpst = get_fpstatus_ptr(true);
64
65
- tcg_op1 = tcg_temp_new_i32();
66
- tcg_op2 = tcg_temp_new_i32();
67
+ tcg_op1 = read_fp_hreg(s, rn);
68
+ tcg_op2 = read_fp_hreg(s, rm);
69
tcg_res = tcg_temp_new_i32();
70
71
- read_vec_element_i32(s, tcg_op1, rn, 0, MO_16);
72
- read_vec_element_i32(s, tcg_op2, rm, 0, MO_16);
73
-
74
switch (fpopcode) {
75
case 0x03: /* FMULX */
76
gen_helper_advsimd_mulxh(tcg_res, tcg_op1, tcg_op2, fpst);
77
@@ -XXX,XX +XXX,XX @@ static void disas_simd_two_reg_misc_fp16(DisasContext *s, uint32_t insn)
78
}
133
}
79
134
80
if (is_scalar) {
135
- write_bootloader("smpboot", info->smp_loader_start,
81
- TCGv_i32 tcg_op = tcg_temp_new_i32();
136
- smpboot, fixupcontext, as);
82
+ TCGv_i32 tcg_op = read_fp_hreg(s, rn);
137
+ arm_write_bootloader("smpboot", as, info->smp_loader_start,
83
TCGv_i32 tcg_res = tcg_temp_new_i32();
138
+ smpboot, fixupcontext);
84
139
}
85
- read_vec_element_i32(s, tcg_op, rn, 0, MO_16);
140
86
-
141
void arm_write_secure_board_setup_dummy_smc(ARMCPU *cpu,
87
switch (fpop) {
142
@@ -XXX,XX +XXX,XX @@ static void arm_setup_direct_kernel_boot(ARMCPU *cpu,
88
case 0x1a: /* FCVTNS */
143
fixupcontext[FIXUP_ENTRYPOINT_LO] = entry;
89
case 0x1b: /* FCVTMS */
144
fixupcontext[FIXUP_ENTRYPOINT_HI] = entry >> 32;
145
146
- write_bootloader("bootloader", info->loader_start,
147
- primary_loader, fixupcontext, as);
148
+ arm_write_bootloader("bootloader", as, info->loader_start,
149
+ primary_loader, fixupcontext);
150
151
if (info->write_board_setup) {
152
info->write_board_setup(cpu, info);
90
--
153
--
91
2.17.0
154
2.34.1
92
155
93
156
diff view generated by jsdifflib
1
From: Alex Bennée <alex.bennee@linaro.org>
1
From: Cédric Le Goater <clg@kaod.org>
2
2
3
We are meant to explicitly pass fpst, not cpu_env.
3
When writing the secondary-CPU stub boot loader code to the guest,
4
use arm_write_bootloader() instead of directly calling
5
rom_add_blob_fixed(). This fixes a bug on big-endian hosts, because
6
arm_write_bootloader() will correctly byte-swap the host-byte-order
7
array values into the guest-byte-order to write into the guest
8
memory.
4
9
5
Cc: qemu-stable@nongnu.org
10
Cc: qemu-stable@nongnu.org
6
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
11
Signed-off-by: Cédric Le Goater <clg@kaod.org>
7
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
12
Tested-by: Cédric Le Goater <clg@kaod.org>
8
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
13
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
9
Tested-by: Alex Bennée <alex.bennee@linaro.org>
14
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
Message-id: 20180512003217.9105-12-richard.henderson@linaro.org
15
Message-id: 20230424152717.1333930-3-peter.maydell@linaro.org
16
[PMM: Moved the "make arm_write_bootloader() function public" part
17
to its own patch; updated commit message to note that this fixes
18
an actual bug; adjust to the API changes noted in previous commit]
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
19
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
---
20
---
13
target/arm/translate-a64.c | 3 ++-
21
hw/arm/aspeed.c | 38 ++++++++++++++++++++------------------
14
1 file changed, 2 insertions(+), 1 deletion(-)
22
1 file changed, 20 insertions(+), 18 deletions(-)
15
23
16
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
24
diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c
17
index XXXXXXX..XXXXXXX 100644
25
index XXXXXXX..XXXXXXX 100644
18
--- a/target/arm/translate-a64.c
26
--- a/hw/arm/aspeed.c
19
+++ b/target/arm/translate-a64.c
27
+++ b/hw/arm/aspeed.c
20
@@ -XXX,XX +XXX,XX @@ static void handle_fp_1src_half(DisasContext *s, int opcode, int rd, int rn)
28
@@ -XXX,XX +XXX,XX @@ struct AspeedMachineState {
21
tcg_gen_xori_i32(tcg_res, tcg_op, 0x8000);
29
static void aspeed_write_smpboot(ARMCPU *cpu,
22
break;
30
const struct arm_boot_info *info)
23
case 0x3: /* FSQRT */
31
{
24
- gen_helper_sqrt_f16(tcg_res, tcg_op, cpu_env);
32
- static const uint32_t poll_mailbox_ready[] = {
25
+ fpst = get_fpstatus_ptr(true);
33
+ AddressSpace *as = arm_boot_address_space(cpu, info);
26
+ gen_helper_sqrt_f16(tcg_res, tcg_op, fpst);
34
+ static const ARMInsnFixup poll_mailbox_ready[] = {
27
break;
35
/*
28
case 0x8: /* FRINTN */
36
* r2 = per-cpu go sign value
29
case 0x9: /* FRINTP */
37
* r1 = AST_SMP_MBOX_FIELD_ENTRY
38
* r0 = AST_SMP_MBOX_FIELD_GOSIGN
39
*/
40
- 0xee100fb0, /* mrc p15, 0, r0, c0, c0, 5 */
41
- 0xe21000ff, /* ands r0, r0, #255 */
42
- 0xe59f201c, /* ldr r2, [pc, #28] */
43
- 0xe1822000, /* orr r2, r2, r0 */
44
+ { 0xee100fb0 }, /* mrc p15, 0, r0, c0, c0, 5 */
45
+ { 0xe21000ff }, /* ands r0, r0, #255 */
46
+ { 0xe59f201c }, /* ldr r2, [pc, #28] */
47
+ { 0xe1822000 }, /* orr r2, r2, r0 */
48
49
- 0xe59f1018, /* ldr r1, [pc, #24] */
50
- 0xe59f0018, /* ldr r0, [pc, #24] */
51
+ { 0xe59f1018 }, /* ldr r1, [pc, #24] */
52
+ { 0xe59f0018 }, /* ldr r0, [pc, #24] */
53
54
- 0xe320f002, /* wfe */
55
- 0xe5904000, /* ldr r4, [r0] */
56
- 0xe1520004, /* cmp r2, r4 */
57
- 0x1afffffb, /* bne <wfe> */
58
- 0xe591f000, /* ldr pc, [r1] */
59
- AST_SMP_MBOX_GOSIGN,
60
- AST_SMP_MBOX_FIELD_ENTRY,
61
- AST_SMP_MBOX_FIELD_GOSIGN,
62
+ { 0xe320f002 }, /* wfe */
63
+ { 0xe5904000 }, /* ldr r4, [r0] */
64
+ { 0xe1520004 }, /* cmp r2, r4 */
65
+ { 0x1afffffb }, /* bne <wfe> */
66
+ { 0xe591f000 }, /* ldr pc, [r1] */
67
+ { AST_SMP_MBOX_GOSIGN },
68
+ { AST_SMP_MBOX_FIELD_ENTRY },
69
+ { AST_SMP_MBOX_FIELD_GOSIGN },
70
+ { 0, FIXUP_TERMINATOR }
71
};
72
+ static const uint32_t fixupcontext[FIXUP_MAX] = { 0 };
73
74
- rom_add_blob_fixed("aspeed.smpboot", poll_mailbox_ready,
75
- sizeof(poll_mailbox_ready),
76
- info->smp_loader_start);
77
+ arm_write_bootloader("aspeed.smpboot", as, info->smp_loader_start,
78
+ poll_mailbox_ready, fixupcontext);
79
}
80
81
static void aspeed_reset_secondary(ARMCPU *cpu,
30
--
82
--
31
2.17.0
83
2.34.1
32
84
33
85
diff view generated by jsdifflib
1
In commit d81ce0ef2c4f105 we added an extra float_status field
1
When writing the secondary-CPU stub boot loader code to the guest,
2
fp_status_fp16 for Arm, but forgot to initialize it correctly
2
use arm_write_bootloader() instead of directly calling
3
by setting it to float_tininess_before_rounding. This currently
3
rom_add_blob_fixed(). This fixes a bug on big-endian hosts, because
4
will only cause problems for the new V8_FP16 feature, since the
4
arm_write_bootloader() will correctly byte-swap the host-byte-order
5
float-to-float conversion code doesn't use it yet. The effect
5
array values into the guest-byte-order to write into the guest
6
would be that we failed to set the Underflow IEEE exception flag
6
memory.
7
in all the cases where we should.
8
7
9
Add the missing initialization.
8
Cc: qemu-stable@nongnu.org
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
Tested-by: Cédric Le Goater <clg@kaod.org>
11
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
12
Message-id: 20230424152717.1333930-4-peter.maydell@linaro.org
13
---
14
hw/arm/raspi.c | 64 +++++++++++++++++++++++++++-----------------------
15
1 file changed, 34 insertions(+), 30 deletions(-)
10
16
11
Fixes: d81ce0ef2c4f105
17
diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c
12
Cc: qemu-stable@nongnu.org
13
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
14
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
15
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
16
Message-id: 20180512004311.9299-16-richard.henderson@linaro.org
17
---
18
target/arm/cpu.c | 2 ++
19
1 file changed, 2 insertions(+)
20
21
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
22
index XXXXXXX..XXXXXXX 100644
18
index XXXXXXX..XXXXXXX 100644
23
--- a/target/arm/cpu.c
19
--- a/hw/arm/raspi.c
24
+++ b/target/arm/cpu.c
20
+++ b/hw/arm/raspi.c
25
@@ -XXX,XX +XXX,XX @@ static void arm_cpu_reset(CPUState *s)
21
@@ -XXX,XX +XXX,XX @@
26
&env->vfp.fp_status);
22
#include "qemu/units.h"
27
set_float_detect_tininess(float_tininess_before_rounding,
23
#include "qemu/cutils.h"
28
&env->vfp.standard_fp_status);
24
#include "qapi/error.h"
29
+ set_float_detect_tininess(float_tininess_before_rounding,
25
+#include "hw/arm/boot.h"
30
+ &env->vfp.fp_status_f16);
26
#include "hw/arm/bcm2836.h"
31
#ifndef CONFIG_USER_ONLY
27
#include "hw/registerfields.h"
32
if (kvm_enabled()) {
28
#include "qemu/error-report.h"
33
kvm_arm_reset_vcpu(cpu);
29
@@ -XXX,XX +XXX,XX @@ static const char *board_type(uint32_t board_rev)
30
31
static void write_smpboot(ARMCPU *cpu, const struct arm_boot_info *info)
32
{
33
- static const uint32_t smpboot[] = {
34
- 0xe1a0e00f, /* mov lr, pc */
35
- 0xe3a0fe00 + (BOARDSETUP_ADDR >> 4), /* mov pc, BOARDSETUP_ADDR */
36
- 0xee100fb0, /* mrc p15, 0, r0, c0, c0, 5;get core ID */
37
- 0xe7e10050, /* ubfx r0, r0, #0, #2 ;extract LSB */
38
- 0xe59f5014, /* ldr r5, =0x400000CC ;load mbox base */
39
- 0xe320f001, /* 1: yield */
40
- 0xe7953200, /* ldr r3, [r5, r0, lsl #4] ;read mbox for our core*/
41
- 0xe3530000, /* cmp r3, #0 ;spin while zero */
42
- 0x0afffffb, /* beq 1b */
43
- 0xe7853200, /* str r3, [r5, r0, lsl #4] ;clear mbox */
44
- 0xe12fff13, /* bx r3 ;jump to target */
45
- 0x400000cc, /* (constant: mailbox 3 read/clear base) */
46
+ static const ARMInsnFixup smpboot[] = {
47
+ { 0xe1a0e00f }, /* mov lr, pc */
48
+ { 0xe3a0fe00 + (BOARDSETUP_ADDR >> 4) }, /* mov pc, BOARDSETUP_ADDR */
49
+ { 0xee100fb0 }, /* mrc p15, 0, r0, c0, c0, 5;get core ID */
50
+ { 0xe7e10050 }, /* ubfx r0, r0, #0, #2 ;extract LSB */
51
+ { 0xe59f5014 }, /* ldr r5, =0x400000CC ;load mbox base */
52
+ { 0xe320f001 }, /* 1: yield */
53
+ { 0xe7953200 }, /* ldr r3, [r5, r0, lsl #4] ;read mbox for our core */
54
+ { 0xe3530000 }, /* cmp r3, #0 ;spin while zero */
55
+ { 0x0afffffb }, /* beq 1b */
56
+ { 0xe7853200 }, /* str r3, [r5, r0, lsl #4] ;clear mbox */
57
+ { 0xe12fff13 }, /* bx r3 ;jump to target */
58
+ { 0x400000cc }, /* (constant: mailbox 3 read/clear base) */
59
+ { 0, FIXUP_TERMINATOR }
60
};
61
+ static const uint32_t fixupcontext[FIXUP_MAX] = { 0 };
62
63
/* check that we don't overrun board setup vectors */
64
QEMU_BUILD_BUG_ON(SMPBOOT_ADDR + sizeof(smpboot) > MVBAR_ADDR);
65
@@ -XXX,XX +XXX,XX @@ static void write_smpboot(ARMCPU *cpu, const struct arm_boot_info *info)
66
QEMU_BUILD_BUG_ON((BOARDSETUP_ADDR & 0xf) != 0
67
|| (BOARDSETUP_ADDR >> 4) >= 0x100);
68
69
- rom_add_blob_fixed_as("raspi_smpboot", smpboot, sizeof(smpboot),
70
- info->smp_loader_start,
71
- arm_boot_address_space(cpu, info));
72
+ arm_write_bootloader("raspi_smpboot", arm_boot_address_space(cpu, info),
73
+ info->smp_loader_start, smpboot, fixupcontext);
74
}
75
76
static void write_smpboot64(ARMCPU *cpu, const struct arm_boot_info *info)
77
@@ -XXX,XX +XXX,XX @@ static void write_smpboot64(ARMCPU *cpu, const struct arm_boot_info *info)
78
* the primary CPU goes into the kernel. We put these variables inside
79
* a rom blob, so that the reset for ROM contents zeroes them for us.
80
*/
81
- static const uint32_t smpboot[] = {
82
- 0xd2801b05, /* mov x5, 0xd8 */
83
- 0xd53800a6, /* mrs x6, mpidr_el1 */
84
- 0x924004c6, /* and x6, x6, #0x3 */
85
- 0xd503205f, /* spin: wfe */
86
- 0xf86678a4, /* ldr x4, [x5,x6,lsl #3] */
87
- 0xb4ffffc4, /* cbz x4, spin */
88
- 0xd2800000, /* mov x0, #0x0 */
89
- 0xd2800001, /* mov x1, #0x0 */
90
- 0xd2800002, /* mov x2, #0x0 */
91
- 0xd2800003, /* mov x3, #0x0 */
92
- 0xd61f0080, /* br x4 */
93
+ static const ARMInsnFixup smpboot[] = {
94
+ { 0xd2801b05 }, /* mov x5, 0xd8 */
95
+ { 0xd53800a6 }, /* mrs x6, mpidr_el1 */
96
+ { 0x924004c6 }, /* and x6, x6, #0x3 */
97
+ { 0xd503205f }, /* spin: wfe */
98
+ { 0xf86678a4 }, /* ldr x4, [x5,x6,lsl #3] */
99
+ { 0xb4ffffc4 }, /* cbz x4, spin */
100
+ { 0xd2800000 }, /* mov x0, #0x0 */
101
+ { 0xd2800001 }, /* mov x1, #0x0 */
102
+ { 0xd2800002 }, /* mov x2, #0x0 */
103
+ { 0xd2800003 }, /* mov x3, #0x0 */
104
+ { 0xd61f0080 }, /* br x4 */
105
+ { 0, FIXUP_TERMINATOR }
106
};
107
+ static const uint32_t fixupcontext[FIXUP_MAX] = { 0 };
108
109
static const uint64_t spintables[] = {
110
0, 0, 0, 0
111
};
112
113
- rom_add_blob_fixed_as("raspi_smpboot", smpboot, sizeof(smpboot),
114
- info->smp_loader_start, as);
115
+ arm_write_bootloader("raspi_smpboot", as, info->smp_loader_start,
116
+ smpboot, fixupcontext);
117
rom_add_blob_fixed_as("raspi_spintables", spintables, sizeof(spintables),
118
SPINTABLE_ADDR, as);
119
}
34
--
120
--
35
2.17.0
121
2.34.1
36
122
37
123
diff view generated by jsdifflib
1
In float-to-integer conversion, if the floating point input
1
The Allwinner PIC model uses set_bit() and clear_bit() to update the
2
converts exactly to the largest or smallest integer that
2
values in its irq_pending[] array when an interrupt arrives. However
3
fits in to the result type, this is not an overflow.
3
it is using these functions wrongly: they work on an array of type
4
In this situation we were producing the correct result value,
4
'long', and it is passing an array of type 'uint32_t'. Because the
5
but were incorrectly setting the Invalid flag.
5
code manually figures out the right array element, this works on
6
For example for Arm A64, "FCVTAS w0, d0" on an input of
6
little-endian hosts and on 32-bit big-endian hosts, where bits 0..31
7
0x41dfffffffc00000 should produce 0x7fffffff and set no flags.
7
in a 'long' are in the same place as they are in a 'uint32_t'.
8
However it breaks on 64-bit big-endian hosts.
8
9
9
Fix the boundary case to take the right half of the if()
10
Remove the use of set_bit() and clear_bit() in favour of using
10
statements.
11
deposit32() on the array element. This fixes a bug where on
11
12
big-endian 64-bit hosts the guest kernel would hang early on in
12
This fixes a regression from 2.11 introduced by the softfloat
13
bootup.
13
refactoring.
14
14
15
Cc: qemu-stable@nongnu.org
15
Cc: qemu-stable@nongnu.org
16
Fixes: ab52f973a50
17
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
16
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
18
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
17
Reviewed-by: Thomas Huth <thuth@redhat.com>
19
Message-id: 20180510140141.12120-1-peter.maydell@linaro.org
18
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
19
Message-id: 20230424152833.1334136-1-peter.maydell@linaro.org
20
---
20
---
21
fpu/softfloat.c | 4 ++--
21
hw/intc/allwinner-a10-pic.c | 7 ++-----
22
1 file changed, 2 insertions(+), 2 deletions(-)
22
1 file changed, 2 insertions(+), 5 deletions(-)
23
23
24
diff --git a/fpu/softfloat.c b/fpu/softfloat.c
24
diff --git a/hw/intc/allwinner-a10-pic.c b/hw/intc/allwinner-a10-pic.c
25
index XXXXXXX..XXXXXXX 100644
25
index XXXXXXX..XXXXXXX 100644
26
--- a/fpu/softfloat.c
26
--- a/hw/intc/allwinner-a10-pic.c
27
+++ b/fpu/softfloat.c
27
+++ b/hw/intc/allwinner-a10-pic.c
28
@@ -XXX,XX +XXX,XX @@ static int64_t round_to_int_and_pack(FloatParts in, int rmode,
28
@@ -XXX,XX +XXX,XX @@ static void aw_a10_pic_update(AwA10PICState *s)
29
r = UINT64_MAX;
29
static void aw_a10_pic_set_irq(void *opaque, int irq, int level)
30
}
30
{
31
if (p.sign) {
31
AwA10PICState *s = opaque;
32
- if (r < -(uint64_t) min) {
32
+ uint32_t *pending_reg = &s->irq_pending[irq / 32];
33
+ if (r <= -(uint64_t) min) {
33
34
return -r;
34
- if (level) {
35
} else {
35
- set_bit(irq % 32, (void *)&s->irq_pending[irq / 32]);
36
s->float_exception_flags = orig_flags | float_flag_invalid;
36
- } else {
37
return min;
37
- clear_bit(irq % 32, (void *)&s->irq_pending[irq / 32]);
38
}
38
- }
39
} else {
39
+ *pending_reg = deposit32(*pending_reg, irq % 32, 1, level);
40
- if (r < max) {
40
aw_a10_pic_update(s);
41
+ if (r <= max) {
41
}
42
return r;
42
43
} else {
44
s->float_exception_flags = orig_flags | float_flag_invalid;
45
--
43
--
46
2.17.0
44
2.34.1
47
45
48
46
diff view generated by jsdifflib
New patch
1
In several places in the 32-bit Arm translate.c, we try to use
2
load_cpu_field() to load from a CPUARMState field into a TCGv_i32
3
where the field is actually 64-bit. This works on little-endian
4
hosts, but gives the wrong half of the register on big-endian.
1
5
6
Add a new load_cpu_field_low32() which loads the low 32 bits
7
of a 64-bit field into a TCGv_i32. The new macro includes a
8
compile-time check against accidentally using it on a field
9
of the wrong size. Use it to fix the two places in the code
10
where we were using load_cpu_field() on a 64-bit field.
11
12
This fixes a bug where on big-endian hosts the guest would
13
crash after executing an ERET instruction, and a more corner
14
case one where some UNDEFs for attempted accesses to MSR
15
banked registers from Secure EL1 might go to the wrong EL.
16
17
Cc: qemu-stable@nongnu.org
18
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
19
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
20
Message-id: 20230424153909.1419369-2-peter.maydell@linaro.org
21
---
22
target/arm/translate-a32.h | 7 +++++++
23
target/arm/tcg/translate.c | 4 ++--
24
2 files changed, 9 insertions(+), 2 deletions(-)
25
26
diff --git a/target/arm/translate-a32.h b/target/arm/translate-a32.h
27
index XXXXXXX..XXXXXXX 100644
28
--- a/target/arm/translate-a32.h
29
+++ b/target/arm/translate-a32.h
30
@@ -XXX,XX +XXX,XX @@ static inline TCGv_i32 load_cpu_offset(int offset)
31
32
#define load_cpu_field(name) load_cpu_offset(offsetof(CPUARMState, name))
33
34
+/* Load from the low half of a 64-bit field to a TCGv_i32 */
35
+#define load_cpu_field_low32(name) \
36
+ ({ \
37
+ QEMU_BUILD_BUG_ON(sizeof_field(CPUARMState, name) != 8); \
38
+ load_cpu_offset(offsetoflow32(CPUARMState, name)); \
39
+ })
40
+
41
void store_cpu_offset(TCGv_i32 var, int offset, int size);
42
43
#define store_cpu_field(var, name) \
44
diff --git a/target/arm/tcg/translate.c b/target/arm/tcg/translate.c
45
index XXXXXXX..XXXXXXX 100644
46
--- a/target/arm/tcg/translate.c
47
+++ b/target/arm/tcg/translate.c
48
@@ -XXX,XX +XXX,XX @@ static bool msr_banked_access_decode(DisasContext *s, int r, int sysm, int rn,
49
if (arm_dc_feature(s, ARM_FEATURE_AARCH64) &&
50
dc_isar_feature(aa64_sel2, s)) {
51
/* Target EL is EL<3 minus SCR_EL3.EEL2> */
52
- tcg_el = load_cpu_field(cp15.scr_el3);
53
+ tcg_el = load_cpu_field_low32(cp15.scr_el3);
54
tcg_gen_sextract_i32(tcg_el, tcg_el, ctz32(SCR_EEL2), 1);
55
tcg_gen_addi_i32(tcg_el, tcg_el, 3);
56
} else {
57
@@ -XXX,XX +XXX,XX @@ static bool trans_ERET(DisasContext *s, arg_ERET *a)
58
}
59
if (s->current_el == 2) {
60
/* ERET from Hyp uses ELR_Hyp, not LR */
61
- tmp = load_cpu_field(elr_el[2]);
62
+ tmp = load_cpu_field_low32(elr_el[2]);
63
} else {
64
tmp = load_reg(s, 14);
65
}
66
--
67
2.34.1
diff view generated by jsdifflib
New patch
1
Add some compile-time asserts to the load_cpu_field() and store_cpu_field()
2
macros that the struct field being accessed is the expected size. This
3
lets us catch cases where we incorrectly tried to do a 32-bit load
4
from a 64-bit struct field.
1
5
6
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
8
Message-id: 20230424153909.1419369-3-peter.maydell@linaro.org
9
---
10
target/arm/translate-a32.h | 17 +++++++++++++----
11
1 file changed, 13 insertions(+), 4 deletions(-)
12
13
diff --git a/target/arm/translate-a32.h b/target/arm/translate-a32.h
14
index XXXXXXX..XXXXXXX 100644
15
--- a/target/arm/translate-a32.h
16
+++ b/target/arm/translate-a32.h
17
@@ -XXX,XX +XXX,XX @@ static inline TCGv_i32 load_cpu_offset(int offset)
18
return tmp;
19
}
20
21
-#define load_cpu_field(name) load_cpu_offset(offsetof(CPUARMState, name))
22
+/* Load from a 32-bit field to a TCGv_i32 */
23
+#define load_cpu_field(name) \
24
+ ({ \
25
+ QEMU_BUILD_BUG_ON(sizeof_field(CPUARMState, name) != 4); \
26
+ load_cpu_offset(offsetof(CPUARMState, name)); \
27
+ })
28
29
/* Load from the low half of a 64-bit field to a TCGv_i32 */
30
#define load_cpu_field_low32(name) \
31
@@ -XXX,XX +XXX,XX @@ static inline TCGv_i32 load_cpu_offset(int offset)
32
33
void store_cpu_offset(TCGv_i32 var, int offset, int size);
34
35
-#define store_cpu_field(var, name) \
36
- store_cpu_offset(var, offsetof(CPUARMState, name), \
37
- sizeof_field(CPUARMState, name))
38
+#define store_cpu_field(val, name) \
39
+ ({ \
40
+ QEMU_BUILD_BUG_ON(sizeof_field(CPUARMState, name) != 4 \
41
+ && sizeof_field(CPUARMState, name) != 1); \
42
+ store_cpu_offset(val, offsetof(CPUARMState, name), \
43
+ sizeof_field(CPUARMState, name)); \
44
+ })
45
46
#define store_cpu_field_constant(val, name) \
47
store_cpu_field(tcg_constant_i32(val), name)
48
--
49
2.34.1
diff view generated by jsdifflib
1
From: Alex Bennée <alex.bennee@linaro.org>
1
In allwinner_sdhost_process_desc() we just read directly from
2
guest memory into a host TransferDescriptor struct and back.
3
This only works on little-endian hosts. Abstract the reading
4
and writing of descriptors into functions that handle the
5
byte-swapping so that TransferDescriptor structs as seen by
6
the rest of the code are always in host-order.
2
7
3
These where missed out from the rest of the half-precision work.
8
This fixes a failure of one of the avocado tests on s390.
4
9
5
Cc: qemu-stable@nongnu.org
10
Cc: qemu-stable@nongnu.org
6
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
7
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
8
Tested-by: Alex Bennée <alex.bennee@linaro.org>
9
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
10
Message-id: 20180512003217.9105-9-richard.henderson@linaro.org
11
[rth: Diagnose lack of FP16 before fp_access_check]
12
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
13
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
Reviewed-by: Thomas Huth <thuth@redhat.com>
13
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
14
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
15
Message-id: 20230424165053.1428857-2-peter.maydell@linaro.org
14
---
16
---
15
target/arm/helper-a64.h | 2 +
17
hw/sd/allwinner-sdhost.c | 31 ++++++++++++++++++++++++++-----
16
target/arm/helper-a64.c | 10 +++++
18
1 file changed, 26 insertions(+), 5 deletions(-)
17
target/arm/translate-a64.c | 88 ++++++++++++++++++++++++++++++--------
18
3 files changed, 83 insertions(+), 17 deletions(-)
19
19
20
diff --git a/target/arm/helper-a64.h b/target/arm/helper-a64.h
20
diff --git a/hw/sd/allwinner-sdhost.c b/hw/sd/allwinner-sdhost.c
21
index XXXXXXX..XXXXXXX 100644
21
index XXXXXXX..XXXXXXX 100644
22
--- a/target/arm/helper-a64.h
22
--- a/hw/sd/allwinner-sdhost.c
23
+++ b/target/arm/helper-a64.h
23
+++ b/hw/sd/allwinner-sdhost.c
24
@@ -XXX,XX +XXX,XX @@
24
@@ -XXX,XX +XXX,XX @@ static void allwinner_sdhost_auto_stop(AwSdHostState *s)
25
DEF_HELPER_FLAGS_2(udiv64, TCG_CALL_NO_RWG_SE, i64, i64, i64)
25
}
26
DEF_HELPER_FLAGS_2(sdiv64, TCG_CALL_NO_RWG_SE, s64, s64, s64)
27
DEF_HELPER_FLAGS_1(rbit64, TCG_CALL_NO_RWG_SE, i64, i64)
28
+DEF_HELPER_3(vfp_cmph_a64, i64, f16, f16, ptr)
29
+DEF_HELPER_3(vfp_cmpeh_a64, i64, f16, f16, ptr)
30
DEF_HELPER_3(vfp_cmps_a64, i64, f32, f32, ptr)
31
DEF_HELPER_3(vfp_cmpes_a64, i64, f32, f32, ptr)
32
DEF_HELPER_3(vfp_cmpd_a64, i64, f64, f64, ptr)
33
diff --git a/target/arm/helper-a64.c b/target/arm/helper-a64.c
34
index XXXXXXX..XXXXXXX 100644
35
--- a/target/arm/helper-a64.c
36
+++ b/target/arm/helper-a64.c
37
@@ -XXX,XX +XXX,XX @@ static inline uint32_t float_rel_to_flags(int res)
38
return flags;
39
}
26
}
40
27
41
+uint64_t HELPER(vfp_cmph_a64)(float16 x, float16 y, void *fp_status)
28
+static void read_descriptor(AwSdHostState *s, hwaddr desc_addr,
29
+ TransferDescriptor *desc)
42
+{
30
+{
43
+ return float_rel_to_flags(float16_compare_quiet(x, y, fp_status));
31
+ uint32_t desc_words[4];
32
+ dma_memory_read(&s->dma_as, desc_addr, &desc_words, sizeof(desc_words),
33
+ MEMTXATTRS_UNSPECIFIED);
34
+ desc->status = le32_to_cpu(desc_words[0]);
35
+ desc->size = le32_to_cpu(desc_words[1]);
36
+ desc->addr = le32_to_cpu(desc_words[2]);
37
+ desc->next = le32_to_cpu(desc_words[3]);
44
+}
38
+}
45
+
39
+
46
+uint64_t HELPER(vfp_cmpeh_a64)(float16 x, float16 y, void *fp_status)
40
+static void write_descriptor(AwSdHostState *s, hwaddr desc_addr,
41
+ const TransferDescriptor *desc)
47
+{
42
+{
48
+ return float_rel_to_flags(float16_compare(x, y, fp_status));
43
+ uint32_t desc_words[4];
44
+ desc_words[0] = cpu_to_le32(desc->status);
45
+ desc_words[1] = cpu_to_le32(desc->size);
46
+ desc_words[2] = cpu_to_le32(desc->addr);
47
+ desc_words[3] = cpu_to_le32(desc->next);
48
+ dma_memory_write(&s->dma_as, desc_addr, &desc_words, sizeof(desc_words),
49
+ MEMTXATTRS_UNSPECIFIED);
49
+}
50
+}
50
+
51
+
51
uint64_t HELPER(vfp_cmps_a64)(float32 x, float32 y, void *fp_status)
52
static uint32_t allwinner_sdhost_process_desc(AwSdHostState *s,
52
{
53
hwaddr desc_addr,
53
return float_rel_to_flags(float32_compare_quiet(x, y, fp_status));
54
TransferDescriptor *desc,
54
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
55
@@ -XXX,XX +XXX,XX @@ static uint32_t allwinner_sdhost_process_desc(AwSdHostState *s,
55
index XXXXXXX..XXXXXXX 100644
56
uint32_t num_bytes = max_bytes;
56
--- a/target/arm/translate-a64.c
57
uint8_t buf[1024];
57
+++ b/target/arm/translate-a64.c
58
58
@@ -XXX,XX +XXX,XX @@ static void disas_data_proc_reg(DisasContext *s, uint32_t insn)
59
- /* Read descriptor */
59
}
60
- dma_memory_read(&s->dma_as, desc_addr, desc, sizeof(*desc),
61
- MEMTXATTRS_UNSPECIFIED);
62
+ read_descriptor(s, desc_addr, desc);
63
if (desc->size == 0) {
64
desc->size = klass->max_desc_size;
65
} else if (desc->size > klass->max_desc_size) {
66
@@ -XXX,XX +XXX,XX @@ static uint32_t allwinner_sdhost_process_desc(AwSdHostState *s,
67
68
/* Clear hold flag and flush descriptor */
69
desc->status &= ~DESC_STATUS_HOLD;
70
- dma_memory_write(&s->dma_as, desc_addr, desc, sizeof(*desc),
71
- MEMTXATTRS_UNSPECIFIED);
72
+ write_descriptor(s, desc_addr, desc);
73
74
return num_done;
60
}
75
}
61
62
-static void handle_fp_compare(DisasContext *s, bool is_double,
63
+static void handle_fp_compare(DisasContext *s, int size,
64
unsigned int rn, unsigned int rm,
65
bool cmp_with_zero, bool signal_all_nans)
66
{
67
TCGv_i64 tcg_flags = tcg_temp_new_i64();
68
- TCGv_ptr fpst = get_fpstatus_ptr(false);
69
+ TCGv_ptr fpst = get_fpstatus_ptr(size == MO_16);
70
71
- if (is_double) {
72
+ if (size == MO_64) {
73
TCGv_i64 tcg_vn, tcg_vm;
74
75
tcg_vn = read_fp_dreg(s, rn);
76
@@ -XXX,XX +XXX,XX @@ static void handle_fp_compare(DisasContext *s, bool is_double,
77
tcg_temp_free_i64(tcg_vn);
78
tcg_temp_free_i64(tcg_vm);
79
} else {
80
- TCGv_i32 tcg_vn, tcg_vm;
81
+ TCGv_i32 tcg_vn = tcg_temp_new_i32();
82
+ TCGv_i32 tcg_vm = tcg_temp_new_i32();
83
84
- tcg_vn = read_fp_sreg(s, rn);
85
+ read_vec_element_i32(s, tcg_vn, rn, 0, size);
86
if (cmp_with_zero) {
87
- tcg_vm = tcg_const_i32(0);
88
+ tcg_gen_movi_i32(tcg_vm, 0);
89
} else {
90
- tcg_vm = read_fp_sreg(s, rm);
91
+ read_vec_element_i32(s, tcg_vm, rm, 0, size);
92
}
93
- if (signal_all_nans) {
94
- gen_helper_vfp_cmpes_a64(tcg_flags, tcg_vn, tcg_vm, fpst);
95
- } else {
96
- gen_helper_vfp_cmps_a64(tcg_flags, tcg_vn, tcg_vm, fpst);
97
+
98
+ switch (size) {
99
+ case MO_32:
100
+ if (signal_all_nans) {
101
+ gen_helper_vfp_cmpes_a64(tcg_flags, tcg_vn, tcg_vm, fpst);
102
+ } else {
103
+ gen_helper_vfp_cmps_a64(tcg_flags, tcg_vn, tcg_vm, fpst);
104
+ }
105
+ break;
106
+ case MO_16:
107
+ if (signal_all_nans) {
108
+ gen_helper_vfp_cmpeh_a64(tcg_flags, tcg_vn, tcg_vm, fpst);
109
+ } else {
110
+ gen_helper_vfp_cmph_a64(tcg_flags, tcg_vn, tcg_vm, fpst);
111
+ }
112
+ break;
113
+ default:
114
+ g_assert_not_reached();
115
}
116
+
117
tcg_temp_free_i32(tcg_vn);
118
tcg_temp_free_i32(tcg_vm);
119
}
120
@@ -XXX,XX +XXX,XX @@ static void handle_fp_compare(DisasContext *s, bool is_double,
121
static void disas_fp_compare(DisasContext *s, uint32_t insn)
122
{
123
unsigned int mos, type, rm, op, rn, opc, op2r;
124
+ int size;
125
126
mos = extract32(insn, 29, 3);
127
- type = extract32(insn, 22, 2); /* 0 = single, 1 = double */
128
+ type = extract32(insn, 22, 2);
129
rm = extract32(insn, 16, 5);
130
op = extract32(insn, 14, 2);
131
rn = extract32(insn, 5, 5);
132
opc = extract32(insn, 3, 2);
133
op2r = extract32(insn, 0, 3);
134
135
- if (mos || op || op2r || type > 1) {
136
+ if (mos || op || op2r) {
137
+ unallocated_encoding(s);
138
+ return;
139
+ }
140
+
141
+ switch (type) {
142
+ case 0:
143
+ size = MO_32;
144
+ break;
145
+ case 1:
146
+ size = MO_64;
147
+ break;
148
+ case 3:
149
+ size = MO_16;
150
+ if (arm_dc_feature(s, ARM_FEATURE_V8_FP16)) {
151
+ break;
152
+ }
153
+ /* fallthru */
154
+ default:
155
unallocated_encoding(s);
156
return;
157
}
158
@@ -XXX,XX +XXX,XX @@ static void disas_fp_compare(DisasContext *s, uint32_t insn)
159
return;
160
}
161
162
- handle_fp_compare(s, type, rn, rm, opc & 1, opc & 2);
163
+ handle_fp_compare(s, size, rn, rm, opc & 1, opc & 2);
164
}
165
166
/* Floating point conditional compare
167
@@ -XXX,XX +XXX,XX @@ static void disas_fp_ccomp(DisasContext *s, uint32_t insn)
168
unsigned int mos, type, rm, cond, rn, op, nzcv;
169
TCGv_i64 tcg_flags;
170
TCGLabel *label_continue = NULL;
171
+ int size;
172
173
mos = extract32(insn, 29, 3);
174
- type = extract32(insn, 22, 2); /* 0 = single, 1 = double */
175
+ type = extract32(insn, 22, 2);
176
rm = extract32(insn, 16, 5);
177
cond = extract32(insn, 12, 4);
178
rn = extract32(insn, 5, 5);
179
op = extract32(insn, 4, 1);
180
nzcv = extract32(insn, 0, 4);
181
182
- if (mos || type > 1) {
183
+ if (mos) {
184
+ unallocated_encoding(s);
185
+ return;
186
+ }
187
+
188
+ switch (type) {
189
+ case 0:
190
+ size = MO_32;
191
+ break;
192
+ case 1:
193
+ size = MO_64;
194
+ break;
195
+ case 3:
196
+ size = MO_16;
197
+ if (arm_dc_feature(s, ARM_FEATURE_V8_FP16)) {
198
+ break;
199
+ }
200
+ /* fallthru */
201
+ default:
202
unallocated_encoding(s);
203
return;
204
}
205
@@ -XXX,XX +XXX,XX @@ static void disas_fp_ccomp(DisasContext *s, uint32_t insn)
206
gen_set_label(label_match);
207
}
208
209
- handle_fp_compare(s, type, rn, rm, false, op);
210
+ handle_fp_compare(s, size, rn, rm, false, op);
211
212
if (cond < 0x0e) {
213
gen_set_label(label_continue);
214
--
76
--
215
2.17.0
77
2.34.1
216
78
217
79
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
In allwinner-sun8i-emac we just read directly from guest memory into
2
a host FrameDescriptor struct and back. This only works on
3
little-endian hosts. Reading and writing of descriptors is already
4
abstracted into functions; make those functions also handle the
5
byte-swapping so that TransferDescriptor structs as seen by the rest
6
of the code are always in host-order, and fix two places that were
7
doing ad-hoc descriptor reading without using the functions.
2
8
3
Cc: qemu-stable@nongnu.org
9
Cc: qemu-stable@nongnu.org
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
Reviewed-by: Thomas Huth <thuth@redhat.com>
4
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
12
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
5
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
13
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
6
Tested-by: Alex Bennée <alex.bennee@linaro.org>
14
Message-id: 20230424165053.1428857-3-peter.maydell@linaro.org
7
Message-id: 20180512003217.9105-4-richard.henderson@linaro.org
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
---
15
---
10
target/arm/helper.h | 6 +++
16
hw/net/allwinner-sun8i-emac.c | 22 +++++++++++++++-------
11
target/arm/helper.c | 38 ++++++++++++++-
17
1 file changed, 15 insertions(+), 7 deletions(-)
12
target/arm/translate-a64.c | 96 +++++++++++++++++++++++++++++++-------
13
3 files changed, 122 insertions(+), 18 deletions(-)
14
18
15
diff --git a/target/arm/helper.h b/target/arm/helper.h
19
diff --git a/hw/net/allwinner-sun8i-emac.c b/hw/net/allwinner-sun8i-emac.c
16
index XXXXXXX..XXXXXXX 100644
20
index XXXXXXX..XXXXXXX 100644
17
--- a/target/arm/helper.h
21
--- a/hw/net/allwinner-sun8i-emac.c
18
+++ b/target/arm/helper.h
22
+++ b/hw/net/allwinner-sun8i-emac.c
19
@@ -XXX,XX +XXX,XX @@ DEF_HELPER_3(vfp_touhd_round_to_zero, i64, f64, i32, ptr)
23
@@ -XXX,XX +XXX,XX @@ static void allwinner_sun8i_emac_get_desc(AwSun8iEmacState *s,
20
DEF_HELPER_3(vfp_tould_round_to_zero, i64, f64, i32, ptr)
24
FrameDescriptor *desc,
21
DEF_HELPER_3(vfp_touhh, i32, f16, i32, ptr)
25
uint32_t phys_addr)
22
DEF_HELPER_3(vfp_toshh, i32, f16, i32, ptr)
26
{
23
+DEF_HELPER_3(vfp_toulh, i32, f16, i32, ptr)
27
- dma_memory_read(&s->dma_as, phys_addr, desc, sizeof(*desc),
24
+DEF_HELPER_3(vfp_toslh, i32, f16, i32, ptr)
28
+ uint32_t desc_words[4];
25
+DEF_HELPER_3(vfp_touqh, i64, f16, i32, ptr)
29
+ dma_memory_read(&s->dma_as, phys_addr, &desc_words, sizeof(desc_words),
26
+DEF_HELPER_3(vfp_tosqh, i64, f16, i32, ptr)
30
MEMTXATTRS_UNSPECIFIED);
27
DEF_HELPER_3(vfp_toshs, i32, f32, i32, ptr)
31
+ desc->status = le32_to_cpu(desc_words[0]);
28
DEF_HELPER_3(vfp_tosls, i32, f32, i32, ptr)
32
+ desc->status2 = le32_to_cpu(desc_words[1]);
29
DEF_HELPER_3(vfp_tosqs, i64, f32, i32, ptr)
33
+ desc->addr = le32_to_cpu(desc_words[2]);
30
@@ -XXX,XX +XXX,XX @@ DEF_HELPER_3(vfp_ultod, f64, i64, i32, ptr)
34
+ desc->next = le32_to_cpu(desc_words[3]);
31
DEF_HELPER_3(vfp_uqtod, f64, i64, i32, ptr)
32
DEF_HELPER_3(vfp_sltoh, f16, i32, i32, ptr)
33
DEF_HELPER_3(vfp_ultoh, f16, i32, i32, ptr)
34
+DEF_HELPER_3(vfp_sqtoh, f16, i64, i32, ptr)
35
+DEF_HELPER_3(vfp_uqtoh, f16, i64, i32, ptr)
36
37
DEF_HELPER_FLAGS_2(set_rmode, TCG_CALL_NO_RWG, i32, i32, ptr)
38
DEF_HELPER_FLAGS_2(set_neon_rmode, TCG_CALL_NO_RWG, i32, i32, env)
39
diff --git a/target/arm/helper.c b/target/arm/helper.c
40
index XXXXXXX..XXXXXXX 100644
41
--- a/target/arm/helper.c
42
+++ b/target/arm/helper.c
43
@@ -XXX,XX +XXX,XX @@ VFP_CONV_FIX_A64(uq, s, 32, 64, uint64)
44
#undef VFP_CONV_FIX_A64
45
46
/* Conversion to/from f16 can overflow to infinity before/after scaling.
47
- * Therefore we convert to f64 (which does not round), scale,
48
- * and then convert f64 to f16 (which may round).
49
+ * Therefore we convert to f64, scale, and then convert f64 to f16; or
50
+ * vice versa for conversion to integer.
51
+ *
52
+ * For 16- and 32-bit integers, the conversion to f64 never rounds.
53
+ * For 64-bit integers, any integer that would cause rounding will also
54
+ * overflow to f16 infinity, so there is no double rounding problem.
55
*/
56
57
static float16 do_postscale_fp16(float64 f, int shift, float_status *fpst)
58
@@ -XXX,XX +XXX,XX @@ float16 HELPER(vfp_ultoh)(uint32_t x, uint32_t shift, void *fpst)
59
return do_postscale_fp16(uint32_to_float64(x, fpst), shift, fpst);
60
}
35
}
61
36
62
+float16 HELPER(vfp_sqtoh)(uint64_t x, uint32_t shift, void *fpst)
37
static uint32_t allwinner_sun8i_emac_next_desc(AwSun8iEmacState *s,
63
+{
38
@@ -XXX,XX +XXX,XX @@ static uint32_t allwinner_sun8i_emac_tx_desc(AwSun8iEmacState *s,
64
+ return do_postscale_fp16(int64_to_float64(x, fpst), shift, fpst);
39
}
65
+}
40
66
+
41
static void allwinner_sun8i_emac_flush_desc(AwSun8iEmacState *s,
67
+float16 HELPER(vfp_uqtoh)(uint64_t x, uint32_t shift, void *fpst)
42
- FrameDescriptor *desc,
68
+{
43
+ const FrameDescriptor *desc,
69
+ return do_postscale_fp16(uint64_to_float64(x, fpst), shift, fpst);
44
uint32_t phys_addr)
70
+}
71
+
72
static float64 do_prescale_fp16(float16 f, int shift, float_status *fpst)
73
{
45
{
74
if (unlikely(float16_is_any_nan(f))) {
46
- dma_memory_write(&s->dma_as, phys_addr, desc, sizeof(*desc),
75
@@ -XXX,XX +XXX,XX @@ uint32_t HELPER(vfp_touhh)(float16 x, uint32_t shift, void *fpst)
47
+ uint32_t desc_words[4];
76
return float64_to_uint16(do_prescale_fp16(x, shift, fpst), fpst);
48
+ desc_words[0] = cpu_to_le32(desc->status);
49
+ desc_words[1] = cpu_to_le32(desc->status2);
50
+ desc_words[2] = cpu_to_le32(desc->addr);
51
+ desc_words[3] = cpu_to_le32(desc->next);
52
+ dma_memory_write(&s->dma_as, phys_addr, &desc_words, sizeof(desc_words),
53
MEMTXATTRS_UNSPECIFIED);
77
}
54
}
78
55
79
+uint32_t HELPER(vfp_toslh)(float16 x, uint32_t shift, void *fpst)
56
@@ -XXX,XX +XXX,XX @@ static uint64_t allwinner_sun8i_emac_read(void *opaque, hwaddr offset,
80
+{
57
break;
81
+ return float64_to_int32(do_prescale_fp16(x, shift, fpst), fpst);
58
case REG_TX_CUR_BUF: /* Transmit Current Buffer */
82
+}
59
if (s->tx_desc_curr != 0) {
83
+
60
- dma_memory_read(&s->dma_as, s->tx_desc_curr, &desc, sizeof(desc),
84
+uint32_t HELPER(vfp_toulh)(float16 x, uint32_t shift, void *fpst)
61
- MEMTXATTRS_UNSPECIFIED);
85
+{
62
+ allwinner_sun8i_emac_get_desc(s, &desc, s->tx_desc_curr);
86
+ return float64_to_uint32(do_prescale_fp16(x, shift, fpst), fpst);
63
value = desc.addr;
87
+}
64
} else {
88
+
65
value = 0;
89
+uint64_t HELPER(vfp_tosqh)(float16 x, uint32_t shift, void *fpst)
66
@@ -XXX,XX +XXX,XX @@ static uint64_t allwinner_sun8i_emac_read(void *opaque, hwaddr offset,
90
+{
67
break;
91
+ return float64_to_int64(do_prescale_fp16(x, shift, fpst), fpst);
68
case REG_RX_CUR_BUF: /* Receive Current Buffer */
92
+}
69
if (s->rx_desc_curr != 0) {
93
+
70
- dma_memory_read(&s->dma_as, s->rx_desc_curr, &desc, sizeof(desc),
94
+uint64_t HELPER(vfp_touqh)(float16 x, uint32_t shift, void *fpst)
71
- MEMTXATTRS_UNSPECIFIED);
95
+{
72
+ allwinner_sun8i_emac_get_desc(s, &desc, s->rx_desc_curr);
96
+ return float64_to_uint64(do_prescale_fp16(x, shift, fpst), fpst);
73
value = desc.addr;
97
+}
74
} else {
98
+
75
value = 0;
99
/* Set the current fp rounding mode and return the old one.
100
* The argument is a softfloat float_round_ value.
101
*/
102
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
103
index XXXXXXX..XXXXXXX 100644
104
--- a/target/arm/translate-a64.c
105
+++ b/target/arm/translate-a64.c
106
@@ -XXX,XX +XXX,XX @@ static void handle_fpfpcvt(DisasContext *s, int rd, int rn, int opcode,
107
bool itof, int rmode, int scale, int sf, int type)
108
{
109
bool is_signed = !(opcode & 1);
110
- bool is_double = type;
111
TCGv_ptr tcg_fpstatus;
112
- TCGv_i32 tcg_shift;
113
+ TCGv_i32 tcg_shift, tcg_single;
114
+ TCGv_i64 tcg_double;
115
116
- tcg_fpstatus = get_fpstatus_ptr(false);
117
+ tcg_fpstatus = get_fpstatus_ptr(type == 3);
118
119
tcg_shift = tcg_const_i32(64 - scale);
120
121
@@ -XXX,XX +XXX,XX @@ static void handle_fpfpcvt(DisasContext *s, int rd, int rn, int opcode,
122
tcg_int = tcg_extend;
123
}
124
125
- if (is_double) {
126
- TCGv_i64 tcg_double = tcg_temp_new_i64();
127
+ switch (type) {
128
+ case 1: /* float64 */
129
+ tcg_double = tcg_temp_new_i64();
130
if (is_signed) {
131
gen_helper_vfp_sqtod(tcg_double, tcg_int,
132
tcg_shift, tcg_fpstatus);
133
@@ -XXX,XX +XXX,XX @@ static void handle_fpfpcvt(DisasContext *s, int rd, int rn, int opcode,
134
}
135
write_fp_dreg(s, rd, tcg_double);
136
tcg_temp_free_i64(tcg_double);
137
- } else {
138
- TCGv_i32 tcg_single = tcg_temp_new_i32();
139
+ break;
140
+
141
+ case 0: /* float32 */
142
+ tcg_single = tcg_temp_new_i32();
143
if (is_signed) {
144
gen_helper_vfp_sqtos(tcg_single, tcg_int,
145
tcg_shift, tcg_fpstatus);
146
@@ -XXX,XX +XXX,XX @@ static void handle_fpfpcvt(DisasContext *s, int rd, int rn, int opcode,
147
}
148
write_fp_sreg(s, rd, tcg_single);
149
tcg_temp_free_i32(tcg_single);
150
+ break;
151
+
152
+ case 3: /* float16 */
153
+ tcg_single = tcg_temp_new_i32();
154
+ if (is_signed) {
155
+ gen_helper_vfp_sqtoh(tcg_single, tcg_int,
156
+ tcg_shift, tcg_fpstatus);
157
+ } else {
158
+ gen_helper_vfp_uqtoh(tcg_single, tcg_int,
159
+ tcg_shift, tcg_fpstatus);
160
+ }
161
+ write_fp_sreg(s, rd, tcg_single);
162
+ tcg_temp_free_i32(tcg_single);
163
+ break;
164
+
165
+ default:
166
+ g_assert_not_reached();
167
}
168
} else {
169
TCGv_i64 tcg_int = cpu_reg(s, rd);
170
@@ -XXX,XX +XXX,XX @@ static void handle_fpfpcvt(DisasContext *s, int rd, int rn, int opcode,
171
172
gen_helper_set_rmode(tcg_rmode, tcg_rmode, tcg_fpstatus);
173
174
- if (is_double) {
175
- TCGv_i64 tcg_double = read_fp_dreg(s, rn);
176
+ switch (type) {
177
+ case 1: /* float64 */
178
+ tcg_double = read_fp_dreg(s, rn);
179
if (is_signed) {
180
if (!sf) {
181
gen_helper_vfp_tosld(tcg_int, tcg_double,
182
@@ -XXX,XX +XXX,XX @@ static void handle_fpfpcvt(DisasContext *s, int rd, int rn, int opcode,
183
tcg_shift, tcg_fpstatus);
184
}
185
}
186
+ if (!sf) {
187
+ tcg_gen_ext32u_i64(tcg_int, tcg_int);
188
+ }
189
tcg_temp_free_i64(tcg_double);
190
- } else {
191
- TCGv_i32 tcg_single = read_fp_sreg(s, rn);
192
+ break;
193
+
194
+ case 0: /* float32 */
195
+ tcg_single = read_fp_sreg(s, rn);
196
if (sf) {
197
if (is_signed) {
198
gen_helper_vfp_tosqs(tcg_int, tcg_single,
199
@@ -XXX,XX +XXX,XX @@ static void handle_fpfpcvt(DisasContext *s, int rd, int rn, int opcode,
200
tcg_temp_free_i32(tcg_dest);
201
}
202
tcg_temp_free_i32(tcg_single);
203
+ break;
204
+
205
+ case 3: /* float16 */
206
+ tcg_single = read_fp_sreg(s, rn);
207
+ if (sf) {
208
+ if (is_signed) {
209
+ gen_helper_vfp_tosqh(tcg_int, tcg_single,
210
+ tcg_shift, tcg_fpstatus);
211
+ } else {
212
+ gen_helper_vfp_touqh(tcg_int, tcg_single,
213
+ tcg_shift, tcg_fpstatus);
214
+ }
215
+ } else {
216
+ TCGv_i32 tcg_dest = tcg_temp_new_i32();
217
+ if (is_signed) {
218
+ gen_helper_vfp_toslh(tcg_dest, tcg_single,
219
+ tcg_shift, tcg_fpstatus);
220
+ } else {
221
+ gen_helper_vfp_toulh(tcg_dest, tcg_single,
222
+ tcg_shift, tcg_fpstatus);
223
+ }
224
+ tcg_gen_extu_i32_i64(tcg_int, tcg_dest);
225
+ tcg_temp_free_i32(tcg_dest);
226
+ }
227
+ tcg_temp_free_i32(tcg_single);
228
+ break;
229
+
230
+ default:
231
+ g_assert_not_reached();
232
}
233
234
gen_helper_set_rmode(tcg_rmode, tcg_rmode, tcg_fpstatus);
235
tcg_temp_free_i32(tcg_rmode);
236
-
237
- if (!sf) {
238
- tcg_gen_ext32u_i64(tcg_int, tcg_int);
239
- }
240
}
241
242
tcg_temp_free_ptr(tcg_fpstatus);
243
@@ -XXX,XX +XXX,XX @@ static void disas_fp_int_conv(DisasContext *s, uint32_t insn)
244
/* actual FP conversions */
245
bool itof = extract32(opcode, 1, 1);
246
247
- if (type > 1 || (rmode != 0 && opcode > 1)) {
248
+ if (rmode != 0 && opcode > 1) {
249
+ unallocated_encoding(s);
250
+ return;
251
+ }
252
+ switch (type) {
253
+ case 0: /* float32 */
254
+ case 1: /* float64 */
255
+ break;
256
+ case 3: /* float16 */
257
+ if (arm_dc_feature(s, ARM_FEATURE_V8_FP16)) {
258
+ break;
259
+ }
260
+ /* fallthru */
261
+ default:
262
unallocated_encoding(s);
263
return;
264
}
265
--
76
--
266
2.17.0
77
2.34.1
267
78
268
79
diff view generated by jsdifflib