1
target-arm queue: nothing big, just a collection of minor things.
1
First arm pullreq for 7.1. The bulk of this is the qemu_split_irq
2
removal.
2
3
4
I have enough stuff in my to-review queue that I expect to do another
5
pullreq early next week, but 31 patches is enough to not hang on to.
6
7
thanks
3
-- PMM
8
-- PMM
4
9
5
The following changes since commit ae3aa5da96f4ccf0c2a28851449d92db9fcfad71:
10
The following changes since commit 9c125d17e9402c232c46610802e5931b3639d77b:
6
11
7
Merge remote-tracking branch 'remotes/berrange/tags/socket-next-pull-request' into staging (2020-05-21 16:47:28 +0100)
12
Merge tag 'pull-tcg-20220420' of https://gitlab.com/rth7680/qemu into staging (2022-04-20 16:43:11 -0700)
8
13
9
are available in the Git repository at:
14
are available in the Git repository at:
10
15
11
https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20200521
16
https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20220421
12
17
13
for you to fetch changes up to 17b5df7b65d0192c5d775b5e1581518580774c77:
18
for you to fetch changes up to 5b415dd61bdbf61fb4be0e9f1a7172b8bce682c6:
14
19
15
linux-user/arm/signal.c: Drop TARGET_CONFIG_CPU_32 (2020-05-21 20:00:19 +0100)
20
hw/arm: Use bit fields for NPCM7XX PWRON STRAPs (2022-04-21 11:37:05 +0100)
16
21
17
----------------------------------------------------------------
22
----------------------------------------------------------------
18
target-arm queue:
23
target-arm queue:
19
* tests/acceptance: Add a test for the canon-a1100 machine
24
* hw/arm/virt: Check for attempt to use TrustZone with KVM or HVF
20
* docs/system: Document some of the Arm development boards
25
* versal: Add the Cortex-R5s in the Real-Time Processing Unit (RPU) subsystem
21
* linux-user: make BKPT insn cause SIGTRAP, not be a syscall
26
* versal: model enough of the Clock/Reset Low-power domain (CRL) to allow control of the Cortex-R5s
22
* target/arm: Remove unused GEN_NEON_INTEGER_OP macro
27
* xlnx-zynqmp: Connect 4 TTC timers
23
* fsl-imx25, fsl-imx31, fsl-imx6, fsl-imx6ul, fsl-imx7: implement watchdog
28
* exynos4210: Refactor GIC/combiner code to stop using qemu_split_irq
24
* hw/arm: Use qemu_log_mask() instead of hw_error() in various places
29
* realview: replace 'qemu_split_irq' with 'TYPE_SPLIT_IRQ'
25
* ARM: PL061: Introduce N_GPIOS
30
* stellaris: replace 'qemu_split_irq' with 'TYPE_SPLIT_IRQ'
26
* target/arm: Improve clear_vec_high() usage
31
* hw/core/irq: remove unused 'qemu_irq_split' function
27
* target/arm: Allow user-mode code to write CPSR.E via MSR
32
* npcm7xx: use symbolic constants for PWRON STRAP bit fields
28
* linux-user/arm: Reset CPSR_E when entering a signal handler
33
* virt: document impact of gic-version on max CPUs
29
* linux-user/arm/signal.c: Drop TARGET_CONFIG_CPU_32
30
34
31
----------------------------------------------------------------
35
----------------------------------------------------------------
32
Amanieu d'Antras (1):
36
Edgar E. Iglesias (6):
33
linux-user/arm: Reset CPSR_E when entering a signal handler
37
timer: cadence_ttc: Break out header file to allow embedding
38
hw/arm/xlnx-zynqmp: Connect 4 TTC timers
39
hw/arm: versal: Create an APU CPU Cluster
40
hw/arm: versal: Add the Cortex-R5Fs
41
hw/misc: Add a model of the Xilinx Versal CRL
42
hw/arm: versal: Connect the CRL
34
43
35
Geert Uytterhoeven (1):
44
Hao Wu (2):
36
ARM: PL061: Introduce N_GPIOS
45
hw/misc: Add PWRON STRAP bit fields in GCR module
46
hw/arm: Use bit fields for NPCM7XX PWRON STRAPs
37
47
38
Guenter Roeck (8):
48
Heinrich Schuchardt (1):
39
hw: Move i.MX watchdog driver to hw/watchdog
49
hw/arm/virt: impact of gic-version on max CPUs
40
hw/watchdog: Implement full i.MX watchdog support
41
hw/arm/fsl-imx25: Wire up watchdog
42
hw/arm/fsl-imx31: Wire up watchdog
43
hw/arm/fsl-imx6: Connect watchdog interrupts
44
hw/arm/fsl-imx6ul: Connect watchdog interrupts
45
hw/arm/fsl-imx7: Instantiate various unimplemented devices
46
hw/arm/fsl-imx7: Connect watchdog interrupts
47
50
48
Peter Maydell (12):
51
Peter Maydell (19):
49
docs/system: Add 'Arm' to the Integrator/CP document title
52
hw/arm/virt: Check for attempt to use TrustZone with KVM or HVF
50
docs/system: Sort Arm board index into alphabetical order
53
hw/arm/exynos4210: Use TYPE_OR_IRQ instead of custom OR-gate device
51
docs/system: Document Arm Versatile Express boards
54
hw/intc/exynos4210_gic: Remove unused TYPE_EXYNOS4210_IRQ_GATE
52
docs/system: Document the various MPS2 models
55
hw/arm/exynos4210: Put a9mpcore device into state struct
53
docs/system: Document Musca boards
56
hw/arm/exynos4210: Drop int_gic_irq[] from Exynos4210Irq struct
54
linux-user/arm: BKPT should cause SIGTRAP, not be a syscall
57
hw/arm/exynos4210: Coalesce board_irqs and irq_table
55
linux-user/arm: Remove bogus SVC 0xf0002 handling
58
hw/arm/exynos4210: Fix code style nit in combiner_grp_to_gic_id[]
56
linux-user/arm: Handle invalid arm-specific syscalls correctly
59
hw/arm/exynos4210: Move exynos4210_init_board_irqs() into exynos4210.c
57
linux-user/arm: Fix identification of syscall numbers
60
hw/arm/exynos4210: Put external GIC into state struct
58
target/arm: Remove unused GEN_NEON_INTEGER_OP macro
61
hw/arm/exynos4210: Drop ext_gic_irq[] from Exynos4210Irq struct
59
target/arm: Allow user-mode code to write CPSR.E via MSR
62
hw/arm/exynos4210: Move exynos4210_combiner_get_gpioin() into exynos4210.c
60
linux-user/arm/signal.c: Drop TARGET_CONFIG_CPU_32
63
hw/arm/exynos4210: Delete unused macro definitions
64
hw/arm/exynos4210: Use TYPE_SPLIT_IRQ in exynos4210_init_board_irqs()
65
hw/arm/exynos4210: Fill in irq_table[] for internal-combiner-only IRQ lines
66
hw/arm/exynos4210: Connect MCT_G0 and MCT_G1 to both combiners
67
hw/arm/exynos4210: Don't connect multiple lines to external GIC inputs
68
hw/arm/exynos4210: Fold combiner splits into exynos4210_init_board_irqs()
69
hw/arm/exynos4210: Put combiners into state struct
70
hw/arm/exynos4210: Drop Exynos4210Irq struct
61
71
62
Philippe Mathieu-Daudé (4):
72
Zongyuan Li (3):
63
hw/arm/integratorcp: Replace hw_error() by qemu_log_mask()
73
hw/arm/realview: replace 'qemu_split_irq' with 'TYPE_SPLIT_IRQ'
64
hw/arm/pxa2xx: Replace hw_error() by qemu_log_mask()
74
hw/arm/stellaris: replace 'qemu_split_irq' with 'TYPE_SPLIT_IRQ'
65
hw/char/xilinx_uartlite: Replace hw_error() by qemu_log_mask()
75
hw/core/irq: remove unused 'qemu_irq_split' function
66
hw/timer/exynos4210_mct: Replace hw_error() by qemu_log_mask()
67
76
68
Richard Henderson (2):
77
docs/system/arm/virt.rst | 4 +-
69
target/arm: Use tcg_gen_gvec_mov for clear_vec_high
78
include/hw/arm/exynos4210.h | 50 ++--
70
target/arm: Use clear_vec_high more effectively
79
include/hw/arm/xlnx-versal.h | 16 ++
71
80
include/hw/arm/xlnx-zynqmp.h | 4 +
72
Thomas Huth (1):
81
include/hw/intc/exynos4210_combiner.h | 57 +++++
73
tests/acceptance: Add a test for the canon-a1100 machine
82
include/hw/intc/exynos4210_gic.h | 43 ++++
74
83
include/hw/irq.h | 5 -
75
docs/system/arm/integratorcp.rst | 4 +-
84
include/hw/misc/npcm7xx_gcr.h | 30 +++
76
docs/system/arm/mps2.rst | 29 +++
85
include/hw/misc/xlnx-versal-crl.h | 235 +++++++++++++++++++
77
docs/system/arm/musca.rst | 31 +++
86
include/hw/timer/cadence_ttc.h | 54 +++++
78
docs/system/arm/vexpress.rst | 60 ++++++
87
hw/arm/exynos4210.c | 430 ++++++++++++++++++++++++++++++----
79
docs/system/target-arm.rst | 20 +-
88
hw/arm/npcm7xx_boards.c | 24 +-
80
include/hw/arm/fsl-imx25.h | 5 +
89
hw/arm/realview.c | 33 ++-
81
include/hw/arm/fsl-imx31.h | 4 +
90
hw/arm/stellaris.c | 15 +-
82
include/hw/arm/fsl-imx6.h | 2 +-
91
hw/arm/virt.c | 7 +
83
include/hw/arm/fsl-imx6ul.h | 2 +-
92
hw/arm/xlnx-versal-virt.c | 6 +-
84
include/hw/arm/fsl-imx7.h | 23 ++-
93
hw/arm/xlnx-versal.c | 99 +++++++-
85
include/hw/misc/imx2_wdt.h | 33 ----
94
hw/arm/xlnx-zynqmp.c | 22 ++
86
include/hw/watchdog/wdt_imx2.h | 90 +++++++++
95
hw/core/irq.c | 15 --
87
target/arm/cpu.h | 2 +-
96
hw/intc/exynos4210_combiner.c | 108 +--------
88
hw/arm/fsl-imx25.c | 10 +
97
hw/intc/exynos4210_gic.c | 344 +--------------------------
89
hw/arm/fsl-imx31.c | 6 +
98
hw/misc/xlnx-versal-crl.c | 421 +++++++++++++++++++++++++++++++++
90
hw/arm/fsl-imx6.c | 9 +
99
hw/timer/cadence_ttc.c | 32 +--
91
hw/arm/fsl-imx6ul.c | 10 +
100
MAINTAINERS | 2 +-
92
hw/arm/fsl-imx7.c | 35 ++++
101
hw/misc/meson.build | 1 +
93
hw/arm/integratorcp.c | 23 ++-
102
25 files changed, 1457 insertions(+), 600 deletions(-)
94
hw/arm/pxa2xx_gpio.c | 7 +-
103
create mode 100644 include/hw/intc/exynos4210_combiner.h
95
hw/char/xilinx_uartlite.c | 5 +-
104
create mode 100644 include/hw/intc/exynos4210_gic.h
96
hw/display/pxa2xx_lcd.c | 8 +-
105
create mode 100644 include/hw/misc/xlnx-versal-crl.h
97
hw/dma/pxa2xx_dma.c | 14 +-
106
create mode 100644 include/hw/timer/cadence_ttc.h
98
hw/gpio/pl061.c | 12 +-
107
create mode 100644 hw/misc/xlnx-versal-crl.c
99
hw/misc/imx2_wdt.c | 90 ---------
100
hw/timer/exynos4210_mct.c | 12 +-
101
hw/watchdog/wdt_imx2.c | 303 +++++++++++++++++++++++++++++
102
linux-user/arm/cpu_loop.c | 145 ++++++++------
103
linux-user/arm/signal.c | 15 +-
104
target/arm/translate-a64.c | 63 +++---
105
target/arm/translate.c | 23 ---
106
MAINTAINERS | 6 +
107
hw/arm/Kconfig | 5 +
108
hw/misc/Makefile.objs | 1 -
109
hw/watchdog/Kconfig | 3 +
110
hw/watchdog/Makefile.objs | 1 +
111
tests/acceptance/machine_arm_canona1100.py | 35 ++++
112
37 files changed, 854 insertions(+), 292 deletions(-)
113
create mode 100644 docs/system/arm/mps2.rst
114
create mode 100644 docs/system/arm/musca.rst
115
create mode 100644 docs/system/arm/vexpress.rst
116
delete mode 100644 include/hw/misc/imx2_wdt.h
117
create mode 100644 include/hw/watchdog/wdt_imx2.h
118
delete mode 100644 hw/misc/imx2_wdt.c
119
create mode 100644 hw/watchdog/wdt_imx2.c
120
create mode 100644 tests/acceptance/machine_arm_canona1100.py
121
diff view generated by jsdifflib
New patch
1
It's not possible to provide the guest with the Security extensions
2
(TrustZone) when using KVM or HVF, because the hardware
3
virtualization extensions don't permit running EL3 guest code.
4
However, we weren't checking for this combination, with the result
5
that QEMU would assert if you tried it:
1
6
7
$ qemu-system-aarch64 -enable-kvm -machine virt,secure=on -cpu host -display none
8
Unexpected error in object_property_find_err() at ../../qom/object.c:1304:
9
qemu-system-aarch64: Property 'host-arm-cpu.secure-memory' not found
10
Aborted
11
12
Check for this combination of options and report an error, in the
13
same way we already do for attempts to give a KVM or HVF guest the
14
Virtualization or MTE extensions. Now we will report:
15
16
qemu-system-aarch64: mach-virt: KVM does not support providing Security extensions (TrustZone) to the guest CPU
17
18
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/961
19
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
20
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
21
Message-id: 20220404155301.566542-1-peter.maydell@linaro.org
22
---
23
hw/arm/virt.c | 7 +++++++
24
1 file changed, 7 insertions(+)
25
26
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
27
index XXXXXXX..XXXXXXX 100644
28
--- a/hw/arm/virt.c
29
+++ b/hw/arm/virt.c
30
@@ -XXX,XX +XXX,XX @@ static void machvirt_init(MachineState *machine)
31
exit(1);
32
}
33
34
+ if (vms->secure && (kvm_enabled() || hvf_enabled())) {
35
+ error_report("mach-virt: %s does not support providing "
36
+ "Security extensions (TrustZone) to the guest CPU",
37
+ kvm_enabled() ? "KVM" : "HVF");
38
+ exit(1);
39
+ }
40
+
41
if (vms->virt && (kvm_enabled() || hvf_enabled())) {
42
error_report("mach-virt: %s does not support providing "
43
"Virtualization extensions to the guest CPU",
44
--
45
2.25.1
diff view generated by jsdifflib
1
Add basic documentation of the MPS2 board models.
1
From: "Edgar E. Iglesias" <edgar.iglesias@amd.com>
2
2
3
Break out header file to allow embedding of the the TTC.
4
5
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@amd.com>
6
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
7
Reviewed-by: Luc Michel <luc@lmichel.fr>
8
Reviewed-by: Francisco Iglesias <frasse.iglesias@gmail.com>
9
Message-id: 20220331222017.2914409-2-edgar.iglesias@gmail.com
3
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
5
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
6
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
7
Message-id: 20200507151819.28444-5-peter.maydell@linaro.org
8
---
11
---
9
docs/system/arm/mps2.rst | 29 +++++++++++++++++++++++++++++
12
include/hw/timer/cadence_ttc.h | 54 ++++++++++++++++++++++++++++++++++
10
docs/system/target-arm.rst | 1 +
13
hw/timer/cadence_ttc.c | 32 ++------------------
11
MAINTAINERS | 1 +
14
2 files changed, 56 insertions(+), 30 deletions(-)
12
3 files changed, 31 insertions(+)
15
create mode 100644 include/hw/timer/cadence_ttc.h
13
create mode 100644 docs/system/arm/mps2.rst
14
16
15
diff --git a/docs/system/arm/mps2.rst b/docs/system/arm/mps2.rst
17
diff --git a/include/hw/timer/cadence_ttc.h b/include/hw/timer/cadence_ttc.h
16
new file mode 100644
18
new file mode 100644
17
index XXXXXXX..XXXXXXX
19
index XXXXXXX..XXXXXXX
18
--- /dev/null
20
--- /dev/null
19
+++ b/docs/system/arm/mps2.rst
21
+++ b/include/hw/timer/cadence_ttc.h
20
@@ -XXX,XX +XXX,XX @@
22
@@ -XXX,XX +XXX,XX @@
21
+Arm MPS2 boards (``mps2-an385``, ``mps2-an505``, ``mps2-an511``, ``mps2-an521``)
23
+/*
22
+================================================================================
24
+ * Xilinx Zynq cadence TTC model
25
+ *
26
+ * Copyright (c) 2011 Xilinx Inc.
27
+ * Copyright (c) 2012 Peter A.G. Crosthwaite (peter.crosthwaite@petalogix.com)
28
+ * Copyright (c) 2012 PetaLogix Pty Ltd.
29
+ * Written By Haibing Ma
30
+ * M. Habib
31
+ *
32
+ * This program is free software; you can redistribute it and/or
33
+ * modify it under the terms of the GNU General Public License
34
+ * as published by the Free Software Foundation; either version
35
+ * 2 of the License, or (at your option) any later version.
36
+ *
37
+ * You should have received a copy of the GNU General Public License along
38
+ * with this program; if not, see <http://www.gnu.org/licenses/>.
39
+ */
40
+#ifndef HW_TIMER_CADENCE_TTC_H
41
+#define HW_TIMER_CADENCE_TTC_H
23
+
42
+
24
+These board models all use Arm M-profile CPUs.
43
+#include "hw/sysbus.h"
44
+#include "qemu/timer.h"
25
+
45
+
26
+The Arm MPS2 and MPS2+ dev boards are FPGA based (the 2+ has a bigger
46
+typedef struct {
27
+FPGA but is otherwise the same as the 2). Since the CPU itself
47
+ QEMUTimer *timer;
28
+and most of the devices are in the FPGA, the details of the board
48
+ int freq;
29
+as seen by the guest depend significantly on the FPGA image.
30
+
49
+
31
+QEMU models the following FPGA images:
50
+ uint32_t reg_clock;
51
+ uint32_t reg_count;
52
+ uint32_t reg_value;
53
+ uint16_t reg_interval;
54
+ uint16_t reg_match[3];
55
+ uint32_t reg_intr;
56
+ uint32_t reg_intr_en;
57
+ uint32_t reg_event_ctrl;
58
+ uint32_t reg_event;
32
+
59
+
33
+``mps2-an385``
60
+ uint64_t cpu_time;
34
+ Cortex-M3 as documented in ARM Application Note AN385
61
+ unsigned int cpu_time_valid;
35
+``mps2-an511``
36
+ Cortex-M3 'DesignStart' as documented in AN511
37
+``mps2-an505``
38
+ Cortex-M33 as documented in ARM Application Note AN505
39
+``mps2-an521``
40
+ Dual Cortex-M33 as documented in Application Note AN521
41
+
62
+
42
+Differences between QEMU and real hardware:
63
+ qemu_irq irq;
64
+} CadenceTimerState;
43
+
65
+
44
+- AN385 remapping of low 16K of memory to either ZBT SSRAM1 or to
66
+#define TYPE_CADENCE_TTC "cadence_ttc"
45
+ block RAM is unimplemented (QEMU always maps this to ZBT SSRAM1, as
67
+OBJECT_DECLARE_SIMPLE_TYPE(CadenceTTCState, CADENCE_TTC)
46
+ if zbt_boot_ctrl is always zero)
68
+
47
+- QEMU provides a LAN9118 ethernet rather than LAN9220; the only guest
69
+struct CadenceTTCState {
48
+ visible difference is that the LAN9118 doesn't support checksum
70
+ SysBusDevice parent_obj;
49
+ offloading
71
+
50
diff --git a/docs/system/target-arm.rst b/docs/system/target-arm.rst
72
+ MemoryRegion iomem;
73
+ CadenceTimerState timer[3];
74
+};
75
+
76
+#endif
77
diff --git a/hw/timer/cadence_ttc.c b/hw/timer/cadence_ttc.c
51
index XXXXXXX..XXXXXXX 100644
78
index XXXXXXX..XXXXXXX 100644
52
--- a/docs/system/target-arm.rst
79
--- a/hw/timer/cadence_ttc.c
53
+++ b/docs/system/target-arm.rst
80
+++ b/hw/timer/cadence_ttc.c
54
@@ -XXX,XX +XXX,XX @@ undocumented; you can get a complete list by running
81
@@ -XXX,XX +XXX,XX @@
55
:maxdepth: 1
82
#include "qemu/timer.h"
56
83
#include "qom/object.h"
57
arm/integratorcp
84
58
+ arm/mps2
85
+#include "hw/timer/cadence_ttc.h"
59
arm/realview
86
+
60
arm/versatile
87
#ifdef CADENCE_TTC_ERR_DEBUG
61
arm/vexpress
88
#define DB_PRINT(...) do { \
62
diff --git a/MAINTAINERS b/MAINTAINERS
89
fprintf(stderr, ": %s: ", __func__); \
63
index XXXXXXX..XXXXXXX 100644
90
@@ -XXX,XX +XXX,XX @@
64
--- a/MAINTAINERS
91
#define CLOCK_CTRL_PS_EN 0x00000001
65
+++ b/MAINTAINERS
92
#define CLOCK_CTRL_PS_V 0x0000001e
66
@@ -XXX,XX +XXX,XX @@ F: hw/misc/armsse-cpuid.c
93
67
F: include/hw/misc/armsse-cpuid.h
94
-typedef struct {
68
F: hw/misc/armsse-mhu.c
95
- QEMUTimer *timer;
69
F: include/hw/misc/armsse-mhu.h
96
- int freq;
70
+F: docs/system/arm/mps2.rst
97
-
71
98
- uint32_t reg_clock;
72
Musca
99
- uint32_t reg_count;
73
M: Peter Maydell <peter.maydell@linaro.org>
100
- uint32_t reg_value;
101
- uint16_t reg_interval;
102
- uint16_t reg_match[3];
103
- uint32_t reg_intr;
104
- uint32_t reg_intr_en;
105
- uint32_t reg_event_ctrl;
106
- uint32_t reg_event;
107
-
108
- uint64_t cpu_time;
109
- unsigned int cpu_time_valid;
110
-
111
- qemu_irq irq;
112
-} CadenceTimerState;
113
-
114
-#define TYPE_CADENCE_TTC "cadence_ttc"
115
-OBJECT_DECLARE_SIMPLE_TYPE(CadenceTTCState, CADENCE_TTC)
116
-
117
-struct CadenceTTCState {
118
- SysBusDevice parent_obj;
119
-
120
- MemoryRegion iomem;
121
- CadenceTimerState timer[3];
122
-};
123
-
124
static void cadence_timer_update(CadenceTimerState *s)
125
{
126
qemu_set_irq(s->irq, !!(s->reg_intr & s->reg_intr_en));
74
--
127
--
75
2.20.1
128
2.25.1
76
77
diff view generated by jsdifflib
1
From: Amanieu d'Antras <amanieu@gmail.com>
1
From: "Edgar E. Iglesias" <edgar.iglesias@amd.com>
2
2
3
This fixes signal handlers running with the wrong endianness if the
3
Connect the 4 TTC timers on the ZynqMP.
4
interrupted code used SETEND to dynamically switch endianness.
5
4
6
Signed-off-by: Amanieu d'Antras <amanieu@gmail.com>
5
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@amd.com>
7
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
6
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
8
Message-id: 20200511131117.2486486-1-amanieu@gmail.com
7
Reviewed-by: Luc Michel <luc@lmichel.fr>
8
Reviewed-by: Francisco Iglesias <frasse.iglesias@gmail.com>
9
Message-id: 20220331222017.2914409-3-edgar.iglesias@gmail.com
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
---
11
---
11
linux-user/arm/signal.c | 8 +++++++-
12
include/hw/arm/xlnx-zynqmp.h | 4 ++++
12
1 file changed, 7 insertions(+), 1 deletion(-)
13
hw/arm/xlnx-zynqmp.c | 22 ++++++++++++++++++++++
14
2 files changed, 26 insertions(+)
13
15
14
diff --git a/linux-user/arm/signal.c b/linux-user/arm/signal.c
16
diff --git a/include/hw/arm/xlnx-zynqmp.h b/include/hw/arm/xlnx-zynqmp.h
15
index XXXXXXX..XXXXXXX 100644
17
index XXXXXXX..XXXXXXX 100644
16
--- a/linux-user/arm/signal.c
18
--- a/include/hw/arm/xlnx-zynqmp.h
17
+++ b/linux-user/arm/signal.c
19
+++ b/include/hw/arm/xlnx-zynqmp.h
18
@@ -XXX,XX +XXX,XX @@ setup_return(CPUARMState *env, struct target_sigaction *ka,
20
@@ -XXX,XX +XXX,XX @@
19
} else {
21
#include "hw/or-irq.h"
20
cpsr &= ~CPSR_T;
22
#include "hw/misc/xlnx-zynqmp-apu-ctrl.h"
21
}
23
#include "hw/misc/xlnx-zynqmp-crf.h"
22
+ if (env->cp15.sctlr_el[1] & SCTLR_E0E) {
24
+#include "hw/timer/cadence_ttc.h"
23
+ cpsr |= CPSR_E;
25
24
+ } else {
26
#define TYPE_XLNX_ZYNQMP "xlnx-zynqmp"
25
+ cpsr &= ~CPSR_E;
27
OBJECT_DECLARE_SIMPLE_TYPE(XlnxZynqMPState, XLNX_ZYNQMP)
28
@@ -XXX,XX +XXX,XX @@ OBJECT_DECLARE_SIMPLE_TYPE(XlnxZynqMPState, XLNX_ZYNQMP)
29
#define XLNX_ZYNQMP_MAX_RAM_SIZE (XLNX_ZYNQMP_MAX_LOW_RAM_SIZE + \
30
XLNX_ZYNQMP_MAX_HIGH_RAM_SIZE)
31
32
+#define XLNX_ZYNQMP_NUM_TTC 4
33
+
34
/*
35
* Unimplemented mmio regions needed to boot some images.
36
*/
37
@@ -XXX,XX +XXX,XX @@ struct XlnxZynqMPState {
38
qemu_or_irq qspi_irq_orgate;
39
XlnxZynqMPAPUCtrl apu_ctrl;
40
XlnxZynqMPCRF crf;
41
+ CadenceTTCState ttc[XLNX_ZYNQMP_NUM_TTC];
42
43
char *boot_cpu;
44
ARMCPU *boot_cpu_ptr;
45
diff --git a/hw/arm/xlnx-zynqmp.c b/hw/arm/xlnx-zynqmp.c
46
index XXXXXXX..XXXXXXX 100644
47
--- a/hw/arm/xlnx-zynqmp.c
48
+++ b/hw/arm/xlnx-zynqmp.c
49
@@ -XXX,XX +XXX,XX @@
50
#define APU_ADDR 0xfd5c0000
51
#define APU_IRQ 153
52
53
+#define TTC0_ADDR 0xFF110000
54
+#define TTC0_IRQ 36
55
+
56
#define IPI_ADDR 0xFF300000
57
#define IPI_IRQ 64
58
59
@@ -XXX,XX +XXX,XX @@ static void xlnx_zynqmp_create_crf(XlnxZynqMPState *s, qemu_irq *gic)
60
sysbus_connect_irq(sbd, 0, gic[CRF_IRQ]);
61
}
62
63
+static void xlnx_zynqmp_create_ttc(XlnxZynqMPState *s, qemu_irq *gic)
64
+{
65
+ SysBusDevice *sbd;
66
+ int i, irq;
67
+
68
+ for (i = 0; i < XLNX_ZYNQMP_NUM_TTC; i++) {
69
+ object_initialize_child(OBJECT(s), "ttc[*]", &s->ttc[i],
70
+ TYPE_CADENCE_TTC);
71
+ sbd = SYS_BUS_DEVICE(&s->ttc[i]);
72
+
73
+ sysbus_realize(sbd, &error_fatal);
74
+ sysbus_mmio_map(sbd, 0, TTC0_ADDR + i * 0x10000);
75
+ for (irq = 0; irq < 3; irq++) {
76
+ sysbus_connect_irq(sbd, irq, gic[TTC0_IRQ + i * 3 + irq]);
77
+ }
26
+ }
78
+ }
27
79
+}
28
if (ka->sa_flags & TARGET_SA_RESTORER) {
80
+
29
if (is_fdpic) {
81
static void xlnx_zynqmp_create_unimp_mmio(XlnxZynqMPState *s)
30
@@ -XXX,XX +XXX,XX @@ setup_return(CPUARMState *env, struct target_sigaction *ka,
82
{
31
env->regs[13] = frame_addr;
83
static const struct UnimpInfo {
32
env->regs[14] = retcode;
84
@@ -XXX,XX +XXX,XX @@ static void xlnx_zynqmp_realize(DeviceState *dev, Error **errp)
33
env->regs[15] = handler & (thumb ? ~1 : ~3);
85
xlnx_zynqmp_create_efuse(s, gic_spi);
34
- cpsr_write(env, cpsr, CPSR_IT | CPSR_T, CPSRWriteByInstr);
86
xlnx_zynqmp_create_apu_ctrl(s, gic_spi);
35
+ cpsr_write(env, cpsr, CPSR_IT | CPSR_T | CPSR_E, CPSRWriteByInstr);
87
xlnx_zynqmp_create_crf(s, gic_spi);
36
+ arm_rebuild_hflags(env);
88
+ xlnx_zynqmp_create_ttc(s, gic_spi);
37
89
xlnx_zynqmp_create_unimp_mmio(s);
38
return 0;
90
39
}
91
for (i = 0; i < XLNX_ZYNQMP_NUM_GDMA_CH; i++) {
40
--
92
--
41
2.20.1
93
2.25.1
42
43
diff view generated by jsdifflib
1
From: Guenter Roeck <linux@roeck-us.net>
1
From: "Edgar E. Iglesias" <edgar.iglesias@amd.com>
2
2
3
With this patch, the watchdog on i.MX31 emulations is fully operational.
3
Create an APU CPU Cluster. This is in preparation to add the RPU.
4
4
5
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
5
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@amd.com>
6
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
6
Reviewed-by: Francisco Iglesias <francisco.iglesias@amd.com>
7
Message-id: 20200517162135.110364-5-linux@roeck-us.net
7
Message-id: 20220406174303.2022038-2-edgar.iglesias@xilinx.com
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
---
9
---
10
include/hw/arm/fsl-imx31.h | 4 ++++
10
include/hw/arm/xlnx-versal.h | 2 ++
11
hw/arm/fsl-imx31.c | 6 ++++++
11
hw/arm/xlnx-versal.c | 9 ++++++++-
12
hw/arm/Kconfig | 1 +
12
2 files changed, 10 insertions(+), 1 deletion(-)
13
3 files changed, 11 insertions(+)
14
13
15
diff --git a/include/hw/arm/fsl-imx31.h b/include/hw/arm/fsl-imx31.h
14
diff --git a/include/hw/arm/xlnx-versal.h b/include/hw/arm/xlnx-versal.h
16
index XXXXXXX..XXXXXXX 100644
15
index XXXXXXX..XXXXXXX 100644
17
--- a/include/hw/arm/fsl-imx31.h
16
--- a/include/hw/arm/xlnx-versal.h
18
+++ b/include/hw/arm/fsl-imx31.h
17
+++ b/include/hw/arm/xlnx-versal.h
19
@@ -XXX,XX +XXX,XX @@
18
@@ -XXX,XX +XXX,XX @@
20
#include "hw/timer/imx_epit.h"
19
21
#include "hw/i2c/imx_i2c.h"
20
#include "hw/sysbus.h"
22
#include "hw/gpio/imx_gpio.h"
21
#include "hw/arm/boot.h"
23
+#include "hw/watchdog/wdt_imx2.h"
22
+#include "hw/cpu/cluster.h"
24
#include "exec/memory.h"
23
#include "hw/or-irq.h"
25
#include "target/arm/cpu.h"
24
#include "hw/sd/sdhci.h"
26
25
#include "hw/intc/arm_gicv3.h"
27
@@ -XXX,XX +XXX,XX @@ typedef struct FslIMX31State {
26
@@ -XXX,XX +XXX,XX @@ struct Versal {
28
IMXEPITState epit[FSL_IMX31_NUM_EPITS];
27
struct {
29
IMXI2CState i2c[FSL_IMX31_NUM_I2CS];
28
struct {
30
IMXGPIOState gpio[FSL_IMX31_NUM_GPIOS];
29
MemoryRegion mr;
31
+ IMX2WdtState wdt;
30
+ CPUClusterState cluster;
32
MemoryRegion secure_rom;
31
ARMCPU cpu[XLNX_VERSAL_NR_ACPUS];
33
MemoryRegion rom;
32
GICv3State gic;
34
MemoryRegion iram;
33
} apu;
35
@@ -XXX,XX +XXX,XX @@ typedef struct FslIMX31State {
34
diff --git a/hw/arm/xlnx-versal.c b/hw/arm/xlnx-versal.c
36
#define FSL_IMX31_GPIO1_SIZE 0x4000
37
#define FSL_IMX31_GPIO2_ADDR 0x53FD0000
38
#define FSL_IMX31_GPIO2_SIZE 0x4000
39
+#define FSL_IMX31_WDT_ADDR 0x53FDC000
40
+#define FSL_IMX31_WDT_SIZE 0x4000
41
#define FSL_IMX31_AVIC_ADDR 0x68000000
42
#define FSL_IMX31_AVIC_SIZE 0x100
43
#define FSL_IMX31_SDRAM0_ADDR 0x80000000
44
diff --git a/hw/arm/fsl-imx31.c b/hw/arm/fsl-imx31.c
45
index XXXXXXX..XXXXXXX 100644
35
index XXXXXXX..XXXXXXX 100644
46
--- a/hw/arm/fsl-imx31.c
36
--- a/hw/arm/xlnx-versal.c
47
+++ b/hw/arm/fsl-imx31.c
37
+++ b/hw/arm/xlnx-versal.c
48
@@ -XXX,XX +XXX,XX @@ static void fsl_imx31_init(Object *obj)
38
@@ -XXX,XX +XXX,XX @@ static void versal_create_apu_cpus(Versal *s)
49
sysbus_init_child_obj(obj, "gpio[*]", &s->gpio[i], sizeof(s->gpio[i]),
39
{
50
TYPE_IMX_GPIO);
40
int i;
41
42
+ object_initialize_child(OBJECT(s), "apu-cluster", &s->fpd.apu.cluster,
43
+ TYPE_CPU_CLUSTER);
44
+ qdev_prop_set_uint32(DEVICE(&s->fpd.apu.cluster), "cluster-id", 0);
45
+
46
for (i = 0; i < ARRAY_SIZE(s->fpd.apu.cpu); i++) {
47
Object *obj;
48
49
- object_initialize_child(OBJECT(s), "apu-cpu[*]", &s->fpd.apu.cpu[i],
50
+ object_initialize_child(OBJECT(&s->fpd.apu.cluster),
51
+ "apu-cpu[*]", &s->fpd.apu.cpu[i],
52
XLNX_VERSAL_ACPU_TYPE);
53
obj = OBJECT(&s->fpd.apu.cpu[i]);
54
if (i) {
55
@@ -XXX,XX +XXX,XX @@ static void versal_create_apu_cpus(Versal *s)
56
&error_abort);
57
qdev_realize(DEVICE(obj), NULL, &error_fatal);
51
}
58
}
52
+
59
+
53
+ sysbus_init_child_obj(obj, "wdt", &s->wdt, sizeof(s->wdt), TYPE_IMX2_WDT);
60
+ qdev_realize(DEVICE(&s->fpd.apu.cluster), NULL, &error_fatal);
54
}
61
}
55
62
56
static void fsl_imx31_realize(DeviceState *dev, Error **errp)
63
static void versal_create_apu_gic(Versal *s, qemu_irq *pic)
57
@@ -XXX,XX +XXX,XX @@ static void fsl_imx31_realize(DeviceState *dev, Error **errp)
58
gpio_table[i].irq));
59
}
60
61
+ /* Watchdog */
62
+ object_property_set_bool(OBJECT(&s->wdt), true, "realized", &error_abort);
63
+ sysbus_mmio_map(SYS_BUS_DEVICE(&s->wdt), 0, FSL_IMX31_WDT_ADDR);
64
+
65
/* On a real system, the first 16k is a `secure boot rom' */
66
memory_region_init_rom(&s->secure_rom, OBJECT(dev), "imx31.secure_rom",
67
FSL_IMX31_SECURE_ROM_SIZE, &err);
68
diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig
69
index XXXXXXX..XXXXXXX 100644
70
--- a/hw/arm/Kconfig
71
+++ b/hw/arm/Kconfig
72
@@ -XXX,XX +XXX,XX @@ config FSL_IMX31
73
select SERIAL
74
select IMX
75
select IMX_I2C
76
+ select WDT_IMX2
77
select LAN9118
78
79
config FSL_IMX6
80
--
64
--
81
2.20.1
65
2.25.1
82
83
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
1
From: "Edgar E. Iglesias" <edgar.iglesias@amd.com>
2
2
3
hw_error() calls exit(). This a bit overkill when we can log
3
Add the Cortex-R5Fs of the Versal RPU (Real-time Processing Unit)
4
the accesses as unimplemented or guest error.
4
subsystem.
5
5
6
When fuzzing the devices, we don't want the whole process to
6
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@amd.com>
7
exit. Replace some hw_error() calls by qemu_log_mask().
7
Reviewed-by: Francisco Iglesias <francisco.iglesias@amd.com>
8
8
Message-id: 20220406174303.2022038-3-edgar.iglesias@xilinx.com
9
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
10
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
11
Message-id: 20200518140309.5220-3-f4bug@amsat.org
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
---
10
---
14
hw/arm/pxa2xx_gpio.c | 7 ++++---
11
include/hw/arm/xlnx-versal.h | 10 ++++++++++
15
hw/display/pxa2xx_lcd.c | 8 +++++---
12
hw/arm/xlnx-versal-virt.c | 6 +++---
16
hw/dma/pxa2xx_dma.c | 14 +++++++++-----
13
hw/arm/xlnx-versal.c | 36 ++++++++++++++++++++++++++++++++++++
17
3 files changed, 18 insertions(+), 11 deletions(-)
14
3 files changed, 49 insertions(+), 3 deletions(-)
18
15
19
diff --git a/hw/arm/pxa2xx_gpio.c b/hw/arm/pxa2xx_gpio.c
16
diff --git a/include/hw/arm/xlnx-versal.h b/include/hw/arm/xlnx-versal.h
20
index XXXXXXX..XXXXXXX 100644
17
index XXXXXXX..XXXXXXX 100644
21
--- a/hw/arm/pxa2xx_gpio.c
18
--- a/include/hw/arm/xlnx-versal.h
22
+++ b/hw/arm/pxa2xx_gpio.c
19
+++ b/include/hw/arm/xlnx-versal.h
23
@@ -XXX,XX +XXX,XX @@
20
@@ -XXX,XX +XXX,XX @@
24
21
OBJECT_DECLARE_SIMPLE_TYPE(Versal, XLNX_VERSAL)
25
#include "qemu/osdep.h"
22
26
#include "cpu.h"
23
#define XLNX_VERSAL_NR_ACPUS 2
27
-#include "hw/hw.h"
24
+#define XLNX_VERSAL_NR_RCPUS 2
28
#include "hw/irq.h"
25
#define XLNX_VERSAL_NR_UARTS 2
29
#include "hw/qdev-properties.h"
26
#define XLNX_VERSAL_NR_GEMS 2
27
#define XLNX_VERSAL_NR_ADMAS 8
28
@@ -XXX,XX +XXX,XX @@ struct Versal {
29
VersalUsb2 usb;
30
} iou;
31
32
+ /* Real-time Processing Unit. */
33
+ struct {
34
+ MemoryRegion mr;
35
+ MemoryRegion mr_ps_alias;
36
+
37
+ CPUClusterState cluster;
38
+ ARMCPU cpu[XLNX_VERSAL_NR_RCPUS];
39
+ } rpu;
40
+
41
struct {
42
qemu_or_irq irq_orgate;
43
XlnxXramCtrl ctrl[XLNX_VERSAL_NR_XRAM];
44
diff --git a/hw/arm/xlnx-versal-virt.c b/hw/arm/xlnx-versal-virt.c
45
index XXXXXXX..XXXXXXX 100644
46
--- a/hw/arm/xlnx-versal-virt.c
47
+++ b/hw/arm/xlnx-versal-virt.c
48
@@ -XXX,XX +XXX,XX @@ static void versal_virt_machine_class_init(ObjectClass *oc, void *data)
49
50
mc->desc = "Xilinx Versal Virtual development board";
51
mc->init = versal_virt_init;
52
- mc->min_cpus = XLNX_VERSAL_NR_ACPUS;
53
- mc->max_cpus = XLNX_VERSAL_NR_ACPUS;
54
- mc->default_cpus = XLNX_VERSAL_NR_ACPUS;
55
+ mc->min_cpus = XLNX_VERSAL_NR_ACPUS + XLNX_VERSAL_NR_RCPUS;
56
+ mc->max_cpus = XLNX_VERSAL_NR_ACPUS + XLNX_VERSAL_NR_RCPUS;
57
+ mc->default_cpus = XLNX_VERSAL_NR_ACPUS + XLNX_VERSAL_NR_RCPUS;
58
mc->no_cdrom = true;
59
mc->default_ram_id = "ddr";
60
}
61
diff --git a/hw/arm/xlnx-versal.c b/hw/arm/xlnx-versal.c
62
index XXXXXXX..XXXXXXX 100644
63
--- a/hw/arm/xlnx-versal.c
64
+++ b/hw/arm/xlnx-versal.c
65
@@ -XXX,XX +XXX,XX @@
30
#include "hw/sysbus.h"
66
#include "hw/sysbus.h"
31
@@ -XXX,XX +XXX,XX @@ static uint64_t pxa2xx_gpio_read(void *opaque, hwaddr offset,
67
32
return s->status[bank];
68
#define XLNX_VERSAL_ACPU_TYPE ARM_CPU_TYPE_NAME("cortex-a72")
33
69
+#define XLNX_VERSAL_RCPU_TYPE ARM_CPU_TYPE_NAME("cortex-r5f")
34
default:
70
#define GEM_REVISION 0x40070106
35
- hw_error("%s: Bad offset " REG_FMT "\n", __func__, offset);
71
36
+ qemu_log_mask(LOG_GUEST_ERROR, "%s: Bad offset 0x%" HWADDR_PRIX "\n",
72
#define VERSAL_NUM_PMC_APB_IRQS 3
37
+ __func__, offset);
73
@@ -XXX,XX +XXX,XX @@ static void versal_create_apu_gic(Versal *s, qemu_irq *pic)
38
}
39
40
return 0;
41
@@ -XXX,XX +XXX,XX @@ static void pxa2xx_gpio_write(void *opaque, hwaddr offset,
42
break;
43
44
default:
45
- hw_error("%s: Bad offset " REG_FMT "\n", __func__, offset);
46
+ qemu_log_mask(LOG_GUEST_ERROR, "%s: Bad offset 0x%" HWADDR_PRIX "\n",
47
+ __func__, offset);
48
}
74
}
49
}
75
}
50
76
51
diff --git a/hw/display/pxa2xx_lcd.c b/hw/display/pxa2xx_lcd.c
77
+static void versal_create_rpu_cpus(Versal *s)
52
index XXXXXXX..XXXXXXX 100644
78
+{
53
--- a/hw/display/pxa2xx_lcd.c
79
+ int i;
54
+++ b/hw/display/pxa2xx_lcd.c
80
+
55
@@ -XXX,XX +XXX,XX @@
81
+ object_initialize_child(OBJECT(s), "rpu-cluster", &s->lpd.rpu.cluster,
56
*/
82
+ TYPE_CPU_CLUSTER);
57
83
+ qdev_prop_set_uint32(DEVICE(&s->lpd.rpu.cluster), "cluster-id", 1);
58
#include "qemu/osdep.h"
84
+
59
-#include "hw/hw.h"
85
+ for (i = 0; i < ARRAY_SIZE(s->lpd.rpu.cpu); i++) {
60
+#include "qemu/log.h"
86
+ Object *obj;
61
#include "hw/irq.h"
87
+
62
#include "migration/vmstate.h"
88
+ object_initialize_child(OBJECT(&s->lpd.rpu.cluster),
63
#include "ui/console.h"
89
+ "rpu-cpu[*]", &s->lpd.rpu.cpu[i],
64
@@ -XXX,XX +XXX,XX @@ static uint64_t pxa2xx_lcdc_read(void *opaque, hwaddr offset,
90
+ XLNX_VERSAL_RCPU_TYPE);
65
91
+ obj = OBJECT(&s->lpd.rpu.cpu[i]);
66
default:
92
+ object_property_set_bool(obj, "start-powered-off", true,
67
fail:
93
+ &error_abort);
68
- hw_error("%s: Bad offset " REG_FMT "\n", __func__, offset);
94
+
69
+ qemu_log_mask(LOG_GUEST_ERROR, "%s: Bad offset 0x%" HWADDR_PRIX "\n",
95
+ object_property_set_int(obj, "mp-affinity", 0x100 | i, &error_abort);
70
+ __func__, offset);
96
+ object_property_set_int(obj, "core-count", ARRAY_SIZE(s->lpd.rpu.cpu),
71
}
97
+ &error_abort);
72
98
+ object_property_set_link(obj, "memory", OBJECT(&s->lpd.rpu.mr),
73
return 0;
99
+ &error_abort);
74
@@ -XXX,XX +XXX,XX @@ static void pxa2xx_lcdc_write(void *opaque, hwaddr offset,
100
+ qdev_realize(DEVICE(obj), NULL, &error_fatal);
75
101
+ }
76
default:
102
+
77
fail:
103
+ qdev_realize(DEVICE(&s->lpd.rpu.cluster), NULL, &error_fatal);
78
- hw_error("%s: Bad offset " REG_FMT "\n", __func__, offset);
104
+}
79
+ qemu_log_mask(LOG_GUEST_ERROR, "%s: Bad offset 0x%" HWADDR_PRIX "\n",
105
+
80
+ __func__, offset);
106
static void versal_create_uarts(Versal *s, qemu_irq *pic)
81
}
107
{
108
int i;
109
@@ -XXX,XX +XXX,XX @@ static void versal_realize(DeviceState *dev, Error **errp)
110
111
versal_create_apu_cpus(s);
112
versal_create_apu_gic(s, pic);
113
+ versal_create_rpu_cpus(s);
114
versal_create_uarts(s, pic);
115
versal_create_usbs(s, pic);
116
versal_create_gems(s, pic);
117
@@ -XXX,XX +XXX,XX @@ static void versal_realize(DeviceState *dev, Error **errp)
118
119
memory_region_add_subregion_overlap(&s->mr_ps, MM_OCM, &s->lpd.mr_ocm, 0);
120
memory_region_add_subregion_overlap(&s->fpd.apu.mr, 0, &s->mr_ps, 0);
121
+ memory_region_add_subregion_overlap(&s->lpd.rpu.mr, 0,
122
+ &s->lpd.rpu.mr_ps_alias, 0);
82
}
123
}
83
124
84
diff --git a/hw/dma/pxa2xx_dma.c b/hw/dma/pxa2xx_dma.c
125
static void versal_init(Object *obj)
85
index XXXXXXX..XXXXXXX 100644
126
@@ -XXX,XX +XXX,XX @@ static void versal_init(Object *obj)
86
--- a/hw/dma/pxa2xx_dma.c
127
Versal *s = XLNX_VERSAL(obj);
87
+++ b/hw/dma/pxa2xx_dma.c
128
88
@@ -XXX,XX +XXX,XX @@
129
memory_region_init(&s->fpd.apu.mr, obj, "mr-apu", UINT64_MAX);
89
*/
130
+ memory_region_init(&s->lpd.rpu.mr, obj, "mr-rpu", UINT64_MAX);
90
131
memory_region_init(&s->mr_ps, obj, "mr-ps-switch", UINT64_MAX);
91
#include "qemu/osdep.h"
132
+ memory_region_init_alias(&s->lpd.rpu.mr_ps_alias, OBJECT(s),
92
+#include "qemu/log.h"
133
+ "mr-rpu-ps-alias", &s->mr_ps, 0, UINT64_MAX);
93
#include "hw/hw.h"
94
#include "hw/irq.h"
95
#include "hw/qdev-properties.h"
96
@@ -XXX,XX +XXX,XX @@ static uint64_t pxa2xx_dma_read(void *opaque, hwaddr offset,
97
unsigned int channel;
98
99
if (size != 4) {
100
- hw_error("%s: Bad access width\n", __func__);
101
+ qemu_log_mask(LOG_GUEST_ERROR, "%s: Bad access width %u\n",
102
+ __func__, size);
103
return 5;
104
}
105
106
@@ -XXX,XX +XXX,XX @@ static uint64_t pxa2xx_dma_read(void *opaque, hwaddr offset,
107
return s->chan[channel].cmd;
108
}
109
}
110
-
111
- hw_error("%s: Bad offset 0x" TARGET_FMT_plx "\n", __func__, offset);
112
+ qemu_log_mask(LOG_GUEST_ERROR, "%s: Bad offset 0x%" HWADDR_PRIX "\n",
113
+ __func__, offset);
114
return 7;
115
}
134
}
116
135
117
@@ -XXX,XX +XXX,XX @@ static void pxa2xx_dma_write(void *opaque, hwaddr offset,
136
static Property versal_properties[] = {
118
unsigned int channel;
119
120
if (size != 4) {
121
- hw_error("%s: Bad access width\n", __func__);
122
+ qemu_log_mask(LOG_GUEST_ERROR, "%s: Bad access width %u\n",
123
+ __func__, size);
124
return;
125
}
126
127
@@ -XXX,XX +XXX,XX @@ static void pxa2xx_dma_write(void *opaque, hwaddr offset,
128
break;
129
}
130
fail:
131
- hw_error("%s: Bad offset " TARGET_FMT_plx "\n", __func__, offset);
132
+ qemu_log_mask(LOG_GUEST_ERROR, "%s: Bad offset 0x%" HWADDR_PRIX "\n",
133
+ __func__, offset);
134
}
135
}
136
137
--
137
--
138
2.20.1
138
2.25.1
139
140
diff view generated by jsdifflib
1
From: Thomas Huth <thuth@redhat.com>
1
From: "Edgar E. Iglesias" <edgar.iglesias@amd.com>
2
2
3
The canon-a1100 machine can be used with the Barebox firmware. The
3
Add a model of the Xilinx Versal CRL.
4
QEMU Advent Calendar 2018 features a pre-compiled image which we
5
can use for testing.
6
4
7
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
5
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@amd.com>
8
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
6
Reviewed-by: Frederic Konrad <fkonrad@amd.com>
9
Reviewed-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
7
Reviewed-by: Francisco Iglesias <francisco.iglesias@amd.com>
10
Tested-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
8
Message-id: 20220406174303.2022038-4-edgar.iglesias@xilinx.com
11
Signed-off-by: Thomas Huth <thuth@redhat.com>
12
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
13
Message-id: 20200514190422.23645-1-f4bug@amsat.org
14
Message-Id: <20200129090420.13954-1-thuth@redhat.com>
15
[PMD: Rebased MAINTAINERS]
16
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
17
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
18
---
10
---
19
MAINTAINERS | 1 +
11
include/hw/misc/xlnx-versal-crl.h | 235 +++++++++++++++++
20
tests/acceptance/machine_arm_canona1100.py | 35 ++++++++++++++++++++++
12
hw/misc/xlnx-versal-crl.c | 421 ++++++++++++++++++++++++++++++
21
2 files changed, 36 insertions(+)
13
hw/misc/meson.build | 1 +
22
create mode 100644 tests/acceptance/machine_arm_canona1100.py
14
3 files changed, 657 insertions(+)
15
create mode 100644 include/hw/misc/xlnx-versal-crl.h
16
create mode 100644 hw/misc/xlnx-versal-crl.c
23
17
24
diff --git a/MAINTAINERS b/MAINTAINERS
18
diff --git a/include/hw/misc/xlnx-versal-crl.h b/include/hw/misc/xlnx-versal-crl.h
25
index XXXXXXX..XXXXXXX 100644
26
--- a/MAINTAINERS
27
+++ b/MAINTAINERS
28
@@ -XXX,XX +XXX,XX @@ S: Odd Fixes
29
F: include/hw/arm/digic.h
30
F: hw/*/digic*
31
F: include/hw/*/digic*
32
+F: tests/acceptance/machine_arm_canona1100.py
33
34
Goldfish RTC
35
M: Anup Patel <anup.patel@wdc.com>
36
diff --git a/tests/acceptance/machine_arm_canona1100.py b/tests/acceptance/machine_arm_canona1100.py
37
new file mode 100644
19
new file mode 100644
38
index XXXXXXX..XXXXXXX
20
index XXXXXXX..XXXXXXX
39
--- /dev/null
21
--- /dev/null
40
+++ b/tests/acceptance/machine_arm_canona1100.py
22
+++ b/include/hw/misc/xlnx-versal-crl.h
41
@@ -XXX,XX +XXX,XX @@
23
@@ -XXX,XX +XXX,XX @@
42
+# Functional test that boots the canon-a1100 machine with firmware
24
+/*
43
+#
25
+ * QEMU model of the Clock-Reset-LPD (CRL).
44
+# Copyright (c) 2020 Red Hat, Inc.
26
+ *
45
+#
27
+ * Copyright (c) 2022 Xilinx Inc.
46
+# Author:
28
+ * SPDX-License-Identifier: GPL-2.0-or-later
47
+# Thomas Huth <thuth@redhat.com>
29
+ *
48
+#
30
+ * Written by Edgar E. Iglesias <edgar.iglesias@xilinx.com>
49
+# This work is licensed under the terms of the GNU GPL, version 2 or
31
+ */
50
+# later. See the COPYING file in the top-level directory.
32
+#ifndef HW_MISC_XLNX_VERSAL_CRL_H
51
+
33
+#define HW_MISC_XLNX_VERSAL_CRL_H
52
+from avocado_qemu import Test
34
+
53
+from avocado_qemu import wait_for_console_pattern
35
+#include "hw/sysbus.h"
54
+from avocado.utils import archive
36
+#include "hw/register.h"
55
+
37
+#include "target/arm/cpu.h"
56
+class CanonA1100Machine(Test):
38
+
57
+ """Boots the barebox firmware and checks that the console is operational"""
39
+#define TYPE_XLNX_VERSAL_CRL "xlnx,versal-crl"
58
+
40
+OBJECT_DECLARE_SIMPLE_TYPE(XlnxVersalCRL, XLNX_VERSAL_CRL)
59
+ timeout = 90
41
+
60
+
42
+REG32(ERR_CTRL, 0x0)
61
+ def test_arm_canona1100(self):
43
+ FIELD(ERR_CTRL, SLVERR_ENABLE, 0, 1)
62
+ """
44
+REG32(IR_STATUS, 0x4)
63
+ :avocado: tags=arch:arm
45
+ FIELD(IR_STATUS, ADDR_DECODE_ERR, 0, 1)
64
+ :avocado: tags=machine:canon-a1100
46
+REG32(IR_MASK, 0x8)
65
+ :avocado: tags=device:pflash_cfi02
47
+ FIELD(IR_MASK, ADDR_DECODE_ERR, 0, 1)
66
+ """
48
+REG32(IR_ENABLE, 0xc)
67
+ tar_url = ('https://www.qemu-advent-calendar.org'
49
+ FIELD(IR_ENABLE, ADDR_DECODE_ERR, 0, 1)
68
+ '/2018/download/day18.tar.xz')
50
+REG32(IR_DISABLE, 0x10)
69
+ tar_hash = '068b5fc4242b29381acee94713509f8a876e9db6'
51
+ FIELD(IR_DISABLE, ADDR_DECODE_ERR, 0, 1)
70
+ file_path = self.fetch_asset(tar_url, asset_hash=tar_hash)
52
+REG32(WPROT, 0x1c)
71
+ archive.extract(file_path, self.workdir)
53
+ FIELD(WPROT, ACTIVE, 0, 1)
72
+ self.vm.set_console()
54
+REG32(PLL_CLK_OTHER_DMN, 0x20)
73
+ self.vm.add_args('-bios',
55
+ FIELD(PLL_CLK_OTHER_DMN, APLL_BYPASS, 0, 1)
74
+ self.workdir + '/day18/barebox.canon-a1100.bin')
56
+REG32(RPLL_CTRL, 0x40)
75
+ self.vm.launch()
57
+ FIELD(RPLL_CTRL, POST_SRC, 24, 3)
76
+ wait_for_console_pattern(self, 'running /env/bin/init')
58
+ FIELD(RPLL_CTRL, PRE_SRC, 20, 3)
59
+ FIELD(RPLL_CTRL, CLKOUTDIV, 16, 2)
60
+ FIELD(RPLL_CTRL, FBDIV, 8, 8)
61
+ FIELD(RPLL_CTRL, BYPASS, 3, 1)
62
+ FIELD(RPLL_CTRL, RESET, 0, 1)
63
+REG32(RPLL_CFG, 0x44)
64
+ FIELD(RPLL_CFG, LOCK_DLY, 25, 7)
65
+ FIELD(RPLL_CFG, LOCK_CNT, 13, 10)
66
+ FIELD(RPLL_CFG, LFHF, 10, 2)
67
+ FIELD(RPLL_CFG, CP, 5, 4)
68
+ FIELD(RPLL_CFG, RES, 0, 4)
69
+REG32(RPLL_FRAC_CFG, 0x48)
70
+ FIELD(RPLL_FRAC_CFG, ENABLED, 31, 1)
71
+ FIELD(RPLL_FRAC_CFG, SEED, 22, 3)
72
+ FIELD(RPLL_FRAC_CFG, ALGRTHM, 19, 1)
73
+ FIELD(RPLL_FRAC_CFG, ORDER, 18, 1)
74
+ FIELD(RPLL_FRAC_CFG, DATA, 0, 16)
75
+REG32(PLL_STATUS, 0x50)
76
+ FIELD(PLL_STATUS, RPLL_STABLE, 2, 1)
77
+ FIELD(PLL_STATUS, RPLL_LOCK, 0, 1)
78
+REG32(RPLL_TO_XPD_CTRL, 0x100)
79
+ FIELD(RPLL_TO_XPD_CTRL, CLKACT, 25, 1)
80
+ FIELD(RPLL_TO_XPD_CTRL, DIVISOR0, 8, 10)
81
+REG32(LPD_TOP_SWITCH_CTRL, 0x104)
82
+ FIELD(LPD_TOP_SWITCH_CTRL, CLKACT_ADMA, 26, 1)
83
+ FIELD(LPD_TOP_SWITCH_CTRL, CLKACT, 25, 1)
84
+ FIELD(LPD_TOP_SWITCH_CTRL, DIVISOR0, 8, 10)
85
+ FIELD(LPD_TOP_SWITCH_CTRL, SRCSEL, 0, 3)
86
+REG32(LPD_LSBUS_CTRL, 0x108)
87
+ FIELD(LPD_LSBUS_CTRL, CLKACT, 25, 1)
88
+ FIELD(LPD_LSBUS_CTRL, DIVISOR0, 8, 10)
89
+ FIELD(LPD_LSBUS_CTRL, SRCSEL, 0, 3)
90
+REG32(CPU_R5_CTRL, 0x10c)
91
+ FIELD(CPU_R5_CTRL, CLKACT_OCM2, 28, 1)
92
+ FIELD(CPU_R5_CTRL, CLKACT_OCM, 27, 1)
93
+ FIELD(CPU_R5_CTRL, CLKACT_CORE, 26, 1)
94
+ FIELD(CPU_R5_CTRL, CLKACT, 25, 1)
95
+ FIELD(CPU_R5_CTRL, DIVISOR0, 8, 10)
96
+ FIELD(CPU_R5_CTRL, SRCSEL, 0, 3)
97
+REG32(IOU_SWITCH_CTRL, 0x114)
98
+ FIELD(IOU_SWITCH_CTRL, CLKACT, 25, 1)
99
+ FIELD(IOU_SWITCH_CTRL, DIVISOR0, 8, 10)
100
+ FIELD(IOU_SWITCH_CTRL, SRCSEL, 0, 3)
101
+REG32(GEM0_REF_CTRL, 0x118)
102
+ FIELD(GEM0_REF_CTRL, CLKACT_RX, 27, 1)
103
+ FIELD(GEM0_REF_CTRL, CLKACT_TX, 26, 1)
104
+ FIELD(GEM0_REF_CTRL, CLKACT, 25, 1)
105
+ FIELD(GEM0_REF_CTRL, DIVISOR0, 8, 10)
106
+ FIELD(GEM0_REF_CTRL, SRCSEL, 0, 3)
107
+REG32(GEM1_REF_CTRL, 0x11c)
108
+ FIELD(GEM1_REF_CTRL, CLKACT_RX, 27, 1)
109
+ FIELD(GEM1_REF_CTRL, CLKACT_TX, 26, 1)
110
+ FIELD(GEM1_REF_CTRL, CLKACT, 25, 1)
111
+ FIELD(GEM1_REF_CTRL, DIVISOR0, 8, 10)
112
+ FIELD(GEM1_REF_CTRL, SRCSEL, 0, 3)
113
+REG32(GEM_TSU_REF_CTRL, 0x120)
114
+ FIELD(GEM_TSU_REF_CTRL, CLKACT, 25, 1)
115
+ FIELD(GEM_TSU_REF_CTRL, DIVISOR0, 8, 10)
116
+ FIELD(GEM_TSU_REF_CTRL, SRCSEL, 0, 3)
117
+REG32(USB0_BUS_REF_CTRL, 0x124)
118
+ FIELD(USB0_BUS_REF_CTRL, CLKACT, 25, 1)
119
+ FIELD(USB0_BUS_REF_CTRL, DIVISOR0, 8, 10)
120
+ FIELD(USB0_BUS_REF_CTRL, SRCSEL, 0, 3)
121
+REG32(UART0_REF_CTRL, 0x128)
122
+ FIELD(UART0_REF_CTRL, CLKACT, 25, 1)
123
+ FIELD(UART0_REF_CTRL, DIVISOR0, 8, 10)
124
+ FIELD(UART0_REF_CTRL, SRCSEL, 0, 3)
125
+REG32(UART1_REF_CTRL, 0x12c)
126
+ FIELD(UART1_REF_CTRL, CLKACT, 25, 1)
127
+ FIELD(UART1_REF_CTRL, DIVISOR0, 8, 10)
128
+ FIELD(UART1_REF_CTRL, SRCSEL, 0, 3)
129
+REG32(SPI0_REF_CTRL, 0x130)
130
+ FIELD(SPI0_REF_CTRL, CLKACT, 25, 1)
131
+ FIELD(SPI0_REF_CTRL, DIVISOR0, 8, 10)
132
+ FIELD(SPI0_REF_CTRL, SRCSEL, 0, 3)
133
+REG32(SPI1_REF_CTRL, 0x134)
134
+ FIELD(SPI1_REF_CTRL, CLKACT, 25, 1)
135
+ FIELD(SPI1_REF_CTRL, DIVISOR0, 8, 10)
136
+ FIELD(SPI1_REF_CTRL, SRCSEL, 0, 3)
137
+REG32(CAN0_REF_CTRL, 0x138)
138
+ FIELD(CAN0_REF_CTRL, CLKACT, 25, 1)
139
+ FIELD(CAN0_REF_CTRL, DIVISOR0, 8, 10)
140
+ FIELD(CAN0_REF_CTRL, SRCSEL, 0, 3)
141
+REG32(CAN1_REF_CTRL, 0x13c)
142
+ FIELD(CAN1_REF_CTRL, CLKACT, 25, 1)
143
+ FIELD(CAN1_REF_CTRL, DIVISOR0, 8, 10)
144
+ FIELD(CAN1_REF_CTRL, SRCSEL, 0, 3)
145
+REG32(I2C0_REF_CTRL, 0x140)
146
+ FIELD(I2C0_REF_CTRL, CLKACT, 25, 1)
147
+ FIELD(I2C0_REF_CTRL, DIVISOR0, 8, 10)
148
+ FIELD(I2C0_REF_CTRL, SRCSEL, 0, 3)
149
+REG32(I2C1_REF_CTRL, 0x144)
150
+ FIELD(I2C1_REF_CTRL, CLKACT, 25, 1)
151
+ FIELD(I2C1_REF_CTRL, DIVISOR0, 8, 10)
152
+ FIELD(I2C1_REF_CTRL, SRCSEL, 0, 3)
153
+REG32(DBG_LPD_CTRL, 0x148)
154
+ FIELD(DBG_LPD_CTRL, CLKACT, 25, 1)
155
+ FIELD(DBG_LPD_CTRL, DIVISOR0, 8, 10)
156
+ FIELD(DBG_LPD_CTRL, SRCSEL, 0, 3)
157
+REG32(TIMESTAMP_REF_CTRL, 0x14c)
158
+ FIELD(TIMESTAMP_REF_CTRL, CLKACT, 25, 1)
159
+ FIELD(TIMESTAMP_REF_CTRL, DIVISOR0, 8, 10)
160
+ FIELD(TIMESTAMP_REF_CTRL, SRCSEL, 0, 3)
161
+REG32(CRL_SAFETY_CHK, 0x150)
162
+REG32(PSM_REF_CTRL, 0x154)
163
+ FIELD(PSM_REF_CTRL, DIVISOR0, 8, 10)
164
+ FIELD(PSM_REF_CTRL, SRCSEL, 0, 3)
165
+REG32(DBG_TSTMP_CTRL, 0x158)
166
+ FIELD(DBG_TSTMP_CTRL, CLKACT, 25, 1)
167
+ FIELD(DBG_TSTMP_CTRL, DIVISOR0, 8, 10)
168
+ FIELD(DBG_TSTMP_CTRL, SRCSEL, 0, 3)
169
+REG32(CPM_TOPSW_REF_CTRL, 0x15c)
170
+ FIELD(CPM_TOPSW_REF_CTRL, CLKACT, 25, 1)
171
+ FIELD(CPM_TOPSW_REF_CTRL, DIVISOR0, 8, 10)
172
+ FIELD(CPM_TOPSW_REF_CTRL, SRCSEL, 0, 3)
173
+REG32(USB3_DUAL_REF_CTRL, 0x160)
174
+ FIELD(USB3_DUAL_REF_CTRL, CLKACT, 25, 1)
175
+ FIELD(USB3_DUAL_REF_CTRL, DIVISOR0, 8, 10)
176
+ FIELD(USB3_DUAL_REF_CTRL, SRCSEL, 0, 3)
177
+REG32(RST_CPU_R5, 0x300)
178
+ FIELD(RST_CPU_R5, RESET_PGE, 4, 1)
179
+ FIELD(RST_CPU_R5, RESET_AMBA, 2, 1)
180
+ FIELD(RST_CPU_R5, RESET_CPU1, 1, 1)
181
+ FIELD(RST_CPU_R5, RESET_CPU0, 0, 1)
182
+REG32(RST_ADMA, 0x304)
183
+ FIELD(RST_ADMA, RESET, 0, 1)
184
+REG32(RST_GEM0, 0x308)
185
+ FIELD(RST_GEM0, RESET, 0, 1)
186
+REG32(RST_GEM1, 0x30c)
187
+ FIELD(RST_GEM1, RESET, 0, 1)
188
+REG32(RST_SPARE, 0x310)
189
+ FIELD(RST_SPARE, RESET, 0, 1)
190
+REG32(RST_USB0, 0x314)
191
+ FIELD(RST_USB0, RESET, 0, 1)
192
+REG32(RST_UART0, 0x318)
193
+ FIELD(RST_UART0, RESET, 0, 1)
194
+REG32(RST_UART1, 0x31c)
195
+ FIELD(RST_UART1, RESET, 0, 1)
196
+REG32(RST_SPI0, 0x320)
197
+ FIELD(RST_SPI0, RESET, 0, 1)
198
+REG32(RST_SPI1, 0x324)
199
+ FIELD(RST_SPI1, RESET, 0, 1)
200
+REG32(RST_CAN0, 0x328)
201
+ FIELD(RST_CAN0, RESET, 0, 1)
202
+REG32(RST_CAN1, 0x32c)
203
+ FIELD(RST_CAN1, RESET, 0, 1)
204
+REG32(RST_I2C0, 0x330)
205
+ FIELD(RST_I2C0, RESET, 0, 1)
206
+REG32(RST_I2C1, 0x334)
207
+ FIELD(RST_I2C1, RESET, 0, 1)
208
+REG32(RST_DBG_LPD, 0x338)
209
+ FIELD(RST_DBG_LPD, RPU_DBG1_RESET, 5, 1)
210
+ FIELD(RST_DBG_LPD, RPU_DBG0_RESET, 4, 1)
211
+ FIELD(RST_DBG_LPD, RESET_HSDP, 1, 1)
212
+ FIELD(RST_DBG_LPD, RESET, 0, 1)
213
+REG32(RST_GPIO, 0x33c)
214
+ FIELD(RST_GPIO, RESET, 0, 1)
215
+REG32(RST_TTC, 0x344)
216
+ FIELD(RST_TTC, TTC3_RESET, 3, 1)
217
+ FIELD(RST_TTC, TTC2_RESET, 2, 1)
218
+ FIELD(RST_TTC, TTC1_RESET, 1, 1)
219
+ FIELD(RST_TTC, TTC0_RESET, 0, 1)
220
+REG32(RST_TIMESTAMP, 0x348)
221
+ FIELD(RST_TIMESTAMP, RESET, 0, 1)
222
+REG32(RST_SWDT, 0x34c)
223
+ FIELD(RST_SWDT, RESET, 0, 1)
224
+REG32(RST_OCM, 0x350)
225
+ FIELD(RST_OCM, RESET, 0, 1)
226
+REG32(RST_IPI, 0x354)
227
+ FIELD(RST_IPI, RESET, 0, 1)
228
+REG32(RST_SYSMON, 0x358)
229
+ FIELD(RST_SYSMON, SEQ_RST, 1, 1)
230
+ FIELD(RST_SYSMON, CFG_RST, 0, 1)
231
+REG32(RST_FPD, 0x360)
232
+ FIELD(RST_FPD, SRST, 1, 1)
233
+ FIELD(RST_FPD, POR, 0, 1)
234
+REG32(PSM_RST_MODE, 0x370)
235
+ FIELD(PSM_RST_MODE, WAKEUP, 2, 1)
236
+ FIELD(PSM_RST_MODE, RST_MODE, 0, 2)
237
+
238
+#define CRL_R_MAX (R_PSM_RST_MODE + 1)
239
+
240
+#define RPU_MAX_CPU 2
241
+
242
+struct XlnxVersalCRL {
243
+ SysBusDevice parent_obj;
244
+ qemu_irq irq;
245
+
246
+ struct {
247
+ ARMCPU *cpu_r5[RPU_MAX_CPU];
248
+ DeviceState *adma[8];
249
+ DeviceState *uart[2];
250
+ DeviceState *gem[2];
251
+ DeviceState *usb;
252
+ } cfg;
253
+
254
+ RegisterInfoArray *reg_array;
255
+ uint32_t regs[CRL_R_MAX];
256
+ RegisterInfo regs_info[CRL_R_MAX];
257
+};
258
+#endif
259
diff --git a/hw/misc/xlnx-versal-crl.c b/hw/misc/xlnx-versal-crl.c
260
new file mode 100644
261
index XXXXXXX..XXXXXXX
262
--- /dev/null
263
+++ b/hw/misc/xlnx-versal-crl.c
264
@@ -XXX,XX +XXX,XX @@
265
+/*
266
+ * QEMU model of the Clock-Reset-LPD (CRL).
267
+ *
268
+ * Copyright (c) 2022 Advanced Micro Devices, Inc.
269
+ * SPDX-License-Identifier: GPL-2.0-or-later
270
+ *
271
+ * Written by Edgar E. Iglesias <edgar.iglesias@amd.com>
272
+ */
273
+
274
+#include "qemu/osdep.h"
275
+#include "qapi/error.h"
276
+#include "qemu/log.h"
277
+#include "qemu/bitops.h"
278
+#include "migration/vmstate.h"
279
+#include "hw/qdev-properties.h"
280
+#include "hw/sysbus.h"
281
+#include "hw/irq.h"
282
+#include "hw/register.h"
283
+#include "hw/resettable.h"
284
+
285
+#include "target/arm/arm-powerctl.h"
286
+#include "hw/misc/xlnx-versal-crl.h"
287
+
288
+#ifndef XLNX_VERSAL_CRL_ERR_DEBUG
289
+#define XLNX_VERSAL_CRL_ERR_DEBUG 0
290
+#endif
291
+
292
+static void crl_update_irq(XlnxVersalCRL *s)
293
+{
294
+ bool pending = s->regs[R_IR_STATUS] & ~s->regs[R_IR_MASK];
295
+ qemu_set_irq(s->irq, pending);
296
+}
297
+
298
+static void crl_status_postw(RegisterInfo *reg, uint64_t val64)
299
+{
300
+ XlnxVersalCRL *s = XLNX_VERSAL_CRL(reg->opaque);
301
+ crl_update_irq(s);
302
+}
303
+
304
+static uint64_t crl_enable_prew(RegisterInfo *reg, uint64_t val64)
305
+{
306
+ XlnxVersalCRL *s = XLNX_VERSAL_CRL(reg->opaque);
307
+ uint32_t val = val64;
308
+
309
+ s->regs[R_IR_MASK] &= ~val;
310
+ crl_update_irq(s);
311
+ return 0;
312
+}
313
+
314
+static uint64_t crl_disable_prew(RegisterInfo *reg, uint64_t val64)
315
+{
316
+ XlnxVersalCRL *s = XLNX_VERSAL_CRL(reg->opaque);
317
+ uint32_t val = val64;
318
+
319
+ s->regs[R_IR_MASK] |= val;
320
+ crl_update_irq(s);
321
+ return 0;
322
+}
323
+
324
+static void crl_reset_dev(XlnxVersalCRL *s, DeviceState *dev,
325
+ bool rst_old, bool rst_new)
326
+{
327
+ device_cold_reset(dev);
328
+}
329
+
330
+static void crl_reset_cpu(XlnxVersalCRL *s, ARMCPU *armcpu,
331
+ bool rst_old, bool rst_new)
332
+{
333
+ if (rst_new) {
334
+ arm_set_cpu_off(armcpu->mp_affinity);
335
+ } else {
336
+ arm_set_cpu_on_and_reset(armcpu->mp_affinity);
337
+ }
338
+}
339
+
340
+#define REGFIELD_RESET(type, s, reg, f, new_val, dev) { \
341
+ bool old_f = ARRAY_FIELD_EX32((s)->regs, reg, f); \
342
+ bool new_f = FIELD_EX32(new_val, reg, f); \
343
+ \
344
+ /* Detect edges. */ \
345
+ if (dev && old_f != new_f) { \
346
+ crl_reset_ ## type(s, dev, old_f, new_f); \
347
+ } \
348
+}
349
+
350
+static uint64_t crl_rst_r5_prew(RegisterInfo *reg, uint64_t val64)
351
+{
352
+ XlnxVersalCRL *s = XLNX_VERSAL_CRL(reg->opaque);
353
+
354
+ REGFIELD_RESET(cpu, s, RST_CPU_R5, RESET_CPU0, val64, s->cfg.cpu_r5[0]);
355
+ REGFIELD_RESET(cpu, s, RST_CPU_R5, RESET_CPU1, val64, s->cfg.cpu_r5[1]);
356
+ return val64;
357
+}
358
+
359
+static uint64_t crl_rst_adma_prew(RegisterInfo *reg, uint64_t val64)
360
+{
361
+ XlnxVersalCRL *s = XLNX_VERSAL_CRL(reg->opaque);
362
+ int i;
363
+
364
+ /* A single register fans out to all ADMA reset inputs. */
365
+ for (i = 0; i < ARRAY_SIZE(s->cfg.adma); i++) {
366
+ REGFIELD_RESET(dev, s, RST_ADMA, RESET, val64, s->cfg.adma[i]);
367
+ }
368
+ return val64;
369
+}
370
+
371
+static uint64_t crl_rst_uart0_prew(RegisterInfo *reg, uint64_t val64)
372
+{
373
+ XlnxVersalCRL *s = XLNX_VERSAL_CRL(reg->opaque);
374
+
375
+ REGFIELD_RESET(dev, s, RST_UART0, RESET, val64, s->cfg.uart[0]);
376
+ return val64;
377
+}
378
+
379
+static uint64_t crl_rst_uart1_prew(RegisterInfo *reg, uint64_t val64)
380
+{
381
+ XlnxVersalCRL *s = XLNX_VERSAL_CRL(reg->opaque);
382
+
383
+ REGFIELD_RESET(dev, s, RST_UART1, RESET, val64, s->cfg.uart[1]);
384
+ return val64;
385
+}
386
+
387
+static uint64_t crl_rst_gem0_prew(RegisterInfo *reg, uint64_t val64)
388
+{
389
+ XlnxVersalCRL *s = XLNX_VERSAL_CRL(reg->opaque);
390
+
391
+ REGFIELD_RESET(dev, s, RST_GEM0, RESET, val64, s->cfg.gem[0]);
392
+ return val64;
393
+}
394
+
395
+static uint64_t crl_rst_gem1_prew(RegisterInfo *reg, uint64_t val64)
396
+{
397
+ XlnxVersalCRL *s = XLNX_VERSAL_CRL(reg->opaque);
398
+
399
+ REGFIELD_RESET(dev, s, RST_GEM1, RESET, val64, s->cfg.gem[1]);
400
+ return val64;
401
+}
402
+
403
+static uint64_t crl_rst_usb_prew(RegisterInfo *reg, uint64_t val64)
404
+{
405
+ XlnxVersalCRL *s = XLNX_VERSAL_CRL(reg->opaque);
406
+
407
+ REGFIELD_RESET(dev, s, RST_USB0, RESET, val64, s->cfg.usb);
408
+ return val64;
409
+}
410
+
411
+static const RegisterAccessInfo crl_regs_info[] = {
412
+ { .name = "ERR_CTRL", .addr = A_ERR_CTRL,
413
+ },{ .name = "IR_STATUS", .addr = A_IR_STATUS,
414
+ .w1c = 0x1,
415
+ .post_write = crl_status_postw,
416
+ },{ .name = "IR_MASK", .addr = A_IR_MASK,
417
+ .reset = 0x1,
418
+ .ro = 0x1,
419
+ },{ .name = "IR_ENABLE", .addr = A_IR_ENABLE,
420
+ .pre_write = crl_enable_prew,
421
+ },{ .name = "IR_DISABLE", .addr = A_IR_DISABLE,
422
+ .pre_write = crl_disable_prew,
423
+ },{ .name = "WPROT", .addr = A_WPROT,
424
+ },{ .name = "PLL_CLK_OTHER_DMN", .addr = A_PLL_CLK_OTHER_DMN,
425
+ .reset = 0x1,
426
+ .rsvd = 0xe,
427
+ },{ .name = "RPLL_CTRL", .addr = A_RPLL_CTRL,
428
+ .reset = 0x24809,
429
+ .rsvd = 0xf88c00f6,
430
+ },{ .name = "RPLL_CFG", .addr = A_RPLL_CFG,
431
+ .reset = 0x2000000,
432
+ .rsvd = 0x1801210,
433
+ },{ .name = "RPLL_FRAC_CFG", .addr = A_RPLL_FRAC_CFG,
434
+ .rsvd = 0x7e330000,
435
+ },{ .name = "PLL_STATUS", .addr = A_PLL_STATUS,
436
+ .reset = R_PLL_STATUS_RPLL_STABLE_MASK |
437
+ R_PLL_STATUS_RPLL_LOCK_MASK,
438
+ .rsvd = 0xfa,
439
+ .ro = 0x5,
440
+ },{ .name = "RPLL_TO_XPD_CTRL", .addr = A_RPLL_TO_XPD_CTRL,
441
+ .reset = 0x2000100,
442
+ .rsvd = 0xfdfc00ff,
443
+ },{ .name = "LPD_TOP_SWITCH_CTRL", .addr = A_LPD_TOP_SWITCH_CTRL,
444
+ .reset = 0x6000300,
445
+ .rsvd = 0xf9fc00f8,
446
+ },{ .name = "LPD_LSBUS_CTRL", .addr = A_LPD_LSBUS_CTRL,
447
+ .reset = 0x2000800,
448
+ .rsvd = 0xfdfc00f8,
449
+ },{ .name = "CPU_R5_CTRL", .addr = A_CPU_R5_CTRL,
450
+ .reset = 0xe000300,
451
+ .rsvd = 0xe1fc00f8,
452
+ },{ .name = "IOU_SWITCH_CTRL", .addr = A_IOU_SWITCH_CTRL,
453
+ .reset = 0x2000500,
454
+ .rsvd = 0xfdfc00f8,
455
+ },{ .name = "GEM0_REF_CTRL", .addr = A_GEM0_REF_CTRL,
456
+ .reset = 0xe000a00,
457
+ .rsvd = 0xf1fc00f8,
458
+ },{ .name = "GEM1_REF_CTRL", .addr = A_GEM1_REF_CTRL,
459
+ .reset = 0xe000a00,
460
+ .rsvd = 0xf1fc00f8,
461
+ },{ .name = "GEM_TSU_REF_CTRL", .addr = A_GEM_TSU_REF_CTRL,
462
+ .reset = 0x300,
463
+ .rsvd = 0xfdfc00f8,
464
+ },{ .name = "USB0_BUS_REF_CTRL", .addr = A_USB0_BUS_REF_CTRL,
465
+ .reset = 0x2001900,
466
+ .rsvd = 0xfdfc00f8,
467
+ },{ .name = "UART0_REF_CTRL", .addr = A_UART0_REF_CTRL,
468
+ .reset = 0xc00,
469
+ .rsvd = 0xfdfc00f8,
470
+ },{ .name = "UART1_REF_CTRL", .addr = A_UART1_REF_CTRL,
471
+ .reset = 0xc00,
472
+ .rsvd = 0xfdfc00f8,
473
+ },{ .name = "SPI0_REF_CTRL", .addr = A_SPI0_REF_CTRL,
474
+ .reset = 0x600,
475
+ .rsvd = 0xfdfc00f8,
476
+ },{ .name = "SPI1_REF_CTRL", .addr = A_SPI1_REF_CTRL,
477
+ .reset = 0x600,
478
+ .rsvd = 0xfdfc00f8,
479
+ },{ .name = "CAN0_REF_CTRL", .addr = A_CAN0_REF_CTRL,
480
+ .reset = 0xc00,
481
+ .rsvd = 0xfdfc00f8,
482
+ },{ .name = "CAN1_REF_CTRL", .addr = A_CAN1_REF_CTRL,
483
+ .reset = 0xc00,
484
+ .rsvd = 0xfdfc00f8,
485
+ },{ .name = "I2C0_REF_CTRL", .addr = A_I2C0_REF_CTRL,
486
+ .reset = 0xc00,
487
+ .rsvd = 0xfdfc00f8,
488
+ },{ .name = "I2C1_REF_CTRL", .addr = A_I2C1_REF_CTRL,
489
+ .reset = 0xc00,
490
+ .rsvd = 0xfdfc00f8,
491
+ },{ .name = "DBG_LPD_CTRL", .addr = A_DBG_LPD_CTRL,
492
+ .reset = 0x300,
493
+ .rsvd = 0xfdfc00f8,
494
+ },{ .name = "TIMESTAMP_REF_CTRL", .addr = A_TIMESTAMP_REF_CTRL,
495
+ .reset = 0x2000c00,
496
+ .rsvd = 0xfdfc00f8,
497
+ },{ .name = "CRL_SAFETY_CHK", .addr = A_CRL_SAFETY_CHK,
498
+ },{ .name = "PSM_REF_CTRL", .addr = A_PSM_REF_CTRL,
499
+ .reset = 0xf04,
500
+ .rsvd = 0xfffc00f8,
501
+ },{ .name = "DBG_TSTMP_CTRL", .addr = A_DBG_TSTMP_CTRL,
502
+ .reset = 0x300,
503
+ .rsvd = 0xfdfc00f8,
504
+ },{ .name = "CPM_TOPSW_REF_CTRL", .addr = A_CPM_TOPSW_REF_CTRL,
505
+ .reset = 0x300,
506
+ .rsvd = 0xfdfc00f8,
507
+ },{ .name = "USB3_DUAL_REF_CTRL", .addr = A_USB3_DUAL_REF_CTRL,
508
+ .reset = 0x3c00,
509
+ .rsvd = 0xfdfc00f8,
510
+ },{ .name = "RST_CPU_R5", .addr = A_RST_CPU_R5,
511
+ .reset = 0x17,
512
+ .rsvd = 0x8,
513
+ .pre_write = crl_rst_r5_prew,
514
+ },{ .name = "RST_ADMA", .addr = A_RST_ADMA,
515
+ .reset = 0x1,
516
+ .pre_write = crl_rst_adma_prew,
517
+ },{ .name = "RST_GEM0", .addr = A_RST_GEM0,
518
+ .reset = 0x1,
519
+ .pre_write = crl_rst_gem0_prew,
520
+ },{ .name = "RST_GEM1", .addr = A_RST_GEM1,
521
+ .reset = 0x1,
522
+ .pre_write = crl_rst_gem1_prew,
523
+ },{ .name = "RST_SPARE", .addr = A_RST_SPARE,
524
+ .reset = 0x1,
525
+ },{ .name = "RST_USB0", .addr = A_RST_USB0,
526
+ .reset = 0x1,
527
+ .pre_write = crl_rst_usb_prew,
528
+ },{ .name = "RST_UART0", .addr = A_RST_UART0,
529
+ .reset = 0x1,
530
+ .pre_write = crl_rst_uart0_prew,
531
+ },{ .name = "RST_UART1", .addr = A_RST_UART1,
532
+ .reset = 0x1,
533
+ .pre_write = crl_rst_uart1_prew,
534
+ },{ .name = "RST_SPI0", .addr = A_RST_SPI0,
535
+ .reset = 0x1,
536
+ },{ .name = "RST_SPI1", .addr = A_RST_SPI1,
537
+ .reset = 0x1,
538
+ },{ .name = "RST_CAN0", .addr = A_RST_CAN0,
539
+ .reset = 0x1,
540
+ },{ .name = "RST_CAN1", .addr = A_RST_CAN1,
541
+ .reset = 0x1,
542
+ },{ .name = "RST_I2C0", .addr = A_RST_I2C0,
543
+ .reset = 0x1,
544
+ },{ .name = "RST_I2C1", .addr = A_RST_I2C1,
545
+ .reset = 0x1,
546
+ },{ .name = "RST_DBG_LPD", .addr = A_RST_DBG_LPD,
547
+ .reset = 0x33,
548
+ .rsvd = 0xcc,
549
+ },{ .name = "RST_GPIO", .addr = A_RST_GPIO,
550
+ .reset = 0x1,
551
+ },{ .name = "RST_TTC", .addr = A_RST_TTC,
552
+ .reset = 0xf,
553
+ },{ .name = "RST_TIMESTAMP", .addr = A_RST_TIMESTAMP,
554
+ .reset = 0x1,
555
+ },{ .name = "RST_SWDT", .addr = A_RST_SWDT,
556
+ .reset = 0x1,
557
+ },{ .name = "RST_OCM", .addr = A_RST_OCM,
558
+ },{ .name = "RST_IPI", .addr = A_RST_IPI,
559
+ },{ .name = "RST_FPD", .addr = A_RST_FPD,
560
+ .reset = 0x3,
561
+ },{ .name = "PSM_RST_MODE", .addr = A_PSM_RST_MODE,
562
+ .reset = 0x1,
563
+ .rsvd = 0xf8,
564
+ }
565
+};
566
+
567
+static void crl_reset_enter(Object *obj, ResetType type)
568
+{
569
+ XlnxVersalCRL *s = XLNX_VERSAL_CRL(obj);
570
+ unsigned int i;
571
+
572
+ for (i = 0; i < ARRAY_SIZE(s->regs_info); ++i) {
573
+ register_reset(&s->regs_info[i]);
574
+ }
575
+}
576
+
577
+static void crl_reset_hold(Object *obj)
578
+{
579
+ XlnxVersalCRL *s = XLNX_VERSAL_CRL(obj);
580
+
581
+ crl_update_irq(s);
582
+}
583
+
584
+static const MemoryRegionOps crl_ops = {
585
+ .read = register_read_memory,
586
+ .write = register_write_memory,
587
+ .endianness = DEVICE_LITTLE_ENDIAN,
588
+ .valid = {
589
+ .min_access_size = 4,
590
+ .max_access_size = 4,
591
+ },
592
+};
593
+
594
+static void crl_init(Object *obj)
595
+{
596
+ XlnxVersalCRL *s = XLNX_VERSAL_CRL(obj);
597
+ SysBusDevice *sbd = SYS_BUS_DEVICE(obj);
598
+ int i;
599
+
600
+ s->reg_array =
601
+ register_init_block32(DEVICE(obj), crl_regs_info,
602
+ ARRAY_SIZE(crl_regs_info),
603
+ s->regs_info, s->regs,
604
+ &crl_ops,
605
+ XLNX_VERSAL_CRL_ERR_DEBUG,
606
+ CRL_R_MAX * 4);
607
+ sysbus_init_mmio(sbd, &s->reg_array->mem);
608
+ sysbus_init_irq(sbd, &s->irq);
609
+
610
+ for (i = 0; i < ARRAY_SIZE(s->cfg.cpu_r5); ++i) {
611
+ object_property_add_link(obj, "cpu_r5[*]", TYPE_ARM_CPU,
612
+ (Object **)&s->cfg.cpu_r5[i],
613
+ qdev_prop_allow_set_link_before_realize,
614
+ OBJ_PROP_LINK_STRONG);
615
+ }
616
+
617
+ for (i = 0; i < ARRAY_SIZE(s->cfg.adma); ++i) {
618
+ object_property_add_link(obj, "adma[*]", TYPE_DEVICE,
619
+ (Object **)&s->cfg.adma[i],
620
+ qdev_prop_allow_set_link_before_realize,
621
+ OBJ_PROP_LINK_STRONG);
622
+ }
623
+
624
+ for (i = 0; i < ARRAY_SIZE(s->cfg.uart); ++i) {
625
+ object_property_add_link(obj, "uart[*]", TYPE_DEVICE,
626
+ (Object **)&s->cfg.uart[i],
627
+ qdev_prop_allow_set_link_before_realize,
628
+ OBJ_PROP_LINK_STRONG);
629
+ }
630
+
631
+ for (i = 0; i < ARRAY_SIZE(s->cfg.gem); ++i) {
632
+ object_property_add_link(obj, "gem[*]", TYPE_DEVICE,
633
+ (Object **)&s->cfg.gem[i],
634
+ qdev_prop_allow_set_link_before_realize,
635
+ OBJ_PROP_LINK_STRONG);
636
+ }
637
+
638
+ object_property_add_link(obj, "usb", TYPE_DEVICE,
639
+ (Object **)&s->cfg.gem[i],
640
+ qdev_prop_allow_set_link_before_realize,
641
+ OBJ_PROP_LINK_STRONG);
642
+}
643
+
644
+static void crl_finalize(Object *obj)
645
+{
646
+ XlnxVersalCRL *s = XLNX_VERSAL_CRL(obj);
647
+ register_finalize_block(s->reg_array);
648
+}
649
+
650
+static const VMStateDescription vmstate_crl = {
651
+ .name = TYPE_XLNX_VERSAL_CRL,
652
+ .version_id = 1,
653
+ .minimum_version_id = 1,
654
+ .fields = (VMStateField[]) {
655
+ VMSTATE_UINT32_ARRAY(regs, XlnxVersalCRL, CRL_R_MAX),
656
+ VMSTATE_END_OF_LIST(),
657
+ }
658
+};
659
+
660
+static void crl_class_init(ObjectClass *klass, void *data)
661
+{
662
+ ResettableClass *rc = RESETTABLE_CLASS(klass);
663
+ DeviceClass *dc = DEVICE_CLASS(klass);
664
+
665
+ dc->vmsd = &vmstate_crl;
666
+
667
+ rc->phases.enter = crl_reset_enter;
668
+ rc->phases.hold = crl_reset_hold;
669
+}
670
+
671
+static const TypeInfo crl_info = {
672
+ .name = TYPE_XLNX_VERSAL_CRL,
673
+ .parent = TYPE_SYS_BUS_DEVICE,
674
+ .instance_size = sizeof(XlnxVersalCRL),
675
+ .class_init = crl_class_init,
676
+ .instance_init = crl_init,
677
+ .instance_finalize = crl_finalize,
678
+};
679
+
680
+static void crl_register_types(void)
681
+{
682
+ type_register_static(&crl_info);
683
+}
684
+
685
+type_init(crl_register_types)
686
diff --git a/hw/misc/meson.build b/hw/misc/meson.build
687
index XXXXXXX..XXXXXXX 100644
688
--- a/hw/misc/meson.build
689
+++ b/hw/misc/meson.build
690
@@ -XXX,XX +XXX,XX @@ softmmu_ss.add(when: 'CONFIG_SLAVIO', if_true: files('slavio_misc.c'))
691
softmmu_ss.add(when: 'CONFIG_ZYNQ', if_true: files('zynq_slcr.c'))
692
specific_ss.add(when: 'CONFIG_XLNX_ZYNQMP_ARM', if_true: files('xlnx-zynqmp-crf.c'))
693
specific_ss.add(when: 'CONFIG_XLNX_ZYNQMP_ARM', if_true: files('xlnx-zynqmp-apu-ctrl.c'))
694
+specific_ss.add(when: 'CONFIG_XLNX_VERSAL', if_true: files('xlnx-versal-crl.c'))
695
softmmu_ss.add(when: 'CONFIG_XLNX_VERSAL', if_true: files(
696
'xlnx-versal-xramc.c',
697
'xlnx-versal-pmc-iou-slcr.c',
77
--
698
--
78
2.20.1
699
2.25.1
79
80
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
From: "Edgar E. Iglesias" <edgar.iglesias@amd.com>
2
2
3
The 8-byte store for the end a !is_q operation can be
3
Connect the CRL (Clock Reset LPD) to the Versal SoC.
4
merged with the other stores. Use a no-op vector move
5
to trigger the expand_clr portion of tcg_gen_gvec_mov.
6
4
7
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
5
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@amd.com>
8
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
6
Reviewed-by: Frederic Konrad <fkonrad@amd.com>
9
Message-id: 20200519212453.28494-2-richard.henderson@linaro.org
7
Reviewed-by: Francisco Iglesias <francisco.iglesias@amd.com>
8
Message-id: 20220406174303.2022038-5-edgar.iglesias@xilinx.com
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
---
10
---
12
target/arm/translate-a64.c | 10 ++--------
11
include/hw/arm/xlnx-versal.h | 4 +++
13
1 file changed, 2 insertions(+), 8 deletions(-)
12
hw/arm/xlnx-versal.c | 54 ++++++++++++++++++++++++++++++++++--
13
2 files changed, 56 insertions(+), 2 deletions(-)
14
14
15
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
15
diff --git a/include/hw/arm/xlnx-versal.h b/include/hw/arm/xlnx-versal.h
16
index XXXXXXX..XXXXXXX 100644
16
index XXXXXXX..XXXXXXX 100644
17
--- a/target/arm/translate-a64.c
17
--- a/include/hw/arm/xlnx-versal.h
18
+++ b/target/arm/translate-a64.c
18
+++ b/include/hw/arm/xlnx-versal.h
19
@@ -XXX,XX +XXX,XX @@ static void clear_vec_high(DisasContext *s, bool is_q, int rd)
19
@@ -XXX,XX +XXX,XX @@
20
unsigned ofs = fp_reg_offset(s, rd, MO_64);
20
#include "hw/nvram/xlnx-versal-efuse.h"
21
unsigned vsz = vec_full_reg_size(s);
21
#include "hw/ssi/xlnx-versal-ospi.h"
22
22
#include "hw/dma/xlnx_csu_dma.h"
23
- if (!is_q) {
23
+#include "hw/misc/xlnx-versal-crl.h"
24
- TCGv_i64 tcg_zero = tcg_const_i64(0);
24
#include "hw/misc/xlnx-versal-pmc-iou-slcr.h"
25
- tcg_gen_st_i64(tcg_zero, cpu_env, ofs + 8);
25
26
- tcg_temp_free_i64(tcg_zero);
26
#define TYPE_XLNX_VERSAL "xlnx-versal"
27
- }
27
@@ -XXX,XX +XXX,XX @@ struct Versal {
28
- if (vsz > 16) {
28
qemu_or_irq irq_orgate;
29
- tcg_gen_gvec_dup_imm(MO_64, ofs + 16, vsz - 16, vsz - 16, 0);
29
XlnxXramCtrl ctrl[XLNX_VERSAL_NR_XRAM];
30
- }
30
} xram;
31
+ /* Nop move, with side effect of clearing the tail. */
31
+
32
+ tcg_gen_gvec_mov(MO_64, ofs, ofs, is_q ? 16 : 8, vsz);
32
+ XlnxVersalCRL crl;
33
} lpd;
34
35
/* The Platform Management Controller subsystem. */
36
@@ -XXX,XX +XXX,XX @@ struct Versal {
37
#define VERSAL_TIMER_NS_EL1_IRQ 14
38
#define VERSAL_TIMER_NS_EL2_IRQ 10
39
40
+#define VERSAL_CRL_IRQ 10
41
#define VERSAL_UART0_IRQ_0 18
42
#define VERSAL_UART1_IRQ_0 19
43
#define VERSAL_USB0_IRQ_0 22
44
diff --git a/hw/arm/xlnx-versal.c b/hw/arm/xlnx-versal.c
45
index XXXXXXX..XXXXXXX 100644
46
--- a/hw/arm/xlnx-versal.c
47
+++ b/hw/arm/xlnx-versal.c
48
@@ -XXX,XX +XXX,XX @@ static void versal_create_ospi(Versal *s, qemu_irq *pic)
49
qdev_connect_gpio_out(orgate, 0, pic[VERSAL_OSPI_IRQ]);
33
}
50
}
34
51
35
void write_fp_dreg(DisasContext *s, int reg, TCGv_i64 v)
52
+static void versal_create_crl(Versal *s, qemu_irq *pic)
53
+{
54
+ SysBusDevice *sbd;
55
+ int i;
56
+
57
+ object_initialize_child(OBJECT(s), "crl", &s->lpd.crl,
58
+ TYPE_XLNX_VERSAL_CRL);
59
+ sbd = SYS_BUS_DEVICE(&s->lpd.crl);
60
+
61
+ for (i = 0; i < ARRAY_SIZE(s->lpd.rpu.cpu); i++) {
62
+ g_autofree gchar *name = g_strdup_printf("cpu_r5[%d]", i);
63
+
64
+ object_property_set_link(OBJECT(&s->lpd.crl),
65
+ name, OBJECT(&s->lpd.rpu.cpu[i]),
66
+ &error_abort);
67
+ }
68
+
69
+ for (i = 0; i < ARRAY_SIZE(s->lpd.iou.gem); i++) {
70
+ g_autofree gchar *name = g_strdup_printf("gem[%d]", i);
71
+
72
+ object_property_set_link(OBJECT(&s->lpd.crl),
73
+ name, OBJECT(&s->lpd.iou.gem[i]),
74
+ &error_abort);
75
+ }
76
+
77
+ for (i = 0; i < ARRAY_SIZE(s->lpd.iou.adma); i++) {
78
+ g_autofree gchar *name = g_strdup_printf("adma[%d]", i);
79
+
80
+ object_property_set_link(OBJECT(&s->lpd.crl),
81
+ name, OBJECT(&s->lpd.iou.adma[i]),
82
+ &error_abort);
83
+ }
84
+
85
+ for (i = 0; i < ARRAY_SIZE(s->lpd.iou.uart); i++) {
86
+ g_autofree gchar *name = g_strdup_printf("uart[%d]", i);
87
+
88
+ object_property_set_link(OBJECT(&s->lpd.crl),
89
+ name, OBJECT(&s->lpd.iou.uart[i]),
90
+ &error_abort);
91
+ }
92
+
93
+ object_property_set_link(OBJECT(&s->lpd.crl),
94
+ "usb", OBJECT(&s->lpd.iou.usb),
95
+ &error_abort);
96
+
97
+ sysbus_realize(sbd, &error_fatal);
98
+ memory_region_add_subregion(&s->mr_ps, MM_CRL,
99
+ sysbus_mmio_get_region(sbd, 0));
100
+ sysbus_connect_irq(sbd, 0, pic[VERSAL_CRL_IRQ]);
101
+}
102
+
103
/* This takes the board allocated linear DDR memory and creates aliases
104
* for each split DDR range/aperture on the Versal address map.
105
*/
106
@@ -XXX,XX +XXX,XX @@ static void versal_unimp(Versal *s)
107
108
versal_unimp_area(s, "psm", &s->mr_ps,
109
MM_PSM_START, MM_PSM_END - MM_PSM_START);
110
- versal_unimp_area(s, "crl", &s->mr_ps,
111
- MM_CRL, MM_CRL_SIZE);
112
versal_unimp_area(s, "crf", &s->mr_ps,
113
MM_FPD_CRF, MM_FPD_CRF_SIZE);
114
versal_unimp_area(s, "apu", &s->mr_ps,
115
@@ -XXX,XX +XXX,XX @@ static void versal_realize(DeviceState *dev, Error **errp)
116
versal_create_efuse(s, pic);
117
versal_create_pmc_iou_slcr(s, pic);
118
versal_create_ospi(s, pic);
119
+ versal_create_crl(s, pic);
120
versal_map_ddr(s);
121
versal_unimp(s);
122
36
--
123
--
37
2.20.1
124
2.25.1
38
39
diff view generated by jsdifflib
1
From: Guenter Roeck <linux@roeck-us.net>
1
The Exynos4210 SoC device currently uses a custom device
2
"exynos4210.irq_gate" to model the OR gate that feeds each CPU's IRQ
3
line. We have a standard TYPE_OR_IRQ device for this now, so use
4
that instead.
2
5
3
With this commit, the watchdog on mcimx6ul-evk is fully operational,
6
(This is a migration compatibility break, but that is OK for this
4
including pretimeout support.
7
machine type.)
5
8
6
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
7
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
8
Message-id: 20200517162135.110364-7-linux@roeck-us.net
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
11
Message-id: 20220404154658.565020-2-peter.maydell@linaro.org
10
---
12
---
11
hw/arm/fsl-imx6ul.c | 10 ++++++++++
13
include/hw/arm/exynos4210.h | 1 +
12
1 file changed, 10 insertions(+)
14
hw/arm/exynos4210.c | 31 ++++++++++++++++---------------
15
2 files changed, 17 insertions(+), 15 deletions(-)
13
16
14
diff --git a/hw/arm/fsl-imx6ul.c b/hw/arm/fsl-imx6ul.c
17
diff --git a/include/hw/arm/exynos4210.h b/include/hw/arm/exynos4210.h
15
index XXXXXXX..XXXXXXX 100644
18
index XXXXXXX..XXXXXXX 100644
16
--- a/hw/arm/fsl-imx6ul.c
19
--- a/include/hw/arm/exynos4210.h
17
+++ b/hw/arm/fsl-imx6ul.c
20
+++ b/include/hw/arm/exynos4210.h
18
@@ -XXX,XX +XXX,XX @@ static void fsl_imx6ul_realize(DeviceState *dev, Error **errp)
21
@@ -XXX,XX +XXX,XX @@ struct Exynos4210State {
19
FSL_IMX6UL_WDOG2_ADDR,
22
MemoryRegion bootreg_mem;
20
FSL_IMX6UL_WDOG3_ADDR,
23
I2CBus *i2c_if[EXYNOS4210_I2C_NUMBER];
21
};
24
qemu_or_irq pl330_irq_orgate[EXYNOS4210_NUM_DMA];
22
+ static const int FSL_IMX6UL_WDOGn_IRQ[FSL_IMX6UL_NUM_WDTS] = {
25
+ qemu_or_irq cpu_irq_orgate[EXYNOS4210_NCPUS];
23
+ FSL_IMX6UL_WDOG1_IRQ,
26
};
24
+ FSL_IMX6UL_WDOG2_IRQ,
27
25
+ FSL_IMX6UL_WDOG3_IRQ,
28
#define TYPE_EXYNOS4210_SOC "exynos4210"
26
+ };
29
diff --git a/hw/arm/exynos4210.c b/hw/arm/exynos4210.c
27
30
index XXXXXXX..XXXXXXX 100644
28
+ object_property_set_bool(OBJECT(&s->wdt[i]), true, "pretimeout-support",
31
--- a/hw/arm/exynos4210.c
29
+ &error_abort);
32
+++ b/hw/arm/exynos4210.c
30
object_property_set_bool(OBJECT(&s->wdt[i]), true, "realized",
33
@@ -XXX,XX +XXX,XX @@ static void exynos4210_realize(DeviceState *socdev, Error **errp)
31
&error_abort);
34
{
32
35
Exynos4210State *s = EXYNOS4210_SOC(socdev);
33
sysbus_mmio_map(SYS_BUS_DEVICE(&s->wdt[i]), 0,
36
MemoryRegion *system_mem = get_system_memory();
34
FSL_IMX6UL_WDOGn_ADDR[i]);
37
- qemu_irq gate_irq[EXYNOS4210_NCPUS][EXYNOS4210_IRQ_GATE_NINPUTS];
35
+ sysbus_connect_irq(SYS_BUS_DEVICE(&s->wdt[i]), 0,
38
SysBusDevice *busdev;
36
+ qdev_get_gpio_in(DEVICE(&s->a7mpcore),
39
DeviceState *dev, *uart[4], *pl330[3];
37
+ FSL_IMX6UL_WDOGn_IRQ[i]));
40
int i, n;
41
@@ -XXX,XX +XXX,XX @@ static void exynos4210_realize(DeviceState *socdev, Error **errp)
42
43
/* IRQ Gate */
44
for (i = 0; i < EXYNOS4210_NCPUS; i++) {
45
- dev = qdev_new("exynos4210.irq_gate");
46
- qdev_prop_set_uint32(dev, "n_in", EXYNOS4210_IRQ_GATE_NINPUTS);
47
- sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
48
- /* Get IRQ Gate input in gate_irq */
49
- for (n = 0; n < EXYNOS4210_IRQ_GATE_NINPUTS; n++) {
50
- gate_irq[i][n] = qdev_get_gpio_in(dev, n);
51
- }
52
- busdev = SYS_BUS_DEVICE(dev);
53
-
54
- /* Connect IRQ Gate output to CPU's IRQ line */
55
- sysbus_connect_irq(busdev, 0,
56
- qdev_get_gpio_in(DEVICE(s->cpu[i]), ARM_CPU_IRQ));
57
+ DeviceState *orgate = DEVICE(&s->cpu_irq_orgate[i]);
58
+ object_property_set_int(OBJECT(orgate), "num-lines",
59
+ EXYNOS4210_IRQ_GATE_NINPUTS,
60
+ &error_abort);
61
+ qdev_realize(orgate, NULL, &error_abort);
62
+ qdev_connect_gpio_out(orgate, 0,
63
+ qdev_get_gpio_in(DEVICE(s->cpu[i]), ARM_CPU_IRQ));
38
}
64
}
39
65
40
/*
66
/* Private memory region and Internal GIC */
67
@@ -XXX,XX +XXX,XX @@ static void exynos4210_realize(DeviceState *socdev, Error **errp)
68
sysbus_realize_and_unref(busdev, &error_fatal);
69
sysbus_mmio_map(busdev, 0, EXYNOS4210_SMP_PRIVATE_BASE_ADDR);
70
for (n = 0; n < EXYNOS4210_NCPUS; n++) {
71
- sysbus_connect_irq(busdev, n, gate_irq[n][0]);
72
+ sysbus_connect_irq(busdev, n,
73
+ qdev_get_gpio_in(DEVICE(&s->cpu_irq_orgate[n]), 0));
74
}
75
for (n = 0; n < EXYNOS4210_INT_GIC_NIRQ; n++) {
76
s->irqs.int_gic_irq[n] = qdev_get_gpio_in(dev, n);
77
@@ -XXX,XX +XXX,XX @@ static void exynos4210_realize(DeviceState *socdev, Error **errp)
78
/* Map Distributer interface */
79
sysbus_mmio_map(busdev, 1, EXYNOS4210_EXT_GIC_DIST_BASE_ADDR);
80
for (n = 0; n < EXYNOS4210_NCPUS; n++) {
81
- sysbus_connect_irq(busdev, n, gate_irq[n][1]);
82
+ sysbus_connect_irq(busdev, n,
83
+ qdev_get_gpio_in(DEVICE(&s->cpu_irq_orgate[n]), 1));
84
}
85
for (n = 0; n < EXYNOS4210_EXT_GIC_NIRQ; n++) {
86
s->irqs.ext_gic_irq[n] = qdev_get_gpio_in(dev, n);
87
@@ -XXX,XX +XXX,XX @@ static void exynos4210_init(Object *obj)
88
object_initialize_child(obj, name, orgate, TYPE_OR_IRQ);
89
g_free(name);
90
}
91
+
92
+ for (i = 0; i < ARRAY_SIZE(s->cpu_irq_orgate); i++) {
93
+ g_autofree char *name = g_strdup_printf("cpu-irq-orgate%d", i);
94
+ object_initialize_child(obj, name, &s->cpu_irq_orgate[i], TYPE_OR_IRQ);
95
+ }
96
}
97
98
static void exynos4210_class_init(ObjectClass *klass, void *data)
41
--
99
--
42
2.20.1
100
2.25.1
43
44
diff view generated by jsdifflib
New patch
1
Now we have removed the only use of TYPE_EXYNOS4210_IRQ_GATE we can
2
delete the device entirely.
1
3
4
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5
Reviewed-by: Francisco Iglesias <frasse.iglesias@gmail.com>
6
Message-id: 20220404154658.565020-3-peter.maydell@linaro.org
7
---
8
hw/intc/exynos4210_gic.c | 107 ---------------------------------------
9
1 file changed, 107 deletions(-)
10
11
diff --git a/hw/intc/exynos4210_gic.c b/hw/intc/exynos4210_gic.c
12
index XXXXXXX..XXXXXXX 100644
13
--- a/hw/intc/exynos4210_gic.c
14
+++ b/hw/intc/exynos4210_gic.c
15
@@ -XXX,XX +XXX,XX @@ static void exynos4210_gic_register_types(void)
16
}
17
18
type_init(exynos4210_gic_register_types)
19
-
20
-/* IRQ OR Gate struct.
21
- *
22
- * This device models an OR gate. There are n_in input qdev gpio lines and one
23
- * output sysbus IRQ line. The output IRQ level is formed as OR between all
24
- * gpio inputs.
25
- */
26
-
27
-#define TYPE_EXYNOS4210_IRQ_GATE "exynos4210.irq_gate"
28
-OBJECT_DECLARE_SIMPLE_TYPE(Exynos4210IRQGateState, EXYNOS4210_IRQ_GATE)
29
-
30
-struct Exynos4210IRQGateState {
31
- SysBusDevice parent_obj;
32
-
33
- uint32_t n_in; /* inputs amount */
34
- uint32_t *level; /* input levels */
35
- qemu_irq out; /* output IRQ */
36
-};
37
-
38
-static Property exynos4210_irq_gate_properties[] = {
39
- DEFINE_PROP_UINT32("n_in", Exynos4210IRQGateState, n_in, 1),
40
- DEFINE_PROP_END_OF_LIST(),
41
-};
42
-
43
-static const VMStateDescription vmstate_exynos4210_irq_gate = {
44
- .name = "exynos4210.irq_gate",
45
- .version_id = 2,
46
- .minimum_version_id = 2,
47
- .fields = (VMStateField[]) {
48
- VMSTATE_VBUFFER_UINT32(level, Exynos4210IRQGateState, 1, NULL, n_in),
49
- VMSTATE_END_OF_LIST()
50
- }
51
-};
52
-
53
-/* Process a change in IRQ input. */
54
-static void exynos4210_irq_gate_handler(void *opaque, int irq, int level)
55
-{
56
- Exynos4210IRQGateState *s = (Exynos4210IRQGateState *)opaque;
57
- uint32_t i;
58
-
59
- assert(irq < s->n_in);
60
-
61
- s->level[irq] = level;
62
-
63
- for (i = 0; i < s->n_in; i++) {
64
- if (s->level[i] >= 1) {
65
- qemu_irq_raise(s->out);
66
- return;
67
- }
68
- }
69
-
70
- qemu_irq_lower(s->out);
71
-}
72
-
73
-static void exynos4210_irq_gate_reset(DeviceState *d)
74
-{
75
- Exynos4210IRQGateState *s = EXYNOS4210_IRQ_GATE(d);
76
-
77
- memset(s->level, 0, s->n_in * sizeof(*s->level));
78
-}
79
-
80
-/*
81
- * IRQ Gate initialization.
82
- */
83
-static void exynos4210_irq_gate_init(Object *obj)
84
-{
85
- Exynos4210IRQGateState *s = EXYNOS4210_IRQ_GATE(obj);
86
- SysBusDevice *sbd = SYS_BUS_DEVICE(obj);
87
-
88
- sysbus_init_irq(sbd, &s->out);
89
-}
90
-
91
-static void exynos4210_irq_gate_realize(DeviceState *dev, Error **errp)
92
-{
93
- Exynos4210IRQGateState *s = EXYNOS4210_IRQ_GATE(dev);
94
-
95
- /* Allocate general purpose input signals and connect a handler to each of
96
- * them */
97
- qdev_init_gpio_in(dev, exynos4210_irq_gate_handler, s->n_in);
98
-
99
- s->level = g_malloc0(s->n_in * sizeof(*s->level));
100
-}
101
-
102
-static void exynos4210_irq_gate_class_init(ObjectClass *klass, void *data)
103
-{
104
- DeviceClass *dc = DEVICE_CLASS(klass);
105
-
106
- dc->reset = exynos4210_irq_gate_reset;
107
- dc->vmsd = &vmstate_exynos4210_irq_gate;
108
- device_class_set_props(dc, exynos4210_irq_gate_properties);
109
- dc->realize = exynos4210_irq_gate_realize;
110
-}
111
-
112
-static const TypeInfo exynos4210_irq_gate_info = {
113
- .name = TYPE_EXYNOS4210_IRQ_GATE,
114
- .parent = TYPE_SYS_BUS_DEVICE,
115
- .instance_size = sizeof(Exynos4210IRQGateState),
116
- .instance_init = exynos4210_irq_gate_init,
117
- .class_init = exynos4210_irq_gate_class_init,
118
-};
119
-
120
-static void exynos4210_irq_gate_register_types(void)
121
-{
122
- type_register_static(&exynos4210_irq_gate_info);
123
-}
124
-
125
-type_init(exynos4210_irq_gate_register_types)
126
--
127
2.25.1
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
The exynos4210 SoC mostly creates its child devices as if it were
2
board code. This includes the a9mpcore object. Switch that to a
3
new-style "embedded in the state struct" creation, because in the
4
next commit we're going to want to refer to the object again further
5
down in the exynos4210_realize() function.
2
6
3
Do not explicitly store zero to the NEON high part
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4
when we can pass !is_q to clear_vec_high.
8
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
9
Message-id: 20220404154658.565020-4-peter.maydell@linaro.org
10
---
11
include/hw/arm/exynos4210.h | 2 ++
12
hw/arm/exynos4210.c | 11 ++++++-----
13
2 files changed, 8 insertions(+), 5 deletions(-)
5
14
6
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
15
diff --git a/include/hw/arm/exynos4210.h b/include/hw/arm/exynos4210.h
7
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8
Message-id: 20200519212453.28494-3-richard.henderson@linaro.org
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
---
11
target/arm/translate-a64.c | 53 +++++++++++++++++++++++---------------
12
1 file changed, 32 insertions(+), 21 deletions(-)
13
14
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
15
index XXXXXXX..XXXXXXX 100644
16
index XXXXXXX..XXXXXXX 100644
16
--- a/target/arm/translate-a64.c
17
--- a/include/hw/arm/exynos4210.h
17
+++ b/target/arm/translate-a64.c
18
+++ b/include/hw/arm/exynos4210.h
18
@@ -XXX,XX +XXX,XX @@ static void do_fp_ld(DisasContext *s, int destidx, TCGv_i64 tcg_addr, int size)
19
@@ -XXX,XX +XXX,XX @@
19
{
20
20
/* This always zero-extends and writes to a full 128 bit wide vector */
21
#include "hw/or-irq.h"
21
TCGv_i64 tmplo = tcg_temp_new_i64();
22
#include "hw/sysbus.h"
22
- TCGv_i64 tmphi;
23
+#include "hw/cpu/a9mpcore.h"
23
+ TCGv_i64 tmphi = NULL;
24
#include "target/arm/cpu-qom.h"
24
25
#include "qom/object.h"
25
if (size < 4) {
26
26
MemOp memop = s->be_data + size;
27
@@ -XXX,XX +XXX,XX @@ struct Exynos4210State {
27
- tmphi = tcg_const_i64(0);
28
I2CBus *i2c_if[EXYNOS4210_I2C_NUMBER];
28
tcg_gen_qemu_ld_i64(tmplo, tcg_addr, get_mem_index(s), memop);
29
qemu_or_irq pl330_irq_orgate[EXYNOS4210_NUM_DMA];
29
} else {
30
qemu_or_irq cpu_irq_orgate[EXYNOS4210_NCPUS];
30
bool be = s->be_data == MO_BE;
31
+ A9MPPrivState a9mpcore;
31
@@ -XXX,XX +XXX,XX @@ static void do_fp_ld(DisasContext *s, int destidx, TCGv_i64 tcg_addr, int size)
32
};
33
34
#define TYPE_EXYNOS4210_SOC "exynos4210"
35
diff --git a/hw/arm/exynos4210.c b/hw/arm/exynos4210.c
36
index XXXXXXX..XXXXXXX 100644
37
--- a/hw/arm/exynos4210.c
38
+++ b/hw/arm/exynos4210.c
39
@@ -XXX,XX +XXX,XX @@ static void exynos4210_realize(DeviceState *socdev, Error **errp)
32
}
40
}
33
41
34
tcg_gen_st_i64(tmplo, cpu_env, fp_reg_offset(s, destidx, MO_64));
42
/* Private memory region and Internal GIC */
35
- tcg_gen_st_i64(tmphi, cpu_env, fp_reg_hi_offset(s, destidx));
43
- dev = qdev_new(TYPE_A9MPCORE_PRIV);
36
-
44
- qdev_prop_set_uint32(dev, "num-cpu", EXYNOS4210_NCPUS);
37
tcg_temp_free_i64(tmplo);
45
- busdev = SYS_BUS_DEVICE(dev);
38
- tcg_temp_free_i64(tmphi);
46
- sysbus_realize_and_unref(busdev, &error_fatal);
39
47
+ qdev_prop_set_uint32(DEVICE(&s->a9mpcore), "num-cpu", EXYNOS4210_NCPUS);
40
- clear_vec_high(s, true, destidx);
48
+ busdev = SYS_BUS_DEVICE(&s->a9mpcore);
41
+ if (tmphi) {
49
+ sysbus_realize(busdev, &error_fatal);
42
+ tcg_gen_st_i64(tmphi, cpu_env, fp_reg_hi_offset(s, destidx));
50
sysbus_mmio_map(busdev, 0, EXYNOS4210_SMP_PRIVATE_BASE_ADDR);
43
+ tcg_temp_free_i64(tmphi);
51
for (n = 0; n < EXYNOS4210_NCPUS; n++) {
44
+ }
52
sysbus_connect_irq(busdev, n,
45
+ clear_vec_high(s, tmphi != NULL, destidx);
53
qdev_get_gpio_in(DEVICE(&s->cpu_irq_orgate[n]), 0));
54
}
55
for (n = 0; n < EXYNOS4210_INT_GIC_NIRQ; n++) {
56
- s->irqs.int_gic_irq[n] = qdev_get_gpio_in(dev, n);
57
+ s->irqs.int_gic_irq[n] = qdev_get_gpio_in(DEVICE(&s->a9mpcore), n);
58
}
59
60
/* Cache controller */
61
@@ -XXX,XX +XXX,XX @@ static void exynos4210_init(Object *obj)
62
g_autofree char *name = g_strdup_printf("cpu-irq-orgate%d", i);
63
object_initialize_child(obj, name, &s->cpu_irq_orgate[i], TYPE_OR_IRQ);
64
}
65
+
66
+ object_initialize_child(obj, "a9mpcore", &s->a9mpcore, TYPE_A9MPCORE_PRIV);
46
}
67
}
47
68
48
/*
69
static void exynos4210_class_init(ObjectClass *klass, void *data)
49
@@ -XXX,XX +XXX,XX @@ static void disas_simd_ext(DisasContext *s, uint32_t insn)
50
read_vec_element(s, tcg_resh, rm, 0, MO_64);
51
do_ext64(s, tcg_resh, tcg_resl, pos);
52
}
53
- tcg_gen_movi_i64(tcg_resh, 0);
54
} else {
55
TCGv_i64 tcg_hh;
56
typedef struct {
57
@@ -XXX,XX +XXX,XX @@ static void disas_simd_ext(DisasContext *s, uint32_t insn)
58
59
write_vec_element(s, tcg_resl, rd, 0, MO_64);
60
tcg_temp_free_i64(tcg_resl);
61
- write_vec_element(s, tcg_resh, rd, 1, MO_64);
62
+ if (is_q) {
63
+ write_vec_element(s, tcg_resh, rd, 1, MO_64);
64
+ }
65
tcg_temp_free_i64(tcg_resh);
66
- clear_vec_high(s, true, rd);
67
+ clear_vec_high(s, is_q, rd);
68
}
69
70
/* TBL/TBX
71
@@ -XXX,XX +XXX,XX @@ static void disas_simd_tb(DisasContext *s, uint32_t insn)
72
* the input.
73
*/
74
tcg_resl = tcg_temp_new_i64();
75
- tcg_resh = tcg_temp_new_i64();
76
+ tcg_resh = NULL;
77
78
if (is_tblx) {
79
read_vec_element(s, tcg_resl, rd, 0, MO_64);
80
} else {
81
tcg_gen_movi_i64(tcg_resl, 0);
82
}
83
- if (is_tblx && is_q) {
84
- read_vec_element(s, tcg_resh, rd, 1, MO_64);
85
- } else {
86
- tcg_gen_movi_i64(tcg_resh, 0);
87
+
88
+ if (is_q) {
89
+ tcg_resh = tcg_temp_new_i64();
90
+ if (is_tblx) {
91
+ read_vec_element(s, tcg_resh, rd, 1, MO_64);
92
+ } else {
93
+ tcg_gen_movi_i64(tcg_resh, 0);
94
+ }
95
}
96
97
tcg_idx = tcg_temp_new_i64();
98
@@ -XXX,XX +XXX,XX @@ static void disas_simd_tb(DisasContext *s, uint32_t insn)
99
100
write_vec_element(s, tcg_resl, rd, 0, MO_64);
101
tcg_temp_free_i64(tcg_resl);
102
- write_vec_element(s, tcg_resh, rd, 1, MO_64);
103
- tcg_temp_free_i64(tcg_resh);
104
- clear_vec_high(s, true, rd);
105
+
106
+ if (is_q) {
107
+ write_vec_element(s, tcg_resh, rd, 1, MO_64);
108
+ tcg_temp_free_i64(tcg_resh);
109
+ }
110
+ clear_vec_high(s, is_q, rd);
111
}
112
113
/* ZIP/UZP/TRN
114
@@ -XXX,XX +XXX,XX @@ static void disas_simd_zip_trn(DisasContext *s, uint32_t insn)
115
}
116
117
tcg_resl = tcg_const_i64(0);
118
- tcg_resh = tcg_const_i64(0);
119
+ tcg_resh = is_q ? tcg_const_i64(0) : NULL;
120
tcg_res = tcg_temp_new_i64();
121
122
for (i = 0; i < elements; i++) {
123
@@ -XXX,XX +XXX,XX @@ static void disas_simd_zip_trn(DisasContext *s, uint32_t insn)
124
125
write_vec_element(s, tcg_resl, rd, 0, MO_64);
126
tcg_temp_free_i64(tcg_resl);
127
- write_vec_element(s, tcg_resh, rd, 1, MO_64);
128
- tcg_temp_free_i64(tcg_resh);
129
- clear_vec_high(s, true, rd);
130
+
131
+ if (is_q) {
132
+ write_vec_element(s, tcg_resh, rd, 1, MO_64);
133
+ tcg_temp_free_i64(tcg_resh);
134
+ }
135
+ clear_vec_high(s, is_q, rd);
136
}
137
138
/*
139
--
70
--
140
2.20.1
71
2.25.1
141
142
diff view generated by jsdifflib
1
Using the MSR instruction to write to CPSR.E is deprecated, but it is
1
The only time we use the int_gic_irq[] array in the Exynos4210Irq
2
required to work from any mode including unprivileged code. We were
2
struct is in the exynos4210_realize() function: we initialize it with
3
incorrectly forbidding usermode code from writing it because
3
the GPIO inputs of the a9mpcore device, and then a bit later on we
4
CPSR_USER did not include the CPSR_E bit.
4
connect those to the outputs of the internal combiner. Now that the
5
5
a9mpcore object is easily accessible as s->a9mpcore we can make the
6
We use CPSR_USER in only three places:
6
connection directly from one device to the other without going via
7
* as the mask of what to allow userspace MSR to write to CPSR
7
this array.
8
* when deciding what bits a linux-user signal-return should be
9
able to write from the sigcontext structure
10
* in target_user_copy_regs() when we set up the initial
11
registers for the linux-user process
12
13
In the first two cases not being able to update CPSR.E is a bug, and
14
in the third case it doesn't matter because CPSR.E is always 0 there.
15
So we can fix both bugs by adding CPSR_E to CPSR_USER.
16
17
Because the cpsr_write() in restore_sigcontext() is now changing
18
a CPSR bit which is cached in hflags, we need to add an
19
arm_rebuild_hflags() call there; the callsite in
20
target_user_copy_regs() was already rebuilding hflags for other
21
reasons.
22
23
(The recommended way to change CPSR.E is to use the 'SETEND'
24
instruction, which we do correctly allow from usermode code.)
25
8
26
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
27
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
10
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
28
Message-id: 20200518142801.20503-1-peter.maydell@linaro.org
11
Message-id: 20220404154658.565020-5-peter.maydell@linaro.org
29
---
12
---
30
target/arm/cpu.h | 2 +-
13
include/hw/arm/exynos4210.h | 1 -
31
linux-user/arm/signal.c | 1 +
14
hw/arm/exynos4210.c | 6 ++----
32
2 files changed, 2 insertions(+), 1 deletion(-)
15
2 files changed, 2 insertions(+), 5 deletions(-)
33
16
34
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
17
diff --git a/include/hw/arm/exynos4210.h b/include/hw/arm/exynos4210.h
35
index XXXXXXX..XXXXXXX 100644
18
index XXXXXXX..XXXXXXX 100644
36
--- a/target/arm/cpu.h
19
--- a/include/hw/arm/exynos4210.h
37
+++ b/target/arm/cpu.h
20
+++ b/include/hw/arm/exynos4210.h
38
@@ -XXX,XX +XXX,XX @@ void pmu_init(ARMCPU *cpu);
21
@@ -XXX,XX +XXX,XX @@
39
#define CACHED_CPSR_BITS (CPSR_T | CPSR_AIF | CPSR_GE | CPSR_IT | CPSR_Q \
22
typedef struct Exynos4210Irq {
40
| CPSR_NZCV)
23
qemu_irq int_combiner_irq[EXYNOS4210_MAX_INT_COMBINER_IN_IRQ];
41
/* Bits writable in user mode. */
24
qemu_irq ext_combiner_irq[EXYNOS4210_MAX_EXT_COMBINER_IN_IRQ];
42
-#define CPSR_USER (CPSR_NZCV | CPSR_Q | CPSR_GE)
25
- qemu_irq int_gic_irq[EXYNOS4210_INT_GIC_NIRQ];
43
+#define CPSR_USER (CPSR_NZCV | CPSR_Q | CPSR_GE | CPSR_E)
26
qemu_irq ext_gic_irq[EXYNOS4210_EXT_GIC_NIRQ];
44
/* Execution state bits. MRS read as zero, MSR writes ignored. */
27
qemu_irq board_irqs[EXYNOS4210_MAX_INT_COMBINER_IN_IRQ];
45
#define CPSR_EXEC (CPSR_T | CPSR_IT | CPSR_J | CPSR_IL)
28
} Exynos4210Irq;
46
29
diff --git a/hw/arm/exynos4210.c b/hw/arm/exynos4210.c
47
diff --git a/linux-user/arm/signal.c b/linux-user/arm/signal.c
48
index XXXXXXX..XXXXXXX 100644
30
index XXXXXXX..XXXXXXX 100644
49
--- a/linux-user/arm/signal.c
31
--- a/hw/arm/exynos4210.c
50
+++ b/linux-user/arm/signal.c
32
+++ b/hw/arm/exynos4210.c
51
@@ -XXX,XX +XXX,XX @@ restore_sigcontext(CPUARMState *env, struct target_sigcontext *sc)
33
@@ -XXX,XX +XXX,XX @@ static void exynos4210_realize(DeviceState *socdev, Error **errp)
52
#ifdef TARGET_CONFIG_CPU_32
34
sysbus_connect_irq(busdev, n,
53
__get_user(cpsr, &sc->arm_cpsr);
35
qdev_get_gpio_in(DEVICE(&s->cpu_irq_orgate[n]), 0));
54
cpsr_write(env, cpsr, CPSR_USER | CPSR_EXEC, CPSRWriteByInstr);
36
}
55
+ arm_rebuild_hflags(env);
37
- for (n = 0; n < EXYNOS4210_INT_GIC_NIRQ; n++) {
56
#endif
38
- s->irqs.int_gic_irq[n] = qdev_get_gpio_in(DEVICE(&s->a9mpcore), n);
57
39
- }
58
err |= !valid_user_regs(env);
40
41
/* Cache controller */
42
sysbus_create_simple("l2x0", EXYNOS4210_L2X0_BASE_ADDR, NULL);
43
@@ -XXX,XX +XXX,XX @@ static void exynos4210_realize(DeviceState *socdev, Error **errp)
44
busdev = SYS_BUS_DEVICE(dev);
45
sysbus_realize_and_unref(busdev, &error_fatal);
46
for (n = 0; n < EXYNOS4210_MAX_INT_COMBINER_OUT_IRQ; n++) {
47
- sysbus_connect_irq(busdev, n, s->irqs.int_gic_irq[n]);
48
+ sysbus_connect_irq(busdev, n,
49
+ qdev_get_gpio_in(DEVICE(&s->a9mpcore), n));
50
}
51
exynos4210_combiner_get_gpioin(&s->irqs, dev, 0);
52
sysbus_mmio_map(busdev, 0, EXYNOS4210_INT_COMBINER_BASE_ADDR);
59
--
53
--
60
2.20.1
54
2.25.1
61
62
diff view generated by jsdifflib
1
From: Guenter Roeck <linux@roeck-us.net>
1
The exynos4210 code currently has two very similar arrays of IRQs:
2
2
3
With this patch applied, the watchdog in the sabrelite emulation
3
* board_irqs is a field of the Exynos4210Irq struct which is filled
4
is fully operational, including pretimeout support.
4
in by exynos4210_init_board_irqs() with the appropriate qemu_irqs
5
for each IRQ the board/SoC can assert
6
* irq_table is a set of qemu_irqs pointed to from the
7
Exynos4210State struct. It's allocated in exynos4210_init_irq,
8
and the only behaviour these irqs have is that they pass on the
9
level to the equivalent board_irqs[] irq
5
10
6
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
11
The extra indirection through irq_table is unnecessary, so coalesce
7
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
12
these into a single irq_table[] array as a direct field in
8
Message-id: 20200517162135.110364-6-linux@roeck-us.net
13
Exynos4210State which exynos4210_init_board_irqs() fills in.
14
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
15
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
16
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
17
Message-id: 20220404154658.565020-6-peter.maydell@linaro.org
10
---
18
---
11
hw/arm/fsl-imx6.c | 9 +++++++++
19
include/hw/arm/exynos4210.h | 8 ++------
12
1 file changed, 9 insertions(+)
20
hw/arm/exynos4210.c | 6 +-----
21
hw/intc/exynos4210_gic.c | 32 ++++++++------------------------
22
3 files changed, 11 insertions(+), 35 deletions(-)
13
23
14
diff --git a/hw/arm/fsl-imx6.c b/hw/arm/fsl-imx6.c
24
diff --git a/include/hw/arm/exynos4210.h b/include/hw/arm/exynos4210.h
15
index XXXXXXX..XXXXXXX 100644
25
index XXXXXXX..XXXXXXX 100644
16
--- a/hw/arm/fsl-imx6.c
26
--- a/include/hw/arm/exynos4210.h
17
+++ b/hw/arm/fsl-imx6.c
27
+++ b/include/hw/arm/exynos4210.h
18
@@ -XXX,XX +XXX,XX @@ static void fsl_imx6_realize(DeviceState *dev, Error **errp)
28
@@ -XXX,XX +XXX,XX @@ typedef struct Exynos4210Irq {
19
FSL_IMX6_WDOG1_ADDR,
29
qemu_irq int_combiner_irq[EXYNOS4210_MAX_INT_COMBINER_IN_IRQ];
20
FSL_IMX6_WDOG2_ADDR,
30
qemu_irq ext_combiner_irq[EXYNOS4210_MAX_EXT_COMBINER_IN_IRQ];
21
};
31
qemu_irq ext_gic_irq[EXYNOS4210_EXT_GIC_NIRQ];
22
+ static const int FSL_IMX6_WDOGn_IRQ[FSL_IMX6_NUM_WDTS] = {
32
- qemu_irq board_irqs[EXYNOS4210_MAX_INT_COMBINER_IN_IRQ];
23
+ FSL_IMX6_WDOG1_IRQ,
33
} Exynos4210Irq;
24
+ FSL_IMX6_WDOG2_IRQ,
34
25
+ };
35
struct Exynos4210State {
26
36
@@ -XXX,XX +XXX,XX @@ struct Exynos4210State {
27
+ object_property_set_bool(OBJECT(&s->wdt[i]), true, "pretimeout-support",
37
/*< public >*/
28
+ &error_abort);
38
ARMCPU *cpu[EXYNOS4210_NCPUS];
29
object_property_set_bool(OBJECT(&s->wdt[i]), true, "realized",
39
Exynos4210Irq irqs;
30
&error_abort);
40
- qemu_irq *irq_table;
31
41
+ qemu_irq irq_table[EXYNOS4210_MAX_INT_COMBINER_IN_IRQ];
32
sysbus_mmio_map(SYS_BUS_DEVICE(&s->wdt[i]), 0, FSL_IMX6_WDOGn_ADDR[i]);
42
33
+ sysbus_connect_irq(SYS_BUS_DEVICE(&s->wdt[i]), 0,
43
MemoryRegion chipid_mem;
34
+ qdev_get_gpio_in(DEVICE(&s->a9mpcore),
44
MemoryRegion iram_mem;
35
+ FSL_IMX6_WDOGn_IRQ[i]));
45
@@ -XXX,XX +XXX,XX @@ OBJECT_DECLARE_SIMPLE_TYPE(Exynos4210State, EXYNOS4210_SOC)
46
void exynos4210_write_secondary(ARMCPU *cpu,
47
const struct arm_boot_info *info);
48
49
-/* Initialize exynos4210 IRQ subsystem stub */
50
-qemu_irq *exynos4210_init_irq(Exynos4210Irq *env);
51
-
52
/* Initialize board IRQs.
53
* These IRQs contain splitted Int/External Combiner and External Gic IRQs */
54
-void exynos4210_init_board_irqs(Exynos4210Irq *s);
55
+void exynos4210_init_board_irqs(Exynos4210State *s);
56
57
/* Get IRQ number from exynos4210 IRQ subsystem stub.
58
* To identify IRQ source use internal combiner group and bit number
59
diff --git a/hw/arm/exynos4210.c b/hw/arm/exynos4210.c
60
index XXXXXXX..XXXXXXX 100644
61
--- a/hw/arm/exynos4210.c
62
+++ b/hw/arm/exynos4210.c
63
@@ -XXX,XX +XXX,XX @@ static void exynos4210_realize(DeviceState *socdev, Error **errp)
64
qdev_realize(DEVICE(cpuobj), NULL, &error_fatal);
36
}
65
}
37
66
38
/* ROM memory */
67
- /*** IRQs ***/
68
-
69
- s->irq_table = exynos4210_init_irq(&s->irqs);
70
-
71
/* IRQ Gate */
72
for (i = 0; i < EXYNOS4210_NCPUS; i++) {
73
DeviceState *orgate = DEVICE(&s->cpu_irq_orgate[i]);
74
@@ -XXX,XX +XXX,XX @@ static void exynos4210_realize(DeviceState *socdev, Error **errp)
75
sysbus_mmio_map(busdev, 0, EXYNOS4210_EXT_COMBINER_BASE_ADDR);
76
77
/* Initialize board IRQs. */
78
- exynos4210_init_board_irqs(&s->irqs);
79
+ exynos4210_init_board_irqs(s);
80
81
/*** Memory ***/
82
83
diff --git a/hw/intc/exynos4210_gic.c b/hw/intc/exynos4210_gic.c
84
index XXXXXXX..XXXXXXX 100644
85
--- a/hw/intc/exynos4210_gic.c
86
+++ b/hw/intc/exynos4210_gic.c
87
@@ -XXX,XX +XXX,XX @@ combiner_grp_to_gic_id[64-EXYNOS4210_MAX_EXT_COMBINER_OUT_IRQ][8] = {
88
#define EXYNOS4210_GIC_CPU_REGION_SIZE 0x100
89
#define EXYNOS4210_GIC_DIST_REGION_SIZE 0x1000
90
91
-static void exynos4210_irq_handler(void *opaque, int irq, int level)
92
-{
93
- Exynos4210Irq *s = (Exynos4210Irq *)opaque;
94
-
95
- /* Bypass */
96
- qemu_set_irq(s->board_irqs[irq], level);
97
-}
98
-
99
-/*
100
- * Initialize exynos4210 IRQ subsystem stub.
101
- */
102
-qemu_irq *exynos4210_init_irq(Exynos4210Irq *s)
103
-{
104
- return qemu_allocate_irqs(exynos4210_irq_handler, s,
105
- EXYNOS4210_MAX_INT_COMBINER_IN_IRQ);
106
-}
107
-
108
/*
109
* Initialize board IRQs.
110
* These IRQs contain splitted Int/External Combiner and External Gic IRQs.
111
*/
112
-void exynos4210_init_board_irqs(Exynos4210Irq *s)
113
+void exynos4210_init_board_irqs(Exynos4210State *s)
114
{
115
uint32_t grp, bit, irq_id, n;
116
+ Exynos4210Irq *is = &s->irqs;
117
118
for (n = 0; n < EXYNOS4210_MAX_EXT_COMBINER_IN_IRQ; n++) {
119
irq_id = 0;
120
@@ -XXX,XX +XXX,XX @@ void exynos4210_init_board_irqs(Exynos4210Irq *s)
121
irq_id = EXT_GIC_ID_MCT_G1;
122
}
123
if (irq_id) {
124
- s->board_irqs[n] = qemu_irq_split(s->int_combiner_irq[n],
125
- s->ext_gic_irq[irq_id-32]);
126
+ s->irq_table[n] = qemu_irq_split(is->int_combiner_irq[n],
127
+ is->ext_gic_irq[irq_id - 32]);
128
} else {
129
- s->board_irqs[n] = qemu_irq_split(s->int_combiner_irq[n],
130
- s->ext_combiner_irq[n]);
131
+ s->irq_table[n] = qemu_irq_split(is->int_combiner_irq[n],
132
+ is->ext_combiner_irq[n]);
133
}
134
}
135
for (; n < EXYNOS4210_MAX_INT_COMBINER_IN_IRQ; n++) {
136
@@ -XXX,XX +XXX,XX @@ void exynos4210_init_board_irqs(Exynos4210Irq *s)
137
EXYNOS4210_MAX_EXT_COMBINER_OUT_IRQ][bit];
138
139
if (irq_id) {
140
- s->board_irqs[n] = qemu_irq_split(s->int_combiner_irq[n],
141
- s->ext_gic_irq[irq_id-32]);
142
+ s->irq_table[n] = qemu_irq_split(is->int_combiner_irq[n],
143
+ is->ext_gic_irq[irq_id - 32]);
144
}
145
}
146
}
39
--
147
--
40
2.20.1
148
2.25.1
41
42
diff view generated by jsdifflib
1
The GEN_NEON_INTEGER_OP macro is no longer used; remove it.
1
Fix a missing set of spaces around '-' in the definition of
2
combiner_grp_to_gic_id[]. We're about to move this code, so
3
fix the style issue first to keep checkpatch happy with the
4
code-motion patch.
2
5
3
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
7
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
8
Message-id: 20220404154658.565020-7-peter.maydell@linaro.org
5
---
9
---
6
target/arm/translate.c | 23 -----------------------
10
hw/intc/exynos4210_gic.c | 2 +-
7
1 file changed, 23 deletions(-)
11
1 file changed, 1 insertion(+), 1 deletion(-)
8
12
9
diff --git a/target/arm/translate.c b/target/arm/translate.c
13
diff --git a/hw/intc/exynos4210_gic.c b/hw/intc/exynos4210_gic.c
10
index XXXXXXX..XXXXXXX 100644
14
index XXXXXXX..XXXXXXX 100644
11
--- a/target/arm/translate.c
15
--- a/hw/intc/exynos4210_gic.c
12
+++ b/target/arm/translate.c
16
+++ b/hw/intc/exynos4210_gic.c
13
@@ -XXX,XX +XXX,XX @@ static inline void gen_neon_rsb(int size, TCGv_i32 t0, TCGv_i32 t1)
17
@@ -XXX,XX +XXX,XX @@ enum ExtInt {
14
default: return 1; \
18
*/
15
}} while (0)
19
16
20
static const uint32_t
17
-#define GEN_NEON_INTEGER_OP(name) do { \
21
-combiner_grp_to_gic_id[64-EXYNOS4210_MAX_EXT_COMBINER_OUT_IRQ][8] = {
18
- switch ((size << 1) | u) { \
22
+combiner_grp_to_gic_id[64 - EXYNOS4210_MAX_EXT_COMBINER_OUT_IRQ][8] = {
19
- case 0: \
23
/* int combiner groups 16-19 */
20
- gen_helper_neon_##name##_s8(tmp, tmp, tmp2); \
24
{ }, { }, { }, { },
21
- break; \
25
/* int combiner group 20 */
22
- case 1: \
23
- gen_helper_neon_##name##_u8(tmp, tmp, tmp2); \
24
- break; \
25
- case 2: \
26
- gen_helper_neon_##name##_s16(tmp, tmp, tmp2); \
27
- break; \
28
- case 3: \
29
- gen_helper_neon_##name##_u16(tmp, tmp, tmp2); \
30
- break; \
31
- case 4: \
32
- gen_helper_neon_##name##_s32(tmp, tmp, tmp2); \
33
- break; \
34
- case 5: \
35
- gen_helper_neon_##name##_u32(tmp, tmp, tmp2); \
36
- break; \
37
- default: return 1; \
38
- }} while (0)
39
-
40
static TCGv_i32 neon_load_scratch(int scratch)
41
{
42
TCGv_i32 tmp = tcg_temp_new_i32();
43
--
26
--
44
2.20.1
27
2.25.1
45
46
diff view generated by jsdifflib
1
From: Guenter Roeck <linux@roeck-us.net>
1
The function exynos4210_init_board_irqs() currently lives in
2
exynos4210_gic.c, but it isn't really part of the exynos4210.gic
3
device -- it is a function that implements (some of) the wiring up of
4
interrupts between the SoC's GIC and combiner components. This means
5
it fits better in exynos4210.c, which is the SoC-level code. Move it
6
there. Similarly, exynos4210_git_irq() is used almost only in the
7
SoC-level code, so move it too.
2
8
3
Implement full support for the watchdog in i.MX systems.
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4
Pretimeout support is optional because the watchdog hardware
10
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
5
on i.MX31 does not support pretimeouts.
11
Message-id: 20220404154658.565020-8-peter.maydell@linaro.org
12
---
13
include/hw/arm/exynos4210.h | 4 -
14
hw/arm/exynos4210.c | 202 +++++++++++++++++++++++++++++++++++
15
hw/intc/exynos4210_gic.c | 204 ------------------------------------
16
3 files changed, 202 insertions(+), 208 deletions(-)
6
17
7
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
18
diff --git a/include/hw/arm/exynos4210.h b/include/hw/arm/exynos4210.h
8
Message-id: 20200517162135.110364-3-linux@roeck-us.net
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
11
---
12
include/hw/watchdog/wdt_imx2.h | 61 ++++++++-
13
hw/watchdog/wdt_imx2.c | 239 +++++++++++++++++++++++++++++++--
14
2 files changed, 285 insertions(+), 15 deletions(-)
15
16
diff --git a/include/hw/watchdog/wdt_imx2.h b/include/hw/watchdog/wdt_imx2.h
17
index XXXXXXX..XXXXXXX 100644
19
index XXXXXXX..XXXXXXX 100644
18
--- a/include/hw/watchdog/wdt_imx2.h
20
--- a/include/hw/arm/exynos4210.h
19
+++ b/include/hw/watchdog/wdt_imx2.h
21
+++ b/include/hw/arm/exynos4210.h
22
@@ -XXX,XX +XXX,XX @@ OBJECT_DECLARE_SIMPLE_TYPE(Exynos4210State, EXYNOS4210_SOC)
23
void exynos4210_write_secondary(ARMCPU *cpu,
24
const struct arm_boot_info *info);
25
26
-/* Initialize board IRQs.
27
- * These IRQs contain splitted Int/External Combiner and External Gic IRQs */
28
-void exynos4210_init_board_irqs(Exynos4210State *s);
29
-
30
/* Get IRQ number from exynos4210 IRQ subsystem stub.
31
* To identify IRQ source use internal combiner group and bit number
32
* grp - group number
33
diff --git a/hw/arm/exynos4210.c b/hw/arm/exynos4210.c
34
index XXXXXXX..XXXXXXX 100644
35
--- a/hw/arm/exynos4210.c
36
+++ b/hw/arm/exynos4210.c
20
@@ -XXX,XX +XXX,XX @@
37
@@ -XXX,XX +XXX,XX @@
21
#ifndef IMX2_WDT_H
38
#define EXYNOS4210_PL330_BASE1_ADDR 0x12690000
22
#define IMX2_WDT_H
39
#define EXYNOS4210_PL330_BASE2_ADDR 0x12850000
23
40
24
+#include "qemu/bitops.h"
41
+enum ExtGicId {
25
#include "hw/sysbus.h"
42
+ EXT_GIC_ID_MDMA_LCD0 = 66,
26
+#include "hw/irq.h"
43
+ EXT_GIC_ID_PDMA0,
27
+#include "hw/ptimer.h"
44
+ EXT_GIC_ID_PDMA1,
28
45
+ EXT_GIC_ID_TIMER0,
29
#define TYPE_IMX2_WDT "imx2.wdt"
46
+ EXT_GIC_ID_TIMER1,
30
#define IMX2_WDT(obj) OBJECT_CHECK(IMX2WdtState, (obj), TYPE_IMX2_WDT)
47
+ EXT_GIC_ID_TIMER2,
31
48
+ EXT_GIC_ID_TIMER3,
32
enum IMX2WdtRegisters {
49
+ EXT_GIC_ID_TIMER4,
33
- IMX2_WDT_WCR = 0x0000,
50
+ EXT_GIC_ID_MCT_L0,
34
- IMX2_WDT_REG_NUM = 0x0008 / sizeof(uint16_t) + 1,
51
+ EXT_GIC_ID_WDT,
35
+ IMX2_WDT_WCR = 0x0000, /* Control Register */
52
+ EXT_GIC_ID_RTC_ALARM,
36
+ IMX2_WDT_WSR = 0x0002, /* Service Register */
53
+ EXT_GIC_ID_RTC_TIC,
37
+ IMX2_WDT_WRSR = 0x0004, /* Reset Status Register */
54
+ EXT_GIC_ID_GPIO_XB,
38
+ IMX2_WDT_WICR = 0x0006, /* Interrupt Control Register */
55
+ EXT_GIC_ID_GPIO_XA,
39
+ IMX2_WDT_WMCR = 0x0008, /* Misc Register */
56
+ EXT_GIC_ID_MCT_L1,
40
};
57
+ EXT_GIC_ID_IEM_APC,
41
58
+ EXT_GIC_ID_IEM_IEC,
42
+#define IMX2_WDT_MMIO_SIZE 0x000a
59
+ EXT_GIC_ID_NFC,
43
+
60
+ EXT_GIC_ID_UART0,
44
+/* Control Register definitions */
61
+ EXT_GIC_ID_UART1,
45
+#define IMX2_WDT_WCR_WT (0xFF << 8) /* Watchdog Timeout Field */
62
+ EXT_GIC_ID_UART2,
46
+#define IMX2_WDT_WCR_WDW BIT(7) /* WDOG Disable for Wait */
63
+ EXT_GIC_ID_UART3,
47
+#define IMX2_WDT_WCR_WDA BIT(5) /* WDOG Assertion */
64
+ EXT_GIC_ID_UART4,
48
+#define IMX2_WDT_WCR_SRS BIT(4) /* Software Reset Signal */
65
+ EXT_GIC_ID_MCT_G0,
49
+#define IMX2_WDT_WCR_WDT BIT(3) /* WDOG Timeout Assertion */
66
+ EXT_GIC_ID_I2C0,
50
+#define IMX2_WDT_WCR_WDE BIT(2) /* Watchdog Enable */
67
+ EXT_GIC_ID_I2C1,
51
+#define IMX2_WDT_WCR_WDBG BIT(1) /* Watchdog Debug Enable */
68
+ EXT_GIC_ID_I2C2,
52
+#define IMX2_WDT_WCR_WDZST BIT(0) /* Watchdog Timer Suspend */
69
+ EXT_GIC_ID_I2C3,
53
+
70
+ EXT_GIC_ID_I2C4,
54
+#define IMX2_WDT_WCR_LOCK_MASK (IMX2_WDT_WCR_WDZST | IMX2_WDT_WCR_WDBG \
71
+ EXT_GIC_ID_I2C5,
55
+ | IMX2_WDT_WCR_WDW)
72
+ EXT_GIC_ID_I2C6,
56
+
73
+ EXT_GIC_ID_I2C7,
57
+/* Service Register definitions */
74
+ EXT_GIC_ID_SPI0,
58
+#define IMX2_WDT_SEQ1 0x5555 /* service sequence 1 */
75
+ EXT_GIC_ID_SPI1,
59
+#define IMX2_WDT_SEQ2 0xAAAA /* service sequence 2 */
76
+ EXT_GIC_ID_SPI2,
60
+
77
+ EXT_GIC_ID_MCT_G1,
61
+/* Reset Status Register definitions */
78
+ EXT_GIC_ID_USB_HOST,
62
+#define IMX2_WDT_WRSR_TOUT BIT(1) /* Reset due to Timeout */
79
+ EXT_GIC_ID_USB_DEVICE,
63
+#define IMX2_WDT_WRSR_SFTW BIT(0) /* Reset due to software reset */
80
+ EXT_GIC_ID_MODEMIF,
64
+
81
+ EXT_GIC_ID_HSMMC0,
65
+/* Interrupt Control Register definitions */
82
+ EXT_GIC_ID_HSMMC1,
66
+#define IMX2_WDT_WICR_WIE BIT(15) /* Interrupt Enable */
83
+ EXT_GIC_ID_HSMMC2,
67
+#define IMX2_WDT_WICR_WTIS BIT(14) /* Interrupt Status */
84
+ EXT_GIC_ID_HSMMC3,
68
+#define IMX2_WDT_WICR_WICT 0xff /* Interrupt Timeout */
85
+ EXT_GIC_ID_SDMMC,
69
+#define IMX2_WDT_WICR_WICT_DEF 0x04 /* Default interrupt timeout (2s) */
86
+ EXT_GIC_ID_MIPI_CSI_4LANE,
70
+
87
+ EXT_GIC_ID_MIPI_DSI_4LANE,
71
+#define IMX2_WDT_WICR_LOCK_MASK (IMX2_WDT_WICR_WIE | IMX2_WDT_WICR_WICT)
88
+ EXT_GIC_ID_MIPI_CSI_2LANE,
72
+
89
+ EXT_GIC_ID_MIPI_DSI_2LANE,
73
+/* Misc Control Register definitions */
90
+ EXT_GIC_ID_ONENAND_AUDI,
74
+#define IMX2_WDT_WMCR_PDE BIT(0) /* Power-Down Enable */
91
+ EXT_GIC_ID_ROTATOR,
75
92
+ EXT_GIC_ID_FIMC0,
76
typedef struct IMX2WdtState {
93
+ EXT_GIC_ID_FIMC1,
77
/* <private> */
94
+ EXT_GIC_ID_FIMC2,
78
SysBusDevice parent_obj;
95
+ EXT_GIC_ID_FIMC3,
79
96
+ EXT_GIC_ID_JPEG,
80
+ /*< public >*/
97
+ EXT_GIC_ID_2D,
81
MemoryRegion mmio;
98
+ EXT_GIC_ID_PCIe,
82
+ qemu_irq irq;
99
+ EXT_GIC_ID_MIXER,
83
+
100
+ EXT_GIC_ID_HDMI,
84
+ struct ptimer_state *timer;
101
+ EXT_GIC_ID_HDMI_I2C,
85
+ struct ptimer_state *itimer;
102
+ EXT_GIC_ID_MFC,
86
+
103
+ EXT_GIC_ID_TVENC,
87
+ bool pretimeout_support;
104
+};
88
+ bool wicr_locked;
105
+
89
+
106
+enum ExtInt {
90
+ uint16_t wcr;
107
+ EXT_GIC_ID_EXTINT0 = 48,
91
+ uint16_t wsr;
108
+ EXT_GIC_ID_EXTINT1,
92
+ uint16_t wrsr;
109
+ EXT_GIC_ID_EXTINT2,
93
+ uint16_t wicr;
110
+ EXT_GIC_ID_EXTINT3,
94
+ uint16_t wmcr;
111
+ EXT_GIC_ID_EXTINT4,
95
+
112
+ EXT_GIC_ID_EXTINT5,
96
+ bool wcr_locked; /* affects WDZST, WDBG, and WDW */
113
+ EXT_GIC_ID_EXTINT6,
97
+ bool wcr_wde_locked; /* affects WDE */
114
+ EXT_GIC_ID_EXTINT7,
98
+ bool wcr_wdt_locked; /* affects WDT (never cleared) */
115
+ EXT_GIC_ID_EXTINT8,
99
} IMX2WdtState;
116
+ EXT_GIC_ID_EXTINT9,
100
117
+ EXT_GIC_ID_EXTINT10,
101
#endif /* IMX2_WDT_H */
118
+ EXT_GIC_ID_EXTINT11,
102
diff --git a/hw/watchdog/wdt_imx2.c b/hw/watchdog/wdt_imx2.c
119
+ EXT_GIC_ID_EXTINT12,
103
index XXXXXXX..XXXXXXX 100644
120
+ EXT_GIC_ID_EXTINT13,
104
--- a/hw/watchdog/wdt_imx2.c
121
+ EXT_GIC_ID_EXTINT14,
105
+++ b/hw/watchdog/wdt_imx2.c
122
+ EXT_GIC_ID_EXTINT15
106
@@ -XXX,XX +XXX,XX @@
123
+};
107
#include "qemu/bitops.h"
124
+
108
#include "qemu/module.h"
125
+/*
109
#include "sysemu/watchdog.h"
126
+ * External GIC sources which are not from External Interrupt Combiner or
110
+#include "migration/vmstate.h"
127
+ * External Interrupts are starting from EXYNOS4210_MAX_EXT_COMBINER_OUT_IRQ,
111
+#include "hw/qdev-properties.h"
128
+ * which is INTG16 in Internal Interrupt Combiner.
112
129
+ */
113
#include "hw/watchdog/wdt_imx2.h"
130
+
114
131
+static const uint32_t
115
-#define IMX2_WDT_WCR_WDA BIT(5) /* -> External Reset WDOG_B */
132
+combiner_grp_to_gic_id[64 - EXYNOS4210_MAX_EXT_COMBINER_OUT_IRQ][8] = {
116
-#define IMX2_WDT_WCR_SRS BIT(4) /* -> Software Reset Signal */
133
+ /* int combiner groups 16-19 */
117
-
134
+ { }, { }, { }, { },
118
-static uint64_t imx2_wdt_read(void *opaque, hwaddr addr,
135
+ /* int combiner group 20 */
119
- unsigned int size)
136
+ { 0, EXT_GIC_ID_MDMA_LCD0 },
120
+static void imx2_wdt_interrupt(void *opaque)
137
+ /* int combiner group 21 */
121
{
138
+ { EXT_GIC_ID_PDMA0, EXT_GIC_ID_PDMA1 },
122
+ IMX2WdtState *s = IMX2_WDT(opaque);
139
+ /* int combiner group 22 */
123
+
140
+ { EXT_GIC_ID_TIMER0, EXT_GIC_ID_TIMER1, EXT_GIC_ID_TIMER2,
124
+ s->wicr |= IMX2_WDT_WICR_WTIS;
141
+ EXT_GIC_ID_TIMER3, EXT_GIC_ID_TIMER4 },
125
+ qemu_set_irq(s->irq, 1);
142
+ /* int combiner group 23 */
126
+}
143
+ { EXT_GIC_ID_RTC_ALARM, EXT_GIC_ID_RTC_TIC },
127
+
144
+ /* int combiner group 24 */
128
+static void imx2_wdt_expired(void *opaque)
145
+ { EXT_GIC_ID_GPIO_XB, EXT_GIC_ID_GPIO_XA },
146
+ /* int combiner group 25 */
147
+ { EXT_GIC_ID_IEM_APC, EXT_GIC_ID_IEM_IEC },
148
+ /* int combiner group 26 */
149
+ { EXT_GIC_ID_UART0, EXT_GIC_ID_UART1, EXT_GIC_ID_UART2, EXT_GIC_ID_UART3,
150
+ EXT_GIC_ID_UART4 },
151
+ /* int combiner group 27 */
152
+ { EXT_GIC_ID_I2C0, EXT_GIC_ID_I2C1, EXT_GIC_ID_I2C2, EXT_GIC_ID_I2C3,
153
+ EXT_GIC_ID_I2C4, EXT_GIC_ID_I2C5, EXT_GIC_ID_I2C6,
154
+ EXT_GIC_ID_I2C7 },
155
+ /* int combiner group 28 */
156
+ { EXT_GIC_ID_SPI0, EXT_GIC_ID_SPI1, EXT_GIC_ID_SPI2 , EXT_GIC_ID_USB_HOST},
157
+ /* int combiner group 29 */
158
+ { EXT_GIC_ID_HSMMC0, EXT_GIC_ID_HSMMC1, EXT_GIC_ID_HSMMC2,
159
+ EXT_GIC_ID_HSMMC3, EXT_GIC_ID_SDMMC },
160
+ /* int combiner group 30 */
161
+ { EXT_GIC_ID_MIPI_CSI_4LANE, EXT_GIC_ID_MIPI_CSI_2LANE },
162
+ /* int combiner group 31 */
163
+ { EXT_GIC_ID_MIPI_DSI_4LANE, EXT_GIC_ID_MIPI_DSI_2LANE },
164
+ /* int combiner group 32 */
165
+ { EXT_GIC_ID_FIMC0, EXT_GIC_ID_FIMC1 },
166
+ /* int combiner group 33 */
167
+ { EXT_GIC_ID_FIMC2, EXT_GIC_ID_FIMC3 },
168
+ /* int combiner group 34 */
169
+ { EXT_GIC_ID_ONENAND_AUDI, EXT_GIC_ID_NFC },
170
+ /* int combiner group 35 */
171
+ { 0, 0, 0, EXT_GIC_ID_MCT_L1, EXT_GIC_ID_MCT_G0, EXT_GIC_ID_MCT_G1 },
172
+ /* int combiner group 36 */
173
+ { EXT_GIC_ID_MIXER },
174
+ /* int combiner group 37 */
175
+ { EXT_GIC_ID_EXTINT4, EXT_GIC_ID_EXTINT5, EXT_GIC_ID_EXTINT6,
176
+ EXT_GIC_ID_EXTINT7 },
177
+ /* groups 38-50 */
178
+ { }, { }, { }, { }, { }, { }, { }, { }, { }, { }, { }, { }, { },
179
+ /* int combiner group 51 */
180
+ { EXT_GIC_ID_MCT_L0, 0, 0, 0, EXT_GIC_ID_MCT_G0, EXT_GIC_ID_MCT_G1 },
181
+ /* group 52 */
182
+ { },
183
+ /* int combiner group 53 */
184
+ { EXT_GIC_ID_WDT, 0, 0, 0, EXT_GIC_ID_MCT_G0, EXT_GIC_ID_MCT_G1 },
185
+ /* groups 54-63 */
186
+ { }, { }, { }, { }, { }, { }, { }, { }, { }, { }
187
+};
188
+
189
+/*
190
+ * Initialize board IRQs.
191
+ * These IRQs contain splitted Int/External Combiner and External Gic IRQs.
192
+ */
193
+static void exynos4210_init_board_irqs(Exynos4210State *s)
129
+{
194
+{
130
+ IMX2WdtState *s = IMX2_WDT(opaque);
195
+ uint32_t grp, bit, irq_id, n;
131
+
196
+ Exynos4210Irq *is = &s->irqs;
132
+ s->wrsr = IMX2_WDT_WRSR_TOUT;
197
+
133
+
198
+ for (n = 0; n < EXYNOS4210_MAX_EXT_COMBINER_IN_IRQ; n++) {
134
+ /* Perform watchdog action if watchdog is enabled */
199
+ irq_id = 0;
135
+ if (s->wcr & IMX2_WDT_WCR_WDE) {
200
+ if (n == EXYNOS4210_COMBINER_GET_IRQ_NUM(1, 4) ||
136
+ s->wrsr = IMX2_WDT_WRSR_TOUT;
201
+ n == EXYNOS4210_COMBINER_GET_IRQ_NUM(12, 4)) {
137
+ watchdog_perform_action();
202
+ /* MCT_G0 is passed to External GIC */
203
+ irq_id = EXT_GIC_ID_MCT_G0;
204
+ }
205
+ if (n == EXYNOS4210_COMBINER_GET_IRQ_NUM(1, 5) ||
206
+ n == EXYNOS4210_COMBINER_GET_IRQ_NUM(12, 5)) {
207
+ /* MCT_G1 is passed to External and GIC */
208
+ irq_id = EXT_GIC_ID_MCT_G1;
209
+ }
210
+ if (irq_id) {
211
+ s->irq_table[n] = qemu_irq_split(is->int_combiner_irq[n],
212
+ is->ext_gic_irq[irq_id - 32]);
213
+ } else {
214
+ s->irq_table[n] = qemu_irq_split(is->int_combiner_irq[n],
215
+ is->ext_combiner_irq[n]);
216
+ }
217
+ }
218
+ for (; n < EXYNOS4210_MAX_INT_COMBINER_IN_IRQ; n++) {
219
+ /* these IDs are passed to Internal Combiner and External GIC */
220
+ grp = EXYNOS4210_COMBINER_GET_GRP_NUM(n);
221
+ bit = EXYNOS4210_COMBINER_GET_BIT_NUM(n);
222
+ irq_id = combiner_grp_to_gic_id[grp -
223
+ EXYNOS4210_MAX_EXT_COMBINER_OUT_IRQ][bit];
224
+
225
+ if (irq_id) {
226
+ s->irq_table[n] = qemu_irq_split(is->int_combiner_irq[n],
227
+ is->ext_gic_irq[irq_id - 32]);
228
+ }
138
+ }
229
+ }
139
+}
230
+}
140
+
231
+
141
+static void imx2_wdt_reset(DeviceState *dev)
232
+/*
233
+ * Get IRQ number from exynos4210 IRQ subsystem stub.
234
+ * To identify IRQ source use internal combiner group and bit number
235
+ * grp - group number
236
+ * bit - bit number inside group
237
+ */
238
+uint32_t exynos4210_get_irq(uint32_t grp, uint32_t bit)
142
+{
239
+{
143
+ IMX2WdtState *s = IMX2_WDT(dev);
240
+ return EXYNOS4210_COMBINER_GET_IRQ_NUM(grp, bit);
144
+
145
+ ptimer_transaction_begin(s->timer);
146
+ ptimer_stop(s->timer);
147
+ ptimer_transaction_commit(s->timer);
148
+
149
+ if (s->pretimeout_support) {
150
+ ptimer_transaction_begin(s->itimer);
151
+ ptimer_stop(s->itimer);
152
+ ptimer_transaction_commit(s->itimer);
153
+ }
154
+
155
+ s->wicr_locked = false;
156
+ s->wcr_locked = false;
157
+ s->wcr_wde_locked = false;
158
+
159
+ s->wcr = IMX2_WDT_WCR_WDA | IMX2_WDT_WCR_SRS;
160
+ s->wsr = 0;
161
+ s->wrsr &= ~(IMX2_WDT_WRSR_TOUT | IMX2_WDT_WRSR_SFTW);
162
+ s->wicr = IMX2_WDT_WICR_WICT_DEF;
163
+ s->wmcr = IMX2_WDT_WMCR_PDE;
164
+}
241
+}
165
+
242
+
166
+static uint64_t imx2_wdt_read(void *opaque, hwaddr addr, unsigned int size)
243
static uint8_t chipid_and_omr[] = { 0x11, 0x02, 0x21, 0x43,
167
+{
244
0x09, 0x00, 0x00, 0x00 };
168
+ IMX2WdtState *s = IMX2_WDT(opaque);
245
169
+
246
diff --git a/hw/intc/exynos4210_gic.c b/hw/intc/exynos4210_gic.c
170
+ switch (addr) {
247
index XXXXXXX..XXXXXXX 100644
171
+ case IMX2_WDT_WCR:
248
--- a/hw/intc/exynos4210_gic.c
172
+ return s->wcr;
249
+++ b/hw/intc/exynos4210_gic.c
173
+ case IMX2_WDT_WSR:
250
@@ -XXX,XX +XXX,XX @@
174
+ return s->wsr;
251
#include "hw/arm/exynos4210.h"
175
+ case IMX2_WDT_WRSR:
252
#include "qom/object.h"
176
+ return s->wrsr;
253
177
+ case IMX2_WDT_WICR:
254
-enum ExtGicId {
178
+ return s->wicr;
255
- EXT_GIC_ID_MDMA_LCD0 = 66,
179
+ case IMX2_WDT_WMCR:
256
- EXT_GIC_ID_PDMA0,
180
+ return s->wmcr;
257
- EXT_GIC_ID_PDMA1,
181
+ }
258
- EXT_GIC_ID_TIMER0,
182
return 0;
259
- EXT_GIC_ID_TIMER1,
183
}
260
- EXT_GIC_ID_TIMER2,
184
261
- EXT_GIC_ID_TIMER3,
185
+static void imx_wdt2_update_itimer(IMX2WdtState *s, bool start)
262
- EXT_GIC_ID_TIMER4,
186
+{
263
- EXT_GIC_ID_MCT_L0,
187
+ bool running = (s->wcr & IMX2_WDT_WCR_WDE) && (s->wcr & IMX2_WDT_WCR_WT);
264
- EXT_GIC_ID_WDT,
188
+ bool enabled = s->wicr & IMX2_WDT_WICR_WIE;
265
- EXT_GIC_ID_RTC_ALARM,
189
+
266
- EXT_GIC_ID_RTC_TIC,
190
+ ptimer_transaction_begin(s->itimer);
267
- EXT_GIC_ID_GPIO_XB,
191
+ if (start || !enabled) {
268
- EXT_GIC_ID_GPIO_XA,
192
+ ptimer_stop(s->itimer);
269
- EXT_GIC_ID_MCT_L1,
193
+ }
270
- EXT_GIC_ID_IEM_APC,
194
+ if (running && enabled) {
271
- EXT_GIC_ID_IEM_IEC,
195
+ int count = ptimer_get_count(s->timer);
272
- EXT_GIC_ID_NFC,
196
+ int pretimeout = s->wicr & IMX2_WDT_WICR_WICT;
273
- EXT_GIC_ID_UART0,
197
+
274
- EXT_GIC_ID_UART1,
198
+ /*
275
- EXT_GIC_ID_UART2,
199
+ * Only (re-)start pretimeout timer if its counter value is larger
276
- EXT_GIC_ID_UART3,
200
+ * than 0. Otherwise it will fire right away and we'll get an
277
- EXT_GIC_ID_UART4,
201
+ * interrupt loop.
278
- EXT_GIC_ID_MCT_G0,
202
+ */
279
- EXT_GIC_ID_I2C0,
203
+ if (count > pretimeout) {
280
- EXT_GIC_ID_I2C1,
204
+ ptimer_set_count(s->itimer, count - pretimeout);
281
- EXT_GIC_ID_I2C2,
205
+ if (start) {
282
- EXT_GIC_ID_I2C3,
206
+ ptimer_run(s->itimer, 1);
283
- EXT_GIC_ID_I2C4,
207
+ }
284
- EXT_GIC_ID_I2C5,
208
+ }
285
- EXT_GIC_ID_I2C6,
209
+ }
286
- EXT_GIC_ID_I2C7,
210
+ ptimer_transaction_commit(s->itimer);
287
- EXT_GIC_ID_SPI0,
211
+}
288
- EXT_GIC_ID_SPI1,
212
+
289
- EXT_GIC_ID_SPI2,
213
+static void imx_wdt2_update_timer(IMX2WdtState *s, bool start)
290
- EXT_GIC_ID_MCT_G1,
214
+{
291
- EXT_GIC_ID_USB_HOST,
215
+ ptimer_transaction_begin(s->timer);
292
- EXT_GIC_ID_USB_DEVICE,
216
+ if (start) {
293
- EXT_GIC_ID_MODEMIF,
217
+ ptimer_stop(s->timer);
294
- EXT_GIC_ID_HSMMC0,
218
+ }
295
- EXT_GIC_ID_HSMMC1,
219
+ if ((s->wcr & IMX2_WDT_WCR_WDE) && (s->wcr & IMX2_WDT_WCR_WT)) {
296
- EXT_GIC_ID_HSMMC2,
220
+ int count = (s->wcr & IMX2_WDT_WCR_WT) >> 8;
297
- EXT_GIC_ID_HSMMC3,
221
+
298
- EXT_GIC_ID_SDMMC,
222
+ /* A value of 0 reflects one period (0.5s). */
299
- EXT_GIC_ID_MIPI_CSI_4LANE,
223
+ ptimer_set_count(s->timer, count + 1);
300
- EXT_GIC_ID_MIPI_DSI_4LANE,
224
+ if (start) {
301
- EXT_GIC_ID_MIPI_CSI_2LANE,
225
+ ptimer_run(s->timer, 1);
302
- EXT_GIC_ID_MIPI_DSI_2LANE,
226
+ }
303
- EXT_GIC_ID_ONENAND_AUDI,
227
+ }
304
- EXT_GIC_ID_ROTATOR,
228
+ ptimer_transaction_commit(s->timer);
305
- EXT_GIC_ID_FIMC0,
229
+ if (s->pretimeout_support) {
306
- EXT_GIC_ID_FIMC1,
230
+ imx_wdt2_update_itimer(s, start);
307
- EXT_GIC_ID_FIMC2,
231
+ }
308
- EXT_GIC_ID_FIMC3,
232
+}
309
- EXT_GIC_ID_JPEG,
233
+
310
- EXT_GIC_ID_2D,
234
static void imx2_wdt_write(void *opaque, hwaddr addr,
311
- EXT_GIC_ID_PCIe,
235
uint64_t value, unsigned int size)
312
- EXT_GIC_ID_MIXER,
236
{
313
- EXT_GIC_ID_HDMI,
237
- if (addr == IMX2_WDT_WCR &&
314
- EXT_GIC_ID_HDMI_I2C,
238
- (~value & (IMX2_WDT_WCR_WDA | IMX2_WDT_WCR_SRS))) {
315
- EXT_GIC_ID_MFC,
239
- watchdog_perform_action();
316
- EXT_GIC_ID_TVENC,
240
+ IMX2WdtState *s = IMX2_WDT(opaque);
317
-};
241
+
318
-
242
+ switch (addr) {
319
-enum ExtInt {
243
+ case IMX2_WDT_WCR:
320
- EXT_GIC_ID_EXTINT0 = 48,
244
+ if (s->wcr_locked) {
321
- EXT_GIC_ID_EXTINT1,
245
+ value &= ~IMX2_WDT_WCR_LOCK_MASK;
322
- EXT_GIC_ID_EXTINT2,
246
+ value |= (s->wicr & IMX2_WDT_WCR_LOCK_MASK);
323
- EXT_GIC_ID_EXTINT3,
247
+ }
324
- EXT_GIC_ID_EXTINT4,
248
+ s->wcr_locked = true;
325
- EXT_GIC_ID_EXTINT5,
249
+ if (s->wcr_wde_locked) {
326
- EXT_GIC_ID_EXTINT6,
250
+ value &= ~IMX2_WDT_WCR_WDE;
327
- EXT_GIC_ID_EXTINT7,
251
+ value |= (s->wicr & ~IMX2_WDT_WCR_WDE);
328
- EXT_GIC_ID_EXTINT8,
252
+ } else if (value & IMX2_WDT_WCR_WDE) {
329
- EXT_GIC_ID_EXTINT9,
253
+ s->wcr_wde_locked = true;
330
- EXT_GIC_ID_EXTINT10,
254
+ }
331
- EXT_GIC_ID_EXTINT11,
255
+ if (s->wcr_wdt_locked) {
332
- EXT_GIC_ID_EXTINT12,
256
+ value &= ~IMX2_WDT_WCR_WDT;
333
- EXT_GIC_ID_EXTINT13,
257
+ value |= (s->wicr & ~IMX2_WDT_WCR_WDT);
334
- EXT_GIC_ID_EXTINT14,
258
+ } else if (value & IMX2_WDT_WCR_WDT) {
335
- EXT_GIC_ID_EXTINT15
259
+ s->wcr_wdt_locked = true;
336
-};
260
+ }
337
-
261
+
338
-/*
262
+ s->wcr = value;
339
- * External GIC sources which are not from External Interrupt Combiner or
263
+ if (!(value & IMX2_WDT_WCR_SRS)) {
340
- * External Interrupts are starting from EXYNOS4210_MAX_EXT_COMBINER_OUT_IRQ,
264
+ s->wrsr = IMX2_WDT_WRSR_SFTW;
341
- * which is INTG16 in Internal Interrupt Combiner.
265
+ }
342
- */
266
+ if (!(value & (IMX2_WDT_WCR_WDA | IMX2_WDT_WCR_SRS)) ||
343
-
267
+ (!(value & IMX2_WDT_WCR_WT) && (value & IMX2_WDT_WCR_WDE))) {
344
-static const uint32_t
268
+ watchdog_perform_action();
345
-combiner_grp_to_gic_id[64 - EXYNOS4210_MAX_EXT_COMBINER_OUT_IRQ][8] = {
269
+ }
346
- /* int combiner groups 16-19 */
270
+ s->wcr |= IMX2_WDT_WCR_SRS;
347
- { }, { }, { }, { },
271
+ imx_wdt2_update_timer(s, true);
348
- /* int combiner group 20 */
272
+ break;
349
- { 0, EXT_GIC_ID_MDMA_LCD0 },
273
+ case IMX2_WDT_WSR:
350
- /* int combiner group 21 */
274
+ if (s->wsr == IMX2_WDT_SEQ1 && value == IMX2_WDT_SEQ2) {
351
- { EXT_GIC_ID_PDMA0, EXT_GIC_ID_PDMA1 },
275
+ imx_wdt2_update_timer(s, false);
352
- /* int combiner group 22 */
276
+ }
353
- { EXT_GIC_ID_TIMER0, EXT_GIC_ID_TIMER1, EXT_GIC_ID_TIMER2,
277
+ s->wsr = value;
354
- EXT_GIC_ID_TIMER3, EXT_GIC_ID_TIMER4 },
278
+ break;
355
- /* int combiner group 23 */
279
+ case IMX2_WDT_WRSR:
356
- { EXT_GIC_ID_RTC_ALARM, EXT_GIC_ID_RTC_TIC },
280
+ break;
357
- /* int combiner group 24 */
281
+ case IMX2_WDT_WICR:
358
- { EXT_GIC_ID_GPIO_XB, EXT_GIC_ID_GPIO_XA },
282
+ if (!s->pretimeout_support) {
359
- /* int combiner group 25 */
283
+ return;
360
- { EXT_GIC_ID_IEM_APC, EXT_GIC_ID_IEM_IEC },
284
+ }
361
- /* int combiner group 26 */
285
+ value &= IMX2_WDT_WICR_LOCK_MASK | IMX2_WDT_WICR_WTIS;
362
- { EXT_GIC_ID_UART0, EXT_GIC_ID_UART1, EXT_GIC_ID_UART2, EXT_GIC_ID_UART3,
286
+ if (s->wicr_locked) {
363
- EXT_GIC_ID_UART4 },
287
+ value &= IMX2_WDT_WICR_WTIS;
364
- /* int combiner group 27 */
288
+ value |= (s->wicr & IMX2_WDT_WICR_LOCK_MASK);
365
- { EXT_GIC_ID_I2C0, EXT_GIC_ID_I2C1, EXT_GIC_ID_I2C2, EXT_GIC_ID_I2C3,
289
+ }
366
- EXT_GIC_ID_I2C4, EXT_GIC_ID_I2C5, EXT_GIC_ID_I2C6,
290
+ s->wicr = value | (s->wicr & IMX2_WDT_WICR_WTIS);
367
- EXT_GIC_ID_I2C7 },
291
+ if (value & IMX2_WDT_WICR_WTIS) {
368
- /* int combiner group 28 */
292
+ s->wicr &= ~IMX2_WDT_WICR_WTIS;
369
- { EXT_GIC_ID_SPI0, EXT_GIC_ID_SPI1, EXT_GIC_ID_SPI2 , EXT_GIC_ID_USB_HOST},
293
+ qemu_set_irq(s->irq, 0);
370
- /* int combiner group 29 */
294
+ }
371
- { EXT_GIC_ID_HSMMC0, EXT_GIC_ID_HSMMC1, EXT_GIC_ID_HSMMC2,
295
+ imx_wdt2_update_itimer(s, true);
372
- EXT_GIC_ID_HSMMC3, EXT_GIC_ID_SDMMC },
296
+ s->wicr_locked = true;
373
- /* int combiner group 30 */
297
+ break;
374
- { EXT_GIC_ID_MIPI_CSI_4LANE, EXT_GIC_ID_MIPI_CSI_2LANE },
298
+ case IMX2_WDT_WMCR:
375
- /* int combiner group 31 */
299
+ s->wmcr = value & IMX2_WDT_WMCR_PDE;
376
- { EXT_GIC_ID_MIPI_DSI_4LANE, EXT_GIC_ID_MIPI_DSI_2LANE },
300
+ break;
377
- /* int combiner group 32 */
301
}
378
- { EXT_GIC_ID_FIMC0, EXT_GIC_ID_FIMC1 },
302
}
379
- /* int combiner group 33 */
303
380
- { EXT_GIC_ID_FIMC2, EXT_GIC_ID_FIMC3 },
304
@@ -XXX,XX +XXX,XX @@ static const MemoryRegionOps imx2_wdt_ops = {
381
- /* int combiner group 34 */
305
* real device but in practice there is no reason for a guest
382
- { EXT_GIC_ID_ONENAND_AUDI, EXT_GIC_ID_NFC },
306
* to access this device unaligned.
383
- /* int combiner group 35 */
307
*/
384
- { 0, 0, 0, EXT_GIC_ID_MCT_L1, EXT_GIC_ID_MCT_G0, EXT_GIC_ID_MCT_G1 },
308
- .min_access_size = 4,
385
- /* int combiner group 36 */
309
- .max_access_size = 4,
386
- { EXT_GIC_ID_MIXER },
310
+ .min_access_size = 2,
387
- /* int combiner group 37 */
311
+ .max_access_size = 2,
388
- { EXT_GIC_ID_EXTINT4, EXT_GIC_ID_EXTINT5, EXT_GIC_ID_EXTINT6,
312
.unaligned = false,
389
- EXT_GIC_ID_EXTINT7 },
313
},
390
- /* groups 38-50 */
314
};
391
- { }, { }, { }, { }, { }, { }, { }, { }, { }, { }, { }, { }, { },
315
392
- /* int combiner group 51 */
316
+static const VMStateDescription vmstate_imx2_wdt = {
393
- { EXT_GIC_ID_MCT_L0, 0, 0, 0, EXT_GIC_ID_MCT_G0, EXT_GIC_ID_MCT_G1 },
317
+ .name = "imx2.wdt",
394
- /* group 52 */
318
+ .fields = (VMStateField[]) {
395
- { },
319
+ VMSTATE_PTIMER(timer, IMX2WdtState),
396
- /* int combiner group 53 */
320
+ VMSTATE_PTIMER(itimer, IMX2WdtState),
397
- { EXT_GIC_ID_WDT, 0, 0, 0, EXT_GIC_ID_MCT_G0, EXT_GIC_ID_MCT_G1 },
321
+ VMSTATE_BOOL(wicr_locked, IMX2WdtState),
398
- /* groups 54-63 */
322
+ VMSTATE_BOOL(wcr_locked, IMX2WdtState),
399
- { }, { }, { }, { }, { }, { }, { }, { }, { }, { }
323
+ VMSTATE_BOOL(wcr_wde_locked, IMX2WdtState),
400
-};
324
+ VMSTATE_BOOL(wcr_wdt_locked, IMX2WdtState),
401
-
325
+ VMSTATE_UINT16(wcr, IMX2WdtState),
402
#define EXYNOS4210_GIC_NIRQ 160
326
+ VMSTATE_UINT16(wsr, IMX2WdtState),
403
327
+ VMSTATE_UINT16(wrsr, IMX2WdtState),
404
#define EXYNOS4210_EXT_GIC_CPU_REGION_SIZE 0x10000
328
+ VMSTATE_UINT16(wmcr, IMX2WdtState),
405
@@ -XXX,XX +XXX,XX @@ combiner_grp_to_gic_id[64 - EXYNOS4210_MAX_EXT_COMBINER_OUT_IRQ][8] = {
329
+ VMSTATE_UINT16(wicr, IMX2WdtState),
406
#define EXYNOS4210_GIC_CPU_REGION_SIZE 0x100
330
+ VMSTATE_END_OF_LIST()
407
#define EXYNOS4210_GIC_DIST_REGION_SIZE 0x1000
331
+ }
408
332
+};
409
-/*
333
+
410
- * Initialize board IRQs.
334
static void imx2_wdt_realize(DeviceState *dev, Error **errp)
411
- * These IRQs contain splitted Int/External Combiner and External Gic IRQs.
335
{
412
- */
336
IMX2WdtState *s = IMX2_WDT(dev);
413
-void exynos4210_init_board_irqs(Exynos4210State *s)
337
+ SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
414
-{
338
415
- uint32_t grp, bit, irq_id, n;
339
memory_region_init_io(&s->mmio, OBJECT(dev),
416
- Exynos4210Irq *is = &s->irqs;
340
&imx2_wdt_ops, s,
417
-
341
- TYPE_IMX2_WDT".mmio",
418
- for (n = 0; n < EXYNOS4210_MAX_EXT_COMBINER_IN_IRQ; n++) {
342
- IMX2_WDT_REG_NUM * sizeof(uint16_t));
419
- irq_id = 0;
343
- sysbus_init_mmio(SYS_BUS_DEVICE(dev), &s->mmio);
420
- if (n == EXYNOS4210_COMBINER_GET_IRQ_NUM(1, 4) ||
344
+ TYPE_IMX2_WDT,
421
- n == EXYNOS4210_COMBINER_GET_IRQ_NUM(12, 4)) {
345
+ IMX2_WDT_MMIO_SIZE);
422
- /* MCT_G0 is passed to External GIC */
346
+ sysbus_init_mmio(sbd, &s->mmio);
423
- irq_id = EXT_GIC_ID_MCT_G0;
347
+ sysbus_init_irq(sbd, &s->irq);
424
- }
348
+
425
- if (n == EXYNOS4210_COMBINER_GET_IRQ_NUM(1, 5) ||
349
+ s->timer = ptimer_init(imx2_wdt_expired, s,
426
- n == EXYNOS4210_COMBINER_GET_IRQ_NUM(12, 5)) {
350
+ PTIMER_POLICY_NO_IMMEDIATE_TRIGGER |
427
- /* MCT_G1 is passed to External and GIC */
351
+ PTIMER_POLICY_NO_IMMEDIATE_RELOAD |
428
- irq_id = EXT_GIC_ID_MCT_G1;
352
+ PTIMER_POLICY_NO_COUNTER_ROUND_DOWN);
429
- }
353
+ ptimer_transaction_begin(s->timer);
430
- if (irq_id) {
354
+ ptimer_set_freq(s->timer, 2);
431
- s->irq_table[n] = qemu_irq_split(is->int_combiner_irq[n],
355
+ ptimer_set_limit(s->timer, 0xff, 1);
432
- is->ext_gic_irq[irq_id - 32]);
356
+ ptimer_transaction_commit(s->timer);
433
- } else {
357
+ if (s->pretimeout_support) {
434
- s->irq_table[n] = qemu_irq_split(is->int_combiner_irq[n],
358
+ s->itimer = ptimer_init(imx2_wdt_interrupt, s,
435
- is->ext_combiner_irq[n]);
359
+ PTIMER_POLICY_NO_IMMEDIATE_TRIGGER |
436
- }
360
+ PTIMER_POLICY_NO_IMMEDIATE_RELOAD |
437
- }
361
+ PTIMER_POLICY_NO_COUNTER_ROUND_DOWN);
438
- for (; n < EXYNOS4210_MAX_INT_COMBINER_IN_IRQ; n++) {
362
+ ptimer_transaction_begin(s->itimer);
439
- /* these IDs are passed to Internal Combiner and External GIC */
363
+ ptimer_set_freq(s->itimer, 2);
440
- grp = EXYNOS4210_COMBINER_GET_GRP_NUM(n);
364
+ ptimer_set_limit(s->itimer, 0xff, 1);
441
- bit = EXYNOS4210_COMBINER_GET_BIT_NUM(n);
365
+ ptimer_transaction_commit(s->itimer);
442
- irq_id = combiner_grp_to_gic_id[grp -
366
+ }
443
- EXYNOS4210_MAX_EXT_COMBINER_OUT_IRQ][bit];
367
}
444
-
368
445
- if (irq_id) {
369
+static Property imx2_wdt_properties[] = {
446
- s->irq_table[n] = qemu_irq_split(is->int_combiner_irq[n],
370
+ DEFINE_PROP_BOOL("pretimeout-support", IMX2WdtState, pretimeout_support,
447
- is->ext_gic_irq[irq_id - 32]);
371
+ false),
448
- }
372
+};
449
- }
373
+
450
-}
374
static void imx2_wdt_class_init(ObjectClass *klass, void *data)
451
-
375
{
452
-/*
376
DeviceClass *dc = DEVICE_CLASS(klass);
453
- * Get IRQ number from exynos4210 IRQ subsystem stub.
377
454
- * To identify IRQ source use internal combiner group and bit number
378
+ device_class_set_props(dc, imx2_wdt_properties);
455
- * grp - group number
379
dc->realize = imx2_wdt_realize;
456
- * bit - bit number inside group
380
+ dc->reset = imx2_wdt_reset;
457
- */
381
+ dc->vmsd = &vmstate_imx2_wdt;
458
-uint32_t exynos4210_get_irq(uint32_t grp, uint32_t bit)
382
+ dc->desc = "i.MX watchdog timer";
459
-{
383
set_bit(DEVICE_CATEGORY_MISC, dc->categories);
460
- return EXYNOS4210_COMBINER_GET_IRQ_NUM(grp, bit);
384
}
461
-}
462
-
463
-/********* GIC part *********/
464
-
465
#define TYPE_EXYNOS4210_GIC "exynos4210.gic"
466
OBJECT_DECLARE_SIMPLE_TYPE(Exynos4210GicState, EXYNOS4210_GIC)
385
467
386
--
468
--
387
2.20.1
469
2.25.1
388
389
diff view generated by jsdifflib
1
Provide a minimal documentation of the Musca boards.
1
Switch the creation of the external GIC to the new-style "embedded in
2
state struct" approach, so we can easily refer to the object
3
elsewhere during realize.
2
4
3
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
6
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
5
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
7
Message-id: 20220404154658.565020-9-peter.maydell@linaro.org
6
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
7
Message-id: 20200507151819.28444-6-peter.maydell@linaro.org
8
---
8
---
9
docs/system/arm/musca.rst | 31 +++++++++++++++++++++++++++++++
9
include/hw/arm/exynos4210.h | 2 ++
10
docs/system/target-arm.rst | 1 +
10
include/hw/intc/exynos4210_gic.h | 43 ++++++++++++++++++++++++++++++++
11
MAINTAINERS | 1 +
11
hw/arm/exynos4210.c | 10 ++++----
12
3 files changed, 33 insertions(+)
12
hw/intc/exynos4210_gic.c | 17 ++-----------
13
create mode 100644 docs/system/arm/musca.rst
13
MAINTAINERS | 2 +-
14
5 files changed, 53 insertions(+), 21 deletions(-)
15
create mode 100644 include/hw/intc/exynos4210_gic.h
14
16
15
diff --git a/docs/system/arm/musca.rst b/docs/system/arm/musca.rst
17
diff --git a/include/hw/arm/exynos4210.h b/include/hw/arm/exynos4210.h
18
index XXXXXXX..XXXXXXX 100644
19
--- a/include/hw/arm/exynos4210.h
20
+++ b/include/hw/arm/exynos4210.h
21
@@ -XXX,XX +XXX,XX @@
22
#include "hw/or-irq.h"
23
#include "hw/sysbus.h"
24
#include "hw/cpu/a9mpcore.h"
25
+#include "hw/intc/exynos4210_gic.h"
26
#include "target/arm/cpu-qom.h"
27
#include "qom/object.h"
28
29
@@ -XXX,XX +XXX,XX @@ struct Exynos4210State {
30
qemu_or_irq pl330_irq_orgate[EXYNOS4210_NUM_DMA];
31
qemu_or_irq cpu_irq_orgate[EXYNOS4210_NCPUS];
32
A9MPPrivState a9mpcore;
33
+ Exynos4210GicState ext_gic;
34
};
35
36
#define TYPE_EXYNOS4210_SOC "exynos4210"
37
diff --git a/include/hw/intc/exynos4210_gic.h b/include/hw/intc/exynos4210_gic.h
16
new file mode 100644
38
new file mode 100644
17
index XXXXXXX..XXXXXXX
39
index XXXXXXX..XXXXXXX
18
--- /dev/null
40
--- /dev/null
19
+++ b/docs/system/arm/musca.rst
41
+++ b/include/hw/intc/exynos4210_gic.h
20
@@ -XXX,XX +XXX,XX @@
42
@@ -XXX,XX +XXX,XX @@
21
+Arm Musca boards (``musca-a``, ``musca-b1``)
43
+/*
22
+============================================
44
+ * Samsung exynos4210 GIC implementation. Based on hw/arm_gic.c
45
+ *
46
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd.
47
+ * All rights reserved.
48
+ *
49
+ * Evgeny Voevodin <e.voevodin@samsung.com>
50
+ *
51
+ * This program is free software; you can redistribute it and/or modify it
52
+ * under the terms of the GNU General Public License as published by the
53
+ * Free Software Foundation; either version 2 of the License, or (at your
54
+ * option) any later version.
55
+ *
56
+ * This program is distributed in the hope that it will be useful,
57
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
58
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
59
+ * See the GNU General Public License for more details.
60
+ *
61
+ * You should have received a copy of the GNU General Public License along
62
+ * with this program; if not, see <http://www.gnu.org/licenses/>.
63
+ */
64
+#ifndef HW_INTC_EXYNOS4210_GIC_H
65
+#define HW_INTC_EXYNOS4210_GIC_H
23
+
66
+
24
+The Arm Musca development boards are a reference implementation
67
+#include "hw/sysbus.h"
25
+of a system using the SSE-200 Subsystem for Embedded. They are
26
+dual Cortex-M33 systems.
27
+
68
+
28
+QEMU provides models of the A and B1 variants of this board.
69
+#define TYPE_EXYNOS4210_GIC "exynos4210.gic"
70
+OBJECT_DECLARE_SIMPLE_TYPE(Exynos4210GicState, EXYNOS4210_GIC)
29
+
71
+
30
+Unimplemented devices:
72
+#define EXYNOS4210_GIC_NCPUS 2
31
+
73
+
32
+- SPI
74
+struct Exynos4210GicState {
33
+- |I2C|
75
+ SysBusDevice parent_obj;
34
+- |I2S|
35
+- PWM
36
+- QSPI
37
+- Timer
38
+- SCC
39
+- GPIO
40
+- eFlash
41
+- MHU
42
+- PVT
43
+- SDIO
44
+- CryptoCell
45
+
76
+
46
+Note that (like the real hardware) the Musca-A machine is
77
+ MemoryRegion cpu_container;
47
+asymmetric: CPU 0 does not have the FPU or DSP extensions,
78
+ MemoryRegion dist_container;
48
+but CPU 1 does. Also like the real hardware, the memory maps
79
+ MemoryRegion cpu_alias[EXYNOS4210_GIC_NCPUS];
49
+for the A and B1 variants differ significantly, so guest
80
+ MemoryRegion dist_alias[EXYNOS4210_GIC_NCPUS];
50
+software must be built for the right variant.
81
+ uint32_t num_cpu;
82
+ DeviceState *gic;
83
+};
51
+
84
+
52
diff --git a/docs/system/target-arm.rst b/docs/system/target-arm.rst
85
+#endif
86
diff --git a/hw/arm/exynos4210.c b/hw/arm/exynos4210.c
53
index XXXXXXX..XXXXXXX 100644
87
index XXXXXXX..XXXXXXX 100644
54
--- a/docs/system/target-arm.rst
88
--- a/hw/arm/exynos4210.c
55
+++ b/docs/system/target-arm.rst
89
+++ b/hw/arm/exynos4210.c
56
@@ -XXX,XX +XXX,XX @@ undocumented; you can get a complete list by running
90
@@ -XXX,XX +XXX,XX @@ static void exynos4210_realize(DeviceState *socdev, Error **errp)
57
91
sysbus_create_simple("l2x0", EXYNOS4210_L2X0_BASE_ADDR, NULL);
58
arm/integratorcp
92
59
arm/mps2
93
/* External GIC */
60
+ arm/musca
94
- dev = qdev_new("exynos4210.gic");
61
arm/realview
95
- qdev_prop_set_uint32(dev, "num-cpu", EXYNOS4210_NCPUS);
62
arm/versatile
96
- busdev = SYS_BUS_DEVICE(dev);
63
arm/vexpress
97
- sysbus_realize_and_unref(busdev, &error_fatal);
98
+ qdev_prop_set_uint32(DEVICE(&s->ext_gic), "num-cpu", EXYNOS4210_NCPUS);
99
+ busdev = SYS_BUS_DEVICE(&s->ext_gic);
100
+ sysbus_realize(busdev, &error_fatal);
101
/* Map CPU interface */
102
sysbus_mmio_map(busdev, 0, EXYNOS4210_EXT_GIC_CPU_BASE_ADDR);
103
/* Map Distributer interface */
104
@@ -XXX,XX +XXX,XX @@ static void exynos4210_realize(DeviceState *socdev, Error **errp)
105
qdev_get_gpio_in(DEVICE(&s->cpu_irq_orgate[n]), 1));
106
}
107
for (n = 0; n < EXYNOS4210_EXT_GIC_NIRQ; n++) {
108
- s->irqs.ext_gic_irq[n] = qdev_get_gpio_in(dev, n);
109
+ s->irqs.ext_gic_irq[n] = qdev_get_gpio_in(DEVICE(&s->ext_gic), n);
110
}
111
112
/* Internal Interrupt Combiner */
113
@@ -XXX,XX +XXX,XX @@ static void exynos4210_init(Object *obj)
114
}
115
116
object_initialize_child(obj, "a9mpcore", &s->a9mpcore, TYPE_A9MPCORE_PRIV);
117
+ object_initialize_child(obj, "ext-gic", &s->ext_gic, TYPE_EXYNOS4210_GIC);
118
}
119
120
static void exynos4210_class_init(ObjectClass *klass, void *data)
121
diff --git a/hw/intc/exynos4210_gic.c b/hw/intc/exynos4210_gic.c
122
index XXXXXXX..XXXXXXX 100644
123
--- a/hw/intc/exynos4210_gic.c
124
+++ b/hw/intc/exynos4210_gic.c
125
@@ -XXX,XX +XXX,XX @@
126
#include "qemu/module.h"
127
#include "hw/irq.h"
128
#include "hw/qdev-properties.h"
129
+#include "hw/intc/exynos4210_gic.h"
130
#include "hw/arm/exynos4210.h"
131
#include "qom/object.h"
132
133
@@ -XXX,XX +XXX,XX @@
134
#define EXYNOS4210_GIC_CPU_REGION_SIZE 0x100
135
#define EXYNOS4210_GIC_DIST_REGION_SIZE 0x1000
136
137
-#define TYPE_EXYNOS4210_GIC "exynos4210.gic"
138
-OBJECT_DECLARE_SIMPLE_TYPE(Exynos4210GicState, EXYNOS4210_GIC)
139
-
140
-struct Exynos4210GicState {
141
- SysBusDevice parent_obj;
142
-
143
- MemoryRegion cpu_container;
144
- MemoryRegion dist_container;
145
- MemoryRegion cpu_alias[EXYNOS4210_NCPUS];
146
- MemoryRegion dist_alias[EXYNOS4210_NCPUS];
147
- uint32_t num_cpu;
148
- DeviceState *gic;
149
-};
150
-
151
static void exynos4210_gic_set_irq(void *opaque, int irq, int level)
152
{
153
Exynos4210GicState *s = (Exynos4210GicState *)opaque;
154
@@ -XXX,XX +XXX,XX @@ static void exynos4210_gic_realize(DeviceState *dev, Error **errp)
155
* enough room for the cpu numbers. gcc 9.2.1 on 32-bit x86
156
* doesn't figure this out, otherwise and gives spurious warnings.
157
*/
158
- assert(n <= EXYNOS4210_NCPUS);
159
+ assert(n <= EXYNOS4210_GIC_NCPUS);
160
for (i = 0; i < n; i++) {
161
/* Map CPU interface per SMP Core */
162
sprintf(cpu_alias_name, "%s%x", cpu_prefix, i);
64
diff --git a/MAINTAINERS b/MAINTAINERS
163
diff --git a/MAINTAINERS b/MAINTAINERS
65
index XXXXXXX..XXXXXXX 100644
164
index XXXXXXX..XXXXXXX 100644
66
--- a/MAINTAINERS
165
--- a/MAINTAINERS
67
+++ b/MAINTAINERS
166
+++ b/MAINTAINERS
68
@@ -XXX,XX +XXX,XX @@ M: Peter Maydell <peter.maydell@linaro.org>
167
@@ -XXX,XX +XXX,XX @@ M: Peter Maydell <peter.maydell@linaro.org>
69
L: qemu-arm@nongnu.org
168
L: qemu-arm@nongnu.org
70
S: Maintained
169
S: Odd Fixes
71
F: hw/arm/musca.c
170
F: hw/*/exynos*
72
+F: docs/system/arm/musca.rst
171
-F: include/hw/arm/exynos4210.h
73
172
+F: include/hw/*/exynos*
74
Musicpal
173
75
M: Jan Kiszka <jan.kiszka@web.de>
174
Calxeda Highbank
175
M: Rob Herring <robh@kernel.org>
76
--
176
--
77
2.20.1
177
2.25.1
78
79
diff view generated by jsdifflib
1
Our code to identify syscall numbers has some issues:
1
The only time we use the ext_gic_irq[] array in the Exynos4210Irq
2
* for Thumb mode, we never need the immediate value from the insn,
2
struct is during realize of the SoC -- we initialize it with the
3
but we always read it anyway
3
input IRQs of the external GIC device, and then connect those to
4
* bad immediate values in the svc insn should cause a SIGILL, but we
4
outputs of other devices further on in realize (including in the
5
were abort()ing instead (via "goto error")
5
exynos4210_init_board_irqs() function). Now that the ext_gic object
6
6
is easily accessible as s->ext_gic we can make the connections
7
We can fix both these things by refactoring the code that identifies
7
directly from one device to the other without going via this array.
8
the syscall number to more closely follow the kernel COMPAT_OABI code:
9
* for Thumb it is always r7
10
* for Arm, if the immediate value is 0, then this is an EABI call
11
with the syscall number in r7
12
* otherwise, we XOR the immediate value with 0x900000
13
(ARM_SYSCALL_BASE for QEMU; __NR_OABI_SYSCALL_BASE in the kernel),
14
which converts valid syscall immediates into the desired value,
15
and puts all invalid immediates in the range 0x100000 or above
16
* then we can just let the existing "value too large, deliver
17
SIGILL" case handle invalid numbers, and drop the 'goto error'
18
8
19
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
20
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
10
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
21
Message-id: 20200420212206.12776-5-peter.maydell@linaro.org
11
Message-id: 20220404154658.565020-10-peter.maydell@linaro.org
22
---
12
---
23
linux-user/arm/cpu_loop.c | 143 ++++++++++++++++++++------------------
13
include/hw/arm/exynos4210.h | 1 -
24
1 file changed, 77 insertions(+), 66 deletions(-)
14
hw/arm/exynos4210.c | 12 ++++++------
15
2 files changed, 6 insertions(+), 7 deletions(-)
25
16
26
diff --git a/linux-user/arm/cpu_loop.c b/linux-user/arm/cpu_loop.c
17
diff --git a/include/hw/arm/exynos4210.h b/include/hw/arm/exynos4210.h
27
index XXXXXXX..XXXXXXX 100644
18
index XXXXXXX..XXXXXXX 100644
28
--- a/linux-user/arm/cpu_loop.c
19
--- a/include/hw/arm/exynos4210.h
29
+++ b/linux-user/arm/cpu_loop.c
20
+++ b/include/hw/arm/exynos4210.h
30
@@ -XXX,XX +XXX,XX @@ void cpu_loop(CPUARMState *env)
21
@@ -XXX,XX +XXX,XX @@
31
env->eabi = 1;
22
typedef struct Exynos4210Irq {
32
/* system call */
23
qemu_irq int_combiner_irq[EXYNOS4210_MAX_INT_COMBINER_IN_IRQ];
33
if (env->thumb) {
24
qemu_irq ext_combiner_irq[EXYNOS4210_MAX_EXT_COMBINER_IN_IRQ];
34
- /* FIXME - what to do if get_user() fails? */
25
- qemu_irq ext_gic_irq[EXYNOS4210_EXT_GIC_NIRQ];
35
- get_user_code_u16(insn, env->regs[15] - 2, env);
26
} Exynos4210Irq;
36
- n = insn & 0xff;
27
37
+ /* Thumb is always EABI style with syscall number in r7 */
28
struct Exynos4210State {
38
+ n = env->regs[7];
29
diff --git a/hw/arm/exynos4210.c b/hw/arm/exynos4210.c
39
} else {
30
index XXXXXXX..XXXXXXX 100644
40
+ /*
31
--- a/hw/arm/exynos4210.c
41
+ * Equivalent of kernel CONFIG_OABI_COMPAT: read the
32
+++ b/hw/arm/exynos4210.c
42
+ * Arm SVC insn to extract the immediate, which is the
33
@@ -XXX,XX +XXX,XX @@ static void exynos4210_init_board_irqs(Exynos4210State *s)
43
+ * syscall number in OABI.
34
{
44
+ */
35
uint32_t grp, bit, irq_id, n;
45
/* FIXME - what to do if get_user() fails? */
36
Exynos4210Irq *is = &s->irqs;
46
get_user_code_u32(insn, env->regs[15] - 4, env);
37
+ DeviceState *extgicdev = DEVICE(&s->ext_gic);
47
n = insn & 0xffffff;
38
48
- }
39
for (n = 0; n < EXYNOS4210_MAX_EXT_COMBINER_IN_IRQ; n++) {
49
-
40
irq_id = 0;
50
- if (n == 0 || n >= ARM_SYSCALL_BASE || env->thumb) {
41
@@ -XXX,XX +XXX,XX @@ static void exynos4210_init_board_irqs(Exynos4210State *s)
51
- /* linux syscall */
42
}
52
- if (env->thumb || n == 0) {
43
if (irq_id) {
53
+ if (n == 0) {
44
s->irq_table[n] = qemu_irq_split(is->int_combiner_irq[n],
54
+ /* zero immediate: EABI, syscall number in r7 */
45
- is->ext_gic_irq[irq_id - 32]);
55
n = env->regs[7];
46
+ qdev_get_gpio_in(extgicdev,
56
} else {
47
+ irq_id - 32));
57
- n -= ARM_SYSCALL_BASE;
48
} else {
58
+ /*
49
s->irq_table[n] = qemu_irq_split(is->int_combiner_irq[n],
59
+ * This XOR matches the kernel code: an immediate
50
is->ext_combiner_irq[n]);
60
+ * in the valid range (0x900000 .. 0x9fffff) is
51
@@ -XXX,XX +XXX,XX @@ static void exynos4210_init_board_irqs(Exynos4210State *s)
61
+ * converted into the correct EABI-style syscall
52
62
+ * number; invalid immediates end up as values
53
if (irq_id) {
63
+ * > 0xfffff and are handled below as out-of-range.
54
s->irq_table[n] = qemu_irq_split(is->int_combiner_irq[n],
64
+ */
55
- is->ext_gic_irq[irq_id - 32]);
65
+ n ^= ARM_SYSCALL_BASE;
56
+ qdev_get_gpio_in(extgicdev,
66
env->eabi = 0;
57
+ irq_id - 32));
67
}
58
}
68
- if ( n > ARM_NR_BASE) {
59
}
69
- switch (n) {
60
}
70
- case ARM_NR_cacheflush:
61
@@ -XXX,XX +XXX,XX @@ static void exynos4210_realize(DeviceState *socdev, Error **errp)
71
- /* nop */
62
sysbus_connect_irq(busdev, n,
72
- break;
63
qdev_get_gpio_in(DEVICE(&s->cpu_irq_orgate[n]), 1));
73
- case ARM_NR_set_tls:
64
}
74
- cpu_set_tls(env, env->regs[0]);
65
- for (n = 0; n < EXYNOS4210_EXT_GIC_NIRQ; n++) {
75
- env->regs[0] = 0;
66
- s->irqs.ext_gic_irq[n] = qdev_get_gpio_in(DEVICE(&s->ext_gic), n);
76
- break;
67
- }
77
- case ARM_NR_breakpoint:
68
78
- env->regs[15] -= env->thumb ? 2 : 4;
69
/* Internal Interrupt Combiner */
79
- goto excp_debug;
70
dev = qdev_new("exynos4210.combiner");
80
- case ARM_NR_get_tls:
71
@@ -XXX,XX +XXX,XX @@ static void exynos4210_realize(DeviceState *socdev, Error **errp)
81
- env->regs[0] = cpu_get_tls(env);
72
busdev = SYS_BUS_DEVICE(dev);
82
- break;
73
sysbus_realize_and_unref(busdev, &error_fatal);
83
- default:
74
for (n = 0; n < EXYNOS4210_MAX_INT_COMBINER_OUT_IRQ; n++) {
84
- if (n < 0xf0800) {
75
- sysbus_connect_irq(busdev, n, s->irqs.ext_gic_irq[n]);
85
- /*
76
+ sysbus_connect_irq(busdev, n, qdev_get_gpio_in(DEVICE(&s->ext_gic), n));
86
- * Syscalls 0xf0000..0xf07ff (or 0x9f0000..
77
}
87
- * 0x9f07ff in OABI numbering) are defined
78
exynos4210_combiner_get_gpioin(&s->irqs, dev, 1);
88
- * to return -ENOSYS rather than raising
79
sysbus_mmio_map(busdev, 0, EXYNOS4210_EXT_COMBINER_BASE_ADDR);
89
- * SIGILL. Note that we have already
90
- * removed the 0x900000 prefix.
91
- */
92
- qemu_log_mask(LOG_UNIMP,
93
- "qemu: Unsupported ARM syscall: 0x%x\n",
94
- n);
95
- env->regs[0] = -TARGET_ENOSYS;
96
+ }
97
+
98
+ if (n > ARM_NR_BASE) {
99
+ switch (n) {
100
+ case ARM_NR_cacheflush:
101
+ /* nop */
102
+ break;
103
+ case ARM_NR_set_tls:
104
+ cpu_set_tls(env, env->regs[0]);
105
+ env->regs[0] = 0;
106
+ break;
107
+ case ARM_NR_breakpoint:
108
+ env->regs[15] -= env->thumb ? 2 : 4;
109
+ goto excp_debug;
110
+ case ARM_NR_get_tls:
111
+ env->regs[0] = cpu_get_tls(env);
112
+ break;
113
+ default:
114
+ if (n < 0xf0800) {
115
+ /*
116
+ * Syscalls 0xf0000..0xf07ff (or 0x9f0000..
117
+ * 0x9f07ff in OABI numbering) are defined
118
+ * to return -ENOSYS rather than raising
119
+ * SIGILL. Note that we have already
120
+ * removed the 0x900000 prefix.
121
+ */
122
+ qemu_log_mask(LOG_UNIMP,
123
+ "qemu: Unsupported ARM syscall: 0x%x\n",
124
+ n);
125
+ env->regs[0] = -TARGET_ENOSYS;
126
+ } else {
127
+ /*
128
+ * Otherwise SIGILL. This includes any SWI with
129
+ * immediate not originally 0x9fxxxx, because
130
+ * of the earlier XOR.
131
+ */
132
+ info.si_signo = TARGET_SIGILL;
133
+ info.si_errno = 0;
134
+ info.si_code = TARGET_ILL_ILLTRP;
135
+ info._sifields._sigfault._addr = env->regs[15];
136
+ if (env->thumb) {
137
+ info._sifields._sigfault._addr -= 2;
138
} else {
139
- /* Otherwise SIGILL */
140
- info.si_signo = TARGET_SIGILL;
141
- info.si_errno = 0;
142
- info.si_code = TARGET_ILL_ILLTRP;
143
- info._sifields._sigfault._addr = env->regs[15];
144
- if (env->thumb) {
145
- info._sifields._sigfault._addr -= 2;
146
- } else {
147
- info._sifields._sigfault._addr -= 4;
148
- }
149
- queue_signal(env, info.si_signo,
150
- QEMU_SI_FAULT, &info);
151
+ info._sifields._sigfault._addr -= 4;
152
}
153
- break;
154
- }
155
- } else {
156
- ret = do_syscall(env,
157
- n,
158
- env->regs[0],
159
- env->regs[1],
160
- env->regs[2],
161
- env->regs[3],
162
- env->regs[4],
163
- env->regs[5],
164
- 0, 0);
165
- if (ret == -TARGET_ERESTARTSYS) {
166
- env->regs[15] -= env->thumb ? 2 : 4;
167
- } else if (ret != -TARGET_QEMU_ESIGRETURN) {
168
- env->regs[0] = ret;
169
+ queue_signal(env, info.si_signo,
170
+ QEMU_SI_FAULT, &info);
171
}
172
+ break;
173
}
174
} else {
175
- goto error;
176
+ ret = do_syscall(env,
177
+ n,
178
+ env->regs[0],
179
+ env->regs[1],
180
+ env->regs[2],
181
+ env->regs[3],
182
+ env->regs[4],
183
+ env->regs[5],
184
+ 0, 0);
185
+ if (ret == -TARGET_ERESTARTSYS) {
186
+ env->regs[15] -= env->thumb ? 2 : 4;
187
+ } else if (ret != -TARGET_QEMU_ESIGRETURN) {
188
+ env->regs[0] = ret;
189
+ }
190
}
191
}
192
break;
193
--
80
--
194
2.20.1
81
2.25.1
195
196
diff view generated by jsdifflib
1
The Arm signal-handling code has some parts ifdeffed with a
1
The function exynos4210_combiner_get_gpioin() currently lives in
2
TARGET_CONFIG_CPU_32, which is always defined. This is a leftover
2
exynos4210_combiner.c, but it isn't really part of the combiner
3
from when this code's structure was based on the Linux kernel
3
device itself -- it is a function that implements the wiring up of
4
signal handling code, where it was intended to support 26-bit
4
some interrupt sources to multiple combiner inputs. Move it to live
5
Arm CPUs. The kernel dropped its CONFIG_CPU_32 in kernel commit
5
with the other SoC-level code in exynos4210.c, along with a few
6
4da8b8208eded0ba21e3 in 2009.
6
macros previously defined in exynos4210.h which are now used only
7
7
in exynos4210.c.
8
QEMU has never had 26-bit CPU support and is unlikely to ever
9
add it; we certainly aren't going to support 26-bit Linux
10
binaries via linux-user mode. The ifdef is just unhelpful
11
noise, so remove it entirely.
12
8
13
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
14
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
10
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
15
Message-id: 20200518143014.20689-1-peter.maydell@linaro.org
11
Message-id: 20220404154658.565020-11-peter.maydell@linaro.org
16
---
12
---
17
linux-user/arm/signal.c | 6 ------
13
include/hw/arm/exynos4210.h | 11 -----
18
1 file changed, 6 deletions(-)
14
hw/arm/exynos4210.c | 82 +++++++++++++++++++++++++++++++++++
15
hw/intc/exynos4210_combiner.c | 77 --------------------------------
16
3 files changed, 82 insertions(+), 88 deletions(-)
19
17
20
diff --git a/linux-user/arm/signal.c b/linux-user/arm/signal.c
18
diff --git a/include/hw/arm/exynos4210.h b/include/hw/arm/exynos4210.h
21
index XXXXXXX..XXXXXXX 100644
19
index XXXXXXX..XXXXXXX 100644
22
--- a/linux-user/arm/signal.c
20
--- a/include/hw/arm/exynos4210.h
23
+++ b/linux-user/arm/signal.c
21
+++ b/include/hw/arm/exynos4210.h
24
@@ -XXX,XX +XXX,XX @@ struct rt_sigframe_v2
22
@@ -XXX,XX +XXX,XX @@
25
abi_ulong retcode[4];
23
#define EXYNOS4210_MAX_EXT_COMBINER_IN_IRQ \
24
(EXYNOS4210_MAX_EXT_COMBINER_OUT_IRQ * 8)
25
26
-#define EXYNOS4210_COMBINER_GET_IRQ_NUM(grp, bit) ((grp)*8 + (bit))
27
-#define EXYNOS4210_COMBINER_GET_GRP_NUM(irq) ((irq) / 8)
28
-#define EXYNOS4210_COMBINER_GET_BIT_NUM(irq) \
29
- ((irq) - 8 * EXYNOS4210_COMBINER_GET_GRP_NUM(irq))
30
-
31
/* IRQs number for external and internal GIC */
32
#define EXYNOS4210_EXT_GIC_NIRQ (160-32)
33
#define EXYNOS4210_INT_GIC_NIRQ 64
34
@@ -XXX,XX +XXX,XX @@ void exynos4210_write_secondary(ARMCPU *cpu,
35
* bit - bit number inside group */
36
uint32_t exynos4210_get_irq(uint32_t grp, uint32_t bit);
37
38
-/*
39
- * Get Combiner input GPIO into irqs structure
40
- */
41
-void exynos4210_combiner_get_gpioin(Exynos4210Irq *irqs, DeviceState *dev,
42
- int ext);
43
-
44
/*
45
* exynos4210 UART
46
*/
47
diff --git a/hw/arm/exynos4210.c b/hw/arm/exynos4210.c
48
index XXXXXXX..XXXXXXX 100644
49
--- a/hw/arm/exynos4210.c
50
+++ b/hw/arm/exynos4210.c
51
@@ -XXX,XX +XXX,XX @@ combiner_grp_to_gic_id[64 - EXYNOS4210_MAX_EXT_COMBINER_OUT_IRQ][8] = {
52
{ }, { }, { }, { }, { }, { }, { }, { }, { }, { }
26
};
53
};
27
54
28
-#define TARGET_CONFIG_CPU_32 1
55
+#define EXYNOS4210_COMBINER_GET_IRQ_NUM(grp, bit) ((grp) * 8 + (bit))
29
-
56
+#define EXYNOS4210_COMBINER_GET_GRP_NUM(irq) ((irq) / 8)
57
+#define EXYNOS4210_COMBINER_GET_BIT_NUM(irq) \
58
+ ((irq) - 8 * EXYNOS4210_COMBINER_GET_GRP_NUM(irq))
59
+
30
/*
60
/*
31
* For ARM syscalls, we encode the syscall number into the instruction.
61
* Initialize board IRQs.
32
*/
62
* These IRQs contain splitted Int/External Combiner and External Gic IRQs.
33
@@ -XXX,XX +XXX,XX @@ setup_sigcontext(struct target_sigcontext *sc, /*struct _fpstate *fpstate,*/
63
@@ -XXX,XX +XXX,XX @@ uint32_t exynos4210_get_irq(uint32_t grp, uint32_t bit)
34
__put_user(env->regs[13], &sc->arm_sp);
64
return EXYNOS4210_COMBINER_GET_IRQ_NUM(grp, bit);
35
__put_user(env->regs[14], &sc->arm_lr);
65
}
36
__put_user(env->regs[15], &sc->arm_pc);
66
37
-#ifdef TARGET_CONFIG_CPU_32
67
+/*
38
__put_user(cpsr_read(env), &sc->arm_cpsr);
68
+ * Get Combiner input GPIO into irqs structure
39
-#endif
69
+ */
40
70
+static void exynos4210_combiner_get_gpioin(Exynos4210Irq *irqs,
41
__put_user(/* current->thread.trap_no */ 0, &sc->trap_no);
71
+ DeviceState *dev, int ext)
42
__put_user(/* current->thread.error_code */ 0, &sc->error_code);
72
+{
43
@@ -XXX,XX +XXX,XX @@ restore_sigcontext(CPUARMState *env, struct target_sigcontext *sc)
73
+ int n;
44
__get_user(env->regs[13], &sc->arm_sp);
74
+ int bit;
45
__get_user(env->regs[14], &sc->arm_lr);
75
+ int max;
46
__get_user(env->regs[15], &sc->arm_pc);
76
+ qemu_irq *irq;
47
-#ifdef TARGET_CONFIG_CPU_32
77
+
48
__get_user(cpsr, &sc->arm_cpsr);
78
+ max = ext ? EXYNOS4210_MAX_EXT_COMBINER_IN_IRQ :
49
cpsr_write(env, cpsr, CPSR_USER | CPSR_EXEC, CPSRWriteByInstr);
79
+ EXYNOS4210_MAX_INT_COMBINER_IN_IRQ;
50
arm_rebuild_hflags(env);
80
+ irq = ext ? irqs->ext_combiner_irq : irqs->int_combiner_irq;
51
-#endif
81
+
52
82
+ /*
53
err |= !valid_user_regs(env);
83
+ * Some IRQs of Int/External Combiner are going to two Combiners groups,
54
84
+ * so let split them.
85
+ */
86
+ for (n = 0; n < max; n++) {
87
+
88
+ bit = EXYNOS4210_COMBINER_GET_BIT_NUM(n);
89
+
90
+ switch (n) {
91
+ /* MDNIE_LCD1 INTG1 */
92
+ case EXYNOS4210_COMBINER_GET_IRQ_NUM(1, 0) ...
93
+ EXYNOS4210_COMBINER_GET_IRQ_NUM(1, 3):
94
+ irq[n] = qemu_irq_split(qdev_get_gpio_in(dev, n),
95
+ irq[EXYNOS4210_COMBINER_GET_IRQ_NUM(0, bit + 4)]);
96
+ continue;
97
+
98
+ /* TMU INTG3 */
99
+ case EXYNOS4210_COMBINER_GET_IRQ_NUM(3, 4):
100
+ irq[n] = qemu_irq_split(qdev_get_gpio_in(dev, n),
101
+ irq[EXYNOS4210_COMBINER_GET_IRQ_NUM(2, bit)]);
102
+ continue;
103
+
104
+ /* LCD1 INTG12 */
105
+ case EXYNOS4210_COMBINER_GET_IRQ_NUM(12, 0) ...
106
+ EXYNOS4210_COMBINER_GET_IRQ_NUM(12, 3):
107
+ irq[n] = qemu_irq_split(qdev_get_gpio_in(dev, n),
108
+ irq[EXYNOS4210_COMBINER_GET_IRQ_NUM(11, bit + 4)]);
109
+ continue;
110
+
111
+ /* Multi-Core Timer INTG12 */
112
+ case EXYNOS4210_COMBINER_GET_IRQ_NUM(12, 4) ...
113
+ EXYNOS4210_COMBINER_GET_IRQ_NUM(12, 8):
114
+ irq[n] = qemu_irq_split(qdev_get_gpio_in(dev, n),
115
+ irq[EXYNOS4210_COMBINER_GET_IRQ_NUM(1, bit + 4)]);
116
+ continue;
117
+
118
+ /* Multi-Core Timer INTG35 */
119
+ case EXYNOS4210_COMBINER_GET_IRQ_NUM(35, 4) ...
120
+ EXYNOS4210_COMBINER_GET_IRQ_NUM(35, 8):
121
+ irq[n] = qemu_irq_split(qdev_get_gpio_in(dev, n),
122
+ irq[EXYNOS4210_COMBINER_GET_IRQ_NUM(1, bit + 4)]);
123
+ continue;
124
+
125
+ /* Multi-Core Timer INTG51 */
126
+ case EXYNOS4210_COMBINER_GET_IRQ_NUM(51, 4) ...
127
+ EXYNOS4210_COMBINER_GET_IRQ_NUM(51, 8):
128
+ irq[n] = qemu_irq_split(qdev_get_gpio_in(dev, n),
129
+ irq[EXYNOS4210_COMBINER_GET_IRQ_NUM(1, bit + 4)]);
130
+ continue;
131
+
132
+ /* Multi-Core Timer INTG53 */
133
+ case EXYNOS4210_COMBINER_GET_IRQ_NUM(53, 4) ...
134
+ EXYNOS4210_COMBINER_GET_IRQ_NUM(53, 8):
135
+ irq[n] = qemu_irq_split(qdev_get_gpio_in(dev, n),
136
+ irq[EXYNOS4210_COMBINER_GET_IRQ_NUM(1, bit + 4)]);
137
+ continue;
138
+ }
139
+
140
+ irq[n] = qdev_get_gpio_in(dev, n);
141
+ }
142
+}
143
+
144
static uint8_t chipid_and_omr[] = { 0x11, 0x02, 0x21, 0x43,
145
0x09, 0x00, 0x00, 0x00 };
146
147
diff --git a/hw/intc/exynos4210_combiner.c b/hw/intc/exynos4210_combiner.c
148
index XXXXXXX..XXXXXXX 100644
149
--- a/hw/intc/exynos4210_combiner.c
150
+++ b/hw/intc/exynos4210_combiner.c
151
@@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_exynos4210_combiner = {
152
}
153
};
154
155
-/*
156
- * Get Combiner input GPIO into irqs structure
157
- */
158
-void exynos4210_combiner_get_gpioin(Exynos4210Irq *irqs, DeviceState *dev,
159
- int ext)
160
-{
161
- int n;
162
- int bit;
163
- int max;
164
- qemu_irq *irq;
165
-
166
- max = ext ? EXYNOS4210_MAX_EXT_COMBINER_IN_IRQ :
167
- EXYNOS4210_MAX_INT_COMBINER_IN_IRQ;
168
- irq = ext ? irqs->ext_combiner_irq : irqs->int_combiner_irq;
169
-
170
- /*
171
- * Some IRQs of Int/External Combiner are going to two Combiners groups,
172
- * so let split them.
173
- */
174
- for (n = 0; n < max; n++) {
175
-
176
- bit = EXYNOS4210_COMBINER_GET_BIT_NUM(n);
177
-
178
- switch (n) {
179
- /* MDNIE_LCD1 INTG1 */
180
- case EXYNOS4210_COMBINER_GET_IRQ_NUM(1, 0) ...
181
- EXYNOS4210_COMBINER_GET_IRQ_NUM(1, 3):
182
- irq[n] = qemu_irq_split(qdev_get_gpio_in(dev, n),
183
- irq[EXYNOS4210_COMBINER_GET_IRQ_NUM(0, bit + 4)]);
184
- continue;
185
-
186
- /* TMU INTG3 */
187
- case EXYNOS4210_COMBINER_GET_IRQ_NUM(3, 4):
188
- irq[n] = qemu_irq_split(qdev_get_gpio_in(dev, n),
189
- irq[EXYNOS4210_COMBINER_GET_IRQ_NUM(2, bit)]);
190
- continue;
191
-
192
- /* LCD1 INTG12 */
193
- case EXYNOS4210_COMBINER_GET_IRQ_NUM(12, 0) ...
194
- EXYNOS4210_COMBINER_GET_IRQ_NUM(12, 3):
195
- irq[n] = qemu_irq_split(qdev_get_gpio_in(dev, n),
196
- irq[EXYNOS4210_COMBINER_GET_IRQ_NUM(11, bit + 4)]);
197
- continue;
198
-
199
- /* Multi-Core Timer INTG12 */
200
- case EXYNOS4210_COMBINER_GET_IRQ_NUM(12, 4) ...
201
- EXYNOS4210_COMBINER_GET_IRQ_NUM(12, 8):
202
- irq[n] = qemu_irq_split(qdev_get_gpio_in(dev, n),
203
- irq[EXYNOS4210_COMBINER_GET_IRQ_NUM(1, bit + 4)]);
204
- continue;
205
-
206
- /* Multi-Core Timer INTG35 */
207
- case EXYNOS4210_COMBINER_GET_IRQ_NUM(35, 4) ...
208
- EXYNOS4210_COMBINER_GET_IRQ_NUM(35, 8):
209
- irq[n] = qemu_irq_split(qdev_get_gpio_in(dev, n),
210
- irq[EXYNOS4210_COMBINER_GET_IRQ_NUM(1, bit + 4)]);
211
- continue;
212
-
213
- /* Multi-Core Timer INTG51 */
214
- case EXYNOS4210_COMBINER_GET_IRQ_NUM(51, 4) ...
215
- EXYNOS4210_COMBINER_GET_IRQ_NUM(51, 8):
216
- irq[n] = qemu_irq_split(qdev_get_gpio_in(dev, n),
217
- irq[EXYNOS4210_COMBINER_GET_IRQ_NUM(1, bit + 4)]);
218
- continue;
219
-
220
- /* Multi-Core Timer INTG53 */
221
- case EXYNOS4210_COMBINER_GET_IRQ_NUM(53, 4) ...
222
- EXYNOS4210_COMBINER_GET_IRQ_NUM(53, 8):
223
- irq[n] = qemu_irq_split(qdev_get_gpio_in(dev, n),
224
- irq[EXYNOS4210_COMBINER_GET_IRQ_NUM(1, bit + 4)]);
225
- continue;
226
- }
227
-
228
- irq[n] = qdev_get_gpio_in(dev, n);
229
- }
230
-}
231
-
232
static uint64_t
233
exynos4210_combiner_read(void *opaque, hwaddr offset, unsigned size)
234
{
55
--
235
--
56
2.20.1
236
2.25.1
57
58
diff view generated by jsdifflib
1
The kernel has different handling for syscalls with invalid
1
Delete a couple of #defines which are never used.
2
numbers that are in the "arm-specific" range 0x9f0000 and up:
3
* 0x9f0000..0x9f07ff return -ENOSYS if not implemented
4
* other out of range syscalls cause a SIGILL
5
(see the kernel's arch/arm/kernel/traps.c:arm_syscall())
6
7
Implement this distinction. (Note that our code doesn't look
8
quite like the kernel's, because we have removed the
9
0x900000 prefix by this point, whereas the kernel retains
10
it in arm_syscall().)
11
2
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
3
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
4
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
14
Message-id: 20200420212206.12776-4-peter.maydell@linaro.org
5
Message-id: 20220404154658.565020-12-peter.maydell@linaro.org
15
---
6
---
16
linux-user/arm/cpu_loop.c | 30 ++++++++++++++++++++++++++----
7
include/hw/arm/exynos4210.h | 4 ----
17
1 file changed, 26 insertions(+), 4 deletions(-)
8
1 file changed, 4 deletions(-)
18
9
19
diff --git a/linux-user/arm/cpu_loop.c b/linux-user/arm/cpu_loop.c
10
diff --git a/include/hw/arm/exynos4210.h b/include/hw/arm/exynos4210.h
20
index XXXXXXX..XXXXXXX 100644
11
index XXXXXXX..XXXXXXX 100644
21
--- a/linux-user/arm/cpu_loop.c
12
--- a/include/hw/arm/exynos4210.h
22
+++ b/linux-user/arm/cpu_loop.c
13
+++ b/include/hw/arm/exynos4210.h
23
@@ -XXX,XX +XXX,XX @@ void cpu_loop(CPUARMState *env)
14
@@ -XXX,XX +XXX,XX @@
24
env->regs[0] = cpu_get_tls(env);
15
#define EXYNOS4210_MAX_EXT_COMBINER_IN_IRQ \
25
break;
16
(EXYNOS4210_MAX_EXT_COMBINER_OUT_IRQ * 8)
26
default:
17
27
- qemu_log_mask(LOG_UNIMP,
18
-/* IRQs number for external and internal GIC */
28
- "qemu: Unsupported ARM syscall: 0x%x\n",
19
-#define EXYNOS4210_EXT_GIC_NIRQ (160-32)
29
- n);
20
-#define EXYNOS4210_INT_GIC_NIRQ 64
30
- env->regs[0] = -TARGET_ENOSYS;
21
-
31
+ if (n < 0xf0800) {
22
#define EXYNOS4210_I2C_NUMBER 9
32
+ /*
23
33
+ * Syscalls 0xf0000..0xf07ff (or 0x9f0000..
24
#define EXYNOS4210_NUM_DMA 3
34
+ * 0x9f07ff in OABI numbering) are defined
35
+ * to return -ENOSYS rather than raising
36
+ * SIGILL. Note that we have already
37
+ * removed the 0x900000 prefix.
38
+ */
39
+ qemu_log_mask(LOG_UNIMP,
40
+ "qemu: Unsupported ARM syscall: 0x%x\n",
41
+ n);
42
+ env->regs[0] = -TARGET_ENOSYS;
43
+ } else {
44
+ /* Otherwise SIGILL */
45
+ info.si_signo = TARGET_SIGILL;
46
+ info.si_errno = 0;
47
+ info.si_code = TARGET_ILL_ILLTRP;
48
+ info._sifields._sigfault._addr = env->regs[15];
49
+ if (env->thumb) {
50
+ info._sifields._sigfault._addr -= 2;
51
+ } else {
52
+ info._sifields._sigfault._addr -= 4;
53
+ }
54
+ queue_signal(env, info.si_signo,
55
+ QEMU_SI_FAULT, &info);
56
+ }
57
break;
58
}
59
} else {
60
--
25
--
61
2.20.1
26
2.25.1
62
63
diff view generated by jsdifflib
1
From: Guenter Roeck <linux@roeck-us.net>
1
In exynos4210_init_board_irqs(), use the TYPE_SPLIT_IRQ device
2
instead of qemu_irq_split().
2
3
3
With this commit, the watchdog on imx25-pdk is fully operational,
4
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4
including pretimeout support.
5
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
6
Message-id: 20220404154658.565020-13-peter.maydell@linaro.org
7
---
8
include/hw/arm/exynos4210.h | 9 ++++++++
9
hw/arm/exynos4210.c | 41 +++++++++++++++++++++++++++++--------
10
2 files changed, 42 insertions(+), 8 deletions(-)
5
11
6
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
12
diff --git a/include/hw/arm/exynos4210.h b/include/hw/arm/exynos4210.h
7
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
8
Message-id: 20200517162135.110364-4-linux@roeck-us.net
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
---
11
include/hw/arm/fsl-imx25.h | 5 +++++
12
hw/arm/fsl-imx25.c | 10 ++++++++++
13
hw/arm/Kconfig | 1 +
14
3 files changed, 16 insertions(+)
15
16
diff --git a/include/hw/arm/fsl-imx25.h b/include/hw/arm/fsl-imx25.h
17
index XXXXXXX..XXXXXXX 100644
13
index XXXXXXX..XXXXXXX 100644
18
--- a/include/hw/arm/fsl-imx25.h
14
--- a/include/hw/arm/exynos4210.h
19
+++ b/include/hw/arm/fsl-imx25.h
15
+++ b/include/hw/arm/exynos4210.h
20
@@ -XXX,XX +XXX,XX @@
16
@@ -XXX,XX +XXX,XX @@
21
#include "hw/gpio/imx_gpio.h"
17
#include "hw/sysbus.h"
22
#include "hw/sd/sdhci.h"
18
#include "hw/cpu/a9mpcore.h"
23
#include "hw/usb/chipidea.h"
19
#include "hw/intc/exynos4210_gic.h"
24
+#include "hw/watchdog/wdt_imx2.h"
20
+#include "hw/core/split-irq.h"
25
#include "exec/memory.h"
21
#include "target/arm/cpu-qom.h"
26
#include "target/arm/cpu.h"
22
#include "qom/object.h"
27
23
28
@@ -XXX,XX +XXX,XX @@ typedef struct FslIMX25State {
24
@@ -XXX,XX +XXX,XX @@
29
IMXGPIOState gpio[FSL_IMX25_NUM_GPIOS];
25
30
SDHCIState esdhc[FSL_IMX25_NUM_ESDHCS];
26
#define EXYNOS4210_NUM_DMA 3
31
ChipideaState usb[FSL_IMX25_NUM_USBS];
27
32
+ IMX2WdtState wdt;
28
+/*
33
MemoryRegion rom[2];
29
+ * We need one splitter for every external combiner input, plus
34
MemoryRegion iram;
30
+ * one for every non-zero entry in combiner_grp_to_gic_id[].
35
MemoryRegion iram_alias;
31
+ * We'll assert in exynos4210_init_board_irqs() if this is wrong.
36
@@ -XXX,XX +XXX,XX @@ typedef struct FslIMX25State {
32
+ */
37
#define FSL_IMX25_GPIO1_SIZE 0x4000
33
+#define EXYNOS4210_NUM_SPLITTERS (EXYNOS4210_MAX_EXT_COMBINER_IN_IRQ + 60)
38
#define FSL_IMX25_GPIO2_ADDR 0x53FD0000
34
+
39
#define FSL_IMX25_GPIO2_SIZE 0x4000
35
typedef struct Exynos4210Irq {
40
+#define FSL_IMX25_WDT_ADDR 0x53FDC000
36
qemu_irq int_combiner_irq[EXYNOS4210_MAX_INT_COMBINER_IN_IRQ];
41
+#define FSL_IMX25_WDT_SIZE 0x4000
37
qemu_irq ext_combiner_irq[EXYNOS4210_MAX_EXT_COMBINER_IN_IRQ];
42
#define FSL_IMX25_USB1_ADDR 0x53FF4000
38
@@ -XXX,XX +XXX,XX @@ struct Exynos4210State {
43
#define FSL_IMX25_USB1_SIZE 0x0200
39
qemu_or_irq cpu_irq_orgate[EXYNOS4210_NCPUS];
44
#define FSL_IMX25_USB2_ADDR 0x53FF4400
40
A9MPPrivState a9mpcore;
45
@@ -XXX,XX +XXX,XX @@ typedef struct FslIMX25State {
41
Exynos4210GicState ext_gic;
46
#define FSL_IMX25_ESDHC2_IRQ 8
42
+ SplitIRQ splitter[EXYNOS4210_NUM_SPLITTERS];
47
#define FSL_IMX25_USB1_IRQ 37
43
};
48
#define FSL_IMX25_USB2_IRQ 35
44
49
+#define FSL_IMX25_WDT_IRQ 55
45
#define TYPE_EXYNOS4210_SOC "exynos4210"
50
46
diff --git a/hw/arm/exynos4210.c b/hw/arm/exynos4210.c
51
#endif /* FSL_IMX25_H */
52
diff --git a/hw/arm/fsl-imx25.c b/hw/arm/fsl-imx25.c
53
index XXXXXXX..XXXXXXX 100644
47
index XXXXXXX..XXXXXXX 100644
54
--- a/hw/arm/fsl-imx25.c
48
--- a/hw/arm/exynos4210.c
55
+++ b/hw/arm/fsl-imx25.c
49
+++ b/hw/arm/exynos4210.c
56
@@ -XXX,XX +XXX,XX @@ static void fsl_imx25_init(Object *obj)
50
@@ -XXX,XX +XXX,XX @@ static void exynos4210_init_board_irqs(Exynos4210State *s)
57
TYPE_CHIPIDEA);
51
uint32_t grp, bit, irq_id, n;
52
Exynos4210Irq *is = &s->irqs;
53
DeviceState *extgicdev = DEVICE(&s->ext_gic);
54
+ int splitcount = 0;
55
+ DeviceState *splitter;
56
57
for (n = 0; n < EXYNOS4210_MAX_EXT_COMBINER_IN_IRQ; n++) {
58
irq_id = 0;
59
@@ -XXX,XX +XXX,XX @@ static void exynos4210_init_board_irqs(Exynos4210State *s)
60
/* MCT_G1 is passed to External and GIC */
61
irq_id = EXT_GIC_ID_MCT_G1;
62
}
63
+
64
+ assert(splitcount < EXYNOS4210_NUM_SPLITTERS);
65
+ splitter = DEVICE(&s->splitter[splitcount]);
66
+ qdev_prop_set_uint16(splitter, "num-lines", 2);
67
+ qdev_realize(splitter, NULL, &error_abort);
68
+ splitcount++;
69
+ s->irq_table[n] = qdev_get_gpio_in(splitter, 0);
70
+ qdev_connect_gpio_out(splitter, 0, is->int_combiner_irq[n]);
71
if (irq_id) {
72
- s->irq_table[n] = qemu_irq_split(is->int_combiner_irq[n],
73
- qdev_get_gpio_in(extgicdev,
74
- irq_id - 32));
75
+ qdev_connect_gpio_out(splitter, 1,
76
+ qdev_get_gpio_in(extgicdev, irq_id - 32));
77
} else {
78
- s->irq_table[n] = qemu_irq_split(is->int_combiner_irq[n],
79
- is->ext_combiner_irq[n]);
80
+ qdev_connect_gpio_out(splitter, 1, is->ext_combiner_irq[n]);
81
}
58
}
82
}
59
83
for (; n < EXYNOS4210_MAX_INT_COMBINER_IN_IRQ; n++) {
60
+ sysbus_init_child_obj(obj, "wdt", &s->wdt, sizeof(s->wdt), TYPE_IMX2_WDT);
84
@@ -XXX,XX +XXX,XX @@ static void exynos4210_init_board_irqs(Exynos4210State *s)
85
EXYNOS4210_MAX_EXT_COMBINER_OUT_IRQ][bit];
86
87
if (irq_id) {
88
- s->irq_table[n] = qemu_irq_split(is->int_combiner_irq[n],
89
- qdev_get_gpio_in(extgicdev,
90
- irq_id - 32));
91
+ assert(splitcount < EXYNOS4210_NUM_SPLITTERS);
92
+ splitter = DEVICE(&s->splitter[splitcount]);
93
+ qdev_prop_set_uint16(splitter, "num-lines", 2);
94
+ qdev_realize(splitter, NULL, &error_abort);
95
+ splitcount++;
96
+ s->irq_table[n] = qdev_get_gpio_in(splitter, 0);
97
+ qdev_connect_gpio_out(splitter, 0, is->int_combiner_irq[n]);
98
+ qdev_connect_gpio_out(splitter, 1,
99
+ qdev_get_gpio_in(extgicdev, irq_id - 32));
100
}
101
}
102
+ /*
103
+ * We check this here to avoid a more obscure assert later when
104
+ * qdev_assert_realized_properly() checks that we realized every
105
+ * child object we initialized.
106
+ */
107
+ assert(splitcount == EXYNOS4210_NUM_SPLITTERS);
61
}
108
}
62
109
63
static void fsl_imx25_realize(DeviceState *dev, Error **errp)
110
/*
64
@@ -XXX,XX +XXX,XX @@ static void fsl_imx25_realize(DeviceState *dev, Error **errp)
111
@@ -XXX,XX +XXX,XX @@ static void exynos4210_init(Object *obj)
65
usb_table[i].irq));
112
object_initialize_child(obj, name, &s->cpu_irq_orgate[i], TYPE_OR_IRQ);
66
}
113
}
67
114
68
+ /* Watchdog */
115
+ for (i = 0; i < ARRAY_SIZE(s->splitter); i++) {
69
+ object_property_set_bool(OBJECT(&s->wdt), true, "pretimeout-support",
116
+ g_autofree char *name = g_strdup_printf("irq-splitter%d", i);
70
+ &error_abort);
117
+ object_initialize_child(obj, name, &s->splitter[i], TYPE_SPLIT_IRQ);
71
+ object_property_set_bool(OBJECT(&s->wdt), true, "realized", &error_abort);
118
+ }
72
+ sysbus_mmio_map(SYS_BUS_DEVICE(&s->wdt), 0, FSL_IMX25_WDT_ADDR);
73
+ sysbus_connect_irq(SYS_BUS_DEVICE(&s->wdt), 0,
74
+ qdev_get_gpio_in(DEVICE(&s->avic),
75
+ FSL_IMX25_WDT_IRQ));
76
+
119
+
77
/* initialize 2 x 16 KB ROM */
120
object_initialize_child(obj, "a9mpcore", &s->a9mpcore, TYPE_A9MPCORE_PRIV);
78
memory_region_init_rom(&s->rom[0], OBJECT(dev), "imx25.rom0",
121
object_initialize_child(obj, "ext-gic", &s->ext_gic, TYPE_EXYNOS4210_GIC);
79
FSL_IMX25_ROM0_SIZE, &err);
122
}
80
diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig
81
index XXXXXXX..XXXXXXX 100644
82
--- a/hw/arm/Kconfig
83
+++ b/hw/arm/Kconfig
84
@@ -XXX,XX +XXX,XX @@ config FSL_IMX25
85
select IMX
86
select IMX_FEC
87
select IMX_I2C
88
+ select WDT_IMX2
89
select DS1338
90
91
config FSL_IMX31
92
--
123
--
93
2.20.1
124
2.25.1
94
95
diff view generated by jsdifflib
1
From: Guenter Roeck <linux@roeck-us.net>
1
In exynos4210_init_board_irqs(), the loop that handles IRQ lines that
2
are in a range that applies to the internal combiner only creates a
3
splitter for those interrupts which go to both the internal combiner
4
and to the external GIC, but it does nothing at all for the
5
interrupts which don't go to the external GIC, leaving the
6
irq_table[] array element empty for those. (This will result in
7
those interrupts simply being lost, not in a QEMU crash.)
2
8
3
i.MX7 supports watchdog pretimeout interupts. With this commit,
9
I don't have a reliable datasheet for this SoC, but since we do wire
4
the watchdog in mcimx7d-sabre is fully operational, including
10
up one interrupt line in this category (the HDMI I2C device on
5
pretimeout support.
11
interrupt 16,1), this seems like it must be a bug in the existing
12
QEMU code. Fill in the irq_table[] entries where we're not splitting
13
the IRQ to both the internal combiner and the external GIC with the
14
IRQ line of the internal combiner. (That is, these IRQ lines go to
15
just one device, not multiple.)
6
16
7
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
17
This bug didn't have any visible guest effects because the only
8
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
18
implemented device that was affected was the HDMI I2C controller,
9
Message-id: 20200517162135.110364-9-linux@roeck-us.net
19
and we never connect any I2C devices to that bus.
20
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
21
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
22
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
23
Message-id: 20220404154658.565020-14-peter.maydell@linaro.org
11
---
24
---
12
include/hw/arm/fsl-imx7.h | 5 +++++
25
hw/arm/exynos4210.c | 2 ++
13
hw/arm/fsl-imx7.c | 11 +++++++++++
26
1 file changed, 2 insertions(+)
14
2 files changed, 16 insertions(+)
15
27
16
diff --git a/include/hw/arm/fsl-imx7.h b/include/hw/arm/fsl-imx7.h
28
diff --git a/hw/arm/exynos4210.c b/hw/arm/exynos4210.c
17
index XXXXXXX..XXXXXXX 100644
29
index XXXXXXX..XXXXXXX 100644
18
--- a/include/hw/arm/fsl-imx7.h
30
--- a/hw/arm/exynos4210.c
19
+++ b/include/hw/arm/fsl-imx7.h
31
+++ b/hw/arm/exynos4210.c
20
@@ -XXX,XX +XXX,XX @@ enum FslIMX7IRQs {
32
@@ -XXX,XX +XXX,XX @@ static void exynos4210_init_board_irqs(Exynos4210State *s)
21
FSL_IMX7_USB2_IRQ = 42,
33
qdev_connect_gpio_out(splitter, 0, is->int_combiner_irq[n]);
22
FSL_IMX7_USB3_IRQ = 40,
34
qdev_connect_gpio_out(splitter, 1,
23
35
qdev_get_gpio_in(extgicdev, irq_id - 32));
24
+ FSL_IMX7_WDOG1_IRQ = 78,
36
+ } else {
25
+ FSL_IMX7_WDOG2_IRQ = 79,
37
+ s->irq_table[n] = is->int_combiner_irq[n];
26
+ FSL_IMX7_WDOG3_IRQ = 10,
38
}
27
+ FSL_IMX7_WDOG4_IRQ = 109,
28
+
29
FSL_IMX7_PCI_INTA_IRQ = 125,
30
FSL_IMX7_PCI_INTB_IRQ = 124,
31
FSL_IMX7_PCI_INTC_IRQ = 123,
32
diff --git a/hw/arm/fsl-imx7.c b/hw/arm/fsl-imx7.c
33
index XXXXXXX..XXXXXXX 100644
34
--- a/hw/arm/fsl-imx7.c
35
+++ b/hw/arm/fsl-imx7.c
36
@@ -XXX,XX +XXX,XX @@ static void fsl_imx7_realize(DeviceState *dev, Error **errp)
37
FSL_IMX7_WDOG3_ADDR,
38
FSL_IMX7_WDOG4_ADDR,
39
};
40
+ static const int FSL_IMX7_WDOGn_IRQ[FSL_IMX7_NUM_WDTS] = {
41
+ FSL_IMX7_WDOG1_IRQ,
42
+ FSL_IMX7_WDOG2_IRQ,
43
+ FSL_IMX7_WDOG3_IRQ,
44
+ FSL_IMX7_WDOG4_IRQ,
45
+ };
46
47
+ object_property_set_bool(OBJECT(&s->wdt[i]), true, "pretimeout-support",
48
+ &error_abort);
49
object_property_set_bool(OBJECT(&s->wdt[i]), true, "realized",
50
&error_abort);
51
52
sysbus_mmio_map(SYS_BUS_DEVICE(&s->wdt[i]), 0, FSL_IMX7_WDOGn_ADDR[i]);
53
+ sysbus_connect_irq(SYS_BUS_DEVICE(&s->wdt[i]), 0,
54
+ qdev_get_gpio_in(DEVICE(&s->a7mpcore),
55
+ FSL_IMX7_WDOGn_IRQ[i]));
56
}
39
}
57
58
/*
40
/*
59
--
41
--
60
2.20.1
42
2.25.1
61
62
diff view generated by jsdifflib
1
We incorrectly treat SVC 0xf0002 as a cacheflush request (which is a
1
Currently for the interrupts MCT_G0 and MCT_G1 which are
2
NOP for QEMU). This is the wrong syscall number, because in the
2
the only ones in the input range of the external combiner
3
svc-immediate OABI syscall numbers are all offset by the
3
and which are also wired to the external GIC, we connect
4
ARM_SYSCALL_BASE value and so the correct insn is SVC 0x9f0002.
4
them only to the internal combiner and the external GIC.
5
(This is handled further down in the code with the other Arm-specific
5
This seems likely to be a bug, as all other interrupts
6
syscalls like NR_breakpoint.)
6
which are in the input range of both combiners are
7
connected to both combiners. (The fact that the code in
8
exynos4210_combiner_get_gpioin() is also trying to wire
9
up these inputs on both combiners also suggests this.)
7
10
8
When this code was initially added in commit 6f1f31c069b20611 in
11
Wire these interrupts up to both combiners, like the rest.
9
2004, ARM_NR_cacheflush was defined as (ARM_SYSCALL_BASE + 0xf0000 + 2)
10
so the value in the comparison took account of the extra 0x900000
11
offset. In commit fbb4a2e371f2fa7 in 2008, the ARM_SYSCALL_BASE
12
was removed from the definition of ARM_NR_cacheflush and handling
13
for this group of syscalls was added below the point where we subtract
14
ARM_SYSCALL_BASE from the SVC immediate value. However that commit
15
forgot to remove the now-obsolete earlier handling code.
16
17
Remove the spurious ARM_NR_cacheflush condition.
18
12
19
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
20
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
14
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
21
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
15
Message-id: 20220404154658.565020-15-peter.maydell@linaro.org
22
Message-id: 20200420212206.12776-3-peter.maydell@linaro.org
23
---
16
---
24
linux-user/arm/cpu_loop.c | 4 +---
17
hw/arm/exynos4210.c | 7 +++----
25
1 file changed, 1 insertion(+), 3 deletions(-)
18
1 file changed, 3 insertions(+), 4 deletions(-)
26
19
27
diff --git a/linux-user/arm/cpu_loop.c b/linux-user/arm/cpu_loop.c
20
diff --git a/hw/arm/exynos4210.c b/hw/arm/exynos4210.c
28
index XXXXXXX..XXXXXXX 100644
21
index XXXXXXX..XXXXXXX 100644
29
--- a/linux-user/arm/cpu_loop.c
22
--- a/hw/arm/exynos4210.c
30
+++ b/linux-user/arm/cpu_loop.c
23
+++ b/hw/arm/exynos4210.c
31
@@ -XXX,XX +XXX,XX @@ void cpu_loop(CPUARMState *env)
24
@@ -XXX,XX +XXX,XX @@ static void exynos4210_init_board_irqs(Exynos4210State *s)
32
n = insn & 0xffffff;
25
33
}
26
assert(splitcount < EXYNOS4210_NUM_SPLITTERS);
34
27
splitter = DEVICE(&s->splitter[splitcount]);
35
- if (n == ARM_NR_cacheflush) {
28
- qdev_prop_set_uint16(splitter, "num-lines", 2);
36
- /* nop */
29
+ qdev_prop_set_uint16(splitter, "num-lines", irq_id ? 3 : 2);
37
- } else if (n == 0 || n >= ARM_SYSCALL_BASE || env->thumb) {
30
qdev_realize(splitter, NULL, &error_abort);
38
+ if (n == 0 || n >= ARM_SYSCALL_BASE || env->thumb) {
31
splitcount++;
39
/* linux syscall */
32
s->irq_table[n] = qdev_get_gpio_in(splitter, 0);
40
if (env->thumb || n == 0) {
33
qdev_connect_gpio_out(splitter, 0, is->int_combiner_irq[n]);
41
n = env->regs[7];
34
+ qdev_connect_gpio_out(splitter, 1, is->ext_combiner_irq[n]);
35
if (irq_id) {
36
- qdev_connect_gpio_out(splitter, 1,
37
+ qdev_connect_gpio_out(splitter, 2,
38
qdev_get_gpio_in(extgicdev, irq_id - 32));
39
- } else {
40
- qdev_connect_gpio_out(splitter, 1, is->ext_combiner_irq[n]);
41
}
42
}
43
for (; n < EXYNOS4210_MAX_INT_COMBINER_IN_IRQ; n++) {
42
--
44
--
43
2.20.1
45
2.25.1
44
45
diff view generated by jsdifflib
1
Sort the board index into alphabetical order. (Note that we need to
1
The combiner_grp_to_gic_id[] array includes the EXT_GIC_ID_MCT_G0
2
sort alphabetically by the title text of each file, which isn't the
2
and EXT_GIC_ID_MCT_G1 multiple times. This means that we will
3
same ordering as sorting by the filename.)
3
connect multiple IRQs up to the same external GIC input, which
4
is not permitted. We do the same thing in the code in
5
exynos4210_init_board_irqs() because the conditionals selecting
6
an irq_id in the first loop match multiple interrupt IDs.
7
8
Overall we do this for interrupt IDs
9
(1, 4), (12, 4), (35, 4), (51, 4), (53, 4) for EXT_GIC_ID_MCT_G0
10
and
11
(1, 5), (12, 5), (35, 5), (51, 5), (53, 5) for EXT_GIC_ID_MCT_G1
12
13
These correspond to the cases for the multi-core timer that we are
14
wiring up to multiple inputs on the combiner in
15
exynos4210_combiner_get_gpioin(). That code already deals with all
16
these interrupt IDs being the same input source, so we don't need to
17
connect the external GIC interrupt for any of them except the first
18
(1, 4) and (1, 5). Remove the array entries and conditionals which
19
were incorrectly causing us to wire up extra lines.
20
21
This bug didn't cause any visible effects, because we only connect
22
up a device to the "primary" ID values (1, 4) and (1, 5), so the
23
extra lines would never be set to a level.
4
24
5
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
25
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
26
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
7
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
27
Message-id: 20220404154658.565020-16-peter.maydell@linaro.org
8
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
9
Message-id: 20200507151819.28444-3-peter.maydell@linaro.org
10
---
28
---
11
docs/system/target-arm.rst | 17 +++++++++++------
29
include/hw/arm/exynos4210.h | 2 +-
12
1 file changed, 11 insertions(+), 6 deletions(-)
30
hw/arm/exynos4210.c | 12 +++++-------
31
2 files changed, 6 insertions(+), 8 deletions(-)
13
32
14
diff --git a/docs/system/target-arm.rst b/docs/system/target-arm.rst
33
diff --git a/include/hw/arm/exynos4210.h b/include/hw/arm/exynos4210.h
15
index XXXXXXX..XXXXXXX 100644
34
index XXXXXXX..XXXXXXX 100644
16
--- a/docs/system/target-arm.rst
35
--- a/include/hw/arm/exynos4210.h
17
+++ b/docs/system/target-arm.rst
36
+++ b/include/hw/arm/exynos4210.h
18
@@ -XXX,XX +XXX,XX @@ Unfortunately many of the Arm boards QEMU supports are currently
37
@@ -XXX,XX +XXX,XX @@
19
undocumented; you can get a complete list by running
38
* one for every non-zero entry in combiner_grp_to_gic_id[].
20
``qemu-system-aarch64 --machine help``.
39
* We'll assert in exynos4210_init_board_irqs() if this is wrong.
21
40
*/
22
+..
41
-#define EXYNOS4210_NUM_SPLITTERS (EXYNOS4210_MAX_EXT_COMBINER_IN_IRQ + 60)
23
+ This table of contents should be kept sorted alphabetically
42
+#define EXYNOS4210_NUM_SPLITTERS (EXYNOS4210_MAX_EXT_COMBINER_IN_IRQ + 54)
24
+ by the title text of each file, which isn't the same ordering
43
25
+ as an alphabetical sort by filename.
44
typedef struct Exynos4210Irq {
26
+
45
qemu_irq int_combiner_irq[EXYNOS4210_MAX_INT_COMBINER_IN_IRQ];
27
.. toctree::
46
diff --git a/hw/arm/exynos4210.c b/hw/arm/exynos4210.c
28
:maxdepth: 1
47
index XXXXXXX..XXXXXXX 100644
29
48
--- a/hw/arm/exynos4210.c
30
arm/integratorcp
49
+++ b/hw/arm/exynos4210.c
31
- arm/versatile
50
@@ -XXX,XX +XXX,XX @@ combiner_grp_to_gic_id[64 - EXYNOS4210_MAX_EXT_COMBINER_OUT_IRQ][8] = {
32
arm/realview
51
/* int combiner group 34 */
33
- arm/xscale
52
{ EXT_GIC_ID_ONENAND_AUDI, EXT_GIC_ID_NFC },
34
- arm/palm
53
/* int combiner group 35 */
35
- arm/nseries
54
- { 0, 0, 0, EXT_GIC_ID_MCT_L1, EXT_GIC_ID_MCT_G0, EXT_GIC_ID_MCT_G1 },
36
- arm/stellaris
55
+ { 0, 0, 0, EXT_GIC_ID_MCT_L1 },
37
+ arm/versatile
56
/* int combiner group 36 */
38
arm/musicpal
57
{ EXT_GIC_ID_MIXER },
39
- arm/sx1
58
/* int combiner group 37 */
40
+ arm/nseries
59
@@ -XXX,XX +XXX,XX @@ combiner_grp_to_gic_id[64 - EXYNOS4210_MAX_EXT_COMBINER_OUT_IRQ][8] = {
41
arm/orangepi
60
/* groups 38-50 */
42
+ arm/palm
61
{ }, { }, { }, { }, { }, { }, { }, { }, { }, { }, { }, { }, { },
43
+ arm/xscale
62
/* int combiner group 51 */
44
+ arm/sx1
63
- { EXT_GIC_ID_MCT_L0, 0, 0, 0, EXT_GIC_ID_MCT_G0, EXT_GIC_ID_MCT_G1 },
45
+ arm/stellaris
64
+ { EXT_GIC_ID_MCT_L0 },
46
65
/* group 52 */
47
Arm CPU features
66
{ },
48
================
67
/* int combiner group 53 */
68
- { EXT_GIC_ID_WDT, 0, 0, 0, EXT_GIC_ID_MCT_G0, EXT_GIC_ID_MCT_G1 },
69
+ { EXT_GIC_ID_WDT },
70
/* groups 54-63 */
71
{ }, { }, { }, { }, { }, { }, { }, { }, { }, { }
72
};
73
@@ -XXX,XX +XXX,XX @@ static void exynos4210_init_board_irqs(Exynos4210State *s)
74
75
for (n = 0; n < EXYNOS4210_MAX_EXT_COMBINER_IN_IRQ; n++) {
76
irq_id = 0;
77
- if (n == EXYNOS4210_COMBINER_GET_IRQ_NUM(1, 4) ||
78
- n == EXYNOS4210_COMBINER_GET_IRQ_NUM(12, 4)) {
79
+ if (n == EXYNOS4210_COMBINER_GET_IRQ_NUM(1, 4)) {
80
/* MCT_G0 is passed to External GIC */
81
irq_id = EXT_GIC_ID_MCT_G0;
82
}
83
- if (n == EXYNOS4210_COMBINER_GET_IRQ_NUM(1, 5) ||
84
- n == EXYNOS4210_COMBINER_GET_IRQ_NUM(12, 5)) {
85
+ if (n == EXYNOS4210_COMBINER_GET_IRQ_NUM(1, 5)) {
86
/* MCT_G1 is passed to External and GIC */
87
irq_id = EXT_GIC_ID_MCT_G1;
88
}
49
--
89
--
50
2.20.1
90
2.25.1
51
52
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
1
At this point, the function exynos4210_init_board_irqs() splits input
2
2
IRQ lines to connect them to the input combiner, output combiner and
3
hw_error() calls exit(). This a bit overkill when we can log
3
external GIC. The function exynos4210_combiner_get_gpioin() splits
4
the accesses as unimplemented or guest error.
4
some of the combiner input lines further to connect them to multiple
5
5
different inputs on the combiner.
6
When fuzzing the devices, we don't want the whole process to
6
7
exit. Replace some hw_error() calls by qemu_log_mask().
7
Because (unlike qemu_irq_split()) the TYPE_SPLIT_IRQ device has a
8
8
configurable number of outputs, we can do all this in one place, by
9
Per the datasheet "Exynos 4412 RISC Microprocessor Rev 1.00"
9
making exynos4210_init_board_irqs() add extra outputs to the splitter
10
Chapter 25 "Multi Core Timer (MCT)" figure 1 and table 4,
10
device when it must be connected to more than one input on each
11
the default value on the APB bus is 0.
11
combiner.
12
12
13
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
13
We do this with a new data structure, the combinermap, which is an
14
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
14
array each of whose elements is a list of the interrupt IDs on the
15
Message-id: 20200518140309.5220-5-f4bug@amsat.org
15
combiner which must be tied together. As we loop through each
16
interrupt ID, if we find that it is the first one in one of these
17
lists, we configure the splitter device with eonugh extra outputs and
18
wire them up to the other interrupt IDs in the list.
19
20
Conveniently, for all the cases where this is necessary, the
21
lowest-numbered interrupt ID in each group is in the range of the
22
external combiner, so we only need to code for this in the first of
23
the two loops in exynos4210_init_board_irqs().
24
25
The old code in exynos4210_combiner_get_gpioin() which is being
26
deleted here had several problems which don't exist in the new code
27
in its handling of the multi-core timer interrupts:
28
(1) the case labels specified bits 4 ... 8, but bit '8' doesn't
29
exist; these should have been 4 ... 7
30
(2) it used the input irq[EXYNOS4210_COMBINER_GET_IRQ_NUM(1, bit + 4)]
31
multiple times as the input of several different splitters,
32
which isn't allowed
33
(3) in an apparent cut-and-paste error, the cases for all the
34
multi-core timer inputs used "bit + 4" even though the
35
bit range for the case was (intended to be) 4 ... 7, which
36
meant it was looking at non-existent bits 8 ... 11.
37
None of these exist in the new code.
38
16
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
39
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
40
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
41
Message-id: 20220404154658.565020-17-peter.maydell@linaro.org
17
---
42
---
18
hw/timer/exynos4210_mct.c | 12 +++++-------
43
include/hw/arm/exynos4210.h | 6 +-
19
1 file changed, 5 insertions(+), 7 deletions(-)
44
hw/arm/exynos4210.c | 178 +++++++++++++++++++++++-------------
20
45
2 files changed, 119 insertions(+), 65 deletions(-)
21
diff --git a/hw/timer/exynos4210_mct.c b/hw/timer/exynos4210_mct.c
46
47
diff --git a/include/hw/arm/exynos4210.h b/include/hw/arm/exynos4210.h
22
index XXXXXXX..XXXXXXX 100644
48
index XXXXXXX..XXXXXXX 100644
23
--- a/hw/timer/exynos4210_mct.c
49
--- a/include/hw/arm/exynos4210.h
24
+++ b/hw/timer/exynos4210_mct.c
50
+++ b/include/hw/arm/exynos4210.h
25
@@ -XXX,XX +XXX,XX @@
51
@@ -XXX,XX +XXX,XX @@
26
52
27
#include "qemu/osdep.h"
53
/*
28
#include "qemu/log.h"
54
* We need one splitter for every external combiner input, plus
29
-#include "hw/hw.h"
55
- * one for every non-zero entry in combiner_grp_to_gic_id[].
30
#include "hw/sysbus.h"
56
+ * one for every non-zero entry in combiner_grp_to_gic_id[],
31
#include "migration/vmstate.h"
57
+ * minus one for every external combiner ID in second or later
32
#include "qemu/timer.h"
58
+ * places in a combinermap[] line.
33
@@ -XXX,XX +XXX,XX @@
59
* We'll assert in exynos4210_init_board_irqs() if this is wrong.
34
#include "hw/ptimer.h"
60
*/
35
61
-#define EXYNOS4210_NUM_SPLITTERS (EXYNOS4210_MAX_EXT_COMBINER_IN_IRQ + 54)
36
#include "hw/arm/exynos4210.h"
62
+#define EXYNOS4210_NUM_SPLITTERS (EXYNOS4210_MAX_EXT_COMBINER_IN_IRQ + 38)
37
-#include "hw/hw.h"
63
38
#include "hw/irq.h"
64
typedef struct Exynos4210Irq {
39
65
qemu_irq int_combiner_irq[EXYNOS4210_MAX_INT_COMBINER_IN_IRQ];
40
//#define DEBUG_MCT
66
diff --git a/hw/arm/exynos4210.c b/hw/arm/exynos4210.c
41
@@ -XXX,XX +XXX,XX @@ static uint64_t exynos4210_mct_read(void *opaque, hwaddr offset,
67
index XXXXXXX..XXXXXXX 100644
42
int index;
68
--- a/hw/arm/exynos4210.c
43
int shift;
69
+++ b/hw/arm/exynos4210.c
44
uint64_t count;
70
@@ -XXX,XX +XXX,XX @@ combiner_grp_to_gic_id[64 - EXYNOS4210_MAX_EXT_COMBINER_OUT_IRQ][8] = {
45
- uint32_t value;
71
#define EXYNOS4210_COMBINER_GET_BIT_NUM(irq) \
46
+ uint32_t value = 0;
72
((irq) - 8 * EXYNOS4210_COMBINER_GET_GRP_NUM(irq))
47
int lt_i;
73
48
74
+/*
49
switch (offset) {
75
+ * Some interrupt lines go to multiple combiner inputs.
50
@@ -XXX,XX +XXX,XX @@ static uint64_t exynos4210_mct_read(void *opaque, hwaddr offset,
76
+ * This data structure defines those: each array element is
51
break;
77
+ * a list of combiner inputs which are connected together;
52
78
+ * the one with the smallest interrupt ID value must be first.
53
default:
79
+ * As with combiner_grp_to_gic_id[], we rely on (0, 0) not being
54
- hw_error("exynos4210.mct: bad read offset "
80
+ * wired to anything so we can use 0 as a terminator.
55
- TARGET_FMT_plx "\n", offset);
81
+ */
56
+ qemu_log_mask(LOG_GUEST_ERROR, "%s: Bad offset 0x%" HWADDR_PRIX "\n",
82
+#define IRQNO(G, B) EXYNOS4210_COMBINER_GET_IRQ_NUM(G, B)
57
+ __func__, offset);
83
+#define IRQNONE 0
58
break;
84
+
85
+#define COMBINERMAP_SIZE 16
86
+
87
+static const int combinermap[COMBINERMAP_SIZE][6] = {
88
+ /* MDNIE_LCD1 */
89
+ { IRQNO(0, 4), IRQNO(1, 0), IRQNONE },
90
+ { IRQNO(0, 5), IRQNO(1, 1), IRQNONE },
91
+ { IRQNO(0, 6), IRQNO(1, 2), IRQNONE },
92
+ { IRQNO(0, 7), IRQNO(1, 3), IRQNONE },
93
+ /* TMU */
94
+ { IRQNO(2, 4), IRQNO(3, 4), IRQNONE },
95
+ { IRQNO(2, 5), IRQNO(3, 5), IRQNONE },
96
+ { IRQNO(2, 6), IRQNO(3, 6), IRQNONE },
97
+ { IRQNO(2, 7), IRQNO(3, 7), IRQNONE },
98
+ /* LCD1 */
99
+ { IRQNO(11, 4), IRQNO(12, 0), IRQNONE },
100
+ { IRQNO(11, 5), IRQNO(12, 1), IRQNONE },
101
+ { IRQNO(11, 6), IRQNO(12, 2), IRQNONE },
102
+ { IRQNO(11, 7), IRQNO(12, 3), IRQNONE },
103
+ /* Multi-core timer */
104
+ { IRQNO(1, 4), IRQNO(12, 4), IRQNO(35, 4), IRQNO(51, 4), IRQNO(53, 4), IRQNONE },
105
+ { IRQNO(1, 5), IRQNO(12, 5), IRQNO(35, 5), IRQNO(51, 5), IRQNO(53, 5), IRQNONE },
106
+ { IRQNO(1, 6), IRQNO(12, 6), IRQNO(35, 6), IRQNO(51, 6), IRQNO(53, 6), IRQNONE },
107
+ { IRQNO(1, 7), IRQNO(12, 7), IRQNO(35, 7), IRQNO(51, 7), IRQNO(53, 7), IRQNONE },
108
+};
109
+
110
+#undef IRQNO
111
+
112
+static const int *combinermap_entry(int irq)
113
+{
114
+ /*
115
+ * If the interrupt number passed in is the first entry in some
116
+ * line of the combinermap, return a pointer to that line;
117
+ * otherwise return NULL.
118
+ */
119
+ int i;
120
+ for (i = 0; i < COMBINERMAP_SIZE; i++) {
121
+ if (combinermap[i][0] == irq) {
122
+ return combinermap[i];
123
+ }
124
+ }
125
+ return NULL;
126
+}
127
+
128
+static int mapline_size(const int *mapline)
129
+{
130
+ /* Return number of entries in this mapline in total */
131
+ int i = 0;
132
+
133
+ if (!mapline) {
134
+ /* Not in the map? IRQ goes to exactly one combiner input */
135
+ return 1;
136
+ }
137
+ while (*mapline != IRQNONE) {
138
+ mapline++;
139
+ i++;
140
+ }
141
+ return i;
142
+}
143
+
144
/*
145
* Initialize board IRQs.
146
* These IRQs contain splitted Int/External Combiner and External Gic IRQs.
147
@@ -XXX,XX +XXX,XX @@ static void exynos4210_init_board_irqs(Exynos4210State *s)
148
DeviceState *extgicdev = DEVICE(&s->ext_gic);
149
int splitcount = 0;
150
DeviceState *splitter;
151
+ const int *mapline;
152
+ int numlines, splitin, in;
153
154
for (n = 0; n < EXYNOS4210_MAX_EXT_COMBINER_IN_IRQ; n++) {
155
irq_id = 0;
156
@@ -XXX,XX +XXX,XX @@ static void exynos4210_init_board_irqs(Exynos4210State *s)
157
irq_id = EXT_GIC_ID_MCT_G1;
158
}
159
160
+ if (s->irq_table[n]) {
161
+ /*
162
+ * This must be some non-first entry in a combinermap line,
163
+ * and we've already filled it in.
164
+ */
165
+ continue;
166
+ }
167
+ mapline = combinermap_entry(n);
168
+ /*
169
+ * We need to connect the IRQ to multiple inputs on both combiners
170
+ * and possibly also to the external GIC.
171
+ */
172
+ numlines = 2 * mapline_size(mapline);
173
+ if (irq_id) {
174
+ numlines++;
175
+ }
176
assert(splitcount < EXYNOS4210_NUM_SPLITTERS);
177
splitter = DEVICE(&s->splitter[splitcount]);
178
- qdev_prop_set_uint16(splitter, "num-lines", irq_id ? 3 : 2);
179
+ qdev_prop_set_uint16(splitter, "num-lines", numlines);
180
qdev_realize(splitter, NULL, &error_abort);
181
splitcount++;
182
- s->irq_table[n] = qdev_get_gpio_in(splitter, 0);
183
- qdev_connect_gpio_out(splitter, 0, is->int_combiner_irq[n]);
184
- qdev_connect_gpio_out(splitter, 1, is->ext_combiner_irq[n]);
185
+
186
+ in = n;
187
+ splitin = 0;
188
+ for (;;) {
189
+ s->irq_table[in] = qdev_get_gpio_in(splitter, 0);
190
+ qdev_connect_gpio_out(splitter, splitin, is->int_combiner_irq[in]);
191
+ qdev_connect_gpio_out(splitter, splitin + 1, is->ext_combiner_irq[in]);
192
+ splitin += 2;
193
+ if (!mapline) {
194
+ break;
195
+ }
196
+ mapline++;
197
+ in = *mapline;
198
+ if (in == IRQNONE) {
199
+ break;
200
+ }
201
+ }
202
if (irq_id) {
203
- qdev_connect_gpio_out(splitter, 2,
204
+ qdev_connect_gpio_out(splitter, splitin,
205
qdev_get_gpio_in(extgicdev, irq_id - 32));
206
}
59
}
207
}
60
return value;
208
@@ -XXX,XX +XXX,XX @@ static void exynos4210_init_board_irqs(Exynos4210State *s)
61
@@ -XXX,XX +XXX,XX @@ static void exynos4210_mct_write(void *opaque, hwaddr offset,
209
irq_id = combiner_grp_to_gic_id[grp -
62
break;
210
EXYNOS4210_MAX_EXT_COMBINER_OUT_IRQ][bit];
63
211
64
default:
212
+ if (s->irq_table[n]) {
65
- hw_error("exynos4210.mct: bad write offset "
213
+ /*
66
- TARGET_FMT_plx "\n", offset);
214
+ * This must be some non-first entry in a combinermap line,
67
+ qemu_log_mask(LOG_GUEST_ERROR, "%s: Bad offset 0x%" HWADDR_PRIX "\n",
215
+ * and we've already filled it in.
68
+ __func__, offset);
216
+ */
69
break;
217
+ continue;
218
+ }
219
+
220
if (irq_id) {
221
assert(splitcount < EXYNOS4210_NUM_SPLITTERS);
222
splitter = DEVICE(&s->splitter[splitcount]);
223
@@ -XXX,XX +XXX,XX @@ static void exynos4210_combiner_get_gpioin(Exynos4210Irq *irqs,
224
DeviceState *dev, int ext)
225
{
226
int n;
227
- int bit;
228
int max;
229
qemu_irq *irq;
230
231
@@ -XXX,XX +XXX,XX @@ static void exynos4210_combiner_get_gpioin(Exynos4210Irq *irqs,
232
EXYNOS4210_MAX_INT_COMBINER_IN_IRQ;
233
irq = ext ? irqs->ext_combiner_irq : irqs->int_combiner_irq;
234
235
- /*
236
- * Some IRQs of Int/External Combiner are going to two Combiners groups,
237
- * so let split them.
238
- */
239
for (n = 0; n < max; n++) {
240
-
241
- bit = EXYNOS4210_COMBINER_GET_BIT_NUM(n);
242
-
243
- switch (n) {
244
- /* MDNIE_LCD1 INTG1 */
245
- case EXYNOS4210_COMBINER_GET_IRQ_NUM(1, 0) ...
246
- EXYNOS4210_COMBINER_GET_IRQ_NUM(1, 3):
247
- irq[n] = qemu_irq_split(qdev_get_gpio_in(dev, n),
248
- irq[EXYNOS4210_COMBINER_GET_IRQ_NUM(0, bit + 4)]);
249
- continue;
250
-
251
- /* TMU INTG3 */
252
- case EXYNOS4210_COMBINER_GET_IRQ_NUM(3, 4):
253
- irq[n] = qemu_irq_split(qdev_get_gpio_in(dev, n),
254
- irq[EXYNOS4210_COMBINER_GET_IRQ_NUM(2, bit)]);
255
- continue;
256
-
257
- /* LCD1 INTG12 */
258
- case EXYNOS4210_COMBINER_GET_IRQ_NUM(12, 0) ...
259
- EXYNOS4210_COMBINER_GET_IRQ_NUM(12, 3):
260
- irq[n] = qemu_irq_split(qdev_get_gpio_in(dev, n),
261
- irq[EXYNOS4210_COMBINER_GET_IRQ_NUM(11, bit + 4)]);
262
- continue;
263
-
264
- /* Multi-Core Timer INTG12 */
265
- case EXYNOS4210_COMBINER_GET_IRQ_NUM(12, 4) ...
266
- EXYNOS4210_COMBINER_GET_IRQ_NUM(12, 8):
267
- irq[n] = qemu_irq_split(qdev_get_gpio_in(dev, n),
268
- irq[EXYNOS4210_COMBINER_GET_IRQ_NUM(1, bit + 4)]);
269
- continue;
270
-
271
- /* Multi-Core Timer INTG35 */
272
- case EXYNOS4210_COMBINER_GET_IRQ_NUM(35, 4) ...
273
- EXYNOS4210_COMBINER_GET_IRQ_NUM(35, 8):
274
- irq[n] = qemu_irq_split(qdev_get_gpio_in(dev, n),
275
- irq[EXYNOS4210_COMBINER_GET_IRQ_NUM(1, bit + 4)]);
276
- continue;
277
-
278
- /* Multi-Core Timer INTG51 */
279
- case EXYNOS4210_COMBINER_GET_IRQ_NUM(51, 4) ...
280
- EXYNOS4210_COMBINER_GET_IRQ_NUM(51, 8):
281
- irq[n] = qemu_irq_split(qdev_get_gpio_in(dev, n),
282
- irq[EXYNOS4210_COMBINER_GET_IRQ_NUM(1, bit + 4)]);
283
- continue;
284
-
285
- /* Multi-Core Timer INTG53 */
286
- case EXYNOS4210_COMBINER_GET_IRQ_NUM(53, 4) ...
287
- EXYNOS4210_COMBINER_GET_IRQ_NUM(53, 8):
288
- irq[n] = qemu_irq_split(qdev_get_gpio_in(dev, n),
289
- irq[EXYNOS4210_COMBINER_GET_IRQ_NUM(1, bit + 4)]);
290
- continue;
291
- }
292
-
293
irq[n] = qdev_get_gpio_in(dev, n);
70
}
294
}
71
}
295
}
72
--
296
--
73
2.20.1
297
2.25.1
74
75
diff view generated by jsdifflib
1
Provide a minimal documentation of the Versatile Express boards
1
Switch the creation of the combiner devices to the new-style
2
(vexpress-a9, vexpress-a15).
2
"embedded in state struct" approach, so we can easily refer
3
to the object elsewhere during realize.
3
4
4
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
6
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
6
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
7
Message-id: 20220404154658.565020-18-peter.maydell@linaro.org
7
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
8
Message-id: 20200507151819.28444-4-peter.maydell@linaro.org
9
---
8
---
10
docs/system/arm/vexpress.rst | 60 ++++++++++++++++++++++++++++++++++++
9
include/hw/arm/exynos4210.h | 3 ++
11
docs/system/target-arm.rst | 1 +
10
include/hw/intc/exynos4210_combiner.h | 57 +++++++++++++++++++++++++++
12
MAINTAINERS | 1 +
11
hw/arm/exynos4210.c | 20 +++++-----
13
3 files changed, 62 insertions(+)
12
hw/intc/exynos4210_combiner.c | 31 +--------------
14
create mode 100644 docs/system/arm/vexpress.rst
13
4 files changed, 72 insertions(+), 39 deletions(-)
14
create mode 100644 include/hw/intc/exynos4210_combiner.h
15
15
16
diff --git a/docs/system/arm/vexpress.rst b/docs/system/arm/vexpress.rst
16
diff --git a/include/hw/arm/exynos4210.h b/include/hw/arm/exynos4210.h
17
index XXXXXXX..XXXXXXX 100644
18
--- a/include/hw/arm/exynos4210.h
19
+++ b/include/hw/arm/exynos4210.h
20
@@ -XXX,XX +XXX,XX @@
21
#include "hw/sysbus.h"
22
#include "hw/cpu/a9mpcore.h"
23
#include "hw/intc/exynos4210_gic.h"
24
+#include "hw/intc/exynos4210_combiner.h"
25
#include "hw/core/split-irq.h"
26
#include "target/arm/cpu-qom.h"
27
#include "qom/object.h"
28
@@ -XXX,XX +XXX,XX @@ struct Exynos4210State {
29
qemu_or_irq cpu_irq_orgate[EXYNOS4210_NCPUS];
30
A9MPPrivState a9mpcore;
31
Exynos4210GicState ext_gic;
32
+ Exynos4210CombinerState int_combiner;
33
+ Exynos4210CombinerState ext_combiner;
34
SplitIRQ splitter[EXYNOS4210_NUM_SPLITTERS];
35
};
36
37
diff --git a/include/hw/intc/exynos4210_combiner.h b/include/hw/intc/exynos4210_combiner.h
17
new file mode 100644
38
new file mode 100644
18
index XXXXXXX..XXXXXXX
39
index XXXXXXX..XXXXXXX
19
--- /dev/null
40
--- /dev/null
20
+++ b/docs/system/arm/vexpress.rst
41
+++ b/include/hw/intc/exynos4210_combiner.h
21
@@ -XXX,XX +XXX,XX @@
42
@@ -XXX,XX +XXX,XX @@
22
+Arm Versatile Express boards (``vexpress-a9``, ``vexpress-a15``)
43
+/*
23
+================================================================
44
+ * Samsung exynos4210 Interrupt Combiner
45
+ *
46
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd.
47
+ * All rights reserved.
48
+ *
49
+ * Evgeny Voevodin <e.voevodin@samsung.com>
50
+ *
51
+ * This program is free software; you can redistribute it and/or modify it
52
+ * under the terms of the GNU General Public License as published by the
53
+ * Free Software Foundation; either version 2 of the License, or (at your
54
+ * option) any later version.
55
+ *
56
+ * This program is distributed in the hope that it will be useful,
57
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
58
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
59
+ * See the GNU General Public License for more details.
60
+ *
61
+ * You should have received a copy of the GNU General Public License along
62
+ * with this program; if not, see <http://www.gnu.org/licenses/>.
63
+ */
24
+
64
+
25
+QEMU models two variants of the Arm Versatile Express development
65
+#ifndef HW_INTC_EXYNOS4210_COMBINER
26
+board family:
66
+#define HW_INTC_EXYNOS4210_COMBINER
27
+
67
+
28
+- ``vexpress-a9`` models the combination of the Versatile Express
68
+#include "hw/sysbus.h"
29
+ motherboard and the CoreTile Express A9x4 daughterboard
30
+- ``vexpress-a15`` models the combination of the Versatile Express
31
+ motherboard and the CoreTile Express A15x2 daughterboard
32
+
69
+
33
+Note that as this hardware does not have PCI, IDE or SCSI,
70
+/*
34
+the only available storage option is emulated SD card.
71
+ * State for each output signal of internal combiner
72
+ */
73
+typedef struct CombinerGroupState {
74
+ uint8_t src_mask; /* 1 - source enabled, 0 - disabled */
75
+ uint8_t src_pending; /* Pending source interrupts before masking */
76
+} CombinerGroupState;
35
+
77
+
36
+Implemented devices:
78
+#define TYPE_EXYNOS4210_COMBINER "exynos4210.combiner"
79
+OBJECT_DECLARE_SIMPLE_TYPE(Exynos4210CombinerState, EXYNOS4210_COMBINER)
37
+
80
+
38
+- PL041 audio
81
+/* Number of groups and total number of interrupts for the internal combiner */
39
+- PL181 SD controller
82
+#define IIC_NGRP 64
40
+- PL050 keyboard and mouse
83
+#define IIC_NIRQ (IIC_NGRP * 8)
41
+- PL011 UARTs
84
+#define IIC_REGSET_SIZE 0x41
42
+- SP804 timers
43
+- I2C controller
44
+- PL031 RTC
45
+- PL111 LCD display controller
46
+- Flash memory
47
+- LAN9118 ethernet
48
+
85
+
49
+Unimplemented devices:
86
+struct Exynos4210CombinerState {
87
+ SysBusDevice parent_obj;
50
+
88
+
51
+- SP810 system control block
89
+ MemoryRegion iomem;
52
+- PCI-express
53
+- USB controller (Philips ISP1761)
54
+- Local DAP ROM
55
+- CoreSight interfaces
56
+- PL301 AXI interconnect
57
+- SCC
58
+- System counter
59
+- HDLCD controller (``vexpress-a15``)
60
+- SP805 watchdog
61
+- PL341 dynamic memory controller
62
+- DMA330 DMA controller
63
+- PL354 static memory controller
64
+- BP147 TrustZone Protection Controller
65
+- TrustZone Address Space Controller
66
+
90
+
67
+Other differences between the hardware and the QEMU model:
91
+ struct CombinerGroupState group[IIC_NGRP];
92
+ uint32_t reg_set[IIC_REGSET_SIZE];
93
+ uint32_t icipsr[2];
94
+ uint32_t external; /* 1 means that this combiner is external */
68
+
95
+
69
+- QEMU will default to creating one CPU unless you pass a different
96
+ qemu_irq output_irq[IIC_NGRP];
70
+ ``-smp`` argument
97
+};
71
+- QEMU allows the amount of RAM provided to be specified with the
98
+
72
+ ``-m`` argument
99
+#endif
73
+- QEMU defaults to providing a CPU which does not provide either
100
diff --git a/hw/arm/exynos4210.c b/hw/arm/exynos4210.c
74
+ TrustZone or the Virtualization Extensions: if you want these you
75
+ must enable them with ``-machine secure=on`` and ``-machine
76
+ virtualization=on``
77
+- QEMU provides 4 virtio-mmio virtio transports; these start at
78
+ address ``0x10013000`` for ``vexpress-a9`` and at ``0x1c130000`` for
79
+ ``vexpress-a15``, and have IRQs from 40 upwards. If a dtb is
80
+ provided on the command line then QEMU will edit it to include
81
+ suitable entries describing these transports for the guest.
82
diff --git a/docs/system/target-arm.rst b/docs/system/target-arm.rst
83
index XXXXXXX..XXXXXXX 100644
101
index XXXXXXX..XXXXXXX 100644
84
--- a/docs/system/target-arm.rst
102
--- a/hw/arm/exynos4210.c
85
+++ b/docs/system/target-arm.rst
103
+++ b/hw/arm/exynos4210.c
86
@@ -XXX,XX +XXX,XX @@ undocumented; you can get a complete list by running
104
@@ -XXX,XX +XXX,XX @@ static void exynos4210_realize(DeviceState *socdev, Error **errp)
87
arm/integratorcp
105
}
88
arm/realview
106
89
arm/versatile
107
/* Internal Interrupt Combiner */
90
+ arm/vexpress
108
- dev = qdev_new("exynos4210.combiner");
91
arm/musicpal
109
- busdev = SYS_BUS_DEVICE(dev);
92
arm/nseries
110
- sysbus_realize_and_unref(busdev, &error_fatal);
93
arm/orangepi
111
+ busdev = SYS_BUS_DEVICE(&s->int_combiner);
94
diff --git a/MAINTAINERS b/MAINTAINERS
112
+ sysbus_realize(busdev, &error_fatal);
113
for (n = 0; n < EXYNOS4210_MAX_INT_COMBINER_OUT_IRQ; n++) {
114
sysbus_connect_irq(busdev, n,
115
qdev_get_gpio_in(DEVICE(&s->a9mpcore), n));
116
}
117
- exynos4210_combiner_get_gpioin(&s->irqs, dev, 0);
118
+ exynos4210_combiner_get_gpioin(&s->irqs, DEVICE(&s->int_combiner), 0);
119
sysbus_mmio_map(busdev, 0, EXYNOS4210_INT_COMBINER_BASE_ADDR);
120
121
/* External Interrupt Combiner */
122
- dev = qdev_new("exynos4210.combiner");
123
- qdev_prop_set_uint32(dev, "external", 1);
124
- busdev = SYS_BUS_DEVICE(dev);
125
- sysbus_realize_and_unref(busdev, &error_fatal);
126
+ qdev_prop_set_uint32(DEVICE(&s->ext_combiner), "external", 1);
127
+ busdev = SYS_BUS_DEVICE(&s->ext_combiner);
128
+ sysbus_realize(busdev, &error_fatal);
129
for (n = 0; n < EXYNOS4210_MAX_INT_COMBINER_OUT_IRQ; n++) {
130
sysbus_connect_irq(busdev, n, qdev_get_gpio_in(DEVICE(&s->ext_gic), n));
131
}
132
- exynos4210_combiner_get_gpioin(&s->irqs, dev, 1);
133
+ exynos4210_combiner_get_gpioin(&s->irqs, DEVICE(&s->ext_combiner), 1);
134
sysbus_mmio_map(busdev, 0, EXYNOS4210_EXT_COMBINER_BASE_ADDR);
135
136
/* Initialize board IRQs. */
137
@@ -XXX,XX +XXX,XX @@ static void exynos4210_init(Object *obj)
138
139
object_initialize_child(obj, "a9mpcore", &s->a9mpcore, TYPE_A9MPCORE_PRIV);
140
object_initialize_child(obj, "ext-gic", &s->ext_gic, TYPE_EXYNOS4210_GIC);
141
+ object_initialize_child(obj, "int-combiner", &s->int_combiner,
142
+ TYPE_EXYNOS4210_COMBINER);
143
+ object_initialize_child(obj, "ext-combiner", &s->ext_combiner,
144
+ TYPE_EXYNOS4210_COMBINER);
145
}
146
147
static void exynos4210_class_init(ObjectClass *klass, void *data)
148
diff --git a/hw/intc/exynos4210_combiner.c b/hw/intc/exynos4210_combiner.c
95
index XXXXXXX..XXXXXXX 100644
149
index XXXXXXX..XXXXXXX 100644
96
--- a/MAINTAINERS
150
--- a/hw/intc/exynos4210_combiner.c
97
+++ b/MAINTAINERS
151
+++ b/hw/intc/exynos4210_combiner.c
98
@@ -XXX,XX +XXX,XX @@ M: Peter Maydell <peter.maydell@linaro.org>
152
@@ -XXX,XX +XXX,XX @@
99
L: qemu-arm@nongnu.org
153
#include "hw/sysbus.h"
100
S: Maintained
154
#include "migration/vmstate.h"
101
F: hw/arm/vexpress.c
155
#include "qemu/module.h"
102
+F: docs/system/arm/vexpress.rst
156
-
103
157
+#include "hw/intc/exynos4210_combiner.h"
104
Versatile PB
158
#include "hw/arm/exynos4210.h"
105
M: Peter Maydell <peter.maydell@linaro.org>
159
#include "hw/hw.h"
160
#include "hw/irq.h"
161
@@ -XXX,XX +XXX,XX @@
162
#define DPRINTF(fmt, ...) do {} while (0)
163
#endif
164
165
-#define IIC_NGRP 64 /* Internal Interrupt Combiner
166
- Groups number */
167
-#define IIC_NIRQ (IIC_NGRP * 8)/* Internal Interrupt Combiner
168
- Interrupts number */
169
#define IIC_REGION_SIZE 0x108 /* Size of memory mapped region */
170
-#define IIC_REGSET_SIZE 0x41
171
-
172
-/*
173
- * State for each output signal of internal combiner
174
- */
175
-typedef struct CombinerGroupState {
176
- uint8_t src_mask; /* 1 - source enabled, 0 - disabled */
177
- uint8_t src_pending; /* Pending source interrupts before masking */
178
-} CombinerGroupState;
179
-
180
-#define TYPE_EXYNOS4210_COMBINER "exynos4210.combiner"
181
-OBJECT_DECLARE_SIMPLE_TYPE(Exynos4210CombinerState, EXYNOS4210_COMBINER)
182
-
183
-struct Exynos4210CombinerState {
184
- SysBusDevice parent_obj;
185
-
186
- MemoryRegion iomem;
187
-
188
- struct CombinerGroupState group[IIC_NGRP];
189
- uint32_t reg_set[IIC_REGSET_SIZE];
190
- uint32_t icipsr[2];
191
- uint32_t external; /* 1 means that this combiner is external */
192
-
193
- qemu_irq output_irq[IIC_NGRP];
194
-};
195
196
static const VMStateDescription vmstate_exynos4210_combiner_group_state = {
197
.name = "exynos4210.combiner.groupstate",
106
--
198
--
107
2.20.1
199
2.25.1
108
109
diff view generated by jsdifflib
1
Add 'Arm' to the Integrator/CP document title, for consistency with
1
The only time we use the int_combiner_irq[] and ext_combiner_irq[]
2
the titling of the other documentation of Arm devboard models
2
arrays in the Exynos4210Irq struct is during realize of the SoC -- we
3
(versatile, realview).
3
initialize them with the input IRQs of the combiner devices, and then
4
connect those to outputs of other devices in
5
exynos4210_init_board_irqs(). Now that the combiner objects are
6
easily accessible as s->int_combiner and s->ext_combiner we can make
7
the connections directly from one device to the other without going
8
via these arrays.
9
10
Since these are the only two remaining elements of Exynos4210Irq,
11
we can remove that struct entirely.
4
12
5
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
14
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
7
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
15
Message-id: 20220404154658.565020-19-peter.maydell@linaro.org
8
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
9
Message-id: 20200507151819.28444-2-peter.maydell@linaro.org
10
---
16
---
11
docs/system/arm/integratorcp.rst | 4 ++--
17
include/hw/arm/exynos4210.h | 6 ------
12
1 file changed, 2 insertions(+), 2 deletions(-)
18
hw/arm/exynos4210.c | 34 ++++++++--------------------------
19
2 files changed, 8 insertions(+), 32 deletions(-)
13
20
14
diff --git a/docs/system/arm/integratorcp.rst b/docs/system/arm/integratorcp.rst
21
diff --git a/include/hw/arm/exynos4210.h b/include/hw/arm/exynos4210.h
15
index XXXXXXX..XXXXXXX 100644
22
index XXXXXXX..XXXXXXX 100644
16
--- a/docs/system/arm/integratorcp.rst
23
--- a/include/hw/arm/exynos4210.h
17
+++ b/docs/system/arm/integratorcp.rst
24
+++ b/include/hw/arm/exynos4210.h
18
@@ -XXX,XX +XXX,XX @@
25
@@ -XXX,XX +XXX,XX @@
19
-Integrator/CP (``integratorcp``)
26
*/
20
-================================
27
#define EXYNOS4210_NUM_SPLITTERS (EXYNOS4210_MAX_EXT_COMBINER_IN_IRQ + 38)
21
+Arm Integrator/CP (``integratorcp``)
28
22
+====================================
29
-typedef struct Exynos4210Irq {
23
30
- qemu_irq int_combiner_irq[EXYNOS4210_MAX_INT_COMBINER_IN_IRQ];
24
The Arm Integrator/CP board is emulated with the following devices:
31
- qemu_irq ext_combiner_irq[EXYNOS4210_MAX_EXT_COMBINER_IN_IRQ];
25
32
-} Exynos4210Irq;
33
-
34
struct Exynos4210State {
35
/*< private >*/
36
SysBusDevice parent_obj;
37
/*< public >*/
38
ARMCPU *cpu[EXYNOS4210_NCPUS];
39
- Exynos4210Irq irqs;
40
qemu_irq irq_table[EXYNOS4210_MAX_INT_COMBINER_IN_IRQ];
41
42
MemoryRegion chipid_mem;
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 int mapline_size(const int *mapline)
48
static void exynos4210_init_board_irqs(Exynos4210State *s)
49
{
50
uint32_t grp, bit, irq_id, n;
51
- Exynos4210Irq *is = &s->irqs;
52
DeviceState *extgicdev = DEVICE(&s->ext_gic);
53
+ DeviceState *intcdev = DEVICE(&s->int_combiner);
54
+ DeviceState *extcdev = DEVICE(&s->ext_combiner);
55
int splitcount = 0;
56
DeviceState *splitter;
57
const int *mapline;
58
@@ -XXX,XX +XXX,XX @@ static void exynos4210_init_board_irqs(Exynos4210State *s)
59
splitin = 0;
60
for (;;) {
61
s->irq_table[in] = qdev_get_gpio_in(splitter, 0);
62
- qdev_connect_gpio_out(splitter, splitin, is->int_combiner_irq[in]);
63
- qdev_connect_gpio_out(splitter, splitin + 1, is->ext_combiner_irq[in]);
64
+ qdev_connect_gpio_out(splitter, splitin,
65
+ qdev_get_gpio_in(intcdev, in));
66
+ qdev_connect_gpio_out(splitter, splitin + 1,
67
+ qdev_get_gpio_in(extcdev, in));
68
splitin += 2;
69
if (!mapline) {
70
break;
71
@@ -XXX,XX +XXX,XX @@ static void exynos4210_init_board_irqs(Exynos4210State *s)
72
qdev_realize(splitter, NULL, &error_abort);
73
splitcount++;
74
s->irq_table[n] = qdev_get_gpio_in(splitter, 0);
75
- qdev_connect_gpio_out(splitter, 0, is->int_combiner_irq[n]);
76
+ qdev_connect_gpio_out(splitter, 0, qdev_get_gpio_in(intcdev, n));
77
qdev_connect_gpio_out(splitter, 1,
78
qdev_get_gpio_in(extgicdev, irq_id - 32));
79
} else {
80
- s->irq_table[n] = is->int_combiner_irq[n];
81
+ s->irq_table[n] = qdev_get_gpio_in(intcdev, n);
82
}
83
}
84
/*
85
@@ -XXX,XX +XXX,XX @@ uint32_t exynos4210_get_irq(uint32_t grp, uint32_t bit)
86
return EXYNOS4210_COMBINER_GET_IRQ_NUM(grp, bit);
87
}
88
89
-/*
90
- * Get Combiner input GPIO into irqs structure
91
- */
92
-static void exynos4210_combiner_get_gpioin(Exynos4210Irq *irqs,
93
- DeviceState *dev, int ext)
94
-{
95
- int n;
96
- int max;
97
- qemu_irq *irq;
98
-
99
- max = ext ? EXYNOS4210_MAX_EXT_COMBINER_IN_IRQ :
100
- EXYNOS4210_MAX_INT_COMBINER_IN_IRQ;
101
- irq = ext ? irqs->ext_combiner_irq : irqs->int_combiner_irq;
102
-
103
- for (n = 0; n < max; n++) {
104
- irq[n] = qdev_get_gpio_in(dev, n);
105
- }
106
-}
107
-
108
static uint8_t chipid_and_omr[] = { 0x11, 0x02, 0x21, 0x43,
109
0x09, 0x00, 0x00, 0x00 };
110
111
@@ -XXX,XX +XXX,XX @@ static void exynos4210_realize(DeviceState *socdev, Error **errp)
112
sysbus_connect_irq(busdev, n,
113
qdev_get_gpio_in(DEVICE(&s->a9mpcore), n));
114
}
115
- exynos4210_combiner_get_gpioin(&s->irqs, DEVICE(&s->int_combiner), 0);
116
sysbus_mmio_map(busdev, 0, EXYNOS4210_INT_COMBINER_BASE_ADDR);
117
118
/* External Interrupt Combiner */
119
@@ -XXX,XX +XXX,XX @@ static void exynos4210_realize(DeviceState *socdev, Error **errp)
120
for (n = 0; n < EXYNOS4210_MAX_INT_COMBINER_OUT_IRQ; n++) {
121
sysbus_connect_irq(busdev, n, qdev_get_gpio_in(DEVICE(&s->ext_gic), n));
122
}
123
- exynos4210_combiner_get_gpioin(&s->irqs, DEVICE(&s->ext_combiner), 1);
124
sysbus_mmio_map(busdev, 0, EXYNOS4210_EXT_COMBINER_BASE_ADDR);
125
126
/* Initialize board IRQs. */
26
--
127
--
27
2.20.1
128
2.25.1
28
29
diff view generated by jsdifflib
1
From: Guenter Roeck <linux@roeck-us.net>
1
From: Zongyuan Li <zongyuan.li@smartx.com>
2
2
3
Instantiating PWM, CAN, CAAM, and OCOTP devices is necessary to avoid
3
Signed-off-by: Zongyuan Li <zongyuan.li@smartx.com>
4
crashes when booting mainline Linux.
5
6
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
4
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
7
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
5
Message-id: 20220324181557.203805-2-zongyuan.li@smartx.com
8
Message-id: 20200517162135.110364-8-linux@roeck-us.net
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
---
7
---
11
include/hw/arm/fsl-imx7.h | 16 ++++++++++++++++
8
hw/arm/realview.c | 33 ++++++++++++++++++++++++---------
12
hw/arm/fsl-imx7.c | 24 ++++++++++++++++++++++++
9
1 file changed, 24 insertions(+), 9 deletions(-)
13
2 files changed, 40 insertions(+)
14
10
15
diff --git a/include/hw/arm/fsl-imx7.h b/include/hw/arm/fsl-imx7.h
11
diff --git a/hw/arm/realview.c b/hw/arm/realview.c
16
index XXXXXXX..XXXXXXX 100644
12
index XXXXXXX..XXXXXXX 100644
17
--- a/include/hw/arm/fsl-imx7.h
13
--- a/hw/arm/realview.c
18
+++ b/include/hw/arm/fsl-imx7.h
14
+++ b/hw/arm/realview.c
19
@@ -XXX,XX +XXX,XX @@ enum FslIMX7MemoryMap {
15
@@ -XXX,XX +XXX,XX @@
20
FSL_IMX7_IOMUXC_GPR_ADDR = 0x30340000,
16
#include "hw/sysbus.h"
21
FSL_IMX7_IOMUXCn_SIZE = 0x1000,
17
#include "hw/arm/boot.h"
22
18
#include "hw/arm/primecell.h"
23
+ FSL_IMX7_OCOTP_ADDR = 0x30350000,
19
+#include "hw/core/split-irq.h"
24
+ FSL_IMX7_OCOTP_SIZE = 0x10000,
20
#include "hw/net/lan9118.h"
21
#include "hw/net/smc91c111.h"
22
#include "hw/pci/pci.h"
23
+#include "hw/qdev-core.h"
24
#include "net/net.h"
25
#include "sysemu/sysemu.h"
26
#include "hw/boards.h"
27
@@ -XXX,XX +XXX,XX @@ static const int realview_board_id[] = {
28
0x76d
29
};
30
31
+static void split_irq_from_named(DeviceState *src, const char* outname,
32
+ qemu_irq out1, qemu_irq out2) {
33
+ DeviceState *splitter = qdev_new(TYPE_SPLIT_IRQ);
25
+
34
+
26
FSL_IMX7_ANALOG_ADDR = 0x30360000,
35
+ qdev_prop_set_uint32(splitter, "num-lines", 2);
27
FSL_IMX7_SNVS_ADDR = 0x30370000,
28
FSL_IMX7_CCM_ADDR = 0x30380000,
29
@@ -XXX,XX +XXX,XX @@ enum FslIMX7MemoryMap {
30
FSL_IMX7_ADC2_ADDR = 0x30620000,
31
FSL_IMX7_ADCn_SIZE = 0x1000,
32
33
+ FSL_IMX7_PWM1_ADDR = 0x30660000,
34
+ FSL_IMX7_PWM2_ADDR = 0x30670000,
35
+ FSL_IMX7_PWM3_ADDR = 0x30680000,
36
+ FSL_IMX7_PWM4_ADDR = 0x30690000,
37
+ FSL_IMX7_PWMn_SIZE = 0x10000,
38
+
36
+
39
FSL_IMX7_PCIE_PHY_ADDR = 0x306D0000,
37
+ qdev_realize_and_unref(splitter, NULL, &error_fatal);
40
FSL_IMX7_PCIE_PHY_SIZE = 0x10000,
41
42
FSL_IMX7_GPC_ADDR = 0x303A0000,
43
44
+ FSL_IMX7_CAAM_ADDR = 0x30900000,
45
+ FSL_IMX7_CAAM_SIZE = 0x40000,
46
+
38
+
47
+ FSL_IMX7_CAN1_ADDR = 0x30A00000,
39
+ qdev_connect_gpio_out(splitter, 0, out1);
48
+ FSL_IMX7_CAN2_ADDR = 0x30A10000,
40
+ qdev_connect_gpio_out(splitter, 1, out2);
49
+ FSL_IMX7_CANn_SIZE = 0x10000,
41
+ qdev_connect_gpio_out_named(src, outname, 0,
42
+ qdev_get_gpio_in(splitter, 0));
43
+}
50
+
44
+
51
FSL_IMX7_I2C1_ADDR = 0x30A20000,
45
static void realview_init(MachineState *machine,
52
FSL_IMX7_I2C2_ADDR = 0x30A30000,
46
enum realview_board_type board_type)
53
FSL_IMX7_I2C3_ADDR = 0x30A40000,
47
{
54
diff --git a/hw/arm/fsl-imx7.c b/hw/arm/fsl-imx7.c
48
@@ -XXX,XX +XXX,XX @@ static void realview_init(MachineState *machine,
55
index XXXXXXX..XXXXXXX 100644
49
DeviceState *dev, *sysctl, *gpio2, *pl041;
56
--- a/hw/arm/fsl-imx7.c
50
SysBusDevice *busdev;
57
+++ b/hw/arm/fsl-imx7.c
51
qemu_irq pic[64];
58
@@ -XXX,XX +XXX,XX @@ static void fsl_imx7_realize(DeviceState *dev, Error **errp)
52
- qemu_irq mmc_irq[2];
53
PCIBus *pci_bus = NULL;
54
NICInfo *nd;
55
DriveInfo *dinfo;
56
@@ -XXX,XX +XXX,XX @@ static void realview_init(MachineState *machine,
57
* and the PL061 has them the other way about. Also the card
58
* detect line is inverted.
59
*/
59
*/
60
create_unimplemented_device("sdma", FSL_IMX7_SDMA_ADDR, FSL_IMX7_SDMA_SIZE);
60
- mmc_irq[0] = qemu_irq_split(
61
61
- qdev_get_gpio_in(sysctl, ARM_SYSCTL_GPIO_MMC_WPROT),
62
+ /*
62
- qdev_get_gpio_in(gpio2, 1));
63
+ * CAAM
63
- mmc_irq[1] = qemu_irq_split(
64
+ */
64
- qdev_get_gpio_in(sysctl, ARM_SYSCTL_GPIO_MMC_CARDIN),
65
+ create_unimplemented_device("caam", FSL_IMX7_CAAM_ADDR, FSL_IMX7_CAAM_SIZE);
65
- qemu_irq_invert(qdev_get_gpio_in(gpio2, 0)));
66
- qdev_connect_gpio_out_named(dev, "card-read-only", 0, mmc_irq[0]);
67
- qdev_connect_gpio_out_named(dev, "card-inserted", 0, mmc_irq[1]);
68
+ split_irq_from_named(dev, "card-read-only",
69
+ qdev_get_gpio_in(sysctl, ARM_SYSCTL_GPIO_MMC_WPROT),
70
+ qdev_get_gpio_in(gpio2, 1));
66
+
71
+
67
+ /*
72
+ split_irq_from_named(dev, "card-inserted",
68
+ * PWM
73
+ qdev_get_gpio_in(sysctl, ARM_SYSCTL_GPIO_MMC_CARDIN),
69
+ */
74
+ qemu_irq_invert(qdev_get_gpio_in(gpio2, 0)));
70
+ create_unimplemented_device("pwm1", FSL_IMX7_PWM1_ADDR, FSL_IMX7_PWMn_SIZE);
71
+ create_unimplemented_device("pwm2", FSL_IMX7_PWM2_ADDR, FSL_IMX7_PWMn_SIZE);
72
+ create_unimplemented_device("pwm3", FSL_IMX7_PWM3_ADDR, FSL_IMX7_PWMn_SIZE);
73
+ create_unimplemented_device("pwm4", FSL_IMX7_PWM4_ADDR, FSL_IMX7_PWMn_SIZE);
74
+
75
+
75
+ /*
76
dinfo = drive_get(IF_SD, 0, 0);
76
+ * CAN
77
if (dinfo) {
77
+ */
78
DeviceState *card;
78
+ create_unimplemented_device("can1", FSL_IMX7_CAN1_ADDR, FSL_IMX7_CANn_SIZE);
79
+ create_unimplemented_device("can2", FSL_IMX7_CAN2_ADDR, FSL_IMX7_CANn_SIZE);
80
+
81
+ /*
82
+ * OCOTP
83
+ */
84
+ create_unimplemented_device("ocotp", FSL_IMX7_OCOTP_ADDR,
85
+ FSL_IMX7_OCOTP_SIZE);
86
87
object_property_set_bool(OBJECT(&s->gpr), true, "realized",
88
&error_abort);
89
--
79
--
90
2.20.1
80
2.25.1
91
92
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
1
From: Zongyuan Li <zongyuan.li@smartx.com>
2
2
3
hw_error() calls exit(). This a bit overkill when we can log
3
Signed-off-by: Zongyuan Li <zongyuan.li@smartx.com>
4
the accesses as unimplemented or guest error.
4
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
5
5
Message-id: 20220324181557.203805-3-zongyuan.li@smartx.com
6
When fuzzing the devices, we don't want the whole process to
7
exit. Replace some hw_error() calls by qemu_log_mask().
8
9
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
10
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
11
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
12
Message-id: 20200518140309.5220-4-f4bug@amsat.org
13
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
14
---
7
---
15
hw/char/xilinx_uartlite.c | 5 +++--
8
hw/arm/stellaris.c | 15 +++++++++++++--
16
1 file changed, 3 insertions(+), 2 deletions(-)
9
1 file changed, 13 insertions(+), 2 deletions(-)
17
10
18
diff --git a/hw/char/xilinx_uartlite.c b/hw/char/xilinx_uartlite.c
11
diff --git a/hw/arm/stellaris.c b/hw/arm/stellaris.c
19
index XXXXXXX..XXXXXXX 100644
12
index XXXXXXX..XXXXXXX 100644
20
--- a/hw/char/xilinx_uartlite.c
13
--- a/hw/arm/stellaris.c
21
+++ b/hw/char/xilinx_uartlite.c
14
+++ b/hw/arm/stellaris.c
22
@@ -XXX,XX +XXX,XX @@
15
@@ -XXX,XX +XXX,XX @@
23
*/
24
16
25
#include "qemu/osdep.h"
17
#include "qemu/osdep.h"
26
-#include "hw/hw.h"
18
#include "qapi/error.h"
27
+#include "qemu/log.h"
19
+#include "hw/core/split-irq.h"
28
#include "hw/irq.h"
29
#include "hw/qdev-properties.h"
30
#include "hw/sysbus.h"
20
#include "hw/sysbus.h"
31
@@ -XXX,XX +XXX,XX @@ uart_write(void *opaque, hwaddr addr,
21
#include "hw/sd/sd.h"
32
switch (addr)
22
#include "hw/ssi/ssi.h"
33
{
23
@@ -XXX,XX +XXX,XX @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board)
34
case R_STATUS:
24
DeviceState *ssddev;
35
- hw_error("write to UART STATUS?\n");
25
DriveInfo *dinfo;
36
+ qemu_log_mask(LOG_GUEST_ERROR, "%s: write to UART STATUS\n",
26
DeviceState *carddev;
37
+ __func__);
27
+ DeviceState *gpio_d_splitter;
38
break;
28
BlockBackend *blk;
39
29
40
case R_CTRL:
30
/*
31
@@ -XXX,XX +XXX,XX @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board)
32
&error_fatal);
33
34
ssddev = ssi_create_peripheral(bus, "ssd0323");
35
- gpio_out[GPIO_D][0] = qemu_irq_split(
36
- qdev_get_gpio_in_named(sddev, SSI_GPIO_CS, 0),
37
+
38
+ gpio_d_splitter = qdev_new(TYPE_SPLIT_IRQ);
39
+ qdev_prop_set_uint32(gpio_d_splitter, "num-lines", 2);
40
+ qdev_realize_and_unref(gpio_d_splitter, NULL, &error_fatal);
41
+ qdev_connect_gpio_out(
42
+ gpio_d_splitter, 0,
43
+ qdev_get_gpio_in_named(sddev, SSI_GPIO_CS, 0));
44
+ qdev_connect_gpio_out(
45
+ gpio_d_splitter, 1,
46
qdev_get_gpio_in_named(ssddev, SSI_GPIO_CS, 0));
47
+ gpio_out[GPIO_D][0] = qdev_get_gpio_in(gpio_d_splitter, 0);
48
+
49
gpio_out[GPIO_C][7] = qdev_get_gpio_in(ssddev, 0);
50
51
/* Make sure the select pin is high. */
41
--
52
--
42
2.20.1
53
2.25.1
43
44
diff view generated by jsdifflib
1
From: Geert Uytterhoeven <geert+renesas@glider.be>
1
From: Zongyuan Li <zongyuan.li@smartx.com>
2
2
3
Add a definition for the number of GPIO lines controlled by a PL061
3
Signed-off-by: Zongyuan Li <zongyuan.li@smartx.com>
4
instance, and use it instead of the hardcoded magic value 8.
4
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
5
5
Message-id: 20220324181557.203805-5-zongyuan.li@smartx.com
6
Suggested-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
6
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/811
7
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
8
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
9
Message-id: 20200519085143.1376-1-geert+renesas@glider.be
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
---
8
---
12
hw/gpio/pl061.c | 12 +++++++-----
9
include/hw/irq.h | 5 -----
13
1 file changed, 7 insertions(+), 5 deletions(-)
10
hw/core/irq.c | 15 ---------------
11
2 files changed, 20 deletions(-)
14
12
15
diff --git a/hw/gpio/pl061.c b/hw/gpio/pl061.c
13
diff --git a/include/hw/irq.h b/include/hw/irq.h
16
index XXXXXXX..XXXXXXX 100644
14
index XXXXXXX..XXXXXXX 100644
17
--- a/hw/gpio/pl061.c
15
--- a/include/hw/irq.h
18
+++ b/hw/gpio/pl061.c
16
+++ b/include/hw/irq.h
19
@@ -XXX,XX +XXX,XX @@ static const uint8_t pl061_id_luminary[12] =
17
@@ -XXX,XX +XXX,XX @@ void qemu_free_irq(qemu_irq irq);
20
#define TYPE_PL061 "pl061"
18
/* Returns a new IRQ with opposite polarity. */
21
#define PL061(obj) OBJECT_CHECK(PL061State, (obj), TYPE_PL061)
19
qemu_irq qemu_irq_invert(qemu_irq irq);
22
20
23
+#define N_GPIOS 8
21
-/* Returns a new IRQ which feeds into both the passed IRQs.
24
+
22
- * It's probably better to use the TYPE_SPLIT_IRQ device instead.
25
typedef struct PL061State {
23
- */
26
SysBusDevice parent_obj;
24
-qemu_irq qemu_irq_split(qemu_irq irq1, qemu_irq irq2);
27
25
-
28
@@ -XXX,XX +XXX,XX @@ typedef struct PL061State {
26
/* For internal use in qtest. Similar to qemu_irq_split, but operating
29
uint32_t cr;
27
on an existing vector of qemu_irq. */
30
uint32_t amsel;
28
void qemu_irq_intercept_in(qemu_irq *gpio_in, qemu_irq_handler handler, int n);
31
qemu_irq irq;
29
diff --git a/hw/core/irq.c b/hw/core/irq.c
32
- qemu_irq out[8];
30
index XXXXXXX..XXXXXXX 100644
33
+ qemu_irq out[N_GPIOS];
31
--- a/hw/core/irq.c
34
const unsigned char *id;
32
+++ b/hw/core/irq.c
35
uint32_t rsvd_start; /* reserved area: [rsvd_start, 0xfcc] */
33
@@ -XXX,XX +XXX,XX @@ qemu_irq qemu_irq_invert(qemu_irq irq)
36
} PL061State;
34
return qemu_allocate_irq(qemu_notirq, irq, 0);
37
@@ -XXX,XX +XXX,XX @@ static void pl061_update(PL061State *s)
38
changed = s->old_out_data ^ out;
39
if (changed) {
40
s->old_out_data = out;
41
- for (i = 0; i < 8; i++) {
42
+ for (i = 0; i < N_GPIOS; i++) {
43
mask = 1 << i;
44
if (changed & mask) {
45
DPRINTF("Set output %d = %d\n", i, (out & mask) != 0);
46
@@ -XXX,XX +XXX,XX @@ static void pl061_update(PL061State *s)
47
changed = (s->old_in_data ^ s->data) & ~s->dir;
48
if (changed) {
49
s->old_in_data = s->data;
50
- for (i = 0; i < 8; i++) {
51
+ for (i = 0; i < N_GPIOS; i++) {
52
mask = 1 << i;
53
if (changed & mask) {
54
DPRINTF("Changed input %d = %d\n", i, (s->data & mask) != 0);
55
@@ -XXX,XX +XXX,XX @@ static void pl061_init(Object *obj)
56
memory_region_init_io(&s->iomem, obj, &pl061_ops, s, "pl061", 0x1000);
57
sysbus_init_mmio(sbd, &s->iomem);
58
sysbus_init_irq(sbd, &s->irq);
59
- qdev_init_gpio_in(dev, pl061_set_irq, 8);
60
- qdev_init_gpio_out(dev, s->out, 8);
61
+ qdev_init_gpio_in(dev, pl061_set_irq, N_GPIOS);
62
+ qdev_init_gpio_out(dev, s->out, N_GPIOS);
63
}
35
}
64
36
65
static void pl061_class_init(ObjectClass *klass, void *data)
37
-static void qemu_splitirq(void *opaque, int line, int level)
38
-{
39
- struct IRQState **irq = opaque;
40
- irq[0]->handler(irq[0]->opaque, irq[0]->n, level);
41
- irq[1]->handler(irq[1]->opaque, irq[1]->n, level);
42
-}
43
-
44
-qemu_irq qemu_irq_split(qemu_irq irq1, qemu_irq irq2)
45
-{
46
- qemu_irq *s = g_new0(qemu_irq, 2);
47
- s[0] = irq1;
48
- s[1] = irq2;
49
- return qemu_allocate_irq(qemu_splitirq, s, 0);
50
-}
51
-
52
void qemu_irq_intercept_in(qemu_irq *gpio_in, qemu_irq_handler handler, int n)
53
{
54
int i;
66
--
55
--
67
2.20.1
56
2.25.1
68
69
diff view generated by jsdifflib
1
From: Guenter Roeck <linux@roeck-us.net>
1
From: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2
2
3
In preparation for a full implementation, move i.MX watchdog driver
3
Describe that the gic-version influences the maximum number of CPUs.
4
from hw/misc to hw/watchdog. While at it, add the watchdog files
5
to MAINTAINERS.
6
4
7
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
5
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
8
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
6
Message-id: 20220413231456.35811-1-heinrich.schuchardt@canonical.com
9
Message-id: 20200517162135.110364-2-linux@roeck-us.net
7
[PMM: minor punctuation tweaks]
8
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
---
10
---
12
include/hw/arm/fsl-imx6.h | 2 +-
11
docs/system/arm/virt.rst | 4 ++--
13
include/hw/arm/fsl-imx6ul.h | 2 +-
12
1 file changed, 2 insertions(+), 2 deletions(-)
14
include/hw/arm/fsl-imx7.h | 2 +-
15
include/hw/{misc/imx2_wdt.h => watchdog/wdt_imx2.h} | 0
16
hw/{misc/imx2_wdt.c => watchdog/wdt_imx2.c} | 2 +-
17
MAINTAINERS | 2 ++
18
hw/arm/Kconfig | 3 +++
19
hw/misc/Makefile.objs | 1 -
20
hw/watchdog/Kconfig | 3 +++
21
hw/watchdog/Makefile.objs | 1 +
22
10 files changed, 13 insertions(+), 5 deletions(-)
23
rename include/hw/{misc/imx2_wdt.h => watchdog/wdt_imx2.h} (100%)
24
rename hw/{misc/imx2_wdt.c => watchdog/wdt_imx2.c} (98%)
25
13
26
diff --git a/include/hw/arm/fsl-imx6.h b/include/hw/arm/fsl-imx6.h
14
diff --git a/docs/system/arm/virt.rst b/docs/system/arm/virt.rst
27
index XXXXXXX..XXXXXXX 100644
15
index XXXXXXX..XXXXXXX 100644
28
--- a/include/hw/arm/fsl-imx6.h
16
--- a/docs/system/arm/virt.rst
29
+++ b/include/hw/arm/fsl-imx6.h
17
+++ b/docs/system/arm/virt.rst
30
@@ -XXX,XX +XXX,XX @@
18
@@ -XXX,XX +XXX,XX @@ gic-version
31
#include "hw/cpu/a9mpcore.h"
19
Valid values are:
32
#include "hw/misc/imx6_ccm.h"
20
33
#include "hw/misc/imx6_src.h"
21
``2``
34
-#include "hw/misc/imx2_wdt.h"
22
- GICv2
35
+#include "hw/watchdog/wdt_imx2.h"
23
+ GICv2. Note that this limits the number of CPUs to 8.
36
#include "hw/char/imx_serial.h"
24
``3``
37
#include "hw/timer/imx_gpt.h"
25
- GICv3
38
#include "hw/timer/imx_epit.h"
26
+ GICv3. This allows up to 512 CPUs.
39
diff --git a/include/hw/arm/fsl-imx6ul.h b/include/hw/arm/fsl-imx6ul.h
27
``host``
40
index XXXXXXX..XXXXXXX 100644
28
Use the same GIC version the host provides, when using KVM
41
--- a/include/hw/arm/fsl-imx6ul.h
29
``max``
42
+++ b/include/hw/arm/fsl-imx6ul.h
43
@@ -XXX,XX +XXX,XX @@
44
#include "hw/misc/imx7_snvs.h"
45
#include "hw/misc/imx7_gpr.h"
46
#include "hw/intc/imx_gpcv2.h"
47
-#include "hw/misc/imx2_wdt.h"
48
+#include "hw/watchdog/wdt_imx2.h"
49
#include "hw/gpio/imx_gpio.h"
50
#include "hw/char/imx_serial.h"
51
#include "hw/timer/imx_gpt.h"
52
diff --git a/include/hw/arm/fsl-imx7.h b/include/hw/arm/fsl-imx7.h
53
index XXXXXXX..XXXXXXX 100644
54
--- a/include/hw/arm/fsl-imx7.h
55
+++ b/include/hw/arm/fsl-imx7.h
56
@@ -XXX,XX +XXX,XX @@
57
#include "hw/misc/imx7_snvs.h"
58
#include "hw/misc/imx7_gpr.h"
59
#include "hw/misc/imx6_src.h"
60
-#include "hw/misc/imx2_wdt.h"
61
+#include "hw/watchdog/wdt_imx2.h"
62
#include "hw/gpio/imx_gpio.h"
63
#include "hw/char/imx_serial.h"
64
#include "hw/timer/imx_gpt.h"
65
diff --git a/include/hw/misc/imx2_wdt.h b/include/hw/watchdog/wdt_imx2.h
66
similarity index 100%
67
rename from include/hw/misc/imx2_wdt.h
68
rename to include/hw/watchdog/wdt_imx2.h
69
diff --git a/hw/misc/imx2_wdt.c b/hw/watchdog/wdt_imx2.c
70
similarity index 98%
71
rename from hw/misc/imx2_wdt.c
72
rename to hw/watchdog/wdt_imx2.c
73
index XXXXXXX..XXXXXXX 100644
74
--- a/hw/misc/imx2_wdt.c
75
+++ b/hw/watchdog/wdt_imx2.c
76
@@ -XXX,XX +XXX,XX @@
77
#include "qemu/module.h"
78
#include "sysemu/watchdog.h"
79
80
-#include "hw/misc/imx2_wdt.h"
81
+#include "hw/watchdog/wdt_imx2.h"
82
83
#define IMX2_WDT_WCR_WDA BIT(5) /* -> External Reset WDOG_B */
84
#define IMX2_WDT_WCR_SRS BIT(4) /* -> Software Reset Signal */
85
diff --git a/MAINTAINERS b/MAINTAINERS
86
index XXXXXXX..XXXXXXX 100644
87
--- a/MAINTAINERS
88
+++ b/MAINTAINERS
89
@@ -XXX,XX +XXX,XX @@ S: Odd Fixes
90
F: hw/arm/fsl-imx25.c
91
F: hw/arm/imx25_pdk.c
92
F: hw/misc/imx25_ccm.c
93
+F: hw/watchdog/wdt_imx2.c
94
F: include/hw/arm/fsl-imx25.h
95
F: include/hw/misc/imx25_ccm.h
96
+F: include/hw/watchdog/wdt_imx2.h
97
98
i.MX31 (kzm)
99
M: Peter Chubb <peter.chubb@nicta.com.au>
100
diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig
101
index XXXXXXX..XXXXXXX 100644
102
--- a/hw/arm/Kconfig
103
+++ b/hw/arm/Kconfig
104
@@ -XXX,XX +XXX,XX @@ config FSL_IMX6
105
select IMX_FEC
106
select IMX_I2C
107
select IMX_USBPHY
108
+ select WDT_IMX2
109
select SDHCI
110
111
config ASPEED_SOC
112
@@ -XXX,XX +XXX,XX @@ config FSL_IMX7
113
select IMX
114
select IMX_FEC
115
select IMX_I2C
116
+ select WDT_IMX2
117
select PCI_EXPRESS_DESIGNWARE
118
select SDHCI
119
select UNIMP
120
@@ -XXX,XX +XXX,XX @@ config FSL_IMX6UL
121
select IMX
122
select IMX_FEC
123
select IMX_I2C
124
+ select WDT_IMX2
125
select SDHCI
126
select UNIMP
127
128
diff --git a/hw/misc/Makefile.objs b/hw/misc/Makefile.objs
129
index XXXXXXX..XXXXXXX 100644
130
--- a/hw/misc/Makefile.objs
131
+++ b/hw/misc/Makefile.objs
132
@@ -XXX,XX +XXX,XX @@ common-obj-$(CONFIG_IMX) += imx6_ccm.o
133
common-obj-$(CONFIG_IMX) += imx6ul_ccm.o
134
obj-$(CONFIG_IMX) += imx6_src.o
135
common-obj-$(CONFIG_IMX) += imx7_ccm.o
136
-common-obj-$(CONFIG_IMX) += imx2_wdt.o
137
common-obj-$(CONFIG_IMX) += imx7_snvs.o
138
common-obj-$(CONFIG_IMX) += imx7_gpr.o
139
common-obj-$(CONFIG_IMX) += imx_rngc.o
140
diff --git a/hw/watchdog/Kconfig b/hw/watchdog/Kconfig
141
index XXXXXXX..XXXXXXX 100644
142
--- a/hw/watchdog/Kconfig
143
+++ b/hw/watchdog/Kconfig
144
@@ -XXX,XX +XXX,XX @@ config WDT_IB700
145
146
config WDT_DIAG288
147
bool
148
+
149
+config WDT_IMX2
150
+ bool
151
diff --git a/hw/watchdog/Makefile.objs b/hw/watchdog/Makefile.objs
152
index XXXXXXX..XXXXXXX 100644
153
--- a/hw/watchdog/Makefile.objs
154
+++ b/hw/watchdog/Makefile.objs
155
@@ -XXX,XX +XXX,XX @@ common-obj-$(CONFIG_WDT_IB6300ESB) += wdt_i6300esb.o
156
common-obj-$(CONFIG_WDT_IB700) += wdt_ib700.o
157
common-obj-$(CONFIG_WDT_DIAG288) += wdt_diag288.o
158
common-obj-$(CONFIG_ASPEED_SOC) += wdt_aspeed.o
159
+common-obj-$(CONFIG_WDT_IMX2) += wdt_imx2.o
160
--
30
--
161
2.20.1
31
2.25.1
162
163
diff view generated by jsdifflib
1
In linux-user/arm/cpu-loop.c we incorrectly treat EXCP_BKPT similarly
1
From: Hao Wu <wuhaotsh@google.com>
2
to EXCP_SWI, which means that if the guest executes a BKPT insn then
3
QEMU will perform a syscall for it (which syscall depends on what
4
value happens to be in r7...). The correct behaviour is that the
5
guest process should take a SIGTRAP.
6
2
7
This code has been like this (more or less) since commit
3
Similar to the Aspeed code in include/misc/aspeed_scu.h, we define
8
06c949e62a098f in 2006 which added BKPT in the first place. This is
4
the PWRON STRAP fields in their corresponding module for NPCM7XX.
9
probably because at the time the same code path was used to handle
10
both Linux syscalls and semihosting calls, and (on M profile) BKPT
11
with a suitable magic number is used for semihosting calls. But
12
these days we've moved handling of semihosting out to an entirely
13
different codepath, so we can fix this bug by simply removing this
14
handling of EXCP_BKPT and instead making it deliver a SIGTRAP like
15
EXCP_DEBUG (as we do already on aarch64).
16
5
17
Reported-by: <omerg681@gmail.com>
6
Signed-off-by: Hao Wu <wuhaotsh@google.com>
18
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
7
Reviewed-by: Patrick Venture <venture@google.com>
19
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
8
Message-id: 20220411165842.3912945-2-wuhaotsh@google.com
20
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
21
Message-id: 20200420212206.12776-2-peter.maydell@linaro.org
22
Fixes: https://bugs.launchpad.net/qemu/+bug/1873898
23
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
24
---
11
---
25
linux-user/arm/cpu_loop.c | 30 ++++++++----------------------
12
include/hw/misc/npcm7xx_gcr.h | 30 ++++++++++++++++++++++++++++++
26
1 file changed, 8 insertions(+), 22 deletions(-)
13
1 file changed, 30 insertions(+)
27
14
28
diff --git a/linux-user/arm/cpu_loop.c b/linux-user/arm/cpu_loop.c
15
diff --git a/include/hw/misc/npcm7xx_gcr.h b/include/hw/misc/npcm7xx_gcr.h
29
index XXXXXXX..XXXXXXX 100644
16
index XXXXXXX..XXXXXXX 100644
30
--- a/linux-user/arm/cpu_loop.c
17
--- a/include/hw/misc/npcm7xx_gcr.h
31
+++ b/linux-user/arm/cpu_loop.c
18
+++ b/include/hw/misc/npcm7xx_gcr.h
32
@@ -XXX,XX +XXX,XX @@ void cpu_loop(CPUARMState *env)
19
@@ -XXX,XX +XXX,XX @@
33
}
20
#include "exec/memory.h"
34
break;
21
#include "hw/sysbus.h"
35
case EXCP_SWI:
22
36
- case EXCP_BKPT:
23
+/*
37
{
24
+ * NPCM7XX PWRON STRAP bit fields
38
env->eabi = 1;
25
+ * 12: SPI0 powered by VSBV3 at 1.8V
39
/* system call */
26
+ * 11: System flash attached to BMC
40
- if (trapnr == EXCP_BKPT) {
27
+ * 10: BSP alternative pins.
41
- if (env->thumb) {
28
+ * 9:8: Flash UART command route enabled.
42
- /* FIXME - what to do if get_user() fails? */
29
+ * 7: Security enabled.
43
- get_user_code_u16(insn, env->regs[15], env);
30
+ * 6: HI-Z state control.
44
- n = insn & 0xff;
31
+ * 5: ECC disabled.
45
- env->regs[15] += 2;
32
+ * 4: Reserved
46
- } else {
33
+ * 3: JTAG2 enabled.
47
- /* FIXME - what to do if get_user() fails? */
34
+ * 2:0: CPU and DRAM clock frequency.
48
- get_user_code_u32(insn, env->regs[15], env);
35
+ */
49
- n = (insn & 0xf) | ((insn >> 4) & 0xff0);
36
+#define NPCM7XX_PWRON_STRAP_SPI0F18 BIT(12)
50
- env->regs[15] += 4;
37
+#define NPCM7XX_PWRON_STRAP_SFAB BIT(11)
51
- }
38
+#define NPCM7XX_PWRON_STRAP_BSPA BIT(10)
52
+ if (env->thumb) {
39
+#define NPCM7XX_PWRON_STRAP_FUP(x) ((x) << 8)
53
+ /* FIXME - what to do if get_user() fails? */
40
+#define FUP_NORM_UART2 3
54
+ get_user_code_u16(insn, env->regs[15] - 2, env);
41
+#define FUP_PROG_UART3 2
55
+ n = insn & 0xff;
42
+#define FUP_PROG_UART2 1
56
} else {
43
+#define FUP_NORM_UART3 0
57
- if (env->thumb) {
44
+#define NPCM7XX_PWRON_STRAP_SECEN BIT(7)
58
- /* FIXME - what to do if get_user() fails? */
45
+#define NPCM7XX_PWRON_STRAP_HIZ BIT(6)
59
- get_user_code_u16(insn, env->regs[15] - 2, env);
46
+#define NPCM7XX_PWRON_STRAP_ECC BIT(5)
60
- n = insn & 0xff;
47
+#define NPCM7XX_PWRON_STRAP_RESERVE1 BIT(4)
61
- } else {
48
+#define NPCM7XX_PWRON_STRAP_J2EN BIT(3)
62
- /* FIXME - what to do if get_user() fails? */
49
+#define NPCM7XX_PWRON_STRAP_CKFRQ(x) (x)
63
- get_user_code_u32(insn, env->regs[15] - 4, env);
50
+#define CKFRQ_SKIPINIT 0x000
64
- n = insn & 0xffffff;
51
+#define CKFRQ_DEFAULT 0x111
65
- }
52
+
66
+ /* FIXME - what to do if get_user() fails? */
53
/*
67
+ get_user_code_u32(insn, env->regs[15] - 4, env);
54
* Number of registers in our device state structure. Don't change this without
68
+ n = insn & 0xffffff;
55
* incrementing the version_id in the vmstate.
69
}
70
71
if (n == ARM_NR_cacheflush) {
72
@@ -XXX,XX +XXX,XX @@ void cpu_loop(CPUARMState *env)
73
}
74
break;
75
case EXCP_DEBUG:
76
+ case EXCP_BKPT:
77
excp_debug:
78
info.si_signo = TARGET_SIGTRAP;
79
info.si_errno = 0;
80
--
56
--
81
2.20.1
57
2.25.1
82
83
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
1
From: Hao Wu <wuhaotsh@google.com>
2
2
3
hw_error() calls exit(). This a bit overkill when we can log
3
This patch uses the defined fields to describe PWRON STRAPs for
4
the accesses as unimplemented or guest error.
4
better readability.
5
5
6
When fuzzing the devices, we don't want the whole process to
6
Signed-off-by: Hao Wu <wuhaotsh@google.com>
7
exit. Replace some hw_error() calls by qemu_log_mask().
7
Reviewed-by: Patrick Venture <venture@google.com>
8
8
Message-id: 20220411165842.3912945-3-wuhaotsh@google.com
9
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
9
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
10
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
11
Message-id: 20200518140309.5220-2-f4bug@amsat.org
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
---
11
---
14
hw/arm/integratorcp.c | 23 +++++++++++++++--------
12
hw/arm/npcm7xx_boards.c | 24 +++++++++++++++++++-----
15
1 file changed, 15 insertions(+), 8 deletions(-)
13
1 file changed, 19 insertions(+), 5 deletions(-)
16
14
17
diff --git a/hw/arm/integratorcp.c b/hw/arm/integratorcp.c
15
diff --git a/hw/arm/npcm7xx_boards.c b/hw/arm/npcm7xx_boards.c
18
index XXXXXXX..XXXXXXX 100644
16
index XXXXXXX..XXXXXXX 100644
19
--- a/hw/arm/integratorcp.c
17
--- a/hw/arm/npcm7xx_boards.c
20
+++ b/hw/arm/integratorcp.c
18
+++ b/hw/arm/npcm7xx_boards.c
21
@@ -XXX,XX +XXX,XX @@
19
@@ -XXX,XX +XXX,XX @@
22
#include "exec/address-spaces.h"
23
#include "sysemu/runstate.h"
24
#include "sysemu/sysemu.h"
20
#include "sysemu/sysemu.h"
25
+#include "qemu/log.h"
21
#include "sysemu/block-backend.h"
26
#include "qemu/error-report.h"
22
27
#include "hw/char/pl011.h"
23
-#define NPCM750_EVB_POWER_ON_STRAPS 0x00001ff7
28
#include "hw/hw.h"
24
-#define QUANTA_GSJ_POWER_ON_STRAPS 0x00001fff
29
@@ -XXX,XX +XXX,XX @@ static uint64_t integratorcm_read(void *opaque, hwaddr offset,
25
-#define QUANTA_GBS_POWER_ON_STRAPS 0x000017ff
30
/* ??? Voltage control unimplemented. */
26
-#define KUDO_BMC_POWER_ON_STRAPS 0x00001fff
31
return 0;
27
-#define MORI_BMC_POWER_ON_STRAPS 0x00001fff
32
default:
28
+#define NPCM7XX_POWER_ON_STRAPS_DEFAULT ( \
33
- hw_error("integratorcm_read: Unimplemented offset 0x%x\n",
29
+ NPCM7XX_PWRON_STRAP_SPI0F18 | \
34
- (int)offset);
30
+ NPCM7XX_PWRON_STRAP_SFAB | \
35
+ qemu_log_mask(LOG_UNIMP,
31
+ NPCM7XX_PWRON_STRAP_BSPA | \
36
+ "%s: Unimplemented offset 0x%" HWADDR_PRIX "\n",
32
+ NPCM7XX_PWRON_STRAP_FUP(FUP_NORM_UART2) | \
37
+ __func__, offset);
33
+ NPCM7XX_PWRON_STRAP_SECEN | \
38
return 0;
34
+ NPCM7XX_PWRON_STRAP_HIZ | \
39
}
35
+ NPCM7XX_PWRON_STRAP_ECC | \
40
}
36
+ NPCM7XX_PWRON_STRAP_RESERVE1 | \
41
@@ -XXX,XX +XXX,XX @@ static void integratorcm_write(void *opaque, hwaddr offset,
37
+ NPCM7XX_PWRON_STRAP_J2EN | \
42
/* ??? Voltage control unimplemented. */
38
+ NPCM7XX_PWRON_STRAP_CKFRQ(CKFRQ_DEFAULT))
43
break;
39
+
44
default:
40
+#define NPCM750_EVB_POWER_ON_STRAPS ( \
45
- hw_error("integratorcm_write: Unimplemented offset 0x%x\n",
41
+ NPCM7XX_POWER_ON_STRAPS_DEFAULT & ~NPCM7XX_PWRON_STRAP_J2EN)
46
- (int)offset);
42
+#define QUANTA_GSJ_POWER_ON_STRAPS NPCM7XX_POWER_ON_STRAPS_DEFAULT
47
+ qemu_log_mask(LOG_UNIMP,
43
+#define QUANTA_GBS_POWER_ON_STRAPS ( \
48
+ "%s: Unimplemented offset 0x%" HWADDR_PRIX "\n",
44
+ NPCM7XX_POWER_ON_STRAPS_DEFAULT & ~NPCM7XX_PWRON_STRAP_SFAB)
49
+ __func__, offset);
45
+#define KUDO_BMC_POWER_ON_STRAPS NPCM7XX_POWER_ON_STRAPS_DEFAULT
50
break;
46
+#define MORI_BMC_POWER_ON_STRAPS NPCM7XX_POWER_ON_STRAPS_DEFAULT
51
}
47
52
}
48
static const char npcm7xx_default_bootrom[] = "npcm7xx_bootrom.bin";
53
@@ -XXX,XX +XXX,XX @@ static uint64_t icp_pic_read(void *opaque, hwaddr offset,
54
case 5: /* INT_SOFTCLR */
55
case 11: /* FRQ_ENABLECLR */
56
default:
57
- printf ("icp_pic_read: Bad register offset 0x%x\n", (int)offset);
58
+ qemu_log_mask(LOG_GUEST_ERROR, "%s: Bad offset 0x%" HWADDR_PRIX "\n",
59
+ __func__, offset);
60
return 0;
61
}
62
}
63
@@ -XXX,XX +XXX,XX @@ static void icp_pic_write(void *opaque, hwaddr offset,
64
case 8: /* FRQ_STATUS */
65
case 9: /* FRQ_RAWSTAT */
66
default:
67
- printf ("icp_pic_write: Bad register offset 0x%x\n", (int)offset);
68
+ qemu_log_mask(LOG_GUEST_ERROR, "%s: Bad offset 0x%" HWADDR_PRIX "\n",
69
+ __func__, offset);
70
return;
71
}
72
icp_pic_update(s);
73
@@ -XXX,XX +XXX,XX @@ static uint64_t icp_control_read(void *opaque, hwaddr offset,
74
case 3: /* CP_DECODE */
75
return 0x11;
76
default:
77
- hw_error("icp_control_read: Bad offset %x\n", (int)offset);
78
+ qemu_log_mask(LOG_GUEST_ERROR, "%s: Bad offset 0x%" HWADDR_PRIX "\n",
79
+ __func__, offset);
80
return 0;
81
}
82
}
83
@@ -XXX,XX +XXX,XX @@ static void icp_control_write(void *opaque, hwaddr offset,
84
/* Nothing interesting implemented yet. */
85
break;
86
default:
87
- hw_error("icp_control_write: Bad offset %x\n", (int)offset);
88
+ qemu_log_mask(LOG_GUEST_ERROR, "%s: Bad offset 0x%" HWADDR_PRIX "\n",
89
+ __func__, offset);
90
}
91
}
92
49
93
--
50
--
94
2.20.1
51
2.25.1
95
96
diff view generated by jsdifflib