1
Just one bugfix patch for this rc:
1
Two bug fixes for 9.0...
2
2
3
The following changes since commit ca5f3d4df1b47d7f66a109cdb504e83dfd7ec433:
3
-- PMM
4
4
5
Merge tag 'pull-la-20220808' of https://gitlab.com/rth7680/qemu into staging (2022-08-08 19:51:12 -0700)
5
The following changes since commit ce64e6224affb8b4e4b019f76d2950270b391af5:
6
7
Merge tag 'qemu-sparc-20240404' of https://github.com/mcayland/qemu into staging (2024-04-04 15:28:06 +0100)
6
8
7
are available in the Git repository at:
9
are available in the Git repository at:
8
10
9
https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20220809
11
https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20240408
10
12
11
for you to fetch changes up to c7f26ded6d5065e4116f630f6a490b55f6c5f58e:
13
for you to fetch changes up to 19b254e86a900dc5ee332e3ac0baf9c521301abf:
12
14
13
icount: Take iothread lock when running QEMU timers (2022-08-09 10:55:14 +0100)
15
target/arm: Use correct SecuritySpace for AArch64 AT ops at EL3 (2024-04-08 15:38:53 +0100)
14
16
15
----------------------------------------------------------------
17
----------------------------------------------------------------
16
target-arm queue:
18
target-arm:
17
* icount: Take iothread lock when running QEMU timers
19
* Use correct SecuritySpace for AArch64 AT ops at EL3
20
* Fix CNTPOFF_EL2 trap to missing EL3
18
21
19
----------------------------------------------------------------
22
----------------------------------------------------------------
20
Peter Maydell (1):
23
Peter Maydell (1):
21
icount: Take iothread lock when running QEMU timers
24
target/arm: Use correct SecuritySpace for AArch64 AT ops at EL3
22
25
23
accel/tcg/tcg-accel-ops-icount.c | 6 ++++++
26
Pierre-Clément Tosi (1):
24
1 file changed, 6 insertions(+)
27
target/arm: Fix CNTPOFF_EL2 trap to missing EL3
28
29
target/arm/helper.c | 10 +++++++---
30
1 file changed, 7 insertions(+), 3 deletions(-)
31
diff view generated by jsdifflib
New patch
1
From: Pierre-Clément Tosi <ptosi@google.com>
1
2
3
EL2 accesses to CNTPOFF_EL2 should only ever trap to EL3 if EL3 is
4
present, as described by the reference manual (for MRS):
5
6
/* ... */
7
elsif PSTATE.EL == EL2 then
8
if Halted() && HaveEL(EL3) && /*...*/ then
9
UNDEFINED;
10
elsif HaveEL(EL3) && SCR_EL3.ECVEn == '0' then
11
/* ... */
12
else
13
X[t, 64] = CNTPOFF_EL2;
14
15
However, the existing implementation of gt_cntpoff_access() always
16
returns CP_ACCESS_TRAP_EL3 for EL2 accesses with SCR_EL3.ECVEn unset. In
17
pseudo-code terminology, this corresponds to assuming that HaveEL(EL3)
18
is always true, which is wrong. As a result, QEMU panics in
19
access_check_cp_reg() when started without EL3 and running EL2 code
20
accessing the register (e.g. any recent KVM booting a guest).
21
22
Therefore, add the HaveEL(EL3) check to gt_cntpoff_access().
23
24
Fixes: 2808d3b38a52 ("target/arm: Implement FEAT_ECV CNTPOFF_EL2 handling")
25
Signed-off-by: Pierre-Clément Tosi <ptosi@google.com>
26
Message-id: m3al6amhdkmsiy2f62w72ufth6dzn45xg5cz6xljceyibphnf4@ezmmpwk4tnhl
27
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
28
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
29
---
30
target/arm/helper.c | 3 ++-
31
1 file changed, 2 insertions(+), 1 deletion(-)
32
33
diff --git a/target/arm/helper.c b/target/arm/helper.c
34
index XXXXXXX..XXXXXXX 100644
35
--- a/target/arm/helper.c
36
+++ b/target/arm/helper.c
37
@@ -XXX,XX +XXX,XX @@ static CPAccessResult gt_cntpoff_access(CPUARMState *env,
38
const ARMCPRegInfo *ri,
39
bool isread)
40
{
41
- if (arm_current_el(env) == 2 && !(env->cp15.scr_el3 & SCR_ECVEN)) {
42
+ if (arm_current_el(env) == 2 && arm_feature(env, ARM_FEATURE_EL3) &&
43
+ !(env->cp15.scr_el3 & SCR_ECVEN)) {
44
return CP_ACCESS_TRAP_EL3;
45
}
46
return CP_ACCESS_OK;
47
--
48
2.34.1
49
50
diff view generated by jsdifflib
1
The function icount_prepare_for_run() is called with the iothread
1
When we do an AT address translation operation, the page table walk
2
unlocked, but it can call icount_notify_aio_contexts() which will
2
is supposed to be performed in the context of the EL we're doing the
3
run qemu timer handlers. Those are supposed to be run only with
3
walk for, so for instance an AT S1E2R walk is done for EL2. In the
4
the iothread lock held, so take the lock while we do that.
4
pseudocode an EL is passed to AArch64.AT(), which calls
5
SecurityStateAtEL() to find the security state that we should be
6
doing the walk with.
5
7
6
Since icount mode runs everything on a single thread anyway,
8
In ats_write64() we get this wrong, instead using the current
7
not holding the lock is likely mostly not going to introduce
9
security space always. This is fine for AT operations performed from
8
races, but it can cause us to trip over assertions that we
10
EL1 and EL2, because there the current security state and the
9
do hold the lock, such as the one reported in issue 1130.
11
security state for the lower EL are the same. But for AT operations
12
performed from EL3, the current security state is always either
13
Secure or Root, whereas we want to use the security state defined by
14
SCR_EL3.{NS,NSE} for the walk. This affects not just guests using
15
FEAT_RME but also ones where EL3 is Secure state and the EL3 code
16
is trying to do an AT for a NonSecure EL2 or EL1.
10
17
11
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1130
18
Use arm_security_space_below_el3() to get the SecuritySpace to
19
pass to do_ats_write() for all AT operations except the
20
AT S1E3* operations.
21
22
Cc: qemu-stable@nongnu.org
23
Fixes: e1ee56ec2383 ("target/arm: Pass security space rather than flag for AT instructions")
24
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2250
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
25
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
26
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
14
Tested-by: Pavel Dovgalyuk <Pavel.Dovgalyuk@ispras.ru>
27
Message-id: 20240405180232.3570066-1-peter.maydell@linaro.org
15
Message-id: 20220801164527.3134765-1-peter.maydell@linaro.org
16
---
28
---
17
accel/tcg/tcg-accel-ops-icount.c | 6 ++++++
29
target/arm/helper.c | 7 +++++--
18
1 file changed, 6 insertions(+)
30
1 file changed, 5 insertions(+), 2 deletions(-)
19
31
20
diff --git a/accel/tcg/tcg-accel-ops-icount.c b/accel/tcg/tcg-accel-ops-icount.c
32
diff --git a/target/arm/helper.c b/target/arm/helper.c
21
index XXXXXXX..XXXXXXX 100644
33
index XXXXXXX..XXXXXXX 100644
22
--- a/accel/tcg/tcg-accel-ops-icount.c
34
--- a/target/arm/helper.c
23
+++ b/accel/tcg/tcg-accel-ops-icount.c
35
+++ b/target/arm/helper.c
24
@@ -XXX,XX +XXX,XX @@ void icount_prepare_for_run(CPUState *cpu)
36
@@ -XXX,XX +XXX,XX @@ static void ats_write64(CPUARMState *env, const ARMCPRegInfo *ri,
25
replay_mutex_lock();
37
ARMMMUIdx mmu_idx;
26
38
uint64_t hcr_el2 = arm_hcr_el2_eff(env);
27
if (cpu->icount_budget == 0) {
39
bool regime_e20 = (hcr_el2 & (HCR_E2H | HCR_TGE)) == (HCR_E2H | HCR_TGE);
28
+ /*
40
+ bool for_el3 = false;
29
+ * We're called without the iothread lock, so must take it while
41
+ ARMSecuritySpace ss;
30
+ * we're calling timer handlers.
42
31
+ */
43
switch (ri->opc2 & 6) {
32
+ qemu_mutex_lock_iothread();
44
case 0:
33
icount_notify_aio_contexts();
45
@@ -XXX,XX +XXX,XX @@ static void ats_write64(CPUARMState *env, const ARMCPRegInfo *ri,
34
+ qemu_mutex_unlock_iothread();
46
break;
47
case 6: /* AT S1E3R, AT S1E3W */
48
mmu_idx = ARMMMUIdx_E3;
49
+ for_el3 = true;
50
break;
51
default:
52
g_assert_not_reached();
53
@@ -XXX,XX +XXX,XX @@ static void ats_write64(CPUARMState *env, const ARMCPRegInfo *ri,
54
g_assert_not_reached();
35
}
55
}
36
}
56
37
57
- env->cp15.par_el[1] = do_ats_write(env, value, access_type,
58
- mmu_idx, arm_security_space(env));
59
+ ss = for_el3 ? arm_security_space(env) : arm_security_space_below_el3(env);
60
+ env->cp15.par_el[1] = do_ats_write(env, value, access_type, mmu_idx, ss);
61
#else
62
/* Handled by hardware accelerator. */
63
g_assert_not_reached();
38
--
64
--
39
2.25.1
65
2.34.1
diff view generated by jsdifflib