Skip to content

Commit 5719376

Browse files
committed
Merge tag 'pull-target-arm-20250314-1' of https://git.linaro.org/people/pmaydell/qemu-arm into staging
target-arm queue: * Correctly handle corner cases of guest attempting an exception return to AArch32 when target EL is AArch64 only * MAINTAINERS: Fix status for Arm boards I "maintain" * tests/functional: Bump up arm_replay timeout * Revert "hw/char/pl011: Warn when using disabled receiver" * util/cacheflush: Make first DSB unconditional on aarch64 * target/arm: Fix SVE/SME access check logic * meson.build: Set RUST_BACKTRACE for all tests # -----BEGIN PGP SIGNATURE----- # # iQJNBAABCAA3FiEE4aXFk81BneKOgxXPPCUl7RQ2DN4FAmfULAUZHHBldGVyLm1h # eWRlbGxAbGluYXJvLm9yZwAKCRA8JSXtFDYM3gMKD/9GwpPo5/q2VAsJ/e+4JcGM # 5P8+lnt/tA5A2sA3Gl5o8v1LN5zm9CvyzHSlQSnvXygXlUP5e6vkwKQ8/DGZogjL # L0wRGOqGyNWapT9sulwsKzLXlG+9GCKeLbKq8wC9mUnviQ+FxTz2IxDexJedw0pS # NrLN55RSQO3OIEGt2fqIXKG+421/TfDPx998cwA4vyIgqZY1ZtHE2BvJNfatpSAc # Y6Rdq/BqWc0Tx0BAL7RgEl86OFO6YskbJwPbT6t/2KRBrqDbeuaHrynOzfA1Wbqx # RIvYqPuFg/ncziU7a2ZJLi4JvfSNO2RTH6KyDbq8WXqB5f7x59QuwXtfsEgmQK/T # 9JkC1G2R9RWezRmVygc7pImIpkMmSs12nhiij3OTmsTCSHB/qQJ8jHoxZN/cTUCw # pphVrAEwuWx48YR9x8xorsgoMRmwIkXdlTSuvLmq6y9ypq8OjoWILZuwN48ILZZT # MqoKNQwbQJr/0L6Tg7csQayJ2L2fJgQDcVOA8lnjlAwRlRI+eMWUz181iGwwKDM9 # rvzntqrVx1d0H4I598vgv597GAn8wo3r7DK5lMt+M5zy5sJY1SgtJU6/PGNrtPKO # GwLG1jaNjBHl0+YnEgvQp0Fw2bDXftxvZIjTiySHJ69xcC9oyUKtaDvJWUk4Ft8D # USAXvWC1qKHPMACPUGRWCw== # =g6lD # -----END PGP SIGNATURE----- # gpg: Signature made Fri 14 Mar 2025 09:15:49 EDT # gpg: using RSA key E1A5C593CD419DE28E8315CF3C2525ED14360CDE # gpg: issuer "[email protected]" # gpg: Good signature from "Peter Maydell <[email protected]>" [full] # gpg: aka "Peter Maydell <[email protected]>" [full] # gpg: aka "Peter Maydell <[email protected]>" [full] # gpg: aka "Peter Maydell <[email protected]>" [unknown] # Primary key fingerprint: E1A5 C593 CD41 9DE2 8E83 15CF 3C25 25ED 1436 0CDE * tag 'pull-target-arm-20250314-1' of https://git.linaro.org/people/pmaydell/qemu-arm: meson.build: Set RUST_BACKTRACE for all tests target/arm: Simplify pstate_sm check in sve_access_check target/arm: Make DisasContext.{fp, sve}_access_checked tristate util/cacheflush: Make first DSB unconditional on aarch64 Revert "hw/char/pl011: Warn when using disabled receiver" tests/functional: Bump up arm_replay timeout MAINTAINERS: Fix status for Arm boards I "maintain" target/arm: Forbid return to AArch32 when CPU is AArch64-only target/arm: Add cpu local variable to exception_return helper target/arm: HCR_EL2.RW should be RAO/WI if EL1 doesn't support AArch32 target/arm: SCR_EL3.RW should be treated as 1 if EL2 doesn't support AArch32 target/arm: Move arm_current_el() and arm_el_is_aa64() to internals.h target/arm: Move arm_cpu_data_is_big_endian() etc to internals.h linux-user/arm: Remove unused get_put_user macros linux-user/aarch64: Remove unused get/put_user macros target/arm: Un-inline access_secure_reg() target/arm: Move A32_BANKED_REG_{GET,SET} macros to cpregs.h Signed-off-by: Stefan Hajnoczi <[email protected]>
2 parents 9beccc2 + a019e15 commit 5719376

