1
Hi; here's a target-arm pullreq for rc0; these are all bugfixes
1
For some reason the xilinx can bus patches built in my local config
2
and similar minor stuff.
2
but not in the merge-test ones; dropped those.
3
3
4
thanks
5
-- PMM
4
-- PMM
6
5
7
The following changes since commit 0462a32b4f63b2448b4a196381138afd50719dc4:
6
The following changes since commit a68694cd1f3e5448cca814ff39b871f9ebd71ed5:
8
7
9
Merge tag 'for-upstream' of https://repo.or.cz/qemu/kevin into staging (2025-03-14 09:31:13 +0800)
8
Merge remote-tracking branch 'remotes/philmd-gitlab/tags/edk2-next-20200914' into staging (2020-09-14 12:18:58 +0100)
10
9
11
are available in the Git repository at:
10
are available in the Git repository at:
12
11
13
https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20250314-1
12
https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20200914-1
14
13
15
for you to fetch changes up to a019e15edfd62beae1e2f6adc0fa7415ba20b14c:
14
for you to fetch changes up to 4fe986dd4480308ecf07200cfbd3c3d494a0f639:
16
15
17
meson.build: Set RUST_BACKTRACE for all tests (2025-03-14 12:54:33 +0000)
16
tests/acceptance: console boot tests for quanta-gsj (2020-09-14 14:24:59 +0100)
18
17
19
----------------------------------------------------------------
18
----------------------------------------------------------------
20
target-arm queue:
19
* hw/misc/a9scu: Do not allow invalid CPU count
21
* Correctly handle corner cases of guest attempting an exception
20
* hw/misc/a9scu: Minor cleanups
22
return to AArch32 when target EL is AArch64 only
21
* hw/timer/armv7m_systick: assert that board code set system_clock_scale
23
* MAINTAINERS: Fix status for Arm boards I "maintain"
22
* decodetree: Improve identifier matching
24
* tests/functional: Bump up arm_replay timeout
23
* target/arm: Clean up neon fp insn size field decode
25
* Revert "hw/char/pl011: Warn when using disabled receiver"
24
* target/arm: Remove KVM support for 32-bit Arm hosts
26
* util/cacheflush: Make first DSB unconditional on aarch64
25
* hw/arm/mps2: New board models mps2-an386, mps2-an500
27
* target/arm: Fix SVE/SME access check logic
26
* Deprecate Unicore32 port
28
* meson.build: Set RUST_BACKTRACE for all tests
27
* Deprecate lm32 port
28
* target/arm: Count PMU events when MDCR.SPME is set
29
* hw/arm: versal-virt: Correct the tx/rx GEM clocks
30
* New Nuvoton iBMC board models npcm750-evb, quanta-gsj
29
31
30
----------------------------------------------------------------
32
----------------------------------------------------------------
31
Joe Komlodi (1):
33
Aaron Lindsay (1):
32
util/cacheflush: Make first DSB unconditional on aarch64
34
target/arm: Count PMU events when MDCR.SPME is set
33
35
34
Paolo Bonzini (1):
36
Edgar E. Iglesias (1):
35
Revert "hw/char/pl011: Warn when using disabled receiver"
37
hw/arm: versal-virt: Correct the tx/rx GEM clocks
36
38
37
Peter Maydell (13):
39
Havard Skinnemoen (14):
38
target/arm: Move A32_BANKED_REG_{GET,SET} macros to cpregs.h
40
hw/misc: Add NPCM7xx System Global Control Registers device model
39
target/arm: Un-inline access_secure_reg()
41
hw/misc: Add NPCM7xx Clock Controller device model
40
linux-user/aarch64: Remove unused get/put_user macros
42
hw/timer: Add NPCM7xx Timer device model
41
linux-user/arm: Remove unused get_put_user macros
43
hw/arm: Add NPCM730 and NPCM750 SoC models
42
target/arm: Move arm_cpu_data_is_big_endian() etc to internals.h
44
hw/arm: Add two NPCM7xx-based machines
43
target/arm: Move arm_current_el() and arm_el_is_aa64() to internals.h
45
roms: Add virtual Boot ROM for NPCM7xx SoCs
44
target/arm: SCR_EL3.RW should be treated as 1 if EL2 doesn't support AArch32
46
hw/arm: Load -bios image as a boot ROM for npcm7xx
45
target/arm: HCR_EL2.RW should be RAO/WI if EL1 doesn't support AArch32
47
hw/nvram: NPCM7xx OTP device model
46
target/arm: Add cpu local variable to exception_return helper
48
hw/mem: Stubbed out NPCM7xx Memory Controller model
47
target/arm: Forbid return to AArch32 when CPU is AArch64-only
49
hw/ssi: NPCM7xx Flash Interface Unit device model
48
MAINTAINERS: Fix status for Arm boards I "maintain"
50
hw/arm: Wire up BMC boot flash for npcm750-evb and quanta-gsj
49
tests/functional: Bump up arm_replay timeout
51
hw/arm/npcm7xx: add board setup stub for CPU and UART clocks
50
meson.build: Set RUST_BACKTRACE for all tests
52
docs/system: Add Nuvoton machine documentation
53
tests/acceptance: console boot tests for quanta-gsj
51
54
52
Richard Henderson (2):
55
Peter Maydell (11):
53
target/arm: Make DisasContext.{fp, sve}_access_checked tristate
56
hw/timer/armv7m_systick: assert that board code set system_clock_scale
54
target/arm: Simplify pstate_sm check in sve_access_check
57
target/arm: Convert Neon 3-same-fp size field to MO_* in decode
58
target/arm: Convert Neon VCVT fp size field to MO_* in decode
59
target/arm: Convert VCMLA, VCADD size field to MO_* in decode
60
target/arm: Remove KVM support for 32-bit Arm hosts
61
target/arm: Remove no-longer-reachable 32-bit KVM code
62
hw/arm/mps2: New board model mps2-an386
63
hw/arm/mps2: New board model mps2-an500
64
docs/system/arm/mps2.rst: Make board list consistent
65
Deprecate Unicore32 port
66
Deprecate lm32 port
55
67
56
MAINTAINERS | 14 ++--
68
Philippe Mathieu-Daudé (4):
57
meson.build | 9 ++-
69
hw/misc/a9scu: Do not allow invalid CPU count
58
target/arm/cpregs.h | 28 +++++++
70
hw/misc/a9scu: Simplify setting MemoryRegionOps::valid fields
59
target/arm/cpu.h | 153 +-----------------------------------
71
hw/misc/a9scu: Simplify setting MemoryRegionOps::impl fields
60
target/arm/internals.h | 135 +++++++++++++++++++++++++++++++
72
hw/misc/a9scu: Report unimplemented accesses with qemu_log_mask(UNIMP)
61
target/arm/tcg/translate-a64.h | 2 +-
73
62
target/arm/tcg/translate.h | 10 ++-
74
Richard Henderson (1):
63
hw/char/pl011.c | 19 ++---
75
decodetree: Improve identifier matching
64
hw/intc/arm_gicv3_cpuif.c | 1 +
76
65
linux-user/aarch64/cpu_loop.c | 48 -----------
77
docs/system/arm/mps2.rst | 20 +-
66
linux-user/arm/cpu_loop.c | 43 +---------
78
docs/system/arm/nuvoton.rst | 92 +++++
67
target/arm/arch_dump.c | 1 +
79
docs/system/deprecated.rst | 32 +-
68
target/arm/helper.c | 16 +++-
80
docs/system/target-arm.rst | 1 +
69
target/arm/tcg/helper-a64.c | 12 ++-
81
configure | 2 +-
70
target/arm/tcg/hflags.c | 9 +++
82
default-configs/arm-softmmu.mak | 1 +
71
target/arm/tcg/translate-a64.c | 37 ++++-----
83
include/hw/arm/npcm7xx.h | 112 +++++++
72
util/cacheflush.c | 4 +-
84
include/hw/mem/npcm7xx_mc.h | 36 ++
73
.gitlab-ci.d/buildtest-template.yml | 1 -
85
include/hw/misc/npcm7xx_clk.h | 48 +++
74
18 files changed, 257 insertions(+), 285 deletions(-)
86
include/hw/misc/npcm7xx_gcr.h | 43 +++
87
include/hw/nvram/npcm7xx_otp.h | 79 +++++
88
include/hw/ssi/npcm7xx_fiu.h | 73 ++++
89
include/hw/timer/npcm7xx_timer.h | 78 +++++
90
target/arm/kvm-consts.h | 7 -
91
target/arm/kvm_arm.h | 6 -
92
target/arm/neon-dp.decode | 18 +-
93
target/arm/neon-shared.decode | 18 +-
94
tests/decode/succ_ident1.decode | 7 +
95
hw/arm/mps2.c | 97 +++++-
96
hw/arm/npcm7xx.c | 532 +++++++++++++++++++++++++++++
97
hw/arm/npcm7xx_boards.c | 197 +++++++++++
98
hw/arm/xlnx-versal-virt.c | 2 +-
99
hw/mem/npcm7xx_mc.c | 84 +++++
100
hw/misc/a9scu.c | 59 ++--
101
hw/misc/npcm7xx_clk.c | 266 +++++++++++++++
102
hw/misc/npcm7xx_gcr.c | 269 +++++++++++++++
103
hw/nvram/npcm7xx_otp.c | 440 ++++++++++++++++++++++++
104
hw/ssi/npcm7xx_fiu.c | 572 +++++++++++++++++++++++++++++++
105
hw/timer/armv7m_systick.c | 8 +
106
hw/timer/npcm7xx_timer.c | 543 ++++++++++++++++++++++++++++++
107
target/arm/cpu.c | 101 +++---
108
target/arm/helper.c | 2 +-
109
target/arm/kvm.c | 7 -
110
target/arm/kvm32.c | 595 ---------------------------------
111
.gitmodules | 3 +
112
MAINTAINERS | 10 +
113
hw/arm/Kconfig | 9 +
114
hw/arm/meson.build | 1 +
115
hw/mem/meson.build | 1 +
116
hw/misc/meson.build | 4 +
117
hw/misc/trace-events | 8 +
118
hw/nvram/meson.build | 1 +
119
hw/ssi/meson.build | 1 +
120
hw/ssi/trace-events | 11 +
121
hw/timer/meson.build | 1 +
122
hw/timer/trace-events | 5 +
123
pc-bios/README | 6 +
124
pc-bios/meson.build | 1 +
125
pc-bios/npcm7xx_bootrom.bin | Bin 0 -> 768 bytes
126
roms/Makefile | 7 +
127
roms/vbootrom | 1 +
128
scripts/decodetree.py | 46 ++-
129
target/arm/meson.build | 5 +-
130
target/arm/translate-neon.c.inc | 42 ++-
131
tests/acceptance/boot_linux_console.py | 83 +++++
132
55 files changed, 3910 insertions(+), 783 deletions(-)
133
create mode 100644 docs/system/arm/nuvoton.rst
134
create mode 100644 include/hw/arm/npcm7xx.h
135
create mode 100644 include/hw/mem/npcm7xx_mc.h
136
create mode 100644 include/hw/misc/npcm7xx_clk.h
137
create mode 100644 include/hw/misc/npcm7xx_gcr.h
138
create mode 100644 include/hw/nvram/npcm7xx_otp.h
139
create mode 100644 include/hw/ssi/npcm7xx_fiu.h
140
create mode 100644 include/hw/timer/npcm7xx_timer.h
141
create mode 100644 tests/decode/succ_ident1.decode
142
create mode 100644 hw/arm/npcm7xx.c
143
create mode 100644 hw/arm/npcm7xx_boards.c
144
create mode 100644 hw/mem/npcm7xx_mc.c
145
create mode 100644 hw/misc/npcm7xx_clk.c
146
create mode 100644 hw/misc/npcm7xx_gcr.c
147
create mode 100644 hw/nvram/npcm7xx_otp.c
148
create mode 100644 hw/ssi/npcm7xx_fiu.c
149
create mode 100644 hw/timer/npcm7xx_timer.c
150
delete mode 100644 target/arm/kvm32.c
151
create mode 100644 pc-bios/npcm7xx_bootrom.bin
152
create mode 160000 roms/vbootrom
153
diff view generated by jsdifflib
Deleted patch
1
The A32_BANKED_REG_{GET,SET} macros are only used inside target/arm;
2
move their definitions to cpregs.h. There's no need to have them
3
defined in all the code that includes cpu.h.
4
1
5
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
7
---
8
target/arm/cpregs.h | 28 ++++++++++++++++++++++++++++
9
target/arm/cpu.h | 27 ---------------------------
10
2 files changed, 28 insertions(+), 27 deletions(-)
11
12
diff --git a/target/arm/cpregs.h b/target/arm/cpregs.h
13
index XXXXXXX..XXXXXXX 100644
14
--- a/target/arm/cpregs.h
15
+++ b/target/arm/cpregs.h
16
@@ -XXX,XX +XXX,XX @@ static inline bool arm_cpreg_traps_in_nv(const ARMCPRegInfo *ri)
17
return ri->opc1 == 4 || ri->opc1 == 5;
18
}
19
20
+/* Macros for accessing a specified CP register bank */
21
+#define A32_BANKED_REG_GET(_env, _regname, _secure) \
22
+ ((_secure) ? (_env)->cp15._regname##_s : (_env)->cp15._regname##_ns)
23
+
24
+#define A32_BANKED_REG_SET(_env, _regname, _secure, _val) \
25
+ do { \
26
+ if (_secure) { \
27
+ (_env)->cp15._regname##_s = (_val); \
28
+ } else { \
29
+ (_env)->cp15._regname##_ns = (_val); \
30
+ } \
31
+ } while (0)
32
+
33
+/*
34
+ * Macros for automatically accessing a specific CP register bank depending on
35
+ * the current secure state of the system. These macros are not intended for
36
+ * supporting instruction translation reads/writes as these are dependent
37
+ * solely on the SCR.NS bit and not the mode.
38
+ */
39
+#define A32_BANKED_CURRENT_REG_GET(_env, _regname) \
40
+ A32_BANKED_REG_GET((_env), _regname, \
41
+ (arm_is_secure(_env) && !arm_el_is_aa64((_env), 3)))
42
+
43
+#define A32_BANKED_CURRENT_REG_SET(_env, _regname, _val) \
44
+ A32_BANKED_REG_SET((_env), _regname, \
45
+ (arm_is_secure(_env) && !arm_el_is_aa64((_env), 3)), \
46
+ (_val))
47
+
48
#endif /* TARGET_ARM_CPREGS_H */
49
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
50
index XXXXXXX..XXXXXXX 100644
51
--- a/target/arm/cpu.h
52
+++ b/target/arm/cpu.h
53
@@ -XXX,XX +XXX,XX @@ static inline bool access_secure_reg(CPUARMState *env)
54
return ret;
55
}
56
57
-/* Macros for accessing a specified CP register bank */
58
-#define A32_BANKED_REG_GET(_env, _regname, _secure) \
59
- ((_secure) ? (_env)->cp15._regname##_s : (_env)->cp15._regname##_ns)
60
-
61
-#define A32_BANKED_REG_SET(_env, _regname, _secure, _val) \
62
- do { \
63
- if (_secure) { \
64
- (_env)->cp15._regname##_s = (_val); \
65
- } else { \
66
- (_env)->cp15._regname##_ns = (_val); \
67
- } \
68
- } while (0)
69
-
70
-/* Macros for automatically accessing a specific CP register bank depending on
71
- * the current secure state of the system. These macros are not intended for
72
- * supporting instruction translation reads/writes as these are dependent
73
- * solely on the SCR.NS bit and not the mode.
74
- */
75
-#define A32_BANKED_CURRENT_REG_GET(_env, _regname) \
76
- A32_BANKED_REG_GET((_env), _regname, \
77
- (arm_is_secure(_env) && !arm_el_is_aa64((_env), 3)))
78
-
79
-#define A32_BANKED_CURRENT_REG_SET(_env, _regname, _val) \
80
- A32_BANKED_REG_SET((_env), _regname, \
81
- (arm_is_secure(_env) && !arm_el_is_aa64((_env), 3)), \
82
- (_val))
83
-
84
uint32_t arm_phys_excp_target_el(CPUState *cs, uint32_t excp_idx,
85
uint32_t cur_el, bool secure);
86
87
--
88
2.43.0
diff view generated by jsdifflib
Deleted patch
1
We would like to move arm_el_is_aa64() to internals.h; however, it is
2
used by access_secure_reg(). Make that function not be inline, so
3
that it can stay in cpu.h.
4
1
5
access_secure_reg() is used only in two places:
6
* in hflags.c
7
* in the user-mode arm emulators, to decide whether to store
8
the TLS value in the secure or non-secure banked field
9
10
The second of these is not on a super-hot path that would care about
11
the inlining (and incidentally will always use the NS banked field
12
because our user-mode CPUs never set ARM_FEATURE_EL3); put the
13
definition of access_secure_reg() in hflags.c, near its only use
14
inside target/arm.
15
16
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
17
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
18
---
19
target/arm/cpu.h | 12 +++---------
20
target/arm/tcg/hflags.c | 9 +++++++++
21
2 files changed, 12 insertions(+), 9 deletions(-)
22
23
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
24
index XXXXXXX..XXXXXXX 100644
25
--- a/target/arm/cpu.h
26
+++ b/target/arm/cpu.h
27
@@ -XXX,XX +XXX,XX @@ static inline bool arm_el_is_aa64(CPUARMState *env, int el)
28
return aa64;
29
}
30
31
-/* Function for determining whether guest cp register reads and writes should
32
+/*
33
+ * Function for determining whether guest cp register reads and writes should
34
* access the secure or non-secure bank of a cp register. When EL3 is
35
* operating in AArch32 state, the NS-bit determines whether the secure
36
* instance of a cp register should be used. When EL3 is AArch64 (or if
37
* it doesn't exist at all) then there is no register banking, and all
38
* accesses are to the non-secure version.
39
*/
40
-static inline bool access_secure_reg(CPUARMState *env)
41
-{
42
- bool ret = (arm_feature(env, ARM_FEATURE_EL3) &&
43
- !arm_el_is_aa64(env, 3) &&
44
- !(env->cp15.scr_el3 & SCR_NS));
45
-
46
- return ret;
47
-}
48
+bool access_secure_reg(CPUARMState *env);
49
50
uint32_t arm_phys_excp_target_el(CPUState *cs, uint32_t excp_idx,
51
uint32_t cur_el, bool secure);
52
diff --git a/target/arm/tcg/hflags.c b/target/arm/tcg/hflags.c
53
index XXXXXXX..XXXXXXX 100644
54
--- a/target/arm/tcg/hflags.c
55
+++ b/target/arm/tcg/hflags.c
56
@@ -XXX,XX +XXX,XX @@ static bool aprofile_require_alignment(CPUARMState *env, int el, uint64_t sctlr)
57
#endif
58
}
59
60
+bool access_secure_reg(CPUARMState *env)
61
+{
62
+ bool ret = (arm_feature(env, ARM_FEATURE_EL3) &&
63
+ !arm_el_is_aa64(env, 3) &&
64
+ !(env->cp15.scr_el3 & SCR_NS));
65
+
66
+ return ret;
67
+}
68
+
69
static CPUARMTBFlags rebuild_hflags_common(CPUARMState *env, int fp_el,
70
ARMMMUIdx mmu_idx,
71
CPUARMTBFlags flags)
72
--
73
2.43.0
diff view generated by jsdifflib
Deleted patch
1
At the top of linux-user/aarch64/cpu_loop.c we define a set of
2
macros for reading and writing data and code words, but we never
3
use these macros. Delete them.
4
1
5
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
7
---
8
linux-user/aarch64/cpu_loop.c | 48 -----------------------------------
9
1 file changed, 48 deletions(-)
10
11
diff --git a/linux-user/aarch64/cpu_loop.c b/linux-user/aarch64/cpu_loop.c
12
index XXXXXXX..XXXXXXX 100644
13
--- a/linux-user/aarch64/cpu_loop.c
14
+++ b/linux-user/aarch64/cpu_loop.c
15
@@ -XXX,XX +XXX,XX @@
16
#include "target/arm/syndrome.h"
17
#include "target/arm/cpu-features.h"
18
19
-#define get_user_code_u32(x, gaddr, env) \
20
- ({ abi_long __r = get_user_u32((x), (gaddr)); \
21
- if (!__r && bswap_code(arm_sctlr_b(env))) { \
22
- (x) = bswap32(x); \
23
- } \
24
- __r; \
25
- })
26
-
27
-#define get_user_code_u16(x, gaddr, env) \
28
- ({ abi_long __r = get_user_u16((x), (gaddr)); \
29
- if (!__r && bswap_code(arm_sctlr_b(env))) { \
30
- (x) = bswap16(x); \
31
- } \
32
- __r; \
33
- })
34
-
35
-#define get_user_data_u32(x, gaddr, env) \
36
- ({ abi_long __r = get_user_u32((x), (gaddr)); \
37
- if (!__r && arm_cpu_bswap_data(env)) { \
38
- (x) = bswap32(x); \
39
- } \
40
- __r; \
41
- })
42
-
43
-#define get_user_data_u16(x, gaddr, env) \
44
- ({ abi_long __r = get_user_u16((x), (gaddr)); \
45
- if (!__r && arm_cpu_bswap_data(env)) { \
46
- (x) = bswap16(x); \
47
- } \
48
- __r; \
49
- })
50
-
51
-#define put_user_data_u32(x, gaddr, env) \
52
- ({ typeof(x) __x = (x); \
53
- if (arm_cpu_bswap_data(env)) { \
54
- __x = bswap32(__x); \
55
- } \
56
- put_user_u32(__x, (gaddr)); \
57
- })
58
-
59
-#define put_user_data_u16(x, gaddr, env) \
60
- ({ typeof(x) __x = (x); \
61
- if (arm_cpu_bswap_data(env)) { \
62
- __x = bswap16(__x); \
63
- } \
64
- put_user_u16(__x, (gaddr)); \
65
- })
66
-
67
/* AArch64 main loop */
68
void cpu_loop(CPUARMState *env)
69
{
70
--
71
2.43.0
diff view generated by jsdifflib
Deleted patch
1
In linux-user/arm/cpu_loop.c we define a full set of get/put
2
macros for both code and data (since the endianness handling
3
is different between the two). However the only one we actually
4
use is get_user_code_u32(). Remove the rest.
5
1
6
We leave a comment noting how data-side accesses should be handled
7
for big-endian, because that's a subtle point and we just removed the
8
macros that were effectively documenting it.
9
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
12
---
13
linux-user/arm/cpu_loop.c | 43 ++++-----------------------------------
14
1 file changed, 4 insertions(+), 39 deletions(-)
15
16
diff --git a/linux-user/arm/cpu_loop.c b/linux-user/arm/cpu_loop.c
17
index XXXXXXX..XXXXXXX 100644
18
--- a/linux-user/arm/cpu_loop.c
19
+++ b/linux-user/arm/cpu_loop.c
20
@@ -XXX,XX +XXX,XX @@
21
__r; \
22
})
23
24
-#define get_user_code_u16(x, gaddr, env) \
25
- ({ abi_long __r = get_user_u16((x), (gaddr)); \
26
- if (!__r && bswap_code(arm_sctlr_b(env))) { \
27
- (x) = bswap16(x); \
28
- } \
29
- __r; \
30
- })
31
-
32
-#define get_user_data_u32(x, gaddr, env) \
33
- ({ abi_long __r = get_user_u32((x), (gaddr)); \
34
- if (!__r && arm_cpu_bswap_data(env)) { \
35
- (x) = bswap32(x); \
36
- } \
37
- __r; \
38
- })
39
-
40
-#define get_user_data_u16(x, gaddr, env) \
41
- ({ abi_long __r = get_user_u16((x), (gaddr)); \
42
- if (!__r && arm_cpu_bswap_data(env)) { \
43
- (x) = bswap16(x); \
44
- } \
45
- __r; \
46
- })
47
-
48
-#define put_user_data_u32(x, gaddr, env) \
49
- ({ typeof(x) __x = (x); \
50
- if (arm_cpu_bswap_data(env)) { \
51
- __x = bswap32(__x); \
52
- } \
53
- put_user_u32(__x, (gaddr)); \
54
- })
55
-
56
-#define put_user_data_u16(x, gaddr, env) \
57
- ({ typeof(x) __x = (x); \
58
- if (arm_cpu_bswap_data(env)) { \
59
- __x = bswap16(__x); \
60
- } \
61
- put_user_u16(__x, (gaddr)); \
62
- })
63
+/*
64
+ * Note that if we need to do data accesses here, they should do a
65
+ * bswap if arm_cpu_bswap_data() returns true.
66
+ */
67
68
/*
69
* Similar to code in accel/tcg/user-exec.c, but outside the execution loop.
70
--
71
2.43.0
diff view generated by jsdifflib
Deleted patch
1
The arm_cpu_data_is_big_endian() and related functions are now used
2
only in target/arm; they can be moved to internals.h.
3
1
4
The motivation here is that we would like to move arm_current_el()
5
to internals.h.
6
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
9
---
10
target/arm/cpu.h | 48 ------------------------------------------
11
target/arm/internals.h | 48 ++++++++++++++++++++++++++++++++++++++++++
12
2 files changed, 48 insertions(+), 48 deletions(-)
13
14
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
15
index XXXXXXX..XXXXXXX 100644
16
--- a/target/arm/cpu.h
17
+++ b/target/arm/cpu.h
18
@@ -XXX,XX +XXX,XX @@ static inline bool arm_sctlr_b(CPUARMState *env)
19
20
uint64_t arm_sctlr(CPUARMState *env, int el);
21
22
-static inline bool arm_cpu_data_is_big_endian_a32(CPUARMState *env,
23
- bool sctlr_b)
24
-{
25
-#ifdef CONFIG_USER_ONLY
26
- /*
27
- * In system mode, BE32 is modelled in line with the
28
- * architecture (as word-invariant big-endianness), where loads
29
- * and stores are done little endian but from addresses which
30
- * are adjusted by XORing with the appropriate constant. So the
31
- * endianness to use for the raw data access is not affected by
32
- * SCTLR.B.
33
- * In user mode, however, we model BE32 as byte-invariant
34
- * big-endianness (because user-only code cannot tell the
35
- * difference), and so we need to use a data access endianness
36
- * that depends on SCTLR.B.
37
- */
38
- if (sctlr_b) {
39
- return true;
40
- }
41
-#endif
42
- /* In 32bit endianness is determined by looking at CPSR's E bit */
43
- return env->uncached_cpsr & CPSR_E;
44
-}
45
-
46
-static inline bool arm_cpu_data_is_big_endian_a64(int el, uint64_t sctlr)
47
-{
48
- return sctlr & (el ? SCTLR_EE : SCTLR_E0E);
49
-}
50
-
51
-/* Return true if the processor is in big-endian mode. */
52
-static inline bool arm_cpu_data_is_big_endian(CPUARMState *env)
53
-{
54
- if (!is_a64(env)) {
55
- return arm_cpu_data_is_big_endian_a32(env, arm_sctlr_b(env));
56
- } else {
57
- int cur_el = arm_current_el(env);
58
- uint64_t sctlr = arm_sctlr(env, cur_el);
59
- return arm_cpu_data_is_big_endian_a64(cur_el, sctlr);
60
- }
61
-}
62
-
63
#include "exec/cpu-all.h"
64
65
/*
66
@@ -XXX,XX +XXX,XX @@ static inline bool bswap_code(bool sctlr_b)
67
#endif
68
}
69
70
-#ifdef CONFIG_USER_ONLY
71
-static inline bool arm_cpu_bswap_data(CPUARMState *env)
72
-{
73
- return TARGET_BIG_ENDIAN ^ arm_cpu_data_is_big_endian(env);
74
-}
75
-#endif
76
-
77
void cpu_get_tb_cpu_state(CPUARMState *env, vaddr *pc,
78
uint64_t *cs_base, uint32_t *flags);
79
80
diff --git a/target/arm/internals.h b/target/arm/internals.h
81
index XXXXXXX..XXXXXXX 100644
82
--- a/target/arm/internals.h
83
+++ b/target/arm/internals.h
84
@@ -XXX,XX +XXX,XX @@ static inline FloatRoundMode arm_rmode_to_sf(ARMFPRounding rmode)
85
return arm_rmode_to_sf_map[rmode];
86
}
87
88
+static inline bool arm_cpu_data_is_big_endian_a32(CPUARMState *env,
89
+ bool sctlr_b)
90
+{
91
+#ifdef CONFIG_USER_ONLY
92
+ /*
93
+ * In system mode, BE32 is modelled in line with the
94
+ * architecture (as word-invariant big-endianness), where loads
95
+ * and stores are done little endian but from addresses which
96
+ * are adjusted by XORing with the appropriate constant. So the
97
+ * endianness to use for the raw data access is not affected by
98
+ * SCTLR.B.
99
+ * In user mode, however, we model BE32 as byte-invariant
100
+ * big-endianness (because user-only code cannot tell the
101
+ * difference), and so we need to use a data access endianness
102
+ * that depends on SCTLR.B.
103
+ */
104
+ if (sctlr_b) {
105
+ return true;
106
+ }
107
+#endif
108
+ /* In 32bit endianness is determined by looking at CPSR's E bit */
109
+ return env->uncached_cpsr & CPSR_E;
110
+}
111
+
112
+static inline bool arm_cpu_data_is_big_endian_a64(int el, uint64_t sctlr)
113
+{
114
+ return sctlr & (el ? SCTLR_EE : SCTLR_E0E);
115
+}
116
+
117
+/* Return true if the processor is in big-endian mode. */
118
+static inline bool arm_cpu_data_is_big_endian(CPUARMState *env)
119
+{
120
+ if (!is_a64(env)) {
121
+ return arm_cpu_data_is_big_endian_a32(env, arm_sctlr_b(env));
122
+ } else {
123
+ int cur_el = arm_current_el(env);
124
+ uint64_t sctlr = arm_sctlr(env, cur_el);
125
+ return arm_cpu_data_is_big_endian_a64(cur_el, sctlr);
126
+ }
127
+}
128
+
129
+#ifdef CONFIG_USER_ONLY
130
+static inline bool arm_cpu_bswap_data(CPUARMState *env)
131
+{
132
+ return TARGET_BIG_ENDIAN ^ arm_cpu_data_is_big_endian(env);
133
+}
134
+#endif
135
+
136
static inline void aarch64_save_sp(CPUARMState *env, int el)
137
{
138
if (env->pstate & PSTATE_SP) {
139
--
140
2.43.0
diff view generated by jsdifflib
Deleted patch
1
The functions arm_current_el() and arm_el_is_aa64() are used only in
2
target/arm and in hw/intc/arm_gicv3_cpuif.c. They're functions that
3
query internal state of the CPU. Move them out of cpu.h and into
4
internals.h.
5
1
6
This means we need to include internals.h in arm_gicv3_cpuif.c, but
7
this is justifiable because that file is implementing the GICv3 CPU
8
interface, which really is part of the CPU proper; we just ended up
9
implementing it in code in hw/intc/ for historical reasons.
10
11
The motivation for this move is that we'd like to change
12
arm_el_is_aa64() to add a condition that uses cpu_isar_feature();
13
but we don't want to include cpu-features.h in cpu.h.
14
15
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
16
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
17
---
18
target/arm/cpu.h | 66 --------------------------------------
19
target/arm/internals.h | 67 +++++++++++++++++++++++++++++++++++++++
20
hw/intc/arm_gicv3_cpuif.c | 1 +
21
target/arm/arch_dump.c | 1 +
22
4 files changed, 69 insertions(+), 66 deletions(-)
23
24
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
25
index XXXXXXX..XXXXXXX 100644
26
--- a/target/arm/cpu.h
27
+++ b/target/arm/cpu.h
28
@@ -XXX,XX +XXX,XX @@ uint64_t arm_hcr_el2_eff_secstate(CPUARMState *env, ARMSecuritySpace space);
29
uint64_t arm_hcr_el2_eff(CPUARMState *env);
30
uint64_t arm_hcrx_el2_eff(CPUARMState *env);
31
32
-/* Return true if the specified exception level is running in AArch64 state. */
33
-static inline bool arm_el_is_aa64(CPUARMState *env, int el)
34
-{
35
- /* This isn't valid for EL0 (if we're in EL0, is_a64() is what you want,
36
- * and if we're not in EL0 then the state of EL0 isn't well defined.)
37
- */
38
- assert(el >= 1 && el <= 3);
39
- bool aa64 = arm_feature(env, ARM_FEATURE_AARCH64);
40
-
41
- /* The highest exception level is always at the maximum supported
42
- * register width, and then lower levels have a register width controlled
43
- * by bits in the SCR or HCR registers.
44
- */
45
- if (el == 3) {
46
- return aa64;
47
- }
48
-
49
- if (arm_feature(env, ARM_FEATURE_EL3) &&
50
- ((env->cp15.scr_el3 & SCR_NS) || !(env->cp15.scr_el3 & SCR_EEL2))) {
51
- aa64 = aa64 && (env->cp15.scr_el3 & SCR_RW);
52
- }
53
-
54
- if (el == 2) {
55
- return aa64;
56
- }
57
-
58
- if (arm_is_el2_enabled(env)) {
59
- aa64 = aa64 && (env->cp15.hcr_el2 & HCR_RW);
60
- }
61
-
62
- return aa64;
63
-}
64
-
65
/*
66
* Function for determining whether guest cp register reads and writes should
67
* access the secure or non-secure bank of a cp register. When EL3 is
68
@@ -XXX,XX +XXX,XX @@ static inline bool arm_v7m_is_handler_mode(CPUARMState *env)
69
return env->v7m.exception != 0;
70
}
71
72
-/* Return the current Exception Level (as per ARMv8; note that this differs
73
- * from the ARMv7 Privilege Level).
74
- */
75
-static inline int arm_current_el(CPUARMState *env)
76
-{
77
- if (arm_feature(env, ARM_FEATURE_M)) {
78
- return arm_v7m_is_handler_mode(env) ||
79
- !(env->v7m.control[env->v7m.secure] & 1);
80
- }
81
-
82
- if (is_a64(env)) {
83
- return extract32(env->pstate, 2, 2);
84
- }
85
-
86
- switch (env->uncached_cpsr & 0x1f) {
87
- case ARM_CPU_MODE_USR:
88
- return 0;
89
- case ARM_CPU_MODE_HYP:
90
- return 2;
91
- case ARM_CPU_MODE_MON:
92
- return 3;
93
- default:
94
- if (arm_is_secure(env) && !arm_el_is_aa64(env, 3)) {
95
- /* If EL3 is 32-bit then all secure privileged modes run in
96
- * EL3
97
- */
98
- return 3;
99
- }
100
-
101
- return 1;
102
- }
103
-}
104
-
105
/**
106
* write_list_to_cpustate
107
* @cpu: ARMCPU
108
diff --git a/target/arm/internals.h b/target/arm/internals.h
109
index XXXXXXX..XXXXXXX 100644
110
--- a/target/arm/internals.h
111
+++ b/target/arm/internals.h
112
@@ -XXX,XX +XXX,XX @@ static inline FloatRoundMode arm_rmode_to_sf(ARMFPRounding rmode)
113
return arm_rmode_to_sf_map[rmode];
114
}
115
116
+/* Return true if the specified exception level is running in AArch64 state. */
117
+static inline bool arm_el_is_aa64(CPUARMState *env, int el)
118
+{
119
+ /*
120
+ * This isn't valid for EL0 (if we're in EL0, is_a64() is what you want,
121
+ * and if we're not in EL0 then the state of EL0 isn't well defined.)
122
+ */
123
+ assert(el >= 1 && el <= 3);
124
+ bool aa64 = arm_feature(env, ARM_FEATURE_AARCH64);
125
+
126
+ /*
127
+ * The highest exception level is always at the maximum supported
128
+ * register width, and then lower levels have a register width controlled
129
+ * by bits in the SCR or HCR registers.
130
+ */
131
+ if (el == 3) {
132
+ return aa64;
133
+ }
134
+
135
+ if (arm_feature(env, ARM_FEATURE_EL3) &&
136
+ ((env->cp15.scr_el3 & SCR_NS) || !(env->cp15.scr_el3 & SCR_EEL2))) {
137
+ aa64 = aa64 && (env->cp15.scr_el3 & SCR_RW);
138
+ }
139
+
140
+ if (el == 2) {
141
+ return aa64;
142
+ }
143
+
144
+ if (arm_is_el2_enabled(env)) {
145
+ aa64 = aa64 && (env->cp15.hcr_el2 & HCR_RW);
146
+ }
147
+
148
+ return aa64;
149
+}
150
+
151
+/*
152
+ * Return the current Exception Level (as per ARMv8; note that this differs
153
+ * from the ARMv7 Privilege Level).
154
+ */
155
+static inline int arm_current_el(CPUARMState *env)
156
+{
157
+ if (arm_feature(env, ARM_FEATURE_M)) {
158
+ return arm_v7m_is_handler_mode(env) ||
159
+ !(env->v7m.control[env->v7m.secure] & 1);
160
+ }
161
+
162
+ if (is_a64(env)) {
163
+ return extract32(env->pstate, 2, 2);
164
+ }
165
+
166
+ switch (env->uncached_cpsr & 0x1f) {
167
+ case ARM_CPU_MODE_USR:
168
+ return 0;
169
+ case ARM_CPU_MODE_HYP:
170
+ return 2;
171
+ case ARM_CPU_MODE_MON:
172
+ return 3;
173
+ default:
174
+ if (arm_is_secure(env) && !arm_el_is_aa64(env, 3)) {
175
+ /* If EL3 is 32-bit then all secure privileged modes run in EL3 */
176
+ return 3;
177
+ }
178
+
179
+ return 1;
180
+ }
181
+}
182
+
183
static inline bool arm_cpu_data_is_big_endian_a32(CPUARMState *env,
184
bool sctlr_b)
185
{
186
diff --git a/hw/intc/arm_gicv3_cpuif.c b/hw/intc/arm_gicv3_cpuif.c
187
index XXXXXXX..XXXXXXX 100644
188
--- a/hw/intc/arm_gicv3_cpuif.c
189
+++ b/hw/intc/arm_gicv3_cpuif.c
190
@@ -XXX,XX +XXX,XX @@
191
#include "cpu.h"
192
#include "target/arm/cpregs.h"
193
#include "target/arm/cpu-features.h"
194
+#include "target/arm/internals.h"
195
#include "system/tcg.h"
196
#include "system/qtest.h"
197
198
diff --git a/target/arm/arch_dump.c b/target/arm/arch_dump.c
199
index XXXXXXX..XXXXXXX 100644
200
--- a/target/arm/arch_dump.c
201
+++ b/target/arm/arch_dump.c
202
@@ -XXX,XX +XXX,XX @@
203
#include "elf.h"
204
#include "system/dump.h"
205
#include "cpu-features.h"
206
+#include "internals.h"
207
208
/* struct user_pt_regs from arch/arm64/include/uapi/asm/ptrace.h */
209
struct aarch64_user_regs {
210
--
211
2.43.0
diff view generated by jsdifflib
Deleted patch
1
The definition of SCR_EL3.RW says that its effective value is 1 if:
2
- EL2 is implemented and does not support AArch32, and SCR_EL3.NS is 1
3
- the effective value of SCR_EL3.{EEL2,NS} is {1,0} (i.e. we are
4
Secure and Secure EL2 is disabled)
5
1
6
We implement the second of these in arm_el_is_aa64(), but forgot the
7
first.
8
9
Provide a new function arm_scr_rw_eff() to return the effective
10
value of SCR_EL3.RW, and use it in arm_el_is_aa64() and the other
11
places that currently look directly at the bit value.
12
13
(scr_write() enforces that the RW bit is RAO/WI if neither EL1 nor
14
EL2 have AArch32 support, but if EL1 does but EL2 does not then the
15
bit must still be writeable.)
16
17
This will mean that if code at EL3 attempts to perform an exception
18
return to AArch32 EL2 when EL2 is AArch64-only we will correctly
19
handle this as an illegal exception return: it will be caught by the
20
"return to an EL which is configured for a different register width"
21
check in HELPER(exception_return).
22
23
We do already have some CPU types which don't implement AArch32
24
above EL0, so this is technically a bug; it doesn't seem worth
25
backporting to stable because no sensible guest code will be
26
deliberately attempting to set the RW bit to a value corresponding
27
to an unimplemented execution state and then checking that we
28
did the right thing.
29
30
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
31
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
32
---
33
target/arm/internals.h | 26 +++++++++++++++++++++++---
34
target/arm/helper.c | 4 ++--
35
2 files changed, 25 insertions(+), 5 deletions(-)
36
37
diff --git a/target/arm/internals.h b/target/arm/internals.h
38
index XXXXXXX..XXXXXXX 100644
39
--- a/target/arm/internals.h
40
+++ b/target/arm/internals.h
41
@@ -XXX,XX +XXX,XX @@ static inline FloatRoundMode arm_rmode_to_sf(ARMFPRounding rmode)
42
return arm_rmode_to_sf_map[rmode];
43
}
44
45
+/* Return the effective value of SCR_EL3.RW */
46
+static inline bool arm_scr_rw_eff(CPUARMState *env)
47
+{
48
+ /*
49
+ * SCR_EL3.RW has an effective value of 1 if:
50
+ * - we are NS and EL2 is implemented but doesn't support AArch32
51
+ * - we are S and EL2 is enabled (in which case it must be AArch64)
52
+ */
53
+ ARMCPU *cpu = env_archcpu(env);
54
+
55
+ if (env->cp15.scr_el3 & SCR_RW) {
56
+ return true;
57
+ }
58
+ if (env->cp15.scr_el3 & SCR_NS) {
59
+ return arm_feature(env, ARM_FEATURE_EL2) &&
60
+ !cpu_isar_feature(aa64_aa32_el2, cpu);
61
+ } else {
62
+ return env->cp15.scr_el3 & SCR_EEL2;
63
+ }
64
+}
65
+
66
/* Return true if the specified exception level is running in AArch64 state. */
67
static inline bool arm_el_is_aa64(CPUARMState *env, int el)
68
{
69
@@ -XXX,XX +XXX,XX @@ static inline bool arm_el_is_aa64(CPUARMState *env, int el)
70
return aa64;
71
}
72
73
- if (arm_feature(env, ARM_FEATURE_EL3) &&
74
- ((env->cp15.scr_el3 & SCR_NS) || !(env->cp15.scr_el3 & SCR_EEL2))) {
75
- aa64 = aa64 && (env->cp15.scr_el3 & SCR_RW);
76
+ if (arm_feature(env, ARM_FEATURE_EL3)) {
77
+ aa64 = aa64 && arm_scr_rw_eff(env);
78
}
79
80
if (el == 2) {
81
diff --git a/target/arm/helper.c b/target/arm/helper.c
82
index XXXXXXX..XXXXXXX 100644
83
--- a/target/arm/helper.c
84
+++ b/target/arm/helper.c
85
@@ -XXX,XX +XXX,XX @@ uint32_t arm_phys_excp_target_el(CPUState *cs, uint32_t excp_idx,
86
uint64_t hcr_el2;
87
88
if (arm_feature(env, ARM_FEATURE_EL3)) {
89
- rw = ((env->cp15.scr_el3 & SCR_RW) == SCR_RW);
90
+ rw = arm_scr_rw_eff(env);
91
} else {
92
/*
93
* Either EL2 is the highest EL (and so the EL2 register width
94
@@ -XXX,XX +XXX,XX @@ static void arm_cpu_do_interrupt_aarch64(CPUState *cs)
95
96
switch (new_el) {
97
case 3:
98
- is_aa64 = (env->cp15.scr_el3 & SCR_RW) != 0;
99
+ is_aa64 = arm_scr_rw_eff(env);
100
break;
101
case 2:
102
hcr = arm_hcr_el2_eff(env);
103
--
104
2.43.0
diff view generated by jsdifflib
Deleted patch
1
When EL1 doesn't support AArch32, the HCR_EL2.RW bit is supposed to
2
be RAO/WI. Enforce the RAO/WI behaviour.
3
1
4
Note that we handle "reset value should honour RES1 bits" in the same
5
way that SCR_EL3 does, via a reset function.
6
7
We do already have some CPU types which don't implement AArch32
8
above EL0, so this is technically a bug; it doesn't seem worth
9
backporting to stable because no sensible guest code will be
10
deliberately attempting to set the RW bit to a value corresponding
11
to an unimplemented execution state and then checking that we
12
did the right thing.
13
14
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
15
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
16
---
17
target/arm/helper.c | 12 ++++++++++++
18
1 file changed, 12 insertions(+)
19
20
diff --git a/target/arm/helper.c b/target/arm/helper.c
21
index XXXXXXX..XXXXXXX 100644
22
--- a/target/arm/helper.c
23
+++ b/target/arm/helper.c
24
@@ -XXX,XX +XXX,XX @@ static void do_hcr_write(CPUARMState *env, uint64_t value, uint64_t valid_mask)
25
/* Clear RES0 bits. */
26
value &= valid_mask;
27
28
+ /* RW is RAO/WI if EL1 is AArch64 only */
29
+ if (!cpu_isar_feature(aa64_aa32_el1, cpu)) {
30
+ value |= HCR_RW;
31
+ }
32
+
33
/*
34
* These bits change the MMU setup:
35
* HCR_VM enables stage 2 translation
36
@@ -XXX,XX +XXX,XX @@ static void hcr_writelow(CPUARMState *env, const ARMCPRegInfo *ri,
37
do_hcr_write(env, value, MAKE_64BIT_MASK(32, 32));
38
}
39
40
+static void hcr_reset(CPUARMState *env, const ARMCPRegInfo *ri)
41
+{
42
+ /* hcr_write will set the RES1 bits on an AArch64-only CPU */
43
+ hcr_write(env, ri, 0);
44
+}
45
+
46
/*
47
* Return the effective value of HCR_EL2, at the given security state.
48
* Bits that are not included here:
49
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo el2_cp_reginfo[] = {
50
.opc0 = 3, .opc1 = 4, .crn = 1, .crm = 1, .opc2 = 0,
51
.access = PL2_RW, .fieldoffset = offsetof(CPUARMState, cp15.hcr_el2),
52
.nv2_redirect_offset = 0x78,
53
+ .resetfn = hcr_reset,
54
.writefn = hcr_write, .raw_writefn = raw_write },
55
{ .name = "HCR", .state = ARM_CP_STATE_AA32,
56
.type = ARM_CP_ALIAS | ARM_CP_IO,
57
--
58
2.43.0
diff view generated by jsdifflib
Deleted patch
1
We already call env_archcpu() multiple times within the
2
exception_return helper function, and we're about to want to
3
add another use of the ARMCPU pointer. Add a local variable
4
cpu so we can call env_archcpu() just once.
5
1
6
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
8
---
9
target/arm/tcg/helper-a64.c | 7 ++++---
10
1 file changed, 4 insertions(+), 3 deletions(-)
11
12
diff --git a/target/arm/tcg/helper-a64.c b/target/arm/tcg/helper-a64.c
13
index XXXXXXX..XXXXXXX 100644
14
--- a/target/arm/tcg/helper-a64.c
15
+++ b/target/arm/tcg/helper-a64.c
16
@@ -XXX,XX +XXX,XX @@ static void cpsr_write_from_spsr_elx(CPUARMState *env,
17
18
void HELPER(exception_return)(CPUARMState *env, uint64_t new_pc)
19
{
20
+ ARMCPU *cpu = env_archcpu(env);
21
int cur_el = arm_current_el(env);
22
unsigned int spsr_idx = aarch64_banked_spsr_index(cur_el);
23
uint32_t spsr = env->banked_spsr[spsr_idx];
24
@@ -XXX,XX +XXX,XX @@ void HELPER(exception_return)(CPUARMState *env, uint64_t new_pc)
25
}
26
27
bql_lock();
28
- arm_call_pre_el_change_hook(env_archcpu(env));
29
+ arm_call_pre_el_change_hook(cpu);
30
bql_unlock();
31
32
if (!return_to_aa64) {
33
@@ -XXX,XX +XXX,XX @@ void HELPER(exception_return)(CPUARMState *env, uint64_t new_pc)
34
int tbii;
35
36
env->aarch64 = true;
37
- spsr &= aarch64_pstate_valid_mask(&env_archcpu(env)->isar);
38
+ spsr &= aarch64_pstate_valid_mask(&cpu->isar);
39
pstate_write(env, spsr);
40
if (!arm_singlestep_active(env)) {
41
env->pstate &= ~PSTATE_SS;
42
@@ -XXX,XX +XXX,XX @@ void HELPER(exception_return)(CPUARMState *env, uint64_t new_pc)
43
aarch64_sve_change_el(env, cur_el, new_el, return_to_aa64);
44
45
bql_lock();
46
- arm_call_el_change_hook(env_archcpu(env));
47
+ arm_call_el_change_hook(cpu);
48
bql_unlock();
49
50
return;
51
--
52
2.43.0
diff view generated by jsdifflib
Deleted patch
1
In the Arm ARM, rule R_TYTWB states that returning to AArch32
2
is an illegal exception return if:
3
* AArch32 is not supported at any exception level
4
* the target EL is configured for AArch64 via SCR_EL3.RW
5
or HCR_EL2.RW or via CPU state at reset
6
1
7
We check the second of these, but not the first (which can only be
8
relevant for the case of a return to EL0, because if AArch32 is not
9
supported at one of the higher ELs then the RW bits will have an
10
effective value of 1 and the the "configured for AArch64" condition
11
will hold also).
12
13
Add the missing condition. Although this is technically a bug
14
(because we have one AArch64-only CPU: a64fx) it isn't worth
15
backporting to stable because no sensible guest code will
16
deliberately try to return to a nonexistent execution state
17
to check that it gets an illegal exception return.
18
19
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
20
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
21
---
22
target/arm/tcg/helper-a64.c | 5 +++++
23
1 file changed, 5 insertions(+)
24
25
diff --git a/target/arm/tcg/helper-a64.c b/target/arm/tcg/helper-a64.c
26
index XXXXXXX..XXXXXXX 100644
27
--- a/target/arm/tcg/helper-a64.c
28
+++ b/target/arm/tcg/helper-a64.c
29
@@ -XXX,XX +XXX,XX @@ void HELPER(exception_return)(CPUARMState *env, uint64_t new_pc)
30
goto illegal_return;
31
}
32
33
+ if (!return_to_aa64 && !cpu_isar_feature(aa64_aa32, cpu)) {
34
+ /* Return to AArch32 when CPU is AArch64-only */
35
+ goto illegal_return;
36
+ }
37
+
38
if (new_el == 1 && (arm_hcr_el2_eff(env) & HCR_TGE)) {
39
goto illegal_return;
40
}
41
--
42
2.43.0
diff view generated by jsdifflib
Deleted patch
1
I'm down as the only listed maintainer for quite a lot of Arm SoC and
2
board types. In some cases this is only as the "maintainer of last
3
resort" and I'm not in practice doing anything beyond patch review
4
and the odd bit of tidyup.
5
1
6
Move these entries in MAINTAINERS from "Maintained" to "Odd Fixes",
7
to better represent reality. Entries for other boards and SoCs where
8
I do more actively care (or where there is a listed co-maintainer)
9
remain as they are.
10
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
13
Message-id: 20250307152838.3226398-1-peter.maydell@linaro.org
14
---
15
MAINTAINERS | 14 +++++++-------
16
1 file changed, 7 insertions(+), 7 deletions(-)
17
18
diff --git a/MAINTAINERS b/MAINTAINERS
19
index XXXXXXX..XXXXXXX 100644
20
--- a/MAINTAINERS
21
+++ b/MAINTAINERS
22
@@ -XXX,XX +XXX,XX @@ F: docs/system/arm/kzm.rst
23
Integrator CP
24
M: Peter Maydell <peter.maydell@linaro.org>
25
L: qemu-arm@nongnu.org
26
-S: Maintained
27
+S: Odd Fixes
28
F: hw/arm/integratorcp.c
29
F: hw/misc/arm_integrator_debug.c
30
F: include/hw/misc/arm_integrator_debug.h
31
@@ -XXX,XX +XXX,XX @@ F: docs/system/arm/mps2.rst
32
Musca
33
M: Peter Maydell <peter.maydell@linaro.org>
34
L: qemu-arm@nongnu.org
35
-S: Maintained
36
+S: Odd Fixes
37
F: hw/arm/musca.c
38
F: docs/system/arm/musca.rst
39
40
@@ -XXX,XX +XXX,XX @@ F: tests/functional/test_aarch64_raspi4.py
41
Real View
42
M: Peter Maydell <peter.maydell@linaro.org>
43
L: qemu-arm@nongnu.org
44
-S: Maintained
45
+S: Odd Fixes
46
F: hw/arm/realview*
47
F: hw/cpu/realview_mpcore.c
48
F: hw/intc/realview_gic.c
49
@@ -XXX,XX +XXX,XX @@ F: tests/functional/test_arm_collie.py
50
Stellaris
51
M: Peter Maydell <peter.maydell@linaro.org>
52
L: qemu-arm@nongnu.org
53
-S: Maintained
54
+S: Odd Fixes
55
F: hw/*/stellaris*
56
F: hw/display/ssd03*
57
F: include/hw/input/gamepad.h
58
@@ -XXX,XX +XXX,XX @@ F: docs/system/arm/stm32.rst
59
Versatile Express
60
M: Peter Maydell <peter.maydell@linaro.org>
61
L: qemu-arm@nongnu.org
62
-S: Maintained
63
+S: Odd Fixes
64
F: hw/arm/vexpress.c
65
F: hw/display/sii9022.c
66
F: docs/system/arm/vexpress.rst
67
@@ -XXX,XX +XXX,XX @@ F: tests/functional/test_arm_vexpress.py
68
Versatile PB
69
M: Peter Maydell <peter.maydell@linaro.org>
70
L: qemu-arm@nongnu.org
71
-S: Maintained
72
+S: Odd Fixes
73
F: hw/*/versatile*
74
F: hw/i2c/arm_sbcon_i2c.c
75
F: include/hw/i2c/arm_sbcon_i2c.h
76
@@ -XXX,XX +XXX,XX @@ F: include/hw/hyperv/vmbus*.h
77
OMAP
78
M: Peter Maydell <peter.maydell@linaro.org>
79
L: qemu-arm@nongnu.org
80
-S: Maintained
81
+S: Odd Fixes
82
F: hw/*/omap*
83
F: include/hw/arm/omap.h
84
F: docs/system/arm/sx1.rst
85
--
86
2.43.0
87
88
diff view generated by jsdifflib
Deleted patch
1
From: Paolo Bonzini <pbonzini@redhat.com>
2
1
3
The guest does not control whether characters are sent on the UART.
4
Sending them before the guest happens to boot will now result in a
5
"guest error" log entry that is only because of timing, even if the
6
guest _would_ later setup the receiver correctly.
7
8
This reverts the bulk of commit abf2b6a028670bd2890bb3aee7e103fe53e4b0df,
9
and instead adds a comment about why we don't check the enable bits.
10
11
Cc: Philippe Mathieu-Daudé <philmd@linaro.org>
12
Cc: Peter Maydell <peter.maydell@linaro.org>
13
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
14
Message-id: 20250311153717.206129-1-pbonzini@redhat.com
15
[PMM: expanded comment]
16
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
17
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
18
---
19
hw/char/pl011.c | 19 ++++++++++---------
20
1 file changed, 10 insertions(+), 9 deletions(-)
21
22
diff --git a/hw/char/pl011.c b/hw/char/pl011.c
23
index XXXXXXX..XXXXXXX 100644
24
--- a/hw/char/pl011.c
25
+++ b/hw/char/pl011.c
26
@@ -XXX,XX +XXX,XX @@ static int pl011_can_receive(void *opaque)
27
unsigned fifo_depth = pl011_get_fifo_depth(s);
28
unsigned fifo_available = fifo_depth - s->read_count;
29
30
- if (!(s->cr & CR_UARTEN)) {
31
- qemu_log_mask(LOG_GUEST_ERROR,
32
- "PL011 receiving data on disabled UART\n");
33
- }
34
- if (!(s->cr & CR_RXE)) {
35
- qemu_log_mask(LOG_GUEST_ERROR,
36
- "PL011 receiving data on disabled RX UART\n");
37
- }
38
- trace_pl011_can_receive(s->lcr, s->read_count, fifo_depth, fifo_available);
39
+ /*
40
+ * In theory we should check the UART and RX enable bits here and
41
+ * return 0 if they are not set (so the guest can't receive data
42
+ * until you have enabled the UART). In practice we suspect there
43
+ * is at least some guest code out there which has been tested only
44
+ * on QEMU and which never bothers to enable the UART because we
45
+ * historically never enforced that. So we effectively keep the
46
+ * UART continuously enabled regardless of the enable bits.
47
+ */
48
49
+ trace_pl011_can_receive(s->lcr, s->read_count, fifo_depth, fifo_available);
50
return fifo_available;
51
}
52
53
--
54
2.43.0
55
56
diff view generated by jsdifflib
Deleted patch
1
From: Joe Komlodi <komlodi@google.com>
2
1
3
On ARM hosts with CTR_EL0.DIC and CTR_EL0.IDC set, this would only cause
4
an ISB to be executed during cache maintenance, which could lead to QEMU
5
executing TBs containing garbage instructions.
6
7
This seems to be because the ISB finishes executing instructions and
8
flushes the pipeline, but the ISB doesn't guarantee that writes from the
9
executed instructions are committed. If a small enough TB is created, it's
10
possible that the writes setting up the TB aren't committed by the time the
11
TB is executed.
12
13
This function is intended to be a port of the gcc implementation
14
(https://github.com/gcc-mirror/gcc/blob/85b46d0795ac76bc192cb8f88b646a647acf98c1/libgcc/config/aarch64/sync-cache.c#L67)
15
which makes the first DSB unconditional, so we can fix the synchronization
16
issue by doing that as well.
17
18
Cc: qemu-stable@nongnu.org
19
Fixes: 664a79735e4deb1 ("util: Specialize flush_idcache_range for aarch64")
20
Signed-off-by: Joe Komlodi <komlodi@google.com>
21
Message-id: 20250310203622.1827940-2-komlodi@google.com
22
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
23
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
24
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
25
---
26
util/cacheflush.c | 4 +++-
27
1 file changed, 3 insertions(+), 1 deletion(-)
28
29
diff --git a/util/cacheflush.c b/util/cacheflush.c
30
index XXXXXXX..XXXXXXX 100644
31
--- a/util/cacheflush.c
32
+++ b/util/cacheflush.c
33
@@ -XXX,XX +XXX,XX @@ void flush_idcache_range(uintptr_t rx, uintptr_t rw, size_t len)
34
for (p = rw & -dcache_lsize; p < rw + len; p += dcache_lsize) {
35
asm volatile("dc\tcvau, %0" : : "r" (p) : "memory");
36
}
37
- asm volatile("dsb\tish" : : : "memory");
38
}
39
40
+ /* DSB unconditionally to ensure any outstanding writes are committed. */
41
+ asm volatile("dsb\tish" : : : "memory");
42
+
43
/*
44
* If CTR_EL0.DIC is enabled, Instruction cache cleaning to the Point
45
* of Unification is not required for instruction to data coherence.
46
--
47
2.43.0
diff view generated by jsdifflib
Deleted patch
1
From: Richard Henderson <richard.henderson@linaro.org>
2
1
3
The check for fp_excp_el in assert_fp_access_checked is
4
incorrect. For SME, with StreamingMode enabled, the access
5
is really against the streaming mode vectors, and access
6
to the normal fp registers is allowed to be disabled.
7
C.f. sme_enabled_check.
8
9
Convert sve_access_checked to match, even though we don't
10
currently check the exception state.
11
12
Cc: qemu-stable@nongnu.org
13
Fixes: 3d74825f4d6 ("target/arm: Add SME enablement checks")
14
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
15
Message-id: 20250307190415.982049-2-richard.henderson@linaro.org
16
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
17
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
18
---
19
target/arm/tcg/translate-a64.h | 2 +-
20
target/arm/tcg/translate.h | 10 +++++++---
21
target/arm/tcg/translate-a64.c | 17 +++++++++--------
22
3 files changed, 17 insertions(+), 12 deletions(-)
23
24
diff --git a/target/arm/tcg/translate-a64.h b/target/arm/tcg/translate-a64.h
25
index XXXXXXX..XXXXXXX 100644
26
--- a/target/arm/tcg/translate-a64.h
27
+++ b/target/arm/tcg/translate-a64.h
28
@@ -XXX,XX +XXX,XX @@ TCGv_i64 gen_mte_checkN(DisasContext *s, TCGv_i64 addr, bool is_write,
29
static inline void assert_fp_access_checked(DisasContext *s)
30
{
31
#ifdef CONFIG_DEBUG_TCG
32
- if (unlikely(!s->fp_access_checked || s->fp_excp_el)) {
33
+ if (unlikely(s->fp_access_checked <= 0)) {
34
fprintf(stderr, "target-arm: FP access check missing for "
35
"instruction 0x%08x\n", s->insn);
36
abort();
37
diff --git a/target/arm/tcg/translate.h b/target/arm/tcg/translate.h
38
index XXXXXXX..XXXXXXX 100644
39
--- a/target/arm/tcg/translate.h
40
+++ b/target/arm/tcg/translate.h
41
@@ -XXX,XX +XXX,XX @@ typedef struct DisasContext {
42
bool aarch64;
43
bool thumb;
44
bool lse2;
45
- /* Because unallocated encodings generate different exception syndrome
46
+ /*
47
+ * Because unallocated encodings generate different exception syndrome
48
* information from traps due to FP being disabled, we can't do a single
49
* "is fp access disabled" check at a high level in the decode tree.
50
* To help in catching bugs where the access check was forgotten in some
51
* code path, we set this flag when the access check is done, and assert
52
* that it is set at the point where we actually touch the FP regs.
53
+ * 0: not checked,
54
+ * 1: checked, access ok
55
+ * -1: checked, access denied
56
*/
57
- bool fp_access_checked;
58
- bool sve_access_checked;
59
+ int8_t fp_access_checked;
60
+ int8_t sve_access_checked;
61
/* ARMv8 single-step state (this is distinct from the QEMU gdbstub
62
* single-step support).
63
*/
64
diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c
65
index XXXXXXX..XXXXXXX 100644
66
--- a/target/arm/tcg/translate-a64.c
67
+++ b/target/arm/tcg/translate-a64.c
68
@@ -XXX,XX +XXX,XX @@ static bool fp_access_check_only(DisasContext *s)
69
{
70
if (s->fp_excp_el) {
71
assert(!s->fp_access_checked);
72
- s->fp_access_checked = true;
73
+ s->fp_access_checked = -1;
74
75
gen_exception_insn_el(s, 0, EXCP_UDEF,
76
syn_fp_access_trap(1, 0xe, false, 0),
77
s->fp_excp_el);
78
return false;
79
}
80
- s->fp_access_checked = true;
81
+ s->fp_access_checked = 1;
82
return true;
83
}
84
85
@@ -XXX,XX +XXX,XX @@ bool sve_access_check(DisasContext *s)
86
syn_sve_access_trap(), s->sve_excp_el);
87
goto fail_exit;
88
}
89
- s->sve_access_checked = true;
90
+ s->sve_access_checked = 1;
91
return fp_access_check(s);
92
93
fail_exit:
94
/* Assert that we only raise one exception per instruction. */
95
assert(!s->sve_access_checked);
96
- s->sve_access_checked = true;
97
+ s->sve_access_checked = -1;
98
return false;
99
}
100
101
@@ -XXX,XX +XXX,XX @@ bool sme_enabled_check(DisasContext *s)
102
* sme_excp_el by itself for cpregs access checks.
103
*/
104
if (!s->fp_excp_el || s->sme_excp_el < s->fp_excp_el) {
105
- s->fp_access_checked = true;
106
- return sme_access_check(s);
107
+ bool ret = sme_access_check(s);
108
+ s->fp_access_checked = (ret ? 1 : -1);
109
+ return ret;
110
}
111
return fp_access_check_only(s);
112
}
113
@@ -XXX,XX +XXX,XX @@ static void aarch64_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu)
114
s->insn = insn;
115
s->base.pc_next = pc + 4;
116
117
- s->fp_access_checked = false;
118
- s->sve_access_checked = false;
119
+ s->fp_access_checked = 0;
120
+ s->sve_access_checked = 0;
121
122
if (s->pstate_il) {
123
/*
124
--
125
2.43.0
diff view generated by jsdifflib
Deleted patch
1
From: Richard Henderson <richard.henderson@linaro.org>
2
1
3
In StreamingMode, fp_access_checked is handled already.
4
We cannot fall through to fp_access_check lest we fall
5
foul of the double-check assertion.
6
7
Cc: qemu-stable@nongnu.org
8
Fixes: 285b1d5fcef ("target/arm: Handle SME in sve_access_check")
9
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
10
Message-id: 20250307190415.982049-3-richard.henderson@linaro.org
11
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
12
[PMM: move declaration of 'ret' to top of block]
13
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
14
---
15
target/arm/tcg/translate-a64.c | 22 +++++++++++-----------
16
1 file changed, 11 insertions(+), 11 deletions(-)
17
18
diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c
19
index XXXXXXX..XXXXXXX 100644
20
--- a/target/arm/tcg/translate-a64.c
21
+++ b/target/arm/tcg/translate-a64.c
22
@@ -XXX,XX +XXX,XX @@ static int fp_access_check_vector_hsd(DisasContext *s, bool is_q, MemOp esz)
23
bool sve_access_check(DisasContext *s)
24
{
25
if (s->pstate_sm || !dc_isar_feature(aa64_sve, s)) {
26
+ bool ret;
27
+
28
assert(dc_isar_feature(aa64_sme, s));
29
- if (!sme_sm_enabled_check(s)) {
30
- goto fail_exit;
31
- }
32
- } else if (s->sve_excp_el) {
33
+ ret = sme_sm_enabled_check(s);
34
+ s->sve_access_checked = (ret ? 1 : -1);
35
+ return ret;
36
+ }
37
+ if (s->sve_excp_el) {
38
+ /* Assert that we only raise one exception per instruction. */
39
+ assert(!s->sve_access_checked);
40
gen_exception_insn_el(s, 0, EXCP_UDEF,
41
syn_sve_access_trap(), s->sve_excp_el);
42
- goto fail_exit;
43
+ s->sve_access_checked = -1;
44
+ return false;
45
}
46
s->sve_access_checked = 1;
47
return fp_access_check(s);
48
-
49
- fail_exit:
50
- /* Assert that we only raise one exception per instruction. */
51
- assert(!s->sve_access_checked);
52
- s->sve_access_checked = -1;
53
- return false;
54
}
55
56
/*
57
--
58
2.43.0
diff view generated by jsdifflib
Deleted patch
1
We want to capture potential Rust backtraces on panics in our test
2
logs, which isn't Rust's default behaviour. Set RUST_BACKTRACE=1 in
3
the add_test_setup environments, so that all our tests get run with
4
this environment variable set.
5
1
6
This makes the setting of that variable in the gitlab CI template
7
redundant, so we can remove it.
8
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
11
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
12
Message-id: 20250310102950.3752908-1-peter.maydell@linaro.org
13
---
14
meson.build | 9 ++++++---
15
.gitlab-ci.d/buildtest-template.yml | 1 -
16
2 files changed, 6 insertions(+), 4 deletions(-)
17
18
diff --git a/meson.build b/meson.build
19
index XXXXXXX..XXXXXXX 100644
20
--- a/meson.build
21
+++ b/meson.build
22
@@ -XXX,XX +XXX,XX @@ project('qemu', ['c'], meson_version: '>=1.5.0',
23
24
meson.add_devenv({ 'MESON_BUILD_ROOT' : meson.project_build_root() })
25
26
-add_test_setup('quick', exclude_suites: ['slow', 'thorough'], is_default: true)
27
-add_test_setup('slow', exclude_suites: ['thorough'], env: ['G_TEST_SLOW=1', 'SPEED=slow'])
28
-add_test_setup('thorough', env: ['G_TEST_SLOW=1', 'SPEED=thorough'])
29
+add_test_setup('quick', exclude_suites: ['slow', 'thorough'], is_default: true,
30
+ env: ['RUST_BACKTRACE=1'])
31
+add_test_setup('slow', exclude_suites: ['thorough'],
32
+ env: ['G_TEST_SLOW=1', 'SPEED=slow', 'RUST_BACKTRACE=1'])
33
+add_test_setup('thorough',
34
+ env: ['G_TEST_SLOW=1', 'SPEED=thorough', 'RUST_BACKTRACE=1'])
35
36
meson.add_postconf_script(find_program('scripts/symlink-install-tree.py'))
37
38
diff --git a/.gitlab-ci.d/buildtest-template.yml b/.gitlab-ci.d/buildtest-template.yml
39
index XXXXXXX..XXXXXXX 100644
40
--- a/.gitlab-ci.d/buildtest-template.yml
41
+++ b/.gitlab-ci.d/buildtest-template.yml
42
@@ -XXX,XX +XXX,XX @@
43
stage: test
44
image: $CI_REGISTRY_IMAGE/qemu/$IMAGE:$QEMU_CI_CONTAINER_TAG
45
script:
46
- - export RUST_BACKTRACE=1
47
- source scripts/ci/gitlab-ci-section
48
- section_start buildenv "Setting up to run tests"
49
- scripts/git-submodule.sh update roms/SLOF
50
--
51
2.43.0
52
53
diff view generated by jsdifflib