1 | Arm patches for rc3 : just a handful of bug fixes. | 1 | Last handful of arm patches before softfreeze... |
---|---|---|---|
2 | 2 | ||
3 | thanks | 3 | The following changes since commit a98135f727595382e200d04c2996e868b7925a01: |
4 | -- PMM | ||
5 | 4 | ||
6 | 5 | Merge remote-tracking branch 'remotes/kraxel/tags/vga-20200316-pull-request' into staging (2020-03-16 14:55:59 +0000) | |
7 | The following changes since commit 4ecc984210ca1bf508a96a550ec8a93a5f833f6c: | ||
8 | |||
9 | Merge remote-tracking branch 'remotes/palmer/tags/riscv-for-master-4.2-rc3' into staging (2019-11-26 12:36:40 +0000) | ||
10 | 6 | ||
11 | are available in the Git repository at: | 7 | are available in the Git repository at: |
12 | 8 | ||
13 | https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20191126 | 9 | https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20200317 |
14 | 10 | ||
15 | for you to fetch changes up to 6a4ef4e5d1084ce41fafa7d470a644b0fd3d9317: | 11 | for you to fetch changes up to e88d3671e3bbd59d385838a4101ea19cdcf47309: |
16 | 12 | ||
17 | target/arm: Honor HCR_EL2.TID3 trapping requirements (2019-11-26 13:55:37 +0000) | 13 | hw/arm/pxa2xx: Do not wire up OHCI for PXA255 (2020-03-17 11:36:48 +0000) |
18 | 14 | ||
19 | ---------------------------------------------------------------- | 15 | ---------------------------------------------------------------- |
20 | target-arm queue: | 16 | target-arm: |
21 | * handle FTYPE flag correctly in v7M exception return | 17 | * hw/arm/pxa2xx: Do not wire up OHCI for PXA255 |
22 | for v7M CPUs with an FPU (v8M CPUs were already correct) | 18 | * aspeed/smc: Fix number of dummy cycles for FAST_READ_4 command |
23 | * versal: Add the CRP as unimplemented | 19 | * m25p80: Improve command handling for Jedec and unsupported commands |
24 | * Fix ISR_EL1 tracking when executing at EL2 | 20 | * hw/net/imx_fec: write TGSR and TCSR3 in imx_enet_write() |
25 | * Honor HCR_EL2.TID3 trapping requirements | 21 | * hw/arm/fsl-imx6, imx6ul: Wire up USB controllers |
22 | * hw/arm/fsl-imx6ul: Instantiate unimplemented pwm and can devices | ||
26 | 23 | ||
27 | ---------------------------------------------------------------- | 24 | ---------------------------------------------------------------- |
28 | Edgar E. Iglesias (1): | 25 | Chen Qun (1): |
29 | hw/arm: versal: Add the CRP as unimplemented | 26 | hw/net/imx_fec: write TGSR and TCSR3 in imx_enet_write() |
30 | 27 | ||
31 | Jean-Hugues Deschênes (1): | 28 | Guenter Roeck (10): |
32 | target/arm: Fix handling of cortex-m FTYPE flag in EXCRET | 29 | hw/usb: Add basic i.MX USB Phy support |
30 | hw/arm/fsl-imx6ul: Fix USB interrupt numbers | ||
31 | hw/arm/fsl-imx6ul: Instantiate unimplemented pwm and can devices | ||
32 | hw/arm/fsl-imx6ul: Wire up USB controllers | ||
33 | hw/arm/fsl-imx6: Wire up USB controllers | ||
34 | m25p80: Convert to support tracing | ||
35 | m25p80: Improve command handling for Jedec commands | ||
36 | m25p80: Improve command handling for unsupported commands | ||
37 | aspeed/smc: Fix number of dummy cycles for FAST_READ_4 command | ||
38 | hw/arm/pxa2xx: Do not wire up OHCI for PXA255 | ||
33 | 39 | ||
34 | Marc Zyngier (2): | 40 | hw/usb/Makefile.objs | 2 + |
35 | target/arm: Fix ISR_EL1 tracking when executing at EL2 | 41 | include/hw/arm/fsl-imx6.h | 6 ++ |
36 | target/arm: Honor HCR_EL2.TID3 trapping requirements | 42 | include/hw/arm/fsl-imx6ul.h | 16 ++- |
43 | include/hw/usb/imx-usb-phy.h | 53 ++++++++++ | ||
44 | hw/arm/fsl-imx6.c | 36 +++++++ | ||
45 | hw/arm/fsl-imx6ul.c | 49 ++++++++++ | ||
46 | hw/arm/pxa2xx.c | 3 - | ||
47 | hw/block/m25p80.c | 58 +++++------ | ||
48 | hw/net/imx_fec.c | 6 +- | ||
49 | hw/ssi/aspeed_smc.c | 2 +- | ||
50 | hw/usb/imx-usb-phy.c | 225 +++++++++++++++++++++++++++++++++++++++++++ | ||
51 | MAINTAINERS | 2 + | ||
52 | hw/arm/Kconfig | 1 + | ||
53 | hw/block/trace-events | 16 +++ | ||
54 | hw/usb/Kconfig | 5 + | ||
55 | 15 files changed, 444 insertions(+), 36 deletions(-) | ||
56 | create mode 100644 include/hw/usb/imx-usb-phy.h | ||
57 | create mode 100644 hw/usb/imx-usb-phy.c | ||
37 | 58 | ||
38 | include/hw/arm/xlnx-versal.h | 3 ++ | ||
39 | hw/arm/xlnx-versal.c | 2 ++ | ||
40 | target/arm/helper.c | 83 ++++++++++++++++++++++++++++++++++++++++++-- | ||
41 | target/arm/m_helper.c | 7 ++-- | ||
42 | 4 files changed, 89 insertions(+), 6 deletions(-) | ||
43 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | 1 | From: Guenter Roeck <linux@roeck-us.net> | |
2 | |||
3 | Add basic USB PHY support as implemented in i.MX23, i.MX28, i.MX6, | ||
4 | and i.MX7 SoCs. | ||
5 | |||
6 | The only support really needed - at least to boot Linux - is support | ||
7 | for soft reset, which needs to reset various registers to their initial | ||
8 | value. Otherwise, just record register values. | ||
9 | |||
10 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
11 | Signed-off-by: Guenter Roeck <linux@roeck-us.net> | ||
12 | Message-id: 20200313014551.12554-2-linux@roeck-us.net | ||
13 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
14 | --- | ||
15 | hw/usb/Makefile.objs | 2 + | ||
16 | include/hw/usb/imx-usb-phy.h | 53 +++++++++ | ||
17 | hw/usb/imx-usb-phy.c | 225 +++++++++++++++++++++++++++++++++++ | ||
18 | MAINTAINERS | 2 + | ||
19 | hw/arm/Kconfig | 1 + | ||
20 | hw/usb/Kconfig | 5 + | ||
21 | 6 files changed, 288 insertions(+) | ||
22 | create mode 100644 include/hw/usb/imx-usb-phy.h | ||
23 | create mode 100644 hw/usb/imx-usb-phy.c | ||
24 | |||
25 | diff --git a/hw/usb/Makefile.objs b/hw/usb/Makefile.objs | ||
26 | index XXXXXXX..XXXXXXX 100644 | ||
27 | --- a/hw/usb/Makefile.objs | ||
28 | +++ b/hw/usb/Makefile.objs | ||
29 | @@ -XXX,XX +XXX,XX @@ common-obj-$(CONFIG_XEN) += xen-usb.o | ||
30 | xen-usb.o-cflags := $(LIBUSB_CFLAGS) | ||
31 | xen-usb.o-libs := $(LIBUSB_LIBS) | ||
32 | endif | ||
33 | + | ||
34 | +common-obj-$(CONFIG_IMX_USBPHY) += imx-usb-phy.o | ||
35 | diff --git a/include/hw/usb/imx-usb-phy.h b/include/hw/usb/imx-usb-phy.h | ||
36 | new file mode 100644 | ||
37 | index XXXXXXX..XXXXXXX | ||
38 | --- /dev/null | ||
39 | +++ b/include/hw/usb/imx-usb-phy.h | ||
40 | @@ -XXX,XX +XXX,XX @@ | ||
41 | +#ifndef IMX_USB_PHY_H | ||
42 | +#define IMX_USB_PHY_H | ||
43 | + | ||
44 | +#include "hw/sysbus.h" | ||
45 | +#include "qemu/bitops.h" | ||
46 | + | ||
47 | +enum IMXUsbPhyRegisters { | ||
48 | + USBPHY_PWD, | ||
49 | + USBPHY_PWD_SET, | ||
50 | + USBPHY_PWD_CLR, | ||
51 | + USBPHY_PWD_TOG, | ||
52 | + USBPHY_TX, | ||
53 | + USBPHY_TX_SET, | ||
54 | + USBPHY_TX_CLR, | ||
55 | + USBPHY_TX_TOG, | ||
56 | + USBPHY_RX, | ||
57 | + USBPHY_RX_SET, | ||
58 | + USBPHY_RX_CLR, | ||
59 | + USBPHY_RX_TOG, | ||
60 | + USBPHY_CTRL, | ||
61 | + USBPHY_CTRL_SET, | ||
62 | + USBPHY_CTRL_CLR, | ||
63 | + USBPHY_CTRL_TOG, | ||
64 | + USBPHY_STATUS, | ||
65 | + USBPHY_DEBUG = 0x14, | ||
66 | + USBPHY_DEBUG_SET, | ||
67 | + USBPHY_DEBUG_CLR, | ||
68 | + USBPHY_DEBUG_TOG, | ||
69 | + USBPHY_DEBUG0_STATUS, | ||
70 | + USBPHY_DEBUG1 = 0x1c, | ||
71 | + USBPHY_DEBUG1_SET, | ||
72 | + USBPHY_DEBUG1_CLR, | ||
73 | + USBPHY_DEBUG1_TOG, | ||
74 | + USBPHY_VERSION, | ||
75 | + USBPHY_MAX | ||
76 | +}; | ||
77 | + | ||
78 | +#define USBPHY_CTRL_SFTRST BIT(31) | ||
79 | + | ||
80 | +#define TYPE_IMX_USBPHY "imx.usbphy" | ||
81 | +#define IMX_USBPHY(obj) OBJECT_CHECK(IMXUSBPHYState, (obj), TYPE_IMX_USBPHY) | ||
82 | + | ||
83 | +typedef struct IMXUSBPHYState { | ||
84 | + /* <private> */ | ||
85 | + SysBusDevice parent_obj; | ||
86 | + | ||
87 | + /* <public> */ | ||
88 | + MemoryRegion iomem; | ||
89 | + | ||
90 | + uint32_t usbphy[USBPHY_MAX]; | ||
91 | +} IMXUSBPHYState; | ||
92 | + | ||
93 | +#endif /* IMX_USB_PHY_H */ | ||
94 | diff --git a/hw/usb/imx-usb-phy.c b/hw/usb/imx-usb-phy.c | ||
95 | new file mode 100644 | ||
96 | index XXXXXXX..XXXXXXX | ||
97 | --- /dev/null | ||
98 | +++ b/hw/usb/imx-usb-phy.c | ||
99 | @@ -XXX,XX +XXX,XX @@ | ||
100 | +/* | ||
101 | + * i.MX USB PHY | ||
102 | + * | ||
103 | + * Copyright (c) 2020 Guenter Roeck <linux@roeck-us.net> | ||
104 | + * | ||
105 | + * This work is licensed under the terms of the GNU GPL, version 2 or later. | ||
106 | + * See the COPYING file in the top-level directory. | ||
107 | + * | ||
108 | + * We need to implement basic reset control in the PHY control register. | ||
109 | + * For everything else, it is sufficient to set whatever is written. | ||
110 | + */ | ||
111 | + | ||
112 | +#include "qemu/osdep.h" | ||
113 | +#include "hw/usb/imx-usb-phy.h" | ||
114 | +#include "migration/vmstate.h" | ||
115 | +#include "qemu/log.h" | ||
116 | +#include "qemu/module.h" | ||
117 | + | ||
118 | +static const VMStateDescription vmstate_imx_usbphy = { | ||
119 | + .name = TYPE_IMX_USBPHY, | ||
120 | + .version_id = 1, | ||
121 | + .minimum_version_id = 1, | ||
122 | + .fields = (VMStateField[]) { | ||
123 | + VMSTATE_UINT32_ARRAY(usbphy, IMXUSBPHYState, USBPHY_MAX), | ||
124 | + VMSTATE_END_OF_LIST() | ||
125 | + }, | ||
126 | +}; | ||
127 | + | ||
128 | +static void imx_usbphy_softreset(IMXUSBPHYState *s) | ||
129 | +{ | ||
130 | + s->usbphy[USBPHY_PWD] = 0x001e1c00; | ||
131 | + s->usbphy[USBPHY_TX] = 0x10060607; | ||
132 | + s->usbphy[USBPHY_RX] = 0x00000000; | ||
133 | + s->usbphy[USBPHY_CTRL] = 0xc0200000; | ||
134 | +} | ||
135 | + | ||
136 | +static void imx_usbphy_reset(DeviceState *dev) | ||
137 | +{ | ||
138 | + IMXUSBPHYState *s = IMX_USBPHY(dev); | ||
139 | + | ||
140 | + s->usbphy[USBPHY_STATUS] = 0x00000000; | ||
141 | + s->usbphy[USBPHY_DEBUG] = 0x7f180000; | ||
142 | + s->usbphy[USBPHY_DEBUG0_STATUS] = 0x00000000; | ||
143 | + s->usbphy[USBPHY_DEBUG1] = 0x00001000; | ||
144 | + s->usbphy[USBPHY_VERSION] = 0x04020000; | ||
145 | + | ||
146 | + imx_usbphy_softreset(s); | ||
147 | +} | ||
148 | + | ||
149 | +static uint64_t imx_usbphy_read(void *opaque, hwaddr offset, unsigned size) | ||
150 | +{ | ||
151 | + IMXUSBPHYState *s = (IMXUSBPHYState *)opaque; | ||
152 | + uint32_t index = offset >> 2; | ||
153 | + uint32_t value; | ||
154 | + | ||
155 | + switch (index) { | ||
156 | + case USBPHY_PWD_SET: | ||
157 | + case USBPHY_TX_SET: | ||
158 | + case USBPHY_RX_SET: | ||
159 | + case USBPHY_CTRL_SET: | ||
160 | + case USBPHY_DEBUG_SET: | ||
161 | + case USBPHY_DEBUG1_SET: | ||
162 | + /* | ||
163 | + * All REG_NAME_SET register access are in fact targeting the | ||
164 | + * REG_NAME register. | ||
165 | + */ | ||
166 | + value = s->usbphy[index - 1]; | ||
167 | + break; | ||
168 | + case USBPHY_PWD_CLR: | ||
169 | + case USBPHY_TX_CLR: | ||
170 | + case USBPHY_RX_CLR: | ||
171 | + case USBPHY_CTRL_CLR: | ||
172 | + case USBPHY_DEBUG_CLR: | ||
173 | + case USBPHY_DEBUG1_CLR: | ||
174 | + /* | ||
175 | + * All REG_NAME_CLR register access are in fact targeting the | ||
176 | + * REG_NAME register. | ||
177 | + */ | ||
178 | + value = s->usbphy[index - 2]; | ||
179 | + break; | ||
180 | + case USBPHY_PWD_TOG: | ||
181 | + case USBPHY_TX_TOG: | ||
182 | + case USBPHY_RX_TOG: | ||
183 | + case USBPHY_CTRL_TOG: | ||
184 | + case USBPHY_DEBUG_TOG: | ||
185 | + case USBPHY_DEBUG1_TOG: | ||
186 | + /* | ||
187 | + * All REG_NAME_TOG register access are in fact targeting the | ||
188 | + * REG_NAME register. | ||
189 | + */ | ||
190 | + value = s->usbphy[index - 3]; | ||
191 | + break; | ||
192 | + default: | ||
193 | + value = s->usbphy[index]; | ||
194 | + break; | ||
195 | + } | ||
196 | + return (uint64_t)value; | ||
197 | +} | ||
198 | + | ||
199 | +static void imx_usbphy_write(void *opaque, hwaddr offset, uint64_t value, | ||
200 | + unsigned size) | ||
201 | +{ | ||
202 | + IMXUSBPHYState *s = (IMXUSBPHYState *)opaque; | ||
203 | + uint32_t index = offset >> 2; | ||
204 | + | ||
205 | + switch (index) { | ||
206 | + case USBPHY_CTRL: | ||
207 | + s->usbphy[index] = value; | ||
208 | + if (value & USBPHY_CTRL_SFTRST) { | ||
209 | + imx_usbphy_softreset(s); | ||
210 | + } | ||
211 | + break; | ||
212 | + case USBPHY_PWD: | ||
213 | + case USBPHY_TX: | ||
214 | + case USBPHY_RX: | ||
215 | + case USBPHY_STATUS: | ||
216 | + case USBPHY_DEBUG: | ||
217 | + case USBPHY_DEBUG1: | ||
218 | + s->usbphy[index] = value; | ||
219 | + break; | ||
220 | + case USBPHY_CTRL_SET: | ||
221 | + s->usbphy[index - 1] |= value; | ||
222 | + if (value & USBPHY_CTRL_SFTRST) { | ||
223 | + imx_usbphy_softreset(s); | ||
224 | + } | ||
225 | + break; | ||
226 | + case USBPHY_PWD_SET: | ||
227 | + case USBPHY_TX_SET: | ||
228 | + case USBPHY_RX_SET: | ||
229 | + case USBPHY_DEBUG_SET: | ||
230 | + case USBPHY_DEBUG1_SET: | ||
231 | + /* | ||
232 | + * All REG_NAME_SET register access are in fact targeting the | ||
233 | + * REG_NAME register. So we change the value of the REG_NAME | ||
234 | + * register, setting bits passed in the value. | ||
235 | + */ | ||
236 | + s->usbphy[index - 1] |= value; | ||
237 | + break; | ||
238 | + case USBPHY_PWD_CLR: | ||
239 | + case USBPHY_TX_CLR: | ||
240 | + case USBPHY_RX_CLR: | ||
241 | + case USBPHY_CTRL_CLR: | ||
242 | + case USBPHY_DEBUG_CLR: | ||
243 | + case USBPHY_DEBUG1_CLR: | ||
244 | + /* | ||
245 | + * All REG_NAME_CLR register access are in fact targeting the | ||
246 | + * REG_NAME register. So we change the value of the REG_NAME | ||
247 | + * register, unsetting bits passed in the value. | ||
248 | + */ | ||
249 | + s->usbphy[index - 2] &= ~value; | ||
250 | + break; | ||
251 | + case USBPHY_CTRL_TOG: | ||
252 | + s->usbphy[index - 3] ^= value; | ||
253 | + if ((value & USBPHY_CTRL_SFTRST) && | ||
254 | + (s->usbphy[index - 3] & USBPHY_CTRL_SFTRST)) { | ||
255 | + imx_usbphy_softreset(s); | ||
256 | + } | ||
257 | + break; | ||
258 | + case USBPHY_PWD_TOG: | ||
259 | + case USBPHY_TX_TOG: | ||
260 | + case USBPHY_RX_TOG: | ||
261 | + case USBPHY_DEBUG_TOG: | ||
262 | + case USBPHY_DEBUG1_TOG: | ||
263 | + /* | ||
264 | + * All REG_NAME_TOG register access are in fact targeting the | ||
265 | + * REG_NAME register. So we change the value of the REG_NAME | ||
266 | + * register, toggling bits passed in the value. | ||
267 | + */ | ||
268 | + s->usbphy[index - 3] ^= value; | ||
269 | + break; | ||
270 | + default: | ||
271 | + /* Other registers are read-only */ | ||
272 | + break; | ||
273 | + } | ||
274 | +} | ||
275 | + | ||
276 | +static const struct MemoryRegionOps imx_usbphy_ops = { | ||
277 | + .read = imx_usbphy_read, | ||
278 | + .write = imx_usbphy_write, | ||
279 | + .endianness = DEVICE_NATIVE_ENDIAN, | ||
280 | + .valid = { | ||
281 | + /* | ||
282 | + * Our device would not work correctly if the guest was doing | ||
283 | + * unaligned access. This might not be a limitation on the real | ||
284 | + * device but in practice there is no reason for a guest to access | ||
285 | + * this device unaligned. | ||
286 | + */ | ||
287 | + .min_access_size = 4, | ||
288 | + .max_access_size = 4, | ||
289 | + .unaligned = false, | ||
290 | + }, | ||
291 | +}; | ||
292 | + | ||
293 | +static void imx_usbphy_realize(DeviceState *dev, Error **errp) | ||
294 | +{ | ||
295 | + IMXUSBPHYState *s = IMX_USBPHY(dev); | ||
296 | + | ||
297 | + memory_region_init_io(&s->iomem, OBJECT(s), &imx_usbphy_ops, s, | ||
298 | + "imx-usbphy", 0x1000); | ||
299 | + sysbus_init_mmio(SYS_BUS_DEVICE(s), &s->iomem); | ||
300 | +} | ||
301 | + | ||
302 | +static void imx_usbphy_class_init(ObjectClass *klass, void *data) | ||
303 | +{ | ||
304 | + DeviceClass *dc = DEVICE_CLASS(klass); | ||
305 | + | ||
306 | + dc->reset = imx_usbphy_reset; | ||
307 | + dc->vmsd = &vmstate_imx_usbphy; | ||
308 | + dc->desc = "i.MX USB PHY Module"; | ||
309 | + dc->realize = imx_usbphy_realize; | ||
310 | +} | ||
311 | + | ||
312 | +static const TypeInfo imx_usbphy_info = { | ||
313 | + .name = TYPE_IMX_USBPHY, | ||
314 | + .parent = TYPE_SYS_BUS_DEVICE, | ||
315 | + .instance_size = sizeof(IMXUSBPHYState), | ||
316 | + .class_init = imx_usbphy_class_init, | ||
317 | +}; | ||
318 | + | ||
319 | +static void imx_usbphy_register_types(void) | ||
320 | +{ | ||
321 | + type_register_static(&imx_usbphy_info); | ||
322 | +} | ||
323 | + | ||
324 | +type_init(imx_usbphy_register_types) | ||
325 | diff --git a/MAINTAINERS b/MAINTAINERS | ||
326 | index XXXXXXX..XXXXXXX 100644 | ||
327 | --- a/MAINTAINERS | ||
328 | +++ b/MAINTAINERS | ||
329 | @@ -XXX,XX +XXX,XX @@ F: hw/arm/sabrelite.c | ||
330 | F: hw/arm/fsl-imx6.c | ||
331 | F: hw/misc/imx6_*.c | ||
332 | F: hw/ssi/imx_spi.c | ||
333 | +F: hw/usb/imx-usb-phy.c | ||
334 | +F: include/hw/usb/imx-usb-phy.h | ||
335 | F: include/hw/arm/fsl-imx6.h | ||
336 | F: include/hw/misc/imx6_*.h | ||
337 | F: include/hw/ssi/imx_spi.h | ||
338 | diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig | ||
339 | index XXXXXXX..XXXXXXX 100644 | ||
340 | --- a/hw/arm/Kconfig | ||
341 | +++ b/hw/arm/Kconfig | ||
342 | @@ -XXX,XX +XXX,XX @@ config FSL_IMX6 | ||
343 | select IMX | ||
344 | select IMX_FEC | ||
345 | select IMX_I2C | ||
346 | + select IMX_USBPHY | ||
347 | select SDHCI | ||
348 | |||
349 | config ASPEED_SOC | ||
350 | diff --git a/hw/usb/Kconfig b/hw/usb/Kconfig | ||
351 | index XXXXXXX..XXXXXXX 100644 | ||
352 | --- a/hw/usb/Kconfig | ||
353 | +++ b/hw/usb/Kconfig | ||
354 | @@ -XXX,XX +XXX,XX @@ config USB_STORAGE_MTP | ||
355 | bool | ||
356 | default y | ||
357 | depends on USB | ||
358 | + | ||
359 | +config IMX_USBPHY | ||
360 | + bool | ||
361 | + default y | ||
362 | + depends on USB | ||
363 | -- | ||
364 | 2.20.1 | ||
365 | |||
366 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Guenter Roeck <linux@roeck-us.net> | ||
1 | 2 | ||
3 | USB1 and USB2 interrupt numbers were swapped. USB_PHY2 interrupt number | ||
4 | is 45. That didn't really matter up to now since the interrupts were not | ||
5 | used, but it needs to be fixed to be able to wire up the USB controllers. | ||
6 | |||
7 | Fixes: 31cbf933f0e ("i.MX6UL: Add i.MX6UL SOC") | ||
8 | Signed-off-by: Guenter Roeck <linux@roeck-us.net> | ||
9 | Message-id: 20200313014551.12554-3-linux@roeck-us.net | ||
10 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
12 | --- | ||
13 | include/hw/arm/fsl-imx6ul.h | 6 +++--- | ||
14 | 1 file changed, 3 insertions(+), 3 deletions(-) | ||
15 | |||
16 | diff --git a/include/hw/arm/fsl-imx6ul.h b/include/hw/arm/fsl-imx6ul.h | ||
17 | index XXXXXXX..XXXXXXX 100644 | ||
18 | --- a/include/hw/arm/fsl-imx6ul.h | ||
19 | +++ b/include/hw/arm/fsl-imx6ul.h | ||
20 | @@ -XXX,XX +XXX,XX @@ enum FslIMX6ULIRQs { | ||
21 | FSL_IMX6UL_UART7_IRQ = 39, | ||
22 | FSL_IMX6UL_UART8_IRQ = 40, | ||
23 | |||
24 | - FSL_IMX6UL_USB1_IRQ = 42, | ||
25 | - FSL_IMX6UL_USB2_IRQ = 43, | ||
26 | + FSL_IMX6UL_USB1_IRQ = 43, | ||
27 | + FSL_IMX6UL_USB2_IRQ = 42, | ||
28 | FSL_IMX6UL_USB_PHY1_IRQ = 44, | ||
29 | - FSL_IMX6UL_USB_PHY2_IRQ = 44, | ||
30 | + FSL_IMX6UL_USB_PHY2_IRQ = 45, | ||
31 | |||
32 | FSL_IMX6UL_CAAM_JQ2_IRQ = 46, | ||
33 | FSL_IMX6UL_CAAM_ERR_IRQ = 47, | ||
34 | -- | ||
35 | 2.20.1 | ||
36 | |||
37 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Guenter Roeck <linux@roeck-us.net> | ||
1 | 2 | ||
3 | Recent Linux kernels (post v4.20) crash due to accesses to flexcan | ||
4 | and pwm controllers. Instantiate as unimplemented devices to work | ||
5 | around the problem. | ||
6 | |||
7 | Signed-off-by: Guenter Roeck <linux@roeck-us.net> | ||
8 | Message-id: 20200313014551.12554-4-linux@roeck-us.net | ||
9 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
11 | --- | ||
12 | hw/arm/fsl-imx6ul.c | 14 ++++++++++++++ | ||
13 | 1 file changed, 14 insertions(+) | ||
14 | |||
15 | diff --git a/hw/arm/fsl-imx6ul.c b/hw/arm/fsl-imx6ul.c | ||
16 | index XXXXXXX..XXXXXXX 100644 | ||
17 | --- a/hw/arm/fsl-imx6ul.c | ||
18 | +++ b/hw/arm/fsl-imx6ul.c | ||
19 | @@ -XXX,XX +XXX,XX @@ static void fsl_imx6ul_realize(DeviceState *dev, Error **errp) | ||
20 | */ | ||
21 | create_unimplemented_device("sdma", FSL_IMX6UL_SDMA_ADDR, 0x4000); | ||
22 | |||
23 | + /* | ||
24 | + * PWM | ||
25 | + */ | ||
26 | + create_unimplemented_device("pwm1", FSL_IMX6UL_PWM1_ADDR, 0x4000); | ||
27 | + create_unimplemented_device("pwm2", FSL_IMX6UL_PWM2_ADDR, 0x4000); | ||
28 | + create_unimplemented_device("pwm3", FSL_IMX6UL_PWM3_ADDR, 0x4000); | ||
29 | + create_unimplemented_device("pwm4", FSL_IMX6UL_PWM4_ADDR, 0x4000); | ||
30 | + | ||
31 | + /* | ||
32 | + * CAN | ||
33 | + */ | ||
34 | + create_unimplemented_device("can1", FSL_IMX6UL_CAN1_ADDR, 0x4000); | ||
35 | + create_unimplemented_device("can2", FSL_IMX6UL_CAN2_ADDR, 0x4000); | ||
36 | + | ||
37 | /* | ||
38 | * APHB_DMA | ||
39 | */ | ||
40 | -- | ||
41 | 2.20.1 | ||
42 | |||
43 | diff view generated by jsdifflib |
1 | From: Marc Zyngier <maz@kernel.org> | 1 | From: Guenter Roeck <linux@roeck-us.net> |
---|---|---|---|
2 | 2 | ||
3 | HCR_EL2.TID3 mandates that access from EL1 to a long list of id | 3 | IMX6UL USB controllers are quite similar to IMX7 USB controllers. |
4 | registers traps to EL2, and QEMU has so far ignored this requirement. | 4 | Wire them up the same way. |
5 | 5 | ||
6 | This breaks (among other things) KVM guests that have PtrAuth enabled, | 6 | The only real difference is that wiring up phy devices is necessary |
7 | while the hypervisor doesn't want to expose the feature to its guest. | 7 | to avoid phy reset timeouts in the Linux kernel. |
8 | To achieve this, KVM traps the ID registers (ID_AA64ISAR1_EL1 in this | ||
9 | case), and masks out the unsupported feature. | ||
10 | 8 | ||
11 | QEMU not honoring the trap request means that the guest observes | 9 | Signed-off-by: Guenter Roeck <linux@roeck-us.net> |
12 | that the feature is present in the HW, starts using it, and dies | 10 | Message-id: 20200313014551.12554-5-linux@roeck-us.net |
13 | a horrible death when KVM injects an UNDEF, because the feature | ||
14 | *really* isn't supported. | ||
15 | |||
16 | Do the right thing by trapping to EL2 if HCR_EL2.TID3 is set. | ||
17 | |||
18 | Note that this change does not include trapping of the MVFR | ||
19 | registers from AArch32 (they are accessed via the VMRS | ||
20 | instruction and need to be handled in a different way). | ||
21 | |||
22 | Reported-by: Will Deacon <will@kernel.org> | ||
23 | Signed-off-by: Marc Zyngier <maz@kernel.org> | ||
24 | Tested-by: Will Deacon <will@kernel.org> | ||
25 | Message-id: 20191123115618.29230-1-maz@kernel.org | ||
26 | [PMM: added missing accessfn line for ID_AA4PFR2_EL1_RESERVED; | ||
27 | changed names of access functions to include _tid3] | ||
28 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 11 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
29 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
30 | --- | 13 | --- |
31 | target/arm/helper.c | 76 +++++++++++++++++++++++++++++++++++++++++++++ | 14 | include/hw/arm/fsl-imx6ul.h | 10 ++++++++++ |
32 | 1 file changed, 76 insertions(+) | 15 | hw/arm/fsl-imx6ul.c | 35 +++++++++++++++++++++++++++++++++++ |
16 | 2 files changed, 45 insertions(+) | ||
33 | 17 | ||
34 | diff --git a/target/arm/helper.c b/target/arm/helper.c | 18 | diff --git a/include/hw/arm/fsl-imx6ul.h b/include/hw/arm/fsl-imx6ul.h |
35 | index XXXXXXX..XXXXXXX 100644 | 19 | index XXXXXXX..XXXXXXX 100644 |
36 | --- a/target/arm/helper.c | 20 | --- a/include/hw/arm/fsl-imx6ul.h |
37 | +++ b/target/arm/helper.c | 21 | +++ b/include/hw/arm/fsl-imx6ul.h |
38 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo predinv_reginfo[] = { | 22 | @@ -XXX,XX +XXX,XX @@ |
39 | REGINFO_SENTINEL | 23 | #include "hw/sd/sdhci.h" |
24 | #include "hw/ssi/imx_spi.h" | ||
25 | #include "hw/net/imx_fec.h" | ||
26 | +#include "hw/usb/chipidea.h" | ||
27 | +#include "hw/usb/imx-usb-phy.h" | ||
28 | #include "exec/memory.h" | ||
29 | #include "cpu.h" | ||
30 | |||
31 | @@ -XXX,XX +XXX,XX @@ enum FslIMX6ULConfiguration { | ||
32 | FSL_IMX6UL_NUM_I2CS = 4, | ||
33 | FSL_IMX6UL_NUM_ECSPIS = 4, | ||
34 | FSL_IMX6UL_NUM_ADCS = 2, | ||
35 | + FSL_IMX6UL_NUM_USB_PHYS = 2, | ||
36 | + FSL_IMX6UL_NUM_USBS = 2, | ||
40 | }; | 37 | }; |
41 | 38 | ||
42 | +static CPAccessResult access_aa64_tid3(CPUARMState *env, const ARMCPRegInfo *ri, | 39 | typedef struct FslIMX6ULState { |
43 | + bool isread) | 40 | @@ -XXX,XX +XXX,XX @@ typedef struct FslIMX6ULState { |
44 | +{ | 41 | IMXFECState eth[FSL_IMX6UL_NUM_ETHS]; |
45 | + if ((arm_current_el(env) < 2) && (arm_hcr_el2_eff(env) & HCR_TID3)) { | 42 | SDHCIState usdhc[FSL_IMX6UL_NUM_USDHCS]; |
46 | + return CP_ACCESS_TRAP_EL2; | 43 | IMX2WdtState wdt[FSL_IMX6UL_NUM_WDTS]; |
44 | + IMXUSBPHYState usbphy[FSL_IMX6UL_NUM_USB_PHYS]; | ||
45 | + ChipideaState usb[FSL_IMX6UL_NUM_USBS]; | ||
46 | MemoryRegion rom; | ||
47 | MemoryRegion caam; | ||
48 | MemoryRegion ocram; | ||
49 | @@ -XXX,XX +XXX,XX @@ enum FslIMX6ULMemoryMap { | ||
50 | FSL_IMX6UL_EPIT2_ADDR = 0x020D4000, | ||
51 | FSL_IMX6UL_EPIT1_ADDR = 0x020D0000, | ||
52 | FSL_IMX6UL_SNVS_HP_ADDR = 0x020CC000, | ||
53 | + FSL_IMX6UL_USBPHY2_ADDR = 0x020CA000, | ||
54 | + FSL_IMX6UL_USBPHY2_SIZE = (4 * 1024), | ||
55 | + FSL_IMX6UL_USBPHY1_ADDR = 0x020C9000, | ||
56 | + FSL_IMX6UL_USBPHY1_SIZE = (4 * 1024), | ||
57 | FSL_IMX6UL_ANALOG_ADDR = 0x020C8000, | ||
58 | FSL_IMX6UL_CCM_ADDR = 0x020C4000, | ||
59 | FSL_IMX6UL_WDOG2_ADDR = 0x020C0000, | ||
60 | diff --git a/hw/arm/fsl-imx6ul.c b/hw/arm/fsl-imx6ul.c | ||
61 | index XXXXXXX..XXXXXXX 100644 | ||
62 | --- a/hw/arm/fsl-imx6ul.c | ||
63 | +++ b/hw/arm/fsl-imx6ul.c | ||
64 | @@ -XXX,XX +XXX,XX @@ | ||
65 | #include "qapi/error.h" | ||
66 | #include "hw/arm/fsl-imx6ul.h" | ||
67 | #include "hw/misc/unimp.h" | ||
68 | +#include "hw/usb/imx-usb-phy.h" | ||
69 | #include "hw/boards.h" | ||
70 | #include "sysemu/sysemu.h" | ||
71 | #include "qemu/error-report.h" | ||
72 | @@ -XXX,XX +XXX,XX @@ static void fsl_imx6ul_init(Object *obj) | ||
73 | TYPE_IMX_ENET); | ||
74 | } | ||
75 | |||
76 | + /* USB */ | ||
77 | + for (i = 0; i < FSL_IMX6UL_NUM_USB_PHYS; i++) { | ||
78 | + snprintf(name, NAME_SIZE, "usbphy%d", i); | ||
79 | + sysbus_init_child_obj(obj, name, &s->usbphy[i], sizeof(s->usbphy[i]), | ||
80 | + TYPE_IMX_USBPHY); | ||
81 | + } | ||
82 | + for (i = 0; i < FSL_IMX6UL_NUM_USBS; i++) { | ||
83 | + snprintf(name, NAME_SIZE, "usb%d", i); | ||
84 | + sysbus_init_child_obj(obj, name, &s->usb[i], sizeof(s->usb[i]), | ||
85 | + TYPE_CHIPIDEA); | ||
47 | + } | 86 | + } |
48 | + | 87 | + |
49 | + return CP_ACCESS_OK; | 88 | /* |
50 | +} | 89 | * SDHCI |
51 | + | 90 | */ |
52 | +static CPAccessResult access_aa32_tid3(CPUARMState *env, const ARMCPRegInfo *ri, | 91 | @@ -XXX,XX +XXX,XX @@ static void fsl_imx6ul_realize(DeviceState *dev, Error **errp) |
53 | + bool isread) | 92 | FSL_IMX6UL_ENETn_TIMER_IRQ[i])); |
54 | +{ | 93 | } |
55 | + if (arm_feature(env, ARM_FEATURE_V8)) { | 94 | |
56 | + return access_aa64_tid3(env, ri, isread); | 95 | + /* USB */ |
96 | + for (i = 0; i < FSL_IMX6UL_NUM_USB_PHYS; i++) { | ||
97 | + object_property_set_bool(OBJECT(&s->usbphy[i]), true, "realized", | ||
98 | + &error_abort); | ||
99 | + sysbus_mmio_map(SYS_BUS_DEVICE(&s->usbphy[i]), 0, | ||
100 | + FSL_IMX6UL_USBPHY1_ADDR + i * 0x1000); | ||
57 | + } | 101 | + } |
58 | + | 102 | + |
59 | + return CP_ACCESS_OK; | 103 | + for (i = 0; i < FSL_IMX6UL_NUM_USBS; i++) { |
60 | +} | 104 | + static const int FSL_IMX6UL_USBn_IRQ[] = { |
105 | + FSL_IMX6UL_USB1_IRQ, | ||
106 | + FSL_IMX6UL_USB2_IRQ, | ||
107 | + }; | ||
108 | + object_property_set_bool(OBJECT(&s->usb[i]), true, "realized", | ||
109 | + &error_abort); | ||
110 | + sysbus_mmio_map(SYS_BUS_DEVICE(&s->usb[i]), 0, | ||
111 | + FSL_IMX6UL_USBO2_USB_ADDR + i * 0x200); | ||
112 | + sysbus_connect_irq(SYS_BUS_DEVICE(&s->usb[i]), 0, | ||
113 | + qdev_get_gpio_in(DEVICE(&s->a7mpcore), | ||
114 | + FSL_IMX6UL_USBn_IRQ[i])); | ||
115 | + } | ||
61 | + | 116 | + |
62 | void register_cp_regs_for_features(ARMCPU *cpu) | 117 | /* |
63 | { | 118 | * USDHC |
64 | /* Register all the coprocessor registers based on feature bits */ | 119 | */ |
65 | @@ -XXX,XX +XXX,XX @@ void register_cp_regs_for_features(ARMCPU *cpu) | ||
66 | { .name = "ID_PFR0", .state = ARM_CP_STATE_BOTH, | ||
67 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 1, .opc2 = 0, | ||
68 | .access = PL1_R, .type = ARM_CP_CONST, | ||
69 | + .accessfn = access_aa32_tid3, | ||
70 | .resetvalue = cpu->id_pfr0 }, | ||
71 | /* ID_PFR1 is not a plain ARM_CP_CONST because we don't know | ||
72 | * the value of the GIC field until after we define these regs. | ||
73 | @@ -XXX,XX +XXX,XX @@ void register_cp_regs_for_features(ARMCPU *cpu) | ||
74 | { .name = "ID_PFR1", .state = ARM_CP_STATE_BOTH, | ||
75 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 1, .opc2 = 1, | ||
76 | .access = PL1_R, .type = ARM_CP_NO_RAW, | ||
77 | + .accessfn = access_aa32_tid3, | ||
78 | .readfn = id_pfr1_read, | ||
79 | .writefn = arm_cp_write_ignore }, | ||
80 | { .name = "ID_DFR0", .state = ARM_CP_STATE_BOTH, | ||
81 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 1, .opc2 = 2, | ||
82 | .access = PL1_R, .type = ARM_CP_CONST, | ||
83 | + .accessfn = access_aa32_tid3, | ||
84 | .resetvalue = cpu->id_dfr0 }, | ||
85 | { .name = "ID_AFR0", .state = ARM_CP_STATE_BOTH, | ||
86 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 1, .opc2 = 3, | ||
87 | .access = PL1_R, .type = ARM_CP_CONST, | ||
88 | + .accessfn = access_aa32_tid3, | ||
89 | .resetvalue = cpu->id_afr0 }, | ||
90 | { .name = "ID_MMFR0", .state = ARM_CP_STATE_BOTH, | ||
91 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 1, .opc2 = 4, | ||
92 | .access = PL1_R, .type = ARM_CP_CONST, | ||
93 | + .accessfn = access_aa32_tid3, | ||
94 | .resetvalue = cpu->id_mmfr0 }, | ||
95 | { .name = "ID_MMFR1", .state = ARM_CP_STATE_BOTH, | ||
96 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 1, .opc2 = 5, | ||
97 | .access = PL1_R, .type = ARM_CP_CONST, | ||
98 | + .accessfn = access_aa32_tid3, | ||
99 | .resetvalue = cpu->id_mmfr1 }, | ||
100 | { .name = "ID_MMFR2", .state = ARM_CP_STATE_BOTH, | ||
101 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 1, .opc2 = 6, | ||
102 | .access = PL1_R, .type = ARM_CP_CONST, | ||
103 | + .accessfn = access_aa32_tid3, | ||
104 | .resetvalue = cpu->id_mmfr2 }, | ||
105 | { .name = "ID_MMFR3", .state = ARM_CP_STATE_BOTH, | ||
106 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 1, .opc2 = 7, | ||
107 | .access = PL1_R, .type = ARM_CP_CONST, | ||
108 | + .accessfn = access_aa32_tid3, | ||
109 | .resetvalue = cpu->id_mmfr3 }, | ||
110 | { .name = "ID_ISAR0", .state = ARM_CP_STATE_BOTH, | ||
111 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 2, .opc2 = 0, | ||
112 | .access = PL1_R, .type = ARM_CP_CONST, | ||
113 | + .accessfn = access_aa32_tid3, | ||
114 | .resetvalue = cpu->isar.id_isar0 }, | ||
115 | { .name = "ID_ISAR1", .state = ARM_CP_STATE_BOTH, | ||
116 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 2, .opc2 = 1, | ||
117 | .access = PL1_R, .type = ARM_CP_CONST, | ||
118 | + .accessfn = access_aa32_tid3, | ||
119 | .resetvalue = cpu->isar.id_isar1 }, | ||
120 | { .name = "ID_ISAR2", .state = ARM_CP_STATE_BOTH, | ||
121 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 2, .opc2 = 2, | ||
122 | .access = PL1_R, .type = ARM_CP_CONST, | ||
123 | + .accessfn = access_aa32_tid3, | ||
124 | .resetvalue = cpu->isar.id_isar2 }, | ||
125 | { .name = "ID_ISAR3", .state = ARM_CP_STATE_BOTH, | ||
126 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 2, .opc2 = 3, | ||
127 | .access = PL1_R, .type = ARM_CP_CONST, | ||
128 | + .accessfn = access_aa32_tid3, | ||
129 | .resetvalue = cpu->isar.id_isar3 }, | ||
130 | { .name = "ID_ISAR4", .state = ARM_CP_STATE_BOTH, | ||
131 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 2, .opc2 = 4, | ||
132 | .access = PL1_R, .type = ARM_CP_CONST, | ||
133 | + .accessfn = access_aa32_tid3, | ||
134 | .resetvalue = cpu->isar.id_isar4 }, | ||
135 | { .name = "ID_ISAR5", .state = ARM_CP_STATE_BOTH, | ||
136 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 2, .opc2 = 5, | ||
137 | .access = PL1_R, .type = ARM_CP_CONST, | ||
138 | + .accessfn = access_aa32_tid3, | ||
139 | .resetvalue = cpu->isar.id_isar5 }, | ||
140 | { .name = "ID_MMFR4", .state = ARM_CP_STATE_BOTH, | ||
141 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 2, .opc2 = 6, | ||
142 | .access = PL1_R, .type = ARM_CP_CONST, | ||
143 | + .accessfn = access_aa32_tid3, | ||
144 | .resetvalue = cpu->id_mmfr4 }, | ||
145 | { .name = "ID_ISAR6", .state = ARM_CP_STATE_BOTH, | ||
146 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 2, .opc2 = 7, | ||
147 | .access = PL1_R, .type = ARM_CP_CONST, | ||
148 | + .accessfn = access_aa32_tid3, | ||
149 | .resetvalue = cpu->isar.id_isar6 }, | ||
150 | REGINFO_SENTINEL | ||
151 | }; | ||
152 | @@ -XXX,XX +XXX,XX @@ void register_cp_regs_for_features(ARMCPU *cpu) | ||
153 | { .name = "ID_AA64PFR0_EL1", .state = ARM_CP_STATE_AA64, | ||
154 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 4, .opc2 = 0, | ||
155 | .access = PL1_R, .type = ARM_CP_NO_RAW, | ||
156 | + .accessfn = access_aa64_tid3, | ||
157 | .readfn = id_aa64pfr0_read, | ||
158 | .writefn = arm_cp_write_ignore }, | ||
159 | { .name = "ID_AA64PFR1_EL1", .state = ARM_CP_STATE_AA64, | ||
160 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 4, .opc2 = 1, | ||
161 | .access = PL1_R, .type = ARM_CP_CONST, | ||
162 | + .accessfn = access_aa64_tid3, | ||
163 | .resetvalue = cpu->isar.id_aa64pfr1}, | ||
164 | { .name = "ID_AA64PFR2_EL1_RESERVED", .state = ARM_CP_STATE_AA64, | ||
165 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 4, .opc2 = 2, | ||
166 | .access = PL1_R, .type = ARM_CP_CONST, | ||
167 | + .accessfn = access_aa64_tid3, | ||
168 | .resetvalue = 0 }, | ||
169 | { .name = "ID_AA64PFR3_EL1_RESERVED", .state = ARM_CP_STATE_AA64, | ||
170 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 4, .opc2 = 3, | ||
171 | .access = PL1_R, .type = ARM_CP_CONST, | ||
172 | + .accessfn = access_aa64_tid3, | ||
173 | .resetvalue = 0 }, | ||
174 | { .name = "ID_AA64ZFR0_EL1", .state = ARM_CP_STATE_AA64, | ||
175 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 4, .opc2 = 4, | ||
176 | .access = PL1_R, .type = ARM_CP_CONST, | ||
177 | + .accessfn = access_aa64_tid3, | ||
178 | /* At present, only SVEver == 0 is defined anyway. */ | ||
179 | .resetvalue = 0 }, | ||
180 | { .name = "ID_AA64PFR5_EL1_RESERVED", .state = ARM_CP_STATE_AA64, | ||
181 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 4, .opc2 = 5, | ||
182 | .access = PL1_R, .type = ARM_CP_CONST, | ||
183 | + .accessfn = access_aa64_tid3, | ||
184 | .resetvalue = 0 }, | ||
185 | { .name = "ID_AA64PFR6_EL1_RESERVED", .state = ARM_CP_STATE_AA64, | ||
186 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 4, .opc2 = 6, | ||
187 | .access = PL1_R, .type = ARM_CP_CONST, | ||
188 | + .accessfn = access_aa64_tid3, | ||
189 | .resetvalue = 0 }, | ||
190 | { .name = "ID_AA64PFR7_EL1_RESERVED", .state = ARM_CP_STATE_AA64, | ||
191 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 4, .opc2 = 7, | ||
192 | .access = PL1_R, .type = ARM_CP_CONST, | ||
193 | + .accessfn = access_aa64_tid3, | ||
194 | .resetvalue = 0 }, | ||
195 | { .name = "ID_AA64DFR0_EL1", .state = ARM_CP_STATE_AA64, | ||
196 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 5, .opc2 = 0, | ||
197 | .access = PL1_R, .type = ARM_CP_CONST, | ||
198 | + .accessfn = access_aa64_tid3, | ||
199 | .resetvalue = cpu->id_aa64dfr0 }, | ||
200 | { .name = "ID_AA64DFR1_EL1", .state = ARM_CP_STATE_AA64, | ||
201 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 5, .opc2 = 1, | ||
202 | .access = PL1_R, .type = ARM_CP_CONST, | ||
203 | + .accessfn = access_aa64_tid3, | ||
204 | .resetvalue = cpu->id_aa64dfr1 }, | ||
205 | { .name = "ID_AA64DFR2_EL1_RESERVED", .state = ARM_CP_STATE_AA64, | ||
206 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 5, .opc2 = 2, | ||
207 | .access = PL1_R, .type = ARM_CP_CONST, | ||
208 | + .accessfn = access_aa64_tid3, | ||
209 | .resetvalue = 0 }, | ||
210 | { .name = "ID_AA64DFR3_EL1_RESERVED", .state = ARM_CP_STATE_AA64, | ||
211 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 5, .opc2 = 3, | ||
212 | .access = PL1_R, .type = ARM_CP_CONST, | ||
213 | + .accessfn = access_aa64_tid3, | ||
214 | .resetvalue = 0 }, | ||
215 | { .name = "ID_AA64AFR0_EL1", .state = ARM_CP_STATE_AA64, | ||
216 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 5, .opc2 = 4, | ||
217 | .access = PL1_R, .type = ARM_CP_CONST, | ||
218 | + .accessfn = access_aa64_tid3, | ||
219 | .resetvalue = cpu->id_aa64afr0 }, | ||
220 | { .name = "ID_AA64AFR1_EL1", .state = ARM_CP_STATE_AA64, | ||
221 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 5, .opc2 = 5, | ||
222 | .access = PL1_R, .type = ARM_CP_CONST, | ||
223 | + .accessfn = access_aa64_tid3, | ||
224 | .resetvalue = cpu->id_aa64afr1 }, | ||
225 | { .name = "ID_AA64AFR2_EL1_RESERVED", .state = ARM_CP_STATE_AA64, | ||
226 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 5, .opc2 = 6, | ||
227 | .access = PL1_R, .type = ARM_CP_CONST, | ||
228 | + .accessfn = access_aa64_tid3, | ||
229 | .resetvalue = 0 }, | ||
230 | { .name = "ID_AA64AFR3_EL1_RESERVED", .state = ARM_CP_STATE_AA64, | ||
231 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 5, .opc2 = 7, | ||
232 | .access = PL1_R, .type = ARM_CP_CONST, | ||
233 | + .accessfn = access_aa64_tid3, | ||
234 | .resetvalue = 0 }, | ||
235 | { .name = "ID_AA64ISAR0_EL1", .state = ARM_CP_STATE_AA64, | ||
236 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 6, .opc2 = 0, | ||
237 | .access = PL1_R, .type = ARM_CP_CONST, | ||
238 | + .accessfn = access_aa64_tid3, | ||
239 | .resetvalue = cpu->isar.id_aa64isar0 }, | ||
240 | { .name = "ID_AA64ISAR1_EL1", .state = ARM_CP_STATE_AA64, | ||
241 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 6, .opc2 = 1, | ||
242 | .access = PL1_R, .type = ARM_CP_CONST, | ||
243 | + .accessfn = access_aa64_tid3, | ||
244 | .resetvalue = cpu->isar.id_aa64isar1 }, | ||
245 | { .name = "ID_AA64ISAR2_EL1_RESERVED", .state = ARM_CP_STATE_AA64, | ||
246 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 6, .opc2 = 2, | ||
247 | .access = PL1_R, .type = ARM_CP_CONST, | ||
248 | + .accessfn = access_aa64_tid3, | ||
249 | .resetvalue = 0 }, | ||
250 | { .name = "ID_AA64ISAR3_EL1_RESERVED", .state = ARM_CP_STATE_AA64, | ||
251 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 6, .opc2 = 3, | ||
252 | .access = PL1_R, .type = ARM_CP_CONST, | ||
253 | + .accessfn = access_aa64_tid3, | ||
254 | .resetvalue = 0 }, | ||
255 | { .name = "ID_AA64ISAR4_EL1_RESERVED", .state = ARM_CP_STATE_AA64, | ||
256 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 6, .opc2 = 4, | ||
257 | .access = PL1_R, .type = ARM_CP_CONST, | ||
258 | + .accessfn = access_aa64_tid3, | ||
259 | .resetvalue = 0 }, | ||
260 | { .name = "ID_AA64ISAR5_EL1_RESERVED", .state = ARM_CP_STATE_AA64, | ||
261 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 6, .opc2 = 5, | ||
262 | .access = PL1_R, .type = ARM_CP_CONST, | ||
263 | + .accessfn = access_aa64_tid3, | ||
264 | .resetvalue = 0 }, | ||
265 | { .name = "ID_AA64ISAR6_EL1_RESERVED", .state = ARM_CP_STATE_AA64, | ||
266 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 6, .opc2 = 6, | ||
267 | .access = PL1_R, .type = ARM_CP_CONST, | ||
268 | + .accessfn = access_aa64_tid3, | ||
269 | .resetvalue = 0 }, | ||
270 | { .name = "ID_AA64ISAR7_EL1_RESERVED", .state = ARM_CP_STATE_AA64, | ||
271 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 6, .opc2 = 7, | ||
272 | .access = PL1_R, .type = ARM_CP_CONST, | ||
273 | + .accessfn = access_aa64_tid3, | ||
274 | .resetvalue = 0 }, | ||
275 | { .name = "ID_AA64MMFR0_EL1", .state = ARM_CP_STATE_AA64, | ||
276 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 7, .opc2 = 0, | ||
277 | .access = PL1_R, .type = ARM_CP_CONST, | ||
278 | + .accessfn = access_aa64_tid3, | ||
279 | .resetvalue = cpu->isar.id_aa64mmfr0 }, | ||
280 | { .name = "ID_AA64MMFR1_EL1", .state = ARM_CP_STATE_AA64, | ||
281 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 7, .opc2 = 1, | ||
282 | .access = PL1_R, .type = ARM_CP_CONST, | ||
283 | + .accessfn = access_aa64_tid3, | ||
284 | .resetvalue = cpu->isar.id_aa64mmfr1 }, | ||
285 | { .name = "ID_AA64MMFR2_EL1_RESERVED", .state = ARM_CP_STATE_AA64, | ||
286 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 7, .opc2 = 2, | ||
287 | .access = PL1_R, .type = ARM_CP_CONST, | ||
288 | + .accessfn = access_aa64_tid3, | ||
289 | .resetvalue = 0 }, | ||
290 | { .name = "ID_AA64MMFR3_EL1_RESERVED", .state = ARM_CP_STATE_AA64, | ||
291 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 7, .opc2 = 3, | ||
292 | .access = PL1_R, .type = ARM_CP_CONST, | ||
293 | + .accessfn = access_aa64_tid3, | ||
294 | .resetvalue = 0 }, | ||
295 | { .name = "ID_AA64MMFR4_EL1_RESERVED", .state = ARM_CP_STATE_AA64, | ||
296 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 7, .opc2 = 4, | ||
297 | .access = PL1_R, .type = ARM_CP_CONST, | ||
298 | + .accessfn = access_aa64_tid3, | ||
299 | .resetvalue = 0 }, | ||
300 | { .name = "ID_AA64MMFR5_EL1_RESERVED", .state = ARM_CP_STATE_AA64, | ||
301 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 7, .opc2 = 5, | ||
302 | .access = PL1_R, .type = ARM_CP_CONST, | ||
303 | + .accessfn = access_aa64_tid3, | ||
304 | .resetvalue = 0 }, | ||
305 | { .name = "ID_AA64MMFR6_EL1_RESERVED", .state = ARM_CP_STATE_AA64, | ||
306 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 7, .opc2 = 6, | ||
307 | .access = PL1_R, .type = ARM_CP_CONST, | ||
308 | + .accessfn = access_aa64_tid3, | ||
309 | .resetvalue = 0 }, | ||
310 | { .name = "ID_AA64MMFR7_EL1_RESERVED", .state = ARM_CP_STATE_AA64, | ||
311 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 7, .opc2 = 7, | ||
312 | .access = PL1_R, .type = ARM_CP_CONST, | ||
313 | + .accessfn = access_aa64_tid3, | ||
314 | .resetvalue = 0 }, | ||
315 | { .name = "MVFR0_EL1", .state = ARM_CP_STATE_AA64, | ||
316 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 3, .opc2 = 0, | ||
317 | .access = PL1_R, .type = ARM_CP_CONST, | ||
318 | + .accessfn = access_aa64_tid3, | ||
319 | .resetvalue = cpu->isar.mvfr0 }, | ||
320 | { .name = "MVFR1_EL1", .state = ARM_CP_STATE_AA64, | ||
321 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 3, .opc2 = 1, | ||
322 | .access = PL1_R, .type = ARM_CP_CONST, | ||
323 | + .accessfn = access_aa64_tid3, | ||
324 | .resetvalue = cpu->isar.mvfr1 }, | ||
325 | { .name = "MVFR2_EL1", .state = ARM_CP_STATE_AA64, | ||
326 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 3, .opc2 = 2, | ||
327 | .access = PL1_R, .type = ARM_CP_CONST, | ||
328 | + .accessfn = access_aa64_tid3, | ||
329 | .resetvalue = cpu->isar.mvfr2 }, | ||
330 | { .name = "MVFR3_EL1_RESERVED", .state = ARM_CP_STATE_AA64, | ||
331 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 3, .opc2 = 3, | ||
332 | .access = PL1_R, .type = ARM_CP_CONST, | ||
333 | + .accessfn = access_aa64_tid3, | ||
334 | .resetvalue = 0 }, | ||
335 | { .name = "MVFR4_EL1_RESERVED", .state = ARM_CP_STATE_AA64, | ||
336 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 3, .opc2 = 4, | ||
337 | .access = PL1_R, .type = ARM_CP_CONST, | ||
338 | + .accessfn = access_aa64_tid3, | ||
339 | .resetvalue = 0 }, | ||
340 | { .name = "MVFR5_EL1_RESERVED", .state = ARM_CP_STATE_AA64, | ||
341 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 3, .opc2 = 5, | ||
342 | .access = PL1_R, .type = ARM_CP_CONST, | ||
343 | + .accessfn = access_aa64_tid3, | ||
344 | .resetvalue = 0 }, | ||
345 | { .name = "MVFR6_EL1_RESERVED", .state = ARM_CP_STATE_AA64, | ||
346 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 3, .opc2 = 6, | ||
347 | .access = PL1_R, .type = ARM_CP_CONST, | ||
348 | + .accessfn = access_aa64_tid3, | ||
349 | .resetvalue = 0 }, | ||
350 | { .name = "MVFR7_EL1_RESERVED", .state = ARM_CP_STATE_AA64, | ||
351 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 3, .opc2 = 7, | ||
352 | .access = PL1_R, .type = ARM_CP_CONST, | ||
353 | + .accessfn = access_aa64_tid3, | ||
354 | .resetvalue = 0 }, | ||
355 | { .name = "PMCEID0", .state = ARM_CP_STATE_AA32, | ||
356 | .cp = 15, .opc1 = 0, .crn = 9, .crm = 12, .opc2 = 6, | ||
357 | -- | 120 | -- |
358 | 2.20.1 | 121 | 2.20.1 |
359 | 122 | ||
360 | 123 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Guenter Roeck <linux@roeck-us.net> | ||
1 | 2 | ||
3 | With this patch, the USB controllers on 'sabrelite' are detected | ||
4 | and can be used to boot the system. | ||
5 | |||
6 | Signed-off-by: Guenter Roeck <linux@roeck-us.net> | ||
7 | Message-id: 20200313014551.12554-6-linux@roeck-us.net | ||
8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | --- | ||
11 | include/hw/arm/fsl-imx6.h | 6 ++++++ | ||
12 | hw/arm/fsl-imx6.c | 36 ++++++++++++++++++++++++++++++++++++ | ||
13 | 2 files changed, 42 insertions(+) | ||
14 | |||
15 | diff --git a/include/hw/arm/fsl-imx6.h b/include/hw/arm/fsl-imx6.h | ||
16 | index XXXXXXX..XXXXXXX 100644 | ||
17 | --- a/include/hw/arm/fsl-imx6.h | ||
18 | +++ b/include/hw/arm/fsl-imx6.h | ||
19 | @@ -XXX,XX +XXX,XX @@ | ||
20 | #include "hw/sd/sdhci.h" | ||
21 | #include "hw/ssi/imx_spi.h" | ||
22 | #include "hw/net/imx_fec.h" | ||
23 | +#include "hw/usb/chipidea.h" | ||
24 | +#include "hw/usb/imx-usb-phy.h" | ||
25 | #include "exec/memory.h" | ||
26 | #include "cpu.h" | ||
27 | |||
28 | @@ -XXX,XX +XXX,XX @@ | ||
29 | #define FSL_IMX6_NUM_ESDHCS 4 | ||
30 | #define FSL_IMX6_NUM_ECSPIS 5 | ||
31 | #define FSL_IMX6_NUM_WDTS 2 | ||
32 | +#define FSL_IMX6_NUM_USB_PHYS 2 | ||
33 | +#define FSL_IMX6_NUM_USBS 4 | ||
34 | |||
35 | typedef struct FslIMX6State { | ||
36 | /*< private >*/ | ||
37 | @@ -XXX,XX +XXX,XX @@ typedef struct FslIMX6State { | ||
38 | SDHCIState esdhc[FSL_IMX6_NUM_ESDHCS]; | ||
39 | IMXSPIState spi[FSL_IMX6_NUM_ECSPIS]; | ||
40 | IMX2WdtState wdt[FSL_IMX6_NUM_WDTS]; | ||
41 | + IMXUSBPHYState usbphy[FSL_IMX6_NUM_USB_PHYS]; | ||
42 | + ChipideaState usb[FSL_IMX6_NUM_USBS]; | ||
43 | IMXFECState eth; | ||
44 | MemoryRegion rom; | ||
45 | MemoryRegion caam; | ||
46 | diff --git a/hw/arm/fsl-imx6.c b/hw/arm/fsl-imx6.c | ||
47 | index XXXXXXX..XXXXXXX 100644 | ||
48 | --- a/hw/arm/fsl-imx6.c | ||
49 | +++ b/hw/arm/fsl-imx6.c | ||
50 | @@ -XXX,XX +XXX,XX @@ | ||
51 | #include "qemu/osdep.h" | ||
52 | #include "qapi/error.h" | ||
53 | #include "hw/arm/fsl-imx6.h" | ||
54 | +#include "hw/usb/imx-usb-phy.h" | ||
55 | #include "hw/boards.h" | ||
56 | #include "hw/qdev-properties.h" | ||
57 | #include "sysemu/sysemu.h" | ||
58 | @@ -XXX,XX +XXX,XX @@ static void fsl_imx6_init(Object *obj) | ||
59 | TYPE_IMX_USDHC); | ||
60 | } | ||
61 | |||
62 | + for (i = 0; i < FSL_IMX6_NUM_USB_PHYS; i++) { | ||
63 | + snprintf(name, NAME_SIZE, "usbphy%d", i); | ||
64 | + sysbus_init_child_obj(obj, name, &s->usbphy[i], sizeof(s->usbphy[i]), | ||
65 | + TYPE_IMX_USBPHY); | ||
66 | + } | ||
67 | + for (i = 0; i < FSL_IMX6_NUM_USBS; i++) { | ||
68 | + snprintf(name, NAME_SIZE, "usb%d", i); | ||
69 | + sysbus_init_child_obj(obj, name, &s->usb[i], sizeof(s->usb[i]), | ||
70 | + TYPE_CHIPIDEA); | ||
71 | + } | ||
72 | + | ||
73 | for (i = 0; i < FSL_IMX6_NUM_ECSPIS; i++) { | ||
74 | snprintf(name, NAME_SIZE, "spi%d", i + 1); | ||
75 | sysbus_init_child_obj(obj, name, &s->spi[i], sizeof(s->spi[i]), | ||
76 | @@ -XXX,XX +XXX,XX @@ static void fsl_imx6_realize(DeviceState *dev, Error **errp) | ||
77 | esdhc_table[i].irq)); | ||
78 | } | ||
79 | |||
80 | + /* USB */ | ||
81 | + for (i = 0; i < FSL_IMX6_NUM_USB_PHYS; i++) { | ||
82 | + object_property_set_bool(OBJECT(&s->usbphy[i]), true, "realized", | ||
83 | + &error_abort); | ||
84 | + sysbus_mmio_map(SYS_BUS_DEVICE(&s->usbphy[i]), 0, | ||
85 | + FSL_IMX6_USBPHY1_ADDR + i * 0x1000); | ||
86 | + } | ||
87 | + for (i = 0; i < FSL_IMX6_NUM_USBS; i++) { | ||
88 | + static const int FSL_IMX6_USBn_IRQ[] = { | ||
89 | + FSL_IMX6_USB_OTG_IRQ, | ||
90 | + FSL_IMX6_USB_HOST1_IRQ, | ||
91 | + FSL_IMX6_USB_HOST2_IRQ, | ||
92 | + FSL_IMX6_USB_HOST3_IRQ, | ||
93 | + }; | ||
94 | + | ||
95 | + object_property_set_bool(OBJECT(&s->usb[i]), true, "realized", | ||
96 | + &error_abort); | ||
97 | + sysbus_mmio_map(SYS_BUS_DEVICE(&s->usb[i]), 0, | ||
98 | + FSL_IMX6_USBOH3_USB_ADDR + i * 0x200); | ||
99 | + sysbus_connect_irq(SYS_BUS_DEVICE(&s->usb[i]), 0, | ||
100 | + qdev_get_gpio_in(DEVICE(&s->a9mpcore), | ||
101 | + FSL_IMX6_USBn_IRQ[i])); | ||
102 | + } | ||
103 | + | ||
104 | /* Initialize all ECSPI */ | ||
105 | for (i = 0; i < FSL_IMX6_NUM_ECSPIS; i++) { | ||
106 | static const struct { | ||
107 | -- | ||
108 | 2.20.1 | ||
109 | |||
110 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Chen Qun <kuhn.chenqun@huawei.com> | ||
1 | 2 | ||
3 | The current code causes clang static code analyzer generate warning: | ||
4 | hw/net/imx_fec.c:858:9: warning: Value stored to 'value' is never read | ||
5 | value = value & 0x0000000f; | ||
6 | ^ ~~~~~~~~~~~~~~~~~~ | ||
7 | hw/net/imx_fec.c:864:9: warning: Value stored to 'value' is never read | ||
8 | value = value & 0x000000fd; | ||
9 | ^ ~~~~~~~~~~~~~~~~~~ | ||
10 | |||
11 | According to the definition of the function, the two “value” assignments | ||
12 | should be written to registers. | ||
13 | |||
14 | Reported-by: Euler Robot <euler.robot@huawei.com> | ||
15 | Signed-off-by: Chen Qun <kuhn.chenqun@huawei.com> | ||
16 | Message-id: 20200313123242.13236-1-kuhn.chenqun@huawei.com | ||
17 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
18 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
19 | --- | ||
20 | hw/net/imx_fec.c | 6 ++++-- | ||
21 | 1 file changed, 4 insertions(+), 2 deletions(-) | ||
22 | |||
23 | diff --git a/hw/net/imx_fec.c b/hw/net/imx_fec.c | ||
24 | index XXXXXXX..XXXXXXX 100644 | ||
25 | --- a/hw/net/imx_fec.c | ||
26 | +++ b/hw/net/imx_fec.c | ||
27 | @@ -XXX,XX +XXX,XX @@ static void imx_enet_write(IMXFECState *s, uint32_t index, uint32_t value) | ||
28 | break; | ||
29 | case ENET_TGSR: | ||
30 | /* implement clear timer flag */ | ||
31 | - value = value & 0x0000000f; | ||
32 | + s->regs[index] &= ~(value & 0x0000000f); /* all bits W1C */ | ||
33 | break; | ||
34 | case ENET_TCSR0: | ||
35 | case ENET_TCSR1: | ||
36 | case ENET_TCSR2: | ||
37 | case ENET_TCSR3: | ||
38 | - value = value & 0x000000fd; | ||
39 | + s->regs[index] &= ~(value & 0x00000080); /* W1C bits */ | ||
40 | + s->regs[index] &= ~0x0000007d; /* writable fields */ | ||
41 | + s->regs[index] |= (value & 0x0000007d); | ||
42 | break; | ||
43 | case ENET_TCCR0: | ||
44 | case ENET_TCCR1: | ||
45 | -- | ||
46 | 2.20.1 | ||
47 | |||
48 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Guenter Roeck <linux@roeck-us.net> | ||
1 | 2 | ||
3 | While at it, add some trace messages to help debug problems | ||
4 | seen when running the latest Linux kernel. | ||
5 | |||
6 | Signed-off-by: Guenter Roeck <linux@roeck-us.net> | ||
7 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
8 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | ||
9 | Reviewed-by: Cédric Le Goater <clg@kaod.org> | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
11 | --- | ||
12 | hw/block/m25p80.c | 48 ++++++++++++++++++++----------------------- | ||
13 | hw/block/trace-events | 16 +++++++++++++++ | ||
14 | 2 files changed, 38 insertions(+), 26 deletions(-) | ||
15 | |||
16 | diff --git a/hw/block/m25p80.c b/hw/block/m25p80.c | ||
17 | index XXXXXXX..XXXXXXX 100644 | ||
18 | --- a/hw/block/m25p80.c | ||
19 | +++ b/hw/block/m25p80.c | ||
20 | @@ -XXX,XX +XXX,XX @@ | ||
21 | #include "qemu/module.h" | ||
22 | #include "qemu/error-report.h" | ||
23 | #include "qapi/error.h" | ||
24 | - | ||
25 | -#ifndef M25P80_ERR_DEBUG | ||
26 | -#define M25P80_ERR_DEBUG 0 | ||
27 | -#endif | ||
28 | - | ||
29 | -#define DB_PRINT_L(level, ...) do { \ | ||
30 | - if (M25P80_ERR_DEBUG > (level)) { \ | ||
31 | - fprintf(stderr, ": %s: ", __func__); \ | ||
32 | - fprintf(stderr, ## __VA_ARGS__); \ | ||
33 | - } \ | ||
34 | -} while (0) | ||
35 | +#include "trace.h" | ||
36 | |||
37 | /* Fields for FlashPartInfo->flags */ | ||
38 | |||
39 | @@ -XXX,XX +XXX,XX @@ static void flash_erase(Flash *s, int offset, FlashCMD cmd) | ||
40 | abort(); | ||
41 | } | ||
42 | |||
43 | - DB_PRINT_L(0, "offset = %#x, len = %d\n", offset, len); | ||
44 | + trace_m25p80_flash_erase(s, offset, len); | ||
45 | + | ||
46 | if ((s->pi->flags & capa_to_assert) != capa_to_assert) { | ||
47 | qemu_log_mask(LOG_GUEST_ERROR, "M25P80: %d erase size not supported by" | ||
48 | " device\n", len); | ||
49 | @@ -XXX,XX +XXX,XX @@ void flash_write8(Flash *s, uint32_t addr, uint8_t data) | ||
50 | } | ||
51 | |||
52 | if ((prev ^ data) & data) { | ||
53 | - DB_PRINT_L(1, "programming zero to one! addr=%" PRIx32 " %" PRIx8 | ||
54 | - " -> %" PRIx8 "\n", addr, prev, data); | ||
55 | + trace_m25p80_programming_zero_to_one(s, addr, prev, data); | ||
56 | } | ||
57 | |||
58 | if (s->pi->flags & EEPROM) { | ||
59 | @@ -XXX,XX +XXX,XX @@ static void complete_collecting_data(Flash *s) | ||
60 | |||
61 | s->state = STATE_IDLE; | ||
62 | |||
63 | + trace_m25p80_complete_collecting(s, s->cmd_in_progress, n, s->ear, | ||
64 | + s->cur_addr); | ||
65 | + | ||
66 | switch (s->cmd_in_progress) { | ||
67 | case DPP: | ||
68 | case QPP: | ||
69 | @@ -XXX,XX +XXX,XX @@ static void reset_memory(Flash *s) | ||
70 | break; | ||
71 | } | ||
72 | |||
73 | - DB_PRINT_L(0, "Reset done.\n"); | ||
74 | + trace_m25p80_reset_done(s); | ||
75 | } | ||
76 | |||
77 | static void decode_fast_read_cmd(Flash *s) | ||
78 | @@ -XXX,XX +XXX,XX @@ static void decode_qio_read_cmd(Flash *s) | ||
79 | |||
80 | static void decode_new_cmd(Flash *s, uint32_t value) | ||
81 | { | ||
82 | - s->cmd_in_progress = value; | ||
83 | int i; | ||
84 | - DB_PRINT_L(0, "decoded new command:%x\n", value); | ||
85 | + | ||
86 | + s->cmd_in_progress = value; | ||
87 | + trace_m25p80_command_decoded(s, value); | ||
88 | |||
89 | if (value != RESET_MEMORY) { | ||
90 | s->reset_enable = false; | ||
91 | @@ -XXX,XX +XXX,XX @@ static void decode_new_cmd(Flash *s, uint32_t value) | ||
92 | break; | ||
93 | |||
94 | case JEDEC_READ: | ||
95 | - DB_PRINT_L(0, "populated jedec code\n"); | ||
96 | + trace_m25p80_populated_jedec(s); | ||
97 | for (i = 0; i < s->pi->id_len; i++) { | ||
98 | s->data[i] = s->pi->id[i]; | ||
99 | } | ||
100 | @@ -XXX,XX +XXX,XX @@ static void decode_new_cmd(Flash *s, uint32_t value) | ||
101 | case BULK_ERASE_60: | ||
102 | case BULK_ERASE: | ||
103 | if (s->write_enable) { | ||
104 | - DB_PRINT_L(0, "chip erase\n"); | ||
105 | + trace_m25p80_chip_erase(s); | ||
106 | flash_erase(s, 0, BULK_ERASE); | ||
107 | } else { | ||
108 | qemu_log_mask(LOG_GUEST_ERROR, "M25P80: chip erase with write " | ||
109 | @@ -XXX,XX +XXX,XX @@ static int m25p80_cs(SSISlave *ss, bool select) | ||
110 | s->data_read_loop = false; | ||
111 | } | ||
112 | |||
113 | - DB_PRINT_L(0, "%sselect\n", select ? "de" : ""); | ||
114 | + trace_m25p80_select(s, select ? "de" : ""); | ||
115 | |||
116 | return 0; | ||
117 | } | ||
118 | @@ -XXX,XX +XXX,XX @@ static uint32_t m25p80_transfer8(SSISlave *ss, uint32_t tx) | ||
119 | Flash *s = M25P80(ss); | ||
120 | uint32_t r = 0; | ||
121 | |||
122 | + trace_m25p80_transfer(s, s->state, s->len, s->needed_bytes, s->pos, | ||
123 | + s->cur_addr, (uint8_t)tx); | ||
124 | + | ||
125 | switch (s->state) { | ||
126 | |||
127 | case STATE_PAGE_PROGRAM: | ||
128 | - DB_PRINT_L(1, "page program cur_addr=%#" PRIx32 " data=%" PRIx8 "\n", | ||
129 | - s->cur_addr, (uint8_t)tx); | ||
130 | + trace_m25p80_page_program(s, s->cur_addr, (uint8_t)tx); | ||
131 | flash_write8(s, s->cur_addr, (uint8_t)tx); | ||
132 | s->cur_addr = (s->cur_addr + 1) & (s->size - 1); | ||
133 | break; | ||
134 | |||
135 | case STATE_READ: | ||
136 | r = s->storage[s->cur_addr]; | ||
137 | - DB_PRINT_L(1, "READ 0x%" PRIx32 "=%" PRIx8 "\n", s->cur_addr, | ||
138 | - (uint8_t)r); | ||
139 | + trace_m25p80_read_byte(s, s->cur_addr, (uint8_t)r); | ||
140 | s->cur_addr = (s->cur_addr + 1) & (s->size - 1); | ||
141 | break; | ||
142 | |||
143 | @@ -XXX,XX +XXX,XX @@ static uint32_t m25p80_transfer8(SSISlave *ss, uint32_t tx) | ||
144 | } | ||
145 | |||
146 | r = s->data[s->pos]; | ||
147 | + trace_m25p80_read_data(s, s->pos, (uint8_t)r); | ||
148 | s->pos++; | ||
149 | if (s->pos == s->len) { | ||
150 | s->pos = 0; | ||
151 | @@ -XXX,XX +XXX,XX @@ static void m25p80_realize(SSISlave *ss, Error **errp) | ||
152 | return; | ||
153 | } | ||
154 | |||
155 | - DB_PRINT_L(0, "Binding to IF_MTD drive\n"); | ||
156 | + trace_m25p80_binding(s); | ||
157 | s->storage = blk_blockalign(s->blk, s->size); | ||
158 | |||
159 | if (blk_pread(s->blk, 0, s->storage, s->size) != s->size) { | ||
160 | @@ -XXX,XX +XXX,XX @@ static void m25p80_realize(SSISlave *ss, Error **errp) | ||
161 | return; | ||
162 | } | ||
163 | } else { | ||
164 | - DB_PRINT_L(0, "No BDRV - binding to RAM\n"); | ||
165 | + trace_m25p80_binding_no_bdrv(s); | ||
166 | s->storage = blk_blockalign(NULL, s->size); | ||
167 | memset(s->storage, 0xFF, s->size); | ||
168 | } | ||
169 | diff --git a/hw/block/trace-events b/hw/block/trace-events | ||
170 | index XXXXXXX..XXXXXXX 100644 | ||
171 | --- a/hw/block/trace-events | ||
172 | +++ b/hw/block/trace-events | ||
173 | @@ -XXX,XX +XXX,XX @@ xen_block_blockdev_add(char *str) "%s" | ||
174 | xen_block_blockdev_del(const char *node_name) "%s" | ||
175 | xen_block_device_create(unsigned int number) "%u" | ||
176 | xen_block_device_destroy(unsigned int number) "%u" | ||
177 | + | ||
178 | +# m25p80.c | ||
179 | +m25p80_flash_erase(void *s, int offset, uint32_t len) "[%p] offset = 0x%"PRIx32", len = %u" | ||
180 | +m25p80_programming_zero_to_one(void *s, uint32_t addr, uint8_t prev, uint8_t data) "[%p] programming zero to one! addr=0x%"PRIx32" 0x%"PRIx8" -> 0x%"PRIx8 | ||
181 | +m25p80_reset_done(void *s) "[%p] Reset done." | ||
182 | +m25p80_command_decoded(void *s, uint32_t cmd) "[%p] new command:0x%"PRIx32 | ||
183 | +m25p80_complete_collecting(void *s, uint32_t cmd, int n, uint8_t ear, uint32_t cur_addr) "[%p] decode cmd: 0x%"PRIx32" len %d ear 0x%"PRIx8" addr 0x%"PRIx32 | ||
184 | +m25p80_populated_jedec(void *s) "[%p] populated jedec code" | ||
185 | +m25p80_chip_erase(void *s) "[%p] chip erase" | ||
186 | +m25p80_select(void *s, const char *what) "[%p] %sselect" | ||
187 | +m25p80_page_program(void *s, uint32_t addr, uint8_t tx) "[%p] page program cur_addr=0x%"PRIx32" data=0x%"PRIx8 | ||
188 | +m25p80_transfer(void *s, uint8_t state, uint32_t len, uint8_t needed, uint32_t pos, uint32_t cur_addr, uint8_t t) "[%p] Transfer state 0x%"PRIx8" len 0x%"PRIx32" needed 0x%"PRIx8" pos 0x%"PRIx32" addr 0x%"PRIx32" tx 0x%"PRIx8 | ||
189 | +m25p80_read_byte(void *s, uint32_t addr, uint8_t v) "[%p] Read byte 0x%"PRIx32"=0x%"PRIx8 | ||
190 | +m25p80_read_data(void *s, uint32_t pos, uint8_t v) "[%p] Read data 0x%"PRIx32"=0x%"PRIx8 | ||
191 | +m25p80_binding(void *s) "[%p] Binding to IF_MTD drive" | ||
192 | +m25p80_binding_no_bdrv(void *s) "[%p] No BDRV - binding to RAM" | ||
193 | -- | ||
194 | 2.20.1 | ||
195 | |||
196 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Guenter Roeck <linux@roeck-us.net> | ||
1 | 2 | ||
3 | When requesting JEDEC data using the JEDEC_READ command, the Linux kernel | ||
4 | always requests 6 bytes. The current implementation only returns three | ||
5 | bytes, and interprets the remaining three bytes as new commands. | ||
6 | While this does not matter most of the time, it is at the very least | ||
7 | confusing. To avoid the problem, always report up to 6 bytes of JEDEC | ||
8 | data. Fill remaining data with 0. | ||
9 | |||
10 | Signed-off-by: Guenter Roeck <linux@roeck-us.net> | ||
11 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
12 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | ||
13 | Reviewed-by: Cédric Le Goater <clg@kaod.org> | ||
14 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
15 | --- | ||
16 | hw/block/m25p80.c | 5 ++++- | ||
17 | 1 file changed, 4 insertions(+), 1 deletion(-) | ||
18 | |||
19 | diff --git a/hw/block/m25p80.c b/hw/block/m25p80.c | ||
20 | index XXXXXXX..XXXXXXX 100644 | ||
21 | --- a/hw/block/m25p80.c | ||
22 | +++ b/hw/block/m25p80.c | ||
23 | @@ -XXX,XX +XXX,XX @@ static void decode_new_cmd(Flash *s, uint32_t value) | ||
24 | for (i = 0; i < s->pi->id_len; i++) { | ||
25 | s->data[i] = s->pi->id[i]; | ||
26 | } | ||
27 | + for (; i < SPI_NOR_MAX_ID_LEN; i++) { | ||
28 | + s->data[i] = 0; | ||
29 | + } | ||
30 | |||
31 | - s->len = s->pi->id_len; | ||
32 | + s->len = SPI_NOR_MAX_ID_LEN; | ||
33 | s->pos = 0; | ||
34 | s->state = STATE_READING_DATA; | ||
35 | break; | ||
36 | -- | ||
37 | 2.20.1 | ||
38 | |||
39 | diff view generated by jsdifflib |
1 | From: Jean-Hugues Deschênes <Jean-Hugues.Deschenes@ossiaco.com> | 1 | From: Guenter Roeck <linux@roeck-us.net> |
---|---|---|---|
2 | 2 | ||
3 | According to the PushStack() pseudocode in the armv7m RM, | 3 | Whenever an unsupported command is encountered, the current code |
4 | bit 4 of the LR should be set to NOT(CONTROL.PFCA) when | 4 | interprets each transferred byte as new command. Most of the time, those |
5 | an FPU is present. Current implementation is doing it for | 5 | 'commands' are interpreted as new unknown commands. However, in rare |
6 | armv8, but not for armv7. This patch makes the existing | 6 | cases, it may be that for example address or length information |
7 | logic applicable to both code paths. | 7 | passed with the original command is by itself a valid command. |
8 | If that happens, the state machine may get completely confused and, | ||
9 | worst case, start writing data into the flash or even erase it. | ||
8 | 10 | ||
9 | Signed-off-by: Jean-Hugues Deschenes <jean-hugues.deschenes@ossiaco.com> | 11 | To avoid the problem, transition into STATE_READING_DATA and keep |
10 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 12 | sending a value of 0 until the chip is deselected after encountering |
13 | an unsupported command. | ||
14 | |||
15 | Signed-off-by: Guenter Roeck <linux@roeck-us.net> | ||
16 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
17 | Reviewed-by: Cédric Le Goater <clg@kaod.org> | ||
11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 18 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
12 | --- | 19 | --- |
13 | target/arm/m_helper.c | 7 +++---- | 20 | hw/block/m25p80.c | 5 +++++ |
14 | 1 file changed, 3 insertions(+), 4 deletions(-) | 21 | 1 file changed, 5 insertions(+) |
15 | 22 | ||
16 | diff --git a/target/arm/m_helper.c b/target/arm/m_helper.c | 23 | diff --git a/hw/block/m25p80.c b/hw/block/m25p80.c |
17 | index XXXXXXX..XXXXXXX 100644 | 24 | index XXXXXXX..XXXXXXX 100644 |
18 | --- a/target/arm/m_helper.c | 25 | --- a/hw/block/m25p80.c |
19 | +++ b/target/arm/m_helper.c | 26 | +++ b/hw/block/m25p80.c |
20 | @@ -XXX,XX +XXX,XX @@ void arm_v7m_cpu_do_interrupt(CPUState *cs) | 27 | @@ -XXX,XX +XXX,XX @@ static void decode_new_cmd(Flash *s, uint32_t value) |
21 | if (env->v7m.secure) { | 28 | s->quad_enable = false; |
22 | lr |= R_V7M_EXCRET_S_MASK; | 29 | break; |
23 | } | 30 | default: |
24 | - if (!(env->v7m.control[M_REG_S] & R_V7M_CONTROL_FPCA_MASK)) { | 31 | + s->pos = 0; |
25 | - lr |= R_V7M_EXCRET_FTYPE_MASK; | 32 | + s->len = 1; |
26 | - } | 33 | + s->state = STATE_READING_DATA; |
27 | } else { | 34 | + s->data_read_loop = true; |
28 | lr = R_V7M_EXCRET_RES1_MASK | | 35 | + s->data[0] = 0; |
29 | R_V7M_EXCRET_S_MASK | | 36 | qemu_log_mask(LOG_GUEST_ERROR, "M25P80: Unknown cmd %x\n", value); |
30 | R_V7M_EXCRET_DCRS_MASK | | 37 | break; |
31 | - R_V7M_EXCRET_FTYPE_MASK | | ||
32 | R_V7M_EXCRET_ES_MASK; | ||
33 | if (env->v7m.control[M_REG_NS] & R_V7M_CONTROL_SPSEL_MASK) { | ||
34 | lr |= R_V7M_EXCRET_SPSEL_MASK; | ||
35 | } | ||
36 | } | ||
37 | + if (!(env->v7m.control[M_REG_S] & R_V7M_CONTROL_FPCA_MASK)) { | ||
38 | + lr |= R_V7M_EXCRET_FTYPE_MASK; | ||
39 | + } | ||
40 | if (!arm_v7m_is_handler_mode(env)) { | ||
41 | lr |= R_V7M_EXCRET_MODE_MASK; | ||
42 | } | 38 | } |
43 | -- | 39 | -- |
44 | 2.20.1 | 40 | 2.20.1 |
45 | 41 | ||
46 | 42 | diff view generated by jsdifflib |
1 | From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com> | 1 | From: Guenter Roeck <linux@roeck-us.net> |
---|---|---|---|
2 | 2 | ||
3 | Add the CRP as unimplemented thus avoiding bus errors when | 3 | The Linux kernel recently started using FAST_READ_4 commands. |
4 | guests access these registers. | 4 | This results in flash read failures. At the same time, the m25p80 |
5 | emulation is seen to read 8 more bytes than expected. Adjusting the | ||
6 | expected number of dummy cycles to match FAST_READ fixes the problem. | ||
5 | 7 | ||
6 | Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | 8 | Fixes: f95c4bffdc4c ("aspeed/smc: snoop SPI transfers to fake dummy cycles") |
7 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | 9 | Reviewed-by: Cédric Le Goater <clg@kaod.org> |
8 | Reviewed-by: Luc Michel <luc.michel@greensocs.com> | 10 | Signed-off-by: Guenter Roeck <linux@roeck-us.net> |
9 | Message-id: 20191115154734.26449-2-edgar.iglesias@gmail.com | 11 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> |
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
11 | --- | 13 | --- |
12 | include/hw/arm/xlnx-versal.h | 3 +++ | 14 | hw/ssi/aspeed_smc.c | 2 +- |
13 | hw/arm/xlnx-versal.c | 2 ++ | 15 | 1 file changed, 1 insertion(+), 1 deletion(-) |
14 | 2 files changed, 5 insertions(+) | ||
15 | 16 | ||
16 | diff --git a/include/hw/arm/xlnx-versal.h b/include/hw/arm/xlnx-versal.h | 17 | diff --git a/hw/ssi/aspeed_smc.c b/hw/ssi/aspeed_smc.c |
17 | index XXXXXXX..XXXXXXX 100644 | 18 | index XXXXXXX..XXXXXXX 100644 |
18 | --- a/include/hw/arm/xlnx-versal.h | 19 | --- a/hw/ssi/aspeed_smc.c |
19 | +++ b/include/hw/arm/xlnx-versal.h | 20 | +++ b/hw/ssi/aspeed_smc.c |
20 | @@ -XXX,XX +XXX,XX @@ typedef struct Versal { | 21 | @@ -XXX,XX +XXX,XX @@ static int aspeed_smc_num_dummies(uint8_t command) |
21 | #define MM_IOU_SCNTRS_SIZE 0x10000 | 22 | case FAST_READ: |
22 | #define MM_FPD_CRF 0xfd1a0000U | 23 | case DOR: |
23 | #define MM_FPD_CRF_SIZE 0x140000 | 24 | case QOR: |
24 | + | 25 | + case FAST_READ_4: |
25 | +#define MM_PMC_CRP 0xf1260000U | 26 | case DOR_4: |
26 | +#define MM_PMC_CRP_SIZE 0x10000 | 27 | case QOR_4: |
27 | #endif | 28 | return 1; |
28 | diff --git a/hw/arm/xlnx-versal.c b/hw/arm/xlnx-versal.c | 29 | case DIOR: |
29 | index XXXXXXX..XXXXXXX 100644 | 30 | - case FAST_READ_4: |
30 | --- a/hw/arm/xlnx-versal.c | 31 | case DIOR_4: |
31 | +++ b/hw/arm/xlnx-versal.c | 32 | return 2; |
32 | @@ -XXX,XX +XXX,XX @@ static void versal_unimp(Versal *s) | 33 | case QIOR: |
33 | MM_CRL, MM_CRL_SIZE); | ||
34 | versal_unimp_area(s, "crf", &s->mr_ps, | ||
35 | MM_FPD_CRF, MM_FPD_CRF_SIZE); | ||
36 | + versal_unimp_area(s, "crp", &s->mr_ps, | ||
37 | + MM_PMC_CRP, MM_PMC_CRP_SIZE); | ||
38 | versal_unimp_area(s, "iou-scntr", &s->mr_ps, | ||
39 | MM_IOU_SCNTR, MM_IOU_SCNTR_SIZE); | ||
40 | versal_unimp_area(s, "iou-scntr-seucre", &s->mr_ps, | ||
41 | -- | 34 | -- |
42 | 2.20.1 | 35 | 2.20.1 |
43 | 36 | ||
44 | 37 | diff view generated by jsdifflib |
1 | From: Marc Zyngier <maz@kernel.org> | 1 | From: Guenter Roeck <linux@roeck-us.net> |
---|---|---|---|
2 | 2 | ||
3 | The ARMv8 ARM states when executing at EL2, EL3 or Secure EL1, | 3 | PXA255 does not support a USB OHCI controller, so don't wire it up. |
4 | ISR_EL1 shows the pending status of the physical IRQ, FIQ, or | ||
5 | SError interrupts. | ||
6 | 4 | ||
7 | Unfortunately, QEMU's implementation only considers the HCR_EL2 | 5 | Signed-off-by: Guenter Roeck <linux@roeck-us.net> |
8 | bits, and ignores the current exception level. This means a hypervisor | 6 | Message-id: 20200313160215.28155-1-linux@roeck-us.net |
9 | trying to look at its own interrupt state actually sees the guest | ||
10 | state, which is unexpected and breaks KVM as of Linux 5.3. | ||
11 | |||
12 | Instead, check for the running EL and return the physical bits | ||
13 | if not running in a virtualized context. | ||
14 | |||
15 | Fixes: 636540e9c40b | ||
16 | Cc: qemu-stable@nongnu.org | ||
17 | Reported-by: Quentin Perret <qperret@google.com> | ||
18 | Signed-off-by: Marc Zyngier <maz@kernel.org> | ||
19 | Message-id: 20191122135833.28953-1-maz@kernel.org | ||
20 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
21 | Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | ||
22 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
23 | --- | 9 | --- |
24 | target/arm/helper.c | 7 +++++-- | 10 | hw/arm/pxa2xx.c | 3 --- |
25 | 1 file changed, 5 insertions(+), 2 deletions(-) | 11 | 1 file changed, 3 deletions(-) |
26 | 12 | ||
27 | diff --git a/target/arm/helper.c b/target/arm/helper.c | 13 | diff --git a/hw/arm/pxa2xx.c b/hw/arm/pxa2xx.c |
28 | index XXXXXXX..XXXXXXX 100644 | 14 | index XXXXXXX..XXXXXXX 100644 |
29 | --- a/target/arm/helper.c | 15 | --- a/hw/arm/pxa2xx.c |
30 | +++ b/target/arm/helper.c | 16 | +++ b/hw/arm/pxa2xx.c |
31 | @@ -XXX,XX +XXX,XX @@ static uint64_t isr_read(CPUARMState *env, const ARMCPRegInfo *ri) | 17 | @@ -XXX,XX +XXX,XX @@ PXA2xxState *pxa255_init(MemoryRegion *address_space, unsigned int sdram_size) |
32 | CPUState *cs = env_cpu(env); | 18 | s->ssp[i] = (SSIBus *)qdev_get_child_bus(dev, "ssi"); |
33 | uint64_t hcr_el2 = arm_hcr_el2_eff(env); | ||
34 | uint64_t ret = 0; | ||
35 | + bool allow_virt = (arm_current_el(env) == 1 && | ||
36 | + (!arm_is_secure_below_el3(env) || | ||
37 | + (env->cp15.scr_el3 & SCR_EEL2))); | ||
38 | |||
39 | - if (hcr_el2 & HCR_IMO) { | ||
40 | + if (allow_virt && (hcr_el2 & HCR_IMO)) { | ||
41 | if (cs->interrupt_request & CPU_INTERRUPT_VIRQ) { | ||
42 | ret |= CPSR_I; | ||
43 | } | ||
44 | @@ -XXX,XX +XXX,XX @@ static uint64_t isr_read(CPUARMState *env, const ARMCPRegInfo *ri) | ||
45 | } | ||
46 | } | 19 | } |
47 | 20 | ||
48 | - if (hcr_el2 & HCR_FMO) { | 21 | - sysbus_create_simple("sysbus-ohci", 0x4c000000, |
49 | + if (allow_virt && (hcr_el2 & HCR_FMO)) { | 22 | - qdev_get_gpio_in(s->pic, PXA2XX_PIC_USBH1)); |
50 | if (cs->interrupt_request & CPU_INTERRUPT_VFIQ) { | 23 | - |
51 | ret |= CPSR_F; | 24 | s->pcmcia[0] = pxa2xx_pcmcia_init(address_space, 0x20000000); |
52 | } | 25 | s->pcmcia[1] = pxa2xx_pcmcia_init(address_space, 0x30000000); |
26 | |||
53 | -- | 27 | -- |
54 | 2.20.1 | 28 | 2.20.1 |
55 | 29 | ||
56 | 30 | diff view generated by jsdifflib |