File tree

18 files changed

+257
-285
lines changed

18 files changed

+257
-285
lines changed

.gitlab-ci.d/buildtest-template.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@
6363
stage: test
6464
image: $CI_REGISTRY_IMAGE/qemu/$IMAGE:$QEMU_CI_CONTAINER_TAG
6565
script:
66-
- export RUST_BACKTRACE=1
6766
- source scripts/ci/gitlab-ci-section
6867
- section_start buildenv "Setting up to run tests"
6968
- scripts/git-submodule.sh update roms/SLOF

MAINTAINERS

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -786,7 +786,7 @@ F: docs/system/arm/kzm.rst
786786
Integrator CP
787787
M: Peter Maydell <[email protected]>
788788
789-
S: Maintained
789+
S: Odd Fixes
790790
F: hw/arm/integratorcp.c
791791
F: hw/misc/arm_integrator_debug.c
792792
F: include/hw/misc/arm_integrator_debug.h
@@ -867,7 +867,7 @@ F: docs/system/arm/mps2.rst
867867
Musca
868868
M: Peter Maydell <[email protected]>
869869
870-
S: Maintained
870+
S: Odd Fixes
871871
F: hw/arm/musca.c
872872
F: docs/system/arm/musca.rst
873873

@@ -915,7 +915,7 @@ F: tests/functional/test_aarch64_raspi4.py
915915
Real View
916916
M: Peter Maydell <[email protected]>
917917
918-
S: Maintained
918+
S: Odd Fixes
919919
F: hw/arm/realview*
920920
F: hw/cpu/realview_mpcore.c
921921
F: hw/intc/realview_gic.c
@@ -965,7 +965,7 @@ F: tests/functional/test_arm_collie.py
965965
Stellaris
966966
M: Peter Maydell <[email protected]>
967967
968-
S: Maintained
968+
S: Odd Fixes
969969
F: hw/*/stellaris*
970970
F: hw/display/ssd03*
971971
F: include/hw/input/gamepad.h
@@ -995,7 +995,7 @@ F: docs/system/arm/stm32.rst
995995
Versatile Express
996996
M: Peter Maydell <[email protected]>
997997
998-
S: Maintained
998+
S: Odd Fixes
999999
F: hw/arm/vexpress.c
10001000
F: hw/display/sii9022.c
10011001
F: docs/system/arm/vexpress.rst
@@ -1004,7 +1004,7 @@ F: tests/functional/test_arm_vexpress.py
10041004
Versatile PB
10051005
M: Peter Maydell <[email protected]>
10061006
1007-
S: Maintained
1007+
S: Odd Fixes
10081008
F: hw/*/versatile*
10091009
F: hw/i2c/arm_sbcon_i2c.c
10101010
F: include/hw/i2c/arm_sbcon_i2c.h
@@ -2003,7 +2003,7 @@ F: include/hw/hyperv/vmbus*.h
20032003
OMAP
20042004
M: Peter Maydell <[email protected]>
20052005
2006-
S: Maintained
2006+
S: Odd Fixes
20072007
F: hw/*/omap*
20082008
F: include/hw/arm/omap.h
20092009
F: docs/system/arm/sx1.rst

hw/char/pl011.c

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -490,16 +490,17 @@ static int pl011_can_receive(void *opaque)
490490
unsigned fifo_depth = pl011_get_fifo_depth(s);
491491
unsigned fifo_available = fifo_depth - s->read_count;
492492

493-
if (!(s->cr & CR_UARTEN)) {
494-
qemu_log_mask(LOG_GUEST_ERROR,
495-
"PL011 receiving data on disabled UART\n");
496-
}
497-
if (!(s->cr & CR_RXE)) {
498-
qemu_log_mask(LOG_GUEST_ERROR,
499-
"PL011 receiving data on disabled RX UART\n");
500-
}
501-
trace_pl011_can_receive(s->lcr, s->read_count, fifo_depth, fifo_available);
493+
/*
494+
* In theory we should check the UART and RX enable bits here and
495+
* return 0 if they are not set (so the guest can't receive data
496+
* until you have enabled the UART). In practice we suspect there
497+
* is at least some guest code out there which has been tested only
498+
* on QEMU and which never bothers to enable the UART because we
499+
* historically never enforced that. So we effectively keep the
500+
* UART continuously enabled regardless of the enable bits.
501+
*/
502502

