1 | Not very much here, but several people have fallen over | 1 | Latest arm queue, a mixed bag of features and bug fixes. |
---|---|---|---|
2 | the vector operation segfault bug, so let's get the fix | ||
3 | into master. | ||
4 | 2 | ||
5 | thanks | 3 | thanks |
6 | -- PMM | 4 | -- PMM |
7 | 5 | ||
8 | The following changes since commit d418238dca7b4e0b124135827ead3076233052b1: | 6 | The following changes since commit cbf01142b2aef0c0b4e995cecd7e79d342bbc47e: |
9 | 7 | ||
10 | Merge remote-tracking branch 'remotes/rth/tags/pull-rng-20190522' into staging (2019-05-23 12:57:17 +0100) | 8 | Merge remote-tracking branch 'remotes/rth/tags/pull-tcg-20200115' into staging (2020-01-17 12:13:17 +0000) |
11 | 9 | ||
12 | are available in the Git repository at: | 10 | are available in the Git repository at: |
13 | 11 | ||
14 | https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20190523 | 12 | https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20200117-1 |
15 | 13 | ||
16 | for you to fetch changes up to 98e4f4fdb8ea05d840f51f47125924c2bb9df2df: | 14 | for you to fetch changes up to 1a1fbc6cbb34c26d43d8360c66c1d21681af14a9: |
17 | 15 | ||
18 | hw/arm/exynos4210: QOM'ify the Exynos4210 SoC (2019-05-23 14:47:44 +0100) | 16 | target/arm: Set ISSIs16Bit in make_issinfo (2020-01-17 14:27:16 +0000) |
19 | 17 | ||
20 | ---------------------------------------------------------------- | 18 | ---------------------------------------------------------------- |
21 | target-arm queue: | 19 | Add model of the Netduino Plus 2 board |
22 | * exynos4210: QOM'ify the Exynos4210 SoC | 20 | Some allwinner-a10 code cleanup |
23 | * exynos4210: Add DMA support for the Exynos4210 | 21 | New test cases for cubieboard |
24 | * arm_gicv3: Fix writes to ICC_CTLR_EL3 | 22 | target/arm/arm-semi: fix SYS_OPEN to return nonzero filehandle |
25 | * arm_gicv3: Fix write of ICH_VMCR_EL2.{VBPR0, VBPR1} | 23 | i.MX: add an emulation for RNGC device |
26 | * target/arm: Fix vector operation segfault | 24 | target/arm: adjust program counter for wfi exception in AArch32 |
27 | * target/arm: Minor improvements to BFXIL, EXTR | 25 | arm/gicv3: update virtual irq state after IAR register read |
26 | Set IL bit correctly for syndrome information for data aborts | ||
28 | 27 | ||
29 | ---------------------------------------------------------------- | 28 | ---------------------------------------------------------------- |
30 | Alistair Francis (1): | 29 | Alistair Francis (4): |
31 | target/arm: Fix vector operation segfault | 30 | hw/misc: Add the STM32F4xx Sysconfig device |
31 | hw/misc: Add the STM32F4xx EXTI device | ||
32 | hw/arm: Add the STM32F4xx SoC | ||
33 | hw/arm: Add the Netduino Plus 2 | ||
32 | 34 | ||
33 | Guenter Roeck (1): | 35 | Jeff Kubascik (3): |
34 | hw/arm/exynos4210: Add DMA support for the Exynos4210 | 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 | ||
35 | 39 | ||
36 | Peter Maydell (5): | 40 | Martin Kaiser (1): |
37 | arm: Move system_clock_scale to armv7m_systick.h | 41 | i.MX: add an emulation for RNGC |
38 | arm: Remove unnecessary includes of hw/arm/arm.h | ||
39 | arm: Rename hw/arm/arm.h to hw/arm/boot.h | ||
40 | hw/intc/arm_gicv3: Fix write of ICH_VMCR_EL2.{VBPR0, VBPR1} | ||
41 | hw/intc/arm_gicv3: Fix writes to ICC_CTLR_EL3 | ||
42 | 42 | ||
43 | Philippe Mathieu-Daudé (3): | 43 | Masahiro Yamada (1): |
44 | hw/arm/exynos4: Remove unuseful debug code | 44 | target/arm/arm-semi: fix SYS_OPEN to return nonzero filehandle |
45 | hw/arm/exynos4: Use the IEC binary prefix definitions | ||
46 | hw/arm/exynos4210: QOM'ify the Exynos4210 SoC | ||
47 | 45 | ||
48 | Richard Henderson (2): | 46 | Philippe Mathieu-Daudé (5): |
49 | target/arm: Use extract2 for EXTR | 47 | tests/boot_linux_console: Add initrd test for the CubieBoard |
50 | target/arm: Simplify BFXIL expansion | 48 | tests/boot_linux_console: Add a SD card test for the CubieBoard |
49 | hw/arm/allwinner-a10: Move SoC definitions out of header | ||
50 | hw/arm/allwinner-a10: Simplify by passing IRQs with qdev_pass_gpios() | ||
51 | hw/arm/allwinner-a10: Remove local qemu_irq variables | ||
51 | 52 | ||
52 | include/hw/arm/allwinner-a10.h | 2 +- | 53 | Richard Henderson (1): |
53 | include/hw/arm/aspeed_soc.h | 1 - | 54 | target/arm: Set ISSIs16Bit in make_issinfo |
54 | include/hw/arm/bcm2836.h | 1 - | ||
55 | include/hw/arm/{arm.h => boot.h} | 12 +++------ | ||
56 | include/hw/arm/exynos4210.h | 9 +++++-- | ||
57 | include/hw/arm/fsl-imx25.h | 2 +- | ||
58 | include/hw/arm/fsl-imx31.h | 2 +- | ||
59 | include/hw/arm/fsl-imx6.h | 2 +- | ||
60 | include/hw/arm/fsl-imx6ul.h | 2 +- | ||
61 | include/hw/arm/fsl-imx7.h | 2 +- | ||
62 | include/hw/arm/virt.h | 2 +- | ||
63 | include/hw/arm/xlnx-versal.h | 2 +- | ||
64 | include/hw/arm/xlnx-zynqmp.h | 2 +- | ||
65 | include/hw/timer/armv7m_systick.h | 22 ++++++++++++++++ | ||
66 | hw/arm/armsse.c | 2 +- | ||
67 | hw/arm/armv7m.c | 2 +- | ||
68 | hw/arm/aspeed.c | 2 +- | ||
69 | hw/arm/boot.c | 2 +- | ||
70 | hw/arm/collie.c | 2 +- | ||
71 | hw/arm/exynos4210.c | 54 ++++++++++++++++++++++++++++++++++++--- | ||
72 | hw/arm/exynos4_boards.c | 40 ++++++++--------------------- | ||
73 | hw/arm/highbank.c | 2 +- | ||
74 | hw/arm/integratorcp.c | 2 +- | ||
75 | hw/arm/mainstone.c | 2 +- | ||
76 | hw/arm/microbit.c | 2 +- | ||
77 | hw/arm/mps2-tz.c | 2 +- | ||
78 | hw/arm/mps2.c | 2 +- | ||
79 | hw/arm/msf2-soc.c | 1 - | ||
80 | hw/arm/msf2-som.c | 2 +- | ||
81 | hw/arm/musca.c | 2 +- | ||
82 | hw/arm/musicpal.c | 2 +- | ||
83 | hw/arm/netduino2.c | 2 +- | ||
84 | hw/arm/nrf51_soc.c | 2 +- | ||
85 | hw/arm/nseries.c | 2 +- | ||
86 | hw/arm/omap1.c | 2 +- | ||
87 | hw/arm/omap2.c | 2 +- | ||
88 | hw/arm/omap_sx1.c | 2 +- | ||
89 | hw/arm/palm.c | 2 +- | ||
90 | hw/arm/raspi.c | 2 +- | ||
91 | hw/arm/realview.c | 2 +- | ||
92 | hw/arm/spitz.c | 2 +- | ||
93 | hw/arm/stellaris.c | 2 +- | ||
94 | hw/arm/stm32f205_soc.c | 2 +- | ||
95 | hw/arm/strongarm.c | 2 +- | ||
96 | hw/arm/tosa.c | 2 +- | ||
97 | hw/arm/versatilepb.c | 2 +- | ||
98 | hw/arm/vexpress.c | 2 +- | ||
99 | hw/arm/virt.c | 2 +- | ||
100 | hw/arm/xilinx_zynq.c | 2 +- | ||
101 | hw/arm/xlnx-versal.c | 2 +- | ||
102 | hw/arm/z2.c | 2 +- | ||
103 | hw/intc/arm_gicv3_cpuif.c | 6 ++--- | ||
104 | hw/intc/armv7m_nvic.c | 1 - | ||
105 | target/arm/arm-semi.c | 1 - | ||
106 | target/arm/cpu.c | 1 - | ||
107 | target/arm/cpu64.c | 1 - | ||
108 | target/arm/kvm.c | 1 - | ||
109 | target/arm/kvm32.c | 1 - | ||
110 | target/arm/kvm64.c | 1 - | ||
111 | target/arm/translate-a64.c | 44 ++++++++++++++++--------------- | ||
112 | target/arm/translate.c | 4 +-- | ||
113 | 61 files changed, 164 insertions(+), 123 deletions(-) | ||
114 | rename include/hw/arm/{arm.h => boot.h} (96%) | ||
115 | 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 ICC_CTLR_EL3 register includes some bits which are aliases | 1 | From: Alistair Francis <alistair@alistair23.me> |
---|---|---|---|
2 | of bits in the ICC_CTLR_EL1(S) and (NS) registers. QEMU chooses | ||
3 | to keep those bits in the cs->icc_ctlr_el1[] struct fields. | ||
4 | Unfortunately a missing '~' in the code to update the bits | ||
5 | in those fields meant that writing to ICC_CTLR_EL3 would corrupt | ||
6 | the ICC_CLTR_EL1 register values. | ||
7 | 2 | ||
3 | Signed-off-by: Alistair Francis <alistair@alistair23.me> | ||
4 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
5 | Message-id: 49b01423a09cef2ca832ff73a84a996568f1a8fc.1576658572.git.alistair@alistair23.me | ||
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
9 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
10 | Message-id: 20190520162809.2677-5-peter.maydell@linaro.org | ||
11 | --- | 7 | --- |
12 | hw/intc/arm_gicv3_cpuif.c | 4 ++-- | 8 | hw/misc/Makefile.objs | 1 + |
13 | 1 file changed, 2 insertions(+), 2 deletions(-) | 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 | ||
14 | 18 | ||
15 | diff --git a/hw/intc/arm_gicv3_cpuif.c b/hw/intc/arm_gicv3_cpuif.c | 19 | diff --git a/hw/misc/Makefile.objs b/hw/misc/Makefile.objs |
16 | index XXXXXXX..XXXXXXX 100644 | 20 | index XXXXXXX..XXXXXXX 100644 |
17 | --- a/hw/intc/arm_gicv3_cpuif.c | 21 | --- a/hw/misc/Makefile.objs |
18 | +++ b/hw/intc/arm_gicv3_cpuif.c | 22 | +++ b/hw/misc/Makefile.objs |
19 | @@ -XXX,XX +XXX,XX @@ static void icc_ctlr_el3_write(CPUARMState *env, const ARMCPRegInfo *ri, | 23 | @@ -XXX,XX +XXX,XX @@ common-obj-$(CONFIG_SLAVIO) += slavio_misc.o |
20 | trace_gicv3_icc_ctlr_el3_write(gicv3_redist_affid(cs), value); | 24 | common-obj-$(CONFIG_ZYNQ) += zynq_slcr.o |
21 | 25 | common-obj-$(CONFIG_ZYNQ) += zynq-xadc.o | |
22 | /* *_EL1NS and *_EL1S bits are aliases into the ICC_CTLR_EL1 bits. */ | 26 | common-obj-$(CONFIG_STM32F2XX_SYSCFG) += stm32f2xx_syscfg.o |
23 | - cs->icc_ctlr_el1[GICV3_NS] &= (ICC_CTLR_EL1_CBPR | ICC_CTLR_EL1_EOIMODE); | 27 | +common-obj-$(CONFIG_STM32F4XX_SYSCFG) += stm32f4xx_syscfg.o |
24 | + cs->icc_ctlr_el1[GICV3_NS] &= ~(ICC_CTLR_EL1_CBPR | ICC_CTLR_EL1_EOIMODE); | 28 | obj-$(CONFIG_MIPS_CPS) += mips_cmgcr.o |
25 | if (value & ICC_CTLR_EL3_EOIMODE_EL1NS) { | 29 | obj-$(CONFIG_MIPS_CPS) += mips_cpc.o |
26 | cs->icc_ctlr_el1[GICV3_NS] |= ICC_CTLR_EL1_EOIMODE; | 30 | obj-$(CONFIG_MIPS_ITU) += mips_itu.o |
27 | } | 31 | diff --git a/include/hw/misc/stm32f4xx_syscfg.h b/include/hw/misc/stm32f4xx_syscfg.h |
28 | @@ -XXX,XX +XXX,XX @@ static void icc_ctlr_el3_write(CPUARMState *env, const ARMCPRegInfo *ri, | 32 | new file mode 100644 |
29 | cs->icc_ctlr_el1[GICV3_NS] |= ICC_CTLR_EL1_CBPR; | 33 | index XXXXXXX..XXXXXXX |
30 | } | 34 | --- /dev/null |
31 | 35 | +++ b/include/hw/misc/stm32f4xx_syscfg.h | |
32 | - cs->icc_ctlr_el1[GICV3_S] &= (ICC_CTLR_EL1_CBPR | ICC_CTLR_EL1_EOIMODE); | 36 | @@ -XXX,XX +XXX,XX @@ |
33 | + cs->icc_ctlr_el1[GICV3_S] &= ~(ICC_CTLR_EL1_CBPR | ICC_CTLR_EL1_EOIMODE); | 37 | +/* |
34 | if (value & ICC_CTLR_EL3_EOIMODE_EL1S) { | 38 | + * STM32F4xx SYSCFG |
35 | cs->icc_ctlr_el1[GICV3_S] |= ICC_CTLR_EL1_EOIMODE; | 39 | + * |
36 | } | 40 | + * Copyright (c) 2014 Alistair Francis <alistair@alistair23.me> |
41 | + * | ||
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. | ||
59 | + */ | ||
60 | + | ||
61 | +#ifndef HW_STM_SYSCFG_H | ||
62 | +#define HW_STM_SYSCFG_H | ||
63 | + | ||
64 | +#include "hw/sysbus.h" | ||
65 | +#include "hw/hw.h" | ||
66 | + | ||
67 | +#define SYSCFG_MEMRMP 0x00 | ||
68 | +#define SYSCFG_PMC 0x04 | ||
69 | +#define SYSCFG_EXTICR1 0x08 | ||
70 | +#define SYSCFG_EXTICR2 0x0C | ||
71 | +#define SYSCFG_EXTICR3 0x10 | ||
72 | +#define SYSCFG_EXTICR4 0x14 | ||
73 | +#define SYSCFG_CMPCR 0x20 | ||
74 | + | ||
75 | +#define TYPE_STM32F4XX_SYSCFG "stm32f4xx-syscfg" | ||
76 | +#define STM32F4XX_SYSCFG(obj) \ | ||
77 | + OBJECT_CHECK(STM32F4xxSyscfgState, (obj), TYPE_STM32F4XX_SYSCFG) | ||
78 | + | ||
79 | +#define SYSCFG_NUM_EXTICR 4 | ||
80 | + | ||
81 | +typedef struct { | ||
82 | + /* <private> */ | ||
83 | + SysBusDevice parent_obj; | ||
84 | + | ||
85 | + /* <public> */ | ||
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 | ||
103 | @@ -XXX,XX +XXX,XX @@ | ||
104 | +/* | ||
105 | + * STM32F4xx SYSCFG | ||
106 | + * | ||
107 | + * Copyright (c) 2014 Alistair Francis <alistair@alistair23.me> | ||
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, | ||
223 | +}; | ||
224 | + | ||
225 | +static void stm32f4xx_syscfg_init(Object *obj) | ||
226 | +{ | ||
227 | + STM32F4xxSyscfgState *s = STM32F4XX_SYSCFG(obj); | ||
228 | + | ||
229 | + sysbus_init_irq(SYS_BUS_DEVICE(obj), &s->irq); | ||
230 | + | ||
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 | + } | ||
251 | +}; | ||
252 | + | ||
253 | +static void stm32f4xx_syscfg_class_init(ObjectClass *klass, void *data) | ||
254 | +{ | ||
255 | + DeviceClass *dc = DEVICE_CLASS(klass); | ||
256 | + | ||
257 | + dc->reset = stm32f4xx_syscfg_reset; | ||
258 | + dc->vmsd = &vmstate_stm32f4xx_syscfg; | ||
259 | +} | ||
260 | + | ||
261 | +static const TypeInfo stm32f4xx_syscfg_info = { | ||
262 | + .name = TYPE_STM32F4XX_SYSCFG, | ||
263 | + .parent = TYPE_SYS_BUS_DEVICE, | ||
264 | + .instance_size = sizeof(STM32F4xxSyscfgState), | ||
265 | + .instance_init = stm32f4xx_syscfg_init, | ||
266 | + .class_init = stm32f4xx_syscfg_class_init, | ||
267 | +}; | ||
268 | + | ||
269 | +static void stm32f4xx_syscfg_register_types(void) | ||
270 | +{ | ||
271 | + type_register_static(&stm32f4xx_syscfg_info); | ||
272 | +} | ||
273 | + | ||
274 | +type_init(stm32f4xx_syscfg_register_types) | ||
275 | diff --git a/default-configs/arm-softmmu.mak b/default-configs/arm-softmmu.mak | ||
276 | index XXXXXXX..XXXXXXX 100644 | ||
277 | --- a/default-configs/arm-softmmu.mak | ||
278 | +++ b/default-configs/arm-softmmu.mak | ||
279 | @@ -XXX,XX +XXX,XX @@ CONFIG_Z2=y | ||
280 | CONFIG_COLLIE=y | ||
281 | CONFIG_ASPEED_SOC=y | ||
282 | CONFIG_NETDUINO2=y | ||
283 | +CONFIG_NETDUINOPLUS2=y | ||
284 | CONFIG_MPS2=y | ||
285 | CONFIG_RASPI=y | ||
286 | CONFIG_DIGIC=y | ||
287 | diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig | ||
288 | index XXXXXXX..XXXXXXX 100644 | ||
289 | --- a/hw/arm/Kconfig | ||
290 | +++ b/hw/arm/Kconfig | ||
291 | @@ -XXX,XX +XXX,XX @@ config NETDUINO2 | ||
292 | bool | ||
293 | select STM32F205_SOC | ||
294 | |||
295 | +config NETDUINOPLUS2 | ||
296 | + bool | ||
297 | + select STM32F405_SOC | ||
298 | + | ||
299 | config NSERIES | ||
300 | bool | ||
301 | select OMAP | ||
302 | @@ -XXX,XX +XXX,XX @@ config STM32F205_SOC | ||
303 | select STM32F2XX_ADC | ||
304 | select STM32F2XX_SPI | ||
305 | |||
306 | +config STM32F405_SOC | ||
307 | + bool | ||
308 | + select ARM_V7M | ||
309 | + select STM32F4XX_SYSCFG | ||
310 | + | ||
311 | config XLNX_ZYNQMP_ARM | ||
312 | bool | ||
313 | select AHCI | ||
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" | ||
37 | -- | 345 | -- |
38 | 2.20.1 | 346 | 2.20.1 |
39 | 347 | ||
40 | 348 | 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: ef941d59fd8658589d34ed432e1d6dfdcf7fb1d0.1576658572.git.alistair@alistair23.me | ||
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 | ||
18 | |||
19 | diff --git a/hw/misc/Makefile.objs b/hw/misc/Makefile.objs | ||
20 | index XXXXXXX..XXXXXXX 100644 | ||
21 | --- a/hw/misc/Makefile.objs | ||
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 | ||
36 | @@ -XXX,XX +XXX,XX @@ | ||
37 | +/* | ||
38 | + * STM32F4XX EXTI | ||
39 | + * | ||
40 | + * Copyright (c) 2014 Alistair Francis <alistair@alistair23.me> | ||
41 | + * | ||
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. | ||
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 | + | ||
96 | +#endif | ||
97 | diff --git a/hw/misc/stm32f4xx_exti.c b/hw/misc/stm32f4xx_exti.c | ||
98 | new file mode 100644 | ||
99 | index XXXXXXX..XXXXXXX | ||
100 | --- /dev/null | ||
101 | +++ b/hw/misc/stm32f4xx_exti.c | ||
102 | @@ -XXX,XX +XXX,XX @@ | ||
103 | +/* | ||
104 | + * STM32F4XX EXTI | ||
105 | + * | ||
106 | + * Copyright (c) 2014 Alistair Francis <alistair@alistair23.me> | ||
107 | + * | ||
108 | + * Permission is hereby granted, free of charge, to any person obtaining a copy | ||
109 | + * of this software and associated documentation files (the "Software"), to deal | ||
110 | + * in the Software without restriction, including without limitation the rights | ||
111 | + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
112 | + * copies of the Software, and to permit persons to whom the Software is | ||
113 | + * furnished to do so, subject to the following conditions: | ||
114 | + * | ||
115 | + * The above copyright notice and this permission notice shall be included in | ||
116 | + * all copies or substantial portions of the Software. | ||
117 | + * | ||
118 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
119 | + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
120 | + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
121 | + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
122 | + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
123 | + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
124 | + * THE SOFTWARE. | ||
125 | + */ | ||
126 | + | ||
127 | +#include "qemu/osdep.h" | ||
128 | +#include "qemu/log.h" | ||
129 | +#include "trace.h" | ||
130 | +#include "hw/irq.h" | ||
131 | +#include "migration/vmstate.h" | ||
132 | +#include "hw/misc/stm32f4xx_exti.h" | ||
133 | + | ||
134 | +static void stm32f4xx_exti_reset(DeviceState *dev) | ||
135 | +{ | ||
136 | + STM32F4xxExtiState *s = STM32F4XX_EXTI(dev); | ||
137 | + | ||
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 | ||
292 | index XXXXXXX..XXXXXXX 100644 | ||
293 | --- a/hw/arm/Kconfig | ||
294 | +++ b/hw/arm/Kconfig | ||
295 | @@ -XXX,XX +XXX,XX @@ config STM32F405_SOC | ||
296 | bool | ||
297 | select ARM_V7M | ||
298 | select STM32F4XX_SYSCFG | ||
299 | + select STM32F4XX_EXTI | ||
300 | |||
301 | config XLNX_ZYNQMP_ARM | ||
302 | bool | ||
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" | ||
333 | -- | ||
334 | 2.20.1 | ||
335 | |||
336 | diff view generated by jsdifflib |
1 | From: Philippe Mathieu-Daudé <philmd@redhat.com> | 1 | From: Alistair Francis <alistair@alistair23.me> |
---|---|---|---|
2 | 2 | ||
3 | Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> | 3 | Signed-off-by: Alistair Francis <alistair@alistair23.me> |
4 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | 4 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
5 | Message-id: 20190520214342.13709-5-philmd@redhat.com | 5 | Message-id: 1d145c4c13e5fa140caf131232a6f524c88fcd72.1576658572.git.alistair@alistair23.me |
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
7 | --- | 7 | --- |
8 | include/hw/arm/exynos4210.h | 9 +++++++-- | 8 | hw/arm/Makefile.objs | 1 + |
9 | hw/arm/exynos4210.c | 28 ++++++++++++++++++++++++---- | 9 | include/hw/arm/stm32f405_soc.h | 73 ++++++++ |
10 | hw/arm/exynos4_boards.c | 9 ++++++--- | 10 | hw/arm/stm32f405_soc.c | 302 +++++++++++++++++++++++++++++++++ |
11 | 3 files changed, 37 insertions(+), 9 deletions(-) | 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 | ||
12 | 15 | ||
13 | diff --git a/include/hw/arm/exynos4210.h b/include/hw/arm/exynos4210.h | 16 | diff --git a/hw/arm/Makefile.objs b/hw/arm/Makefile.objs |
14 | index XXXXXXX..XXXXXXX 100644 | 17 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/include/hw/arm/exynos4210.h | 18 | --- a/hw/arm/Makefile.objs |
16 | +++ b/include/hw/arm/exynos4210.h | 19 | +++ b/hw/arm/Makefile.objs |
17 | @@ -XXX,XX +XXX,XX @@ typedef struct Exynos4210Irq { | 20 | @@ -XXX,XX +XXX,XX @@ obj-$(CONFIG_STRONGARM) += strongarm.o |
18 | } Exynos4210Irq; | 21 | obj-$(CONFIG_ALLWINNER_A10) += allwinner-a10.o cubieboard.o |
19 | 22 | obj-$(CONFIG_RASPI) += bcm2835_peripherals.o bcm2836.o raspi.o | |
20 | typedef struct Exynos4210State { | 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 { | ||
21 | + /*< private >*/ | 85 | + /*< private >*/ |
22 | + SysBusDevice parent_obj; | 86 | + SysBusDevice parent_obj; |
23 | + /*< public >*/ | 87 | + /*< public >*/ |
24 | ARMCPU *cpu[EXYNOS4210_NCPUS]; | 88 | + |
25 | Exynos4210Irq irqs; | 89 | + char *cpu_type; |
26 | qemu_irq *irq_table; | 90 | + |
27 | @@ -XXX,XX +XXX,XX @@ typedef struct Exynos4210State { | 91 | + ARMv7MState armv7m; |
28 | I2CBus *i2c_if[EXYNOS4210_I2C_NUMBER]; | 92 | + |
29 | } Exynos4210State; | 93 | + STM32F4xxSyscfgState syscfg; |
30 | 94 | + STM32F4xxExtiState exti; | |
31 | +#define TYPE_EXYNOS4210_SOC "exynos4210" | 95 | + STM32F2XXUsartState usart[STM_NUM_USARTS]; |
32 | +#define EXYNOS4210_SOC(obj) \ | 96 | + STM32F2XXTimerState timer[STM_NUM_TIMERS]; |
33 | + OBJECT_CHECK(Exynos4210State, obj, TYPE_EXYNOS4210_SOC) | 97 | + qemu_or_irq adc_irqs; |
34 | + | 98 | + STM32F2XXADCState adc[STM_NUM_ADCS]; |
35 | void exynos4210_write_secondary(ARMCPU *cpu, | 99 | + STM32F2XXSPIState spi[STM_NUM_SPIS]; |
36 | const struct arm_boot_info *info); | 100 | + |
37 | 101 | + MemoryRegion sram; | |
38 | -Exynos4210State *exynos4210_init(MemoryRegion *system_mem); | 102 | + MemoryRegion flash; |
39 | - | 103 | + MemoryRegion flash_alias; |
40 | /* Initialize exynos4210 IRQ subsystem stub */ | 104 | +} STM32F405State; |
41 | qemu_irq *exynos4210_init_irq(Exynos4210Irq *env); | 105 | + |
42 | 106 | +#endif | |
43 | diff --git a/hw/arm/exynos4210.c b/hw/arm/exynos4210.c | 107 | diff --git a/hw/arm/stm32f405_soc.c b/hw/arm/stm32f405_soc.c |
44 | index XXXXXXX..XXXXXXX 100644 | 108 | new file mode 100644 |
45 | --- a/hw/arm/exynos4210.c | 109 | index XXXXXXX..XXXXXXX |
46 | +++ b/hw/arm/exynos4210.c | 110 | --- /dev/null |
47 | @@ -XXX,XX +XXX,XX @@ static void pl330_create(uint32_t base, qemu_irq irq, int nreq) | 111 | +++ b/hw/arm/stm32f405_soc.c |
48 | sysbus_connect_irq(busdev, 0, irq); | 112 | @@ -XXX,XX +XXX,XX @@ |
49 | } | 113 | +/* |
50 | 114 | + * STM32F405 SoC | |
51 | -Exynos4210State *exynos4210_init(MemoryRegion *system_mem) | 115 | + * |
52 | +static void exynos4210_realize(DeviceState *socdev, Error **errp) | 116 | + * Copyright (c) 2014 Alistair Francis <alistair@alistair23.me> |
53 | { | 117 | + * |
54 | - Exynos4210State *s = g_new0(Exynos4210State, 1); | 118 | + * Permission is hereby granted, free of charge, to any person obtaining a copy |
55 | + Exynos4210State *s = EXYNOS4210_SOC(socdev); | 119 | + * of this software and associated documentation files (the "Software"), to deal |
56 | + MemoryRegion *system_mem = get_system_memory(); | 120 | + * in the Software without restriction, including without limitation the rights |
57 | qemu_irq gate_irq[EXYNOS4210_NCPUS][EXYNOS4210_IRQ_GATE_NINPUTS]; | 121 | + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
58 | SysBusDevice *busdev; | 122 | + * copies of the Software, and to permit persons to whom the Software is |
59 | DeviceState *dev; | 123 | + * furnished to do so, subject to the following conditions: |
60 | @@ -XXX,XX +XXX,XX @@ Exynos4210State *exynos4210_init(MemoryRegion *system_mem) | 124 | + * |
61 | qemu_irq_invert(s->irq_table[exynos4210_get_irq(36, 1)]), 32); | 125 | + * The above copyright notice and this permission notice shall be included in |
62 | pl330_create(EXYNOS4210_PL330_BASE2_ADDR, | 126 | + * all copies or substantial portions of the Software. |
63 | qemu_irq_invert(s->irq_table[exynos4210_get_irq(34, 1)]), 1); | 127 | + * |
64 | - | 128 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
65 | - return s; | 129 | + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
66 | } | 130 | + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
67 | + | 131 | + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
68 | +static void exynos4210_class_init(ObjectClass *klass, void *data) | 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) | ||
69 | +{ | 393 | +{ |
70 | + DeviceClass *dc = DEVICE_CLASS(klass); | 394 | + DeviceClass *dc = DEVICE_CLASS(klass); |
71 | + | 395 | + |
72 | + dc->realize = exynos4210_realize; | 396 | + dc->realize = stm32f405_soc_realize; |
397 | + dc->props = stm32f405_soc_properties; | ||
398 | + /* No vmstate or reset required: device has no internal state */ | ||
73 | +} | 399 | +} |
74 | + | 400 | + |
75 | +static const TypeInfo exynos4210_info = { | 401 | +static const TypeInfo stm32f405_soc_info = { |
76 | + .name = TYPE_EXYNOS4210_SOC, | 402 | + .name = TYPE_STM32F405_SOC, |
77 | + .parent = TYPE_SYS_BUS_DEVICE, | 403 | + .parent = TYPE_SYS_BUS_DEVICE, |
78 | + .instance_size = sizeof(Exynos4210State), | 404 | + .instance_size = sizeof(STM32F405State), |
79 | + .class_init = exynos4210_class_init, | 405 | + .instance_init = stm32f405_soc_initfn, |
406 | + .class_init = stm32f405_soc_class_init, | ||
80 | +}; | 407 | +}; |
81 | + | 408 | + |
82 | +static void exynos4210_register_types(void) | 409 | +static void stm32f405_soc_types(void) |
83 | +{ | 410 | +{ |
84 | + type_register_static(&exynos4210_info); | 411 | + type_register_static(&stm32f405_soc_info); |
85 | +} | 412 | +} |
86 | + | 413 | + |
87 | +type_init(exynos4210_register_types) | 414 | +type_init(stm32f405_soc_types) |
88 | diff --git a/hw/arm/exynos4_boards.c b/hw/arm/exynos4_boards.c | 415 | diff --git a/MAINTAINERS b/MAINTAINERS |
89 | index XXXXXXX..XXXXXXX 100644 | 416 | index XXXXXXX..XXXXXXX 100644 |
90 | --- a/hw/arm/exynos4_boards.c | 417 | --- a/MAINTAINERS |
91 | +++ b/hw/arm/exynos4_boards.c | 418 | +++ b/MAINTAINERS |
92 | @@ -XXX,XX +XXX,XX @@ typedef enum Exynos4BoardType { | 419 | @@ -XXX,XX +XXX,XX @@ F: hw/adc/* |
93 | } Exynos4BoardType; | 420 | F: hw/ssi/stm32f2xx_spi.c |
94 | 421 | F: include/hw/*/stm32*.h | |
95 | typedef struct Exynos4BoardState { | 422 | |
96 | - Exynos4210State *soc; | 423 | +STM32F405 |
97 | + Exynos4210State soc; | 424 | +M: Alistair Francis <alistair@alistair23.me> |
98 | MemoryRegion dram0_mem; | 425 | +M: Peter Maydell <peter.maydell@linaro.org> |
99 | MemoryRegion dram1_mem; | 426 | +S: Maintained |
100 | } Exynos4BoardState; | 427 | +F: hw/arm/stm32f405_soc.c |
101 | @@ -XXX,XX +XXX,XX @@ exynos4_boards_init_common(MachineState *machine, | 428 | +F: hw/misc/stm32f4xx_syscfg.c |
102 | exynos4_boards_init_ram(s, get_system_memory(), | 429 | +F: hw/misc/stm32f4xx_exti.c |
103 | exynos4_board_ram_size[board_type]); | 430 | + |
104 | 431 | Netduino 2 | |
105 | - s->soc = exynos4210_init(get_system_memory()); | 432 | M: Alistair Francis <alistair@alistair23.me> |
106 | + object_initialize(&s->soc, sizeof(s->soc), TYPE_EXYNOS4210_SOC); | 433 | M: Peter Maydell <peter.maydell@linaro.org> |
107 | + qdev_set_parent_bus(DEVICE(&s->soc), sysbus_get_default()); | ||
108 | + object_property_set_bool(OBJECT(&s->soc), true, "realized", | ||
109 | + &error_fatal); | ||
110 | |||
111 | return s; | ||
112 | } | ||
113 | @@ -XXX,XX +XXX,XX @@ static void smdkc210_init(MachineState *machine) | ||
114 | EXYNOS4_BOARD_SMDKC210); | ||
115 | |||
116 | lan9215_init(SMDK_LAN9118_BASE_ADDR, | ||
117 | - qemu_irq_invert(s->soc->irq_table[exynos4210_get_irq(37, 1)])); | ||
118 | + qemu_irq_invert(s->soc.irq_table[exynos4210_get_irq(37, 1)])); | ||
119 | arm_load_kernel(ARM_CPU(first_cpu), &exynos4_board_binfo); | ||
120 | } | ||
121 | |||
122 | -- | 434 | -- |
123 | 2.20.1 | 435 | 2.20.1 |
124 | 436 | ||
125 | 437 | diff view generated by jsdifflib |
1 | From: Guenter Roeck <linux@roeck-us.net> | 1 | From: Alistair Francis <alistair@alistair23.me> |
---|---|---|---|
2 | 2 | ||
3 | QEMU already supports pl330. Instantiate it for Exynos4210. | 3 | Signed-off-by: Alistair Francis <alistair@alistair23.me> |
4 | |||
5 | Relevant part of Linux arch/arm/boot/dts/exynos4.dtsi: | ||
6 | |||
7 | / { | ||
8 | soc: soc { | ||
9 | amba { | ||
10 | pdma0: pdma@12680000 { | ||
11 | compatible = "arm,pl330", "arm,primecell"; | ||
12 | reg = <0x12680000 0x1000>; | ||
13 | interrupts = <GIC_SPI 35 IRQ_TYPE_LEVEL_HIGH>; | ||
14 | clocks = <&clock CLK_PDMA0>; | ||
15 | clock-names = "apb_pclk"; | ||
16 | #dma-cells = <1>; | ||
17 | #dma-channels = <8>; | ||
18 | #dma-requests = <32>; | ||
19 | }; | ||
20 | pdma1: pdma@12690000 { | ||
21 | compatible = "arm,pl330", "arm,primecell"; | ||
22 | reg = <0x12690000 0x1000>; | ||
23 | interrupts = <GIC_SPI 36 IRQ_TYPE_LEVEL_HIGH>; | ||
24 | clocks = <&clock CLK_PDMA1>; | ||
25 | clock-names = "apb_pclk"; | ||
26 | #dma-cells = <1>; | ||
27 | #dma-channels = <8>; | ||
28 | #dma-requests = <32>; | ||
29 | }; | ||
30 | mdma1: mdma@12850000 { | ||
31 | compatible = "arm,pl330", "arm,primecell"; | ||
32 | reg = <0x12850000 0x1000>; | ||
33 | interrupts = <GIC_SPI 34 IRQ_TYPE_LEVEL_HIGH>; | ||
34 | clocks = <&clock CLK_MDMA>; | ||
35 | clock-names = "apb_pclk"; | ||
36 | #dma-cells = <1>; | ||
37 | #dma-channels = <8>; | ||
38 | #dma-requests = <1>; | ||
39 | }; | ||
40 | }; | ||
41 | }; | ||
42 | }; | ||
43 | |||
44 | Signed-off-by: Guenter Roeck <linux@roeck-us.net> | ||
45 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
46 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | ||
47 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 4 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
48 | Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> | 5 | Message-id: dad8d8d47f7625913e35e27a1c00f603a6b08f9a.1576658572.git.alistair@alistair23.me |
49 | Message-id: 20190520214342.13709-4-philmd@redhat.com | ||
50 | [PMD: Do not set default qdev properties, create the controllers in the SoC | ||
51 | rather than the board (Peter Maydell), add dtsi in commit message] | ||
52 | Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
53 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
54 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
55 | --- | 7 | --- |
56 | hw/arm/exynos4210.c | 26 ++++++++++++++++++++++++++ | 8 | hw/arm/Makefile.objs | 1 + |
57 | 1 file changed, 26 insertions(+) | 9 | hw/arm/netduinoplus2.c | 52 ++++++++++++++++++++++++++++++++++++++++++ |
10 | MAINTAINERS | 6 +++++ | ||
11 | 3 files changed, 59 insertions(+) | ||
12 | create mode 100644 hw/arm/netduinoplus2.c | ||
58 | 13 | ||
59 | diff --git a/hw/arm/exynos4210.c b/hw/arm/exynos4210.c | 14 | diff --git a/hw/arm/Makefile.objs b/hw/arm/Makefile.objs |
60 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
61 | --- a/hw/arm/exynos4210.c | 16 | --- a/hw/arm/Makefile.objs |
62 | +++ b/hw/arm/exynos4210.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 | ||
63 | @@ -XXX,XX +XXX,XX @@ | 31 | @@ -XXX,XX +XXX,XX @@ |
64 | /* EHCI */ | 32 | +/* |
65 | #define EXYNOS4210_EHCI_BASE_ADDR 0x12580000 | 33 | + * Netduino Plus 2 Machine Model |
66 | 34 | + * | |
67 | +/* DMA */ | 35 | + * Copyright (c) 2014 Alistair Francis <alistair@alistair23.me> |
68 | +#define EXYNOS4210_PL330_BASE0_ADDR 0x12680000 | 36 | + * |
69 | +#define EXYNOS4210_PL330_BASE1_ADDR 0x12690000 | 37 | + * Permission is hereby granted, free of charge, to any person obtaining a copy |
70 | +#define EXYNOS4210_PL330_BASE2_ADDR 0x12850000 | 38 | + * of this software and associated documentation files (the "Software"), to deal |
39 | + * in the Software without restriction, including without limitation the rights | ||
40 | + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
41 | + * copies of the Software, and to permit persons to whom the Software is | ||
42 | + * furnished to do so, subject to the following conditions: | ||
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 | + */ | ||
71 | + | 55 | + |
72 | static uint8_t chipid_and_omr[] = { 0x11, 0x02, 0x21, 0x43, | 56 | +#include "qemu/osdep.h" |
73 | 0x09, 0x00, 0x00, 0x00 }; | 57 | +#include "qapi/error.h" |
74 | 58 | +#include "hw/boards.h" | |
75 | @@ -XXX,XX +XXX,XX @@ static uint64_t exynos4210_calc_affinity(int cpu) | 59 | +#include "hw/qdev-properties.h" |
76 | return (0x9 << ARM_AFF1_SHIFT) | cpu; | 60 | +#include "qemu/error-report.h" |
77 | } | 61 | +#include "hw/arm/stm32f405_soc.h" |
78 | 62 | +#include "hw/arm/boot.h" | |
79 | +static void pl330_create(uint32_t base, qemu_irq irq, int nreq) | 63 | + |
64 | +static void netduinoplus2_init(MachineState *machine) | ||
80 | +{ | 65 | +{ |
81 | + SysBusDevice *busdev; | ||
82 | + DeviceState *dev; | 66 | + DeviceState *dev; |
83 | + | 67 | + |
84 | + dev = qdev_create(NULL, "pl330"); | 68 | + dev = qdev_create(NULL, TYPE_STM32F405_SOC); |
85 | + qdev_prop_set_uint8(dev, "num_periph_req", nreq); | 69 | + qdev_prop_set_string(dev, "cpu-type", ARM_CPU_TYPE_NAME("cortex-m4")); |
86 | + qdev_init_nofail(dev); | 70 | + object_property_set_bool(OBJECT(dev), true, "realized", &error_fatal); |
87 | + busdev = SYS_BUS_DEVICE(dev); | 71 | + |
88 | + sysbus_mmio_map(busdev, 0, base); | 72 | + armv7m_load_kernel(ARM_CPU(first_cpu), |
89 | + sysbus_connect_irq(busdev, 0, irq); | 73 | + machine->kernel_filename, |
74 | + FLASH_SIZE); | ||
90 | +} | 75 | +} |
91 | + | 76 | + |
92 | Exynos4210State *exynos4210_init(MemoryRegion *system_mem) | 77 | +static void netduinoplus2_machine_init(MachineClass *mc) |
93 | { | 78 | +{ |
94 | Exynos4210State *s = g_new0(Exynos4210State, 1); | 79 | + mc->desc = "Netduino Plus 2 Machine"; |
95 | @@ -XXX,XX +XXX,XX @@ Exynos4210State *exynos4210_init(MemoryRegion *system_mem) | 80 | + mc->init = netduinoplus2_init; |
96 | sysbus_create_simple(TYPE_EXYNOS4210_EHCI, EXYNOS4210_EHCI_BASE_ADDR, | 81 | +} |
97 | s->irq_table[exynos4210_get_irq(28, 3)]); | ||
98 | |||
99 | + /*** DMA controllers ***/ | ||
100 | + pl330_create(EXYNOS4210_PL330_BASE0_ADDR, | ||
101 | + qemu_irq_invert(s->irq_table[exynos4210_get_irq(35, 1)]), 32); | ||
102 | + pl330_create(EXYNOS4210_PL330_BASE1_ADDR, | ||
103 | + qemu_irq_invert(s->irq_table[exynos4210_get_irq(36, 1)]), 32); | ||
104 | + pl330_create(EXYNOS4210_PL330_BASE2_ADDR, | ||
105 | + qemu_irq_invert(s->irq_table[exynos4210_get_irq(34, 1)]), 1); | ||
106 | + | 82 | + |
107 | return s; | 83 | +DEFINE_MACHINE("netduinoplus2", netduinoplus2_machine_init) |
108 | } | 84 | diff --git a/MAINTAINERS b/MAINTAINERS |
85 | index XXXXXXX..XXXXXXX 100644 | ||
86 | --- a/MAINTAINERS | ||
87 | +++ b/MAINTAINERS | ||
88 | @@ -XXX,XX +XXX,XX @@ M: Peter Maydell <peter.maydell@linaro.org> | ||
89 | S: Maintained | ||
90 | F: hw/arm/netduino2.c | ||
91 | |||
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> | ||
109 | -- | 101 | -- |
110 | 2.20.1 | 102 | 2.20.1 |
111 | 103 | ||
112 | 104 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
1 | 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 | ||
52 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
53 | --- | ||
54 | tests/acceptance/boot_linux_console.py | 41 ++++++++++++++++++++++++++ | ||
55 | 1 file changed, 41 insertions(+) | ||
56 | |||
57 | diff --git a/tests/acceptance/boot_linux_console.py b/tests/acceptance/boot_linux_console.py | ||
58 | index XXXXXXX..XXXXXXX 100644 | ||
59 | --- a/tests/acceptance/boot_linux_console.py | ||
60 | +++ b/tests/acceptance/boot_linux_console.py | ||
61 | @@ -XXX,XX +XXX,XX @@ class BootLinuxConsole(Test): | ||
62 | self.wait_for_console_pattern('Boot successful.') | ||
63 | # TODO user command, for now the uart is stuck | ||
64 | |||
65 | + def test_arm_cubieboard_initrd(self): | ||
66 | + """ | ||
67 | + :avocado: tags=arch:arm | ||
68 | + :avocado: tags=machine:cubieboard | ||
69 | + """ | ||
70 | + deb_url = ('https://apt.armbian.com/pool/main/l/' | ||
71 | + 'linux-4.20.7-sunxi/linux-image-dev-sunxi_5.75_armhf.deb') | ||
72 | + deb_hash = '1334c29c44d984ffa05ed10de8c3361f33d78315' | ||
73 | + deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash) | ||
74 | + kernel_path = self.extract_from_deb(deb_path, | ||
75 | + '/boot/vmlinuz-4.20.7-sunxi') | ||
76 | + dtb_path = '/usr/lib/linux-image-dev-sunxi/sun4i-a10-cubieboard.dtb' | ||
77 | + dtb_path = self.extract_from_deb(deb_path, dtb_path) | ||
78 | + initrd_url = ('https://github.com/groeck/linux-build-test/raw/' | ||
79 | + '2eb0a73b5d5a28df3170c546ddaaa9757e1e0848/rootfs/' | ||
80 | + 'arm/rootfs-armv5.cpio.gz') | ||
81 | + initrd_hash = '2b50f1873e113523967806f4da2afe385462ff9b' | ||
82 | + initrd_path_gz = self.fetch_asset(initrd_url, asset_hash=initrd_hash) | ||
83 | + initrd_path = os.path.join(self.workdir, 'rootfs.cpio') | ||
84 | + archive.gzip_uncompress(initrd_path_gz, initrd_path) | ||
85 | + | ||
86 | + self.vm.set_console() | ||
87 | + kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE + | ||
88 | + 'console=ttyS0,115200 ' | ||
89 | + 'usbcore.nousb ' | ||
90 | + 'panic=-1 noreboot') | ||
91 | + self.vm.add_args('-kernel', kernel_path, | ||
92 | + '-dtb', dtb_path, | ||
93 | + '-initrd', initrd_path, | ||
94 | + '-append', kernel_command_line, | ||
95 | + '-no-reboot') | ||
96 | + self.vm.launch() | ||
97 | + self.wait_for_console_pattern('Boot successful.') | ||
98 | + | ||
99 | + exec_command_and_wait_for_pattern(self, 'cat /proc/cpuinfo', | ||
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 | ||
109 | -- | ||
110 | 2.20.1 | ||
111 | |||
112 | diff view generated by jsdifflib |
1 | From: Philippe Mathieu-Daudé <philmd@redhat.com> | 1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> |
---|---|---|---|
2 | 2 | ||
3 | It eases code review, unit is explicit. | 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/ | ||
4 | 6 | ||
5 | Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> | 7 | The cpio image used comes from the linux-build-test project: |
6 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | 8 | https://github.com/groeck/linux-build-test |
7 | Message-id: 20190520214342.13709-3-philmd@redhat.com | 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 | ||
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 64 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
9 | --- | 65 | --- |
10 | hw/arm/exynos4_boards.c | 5 +++-- | 66 | tests/acceptance/boot_linux_console.py | 44 ++++++++++++++++++++++++++ |
11 | 1 file changed, 3 insertions(+), 2 deletions(-) | 67 | 1 file changed, 44 insertions(+) |
12 | 68 | ||
13 | diff --git a/hw/arm/exynos4_boards.c b/hw/arm/exynos4_boards.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/exynos4_boards.c | 71 | --- a/tests/acceptance/boot_linux_console.py |
16 | +++ b/hw/arm/exynos4_boards.c | 72 | +++ b/tests/acceptance/boot_linux_console.py |
17 | @@ -XXX,XX +XXX,XX @@ | 73 | @@ -XXX,XX +XXX,XX @@ class BootLinuxConsole(Test): |
18 | */ | 74 | exec_command_and_wait_for_pattern(self, 'reboot', |
19 | 75 | 'reboot: Restarting system') | |
20 | #include "qemu/osdep.h" | 76 | |
21 | +#include "qemu/units.h" | 77 | + def test_arm_cubieboard_sata(self): |
22 | #include "qapi/error.h" | 78 | + """ |
23 | #include "qemu/error-report.h" | 79 | + :avocado: tags=arch:arm |
24 | #include "qemu-common.h" | 80 | + :avocado: tags=machine:cubieboard |
25 | @@ -XXX,XX +XXX,XX @@ static int exynos4_board_smp_bootreg_addr[EXYNOS4_NUM_OF_BOARDS] = { | 81 | + """ |
26 | }; | 82 | + deb_url = ('https://apt.armbian.com/pool/main/l/' |
27 | 83 | + 'linux-4.20.7-sunxi/linux-image-dev-sunxi_5.75_armhf.deb') | |
28 | static unsigned long exynos4_board_ram_size[EXYNOS4_NUM_OF_BOARDS] = { | 84 | + deb_hash = '1334c29c44d984ffa05ed10de8c3361f33d78315' |
29 | - [EXYNOS4_BOARD_NURI] = 0x40000000, | 85 | + deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash) |
30 | - [EXYNOS4_BOARD_SMDKC210] = 0x40000000, | 86 | + kernel_path = self.extract_from_deb(deb_path, |
31 | + [EXYNOS4_BOARD_NURI] = 1 * GiB, | 87 | + '/boot/vmlinuz-4.20.7-sunxi') |
32 | + [EXYNOS4_BOARD_SMDKC210] = 1 * GiB, | 88 | + dtb_path = '/usr/lib/linux-image-dev-sunxi/sun4i-a10-cubieboard.dtb' |
33 | }; | 89 | + dtb_path = self.extract_from_deb(deb_path, dtb_path) |
34 | 90 | + rootfs_url = ('https://github.com/groeck/linux-build-test/raw/' | |
35 | static struct arm_boot_info exynos4_board_binfo = { | 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) | ||
97 | + | ||
98 | + self.vm.set_console() | ||
99 | + kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE + | ||
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 | ||
36 | -- | 124 | -- |
37 | 2.20.1 | 125 | 2.20.1 |
38 | 126 | ||
39 | 127 | diff view generated by jsdifflib |
1 | The header file hw/arm/arm.h now includes only declarations | 1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> |
---|---|---|---|
2 | relating to hw/arm/boot.c functionality. Rename it accordingly, | ||
3 | and adjust its header comment. | ||
4 | 2 | ||
5 | The bulk of this commit was created via | 3 | These definitions are specific to the A10 SoC and don't need |
6 | perl -pi -e 's|hw/arm/arm.h|hw/arm/boot.h|' hw/arm/*.c include/hw/arm/*.h | 4 | to be exported to the different Allwinner peripherals. |
7 | 5 | ||
8 | In a few cases we can just delete the #include: | 6 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> |
9 | hw/arm/msf2-soc.c, include/hw/arm/aspeed_soc.h and | 7 | Message-id: 20191230110953.25496-4-f4bug@amsat.org |
10 | include/hw/arm/bcm2836.h did not require it. | ||
11 | |||
12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
13 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | 9 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
14 | Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
15 | Message-id: 20190516163857.6430-4-peter.maydell@linaro.org | ||
16 | --- | 10 | --- |
17 | include/hw/arm/allwinner-a10.h | 2 +- | 11 | include/hw/arm/allwinner-a10.h | 6 ------ |
18 | include/hw/arm/aspeed_soc.h | 1 - | 12 | hw/arm/allwinner-a10.c | 6 ++++++ |
19 | include/hw/arm/bcm2836.h | 1 - | 13 | 2 files changed, 6 insertions(+), 6 deletions(-) |
20 | include/hw/arm/{arm.h => boot.h} | 8 ++++---- | ||
21 | include/hw/arm/fsl-imx25.h | 2 +- | ||
22 | include/hw/arm/fsl-imx31.h | 2 +- | ||
23 | include/hw/arm/fsl-imx6.h | 2 +- | ||
24 | include/hw/arm/fsl-imx6ul.h | 2 +- | ||
25 | include/hw/arm/fsl-imx7.h | 2 +- | ||
26 | include/hw/arm/virt.h | 2 +- | ||
27 | include/hw/arm/xlnx-versal.h | 2 +- | ||
28 | include/hw/arm/xlnx-zynqmp.h | 2 +- | ||
29 | hw/arm/armsse.c | 2 +- | ||
30 | hw/arm/armv7m.c | 2 +- | ||
31 | hw/arm/aspeed.c | 2 +- | ||
32 | hw/arm/boot.c | 2 +- | ||
33 | hw/arm/collie.c | 2 +- | ||
34 | hw/arm/exynos4210.c | 2 +- | ||
35 | hw/arm/exynos4_boards.c | 2 +- | ||
36 | hw/arm/highbank.c | 2 +- | ||
37 | hw/arm/integratorcp.c | 2 +- | ||
38 | hw/arm/mainstone.c | 2 +- | ||
39 | hw/arm/microbit.c | 2 +- | ||
40 | hw/arm/mps2-tz.c | 2 +- | ||
41 | hw/arm/mps2.c | 2 +- | ||
42 | hw/arm/msf2-soc.c | 1 - | ||
43 | hw/arm/msf2-som.c | 2 +- | ||
44 | hw/arm/musca.c | 2 +- | ||
45 | hw/arm/musicpal.c | 2 +- | ||
46 | hw/arm/netduino2.c | 2 +- | ||
47 | hw/arm/nrf51_soc.c | 2 +- | ||
48 | hw/arm/nseries.c | 2 +- | ||
49 | hw/arm/omap1.c | 2 +- | ||
50 | hw/arm/omap2.c | 2 +- | ||
51 | hw/arm/omap_sx1.c | 2 +- | ||
52 | hw/arm/palm.c | 2 +- | ||
53 | hw/arm/raspi.c | 2 +- | ||
54 | hw/arm/realview.c | 2 +- | ||
55 | hw/arm/spitz.c | 2 +- | ||
56 | hw/arm/stellaris.c | 2 +- | ||
57 | hw/arm/stm32f205_soc.c | 2 +- | ||
58 | hw/arm/strongarm.c | 2 +- | ||
59 | hw/arm/tosa.c | 2 +- | ||
60 | hw/arm/versatilepb.c | 2 +- | ||
61 | hw/arm/vexpress.c | 2 +- | ||
62 | hw/arm/virt.c | 2 +- | ||
63 | hw/arm/xilinx_zynq.c | 2 +- | ||
64 | hw/arm/xlnx-versal.c | 2 +- | ||
65 | hw/arm/z2.c | 2 +- | ||
66 | 49 files changed, 49 insertions(+), 52 deletions(-) | ||
67 | rename include/hw/arm/{arm.h => boot.h} (98%) | ||
68 | 14 | ||
69 | diff --git a/include/hw/arm/allwinner-a10.h b/include/hw/arm/allwinner-a10.h | 15 | diff --git a/include/hw/arm/allwinner-a10.h b/include/hw/arm/allwinner-a10.h |
70 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
71 | --- a/include/hw/arm/allwinner-a10.h | 17 | --- a/include/hw/arm/allwinner-a10.h |
72 | +++ b/include/hw/arm/allwinner-a10.h | 18 | +++ b/include/hw/arm/allwinner-a10.h |
73 | @@ -XXX,XX +XXX,XX @@ | 19 | @@ -XXX,XX +XXX,XX @@ |
74 | #include "qemu-common.h" | 20 | #include "target/arm/cpu.h" |
75 | #include "qemu/error-report.h" | 21 | |
76 | #include "hw/char/serial.h" | 22 | |
77 | -#include "hw/arm/arm.h" | 23 | -#define AW_A10_PIC_REG_BASE 0x01c20400 |
78 | +#include "hw/arm/boot.h" | 24 | -#define AW_A10_PIT_REG_BASE 0x01c20c00 |
79 | #include "hw/timer/allwinner-a10-pit.h" | 25 | -#define AW_A10_UART0_REG_BASE 0x01c28000 |
80 | #include "hw/intc/allwinner-a10-pic.h" | 26 | -#define AW_A10_EMAC_BASE 0x01c0b000 |
81 | #include "hw/net/allwinner_emac.h" | 27 | -#define AW_A10_SATA_BASE 0x01c18000 |
82 | diff --git a/include/hw/arm/aspeed_soc.h b/include/hw/arm/aspeed_soc.h | 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 | ||
83 | index XXXXXXX..XXXXXXX 100644 | 33 | index XXXXXXX..XXXXXXX 100644 |
84 | --- a/include/hw/arm/aspeed_soc.h | 34 | --- a/hw/arm/allwinner-a10.c |
85 | +++ b/include/hw/arm/aspeed_soc.h | 35 | +++ b/hw/arm/allwinner-a10.c |
86 | @@ -XXX,XX +XXX,XX @@ | 36 | @@ -XXX,XX +XXX,XX @@ |
87 | #ifndef ASPEED_SOC_H | 37 | #include "hw/misc/unimp.h" |
88 | #define ASPEED_SOC_H | ||
89 | |||
90 | -#include "hw/arm/arm.h" | ||
91 | #include "hw/intc/aspeed_vic.h" | ||
92 | #include "hw/misc/aspeed_scu.h" | ||
93 | #include "hw/misc/aspeed_sdmc.h" | ||
94 | diff --git a/include/hw/arm/bcm2836.h b/include/hw/arm/bcm2836.h | ||
95 | index XXXXXXX..XXXXXXX 100644 | ||
96 | --- a/include/hw/arm/bcm2836.h | ||
97 | +++ b/include/hw/arm/bcm2836.h | ||
98 | @@ -XXX,XX +XXX,XX @@ | ||
99 | #ifndef BCM2836_H | ||
100 | #define BCM2836_H | ||
101 | |||
102 | -#include "hw/arm/arm.h" | ||
103 | #include "hw/arm/bcm2835_peripherals.h" | ||
104 | #include "hw/intc/bcm2836_control.h" | ||
105 | |||
106 | diff --git a/include/hw/arm/arm.h b/include/hw/arm/boot.h | ||
107 | similarity index 98% | ||
108 | rename from include/hw/arm/arm.h | ||
109 | rename to include/hw/arm/boot.h | ||
110 | index XXXXXXX..XXXXXXX 100644 | ||
111 | --- a/include/hw/arm/arm.h | ||
112 | +++ b/include/hw/arm/boot.h | ||
113 | @@ -XXX,XX +XXX,XX @@ | ||
114 | /* | ||
115 | - * Misc ARM declarations | ||
116 | + * ARM kernel loader. | ||
117 | * | ||
118 | * Copyright (c) 2006 CodeSourcery. | ||
119 | * Written by Paul Brook | ||
120 | @@ -XXX,XX +XXX,XX @@ | ||
121 | * | ||
122 | */ | ||
123 | |||
124 | -#ifndef HW_ARM_H | ||
125 | -#define HW_ARM_H | ||
126 | +#ifndef HW_ARM_BOOT_H | ||
127 | +#define HW_ARM_BOOT_H | ||
128 | |||
129 | #include "exec/memory.h" | ||
130 | #include "target/arm/cpu-qom.h" | ||
131 | @@ -XXX,XX +XXX,XX @@ void arm_write_secure_board_setup_dummy_smc(ARMCPU *cpu, | ||
132 | const struct arm_boot_info *info, | ||
133 | hwaddr mvbar_addr); | ||
134 | |||
135 | -#endif /* HW_ARM_H */ | ||
136 | +#endif /* HW_ARM_BOOT_H */ | ||
137 | diff --git a/include/hw/arm/fsl-imx25.h b/include/hw/arm/fsl-imx25.h | ||
138 | index XXXXXXX..XXXXXXX 100644 | ||
139 | --- a/include/hw/arm/fsl-imx25.h | ||
140 | +++ b/include/hw/arm/fsl-imx25.h | ||
141 | @@ -XXX,XX +XXX,XX @@ | ||
142 | #ifndef FSL_IMX25_H | ||
143 | #define FSL_IMX25_H | ||
144 | |||
145 | -#include "hw/arm/arm.h" | ||
146 | +#include "hw/arm/boot.h" | ||
147 | #include "hw/intc/imx_avic.h" | ||
148 | #include "hw/misc/imx25_ccm.h" | ||
149 | #include "hw/char/imx_serial.h" | ||
150 | diff --git a/include/hw/arm/fsl-imx31.h b/include/hw/arm/fsl-imx31.h | ||
151 | index XXXXXXX..XXXXXXX 100644 | ||
152 | --- a/include/hw/arm/fsl-imx31.h | ||
153 | +++ b/include/hw/arm/fsl-imx31.h | ||
154 | @@ -XXX,XX +XXX,XX @@ | ||
155 | #ifndef FSL_IMX31_H | ||
156 | #define FSL_IMX31_H | ||
157 | |||
158 | -#include "hw/arm/arm.h" | ||
159 | +#include "hw/arm/boot.h" | ||
160 | #include "hw/intc/imx_avic.h" | ||
161 | #include "hw/misc/imx31_ccm.h" | ||
162 | #include "hw/char/imx_serial.h" | ||
163 | diff --git a/include/hw/arm/fsl-imx6.h b/include/hw/arm/fsl-imx6.h | ||
164 | index XXXXXXX..XXXXXXX 100644 | ||
165 | --- a/include/hw/arm/fsl-imx6.h | ||
166 | +++ b/include/hw/arm/fsl-imx6.h | ||
167 | @@ -XXX,XX +XXX,XX @@ | ||
168 | #ifndef FSL_IMX6_H | ||
169 | #define FSL_IMX6_H | ||
170 | |||
171 | -#include "hw/arm/arm.h" | ||
172 | +#include "hw/arm/boot.h" | ||
173 | #include "hw/cpu/a9mpcore.h" | ||
174 | #include "hw/misc/imx6_ccm.h" | ||
175 | #include "hw/misc/imx6_src.h" | ||
176 | diff --git a/include/hw/arm/fsl-imx6ul.h b/include/hw/arm/fsl-imx6ul.h | ||
177 | index XXXXXXX..XXXXXXX 100644 | ||
178 | --- a/include/hw/arm/fsl-imx6ul.h | ||
179 | +++ b/include/hw/arm/fsl-imx6ul.h | ||
180 | @@ -XXX,XX +XXX,XX @@ | ||
181 | #ifndef FSL_IMX6UL_H | ||
182 | #define FSL_IMX6UL_H | ||
183 | |||
184 | -#include "hw/arm/arm.h" | ||
185 | +#include "hw/arm/boot.h" | ||
186 | #include "hw/cpu/a15mpcore.h" | ||
187 | #include "hw/misc/imx6ul_ccm.h" | ||
188 | #include "hw/misc/imx6_src.h" | ||
189 | diff --git a/include/hw/arm/fsl-imx7.h b/include/hw/arm/fsl-imx7.h | ||
190 | index XXXXXXX..XXXXXXX 100644 | ||
191 | --- a/include/hw/arm/fsl-imx7.h | ||
192 | +++ b/include/hw/arm/fsl-imx7.h | ||
193 | @@ -XXX,XX +XXX,XX @@ | ||
194 | #ifndef FSL_IMX7_H | ||
195 | #define FSL_IMX7_H | ||
196 | |||
197 | -#include "hw/arm/arm.h" | ||
198 | +#include "hw/arm/boot.h" | ||
199 | #include "hw/cpu/a15mpcore.h" | ||
200 | #include "hw/intc/imx_gpcv2.h" | ||
201 | #include "hw/misc/imx7_ccm.h" | ||
202 | diff --git a/include/hw/arm/virt.h b/include/hw/arm/virt.h | ||
203 | index XXXXXXX..XXXXXXX 100644 | ||
204 | --- a/include/hw/arm/virt.h | ||
205 | +++ b/include/hw/arm/virt.h | ||
206 | @@ -XXX,XX +XXX,XX @@ | ||
207 | #include "exec/hwaddr.h" | ||
208 | #include "qemu/notify.h" | ||
209 | #include "hw/boards.h" | ||
210 | -#include "hw/arm/arm.h" | ||
211 | +#include "hw/arm/boot.h" | ||
212 | #include "hw/block/flash.h" | ||
213 | #include "sysemu/kvm.h" | ||
214 | #include "hw/intc/arm_gicv3_common.h" | ||
215 | diff --git a/include/hw/arm/xlnx-versal.h b/include/hw/arm/xlnx-versal.h | ||
216 | index XXXXXXX..XXXXXXX 100644 | ||
217 | --- a/include/hw/arm/xlnx-versal.h | ||
218 | +++ b/include/hw/arm/xlnx-versal.h | ||
219 | @@ -XXX,XX +XXX,XX @@ | ||
220 | #define XLNX_VERSAL_H | ||
221 | |||
222 | #include "hw/sysbus.h" | ||
223 | -#include "hw/arm/arm.h" | ||
224 | +#include "hw/arm/boot.h" | ||
225 | #include "hw/intc/arm_gicv3.h" | ||
226 | |||
227 | #define TYPE_XLNX_VERSAL "xlnx-versal" | ||
228 | diff --git a/include/hw/arm/xlnx-zynqmp.h b/include/hw/arm/xlnx-zynqmp.h | ||
229 | index XXXXXXX..XXXXXXX 100644 | ||
230 | --- a/include/hw/arm/xlnx-zynqmp.h | ||
231 | +++ b/include/hw/arm/xlnx-zynqmp.h | ||
232 | @@ -XXX,XX +XXX,XX @@ | ||
233 | #ifndef XLNX_ZYNQMP_H | ||
234 | |||
235 | #include "qemu-common.h" | ||
236 | -#include "hw/arm/arm.h" | ||
237 | +#include "hw/arm/boot.h" | ||
238 | #include "hw/intc/arm_gic.h" | ||
239 | #include "hw/net/cadence_gem.h" | ||
240 | #include "hw/char/cadence_uart.h" | ||
241 | diff --git a/hw/arm/armsse.c b/hw/arm/armsse.c | ||
242 | index XXXXXXX..XXXXXXX 100644 | ||
243 | --- a/hw/arm/armsse.c | ||
244 | +++ b/hw/arm/armsse.c | ||
245 | @@ -XXX,XX +XXX,XX @@ | ||
246 | #include "hw/sysbus.h" | ||
247 | #include "hw/registerfields.h" | ||
248 | #include "hw/arm/armsse.h" | ||
249 | -#include "hw/arm/arm.h" | ||
250 | +#include "hw/arm/boot.h" | ||
251 | |||
252 | /* Format of the System Information block SYS_CONFIG register */ | ||
253 | typedef enum SysConfigFormat { | ||
254 | diff --git a/hw/arm/armv7m.c b/hw/arm/armv7m.c | ||
255 | index XXXXXXX..XXXXXXX 100644 | ||
256 | --- a/hw/arm/armv7m.c | ||
257 | +++ b/hw/arm/armv7m.c | ||
258 | @@ -XXX,XX +XXX,XX @@ | ||
259 | #include "qemu-common.h" | ||
260 | #include "cpu.h" | ||
261 | #include "hw/sysbus.h" | ||
262 | -#include "hw/arm/arm.h" | ||
263 | +#include "hw/arm/boot.h" | ||
264 | #include "hw/loader.h" | ||
265 | #include "elf.h" | ||
266 | #include "sysemu/qtest.h" | ||
267 | diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c | ||
268 | index XXXXXXX..XXXXXXX 100644 | ||
269 | --- a/hw/arm/aspeed.c | ||
270 | +++ b/hw/arm/aspeed.c | ||
271 | @@ -XXX,XX +XXX,XX @@ | ||
272 | #include "qemu-common.h" | ||
273 | #include "cpu.h" | ||
274 | #include "exec/address-spaces.h" | ||
275 | -#include "hw/arm/arm.h" | ||
276 | +#include "hw/arm/boot.h" | ||
277 | #include "hw/arm/aspeed.h" | ||
278 | #include "hw/arm/aspeed_soc.h" | ||
279 | #include "hw/boards.h" | ||
280 | diff --git a/hw/arm/boot.c b/hw/arm/boot.c | ||
281 | index XXXXXXX..XXXXXXX 100644 | ||
282 | --- a/hw/arm/boot.c | ||
283 | +++ b/hw/arm/boot.c | ||
284 | @@ -XXX,XX +XXX,XX @@ | ||
285 | #include "qapi/error.h" | ||
286 | #include <libfdt.h> | ||
287 | #include "hw/hw.h" | ||
288 | -#include "hw/arm/arm.h" | ||
289 | +#include "hw/arm/boot.h" | ||
290 | #include "hw/arm/linux-boot-if.h" | ||
291 | #include "sysemu/kvm.h" | ||
292 | #include "sysemu/sysemu.h" | 38 | #include "sysemu/sysemu.h" |
293 | diff --git a/hw/arm/collie.c b/hw/arm/collie.c | 39 | |
294 | index XXXXXXX..XXXXXXX 100644 | 40 | +#define AW_A10_PIC_REG_BASE 0x01c20400 |
295 | --- a/hw/arm/collie.c | 41 | +#define AW_A10_PIT_REG_BASE 0x01c20c00 |
296 | +++ b/hw/arm/collie.c | 42 | +#define AW_A10_UART0_REG_BASE 0x01c28000 |
297 | @@ -XXX,XX +XXX,XX @@ | 43 | +#define AW_A10_EMAC_BASE 0x01c0b000 |
298 | #include "hw/sysbus.h" | 44 | +#define AW_A10_SATA_BASE 0x01c18000 |
299 | #include "hw/boards.h" | 45 | + |
300 | #include "strongarm.h" | 46 | static void aw_a10_init(Object *obj) |
301 | -#include "hw/arm/arm.h" | ||
302 | +#include "hw/arm/boot.h" | ||
303 | #include "hw/block/flash.h" | ||
304 | #include "exec/address-spaces.h" | ||
305 | #include "cpu.h" | ||
306 | diff --git a/hw/arm/exynos4210.c b/hw/arm/exynos4210.c | ||
307 | index XXXXXXX..XXXXXXX 100644 | ||
308 | --- a/hw/arm/exynos4210.c | ||
309 | +++ b/hw/arm/exynos4210.c | ||
310 | @@ -XXX,XX +XXX,XX @@ | ||
311 | #include "hw/boards.h" | ||
312 | #include "sysemu/sysemu.h" | ||
313 | #include "hw/sysbus.h" | ||
314 | -#include "hw/arm/arm.h" | ||
315 | +#include "hw/arm/boot.h" | ||
316 | #include "hw/loader.h" | ||
317 | #include "hw/arm/exynos4210.h" | ||
318 | #include "hw/sd/sdhci.h" | ||
319 | diff --git a/hw/arm/exynos4_boards.c b/hw/arm/exynos4_boards.c | ||
320 | index XXXXXXX..XXXXXXX 100644 | ||
321 | --- a/hw/arm/exynos4_boards.c | ||
322 | +++ b/hw/arm/exynos4_boards.c | ||
323 | @@ -XXX,XX +XXX,XX @@ | ||
324 | #include "sysemu/sysemu.h" | ||
325 | #include "hw/sysbus.h" | ||
326 | #include "net/net.h" | ||
327 | -#include "hw/arm/arm.h" | ||
328 | +#include "hw/arm/boot.h" | ||
329 | #include "exec/address-spaces.h" | ||
330 | #include "hw/arm/exynos4210.h" | ||
331 | #include "hw/net/lan9118.h" | ||
332 | diff --git a/hw/arm/highbank.c b/hw/arm/highbank.c | ||
333 | index XXXXXXX..XXXXXXX 100644 | ||
334 | --- a/hw/arm/highbank.c | ||
335 | +++ b/hw/arm/highbank.c | ||
336 | @@ -XXX,XX +XXX,XX @@ | ||
337 | #include "qemu/osdep.h" | ||
338 | #include "qapi/error.h" | ||
339 | #include "hw/sysbus.h" | ||
340 | -#include "hw/arm/arm.h" | ||
341 | +#include "hw/arm/boot.h" | ||
342 | #include "hw/loader.h" | ||
343 | #include "net/net.h" | ||
344 | #include "sysemu/kvm.h" | ||
345 | diff --git a/hw/arm/integratorcp.c b/hw/arm/integratorcp.c | ||
346 | index XXXXXXX..XXXXXXX 100644 | ||
347 | --- a/hw/arm/integratorcp.c | ||
348 | +++ b/hw/arm/integratorcp.c | ||
349 | @@ -XXX,XX +XXX,XX @@ | ||
350 | #include "cpu.h" | ||
351 | #include "hw/sysbus.h" | ||
352 | #include "hw/boards.h" | ||
353 | -#include "hw/arm/arm.h" | ||
354 | +#include "hw/arm/boot.h" | ||
355 | #include "hw/misc/arm_integrator_debug.h" | ||
356 | #include "hw/net/smc91c111.h" | ||
357 | #include "net/net.h" | ||
358 | diff --git a/hw/arm/mainstone.c b/hw/arm/mainstone.c | ||
359 | index XXXXXXX..XXXXXXX 100644 | ||
360 | --- a/hw/arm/mainstone.c | ||
361 | +++ b/hw/arm/mainstone.c | ||
362 | @@ -XXX,XX +XXX,XX @@ | ||
363 | #include "qapi/error.h" | ||
364 | #include "hw/hw.h" | ||
365 | #include "hw/arm/pxa.h" | ||
366 | -#include "hw/arm/arm.h" | ||
367 | +#include "hw/arm/boot.h" | ||
368 | #include "net/net.h" | ||
369 | #include "hw/net/smc91c111.h" | ||
370 | #include "hw/boards.h" | ||
371 | diff --git a/hw/arm/microbit.c b/hw/arm/microbit.c | ||
372 | index XXXXXXX..XXXXXXX 100644 | ||
373 | --- a/hw/arm/microbit.c | ||
374 | +++ b/hw/arm/microbit.c | ||
375 | @@ -XXX,XX +XXX,XX @@ | ||
376 | #include "qemu/osdep.h" | ||
377 | #include "qapi/error.h" | ||
378 | #include "hw/boards.h" | ||
379 | -#include "hw/arm/arm.h" | ||
380 | +#include "hw/arm/boot.h" | ||
381 | #include "sysemu/sysemu.h" | ||
382 | #include "exec/address-spaces.h" | ||
383 | |||
384 | diff --git a/hw/arm/mps2-tz.c b/hw/arm/mps2-tz.c | ||
385 | index XXXXXXX..XXXXXXX 100644 | ||
386 | --- a/hw/arm/mps2-tz.c | ||
387 | +++ b/hw/arm/mps2-tz.c | ||
388 | @@ -XXX,XX +XXX,XX @@ | ||
389 | #include "qemu/osdep.h" | ||
390 | #include "qapi/error.h" | ||
391 | #include "qemu/error-report.h" | ||
392 | -#include "hw/arm/arm.h" | ||
393 | +#include "hw/arm/boot.h" | ||
394 | #include "hw/arm/armv7m.h" | ||
395 | #include "hw/or-irq.h" | ||
396 | #include "hw/boards.h" | ||
397 | diff --git a/hw/arm/mps2.c b/hw/arm/mps2.c | ||
398 | index XXXXXXX..XXXXXXX 100644 | ||
399 | --- a/hw/arm/mps2.c | ||
400 | +++ b/hw/arm/mps2.c | ||
401 | @@ -XXX,XX +XXX,XX @@ | ||
402 | #include "qemu/osdep.h" | ||
403 | #include "qapi/error.h" | ||
404 | #include "qemu/error-report.h" | ||
405 | -#include "hw/arm/arm.h" | ||
406 | +#include "hw/arm/boot.h" | ||
407 | #include "hw/arm/armv7m.h" | ||
408 | #include "hw/or-irq.h" | ||
409 | #include "hw/boards.h" | ||
410 | diff --git a/hw/arm/msf2-soc.c b/hw/arm/msf2-soc.c | ||
411 | index XXXXXXX..XXXXXXX 100644 | ||
412 | --- a/hw/arm/msf2-soc.c | ||
413 | +++ b/hw/arm/msf2-soc.c | ||
414 | @@ -XXX,XX +XXX,XX @@ | ||
415 | #include "qemu/units.h" | ||
416 | #include "qapi/error.h" | ||
417 | #include "qemu-common.h" | ||
418 | -#include "hw/arm/arm.h" | ||
419 | #include "exec/address-spaces.h" | ||
420 | #include "hw/char/serial.h" | ||
421 | #include "hw/boards.h" | ||
422 | diff --git a/hw/arm/msf2-som.c b/hw/arm/msf2-som.c | ||
423 | index XXXXXXX..XXXXXXX 100644 | ||
424 | --- a/hw/arm/msf2-som.c | ||
425 | +++ b/hw/arm/msf2-som.c | ||
426 | @@ -XXX,XX +XXX,XX @@ | ||
427 | #include "qapi/error.h" | ||
428 | #include "qemu/error-report.h" | ||
429 | #include "hw/boards.h" | ||
430 | -#include "hw/arm/arm.h" | ||
431 | +#include "hw/arm/boot.h" | ||
432 | #include "exec/address-spaces.h" | ||
433 | #include "hw/arm/msf2-soc.h" | ||
434 | #include "cpu.h" | ||
435 | diff --git a/hw/arm/musca.c b/hw/arm/musca.c | ||
436 | index XXXXXXX..XXXXXXX 100644 | ||
437 | --- a/hw/arm/musca.c | ||
438 | +++ b/hw/arm/musca.c | ||
439 | @@ -XXX,XX +XXX,XX @@ | ||
440 | #include "qapi/error.h" | ||
441 | #include "exec/address-spaces.h" | ||
442 | #include "sysemu/sysemu.h" | ||
443 | -#include "hw/arm/arm.h" | ||
444 | +#include "hw/arm/boot.h" | ||
445 | #include "hw/arm/armsse.h" | ||
446 | #include "hw/boards.h" | ||
447 | #include "hw/char/pl011.h" | ||
448 | diff --git a/hw/arm/musicpal.c b/hw/arm/musicpal.c | ||
449 | index XXXXXXX..XXXXXXX 100644 | ||
450 | --- a/hw/arm/musicpal.c | ||
451 | +++ b/hw/arm/musicpal.c | ||
452 | @@ -XXX,XX +XXX,XX @@ | ||
453 | #include "qemu-common.h" | ||
454 | #include "cpu.h" | ||
455 | #include "hw/sysbus.h" | ||
456 | -#include "hw/arm/arm.h" | ||
457 | +#include "hw/arm/boot.h" | ||
458 | #include "net/net.h" | ||
459 | #include "sysemu/sysemu.h" | ||
460 | #include "hw/boards.h" | ||
461 | diff --git a/hw/arm/netduino2.c b/hw/arm/netduino2.c | ||
462 | index XXXXXXX..XXXXXXX 100644 | ||
463 | --- a/hw/arm/netduino2.c | ||
464 | +++ b/hw/arm/netduino2.c | ||
465 | @@ -XXX,XX +XXX,XX @@ | ||
466 | #include "hw/boards.h" | ||
467 | #include "qemu/error-report.h" | ||
468 | #include "hw/arm/stm32f205_soc.h" | ||
469 | -#include "hw/arm/arm.h" | ||
470 | +#include "hw/arm/boot.h" | ||
471 | |||
472 | static void netduino2_init(MachineState *machine) | ||
473 | { | 47 | { |
474 | diff --git a/hw/arm/nrf51_soc.c b/hw/arm/nrf51_soc.c | 48 | AwA10State *s = AW_A10(obj); |
475 | index XXXXXXX..XXXXXXX 100644 | ||
476 | --- a/hw/arm/nrf51_soc.c | ||
477 | +++ b/hw/arm/nrf51_soc.c | ||
478 | @@ -XXX,XX +XXX,XX @@ | ||
479 | #include "qemu/osdep.h" | ||
480 | #include "qapi/error.h" | ||
481 | #include "qemu-common.h" | ||
482 | -#include "hw/arm/arm.h" | ||
483 | +#include "hw/arm/boot.h" | ||
484 | #include "hw/sysbus.h" | ||
485 | #include "hw/boards.h" | ||
486 | #include "hw/misc/unimp.h" | ||
487 | diff --git a/hw/arm/nseries.c b/hw/arm/nseries.c | ||
488 | index XXXXXXX..XXXXXXX 100644 | ||
489 | --- a/hw/arm/nseries.c | ||
490 | +++ b/hw/arm/nseries.c | ||
491 | @@ -XXX,XX +XXX,XX @@ | ||
492 | #include "qemu/bswap.h" | ||
493 | #include "sysemu/sysemu.h" | ||
494 | #include "hw/arm/omap.h" | ||
495 | -#include "hw/arm/arm.h" | ||
496 | +#include "hw/arm/boot.h" | ||
497 | #include "hw/irq.h" | ||
498 | #include "ui/console.h" | ||
499 | #include "hw/boards.h" | ||
500 | diff --git a/hw/arm/omap1.c b/hw/arm/omap1.c | ||
501 | index XXXXXXX..XXXXXXX 100644 | ||
502 | --- a/hw/arm/omap1.c | ||
503 | +++ b/hw/arm/omap1.c | ||
504 | @@ -XXX,XX +XXX,XX @@ | ||
505 | #include "cpu.h" | ||
506 | #include "hw/boards.h" | ||
507 | #include "hw/hw.h" | ||
508 | -#include "hw/arm/arm.h" | ||
509 | +#include "hw/arm/boot.h" | ||
510 | #include "hw/arm/omap.h" | ||
511 | #include "sysemu/sysemu.h" | ||
512 | #include "hw/arm/soc_dma.h" | ||
513 | diff --git a/hw/arm/omap2.c b/hw/arm/omap2.c | ||
514 | index XXXXXXX..XXXXXXX 100644 | ||
515 | --- a/hw/arm/omap2.c | ||
516 | +++ b/hw/arm/omap2.c | ||
517 | @@ -XXX,XX +XXX,XX @@ | ||
518 | #include "sysemu/qtest.h" | ||
519 | #include "hw/boards.h" | ||
520 | #include "hw/hw.h" | ||
521 | -#include "hw/arm/arm.h" | ||
522 | +#include "hw/arm/boot.h" | ||
523 | #include "hw/arm/omap.h" | ||
524 | #include "sysemu/sysemu.h" | ||
525 | #include "qemu/timer.h" | ||
526 | diff --git a/hw/arm/omap_sx1.c b/hw/arm/omap_sx1.c | ||
527 | index XXXXXXX..XXXXXXX 100644 | ||
528 | --- a/hw/arm/omap_sx1.c | ||
529 | +++ b/hw/arm/omap_sx1.c | ||
530 | @@ -XXX,XX +XXX,XX @@ | ||
531 | #include "ui/console.h" | ||
532 | #include "hw/arm/omap.h" | ||
533 | #include "hw/boards.h" | ||
534 | -#include "hw/arm/arm.h" | ||
535 | +#include "hw/arm/boot.h" | ||
536 | #include "hw/block/flash.h" | ||
537 | #include "sysemu/qtest.h" | ||
538 | #include "exec/address-spaces.h" | ||
539 | diff --git a/hw/arm/palm.c b/hw/arm/palm.c | ||
540 | index XXXXXXX..XXXXXXX 100644 | ||
541 | --- a/hw/arm/palm.c | ||
542 | +++ b/hw/arm/palm.c | ||
543 | @@ -XXX,XX +XXX,XX @@ | ||
544 | #include "ui/console.h" | ||
545 | #include "hw/arm/omap.h" | ||
546 | #include "hw/boards.h" | ||
547 | -#include "hw/arm/arm.h" | ||
548 | +#include "hw/arm/boot.h" | ||
549 | #include "hw/input/tsc2xxx.h" | ||
550 | #include "hw/loader.h" | ||
551 | #include "exec/address-spaces.h" | ||
552 | diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c | ||
553 | index XXXXXXX..XXXXXXX 100644 | ||
554 | --- a/hw/arm/raspi.c | ||
555 | +++ b/hw/arm/raspi.c | ||
556 | @@ -XXX,XX +XXX,XX @@ | ||
557 | #include "qemu/error-report.h" | ||
558 | #include "hw/boards.h" | ||
559 | #include "hw/loader.h" | ||
560 | -#include "hw/arm/arm.h" | ||
561 | +#include "hw/arm/boot.h" | ||
562 | #include "sysemu/sysemu.h" | ||
563 | |||
564 | #define SMPBOOT_ADDR 0x300 /* this should leave enough space for ATAGS */ | ||
565 | diff --git a/hw/arm/realview.c b/hw/arm/realview.c | ||
566 | index XXXXXXX..XXXXXXX 100644 | ||
567 | --- a/hw/arm/realview.c | ||
568 | +++ b/hw/arm/realview.c | ||
569 | @@ -XXX,XX +XXX,XX @@ | ||
570 | #include "qemu-common.h" | ||
571 | #include "cpu.h" | ||
572 | #include "hw/sysbus.h" | ||
573 | -#include "hw/arm/arm.h" | ||
574 | +#include "hw/arm/boot.h" | ||
575 | #include "hw/arm/primecell.h" | ||
576 | #include "hw/net/lan9118.h" | ||
577 | #include "hw/net/smc91c111.h" | ||
578 | diff --git a/hw/arm/spitz.c b/hw/arm/spitz.c | ||
579 | index XXXXXXX..XXXXXXX 100644 | ||
580 | --- a/hw/arm/spitz.c | ||
581 | +++ b/hw/arm/spitz.c | ||
582 | @@ -XXX,XX +XXX,XX @@ | ||
583 | #include "qapi/error.h" | ||
584 | #include "hw/hw.h" | ||
585 | #include "hw/arm/pxa.h" | ||
586 | -#include "hw/arm/arm.h" | ||
587 | +#include "hw/arm/boot.h" | ||
588 | #include "sysemu/sysemu.h" | ||
589 | #include "hw/pcmcia.h" | ||
590 | #include "hw/i2c/i2c.h" | ||
591 | diff --git a/hw/arm/stellaris.c b/hw/arm/stellaris.c | ||
592 | index XXXXXXX..XXXXXXX 100644 | ||
593 | --- a/hw/arm/stellaris.c | ||
594 | +++ b/hw/arm/stellaris.c | ||
595 | @@ -XXX,XX +XXX,XX @@ | ||
596 | #include "qapi/error.h" | ||
597 | #include "hw/sysbus.h" | ||
598 | #include "hw/ssi/ssi.h" | ||
599 | -#include "hw/arm/arm.h" | ||
600 | +#include "hw/arm/boot.h" | ||
601 | #include "qemu/timer.h" | ||
602 | #include "hw/i2c/i2c.h" | ||
603 | #include "net/net.h" | ||
604 | diff --git a/hw/arm/stm32f205_soc.c b/hw/arm/stm32f205_soc.c | ||
605 | index XXXXXXX..XXXXXXX 100644 | ||
606 | --- a/hw/arm/stm32f205_soc.c | ||
607 | +++ b/hw/arm/stm32f205_soc.c | ||
608 | @@ -XXX,XX +XXX,XX @@ | ||
609 | #include "qemu/osdep.h" | ||
610 | #include "qapi/error.h" | ||
611 | #include "qemu-common.h" | ||
612 | -#include "hw/arm/arm.h" | ||
613 | +#include "hw/arm/boot.h" | ||
614 | #include "exec/address-spaces.h" | ||
615 | #include "hw/arm/stm32f205_soc.h" | ||
616 | |||
617 | diff --git a/hw/arm/strongarm.c b/hw/arm/strongarm.c | ||
618 | index XXXXXXX..XXXXXXX 100644 | ||
619 | --- a/hw/arm/strongarm.c | ||
620 | +++ b/hw/arm/strongarm.c | ||
621 | @@ -XXX,XX +XXX,XX @@ | ||
622 | #include "hw/sysbus.h" | ||
623 | #include "strongarm.h" | ||
624 | #include "qemu/error-report.h" | ||
625 | -#include "hw/arm/arm.h" | ||
626 | +#include "hw/arm/boot.h" | ||
627 | #include "chardev/char-fe.h" | ||
628 | #include "chardev/char-serial.h" | ||
629 | #include "sysemu/sysemu.h" | ||
630 | diff --git a/hw/arm/tosa.c b/hw/arm/tosa.c | ||
631 | index XXXXXXX..XXXXXXX 100644 | ||
632 | --- a/hw/arm/tosa.c | ||
633 | +++ b/hw/arm/tosa.c | ||
634 | @@ -XXX,XX +XXX,XX @@ | ||
635 | #include "qapi/error.h" | ||
636 | #include "hw/hw.h" | ||
637 | #include "hw/arm/pxa.h" | ||
638 | -#include "hw/arm/arm.h" | ||
639 | +#include "hw/arm/boot.h" | ||
640 | #include "hw/arm/sharpsl.h" | ||
641 | #include "hw/pcmcia.h" | ||
642 | #include "hw/boards.h" | ||
643 | diff --git a/hw/arm/versatilepb.c b/hw/arm/versatilepb.c | ||
644 | index XXXXXXX..XXXXXXX 100644 | ||
645 | --- a/hw/arm/versatilepb.c | ||
646 | +++ b/hw/arm/versatilepb.c | ||
647 | @@ -XXX,XX +XXX,XX @@ | ||
648 | #include "qemu-common.h" | ||
649 | #include "cpu.h" | ||
650 | #include "hw/sysbus.h" | ||
651 | -#include "hw/arm/arm.h" | ||
652 | +#include "hw/arm/boot.h" | ||
653 | #include "hw/net/smc91c111.h" | ||
654 | #include "net/net.h" | ||
655 | #include "sysemu/sysemu.h" | ||
656 | diff --git a/hw/arm/vexpress.c b/hw/arm/vexpress.c | ||
657 | index XXXXXXX..XXXXXXX 100644 | ||
658 | --- a/hw/arm/vexpress.c | ||
659 | +++ b/hw/arm/vexpress.c | ||
660 | @@ -XXX,XX +XXX,XX @@ | ||
661 | #include "qemu-common.h" | ||
662 | #include "cpu.h" | ||
663 | #include "hw/sysbus.h" | ||
664 | -#include "hw/arm/arm.h" | ||
665 | +#include "hw/arm/boot.h" | ||
666 | #include "hw/arm/primecell.h" | ||
667 | #include "hw/net/lan9118.h" | ||
668 | #include "hw/i2c/i2c.h" | ||
669 | diff --git a/hw/arm/virt.c b/hw/arm/virt.c | ||
670 | index XXXXXXX..XXXXXXX 100644 | ||
671 | --- a/hw/arm/virt.c | ||
672 | +++ b/hw/arm/virt.c | ||
673 | @@ -XXX,XX +XXX,XX @@ | ||
674 | #include "qemu/option.h" | ||
675 | #include "qapi/error.h" | ||
676 | #include "hw/sysbus.h" | ||
677 | -#include "hw/arm/arm.h" | ||
678 | +#include "hw/arm/boot.h" | ||
679 | #include "hw/arm/primecell.h" | ||
680 | #include "hw/arm/virt.h" | ||
681 | #include "hw/block/flash.h" | ||
682 | diff --git a/hw/arm/xilinx_zynq.c b/hw/arm/xilinx_zynq.c | ||
683 | index XXXXXXX..XXXXXXX 100644 | ||
684 | --- a/hw/arm/xilinx_zynq.c | ||
685 | +++ b/hw/arm/xilinx_zynq.c | ||
686 | @@ -XXX,XX +XXX,XX @@ | ||
687 | #include "qemu-common.h" | ||
688 | #include "cpu.h" | ||
689 | #include "hw/sysbus.h" | ||
690 | -#include "hw/arm/arm.h" | ||
691 | +#include "hw/arm/boot.h" | ||
692 | #include "net/net.h" | ||
693 | #include "exec/address-spaces.h" | ||
694 | #include "sysemu/sysemu.h" | ||
695 | diff --git a/hw/arm/xlnx-versal.c b/hw/arm/xlnx-versal.c | ||
696 | index XXXXXXX..XXXXXXX 100644 | ||
697 | --- a/hw/arm/xlnx-versal.c | ||
698 | +++ b/hw/arm/xlnx-versal.c | ||
699 | @@ -XXX,XX +XXX,XX @@ | ||
700 | #include "net/net.h" | ||
701 | #include "sysemu/sysemu.h" | ||
702 | #include "sysemu/kvm.h" | ||
703 | -#include "hw/arm/arm.h" | ||
704 | +#include "hw/arm/boot.h" | ||
705 | #include "kvm_arm.h" | ||
706 | #include "hw/misc/unimp.h" | ||
707 | #include "hw/intc/arm_gicv3_common.h" | ||
708 | diff --git a/hw/arm/z2.c b/hw/arm/z2.c | ||
709 | index XXXXXXX..XXXXXXX 100644 | ||
710 | --- a/hw/arm/z2.c | ||
711 | +++ b/hw/arm/z2.c | ||
712 | @@ -XXX,XX +XXX,XX @@ | ||
713 | #include "qemu/osdep.h" | ||
714 | #include "hw/hw.h" | ||
715 | #include "hw/arm/pxa.h" | ||
716 | -#include "hw/arm/arm.h" | ||
717 | +#include "hw/arm/boot.h" | ||
718 | #include "hw/i2c/i2c.h" | ||
719 | #include "hw/ssi/ssi.h" | ||
720 | #include "hw/boards.h" | ||
721 | -- | 49 | -- |
722 | 2.20.1 | 50 | 2.20.1 |
723 | 51 | ||
724 | 52 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
1 | 2 | ||
3 | By calling qdev_pass_gpios() we don't need to hold a copy of the | ||
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. | ||
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> | ||
11 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
12 | --- | ||
13 | include/hw/arm/allwinner-a10.h | 1 - | ||
14 | hw/arm/allwinner-a10.c | 24 +++++++++++------------- | ||
15 | 2 files changed, 11 insertions(+), 14 deletions(-) | ||
16 | |||
17 | diff --git a/include/hw/arm/allwinner-a10.h b/include/hw/arm/allwinner-a10.h | ||
18 | index XXXXXXX..XXXXXXX 100644 | ||
19 | --- a/include/hw/arm/allwinner-a10.h | ||
20 | +++ b/include/hw/arm/allwinner-a10.h | ||
21 | @@ -XXX,XX +XXX,XX @@ typedef struct AwA10State { | ||
22 | /*< public >*/ | ||
23 | |||
24 | ARMCPU cpu; | ||
25 | - qemu_irq irq[AW_A10_PIC_INT_NR]; | ||
26 | AwA10PITState timer; | ||
27 | AwA10PICState intc; | ||
28 | AwEmacState emac; | ||
29 | diff --git a/hw/arm/allwinner-a10.c b/hw/arm/allwinner-a10.c | ||
30 | index XXXXXXX..XXXXXXX 100644 | ||
31 | --- a/hw/arm/allwinner-a10.c | ||
32 | +++ b/hw/arm/allwinner-a10.c | ||
33 | @@ -XXX,XX +XXX,XX @@ static void aw_a10_realize(DeviceState *dev, Error **errp) | ||
34 | { | ||
35 | AwA10State *s = AW_A10(dev); | ||
36 | SysBusDevice *sysbusdev; | ||
37 | - uint8_t i; | ||
38 | qemu_irq fiq, irq; | ||
39 | Error *err = NULL; | ||
40 | |||
41 | @@ -XXX,XX +XXX,XX @@ static void aw_a10_realize(DeviceState *dev, Error **errp) | ||
42 | sysbus_mmio_map(sysbusdev, 0, AW_A10_PIC_REG_BASE); | ||
43 | sysbus_connect_irq(sysbusdev, 0, irq); | ||
44 | sysbus_connect_irq(sysbusdev, 1, fiq); | ||
45 | - for (i = 0; i < AW_A10_PIC_INT_NR; i++) { | ||
46 | - s->irq[i] = qdev_get_gpio_in(DEVICE(&s->intc), i); | ||
47 | - } | ||
48 | + qdev_pass_gpios(DEVICE(&s->intc), dev, NULL); | ||
49 | |||
50 | object_property_set_bool(OBJECT(&s->timer), true, "realized", &err); | ||
51 | if (err != NULL) { | ||
52 | @@ -XXX,XX +XXX,XX @@ static void aw_a10_realize(DeviceState *dev, Error **errp) | ||
53 | } | ||
54 | sysbusdev = SYS_BUS_DEVICE(&s->timer); | ||
55 | sysbus_mmio_map(sysbusdev, 0, AW_A10_PIT_REG_BASE); | ||
56 | - sysbus_connect_irq(sysbusdev, 0, s->irq[22]); | ||
57 | - sysbus_connect_irq(sysbusdev, 1, s->irq[23]); | ||
58 | - sysbus_connect_irq(sysbusdev, 2, s->irq[24]); | ||
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); | ||
92 | } | ||
93 | |||
94 | -- | ||
95 | 2.20.1 | ||
96 | |||
97 | diff view generated by jsdifflib |
1 | The system_clock_scale global is used only by the armv7m systick | 1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> |
---|---|---|---|
2 | device; move the extern declaration to the armv7m_systick.h header, | ||
3 | and expand the comment to explain what it is and that it should | ||
4 | ideally be replaced with a different approach. | ||
5 | 2 | ||
3 | We won't reuse the CPU IRQ/FIQ variables. Simplify by calling | ||
4 | qdev_get_gpio_in() in place. | ||
5 | |||
6 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
7 | Message-id: 20191230110953.25496-6-f4bug@amsat.org | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
7 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | 9 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
8 | Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
9 | Message-id: 20190516163857.6430-2-peter.maydell@linaro.org | ||
10 | --- | 10 | --- |
11 | include/hw/arm/arm.h | 4 ---- | 11 | hw/arm/allwinner-a10.c | 9 ++++----- |
12 | include/hw/timer/armv7m_systick.h | 22 ++++++++++++++++++++++ | 12 | 1 file changed, 4 insertions(+), 5 deletions(-) |
13 | 2 files changed, 22 insertions(+), 4 deletions(-) | ||
14 | 13 | ||
15 | diff --git a/include/hw/arm/arm.h b/include/hw/arm/arm.h | 14 | diff --git a/hw/arm/allwinner-a10.c b/hw/arm/allwinner-a10.c |
16 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
17 | --- a/include/hw/arm/arm.h | 16 | --- a/hw/arm/allwinner-a10.c |
18 | +++ b/include/hw/arm/arm.h | 17 | +++ b/hw/arm/allwinner-a10.c |
19 | @@ -XXX,XX +XXX,XX @@ void arm_write_secure_board_setup_dummy_smc(ARMCPU *cpu, | 18 | @@ -XXX,XX +XXX,XX @@ static void aw_a10_realize(DeviceState *dev, Error **errp) |
20 | const struct arm_boot_info *info, | 19 | { |
21 | hwaddr mvbar_addr); | 20 | AwA10State *s = AW_A10(dev); |
22 | 21 | SysBusDevice *sysbusdev; | |
23 | -/* Multiplication factor to convert from system clock ticks to qemu timer | 22 | - qemu_irq fiq, irq; |
24 | - ticks. */ | 23 | Error *err = NULL; |
25 | -extern int system_clock_scale; | 24 | |
26 | - | 25 | object_property_set_bool(OBJECT(&s->cpu), true, "realized", &err); |
27 | #endif /* HW_ARM_H */ | 26 | @@ -XXX,XX +XXX,XX @@ static void aw_a10_realize(DeviceState *dev, Error **errp) |
28 | diff --git a/include/hw/timer/armv7m_systick.h b/include/hw/timer/armv7m_systick.h | 27 | error_propagate(errp, err); |
29 | index XXXXXXX..XXXXXXX 100644 | 28 | return; |
30 | --- a/include/hw/timer/armv7m_systick.h | 29 | } |
31 | +++ b/include/hw/timer/armv7m_systick.h | 30 | - irq = qdev_get_gpio_in(DEVICE(&s->cpu), ARM_CPU_IRQ); |
32 | @@ -XXX,XX +XXX,XX @@ typedef struct SysTickState { | 31 | - fiq = qdev_get_gpio_in(DEVICE(&s->cpu), ARM_CPU_FIQ); |
33 | qemu_irq irq; | 32 | |
34 | } SysTickState; | 33 | object_property_set_bool(OBJECT(&s->intc), true, "realized", &err); |
35 | 34 | if (err != NULL) { | |
36 | +/* | 35 | @@ -XXX,XX +XXX,XX @@ static void aw_a10_realize(DeviceState *dev, Error **errp) |
37 | + * Multiplication factor to convert from system clock ticks to qemu timer | 36 | } |
38 | + * ticks. This should be set (by board code, usually) to a value | 37 | sysbusdev = SYS_BUS_DEVICE(&s->intc); |
39 | + * equal to NANOSECONDS_PER_SECOND / frq, where frq is the clock frequency | 38 | sysbus_mmio_map(sysbusdev, 0, AW_A10_PIC_REG_BASE); |
40 | + * in Hz of the CPU. | 39 | - sysbus_connect_irq(sysbusdev, 0, irq); |
41 | + * | 40 | - sysbus_connect_irq(sysbusdev, 1, fiq); |
42 | + * This value is used by the systick device when it is running in | 41 | + sysbus_connect_irq(sysbusdev, 0, |
43 | + * its "use the CPU clock" mode (ie when SYST_CSR.CLKSOURCE == 1) to | 42 | + qdev_get_gpio_in(DEVICE(&s->cpu), ARM_CPU_IRQ)); |
44 | + * set how fast the timer should tick. | 43 | + sysbus_connect_irq(sysbusdev, 1, |
45 | + * | 44 | + qdev_get_gpio_in(DEVICE(&s->cpu), ARM_CPU_FIQ)); |
46 | + * TODO: we should refactor this so that rather than using a global | 45 | qdev_pass_gpios(DEVICE(&s->intc), dev, NULL); |
47 | + * we use a device property or something similar. This is complicated | 46 | |
48 | + * because (a) the property would need to be plumbed through from the | 47 | object_property_set_bool(OBJECT(&s->timer), true, "realized", &err); |
49 | + * board code down through various layers to the systick device | ||
50 | + * and (b) the property needs to be modifiable after realize, because | ||
51 | + * the stellaris board uses this to implement the behaviour where the | ||
52 | + * guest can reprogram the PLL registers to downclock the CPU, and the | ||
53 | + * systick device needs to react accordingly. Possibly this should | ||
54 | + * be deferred until we have a good API for modelling clock trees. | ||
55 | + */ | ||
56 | +extern int system_clock_scale; | ||
57 | + | ||
58 | #endif | ||
59 | -- | 48 | -- |
60 | 2.20.1 | 49 | 2.20.1 |
61 | 50 | ||
62 | 51 | diff view generated by jsdifflib |
1 | The hw/arm/arm.h header now only includes declarations relating | 1 | From: Masahiro Yamada <masahiroy@kernel.org> |
---|---|---|---|
2 | to boot.c code, so it is only needed by Arm board or SoC code. | ||
3 | Remove some unnecessary inclusions of it from target/arm files | ||
4 | and from hw/intc/armv7m_nvic.c. | ||
5 | 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 | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 40 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
7 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
8 | Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
9 | Message-id: 20190516163857.6430-3-peter.maydell@linaro.org | ||
10 | --- | 41 | --- |
11 | hw/intc/armv7m_nvic.c | 1 - | 42 | target/arm/arm-semi.c | 5 +++-- |
12 | target/arm/arm-semi.c | 1 - | 43 | 1 file changed, 3 insertions(+), 2 deletions(-) |
13 | target/arm/cpu.c | 1 - | ||
14 | target/arm/cpu64.c | 1 - | ||
15 | target/arm/kvm.c | 1 - | ||
16 | target/arm/kvm32.c | 1 - | ||
17 | target/arm/kvm64.c | 1 - | ||
18 | 7 files changed, 7 deletions(-) | ||
19 | 44 | ||
20 | diff --git a/hw/intc/armv7m_nvic.c b/hw/intc/armv7m_nvic.c | ||
21 | index XXXXXXX..XXXXXXX 100644 | ||
22 | --- a/hw/intc/armv7m_nvic.c | ||
23 | +++ b/hw/intc/armv7m_nvic.c | ||
24 | @@ -XXX,XX +XXX,XX @@ | ||
25 | #include "cpu.h" | ||
26 | #include "hw/sysbus.h" | ||
27 | #include "qemu/timer.h" | ||
28 | -#include "hw/arm/arm.h" | ||
29 | #include "hw/intc/armv7m_nvic.h" | ||
30 | #include "target/arm/cpu.h" | ||
31 | #include "exec/exec-all.h" | ||
32 | diff --git a/target/arm/arm-semi.c b/target/arm/arm-semi.c | 45 | diff --git a/target/arm/arm-semi.c b/target/arm/arm-semi.c |
33 | index XXXXXXX..XXXXXXX 100644 | 46 | index XXXXXXX..XXXXXXX 100644 |
34 | --- a/target/arm/arm-semi.c | 47 | --- a/target/arm/arm-semi.c |
35 | +++ b/target/arm/arm-semi.c | 48 | +++ b/target/arm/arm-semi.c |
36 | @@ -XXX,XX +XXX,XX @@ | 49 | @@ -XXX,XX +XXX,XX @@ static int alloc_guestfd(void) |
37 | #else | 50 | guestfd_array = g_array_new(FALSE, TRUE, sizeof(GuestFD)); |
38 | #include "qemu-common.h" | 51 | } |
39 | #include "exec/gdbstub.h" | 52 | |
40 | -#include "hw/arm/arm.h" | 53 | - for (i = 0; i < guestfd_array->len; i++) { |
41 | #include "qemu/cutils.h" | 54 | + /* SYS_OPEN should return nonzero handle on success. Start guestfd from 1 */ |
42 | #endif | 55 | + for (i = 1; i < guestfd_array->len; i++) { |
43 | 56 | GuestFD *gf = &g_array_index(guestfd_array, GuestFD, i); | |
44 | diff --git a/target/arm/cpu.c b/target/arm/cpu.c | 57 | |
45 | index XXXXXXX..XXXXXXX 100644 | 58 | if (gf->type == GuestFDUnused) { |
46 | --- a/target/arm/cpu.c | 59 | @@ -XXX,XX +XXX,XX @@ static GuestFD *do_get_guestfd(int guestfd) |
47 | +++ b/target/arm/cpu.c | 60 | return NULL; |
48 | @@ -XXX,XX +XXX,XX @@ | 61 | } |
49 | #if !defined(CONFIG_USER_ONLY) | 62 | |
50 | #include "hw/loader.h" | 63 | - if (guestfd < 0 || guestfd >= guestfd_array->len) { |
51 | #endif | 64 | + if (guestfd <= 0 || guestfd >= guestfd_array->len) { |
52 | -#include "hw/arm/arm.h" | 65 | return NULL; |
53 | #include "sysemu/sysemu.h" | 66 | } |
54 | #include "sysemu/hw_accel.h" | ||
55 | #include "kvm_arm.h" | ||
56 | diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c | ||
57 | index XXXXXXX..XXXXXXX 100644 | ||
58 | --- a/target/arm/cpu64.c | ||
59 | +++ b/target/arm/cpu64.c | ||
60 | @@ -XXX,XX +XXX,XX @@ | ||
61 | #if !defined(CONFIG_USER_ONLY) | ||
62 | #include "hw/loader.h" | ||
63 | #endif | ||
64 | -#include "hw/arm/arm.h" | ||
65 | #include "sysemu/sysemu.h" | ||
66 | #include "sysemu/kvm.h" | ||
67 | #include "kvm_arm.h" | ||
68 | diff --git a/target/arm/kvm.c b/target/arm/kvm.c | ||
69 | index XXXXXXX..XXXXXXX 100644 | ||
70 | --- a/target/arm/kvm.c | ||
71 | +++ b/target/arm/kvm.c | ||
72 | @@ -XXX,XX +XXX,XX @@ | ||
73 | #include "cpu.h" | ||
74 | #include "trace.h" | ||
75 | #include "internals.h" | ||
76 | -#include "hw/arm/arm.h" | ||
77 | #include "hw/pci/pci.h" | ||
78 | #include "exec/memattrs.h" | ||
79 | #include "exec/address-spaces.h" | ||
80 | diff --git a/target/arm/kvm32.c b/target/arm/kvm32.c | ||
81 | index XXXXXXX..XXXXXXX 100644 | ||
82 | --- a/target/arm/kvm32.c | ||
83 | +++ b/target/arm/kvm32.c | ||
84 | @@ -XXX,XX +XXX,XX @@ | ||
85 | #include "sysemu/kvm.h" | ||
86 | #include "kvm_arm.h" | ||
87 | #include "internals.h" | ||
88 | -#include "hw/arm/arm.h" | ||
89 | #include "qemu/log.h" | ||
90 | |||
91 | static inline void set_feature(uint64_t *features, int feature) | ||
92 | diff --git a/target/arm/kvm64.c b/target/arm/kvm64.c | ||
93 | index XXXXXXX..XXXXXXX 100644 | ||
94 | --- a/target/arm/kvm64.c | ||
95 | +++ b/target/arm/kvm64.c | ||
96 | @@ -XXX,XX +XXX,XX @@ | ||
97 | #include "sysemu/kvm.h" | ||
98 | #include "kvm_arm.h" | ||
99 | #include "internals.h" | ||
100 | -#include "hw/arm/arm.h" | ||
101 | |||
102 | static bool have_guest_debug; | ||
103 | 67 | ||
104 | -- | 68 | -- |
105 | 2.20.1 | 69 | 2.20.1 |
106 | 70 | ||
107 | 71 | diff view generated by jsdifflib |
1 | From: Philippe Mathieu-Daudé <philmd@redhat.com> | 1 | From: Martin Kaiser <martin@kaiser.cx> |
---|---|---|---|
2 | 2 | ||
3 | Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> | 3 | Add an emulation for the RNGC random number generator and the compatible |
4 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | 4 | RNGB variant. These peripherals are included (at least) in imx25 and |
5 | Message-id: 20190520214342.13709-2-philmd@redhat.com | 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> | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
7 | --- | 13 | --- |
8 | hw/arm/exynos4_boards.c | 24 ------------------------ | 14 | hw/misc/Makefile.objs | 1 + |
9 | 1 file changed, 24 deletions(-) | 15 | include/hw/arm/fsl-imx25.h | 5 + |
10 | 16 | include/hw/misc/imx_rngc.h | 35 +++++ | |
11 | diff --git a/hw/arm/exynos4_boards.c b/hw/arm/exynos4_boards.c | 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 | ||
12 | index XXXXXXX..XXXXXXX 100644 | 24 | index XXXXXXX..XXXXXXX 100644 |
13 | --- a/hw/arm/exynos4_boards.c | 25 | --- a/hw/misc/Makefile.objs |
14 | +++ b/hw/arm/exynos4_boards.c | 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 | ||
15 | @@ -XXX,XX +XXX,XX @@ | 39 | @@ -XXX,XX +XXX,XX @@ |
16 | #include "hw/net/lan9118.h" | 40 | #include "hw/timer/imx_gpt.h" |
17 | #include "hw/boards.h" | 41 | #include "hw/timer/imx_epit.h" |
18 | 42 | #include "hw/net/imx_fec.h" | |
19 | -#undef DEBUG | 43 | +#include "hw/misc/imx_rngc.h" |
20 | - | 44 | #include "hw/i2c/imx_i2c.h" |
21 | -//#define DEBUG | 45 | #include "hw/gpio/imx_gpio.h" |
22 | - | 46 | #include "exec/memory.h" |
23 | -#ifdef DEBUG | 47 | @@ -XXX,XX +XXX,XX @@ typedef struct FslIMX25State { |
24 | - #undef PRINT_DEBUG | 48 | IMXGPTState gpt[FSL_IMX25_NUM_GPTS]; |
25 | - #define PRINT_DEBUG(fmt, args...) \ | 49 | IMXEPITState epit[FSL_IMX25_NUM_EPITS]; |
26 | - do { \ | 50 | IMXFECState fec; |
27 | - fprintf(stderr, " [%s:%d] "fmt, __func__, __LINE__, ##args); \ | 51 | + IMXRNGCState rngc; |
28 | - } while (0) | 52 | IMXI2CState i2c[FSL_IMX25_NUM_I2CS]; |
29 | -#else | 53 | IMXGPIOState gpio[FSL_IMX25_NUM_GPIOS]; |
30 | - #define PRINT_DEBUG(fmt, args...) do {} while (0) | 54 | MemoryRegion rom[2]; |
31 | -#endif | 55 | @@ -XXX,XX +XXX,XX @@ typedef struct FslIMX25State { |
32 | - | 56 | #define FSL_IMX25_GPIO4_SIZE 0x4000 |
33 | #define SMDK_LAN9118_BASE_ADDR 0x05000000 | 57 | #define FSL_IMX25_GPIO3_ADDR 0x53FA4000 |
34 | 58 | #define FSL_IMX25_GPIO3_SIZE 0x4000 | |
35 | typedef enum Exynos4BoardType { | 59 | +#define FSL_IMX25_RNGC_ADDR 0x53FB0000 |
36 | @@ -XXX,XX +XXX,XX @@ exynos4_boards_init_common(MachineState *machine, | 60 | +#define FSL_IMX25_RNGC_SIZE 0x4000 |
37 | exynos4_board_binfo.gic_cpu_if_addr = | 61 | #define FSL_IMX25_GPIO1_ADDR 0x53FCC000 |
38 | EXYNOS4210_SMP_PRIVATE_BASE_ADDR + 0x100; | 62 | #define FSL_IMX25_GPIO1_SIZE 0x4000 |
39 | 63 | #define FSL_IMX25_GPIO2_ADDR 0x53FD0000 | |
40 | - PRINT_DEBUG("\n ram_size: %luMiB [0x%08lx]\n" | 64 | @@ -XXX,XX +XXX,XX @@ typedef struct FslIMX25State { |
41 | - " kernel_filename: %s\n" | 65 | #define FSL_IMX25_EPIT1_IRQ 28 |
42 | - " kernel_cmdline: %s\n" | 66 | #define FSL_IMX25_EPIT2_IRQ 27 |
43 | - " initrd_filename: %s\n", | 67 | #define FSL_IMX25_FEC_IRQ 57 |
44 | - exynos4_board_ram_size[board_type] / 1048576, | 68 | +#define FSL_IMX25_RNGC_IRQ 22 |
45 | - exynos4_board_ram_size[board_type], | 69 | #define FSL_IMX25_I2C1_IRQ 3 |
46 | - machine->kernel_filename, | 70 | #define FSL_IMX25_I2C2_IRQ 4 |
47 | - machine->kernel_cmdline, | 71 | #define FSL_IMX25_I2C3_IRQ 10 |
48 | - machine->initrd_filename); | 72 | diff --git a/include/hw/misc/imx_rngc.h b/include/hw/misc/imx_rngc.h |
49 | - | 73 | new file mode 100644 |
50 | exynos4_boards_init_ram(s, get_system_memory(), | 74 | index XXXXXXX..XXXXXXX |
51 | exynos4_board_ram_size[board_type]); | 75 | --- /dev/null |
52 | 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) | ||
53 | -- | 426 | -- |
54 | 2.20.1 | 427 | 2.20.1 |
55 | 428 | ||
56 | 429 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | From: Jeff Kubascik <jeff.kubascik@dornerworks.com> |
---|---|---|---|
2 | 2 | ||
3 | The mask implied by the extract is redundant with the one | 3 | The wfi instruction can be configured to be trapped by a higher exception |
4 | implied by the deposit. Also, fix spelling of BFXIL. | 4 | level, such as the EL2 hypervisor. When the instruction is trapped, the |
5 | program counter should contain the address of the wfi instruction that | ||
6 | caused the exception. The program counter is adjusted for this in the wfi op | ||
7 | helper function. | ||
5 | 8 | ||
6 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 9 | However, this correction is done to env->pc, which only applies to AArch64 |
7 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 10 | mode. For AArch32, the program counter is stored in env->regs[15]. This |
8 | Message-id: 20190514011129.11330-3-richard.henderson@linaro.org | 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> | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 16 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
10 | --- | 17 | --- |
11 | target/arm/translate-a64.c | 6 +++--- | 18 | target/arm/op_helper.c | 7 ++++++- |
12 | 1 file changed, 3 insertions(+), 3 deletions(-) | 19 | 1 file changed, 6 insertions(+), 1 deletion(-) |
13 | 20 | ||
14 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c | 21 | diff --git a/target/arm/op_helper.c b/target/arm/op_helper.c |
15 | index XXXXXXX..XXXXXXX 100644 | 22 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/target/arm/translate-a64.c | 23 | --- a/target/arm/op_helper.c |
17 | +++ b/target/arm/translate-a64.c | 24 | +++ b/target/arm/op_helper.c |
18 | @@ -XXX,XX +XXX,XX @@ static void disas_bitfield(DisasContext *s, uint32_t insn) | 25 | @@ -XXX,XX +XXX,XX @@ void HELPER(wfi)(CPUARMState *env, uint32_t insn_len) |
19 | tcg_gen_extract_i64(tcg_rd, tcg_tmp, ri, len); | ||
20 | return; | ||
21 | } | ||
22 | - /* opc == 1, BXFIL fall through to deposit */ | ||
23 | - tcg_gen_extract_i64(tcg_tmp, tcg_tmp, ri, len); | ||
24 | + /* opc == 1, BFXIL fall through to deposit */ | ||
25 | + tcg_gen_shri_i64(tcg_tmp, tcg_tmp, ri); | ||
26 | pos = 0; | ||
27 | } else { | ||
28 | /* Handle the ri > si case with a deposit | ||
29 | @@ -XXX,XX +XXX,XX @@ static void disas_bitfield(DisasContext *s, uint32_t insn) | ||
30 | len = ri; | ||
31 | } | 26 | } |
32 | 27 | ||
33 | - if (opc == 1) { /* BFM, BXFIL */ | 28 | if (target_el) { |
34 | + if (opc == 1) { /* BFM, BFXIL */ | 29 | - env->pc -= insn_len; |
35 | tcg_gen_deposit_i64(tcg_rd, tcg_rd, tcg_tmp, pos, len); | 30 | + if (env->aarch64) { |
36 | } else { | 31 | + env->pc -= insn_len; |
37 | /* SBFM or UBFM: We start with zero, and we haven't modified | 32 | + } else { |
33 | + env->regs[15] -= insn_len; | ||
34 | + } | ||
35 | + | ||
36 | raise_exception(env, EXCP_UDEF, syn_wfx(1, 0xe, 0, insn_len == 2), | ||
37 | target_el); | ||
38 | } | ||
38 | -- | 39 | -- |
39 | 2.20.1 | 40 | 2.20.1 |
40 | 41 | ||
41 | 42 | diff view generated by jsdifflib |
1 | In ich_vmcr_write() we enforce "writes of BPR fields to less than | 1 | From: Jeff Kubascik <jeff.kubascik@dornerworks.com> |
---|---|---|---|
2 | their minimum sets them to the minimum" by doing a "read vbpr and | ||
3 | write it back" operation. A typo here meant that we weren't handling | ||
4 | writes to these fields correctly, because we were reading from VBPR0 | ||
5 | but writing to VBPR1. | ||
6 | 2 | ||
3 | The IAR0/IAR1 register is used to acknowledge an interrupt - a read of the | ||
4 | register activates the highest priority pending interrupt and provides its | ||
5 | interrupt ID. Activating an interrupt can change the CPU's virtual interrupt | ||
6 | state - this change makes sure the virtual irq state is updated. | ||
7 | |||
8 | Signed-off-by: Jeff Kubascik <jeff.kubascik@dornerworks.com> | ||
9 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
10 | Message-id: 20200113154607.97032-1-jeff.kubascik@dornerworks.com | ||
7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
8 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
9 | Message-id: 20190520162809.2677-4-peter.maydell@linaro.org | ||
10 | --- | 12 | --- |
11 | hw/intc/arm_gicv3_cpuif.c | 2 +- | 13 | hw/intc/arm_gicv3_cpuif.c | 3 +++ |
12 | 1 file changed, 1 insertion(+), 1 deletion(-) | 14 | 1 file changed, 3 insertions(+) |
13 | 15 | ||
14 | diff --git a/hw/intc/arm_gicv3_cpuif.c b/hw/intc/arm_gicv3_cpuif.c | 16 | diff --git a/hw/intc/arm_gicv3_cpuif.c b/hw/intc/arm_gicv3_cpuif.c |
15 | index XXXXXXX..XXXXXXX 100644 | 17 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/hw/intc/arm_gicv3_cpuif.c | 18 | --- a/hw/intc/arm_gicv3_cpuif.c |
17 | +++ b/hw/intc/arm_gicv3_cpuif.c | 19 | +++ b/hw/intc/arm_gicv3_cpuif.c |
18 | @@ -XXX,XX +XXX,XX @@ static void ich_vmcr_write(CPUARMState *env, const ARMCPRegInfo *ri, | 20 | @@ -XXX,XX +XXX,XX @@ static uint64_t icv_iar_read(CPUARMState *env, const ARMCPRegInfo *ri) |
19 | /* Enforce "writing BPRs to less than minimum sets them to the minimum" | 21 | |
20 | * by reading and writing back the fields. | 22 | trace_gicv3_icv_iar_read(ri->crm == 8 ? 0 : 1, |
21 | */ | 23 | gicv3_redist_affid(cs), intid); |
22 | - write_vbpr(cs, GICV3_G1, read_vbpr(cs, GICV3_G0)); | 24 | + |
23 | + write_vbpr(cs, GICV3_G0, read_vbpr(cs, GICV3_G0)); | 25 | + gicv3_cpuif_virt_update(cs); |
24 | write_vbpr(cs, GICV3_G1, read_vbpr(cs, GICV3_G1)); | 26 | + |
25 | 27 | return intid; | |
26 | gicv3_cpuif_virt_update(cs); | 28 | } |
29 | |||
27 | -- | 30 | -- |
28 | 2.20.1 | 31 | 2.20.1 |
29 | 32 | ||
30 | 33 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | From: Jeff Kubascik <jeff.kubascik@dornerworks.com> |
---|---|---|---|
2 | 2 | ||
3 | This is, after all, how we implement extract2 in tcg/aarch64. | 3 | The IL bit is set for 32-bit instructions, thus passing false |
4 | with the is_16bit parameter to syn_data_abort_with_iss() makes | ||
5 | a syn mask that always has the IL bit set. | ||
4 | 6 | ||
7 | Pass is_16bit as true to make the initial syn mask have IL=0, | ||
8 | so that the final IL value comes from or'ing template_syn. | ||
9 | |||
10 | Cc: qemu-stable@nongnu.org | ||
11 | Fixes: aaa1f954d4ca ("target-arm: A64: Create Instruction Syndromes for Data Aborts") | ||
12 | Signed-off-by: Jeff Kubascik <jeff.kubascik@dornerworks.com> | ||
13 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
14 | Message-id: 20200117004618.2742-2-richard.henderson@linaro.org | ||
15 | [rth: Extracted this as a self-contained bug fix from a larger patch] | ||
16 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 17 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Message-id: 20190514011129.11330-2-richard.henderson@linaro.org | ||
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 18 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
9 | --- | 19 | --- |
10 | target/arm/translate-a64.c | 38 ++++++++++++++++++++------------------ | 20 | target/arm/tlb_helper.c | 2 +- |
11 | 1 file changed, 20 insertions(+), 18 deletions(-) | 21 | 1 file changed, 1 insertion(+), 1 deletion(-) |
12 | 22 | ||
13 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c | 23 | diff --git a/target/arm/tlb_helper.c b/target/arm/tlb_helper.c |
14 | index XXXXXXX..XXXXXXX 100644 | 24 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/target/arm/translate-a64.c | 25 | --- a/target/arm/tlb_helper.c |
16 | +++ b/target/arm/translate-a64.c | 26 | +++ b/target/arm/tlb_helper.c |
17 | @@ -XXX,XX +XXX,XX @@ static void disas_extract(DisasContext *s, uint32_t insn) | 27 | @@ -XXX,XX +XXX,XX @@ static inline uint32_t merge_syn_data_abort(uint32_t template_syn, |
18 | } else { | 28 | syn = syn_data_abort_with_iss(same_el, |
19 | tcg_gen_ext32u_i64(tcg_rd, cpu_reg(s, rm)); | 29 | 0, 0, 0, 0, 0, |
20 | } | 30 | ea, 0, s1ptw, is_write, fsc, |
21 | - } else if (rm == rn) { /* ROR */ | 31 | - false); |
22 | - tcg_rm = cpu_reg(s, rm); | 32 | + true); |
23 | - if (sf) { | 33 | /* Merge the runtime syndrome with the template syndrome. */ |
24 | - tcg_gen_rotri_i64(tcg_rd, tcg_rm, imm); | 34 | syn |= template_syn; |
25 | - } else { | ||
26 | - TCGv_i32 tmp = tcg_temp_new_i32(); | ||
27 | - tcg_gen_extrl_i64_i32(tmp, tcg_rm); | ||
28 | - tcg_gen_rotri_i32(tmp, tmp, imm); | ||
29 | - tcg_gen_extu_i32_i64(tcg_rd, tmp); | ||
30 | - tcg_temp_free_i32(tmp); | ||
31 | - } | ||
32 | } else { | ||
33 | - tcg_rm = read_cpu_reg(s, rm, sf); | ||
34 | - tcg_rn = read_cpu_reg(s, rn, sf); | ||
35 | - tcg_gen_shri_i64(tcg_rm, tcg_rm, imm); | ||
36 | - tcg_gen_shli_i64(tcg_rn, tcg_rn, bitsize - imm); | ||
37 | - tcg_gen_or_i64(tcg_rd, tcg_rm, tcg_rn); | ||
38 | - if (!sf) { | ||
39 | - tcg_gen_ext32u_i64(tcg_rd, tcg_rd); | ||
40 | + tcg_rm = cpu_reg(s, rm); | ||
41 | + tcg_rn = cpu_reg(s, rn); | ||
42 | + | ||
43 | + if (sf) { | ||
44 | + /* Specialization to ROR happens in EXTRACT2. */ | ||
45 | + tcg_gen_extract2_i64(tcg_rd, tcg_rm, tcg_rn, imm); | ||
46 | + } else { | ||
47 | + TCGv_i32 t0 = tcg_temp_new_i32(); | ||
48 | + | ||
49 | + tcg_gen_extrl_i64_i32(t0, tcg_rm); | ||
50 | + if (rm == rn) { | ||
51 | + tcg_gen_rotri_i32(t0, t0, imm); | ||
52 | + } else { | ||
53 | + TCGv_i32 t1 = tcg_temp_new_i32(); | ||
54 | + tcg_gen_extrl_i64_i32(t1, tcg_rn); | ||
55 | + tcg_gen_extract2_i32(t0, t0, t1, imm); | ||
56 | + tcg_temp_free_i32(t1); | ||
57 | + } | ||
58 | + tcg_gen_extu_i32_i64(tcg_rd, t0); | ||
59 | + tcg_temp_free_i32(t0); | ||
60 | } | ||
61 | } | ||
62 | } | 35 | } |
63 | -- | 36 | -- |
64 | 2.20.1 | 37 | 2.20.1 |
65 | 38 | ||
66 | 39 | diff view generated by jsdifflib |
1 | From: Alistair Francis <alistair.francis@wdc.com> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Commit 89e68b575 "target/arm: Use vector operations for saturation" | 3 | During the conversion to decodetree, the setting of |
4 | causes this abort() when booting QEMU ARM with a Cortex-A15: | 4 | ISSIs16Bit got lost. This causes the guest os to |
5 | incorrectly adjust trapping memory operations. | ||
5 | 6 | ||
6 | 0 0x00007ffff4c2382f in raise () at /usr/lib/libc.so.6 | 7 | Cc: qemu-stable@nongnu.org |
7 | 1 0x00007ffff4c0e672 in abort () at /usr/lib/libc.so.6 | 8 | Fixes: 46beb58efbb8a2a32 ("target/arm: Convert T16, load (literal)") |
8 | 2 0x00005555559c1839 in disas_neon_data_insn (insn=<optimized out>, s=<optimized out>) at ./target/arm/translate.c:6673 | 9 | Reported-by: Jeff Kubascik <jeff.kubascik@dornerworks.com> |
9 | 3 0x00005555559c1839 in disas_neon_data_insn (s=<optimized out>, insn=<optimized out>) at ./target/arm/translate.c:6386 | 10 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
10 | 4 0x00005555559cd8a4 in disas_arm_insn (insn=4081107068, s=0x7fffe59a9510) at ./target/arm/translate.c:9289 | 11 | Message-id: 20200117004618.2742-3-richard.henderson@linaro.org |
11 | 5 0x00005555559cd8a4 in arm_tr_translate_insn (dcbase=0x7fffe59a9510, cpu=<optimized out>) at ./target/arm/translate.c:13612 | 12 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
12 | 6 0x00005555558d1d39 in translator_loop (ops=0x5555561cc580 <arm_translator_ops>, db=0x7fffe59a9510, cpu=0x55555686a2f0, tb=<optimized out>, max_insns=<optimized out>) at ./accel/tcg/translator.c:96 | ||
13 | 7 0x00005555559d10d4 in gen_intermediate_code (cpu=cpu@entry=0x55555686a2f0, tb=tb@entry=0x7fffd7840080 <code_gen_buffer+126091347>, max_insns=max_insns@entry=512) at ./target/arm/translate.c:13901 | ||
14 | 8 0x00005555558d06b9 in tb_gen_code (cpu=cpu@entry=0x55555686a2f0, pc=3067096216, cs_base=0, flags=192, cflags=-16252928, cflags@entry=524288) at ./accel/tcg/translate-all.c:1736 | ||
15 | 9 0x00005555558ce467 in tb_find (cf_mask=524288, tb_exit=1, last_tb=0x7fffd783e640 <code_gen_buffer+126084627>, cpu=0x1) at ./accel/tcg/cpu-exec.c:407 | ||
16 | 10 0x00005555558ce467 in cpu_exec (cpu=cpu@entry=0x55555686a2f0) at ./accel/tcg/cpu-exec.c:728 | ||
17 | 11 0x000055555588b0cf in tcg_cpu_exec (cpu=0x55555686a2f0) at ./cpus.c:1431 | ||
18 | 12 0x000055555588d223 in qemu_tcg_cpu_thread_fn (arg=0x55555686a2f0) at ./cpus.c:1735 | ||
19 | 13 0x000055555588d223 in qemu_tcg_cpu_thread_fn (arg=arg@entry=0x55555686a2f0) at ./cpus.c:1709 | ||
20 | 14 0x0000555555d2629a in qemu_thread_start (args=<optimized out>) at ./util/qemu-thread-posix.c:502 | ||
21 | 15 0x00007ffff4db8a92 in start_thread () at /usr/lib/libpthread. | ||
22 | |||
23 | This patch ensures that we don't hit the abort() in the second switch | ||
24 | case in disas_neon_data_insn() as we will return from the first case. | ||
25 | |||
26 | Signed-off-by: Alistair Francis <alistair.francis@wdc.com> | ||
27 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
28 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
29 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | ||
30 | Tested-by: Alex Bennée <alex.bennee@linaro.org> | ||
31 | Message-id: ad91b397f360b2fc7f4087e476f7df5b04d42ddb.1558021877.git.alistair.francis@wdc.com | ||
32 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 13 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
33 | --- | 14 | --- |
34 | target/arm/translate.c | 4 ++-- | 15 | target/arm/translate.c | 3 +++ |
35 | 1 file changed, 2 insertions(+), 2 deletions(-) | 16 | 1 file changed, 3 insertions(+) |
36 | 17 | ||
37 | diff --git a/target/arm/translate.c b/target/arm/translate.c | 18 | diff --git a/target/arm/translate.c b/target/arm/translate.c |
38 | index XXXXXXX..XXXXXXX 100644 | 19 | index XXXXXXX..XXXXXXX 100644 |
39 | --- a/target/arm/translate.c | 20 | --- a/target/arm/translate.c |
40 | +++ b/target/arm/translate.c | 21 | +++ b/target/arm/translate.c |
41 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) | 22 | @@ -XXX,XX +XXX,XX @@ static ISSInfo make_issinfo(DisasContext *s, int rd, bool p, bool w) |
42 | tcg_gen_gvec_4(rd_ofs, offsetof(CPUARMState, vfp.qc), | 23 | /* ISS not valid if writeback */ |
43 | rn_ofs, rm_ofs, vec_size, vec_size, | 24 | if (p && !w) { |
44 | (u ? uqadd_op : sqadd_op) + size); | 25 | ret = rd; |
45 | - break; | 26 | + if (s->base.pc_next - s->pc_curr == 2) { |
46 | + return 0; | 27 | + ret |= ISSIs16Bit; |
47 | 28 | + } | |
48 | case NEON_3R_VQSUB: | 29 | } else { |
49 | tcg_gen_gvec_4(rd_ofs, offsetof(CPUARMState, vfp.qc), | 30 | ret = ISSInvalid; |
50 | rn_ofs, rm_ofs, vec_size, vec_size, | 31 | } |
51 | (u ? uqsub_op : sqsub_op) + size); | ||
52 | - break; | ||
53 | + return 0; | ||
54 | |||
55 | case NEON_3R_VMUL: /* VMUL */ | ||
56 | if (u) { | ||
57 | -- | 32 | -- |
58 | 2.20.1 | 33 | 2.20.1 |
59 | 34 | ||
60 | 35 | diff view generated by jsdifflib |