1
Nothing very exciting this time around...
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
5
thanks
3
-- PMM
6
-- PMM
4
7
5
The following changes since commit 37a712a0f969ca2df7f01182409a6c4825cebfb5:
8
The following changes since commit 7c18f2d663521f1b31b821a13358ce38075eaf7d:
6
9
7
Merge remote-tracking branch 'remotes/bonzini-gitlab/tags/for-upstream' into staging (2020-10-01 12:23:19 +0100)
10
Merge tag 'for-upstream' of https://gitlab.com/bonzini/qemu into staging (2023-04-29 23:07:17 +0100)
8
11
9
are available in the Git repository at:
12
are available in the Git repository at:
10
13
11
https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20201001
14
https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20230502-1
12
15
13
for you to fetch changes up to cdfaa57dcb53ba012439765a1462247dfda8595d:
16
for you to fetch changes up to 0ab99e4252f21550f2c16f859cbcdd3cced9f8bf:
14
17
15
hw/arm/raspi: Remove use of the 'version' value in the board code (2020-10-01 15:31:01 +0100)
18
hw/net/allwinner-sun8i-emac: Correctly byteswap descriptor fields (2023-05-02 13:10:42 +0100)
16
19
17
----------------------------------------------------------------
20
----------------------------------------------------------------
18
target-arm queue:
21
* Support building Arm targets with CONFIG_TCG=no (ie KVM only)
19
* Make isar_feature_aa32_fp16_arith() handle M-profile
22
* hw/net: npcm7xx_emc: set MAC in register space
20
* Fix SVE splice
23
* hw/arm/bcm2835_property: Implement "get command line" message
21
* Fix SVE LDR/STR
24
* Deprecate the '-singlestep' command line option in favour of
22
* Remove ignore_memory_transaction_failures on the raspi2
25
'-one-insn-per-tb' and '-accel one-insn-per-tb=on'
23
* raspi: Various cleanup/refactoring
26
* Deprecate 'singlestep' member of QMP StatusInfo struct
27
* docs/about/deprecated.rst: Add "since 7.1" tag to dtb-kaslr-seed deprecation
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
24
34
25
----------------------------------------------------------------
35
----------------------------------------------------------------
26
Peter Maydell (5):
36
Claudio Fontana (1):
27
target/arm: Replace ARM_FEATURE_PXN with ID_MMFR0.VMSA check
37
target/arm: move cpu_tcg to tcg/cpu32.c
28
target/arm: Move id_pfr0, id_pfr1 into ARMISARegisters
29
hw/intc/armv7m_nvic: Only show ID register values for Main Extension CPUs
30
target/arm: Add ID register values for Cortex-M0
31
target/arm: Make isar_feature_aa32_fp16_arith() handle M-profile
32
38
33
Philippe Mathieu-Daudé (11):
39
Cédric Le Goater (2):
34
hw/arm/raspi: Define various blocks base addresses
40
hw/arm/boot: Make write_bootloader() public as arm_write_bootloader()
35
hw/arm/bcm2835: Add more unimplemented peripherals
41
hw/arm/aspeed: Use arm_write_bootloader() to write the bootloader
36
hw/arm/raspi: Remove ignore_memory_transaction_failures on the raspi2
37
hw/arm/raspi: Display the board revision in the machine description
38
hw/arm/raspi: Load the firmware on the first core
39
hw/arm/raspi: Move arm_boot_info structure to RaspiMachineState
40
hw/arm/raspi: Avoid using TypeInfo::class_data pointer
41
hw/arm/raspi: Use more specific machine names
42
hw/arm/raspi: Introduce RaspiProcessorId enum
43
hw/arm/raspi: Use RaspiProcessorId to set the firmware load address
44
hw/arm/raspi: Remove use of the 'version' value in the board code
45
42
46
Richard Henderson (2):
43
Daniel Bertalan (1):
47
target/arm: Fix sve ldr/str
44
hw/arm/bcm2835_property: Implement "get command line" message
48
target/arm: Fix SVE splice
49
45
50
include/hw/arm/bcm2835_peripherals.h | 2 +
46
Fabiano Rosas (11):
51
include/hw/arm/raspi_platform.h | 51 ++++++++++--
47
target/arm: Move cortex sysregs into a separate file
52
target/arm/cpu.h | 50 +++++++++--
48
target/arm: Remove dead code from cpu_max_set_sve_max_vq
53
hw/arm/bcm2835_peripherals.c | 2 +
49
target/arm: Extract TCG -cpu max code into a function
54
hw/arm/raspi.c | 155 +++++++++++++++++++----------------
50
target/arm: Do not expose all -cpu max features to qtests
55
hw/intc/armv7m_nvic.c | 46 ++++++++++-
51
target/arm: Move 64-bit TCG CPUs into tcg/
56
target/arm/cpu.c | 21 +++--
52
tests/qtest: Adjust and document query-cpu-model-expansion test for arm
57
target/arm/cpu64.c | 12 +--
53
tests/qtest: Fix tests when no KVM or TCG are present
58
target/arm/cpu_tcg.c | 60 ++++++++++----
54
tests/avocado: Pass parameters to migration test
59
target/arm/helper.c | 9 +-
55
arm/Kconfig: Always select SEMIHOSTING when TCG is present
60
target/arm/kvm64.c | 4 +
56
arm/Kconfig: Do not build TCG-only boards on a KVM-only build
61
target/arm/translate-sve.c | 6 +-
57
tests/qtest: Restrict tpm-tis-i2c-test to CONFIG_TCG
62
12 files changed, 286 insertions(+), 132 deletions(-)
63
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
81
82
Philippe Mathieu-Daudé (1):
83
gitlab-ci: Check building KVM-only aarch64 target
84
85
docs/about/deprecated.rst | 43 +-
86
docs/user/main.rst | 14 +-
87
configs/devices/aarch64-softmmu/default.mak | 4 -
88
configs/devices/arm-softmmu/default.mak | 39 --
89
qapi/run-state.json | 16 +-
90
accel/tcg/internal.h | 2 +
91
include/exec/cpu-common.h | 2 -
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
146
diff view generated by jsdifflib
1
Move the id_pfr0 and id_pfr1 fields into the ARMISARegisters
1
From: Fabiano Rosas <farosas@suse.de>
2
sub-struct. We're going to want id_pfr1 for an isar_features
2
3
check, and moving both at the same time avoids an odd
3
The file cpu_tcg.c is about to be moved into the tcg/ directory, so
4
inconsistency.
4
move the register definitions into a new file.
5
5
6
Changes other than the ones to cpu.h and kvm64.c made
6
Also move the function declaration to the more appropriate cpregs.h.
7
automatically with:
7
8
perl -p -i -e 's/cpu->id_pfr/cpu->isar.id_pfr/' target/arm/*.c hw/intc/armv7m_nvic.c
8
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
9
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
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
12
Message-id: 20200910173855.4068-3-peter.maydell@linaro.org
13
---
13
---
14
target/arm/cpu.h | 4 ++--
14
target/arm/cpregs.h | 6 ++++
15
hw/intc/armv7m_nvic.c | 4 ++--
15
target/arm/internals.h | 6 ----
16
target/arm/cpu.c | 20 ++++++++++----------
16
target/arm/cortex-regs.c | 69 ++++++++++++++++++++++++++++++++++++++++
17
target/arm/cpu64.c | 12 ++++++------
17
target/arm/cpu64.c | 1 +
18
target/arm/cpu_tcg.c | 36 ++++++++++++++++++------------------
18
target/arm/cpu_tcg.c | 59 ----------------------------------
19
target/arm/helper.c | 4 ++--
19
target/arm/meson.build | 1 +
20
target/arm/kvm64.c | 4 ++++
20
6 files changed, 77 insertions(+), 65 deletions(-)
21
7 files changed, 44 insertions(+), 40 deletions(-)
21
create mode 100644 target/arm/cortex-regs.c
22
22
23
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
23
diff --git a/target/arm/cpregs.h b/target/arm/cpregs.h
24
index XXXXXXX..XXXXXXX 100644
24
index XXXXXXX..XXXXXXX 100644
25
--- a/target/arm/cpu.h
25
--- a/target/arm/cpregs.h
26
+++ b/target/arm/cpu.h
26
+++ b/target/arm/cpregs.h
27
@@ -XXX,XX +XXX,XX @@ struct ARMCPU {
27
@@ -XXX,XX +XXX,XX @@ static inline bool arm_cpreg_in_idspace(const ARMCPRegInfo *ri)
28
uint32_t id_mmfr2;
28
ri->crn, ri->crm);
29
uint32_t id_mmfr3;
29
}
30
uint32_t id_mmfr4;
30
31
+ uint32_t id_pfr0;
31
+#ifdef CONFIG_USER_ONLY
32
+ uint32_t id_pfr1;
32
+static inline void define_cortex_a72_a57_a53_cp_reginfo(ARMCPU *cpu) { }
33
uint32_t mvfr0;
33
+#else
34
uint32_t mvfr1;
34
+void define_cortex_a72_a57_a53_cp_reginfo(ARMCPU *cpu);
35
uint32_t mvfr2;
35
+#endif
36
@@ -XXX,XX +XXX,XX @@ struct ARMCPU {
36
+
37
uint32_t reset_fpsid;
37
#endif /* TARGET_ARM_CPREGS_H */
38
uint32_t ctr;
38
diff --git a/target/arm/internals.h b/target/arm/internals.h
39
uint32_t reset_sctlr;
39
index XXXXXXX..XXXXXXX 100644
40
- uint32_t id_pfr0;
40
--- a/target/arm/internals.h
41
- uint32_t id_pfr1;
41
+++ b/target/arm/internals.h
42
uint64_t pmceid0;
42
@@ -XXX,XX +XXX,XX @@ uint32_t arm_v7m_mrs_control(CPUARMState *env, uint32_t secure);
43
uint64_t pmceid1;
43
uint32_t *arm_v7m_get_sp_ptr(CPUARMState *env, bool secure,
44
uint32_t id_afr0;
44
bool threadmode, bool spsel);
45
diff --git a/hw/intc/armv7m_nvic.c b/hw/intc/armv7m_nvic.c
45
46
index XXXXXXX..XXXXXXX 100644
46
-#ifdef CONFIG_USER_ONLY
47
--- a/hw/intc/armv7m_nvic.c
47
-static inline void define_cortex_a72_a57_a53_cp_reginfo(ARMCPU *cpu) { }
48
+++ b/hw/intc/armv7m_nvic.c
48
-#else
49
@@ -XXX,XX +XXX,XX @@ static uint32_t nvic_readl(NVICState *s, uint32_t offset, MemTxAttrs attrs)
49
-void define_cortex_a72_a57_a53_cp_reginfo(ARMCPU *cpu);
50
"Aux Fault status registers unimplemented\n");
50
-#endif
51
return 0;
51
-
52
case 0xd40: /* PFR0. */
52
bool el_is_in_host(CPUARMState *env, int el);
53
- return cpu->id_pfr0;
53
54
+ return cpu->isar.id_pfr0;
54
void aa32_max_features(ARMCPU *cpu);
55
case 0xd44: /* PFR1. */
55
diff --git a/target/arm/cortex-regs.c b/target/arm/cortex-regs.c
56
- return cpu->id_pfr1;
56
new file mode 100644
57
+ return cpu->isar.id_pfr1;
57
index XXXXXXX..XXXXXXX
58
case 0xd48: /* DFR0. */
58
--- /dev/null
59
return cpu->isar.id_dfr0;
59
+++ b/target/arm/cortex-regs.c
60
case 0xd4c: /* AFR0. */
60
@@ -XXX,XX +XXX,XX @@
61
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
61
+/*
62
index XXXXXXX..XXXXXXX 100644
62
+ * ARM Cortex-A registers
63
--- a/target/arm/cpu.c
63
+ *
64
+++ b/target/arm/cpu.c
64
+ * This code is licensed under the GNU GPL v2 or later.
65
@@ -XXX,XX +XXX,XX @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp)
65
+ *
66
/* Disable the security extension feature bits in the processor feature
66
+ * SPDX-License-Identifier: GPL-2.0-or-later
67
* registers as well. These are id_pfr1[7:4] and id_aa64pfr0[15:12].
67
+ */
68
*/
68
+
69
- cpu->id_pfr1 &= ~0xf0;
69
+#include "qemu/osdep.h"
70
+ cpu->isar.id_pfr1 &= ~0xf0;
70
+#include "cpu.h"
71
cpu->isar.id_aa64pfr0 &= ~0xf000;
71
+#include "cpregs.h"
72
}
72
+
73
73
+
74
@@ -XXX,XX +XXX,XX @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp)
74
+static uint64_t l2ctlr_read(CPUARMState *env, const ARMCPRegInfo *ri)
75
* id_aa64pfr0_el1[11:8].
75
+{
76
*/
76
+ ARMCPU *cpu = env_archcpu(env);
77
cpu->isar.id_aa64pfr0 &= ~0xf00;
77
+
78
- cpu->id_pfr1 &= ~0xf000;
78
+ /* Number of cores is in [25:24]; otherwise we RAZ */
79
+ cpu->isar.id_pfr1 &= ~0xf000;
79
+ return (cpu->core_count - 1) << 24;
80
}
80
+}
81
81
+
82
#ifndef CONFIG_USER_ONLY
82
+static const ARMCPRegInfo cortex_a72_a57_a53_cp_reginfo[] = {
83
@@ -XXX,XX +XXX,XX @@ static void cortex_a8_initfn(Object *obj)
83
+ { .name = "L2CTLR_EL1", .state = ARM_CP_STATE_AA64,
84
cpu->isar.mvfr1 = 0x00011111;
84
+ .opc0 = 3, .opc1 = 1, .crn = 11, .crm = 0, .opc2 = 2,
85
cpu->ctr = 0x82048004;
85
+ .access = PL1_RW, .readfn = l2ctlr_read,
86
cpu->reset_sctlr = 0x00c50078;
86
+ .writefn = arm_cp_write_ignore },
87
- cpu->id_pfr0 = 0x1031;
87
+ { .name = "L2CTLR",
88
- cpu->id_pfr1 = 0x11;
88
+ .cp = 15, .opc1 = 1, .crn = 9, .crm = 0, .opc2 = 2,
89
+ cpu->isar.id_pfr0 = 0x1031;
89
+ .access = PL1_RW, .readfn = l2ctlr_read,
90
+ cpu->isar.id_pfr1 = 0x11;
90
+ .writefn = arm_cp_write_ignore },
91
cpu->isar.id_dfr0 = 0x400;
91
+ { .name = "L2ECTLR_EL1", .state = ARM_CP_STATE_AA64,
92
cpu->id_afr0 = 0;
92
+ .opc0 = 3, .opc1 = 1, .crn = 11, .crm = 0, .opc2 = 3,
93
cpu->isar.id_mmfr0 = 0x31100003;
93
+ .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 },
94
@@ -XXX,XX +XXX,XX @@ static void cortex_a9_initfn(Object *obj)
94
+ { .name = "L2ECTLR",
95
cpu->isar.mvfr1 = 0x01111111;
95
+ .cp = 15, .opc1 = 1, .crn = 9, .crm = 0, .opc2 = 3,
96
cpu->ctr = 0x80038003;
96
+ .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 },
97
cpu->reset_sctlr = 0x00c50078;
97
+ { .name = "L2ACTLR", .state = ARM_CP_STATE_BOTH,
98
- cpu->id_pfr0 = 0x1031;
98
+ .opc0 = 3, .opc1 = 1, .crn = 15, .crm = 0, .opc2 = 0,
99
- cpu->id_pfr1 = 0x11;
99
+ .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 },
100
+ cpu->isar.id_pfr0 = 0x1031;
100
+ { .name = "CPUACTLR_EL1", .state = ARM_CP_STATE_AA64,
101
+ cpu->isar.id_pfr1 = 0x11;
101
+ .opc0 = 3, .opc1 = 1, .crn = 15, .crm = 2, .opc2 = 0,
102
cpu->isar.id_dfr0 = 0x000;
102
+ .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 },
103
cpu->id_afr0 = 0;
103
+ { .name = "CPUACTLR",
104
cpu->isar.id_mmfr0 = 0x00100103;
104
+ .cp = 15, .opc1 = 0, .crm = 15,
105
@@ -XXX,XX +XXX,XX @@ static void cortex_a7_initfn(Object *obj)
105
+ .access = PL1_RW, .type = ARM_CP_CONST | ARM_CP_64BIT, .resetvalue = 0 },
106
cpu->isar.mvfr1 = 0x11111111;
106
+ { .name = "CPUECTLR_EL1", .state = ARM_CP_STATE_AA64,
107
cpu->ctr = 0x84448003;
107
+ .opc0 = 3, .opc1 = 1, .crn = 15, .crm = 2, .opc2 = 1,
108
cpu->reset_sctlr = 0x00c50078;
108
+ .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 },
109
- cpu->id_pfr0 = 0x00001131;
109
+ { .name = "CPUECTLR",
110
- cpu->id_pfr1 = 0x00011011;
110
+ .cp = 15, .opc1 = 1, .crm = 15,
111
+ cpu->isar.id_pfr0 = 0x00001131;
111
+ .access = PL1_RW, .type = ARM_CP_CONST | ARM_CP_64BIT, .resetvalue = 0 },
112
+ cpu->isar.id_pfr1 = 0x00011011;
112
+ { .name = "CPUMERRSR_EL1", .state = ARM_CP_STATE_AA64,
113
cpu->isar.id_dfr0 = 0x02010555;
113
+ .opc0 = 3, .opc1 = 1, .crn = 15, .crm = 2, .opc2 = 2,
114
cpu->id_afr0 = 0x00000000;
114
+ .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 },
115
cpu->isar.id_mmfr0 = 0x10101105;
115
+ { .name = "CPUMERRSR",
116
@@ -XXX,XX +XXX,XX @@ static void cortex_a15_initfn(Object *obj)
116
+ .cp = 15, .opc1 = 2, .crm = 15,
117
cpu->isar.mvfr1 = 0x11111111;
117
+ .access = PL1_RW, .type = ARM_CP_CONST | ARM_CP_64BIT, .resetvalue = 0 },
118
cpu->ctr = 0x8444c004;
118
+ { .name = "L2MERRSR_EL1", .state = ARM_CP_STATE_AA64,
119
cpu->reset_sctlr = 0x00c50078;
119
+ .opc0 = 3, .opc1 = 1, .crn = 15, .crm = 2, .opc2 = 3,
120
- cpu->id_pfr0 = 0x00001131;
120
+ .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 },
121
- cpu->id_pfr1 = 0x00011011;
121
+ { .name = "L2MERRSR",
122
+ cpu->isar.id_pfr0 = 0x00001131;
122
+ .cp = 15, .opc1 = 3, .crm = 15,
123
+ cpu->isar.id_pfr1 = 0x00011011;
123
+ .access = PL1_RW, .type = ARM_CP_CONST | ARM_CP_64BIT, .resetvalue = 0 },
124
cpu->isar.id_dfr0 = 0x02010555;
124
+};
125
cpu->id_afr0 = 0x00000000;
125
+
126
cpu->isar.id_mmfr0 = 0x10201105;
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
+}
127
diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c
130
diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c
128
index XXXXXXX..XXXXXXX 100644
131
index XXXXXXX..XXXXXXX 100644
129
--- a/target/arm/cpu64.c
132
--- a/target/arm/cpu64.c
130
+++ b/target/arm/cpu64.c
133
+++ b/target/arm/cpu64.c
131
@@ -XXX,XX +XXX,XX @@ static void aarch64_a57_initfn(Object *obj)
134
@@ -XXX,XX +XXX,XX @@
132
cpu->isar.mvfr2 = 0x00000043;
135
#include "qapi/visitor.h"
133
cpu->ctr = 0x8444c004;
136
#include "hw/qdev-properties.h"
134
cpu->reset_sctlr = 0x00c50838;
137
#include "internals.h"
135
- cpu->id_pfr0 = 0x00000131;
138
+#include "cpregs.h"
136
- cpu->id_pfr1 = 0x00011011;
139
137
+ cpu->isar.id_pfr0 = 0x00000131;
140
static void aarch64_a35_initfn(Object *obj)
138
+ cpu->isar.id_pfr1 = 0x00011011;
141
{
139
cpu->isar.id_dfr0 = 0x03010066;
140
cpu->id_afr0 = 0x00000000;
141
cpu->isar.id_mmfr0 = 0x10101105;
142
@@ -XXX,XX +XXX,XX @@ static void aarch64_a53_initfn(Object *obj)
143
cpu->isar.mvfr2 = 0x00000043;
144
cpu->ctr = 0x84448004; /* L1Ip = VIPT */
145
cpu->reset_sctlr = 0x00c50838;
146
- cpu->id_pfr0 = 0x00000131;
147
- cpu->id_pfr1 = 0x00011011;
148
+ cpu->isar.id_pfr0 = 0x00000131;
149
+ cpu->isar.id_pfr1 = 0x00011011;
150
cpu->isar.id_dfr0 = 0x03010066;
151
cpu->id_afr0 = 0x00000000;
152
cpu->isar.id_mmfr0 = 0x10101105;
153
@@ -XXX,XX +XXX,XX @@ static void aarch64_a72_initfn(Object *obj)
154
cpu->isar.mvfr2 = 0x00000043;
155
cpu->ctr = 0x8444c004;
156
cpu->reset_sctlr = 0x00c50838;
157
- cpu->id_pfr0 = 0x00000131;
158
- cpu->id_pfr1 = 0x00011011;
159
+ cpu->isar.id_pfr0 = 0x00000131;
160
+ cpu->isar.id_pfr1 = 0x00011011;
161
cpu->isar.id_dfr0 = 0x03010066;
162
cpu->id_afr0 = 0x00000000;
163
cpu->isar.id_mmfr0 = 0x10201105;
164
diff --git a/target/arm/cpu_tcg.c b/target/arm/cpu_tcg.c
142
diff --git a/target/arm/cpu_tcg.c b/target/arm/cpu_tcg.c
165
index XXXXXXX..XXXXXXX 100644
143
index XXXXXXX..XXXXXXX 100644
166
--- a/target/arm/cpu_tcg.c
144
--- a/target/arm/cpu_tcg.c
167
+++ b/target/arm/cpu_tcg.c
145
+++ b/target/arm/cpu_tcg.c
168
@@ -XXX,XX +XXX,XX @@ static void arm1136_r2_initfn(Object *obj)
146
@@ -XXX,XX +XXX,XX @@ void aa32_max_features(ARMCPU *cpu)
169
cpu->isar.mvfr1 = 0x00000000;
147
cpu->isar.id_dfr0 = t;
170
cpu->ctr = 0x1dd20d2;
148
}
171
cpu->reset_sctlr = 0x00050078;
149
172
- cpu->id_pfr0 = 0x111;
150
-#ifndef CONFIG_USER_ONLY
173
- cpu->id_pfr1 = 0x1;
151
-static uint64_t l2ctlr_read(CPUARMState *env, const ARMCPRegInfo *ri)
174
+ cpu->isar.id_pfr0 = 0x111;
152
-{
175
+ cpu->isar.id_pfr1 = 0x1;
153
- ARMCPU *cpu = env_archcpu(env);
176
cpu->isar.id_dfr0 = 0x2;
154
-
177
cpu->id_afr0 = 0x3;
155
- /* Number of cores is in [25:24]; otherwise we RAZ */
178
cpu->isar.id_mmfr0 = 0x01130003;
156
- return (cpu->core_count - 1) << 24;
179
@@ -XXX,XX +XXX,XX @@ static void arm1136_initfn(Object *obj)
157
-}
180
cpu->isar.mvfr1 = 0x00000000;
158
-
181
cpu->ctr = 0x1dd20d2;
159
-static const ARMCPRegInfo cortex_a72_a57_a53_cp_reginfo[] = {
182
cpu->reset_sctlr = 0x00050078;
160
- { .name = "L2CTLR_EL1", .state = ARM_CP_STATE_AA64,
183
- cpu->id_pfr0 = 0x111;
161
- .opc0 = 3, .opc1 = 1, .crn = 11, .crm = 0, .opc2 = 2,
184
- cpu->id_pfr1 = 0x1;
162
- .access = PL1_RW, .readfn = l2ctlr_read,
185
+ cpu->isar.id_pfr0 = 0x111;
163
- .writefn = arm_cp_write_ignore },
186
+ cpu->isar.id_pfr1 = 0x1;
164
- { .name = "L2CTLR",
187
cpu->isar.id_dfr0 = 0x2;
165
- .cp = 15, .opc1 = 1, .crn = 9, .crm = 0, .opc2 = 2,
188
cpu->id_afr0 = 0x3;
166
- .access = PL1_RW, .readfn = l2ctlr_read,
189
cpu->isar.id_mmfr0 = 0x01130003;
167
- .writefn = arm_cp_write_ignore },
190
@@ -XXX,XX +XXX,XX @@ static void arm1176_initfn(Object *obj)
168
- { .name = "L2ECTLR_EL1", .state = ARM_CP_STATE_AA64,
191
cpu->isar.mvfr1 = 0x00000000;
169
- .opc0 = 3, .opc1 = 1, .crn = 11, .crm = 0, .opc2 = 3,
192
cpu->ctr = 0x1dd20d2;
170
- .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 },
193
cpu->reset_sctlr = 0x00050078;
171
- { .name = "L2ECTLR",
194
- cpu->id_pfr0 = 0x111;
172
- .cp = 15, .opc1 = 1, .crn = 9, .crm = 0, .opc2 = 3,
195
- cpu->id_pfr1 = 0x11;
173
- .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 },
196
+ cpu->isar.id_pfr0 = 0x111;
174
- { .name = "L2ACTLR", .state = ARM_CP_STATE_BOTH,
197
+ cpu->isar.id_pfr1 = 0x11;
175
- .opc0 = 3, .opc1 = 1, .crn = 15, .crm = 0, .opc2 = 0,
198
cpu->isar.id_dfr0 = 0x33;
176
- .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 },
199
cpu->id_afr0 = 0;
177
- { .name = "CPUACTLR_EL1", .state = ARM_CP_STATE_AA64,
200
cpu->isar.id_mmfr0 = 0x01130003;
178
- .opc0 = 3, .opc1 = 1, .crn = 15, .crm = 2, .opc2 = 0,
201
@@ -XXX,XX +XXX,XX @@ static void arm11mpcore_initfn(Object *obj)
179
- .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 },
202
cpu->isar.mvfr0 = 0x11111111;
180
- { .name = "CPUACTLR",
203
cpu->isar.mvfr1 = 0x00000000;
181
- .cp = 15, .opc1 = 0, .crm = 15,
204
cpu->ctr = 0x1d192992; /* 32K icache 32K dcache */
182
- .access = PL1_RW, .type = ARM_CP_CONST | ARM_CP_64BIT, .resetvalue = 0 },
205
- cpu->id_pfr0 = 0x111;
183
- { .name = "CPUECTLR_EL1", .state = ARM_CP_STATE_AA64,
206
- cpu->id_pfr1 = 0x1;
184
- .opc0 = 3, .opc1 = 1, .crn = 15, .crm = 2, .opc2 = 1,
207
+ cpu->isar.id_pfr0 = 0x111;
185
- .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 },
208
+ cpu->isar.id_pfr1 = 0x1;
186
- { .name = "CPUECTLR",
209
cpu->isar.id_dfr0 = 0;
187
- .cp = 15, .opc1 = 1, .crm = 15,
210
cpu->id_afr0 = 0x2;
188
- .access = PL1_RW, .type = ARM_CP_CONST | ARM_CP_64BIT, .resetvalue = 0 },
211
cpu->isar.id_mmfr0 = 0x01100103;
189
- { .name = "CPUMERRSR_EL1", .state = ARM_CP_STATE_AA64,
212
@@ -XXX,XX +XXX,XX @@ static void cortex_m3_initfn(Object *obj)
190
- .opc0 = 3, .opc1 = 1, .crn = 15, .crm = 2, .opc2 = 2,
213
set_feature(&cpu->env, ARM_FEATURE_M_MAIN);
191
- .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 },
214
cpu->midr = 0x410fc231;
192
- { .name = "CPUMERRSR",
215
cpu->pmsav7_dregion = 8;
193
- .cp = 15, .opc1 = 2, .crm = 15,
216
- cpu->id_pfr0 = 0x00000030;
194
- .access = PL1_RW, .type = ARM_CP_CONST | ARM_CP_64BIT, .resetvalue = 0 },
217
- cpu->id_pfr1 = 0x00000200;
195
- { .name = "L2MERRSR_EL1", .state = ARM_CP_STATE_AA64,
218
+ cpu->isar.id_pfr0 = 0x00000030;
196
- .opc0 = 3, .opc1 = 1, .crn = 15, .crm = 2, .opc2 = 3,
219
+ cpu->isar.id_pfr1 = 0x00000200;
197
- .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 },
220
cpu->isar.id_dfr0 = 0x00100000;
198
- { .name = "L2MERRSR",
221
cpu->id_afr0 = 0x00000000;
199
- .cp = 15, .opc1 = 3, .crm = 15,
222
cpu->isar.id_mmfr0 = 0x00000030;
200
- .access = PL1_RW, .type = ARM_CP_CONST | ARM_CP_64BIT, .resetvalue = 0 },
223
@@ -XXX,XX +XXX,XX @@ static void cortex_m4_initfn(Object *obj)
201
-};
224
cpu->isar.mvfr0 = 0x10110021;
202
-
225
cpu->isar.mvfr1 = 0x11000011;
203
-void define_cortex_a72_a57_a53_cp_reginfo(ARMCPU *cpu)
226
cpu->isar.mvfr2 = 0x00000000;
204
-{
227
- cpu->id_pfr0 = 0x00000030;
205
- define_arm_cp_regs(cpu, cortex_a72_a57_a53_cp_reginfo);
228
- cpu->id_pfr1 = 0x00000200;
206
-}
229
+ cpu->isar.id_pfr0 = 0x00000030;
207
-#endif /* !CONFIG_USER_ONLY */
230
+ cpu->isar.id_pfr1 = 0x00000200;
208
-
231
cpu->isar.id_dfr0 = 0x00100000;
209
/* CPU models. These are not needed for the AArch64 linux-user build. */
232
cpu->id_afr0 = 0x00000000;
210
#if !defined(CONFIG_USER_ONLY) || !defined(TARGET_AARCH64)
233
cpu->isar.id_mmfr0 = 0x00000030;
211
234
@@ -XXX,XX +XXX,XX @@ static void cortex_m7_initfn(Object *obj)
212
diff --git a/target/arm/meson.build b/target/arm/meson.build
235
cpu->isar.mvfr0 = 0x10110221;
213
index XXXXXXX..XXXXXXX 100644
236
cpu->isar.mvfr1 = 0x12000011;
214
--- a/target/arm/meson.build
237
cpu->isar.mvfr2 = 0x00000040;
215
+++ b/target/arm/meson.build
238
- cpu->id_pfr0 = 0x00000030;
216
@@ -XXX,XX +XXX,XX @@ arm_softmmu_ss.add(files(
239
- cpu->id_pfr1 = 0x00000200;
217
'arch_dump.c',
240
+ cpu->isar.id_pfr0 = 0x00000030;
218
'arm-powerctl.c',
241
+ cpu->isar.id_pfr1 = 0x00000200;
219
'arm-qmp-cmds.c',
242
cpu->isar.id_dfr0 = 0x00100000;
220
+ 'cortex-regs.c',
243
cpu->id_afr0 = 0x00000000;
221
'machine.c',
244
cpu->isar.id_mmfr0 = 0x00100030;
222
'ptw.c',
245
@@ -XXX,XX +XXX,XX @@ static void cortex_m33_initfn(Object *obj)
223
))
246
cpu->isar.mvfr0 = 0x10110021;
247
cpu->isar.mvfr1 = 0x11000011;
248
cpu->isar.mvfr2 = 0x00000040;
249
- cpu->id_pfr0 = 0x00000030;
250
- cpu->id_pfr1 = 0x00000210;
251
+ cpu->isar.id_pfr0 = 0x00000030;
252
+ cpu->isar.id_pfr1 = 0x00000210;
253
cpu->isar.id_dfr0 = 0x00200000;
254
cpu->id_afr0 = 0x00000000;
255
cpu->isar.id_mmfr0 = 0x00101F40;
256
@@ -XXX,XX +XXX,XX @@ static void cortex_r5_initfn(Object *obj)
257
set_feature(&cpu->env, ARM_FEATURE_PMSA);
258
set_feature(&cpu->env, ARM_FEATURE_PMU);
259
cpu->midr = 0x411fc153; /* r1p3 */
260
- cpu->id_pfr0 = 0x0131;
261
- cpu->id_pfr1 = 0x001;
262
+ cpu->isar.id_pfr0 = 0x0131;
263
+ cpu->isar.id_pfr1 = 0x001;
264
cpu->isar.id_dfr0 = 0x010400;
265
cpu->id_afr0 = 0x0;
266
cpu->isar.id_mmfr0 = 0x0210030;
267
diff --git a/target/arm/helper.c b/target/arm/helper.c
268
index XXXXXXX..XXXXXXX 100644
269
--- a/target/arm/helper.c
270
+++ b/target/arm/helper.c
271
@@ -XXX,XX +XXX,XX @@ static void define_pmu_regs(ARMCPU *cpu)
272
static uint64_t id_pfr1_read(CPUARMState *env, const ARMCPRegInfo *ri)
273
{
274
ARMCPU *cpu = env_archcpu(env);
275
- uint64_t pfr1 = cpu->id_pfr1;
276
+ uint64_t pfr1 = cpu->isar.id_pfr1;
277
278
if (env->gicv3state) {
279
pfr1 |= 1 << 28;
280
@@ -XXX,XX +XXX,XX @@ void register_cp_regs_for_features(ARMCPU *cpu)
281
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 1, .opc2 = 0,
282
.access = PL1_R, .type = ARM_CP_CONST,
283
.accessfn = access_aa32_tid3,
284
- .resetvalue = cpu->id_pfr0 },
285
+ .resetvalue = cpu->isar.id_pfr0 },
286
/* ID_PFR1 is not a plain ARM_CP_CONST because we don't know
287
* the value of the GIC field until after we define these regs.
288
*/
289
diff --git a/target/arm/kvm64.c b/target/arm/kvm64.c
290
index XXXXXXX..XXXXXXX 100644
291
--- a/target/arm/kvm64.c
292
+++ b/target/arm/kvm64.c
293
@@ -XXX,XX +XXX,XX @@ bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf)
294
* than skipping the reads and leaving 0, as we must avoid
295
* considering the values in every case.
296
*/
297
+ err |= read_sys_reg32(fdarray[2], &ahcf->isar.id_pfr0,
298
+ ARM64_SYS_REG(3, 0, 0, 1, 0));
299
+ err |= read_sys_reg32(fdarray[2], &ahcf->isar.id_pfr1,
300
+ ARM64_SYS_REG(3, 0, 0, 1, 1));
301
err |= read_sys_reg32(fdarray[2], &ahcf->isar.id_dfr0,
302
ARM64_SYS_REG(3, 0, 0, 1, 2));
303
err |= read_sys_reg32(fdarray[2], &ahcf->isar.id_mmfr0,
304
--
224
--
305
2.20.1
225
2.34.1
306
226
307
227
diff view generated by jsdifflib
New patch
1
From: Fabiano Rosas <farosas@suse.de>
1
2
3
The sve-max-vq property has been removed from the -cpu max used with
4
KVM, so code under kvm_enabled in cpu_max_set_sve_max_vq is not
5
reachable.
6
7
Fixes: 0baa21be49 ("target/arm: Make KVM -cpu max exactly like -cpu host")
8
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
9
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
10
Signed-off-by: Fabiano Rosas <farosas@suse.de>
11
Message-id: 20230426180013.14814-3-farosas@suse.de
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
---
14
target/arm/cpu64.c | 6 ------
15
1 file changed, 6 deletions(-)
16
17
diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c
18
index XXXXXXX..XXXXXXX 100644
19
--- a/target/arm/cpu64.c
20
+++ b/target/arm/cpu64.c
21
@@ -XXX,XX +XXX,XX @@ static void cpu_max_set_sve_max_vq(Object *obj, Visitor *v, const char *name,
22
return;
23
}
24
25
- if (kvm_enabled() && !kvm_arm_sve_supported()) {
26
- error_setg(errp, "cannot set sve-max-vq");
27
- error_append_hint(errp, "SVE not supported by KVM on this host\n");
28
- return;
29
- }
30
-
31
if (max_vq == 0 || max_vq > ARM_MAX_VQ) {
32
error_setg(errp, "unsupported SVE vector length");
33
error_append_hint(errp, "Valid sve-max-vq in range [1-%d]\n",
34
--
35
2.34.1
36
37
diff view generated by jsdifflib
New patch
1
From: Fabiano Rosas <farosas@suse.de>
1
2
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.
6
7
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
8
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
9
Signed-off-by: Fabiano Rosas <farosas@suse.de>
10
Message-id: 20230426180013.14814-4-farosas@suse.de
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
---
13
target/arm/cpu64.c | 32 ++++++++++++++++++--------------
14
1 file changed, 18 insertions(+), 14 deletions(-)
15
16
diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c
17
index XXXXXXX..XXXXXXX 100644
18
--- a/target/arm/cpu64.c
19
+++ b/target/arm/cpu64.c
20
@@ -XXX,XX +XXX,XX @@ static void aarch64_host_initfn(Object *obj)
21
#endif
22
}
23
24
-/* -cpu max: if KVM is enabled, like -cpu host (best possible with this host);
25
- * otherwise, a CPU with as many features enabled as our emulation supports.
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)
57
+{
58
+ if (kvm_enabled() || hvf_enabled()) {
59
+ /* With KVM or HVF, '-cpu max' is identical to '-cpu host' */
60
+ aarch64_host_initfn(obj);
61
+ return;
62
+ }
63
+
64
+ /* '-cpu max' for TCG: we currently do this as "A57 with extra things" */
65
+
66
+ aarch64_a57_initfn(obj);
67
+ aarch64_max_tcg_initfn(obj);
68
+}
69
+
70
static const ARMCPUInfo aarch64_cpus[] = {
71
{ .name = "cortex-a35", .initfn = aarch64_a35_initfn },
72
{ .name = "cortex-a57", .initfn = aarch64_a57_initfn },
73
--
74
2.34.1
75
76
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
1
From: Fabiano Rosas <farosas@suse.de>
2
2
3
The arm_boot_info structure belong to the machine,
3
We're about to move the TCG-only -cpu max configuration code under
4
move it to RaspiMachineState.
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.
5
7
6
Reviewed-by: Luc Michel <luc.michel@greensocs.com>
8
Delineate now what is used with TCG-only and what is also used with
7
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
9
qtests to make the subsequent patches cleaner.
8
Message-id: 20200924111808.77168-4-f4bug@amsat.org
10
11
Signed-off-by: Fabiano Rosas <farosas@suse.de>
12
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
13
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
14
Message-id: 20230426180013.14814-5-farosas@suse.de
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
15
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
---
16
---
11
hw/arm/raspi.c | 30 +++++++++++++++---------------
17
target/arm/cpu64.c | 12 +++++++++---
12
1 file changed, 15 insertions(+), 15 deletions(-)
18
1 file changed, 9 insertions(+), 3 deletions(-)
13
19
14
diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c
20
diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c
15
index XXXXXXX..XXXXXXX 100644
21
index XXXXXXX..XXXXXXX 100644
16
--- a/hw/arm/raspi.c
22
--- a/target/arm/cpu64.c
17
+++ b/hw/arm/raspi.c
23
+++ b/target/arm/cpu64.c
18
@@ -XXX,XX +XXX,XX @@ struct RaspiMachineState {
24
@@ -XXX,XX +XXX,XX @@
19
MachineState parent_obj;
25
#include "qemu/module.h"
20
/*< public >*/
26
#include "sysemu/kvm.h"
21
BCM283XState soc;
27
#include "sysemu/hvf.h"
22
+ struct arm_boot_info binfo;
28
+#include "sysemu/qtest.h"
23
};
29
+#include "sysemu/tcg.h"
24
typedef struct RaspiMachineState RaspiMachineState;
30
#include "kvm_arm.h"
25
31
#include "hvf_arm.h"
26
@@ -XXX,XX +XXX,XX @@ static void reset_secondary(ARMCPU *cpu, const struct arm_boot_info *info)
32
#include "qapi/visitor.h"
27
static void setup_boot(MachineState *machine, int version, size_t ram_size)
33
@@ -XXX,XX +XXX,XX @@ static void aarch64_max_initfn(Object *obj)
28
{
34
return;
29
RaspiMachineState *s = RASPI_MACHINE(machine);
30
- static struct arm_boot_info binfo;
31
int r;
32
33
- binfo.board_id = MACH_TYPE_BCM2708;
34
- binfo.ram_size = ram_size;
35
- binfo.nb_cpus = machine->smp.cpus;
36
+ s->binfo.board_id = MACH_TYPE_BCM2708;
37
+ s->binfo.ram_size = ram_size;
38
+ s->binfo.nb_cpus = machine->smp.cpus;
39
40
if (version <= 2) {
41
/* The rpi1 and 2 require some custom setup code to run in Secure
42
@@ -XXX,XX +XXX,XX @@ static void setup_boot(MachineState *machine, int version, size_t ram_size)
43
* firmware for some cache maintenance operations.
44
* The rpi3 doesn't need this.
45
*/
46
- binfo.board_setup_addr = BOARDSETUP_ADDR;
47
- binfo.write_board_setup = write_board_setup;
48
- binfo.secure_board_setup = true;
49
- binfo.secure_boot = true;
50
+ s->binfo.board_setup_addr = BOARDSETUP_ADDR;
51
+ s->binfo.write_board_setup = write_board_setup;
52
+ s->binfo.secure_board_setup = true;
53
+ s->binfo.secure_boot = true;
54
}
35
}
55
36
56
/* Pi2 and Pi3 requires SMP setup */
37
- /* '-cpu max' for TCG: we currently do this as "A57 with extra things" */
57
if (version >= 2) {
38
+ if (tcg_enabled() || qtest_enabled()) {
58
- binfo.smp_loader_start = SMPBOOT_ADDR;
39
+ aarch64_a57_initfn(obj);
59
+ s->binfo.smp_loader_start = SMPBOOT_ADDR;
40
+ }
60
if (version == 2) {
41
61
- binfo.write_secondary_boot = write_smpboot;
42
- aarch64_a57_initfn(obj);
62
+ s->binfo.write_secondary_boot = write_smpboot;
43
- aarch64_max_tcg_initfn(obj);
63
} else {
44
+ /* '-cpu max' for TCG: we currently do this as "A57 with extra things" */
64
- binfo.write_secondary_boot = write_smpboot64;
45
+ if (tcg_enabled()) {
65
+ s->binfo.write_secondary_boot = write_smpboot64;
46
+ aarch64_max_tcg_initfn(obj);
66
}
47
+ }
67
- binfo.secondary_cpu_reset_hook = reset_secondary;
68
+ s->binfo.secondary_cpu_reset_hook = reset_secondary;
69
}
70
71
/* If the user specified a "firmware" image (e.g. UEFI), we bypass
72
@@ -XXX,XX +XXX,XX @@ static void setup_boot(MachineState *machine, int version, size_t ram_size)
73
exit(1);
74
}
75
76
- binfo.entry = firmware_addr;
77
- binfo.firmware_loaded = true;
78
+ s->binfo.entry = firmware_addr;
79
+ s->binfo.firmware_loaded = true;
80
}
81
82
- arm_load_kernel(&s->soc.cpu[0].core, machine, &binfo);
83
+ arm_load_kernel(&s->soc.cpu[0].core, machine, &s->binfo);
84
}
48
}
85
49
86
static void raspi_machine_init(MachineState *machine)
50
static const ARMCPUInfo aarch64_cpus[] = {
87
--
51
--
88
2.20.1
52
2.34.1
89
53
90
54
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
1
From: Fabiano Rosas <farosas@suse.de>
2
2
3
We expected the 'version' ID to match the board processor ID,
3
Move the 64-bit CPUs that are TCG-only:
4
but this is not always true (for example boards with revision
4
- cortex-a35
5
id 0xa02042/0xa22042 are Raspberry Pi 2 with a BCM2837 SoC).
5
- cortex-a55
6
This was not important because we were not modelling them, but
6
- cortex-a72
7
since the recent refactor now allow to model these boards, it
7
- cortex-a76
8
is safer to check the processor id directly. Remove the version
8
- a64fx
9
check.
9
- neoverse-n1
10
10
11
Suggested-by: Peter Maydell <peter.maydell@linaro.org>
11
Keep the CPUs that can be used with KVM:
12
Reviewed-by: Luc Michel <luc.michel@greensocs.com>
12
- cortex-a57
13
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
13
- cortex-a53
14
Message-id: 20200924111808.77168-9-f4bug@amsat.org
14
- max
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
15
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
21
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
16
---
22
---
17
hw/arm/raspi.c | 29 +++++++++++++----------------
23
target/arm/internals.h | 4 +
18
1 file changed, 13 insertions(+), 16 deletions(-)
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%)
19
30
20
diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c
31
diff --git a/target/arm/internals.h b/target/arm/internals.h
21
index XXXXXXX..XXXXXXX 100644
32
index XXXXXXX..XXXXXXX 100644
22
--- a/hw/arm/raspi.c
33
--- a/target/arm/internals.h
23
+++ b/hw/arm/raspi.c
34
+++ b/target/arm/internals.h
24
@@ -XXX,XX +XXX,XX @@ static RaspiProcessorId board_processor_id(uint32_t board_rev)
35
@@ -XXX,XX +XXX,XX @@ void arm_cpu_sve_finalize(ARMCPU *cpu, Error **errp);
25
return proc_id;
36
void arm_cpu_sme_finalize(ARMCPU *cpu, Error **errp);
37
void arm_cpu_pauth_finalize(ARMCPU *cpu, Error **errp);
38
void arm_cpu_lpa2_finalize(ARMCPU *cpu, Error **errp);
39
+void aarch64_max_tcg_initfn(Object *obj);
40
+void aarch64_add_pauth_properties(Object *obj);
41
+void aarch64_add_sve_properties(Object *obj);
42
+void aarch64_add_sme_properties(Object *obj);
43
#endif
44
45
/* Read the CONTROL register as the MRS instruction would. */
46
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
47
index XXXXXXX..XXXXXXX 100644
48
--- a/hw/arm/virt.c
49
+++ b/hw/arm/virt.c
50
@@ -XXX,XX +XXX,XX @@ static const char *valid_cpus[] = {
51
ARM_CPU_TYPE_NAME("cortex-a7"),
52
#endif
53
ARM_CPU_TYPE_NAME("cortex-a15"),
54
+#ifdef CONFIG_TCG
55
ARM_CPU_TYPE_NAME("cortex-a35"),
56
- ARM_CPU_TYPE_NAME("cortex-a53"),
57
ARM_CPU_TYPE_NAME("cortex-a55"),
58
- ARM_CPU_TYPE_NAME("cortex-a57"),
59
ARM_CPU_TYPE_NAME("cortex-a72"),
60
ARM_CPU_TYPE_NAME("cortex-a76"),
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;
26
}
162
}
27
163
28
-static int board_version(uint32_t board_rev)
164
-static void cpu_max_get_sve_max_vq(Object *obj, Visitor *v, const char *name,
29
-{
165
- void *opaque, Error **errp)
30
- return board_processor_id(board_rev) + 1;
166
-{
31
-}
167
- ARMCPU *cpu = ARM_CPU(obj);
32
-
168
- uint32_t value;
33
static const char *board_soc_type(uint32_t board_rev)
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)
34
{
208
{
35
return soc_property[board_processor_id(board_rev)].type;
209
ARMCPU *cpu = ARM_CPU(obj);
36
@@ -XXX,XX +XXX,XX @@ static void reset_secondary(ARMCPU *cpu, const struct arm_boot_info *info)
210
uint32_t vq;
37
cpu_set_pc(cs, info->smp_loader_start);
211
@@ -XXX,XX +XXX,XX @@ static void aarch64_add_sve_properties(Object *obj)
212
#endif
38
}
213
}
39
214
40
-static void setup_boot(MachineState *machine, int version, size_t ram_size)
215
-static void aarch64_add_sme_properties(Object *obj)
41
+static void setup_boot(MachineState *machine, RaspiProcessorId processor_id,
216
+void aarch64_add_sme_properties(Object *obj)
42
+ size_t ram_size)
43
{
217
{
44
RaspiMachineState *s = RASPI_MACHINE(machine);
218
ARMCPU *cpu = ARM_CPU(obj);
45
int r;
219
uint32_t vq;
46
@@ -XXX,XX +XXX,XX @@ static void setup_boot(MachineState *machine, int version, size_t ram_size)
220
@@ -XXX,XX +XXX,XX @@ static Property arm_cpu_pauth_property =
47
s->binfo.ram_size = ram_size;
221
static Property arm_cpu_pauth_impdef_property =
48
s->binfo.nb_cpus = machine->smp.cpus;
222
DEFINE_PROP_BOOL("pauth-impdef", ARMCPU, prop_pauth_impdef, false);
49
223
50
- if (version <= 2) {
224
-static void aarch64_add_pauth_properties(Object *obj)
51
- /* The rpi1 and 2 require some custom setup code to run in Secure
225
+void aarch64_add_pauth_properties(Object *obj)
52
- * mode before booting a kernel (to set up the SMC vectors so
226
{
53
- * that we get a no-op SMC; this is used by Linux to call the
227
ARMCPU *cpu = ARM_CPU(obj);
54
+ if (processor_id <= PROCESSOR_ID_BCM2836) {
228
55
+ /*
229
@@ -XXX,XX +XXX,XX @@ static void aarch64_add_pauth_properties(Object *obj)
56
+ * The BCM2835 and BCM2836 require some custom setup code to run
57
+ * in Secure mode before booting a kernel (to set up the SMC vectors
58
+ * so that we get a no-op SMC; this is used by Linux to call the
59
* firmware for some cache maintenance operations.
60
- * The rpi3 doesn't need this.
61
+ * The BCM2837 doesn't need this.
62
*/
63
s->binfo.board_setup_addr = BOARDSETUP_ADDR;
64
s->binfo.write_board_setup = write_board_setup;
65
@@ -XXX,XX +XXX,XX @@ static void setup_boot(MachineState *machine, int version, size_t ram_size)
66
s->binfo.secure_boot = true;
67
}
230
}
68
69
- /* Pi2 and Pi3 requires SMP setup */
70
- if (version >= 2) {
71
+ /* BCM2836 and BCM2837 requires SMP setup */
72
+ if (processor_id >= PROCESSOR_ID_BCM2836) {
73
s->binfo.smp_loader_start = SMPBOOT_ADDR;
74
- if (version == 2) {
75
+ if (processor_id == PROCESSOR_ID_BCM2836) {
76
s->binfo.write_secondary_boot = write_smpboot;
77
} else {
78
s->binfo.write_secondary_boot = write_smpboot64;
79
@@ -XXX,XX +XXX,XX @@ static void raspi_machine_init(MachineState *machine)
80
RaspiMachineClass *mc = RASPI_MACHINE_GET_CLASS(machine);
81
RaspiMachineState *s = RASPI_MACHINE(machine);
82
uint32_t board_rev = mc->board_rev;
83
- int version = board_version(board_rev);
84
uint64_t ram_size = board_ram_size(board_rev);
85
uint32_t vcram_size;
86
DriveInfo *di;
87
@@ -XXX,XX +XXX,XX @@ static void raspi_machine_init(MachineState *machine)
88
89
vcram_size = object_property_get_uint(OBJECT(&s->soc), "vcram-size",
90
&error_abort);
91
- setup_boot(machine, version, machine->ram_size - vcram_size);
92
+ setup_boot(machine, board_processor_id(mc->board_rev),
93
+ machine->ram_size - vcram_size);
94
}
231
}
95
232
96
static void raspi_machine_class_common_init(MachineClass *mc,
233
-static Property arm_cpu_lpa2_property =
234
- DEFINE_PROP_BOOL("lpa2", ARMCPU, prop_lpa2, true);
235
-
236
void arm_cpu_lpa2_finalize(ARMCPU *cpu, Error **errp)
237
{
238
uint64_t t;
239
@@ -XXX,XX +XXX,XX @@ static void aarch64_a53_initfn(Object *obj)
240
define_cortex_a72_a57_a53_cp_reginfo(cpu);
241
}
242
243
-static void aarch64_a55_initfn(Object *obj)
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',
97
--
1688
--
98
2.20.1
1689
2.34.1
99
1690
100
1691
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
From: Fabiano Rosas <farosas@suse.de>
2
2
3
The mte update missed a bit when producing clean addresses.
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
Fixes: b2aa8879b88
9
While here add comments clarifying what we're testing.
6
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
10
7
Message-id: 20200916014102.2446323-1-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-sve.c | 4 ++--
18
tests/qtest/arm-cpu-features.c | 20 +++++++++++++++++---
12
1 file changed, 2 insertions(+), 2 deletions(-)
19
1 file changed, 17 insertions(+), 3 deletions(-)
13
20
14
diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.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-sve.c
23
--- a/tests/qtest/arm-cpu-features.c
17
+++ b/target/arm/translate-sve.c
24
+++ b/tests/qtest/arm-cpu-features.c
18
@@ -XXX,XX +XXX,XX @@ static void do_ldr(DisasContext *s, uint32_t vofs, int len, int rn, int imm)
25
@@ -XXX,XX +XXX,XX @@ static void test_query_cpu_model_expansion_kvm(const void *data)
19
for (i = 0; i < len_align; i += 8) {
26
QDict *resp;
20
tcg_gen_qemu_ld_i64(t0, clean_addr, midx, MO_LEQ);
27
char *error;
21
tcg_gen_st_i64(t0, cpu_env, vofs + i);
28
22
- tcg_gen_addi_i64(clean_addr, cpu_reg_sp(s, rn), 8);
29
- assert_error(qts, "cortex-a15",
23
+ tcg_gen_addi_i64(clean_addr, clean_addr, 8);
30
- "We cannot guarantee the CPU type 'cortex-a15' works "
24
}
31
- "with KVM on this host", NULL);
25
tcg_temp_free_i64(t0);
32
+ /*
26
} else {
33
+ * When using KVM, only the 'host' and 'max' CPU models are
27
@@ -XXX,XX +XXX,XX @@ static void do_str(DisasContext *s, uint32_t vofs, int len, int rn, int imm)
34
+ * supported. Test that we're emitting a suitable error for
28
for (i = 0; i < len_align; i += 8) {
35
+ * unsupported CPU models.
29
tcg_gen_ld_i64(t0, cpu_env, vofs + i);
36
+ */
30
tcg_gen_qemu_st_i64(t0, clean_addr, midx, MO_LEQ);
37
+ if (qtest_has_accel("tcg")) {
31
- tcg_gen_addi_i64(clean_addr, cpu_reg_sp(s, rn), 8);
38
+ assert_error(qts, "cortex-a7",
32
+ tcg_gen_addi_i64(clean_addr, clean_addr, 8);
39
+ "We cannot guarantee the CPU type 'cortex-a7' works "
33
}
40
+ "with KVM on this host", NULL);
34
tcg_temp_free_i64(t0);
41
+ } else {
35
} 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
36
--
52
--
37
2.20.1
53
2.34.1
38
54
39
55
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
1
From: Claudio Fontana <cfontana@suse.de>
2
2
3
As we only support a reduced set of the REV_CODE_PROCESSOR id
3
move the module containing cpu models definitions
4
encoded in the board revision, define the PROCESSOR_ID values
4
for 32bit TCG-only CPUs to tcg/ and rename it for clarity.
5
as an enum. We can simplify the board_soc_type and cores_count
6
methods.
7
5
8
Reviewed-by: Luc Michel <luc.michel@greensocs.com>
6
Signed-off-by: Claudio Fontana <cfontana@suse.de>
9
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
7
Signed-off-by: Fabiano Rosas <farosas@suse.de>
10
Message-id: 20200924111808.77168-7-f4bug@amsat.org
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
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
---
13
---
13
hw/arm/raspi.c | 45 +++++++++++++++++++++------------------------
14
hw/arm/virt.c | 2 --
14
1 file changed, 21 insertions(+), 24 deletions(-)
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%)
15
21
16
diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c
22
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
17
index XXXXXXX..XXXXXXX 100644
23
index XXXXXXX..XXXXXXX 100644
18
--- a/hw/arm/raspi.c
24
--- a/hw/arm/virt.c
19
+++ b/hw/arm/raspi.c
25
+++ b/hw/arm/virt.c
20
@@ -XXX,XX +XXX,XX @@ FIELD(REV_CODE, MANUFACTURER, 16, 4);
26
@@ -XXX,XX +XXX,XX @@ static const int a15irqmap[] = {
21
FIELD(REV_CODE, MEMORY_SIZE, 20, 3);
27
static const char *valid_cpus[] = {
22
FIELD(REV_CODE, STYLE, 23, 1);
28
#ifdef CONFIG_TCG
23
29
ARM_CPU_TYPE_NAME("cortex-a7"),
24
+typedef enum RaspiProcessorId {
30
-#endif
25
+ PROCESSOR_ID_BCM2836 = 1,
31
ARM_CPU_TYPE_NAME("cortex-a15"),
26
+ PROCESSOR_ID_BCM2837 = 2,
32
-#ifdef CONFIG_TCG
27
+} RaspiProcessorId;
33
ARM_CPU_TYPE_NAME("cortex-a35"),
28
+
34
ARM_CPU_TYPE_NAME("cortex-a55"),
29
+static const struct {
35
ARM_CPU_TYPE_NAME("cortex-a72"),
30
+ const char *type;
36
diff --git a/target/arm/cpu_tcg.c b/target/arm/tcg/cpu32.c
31
+ int cores_count;
37
similarity index 99%
32
+} soc_property[] = {
38
rename from target/arm/cpu_tcg.c
33
+ [PROCESSOR_ID_BCM2836] = {TYPE_BCM2836, BCM283X_NCPUS},
39
rename to target/arm/tcg/cpu32.c
34
+ [PROCESSOR_ID_BCM2837] = {TYPE_BCM2837, BCM283X_NCPUS},
40
index XXXXXXX..XXXXXXX 100644
35
+};
41
--- a/target/arm/cpu_tcg.c
36
+
42
+++ b/target/arm/tcg/cpu32.c
37
static uint64_t board_ram_size(uint32_t board_rev)
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)
38
{
67
{
39
assert(FIELD_EX32(board_rev, REV_CODE, STYLE)); /* Only new style */
68
CPUClass *cc = CPU_GET_CLASS(cs);
40
return 256 * MiB << FIELD_EX32(board_rev, REV_CODE, MEMORY_SIZE);
69
@@ -XXX,XX +XXX,XX @@ static bool arm_v7m_cpu_exec_interrupt(CPUState *cs, int interrupt_request)
70
}
71
return ret;
41
}
72
}
42
73
-#endif /* !CONFIG_USER_ONLY && CONFIG_TCG */
43
-static int board_processor_id(uint32_t board_rev)
74
+#endif /* !CONFIG_USER_ONLY */
44
+static RaspiProcessorId board_processor_id(uint32_t board_rev)
75
76
static void arm926_initfn(Object *obj)
45
{
77
{
46
+ int proc_id = FIELD_EX32(board_rev, REV_CODE, PROCESSOR);
78
@@ -XXX,XX +XXX,XX @@ static void pxa270c5_initfn(Object *obj)
47
+
79
cpu->reset_sctlr = 0x00000078;
48
assert(FIELD_EX32(board_rev, REV_CODE, STYLE)); /* Only new style */
49
- return FIELD_EX32(board_rev, REV_CODE, PROCESSOR);
50
+ assert(proc_id < ARRAY_SIZE(soc_property) && soc_property[proc_id].type);
51
+
52
+ return proc_id;
53
}
80
}
54
81
55
static int board_version(uint32_t board_rev)
82
-#ifdef CONFIG_TCG
56
@@ -XXX,XX +XXX,XX @@ static int board_version(uint32_t board_rev)
83
static const struct TCGCPUOps arm_v7m_tcg_ops = {
57
84
.initialize = arm_translate_init,
58
static const char *board_soc_type(uint32_t board_rev)
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)
59
{
93
{
60
- static const char *soc_types[] = {
94
@@ -XXX,XX +XXX,XX @@ static void arm_v7m_class_init(ObjectClass *oc, void *data)
61
- NULL, TYPE_BCM2836, TYPE_BCM2837,
95
CPUClass *cc = CPU_CLASS(oc);
62
- };
96
63
- int proc_id = board_processor_id(board_rev);
97
acc->info = data;
98
-#ifdef CONFIG_TCG
99
cc->tcg_ops = &arm_v7m_tcg_ops;
100
-#endif /* CONFIG_TCG */
64
-
101
-
65
- if (proc_id >= ARRAY_SIZE(soc_types) || !soc_types[proc_id]) {
102
cc->gdb_core_xml_file = "arm-m-profile.xml";
66
- error_report("Unsupported processor id '%d' (board revision: 0x%x)",
67
- proc_id, board_rev);
68
- exit(1);
69
- }
70
- return soc_types[proc_id];
71
+ return soc_property[board_processor_id(board_rev)].type;
72
}
103
}
73
104
74
static int cores_count(uint32_t board_rev)
105
diff --git a/target/arm/tcg/cpu64.c b/target/arm/tcg/cpu64.c
75
{
106
index XXXXXXX..XXXXXXX 100644
76
- static const int soc_cores_count[] = {
107
--- a/target/arm/tcg/cpu64.c
77
- 0, BCM283X_NCPUS, BCM283X_NCPUS,
108
+++ b/target/arm/tcg/cpu64.c
78
- };
109
@@ -XXX,XX +XXX,XX @@ static void aarch64_neoverse_n1_initfn(Object *obj)
79
- int proc_id = board_processor_id(board_rev);
110
80
-
111
/*
81
- if (proc_id >= ARRAY_SIZE(soc_cores_count) || !soc_cores_count[proc_id]) {
112
* -cpu max: a CPU with as many features enabled as our emulation supports.
82
- error_report("Unsupported processor id '%d' (board revision: 0x%x)",
113
- * The version of '-cpu max' for qemu-system-arm is defined in cpu_tcg.c;
83
- proc_id, board_rev);
114
+ * The version of '-cpu max' for qemu-system-arm is defined in cpu32.c;
84
- exit(1);
115
* this only needs to handle 64 bits.
85
- }
116
*/
86
- return soc_cores_count[proc_id];
117
void aarch64_max_tcg_initfn(Object *obj)
87
+ return soc_property[board_processor_id(board_rev)].cores_count;
118
diff --git a/target/arm/meson.build b/target/arm/meson.build
88
}
119
index XXXXXXX..XXXXXXX 100644
89
120
--- a/target/arm/meson.build
90
static const char *board_type(uint32_t board_rev)
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',
91
--
142
--
92
2.20.1
143
2.34.1
93
144
94
145
diff view generated by jsdifflib
New patch
1
From: Fabiano Rosas <farosas@suse.de>
1
2
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.
6
7
If we build with --disable-tcg on the aarch64 host, we will end-up
8
with a QEMU binary (x86) that does not support TCG nor KVM.
9
10
Skip tests that crash or hang in the above scenario. Do not include
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
24
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
25
---
26
tests/qtest/bios-tables-test.c | 11 +++++++++--
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(-)
32
33
diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c
34
index XXXXXXX..XXXXXXX 100644
35
--- a/tests/qtest/bios-tables-test.c
36
+++ b/tests/qtest/bios-tables-test.c
37
@@ -XXX,XX +XXX,XX @@ static void test_acpi_virt_oem_fields(void)
38
int main(int argc, char *argv[])
39
{
40
const char *arch = qtest_get_arch();
41
- const bool has_kvm = qtest_has_accel("kvm");
42
- const bool has_tcg = qtest_has_accel("tcg");
43
+ bool has_kvm, has_tcg;
44
char *v_env = getenv("V");
45
int ret;
46
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");
53
+
54
+ if (!has_tcg && !has_kvm) {
55
+ g_test_skip("No KVM or TCG accelerator available");
56
+ return 0;
57
+ }
58
+
59
if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) {
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;
73
+ }
74
+
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");
96
+
97
+ if (!has_tcg && !has_kvm) {
98
+ g_test_skip("No KVM or TCG accelerator available");
99
+ return 0;
100
+ }
101
+
102
has_uffd = ufd_version_check();
103
arch = qtest_get_arch();
104
105
diff --git a/tests/qtest/pxe-test.c b/tests/qtest/pxe-test.c
106
index XXXXXXX..XXXXXXX 100644
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);
114
+
115
+ if (!qtest_has_accel("tcg") && !qtest_has_accel("kvm")) {
116
+ g_test_skip("No KVM or TCG accelerator available");
117
+ return 0;
118
+ }
119
+
120
ret = boot_sector_init(disk);
121
if(ret)
122
return ret;
123
124
- g_test_init(&argc, &argv, NULL);
125
126
if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) {
127
test_batch(x86_tests, false);
128
diff --git a/tests/qtest/vmgenid-test.c b/tests/qtest/vmgenid-test.c
129
index XXXXXXX..XXXXXXX 100644
130
--- a/tests/qtest/vmgenid-test.c
131
+++ b/tests/qtest/vmgenid-test.c
132
@@ -XXX,XX +XXX,XX @@ int main(int argc, char **argv)
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;
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",
153
--
154
2.34.1
155
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
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
2
2
3
The firmware load address depends on the SoC ("processor id") used,
3
Add a manual new job to cross-build the aarch64 target with
4
not on the version of the board.
4
only the KVM accelerator enabled (in particular, no TCG).
5
5
6
Suggested-by: Luc Michel <luc.michel@greensocs.com>
6
Re-enable running the similar job on the project Aarch64
7
Reviewed-by: Luc Michel <luc.michel@greensocs.com>
7
custom runner.
8
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
8
9
Message-id: 20200924111808.77168-8-f4bug@amsat.org
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
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
14
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
---
15
---
12
hw/arm/raspi.c | 3 ++-
16
.gitlab-ci.d/crossbuilds.yml | 11 +++++++++++
13
1 file changed, 2 insertions(+), 1 deletion(-)
17
.gitlab-ci.d/custom-runners/ubuntu-22.04-aarch64.yml | 4 ----
18
2 files changed, 11 insertions(+), 4 deletions(-)
14
19
15
diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c
20
diff --git a/.gitlab-ci.d/crossbuilds.yml b/.gitlab-ci.d/crossbuilds.yml
16
index XXXXXXX..XXXXXXX 100644
21
index XXXXXXX..XXXXXXX 100644
17
--- a/hw/arm/raspi.c
22
--- a/.gitlab-ci.d/crossbuilds.yml
18
+++ b/hw/arm/raspi.c
23
+++ b/.gitlab-ci.d/crossbuilds.yml
19
@@ -XXX,XX +XXX,XX @@ static void setup_boot(MachineState *machine, int version, size_t ram_size)
24
@@ -XXX,XX +XXX,XX @@ cross-arm64-xen-only:
20
* the normal Linux boot process
25
IMAGE: debian-arm64-cross
21
*/
26
ACCEL: xen
22
if (machine->firmware) {
27
EXTRA_CONFIGURE_OPTS: --disable-tcg --disable-kvm
23
- hwaddr firmware_addr = version == 3 ? FIRMWARE_ADDR_3 : FIRMWARE_ADDR_2;
28
+
24
+ hwaddr firmware_addr = processor_id <= PROCESSOR_ID_BCM2836
29
+# Similar job is run by qemu-project's custom runner by default
25
+ ? FIRMWARE_ADDR_2 : FIRMWARE_ADDR_3;
30
+cross-arm64-kvm-only:
26
/* load the firmware image (typically kernel.img) */
31
+ extends: .cross_accel_build_job
27
r = load_image_targphys(machine->firmware, firmware_addr,
32
+ needs:
28
ram_size - firmware_addr);
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
29
--
55
--
30
2.20.1
56
2.34.1
31
57
32
58
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
1
From: Patrick Venture <venture@google.com>
2
2
3
Now that we can instantiate different machines based on their
3
The MAC address set from Qemu wasn't being saved into the register space.
4
board_rev register value, we can have various raspi2 and raspi3.
5
4
6
In commit fc78a990ec103 we corrected the machine description.
5
Reviewed-by: Hao Wu <wuhaotsh@google.com>
7
Correct the machine names too. For backward compatibility, add
6
Signed-off-by: Patrick Venture <venture@google.com>
8
an alias to the previous generic name.
7
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
9
8
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
10
Reviewed-by: Luc Michel <luc.michel@greensocs.com>
9
[PMM: moved variable declaration to top of function]
11
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
12
Message-id: 20200924111808.77168-6-f4bug@amsat.org
13
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
14
---
11
---
15
hw/arm/raspi.c | 6 ++++--
12
hw/net/npcm7xx_emc.c | 32 +++++++++++++++++++++++++-------
16
1 file changed, 4 insertions(+), 2 deletions(-)
13
1 file changed, 25 insertions(+), 7 deletions(-)
17
14
18
diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c
15
diff --git a/hw/net/npcm7xx_emc.c b/hw/net/npcm7xx_emc.c
19
index XXXXXXX..XXXXXXX 100644
16
index XXXXXXX..XXXXXXX 100644
20
--- a/hw/arm/raspi.c
17
--- a/hw/net/npcm7xx_emc.c
21
+++ b/hw/arm/raspi.c
18
+++ b/hw/net/npcm7xx_emc.c
22
@@ -XXX,XX +XXX,XX @@ static void raspi2b_machine_class_init(ObjectClass *oc, void *data)
19
@@ -XXX,XX +XXX,XX @@ static const char *emc_reg_name(int regno)
23
MachineClass *mc = MACHINE_CLASS(oc);
20
24
RaspiMachineClass *rmc = RASPI_MACHINE_CLASS(oc);
21
static void emc_reset(NPCM7xxEMCState *emc)
25
22
{
26
+ mc->alias = "raspi2";
23
+ uint32_t value;
27
rmc->board_rev = 0xa21041;
24
+
28
raspi_machine_class_common_init(mc, rmc->board_rev);
25
trace_npcm7xx_emc_reset(emc->emc_num);
29
};
26
30
@@ -XXX,XX +XXX,XX @@ static void raspi3b_machine_class_init(ObjectClass *oc, void *data)
27
memset(&emc->regs[0], 0, sizeof(emc->regs));
31
MachineClass *mc = MACHINE_CLASS(oc);
28
@@ -XXX,XX +XXX,XX @@ static void emc_reset(NPCM7xxEMCState *emc)
32
RaspiMachineClass *rmc = RASPI_MACHINE_CLASS(oc);
29
33
30
emc->tx_active = false;
34
+ mc->alias = "raspi3";
31
emc->rx_active = false;
35
rmc->board_rev = 0xa02082;
32
+
36
raspi_machine_class_common_init(mc, rmc->board_rev);
33
+ /* Set the MAC address in the register space. */
37
};
34
+ value = (emc->conf.macaddr.a[0] << 24) |
38
@@ -XXX,XX +XXX,XX @@ static void raspi3b_machine_class_init(ObjectClass *oc, void *data)
35
+ (emc->conf.macaddr.a[1] << 16) |
39
36
+ (emc->conf.macaddr.a[2] << 8) |
40
static const TypeInfo raspi_machine_types[] = {
37
+ emc->conf.macaddr.a[3];
41
{
38
+ emc->regs[REG_CAMM_BASE] = value;
42
- .name = MACHINE_TYPE_NAME("raspi2"),
39
+
43
+ .name = MACHINE_TYPE_NAME("raspi2b"),
40
+ value = (emc->conf.macaddr.a[4] << 24) | (emc->conf.macaddr.a[5] << 16);
44
.parent = TYPE_RASPI_MACHINE,
41
+ emc->regs[REG_CAML_BASE] = value;
45
.class_init = raspi2b_machine_class_init,
42
}
46
#ifdef TARGET_AARCH64
43
47
}, {
44
static void npcm7xx_emc_reset(DeviceState *dev)
48
- .name = MACHINE_TYPE_NAME("raspi3"),
45
@@ -XXX,XX +XXX,XX @@ static bool emc_receive_filter1(NPCM7xxEMCState *emc, const uint8_t *buf,
49
+ .name = MACHINE_TYPE_NAME("raspi3b"),
46
}
50
.parent = TYPE_RASPI_MACHINE,
47
case ETH_PKT_UCAST: {
51
.class_init = raspi3b_machine_class_init,
48
bool matches;
52
#endif
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;
53
--
88
--
54
2.20.1
89
2.34.1
55
90
56
91
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
1
From: Daniel Bertalan <dani@danielbertalan.dev>
2
2
3
Commit 1c3db49d39 added the raspi3, which uses the same peripherals
3
This query copies the kernel command line into the message buffer. It
4
than the raspi2 (but with different ARM cores). The raspi3 was
4
was previously stubbed out to return empty, this commit makes it reflect
5
introduced without the ignore_memory_transaction_failures flag.
5
the arguments specified with `-append`.
6
Almost 2 years later, the machine is usable running U-Boot and
7
Linux.
8
In commit 00cbd5bd74 we mapped a lot of unimplemented devices,
9
commit d442d95f added thermal block and commit 0e5bbd7406 the
10
system timer.
11
As we are happy with the raspi3, let's remove this flag on the
12
raspi2.
13
6
14
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
7
I observed the following peculiarities on my Pi 3B+:
15
Reviewed-by: Luc Michel <luc.michel@greensocs.com>
8
- If the buffer is shorter than the string, the response header gives
16
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
9
the full length, but no data is actually copied.
17
Message-id: 20200921034729.432931-4-f4bug@amsat.org
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]
18
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
21
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
19
---
22
---
20
hw/arm/raspi.c | 3 ---
23
include/hw/misc/bcm2835_property.h | 1 +
21
1 file changed, 3 deletions(-)
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(-)
22
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
}
23
diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c
68
diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c
24
index XXXXXXX..XXXXXXX 100644
69
index XXXXXXX..XXXXXXX 100644
25
--- a/hw/arm/raspi.c
70
--- a/hw/arm/raspi.c
26
+++ b/hw/arm/raspi.c
71
+++ b/hw/arm/raspi.c
27
@@ -XXX,XX +XXX,XX @@ static void raspi_machine_class_init(ObjectClass *oc, void *data)
72
@@ -XXX,XX +XXX,XX @@ static void raspi_machine_init(MachineState *machine)
28
mc->default_cpus = mc->min_cpus = mc->max_cpus = cores_count(board_rev);
73
object_property_add_const_link(OBJECT(&s->soc), "ram", OBJECT(machine->ram));
29
mc->default_ram_size = board_ram_size(board_rev);
74
object_property_set_int(OBJECT(&s->soc), "board-rev", board_rev,
30
mc->default_ram_id = "ram";
75
&error_abort);
31
- if (board_version(board_rev) == 2) {
76
+ object_property_set_str(OBJECT(&s->soc), "command-line",
32
- mc->ignore_memory_transaction_failures = true;
77
+ machine->kernel_cmdline, &error_abort);
33
- }
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()
34
};
110
};
35
111
36
static const TypeInfo raspi_machine_types[] = {
37
--
112
--
38
2.20.1
113
2.34.1
39
40
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
The ARM_FEATURE_PXN bit indicates whether the CPU supports the PXN
1
The HMP 'singlestep' command, the QMP 'query-status' command and the
2
bit in short-descriptor translation table format descriptors. This
2
HMP 'info status' command (which is just wrapping the QMP command
3
is indicated by ID_MMFR0.VMSA being at least 0b0100. Replace the
3
implementation) look at the 'singlestep' global variable. Make them
4
feature bit with an ID register check, in line with our preference
4
access the new TCG accelerator 'one-insn-per-tb' property instead.
5
for ID register checks over feature bits.
5
6
This leaves the HMP and QMP command/field names and output strings
7
unchanged; we will clean that up later.
6
8
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
10
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
9
Message-id: 20200910173855.4068-2-peter.maydell@linaro.org
11
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
12
Message-id: 20230417164041.684562-3-peter.maydell@linaro.org
10
---
13
---
11
target/arm/cpu.h | 15 ++++++++++++++-
14
softmmu/runstate-hmp-cmds.c | 18 ++++++++++++++++--
12
target/arm/cpu.c | 1 -
15
softmmu/runstate.c | 10 +++++++++-
13
target/arm/helper.c | 5 +++--
16
2 files changed, 25 insertions(+), 3 deletions(-)
14
3 files changed, 17 insertions(+), 4 deletions(-)
15
17
16
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
18
diff --git a/softmmu/runstate-hmp-cmds.c b/softmmu/runstate-hmp-cmds.c
17
index XXXXXXX..XXXXXXX 100644
19
index XXXXXXX..XXXXXXX 100644
18
--- a/target/arm/cpu.h
20
--- a/softmmu/runstate-hmp-cmds.c
19
+++ b/target/arm/cpu.h
21
+++ b/softmmu/runstate-hmp-cmds.c
20
@@ -XXX,XX +XXX,XX @@ FIELD(ID_ISAR6, FHM, 8, 4)
22
@@ -XXX,XX +XXX,XX @@
21
FIELD(ID_ISAR6, SB, 12, 4)
23
#include "qapi/error.h"
22
FIELD(ID_ISAR6, SPECRES, 16, 4)
24
#include "qapi/qapi-commands-run-state.h"
23
25
#include "qapi/qmp/qdict.h"
24
+FIELD(ID_MMFR0, VMSA, 0, 4)
26
+#include "qemu/accel.h"
25
+FIELD(ID_MMFR0, PMSA, 4, 4)
27
26
+FIELD(ID_MMFR0, OUTERSHR, 8, 4)
28
void hmp_info_status(Monitor *mon, const QDict *qdict)
27
+FIELD(ID_MMFR0, SHARELVL, 12, 4)
29
{
28
+FIELD(ID_MMFR0, TCM, 16, 4)
30
@@ -XXX,XX +XXX,XX @@ void hmp_info_status(Monitor *mon, const QDict *qdict)
29
+FIELD(ID_MMFR0, AUXREG, 20, 4)
31
void hmp_singlestep(Monitor *mon, const QDict *qdict)
30
+FIELD(ID_MMFR0, FCSE, 24, 4)
32
{
31
+FIELD(ID_MMFR0, INNERSHR, 28, 4)
33
const char *option = qdict_get_try_str(qdict, "option");
34
+ AccelState *accel = current_accel();
35
+ bool newval;
32
+
36
+
33
FIELD(ID_MMFR3, CMAINTVA, 0, 4)
37
+ if (!object_property_find(OBJECT(accel), "one-insn-per-tb")) {
34
FIELD(ID_MMFR3, CMAINTSW, 4, 4)
38
+ monitor_printf(mon,
35
FIELD(ID_MMFR3, BPMAINT, 8, 4)
39
+ "This accelerator does not support setting one-insn-per-tb\n");
36
@@ -XXX,XX +XXX,XX @@ enum arm_features {
40
+ return;
37
ARM_FEATURE_CACHE_DIRTY_REG, /* 1136/1176 cache dirty status register */
41
+ }
38
ARM_FEATURE_CACHE_BLOCK_OPS, /* v6 optional cache block operations */
42
+
39
ARM_FEATURE_MPIDR, /* has cp15 MPIDR */
43
if (!option || !strcmp(option, "on")) {
40
- ARM_FEATURE_PXN, /* has Privileged Execute Never bit */
44
- singlestep = 1;
41
ARM_FEATURE_LPAE, /* has Large Physical Address Extension */
45
+ newval = true;
42
ARM_FEATURE_V8,
46
} else if (!strcmp(option, "off")) {
43
ARM_FEATURE_AARCH64, /* supports 64 bit mode */
47
- singlestep = 0;
44
@@ -XXX,XX +XXX,XX @@ static inline bool isar_feature_aa32_vminmaxnm(const ARMISARegisters *id)
48
+ newval = false;
45
return FIELD_EX32(id->mvfr2, MVFR2, FPMISC) >= 4;
49
} else {
50
monitor_printf(mon, "unexpected option %s\n", option);
51
+ return;
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);
46
}
56
}
47
57
48
+static inline bool isar_feature_aa32_pxn(const ARMISARegisters *id)
58
void hmp_watchdog_action(Monitor *mon, const QDict *qdict)
49
+{
59
diff --git a/softmmu/runstate.c b/softmmu/runstate.c
50
+ return FIELD_EX32(id->id_mmfr0, ID_MMFR0, VMSA) >= 4;
60
index XXXXXXX..XXXXXXX 100644
51
+}
61
--- a/softmmu/runstate.c
52
+
62
+++ b/softmmu/runstate.c
53
static inline bool isar_feature_aa32_pan(const ARMISARegisters *id)
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)
54
{
73
{
55
return FIELD_EX32(id->id_mmfr3, ID_MMFR3, PAN) != 0;
74
StatusInfo *info = g_malloc0(sizeof(*info));
56
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
75
+ AccelState *accel = current_accel();
57
index XXXXXXX..XXXXXXX 100644
76
58
--- a/target/arm/cpu.c
77
+ /*
59
+++ b/target/arm/cpu.c
78
+ * We ignore errors, which will happen if the accelerator
60
@@ -XXX,XX +XXX,XX @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp)
79
+ * is not TCG. "singlestep" is meaningless for other accelerators,
61
}
80
+ * so we will set the StatusInfo field to false for those.
62
if (arm_feature(env, ARM_FEATURE_LPAE)) {
81
+ */
63
set_feature(env, ARM_FEATURE_V7MP);
82
+ info->singlestep = object_property_get_bool(OBJECT(accel),
64
- set_feature(env, ARM_FEATURE_PXN);
83
+ "one-insn-per-tb", NULL);
65
}
84
info->running = runstate_is_running();
66
if (arm_feature(env, ARM_FEATURE_CBAR_RO)) {
85
- info->singlestep = singlestep;
67
set_feature(env, ARM_FEATURE_CBAR);
86
info->status = current_run_state;
68
diff --git a/target/arm/helper.c b/target/arm/helper.c
87
69
index XXXXXXX..XXXXXXX 100644
88
return info;
70
--- a/target/arm/helper.c
71
+++ b/target/arm/helper.c
72
@@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_v6(CPUARMState *env, uint32_t address,
73
target_ulong *page_size, ARMMMUFaultInfo *fi)
74
{
75
CPUState *cs = env_cpu(env);
76
+ ARMCPU *cpu = env_archcpu(env);
77
int level = 1;
78
uint32_t table;
79
uint32_t desc;
80
@@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_v6(CPUARMState *env, uint32_t address,
81
goto do_fault;
82
}
83
type = (desc & 3);
84
- if (type == 0 || (type == 3 && !arm_feature(env, ARM_FEATURE_PXN))) {
85
+ if (type == 0 || (type == 3 && !cpu_isar_feature(aa32_pxn, cpu))) {
86
/* Section translation fault, or attempt to use the encoding
87
* which is Reserved on implementations without PXN.
88
*/
89
@@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_v6(CPUARMState *env, uint32_t address,
90
pxn = desc & 1;
91
ns = extract32(desc, 19, 1);
92
} else {
93
- if (arm_feature(env, ARM_FEATURE_PXN)) {
94
+ if (cpu_isar_feature(aa32_pxn, cpu)) {
95
pxn = (desc >> 2) & 1;
96
}
97
ns = extract32(desc, 3, 1);
98
--
89
--
99
2.20.1
90
2.34.1
100
91
101
92
diff view generated by jsdifflib
1
The M-profile definition of the MVFR1 ID register differs slightly
1
The only place left that looks at the old 'singlestep' global
2
from the A-profile one, and in particular the check for "does the CPU
2
variable is the TCG curr_cflags() function. Replace the old global
3
support fp16 arithmetic" is not the same.
3
with a new 'one_insn_per_tb' which is defined in tcg-all.c and
4
declared in accel/tcg/internal.h. This keeps it restricted to the
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.
4
8
5
We don't currently implement any M-profile CPUs with fp16 arithmetic,
9
While we're making this change, use qatomic_read() and qatomic_set()
6
so this is not yet a visible bug, but correcting the logic now
10
on the accesses to the new global, because TCG will read it without
7
disarms this beartrap for when we eventually do.
11
holding a lock.
8
12
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
14
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
11
Message-id: 20200910173855.4068-6-peter.maydell@linaro.org
15
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
16
Message-id: 20230417164041.684562-4-peter.maydell@linaro.org
12
---
17
---
13
target/arm/cpu.h | 31 ++++++++++++++++++++++++++-----
18
accel/tcg/internal.h | 2 ++
14
1 file changed, 26 insertions(+), 5 deletions(-)
19
include/exec/cpu-common.h | 2 --
20
accel/tcg/cpu-exec.c | 2 +-
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/target/arm/cpu.h b/target/arm/cpu.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/target/arm/cpu.h
29
--- a/accel/tcg/internal.h
19
+++ b/target/arm/cpu.h
30
+++ b/accel/tcg/internal.h
20
@@ -XXX,XX +XXX,XX @@ FIELD(ID_MMFR4, LSM, 20, 4)
31
@@ -XXX,XX +XXX,XX @@ static inline target_ulong log_pc(CPUState *cpu, const TranslationBlock *tb)
21
FIELD(ID_MMFR4, CCIDX, 24, 4)
32
extern int64_t max_delay;
22
FIELD(ID_MMFR4, EVT, 28, 4)
33
extern int64_t max_advance;
23
34
24
+FIELD(ID_PFR1, PROGMOD, 0, 4)
35
+extern bool one_insn_per_tb;
25
+FIELD(ID_PFR1, SECURITY, 4, 4)
26
+FIELD(ID_PFR1, MPROGMOD, 8, 4)
27
+FIELD(ID_PFR1, VIRTUALIZATION, 12, 4)
28
+FIELD(ID_PFR1, GENTIMER, 16, 4)
29
+FIELD(ID_PFR1, SEC_FRAC, 20, 4)
30
+FIELD(ID_PFR1, VIRT_FRAC, 24, 4)
31
+FIELD(ID_PFR1, GIC, 28, 4)
32
+
36
+
33
FIELD(ID_AA64ISAR0, AES, 4, 4)
37
#endif /* ACCEL_TCG_INTERNAL_H */
34
FIELD(ID_AA64ISAR0, SHA1, 8, 4)
38
diff --git a/include/exec/cpu-common.h b/include/exec/cpu-common.h
35
FIELD(ID_AA64ISAR0, SHA2, 12, 4)
39
index XXXXXXX..XXXXXXX 100644
36
@@ -XXX,XX +XXX,XX @@ FIELD(MVFR0, FPROUND, 28, 4)
40
--- a/include/exec/cpu-common.h
37
41
+++ b/include/exec/cpu-common.h
38
FIELD(MVFR1, FPFTZ, 0, 4)
42
@@ -XXX,XX +XXX,XX @@ int cpu_memory_rw_debug(CPUState *cpu, vaddr addr,
39
FIELD(MVFR1, FPDNAN, 4, 4)
43
void *ptr, size_t len, bool is_write);
40
-FIELD(MVFR1, SIMDLS, 8, 4)
44
41
-FIELD(MVFR1, SIMDINT, 12, 4)
45
/* vl.c */
42
-FIELD(MVFR1, SIMDSP, 16, 4)
46
-extern int singlestep;
43
-FIELD(MVFR1, SIMDHP, 20, 4)
47
-
44
+FIELD(MVFR1, SIMDLS, 8, 4) /* A-profile only */
48
void list_cpus(void);
45
+FIELD(MVFR1, SIMDINT, 12, 4) /* A-profile only */
49
46
+FIELD(MVFR1, SIMDSP, 16, 4) /* A-profile only */
50
#endif /* CPU_COMMON_H */
47
+FIELD(MVFR1, SIMDHP, 20, 4) /* A-profile only */
51
diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c
48
+FIELD(MVFR1, MVE, 8, 4) /* M-profile only */
52
index XXXXXXX..XXXXXXX 100644
49
+FIELD(MVFR1, FP16, 20, 4) /* M-profile only */
53
--- a/accel/tcg/cpu-exec.c
50
FIELD(MVFR1, FPHP, 24, 4)
54
+++ b/accel/tcg/cpu-exec.c
51
FIELD(MVFR1, SIMDFMAC, 28, 4)
55
@@ -XXX,XX +XXX,XX @@ uint32_t curr_cflags(CPUState *cpu)
52
56
*/
53
@@ -XXX,XX +XXX,XX @@ static inline bool isar_feature_aa32_predinv(const ARMISARegisters *id)
57
if (unlikely(cpu->singlestep_enabled)) {
54
return FIELD_EX32(id->id_isar6, ID_ISAR6, SPECRES) != 0;
58
cflags |= CF_NO_GOTO_TB | CF_NO_GOTO_PTR | CF_SINGLE_STEP | 1;
59
- } else if (singlestep) {
60
+ } else if (qatomic_read(&one_insn_per_tb)) {
61
cflags |= CF_NO_GOTO_TB | 1;
62
} else if (qemu_loglevel_mask(CPU_LOG_TB_NOCHAIN)) {
63
cflags |= CF_NO_GOTO_TB;
64
diff --git a/accel/tcg/tcg-all.c b/accel/tcg/tcg-all.c
65
index XXXXXXX..XXXXXXX 100644
66
--- a/accel/tcg/tcg-all.c
67
+++ b/accel/tcg/tcg-all.c
68
@@ -XXX,XX +XXX,XX @@
69
#include "qapi/error.h"
70
#include "qemu/error-report.h"
71
#include "qemu/accel.h"
72
+#include "qemu/atomic.h"
73
#include "qapi/qapi-builtin-visit.h"
74
#include "qemu/units.h"
75
#if !defined(CONFIG_USER_ONLY)
76
@@ -XXX,XX +XXX,XX @@ static void tcg_accel_instance_init(Object *obj)
55
}
77
}
56
78
57
+static inline bool isar_feature_aa32_mprofile(const ARMISARegisters *id)
79
bool mttcg_enabled;
58
+{
80
+bool one_insn_per_tb;
59
+ return FIELD_EX32(id->id_pfr1, ID_PFR1, MPROGMOD) != 0;
81
60
+}
82
static int tcg_init_machine(MachineState *ms)
61
+
62
static inline bool isar_feature_aa32_fp16_arith(const ARMISARegisters *id)
63
{
83
{
64
- return FIELD_EX32(id->mvfr1, MVFR1, FPHP) >= 3;
84
@@ -XXX,XX +XXX,XX @@ static void tcg_set_one_insn_per_tb(Object *obj, bool value, Error **errp)
65
+ /* Sadly this is encoded differently for A-profile and M-profile */
85
{
66
+ if (isar_feature_aa32_mprofile(id)) {
86
TCGState *s = TCG_STATE(obj);
67
+ return FIELD_EX32(id->mvfr1, MVFR1, FP16) > 0;
87
s->one_insn_per_tb = value;
68
+ } else {
88
- /* For the moment, set the global also: this changes the behaviour */
69
+ return FIELD_EX32(id->mvfr1, MVFR1, FPHP) >= 3;
89
- singlestep = value;
70
+ }
90
+ /* Set the global also: this changes the behaviour */
91
+ qatomic_set(&one_insn_per_tb, value);
71
}
92
}
72
93
73
static inline bool isar_feature_aa32_vfp_simd(const ARMISARegisters *id)
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];
74
--
131
--
75
2.20.1
132
2.34.1
76
133
77
134
diff view generated by jsdifflib
1
Give the Cortex-M0 ID register values corresponding to its
1
The '-singlestep' option is confusing, because it doesn't actually
2
implemented behaviour. These will not be guest-visible but will be
2
have anything to do with single-stepping the CPU. What it does do
3
used to govern the behaviour of QEMU's emulation. We use the same
3
is force TCG emulation to put one guest instruction in each TB,
4
values that the Cortex-M3 does.
4
which can be useful in some situations.
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.
5
9
6
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
11
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
8
Message-id: 20200910173855.4068-5-peter.maydell@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
9
---
15
---
10
target/arm/cpu_tcg.c | 24 ++++++++++++++++++++++++
16
docs/user/main.rst | 7 ++++++-
11
1 file changed, 24 insertions(+)
17
linux-user/main.c | 9 ++++++---
18
2 files changed, 12 insertions(+), 4 deletions(-)
12
19
13
diff --git a/target/arm/cpu_tcg.c b/target/arm/cpu_tcg.c
20
diff --git a/docs/user/main.rst b/docs/user/main.rst
14
index XXXXXXX..XXXXXXX 100644
21
index XXXXXXX..XXXXXXX 100644
15
--- a/target/arm/cpu_tcg.c
22
--- a/docs/user/main.rst
16
+++ b/target/arm/cpu_tcg.c
23
+++ b/docs/user/main.rst
17
@@ -XXX,XX +XXX,XX @@ static void cortex_m0_initfn(Object *obj)
24
@@ -XXX,XX +XXX,XX @@ Debug options:
18
set_feature(&cpu->env, ARM_FEATURE_M);
25
``-g port``
19
26
Wait gdb connection to port
20
cpu->midr = 0x410cc200;
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.
21
+
32
+
22
+ /*
33
``-singlestep``
23
+ * These ID register values are not guest visible, because
34
- Run the emulation in single step mode.
24
+ * we do not implement the Main Extension. They must be set
35
+ This is a deprecated synonym for the ``-one-insn-per-tb`` option.
25
+ * to values corresponding to the Cortex-M0's implemented
36
26
+ * features, because QEMU generally controls its emulation
37
Environment variables:
27
+ * by looking at ID register fields. We use the same values as
38
28
+ * for the M3.
39
diff --git a/linux-user/main.c b/linux-user/main.c
29
+ */
40
index XXXXXXX..XXXXXXX 100644
30
+ cpu->isar.id_pfr0 = 0x00000030;
41
--- a/linux-user/main.c
31
+ cpu->isar.id_pfr1 = 0x00000200;
42
+++ b/linux-user/main.c
32
+ cpu->isar.id_dfr0 = 0x00100000;
43
@@ -XXX,XX +XXX,XX @@ static void handle_arg_reserved_va(const char *arg)
33
+ cpu->id_afr0 = 0x00000000;
44
reserved_va = val ? val - 1 : 0;
34
+ cpu->isar.id_mmfr0 = 0x00000030;
35
+ cpu->isar.id_mmfr1 = 0x00000000;
36
+ cpu->isar.id_mmfr2 = 0x00000000;
37
+ cpu->isar.id_mmfr3 = 0x00000000;
38
+ cpu->isar.id_isar0 = 0x01141110;
39
+ cpu->isar.id_isar1 = 0x02111000;
40
+ cpu->isar.id_isar2 = 0x21112231;
41
+ cpu->isar.id_isar3 = 0x01111110;
42
+ cpu->isar.id_isar4 = 0x01310102;
43
+ cpu->isar.id_isar5 = 0x00000000;
44
+ cpu->isar.id_isar6 = 0x00000000;
45
}
45
}
46
46
47
static void cortex_m3_initfn(Object *obj)
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,
48
--
66
--
49
2.20.1
67
2.34.1
50
68
51
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
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
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'.
2
6
3
The Raspberry firmware is closed-source. While running it, it
7
We don't need a deprecate-and-drop period for this because the
4
accesses various I/O registers. Logging these accesses as UNIMP
8
HMP interface has no stability guarantees.
5
(unimplemented) help to understand what the firmware is doing
6
(ideally we want it able to boot a Linux kernel).
7
9
8
Document various blocks we might use later.
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(-)
9
18
10
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
19
diff --git a/accel/tcg/monitor.c b/accel/tcg/monitor.c
11
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
12
Reviewed-by: Luc Michel <luc.michel@greensocs.com>
13
Message-id: 20200921034729.432931-2-f4bug@amsat.org
14
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
15
---
16
include/hw/arm/raspi_platform.h | 51 +++++++++++++++++++++++++++------
17
1 file changed, 43 insertions(+), 8 deletions(-)
18
19
diff --git a/include/hw/arm/raspi_platform.h b/include/hw/arm/raspi_platform.h
20
index XXXXXXX..XXXXXXX 100644
20
index XXXXXXX..XXXXXXX 100644
21
--- a/include/hw/arm/raspi_platform.h
21
--- a/accel/tcg/monitor.c
22
+++ b/include/hw/arm/raspi_platform.h
22
+++ b/accel/tcg/monitor.c
23
@@ -XXX,XX +XXX,XX @@
23
@@ -XXX,XX +XXX,XX @@
24
* You should have received a copy of the GNU General Public License
25
* along with this program; if not, write to the Free Software
26
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27
+ *
28
+ * Various undocumented addresses and names come from Herman Hermitage's VC4
29
+ * documentation:
30
+ * https://github.com/hermanhermitage/videocoreiv/wiki/MMIO-Register-map
31
*/
24
*/
32
25
33
#ifndef HW_ARM_RASPI_PLATFORM_H
26
#include "qemu/osdep.h"
34
#define HW_ARM_RASPI_PLATFORM_H
27
+#include "qemu/accel.h"
35
28
#include "qapi/error.h"
36
#define MSYNC_OFFSET 0x0000 /* Multicore Sync Block */
29
#include "qapi/type-helpers.h"
37
-#define IC0_OFFSET 0x2000
30
#include "qapi/qapi-commands-machine.h"
38
+#define CCPT_OFFSET 0x1000 /* Compact Camera Port 2 TX */
31
@@ -XXX,XX +XXX,XX @@ static void dump_drift_info(GString *buf)
39
+#define INTE_OFFSET 0x2000 /* VC Interrupt controller */
32
}
40
#define ST_OFFSET 0x3000 /* System Timer */
33
}
41
+#define TXP_OFFSET 0x4000 /* Transposer */
34
42
+#define JPEG_OFFSET 0x5000
35
+static void dump_accel_info(GString *buf)
43
#define MPHI_OFFSET 0x6000 /* Message-based Parallel Host Intf. */
36
+{
44
#define DMA_OFFSET 0x7000 /* DMA controller, channels 0-14 */
37
+ AccelState *accel = current_accel();
45
-#define ARM_OFFSET 0xB000 /* BCM2708 ARM control block */
38
+ bool one_insn_per_tb = object_property_get_bool(OBJECT(accel),
46
+#define ARBA_OFFSET 0x9000
39
+ "one-insn-per-tb",
47
+#define BRDG_OFFSET 0xa000
40
+ &error_fatal);
48
+#define ARM_OFFSET 0xB000 /* ARM control block */
41
+
49
#define ARMCTRL_OFFSET (ARM_OFFSET + 0x000)
42
+ g_string_append_printf(buf, "Accelerator settings:\n");
50
#define ARMCTRL_IC_OFFSET (ARM_OFFSET + 0x200) /* Interrupt controller */
43
+ g_string_append_printf(buf, "one-insn-per-tb: %s\n\n",
51
-#define ARMCTRL_TIMER0_1_OFFSET (ARM_OFFSET + 0x400) /* Timer 0 and 1 */
44
+ one_insn_per_tb ? "on" : "off");
52
+#define ARMCTRL_TIMER0_1_OFFSET (ARM_OFFSET + 0x400) /* Timer 0 and 1 (SP804) */
45
+}
53
#define ARMCTRL_0_SBM_OFFSET (ARM_OFFSET + 0x800) /* User 0 (ARM) Semaphores
46
+
54
* Doorbells & Mailboxes */
47
HumanReadableText *qmp_x_query_jit(Error **errp)
55
#define CPRMAN_OFFSET 0x100000 /* Power Management, Watchdog */
48
{
56
@@ -XXX,XX +XXX,XX @@
49
g_autoptr(GString) buf = g_string_new("");
57
#define AVS_OFFSET 0x103000 /* Audio Video Standard */
50
@@ -XXX,XX +XXX,XX @@ HumanReadableText *qmp_x_query_jit(Error **errp)
58
#define RNG_OFFSET 0x104000
51
return NULL;
59
#define GPIO_OFFSET 0x200000
52
}
60
-#define UART0_OFFSET 0x201000
53
61
-#define MMCI0_OFFSET 0x202000
54
+ dump_accel_info(buf);
62
-#define I2S_OFFSET 0x203000
55
dump_exec_info(buf);
63
-#define SPI0_OFFSET 0x204000
56
dump_drift_info(buf);
64
+#define UART0_OFFSET 0x201000 /* PL011 */
57
65
+#define MMCI0_OFFSET 0x202000 /* Legacy MMC */
58
diff --git a/softmmu/runstate-hmp-cmds.c b/softmmu/runstate-hmp-cmds.c
66
+#define I2S_OFFSET 0x203000 /* PCM */
59
index XXXXXXX..XXXXXXX 100644
67
+#define SPI0_OFFSET 0x204000 /* SPI master */
60
--- a/softmmu/runstate-hmp-cmds.c
68
#define BSC0_OFFSET 0x205000 /* BSC0 I2C/TWI */
61
+++ b/softmmu/runstate-hmp-cmds.c
69
+#define PIXV0_OFFSET 0x206000
62
@@ -XXX,XX +XXX,XX @@ void hmp_info_status(Monitor *mon, const QDict *qdict)
70
+#define PIXV1_OFFSET 0x207000
63
71
+#define DPI_OFFSET 0x208000
64
info = qmp_query_status(NULL);
72
+#define DSI0_OFFSET 0x209000 /* Display Serial Interface */
65
73
+#define PWM_OFFSET 0x20c000
66
- monitor_printf(mon, "VM status: %s%s",
74
+#define PERM_OFFSET 0x20d000
67
- info->running ? "running" : "paused",
75
+#define TEC_OFFSET 0x20e000
68
- info->singlestep ? " (single step mode)" : "");
76
#define OTP_OFFSET 0x20f000
69
+ monitor_printf(mon, "VM status: %s",
77
+#define SLIM_OFFSET 0x210000 /* SLIMbus */
70
+ info->running ? "running" : "paused");
78
+#define CPG_OFFSET 0x211000
71
79
#define THERMAL_OFFSET 0x212000
72
if (!info->running && info->status != RUN_STATE_PAUSED) {
80
-#define BSC_SL_OFFSET 0x214000 /* SPI slave */
73
monitor_printf(mon, " (%s)", RunState_str(info->status));
81
+#define AVSP_OFFSET 0x213000
82
+#define BSC_SL_OFFSET 0x214000 /* SPI slave (bootrom) */
83
#define AUX_OFFSET 0x215000 /* AUX: UART1/SPI1/SPI2 */
84
#define EMMC1_OFFSET 0x300000
85
+#define EMMC2_OFFSET 0x340000
86
+#define HVS_OFFSET 0x400000
87
#define SMI_OFFSET 0x600000
88
+#define DSI1_OFFSET 0x700000
89
+#define UCAM_OFFSET 0x800000
90
+#define CMI_OFFSET 0x802000
91
#define BSC1_OFFSET 0x804000 /* BSC1 I2C/TWI */
92
#define BSC2_OFFSET 0x805000 /* BSC2 I2C/TWI */
93
+#define VECA_OFFSET 0x806000
94
+#define PIXV2_OFFSET 0x807000
95
+#define HDMI_OFFSET 0x808000
96
+#define HDCP_OFFSET 0x809000
97
+#define ARBR0_OFFSET 0x80a000
98
#define DBUS_OFFSET 0x900000
99
#define AVE0_OFFSET 0x910000
100
#define USB_OTG_OFFSET 0x980000 /* DTC_OTG USB controller */
101
+#define V3D_OFFSET 0xc00000
102
#define SDRAMC_OFFSET 0xe00000
103
+#define L2CC_OFFSET 0xe01000 /* Level 2 Cache controller */
104
+#define L1CC_OFFSET 0xe02000 /* Level 1 Cache controller */
105
+#define ARBR1_OFFSET 0xe04000
106
#define DMA15_OFFSET 0xE05000 /* DMA controller, channel 15 */
107
+#define DCRC_OFFSET 0xe07000
108
+#define AXIP_OFFSET 0xe08000
109
110
/* GPU interrupts */
111
#define INTERRUPT_TIMER0 0
112
--
74
--
113
2.20.1
75
2.34.1
114
76
115
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
New patch
1
The run-state.json file is missing a trailing newline; add it.
1
2
3
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
5
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
6
Message-id: 20230417164041.684562-10-peter.maydell@linaro.org
7
---
8
qapi/run-state.json | 2 +-
9
1 file changed, 1 insertion(+), 1 deletion(-)
10
11
diff --git a/qapi/run-state.json b/qapi/run-state.json
12
index XXXXXXX..XXXXXXX 100644
13
--- a/qapi/run-state.json
14
+++ b/qapi/run-state.json
15
@@ -XXX,XX +XXX,XX @@
16
# Since: 7.2
17
##
18
{ 'enum': 'NotifyVmexitOption',
19
- 'data': [ 'run', 'internal-error', 'disable' ] }
20
\ No newline at end of file
21
+ 'data': [ 'run', 'internal-error', 'disable' ] }
22
--
23
2.34.1
24
25
diff view generated by jsdifflib
1
M-profile CPUs only implement the ID registers as guest-visible if
1
The 'singlestep' member of StatusInfo has never done what the QMP
2
the CPU implements the Main Extension (all our current CPUs except
2
documentation claims it does. What it actually reports is whether
3
the Cortex-M0 do).
3
TCG is working in "one guest instruction per translation block" mode.
4
4
5
Currently we handle this by having the Cortex-M0 leave the ID
5
We no longer need this field for the HMP 'info status' command, as
6
register values in the ARMCPU struct as zero, but this conflicts with
6
we've moved that information to 'info jit'. It seems unlikely that
7
our design decision to make QEMU behaviour be keyed off ID register
7
anybody is monitoring the state of this obscure TCG setting via QMP,
8
fields wherever possible.
8
especially since QMP provides no means for changing the setting. So
9
simply deprecate the field, without providing any replacement.
9
10
10
Explicitly code the ID registers in the NVIC to return 0 if the Main
11
Until we do eventually delete the member, correct the misstatements
11
Extension is not implemented, so we can make the M0 model set the
12
in the QAPI documentation about it.
12
ARMCPU struct fields to obtain the correct behaviour without those
13
13
values becoming guest-visible.
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.
14
19
15
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
20
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
16
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
21
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
17
Message-id: 20200910173855.4068-4-peter.maydell@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
18
---
25
---
19
hw/intc/armv7m_nvic.c | 42 ++++++++++++++++++++++++++++++++++++++++++
26
docs/about/deprecated.rst | 14 ++++++++++++++
20
1 file changed, 42 insertions(+)
27
qapi/run-state.json | 14 +++++++++++---
28
2 files changed, 25 insertions(+), 3 deletions(-)
21
29
22
diff --git a/hw/intc/armv7m_nvic.c b/hw/intc/armv7m_nvic.c
30
diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst
23
index XXXXXXX..XXXXXXX 100644
31
index XXXXXXX..XXXXXXX 100644
24
--- a/hw/intc/armv7m_nvic.c
32
--- a/docs/about/deprecated.rst
25
+++ b/hw/intc/armv7m_nvic.c
33
+++ b/docs/about/deprecated.rst
26
@@ -XXX,XX +XXX,XX @@ static uint32_t nvic_readl(NVICState *s, uint32_t offset, MemTxAttrs attrs)
34
@@ -XXX,XX +XXX,XX @@ accepted incorrect commands will return an error. Users should make sure that
27
"Aux Fault status registers unimplemented\n");
35
all arguments passed to ``device_add`` are consistent with the documented
28
return 0;
36
property types.
29
case 0xd40: /* PFR0. */
37
30
+ if (!arm_feature(&cpu->env, ARM_FEATURE_M_MAIN)) {
38
+``StatusInfo`` member ``singlestep`` (since 8.1)
31
+ goto bad_offset;
39
+''''''''''''''''''''''''''''''''''''''''''''''''
32
+ }
40
+
33
return cpu->isar.id_pfr0;
41
+The ``singlestep`` member of the ``StatusInfo`` returned from the
34
case 0xd44: /* PFR1. */
42
+``query-status`` command is deprecated. This member has a confusing
35
+ if (!arm_feature(&cpu->env, ARM_FEATURE_M_MAIN)) {
43
+name and it never did what the documentation claimed or what its name
36
+ goto bad_offset;
44
+suggests. We do not believe that anybody is actually using the
37
+ }
45
+information provided in this member.
38
return cpu->isar.id_pfr1;
46
+
39
case 0xd48: /* DFR0. */
47
+The information it reports is whether the TCG JIT is in "one
40
+ if (!arm_feature(&cpu->env, ARM_FEATURE_M_MAIN)) {
48
+instruction per translated block" mode (which can be set on the
41
+ goto bad_offset;
49
+command line or via the HMP, but not via QMP). The information remains
42
+ }
50
+available via the HMP 'info jit' command.
43
return cpu->isar.id_dfr0;
51
+
44
case 0xd4c: /* AFR0. */
52
Human Monitor Protocol (HMP) commands
45
+ if (!arm_feature(&cpu->env, ARM_FEATURE_M_MAIN)) {
53
-------------------------------------
46
+ goto bad_offset;
54
47
+ }
55
diff --git a/qapi/run-state.json b/qapi/run-state.json
48
return cpu->id_afr0;
56
index XXXXXXX..XXXXXXX 100644
49
case 0xd50: /* MMFR0. */
57
--- a/qapi/run-state.json
50
+ if (!arm_feature(&cpu->env, ARM_FEATURE_M_MAIN)) {
58
+++ b/qapi/run-state.json
51
+ goto bad_offset;
59
@@ -XXX,XX +XXX,XX @@
52
+ }
60
#
53
return cpu->isar.id_mmfr0;
61
# @running: true if all VCPUs are runnable, false if not runnable
54
case 0xd54: /* MMFR1. */
62
#
55
+ if (!arm_feature(&cpu->env, ARM_FEATURE_M_MAIN)) {
63
-# @singlestep: true if VCPUs are in single-step mode
56
+ goto bad_offset;
64
+# @singlestep: true if using TCG with one guest instruction
57
+ }
65
+# per translation block
58
return cpu->isar.id_mmfr1;
66
#
59
case 0xd58: /* MMFR2. */
67
# @status: the virtual machine @RunState
60
+ if (!arm_feature(&cpu->env, ARM_FEATURE_M_MAIN)) {
68
#
61
+ goto bad_offset;
69
+# Features:
62
+ }
70
+# @deprecated: Member 'singlestep' is deprecated (with no replacement).
63
return cpu->isar.id_mmfr2;
71
+#
64
case 0xd5c: /* MMFR3. */
72
# Since: 0.14
65
+ if (!arm_feature(&cpu->env, ARM_FEATURE_M_MAIN)) {
73
#
66
+ goto bad_offset;
74
-# Notes: @singlestep is enabled through the GDB stub
67
+ }
75
+# Notes: @singlestep is enabled on the command line with
68
return cpu->isar.id_mmfr3;
76
+# '-accel tcg,one-insn-per-tb=on', or with the HMP
69
case 0xd60: /* ISAR0. */
77
+# 'one-insn-per-tb' command.
70
+ if (!arm_feature(&cpu->env, ARM_FEATURE_M_MAIN)) {
78
##
71
+ goto bad_offset;
79
{ 'struct': 'StatusInfo',
72
+ }
80
- 'data': {'running': 'bool', 'singlestep': 'bool', 'status': 'RunState'} }
73
return cpu->isar.id_isar0;
81
+ 'data': {'running': 'bool',
74
case 0xd64: /* ISAR1. */
82
+ 'singlestep': { 'type': 'bool', 'features': [ 'deprecated' ]},
75
+ if (!arm_feature(&cpu->env, ARM_FEATURE_M_MAIN)) {
83
+ 'status': 'RunState'} }
76
+ goto bad_offset;
84
77
+ }
85
##
78
return cpu->isar.id_isar1;
86
# @query-status:
79
case 0xd68: /* ISAR2. */
80
+ if (!arm_feature(&cpu->env, ARM_FEATURE_M_MAIN)) {
81
+ goto bad_offset;
82
+ }
83
return cpu->isar.id_isar2;
84
case 0xd6c: /* ISAR3. */
85
+ if (!arm_feature(&cpu->env, ARM_FEATURE_M_MAIN)) {
86
+ goto bad_offset;
87
+ }
88
return cpu->isar.id_isar3;
89
case 0xd70: /* ISAR4. */
90
+ if (!arm_feature(&cpu->env, ARM_FEATURE_M_MAIN)) {
91
+ goto bad_offset;
92
+ }
93
return cpu->isar.id_isar4;
94
case 0xd74: /* ISAR5. */
95
+ if (!arm_feature(&cpu->env, ARM_FEATURE_M_MAIN)) {
96
+ goto bad_offset;
97
+ }
98
return cpu->isar.id_isar5;
99
case 0xd78: /* CLIDR */
100
return cpu->clidr;
101
--
87
--
102
2.20.1
88
2.34.1
103
89
104
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: Philippe Mathieu-Daudé <f4bug@amsat.org>
1
From: Cédric Le Goater <clg@kaod.org>
2
2
3
The 'first_cpu' is more a QEMU accelerator-related concept
3
The arm boot.c code includes a utility function write_bootloader()
4
than a variable the machine requires to use.
4
which assists in writing a boot-code fragment into guest memory,
5
Since the machine is aware of its CPUs, directly use the
5
including handling endianness and fixing it up with entry point
6
first one to load the firmware.
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.
7
9
8
Reviewed-by: Luc Michel <luc.michel@greensocs.com>
10
Since we are making it public, make its API a little neater: move the
9
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
11
AddressSpace* argument to be next to the hwaddr argument, and allow
10
Message-id: 20200924111808.77168-3-f4bug@amsat.org
12
the fixupcontext array to be const, since we never modify it in this
13
function.
14
15
Cc: qemu-stable@nongnu.org
16
Signed-off-by: Cédric Le Goater <clg@kaod.org>
17
Tested-by: Cédric Le Goater <clg@kaod.org>
18
Reviewed-by: Philippe Mathieu-Daudé <philmd@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]
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
22
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
---
23
---
13
hw/arm/raspi.c | 3 ++-
24
include/hw/arm/boot.h | 49 +++++++++++++++++++++++++++++++++++++++++++
14
1 file changed, 2 insertions(+), 1 deletion(-)
25
hw/arm/boot.c | 35 +++++++------------------------
26
2 files changed, 57 insertions(+), 27 deletions(-)
15
27
16
diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c
28
diff --git a/include/hw/arm/boot.h b/include/hw/arm/boot.h
17
index XXXXXXX..XXXXXXX 100644
29
index XXXXXXX..XXXXXXX 100644
18
--- a/hw/arm/raspi.c
30
--- a/include/hw/arm/boot.h
19
+++ b/hw/arm/raspi.c
31
+++ b/include/hw/arm/boot.h
20
@@ -XXX,XX +XXX,XX @@ static void reset_secondary(ARMCPU *cpu, const struct arm_boot_info *info)
32
@@ -XXX,XX +XXX,XX @@ void arm_write_secure_board_setup_dummy_smc(ARMCPU *cpu,
21
33
const struct arm_boot_info *info,
22
static void setup_boot(MachineState *machine, int version, size_t ram_size)
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);
92
}
93
94
-typedef enum {
95
- FIXUP_NONE = 0, /* do nothing */
96
- FIXUP_TERMINATOR, /* end of insns */
97
- FIXUP_BOARDID, /* overwrite with board ID number */
98
- FIXUP_BOARD_SETUP, /* overwrite with board specific setup code address */
99
- FIXUP_ARGPTR_LO, /* overwrite with pointer to kernel args */
100
- FIXUP_ARGPTR_HI, /* overwrite with pointer to kernel args (high half) */
101
- FIXUP_ENTRYPOINT_LO, /* overwrite with kernel entry point */
102
- FIXUP_ENTRYPOINT_HI, /* overwrite with kernel entry point (high half) */
103
- FIXUP_GIC_CPU_IF, /* overwrite with GIC CPU interface address */
104
- FIXUP_BOOTREG, /* overwrite with boot register address */
105
- FIXUP_DSB, /* overwrite with correct DSB insn for cpu */
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)
23
{
128
{
24
+ RaspiMachineState *s = RASPI_MACHINE(machine);
129
/* Fix up the specified bootloader fragment and write it into
25
static struct arm_boot_info binfo;
130
* guest memory using rom_add_blob_fixed(). fixupcontext is
26
int r;
131
@@ -XXX,XX +XXX,XX @@ static void default_write_secondary(ARMCPU *cpu,
27
132
fixupcontext[FIXUP_DSB] = CP15_DSB_INSN;
28
@@ -XXX,XX +XXX,XX @@ static void setup_boot(MachineState *machine, int version, size_t ram_size)
29
binfo.firmware_loaded = true;
30
}
133
}
31
134
32
- arm_load_kernel(ARM_CPU(first_cpu), machine, &binfo);
135
- write_bootloader("smpboot", info->smp_loader_start,
33
+ arm_load_kernel(&s->soc.cpu[0].core, machine, &binfo);
136
- smpboot, fixupcontext, as);
137
+ arm_write_bootloader("smpboot", as, info->smp_loader_start,
138
+ smpboot, fixupcontext);
34
}
139
}
35
140
36
static void raspi_machine_init(MachineState *machine)
141
void arm_write_secure_board_setup_dummy_smc(ARMCPU *cpu,
142
@@ -XXX,XX +XXX,XX @@ static void arm_setup_direct_kernel_boot(ARMCPU *cpu,
143
fixupcontext[FIXUP_ENTRYPOINT_LO] = entry;
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);
37
--
153
--
38
2.20.1
154
2.34.1
39
155
40
156
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
1
From: Cédric Le Goater <clg@kaod.org>
2
2
3
Using class_data pointer to create a MachineClass is not
3
When writing the secondary-CPU stub boot loader code to the guest,
4
the recommended way anymore. The correct way is to open-code
4
use arm_write_bootloader() instead of directly calling
5
the MachineClass::fields in the class_init() method.
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.
6
9
7
We can not use TYPE_RASPI_MACHINE::class_base_init() because
10
Cc: qemu-stable@nongnu.org
8
it is called *before* each machine class_init(), therefore the
11
Signed-off-by: Cédric Le Goater <clg@kaod.org>
9
board_rev field is not populated. We have to manually call
12
Tested-by: Cédric Le Goater <clg@kaod.org>
10
raspi_machine_class_common_init() for each machine.
13
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
11
14
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
This partly reverts commit a03bde3674e.
15
Message-id: 20230424152717.1333930-3-peter.maydell@linaro.org
13
16
[PMM: Moved the "make arm_write_bootloader() function public" part
14
Suggested-by: Igor Mammedov <imammedo@redhat.com>
17
to its own patch; updated commit message to note that this fixes
15
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
18
an actual bug; adjust to the API changes noted in previous commit]
16
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
17
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
18
Message-id: 20200924111808.77168-5-f4bug@amsat.org
19
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
19
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
20
---
20
---
21
hw/arm/raspi.c | 34 ++++++++++++++++++++++++----------
21
hw/arm/aspeed.c | 38 ++++++++++++++++++++------------------
22
1 file changed, 24 insertions(+), 10 deletions(-)
22
1 file changed, 20 insertions(+), 18 deletions(-)
23
23
24
diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c
24
diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c
25
index XXXXXXX..XXXXXXX 100644
25
index XXXXXXX..XXXXXXX 100644
26
--- a/hw/arm/raspi.c
26
--- a/hw/arm/aspeed.c
27
+++ b/hw/arm/raspi.c
27
+++ b/hw/arm/aspeed.c
28
@@ -XXX,XX +XXX,XX @@ static void raspi_machine_init(MachineState *machine)
28
@@ -XXX,XX +XXX,XX @@ struct AspeedMachineState {
29
setup_boot(machine, version, machine->ram_size - vcram_size);
29
static void aspeed_write_smpboot(ARMCPU *cpu,
30
const struct arm_boot_info *info)
31
{
32
- static const uint32_t poll_mailbox_ready[] = {
33
+ AddressSpace *as = arm_boot_address_space(cpu, info);
34
+ static const ARMInsnFixup poll_mailbox_ready[] = {
35
/*
36
* r2 = per-cpu go sign value
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);
30
}
79
}
31
80
32
-static void raspi_machine_class_init(ObjectClass *oc, void *data)
81
static void aspeed_reset_secondary(ARMCPU *cpu,
33
+static void raspi_machine_class_common_init(MachineClass *mc,
34
+ uint32_t board_rev)
35
{
36
- MachineClass *mc = MACHINE_CLASS(oc);
37
- RaspiMachineClass *rmc = RASPI_MACHINE_CLASS(oc);
38
- uint32_t board_rev = (uint32_t)(uintptr_t)data;
39
-
40
- rmc->board_rev = board_rev;
41
mc->desc = g_strdup_printf("Raspberry Pi %s (revision 1.%u)",
42
board_type(board_rev),
43
FIELD_EX32(board_rev, REV_CODE, REVISION));
44
@@ -XXX,XX +XXX,XX @@ static void raspi_machine_class_init(ObjectClass *oc, void *data)
45
mc->default_ram_id = "ram";
46
};
47
48
+static void raspi2b_machine_class_init(ObjectClass *oc, void *data)
49
+{
50
+ MachineClass *mc = MACHINE_CLASS(oc);
51
+ RaspiMachineClass *rmc = RASPI_MACHINE_CLASS(oc);
52
+
53
+ rmc->board_rev = 0xa21041;
54
+ raspi_machine_class_common_init(mc, rmc->board_rev);
55
+};
56
+
57
+#ifdef TARGET_AARCH64
58
+static void raspi3b_machine_class_init(ObjectClass *oc, void *data)
59
+{
60
+ MachineClass *mc = MACHINE_CLASS(oc);
61
+ RaspiMachineClass *rmc = RASPI_MACHINE_CLASS(oc);
62
+
63
+ rmc->board_rev = 0xa02082;
64
+ raspi_machine_class_common_init(mc, rmc->board_rev);
65
+};
66
+#endif /* TARGET_AARCH64 */
67
+
68
static const TypeInfo raspi_machine_types[] = {
69
{
70
.name = MACHINE_TYPE_NAME("raspi2"),
71
.parent = TYPE_RASPI_MACHINE,
72
- .class_init = raspi_machine_class_init,
73
- .class_data = (void *)0xa21041,
74
+ .class_init = raspi2b_machine_class_init,
75
#ifdef TARGET_AARCH64
76
}, {
77
.name = MACHINE_TYPE_NAME("raspi3"),
78
.parent = TYPE_RASPI_MACHINE,
79
- .class_init = raspi_machine_class_init,
80
- .class_data = (void *)0xa02082,
81
+ .class_init = raspi3b_machine_class_init,
82
#endif
83
}, {
84
.name = TYPE_RASPI_MACHINE,
85
--
82
--
86
2.20.1
83
2.34.1
87
84
88
85
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
1
When writing the secondary-CPU stub boot loader code to the guest,
2
use arm_write_bootloader() instead of directly calling
3
rom_add_blob_fixed(). This fixes a bug on big-endian hosts, because
4
arm_write_bootloader() will correctly byte-swap the host-byte-order
5
array values into the guest-byte-order to write into the guest
6
memory.
2
7
3
Display the board revision in the machine description.
8
Cc: qemu-stable@nongnu.org
4
5
Before:
6
7
$ qemu-system-aarch64 -M help | fgrep raspi
8
raspi2 Raspberry Pi 2B
9
raspi3 Raspberry Pi 3B
10
11
After:
12
13
raspi2 Raspberry Pi 2B (revision 1.1)
14
raspi3 Raspberry Pi 3B (revision 1.2)
15
16
Reviewed-by: Luc Michel <luc.michel@greensocs.com>
17
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
18
Message-id: 20200924111808.77168-2-f4bug@amsat.org
19
Signed-off-by: Peter Maydell <peter.maydell@linaro.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
20
---
13
---
21
hw/arm/raspi.c | 4 +++-
14
hw/arm/raspi.c | 64 +++++++++++++++++++++++++++-----------------------
22
1 file changed, 3 insertions(+), 1 deletion(-)
15
1 file changed, 34 insertions(+), 30 deletions(-)
23
16
24
diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c
17
diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c
25
index XXXXXXX..XXXXXXX 100644
18
index XXXXXXX..XXXXXXX 100644
26
--- a/hw/arm/raspi.c
19
--- a/hw/arm/raspi.c
27
+++ b/hw/arm/raspi.c
20
+++ b/hw/arm/raspi.c
28
@@ -XXX,XX +XXX,XX @@ static void raspi_machine_class_init(ObjectClass *oc, void *data)
21
@@ -XXX,XX +XXX,XX @@
29
uint32_t board_rev = (uint32_t)(uintptr_t)data;
22
#include "qemu/units.h"
30
23
#include "qemu/cutils.h"
31
rmc->board_rev = board_rev;
24
#include "qapi/error.h"
32
- mc->desc = g_strdup_printf("Raspberry Pi %s", board_type(board_rev));
25
+#include "hw/arm/boot.h"
33
+ mc->desc = g_strdup_printf("Raspberry Pi %s (revision 1.%u)",
26
#include "hw/arm/bcm2836.h"
34
+ board_type(board_rev),
27
#include "hw/registerfields.h"
35
+ FIELD_EX32(board_rev, REV_CODE, REVISION));
28
#include "qemu/error-report.h"
36
mc->init = raspi_machine_init;
29
@@ -XXX,XX +XXX,XX @@ static const char *board_type(uint32_t board_rev)
37
mc->block_default_type = IF_SD;
30
38
mc->no_parallel = 1;
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
}
39
--
120
--
40
2.20.1
121
2.34.1
41
122
42
123
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
1
The Allwinner PIC model uses set_bit() and clear_bit() to update the
2
values in its irq_pending[] array when an interrupt arrives. However
3
it is using these functions wrongly: they work on an array of type
4
'long', and it is passing an array of type 'uint32_t'. Because the
5
code manually figures out the right array element, this works on
6
little-endian hosts and on 32-bit big-endian hosts, where bits 0..31
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.
2
9
3
The bcm2835-v3d is used since Linux 4.7, see commit
10
Remove the use of set_bit() and clear_bit() in favour of using
4
49ac67e0c39c ("ARM: bcm2835: Add VC4 to the device tree"),
11
deposit32() on the array element. This fixes a bug where on
5
and the bcm2835-txp since Linux 4.19, see commit
12
big-endian 64-bit hosts the guest kernel would hang early on in
6
b7dd29b401f5 ("ARM: dts: bcm283x: Add Transposer block").
13
bootup.
7
14
8
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
15
Cc: qemu-stable@nongnu.org
9
Reviewed-by: Luc Michel <luc.michel@greensocs.com>
10
Message-id: 20200921034729.432931-3-f4bug@amsat.org
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
16
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
17
Reviewed-by: Thomas Huth <thuth@redhat.com>
18
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
19
Message-id: 20230424152833.1334136-1-peter.maydell@linaro.org
12
---
20
---
13
include/hw/arm/bcm2835_peripherals.h | 2 ++
21
hw/intc/allwinner-a10-pic.c | 7 ++-----
14
hw/arm/bcm2835_peripherals.c | 2 ++
22
1 file changed, 2 insertions(+), 5 deletions(-)
15
2 files changed, 4 insertions(+)
16
23
17
diff --git a/include/hw/arm/bcm2835_peripherals.h b/include/hw/arm/bcm2835_peripherals.h
24
diff --git a/hw/intc/allwinner-a10-pic.c b/hw/intc/allwinner-a10-pic.c
18
index XXXXXXX..XXXXXXX 100644
25
index XXXXXXX..XXXXXXX 100644
19
--- a/include/hw/arm/bcm2835_peripherals.h
26
--- a/hw/intc/allwinner-a10-pic.c
20
+++ b/include/hw/arm/bcm2835_peripherals.h
27
+++ b/hw/intc/allwinner-a10-pic.c
21
@@ -XXX,XX +XXX,XX @@ struct BCM2835PeripheralState {
28
@@ -XXX,XX +XXX,XX @@ static void aw_a10_pic_update(AwA10PICState *s)
22
29
static void aw_a10_pic_set_irq(void *opaque, int irq, int level)
23
BCM2835SystemTimerState systmr;
30
{
24
BCM2835MphiState mphi;
31
AwA10PICState *s = opaque;
25
+ UnimplementedDeviceState txp;
32
+ uint32_t *pending_reg = &s->irq_pending[irq / 32];
26
UnimplementedDeviceState armtmr;
33
27
UnimplementedDeviceState cprman;
34
- if (level) {
28
UnimplementedDeviceState a2w;
35
- set_bit(irq % 32, (void *)&s->irq_pending[irq / 32]);
29
@@ -XXX,XX +XXX,XX @@ struct BCM2835PeripheralState {
36
- } else {
30
UnimplementedDeviceState otp;
37
- clear_bit(irq % 32, (void *)&s->irq_pending[irq / 32]);
31
UnimplementedDeviceState dbus;
38
- }
32
UnimplementedDeviceState ave0;
39
+ *pending_reg = deposit32(*pending_reg, irq % 32, 1, level);
33
+ UnimplementedDeviceState v3d;
40
aw_a10_pic_update(s);
34
UnimplementedDeviceState bscsl;
35
UnimplementedDeviceState smi;
36
DWC2State dwc2;
37
diff --git a/hw/arm/bcm2835_peripherals.c b/hw/arm/bcm2835_peripherals.c
38
index XXXXXXX..XXXXXXX 100644
39
--- a/hw/arm/bcm2835_peripherals.c
40
+++ b/hw/arm/bcm2835_peripherals.c
41
@@ -XXX,XX +XXX,XX @@ static void bcm2835_peripherals_realize(DeviceState *dev, Error **errp)
42
qdev_get_gpio_in_named(DEVICE(&s->ic), BCM2835_IC_GPU_IRQ,
43
INTERRUPT_USB));
44
45
+ create_unimp(s, &s->txp, "bcm2835-txp", TXP_OFFSET, 0x1000);
46
create_unimp(s, &s->armtmr, "bcm2835-sp804", ARMCTRL_TIMER0_1_OFFSET, 0x40);
47
create_unimp(s, &s->cprman, "bcm2835-cprman", CPRMAN_OFFSET, 0x1000);
48
create_unimp(s, &s->a2w, "bcm2835-a2w", A2W_OFFSET, 0x1000);
49
@@ -XXX,XX +XXX,XX @@ static void bcm2835_peripherals_realize(DeviceState *dev, Error **errp)
50
create_unimp(s, &s->otp, "bcm2835-otp", OTP_OFFSET, 0x80);
51
create_unimp(s, &s->dbus, "bcm2835-dbus", DBUS_OFFSET, 0x8000);
52
create_unimp(s, &s->ave0, "bcm2835-ave0", AVE0_OFFSET, 0x8000);
53
+ create_unimp(s, &s->v3d, "bcm2835-v3d", V3D_OFFSET, 0x1000);
54
create_unimp(s, &s->sdramc, "bcm2835-sdramc", SDRAMC_OFFSET, 0x100);
55
}
41
}
56
42
57
--
43
--
58
2.20.1
44
2.34.1
59
45
60
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: Richard Henderson <richard.henderson@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
While converting to gen_gvec_ool_zzzp, we lost passing
8
This fixes a failure of one of the avocado tests on s390.
4
a->esz as the data argument to the function.
5
9
6
Fixes: 36cbb7a8e71
7
Cc: qemu-stable@nongnu.org
10
Cc: qemu-stable@nongnu.org
8
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
9
Message-id: 20200918000500.2690937-1-richard.henderson@linaro.org
10
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
11
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
12
---
16
---
13
target/arm/translate-sve.c | 2 +-
17
hw/sd/allwinner-sdhost.c | 31 ++++++++++++++++++++++++++-----
14
1 file changed, 1 insertion(+), 1 deletion(-)
18
1 file changed, 26 insertions(+), 5 deletions(-)
15
19
16
diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c
20
diff --git a/hw/sd/allwinner-sdhost.c b/hw/sd/allwinner-sdhost.c
17
index XXXXXXX..XXXXXXX 100644
21
index XXXXXXX..XXXXXXX 100644
18
--- a/target/arm/translate-sve.c
22
--- a/hw/sd/allwinner-sdhost.c
19
+++ b/target/arm/translate-sve.c
23
+++ b/hw/sd/allwinner-sdhost.c
20
@@ -XXX,XX +XXX,XX @@ static bool trans_SPLICE(DisasContext *s, arg_rprr_esz *a)
24
@@ -XXX,XX +XXX,XX @@ static void allwinner_sdhost_auto_stop(AwSdHostState *s)
21
{
22
if (sve_access_check(s)) {
23
gen_gvec_ool_zzzp(s, gen_helper_sve_splice,
24
- a->rd, a->rn, a->rm, a->pg, 0);
25
+ a->rd, a->rn, a->rm, a->pg, a->esz);
26
}
25
}
27
return true;
26
}
27
28
+static void read_descriptor(AwSdHostState *s, hwaddr desc_addr,
29
+ TransferDescriptor *desc)
30
+{
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]);
38
+}
39
+
40
+static void write_descriptor(AwSdHostState *s, hwaddr desc_addr,
41
+ const TransferDescriptor *desc)
42
+{
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);
50
+}
51
+
52
static uint32_t allwinner_sdhost_process_desc(AwSdHostState *s,
53
hwaddr desc_addr,
54
TransferDescriptor *desc,
55
@@ -XXX,XX +XXX,XX @@ static uint32_t allwinner_sdhost_process_desc(AwSdHostState *s,
56
uint32_t num_bytes = max_bytes;
57
uint8_t buf[1024];
58
59
- /* Read descriptor */
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;
28
}
75
}
29
--
76
--
30
2.20.1
77
2.34.1
31
78
32
79
diff view generated by jsdifflib
New patch
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.
1
8
9
Cc: qemu-stable@nongnu.org
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
Reviewed-by: Thomas Huth <thuth@redhat.com>
12
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
13
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
14
Message-id: 20230424165053.1428857-3-peter.maydell@linaro.org
15
---
16
hw/net/allwinner-sun8i-emac.c | 22 +++++++++++++++-------
17
1 file changed, 15 insertions(+), 7 deletions(-)
18
19
diff --git a/hw/net/allwinner-sun8i-emac.c b/hw/net/allwinner-sun8i-emac.c
20
index XXXXXXX..XXXXXXX 100644
21
--- a/hw/net/allwinner-sun8i-emac.c
22
+++ b/hw/net/allwinner-sun8i-emac.c
23
@@ -XXX,XX +XXX,XX @@ static void allwinner_sun8i_emac_get_desc(AwSun8iEmacState *s,
24
FrameDescriptor *desc,
25
uint32_t phys_addr)
26
{
27
- dma_memory_read(&s->dma_as, phys_addr, desc, sizeof(*desc),
28
+ uint32_t desc_words[4];
29
+ dma_memory_read(&s->dma_as, phys_addr, &desc_words, sizeof(desc_words),
30
MEMTXATTRS_UNSPECIFIED);
31
+ desc->status = le32_to_cpu(desc_words[0]);
32
+ desc->status2 = le32_to_cpu(desc_words[1]);
33
+ desc->addr = le32_to_cpu(desc_words[2]);
34
+ desc->next = le32_to_cpu(desc_words[3]);
35
}
36
37
static uint32_t allwinner_sun8i_emac_next_desc(AwSun8iEmacState *s,
38
@@ -XXX,XX +XXX,XX @@ static uint32_t allwinner_sun8i_emac_tx_desc(AwSun8iEmacState *s,
39
}
40
41
static void allwinner_sun8i_emac_flush_desc(AwSun8iEmacState *s,
42
- FrameDescriptor *desc,
43
+ const FrameDescriptor *desc,
44
uint32_t phys_addr)
45
{
46
- dma_memory_write(&s->dma_as, phys_addr, desc, sizeof(*desc),
47
+ uint32_t desc_words[4];
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);
54
}
55
56
@@ -XXX,XX +XXX,XX @@ static uint64_t allwinner_sun8i_emac_read(void *opaque, hwaddr offset,
57
break;
58
case REG_TX_CUR_BUF: /* Transmit Current Buffer */
59
if (s->tx_desc_curr != 0) {
60
- dma_memory_read(&s->dma_as, s->tx_desc_curr, &desc, sizeof(desc),
61
- MEMTXATTRS_UNSPECIFIED);
62
+ allwinner_sun8i_emac_get_desc(s, &desc, s->tx_desc_curr);
63
value = desc.addr;
64
} else {
65
value = 0;
66
@@ -XXX,XX +XXX,XX @@ static uint64_t allwinner_sun8i_emac_read(void *opaque, hwaddr offset,
67
break;
68
case REG_RX_CUR_BUF: /* Receive Current Buffer */
69
if (s->rx_desc_curr != 0) {
70
- dma_memory_read(&s->dma_as, s->rx_desc_curr, &desc, sizeof(desc),
71
- MEMTXATTRS_UNSPECIFIED);
72
+ allwinner_sun8i_emac_get_desc(s, &desc, s->rx_desc_curr);
73
value = desc.addr;
74
} else {
75
value = 0;
76
--
77
2.34.1
78
79
diff view generated by jsdifflib