503+
trace_pl011_can_receive(s->lcr, s->read_count, fifo_depth, fifo_available);
503504
return fifo_available;
504505
}
505506

hw/intc/arm_gicv3_cpuif.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include "cpu.h"
2323
#include "target/arm/cpregs.h"
2424
#include "target/arm/cpu-features.h"
25+
#include "target/arm/internals.h"
2526
#include "system/tcg.h"
2627
#include "system/qtest.h"
2728

linux-user/aarch64/cpu_loop.c

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -27,54 +27,6 @@
2727
#include "target/arm/syndrome.h"
2828
#include "target/arm/cpu-features.h"
2929

30-
#define get_user_code_u32(x, gaddr, env) \
31-
({ abi_long __r = get_user_u32((x), (gaddr)); \
32-
if (!__r && bswap_code(arm_sctlr_b(env))) { \
33-
(x) = bswap32(x); \
34-
} \
35-
__r; \
36-
})
37-
38-
#define get_user_code_u16(x, gaddr, env) \
39-
({ abi_long __r = get_user_u16((x), (gaddr)); \
40-
if (!__r && bswap_code(arm_sctlr_b(env))) { \
41-
(x) = bswap16(x); \
42-
} \
43-
__r; \
44-
})
45-
46-
#define get_user_data_u32(x, gaddr, env) \
47-
({ abi_long __r = get_user_u32((x), (gaddr)); \
48-
if (!__r && arm_cpu_bswap_data(env)) { \
49-
(x) = bswap32(x); \
50-
} \
51-
__r; \
52-
})
53-
54-
#define get_user_data_u16(x, gaddr, env) \
55-
({ abi_long __r = get_user_u16((x), (gaddr)); \
56-
if (!__r && arm_cpu_bswap_data(env)) { \
57-
(x) = bswap16(x); \
58-
} \
59-
__r; \
60-
})
61-
62-
#define put_user_data_u32(x, gaddr, env) \
63-
({ typeof(x) __x = (x); \
64-
if (arm_cpu_bswap_data(env)) { \
65-
__x = bswap32(__x); \
66-
} \
67-
put_user_u32(__x, (gaddr)); \
68-
})
69-
70-
#define put_user_data_u16(x, gaddr, env) \
71-
({ typeof(x) __x = (x); \
72-
if (arm_cpu_bswap_data(env)) { \
73-
__x = bswap16(__x); \
74-
} \
75-
put_user_u16(__x, (gaddr)); \
76-
})
77-
7830
/* AArch64 main loop */
7931
void cpu_loop(CPUARMState *env)
8032
{

linux-user/arm/cpu_loop.c

Lines changed: 4 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -36,45 +36,10 @@
3636
__r; \
3737
})
3838

39-
#define get_user_code_u16(x, gaddr, env) \
40-
({ abi_long __r = get_user_u16((x), (gaddr)); \
41-
if (!__r && bswap_code(arm_sctlr_b(env))) { \
42-
(x) = bswap16(x); \
43-
} \
44-
__r; \
45-
})
46-
47-
#define get_user_data_u32(x, gaddr, env) \
48-
({ abi_long __r = get_user_u32((x), (gaddr)); \
49-
if (!__r && arm_cpu_bswap_data(env)) { \
50-
(x) = bswap32(x); \
51-
} \
52-
__r; \
53-
})
54-
55-
#define get_user_data_u16(x, gaddr, env) \
56-
({ abi_long __r = get_user_u16((x), (gaddr)); \
57-
if (!__r && arm_cpu_bswap_data(env)) { \
58-
(x) = bswap16(x); \
59-
} \
60-
__r; \
61-
})
62-
63-
#define put_user_data_u32(x, gaddr, env) \
64-
({ typeof(x) __x = (x); \
65-
if (arm_cpu_bswap_data(env)) { \
66-
__x = bswap32(__x); \
67-
} \
68-
put_user_u32(__x, (gaddr)); \
69-
})
70-
71-
#define put_user_data_u16(x, gaddr, env) \
72-
({ typeof(x) __x = (x); \
73-
if (arm_cpu_bswap_data(env)) { \
74-
__x = bswap16(__x); \
75-
} \
76-
put_user_u16(__x, (gaddr)); \
77-
})
39+
/*
40+
* Note that if we need to do data accesses here, they should do a
41+
* bswap if arm_cpu_bswap_data() returns true.
42+
*/
7843

