1 | The following changes since commit e5cd695266c5709308aa95b1baae499e4b5d4544: | 1 | First arm pullreq for 7.1. The bulk of this is the qemu_split_irq |
---|---|---|---|
2 | removal. | ||
2 | 3 | ||
3 | Merge remote-tracking branch 'remotes/cody/tags/block-pull-request' into staging (2018-05-08 17:05:58 +0100) | 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 | ||
8 | -- PMM | ||
9 | |||
10 | The following changes since commit 9c125d17e9402c232c46610802e5931b3639d77b: | ||
11 | |||
12 | Merge tag 'pull-tcg-20220420' of https://gitlab.com/rth7680/qemu into staging (2022-04-20 16:43:11 -0700) | ||
4 | 13 | ||
5 | are available in the Git repository at: | 14 | are available in the Git repository at: |
6 | 15 | ||
7 | git://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20180510 | 16 | https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20220421 |
8 | 17 | ||
9 | for you to fetch changes up to 9a9f1f59521f46e8ff4527d9a2b52f83577e2aa3: | 18 | for you to fetch changes up to 5b415dd61bdbf61fb4be0e9f1a7172b8bce682c6: |
10 | 19 | ||
11 | target/arm: Clear SVE high bits for FMOV (2018-05-10 18:10:58 +0100) | 20 | hw/arm: Use bit fields for NPCM7XX PWRON STRAPs (2022-04-21 11:37:05 +0100) |
12 | 21 | ||
13 | ---------------------------------------------------------------- | 22 | ---------------------------------------------------------------- |
14 | target-arm queue: | 23 | target-arm queue: |
15 | * hw/arm/iotkit.c: fix minor memory leak | 24 | * hw/arm/virt: Check for attempt to use TrustZone with KVM or HVF |
16 | * softfloat: fix wrong-exception-flags bug for multiply-add corner case | 25 | * versal: Add the Cortex-R5s in the Real-Time Processing Unit (RPU) subsystem |
17 | * arm: isolate and clean up DTB generation | 26 | * versal: model enough of the Clock/Reset Low-power domain (CRL) to allow control of the Cortex-R5s |
18 | * implement Arm v8.1-Atomics extension | 27 | * xlnx-zynqmp: Connect 4 TTC timers |
19 | * Fix some bugs and missing instructions in the v8.2-FP16 extension | 28 | * exynos4210: Refactor GIC/combiner code to stop using qemu_split_irq |
29 | * realview: replace 'qemu_split_irq' with 'TYPE_SPLIT_IRQ' | ||
30 | * stellaris: replace 'qemu_split_irq' with 'TYPE_SPLIT_IRQ' | ||
31 | * hw/core/irq: remove unused 'qemu_irq_split' function | ||
32 | * npcm7xx: use symbolic constants for PWRON STRAP bit fields | ||
33 | * virt: document impact of gic-version on max CPUs | ||
20 | 34 | ||
21 | ---------------------------------------------------------------- | 35 | ---------------------------------------------------------------- |
22 | Igor Mammedov (4): | 36 | Edgar E. Iglesias (6): |
23 | pc: simplify MachineClass::get_hotplug_handler handling | 37 | timer: cadence_ttc: Break out header file to allow embedding |
24 | platform-bus-device: use device plug callback instead of machine_done notifier | 38 | hw/arm/xlnx-zynqmp: Connect 4 TTC timers |
25 | arm/boot: split load_dtb() from arm_load_kernel() | 39 | hw/arm: versal: Create an APU CPU Cluster |
26 | make sure that we aren't overwriting mc->get_hotplug_handler by accident | 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 | ||
27 | 43 | ||
28 | Peter Maydell (3): | 44 | Hao Wu (2): |
29 | hw/arm/iotkit.c: fix minor memory leak | 45 | hw/misc: Add PWRON STRAP bit fields in GCR module |
30 | softfloat: Handle default NaN mode after pickNaNMulAdd, not before | 46 | hw/arm: Use bit fields for NPCM7XX PWRON STRAPs |
31 | atomic.h: Work around gcc spurious "unused value" warning | ||
32 | 47 | ||
33 | Richard Henderson (14): | 48 | Heinrich Schuchardt (1): |
34 | tcg: Introduce helpers for integer min/max | 49 | hw/arm/virt: impact of gic-version on max CPUs |
35 | target/arm: Use new min/max expanders | ||
36 | target/xtensa: Use new min/max expanders | ||
37 | tcg: Introduce atomic helpers for integer min/max | ||
38 | tcg: Use GEN_ATOMIC_HELPER_FN for opposite endian atomic add | ||
39 | target/riscv: Use new atomic min/max expanders | ||
40 | target/arm: Introduce ARM_FEATURE_V8_ATOMICS and initial decode | ||
41 | target/arm: Fill in disas_ldst_atomic | ||
42 | target/arm: Implement CAS and CASP | ||
43 | target/arm: Enable ARM_FEATURE_V8_ATOMICS for user-only | ||
44 | target/arm: Implement vector shifted SCVF/UCVF for fp16 | ||
45 | target/arm: Implement vector shifted FCVT for fp16 | ||
46 | target/arm: Fix float16 to/from int16 | ||
47 | target/arm: Clear SVE high bits for FMOV | ||
48 | 50 | ||
49 | accel/tcg/atomic_template.h | 112 ++++++---- | 51 | Peter Maydell (19): |
50 | accel/tcg/tcg-runtime.h | 8 + | 52 | hw/arm/virt: Check for attempt to use TrustZone with KVM or HVF |
51 | hw/ppc/e500.h | 5 + | 53 | hw/arm/exynos4210: Use TYPE_OR_IRQ instead of custom OR-gate device |
52 | include/hw/arm/arm.h | 45 +++- | 54 | hw/intc/exynos4210_gic: Remove unused TYPE_EXYNOS4210_IRQ_GATE |
53 | include/hw/arm/sysbus-fdt.h | 37 +--- | 55 | hw/arm/exynos4210: Put a9mpcore device into state struct |
54 | include/hw/arm/virt.h | 1 + | 56 | hw/arm/exynos4210: Drop int_gic_irq[] from Exynos4210Irq struct |
55 | include/hw/i386/pc.h | 8 - | 57 | hw/arm/exynos4210: Coalesce board_irqs and irq_table |
56 | include/hw/platform-bus.h | 4 +- | 58 | hw/arm/exynos4210: Fix code style nit in combiner_grp_to_gic_id[] |
57 | include/qemu/atomic.h | 2 +- | 59 | hw/arm/exynos4210: Move exynos4210_init_board_irqs() into exynos4210.c |
58 | target/arm/cpu.h | 1 + | 60 | hw/arm/exynos4210: Put external GIC into state struct |
59 | target/arm/helper-a64.h | 2 + | 61 | hw/arm/exynos4210: Drop ext_gic_irq[] from Exynos4210Irq struct |
60 | target/arm/helper.h | 4 +- | 62 | hw/arm/exynos4210: Move exynos4210_combiner_get_gpioin() into exynos4210.c |
61 | tcg/tcg-op.h | 50 +++++ | 63 | hw/arm/exynos4210: Delete unused macro definitions |
62 | tcg/tcg.h | 8 + | 64 | hw/arm/exynos4210: Use TYPE_SPLIT_IRQ in exynos4210_init_board_irqs() |
63 | fpu/softfloat.c | 52 +++-- | 65 | hw/arm/exynos4210: Fill in irq_table[] for internal-combiner-only IRQ lines |
64 | hw/arm/boot.c | 72 ++----- | 66 | hw/arm/exynos4210: Connect MCT_G0 and MCT_G1 to both combiners |
65 | hw/arm/iotkit.c | 1 + | 67 | hw/arm/exynos4210: Don't connect multiple lines to external GIC inputs |
66 | hw/arm/sysbus-fdt.c | 64 +----- | 68 | hw/arm/exynos4210: Fold combiner splits into exynos4210_init_board_irqs() |
67 | hw/arm/virt.c | 96 ++++++--- | 69 | hw/arm/exynos4210: Put combiners into state struct |
68 | hw/core/platform-bus.c | 29 +-- | 70 | hw/arm/exynos4210: Drop Exynos4210Irq struct |
69 | hw/i386/pc.c | 7 +- | ||
70 | hw/ppc/e500.c | 38 ++-- | ||
71 | hw/ppc/e500plat.c | 32 +++ | ||
72 | hw/ppc/spapr.c | 1 + | ||
73 | hw/s390x/s390-virtio-ccw.c | 1 + | ||
74 | linux-user/elfload.c | 1 + | ||
75 | target/arm/cpu64.c | 1 + | ||
76 | target/arm/helper-a64.c | 43 ++++ | ||
77 | target/arm/helper.c | 53 ++++- | ||
78 | target/arm/translate-a64.c | 490 +++++++++++++++++++++++++++++++++----------- | ||
79 | target/riscv/translate.c | 72 ++----- | ||
80 | target/xtensa/translate.c | 50 +++-- | ||
81 | tcg/tcg-op.c | 48 +++++ | ||
82 | 33 files changed, 934 insertions(+), 504 deletions(-) | ||
83 | 71 | ||
72 | Zongyuan Li (3): | ||
73 | hw/arm/realview: replace 'qemu_split_irq' with 'TYPE_SPLIT_IRQ' | ||
74 | hw/arm/stellaris: replace 'qemu_split_irq' with 'TYPE_SPLIT_IRQ' | ||
75 | hw/core/irq: remove unused 'qemu_irq_split' function | ||
76 | |||
77 | docs/system/arm/virt.rst | 4 +- | ||
78 | include/hw/arm/exynos4210.h | 50 ++-- | ||
79 | include/hw/arm/xlnx-versal.h | 16 ++ | ||
80 | include/hw/arm/xlnx-zynqmp.h | 4 + | ||
81 | include/hw/intc/exynos4210_combiner.h | 57 +++++ | ||
82 | include/hw/intc/exynos4210_gic.h | 43 ++++ | ||
83 | include/hw/irq.h | 5 - | ||
84 | include/hw/misc/npcm7xx_gcr.h | 30 +++ | ||
85 | include/hw/misc/xlnx-versal-crl.h | 235 +++++++++++++++++++ | ||
86 | include/hw/timer/cadence_ttc.h | 54 +++++ | ||
87 | hw/arm/exynos4210.c | 430 ++++++++++++++++++++++++++++++---- | ||
88 | hw/arm/npcm7xx_boards.c | 24 +- | ||
89 | hw/arm/realview.c | 33 ++- | ||
90 | hw/arm/stellaris.c | 15 +- | ||
91 | hw/arm/virt.c | 7 + | ||
92 | hw/arm/xlnx-versal-virt.c | 6 +- | ||
93 | hw/arm/xlnx-versal.c | 99 +++++++- | ||
94 | hw/arm/xlnx-zynqmp.c | 22 ++ | ||
95 | hw/core/irq.c | 15 -- | ||
96 | hw/intc/exynos4210_combiner.c | 108 +-------- | ||
97 | hw/intc/exynos4210_gic.c | 344 +-------------------------- | ||
98 | hw/misc/xlnx-versal-crl.c | 421 +++++++++++++++++++++++++++++++++ | ||
99 | hw/timer/cadence_ttc.c | 32 +-- | ||
100 | MAINTAINERS | 2 +- | ||
101 | hw/misc/meson.build | 1 + | ||
102 | 25 files changed, 1457 insertions(+), 600 deletions(-) | ||
103 | create mode 100644 include/hw/intc/exynos4210_combiner.h | ||
104 | create mode 100644 include/hw/intc/exynos4210_gic.h | ||
105 | create mode 100644 include/hw/misc/xlnx-versal-crl.h | ||
106 | create mode 100644 include/hw/timer/cadence_ttc.h | ||
107 | create mode 100644 hw/misc/xlnx-versal-crl.c | diff view generated by jsdifflib |
1 | From: Igor Mammedov <imammedo@redhat.com> | 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: | ||
2 | 6 | ||
3 | Suggested-by: Eduardo Habkost <ehabkost@redhat.com> | 7 | $ qemu-system-aarch64 -enable-kvm -machine virt,secure=on -cpu host -display none |
4 | Signed-off-by: Igor Mammedov <imammedo@redhat.com> | 8 | Unexpected error in object_property_find_err() at ../../qom/object.c:1304: |
5 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 9 | qemu-system-aarch64: Property 'host-arm-cpu.secure-memory' not found |
6 | Message-id: 1525691524-32265-5-git-send-email-imammedo@redhat.com | 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 | ||
7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 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 | ||
8 | --- | 22 | --- |
9 | hw/arm/virt.c | 1 + | 23 | hw/arm/virt.c | 7 +++++++ |
10 | hw/i386/pc.c | 1 + | 24 | 1 file changed, 7 insertions(+) |
11 | hw/ppc/e500plat.c | 1 + | ||
12 | hw/ppc/spapr.c | 1 + | ||
13 | hw/s390x/s390-virtio-ccw.c | 1 + | ||
14 | 5 files changed, 5 insertions(+) | ||
15 | 25 | ||
16 | diff --git a/hw/arm/virt.c b/hw/arm/virt.c | 26 | diff --git a/hw/arm/virt.c b/hw/arm/virt.c |
17 | index XXXXXXX..XXXXXXX 100644 | 27 | index XXXXXXX..XXXXXXX 100644 |
18 | --- a/hw/arm/virt.c | 28 | --- a/hw/arm/virt.c |
19 | +++ b/hw/arm/virt.c | 29 | +++ b/hw/arm/virt.c |
20 | @@ -XXX,XX +XXX,XX @@ static void virt_machine_class_init(ObjectClass *oc, void *data) | 30 | @@ -XXX,XX +XXX,XX @@ static void machvirt_init(MachineState *machine) |
21 | mc->cpu_index_to_instance_props = virt_cpu_index_to_props; | 31 | exit(1); |
22 | mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-a15"); | 32 | } |
23 | mc->get_default_cpu_node_id = virt_get_default_cpu_node_id; | 33 | |
24 | + assert(!mc->get_hotplug_handler); | 34 | + if (vms->secure && (kvm_enabled() || hvf_enabled())) { |
25 | mc->get_hotplug_handler = virt_machine_get_hotplug_handler; | 35 | + error_report("mach-virt: %s does not support providing " |
26 | hc->plug = virt_machine_device_plug_cb; | 36 | + "Security extensions (TrustZone) to the guest CPU", |
27 | } | 37 | + kvm_enabled() ? "KVM" : "HVF"); |
28 | diff --git a/hw/i386/pc.c b/hw/i386/pc.c | 38 | + exit(1); |
29 | index XXXXXXX..XXXXXXX 100644 | 39 | + } |
30 | --- a/hw/i386/pc.c | 40 | + |
31 | +++ b/hw/i386/pc.c | 41 | if (vms->virt && (kvm_enabled() || hvf_enabled())) { |
32 | @@ -XXX,XX +XXX,XX @@ static void pc_machine_class_init(ObjectClass *oc, void *data) | 42 | error_report("mach-virt: %s does not support providing " |
33 | pcmc->acpi_data_size = 0x20000 + 0x8000; | 43 | "Virtualization extensions to the guest CPU", |
34 | pcmc->save_tsc_khz = true; | ||
35 | pcmc->linuxboot_dma_enabled = true; | ||
36 | + assert(!mc->get_hotplug_handler); | ||
37 | mc->get_hotplug_handler = pc_get_hotpug_handler; | ||
38 | mc->cpu_index_to_instance_props = pc_cpu_index_to_props; | ||
39 | mc->get_default_cpu_node_id = pc_get_default_cpu_node_id; | ||
40 | diff --git a/hw/ppc/e500plat.c b/hw/ppc/e500plat.c | ||
41 | index XXXXXXX..XXXXXXX 100644 | ||
42 | --- a/hw/ppc/e500plat.c | ||
43 | +++ b/hw/ppc/e500plat.c | ||
44 | @@ -XXX,XX +XXX,XX @@ static void e500plat_machine_class_init(ObjectClass *oc, void *data) | ||
45 | HotplugHandlerClass *hc = HOTPLUG_HANDLER_CLASS(oc); | ||
46 | MachineClass *mc = MACHINE_CLASS(oc); | ||
47 | |||
48 | + assert(!mc->get_hotplug_handler); | ||
49 | mc->get_hotplug_handler = e500plat_machine_get_hotpug_handler; | ||
50 | hc->plug = e500plat_machine_device_plug_cb; | ||
51 | |||
52 | diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c | ||
53 | index XXXXXXX..XXXXXXX 100644 | ||
54 | --- a/hw/ppc/spapr.c | ||
55 | +++ b/hw/ppc/spapr.c | ||
56 | @@ -XXX,XX +XXX,XX @@ static void spapr_machine_class_init(ObjectClass *oc, void *data) | ||
57 | mc->kvm_type = spapr_kvm_type; | ||
58 | machine_class_allow_dynamic_sysbus_dev(mc, TYPE_SPAPR_PCI_HOST_BRIDGE); | ||
59 | mc->pci_allow_0_address = true; | ||
60 | + assert(!mc->get_hotplug_handler); | ||
61 | mc->get_hotplug_handler = spapr_get_hotplug_handler; | ||
62 | hc->pre_plug = spapr_machine_device_pre_plug; | ||
63 | hc->plug = spapr_machine_device_plug; | ||
64 | diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c | ||
65 | index XXXXXXX..XXXXXXX 100644 | ||
66 | --- a/hw/s390x/s390-virtio-ccw.c | ||
67 | +++ b/hw/s390x/s390-virtio-ccw.c | ||
68 | @@ -XXX,XX +XXX,XX @@ static void ccw_machine_class_init(ObjectClass *oc, void *data) | ||
69 | mc->no_sdcard = 1; | ||
70 | mc->max_cpus = S390_MAX_CPUS; | ||
71 | mc->has_hotpluggable_cpus = true; | ||
72 | + assert(!mc->get_hotplug_handler); | ||
73 | mc->get_hotplug_handler = s390_get_hotplug_handler; | ||
74 | mc->cpu_index_to_instance_props = s390_cpu_index_to_props; | ||
75 | mc->possible_cpu_arch_ids = s390_possible_cpu_arch_ids; | ||
76 | -- | 44 | -- |
77 | 2.17.0 | 45 | 2.25.1 |
78 | |||
79 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: "Edgar E. Iglesias" <edgar.iglesias@amd.com> | ||
1 | 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 | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
11 | --- | ||
12 | include/hw/timer/cadence_ttc.h | 54 ++++++++++++++++++++++++++++++++++ | ||
13 | hw/timer/cadence_ttc.c | 32 ++------------------ | ||
14 | 2 files changed, 56 insertions(+), 30 deletions(-) | ||
15 | create mode 100644 include/hw/timer/cadence_ttc.h | ||
16 | |||
17 | diff --git a/include/hw/timer/cadence_ttc.h b/include/hw/timer/cadence_ttc.h | ||
18 | new file mode 100644 | ||
19 | index XXXXXXX..XXXXXXX | ||
20 | --- /dev/null | ||
21 | +++ b/include/hw/timer/cadence_ttc.h | ||
22 | @@ -XXX,XX +XXX,XX @@ | ||
23 | +/* | ||
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 | ||
42 | + | ||
43 | +#include "hw/sysbus.h" | ||
44 | +#include "qemu/timer.h" | ||
45 | + | ||
46 | +typedef struct { | ||
47 | + QEMUTimer *timer; | ||
48 | + int freq; | ||
49 | + | ||
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; | ||
59 | + | ||
60 | + uint64_t cpu_time; | ||
61 | + unsigned int cpu_time_valid; | ||
62 | + | ||
63 | + qemu_irq irq; | ||
64 | +} CadenceTimerState; | ||
65 | + | ||
66 | +#define TYPE_CADENCE_TTC "cadence_ttc" | ||
67 | +OBJECT_DECLARE_SIMPLE_TYPE(CadenceTTCState, CADENCE_TTC) | ||
68 | + | ||
69 | +struct CadenceTTCState { | ||
70 | + SysBusDevice parent_obj; | ||
71 | + | ||
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 | ||
78 | index XXXXXXX..XXXXXXX 100644 | ||
79 | --- a/hw/timer/cadence_ttc.c | ||
80 | +++ b/hw/timer/cadence_ttc.c | ||
81 | @@ -XXX,XX +XXX,XX @@ | ||
82 | #include "qemu/timer.h" | ||
83 | #include "qom/object.h" | ||
84 | |||
85 | +#include "hw/timer/cadence_ttc.h" | ||
86 | + | ||
87 | #ifdef CADENCE_TTC_ERR_DEBUG | ||
88 | #define DB_PRINT(...) do { \ | ||
89 | fprintf(stderr, ": %s: ", __func__); \ | ||
90 | @@ -XXX,XX +XXX,XX @@ | ||
91 | #define CLOCK_CTRL_PS_EN 0x00000001 | ||
92 | #define CLOCK_CTRL_PS_V 0x0000001e | ||
93 | |||
94 | -typedef struct { | ||
95 | - QEMUTimer *timer; | ||
96 | - int freq; | ||
97 | - | ||
98 | - uint32_t reg_clock; | ||
99 | - uint32_t reg_count; | ||
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)); | ||
127 | -- | ||
128 | 2.25.1 | 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 generic expanders replace nearly identical code in the translator. | 3 | Connect the 4 TTC timers on the ZynqMP. |
4 | 4 | ||
5 | Acked-by: Max Filippov <jcmvbkbc@gmail.com> | 5 | Signed-off-by: Edgar E. Iglesias <edgar.iglesias@amd.com> |
6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 6 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> |
7 | Message-id: 20180508151437.4232-4-richard.henderson@linaro.org | 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 | ||
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
9 | --- | 11 | --- |
10 | target/xtensa/translate.c | 50 ++++++++++++++++++++++++++------------- | 12 | include/hw/arm/xlnx-zynqmp.h | 4 ++++ |
11 | 1 file changed, 33 insertions(+), 17 deletions(-) | 13 | hw/arm/xlnx-zynqmp.c | 22 ++++++++++++++++++++++ |
14 | 2 files changed, 26 insertions(+) | ||
12 | 15 | ||
13 | diff --git a/target/xtensa/translate.c b/target/xtensa/translate.c | 16 | diff --git a/include/hw/arm/xlnx-zynqmp.h b/include/hw/arm/xlnx-zynqmp.h |
14 | index XXXXXXX..XXXXXXX 100644 | 17 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/target/xtensa/translate.c | 18 | --- a/include/hw/arm/xlnx-zynqmp.h |
16 | +++ b/target/xtensa/translate.c | 19 | +++ b/include/hw/arm/xlnx-zynqmp.h |
17 | @@ -XXX,XX +XXX,XX @@ static void translate_clamps(DisasContext *dc, const uint32_t arg[], | 20 | @@ -XXX,XX +XXX,XX @@ |
18 | TCGv_i32 tmp1 = tcg_const_i32(-1u << arg[2]); | 21 | #include "hw/or-irq.h" |
19 | TCGv_i32 tmp2 = tcg_const_i32((1 << arg[2]) - 1); | 22 | #include "hw/misc/xlnx-zynqmp-apu-ctrl.h" |
20 | 23 | #include "hw/misc/xlnx-zynqmp-crf.h" | |
21 | - tcg_gen_movcond_i32(TCG_COND_GT, tmp1, | 24 | +#include "hw/timer/cadence_ttc.h" |
22 | - cpu_R[arg[1]], tmp1, cpu_R[arg[1]], tmp1); | 25 | |
23 | - tcg_gen_movcond_i32(TCG_COND_LT, cpu_R[arg[0]], | 26 | #define TYPE_XLNX_ZYNQMP "xlnx-zynqmp" |
24 | - tmp1, tmp2, tmp1, tmp2); | 27 | OBJECT_DECLARE_SIMPLE_TYPE(XlnxZynqMPState, XLNX_ZYNQMP) |
25 | + tcg_gen_smax_i32(tmp1, tmp1, cpu_R[arg[1]]); | 28 | @@ -XXX,XX +XXX,XX @@ OBJECT_DECLARE_SIMPLE_TYPE(XlnxZynqMPState, XLNX_ZYNQMP) |
26 | + tcg_gen_smin_i32(cpu_R[arg[0]], tmp1, tmp2); | 29 | #define XLNX_ZYNQMP_MAX_RAM_SIZE (XLNX_ZYNQMP_MAX_LOW_RAM_SIZE + \ |
27 | tcg_temp_free(tmp1); | 30 | XLNX_ZYNQMP_MAX_HIGH_RAM_SIZE) |
28 | tcg_temp_free(tmp2); | 31 | |
29 | } | 32 | +#define XLNX_ZYNQMP_NUM_TTC 4 |
30 | @@ -XXX,XX +XXX,XX @@ static void translate_memw(DisasContext *dc, const uint32_t arg[], | 33 | + |
31 | tcg_gen_mb(TCG_BAR_SC | TCG_MO_ALL); | 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]); | ||
32 | } | 61 | } |
33 | 62 | ||
34 | -static void translate_minmax(DisasContext *dc, const uint32_t arg[], | 63 | +static void xlnx_zynqmp_create_ttc(XlnxZynqMPState *s, qemu_irq *gic) |
35 | - const uint32_t par[]) | 64 | +{ |
36 | +static void translate_smin(DisasContext *dc, const uint32_t arg[], | 65 | + SysBusDevice *sbd; |
37 | + const uint32_t par[]) | 66 | + int i, irq; |
38 | { | 67 | + |
39 | if (gen_window_check3(dc, arg[0], arg[1], arg[2])) { | 68 | + for (i = 0; i < XLNX_ZYNQMP_NUM_TTC; i++) { |
40 | - tcg_gen_movcond_i32(par[0], cpu_R[arg[0]], | 69 | + object_initialize_child(OBJECT(s), "ttc[*]", &s->ttc[i], |
41 | - cpu_R[arg[1]], cpu_R[arg[2]], | 70 | + TYPE_CADENCE_TTC); |
42 | - cpu_R[arg[1]], cpu_R[arg[2]]); | 71 | + sbd = SYS_BUS_DEVICE(&s->ttc[i]); |
43 | + tcg_gen_smin_i32(cpu_R[arg[0]], cpu_R[arg[1]], cpu_R[arg[2]]); | 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 | + } | ||
44 | + } | 78 | + } |
45 | +} | 79 | +} |
46 | + | 80 | + |
47 | +static void translate_umin(DisasContext *dc, const uint32_t arg[], | 81 | static void xlnx_zynqmp_create_unimp_mmio(XlnxZynqMPState *s) |
48 | + const uint32_t par[]) | 82 | { |
49 | +{ | 83 | static const struct UnimpInfo { |
50 | + if (gen_window_check3(dc, arg[0], arg[1], arg[2])) { | 84 | @@ -XXX,XX +XXX,XX @@ static void xlnx_zynqmp_realize(DeviceState *dev, Error **errp) |
51 | + tcg_gen_umin_i32(cpu_R[arg[0]], cpu_R[arg[1]], cpu_R[arg[2]]); | 85 | xlnx_zynqmp_create_efuse(s, gic_spi); |
52 | + } | 86 | xlnx_zynqmp_create_apu_ctrl(s, gic_spi); |
53 | +} | 87 | xlnx_zynqmp_create_crf(s, gic_spi); |
54 | + | 88 | + xlnx_zynqmp_create_ttc(s, gic_spi); |
55 | +static void translate_smax(DisasContext *dc, const uint32_t arg[], | 89 | xlnx_zynqmp_create_unimp_mmio(s); |
56 | + const uint32_t par[]) | 90 | |
57 | +{ | 91 | for (i = 0; i < XLNX_ZYNQMP_NUM_GDMA_CH; i++) { |
58 | + if (gen_window_check3(dc, arg[0], arg[1], arg[2])) { | ||
59 | + tcg_gen_smax_i32(cpu_R[arg[0]], cpu_R[arg[1]], cpu_R[arg[2]]); | ||
60 | + } | ||
61 | +} | ||
62 | + | ||
63 | +static void translate_umax(DisasContext *dc, const uint32_t arg[], | ||
64 | + const uint32_t par[]) | ||
65 | +{ | ||
66 | + if (gen_window_check3(dc, arg[0], arg[1], arg[2])) { | ||
67 | + tcg_gen_umax_i32(cpu_R[arg[0]], cpu_R[arg[1]], cpu_R[arg[2]]); | ||
68 | } | ||
69 | } | ||
70 | |||
71 | @@ -XXX,XX +XXX,XX @@ static const XtensaOpcodeOps core_ops[] = { | ||
72 | .par = (const uint32_t[]){TCG_COND_NE}, | ||
73 | }, { | ||
74 | .name = "max", | ||
75 | - .translate = translate_minmax, | ||
76 | - .par = (const uint32_t[]){TCG_COND_GE}, | ||
77 | + .translate = translate_smax, | ||
78 | }, { | ||
79 | .name = "maxu", | ||
80 | - .translate = translate_minmax, | ||
81 | - .par = (const uint32_t[]){TCG_COND_GEU}, | ||
82 | + .translate = translate_umax, | ||
83 | }, { | ||
84 | .name = "memw", | ||
85 | .translate = translate_memw, | ||
86 | }, { | ||
87 | .name = "min", | ||
88 | - .translate = translate_minmax, | ||
89 | - .par = (const uint32_t[]){TCG_COND_LT}, | ||
90 | + .translate = translate_smin, | ||
91 | }, { | ||
92 | .name = "minu", | ||
93 | - .translate = translate_minmax, | ||
94 | - .par = (const uint32_t[]){TCG_COND_LTU}, | ||
95 | + .translate = translate_umin, | ||
96 | }, { | ||
97 | .name = "mov", | ||
98 | .translate = translate_mov, | ||
99 | -- | 92 | -- |
100 | 2.17.0 | 93 | 2.25.1 |
101 | |||
102 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: "Edgar E. Iglesias" <edgar.iglesias@amd.com> | ||
1 | 2 | ||
3 | Create an APU CPU Cluster. This is in preparation to add the RPU. | ||
4 | |||
5 | Signed-off-by: Edgar E. Iglesias <edgar.iglesias@amd.com> | ||
6 | Reviewed-by: Francisco Iglesias <francisco.iglesias@amd.com> | ||
7 | Message-id: 20220406174303.2022038-2-edgar.iglesias@xilinx.com | ||
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
9 | --- | ||
10 | include/hw/arm/xlnx-versal.h | 2 ++ | ||
11 | hw/arm/xlnx-versal.c | 9 ++++++++- | ||
12 | 2 files changed, 10 insertions(+), 1 deletion(-) | ||
13 | |||
14 | diff --git a/include/hw/arm/xlnx-versal.h b/include/hw/arm/xlnx-versal.h | ||
15 | index XXXXXXX..XXXXXXX 100644 | ||
16 | --- a/include/hw/arm/xlnx-versal.h | ||
17 | +++ b/include/hw/arm/xlnx-versal.h | ||
18 | @@ -XXX,XX +XXX,XX @@ | ||
19 | |||
20 | #include "hw/sysbus.h" | ||
21 | #include "hw/arm/boot.h" | ||
22 | +#include "hw/cpu/cluster.h" | ||
23 | #include "hw/or-irq.h" | ||
24 | #include "hw/sd/sdhci.h" | ||
25 | #include "hw/intc/arm_gicv3.h" | ||
26 | @@ -XXX,XX +XXX,XX @@ struct Versal { | ||
27 | struct { | ||
28 | struct { | ||
29 | MemoryRegion mr; | ||
30 | + CPUClusterState cluster; | ||
31 | ARMCPU cpu[XLNX_VERSAL_NR_ACPUS]; | ||
32 | GICv3State gic; | ||
33 | } apu; | ||
34 | diff --git a/hw/arm/xlnx-versal.c b/hw/arm/xlnx-versal.c | ||
35 | index XXXXXXX..XXXXXXX 100644 | ||
36 | --- a/hw/arm/xlnx-versal.c | ||
37 | +++ b/hw/arm/xlnx-versal.c | ||
38 | @@ -XXX,XX +XXX,XX @@ static void versal_create_apu_cpus(Versal *s) | ||
39 | { | ||
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); | ||
58 | } | ||
59 | + | ||
60 | + qdev_realize(DEVICE(&s->fpd.apu.cluster), NULL, &error_fatal); | ||
61 | } | ||
62 | |||
63 | static void versal_create_apu_gic(Versal *s, qemu_irq *pic) | ||
64 | -- | ||
65 | 2.25.1 | 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 insns in the ARMv8.1-Atomics are added to the existing | 3 | Add the Cortex-R5Fs of the Versal RPU (Real-time Processing Unit) |
4 | load/store exclusive and load/store reg opcode spaces. | 4 | subsystem. |
5 | Rearrange the top-level decoders for these to accomodate. | ||
6 | The Atomics insns themselves still generate Unallocated. | ||
7 | 5 | ||
8 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 6 | Signed-off-by: Edgar E. Iglesias <edgar.iglesias@amd.com> |
9 | Message-id: 20180508151437.4232-8-richard.henderson@linaro.org | 7 | Reviewed-by: Francisco Iglesias <francisco.iglesias@amd.com> |
10 | [PMM: Drop the ARM_FEATURE_V8_1 feature flag] | 8 | Message-id: 20220406174303.2022038-3-edgar.iglesias@xilinx.com |
11 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
13 | --- | 10 | --- |
14 | target/arm/cpu.h | 1 + | 11 | include/hw/arm/xlnx-versal.h | 10 ++++++++++ |
15 | linux-user/elfload.c | 1 + | 12 | hw/arm/xlnx-versal-virt.c | 6 +++--- |
16 | target/arm/translate-a64.c | 182 +++++++++++++++++++++++++++---------- | 13 | hw/arm/xlnx-versal.c | 36 ++++++++++++++++++++++++++++++++++++ |
17 | 3 files changed, 138 insertions(+), 46 deletions(-) | 14 | 3 files changed, 49 insertions(+), 3 deletions(-) |
18 | 15 | ||
19 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h | 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/target/arm/cpu.h | 18 | --- a/include/hw/arm/xlnx-versal.h |
22 | +++ b/target/arm/cpu.h | 19 | +++ b/include/hw/arm/xlnx-versal.h |
23 | @@ -XXX,XX +XXX,XX @@ enum arm_features { | 20 | @@ -XXX,XX +XXX,XX @@ |
24 | ARM_FEATURE_V8_SHA3, /* implements SHA3 part of v8 Crypto Extensions */ | 21 | OBJECT_DECLARE_SIMPLE_TYPE(Versal, XLNX_VERSAL) |
25 | ARM_FEATURE_V8_SM3, /* implements SM3 part of v8 Crypto Extensions */ | 22 | |
26 | ARM_FEATURE_V8_SM4, /* implements SM4 part of v8 Crypto Extensions */ | 23 | #define XLNX_VERSAL_NR_ACPUS 2 |
27 | + ARM_FEATURE_V8_ATOMICS, /* ARMv8.1-Atomics feature */ | 24 | +#define XLNX_VERSAL_NR_RCPUS 2 |
28 | ARM_FEATURE_V8_RDM, /* implements v8.1 simd round multiply */ | 25 | #define XLNX_VERSAL_NR_UARTS 2 |
29 | ARM_FEATURE_V8_FP16, /* implements v8.2 half-precision float */ | 26 | #define XLNX_VERSAL_NR_GEMS 2 |
30 | ARM_FEATURE_V8_FCMA, /* has complex number part of v8.3 extensions. */ | 27 | #define XLNX_VERSAL_NR_ADMAS 8 |
31 | diff --git a/linux-user/elfload.c b/linux-user/elfload.c | 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 | ||
32 | index XXXXXXX..XXXXXXX 100644 | 45 | index XXXXXXX..XXXXXXX 100644 |
33 | --- a/linux-user/elfload.c | 46 | --- a/hw/arm/xlnx-versal-virt.c |
34 | +++ b/linux-user/elfload.c | 47 | +++ b/hw/arm/xlnx-versal-virt.c |
35 | @@ -XXX,XX +XXX,XX @@ static uint32_t get_elf_hwcap(void) | 48 | @@ -XXX,XX +XXX,XX @@ static void versal_virt_machine_class_init(ObjectClass *oc, void *data) |
36 | GET_FEATURE(ARM_FEATURE_V8_SHA512, ARM_HWCAP_A64_SHA512); | 49 | |
37 | GET_FEATURE(ARM_FEATURE_V8_FP16, | 50 | mc->desc = "Xilinx Versal Virtual development board"; |
38 | ARM_HWCAP_A64_FPHP | ARM_HWCAP_A64_ASIMDHP); | 51 | mc->init = versal_virt_init; |
39 | + GET_FEATURE(ARM_FEATURE_V8_ATOMICS, ARM_HWCAP_A64_ATOMICS); | 52 | - mc->min_cpus = XLNX_VERSAL_NR_ACPUS; |
40 | GET_FEATURE(ARM_FEATURE_V8_RDM, ARM_HWCAP_A64_ASIMDRDM); | 53 | - mc->max_cpus = XLNX_VERSAL_NR_ACPUS; |
41 | GET_FEATURE(ARM_FEATURE_V8_FCMA, ARM_HWCAP_A64_FCMA); | 54 | - mc->default_cpus = XLNX_VERSAL_NR_ACPUS; |
42 | #undef GET_FEATURE | 55 | + mc->min_cpus = XLNX_VERSAL_NR_ACPUS + XLNX_VERSAL_NR_RCPUS; |
43 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c | 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 | ||
44 | index XXXXXXX..XXXXXXX 100644 | 62 | index XXXXXXX..XXXXXXX 100644 |
45 | --- a/target/arm/translate-a64.c | 63 | --- a/hw/arm/xlnx-versal.c |
46 | +++ b/target/arm/translate-a64.c | 64 | +++ b/hw/arm/xlnx-versal.c |
47 | @@ -XXX,XX +XXX,XX @@ static void disas_ldst_excl(DisasContext *s, uint32_t insn) | 65 | @@ -XXX,XX +XXX,XX @@ |
48 | int rt = extract32(insn, 0, 5); | 66 | #include "hw/sysbus.h" |
49 | int rn = extract32(insn, 5, 5); | 67 | |
50 | int rt2 = extract32(insn, 10, 5); | 68 | #define XLNX_VERSAL_ACPU_TYPE ARM_CPU_TYPE_NAME("cortex-a72") |
51 | - int is_lasr = extract32(insn, 15, 1); | 69 | +#define XLNX_VERSAL_RCPU_TYPE ARM_CPU_TYPE_NAME("cortex-r5f") |
52 | int rs = extract32(insn, 16, 5); | 70 | #define GEM_REVISION 0x40070106 |
53 | - int is_pair = extract32(insn, 21, 1); | 71 | |
54 | - int is_store = !extract32(insn, 22, 1); | 72 | #define VERSAL_NUM_PMC_APB_IRQS 3 |
55 | - int is_excl = !extract32(insn, 23, 1); | 73 | @@ -XXX,XX +XXX,XX @@ static void versal_create_apu_gic(Versal *s, qemu_irq *pic) |
56 | + int is_lasr = extract32(insn, 15, 1); | ||
57 | + int o2_L_o1_o0 = extract32(insn, 21, 3) * 2 | is_lasr; | ||
58 | int size = extract32(insn, 30, 2); | ||
59 | TCGv_i64 tcg_addr; | ||
60 | |||
61 | - if ((!is_excl && !is_pair && !is_lasr) || | ||
62 | - (!is_excl && is_pair) || | ||
63 | - (is_pair && size < 2)) { | ||
64 | - unallocated_encoding(s); | ||
65 | + switch (o2_L_o1_o0) { | ||
66 | + case 0x0: /* STXR */ | ||
67 | + case 0x1: /* STLXR */ | ||
68 | + if (rn == 31) { | ||
69 | + gen_check_sp_alignment(s); | ||
70 | + } | ||
71 | + if (is_lasr) { | ||
72 | + tcg_gen_mb(TCG_MO_ALL | TCG_BAR_STRL); | ||
73 | + } | ||
74 | + tcg_addr = read_cpu_reg_sp(s, rn, 1); | ||
75 | + gen_store_exclusive(s, rs, rt, rt2, tcg_addr, size, false); | ||
76 | return; | ||
77 | - } | ||
78 | |||
79 | - if (rn == 31) { | ||
80 | - gen_check_sp_alignment(s); | ||
81 | - } | ||
82 | - tcg_addr = read_cpu_reg_sp(s, rn, 1); | ||
83 | - | ||
84 | - /* Note that since TCG is single threaded load-acquire/store-release | ||
85 | - * semantics require no extra if (is_lasr) { ... } handling. | ||
86 | - */ | ||
87 | - | ||
88 | - if (is_excl) { | ||
89 | - if (!is_store) { | ||
90 | - s->is_ldex = true; | ||
91 | - gen_load_exclusive(s, rt, rt2, tcg_addr, size, is_pair); | ||
92 | - if (is_lasr) { | ||
93 | - tcg_gen_mb(TCG_MO_ALL | TCG_BAR_LDAQ); | ||
94 | - } | ||
95 | - } else { | ||
96 | - if (is_lasr) { | ||
97 | - tcg_gen_mb(TCG_MO_ALL | TCG_BAR_STRL); | ||
98 | - } | ||
99 | - gen_store_exclusive(s, rs, rt, rt2, tcg_addr, size, is_pair); | ||
100 | + case 0x4: /* LDXR */ | ||
101 | + case 0x5: /* LDAXR */ | ||
102 | + if (rn == 31) { | ||
103 | + gen_check_sp_alignment(s); | ||
104 | } | ||
105 | - } else { | ||
106 | - TCGv_i64 tcg_rt = cpu_reg(s, rt); | ||
107 | - bool iss_sf = disas_ldst_compute_iss_sf(size, false, 0); | ||
108 | + tcg_addr = read_cpu_reg_sp(s, rn, 1); | ||
109 | + s->is_ldex = true; | ||
110 | + gen_load_exclusive(s, rt, rt2, tcg_addr, size, false); | ||
111 | + if (is_lasr) { | ||
112 | + tcg_gen_mb(TCG_MO_ALL | TCG_BAR_LDAQ); | ||
113 | + } | ||
114 | + return; | ||
115 | |||
116 | + case 0x9: /* STLR */ | ||
117 | /* Generate ISS for non-exclusive accesses including LASR. */ | ||
118 | - if (is_store) { | ||
119 | + if (rn == 31) { | ||
120 | + gen_check_sp_alignment(s); | ||
121 | + } | ||
122 | + tcg_gen_mb(TCG_MO_ALL | TCG_BAR_STRL); | ||
123 | + tcg_addr = read_cpu_reg_sp(s, rn, 1); | ||
124 | + do_gpr_st(s, cpu_reg(s, rt), tcg_addr, size, true, rt, | ||
125 | + disas_ldst_compute_iss_sf(size, false, 0), is_lasr); | ||
126 | + return; | ||
127 | + | ||
128 | + case 0xd: /* LDAR */ | ||
129 | + /* Generate ISS for non-exclusive accesses including LASR. */ | ||
130 | + if (rn == 31) { | ||
131 | + gen_check_sp_alignment(s); | ||
132 | + } | ||
133 | + tcg_addr = read_cpu_reg_sp(s, rn, 1); | ||
134 | + do_gpr_ld(s, cpu_reg(s, rt), tcg_addr, size, false, false, true, rt, | ||
135 | + disas_ldst_compute_iss_sf(size, false, 0), is_lasr); | ||
136 | + tcg_gen_mb(TCG_MO_ALL | TCG_BAR_LDAQ); | ||
137 | + return; | ||
138 | + | ||
139 | + case 0x2: case 0x3: /* CASP / STXP */ | ||
140 | + if (size & 2) { /* STXP / STLXP */ | ||
141 | + if (rn == 31) { | ||
142 | + gen_check_sp_alignment(s); | ||
143 | + } | ||
144 | if (is_lasr) { | ||
145 | tcg_gen_mb(TCG_MO_ALL | TCG_BAR_STRL); | ||
146 | } | ||
147 | - do_gpr_st(s, tcg_rt, tcg_addr, size, | ||
148 | - true, rt, iss_sf, is_lasr); | ||
149 | - } else { | ||
150 | - do_gpr_ld(s, tcg_rt, tcg_addr, size, false, false, | ||
151 | - true, rt, iss_sf, is_lasr); | ||
152 | + tcg_addr = read_cpu_reg_sp(s, rn, 1); | ||
153 | + gen_store_exclusive(s, rs, rt, rt2, tcg_addr, size, true); | ||
154 | + return; | ||
155 | + } | ||
156 | + /* CASP / CASPL */ | ||
157 | + break; | ||
158 | + | ||
159 | + case 0x6: case 0x7: /* CASP / LDXP */ | ||
160 | + if (size & 2) { /* LDXP / LDAXP */ | ||
161 | + if (rn == 31) { | ||
162 | + gen_check_sp_alignment(s); | ||
163 | + } | ||
164 | + tcg_addr = read_cpu_reg_sp(s, rn, 1); | ||
165 | + s->is_ldex = true; | ||
166 | + gen_load_exclusive(s, rt, rt2, tcg_addr, size, true); | ||
167 | if (is_lasr) { | ||
168 | tcg_gen_mb(TCG_MO_ALL | TCG_BAR_LDAQ); | ||
169 | } | ||
170 | + return; | ||
171 | } | ||
172 | + /* CASPA / CASPAL */ | ||
173 | + break; | ||
174 | + | ||
175 | + case 0xa: /* CAS */ | ||
176 | + case 0xb: /* CASL */ | ||
177 | + case 0xe: /* CASA */ | ||
178 | + case 0xf: /* CASAL */ | ||
179 | + break; | ||
180 | } | ||
181 | + unallocated_encoding(s); | ||
182 | } | ||
183 | |||
184 | /* | ||
185 | @@ -XXX,XX +XXX,XX @@ static void disas_ldst_reg_unsigned_imm(DisasContext *s, uint32_t insn, | ||
186 | } | 74 | } |
187 | } | 75 | } |
188 | 76 | ||
189 | +/* Atomic memory operations | 77 | +static void versal_create_rpu_cpus(Versal *s) |
190 | + * | ||
191 | + * 31 30 27 26 24 22 21 16 15 12 10 5 0 | ||
192 | + * +------+-------+---+-----+-----+---+----+----+-----+-----+----+-----+ | ||
193 | + * | size | 1 1 1 | V | 0 0 | A R | 1 | Rs | o3 | opc | 0 0 | Rn | Rt | | ||
194 | + * +------+-------+---+-----+-----+--------+----+-----+-----+----+-----+ | ||
195 | + * | ||
196 | + * Rt: the result register | ||
197 | + * Rn: base address or SP | ||
198 | + * Rs: the source register for the operation | ||
199 | + * V: vector flag (always 0 as of v8.3) | ||
200 | + * A: acquire flag | ||
201 | + * R: release flag | ||
202 | + */ | ||
203 | +static void disas_ldst_atomic(DisasContext *s, uint32_t insn, | ||
204 | + int size, int rt, bool is_vector) | ||
205 | +{ | 78 | +{ |
206 | + int rs = extract32(insn, 16, 5); | 79 | + int i; |
207 | + int rn = extract32(insn, 5, 5); | ||
208 | + int o3_opc = extract32(insn, 12, 4); | ||
209 | + int feature = ARM_FEATURE_V8_ATOMICS; | ||
210 | + | 80 | + |
211 | + if (is_vector) { | 81 | + object_initialize_child(OBJECT(s), "rpu-cluster", &s->lpd.rpu.cluster, |
212 | + unallocated_encoding(s); | 82 | + TYPE_CPU_CLUSTER); |
213 | + return; | 83 | + qdev_prop_set_uint32(DEVICE(&s->lpd.rpu.cluster), "cluster-id", 1); |
214 | + } | 84 | + |
215 | + switch (o3_opc) { | 85 | + for (i = 0; i < ARRAY_SIZE(s->lpd.rpu.cpu); i++) { |
216 | + case 000: /* LDADD */ | 86 | + Object *obj; |
217 | + case 001: /* LDCLR */ | 87 | + |
218 | + case 002: /* LDEOR */ | 88 | + object_initialize_child(OBJECT(&s->lpd.rpu.cluster), |
219 | + case 003: /* LDSET */ | 89 | + "rpu-cpu[*]", &s->lpd.rpu.cpu[i], |
220 | + case 004: /* LDSMAX */ | 90 | + XLNX_VERSAL_RCPU_TYPE); |
221 | + case 005: /* LDSMIN */ | 91 | + obj = OBJECT(&s->lpd.rpu.cpu[i]); |
222 | + case 006: /* LDUMAX */ | 92 | + object_property_set_bool(obj, "start-powered-off", true, |
223 | + case 007: /* LDUMIN */ | 93 | + &error_abort); |
224 | + case 010: /* SWP */ | 94 | + |
225 | + default: | 95 | + object_property_set_int(obj, "mp-affinity", 0x100 | i, &error_abort); |
226 | + unallocated_encoding(s); | 96 | + object_property_set_int(obj, "core-count", ARRAY_SIZE(s->lpd.rpu.cpu), |
227 | + return; | 97 | + &error_abort); |
228 | + } | 98 | + object_property_set_link(obj, "memory", OBJECT(&s->lpd.rpu.mr), |
229 | + if (!arm_dc_feature(s, feature)) { | 99 | + &error_abort); |
230 | + unallocated_encoding(s); | 100 | + qdev_realize(DEVICE(obj), NULL, &error_fatal); |
231 | + return; | ||
232 | + } | 101 | + } |
233 | + | 102 | + |
234 | + (void)rs; | 103 | + qdev_realize(DEVICE(&s->lpd.rpu.cluster), NULL, &error_fatal); |
235 | + (void)rn; | ||
236 | +} | 104 | +} |
237 | + | 105 | + |
238 | /* Load/store register (all forms) */ | 106 | static void versal_create_uarts(Versal *s, qemu_irq *pic) |
239 | static void disas_ldst_reg(DisasContext *s, uint32_t insn) | ||
240 | { | 107 | { |
241 | @@ -XXX,XX +XXX,XX @@ static void disas_ldst_reg(DisasContext *s, uint32_t insn) | 108 | int i; |
242 | 109 | @@ -XXX,XX +XXX,XX @@ static void versal_realize(DeviceState *dev, Error **errp) | |
243 | switch (extract32(insn, 24, 2)) { | 110 | |
244 | case 0: | 111 | versal_create_apu_cpus(s); |
245 | - if (extract32(insn, 21, 1) == 1 && extract32(insn, 10, 2) == 2) { | 112 | versal_create_apu_gic(s, pic); |
246 | - disas_ldst_reg_roffset(s, insn, opc, size, rt, is_vector); | 113 | + versal_create_rpu_cpus(s); |
247 | - } else { | 114 | versal_create_uarts(s, pic); |
248 | + if (extract32(insn, 21, 1) == 0) { | 115 | versal_create_usbs(s, pic); |
249 | /* Load/store register (unscaled immediate) | 116 | versal_create_gems(s, pic); |
250 | * Load/store immediate pre/post-indexed | 117 | @@ -XXX,XX +XXX,XX @@ static void versal_realize(DeviceState *dev, Error **errp) |
251 | * Load/store register unprivileged | 118 | |
252 | */ | 119 | memory_region_add_subregion_overlap(&s->mr_ps, MM_OCM, &s->lpd.mr_ocm, 0); |
253 | disas_ldst_reg_imm9(s, insn, opc, size, rt, is_vector); | 120 | memory_region_add_subregion_overlap(&s->fpd.apu.mr, 0, &s->mr_ps, 0); |
254 | + return; | 121 | + memory_region_add_subregion_overlap(&s->lpd.rpu.mr, 0, |
255 | + } | 122 | + &s->lpd.rpu.mr_ps_alias, 0); |
256 | + switch (extract32(insn, 10, 2)) { | ||
257 | + case 0: | ||
258 | + disas_ldst_atomic(s, insn, size, rt, is_vector); | ||
259 | + return; | ||
260 | + case 2: | ||
261 | + disas_ldst_reg_roffset(s, insn, opc, size, rt, is_vector); | ||
262 | + return; | ||
263 | } | ||
264 | break; | ||
265 | case 1: | ||
266 | disas_ldst_reg_unsigned_imm(s, insn, opc, size, rt, is_vector); | ||
267 | - break; | ||
268 | - default: | ||
269 | - unallocated_encoding(s); | ||
270 | - break; | ||
271 | + return; | ||
272 | } | ||
273 | + unallocated_encoding(s); | ||
274 | } | 123 | } |
275 | 124 | ||
276 | /* AdvSIMD load/store multiple structures | 125 | static void versal_init(Object *obj) |
126 | @@ -XXX,XX +XXX,XX @@ static void versal_init(Object *obj) | ||
127 | Versal *s = XLNX_VERSAL(obj); | ||
128 | |||
129 | memory_region_init(&s->fpd.apu.mr, obj, "mr-apu", UINT64_MAX); | ||
130 | + memory_region_init(&s->lpd.rpu.mr, obj, "mr-rpu", UINT64_MAX); | ||
131 | memory_region_init(&s->mr_ps, obj, "mr-ps-switch", UINT64_MAX); | ||
132 | + memory_region_init_alias(&s->lpd.rpu.mr_ps_alias, OBJECT(s), | ||
133 | + "mr-rpu-ps-alias", &s->mr_ps, 0, UINT64_MAX); | ||
134 | } | ||
135 | |||
136 | static Property versal_properties[] = { | ||
277 | -- | 137 | -- |
278 | 2.17.0 | 138 | 2.25.1 |
279 | |||
280 | 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 | Use write_fp_dreg and clear_vec_high to zero the bits | 3 | Add a model of the Xilinx Versal CRL. |
4 | that need zeroing for these cases. | ||
5 | 4 | ||
6 | Cc: qemu-stable@nongnu.org | 5 | Signed-off-by: Edgar E. Iglesias <edgar.iglesias@amd.com> |
7 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | 6 | Reviewed-by: Frederic Konrad <fkonrad@amd.com> |
8 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 7 | Reviewed-by: Francisco Iglesias <francisco.iglesias@amd.com> |
9 | Message-id: 20180502221552.3873-5-richard.henderson@linaro.org | 8 | Message-id: 20220406174303.2022038-4-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 | 17 +++++------------ | 11 | include/hw/misc/xlnx-versal-crl.h | 235 +++++++++++++++++ |
13 | 1 file changed, 5 insertions(+), 12 deletions(-) | 12 | hw/misc/xlnx-versal-crl.c | 421 ++++++++++++++++++++++++++++++ |
13 | hw/misc/meson.build | 1 + | ||
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 | ||
14 | 17 | ||
15 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c | 18 | diff --git a/include/hw/misc/xlnx-versal-crl.h b/include/hw/misc/xlnx-versal-crl.h |
19 | new file mode 100644 | ||
20 | index XXXXXXX..XXXXXXX | ||
21 | --- /dev/null | ||
22 | +++ b/include/hw/misc/xlnx-versal-crl.h | ||
23 | @@ -XXX,XX +XXX,XX @@ | ||
24 | +/* | ||
25 | + * QEMU model of the Clock-Reset-LPD (CRL). | ||
26 | + * | ||
27 | + * Copyright (c) 2022 Xilinx Inc. | ||
28 | + * SPDX-License-Identifier: GPL-2.0-or-later | ||
29 | + * | ||
30 | + * Written by Edgar E. Iglesias <edgar.iglesias@xilinx.com> | ||
31 | + */ | ||
32 | +#ifndef HW_MISC_XLNX_VERSAL_CRL_H | ||
33 | +#define HW_MISC_XLNX_VERSAL_CRL_H | ||
34 | + | ||
35 | +#include "hw/sysbus.h" | ||
36 | +#include "hw/register.h" | ||
37 | +#include "target/arm/cpu.h" | ||
38 | + | ||
39 | +#define TYPE_XLNX_VERSAL_CRL "xlnx,versal-crl" | ||
40 | +OBJECT_DECLARE_SIMPLE_TYPE(XlnxVersalCRL, XLNX_VERSAL_CRL) | ||
41 | + | ||
42 | +REG32(ERR_CTRL, 0x0) | ||
43 | + FIELD(ERR_CTRL, SLVERR_ENABLE, 0, 1) | ||
44 | +REG32(IR_STATUS, 0x4) | ||
45 | + FIELD(IR_STATUS, ADDR_DECODE_ERR, 0, 1) | ||
46 | +REG32(IR_MASK, 0x8) | ||
47 | + FIELD(IR_MASK, ADDR_DECODE_ERR, 0, 1) | ||
48 | +REG32(IR_ENABLE, 0xc) | ||
49 | + FIELD(IR_ENABLE, ADDR_DECODE_ERR, 0, 1) | ||
50 | +REG32(IR_DISABLE, 0x10) | ||
51 | + FIELD(IR_DISABLE, ADDR_DECODE_ERR, 0, 1) | ||
52 | +REG32(WPROT, 0x1c) | ||
53 | + FIELD(WPROT, ACTIVE, 0, 1) | ||
54 | +REG32(PLL_CLK_OTHER_DMN, 0x20) | ||
55 | + FIELD(PLL_CLK_OTHER_DMN, APLL_BYPASS, 0, 1) | ||
56 | +REG32(RPLL_CTRL, 0x40) | ||
57 | + FIELD(RPLL_CTRL, POST_SRC, 24, 3) | ||
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 | ||
16 | index XXXXXXX..XXXXXXX 100644 | 687 | index XXXXXXX..XXXXXXX 100644 |
17 | --- a/target/arm/translate-a64.c | 688 | --- a/hw/misc/meson.build |
18 | +++ b/target/arm/translate-a64.c | 689 | +++ b/hw/misc/meson.build |
19 | @@ -XXX,XX +XXX,XX @@ static void handle_fmov(DisasContext *s, int rd, int rn, int type, bool itof) | 690 | @@ -XXX,XX +XXX,XX @@ softmmu_ss.add(when: 'CONFIG_SLAVIO', if_true: files('slavio_misc.c')) |
20 | 691 | softmmu_ss.add(when: 'CONFIG_ZYNQ', if_true: files('zynq_slcr.c')) | |
21 | if (itof) { | 692 | specific_ss.add(when: 'CONFIG_XLNX_ZYNQMP_ARM', if_true: files('xlnx-zynqmp-crf.c')) |
22 | TCGv_i64 tcg_rn = cpu_reg(s, rn); | 693 | specific_ss.add(when: 'CONFIG_XLNX_ZYNQMP_ARM', if_true: files('xlnx-zynqmp-apu-ctrl.c')) |
23 | + TCGv_i64 tmp; | 694 | +specific_ss.add(when: 'CONFIG_XLNX_VERSAL', if_true: files('xlnx-versal-crl.c')) |
24 | 695 | softmmu_ss.add(when: 'CONFIG_XLNX_VERSAL', if_true: files( | |
25 | switch (type) { | 696 | 'xlnx-versal-xramc.c', |
26 | case 0: | 697 | 'xlnx-versal-pmc-iou-slcr.c', |
27 | - { | ||
28 | /* 32 bit */ | ||
29 | - TCGv_i64 tmp = tcg_temp_new_i64(); | ||
30 | + tmp = tcg_temp_new_i64(); | ||
31 | tcg_gen_ext32u_i64(tmp, tcg_rn); | ||
32 | - tcg_gen_st_i64(tmp, cpu_env, fp_reg_offset(s, rd, MO_64)); | ||
33 | - tcg_gen_movi_i64(tmp, 0); | ||
34 | - tcg_gen_st_i64(tmp, cpu_env, fp_reg_hi_offset(s, rd)); | ||
35 | + write_fp_dreg(s, rd, tmp); | ||
36 | tcg_temp_free_i64(tmp); | ||
37 | break; | ||
38 | - } | ||
39 | case 1: | ||
40 | - { | ||
41 | /* 64 bit */ | ||
42 | - TCGv_i64 tmp = tcg_const_i64(0); | ||
43 | - tcg_gen_st_i64(tcg_rn, cpu_env, fp_reg_offset(s, rd, MO_64)); | ||
44 | - tcg_gen_st_i64(tmp, cpu_env, fp_reg_hi_offset(s, rd)); | ||
45 | - tcg_temp_free_i64(tmp); | ||
46 | + write_fp_dreg(s, rd, tcg_rn); | ||
47 | break; | ||
48 | - } | ||
49 | case 2: | ||
50 | /* 64 bit to top half. */ | ||
51 | tcg_gen_st_i64(tcg_rn, cpu_env, fp_reg_hi_offset(s, rd)); | ||
52 | + clear_vec_high(s, true, rd); | ||
53 | break; | ||
54 | } | ||
55 | } else { | ||
56 | -- | 698 | -- |
57 | 2.17.0 | 699 | 2.25.1 |
58 | |||
59 | 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 | These operations are re-invented by several targets so far. | 3 | Connect the CRL (Clock Reset LPD) to the Versal SoC. |
4 | Several supported hosts have insns for these, so place the | ||
5 | expanders out-of-line for a future introduction of tcg opcodes. | ||
6 | 4 | ||
7 | Reviewed-by: Peter Maydell <peter.maydell@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: 20180508151437.4232-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 | tcg/tcg-op.h | 16 ++++++++++++++++ | 11 | include/hw/arm/xlnx-versal.h | 4 +++ |
13 | tcg/tcg-op.c | 40 ++++++++++++++++++++++++++++++++++++++++ | 12 | hw/arm/xlnx-versal.c | 54 ++++++++++++++++++++++++++++++++++-- |
14 | 2 files changed, 56 insertions(+) | 13 | 2 files changed, 56 insertions(+), 2 deletions(-) |
15 | 14 | ||
16 | diff --git a/tcg/tcg-op.h b/tcg/tcg-op.h | 15 | diff --git a/include/hw/arm/xlnx-versal.h b/include/hw/arm/xlnx-versal.h |
17 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
18 | --- a/tcg/tcg-op.h | 17 | --- a/include/hw/arm/xlnx-versal.h |
19 | +++ b/tcg/tcg-op.h | 18 | +++ b/include/hw/arm/xlnx-versal.h |
20 | @@ -XXX,XX +XXX,XX @@ void tcg_gen_ext8u_i32(TCGv_i32 ret, TCGv_i32 arg); | 19 | @@ -XXX,XX +XXX,XX @@ |
21 | void tcg_gen_ext16u_i32(TCGv_i32 ret, TCGv_i32 arg); | 20 | #include "hw/nvram/xlnx-versal-efuse.h" |
22 | void tcg_gen_bswap16_i32(TCGv_i32 ret, TCGv_i32 arg); | 21 | #include "hw/ssi/xlnx-versal-ospi.h" |
23 | void tcg_gen_bswap32_i32(TCGv_i32 ret, TCGv_i32 arg); | 22 | #include "hw/dma/xlnx_csu_dma.h" |
24 | +void tcg_gen_smin_i32(TCGv_i32, TCGv_i32 arg1, TCGv_i32 arg2); | 23 | +#include "hw/misc/xlnx-versal-crl.h" |
25 | +void tcg_gen_smax_i32(TCGv_i32, TCGv_i32 arg1, TCGv_i32 arg2); | 24 | #include "hw/misc/xlnx-versal-pmc-iou-slcr.h" |
26 | +void tcg_gen_umin_i32(TCGv_i32, TCGv_i32 arg1, TCGv_i32 arg2); | 25 | |
27 | +void tcg_gen_umax_i32(TCGv_i32, TCGv_i32 arg1, TCGv_i32 arg2); | 26 | #define TYPE_XLNX_VERSAL "xlnx-versal" |
28 | 27 | @@ -XXX,XX +XXX,XX @@ struct Versal { | |
29 | static inline void tcg_gen_discard_i32(TCGv_i32 arg) | 28 | qemu_or_irq irq_orgate; |
30 | { | 29 | XlnxXramCtrl ctrl[XLNX_VERSAL_NR_XRAM]; |
31 | @@ -XXX,XX +XXX,XX @@ void tcg_gen_ext32u_i64(TCGv_i64 ret, TCGv_i64 arg); | 30 | } xram; |
32 | void tcg_gen_bswap16_i64(TCGv_i64 ret, TCGv_i64 arg); | 31 | + |
33 | void tcg_gen_bswap32_i64(TCGv_i64 ret, TCGv_i64 arg); | 32 | + XlnxVersalCRL crl; |
34 | void tcg_gen_bswap64_i64(TCGv_i64 ret, TCGv_i64 arg); | 33 | } lpd; |
35 | +void tcg_gen_smin_i64(TCGv_i64, TCGv_i64 arg1, TCGv_i64 arg2); | 34 | |
36 | +void tcg_gen_smax_i64(TCGv_i64, TCGv_i64 arg1, TCGv_i64 arg2); | 35 | /* The Platform Management Controller subsystem. */ |
37 | +void tcg_gen_umin_i64(TCGv_i64, TCGv_i64 arg1, TCGv_i64 arg2); | 36 | @@ -XXX,XX +XXX,XX @@ struct Versal { |
38 | +void tcg_gen_umax_i64(TCGv_i64, TCGv_i64 arg1, TCGv_i64 arg2); | 37 | #define VERSAL_TIMER_NS_EL1_IRQ 14 |
39 | 38 | #define VERSAL_TIMER_NS_EL2_IRQ 10 | |
40 | #if TCG_TARGET_REG_BITS == 64 | 39 | |
41 | static inline void tcg_gen_discard_i64(TCGv_i64 arg) | 40 | +#define VERSAL_CRL_IRQ 10 |
42 | @@ -XXX,XX +XXX,XX @@ void tcg_gen_stl_vec(TCGv_vec r, TCGv_ptr base, TCGArg offset, TCGType t); | 41 | #define VERSAL_UART0_IRQ_0 18 |
43 | #define tcg_gen_mulu2_tl tcg_gen_mulu2_i64 | 42 | #define VERSAL_UART1_IRQ_0 19 |
44 | #define tcg_gen_muls2_tl tcg_gen_muls2_i64 | 43 | #define VERSAL_USB0_IRQ_0 22 |
45 | #define tcg_gen_mulsu2_tl tcg_gen_mulsu2_i64 | 44 | diff --git a/hw/arm/xlnx-versal.c b/hw/arm/xlnx-versal.c |
46 | +#define tcg_gen_smin_tl tcg_gen_smin_i64 | ||
47 | +#define tcg_gen_umin_tl tcg_gen_umin_i64 | ||
48 | +#define tcg_gen_smax_tl tcg_gen_smax_i64 | ||
49 | +#define tcg_gen_umax_tl tcg_gen_umax_i64 | ||
50 | #define tcg_gen_atomic_cmpxchg_tl tcg_gen_atomic_cmpxchg_i64 | ||
51 | #define tcg_gen_atomic_xchg_tl tcg_gen_atomic_xchg_i64 | ||
52 | #define tcg_gen_atomic_fetch_add_tl tcg_gen_atomic_fetch_add_i64 | ||
53 | @@ -XXX,XX +XXX,XX @@ void tcg_gen_stl_vec(TCGv_vec r, TCGv_ptr base, TCGArg offset, TCGType t); | ||
54 | #define tcg_gen_mulu2_tl tcg_gen_mulu2_i32 | ||
55 | #define tcg_gen_muls2_tl tcg_gen_muls2_i32 | ||
56 | #define tcg_gen_mulsu2_tl tcg_gen_mulsu2_i32 | ||
57 | +#define tcg_gen_smin_tl tcg_gen_smin_i32 | ||
58 | +#define tcg_gen_umin_tl tcg_gen_umin_i32 | ||
59 | +#define tcg_gen_smax_tl tcg_gen_smax_i32 | ||
60 | +#define tcg_gen_umax_tl tcg_gen_umax_i32 | ||
61 | #define tcg_gen_atomic_cmpxchg_tl tcg_gen_atomic_cmpxchg_i32 | ||
62 | #define tcg_gen_atomic_xchg_tl tcg_gen_atomic_xchg_i32 | ||
63 | #define tcg_gen_atomic_fetch_add_tl tcg_gen_atomic_fetch_add_i32 | ||
64 | diff --git a/tcg/tcg-op.c b/tcg/tcg-op.c | ||
65 | index XXXXXXX..XXXXXXX 100644 | 45 | index XXXXXXX..XXXXXXX 100644 |
66 | --- a/tcg/tcg-op.c | 46 | --- a/hw/arm/xlnx-versal.c |
67 | +++ b/tcg/tcg-op.c | 47 | +++ b/hw/arm/xlnx-versal.c |
68 | @@ -XXX,XX +XXX,XX @@ void tcg_gen_bswap32_i32(TCGv_i32 ret, TCGv_i32 arg) | 48 | @@ -XXX,XX +XXX,XX @@ static void versal_create_ospi(Versal *s, qemu_irq *pic) |
69 | } | 49 | qdev_connect_gpio_out(orgate, 0, pic[VERSAL_OSPI_IRQ]); |
70 | } | 50 | } |
71 | 51 | ||
72 | +void tcg_gen_smin_i32(TCGv_i32 ret, TCGv_i32 a, TCGv_i32 b) | 52 | +static void versal_create_crl(Versal *s, qemu_irq *pic) |
73 | +{ | 53 | +{ |
74 | + tcg_gen_movcond_i32(TCG_COND_LT, ret, a, b, a, b); | 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]); | ||
75 | +} | 101 | +} |
76 | + | 102 | + |
77 | +void tcg_gen_umin_i32(TCGv_i32 ret, TCGv_i32 a, TCGv_i32 b) | 103 | /* This takes the board allocated linear DDR memory and creates aliases |
78 | +{ | 104 | * for each split DDR range/aperture on the Versal address map. |
79 | + tcg_gen_movcond_i32(TCG_COND_LTU, ret, a, b, a, b); | 105 | */ |
80 | +} | 106 | @@ -XXX,XX +XXX,XX @@ static void versal_unimp(Versal *s) |
81 | + | 107 | |
82 | +void tcg_gen_smax_i32(TCGv_i32 ret, TCGv_i32 a, TCGv_i32 b) | 108 | versal_unimp_area(s, "psm", &s->mr_ps, |
83 | +{ | 109 | MM_PSM_START, MM_PSM_END - MM_PSM_START); |
84 | + tcg_gen_movcond_i32(TCG_COND_LT, ret, a, b, b, a); | 110 | - versal_unimp_area(s, "crl", &s->mr_ps, |
85 | +} | 111 | - MM_CRL, MM_CRL_SIZE); |
86 | + | 112 | versal_unimp_area(s, "crf", &s->mr_ps, |
87 | +void tcg_gen_umax_i32(TCGv_i32 ret, TCGv_i32 a, TCGv_i32 b) | 113 | MM_FPD_CRF, MM_FPD_CRF_SIZE); |
88 | +{ | 114 | versal_unimp_area(s, "apu", &s->mr_ps, |
89 | + tcg_gen_movcond_i32(TCG_COND_LTU, ret, a, b, b, a); | 115 | @@ -XXX,XX +XXX,XX @@ static void versal_realize(DeviceState *dev, Error **errp) |
90 | +} | 116 | versal_create_efuse(s, pic); |
91 | + | 117 | versal_create_pmc_iou_slcr(s, pic); |
92 | /* 64-bit ops */ | 118 | versal_create_ospi(s, pic); |
93 | 119 | + versal_create_crl(s, pic); | |
94 | #if TCG_TARGET_REG_BITS == 32 | 120 | versal_map_ddr(s); |
95 | @@ -XXX,XX +XXX,XX @@ void tcg_gen_mulsu2_i64(TCGv_i64 rl, TCGv_i64 rh, TCGv_i64 arg1, TCGv_i64 arg2) | 121 | versal_unimp(s); |
96 | tcg_temp_free_i64(t2); | 122 | |
97 | } | ||
98 | |||
99 | +void tcg_gen_smin_i64(TCGv_i64 ret, TCGv_i64 a, TCGv_i64 b) | ||
100 | +{ | ||
101 | + tcg_gen_movcond_i64(TCG_COND_LT, ret, a, b, a, b); | ||
102 | +} | ||
103 | + | ||
104 | +void tcg_gen_umin_i64(TCGv_i64 ret, TCGv_i64 a, TCGv_i64 b) | ||
105 | +{ | ||
106 | + tcg_gen_movcond_i64(TCG_COND_LTU, ret, a, b, a, b); | ||
107 | +} | ||
108 | + | ||
109 | +void tcg_gen_smax_i64(TCGv_i64 ret, TCGv_i64 a, TCGv_i64 b) | ||
110 | +{ | ||
111 | + tcg_gen_movcond_i64(TCG_COND_LT, ret, a, b, b, a); | ||
112 | +} | ||
113 | + | ||
114 | +void tcg_gen_umax_i64(TCGv_i64 ret, TCGv_i64 a, TCGv_i64 b) | ||
115 | +{ | ||
116 | + tcg_gen_movcond_i64(TCG_COND_LTU, ret, a, b, b, a); | ||
117 | +} | ||
118 | + | ||
119 | /* Size changing operations. */ | ||
120 | |||
121 | void tcg_gen_extrl_i64_i32(TCGv_i32 ret, TCGv_i64 arg) | ||
122 | -- | 123 | -- |
123 | 2.17.0 | 124 | 2.25.1 |
124 | |||
125 | diff view generated by jsdifflib |
1 | From: Igor Mammedov <imammedo@redhat.com> | 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 | By default MachineClass::get_hotplug_handler is NULL and concrete board | 6 | (This is a migration compatibility break, but that is OK for this |
4 | should set it to it's own handler. | 7 | machine type.) |
5 | Considering there isn't any default handler, drop saving empty | ||
6 | MachineClass::get_hotplug_handler in child class and make PC code | ||
7 | consistent with spapr/s390x boards. | ||
8 | 8 | ||
9 | We can bring this back when actual usecase surfaces and do it | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
10 | consistently across boards that use get_hotplug_handler(). | 10 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
11 | Message-id: 20220404154658.565020-2-peter.maydell@linaro.org | ||
12 | --- | ||
13 | include/hw/arm/exynos4210.h | 1 + | ||
14 | hw/arm/exynos4210.c | 31 ++++++++++++++++--------------- | ||
15 | 2 files changed, 17 insertions(+), 15 deletions(-) | ||
11 | 16 | ||
12 | Suggested-by: David Gibson <david@gibson.dropbear.id.au> | 17 | diff --git a/include/hw/arm/exynos4210.h b/include/hw/arm/exynos4210.h |
13 | Signed-off-by: Igor Mammedov <imammedo@redhat.com> | ||
14 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
15 | Reviewed-by: Eduardo Habkost <ehabkost@redhat.com> | ||
16 | Message-id: 1525691524-32265-2-git-send-email-imammedo@redhat.com | ||
17 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
18 | --- | ||
19 | include/hw/i386/pc.h | 8 -------- | ||
20 | hw/i386/pc.c | 6 +----- | ||
21 | 2 files changed, 1 insertion(+), 13 deletions(-) | ||
22 | |||
23 | diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h | ||
24 | index XXXXXXX..XXXXXXX 100644 | 18 | index XXXXXXX..XXXXXXX 100644 |
25 | --- a/include/hw/i386/pc.h | 19 | --- a/include/hw/arm/exynos4210.h |
26 | +++ b/include/hw/i386/pc.h | 20 | +++ b/include/hw/arm/exynos4210.h |
27 | @@ -XXX,XX +XXX,XX @@ struct PCMachineState { | 21 | @@ -XXX,XX +XXX,XX @@ struct Exynos4210State { |
28 | /** | 22 | MemoryRegion bootreg_mem; |
29 | * PCMachineClass: | 23 | I2CBus *i2c_if[EXYNOS4210_I2C_NUMBER]; |
30 | * | 24 | qemu_or_irq pl330_irq_orgate[EXYNOS4210_NUM_DMA]; |
31 | - * Methods: | 25 | + qemu_or_irq cpu_irq_orgate[EXYNOS4210_NCPUS]; |
32 | - * | 26 | }; |
33 | - * @get_hotplug_handler: pointer to parent class callback @get_hotplug_handler | 27 | |
34 | - * | 28 | #define TYPE_EXYNOS4210_SOC "exynos4210" |
35 | * Compat fields: | 29 | diff --git a/hw/arm/exynos4210.c b/hw/arm/exynos4210.c |
36 | * | 30 | index XXXXXXX..XXXXXXX 100644 |
37 | * @enforce_aligned_dimm: check that DIMM's address/size is aligned by | 31 | --- a/hw/arm/exynos4210.c |
38 | @@ -XXX,XX +XXX,XX @@ struct PCMachineClass { | 32 | +++ b/hw/arm/exynos4210.c |
39 | 33 | @@ -XXX,XX +XXX,XX @@ static void exynos4210_realize(DeviceState *socdev, Error **errp) | |
40 | /*< public >*/ | 34 | { |
41 | 35 | Exynos4210State *s = EXYNOS4210_SOC(socdev); | |
42 | - /* Methods: */ | 36 | MemoryRegion *system_mem = get_system_memory(); |
43 | - HotplugHandler *(*get_hotplug_handler)(MachineState *machine, | 37 | - qemu_irq gate_irq[EXYNOS4210_NCPUS][EXYNOS4210_IRQ_GATE_NINPUTS]; |
44 | - DeviceState *dev); | 38 | SysBusDevice *busdev; |
39 | DeviceState *dev, *uart[4], *pl330[3]; | ||
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); | ||
45 | - | 53 | - |
46 | /* Device configuration: */ | 54 | - /* Connect IRQ Gate output to CPU's IRQ line */ |
47 | bool pci_enabled; | 55 | - sysbus_connect_irq(busdev, 0, |
48 | bool kvmclock_enabled; | 56 | - qdev_get_gpio_in(DEVICE(s->cpu[i]), ARM_CPU_IRQ)); |
49 | diff --git a/hw/i386/pc.c b/hw/i386/pc.c | 57 | + DeviceState *orgate = DEVICE(&s->cpu_irq_orgate[i]); |
50 | index XXXXXXX..XXXXXXX 100644 | 58 | + object_property_set_int(OBJECT(orgate), "num-lines", |
51 | --- a/hw/i386/pc.c | 59 | + EXYNOS4210_IRQ_GATE_NINPUTS, |
52 | +++ b/hw/i386/pc.c | 60 | + &error_abort); |
53 | @@ -XXX,XX +XXX,XX @@ static void pc_machine_device_unplug_cb(HotplugHandler *hotplug_dev, | 61 | + qdev_realize(orgate, NULL, &error_abort); |
54 | static HotplugHandler *pc_get_hotpug_handler(MachineState *machine, | 62 | + qdev_connect_gpio_out(orgate, 0, |
55 | DeviceState *dev) | 63 | + qdev_get_gpio_in(DEVICE(s->cpu[i]), ARM_CPU_IRQ)); |
56 | { | ||
57 | - PCMachineClass *pcmc = PC_MACHINE_GET_CLASS(machine); | ||
58 | - | ||
59 | if (object_dynamic_cast(OBJECT(dev), TYPE_PC_DIMM) || | ||
60 | object_dynamic_cast(OBJECT(dev), TYPE_CPU)) { | ||
61 | return HOTPLUG_HANDLER(machine); | ||
62 | } | 64 | } |
63 | 65 | ||
64 | - return pcmc->get_hotplug_handler ? | 66 | /* Private memory region and Internal GIC */ |
65 | - pcmc->get_hotplug_handler(machine, dev) : NULL; | 67 | @@ -XXX,XX +XXX,XX @@ static void exynos4210_realize(DeviceState *socdev, Error **errp) |
66 | + return NULL; | 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 | + } | ||
67 | } | 96 | } |
68 | 97 | ||
69 | static void | 98 | static void exynos4210_class_init(ObjectClass *klass, void *data) |
70 | @@ -XXX,XX +XXX,XX @@ static void pc_machine_class_init(ObjectClass *oc, void *data) | ||
71 | HotplugHandlerClass *hc = HOTPLUG_HANDLER_CLASS(oc); | ||
72 | NMIClass *nc = NMI_CLASS(oc); | ||
73 | |||
74 | - pcmc->get_hotplug_handler = mc->get_hotplug_handler; | ||
75 | pcmc->pci_enabled = true; | ||
76 | pcmc->has_acpi_build = true; | ||
77 | pcmc->rsdp_in_ram = true; | ||
78 | -- | 99 | -- |
79 | 2.17.0 | 100 | 2.25.1 |
80 | |||
81 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | Now we have removed the only use of TYPE_EXYNOS4210_IRQ_GATE we can |
---|---|---|---|
2 | delete the device entirely. | ||
2 | 3 | ||
3 | The generic expanders replace nearly identical code in the translator. | 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(-) | ||
4 | 10 | ||
5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 11 | diff --git a/hw/intc/exynos4210_gic.c b/hw/intc/exynos4210_gic.c |
6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Message-id: 20180508151437.4232-3-richard.henderson@linaro.org | ||
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
9 | --- | ||
10 | target/arm/translate-a64.c | 46 ++++++++++++-------------------------- | ||
11 | 1 file changed, 14 insertions(+), 32 deletions(-) | ||
12 | |||
13 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c | ||
14 | index XXXXXXX..XXXXXXX 100644 | 12 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/target/arm/translate-a64.c | 13 | --- a/hw/intc/exynos4210_gic.c |
16 | +++ b/target/arm/translate-a64.c | 14 | +++ b/hw/intc/exynos4210_gic.c |
17 | @@ -XXX,XX +XXX,XX @@ static void disas_simd_across_lanes(DisasContext *s, uint32_t insn) | 15 | @@ -XXX,XX +XXX,XX @@ static void exynos4210_gic_register_types(void) |
18 | tcg_gen_add_i64(tcg_res, tcg_res, tcg_elt); | ||
19 | break; | ||
20 | case 0x0a: /* SMAXV / UMAXV */ | ||
21 | - tcg_gen_movcond_i64(is_u ? TCG_COND_GEU : TCG_COND_GE, | ||
22 | - tcg_res, | ||
23 | - tcg_res, tcg_elt, tcg_res, tcg_elt); | ||
24 | + if (is_u) { | ||
25 | + tcg_gen_umax_i64(tcg_res, tcg_res, tcg_elt); | ||
26 | + } else { | ||
27 | + tcg_gen_smax_i64(tcg_res, tcg_res, tcg_elt); | ||
28 | + } | ||
29 | break; | ||
30 | case 0x1a: /* SMINV / UMINV */ | ||
31 | - tcg_gen_movcond_i64(is_u ? TCG_COND_LEU : TCG_COND_LE, | ||
32 | - tcg_res, | ||
33 | - tcg_res, tcg_elt, tcg_res, tcg_elt); | ||
34 | - break; | ||
35 | + if (is_u) { | ||
36 | + tcg_gen_umin_i64(tcg_res, tcg_res, tcg_elt); | ||
37 | + } else { | ||
38 | + tcg_gen_smin_i64(tcg_res, tcg_res, tcg_elt); | ||
39 | + } | ||
40 | break; | ||
41 | default: | ||
42 | g_assert_not_reached(); | ||
43 | @@ -XXX,XX +XXX,XX @@ static void disas_simd_3same_logic(DisasContext *s, uint32_t insn) | ||
44 | } | ||
45 | } | 16 | } |
46 | 17 | ||
47 | -/* Helper functions for 32 bit comparisons */ | 18 | type_init(exynos4210_gic_register_types) |
48 | -static void gen_max_s32(TCGv_i32 res, TCGv_i32 op1, TCGv_i32 op2) | 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) | ||
49 | -{ | 55 | -{ |
50 | - tcg_gen_movcond_i32(TCG_COND_GE, res, op1, op2, op1, op2); | 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); | ||
51 | -} | 71 | -} |
52 | - | 72 | - |
53 | -static void gen_max_u32(TCGv_i32 res, TCGv_i32 op1, TCGv_i32 op2) | 73 | -static void exynos4210_irq_gate_reset(DeviceState *d) |
54 | -{ | 74 | -{ |
55 | - tcg_gen_movcond_i32(TCG_COND_GEU, res, op1, op2, op1, op2); | 75 | - Exynos4210IRQGateState *s = EXYNOS4210_IRQ_GATE(d); |
76 | - | ||
77 | - memset(s->level, 0, s->n_in * sizeof(*s->level)); | ||
56 | -} | 78 | -} |
57 | - | 79 | - |
58 | -static void gen_min_s32(TCGv_i32 res, TCGv_i32 op1, TCGv_i32 op2) | 80 | -/* |
81 | - * IRQ Gate initialization. | ||
82 | - */ | ||
83 | -static void exynos4210_irq_gate_init(Object *obj) | ||
59 | -{ | 84 | -{ |
60 | - tcg_gen_movcond_i32(TCG_COND_LE, res, op1, op2, op1, op2); | 85 | - Exynos4210IRQGateState *s = EXYNOS4210_IRQ_GATE(obj); |
86 | - SysBusDevice *sbd = SYS_BUS_DEVICE(obj); | ||
87 | - | ||
88 | - sysbus_init_irq(sbd, &s->out); | ||
61 | -} | 89 | -} |
62 | - | 90 | - |
63 | -static void gen_min_u32(TCGv_i32 res, TCGv_i32 op1, TCGv_i32 op2) | 91 | -static void exynos4210_irq_gate_realize(DeviceState *dev, Error **errp) |
64 | -{ | 92 | -{ |
65 | - tcg_gen_movcond_i32(TCG_COND_LEU, res, op1, op2, op1, op2); | 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)); | ||
66 | -} | 100 | -} |
67 | - | 101 | - |
68 | /* Pairwise op subgroup of C3.6.16. | 102 | -static void exynos4210_irq_gate_class_init(ObjectClass *klass, void *data) |
69 | * | 103 | -{ |
70 | * This is called directly or via the handle_3same_float for float pairwise | 104 | - DeviceClass *dc = DEVICE_CLASS(klass); |
71 | @@ -XXX,XX +XXX,XX @@ static void handle_simd_3same_pair(DisasContext *s, int is_q, int u, int opcode, | 105 | - |
72 | static NeonGenTwoOpFn * const fns[3][2] = { | 106 | - dc->reset = exynos4210_irq_gate_reset; |
73 | { gen_helper_neon_pmax_s8, gen_helper_neon_pmax_u8 }, | 107 | - dc->vmsd = &vmstate_exynos4210_irq_gate; |
74 | { gen_helper_neon_pmax_s16, gen_helper_neon_pmax_u16 }, | 108 | - device_class_set_props(dc, exynos4210_irq_gate_properties); |
75 | - { gen_max_s32, gen_max_u32 }, | 109 | - dc->realize = exynos4210_irq_gate_realize; |
76 | + { tcg_gen_smax_i32, tcg_gen_umax_i32 }, | 110 | -} |
77 | }; | 111 | - |
78 | genfn = fns[size][u]; | 112 | -static const TypeInfo exynos4210_irq_gate_info = { |
79 | break; | 113 | - .name = TYPE_EXYNOS4210_IRQ_GATE, |
80 | @@ -XXX,XX +XXX,XX @@ static void handle_simd_3same_pair(DisasContext *s, int is_q, int u, int opcode, | 114 | - .parent = TYPE_SYS_BUS_DEVICE, |
81 | static NeonGenTwoOpFn * const fns[3][2] = { | 115 | - .instance_size = sizeof(Exynos4210IRQGateState), |
82 | { gen_helper_neon_pmin_s8, gen_helper_neon_pmin_u8 }, | 116 | - .instance_init = exynos4210_irq_gate_init, |
83 | { gen_helper_neon_pmin_s16, gen_helper_neon_pmin_u16 }, | 117 | - .class_init = exynos4210_irq_gate_class_init, |
84 | - { gen_min_s32, gen_min_u32 }, | 118 | -}; |
85 | + { tcg_gen_smin_i32, tcg_gen_umin_i32 }, | 119 | - |
86 | }; | 120 | -static void exynos4210_irq_gate_register_types(void) |
87 | genfn = fns[size][u]; | 121 | -{ |
88 | break; | 122 | - type_register_static(&exynos4210_irq_gate_info); |
89 | @@ -XXX,XX +XXX,XX @@ static void disas_simd_3same_int(DisasContext *s, uint32_t insn) | 123 | -} |
90 | static NeonGenTwoOpFn * const fns[3][2] = { | 124 | - |
91 | { gen_helper_neon_max_s8, gen_helper_neon_max_u8 }, | 125 | -type_init(exynos4210_irq_gate_register_types) |
92 | { gen_helper_neon_max_s16, gen_helper_neon_max_u16 }, | ||
93 | - { gen_max_s32, gen_max_u32 }, | ||
94 | + { tcg_gen_smax_i32, tcg_gen_umax_i32 }, | ||
95 | }; | ||
96 | genfn = fns[size][u]; | ||
97 | break; | ||
98 | @@ -XXX,XX +XXX,XX @@ static void disas_simd_3same_int(DisasContext *s, uint32_t insn) | ||
99 | static NeonGenTwoOpFn * const fns[3][2] = { | ||
100 | { gen_helper_neon_min_s8, gen_helper_neon_min_u8 }, | ||
101 | { gen_helper_neon_min_s16, gen_helper_neon_min_u16 }, | ||
102 | - { gen_min_s32, gen_min_u32 }, | ||
103 | + { tcg_gen_smin_i32, tcg_gen_umin_i32 }, | ||
104 | }; | ||
105 | genfn = fns[size][u]; | ||
106 | break; | ||
107 | -- | 126 | -- |
108 | 2.17.0 | 127 | 2.25.1 |
109 | |||
110 | diff view generated by jsdifflib |
1 | It is implementation defined whether a multiply-add of | 1 | The exynos4210 SoC mostly creates its child devices as if it were |
---|---|---|---|
2 | (0,inf,qnan) or (inf,0,qnan) raises InvalidaOperation or | 2 | board code. This includes the a9mpcore object. Switch that to a |
3 | not, so we let the target-specific pickNaNMulAdd function | 3 | new-style "embedded in the state struct" creation, because in the |
4 | handle this. This means that we must do the "return the | 4 | next commit we're going to want to refer to the object again further |
5 | default NaN in default NaN mode" check after the call, | 5 | down in the exynos4210_realize() function. |
6 | not before. Correct the ordering, and restore the comment | ||
7 | from the old propagateFloat64MulAddNaN() that warned about | ||
8 | this corner case. | ||
9 | 6 | ||
10 | This fixes a regression from 2.11 for Arm guests where we would | ||
11 | incorrectly fail to set the Invalid flag for these cases. | ||
12 | |||
13 | Cc: qemu-stable@nongnu.org | ||
14 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
15 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 8 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
16 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | 9 | Message-id: 20220404154658.565020-4-peter.maydell@linaro.org |
17 | Tested-by: Alex Bennée <alex.bennee@linaro.org> | ||
18 | Message-id: 20180504100547.14621-1-peter.maydell@linaro.org | ||
19 | --- | 10 | --- |
20 | fpu/softfloat.c | 52 ++++++++++++++++++++++++++++--------------------- | 11 | include/hw/arm/exynos4210.h | 2 ++ |
21 | 1 file changed, 30 insertions(+), 22 deletions(-) | 12 | hw/arm/exynos4210.c | 11 ++++++----- |
13 | 2 files changed, 8 insertions(+), 5 deletions(-) | ||
22 | 14 | ||
23 | diff --git a/fpu/softfloat.c b/fpu/softfloat.c | 15 | diff --git a/include/hw/arm/exynos4210.h b/include/hw/arm/exynos4210.h |
24 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
25 | --- a/fpu/softfloat.c | 17 | --- a/include/hw/arm/exynos4210.h |
26 | +++ b/fpu/softfloat.c | 18 | +++ b/include/hw/arm/exynos4210.h |
27 | @@ -XXX,XX +XXX,XX @@ static FloatParts pick_nan(FloatParts a, FloatParts b, float_status *s) | 19 | @@ -XXX,XX +XXX,XX @@ |
28 | static FloatParts pick_nan_muladd(FloatParts a, FloatParts b, FloatParts c, | 20 | |
29 | bool inf_zero, float_status *s) | 21 | #include "hw/or-irq.h" |
30 | { | 22 | #include "hw/sysbus.h" |
31 | + int which; | 23 | +#include "hw/cpu/a9mpcore.h" |
32 | + | 24 | #include "target/arm/cpu-qom.h" |
33 | if (is_snan(a.cls) || is_snan(b.cls) || is_snan(c.cls)) { | 25 | #include "qom/object.h" |
34 | s->float_exception_flags |= float_flag_invalid; | 26 | |
27 | @@ -XXX,XX +XXX,XX @@ struct Exynos4210State { | ||
28 | I2CBus *i2c_if[EXYNOS4210_I2C_NUMBER]; | ||
29 | qemu_or_irq pl330_irq_orgate[EXYNOS4210_NUM_DMA]; | ||
30 | qemu_or_irq cpu_irq_orgate[EXYNOS4210_NCPUS]; | ||
31 | + A9MPPrivState a9mpcore; | ||
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) | ||
35 | } | 40 | } |
36 | 41 | ||
37 | - if (s->default_nan_mode) { | 42 | /* Private memory region and Internal GIC */ |
38 | - a.cls = float_class_dnan; | 43 | - dev = qdev_new(TYPE_A9MPCORE_PRIV); |
39 | - } else { | 44 | - qdev_prop_set_uint32(dev, "num-cpu", EXYNOS4210_NCPUS); |
40 | - switch (pickNaNMulAdd(is_qnan(a.cls), is_snan(a.cls), | 45 | - busdev = SYS_BUS_DEVICE(dev); |
41 | - is_qnan(b.cls), is_snan(b.cls), | 46 | - sysbus_realize_and_unref(busdev, &error_fatal); |
42 | - is_qnan(c.cls), is_snan(c.cls), | 47 | + qdev_prop_set_uint32(DEVICE(&s->a9mpcore), "num-cpu", EXYNOS4210_NCPUS); |
43 | - inf_zero, s)) { | 48 | + busdev = SYS_BUS_DEVICE(&s->a9mpcore); |
44 | - case 0: | 49 | + sysbus_realize(busdev, &error_fatal); |
45 | - break; | 50 | sysbus_mmio_map(busdev, 0, EXYNOS4210_SMP_PRIVATE_BASE_ADDR); |
46 | - case 1: | 51 | for (n = 0; n < EXYNOS4210_NCPUS; n++) { |
47 | - a = b; | 52 | sysbus_connect_irq(busdev, n, |
48 | - break; | 53 | qdev_get_gpio_in(DEVICE(&s->cpu_irq_orgate[n]), 0)); |
49 | - case 2: | 54 | } |
50 | - a = c; | 55 | for (n = 0; n < EXYNOS4210_INT_GIC_NIRQ; n++) { |
51 | - break; | 56 | - s->irqs.int_gic_irq[n] = qdev_get_gpio_in(dev, n); |
52 | - case 3: | 57 | + s->irqs.int_gic_irq[n] = qdev_get_gpio_in(DEVICE(&s->a9mpcore), n); |
53 | - a.cls = float_class_dnan; | 58 | } |
54 | - return a; | 59 | |
55 | - default: | 60 | /* Cache controller */ |
56 | - g_assert_not_reached(); | 61 | @@ -XXX,XX +XXX,XX @@ static void exynos4210_init(Object *obj) |
57 | - } | 62 | g_autofree char *name = g_strdup_printf("cpu-irq-orgate%d", i); |
58 | + which = pickNaNMulAdd(is_qnan(a.cls), is_snan(a.cls), | 63 | object_initialize_child(obj, name, &s->cpu_irq_orgate[i], TYPE_OR_IRQ); |
59 | + is_qnan(b.cls), is_snan(b.cls), | ||
60 | + is_qnan(c.cls), is_snan(c.cls), | ||
61 | + inf_zero, s); | ||
62 | |||
63 | - a.cls = float_class_msnan; | ||
64 | + if (s->default_nan_mode) { | ||
65 | + /* Note that this check is after pickNaNMulAdd so that function | ||
66 | + * has an opportunity to set the Invalid flag. | ||
67 | + */ | ||
68 | + a.cls = float_class_dnan; | ||
69 | + return a; | ||
70 | } | 64 | } |
71 | + | 65 | + |
72 | + switch (which) { | 66 | + object_initialize_child(obj, "a9mpcore", &s->a9mpcore, TYPE_A9MPCORE_PRIV); |
73 | + case 0: | ||
74 | + break; | ||
75 | + case 1: | ||
76 | + a = b; | ||
77 | + break; | ||
78 | + case 2: | ||
79 | + a = c; | ||
80 | + break; | ||
81 | + case 3: | ||
82 | + a.cls = float_class_dnan; | ||
83 | + return a; | ||
84 | + default: | ||
85 | + g_assert_not_reached(); | ||
86 | + } | ||
87 | + a.cls = float_class_msnan; | ||
88 | + | ||
89 | return a; | ||
90 | } | 67 | } |
91 | 68 | ||
69 | static void exynos4210_class_init(ObjectClass *klass, void *data) | ||
92 | -- | 70 | -- |
93 | 2.17.0 | 71 | 2.25.1 |
94 | |||
95 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | The only time we use the int_gic_irq[] array in the Exynos4210Irq | ||
2 | struct is in the exynos4210_realize() function: we initialize it with | ||
3 | the GPIO inputs of the a9mpcore device, and then a bit later on we | ||
4 | connect those to the outputs of the internal combiner. Now that the | ||
5 | a9mpcore object is easily accessible as s->a9mpcore we can make the | ||
6 | connection directly from one device to the other without going via | ||
7 | this array. | ||
1 | 8 | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
11 | Message-id: 20220404154658.565020-5-peter.maydell@linaro.org | ||
12 | --- | ||
13 | include/hw/arm/exynos4210.h | 1 - | ||
14 | hw/arm/exynos4210.c | 6 ++---- | ||
15 | 2 files changed, 2 insertions(+), 5 deletions(-) | ||
16 | |||
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 | typedef struct Exynos4210Irq { | ||
23 | qemu_irq int_combiner_irq[EXYNOS4210_MAX_INT_COMBINER_IN_IRQ]; | ||
24 | qemu_irq ext_combiner_irq[EXYNOS4210_MAX_EXT_COMBINER_IN_IRQ]; | ||
25 | - qemu_irq int_gic_irq[EXYNOS4210_INT_GIC_NIRQ]; | ||
26 | qemu_irq ext_gic_irq[EXYNOS4210_EXT_GIC_NIRQ]; | ||
27 | qemu_irq board_irqs[EXYNOS4210_MAX_INT_COMBINER_IN_IRQ]; | ||
28 | } Exynos4210Irq; | ||
29 | diff --git a/hw/arm/exynos4210.c b/hw/arm/exynos4210.c | ||
30 | index XXXXXXX..XXXXXXX 100644 | ||
31 | --- a/hw/arm/exynos4210.c | ||
32 | +++ b/hw/arm/exynos4210.c | ||
33 | @@ -XXX,XX +XXX,XX @@ static void exynos4210_realize(DeviceState *socdev, Error **errp) | ||
34 | sysbus_connect_irq(busdev, n, | ||
35 | qdev_get_gpio_in(DEVICE(&s->cpu_irq_orgate[n]), 0)); | ||
36 | } | ||
37 | - for (n = 0; n < EXYNOS4210_INT_GIC_NIRQ; n++) { | ||
38 | - s->irqs.int_gic_irq[n] = qdev_get_gpio_in(DEVICE(&s->a9mpcore), n); | ||
39 | - } | ||
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); | ||
53 | -- | ||
54 | 2.25.1 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | The exynos4210 code currently has two very similar arrays of IRQs: | ||
1 | 2 | ||
3 | * board_irqs is a field of the Exynos4210Irq struct which is filled | ||
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 | ||
10 | |||
11 | The extra indirection through irq_table is unnecessary, so coalesce | ||
12 | these into a single irq_table[] array as a direct field in | ||
13 | Exynos4210State which exynos4210_init_board_irqs() fills in. | ||
14 | |||
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 | ||
18 | --- | ||
19 | include/hw/arm/exynos4210.h | 8 ++------ | ||
20 | hw/arm/exynos4210.c | 6 +----- | ||
21 | hw/intc/exynos4210_gic.c | 32 ++++++++------------------------ | ||
22 | 3 files changed, 11 insertions(+), 35 deletions(-) | ||
23 | |||
24 | diff --git a/include/hw/arm/exynos4210.h b/include/hw/arm/exynos4210.h | ||
25 | index XXXXXXX..XXXXXXX 100644 | ||
26 | --- a/include/hw/arm/exynos4210.h | ||
27 | +++ b/include/hw/arm/exynos4210.h | ||
28 | @@ -XXX,XX +XXX,XX @@ typedef struct Exynos4210Irq { | ||
29 | qemu_irq int_combiner_irq[EXYNOS4210_MAX_INT_COMBINER_IN_IRQ]; | ||
30 | qemu_irq ext_combiner_irq[EXYNOS4210_MAX_EXT_COMBINER_IN_IRQ]; | ||
31 | qemu_irq ext_gic_irq[EXYNOS4210_EXT_GIC_NIRQ]; | ||
32 | - qemu_irq board_irqs[EXYNOS4210_MAX_INT_COMBINER_IN_IRQ]; | ||
33 | } Exynos4210Irq; | ||
34 | |||
35 | struct Exynos4210State { | ||
36 | @@ -XXX,XX +XXX,XX @@ struct Exynos4210State { | ||
37 | /*< public >*/ | ||
38 | ARMCPU *cpu[EXYNOS4210_NCPUS]; | ||
39 | Exynos4210Irq irqs; | ||
40 | - qemu_irq *irq_table; | ||
41 | + qemu_irq irq_table[EXYNOS4210_MAX_INT_COMBINER_IN_IRQ]; | ||
42 | |||
43 | MemoryRegion chipid_mem; | ||
44 | MemoryRegion iram_mem; | ||
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); | ||
65 | } | ||
66 | |||
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 | } | ||
147 | -- | ||
148 | 2.25.1 | diff view generated by jsdifflib |
1 | Some versions of gcc produce a spurious warning if the result of | 1 | Fix a missing set of spaces around '-' in the definition of |
---|---|---|---|
2 | __atomic_compare_echange_n() is not used and the type involved | 2 | combiner_grp_to_gic_id[]. We're about to move this code, so |
3 | is a signed 8 bit value: | 3 | fix the style issue first to keep checkpatch happy with the |
4 | error: value computed is not used [-Werror=unused-value] | 4 | code-motion patch. |
5 | This has been seen on at least | ||
6 | gcc (Ubuntu 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609 | ||
7 | |||
8 | Work around this by using an explicit cast to void to indicate | ||
9 | that we don't care about the return value. | ||
10 | |||
11 | We don't currently use our atomic_cmpxchg() macro on any signed | ||
12 | 8 bit types, but the upcoming support for the Arm v8.1-Atomics | ||
13 | will require it. | ||
14 | 5 | ||
15 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
16 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 7 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
17 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 8 | Message-id: 20220404154658.565020-7-peter.maydell@linaro.org |
18 | --- | 9 | --- |
19 | include/qemu/atomic.h | 2 +- | 10 | hw/intc/exynos4210_gic.c | 2 +- |
20 | 1 file changed, 1 insertion(+), 1 deletion(-) | 11 | 1 file changed, 1 insertion(+), 1 deletion(-) |
21 | 12 | ||
22 | diff --git a/include/qemu/atomic.h b/include/qemu/atomic.h | 13 | diff --git a/hw/intc/exynos4210_gic.c b/hw/intc/exynos4210_gic.c |
23 | index XXXXXXX..XXXXXXX 100644 | 14 | index XXXXXXX..XXXXXXX 100644 |
24 | --- a/include/qemu/atomic.h | 15 | --- a/hw/intc/exynos4210_gic.c |
25 | +++ b/include/qemu/atomic.h | 16 | +++ b/hw/intc/exynos4210_gic.c |
26 | @@ -XXX,XX +XXX,XX @@ | 17 | @@ -XXX,XX +XXX,XX @@ enum ExtInt { |
27 | /* Returns the eventual value, failed or not */ | 18 | */ |
28 | #define atomic_cmpxchg__nocheck(ptr, old, new) ({ \ | 19 | |
29 | typeof_strip_qual(*ptr) _old = (old); \ | 20 | static const uint32_t |
30 | - __atomic_compare_exchange_n(ptr, &_old, new, false, \ | 21 | -combiner_grp_to_gic_id[64-EXYNOS4210_MAX_EXT_COMBINER_OUT_IRQ][8] = { |
31 | + (void)__atomic_compare_exchange_n(ptr, &_old, new, false, \ | 22 | +combiner_grp_to_gic_id[64 - EXYNOS4210_MAX_EXT_COMBINER_OUT_IRQ][8] = { |
32 | __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); \ | 23 | /* int combiner groups 16-19 */ |
33 | _old; \ | 24 | { }, { }, { }, { }, |
34 | }) | 25 | /* int combiner group 20 */ |
35 | -- | 26 | -- |
36 | 2.17.0 | 27 | 2.25.1 |
37 | |||
38 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 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 | The instruction "ucvtf v0.4h, v04h, #2", with input 0x8000u, | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
4 | overflows the intermediate float16 to infinity before we have a | 10 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
5 | chance to scale the output. Use float64 as the intermediate type | 11 | Message-id: 20220404154658.565020-8-peter.maydell@linaro.org |
6 | so that no input argument (uint32_t in this case) can overflow | 12 | --- |
7 | or round before scaling. Given the declared argument, the signed | 13 | include/hw/arm/exynos4210.h | 4 - |
8 | int32_t function has the same problem. | 14 | hw/arm/exynos4210.c | 202 +++++++++++++++++++++++++++++++++++ |
15 | hw/intc/exynos4210_gic.c | 204 ------------------------------------ | ||
16 | 3 files changed, 202 insertions(+), 208 deletions(-) | ||
9 | 17 | ||
10 | When converting from float16 to integer, using u/int32_t instead | 18 | diff --git a/include/hw/arm/exynos4210.h b/include/hw/arm/exynos4210.h |
11 | of u/int16_t means that the bounding is incorrect. | ||
12 | |||
13 | Cc: qemu-stable@nongnu.org | ||
14 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | ||
15 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
16 | Message-id: 20180502221552.3873-4-richard.henderson@linaro.org | ||
17 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
18 | --- | ||
19 | target/arm/helper.h | 4 +-- | ||
20 | target/arm/helper.c | 53 ++++++++++++++++++++++++++++++++++++-- | ||
21 | target/arm/translate-a64.c | 4 +-- | ||
22 | 3 files changed, 55 insertions(+), 6 deletions(-) | ||
23 | |||
24 | diff --git a/target/arm/helper.h b/target/arm/helper.h | ||
25 | index XXXXXXX..XXXXXXX 100644 | 19 | index XXXXXXX..XXXXXXX 100644 |
26 | --- a/target/arm/helper.h | 20 | --- a/include/hw/arm/exynos4210.h |
27 | +++ b/target/arm/helper.h | 21 | +++ b/include/hw/arm/exynos4210.h |
28 | @@ -XXX,XX +XXX,XX @@ DEF_HELPER_3(vfp_toshd_round_to_zero, i64, f64, i32, ptr) | 22 | @@ -XXX,XX +XXX,XX @@ OBJECT_DECLARE_SIMPLE_TYPE(Exynos4210State, EXYNOS4210_SOC) |
29 | DEF_HELPER_3(vfp_tosld_round_to_zero, i64, f64, i32, ptr) | 23 | void exynos4210_write_secondary(ARMCPU *cpu, |
30 | DEF_HELPER_3(vfp_touhd_round_to_zero, i64, f64, i32, ptr) | 24 | const struct arm_boot_info *info); |
31 | DEF_HELPER_3(vfp_tould_round_to_zero, i64, f64, i32, ptr) | 25 | |
32 | -DEF_HELPER_3(vfp_toulh, i32, f16, i32, ptr) | 26 | -/* Initialize board IRQs. |
33 | -DEF_HELPER_3(vfp_toslh, i32, f16, i32, ptr) | 27 | - * These IRQs contain splitted Int/External Combiner and External Gic IRQs */ |
34 | +DEF_HELPER_3(vfp_touhh, i32, f16, i32, ptr) | 28 | -void exynos4210_init_board_irqs(Exynos4210State *s); |
35 | +DEF_HELPER_3(vfp_toshh, i32, f16, i32, ptr) | 29 | - |
36 | DEF_HELPER_3(vfp_toshs, i32, f32, i32, ptr) | 30 | /* Get IRQ number from exynos4210 IRQ subsystem stub. |
37 | DEF_HELPER_3(vfp_tosls, i32, f32, i32, ptr) | 31 | * To identify IRQ source use internal combiner group and bit number |
38 | DEF_HELPER_3(vfp_tosqs, i64, f32, i32, ptr) | 32 | * grp - group number |
39 | diff --git a/target/arm/helper.c b/target/arm/helper.c | 33 | diff --git a/hw/arm/exynos4210.c b/hw/arm/exynos4210.c |
40 | index XXXXXXX..XXXXXXX 100644 | 34 | index XXXXXXX..XXXXXXX 100644 |
41 | --- a/target/arm/helper.c | 35 | --- a/hw/arm/exynos4210.c |
42 | +++ b/target/arm/helper.c | 36 | +++ b/hw/arm/exynos4210.c |
43 | @@ -XXX,XX +XXX,XX @@ VFP_CONV_FIX_A64(sq, s, 32, 64, int64) | 37 | @@ -XXX,XX +XXX,XX @@ |
44 | VFP_CONV_FIX(uh, s, 32, 32, uint16) | 38 | #define EXYNOS4210_PL330_BASE1_ADDR 0x12690000 |
45 | VFP_CONV_FIX(ul, s, 32, 32, uint32) | 39 | #define EXYNOS4210_PL330_BASE2_ADDR 0x12850000 |
46 | VFP_CONV_FIX_A64(uq, s, 32, 64, uint64) | 40 | |
47 | -VFP_CONV_FIX_A64(sl, h, 16, 32, int32) | 41 | +enum ExtGicId { |
48 | -VFP_CONV_FIX_A64(ul, h, 16, 32, uint32) | 42 | + EXT_GIC_ID_MDMA_LCD0 = 66, |
49 | + | 43 | + EXT_GIC_ID_PDMA0, |
50 | #undef VFP_CONV_FIX | 44 | + EXT_GIC_ID_PDMA1, |
51 | #undef VFP_CONV_FIX_FLOAT | 45 | + EXT_GIC_ID_TIMER0, |
52 | #undef VFP_CONV_FLOAT_FIX_ROUND | 46 | + EXT_GIC_ID_TIMER1, |
53 | +#undef VFP_CONV_FIX_A64 | 47 | + EXT_GIC_ID_TIMER2, |
54 | + | 48 | + EXT_GIC_ID_TIMER3, |
55 | +/* Conversion to/from f16 can overflow to infinity before/after scaling. | 49 | + EXT_GIC_ID_TIMER4, |
56 | + * Therefore we convert to f64 (which does not round), scale, | 50 | + EXT_GIC_ID_MCT_L0, |
57 | + * and then convert f64 to f16 (which may round). | 51 | + EXT_GIC_ID_WDT, |
52 | + EXT_GIC_ID_RTC_ALARM, | ||
53 | + EXT_GIC_ID_RTC_TIC, | ||
54 | + EXT_GIC_ID_GPIO_XB, | ||
55 | + EXT_GIC_ID_GPIO_XA, | ||
56 | + EXT_GIC_ID_MCT_L1, | ||
57 | + EXT_GIC_ID_IEM_APC, | ||
58 | + EXT_GIC_ID_IEM_IEC, | ||
59 | + EXT_GIC_ID_NFC, | ||
60 | + EXT_GIC_ID_UART0, | ||
61 | + EXT_GIC_ID_UART1, | ||
62 | + EXT_GIC_ID_UART2, | ||
63 | + EXT_GIC_ID_UART3, | ||
64 | + EXT_GIC_ID_UART4, | ||
65 | + EXT_GIC_ID_MCT_G0, | ||
66 | + EXT_GIC_ID_I2C0, | ||
67 | + EXT_GIC_ID_I2C1, | ||
68 | + EXT_GIC_ID_I2C2, | ||
69 | + EXT_GIC_ID_I2C3, | ||
70 | + EXT_GIC_ID_I2C4, | ||
71 | + EXT_GIC_ID_I2C5, | ||
72 | + EXT_GIC_ID_I2C6, | ||
73 | + EXT_GIC_ID_I2C7, | ||
74 | + EXT_GIC_ID_SPI0, | ||
75 | + EXT_GIC_ID_SPI1, | ||
76 | + EXT_GIC_ID_SPI2, | ||
77 | + EXT_GIC_ID_MCT_G1, | ||
78 | + EXT_GIC_ID_USB_HOST, | ||
79 | + EXT_GIC_ID_USB_DEVICE, | ||
80 | + EXT_GIC_ID_MODEMIF, | ||
81 | + EXT_GIC_ID_HSMMC0, | ||
82 | + EXT_GIC_ID_HSMMC1, | ||
83 | + EXT_GIC_ID_HSMMC2, | ||
84 | + EXT_GIC_ID_HSMMC3, | ||
85 | + EXT_GIC_ID_SDMMC, | ||
86 | + EXT_GIC_ID_MIPI_CSI_4LANE, | ||
87 | + EXT_GIC_ID_MIPI_DSI_4LANE, | ||
88 | + EXT_GIC_ID_MIPI_CSI_2LANE, | ||
89 | + EXT_GIC_ID_MIPI_DSI_2LANE, | ||
90 | + EXT_GIC_ID_ONENAND_AUDI, | ||
91 | + EXT_GIC_ID_ROTATOR, | ||
92 | + EXT_GIC_ID_FIMC0, | ||
93 | + EXT_GIC_ID_FIMC1, | ||
94 | + EXT_GIC_ID_FIMC2, | ||
95 | + EXT_GIC_ID_FIMC3, | ||
96 | + EXT_GIC_ID_JPEG, | ||
97 | + EXT_GIC_ID_2D, | ||
98 | + EXT_GIC_ID_PCIe, | ||
99 | + EXT_GIC_ID_MIXER, | ||
100 | + EXT_GIC_ID_HDMI, | ||
101 | + EXT_GIC_ID_HDMI_I2C, | ||
102 | + EXT_GIC_ID_MFC, | ||
103 | + EXT_GIC_ID_TVENC, | ||
104 | +}; | ||
105 | + | ||
106 | +enum ExtInt { | ||
107 | + EXT_GIC_ID_EXTINT0 = 48, | ||
108 | + EXT_GIC_ID_EXTINT1, | ||
109 | + EXT_GIC_ID_EXTINT2, | ||
110 | + EXT_GIC_ID_EXTINT3, | ||
111 | + EXT_GIC_ID_EXTINT4, | ||
112 | + EXT_GIC_ID_EXTINT5, | ||
113 | + EXT_GIC_ID_EXTINT6, | ||
114 | + EXT_GIC_ID_EXTINT7, | ||
115 | + EXT_GIC_ID_EXTINT8, | ||
116 | + EXT_GIC_ID_EXTINT9, | ||
117 | + EXT_GIC_ID_EXTINT10, | ||
118 | + EXT_GIC_ID_EXTINT11, | ||
119 | + EXT_GIC_ID_EXTINT12, | ||
120 | + EXT_GIC_ID_EXTINT13, | ||
121 | + EXT_GIC_ID_EXTINT14, | ||
122 | + EXT_GIC_ID_EXTINT15 | ||
123 | +}; | ||
124 | + | ||
125 | +/* | ||
126 | + * External GIC sources which are not from External Interrupt Combiner or | ||
127 | + * External Interrupts are starting from EXYNOS4210_MAX_EXT_COMBINER_OUT_IRQ, | ||
128 | + * which is INTG16 in Internal Interrupt Combiner. | ||
58 | + */ | 129 | + */ |
59 | + | 130 | + |
60 | +static float16 do_postscale_fp16(float64 f, int shift, float_status *fpst) | 131 | +static const uint32_t |
132 | +combiner_grp_to_gic_id[64 - EXYNOS4210_MAX_EXT_COMBINER_OUT_IRQ][8] = { | ||
133 | + /* int combiner groups 16-19 */ | ||
134 | + { }, { }, { }, { }, | ||
135 | + /* int combiner group 20 */ | ||
136 | + { 0, EXT_GIC_ID_MDMA_LCD0 }, | ||
137 | + /* int combiner group 21 */ | ||
138 | + { EXT_GIC_ID_PDMA0, EXT_GIC_ID_PDMA1 }, | ||
139 | + /* int combiner group 22 */ | ||
140 | + { EXT_GIC_ID_TIMER0, EXT_GIC_ID_TIMER1, EXT_GIC_ID_TIMER2, | ||
141 | + EXT_GIC_ID_TIMER3, EXT_GIC_ID_TIMER4 }, | ||
142 | + /* int combiner group 23 */ | ||
143 | + { EXT_GIC_ID_RTC_ALARM, EXT_GIC_ID_RTC_TIC }, | ||
144 | + /* int combiner group 24 */ | ||
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) | ||
61 | +{ | 194 | +{ |
62 | + return float64_to_float16(float64_scalbn(f, -shift, fpst), true, fpst); | 195 | + uint32_t grp, bit, irq_id, n; |
63 | +} | 196 | + Exynos4210Irq *is = &s->irqs; |
64 | + | 197 | + |
65 | +float16 HELPER(vfp_sltoh)(uint32_t x, uint32_t shift, void *fpst) | 198 | + for (n = 0; n < EXYNOS4210_MAX_EXT_COMBINER_IN_IRQ; n++) { |
66 | +{ | 199 | + irq_id = 0; |
67 | + return do_postscale_fp16(int32_to_float64(x, fpst), shift, fpst); | 200 | + if (n == EXYNOS4210_COMBINER_GET_IRQ_NUM(1, 4) || |
68 | +} | 201 | + n == EXYNOS4210_COMBINER_GET_IRQ_NUM(12, 4)) { |
69 | + | 202 | + /* MCT_G0 is passed to External GIC */ |
70 | +float16 HELPER(vfp_ultoh)(uint32_t x, uint32_t shift, void *fpst) | 203 | + irq_id = EXT_GIC_ID_MCT_G0; |
71 | +{ | 204 | + } |
72 | + return do_postscale_fp16(uint32_to_float64(x, fpst), shift, fpst); | 205 | + if (n == EXYNOS4210_COMBINER_GET_IRQ_NUM(1, 5) || |
73 | +} | 206 | + n == EXYNOS4210_COMBINER_GET_IRQ_NUM(12, 5)) { |
74 | + | 207 | + /* MCT_G1 is passed to External and GIC */ |
75 | +static float64 do_prescale_fp16(float16 f, int shift, float_status *fpst) | 208 | + irq_id = EXT_GIC_ID_MCT_G1; |
76 | +{ | 209 | + } |
77 | + if (unlikely(float16_is_any_nan(f))) { | 210 | + if (irq_id) { |
78 | + float_raise(float_flag_invalid, fpst); | 211 | + s->irq_table[n] = qemu_irq_split(is->int_combiner_irq[n], |
79 | + return 0; | 212 | + is->ext_gic_irq[irq_id - 32]); |
80 | + } else { | 213 | + } else { |
81 | + int old_exc_flags = get_float_exception_flags(fpst); | 214 | + s->irq_table[n] = qemu_irq_split(is->int_combiner_irq[n], |
82 | + float64 ret; | 215 | + is->ext_combiner_irq[n]); |
83 | + | 216 | + } |
84 | + ret = float16_to_float64(f, true, fpst); | 217 | + } |
85 | + ret = float64_scalbn(ret, shift, fpst); | 218 | + for (; n < EXYNOS4210_MAX_INT_COMBINER_IN_IRQ; n++) { |
86 | + old_exc_flags |= get_float_exception_flags(fpst) | 219 | + /* these IDs are passed to Internal Combiner and External GIC */ |
87 | + & float_flag_input_denormal; | 220 | + grp = EXYNOS4210_COMBINER_GET_GRP_NUM(n); |
88 | + set_float_exception_flags(old_exc_flags, fpst); | 221 | + bit = EXYNOS4210_COMBINER_GET_BIT_NUM(n); |
89 | + | 222 | + irq_id = combiner_grp_to_gic_id[grp - |
90 | + return ret; | 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 | + } | ||
91 | + } | 229 | + } |
92 | +} | 230 | +} |
93 | + | 231 | + |
94 | +uint32_t HELPER(vfp_toshh)(float16 x, uint32_t shift, void *fpst) | 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) | ||
95 | +{ | 239 | +{ |
96 | + return float64_to_int16(do_prescale_fp16(x, shift, fpst), fpst); | 240 | + return EXYNOS4210_COMBINER_GET_IRQ_NUM(grp, bit); |
97 | +} | 241 | +} |
98 | + | 242 | + |
99 | +uint32_t HELPER(vfp_touhh)(float16 x, uint32_t shift, void *fpst) | 243 | static uint8_t chipid_and_omr[] = { 0x11, 0x02, 0x21, 0x43, |
100 | +{ | 244 | 0x09, 0x00, 0x00, 0x00 }; |
101 | + return float64_to_uint16(do_prescale_fp16(x, shift, fpst), fpst); | 245 | |
102 | +} | 246 | diff --git a/hw/intc/exynos4210_gic.c b/hw/intc/exynos4210_gic.c |
103 | |||
104 | /* Set the current fp rounding mode and return the old one. | ||
105 | * The argument is a softfloat float_round_ value. | ||
106 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c | ||
107 | index XXXXXXX..XXXXXXX 100644 | 247 | index XXXXXXX..XXXXXXX 100644 |
108 | --- a/target/arm/translate-a64.c | 248 | --- a/hw/intc/exynos4210_gic.c |
109 | +++ b/target/arm/translate-a64.c | 249 | +++ b/hw/intc/exynos4210_gic.c |
110 | @@ -XXX,XX +XXX,XX @@ static void handle_simd_shift_fpint_conv(DisasContext *s, bool is_scalar, | 250 | @@ -XXX,XX +XXX,XX @@ |
111 | switch (size) { | 251 | #include "hw/arm/exynos4210.h" |
112 | case MO_16: | 252 | #include "qom/object.h" |
113 | if (is_u) { | 253 | |
114 | - fn = gen_helper_vfp_toulh; | 254 | -enum ExtGicId { |
115 | + fn = gen_helper_vfp_touhh; | 255 | - EXT_GIC_ID_MDMA_LCD0 = 66, |
116 | } else { | 256 | - EXT_GIC_ID_PDMA0, |
117 | - fn = gen_helper_vfp_toslh; | 257 | - EXT_GIC_ID_PDMA1, |
118 | + fn = gen_helper_vfp_toshh; | 258 | - EXT_GIC_ID_TIMER0, |
119 | } | 259 | - EXT_GIC_ID_TIMER1, |
120 | break; | 260 | - EXT_GIC_ID_TIMER2, |
121 | case MO_32: | 261 | - EXT_GIC_ID_TIMER3, |
262 | - EXT_GIC_ID_TIMER4, | ||
263 | - EXT_GIC_ID_MCT_L0, | ||
264 | - EXT_GIC_ID_WDT, | ||
265 | - EXT_GIC_ID_RTC_ALARM, | ||
266 | - EXT_GIC_ID_RTC_TIC, | ||
267 | - EXT_GIC_ID_GPIO_XB, | ||
268 | - EXT_GIC_ID_GPIO_XA, | ||
269 | - EXT_GIC_ID_MCT_L1, | ||
270 | - EXT_GIC_ID_IEM_APC, | ||
271 | - EXT_GIC_ID_IEM_IEC, | ||
272 | - EXT_GIC_ID_NFC, | ||
273 | - EXT_GIC_ID_UART0, | ||
274 | - EXT_GIC_ID_UART1, | ||
275 | - EXT_GIC_ID_UART2, | ||
276 | - EXT_GIC_ID_UART3, | ||
277 | - EXT_GIC_ID_UART4, | ||
278 | - EXT_GIC_ID_MCT_G0, | ||
279 | - EXT_GIC_ID_I2C0, | ||
280 | - EXT_GIC_ID_I2C1, | ||
281 | - EXT_GIC_ID_I2C2, | ||
282 | - EXT_GIC_ID_I2C3, | ||
283 | - EXT_GIC_ID_I2C4, | ||
284 | - EXT_GIC_ID_I2C5, | ||
285 | - EXT_GIC_ID_I2C6, | ||
286 | - EXT_GIC_ID_I2C7, | ||
287 | - EXT_GIC_ID_SPI0, | ||
288 | - EXT_GIC_ID_SPI1, | ||
289 | - EXT_GIC_ID_SPI2, | ||
290 | - EXT_GIC_ID_MCT_G1, | ||
291 | - EXT_GIC_ID_USB_HOST, | ||
292 | - EXT_GIC_ID_USB_DEVICE, | ||
293 | - EXT_GIC_ID_MODEMIF, | ||
294 | - EXT_GIC_ID_HSMMC0, | ||
295 | - EXT_GIC_ID_HSMMC1, | ||
296 | - EXT_GIC_ID_HSMMC2, | ||
297 | - EXT_GIC_ID_HSMMC3, | ||
298 | - EXT_GIC_ID_SDMMC, | ||
299 | - EXT_GIC_ID_MIPI_CSI_4LANE, | ||
300 | - EXT_GIC_ID_MIPI_DSI_4LANE, | ||
301 | - EXT_GIC_ID_MIPI_CSI_2LANE, | ||
302 | - EXT_GIC_ID_MIPI_DSI_2LANE, | ||
303 | - EXT_GIC_ID_ONENAND_AUDI, | ||
304 | - EXT_GIC_ID_ROTATOR, | ||
305 | - EXT_GIC_ID_FIMC0, | ||
306 | - EXT_GIC_ID_FIMC1, | ||
307 | - EXT_GIC_ID_FIMC2, | ||
308 | - EXT_GIC_ID_FIMC3, | ||
309 | - EXT_GIC_ID_JPEG, | ||
310 | - EXT_GIC_ID_2D, | ||
311 | - EXT_GIC_ID_PCIe, | ||
312 | - EXT_GIC_ID_MIXER, | ||
313 | - EXT_GIC_ID_HDMI, | ||
314 | - EXT_GIC_ID_HDMI_I2C, | ||
315 | - EXT_GIC_ID_MFC, | ||
316 | - EXT_GIC_ID_TVENC, | ||
317 | -}; | ||
318 | - | ||
319 | -enum ExtInt { | ||
320 | - EXT_GIC_ID_EXTINT0 = 48, | ||
321 | - EXT_GIC_ID_EXTINT1, | ||
322 | - EXT_GIC_ID_EXTINT2, | ||
323 | - EXT_GIC_ID_EXTINT3, | ||
324 | - EXT_GIC_ID_EXTINT4, | ||
325 | - EXT_GIC_ID_EXTINT5, | ||
326 | - EXT_GIC_ID_EXTINT6, | ||
327 | - EXT_GIC_ID_EXTINT7, | ||
328 | - EXT_GIC_ID_EXTINT8, | ||
329 | - EXT_GIC_ID_EXTINT9, | ||
330 | - EXT_GIC_ID_EXTINT10, | ||
331 | - EXT_GIC_ID_EXTINT11, | ||
332 | - EXT_GIC_ID_EXTINT12, | ||
333 | - EXT_GIC_ID_EXTINT13, | ||
334 | - EXT_GIC_ID_EXTINT14, | ||
335 | - EXT_GIC_ID_EXTINT15 | ||
336 | -}; | ||
337 | - | ||
338 | -/* | ||
339 | - * External GIC sources which are not from External Interrupt Combiner or | ||
340 | - * External Interrupts are starting from EXYNOS4210_MAX_EXT_COMBINER_OUT_IRQ, | ||
341 | - * which is INTG16 in Internal Interrupt Combiner. | ||
342 | - */ | ||
343 | - | ||
344 | -static const uint32_t | ||
345 | -combiner_grp_to_gic_id[64 - EXYNOS4210_MAX_EXT_COMBINER_OUT_IRQ][8] = { | ||
346 | - /* int combiner groups 16-19 */ | ||
347 | - { }, { }, { }, { }, | ||
348 | - /* int combiner group 20 */ | ||
349 | - { 0, EXT_GIC_ID_MDMA_LCD0 }, | ||
350 | - /* int combiner group 21 */ | ||
351 | - { EXT_GIC_ID_PDMA0, EXT_GIC_ID_PDMA1 }, | ||
352 | - /* int combiner group 22 */ | ||
353 | - { EXT_GIC_ID_TIMER0, EXT_GIC_ID_TIMER1, EXT_GIC_ID_TIMER2, | ||
354 | - EXT_GIC_ID_TIMER3, EXT_GIC_ID_TIMER4 }, | ||
355 | - /* int combiner group 23 */ | ||
356 | - { EXT_GIC_ID_RTC_ALARM, EXT_GIC_ID_RTC_TIC }, | ||
357 | - /* int combiner group 24 */ | ||
358 | - { EXT_GIC_ID_GPIO_XB, EXT_GIC_ID_GPIO_XA }, | ||
359 | - /* int combiner group 25 */ | ||
360 | - { EXT_GIC_ID_IEM_APC, EXT_GIC_ID_IEM_IEC }, | ||
361 | - /* int combiner group 26 */ | ||
362 | - { EXT_GIC_ID_UART0, EXT_GIC_ID_UART1, EXT_GIC_ID_UART2, EXT_GIC_ID_UART3, | ||
363 | - EXT_GIC_ID_UART4 }, | ||
364 | - /* int combiner group 27 */ | ||
365 | - { EXT_GIC_ID_I2C0, EXT_GIC_ID_I2C1, EXT_GIC_ID_I2C2, EXT_GIC_ID_I2C3, | ||
366 | - EXT_GIC_ID_I2C4, EXT_GIC_ID_I2C5, EXT_GIC_ID_I2C6, | ||
367 | - EXT_GIC_ID_I2C7 }, | ||
368 | - /* int combiner group 28 */ | ||
369 | - { EXT_GIC_ID_SPI0, EXT_GIC_ID_SPI1, EXT_GIC_ID_SPI2 , EXT_GIC_ID_USB_HOST}, | ||
370 | - /* int combiner group 29 */ | ||
371 | - { EXT_GIC_ID_HSMMC0, EXT_GIC_ID_HSMMC1, EXT_GIC_ID_HSMMC2, | ||
372 | - EXT_GIC_ID_HSMMC3, EXT_GIC_ID_SDMMC }, | ||
373 | - /* int combiner group 30 */ | ||
374 | - { EXT_GIC_ID_MIPI_CSI_4LANE, EXT_GIC_ID_MIPI_CSI_2LANE }, | ||
375 | - /* int combiner group 31 */ | ||
376 | - { EXT_GIC_ID_MIPI_DSI_4LANE, EXT_GIC_ID_MIPI_DSI_2LANE }, | ||
377 | - /* int combiner group 32 */ | ||
378 | - { EXT_GIC_ID_FIMC0, EXT_GIC_ID_FIMC1 }, | ||
379 | - /* int combiner group 33 */ | ||
380 | - { EXT_GIC_ID_FIMC2, EXT_GIC_ID_FIMC3 }, | ||
381 | - /* int combiner group 34 */ | ||
382 | - { EXT_GIC_ID_ONENAND_AUDI, EXT_GIC_ID_NFC }, | ||
383 | - /* int combiner group 35 */ | ||
384 | - { 0, 0, 0, EXT_GIC_ID_MCT_L1, EXT_GIC_ID_MCT_G0, EXT_GIC_ID_MCT_G1 }, | ||
385 | - /* int combiner group 36 */ | ||
386 | - { EXT_GIC_ID_MIXER }, | ||
387 | - /* int combiner group 37 */ | ||
388 | - { EXT_GIC_ID_EXTINT4, EXT_GIC_ID_EXTINT5, EXT_GIC_ID_EXTINT6, | ||
389 | - EXT_GIC_ID_EXTINT7 }, | ||
390 | - /* groups 38-50 */ | ||
391 | - { }, { }, { }, { }, { }, { }, { }, { }, { }, { }, { }, { }, { }, | ||
392 | - /* int combiner group 51 */ | ||
393 | - { EXT_GIC_ID_MCT_L0, 0, 0, 0, EXT_GIC_ID_MCT_G0, EXT_GIC_ID_MCT_G1 }, | ||
394 | - /* group 52 */ | ||
395 | - { }, | ||
396 | - /* int combiner group 53 */ | ||
397 | - { EXT_GIC_ID_WDT, 0, 0, 0, EXT_GIC_ID_MCT_G0, EXT_GIC_ID_MCT_G1 }, | ||
398 | - /* groups 54-63 */ | ||
399 | - { }, { }, { }, { }, { }, { }, { }, { }, { }, { } | ||
400 | -}; | ||
401 | - | ||
402 | #define EXYNOS4210_GIC_NIRQ 160 | ||
403 | |||
404 | #define EXYNOS4210_EXT_GIC_CPU_REGION_SIZE 0x10000 | ||
405 | @@ -XXX,XX +XXX,XX @@ combiner_grp_to_gic_id[64 - EXYNOS4210_MAX_EXT_COMBINER_OUT_IRQ][8] = { | ||
406 | #define EXYNOS4210_GIC_CPU_REGION_SIZE 0x100 | ||
407 | #define EXYNOS4210_GIC_DIST_REGION_SIZE 0x1000 | ||
408 | |||
409 | -/* | ||
410 | - * Initialize board IRQs. | ||
411 | - * These IRQs contain splitted Int/External Combiner and External Gic IRQs. | ||
412 | - */ | ||
413 | -void exynos4210_init_board_irqs(Exynos4210State *s) | ||
414 | -{ | ||
415 | - uint32_t grp, bit, irq_id, n; | ||
416 | - Exynos4210Irq *is = &s->irqs; | ||
417 | - | ||
418 | - for (n = 0; n < EXYNOS4210_MAX_EXT_COMBINER_IN_IRQ; n++) { | ||
419 | - irq_id = 0; | ||
420 | - if (n == EXYNOS4210_COMBINER_GET_IRQ_NUM(1, 4) || | ||
421 | - n == EXYNOS4210_COMBINER_GET_IRQ_NUM(12, 4)) { | ||
422 | - /* MCT_G0 is passed to External GIC */ | ||
423 | - irq_id = EXT_GIC_ID_MCT_G0; | ||
424 | - } | ||
425 | - if (n == EXYNOS4210_COMBINER_GET_IRQ_NUM(1, 5) || | ||
426 | - n == EXYNOS4210_COMBINER_GET_IRQ_NUM(12, 5)) { | ||
427 | - /* MCT_G1 is passed to External and GIC */ | ||
428 | - irq_id = EXT_GIC_ID_MCT_G1; | ||
429 | - } | ||
430 | - if (irq_id) { | ||
431 | - s->irq_table[n] = qemu_irq_split(is->int_combiner_irq[n], | ||
432 | - is->ext_gic_irq[irq_id - 32]); | ||
433 | - } else { | ||
434 | - s->irq_table[n] = qemu_irq_split(is->int_combiner_irq[n], | ||
435 | - is->ext_combiner_irq[n]); | ||
436 | - } | ||
437 | - } | ||
438 | - for (; n < EXYNOS4210_MAX_INT_COMBINER_IN_IRQ; n++) { | ||
439 | - /* these IDs are passed to Internal Combiner and External GIC */ | ||
440 | - grp = EXYNOS4210_COMBINER_GET_GRP_NUM(n); | ||
441 | - bit = EXYNOS4210_COMBINER_GET_BIT_NUM(n); | ||
442 | - irq_id = combiner_grp_to_gic_id[grp - | ||
443 | - EXYNOS4210_MAX_EXT_COMBINER_OUT_IRQ][bit]; | ||
444 | - | ||
445 | - if (irq_id) { | ||
446 | - s->irq_table[n] = qemu_irq_split(is->int_combiner_irq[n], | ||
447 | - is->ext_gic_irq[irq_id - 32]); | ||
448 | - } | ||
449 | - } | ||
450 | -} | ||
451 | - | ||
452 | -/* | ||
453 | - * Get IRQ number from exynos4210 IRQ subsystem stub. | ||
454 | - * To identify IRQ source use internal combiner group and bit number | ||
455 | - * grp - group number | ||
456 | - * bit - bit number inside group | ||
457 | - */ | ||
458 | -uint32_t exynos4210_get_irq(uint32_t grp, uint32_t bit) | ||
459 | -{ | ||
460 | - return EXYNOS4210_COMBINER_GET_IRQ_NUM(grp, bit); | ||
461 | -} | ||
462 | - | ||
463 | -/********* GIC part *********/ | ||
464 | - | ||
465 | #define TYPE_EXYNOS4210_GIC "exynos4210.gic" | ||
466 | OBJECT_DECLARE_SIMPLE_TYPE(Exynos4210GicState, EXYNOS4210_GIC) | ||
467 | |||
122 | -- | 468 | -- |
123 | 2.17.0 | 469 | 2.25.1 |
124 | |||
125 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 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 | This implements all of the v8.1-Atomics instructions except | 5 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
4 | for compare-and-swap, which is decoded elsewhere. | 6 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
7 | Message-id: 20220404154658.565020-9-peter.maydell@linaro.org | ||
8 | --- | ||
9 | include/hw/arm/exynos4210.h | 2 ++ | ||
10 | include/hw/intc/exynos4210_gic.h | 43 ++++++++++++++++++++++++++++++++ | ||
11 | hw/arm/exynos4210.c | 10 ++++---- | ||
12 | hw/intc/exynos4210_gic.c | 17 ++----------- | ||
13 | MAINTAINERS | 2 +- | ||
14 | 5 files changed, 53 insertions(+), 21 deletions(-) | ||
15 | create mode 100644 include/hw/intc/exynos4210_gic.h | ||
5 | 16 | ||
6 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 17 | 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: 20180508151437.4232-9-richard.henderson@linaro.org | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | --- | ||
11 | target/arm/translate-a64.c | 38 ++++++++++++++++++++++++++++++++++++-- | ||
12 | 1 file changed, 36 insertions(+), 2 deletions(-) | ||
13 | |||
14 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c | ||
15 | index XXXXXXX..XXXXXXX 100644 | 18 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/target/arm/translate-a64.c | 19 | --- a/include/hw/arm/exynos4210.h |
17 | +++ b/target/arm/translate-a64.c | 20 | +++ b/include/hw/arm/exynos4210.h |
18 | @@ -XXX,XX +XXX,XX @@ typedef void NeonGenOneOpFn(TCGv_i64, TCGv_i64); | 21 | @@ -XXX,XX +XXX,XX @@ |
19 | typedef void CryptoTwoOpFn(TCGv_ptr, TCGv_ptr); | 22 | #include "hw/or-irq.h" |
20 | typedef void CryptoThreeOpIntFn(TCGv_ptr, TCGv_ptr, TCGv_i32); | 23 | #include "hw/sysbus.h" |
21 | typedef void CryptoThreeOpFn(TCGv_ptr, TCGv_ptr, TCGv_ptr); | 24 | #include "hw/cpu/a9mpcore.h" |
22 | +typedef void AtomicThreeOpFn(TCGv_i64, TCGv_i64, TCGv_i64, TCGArg, TCGMemOp); | 25 | +#include "hw/intc/exynos4210_gic.h" |
23 | 26 | #include "target/arm/cpu-qom.h" | |
24 | /* Note that the gvec expanders operate on offsets + sizes. */ | 27 | #include "qom/object.h" |
25 | typedef void GVecGen2Fn(unsigned, uint32_t, uint32_t, uint32_t, uint32_t); | 28 | |
26 | @@ -XXX,XX +XXX,XX @@ static void disas_ldst_atomic(DisasContext *s, uint32_t insn, | 29 | @@ -XXX,XX +XXX,XX @@ struct Exynos4210State { |
27 | int rn = extract32(insn, 5, 5); | 30 | qemu_or_irq pl330_irq_orgate[EXYNOS4210_NUM_DMA]; |
28 | int o3_opc = extract32(insn, 12, 4); | 31 | qemu_or_irq cpu_irq_orgate[EXYNOS4210_NCPUS]; |
29 | int feature = ARM_FEATURE_V8_ATOMICS; | 32 | A9MPPrivState a9mpcore; |
30 | + TCGv_i64 tcg_rn, tcg_rs; | 33 | + Exynos4210GicState ext_gic; |
31 | + AtomicThreeOpFn *fn; | 34 | }; |
32 | 35 | ||
33 | if (is_vector) { | 36 | #define TYPE_EXYNOS4210_SOC "exynos4210" |
34 | unallocated_encoding(s); | 37 | diff --git a/include/hw/intc/exynos4210_gic.h b/include/hw/intc/exynos4210_gic.h |
35 | @@ -XXX,XX +XXX,XX @@ static void disas_ldst_atomic(DisasContext *s, uint32_t insn, | 38 | new file mode 100644 |
39 | index XXXXXXX..XXXXXXX | ||
40 | --- /dev/null | ||
41 | +++ b/include/hw/intc/exynos4210_gic.h | ||
42 | @@ -XXX,XX +XXX,XX @@ | ||
43 | +/* | ||
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 | ||
66 | + | ||
67 | +#include "hw/sysbus.h" | ||
68 | + | ||
69 | +#define TYPE_EXYNOS4210_GIC "exynos4210.gic" | ||
70 | +OBJECT_DECLARE_SIMPLE_TYPE(Exynos4210GicState, EXYNOS4210_GIC) | ||
71 | + | ||
72 | +#define EXYNOS4210_GIC_NCPUS 2 | ||
73 | + | ||
74 | +struct Exynos4210GicState { | ||
75 | + SysBusDevice parent_obj; | ||
76 | + | ||
77 | + MemoryRegion cpu_container; | ||
78 | + MemoryRegion dist_container; | ||
79 | + MemoryRegion cpu_alias[EXYNOS4210_GIC_NCPUS]; | ||
80 | + MemoryRegion dist_alias[EXYNOS4210_GIC_NCPUS]; | ||
81 | + uint32_t num_cpu; | ||
82 | + DeviceState *gic; | ||
83 | +}; | ||
84 | + | ||
85 | +#endif | ||
86 | diff --git a/hw/arm/exynos4210.c b/hw/arm/exynos4210.c | ||
87 | index XXXXXXX..XXXXXXX 100644 | ||
88 | --- a/hw/arm/exynos4210.c | ||
89 | +++ b/hw/arm/exynos4210.c | ||
90 | @@ -XXX,XX +XXX,XX @@ static void exynos4210_realize(DeviceState *socdev, Error **errp) | ||
91 | sysbus_create_simple("l2x0", EXYNOS4210_L2X0_BASE_ADDR, NULL); | ||
92 | |||
93 | /* External GIC */ | ||
94 | - dev = qdev_new("exynos4210.gic"); | ||
95 | - qdev_prop_set_uint32(dev, "num-cpu", EXYNOS4210_NCPUS); | ||
96 | - busdev = SYS_BUS_DEVICE(dev); | ||
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)); | ||
36 | } | 106 | } |
37 | switch (o3_opc) { | 107 | for (n = 0; n < EXYNOS4210_EXT_GIC_NIRQ; n++) { |
38 | case 000: /* LDADD */ | 108 | - s->irqs.ext_gic_irq[n] = qdev_get_gpio_in(dev, n); |
39 | + fn = tcg_gen_atomic_fetch_add_i64; | 109 | + s->irqs.ext_gic_irq[n] = qdev_get_gpio_in(DEVICE(&s->ext_gic), n); |
40 | + break; | ||
41 | case 001: /* LDCLR */ | ||
42 | + fn = tcg_gen_atomic_fetch_and_i64; | ||
43 | + break; | ||
44 | case 002: /* LDEOR */ | ||
45 | + fn = tcg_gen_atomic_fetch_xor_i64; | ||
46 | + break; | ||
47 | case 003: /* LDSET */ | ||
48 | + fn = tcg_gen_atomic_fetch_or_i64; | ||
49 | + break; | ||
50 | case 004: /* LDSMAX */ | ||
51 | + fn = tcg_gen_atomic_fetch_smax_i64; | ||
52 | + break; | ||
53 | case 005: /* LDSMIN */ | ||
54 | + fn = tcg_gen_atomic_fetch_smin_i64; | ||
55 | + break; | ||
56 | case 006: /* LDUMAX */ | ||
57 | + fn = tcg_gen_atomic_fetch_umax_i64; | ||
58 | + break; | ||
59 | case 007: /* LDUMIN */ | ||
60 | + fn = tcg_gen_atomic_fetch_umin_i64; | ||
61 | + break; | ||
62 | case 010: /* SWP */ | ||
63 | + fn = tcg_gen_atomic_xchg_i64; | ||
64 | + break; | ||
65 | default: | ||
66 | unallocated_encoding(s); | ||
67 | return; | ||
68 | @@ -XXX,XX +XXX,XX @@ static void disas_ldst_atomic(DisasContext *s, uint32_t insn, | ||
69 | return; | ||
70 | } | 110 | } |
71 | 111 | ||
72 | - (void)rs; | 112 | /* Internal Interrupt Combiner */ |
73 | - (void)rn; | 113 | @@ -XXX,XX +XXX,XX @@ static void exynos4210_init(Object *obj) |
74 | + if (rn == 31) { | 114 | } |
75 | + gen_check_sp_alignment(s); | 115 | |
76 | + } | 116 | object_initialize_child(obj, "a9mpcore", &s->a9mpcore, TYPE_A9MPCORE_PRIV); |
77 | + tcg_rn = cpu_reg_sp(s, rn); | 117 | + object_initialize_child(obj, "ext-gic", &s->ext_gic, TYPE_EXYNOS4210_GIC); |
78 | + tcg_rs = read_cpu_reg(s, rs, true); | ||
79 | + | ||
80 | + if (o3_opc == 1) { /* LDCLR */ | ||
81 | + tcg_gen_not_i64(tcg_rs, tcg_rs); | ||
82 | + } | ||
83 | + | ||
84 | + /* The tcg atomic primitives are all full barriers. Therefore we | ||
85 | + * can ignore the Acquire and Release bits of this instruction. | ||
86 | + */ | ||
87 | + fn(cpu_reg(s, rt), tcg_rn, tcg_rs, get_mem_index(s), | ||
88 | + s->be_data | size | MO_ALIGN); | ||
89 | } | 118 | } |
90 | 119 | ||
91 | /* Load/store register (all forms) */ | 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); | ||
163 | diff --git a/MAINTAINERS b/MAINTAINERS | ||
164 | index XXXXXXX..XXXXXXX 100644 | ||
165 | --- a/MAINTAINERS | ||
166 | +++ b/MAINTAINERS | ||
167 | @@ -XXX,XX +XXX,XX @@ M: Peter Maydell <peter.maydell@linaro.org> | ||
168 | L: qemu-arm@nongnu.org | ||
169 | S: Odd Fixes | ||
170 | F: hw/*/exynos* | ||
171 | -F: include/hw/arm/exynos4210.h | ||
172 | +F: include/hw/*/exynos* | ||
173 | |||
174 | Calxeda Highbank | ||
175 | M: Rob Herring <robh@kernel.org> | ||
92 | -- | 176 | -- |
93 | 2.17.0 | 177 | 2.25.1 |
94 | |||
95 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | The only time we use the ext_gic_irq[] array in the Exynos4210Irq | ||
2 | struct is during realize of the SoC -- we initialize it with the | ||
3 | input IRQs of the external GIC device, and then connect those to | ||
4 | outputs of other devices further on in realize (including in the | ||
5 | exynos4210_init_board_irqs() function). Now that the ext_gic object | ||
6 | is easily accessible as s->ext_gic we can make the connections | ||
7 | directly from one device to the other without going via this array. | ||
1 | 8 | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
11 | Message-id: 20220404154658.565020-10-peter.maydell@linaro.org | ||
12 | --- | ||
13 | include/hw/arm/exynos4210.h | 1 - | ||
14 | hw/arm/exynos4210.c | 12 ++++++------ | ||
15 | 2 files changed, 6 insertions(+), 7 deletions(-) | ||
16 | |||
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 | typedef struct Exynos4210Irq { | ||
23 | qemu_irq int_combiner_irq[EXYNOS4210_MAX_INT_COMBINER_IN_IRQ]; | ||
24 | qemu_irq ext_combiner_irq[EXYNOS4210_MAX_EXT_COMBINER_IN_IRQ]; | ||
25 | - qemu_irq ext_gic_irq[EXYNOS4210_EXT_GIC_NIRQ]; | ||
26 | } Exynos4210Irq; | ||
27 | |||
28 | struct Exynos4210State { | ||
29 | diff --git a/hw/arm/exynos4210.c b/hw/arm/exynos4210.c | ||
30 | index XXXXXXX..XXXXXXX 100644 | ||
31 | --- a/hw/arm/exynos4210.c | ||
32 | +++ b/hw/arm/exynos4210.c | ||
33 | @@ -XXX,XX +XXX,XX @@ static void exynos4210_init_board_irqs(Exynos4210State *s) | ||
34 | { | ||
35 | uint32_t grp, bit, irq_id, n; | ||
36 | Exynos4210Irq *is = &s->irqs; | ||
37 | + DeviceState *extgicdev = DEVICE(&s->ext_gic); | ||
38 | |||
39 | for (n = 0; n < EXYNOS4210_MAX_EXT_COMBINER_IN_IRQ; n++) { | ||
40 | irq_id = 0; | ||
41 | @@ -XXX,XX +XXX,XX @@ static void exynos4210_init_board_irqs(Exynos4210State *s) | ||
42 | } | ||
43 | if (irq_id) { | ||
44 | s->irq_table[n] = qemu_irq_split(is->int_combiner_irq[n], | ||
45 | - is->ext_gic_irq[irq_id - 32]); | ||
46 | + qdev_get_gpio_in(extgicdev, | ||
47 | + irq_id - 32)); | ||
48 | } else { | ||
49 | s->irq_table[n] = qemu_irq_split(is->int_combiner_irq[n], | ||
50 | is->ext_combiner_irq[n]); | ||
51 | @@ -XXX,XX +XXX,XX @@ static void exynos4210_init_board_irqs(Exynos4210State *s) | ||
52 | |||
53 | if (irq_id) { | ||
54 | s->irq_table[n] = qemu_irq_split(is->int_combiner_irq[n], | ||
55 | - is->ext_gic_irq[irq_id - 32]); | ||
56 | + qdev_get_gpio_in(extgicdev, | ||
57 | + irq_id - 32)); | ||
58 | } | ||
59 | } | ||
60 | } | ||
61 | @@ -XXX,XX +XXX,XX @@ static void exynos4210_realize(DeviceState *socdev, Error **errp) | ||
62 | sysbus_connect_irq(busdev, n, | ||
63 | qdev_get_gpio_in(DEVICE(&s->cpu_irq_orgate[n]), 1)); | ||
64 | } | ||
65 | - for (n = 0; n < EXYNOS4210_EXT_GIC_NIRQ; n++) { | ||
66 | - s->irqs.ext_gic_irq[n] = qdev_get_gpio_in(DEVICE(&s->ext_gic), n); | ||
67 | - } | ||
68 | |||
69 | /* Internal Interrupt Combiner */ | ||
70 | dev = qdev_new("exynos4210.combiner"); | ||
71 | @@ -XXX,XX +XXX,XX @@ static void exynos4210_realize(DeviceState *socdev, Error **errp) | ||
72 | busdev = SYS_BUS_DEVICE(dev); | ||
73 | sysbus_realize_and_unref(busdev, &error_fatal); | ||
74 | for (n = 0; n < EXYNOS4210_MAX_INT_COMBINER_OUT_IRQ; n++) { | ||
75 | - sysbus_connect_irq(busdev, n, s->irqs.ext_gic_irq[n]); | ||
76 | + sysbus_connect_irq(busdev, n, qdev_get_gpio_in(DEVICE(&s->ext_gic), n)); | ||
77 | } | ||
78 | exynos4210_combiner_get_gpioin(&s->irqs, dev, 1); | ||
79 | sysbus_mmio_map(busdev, 0, EXYNOS4210_EXT_COMBINER_BASE_ADDR); | ||
80 | -- | ||
81 | 2.25.1 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | The function exynos4210_combiner_get_gpioin() currently lives in |
---|---|---|---|
2 | exynos4210_combiner.c, but it isn't really part of the combiner | ||
3 | device itself -- it is a function that implements the wiring up of | ||
4 | some interrupt sources to multiple combiner inputs. Move it to live | ||
5 | with the other SoC-level code in exynos4210.c, along with a few | ||
6 | macros previously defined in exynos4210.h which are now used only | ||
7 | in exynos4210.c. | ||
2 | 8 | ||
3 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
4 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
5 | Message-id: 20180508151437.4232-10-richard.henderson@linaro.org | ||
6 | 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-11-peter.maydell@linaro.org | ||
7 | --- | 12 | --- |
8 | target/arm/helper-a64.h | 2 + | 13 | include/hw/arm/exynos4210.h | 11 ----- |
9 | target/arm/helper-a64.c | 43 ++++++++++++++ | 14 | hw/arm/exynos4210.c | 82 +++++++++++++++++++++++++++++++++++ |
10 | target/arm/translate-a64.c | 119 ++++++++++++++++++++++++++++++++++++- | 15 | hw/intc/exynos4210_combiner.c | 77 -------------------------------- |
11 | 3 files changed, 161 insertions(+), 3 deletions(-) | 16 | 3 files changed, 82 insertions(+), 88 deletions(-) |
12 | 17 | ||
13 | diff --git a/target/arm/helper-a64.h b/target/arm/helper-a64.h | 18 | diff --git a/include/hw/arm/exynos4210.h b/include/hw/arm/exynos4210.h |
14 | index XXXXXXX..XXXXXXX 100644 | 19 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/target/arm/helper-a64.h | 20 | --- a/include/hw/arm/exynos4210.h |
16 | +++ b/target/arm/helper-a64.h | 21 | +++ b/include/hw/arm/exynos4210.h |
17 | @@ -XXX,XX +XXX,XX @@ DEF_HELPER_FLAGS_4(paired_cmpxchg64_le_parallel, TCG_CALL_NO_WG, | 22 | @@ -XXX,XX +XXX,XX @@ |
18 | DEF_HELPER_FLAGS_4(paired_cmpxchg64_be, TCG_CALL_NO_WG, i64, env, i64, i64, i64) | 23 | #define EXYNOS4210_MAX_EXT_COMBINER_IN_IRQ \ |
19 | DEF_HELPER_FLAGS_4(paired_cmpxchg64_be_parallel, TCG_CALL_NO_WG, | 24 | (EXYNOS4210_MAX_EXT_COMBINER_OUT_IRQ * 8) |
20 | i64, env, i64, i64, i64) | 25 | |
21 | +DEF_HELPER_5(casp_le_parallel, void, env, i32, i64, i64, i64) | 26 | -#define EXYNOS4210_COMBINER_GET_IRQ_NUM(grp, bit) ((grp)*8 + (bit)) |
22 | +DEF_HELPER_5(casp_be_parallel, void, env, i32, i64, i64, i64) | 27 | -#define EXYNOS4210_COMBINER_GET_GRP_NUM(irq) ((irq) / 8) |
23 | DEF_HELPER_FLAGS_3(advsimd_maxh, TCG_CALL_NO_RWG, f16, f16, f16, ptr) | 28 | -#define EXYNOS4210_COMBINER_GET_BIT_NUM(irq) \ |
24 | DEF_HELPER_FLAGS_3(advsimd_minh, TCG_CALL_NO_RWG, f16, f16, f16, ptr) | 29 | - ((irq) - 8 * EXYNOS4210_COMBINER_GET_GRP_NUM(irq)) |
25 | DEF_HELPER_FLAGS_3(advsimd_maxnumh, TCG_CALL_NO_RWG, f16, f16, f16, ptr) | 30 | - |
26 | diff --git a/target/arm/helper-a64.c b/target/arm/helper-a64.c | 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 | ||
27 | index XXXXXXX..XXXXXXX 100644 | 48 | index XXXXXXX..XXXXXXX 100644 |
28 | --- a/target/arm/helper-a64.c | 49 | --- a/hw/arm/exynos4210.c |
29 | +++ b/target/arm/helper-a64.c | 50 | +++ b/hw/arm/exynos4210.c |
30 | @@ -XXX,XX +XXX,XX @@ uint64_t HELPER(paired_cmpxchg64_be_parallel)(CPUARMState *env, uint64_t addr, | 51 | @@ -XXX,XX +XXX,XX @@ combiner_grp_to_gic_id[64 - EXYNOS4210_MAX_EXT_COMBINER_OUT_IRQ][8] = { |
31 | return do_paired_cmpxchg64_be(env, addr, new_lo, new_hi, true, GETPC()); | 52 | { }, { }, { }, { }, { }, { }, { }, { }, { }, { } |
53 | }; | ||
54 | |||
55 | +#define EXYNOS4210_COMBINER_GET_IRQ_NUM(grp, bit) ((grp) * 8 + (bit)) | ||
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 | + | ||
60 | /* | ||
61 | * Initialize board IRQs. | ||
62 | * These IRQs contain splitted Int/External Combiner and External Gic IRQs. | ||
63 | @@ -XXX,XX +XXX,XX @@ uint32_t exynos4210_get_irq(uint32_t grp, uint32_t bit) | ||
64 | return EXYNOS4210_COMBINER_GET_IRQ_NUM(grp, bit); | ||
32 | } | 65 | } |
33 | 66 | ||
34 | +/* Writes back the old data into Rs. */ | 67 | +/* |
35 | +void HELPER(casp_le_parallel)(CPUARMState *env, uint32_t rs, uint64_t addr, | 68 | + * Get Combiner input GPIO into irqs structure |
36 | + uint64_t new_lo, uint64_t new_hi) | 69 | + */ |
70 | +static void exynos4210_combiner_get_gpioin(Exynos4210Irq *irqs, | ||
71 | + DeviceState *dev, int ext) | ||
37 | +{ | 72 | +{ |
38 | + uintptr_t ra = GETPC(); | 73 | + int n; |
39 | +#ifndef CONFIG_ATOMIC128 | 74 | + int bit; |
40 | + cpu_loop_exit_atomic(ENV_GET_CPU(env), ra); | 75 | + int max; |
41 | +#else | 76 | + qemu_irq *irq; |
42 | + Int128 oldv, cmpv, newv; | 77 | + |
43 | + | 78 | + max = ext ? EXYNOS4210_MAX_EXT_COMBINER_IN_IRQ : |
44 | + cmpv = int128_make128(env->xregs[rs], env->xregs[rs + 1]); | 79 | + EXYNOS4210_MAX_INT_COMBINER_IN_IRQ; |
45 | + newv = int128_make128(new_lo, new_hi); | 80 | + irq = ext ? irqs->ext_combiner_irq : irqs->int_combiner_irq; |
46 | + | 81 | + |
47 | + int mem_idx = cpu_mmu_index(env, false); | 82 | + /* |
48 | + TCGMemOpIdx oi = make_memop_idx(MO_LEQ | MO_ALIGN_16, mem_idx); | 83 | + * Some IRQs of Int/External Combiner are going to two Combiners groups, |
49 | + oldv = helper_atomic_cmpxchgo_le_mmu(env, addr, cmpv, newv, oi, ra); | 84 | + * so let split them. |
50 | + | 85 | + */ |
51 | + env->xregs[rs] = int128_getlo(oldv); | 86 | + for (n = 0; n < max; n++) { |
52 | + env->xregs[rs + 1] = int128_gethi(oldv); | 87 | + |
53 | +#endif | 88 | + bit = EXYNOS4210_COMBINER_GET_BIT_NUM(n); |
54 | +} | 89 | + |
55 | + | 90 | + switch (n) { |
56 | +void HELPER(casp_be_parallel)(CPUARMState *env, uint32_t rs, uint64_t addr, | 91 | + /* MDNIE_LCD1 INTG1 */ |
57 | + uint64_t new_hi, uint64_t new_lo) | 92 | + case EXYNOS4210_COMBINER_GET_IRQ_NUM(1, 0) ... |
58 | +{ | 93 | + EXYNOS4210_COMBINER_GET_IRQ_NUM(1, 3): |
59 | + uintptr_t ra = GETPC(); | 94 | + irq[n] = qemu_irq_split(qdev_get_gpio_in(dev, n), |
60 | +#ifndef CONFIG_ATOMIC128 | 95 | + irq[EXYNOS4210_COMBINER_GET_IRQ_NUM(0, bit + 4)]); |
61 | + cpu_loop_exit_atomic(ENV_GET_CPU(env), ra); | 96 | + continue; |
62 | +#else | 97 | + |
63 | + Int128 oldv, cmpv, newv; | 98 | + /* TMU INTG3 */ |
64 | + | 99 | + case EXYNOS4210_COMBINER_GET_IRQ_NUM(3, 4): |
65 | + cmpv = int128_make128(env->xregs[rs + 1], env->xregs[rs]); | 100 | + irq[n] = qemu_irq_split(qdev_get_gpio_in(dev, n), |
66 | + newv = int128_make128(new_lo, new_hi); | 101 | + irq[EXYNOS4210_COMBINER_GET_IRQ_NUM(2, bit)]); |
67 | + | 102 | + continue; |
68 | + int mem_idx = cpu_mmu_index(env, false); | 103 | + |
69 | + TCGMemOpIdx oi = make_memop_idx(MO_LEQ | MO_ALIGN_16, mem_idx); | 104 | + /* LCD1 INTG12 */ |
70 | + oldv = helper_atomic_cmpxchgo_be_mmu(env, addr, cmpv, newv, oi, ra); | 105 | + case EXYNOS4210_COMBINER_GET_IRQ_NUM(12, 0) ... |
71 | + | 106 | + EXYNOS4210_COMBINER_GET_IRQ_NUM(12, 3): |
72 | + env->xregs[rs + 1] = int128_getlo(oldv); | 107 | + irq[n] = qemu_irq_split(qdev_get_gpio_in(dev, n), |
73 | + env->xregs[rs] = int128_gethi(oldv); | 108 | + irq[EXYNOS4210_COMBINER_GET_IRQ_NUM(11, bit + 4)]); |
74 | +#endif | 109 | + continue; |
75 | +} | 110 | + |
76 | + | 111 | + /* Multi-Core Timer INTG12 */ |
77 | /* | 112 | + case EXYNOS4210_COMBINER_GET_IRQ_NUM(12, 4) ... |
78 | * AdvSIMD half-precision | 113 | + EXYNOS4210_COMBINER_GET_IRQ_NUM(12, 8): |
79 | */ | 114 | + irq[n] = qemu_irq_split(qdev_get_gpio_in(dev, n), |
80 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c | 115 | + irq[EXYNOS4210_COMBINER_GET_IRQ_NUM(1, bit + 4)]); |
81 | index XXXXXXX..XXXXXXX 100644 | 116 | + continue; |
82 | --- a/target/arm/translate-a64.c | 117 | + |
83 | +++ b/target/arm/translate-a64.c | 118 | + /* Multi-Core Timer INTG35 */ |
84 | @@ -XXX,XX +XXX,XX @@ static void gen_store_exclusive(DisasContext *s, int rd, int rt, int rt2, | 119 | + case EXYNOS4210_COMBINER_GET_IRQ_NUM(35, 4) ... |
85 | tcg_gen_movi_i64(cpu_exclusive_addr, -1); | 120 | + EXYNOS4210_COMBINER_GET_IRQ_NUM(35, 8): |
86 | } | 121 | + irq[n] = qemu_irq_split(qdev_get_gpio_in(dev, n), |
87 | 122 | + irq[EXYNOS4210_COMBINER_GET_IRQ_NUM(1, bit + 4)]); | |
88 | +static void gen_compare_and_swap(DisasContext *s, int rs, int rt, | 123 | + continue; |
89 | + int rn, int size) | 124 | + |
90 | +{ | 125 | + /* Multi-Core Timer INTG51 */ |
91 | + TCGv_i64 tcg_rs = cpu_reg(s, rs); | 126 | + case EXYNOS4210_COMBINER_GET_IRQ_NUM(51, 4) ... |
92 | + TCGv_i64 tcg_rt = cpu_reg(s, rt); | 127 | + EXYNOS4210_COMBINER_GET_IRQ_NUM(51, 8): |
93 | + int memidx = get_mem_index(s); | 128 | + irq[n] = qemu_irq_split(qdev_get_gpio_in(dev, n), |
94 | + TCGv_i64 addr = cpu_reg_sp(s, rn); | 129 | + irq[EXYNOS4210_COMBINER_GET_IRQ_NUM(1, bit + 4)]); |
95 | + | 130 | + continue; |
96 | + if (rn == 31) { | 131 | + |
97 | + gen_check_sp_alignment(s); | 132 | + /* Multi-Core Timer INTG53 */ |
98 | + } | 133 | + case EXYNOS4210_COMBINER_GET_IRQ_NUM(53, 4) ... |
99 | + tcg_gen_atomic_cmpxchg_i64(tcg_rs, addr, tcg_rs, tcg_rt, memidx, | 134 | + EXYNOS4210_COMBINER_GET_IRQ_NUM(53, 8): |
100 | + size | MO_ALIGN | s->be_data); | 135 | + irq[n] = qemu_irq_split(qdev_get_gpio_in(dev, n), |
101 | +} | 136 | + irq[EXYNOS4210_COMBINER_GET_IRQ_NUM(1, bit + 4)]); |
102 | + | 137 | + continue; |
103 | +static void gen_compare_and_swap_pair(DisasContext *s, int rs, int rt, | ||
104 | + int rn, int size) | ||
105 | +{ | ||
106 | + TCGv_i64 s1 = cpu_reg(s, rs); | ||
107 | + TCGv_i64 s2 = cpu_reg(s, rs + 1); | ||
108 | + TCGv_i64 t1 = cpu_reg(s, rt); | ||
109 | + TCGv_i64 t2 = cpu_reg(s, rt + 1); | ||
110 | + TCGv_i64 addr = cpu_reg_sp(s, rn); | ||
111 | + int memidx = get_mem_index(s); | ||
112 | + | ||
113 | + if (rn == 31) { | ||
114 | + gen_check_sp_alignment(s); | ||
115 | + } | ||
116 | + | ||
117 | + if (size == 2) { | ||
118 | + TCGv_i64 cmp = tcg_temp_new_i64(); | ||
119 | + TCGv_i64 val = tcg_temp_new_i64(); | ||
120 | + | ||
121 | + if (s->be_data == MO_LE) { | ||
122 | + tcg_gen_concat32_i64(val, t1, t2); | ||
123 | + tcg_gen_concat32_i64(cmp, s1, s2); | ||
124 | + } else { | ||
125 | + tcg_gen_concat32_i64(val, t2, t1); | ||
126 | + tcg_gen_concat32_i64(cmp, s2, s1); | ||
127 | + } | 138 | + } |
128 | + | 139 | + |
129 | + tcg_gen_atomic_cmpxchg_i64(cmp, addr, cmp, val, memidx, | 140 | + irq[n] = qdev_get_gpio_in(dev, n); |
130 | + MO_64 | MO_ALIGN | s->be_data); | ||
131 | + tcg_temp_free_i64(val); | ||
132 | + | ||
133 | + if (s->be_data == MO_LE) { | ||
134 | + tcg_gen_extr32_i64(s1, s2, cmp); | ||
135 | + } else { | ||
136 | + tcg_gen_extr32_i64(s2, s1, cmp); | ||
137 | + } | ||
138 | + tcg_temp_free_i64(cmp); | ||
139 | + } else if (tb_cflags(s->base.tb) & CF_PARALLEL) { | ||
140 | + TCGv_i32 tcg_rs = tcg_const_i32(rs); | ||
141 | + | ||
142 | + if (s->be_data == MO_LE) { | ||
143 | + gen_helper_casp_le_parallel(cpu_env, tcg_rs, addr, t1, t2); | ||
144 | + } else { | ||
145 | + gen_helper_casp_be_parallel(cpu_env, tcg_rs, addr, t1, t2); | ||
146 | + } | ||
147 | + tcg_temp_free_i32(tcg_rs); | ||
148 | + } else { | ||
149 | + TCGv_i64 d1 = tcg_temp_new_i64(); | ||
150 | + TCGv_i64 d2 = tcg_temp_new_i64(); | ||
151 | + TCGv_i64 a2 = tcg_temp_new_i64(); | ||
152 | + TCGv_i64 c1 = tcg_temp_new_i64(); | ||
153 | + TCGv_i64 c2 = tcg_temp_new_i64(); | ||
154 | + TCGv_i64 zero = tcg_const_i64(0); | ||
155 | + | ||
156 | + /* Load the two words, in memory order. */ | ||
157 | + tcg_gen_qemu_ld_i64(d1, addr, memidx, | ||
158 | + MO_64 | MO_ALIGN_16 | s->be_data); | ||
159 | + tcg_gen_addi_i64(a2, addr, 8); | ||
160 | + tcg_gen_qemu_ld_i64(d2, addr, memidx, MO_64 | s->be_data); | ||
161 | + | ||
162 | + /* Compare the two words, also in memory order. */ | ||
163 | + tcg_gen_setcond_i64(TCG_COND_EQ, c1, d1, s1); | ||
164 | + tcg_gen_setcond_i64(TCG_COND_EQ, c2, d2, s2); | ||
165 | + tcg_gen_and_i64(c2, c2, c1); | ||
166 | + | ||
167 | + /* If compare equal, write back new data, else write back old data. */ | ||
168 | + tcg_gen_movcond_i64(TCG_COND_NE, c1, c2, zero, t1, d1); | ||
169 | + tcg_gen_movcond_i64(TCG_COND_NE, c2, c2, zero, t2, d2); | ||
170 | + tcg_gen_qemu_st_i64(c1, addr, memidx, MO_64 | s->be_data); | ||
171 | + tcg_gen_qemu_st_i64(c2, a2, memidx, MO_64 | s->be_data); | ||
172 | + tcg_temp_free_i64(a2); | ||
173 | + tcg_temp_free_i64(c1); | ||
174 | + tcg_temp_free_i64(c2); | ||
175 | + tcg_temp_free_i64(zero); | ||
176 | + | ||
177 | + /* Write back the data from memory to Rs. */ | ||
178 | + tcg_gen_mov_i64(s1, d1); | ||
179 | + tcg_gen_mov_i64(s2, d2); | ||
180 | + tcg_temp_free_i64(d1); | ||
181 | + tcg_temp_free_i64(d2); | ||
182 | + } | 141 | + } |
183 | +} | 142 | +} |
184 | + | 143 | + |
185 | /* Update the Sixty-Four bit (SF) registersize. This logic is derived | 144 | static uint8_t chipid_and_omr[] = { 0x11, 0x02, 0x21, 0x43, |
186 | * from the ARMv8 specs for LDR (Shared decode for all encodings). | 145 | 0x09, 0x00, 0x00, 0x00 }; |
187 | */ | 146 | |
188 | @@ -XXX,XX +XXX,XX @@ static void disas_ldst_excl(DisasContext *s, uint32_t insn) | 147 | diff --git a/hw/intc/exynos4210_combiner.c b/hw/intc/exynos4210_combiner.c |
189 | gen_store_exclusive(s, rs, rt, rt2, tcg_addr, size, true); | 148 | index XXXXXXX..XXXXXXX 100644 |
190 | return; | 149 | --- a/hw/intc/exynos4210_combiner.c |
191 | } | 150 | +++ b/hw/intc/exynos4210_combiner.c |
192 | - /* CASP / CASPL */ | 151 | @@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_exynos4210_combiner = { |
193 | + if (rt2 == 31 | ||
194 | + && ((rt | rs) & 1) == 0 | ||
195 | + && arm_dc_feature(s, ARM_FEATURE_V8_ATOMICS)) { | ||
196 | + /* CASP / CASPL */ | ||
197 | + gen_compare_and_swap_pair(s, rs, rt, rn, size | 2); | ||
198 | + return; | ||
199 | + } | ||
200 | break; | ||
201 | |||
202 | - case 0x6: case 0x7: /* CASP / LDXP */ | ||
203 | + case 0x6: case 0x7: /* CASPA / LDXP */ | ||
204 | if (size & 2) { /* LDXP / LDAXP */ | ||
205 | if (rn == 31) { | ||
206 | gen_check_sp_alignment(s); | ||
207 | @@ -XXX,XX +XXX,XX @@ static void disas_ldst_excl(DisasContext *s, uint32_t insn) | ||
208 | } | ||
209 | return; | ||
210 | } | ||
211 | - /* CASPA / CASPAL */ | ||
212 | + if (rt2 == 31 | ||
213 | + && ((rt | rs) & 1) == 0 | ||
214 | + && arm_dc_feature(s, ARM_FEATURE_V8_ATOMICS)) { | ||
215 | + /* CASPA / CASPAL */ | ||
216 | + gen_compare_and_swap_pair(s, rs, rt, rn, size | 2); | ||
217 | + return; | ||
218 | + } | ||
219 | break; | ||
220 | |||
221 | case 0xa: /* CAS */ | ||
222 | case 0xb: /* CASL */ | ||
223 | case 0xe: /* CASA */ | ||
224 | case 0xf: /* CASAL */ | ||
225 | + if (rt2 == 31 && arm_dc_feature(s, ARM_FEATURE_V8_ATOMICS)) { | ||
226 | + gen_compare_and_swap(s, rs, rt, rn, size); | ||
227 | + return; | ||
228 | + } | ||
229 | break; | ||
230 | } | 152 | } |
231 | unallocated_encoding(s); | 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 | { | ||
232 | -- | 235 | -- |
233 | 2.17.0 | 236 | 2.25.1 |
234 | |||
235 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | Delete a couple of #defines which are never used. | ||
1 | 2 | ||
3 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
4 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
5 | Message-id: 20220404154658.565020-12-peter.maydell@linaro.org | ||
6 | --- | ||
7 | include/hw/arm/exynos4210.h | 4 ---- | ||
8 | 1 file changed, 4 deletions(-) | ||
9 | |||
10 | diff --git a/include/hw/arm/exynos4210.h b/include/hw/arm/exynos4210.h | ||
11 | index XXXXXXX..XXXXXXX 100644 | ||
12 | --- a/include/hw/arm/exynos4210.h | ||
13 | +++ b/include/hw/arm/exynos4210.h | ||
14 | @@ -XXX,XX +XXX,XX @@ | ||
15 | #define EXYNOS4210_MAX_EXT_COMBINER_IN_IRQ \ | ||
16 | (EXYNOS4210_MAX_EXT_COMBINER_OUT_IRQ * 8) | ||
17 | |||
18 | -/* IRQs number for external and internal GIC */ | ||
19 | -#define EXYNOS4210_EXT_GIC_NIRQ (160-32) | ||
20 | -#define EXYNOS4210_INT_GIC_NIRQ 64 | ||
21 | - | ||
22 | #define EXYNOS4210_I2C_NUMBER 9 | ||
23 | |||
24 | #define EXYNOS4210_NUM_DMA 3 | ||
25 | -- | ||
26 | 2.25.1 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | In exynos4210_init_board_irqs(), use the TYPE_SPLIT_IRQ device | ||
2 | instead of qemu_irq_split(). | ||
1 | 3 | ||
4 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
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(-) | ||
11 | |||
12 | diff --git a/include/hw/arm/exynos4210.h b/include/hw/arm/exynos4210.h | ||
13 | index XXXXXXX..XXXXXXX 100644 | ||
14 | --- a/include/hw/arm/exynos4210.h | ||
15 | +++ b/include/hw/arm/exynos4210.h | ||
16 | @@ -XXX,XX +XXX,XX @@ | ||
17 | #include "hw/sysbus.h" | ||
18 | #include "hw/cpu/a9mpcore.h" | ||
19 | #include "hw/intc/exynos4210_gic.h" | ||
20 | +#include "hw/core/split-irq.h" | ||
21 | #include "target/arm/cpu-qom.h" | ||
22 | #include "qom/object.h" | ||
23 | |||
24 | @@ -XXX,XX +XXX,XX @@ | ||
25 | |||
26 | #define EXYNOS4210_NUM_DMA 3 | ||
27 | |||
28 | +/* | ||
29 | + * We need one splitter for every external combiner input, plus | ||
30 | + * one for every non-zero entry in combiner_grp_to_gic_id[]. | ||
31 | + * We'll assert in exynos4210_init_board_irqs() if this is wrong. | ||
32 | + */ | ||
33 | +#define EXYNOS4210_NUM_SPLITTERS (EXYNOS4210_MAX_EXT_COMBINER_IN_IRQ + 60) | ||
34 | + | ||
35 | typedef struct Exynos4210Irq { | ||
36 | qemu_irq int_combiner_irq[EXYNOS4210_MAX_INT_COMBINER_IN_IRQ]; | ||
37 | qemu_irq ext_combiner_irq[EXYNOS4210_MAX_EXT_COMBINER_IN_IRQ]; | ||
38 | @@ -XXX,XX +XXX,XX @@ struct Exynos4210State { | ||
39 | qemu_or_irq cpu_irq_orgate[EXYNOS4210_NCPUS]; | ||
40 | A9MPPrivState a9mpcore; | ||
41 | Exynos4210GicState ext_gic; | ||
42 | + SplitIRQ splitter[EXYNOS4210_NUM_SPLITTERS]; | ||
43 | }; | ||
44 | |||
45 | #define TYPE_EXYNOS4210_SOC "exynos4210" | ||
46 | diff --git a/hw/arm/exynos4210.c b/hw/arm/exynos4210.c | ||
47 | index XXXXXXX..XXXXXXX 100644 | ||
48 | --- a/hw/arm/exynos4210.c | ||
49 | +++ b/hw/arm/exynos4210.c | ||
50 | @@ -XXX,XX +XXX,XX @@ static void exynos4210_init_board_irqs(Exynos4210State *s) | ||
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 | } | ||
82 | } | ||
83 | for (; n < EXYNOS4210_MAX_INT_COMBINER_IN_IRQ; n++) { | ||
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); | ||
108 | } | ||
109 | |||
110 | /* | ||
111 | @@ -XXX,XX +XXX,XX @@ static void exynos4210_init(Object *obj) | ||
112 | object_initialize_child(obj, name, &s->cpu_irq_orgate[i], TYPE_OR_IRQ); | ||
113 | } | ||
114 | |||
115 | + for (i = 0; i < ARRAY_SIZE(s->splitter); i++) { | ||
116 | + g_autofree char *name = g_strdup_printf("irq-splitter%d", i); | ||
117 | + object_initialize_child(obj, name, &s->splitter[i], TYPE_SPLIT_IRQ); | ||
118 | + } | ||
119 | + | ||
120 | object_initialize_child(obj, "a9mpcore", &s->a9mpcore, TYPE_A9MPCORE_PRIV); | ||
121 | object_initialize_child(obj, "ext-gic", &s->ext_gic, TYPE_EXYNOS4210_GIC); | ||
122 | } | ||
123 | -- | ||
124 | 2.25.1 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
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.) | ||
1 | 8 | ||
9 | I don't have a reliable datasheet for this SoC, but since we do wire | ||
10 | up one interrupt line in this category (the HDMI I2C device on | ||
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.) | ||
16 | |||
17 | This bug didn't have any visible guest effects because the only | ||
18 | implemented device that was affected was the HDMI I2C controller, | ||
19 | and we never connect any I2C devices to that bus. | ||
20 | |||
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 | ||
24 | --- | ||
25 | hw/arm/exynos4210.c | 2 ++ | ||
26 | 1 file changed, 2 insertions(+) | ||
27 | |||
28 | diff --git a/hw/arm/exynos4210.c b/hw/arm/exynos4210.c | ||
29 | index XXXXXXX..XXXXXXX 100644 | ||
30 | --- a/hw/arm/exynos4210.c | ||
31 | +++ b/hw/arm/exynos4210.c | ||
32 | @@ -XXX,XX +XXX,XX @@ static void exynos4210_init_board_irqs(Exynos4210State *s) | ||
33 | qdev_connect_gpio_out(splitter, 0, is->int_combiner_irq[n]); | ||
34 | qdev_connect_gpio_out(splitter, 1, | ||
35 | qdev_get_gpio_in(extgicdev, irq_id - 32)); | ||
36 | + } else { | ||
37 | + s->irq_table[n] = is->int_combiner_irq[n]; | ||
38 | } | ||
39 | } | ||
40 | /* | ||
41 | -- | ||
42 | 2.25.1 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | Currently for the interrupts MCT_G0 and MCT_G1 which are | ||
2 | the only ones in the input range of the external combiner | ||
3 | and which are also wired to the external GIC, we connect | ||
4 | them only to the internal combiner and the external GIC. | ||
5 | This seems likely to be a bug, as all other interrupts | ||
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.) | ||
1 | 10 | ||
11 | Wire these interrupts up to both combiners, like the rest. | ||
12 | |||
13 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
14 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
15 | Message-id: 20220404154658.565020-15-peter.maydell@linaro.org | ||
16 | --- | ||
17 | hw/arm/exynos4210.c | 7 +++---- | ||
18 | 1 file changed, 3 insertions(+), 4 deletions(-) | ||
19 | |||
20 | diff --git a/hw/arm/exynos4210.c b/hw/arm/exynos4210.c | ||
21 | index XXXXXXX..XXXXXXX 100644 | ||
22 | --- a/hw/arm/exynos4210.c | ||
23 | +++ b/hw/arm/exynos4210.c | ||
24 | @@ -XXX,XX +XXX,XX @@ static void exynos4210_init_board_irqs(Exynos4210State *s) | ||
25 | |||
26 | assert(splitcount < EXYNOS4210_NUM_SPLITTERS); | ||
27 | splitter = DEVICE(&s->splitter[splitcount]); | ||
28 | - qdev_prop_set_uint16(splitter, "num-lines", 2); | ||
29 | + qdev_prop_set_uint16(splitter, "num-lines", irq_id ? 3 : 2); | ||
30 | qdev_realize(splitter, NULL, &error_abort); | ||
31 | splitcount++; | ||
32 | s->irq_table[n] = qdev_get_gpio_in(splitter, 0); | ||
33 | qdev_connect_gpio_out(splitter, 0, is->int_combiner_irq[n]); | ||
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++) { | ||
44 | -- | ||
45 | 2.25.1 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | The combiner_grp_to_gic_id[] array includes the EXT_GIC_ID_MCT_G0 | ||
2 | and EXT_GIC_ID_MCT_G1 multiple times. This means that we will | ||
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. | ||
1 | 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. | ||
24 | |||
25 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
26 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
27 | Message-id: 20220404154658.565020-16-peter.maydell@linaro.org | ||
28 | --- | ||
29 | include/hw/arm/exynos4210.h | 2 +- | ||
30 | hw/arm/exynos4210.c | 12 +++++------- | ||
31 | 2 files changed, 6 insertions(+), 8 deletions(-) | ||
32 | |||
33 | diff --git a/include/hw/arm/exynos4210.h b/include/hw/arm/exynos4210.h | ||
34 | index XXXXXXX..XXXXXXX 100644 | ||
35 | --- a/include/hw/arm/exynos4210.h | ||
36 | +++ b/include/hw/arm/exynos4210.h | ||
37 | @@ -XXX,XX +XXX,XX @@ | ||
38 | * one for every non-zero entry in combiner_grp_to_gic_id[]. | ||
39 | * We'll assert in exynos4210_init_board_irqs() if this is wrong. | ||
40 | */ | ||
41 | -#define EXYNOS4210_NUM_SPLITTERS (EXYNOS4210_MAX_EXT_COMBINER_IN_IRQ + 60) | ||
42 | +#define EXYNOS4210_NUM_SPLITTERS (EXYNOS4210_MAX_EXT_COMBINER_IN_IRQ + 54) | ||
43 | |||
44 | typedef struct Exynos4210Irq { | ||
45 | qemu_irq int_combiner_irq[EXYNOS4210_MAX_INT_COMBINER_IN_IRQ]; | ||
46 | diff --git a/hw/arm/exynos4210.c b/hw/arm/exynos4210.c | ||
47 | index XXXXXXX..XXXXXXX 100644 | ||
48 | --- a/hw/arm/exynos4210.c | ||
49 | +++ b/hw/arm/exynos4210.c | ||
50 | @@ -XXX,XX +XXX,XX @@ combiner_grp_to_gic_id[64 - EXYNOS4210_MAX_EXT_COMBINER_OUT_IRQ][8] = { | ||
51 | /* int combiner group 34 */ | ||
52 | { EXT_GIC_ID_ONENAND_AUDI, EXT_GIC_ID_NFC }, | ||
53 | /* int combiner group 35 */ | ||
54 | - { 0, 0, 0, EXT_GIC_ID_MCT_L1, EXT_GIC_ID_MCT_G0, EXT_GIC_ID_MCT_G1 }, | ||
55 | + { 0, 0, 0, EXT_GIC_ID_MCT_L1 }, | ||
56 | /* int combiner group 36 */ | ||
57 | { EXT_GIC_ID_MIXER }, | ||
58 | /* int combiner group 37 */ | ||
59 | @@ -XXX,XX +XXX,XX @@ combiner_grp_to_gic_id[64 - EXYNOS4210_MAX_EXT_COMBINER_OUT_IRQ][8] = { | ||
60 | /* groups 38-50 */ | ||
61 | { }, { }, { }, { }, { }, { }, { }, { }, { }, { }, { }, { }, { }, | ||
62 | /* int combiner group 51 */ | ||
63 | - { EXT_GIC_ID_MCT_L0, 0, 0, 0, EXT_GIC_ID_MCT_G0, EXT_GIC_ID_MCT_G1 }, | ||
64 | + { EXT_GIC_ID_MCT_L0 }, | ||
65 | /* group 52 */ | ||
66 | { }, | ||
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 | } | ||
89 | -- | ||
90 | 2.25.1 | diff view generated by jsdifflib |
1 | From: Igor Mammedov <imammedo@redhat.com> | 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 | platform-bus were using machine_done notifier to get and map | 3 | external GIC. The function exynos4210_combiner_get_gpioin() splits |
4 | (assign irq/mmio resources) dynamically added sysbus devices | 4 | some of the combiner input lines further to connect them to multiple |
5 | after all '-device' options had been processed. | 5 | different inputs on the combiner. |
6 | That however creates non obvious dependencies on ordering of | 6 | |
7 | machine_done notifiers and requires carefull line juggling | 7 | Because (unlike qemu_irq_split()) the TYPE_SPLIT_IRQ device has a |
8 | to keep it working. For example see comment above | 8 | configurable number of outputs, we can do all this in one place, by |
9 | create_platform_bus() and 'straitforward' arm_load_kernel() | 9 | making exynos4210_init_board_irqs() add extra outputs to the splitter |
10 | had to converted to machine_done notifier and that lead to | 10 | device when it must be connected to more than one input on each |
11 | yet another machine_done notifier to keep it working | 11 | combiner. |
12 | arm_register_platform_bus_fdt_creator(). | 12 | |
13 | 13 | We do this with a new data structure, the combinermap, which is an | |
14 | Instead of hiding resource assignment in platform-bus-device | 14 | array each of whose elements is a list of the interrupt IDs on the |
15 | to magically initialize sysbus devices, use device plug | 15 | combiner which must be tied together. As we loop through each |
16 | callback and assign resources explicitly at board level | 16 | interrupt ID, if we find that it is the first one in one of these |
17 | at the moment each -device option is being processed. | 17 | lists, we configure the splitter device with eonugh extra outputs and |
18 | 18 | wire them up to the other interrupt IDs in the list. | |
19 | That adds a bunch of machine declaration boiler plate to | 19 | |
20 | e500plat board, similar to ARM/x86 but gets rid of hidden | 20 | Conveniently, for all the cases where this is necessary, the |
21 | machine_done notifier and would allow to remove the dependent | 21 | lowest-numbered interrupt ID in each group is in the range of the |
22 | notifiers in ARM code simplifying it and making code flow | 22 | external combiner, so we only need to code for this in the first of |
23 | easier to follow. | 23 | the two loops in exynos4210_init_board_irqs(). |
24 | 24 | ||
25 | Signed-off-by: Igor Mammedov <imammedo@redhat.com> | 25 | The old code in exynos4210_combiner_get_gpioin() which is being |
26 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 26 | deleted here had several problems which don't exist in the new code |
27 | Acked-by: David Gibson <david@gibson.dropbear.id.au> | 27 | in its handling of the multi-core timer interrupts: |
28 | Message-id: 1525691524-32265-3-git-send-email-imammedo@redhat.com | 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 | |||
29 | 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 | ||
30 | --- | 42 | --- |
31 | hw/ppc/e500.h | 5 +++++ | 43 | include/hw/arm/exynos4210.h | 6 +- |
32 | include/hw/arm/virt.h | 1 + | 44 | hw/arm/exynos4210.c | 178 +++++++++++++++++++++++------------- |
33 | include/hw/platform-bus.h | 4 ++-- | 45 | 2 files changed, 119 insertions(+), 65 deletions(-) |
34 | hw/arm/sysbus-fdt.c | 3 --- | 46 | |
35 | hw/arm/virt.c | 31 +++++++++++++++++++++++++++++++ | 47 | diff --git a/include/hw/arm/exynos4210.h b/include/hw/arm/exynos4210.h |
36 | hw/core/platform-bus.c | 29 +++++------------------------ | ||
37 | hw/ppc/e500.c | 38 +++++++++++++++++--------------------- | ||
38 | hw/ppc/e500plat.c | 31 +++++++++++++++++++++++++++++++ | ||
39 | 8 files changed, 92 insertions(+), 50 deletions(-) | ||
40 | |||
41 | diff --git a/hw/ppc/e500.h b/hw/ppc/e500.h | ||
42 | index XXXXXXX..XXXXXXX 100644 | 48 | index XXXXXXX..XXXXXXX 100644 |
43 | --- a/hw/ppc/e500.h | 49 | --- a/include/hw/arm/exynos4210.h |
44 | +++ b/hw/ppc/e500.h | 50 | +++ b/include/hw/arm/exynos4210.h |
45 | @@ -XXX,XX +XXX,XX @@ | 51 | @@ -XXX,XX +XXX,XX @@ |
46 | #define PPCE500_H | 52 | |
47 | 53 | /* | |
48 | #include "hw/boards.h" | 54 | * We need one splitter for every external combiner input, plus |
49 | +#include "hw/platform-bus.h" | 55 | - * one for every non-zero entry in combiner_grp_to_gic_id[]. |
50 | 56 | + * one for every non-zero entry in combiner_grp_to_gic_id[], | |
51 | typedef struct PPCE500MachineState { | 57 | + * minus one for every external combiner ID in second or later |
52 | /*< private >*/ | 58 | + * places in a combinermap[] line. |
53 | MachineState parent_obj; | 59 | * We'll assert in exynos4210_init_board_irqs() if this is wrong. |
54 | 60 | */ | |
55 | + /* points to instance of TYPE_PLATFORM_BUS_DEVICE if | 61 | -#define EXYNOS4210_NUM_SPLITTERS (EXYNOS4210_MAX_EXT_COMBINER_IN_IRQ + 54) |
56 | + * board supports dynamic sysbus devices | 62 | +#define EXYNOS4210_NUM_SPLITTERS (EXYNOS4210_MAX_EXT_COMBINER_IN_IRQ + 38) |
63 | |||
64 | typedef struct Exynos4210Irq { | ||
65 | qemu_irq int_combiner_irq[EXYNOS4210_MAX_INT_COMBINER_IN_IRQ]; | ||
66 | diff --git a/hw/arm/exynos4210.c b/hw/arm/exynos4210.c | ||
67 | index XXXXXXX..XXXXXXX 100644 | ||
68 | --- a/hw/arm/exynos4210.c | ||
69 | +++ b/hw/arm/exynos4210.c | ||
70 | @@ -XXX,XX +XXX,XX @@ combiner_grp_to_gic_id[64 - EXYNOS4210_MAX_EXT_COMBINER_OUT_IRQ][8] = { | ||
71 | #define EXYNOS4210_COMBINER_GET_BIT_NUM(irq) \ | ||
72 | ((irq) - 8 * EXYNOS4210_COMBINER_GET_GRP_NUM(irq)) | ||
73 | |||
74 | +/* | ||
75 | + * Some interrupt lines go to multiple combiner inputs. | ||
76 | + * This data structure defines those: each array element is | ||
77 | + * a list of combiner inputs which are connected together; | ||
78 | + * the one with the smallest interrupt ID value must be first. | ||
79 | + * As with combiner_grp_to_gic_id[], we rely on (0, 0) not being | ||
80 | + * wired to anything so we can use 0 as a terminator. | ||
81 | + */ | ||
82 | +#define IRQNO(G, B) EXYNOS4210_COMBINER_GET_IRQ_NUM(G, B) | ||
83 | +#define IRQNONE 0 | ||
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. | ||
57 | + */ | 118 | + */ |
58 | + PlatformBusDevice *pbus_dev; | 119 | + int i; |
59 | } PPCE500MachineState; | 120 | + for (i = 0; i < COMBINERMAP_SIZE; i++) { |
60 | 121 | + if (combinermap[i][0] == irq) { | |
61 | typedef struct PPCE500MachineClass { | 122 | + return combinermap[i]; |
62 | diff --git a/include/hw/arm/virt.h b/include/hw/arm/virt.h | ||
63 | index XXXXXXX..XXXXXXX 100644 | ||
64 | --- a/include/hw/arm/virt.h | ||
65 | +++ b/include/hw/arm/virt.h | ||
66 | @@ -XXX,XX +XXX,XX @@ typedef struct { | ||
67 | typedef struct { | ||
68 | MachineState parent; | ||
69 | Notifier machine_done; | ||
70 | + DeviceState *platform_bus_dev; | ||
71 | FWCfgState *fw_cfg; | ||
72 | bool secure; | ||
73 | bool highmem; | ||
74 | diff --git a/include/hw/platform-bus.h b/include/hw/platform-bus.h | ||
75 | index XXXXXXX..XXXXXXX 100644 | ||
76 | --- a/include/hw/platform-bus.h | ||
77 | +++ b/include/hw/platform-bus.h | ||
78 | @@ -XXX,XX +XXX,XX @@ typedef struct PlatformBusDevice PlatformBusDevice; | ||
79 | struct PlatformBusDevice { | ||
80 | /*< private >*/ | ||
81 | SysBusDevice parent_obj; | ||
82 | - Notifier notifier; | ||
83 | - bool done_gathering; | ||
84 | |||
85 | /*< public >*/ | ||
86 | uint32_t mmio_size; | ||
87 | @@ -XXX,XX +XXX,XX @@ int platform_bus_get_irqn(PlatformBusDevice *platform_bus, SysBusDevice *sbdev, | ||
88 | hwaddr platform_bus_get_mmio_addr(PlatformBusDevice *pbus, SysBusDevice *sbdev, | ||
89 | int n); | ||
90 | |||
91 | +void platform_bus_link_device(PlatformBusDevice *pbus, SysBusDevice *sbdev); | ||
92 | + | ||
93 | #endif /* HW_PLATFORM_BUS_H */ | ||
94 | diff --git a/hw/arm/sysbus-fdt.c b/hw/arm/sysbus-fdt.c | ||
95 | index XXXXXXX..XXXXXXX 100644 | ||
96 | --- a/hw/arm/sysbus-fdt.c | ||
97 | +++ b/hw/arm/sysbus-fdt.c | ||
98 | @@ -XXX,XX +XXX,XX @@ static void add_all_platform_bus_fdt_nodes(ARMPlatformBusFDTParams *fdt_params) | ||
99 | dev = qdev_find_recursive(sysbus_get_default(), TYPE_PLATFORM_BUS_DEVICE); | ||
100 | pbus = PLATFORM_BUS_DEVICE(dev); | ||
101 | |||
102 | - /* We can only create dt nodes for dynamic devices when they're ready */ | ||
103 | - assert(pbus->done_gathering); | ||
104 | - | ||
105 | PlatformBusFDTData data = { | ||
106 | .fdt = fdt, | ||
107 | .irq_start = irq_start, | ||
108 | diff --git a/hw/arm/virt.c b/hw/arm/virt.c | ||
109 | index XXXXXXX..XXXXXXX 100644 | ||
110 | --- a/hw/arm/virt.c | ||
111 | +++ b/hw/arm/virt.c | ||
112 | @@ -XXX,XX +XXX,XX @@ static void create_platform_bus(VirtMachineState *vms, qemu_irq *pic) | ||
113 | qdev_prop_set_uint32(dev, "mmio_size", | ||
114 | platform_bus_params.platform_bus_size); | ||
115 | qdev_init_nofail(dev); | ||
116 | + vms->platform_bus_dev = dev; | ||
117 | s = SYS_BUS_DEVICE(dev); | ||
118 | |||
119 | for (i = 0; i < platform_bus_params.platform_bus_num_irqs; i++) { | ||
120 | @@ -XXX,XX +XXX,XX @@ static const CPUArchIdList *virt_possible_cpu_arch_ids(MachineState *ms) | ||
121 | return ms->possible_cpus; | ||
122 | } | ||
123 | |||
124 | +static void virt_machine_device_plug_cb(HotplugHandler *hotplug_dev, | ||
125 | + DeviceState *dev, Error **errp) | ||
126 | +{ | ||
127 | + VirtMachineState *vms = VIRT_MACHINE(hotplug_dev); | ||
128 | + | ||
129 | + if (vms->platform_bus_dev) { | ||
130 | + if (object_dynamic_cast(OBJECT(dev), TYPE_SYS_BUS_DEVICE)) { | ||
131 | + platform_bus_link_device(PLATFORM_BUS_DEVICE(vms->platform_bus_dev), | ||
132 | + SYS_BUS_DEVICE(dev)); | ||
133 | + } | 123 | + } |
134 | + } | 124 | + } |
135 | +} | ||
136 | + | ||
137 | +static HotplugHandler *virt_machine_get_hotplug_handler(MachineState *machine, | ||
138 | + DeviceState *dev) | ||
139 | +{ | ||
140 | + if (object_dynamic_cast(OBJECT(dev), TYPE_SYS_BUS_DEVICE)) { | ||
141 | + return HOTPLUG_HANDLER(machine); | ||
142 | + } | ||
143 | + | ||
144 | + return NULL; | 125 | + return NULL; |
145 | +} | 126 | +} |
146 | + | 127 | + |
147 | static void virt_machine_class_init(ObjectClass *oc, void *data) | 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 | } | ||
207 | } | ||
208 | @@ -XXX,XX +XXX,XX @@ static void exynos4210_init_board_irqs(Exynos4210State *s) | ||
209 | irq_id = combiner_grp_to_gic_id[grp - | ||
210 | EXYNOS4210_MAX_EXT_COMBINER_OUT_IRQ][bit]; | ||
211 | |||
212 | + if (s->irq_table[n]) { | ||
213 | + /* | ||
214 | + * This must be some non-first entry in a combinermap line, | ||
215 | + * and we've already filled it in. | ||
216 | + */ | ||
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) | ||
148 | { | 225 | { |
149 | MachineClass *mc = MACHINE_CLASS(oc); | 226 | int n; |
150 | + HotplugHandlerClass *hc = HOTPLUG_HANDLER_CLASS(oc); | 227 | - int bit; |
151 | 228 | int max; | |
152 | mc->init = machvirt_init; | 229 | qemu_irq *irq; |
153 | /* Start max_cpus at the maximum QEMU supports. We'll further restrict | 230 | |
154 | @@ -XXX,XX +XXX,XX @@ static void virt_machine_class_init(ObjectClass *oc, void *data) | 231 | @@ -XXX,XX +XXX,XX @@ static void exynos4210_combiner_get_gpioin(Exynos4210Irq *irqs, |
155 | mc->cpu_index_to_instance_props = virt_cpu_index_to_props; | 232 | EXYNOS4210_MAX_INT_COMBINER_IN_IRQ; |
156 | mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-a15"); | 233 | irq = ext ? irqs->ext_combiner_irq : irqs->int_combiner_irq; |
157 | mc->get_default_cpu_node_id = virt_get_default_cpu_node_id; | 234 | |
158 | + mc->get_hotplug_handler = virt_machine_get_hotplug_handler; | 235 | - /* |
159 | + hc->plug = virt_machine_device_plug_cb; | 236 | - * Some IRQs of Int/External Combiner are going to two Combiners groups, |
160 | } | 237 | - * so let split them. |
161 | 238 | - */ | |
162 | static const TypeInfo virt_machine_info = { | 239 | for (n = 0; n < max; n++) { |
163 | @@ -XXX,XX +XXX,XX @@ static const TypeInfo virt_machine_info = { | 240 | - |
164 | .instance_size = sizeof(VirtMachineState), | 241 | - bit = EXYNOS4210_COMBINER_GET_BIT_NUM(n); |
165 | .class_size = sizeof(VirtMachineClass), | 242 | - |
166 | .class_init = virt_machine_class_init, | 243 | - switch (n) { |
167 | + .interfaces = (InterfaceInfo[]) { | 244 | - /* MDNIE_LCD1 INTG1 */ |
168 | + { TYPE_HOTPLUG_HANDLER }, | 245 | - case EXYNOS4210_COMBINER_GET_IRQ_NUM(1, 0) ... |
169 | + { } | 246 | - EXYNOS4210_COMBINER_GET_IRQ_NUM(1, 3): |
170 | + }, | 247 | - irq[n] = qemu_irq_split(qdev_get_gpio_in(dev, n), |
171 | }; | 248 | - irq[EXYNOS4210_COMBINER_GET_IRQ_NUM(0, bit + 4)]); |
172 | 249 | - continue; | |
173 | static void machvirt_machine_init(void) | 250 | - |
174 | diff --git a/hw/core/platform-bus.c b/hw/core/platform-bus.c | 251 | - /* TMU INTG3 */ |
175 | index XXXXXXX..XXXXXXX 100644 | 252 | - case EXYNOS4210_COMBINER_GET_IRQ_NUM(3, 4): |
176 | --- a/hw/core/platform-bus.c | 253 | - irq[n] = qemu_irq_split(qdev_get_gpio_in(dev, n), |
177 | +++ b/hw/core/platform-bus.c | 254 | - irq[EXYNOS4210_COMBINER_GET_IRQ_NUM(2, bit)]); |
178 | @@ -XXX,XX +XXX,XX @@ static void plaform_bus_refresh_irqs(PlatformBusDevice *pbus) | 255 | - continue; |
179 | { | 256 | - |
180 | bitmap_zero(pbus->used_irqs, pbus->num_irqs); | 257 | - /* LCD1 INTG12 */ |
181 | foreach_dynamic_sysbus_device(platform_bus_count_irqs, pbus); | 258 | - case EXYNOS4210_COMBINER_GET_IRQ_NUM(12, 0) ... |
182 | - pbus->done_gathering = true; | 259 | - EXYNOS4210_COMBINER_GET_IRQ_NUM(12, 3): |
183 | } | 260 | - irq[n] = qemu_irq_split(qdev_get_gpio_in(dev, n), |
184 | 261 | - irq[EXYNOS4210_COMBINER_GET_IRQ_NUM(11, bit + 4)]); | |
185 | static void platform_bus_map_irq(PlatformBusDevice *pbus, SysBusDevice *sbdev, | 262 | - continue; |
186 | @@ -XXX,XX +XXX,XX @@ static void platform_bus_map_mmio(PlatformBusDevice *pbus, SysBusDevice *sbdev, | 263 | - |
187 | } | 264 | - /* Multi-Core Timer INTG12 */ |
188 | 265 | - case EXYNOS4210_COMBINER_GET_IRQ_NUM(12, 4) ... | |
189 | /* | 266 | - EXYNOS4210_COMBINER_GET_IRQ_NUM(12, 8): |
190 | - * For each sysbus device, look for unassigned IRQ lines as well as | 267 | - irq[n] = qemu_irq_split(qdev_get_gpio_in(dev, n), |
191 | - * unassociated MMIO regions. Connect them to the platform bus if available. | 268 | - irq[EXYNOS4210_COMBINER_GET_IRQ_NUM(1, bit + 4)]); |
192 | + * Look for unassigned IRQ lines as well as unassociated MMIO regions. | 269 | - continue; |
193 | + * Connect them to the platform bus if available. | 270 | - |
194 | */ | 271 | - /* Multi-Core Timer INTG35 */ |
195 | -static void link_sysbus_device(SysBusDevice *sbdev, void *opaque) | 272 | - case EXYNOS4210_COMBINER_GET_IRQ_NUM(35, 4) ... |
196 | +void platform_bus_link_device(PlatformBusDevice *pbus, SysBusDevice *sbdev) | 273 | - EXYNOS4210_COMBINER_GET_IRQ_NUM(35, 8): |
197 | { | 274 | - irq[n] = qemu_irq_split(qdev_get_gpio_in(dev, n), |
198 | - PlatformBusDevice *pbus = opaque; | 275 | - irq[EXYNOS4210_COMBINER_GET_IRQ_NUM(1, bit + 4)]); |
199 | int i; | 276 | - continue; |
200 | 277 | - | |
201 | for (i = 0; sysbus_has_irq(sbdev, i); i++) { | 278 | - /* Multi-Core Timer INTG51 */ |
202 | @@ -XXX,XX +XXX,XX @@ static void link_sysbus_device(SysBusDevice *sbdev, void *opaque) | 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); | ||
203 | } | 294 | } |
204 | } | 295 | } |
205 | |||
206 | -static void platform_bus_init_notify(Notifier *notifier, void *data) | ||
207 | -{ | ||
208 | - PlatformBusDevice *pb = container_of(notifier, PlatformBusDevice, notifier); | ||
209 | - | ||
210 | - /* | ||
211 | - * Generate a bitmap of used IRQ lines, as the user might have specified | ||
212 | - * them on the command line. | ||
213 | - */ | ||
214 | - plaform_bus_refresh_irqs(pb); | ||
215 | - | ||
216 | - foreach_dynamic_sysbus_device(link_sysbus_device, pb); | ||
217 | -} | ||
218 | - | ||
219 | static void platform_bus_realize(DeviceState *dev, Error **errp) | ||
220 | { | ||
221 | PlatformBusDevice *pbus; | ||
222 | @@ -XXX,XX +XXX,XX @@ static void platform_bus_realize(DeviceState *dev, Error **errp) | ||
223 | sysbus_init_irq(d, &pbus->irqs[i]); | ||
224 | } | ||
225 | |||
226 | - /* | ||
227 | - * Register notifier that allows us to gather dangling devices once the | ||
228 | - * machine is completely assembled | ||
229 | - */ | ||
230 | - pbus->notifier.notify = platform_bus_init_notify; | ||
231 | - qemu_add_machine_init_done_notifier(&pbus->notifier); | ||
232 | + /* some devices might be initialized before so update used IRQs map */ | ||
233 | + plaform_bus_refresh_irqs(pbus); | ||
234 | } | ||
235 | |||
236 | static Property platform_bus_properties[] = { | ||
237 | diff --git a/hw/ppc/e500.c b/hw/ppc/e500.c | ||
238 | index XXXXXXX..XXXXXXX 100644 | ||
239 | --- a/hw/ppc/e500.c | ||
240 | +++ b/hw/ppc/e500.c | ||
241 | @@ -XXX,XX +XXX,XX @@ static void sysbus_device_create_devtree(SysBusDevice *sbdev, void *opaque) | ||
242 | } | ||
243 | } | ||
244 | |||
245 | -static void platform_bus_create_devtree(const PPCE500MachineClass *pmc, | ||
246 | +static void platform_bus_create_devtree(PPCE500MachineState *pms, | ||
247 | void *fdt, const char *mpic) | ||
248 | { | ||
249 | + const PPCE500MachineClass *pmc = PPCE500_MACHINE_GET_CLASS(pms); | ||
250 | gchar *node = g_strdup_printf("/platform@%"PRIx64, pmc->platform_bus_base); | ||
251 | const char platcomp[] = "qemu,platform\0simple-bus"; | ||
252 | uint64_t addr = pmc->platform_bus_base; | ||
253 | uint64_t size = pmc->platform_bus_size; | ||
254 | int irq_start = pmc->platform_bus_first_irq; | ||
255 | - PlatformBusDevice *pbus; | ||
256 | - DeviceState *dev; | ||
257 | |||
258 | /* Create a /platform node that we can put all devices into */ | ||
259 | |||
260 | @@ -XXX,XX +XXX,XX @@ static void platform_bus_create_devtree(const PPCE500MachineClass *pmc, | ||
261 | |||
262 | qemu_fdt_setprop_phandle(fdt, node, "interrupt-parent", mpic); | ||
263 | |||
264 | - dev = qdev_find_recursive(sysbus_get_default(), TYPE_PLATFORM_BUS_DEVICE); | ||
265 | - pbus = PLATFORM_BUS_DEVICE(dev); | ||
266 | + /* Create dt nodes for dynamic devices */ | ||
267 | + PlatformDevtreeData data = { | ||
268 | + .fdt = fdt, | ||
269 | + .mpic = mpic, | ||
270 | + .irq_start = irq_start, | ||
271 | + .node = node, | ||
272 | + .pbus = pms->pbus_dev, | ||
273 | + }; | ||
274 | |||
275 | - /* We can only create dt nodes for dynamic devices when they're ready */ | ||
276 | - if (pbus->done_gathering) { | ||
277 | - PlatformDevtreeData data = { | ||
278 | - .fdt = fdt, | ||
279 | - .mpic = mpic, | ||
280 | - .irq_start = irq_start, | ||
281 | - .node = node, | ||
282 | - .pbus = pbus, | ||
283 | - }; | ||
284 | - | ||
285 | - /* Loop through all dynamic sysbus devices and create nodes for them */ | ||
286 | - foreach_dynamic_sysbus_device(sysbus_device_create_devtree, &data); | ||
287 | - } | ||
288 | + /* Loop through all dynamic sysbus devices and create nodes for them */ | ||
289 | + foreach_dynamic_sysbus_device(sysbus_device_create_devtree, &data); | ||
290 | |||
291 | g_free(node); | ||
292 | } | ||
293 | @@ -XXX,XX +XXX,XX @@ static int ppce500_load_device_tree(PPCE500MachineState *pms, | ||
294 | } | ||
295 | g_free(soc); | ||
296 | |||
297 | - if (pmc->has_platform_bus) { | ||
298 | - platform_bus_create_devtree(pmc, fdt, mpic); | ||
299 | + if (pms->pbus_dev) { | ||
300 | + platform_bus_create_devtree(pms, fdt, mpic); | ||
301 | } | ||
302 | g_free(mpic); | ||
303 | |||
304 | @@ -XXX,XX +XXX,XX @@ void ppce500_init(MachineState *machine) | ||
305 | qdev_prop_set_uint32(dev, "num_irqs", pmc->platform_bus_num_irqs); | ||
306 | qdev_prop_set_uint32(dev, "mmio_size", pmc->platform_bus_size); | ||
307 | qdev_init_nofail(dev); | ||
308 | - s = SYS_BUS_DEVICE(dev); | ||
309 | + pms->pbus_dev = PLATFORM_BUS_DEVICE(dev); | ||
310 | |||
311 | + s = SYS_BUS_DEVICE(pms->pbus_dev); | ||
312 | for (i = 0; i < pmc->platform_bus_num_irqs; i++) { | ||
313 | int irqn = pmc->platform_bus_first_irq + i; | ||
314 | sysbus_connect_irq(s, i, qdev_get_gpio_in(mpicdev, irqn)); | ||
315 | @@ -XXX,XX +XXX,XX @@ static const TypeInfo ppce500_info = { | ||
316 | .name = TYPE_PPCE500_MACHINE, | ||
317 | .parent = TYPE_MACHINE, | ||
318 | .abstract = true, | ||
319 | + .instance_size = sizeof(PPCE500MachineState), | ||
320 | .class_size = sizeof(PPCE500MachineClass), | ||
321 | }; | ||
322 | |||
323 | diff --git a/hw/ppc/e500plat.c b/hw/ppc/e500plat.c | ||
324 | index XXXXXXX..XXXXXXX 100644 | ||
325 | --- a/hw/ppc/e500plat.c | ||
326 | +++ b/hw/ppc/e500plat.c | ||
327 | @@ -XXX,XX +XXX,XX @@ static void e500plat_init(MachineState *machine) | ||
328 | ppce500_init(machine); | ||
329 | } | ||
330 | |||
331 | +static void e500plat_machine_device_plug_cb(HotplugHandler *hotplug_dev, | ||
332 | + DeviceState *dev, Error **errp) | ||
333 | +{ | ||
334 | + PPCE500MachineState *pms = PPCE500_MACHINE(hotplug_dev); | ||
335 | + | ||
336 | + if (pms->pbus_dev) { | ||
337 | + if (object_dynamic_cast(OBJECT(dev), TYPE_SYS_BUS_DEVICE)) { | ||
338 | + platform_bus_link_device(pms->pbus_dev, SYS_BUS_DEVICE(dev)); | ||
339 | + } | ||
340 | + } | ||
341 | +} | ||
342 | + | ||
343 | +static | ||
344 | +HotplugHandler *e500plat_machine_get_hotpug_handler(MachineState *machine, | ||
345 | + DeviceState *dev) | ||
346 | +{ | ||
347 | + if (object_dynamic_cast(OBJECT(dev), TYPE_SYS_BUS_DEVICE)) { | ||
348 | + return HOTPLUG_HANDLER(machine); | ||
349 | + } | ||
350 | + | ||
351 | + return NULL; | ||
352 | +} | ||
353 | + | ||
354 | #define TYPE_E500PLAT_MACHINE MACHINE_TYPE_NAME("ppce500") | ||
355 | |||
356 | static void e500plat_machine_class_init(ObjectClass *oc, void *data) | ||
357 | { | ||
358 | PPCE500MachineClass *pmc = PPCE500_MACHINE_CLASS(oc); | ||
359 | + HotplugHandlerClass *hc = HOTPLUG_HANDLER_CLASS(oc); | ||
360 | MachineClass *mc = MACHINE_CLASS(oc); | ||
361 | |||
362 | + mc->get_hotplug_handler = e500plat_machine_get_hotpug_handler; | ||
363 | + hc->plug = e500plat_machine_device_plug_cb; | ||
364 | + | ||
365 | pmc->pci_first_slot = 0x1; | ||
366 | pmc->pci_nr_slots = PCI_SLOT_MAX - 1; | ||
367 | pmc->fixup_devtree = e500plat_fixup_devtree; | ||
368 | @@ -XXX,XX +XXX,XX @@ static const TypeInfo e500plat_info = { | ||
369 | .name = TYPE_E500PLAT_MACHINE, | ||
370 | .parent = TYPE_PPCE500_MACHINE, | ||
371 | .class_init = e500plat_machine_class_init, | ||
372 | + .interfaces = (InterfaceInfo[]) { | ||
373 | + { TYPE_HOTPLUG_HANDLER }, | ||
374 | + { } | ||
375 | + } | ||
376 | }; | ||
377 | |||
378 | static void e500plat_register_types(void) | ||
379 | -- | 296 | -- |
380 | 2.17.0 | 297 | 2.25.1 |
381 | |||
382 | diff view generated by jsdifflib |
1 | Coverity (CID1390573) spots that we forgot to free the | 1 | Switch the creation of the combiner devices to the new-style |
---|---|---|---|
2 | gpioname strings in a loop in the iotkit realize function. | 2 | "embedded in state struct" approach, so we can easily refer |
3 | Correct the error. | 3 | to the object elsewhere during realize. |
4 | |||
5 | This isn't a significant leak, because this function | ||
6 | only ever runs once. | ||
7 | 4 | ||
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 5 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
9 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 6 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
10 | Reviewed-by: Peter Xu <peterx@redhat.com> | 7 | Message-id: 20220404154658.565020-18-peter.maydell@linaro.org |
11 | Message-id: 20180427110137.19304-1-peter.maydell@linaro.org | ||
12 | --- | 8 | --- |
13 | hw/arm/iotkit.c | 1 + | 9 | include/hw/arm/exynos4210.h | 3 ++ |
14 | 1 file changed, 1 insertion(+) | 10 | include/hw/intc/exynos4210_combiner.h | 57 +++++++++++++++++++++++++++ |
11 | hw/arm/exynos4210.c | 20 +++++----- | ||
12 | hw/intc/exynos4210_combiner.c | 31 +-------------- | ||
13 | 4 files changed, 72 insertions(+), 39 deletions(-) | ||
14 | create mode 100644 include/hw/intc/exynos4210_combiner.h | ||
15 | 15 | ||
16 | diff --git a/hw/arm/iotkit.c b/hw/arm/iotkit.c | 16 | diff --git a/include/hw/arm/exynos4210.h b/include/hw/arm/exynos4210.h |
17 | index XXXXXXX..XXXXXXX 100644 | 17 | index XXXXXXX..XXXXXXX 100644 |
18 | --- a/hw/arm/iotkit.c | 18 | --- a/include/hw/arm/exynos4210.h |
19 | +++ b/hw/arm/iotkit.c | 19 | +++ b/include/hw/arm/exynos4210.h |
20 | @@ -XXX,XX +XXX,XX @@ static void iotkit_realize(DeviceState *dev, Error **errp) | 20 | @@ -XXX,XX +XXX,XX @@ |
21 | qdev_get_gpio_in(DEVICE(&s->ppc_irq_orgate), i)); | 21 | #include "hw/sysbus.h" |
22 | qdev_connect_gpio_out_named(DEVICE(ppc), "irq", 0, | 22 | #include "hw/cpu/a9mpcore.h" |
23 | qdev_get_gpio_in(devs, 0)); | 23 | #include "hw/intc/exynos4210_gic.h" |
24 | + g_free(gpioname); | 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 | ||
38 | new file mode 100644 | ||
39 | index XXXXXXX..XXXXXXX | ||
40 | --- /dev/null | ||
41 | +++ b/include/hw/intc/exynos4210_combiner.h | ||
42 | @@ -XXX,XX +XXX,XX @@ | ||
43 | +/* | ||
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 | + */ | ||
64 | + | ||
65 | +#ifndef HW_INTC_EXYNOS4210_COMBINER | ||
66 | +#define HW_INTC_EXYNOS4210_COMBINER | ||
67 | + | ||
68 | +#include "hw/sysbus.h" | ||
69 | + | ||
70 | +/* | ||
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; | ||
77 | + | ||
78 | +#define TYPE_EXYNOS4210_COMBINER "exynos4210.combiner" | ||
79 | +OBJECT_DECLARE_SIMPLE_TYPE(Exynos4210CombinerState, EXYNOS4210_COMBINER) | ||
80 | + | ||
81 | +/* Number of groups and total number of interrupts for the internal combiner */ | ||
82 | +#define IIC_NGRP 64 | ||
83 | +#define IIC_NIRQ (IIC_NGRP * 8) | ||
84 | +#define IIC_REGSET_SIZE 0x41 | ||
85 | + | ||
86 | +struct Exynos4210CombinerState { | ||
87 | + SysBusDevice parent_obj; | ||
88 | + | ||
89 | + MemoryRegion iomem; | ||
90 | + | ||
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 */ | ||
95 | + | ||
96 | + qemu_irq output_irq[IIC_NGRP]; | ||
97 | +}; | ||
98 | + | ||
99 | +#endif | ||
100 | diff --git a/hw/arm/exynos4210.c b/hw/arm/exynos4210.c | ||
101 | index XXXXXXX..XXXXXXX 100644 | ||
102 | --- a/hw/arm/exynos4210.c | ||
103 | +++ b/hw/arm/exynos4210.c | ||
104 | @@ -XXX,XX +XXX,XX @@ static void exynos4210_realize(DeviceState *socdev, Error **errp) | ||
25 | } | 105 | } |
26 | 106 | ||
27 | iotkit_forward_sec_resp_cfg(s); | 107 | /* Internal Interrupt Combiner */ |
108 | - dev = qdev_new("exynos4210.combiner"); | ||
109 | - busdev = SYS_BUS_DEVICE(dev); | ||
110 | - sysbus_realize_and_unref(busdev, &error_fatal); | ||
111 | + busdev = SYS_BUS_DEVICE(&s->int_combiner); | ||
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 | ||
149 | index XXXXXXX..XXXXXXX 100644 | ||
150 | --- a/hw/intc/exynos4210_combiner.c | ||
151 | +++ b/hw/intc/exynos4210_combiner.c | ||
152 | @@ -XXX,XX +XXX,XX @@ | ||
153 | #include "hw/sysbus.h" | ||
154 | #include "migration/vmstate.h" | ||
155 | #include "qemu/module.h" | ||
156 | - | ||
157 | +#include "hw/intc/exynos4210_combiner.h" | ||
158 | #include "hw/arm/exynos4210.h" | ||
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", | ||
28 | -- | 198 | -- |
29 | 2.17.0 | 199 | 2.25.1 |
30 | |||
31 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | The only time we use the int_combiner_irq[] and ext_combiner_irq[] |
---|---|---|---|
2 | arrays in the Exynos4210Irq struct is during realize of the SoC -- we | ||
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. | ||
2 | 9 | ||
3 | Suggested-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Since these are the only two remaining elements of Exynos4210Irq, |
4 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 11 | we can remove that struct entirely. |
5 | Message-id: 20180508151437.4232-6-richard.henderson@linaro.org | 12 | |
6 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 13 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
14 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
15 | Message-id: 20220404154658.565020-19-peter.maydell@linaro.org | ||
8 | --- | 16 | --- |
9 | accel/tcg/atomic_template.h | 49 ++++++------------------------------- | 17 | include/hw/arm/exynos4210.h | 6 ------ |
10 | 1 file changed, 7 insertions(+), 42 deletions(-) | 18 | hw/arm/exynos4210.c | 34 ++++++++-------------------------- |
19 | 2 files changed, 8 insertions(+), 32 deletions(-) | ||
11 | 20 | ||
12 | diff --git a/accel/tcg/atomic_template.h b/accel/tcg/atomic_template.h | 21 | diff --git a/include/hw/arm/exynos4210.h b/include/hw/arm/exynos4210.h |
13 | index XXXXXXX..XXXXXXX 100644 | 22 | index XXXXXXX..XXXXXXX 100644 |
14 | --- a/accel/tcg/atomic_template.h | 23 | --- a/include/hw/arm/exynos4210.h |
15 | +++ b/accel/tcg/atomic_template.h | 24 | +++ b/include/hw/arm/exynos4210.h |
16 | @@ -XXX,XX +XXX,XX @@ GEN_ATOMIC_HELPER(xor_fetch) | 25 | @@ -XXX,XX +XXX,XX @@ |
17 | 26 | */ | |
18 | #undef GEN_ATOMIC_HELPER | 27 | #define EXYNOS4210_NUM_SPLITTERS (EXYNOS4210_MAX_EXT_COMBINER_IN_IRQ + 38) |
19 | 28 | ||
20 | -/* Note that for addition, we need to use a separate cmpxchg loop instead | 29 | -typedef struct Exynos4210Irq { |
21 | - of bswaps for the reverse-host-endian helpers. */ | 30 | - qemu_irq int_combiner_irq[EXYNOS4210_MAX_INT_COMBINER_IN_IRQ]; |
22 | -ABI_TYPE ATOMIC_NAME(fetch_add)(CPUArchState *env, target_ulong addr, | 31 | - qemu_irq ext_combiner_irq[EXYNOS4210_MAX_EXT_COMBINER_IN_IRQ]; |
23 | - ABI_TYPE val EXTRA_ARGS) | 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) | ||
24 | -{ | 94 | -{ |
25 | - ATOMIC_MMU_DECLS; | 95 | - int n; |
26 | - DATA_TYPE *haddr = ATOMIC_MMU_LOOKUP; | 96 | - int max; |
27 | - DATA_TYPE ldo, ldn, ret, sto; | 97 | - qemu_irq *irq; |
28 | - | 98 | - |
29 | - ldo = atomic_read__nocheck(haddr); | 99 | - max = ext ? EXYNOS4210_MAX_EXT_COMBINER_IN_IRQ : |
30 | - while (1) { | 100 | - EXYNOS4210_MAX_INT_COMBINER_IN_IRQ; |
31 | - ret = BSWAP(ldo); | 101 | - irq = ext ? irqs->ext_combiner_irq : irqs->int_combiner_irq; |
32 | - sto = BSWAP(ret + val); | 102 | - |
33 | - ldn = atomic_cmpxchg__nocheck(haddr, ldo, sto); | 103 | - for (n = 0; n < max; n++) { |
34 | - if (ldn == ldo) { | 104 | - irq[n] = qdev_get_gpio_in(dev, n); |
35 | - ATOMIC_MMU_CLEANUP; | ||
36 | - return ret; | ||
37 | - } | ||
38 | - ldo = ldn; | ||
39 | - } | 105 | - } |
40 | -} | 106 | -} |
41 | - | 107 | - |
42 | -ABI_TYPE ATOMIC_NAME(add_fetch)(CPUArchState *env, target_ulong addr, | 108 | static uint8_t chipid_and_omr[] = { 0x11, 0x02, 0x21, 0x43, |
43 | - ABI_TYPE val EXTRA_ARGS) | 109 | 0x09, 0x00, 0x00, 0x00 }; |
44 | -{ | 110 | |
45 | - ATOMIC_MMU_DECLS; | 111 | @@ -XXX,XX +XXX,XX @@ static void exynos4210_realize(DeviceState *socdev, Error **errp) |
46 | - DATA_TYPE *haddr = ATOMIC_MMU_LOOKUP; | 112 | sysbus_connect_irq(busdev, n, |
47 | - DATA_TYPE ldo, ldn, ret, sto; | 113 | qdev_get_gpio_in(DEVICE(&s->a9mpcore), n)); |
48 | - | 114 | } |
49 | - ldo = atomic_read__nocheck(haddr); | 115 | - exynos4210_combiner_get_gpioin(&s->irqs, DEVICE(&s->int_combiner), 0); |
50 | - while (1) { | 116 | sysbus_mmio_map(busdev, 0, EXYNOS4210_INT_COMBINER_BASE_ADDR); |
51 | - ret = BSWAP(ldo) + val; | 117 | |
52 | - sto = BSWAP(ret); | 118 | /* External Interrupt Combiner */ |
53 | - ldn = atomic_cmpxchg__nocheck(haddr, ldo, sto); | 119 | @@ -XXX,XX +XXX,XX @@ static void exynos4210_realize(DeviceState *socdev, Error **errp) |
54 | - if (ldn == ldo) { | 120 | for (n = 0; n < EXYNOS4210_MAX_INT_COMBINER_OUT_IRQ; n++) { |
55 | - ATOMIC_MMU_CLEANUP; | 121 | sysbus_connect_irq(busdev, n, qdev_get_gpio_in(DEVICE(&s->ext_gic), n)); |
56 | - return ret; | 122 | } |
57 | - } | 123 | - exynos4210_combiner_get_gpioin(&s->irqs, DEVICE(&s->ext_combiner), 1); |
58 | - ldo = ldn; | 124 | sysbus_mmio_map(busdev, 0, EXYNOS4210_EXT_COMBINER_BASE_ADDR); |
59 | - } | 125 | |
60 | -} | 126 | /* Initialize board IRQs. */ |
61 | - | ||
62 | /* These helpers are, as a whole, full barriers. Within the helper, | ||
63 | * the leading barrier is explicit and the trailing barrier is within | ||
64 | * cmpxchg primitive. | ||
65 | @@ -XXX,XX +XXX,XX @@ GEN_ATOMIC_HELPER_FN(umin_fetch, MIN, DATA_TYPE, new) | ||
66 | GEN_ATOMIC_HELPER_FN(smax_fetch, MAX, SDATA_TYPE, new) | ||
67 | GEN_ATOMIC_HELPER_FN(umax_fetch, MAX, DATA_TYPE, new) | ||
68 | |||
69 | +/* Note that for addition, we need to use a separate cmpxchg loop instead | ||
70 | + of bswaps for the reverse-host-endian helpers. */ | ||
71 | +#define ADD(X, Y) (X + Y) | ||
72 | +GEN_ATOMIC_HELPER_FN(fetch_add, ADD, DATA_TYPE, old) | ||
73 | +GEN_ATOMIC_HELPER_FN(add_fetch, ADD, DATA_TYPE, new) | ||
74 | +#undef ADD | ||
75 | + | ||
76 | #undef GEN_ATOMIC_HELPER_FN | ||
77 | #endif /* DATA_SIZE >= 16 */ | ||
78 | |||
79 | -- | 127 | -- |
80 | 2.17.0 | 128 | 2.25.1 |
81 | |||
82 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | From: Zongyuan Li <zongyuan.li@smartx.com> |
---|---|---|---|
2 | 2 | ||
3 | Given that this atomic operation will be used by both risc-v | 3 | Signed-off-by: Zongyuan Li <zongyuan.li@smartx.com> |
4 | and aarch64, let's not duplicate code across the two targets. | ||
5 | |||
6 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 4 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
7 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 5 | Message-id: 20220324181557.203805-2-zongyuan.li@smartx.com |
8 | Message-id: 20180508151437.4232-5-richard.henderson@linaro.org | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
10 | --- | 7 | --- |
11 | accel/tcg/atomic_template.h | 71 +++++++++++++++++++++++++++++++++++++ | 8 | hw/arm/realview.c | 33 ++++++++++++++++++++++++--------- |
12 | accel/tcg/tcg-runtime.h | 8 +++++ | 9 | 1 file changed, 24 insertions(+), 9 deletions(-) |
13 | tcg/tcg-op.h | 34 ++++++++++++++++++ | ||
14 | tcg/tcg.h | 8 +++++ | ||
15 | tcg/tcg-op.c | 8 +++++ | ||
16 | 5 files changed, 129 insertions(+) | ||
17 | 10 | ||
18 | diff --git a/accel/tcg/atomic_template.h b/accel/tcg/atomic_template.h | 11 | diff --git a/hw/arm/realview.c b/hw/arm/realview.c |
19 | index XXXXXXX..XXXXXXX 100644 | 12 | index XXXXXXX..XXXXXXX 100644 |
20 | --- a/accel/tcg/atomic_template.h | 13 | --- a/hw/arm/realview.c |
21 | +++ b/accel/tcg/atomic_template.h | 14 | +++ b/hw/arm/realview.c |
22 | @@ -XXX,XX +XXX,XX @@ | 15 | @@ -XXX,XX +XXX,XX @@ |
23 | #elif DATA_SIZE == 8 | 16 | #include "hw/sysbus.h" |
24 | # define SUFFIX q | 17 | #include "hw/arm/boot.h" |
25 | # define DATA_TYPE uint64_t | 18 | #include "hw/arm/primecell.h" |
26 | +# define SDATA_TYPE int64_t | 19 | +#include "hw/core/split-irq.h" |
27 | # define BSWAP bswap64 | 20 | #include "hw/net/lan9118.h" |
28 | #elif DATA_SIZE == 4 | 21 | #include "hw/net/smc91c111.h" |
29 | # define SUFFIX l | 22 | #include "hw/pci/pci.h" |
30 | # define DATA_TYPE uint32_t | 23 | +#include "hw/qdev-core.h" |
31 | +# define SDATA_TYPE int32_t | 24 | #include "net/net.h" |
32 | # define BSWAP bswap32 | 25 | #include "sysemu/sysemu.h" |
33 | #elif DATA_SIZE == 2 | 26 | #include "hw/boards.h" |
34 | # define SUFFIX w | 27 | @@ -XXX,XX +XXX,XX @@ static const int realview_board_id[] = { |
35 | # define DATA_TYPE uint16_t | 28 | 0x76d |
36 | +# define SDATA_TYPE int16_t | 29 | }; |
37 | # define BSWAP bswap16 | 30 | |
38 | #elif DATA_SIZE == 1 | 31 | +static void split_irq_from_named(DeviceState *src, const char* outname, |
39 | # define SUFFIX b | 32 | + qemu_irq out1, qemu_irq out2) { |
40 | # define DATA_TYPE uint8_t | 33 | + DeviceState *splitter = qdev_new(TYPE_SPLIT_IRQ); |
41 | +# define SDATA_TYPE int8_t | ||
42 | # define BSWAP | ||
43 | #else | ||
44 | # error unsupported data size | ||
45 | @@ -XXX,XX +XXX,XX @@ GEN_ATOMIC_HELPER(or_fetch) | ||
46 | GEN_ATOMIC_HELPER(xor_fetch) | ||
47 | |||
48 | #undef GEN_ATOMIC_HELPER | ||
49 | + | 34 | + |
50 | +/* These helpers are, as a whole, full barriers. Within the helper, | 35 | + qdev_prop_set_uint32(splitter, "num-lines", 2); |
51 | + * the leading barrier is explicit and the trailing barrier is within | 36 | + |
52 | + * cmpxchg primitive. | 37 | + qdev_realize_and_unref(splitter, NULL, &error_fatal); |
53 | + */ | 38 | + |
54 | +#define GEN_ATOMIC_HELPER_FN(X, FN, XDATA_TYPE, RET) \ | 39 | + qdev_connect_gpio_out(splitter, 0, out1); |
55 | +ABI_TYPE ATOMIC_NAME(X)(CPUArchState *env, target_ulong addr, \ | 40 | + qdev_connect_gpio_out(splitter, 1, out2); |
56 | + ABI_TYPE xval EXTRA_ARGS) \ | 41 | + qdev_connect_gpio_out_named(src, outname, 0, |
57 | +{ \ | 42 | + qdev_get_gpio_in(splitter, 0)); |
58 | + ATOMIC_MMU_DECLS; \ | ||
59 | + XDATA_TYPE *haddr = ATOMIC_MMU_LOOKUP; \ | ||
60 | + XDATA_TYPE cmp, old, new, val = xval; \ | ||
61 | + smp_mb(); \ | ||
62 | + cmp = atomic_read__nocheck(haddr); \ | ||
63 | + do { \ | ||
64 | + old = cmp; new = FN(old, val); \ | ||
65 | + cmp = atomic_cmpxchg__nocheck(haddr, old, new); \ | ||
66 | + } while (cmp != old); \ | ||
67 | + ATOMIC_MMU_CLEANUP; \ | ||
68 | + return RET; \ | ||
69 | +} | 43 | +} |
70 | + | 44 | + |
71 | +GEN_ATOMIC_HELPER_FN(fetch_smin, MIN, SDATA_TYPE, old) | 45 | static void realview_init(MachineState *machine, |
72 | +GEN_ATOMIC_HELPER_FN(fetch_umin, MIN, DATA_TYPE, old) | 46 | enum realview_board_type board_type) |
73 | +GEN_ATOMIC_HELPER_FN(fetch_smax, MAX, SDATA_TYPE, old) | 47 | { |
74 | +GEN_ATOMIC_HELPER_FN(fetch_umax, MAX, DATA_TYPE, old) | 48 | @@ -XXX,XX +XXX,XX @@ static void realview_init(MachineState *machine, |
49 | DeviceState *dev, *sysctl, *gpio2, *pl041; | ||
50 | SysBusDevice *busdev; | ||
51 | qemu_irq pic[64]; | ||
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 | */ | ||
60 | - mmc_irq[0] = qemu_irq_split( | ||
61 | - qdev_get_gpio_in(sysctl, ARM_SYSCTL_GPIO_MMC_WPROT), | ||
62 | - qdev_get_gpio_in(gpio2, 1)); | ||
63 | - mmc_irq[1] = qemu_irq_split( | ||
64 | - qdev_get_gpio_in(sysctl, ARM_SYSCTL_GPIO_MMC_CARDIN), | ||
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)); | ||
75 | + | 71 | + |
76 | +GEN_ATOMIC_HELPER_FN(smin_fetch, MIN, SDATA_TYPE, new) | 72 | + split_irq_from_named(dev, "card-inserted", |
77 | +GEN_ATOMIC_HELPER_FN(umin_fetch, MIN, DATA_TYPE, new) | 73 | + qdev_get_gpio_in(sysctl, ARM_SYSCTL_GPIO_MMC_CARDIN), |
78 | +GEN_ATOMIC_HELPER_FN(smax_fetch, MAX, SDATA_TYPE, new) | 74 | + qemu_irq_invert(qdev_get_gpio_in(gpio2, 0))); |
79 | +GEN_ATOMIC_HELPER_FN(umax_fetch, MAX, DATA_TYPE, new) | ||
80 | + | 75 | + |
81 | +#undef GEN_ATOMIC_HELPER_FN | 76 | dinfo = drive_get(IF_SD, 0, 0); |
82 | #endif /* DATA SIZE >= 16 */ | 77 | if (dinfo) { |
83 | 78 | DeviceState *card; | |
84 | #undef END | ||
85 | @@ -XXX,XX +XXX,XX @@ ABI_TYPE ATOMIC_NAME(add_fetch)(CPUArchState *env, target_ulong addr, | ||
86 | ldo = ldn; | ||
87 | } | ||
88 | } | ||
89 | + | ||
90 | +/* These helpers are, as a whole, full barriers. Within the helper, | ||
91 | + * the leading barrier is explicit and the trailing barrier is within | ||
92 | + * cmpxchg primitive. | ||
93 | + */ | ||
94 | +#define GEN_ATOMIC_HELPER_FN(X, FN, XDATA_TYPE, RET) \ | ||
95 | +ABI_TYPE ATOMIC_NAME(X)(CPUArchState *env, target_ulong addr, \ | ||
96 | + ABI_TYPE xval EXTRA_ARGS) \ | ||
97 | +{ \ | ||
98 | + ATOMIC_MMU_DECLS; \ | ||
99 | + XDATA_TYPE *haddr = ATOMIC_MMU_LOOKUP; \ | ||
100 | + XDATA_TYPE ldo, ldn, old, new, val = xval; \ | ||
101 | + smp_mb(); \ | ||
102 | + ldn = atomic_read__nocheck(haddr); \ | ||
103 | + do { \ | ||
104 | + ldo = ldn; old = BSWAP(ldo); new = FN(old, val); \ | ||
105 | + ldn = atomic_cmpxchg__nocheck(haddr, ldo, BSWAP(new)); \ | ||
106 | + } while (ldo != ldn); \ | ||
107 | + ATOMIC_MMU_CLEANUP; \ | ||
108 | + return RET; \ | ||
109 | +} | ||
110 | + | ||
111 | +GEN_ATOMIC_HELPER_FN(fetch_smin, MIN, SDATA_TYPE, old) | ||
112 | +GEN_ATOMIC_HELPER_FN(fetch_umin, MIN, DATA_TYPE, old) | ||
113 | +GEN_ATOMIC_HELPER_FN(fetch_smax, MAX, SDATA_TYPE, old) | ||
114 | +GEN_ATOMIC_HELPER_FN(fetch_umax, MAX, DATA_TYPE, old) | ||
115 | + | ||
116 | +GEN_ATOMIC_HELPER_FN(smin_fetch, MIN, SDATA_TYPE, new) | ||
117 | +GEN_ATOMIC_HELPER_FN(umin_fetch, MIN, DATA_TYPE, new) | ||
118 | +GEN_ATOMIC_HELPER_FN(smax_fetch, MAX, SDATA_TYPE, new) | ||
119 | +GEN_ATOMIC_HELPER_FN(umax_fetch, MAX, DATA_TYPE, new) | ||
120 | + | ||
121 | +#undef GEN_ATOMIC_HELPER_FN | ||
122 | #endif /* DATA_SIZE >= 16 */ | ||
123 | |||
124 | #undef END | ||
125 | @@ -XXX,XX +XXX,XX @@ ABI_TYPE ATOMIC_NAME(add_fetch)(CPUArchState *env, target_ulong addr, | ||
126 | #undef BSWAP | ||
127 | #undef ABI_TYPE | ||
128 | #undef DATA_TYPE | ||
129 | +#undef SDATA_TYPE | ||
130 | #undef SUFFIX | ||
131 | #undef DATA_SIZE | ||
132 | diff --git a/accel/tcg/tcg-runtime.h b/accel/tcg/tcg-runtime.h | ||
133 | index XXXXXXX..XXXXXXX 100644 | ||
134 | --- a/accel/tcg/tcg-runtime.h | ||
135 | +++ b/accel/tcg/tcg-runtime.h | ||
136 | @@ -XXX,XX +XXX,XX @@ GEN_ATOMIC_HELPERS(fetch_add) | ||
137 | GEN_ATOMIC_HELPERS(fetch_and) | ||
138 | GEN_ATOMIC_HELPERS(fetch_or) | ||
139 | GEN_ATOMIC_HELPERS(fetch_xor) | ||
140 | +GEN_ATOMIC_HELPERS(fetch_smin) | ||
141 | +GEN_ATOMIC_HELPERS(fetch_umin) | ||
142 | +GEN_ATOMIC_HELPERS(fetch_smax) | ||
143 | +GEN_ATOMIC_HELPERS(fetch_umax) | ||
144 | |||
145 | GEN_ATOMIC_HELPERS(add_fetch) | ||
146 | GEN_ATOMIC_HELPERS(and_fetch) | ||
147 | GEN_ATOMIC_HELPERS(or_fetch) | ||
148 | GEN_ATOMIC_HELPERS(xor_fetch) | ||
149 | +GEN_ATOMIC_HELPERS(smin_fetch) | ||
150 | +GEN_ATOMIC_HELPERS(umin_fetch) | ||
151 | +GEN_ATOMIC_HELPERS(smax_fetch) | ||
152 | +GEN_ATOMIC_HELPERS(umax_fetch) | ||
153 | |||
154 | GEN_ATOMIC_HELPERS(xchg) | ||
155 | |||
156 | diff --git a/tcg/tcg-op.h b/tcg/tcg-op.h | ||
157 | index XXXXXXX..XXXXXXX 100644 | ||
158 | --- a/tcg/tcg-op.h | ||
159 | +++ b/tcg/tcg-op.h | ||
160 | @@ -XXX,XX +XXX,XX @@ void tcg_gen_atomic_cmpxchg_i64(TCGv_i64, TCGv, TCGv_i64, TCGv_i64, | ||
161 | |||
162 | void tcg_gen_atomic_xchg_i32(TCGv_i32, TCGv, TCGv_i32, TCGArg, TCGMemOp); | ||
163 | void tcg_gen_atomic_xchg_i64(TCGv_i64, TCGv, TCGv_i64, TCGArg, TCGMemOp); | ||
164 | + | ||
165 | void tcg_gen_atomic_fetch_add_i32(TCGv_i32, TCGv, TCGv_i32, TCGArg, TCGMemOp); | ||
166 | void tcg_gen_atomic_fetch_add_i64(TCGv_i64, TCGv, TCGv_i64, TCGArg, TCGMemOp); | ||
167 | void tcg_gen_atomic_fetch_and_i32(TCGv_i32, TCGv, TCGv_i32, TCGArg, TCGMemOp); | ||
168 | @@ -XXX,XX +XXX,XX @@ void tcg_gen_atomic_fetch_or_i32(TCGv_i32, TCGv, TCGv_i32, TCGArg, TCGMemOp); | ||
169 | void tcg_gen_atomic_fetch_or_i64(TCGv_i64, TCGv, TCGv_i64, TCGArg, TCGMemOp); | ||
170 | void tcg_gen_atomic_fetch_xor_i32(TCGv_i32, TCGv, TCGv_i32, TCGArg, TCGMemOp); | ||
171 | void tcg_gen_atomic_fetch_xor_i64(TCGv_i64, TCGv, TCGv_i64, TCGArg, TCGMemOp); | ||
172 | +void tcg_gen_atomic_fetch_smin_i32(TCGv_i32, TCGv, TCGv_i32, TCGArg, TCGMemOp); | ||
173 | +void tcg_gen_atomic_fetch_smin_i64(TCGv_i64, TCGv, TCGv_i64, TCGArg, TCGMemOp); | ||
174 | +void tcg_gen_atomic_fetch_umin_i32(TCGv_i32, TCGv, TCGv_i32, TCGArg, TCGMemOp); | ||
175 | +void tcg_gen_atomic_fetch_umin_i64(TCGv_i64, TCGv, TCGv_i64, TCGArg, TCGMemOp); | ||
176 | +void tcg_gen_atomic_fetch_smax_i32(TCGv_i32, TCGv, TCGv_i32, TCGArg, TCGMemOp); | ||
177 | +void tcg_gen_atomic_fetch_smax_i64(TCGv_i64, TCGv, TCGv_i64, TCGArg, TCGMemOp); | ||
178 | +void tcg_gen_atomic_fetch_umax_i32(TCGv_i32, TCGv, TCGv_i32, TCGArg, TCGMemOp); | ||
179 | +void tcg_gen_atomic_fetch_umax_i64(TCGv_i64, TCGv, TCGv_i64, TCGArg, TCGMemOp); | ||
180 | + | ||
181 | void tcg_gen_atomic_add_fetch_i32(TCGv_i32, TCGv, TCGv_i32, TCGArg, TCGMemOp); | ||
182 | void tcg_gen_atomic_add_fetch_i64(TCGv_i64, TCGv, TCGv_i64, TCGArg, TCGMemOp); | ||
183 | void tcg_gen_atomic_and_fetch_i32(TCGv_i32, TCGv, TCGv_i32, TCGArg, TCGMemOp); | ||
184 | @@ -XXX,XX +XXX,XX @@ void tcg_gen_atomic_or_fetch_i32(TCGv_i32, TCGv, TCGv_i32, TCGArg, TCGMemOp); | ||
185 | void tcg_gen_atomic_or_fetch_i64(TCGv_i64, TCGv, TCGv_i64, TCGArg, TCGMemOp); | ||
186 | void tcg_gen_atomic_xor_fetch_i32(TCGv_i32, TCGv, TCGv_i32, TCGArg, TCGMemOp); | ||
187 | void tcg_gen_atomic_xor_fetch_i64(TCGv_i64, TCGv, TCGv_i64, TCGArg, TCGMemOp); | ||
188 | +void tcg_gen_atomic_smin_fetch_i32(TCGv_i32, TCGv, TCGv_i32, TCGArg, TCGMemOp); | ||
189 | +void tcg_gen_atomic_smin_fetch_i64(TCGv_i64, TCGv, TCGv_i64, TCGArg, TCGMemOp); | ||
190 | +void tcg_gen_atomic_umin_fetch_i32(TCGv_i32, TCGv, TCGv_i32, TCGArg, TCGMemOp); | ||
191 | +void tcg_gen_atomic_umin_fetch_i64(TCGv_i64, TCGv, TCGv_i64, TCGArg, TCGMemOp); | ||
192 | +void tcg_gen_atomic_smax_fetch_i32(TCGv_i32, TCGv, TCGv_i32, TCGArg, TCGMemOp); | ||
193 | +void tcg_gen_atomic_smax_fetch_i64(TCGv_i64, TCGv, TCGv_i64, TCGArg, TCGMemOp); | ||
194 | +void tcg_gen_atomic_umax_fetch_i32(TCGv_i32, TCGv, TCGv_i32, TCGArg, TCGMemOp); | ||
195 | +void tcg_gen_atomic_umax_fetch_i64(TCGv_i64, TCGv, TCGv_i64, TCGArg, TCGMemOp); | ||
196 | |||
197 | void tcg_gen_mov_vec(TCGv_vec, TCGv_vec); | ||
198 | void tcg_gen_dup_i32_vec(unsigned vece, TCGv_vec, TCGv_i32); | ||
199 | @@ -XXX,XX +XXX,XX @@ void tcg_gen_stl_vec(TCGv_vec r, TCGv_ptr base, TCGArg offset, TCGType t); | ||
200 | #define tcg_gen_atomic_fetch_and_tl tcg_gen_atomic_fetch_and_i64 | ||
201 | #define tcg_gen_atomic_fetch_or_tl tcg_gen_atomic_fetch_or_i64 | ||
202 | #define tcg_gen_atomic_fetch_xor_tl tcg_gen_atomic_fetch_xor_i64 | ||
203 | +#define tcg_gen_atomic_fetch_smin_tl tcg_gen_atomic_fetch_smin_i64 | ||
204 | +#define tcg_gen_atomic_fetch_umin_tl tcg_gen_atomic_fetch_umin_i64 | ||
205 | +#define tcg_gen_atomic_fetch_smax_tl tcg_gen_atomic_fetch_smax_i64 | ||
206 | +#define tcg_gen_atomic_fetch_umax_tl tcg_gen_atomic_fetch_umax_i64 | ||
207 | #define tcg_gen_atomic_add_fetch_tl tcg_gen_atomic_add_fetch_i64 | ||
208 | #define tcg_gen_atomic_and_fetch_tl tcg_gen_atomic_and_fetch_i64 | ||
209 | #define tcg_gen_atomic_or_fetch_tl tcg_gen_atomic_or_fetch_i64 | ||
210 | #define tcg_gen_atomic_xor_fetch_tl tcg_gen_atomic_xor_fetch_i64 | ||
211 | +#define tcg_gen_atomic_smin_fetch_tl tcg_gen_atomic_smin_fetch_i64 | ||
212 | +#define tcg_gen_atomic_umin_fetch_tl tcg_gen_atomic_umin_fetch_i64 | ||
213 | +#define tcg_gen_atomic_smax_fetch_tl tcg_gen_atomic_smax_fetch_i64 | ||
214 | +#define tcg_gen_atomic_umax_fetch_tl tcg_gen_atomic_umax_fetch_i64 | ||
215 | #define tcg_gen_dup_tl_vec tcg_gen_dup_i64_vec | ||
216 | #else | ||
217 | #define tcg_gen_movi_tl tcg_gen_movi_i32 | ||
218 | @@ -XXX,XX +XXX,XX @@ void tcg_gen_stl_vec(TCGv_vec r, TCGv_ptr base, TCGArg offset, TCGType t); | ||
219 | #define tcg_gen_atomic_fetch_and_tl tcg_gen_atomic_fetch_and_i32 | ||
220 | #define tcg_gen_atomic_fetch_or_tl tcg_gen_atomic_fetch_or_i32 | ||
221 | #define tcg_gen_atomic_fetch_xor_tl tcg_gen_atomic_fetch_xor_i32 | ||
222 | +#define tcg_gen_atomic_fetch_smin_tl tcg_gen_atomic_fetch_smin_i32 | ||
223 | +#define tcg_gen_atomic_fetch_umin_tl tcg_gen_atomic_fetch_umin_i32 | ||
224 | +#define tcg_gen_atomic_fetch_smax_tl tcg_gen_atomic_fetch_smax_i32 | ||
225 | +#define tcg_gen_atomic_fetch_umax_tl tcg_gen_atomic_fetch_umax_i32 | ||
226 | #define tcg_gen_atomic_add_fetch_tl tcg_gen_atomic_add_fetch_i32 | ||
227 | #define tcg_gen_atomic_and_fetch_tl tcg_gen_atomic_and_fetch_i32 | ||
228 | #define tcg_gen_atomic_or_fetch_tl tcg_gen_atomic_or_fetch_i32 | ||
229 | #define tcg_gen_atomic_xor_fetch_tl tcg_gen_atomic_xor_fetch_i32 | ||
230 | +#define tcg_gen_atomic_smin_fetch_tl tcg_gen_atomic_smin_fetch_i32 | ||
231 | +#define tcg_gen_atomic_umin_fetch_tl tcg_gen_atomic_umin_fetch_i32 | ||
232 | +#define tcg_gen_atomic_smax_fetch_tl tcg_gen_atomic_smax_fetch_i32 | ||
233 | +#define tcg_gen_atomic_umax_fetch_tl tcg_gen_atomic_umax_fetch_i32 | ||
234 | #define tcg_gen_dup_tl_vec tcg_gen_dup_i32_vec | ||
235 | #endif | ||
236 | |||
237 | diff --git a/tcg/tcg.h b/tcg/tcg.h | ||
238 | index XXXXXXX..XXXXXXX 100644 | ||
239 | --- a/tcg/tcg.h | ||
240 | +++ b/tcg/tcg.h | ||
241 | @@ -XXX,XX +XXX,XX @@ GEN_ATOMIC_HELPER_ALL(fetch_sub) | ||
242 | GEN_ATOMIC_HELPER_ALL(fetch_and) | ||
243 | GEN_ATOMIC_HELPER_ALL(fetch_or) | ||
244 | GEN_ATOMIC_HELPER_ALL(fetch_xor) | ||
245 | +GEN_ATOMIC_HELPER_ALL(fetch_smin) | ||
246 | +GEN_ATOMIC_HELPER_ALL(fetch_umin) | ||
247 | +GEN_ATOMIC_HELPER_ALL(fetch_smax) | ||
248 | +GEN_ATOMIC_HELPER_ALL(fetch_umax) | ||
249 | |||
250 | GEN_ATOMIC_HELPER_ALL(add_fetch) | ||
251 | GEN_ATOMIC_HELPER_ALL(sub_fetch) | ||
252 | GEN_ATOMIC_HELPER_ALL(and_fetch) | ||
253 | GEN_ATOMIC_HELPER_ALL(or_fetch) | ||
254 | GEN_ATOMIC_HELPER_ALL(xor_fetch) | ||
255 | +GEN_ATOMIC_HELPER_ALL(smin_fetch) | ||
256 | +GEN_ATOMIC_HELPER_ALL(umin_fetch) | ||
257 | +GEN_ATOMIC_HELPER_ALL(smax_fetch) | ||
258 | +GEN_ATOMIC_HELPER_ALL(umax_fetch) | ||
259 | |||
260 | GEN_ATOMIC_HELPER_ALL(xchg) | ||
261 | |||
262 | diff --git a/tcg/tcg-op.c b/tcg/tcg-op.c | ||
263 | index XXXXXXX..XXXXXXX 100644 | ||
264 | --- a/tcg/tcg-op.c | ||
265 | +++ b/tcg/tcg-op.c | ||
266 | @@ -XXX,XX +XXX,XX @@ GEN_ATOMIC_HELPER(fetch_add, add, 0) | ||
267 | GEN_ATOMIC_HELPER(fetch_and, and, 0) | ||
268 | GEN_ATOMIC_HELPER(fetch_or, or, 0) | ||
269 | GEN_ATOMIC_HELPER(fetch_xor, xor, 0) | ||
270 | +GEN_ATOMIC_HELPER(fetch_smin, smin, 0) | ||
271 | +GEN_ATOMIC_HELPER(fetch_umin, umin, 0) | ||
272 | +GEN_ATOMIC_HELPER(fetch_smax, smax, 0) | ||
273 | +GEN_ATOMIC_HELPER(fetch_umax, umax, 0) | ||
274 | |||
275 | GEN_ATOMIC_HELPER(add_fetch, add, 1) | ||
276 | GEN_ATOMIC_HELPER(and_fetch, and, 1) | ||
277 | GEN_ATOMIC_HELPER(or_fetch, or, 1) | ||
278 | GEN_ATOMIC_HELPER(xor_fetch, xor, 1) | ||
279 | +GEN_ATOMIC_HELPER(smin_fetch, smin, 1) | ||
280 | +GEN_ATOMIC_HELPER(umin_fetch, umin, 1) | ||
281 | +GEN_ATOMIC_HELPER(smax_fetch, smax, 1) | ||
282 | +GEN_ATOMIC_HELPER(umax_fetch, umax, 1) | ||
283 | |||
284 | static void tcg_gen_mov2_i32(TCGv_i32 r, TCGv_i32 a, TCGv_i32 b) | ||
285 | { | ||
286 | -- | 79 | -- |
287 | 2.17.0 | 80 | 2.25.1 |
288 | |||
289 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | From: Zongyuan Li <zongyuan.li@smartx.com> |
---|---|---|---|
2 | 2 | ||
3 | Signed-off-by: Zongyuan Li <zongyuan.li@smartx.com> | ||
3 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 4 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
4 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 5 | Message-id: 20220324181557.203805-3-zongyuan.li@smartx.com |
5 | Message-id: 20180508151437.4232-11-richard.henderson@linaro.org | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
7 | --- | 7 | --- |
8 | target/arm/cpu64.c | 1 + | 8 | hw/arm/stellaris.c | 15 +++++++++++++-- |
9 | 1 file changed, 1 insertion(+) | 9 | 1 file changed, 13 insertions(+), 2 deletions(-) |
10 | 10 | ||
11 | diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c | 11 | diff --git a/hw/arm/stellaris.c b/hw/arm/stellaris.c |
12 | index XXXXXXX..XXXXXXX 100644 | 12 | index XXXXXXX..XXXXXXX 100644 |
13 | --- a/target/arm/cpu64.c | 13 | --- a/hw/arm/stellaris.c |
14 | +++ b/target/arm/cpu64.c | 14 | +++ b/hw/arm/stellaris.c |
15 | @@ -XXX,XX +XXX,XX @@ static void aarch64_max_initfn(Object *obj) | 15 | @@ -XXX,XX +XXX,XX @@ |
16 | set_feature(&cpu->env, ARM_FEATURE_V8_SM4); | 16 | |
17 | set_feature(&cpu->env, ARM_FEATURE_V8_PMULL); | 17 | #include "qemu/osdep.h" |
18 | set_feature(&cpu->env, ARM_FEATURE_CRC); | 18 | #include "qapi/error.h" |
19 | + set_feature(&cpu->env, ARM_FEATURE_V8_ATOMICS); | 19 | +#include "hw/core/split-irq.h" |
20 | set_feature(&cpu->env, ARM_FEATURE_V8_RDM); | 20 | #include "hw/sysbus.h" |
21 | set_feature(&cpu->env, ARM_FEATURE_V8_FP16); | 21 | #include "hw/sd/sd.h" |
22 | set_feature(&cpu->env, ARM_FEATURE_V8_FCMA); | 22 | #include "hw/ssi/ssi.h" |
23 | @@ -XXX,XX +XXX,XX @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board) | ||
24 | DeviceState *ssddev; | ||
25 | DriveInfo *dinfo; | ||
26 | DeviceState *carddev; | ||
27 | + DeviceState *gpio_d_splitter; | ||
28 | BlockBackend *blk; | ||
29 | |||
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. */ | ||
23 | -- | 52 | -- |
24 | 2.17.0 | 53 | 2.25.1 |
25 | |||
26 | diff view generated by jsdifflib |
1 | From: Igor Mammedov <imammedo@redhat.com> | 1 | From: Zongyuan Li <zongyuan.li@smartx.com> |
---|---|---|---|
2 | 2 | ||
3 | load_dtb() depends on arm_load_kernel() to figure out place | 3 | Signed-off-by: Zongyuan Li <zongyuan.li@smartx.com> |
4 | in RAM where it should be loaded, but it's not required for | 4 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
5 | arm_load_kernel() to work. Sometimes it's neccesary for | 5 | Message-id: 20220324181557.203805-5-zongyuan.li@smartx.com |
6 | devices added with -device/device_add to be enumerated in | 6 | Resolves: https://gitlab.com/qemu-project/qemu/-/issues/811 |
7 | DTB as well, which's lead to [1] and surrounding commits to | ||
8 | add 2 more machine_done notifiers with non obvious ordering | ||
9 | to make dynamic sysbus devices initialization happen in | ||
10 | the right order. | ||
11 | |||
12 | However instead of moving whole arm_load_kernel() in to | ||
13 | machine_done, it's sufficient to move only load_dtb() into | ||
14 | virt_machine_done() notifier and remove ArmLoadKernelNotifier/ | ||
15 | /PlatformBusFDTNotifierParams notifiers, which saves us ~90LOC | ||
16 | and simplifies code flow quite a bit. | ||
17 | Later would allow to consolidate DTB generation within one | ||
18 | function for 'mach-virt' board and make it reentrant so it | ||
19 | could generate updated DTB in device hotplug secenarios. | ||
20 | |||
21 | While at it rename load_dtb() to arm_load_dtb() since it's | ||
22 | public now. | ||
23 | |||
24 | Add additional field skip_dtb_autoload to struct arm_boot_info | ||
25 | to allow manual DTB load later in mach-virt and to avoid touching | ||
26 | all other boards to explicitly call arm_load_dtb(). | ||
27 | |||
28 | 1) (ac9d32e hw/arm/boot: arm_load_kernel implemented as a machine init done notifier) | ||
29 | |||
30 | Signed-off-by: Igor Mammedov <imammedo@redhat.com> | ||
31 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
32 | Reviewed-by: Andrew Jones <drjones@redhat.com> | ||
33 | Message-id: 1525691524-32265-4-git-send-email-imammedo@redhat.com | ||
34 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
35 | --- | 8 | --- |
36 | include/hw/arm/arm.h | 45 +++++++++++++++++------ | 9 | include/hw/irq.h | 5 ----- |
37 | include/hw/arm/sysbus-fdt.h | 37 ++++--------------- | 10 | hw/core/irq.c | 15 --------------- |
38 | hw/arm/boot.c | 72 ++++++++++--------------------------- | 11 | 2 files changed, 20 deletions(-) |
39 | hw/arm/sysbus-fdt.c | 61 +++---------------------------- | ||
40 | hw/arm/virt.c | 64 ++++++++++++++++----------------- | ||
41 | 5 files changed, 94 insertions(+), 185 deletions(-) | ||
42 | 12 | ||
43 | diff --git a/include/hw/arm/arm.h b/include/hw/arm/arm.h | 13 | diff --git a/include/hw/irq.h b/include/hw/irq.h |
44 | index XXXXXXX..XXXXXXX 100644 | 14 | index XXXXXXX..XXXXXXX 100644 |
45 | --- a/include/hw/arm/arm.h | 15 | --- a/include/hw/irq.h |
46 | +++ b/include/hw/arm/arm.h | 16 | +++ b/include/hw/irq.h |
47 | @@ -XXX,XX +XXX,XX @@ DeviceState *armv7m_init(MemoryRegion *system_memory, int mem_size, int num_irq, | 17 | @@ -XXX,XX +XXX,XX @@ void qemu_free_irq(qemu_irq irq); |
48 | */ | 18 | /* Returns a new IRQ with opposite polarity. */ |
49 | void armv7m_load_kernel(ARMCPU *cpu, const char *kernel_filename, int mem_size); | 19 | qemu_irq qemu_irq_invert(qemu_irq irq); |
50 | 20 | ||
51 | -/* | 21 | -/* Returns a new IRQ which feeds into both the passed IRQs. |
52 | - * struct used as a parameter of the arm_load_kernel machine init | 22 | - * It's probably better to use the TYPE_SPLIT_IRQ device instead. |
53 | - * done notifier | ||
54 | - */ | 23 | - */ |
55 | -typedef struct { | 24 | -qemu_irq qemu_irq_split(qemu_irq irq1, qemu_irq irq2); |
56 | - Notifier notifier; /* actual notifier */ | ||
57 | - ARMCPU *cpu; /* handle to the first cpu object */ | ||
58 | -} ArmLoadKernelNotifier; | ||
59 | - | 25 | - |
60 | /* arm_boot.c */ | 26 | /* For internal use in qtest. Similar to qemu_irq_split, but operating |
61 | struct arm_boot_info { | 27 | on an existing vector of qemu_irq. */ |
62 | uint64_t ram_size; | 28 | void qemu_irq_intercept_in(qemu_irq *gpio_in, qemu_irq_handler handler, int n); |
63 | @@ -XXX,XX +XXX,XX @@ struct arm_boot_info { | 29 | diff --git a/hw/core/irq.c b/hw/core/irq.c |
64 | const char *initrd_filename; | ||
65 | const char *dtb_filename; | ||
66 | hwaddr loader_start; | ||
67 | + hwaddr dtb_start; | ||
68 | + hwaddr dtb_limit; | ||
69 | + /* If set to True, arm_load_kernel() will not load DTB. | ||
70 | + * It allows board to load DTB manually later. | ||
71 | + * (default: False) | ||
72 | + */ | ||
73 | + bool skip_dtb_autoload; | ||
74 | /* multicore boards that use the default secondary core boot functions | ||
75 | * need to put the address of the secondary boot code, the boot reg, | ||
76 | * and the GIC address in the next 3 values, respectively. boards that | ||
77 | @@ -XXX,XX +XXX,XX @@ struct arm_boot_info { | ||
78 | * the user it should implement this hook. | ||
79 | */ | ||
80 | void (*modify_dtb)(const struct arm_boot_info *info, void *fdt); | ||
81 | - /* machine init done notifier executing arm_load_dtb */ | ||
82 | - ArmLoadKernelNotifier load_kernel_notifier; | ||
83 | /* Used internally by arm_boot.c */ | ||
84 | int is_linux; | ||
85 | hwaddr initrd_start; | ||
86 | @@ -XXX,XX +XXX,XX @@ struct arm_boot_info { | ||
87 | */ | ||
88 | void arm_load_kernel(ARMCPU *cpu, struct arm_boot_info *info); | ||
89 | |||
90 | +AddressSpace *arm_boot_address_space(ARMCPU *cpu, | ||
91 | + const struct arm_boot_info *info); | ||
92 | + | ||
93 | +/** | ||
94 | + * arm_load_dtb() - load a device tree binary image into memory | ||
95 | + * @addr: the address to load the image at | ||
96 | + * @binfo: struct describing the boot environment | ||
97 | + * @addr_limit: upper limit of the available memory area at @addr | ||
98 | + * @as: address space to load image to | ||
99 | + * | ||
100 | + * Load a device tree supplied by the machine or by the user with the | ||
101 | + * '-dtb' command line option, and put it at offset @addr in target | ||
102 | + * memory. | ||
103 | + * | ||
104 | + * If @addr_limit contains a meaningful value (i.e., it is strictly greater | ||
105 | + * than @addr), the device tree is only loaded if its size does not exceed | ||
106 | + * the limit. | ||
107 | + * | ||
108 | + * Returns: the size of the device tree image on success, | ||
109 | + * 0 if the image size exceeds the limit, | ||
110 | + * -1 on errors. | ||
111 | + * | ||
112 | + * Note: Must not be called unless have_dtb(binfo) is true. | ||
113 | + */ | ||
114 | +int arm_load_dtb(hwaddr addr, const struct arm_boot_info *binfo, | ||
115 | + hwaddr addr_limit, AddressSpace *as); | ||
116 | + | ||
117 | /* Write a secure board setup routine with a dummy handler for SMCs */ | ||
118 | void arm_write_secure_board_setup_dummy_smc(ARMCPU *cpu, | ||
119 | const struct arm_boot_info *info, | ||
120 | diff --git a/include/hw/arm/sysbus-fdt.h b/include/hw/arm/sysbus-fdt.h | ||
121 | index XXXXXXX..XXXXXXX 100644 | 30 | index XXXXXXX..XXXXXXX 100644 |
122 | --- a/include/hw/arm/sysbus-fdt.h | 31 | --- a/hw/core/irq.c |
123 | +++ b/include/hw/arm/sysbus-fdt.h | 32 | +++ b/hw/core/irq.c |
124 | @@ -XXX,XX +XXX,XX @@ | 33 | @@ -XXX,XX +XXX,XX @@ qemu_irq qemu_irq_invert(qemu_irq irq) |
125 | #ifndef HW_ARM_SYSBUS_FDT_H | 34 | return qemu_allocate_irq(qemu_notirq, irq, 0); |
126 | #define HW_ARM_SYSBUS_FDT_H | ||
127 | |||
128 | -#include "hw/arm/arm.h" | ||
129 | -#include "qemu-common.h" | ||
130 | -#include "hw/sysbus.h" | ||
131 | - | ||
132 | -/* | ||
133 | - * struct that contains dimensioning parameters of the platform bus | ||
134 | - */ | ||
135 | -typedef struct { | ||
136 | - hwaddr platform_bus_base; /* start address of the bus */ | ||
137 | - hwaddr platform_bus_size; /* size of the bus */ | ||
138 | - int platform_bus_first_irq; /* first hwirq assigned to the bus */ | ||
139 | - int platform_bus_num_irqs; /* number of hwirq assigned to the bus */ | ||
140 | -} ARMPlatformBusSystemParams; | ||
141 | - | ||
142 | -/* | ||
143 | - * struct that contains all relevant info to build the fdt nodes of | ||
144 | - * platform bus and attached dynamic sysbus devices | ||
145 | - * in the future might be augmented with additional info | ||
146 | - * such as PHY, CLK handles ... | ||
147 | - */ | ||
148 | -typedef struct { | ||
149 | - const ARMPlatformBusSystemParams *system_params; | ||
150 | - struct arm_boot_info *binfo; | ||
151 | - const char *intc; /* parent interrupt controller name */ | ||
152 | -} ARMPlatformBusFDTParams; | ||
153 | +#include "exec/hwaddr.h" | ||
154 | |||
155 | /** | ||
156 | - * arm_register_platform_bus_fdt_creator - register a machine init done | ||
157 | - * notifier that creates the device tree nodes of the platform bus and | ||
158 | - * associated dynamic sysbus devices | ||
159 | + * platform_bus_add_all_fdt_nodes - create all the platform bus nodes | ||
160 | + * | ||
161 | + * builds the parent platform bus node and all the nodes of dynamic | ||
162 | + * sysbus devices attached to it. | ||
163 | */ | ||
164 | -void arm_register_platform_bus_fdt_creator(ARMPlatformBusFDTParams *fdt_params); | ||
165 | - | ||
166 | +void platform_bus_add_all_fdt_nodes(void *fdt, const char *intc, hwaddr addr, | ||
167 | + hwaddr bus_size, int irq_start); | ||
168 | #endif | ||
169 | diff --git a/hw/arm/boot.c b/hw/arm/boot.c | ||
170 | index XXXXXXX..XXXXXXX 100644 | ||
171 | --- a/hw/arm/boot.c | ||
172 | +++ b/hw/arm/boot.c | ||
173 | @@ -XXX,XX +XXX,XX @@ | ||
174 | #define ARM64_TEXT_OFFSET_OFFSET 8 | ||
175 | #define ARM64_MAGIC_OFFSET 56 | ||
176 | |||
177 | -static AddressSpace *arm_boot_address_space(ARMCPU *cpu, | ||
178 | - const struct arm_boot_info *info) | ||
179 | +AddressSpace *arm_boot_address_space(ARMCPU *cpu, | ||
180 | + const struct arm_boot_info *info) | ||
181 | { | ||
182 | /* Return the address space to use for bootloader reads and writes. | ||
183 | * We prefer the secure address space if the CPU has it and we're | ||
184 | @@ -XXX,XX +XXX,XX @@ static void fdt_add_psci_node(void *fdt) | ||
185 | qemu_fdt_setprop_cell(fdt, "/psci", "migrate", migrate_fn); | ||
186 | } | 35 | } |
187 | 36 | ||
188 | -/** | 37 | -static void qemu_splitirq(void *opaque, int line, int level) |
189 | - * load_dtb() - load a device tree binary image into memory | 38 | -{ |
190 | - * @addr: the address to load the image at | 39 | - struct IRQState **irq = opaque; |
191 | - * @binfo: struct describing the boot environment | 40 | - irq[0]->handler(irq[0]->opaque, irq[0]->n, level); |
192 | - * @addr_limit: upper limit of the available memory area at @addr | 41 | - irq[1]->handler(irq[1]->opaque, irq[1]->n, level); |
193 | - * @as: address space to load image to | ||
194 | - * | ||
195 | - * Load a device tree supplied by the machine or by the user with the | ||
196 | - * '-dtb' command line option, and put it at offset @addr in target | ||
197 | - * memory. | ||
198 | - * | ||
199 | - * If @addr_limit contains a meaningful value (i.e., it is strictly greater | ||
200 | - * than @addr), the device tree is only loaded if its size does not exceed | ||
201 | - * the limit. | ||
202 | - * | ||
203 | - * Returns: the size of the device tree image on success, | ||
204 | - * 0 if the image size exceeds the limit, | ||
205 | - * -1 on errors. | ||
206 | - * | ||
207 | - * Note: Must not be called unless have_dtb(binfo) is true. | ||
208 | - */ | ||
209 | -static int load_dtb(hwaddr addr, const struct arm_boot_info *binfo, | ||
210 | - hwaddr addr_limit, AddressSpace *as) | ||
211 | +int arm_load_dtb(hwaddr addr, const struct arm_boot_info *binfo, | ||
212 | + hwaddr addr_limit, AddressSpace *as) | ||
213 | { | ||
214 | void *fdt = NULL; | ||
215 | int size, rc; | ||
216 | @@ -XXX,XX +XXX,XX @@ static uint64_t load_aarch64_image(const char *filename, hwaddr mem_base, | ||
217 | return size; | ||
218 | } | ||
219 | |||
220 | -static void arm_load_kernel_notify(Notifier *notifier, void *data) | ||
221 | +void arm_load_kernel(ARMCPU *cpu, struct arm_boot_info *info) | ||
222 | { | ||
223 | CPUState *cs; | ||
224 | int kernel_size; | ||
225 | @@ -XXX,XX +XXX,XX @@ static void arm_load_kernel_notify(Notifier *notifier, void *data) | ||
226 | int elf_machine; | ||
227 | hwaddr entry; | ||
228 | static const ARMInsnFixup *primary_loader; | ||
229 | - ArmLoadKernelNotifier *n = DO_UPCAST(ArmLoadKernelNotifier, | ||
230 | - notifier, notifier); | ||
231 | - ARMCPU *cpu = n->cpu; | ||
232 | - struct arm_boot_info *info = | ||
233 | - container_of(n, struct arm_boot_info, load_kernel_notifier); | ||
234 | AddressSpace *as = arm_boot_address_space(cpu, info); | ||
235 | |||
236 | /* The board code is not supposed to set secure_board_setup unless | ||
237 | @@ -XXX,XX +XXX,XX @@ static void arm_load_kernel_notify(Notifier *notifier, void *data) | ||
238 | assert(!(info->secure_board_setup && kvm_enabled())); | ||
239 | |||
240 | info->dtb_filename = qemu_opt_get(qemu_get_machine_opts(), "dtb"); | ||
241 | + info->dtb_limit = 0; | ||
242 | |||
243 | /* Load the kernel. */ | ||
244 | if (!info->kernel_filename || info->firmware_loaded) { | ||
245 | @@ -XXX,XX +XXX,XX @@ static void arm_load_kernel_notify(Notifier *notifier, void *data) | ||
246 | * the kernel is supposed to be loaded by the bootloader), copy the | ||
247 | * DTB to the base of RAM for the bootloader to pick up. | ||
248 | */ | ||
249 | - if (load_dtb(info->loader_start, info, 0, as) < 0) { | ||
250 | - exit(1); | ||
251 | - } | ||
252 | + info->dtb_start = info->loader_start; | ||
253 | } | ||
254 | |||
255 | if (info->kernel_filename) { | ||
256 | @@ -XXX,XX +XXX,XX @@ static void arm_load_kernel_notify(Notifier *notifier, void *data) | ||
257 | */ | ||
258 | if (elf_low_addr > info->loader_start | ||
259 | || elf_high_addr < info->loader_start) { | ||
260 | - /* Pass elf_low_addr as address limit to load_dtb if it may be | ||
261 | + /* Set elf_low_addr as address limit for arm_load_dtb if it may be | ||
262 | * pointing into RAM, otherwise pass '0' (no limit) | ||
263 | */ | ||
264 | if (elf_low_addr < info->loader_start) { | ||
265 | elf_low_addr = 0; | ||
266 | } | ||
267 | - if (load_dtb(info->loader_start, info, elf_low_addr, as) < 0) { | ||
268 | - exit(1); | ||
269 | - } | ||
270 | + info->dtb_start = info->loader_start; | ||
271 | + info->dtb_limit = elf_low_addr; | ||
272 | } | ||
273 | } | ||
274 | entry = elf_entry; | ||
275 | @@ -XXX,XX +XXX,XX @@ static void arm_load_kernel_notify(Notifier *notifier, void *data) | ||
276 | */ | ||
277 | if (have_dtb(info)) { | ||
278 | hwaddr align; | ||
279 | - hwaddr dtb_start; | ||
280 | |||
281 | if (elf_machine == EM_AARCH64) { | ||
282 | /* | ||
283 | @@ -XXX,XX +XXX,XX @@ static void arm_load_kernel_notify(Notifier *notifier, void *data) | ||
284 | } | ||
285 | |||
286 | /* Place the DTB after the initrd in memory with alignment. */ | ||
287 | - dtb_start = QEMU_ALIGN_UP(info->initrd_start + initrd_size, align); | ||
288 | - if (load_dtb(dtb_start, info, 0, as) < 0) { | ||
289 | - exit(1); | ||
290 | - } | ||
291 | - fixupcontext[FIXUP_ARGPTR] = dtb_start; | ||
292 | + info->dtb_start = QEMU_ALIGN_UP(info->initrd_start + initrd_size, | ||
293 | + align); | ||
294 | + fixupcontext[FIXUP_ARGPTR] = info->dtb_start; | ||
295 | } else { | ||
296 | fixupcontext[FIXUP_ARGPTR] = info->loader_start + KERNEL_ARGS_ADDR; | ||
297 | if (info->ram_size >= (1ULL << 32)) { | ||
298 | @@ -XXX,XX +XXX,XX @@ static void arm_load_kernel_notify(Notifier *notifier, void *data) | ||
299 | for (cs = first_cpu; cs; cs = CPU_NEXT(cs)) { | ||
300 | ARM_CPU(cs)->env.boot_info = info; | ||
301 | } | ||
302 | -} | 42 | -} |
303 | - | 43 | - |
304 | -void arm_load_kernel(ARMCPU *cpu, struct arm_boot_info *info) | 44 | -qemu_irq qemu_irq_split(qemu_irq irq1, qemu_irq irq2) |
305 | -{ | 45 | -{ |
306 | - CPUState *cs; | 46 | - qemu_irq *s = g_new0(qemu_irq, 2); |
307 | - | 47 | - s[0] = irq1; |
308 | - info->load_kernel_notifier.cpu = cpu; | 48 | - s[1] = irq2; |
309 | - info->load_kernel_notifier.notifier.notify = arm_load_kernel_notify; | 49 | - return qemu_allocate_irq(qemu_splitirq, s, 0); |
310 | - qemu_add_machine_init_done_notifier(&info->load_kernel_notifier.notifier); | ||
311 | |||
312 | /* CPU objects (unlike devices) are not automatically reset on system | ||
313 | * reset, so we must always register a handler to do so. If we're | ||
314 | @@ -XXX,XX +XXX,XX @@ void arm_load_kernel(ARMCPU *cpu, struct arm_boot_info *info) | ||
315 | for (cs = first_cpu; cs; cs = CPU_NEXT(cs)) { | ||
316 | qemu_register_reset(do_cpu_reset, ARM_CPU(cs)); | ||
317 | } | ||
318 | + | ||
319 | + if (!info->skip_dtb_autoload && have_dtb(info)) { | ||
320 | + if (arm_load_dtb(info->dtb_start, info, info->dtb_limit, as) < 0) { | ||
321 | + exit(1); | ||
322 | + } | ||
323 | + } | ||
324 | } | ||
325 | |||
326 | static const TypeInfo arm_linux_boot_if_info = { | ||
327 | diff --git a/hw/arm/sysbus-fdt.c b/hw/arm/sysbus-fdt.c | ||
328 | index XXXXXXX..XXXXXXX 100644 | ||
329 | --- a/hw/arm/sysbus-fdt.c | ||
330 | +++ b/hw/arm/sysbus-fdt.c | ||
331 | @@ -XXX,XX +XXX,XX @@ typedef struct PlatformBusFDTData { | ||
332 | PlatformBusDevice *pbus; | ||
333 | } PlatformBusFDTData; | ||
334 | |||
335 | -/* | ||
336 | - * struct used when calling the machine init done notifier | ||
337 | - * that constructs the fdt nodes of platform bus devices | ||
338 | - */ | ||
339 | -typedef struct PlatformBusFDTNotifierParams { | ||
340 | - Notifier notifier; | ||
341 | - ARMPlatformBusFDTParams *fdt_params; | ||
342 | -} PlatformBusFDTNotifierParams; | ||
343 | - | ||
344 | /* struct that associates a device type name and a node creation function */ | ||
345 | typedef struct NodeCreationPair { | ||
346 | const char *typename; | ||
347 | @@ -XXX,XX +XXX,XX @@ static void add_fdt_node(SysBusDevice *sbdev, void *opaque) | ||
348 | exit(1); | ||
349 | } | ||
350 | |||
351 | -/** | ||
352 | - * add_all_platform_bus_fdt_nodes - create all the platform bus nodes | ||
353 | - * | ||
354 | - * builds the parent platform bus node and all the nodes of dynamic | ||
355 | - * sysbus devices attached to it. | ||
356 | - */ | ||
357 | -static void add_all_platform_bus_fdt_nodes(ARMPlatformBusFDTParams *fdt_params) | ||
358 | +void platform_bus_add_all_fdt_nodes(void *fdt, const char *intc, hwaddr addr, | ||
359 | + hwaddr bus_size, int irq_start) | ||
360 | { | ||
361 | const char platcomp[] = "qemu,platform\0simple-bus"; | ||
362 | PlatformBusDevice *pbus; | ||
363 | DeviceState *dev; | ||
364 | gchar *node; | ||
365 | - uint64_t addr, size; | ||
366 | - int irq_start, dtb_size; | ||
367 | - struct arm_boot_info *info = fdt_params->binfo; | ||
368 | - const ARMPlatformBusSystemParams *params = fdt_params->system_params; | ||
369 | - const char *intc = fdt_params->intc; | ||
370 | - void *fdt = info->get_dtb(info, &dtb_size); | ||
371 | - | ||
372 | - /* | ||
373 | - * If the user provided a dtb, we assume the dynamic sysbus nodes | ||
374 | - * already are integrated there. This corresponds to a use case where | ||
375 | - * the dynamic sysbus nodes are complex and their generation is not yet | ||
376 | - * supported. In that case the user can take charge of the guest dt | ||
377 | - * while qemu takes charge of the qom stuff. | ||
378 | - */ | ||
379 | - if (info->dtb_filename) { | ||
380 | - return; | ||
381 | - } | ||
382 | |||
383 | assert(fdt); | ||
384 | |||
385 | - node = g_strdup_printf("/platform@%"PRIx64, params->platform_bus_base); | ||
386 | - addr = params->platform_bus_base; | ||
387 | - size = params->platform_bus_size; | ||
388 | - irq_start = params->platform_bus_first_irq; | ||
389 | + node = g_strdup_printf("/platform@%"PRIx64, addr); | ||
390 | |||
391 | /* Create a /platform node that we can put all devices into */ | ||
392 | qemu_fdt_add_subnode(fdt, node); | ||
393 | @@ -XXX,XX +XXX,XX @@ static void add_all_platform_bus_fdt_nodes(ARMPlatformBusFDTParams *fdt_params) | ||
394 | */ | ||
395 | qemu_fdt_setprop_cells(fdt, node, "#size-cells", 1); | ||
396 | qemu_fdt_setprop_cells(fdt, node, "#address-cells", 1); | ||
397 | - qemu_fdt_setprop_cells(fdt, node, "ranges", 0, addr >> 32, addr, size); | ||
398 | + qemu_fdt_setprop_cells(fdt, node, "ranges", 0, addr >> 32, addr, bus_size); | ||
399 | |||
400 | qemu_fdt_setprop_phandle(fdt, node, "interrupt-parent", intc); | ||
401 | |||
402 | @@ -XXX,XX +XXX,XX @@ static void add_all_platform_bus_fdt_nodes(ARMPlatformBusFDTParams *fdt_params) | ||
403 | |||
404 | g_free(node); | ||
405 | } | ||
406 | - | ||
407 | -static void platform_bus_fdt_notify(Notifier *notifier, void *data) | ||
408 | -{ | ||
409 | - PlatformBusFDTNotifierParams *p = DO_UPCAST(PlatformBusFDTNotifierParams, | ||
410 | - notifier, notifier); | ||
411 | - | ||
412 | - add_all_platform_bus_fdt_nodes(p->fdt_params); | ||
413 | - g_free(p->fdt_params); | ||
414 | - g_free(p); | ||
415 | -} | 50 | -} |
416 | - | 51 | - |
417 | -void arm_register_platform_bus_fdt_creator(ARMPlatformBusFDTParams *fdt_params) | 52 | void qemu_irq_intercept_in(qemu_irq *gpio_in, qemu_irq_handler handler, int n) |
418 | -{ | 53 | { |
419 | - PlatformBusFDTNotifierParams *p = g_new(PlatformBusFDTNotifierParams, 1); | ||
420 | - | ||
421 | - p->fdt_params = fdt_params; | ||
422 | - p->notifier.notify = platform_bus_fdt_notify; | ||
423 | - qemu_add_machine_init_done_notifier(&p->notifier); | ||
424 | -} | ||
425 | diff --git a/hw/arm/virt.c b/hw/arm/virt.c | ||
426 | index XXXXXXX..XXXXXXX 100644 | ||
427 | --- a/hw/arm/virt.c | ||
428 | +++ b/hw/arm/virt.c | ||
429 | @@ -XXX,XX +XXX,XX @@ | ||
430 | |||
431 | #define PLATFORM_BUS_NUM_IRQS 64 | ||
432 | |||
433 | -static ARMPlatformBusSystemParams platform_bus_params; | ||
434 | - | ||
435 | /* RAM limit in GB. Since VIRT_MEM starts at the 1GB mark, this means | ||
436 | * RAM can go up to the 256GB mark, leaving 256GB of the physical | ||
437 | * address space unallocated and free for future use between 256G and 512G. | ||
438 | @@ -XXX,XX +XXX,XX @@ static void create_platform_bus(VirtMachineState *vms, qemu_irq *pic) | ||
439 | DeviceState *dev; | ||
440 | SysBusDevice *s; | ||
441 | int i; | 54 | int i; |
442 | - ARMPlatformBusFDTParams *fdt_params = g_new(ARMPlatformBusFDTParams, 1); | ||
443 | MemoryRegion *sysmem = get_system_memory(); | ||
444 | |||
445 | - platform_bus_params.platform_bus_base = vms->memmap[VIRT_PLATFORM_BUS].base; | ||
446 | - platform_bus_params.platform_bus_size = vms->memmap[VIRT_PLATFORM_BUS].size; | ||
447 | - platform_bus_params.platform_bus_first_irq = vms->irqmap[VIRT_PLATFORM_BUS]; | ||
448 | - platform_bus_params.platform_bus_num_irqs = PLATFORM_BUS_NUM_IRQS; | ||
449 | - | ||
450 | - fdt_params->system_params = &platform_bus_params; | ||
451 | - fdt_params->binfo = &vms->bootinfo; | ||
452 | - fdt_params->intc = "/intc"; | ||
453 | - /* | ||
454 | - * register a machine init done notifier that creates the device tree | ||
455 | - * nodes of the platform bus and its children dynamic sysbus devices | ||
456 | - */ | ||
457 | - arm_register_platform_bus_fdt_creator(fdt_params); | ||
458 | - | ||
459 | dev = qdev_create(NULL, TYPE_PLATFORM_BUS_DEVICE); | ||
460 | dev->id = TYPE_PLATFORM_BUS_DEVICE; | ||
461 | - qdev_prop_set_uint32(dev, "num_irqs", | ||
462 | - platform_bus_params.platform_bus_num_irqs); | ||
463 | - qdev_prop_set_uint32(dev, "mmio_size", | ||
464 | - platform_bus_params.platform_bus_size); | ||
465 | + qdev_prop_set_uint32(dev, "num_irqs", PLATFORM_BUS_NUM_IRQS); | ||
466 | + qdev_prop_set_uint32(dev, "mmio_size", vms->memmap[VIRT_PLATFORM_BUS].size); | ||
467 | qdev_init_nofail(dev); | ||
468 | vms->platform_bus_dev = dev; | ||
469 | - s = SYS_BUS_DEVICE(dev); | ||
470 | |||
471 | - for (i = 0; i < platform_bus_params.platform_bus_num_irqs; i++) { | ||
472 | - int irqn = platform_bus_params.platform_bus_first_irq + i; | ||
473 | + s = SYS_BUS_DEVICE(dev); | ||
474 | + for (i = 0; i < PLATFORM_BUS_NUM_IRQS; i++) { | ||
475 | + int irqn = vms->irqmap[VIRT_PLATFORM_BUS] + i; | ||
476 | sysbus_connect_irq(s, i, pic[irqn]); | ||
477 | } | ||
478 | |||
479 | memory_region_add_subregion(sysmem, | ||
480 | - platform_bus_params.platform_bus_base, | ||
481 | + vms->memmap[VIRT_PLATFORM_BUS].base, | ||
482 | sysbus_mmio_get_region(s, 0)); | ||
483 | } | ||
484 | |||
485 | @@ -XXX,XX +XXX,XX @@ void virt_machine_done(Notifier *notifier, void *data) | ||
486 | { | ||
487 | VirtMachineState *vms = container_of(notifier, VirtMachineState, | ||
488 | machine_done); | ||
489 | + ARMCPU *cpu = ARM_CPU(first_cpu); | ||
490 | + struct arm_boot_info *info = &vms->bootinfo; | ||
491 | + AddressSpace *as = arm_boot_address_space(cpu, info); | ||
492 | + | ||
493 | + /* | ||
494 | + * If the user provided a dtb, we assume the dynamic sysbus nodes | ||
495 | + * already are integrated there. This corresponds to a use case where | ||
496 | + * the dynamic sysbus nodes are complex and their generation is not yet | ||
497 | + * supported. In that case the user can take charge of the guest dt | ||
498 | + * while qemu takes charge of the qom stuff. | ||
499 | + */ | ||
500 | + if (info->dtb_filename == NULL) { | ||
501 | + platform_bus_add_all_fdt_nodes(vms->fdt, "/intc", | ||
502 | + vms->memmap[VIRT_PLATFORM_BUS].base, | ||
503 | + vms->memmap[VIRT_PLATFORM_BUS].size, | ||
504 | + vms->irqmap[VIRT_PLATFORM_BUS]); | ||
505 | + } | ||
506 | + if (arm_load_dtb(info->dtb_start, info, info->dtb_limit, as) < 0) { | ||
507 | + exit(1); | ||
508 | + } | ||
509 | |||
510 | virt_acpi_setup(vms); | ||
511 | virt_build_smbios(vms); | ||
512 | @@ -XXX,XX +XXX,XX @@ static void machvirt_init(MachineState *machine) | ||
513 | vms->fw_cfg = create_fw_cfg(vms, &address_space_memory); | ||
514 | rom_set_fw(vms->fw_cfg); | ||
515 | |||
516 | - vms->machine_done.notify = virt_machine_done; | ||
517 | - qemu_add_machine_init_done_notifier(&vms->machine_done); | ||
518 | + create_platform_bus(vms, pic); | ||
519 | |||
520 | vms->bootinfo.ram_size = machine->ram_size; | ||
521 | vms->bootinfo.kernel_filename = machine->kernel_filename; | ||
522 | @@ -XXX,XX +XXX,XX @@ static void machvirt_init(MachineState *machine) | ||
523 | vms->bootinfo.board_id = -1; | ||
524 | vms->bootinfo.loader_start = vms->memmap[VIRT_MEM].base; | ||
525 | vms->bootinfo.get_dtb = machvirt_dtb; | ||
526 | + vms->bootinfo.skip_dtb_autoload = true; | ||
527 | vms->bootinfo.firmware_loaded = firmware_loaded; | ||
528 | arm_load_kernel(ARM_CPU(first_cpu), &vms->bootinfo); | ||
529 | |||
530 | - /* | ||
531 | - * arm_load_kernel machine init done notifier registration must | ||
532 | - * happen before the platform_bus_create call. In this latter, | ||
533 | - * another notifier is registered which adds platform bus nodes. | ||
534 | - * Notifiers are executed in registration reverse order. | ||
535 | - */ | ||
536 | - create_platform_bus(vms, pic); | ||
537 | + vms->machine_done.notify = virt_machine_done; | ||
538 | + qemu_add_machine_init_done_notifier(&vms->machine_done); | ||
539 | } | ||
540 | |||
541 | static bool virt_get_secure(Object *obj, Error **errp) | ||
542 | -- | 55 | -- |
543 | 2.17.0 | 56 | 2.25.1 |
544 | |||
545 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | From: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> |
---|---|---|---|
2 | 2 | ||
3 | While we have some of the scalar paths for FCVT for fp16, | 3 | Describe that the gic-version influences the maximum number of CPUs. |
4 | we failed to decode the fp16 version of these instructions. | ||
5 | 4 | ||
6 | Cc: qemu-stable@nongnu.org | 5 | Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> |
7 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 6 | Message-id: 20220413231456.35811-1-heinrich.schuchardt@canonical.com |
8 | Message-id: 20180502221552.3873-3-richard.henderson@linaro.org | 7 | [PMM: minor punctuation tweaks] |
9 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 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 | target/arm/translate-a64.c | 65 +++++++++++++++++++++++++++----------- | 11 | docs/system/arm/virt.rst | 4 ++-- |
13 | 1 file changed, 46 insertions(+), 19 deletions(-) | 12 | 1 file changed, 2 insertions(+), 2 deletions(-) |
14 | 13 | ||
15 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c | 14 | diff --git a/docs/system/arm/virt.rst b/docs/system/arm/virt.rst |
16 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
17 | --- a/target/arm/translate-a64.c | 16 | --- a/docs/system/arm/virt.rst |
18 | +++ b/target/arm/translate-a64.c | 17 | +++ b/docs/system/arm/virt.rst |
19 | @@ -XXX,XX +XXX,XX @@ static void handle_simd_shift_fpint_conv(DisasContext *s, bool is_scalar, | 18 | @@ -XXX,XX +XXX,XX @@ gic-version |
20 | bool is_q, bool is_u, | 19 | Valid values are: |
21 | int immh, int immb, int rn, int rd) | 20 | |
22 | { | 21 | ``2`` |
23 | - bool is_double = extract32(immh, 3, 1); | 22 | - GICv2 |
24 | int immhb = immh << 3 | immb; | 23 | + GICv2. Note that this limits the number of CPUs to 8. |
25 | - int fracbits = (is_double ? 128 : 64) - immhb; | 24 | ``3`` |
26 | - int pass; | 25 | - GICv3 |
27 | + int pass, size, fracbits; | 26 | + GICv3. This allows up to 512 CPUs. |
28 | TCGv_ptr tcg_fpstatus; | 27 | ``host`` |
29 | TCGv_i32 tcg_rmode, tcg_shift; | 28 | Use the same GIC version the host provides, when using KVM |
30 | 29 | ``max`` | |
31 | - if (!extract32(immh, 2, 2)) { | ||
32 | - unallocated_encoding(s); | ||
33 | - return; | ||
34 | - } | ||
35 | - | ||
36 | - if (!is_scalar && !is_q && is_double) { | ||
37 | + if (immh & 0x8) { | ||
38 | + size = MO_64; | ||
39 | + if (!is_scalar && !is_q) { | ||
40 | + unallocated_encoding(s); | ||
41 | + return; | ||
42 | + } | ||
43 | + } else if (immh & 0x4) { | ||
44 | + size = MO_32; | ||
45 | + } else if (immh & 0x2) { | ||
46 | + size = MO_16; | ||
47 | + if (!arm_dc_feature(s, ARM_FEATURE_V8_FP16)) { | ||
48 | + unallocated_encoding(s); | ||
49 | + return; | ||
50 | + } | ||
51 | + } else { | ||
52 | + /* Should have split out AdvSIMD modified immediate earlier. */ | ||
53 | + assert(immh == 1); | ||
54 | unallocated_encoding(s); | ||
55 | return; | ||
56 | } | ||
57 | @@ -XXX,XX +XXX,XX @@ static void handle_simd_shift_fpint_conv(DisasContext *s, bool is_scalar, | ||
58 | assert(!(is_scalar && is_q)); | ||
59 | |||
60 | tcg_rmode = tcg_const_i32(arm_rmode_to_sf(FPROUNDING_ZERO)); | ||
61 | - tcg_fpstatus = get_fpstatus_ptr(false); | ||
62 | + tcg_fpstatus = get_fpstatus_ptr(size == MO_16); | ||
63 | gen_helper_set_rmode(tcg_rmode, tcg_rmode, tcg_fpstatus); | ||
64 | + fracbits = (16 << size) - immhb; | ||
65 | tcg_shift = tcg_const_i32(fracbits); | ||
66 | |||
67 | - if (is_double) { | ||
68 | + if (size == MO_64) { | ||
69 | int maxpass = is_scalar ? 1 : 2; | ||
70 | |||
71 | for (pass = 0; pass < maxpass; pass++) { | ||
72 | @@ -XXX,XX +XXX,XX @@ static void handle_simd_shift_fpint_conv(DisasContext *s, bool is_scalar, | ||
73 | } | ||
74 | clear_vec_high(s, is_q, rd); | ||
75 | } else { | ||
76 | - int maxpass = is_scalar ? 1 : is_q ? 4 : 2; | ||
77 | + void (*fn)(TCGv_i32, TCGv_i32, TCGv_i32, TCGv_ptr); | ||
78 | + int maxpass = is_scalar ? 1 : ((8 << is_q) >> size); | ||
79 | + | ||
80 | + switch (size) { | ||
81 | + case MO_16: | ||
82 | + if (is_u) { | ||
83 | + fn = gen_helper_vfp_toulh; | ||
84 | + } else { | ||
85 | + fn = gen_helper_vfp_toslh; | ||
86 | + } | ||
87 | + break; | ||
88 | + case MO_32: | ||
89 | + if (is_u) { | ||
90 | + fn = gen_helper_vfp_touls; | ||
91 | + } else { | ||
92 | + fn = gen_helper_vfp_tosls; | ||
93 | + } | ||
94 | + break; | ||
95 | + default: | ||
96 | + g_assert_not_reached(); | ||
97 | + } | ||
98 | + | ||
99 | for (pass = 0; pass < maxpass; pass++) { | ||
100 | TCGv_i32 tcg_op = tcg_temp_new_i32(); | ||
101 | |||
102 | - read_vec_element_i32(s, tcg_op, rn, pass, MO_32); | ||
103 | - if (is_u) { | ||
104 | - gen_helper_vfp_touls(tcg_op, tcg_op, tcg_shift, tcg_fpstatus); | ||
105 | - } else { | ||
106 | - gen_helper_vfp_tosls(tcg_op, tcg_op, tcg_shift, tcg_fpstatus); | ||
107 | - } | ||
108 | + read_vec_element_i32(s, tcg_op, rn, pass, size); | ||
109 | + fn(tcg_op, tcg_op, tcg_shift, tcg_fpstatus); | ||
110 | if (is_scalar) { | ||
111 | write_fp_sreg(s, rd, tcg_op); | ||
112 | } else { | ||
113 | - write_vec_element_i32(s, tcg_op, rd, pass, MO_32); | ||
114 | + write_vec_element_i32(s, tcg_op, rd, pass, size); | ||
115 | } | ||
116 | tcg_temp_free_i32(tcg_op); | ||
117 | } | ||
118 | -- | 30 | -- |
119 | 2.17.0 | 31 | 2.25.1 |
120 | |||
121 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | From: Hao Wu <wuhaotsh@google.com> |
---|---|---|---|
2 | 2 | ||
3 | Reviewed-by: Michael Clark <mjc@sifive.com> | 3 | Similar to the Aspeed code in include/misc/aspeed_scu.h, we define |
4 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 4 | the PWRON STRAP fields in their corresponding module for NPCM7XX. |
5 | Message-id: 20180508151437.4232-7-richard.henderson@linaro.org | 5 | |
6 | Signed-off-by: Hao Wu <wuhaotsh@google.com> | ||
7 | Reviewed-by: Patrick Venture <venture@google.com> | ||
8 | Message-id: 20220411165842.3912945-2-wuhaotsh@google.com | ||
9 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
7 | --- | 11 | --- |
8 | target/riscv/translate.c | 72 +++++++++++----------------------------- | 12 | include/hw/misc/npcm7xx_gcr.h | 30 ++++++++++++++++++++++++++++++ |
9 | 1 file changed, 20 insertions(+), 52 deletions(-) | 13 | 1 file changed, 30 insertions(+) |
10 | 14 | ||
11 | diff --git a/target/riscv/translate.c b/target/riscv/translate.c | 15 | diff --git a/include/hw/misc/npcm7xx_gcr.h b/include/hw/misc/npcm7xx_gcr.h |
12 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
13 | --- a/target/riscv/translate.c | 17 | --- a/include/hw/misc/npcm7xx_gcr.h |
14 | +++ b/target/riscv/translate.c | 18 | +++ b/include/hw/misc/npcm7xx_gcr.h |
15 | @@ -XXX,XX +XXX,XX @@ static void gen_atomic(DisasContext *ctx, uint32_t opc, | 19 | @@ -XXX,XX +XXX,XX @@ |
16 | TCGv src1, src2, dat; | 20 | #include "exec/memory.h" |
17 | TCGLabel *l1, *l2; | 21 | #include "hw/sysbus.h" |
18 | TCGMemOp mop; | 22 | |
19 | - TCGCond cond; | 23 | +/* |
20 | bool aq, rl; | 24 | + * NPCM7XX PWRON STRAP bit fields |
21 | 25 | + * 12: SPI0 powered by VSBV3 at 1.8V | |
22 | /* Extract the size of the atomic operation. */ | 26 | + * 11: System flash attached to BMC |
23 | @@ -XXX,XX +XXX,XX @@ static void gen_atomic(DisasContext *ctx, uint32_t opc, | 27 | + * 10: BSP alternative pins. |
24 | tcg_gen_atomic_fetch_or_tl(src2, src1, src2, ctx->mem_idx, mop); | 28 | + * 9:8: Flash UART command route enabled. |
25 | gen_set_gpr(rd, src2); | 29 | + * 7: Security enabled. |
26 | break; | 30 | + * 6: HI-Z state control. |
27 | - | 31 | + * 5: ECC disabled. |
28 | case OPC_RISC_AMOMIN: | 32 | + * 4: Reserved |
29 | - cond = TCG_COND_LT; | 33 | + * 3: JTAG2 enabled. |
30 | - goto do_minmax; | 34 | + * 2:0: CPU and DRAM clock frequency. |
31 | - case OPC_RISC_AMOMAX: | 35 | + */ |
32 | - cond = TCG_COND_GT; | 36 | +#define NPCM7XX_PWRON_STRAP_SPI0F18 BIT(12) |
33 | - goto do_minmax; | 37 | +#define NPCM7XX_PWRON_STRAP_SFAB BIT(11) |
34 | - case OPC_RISC_AMOMINU: | 38 | +#define NPCM7XX_PWRON_STRAP_BSPA BIT(10) |
35 | - cond = TCG_COND_LTU; | 39 | +#define NPCM7XX_PWRON_STRAP_FUP(x) ((x) << 8) |
36 | - goto do_minmax; | 40 | +#define FUP_NORM_UART2 3 |
37 | - case OPC_RISC_AMOMAXU: | 41 | +#define FUP_PROG_UART3 2 |
38 | - cond = TCG_COND_GTU; | 42 | +#define FUP_PROG_UART2 1 |
39 | - goto do_minmax; | 43 | +#define FUP_NORM_UART3 0 |
40 | - do_minmax: | 44 | +#define NPCM7XX_PWRON_STRAP_SECEN BIT(7) |
41 | - /* Handle the RL barrier. The AQ barrier is handled along the | 45 | +#define NPCM7XX_PWRON_STRAP_HIZ BIT(6) |
42 | - parallel path by the SC atomic cmpxchg. On the serial path, | 46 | +#define NPCM7XX_PWRON_STRAP_ECC BIT(5) |
43 | - of course, barriers do not matter. */ | 47 | +#define NPCM7XX_PWRON_STRAP_RESERVE1 BIT(4) |
44 | - if (rl) { | 48 | +#define NPCM7XX_PWRON_STRAP_J2EN BIT(3) |
45 | - tcg_gen_mb(TCG_MO_ALL | TCG_BAR_STRL); | 49 | +#define NPCM7XX_PWRON_STRAP_CKFRQ(x) (x) |
46 | - } | 50 | +#define CKFRQ_SKIPINIT 0x000 |
47 | - if (tb_cflags(ctx->tb) & CF_PARALLEL) { | 51 | +#define CKFRQ_DEFAULT 0x111 |
48 | - l1 = gen_new_label(); | 52 | + |
49 | - gen_set_label(l1); | 53 | /* |
50 | - } else { | 54 | * Number of registers in our device state structure. Don't change this without |
51 | - l1 = NULL; | 55 | * incrementing the version_id in the vmstate. |
52 | - } | ||
53 | - | ||
54 | gen_get_gpr(src1, rs1); | ||
55 | gen_get_gpr(src2, rs2); | ||
56 | - if ((mop & MO_SSIZE) == MO_SL) { | ||
57 | - /* Sign-extend the register comparison input. */ | ||
58 | - tcg_gen_ext32s_tl(src2, src2); | ||
59 | - } | ||
60 | - dat = tcg_temp_local_new(); | ||
61 | - tcg_gen_qemu_ld_tl(dat, src1, ctx->mem_idx, mop); | ||
62 | - tcg_gen_movcond_tl(cond, src2, dat, src2, dat, src2); | ||
63 | - | ||
64 | - if (tb_cflags(ctx->tb) & CF_PARALLEL) { | ||
65 | - /* Parallel context. Make this operation atomic by verifying | ||
66 | - that the memory didn't change while we computed the result. */ | ||
67 | - tcg_gen_atomic_cmpxchg_tl(src2, src1, dat, src2, ctx->mem_idx, mop); | ||
68 | - | ||
69 | - /* If the cmpxchg failed, retry. */ | ||
70 | - /* ??? There is an assumption here that this will eventually | ||
71 | - succeed, such that we don't live-lock. This is not unlike | ||
72 | - a similar loop that the compiler would generate for e.g. | ||
73 | - __atomic_fetch_and_xor, so don't worry about it. */ | ||
74 | - tcg_gen_brcond_tl(TCG_COND_NE, dat, src2, l1); | ||
75 | - } else { | ||
76 | - /* Serial context. Directly store the result. */ | ||
77 | - tcg_gen_qemu_st_tl(src2, src1, ctx->mem_idx, mop); | ||
78 | - } | ||
79 | - gen_set_gpr(rd, dat); | ||
80 | - tcg_temp_free(dat); | ||
81 | + tcg_gen_atomic_fetch_smin_tl(src2, src1, src2, ctx->mem_idx, mop); | ||
82 | + gen_set_gpr(rd, src2); | ||
83 | + break; | ||
84 | + case OPC_RISC_AMOMAX: | ||
85 | + gen_get_gpr(src1, rs1); | ||
86 | + gen_get_gpr(src2, rs2); | ||
87 | + tcg_gen_atomic_fetch_smax_tl(src2, src1, src2, ctx->mem_idx, mop); | ||
88 | + gen_set_gpr(rd, src2); | ||
89 | + break; | ||
90 | + case OPC_RISC_AMOMINU: | ||
91 | + gen_get_gpr(src1, rs1); | ||
92 | + gen_get_gpr(src2, rs2); | ||
93 | + tcg_gen_atomic_fetch_umin_tl(src2, src1, src2, ctx->mem_idx, mop); | ||
94 | + gen_set_gpr(rd, src2); | ||
95 | + break; | ||
96 | + case OPC_RISC_AMOMAXU: | ||
97 | + gen_get_gpr(src1, rs1); | ||
98 | + gen_get_gpr(src2, rs2); | ||
99 | + tcg_gen_atomic_fetch_umax_tl(src2, src1, src2, ctx->mem_idx, mop); | ||
100 | + gen_set_gpr(rd, src2); | ||
101 | break; | ||
102 | |||
103 | default: | ||
104 | -- | 56 | -- |
105 | 2.17.0 | 57 | 2.25.1 |
106 | |||
107 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | From: Hao Wu <wuhaotsh@google.com> |
---|---|---|---|
2 | 2 | ||
3 | While we have some of the scalar paths for *CVF for fp16, | 3 | This patch uses the defined fields to describe PWRON STRAPs for |
4 | we failed to decode the fp16 version of these instructions. | 4 | better readability. |
5 | 5 | ||
6 | Cc: qemu-stable@nongnu.org | 6 | Signed-off-by: Hao Wu <wuhaotsh@google.com> |
7 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 7 | Reviewed-by: Patrick Venture <venture@google.com> |
8 | Message-id: 20180502221552.3873-2-richard.henderson@linaro.org | 8 | Message-id: 20220411165842.3912945-3-wuhaotsh@google.com |
9 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
11 | --- | 11 | --- |
12 | target/arm/translate-a64.c | 33 ++++++++++++++++++++------------- | 12 | hw/arm/npcm7xx_boards.c | 24 +++++++++++++++++++----- |
13 | 1 file changed, 20 insertions(+), 13 deletions(-) | 13 | 1 file changed, 19 insertions(+), 5 deletions(-) |
14 | 14 | ||
15 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c | 15 | diff --git a/hw/arm/npcm7xx_boards.c b/hw/arm/npcm7xx_boards.c |
16 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
17 | --- a/target/arm/translate-a64.c | 17 | --- a/hw/arm/npcm7xx_boards.c |
18 | +++ b/target/arm/translate-a64.c | 18 | +++ b/hw/arm/npcm7xx_boards.c |
19 | @@ -XXX,XX +XXX,XX @@ static void handle_simd_shift_intfp_conv(DisasContext *s, bool is_scalar, | 19 | @@ -XXX,XX +XXX,XX @@ |
20 | int immh, int immb, int opcode, | 20 | #include "sysemu/sysemu.h" |
21 | int rn, int rd) | 21 | #include "sysemu/block-backend.h" |
22 | { | 22 | |
23 | - bool is_double = extract32(immh, 3, 1); | 23 | -#define NPCM750_EVB_POWER_ON_STRAPS 0x00001ff7 |
24 | - int size = is_double ? MO_64 : MO_32; | 24 | -#define QUANTA_GSJ_POWER_ON_STRAPS 0x00001fff |
25 | - int elements; | 25 | -#define QUANTA_GBS_POWER_ON_STRAPS 0x000017ff |
26 | + int size, elements, fracbits; | 26 | -#define KUDO_BMC_POWER_ON_STRAPS 0x00001fff |
27 | int immhb = immh << 3 | immb; | 27 | -#define MORI_BMC_POWER_ON_STRAPS 0x00001fff |
28 | - int fracbits = (is_double ? 128 : 64) - immhb; | 28 | +#define NPCM7XX_POWER_ON_STRAPS_DEFAULT ( \ |
29 | 29 | + NPCM7XX_PWRON_STRAP_SPI0F18 | \ | |
30 | - if (!extract32(immh, 2, 2)) { | 30 | + NPCM7XX_PWRON_STRAP_SFAB | \ |
31 | + if (immh & 8) { | 31 | + NPCM7XX_PWRON_STRAP_BSPA | \ |
32 | + size = MO_64; | 32 | + NPCM7XX_PWRON_STRAP_FUP(FUP_NORM_UART2) | \ |
33 | + if (!is_scalar && !is_q) { | 33 | + NPCM7XX_PWRON_STRAP_SECEN | \ |
34 | + unallocated_encoding(s); | 34 | + NPCM7XX_PWRON_STRAP_HIZ | \ |
35 | + return; | 35 | + NPCM7XX_PWRON_STRAP_ECC | \ |
36 | + } | 36 | + NPCM7XX_PWRON_STRAP_RESERVE1 | \ |
37 | + } else if (immh & 4) { | 37 | + NPCM7XX_PWRON_STRAP_J2EN | \ |
38 | + size = MO_32; | 38 | + NPCM7XX_PWRON_STRAP_CKFRQ(CKFRQ_DEFAULT)) |
39 | + } else if (immh & 2) { | 39 | + |
40 | + size = MO_16; | 40 | +#define NPCM750_EVB_POWER_ON_STRAPS ( \ |
41 | + if (!arm_dc_feature(s, ARM_FEATURE_V8_FP16)) { | 41 | + NPCM7XX_POWER_ON_STRAPS_DEFAULT & ~NPCM7XX_PWRON_STRAP_J2EN) |
42 | + unallocated_encoding(s); | 42 | +#define QUANTA_GSJ_POWER_ON_STRAPS NPCM7XX_POWER_ON_STRAPS_DEFAULT |
43 | + return; | 43 | +#define QUANTA_GBS_POWER_ON_STRAPS ( \ |
44 | + } | 44 | + NPCM7XX_POWER_ON_STRAPS_DEFAULT & ~NPCM7XX_PWRON_STRAP_SFAB) |
45 | + } else { | 45 | +#define KUDO_BMC_POWER_ON_STRAPS NPCM7XX_POWER_ON_STRAPS_DEFAULT |
46 | + /* immh == 0 would be a failure of the decode logic */ | 46 | +#define MORI_BMC_POWER_ON_STRAPS NPCM7XX_POWER_ON_STRAPS_DEFAULT |
47 | + g_assert(immh == 1); | 47 | |
48 | unallocated_encoding(s); | 48 | static const char npcm7xx_default_bootrom[] = "npcm7xx_bootrom.bin"; |
49 | return; | ||
50 | } | ||
51 | @@ -XXX,XX +XXX,XX @@ static void handle_simd_shift_intfp_conv(DisasContext *s, bool is_scalar, | ||
52 | if (is_scalar) { | ||
53 | elements = 1; | ||
54 | } else { | ||
55 | - elements = is_double ? 2 : is_q ? 4 : 2; | ||
56 | - if (is_double && !is_q) { | ||
57 | - unallocated_encoding(s); | ||
58 | - return; | ||
59 | - } | ||
60 | + elements = (8 << is_q) >> size; | ||
61 | } | ||
62 | + fracbits = (16 << size) - immhb; | ||
63 | |||
64 | if (!fp_access_check(s)) { | ||
65 | return; | ||
66 | } | ||
67 | |||
68 | - /* immh == 0 would be a failure of the decode logic */ | ||
69 | - g_assert(immh); | ||
70 | - | ||
71 | handle_simd_intfp_conv(s, rd, rn, elements, !is_u, fracbits, size); | ||
72 | } | ||
73 | 49 | ||
74 | -- | 50 | -- |
75 | 2.17.0 | 51 | 2.25.1 |
76 | |||
77 | diff view generated by jsdifflib |