1
ARM queue, mostly bug fixes to go into rc0.
1
ARM queue for 2.10: all M profile bugfixes...
2
The integratorcp and fsl_imx* changes are migration
3
compat breakers but that's ok for these boards.
4
2
5
thanks
3
thanks
6
-- PMM
4
-- PMM
7
5
6
The following changes since commit 25dd0e77898c3e10796d4cbeb35e8af5ba6ce975:
8
7
9
The following changes since commit ce1d20aac8533357650774c2c240e30de87dc122:
8
Merge remote-tracking branch 'remotes/mjt/tags/trivial-patches-fetch' into staging (2017-07-31 11:27:43 +0100)
10
11
Merge remote-tracking branch 'remotes/ericb/tags/pull-nbd-2017-07-24' into staging (2017-07-24 16:20:47 +0100)
12
9
13
are available in the git repository at:
10
are available in the git repository at:
14
11
15
git://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20170724
12
git://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20170731
16
13
17
for you to fetch changes up to b2d1b0507d1b80f23da12dd8aab56944fe380a09:
14
for you to fetch changes up to 89cbc3778a3d61761e2231e740269218c9a8a41d:
18
15
19
integratorcp: Don't migrate flash using vmstate_register_ram_global() (2017-07-24 17:59:28 +0100)
16
hw/mps2_scc: fix incorrect properties (2017-07-31 13:11:56 +0100)
20
17
21
----------------------------------------------------------------
18
----------------------------------------------------------------
22
target-arm queue:
19
target-arm queue:
23
* fix a TCG temporary leak in aarch64 rev16
20
* fix broken properties on MPS2 SCC device
24
* fsl_imx*: migrate the ROM contents
21
* fix MPU trace handling of write vs exec
25
* integratorcp: don't use vmstate_register_ram_global for flash
22
* fix MPU M profile bugs:
26
* mps2: Correctly set parent bus for SCC device
23
- not handling system space or PPB region correctly
24
- not resetting state
25
- not migrating MPU_RNR
27
26
28
----------------------------------------------------------------
27
----------------------------------------------------------------
29
Emilio G. Cota (1):
28
Peter Maydell (6):
30
target/arm: fix TCG temp leak in aarch64 rev16
29
target/arm: Correct MPU trace handling of write vs execute
30
target/arm: Don't do MPU lookups for addresses in M profile PPB region
31
target/arm: Don't allow guest to make System space executable for M profile
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
31
35
32
Peter Maydell (3):
36
Philippe Mathieu-Daudé (1):
33
fsl_imx*: Migrate ROM contents
37
hw/mps2_scc: fix incorrect properties
34
mps2: Correctly set parent bus for SCC device
35
integratorcp: Don't migrate flash using vmstate_register_ram_global()
36
38
37
hw/arm/fsl-imx25.c | 4 ++--
39
target/arm/cpu.h | 3 +--
38
hw/arm/fsl-imx31.c | 4 ++--
40
hw/intc/armv7m_nvic.c | 14 +++++-----
39
hw/arm/fsl-imx6.c | 4 ++--
41
hw/misc/mps2-scc.c | 4 +--
40
hw/arm/integratorcp.c | 3 +--
42
target/arm/cpu.c | 14 ++++++++++
41
hw/arm/mps2.c | 2 +-
43
target/arm/helper.c | 71 ++++++++++++++++++++++++++++++++++-----------------
42
target/arm/translate-a64.c | 1 +
44
target/arm/machine.c | 30 +++++++++++++++++++++-
43
6 files changed, 9 insertions(+), 9 deletions(-)
45
6 files changed, 101 insertions(+), 35 deletions(-)
44
46
diff view generated by jsdifflib
New 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".
1
4
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
New 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).
1
6
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
New 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.
1
4
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
The fsl-imx* boards accidentally forgot to register the ROM memory
1
Almost all of the PMSAv7 state is in the pmsav7 substruct of
2
regions for migration. This used to require a manual step of calling
2
the ARM CPU state structure. The exception is the region
3
vmstate_register_ram(), but following commits
3
number register, which is in cp15.c6_rgnr. This exception
4
1cfe48c1ce21..b08199c6fbea194 we can use memory_region_init_rom() to
4
is a bit odd for M profile, which otherwise generally does
5
have it do the migration for us.
5
not store state in the cp15 substruct.
6
6
7
This is a migration break, but the migration code currently does not
7
Rename cp15.c6_rgnr to pmsav7.rnr accordingly.
8
handle the case of having two RAM regions which were not registered
9
for migration, and so prior to this commit a migration load would
10
always fail with:
11
"qemu-system-arm: Length mismatch: 0x4000 in != 0x18000: Invalid argument"
12
13
NB: migration appears at this point to be broken for this board
14
anyway -- it succeeds but the destination hangs; probably some
15
device in the system does not yet support migration.
16
8
17
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
18
Message-id: 1500309775-18361-1-git-send-email-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
19
---
12
---
20
hw/arm/fsl-imx25.c | 4 ++--
13
target/arm/cpu.h | 3 +--
21
hw/arm/fsl-imx31.c | 4 ++--
14
hw/intc/armv7m_nvic.c | 14 +++++++-------
22
hw/arm/fsl-imx6.c | 4 ++--
15
target/arm/helper.c | 6 +++---
23
3 files changed, 6 insertions(+), 6 deletions(-)
16
target/arm/machine.c | 2 +-
17
4 files changed, 12 insertions(+), 13 deletions(-)
24
18
25
diff --git a/hw/arm/fsl-imx25.c b/hw/arm/fsl-imx25.c
19
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
26
index XXXXXXX..XXXXXXX 100644
20
index XXXXXXX..XXXXXXX 100644
27
--- a/hw/arm/fsl-imx25.c
21
--- a/target/arm/cpu.h
28
+++ b/hw/arm/fsl-imx25.c
22
+++ b/target/arm/cpu.h
29
@@ -XXX,XX +XXX,XX @@ static void fsl_imx25_realize(DeviceState *dev, Error **errp)
23
@@ -XXX,XX +XXX,XX @@ typedef struct CPUARMState {
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
}
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;
30
}
105
}
31
106
32
/* initialize 2 x 16 KB ROM */
107
- u32p += env->cp15.c6_rgnr;
33
- memory_region_init_rom_nomigrate(&s->rom[0], NULL,
108
+ u32p += env->pmsav7.rnr;
34
+ memory_region_init_rom(&s->rom[0], NULL,
109
return *u32p;
35
"imx25.rom0", FSL_IMX25_ROM0_SIZE, &err);
110
}
36
if (err) {
111
37
error_propagate(errp, err);
112
@@ -XXX,XX +XXX,XX @@ static void pmsav7_write(CPUARMState *env, const ARMCPRegInfo *ri,
38
@@ -XXX,XX +XXX,XX @@ static void fsl_imx25_realize(DeviceState *dev, Error **errp)
113
return;
39
}
114
}
40
memory_region_add_subregion(get_system_memory(), FSL_IMX25_ROM0_ADDR,
115
41
&s->rom[0]);
116
- u32p += env->cp15.c6_rgnr;
42
- memory_region_init_rom_nomigrate(&s->rom[1], NULL,
117
+ u32p += env->pmsav7.rnr;
43
+ memory_region_init_rom(&s->rom[1], NULL,
118
tlb_flush(CPU(cpu)); /* Mappings may have changed - purge! */
44
"imx25.rom1", FSL_IMX25_ROM1_SIZE, &err);
119
*u32p = value;
45
if (err) {
120
}
46
error_propagate(errp, err);
121
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo pmsav7_cp_reginfo[] = {
47
diff --git a/hw/arm/fsl-imx31.c b/hw/arm/fsl-imx31.c
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
48
index XXXXXXX..XXXXXXX 100644
131
index XXXXXXX..XXXXXXX 100644
49
--- a/hw/arm/fsl-imx31.c
132
--- a/target/arm/machine.c
50
+++ b/hw/arm/fsl-imx31.c
133
+++ b/target/arm/machine.c
51
@@ -XXX,XX +XXX,XX @@ static void fsl_imx31_realize(DeviceState *dev, Error **errp)
134
@@ -XXX,XX +XXX,XX @@ static bool pmsav7_rgnr_vmstate_validate(void *opaque, int version_id)
52
}
135
{
53
136
ARMCPU *cpu = opaque;
54
/* On a real system, the first 16k is a `secure boot rom' */
137
55
- memory_region_init_rom_nomigrate(&s->secure_rom, NULL, "imx31.secure_rom",
138
- return cpu->env.cp15.c6_rgnr < cpu->pmsav7_dregion;
56
+ memory_region_init_rom(&s->secure_rom, NULL, "imx31.secure_rom",
139
+ return cpu->env.pmsav7.rnr < cpu->pmsav7_dregion;
57
FSL_IMX31_SECURE_ROM_SIZE, &err);
140
}
58
if (err) {
141
59
error_propagate(errp, err);
142
static const VMStateDescription vmstate_pmsav7 = {
60
@@ -XXX,XX +XXX,XX @@ static void fsl_imx31_realize(DeviceState *dev, Error **errp)
61
&s->secure_rom);
62
63
/* There is also a 16k ROM */
64
- memory_region_init_rom_nomigrate(&s->rom, NULL, "imx31.rom",
65
+ memory_region_init_rom(&s->rom, NULL, "imx31.rom",
66
FSL_IMX31_ROM_SIZE, &err);
67
if (err) {
68
error_propagate(errp, err);
69
diff --git a/hw/arm/fsl-imx6.c b/hw/arm/fsl-imx6.c
70
index XXXXXXX..XXXXXXX 100644
71
--- a/hw/arm/fsl-imx6.c
72
+++ b/hw/arm/fsl-imx6.c
73
@@ -XXX,XX +XXX,XX @@ static void fsl_imx6_realize(DeviceState *dev, Error **errp)
74
FSL_IMX6_ENET_MAC_1588_IRQ));
75
76
/* ROM memory */
77
- memory_region_init_rom_nomigrate(&s->rom, NULL, "imx6.rom",
78
+ memory_region_init_rom(&s->rom, NULL, "imx6.rom",
79
FSL_IMX6_ROM_SIZE, &err);
80
if (err) {
81
error_propagate(errp, err);
82
@@ -XXX,XX +XXX,XX @@ static void fsl_imx6_realize(DeviceState *dev, Error **errp)
83
&s->rom);
84
85
/* CAAM memory */
86
- memory_region_init_rom_nomigrate(&s->caam, NULL, "imx6.caam",
87
+ memory_region_init_rom(&s->caam, NULL, "imx6.caam",
88
FSL_IMX6_CAAM_MEM_SIZE, &err);
89
if (err) {
90
error_propagate(errp, err);
91
--
143
--
92
2.7.4
144
2.7.4
93
145
94
146
diff view generated by jsdifflib
1
Instead of migrating the flash by creating the memory region
1
When the PMSAv7 implementation was originally added it was for R profile
2
with memory_region_init_ram_nomigrate() and then calling
2
CPUs only, and reset was handled using the cpreg .resetfn hooks.
3
vmstate_register_ram_global(), just use memory_region_init_ram(),
3
Unfortunately for M profile cores this doesn't work, because they do
4
which now handles migration registration automatically.
4
not register any cpregs. Move the reset handling into arm_cpu_reset(),
5
5
where it will work for both R profile and M profile cores.
6
This is a migration compatibility break for the integratorcp
7
board, because the RAM region's migration name changes to
8
include the device path. This is OK because we don't guarantee
9
migration compatibility for this board.
10
6
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
Message-id: 1500310341-28931-1-git-send-email-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
13
---
10
---
14
hw/arm/integratorcp.c | 3 +--
11
target/arm/cpu.c | 14 ++++++++++++++
15
1 file changed, 1 insertion(+), 2 deletions(-)
12
target/arm/helper.c | 28 ++++++++++++----------------
13
2 files changed, 26 insertions(+), 16 deletions(-)
16
14
17
diff --git a/hw/arm/integratorcp.c b/hw/arm/integratorcp.c
15
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
18
index XXXXXXX..XXXXXXX 100644
16
index XXXXXXX..XXXXXXX 100644
19
--- a/hw/arm/integratorcp.c
17
--- a/target/arm/cpu.c
20
+++ b/hw/arm/integratorcp.c
18
+++ b/target/arm/cpu.c
21
@@ -XXX,XX +XXX,XX @@ static void integratorcm_init(Object *obj)
19
@@ -XXX,XX +XXX,XX @@ static void arm_cpu_reset(CPUState *s)
22
s->cm_init = 0x00000112;
20
23
s->cm_refcnt_offset = muldiv64(qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL), 24,
21
env->vfp.xregs[ARM_VFP_FPEXC] = 0;
24
1000);
22
#endif
25
- memory_region_init_ram_nomigrate(&s->flash, obj, "integrator.flash", 0x100000,
23
+
26
+ memory_region_init_ram(&s->flash, obj, "integrator.flash", 0x100000,
24
+ if (arm_feature(env, ARM_FEATURE_PMSA) &&
27
&error_fatal);
25
+ arm_feature(env, ARM_FEATURE_V7)) {
28
- vmstate_register_ram_global(&s->flash);
26
+ if (cpu->pmsav7_dregion > 0) {
29
27
+ memset(env->pmsav7.drbar, 0,
30
memory_region_init_io(&s->iomem, obj, &integratorcm_ops, s,
28
+ sizeof(*env->pmsav7.drbar) * cpu->pmsav7_dregion);
31
"integratorcm", 0x00800000);
29
+ memset(env->pmsav7.drsr, 0,
30
+ sizeof(*env->pmsav7.drsr) * cpu->pmsav7_dregion);
31
+ memset(env->pmsav7.dracr, 0,
32
+ sizeof(*env->pmsav7.dracr) * cpu->pmsav7_dregion);
33
+ }
34
+ env->pmsav7.rnr = 0;
35
+ }
36
+
37
set_flush_to_zero(1, &env->vfp.standard_fp_status);
38
set_flush_inputs_to_zero(1, &env->vfp.standard_fp_status);
39
set_default_nan_mode(1, &env->vfp.standard_fp_status);
40
diff --git a/target/arm/helper.c b/target/arm/helper.c
41
index XXXXXXX..XXXXXXX 100644
42
--- a/target/arm/helper.c
43
+++ b/target/arm/helper.c
44
@@ -XXX,XX +XXX,XX @@ static void pmsav7_write(CPUARMState *env, const ARMCPRegInfo *ri,
45
*u32p = value;
46
}
47
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
-
53
- if (!u32p) {
54
- return;
55
- }
56
-
57
- memset(u32p, 0, sizeof(*u32p) * cpu->pmsav7_dregion);
58
-}
59
-
60
static void pmsav7_rgnr_write(CPUARMState *env, const ARMCPRegInfo *ri,
61
uint64_t value)
62
{
63
@@ -XXX,XX +XXX,XX @@ static void pmsav7_rgnr_write(CPUARMState *env, const ARMCPRegInfo *ri,
64
}
65
66
static const ARMCPRegInfo pmsav7_cp_reginfo[] = {
67
+ /* Reset for all these registers is handled in arm_cpu_reset(),
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
32
--
98
--
33
2.7.4
99
2.7.4
34
100
35
101
diff view generated by jsdifflib
1
A cut-and-paste error meant that instead of setting the
1
The PMSAv7 region number register is migrated for R profile
2
qdev parent bus for the SCC device we were setting it
2
cores using the cpreg scheme, but M profile doesn't use
3
twice for the ARMv7M container device. Fix this bug.
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.
4
6
5
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6
Message-id: 1500634509-28011-1-git-send-email-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
7
---
10
---
8
hw/arm/mps2.c | 2 +-
11
target/arm/machine.c | 28 ++++++++++++++++++++++++++++
9
1 file changed, 1 insertion(+), 1 deletion(-)
12
1 file changed, 28 insertions(+)
10
13
11
diff --git a/hw/arm/mps2.c b/hw/arm/mps2.c
14
diff --git a/target/arm/machine.c b/target/arm/machine.c
12
index XXXXXXX..XXXXXXX 100644
15
index XXXXXXX..XXXXXXX 100644
13
--- a/hw/arm/mps2.c
16
--- a/target/arm/machine.c
14
+++ b/hw/arm/mps2.c
17
+++ b/target/arm/machine.c
15
@@ -XXX,XX +XXX,XX @@ static void mps2_common_init(MachineState *machine)
18
@@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_pmsav7 = {
16
19
}
17
object_initialize(&mms->scc, sizeof(mms->scc), TYPE_MPS2_SCC);
20
};
18
sccdev = DEVICE(&mms->scc);
21
19
- qdev_set_parent_bus(armv7m, sysbus_get_default());
22
+static bool pmsav7_rnr_needed(void *opaque)
20
+ qdev_set_parent_bus(sccdev, sysbus_get_default());
23
+{
21
qdev_prop_set_uint32(sccdev, "scc-cfg4", 0x2);
24
+ ARMCPU *cpu = opaque;
22
qdev_prop_set_uint32(sccdev, "scc-aid", 0x02000008);
25
+ CPUARMState *env = &cpu->env;
23
qdev_prop_set_uint32(sccdev, "scc-id", mmc->scc_id);
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
}
24
--
60
--
25
2.7.4
61
2.7.4
26
62
27
63
diff view generated by jsdifflib
1
From: "Emilio G. Cota" <cota@braap.org>
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
2
2
3
Fix a TCG temporary leak in the new aarch64 rev16 handling.
3
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
4
4
Message-id: 20170729234930.725-1-f4bug@amsat.org
5
Signed-off-by: Emilio G. Cota <cota@braap.org>
6
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
5
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8
---
7
---
9
target/arm/translate-a64.c | 1 +
8
hw/misc/mps2-scc.c | 4 ++--
10
1 file changed, 1 insertion(+)
9
1 file changed, 2 insertions(+), 2 deletions(-)
11
10
12
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
11
diff --git a/hw/misc/mps2-scc.c b/hw/misc/mps2-scc.c
13
index XXXXXXX..XXXXXXX 100644
12
index XXXXXXX..XXXXXXX 100644
14
--- a/target/arm/translate-a64.c
13
--- a/hw/misc/mps2-scc.c
15
+++ b/target/arm/translate-a64.c
14
+++ b/hw/misc/mps2-scc.c
16
@@ -XXX,XX +XXX,XX @@ static void handle_rev16(DisasContext *s, unsigned int sf,
15
@@ -XXX,XX +XXX,XX @@ static Property mps2_scc_properties[] = {
17
tcg_gen_shli_i64(tcg_rd, tcg_rd, 8);
16
/* Values for various read-only ID registers (which are specific
18
tcg_gen_or_i64(tcg_rd, tcg_rd, tcg_tmp);
17
* to the board model or FPGA image)
19
18
*/
20
+ tcg_temp_free_i64(mask);
19
- DEFINE_PROP_UINT32("scc-cfg4", MPS2SCC, aid, 0),
21
tcg_temp_free_i64(tcg_tmp);
20
+ DEFINE_PROP_UINT32("scc-cfg4", MPS2SCC, cfg4, 0),
22
}
21
DEFINE_PROP_UINT32("scc-aid", MPS2SCC, aid, 0),
23
22
- DEFINE_PROP_UINT32("scc-id", MPS2SCC, aid, 0),
23
+ DEFINE_PROP_UINT32("scc-id", MPS2SCC, id, 0),
24
/* These are the initial settings for the source clocks on the board.
25
* In hardware they can be configured via a config file read by the
26
* motherboard configuration controller to suit the FPGA image.
24
--
27
--
25
2.7.4
28
2.7.4
26
29
27
30
diff view generated by jsdifflib