1
Arm patch queue -- these are all bug fix patches but we might
1
target-arm queue: this time around is all small fixes
2
as well put them in to rc0...
2
and changes.
3
3
4
thanks
4
thanks
5
-- PMM
5
-- PMM
6
6
7
The following changes since commit 2c8cfc0b52b5a4d123c26c0b5fdf941be24805be:
7
The following changes since commit fec105c2abda8567ec15230429c41429b5ee307c:
8
8
9
Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging (2018-03-19 11:44:26 +0000)
9
Merge remote-tracking branch 'remotes/kraxel/tags/audio-20190828-pull-request' into staging (2019-09-03 14:03:15 +0100)
10
10
11
are available in the Git repository at:
11
are available in the Git repository at:
12
12
13
git://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20180319
13
https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20190903
14
14
15
for you to fetch changes up to ff72cb6b46b95bb530787add5277c211af3d31c6:
15
for you to fetch changes up to 5e5584c89f36b302c666bc6db535fd3f7ff35ad2:
16
16
17
hw/arm/raspi: Provide spin-loop code for AArch64 CPUs (2018-03-19 18:23:24 +0000)
17
target/arm: Don't abort on M-profile exception return in linux-user mode (2019-09-03 16:20:35 +0100)
18
18
19
----------------------------------------------------------------
19
----------------------------------------------------------------
20
target-arm queue:
20
target-arm queue:
21
* fsl-imx6: Fix incorrect Ethernet interrupt defines
21
* Revert and correctly fix refactoring of unallocated_encoding()
22
* dump: Update correct kdump phys_base field for AArch64
22
* Take exceptions on ATS instructions when needed
23
* char: i.MX: Add support for "TX complete" interrupt
23
* aspeed/timer: Provide back-pressure information for short periods
24
* bcm2836/raspi: Fix various bugs resulting in panics trying
24
* memory: Remove unused memory_region_iommu_replay_all()
25
to boot a Debian Linux kernel on raspi3
25
* hw/arm/smmuv3: Log a guest error when decoding an invalid STE
26
* hw/arm/smmuv3: Remove spurious error messages on IOVA invalidations
27
* target/arm: Fix SMMLS argument order
28
* hw/arm: Use ARM_CPU_TYPE_NAME() macro when appropriate
29
* hw/arm: Correct reference counting for creation of various objects
30
* includes: remove stale [smp|max]_cpus externs
31
* tcg/README: fix typo
32
* atomic_template: fix indentation in GEN_ATOMIC_HELPER
33
* include/exec/cpu-defs.h: fix typo
34
* target/arm: Free TCG temps in trans_VMOV_64_sp()
35
* target/arm: Don't abort on M-profile exception return in linux-user mode
26
36
27
----------------------------------------------------------------
37
----------------------------------------------------------------
28
Andrey Smirnov (2):
38
Alex Bennée (2):
29
char: i.MX: Simplify imx_update()
39
includes: remove stale [smp|max]_cpus externs
30
char: i.MX: Add support for "TX complete" interrupt
40
include/exec/cpu-defs.h: fix typo
31
41
32
Guenter Roeck (1):
42
Andrew Jeffery (1):
33
fsl-imx6: Swap Ethernet interrupt defines
43
aspeed/timer: Provide back-pressure information for short periods
34
44
35
Peter Maydell (9):
45
Emilio G. Cota (2):
36
hw/arm/raspi: Don't do board-setup or secure-boot for raspi3
46
tcg/README: fix typo s/afterwise/afterwards/
37
hw/arm/boot: assert that secure_boot and secure_board_setup are false for AArch64
47
atomic_template: fix indentation in GEN_ATOMIC_HELPER
38
hw/arm/boot: If booting a kernel in EL2, set SCR_EL3.HCE
39
hw/arm/bcm2386: Fix parent type of bcm2386
40
hw/arm/bcm2836: Rename bcm2836 type/struct to bcm283x
41
hw/arm/bcm2836: Create proper bcm2837 device
42
hw/arm/bcm2836: Use correct affinity values for BCM2837
43
hw/arm/bcm2836: Hardcode correct CPU type
44
hw/arm/raspi: Provide spin-loop code for AArch64 CPUs
45
48
46
Wei Huang (1):
49
Eric Auger (3):
47
dump: Update correct kdump phys_base field for AArch64
50
memory: Remove unused memory_region_iommu_replay_all()
51
hw/arm/smmuv3: Log a guest error when decoding an invalid STE
52
hw/arm/smmuv3: Remove spurious error messages on IOVA invalidations
48
53
49
include/hw/arm/bcm2836.h | 31 +++++++++++++---
54
Peter Maydell (4):
50
include/hw/arm/fsl-imx6.h | 4 +-
55
target/arm: Allow ARMCPRegInfo read/write functions to throw exceptions
51
include/hw/char/imx_serial.h | 3 ++
56
target/arm: Take exceptions on ATS instructions when needed
52
dump.c | 14 +++++--
57
target/arm: Free TCG temps in trans_VMOV_64_sp()
53
hw/arm/bcm2836.c | 87 +++++++++++++++++++++++++++++++-------------
58
target/arm: Don't abort on M-profile exception return in linux-user mode
54
hw/arm/boot.c | 12 ++++++
55
hw/arm/raspi.c | 77 +++++++++++++++++++++++++++++++--------
56
hw/char/imx_serial.c | 44 ++++++++++++++++------
57
hw/net/imx_fec.c | 28 +++++++++++++-
58
9 files changed, 237 insertions(+), 63 deletions(-)
59
59
60
Philippe Mathieu-Daudé (6):
61
hw/arm: Use ARM_CPU_TYPE_NAME() macro when appropriate
62
hw/arm: Use object_initialize_child for correct reference counting
63
hw/arm: Use sysbus_init_child_obj for correct reference counting
64
hw/arm/fsl-imx: Add the cpu as child of the SoC object
65
hw/dma/xilinx_axi: Use object_initialize_child for correct ref. counting
66
hw/net/xilinx_axi: Use object_initialize_child for correct ref. counting
67
68
Richard Henderson (3):
69
Revert "target/arm: Use unallocated_encoding for aarch32"
70
target/arm: Factor out unallocated_encoding for aarch32
71
target/arm: Fix SMMLS argument order
72
73
accel/tcg/atomic_template.h | 2 +-
74
hw/arm/smmuv3-internal.h | 1 +
75
include/exec/cpu-defs.h | 2 +-
76
include/exec/memory.h | 10 ----
77
include/sysemu/sysemu.h | 2 -
78
target/arm/cpu.h | 6 ++-
79
target/arm/translate-a64.h | 2 +
80
target/arm/translate.h | 2 -
81
hw/arm/allwinner-a10.c | 3 +-
82
hw/arm/cubieboard.c | 3 +-
83
hw/arm/digic.c | 3 +-
84
hw/arm/exynos4_boards.c | 4 +-
85
hw/arm/fsl-imx25.c | 4 +-
86
hw/arm/fsl-imx31.c | 4 +-
87
hw/arm/fsl-imx6.c | 3 +-
88
hw/arm/fsl-imx6ul.c | 2 +-
89
hw/arm/mcimx7d-sabre.c | 9 ++--
90
hw/arm/mps2-tz.c | 15 +++---
91
hw/arm/musca.c | 9 ++--
92
hw/arm/smmuv3.c | 18 ++++---
93
hw/arm/xlnx-zynqmp.c | 8 +--
94
hw/dma/xilinx_axidma.c | 16 +++---
95
hw/net/xilinx_axienet.c | 17 +++----
96
hw/timer/aspeed_timer.c | 17 ++++++-
97
memory.c | 9 ----
98
target/arm/helper.c | 107 +++++++++++++++++++++++++++++++++++------
99
target/arm/translate-a64.c | 13 +++++
100
target/arm/translate-vfp.inc.c | 2 +
101
target/arm/translate.c | 50 +++++++++++++++++--
102
tcg/README | 2 +-
103
30 files changed, 244 insertions(+), 101 deletions(-)
104
diff view generated by jsdifflib
1
The raspi3 has AArch64 CPUs, which means that our smpboot
1
From: Richard Henderson <richard.henderson@linaro.org>
2
code for keeping the secondary CPUs in a pen needs to have
3
a version for A64 as well as A32. Without this, the
4
secondary CPUs go into an infinite loop of taking undefined
5
instruction exceptions.
6
2
3
This reverts commit 3cb36637157088892e9e33ddb1034bffd1251d3b.
4
5
Despite the fact that the text for the call to gen_exception_insn
6
is identical for aarch64 and aarch32, the implementation inside
7
gen_exception_insn is totally different.
8
9
This fixes exceptions raised from aarch64.
10
11
Reported-by: Laurent Desnogues <laurent.desnogues@gmail.com>
12
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
13
Reviewed-by: Laurent Desnogues <laurent.desnogues@gmail.com>
14
Message-id: 20190826151536.6771-2-richard.henderson@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: 20180313153458.26822-10-peter.maydell@linaro.org
10
---
16
---
11
hw/arm/raspi.c | 41 ++++++++++++++++++++++++++++++++++++++++-
17
target/arm/translate-a64.h | 2 ++
12
1 file changed, 40 insertions(+), 1 deletion(-)
18
target/arm/translate.h | 2 --
19
target/arm/translate-a64.c | 7 +++++++
20
target/arm/translate-vfp.inc.c | 3 ++-
21
target/arm/translate.c | 22 ++++++++++------------
22
5 files changed, 21 insertions(+), 15 deletions(-)
13
23
14
diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c
24
diff --git a/target/arm/translate-a64.h b/target/arm/translate-a64.h
15
index XXXXXXX..XXXXXXX 100644
25
index XXXXXXX..XXXXXXX 100644
16
--- a/hw/arm/raspi.c
26
--- a/target/arm/translate-a64.h
17
+++ b/hw/arm/raspi.c
27
+++ b/target/arm/translate-a64.h
18
@@ -XXX,XX +XXX,XX @@
28
@@ -XXX,XX +XXX,XX @@
19
#define BOARDSETUP_ADDR (MVBAR_ADDR + 0x20) /* board setup code */
29
#ifndef TARGET_ARM_TRANSLATE_A64_H
20
#define FIRMWARE_ADDR_2 0x8000 /* Pi 2 loads kernel.img here by default */
30
#define TARGET_ARM_TRANSLATE_A64_H
21
#define FIRMWARE_ADDR_3 0x80000 /* Pi 3 loads kernel.img here by default */
31
22
+#define SPINTABLE_ADDR 0xd8 /* Pi 3 bootloader spintable */
32
+void unallocated_encoding(DisasContext *s);
23
33
+
24
/* Table of Linux board IDs for different Pi versions */
34
#define unsupported_encoding(s, insn) \
25
static const int raspi_boardid[] = {[1] = 0xc42, [2] = 0xc43, [3] = 0xc44};
35
do { \
26
@@ -XXX,XX +XXX,XX @@ static void write_smpboot(ARMCPU *cpu, const struct arm_boot_info *info)
36
qemu_log_mask(LOG_UNIMP, \
27
info->smp_loader_start);
37
diff --git a/target/arm/translate.h b/target/arm/translate.h
38
index XXXXXXX..XXXXXXX 100644
39
--- a/target/arm/translate.h
40
+++ b/target/arm/translate.h
41
@@ -XXX,XX +XXX,XX @@ typedef struct DisasCompare {
42
bool value_global;
43
} DisasCompare;
44
45
-void unallocated_encoding(DisasContext *s);
46
-
47
/* Share the TCG temporaries common between 32 and 64 bit modes. */
48
extern TCGv_i32 cpu_NF, cpu_ZF, cpu_CF, cpu_VF;
49
extern TCGv_i64 cpu_exclusive_addr;
50
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
51
index XXXXXXX..XXXXXXX 100644
52
--- a/target/arm/translate-a64.c
53
+++ b/target/arm/translate-a64.c
54
@@ -XXX,XX +XXX,XX @@ static inline void gen_goto_tb(DisasContext *s, int n, uint64_t dest)
55
}
28
}
56
}
29
57
30
+static void write_smpboot64(ARMCPU *cpu, const struct arm_boot_info *info)
58
+void unallocated_encoding(DisasContext *s)
31
+{
59
+{
32
+ /* Unlike the AArch32 version we don't need to call the board setup hook.
60
+ /* Unallocated and reserved encodings are uncategorized */
33
+ * The mechanism for doing the spin-table is also entirely different.
61
+ gen_exception_insn(s, s->pc_curr, EXCP_UDEF, syn_uncategorized(),
34
+ * We must have four 64-bit fields at absolute addresses
62
+ default_exception_el(s));
35
+ * 0xd8, 0xe0, 0xe8, 0xf0 in RAM, which are the flag variables for
36
+ * our CPUs, and which we must ensure are zero initialized before
37
+ * the primary CPU goes into the kernel. We put these variables inside
38
+ * a rom blob, so that the reset for ROM contents zeroes them for us.
39
+ */
40
+ static const uint32_t smpboot[] = {
41
+ 0xd2801b05, /* mov x5, 0xd8 */
42
+ 0xd53800a6, /* mrs x6, mpidr_el1 */
43
+ 0x924004c6, /* and x6, x6, #0x3 */
44
+ 0xd503205f, /* spin: wfe */
45
+ 0xf86678a4, /* ldr x4, [x5,x6,lsl #3] */
46
+ 0xb4ffffc4, /* cbz x4, spin */
47
+ 0xd2800000, /* mov x0, #0x0 */
48
+ 0xd2800001, /* mov x1, #0x0 */
49
+ 0xd2800002, /* mov x2, #0x0 */
50
+ 0xd2800003, /* mov x3, #0x0 */
51
+ 0xd61f0080, /* br x4 */
52
+ };
53
+
54
+ static const uint64_t spintables[] = {
55
+ 0, 0, 0, 0
56
+ };
57
+
58
+ rom_add_blob_fixed("raspi_smpboot", smpboot, sizeof(smpboot),
59
+ info->smp_loader_start);
60
+ rom_add_blob_fixed("raspi_spintables", spintables, sizeof(spintables),
61
+ SPINTABLE_ADDR);
62
+}
63
+}
63
+
64
+
64
static void write_board_setup(ARMCPU *cpu, const struct arm_boot_info *info)
65
static void init_tmp_a64_array(DisasContext *s)
65
{
66
{
66
arm_write_secure_board_setup_dummy_smc(cpu, info, MVBAR_ADDR);
67
#ifdef CONFIG_DEBUG_TCG
67
@@ -XXX,XX +XXX,XX @@ static void setup_boot(MachineState *machine, int version, size_t ram_size)
68
diff --git a/target/arm/translate-vfp.inc.c b/target/arm/translate-vfp.inc.c
68
/* Pi2 and Pi3 requires SMP setup */
69
index XXXXXXX..XXXXXXX 100644
69
if (version >= 2) {
70
--- a/target/arm/translate-vfp.inc.c
70
binfo.smp_loader_start = SMPBOOT_ADDR;
71
+++ b/target/arm/translate-vfp.inc.c
71
- binfo.write_secondary_boot = write_smpboot;
72
@@ -XXX,XX +XXX,XX @@ static bool full_vfp_access_check(DisasContext *s, bool ignore_vfp_enabled)
72
+ if (version == 2) {
73
73
+ binfo.write_secondary_boot = write_smpboot;
74
if (!s->vfp_enabled && !ignore_vfp_enabled) {
74
+ } else {
75
assert(!arm_dc_feature(s, ARM_FEATURE_M));
75
+ binfo.write_secondary_boot = write_smpboot64;
76
- unallocated_encoding(s);
76
+ }
77
+ gen_exception_insn(s, s->pc_curr, EXCP_UDEF, syn_uncategorized(),
77
binfo.secondary_cpu_reset_hook = reset_secondary;
78
+ default_exception_el(s));
79
return false;
78
}
80
}
79
81
82
diff --git a/target/arm/translate.c b/target/arm/translate.c
83
index XXXXXXX..XXXXXXX 100644
84
--- a/target/arm/translate.c
85
+++ b/target/arm/translate.c
86
@@ -XXX,XX +XXX,XX @@ static void gen_exception_bkpt_insn(DisasContext *s, uint32_t syn)
87
s->base.is_jmp = DISAS_NORETURN;
88
}
89
90
-void unallocated_encoding(DisasContext *s)
91
-{
92
- /* Unallocated and reserved encodings are uncategorized */
93
- gen_exception_insn(s, s->pc_curr, EXCP_UDEF, syn_uncategorized(),
94
- default_exception_el(s));
95
-}
96
-
97
/* Force a TB lookup after an instruction that changes the CPU state. */
98
static inline void gen_lookup_tb(DisasContext *s)
99
{
100
@@ -XXX,XX +XXX,XX @@ static inline void gen_hlt(DisasContext *s, int imm)
101
return;
102
}
103
104
- unallocated_encoding(s);
105
+ gen_exception_insn(s, s->pc_curr, EXCP_UDEF, syn_uncategorized(),
106
+ default_exception_el(s));
107
}
108
109
static inline void gen_add_data_offset(DisasContext *s, unsigned int insn,
110
@@ -XXX,XX +XXX,XX @@ static void gen_srs(DisasContext *s,
111
}
112
113
if (undef) {
114
- unallocated_encoding(s);
115
+ gen_exception_insn(s, s->pc_curr, EXCP_UDEF, syn_uncategorized(),
116
+ default_exception_el(s));
117
return;
118
}
119
120
@@ -XXX,XX +XXX,XX @@ static void disas_arm_insn(DisasContext *s, unsigned int insn)
121
break;
122
default:
123
illegal_op:
124
- unallocated_encoding(s);
125
+ gen_exception_insn(s, s->pc_curr, EXCP_UDEF, syn_uncategorized(),
126
+ default_exception_el(s));
127
break;
128
}
129
}
130
@@ -XXX,XX +XXX,XX @@ static void disas_thumb2_insn(DisasContext *s, uint32_t insn)
131
}
132
return;
133
illegal_op:
134
- unallocated_encoding(s);
135
+ gen_exception_insn(s, s->pc_curr, EXCP_UDEF, syn_uncategorized(),
136
+ default_exception_el(s));
137
}
138
139
static void disas_thumb_insn(DisasContext *s, uint32_t insn)
140
@@ -XXX,XX +XXX,XX @@ static void disas_thumb_insn(DisasContext *s, uint32_t insn)
141
return;
142
illegal_op:
143
undef:
144
- unallocated_encoding(s);
145
+ gen_exception_insn(s, s->pc_curr, EXCP_UDEF, syn_uncategorized(),
146
+ default_exception_el(s));
147
}
148
149
static bool insn_crosses_page(CPUARMState *env, DisasContext *s)
80
--
150
--
81
2.16.2
151
2.20.1
82
152
83
153
diff view generated by jsdifflib
1
Our BCM2836 type is really a generic one that can be any of
1
From: Richard Henderson <richard.henderson@linaro.org>
2
the bcm283x family. Rename it accordingly. We change only
3
the names which are visible via the header file to the
4
rest of the QEMU code, leaving private function names
5
in bcm2836.c as they are.
6
2
7
This is a preliminary to making bcm283x be an abstract
3
Make this a static function private to translate.c.
8
parent class to specific types for the bcm2836 and bcm2837.
4
Thus we can use the same idiom between aarch64 and aarch32
5
without actually sharing function implementations.
9
6
7
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8
Reviewed-by: Laurent Desnogues <laurent.desnogues@gmail.com>
9
Message-id: 20190826151536.6771-3-richard.henderson@linaro.org
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
Reviewed-by: Andrew Baumann <Andrew.Baumann@microsoft.com>
12
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
13
Message-id: 20180313153458.26822-6-peter.maydell@linaro.org
14
---
11
---
15
include/hw/arm/bcm2836.h | 12 ++++++------
12
target/arm/translate-vfp.inc.c | 3 +--
16
hw/arm/bcm2836.c | 17 +++++++++--------
13
target/arm/translate.c | 22 ++++++++++++----------
17
hw/arm/raspi.c | 16 ++++++++--------
14
2 files changed, 13 insertions(+), 12 deletions(-)
18
3 files changed, 23 insertions(+), 22 deletions(-)
19
15
20
diff --git a/include/hw/arm/bcm2836.h b/include/hw/arm/bcm2836.h
16
diff --git a/target/arm/translate-vfp.inc.c b/target/arm/translate-vfp.inc.c
21
index XXXXXXX..XXXXXXX 100644
17
index XXXXXXX..XXXXXXX 100644
22
--- a/include/hw/arm/bcm2836.h
18
--- a/target/arm/translate-vfp.inc.c
23
+++ b/include/hw/arm/bcm2836.h
19
+++ b/target/arm/translate-vfp.inc.c
24
@@ -XXX,XX +XXX,XX @@
20
@@ -XXX,XX +XXX,XX @@ static bool full_vfp_access_check(DisasContext *s, bool ignore_vfp_enabled)
25
#include "hw/arm/bcm2835_peripherals.h"
21
26
#include "hw/intc/bcm2836_control.h"
22
if (!s->vfp_enabled && !ignore_vfp_enabled) {
27
23
assert(!arm_dc_feature(s, ARM_FEATURE_M));
28
-#define TYPE_BCM2836 "bcm2836"
24
- gen_exception_insn(s, s->pc_curr, EXCP_UDEF, syn_uncategorized(),
29
-#define BCM2836(obj) OBJECT_CHECK(BCM2836State, (obj), TYPE_BCM2836)
25
- default_exception_el(s));
30
+#define TYPE_BCM283X "bcm283x"
26
+ unallocated_encoding(s);
31
+#define BCM283X(obj) OBJECT_CHECK(BCM283XState, (obj), TYPE_BCM283X)
27
return false;
32
28
}
33
-#define BCM2836_NCPUS 4
29
34
+#define BCM283X_NCPUS 4
30
diff --git a/target/arm/translate.c b/target/arm/translate.c
35
36
-typedef struct BCM2836State {
37
+typedef struct BCM283XState {
38
/*< private >*/
39
DeviceState parent_obj;
40
/*< public >*/
41
@@ -XXX,XX +XXX,XX @@ typedef struct BCM2836State {
42
char *cpu_type;
43
uint32_t enabled_cpus;
44
45
- ARMCPU cpus[BCM2836_NCPUS];
46
+ ARMCPU cpus[BCM283X_NCPUS];
47
BCM2836ControlState control;
48
BCM2835PeripheralState peripherals;
49
-} BCM2836State;
50
+} BCM283XState;
51
52
#endif /* BCM2836_H */
53
diff --git a/hw/arm/bcm2836.c b/hw/arm/bcm2836.c
54
index XXXXXXX..XXXXXXX 100644
31
index XXXXXXX..XXXXXXX 100644
55
--- a/hw/arm/bcm2836.c
32
--- a/target/arm/translate.c
56
+++ b/hw/arm/bcm2836.c
33
+++ b/target/arm/translate.c
57
@@ -XXX,XX +XXX,XX @@
34
@@ -XXX,XX +XXX,XX @@ static void gen_exception_bkpt_insn(DisasContext *s, uint32_t syn)
58
35
s->base.is_jmp = DISAS_NORETURN;
59
static void bcm2836_init(Object *obj)
36
}
37
38
+static void unallocated_encoding(DisasContext *s)
39
+{
40
+ /* Unallocated and reserved encodings are uncategorized */
41
+ gen_exception_insn(s, s->pc_curr, EXCP_UDEF, syn_uncategorized(),
42
+ default_exception_el(s));
43
+}
44
+
45
/* Force a TB lookup after an instruction that changes the CPU state. */
46
static inline void gen_lookup_tb(DisasContext *s)
60
{
47
{
61
- BCM2836State *s = BCM2836(obj);
48
@@ -XXX,XX +XXX,XX @@ static inline void gen_hlt(DisasContext *s, int imm)
62
+ BCM283XState *s = BCM283X(obj);
49
return;
63
50
}
64
object_initialize(&s->control, sizeof(s->control), TYPE_BCM2836_CONTROL);
51
65
object_property_add_child(obj, "control", OBJECT(&s->control), NULL);
52
- gen_exception_insn(s, s->pc_curr, EXCP_UDEF, syn_uncategorized(),
66
@@ -XXX,XX +XXX,XX @@ static void bcm2836_init(Object *obj)
53
- default_exception_el(s));
67
54
+ unallocated_encoding(s);
68
static void bcm2836_realize(DeviceState *dev, Error **errp)
69
{
70
- BCM2836State *s = BCM2836(dev);
71
+ BCM283XState *s = BCM283X(dev);
72
Object *obj;
73
Error *err = NULL;
74
int n;
75
@@ -XXX,XX +XXX,XX @@ static void bcm2836_realize(DeviceState *dev, Error **errp)
76
/* common peripherals from bcm2835 */
77
78
obj = OBJECT(dev);
79
- for (n = 0; n < BCM2836_NCPUS; n++) {
80
+ for (n = 0; n < BCM283X_NCPUS; n++) {
81
object_initialize(&s->cpus[n], sizeof(s->cpus[n]),
82
s->cpu_type);
83
object_property_add_child(obj, "cpu[*]", OBJECT(&s->cpus[n]),
84
@@ -XXX,XX +XXX,XX @@ static void bcm2836_realize(DeviceState *dev, Error **errp)
85
sysbus_connect_irq(SYS_BUS_DEVICE(&s->peripherals), 1,
86
qdev_get_gpio_in_named(DEVICE(&s->control), "gpu-fiq", 0));
87
88
- for (n = 0; n < BCM2836_NCPUS; n++) {
89
+ for (n = 0; n < BCM283X_NCPUS; n++) {
90
/* Mirror bcm2836, which has clusterid set to 0xf
91
* TODO: this should be converted to a property of ARM_CPU
92
*/
93
@@ -XXX,XX +XXX,XX @@ static void bcm2836_realize(DeviceState *dev, Error **errp)
94
}
55
}
95
56
96
static Property bcm2836_props[] = {
57
static inline void gen_add_data_offset(DisasContext *s, unsigned int insn,
97
- DEFINE_PROP_STRING("cpu-type", BCM2836State, cpu_type),
58
@@ -XXX,XX +XXX,XX @@ static void gen_srs(DisasContext *s,
98
- DEFINE_PROP_UINT32("enabled-cpus", BCM2836State, enabled_cpus, BCM2836_NCPUS),
59
}
99
+ DEFINE_PROP_STRING("cpu-type", BCM283XState, cpu_type),
60
100
+ DEFINE_PROP_UINT32("enabled-cpus", BCM283XState, enabled_cpus,
61
if (undef) {
101
+ BCM283X_NCPUS),
62
- gen_exception_insn(s, s->pc_curr, EXCP_UDEF, syn_uncategorized(),
102
DEFINE_PROP_END_OF_LIST()
63
- default_exception_el(s));
103
};
64
+ unallocated_encoding(s);
104
65
return;
105
@@ -XXX,XX +XXX,XX @@ static void bcm2836_class_init(ObjectClass *oc, void *data)
66
}
67
68
@@ -XXX,XX +XXX,XX @@ static void disas_arm_insn(DisasContext *s, unsigned int insn)
69
break;
70
default:
71
illegal_op:
72
- gen_exception_insn(s, s->pc_curr, EXCP_UDEF, syn_uncategorized(),
73
- default_exception_el(s));
74
+ unallocated_encoding(s);
75
break;
76
}
77
}
78
@@ -XXX,XX +XXX,XX @@ static void disas_thumb2_insn(DisasContext *s, uint32_t insn)
79
}
80
return;
81
illegal_op:
82
- gen_exception_insn(s, s->pc_curr, EXCP_UDEF, syn_uncategorized(),
83
- default_exception_el(s));
84
+ unallocated_encoding(s);
106
}
85
}
107
86
108
static const TypeInfo bcm2836_type_info = {
87
static void disas_thumb_insn(DisasContext *s, uint32_t insn)
109
- .name = TYPE_BCM2836,
88
@@ -XXX,XX +XXX,XX @@ static void disas_thumb_insn(DisasContext *s, uint32_t insn)
110
+ .name = TYPE_BCM283X,
89
return;
111
.parent = TYPE_DEVICE,
90
illegal_op:
112
- .instance_size = sizeof(BCM2836State),
91
undef:
113
+ .instance_size = sizeof(BCM283XState),
92
- gen_exception_insn(s, s->pc_curr, EXCP_UDEF, syn_uncategorized(),
114
.instance_init = bcm2836_init,
93
- default_exception_el(s));
115
.class_init = bcm2836_class_init,
94
+ unallocated_encoding(s);
116
};
117
diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c
118
index XXXXXXX..XXXXXXX 100644
119
--- a/hw/arm/raspi.c
120
+++ b/hw/arm/raspi.c
121
@@ -XXX,XX +XXX,XX @@
122
static const int raspi_boardid[] = {[1] = 0xc42, [2] = 0xc43, [3] = 0xc44};
123
124
typedef struct RasPiState {
125
- BCM2836State soc;
126
+ BCM283XState soc;
127
MemoryRegion ram;
128
} RasPiState;
129
130
@@ -XXX,XX +XXX,XX @@ static void raspi_init(MachineState *machine, int version)
131
BusState *bus;
132
DeviceState *carddev;
133
134
- object_initialize(&s->soc, sizeof(s->soc), TYPE_BCM2836);
135
+ object_initialize(&s->soc, sizeof(s->soc), TYPE_BCM283X);
136
object_property_add_child(OBJECT(machine), "soc", OBJECT(&s->soc),
137
&error_abort);
138
139
@@ -XXX,XX +XXX,XX @@ static void raspi2_machine_init(MachineClass *mc)
140
mc->no_floppy = 1;
141
mc->no_cdrom = 1;
142
mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-a15");
143
- mc->max_cpus = BCM2836_NCPUS;
144
- mc->min_cpus = BCM2836_NCPUS;
145
- mc->default_cpus = BCM2836_NCPUS;
146
+ mc->max_cpus = BCM283X_NCPUS;
147
+ mc->min_cpus = BCM283X_NCPUS;
148
+ mc->default_cpus = BCM283X_NCPUS;
149
mc->default_ram_size = 1024 * 1024 * 1024;
150
mc->ignore_memory_transaction_failures = true;
151
};
152
@@ -XXX,XX +XXX,XX @@ static void raspi3_machine_init(MachineClass *mc)
153
mc->no_floppy = 1;
154
mc->no_cdrom = 1;
155
mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-a53");
156
- mc->max_cpus = BCM2836_NCPUS;
157
- mc->min_cpus = BCM2836_NCPUS;
158
- mc->default_cpus = BCM2836_NCPUS;
159
+ mc->max_cpus = BCM283X_NCPUS;
160
+ mc->min_cpus = BCM283X_NCPUS;
161
+ mc->default_cpus = BCM283X_NCPUS;
162
mc->default_ram_size = 1024 * 1024 * 1024;
163
}
95
}
164
DEFINE_MACHINE("raspi3", raspi3_machine_init)
96
97
static bool insn_crosses_page(CPUARMState *env, DisasContext *s)
165
--
98
--
166
2.16.2
99
2.20.1
167
100
168
101
diff view generated by jsdifflib
1
The BCM2837 sets the Aff1 field of the MPIDR affinity values for the
1
Currently the only part of an ARMCPRegInfo which is allowed to cause
2
CPUs to 0, whereas the BCM2836 uses 0xf. Set this correctly, as it
2
a CPU exception is the access function, which returns a value indicating
3
is required for Linux to boot.
3
that some flavour of UNDEF should be generated.
4
5
For the ATS system instructions, we would like to conditionally
6
generate exceptions as part of the writefn, because some faults
7
during the page table walk (like external aborts) should cause
8
an exception to be raised rather than returning a value.
9
10
There are several ways we could do this:
11
* plumb the GETPC() value from the top level set_cp_reg/get_cp_reg
12
helper functions through into the readfn and writefn hooks
13
* add extra readfn_with_ra/writefn_with_ra hooks that take the GETPC()
14
value
15
* require the ATS instructions to provide a dummy accessfn,
16
which serves no purpose except to cause the code generation
17
to emit TCG ops to sync the CPU state
18
* add an ARM_CP_ flag to mark the ARMCPRegInfo as possibly
19
throwing an exception in its read/write hooks, and make the
20
codegen sync the CPU state before calling the hooks if the
21
flag is set
22
23
This patch opts for the last of these, as it is fairly simple
24
to implement and doesn't require invasive changes like updating
25
the readfn/writefn hook function prototype signature.
4
26
5
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
27
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6
Reviewed-by: Andrew Baumann <Andrew.Baumann@microsoft.com>
28
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
7
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
29
Tested-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
8
Message-id: 20180313153458.26822-8-peter.maydell@linaro.org
30
Message-id: 20190816125802.25877-2-peter.maydell@linaro.org
9
---
31
---
10
hw/arm/bcm2836.c | 11 +++++++----
32
target/arm/cpu.h | 6 +++++-
11
1 file changed, 7 insertions(+), 4 deletions(-)
33
target/arm/translate-a64.c | 6 ++++++
34
target/arm/translate.c | 7 +++++++
35
3 files changed, 18 insertions(+), 1 deletion(-)
12
36
13
diff --git a/hw/arm/bcm2836.c b/hw/arm/bcm2836.c
37
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
14
index XXXXXXX..XXXXXXX 100644
38
index XXXXXXX..XXXXXXX 100644
15
--- a/hw/arm/bcm2836.c
39
--- a/target/arm/cpu.h
16
+++ b/hw/arm/bcm2836.c
40
+++ b/target/arm/cpu.h
17
@@ -XXX,XX +XXX,XX @@
41
@@ -XXX,XX +XXX,XX @@ static inline uint64_t cpreg_to_kvm_id(uint32_t cpregid)
18
42
* IO indicates that this register does I/O and therefore its accesses
19
struct BCM283XInfo {
43
* need to be surrounded by gen_io_start()/gen_io_end(). In particular,
20
const char *name;
44
* registers which implement clocks or timers require this.
21
+ int clusterid;
45
+ * RAISES_EXC is for when the read or write hook might raise an exception;
22
};
46
+ * the generated code will synchronize the CPU state before calling the hook
23
47
+ * so that it is safe for the hook to call raise_exception().
24
static const BCM283XInfo bcm283x_socs[] = {
48
*/
25
{
49
#define ARM_CP_SPECIAL 0x0001
26
.name = TYPE_BCM2836,
50
#define ARM_CP_CONST 0x0002
27
+ .clusterid = 0xf,
51
@@ -XXX,XX +XXX,XX @@ static inline uint64_t cpreg_to_kvm_id(uint32_t cpregid)
28
},
52
#define ARM_CP_FPU 0x1000
29
{
53
#define ARM_CP_SVE 0x2000
30
.name = TYPE_BCM2837,
54
#define ARM_CP_NO_GDB 0x4000
31
+ .clusterid = 0x0,
55
+#define ARM_CP_RAISES_EXC 0x8000
32
},
56
/* Used only as a terminator for ARMCPRegInfo lists */
33
};
57
#define ARM_CP_SENTINEL 0xffff
34
58
/* Mask of only the flag bits in a type field */
35
@@ -XXX,XX +XXX,XX @@ static void bcm2836_init(Object *obj)
59
-#define ARM_CP_FLAG_MASK 0x70ff
36
static void bcm2836_realize(DeviceState *dev, Error **errp)
60
+#define ARM_CP_FLAG_MASK 0xf0ff
37
{
61
38
BCM283XState *s = BCM283X(dev);
62
/* Valid values for ARMCPRegInfo state field, indicating which of
39
+ BCM283XClass *bc = BCM283X_GET_CLASS(dev);
63
* the AArch32 and AArch64 execution states this register is visible in.
40
+ const BCM283XInfo *info = bc->info;
64
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
41
Object *obj;
65
index XXXXXXX..XXXXXXX 100644
42
Error *err = NULL;
66
--- a/target/arm/translate-a64.c
43
int n;
67
+++ b/target/arm/translate-a64.c
44
@@ -XXX,XX +XXX,XX @@ static void bcm2836_realize(DeviceState *dev, Error **errp)
68
@@ -XXX,XX +XXX,XX @@ static void handle_sys(DisasContext *s, uint32_t insn, bool isread,
45
qdev_get_gpio_in_named(DEVICE(&s->control), "gpu-fiq", 0));
69
tcg_temp_free_ptr(tmpptr);
46
70
tcg_temp_free_i32(tcg_syn);
47
for (n = 0; n < BCM283X_NCPUS; n++) {
71
tcg_temp_free_i32(tcg_isread);
48
- /* Mirror bcm2836, which has clusterid set to 0xf
72
+ } else if (ri->type & ARM_CP_RAISES_EXC) {
49
- * TODO: this should be converted to a property of ARM_CPU
73
+ /*
50
- */
74
+ * The readfn or writefn might raise an exception;
51
- s->cpus[n].mp_affinity = 0xF00 | n;
75
+ * synchronize the CPU state in case it does.
52
+ /* TODO: this should be converted to a property of ARM_CPU */
76
+ */
53
+ s->cpus[n].mp_affinity = (info->clusterid << 8) | n;
77
+ gen_a64_set_pc_im(s->pc_curr);
54
78
}
55
/* set periphbase/CBAR value for CPU-local registers */
79
56
object_property_set_int(OBJECT(&s->cpus[n]),
80
/* Handle special cases first */
81
diff --git a/target/arm/translate.c b/target/arm/translate.c
82
index XXXXXXX..XXXXXXX 100644
83
--- a/target/arm/translate.c
84
+++ b/target/arm/translate.c
85
@@ -XXX,XX +XXX,XX @@ static int disas_coproc_insn(DisasContext *s, uint32_t insn)
86
tcg_temp_free_ptr(tmpptr);
87
tcg_temp_free_i32(tcg_syn);
88
tcg_temp_free_i32(tcg_isread);
89
+ } else if (ri->type & ARM_CP_RAISES_EXC) {
90
+ /*
91
+ * The readfn or writefn might raise an exception;
92
+ * synchronize the CPU state in case it does.
93
+ */
94
+ gen_set_condexec(s);
95
+ gen_set_pc_im(s, s->pc_curr);
96
}
97
98
/* Handle special cases first */
57
--
99
--
58
2.16.2
100
2.20.1
59
101
60
102
diff view generated by jsdifflib
1
If we're directly booting a Linux kernel and the CPU supports both
1
The translation table walk for an ATS instruction can result in
2
EL3 and EL2, we start the kernel in EL2, as it expects. We must also
2
various faults. In general these are just reported back via the
3
set the SCR_EL3.HCE bit in this situation, so that the HVC
3
PAR_EL1 fault status fields, but in some cases the architecture
4
instruction is enabled rather than UNDEFing. Otherwise at least some
4
requires that the fault is turned into an exception:
5
kernels will panic when trying to initialize KVM in the guest.
5
* synchronous stage 2 faults of any kind during AT S1E0* and
6
AT S1E1* instructions executed from NS EL1 fault to EL2 or EL3
7
* synchronous external aborts are taken as Data Abort exceptions
8
9
(This is documented in the v8A Arm ARM DDI0487A.e D5.2.11 and
10
G5.13.4.)
6
11
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8
Message-id: 20180313153458.26822-4-peter.maydell@linaro.org
13
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
14
Tested-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
15
Message-id: 20190816125802.25877-3-peter.maydell@linaro.org
9
---
16
---
10
hw/arm/boot.c | 5 +++++
17
target/arm/helper.c | 107 +++++++++++++++++++++++++++++++++++++-------
11
1 file changed, 5 insertions(+)
18
1 file changed, 92 insertions(+), 15 deletions(-)
12
19
13
diff --git a/hw/arm/boot.c b/hw/arm/boot.c
20
diff --git a/target/arm/helper.c b/target/arm/helper.c
14
index XXXXXXX..XXXXXXX 100644
21
index XXXXXXX..XXXXXXX 100644
15
--- a/hw/arm/boot.c
22
--- a/target/arm/helper.c
16
+++ b/hw/arm/boot.c
23
+++ b/target/arm/helper.c
17
@@ -XXX,XX +XXX,XX @@ static void do_cpu_reset(void *opaque)
24
@@ -XXX,XX +XXX,XX @@ static uint64_t do_ats_write(CPUARMState *env, uint64_t value,
18
assert(!info->secure_board_setup);
25
ret = get_phys_addr(env, value, access_type, mmu_idx, &phys_addr, &attrs,
19
}
26
&prot, &page_size, &fi, &cacheattrs);
20
27
21
+ if (arm_feature(env, ARM_FEATURE_EL2)) {
28
+ if (ret) {
22
+ /* If we have EL2 then Linux expects the HVC insn to work */
29
+ /*
23
+ env->cp15.scr_el3 |= SCR_HCE;
30
+ * Some kinds of translation fault must cause exceptions rather
31
+ * than being reported in the PAR.
32
+ */
33
+ int current_el = arm_current_el(env);
34
+ int target_el;
35
+ uint32_t syn, fsr, fsc;
36
+ bool take_exc = false;
37
+
38
+ if (fi.s1ptw && current_el == 1 && !arm_is_secure(env)
39
+ && (mmu_idx == ARMMMUIdx_S1NSE1 || mmu_idx == ARMMMUIdx_S1NSE0)) {
40
+ /*
41
+ * Synchronous stage 2 fault on an access made as part of the
42
+ * translation table walk for AT S1E0* or AT S1E1* insn
43
+ * executed from NS EL1. If this is a synchronous external abort
44
+ * and SCR_EL3.EA == 1, then we take a synchronous external abort
45
+ * to EL3. Otherwise the fault is taken as an exception to EL2,
46
+ * and HPFAR_EL2 holds the faulting IPA.
47
+ */
48
+ if (fi.type == ARMFault_SyncExternalOnWalk &&
49
+ (env->cp15.scr_el3 & SCR_EA)) {
50
+ target_el = 3;
51
+ } else {
52
+ env->cp15.hpfar_el2 = extract64(fi.s2addr, 12, 47) << 4;
53
+ target_el = 2;
54
+ }
55
+ take_exc = true;
56
+ } else if (fi.type == ARMFault_SyncExternalOnWalk) {
57
+ /*
58
+ * Synchronous external aborts during a translation table walk
59
+ * are taken as Data Abort exceptions.
60
+ */
61
+ if (fi.stage2) {
62
+ if (current_el == 3) {
63
+ target_el = 3;
64
+ } else {
65
+ target_el = 2;
24
+ }
66
+ }
67
+ } else {
68
+ target_el = exception_target_el(env);
69
+ }
70
+ take_exc = true;
71
+ }
25
+
72
+
26
/* Set to non-secure if not a secure boot */
73
+ if (take_exc) {
27
if (!info->secure_boot &&
74
+ /* Construct FSR and FSC using same logic as arm_deliver_fault() */
28
(cs != first_cpu || !info->secure_board_setup)) {
75
+ if (target_el == 2 || arm_el_is_aa64(env, target_el) ||
76
+ arm_s1_regime_using_lpae_format(env, mmu_idx)) {
77
+ fsr = arm_fi_to_lfsc(&fi);
78
+ fsc = extract32(fsr, 0, 6);
79
+ } else {
80
+ fsr = arm_fi_to_sfsc(&fi);
81
+ fsc = 0x3f;
82
+ }
83
+ /*
84
+ * Report exception with ESR indicating a fault due to a
85
+ * translation table walk for a cache maintenance instruction.
86
+ */
87
+ syn = syn_data_abort_no_iss(current_el == target_el,
88
+ fi.ea, 1, fi.s1ptw, 1, fsc);
89
+ env->exception.vaddress = value;
90
+ env->exception.fsr = fsr;
91
+ raise_exception(env, EXCP_DATA_ABORT, syn, target_el);
92
+ }
93
+ }
94
+
95
if (is_a64(env)) {
96
format64 = true;
97
} else if (arm_feature(env, ARM_FEATURE_LPAE)) {
98
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo vapa_cp_reginfo[] = {
99
/* This underdecoding is safe because the reginfo is NO_RAW. */
100
{ .name = "ATS", .cp = 15, .crn = 7, .crm = 8, .opc1 = 0, .opc2 = CP_ANY,
101
.access = PL1_W, .accessfn = ats_access,
102
- .writefn = ats_write, .type = ARM_CP_NO_RAW },
103
+ .writefn = ats_write, .type = ARM_CP_NO_RAW | ARM_CP_RAISES_EXC },
104
#endif
105
REGINFO_SENTINEL
106
};
107
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v8_cp_reginfo[] = {
108
/* 64 bit address translation operations */
109
{ .name = "AT_S1E1R", .state = ARM_CP_STATE_AA64,
110
.opc0 = 1, .opc1 = 0, .crn = 7, .crm = 8, .opc2 = 0,
111
- .access = PL1_W, .type = ARM_CP_NO_RAW, .writefn = ats_write64 },
112
+ .access = PL1_W, .type = ARM_CP_NO_RAW | ARM_CP_RAISES_EXC,
113
+ .writefn = ats_write64 },
114
{ .name = "AT_S1E1W", .state = ARM_CP_STATE_AA64,
115
.opc0 = 1, .opc1 = 0, .crn = 7, .crm = 8, .opc2 = 1,
116
- .access = PL1_W, .type = ARM_CP_NO_RAW, .writefn = ats_write64 },
117
+ .access = PL1_W, .type = ARM_CP_NO_RAW | ARM_CP_RAISES_EXC,
118
+ .writefn = ats_write64 },
119
{ .name = "AT_S1E0R", .state = ARM_CP_STATE_AA64,
120
.opc0 = 1, .opc1 = 0, .crn = 7, .crm = 8, .opc2 = 2,
121
- .access = PL1_W, .type = ARM_CP_NO_RAW, .writefn = ats_write64 },
122
+ .access = PL1_W, .type = ARM_CP_NO_RAW | ARM_CP_RAISES_EXC,
123
+ .writefn = ats_write64 },
124
{ .name = "AT_S1E0W", .state = ARM_CP_STATE_AA64,
125
.opc0 = 1, .opc1 = 0, .crn = 7, .crm = 8, .opc2 = 3,
126
- .access = PL1_W, .type = ARM_CP_NO_RAW, .writefn = ats_write64 },
127
+ .access = PL1_W, .type = ARM_CP_NO_RAW | ARM_CP_RAISES_EXC,
128
+ .writefn = ats_write64 },
129
{ .name = "AT_S12E1R", .state = ARM_CP_STATE_AA64,
130
.opc0 = 1, .opc1 = 4, .crn = 7, .crm = 8, .opc2 = 4,
131
- .access = PL2_W, .type = ARM_CP_NO_RAW, .writefn = ats_write64 },
132
+ .access = PL2_W, .type = ARM_CP_NO_RAW | ARM_CP_RAISES_EXC,
133
+ .writefn = ats_write64 },
134
{ .name = "AT_S12E1W", .state = ARM_CP_STATE_AA64,
135
.opc0 = 1, .opc1 = 4, .crn = 7, .crm = 8, .opc2 = 5,
136
- .access = PL2_W, .type = ARM_CP_NO_RAW, .writefn = ats_write64 },
137
+ .access = PL2_W, .type = ARM_CP_NO_RAW | ARM_CP_RAISES_EXC,
138
+ .writefn = ats_write64 },
139
{ .name = "AT_S12E0R", .state = ARM_CP_STATE_AA64,
140
.opc0 = 1, .opc1 = 4, .crn = 7, .crm = 8, .opc2 = 6,
141
- .access = PL2_W, .type = ARM_CP_NO_RAW, .writefn = ats_write64 },
142
+ .access = PL2_W, .type = ARM_CP_NO_RAW | ARM_CP_RAISES_EXC,
143
+ .writefn = ats_write64 },
144
{ .name = "AT_S12E0W", .state = ARM_CP_STATE_AA64,
145
.opc0 = 1, .opc1 = 4, .crn = 7, .crm = 8, .opc2 = 7,
146
- .access = PL2_W, .type = ARM_CP_NO_RAW, .writefn = ats_write64 },
147
+ .access = PL2_W, .type = ARM_CP_NO_RAW | ARM_CP_RAISES_EXC,
148
+ .writefn = ats_write64 },
149
/* AT S1E2* are elsewhere as they UNDEF from EL3 if EL2 is not present */
150
{ .name = "AT_S1E3R", .state = ARM_CP_STATE_AA64,
151
.opc0 = 1, .opc1 = 6, .crn = 7, .crm = 8, .opc2 = 0,
152
- .access = PL3_W, .type = ARM_CP_NO_RAW, .writefn = ats_write64 },
153
+ .access = PL3_W, .type = ARM_CP_NO_RAW | ARM_CP_RAISES_EXC,
154
+ .writefn = ats_write64 },
155
{ .name = "AT_S1E3W", .state = ARM_CP_STATE_AA64,
156
.opc0 = 1, .opc1 = 6, .crn = 7, .crm = 8, .opc2 = 1,
157
- .access = PL3_W, .type = ARM_CP_NO_RAW, .writefn = ats_write64 },
158
+ .access = PL3_W, .type = ARM_CP_NO_RAW | ARM_CP_RAISES_EXC,
159
+ .writefn = ats_write64 },
160
{ .name = "PAR_EL1", .state = ARM_CP_STATE_AA64,
161
.type = ARM_CP_ALIAS,
162
.opc0 = 3, .opc1 = 0, .crn = 7, .crm = 4, .opc2 = 0,
163
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo el2_cp_reginfo[] = {
164
{ .name = "AT_S1E2R", .state = ARM_CP_STATE_AA64,
165
.opc0 = 1, .opc1 = 4, .crn = 7, .crm = 8, .opc2 = 0,
166
.access = PL2_W, .accessfn = at_s1e2_access,
167
- .type = ARM_CP_NO_RAW, .writefn = ats_write64 },
168
+ .type = ARM_CP_NO_RAW | ARM_CP_RAISES_EXC, .writefn = ats_write64 },
169
{ .name = "AT_S1E2W", .state = ARM_CP_STATE_AA64,
170
.opc0 = 1, .opc1 = 4, .crn = 7, .crm = 8, .opc2 = 1,
171
.access = PL2_W, .accessfn = at_s1e2_access,
172
- .type = ARM_CP_NO_RAW, .writefn = ats_write64 },
173
+ .type = ARM_CP_NO_RAW | ARM_CP_RAISES_EXC, .writefn = ats_write64 },
174
/* The AArch32 ATS1H* operations are CONSTRAINED UNPREDICTABLE
175
* if EL2 is not implemented; we choose to UNDEF. Behaviour at EL3
176
* with SCR.NS == 0 outside Monitor mode is UNPREDICTABLE; we choose
177
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo el2_cp_reginfo[] = {
178
*/
179
{ .name = "ATS1HR", .cp = 15, .opc1 = 4, .crn = 7, .crm = 8, .opc2 = 0,
180
.access = PL2_W,
181
- .writefn = ats1h_write, .type = ARM_CP_NO_RAW },
182
+ .writefn = ats1h_write, .type = ARM_CP_NO_RAW | ARM_CP_RAISES_EXC },
183
{ .name = "ATS1HW", .cp = 15, .opc1 = 4, .crn = 7, .crm = 8, .opc2 = 1,
184
.access = PL2_W,
185
- .writefn = ats1h_write, .type = ARM_CP_NO_RAW },
186
+ .writefn = ats1h_write, .type = ARM_CP_NO_RAW | ARM_CP_RAISES_EXC },
187
{ .name = "CNTHCTL_EL2", .state = ARM_CP_STATE_BOTH,
188
.opc0 = 3, .opc1 = 4, .crn = 14, .crm = 1, .opc2 = 0,
189
/* ARMv7 requires bit 0 and 1 to reset to 1. ARMv8 defines the
29
--
190
--
30
2.16.2
191
2.20.1
31
192
32
193
diff view generated by jsdifflib
1
Now we have separate types for BCM2386 and BCM2387, we might as well
1
From: Andrew Jeffery <andrew@aj.id.au>
2
just hard-code the CPU type they use rather than having it passed
3
through as an object property. This then lets us put the initialization
4
of the CPU object in init rather than realize.
5
2
6
Note that this change means that it's no longer possible on
3
First up: This is not the way the hardware behaves.
7
the command line to use -cpu to ask for a different kind of
8
CPU than the SoC supports. This was never a supported thing to
9
do anyway; we were just not sanity-checking the command line.
10
4
11
This does require us to only build the bcm2837 object on
5
However, it helps resolve real-world problems with short periods being
12
TARGET_AARCH64 configs, since otherwise it won't instantiate
6
used under Linux. Commit 4451d3f59f2a ("clocksource/drivers/fttmr010:
13
due to the missing cortex-a53 device and "make check" will fail.
7
Fix set_next_event handler") in Linux fixed the timer driver to
8
correctly schedule the next event for the Aspeed controller, and in
9
combination with 5daa8212c08e ("ARM: dts: aspeed: Describe random number
10
device") Linux will now set a timer with a period as low as 1us.
14
11
12
Configuring a qemu timer with such a short period results in spending
13
time handling the interrupt in the model rather than executing guest
14
code, leading to noticeable "sticky" behaviour in the guest.
15
16
The behaviour of Linux is correct with respect to the hardware, so we
17
need to improve our handling under emulation. The approach chosen is to
18
provide back-pressure information by calculating an acceptable minimum
19
number of ticks to be set on the model. Under Linux an additional read
20
is added in the timer configuration path to detect back-pressure, which
21
will never occur on hardware. However if back-pressure is observed, the
22
driver alerts the clock event subsystem, which then performs its own
23
next event dilation via a config option - d1748302f70b ("clockevents:
24
Make minimum delay adjustments configurable")
25
26
A minimum period of 5us was experimentally determined on a Lenovo
27
T480s, which I've increased to 20us for "safety".
28
29
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
30
Reviewed-by: Joel Stanley <joel@jms.id.au>
31
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
32
Tested-by: Joel Stanley <joel@jms.id.au>
33
Signed-off-by: Cédric Le Goater <clg@kaod.org>
34
Message-id: 20190704055150.4899-1-clg@kaod.org
35
[clg: - changed the computation of min_ticks to be done each time the
36
timer value is reloaded. It removes the ordering issue of the
37
timer and scu reset handlers but is slightly slower ]
38
- introduced TIMER_MIN_NS
39
- introduced calculate_min_ticks() ]
40
Signed-off-by: Cédric Le Goater <clg@kaod.org>
15
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
41
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
16
Reviewed-by: Andrew Baumann <Andrew.Baumann@microsoft.com>
17
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
18
Message-id: 20180313153458.26822-9-peter.maydell@linaro.org
19
---
42
---
20
hw/arm/bcm2836.c | 24 +++++++++++++++---------
43
hw/timer/aspeed_timer.c | 17 ++++++++++++++++-
21
hw/arm/raspi.c | 2 --
44
1 file changed, 16 insertions(+), 1 deletion(-)
22
2 files changed, 15 insertions(+), 11 deletions(-)
23
45
24
diff --git a/hw/arm/bcm2836.c b/hw/arm/bcm2836.c
46
diff --git a/hw/timer/aspeed_timer.c b/hw/timer/aspeed_timer.c
25
index XXXXXXX..XXXXXXX 100644
47
index XXXXXXX..XXXXXXX 100644
26
--- a/hw/arm/bcm2836.c
48
--- a/hw/timer/aspeed_timer.c
27
+++ b/hw/arm/bcm2836.c
49
+++ b/hw/timer/aspeed_timer.c
28
@@ -XXX,XX +XXX,XX @@
50
@@ -XXX,XX +XXX,XX @@ enum timer_ctrl_op {
29
51
op_pulse_enable
30
struct BCM283XInfo {
31
const char *name;
32
+ const char *cpu_type;
33
int clusterid;
34
};
52
};
35
53
36
static const BCM283XInfo bcm283x_socs[] = {
54
+/*
37
{
55
+ * Minimum value of the reload register to filter out short period
38
.name = TYPE_BCM2836,
56
+ * timers which have a noticeable impact in emulation. 5us should be
39
+ .cpu_type = ARM_CPU_TYPE_NAME("cortex-a15"),
57
+ * enough, use 20us for "safety".
40
.clusterid = 0xf,
58
+ */
41
},
59
+#define TIMER_MIN_NS (20 * SCALE_US)
42
+#ifdef TARGET_AARCH64
60
+
43
{
61
/**
44
.name = TYPE_BCM2837,
62
* Avoid mutual references between AspeedTimerCtrlState and AspeedTimer
45
+ .cpu_type = ARM_CPU_TYPE_NAME("cortex-a53"),
63
* structs, as it's a waste of memory. The ptimer BH callback needs to know
46
.clusterid = 0x0,
64
@@ -XXX,XX +XXX,XX @@ static inline uint32_t calculate_ticks(struct AspeedTimer *t, uint64_t now_ns)
47
},
65
return t->reload - MIN(t->reload, ticks);
48
+#endif
66
}
49
};
67
50
68
+static uint32_t calculate_min_ticks(AspeedTimer *t, uint32_t value)
51
static void bcm2836_init(Object *obj)
69
+{
70
+ uint32_t rate = calculate_rate(t);
71
+ uint32_t min_ticks = muldiv64(TIMER_MIN_NS, rate, NANOSECONDS_PER_SECOND);
72
+
73
+ return value < min_ticks ? min_ticks : value;
74
+}
75
+
76
static inline uint64_t calculate_time(struct AspeedTimer *t, uint32_t ticks)
52
{
77
{
53
BCM283XState *s = BCM283X(obj);
78
uint64_t delta_ns;
54
+ BCM283XClass *bc = BCM283X_GET_CLASS(obj);
79
@@ -XXX,XX +XXX,XX @@ static void aspeed_timer_set_value(AspeedTimerCtrlState *s, int timer, int reg,
55
+ const BCM283XInfo *info = bc->info;
80
switch (reg) {
56
+ int n;
81
case TIMER_REG_RELOAD:
57
+
82
old_reload = t->reload;
58
+ for (n = 0; n < BCM283X_NCPUS; n++) {
83
- t->reload = value;
59
+ object_initialize(&s->cpus[n], sizeof(s->cpus[n]),
84
+ t->reload = calculate_min_ticks(t, value);
60
+ info->cpu_type);
85
61
+ object_property_add_child(obj, "cpu[*]", OBJECT(&s->cpus[n]),
86
/* If the reload value was not previously set, or zero, and
62
+ &error_abort);
87
* the current value is valid, try to start the timer if it is
63
+ }
64
65
object_initialize(&s->control, sizeof(s->control), TYPE_BCM2836_CONTROL);
66
object_property_add_child(obj, "control", OBJECT(&s->control), NULL);
67
@@ -XXX,XX +XXX,XX @@ static void bcm2836_realize(DeviceState *dev, Error **errp)
68
69
/* common peripherals from bcm2835 */
70
71
- obj = OBJECT(dev);
72
- for (n = 0; n < BCM283X_NCPUS; n++) {
73
- object_initialize(&s->cpus[n], sizeof(s->cpus[n]),
74
- s->cpu_type);
75
- object_property_add_child(obj, "cpu[*]", OBJECT(&s->cpus[n]),
76
- &error_abort);
77
- }
78
-
79
obj = object_property_get_link(OBJECT(dev), "ram", &err);
80
if (obj == NULL) {
81
error_setg(errp, "%s: required ram link not found: %s",
82
@@ -XXX,XX +XXX,XX @@ static void bcm2836_realize(DeviceState *dev, Error **errp)
83
}
84
85
static Property bcm2836_props[] = {
86
- DEFINE_PROP_STRING("cpu-type", BCM283XState, cpu_type),
87
DEFINE_PROP_UINT32("enabled-cpus", BCM283XState, enabled_cpus,
88
BCM283X_NCPUS),
89
DEFINE_PROP_END_OF_LIST()
90
diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c
91
index XXXXXXX..XXXXXXX 100644
92
--- a/hw/arm/raspi.c
93
+++ b/hw/arm/raspi.c
94
@@ -XXX,XX +XXX,XX @@ static void raspi_init(MachineState *machine, int version)
95
/* Setup the SOC */
96
object_property_add_const_link(OBJECT(&s->soc), "ram", OBJECT(&s->ram),
97
&error_abort);
98
- object_property_set_str(OBJECT(&s->soc), machine->cpu_type, "cpu-type",
99
- &error_abort);
100
object_property_set_int(OBJECT(&s->soc), smp_cpus, "enabled-cpus",
101
&error_abort);
102
int board_rev = version == 3 ? 0xa02082 : 0xa21041;
103
--
88
--
104
2.16.2
89
2.20.1
105
90
106
91
diff view generated by jsdifflib
New patch
1
From: Eric Auger <eric.auger@redhat.com>
1
2
3
memory_region_iommu_replay_all is not used. Remove it.
4
5
Signed-off-by: Eric Auger <eric.auger@redhat.com>
6
Reported-by: Peter Maydell <peter.maydell@linaro.org>
7
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
8
Reviewed-by: Peter Xu <peterx@redhat.com>
9
Message-id: 20190822172350.12008-2-eric.auger@redhat.com
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
---
12
include/exec/memory.h | 10 ----------
13
memory.c | 9 ---------
14
2 files changed, 19 deletions(-)
15
16
diff --git a/include/exec/memory.h b/include/exec/memory.h
17
index XXXXXXX..XXXXXXX 100644
18
--- a/include/exec/memory.h
19
+++ b/include/exec/memory.h
20
@@ -XXX,XX +XXX,XX @@ void memory_region_register_iommu_notifier(MemoryRegion *mr,
21
*/
22
void memory_region_iommu_replay(IOMMUMemoryRegion *iommu_mr, IOMMUNotifier *n);
23
24
-/**
25
- * memory_region_iommu_replay_all: replay existing IOMMU translations
26
- * to all the notifiers registered.
27
- *
28
- * Note: this is not related to record-and-replay functionality.
29
- *
30
- * @iommu_mr: the memory region to observe
31
- */
32
-void memory_region_iommu_replay_all(IOMMUMemoryRegion *iommu_mr);
33
-
34
/**
35
* memory_region_unregister_iommu_notifier: unregister a notifier for
36
* changes to IOMMU translation entries.
37
diff --git a/memory.c b/memory.c
38
index XXXXXXX..XXXXXXX 100644
39
--- a/memory.c
40
+++ b/memory.c
41
@@ -XXX,XX +XXX,XX @@ void memory_region_iommu_replay(IOMMUMemoryRegion *iommu_mr, IOMMUNotifier *n)
42
}
43
}
44
45
-void memory_region_iommu_replay_all(IOMMUMemoryRegion *iommu_mr)
46
-{
47
- IOMMUNotifier *notifier;
48
-
49
- IOMMU_NOTIFIER_FOREACH(notifier, iommu_mr) {
50
- memory_region_iommu_replay(iommu_mr, notifier);
51
- }
52
-}
53
-
54
void memory_region_unregister_iommu_notifier(MemoryRegion *mr,
55
IOMMUNotifier *n)
56
{
57
--
58
2.20.1
59
60
diff view generated by jsdifflib
New patch
1
From: Eric Auger <eric.auger@redhat.com>
1
2
3
Log a guest error when encountering an invalid STE.
4
5
Signed-off-by: Eric Auger <eric.auger@redhat.com>
6
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
7
Message-id: 20190822172350.12008-5-eric.auger@redhat.com
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
---
10
hw/arm/smmuv3.c | 1 +
11
1 file changed, 1 insertion(+)
12
13
diff --git a/hw/arm/smmuv3.c b/hw/arm/smmuv3.c
14
index XXXXXXX..XXXXXXX 100644
15
--- a/hw/arm/smmuv3.c
16
+++ b/hw/arm/smmuv3.c
17
@@ -XXX,XX +XXX,XX @@ static int decode_ste(SMMUv3State *s, SMMUTransCfg *cfg,
18
uint32_t config;
19
20
if (!STE_VALID(ste)) {
21
+ qemu_log_mask(LOG_GUEST_ERROR, "invalid STE\n");
22
goto bad_ste;
23
}
24
25
--
26
2.20.1
27
28
diff view generated by jsdifflib
1
From: Guenter Roeck <linux@roeck-us.net>
1
From: Eric Auger <eric.auger@redhat.com>
2
2
3
The sabrelite machine model used by qemu-system-arm is based on the
3
An IOVA/ASID invalidation is notified to all IOMMU Memory Regions
4
Freescale/NXP i.MX6Q processor. This SoC has an on-board ethernet
4
through smmuv3_inv_notifiers_iova/smmuv3_notify_iova.
5
controller which is supported in QEMU using the imx_fec.c module
6
(actually called imx.enet for this model.)
7
5
8
The include/hw/arm/fsm-imx6.h file defines the interrupt vectors for the
6
When the notification occurs it is possible that some of the
9
imx.enet device like this:
7
PCIe devices associated to the notified regions do not have a
8
valid stream table entry. In that case we output a LOG_GUEST_ERROR
9
message, for example:
10
10
11
#define FSL_IMX6_ENET_MAC_1588_IRQ 118
11
invalid sid=<SID> (L1STD span=0)
12
#define FSL_IMX6_ENET_MAC_IRQ 119
12
"smmuv3_notify_iova error decoding the configuration for iommu mr=<MR>
13
13
14
According to https://www.nxp.com/docs/en/reference-manual/IMX6DQRM.pdf,
14
This is unfortunate as the user gets the impression that there
15
page 225, in Table 3-1. ARM Cortex A9 domain interrupt summary,
15
are some translation decoding errors whereas there are not.
16
interrupts are as follows.
17
16
18
150 ENET MAC 0 IRQ
17
This patch adds a new field in SMMUEventInfo that tells whether
19
151 ENET MAC 0 1588 Timer interrupt
18
the detection of an invalid STE must lead to an error report.
19
invalid_ste_allowed is set before doing the invalidations and
20
kept unset on actual translation.
20
21
21
where
22
The other configuration decoding error messages are kept since if the
23
STE is valid then the rest of the config must be correct.
22
24
23
150 - 32 == 118
25
Signed-off-by: Eric Auger <eric.auger@redhat.com>
24
151 - 32 == 119
26
Message-id: 20190822172350.12008-6-eric.auger@redhat.com
25
26
In other words, the vector definitions in the fsl-imx6.h file are reversed.
27
28
Fixing the interrupts alone causes problems with older Linux kernels:
29
The Ethernet interface will fail to probe with Linux v4.9 and earlier.
30
Linux v4.1 and earlier will crash due to a bug in Ethernet driver probe
31
error handling. This is a Linux kernel problem, not a qemu problem:
32
the Linux kernel only worked by accident since it requested both interrupts.
33
34
For backward compatibility, generate the Ethernet interrupt on both interrupt
35
lines. This was shown to work from all Linux kernel releases starting with
36
v3.16.
37
38
Link: https://bugs.launchpad.net/qemu/+bug/1753309
39
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
40
Message-id: 1520723090-22130-1-git-send-email-linux@roeck-us.net
41
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
27
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
42
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
28
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
43
---
29
---
44
include/hw/arm/fsl-imx6.h | 4 ++--
30
hw/arm/smmuv3-internal.h | 1 +
45
hw/net/imx_fec.c | 28 +++++++++++++++++++++++++++-
31
hw/arm/smmuv3.c | 19 +++++++++++--------
46
2 files changed, 29 insertions(+), 3 deletions(-)
32
2 files changed, 12 insertions(+), 8 deletions(-)
47
33
48
diff --git a/include/hw/arm/fsl-imx6.h b/include/hw/arm/fsl-imx6.h
34
diff --git a/hw/arm/smmuv3-internal.h b/hw/arm/smmuv3-internal.h
49
index XXXXXXX..XXXXXXX 100644
35
index XXXXXXX..XXXXXXX 100644
50
--- a/include/hw/arm/fsl-imx6.h
36
--- a/hw/arm/smmuv3-internal.h
51
+++ b/include/hw/arm/fsl-imx6.h
37
+++ b/hw/arm/smmuv3-internal.h
52
@@ -XXX,XX +XXX,XX @@ typedef struct FslIMX6State {
38
@@ -XXX,XX +XXX,XX @@ typedef struct SMMUEventInfo {
53
#define FSL_IMX6_HDMI_MASTER_IRQ 115
39
uint32_t sid;
54
#define FSL_IMX6_HDMI_CEC_IRQ 116
40
bool recorded;
55
#define FSL_IMX6_MLB150_LOW_IRQ 117
41
bool record_trans_faults;
56
-#define FSL_IMX6_ENET_MAC_1588_IRQ 118
42
+ bool inval_ste_allowed;
57
-#define FSL_IMX6_ENET_MAC_IRQ 119
43
union {
58
+#define FSL_IMX6_ENET_MAC_IRQ 118
44
struct {
59
+#define FSL_IMX6_ENET_MAC_1588_IRQ 119
45
uint32_t ssid;
60
#define FSL_IMX6_PCIE1_IRQ 120
46
diff --git a/hw/arm/smmuv3.c b/hw/arm/smmuv3.c
61
#define FSL_IMX6_PCIE2_IRQ 121
62
#define FSL_IMX6_PCIE3_IRQ 122
63
diff --git a/hw/net/imx_fec.c b/hw/net/imx_fec.c
64
index XXXXXXX..XXXXXXX 100644
47
index XXXXXXX..XXXXXXX 100644
65
--- a/hw/net/imx_fec.c
48
--- a/hw/arm/smmuv3.c
66
+++ b/hw/net/imx_fec.c
49
+++ b/hw/arm/smmuv3.c
67
@@ -XXX,XX +XXX,XX @@ static void imx_enet_write_bd(IMXENETBufDesc *bd, dma_addr_t addr)
50
@@ -XXX,XX +XXX,XX @@ static int decode_ste(SMMUv3State *s, SMMUTransCfg *cfg,
68
51
uint32_t config;
69
static void imx_eth_update(IMXFECState *s)
52
53
if (!STE_VALID(ste)) {
54
- qemu_log_mask(LOG_GUEST_ERROR, "invalid STE\n");
55
+ if (!event->inval_ste_allowed) {
56
+ qemu_log_mask(LOG_GUEST_ERROR, "invalid STE\n");
57
+ }
58
goto bad_ste;
59
}
60
61
@@ -XXX,XX +XXX,XX @@ static int smmu_find_ste(SMMUv3State *s, uint32_t sid, STE *ste,
62
63
if (!span) {
64
/* l2ptr is not valid */
65
- qemu_log_mask(LOG_GUEST_ERROR,
66
- "invalid sid=%d (L1STD span=0)\n", sid);
67
+ if (!event->inval_ste_allowed) {
68
+ qemu_log_mask(LOG_GUEST_ERROR,
69
+ "invalid sid=%d (L1STD span=0)\n", sid);
70
+ }
71
event->type = SMMU_EVT_C_BAD_STREAMID;
72
return -EINVAL;
73
}
74
@@ -XXX,XX +XXX,XX @@ static IOMMUTLBEntry smmuv3_translate(IOMMUMemoryRegion *mr, hwaddr addr,
75
SMMUDevice *sdev = container_of(mr, SMMUDevice, iommu);
76
SMMUv3State *s = sdev->smmu;
77
uint32_t sid = smmu_get_sid(sdev);
78
- SMMUEventInfo event = {.type = SMMU_EVT_NONE, .sid = sid};
79
+ SMMUEventInfo event = {.type = SMMU_EVT_NONE,
80
+ .sid = sid,
81
+ .inval_ste_allowed = false};
82
SMMUPTWEventInfo ptw_info = {};
83
SMMUTranslationStatus status;
84
SMMUState *bs = ARM_SMMU(s);
85
@@ -XXX,XX +XXX,XX @@ static void smmuv3_notify_iova(IOMMUMemoryRegion *mr,
86
dma_addr_t iova)
70
{
87
{
71
- if (s->regs[ENET_EIR] & s->regs[ENET_EIMR] & ENET_INT_TS_TIMER) {
88
SMMUDevice *sdev = container_of(mr, SMMUDevice, iommu);
72
+ /*
89
- SMMUEventInfo event = {};
73
+ * Previous versions of qemu had the ENET_INT_MAC and ENET_INT_TS_TIMER
90
+ SMMUEventInfo event = {.inval_ste_allowed = true};
74
+ * interrupts swapped. This worked with older versions of Linux (4.14
91
SMMUTransTableInfo *tt;
75
+ * and older) since Linux associated both interrupt lines with Ethernet
92
SMMUTransCfg *cfg;
76
+ * MAC interrupts. Specifically,
93
IOMMUTLBEntry entry;
77
+ * - Linux 4.15 and later have separate interrupt handlers for the MAC and
94
78
+ * timer interrupts. Those versions of Linux fail with versions of QEMU
95
cfg = smmuv3_get_config(sdev, &event);
79
+ * with swapped interrupt assignments.
96
if (!cfg) {
80
+ * - In linux 4.14, both interrupt lines were registered with the Ethernet
97
- qemu_log_mask(LOG_GUEST_ERROR,
81
+ * MAC interrupt handler. As a result, all versions of qemu happen to
98
- "%s error decoding the configuration for iommu mr=%s\n",
82
+ * work, though that is accidental.
99
- __func__, mr->parent_obj.name);
83
+ * - In Linux 4.9 and older, the timer interrupt was registered directly
100
return;
84
+ * with the Ethernet MAC interrupt handler. The MAC interrupt was
101
}
85
+ * redirected to a GPIO interrupt to work around erratum ERR006687.
102
86
+ * This was implemented using the SOC's IOMUX block. In qemu, this GPIO
87
+ * interrupt never fired since IOMUX is currently not supported in qemu.
88
+ * Linux instead received MAC interrupts on the timer interrupt.
89
+ * As a result, qemu versions with the swapped interrupt assignment work,
90
+ * albeit accidentally, but qemu versions with the correct interrupt
91
+ * assignment fail.
92
+ *
93
+ * To ensure that all versions of Linux work, generate ENET_INT_MAC
94
+ * interrrupts on both interrupt lines. This should be changed if and when
95
+ * qemu supports IOMUX.
96
+ */
97
+ if (s->regs[ENET_EIR] & s->regs[ENET_EIMR] &
98
+ (ENET_INT_MAC | ENET_INT_TS_TIMER)) {
99
qemu_set_irq(s->irq[1], 1);
100
} else {
101
qemu_set_irq(s->irq[1], 0);
102
--
103
--
103
2.16.2
104
2.20.1
104
105
105
106
diff view generated by jsdifflib
1
From: Andrey Smirnov <andrew.smirnov@gmail.com>
1
From: Richard Henderson <richard.henderson@linaro.org>
2
2
3
Add support for "TX complete"/TXDC interrupt generate by real HW since
3
The previous simplification got the order of operands to the
4
it is needed to support guests other than Linux.
4
subtraction wrong. Since the 64-bit product is the subtrahend,
5
we must use a 64-bit subtract to properly compute the borrow
6
from the low-part of the product.
5
7
6
Based on the patch by Bill Paul as found here:
8
Fixes: 5f8cd06ebcf5 ("target/arm: Simplify SMMLA, SMMLAR, SMMLS, SMMLSR")
7
https://bugs.launchpad.net/qemu/+bug/1753314
9
Reported-by: Laurent Desnogues <laurent.desnogues@gmail.com>
8
10
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
9
Cc: qemu-devel@nongnu.org
11
Tested-by: Laurent Desnogues <laurent.desnogues@gmail.com>
10
Cc: qemu-arm@nongnu.org
12
Message-id: 20190829013258.16102-1-richard.henderson@linaro.org
11
Cc: Bill Paul <wpaul@windriver.com>
12
Cc: Peter Maydell <peter.maydell@linaro.org>
13
Signed-off-by: Bill Paul <wpaul@windriver.com>
14
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
15
Message-id: 20180315191141.6789-2-andrew.smirnov@gmail.com
16
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
13
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
17
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
14
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
18
---
15
---
19
include/hw/char/imx_serial.h | 3 +++
16
target/arm/translate.c | 20 ++++++++++++++++++--
20
hw/char/imx_serial.c | 20 +++++++++++++++++---
17
1 file changed, 18 insertions(+), 2 deletions(-)
21
2 files changed, 20 insertions(+), 3 deletions(-)
22
18
23
diff --git a/include/hw/char/imx_serial.h b/include/hw/char/imx_serial.h
19
diff --git a/target/arm/translate.c b/target/arm/translate.c
24
index XXXXXXX..XXXXXXX 100644
20
index XXXXXXX..XXXXXXX 100644
25
--- a/include/hw/char/imx_serial.h
21
--- a/target/arm/translate.c
26
+++ b/include/hw/char/imx_serial.h
22
+++ b/target/arm/translate.c
27
@@ -XXX,XX +XXX,XX @@
23
@@ -XXX,XX +XXX,XX @@ static void disas_arm_insn(DisasContext *s, unsigned int insn)
28
#define UCR2_RXEN (1<<1) /* Receiver enable */
24
if (rd != 15) {
29
#define UCR2_SRST (1<<0) /* Reset complete */
25
tmp3 = load_reg(s, rd);
30
26
if (insn & (1 << 6)) {
31
+#define UCR4_TCEN BIT(3) /* TX complete interrupt enable */
27
- tcg_gen_sub_i32(tmp, tmp, tmp3);
32
+
28
+ /*
33
#define UTS1_TXEMPTY (1<<6)
29
+ * For SMMLS, we need a 64-bit subtract.
34
#define UTS1_RXEMPTY (1<<5)
30
+ * Borrow caused by a non-zero multiplicand
35
#define UTS1_TXFULL (1<<4)
31
+ * lowpart, and the correct result lowpart
36
@@ -XXX,XX +XXX,XX @@ typedef struct IMXSerialState {
32
+ * for rounding.
37
uint32_t ubmr;
33
+ */
38
uint32_t ubrc;
34
+ TCGv_i32 zero = tcg_const_i32(0);
39
uint32_t ucr3;
35
+ tcg_gen_sub2_i32(tmp2, tmp, zero, tmp3,
40
+ uint32_t ucr4;
36
+ tmp2, tmp);
41
37
+ tcg_temp_free_i32(zero);
42
qemu_irq irq;
38
} else {
43
CharBackend chr;
39
tcg_gen_add_i32(tmp, tmp, tmp3);
44
diff --git a/hw/char/imx_serial.c b/hw/char/imx_serial.c
40
}
45
index XXXXXXX..XXXXXXX 100644
41
@@ -XXX,XX +XXX,XX @@ static void disas_thumb2_insn(DisasContext *s, uint32_t insn)
46
--- a/hw/char/imx_serial.c
42
if (insn & (1 << 20)) {
47
+++ b/hw/char/imx_serial.c
43
tcg_gen_add_i32(tmp, tmp, tmp3);
48
@@ -XXX,XX +XXX,XX @@
44
} else {
49
45
- tcg_gen_sub_i32(tmp, tmp, tmp3);
50
static const VMStateDescription vmstate_imx_serial = {
46
+ /*
51
.name = TYPE_IMX_SERIAL,
47
+ * For SMMLS, we need a 64-bit subtract.
52
- .version_id = 1,
48
+ * Borrow caused by a non-zero multiplicand lowpart,
53
- .minimum_version_id = 1,
49
+ * and the correct result lowpart for rounding.
54
+ .version_id = 2,
50
+ */
55
+ .minimum_version_id = 2,
51
+ TCGv_i32 zero = tcg_const_i32(0);
56
.fields = (VMStateField[]) {
52
+ tcg_gen_sub2_i32(tmp2, tmp, zero, tmp3, tmp2, tmp);
57
VMSTATE_INT32(readbuff, IMXSerialState),
53
+ tcg_temp_free_i32(zero);
58
VMSTATE_UINT32(usr1, IMXSerialState),
54
}
59
@@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_imx_serial = {
55
tcg_temp_free_i32(tmp3);
60
VMSTATE_UINT32(ubmr, IMXSerialState),
56
}
61
VMSTATE_UINT32(ubrc, IMXSerialState),
62
VMSTATE_UINT32(ucr3, IMXSerialState),
63
+ VMSTATE_UINT32(ucr4, IMXSerialState),
64
VMSTATE_END_OF_LIST()
65
},
66
};
67
@@ -XXX,XX +XXX,XX @@ static void imx_update(IMXSerialState *s)
68
* unfortunately.
69
*/
70
mask = (s->ucr1 & UCR1_TXMPTYEN) ? USR2_TXFE : 0;
71
+ /*
72
+ * TCEN and TXDC are both bit 3
73
+ */
74
+ mask |= s->ucr4 & UCR4_TCEN;
75
+
76
usr2 = s->usr2 & mask;
77
78
qemu_set_irq(s->irq, usr1 || usr2);
79
@@ -XXX,XX +XXX,XX @@ static uint64_t imx_serial_read(void *opaque, hwaddr offset,
80
return s->ucr3;
81
82
case 0x23: /* UCR4 */
83
+ return s->ucr4;
84
+
85
case 0x29: /* BRM Incremental */
86
return 0x0; /* TODO */
87
88
@@ -XXX,XX +XXX,XX @@ static void imx_serial_write(void *opaque, hwaddr offset,
89
* qemu_chr_fe_write and background I/O callbacks */
90
qemu_chr_fe_write_all(&s->chr, &ch, 1);
91
s->usr1 &= ~USR1_TRDY;
92
+ s->usr2 &= ~USR2_TXDC;
93
imx_update(s);
94
s->usr1 |= USR1_TRDY;
95
+ s->usr2 |= USR2_TXDC;
96
imx_update(s);
97
}
98
break;
99
@@ -XXX,XX +XXX,XX @@ static void imx_serial_write(void *opaque, hwaddr offset,
100
s->ucr3 = value & 0xffff;
101
break;
102
103
- case 0x2d: /* UTS1 */
104
case 0x23: /* UCR4 */
105
+ s->ucr4 = value & 0xffff;
106
+ imx_update(s);
107
+ break;
108
+
109
+ case 0x2d: /* UTS1 */
110
qemu_log_mask(LOG_UNIMP, "[%s]%s: Unimplemented reg 0x%"
111
HWADDR_PRIx "\n", TYPE_IMX_SERIAL, __func__, offset);
112
/* TODO */
113
--
57
--
114
2.16.2
58
2.20.1
115
59
116
60
diff view generated by jsdifflib
New patch
1
From: Philippe Mathieu-Daudé <philmd@redhat.com>
1
2
3
Commit ba1ba5cca introduce the ARM_CPU_TYPE_NAME() macro.
4
Unify the code base by use it in all places.
5
6
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
7
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
8
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
9
Message-id: 20190823143249.8096-2-philmd@redhat.com
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
---
12
hw/arm/allwinner-a10.c | 3 ++-
13
hw/arm/cubieboard.c | 3 ++-
14
hw/arm/digic.c | 3 ++-
15
hw/arm/fsl-imx25.c | 2 +-
16
hw/arm/fsl-imx31.c | 2 +-
17
hw/arm/fsl-imx6.c | 3 ++-
18
hw/arm/fsl-imx6ul.c | 2 +-
19
hw/arm/xlnx-zynqmp.c | 8 ++++----
20
8 files changed, 15 insertions(+), 11 deletions(-)
21
22
diff --git a/hw/arm/allwinner-a10.c b/hw/arm/allwinner-a10.c
23
index XXXXXXX..XXXXXXX 100644
24
--- a/hw/arm/allwinner-a10.c
25
+++ b/hw/arm/allwinner-a10.c
26
@@ -XXX,XX +XXX,XX @@ static void aw_a10_init(Object *obj)
27
AwA10State *s = AW_A10(obj);
28
29
object_initialize_child(obj, "cpu", &s->cpu, sizeof(s->cpu),
30
- "cortex-a8-" TYPE_ARM_CPU, &error_abort, NULL);
31
+ ARM_CPU_TYPE_NAME("cortex-a8"),
32
+ &error_abort, NULL);
33
34
sysbus_init_child_obj(obj, "intc", &s->intc, sizeof(s->intc),
35
TYPE_AW_A10_PIC);
36
diff --git a/hw/arm/cubieboard.c b/hw/arm/cubieboard.c
37
index XXXXXXX..XXXXXXX 100644
38
--- a/hw/arm/cubieboard.c
39
+++ b/hw/arm/cubieboard.c
40
@@ -XXX,XX +XXX,XX @@ static void cubieboard_init(MachineState *machine)
41
42
static void cubieboard_machine_init(MachineClass *mc)
43
{
44
- mc->desc = "cubietech cubieboard";
45
+ mc->desc = "cubietech cubieboard (Cortex-A9)";
46
+ mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-a9");
47
mc->init = cubieboard_init;
48
mc->block_default_type = IF_IDE;
49
mc->units_per_default_bus = 1;
50
diff --git a/hw/arm/digic.c b/hw/arm/digic.c
51
index XXXXXXX..XXXXXXX 100644
52
--- a/hw/arm/digic.c
53
+++ b/hw/arm/digic.c
54
@@ -XXX,XX +XXX,XX @@ static void digic_init(Object *obj)
55
int i;
56
57
object_initialize_child(obj, "cpu", &s->cpu, sizeof(s->cpu),
58
- "arm946-" TYPE_ARM_CPU, &error_abort, NULL);
59
+ ARM_CPU_TYPE_NAME("arm946"),
60
+ &error_abort, NULL);
61
62
for (i = 0; i < DIGIC4_NB_TIMERS; i++) {
63
#define DIGIC_TIMER_NAME_MLEN 11
64
diff --git a/hw/arm/fsl-imx25.c b/hw/arm/fsl-imx25.c
65
index XXXXXXX..XXXXXXX 100644
66
--- a/hw/arm/fsl-imx25.c
67
+++ b/hw/arm/fsl-imx25.c
68
@@ -XXX,XX +XXX,XX @@ static void fsl_imx25_init(Object *obj)
69
FslIMX25State *s = FSL_IMX25(obj);
70
int i;
71
72
- object_initialize(&s->cpu, sizeof(s->cpu), "arm926-" TYPE_ARM_CPU);
73
+ object_initialize(&s->cpu, sizeof(s->cpu), ARM_CPU_TYPE_NAME("arm926"));
74
75
sysbus_init_child_obj(obj, "avic", &s->avic, sizeof(s->avic),
76
TYPE_IMX_AVIC);
77
diff --git a/hw/arm/fsl-imx31.c b/hw/arm/fsl-imx31.c
78
index XXXXXXX..XXXXXXX 100644
79
--- a/hw/arm/fsl-imx31.c
80
+++ b/hw/arm/fsl-imx31.c
81
@@ -XXX,XX +XXX,XX @@ static void fsl_imx31_init(Object *obj)
82
FslIMX31State *s = FSL_IMX31(obj);
83
int i;
84
85
- object_initialize(&s->cpu, sizeof(s->cpu), "arm1136-" TYPE_ARM_CPU);
86
+ object_initialize(&s->cpu, sizeof(s->cpu), ARM_CPU_TYPE_NAME("arm1136"));
87
88
sysbus_init_child_obj(obj, "avic", &s->avic, sizeof(s->avic),
89
TYPE_IMX_AVIC);
90
diff --git a/hw/arm/fsl-imx6.c b/hw/arm/fsl-imx6.c
91
index XXXXXXX..XXXXXXX 100644
92
--- a/hw/arm/fsl-imx6.c
93
+++ b/hw/arm/fsl-imx6.c
94
@@ -XXX,XX +XXX,XX @@ static void fsl_imx6_init(Object *obj)
95
for (i = 0; i < MIN(ms->smp.cpus, FSL_IMX6_NUM_CPUS); i++) {
96
snprintf(name, NAME_SIZE, "cpu%d", i);
97
object_initialize_child(obj, name, &s->cpu[i], sizeof(s->cpu[i]),
98
- "cortex-a9-" TYPE_ARM_CPU, &error_abort, NULL);
99
+ ARM_CPU_TYPE_NAME("cortex-a9"),
100
+ &error_abort, NULL);
101
}
102
103
sysbus_init_child_obj(obj, "a9mpcore", &s->a9mpcore, sizeof(s->a9mpcore),
104
diff --git a/hw/arm/fsl-imx6ul.c b/hw/arm/fsl-imx6ul.c
105
index XXXXXXX..XXXXXXX 100644
106
--- a/hw/arm/fsl-imx6ul.c
107
+++ b/hw/arm/fsl-imx6ul.c
108
@@ -XXX,XX +XXX,XX @@ static void fsl_imx6ul_init(Object *obj)
109
int i;
110
111
object_initialize_child(obj, "cpu0", &s->cpu, sizeof(s->cpu),
112
- "cortex-a7-" TYPE_ARM_CPU, &error_abort, NULL);
113
+ ARM_CPU_TYPE_NAME("cortex-a7"), &error_abort, NULL);
114
115
/*
116
* A7MPCORE
117
diff --git a/hw/arm/xlnx-zynqmp.c b/hw/arm/xlnx-zynqmp.c
118
index XXXXXXX..XXXXXXX 100644
119
--- a/hw/arm/xlnx-zynqmp.c
120
+++ b/hw/arm/xlnx-zynqmp.c
121
@@ -XXX,XX +XXX,XX @@ static void xlnx_zynqmp_create_rpu(MachineState *ms, XlnxZynqMPState *s,
122
123
object_initialize_child(OBJECT(&s->rpu_cluster), "rpu-cpu[*]",
124
&s->rpu_cpu[i], sizeof(s->rpu_cpu[i]),
125
- "cortex-r5f-" TYPE_ARM_CPU, &error_abort,
126
- NULL);
127
+ ARM_CPU_TYPE_NAME("cortex-r5f"),
128
+ &error_abort, NULL);
129
130
name = object_get_canonical_path_component(OBJECT(&s->rpu_cpu[i]));
131
if (strcmp(name, boot_cpu)) {
132
@@ -XXX,XX +XXX,XX @@ static void xlnx_zynqmp_init(Object *obj)
133
for (i = 0; i < num_apus; i++) {
134
object_initialize_child(OBJECT(&s->apu_cluster), "apu-cpu[*]",
135
&s->apu_cpu[i], sizeof(s->apu_cpu[i]),
136
- "cortex-a53-" TYPE_ARM_CPU, &error_abort,
137
- NULL);
138
+ ARM_CPU_TYPE_NAME("cortex-a53"),
139
+ &error_abort, NULL);
140
}
141
142
sysbus_init_child_obj(obj, "gic", &s->gic, sizeof(s->gic),
143
--
144
2.20.1
145
146
diff view generated by jsdifflib
New patch
1
From: Philippe Mathieu-Daudé <philmd@redhat.com>
1
2
3
As explained in commit aff39be0ed97:
4
5
Both functions, object_initialize() and object_property_add_child()
6
increase the reference counter of the new object, so one of the
7
references has to be dropped afterwards to get the reference
8
counting right. Otherwise the child object will not be properly
9
cleaned up when the parent gets destroyed.
10
Thus let's use now object_initialize_child() instead to get the
11
reference counting here right.
12
13
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
14
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
15
Reviewed-by: Thomas Huth <thuth@redhat.com>
16
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
17
Message-id: 20190823143249.8096-3-philmd@redhat.com
18
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
19
---
20
hw/arm/mcimx7d-sabre.c | 9 ++++-----
21
hw/arm/mps2-tz.c | 15 +++++++--------
22
hw/arm/musca.c | 9 +++++----
23
3 files changed, 16 insertions(+), 17 deletions(-)
24
25
diff --git a/hw/arm/mcimx7d-sabre.c b/hw/arm/mcimx7d-sabre.c
26
index XXXXXXX..XXXXXXX 100644
27
--- a/hw/arm/mcimx7d-sabre.c
28
+++ b/hw/arm/mcimx7d-sabre.c
29
@@ -XXX,XX +XXX,XX @@ static void mcimx7d_sabre_init(MachineState *machine)
30
{
31
static struct arm_boot_info boot_info;
32
MCIMX7Sabre *s = g_new0(MCIMX7Sabre, 1);
33
- Object *soc;
34
int i;
35
36
if (machine->ram_size > FSL_IMX7_MMDC_SIZE) {
37
@@ -XXX,XX +XXX,XX @@ static void mcimx7d_sabre_init(MachineState *machine)
38
.nb_cpus = machine->smp.cpus,
39
};
40
41
- object_initialize(&s->soc, sizeof(s->soc), TYPE_FSL_IMX7);
42
- soc = OBJECT(&s->soc);
43
- object_property_add_child(OBJECT(machine), "soc", soc, &error_fatal);
44
- object_property_set_bool(soc, true, "realized", &error_fatal);
45
+ object_initialize_child(OBJECT(machine), "soc",
46
+ &s->soc, sizeof(s->soc),
47
+ TYPE_FSL_IMX7, &error_fatal, NULL);
48
+ object_property_set_bool(OBJECT(&s->soc), true, "realized", &error_fatal);
49
50
memory_region_allocate_system_memory(&s->ram, NULL, "mcimx7d-sabre.ram",
51
machine->ram_size);
52
diff --git a/hw/arm/mps2-tz.c b/hw/arm/mps2-tz.c
53
index XXXXXXX..XXXXXXX 100644
54
--- a/hw/arm/mps2-tz.c
55
+++ b/hw/arm/mps2-tz.c
56
@@ -XXX,XX +XXX,XX @@ static void mps2tz_common_init(MachineState *machine)
57
/* The sec_resp_cfg output from the IoTKit must be split into multiple
58
* lines, one for each of the PPCs we create here, plus one per MSC.
59
*/
60
- object_initialize(&mms->sec_resp_splitter, sizeof(mms->sec_resp_splitter),
61
- TYPE_SPLIT_IRQ);
62
- object_property_add_child(OBJECT(machine), "sec-resp-splitter",
63
- OBJECT(&mms->sec_resp_splitter), &error_abort);
64
+ object_initialize_child(OBJECT(machine), "sec-resp-splitter",
65
+ &mms->sec_resp_splitter,
66
+ sizeof(mms->sec_resp_splitter),
67
+ TYPE_SPLIT_IRQ, &error_abort, NULL);
68
object_property_set_int(OBJECT(&mms->sec_resp_splitter),
69
ARRAY_SIZE(mms->ppc) + ARRAY_SIZE(mms->msc),
70
"num-lines", &error_fatal);
71
@@ -XXX,XX +XXX,XX @@ static void mps2tz_common_init(MachineState *machine)
72
* Tx, Rx and "combined" IRQs are sent to the NVIC separately.
73
* Create the OR gate for this.
74
*/
75
- object_initialize(&mms->uart_irq_orgate, sizeof(mms->uart_irq_orgate),
76
- TYPE_OR_IRQ);
77
- object_property_add_child(OBJECT(mms), "uart-irq-orgate",
78
- OBJECT(&mms->uart_irq_orgate), &error_abort);
79
+ object_initialize_child(OBJECT(mms), "uart-irq-orgate",
80
+ &mms->uart_irq_orgate, sizeof(mms->uart_irq_orgate),
81
+ TYPE_OR_IRQ, &error_abort, NULL);
82
object_property_set_int(OBJECT(&mms->uart_irq_orgate), 10, "num-lines",
83
&error_fatal);
84
object_property_set_bool(OBJECT(&mms->uart_irq_orgate), true,
85
diff --git a/hw/arm/musca.c b/hw/arm/musca.c
86
index XXXXXXX..XXXXXXX 100644
87
--- a/hw/arm/musca.c
88
+++ b/hw/arm/musca.c
89
@@ -XXX,XX +XXX,XX @@ static void musca_init(MachineState *machine)
90
* The sec_resp_cfg output from the SSE-200 must be split into multiple
91
* lines, one for each of the PPCs we create here.
92
*/
93
- object_initialize(&mms->sec_resp_splitter, sizeof(mms->sec_resp_splitter),
94
- TYPE_SPLIT_IRQ);
95
- object_property_add_child(OBJECT(machine), "sec-resp-splitter",
96
- OBJECT(&mms->sec_resp_splitter), &error_fatal);
97
+ object_initialize_child(OBJECT(machine), "sec-resp-splitter",
98
+ &mms->sec_resp_splitter,
99
+ sizeof(mms->sec_resp_splitter),
100
+ TYPE_SPLIT_IRQ, &error_fatal, NULL);
101
+
102
object_property_set_int(OBJECT(&mms->sec_resp_splitter),
103
ARRAY_SIZE(mms->ppc), "num-lines", &error_fatal);
104
object_property_set_bool(OBJECT(&mms->sec_resp_splitter), true,
105
--
106
2.20.1
107
108
diff view generated by jsdifflib
New patch
1
From: Philippe Mathieu-Daudé <philmd@redhat.com>
1
2
3
Both object_initialize() and qdev_set_parent_bus() increase the
4
reference counter of the new object, so one of the references has
5
to be dropped afterwards to get the reference counting right.
6
In machine model code this refcount leak is not particularly
7
problematic because (unlike devices) machines will never be
8
created on demand via QMP, and they are never destroyed.
9
But in any case let's use the new sysbus_init_child_obj() instead
10
to get the reference counting here right.
11
12
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
13
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
14
Message-id: 20190823143249.8096-4-philmd@redhat.com
15
[PMM: rewrote commit message]
16
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
17
---
18
hw/arm/exynos4_boards.c | 4 ++--
19
1 file changed, 2 insertions(+), 2 deletions(-)
20
21
diff --git a/hw/arm/exynos4_boards.c b/hw/arm/exynos4_boards.c
22
index XXXXXXX..XXXXXXX 100644
23
--- a/hw/arm/exynos4_boards.c
24
+++ b/hw/arm/exynos4_boards.c
25
@@ -XXX,XX +XXX,XX @@ exynos4_boards_init_common(MachineState *machine,
26
exynos4_boards_init_ram(s, get_system_memory(),
27
exynos4_board_ram_size[board_type]);
28
29
- object_initialize(&s->soc, sizeof(s->soc), TYPE_EXYNOS4210_SOC);
30
- qdev_set_parent_bus(DEVICE(&s->soc), sysbus_get_default());
31
+ sysbus_init_child_obj(OBJECT(machine), "soc",
32
+ &s->soc, sizeof(s->soc), TYPE_EXYNOS4210_SOC);
33
object_property_set_bool(OBJECT(&s->soc), true, "realized",
34
&error_fatal);
35
36
--
37
2.20.1
38
39
diff view generated by jsdifflib
New patch
1
From: Philippe Mathieu-Daudé <philmd@redhat.com>
1
2
3
Child properties form the composition tree. All objects need to be
4
a child of another object. Objects can only be a child of one object.
5
6
Respect this with the i.MX SoC, to get a cleaner composition tree.
7
8
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
9
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
10
Message-id: 20190823143249.8096-5-philmd@redhat.com
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
---
13
hw/arm/fsl-imx25.c | 4 +++-
14
hw/arm/fsl-imx31.c | 4 +++-
15
2 files changed, 6 insertions(+), 2 deletions(-)
16
17
diff --git a/hw/arm/fsl-imx25.c b/hw/arm/fsl-imx25.c
18
index XXXXXXX..XXXXXXX 100644
19
--- a/hw/arm/fsl-imx25.c
20
+++ b/hw/arm/fsl-imx25.c
21
@@ -XXX,XX +XXX,XX @@ static void fsl_imx25_init(Object *obj)
22
FslIMX25State *s = FSL_IMX25(obj);
23
int i;
24
25
- object_initialize(&s->cpu, sizeof(s->cpu), ARM_CPU_TYPE_NAME("arm926"));
26
+ object_initialize_child(obj, "cpu", &s->cpu, sizeof(s->cpu),
27
+ ARM_CPU_TYPE_NAME("arm926"),
28
+ &error_abort, NULL);
29
30
sysbus_init_child_obj(obj, "avic", &s->avic, sizeof(s->avic),
31
TYPE_IMX_AVIC);
32
diff --git a/hw/arm/fsl-imx31.c b/hw/arm/fsl-imx31.c
33
index XXXXXXX..XXXXXXX 100644
34
--- a/hw/arm/fsl-imx31.c
35
+++ b/hw/arm/fsl-imx31.c
36
@@ -XXX,XX +XXX,XX @@ static void fsl_imx31_init(Object *obj)
37
FslIMX31State *s = FSL_IMX31(obj);
38
int i;
39
40
- object_initialize(&s->cpu, sizeof(s->cpu), ARM_CPU_TYPE_NAME("arm1136"));
41
+ object_initialize_child(obj, "cpu", &s->cpu, sizeof(s->cpu),
42
+ ARM_CPU_TYPE_NAME("arm1136"),
43
+ &error_abort, NULL);
44
45
sysbus_init_child_obj(obj, "avic", &s->avic, sizeof(s->avic),
46
TYPE_IMX_AVIC);
47
--
48
2.20.1
49
50
diff view generated by jsdifflib
New patch
1
From: Philippe Mathieu-Daudé <philmd@redhat.com>
1
2
3
As explained in commit aff39be0ed97:
4
5
Both functions, object_initialize() and object_property_add_child()
6
increase the reference counter of the new object, so one of the
7
references has to be dropped afterwards to get the reference
8
counting right. Otherwise the child object will not be properly
9
cleaned up when the parent gets destroyed.
10
Thus let's use now object_initialize_child() instead to get the
11
reference counting here right.
12
13
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
14
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
15
Reviewed-by: Thomas Huth <thuth@redhat.com>
16
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
17
Message-id: 20190823143249.8096-6-philmd@redhat.com
18
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
19
---
20
hw/dma/xilinx_axidma.c | 16 ++++++++--------
21
1 file changed, 8 insertions(+), 8 deletions(-)
22
23
diff --git a/hw/dma/xilinx_axidma.c b/hw/dma/xilinx_axidma.c
24
index XXXXXXX..XXXXXXX 100644
25
--- a/hw/dma/xilinx_axidma.c
26
+++ b/hw/dma/xilinx_axidma.c
27
@@ -XXX,XX +XXX,XX @@ static void xilinx_axidma_init(Object *obj)
28
XilinxAXIDMA *s = XILINX_AXI_DMA(obj);
29
SysBusDevice *sbd = SYS_BUS_DEVICE(obj);
30
31
- object_initialize(&s->rx_data_dev, sizeof(s->rx_data_dev),
32
- TYPE_XILINX_AXI_DMA_DATA_STREAM);
33
- object_initialize(&s->rx_control_dev, sizeof(s->rx_control_dev),
34
- TYPE_XILINX_AXI_DMA_CONTROL_STREAM);
35
- object_property_add_child(OBJECT(s), "axistream-connected-target",
36
- (Object *)&s->rx_data_dev, &error_abort);
37
- object_property_add_child(OBJECT(s), "axistream-control-connected-target",
38
- (Object *)&s->rx_control_dev, &error_abort);
39
+ object_initialize_child(OBJECT(s), "axistream-connected-target",
40
+ &s->rx_data_dev, sizeof(s->rx_data_dev),
41
+ TYPE_XILINX_AXI_DMA_DATA_STREAM, &error_abort,
42
+ NULL);
43
+ object_initialize_child(OBJECT(s), "axistream-control-connected-target",
44
+ &s->rx_control_dev, sizeof(s->rx_control_dev),
45
+ TYPE_XILINX_AXI_DMA_CONTROL_STREAM, &error_abort,
46
+ NULL);
47
48
sysbus_init_irq(sbd, &s->streams[0].irq);
49
sysbus_init_irq(sbd, &s->streams[1].irq);
50
--
51
2.20.1
52
53
diff view generated by jsdifflib
New patch
1
From: Philippe Mathieu-Daudé <philmd@redhat.com>
1
2
3
As explained in commit aff39be0ed97:
4
5
Both functions, object_initialize() and object_property_add_child()
6
increase the reference counter of the new object, so one of the
7
references has to be dropped afterwards to get the reference
8
counting right. Otherwise the child object will not be properly
9
cleaned up when the parent gets destroyed.
10
Thus let's use now object_initialize_child() instead to get the
11
reference counting here right.
12
13
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
14
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
15
Reviewed-by: Thomas Huth <thuth@redhat.com>
16
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
17
Message-id: 20190823143249.8096-7-philmd@redhat.com
18
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
19
---
20
hw/net/xilinx_axienet.c | 17 ++++++++---------
21
1 file changed, 8 insertions(+), 9 deletions(-)
22
23
diff --git a/hw/net/xilinx_axienet.c b/hw/net/xilinx_axienet.c
24
index XXXXXXX..XXXXXXX 100644
25
--- a/hw/net/xilinx_axienet.c
26
+++ b/hw/net/xilinx_axienet.c
27
@@ -XXX,XX +XXX,XX @@ static void xilinx_enet_init(Object *obj)
28
XilinxAXIEnet *s = XILINX_AXI_ENET(obj);
29
SysBusDevice *sbd = SYS_BUS_DEVICE(obj);
30
31
- object_initialize(&s->rx_data_dev, sizeof(s->rx_data_dev),
32
- TYPE_XILINX_AXI_ENET_DATA_STREAM);
33
- object_initialize(&s->rx_control_dev, sizeof(s->rx_control_dev),
34
- TYPE_XILINX_AXI_ENET_CONTROL_STREAM);
35
- object_property_add_child(OBJECT(s), "axistream-connected-target",
36
- (Object *)&s->rx_data_dev, &error_abort);
37
- object_property_add_child(OBJECT(s), "axistream-control-connected-target",
38
- (Object *)&s->rx_control_dev, &error_abort);
39
-
40
+ object_initialize_child(OBJECT(s), "axistream-connected-target",
41
+ &s->rx_data_dev, sizeof(s->rx_data_dev),
42
+ TYPE_XILINX_AXI_ENET_DATA_STREAM, &error_abort,
43
+ NULL);
44
+ object_initialize_child(OBJECT(s), "axistream-control-connected-target",
45
+ &s->rx_control_dev, sizeof(s->rx_control_dev),
46
+ TYPE_XILINX_AXI_ENET_CONTROL_STREAM, &error_abort,
47
+ NULL);
48
sysbus_init_irq(sbd, &s->irq);
49
50
memory_region_init_io(&s->iomem, OBJECT(s), &enet_ops, s, "enet", 0x40000);
51
--
52
2.20.1
53
54
diff view generated by jsdifflib
1
Add some assertions that if we're about to boot an AArch64 kernel,
1
From: Alex Bennée <alex.bennee@linaro.org>
2
the board code has not mistakenly set either secure_boot or
3
secure_board_setup. It doesn't make sense to set secure_boot,
4
because all AArch64 kernels must be booted in non-secure mode.
5
2
6
It might in theory make sense to set secure_board_setup, but
3
Commit a5e0b3311 removed these in favour of querying machine
7
we don't currently support that, because only the AArch32
4
properties. Remove the extern declarations as well.
8
bootloader[] code calls this hook; bootloader_aarch64[] does not.
9
Since we don't have a current need for this functionality, just
10
assert that we don't try to use it. If it's needed we'll add
11
it later.
12
5
6
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
7
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
8
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
9
Message-id: 20190828165307.18321-6-alex.bennee@linaro.org
10
Cc: Like Xu <like.xu@linux.intel.com>
11
Message-Id: <20190711130546.18578-1-alex.bennee@linaro.org>
13
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
14
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
15
Message-id: 20180313153458.26822-3-peter.maydell@linaro.org
16
---
13
---
17
hw/arm/boot.c | 7 +++++++
14
include/sysemu/sysemu.h | 2 --
18
1 file changed, 7 insertions(+)
15
1 file changed, 2 deletions(-)
19
16
20
diff --git a/hw/arm/boot.c b/hw/arm/boot.c
17
diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h
21
index XXXXXXX..XXXXXXX 100644
18
index XXXXXXX..XXXXXXX 100644
22
--- a/hw/arm/boot.c
19
--- a/include/sysemu/sysemu.h
23
+++ b/hw/arm/boot.c
20
+++ b/include/sysemu/sysemu.h
24
@@ -XXX,XX +XXX,XX @@ static void do_cpu_reset(void *opaque)
21
@@ -XXX,XX +XXX,XX @@ extern const char *keyboard_layout;
25
} else {
22
extern int win2k_install_hack;
26
env->pstate = PSTATE_MODE_EL1h;
23
extern int alt_grab;
27
}
24
extern int ctrl_grab;
28
+ /* AArch64 kernels never boot in secure mode */
25
-extern int smp_cpus;
29
+ assert(!info->secure_boot);
26
-extern unsigned int max_cpus;
30
+ /* This hook is only supported for AArch32 currently:
27
extern int cursor_hide;
31
+ * bootloader_aarch64[] will not call the hook, and
28
extern int graphic_rotate;
32
+ * the code above has already dropped us into EL2 or EL1.
29
extern int no_quit;
33
+ */
34
+ assert(!info->secure_board_setup);
35
}
36
37
/* Set to non-secure if not a secure boot */
38
--
30
--
39
2.16.2
31
2.20.1
40
32
41
33
diff view generated by jsdifflib
1
The bcm2837 is pretty similar to the bcm2836, but it does have
1
From: "Emilio G. Cota" <cota@braap.org>
2
some differences. Notably, the MPIDR affinity aff1 values it
3
sets for the CPUs are 0x0, rather than the 0xf that the bcm2836
4
uses, and if this is wrong Linux will not boot.
5
2
6
Rather than trying to have one device with properties that
3
Afterwise is "wise after the fact", as in "hindsight".
7
configure it differently for the two cases, create two
4
Here we meant "afterwards" (as in "subsequently"). Fix it.
8
separate QOM devices for the two SoCs. We use the same approach
9
as hw/arm/aspeed_soc.c and share code and have a data table
10
that might differ per-SoC. For the moment the two types don't
11
actually have different behaviour.
12
5
6
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
7
Signed-off-by: Emilio G. Cota <cota@braap.org>
8
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
9
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
10
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
11
Message-id: 20190828165307.18321-7-alex.bennee@linaro.org
13
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
14
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
15
Message-id: 20180313153458.26822-7-peter.maydell@linaro.org
16
---
13
---
17
include/hw/arm/bcm2836.h | 19 +++++++++++++++++++
14
tcg/README | 2 +-
18
hw/arm/bcm2836.c | 37 ++++++++++++++++++++++++++++++++-----
15
1 file changed, 1 insertion(+), 1 deletion(-)
19
hw/arm/raspi.c | 3 ++-
20
3 files changed, 53 insertions(+), 6 deletions(-)
21
16
22
diff --git a/include/hw/arm/bcm2836.h b/include/hw/arm/bcm2836.h
17
diff --git a/tcg/README b/tcg/README
23
index XXXXXXX..XXXXXXX 100644
18
index XXXXXXX..XXXXXXX 100644
24
--- a/include/hw/arm/bcm2836.h
19
--- a/tcg/README
25
+++ b/include/hw/arm/bcm2836.h
20
+++ b/tcg/README
26
@@ -XXX,XX +XXX,XX @@
21
@@ -XXX,XX +XXX,XX @@ This can be overridden using the following function modifiers:
27
22
canonical locations before calling the helper.
28
#define BCM283X_NCPUS 4
23
- TCG_CALL_NO_WRITE_GLOBALS means that the helper does not modify any globals.
29
24
They will only be saved to their canonical location before calling helpers,
30
+/* These type names are for specific SoCs; other than instantiating
25
- but they won't be reloaded afterwise.
31
+ * them, code using these devices should always handle them via the
26
+ but they won't be reloaded afterwards.
32
+ * BCM283x base class, so they have no BCM2836(obj) etc macros.
27
- TCG_CALL_NO_SIDE_EFFECTS means that the call to the function is removed if
33
+ */
28
the return value is not used.
34
+#define TYPE_BCM2836 "bcm2836"
35
+#define TYPE_BCM2837 "bcm2837"
36
+
37
typedef struct BCM283XState {
38
/*< private >*/
39
DeviceState parent_obj;
40
@@ -XXX,XX +XXX,XX @@ typedef struct BCM283XState {
41
BCM2835PeripheralState peripherals;
42
} BCM283XState;
43
44
+typedef struct BCM283XInfo BCM283XInfo;
45
+
46
+typedef struct BCM283XClass {
47
+ DeviceClass parent_class;
48
+ const BCM283XInfo *info;
49
+} BCM283XClass;
50
+
51
+#define BCM283X_CLASS(klass) \
52
+ OBJECT_CLASS_CHECK(BCM283XClass, (klass), TYPE_BCM283X)
53
+#define BCM283X_GET_CLASS(obj) \
54
+ OBJECT_GET_CLASS(BCM283XClass, (obj), TYPE_BCM283X)
55
+
56
#endif /* BCM2836_H */
57
diff --git a/hw/arm/bcm2836.c b/hw/arm/bcm2836.c
58
index XXXXXXX..XXXXXXX 100644
59
--- a/hw/arm/bcm2836.c
60
+++ b/hw/arm/bcm2836.c
61
@@ -XXX,XX +XXX,XX @@
62
/* "QA7" (Pi2) interrupt controller and mailboxes etc. */
63
#define BCM2836_CONTROL_BASE 0x40000000
64
65
+struct BCM283XInfo {
66
+ const char *name;
67
+};
68
+
69
+static const BCM283XInfo bcm283x_socs[] = {
70
+ {
71
+ .name = TYPE_BCM2836,
72
+ },
73
+ {
74
+ .name = TYPE_BCM2837,
75
+ },
76
+};
77
+
78
static void bcm2836_init(Object *obj)
79
{
80
BCM283XState *s = BCM283X(obj);
81
@@ -XXX,XX +XXX,XX @@ static Property bcm2836_props[] = {
82
DEFINE_PROP_END_OF_LIST()
83
};
84
85
-static void bcm2836_class_init(ObjectClass *oc, void *data)
86
+static void bcm283x_class_init(ObjectClass *oc, void *data)
87
{
88
DeviceClass *dc = DEVICE_CLASS(oc);
89
+ BCM283XClass *bc = BCM283X_CLASS(oc);
90
91
- dc->props = bcm2836_props;
92
+ bc->info = data;
93
dc->realize = bcm2836_realize;
94
+ dc->props = bcm2836_props;
95
}
96
97
-static const TypeInfo bcm2836_type_info = {
98
+static const TypeInfo bcm283x_type_info = {
99
.name = TYPE_BCM283X,
100
.parent = TYPE_DEVICE,
101
.instance_size = sizeof(BCM283XState),
102
.instance_init = bcm2836_init,
103
- .class_init = bcm2836_class_init,
104
+ .class_size = sizeof(BCM283XClass),
105
+ .abstract = true,
106
};
107
108
static void bcm2836_register_types(void)
109
{
110
- type_register_static(&bcm2836_type_info);
111
+ int i;
112
+
113
+ type_register_static(&bcm283x_type_info);
114
+ for (i = 0; i < ARRAY_SIZE(bcm283x_socs); i++) {
115
+ TypeInfo ti = {
116
+ .name = bcm283x_socs[i].name,
117
+ .parent = TYPE_BCM283X,
118
+ .class_init = bcm283x_class_init,
119
+ .class_data = (void *) &bcm283x_socs[i],
120
+ };
121
+ type_register(&ti);
122
+ }
123
}
124
125
type_init(bcm2836_register_types)
126
diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c
127
index XXXXXXX..XXXXXXX 100644
128
--- a/hw/arm/raspi.c
129
+++ b/hw/arm/raspi.c
130
@@ -XXX,XX +XXX,XX @@ static void raspi_init(MachineState *machine, int version)
131
BusState *bus;
132
DeviceState *carddev;
133
134
- object_initialize(&s->soc, sizeof(s->soc), TYPE_BCM283X);
135
+ object_initialize(&s->soc, sizeof(s->soc),
136
+ version == 3 ? TYPE_BCM2837 : TYPE_BCM2836);
137
object_property_add_child(OBJECT(machine), "soc", OBJECT(&s->soc),
138
&error_abort);
139
29
140
--
30
--
141
2.16.2
31
2.20.1
142
32
143
33
diff view generated by jsdifflib
1
From: Wei Huang <wei@redhat.com>
1
From: "Emilio G. Cota" <cota@braap.org>
2
2
3
For guest kernel that supports KASLR, the load address can change every
3
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
4
time when guest VM runs. To find the physical base address correctly,
4
Signed-off-by: Emilio G. Cota <cota@braap.org>
5
current QEMU dump searches VMCOREINFO for the string "NUMBER(phys_base)=".
5
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
6
However this string pattern is only available on x86_64. AArch64 uses a
6
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
7
different field, called "NUMBER(PHYS_OFFSET)=". This patch makes sure
7
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
8
QEMU dump uses the correct string on AArch64.
8
Message-id: 20190828165307.18321-8-alex.bennee@linaro.org
9
10
Signed-off-by: Wei Huang <wei@redhat.com>
11
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
12
Message-id: 1520615003-20869-1-git-send-email-wei@redhat.com
13
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
14
---
10
---
15
dump.c | 14 +++++++++++---
11
accel/tcg/atomic_template.h | 2 +-
16
1 file changed, 11 insertions(+), 3 deletions(-)
12
1 file changed, 1 insertion(+), 1 deletion(-)
17
13
18
diff --git a/dump.c b/dump.c
14
diff --git a/accel/tcg/atomic_template.h b/accel/tcg/atomic_template.h
19
index XXXXXXX..XXXXXXX 100644
15
index XXXXXXX..XXXXXXX 100644
20
--- a/dump.c
16
--- a/accel/tcg/atomic_template.h
21
+++ b/dump.c
17
+++ b/accel/tcg/atomic_template.h
22
@@ -XXX,XX +XXX,XX @@ static void vmcoreinfo_update_phys_base(DumpState *s)
18
@@ -XXX,XX +XXX,XX @@ ABI_TYPE ATOMIC_NAME(xchg)(CPUArchState *env, target_ulong addr,
23
19
24
lines = g_strsplit((char *)vmci, "\n", -1);
20
#define GEN_ATOMIC_HELPER(X) \
25
for (i = 0; lines[i]; i++) {
21
ABI_TYPE ATOMIC_NAME(X)(CPUArchState *env, target_ulong addr, \
26
- if (g_str_has_prefix(lines[i], "NUMBER(phys_base)=")) {
22
- ABI_TYPE val EXTRA_ARGS) \
27
- if (qemu_strtou64(lines[i] + 18, NULL, 16,
23
+ ABI_TYPE val EXTRA_ARGS) \
28
+ const char *prefix = NULL;
24
{ \
29
+
25
ATOMIC_MMU_DECLS; \
30
+ if (s->dump_info.d_machine == EM_X86_64) {
26
DATA_TYPE *haddr = ATOMIC_MMU_LOOKUP; \
31
+ prefix = "NUMBER(phys_base)=";
32
+ } else if (s->dump_info.d_machine == EM_AARCH64) {
33
+ prefix = "NUMBER(PHYS_OFFSET)=";
34
+ }
35
+
36
+ if (prefix && g_str_has_prefix(lines[i], prefix)) {
37
+ if (qemu_strtou64(lines[i] + strlen(prefix), NULL, 16,
38
&phys_base) < 0) {
39
- warn_report("Failed to read NUMBER(phys_base)=");
40
+ warn_report("Failed to read %s", prefix);
41
} else {
42
s->dump_info.phys_base = phys_base;
43
}
44
--
27
--
45
2.16.2
28
2.20.1
46
29
47
30
diff view generated by jsdifflib
1
The TypeInfo and state struct for bcm2386 disagree about what the
1
From: Alex Bennée <alex.bennee@linaro.org>
2
parent class is -- the TypeInfo says it's TYPE_SYS_BUS_DEVICE,
3
but the BCM2386State struct only defines the parent_obj field
4
as DeviceState. This would have caused problems if anything
5
actually tried to treat the object as a TYPE_SYS_BUS_DEVICE.
6
Fix the TypeInfo to use TYPE_DEVICE as the parent, since we don't
7
need any of the additional functionality TYPE_SYS_BUS_DEVICE
8
provides.
9
2
3
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
4
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
5
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
6
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
7
Message-id: 20190828165307.18321-10-alex.bennee@linaro.org
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
Reviewed-by: Andrew Baumann <Andrew.Baumann@microsoft.com>
12
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
13
Message-id: 20180313153458.26822-5-peter.maydell@linaro.org
14
---
9
---
15
hw/arm/bcm2836.c | 2 +-
10
include/exec/cpu-defs.h | 2 +-
16
1 file changed, 1 insertion(+), 1 deletion(-)
11
1 file changed, 1 insertion(+), 1 deletion(-)
17
12
18
diff --git a/hw/arm/bcm2836.c b/hw/arm/bcm2836.c
13
diff --git a/include/exec/cpu-defs.h b/include/exec/cpu-defs.h
19
index XXXXXXX..XXXXXXX 100644
14
index XXXXXXX..XXXXXXX 100644
20
--- a/hw/arm/bcm2836.c
15
--- a/include/exec/cpu-defs.h
21
+++ b/hw/arm/bcm2836.c
16
+++ b/include/exec/cpu-defs.h
22
@@ -XXX,XX +XXX,XX @@ static void bcm2836_class_init(ObjectClass *oc, void *data)
17
@@ -XXX,XX +XXX,XX @@ typedef struct CPUTLB { } CPUTLB;
23
18
#endif /* !CONFIG_USER_ONLY && CONFIG_TCG */
24
static const TypeInfo bcm2836_type_info = {
19
25
.name = TYPE_BCM2836,
20
/*
26
- .parent = TYPE_SYS_BUS_DEVICE,
21
- * This structure must be placed in ArchCPU immedately
27
+ .parent = TYPE_DEVICE,
22
+ * This structure must be placed in ArchCPU immediately
28
.instance_size = sizeof(BCM2836State),
23
* before CPUArchState, as a field named "neg".
29
.instance_init = bcm2836_init,
24
*/
30
.class_init = bcm2836_class_init,
25
typedef struct CPUNegativeOffsetState {
31
--
26
--
32
2.16.2
27
2.20.1
33
28
34
29
diff view generated by jsdifflib
1
For the rpi1 and 2 we want to boot the Linux kernel via some
1
The function neon_store_reg32() doesn't free the TCG temp that it
2
custom setup code that makes sure that the SMC instruction
2
is passed, so the caller must do that. We got this right in most
3
acts as a no-op, because it's used for cache maintenance.
3
places but forgot to free the TCG temps in trans_VMOV_64_sp().
4
The rpi3 boots AArch64 kernels, which don't need SMC for
5
cache maintenance and always expect to be booted non-secure.
6
Don't fill in the aarch32-specific parts of the binfo struct.
7
4
5
Cc: qemu-stable@nongnu.org
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Reviewed-by: Andrew Baumann <Andrew.Baumann@microsoft.com>
7
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
10
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
8
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
11
Message-id: 20180313153458.26822-2-peter.maydell@linaro.org
9
Message-id: 20190827121931.26836-1-peter.maydell@linaro.org
12
---
10
---
13
hw/arm/raspi.c | 17 +++++++++++++----
11
target/arm/translate-vfp.inc.c | 2 ++
14
1 file changed, 13 insertions(+), 4 deletions(-)
12
1 file changed, 2 insertions(+)
15
13
16
diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c
14
diff --git a/target/arm/translate-vfp.inc.c b/target/arm/translate-vfp.inc.c
17
index XXXXXXX..XXXXXXX 100644
15
index XXXXXXX..XXXXXXX 100644
18
--- a/hw/arm/raspi.c
16
--- a/target/arm/translate-vfp.inc.c
19
+++ b/hw/arm/raspi.c
17
+++ b/target/arm/translate-vfp.inc.c
20
@@ -XXX,XX +XXX,XX @@ static void setup_boot(MachineState *machine, int version, size_t ram_size)
18
@@ -XXX,XX +XXX,XX @@ static bool trans_VMOV_64_sp(DisasContext *s, arg_VMOV_64_sp *a)
21
binfo.board_id = raspi_boardid[version];
19
/* gpreg to fpreg */
22
binfo.ram_size = ram_size;
20
tmp = load_reg(s, a->rt);
23
binfo.nb_cpus = smp_cpus;
21
neon_store_reg32(tmp, a->vm);
24
- binfo.board_setup_addr = BOARDSETUP_ADDR;
22
+ tcg_temp_free_i32(tmp);
25
- binfo.write_board_setup = write_board_setup;
23
tmp = load_reg(s, a->rt2);
26
- binfo.secure_board_setup = true;
24
neon_store_reg32(tmp, a->vm + 1);
27
- binfo.secure_boot = true;
25
+ tcg_temp_free_i32(tmp);
28
+
26
}
29
+ if (version <= 2) {
27
30
+ /* The rpi1 and 2 require some custom setup code to run in Secure
28
return true;
31
+ * mode before booting a kernel (to set up the SMC vectors so
32
+ * that we get a no-op SMC; this is used by Linux to call the
33
+ * firmware for some cache maintenance operations.
34
+ * The rpi3 doesn't need this.
35
+ */
36
+ binfo.board_setup_addr = BOARDSETUP_ADDR;
37
+ binfo.write_board_setup = write_board_setup;
38
+ binfo.secure_board_setup = true;
39
+ binfo.secure_boot = true;
40
+ }
41
42
/* Pi2 and Pi3 requires SMP setup */
43
if (version >= 2) {
44
--
29
--
45
2.16.2
30
2.20.1
46
31
47
32
diff view generated by jsdifflib
1
From: Andrey Smirnov <andrew.smirnov@gmail.com>
1
An attempt to do an exception-return (branch to one of the magic
2
addresses) in linux-user mode for M-profile should behave like
3
a normal branch, because linux-user mode is always going to be
4
in 'handler' mode. This used to work, but we broke it when we added
5
support for the M-profile security extension in commit d02a8698d7ae2bfed.
2
6
3
Code of imx_update() is slightly confusing since the "flags" variable
7
In that commit we allowed even handler-mode calls to magic return
4
doesn't really corespond to anything in real hardware and server as a
8
values to be checked for and dealt with by causing an
5
kitchensink accumulating events normally reported via USR1 and USR2
9
EXCP_EXCEPTION_EXIT exception to be taken, because this is
6
registers.
10
needed for the FNC_RETURN return-from-non-secure-function-call
11
handling. For system mode we added a check in do_v7m_exception_exit()
12
to make any spurious calls from Handler mode behave correctly, but
13
forgot that linux-user mode would also be affected.
7
14
8
Change the code to explicitly evaluate state of interrupts reported
15
How an attempted return-from-non-secure-function-call in linux-user
9
via USR1 and USR2 against corresponding masking bits and use the to
16
mode should be handled is not clear -- on real hardware it would
10
detemine if IRQ line should be asserted or not.
17
result in return to secure code (not to the Linux kernel) which
18
could then handle the error in any way it chose. For QEMU we take
19
the simple approach of treating this erroneous return the same way
20
it would be handled on a CPU without the security extensions --
21
treat it as a normal branch.
11
22
12
NOTE: Check for UTS1_TXEMPTY being set has been dropped for two
23
The upshot of all this is that for linux-user mode we should never
13
reasons:
24
do any of the bx_excret magic, so the code change is simple.
14
25
15
1. Emulation code implements a single character FIFO, so this flag
26
This ought to be a weird corner case that only affects broken guest
16
will always be set since characters are trasmitted as a part of
27
code (because Linux user processes should never be attempting to do
17
the code emulating "push" into the FIFO
28
exception returns or NS function returns), except that the code that
29
assigns addresses in RAM for the process and stack in our linux-user
30
code does not attempt to avoid this magic address range, so
31
legitimate code attempting to return to a trampoline routine on the
32
stack can fall into this case. This change fixes those programs,
33
but we should also look at restricting the range of memory we
34
use for M-profile linux-user guests to the area that would be
35
real RAM in hardware.
18
36
19
2. imx_update() is really just a function doing ORing and maksing
37
Cc: qemu-stable@nongnu.org
20
of reported events, so checking for UTS1_TXEMPTY should happen,
38
Reported-by: Christophe Lyon <christophe.lyon@linaro.org>
21
if it's ever really needed should probably happen outside of
39
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
22
it.
40
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
23
41
Message-id: 20190822131534.16602-1-peter.maydell@linaro.org
24
Cc: qemu-devel@nongnu.org
42
Fixes: https://bugs.launchpad.net/qemu/+bug/1840922
25
Cc: qemu-arm@nongnu.org
26
Cc: Bill Paul <wpaul@windriver.com>
27
Cc: Peter Maydell <peter.maydell@linaro.org>
28
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
29
Message-id: 20180315191141.6789-1-andrew.smirnov@gmail.com
30
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
31
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
43
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
32
---
44
---
33
hw/char/imx_serial.c | 24 ++++++++++++++++--------
45
target/arm/translate.c | 21 ++++++++++++++++++++-
34
1 file changed, 16 insertions(+), 8 deletions(-)
46
1 file changed, 20 insertions(+), 1 deletion(-)
35
47
36
diff --git a/hw/char/imx_serial.c b/hw/char/imx_serial.c
48
diff --git a/target/arm/translate.c b/target/arm/translate.c
37
index XXXXXXX..XXXXXXX 100644
49
index XXXXXXX..XXXXXXX 100644
38
--- a/hw/char/imx_serial.c
50
--- a/target/arm/translate.c
39
+++ b/hw/char/imx_serial.c
51
+++ b/target/arm/translate.c
40
@@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_imx_serial = {
52
@@ -XXX,XX +XXX,XX @@ static inline void gen_bx(DisasContext *s, TCGv_i32 var)
41
53
store_cpu_field(var, thumb);
42
static void imx_update(IMXSerialState *s)
54
}
55
56
-/* Set PC and Thumb state from var. var is marked as dead.
57
+/*
58
+ * Set PC and Thumb state from var. var is marked as dead.
59
* For M-profile CPUs, include logic to detect exception-return
60
* branches and handle them. This is needed for Thumb POP/LDM to PC, LDR to PC,
61
* and BX reg, and no others, and happens only for code in Handler mode.
62
+ * The Security Extension also requires us to check for the FNC_RETURN
63
+ * which signals a function return from non-secure state; this can happen
64
+ * in both Handler and Thread mode.
65
+ * To avoid having to do multiple comparisons in inline generated code,
66
+ * we make the check we do here loose, so it will match for EXC_RETURN
67
+ * in Thread mode. For system emulation do_v7m_exception_exit() checks
68
+ * for these spurious cases and returns without doing anything (giving
69
+ * the same behaviour as for a branch to a non-magic address).
70
+ *
71
+ * In linux-user mode it is unclear what the right behaviour for an
72
+ * attempted FNC_RETURN should be, because in real hardware this will go
73
+ * directly to Secure code (ie not the Linux kernel) which will then treat
74
+ * the error in any way it chooses. For QEMU we opt to make the FNC_RETURN
75
+ * attempt behave the way it would on a CPU without the security extension,
76
+ * which is to say "like a normal branch". That means we can simply treat
77
+ * all branches as normal with no magic address behaviour.
78
*/
79
static inline void gen_bx_excret(DisasContext *s, TCGv_i32 var)
43
{
80
{
44
- uint32_t flags;
81
@@ -XXX,XX +XXX,XX @@ static inline void gen_bx_excret(DisasContext *s, TCGv_i32 var)
45
+ uint32_t usr1;
82
* s->base.is_jmp that we need to do the rest of the work later.
46
+ uint32_t usr2;
83
*/
47
+ uint32_t mask;
84
gen_bx(s, var);
48
85
+#ifndef CONFIG_USER_ONLY
49
- flags = (s->usr1 & s->ucr1) & (USR1_TRDY|USR1_RRDY);
86
if (arm_dc_feature(s, ARM_FEATURE_M_SECURITY) ||
50
- if (s->ucr1 & UCR1_TXMPTYEN) {
87
(s->v7m_handler_mode && arm_dc_feature(s, ARM_FEATURE_M))) {
51
- flags |= (s->uts1 & UTS1_TXEMPTY);
88
s->base.is_jmp = DISAS_BX_EXCRET;
52
- } else {
89
}
53
- flags &= ~USR1_TRDY;
90
+#endif
54
- }
55
+ /*
56
+ * Lucky for us TRDY and RRDY has the same offset in both USR1 and
57
+ * UCR1, so we can get away with something as simple as the
58
+ * following:
59
+ */
60
+ usr1 = s->usr1 & s->ucr1 & (USR1_TRDY | USR1_RRDY);
61
+ /*
62
+ * Bits that we want in USR2 are not as conveniently laid out,
63
+ * unfortunately.
64
+ */
65
+ mask = (s->ucr1 & UCR1_TXMPTYEN) ? USR2_TXFE : 0;
66
+ usr2 = s->usr2 & mask;
67
68
- qemu_set_irq(s->irq, !!flags);
69
+ qemu_set_irq(s->irq, usr1 || usr2);
70
}
91
}
71
92
72
static void imx_serial_reset(IMXSerialState *s)
93
static inline void gen_bx_excret_final_code(DisasContext *s)
73
--
94
--
74
2.16.2
95
2.20.1
75
96
76
97
diff view generated by jsdifflib