1 | Last lot of patches for arm before softfreeze tomorrow... | 1 | Not very much here, but several people have fallen over |
---|---|---|---|
2 | the vector operation segfault bug, so let's get the fix | ||
3 | into master. | ||
2 | 4 | ||
3 | thanks | 5 | thanks |
4 | -- PMM | 6 | -- PMM |
5 | 7 | ||
6 | The following changes since commit ef3a6af5e789ff078d1fef880f9dfb6adf18e8f1: | 8 | The following changes since commit d418238dca7b4e0b124135827ead3076233052b1: |
7 | 9 | ||
8 | Merge remote-tracking branch 'remotes/kraxel/tags/vga-20181029-pull-request' into staging (2018-10-29 12:59:15 +0000) | 10 | Merge remote-tracking branch 'remotes/rth/tags/pull-rng-20190522' into staging (2019-05-23 12:57:17 +0100) |
9 | 11 | ||
10 | are available in the Git repository at: | 12 | are available in the Git repository at: |
11 | 13 | ||
12 | https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20181029 | 14 | https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20190523 |
13 | 15 | ||
14 | for you to fetch changes up to 20cf5663734310a282e27b7389bc9f53ffe227e6: | 16 | for you to fetch changes up to 98e4f4fdb8ea05d840f51f47125924c2bb9df2df: |
15 | 17 | ||
16 | tests/boot-serial-test: Add microbit board testcase (2018-10-29 15:19:48 +0000) | 18 | hw/arm/exynos4210: QOM'ify the Exynos4210 SoC (2019-05-23 14:47:44 +0100) |
17 | 19 | ||
18 | ---------------------------------------------------------------- | 20 | ---------------------------------------------------------------- |
19 | target-arm queue: | 21 | target-arm queue: |
20 | * microbit: Add the UART to our nRF51 SoC model | 22 | * exynos4210: QOM'ify the Exynos4210 SoC |
21 | * Add a virtual Xilinx Versal board "xlnx-versal-virt" | 23 | * exynos4210: Add DMA support for the Exynos4210 |
22 | * hw/arm/virt: Set VIRT_COMPAT_3_0 compat | 24 | * arm_gicv3: Fix writes to ICC_CTLR_EL3 |
25 | * arm_gicv3: Fix write of ICH_VMCR_EL2.{VBPR0, VBPR1} | ||
26 | * target/arm: Fix vector operation segfault | ||
27 | * target/arm: Minor improvements to BFXIL, EXTR | ||
23 | 28 | ||
24 | ---------------------------------------------------------------- | 29 | ---------------------------------------------------------------- |
25 | Edgar E. Iglesias (2): | 30 | Alistair Francis (1): |
26 | hw/arm: versal: Add a model of Xilinx Versal SoC | 31 | target/arm: Fix vector operation segfault |
27 | hw/arm: versal: Add a virtual Xilinx Versal board | ||
28 | 32 | ||
29 | Eric Auger (1): | 33 | Guenter Roeck (1): |
30 | hw/arm/virt: Set VIRT_COMPAT_3_0 compat | 34 | hw/arm/exynos4210: Add DMA support for the Exynos4210 |
31 | 35 | ||
32 | Julia Suvorova (3): | 36 | Peter Maydell (5): |
33 | hw/char: Implement nRF51 SoC UART | 37 | arm: Move system_clock_scale to armv7m_systick.h |
34 | hw/arm/nrf51_soc: Connect UART to nRF51 SoC | 38 | arm: Remove unnecessary includes of hw/arm/arm.h |
35 | tests/boot-serial-test: Add microbit board testcase | 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 | ||
36 | 42 | ||
37 | hw/arm/Makefile.objs | 1 + | 43 | Philippe Mathieu-Daudé (3): |
38 | hw/char/Makefile.objs | 1 + | 44 | hw/arm/exynos4: Remove unuseful debug code |
39 | include/hw/arm/nrf51_soc.h | 3 + | 45 | hw/arm/exynos4: Use the IEC binary prefix definitions |
40 | include/hw/arm/xlnx-versal.h | 122 +++++++++ | 46 | hw/arm/exynos4210: QOM'ify the Exynos4210 SoC |
41 | include/hw/char/nrf51_uart.h | 78 ++++++ | ||
42 | hw/arm/microbit.c | 2 + | ||
43 | hw/arm/nrf51_soc.c | 20 ++ | ||
44 | hw/arm/virt.c | 4 + | ||
45 | hw/arm/xlnx-versal-virt.c | 493 ++++++++++++++++++++++++++++++++++++ | ||
46 | hw/arm/xlnx-versal.c | 323 +++++++++++++++++++++++ | ||
47 | hw/char/nrf51_uart.c | 330 ++++++++++++++++++++++++ | ||
48 | tests/boot-serial-test.c | 19 ++ | ||
49 | default-configs/aarch64-softmmu.mak | 1 + | ||
50 | hw/char/trace-events | 4 + | ||
51 | 14 files changed, 1401 insertions(+) | ||
52 | create mode 100644 include/hw/arm/xlnx-versal.h | ||
53 | create mode 100644 include/hw/char/nrf51_uart.h | ||
54 | create mode 100644 hw/arm/xlnx-versal-virt.c | ||
55 | create mode 100644 hw/arm/xlnx-versal.c | ||
56 | create mode 100644 hw/char/nrf51_uart.c | ||
57 | 47 | ||
48 | Richard Henderson (2): | ||
49 | target/arm: Use extract2 for EXTR | ||
50 | target/arm: Simplify BFXIL expansion | ||
51 | |||
52 | include/hw/arm/allwinner-a10.h | 2 +- | ||
53 | include/hw/arm/aspeed_soc.h | 1 - | ||
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 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | This is, after all, how we implement extract2 in tcg/aarch64. | ||
4 | |||
5 | 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> | ||
9 | --- | ||
10 | target/arm/translate-a64.c | 38 ++++++++++++++++++++------------------ | ||
11 | 1 file changed, 20 insertions(+), 18 deletions(-) | ||
12 | |||
13 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c | ||
14 | index XXXXXXX..XXXXXXX 100644 | ||
15 | --- a/target/arm/translate-a64.c | ||
16 | +++ b/target/arm/translate-a64.c | ||
17 | @@ -XXX,XX +XXX,XX @@ static void disas_extract(DisasContext *s, uint32_t insn) | ||
18 | } else { | ||
19 | tcg_gen_ext32u_i64(tcg_rd, cpu_reg(s, rm)); | ||
20 | } | ||
21 | - } else if (rm == rn) { /* ROR */ | ||
22 | - tcg_rm = cpu_reg(s, rm); | ||
23 | - if (sf) { | ||
24 | - tcg_gen_rotri_i64(tcg_rd, tcg_rm, imm); | ||
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 | } | ||
63 | -- | ||
64 | 2.20.1 | ||
65 | |||
66 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | The mask implied by the extract is redundant with the one | ||
4 | implied by the deposit. Also, fix spelling of BFXIL. | ||
5 | |||
6 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
7 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
8 | Message-id: 20190514011129.11330-3-richard.henderson@linaro.org | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | --- | ||
11 | target/arm/translate-a64.c | 6 +++--- | ||
12 | 1 file changed, 3 insertions(+), 3 deletions(-) | ||
13 | |||
14 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c | ||
15 | index XXXXXXX..XXXXXXX 100644 | ||
16 | --- a/target/arm/translate-a64.c | ||
17 | +++ b/target/arm/translate-a64.c | ||
18 | @@ -XXX,XX +XXX,XX @@ static void disas_bitfield(DisasContext *s, uint32_t insn) | ||
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 | } | ||
32 | |||
33 | - if (opc == 1) { /* BFM, BXFIL */ | ||
34 | + if (opc == 1) { /* BFM, BFXIL */ | ||
35 | tcg_gen_deposit_i64(tcg_rd, tcg_rd, tcg_tmp, pos, len); | ||
36 | } else { | ||
37 | /* SBFM or UBFM: We start with zero, and we haven't modified | ||
38 | -- | ||
39 | 2.20.1 | ||
40 | |||
41 | diff view generated by jsdifflib |
1 | From: Julia Suvorova via Qemu-devel <qemu-devel@nongnu.org> | 1 | From: Alistair Francis <alistair.francis@wdc.com> |
---|---|---|---|
2 | 2 | ||
3 | Not implemented: CTS/NCTS, PSEL*. | 3 | Commit 89e68b575 "target/arm: Use vector operations for saturation" |
4 | causes this abort() when booting QEMU ARM with a Cortex-A15: | ||
4 | 5 | ||
5 | Signed-off-by: Julia Suvorova <jusual@mail.ru> | 6 | 0 0x00007ffff4c2382f in raise () at /usr/lib/libc.so.6 |
6 | Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> | 7 | 1 0x00007ffff4c0e672 in abort () at /usr/lib/libc.so.6 |
8 | 2 0x00005555559c1839 in disas_neon_data_insn (insn=<optimized out>, s=<optimized out>) at ./target/arm/translate.c:6673 | ||
9 | 3 0x00005555559c1839 in disas_neon_data_insn (s=<optimized out>, insn=<optimized out>) at ./target/arm/translate.c:6386 | ||
10 | 4 0x00005555559cd8a4 in disas_arm_insn (insn=4081107068, s=0x7fffe59a9510) at ./target/arm/translate.c:9289 | ||
11 | 5 0x00005555559cd8a4 in arm_tr_translate_insn (dcbase=0x7fffe59a9510, cpu=<optimized out>) at ./target/arm/translate.c:13612 | ||
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 | ||
7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 32 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
8 | --- | 33 | --- |
9 | hw/char/Makefile.objs | 1 + | 34 | target/arm/translate.c | 4 ++-- |
10 | include/hw/char/nrf51_uart.h | 78 +++++++++ | 35 | 1 file changed, 2 insertions(+), 2 deletions(-) |
11 | hw/char/nrf51_uart.c | 330 +++++++++++++++++++++++++++++++++++ | ||
12 | hw/char/trace-events | 4 + | ||
13 | 4 files changed, 413 insertions(+) | ||
14 | create mode 100644 include/hw/char/nrf51_uart.h | ||
15 | create mode 100644 hw/char/nrf51_uart.c | ||
16 | 36 | ||
17 | diff --git a/hw/char/Makefile.objs b/hw/char/Makefile.objs | 37 | diff --git a/target/arm/translate.c b/target/arm/translate.c |
18 | index XXXXXXX..XXXXXXX 100644 | 38 | index XXXXXXX..XXXXXXX 100644 |
19 | --- a/hw/char/Makefile.objs | 39 | --- a/target/arm/translate.c |
20 | +++ b/hw/char/Makefile.objs | 40 | +++ b/target/arm/translate.c |
21 | @@ -XXX,XX +XXX,XX @@ | 41 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) |
22 | common-obj-$(CONFIG_IPACK) += ipoctal232.o | 42 | tcg_gen_gvec_4(rd_ofs, offsetof(CPUARMState, vfp.qc), |
23 | common-obj-$(CONFIG_ESCC) += escc.o | 43 | rn_ofs, rm_ofs, vec_size, vec_size, |
24 | +common-obj-$(CONFIG_NRF51_SOC) += nrf51_uart.o | 44 | (u ? uqadd_op : sqadd_op) + size); |
25 | common-obj-$(CONFIG_PARALLEL) += parallel.o | 45 | - break; |
26 | common-obj-$(CONFIG_PARALLEL) += parallel-isa.o | 46 | + return 0; |
27 | common-obj-$(CONFIG_PL011) += pl011.o | 47 | |
28 | diff --git a/include/hw/char/nrf51_uart.h b/include/hw/char/nrf51_uart.h | 48 | case NEON_3R_VQSUB: |
29 | new file mode 100644 | 49 | tcg_gen_gvec_4(rd_ofs, offsetof(CPUARMState, vfp.qc), |
30 | index XXXXXXX..XXXXXXX | 50 | rn_ofs, rm_ofs, vec_size, vec_size, |
31 | --- /dev/null | 51 | (u ? uqsub_op : sqsub_op) + size); |
32 | +++ b/include/hw/char/nrf51_uart.h | 52 | - break; |
33 | @@ -XXX,XX +XXX,XX @@ | 53 | + return 0; |
34 | +/* | 54 | |
35 | + * nRF51 SoC UART emulation | 55 | case NEON_3R_VMUL: /* VMUL */ |
36 | + * | 56 | if (u) { |
37 | + * Copyright (c) 2018 Julia Suvorova <jusual@mail.ru> | ||
38 | + * | ||
39 | + * This program is free software; you can redistribute it and/or modify | ||
40 | + * it under the terms of the GNU General Public License version 2 or | ||
41 | + * (at your option) any later version. | ||
42 | + */ | ||
43 | + | ||
44 | +#ifndef NRF51_UART_H | ||
45 | +#define NRF51_UART_H | ||
46 | + | ||
47 | +#include "hw/sysbus.h" | ||
48 | +#include "chardev/char-fe.h" | ||
49 | +#include "hw/registerfields.h" | ||
50 | + | ||
51 | +#define UART_FIFO_LENGTH 6 | ||
52 | +#define UART_BASE 0x40002000 | ||
53 | +#define UART_SIZE 0x1000 | ||
54 | + | ||
55 | +#define TYPE_NRF51_UART "nrf51_soc.uart" | ||
56 | +#define NRF51_UART(obj) OBJECT_CHECK(NRF51UARTState, (obj), TYPE_NRF51_UART) | ||
57 | + | ||
58 | +REG32(UART_STARTRX, 0x000) | ||
59 | +REG32(UART_STOPRX, 0x004) | ||
60 | +REG32(UART_STARTTX, 0x008) | ||
61 | +REG32(UART_STOPTX, 0x00C) | ||
62 | +REG32(UART_SUSPEND, 0x01C) | ||
63 | + | ||
64 | +REG32(UART_CTS, 0x100) | ||
65 | +REG32(UART_NCTS, 0x104) | ||
66 | +REG32(UART_RXDRDY, 0x108) | ||
67 | +REG32(UART_TXDRDY, 0x11C) | ||
68 | +REG32(UART_ERROR, 0x124) | ||
69 | +REG32(UART_RXTO, 0x144) | ||
70 | + | ||
71 | +REG32(UART_INTEN, 0x300) | ||
72 | + FIELD(UART_INTEN, CTS, 0, 1) | ||
73 | + FIELD(UART_INTEN, NCTS, 1, 1) | ||
74 | + FIELD(UART_INTEN, RXDRDY, 2, 1) | ||
75 | + FIELD(UART_INTEN, TXDRDY, 7, 1) | ||
76 | + FIELD(UART_INTEN, ERROR, 9, 1) | ||
77 | + FIELD(UART_INTEN, RXTO, 17, 1) | ||
78 | +REG32(UART_INTENSET, 0x304) | ||
79 | +REG32(UART_INTENCLR, 0x308) | ||
80 | +REG32(UART_ERRORSRC, 0x480) | ||
81 | +REG32(UART_ENABLE, 0x500) | ||
82 | +REG32(UART_PSELRTS, 0x508) | ||
83 | +REG32(UART_PSELTXD, 0x50C) | ||
84 | +REG32(UART_PSELCTS, 0x510) | ||
85 | +REG32(UART_PSELRXD, 0x514) | ||
86 | +REG32(UART_RXD, 0x518) | ||
87 | +REG32(UART_TXD, 0x51C) | ||
88 | +REG32(UART_BAUDRATE, 0x524) | ||
89 | +REG32(UART_CONFIG, 0x56C) | ||
90 | + | ||
91 | +typedef struct NRF51UARTState { | ||
92 | + SysBusDevice parent_obj; | ||
93 | + | ||
94 | + MemoryRegion iomem; | ||
95 | + CharBackend chr; | ||
96 | + qemu_irq irq; | ||
97 | + guint watch_tag; | ||
98 | + | ||
99 | + uint8_t rx_fifo[UART_FIFO_LENGTH]; | ||
100 | + unsigned int rx_fifo_pos; | ||
101 | + unsigned int rx_fifo_len; | ||
102 | + | ||
103 | + uint32_t reg[0x56C]; | ||
104 | + | ||
105 | + bool rx_started; | ||
106 | + bool tx_started; | ||
107 | + bool pending_tx_byte; | ||
108 | + bool enabled; | ||
109 | +} NRF51UARTState; | ||
110 | + | ||
111 | +#endif | ||
112 | diff --git a/hw/char/nrf51_uart.c b/hw/char/nrf51_uart.c | ||
113 | new file mode 100644 | ||
114 | index XXXXXXX..XXXXXXX | ||
115 | --- /dev/null | ||
116 | +++ b/hw/char/nrf51_uart.c | ||
117 | @@ -XXX,XX +XXX,XX @@ | ||
118 | +/* | ||
119 | + * nRF51 SoC UART emulation | ||
120 | + * | ||
121 | + * See nRF51 Series Reference Manual, "29 Universal Asynchronous | ||
122 | + * Receiver/Transmitter" for hardware specifications: | ||
123 | + * http://infocenter.nordicsemi.com/pdf/nRF51_RM_v3.0.pdf | ||
124 | + * | ||
125 | + * Copyright (c) 2018 Julia Suvorova <jusual@mail.ru> | ||
126 | + * | ||
127 | + * This program is free software; you can redistribute it and/or modify | ||
128 | + * it under the terms of the GNU General Public License version 2 or | ||
129 | + * (at your option) any later version. | ||
130 | + */ | ||
131 | + | ||
132 | +#include "qemu/osdep.h" | ||
133 | +#include "qemu/log.h" | ||
134 | +#include "hw/char/nrf51_uart.h" | ||
135 | +#include "trace.h" | ||
136 | + | ||
137 | +static void nrf51_uart_update_irq(NRF51UARTState *s) | ||
138 | +{ | ||
139 | + bool irq = false; | ||
140 | + | ||
141 | + irq |= (s->reg[R_UART_RXDRDY] && | ||
142 | + (s->reg[R_UART_INTEN] & R_UART_INTEN_RXDRDY_MASK)); | ||
143 | + irq |= (s->reg[R_UART_TXDRDY] && | ||
144 | + (s->reg[R_UART_INTEN] & R_UART_INTEN_TXDRDY_MASK)); | ||
145 | + irq |= (s->reg[R_UART_ERROR] && | ||
146 | + (s->reg[R_UART_INTEN] & R_UART_INTEN_ERROR_MASK)); | ||
147 | + irq |= (s->reg[R_UART_RXTO] && | ||
148 | + (s->reg[R_UART_INTEN] & R_UART_INTEN_RXTO_MASK)); | ||
149 | + | ||
150 | + qemu_set_irq(s->irq, irq); | ||
151 | +} | ||
152 | + | ||
153 | +static uint64_t uart_read(void *opaque, hwaddr addr, unsigned int size) | ||
154 | +{ | ||
155 | + NRF51UARTState *s = NRF51_UART(opaque); | ||
156 | + uint64_t r; | ||
157 | + | ||
158 | + if (!s->enabled) { | ||
159 | + return 0; | ||
160 | + } | ||
161 | + | ||
162 | + switch (addr) { | ||
163 | + case A_UART_RXD: | ||
164 | + r = s->rx_fifo[s->rx_fifo_pos]; | ||
165 | + if (s->rx_started && s->rx_fifo_len) { | ||
166 | + s->rx_fifo_pos = (s->rx_fifo_pos + 1) % UART_FIFO_LENGTH; | ||
167 | + s->rx_fifo_len--; | ||
168 | + if (s->rx_fifo_len) { | ||
169 | + s->reg[R_UART_RXDRDY] = 1; | ||
170 | + nrf51_uart_update_irq(s); | ||
171 | + } | ||
172 | + qemu_chr_fe_accept_input(&s->chr); | ||
173 | + } | ||
174 | + break; | ||
175 | + case A_UART_INTENSET: | ||
176 | + case A_UART_INTENCLR: | ||
177 | + case A_UART_INTEN: | ||
178 | + r = s->reg[R_UART_INTEN]; | ||
179 | + break; | ||
180 | + default: | ||
181 | + r = s->reg[addr / 4]; | ||
182 | + break; | ||
183 | + } | ||
184 | + | ||
185 | + trace_nrf51_uart_read(addr, r, size); | ||
186 | + | ||
187 | + return r; | ||
188 | +} | ||
189 | + | ||
190 | +static gboolean uart_transmit(GIOChannel *chan, GIOCondition cond, void *opaque) | ||
191 | +{ | ||
192 | + NRF51UARTState *s = NRF51_UART(opaque); | ||
193 | + int r; | ||
194 | + uint8_t c = s->reg[R_UART_TXD]; | ||
195 | + | ||
196 | + s->watch_tag = 0; | ||
197 | + | ||
198 | + r = qemu_chr_fe_write(&s->chr, &c, 1); | ||
199 | + if (r <= 0) { | ||
200 | + s->watch_tag = qemu_chr_fe_add_watch(&s->chr, G_IO_OUT | G_IO_HUP, | ||
201 | + uart_transmit, s); | ||
202 | + if (!s->watch_tag) { | ||
203 | + /* The hardware has no transmit error reporting, | ||
204 | + * so silently drop the byte | ||
205 | + */ | ||
206 | + goto buffer_drained; | ||
207 | + } | ||
208 | + return FALSE; | ||
209 | + } | ||
210 | + | ||
211 | +buffer_drained: | ||
212 | + s->reg[R_UART_TXDRDY] = 1; | ||
213 | + s->pending_tx_byte = false; | ||
214 | + return FALSE; | ||
215 | +} | ||
216 | + | ||
217 | +static void uart_cancel_transmit(NRF51UARTState *s) | ||
218 | +{ | ||
219 | + if (s->watch_tag) { | ||
220 | + g_source_remove(s->watch_tag); | ||
221 | + s->watch_tag = 0; | ||
222 | + } | ||
223 | +} | ||
224 | + | ||
225 | +static void uart_write(void *opaque, hwaddr addr, | ||
226 | + uint64_t value, unsigned int size) | ||
227 | +{ | ||
228 | + NRF51UARTState *s = NRF51_UART(opaque); | ||
229 | + | ||
230 | + trace_nrf51_uart_write(addr, value, size); | ||
231 | + | ||
232 | + if (!s->enabled && (addr != A_UART_ENABLE)) { | ||
233 | + return; | ||
234 | + } | ||
235 | + | ||
236 | + switch (addr) { | ||
237 | + case A_UART_TXD: | ||
238 | + if (!s->pending_tx_byte && s->tx_started) { | ||
239 | + s->reg[R_UART_TXD] = value; | ||
240 | + s->pending_tx_byte = true; | ||
241 | + uart_transmit(NULL, G_IO_OUT, s); | ||
242 | + } | ||
243 | + break; | ||
244 | + case A_UART_INTEN: | ||
245 | + s->reg[R_UART_INTEN] = value; | ||
246 | + break; | ||
247 | + case A_UART_INTENSET: | ||
248 | + s->reg[R_UART_INTEN] |= value; | ||
249 | + break; | ||
250 | + case A_UART_INTENCLR: | ||
251 | + s->reg[R_UART_INTEN] &= ~value; | ||
252 | + break; | ||
253 | + case A_UART_TXDRDY ... A_UART_RXTO: | ||
254 | + s->reg[addr / 4] = value; | ||
255 | + break; | ||
256 | + case A_UART_ERRORSRC: | ||
257 | + s->reg[addr / 4] &= ~value; | ||
258 | + break; | ||
259 | + case A_UART_RXD: | ||
260 | + break; | ||
261 | + case A_UART_RXDRDY: | ||
262 | + if (value == 0) { | ||
263 | + s->reg[R_UART_RXDRDY] = 0; | ||
264 | + } | ||
265 | + break; | ||
266 | + case A_UART_STARTTX: | ||
267 | + if (value == 1) { | ||
268 | + s->tx_started = true; | ||
269 | + } | ||
270 | + break; | ||
271 | + case A_UART_STARTRX: | ||
272 | + if (value == 1) { | ||
273 | + s->rx_started = true; | ||
274 | + } | ||
275 | + break; | ||
276 | + case A_UART_ENABLE: | ||
277 | + if (value) { | ||
278 | + if (value == 4) { | ||
279 | + s->enabled = true; | ||
280 | + } | ||
281 | + break; | ||
282 | + } | ||
283 | + s->enabled = false; | ||
284 | + value = 1; | ||
285 | + /* fall through */ | ||
286 | + case A_UART_SUSPEND: | ||
287 | + case A_UART_STOPTX: | ||
288 | + if (value == 1) { | ||
289 | + s->tx_started = false; | ||
290 | + } | ||
291 | + /* fall through */ | ||
292 | + case A_UART_STOPRX: | ||
293 | + if (addr != A_UART_STOPTX && value == 1) { | ||
294 | + s->rx_started = false; | ||
295 | + s->reg[R_UART_RXTO] = 1; | ||
296 | + } | ||
297 | + break; | ||
298 | + default: | ||
299 | + s->reg[addr / 4] = value; | ||
300 | + break; | ||
301 | + } | ||
302 | + nrf51_uart_update_irq(s); | ||
303 | +} | ||
304 | + | ||
305 | +static const MemoryRegionOps uart_ops = { | ||
306 | + .read = uart_read, | ||
307 | + .write = uart_write, | ||
308 | + .endianness = DEVICE_LITTLE_ENDIAN, | ||
309 | +}; | ||
310 | + | ||
311 | +static void nrf51_uart_reset(DeviceState *dev) | ||
312 | +{ | ||
313 | + NRF51UARTState *s = NRF51_UART(dev); | ||
314 | + | ||
315 | + s->pending_tx_byte = 0; | ||
316 | + | ||
317 | + uart_cancel_transmit(s); | ||
318 | + | ||
319 | + memset(s->reg, 0, sizeof(s->reg)); | ||
320 | + | ||
321 | + s->reg[R_UART_PSELRTS] = 0xFFFFFFFF; | ||
322 | + s->reg[R_UART_PSELTXD] = 0xFFFFFFFF; | ||
323 | + s->reg[R_UART_PSELCTS] = 0xFFFFFFFF; | ||
324 | + s->reg[R_UART_PSELRXD] = 0xFFFFFFFF; | ||
325 | + s->reg[R_UART_BAUDRATE] = 0x4000000; | ||
326 | + | ||
327 | + s->rx_fifo_len = 0; | ||
328 | + s->rx_fifo_pos = 0; | ||
329 | + s->rx_started = false; | ||
330 | + s->tx_started = false; | ||
331 | + s->enabled = false; | ||
332 | +} | ||
333 | + | ||
334 | +static void uart_receive(void *opaque, const uint8_t *buf, int size) | ||
335 | +{ | ||
336 | + | ||
337 | + NRF51UARTState *s = NRF51_UART(opaque); | ||
338 | + int i; | ||
339 | + | ||
340 | + if (size == 0 || s->rx_fifo_len >= UART_FIFO_LENGTH) { | ||
341 | + return; | ||
342 | + } | ||
343 | + | ||
344 | + for (i = 0; i < size; i++) { | ||
345 | + uint32_t pos = (s->rx_fifo_pos + s->rx_fifo_len) % UART_FIFO_LENGTH; | ||
346 | + s->rx_fifo[pos] = buf[i]; | ||
347 | + s->rx_fifo_len++; | ||
348 | + } | ||
349 | + | ||
350 | + s->reg[R_UART_RXDRDY] = 1; | ||
351 | + nrf51_uart_update_irq(s); | ||
352 | +} | ||
353 | + | ||
354 | +static int uart_can_receive(void *opaque) | ||
355 | +{ | ||
356 | + NRF51UARTState *s = NRF51_UART(opaque); | ||
357 | + | ||
358 | + return s->rx_started ? (UART_FIFO_LENGTH - s->rx_fifo_len) : 0; | ||
359 | +} | ||
360 | + | ||
361 | +static void uart_event(void *opaque, int event) | ||
362 | +{ | ||
363 | + NRF51UARTState *s = NRF51_UART(opaque); | ||
364 | + | ||
365 | + if (event == CHR_EVENT_BREAK) { | ||
366 | + s->reg[R_UART_ERRORSRC] |= 3; | ||
367 | + s->reg[R_UART_ERROR] = 1; | ||
368 | + nrf51_uart_update_irq(s); | ||
369 | + } | ||
370 | +} | ||
371 | + | ||
372 | +static void nrf51_uart_realize(DeviceState *dev, Error **errp) | ||
373 | +{ | ||
374 | + NRF51UARTState *s = NRF51_UART(dev); | ||
375 | + | ||
376 | + qemu_chr_fe_set_handlers(&s->chr, uart_can_receive, uart_receive, | ||
377 | + uart_event, NULL, s, NULL, true); | ||
378 | +} | ||
379 | + | ||
380 | +static void nrf51_uart_init(Object *obj) | ||
381 | +{ | ||
382 | + NRF51UARTState *s = NRF51_UART(obj); | ||
383 | + SysBusDevice *sbd = SYS_BUS_DEVICE(obj); | ||
384 | + | ||
385 | + memory_region_init_io(&s->iomem, obj, &uart_ops, s, | ||
386 | + "nrf51_soc.uart", UART_SIZE); | ||
387 | + sysbus_init_mmio(sbd, &s->iomem); | ||
388 | + sysbus_init_irq(sbd, &s->irq); | ||
389 | +} | ||
390 | + | ||
391 | +static int nrf51_uart_post_load(void *opaque, int version_id) | ||
392 | +{ | ||
393 | + NRF51UARTState *s = NRF51_UART(opaque); | ||
394 | + | ||
395 | + if (s->pending_tx_byte) { | ||
396 | + s->watch_tag = qemu_chr_fe_add_watch(&s->chr, G_IO_OUT | G_IO_HUP, | ||
397 | + uart_transmit, s); | ||
398 | + } | ||
399 | + | ||
400 | + return 0; | ||
401 | +} | ||
402 | + | ||
403 | +static const VMStateDescription nrf51_uart_vmstate = { | ||
404 | + .name = "nrf51_soc.uart", | ||
405 | + .post_load = nrf51_uart_post_load, | ||
406 | + .fields = (VMStateField[]) { | ||
407 | + VMSTATE_UINT32_ARRAY(reg, NRF51UARTState, 0x56C), | ||
408 | + VMSTATE_UINT8_ARRAY(rx_fifo, NRF51UARTState, UART_FIFO_LENGTH), | ||
409 | + VMSTATE_UINT32(rx_fifo_pos, NRF51UARTState), | ||
410 | + VMSTATE_UINT32(rx_fifo_len, NRF51UARTState), | ||
411 | + VMSTATE_BOOL(rx_started, NRF51UARTState), | ||
412 | + VMSTATE_BOOL(tx_started, NRF51UARTState), | ||
413 | + VMSTATE_BOOL(pending_tx_byte, NRF51UARTState), | ||
414 | + VMSTATE_BOOL(enabled, NRF51UARTState), | ||
415 | + VMSTATE_END_OF_LIST() | ||
416 | + } | ||
417 | +}; | ||
418 | + | ||
419 | +static Property nrf51_uart_properties[] = { | ||
420 | + DEFINE_PROP_CHR("chardev", NRF51UARTState, chr), | ||
421 | + DEFINE_PROP_END_OF_LIST(), | ||
422 | +}; | ||
423 | + | ||
424 | +static void nrf51_uart_class_init(ObjectClass *klass, void *data) | ||
425 | +{ | ||
426 | + DeviceClass *dc = DEVICE_CLASS(klass); | ||
427 | + | ||
428 | + dc->reset = nrf51_uart_reset; | ||
429 | + dc->realize = nrf51_uart_realize; | ||
430 | + dc->props = nrf51_uart_properties; | ||
431 | + dc->vmsd = &nrf51_uart_vmstate; | ||
432 | +} | ||
433 | + | ||
434 | +static const TypeInfo nrf51_uart_info = { | ||
435 | + .name = TYPE_NRF51_UART, | ||
436 | + .parent = TYPE_SYS_BUS_DEVICE, | ||
437 | + .instance_size = sizeof(NRF51UARTState), | ||
438 | + .instance_init = nrf51_uart_init, | ||
439 | + .class_init = nrf51_uart_class_init | ||
440 | +}; | ||
441 | + | ||
442 | +static void nrf51_uart_register_types(void) | ||
443 | +{ | ||
444 | + type_register_static(&nrf51_uart_info); | ||
445 | +} | ||
446 | + | ||
447 | +type_init(nrf51_uart_register_types) | ||
448 | diff --git a/hw/char/trace-events b/hw/char/trace-events | ||
449 | index XXXXXXX..XXXXXXX 100644 | ||
450 | --- a/hw/char/trace-events | ||
451 | +++ b/hw/char/trace-events | ||
452 | @@ -XXX,XX +XXX,XX @@ cmsdk_apb_uart_receive(uint8_t c) "CMSDK APB UART: got character 0x%x from backe | ||
453 | cmsdk_apb_uart_tx_pending(void) "CMSDK APB UART: character send to backend pending" | ||
454 | cmsdk_apb_uart_tx(uint8_t c) "CMSDK APB UART: character 0x%x sent to backend" | ||
455 | cmsdk_apb_uart_set_params(int speed) "CMSDK APB UART: params set to %d 8N1" | ||
456 | + | ||
457 | +# hw/char/nrf51_uart.c | ||
458 | +nrf51_uart_read(uint64_t addr, uint64_t r, unsigned int size) "addr 0x%" PRIx64 " value 0x%" PRIx64 " size %u" | ||
459 | +nrf51_uart_write(uint64_t addr, uint64_t value, unsigned int size) "addr 0x%" PRIx64 " value 0x%" PRIx64 " size %u" | ||
460 | -- | 57 | -- |
461 | 2.19.1 | 58 | 2.20.1 |
462 | 59 | ||
463 | 60 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | The system_clock_scale global is used only by the armv7m systick | ||
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. | ||
1 | 5 | ||
6 | 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-2-peter.maydell@linaro.org | ||
10 | --- | ||
11 | include/hw/arm/arm.h | 4 ---- | ||
12 | include/hw/timer/armv7m_systick.h | 22 ++++++++++++++++++++++ | ||
13 | 2 files changed, 22 insertions(+), 4 deletions(-) | ||
14 | |||
15 | diff --git a/include/hw/arm/arm.h b/include/hw/arm/arm.h | ||
16 | index XXXXXXX..XXXXXXX 100644 | ||
17 | --- a/include/hw/arm/arm.h | ||
18 | +++ b/include/hw/arm/arm.h | ||
19 | @@ -XXX,XX +XXX,XX @@ void arm_write_secure_board_setup_dummy_smc(ARMCPU *cpu, | ||
20 | const struct arm_boot_info *info, | ||
21 | hwaddr mvbar_addr); | ||
22 | |||
23 | -/* Multiplication factor to convert from system clock ticks to qemu timer | ||
24 | - ticks. */ | ||
25 | -extern int system_clock_scale; | ||
26 | - | ||
27 | #endif /* HW_ARM_H */ | ||
28 | diff --git a/include/hw/timer/armv7m_systick.h b/include/hw/timer/armv7m_systick.h | ||
29 | index XXXXXXX..XXXXXXX 100644 | ||
30 | --- a/include/hw/timer/armv7m_systick.h | ||
31 | +++ b/include/hw/timer/armv7m_systick.h | ||
32 | @@ -XXX,XX +XXX,XX @@ typedef struct SysTickState { | ||
33 | qemu_irq irq; | ||
34 | } SysTickState; | ||
35 | |||
36 | +/* | ||
37 | + * Multiplication factor to convert from system clock ticks to qemu timer | ||
38 | + * ticks. This should be set (by board code, usually) to a value | ||
39 | + * equal to NANOSECONDS_PER_SECOND / frq, where frq is the clock frequency | ||
40 | + * in Hz of the CPU. | ||
41 | + * | ||
42 | + * This value is used by the systick device when it is running in | ||
43 | + * its "use the CPU clock" mode (ie when SYST_CSR.CLKSOURCE == 1) to | ||
44 | + * set how fast the timer should tick. | ||
45 | + * | ||
46 | + * TODO: we should refactor this so that rather than using a global | ||
47 | + * we use a device property or something similar. This is complicated | ||
48 | + * because (a) the property would need to be plumbed through from the | ||
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 | -- | ||
60 | 2.20.1 | ||
61 | |||
62 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | The hw/arm/arm.h header now only includes declarations relating | ||
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. | ||
1 | 5 | ||
6 | 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 | --- | ||
11 | hw/intc/armv7m_nvic.c | 1 - | ||
12 | target/arm/arm-semi.c | 1 - | ||
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 | |||
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 | ||
33 | index XXXXXXX..XXXXXXX 100644 | ||
34 | --- a/target/arm/arm-semi.c | ||
35 | +++ b/target/arm/arm-semi.c | ||
36 | @@ -XXX,XX +XXX,XX @@ | ||
37 | #else | ||
38 | #include "qemu-common.h" | ||
39 | #include "exec/gdbstub.h" | ||
40 | -#include "hw/arm/arm.h" | ||
41 | #include "qemu/cutils.h" | ||
42 | #endif | ||
43 | |||
44 | diff --git a/target/arm/cpu.c b/target/arm/cpu.c | ||
45 | index XXXXXXX..XXXXXXX 100644 | ||
46 | --- a/target/arm/cpu.c | ||
47 | +++ b/target/arm/cpu.c | ||
48 | @@ -XXX,XX +XXX,XX @@ | ||
49 | #if !defined(CONFIG_USER_ONLY) | ||
50 | #include "hw/loader.h" | ||
51 | #endif | ||
52 | -#include "hw/arm/arm.h" | ||
53 | #include "sysemu/sysemu.h" | ||
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 | |||
104 | -- | ||
105 | 2.20.1 | ||
106 | |||
107 | diff view generated by jsdifflib |
1 | From: Julia Suvorova via Qemu-devel <qemu-devel@nongnu.org> | 1 | The header file hw/arm/arm.h now includes only declarations |
---|---|---|---|
2 | relating to hw/arm/boot.c functionality. Rename it accordingly, | ||
3 | and adjust its header comment. | ||
2 | 4 | ||
3 | Wire up nRF51 UART in the corresponding SoC. | 5 | The bulk of this commit was created via |
6 | perl -pi -e 's|hw/arm/arm.h|hw/arm/boot.h|' hw/arm/*.c include/hw/arm/*.h | ||
4 | 7 | ||
5 | Signed-off-by: Julia Suvorova <jusual@mail.ru> | 8 | In a few cases we can just delete the #include: |
6 | Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> | 9 | hw/arm/msf2-soc.c, include/hw/arm/aspeed_soc.h and |
7 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | 10 | include/hw/arm/bcm2836.h did not require it. |
8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 11 | |
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
13 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
14 | Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
15 | Message-id: 20190516163857.6430-4-peter.maydell@linaro.org | ||
10 | --- | 16 | --- |
11 | include/hw/arm/nrf51_soc.h | 3 +++ | 17 | include/hw/arm/allwinner-a10.h | 2 +- |
12 | hw/arm/microbit.c | 2 ++ | 18 | include/hw/arm/aspeed_soc.h | 1 - |
13 | hw/arm/nrf51_soc.c | 20 ++++++++++++++++++++ | 19 | include/hw/arm/bcm2836.h | 1 - |
14 | 3 files changed, 25 insertions(+) | 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%) | ||
15 | 68 | ||
16 | diff --git a/include/hw/arm/nrf51_soc.h b/include/hw/arm/nrf51_soc.h | 69 | diff --git a/include/hw/arm/allwinner-a10.h b/include/hw/arm/allwinner-a10.h |
17 | index XXXXXXX..XXXXXXX 100644 | 70 | index XXXXXXX..XXXXXXX 100644 |
18 | --- a/include/hw/arm/nrf51_soc.h | 71 | --- a/include/hw/arm/allwinner-a10.h |
19 | +++ b/include/hw/arm/nrf51_soc.h | 72 | +++ b/include/hw/arm/allwinner-a10.h |
20 | @@ -XXX,XX +XXX,XX @@ | 73 | @@ -XXX,XX +XXX,XX @@ |
21 | 74 | #include "qemu-common.h" | |
22 | #include "hw/sysbus.h" | 75 | #include "qemu/error-report.h" |
23 | #include "hw/arm/armv7m.h" | 76 | #include "hw/char/serial.h" |
24 | +#include "hw/char/nrf51_uart.h" | 77 | -#include "hw/arm/arm.h" |
25 | 78 | +#include "hw/arm/boot.h" | |
26 | #define TYPE_NRF51_SOC "nrf51-soc" | 79 | #include "hw/timer/allwinner-a10-pit.h" |
27 | #define NRF51_SOC(obj) \ | 80 | #include "hw/intc/allwinner-a10-pic.h" |
28 | @@ -XXX,XX +XXX,XX @@ typedef struct NRF51State { | 81 | #include "hw/net/allwinner_emac.h" |
29 | /*< public >*/ | 82 | diff --git a/include/hw/arm/aspeed_soc.h b/include/hw/arm/aspeed_soc.h |
30 | ARMv7MState cpu; | 83 | index XXXXXXX..XXXXXXX 100644 |
31 | 84 | --- a/include/hw/arm/aspeed_soc.h | |
32 | + NRF51UARTState uart; | 85 | +++ b/include/hw/arm/aspeed_soc.h |
33 | + | 86 | @@ -XXX,XX +XXX,XX @@ |
34 | MemoryRegion iomem; | 87 | #ifndef ASPEED_SOC_H |
35 | MemoryRegion sram; | 88 | #define ASPEED_SOC_H |
36 | MemoryRegion flash; | 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" | ||
293 | diff --git a/hw/arm/collie.c b/hw/arm/collie.c | ||
294 | index XXXXXXX..XXXXXXX 100644 | ||
295 | --- a/hw/arm/collie.c | ||
296 | +++ b/hw/arm/collie.c | ||
297 | @@ -XXX,XX +XXX,XX @@ | ||
298 | #include "hw/sysbus.h" | ||
299 | #include "hw/boards.h" | ||
300 | #include "strongarm.h" | ||
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" | ||
37 | diff --git a/hw/arm/microbit.c b/hw/arm/microbit.c | 371 | diff --git a/hw/arm/microbit.c b/hw/arm/microbit.c |
38 | index XXXXXXX..XXXXXXX 100644 | 372 | index XXXXXXX..XXXXXXX 100644 |
39 | --- a/hw/arm/microbit.c | 373 | --- a/hw/arm/microbit.c |
40 | +++ b/hw/arm/microbit.c | 374 | +++ b/hw/arm/microbit.c |
41 | @@ -XXX,XX +XXX,XX @@ | 375 | @@ -XXX,XX +XXX,XX @@ |
42 | #include "qapi/error.h" | 376 | #include "qemu/osdep.h" |
43 | #include "hw/boards.h" | 377 | #include "qapi/error.h" |
44 | #include "hw/arm/arm.h" | 378 | #include "hw/boards.h" |
45 | +#include "sysemu/sysemu.h" | 379 | -#include "hw/arm/arm.h" |
46 | #include "exec/address-spaces.h" | 380 | +#include "hw/arm/boot.h" |
47 | 381 | #include "sysemu/sysemu.h" | |
48 | #include "hw/arm/nrf51_soc.h" | 382 | #include "exec/address-spaces.h" |
49 | @@ -XXX,XX +XXX,XX @@ static void microbit_init(MachineState *machine) | 383 | |
50 | 384 | diff --git a/hw/arm/mps2-tz.c b/hw/arm/mps2-tz.c | |
51 | sysbus_init_child_obj(OBJECT(machine), "nrf51", soc, sizeof(s->nrf51), | 385 | index XXXXXXX..XXXXXXX 100644 |
52 | TYPE_NRF51_SOC); | 386 | --- a/hw/arm/mps2-tz.c |
53 | + qdev_prop_set_chr(DEVICE(&s->nrf51), "serial0", serial_hd(0)); | 387 | +++ b/hw/arm/mps2-tz.c |
54 | object_property_set_link(soc, OBJECT(system_memory), "memory", | 388 | @@ -XXX,XX +XXX,XX @@ |
55 | &error_fatal); | 389 | #include "qemu/osdep.h" |
56 | object_property_set_bool(soc, true, "realized", &error_fatal); | 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 | { | ||
57 | diff --git a/hw/arm/nrf51_soc.c b/hw/arm/nrf51_soc.c | 474 | diff --git a/hw/arm/nrf51_soc.c b/hw/arm/nrf51_soc.c |
58 | index XXXXXXX..XXXXXXX 100644 | 475 | index XXXXXXX..XXXXXXX 100644 |
59 | --- a/hw/arm/nrf51_soc.c | 476 | --- a/hw/arm/nrf51_soc.c |
60 | +++ b/hw/arm/nrf51_soc.c | 477 | +++ b/hw/arm/nrf51_soc.c |
61 | @@ -XXX,XX +XXX,XX @@ | 478 | @@ -XXX,XX +XXX,XX @@ |
62 | #define NRF51822_FLASH_SIZE (256 * 1024) | 479 | #include "qemu/osdep.h" |
63 | #define NRF51822_SRAM_SIZE (16 * 1024) | 480 | #include "qapi/error.h" |
64 | 481 | #include "qemu-common.h" | |
65 | +#define BASE_TO_IRQ(base) ((base >> 12) & 0x1F) | 482 | -#include "hw/arm/arm.h" |
66 | + | 483 | +#include "hw/arm/boot.h" |
67 | static void nrf51_soc_realize(DeviceState *dev_soc, Error **errp) | 484 | #include "hw/sysbus.h" |
68 | { | 485 | #include "hw/boards.h" |
69 | NRF51State *s = NRF51_SOC(dev_soc); | 486 | #include "hw/misc/unimp.h" |
70 | + MemoryRegion *mr; | 487 | diff --git a/hw/arm/nseries.c b/hw/arm/nseries.c |
71 | Error *err = NULL; | 488 | index XXXXXXX..XXXXXXX 100644 |
72 | 489 | --- a/hw/arm/nseries.c | |
73 | if (!s->board_memory) { | 490 | +++ b/hw/arm/nseries.c |
74 | @@ -XXX,XX +XXX,XX @@ static void nrf51_soc_realize(DeviceState *dev_soc, Error **errp) | 491 | @@ -XXX,XX +XXX,XX @@ |
75 | } | 492 | #include "qemu/bswap.h" |
76 | memory_region_add_subregion(&s->container, SRAM_BASE, &s->sram); | 493 | #include "sysemu/sysemu.h" |
77 | 494 | #include "hw/arm/omap.h" | |
78 | + /* UART */ | 495 | -#include "hw/arm/arm.h" |
79 | + object_property_set_bool(OBJECT(&s->uart), true, "realized", &err); | 496 | +#include "hw/arm/boot.h" |
80 | + if (err) { | 497 | #include "hw/irq.h" |
81 | + error_propagate(errp, err); | 498 | #include "ui/console.h" |
82 | + return; | 499 | #include "hw/boards.h" |
83 | + } | 500 | diff --git a/hw/arm/omap1.c b/hw/arm/omap1.c |
84 | + mr = sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->uart), 0); | 501 | index XXXXXXX..XXXXXXX 100644 |
85 | + memory_region_add_subregion_overlap(&s->container, UART_BASE, mr, 0); | 502 | --- a/hw/arm/omap1.c |
86 | + sysbus_connect_irq(SYS_BUS_DEVICE(&s->uart), 0, | 503 | +++ b/hw/arm/omap1.c |
87 | + qdev_get_gpio_in(DEVICE(&s->cpu), | 504 | @@ -XXX,XX +XXX,XX @@ |
88 | + BASE_TO_IRQ(UART_BASE))); | 505 | #include "cpu.h" |
89 | + | 506 | #include "hw/boards.h" |
90 | create_unimplemented_device("nrf51_soc.io", IOMEM_BASE, IOMEM_SIZE); | 507 | #include "hw/hw.h" |
91 | create_unimplemented_device("nrf51_soc.ficr", FICR_BASE, FICR_SIZE); | 508 | -#include "hw/arm/arm.h" |
92 | create_unimplemented_device("nrf51_soc.private", | 509 | +#include "hw/arm/boot.h" |
93 | @@ -XXX,XX +XXX,XX @@ static void nrf51_soc_init(Object *obj) | 510 | #include "hw/arm/omap.h" |
94 | qdev_prop_set_string(DEVICE(&s->cpu), "cpu-type", | 511 | #include "sysemu/sysemu.h" |
95 | ARM_CPU_TYPE_NAME("cortex-m0")); | 512 | #include "hw/arm/soc_dma.h" |
96 | qdev_prop_set_uint32(DEVICE(&s->cpu), "num-irq", 32); | 513 | diff --git a/hw/arm/omap2.c b/hw/arm/omap2.c |
97 | + | 514 | index XXXXXXX..XXXXXXX 100644 |
98 | + sysbus_init_child_obj(obj, "uart", &s->uart, sizeof(s->uart), | 515 | --- a/hw/arm/omap2.c |
99 | + TYPE_NRF51_UART); | 516 | +++ b/hw/arm/omap2.c |
100 | + object_property_add_alias(obj, "serial0", OBJECT(&s->uart), "chardev", | 517 | @@ -XXX,XX +XXX,XX @@ |
101 | + &error_abort); | 518 | #include "sysemu/qtest.h" |
102 | } | 519 | #include "hw/boards.h" |
103 | 520 | #include "hw/hw.h" | |
104 | static Property nrf51_soc_properties[] = { | 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" | ||
105 | -- | 721 | -- |
106 | 2.19.1 | 722 | 2.20.1 |
107 | 723 | ||
108 | 724 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | In ich_vmcr_write() we enforce "writes of BPR fields to less than | ||
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. | ||
1 | 6 | ||
7 | 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 | --- | ||
11 | hw/intc/arm_gicv3_cpuif.c | 2 +- | ||
12 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
13 | |||
14 | diff --git a/hw/intc/arm_gicv3_cpuif.c b/hw/intc/arm_gicv3_cpuif.c | ||
15 | index XXXXXXX..XXXXXXX 100644 | ||
16 | --- a/hw/intc/arm_gicv3_cpuif.c | ||
17 | +++ b/hw/intc/arm_gicv3_cpuif.c | ||
18 | @@ -XXX,XX +XXX,XX @@ static void ich_vmcr_write(CPUARMState *env, const ARMCPRegInfo *ri, | ||
19 | /* Enforce "writing BPRs to less than minimum sets them to the minimum" | ||
20 | * by reading and writing back the fields. | ||
21 | */ | ||
22 | - write_vbpr(cs, GICV3_G1, read_vbpr(cs, GICV3_G0)); | ||
23 | + write_vbpr(cs, GICV3_G0, read_vbpr(cs, GICV3_G0)); | ||
24 | write_vbpr(cs, GICV3_G1, read_vbpr(cs, GICV3_G1)); | ||
25 | |||
26 | gicv3_cpuif_virt_update(cs); | ||
27 | -- | ||
28 | 2.20.1 | ||
29 | |||
30 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | The ICC_CTLR_EL3 register includes some bits which are aliases | ||
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. | ||
1 | 7 | ||
8 | 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 | --- | ||
12 | hw/intc/arm_gicv3_cpuif.c | 4 ++-- | ||
13 | 1 file changed, 2 insertions(+), 2 deletions(-) | ||
14 | |||
15 | diff --git a/hw/intc/arm_gicv3_cpuif.c b/hw/intc/arm_gicv3_cpuif.c | ||
16 | index XXXXXXX..XXXXXXX 100644 | ||
17 | --- a/hw/intc/arm_gicv3_cpuif.c | ||
18 | +++ b/hw/intc/arm_gicv3_cpuif.c | ||
19 | @@ -XXX,XX +XXX,XX @@ static void icc_ctlr_el3_write(CPUARMState *env, const ARMCPRegInfo *ri, | ||
20 | trace_gicv3_icc_ctlr_el3_write(gicv3_redist_affid(cs), value); | ||
21 | |||
22 | /* *_EL1NS and *_EL1S bits are aliases into the ICC_CTLR_EL1 bits. */ | ||
23 | - cs->icc_ctlr_el1[GICV3_NS] &= (ICC_CTLR_EL1_CBPR | ICC_CTLR_EL1_EOIMODE); | ||
24 | + cs->icc_ctlr_el1[GICV3_NS] &= ~(ICC_CTLR_EL1_CBPR | ICC_CTLR_EL1_EOIMODE); | ||
25 | if (value & ICC_CTLR_EL3_EOIMODE_EL1NS) { | ||
26 | cs->icc_ctlr_el1[GICV3_NS] |= ICC_CTLR_EL1_EOIMODE; | ||
27 | } | ||
28 | @@ -XXX,XX +XXX,XX @@ static void icc_ctlr_el3_write(CPUARMState *env, const ARMCPRegInfo *ri, | ||
29 | cs->icc_ctlr_el1[GICV3_NS] |= ICC_CTLR_EL1_CBPR; | ||
30 | } | ||
31 | |||
32 | - cs->icc_ctlr_el1[GICV3_S] &= (ICC_CTLR_EL1_CBPR | ICC_CTLR_EL1_EOIMODE); | ||
33 | + cs->icc_ctlr_el1[GICV3_S] &= ~(ICC_CTLR_EL1_CBPR | ICC_CTLR_EL1_EOIMODE); | ||
34 | if (value & ICC_CTLR_EL3_EOIMODE_EL1S) { | ||
35 | cs->icc_ctlr_el1[GICV3_S] |= ICC_CTLR_EL1_EOIMODE; | ||
36 | } | ||
37 | -- | ||
38 | 2.20.1 | ||
39 | |||
40 | diff view generated by jsdifflib |
1 | From: Eric Auger <eric.auger@redhat.com> | 1 | From: Philippe Mathieu-Daudé <philmd@redhat.com> |
---|---|---|---|
2 | 2 | ||
3 | We are missing the VIRT_COMPAT_3_0 definition and setting. | 3 | Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> |
4 | Let's add them. | 4 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> |
5 | 5 | Message-id: 20190520214342.13709-2-philmd@redhat.com | |
6 | Signed-off-by: Eric Auger <eric.auger@redhat.com> | ||
7 | Reviewed-by: Andrew Jones <drjones@redhat.com> | ||
8 | Message-id: 20181024085602.16611-1-eric.auger@redhat.com | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
10 | --- | 7 | --- |
11 | hw/arm/virt.c | 4 ++++ | 8 | hw/arm/exynos4_boards.c | 24 ------------------------ |
12 | 1 file changed, 4 insertions(+) | 9 | 1 file changed, 24 deletions(-) |
13 | 10 | ||
14 | diff --git a/hw/arm/virt.c b/hw/arm/virt.c | 11 | diff --git a/hw/arm/exynos4_boards.c b/hw/arm/exynos4_boards.c |
15 | index XXXXXXX..XXXXXXX 100644 | 12 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/hw/arm/virt.c | 13 | --- a/hw/arm/exynos4_boards.c |
17 | +++ b/hw/arm/virt.c | 14 | +++ b/hw/arm/exynos4_boards.c |
18 | @@ -XXX,XX +XXX,XX @@ static void virt_machine_3_1_options(MachineClass *mc) | 15 | @@ -XXX,XX +XXX,XX @@ |
19 | } | 16 | #include "hw/net/lan9118.h" |
20 | DEFINE_VIRT_MACHINE_AS_LATEST(3, 1) | 17 | #include "hw/boards.h" |
21 | 18 | ||
22 | +#define VIRT_COMPAT_3_0 \ | 19 | -#undef DEBUG |
23 | + HW_COMPAT_3_0 | 20 | - |
24 | + | 21 | -//#define DEBUG |
25 | static void virt_3_0_instance_init(Object *obj) | 22 | - |
26 | { | 23 | -#ifdef DEBUG |
27 | virt_3_1_instance_init(obj); | 24 | - #undef PRINT_DEBUG |
28 | @@ -XXX,XX +XXX,XX @@ static void virt_3_0_instance_init(Object *obj) | 25 | - #define PRINT_DEBUG(fmt, args...) \ |
29 | static void virt_machine_3_0_options(MachineClass *mc) | 26 | - do { \ |
30 | { | 27 | - fprintf(stderr, " [%s:%d] "fmt, __func__, __LINE__, ##args); \ |
31 | virt_machine_3_1_options(mc); | 28 | - } while (0) |
32 | + SET_MACHINE_COMPAT(mc, VIRT_COMPAT_3_0); | 29 | -#else |
33 | } | 30 | - #define PRINT_DEBUG(fmt, args...) do {} while (0) |
34 | DEFINE_VIRT_MACHINE(3, 0) | 31 | -#endif |
32 | - | ||
33 | #define SMDK_LAN9118_BASE_ADDR 0x05000000 | ||
34 | |||
35 | typedef enum Exynos4BoardType { | ||
36 | @@ -XXX,XX +XXX,XX @@ exynos4_boards_init_common(MachineState *machine, | ||
37 | exynos4_board_binfo.gic_cpu_if_addr = | ||
38 | EXYNOS4210_SMP_PRIVATE_BASE_ADDR + 0x100; | ||
39 | |||
40 | - PRINT_DEBUG("\n ram_size: %luMiB [0x%08lx]\n" | ||
41 | - " kernel_filename: %s\n" | ||
42 | - " kernel_cmdline: %s\n" | ||
43 | - " initrd_filename: %s\n", | ||
44 | - exynos4_board_ram_size[board_type] / 1048576, | ||
45 | - exynos4_board_ram_size[board_type], | ||
46 | - machine->kernel_filename, | ||
47 | - machine->kernel_cmdline, | ||
48 | - machine->initrd_filename); | ||
49 | - | ||
50 | exynos4_boards_init_ram(s, get_system_memory(), | ||
51 | exynos4_board_ram_size[board_type]); | ||
35 | 52 | ||
36 | -- | 53 | -- |
37 | 2.19.1 | 54 | 2.20.1 |
38 | 55 | ||
39 | 56 | diff view generated by jsdifflib |
1 | From: Julia Suvorova via Qemu-devel <qemu-devel@nongnu.org> | 1 | From: Philippe Mathieu-Daudé <philmd@redhat.com> |
---|---|---|---|
2 | 2 | ||
3 | New mini-kernel test for nRF51 SoC UART. | 3 | It eases code review, unit is explicit. |
4 | 4 | ||
5 | Signed-off-by: Julia Suvorova <jusual@mail.ru> | 5 | Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> |
6 | Acked-by: Thomas Huth <thuth@redhat.com> | 6 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> |
7 | Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> | 7 | Message-id: 20190520214342.13709-3-philmd@redhat.com |
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
9 | --- | 9 | --- |
10 | tests/boot-serial-test.c | 19 +++++++++++++++++++ | 10 | hw/arm/exynos4_boards.c | 5 +++-- |
11 | 1 file changed, 19 insertions(+) | 11 | 1 file changed, 3 insertions(+), 2 deletions(-) |
12 | 12 | ||
13 | diff --git a/tests/boot-serial-test.c b/tests/boot-serial-test.c | 13 | diff --git a/hw/arm/exynos4_boards.c b/hw/arm/exynos4_boards.c |
14 | index XXXXXXX..XXXXXXX 100644 | 14 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/tests/boot-serial-test.c | 15 | --- a/hw/arm/exynos4_boards.c |
16 | +++ b/tests/boot-serial-test.c | 16 | +++ b/hw/arm/exynos4_boards.c |
17 | @@ -XXX,XX +XXX,XX @@ static const uint8_t kernel_aarch64[] = { | 17 | @@ -XXX,XX +XXX,XX @@ |
18 | 0xfd, 0xff, 0xff, 0x17, /* b -12 (loop) */ | 18 | */ |
19 | |||
20 | #include "qemu/osdep.h" | ||
21 | +#include "qemu/units.h" | ||
22 | #include "qapi/error.h" | ||
23 | #include "qemu/error-report.h" | ||
24 | #include "qemu-common.h" | ||
25 | @@ -XXX,XX +XXX,XX @@ static int exynos4_board_smp_bootreg_addr[EXYNOS4_NUM_OF_BOARDS] = { | ||
19 | }; | 26 | }; |
20 | 27 | ||
21 | +static const uint8_t kernel_nrf51[] = { | 28 | static unsigned long exynos4_board_ram_size[EXYNOS4_NUM_OF_BOARDS] = { |
22 | + 0x00, 0x00, 0x00, 0x00, /* Stack top address */ | 29 | - [EXYNOS4_BOARD_NURI] = 0x40000000, |
23 | + 0x09, 0x00, 0x00, 0x00, /* Reset handler address */ | 30 | - [EXYNOS4_BOARD_SMDKC210] = 0x40000000, |
24 | + 0x04, 0x4a, /* ldr r2, [pc, #16] Get ENABLE */ | 31 | + [EXYNOS4_BOARD_NURI] = 1 * GiB, |
25 | + 0x04, 0x21, /* movs r1, #4 */ | 32 | + [EXYNOS4_BOARD_SMDKC210] = 1 * GiB, |
26 | + 0x11, 0x60, /* str r1, [r2] */ | ||
27 | + 0x04, 0x4a, /* ldr r2, [pc, #16] Get STARTTX */ | ||
28 | + 0x01, 0x21, /* movs r1, #1 */ | ||
29 | + 0x11, 0x60, /* str r1, [r2] */ | ||
30 | + 0x03, 0x4a, /* ldr r2, [pc, #12] Get TXD */ | ||
31 | + 0x54, 0x21, /* movs r1, 'T' */ | ||
32 | + 0x11, 0x60, /* str r1, [r2] */ | ||
33 | + 0xfe, 0xe7, /* b . */ | ||
34 | + 0x00, 0x25, 0x00, 0x40, /* 0x40002500 = UART ENABLE */ | ||
35 | + 0x08, 0x20, 0x00, 0x40, /* 0x40002008 = UART STARTTX */ | ||
36 | + 0x1c, 0x25, 0x00, 0x40 /* 0x4000251c = UART TXD */ | ||
37 | +}; | ||
38 | + | ||
39 | typedef struct testdef { | ||
40 | const char *arch; /* Target architecture */ | ||
41 | const char *machine; /* Name of the machine */ | ||
42 | @@ -XXX,XX +XXX,XX @@ static testdef_t tests[] = { | ||
43 | { "hppa", "hppa", "", "SeaBIOS wants SYSTEM HALT" }, | ||
44 | { "aarch64", "virt", "-cpu cortex-a57", "TT", sizeof(kernel_aarch64), | ||
45 | kernel_aarch64 }, | ||
46 | + { "arm", "microbit", "", "T", sizeof(kernel_nrf51), kernel_nrf51 }, | ||
47 | |||
48 | { NULL } | ||
49 | }; | 33 | }; |
34 | |||
35 | static struct arm_boot_info exynos4_board_binfo = { | ||
50 | -- | 36 | -- |
51 | 2.19.1 | 37 | 2.20.1 |
52 | 38 | ||
53 | 39 | diff view generated by jsdifflib |
1 | From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com> | 1 | From: Guenter Roeck <linux@roeck-us.net> |
---|---|---|---|
2 | 2 | ||
3 | Add a virtual Xilinx Versal board. | 3 | QEMU already supports pl330. Instantiate it for Exynos4210. |
4 | 4 | ||
5 | This board is based on the Xilinx Versal SoC. The exact | 5 | Relevant part of Linux arch/arm/boot/dts/exynos4.dtsi: |
6 | details of what peripherals are attached to this board | ||
7 | will remain in control of QEMU. QEMU will generate an | ||
8 | FDT on the fly for Linux and other software to auto-discover | ||
9 | peripherals. | ||
10 | 6 | ||
11 | Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | 7 | / { |
12 | [PMM: removed stray blank line at EOF] | 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> | ||
48 | Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
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> | ||
13 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 53 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
14 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 54 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
15 | --- | 55 | --- |
16 | hw/arm/Makefile.objs | 2 +- | 56 | hw/arm/exynos4210.c | 26 ++++++++++++++++++++++++++ |
17 | hw/arm/xlnx-versal-virt.c | 493 ++++++++++++++++++++++++++++++++++++++ | 57 | 1 file changed, 26 insertions(+) |
18 | 2 files changed, 494 insertions(+), 1 deletion(-) | ||
19 | create mode 100644 hw/arm/xlnx-versal-virt.c | ||
20 | 58 | ||
21 | diff --git a/hw/arm/Makefile.objs b/hw/arm/Makefile.objs | 59 | diff --git a/hw/arm/exynos4210.c b/hw/arm/exynos4210.c |
22 | index XXXXXXX..XXXXXXX 100644 | 60 | index XXXXXXX..XXXXXXX 100644 |
23 | --- a/hw/arm/Makefile.objs | 61 | --- a/hw/arm/exynos4210.c |
24 | +++ b/hw/arm/Makefile.objs | 62 | +++ b/hw/arm/exynos4210.c |
25 | @@ -XXX,XX +XXX,XX @@ obj-$(CONFIG_ALLWINNER_A10) += allwinner-a10.o cubieboard.o | ||
26 | obj-$(CONFIG_RASPI) += bcm2835_peripherals.o bcm2836.o raspi.o | ||
27 | obj-$(CONFIG_STM32F205_SOC) += stm32f205_soc.o | ||
28 | obj-$(CONFIG_XLNX_ZYNQMP_ARM) += xlnx-zynqmp.o xlnx-zcu102.o | ||
29 | -obj-$(CONFIG_XLNX_VERSAL) += xlnx-versal.o | ||
30 | +obj-$(CONFIG_XLNX_VERSAL) += xlnx-versal.o xlnx-versal-virt.o | ||
31 | obj-$(CONFIG_FSL_IMX25) += fsl-imx25.o imx25_pdk.o | ||
32 | obj-$(CONFIG_FSL_IMX31) += fsl-imx31.o kzm.o | ||
33 | obj-$(CONFIG_FSL_IMX6) += fsl-imx6.o sabrelite.o | ||
34 | diff --git a/hw/arm/xlnx-versal-virt.c b/hw/arm/xlnx-versal-virt.c | ||
35 | new file mode 100644 | ||
36 | index XXXXXXX..XXXXXXX | ||
37 | --- /dev/null | ||
38 | +++ b/hw/arm/xlnx-versal-virt.c | ||
39 | @@ -XXX,XX +XXX,XX @@ | 63 | @@ -XXX,XX +XXX,XX @@ |
40 | +/* | 64 | /* EHCI */ |
41 | + * Xilinx Versal Virtual board. | 65 | #define EXYNOS4210_EHCI_BASE_ADDR 0x12580000 |
42 | + * | 66 | |
43 | + * Copyright (c) 2018 Xilinx Inc. | 67 | +/* DMA */ |
44 | + * Written by Edgar E. Iglesias | 68 | +#define EXYNOS4210_PL330_BASE0_ADDR 0x12680000 |
45 | + * | 69 | +#define EXYNOS4210_PL330_BASE1_ADDR 0x12690000 |
46 | + * This program is free software; you can redistribute it and/or modify | 70 | +#define EXYNOS4210_PL330_BASE2_ADDR 0x12850000 |
47 | + * it under the terms of the GNU General Public License version 2 or | ||
48 | + * (at your option) any later version. | ||
49 | + */ | ||
50 | + | 71 | + |
51 | +#include "qemu/osdep.h" | 72 | static uint8_t chipid_and_omr[] = { 0x11, 0x02, 0x21, 0x43, |
52 | +#include "qemu/log.h" | 73 | 0x09, 0x00, 0x00, 0x00 }; |
53 | +#include "qemu/error-report.h" | 74 | |
54 | +#include "qapi/error.h" | 75 | @@ -XXX,XX +XXX,XX @@ static uint64_t exynos4210_calc_affinity(int cpu) |
55 | +#include "sysemu/device_tree.h" | 76 | return (0x9 << ARM_AFF1_SHIFT) | cpu; |
56 | +#include "exec/address-spaces.h" | 77 | } |
57 | +#include "hw/boards.h" | 78 | |
58 | +#include "hw/sysbus.h" | 79 | +static void pl330_create(uint32_t base, qemu_irq irq, int nreq) |
59 | +#include "hw/arm/sysbus-fdt.h" | 80 | +{ |
60 | +#include "hw/arm/fdt.h" | 81 | + SysBusDevice *busdev; |
61 | +#include "cpu.h" | 82 | + DeviceState *dev; |
62 | +#include "hw/arm/xlnx-versal.h" | ||
63 | + | 83 | + |
64 | +#define TYPE_XLNX_VERSAL_VIRT_MACHINE MACHINE_TYPE_NAME("xlnx-versal-virt") | 84 | + dev = qdev_create(NULL, "pl330"); |
65 | +#define XLNX_VERSAL_VIRT_MACHINE(obj) \ | 85 | + qdev_prop_set_uint8(dev, "num_periph_req", nreq); |
66 | + OBJECT_CHECK(VersalVirt, (obj), TYPE_XLNX_VERSAL_VIRT_MACHINE) | 86 | + qdev_init_nofail(dev); |
67 | + | 87 | + busdev = SYS_BUS_DEVICE(dev); |
68 | +typedef struct VersalVirt { | 88 | + sysbus_mmio_map(busdev, 0, base); |
69 | + MachineState parent_obj; | 89 | + sysbus_connect_irq(busdev, 0, irq); |
70 | + | ||
71 | + Versal soc; | ||
72 | + MemoryRegion mr_ddr; | ||
73 | + | ||
74 | + void *fdt; | ||
75 | + int fdt_size; | ||
76 | + struct { | ||
77 | + uint32_t gic; | ||
78 | + uint32_t ethernet_phy[2]; | ||
79 | + uint32_t clk_125Mhz; | ||
80 | + uint32_t clk_25Mhz; | ||
81 | + } phandle; | ||
82 | + struct arm_boot_info binfo; | ||
83 | + | ||
84 | + struct { | ||
85 | + bool secure; | ||
86 | + } cfg; | ||
87 | +} VersalVirt; | ||
88 | + | ||
89 | +static void fdt_create(VersalVirt *s) | ||
90 | +{ | ||
91 | + MachineClass *mc = MACHINE_GET_CLASS(s); | ||
92 | + int i; | ||
93 | + | ||
94 | + s->fdt = create_device_tree(&s->fdt_size); | ||
95 | + if (!s->fdt) { | ||
96 | + error_report("create_device_tree() failed"); | ||
97 | + exit(1); | ||
98 | + } | ||
99 | + | ||
100 | + /* Allocate all phandles. */ | ||
101 | + s->phandle.gic = qemu_fdt_alloc_phandle(s->fdt); | ||
102 | + for (i = 0; i < ARRAY_SIZE(s->phandle.ethernet_phy); i++) { | ||
103 | + s->phandle.ethernet_phy[i] = qemu_fdt_alloc_phandle(s->fdt); | ||
104 | + } | ||
105 | + s->phandle.clk_25Mhz = qemu_fdt_alloc_phandle(s->fdt); | ||
106 | + s->phandle.clk_125Mhz = qemu_fdt_alloc_phandle(s->fdt); | ||
107 | + | ||
108 | + /* Create /chosen node for load_dtb. */ | ||
109 | + qemu_fdt_add_subnode(s->fdt, "/chosen"); | ||
110 | + | ||
111 | + /* Header */ | ||
112 | + qemu_fdt_setprop_cell(s->fdt, "/", "interrupt-parent", s->phandle.gic); | ||
113 | + qemu_fdt_setprop_cell(s->fdt, "/", "#size-cells", 0x2); | ||
114 | + qemu_fdt_setprop_cell(s->fdt, "/", "#address-cells", 0x2); | ||
115 | + qemu_fdt_setprop_string(s->fdt, "/", "model", mc->desc); | ||
116 | + qemu_fdt_setprop_string(s->fdt, "/", "compatible", "xlnx-versal-virt"); | ||
117 | +} | 90 | +} |
118 | + | 91 | + |
119 | +static void fdt_add_clk_node(VersalVirt *s, const char *name, | 92 | Exynos4210State *exynos4210_init(MemoryRegion *system_mem) |
120 | + unsigned int freq_hz, uint32_t phandle) | 93 | { |
121 | +{ | 94 | Exynos4210State *s = g_new0(Exynos4210State, 1); |
122 | + qemu_fdt_add_subnode(s->fdt, name); | 95 | @@ -XXX,XX +XXX,XX @@ Exynos4210State *exynos4210_init(MemoryRegion *system_mem) |
123 | + qemu_fdt_setprop_cell(s->fdt, name, "phandle", phandle); | 96 | sysbus_create_simple(TYPE_EXYNOS4210_EHCI, EXYNOS4210_EHCI_BASE_ADDR, |
124 | + qemu_fdt_setprop_cell(s->fdt, name, "clock-frequency", freq_hz); | 97 | s->irq_table[exynos4210_get_irq(28, 3)]); |
125 | + qemu_fdt_setprop_cell(s->fdt, name, "#clock-cells", 0x0); | 98 | |
126 | + qemu_fdt_setprop_string(s->fdt, name, "compatible", "fixed-clock"); | 99 | + /*** DMA controllers ***/ |
127 | + qemu_fdt_setprop(s->fdt, name, "u-boot,dm-pre-reloc", NULL, 0); | 100 | + pl330_create(EXYNOS4210_PL330_BASE0_ADDR, |
128 | +} | 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); | ||
129 | + | 106 | + |
130 | +static void fdt_add_cpu_nodes(VersalVirt *s, uint32_t psci_conduit) | 107 | return s; |
131 | +{ | 108 | } |
132 | + int i; | ||
133 | + | ||
134 | + qemu_fdt_add_subnode(s->fdt, "/cpus"); | ||
135 | + qemu_fdt_setprop_cell(s->fdt, "/cpus", "#size-cells", 0x0); | ||
136 | + qemu_fdt_setprop_cell(s->fdt, "/cpus", "#address-cells", 1); | ||
137 | + | ||
138 | + for (i = XLNX_VERSAL_NR_ACPUS - 1; i >= 0; i--) { | ||
139 | + char *name = g_strdup_printf("/cpus/cpu@%d", i); | ||
140 | + ARMCPU *armcpu = ARM_CPU(qemu_get_cpu(i)); | ||
141 | + | ||
142 | + qemu_fdt_add_subnode(s->fdt, name); | ||
143 | + qemu_fdt_setprop_cell(s->fdt, name, "reg", armcpu->mp_affinity); | ||
144 | + if (psci_conduit != QEMU_PSCI_CONDUIT_DISABLED) { | ||
145 | + qemu_fdt_setprop_string(s->fdt, name, "enable-method", "psci"); | ||
146 | + } | ||
147 | + qemu_fdt_setprop_string(s->fdt, name, "device_type", "cpu"); | ||
148 | + qemu_fdt_setprop_string(s->fdt, name, "compatible", | ||
149 | + armcpu->dtb_compatible); | ||
150 | + g_free(name); | ||
151 | + } | ||
152 | +} | ||
153 | + | ||
154 | +static void fdt_add_gic_nodes(VersalVirt *s) | ||
155 | +{ | ||
156 | + char *nodename; | ||
157 | + | ||
158 | + nodename = g_strdup_printf("/gic@%x", MM_GIC_APU_DIST_MAIN); | ||
159 | + qemu_fdt_add_subnode(s->fdt, nodename); | ||
160 | + qemu_fdt_setprop_cell(s->fdt, nodename, "phandle", s->phandle.gic); | ||
161 | + qemu_fdt_setprop_cells(s->fdt, nodename, "interrupts", | ||
162 | + GIC_FDT_IRQ_TYPE_PPI, VERSAL_GIC_MAINT_IRQ, | ||
163 | + GIC_FDT_IRQ_FLAGS_LEVEL_HI); | ||
164 | + qemu_fdt_setprop(s->fdt, nodename, "interrupt-controller", NULL, 0); | ||
165 | + qemu_fdt_setprop_sized_cells(s->fdt, nodename, "reg", | ||
166 | + 2, MM_GIC_APU_DIST_MAIN, | ||
167 | + 2, MM_GIC_APU_DIST_MAIN_SIZE, | ||
168 | + 2, MM_GIC_APU_REDIST_0, | ||
169 | + 2, MM_GIC_APU_REDIST_0_SIZE); | ||
170 | + qemu_fdt_setprop_cell(s->fdt, nodename, "#interrupt-cells", 3); | ||
171 | + qemu_fdt_setprop_string(s->fdt, nodename, "compatible", "arm,gic-v3"); | ||
172 | +} | ||
173 | + | ||
174 | +static void fdt_add_timer_nodes(VersalVirt *s) | ||
175 | +{ | ||
176 | + const char compat[] = "arm,armv8-timer"; | ||
177 | + uint32_t irqflags = GIC_FDT_IRQ_FLAGS_LEVEL_HI; | ||
178 | + | ||
179 | + qemu_fdt_add_subnode(s->fdt, "/timer"); | ||
180 | + qemu_fdt_setprop_cells(s->fdt, "/timer", "interrupts", | ||
181 | + GIC_FDT_IRQ_TYPE_PPI, VERSAL_TIMER_S_EL1_IRQ, irqflags, | ||
182 | + GIC_FDT_IRQ_TYPE_PPI, VERSAL_TIMER_NS_EL1_IRQ, irqflags, | ||
183 | + GIC_FDT_IRQ_TYPE_PPI, VERSAL_TIMER_VIRT_IRQ, irqflags, | ||
184 | + GIC_FDT_IRQ_TYPE_PPI, VERSAL_TIMER_NS_EL2_IRQ, irqflags); | ||
185 | + qemu_fdt_setprop(s->fdt, "/timer", "compatible", | ||
186 | + compat, sizeof(compat)); | ||
187 | +} | ||
188 | + | ||
189 | +static void fdt_add_uart_nodes(VersalVirt *s) | ||
190 | +{ | ||
191 | + uint64_t addrs[] = { MM_UART1, MM_UART0 }; | ||
192 | + unsigned int irqs[] = { VERSAL_UART1_IRQ_0, VERSAL_UART0_IRQ_0 }; | ||
193 | + const char compat[] = "arm,pl011\0arm,sbsa-uart"; | ||
194 | + const char clocknames[] = "uartclk\0apb_pclk"; | ||
195 | + int i; | ||
196 | + | ||
197 | + for (i = 0; i < ARRAY_SIZE(addrs); i++) { | ||
198 | + char *name = g_strdup_printf("/uart@%" PRIx64, addrs[i]); | ||
199 | + qemu_fdt_add_subnode(s->fdt, name); | ||
200 | + qemu_fdt_setprop_cell(s->fdt, name, "current-speed", 115200); | ||
201 | + qemu_fdt_setprop_cells(s->fdt, name, "clocks", | ||
202 | + s->phandle.clk_125Mhz, s->phandle.clk_125Mhz); | ||
203 | + qemu_fdt_setprop(s->fdt, name, "clock-names", | ||
204 | + clocknames, sizeof(clocknames)); | ||
205 | + | ||
206 | + qemu_fdt_setprop_cells(s->fdt, name, "interrupts", | ||
207 | + GIC_FDT_IRQ_TYPE_SPI, irqs[i], | ||
208 | + GIC_FDT_IRQ_FLAGS_LEVEL_HI); | ||
209 | + qemu_fdt_setprop_sized_cells(s->fdt, name, "reg", | ||
210 | + 2, addrs[i], 2, 0x1000); | ||
211 | + qemu_fdt_setprop(s->fdt, name, "compatible", | ||
212 | + compat, sizeof(compat)); | ||
213 | + qemu_fdt_setprop(s->fdt, name, "u-boot,dm-pre-reloc", NULL, 0); | ||
214 | + | ||
215 | + if (addrs[i] == MM_UART0) { | ||
216 | + /* Select UART0. */ | ||
217 | + qemu_fdt_setprop_string(s->fdt, "/chosen", "stdout-path", name); | ||
218 | + } | ||
219 | + g_free(name); | ||
220 | + } | ||
221 | +} | ||
222 | + | ||
223 | +static void fdt_add_fixed_link_nodes(VersalVirt *s, char *gemname, | ||
224 | + uint32_t phandle) | ||
225 | +{ | ||
226 | + char *name = g_strdup_printf("%s/fixed-link", gemname); | ||
227 | + | ||
228 | + qemu_fdt_add_subnode(s->fdt, name); | ||
229 | + qemu_fdt_setprop_cell(s->fdt, name, "phandle", phandle); | ||
230 | + qemu_fdt_setprop_cells(s->fdt, name, "full-duplex"); | ||
231 | + qemu_fdt_setprop_cell(s->fdt, name, "speed", 1000); | ||
232 | + g_free(name); | ||
233 | +} | ||
234 | + | ||
235 | +static void fdt_add_gem_nodes(VersalVirt *s) | ||
236 | +{ | ||
237 | + uint64_t addrs[] = { MM_GEM1, MM_GEM0 }; | ||
238 | + unsigned int irqs[] = { VERSAL_GEM1_IRQ_0, VERSAL_GEM0_IRQ_0 }; | ||
239 | + const char clocknames[] = "pclk\0hclk\0tx_clk\0rx_clk"; | ||
240 | + const char compat_gem[] = "cdns,zynqmp-gem\0cdns,gem"; | ||
241 | + int i; | ||
242 | + | ||
243 | + for (i = 0; i < ARRAY_SIZE(addrs); i++) { | ||
244 | + char *name = g_strdup_printf("/ethernet@%" PRIx64, addrs[i]); | ||
245 | + qemu_fdt_add_subnode(s->fdt, name); | ||
246 | + | ||
247 | + fdt_add_fixed_link_nodes(s, name, s->phandle.ethernet_phy[i]); | ||
248 | + qemu_fdt_setprop_string(s->fdt, name, "phy-mode", "rgmii-id"); | ||
249 | + qemu_fdt_setprop_cell(s->fdt, name, "phy-handle", | ||
250 | + s->phandle.ethernet_phy[i]); | ||
251 | + qemu_fdt_setprop_cells(s->fdt, name, "clocks", | ||
252 | + s->phandle.clk_25Mhz, s->phandle.clk_25Mhz, | ||
253 | + s->phandle.clk_25Mhz, s->phandle.clk_25Mhz); | ||
254 | + qemu_fdt_setprop(s->fdt, name, "clock-names", | ||
255 | + clocknames, sizeof(clocknames)); | ||
256 | + qemu_fdt_setprop_cells(s->fdt, name, "interrupts", | ||
257 | + GIC_FDT_IRQ_TYPE_SPI, irqs[i], | ||
258 | + GIC_FDT_IRQ_FLAGS_LEVEL_HI, | ||
259 | + GIC_FDT_IRQ_TYPE_SPI, irqs[i], | ||
260 | + GIC_FDT_IRQ_FLAGS_LEVEL_HI); | ||
261 | + qemu_fdt_setprop_sized_cells(s->fdt, name, "reg", | ||
262 | + 2, addrs[i], 2, 0x1000); | ||
263 | + qemu_fdt_setprop(s->fdt, name, "compatible", | ||
264 | + compat_gem, sizeof(compat_gem)); | ||
265 | + qemu_fdt_setprop_cell(s->fdt, name, "#address-cells", 1); | ||
266 | + qemu_fdt_setprop_cell(s->fdt, name, "#size-cells", 0); | ||
267 | + g_free(name); | ||
268 | + } | ||
269 | +} | ||
270 | + | ||
271 | +static void fdt_nop_memory_nodes(void *fdt, Error **errp) | ||
272 | +{ | ||
273 | + Error *err = NULL; | ||
274 | + char **node_path; | ||
275 | + int n = 0; | ||
276 | + | ||
277 | + node_path = qemu_fdt_node_unit_path(fdt, "memory", &err); | ||
278 | + if (err) { | ||
279 | + error_propagate(errp, err); | ||
280 | + return; | ||
281 | + } | ||
282 | + while (node_path[n]) { | ||
283 | + if (g_str_has_prefix(node_path[n], "/memory")) { | ||
284 | + qemu_fdt_nop_node(fdt, node_path[n]); | ||
285 | + } | ||
286 | + n++; | ||
287 | + } | ||
288 | + g_strfreev(node_path); | ||
289 | +} | ||
290 | + | ||
291 | +static void fdt_add_memory_nodes(VersalVirt *s, void *fdt, uint64_t ram_size) | ||
292 | +{ | ||
293 | + /* Describes the various split DDR access regions. */ | ||
294 | + static const struct { | ||
295 | + uint64_t base; | ||
296 | + uint64_t size; | ||
297 | + } addr_ranges[] = { | ||
298 | + { MM_TOP_DDR, MM_TOP_DDR_SIZE }, | ||
299 | + { MM_TOP_DDR_2, MM_TOP_DDR_2_SIZE }, | ||
300 | + { MM_TOP_DDR_3, MM_TOP_DDR_3_SIZE }, | ||
301 | + { MM_TOP_DDR_4, MM_TOP_DDR_4_SIZE } | ||
302 | + }; | ||
303 | + uint64_t mem_reg_prop[8] = {0}; | ||
304 | + uint64_t size = ram_size; | ||
305 | + Error *err = NULL; | ||
306 | + char *name; | ||
307 | + int i; | ||
308 | + | ||
309 | + fdt_nop_memory_nodes(fdt, &err); | ||
310 | + if (err) { | ||
311 | + error_report_err(err); | ||
312 | + return; | ||
313 | + } | ||
314 | + | ||
315 | + name = g_strdup_printf("/memory@%x", MM_TOP_DDR); | ||
316 | + for (i = 0; i < ARRAY_SIZE(addr_ranges) && size; i++) { | ||
317 | + uint64_t mapsize; | ||
318 | + | ||
319 | + mapsize = size < addr_ranges[i].size ? size : addr_ranges[i].size; | ||
320 | + | ||
321 | + mem_reg_prop[i * 2] = addr_ranges[i].base; | ||
322 | + mem_reg_prop[i * 2 + 1] = mapsize; | ||
323 | + size -= mapsize; | ||
324 | + } | ||
325 | + qemu_fdt_add_subnode(fdt, name); | ||
326 | + qemu_fdt_setprop_string(fdt, name, "device_type", "memory"); | ||
327 | + | ||
328 | + switch (i) { | ||
329 | + case 1: | ||
330 | + qemu_fdt_setprop_sized_cells(fdt, name, "reg", | ||
331 | + 2, mem_reg_prop[0], | ||
332 | + 2, mem_reg_prop[1]); | ||
333 | + break; | ||
334 | + case 2: | ||
335 | + qemu_fdt_setprop_sized_cells(fdt, name, "reg", | ||
336 | + 2, mem_reg_prop[0], | ||
337 | + 2, mem_reg_prop[1], | ||
338 | + 2, mem_reg_prop[2], | ||
339 | + 2, mem_reg_prop[3]); | ||
340 | + break; | ||
341 | + case 3: | ||
342 | + qemu_fdt_setprop_sized_cells(fdt, name, "reg", | ||
343 | + 2, mem_reg_prop[0], | ||
344 | + 2, mem_reg_prop[1], | ||
345 | + 2, mem_reg_prop[2], | ||
346 | + 2, mem_reg_prop[3], | ||
347 | + 2, mem_reg_prop[4], | ||
348 | + 2, mem_reg_prop[5]); | ||
349 | + break; | ||
350 | + case 4: | ||
351 | + qemu_fdt_setprop_sized_cells(fdt, name, "reg", | ||
352 | + 2, mem_reg_prop[0], | ||
353 | + 2, mem_reg_prop[1], | ||
354 | + 2, mem_reg_prop[2], | ||
355 | + 2, mem_reg_prop[3], | ||
356 | + 2, mem_reg_prop[4], | ||
357 | + 2, mem_reg_prop[5], | ||
358 | + 2, mem_reg_prop[6], | ||
359 | + 2, mem_reg_prop[7]); | ||
360 | + break; | ||
361 | + default: | ||
362 | + g_assert_not_reached(); | ||
363 | + } | ||
364 | + g_free(name); | ||
365 | +} | ||
366 | + | ||
367 | +static void versal_virt_modify_dtb(const struct arm_boot_info *binfo, | ||
368 | + void *fdt) | ||
369 | +{ | ||
370 | + VersalVirt *s = container_of(binfo, VersalVirt, binfo); | ||
371 | + | ||
372 | + fdt_add_memory_nodes(s, fdt, binfo->ram_size); | ||
373 | +} | ||
374 | + | ||
375 | +static void *versal_virt_get_dtb(const struct arm_boot_info *binfo, | ||
376 | + int *fdt_size) | ||
377 | +{ | ||
378 | + const VersalVirt *board = container_of(binfo, VersalVirt, binfo); | ||
379 | + | ||
380 | + *fdt_size = board->fdt_size; | ||
381 | + return board->fdt; | ||
382 | +} | ||
383 | + | ||
384 | +#define NUM_VIRTIO_TRANSPORT 32 | ||
385 | +static void create_virtio_regions(VersalVirt *s) | ||
386 | +{ | ||
387 | + int virtio_mmio_size = 0x200; | ||
388 | + int i; | ||
389 | + | ||
390 | + for (i = 0; i < NUM_VIRTIO_TRANSPORT; i++) { | ||
391 | + char *name = g_strdup_printf("virtio%d", i);; | ||
392 | + hwaddr base = MM_TOP_RSVD + i * virtio_mmio_size; | ||
393 | + int irq = VERSAL_RSVD_HIGH_IRQ_FIRST + i; | ||
394 | + MemoryRegion *mr; | ||
395 | + DeviceState *dev; | ||
396 | + qemu_irq pic_irq; | ||
397 | + | ||
398 | + pic_irq = qdev_get_gpio_in(DEVICE(&s->soc.fpd.apu.gic), irq); | ||
399 | + dev = qdev_create(NULL, "virtio-mmio"); | ||
400 | + object_property_add_child(OBJECT(&s->soc), name, OBJECT(dev), | ||
401 | + &error_fatal); | ||
402 | + qdev_init_nofail(dev); | ||
403 | + sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, pic_irq); | ||
404 | + mr = sysbus_mmio_get_region(SYS_BUS_DEVICE(dev), 0); | ||
405 | + memory_region_add_subregion(&s->soc.mr_ps, base, mr); | ||
406 | + sysbus_create_simple("virtio-mmio", base, pic_irq); | ||
407 | + } | ||
408 | + | ||
409 | + for (i = 0; i < NUM_VIRTIO_TRANSPORT; i++) { | ||
410 | + hwaddr base = MM_TOP_RSVD + i * virtio_mmio_size; | ||
411 | + int irq = VERSAL_RSVD_HIGH_IRQ_FIRST + i; | ||
412 | + char *name = g_strdup_printf("/virtio_mmio@%" PRIx64, base); | ||
413 | + | ||
414 | + qemu_fdt_add_subnode(s->fdt, name); | ||
415 | + qemu_fdt_setprop(s->fdt, name, "dma-coherent", NULL, 0); | ||
416 | + qemu_fdt_setprop_cells(s->fdt, name, "interrupts", | ||
417 | + GIC_FDT_IRQ_TYPE_SPI, irq, | ||
418 | + GIC_FDT_IRQ_FLAGS_EDGE_LO_HI); | ||
419 | + qemu_fdt_setprop_sized_cells(s->fdt, name, "reg", | ||
420 | + 2, base, 2, virtio_mmio_size); | ||
421 | + qemu_fdt_setprop_string(s->fdt, name, "compatible", "virtio,mmio"); | ||
422 | + g_free(name); | ||
423 | + } | ||
424 | +} | ||
425 | + | ||
426 | +static void versal_virt_init(MachineState *machine) | ||
427 | +{ | ||
428 | + VersalVirt *s = XLNX_VERSAL_VIRT_MACHINE(machine); | ||
429 | + int psci_conduit = QEMU_PSCI_CONDUIT_DISABLED; | ||
430 | + | ||
431 | + /* | ||
432 | + * If the user provides an Operating System to be loaded, we expect them | ||
433 | + * to use the -kernel command line option. | ||
434 | + * | ||
435 | + * Users can load firmware or boot-loaders with the -device loader options. | ||
436 | + * | ||
437 | + * When loading an OS, we generate a dtb and let arm_load_kernel() select | ||
438 | + * where it gets loaded. This dtb will be passed to the kernel in x0. | ||
439 | + * | ||
440 | + * If there's no -kernel option, we generate a DTB and place it at 0x1000 | ||
441 | + * for the bootloaders or firmware to pick up. | ||
442 | + * | ||
443 | + * If users want to provide their own DTB, they can use the -dtb option. | ||
444 | + * These dtb's will have their memory nodes modified to match QEMU's | ||
445 | + * selected ram_size option before they get passed to the kernel or fw. | ||
446 | + * | ||
447 | + * When loading an OS, we turn on QEMU's PSCI implementation with SMC | ||
448 | + * as the PSCI conduit. When there's no -kernel, we assume the user | ||
449 | + * provides EL3 firmware to handle PSCI. | ||
450 | + */ | ||
451 | + if (machine->kernel_filename) { | ||
452 | + psci_conduit = QEMU_PSCI_CONDUIT_SMC; | ||
453 | + } | ||
454 | + | ||
455 | + memory_region_allocate_system_memory(&s->mr_ddr, NULL, "ddr", | ||
456 | + machine->ram_size); | ||
457 | + | ||
458 | + sysbus_init_child_obj(OBJECT(machine), "xlnx-ve", &s->soc, | ||
459 | + sizeof(s->soc), TYPE_XLNX_VERSAL); | ||
460 | + object_property_set_link(OBJECT(&s->soc), OBJECT(&s->mr_ddr), | ||
461 | + "ddr", &error_abort); | ||
462 | + object_property_set_int(OBJECT(&s->soc), psci_conduit, | ||
463 | + "psci-conduit", &error_abort); | ||
464 | + object_property_set_bool(OBJECT(&s->soc), true, "realized", &error_fatal); | ||
465 | + | ||
466 | + fdt_create(s); | ||
467 | + create_virtio_regions(s); | ||
468 | + fdt_add_gem_nodes(s); | ||
469 | + fdt_add_uart_nodes(s); | ||
470 | + fdt_add_gic_nodes(s); | ||
471 | + fdt_add_timer_nodes(s); | ||
472 | + fdt_add_cpu_nodes(s, psci_conduit); | ||
473 | + fdt_add_clk_node(s, "/clk125", 125000000, s->phandle.clk_125Mhz); | ||
474 | + fdt_add_clk_node(s, "/clk25", 25000000, s->phandle.clk_25Mhz); | ||
475 | + | ||
476 | + /* Make the APU cpu address space visible to virtio and other | ||
477 | + * modules unaware of muliple address-spaces. */ | ||
478 | + memory_region_add_subregion_overlap(get_system_memory(), | ||
479 | + 0, &s->soc.fpd.apu.mr, 0); | ||
480 | + | ||
481 | + s->binfo.ram_size = machine->ram_size; | ||
482 | + s->binfo.kernel_filename = machine->kernel_filename; | ||
483 | + s->binfo.kernel_cmdline = machine->kernel_cmdline; | ||
484 | + s->binfo.initrd_filename = machine->initrd_filename; | ||
485 | + s->binfo.loader_start = 0x0; | ||
486 | + s->binfo.get_dtb = versal_virt_get_dtb; | ||
487 | + s->binfo.modify_dtb = versal_virt_modify_dtb; | ||
488 | + if (machine->kernel_filename) { | ||
489 | + arm_load_kernel(s->soc.fpd.apu.cpu[0], &s->binfo); | ||
490 | + } else { | ||
491 | + AddressSpace *as = arm_boot_address_space(s->soc.fpd.apu.cpu[0], | ||
492 | + &s->binfo); | ||
493 | + /* Some boot-loaders (e.g u-boot) don't like blobs at address 0 (NULL). | ||
494 | + * Offset things by 4K. */ | ||
495 | + s->binfo.loader_start = 0x1000; | ||
496 | + s->binfo.dtb_limit = 0x1000000; | ||
497 | + if (arm_load_dtb(s->binfo.loader_start, | ||
498 | + &s->binfo, s->binfo.dtb_limit, as) < 0) { | ||
499 | + exit(EXIT_FAILURE); | ||
500 | + } | ||
501 | + } | ||
502 | +} | ||
503 | + | ||
504 | +static void versal_virt_machine_instance_init(Object *obj) | ||
505 | +{ | ||
506 | +} | ||
507 | + | ||
508 | +static void versal_virt_machine_class_init(ObjectClass *oc, void *data) | ||
509 | +{ | ||
510 | + MachineClass *mc = MACHINE_CLASS(oc); | ||
511 | + | ||
512 | + mc->desc = "Xilinx Versal Virtual development board"; | ||
513 | + mc->init = versal_virt_init; | ||
514 | + mc->max_cpus = XLNX_VERSAL_NR_ACPUS; | ||
515 | + mc->default_cpus = XLNX_VERSAL_NR_ACPUS; | ||
516 | + mc->no_cdrom = true; | ||
517 | +} | ||
518 | + | ||
519 | +static const TypeInfo versal_virt_machine_init_typeinfo = { | ||
520 | + .name = TYPE_XLNX_VERSAL_VIRT_MACHINE, | ||
521 | + .parent = TYPE_MACHINE, | ||
522 | + .class_init = versal_virt_machine_class_init, | ||
523 | + .instance_init = versal_virt_machine_instance_init, | ||
524 | + .instance_size = sizeof(VersalVirt), | ||
525 | +}; | ||
526 | + | ||
527 | +static void versal_virt_machine_init_register_types(void) | ||
528 | +{ | ||
529 | + type_register_static(&versal_virt_machine_init_typeinfo); | ||
530 | +} | ||
531 | + | ||
532 | +type_init(versal_virt_machine_init_register_types) | ||
533 | -- | 109 | -- |
534 | 2.19.1 | 110 | 2.20.1 |
535 | 111 | ||
536 | 112 | diff view generated by jsdifflib |
1 | From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com> | 1 | From: Philippe Mathieu-Daudé <philmd@redhat.com> |
---|---|---|---|
2 | 2 | ||
3 | Add a model of Xilinx Versal SoC. | 3 | Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> |
4 | 4 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | |
5 | Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | 5 | Message-id: 20190520214342.13709-5-philmd@redhat.com |
6 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
8 | --- | 7 | --- |
9 | hw/arm/Makefile.objs | 1 + | 8 | include/hw/arm/exynos4210.h | 9 +++++++-- |
10 | include/hw/arm/xlnx-versal.h | 122 +++++++++++ | 9 | hw/arm/exynos4210.c | 28 ++++++++++++++++++++++++---- |
11 | hw/arm/xlnx-versal.c | 323 ++++++++++++++++++++++++++++ | 10 | hw/arm/exynos4_boards.c | 9 ++++++--- |
12 | default-configs/aarch64-softmmu.mak | 1 + | 11 | 3 files changed, 37 insertions(+), 9 deletions(-) |
13 | 4 files changed, 447 insertions(+) | ||
14 | create mode 100644 include/hw/arm/xlnx-versal.h | ||
15 | create mode 100644 hw/arm/xlnx-versal.c | ||
16 | 12 | ||
17 | diff --git a/hw/arm/Makefile.objs b/hw/arm/Makefile.objs | 13 | diff --git a/include/hw/arm/exynos4210.h b/include/hw/arm/exynos4210.h |
18 | index XXXXXXX..XXXXXXX 100644 | 14 | index XXXXXXX..XXXXXXX 100644 |
19 | --- a/hw/arm/Makefile.objs | 15 | --- a/include/hw/arm/exynos4210.h |
20 | +++ b/hw/arm/Makefile.objs | 16 | +++ b/include/hw/arm/exynos4210.h |
21 | @@ -XXX,XX +XXX,XX @@ obj-$(CONFIG_ALLWINNER_A10) += allwinner-a10.o cubieboard.o | 17 | @@ -XXX,XX +XXX,XX @@ typedef struct Exynos4210Irq { |
22 | obj-$(CONFIG_RASPI) += bcm2835_peripherals.o bcm2836.o raspi.o | 18 | } Exynos4210Irq; |
23 | obj-$(CONFIG_STM32F205_SOC) += stm32f205_soc.o | 19 | |
24 | obj-$(CONFIG_XLNX_ZYNQMP_ARM) += xlnx-zynqmp.o xlnx-zcu102.o | 20 | typedef struct Exynos4210State { |
25 | +obj-$(CONFIG_XLNX_VERSAL) += xlnx-versal.o | ||
26 | obj-$(CONFIG_FSL_IMX25) += fsl-imx25.o imx25_pdk.o | ||
27 | obj-$(CONFIG_FSL_IMX31) += fsl-imx31.o kzm.o | ||
28 | obj-$(CONFIG_FSL_IMX6) += fsl-imx6.o sabrelite.o | ||
29 | diff --git a/include/hw/arm/xlnx-versal.h b/include/hw/arm/xlnx-versal.h | ||
30 | new file mode 100644 | ||
31 | index XXXXXXX..XXXXXXX | ||
32 | --- /dev/null | ||
33 | +++ b/include/hw/arm/xlnx-versal.h | ||
34 | @@ -XXX,XX +XXX,XX @@ | ||
35 | +/* | ||
36 | + * Model of the Xilinx Versal | ||
37 | + * | ||
38 | + * Copyright (c) 2018 Xilinx Inc. | ||
39 | + * Written by Edgar E. Iglesias | ||
40 | + * | ||
41 | + * This program is free software; you can redistribute it and/or modify | ||
42 | + * it under the terms of the GNU General Public License version 2 or | ||
43 | + * (at your option) any later version. | ||
44 | + */ | ||
45 | + | ||
46 | +#ifndef XLNX_VERSAL_H | ||
47 | +#define XLNX_VERSAL_H | ||
48 | + | ||
49 | +#include "hw/sysbus.h" | ||
50 | +#include "hw/arm/arm.h" | ||
51 | +#include "hw/intc/arm_gicv3.h" | ||
52 | + | ||
53 | +#define TYPE_XLNX_VERSAL "xlnx-versal" | ||
54 | +#define XLNX_VERSAL(obj) OBJECT_CHECK(Versal, (obj), TYPE_XLNX_VERSAL) | ||
55 | + | ||
56 | +#define XLNX_VERSAL_NR_ACPUS 2 | ||
57 | +#define XLNX_VERSAL_NR_UARTS 2 | ||
58 | +#define XLNX_VERSAL_NR_GEMS 2 | ||
59 | +#define XLNX_VERSAL_NR_IRQS 256 | ||
60 | + | ||
61 | +typedef struct Versal { | ||
62 | + /*< private >*/ | 21 | + /*< private >*/ |
63 | + SysBusDevice parent_obj; | 22 | + SysBusDevice parent_obj; |
23 | + /*< public >*/ | ||
24 | ARMCPU *cpu[EXYNOS4210_NCPUS]; | ||
25 | Exynos4210Irq irqs; | ||
26 | qemu_irq *irq_table; | ||
27 | @@ -XXX,XX +XXX,XX @@ typedef struct Exynos4210State { | ||
28 | I2CBus *i2c_if[EXYNOS4210_I2C_NUMBER]; | ||
29 | } Exynos4210State; | ||
30 | |||
31 | +#define TYPE_EXYNOS4210_SOC "exynos4210" | ||
32 | +#define EXYNOS4210_SOC(obj) \ | ||
33 | + OBJECT_CHECK(Exynos4210State, obj, TYPE_EXYNOS4210_SOC) | ||
64 | + | 34 | + |
65 | + /*< public >*/ | 35 | void exynos4210_write_secondary(ARMCPU *cpu, |
66 | + struct { | 36 | const struct arm_boot_info *info); |
67 | + struct { | 37 | |
68 | + MemoryRegion mr; | 38 | -Exynos4210State *exynos4210_init(MemoryRegion *system_mem); |
69 | + ARMCPU *cpu[XLNX_VERSAL_NR_ACPUS]; | 39 | - |
70 | + GICv3State gic; | 40 | /* Initialize exynos4210 IRQ subsystem stub */ |
71 | + } apu; | 41 | qemu_irq *exynos4210_init_irq(Exynos4210Irq *env); |
72 | + } fpd; | 42 | |
43 | diff --git a/hw/arm/exynos4210.c b/hw/arm/exynos4210.c | ||
44 | index XXXXXXX..XXXXXXX 100644 | ||
45 | --- a/hw/arm/exynos4210.c | ||
46 | +++ b/hw/arm/exynos4210.c | ||
47 | @@ -XXX,XX +XXX,XX @@ static void pl330_create(uint32_t base, qemu_irq irq, int nreq) | ||
48 | sysbus_connect_irq(busdev, 0, irq); | ||
49 | } | ||
50 | |||
51 | -Exynos4210State *exynos4210_init(MemoryRegion *system_mem) | ||
52 | +static void exynos4210_realize(DeviceState *socdev, Error **errp) | ||
53 | { | ||
54 | - Exynos4210State *s = g_new0(Exynos4210State, 1); | ||
55 | + Exynos4210State *s = EXYNOS4210_SOC(socdev); | ||
56 | + MemoryRegion *system_mem = get_system_memory(); | ||
57 | qemu_irq gate_irq[EXYNOS4210_NCPUS][EXYNOS4210_IRQ_GATE_NINPUTS]; | ||
58 | SysBusDevice *busdev; | ||
59 | DeviceState *dev; | ||
60 | @@ -XXX,XX +XXX,XX @@ Exynos4210State *exynos4210_init(MemoryRegion *system_mem) | ||
61 | qemu_irq_invert(s->irq_table[exynos4210_get_irq(36, 1)]), 32); | ||
62 | pl330_create(EXYNOS4210_PL330_BASE2_ADDR, | ||
63 | qemu_irq_invert(s->irq_table[exynos4210_get_irq(34, 1)]), 1); | ||
64 | - | ||
65 | - return s; | ||
66 | } | ||
73 | + | 67 | + |
74 | + MemoryRegion mr_ps; | 68 | +static void exynos4210_class_init(ObjectClass *klass, void *data) |
75 | + | ||
76 | + struct { | ||
77 | + /* 4 ranges to access DDR. */ | ||
78 | + MemoryRegion mr_ddr_ranges[4]; | ||
79 | + } noc; | ||
80 | + | ||
81 | + struct { | ||
82 | + MemoryRegion mr_ocm; | ||
83 | + | ||
84 | + struct { | ||
85 | + SysBusDevice *uart[XLNX_VERSAL_NR_UARTS]; | ||
86 | + SysBusDevice *gem[XLNX_VERSAL_NR_GEMS]; | ||
87 | + } iou; | ||
88 | + } lpd; | ||
89 | + | ||
90 | + struct { | ||
91 | + MemoryRegion *mr_ddr; | ||
92 | + uint32_t psci_conduit; | ||
93 | + } cfg; | ||
94 | +} Versal; | ||
95 | + | ||
96 | +/* Memory-map and IRQ definitions. Copied a subset from | ||
97 | + * auto-generated files. */ | ||
98 | + | ||
99 | +#define VERSAL_GIC_MAINT_IRQ 9 | ||
100 | +#define VERSAL_TIMER_VIRT_IRQ 11 | ||
101 | +#define VERSAL_TIMER_S_EL1_IRQ 13 | ||
102 | +#define VERSAL_TIMER_NS_EL1_IRQ 14 | ||
103 | +#define VERSAL_TIMER_NS_EL2_IRQ 10 | ||
104 | + | ||
105 | +#define VERSAL_UART0_IRQ_0 18 | ||
106 | +#define VERSAL_UART1_IRQ_0 19 | ||
107 | +#define VERSAL_GEM0_IRQ_0 56 | ||
108 | +#define VERSAL_GEM0_WAKE_IRQ_0 57 | ||
109 | +#define VERSAL_GEM1_IRQ_0 58 | ||
110 | +#define VERSAL_GEM1_WAKE_IRQ_0 59 | ||
111 | + | ||
112 | +/* Architecturally eserved IRQs suitable for virtualization. */ | ||
113 | +#define VERSAL_RSVD_HIGH_IRQ_FIRST 160 | ||
114 | +#define VERSAL_RSVD_HIGH_IRQ_LAST 255 | ||
115 | + | ||
116 | +#define MM_TOP_RSVD 0xa0000000U | ||
117 | +#define MM_TOP_RSVD_SIZE 0x4000000 | ||
118 | +#define MM_GIC_APU_DIST_MAIN 0xf9000000U | ||
119 | +#define MM_GIC_APU_DIST_MAIN_SIZE 0x10000 | ||
120 | +#define MM_GIC_APU_REDIST_0 0xf9080000U | ||
121 | +#define MM_GIC_APU_REDIST_0_SIZE 0x80000 | ||
122 | + | ||
123 | +#define MM_UART0 0xff000000U | ||
124 | +#define MM_UART0_SIZE 0x10000 | ||
125 | +#define MM_UART1 0xff010000U | ||
126 | +#define MM_UART1_SIZE 0x10000 | ||
127 | + | ||
128 | +#define MM_GEM0 0xff0c0000U | ||
129 | +#define MM_GEM0_SIZE 0x10000 | ||
130 | +#define MM_GEM1 0xff0d0000U | ||
131 | +#define MM_GEM1_SIZE 0x10000 | ||
132 | + | ||
133 | +#define MM_OCM 0xfffc0000U | ||
134 | +#define MM_OCM_SIZE 0x40000 | ||
135 | + | ||
136 | +#define MM_TOP_DDR 0x0 | ||
137 | +#define MM_TOP_DDR_SIZE 0x80000000U | ||
138 | +#define MM_TOP_DDR_2 0x800000000ULL | ||
139 | +#define MM_TOP_DDR_2_SIZE 0x800000000ULL | ||
140 | +#define MM_TOP_DDR_3 0xc000000000ULL | ||
141 | +#define MM_TOP_DDR_3_SIZE 0x4000000000ULL | ||
142 | +#define MM_TOP_DDR_4 0x10000000000ULL | ||
143 | +#define MM_TOP_DDR_4_SIZE 0xb780000000ULL | ||
144 | + | ||
145 | +#define MM_PSM_START 0xffc80000U | ||
146 | +#define MM_PSM_END 0xffcf0000U | ||
147 | + | ||
148 | +#define MM_CRL 0xff5e0000U | ||
149 | +#define MM_CRL_SIZE 0x300000 | ||
150 | +#define MM_IOU_SCNTR 0xff130000U | ||
151 | +#define MM_IOU_SCNTR_SIZE 0x10000 | ||
152 | +#define MM_IOU_SCNTRS 0xff140000U | ||
153 | +#define MM_IOU_SCNTRS_SIZE 0x10000 | ||
154 | +#define MM_FPD_CRF 0xfd1a0000U | ||
155 | +#define MM_FPD_CRF_SIZE 0x140000 | ||
156 | +#endif | ||
157 | diff --git a/hw/arm/xlnx-versal.c b/hw/arm/xlnx-versal.c | ||
158 | new file mode 100644 | ||
159 | index XXXXXXX..XXXXXXX | ||
160 | --- /dev/null | ||
161 | +++ b/hw/arm/xlnx-versal.c | ||
162 | @@ -XXX,XX +XXX,XX @@ | ||
163 | +/* | ||
164 | + * Xilinx Versal SoC model. | ||
165 | + * | ||
166 | + * Copyright (c) 2018 Xilinx Inc. | ||
167 | + * Written by Edgar E. Iglesias | ||
168 | + * | ||
169 | + * This program is free software; you can redistribute it and/or modify | ||
170 | + * it under the terms of the GNU General Public License version 2 or | ||
171 | + * (at your option) any later version. | ||
172 | + */ | ||
173 | + | ||
174 | +#include "qemu/osdep.h" | ||
175 | +#include "qapi/error.h" | ||
176 | +#include "qemu-common.h" | ||
177 | +#include "qemu/log.h" | ||
178 | +#include "hw/sysbus.h" | ||
179 | +#include "net/net.h" | ||
180 | +#include "sysemu/sysemu.h" | ||
181 | +#include "sysemu/kvm.h" | ||
182 | +#include "hw/arm/arm.h" | ||
183 | +#include "kvm_arm.h" | ||
184 | +#include "hw/misc/unimp.h" | ||
185 | +#include "hw/intc/arm_gicv3_common.h" | ||
186 | +#include "hw/arm/xlnx-versal.h" | ||
187 | + | ||
188 | +#define XLNX_VERSAL_ACPU_TYPE ARM_CPU_TYPE_NAME("cortex-a72") | ||
189 | +#define GEM_REVISION 0x40070106 | ||
190 | + | ||
191 | +static void versal_create_apu_cpus(Versal *s) | ||
192 | +{ | ||
193 | + int i; | ||
194 | + | ||
195 | + for (i = 0; i < ARRAY_SIZE(s->fpd.apu.cpu); i++) { | ||
196 | + Object *obj; | ||
197 | + char *name; | ||
198 | + | ||
199 | + obj = object_new(XLNX_VERSAL_ACPU_TYPE); | ||
200 | + if (!obj) { | ||
201 | + /* Secondary CPUs start in PSCI powered-down state */ | ||
202 | + error_report("Unable to create apu.cpu[%d] of type %s", | ||
203 | + i, XLNX_VERSAL_ACPU_TYPE); | ||
204 | + exit(EXIT_FAILURE); | ||
205 | + } | ||
206 | + | ||
207 | + name = g_strdup_printf("apu-cpu[%d]", i); | ||
208 | + object_property_add_child(OBJECT(s), name, obj, &error_fatal); | ||
209 | + g_free(name); | ||
210 | + | ||
211 | + object_property_set_int(obj, s->cfg.psci_conduit, | ||
212 | + "psci-conduit", &error_abort); | ||
213 | + if (i) { | ||
214 | + object_property_set_bool(obj, true, | ||
215 | + "start-powered-off", &error_abort); | ||
216 | + } | ||
217 | + | ||
218 | + object_property_set_int(obj, ARRAY_SIZE(s->fpd.apu.cpu), | ||
219 | + "core-count", &error_abort); | ||
220 | + object_property_set_link(obj, OBJECT(&s->fpd.apu.mr), "memory", | ||
221 | + &error_abort); | ||
222 | + object_property_set_bool(obj, true, "realized", &error_fatal); | ||
223 | + s->fpd.apu.cpu[i] = ARM_CPU(obj); | ||
224 | + } | ||
225 | +} | ||
226 | + | ||
227 | +static void versal_create_apu_gic(Versal *s, qemu_irq *pic) | ||
228 | +{ | ||
229 | + static const uint64_t addrs[] = { | ||
230 | + MM_GIC_APU_DIST_MAIN, | ||
231 | + MM_GIC_APU_REDIST_0 | ||
232 | + }; | ||
233 | + SysBusDevice *gicbusdev; | ||
234 | + DeviceState *gicdev; | ||
235 | + int nr_apu_cpus = ARRAY_SIZE(s->fpd.apu.cpu); | ||
236 | + int i; | ||
237 | + | ||
238 | + sysbus_init_child_obj(OBJECT(s), "apu-gic", | ||
239 | + &s->fpd.apu.gic, sizeof(s->fpd.apu.gic), | ||
240 | + gicv3_class_name()); | ||
241 | + gicbusdev = SYS_BUS_DEVICE(&s->fpd.apu.gic); | ||
242 | + gicdev = DEVICE(&s->fpd.apu.gic); | ||
243 | + qdev_prop_set_uint32(gicdev, "revision", 3); | ||
244 | + qdev_prop_set_uint32(gicdev, "num-cpu", 2); | ||
245 | + qdev_prop_set_uint32(gicdev, "num-irq", XLNX_VERSAL_NR_IRQS + 32); | ||
246 | + qdev_prop_set_uint32(gicdev, "len-redist-region-count", 1); | ||
247 | + qdev_prop_set_uint32(gicdev, "redist-region-count[0]", 2); | ||
248 | + qdev_prop_set_bit(gicdev, "has-security-extensions", true); | ||
249 | + | ||
250 | + object_property_set_bool(OBJECT(&s->fpd.apu.gic), true, "realized", | ||
251 | + &error_fatal); | ||
252 | + | ||
253 | + for (i = 0; i < ARRAY_SIZE(addrs); i++) { | ||
254 | + MemoryRegion *mr; | ||
255 | + | ||
256 | + mr = sysbus_mmio_get_region(gicbusdev, i); | ||
257 | + memory_region_add_subregion(&s->fpd.apu.mr, addrs[i], mr); | ||
258 | + } | ||
259 | + | ||
260 | + for (i = 0; i < nr_apu_cpus; i++) { | ||
261 | + DeviceState *cpudev = DEVICE(s->fpd.apu.cpu[i]); | ||
262 | + int ppibase = XLNX_VERSAL_NR_IRQS + i * GIC_INTERNAL + GIC_NR_SGIS; | ||
263 | + qemu_irq maint_irq; | ||
264 | + int ti; | ||
265 | + /* Mapping from the output timer irq lines from the CPU to the | ||
266 | + * GIC PPI inputs. | ||
267 | + */ | ||
268 | + const int timer_irq[] = { | ||
269 | + [GTIMER_PHYS] = VERSAL_TIMER_NS_EL1_IRQ, | ||
270 | + [GTIMER_VIRT] = VERSAL_TIMER_VIRT_IRQ, | ||
271 | + [GTIMER_HYP] = VERSAL_TIMER_NS_EL2_IRQ, | ||
272 | + [GTIMER_SEC] = VERSAL_TIMER_S_EL1_IRQ, | ||
273 | + }; | ||
274 | + | ||
275 | + for (ti = 0; ti < ARRAY_SIZE(timer_irq); ti++) { | ||
276 | + qdev_connect_gpio_out(cpudev, ti, | ||
277 | + qdev_get_gpio_in(gicdev, | ||
278 | + ppibase + timer_irq[ti])); | ||
279 | + } | ||
280 | + maint_irq = qdev_get_gpio_in(gicdev, | ||
281 | + ppibase + VERSAL_GIC_MAINT_IRQ); | ||
282 | + qdev_connect_gpio_out_named(cpudev, "gicv3-maintenance-interrupt", | ||
283 | + 0, maint_irq); | ||
284 | + sysbus_connect_irq(gicbusdev, i, qdev_get_gpio_in(cpudev, ARM_CPU_IRQ)); | ||
285 | + sysbus_connect_irq(gicbusdev, i + nr_apu_cpus, | ||
286 | + qdev_get_gpio_in(cpudev, ARM_CPU_FIQ)); | ||
287 | + sysbus_connect_irq(gicbusdev, i + 2 * nr_apu_cpus, | ||
288 | + qdev_get_gpio_in(cpudev, ARM_CPU_VIRQ)); | ||
289 | + sysbus_connect_irq(gicbusdev, i + 3 * nr_apu_cpus, | ||
290 | + qdev_get_gpio_in(cpudev, ARM_CPU_VFIQ)); | ||
291 | + } | ||
292 | + | ||
293 | + for (i = 0; i < XLNX_VERSAL_NR_IRQS; i++) { | ||
294 | + pic[i] = qdev_get_gpio_in(gicdev, i); | ||
295 | + } | ||
296 | +} | ||
297 | + | ||
298 | +static void versal_create_uarts(Versal *s, qemu_irq *pic) | ||
299 | +{ | ||
300 | + int i; | ||
301 | + | ||
302 | + for (i = 0; i < ARRAY_SIZE(s->lpd.iou.uart); i++) { | ||
303 | + static const int irqs[] = { VERSAL_UART0_IRQ_0, VERSAL_UART1_IRQ_0}; | ||
304 | + static const uint64_t addrs[] = { MM_UART0, MM_UART1 }; | ||
305 | + char *name = g_strdup_printf("uart%d", i); | ||
306 | + DeviceState *dev; | ||
307 | + MemoryRegion *mr; | ||
308 | + | ||
309 | + dev = qdev_create(NULL, "pl011"); | ||
310 | + s->lpd.iou.uart[i] = SYS_BUS_DEVICE(dev); | ||
311 | + qdev_prop_set_chr(dev, "chardev", serial_hd(i)); | ||
312 | + object_property_add_child(OBJECT(s), name, OBJECT(dev), &error_fatal); | ||
313 | + qdev_init_nofail(dev); | ||
314 | + | ||
315 | + mr = sysbus_mmio_get_region(s->lpd.iou.uart[i], 0); | ||
316 | + memory_region_add_subregion(&s->mr_ps, addrs[i], mr); | ||
317 | + | ||
318 | + sysbus_connect_irq(s->lpd.iou.uart[i], 0, pic[irqs[i]]); | ||
319 | + g_free(name); | ||
320 | + } | ||
321 | +} | ||
322 | + | ||
323 | +static void versal_create_gems(Versal *s, qemu_irq *pic) | ||
324 | +{ | ||
325 | + int i; | ||
326 | + | ||
327 | + for (i = 0; i < ARRAY_SIZE(s->lpd.iou.gem); i++) { | ||
328 | + static const int irqs[] = { VERSAL_GEM0_IRQ_0, VERSAL_GEM1_IRQ_0}; | ||
329 | + static const uint64_t addrs[] = { MM_GEM0, MM_GEM1 }; | ||
330 | + char *name = g_strdup_printf("gem%d", i); | ||
331 | + NICInfo *nd = &nd_table[i]; | ||
332 | + DeviceState *dev; | ||
333 | + MemoryRegion *mr; | ||
334 | + | ||
335 | + dev = qdev_create(NULL, "cadence_gem"); | ||
336 | + s->lpd.iou.gem[i] = SYS_BUS_DEVICE(dev); | ||
337 | + object_property_add_child(OBJECT(s), name, OBJECT(dev), &error_fatal); | ||
338 | + if (nd->used) { | ||
339 | + qemu_check_nic_model(nd, "cadence_gem"); | ||
340 | + qdev_set_nic_properties(dev, nd); | ||
341 | + } | ||
342 | + object_property_set_int(OBJECT(s->lpd.iou.gem[i]), | ||
343 | + 2, "num-priority-queues", | ||
344 | + &error_abort); | ||
345 | + object_property_set_link(OBJECT(s->lpd.iou.gem[i]), | ||
346 | + OBJECT(&s->mr_ps), "dma", | ||
347 | + &error_abort); | ||
348 | + qdev_init_nofail(dev); | ||
349 | + | ||
350 | + mr = sysbus_mmio_get_region(s->lpd.iou.gem[i], 0); | ||
351 | + memory_region_add_subregion(&s->mr_ps, addrs[i], mr); | ||
352 | + | ||
353 | + sysbus_connect_irq(s->lpd.iou.gem[i], 0, pic[irqs[i]]); | ||
354 | + g_free(name); | ||
355 | + } | ||
356 | +} | ||
357 | + | ||
358 | +/* This takes the board allocated linear DDR memory and creates aliases | ||
359 | + * for each split DDR range/aperture on the Versal address map. | ||
360 | + */ | ||
361 | +static void versal_map_ddr(Versal *s) | ||
362 | +{ | ||
363 | + uint64_t size = memory_region_size(s->cfg.mr_ddr); | ||
364 | + /* Describes the various split DDR access regions. */ | ||
365 | + static const struct { | ||
366 | + uint64_t base; | ||
367 | + uint64_t size; | ||
368 | + } addr_ranges[] = { | ||
369 | + { MM_TOP_DDR, MM_TOP_DDR_SIZE }, | ||
370 | + { MM_TOP_DDR_2, MM_TOP_DDR_2_SIZE }, | ||
371 | + { MM_TOP_DDR_3, MM_TOP_DDR_3_SIZE }, | ||
372 | + { MM_TOP_DDR_4, MM_TOP_DDR_4_SIZE } | ||
373 | + }; | ||
374 | + uint64_t offset = 0; | ||
375 | + int i; | ||
376 | + | ||
377 | + assert(ARRAY_SIZE(addr_ranges) == ARRAY_SIZE(s->noc.mr_ddr_ranges)); | ||
378 | + for (i = 0; i < ARRAY_SIZE(addr_ranges) && size; i++) { | ||
379 | + char *name; | ||
380 | + uint64_t mapsize; | ||
381 | + | ||
382 | + mapsize = size < addr_ranges[i].size ? size : addr_ranges[i].size; | ||
383 | + name = g_strdup_printf("noc-ddr-range%d", i); | ||
384 | + /* Create the MR alias. */ | ||
385 | + memory_region_init_alias(&s->noc.mr_ddr_ranges[i], OBJECT(s), | ||
386 | + name, s->cfg.mr_ddr, | ||
387 | + offset, mapsize); | ||
388 | + | ||
389 | + /* Map it onto the NoC MR. */ | ||
390 | + memory_region_add_subregion(&s->mr_ps, addr_ranges[i].base, | ||
391 | + &s->noc.mr_ddr_ranges[i]); | ||
392 | + offset += mapsize; | ||
393 | + size -= mapsize; | ||
394 | + g_free(name); | ||
395 | + } | ||
396 | +} | ||
397 | + | ||
398 | +static void versal_unimp_area(Versal *s, const char *name, | ||
399 | + MemoryRegion *mr, | ||
400 | + hwaddr base, hwaddr size) | ||
401 | +{ | ||
402 | + DeviceState *dev = qdev_create(NULL, TYPE_UNIMPLEMENTED_DEVICE); | ||
403 | + MemoryRegion *mr_dev; | ||
404 | + | ||
405 | + qdev_prop_set_string(dev, "name", name); | ||
406 | + qdev_prop_set_uint64(dev, "size", size); | ||
407 | + object_property_add_child(OBJECT(s), name, OBJECT(dev), &error_fatal); | ||
408 | + qdev_init_nofail(dev); | ||
409 | + | ||
410 | + mr_dev = sysbus_mmio_get_region(SYS_BUS_DEVICE(dev), 0); | ||
411 | + memory_region_add_subregion(mr, base, mr_dev); | ||
412 | +} | ||
413 | + | ||
414 | +static void versal_unimp(Versal *s) | ||
415 | +{ | ||
416 | + versal_unimp_area(s, "psm", &s->mr_ps, | ||
417 | + MM_PSM_START, MM_PSM_END - MM_PSM_START); | ||
418 | + versal_unimp_area(s, "crl", &s->mr_ps, | ||
419 | + MM_CRL, MM_CRL_SIZE); | ||
420 | + versal_unimp_area(s, "crf", &s->mr_ps, | ||
421 | + MM_FPD_CRF, MM_FPD_CRF_SIZE); | ||
422 | + versal_unimp_area(s, "iou-scntr", &s->mr_ps, | ||
423 | + MM_IOU_SCNTR, MM_IOU_SCNTR_SIZE); | ||
424 | + versal_unimp_area(s, "iou-scntr-seucre", &s->mr_ps, | ||
425 | + MM_IOU_SCNTRS, MM_IOU_SCNTRS_SIZE); | ||
426 | +} | ||
427 | + | ||
428 | +static void versal_realize(DeviceState *dev, Error **errp) | ||
429 | +{ | ||
430 | + Versal *s = XLNX_VERSAL(dev); | ||
431 | + qemu_irq pic[XLNX_VERSAL_NR_IRQS]; | ||
432 | + | ||
433 | + versal_create_apu_cpus(s); | ||
434 | + versal_create_apu_gic(s, pic); | ||
435 | + versal_create_uarts(s, pic); | ||
436 | + versal_create_gems(s, pic); | ||
437 | + versal_map_ddr(s); | ||
438 | + versal_unimp(s); | ||
439 | + | ||
440 | + /* Create the On Chip Memory (OCM). */ | ||
441 | + memory_region_init_ram(&s->lpd.mr_ocm, OBJECT(s), "ocm", | ||
442 | + MM_OCM_SIZE, &error_fatal); | ||
443 | + | ||
444 | + memory_region_add_subregion_overlap(&s->mr_ps, MM_OCM, &s->lpd.mr_ocm, 0); | ||
445 | + memory_region_add_subregion_overlap(&s->fpd.apu.mr, 0, &s->mr_ps, 0); | ||
446 | +} | ||
447 | + | ||
448 | +static void versal_init(Object *obj) | ||
449 | +{ | ||
450 | + Versal *s = XLNX_VERSAL(obj); | ||
451 | + | ||
452 | + memory_region_init(&s->fpd.apu.mr, obj, "mr-apu", UINT64_MAX); | ||
453 | + memory_region_init(&s->mr_ps, obj, "mr-ps-switch", UINT64_MAX); | ||
454 | +} | ||
455 | + | ||
456 | +static Property versal_properties[] = { | ||
457 | + DEFINE_PROP_LINK("ddr", Versal, cfg.mr_ddr, TYPE_MEMORY_REGION, | ||
458 | + MemoryRegion *), | ||
459 | + DEFINE_PROP_UINT32("psci-conduit", Versal, cfg.psci_conduit, 0), | ||
460 | + DEFINE_PROP_END_OF_LIST() | ||
461 | +}; | ||
462 | + | ||
463 | +static void versal_class_init(ObjectClass *klass, void *data) | ||
464 | +{ | 69 | +{ |
465 | + DeviceClass *dc = DEVICE_CLASS(klass); | 70 | + DeviceClass *dc = DEVICE_CLASS(klass); |
466 | + | 71 | + |
467 | + dc->realize = versal_realize; | 72 | + dc->realize = exynos4210_realize; |
468 | + dc->props = versal_properties; | ||
469 | + /* No VMSD since we haven't got any top-level SoC state to save. */ | ||
470 | +} | 73 | +} |
471 | + | 74 | + |
472 | +static const TypeInfo versal_info = { | 75 | +static const TypeInfo exynos4210_info = { |
473 | + .name = TYPE_XLNX_VERSAL, | 76 | + .name = TYPE_EXYNOS4210_SOC, |
474 | + .parent = TYPE_SYS_BUS_DEVICE, | 77 | + .parent = TYPE_SYS_BUS_DEVICE, |
475 | + .instance_size = sizeof(Versal), | 78 | + .instance_size = sizeof(Exynos4210State), |
476 | + .instance_init = versal_init, | 79 | + .class_init = exynos4210_class_init, |
477 | + .class_init = versal_class_init, | ||
478 | +}; | 80 | +}; |
479 | + | 81 | + |
480 | +static void versal_register_types(void) | 82 | +static void exynos4210_register_types(void) |
481 | +{ | 83 | +{ |
482 | + type_register_static(&versal_info); | 84 | + type_register_static(&exynos4210_info); |
483 | +} | 85 | +} |
484 | + | 86 | + |
485 | +type_init(versal_register_types); | 87 | +type_init(exynos4210_register_types) |
486 | diff --git a/default-configs/aarch64-softmmu.mak b/default-configs/aarch64-softmmu.mak | 88 | diff --git a/hw/arm/exynos4_boards.c b/hw/arm/exynos4_boards.c |
487 | index XXXXXXX..XXXXXXX 100644 | 89 | index XXXXXXX..XXXXXXX 100644 |
488 | --- a/default-configs/aarch64-softmmu.mak | 90 | --- a/hw/arm/exynos4_boards.c |
489 | +++ b/default-configs/aarch64-softmmu.mak | 91 | +++ b/hw/arm/exynos4_boards.c |
490 | @@ -XXX,XX +XXX,XX @@ CONFIG_DDC=y | 92 | @@ -XXX,XX +XXX,XX @@ typedef enum Exynos4BoardType { |
491 | CONFIG_DPCD=y | 93 | } Exynos4BoardType; |
492 | CONFIG_XLNX_ZYNQMP=y | 94 | |
493 | CONFIG_XLNX_ZYNQMP_ARM=y | 95 | typedef struct Exynos4BoardState { |
494 | +CONFIG_XLNX_VERSAL=y | 96 | - Exynos4210State *soc; |
495 | CONFIG_ARM_SMMUV3=y | 97 | + Exynos4210State soc; |
98 | MemoryRegion dram0_mem; | ||
99 | MemoryRegion dram1_mem; | ||
100 | } Exynos4BoardState; | ||
101 | @@ -XXX,XX +XXX,XX @@ exynos4_boards_init_common(MachineState *machine, | ||
102 | exynos4_boards_init_ram(s, get_system_memory(), | ||
103 | exynos4_board_ram_size[board_type]); | ||
104 | |||
105 | - s->soc = exynos4210_init(get_system_memory()); | ||
106 | + object_initialize(&s->soc, sizeof(s->soc), TYPE_EXYNOS4210_SOC); | ||
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 | |||
496 | -- | 122 | -- |
497 | 2.19.1 | 123 | 2.20.1 |
498 | 124 | ||
499 | 125 | diff view generated by jsdifflib |