1
Hi; this pull request has a couple of fixes for bugs in
1
The following changes since commit e3debd5e7d0ce031356024878a0a18b9d109354a:
2
the Arm page-table-walk code, which arrived in the last
3
day or so.
4
2
5
I'm sending this out now in the hope it might just sneak
3
Merge tag 'pull-request-2023-03-24' of https://gitlab.com/thuth/qemu into staging (2023-03-24 16:08:46 +0000)
6
in before rc2 gets tagged, so the fixes can get more
7
testing time before the 7.2 release; but if they don't
8
make it then this should go into rc3.
9
10
thanks
11
-- PMM
12
13
The following changes since commit 6d71357a3b651ec9db126e4862b77e13165427f5:
14
15
rtl8139: honor large send MSS value (2022-11-21 09:28:43 -0500)
16
4
17
are available in the Git repository at:
5
are available in the Git repository at:
18
6
19
https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20221122
7
https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20230328
20
8
21
for you to fetch changes up to 15f8f4671afd22491ce99d28a296514717fead4f:
9
for you to fetch changes up to 46e3b237c52e0c48bfd81bce020b51fbe300b23a:
22
10
23
target/arm: Use signed quantity to represent VMSAv8-64 translation level (2022-11-22 16:10:25 +0000)
11
target/arm/gdbstub: Only advertise M-profile features if TCG available (2023-03-28 10:53:40 +0100)
24
12
25
----------------------------------------------------------------
13
----------------------------------------------------------------
26
target-arm:
14
target-arm queue:
27
* Fix broken 5-level pagetable handling
15
* fix part of the "TCG-disabled builds are broken" issue
28
* Fix debug accesses when EL2 is present
29
16
30
----------------------------------------------------------------
17
----------------------------------------------------------------
31
Ard Biesheuvel (1):
18
Philippe Mathieu-Daudé (1):
32
target/arm: Use signed quantity to represent VMSAv8-64 translation level
19
target/arm/gdbstub: Only advertise M-profile features if TCG available
33
20
34
Peter Maydell (1):
21
target/arm/gdbstub.c | 5 +++--
35
target/arm: Don't do two-stage lookup if stage 2 is disabled
22
1 file changed, 3 insertions(+), 2 deletions(-)
36
23
37
target/arm/ptw.c | 11 ++++++-----
38
1 file changed, 6 insertions(+), 5 deletions(-)
diff view generated by jsdifflib
Deleted patch
1
In get_phys_addr_with_struct(), we call get_phys_addr_twostage() if
2
the CPU supports EL2. However, we don't check here that stage 2 is
3
actually enabled. Instead we only check that inside
4
get_phys_addr_twostage() to skip stage 2 translation. This means
5
that even if stage 2 is disabled we still tell the stage 1 lookup to
6
do its page table walks via stage 2.
7
1
8
This works by luck for normal CPU accesses, but it breaks for debug
9
accesses, which are used by the disassembler and also by semihosting
10
file reads and writes, because the debug case takes a different code
11
path inside S1_ptw_translate().
12
13
This means that setups that use semihosting for file loads are broken
14
(a regression since 7.1, introduced in recent ptw refactoring), and
15
that sometimes disassembly in debug logs reports "unable to read
16
memory" rather than showing the guest insns.
17
18
Fix the bug by hoisting the "is stage 2 enabled?" check up to
19
get_phys_addr_with_struct(), so that we handle S2 disabled the same
20
way we do the "no EL2" case, with a simple single stage lookup.
21
22
Reported-by: Jens Wiklander <jens.wiklander@linaro.org>
23
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
24
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
25
Message-id: 20221121212404.1450382-1-peter.maydell@linaro.org
26
---
27
target/arm/ptw.c | 7 ++++---
28
1 file changed, 4 insertions(+), 3 deletions(-)
29
30
diff --git a/target/arm/ptw.c b/target/arm/ptw.c
31
index XXXXXXX..XXXXXXX 100644
32
--- a/target/arm/ptw.c
33
+++ b/target/arm/ptw.c
34
@@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_twostage(CPUARMState *env, S1Translate *ptw,
35
36
ret = get_phys_addr_with_struct(env, ptw, address, access_type, result, fi);
37
38
- /* If S1 fails or S2 is disabled, return early. */
39
- if (ret || regime_translation_disabled(env, ARMMMUIdx_Stage2, is_secure)) {
40
+ /* If S1 fails, return early. */
41
+ if (ret) {
42
return ret;
43
}
44
45
@@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_with_struct(CPUARMState *env, S1Translate *ptw,
46
* Otherwise, a stage1+stage2 translation is just stage 1.
47
*/
48
ptw->in_mmu_idx = mmu_idx = s1_mmu_idx;
49
- if (arm_feature(env, ARM_FEATURE_EL2)) {
50
+ if (arm_feature(env, ARM_FEATURE_EL2) &&
51
+ !regime_translation_disabled(env, ARMMMUIdx_Stage2, is_secure)) {
52
return get_phys_addr_twostage(env, ptw, address, access_type,
53
result, fi);
54
}
55
--
56
2.25.1
diff view generated by jsdifflib
1
From: Ard Biesheuvel <ardb@kernel.org>
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
2
2
3
The LPA2 extension implements 52-bit virtual addressing for 4k and 16k
3
Cortex-M profile is only emulable from TCG accelerator. Restrict
4
translation granules, and for the former, this means an additional level
4
the GDBstub features to its availability in order to avoid a link
5
of translation is needed. This means we start counting at -1 instead of
5
error when TCG is not enabled:
6
0 when doing a walk, and so 'level' is now a signed quantity, and should
7
be typed as such. So turn it from uint32_t into int32_t.
8
6
9
This avoids a level of -1 getting misinterpreted as being >= 3, and
7
Undefined symbols for architecture arm64:
10
terminating a page table walk prematurely with a bogus output address.
8
"_arm_v7m_get_sp_ptr", referenced from:
9
_m_sysreg_get in target_arm_gdbstub.c.o
10
"_arm_v7m_mrs_control", referenced from:
11
_arm_gdb_get_m_systemreg in target_arm_gdbstub.c.o
12
ld: symbol(s) not found for architecture arm64
13
clang: error: linker command failed with exit code 1 (use -v to see invocation)
11
14
12
Cc: Peter Maydell <peter.maydell@linaro.org>
15
Fixes: 7d8b28b8b5 ("target/arm: Implement gdbstub m-profile systemreg and secext")
13
Cc: Philippe Mathieu-Daudé <f4bug@amsat.org>
16
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
14
Cc: Richard Henderson <richard.henderson@linaro.org>
17
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
15
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
18
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
16
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
19
Message-id: 20230322142902.69511-3-philmd@linaro.org
20
[PMM: add #include since I cherry-picked this patch from the series]
17
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
21
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
18
---
22
---
19
target/arm/ptw.c | 4 ++--
23
target/arm/gdbstub.c | 5 +++--
20
1 file changed, 2 insertions(+), 2 deletions(-)
24
1 file changed, 3 insertions(+), 2 deletions(-)
21
25
22
diff --git a/target/arm/ptw.c b/target/arm/ptw.c
26
diff --git a/target/arm/gdbstub.c b/target/arm/gdbstub.c
23
index XXXXXXX..XXXXXXX 100644
27
index XXXXXXX..XXXXXXX 100644
24
--- a/target/arm/ptw.c
28
--- a/target/arm/gdbstub.c
25
+++ b/target/arm/ptw.c
29
+++ b/target/arm/gdbstub.c
26
@@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_lpae(CPUARMState *env, S1Translate *ptw,
30
@@ -XXX,XX +XXX,XX @@
27
ARMCPU *cpu = env_archcpu(env);
31
#include "cpu.h"
28
ARMMMUIdx mmu_idx = ptw->in_mmu_idx;
32
#include "exec/gdbstub.h"
29
bool is_secure = ptw->in_secure;
33
#include "gdbstub/helpers.h"
30
- uint32_t level;
34
+#include "sysemu/tcg.h"
31
+ int32_t level;
35
#include "internals.h"
32
ARMVAParameters param;
36
#include "cpregs.h"
33
uint64_t ttbr;
37
34
hwaddr descaddr, indexmask, indexmask_grainsize;
38
@@ -XXX,XX +XXX,XX @@ void arm_cpu_register_gdb_regs_for_features(ARMCPU *cpu)
35
@@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_lpae(CPUARMState *env, S1Translate *ptw,
39
2, "arm-vfp-sysregs.xml", 0);
36
*/
40
}
37
uint32_t sl0 = extract32(tcr, 6, 2);
41
}
38
uint32_t sl2 = extract64(tcr, 33, 1);
42
- if (cpu_isar_feature(aa32_mve, cpu)) {
39
- uint32_t startlevel;
43
+ if (cpu_isar_feature(aa32_mve, cpu) && tcg_enabled()) {
40
+ int32_t startlevel;
44
gdb_register_coprocessor(cs, mve_gdb_get_reg, mve_gdb_set_reg,
41
bool ok;
45
1, "arm-m-profile-mve.xml", 0);
42
46
}
43
/* SL2 is RES0 unless DS=1 & 4kb granule. */
47
@@ -XXX,XX +XXX,XX @@ void arm_cpu_register_gdb_regs_for_features(ARMCPU *cpu)
48
arm_gen_dynamic_sysreg_xml(cs, cs->gdb_num_regs),
49
"system-registers.xml", 0);
50
51
- if (arm_feature(env, ARM_FEATURE_M)) {
52
+ if (arm_feature(env, ARM_FEATURE_M) && tcg_enabled()) {
53
gdb_register_coprocessor(cs,
54
arm_gdb_get_m_systemreg, arm_gdb_set_m_systemreg,
55
arm_gen_dynamic_m_systemreg_xml(cs, cs->gdb_num_regs),
44
--
56
--
45
2.25.1
57
2.34.1
46
58
47
59
diff view generated by jsdifflib