1
Arm patch queue -- these are all bug fix patches but we might
1
Latest arm queue, a mixed bag of features and bug fixes.
2
as well put them in to rc0...
3
2
4
thanks
3
thanks
5
-- PMM
4
-- PMM
6
5
7
The following changes since commit 2c8cfc0b52b5a4d123c26c0b5fdf941be24805be:
6
The following changes since commit cbf01142b2aef0c0b4e995cecd7e79d342bbc47e:
8
7
9
Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging (2018-03-19 11:44:26 +0000)
8
Merge remote-tracking branch 'remotes/rth/tags/pull-tcg-20200115' into staging (2020-01-17 12:13:17 +0000)
10
9
11
are available in the Git repository at:
10
are available in the Git repository at:
12
11
13
git://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20180319
12
https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20200117-1
14
13
15
for you to fetch changes up to ff72cb6b46b95bb530787add5277c211af3d31c6:
14
for you to fetch changes up to 1a1fbc6cbb34c26d43d8360c66c1d21681af14a9:
16
15
17
hw/arm/raspi: Provide spin-loop code for AArch64 CPUs (2018-03-19 18:23:24 +0000)
16
target/arm: Set ISSIs16Bit in make_issinfo (2020-01-17 14:27:16 +0000)
18
17
19
----------------------------------------------------------------
18
----------------------------------------------------------------
20
target-arm queue:
19
Add model of the Netduino Plus 2 board
21
* fsl-imx6: Fix incorrect Ethernet interrupt defines
20
Some allwinner-a10 code cleanup
22
* dump: Update correct kdump phys_base field for AArch64
21
New test cases for cubieboard
23
* char: i.MX: Add support for "TX complete" interrupt
22
target/arm/arm-semi: fix SYS_OPEN to return nonzero filehandle
24
* bcm2836/raspi: Fix various bugs resulting in panics trying
23
i.MX: add an emulation for RNGC device
25
to boot a Debian Linux kernel on raspi3
24
target/arm: adjust program counter for wfi exception in AArch32
25
arm/gicv3: update virtual irq state after IAR register read
26
Set IL bit correctly for syndrome information for data aborts
26
27
27
----------------------------------------------------------------
28
----------------------------------------------------------------
28
Andrey Smirnov (2):
29
Alistair Francis (4):
29
char: i.MX: Simplify imx_update()
30
hw/misc: Add the STM32F4xx Sysconfig device
30
char: i.MX: Add support for "TX complete" interrupt
31
hw/misc: Add the STM32F4xx EXTI device
32
hw/arm: Add the STM32F4xx SoC
33
hw/arm: Add the Netduino Plus 2
31
34
32
Guenter Roeck (1):
35
Jeff Kubascik (3):
33
fsl-imx6: Swap Ethernet interrupt defines
36
target/arm: adjust program counter for wfi exception in AArch32
37
arm/gicv3: update virtual irq state after IAR register read
38
target/arm: Return correct IL bit in merge_syn_data_abort
34
39
35
Peter Maydell (9):
40
Martin Kaiser (1):
36
hw/arm/raspi: Don't do board-setup or secure-boot for raspi3
41
i.MX: add an emulation for RNGC
37
hw/arm/boot: assert that secure_boot and secure_board_setup are false for AArch64
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
42
46
Wei Huang (1):
43
Masahiro Yamada (1):
47
dump: Update correct kdump phys_base field for AArch64
44
target/arm/arm-semi: fix SYS_OPEN to return nonzero filehandle
48
45
49
include/hw/arm/bcm2836.h | 31 +++++++++++++---
46
Philippe Mathieu-Daudé (5):
50
include/hw/arm/fsl-imx6.h | 4 +-
47
tests/boot_linux_console: Add initrd test for the CubieBoard
51
include/hw/char/imx_serial.h | 3 ++
48
tests/boot_linux_console: Add a SD card test for the CubieBoard
52
dump.c | 14 +++++--
49
hw/arm/allwinner-a10: Move SoC definitions out of header
53
hw/arm/bcm2836.c | 87 +++++++++++++++++++++++++++++++-------------
50
hw/arm/allwinner-a10: Simplify by passing IRQs with qdev_pass_gpios()
54
hw/arm/boot.c | 12 ++++++
51
hw/arm/allwinner-a10: Remove local qemu_irq variables
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
52
53
Richard Henderson (1):
54
target/arm: Set ISSIs16Bit in make_issinfo
55
56
hw/arm/Makefile.objs | 2 +
57
hw/misc/Makefile.objs | 3 +
58
include/hw/arm/allwinner-a10.h | 7 -
59
include/hw/arm/fsl-imx25.h | 5 +
60
include/hw/arm/stm32f405_soc.h | 73 ++++++++
61
include/hw/misc/imx_rngc.h | 35 ++++
62
include/hw/misc/stm32f4xx_exti.h | 60 +++++++
63
include/hw/misc/stm32f4xx_syscfg.h | 61 +++++++
64
hw/arm/allwinner-a10.c | 39 +++--
65
hw/arm/fsl-imx25.c | 11 ++
66
hw/arm/netduinoplus2.c | 52 ++++++
67
hw/arm/stm32f405_soc.c | 302 +++++++++++++++++++++++++++++++++
68
hw/intc/arm_gicv3_cpuif.c | 3 +
69
hw/misc/imx_rngc.c | 278 ++++++++++++++++++++++++++++++
70
hw/misc/stm32f4xx_exti.c | 188 ++++++++++++++++++++
71
hw/misc/stm32f4xx_syscfg.c | 171 +++++++++++++++++++
72
target/arm/arm-semi.c | 5 +-
73
target/arm/op_helper.c | 7 +-
74
target/arm/tlb_helper.c | 2 +-
75
target/arm/translate.c | 3 +
76
MAINTAINERS | 14 ++
77
default-configs/arm-softmmu.mak | 1 +
78
hw/arm/Kconfig | 10 ++
79
hw/misc/Kconfig | 6 +
80
hw/misc/trace-events | 11 ++
81
tests/acceptance/boot_linux_console.py | 85 ++++++++++
82
26 files changed, 1405 insertions(+), 29 deletions(-)
83
create mode 100644 include/hw/arm/stm32f405_soc.h
84
create mode 100644 include/hw/misc/imx_rngc.h
85
create mode 100644 include/hw/misc/stm32f4xx_exti.h
86
create mode 100644 include/hw/misc/stm32f4xx_syscfg.h
87
create mode 100644 hw/arm/netduinoplus2.c
88
create mode 100644 hw/arm/stm32f405_soc.c
89
create mode 100644 hw/misc/imx_rngc.c
90
create mode 100644 hw/misc/stm32f4xx_exti.c
91
create mode 100644 hw/misc/stm32f4xx_syscfg.c
92
diff view generated by jsdifflib
1
The bcm2837 is pretty similar to the bcm2836, but it does have
1
From: Alistair Francis <alistair@alistair23.me>
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
Signed-off-by: Alistair Francis <alistair@alistair23.me>
7
configure it differently for the two cases, create two
4
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
8
separate QOM devices for the two SoCs. We use the same approach
5
Message-id: 49b01423a09cef2ca832ff73a84a996568f1a8fc.1576658572.git.alistair@alistair23.me
9
as hw/arm/aspeed_soc.c and share code and have a data table
6
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
that might differ per-SoC. For the moment the two types don't
7
---
11
actually have different behaviour.
8
hw/misc/Makefile.objs | 1 +
9
include/hw/misc/stm32f4xx_syscfg.h | 61 ++++++++++
10
hw/misc/stm32f4xx_syscfg.c | 171 +++++++++++++++++++++++++++++
11
default-configs/arm-softmmu.mak | 1 +
12
hw/arm/Kconfig | 9 ++
13
hw/misc/Kconfig | 3 +
14
hw/misc/trace-events | 6 +
15
7 files changed, 252 insertions(+)
16
create mode 100644 include/hw/misc/stm32f4xx_syscfg.h
17
create mode 100644 hw/misc/stm32f4xx_syscfg.c
12
18
13
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
19
diff --git a/hw/misc/Makefile.objs b/hw/misc/Makefile.objs
14
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
20
index XXXXXXX..XXXXXXX 100644
15
Message-id: 20180313153458.26822-7-peter.maydell@linaro.org
21
--- a/hw/misc/Makefile.objs
16
---
22
+++ b/hw/misc/Makefile.objs
17
include/hw/arm/bcm2836.h | 19 +++++++++++++++++++
23
@@ -XXX,XX +XXX,XX @@ common-obj-$(CONFIG_SLAVIO) += slavio_misc.o
18
hw/arm/bcm2836.c | 37 ++++++++++++++++++++++++++++++++-----
24
common-obj-$(CONFIG_ZYNQ) += zynq_slcr.o
19
hw/arm/raspi.c | 3 ++-
25
common-obj-$(CONFIG_ZYNQ) += zynq-xadc.o
20
3 files changed, 53 insertions(+), 6 deletions(-)
26
common-obj-$(CONFIG_STM32F2XX_SYSCFG) += stm32f2xx_syscfg.o
21
27
+common-obj-$(CONFIG_STM32F4XX_SYSCFG) += stm32f4xx_syscfg.o
22
diff --git a/include/hw/arm/bcm2836.h b/include/hw/arm/bcm2836.h
28
obj-$(CONFIG_MIPS_CPS) += mips_cmgcr.o
23
index XXXXXXX..XXXXXXX 100644
29
obj-$(CONFIG_MIPS_CPS) += mips_cpc.o
24
--- a/include/hw/arm/bcm2836.h
30
obj-$(CONFIG_MIPS_ITU) += mips_itu.o
25
+++ b/include/hw/arm/bcm2836.h
31
diff --git a/include/hw/misc/stm32f4xx_syscfg.h b/include/hw/misc/stm32f4xx_syscfg.h
32
new file mode 100644
33
index XXXXXXX..XXXXXXX
34
--- /dev/null
35
+++ b/include/hw/misc/stm32f4xx_syscfg.h
26
@@ -XXX,XX +XXX,XX @@
36
@@ -XXX,XX +XXX,XX @@
27
37
+/*
28
#define BCM283X_NCPUS 4
38
+ * STM32F4xx SYSCFG
29
39
+ *
30
+/* These type names are for specific SoCs; other than instantiating
40
+ * Copyright (c) 2014 Alistair Francis <alistair@alistair23.me>
31
+ * them, code using these devices should always handle them via the
41
+ *
32
+ * BCM283x base class, so they have no BCM2836(obj) etc macros.
42
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
43
+ * of this software and associated documentation files (the "Software"), to deal
44
+ * in the Software without restriction, including without limitation the rights
45
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
46
+ * copies of the Software, and to permit persons to whom the Software is
47
+ * furnished to do so, subject to the following conditions:
48
+ *
49
+ * The above copyright notice and this permission notice shall be included in
50
+ * all copies or substantial portions of the Software.
51
+ *
52
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
53
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
54
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
55
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
56
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
57
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
58
+ * THE SOFTWARE.
33
+ */
59
+ */
34
+#define TYPE_BCM2836 "bcm2836"
60
+
35
+#define TYPE_BCM2837 "bcm2837"
61
+#ifndef HW_STM_SYSCFG_H
36
+
62
+#define HW_STM_SYSCFG_H
37
typedef struct BCM283XState {
63
+
38
/*< private >*/
64
+#include "hw/sysbus.h"
39
DeviceState parent_obj;
65
+#include "hw/hw.h"
40
@@ -XXX,XX +XXX,XX @@ typedef struct BCM283XState {
66
+
41
BCM2835PeripheralState peripherals;
67
+#define SYSCFG_MEMRMP 0x00
42
} BCM283XState;
68
+#define SYSCFG_PMC 0x04
43
69
+#define SYSCFG_EXTICR1 0x08
44
+typedef struct BCM283XInfo BCM283XInfo;
70
+#define SYSCFG_EXTICR2 0x0C
45
+
71
+#define SYSCFG_EXTICR3 0x10
46
+typedef struct BCM283XClass {
72
+#define SYSCFG_EXTICR4 0x14
47
+ DeviceClass parent_class;
73
+#define SYSCFG_CMPCR 0x20
48
+ const BCM283XInfo *info;
74
+
49
+} BCM283XClass;
75
+#define TYPE_STM32F4XX_SYSCFG "stm32f4xx-syscfg"
50
+
76
+#define STM32F4XX_SYSCFG(obj) \
51
+#define BCM283X_CLASS(klass) \
77
+ OBJECT_CHECK(STM32F4xxSyscfgState, (obj), TYPE_STM32F4XX_SYSCFG)
52
+ OBJECT_CLASS_CHECK(BCM283XClass, (klass), TYPE_BCM283X)
78
+
53
+#define BCM283X_GET_CLASS(obj) \
79
+#define SYSCFG_NUM_EXTICR 4
54
+ OBJECT_GET_CLASS(BCM283XClass, (obj), TYPE_BCM283X)
80
+
55
+
81
+typedef struct {
56
#endif /* BCM2836_H */
82
+ /* <private> */
57
diff --git a/hw/arm/bcm2836.c b/hw/arm/bcm2836.c
83
+ SysBusDevice parent_obj;
58
index XXXXXXX..XXXXXXX 100644
84
+
59
--- a/hw/arm/bcm2836.c
85
+ /* <public> */
60
+++ b/hw/arm/bcm2836.c
86
+ MemoryRegion mmio;
87
+
88
+ uint32_t syscfg_memrmp;
89
+ uint32_t syscfg_pmc;
90
+ uint32_t syscfg_exticr[SYSCFG_NUM_EXTICR];
91
+ uint32_t syscfg_cmpcr;
92
+
93
+ qemu_irq irq;
94
+ qemu_irq gpio_out[16];
95
+} STM32F4xxSyscfgState;
96
+
97
+#endif
98
diff --git a/hw/misc/stm32f4xx_syscfg.c b/hw/misc/stm32f4xx_syscfg.c
99
new file mode 100644
100
index XXXXXXX..XXXXXXX
101
--- /dev/null
102
+++ b/hw/misc/stm32f4xx_syscfg.c
61
@@ -XXX,XX +XXX,XX @@
103
@@ -XXX,XX +XXX,XX @@
62
/* "QA7" (Pi2) interrupt controller and mailboxes etc. */
104
+/*
63
#define BCM2836_CONTROL_BASE 0x40000000
105
+ * STM32F4xx SYSCFG
64
106
+ *
65
+struct BCM283XInfo {
107
+ * Copyright (c) 2014 Alistair Francis <alistair@alistair23.me>
66
+ const char *name;
108
+ *
109
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
110
+ * of this software and associated documentation files (the "Software"), to deal
111
+ * in the Software without restriction, including without limitation the rights
112
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
113
+ * copies of the Software, and to permit persons to whom the Software is
114
+ * furnished to do so, subject to the following conditions:
115
+ *
116
+ * The above copyright notice and this permission notice shall be included in
117
+ * all copies or substantial portions of the Software.
118
+ *
119
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
120
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
121
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
122
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
123
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
124
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
125
+ * THE SOFTWARE.
126
+ */
127
+
128
+#include "qemu/osdep.h"
129
+#include "qemu/log.h"
130
+#include "trace.h"
131
+#include "hw/irq.h"
132
+#include "migration/vmstate.h"
133
+#include "hw/misc/stm32f4xx_syscfg.h"
134
+
135
+static void stm32f4xx_syscfg_reset(DeviceState *dev)
136
+{
137
+ STM32F4xxSyscfgState *s = STM32F4XX_SYSCFG(dev);
138
+
139
+ s->syscfg_memrmp = 0x00000000;
140
+ s->syscfg_pmc = 0x00000000;
141
+ s->syscfg_exticr[0] = 0x00000000;
142
+ s->syscfg_exticr[1] = 0x00000000;
143
+ s->syscfg_exticr[2] = 0x00000000;
144
+ s->syscfg_exticr[3] = 0x00000000;
145
+ s->syscfg_cmpcr = 0x00000000;
146
+}
147
+
148
+static void stm32f4xx_syscfg_set_irq(void *opaque, int irq, int level)
149
+{
150
+ STM32F4xxSyscfgState *s = opaque;
151
+ int icrreg = irq / 4;
152
+ int startbit = (irq & 3) * 4;
153
+ uint8_t config = config = irq / 16;
154
+
155
+ trace_stm32f4xx_syscfg_set_irq(irq / 16, irq % 16, level);
156
+
157
+ g_assert(icrreg < SYSCFG_NUM_EXTICR);
158
+
159
+ if (extract32(s->syscfg_exticr[icrreg], startbit, 4) == config) {
160
+ qemu_set_irq(s->gpio_out[irq], level);
161
+ trace_stm32f4xx_pulse_exti(irq);
162
+ }
163
+}
164
+
165
+static uint64_t stm32f4xx_syscfg_read(void *opaque, hwaddr addr,
166
+ unsigned int size)
167
+{
168
+ STM32F4xxSyscfgState *s = opaque;
169
+
170
+ trace_stm32f4xx_syscfg_read(addr);
171
+
172
+ switch (addr) {
173
+ case SYSCFG_MEMRMP:
174
+ return s->syscfg_memrmp;
175
+ case SYSCFG_PMC:
176
+ return s->syscfg_pmc;
177
+ case SYSCFG_EXTICR1...SYSCFG_EXTICR4:
178
+ return s->syscfg_exticr[addr / 4 - SYSCFG_EXTICR1 / 4];
179
+ case SYSCFG_CMPCR:
180
+ return s->syscfg_cmpcr;
181
+ default:
182
+ qemu_log_mask(LOG_GUEST_ERROR,
183
+ "%s: Bad offset 0x%"HWADDR_PRIx"\n", __func__, addr);
184
+ return 0;
185
+ }
186
+}
187
+
188
+static void stm32f4xx_syscfg_write(void *opaque, hwaddr addr,
189
+ uint64_t val64, unsigned int size)
190
+{
191
+ STM32F4xxSyscfgState *s = opaque;
192
+ uint32_t value = val64;
193
+
194
+ trace_stm32f4xx_syscfg_write(value, addr);
195
+
196
+ switch (addr) {
197
+ case SYSCFG_MEMRMP:
198
+ qemu_log_mask(LOG_UNIMP,
199
+ "%s: Changing the memory mapping isn't supported " \
200
+ "in QEMU\n", __func__);
201
+ return;
202
+ case SYSCFG_PMC:
203
+ qemu_log_mask(LOG_UNIMP,
204
+ "%s: Changing the memory mapping isn't supported " \
205
+ "in QEMU\n", __func__);
206
+ return;
207
+ case SYSCFG_EXTICR1...SYSCFG_EXTICR4:
208
+ s->syscfg_exticr[addr / 4 - SYSCFG_EXTICR1 / 4] = (value & 0xFFFF);
209
+ return;
210
+ case SYSCFG_CMPCR:
211
+ s->syscfg_cmpcr = value;
212
+ return;
213
+ default:
214
+ qemu_log_mask(LOG_GUEST_ERROR,
215
+ "%s: Bad offset 0x%"HWADDR_PRIx"\n", __func__, addr);
216
+ }
217
+}
218
+
219
+static const MemoryRegionOps stm32f4xx_syscfg_ops = {
220
+ .read = stm32f4xx_syscfg_read,
221
+ .write = stm32f4xx_syscfg_write,
222
+ .endianness = DEVICE_NATIVE_ENDIAN,
67
+};
223
+};
68
+
224
+
69
+static const BCM283XInfo bcm283x_socs[] = {
225
+static void stm32f4xx_syscfg_init(Object *obj)
70
+ {
226
+{
71
+ .name = TYPE_BCM2836,
227
+ STM32F4xxSyscfgState *s = STM32F4XX_SYSCFG(obj);
72
+ },
228
+
73
+ {
229
+ sysbus_init_irq(SYS_BUS_DEVICE(obj), &s->irq);
74
+ .name = TYPE_BCM2837,
230
+
75
+ },
231
+ memory_region_init_io(&s->mmio, obj, &stm32f4xx_syscfg_ops, s,
232
+ TYPE_STM32F4XX_SYSCFG, 0x400);
233
+ sysbus_init_mmio(SYS_BUS_DEVICE(obj), &s->mmio);
234
+
235
+ qdev_init_gpio_in(DEVICE(obj), stm32f4xx_syscfg_set_irq, 16 * 9);
236
+ qdev_init_gpio_out(DEVICE(obj), s->gpio_out, 16);
237
+}
238
+
239
+static const VMStateDescription vmstate_stm32f4xx_syscfg = {
240
+ .name = TYPE_STM32F4XX_SYSCFG,
241
+ .version_id = 1,
242
+ .minimum_version_id = 1,
243
+ .fields = (VMStateField[]) {
244
+ VMSTATE_UINT32(syscfg_memrmp, STM32F4xxSyscfgState),
245
+ VMSTATE_UINT32(syscfg_pmc, STM32F4xxSyscfgState),
246
+ VMSTATE_UINT32_ARRAY(syscfg_exticr, STM32F4xxSyscfgState,
247
+ SYSCFG_NUM_EXTICR),
248
+ VMSTATE_UINT32(syscfg_cmpcr, STM32F4xxSyscfgState),
249
+ VMSTATE_END_OF_LIST()
250
+ }
76
+};
251
+};
77
+
252
+
78
static void bcm2836_init(Object *obj)
253
+static void stm32f4xx_syscfg_class_init(ObjectClass *klass, void *data)
79
{
254
+{
80
BCM283XState *s = BCM283X(obj);
255
+ DeviceClass *dc = DEVICE_CLASS(klass);
81
@@ -XXX,XX +XXX,XX @@ static Property bcm2836_props[] = {
256
+
82
DEFINE_PROP_END_OF_LIST()
257
+ dc->reset = stm32f4xx_syscfg_reset;
83
};
258
+ dc->vmsd = &vmstate_stm32f4xx_syscfg;
84
259
+}
85
-static void bcm2836_class_init(ObjectClass *oc, void *data)
260
+
86
+static void bcm283x_class_init(ObjectClass *oc, void *data)
261
+static const TypeInfo stm32f4xx_syscfg_info = {
87
{
262
+ .name = TYPE_STM32F4XX_SYSCFG,
88
DeviceClass *dc = DEVICE_CLASS(oc);
263
+ .parent = TYPE_SYS_BUS_DEVICE,
89
+ BCM283XClass *bc = BCM283X_CLASS(oc);
264
+ .instance_size = sizeof(STM32F4xxSyscfgState),
90
265
+ .instance_init = stm32f4xx_syscfg_init,
91
- dc->props = bcm2836_props;
266
+ .class_init = stm32f4xx_syscfg_class_init,
92
+ bc->info = data;
267
+};
93
dc->realize = bcm2836_realize;
268
+
94
+ dc->props = bcm2836_props;
269
+static void stm32f4xx_syscfg_register_types(void)
95
}
270
+{
96
271
+ type_register_static(&stm32f4xx_syscfg_info);
97
-static const TypeInfo bcm2836_type_info = {
272
+}
98
+static const TypeInfo bcm283x_type_info = {
273
+
99
.name = TYPE_BCM283X,
274
+type_init(stm32f4xx_syscfg_register_types)
100
.parent = TYPE_DEVICE,
275
diff --git a/default-configs/arm-softmmu.mak b/default-configs/arm-softmmu.mak
101
.instance_size = sizeof(BCM283XState),
276
index XXXXXXX..XXXXXXX 100644
102
.instance_init = bcm2836_init,
277
--- a/default-configs/arm-softmmu.mak
103
- .class_init = bcm2836_class_init,
278
+++ b/default-configs/arm-softmmu.mak
104
+ .class_size = sizeof(BCM283XClass),
279
@@ -XXX,XX +XXX,XX @@ CONFIG_Z2=y
105
+ .abstract = true,
280
CONFIG_COLLIE=y
106
};
281
CONFIG_ASPEED_SOC=y
107
282
CONFIG_NETDUINO2=y
108
static void bcm2836_register_types(void)
283
+CONFIG_NETDUINOPLUS2=y
109
{
284
CONFIG_MPS2=y
110
- type_register_static(&bcm2836_type_info);
285
CONFIG_RASPI=y
111
+ int i;
286
CONFIG_DIGIC=y
112
+
287
diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig
113
+ type_register_static(&bcm283x_type_info);
288
index XXXXXXX..XXXXXXX 100644
114
+ for (i = 0; i < ARRAY_SIZE(bcm283x_socs); i++) {
289
--- a/hw/arm/Kconfig
115
+ TypeInfo ti = {
290
+++ b/hw/arm/Kconfig
116
+ .name = bcm283x_socs[i].name,
291
@@ -XXX,XX +XXX,XX @@ config NETDUINO2
117
+ .parent = TYPE_BCM283X,
292
bool
118
+ .class_init = bcm283x_class_init,
293
select STM32F205_SOC
119
+ .class_data = (void *) &bcm283x_socs[i],
294
120
+ };
295
+config NETDUINOPLUS2
121
+ type_register(&ti);
296
+ bool
122
+ }
297
+ select STM32F405_SOC
123
}
298
+
124
299
config NSERIES
125
type_init(bcm2836_register_types)
300
bool
126
diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c
301
select OMAP
127
index XXXXXXX..XXXXXXX 100644
302
@@ -XXX,XX +XXX,XX @@ config STM32F205_SOC
128
--- a/hw/arm/raspi.c
303
select STM32F2XX_ADC
129
+++ b/hw/arm/raspi.c
304
select STM32F2XX_SPI
130
@@ -XXX,XX +XXX,XX @@ static void raspi_init(MachineState *machine, int version)
305
131
BusState *bus;
306
+config STM32F405_SOC
132
DeviceState *carddev;
307
+ bool
133
308
+ select ARM_V7M
134
- object_initialize(&s->soc, sizeof(s->soc), TYPE_BCM283X);
309
+ select STM32F4XX_SYSCFG
135
+ object_initialize(&s->soc, sizeof(s->soc),
310
+
136
+ version == 3 ? TYPE_BCM2837 : TYPE_BCM2836);
311
config XLNX_ZYNQMP_ARM
137
object_property_add_child(OBJECT(machine), "soc", OBJECT(&s->soc),
312
bool
138
&error_abort);
313
select AHCI
139
314
diff --git a/hw/misc/Kconfig b/hw/misc/Kconfig
315
index XXXXXXX..XXXXXXX 100644
316
--- a/hw/misc/Kconfig
317
+++ b/hw/misc/Kconfig
318
@@ -XXX,XX +XXX,XX @@ config IMX
319
config STM32F2XX_SYSCFG
320
bool
321
322
+config STM32F4XX_SYSCFG
323
+ bool
324
+
325
config MIPS_ITU
326
bool
327
328
diff --git a/hw/misc/trace-events b/hw/misc/trace-events
329
index XXXXXXX..XXXXXXX 100644
330
--- a/hw/misc/trace-events
331
+++ b/hw/misc/trace-events
332
@@ -XXX,XX +XXX,XX @@ mos6522_set_sr_int(void) "set sr_int"
333
mos6522_write(uint64_t addr, uint64_t val) "reg=0x%"PRIx64 " val=0x%"PRIx64
334
mos6522_read(uint64_t addr, unsigned val) "reg=0x%"PRIx64 " val=0x%x"
335
336
+# stm32f4xx_syscfg
337
+stm32f4xx_syscfg_set_irq(int gpio, int line, int level) "Interupt: GPIO: %d, Line: %d; Level: %d"
338
+stm32f4xx_pulse_exti(int irq) "Pulse EXTI: %d"
339
+stm32f4xx_syscfg_read(uint64_t addr) "reg read: addr: 0x%" PRIx64 " "
340
+stm32f4xx_syscfg_write(uint64_t addr, uint64_t data) "reg write: addr: 0x%" PRIx64 " val: 0x%" PRIx64 ""
341
+
342
# tz-mpc.c
343
tz_mpc_reg_read(uint32_t offset, uint64_t data, unsigned size) "TZ MPC regs read: offset 0x%x data 0x%" PRIx64 " size %u"
344
tz_mpc_reg_write(uint32_t offset, uint64_t data, unsigned size) "TZ MPC regs write: offset 0x%x data 0x%" PRIx64 " size %u"
140
--
345
--
141
2.16.2
346
2.20.1
142
347
143
348
diff view generated by jsdifflib
1
Now we have separate types for BCM2386 and BCM2387, we might as well
1
From: Alistair Francis <alistair@alistair23.me>
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
Signed-off-by: Alistair Francis <alistair@alistair23.me>
7
the command line to use -cpu to ask for a different kind of
4
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
8
CPU than the SoC supports. This was never a supported thing to
5
Message-id: ef941d59fd8658589d34ed432e1d6dfdcf7fb1d0.1576658572.git.alistair@alistair23.me
9
do anyway; we were just not sanity-checking the command line.
6
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8
---
9
hw/misc/Makefile.objs | 1 +
10
include/hw/misc/stm32f4xx_exti.h | 60 ++++++++++
11
hw/misc/stm32f4xx_exti.c | 188 +++++++++++++++++++++++++++++++
12
hw/arm/Kconfig | 1 +
13
hw/misc/Kconfig | 3 +
14
hw/misc/trace-events | 5 +
15
6 files changed, 258 insertions(+)
16
create mode 100644 include/hw/misc/stm32f4xx_exti.h
17
create mode 100644 hw/misc/stm32f4xx_exti.c
10
18
11
This does require us to only build the bcm2837 object on
19
diff --git a/hw/misc/Makefile.objs b/hw/misc/Makefile.objs
12
TARGET_AARCH64 configs, since otherwise it won't instantiate
13
due to the missing cortex-a53 device and "make check" will fail.
14
15
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
---
20
hw/arm/bcm2836.c | 24 +++++++++++++++---------
21
hw/arm/raspi.c | 2 --
22
2 files changed, 15 insertions(+), 11 deletions(-)
23
24
diff --git a/hw/arm/bcm2836.c b/hw/arm/bcm2836.c
25
index XXXXXXX..XXXXXXX 100644
20
index XXXXXXX..XXXXXXX 100644
26
--- a/hw/arm/bcm2836.c
21
--- a/hw/misc/Makefile.objs
27
+++ b/hw/arm/bcm2836.c
22
+++ b/hw/misc/Makefile.objs
23
@@ -XXX,XX +XXX,XX @@ common-obj-$(CONFIG_ZYNQ) += zynq_slcr.o
24
common-obj-$(CONFIG_ZYNQ) += zynq-xadc.o
25
common-obj-$(CONFIG_STM32F2XX_SYSCFG) += stm32f2xx_syscfg.o
26
common-obj-$(CONFIG_STM32F4XX_SYSCFG) += stm32f4xx_syscfg.o
27
+common-obj-$(CONFIG_STM32F4XX_EXTI) += stm32f4xx_exti.o
28
obj-$(CONFIG_MIPS_CPS) += mips_cmgcr.o
29
obj-$(CONFIG_MIPS_CPS) += mips_cpc.o
30
obj-$(CONFIG_MIPS_ITU) += mips_itu.o
31
diff --git a/include/hw/misc/stm32f4xx_exti.h b/include/hw/misc/stm32f4xx_exti.h
32
new file mode 100644
33
index XXXXXXX..XXXXXXX
34
--- /dev/null
35
+++ b/include/hw/misc/stm32f4xx_exti.h
28
@@ -XXX,XX +XXX,XX @@
36
@@ -XXX,XX +XXX,XX @@
29
37
+/*
30
struct BCM283XInfo {
38
+ * STM32F4XX EXTI
31
const char *name;
39
+ *
32
+ const char *cpu_type;
40
+ * Copyright (c) 2014 Alistair Francis <alistair@alistair23.me>
33
int clusterid;
41
+ *
34
};
42
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
35
43
+ * of this software and associated documentation files (the "Software"), to deal
36
static const BCM283XInfo bcm283x_socs[] = {
44
+ * in the Software without restriction, including without limitation the rights
37
{
45
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
38
.name = TYPE_BCM2836,
46
+ * copies of the Software, and to permit persons to whom the Software is
39
+ .cpu_type = ARM_CPU_TYPE_NAME("cortex-a15"),
47
+ * furnished to do so, subject to the following conditions:
40
.clusterid = 0xf,
48
+ *
41
},
49
+ * The above copyright notice and this permission notice shall be included in
42
+#ifdef TARGET_AARCH64
50
+ * all copies or substantial portions of the Software.
43
{
51
+ *
44
.name = TYPE_BCM2837,
52
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
45
+ .cpu_type = ARM_CPU_TYPE_NAME("cortex-a53"),
53
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
46
.clusterid = 0x0,
54
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
47
},
55
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
56
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
57
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
58
+ * THE SOFTWARE.
59
+ */
60
+
61
+#ifndef HW_STM_EXTI_H
62
+#define HW_STM_EXTI_H
63
+
64
+#include "hw/sysbus.h"
65
+#include "hw/hw.h"
66
+
67
+#define EXTI_IMR 0x00
68
+#define EXTI_EMR 0x04
69
+#define EXTI_RTSR 0x08
70
+#define EXTI_FTSR 0x0C
71
+#define EXTI_SWIER 0x10
72
+#define EXTI_PR 0x14
73
+
74
+#define TYPE_STM32F4XX_EXTI "stm32f4xx-exti"
75
+#define STM32F4XX_EXTI(obj) \
76
+ OBJECT_CHECK(STM32F4xxExtiState, (obj), TYPE_STM32F4XX_EXTI)
77
+
78
+#define NUM_GPIO_EVENT_IN_LINES 16
79
+#define NUM_INTERRUPT_OUT_LINES 16
80
+
81
+typedef struct {
82
+ SysBusDevice parent_obj;
83
+
84
+ MemoryRegion mmio;
85
+
86
+ uint32_t exti_imr;
87
+ uint32_t exti_emr;
88
+ uint32_t exti_rtsr;
89
+ uint32_t exti_ftsr;
90
+ uint32_t exti_swier;
91
+ uint32_t exti_pr;
92
+
93
+ qemu_irq irq[NUM_INTERRUPT_OUT_LINES];
94
+} STM32F4xxExtiState;
95
+
48
+#endif
96
+#endif
49
};
97
diff --git a/hw/misc/stm32f4xx_exti.c b/hw/misc/stm32f4xx_exti.c
50
98
new file mode 100644
51
static void bcm2836_init(Object *obj)
99
index XXXXXXX..XXXXXXX
52
{
100
--- /dev/null
53
BCM283XState *s = BCM283X(obj);
101
+++ b/hw/misc/stm32f4xx_exti.c
54
+ BCM283XClass *bc = BCM283X_GET_CLASS(obj);
102
@@ -XXX,XX +XXX,XX @@
55
+ const BCM283XInfo *info = bc->info;
103
+/*
56
+ int n;
104
+ * STM32F4XX EXTI
57
+
105
+ *
58
+ for (n = 0; n < BCM283X_NCPUS; n++) {
106
+ * Copyright (c) 2014 Alistair Francis <alistair@alistair23.me>
59
+ object_initialize(&s->cpus[n], sizeof(s->cpus[n]),
107
+ *
60
+ info->cpu_type);
108
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
61
+ object_property_add_child(obj, "cpu[*]", OBJECT(&s->cpus[n]),
109
+ * of this software and associated documentation files (the "Software"), to deal
62
+ &error_abort);
110
+ * in the Software without restriction, including without limitation the rights
63
+ }
111
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
64
112
+ * copies of the Software, and to permit persons to whom the Software is
65
object_initialize(&s->control, sizeof(s->control), TYPE_BCM2836_CONTROL);
113
+ * furnished to do so, subject to the following conditions:
66
object_property_add_child(obj, "control", OBJECT(&s->control), NULL);
114
+ *
67
@@ -XXX,XX +XXX,XX @@ static void bcm2836_realize(DeviceState *dev, Error **errp)
115
+ * The above copyright notice and this permission notice shall be included in
68
116
+ * all copies or substantial portions of the Software.
69
/* common peripherals from bcm2835 */
117
+ *
70
118
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
71
- obj = OBJECT(dev);
119
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
72
- for (n = 0; n < BCM283X_NCPUS; n++) {
120
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
73
- object_initialize(&s->cpus[n], sizeof(s->cpus[n]),
121
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
74
- s->cpu_type);
122
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
75
- object_property_add_child(obj, "cpu[*]", OBJECT(&s->cpus[n]),
123
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
76
- &error_abort);
124
+ * THE SOFTWARE.
77
- }
125
+ */
78
-
126
+
79
obj = object_property_get_link(OBJECT(dev), "ram", &err);
127
+#include "qemu/osdep.h"
80
if (obj == NULL) {
128
+#include "qemu/log.h"
81
error_setg(errp, "%s: required ram link not found: %s",
129
+#include "trace.h"
82
@@ -XXX,XX +XXX,XX @@ static void bcm2836_realize(DeviceState *dev, Error **errp)
130
+#include "hw/irq.h"
83
}
131
+#include "migration/vmstate.h"
84
132
+#include "hw/misc/stm32f4xx_exti.h"
85
static Property bcm2836_props[] = {
133
+
86
- DEFINE_PROP_STRING("cpu-type", BCM283XState, cpu_type),
134
+static void stm32f4xx_exti_reset(DeviceState *dev)
87
DEFINE_PROP_UINT32("enabled-cpus", BCM283XState, enabled_cpus,
135
+{
88
BCM283X_NCPUS),
136
+ STM32F4xxExtiState *s = STM32F4XX_EXTI(dev);
89
DEFINE_PROP_END_OF_LIST()
137
+
90
diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c
138
+ s->exti_imr = 0x00000000;
139
+ s->exti_emr = 0x00000000;
140
+ s->exti_rtsr = 0x00000000;
141
+ s->exti_ftsr = 0x00000000;
142
+ s->exti_swier = 0x00000000;
143
+ s->exti_pr = 0x00000000;
144
+}
145
+
146
+static void stm32f4xx_exti_set_irq(void *opaque, int irq, int level)
147
+{
148
+ STM32F4xxExtiState *s = opaque;
149
+
150
+ trace_stm32f4xx_exti_set_irq(irq, level);
151
+
152
+ if (((1 << irq) & s->exti_rtsr) && level) {
153
+ /* Rising Edge */
154
+ s->exti_pr |= 1 << irq;
155
+ }
156
+
157
+ if (((1 << irq) & s->exti_ftsr) && !level) {
158
+ /* Falling Edge */
159
+ s->exti_pr |= 1 << irq;
160
+ }
161
+
162
+ if (!((1 << irq) & s->exti_imr)) {
163
+ /* Interrupt is masked */
164
+ return;
165
+ }
166
+ qemu_irq_pulse(s->irq[irq]);
167
+}
168
+
169
+static uint64_t stm32f4xx_exti_read(void *opaque, hwaddr addr,
170
+ unsigned int size)
171
+{
172
+ STM32F4xxExtiState *s = opaque;
173
+
174
+ trace_stm32f4xx_exti_read(addr);
175
+
176
+ switch (addr) {
177
+ case EXTI_IMR:
178
+ return s->exti_imr;
179
+ case EXTI_EMR:
180
+ return s->exti_emr;
181
+ case EXTI_RTSR:
182
+ return s->exti_rtsr;
183
+ case EXTI_FTSR:
184
+ return s->exti_ftsr;
185
+ case EXTI_SWIER:
186
+ return s->exti_swier;
187
+ case EXTI_PR:
188
+ return s->exti_pr;
189
+ default:
190
+ qemu_log_mask(LOG_GUEST_ERROR,
191
+ "STM32F4XX_exti_read: Bad offset %x\n", (int)addr);
192
+ return 0;
193
+ }
194
+ return 0;
195
+}
196
+
197
+static void stm32f4xx_exti_write(void *opaque, hwaddr addr,
198
+ uint64_t val64, unsigned int size)
199
+{
200
+ STM32F4xxExtiState *s = opaque;
201
+ uint32_t value = (uint32_t) val64;
202
+
203
+ trace_stm32f4xx_exti_write(addr, value);
204
+
205
+ switch (addr) {
206
+ case EXTI_IMR:
207
+ s->exti_imr = value;
208
+ return;
209
+ case EXTI_EMR:
210
+ s->exti_emr = value;
211
+ return;
212
+ case EXTI_RTSR:
213
+ s->exti_rtsr = value;
214
+ return;
215
+ case EXTI_FTSR:
216
+ s->exti_ftsr = value;
217
+ return;
218
+ case EXTI_SWIER:
219
+ s->exti_swier = value;
220
+ return;
221
+ case EXTI_PR:
222
+ /* This bit is cleared by writing a 1 to it */
223
+ s->exti_pr &= ~value;
224
+ return;
225
+ default:
226
+ qemu_log_mask(LOG_GUEST_ERROR,
227
+ "STM32F4XX_exti_write: Bad offset %x\n", (int)addr);
228
+ }
229
+}
230
+
231
+static const MemoryRegionOps stm32f4xx_exti_ops = {
232
+ .read = stm32f4xx_exti_read,
233
+ .write = stm32f4xx_exti_write,
234
+ .endianness = DEVICE_NATIVE_ENDIAN,
235
+};
236
+
237
+static void stm32f4xx_exti_init(Object *obj)
238
+{
239
+ STM32F4xxExtiState *s = STM32F4XX_EXTI(obj);
240
+ int i;
241
+
242
+ for (i = 0; i < NUM_INTERRUPT_OUT_LINES; i++) {
243
+ sysbus_init_irq(SYS_BUS_DEVICE(obj), &s->irq[i]);
244
+ }
245
+
246
+ memory_region_init_io(&s->mmio, obj, &stm32f4xx_exti_ops, s,
247
+ TYPE_STM32F4XX_EXTI, 0x400);
248
+ sysbus_init_mmio(SYS_BUS_DEVICE(obj), &s->mmio);
249
+
250
+ qdev_init_gpio_in(DEVICE(obj), stm32f4xx_exti_set_irq,
251
+ NUM_GPIO_EVENT_IN_LINES);
252
+}
253
+
254
+static const VMStateDescription vmstate_stm32f4xx_exti = {
255
+ .name = TYPE_STM32F4XX_EXTI,
256
+ .version_id = 1,
257
+ .minimum_version_id = 1,
258
+ .fields = (VMStateField[]) {
259
+ VMSTATE_UINT32(exti_imr, STM32F4xxExtiState),
260
+ VMSTATE_UINT32(exti_emr, STM32F4xxExtiState),
261
+ VMSTATE_UINT32(exti_rtsr, STM32F4xxExtiState),
262
+ VMSTATE_UINT32(exti_ftsr, STM32F4xxExtiState),
263
+ VMSTATE_UINT32(exti_swier, STM32F4xxExtiState),
264
+ VMSTATE_UINT32(exti_pr, STM32F4xxExtiState),
265
+ VMSTATE_END_OF_LIST()
266
+ }
267
+};
268
+
269
+static void stm32f4xx_exti_class_init(ObjectClass *klass, void *data)
270
+{
271
+ DeviceClass *dc = DEVICE_CLASS(klass);
272
+
273
+ dc->reset = stm32f4xx_exti_reset;
274
+ dc->vmsd = &vmstate_stm32f4xx_exti;
275
+}
276
+
277
+static const TypeInfo stm32f4xx_exti_info = {
278
+ .name = TYPE_STM32F4XX_EXTI,
279
+ .parent = TYPE_SYS_BUS_DEVICE,
280
+ .instance_size = sizeof(STM32F4xxExtiState),
281
+ .instance_init = stm32f4xx_exti_init,
282
+ .class_init = stm32f4xx_exti_class_init,
283
+};
284
+
285
+static void stm32f4xx_exti_register_types(void)
286
+{
287
+ type_register_static(&stm32f4xx_exti_info);
288
+}
289
+
290
+type_init(stm32f4xx_exti_register_types)
291
diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig
91
index XXXXXXX..XXXXXXX 100644
292
index XXXXXXX..XXXXXXX 100644
92
--- a/hw/arm/raspi.c
293
--- a/hw/arm/Kconfig
93
+++ b/hw/arm/raspi.c
294
+++ b/hw/arm/Kconfig
94
@@ -XXX,XX +XXX,XX @@ static void raspi_init(MachineState *machine, int version)
295
@@ -XXX,XX +XXX,XX @@ config STM32F405_SOC
95
/* Setup the SOC */
296
bool
96
object_property_add_const_link(OBJECT(&s->soc), "ram", OBJECT(&s->ram),
297
select ARM_V7M
97
&error_abort);
298
select STM32F4XX_SYSCFG
98
- object_property_set_str(OBJECT(&s->soc), machine->cpu_type, "cpu-type",
299
+ select STM32F4XX_EXTI
99
- &error_abort);
300
100
object_property_set_int(OBJECT(&s->soc), smp_cpus, "enabled-cpus",
301
config XLNX_ZYNQMP_ARM
101
&error_abort);
302
bool
102
int board_rev = version == 3 ? 0xa02082 : 0xa21041;
303
diff --git a/hw/misc/Kconfig b/hw/misc/Kconfig
304
index XXXXXXX..XXXXXXX 100644
305
--- a/hw/misc/Kconfig
306
+++ b/hw/misc/Kconfig
307
@@ -XXX,XX +XXX,XX @@ config STM32F2XX_SYSCFG
308
config STM32F4XX_SYSCFG
309
bool
310
311
+config STM32F4XX_EXTI
312
+ bool
313
+
314
config MIPS_ITU
315
bool
316
317
diff --git a/hw/misc/trace-events b/hw/misc/trace-events
318
index XXXXXXX..XXXXXXX 100644
319
--- a/hw/misc/trace-events
320
+++ b/hw/misc/trace-events
321
@@ -XXX,XX +XXX,XX @@ stm32f4xx_pulse_exti(int irq) "Pulse EXTI: %d"
322
stm32f4xx_syscfg_read(uint64_t addr) "reg read: addr: 0x%" PRIx64 " "
323
stm32f4xx_syscfg_write(uint64_t addr, uint64_t data) "reg write: addr: 0x%" PRIx64 " val: 0x%" PRIx64 ""
324
325
+# stm32f4xx_exti
326
+stm32f4xx_exti_set_irq(int irq, int leve) "Set EXTI: %d to %d"
327
+stm32f4xx_exti_read(uint64_t addr) "reg read: addr: 0x%" PRIx64 " "
328
+stm32f4xx_exti_write(uint64_t addr, uint64_t data) "reg write: addr: 0x%" PRIx64 " val: 0x%" PRIx64 ""
329
+
330
# tz-mpc.c
331
tz_mpc_reg_read(uint32_t offset, uint64_t data, unsigned size) "TZ MPC regs read: offset 0x%x data 0x%" PRIx64 " size %u"
332
tz_mpc_reg_write(uint32_t offset, uint64_t data, unsigned size) "TZ MPC regs write: offset 0x%x data 0x%" PRIx64 " size %u"
103
--
333
--
104
2.16.2
334
2.20.1
105
335
106
336
diff view generated by jsdifflib
New patch
1
From: Alistair Francis <alistair@alistair23.me>
1
2
3
Signed-off-by: Alistair Francis <alistair@alistair23.me>
4
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
5
Message-id: 1d145c4c13e5fa140caf131232a6f524c88fcd72.1576658572.git.alistair@alistair23.me
6
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7
---
8
hw/arm/Makefile.objs | 1 +
9
include/hw/arm/stm32f405_soc.h | 73 ++++++++
10
hw/arm/stm32f405_soc.c | 302 +++++++++++++++++++++++++++++++++
11
MAINTAINERS | 8 +
12
4 files changed, 384 insertions(+)
13
create mode 100644 include/hw/arm/stm32f405_soc.h
14
create mode 100644 hw/arm/stm32f405_soc.c
15
16
diff --git a/hw/arm/Makefile.objs b/hw/arm/Makefile.objs
17
index XXXXXXX..XXXXXXX 100644
18
--- a/hw/arm/Makefile.objs
19
+++ b/hw/arm/Makefile.objs
20
@@ -XXX,XX +XXX,XX @@ obj-$(CONFIG_STRONGARM) += strongarm.o
21
obj-$(CONFIG_ALLWINNER_A10) += allwinner-a10.o cubieboard.o
22
obj-$(CONFIG_RASPI) += bcm2835_peripherals.o bcm2836.o raspi.o
23
obj-$(CONFIG_STM32F205_SOC) += stm32f205_soc.o
24
+obj-$(CONFIG_STM32F405_SOC) += stm32f405_soc.o
25
obj-$(CONFIG_XLNX_ZYNQMP_ARM) += xlnx-zynqmp.o xlnx-zcu102.o
26
obj-$(CONFIG_XLNX_VERSAL) += xlnx-versal.o xlnx-versal-virt.o
27
obj-$(CONFIG_FSL_IMX25) += fsl-imx25.o imx25_pdk.o
28
diff --git a/include/hw/arm/stm32f405_soc.h b/include/hw/arm/stm32f405_soc.h
29
new file mode 100644
30
index XXXXXXX..XXXXXXX
31
--- /dev/null
32
+++ b/include/hw/arm/stm32f405_soc.h
33
@@ -XXX,XX +XXX,XX @@
34
+/*
35
+ * STM32F405 SoC
36
+ *
37
+ * Copyright (c) 2014 Alistair Francis <alistair@alistair23.me>
38
+ *
39
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
40
+ * of this software and associated documentation files (the "Software"), to deal
41
+ * in the Software without restriction, including without limitation the rights
42
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
43
+ * copies of the Software, and to permit persons to whom the Software is
44
+ * furnished to do so, subject to the following conditions:
45
+ *
46
+ * The above copyright notice and this permission notice shall be included in
47
+ * all copies or substantial portions of the Software.
48
+ *
49
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
50
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
51
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
52
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
53
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
54
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
55
+ * THE SOFTWARE.
56
+ */
57
+
58
+#ifndef HW_ARM_STM32F405_SOC_H
59
+#define HW_ARM_STM32F405_SOC_H
60
+
61
+#include "hw/misc/stm32f4xx_syscfg.h"
62
+#include "hw/timer/stm32f2xx_timer.h"
63
+#include "hw/char/stm32f2xx_usart.h"
64
+#include "hw/adc/stm32f2xx_adc.h"
65
+#include "hw/misc/stm32f4xx_exti.h"
66
+#include "hw/or-irq.h"
67
+#include "hw/ssi/stm32f2xx_spi.h"
68
+#include "hw/arm/armv7m.h"
69
+
70
+#define TYPE_STM32F405_SOC "stm32f405-soc"
71
+#define STM32F405_SOC(obj) \
72
+ OBJECT_CHECK(STM32F405State, (obj), TYPE_STM32F405_SOC)
73
+
74
+#define STM_NUM_USARTS 7
75
+#define STM_NUM_TIMERS 4
76
+#define STM_NUM_ADCS 6
77
+#define STM_NUM_SPIS 6
78
+
79
+#define FLASH_BASE_ADDRESS 0x08000000
80
+#define FLASH_SIZE (1024 * 1024)
81
+#define SRAM_BASE_ADDRESS 0x20000000
82
+#define SRAM_SIZE (192 * 1024)
83
+
84
+typedef struct STM32F405State {
85
+ /*< private >*/
86
+ SysBusDevice parent_obj;
87
+ /*< public >*/
88
+
89
+ char *cpu_type;
90
+
91
+ ARMv7MState armv7m;
92
+
93
+ STM32F4xxSyscfgState syscfg;
94
+ STM32F4xxExtiState exti;
95
+ STM32F2XXUsartState usart[STM_NUM_USARTS];
96
+ STM32F2XXTimerState timer[STM_NUM_TIMERS];
97
+ qemu_or_irq adc_irqs;
98
+ STM32F2XXADCState adc[STM_NUM_ADCS];
99
+ STM32F2XXSPIState spi[STM_NUM_SPIS];
100
+
101
+ MemoryRegion sram;
102
+ MemoryRegion flash;
103
+ MemoryRegion flash_alias;
104
+} STM32F405State;
105
+
106
+#endif
107
diff --git a/hw/arm/stm32f405_soc.c b/hw/arm/stm32f405_soc.c
108
new file mode 100644
109
index XXXXXXX..XXXXXXX
110
--- /dev/null
111
+++ b/hw/arm/stm32f405_soc.c
112
@@ -XXX,XX +XXX,XX @@
113
+/*
114
+ * STM32F405 SoC
115
+ *
116
+ * Copyright (c) 2014 Alistair Francis <alistair@alistair23.me>
117
+ *
118
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
119
+ * of this software and associated documentation files (the "Software"), to deal
120
+ * in the Software without restriction, including without limitation the rights
121
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
122
+ * copies of the Software, and to permit persons to whom the Software is
123
+ * furnished to do so, subject to the following conditions:
124
+ *
125
+ * The above copyright notice and this permission notice shall be included in
126
+ * all copies or substantial portions of the Software.
127
+ *
128
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
129
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
130
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
131
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
132
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
133
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
134
+ * THE SOFTWARE.
135
+ */
136
+
137
+#include "qemu/osdep.h"
138
+#include "qapi/error.h"
139
+#include "qemu-common.h"
140
+#include "exec/address-spaces.h"
141
+#include "sysemu/sysemu.h"
142
+#include "hw/arm/stm32f405_soc.h"
143
+#include "hw/misc/unimp.h"
144
+
145
+#define SYSCFG_ADD 0x40013800
146
+static const uint32_t usart_addr[] = { 0x40011000, 0x40004400, 0x40004800,
147
+ 0x40004C00, 0x40005000, 0x40011400,
148
+ 0x40007800, 0x40007C00 };
149
+/* At the moment only Timer 2 to 5 are modelled */
150
+static const uint32_t timer_addr[] = { 0x40000000, 0x40000400,
151
+ 0x40000800, 0x40000C00 };
152
+#define ADC_ADDR 0x40012000
153
+static const uint32_t spi_addr[] = { 0x40013000, 0x40003800, 0x40003C00,
154
+ 0x40013400, 0x40015000, 0x40015400 };
155
+#define EXTI_ADDR 0x40013C00
156
+
157
+#define SYSCFG_IRQ 71
158
+static const int usart_irq[] = { 37, 38, 39, 52, 53, 71, 82, 83 };
159
+static const int timer_irq[] = { 28, 29, 30, 50 };
160
+#define ADC_IRQ 18
161
+static const int spi_irq[] = { 35, 36, 51, 0, 0, 0 };
162
+static const int exti_irq[] = { 6, 7, 8, 9, 10, 23, 23, 23, 23, 23, 40,
163
+ 40, 40, 40, 40, 40} ;
164
+
165
+
166
+static void stm32f405_soc_initfn(Object *obj)
167
+{
168
+ STM32F405State *s = STM32F405_SOC(obj);
169
+ int i;
170
+
171
+ sysbus_init_child_obj(obj, "armv7m", &s->armv7m, sizeof(s->armv7m),
172
+ TYPE_ARMV7M);
173
+
174
+ sysbus_init_child_obj(obj, "syscfg", &s->syscfg, sizeof(s->syscfg),
175
+ TYPE_STM32F4XX_SYSCFG);
176
+
177
+ for (i = 0; i < STM_NUM_USARTS; i++) {
178
+ sysbus_init_child_obj(obj, "usart[*]", &s->usart[i],
179
+ sizeof(s->usart[i]), TYPE_STM32F2XX_USART);
180
+ }
181
+
182
+ for (i = 0; i < STM_NUM_TIMERS; i++) {
183
+ sysbus_init_child_obj(obj, "timer[*]", &s->timer[i],
184
+ sizeof(s->timer[i]), TYPE_STM32F2XX_TIMER);
185
+ }
186
+
187
+ for (i = 0; i < STM_NUM_ADCS; i++) {
188
+ sysbus_init_child_obj(obj, "adc[*]", &s->adc[i], sizeof(s->adc[i]),
189
+ TYPE_STM32F2XX_ADC);
190
+ }
191
+
192
+ for (i = 0; i < STM_NUM_SPIS; i++) {
193
+ sysbus_init_child_obj(obj, "spi[*]", &s->spi[i], sizeof(s->spi[i]),
194
+ TYPE_STM32F2XX_SPI);
195
+ }
196
+
197
+ sysbus_init_child_obj(obj, "exti", &s->exti, sizeof(s->exti),
198
+ TYPE_STM32F4XX_EXTI);
199
+}
200
+
201
+static void stm32f405_soc_realize(DeviceState *dev_soc, Error **errp)
202
+{
203
+ STM32F405State *s = STM32F405_SOC(dev_soc);
204
+ MemoryRegion *system_memory = get_system_memory();
205
+ DeviceState *dev, *armv7m;
206
+ SysBusDevice *busdev;
207
+ Error *err = NULL;
208
+ int i;
209
+
210
+ memory_region_init_ram(&s->flash, NULL, "STM32F405.flash", FLASH_SIZE,
211
+ &err);
212
+ if (err != NULL) {
213
+ error_propagate(errp, err);
214
+ return;
215
+ }
216
+ memory_region_init_alias(&s->flash_alias, NULL, "STM32F405.flash.alias",
217
+ &s->flash, 0, FLASH_SIZE);
218
+
219
+ memory_region_set_readonly(&s->flash, true);
220
+ memory_region_set_readonly(&s->flash_alias, true);
221
+
222
+ memory_region_add_subregion(system_memory, FLASH_BASE_ADDRESS, &s->flash);
223
+ memory_region_add_subregion(system_memory, 0, &s->flash_alias);
224
+
225
+ memory_region_init_ram(&s->sram, NULL, "STM32F405.sram", SRAM_SIZE,
226
+ &err);
227
+ if (err != NULL) {
228
+ error_propagate(errp, err);
229
+ return;
230
+ }
231
+ memory_region_add_subregion(system_memory, SRAM_BASE_ADDRESS, &s->sram);
232
+
233
+ armv7m = DEVICE(&s->armv7m);
234
+ qdev_prop_set_uint32(armv7m, "num-irq", 96);
235
+ qdev_prop_set_string(armv7m, "cpu-type", s->cpu_type);
236
+ qdev_prop_set_bit(armv7m, "enable-bitband", true);
237
+ object_property_set_link(OBJECT(&s->armv7m), OBJECT(system_memory),
238
+ "memory", &error_abort);
239
+ object_property_set_bool(OBJECT(&s->armv7m), true, "realized", &err);
240
+ if (err != NULL) {
241
+ error_propagate(errp, err);
242
+ return;
243
+ }
244
+
245
+ /* System configuration controller */
246
+ dev = DEVICE(&s->syscfg);
247
+ object_property_set_bool(OBJECT(&s->syscfg), true, "realized", &err);
248
+ if (err != NULL) {
249
+ error_propagate(errp, err);
250
+ return;
251
+ }
252
+ busdev = SYS_BUS_DEVICE(dev);
253
+ sysbus_mmio_map(busdev, 0, SYSCFG_ADD);
254
+ sysbus_connect_irq(busdev, 0, qdev_get_gpio_in(armv7m, SYSCFG_IRQ));
255
+
256
+ /* Attach UART (uses USART registers) and USART controllers */
257
+ for (i = 0; i < STM_NUM_USARTS; i++) {
258
+ dev = DEVICE(&(s->usart[i]));
259
+ qdev_prop_set_chr(dev, "chardev", serial_hd(i));
260
+ object_property_set_bool(OBJECT(&s->usart[i]), true, "realized", &err);
261
+ if (err != NULL) {
262
+ error_propagate(errp, err);
263
+ return;
264
+ }
265
+ busdev = SYS_BUS_DEVICE(dev);
266
+ sysbus_mmio_map(busdev, 0, usart_addr[i]);
267
+ sysbus_connect_irq(busdev, 0, qdev_get_gpio_in(armv7m, usart_irq[i]));
268
+ }
269
+
270
+ /* Timer 2 to 5 */
271
+ for (i = 0; i < STM_NUM_TIMERS; i++) {
272
+ dev = DEVICE(&(s->timer[i]));
273
+ qdev_prop_set_uint64(dev, "clock-frequency", 1000000000);
274
+ object_property_set_bool(OBJECT(&s->timer[i]), true, "realized", &err);
275
+ if (err != NULL) {
276
+ error_propagate(errp, err);
277
+ return;
278
+ }
279
+ busdev = SYS_BUS_DEVICE(dev);
280
+ sysbus_mmio_map(busdev, 0, timer_addr[i]);
281
+ sysbus_connect_irq(busdev, 0, qdev_get_gpio_in(armv7m, timer_irq[i]));
282
+ }
283
+
284
+ /* ADC device, the IRQs are ORed together */
285
+ object_initialize_child(OBJECT(s), "adc-orirq", &s->adc_irqs,
286
+ sizeof(s->adc_irqs), TYPE_OR_IRQ,
287
+ &err, NULL);
288
+ if (err != NULL) {
289
+ error_propagate(errp, err);
290
+ return;
291
+ }
292
+ object_property_set_int(OBJECT(&s->adc_irqs), STM_NUM_ADCS,
293
+ "num-lines", &err);
294
+ object_property_set_bool(OBJECT(&s->adc_irqs), true, "realized", &err);
295
+ if (err != NULL) {
296
+ error_propagate(errp, err);
297
+ return;
298
+ }
299
+ qdev_connect_gpio_out(DEVICE(&s->adc_irqs), 0,
300
+ qdev_get_gpio_in(armv7m, ADC_IRQ));
301
+
302
+ dev = DEVICE(&(s->adc[i]));
303
+ object_property_set_bool(OBJECT(&s->adc[i]), true, "realized", &err);
304
+ if (err != NULL) {
305
+ error_propagate(errp, err);
306
+ return;
307
+ }
308
+ busdev = SYS_BUS_DEVICE(dev);
309
+ sysbus_mmio_map(busdev, 0, ADC_ADDR);
310
+ sysbus_connect_irq(busdev, 0,
311
+ qdev_get_gpio_in(DEVICE(&s->adc_irqs), i));
312
+
313
+ /* SPI devices */
314
+ for (i = 0; i < STM_NUM_SPIS; i++) {
315
+ dev = DEVICE(&(s->spi[i]));
316
+ object_property_set_bool(OBJECT(&s->spi[i]), true, "realized", &err);
317
+ if (err != NULL) {
318
+ error_propagate(errp, err);
319
+ return;
320
+ }
321
+ busdev = SYS_BUS_DEVICE(dev);
322
+ sysbus_mmio_map(busdev, 0, spi_addr[i]);
323
+ sysbus_connect_irq(busdev, 0, qdev_get_gpio_in(armv7m, spi_irq[i]));
324
+ }
325
+
326
+ /* EXTI device */
327
+ dev = DEVICE(&s->exti);
328
+ object_property_set_bool(OBJECT(&s->exti), true, "realized", &err);
329
+ if (err != NULL) {
330
+ error_propagate(errp, err);
331
+ return;
332
+ }
333
+ busdev = SYS_BUS_DEVICE(dev);
334
+ sysbus_mmio_map(busdev, 0, EXTI_ADDR);
335
+ for (i = 0; i < 16; i++) {
336
+ sysbus_connect_irq(busdev, i, qdev_get_gpio_in(armv7m, exti_irq[i]));
337
+ }
338
+ for (i = 0; i < 16; i++) {
339
+ qdev_connect_gpio_out(DEVICE(&s->syscfg), i, qdev_get_gpio_in(dev, i));
340
+ }
341
+
342
+ create_unimplemented_device("timer[7]", 0x40001400, 0x400);
343
+ create_unimplemented_device("timer[12]", 0x40001800, 0x400);
344
+ create_unimplemented_device("timer[6]", 0x40001000, 0x400);
345
+ create_unimplemented_device("timer[13]", 0x40001C00, 0x400);
346
+ create_unimplemented_device("timer[14]", 0x40002000, 0x400);
347
+ create_unimplemented_device("RTC and BKP", 0x40002800, 0x400);
348
+ create_unimplemented_device("WWDG", 0x40002C00, 0x400);
349
+ create_unimplemented_device("IWDG", 0x40003000, 0x400);
350
+ create_unimplemented_device("I2S2ext", 0x40003000, 0x400);
351
+ create_unimplemented_device("I2S3ext", 0x40004000, 0x400);
352
+ create_unimplemented_device("I2C1", 0x40005400, 0x400);
353
+ create_unimplemented_device("I2C2", 0x40005800, 0x400);
354
+ create_unimplemented_device("I2C3", 0x40005C00, 0x400);
355
+ create_unimplemented_device("CAN1", 0x40006400, 0x400);
356
+ create_unimplemented_device("CAN2", 0x40006800, 0x400);
357
+ create_unimplemented_device("PWR", 0x40007000, 0x400);
358
+ create_unimplemented_device("DAC", 0x40007400, 0x400);
359
+ create_unimplemented_device("timer[1]", 0x40010000, 0x400);
360
+ create_unimplemented_device("timer[8]", 0x40010400, 0x400);
361
+ create_unimplemented_device("SDIO", 0x40012C00, 0x400);
362
+ create_unimplemented_device("timer[9]", 0x40014000, 0x400);
363
+ create_unimplemented_device("timer[10]", 0x40014400, 0x400);
364
+ create_unimplemented_device("timer[11]", 0x40014800, 0x400);
365
+ create_unimplemented_device("GPIOA", 0x40020000, 0x400);
366
+ create_unimplemented_device("GPIOB", 0x40020400, 0x400);
367
+ create_unimplemented_device("GPIOC", 0x40020800, 0x400);
368
+ create_unimplemented_device("GPIOD", 0x40020C00, 0x400);
369
+ create_unimplemented_device("GPIOE", 0x40021000, 0x400);
370
+ create_unimplemented_device("GPIOF", 0x40021400, 0x400);
371
+ create_unimplemented_device("GPIOG", 0x40021800, 0x400);
372
+ create_unimplemented_device("GPIOH", 0x40021C00, 0x400);
373
+ create_unimplemented_device("GPIOI", 0x40022000, 0x400);
374
+ create_unimplemented_device("CRC", 0x40023000, 0x400);
375
+ create_unimplemented_device("RCC", 0x40023800, 0x400);
376
+ create_unimplemented_device("Flash Int", 0x40023C00, 0x400);
377
+ create_unimplemented_device("BKPSRAM", 0x40024000, 0x400);
378
+ create_unimplemented_device("DMA1", 0x40026000, 0x400);
379
+ create_unimplemented_device("DMA2", 0x40026400, 0x400);
380
+ create_unimplemented_device("Ethernet", 0x40028000, 0x1400);
381
+ create_unimplemented_device("USB OTG HS", 0x40040000, 0x30000);
382
+ create_unimplemented_device("USB OTG FS", 0x50000000, 0x31000);
383
+ create_unimplemented_device("DCMI", 0x50050000, 0x400);
384
+ create_unimplemented_device("RNG", 0x50060800, 0x400);
385
+}
386
+
387
+static Property stm32f405_soc_properties[] = {
388
+ DEFINE_PROP_STRING("cpu-type", STM32F405State, cpu_type),
389
+ DEFINE_PROP_END_OF_LIST(),
390
+};
391
+
392
+static void stm32f405_soc_class_init(ObjectClass *klass, void *data)
393
+{
394
+ DeviceClass *dc = DEVICE_CLASS(klass);
395
+
396
+ dc->realize = stm32f405_soc_realize;
397
+ dc->props = stm32f405_soc_properties;
398
+ /* No vmstate or reset required: device has no internal state */
399
+}
400
+
401
+static const TypeInfo stm32f405_soc_info = {
402
+ .name = TYPE_STM32F405_SOC,
403
+ .parent = TYPE_SYS_BUS_DEVICE,
404
+ .instance_size = sizeof(STM32F405State),
405
+ .instance_init = stm32f405_soc_initfn,
406
+ .class_init = stm32f405_soc_class_init,
407
+};
408
+
409
+static void stm32f405_soc_types(void)
410
+{
411
+ type_register_static(&stm32f405_soc_info);
412
+}
413
+
414
+type_init(stm32f405_soc_types)
415
diff --git a/MAINTAINERS b/MAINTAINERS
416
index XXXXXXX..XXXXXXX 100644
417
--- a/MAINTAINERS
418
+++ b/MAINTAINERS
419
@@ -XXX,XX +XXX,XX @@ F: hw/adc/*
420
F: hw/ssi/stm32f2xx_spi.c
421
F: include/hw/*/stm32*.h
422
423
+STM32F405
424
+M: Alistair Francis <alistair@alistair23.me>
425
+M: Peter Maydell <peter.maydell@linaro.org>
426
+S: Maintained
427
+F: hw/arm/stm32f405_soc.c
428
+F: hw/misc/stm32f4xx_syscfg.c
429
+F: hw/misc/stm32f4xx_exti.c
430
+
431
Netduino 2
432
M: Alistair Francis <alistair@alistair23.me>
433
M: Peter Maydell <peter.maydell@linaro.org>
434
--
435
2.20.1
436
437
diff view generated by jsdifflib
1
The raspi3 has AArch64 CPUs, which means that our smpboot
1
From: Alistair Francis <alistair@alistair23.me>
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
Signed-off-by: Alistair Francis <alistair@alistair23.me>
4
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
5
Message-id: dad8d8d47f7625913e35e27a1c00f603a6b08f9a.1576658572.git.alistair@alistair23.me
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6
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
---
7
---
11
hw/arm/raspi.c | 41 ++++++++++++++++++++++++++++++++++++++++-
8
hw/arm/Makefile.objs | 1 +
12
1 file changed, 40 insertions(+), 1 deletion(-)
9
hw/arm/netduinoplus2.c | 52 ++++++++++++++++++++++++++++++++++++++++++
10
MAINTAINERS | 6 +++++
11
3 files changed, 59 insertions(+)
12
create mode 100644 hw/arm/netduinoplus2.c
13
13
14
diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c
14
diff --git a/hw/arm/Makefile.objs b/hw/arm/Makefile.objs
15
index XXXXXXX..XXXXXXX 100644
15
index XXXXXXX..XXXXXXX 100644
16
--- a/hw/arm/raspi.c
16
--- a/hw/arm/Makefile.objs
17
+++ b/hw/arm/raspi.c
17
+++ b/hw/arm/Makefile.objs
18
@@ -XXX,XX +XXX,XX @@ obj-$(CONFIG_MAINSTONE) += mainstone.o
19
obj-$(CONFIG_MICROBIT) += microbit.o
20
obj-$(CONFIG_MUSICPAL) += musicpal.o
21
obj-$(CONFIG_NETDUINO2) += netduino2.o
22
+obj-$(CONFIG_NETDUINOPLUS2) += netduinoplus2.o
23
obj-$(CONFIG_NSERIES) += nseries.o
24
obj-$(CONFIG_SX1) += omap_sx1.o
25
obj-$(CONFIG_CHEETAH) += palm.o
26
diff --git a/hw/arm/netduinoplus2.c b/hw/arm/netduinoplus2.c
27
new file mode 100644
28
index XXXXXXX..XXXXXXX
29
--- /dev/null
30
+++ b/hw/arm/netduinoplus2.c
18
@@ -XXX,XX +XXX,XX @@
31
@@ -XXX,XX +XXX,XX @@
19
#define BOARDSETUP_ADDR (MVBAR_ADDR + 0x20) /* board setup code */
32
+/*
20
#define FIRMWARE_ADDR_2 0x8000 /* Pi 2 loads kernel.img here by default */
33
+ * Netduino Plus 2 Machine Model
21
#define FIRMWARE_ADDR_3 0x80000 /* Pi 3 loads kernel.img here by default */
34
+ *
22
+#define SPINTABLE_ADDR 0xd8 /* Pi 3 bootloader spintable */
35
+ * Copyright (c) 2014 Alistair Francis <alistair@alistair23.me>
23
36
+ *
24
/* Table of Linux board IDs for different Pi versions */
37
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
25
static const int raspi_boardid[] = {[1] = 0xc42, [2] = 0xc43, [3] = 0xc44};
38
+ * of this software and associated documentation files (the "Software"), to deal
26
@@ -XXX,XX +XXX,XX @@ static void write_smpboot(ARMCPU *cpu, const struct arm_boot_info *info)
39
+ * in the Software without restriction, including without limitation the rights
27
info->smp_loader_start);
40
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
28
}
41
+ * copies of the Software, and to permit persons to whom the Software is
29
42
+ * furnished to do so, subject to the following conditions:
30
+static void write_smpboot64(ARMCPU *cpu, const struct arm_boot_info *info)
43
+ *
44
+ * The above copyright notice and this permission notice shall be included in
45
+ * all copies or substantial portions of the Software.
46
+ *
47
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
48
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
49
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
50
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
51
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
52
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
53
+ * THE SOFTWARE.
54
+ */
55
+
56
+#include "qemu/osdep.h"
57
+#include "qapi/error.h"
58
+#include "hw/boards.h"
59
+#include "hw/qdev-properties.h"
60
+#include "qemu/error-report.h"
61
+#include "hw/arm/stm32f405_soc.h"
62
+#include "hw/arm/boot.h"
63
+
64
+static void netduinoplus2_init(MachineState *machine)
31
+{
65
+{
32
+ /* Unlike the AArch32 version we don't need to call the board setup hook.
66
+ DeviceState *dev;
33
+ * The mechanism for doing the spin-table is also entirely different.
34
+ * We must have four 64-bit fields at absolute addresses
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
+
67
+
54
+ static const uint64_t spintables[] = {
68
+ dev = qdev_create(NULL, TYPE_STM32F405_SOC);
55
+ 0, 0, 0, 0
69
+ qdev_prop_set_string(dev, "cpu-type", ARM_CPU_TYPE_NAME("cortex-m4"));
56
+ };
70
+ object_property_set_bool(OBJECT(dev), true, "realized", &error_fatal);
57
+
71
+
58
+ rom_add_blob_fixed("raspi_smpboot", smpboot, sizeof(smpboot),
72
+ armv7m_load_kernel(ARM_CPU(first_cpu),
59
+ info->smp_loader_start);
73
+ machine->kernel_filename,
60
+ rom_add_blob_fixed("raspi_spintables", spintables, sizeof(spintables),
74
+ FLASH_SIZE);
61
+ SPINTABLE_ADDR);
62
+}
75
+}
63
+
76
+
64
static void write_board_setup(ARMCPU *cpu, const struct arm_boot_info *info)
77
+static void netduinoplus2_machine_init(MachineClass *mc)
65
{
78
+{
66
arm_write_secure_board_setup_dummy_smc(cpu, info, MVBAR_ADDR);
79
+ mc->desc = "Netduino Plus 2 Machine";
67
@@ -XXX,XX +XXX,XX @@ static void setup_boot(MachineState *machine, int version, size_t ram_size)
80
+ mc->init = netduinoplus2_init;
68
/* Pi2 and Pi3 requires SMP setup */
81
+}
69
if (version >= 2) {
82
+
70
binfo.smp_loader_start = SMPBOOT_ADDR;
83
+DEFINE_MACHINE("netduinoplus2", netduinoplus2_machine_init)
71
- binfo.write_secondary_boot = write_smpboot;
84
diff --git a/MAINTAINERS b/MAINTAINERS
72
+ if (version == 2) {
85
index XXXXXXX..XXXXXXX 100644
73
+ binfo.write_secondary_boot = write_smpboot;
86
--- a/MAINTAINERS
74
+ } else {
87
+++ b/MAINTAINERS
75
+ binfo.write_secondary_boot = write_smpboot64;
88
@@ -XXX,XX +XXX,XX @@ M: Peter Maydell <peter.maydell@linaro.org>
76
+ }
89
S: Maintained
77
binfo.secondary_cpu_reset_hook = reset_secondary;
90
F: hw/arm/netduino2.c
78
}
91
79
92
+Netduino Plus 2
93
+M: Alistair Francis <alistair@alistair23.me>
94
+M: Peter Maydell <peter.maydell@linaro.org>
95
+S: Maintained
96
+F: hw/arm/netduinoplus2.c
97
+
98
SmartFusion2
99
M: Subbaraya Sundeep <sundeep.lkml@gmail.com>
100
M: Peter Maydell <peter.maydell@linaro.org>
80
--
101
--
81
2.16.2
102
2.20.1
82
103
83
104
diff view generated by jsdifflib
1
The BCM2837 sets the Aff1 field of the MPIDR affinity values for the
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
2
CPUs to 0, whereas the BCM2836 uses 0xf. Set this correctly, as it
3
is required for Linux to boot.
4
2
3
This test boots a Linux kernel on a CubieBoard and verify
4
the serial output is working.
5
6
The kernel image and DeviceTree blob are built by the Armbian
7
project (based on Debian):
8
https://docs.armbian.com/Developer-Guide_Build-Preparation/
9
10
The cpio image used comes from the linux-build-test project:
11
https://github.com/groeck/linux-build-test
12
13
If ARM is a target being built, "make check-acceptance" will
14
automatically include this test by the use of the "arch:arm" tags.
15
16
Alternatively, this test can be run using:
17
18
$ avocado --show=console run -t machine:cubieboard tests/acceptance/boot_linux_console.py
19
console: Uncompressing Linux... done, booting the kernel.
20
console: Booting Linux on physical CPU 0x0
21
console: Linux version 4.20.7-sunxi (root@armbian.com) (gcc version 7.2.1 20171011 (Linaro GCC 7.2-2017.11)) #5.75 SMP Fri Feb 8 09:02:10 CET 2019
22
console: CPU: ARMv7 Processor [410fc080] revision 0 (ARMv7), cr=50c5387d
23
console: CPU: PIPT / VIPT nonaliasing data cache, VIPT nonaliasing instruction cache
24
console: OF: fdt: Machine model: Cubietech Cubieboard
25
[...]
26
console: Boot successful.
27
console: cat /proc/cpuinfo
28
console: / # cat /proc/cpuinfo
29
console: processor : 0
30
console: model name : ARMv7 Processor rev 0 (v7l)
31
console: BogoMIPS : 832.51
32
[...]
33
console: Hardware : Allwinner sun4i/sun5i Families
34
console: Revision : 0000
35
console: Serial : 0000000000000000
36
console: cat /proc/iomem
37
console: / # cat /proc/iomem
38
console: 01c00000-01c0002f : system-control@1c00000
39
console: 01c02000-01c02fff : dma-controller@1c02000
40
console: 01c05000-01c05fff : spi@1c05000
41
console: 01c0b080-01c0b093 : mdio@1c0b080
42
console: 01c0c000-01c0cfff : lcd-controller@1c0c000
43
console: 01c0d000-01c0dfff : lcd-controller@1c0d000
44
console: 01c0f000-01c0ffff : mmc@1c0f000
45
[...]
46
PASS (54.35 s)
47
48
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
49
Reviewed-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
50
Tested-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
51
Message-id: 20191230110953.25496-2-f4bug@amsat.org
5
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
52
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6
Reviewed-by: Andrew Baumann <Andrew.Baumann@microsoft.com>
7
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
8
Message-id: 20180313153458.26822-8-peter.maydell@linaro.org
9
---
53
---
10
hw/arm/bcm2836.c | 11 +++++++----
54
tests/acceptance/boot_linux_console.py | 41 ++++++++++++++++++++++++++
11
1 file changed, 7 insertions(+), 4 deletions(-)
55
1 file changed, 41 insertions(+)
12
56
13
diff --git a/hw/arm/bcm2836.c b/hw/arm/bcm2836.c
57
diff --git a/tests/acceptance/boot_linux_console.py b/tests/acceptance/boot_linux_console.py
14
index XXXXXXX..XXXXXXX 100644
58
index XXXXXXX..XXXXXXX 100644
15
--- a/hw/arm/bcm2836.c
59
--- a/tests/acceptance/boot_linux_console.py
16
+++ b/hw/arm/bcm2836.c
60
+++ b/tests/acceptance/boot_linux_console.py
17
@@ -XXX,XX +XXX,XX @@
61
@@ -XXX,XX +XXX,XX @@ class BootLinuxConsole(Test):
18
62
self.wait_for_console_pattern('Boot successful.')
19
struct BCM283XInfo {
63
# TODO user command, for now the uart is stuck
20
const char *name;
64
21
+ int clusterid;
65
+ def test_arm_cubieboard_initrd(self):
22
};
66
+ """
23
67
+ :avocado: tags=arch:arm
24
static const BCM283XInfo bcm283x_socs[] = {
68
+ :avocado: tags=machine:cubieboard
25
{
69
+ """
26
.name = TYPE_BCM2836,
70
+ deb_url = ('https://apt.armbian.com/pool/main/l/'
27
+ .clusterid = 0xf,
71
+ 'linux-4.20.7-sunxi/linux-image-dev-sunxi_5.75_armhf.deb')
28
},
72
+ deb_hash = '1334c29c44d984ffa05ed10de8c3361f33d78315'
29
{
73
+ deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash)
30
.name = TYPE_BCM2837,
74
+ kernel_path = self.extract_from_deb(deb_path,
31
+ .clusterid = 0x0,
75
+ '/boot/vmlinuz-4.20.7-sunxi')
32
},
76
+ dtb_path = '/usr/lib/linux-image-dev-sunxi/sun4i-a10-cubieboard.dtb'
33
};
77
+ dtb_path = self.extract_from_deb(deb_path, dtb_path)
34
78
+ initrd_url = ('https://github.com/groeck/linux-build-test/raw/'
35
@@ -XXX,XX +XXX,XX @@ static void bcm2836_init(Object *obj)
79
+ '2eb0a73b5d5a28df3170c546ddaaa9757e1e0848/rootfs/'
36
static void bcm2836_realize(DeviceState *dev, Error **errp)
80
+ 'arm/rootfs-armv5.cpio.gz')
37
{
81
+ initrd_hash = '2b50f1873e113523967806f4da2afe385462ff9b'
38
BCM283XState *s = BCM283X(dev);
82
+ initrd_path_gz = self.fetch_asset(initrd_url, asset_hash=initrd_hash)
39
+ BCM283XClass *bc = BCM283X_GET_CLASS(dev);
83
+ initrd_path = os.path.join(self.workdir, 'rootfs.cpio')
40
+ const BCM283XInfo *info = bc->info;
84
+ archive.gzip_uncompress(initrd_path_gz, initrd_path)
41
Object *obj;
85
+
42
Error *err = NULL;
86
+ self.vm.set_console()
43
int n;
87
+ kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
44
@@ -XXX,XX +XXX,XX @@ static void bcm2836_realize(DeviceState *dev, Error **errp)
88
+ 'console=ttyS0,115200 '
45
qdev_get_gpio_in_named(DEVICE(&s->control), "gpu-fiq", 0));
89
+ 'usbcore.nousb '
46
90
+ 'panic=-1 noreboot')
47
for (n = 0; n < BCM283X_NCPUS; n++) {
91
+ self.vm.add_args('-kernel', kernel_path,
48
- /* Mirror bcm2836, which has clusterid set to 0xf
92
+ '-dtb', dtb_path,
49
- * TODO: this should be converted to a property of ARM_CPU
93
+ '-initrd', initrd_path,
50
- */
94
+ '-append', kernel_command_line,
51
- s->cpus[n].mp_affinity = 0xF00 | n;
95
+ '-no-reboot')
52
+ /* TODO: this should be converted to a property of ARM_CPU */
96
+ self.vm.launch()
53
+ s->cpus[n].mp_affinity = (info->clusterid << 8) | n;
97
+ self.wait_for_console_pattern('Boot successful.')
54
98
+
55
/* set periphbase/CBAR value for CPU-local registers */
99
+ exec_command_and_wait_for_pattern(self, 'cat /proc/cpuinfo',
56
object_property_set_int(OBJECT(&s->cpus[n]),
100
+ 'Allwinner sun4i/sun5i')
101
+ exec_command_and_wait_for_pattern(self, 'cat /proc/iomem',
102
+ 'system-control@1c00000')
103
+ exec_command_and_wait_for_pattern(self, 'reboot',
104
+ 'reboot: Restarting system')
105
+
106
def test_s390x_s390_ccw_virtio(self):
107
"""
108
:avocado: tags=arch:s390x
57
--
109
--
58
2.16.2
110
2.20.1
59
111
60
112
diff view generated by jsdifflib
1
If we're directly booting a Linux kernel and the CPU supports both
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
2
EL3 and EL2, we start the kernel in EL2, as it expects. We must also
3
set the SCR_EL3.HCE bit in this situation, so that the HVC
4
instruction is enabled rather than UNDEFing. Otherwise at least some
5
kernels will panic when trying to initialize KVM in the guest.
6
2
3
The kernel image and DeviceTree blob are built by the Armbian
4
project (based on Debian):
5
https://docs.armbian.com/Developer-Guide_Build-Preparation/
6
7
The cpio image used comes from the linux-build-test project:
8
https://github.com/groeck/linux-build-test
9
10
If ARM is a target being built, "make check-acceptance" will
11
automatically include this test by the use of the "arch:arm" tags.
12
13
Alternatively, this test can be run using:
14
15
$ avocado --show=console run -t machine:cubieboard tests/acceptance/boot_linux_console.py
16
console: Uncompressing Linux... done, booting the kernel.
17
console: Booting Linux on physical CPU 0x0
18
console: Linux version 4.20.7-sunxi (root@armbian.com) (gcc version 7.2.1 20171011 (Linaro GCC 7.2-2017.11)) #5.75 SMP Fri Feb 8 09:02:10 CET 2019
19
[...]
20
console: ahci-sunxi 1c18000.sata: Linked as a consumer to regulator.4
21
console: ahci-sunxi 1c18000.sata: controller can't do 64bit DMA, forcing 32bit
22
console: ahci-sunxi 1c18000.sata: AHCI 0001.0000 32 slots 1 ports 1.5 Gbps 0x1 impl platform mode
23
console: ahci-sunxi 1c18000.sata: flags: ncq only
24
console: scsi host0: ahci-sunxi
25
console: ata1: SATA max UDMA/133 mmio [mem 0x01c18000-0x01c18fff] port 0x100 irq 27
26
console: of_cfs_init
27
console: of_cfs_init: OK
28
console: vcc3v0: disabling
29
console: vcc5v0: disabling
30
console: usb1-vbus: disabling
31
console: usb2-vbus: disabling
32
console: ata1: SATA link up 1.5 Gbps (SStatus 113 SControl 300)
33
console: ata1.00: ATA-7: QEMU HARDDISK, 2.5+, max UDMA/100
34
console: ata1.00: 40960 sectors, multi 16: LBA48 NCQ (depth 32)
35
console: ata1.00: applying bridge limits
36
console: ata1.00: configured for UDMA/100
37
console: scsi 0:0:0:0: Direct-Access ATA QEMU HARDDISK 2.5+ PQ: 0 ANSI: 5
38
console: sd 0:0:0:0: Attached scsi generic sg0 type 0
39
console: sd 0:0:0:0: [sda] 40960 512-byte logical blocks: (21.0 MB/20.0 MiB)
40
console: sd 0:0:0:0: [sda] Write Protect is off
41
console: sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
42
console: sd 0:0:0:0: [sda] Attached SCSI disk
43
console: EXT4-fs (sda): mounting ext2 file system using the ext4 subsystem
44
console: EXT4-fs (sda): mounted filesystem without journal. Opts: (null)
45
console: VFS: Mounted root (ext2 filesystem) readonly on device 8:0.
46
[...]
47
console: cat /proc/partitions
48
console: / # cat /proc/partitions
49
console: major minor #blocks name
50
console: 1 0 4096 ram0
51
console: 1 1 4096 ram1
52
console: 1 2 4096 ram2
53
console: 1 3 4096 ram3
54
console: 8 0 20480 sda
55
console: reboot
56
console: / # reboot
57
[...]
58
console: sd 0:0:0:0: [sda] Synchronizing SCSI cache
59
console: reboot: Restarting system
60
PASS (48.39 s)
61
62
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
63
Message-id: 20191230110953.25496-3-f4bug@amsat.org
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
64
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8
Message-id: 20180313153458.26822-4-peter.maydell@linaro.org
9
---
65
---
10
hw/arm/boot.c | 5 +++++
66
tests/acceptance/boot_linux_console.py | 44 ++++++++++++++++++++++++++
11
1 file changed, 5 insertions(+)
67
1 file changed, 44 insertions(+)
12
68
13
diff --git a/hw/arm/boot.c b/hw/arm/boot.c
69
diff --git a/tests/acceptance/boot_linux_console.py b/tests/acceptance/boot_linux_console.py
14
index XXXXXXX..XXXXXXX 100644
70
index XXXXXXX..XXXXXXX 100644
15
--- a/hw/arm/boot.c
71
--- a/tests/acceptance/boot_linux_console.py
16
+++ b/hw/arm/boot.c
72
+++ b/tests/acceptance/boot_linux_console.py
17
@@ -XXX,XX +XXX,XX @@ static void do_cpu_reset(void *opaque)
73
@@ -XXX,XX +XXX,XX @@ class BootLinuxConsole(Test):
18
assert(!info->secure_board_setup);
74
exec_command_and_wait_for_pattern(self, 'reboot',
19
}
75
'reboot: Restarting system')
20
76
21
+ if (arm_feature(env, ARM_FEATURE_EL2)) {
77
+ def test_arm_cubieboard_sata(self):
22
+ /* If we have EL2 then Linux expects the HVC insn to work */
78
+ """
23
+ env->cp15.scr_el3 |= SCR_HCE;
79
+ :avocado: tags=arch:arm
24
+ }
80
+ :avocado: tags=machine:cubieboard
81
+ """
82
+ deb_url = ('https://apt.armbian.com/pool/main/l/'
83
+ 'linux-4.20.7-sunxi/linux-image-dev-sunxi_5.75_armhf.deb')
84
+ deb_hash = '1334c29c44d984ffa05ed10de8c3361f33d78315'
85
+ deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash)
86
+ kernel_path = self.extract_from_deb(deb_path,
87
+ '/boot/vmlinuz-4.20.7-sunxi')
88
+ dtb_path = '/usr/lib/linux-image-dev-sunxi/sun4i-a10-cubieboard.dtb'
89
+ dtb_path = self.extract_from_deb(deb_path, dtb_path)
90
+ rootfs_url = ('https://github.com/groeck/linux-build-test/raw/'
91
+ '2eb0a73b5d5a28df3170c546ddaaa9757e1e0848/rootfs/'
92
+ 'arm/rootfs-armv5.ext2.gz')
93
+ rootfs_hash = '093e89d2b4d982234bf528bc9fb2f2f17a9d1f93'
94
+ rootfs_path_gz = self.fetch_asset(rootfs_url, asset_hash=rootfs_hash)
95
+ rootfs_path = os.path.join(self.workdir, 'rootfs.cpio')
96
+ archive.gzip_uncompress(rootfs_path_gz, rootfs_path)
25
+
97
+
26
/* Set to non-secure if not a secure boot */
98
+ self.vm.set_console()
27
if (!info->secure_boot &&
99
+ kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
28
(cs != first_cpu || !info->secure_board_setup)) {
100
+ 'console=ttyS0,115200 '
101
+ 'usbcore.nousb '
102
+ 'root=/dev/sda ro '
103
+ 'panic=-1 noreboot')
104
+ self.vm.add_args('-kernel', kernel_path,
105
+ '-dtb', dtb_path,
106
+ '-drive', 'if=none,format=raw,id=disk0,file='
107
+ + rootfs_path,
108
+ '-device', 'ide-hd,bus=ide.0,drive=disk0',
109
+ '-append', kernel_command_line,
110
+ '-no-reboot')
111
+ self.vm.launch()
112
+ self.wait_for_console_pattern('Boot successful.')
113
+
114
+ exec_command_and_wait_for_pattern(self, 'cat /proc/cpuinfo',
115
+ 'Allwinner sun4i/sun5i')
116
+ exec_command_and_wait_for_pattern(self, 'cat /proc/partitions',
117
+ 'sda')
118
+ exec_command_and_wait_for_pattern(self, 'reboot',
119
+ 'reboot: Restarting system')
120
+
121
def test_s390x_s390_ccw_virtio(self):
122
"""
123
:avocado: tags=arch:s390x
29
--
124
--
30
2.16.2
125
2.20.1
31
126
32
127
diff view generated by jsdifflib
1
The TypeInfo and state struct for bcm2386 disagree about what the
1
From: Philippe Mathieu-Daudé <f4bug@amsat.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
These definitions are specific to the A10 SoC and don't need
4
to be exported to the different Allwinner peripherals.
5
6
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
7
Message-id: 20191230110953.25496-4-f4bug@amsat.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>
9
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
12
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
13
Message-id: 20180313153458.26822-5-peter.maydell@linaro.org
14
---
10
---
15
hw/arm/bcm2836.c | 2 +-
11
include/hw/arm/allwinner-a10.h | 6 ------
16
1 file changed, 1 insertion(+), 1 deletion(-)
12
hw/arm/allwinner-a10.c | 6 ++++++
13
2 files changed, 6 insertions(+), 6 deletions(-)
17
14
18
diff --git a/hw/arm/bcm2836.c b/hw/arm/bcm2836.c
15
diff --git a/include/hw/arm/allwinner-a10.h b/include/hw/arm/allwinner-a10.h
19
index XXXXXXX..XXXXXXX 100644
16
index XXXXXXX..XXXXXXX 100644
20
--- a/hw/arm/bcm2836.c
17
--- a/include/hw/arm/allwinner-a10.h
21
+++ b/hw/arm/bcm2836.c
18
+++ b/include/hw/arm/allwinner-a10.h
22
@@ -XXX,XX +XXX,XX @@ static void bcm2836_class_init(ObjectClass *oc, void *data)
19
@@ -XXX,XX +XXX,XX @@
23
20
#include "target/arm/cpu.h"
24
static const TypeInfo bcm2836_type_info = {
21
25
.name = TYPE_BCM2836,
22
26
- .parent = TYPE_SYS_BUS_DEVICE,
23
-#define AW_A10_PIC_REG_BASE 0x01c20400
27
+ .parent = TYPE_DEVICE,
24
-#define AW_A10_PIT_REG_BASE 0x01c20c00
28
.instance_size = sizeof(BCM2836State),
25
-#define AW_A10_UART0_REG_BASE 0x01c28000
29
.instance_init = bcm2836_init,
26
-#define AW_A10_EMAC_BASE 0x01c0b000
30
.class_init = bcm2836_class_init,
27
-#define AW_A10_SATA_BASE 0x01c18000
28
-
29
#define AW_A10_SDRAM_BASE 0x40000000
30
31
#define TYPE_AW_A10 "allwinner-a10"
32
diff --git a/hw/arm/allwinner-a10.c b/hw/arm/allwinner-a10.c
33
index XXXXXXX..XXXXXXX 100644
34
--- a/hw/arm/allwinner-a10.c
35
+++ b/hw/arm/allwinner-a10.c
36
@@ -XXX,XX +XXX,XX @@
37
#include "hw/misc/unimp.h"
38
#include "sysemu/sysemu.h"
39
40
+#define AW_A10_PIC_REG_BASE 0x01c20400
41
+#define AW_A10_PIT_REG_BASE 0x01c20c00
42
+#define AW_A10_UART0_REG_BASE 0x01c28000
43
+#define AW_A10_EMAC_BASE 0x01c0b000
44
+#define AW_A10_SATA_BASE 0x01c18000
45
+
46
static void aw_a10_init(Object *obj)
47
{
48
AwA10State *s = AW_A10(obj);
31
--
49
--
32
2.16.2
50
2.20.1
33
51
34
52
diff view generated by jsdifflib
1
Our BCM2836 type is really a generic one that can be any of
1
From: Philippe Mathieu-Daudé <f4bug@amsat.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
By calling qdev_pass_gpios() we don't need to hold a copy of the
8
parent class to specific types for the bcm2836 and bcm2837.
4
IRQs from the INTC into the SoC state.
5
Instead of filling an array of qemu_irq and passing it around, we
6
can now directly call qdev_get_gpio_in() on the SoC.
9
7
8
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
9
Message-id: 20191230110953.25496-5-f4bug@amsat.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>
11
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
12
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
13
Message-id: 20180313153458.26822-6-peter.maydell@linaro.org
14
---
12
---
15
include/hw/arm/bcm2836.h | 12 ++++++------
13
include/hw/arm/allwinner-a10.h | 1 -
16
hw/arm/bcm2836.c | 17 +++++++++--------
14
hw/arm/allwinner-a10.c | 24 +++++++++++-------------
17
hw/arm/raspi.c | 16 ++++++++--------
15
2 files changed, 11 insertions(+), 14 deletions(-)
18
3 files changed, 23 insertions(+), 22 deletions(-)
19
16
20
diff --git a/include/hw/arm/bcm2836.h b/include/hw/arm/bcm2836.h
17
diff --git a/include/hw/arm/allwinner-a10.h b/include/hw/arm/allwinner-a10.h
21
index XXXXXXX..XXXXXXX 100644
18
index XXXXXXX..XXXXXXX 100644
22
--- a/include/hw/arm/bcm2836.h
19
--- a/include/hw/arm/allwinner-a10.h
23
+++ b/include/hw/arm/bcm2836.h
20
+++ b/include/hw/arm/allwinner-a10.h
24
@@ -XXX,XX +XXX,XX @@
21
@@ -XXX,XX +XXX,XX @@ typedef struct AwA10State {
25
#include "hw/arm/bcm2835_peripherals.h"
26
#include "hw/intc/bcm2836_control.h"
27
28
-#define TYPE_BCM2836 "bcm2836"
29
-#define BCM2836(obj) OBJECT_CHECK(BCM2836State, (obj), TYPE_BCM2836)
30
+#define TYPE_BCM283X "bcm283x"
31
+#define BCM283X(obj) OBJECT_CHECK(BCM283XState, (obj), TYPE_BCM283X)
32
33
-#define BCM2836_NCPUS 4
34
+#define BCM283X_NCPUS 4
35
36
-typedef struct BCM2836State {
37
+typedef struct BCM283XState {
38
/*< private >*/
39
DeviceState parent_obj;
40
/*< public >*/
22
/*< public >*/
41
@@ -XXX,XX +XXX,XX @@ typedef struct BCM2836State {
23
42
char *cpu_type;
24
ARMCPU cpu;
43
uint32_t enabled_cpus;
25
- qemu_irq irq[AW_A10_PIC_INT_NR];
44
26
AwA10PITState timer;
45
- ARMCPU cpus[BCM2836_NCPUS];
27
AwA10PICState intc;
46
+ ARMCPU cpus[BCM283X_NCPUS];
28
AwEmacState emac;
47
BCM2836ControlState control;
29
diff --git a/hw/arm/allwinner-a10.c b/hw/arm/allwinner-a10.c
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
30
index XXXXXXX..XXXXXXX 100644
55
--- a/hw/arm/bcm2836.c
31
--- a/hw/arm/allwinner-a10.c
56
+++ b/hw/arm/bcm2836.c
32
+++ b/hw/arm/allwinner-a10.c
57
@@ -XXX,XX +XXX,XX @@
33
@@ -XXX,XX +XXX,XX @@ static void aw_a10_realize(DeviceState *dev, Error **errp)
58
59
static void bcm2836_init(Object *obj)
60
{
34
{
61
- BCM2836State *s = BCM2836(obj);
35
AwA10State *s = AW_A10(dev);
62
+ BCM283XState *s = BCM283X(obj);
36
SysBusDevice *sysbusdev;
63
37
- uint8_t i;
64
object_initialize(&s->control, sizeof(s->control), TYPE_BCM2836_CONTROL);
38
qemu_irq fiq, irq;
65
object_property_add_child(obj, "control", OBJECT(&s->control), NULL);
66
@@ -XXX,XX +XXX,XX @@ static void bcm2836_init(Object *obj)
67
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;
39
Error *err = NULL;
74
int n;
40
75
@@ -XXX,XX +XXX,XX @@ static void bcm2836_realize(DeviceState *dev, Error **errp)
41
@@ -XXX,XX +XXX,XX @@ static void aw_a10_realize(DeviceState *dev, Error **errp)
76
/* common peripherals from bcm2835 */
42
sysbus_mmio_map(sysbusdev, 0, AW_A10_PIC_REG_BASE);
77
43
sysbus_connect_irq(sysbusdev, 0, irq);
78
obj = OBJECT(dev);
44
sysbus_connect_irq(sysbusdev, 1, fiq);
79
- for (n = 0; n < BCM2836_NCPUS; n++) {
45
- for (i = 0; i < AW_A10_PIC_INT_NR; i++) {
80
+ for (n = 0; n < BCM283X_NCPUS; n++) {
46
- s->irq[i] = qdev_get_gpio_in(DEVICE(&s->intc), i);
81
object_initialize(&s->cpus[n], sizeof(s->cpus[n]),
47
- }
82
s->cpu_type);
48
+ qdev_pass_gpios(DEVICE(&s->intc), dev, NULL);
83
object_property_add_child(obj, "cpu[*]", OBJECT(&s->cpus[n]),
49
84
@@ -XXX,XX +XXX,XX @@ static void bcm2836_realize(DeviceState *dev, Error **errp)
50
object_property_set_bool(OBJECT(&s->timer), true, "realized", &err);
85
sysbus_connect_irq(SYS_BUS_DEVICE(&s->peripherals), 1,
51
if (err != NULL) {
86
qdev_get_gpio_in_named(DEVICE(&s->control), "gpu-fiq", 0));
52
@@ -XXX,XX +XXX,XX @@ static void aw_a10_realize(DeviceState *dev, Error **errp)
87
53
}
88
- for (n = 0; n < BCM2836_NCPUS; n++) {
54
sysbusdev = SYS_BUS_DEVICE(&s->timer);
89
+ for (n = 0; n < BCM283X_NCPUS; n++) {
55
sysbus_mmio_map(sysbusdev, 0, AW_A10_PIT_REG_BASE);
90
/* Mirror bcm2836, which has clusterid set to 0xf
56
- sysbus_connect_irq(sysbusdev, 0, s->irq[22]);
91
* TODO: this should be converted to a property of ARM_CPU
57
- sysbus_connect_irq(sysbusdev, 1, s->irq[23]);
92
*/
58
- sysbus_connect_irq(sysbusdev, 2, s->irq[24]);
93
@@ -XXX,XX +XXX,XX @@ static void bcm2836_realize(DeviceState *dev, Error **errp)
59
- sysbus_connect_irq(sysbusdev, 3, s->irq[25]);
60
- sysbus_connect_irq(sysbusdev, 4, s->irq[67]);
61
- sysbus_connect_irq(sysbusdev, 5, s->irq[68]);
62
+ sysbus_connect_irq(sysbusdev, 0, qdev_get_gpio_in(dev, 22));
63
+ sysbus_connect_irq(sysbusdev, 1, qdev_get_gpio_in(dev, 23));
64
+ sysbus_connect_irq(sysbusdev, 2, qdev_get_gpio_in(dev, 24));
65
+ sysbus_connect_irq(sysbusdev, 3, qdev_get_gpio_in(dev, 25));
66
+ sysbus_connect_irq(sysbusdev, 4, qdev_get_gpio_in(dev, 67));
67
+ sysbus_connect_irq(sysbusdev, 5, qdev_get_gpio_in(dev, 68));
68
69
memory_region_init_ram(&s->sram_a, OBJECT(dev), "sram A", 48 * KiB,
70
&error_fatal);
71
@@ -XXX,XX +XXX,XX @@ static void aw_a10_realize(DeviceState *dev, Error **errp)
72
}
73
sysbusdev = SYS_BUS_DEVICE(&s->emac);
74
sysbus_mmio_map(sysbusdev, 0, AW_A10_EMAC_BASE);
75
- sysbus_connect_irq(sysbusdev, 0, s->irq[55]);
76
+ sysbus_connect_irq(sysbusdev, 0, qdev_get_gpio_in(dev, 55));
77
78
object_property_set_bool(OBJECT(&s->sata), true, "realized", &err);
79
if (err) {
80
@@ -XXX,XX +XXX,XX @@ static void aw_a10_realize(DeviceState *dev, Error **errp)
81
return;
82
}
83
sysbus_mmio_map(SYS_BUS_DEVICE(&s->sata), 0, AW_A10_SATA_BASE);
84
- sysbus_connect_irq(SYS_BUS_DEVICE(&s->sata), 0, s->irq[56]);
85
+ sysbus_connect_irq(SYS_BUS_DEVICE(&s->sata), 0, qdev_get_gpio_in(dev, 56));
86
87
/* FIXME use a qdev chardev prop instead of serial_hd() */
88
- serial_mm_init(get_system_memory(), AW_A10_UART0_REG_BASE, 2, s->irq[1],
89
+ serial_mm_init(get_system_memory(), AW_A10_UART0_REG_BASE, 2,
90
+ qdev_get_gpio_in(dev, 1),
91
115200, serial_hd(0), DEVICE_NATIVE_ENDIAN);
94
}
92
}
95
93
96
static Property bcm2836_props[] = {
97
- DEFINE_PROP_STRING("cpu-type", BCM2836State, cpu_type),
98
- DEFINE_PROP_UINT32("enabled-cpus", BCM2836State, enabled_cpus, BCM2836_NCPUS),
99
+ DEFINE_PROP_STRING("cpu-type", BCM283XState, cpu_type),
100
+ DEFINE_PROP_UINT32("enabled-cpus", BCM283XState, enabled_cpus,
101
+ BCM283X_NCPUS),
102
DEFINE_PROP_END_OF_LIST()
103
};
104
105
@@ -XXX,XX +XXX,XX @@ static void bcm2836_class_init(ObjectClass *oc, void *data)
106
}
107
108
static const TypeInfo bcm2836_type_info = {
109
- .name = TYPE_BCM2836,
110
+ .name = TYPE_BCM283X,
111
.parent = TYPE_DEVICE,
112
- .instance_size = sizeof(BCM2836State),
113
+ .instance_size = sizeof(BCM283XState),
114
.instance_init = bcm2836_init,
115
.class_init = bcm2836_class_init,
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
}
164
DEFINE_MACHINE("raspi3", raspi3_machine_init)
165
--
94
--
166
2.16.2
95
2.20.1
167
96
168
97
diff view generated by jsdifflib
1
Add some assertions that if we're about to boot an AArch64 kernel,
1
From: Philippe Mathieu-Daudé <f4bug@amsat.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
We won't reuse the CPU IRQ/FIQ variables. Simplify by calling
7
we don't currently support that, because only the AArch32
4
qdev_get_gpio_in() in place.
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: Philippe Mathieu-Daudé <f4bug@amsat.org>
7
Message-id: 20191230110953.25496-6-f4bug@amsat.org
13
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
14
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
9
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
15
Message-id: 20180313153458.26822-3-peter.maydell@linaro.org
16
---
10
---
17
hw/arm/boot.c | 7 +++++++
11
hw/arm/allwinner-a10.c | 9 ++++-----
18
1 file changed, 7 insertions(+)
12
1 file changed, 4 insertions(+), 5 deletions(-)
19
13
20
diff --git a/hw/arm/boot.c b/hw/arm/boot.c
14
diff --git a/hw/arm/allwinner-a10.c b/hw/arm/allwinner-a10.c
21
index XXXXXXX..XXXXXXX 100644
15
index XXXXXXX..XXXXXXX 100644
22
--- a/hw/arm/boot.c
16
--- a/hw/arm/allwinner-a10.c
23
+++ b/hw/arm/boot.c
17
+++ b/hw/arm/allwinner-a10.c
24
@@ -XXX,XX +XXX,XX @@ static void do_cpu_reset(void *opaque)
18
@@ -XXX,XX +XXX,XX @@ static void aw_a10_realize(DeviceState *dev, Error **errp)
25
} else {
19
{
26
env->pstate = PSTATE_MODE_EL1h;
20
AwA10State *s = AW_A10(dev);
27
}
21
SysBusDevice *sysbusdev;
28
+ /* AArch64 kernels never boot in secure mode */
22
- qemu_irq fiq, irq;
29
+ assert(!info->secure_boot);
23
Error *err = NULL;
30
+ /* This hook is only supported for AArch32 currently:
24
31
+ * bootloader_aarch64[] will not call the hook, and
25
object_property_set_bool(OBJECT(&s->cpu), true, "realized", &err);
32
+ * the code above has already dropped us into EL2 or EL1.
26
@@ -XXX,XX +XXX,XX @@ static void aw_a10_realize(DeviceState *dev, Error **errp)
33
+ */
27
error_propagate(errp, err);
34
+ assert(!info->secure_board_setup);
28
return;
35
}
29
}
36
30
- irq = qdev_get_gpio_in(DEVICE(&s->cpu), ARM_CPU_IRQ);
37
/* Set to non-secure if not a secure boot */
31
- fiq = qdev_get_gpio_in(DEVICE(&s->cpu), ARM_CPU_FIQ);
32
33
object_property_set_bool(OBJECT(&s->intc), true, "realized", &err);
34
if (err != NULL) {
35
@@ -XXX,XX +XXX,XX @@ static void aw_a10_realize(DeviceState *dev, Error **errp)
36
}
37
sysbusdev = SYS_BUS_DEVICE(&s->intc);
38
sysbus_mmio_map(sysbusdev, 0, AW_A10_PIC_REG_BASE);
39
- sysbus_connect_irq(sysbusdev, 0, irq);
40
- sysbus_connect_irq(sysbusdev, 1, fiq);
41
+ sysbus_connect_irq(sysbusdev, 0,
42
+ qdev_get_gpio_in(DEVICE(&s->cpu), ARM_CPU_IRQ));
43
+ sysbus_connect_irq(sysbusdev, 1,
44
+ qdev_get_gpio_in(DEVICE(&s->cpu), ARM_CPU_FIQ));
45
qdev_pass_gpios(DEVICE(&s->intc), dev, NULL);
46
47
object_property_set_bool(OBJECT(&s->timer), true, "realized", &err);
38
--
48
--
39
2.16.2
49
2.20.1
40
50
41
51
diff view generated by jsdifflib
1
For the rpi1 and 2 we want to boot the Linux kernel via some
1
From: Masahiro Yamada <masahiroy@kernel.org>
2
custom setup code that makes sure that the SMC instruction
3
acts as a no-op, because it's used for cache maintenance.
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
2
3
According to the specification "Semihosting for AArch32 and Aarch64",
4
the SYS_OPEN operation should return:
5
6
- A nonzero handle if the call is successful
7
- -1 if the call is not successful
8
9
So, it should never return 0.
10
11
Prior to commit 35e9a0a8ce4b ("target/arm/arm-semi: Make semihosting
12
code hand out its own file descriptors"), the guest fd matched to the
13
host fd. It returned a nonzero handle on success since the fd 0 is
14
already used for stdin.
15
16
Now that the guest fd is the index of guestfd_array, it starts from 0.
17
18
I noticed this issue particularly because Trusted Firmware-A built with
19
PLAT=qemu is no longer working. Its io_semihosting driver only handles
20
a positive return value as a valid filehandle.
21
22
Basically, there are two ways to fix this:
23
24
- Use (guestfd - 1) as the index of guestfs_arrary. We need to insert
25
increment/decrement to convert the guestfd and the array index back
26
and forth.
27
28
- Keep using guestfd as the index of guestfs_array. The first entry
29
of guestfs_array is left unused.
30
31
I thought the latter is simpler. We end up with wasting a small piece
32
of memory for the unused first entry of guestfd_array, but this is
33
probably not a big deal.
34
35
Fixes: 35e9a0a8ce4b ("target/arm/arm-semi: Make semihosting code hand out its own file descriptors")
36
Cc: qemu-stable@nongnu.org
37
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
38
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
39
Message-id: 20200109041228.10131-1-masahiroy@kernel.org
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
40
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Reviewed-by: Andrew Baumann <Andrew.Baumann@microsoft.com>
10
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
11
Message-id: 20180313153458.26822-2-peter.maydell@linaro.org
12
---
41
---
13
hw/arm/raspi.c | 17 +++++++++++++----
42
target/arm/arm-semi.c | 5 +++--
14
1 file changed, 13 insertions(+), 4 deletions(-)
43
1 file changed, 3 insertions(+), 2 deletions(-)
15
44
16
diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c
45
diff --git a/target/arm/arm-semi.c b/target/arm/arm-semi.c
17
index XXXXXXX..XXXXXXX 100644
46
index XXXXXXX..XXXXXXX 100644
18
--- a/hw/arm/raspi.c
47
--- a/target/arm/arm-semi.c
19
+++ b/hw/arm/raspi.c
48
+++ b/target/arm/arm-semi.c
20
@@ -XXX,XX +XXX,XX @@ static void setup_boot(MachineState *machine, int version, size_t ram_size)
49
@@ -XXX,XX +XXX,XX @@ static int alloc_guestfd(void)
21
binfo.board_id = raspi_boardid[version];
50
guestfd_array = g_array_new(FALSE, TRUE, sizeof(GuestFD));
22
binfo.ram_size = ram_size;
51
}
23
binfo.nb_cpus = smp_cpus;
52
24
- binfo.board_setup_addr = BOARDSETUP_ADDR;
53
- for (i = 0; i < guestfd_array->len; i++) {
25
- binfo.write_board_setup = write_board_setup;
54
+ /* SYS_OPEN should return nonzero handle on success. Start guestfd from 1 */
26
- binfo.secure_board_setup = true;
55
+ for (i = 1; i < guestfd_array->len; i++) {
27
- binfo.secure_boot = true;
56
GuestFD *gf = &g_array_index(guestfd_array, GuestFD, i);
28
+
57
29
+ if (version <= 2) {
58
if (gf->type == GuestFDUnused) {
30
+ /* The rpi1 and 2 require some custom setup code to run in Secure
59
@@ -XXX,XX +XXX,XX @@ static GuestFD *do_get_guestfd(int guestfd)
31
+ * mode before booting a kernel (to set up the SMC vectors so
60
return NULL;
32
+ * that we get a no-op SMC; this is used by Linux to call the
61
}
33
+ * firmware for some cache maintenance operations.
62
34
+ * The rpi3 doesn't need this.
63
- if (guestfd < 0 || guestfd >= guestfd_array->len) {
35
+ */
64
+ if (guestfd <= 0 || guestfd >= guestfd_array->len) {
36
+ binfo.board_setup_addr = BOARDSETUP_ADDR;
65
return NULL;
37
+ binfo.write_board_setup = write_board_setup;
66
}
38
+ binfo.secure_board_setup = true;
67
39
+ binfo.secure_boot = true;
40
+ }
41
42
/* Pi2 and Pi3 requires SMP setup */
43
if (version >= 2) {
44
--
68
--
45
2.16.2
69
2.20.1
46
70
47
71
diff view generated by jsdifflib
New patch
1
1
From: Martin Kaiser <martin@kaiser.cx>
2
3
Add an emulation for the RNGC random number generator and the compatible
4
RNGB variant. These peripherals are included (at least) in imx25 and
5
imx35 chipsets.
6
7
The emulation supports the initial self test, reseeding the prng and
8
reading random numbers.
9
10
Signed-off-by: Martin Kaiser <martin@kaiser.cx>
11
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
---
14
hw/misc/Makefile.objs | 1 +
15
include/hw/arm/fsl-imx25.h | 5 +
16
include/hw/misc/imx_rngc.h | 35 +++++
17
hw/arm/fsl-imx25.c | 11 ++
18
hw/misc/imx_rngc.c | 278 +++++++++++++++++++++++++++++++++++++
19
5 files changed, 330 insertions(+)
20
create mode 100644 include/hw/misc/imx_rngc.h
21
create mode 100644 hw/misc/imx_rngc.c
22
23
diff --git a/hw/misc/Makefile.objs b/hw/misc/Makefile.objs
24
index XXXXXXX..XXXXXXX 100644
25
--- a/hw/misc/Makefile.objs
26
+++ b/hw/misc/Makefile.objs
27
@@ -XXX,XX +XXX,XX @@ common-obj-$(CONFIG_IMX) += imx7_ccm.o
28
common-obj-$(CONFIG_IMX) += imx2_wdt.o
29
common-obj-$(CONFIG_IMX) += imx7_snvs.o
30
common-obj-$(CONFIG_IMX) += imx7_gpr.o
31
+common-obj-$(CONFIG_IMX) += imx_rngc.o
32
common-obj-$(CONFIG_MILKYMIST) += milkymist-hpdmc.o
33
common-obj-$(CONFIG_MILKYMIST) += milkymist-pfpu.o
34
common-obj-$(CONFIG_MAINSTONE) += mst_fpga.o
35
diff --git a/include/hw/arm/fsl-imx25.h b/include/hw/arm/fsl-imx25.h
36
index XXXXXXX..XXXXXXX 100644
37
--- a/include/hw/arm/fsl-imx25.h
38
+++ b/include/hw/arm/fsl-imx25.h
39
@@ -XXX,XX +XXX,XX @@
40
#include "hw/timer/imx_gpt.h"
41
#include "hw/timer/imx_epit.h"
42
#include "hw/net/imx_fec.h"
43
+#include "hw/misc/imx_rngc.h"
44
#include "hw/i2c/imx_i2c.h"
45
#include "hw/gpio/imx_gpio.h"
46
#include "exec/memory.h"
47
@@ -XXX,XX +XXX,XX @@ typedef struct FslIMX25State {
48
IMXGPTState gpt[FSL_IMX25_NUM_GPTS];
49
IMXEPITState epit[FSL_IMX25_NUM_EPITS];
50
IMXFECState fec;
51
+ IMXRNGCState rngc;
52
IMXI2CState i2c[FSL_IMX25_NUM_I2CS];
53
IMXGPIOState gpio[FSL_IMX25_NUM_GPIOS];
54
MemoryRegion rom[2];
55
@@ -XXX,XX +XXX,XX @@ typedef struct FslIMX25State {
56
#define FSL_IMX25_GPIO4_SIZE 0x4000
57
#define FSL_IMX25_GPIO3_ADDR 0x53FA4000
58
#define FSL_IMX25_GPIO3_SIZE 0x4000
59
+#define FSL_IMX25_RNGC_ADDR 0x53FB0000
60
+#define FSL_IMX25_RNGC_SIZE 0x4000
61
#define FSL_IMX25_GPIO1_ADDR 0x53FCC000
62
#define FSL_IMX25_GPIO1_SIZE 0x4000
63
#define FSL_IMX25_GPIO2_ADDR 0x53FD0000
64
@@ -XXX,XX +XXX,XX @@ typedef struct FslIMX25State {
65
#define FSL_IMX25_EPIT1_IRQ 28
66
#define FSL_IMX25_EPIT2_IRQ 27
67
#define FSL_IMX25_FEC_IRQ 57
68
+#define FSL_IMX25_RNGC_IRQ 22
69
#define FSL_IMX25_I2C1_IRQ 3
70
#define FSL_IMX25_I2C2_IRQ 4
71
#define FSL_IMX25_I2C3_IRQ 10
72
diff --git a/include/hw/misc/imx_rngc.h b/include/hw/misc/imx_rngc.h
73
new file mode 100644
74
index XXXXXXX..XXXXXXX
75
--- /dev/null
76
+++ b/include/hw/misc/imx_rngc.h
77
@@ -XXX,XX +XXX,XX @@
78
+/*
79
+ * Freescale i.MX RNGC emulation
80
+ *
81
+ * Copyright (C) 2020 Martin Kaiser <martin@kaiser.cx>
82
+ *
83
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
84
+ * See the COPYING file in the top-level directory.
85
+ */
86
+
87
+#ifndef IMX_RNGC_H
88
+#define IMX_RNGC_H
89
+
90
+#include "hw/sysbus.h"
91
+
92
+#define TYPE_IMX_RNGC "imx.rngc"
93
+#define IMX_RNGC(obj) OBJECT_CHECK(IMXRNGCState, (obj), TYPE_IMX_RNGC)
94
+
95
+typedef struct IMXRNGCState {
96
+ /*< private >*/
97
+ SysBusDevice parent_obj;
98
+
99
+ /*< public >*/
100
+ MemoryRegion iomem;
101
+
102
+ uint8_t op_self_test;
103
+ uint8_t op_seed;
104
+ uint8_t mask;
105
+ bool auto_seed;
106
+
107
+ QEMUBH *self_test_bh;
108
+ QEMUBH *seed_bh;
109
+ qemu_irq irq;
110
+} IMXRNGCState;
111
+
112
+#endif /* IMX_RNGC_H */
113
diff --git a/hw/arm/fsl-imx25.c b/hw/arm/fsl-imx25.c
114
index XXXXXXX..XXXXXXX 100644
115
--- a/hw/arm/fsl-imx25.c
116
+++ b/hw/arm/fsl-imx25.c
117
@@ -XXX,XX +XXX,XX @@ static void fsl_imx25_init(Object *obj)
118
119
sysbus_init_child_obj(obj, "fec", &s->fec, sizeof(s->fec), TYPE_IMX_FEC);
120
121
+ sysbus_init_child_obj(obj, "rngc", &s->rngc, sizeof(s->rngc),
122
+ TYPE_IMX_RNGC);
123
+
124
for (i = 0; i < FSL_IMX25_NUM_I2CS; i++) {
125
sysbus_init_child_obj(obj, "i2c[*]", &s->i2c[i], sizeof(s->i2c[i]),
126
TYPE_IMX_I2C);
127
@@ -XXX,XX +XXX,XX @@ static void fsl_imx25_realize(DeviceState *dev, Error **errp)
128
sysbus_connect_irq(SYS_BUS_DEVICE(&s->fec), 0,
129
qdev_get_gpio_in(DEVICE(&s->avic), FSL_IMX25_FEC_IRQ));
130
131
+ object_property_set_bool(OBJECT(&s->rngc), true, "realized", &err);
132
+ if (err) {
133
+ error_propagate(errp, err);
134
+ return;
135
+ }
136
+ sysbus_mmio_map(SYS_BUS_DEVICE(&s->rngc), 0, FSL_IMX25_RNGC_ADDR);
137
+ sysbus_connect_irq(SYS_BUS_DEVICE(&s->rngc), 0,
138
+ qdev_get_gpio_in(DEVICE(&s->avic), FSL_IMX25_RNGC_IRQ));
139
140
/* Initialize all I2C */
141
for (i = 0; i < FSL_IMX25_NUM_I2CS; i++) {
142
diff --git a/hw/misc/imx_rngc.c b/hw/misc/imx_rngc.c
143
new file mode 100644
144
index XXXXXXX..XXXXXXX
145
--- /dev/null
146
+++ b/hw/misc/imx_rngc.c
147
@@ -XXX,XX +XXX,XX @@
148
+/*
149
+ * Freescale i.MX RNGC emulation
150
+ *
151
+ * Copyright (C) 2020 Martin Kaiser <martin@kaiser.cx>
152
+ *
153
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
154
+ * See the COPYING file in the top-level directory.
155
+ *
156
+ * This driver provides the minimum functionality to initialize and seed
157
+ * an rngc and to read random numbers. The rngb that is found in imx25
158
+ * chipsets is also supported.
159
+ */
160
+
161
+#include "qemu/osdep.h"
162
+#include "qemu/main-loop.h"
163
+#include "qemu/module.h"
164
+#include "qemu/log.h"
165
+#include "qemu/guest-random.h"
166
+#include "hw/irq.h"
167
+#include "hw/misc/imx_rngc.h"
168
+#include "migration/vmstate.h"
169
+
170
+#define RNGC_NAME "i.MX RNGC"
171
+
172
+#define RNGC_VER_ID 0x00
173
+#define RNGC_COMMAND 0x04
174
+#define RNGC_CONTROL 0x08
175
+#define RNGC_STATUS 0x0C
176
+#define RNGC_FIFO 0x14
177
+
178
+/* These version info are reported by the rngb in an imx258 chip. */
179
+#define RNG_TYPE_RNGB 0x1
180
+#define V_MAJ 0x2
181
+#define V_MIN 0x40
182
+
183
+#define RNGC_CMD_BIT_SW_RST 0x40
184
+#define RNGC_CMD_BIT_CLR_ERR 0x20
185
+#define RNGC_CMD_BIT_CLR_INT 0x10
186
+#define RNGC_CMD_BIT_SEED 0x02
187
+#define RNGC_CMD_BIT_SELF_TEST 0x01
188
+
189
+#define RNGC_CTRL_BIT_MASK_ERR 0x40
190
+#define RNGC_CTRL_BIT_MASK_DONE 0x20
191
+#define RNGC_CTRL_BIT_AUTO_SEED 0x10
192
+
193
+/* the current status for self-test and seed operations */
194
+#define OP_IDLE 0
195
+#define OP_RUN 1
196
+#define OP_DONE 2
197
+
198
+static uint64_t imx_rngc_read(void *opaque, hwaddr offset, unsigned size)
199
+{
200
+ IMXRNGCState *s = IMX_RNGC(opaque);
201
+ uint64_t val = 0;
202
+
203
+ switch (offset) {
204
+ case RNGC_VER_ID:
205
+ val |= RNG_TYPE_RNGB << 28 | V_MAJ << 8 | V_MIN;
206
+ break;
207
+
208
+ case RNGC_COMMAND:
209
+ if (s->op_seed == OP_RUN) {
210
+ val |= RNGC_CMD_BIT_SEED;
211
+ }
212
+ if (s->op_self_test == OP_RUN) {
213
+ val |= RNGC_CMD_BIT_SELF_TEST;
214
+ }
215
+ break;
216
+
217
+ case RNGC_CONTROL:
218
+ /*
219
+ * The CTL_ACC and VERIF_MODE bits are not supported yet.
220
+ * They read as 0.
221
+ */
222
+ val |= s->mask;
223
+ if (s->auto_seed) {
224
+ val |= RNGC_CTRL_BIT_AUTO_SEED;
225
+ }
226
+ /*
227
+ * We don't have an internal fifo like the real hardware.
228
+ * There's no need for strategy to handle fifo underflows.
229
+ * We return the FIFO_UFLOW_RESPONSE bits as 0.
230
+ */
231
+ break;
232
+
233
+ case RNGC_STATUS:
234
+ /*
235
+ * We never report any statistics test or self-test errors or any
236
+ * other errors. STAT_TEST_PF, ST_PF and ERROR are always 0.
237
+ */
238
+
239
+ /*
240
+ * We don't have an internal fifo, see above. Therefore, we
241
+ * report back the default fifo size (5 32-bit words) and
242
+ * indicate that our fifo is always full.
243
+ */
244
+ val |= 5 << 12 | 5 << 8;
245
+
246
+ /* We always have a new seed available. */
247
+ val |= 1 << 6;
248
+
249
+ if (s->op_seed == OP_DONE) {
250
+ val |= 1 << 5;
251
+ }
252
+ if (s->op_self_test == OP_DONE) {
253
+ val |= 1 << 4;
254
+ }
255
+ if (s->op_seed == OP_RUN || s->op_self_test == OP_RUN) {
256
+ /*
257
+ * We're busy if self-test is running or if we're
258
+ * seeding the prng.
259
+ */
260
+ val |= 1 << 1;
261
+ } else {
262
+ /*
263
+ * We're ready to provide secure random numbers whenever
264
+ * we're not busy.
265
+ */
266
+ val |= 1;
267
+ }
268
+ break;
269
+
270
+ case RNGC_FIFO:
271
+ qemu_guest_getrandom_nofail(&val, sizeof(val));
272
+ break;
273
+ }
274
+
275
+ return val;
276
+}
277
+
278
+static void imx_rngc_do_reset(IMXRNGCState *s)
279
+{
280
+ s->op_self_test = OP_IDLE;
281
+ s->op_seed = OP_IDLE;
282
+ s->mask = 0;
283
+ s->auto_seed = false;
284
+}
285
+
286
+static void imx_rngc_write(void *opaque, hwaddr offset, uint64_t value,
287
+ unsigned size)
288
+{
289
+ IMXRNGCState *s = IMX_RNGC(opaque);
290
+
291
+ switch (offset) {
292
+ case RNGC_COMMAND:
293
+ if (value & RNGC_CMD_BIT_SW_RST) {
294
+ imx_rngc_do_reset(s);
295
+ }
296
+
297
+ /*
298
+ * For now, both CLR_ERR and CLR_INT clear the interrupt. We
299
+ * don't report any errors yet.
300
+ */
301
+ if (value & (RNGC_CMD_BIT_CLR_ERR | RNGC_CMD_BIT_CLR_INT)) {
302
+ qemu_irq_lower(s->irq);
303
+ }
304
+
305
+ if (value & RNGC_CMD_BIT_SEED) {
306
+ s->op_seed = OP_RUN;
307
+ qemu_bh_schedule(s->seed_bh);
308
+ }
309
+
310
+ if (value & RNGC_CMD_BIT_SELF_TEST) {
311
+ s->op_self_test = OP_RUN;
312
+ qemu_bh_schedule(s->self_test_bh);
313
+ }
314
+ break;
315
+
316
+ case RNGC_CONTROL:
317
+ /*
318
+ * The CTL_ACC and VERIF_MODE bits are not supported yet.
319
+ * We ignore them if they're set by the caller.
320
+ */
321
+
322
+ if (value & RNGC_CTRL_BIT_MASK_ERR) {
323
+ s->mask |= RNGC_CTRL_BIT_MASK_ERR;
324
+ } else {
325
+ s->mask &= ~RNGC_CTRL_BIT_MASK_ERR;
326
+ }
327
+
328
+ if (value & RNGC_CTRL_BIT_MASK_DONE) {
329
+ s->mask |= RNGC_CTRL_BIT_MASK_DONE;
330
+ } else {
331
+ s->mask &= ~RNGC_CTRL_BIT_MASK_DONE;
332
+ }
333
+
334
+ if (value & RNGC_CTRL_BIT_AUTO_SEED) {
335
+ s->auto_seed = true;
336
+ } else {
337
+ s->auto_seed = false;
338
+ }
339
+ break;
340
+ }
341
+}
342
+
343
+static const MemoryRegionOps imx_rngc_ops = {
344
+ .read = imx_rngc_read,
345
+ .write = imx_rngc_write,
346
+ .endianness = DEVICE_NATIVE_ENDIAN,
347
+};
348
+
349
+static void imx_rngc_self_test(void *opaque)
350
+{
351
+ IMXRNGCState *s = IMX_RNGC(opaque);
352
+
353
+ s->op_self_test = OP_DONE;
354
+ if (!(s->mask & RNGC_CTRL_BIT_MASK_DONE)) {
355
+ qemu_irq_raise(s->irq);
356
+ }
357
+}
358
+
359
+static void imx_rngc_seed(void *opaque)
360
+{
361
+ IMXRNGCState *s = IMX_RNGC(opaque);
362
+
363
+ s->op_seed = OP_DONE;
364
+ if (!(s->mask & RNGC_CTRL_BIT_MASK_DONE)) {
365
+ qemu_irq_raise(s->irq);
366
+ }
367
+}
368
+
369
+static void imx_rngc_realize(DeviceState *dev, Error **errp)
370
+{
371
+ IMXRNGCState *s = IMX_RNGC(dev);
372
+ SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
373
+
374
+ memory_region_init_io(&s->iomem, OBJECT(s), &imx_rngc_ops, s,
375
+ TYPE_IMX_RNGC, 0x1000);
376
+ sysbus_init_mmio(sbd, &s->iomem);
377
+
378
+ sysbus_init_irq(sbd, &s->irq);
379
+ s->self_test_bh = qemu_bh_new(imx_rngc_self_test, s);
380
+ s->seed_bh = qemu_bh_new(imx_rngc_seed, s);
381
+}
382
+
383
+static void imx_rngc_reset(DeviceState *dev)
384
+{
385
+ IMXRNGCState *s = IMX_RNGC(dev);
386
+
387
+ imx_rngc_do_reset(s);
388
+}
389
+
390
+static const VMStateDescription vmstate_imx_rngc = {
391
+ .name = RNGC_NAME,
392
+ .version_id = 1,
393
+ .minimum_version_id = 1,
394
+ .fields = (VMStateField[]) {
395
+ VMSTATE_UINT8(op_self_test, IMXRNGCState),
396
+ VMSTATE_UINT8(op_seed, IMXRNGCState),
397
+ VMSTATE_UINT8(mask, IMXRNGCState),
398
+ VMSTATE_BOOL(auto_seed, IMXRNGCState),
399
+ VMSTATE_END_OF_LIST()
400
+ }
401
+};
402
+
403
+static void imx_rngc_class_init(ObjectClass *klass, void *data)
404
+{
405
+ DeviceClass *dc = DEVICE_CLASS(klass);
406
+
407
+ dc->realize = imx_rngc_realize;
408
+ dc->reset = imx_rngc_reset;
409
+ dc->desc = RNGC_NAME,
410
+ dc->vmsd = &vmstate_imx_rngc;
411
+}
412
+
413
+static const TypeInfo imx_rngc_info = {
414
+ .name = TYPE_IMX_RNGC,
415
+ .parent = TYPE_SYS_BUS_DEVICE,
416
+ .instance_size = sizeof(IMXRNGCState),
417
+ .class_init = imx_rngc_class_init,
418
+};
419
+
420
+static void imx_rngc_register_types(void)
421
+{
422
+ type_register_static(&imx_rngc_info);
423
+}
424
+
425
+type_init(imx_rngc_register_types)
426
--
427
2.20.1
428
429
diff view generated by jsdifflib
1
From: Wei Huang <wei@redhat.com>
1
From: Jeff Kubascik <jeff.kubascik@dornerworks.com>
2
2
3
For guest kernel that supports KASLR, the load address can change every
3
The wfi instruction can be configured to be trapped by a higher exception
4
time when guest VM runs. To find the physical base address correctly,
4
level, such as the EL2 hypervisor. When the instruction is trapped, the
5
current QEMU dump searches VMCOREINFO for the string "NUMBER(phys_base)=".
5
program counter should contain the address of the wfi instruction that
6
However this string pattern is only available on x86_64. AArch64 uses a
6
caused the exception. The program counter is adjusted for this in the wfi op
7
different field, called "NUMBER(PHYS_OFFSET)=". This patch makes sure
7
helper function.
8
QEMU dump uses the correct string on AArch64.
9
8
10
Signed-off-by: Wei Huang <wei@redhat.com>
9
However, this correction is done to env->pc, which only applies to AArch64
11
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
10
mode. For AArch32, the program counter is stored in env->regs[15]. This
12
Message-id: 1520615003-20869-1-git-send-email-wei@redhat.com
11
adds an if-else statement to modify the correct program counter location
12
based on the the current CPU mode.
13
14
Signed-off-by: Jeff Kubascik <jeff.kubascik@dornerworks.com>
15
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
13
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
16
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
14
---
17
---
15
dump.c | 14 +++++++++++---
18
target/arm/op_helper.c | 7 ++++++-
16
1 file changed, 11 insertions(+), 3 deletions(-)
19
1 file changed, 6 insertions(+), 1 deletion(-)
17
20
18
diff --git a/dump.c b/dump.c
21
diff --git a/target/arm/op_helper.c b/target/arm/op_helper.c
19
index XXXXXXX..XXXXXXX 100644
22
index XXXXXXX..XXXXXXX 100644
20
--- a/dump.c
23
--- a/target/arm/op_helper.c
21
+++ b/dump.c
24
+++ b/target/arm/op_helper.c
22
@@ -XXX,XX +XXX,XX @@ static void vmcoreinfo_update_phys_base(DumpState *s)
25
@@ -XXX,XX +XXX,XX @@ void HELPER(wfi)(CPUARMState *env, uint32_t insn_len)
23
26
}
24
lines = g_strsplit((char *)vmci, "\n", -1);
27
25
for (i = 0; lines[i]; i++) {
28
if (target_el) {
26
- if (g_str_has_prefix(lines[i], "NUMBER(phys_base)=")) {
29
- env->pc -= insn_len;
27
- if (qemu_strtou64(lines[i] + 18, NULL, 16,
30
+ if (env->aarch64) {
28
+ const char *prefix = NULL;
31
+ env->pc -= insn_len;
29
+
32
+ } else {
30
+ if (s->dump_info.d_machine == EM_X86_64) {
33
+ env->regs[15] -= insn_len;
31
+ prefix = "NUMBER(phys_base)=";
32
+ } else if (s->dump_info.d_machine == EM_AARCH64) {
33
+ prefix = "NUMBER(PHYS_OFFSET)=";
34
+ }
34
+ }
35
+
35
+
36
+ if (prefix && g_str_has_prefix(lines[i], prefix)) {
36
raise_exception(env, EXCP_UDEF, syn_wfx(1, 0xe, 0, insn_len == 2),
37
+ if (qemu_strtou64(lines[i] + strlen(prefix), NULL, 16,
37
target_el);
38
&phys_base) < 0) {
38
}
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
--
39
--
45
2.16.2
40
2.20.1
46
41
47
42
diff view generated by jsdifflib
1
From: Andrey Smirnov <andrew.smirnov@gmail.com>
1
From: Jeff Kubascik <jeff.kubascik@dornerworks.com>
2
2
3
Code of imx_update() is slightly confusing since the "flags" variable
3
The IAR0/IAR1 register is used to acknowledge an interrupt - a read of the
4
doesn't really corespond to anything in real hardware and server as a
4
register activates the highest priority pending interrupt and provides its
5
kitchensink accumulating events normally reported via USR1 and USR2
5
interrupt ID. Activating an interrupt can change the CPU's virtual interrupt
6
registers.
6
state - this change makes sure the virtual irq state is updated.
7
7
8
Change the code to explicitly evaluate state of interrupts reported
8
Signed-off-by: Jeff Kubascik <jeff.kubascik@dornerworks.com>
9
via USR1 and USR2 against corresponding masking bits and use the to
9
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
10
detemine if IRQ line should be asserted or not.
10
Message-id: 20200113154607.97032-1-jeff.kubascik@dornerworks.com
11
12
NOTE: Check for UTS1_TXEMPTY being set has been dropped for two
13
reasons:
14
15
1. Emulation code implements a single character FIFO, so this flag
16
will always be set since characters are trasmitted as a part of
17
the code emulating "push" into the FIFO
18
19
2. imx_update() is really just a function doing ORing and maksing
20
of reported events, so checking for UTS1_TXEMPTY should happen,
21
if it's ever really needed should probably happen outside of
22
it.
23
24
Cc: qemu-devel@nongnu.org
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>
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
32
---
12
---
33
hw/char/imx_serial.c | 24 ++++++++++++++++--------
13
hw/intc/arm_gicv3_cpuif.c | 3 +++
34
1 file changed, 16 insertions(+), 8 deletions(-)
14
1 file changed, 3 insertions(+)
35
15
36
diff --git a/hw/char/imx_serial.c b/hw/char/imx_serial.c
16
diff --git a/hw/intc/arm_gicv3_cpuif.c b/hw/intc/arm_gicv3_cpuif.c
37
index XXXXXXX..XXXXXXX 100644
17
index XXXXXXX..XXXXXXX 100644
38
--- a/hw/char/imx_serial.c
18
--- a/hw/intc/arm_gicv3_cpuif.c
39
+++ b/hw/char/imx_serial.c
19
+++ b/hw/intc/arm_gicv3_cpuif.c
40
@@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_imx_serial = {
20
@@ -XXX,XX +XXX,XX @@ static uint64_t icv_iar_read(CPUARMState *env, const ARMCPRegInfo *ri)
41
21
42
static void imx_update(IMXSerialState *s)
22
trace_gicv3_icv_iar_read(ri->crm == 8 ? 0 : 1,
43
{
23
gicv3_redist_affid(cs), intid);
44
- uint32_t flags;
24
+
45
+ uint32_t usr1;
25
+ gicv3_cpuif_virt_update(cs);
46
+ uint32_t usr2;
26
+
47
+ uint32_t mask;
27
return intid;
48
49
- flags = (s->usr1 & s->ucr1) & (USR1_TRDY|USR1_RRDY);
50
- if (s->ucr1 & UCR1_TXMPTYEN) {
51
- flags |= (s->uts1 & UTS1_TXEMPTY);
52
- } else {
53
- flags &= ~USR1_TRDY;
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
}
28
}
71
29
72
static void imx_serial_reset(IMXSerialState *s)
73
--
30
--
74
2.16.2
31
2.20.1
75
32
76
33
diff view generated by jsdifflib
1
From: Guenter Roeck <linux@roeck-us.net>
1
From: Jeff Kubascik <jeff.kubascik@dornerworks.com>
2
2
3
The sabrelite machine model used by qemu-system-arm is based on the
3
The IL bit is set for 32-bit instructions, thus passing false
4
Freescale/NXP i.MX6Q processor. This SoC has an on-board ethernet
4
with the is_16bit parameter to syn_data_abort_with_iss() makes
5
controller which is supported in QEMU using the imx_fec.c module
5
a syn mask that always has the IL bit set.
6
(actually called imx.enet for this model.)
7
6
8
The include/hw/arm/fsm-imx6.h file defines the interrupt vectors for the
7
Pass is_16bit as true to make the initial syn mask have IL=0,
9
imx.enet device like this:
8
so that the final IL value comes from or'ing template_syn.
10
9
11
#define FSL_IMX6_ENET_MAC_1588_IRQ 118
10
Cc: qemu-stable@nongnu.org
12
#define FSL_IMX6_ENET_MAC_IRQ 119
11
Fixes: aaa1f954d4ca ("target-arm: A64: Create Instruction Syndromes for Data Aborts")
13
12
Signed-off-by: Jeff Kubascik <jeff.kubascik@dornerworks.com>
14
According to https://www.nxp.com/docs/en/reference-manual/IMX6DQRM.pdf,
13
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
15
page 225, in Table 3-1. ARM Cortex A9 domain interrupt summary,
14
Message-id: 20200117004618.2742-2-richard.henderson@linaro.org
16
interrupts are as follows.
15
[rth: Extracted this as a self-contained bug fix from a larger patch]
17
16
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
18
150 ENET MAC 0 IRQ
19
151 ENET MAC 0 1588 Timer interrupt
20
21
where
22
23
150 - 32 == 118
24
151 - 32 == 119
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>
17
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
42
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
18
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
43
---
19
---
44
include/hw/arm/fsl-imx6.h | 4 ++--
20
target/arm/tlb_helper.c | 2 +-
45
hw/net/imx_fec.c | 28 +++++++++++++++++++++++++++-
21
1 file changed, 1 insertion(+), 1 deletion(-)
46
2 files changed, 29 insertions(+), 3 deletions(-)
47
22
48
diff --git a/include/hw/arm/fsl-imx6.h b/include/hw/arm/fsl-imx6.h
23
diff --git a/target/arm/tlb_helper.c b/target/arm/tlb_helper.c
49
index XXXXXXX..XXXXXXX 100644
24
index XXXXXXX..XXXXXXX 100644
50
--- a/include/hw/arm/fsl-imx6.h
25
--- a/target/arm/tlb_helper.c
51
+++ b/include/hw/arm/fsl-imx6.h
26
+++ b/target/arm/tlb_helper.c
52
@@ -XXX,XX +XXX,XX @@ typedef struct FslIMX6State {
27
@@ -XXX,XX +XXX,XX @@ static inline uint32_t merge_syn_data_abort(uint32_t template_syn,
53
#define FSL_IMX6_HDMI_MASTER_IRQ 115
28
syn = syn_data_abort_with_iss(same_el,
54
#define FSL_IMX6_HDMI_CEC_IRQ 116
29
0, 0, 0, 0, 0,
55
#define FSL_IMX6_MLB150_LOW_IRQ 117
30
ea, 0, s1ptw, is_write, fsc,
56
-#define FSL_IMX6_ENET_MAC_1588_IRQ 118
31
- false);
57
-#define FSL_IMX6_ENET_MAC_IRQ 119
32
+ true);
58
+#define FSL_IMX6_ENET_MAC_IRQ 118
33
/* Merge the runtime syndrome with the template syndrome. */
59
+#define FSL_IMX6_ENET_MAC_1588_IRQ 119
34
syn |= template_syn;
60
#define FSL_IMX6_PCIE1_IRQ 120
35
}
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
65
--- a/hw/net/imx_fec.c
66
+++ b/hw/net/imx_fec.c
67
@@ -XXX,XX +XXX,XX @@ static void imx_enet_write_bd(IMXENETBufDesc *bd, dma_addr_t addr)
68
69
static void imx_eth_update(IMXFECState *s)
70
{
71
- if (s->regs[ENET_EIR] & s->regs[ENET_EIMR] & ENET_INT_TS_TIMER) {
72
+ /*
73
+ * Previous versions of qemu had the ENET_INT_MAC and ENET_INT_TS_TIMER
74
+ * interrupts swapped. This worked with older versions of Linux (4.14
75
+ * and older) since Linux associated both interrupt lines with Ethernet
76
+ * MAC interrupts. Specifically,
77
+ * - Linux 4.15 and later have separate interrupt handlers for the MAC and
78
+ * timer interrupts. Those versions of Linux fail with versions of QEMU
79
+ * with swapped interrupt assignments.
80
+ * - In linux 4.14, both interrupt lines were registered with the Ethernet
81
+ * MAC interrupt handler. As a result, all versions of qemu happen to
82
+ * work, though that is accidental.
83
+ * - In Linux 4.9 and older, the timer interrupt was registered directly
84
+ * with the Ethernet MAC interrupt handler. The MAC interrupt was
85
+ * redirected to a GPIO interrupt to work around erratum ERR006687.
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
--
36
--
103
2.16.2
37
2.20.1
104
38
105
39
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
During the conversion to decodetree, the setting of
4
it is needed to support guests other than Linux.
4
ISSIs16Bit got lost. This causes the guest os to
5
incorrectly adjust trapping memory operations.
5
6
6
Based on the patch by Bill Paul as found here:
7
Cc: qemu-stable@nongnu.org
7
https://bugs.launchpad.net/qemu/+bug/1753314
8
Fixes: 46beb58efbb8a2a32 ("target/arm: Convert T16, load (literal)")
8
9
Reported-by: Jeff Kubascik <jeff.kubascik@dornerworks.com>
9
Cc: qemu-devel@nongnu.org
10
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
10
Cc: qemu-arm@nongnu.org
11
Message-id: 20200117004618.2742-3-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>
12
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
17
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
18
---
14
---
19
include/hw/char/imx_serial.h | 3 +++
15
target/arm/translate.c | 3 +++
20
hw/char/imx_serial.c | 20 +++++++++++++++++---
16
1 file changed, 3 insertions(+)
21
2 files changed, 20 insertions(+), 3 deletions(-)
22
17
23
diff --git a/include/hw/char/imx_serial.h b/include/hw/char/imx_serial.h
18
diff --git a/target/arm/translate.c b/target/arm/translate.c
24
index XXXXXXX..XXXXXXX 100644
19
index XXXXXXX..XXXXXXX 100644
25
--- a/include/hw/char/imx_serial.h
20
--- a/target/arm/translate.c
26
+++ b/include/hw/char/imx_serial.h
21
+++ b/target/arm/translate.c
27
@@ -XXX,XX +XXX,XX @@
22
@@ -XXX,XX +XXX,XX @@ static ISSInfo make_issinfo(DisasContext *s, int rd, bool p, bool w)
28
#define UCR2_RXEN (1<<1) /* Receiver enable */
23
/* ISS not valid if writeback */
29
#define UCR2_SRST (1<<0) /* Reset complete */
24
if (p && !w) {
30
25
ret = rd;
31
+#define UCR4_TCEN BIT(3) /* TX complete interrupt enable */
26
+ if (s->base.pc_next - s->pc_curr == 2) {
32
+
27
+ ret |= ISSIs16Bit;
33
#define UTS1_TXEMPTY (1<<6)
28
+ }
34
#define UTS1_RXEMPTY (1<<5)
29
} else {
35
#define UTS1_TXFULL (1<<4)
30
ret = ISSInvalid;
36
@@ -XXX,XX +XXX,XX @@ typedef struct IMXSerialState {
31
}
37
uint32_t ubmr;
38
uint32_t ubrc;
39
uint32_t ucr3;
40
+ uint32_t ucr4;
41
42
qemu_irq irq;
43
CharBackend chr;
44
diff --git a/hw/char/imx_serial.c b/hw/char/imx_serial.c
45
index XXXXXXX..XXXXXXX 100644
46
--- a/hw/char/imx_serial.c
47
+++ b/hw/char/imx_serial.c
48
@@ -XXX,XX +XXX,XX @@
49
50
static const VMStateDescription vmstate_imx_serial = {
51
.name = TYPE_IMX_SERIAL,
52
- .version_id = 1,
53
- .minimum_version_id = 1,
54
+ .version_id = 2,
55
+ .minimum_version_id = 2,
56
.fields = (VMStateField[]) {
57
VMSTATE_INT32(readbuff, IMXSerialState),
58
VMSTATE_UINT32(usr1, IMXSerialState),
59
@@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_imx_serial = {
60
VMSTATE_UINT32(ubmr, IMXSerialState),
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
--
32
--
114
2.16.2
33
2.20.1
115
34
116
35
diff view generated by jsdifflib