7944
/*
8045
* Similar to code in accel/tcg/user-exec.c, but outside the execution loop.

meson.build

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,12 @@ project('qemu', ['c'], meson_version: '>=1.5.0',
55

66
meson.add_devenv({ 'MESON_BUILD_ROOT' : meson.project_build_root() })
77

8-
add_test_setup('quick', exclude_suites: ['slow', 'thorough'], is_default: true)
9-
add_test_setup('slow', exclude_suites: ['thorough'], env: ['G_TEST_SLOW=1', 'SPEED=slow'])
10-
add_test_setup('thorough', env: ['G_TEST_SLOW=1', 'SPEED=thorough'])
8+
add_test_setup('quick', exclude_suites: ['slow', 'thorough'], is_default: true,
9+
env: ['RUST_BACKTRACE=1'])
10+
add_test_setup('slow', exclude_suites: ['thorough'],
11+
env: ['G_TEST_SLOW=1', 'SPEED=slow', 'RUST_BACKTRACE=1'])
12+
add_test_setup('thorough',
13+
env: ['G_TEST_SLOW=1', 'SPEED=thorough', 'RUST_BACKTRACE=1'])
1114

1215
meson.add_postconf_script(find_program('scripts/symlink-install-tree.py'))
1316

target/arm/arch_dump.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include "elf.h"
2424
#include "system/dump.h"
2525
#include "cpu-features.h"
26+
#include "internals.h"
2627

2728
/* struct user_pt_regs from arch/arm64/include/uapi/asm/ptrace.h */
2829
struct aarch64_user_regs {

target/arm/cpregs.h

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1157,4 +1157,32 @@ static inline bool arm_cpreg_traps_in_nv(const ARMCPRegInfo *ri)
11571157
return ri->opc1 == 4 || ri->opc1 == 5;
11581158
}
11591159

1160+
/* Macros for accessing a specified CP register bank */
1161+
#define A32_BANKED_REG_GET(_env, _regname, _secure) \
1162+
((_secure) ? (_env)->cp15._regname##_s : (_env)->cp15._regname##_ns)
1163+
1164+
#define A32_BANKED_REG_SET(_env, _regname, _secure, _val) \
1165+
do { \
1166+
if (_secure) { \
1167+
(_env)->cp15._regname##_s = (_val); \
1168+
} else { \
1169+
(_env)->cp15._regname##_ns = (_val); \
1170+
} \
1171+
} while (0)
1172+
1173+
/*
1174+
* Macros for automatically accessing a specific CP register bank depending on
1175+
* the current secure state of the system. These macros are not intended for
1176+
* supporting instruction translation reads/writes as these are dependent
1177+
* solely on the SCR.NS bit and not the mode.
1178+
*/
1179+
#define A32_BANKED_CURRENT_REG_GET(_env, _regname) \
1180+
A32_BANKED_REG_GET((_env), _regname, \
1181+
(arm_is_secure(_env) && !arm_el_is_aa64((_env), 3)))
1182+
1183+
#define A32_BANKED_CURRENT_REG_SET(_env, _regname, _val) \
1184+
A32_BANKED_REG_SET((_env), _regname, \
1185+
(arm_is_secure(_env) && !arm_el_is_aa64((_env), 3)), \
1186+
(_val))
1187+
11601188
#endif /* TARGET_ARM_CPREGS_H */

0 commit comments

Comments
 (0)