1
ARM queue for 2.10: all M profile bugfixes...
1
Only thing for Arm for rc1 is RTH's fix for the KVM SVE probe code.
2
2
3
thanks
4
-- PMM
3
-- PMM
5
4
6
The following changes since commit 25dd0e77898c3e10796d4cbeb35e8af5ba6ce975:
5
The following changes since commit 4e06b3fc1b5e1ec03f22190eabe56891dc9c2236:
7
6
8
Merge remote-tracking branch 'remotes/mjt/tags/trivial-patches-fetch' into staging (2017-07-31 11:27:43 +0100)
7
Merge tag 'pull-hex-20220731' of https://github.com/quic/qemu into staging (2022-07-31 21:38:54 -0700)
9
8
10
are available in the git repository at:
9
are available in the Git repository at:
11
10
12
git://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20170731
11
https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20220801
13
12
14
for you to fetch changes up to 89cbc3778a3d61761e2231e740269218c9a8a41d:
13
for you to fetch changes up to 5265d24c981dfdda8d29b44f7e84a514da75eedc:
15
14
16
hw/mps2_scc: fix incorrect properties (2017-07-31 13:11:56 +0100)
15
target/arm: Move sve probe inside kvm >= 4.15 branch (2022-08-01 16:21:18 +0100)
17
16
18
----------------------------------------------------------------
17
----------------------------------------------------------------
19
target-arm queue:
18
target-arm queue:
20
* fix broken properties on MPS2 SCC device
19
* Fix KVM SVE ID register probe code
21
* fix MPU trace handling of write vs exec
22
* fix MPU M profile bugs:
23
- not handling system space or PPB region correctly
24
- not resetting state
25
- not migrating MPU_RNR
26
20
27
----------------------------------------------------------------
21
----------------------------------------------------------------
28
Peter Maydell (6):
22
Richard Henderson (3):
29
target/arm: Correct MPU trace handling of write vs execute
23
target/arm: Use kvm_arm_sve_supported in kvm_arm_get_host_cpu_features
30
target/arm: Don't do MPU lookups for addresses in M profile PPB region
24
target/arm: Set KVM_ARM_VCPU_SVE while probing the host
31
target/arm: Don't allow guest to make System space executable for M profile
25
target/arm: Move sve probe inside kvm >= 4.15 branch
32
target/arm: Rename cp15.c6_rgnr to pmsav7.rnr
33
target/arm: Move PMSAv7 reset into arm_cpu_reset() so M profile MPUs get reset
34
target/arm: Migrate MPU_RNR register state for M profile cores
35
26
36
Philippe Mathieu-Daudé (1):
27
target/arm/kvm64.c | 45 ++++++++++++++++++++++-----------------------
37
hw/mps2_scc: fix incorrect properties
28
1 file changed, 22 insertions(+), 23 deletions(-)
38
39
target/arm/cpu.h | 3 +--
40
hw/intc/armv7m_nvic.c | 14 +++++-----
41
hw/misc/mps2-scc.c | 4 +--
42
target/arm/cpu.c | 14 ++++++++++
43
target/arm/helper.c | 71 ++++++++++++++++++++++++++++++++++-----------------
44
target/arm/machine.c | 30 +++++++++++++++++++++-
45
6 files changed, 101 insertions(+), 35 deletions(-)
46
diff view generated by jsdifflib
Deleted patch
1
Correct off-by-one bug in the PSMAv7 MPU tracing where it would print
2
a write access as "reading", an insn fetch as "writing", and a read
3
access as "execute".
4
1
5
Since we have an MMUAccessType enum now, we can make the code clearer
6
in the process by using that rather than the raw 0/1/2 values.
7
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Reviewed-by: Richard Henderson <rth@twiddle.net>
10
Message-id: 1500906792-18010-1-git-send-email-peter.maydell@linaro.org
11
---
12
target/arm/helper.c | 4 ++--
13
1 file changed, 2 insertions(+), 2 deletions(-)
14
15
diff --git a/target/arm/helper.c b/target/arm/helper.c
16
index XXXXXXX..XXXXXXX 100644
17
--- a/target/arm/helper.c
18
+++ b/target/arm/helper.c
19
@@ -XXX,XX +XXX,XX @@ static bool get_phys_addr(CPUARMState *env, target_ulong address,
20
phys_ptr, prot, fsr);
21
qemu_log_mask(CPU_LOG_MMU, "PMSAv7 MPU lookup for %s at 0x%08" PRIx32
22
" mmu_idx %u -> %s (prot %c%c%c)\n",
23
- access_type == 1 ? "reading" :
24
- (access_type == 2 ? "writing" : "execute"),
25
+ access_type == MMU_DATA_LOAD ? "reading" :
26
+ (access_type == MMU_DATA_STORE ? "writing" : "execute"),
27
(uint32_t)address, mmu_idx,
28
ret ? "Miss" : "Hit",
29
*prot & PAGE_READ ? 'r' : '-',
30
--
31
2.7.4
32
33
diff view generated by jsdifflib
Deleted patch
1
The M profile PMSAv7 specification says that if the address being looked
2
up is in the PPB region (0xe0000000 - 0xe00fffff) then we do not use
3
the MPU regions but always use the default memory map. Implement this
4
(we were previously behaving like an R profile PMSAv7, which does not
5
special case this).
6
1
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
9
Message-id: 1501153150-19984-2-git-send-email-peter.maydell@linaro.org
10
---
11
target/arm/helper.c | 17 ++++++++++++++++-
12
1 file changed, 16 insertions(+), 1 deletion(-)
13
14
diff --git a/target/arm/helper.c b/target/arm/helper.c
15
index XXXXXXX..XXXXXXX 100644
16
--- a/target/arm/helper.c
17
+++ b/target/arm/helper.c
18
@@ -XXX,XX +XXX,XX @@ static bool pmsav7_use_background_region(ARMCPU *cpu,
19
}
20
}
21
22
+static inline bool m_is_ppb_region(CPUARMState *env, uint32_t address)
23
+{
24
+ /* True if address is in the M profile PPB region 0xe0000000 - 0xe00fffff */
25
+ return arm_feature(env, ARM_FEATURE_M) &&
26
+ extract32(address, 20, 12) == 0xe00;
27
+}
28
+
29
static bool get_phys_addr_pmsav7(CPUARMState *env, uint32_t address,
30
int access_type, ARMMMUIdx mmu_idx,
31
hwaddr *phys_ptr, int *prot, uint32_t *fsr)
32
@@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_pmsav7(CPUARMState *env, uint32_t address,
33
*phys_ptr = address;
34
*prot = 0;
35
36
- if (regime_translation_disabled(env, mmu_idx)) { /* MPU disabled */
37
+ if (regime_translation_disabled(env, mmu_idx) ||
38
+ m_is_ppb_region(env, address)) {
39
+ /* MPU disabled or M profile PPB access: use default memory map.
40
+ * The other case which uses the default memory map in the
41
+ * v7M ARM ARM pseudocode is exception vector reads from the vector
42
+ * table. In QEMU those accesses are done in arm_v7m_load_vector(),
43
+ * which always does a direct read using address_space_ldl(), rather
44
+ * than going via this function, so we don't need to check that here.
45
+ */
46
get_phys_addr_pmsav7_default(env, mmu_idx, address, prot);
47
} else { /* MPU enabled */
48
for (n = (int)cpu->pmsav7_dregion - 1; n >= 0; n--) {
49
--
50
2.7.4
51
52
diff view generated by jsdifflib
Deleted patch
1
For an M profile v7PMSA, the system space (0xe0000000 - 0xffffffff) can
2
never be executable, even if the guest tries to set the MPU registers
3
up that way. Enforce this restriction.
4
1
5
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
7
Message-id: 1501153150-19984-3-git-send-email-peter.maydell@linaro.org
8
---
9
target/arm/helper.c | 16 +++++++++++++++-
10
1 file changed, 15 insertions(+), 1 deletion(-)
11
12
diff --git a/target/arm/helper.c b/target/arm/helper.c
13
index XXXXXXX..XXXXXXX 100644
14
--- a/target/arm/helper.c
15
+++ b/target/arm/helper.c
16
@@ -XXX,XX +XXX,XX @@ static inline bool m_is_ppb_region(CPUARMState *env, uint32_t address)
17
extract32(address, 20, 12) == 0xe00;
18
}
19
20
+static inline bool m_is_system_region(CPUARMState *env, uint32_t address)
21
+{
22
+ /* True if address is in the M profile system region
23
+ * 0xe0000000 - 0xffffffff
24
+ */
25
+ return arm_feature(env, ARM_FEATURE_M) && extract32(address, 29, 3) == 0x7;
26
+}
27
+
28
static bool get_phys_addr_pmsav7(CPUARMState *env, uint32_t address,
29
int access_type, ARMMMUIdx mmu_idx,
30
hwaddr *phys_ptr, int *prot, uint32_t *fsr)
31
@@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_pmsav7(CPUARMState *env, uint32_t address,
32
get_phys_addr_pmsav7_default(env, mmu_idx, address, prot);
33
} else { /* a MPU hit! */
34
uint32_t ap = extract32(env->pmsav7.dracr[n], 8, 3);
35
+ uint32_t xn = extract32(env->pmsav7.dracr[n], 12, 1);
36
+
37
+ if (m_is_system_region(env, address)) {
38
+ /* System space is always execute never */
39
+ xn = 1;
40
+ }
41
42
if (is_user) { /* User mode AP bit decoding */
43
switch (ap) {
44
@@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_pmsav7(CPUARMState *env, uint32_t address,
45
}
46
47
/* execute never */
48
- if (env->pmsav7.dracr[n] & (1 << 12)) {
49
+ if (xn) {
50
*prot &= ~PAGE_EXEC;
51
}
52
}
53
--
54
2.7.4
55
56
diff view generated by jsdifflib
1
Almost all of the PMSAv7 state is in the pmsav7 substruct of
1
From: Richard Henderson <richard.henderson@linaro.org>
2
the ARM CPU state structure. The exception is the region
3
number register, which is in cp15.c6_rgnr. This exception
4
is a bit odd for M profile, which otherwise generally does
5
not store state in the cp15 substruct.
6
2
7
Rename cp15.c6_rgnr to pmsav7.rnr accordingly.
3
Indication for support for SVE will not depend on whether we
4
perform the query on the main kvm_state or the temp vcpu.
8
5
6
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
7
Message-id: 20220726045828.53697-2-richard.henderson@linaro.org
8
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
11
Message-id: 1501153150-19984-4-git-send-email-peter.maydell@linaro.org
12
---
10
---
13
target/arm/cpu.h | 3 +--
11
target/arm/kvm64.c | 2 +-
14
hw/intc/armv7m_nvic.c | 14 +++++++-------
12
1 file changed, 1 insertion(+), 1 deletion(-)
15
target/arm/helper.c | 6 +++---
16
target/arm/machine.c | 2 +-
17
4 files changed, 12 insertions(+), 13 deletions(-)
18
13
19
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
14
diff --git a/target/arm/kvm64.c b/target/arm/kvm64.c
20
index XXXXXXX..XXXXXXX 100644
15
index XXXXXXX..XXXXXXX 100644
21
--- a/target/arm/cpu.h
16
--- a/target/arm/kvm64.c
22
+++ b/target/arm/cpu.h
17
+++ b/target/arm/kvm64.c
23
@@ -XXX,XX +XXX,XX @@ typedef struct CPUARMState {
18
@@ -XXX,XX +XXX,XX @@ bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf)
24
uint64_t par_el[4];
25
};
26
27
- uint32_t c6_rgnr;
28
-
29
uint32_t c9_insn; /* Cache lockdown registers. */
30
uint32_t c9_data;
31
uint64_t c9_pmcr; /* performance monitor control register */
32
@@ -XXX,XX +XXX,XX @@ typedef struct CPUARMState {
33
uint32_t *drbar;
34
uint32_t *drsr;
35
uint32_t *dracr;
36
+ uint32_t rnr;
37
} pmsav7;
38
39
void *nvic;
40
diff --git a/hw/intc/armv7m_nvic.c b/hw/intc/armv7m_nvic.c
41
index XXXXXXX..XXXXXXX 100644
42
--- a/hw/intc/armv7m_nvic.c
43
+++ b/hw/intc/armv7m_nvic.c
44
@@ -XXX,XX +XXX,XX @@ static uint32_t nvic_readl(NVICState *s, uint32_t offset)
45
case 0xd94: /* MPU_CTRL */
46
return cpu->env.v7m.mpu_ctrl;
47
case 0xd98: /* MPU_RNR */
48
- return cpu->env.cp15.c6_rgnr;
49
+ return cpu->env.pmsav7.rnr;
50
case 0xd9c: /* MPU_RBAR */
51
case 0xda4: /* MPU_RBAR_A1 */
52
case 0xdac: /* MPU_RBAR_A2 */
53
case 0xdb4: /* MPU_RBAR_A3 */
54
{
55
- int region = cpu->env.cp15.c6_rgnr;
56
+ int region = cpu->env.pmsav7.rnr;
57
58
if (region >= cpu->pmsav7_dregion) {
59
return 0;
60
@@ -XXX,XX +XXX,XX @@ static uint32_t nvic_readl(NVICState *s, uint32_t offset)
61
case 0xdb0: /* MPU_RASR_A2 */
62
case 0xdb8: /* MPU_RASR_A3 */
63
{
64
- int region = cpu->env.cp15.c6_rgnr;
65
+ int region = cpu->env.pmsav7.rnr;
66
67
if (region >= cpu->pmsav7_dregion) {
68
return 0;
69
@@ -XXX,XX +XXX,XX @@ static void nvic_writel(NVICState *s, uint32_t offset, uint32_t value)
70
PRIu32 "/%" PRIu32 "\n",
71
value, cpu->pmsav7_dregion);
72
} else {
73
- cpu->env.cp15.c6_rgnr = value;
74
+ cpu->env.pmsav7.rnr = value;
75
}
19
}
76
break;
77
case 0xd9c: /* MPU_RBAR */
78
@@ -XXX,XX +XXX,XX @@ static void nvic_writel(NVICState *s, uint32_t offset, uint32_t value)
79
region, cpu->pmsav7_dregion);
80
return;
81
}
82
- cpu->env.cp15.c6_rgnr = region;
83
+ cpu->env.pmsav7.rnr = region;
84
} else {
85
- region = cpu->env.cp15.c6_rgnr;
86
+ region = cpu->env.pmsav7.rnr;
87
}
88
89
if (region >= cpu->pmsav7_dregion) {
90
@@ -XXX,XX +XXX,XX @@ static void nvic_writel(NVICState *s, uint32_t offset, uint32_t value)
91
case 0xdb0: /* MPU_RASR_A2 */
92
case 0xdb8: /* MPU_RASR_A3 */
93
{
94
- int region = cpu->env.cp15.c6_rgnr;
95
+ int region = cpu->env.pmsav7.rnr;
96
97
if (region >= cpu->pmsav7_dregion) {
98
return;
99
diff --git a/target/arm/helper.c b/target/arm/helper.c
100
index XXXXXXX..XXXXXXX 100644
101
--- a/target/arm/helper.c
102
+++ b/target/arm/helper.c
103
@@ -XXX,XX +XXX,XX @@ static uint64_t pmsav7_read(CPUARMState *env, const ARMCPRegInfo *ri)
104
return 0;
105
}
20
}
106
21
107
- u32p += env->cp15.c6_rgnr;
22
- sve_supported = ioctl(fdarray[0], KVM_CHECK_EXTENSION, KVM_CAP_ARM_SVE) > 0;
108
+ u32p += env->pmsav7.rnr;
23
+ sve_supported = kvm_arm_sve_supported();
109
return *u32p;
24
110
}
25
/* Add feature bits that can't appear until after VCPU init. */
111
26
if (sve_supported) {
112
@@ -XXX,XX +XXX,XX @@ static void pmsav7_write(CPUARMState *env, const ARMCPRegInfo *ri,
113
return;
114
}
115
116
- u32p += env->cp15.c6_rgnr;
117
+ u32p += env->pmsav7.rnr;
118
tlb_flush(CPU(cpu)); /* Mappings may have changed - purge! */
119
*u32p = value;
120
}
121
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo pmsav7_cp_reginfo[] = {
122
.readfn = pmsav7_read, .writefn = pmsav7_write, .resetfn = pmsav7_reset },
123
{ .name = "RGNR", .cp = 15, .crn = 6, .opc1 = 0, .crm = 2, .opc2 = 0,
124
.access = PL1_RW,
125
- .fieldoffset = offsetof(CPUARMState, cp15.c6_rgnr),
126
+ .fieldoffset = offsetof(CPUARMState, pmsav7.rnr),
127
.writefn = pmsav7_rgnr_write },
128
REGINFO_SENTINEL
129
};
130
diff --git a/target/arm/machine.c b/target/arm/machine.c
131
index XXXXXXX..XXXXXXX 100644
132
--- a/target/arm/machine.c
133
+++ b/target/arm/machine.c
134
@@ -XXX,XX +XXX,XX @@ static bool pmsav7_rgnr_vmstate_validate(void *opaque, int version_id)
135
{
136
ARMCPU *cpu = opaque;
137
138
- return cpu->env.cp15.c6_rgnr < cpu->pmsav7_dregion;
139
+ return cpu->env.pmsav7.rnr < cpu->pmsav7_dregion;
140
}
141
142
static const VMStateDescription vmstate_pmsav7 = {
143
--
27
--
144
2.7.4
28
2.25.1
145
146
diff view generated by jsdifflib
1
When the PMSAv7 implementation was originally added it was for R profile
1
From: Richard Henderson <richard.henderson@linaro.org>
2
CPUs only, and reset was handled using the cpreg .resetfn hooks.
3
Unfortunately for M profile cores this doesn't work, because they do
4
not register any cpregs. Move the reset handling into arm_cpu_reset(),
5
where it will work for both R profile and M profile cores.
6
2
3
Because we weren't setting this flag, our probe of ID_AA64ZFR0
4
was always returning zero. This also obviates the adjustment
5
of ID_AA64PFR0, which had sanitized the SVE field.
6
7
The effects of the bug are not visible, because the only thing that
8
ID_AA64ZFR0 is used for within qemu at present is tcg translation.
9
The other tests for SVE within KVM are via ID_AA64PFR0.SVE.
10
11
Reported-by: Zenghui Yu <yuzenghui@huawei.com>
12
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
13
Message-id: 20220726045828.53697-3-richard.henderson@linaro.org
14
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
15
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
9
Message-id: 1501153150-19984-5-git-send-email-peter.maydell@linaro.org
10
---
16
---
11
target/arm/cpu.c | 14 ++++++++++++++
17
target/arm/kvm64.c | 27 +++++++++++++--------------
12
target/arm/helper.c | 28 ++++++++++++----------------
18
1 file changed, 13 insertions(+), 14 deletions(-)
13
2 files changed, 26 insertions(+), 16 deletions(-)
14
19
15
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
20
diff --git a/target/arm/kvm64.c b/target/arm/kvm64.c
16
index XXXXXXX..XXXXXXX 100644
21
index XXXXXXX..XXXXXXX 100644
17
--- a/target/arm/cpu.c
22
--- a/target/arm/kvm64.c
18
+++ b/target/arm/cpu.c
23
+++ b/target/arm/kvm64.c
19
@@ -XXX,XX +XXX,XX @@ static void arm_cpu_reset(CPUState *s)
24
@@ -XXX,XX +XXX,XX @@ bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf)
20
25
bool sve_supported;
21
env->vfp.xregs[ARM_VFP_FPEXC] = 0;
26
bool pmu_supported = false;
22
#endif
27
uint64_t features = 0;
23
+
28
- uint64_t t;
24
+ if (arm_feature(env, ARM_FEATURE_PMSA) &&
29
int err;
25
+ arm_feature(env, ARM_FEATURE_V7)) {
30
26
+ if (cpu->pmsav7_dregion > 0) {
31
/* Old kernels may not know about the PREFERRED_TARGET ioctl: however
27
+ memset(env->pmsav7.drbar, 0,
32
@@ -XXX,XX +XXX,XX @@ bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf)
28
+ sizeof(*env->pmsav7.drbar) * cpu->pmsav7_dregion);
33
struct kvm_vcpu_init init = { .target = -1, };
29
+ memset(env->pmsav7.drsr, 0,
34
30
+ sizeof(*env->pmsav7.drsr) * cpu->pmsav7_dregion);
35
/*
31
+ memset(env->pmsav7.dracr, 0,
36
- * Ask for Pointer Authentication if supported. We can't play the
32
+ sizeof(*env->pmsav7.dracr) * cpu->pmsav7_dregion);
37
- * SVE trick of synthesising the ID reg as KVM won't tell us
33
+ }
38
- * whether we have the architected or IMPDEF version of PAuth, so
34
+ env->pmsav7.rnr = 0;
39
- * we have to use the actual ID regs.
40
+ * Ask for SVE if supported, so that we can query ID_AA64ZFR0,
41
+ * which is otherwise RAZ.
42
+ */
43
+ sve_supported = kvm_arm_sve_supported();
44
+ if (sve_supported) {
45
+ init.features[0] |= 1 << KVM_ARM_VCPU_SVE;
35
+ }
46
+ }
36
+
47
+
37
set_flush_to_zero(1, &env->vfp.standard_fp_status);
48
+ /*
38
set_flush_inputs_to_zero(1, &env->vfp.standard_fp_status);
49
+ * Ask for Pointer Authentication if supported, so that we get
39
set_default_nan_mode(1, &env->vfp.standard_fp_status);
50
+ * the unsanitized field values for AA64ISAR1_EL1.
40
diff --git a/target/arm/helper.c b/target/arm/helper.c
51
*/
41
index XXXXXXX..XXXXXXX 100644
52
if (kvm_arm_pauth_supported()) {
42
--- a/target/arm/helper.c
53
init.features[0] |= (1 << KVM_ARM_VCPU_PTRAUTH_ADDRESS |
43
+++ b/target/arm/helper.c
54
@@ -XXX,XX +XXX,XX @@ bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf)
44
@@ -XXX,XX +XXX,XX @@ static void pmsav7_write(CPUARMState *env, const ARMCPRegInfo *ri,
55
}
45
*u32p = value;
56
}
46
}
57
47
58
- sve_supported = kvm_arm_sve_supported();
48
-static void pmsav7_reset(CPUARMState *env, const ARMCPRegInfo *ri)
49
-{
50
- ARMCPU *cpu = arm_env_get_cpu(env);
51
- uint32_t *u32p = *(uint32_t **)raw_ptr(env, ri);
52
-
59
-
53
- if (!u32p) {
60
- /* Add feature bits that can't appear until after VCPU init. */
54
- return;
61
if (sve_supported) {
55
- }
62
- t = ahcf->isar.id_aa64pfr0;
63
- t = FIELD_DP64(t, ID_AA64PFR0, SVE, 1);
64
- ahcf->isar.id_aa64pfr0 = t;
56
-
65
-
57
- memset(u32p, 0, sizeof(*u32p) * cpu->pmsav7_dregion);
66
/*
58
-}
67
* There is a range of kernels between kernel commit 73433762fcae
59
-
68
* and f81cb2c3ad41 which have a bug where the kernel doesn't expose
60
static void pmsav7_rgnr_write(CPUARMState *env, const ARMCPRegInfo *ri,
69
* SYS_ID_AA64ZFR0_EL1 via the ONE_REG API unless the VM has enabled
61
uint64_t value)
70
- * SVE support, so we only read it here, rather than together with all
62
{
71
- * the other ID registers earlier.
63
@@ -XXX,XX +XXX,XX @@ static void pmsav7_rgnr_write(CPUARMState *env, const ARMCPRegInfo *ri,
72
+ * SVE support, which resulted in an error rather than RAZ.
64
}
73
+ * So only read the register if we set KVM_ARM_VCPU_SVE above.
65
74
*/
66
static const ARMCPRegInfo pmsav7_cp_reginfo[] = {
75
err |= read_sys_reg64(fdarray[2], &ahcf->isar.id_aa64zfr0,
67
+ /* Reset for all these registers is handled in arm_cpu_reset(),
76
ARM64_SYS_REG(3, 0, 0, 4, 4));
68
+ * because the PMSAv7 is also used by M-profile CPUs, which do
69
+ * not register cpregs but still need the state to be reset.
70
+ */
71
{ .name = "DRBAR", .cp = 15, .crn = 6, .opc1 = 0, .crm = 1, .opc2 = 0,
72
.access = PL1_RW, .type = ARM_CP_NO_RAW,
73
.fieldoffset = offsetof(CPUARMState, pmsav7.drbar),
74
- .readfn = pmsav7_read, .writefn = pmsav7_write, .resetfn = pmsav7_reset },
75
+ .readfn = pmsav7_read, .writefn = pmsav7_write,
76
+ .resetfn = arm_cp_reset_ignore },
77
{ .name = "DRSR", .cp = 15, .crn = 6, .opc1 = 0, .crm = 1, .opc2 = 2,
78
.access = PL1_RW, .type = ARM_CP_NO_RAW,
79
.fieldoffset = offsetof(CPUARMState, pmsav7.drsr),
80
- .readfn = pmsav7_read, .writefn = pmsav7_write, .resetfn = pmsav7_reset },
81
+ .readfn = pmsav7_read, .writefn = pmsav7_write,
82
+ .resetfn = arm_cp_reset_ignore },
83
{ .name = "DRACR", .cp = 15, .crn = 6, .opc1 = 0, .crm = 1, .opc2 = 4,
84
.access = PL1_RW, .type = ARM_CP_NO_RAW,
85
.fieldoffset = offsetof(CPUARMState, pmsav7.dracr),
86
- .readfn = pmsav7_read, .writefn = pmsav7_write, .resetfn = pmsav7_reset },
87
+ .readfn = pmsav7_read, .writefn = pmsav7_write,
88
+ .resetfn = arm_cp_reset_ignore },
89
{ .name = "RGNR", .cp = 15, .crn = 6, .opc1 = 0, .crm = 2, .opc2 = 0,
90
.access = PL1_RW,
91
.fieldoffset = offsetof(CPUARMState, pmsav7.rnr),
92
- .writefn = pmsav7_rgnr_write },
93
+ .writefn = pmsav7_rgnr_write,
94
+ .resetfn = arm_cp_reset_ignore },
95
REGINFO_SENTINEL
96
};
97
98
--
77
--
99
2.7.4
78
2.25.1
100
101
diff view generated by jsdifflib
Deleted patch
1
The PMSAv7 region number register is migrated for R profile
2
cores using the cpreg scheme, but M profile doesn't use
3
cpregs, and so we weren't migrating the MPU_RNR register state
4
at all. Fix that by adding a migration subsection for the
5
M profile case.
6
1
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
9
Message-id: 1501153150-19984-6-git-send-email-peter.maydell@linaro.org
10
---
11
target/arm/machine.c | 28 ++++++++++++++++++++++++++++
12
1 file changed, 28 insertions(+)
13
14
diff --git a/target/arm/machine.c b/target/arm/machine.c
15
index XXXXXXX..XXXXXXX 100644
16
--- a/target/arm/machine.c
17
+++ b/target/arm/machine.c
18
@@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_pmsav7 = {
19
}
20
};
21
22
+static bool pmsav7_rnr_needed(void *opaque)
23
+{
24
+ ARMCPU *cpu = opaque;
25
+ CPUARMState *env = &cpu->env;
26
+
27
+ /* For R profile cores pmsav7.rnr is migrated via the cpreg
28
+ * "RGNR" definition in helper.h. For M profile we have to
29
+ * migrate it separately.
30
+ */
31
+ return arm_feature(env, ARM_FEATURE_M);
32
+}
33
+
34
+static const VMStateDescription vmstate_pmsav7_rnr = {
35
+ .name = "cpu/pmsav7-rnr",
36
+ .version_id = 1,
37
+ .minimum_version_id = 1,
38
+ .needed = pmsav7_rnr_needed,
39
+ .fields = (VMStateField[]) {
40
+ VMSTATE_UINT32(env.pmsav7.rnr, ARMCPU),
41
+ VMSTATE_END_OF_LIST()
42
+ }
43
+};
44
+
45
static int get_cpsr(QEMUFile *f, void *opaque, size_t size,
46
VMStateField *field)
47
{
48
@@ -XXX,XX +XXX,XX @@ const VMStateDescription vmstate_arm_cpu = {
49
&vmstate_iwmmxt,
50
&vmstate_m,
51
&vmstate_thumb2ee,
52
+ /* pmsav7_rnr must come before pmsav7 so that we have the
53
+ * region number before we test it in the VMSTATE_VALIDATE
54
+ * in vmstate_pmsav7.
55
+ */
56
+ &vmstate_pmsav7_rnr,
57
&vmstate_pmsav7,
58
NULL
59
}
60
--
61
2.7.4
62
63
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
1
From: Richard Henderson <richard.henderson@linaro.org>
2
2
3
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
3
The test for the IF block indicates no ID registers are exposed, much
4
Message-id: 20170729234930.725-1-f4bug@amsat.org
4
less host support for SVE. Move the SVE probe into the ELSE block.
5
6
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
7
Message-id: 20220726045828.53697-4-richard.henderson@linaro.org
5
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
8
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
6
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7
---
10
---
8
hw/misc/mps2-scc.c | 4 ++--
11
target/arm/kvm64.c | 22 +++++++++++-----------
9
1 file changed, 2 insertions(+), 2 deletions(-)
12
1 file changed, 11 insertions(+), 11 deletions(-)
10
13
11
diff --git a/hw/misc/mps2-scc.c b/hw/misc/mps2-scc.c
14
diff --git a/target/arm/kvm64.c b/target/arm/kvm64.c
12
index XXXXXXX..XXXXXXX 100644
15
index XXXXXXX..XXXXXXX 100644
13
--- a/hw/misc/mps2-scc.c
16
--- a/target/arm/kvm64.c
14
+++ b/hw/misc/mps2-scc.c
17
+++ b/target/arm/kvm64.c
15
@@ -XXX,XX +XXX,XX @@ static Property mps2_scc_properties[] = {
18
@@ -XXX,XX +XXX,XX @@ bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf)
16
/* Values for various read-only ID registers (which are specific
19
err |= read_sys_reg64(fdarray[2], &ahcf->isar.reset_pmcr_el0,
17
* to the board model or FPGA image)
20
ARM64_SYS_REG(3, 3, 9, 12, 0));
18
*/
21
}
19
- DEFINE_PROP_UINT32("scc-cfg4", MPS2SCC, aid, 0),
22
- }
20
+ DEFINE_PROP_UINT32("scc-cfg4", MPS2SCC, cfg4, 0),
23
21
DEFINE_PROP_UINT32("scc-aid", MPS2SCC, aid, 0),
24
- if (sve_supported) {
22
- DEFINE_PROP_UINT32("scc-id", MPS2SCC, aid, 0),
25
- /*
23
+ DEFINE_PROP_UINT32("scc-id", MPS2SCC, id, 0),
26
- * There is a range of kernels between kernel commit 73433762fcae
24
/* These are the initial settings for the source clocks on the board.
27
- * and f81cb2c3ad41 which have a bug where the kernel doesn't expose
25
* In hardware they can be configured via a config file read by the
28
- * SYS_ID_AA64ZFR0_EL1 via the ONE_REG API unless the VM has enabled
26
* motherboard configuration controller to suit the FPGA image.
29
- * SVE support, which resulted in an error rather than RAZ.
30
- * So only read the register if we set KVM_ARM_VCPU_SVE above.
31
- */
32
- err |= read_sys_reg64(fdarray[2], &ahcf->isar.id_aa64zfr0,
33
- ARM64_SYS_REG(3, 0, 0, 4, 4));
34
+ if (sve_supported) {
35
+ /*
36
+ * There is a range of kernels between kernel commit 73433762fcae
37
+ * and f81cb2c3ad41 which have a bug where the kernel doesn't
38
+ * expose SYS_ID_AA64ZFR0_EL1 via the ONE_REG API unless the VM has
39
+ * enabled SVE support, which resulted in an error rather than RAZ.
40
+ * So only read the register if we set KVM_ARM_VCPU_SVE above.
41
+ */
42
+ err |= read_sys_reg64(fdarray[2], &ahcf->isar.id_aa64zfr0,
43
+ ARM64_SYS_REG(3, 0, 0, 4, 4));
44
+ }
45
}
46
47
kvm_arm_destroy_scratch_host_vcpu(fdarray);
27
--
48
--
28
2.7.4
49
2.25.1
29
30
diff view generated by jsdifflib