1 | Hi; here's the first target-arm pullreq for the 7.0 cycle. | 1 | The following changes since commit 5767815218efd3cbfd409505ed824d5f356044ae: |
---|---|---|---|
2 | 2 | ||
3 | thanks | 3 | Merge tag 'for_upstream' of https://git.kernel.org/pub/scm/virt/kvm/mst/qemu into staging (2024-02-14 15:45:52 +0000) |
4 | -- PMM | ||
5 | |||
6 | The following changes since commit 76b56fdfc9fa43ec6e5986aee33f108c6c6a511e: | ||
7 | |||
8 | Merge tag 'block-pull-request' of https://gitlab.com/stefanha/qemu into staging (2021-12-14 12:46:18 -0800) | ||
9 | 4 | ||
10 | are available in the Git repository at: | 5 | are available in the Git repository at: |
11 | 6 | ||
12 | https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20211215 | 7 | https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20240215 |
13 | 8 | ||
14 | for you to fetch changes up to aed176558806674d030a8305d989d4e6a5073359: | 9 | for you to fetch changes up to f780e63fe731b058fe52d43653600d8729a1b5f2: |
15 | 10 | ||
16 | tests/acpi: add expected blob for VIOT test on virt machine (2021-12-15 10:35:26 +0000) | 11 | docs: Add documentation for the mps3-an536 board (2024-02-15 14:32:39 +0000) |
17 | 12 | ||
18 | ---------------------------------------------------------------- | 13 | ---------------------------------------------------------------- |
19 | target-arm queue: | 14 | target-arm queue: |
20 | * ITS: error reporting cleanup | 15 | * hw/arm/xilinx_zynq: Wire FIQ between CPU <> GIC |
21 | * aspeed: improve documentation | 16 | * linux-user/aarch64: Choose SYNC as the preferred MTE mode |
22 | * Fix STM32F2XX USART data register readout | 17 | * Fix some errors in SVE/SME handling of MTE tags |
23 | * allow emulated GICv3 to be disabled in non-TCG builds | 18 | * hw/pci-host/raven.c: Mark raven_io_ops as implementing unaligned accesses |
24 | * fix exception priority for singlestep, misaligned PC, bp, etc | 19 | * hw/block/tc58128: Don't emit deprecation warning under qtest |
25 | * Correct calculation of tlb range invalidate length | 20 | * tests/qtest: Fix handling of npcm7xx and GMAC tests |
26 | * npcm7xx_emc: fix missing queue_flush | 21 | * hw/arm/virt: Wire up non-secure EL2 virtual timer IRQ |
27 | * virt: Add VIOT ACPI table for virtio-iommu | 22 | * tests/qtest/npcm7xx_emc-test: Connect all NICs to a backend |
28 | * target/i386: Use assert() to sanity-check b1 in SSE decode | 23 | * Don't assert on vmload/vmsave of M-profile CPUs |
29 | * Don't include qemu-common unnecessarily | 24 | * hw/arm/smmuv3: add support for stage 1 access fault |
25 | * hw/arm/stellaris: QOM cleanups | ||
26 | * Use new CBAR encoding for all v8 CPUs, not all aarch64 CPUs | ||
27 | * Improve Cortex_R52 IMPDEF sysreg modelling | ||
28 | * Allow access to SPSR_hyp from hyp mode | ||
29 | * New board model mps3-an536 (Cortex-R52) | ||
30 | 30 | ||
31 | ---------------------------------------------------------------- | 31 | ---------------------------------------------------------------- |
32 | Alex Bennée (1): | 32 | Luc Michel (1): |
33 | hw/intc: clean-up error reporting for failed ITS cmd | 33 | hw/arm/smmuv3: add support for stage 1 access fault |
34 | 34 | ||
35 | Jean-Philippe Brucker (8): | 35 | Nabih Estefan (1): |
36 | hw/arm/virt-acpi-build: Add VIOT table for virtio-iommu | 36 | tests/qtest: Fix GMAC test to run on a machine in upstream QEMU |
37 | hw/arm/virt: Remove device tree restriction for virtio-iommu | ||
38 | hw/arm/virt: Reject instantiation of multiple IOMMUs | ||
39 | hw/arm/virt: Use object_property_set instead of qdev_prop_set | ||
40 | tests/acpi: allow updates of VIOT expected data files | ||
41 | tests/acpi: add test case for VIOT | ||
42 | tests/acpi: add expected blobs for VIOT test on q35 machine | ||
43 | tests/acpi: add expected blob for VIOT test on virt machine | ||
44 | 37 | ||
45 | Joel Stanley (4): | 38 | Peter Maydell (22): |
46 | docs: aspeed: Add new boards | 39 | hw/pci-host/raven.c: Mark raven_io_ops as implementing unaligned accesses |
47 | docs: aspeed: Update OpenBMC image URL | 40 | hw/block/tc58128: Don't emit deprecation warning under qtest |
48 | docs: aspeed: Give an example of booting a kernel | 41 | tests/qtest/meson.build: Don't include qtests_npcm7xx in qtests_aarch64 |
49 | docs: aspeed: ADC is now modelled | 42 | tests/qtest/bios-tables-test: Allow changes to virt GTDT |
43 | hw/arm/virt: Wire up non-secure EL2 virtual timer IRQ | ||
44 | tests/qtest/bios-tables-tests: Update virt golden reference | ||
45 | hw/arm/npcm7xx: Call qemu_configure_nic_device() for GMAC modules | ||
46 | tests/qtest/npcm7xx_emc-test: Connect all NICs to a backend | ||
47 | target/arm: Don't get MDCR_EL2 in pmu_counter_enabled() before checking ARM_FEATURE_PMU | ||
48 | target/arm: Use new CBAR encoding for all v8 CPUs, not all aarch64 CPUs | ||
49 | target/arm: The Cortex-R52 has a read-only CBAR | ||
50 | target/arm: Add Cortex-R52 IMPDEF sysregs | ||
51 | target/arm: Allow access to SPSR_hyp from hyp mode | ||
52 | hw/misc/mps2-scc: Fix condition for CFG3 register | ||
53 | hw/misc/mps2-scc: Factor out which-board conditionals | ||
54 | hw/misc/mps2-scc: Make changes needed for AN536 FPGA image | ||
55 | hw/arm/mps3r: Initial skeleton for mps3-an536 board | ||
56 | hw/arm/mps3r: Add CPUs, GIC, and per-CPU RAM | ||
57 | hw/arm/mps3r: Add UARTs | ||
58 | hw/arm/mps3r: Add GPIO, watchdog, dual-timer, I2C devices | ||
59 | hw/arm/mps3r: Add remaining devices | ||
60 | docs: Add documentation for the mps3-an536 board | ||
50 | 61 | ||
51 | Olivier Hériveaux (1): | 62 | Philippe Mathieu-Daudé (5): |
52 | Fix STM32F2XX USART data register readout | 63 | hw/arm/xilinx_zynq: Wire FIQ between CPU <> GIC |
64 | hw/arm/stellaris: Convert ADC controller to Resettable interface | ||
65 | hw/arm/stellaris: Convert I2C controller to Resettable interface | ||
66 | hw/arm/stellaris: Add missing QOM 'machine' parent | ||
67 | hw/arm/stellaris: Add missing QOM 'SoC' parent | ||
53 | 68 | ||
54 | Patrick Venture (1): | 69 | Richard Henderson (6): |
55 | hw/net: npcm7xx_emc fix missing queue_flush | 70 | linux-user/aarch64: Choose SYNC as the preferred MTE mode |
71 | target/arm: Fix nregs computation in do_{ld,st}_zpa | ||
72 | target/arm: Adjust and validate mtedesc sizem1 | ||
73 | target/arm: Split out make_svemte_desc | ||
74 | target/arm: Handle mte in do_ldrq, do_ldro | ||
75 | target/arm: Fix SVE/SME gross MTE suppression checks | ||
56 | 76 | ||
57 | Peter Maydell (6): | 77 | MAINTAINERS | 3 +- |
58 | target/i386: Use assert() to sanity-check b1 in SSE decode | 78 | docs/system/arm/mps2.rst | 37 +- |
59 | include/hw/i386: Don't include qemu-common.h in .h files | 79 | configs/devices/arm-softmmu/default.mak | 1 + |
60 | target/hexagon/cpu.h: don't include qemu-common.h | 80 | hw/arm/smmuv3-internal.h | 1 + |
61 | target/rx/cpu.h: Don't include qemu-common.h | 81 | include/hw/arm/smmu-common.h | 1 + |
62 | hw/arm: Don't include qemu-common.h unnecessarily | 82 | include/hw/arm/virt.h | 2 + |
63 | target/arm: Correct calculation of tlb range invalidate length | 83 | include/hw/misc/mps2-scc.h | 1 + |
84 | linux-user/aarch64/target_prctl.h | 29 +- | ||
85 | target/arm/internals.h | 2 +- | ||
86 | target/arm/tcg/translate-a64.h | 2 + | ||
87 | hw/arm/mps3r.c | 640 ++++++++++++++++++++++++++++++++ | ||
88 | hw/arm/npcm7xx.c | 1 + | ||
89 | hw/arm/smmu-common.c | 11 + | ||
90 | hw/arm/smmuv3.c | 1 + | ||
91 | hw/arm/stellaris.c | 47 ++- | ||
92 | hw/arm/virt-acpi-build.c | 20 +- | ||
93 | hw/arm/virt.c | 60 ++- | ||
94 | hw/arm/xilinx_zynq.c | 2 + | ||
95 | hw/block/tc58128.c | 4 +- | ||
96 | hw/misc/mps2-scc.c | 138 ++++++- | ||
97 | hw/pci-host/raven.c | 1 + | ||
98 | target/arm/helper.c | 14 +- | ||
99 | target/arm/tcg/cpu32.c | 109 ++++++ | ||
100 | target/arm/tcg/op_helper.c | 43 ++- | ||
101 | target/arm/tcg/sme_helper.c | 8 +- | ||
102 | target/arm/tcg/sve_helper.c | 12 +- | ||
103 | target/arm/tcg/translate-sme.c | 15 +- | ||
104 | target/arm/tcg/translate-sve.c | 83 +++-- | ||
105 | target/arm/tcg/translate.c | 19 +- | ||
106 | tests/qtest/npcm7xx_emc-test.c | 5 +- | ||
107 | tests/qtest/npcm_gmac-test.c | 84 +---- | ||
108 | hw/arm/Kconfig | 5 + | ||
109 | hw/arm/meson.build | 1 + | ||
110 | tests/data/acpi/virt/FACP | Bin 276 -> 276 bytes | ||
111 | tests/data/acpi/virt/GTDT | Bin 96 -> 104 bytes | ||
112 | tests/qtest/meson.build | 4 +- | ||
113 | 36 files changed, 1184 insertions(+), 222 deletions(-) | ||
114 | create mode 100644 hw/arm/mps3r.c | ||
64 | 115 | ||
65 | Philippe Mathieu-Daudé (2): | ||
66 | hw/intc/arm_gicv3: Extract gicv3_set_gicv3state from arm_gicv3_cpuif.c | ||
67 | hw/intc/arm_gicv3: Introduce CONFIG_ARM_GIC_TCG Kconfig selector | ||
68 | |||
69 | Richard Henderson (10): | ||
70 | target/arm: Hoist pc_next to a local variable in aarch64_tr_translate_insn | ||
71 | target/arm: Hoist pc_next to a local variable in arm_tr_translate_insn | ||
72 | target/arm: Hoist pc_next to a local variable in thumb_tr_translate_insn | ||
73 | target/arm: Split arm_pre_translate_insn | ||
74 | target/arm: Advance pc for arch single-step exception | ||
75 | target/arm: Split compute_fsr_fsc out of arm_deliver_fault | ||
76 | target/arm: Take an exception if PC is misaligned | ||
77 | target/arm: Assert thumb pc is aligned | ||
78 | target/arm: Suppress bp for exceptions with more priority | ||
79 | tests/tcg: Add arm and aarch64 pc alignment tests | ||
80 | |||
81 | docs/system/arm/aspeed.rst | 26 ++++++++++++---- | ||
82 | include/hw/i386/microvm.h | 1 - | ||
83 | include/hw/i386/x86.h | 1 - | ||
84 | target/arm/helper.h | 1 + | ||
85 | target/arm/syndrome.h | 5 +++ | ||
86 | target/hexagon/cpu.h | 1 - | ||
87 | target/rx/cpu.h | 1 - | ||
88 | hw/arm/boot.c | 1 - | ||
89 | hw/arm/digic_boards.c | 1 - | ||
90 | hw/arm/highbank.c | 1 - | ||
91 | hw/arm/npcm7xx_boards.c | 1 - | ||
92 | hw/arm/sbsa-ref.c | 1 - | ||
93 | hw/arm/stm32f405_soc.c | 1 - | ||
94 | hw/arm/vexpress.c | 1 - | ||
95 | hw/arm/virt-acpi-build.c | 7 +++++ | ||
96 | hw/arm/virt.c | 21 ++++++------- | ||
97 | hw/char/stm32f2xx_usart.c | 3 +- | ||
98 | hw/intc/arm_gicv3.c | 2 +- | ||
99 | hw/intc/arm_gicv3_cpuif.c | 10 +----- | ||
100 | hw/intc/arm_gicv3_cpuif_common.c | 22 +++++++++++++ | ||
101 | hw/intc/arm_gicv3_its.c | 39 +++++++++++++++-------- | ||
102 | hw/net/npcm7xx_emc.c | 18 +++++------ | ||
103 | hw/virtio/virtio-iommu-pci.c | 12 ++------ | ||
104 | linux-user/aarch64/cpu_loop.c | 46 ++++++++++++++++------------ | ||
105 | linux-user/hexagon/cpu_loop.c | 1 + | ||
106 | target/arm/debug_helper.c | 23 ++++++++++++++ | ||
107 | target/arm/gdbstub.c | 9 ++++-- | ||
108 | target/arm/helper.c | 6 ++-- | ||
109 | target/arm/machine.c | 10 ++++++ | ||
110 | target/arm/tlb_helper.c | 63 ++++++++++++++++++++++++++++---------- | ||
111 | target/arm/translate-a64.c | 23 ++++++++++++-- | ||
112 | target/arm/translate.c | 58 ++++++++++++++++++++++++++--------- | ||
113 | target/i386/tcg/translate.c | 12 ++------ | ||
114 | tests/qtest/bios-tables-test.c | 38 +++++++++++++++++++++++ | ||
115 | tests/tcg/aarch64/pcalign-a64.c | 37 ++++++++++++++++++++++ | ||
116 | tests/tcg/arm/pcalign-a32.c | 46 ++++++++++++++++++++++++++++ | ||
117 | hw/arm/Kconfig | 1 + | ||
118 | hw/intc/Kconfig | 5 +++ | ||
119 | hw/intc/meson.build | 11 ++++--- | ||
120 | tests/data/acpi/q35/DSDT.viot | Bin 0 -> 9398 bytes | ||
121 | tests/data/acpi/q35/VIOT.viot | Bin 0 -> 112 bytes | ||
122 | tests/data/acpi/virt/VIOT | Bin 0 -> 88 bytes | ||
123 | tests/tcg/aarch64/Makefile.target | 4 +-- | ||
124 | tests/tcg/arm/Makefile.target | 4 +++ | ||
125 | 44 files changed, 429 insertions(+), 145 deletions(-) | ||
126 | create mode 100644 hw/intc/arm_gicv3_cpuif_common.c | ||
127 | create mode 100644 tests/tcg/aarch64/pcalign-a64.c | ||
128 | create mode 100644 tests/tcg/arm/pcalign-a32.c | ||
129 | create mode 100644 tests/data/acpi/q35/DSDT.viot | ||
130 | create mode 100644 tests/data/acpi/q35/VIOT.viot | ||
131 | create mode 100644 tests/data/acpi/virt/VIOT | ||
132 | diff view generated by jsdifflib |
1 | From: Jean-Philippe Brucker <jean-philippe@linaro.org> | 1 | From: Philippe Mathieu-Daudé <philmd@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | The VIOT blob contains the following: | 3 | Similarly to commits dadbb58f59..5ae79fe825 for other ARM boards, |
4 | connect FIQ output of the GIC CPU interfaces to the CPU. | ||
4 | 5 | ||
5 | [000h 0000 4] Signature : "VIOT" [Virtual I/O Translation Table] | 6 | Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
6 | [004h 0004 4] Table Length : 00000058 | 7 | Message-id: 20240130152548.17855-1-philmd@linaro.org |
7 | [008h 0008 1] Revision : 00 | 8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
8 | [009h 0009 1] Checksum : 66 | ||
9 | [00Ah 0010 6] Oem ID : "BOCHS " | ||
10 | [010h 0016 8] Oem Table ID : "BXPC " | ||
11 | [018h 0024 4] Oem Revision : 00000001 | ||
12 | [01Ch 0028 4] Asl Compiler ID : "BXPC" | ||
13 | [020h 0032 4] Asl Compiler Revision : 00000001 | ||
14 | |||
15 | [024h 0036 2] Node count : 0002 | ||
16 | [026h 0038 2] Node offset : 0030 | ||
17 | [028h 0040 8] Reserved : 0000000000000000 | ||
18 | |||
19 | [030h 0048 1] Type : 03 [VirtIO-PCI IOMMU] | ||
20 | [031h 0049 1] Reserved : 00 | ||
21 | [032h 0050 2] Length : 0010 | ||
22 | |||
23 | [034h 0052 2] PCI Segment : 0000 | ||
24 | [036h 0054 2] PCI BDF number : 0008 | ||
25 | [038h 0056 8] Reserved : 0000000000000000 | ||
26 | |||
27 | [040h 0064 1] Type : 01 [PCI Range] | ||
28 | [041h 0065 1] Reserved : 00 | ||
29 | [042h 0066 2] Length : 0018 | ||
30 | |||
31 | [044h 0068 4] Endpoint start : 00000000 | ||
32 | [048h 0072 2] PCI Segment start : 0000 | ||
33 | [04Ah 0074 2] PCI Segment end : 0000 | ||
34 | [04Ch 0076 2] PCI BDF start : 0000 | ||
35 | [04Eh 0078 2] PCI BDF end : 00FF | ||
36 | [050h 0080 2] Output node : 0030 | ||
37 | [052h 0082 6] Reserved : 000000000000 | ||
38 | |||
39 | Acked-by: Ani Sinha <ani@anisinha.ca> | ||
40 | Reviewed-by: Eric Auger <eric.auger@redhat.com> | ||
41 | Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org> | ||
42 | Message-id: 20211210170415.583179-9-jean-philippe@linaro.org | ||
43 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
44 | --- | 10 | --- |
45 | tests/qtest/bios-tables-test-allowed-diff.h | 1 - | 11 | hw/arm/xilinx_zynq.c | 2 ++ |
46 | tests/data/acpi/virt/VIOT | Bin 0 -> 88 bytes | 12 | 1 file changed, 2 insertions(+) |
47 | 2 files changed, 1 deletion(-) | ||
48 | 13 | ||
49 | diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h | 14 | diff --git a/hw/arm/xilinx_zynq.c b/hw/arm/xilinx_zynq.c |
50 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
51 | --- a/tests/qtest/bios-tables-test-allowed-diff.h | 16 | --- a/hw/arm/xilinx_zynq.c |
52 | +++ b/tests/qtest/bios-tables-test-allowed-diff.h | 17 | +++ b/hw/arm/xilinx_zynq.c |
53 | @@ -1,2 +1 @@ | 18 | @@ -XXX,XX +XXX,XX @@ static void zynq_init(MachineState *machine) |
54 | /* List of comma-separated changed AML files to ignore */ | 19 | sysbus_mmio_map(busdev, 0, MPCORE_PERIPHBASE); |
55 | -"tests/data/acpi/virt/VIOT", | 20 | sysbus_connect_irq(busdev, 0, |
56 | diff --git a/tests/data/acpi/virt/VIOT b/tests/data/acpi/virt/VIOT | 21 | qdev_get_gpio_in(DEVICE(cpu), ARM_CPU_IRQ)); |
57 | index XXXXXXX..XXXXXXX 100644 | 22 | + sysbus_connect_irq(busdev, 1, |
58 | GIT binary patch | 23 | + qdev_get_gpio_in(DEVICE(cpu), ARM_CPU_FIQ)); |
59 | literal 88 | 24 | |
60 | zcmWIZ^bd((0D?3pe`k+i1*eDrX9XZ&1PX!JAexE60Hgv8m>C3sGzXN&z`)2L0cSHX | 25 | for (n = 0; n < 64; n++) { |
61 | I{D-Rq0Q5fy0RR91 | 26 | pic[n] = qdev_get_gpio_in(dev, n); |
62 | |||
63 | literal 0 | ||
64 | HcmV?d00001 | ||
65 | |||
66 | -- | 27 | -- |
67 | 2.25.1 | 28 | 2.34.1 |
68 | 29 | ||
69 | 30 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Create arm_check_ss_active and arm_check_kernelpage. | 3 | The API does not generate an error for setting ASYNC | SYNC; that merely |
4 | constrains the selection vs the per-cpu default. For qemu linux-user, | ||
5 | choose SYNC as the default. | ||
4 | 6 | ||
5 | Reverse the order of the tests. While it doesn't matter in practice, | 7 | Cc: qemu-stable@nongnu.org |
6 | because only user-only has a kernel page and user-only never sets | 8 | Reported-by: Gustavo Romero <gustavo.romero@linaro.org> |
7 | ss_active, ss_active has priority over execution exceptions and it | ||
8 | is best to keep them in the proper order. | ||
9 | |||
10 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 9 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
11 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Tested-by: Gustavo Romero <gustavo.romero@linaro.org> |
11 | Message-id: 20240207025210.8837-2-richard.henderson@linaro.org | ||
12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
13 | --- | 13 | --- |
14 | target/arm/translate.c | 10 +++++++--- | 14 | linux-user/aarch64/target_prctl.h | 29 +++++++++++++++++------------ |
15 | 1 file changed, 7 insertions(+), 3 deletions(-) | 15 | 1 file changed, 17 insertions(+), 12 deletions(-) |
16 | 16 | ||
17 | diff --git a/target/arm/translate.c b/target/arm/translate.c | 17 | diff --git a/linux-user/aarch64/target_prctl.h b/linux-user/aarch64/target_prctl.h |
18 | index XXXXXXX..XXXXXXX 100644 | 18 | index XXXXXXX..XXXXXXX 100644 |
19 | --- a/target/arm/translate.c | 19 | --- a/linux-user/aarch64/target_prctl.h |
20 | +++ b/target/arm/translate.c | 20 | +++ b/linux-user/aarch64/target_prctl.h |
21 | @@ -XXX,XX +XXX,XX @@ static void arm_tr_insn_start(DisasContextBase *dcbase, CPUState *cpu) | 21 | @@ -XXX,XX +XXX,XX @@ static abi_long do_prctl_set_tagged_addr_ctrl(CPUArchState *env, abi_long arg2) |
22 | dc->insn_start = tcg_last_op(); | 22 | env->tagged_addr_enable = arg2 & PR_TAGGED_ADDR_ENABLE; |
23 | } | 23 | |
24 | 24 | if (cpu_isar_feature(aa64_mte, cpu)) { | |
25 | -static bool arm_pre_translate_insn(DisasContext *dc) | 25 | - switch (arg2 & PR_MTE_TCF_MASK) { |
26 | +static bool arm_check_kernelpage(DisasContext *dc) | 26 | - case PR_MTE_TCF_NONE: |
27 | { | 27 | - case PR_MTE_TCF_SYNC: |
28 | #ifdef CONFIG_USER_ONLY | 28 | - case PR_MTE_TCF_ASYNC: |
29 | /* Intercept jump to the magic kernel page. */ | 29 | - break; |
30 | @@ -XXX,XX +XXX,XX @@ static bool arm_pre_translate_insn(DisasContext *dc) | 30 | - default: |
31 | return true; | 31 | - return -EINVAL; |
32 | } | 32 | - } |
33 | #endif | 33 | - |
34 | + return false; | 34 | /* |
35 | +} | 35 | * Write PR_MTE_TCF to SCTLR_EL1[TCF0]. |
36 | 36 | - * Note that the syscall values are consistent with hw. | |
37 | +static bool arm_check_ss_active(DisasContext *dc) | 37 | + * |
38 | +{ | 38 | + * The kernel has a per-cpu configuration for the sysadmin, |
39 | if (dc->ss_active && !dc->pstate_ss) { | 39 | + * /sys/devices/system/cpu/cpu<N>/mte_tcf_preferred, |
40 | /* Singlestep state is Active-pending. | 40 | + * which qemu does not implement. |
41 | * If we're in this state at the start of a TB then either | 41 | + * |
42 | @@ -XXX,XX +XXX,XX @@ static void arm_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) | 42 | + * Because there is no performance difference between the modes, and |
43 | uint32_t pc = dc->base.pc_next; | 43 | + * because SYNC is most useful for debugging MTE errors, choose SYNC |
44 | unsigned int insn; | 44 | + * as the preferred mode. With this preference, and the way the API |
45 | 45 | + * uses only two bits, there is no way for the program to select | |
46 | - if (arm_pre_translate_insn(dc)) { | 46 | + * ASYMM mode. |
47 | + if (arm_check_ss_active(dc) || arm_check_kernelpage(dc)) { | 47 | */ |
48 | dc->base.pc_next = pc + 4; | 48 | - env->cp15.sctlr_el[1] = |
49 | return; | 49 | - deposit64(env->cp15.sctlr_el[1], 38, 2, arg2 >> PR_MTE_TCF_SHIFT); |
50 | } | 50 | + unsigned tcf = 0; |
51 | @@ -XXX,XX +XXX,XX @@ static void thumb_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) | 51 | + if (arg2 & PR_MTE_TCF_SYNC) { |
52 | uint32_t insn; | 52 | + tcf = 1; |
53 | bool is_16bit; | 53 | + } else if (arg2 & PR_MTE_TCF_ASYNC) { |
54 | 54 | + tcf = 2; | |
55 | - if (arm_pre_translate_insn(dc)) { | 55 | + } |
56 | + if (arm_check_ss_active(dc) || arm_check_kernelpage(dc)) { | 56 | + env->cp15.sctlr_el[1] = deposit64(env->cp15.sctlr_el[1], 38, 2, tcf); |
57 | dc->base.pc_next = pc + 2; | 57 | |
58 | return; | 58 | /* |
59 | } | 59 | * Write PR_MTE_TAG to GCR_EL1[Exclude]. |
60 | -- | 60 | -- |
61 | 2.25.1 | 61 | 2.34.1 |
62 | |||
63 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | The field is encoded as [0-3], which is convenient for | ||
4 | indexing our array of function pointers, but the true | ||
5 | value is [1-4]. Adjust before calling do_mem_zpa. | ||
6 | |||
7 | Add an assert, and move the comment re passing ZT to | ||
8 | the helper back next to the relevant code. | ||
9 | |||
10 | Cc: qemu-stable@nongnu.org | ||
11 | Fixes: 206adacfb8d ("target/arm: Add mte helpers for sve scalar + int loads") | ||
3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 12 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
13 | Tested-by: Gustavo Romero <gustavo.romero@linaro.org> | ||
14 | Message-id: 20240207025210.8837-3-richard.henderson@linaro.org | ||
4 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 15 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
5 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 16 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
6 | --- | 17 | --- |
7 | target/arm/translate.c | 16 ++++++++-------- | 18 | target/arm/tcg/translate-sve.c | 16 ++++++++-------- |
8 | 1 file changed, 8 insertions(+), 8 deletions(-) | 19 | 1 file changed, 8 insertions(+), 8 deletions(-) |
9 | 20 | ||
10 | diff --git a/target/arm/translate.c b/target/arm/translate.c | 21 | diff --git a/target/arm/tcg/translate-sve.c b/target/arm/tcg/translate-sve.c |
11 | index XXXXXXX..XXXXXXX 100644 | 22 | index XXXXXXX..XXXXXXX 100644 |
12 | --- a/target/arm/translate.c | 23 | --- a/target/arm/tcg/translate-sve.c |
13 | +++ b/target/arm/translate.c | 24 | +++ b/target/arm/tcg/translate-sve.c |
14 | @@ -XXX,XX +XXX,XX @@ static void thumb_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) | 25 | @@ -XXX,XX +XXX,XX @@ static void do_mem_zpa(DisasContext *s, int zt, int pg, TCGv_i64 addr, |
15 | { | 26 | TCGv_ptr t_pg; |
16 | DisasContext *dc = container_of(dcbase, DisasContext, base); | 27 | int desc = 0; |
17 | CPUARMState *env = cpu->env_ptr; | 28 | |
18 | + uint32_t pc = dc->base.pc_next; | 29 | - /* |
19 | uint32_t insn; | 30 | - * For e.g. LD4, there are not enough arguments to pass all 4 |
20 | bool is_16bit; | 31 | - * registers as pointers, so encode the regno into the data field. |
21 | 32 | - * For consistency, do this even for LD1. | |
22 | if (arm_pre_translate_insn(dc)) { | 33 | - */ |
23 | - dc->base.pc_next += 2; | 34 | + assert(mte_n >= 1 && mte_n <= 4); |
24 | + dc->base.pc_next = pc + 2; | 35 | if (s->mte_active[0]) { |
25 | return; | 36 | int msz = dtype_msz(dtype); |
37 | |||
38 | @@ -XXX,XX +XXX,XX @@ static void do_mem_zpa(DisasContext *s, int zt, int pg, TCGv_i64 addr, | ||
39 | addr = clean_data_tbi(s, addr); | ||
26 | } | 40 | } |
27 | 41 | ||
28 | - dc->pc_curr = dc->base.pc_next; | 42 | + /* |
29 | - insn = arm_lduw_code(env, &dc->base, dc->base.pc_next, dc->sctlr_b); | 43 | + * For e.g. LD4, there are not enough arguments to pass all 4 |
30 | + dc->pc_curr = pc; | 44 | + * registers as pointers, so encode the regno into the data field. |
31 | + insn = arm_lduw_code(env, &dc->base, pc, dc->sctlr_b); | 45 | + * For consistency, do this even for LD1. |
32 | is_16bit = thumb_insn_is_16bit(dc, dc->base.pc_next, insn); | 46 | + */ |
33 | - dc->base.pc_next += 2; | 47 | desc = simd_desc(vsz, vsz, zt | desc); |
34 | + pc += 2; | 48 | t_pg = tcg_temp_new_ptr(); |
35 | if (!is_16bit) { | 49 | |
36 | - uint32_t insn2 = arm_lduw_code(env, &dc->base, dc->base.pc_next, | 50 | @@ -XXX,XX +XXX,XX @@ static void do_ld_zpa(DisasContext *s, int zt, int pg, |
37 | - dc->sctlr_b); | 51 | * accessible via the instruction encoding. |
38 | - | 52 | */ |
39 | + uint32_t insn2 = arm_lduw_code(env, &dc->base, pc, dc->sctlr_b); | 53 | assert(fn != NULL); |
40 | insn = insn << 16 | insn2; | 54 | - do_mem_zpa(s, zt, pg, addr, dtype, nreg, false, fn); |
41 | - dc->base.pc_next += 2; | 55 | + do_mem_zpa(s, zt, pg, addr, dtype, nreg + 1, false, fn); |
42 | + pc += 2; | 56 | } |
57 | |||
58 | static bool trans_LD_zprr(DisasContext *s, arg_rprr_load *a) | ||
59 | @@ -XXX,XX +XXX,XX @@ static void do_st_zpa(DisasContext *s, int zt, int pg, TCGv_i64 addr, | ||
60 | if (nreg == 0) { | ||
61 | /* ST1 */ | ||
62 | fn = fn_single[s->mte_active[0]][be][msz][esz]; | ||
63 | - nreg = 1; | ||
64 | } else { | ||
65 | /* ST2, ST3, ST4 -- msz == esz, enforced by encoding */ | ||
66 | assert(msz == esz); | ||
67 | fn = fn_multiple[s->mte_active[0]][be][nreg - 1][msz]; | ||
43 | } | 68 | } |
44 | + dc->base.pc_next = pc; | 69 | assert(fn != NULL); |
45 | dc->insn = insn; | 70 | - do_mem_zpa(s, zt, pg, addr, msz_dtype(s, msz), nreg, true, fn); |
46 | 71 | + do_mem_zpa(s, zt, pg, addr, msz_dtype(s, msz), nreg + 1, true, fn); | |
47 | if (dc->pstate_il) { | 72 | } |
73 | |||
74 | static bool trans_ST_zprr(DisasContext *s, arg_rprr_store *a) | ||
48 | -- | 75 | -- |
49 | 2.25.1 | 76 | 2.34.1 |
50 | |||
51 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | When we added SVE_MTEDESC_SHIFT, we effectively limited the | ||
4 | maximum size of MTEDESC. Adjust SIZEM1 to consume the remaining | ||
5 | bits (32 - 10 - 5 - 12 == 5). Assert that the data to be stored | ||
6 | fits within the field (expecting 8 * 4 - 1 == 31, exact fit). | ||
7 | |||
8 | Cc: qemu-stable@nongnu.org | ||
9 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 10 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
4 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 11 | Tested-by: Gustavo Romero <gustavo.romero@linaro.org> |
12 | Message-id: 20240207025210.8837-4-richard.henderson@linaro.org | ||
5 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 13 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
6 | --- | 14 | --- |
7 | target/arm/translate.c | 9 +++++---- | 15 | target/arm/internals.h | 2 +- |
8 | 1 file changed, 5 insertions(+), 4 deletions(-) | 16 | target/arm/tcg/translate-sve.c | 7 ++++--- |
17 | 2 files changed, 5 insertions(+), 4 deletions(-) | ||
9 | 18 | ||
10 | diff --git a/target/arm/translate.c b/target/arm/translate.c | 19 | diff --git a/target/arm/internals.h b/target/arm/internals.h |
11 | index XXXXXXX..XXXXXXX 100644 | 20 | index XXXXXXX..XXXXXXX 100644 |
12 | --- a/target/arm/translate.c | 21 | --- a/target/arm/internals.h |
13 | +++ b/target/arm/translate.c | 22 | +++ b/target/arm/internals.h |
14 | @@ -XXX,XX +XXX,XX @@ static void arm_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) | 23 | @@ -XXX,XX +XXX,XX @@ FIELD(MTEDESC, TBI, 4, 2) |
24 | FIELD(MTEDESC, TCMA, 6, 2) | ||
25 | FIELD(MTEDESC, WRITE, 8, 1) | ||
26 | FIELD(MTEDESC, ALIGN, 9, 3) | ||
27 | -FIELD(MTEDESC, SIZEM1, 12, SIMD_DATA_BITS - 12) /* size - 1 */ | ||
28 | +FIELD(MTEDESC, SIZEM1, 12, SIMD_DATA_BITS - SVE_MTEDESC_SHIFT - 12) /* size - 1 */ | ||
29 | |||
30 | bool mte_probe(CPUARMState *env, uint32_t desc, uint64_t ptr); | ||
31 | uint64_t mte_check(CPUARMState *env, uint32_t desc, uint64_t ptr, uintptr_t ra); | ||
32 | diff --git a/target/arm/tcg/translate-sve.c b/target/arm/tcg/translate-sve.c | ||
33 | index XXXXXXX..XXXXXXX 100644 | ||
34 | --- a/target/arm/tcg/translate-sve.c | ||
35 | +++ b/target/arm/tcg/translate-sve.c | ||
36 | @@ -XXX,XX +XXX,XX @@ static void do_mem_zpa(DisasContext *s, int zt, int pg, TCGv_i64 addr, | ||
15 | { | 37 | { |
16 | DisasContext *dc = container_of(dcbase, DisasContext, base); | 38 | unsigned vsz = vec_full_reg_size(s); |
17 | CPUARMState *env = cpu->env_ptr; | 39 | TCGv_ptr t_pg; |
18 | + uint32_t pc = dc->base.pc_next; | 40 | + uint32_t sizem1; |
19 | unsigned int insn; | 41 | int desc = 0; |
20 | 42 | ||
21 | if (arm_pre_translate_insn(dc)) { | 43 | assert(mte_n >= 1 && mte_n <= 4); |
22 | - dc->base.pc_next += 4; | 44 | + sizem1 = (mte_n << dtype_msz(dtype)) - 1; |
23 | + dc->base.pc_next = pc + 4; | 45 | + assert(sizem1 <= R_MTEDESC_SIZEM1_MASK >> R_MTEDESC_SIZEM1_SHIFT); |
24 | return; | 46 | if (s->mte_active[0]) { |
25 | } | 47 | - int msz = dtype_msz(dtype); |
26 | 48 | - | |
27 | - dc->pc_curr = dc->base.pc_next; | 49 | desc = FIELD_DP32(desc, MTEDESC, MIDX, get_mem_index(s)); |
28 | - insn = arm_ldl_code(env, &dc->base, dc->base.pc_next, dc->sctlr_b); | 50 | desc = FIELD_DP32(desc, MTEDESC, TBI, s->tbid); |
29 | + dc->pc_curr = pc; | 51 | desc = FIELD_DP32(desc, MTEDESC, TCMA, s->tcma); |
30 | + insn = arm_ldl_code(env, &dc->base, pc, dc->sctlr_b); | 52 | desc = FIELD_DP32(desc, MTEDESC, WRITE, is_write); |
31 | dc->insn = insn; | 53 | - desc = FIELD_DP32(desc, MTEDESC, SIZEM1, (mte_n << msz) - 1); |
32 | - dc->base.pc_next += 4; | 54 | + desc = FIELD_DP32(desc, MTEDESC, SIZEM1, sizem1); |
33 | + dc->base.pc_next = pc + 4; | 55 | desc <<= SVE_MTEDESC_SHIFT; |
34 | disas_arm_insn(dc, insn); | 56 | } else { |
35 | 57 | addr = clean_data_tbi(s, addr); | |
36 | arm_post_translate_insn(dc); | ||
37 | -- | 58 | -- |
38 | 2.25.1 | 59 | 2.34.1 |
39 | |||
40 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Share code that creates mtedesc and embeds within simd_desc. | ||
4 | |||
5 | Cc: qemu-stable@nongnu.org | ||
3 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 6 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
4 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 7 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
8 | Tested-by: Gustavo Romero <gustavo.romero@linaro.org> | ||
9 | Message-id: 20240207025210.8837-5-richard.henderson@linaro.org | ||
5 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
6 | --- | 11 | --- |
7 | tests/tcg/aarch64/pcalign-a64.c | 37 +++++++++++++++++++++++++ | 12 | target/arm/tcg/translate-a64.h | 2 ++ |
8 | tests/tcg/arm/pcalign-a32.c | 46 +++++++++++++++++++++++++++++++ | 13 | target/arm/tcg/translate-sme.c | 15 +++-------- |
9 | tests/tcg/aarch64/Makefile.target | 4 +-- | 14 | target/arm/tcg/translate-sve.c | 47 ++++++++++++++++++---------------- |
10 | tests/tcg/arm/Makefile.target | 4 +++ | 15 | 3 files changed, 31 insertions(+), 33 deletions(-) |
11 | 4 files changed, 89 insertions(+), 2 deletions(-) | ||
12 | create mode 100644 tests/tcg/aarch64/pcalign-a64.c | ||
13 | create mode 100644 tests/tcg/arm/pcalign-a32.c | ||
14 | 16 | ||
15 | diff --git a/tests/tcg/aarch64/pcalign-a64.c b/tests/tcg/aarch64/pcalign-a64.c | 17 | diff --git a/target/arm/tcg/translate-a64.h b/target/arm/tcg/translate-a64.h |
16 | new file mode 100644 | 18 | index XXXXXXX..XXXXXXX 100644 |
17 | index XXXXXXX..XXXXXXX | 19 | --- a/target/arm/tcg/translate-a64.h |
18 | --- /dev/null | 20 | +++ b/target/arm/tcg/translate-a64.h |
19 | +++ b/tests/tcg/aarch64/pcalign-a64.c | 21 | @@ -XXX,XX +XXX,XX @@ bool logic_imm_decode_wmask(uint64_t *result, unsigned int immn, |
20 | @@ -XXX,XX +XXX,XX @@ | 22 | bool sve_access_check(DisasContext *s); |
21 | +/* Test PC misalignment exception */ | 23 | bool sme_enabled_check(DisasContext *s); |
24 | bool sme_enabled_check_with_svcr(DisasContext *s, unsigned); | ||
25 | +uint32_t make_svemte_desc(DisasContext *s, unsigned vsz, uint32_t nregs, | ||
26 | + uint32_t msz, bool is_write, uint32_t data); | ||
27 | |||
28 | /* This function corresponds to CheckStreamingSVEEnabled. */ | ||
29 | static inline bool sme_sm_enabled_check(DisasContext *s) | ||
30 | diff --git a/target/arm/tcg/translate-sme.c b/target/arm/tcg/translate-sme.c | ||
31 | index XXXXXXX..XXXXXXX 100644 | ||
32 | --- a/target/arm/tcg/translate-sme.c | ||
33 | +++ b/target/arm/tcg/translate-sme.c | ||
34 | @@ -XXX,XX +XXX,XX @@ static bool trans_LDST1(DisasContext *s, arg_LDST1 *a) | ||
35 | |||
36 | TCGv_ptr t_za, t_pg; | ||
37 | TCGv_i64 addr; | ||
38 | - int svl, desc = 0; | ||
39 | + uint32_t desc; | ||
40 | bool be = s->be_data == MO_BE; | ||
41 | bool mte = s->mte_active[0]; | ||
42 | |||
43 | @@ -XXX,XX +XXX,XX @@ static bool trans_LDST1(DisasContext *s, arg_LDST1 *a) | ||
44 | tcg_gen_shli_i64(addr, cpu_reg(s, a->rm), a->esz); | ||
45 | tcg_gen_add_i64(addr, addr, cpu_reg_sp(s, a->rn)); | ||
46 | |||
47 | - if (mte) { | ||
48 | - desc = FIELD_DP32(desc, MTEDESC, MIDX, get_mem_index(s)); | ||
49 | - desc = FIELD_DP32(desc, MTEDESC, TBI, s->tbid); | ||
50 | - desc = FIELD_DP32(desc, MTEDESC, TCMA, s->tcma); | ||
51 | - desc = FIELD_DP32(desc, MTEDESC, WRITE, a->st); | ||
52 | - desc = FIELD_DP32(desc, MTEDESC, SIZEM1, (1 << a->esz) - 1); | ||
53 | - desc <<= SVE_MTEDESC_SHIFT; | ||
54 | - } else { | ||
55 | + if (!mte) { | ||
56 | addr = clean_data_tbi(s, addr); | ||
57 | } | ||
58 | - svl = streaming_vec_reg_size(s); | ||
59 | - desc = simd_desc(svl, svl, desc); | ||
22 | + | 60 | + |
23 | +#include <assert.h> | 61 | + desc = make_svemte_desc(s, streaming_vec_reg_size(s), 1, a->esz, a->st, 0); |
24 | +#include <signal.h> | 62 | |
25 | +#include <stdlib.h> | 63 | fns[a->esz][be][a->v][mte][a->st](tcg_env, t_za, t_pg, addr, |
26 | +#include <stdio.h> | 64 | tcg_constant_i32(desc)); |
65 | diff --git a/target/arm/tcg/translate-sve.c b/target/arm/tcg/translate-sve.c | ||
66 | index XXXXXXX..XXXXXXX 100644 | ||
67 | --- a/target/arm/tcg/translate-sve.c | ||
68 | +++ b/target/arm/tcg/translate-sve.c | ||
69 | @@ -XXX,XX +XXX,XX @@ static const uint8_t dtype_esz[16] = { | ||
70 | 3, 2, 1, 3 | ||
71 | }; | ||
72 | |||
73 | -static void do_mem_zpa(DisasContext *s, int zt, int pg, TCGv_i64 addr, | ||
74 | - int dtype, uint32_t mte_n, bool is_write, | ||
75 | - gen_helper_gvec_mem *fn) | ||
76 | +uint32_t make_svemte_desc(DisasContext *s, unsigned vsz, uint32_t nregs, | ||
77 | + uint32_t msz, bool is_write, uint32_t data) | ||
78 | { | ||
79 | - unsigned vsz = vec_full_reg_size(s); | ||
80 | - TCGv_ptr t_pg; | ||
81 | uint32_t sizem1; | ||
82 | - int desc = 0; | ||
83 | + uint32_t desc = 0; | ||
84 | |||
85 | - assert(mte_n >= 1 && mte_n <= 4); | ||
86 | - sizem1 = (mte_n << dtype_msz(dtype)) - 1; | ||
87 | + /* Assert all of the data fits, with or without MTE enabled. */ | ||
88 | + assert(nregs >= 1 && nregs <= 4); | ||
89 | + sizem1 = (nregs << msz) - 1; | ||
90 | assert(sizem1 <= R_MTEDESC_SIZEM1_MASK >> R_MTEDESC_SIZEM1_SHIFT); | ||
91 | + assert(data < 1u << SVE_MTEDESC_SHIFT); | ||
27 | + | 92 | + |
28 | +static void *expected; | 93 | if (s->mte_active[0]) { |
29 | + | 94 | desc = FIELD_DP32(desc, MTEDESC, MIDX, get_mem_index(s)); |
30 | +static void sigbus(int sig, siginfo_t *info, void *vuc) | 95 | desc = FIELD_DP32(desc, MTEDESC, TBI, s->tbid); |
31 | +{ | 96 | @@ -XXX,XX +XXX,XX @@ static void do_mem_zpa(DisasContext *s, int zt, int pg, TCGv_i64 addr, |
32 | + assert(info->si_code == BUS_ADRALN); | 97 | desc = FIELD_DP32(desc, MTEDESC, WRITE, is_write); |
33 | + assert(info->si_addr == expected); | 98 | desc = FIELD_DP32(desc, MTEDESC, SIZEM1, sizem1); |
34 | + exit(EXIT_SUCCESS); | 99 | desc <<= SVE_MTEDESC_SHIFT; |
100 | - } else { | ||
101 | + } | ||
102 | + return simd_desc(vsz, vsz, desc | data); | ||
35 | +} | 103 | +} |
36 | + | 104 | + |
37 | +int main() | 105 | +static void do_mem_zpa(DisasContext *s, int zt, int pg, TCGv_i64 addr, |
106 | + int dtype, uint32_t nregs, bool is_write, | ||
107 | + gen_helper_gvec_mem *fn) | ||
38 | +{ | 108 | +{ |
39 | + void *tmp; | 109 | + TCGv_ptr t_pg; |
110 | + uint32_t desc; | ||
40 | + | 111 | + |
41 | + struct sigaction sa = { | 112 | + if (!s->mte_active[0]) { |
42 | + .sa_sigaction = sigbus, | 113 | addr = clean_data_tbi(s, addr); |
43 | + .sa_flags = SA_SIGINFO | 114 | } |
44 | + }; | 115 | |
116 | @@ -XXX,XX +XXX,XX @@ static void do_mem_zpa(DisasContext *s, int zt, int pg, TCGv_i64 addr, | ||
117 | * registers as pointers, so encode the regno into the data field. | ||
118 | * For consistency, do this even for LD1. | ||
119 | */ | ||
120 | - desc = simd_desc(vsz, vsz, zt | desc); | ||
121 | + desc = make_svemte_desc(s, vec_full_reg_size(s), nregs, | ||
122 | + dtype_msz(dtype), is_write, zt); | ||
123 | t_pg = tcg_temp_new_ptr(); | ||
124 | |||
125 | tcg_gen_addi_ptr(t_pg, tcg_env, pred_full_reg_offset(s, pg)); | ||
126 | @@ -XXX,XX +XXX,XX @@ static void do_mem_zpz(DisasContext *s, int zt, int pg, int zm, | ||
127 | int scale, TCGv_i64 scalar, int msz, bool is_write, | ||
128 | gen_helper_gvec_mem_scatter *fn) | ||
129 | { | ||
130 | - unsigned vsz = vec_full_reg_size(s); | ||
131 | TCGv_ptr t_zm = tcg_temp_new_ptr(); | ||
132 | TCGv_ptr t_pg = tcg_temp_new_ptr(); | ||
133 | TCGv_ptr t_zt = tcg_temp_new_ptr(); | ||
134 | - int desc = 0; | ||
135 | - | ||
136 | - if (s->mte_active[0]) { | ||
137 | - desc = FIELD_DP32(desc, MTEDESC, MIDX, get_mem_index(s)); | ||
138 | - desc = FIELD_DP32(desc, MTEDESC, TBI, s->tbid); | ||
139 | - desc = FIELD_DP32(desc, MTEDESC, TCMA, s->tcma); | ||
140 | - desc = FIELD_DP32(desc, MTEDESC, WRITE, is_write); | ||
141 | - desc = FIELD_DP32(desc, MTEDESC, SIZEM1, (1 << msz) - 1); | ||
142 | - desc <<= SVE_MTEDESC_SHIFT; | ||
143 | - } | ||
144 | - desc = simd_desc(vsz, vsz, desc | scale); | ||
145 | + uint32_t desc; | ||
146 | |||
147 | tcg_gen_addi_ptr(t_pg, tcg_env, pred_full_reg_offset(s, pg)); | ||
148 | tcg_gen_addi_ptr(t_zm, tcg_env, vec_full_reg_offset(s, zm)); | ||
149 | tcg_gen_addi_ptr(t_zt, tcg_env, vec_full_reg_offset(s, zt)); | ||
45 | + | 150 | + |
46 | + if (sigaction(SIGBUS, &sa, NULL) < 0) { | 151 | + desc = make_svemte_desc(s, vec_full_reg_size(s), 1, msz, is_write, scale); |
47 | + perror("sigaction"); | 152 | fn(tcg_env, t_zt, t_pg, t_zm, scalar, tcg_constant_i32(desc)); |
48 | + return EXIT_FAILURE; | 153 | } |
49 | + } | 154 | |
50 | + | ||
51 | + asm volatile("adr %0, 1f + 1\n\t" | ||
52 | + "str %0, %1\n\t" | ||
53 | + "br %0\n" | ||
54 | + "1:" | ||
55 | + : "=&r"(tmp), "=m"(expected)); | ||
56 | + abort(); | ||
57 | +} | ||
58 | diff --git a/tests/tcg/arm/pcalign-a32.c b/tests/tcg/arm/pcalign-a32.c | ||
59 | new file mode 100644 | ||
60 | index XXXXXXX..XXXXXXX | ||
61 | --- /dev/null | ||
62 | +++ b/tests/tcg/arm/pcalign-a32.c | ||
63 | @@ -XXX,XX +XXX,XX @@ | ||
64 | +/* Test PC misalignment exception */ | ||
65 | + | ||
66 | +#ifdef __thumb__ | ||
67 | +#error "This test must be compiled for ARM" | ||
68 | +#endif | ||
69 | + | ||
70 | +#include <assert.h> | ||
71 | +#include <signal.h> | ||
72 | +#include <stdlib.h> | ||
73 | +#include <stdio.h> | ||
74 | + | ||
75 | +static void *expected; | ||
76 | + | ||
77 | +static void sigbus(int sig, siginfo_t *info, void *vuc) | ||
78 | +{ | ||
79 | + assert(info->si_code == BUS_ADRALN); | ||
80 | + assert(info->si_addr == expected); | ||
81 | + exit(EXIT_SUCCESS); | ||
82 | +} | ||
83 | + | ||
84 | +int main() | ||
85 | +{ | ||
86 | + void *tmp; | ||
87 | + | ||
88 | + struct sigaction sa = { | ||
89 | + .sa_sigaction = sigbus, | ||
90 | + .sa_flags = SA_SIGINFO | ||
91 | + }; | ||
92 | + | ||
93 | + if (sigaction(SIGBUS, &sa, NULL) < 0) { | ||
94 | + perror("sigaction"); | ||
95 | + return EXIT_FAILURE; | ||
96 | + } | ||
97 | + | ||
98 | + asm volatile("adr %0, 1f + 2\n\t" | ||
99 | + "str %0, %1\n\t" | ||
100 | + "bx %0\n" | ||
101 | + "1:" | ||
102 | + : "=&r"(tmp), "=m"(expected)); | ||
103 | + | ||
104 | + /* | ||
105 | + * From v8, it is CONSTRAINED UNPREDICTABLE whether BXWritePC aligns | ||
106 | + * the address or not. If so, we can legitimately fall through. | ||
107 | + */ | ||
108 | + return EXIT_SUCCESS; | ||
109 | +} | ||
110 | diff --git a/tests/tcg/aarch64/Makefile.target b/tests/tcg/aarch64/Makefile.target | ||
111 | index XXXXXXX..XXXXXXX 100644 | ||
112 | --- a/tests/tcg/aarch64/Makefile.target | ||
113 | +++ b/tests/tcg/aarch64/Makefile.target | ||
114 | @@ -XXX,XX +XXX,XX @@ VPATH += $(ARM_SRC) | ||
115 | AARCH64_SRC=$(SRC_PATH)/tests/tcg/aarch64 | ||
116 | VPATH += $(AARCH64_SRC) | ||
117 | |||
118 | -# Float-convert Tests | ||
119 | -AARCH64_TESTS=fcvt | ||
120 | +# Base architecture tests | ||
121 | +AARCH64_TESTS=fcvt pcalign-a64 | ||
122 | |||
123 | fcvt: LDFLAGS+=-lm | ||
124 | |||
125 | diff --git a/tests/tcg/arm/Makefile.target b/tests/tcg/arm/Makefile.target | ||
126 | index XXXXXXX..XXXXXXX 100644 | ||
127 | --- a/tests/tcg/arm/Makefile.target | ||
128 | +++ b/tests/tcg/arm/Makefile.target | ||
129 | @@ -XXX,XX +XXX,XX @@ run-fcvt: fcvt | ||
130 | $(call run-test,fcvt,$(QEMU) $<,"$< on $(TARGET_NAME)") | ||
131 | $(call diff-out,fcvt,$(ARM_SRC)/fcvt.ref) | ||
132 | |||
133 | +# PC alignment test | ||
134 | +ARM_TESTS += pcalign-a32 | ||
135 | +pcalign-a32: CFLAGS+=-marm | ||
136 | + | ||
137 | ifeq ($(CONFIG_ARM_COMPATIBLE_SEMIHOSTING),y) | ||
138 | |||
139 | # Semihosting smoke test for linux-user | ||
140 | -- | 155 | -- |
141 | 2.25.1 | 156 | 2.34.1 |
142 | |||
143 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Misaligned thumb PC is architecturally impossible. | 3 | These functions "use the standard load helpers", but |
4 | Assert is better than proceeding, in case we've missed | 4 | fail to clean_data_tbi or populate mtedesc. |
5 | something somewhere. | ||
6 | 5 | ||
7 | Expand a comment about aligning the pc in gdbstub. | 6 | Cc: qemu-stable@nongnu.org |
8 | Fail an incoming migrate if a thumb pc is misaligned. | ||
9 | |||
10 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
11 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 8 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
9 | Tested-by: Gustavo Romero <gustavo.romero@linaro.org> | ||
10 | Message-id: 20240207025210.8837-6-richard.henderson@linaro.org | ||
12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
13 | --- | 12 | --- |
14 | target/arm/gdbstub.c | 9 +++++++-- | 13 | target/arm/tcg/translate-sve.c | 15 +++++++++++++-- |
15 | target/arm/machine.c | 10 ++++++++++ | 14 | 1 file changed, 13 insertions(+), 2 deletions(-) |
16 | target/arm/translate.c | 3 +++ | ||
17 | 3 files changed, 20 insertions(+), 2 deletions(-) | ||
18 | 15 | ||
19 | diff --git a/target/arm/gdbstub.c b/target/arm/gdbstub.c | 16 | diff --git a/target/arm/tcg/translate-sve.c b/target/arm/tcg/translate-sve.c |
20 | index XXXXXXX..XXXXXXX 100644 | 17 | index XXXXXXX..XXXXXXX 100644 |
21 | --- a/target/arm/gdbstub.c | 18 | --- a/target/arm/tcg/translate-sve.c |
22 | +++ b/target/arm/gdbstub.c | 19 | +++ b/target/arm/tcg/translate-sve.c |
23 | @@ -XXX,XX +XXX,XX @@ int arm_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n) | 20 | @@ -XXX,XX +XXX,XX @@ static void do_ldrq(DisasContext *s, int zt, int pg, TCGv_i64 addr, int dtype) |
24 | 21 | unsigned vsz = vec_full_reg_size(s); | |
25 | tmp = ldl_p(mem_buf); | 22 | TCGv_ptr t_pg; |
26 | 23 | int poff; | |
27 | - /* Mask out low bit of PC to workaround gdb bugs. This will probably | 24 | + uint32_t desc; |
28 | - cause problems if we ever implement the Jazelle DBX extensions. */ | 25 | |
29 | + /* | 26 | /* Load the first quadword using the normal predicated load helpers. */ |
30 | + * Mask out low bits of PC to workaround gdb bugs. | 27 | + if (!s->mte_active[0]) { |
31 | + * This avoids an assert in thumb_tr_translate_insn, because it is | 28 | + addr = clean_data_tbi(s, addr); |
32 | + * architecturally impossible to misalign the pc. | ||
33 | + * This will probably cause problems if we ever implement the | ||
34 | + * Jazelle DBX extensions. | ||
35 | + */ | ||
36 | if (n == 15) { | ||
37 | tmp &= ~1; | ||
38 | } | ||
39 | diff --git a/target/arm/machine.c b/target/arm/machine.c | ||
40 | index XXXXXXX..XXXXXXX 100644 | ||
41 | --- a/target/arm/machine.c | ||
42 | +++ b/target/arm/machine.c | ||
43 | @@ -XXX,XX +XXX,XX @@ static int cpu_post_load(void *opaque, int version_id) | ||
44 | return -1; | ||
45 | } | ||
46 | } | ||
47 | + | ||
48 | + /* | ||
49 | + * Misaligned thumb pc is architecturally impossible. | ||
50 | + * We have an assert in thumb_tr_translate_insn to verify this. | ||
51 | + * Fail an incoming migrate to avoid this assert. | ||
52 | + */ | ||
53 | + if (!is_a64(env) && env->thumb && (env->regs[15] & 1)) { | ||
54 | + return -1; | ||
55 | + } | 29 | + } |
56 | + | 30 | + |
57 | if (!kvm_enabled()) { | 31 | poff = pred_full_reg_offset(s, pg); |
58 | pmu_op_finish(&cpu->env); | 32 | if (vsz > 16) { |
33 | /* | ||
34 | @@ -XXX,XX +XXX,XX @@ static void do_ldrq(DisasContext *s, int zt, int pg, TCGv_i64 addr, int dtype) | ||
35 | |||
36 | gen_helper_gvec_mem *fn | ||
37 | = ldr_fns[s->mte_active[0]][s->be_data == MO_BE][dtype][0]; | ||
38 | - fn(tcg_env, t_pg, addr, tcg_constant_i32(simd_desc(16, 16, zt))); | ||
39 | + desc = make_svemte_desc(s, 16, 1, dtype_msz(dtype), false, zt); | ||
40 | + fn(tcg_env, t_pg, addr, tcg_constant_i32(desc)); | ||
41 | |||
42 | /* Replicate that first quadword. */ | ||
43 | if (vsz > 16) { | ||
44 | @@ -XXX,XX +XXX,XX @@ static void do_ldro(DisasContext *s, int zt, int pg, TCGv_i64 addr, int dtype) | ||
45 | unsigned vsz_r32; | ||
46 | TCGv_ptr t_pg; | ||
47 | int poff, doff; | ||
48 | + uint32_t desc; | ||
49 | |||
50 | if (vsz < 32) { | ||
51 | /* | ||
52 | @@ -XXX,XX +XXX,XX @@ static void do_ldro(DisasContext *s, int zt, int pg, TCGv_i64 addr, int dtype) | ||
59 | } | 53 | } |
60 | diff --git a/target/arm/translate.c b/target/arm/translate.c | 54 | |
61 | index XXXXXXX..XXXXXXX 100644 | 55 | /* Load the first octaword using the normal predicated load helpers. */ |
62 | --- a/target/arm/translate.c | 56 | + if (!s->mte_active[0]) { |
63 | +++ b/target/arm/translate.c | 57 | + addr = clean_data_tbi(s, addr); |
64 | @@ -XXX,XX +XXX,XX @@ static void thumb_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) | 58 | + } |
65 | uint32_t insn; | 59 | |
66 | bool is_16bit; | 60 | poff = pred_full_reg_offset(s, pg); |
67 | 61 | if (vsz > 32) { | |
68 | + /* Misaligned thumb PC is architecturally impossible. */ | 62 | @@ -XXX,XX +XXX,XX @@ static void do_ldro(DisasContext *s, int zt, int pg, TCGv_i64 addr, int dtype) |
69 | + assert((dc->base.pc_next & 1) == 0); | 63 | |
70 | + | 64 | gen_helper_gvec_mem *fn |
71 | if (arm_check_ss_active(dc) || arm_check_kernelpage(dc)) { | 65 | = ldr_fns[s->mte_active[0]][s->be_data == MO_BE][dtype][0]; |
72 | dc->base.pc_next = pc + 2; | 66 | - fn(tcg_env, t_pg, addr, tcg_constant_i32(simd_desc(32, 32, zt))); |
73 | return; | 67 | + desc = make_svemte_desc(s, 32, 1, dtype_msz(dtype), false, zt); |
68 | + fn(tcg_env, t_pg, addr, tcg_constant_i32(desc)); | ||
69 | |||
70 | /* | ||
71 | * Replicate that first octaword. | ||
74 | -- | 72 | -- |
75 | 2.25.1 | 73 | 2.34.1 |
76 | |||
77 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | The TBI and TCMA bits are located within mtedesc, not desc. | ||
4 | |||
5 | Cc: qemu-stable@nongnu.org | ||
6 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 7 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
4 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 8 | Tested-by: Gustavo Romero <gustavo.romero@linaro.org> |
9 | Message-id: 20240207025210.8837-7-richard.henderson@linaro.org | ||
5 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
6 | --- | 11 | --- |
7 | target/arm/translate-a64.c | 7 ++++--- | 12 | target/arm/tcg/sme_helper.c | 8 ++++---- |
8 | 1 file changed, 4 insertions(+), 3 deletions(-) | 13 | target/arm/tcg/sve_helper.c | 12 ++++++------ |
14 | 2 files changed, 10 insertions(+), 10 deletions(-) | ||
9 | 15 | ||
10 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c | 16 | diff --git a/target/arm/tcg/sme_helper.c b/target/arm/tcg/sme_helper.c |
11 | index XXXXXXX..XXXXXXX 100644 | 17 | index XXXXXXX..XXXXXXX 100644 |
12 | --- a/target/arm/translate-a64.c | 18 | --- a/target/arm/tcg/sme_helper.c |
13 | +++ b/target/arm/translate-a64.c | 19 | +++ b/target/arm/tcg/sme_helper.c |
14 | @@ -XXX,XX +XXX,XX @@ static void aarch64_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) | 20 | @@ -XXX,XX +XXX,XX @@ void sme_ld1_mte(CPUARMState *env, void *za, uint64_t *vg, |
15 | { | 21 | desc = extract32(desc, 0, SIMD_DATA_SHIFT + SVE_MTEDESC_SHIFT); |
16 | DisasContext *s = container_of(dcbase, DisasContext, base); | 22 | |
17 | CPUARMState *env = cpu->env_ptr; | 23 | /* Perform gross MTE suppression early. */ |
18 | + uint64_t pc = s->base.pc_next; | 24 | - if (!tbi_check(desc, bit55) || |
19 | uint32_t insn; | 25 | - tcma_check(desc, bit55, allocation_tag_from_addr(addr))) { |
20 | 26 | + if (!tbi_check(mtedesc, bit55) || | |
21 | if (s->ss_active && !s->pstate_ss) { | 27 | + tcma_check(mtedesc, bit55, allocation_tag_from_addr(addr))) { |
22 | @@ -XXX,XX +XXX,XX @@ static void aarch64_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) | 28 | mtedesc = 0; |
23 | return; | ||
24 | } | 29 | } |
25 | 30 | ||
26 | - s->pc_curr = s->base.pc_next; | 31 | @@ -XXX,XX +XXX,XX @@ void sme_st1_mte(CPUARMState *env, void *za, uint64_t *vg, target_ulong addr, |
27 | - insn = arm_ldl_code(env, &s->base, s->base.pc_next, s->sctlr_b); | 32 | desc = extract32(desc, 0, SIMD_DATA_SHIFT + SVE_MTEDESC_SHIFT); |
28 | + s->pc_curr = pc; | 33 | |
29 | + insn = arm_ldl_code(env, &s->base, pc, s->sctlr_b); | 34 | /* Perform gross MTE suppression early. */ |
30 | s->insn = insn; | 35 | - if (!tbi_check(desc, bit55) || |
31 | - s->base.pc_next += 4; | 36 | - tcma_check(desc, bit55, allocation_tag_from_addr(addr))) { |
32 | + s->base.pc_next = pc + 4; | 37 | + if (!tbi_check(mtedesc, bit55) || |
33 | 38 | + tcma_check(mtedesc, bit55, allocation_tag_from_addr(addr))) { | |
34 | s->fp_access_checked = false; | 39 | mtedesc = 0; |
35 | s->sve_access_checked = false; | 40 | } |
41 | |||
42 | diff --git a/target/arm/tcg/sve_helper.c b/target/arm/tcg/sve_helper.c | ||
43 | index XXXXXXX..XXXXXXX 100644 | ||
44 | --- a/target/arm/tcg/sve_helper.c | ||
45 | +++ b/target/arm/tcg/sve_helper.c | ||
46 | @@ -XXX,XX +XXX,XX @@ void sve_ldN_r_mte(CPUARMState *env, uint64_t *vg, target_ulong addr, | ||
47 | desc = extract32(desc, 0, SIMD_DATA_SHIFT + SVE_MTEDESC_SHIFT); | ||
48 | |||
49 | /* Perform gross MTE suppression early. */ | ||
50 | - if (!tbi_check(desc, bit55) || | ||
51 | - tcma_check(desc, bit55, allocation_tag_from_addr(addr))) { | ||
52 | + if (!tbi_check(mtedesc, bit55) || | ||
53 | + tcma_check(mtedesc, bit55, allocation_tag_from_addr(addr))) { | ||
54 | mtedesc = 0; | ||
55 | } | ||
56 | |||
57 | @@ -XXX,XX +XXX,XX @@ void sve_ldnfff1_r_mte(CPUARMState *env, void *vg, target_ulong addr, | ||
58 | desc = extract32(desc, 0, SIMD_DATA_SHIFT + SVE_MTEDESC_SHIFT); | ||
59 | |||
60 | /* Perform gross MTE suppression early. */ | ||
61 | - if (!tbi_check(desc, bit55) || | ||
62 | - tcma_check(desc, bit55, allocation_tag_from_addr(addr))) { | ||
63 | + if (!tbi_check(mtedesc, bit55) || | ||
64 | + tcma_check(mtedesc, bit55, allocation_tag_from_addr(addr))) { | ||
65 | mtedesc = 0; | ||
66 | } | ||
67 | |||
68 | @@ -XXX,XX +XXX,XX @@ void sve_stN_r_mte(CPUARMState *env, uint64_t *vg, target_ulong addr, | ||
69 | desc = extract32(desc, 0, SIMD_DATA_SHIFT + SVE_MTEDESC_SHIFT); | ||
70 | |||
71 | /* Perform gross MTE suppression early. */ | ||
72 | - if (!tbi_check(desc, bit55) || | ||
73 | - tcma_check(desc, bit55, allocation_tag_from_addr(addr))) { | ||
74 | + if (!tbi_check(mtedesc, bit55) || | ||
75 | + tcma_check(mtedesc, bit55, allocation_tag_from_addr(addr))) { | ||
76 | mtedesc = 0; | ||
77 | } | ||
78 | |||
36 | -- | 79 | -- |
37 | 2.25.1 | 80 | 2.34.1 |
38 | |||
39 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | The raven_io_ops MemoryRegionOps is the only one in the source tree |
---|---|---|---|
2 | which sets .valid.unaligned to indicate that it should support | ||
3 | unaligned accesses and which does not also set .impl.unaligned to | ||
4 | indicate that its read and write functions can do the unaligned | ||
5 | handling themselves. This is a problem, because at the moment the | ||
6 | core memory system does not implement the support for handling | ||
7 | unaligned accesses by doing a series of aligned accesses and | ||
8 | combining them (system/memory.c:access_with_adjusted_size() has a | ||
9 | TODO comment noting this). | ||
2 | 10 | ||
3 | The size of the code covered by a TranslationBlock cannot be 0; | 11 | Fortunately raven_io_read() and raven_io_write() will correctly deal |
4 | this is checked via assert in tb_gen_code. | 12 | with the case of being passed an unaligned address, so we can fix the |
13 | missing unaligned access support by setting .impl.unaligned in the | ||
14 | MemoryRegionOps struct. | ||
5 | 15 | ||
6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 16 | Fixes: 9a1839164c9c8f06 ("raven: Implement non-contiguous I/O region") |
7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 17 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
18 | Tested-by: Cédric Le Goater <clg@redhat.com> | ||
19 | Reviewed-by: Cédric Le Goater <clg@redhat.com> | ||
20 | Message-id: 20240112134640.1775041-1-peter.maydell@linaro.org | ||
9 | --- | 21 | --- |
10 | target/arm/translate-a64.c | 1 + | 22 | hw/pci-host/raven.c | 1 + |
11 | 1 file changed, 1 insertion(+) | 23 | 1 file changed, 1 insertion(+) |
12 | 24 | ||
13 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c | 25 | diff --git a/hw/pci-host/raven.c b/hw/pci-host/raven.c |
14 | index XXXXXXX..XXXXXXX 100644 | 26 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/target/arm/translate-a64.c | 27 | --- a/hw/pci-host/raven.c |
16 | +++ b/target/arm/translate-a64.c | 28 | +++ b/hw/pci-host/raven.c |
17 | @@ -XXX,XX +XXX,XX @@ static void aarch64_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) | 29 | @@ -XXX,XX +XXX,XX @@ static const MemoryRegionOps raven_io_ops = { |
18 | assert(s->base.num_insns == 1); | 30 | .write = raven_io_write, |
19 | gen_swstep_exception(s, 0, 0); | 31 | .endianness = DEVICE_LITTLE_ENDIAN, |
20 | s->base.is_jmp = DISAS_NORETURN; | 32 | .impl.max_access_size = 4, |
21 | + s->base.pc_next = pc + 4; | 33 | + .impl.unaligned = true, |
22 | return; | 34 | .valid.unaligned = true, |
23 | } | 35 | }; |
24 | 36 | ||
25 | -- | 37 | -- |
26 | 2.25.1 | 38 | 2.34.1 |
27 | 39 | ||
28 | 40 | diff view generated by jsdifflib |
1 | From: Jean-Philippe Brucker <jean-philippe@linaro.org> | 1 | Suppress the deprecation warning when we're running under qtest, |
---|---|---|---|
2 | to avoid "make check" including warning messages in its output. | ||
2 | 3 | ||
3 | To propagate errors to the caller of the pre_plug callback, use the | 4 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
4 | object_poperty_set*() functions directly instead of the qdev_prop_set*() | 5 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
5 | helpers. | 6 | Message-id: 20240206154151.155620-1-peter.maydell@linaro.org |
7 | --- | ||
8 | hw/block/tc58128.c | 4 +++- | ||
9 | 1 file changed, 3 insertions(+), 1 deletion(-) | ||
6 | 10 | ||
7 | Suggested-by: Igor Mammedov <imammedo@redhat.com> | 11 | diff --git a/hw/block/tc58128.c b/hw/block/tc58128.c |
8 | Reviewed-by: Eric Auger <eric.auger@redhat.com> | ||
9 | Reviewed-by: Igor Mammedov <imammedo@redhat.com> | ||
10 | Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org> | ||
11 | Message-id: 20211210170415.583179-5-jean-philippe@linaro.org | ||
12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
13 | --- | ||
14 | hw/arm/virt.c | 5 +++-- | ||
15 | 1 file changed, 3 insertions(+), 2 deletions(-) | ||
16 | |||
17 | diff --git a/hw/arm/virt.c b/hw/arm/virt.c | ||
18 | index XXXXXXX..XXXXXXX 100644 | 12 | index XXXXXXX..XXXXXXX 100644 |
19 | --- a/hw/arm/virt.c | 13 | --- a/hw/block/tc58128.c |
20 | +++ b/hw/arm/virt.c | 14 | +++ b/hw/block/tc58128.c |
21 | @@ -XXX,XX +XXX,XX @@ static void virt_machine_device_pre_plug_cb(HotplugHandler *hotplug_dev, | 15 | @@ -XXX,XX +XXX,XX @@ static sh7750_io_device tc58128 = { |
22 | db_start, db_end, | 16 | |
23 | VIRTIO_IOMMU_RESV_MEM_T_MSI); | 17 | int tc58128_init(struct SH7750State *s, const char *zone1, const char *zone2) |
24 | 18 | { | |
25 | - qdev_prop_set_uint32(dev, "len-reserved-regions", 1); | 19 | - warn_report_once("The TC58128 flash device is deprecated"); |
26 | - qdev_prop_set_string(dev, "reserved-regions[0]", resv_prop_str); | 20 | + if (!qtest_enabled()) { |
27 | + object_property_set_uint(OBJECT(dev), "len-reserved-regions", 1, errp); | 21 | + warn_report_once("The TC58128 flash device is deprecated"); |
28 | + object_property_set_str(OBJECT(dev), "reserved-regions[0]", | 22 | + } |
29 | + resv_prop_str, errp); | 23 | init_dev(&tc58128_devs[0], zone1); |
30 | g_free(resv_prop_str); | 24 | init_dev(&tc58128_devs[1], zone2); |
31 | } | 25 | return sh7750_register_io_device(s, &tc58128); |
32 | } | ||
33 | -- | 26 | -- |
34 | 2.25.1 | 27 | 2.34.1 |
35 | 28 | ||
36 | 29 | diff view generated by jsdifflib |
1 | From: Philippe Mathieu-Daudé <philmd@redhat.com> | 1 | We deliberately don't include qtests_npcm7xx in qtests_aarch64, |
---|---|---|---|
2 | because we already get the coverage of those tests via qtests_arm, | ||
3 | and we don't want to use extra CI minutes testing them twice. | ||
2 | 4 | ||
3 | The TYPE_ARM_GICV3 device is an emulated one. When using | 5 | In commit 327b680877b79c4b we added it to qtests_aarch64; revert |
4 | KVM, it is recommended to use the TYPE_KVM_ARM_GICV3 device | 6 | that change. |
5 | (which uses in-kernel support). | ||
6 | 7 | ||
7 | When using --with-devices-FOO, it is possible to build a | 8 | Fixes: 327b680877b79c4b ("tests/qtest: Creating qtest for GMAC Module") |
8 | binary with a specific set of devices. When this binary is | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
9 | restricted to KVM accelerator, the TYPE_ARM_GICV3 device is | 10 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
10 | irrelevant, and it is desirable to remove it from the binary. | 11 | Message-id: 20240206163043.315535-1-peter.maydell@linaro.org |
12 | --- | ||
13 | tests/qtest/meson.build | 1 - | ||
14 | 1 file changed, 1 deletion(-) | ||
11 | 15 | ||
12 | Therefore introduce the CONFIG_ARM_GIC_TCG Kconfig selector | 16 | diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build |
13 | which select the files required to have the TYPE_ARM_GICV3 | ||
14 | device, but also allowing to de-select this device. | ||
15 | |||
16 | Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
17 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
18 | Message-id: 20211115223619.2599282-3-philmd@redhat.com | ||
19 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
20 | --- | ||
21 | hw/intc/arm_gicv3.c | 2 +- | ||
22 | hw/intc/Kconfig | 5 +++++ | ||
23 | hw/intc/meson.build | 10 ++++++---- | ||
24 | 3 files changed, 12 insertions(+), 5 deletions(-) | ||
25 | |||
26 | diff --git a/hw/intc/arm_gicv3.c b/hw/intc/arm_gicv3.c | ||
27 | index XXXXXXX..XXXXXXX 100644 | 17 | index XXXXXXX..XXXXXXX 100644 |
28 | --- a/hw/intc/arm_gicv3.c | 18 | --- a/tests/qtest/meson.build |
29 | +++ b/hw/intc/arm_gicv3.c | 19 | +++ b/tests/qtest/meson.build |
30 | @@ -XXX,XX +XXX,XX @@ | 20 | @@ -XXX,XX +XXX,XX @@ qtests_aarch64 = \ |
31 | /* | 21 | (config_all_devices.has_key('CONFIG_RASPI') ? ['bcm2835-dma-test'] : []) + \ |
32 | - * ARM Generic Interrupt Controller v3 | 22 | (config_all_accel.has_key('CONFIG_TCG') and \ |
33 | + * ARM Generic Interrupt Controller v3 (emulation) | 23 | config_all_devices.has_key('CONFIG_TPM_TIS_I2C') ? ['tpm-tis-i2c-test'] : []) + \ |
34 | * | 24 | - (config_all_devices.has_key('CONFIG_NPCM7XX') ? qtests_npcm7xx : []) + \ |
35 | * Copyright (c) 2015 Huawei. | 25 | ['arm-cpu-features', |
36 | * Copyright (c) 2016 Linaro Limited | 26 | 'numa-test', |
37 | diff --git a/hw/intc/Kconfig b/hw/intc/Kconfig | 27 | 'boot-serial-test', |
38 | index XXXXXXX..XXXXXXX 100644 | ||
39 | --- a/hw/intc/Kconfig | ||
40 | +++ b/hw/intc/Kconfig | ||
41 | @@ -XXX,XX +XXX,XX @@ config APIC | ||
42 | select MSI_NONBROKEN | ||
43 | select I8259 | ||
44 | |||
45 | +config ARM_GIC_TCG | ||
46 | + bool | ||
47 | + default y | ||
48 | + depends on ARM_GIC && TCG | ||
49 | + | ||
50 | config ARM_GIC_KVM | ||
51 | bool | ||
52 | default y | ||
53 | diff --git a/hw/intc/meson.build b/hw/intc/meson.build | ||
54 | index XXXXXXX..XXXXXXX 100644 | ||
55 | --- a/hw/intc/meson.build | ||
56 | +++ b/hw/intc/meson.build | ||
57 | @@ -XXX,XX +XXX,XX @@ softmmu_ss.add(when: 'CONFIG_ARM_GIC', if_true: files( | ||
58 | 'arm_gic.c', | ||
59 | 'arm_gic_common.c', | ||
60 | 'arm_gicv2m.c', | ||
61 | - 'arm_gicv3.c', | ||
62 | 'arm_gicv3_common.c', | ||
63 | - 'arm_gicv3_dist.c', | ||
64 | 'arm_gicv3_its_common.c', | ||
65 | - 'arm_gicv3_redist.c', | ||
66 | +)) | ||
67 | +softmmu_ss.add(when: 'CONFIG_ARM_GIC_TCG', if_true: files( | ||
68 | + 'arm_gicv3.c', | ||
69 | + 'arm_gicv3_dist.c', | ||
70 | 'arm_gicv3_its.c', | ||
71 | + 'arm_gicv3_redist.c', | ||
72 | )) | ||
73 | softmmu_ss.add(when: 'CONFIG_ETRAXFS', if_true: files('etraxfs_pic.c')) | ||
74 | softmmu_ss.add(when: 'CONFIG_HEATHROW_PIC', if_true: files('heathrow_pic.c')) | ||
75 | @@ -XXX,XX +XXX,XX @@ softmmu_ss.add(when: 'CONFIG_XLNX_ZYNQMP_PMU', if_true: files('xlnx-pmu-iomod-in | ||
76 | specific_ss.add(when: 'CONFIG_ALLWINNER_A10_PIC', if_true: files('allwinner-a10-pic.c')) | ||
77 | specific_ss.add(when: 'CONFIG_APIC', if_true: files('apic.c', 'apic_common.c')) | ||
78 | specific_ss.add(when: 'CONFIG_ARM_GIC', if_true: files('arm_gicv3_cpuif_common.c')) | ||
79 | -specific_ss.add(when: 'CONFIG_ARM_GIC', if_true: files('arm_gicv3_cpuif.c')) | ||
80 | +specific_ss.add(when: 'CONFIG_ARM_GIC_TCG', if_true: files('arm_gicv3_cpuif.c')) | ||
81 | specific_ss.add(when: 'CONFIG_ARM_GIC_KVM', if_true: files('arm_gic_kvm.c')) | ||
82 | specific_ss.add(when: ['CONFIG_ARM_GIC_KVM', 'TARGET_AARCH64'], if_true: files('arm_gicv3_kvm.c', 'arm_gicv3_its_kvm.c')) | ||
83 | specific_ss.add(when: 'CONFIG_ARM_V7M', if_true: files('armv7m_nvic.c')) | ||
84 | -- | 28 | -- |
85 | 2.25.1 | 29 | 2.34.1 |
86 | 30 | ||
87 | 31 | diff view generated by jsdifflib |
1 | From: Jean-Philippe Brucker <jean-philippe@linaro.org> | 1 | Allow changes to the virt GTDT -- we are going to add the IRQ |
---|---|---|---|
2 | entry for a new timer to it. | ||
2 | 3 | ||
3 | Create empty data files and allow updates for the upcoming VIOT tests. | ||
4 | |||
5 | Acked-by: Igor Mammedov <imammedo@redhat.com> | ||
6 | Reviewed-by: Eric Auger <eric.auger@redhat.com> | ||
7 | Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org> | ||
8 | Message-id: 20211210170415.583179-6-jean-philippe@linaro.org | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 4 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
5 | Reviewed-by: Ard Biesheuvel <ardb@kernel.org> | ||
6 | Message-id: 20240122143537.233498-2-peter.maydell@linaro.org | ||
10 | --- | 7 | --- |
11 | tests/qtest/bios-tables-test-allowed-diff.h | 3 +++ | 8 | tests/qtest/bios-tables-test-allowed-diff.h | 2 ++ |
12 | tests/data/acpi/q35/DSDT.viot | 0 | 9 | 1 file changed, 2 insertions(+) |
13 | tests/data/acpi/q35/VIOT.viot | 0 | ||
14 | tests/data/acpi/virt/VIOT | 0 | ||
15 | 4 files changed, 3 insertions(+) | ||
16 | create mode 100644 tests/data/acpi/q35/DSDT.viot | ||
17 | create mode 100644 tests/data/acpi/q35/VIOT.viot | ||
18 | create mode 100644 tests/data/acpi/virt/VIOT | ||
19 | 10 | ||
20 | diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h | 11 | diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h |
21 | index XXXXXXX..XXXXXXX 100644 | 12 | index XXXXXXX..XXXXXXX 100644 |
22 | --- a/tests/qtest/bios-tables-test-allowed-diff.h | 13 | --- a/tests/qtest/bios-tables-test-allowed-diff.h |
23 | +++ b/tests/qtest/bios-tables-test-allowed-diff.h | 14 | +++ b/tests/qtest/bios-tables-test-allowed-diff.h |
24 | @@ -1 +1,4 @@ | 15 | @@ -1 +1,3 @@ |
25 | /* List of comma-separated changed AML files to ignore */ | 16 | /* List of comma-separated changed AML files to ignore */ |
26 | +"tests/data/acpi/virt/VIOT", | 17 | +"tests/data/acpi/virt/FACP", |
27 | +"tests/data/acpi/q35/DSDT.viot", | 18 | +"tests/data/acpi/virt/GTDT", |
28 | +"tests/data/acpi/q35/VIOT.viot", | ||
29 | diff --git a/tests/data/acpi/q35/DSDT.viot b/tests/data/acpi/q35/DSDT.viot | ||
30 | new file mode 100644 | ||
31 | index XXXXXXX..XXXXXXX | ||
32 | diff --git a/tests/data/acpi/q35/VIOT.viot b/tests/data/acpi/q35/VIOT.viot | ||
33 | new file mode 100644 | ||
34 | index XXXXXXX..XXXXXXX | ||
35 | diff --git a/tests/data/acpi/virt/VIOT b/tests/data/acpi/virt/VIOT | ||
36 | new file mode 100644 | ||
37 | index XXXXXXX..XXXXXXX | ||
38 | -- | 19 | -- |
39 | 2.25.1 | 20 | 2.34.1 |
40 | |||
41 | diff view generated by jsdifflib |
1 | From: Jean-Philippe Brucker <jean-philippe@linaro.org> | 1 | Armv8.1+ CPUs have the Virtual Host Extension (VHE) which adds a |
---|---|---|---|
2 | 2 | non-secure EL2 virtual timer. We implemented the timer itself in the | |
3 | When a virtio-iommu is instantiated, describe it using the ACPI VIOT | 3 | CPU model, but never wired up its IRQ line to the GIC. |
4 | table. | 4 | |
5 | 5 | Wire up the IRQ line (this is always safe whether the CPU has the | |
6 | Acked-by: Igor Mammedov <imammedo@redhat.com> | 6 | interrupt or not, since it always creates the outbound IRQ line). |
7 | Reviewed-by: Eric Auger <eric.auger@redhat.com> | 7 | Report it to the guest via dtb and ACPI if the CPU has the feature. |
8 | Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org> | 8 | |
9 | Message-id: 20211210170415.583179-2-jean-philippe@linaro.org | 9 | The DTB binding is documented in the kernel's |
10 | Documentation/devicetree/bindings/timer/arm\,arch_timer.yaml | ||
11 | and the ACPI table entries are documented in the ACPI specification | ||
12 | version 6.3 or later. | ||
13 | |||
14 | Because the IRQ line ACPI binding is new in 6.3, we need to bump the | ||
15 | FADT table rev to show that we might be using 6.3 features. | ||
16 | |||
17 | Note that exposing this IRQ in the DTB will trigger a bug in EDK2 | ||
18 | versions prior to edk2-stable202311, for users who use the virt board | ||
19 | with 'virtualization=on' to enable EL2 emulation and are booting an | ||
20 | EDK2 guest BIOS, if that EDK2 has assertions enabled. The effect is | ||
21 | that EDK2 will assert on bootup: | ||
22 | |||
23 | ASSERT [ArmTimerDxe] /home/kraxel/projects/qemu/roms/edk2/ArmVirtPkg/Library/ArmVirtTimerFdtClientLib/ArmVirtTimerFdtClientLib.c(72): PropSize == 36 || PropSize == 48 | ||
24 | |||
25 | If you see that assertion you should do one of: | ||
26 | * update your EDK2 binaries to edk2-stable202311 or newer | ||
27 | * use the 'virt-8.2' versioned machine type | ||
28 | * not use 'virtualization=on' | ||
29 | |||
30 | (The versions shipped with QEMU itself have the fix.) | ||
31 | |||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 32 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
33 | Reviewed-by: Ard Biesheuvel <ardb@kernel.org> | ||
34 | Message-id: 20240122143537.233498-3-peter.maydell@linaro.org | ||
11 | --- | 35 | --- |
12 | hw/arm/virt-acpi-build.c | 7 +++++++ | 36 | include/hw/arm/virt.h | 2 ++ |
13 | hw/arm/Kconfig | 1 + | 37 | hw/arm/virt-acpi-build.c | 20 ++++++++++---- |
14 | 2 files changed, 8 insertions(+) | 38 | hw/arm/virt.c | 60 ++++++++++++++++++++++++++++++++++------ |
15 | 39 | 3 files changed, 67 insertions(+), 15 deletions(-) | |
40 | |||
41 | diff --git a/include/hw/arm/virt.h b/include/hw/arm/virt.h | ||
42 | index XXXXXXX..XXXXXXX 100644 | ||
43 | --- a/include/hw/arm/virt.h | ||
44 | +++ b/include/hw/arm/virt.h | ||
45 | @@ -XXX,XX +XXX,XX @@ struct VirtMachineClass { | ||
46 | /* Machines < 6.2 have no support for describing cpu topology to guest */ | ||
47 | bool no_cpu_topology; | ||
48 | bool no_tcg_lpa2; | ||
49 | + bool no_ns_el2_virt_timer_irq; | ||
50 | }; | ||
51 | |||
52 | struct VirtMachineState { | ||
53 | @@ -XXX,XX +XXX,XX @@ struct VirtMachineState { | ||
54 | PCIBus *bus; | ||
55 | char *oem_id; | ||
56 | char *oem_table_id; | ||
57 | + bool ns_el2_virt_timer_irq; | ||
58 | }; | ||
59 | |||
60 | #define VIRT_ECAM_ID(high) (high ? VIRT_HIGH_PCIE_ECAM : VIRT_PCIE_ECAM) | ||
16 | diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c | 61 | diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c |
17 | index XXXXXXX..XXXXXXX 100644 | 62 | index XXXXXXX..XXXXXXX 100644 |
18 | --- a/hw/arm/virt-acpi-build.c | 63 | --- a/hw/arm/virt-acpi-build.c |
19 | +++ b/hw/arm/virt-acpi-build.c | 64 | +++ b/hw/arm/virt-acpi-build.c |
20 | @@ -XXX,XX +XXX,XX @@ | 65 | @@ -XXX,XX +XXX,XX @@ build_srat(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms) |
21 | #include "kvm_arm.h" | 66 | } |
22 | #include "migration/vmstate.h" | 67 | |
23 | #include "hw/acpi/ghes.h" | 68 | /* |
24 | +#include "hw/acpi/viot.h" | 69 | - * ACPI spec, Revision 5.1 |
25 | 70 | - * 5.2.24 Generic Timer Description Table (GTDT) | |
26 | #define ARM_SPI_BASE 32 | 71 | + * ACPI spec, Revision 6.5 |
27 | 72 | + * 5.2.25 Generic Timer Description Table (GTDT) | |
28 | @@ -XXX,XX +XXX,XX @@ void virt_acpi_build(VirtMachineState *vms, AcpiBuildTables *tables) | 73 | */ |
74 | static void | ||
75 | build_gtdt(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms) | ||
76 | @@ -XXX,XX +XXX,XX @@ build_gtdt(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms) | ||
77 | uint32_t irqflags = vmc->claim_edge_triggered_timers ? | ||
78 | 1 : /* Interrupt is Edge triggered */ | ||
79 | 0; /* Interrupt is Level triggered */ | ||
80 | - AcpiTable table = { .sig = "GTDT", .rev = 2, .oem_id = vms->oem_id, | ||
81 | + AcpiTable table = { .sig = "GTDT", .rev = 3, .oem_id = vms->oem_id, | ||
82 | .oem_table_id = vms->oem_table_id }; | ||
83 | |||
84 | acpi_table_begin(&table, table_data); | ||
85 | @@ -XXX,XX +XXX,XX @@ build_gtdt(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms) | ||
86 | build_append_int_noprefix(table_data, 0, 4); | ||
87 | /* Platform Timer Offset */ | ||
88 | build_append_int_noprefix(table_data, 0, 4); | ||
89 | - | ||
90 | + if (vms->ns_el2_virt_timer_irq) { | ||
91 | + /* Virtual EL2 Timer GSIV */ | ||
92 | + build_append_int_noprefix(table_data, ARCH_TIMER_NS_EL2_VIRT_IRQ, 4); | ||
93 | + /* Virtual EL2 Timer Flags */ | ||
94 | + build_append_int_noprefix(table_data, irqflags, 4); | ||
95 | + } else { | ||
96 | + build_append_int_noprefix(table_data, 0, 4); | ||
97 | + build_append_int_noprefix(table_data, 0, 4); | ||
98 | + } | ||
99 | acpi_table_end(linker, &table); | ||
100 | } | ||
101 | |||
102 | @@ -XXX,XX +XXX,XX @@ build_madt(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms) | ||
103 | static void build_fadt_rev6(GArray *table_data, BIOSLinker *linker, | ||
104 | VirtMachineState *vms, unsigned dsdt_tbl_offset) | ||
105 | { | ||
106 | - /* ACPI v6.0 */ | ||
107 | + /* ACPI v6.3 */ | ||
108 | AcpiFadtData fadt = { | ||
109 | .rev = 6, | ||
110 | - .minor_ver = 0, | ||
111 | + .minor_ver = 3, | ||
112 | .flags = 1 << ACPI_FADT_F_HW_REDUCED_ACPI, | ||
113 | .xdsdt_tbl_offset = &dsdt_tbl_offset, | ||
114 | }; | ||
115 | diff --git a/hw/arm/virt.c b/hw/arm/virt.c | ||
116 | index XXXXXXX..XXXXXXX 100644 | ||
117 | --- a/hw/arm/virt.c | ||
118 | +++ b/hw/arm/virt.c | ||
119 | @@ -XXX,XX +XXX,XX @@ static void create_randomness(MachineState *ms, const char *node) | ||
120 | qemu_fdt_setprop(ms->fdt, node, "rng-seed", seed.rng, sizeof(seed.rng)); | ||
121 | } | ||
122 | |||
123 | +/* | ||
124 | + * The CPU object always exposes the NS EL2 virt timer IRQ line, | ||
125 | + * but we don't want to advertise it to the guest in the dtb or ACPI | ||
126 | + * table unless it's really going to do something. | ||
127 | + */ | ||
128 | +static bool ns_el2_virt_timer_present(void) | ||
129 | +{ | ||
130 | + ARMCPU *cpu = ARM_CPU(qemu_get_cpu(0)); | ||
131 | + CPUARMState *env = &cpu->env; | ||
132 | + | ||
133 | + return arm_feature(env, ARM_FEATURE_AARCH64) && | ||
134 | + arm_feature(env, ARM_FEATURE_EL2) && cpu_isar_feature(aa64_vh, cpu); | ||
135 | +} | ||
136 | + | ||
137 | static void create_fdt(VirtMachineState *vms) | ||
138 | { | ||
139 | MachineState *ms = MACHINE(vms); | ||
140 | @@ -XXX,XX +XXX,XX @@ static void fdt_add_timer_nodes(const VirtMachineState *vms) | ||
141 | "arm,armv7-timer"); | ||
29 | } | 142 | } |
30 | #endif | 143 | qemu_fdt_setprop(ms->fdt, "/timer", "always-on", NULL, 0); |
31 | 144 | - qemu_fdt_setprop_cells(ms->fdt, "/timer", "interrupts", | |
32 | + if (vms->iommu == VIRT_IOMMU_VIRTIO) { | 145 | - GIC_FDT_IRQ_TYPE_PPI, |
33 | + acpi_add_table(table_offsets, tables_blob); | 146 | - INTID_TO_PPI(ARCH_TIMER_S_EL1_IRQ), irqflags, |
34 | + build_viot(ms, tables_blob, tables->linker, vms->virtio_iommu_bdf, | 147 | - GIC_FDT_IRQ_TYPE_PPI, |
35 | + vms->oem_id, vms->oem_table_id); | 148 | - INTID_TO_PPI(ARCH_TIMER_NS_EL1_IRQ), irqflags, |
149 | - GIC_FDT_IRQ_TYPE_PPI, | ||
150 | - INTID_TO_PPI(ARCH_TIMER_VIRT_IRQ), irqflags, | ||
151 | - GIC_FDT_IRQ_TYPE_PPI, | ||
152 | - INTID_TO_PPI(ARCH_TIMER_NS_EL2_IRQ), irqflags); | ||
153 | + if (vms->ns_el2_virt_timer_irq) { | ||
154 | + qemu_fdt_setprop_cells(ms->fdt, "/timer", "interrupts", | ||
155 | + GIC_FDT_IRQ_TYPE_PPI, | ||
156 | + INTID_TO_PPI(ARCH_TIMER_S_EL1_IRQ), irqflags, | ||
157 | + GIC_FDT_IRQ_TYPE_PPI, | ||
158 | + INTID_TO_PPI(ARCH_TIMER_NS_EL1_IRQ), irqflags, | ||
159 | + GIC_FDT_IRQ_TYPE_PPI, | ||
160 | + INTID_TO_PPI(ARCH_TIMER_VIRT_IRQ), irqflags, | ||
161 | + GIC_FDT_IRQ_TYPE_PPI, | ||
162 | + INTID_TO_PPI(ARCH_TIMER_NS_EL2_IRQ), irqflags, | ||
163 | + GIC_FDT_IRQ_TYPE_PPI, | ||
164 | + INTID_TO_PPI(ARCH_TIMER_NS_EL2_VIRT_IRQ), irqflags); | ||
165 | + } else { | ||
166 | + qemu_fdt_setprop_cells(ms->fdt, "/timer", "interrupts", | ||
167 | + GIC_FDT_IRQ_TYPE_PPI, | ||
168 | + INTID_TO_PPI(ARCH_TIMER_S_EL1_IRQ), irqflags, | ||
169 | + GIC_FDT_IRQ_TYPE_PPI, | ||
170 | + INTID_TO_PPI(ARCH_TIMER_NS_EL1_IRQ), irqflags, | ||
171 | + GIC_FDT_IRQ_TYPE_PPI, | ||
172 | + INTID_TO_PPI(ARCH_TIMER_VIRT_IRQ), irqflags, | ||
173 | + GIC_FDT_IRQ_TYPE_PPI, | ||
174 | + INTID_TO_PPI(ARCH_TIMER_NS_EL2_IRQ), irqflags); | ||
36 | + } | 175 | + } |
37 | + | 176 | } |
38 | /* XSDT is pointed to by RSDP */ | 177 | |
39 | xsdt = tables_blob->len; | 178 | static void fdt_add_cpu_nodes(const VirtMachineState *vms) |
40 | build_xsdt(tables_blob, tables->linker, table_offsets, vms->oem_id, | 179 | @@ -XXX,XX +XXX,XX @@ static void create_gic(VirtMachineState *vms, MemoryRegion *mem) |
41 | diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig | 180 | [GTIMER_VIRT] = ARCH_TIMER_VIRT_IRQ, |
42 | index XXXXXXX..XXXXXXX 100644 | 181 | [GTIMER_HYP] = ARCH_TIMER_NS_EL2_IRQ, |
43 | --- a/hw/arm/Kconfig | 182 | [GTIMER_SEC] = ARCH_TIMER_S_EL1_IRQ, |
44 | +++ b/hw/arm/Kconfig | 183 | + [GTIMER_HYPVIRT] = ARCH_TIMER_NS_EL2_VIRT_IRQ, |
45 | @@ -XXX,XX +XXX,XX @@ config ARM_VIRT | 184 | }; |
46 | select DIMM | 185 | |
47 | select ACPI_HW_REDUCED | 186 | for (unsigned irq = 0; irq < ARRAY_SIZE(timer_irq); irq++) { |
48 | select ACPI_APEI | 187 | @@ -XXX,XX +XXX,XX @@ static void machvirt_init(MachineState *machine) |
49 | + select ACPI_VIOT | 188 | qdev_realize(DEVICE(cpuobj), NULL, &error_fatal); |
50 | 189 | object_unref(cpuobj); | |
51 | config CHEETAH | 190 | } |
52 | bool | 191 | + |
192 | + /* Now we've created the CPUs we can see if they have the hypvirt timer */ | ||
193 | + vms->ns_el2_virt_timer_irq = ns_el2_virt_timer_present() && | ||
194 | + !vmc->no_ns_el2_virt_timer_irq; | ||
195 | + | ||
196 | fdt_add_timer_nodes(vms); | ||
197 | fdt_add_cpu_nodes(vms); | ||
198 | |||
199 | @@ -XXX,XX +XXX,XX @@ DEFINE_VIRT_MACHINE_AS_LATEST(9, 0) | ||
200 | |||
201 | static void virt_machine_8_2_options(MachineClass *mc) | ||
202 | { | ||
203 | + VirtMachineClass *vmc = VIRT_MACHINE_CLASS(OBJECT_CLASS(mc)); | ||
204 | + | ||
205 | virt_machine_9_0_options(mc); | ||
206 | compat_props_add(mc->compat_props, hw_compat_8_2, hw_compat_8_2_len); | ||
207 | + /* | ||
208 | + * Don't expose NS_EL2_VIRT timer IRQ in DTB on ACPI on 8.2 and | ||
209 | + * earlier machines. (Exposing it tickles a bug in older EDK2 | ||
210 | + * guest BIOS binaries.) | ||
211 | + */ | ||
212 | + vmc->no_ns_el2_virt_timer_irq = true; | ||
213 | } | ||
214 | DEFINE_VIRT_MACHINE(8, 2) | ||
215 | |||
53 | -- | 216 | -- |
54 | 2.25.1 | 217 | 2.34.1 |
55 | |||
56 | diff view generated by jsdifflib |
1 | From: Jean-Philippe Brucker <jean-philippe@linaro.org> | 1 | Update the virt golden reference files to say that the FACP is ACPI |
---|---|---|---|
2 | 2 | v6.3, and the GTDT table is a revision 3 table with space for the | |
3 | Add expected blobs of the VIOT and DSDT table for the VIOT test on the | 3 | virtual EL2 timer. |
4 | q35 machine. | 4 | |
5 | 5 | Diffs from iasl: | |
6 | Since the test instantiates a virtio device and two PCIe expander | 6 | |
7 | bridges, DSDT.viot has more blocks than the base DSDT. | 7 | @@ -XXX,XX +XXX,XX @@ |
8 | 8 | /* | |
9 | The VIOT table generated for the q35 test is: | 9 | * Intel ACPI Component Architecture |
10 | 10 | * AML/ASL+ Disassembler version 20200925 (64-bit version) | |
11 | [000h 0000 4] Signature : "VIOT" [Virtual I/O Translation Table] | 11 | * Copyright (c) 2000 - 2020 Intel Corporation |
12 | [004h 0004 4] Table Length : 00000070 | 12 | * |
13 | [008h 0008 1] Revision : 00 | 13 | - * Disassembly of tests/data/acpi/virt/FACP, Mon Jan 22 13:48:40 2024 |
14 | [009h 0009 1] Checksum : 3D | 14 | + * Disassembly of /tmp/aml-W8RZH2, Mon Jan 22 13:48:40 2024 |
15 | [00Ah 0010 6] Oem ID : "BOCHS " | 15 | * |
16 | [010h 0016 8] Oem Table ID : "BXPC " | 16 | * ACPI Data Table [FACP] |
17 | [018h 0024 4] Oem Revision : 00000001 | 17 | * |
18 | [01Ch 0028 4] Asl Compiler ID : "BXPC" | 18 | * Format: [HexOffset DecimalOffset ByteLength] FieldName : FieldValue |
19 | [020h 0032 4] Asl Compiler Revision : 00000001 | 19 | */ |
20 | 20 | ||
21 | [024h 0036 2] Node count : 0003 | 21 | [000h 0000 4] Signature : "FACP" [Fixed ACPI Description Table (FADT)] |
22 | [026h 0038 2] Node offset : 0030 | 22 | [004h 0004 4] Table Length : 00000114 |
23 | [028h 0040 8] Reserved : 0000000000000000 | 23 | [008h 0008 1] Revision : 06 |
24 | 24 | -[009h 0009 1] Checksum : 15 | |
25 | [030h 0048 1] Type : 03 [VirtIO-PCI IOMMU] | 25 | +[009h 0009 1] Checksum : 12 |
26 | [031h 0049 1] Reserved : 00 | 26 | [00Ah 0010 6] Oem ID : "BOCHS " |
27 | [032h 0050 2] Length : 0010 | 27 | [010h 0016 8] Oem Table ID : "BXPC " |
28 | 28 | [018h 0024 4] Oem Revision : 00000001 | |
29 | [034h 0052 2] PCI Segment : 0000 | 29 | [01Ch 0028 4] Asl Compiler ID : "BXPC" |
30 | [036h 0054 2] PCI BDF number : 0010 | 30 | [020h 0032 4] Asl Compiler Revision : 00000001 |
31 | [038h 0056 8] Reserved : 0000000000000000 | 31 | |
32 | 32 | [024h 0036 4] FACS Address : 00000000 | |
33 | [040h 0064 1] Type : 01 [PCI Range] | 33 | [028h 0040 4] DSDT Address : 00000000 |
34 | [041h 0065 1] Reserved : 00 | 34 | [02Ch 0044 1] Model : 00 |
35 | [042h 0066 2] Length : 0018 | 35 | [02Dh 0045 1] PM Profile : 00 [Unspecified] |
36 | 36 | [02Eh 0046 2] SCI Interrupt : 0000 | |
37 | [044h 0068 4] Endpoint start : 00003000 | 37 | [030h 0048 4] SMI Command Port : 00000000 |
38 | [048h 0072 2] PCI Segment start : 0000 | 38 | [034h 0052 1] ACPI Enable Value : 00 |
39 | [04Ah 0074 2] PCI Segment end : 0000 | 39 | [035h 0053 1] ACPI Disable Value : 00 |
40 | [04Ch 0076 2] PCI BDF start : 3000 | 40 | [036h 0054 1] S4BIOS Command : 00 |
41 | [04Eh 0078 2] PCI BDF end : 30FF | 41 | [037h 0055 1] P-State Control : 00 |
42 | [050h 0080 2] Output node : 0030 | 42 | @@ -XXX,XX +XXX,XX @@ |
43 | [052h 0082 6] Reserved : 000000000000 | 43 | Use APIC Physical Destination Mode (V4) : 0 |
44 | 44 | Hardware Reduced (V5) : 1 | |
45 | [058h 0088 1] Type : 01 [PCI Range] | 45 | Low Power S0 Idle (V5) : 0 |
46 | [059h 0089 1] Reserved : 00 | 46 | |
47 | [05Ah 0090 2] Length : 0018 | 47 | [074h 0116 12] Reset Register : [Generic Address Structure] |
48 | 48 | [074h 0116 1] Space ID : 00 [SystemMemory] | |
49 | [05Ch 0092 4] Endpoint start : 00001000 | 49 | [075h 0117 1] Bit Width : 00 |
50 | [060h 0096 2] PCI Segment start : 0000 | 50 | [076h 0118 1] Bit Offset : 00 |
51 | [062h 0098 2] PCI Segment end : 0000 | 51 | [077h 0119 1] Encoded Access Width : 00 [Undefined/Legacy] |
52 | [064h 0100 2] PCI BDF start : 1000 | 52 | [078h 0120 8] Address : 0000000000000000 |
53 | [066h 0102 2] PCI BDF end : 10FF | 53 | |
54 | [068h 0104 2] Output node : 0030 | 54 | [080h 0128 1] Value to cause reset : 00 |
55 | [06Ah 0106 6] Reserved : 000000000000 | 55 | [081h 0129 2] ARM Flags (decoded below) : 0003 |
56 | 56 | PSCI Compliant : 1 | |
57 | And the DSDT diff is: | 57 | Must use HVC for PSCI : 1 |
58 | 58 | ||
59 | @@ -XXX,XX +XXX,XX @@ | 59 | -[083h 0131 1] FADT Minor Revision : 00 |
60 | * | 60 | +[083h 0131 1] FADT Minor Revision : 03 |
61 | * Disassembling to symbolic ASL+ operators | 61 | [084h 0132 8] FACS Address : 0000000000000000 |
62 | * | 62 | [08Ch 0140 8] DSDT Address : 0000000000000000 |
63 | - * Disassembly of tests/data/acpi/q35/DSDT, Fri Dec 10 15:03:08 2021 | 63 | [094h 0148 12] PM1A Event Block : [Generic Address Structure] |
64 | + * Disassembly of /tmp/aml-H9Y5D1, Fri Dec 10 15:02:27 2021 | 64 | [094h 0148 1] Space ID : 00 [SystemMemory] |
65 | * | 65 | [095h 0149 1] Bit Width : 00 |
66 | * Original Table Header: | 66 | [096h 0150 1] Bit Offset : 00 |
67 | * Signature "DSDT" | 67 | [097h 0151 1] Encoded Access Width : 00 [Undefined/Legacy] |
68 | - * Length 0x00002061 (8289) | 68 | [098h 0152 8] Address : 0000000000000000 |
69 | + * Length 0x000024B6 (9398) | 69 | |
70 | * Revision 0x01 **** 32-bit table (V1), no 64-bit math support | 70 | [0A0h 0160 12] PM1B Event Block : [Generic Address Structure] |
71 | - * Checksum 0xFA | 71 | [0A0h 0160 1] Space ID : 00 [SystemMemory] |
72 | + * Checksum 0xA7 | 72 | [0A1h 0161 1] Bit Width : 00 |
73 | * OEM ID "BOCHS " | 73 | [0A2h 0162 1] Bit Offset : 00 |
74 | * OEM Table ID "BXPC " | 74 | [0A3h 0163 1] Encoded Access Width : 00 [Undefined/Legacy] |
75 | * OEM Revision 0x00000001 (1) | 75 | [0A4h 0164 8] Address : 0000000000000000 |
76 | @@ -XXX,XX +XXX,XX @@ | 76 | |
77 | } | 77 | @@ -XXX,XX +XXX,XX @@ |
78 | } | 78 | [0F5h 0245 1] Bit Width : 00 |
79 | 79 | [0F6h 0246 1] Bit Offset : 00 | |
80 | + Scope (\_SB) | 80 | [0F7h 0247 1] Encoded Access Width : 00 [Undefined/Legacy] |
81 | + { | 81 | [0F8h 0248 8] Address : 0000000000000000 |
82 | + Device (PC30) | 82 | |
83 | + { | 83 | [100h 0256 12] Sleep Status Register : [Generic Address Structure] |
84 | + Name (_UID, 0x30) // _UID: Unique ID | 84 | [100h 0256 1] Space ID : 00 [SystemMemory] |
85 | + Name (_BBN, 0x30) // _BBN: BIOS Bus Number | 85 | [101h 0257 1] Bit Width : 00 |
86 | + Name (_HID, EisaId ("PNP0A08") /* PCI Express Bus */) // _HID: Hardware ID | 86 | [102h 0258 1] Bit Offset : 00 |
87 | + Name (_CID, EisaId ("PNP0A03") /* PCI Bus */) // _CID: Compatible ID | 87 | [103h 0259 1] Encoded Access Width : 00 [Undefined/Legacy] |
88 | + Method (_OSC, 4, NotSerialized) // _OSC: Operating System Capabilities | 88 | [104h 0260 8] Address : 0000000000000000 |
89 | + { | 89 | |
90 | + CreateDWordField (Arg3, Zero, CDW1) | 90 | [10Ch 0268 8] Hypervisor ID : 00000000554D4551 |
91 | + If ((Arg0 == ToUUID ("33db4d5b-1ff7-401c-9657-7441c03dd766") /* PCI Host Bridge Device */)) | 91 | |
92 | + { | 92 | Raw Table Data: Length 276 (0x114) |
93 | + CreateDWordField (Arg3, 0x04, CDW2) | 93 | |
94 | + CreateDWordField (Arg3, 0x08, CDW3) | 94 | - 0000: 46 41 43 50 14 01 00 00 06 15 42 4F 43 48 53 20 // FACP......BOCHS |
95 | + Local0 = CDW3 /* \_SB_.PC30._OSC.CDW3 */ | 95 | + 0000: 46 41 43 50 14 01 00 00 06 12 42 4F 43 48 53 20 // FACP......BOCHS |
96 | + Local0 &= 0x1F | 96 | 0010: 42 58 50 43 20 20 20 20 01 00 00 00 42 58 50 43 // BXPC ....BXPC |
97 | + If ((Arg1 != One)) | 97 | 0020: 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 // ................ |
98 | + { | 98 | 0030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 // ................ |
99 | + CDW1 |= 0x08 | 99 | 0040: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 // ................ |
100 | + } | 100 | 0050: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 // ................ |
101 | + | 101 | 0060: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 // ................ |
102 | + If ((CDW3 != Local0)) | 102 | 0070: 00 00 10 00 00 00 00 00 00 00 00 00 00 00 00 00 // ................ |
103 | + { | 103 | - 0080: 00 03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 // ................ |
104 | + CDW1 |= 0x10 | 104 | + 0080: 00 03 00 03 00 00 00 00 00 00 00 00 00 00 00 00 // ................ |
105 | + } | 105 | 0090: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 // ................ |
106 | + | 106 | 00A0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 // ................ |
107 | + CDW3 = Local0 | 107 | 00B0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 // ................ |
108 | + } | 108 | 00C0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 // ................ |
109 | + Else | 109 | 00D0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 // ................ |
110 | + { | 110 | 00E0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 // ................ |
111 | + CDW1 |= 0x04 | 111 | 00F0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 // ................ |
112 | + } | 112 | 0100: 00 00 00 00 00 00 00 00 00 00 00 00 51 45 4D 55 // ............QEMU |
113 | + | 113 | 0110: 00 00 00 00 // .... |
114 | + Return (Arg3) | 114 | |
115 | + } | 115 | @@ -XXX,XX +XXX,XX @@ |
116 | + | 116 | /* |
117 | + Method (_PRT, 0, NotSerialized) // _PRT: PCI Routing Table | 117 | * Intel ACPI Component Architecture |
118 | + { | 118 | * AML/ASL+ Disassembler version 20200925 (64-bit version) |
119 | + Local0 = Package (0x80){} | 119 | * Copyright (c) 2000 - 2020 Intel Corporation |
120 | + Local1 = Zero | 120 | * |
121 | + While ((Local1 < 0x80)) | 121 | - * Disassembly of tests/data/acpi/virt/GTDT, Mon Jan 22 13:48:40 2024 |
122 | + { | 122 | + * Disassembly of /tmp/aml-XDSZH2, Mon Jan 22 13:48:40 2024 |
123 | + Local2 = (Local1 >> 0x02) | 123 | * |
124 | + Local3 = ((Local1 + Local2) & 0x03) | 124 | * ACPI Data Table [GTDT] |
125 | + If ((Local3 == Zero)) | 125 | * |
126 | + { | 126 | * Format: [HexOffset DecimalOffset ByteLength] FieldName : FieldValue |
127 | + Local4 = Package (0x04) | 127 | */ |
128 | + { | 128 | |
129 | + Zero, | 129 | [000h 0000 4] Signature : "GTDT" [Generic Timer Description Table] |
130 | + Zero, | 130 | -[004h 0004 4] Table Length : 00000060 |
131 | + LNKD, | 131 | -[008h 0008 1] Revision : 02 |
132 | + Zero | 132 | -[009h 0009 1] Checksum : 9C |
133 | + } | 133 | +[004h 0004 4] Table Length : 00000068 |
134 | + } | 134 | +[008h 0008 1] Revision : 03 |
135 | + | 135 | +[009h 0009 1] Checksum : 93 |
136 | + If ((Local3 == One)) | 136 | [00Ah 0010 6] Oem ID : "BOCHS " |
137 | + { | 137 | [010h 0016 8] Oem Table ID : "BXPC " |
138 | + Local4 = Package (0x04) | 138 | [018h 0024 4] Oem Revision : 00000001 |
139 | + { | 139 | [01Ch 0028 4] Asl Compiler ID : "BXPC" |
140 | + Zero, | 140 | [020h 0032 4] Asl Compiler Revision : 00000001 |
141 | + Zero, | 141 | |
142 | + LNKA, | 142 | [024h 0036 8] Counter Block Address : FFFFFFFFFFFFFFFF |
143 | + Zero | 143 | [02Ch 0044 4] Reserved : 00000000 |
144 | + } | 144 | |
145 | + } | 145 | [030h 0048 4] Secure EL1 Interrupt : 0000001D |
146 | + | 146 | [034h 0052 4] EL1 Flags (decoded below) : 00000000 |
147 | + If ((Local3 == 0x02)) | 147 | Trigger Mode : 0 |
148 | + { | 148 | Polarity : 0 |
149 | + Local4 = Package (0x04) | 149 | Always On : 0 |
150 | + { | 150 | |
151 | + Zero, | 151 | [038h 0056 4] Non-Secure EL1 Interrupt : 0000001E |
152 | + Zero, | 152 | @@ -XXX,XX +XXX,XX @@ |
153 | + LNKB, | 153 | |
154 | + Zero | 154 | [040h 0064 4] Virtual Timer Interrupt : 0000001B |
155 | + } | 155 | [044h 0068 4] VT Flags (decoded below) : 00000000 |
156 | + } | 156 | Trigger Mode : 0 |
157 | + | 157 | Polarity : 0 |
158 | + If ((Local3 == 0x03)) | 158 | Always On : 0 |
159 | + { | 159 | |
160 | + Local4 = Package (0x04) | 160 | [048h 0072 4] Non-Secure EL2 Interrupt : 0000001A |
161 | + { | 161 | [04Ch 0076 4] NEL2 Flags (decoded below) : 00000000 |
162 | + Zero, | 162 | Trigger Mode : 0 |
163 | + Zero, | 163 | Polarity : 0 |
164 | + LNKC, | 164 | Always On : 0 |
165 | + Zero | 165 | [050h 0080 8] Counter Read Block Address : FFFFFFFFFFFFFFFF |
166 | + } | 166 | |
167 | + } | 167 | [058h 0088 4] Platform Timer Count : 00000000 |
168 | + | 168 | [05Ch 0092 4] Platform Timer Offset : 00000000 |
169 | + Local4 [Zero] = ((Local2 << 0x10) | 0xFFFF) | 169 | +[060h 0096 4] Virtual EL2 Timer GSIV : 00000000 |
170 | + Local4 [One] = (Local1 & 0x03) | 170 | +[064h 0100 4] Virtual EL2 Timer Flags : 00000000 |
171 | + Local0 [Local1] = Local4 | 171 | |
172 | + Local1++ | 172 | -Raw Table Data: Length 96 (0x60) |
173 | + } | 173 | +Raw Table Data: Length 104 (0x68) |
174 | + | 174 | |
175 | + Return (Local0) | 175 | - 0000: 47 54 44 54 60 00 00 00 02 9C 42 4F 43 48 53 20 // GTDT`.....BOCHS |
176 | + } | 176 | + 0000: 47 54 44 54 68 00 00 00 03 93 42 4F 43 48 53 20 // GTDTh.....BOCHS |
177 | + | 177 | 0010: 42 58 50 43 20 20 20 20 01 00 00 00 42 58 50 43 // BXPC ....BXPC |
178 | + Name (_CRS, ResourceTemplate () // _CRS: Current Resource Settings | 178 | 0020: 01 00 00 00 FF FF FF FF FF FF FF FF 00 00 00 00 // ................ |
179 | + { | 179 | 0030: 1D 00 00 00 00 00 00 00 1E 00 00 00 04 00 00 00 // ................ |
180 | + WordBusNumber (ResourceProducer, MinFixed, MaxFixed, PosDecode, | 180 | 0040: 1B 00 00 00 00 00 00 00 1A 00 00 00 00 00 00 00 // ................ |
181 | + 0x0000, // Granularity | 181 | 0050: FF FF FF FF FF FF FF FF 00 00 00 00 00 00 00 00 // ................ |
182 | + 0x0030, // Range Minimum | 182 | + 0060: 00 00 00 00 00 00 00 00 // ........ |
183 | + 0x0030, // Range Maximum | 183 | |
184 | + 0x0000, // Translation Offset | ||
185 | + 0x0001, // Length | ||
186 | + ,, ) | ||
187 | + }) | ||
188 | + } | ||
189 | + } | ||
190 | + | ||
191 | + Scope (\_SB) | ||
192 | + { | ||
193 | + Device (PC20) | ||
194 | + { | ||
195 | + Name (_UID, 0x20) // _UID: Unique ID | ||
196 | + Name (_BBN, 0x20) // _BBN: BIOS Bus Number | ||
197 | + Name (_HID, EisaId ("PNP0A08") /* PCI Express Bus */) // _HID: Hardware ID | ||
198 | + Name (_CID, EisaId ("PNP0A03") /* PCI Bus */) // _CID: Compatible ID | ||
199 | + Method (_OSC, 4, NotSerialized) // _OSC: Operating System Capabilities | ||
200 | + { | ||
201 | + CreateDWordField (Arg3, Zero, CDW1) | ||
202 | + If ((Arg0 == ToUUID ("33db4d5b-1ff7-401c-9657-7441c03dd766") /* PCI Host Bridge Device */)) | ||
203 | + { | ||
204 | + CreateDWordField (Arg3, 0x04, CDW2) | ||
205 | + CreateDWordField (Arg3, 0x08, CDW3) | ||
206 | + Local0 = CDW3 /* \_SB_.PC20._OSC.CDW3 */ | ||
207 | + Local0 &= 0x1F | ||
208 | + If ((Arg1 != One)) | ||
209 | + { | ||
210 | + CDW1 |= 0x08 | ||
211 | + } | ||
212 | + | ||
213 | + If ((CDW3 != Local0)) | ||
214 | + { | ||
215 | + CDW1 |= 0x10 | ||
216 | + } | ||
217 | + | ||
218 | + CDW3 = Local0 | ||
219 | + } | ||
220 | + Else | ||
221 | + { | ||
222 | + CDW1 |= 0x04 | ||
223 | + } | ||
224 | + | ||
225 | + Return (Arg3) | ||
226 | + } | ||
227 | + | ||
228 | + Method (_PRT, 0, NotSerialized) // _PRT: PCI Routing Table | ||
229 | + { | ||
230 | + Local0 = Package (0x80){} | ||
231 | + Local1 = Zero | ||
232 | + While ((Local1 < 0x80)) | ||
233 | + { | ||
234 | + Local2 = (Local1 >> 0x02) | ||
235 | + Local3 = ((Local1 + Local2) & 0x03) | ||
236 | + If ((Local3 == Zero)) | ||
237 | + { | ||
238 | + Local4 = Package (0x04) | ||
239 | + { | ||
240 | + Zero, | ||
241 | + Zero, | ||
242 | + LNKD, | ||
243 | + Zero | ||
244 | + } | ||
245 | + } | ||
246 | + | ||
247 | + If ((Local3 == One)) | ||
248 | + { | ||
249 | + Local4 = Package (0x04) | ||
250 | + { | ||
251 | + Zero, | ||
252 | + Zero, | ||
253 | + LNKA, | ||
254 | + Zero | ||
255 | + } | ||
256 | + } | ||
257 | + | ||
258 | + If ((Local3 == 0x02)) | ||
259 | + { | ||
260 | + Local4 = Package (0x04) | ||
261 | + { | ||
262 | + Zero, | ||
263 | + Zero, | ||
264 | + LNKB, | ||
265 | + Zero | ||
266 | + } | ||
267 | + } | ||
268 | + | ||
269 | + If ((Local3 == 0x03)) | ||
270 | + { | ||
271 | + Local4 = Package (0x04) | ||
272 | + { | ||
273 | + Zero, | ||
274 | + Zero, | ||
275 | + LNKC, | ||
276 | + Zero | ||
277 | + } | ||
278 | + } | ||
279 | + | ||
280 | + Local4 [Zero] = ((Local2 << 0x10) | 0xFFFF) | ||
281 | + Local4 [One] = (Local1 & 0x03) | ||
282 | + Local0 [Local1] = Local4 | ||
283 | + Local1++ | ||
284 | + } | ||
285 | + | ||
286 | + Return (Local0) | ||
287 | + } | ||
288 | + | ||
289 | + Name (_CRS, ResourceTemplate () // _CRS: Current Resource Settings | ||
290 | + { | ||
291 | + WordBusNumber (ResourceProducer, MinFixed, MaxFixed, PosDecode, | ||
292 | + 0x0000, // Granularity | ||
293 | + 0x0020, // Range Minimum | ||
294 | + 0x0020, // Range Maximum | ||
295 | + 0x0000, // Translation Offset | ||
296 | + 0x0001, // Length | ||
297 | + ,, ) | ||
298 | + }) | ||
299 | + } | ||
300 | + } | ||
301 | + | ||
302 | + Scope (\_SB) | ||
303 | + { | ||
304 | + Device (PC10) | ||
305 | + { | ||
306 | + Name (_UID, 0x10) // _UID: Unique ID | ||
307 | + Name (_BBN, 0x10) // _BBN: BIOS Bus Number | ||
308 | + Name (_HID, EisaId ("PNP0A08") /* PCI Express Bus */) // _HID: Hardware ID | ||
309 | + Name (_CID, EisaId ("PNP0A03") /* PCI Bus */) // _CID: Compatible ID | ||
310 | + Method (_OSC, 4, NotSerialized) // _OSC: Operating System Capabilities | ||
311 | + { | ||
312 | + CreateDWordField (Arg3, Zero, CDW1) | ||
313 | + If ((Arg0 == ToUUID ("33db4d5b-1ff7-401c-9657-7441c03dd766") /* PCI Host Bridge Device */)) | ||
314 | + { | ||
315 | + CreateDWordField (Arg3, 0x04, CDW2) | ||
316 | + CreateDWordField (Arg3, 0x08, CDW3) | ||
317 | + Local0 = CDW3 /* \_SB_.PC10._OSC.CDW3 */ | ||
318 | + Local0 &= 0x1F | ||
319 | + If ((Arg1 != One)) | ||
320 | + { | ||
321 | + CDW1 |= 0x08 | ||
322 | + } | ||
323 | + | ||
324 | + If ((CDW3 != Local0)) | ||
325 | + { | ||
326 | + CDW1 |= 0x10 | ||
327 | + } | ||
328 | + | ||
329 | + CDW3 = Local0 | ||
330 | + } | ||
331 | + Else | ||
332 | + { | ||
333 | + CDW1 |= 0x04 | ||
334 | + } | ||
335 | + | ||
336 | + Return (Arg3) | ||
337 | + } | ||
338 | + | ||
339 | + Method (_PRT, 0, NotSerialized) // _PRT: PCI Routing Table | ||
340 | + { | ||
341 | + Local0 = Package (0x80){} | ||
342 | + Local1 = Zero | ||
343 | + While ((Local1 < 0x80)) | ||
344 | + { | ||
345 | + Local2 = (Local1 >> 0x02) | ||
346 | + Local3 = ((Local1 + Local2) & 0x03) | ||
347 | + If ((Local3 == Zero)) | ||
348 | + { | ||
349 | + Local4 = Package (0x04) | ||
350 | + { | ||
351 | + Zero, | ||
352 | + Zero, | ||
353 | + LNKD, | ||
354 | + Zero | ||
355 | + } | ||
356 | + } | ||
357 | + | ||
358 | + If ((Local3 == One)) | ||
359 | + { | ||
360 | + Local4 = Package (0x04) | ||
361 | + { | ||
362 | + Zero, | ||
363 | + Zero, | ||
364 | + LNKA, | ||
365 | + Zero | ||
366 | + } | ||
367 | + } | ||
368 | + | ||
369 | + If ((Local3 == 0x02)) | ||
370 | + { | ||
371 | + Local4 = Package (0x04) | ||
372 | + { | ||
373 | + Zero, | ||
374 | + Zero, | ||
375 | + LNKB, | ||
376 | + Zero | ||
377 | + } | ||
378 | + } | ||
379 | + | ||
380 | + If ((Local3 == 0x03)) | ||
381 | + { | ||
382 | + Local4 = Package (0x04) | ||
383 | + { | ||
384 | + Zero, | ||
385 | + Zero, | ||
386 | + LNKC, | ||
387 | + Zero | ||
388 | + } | ||
389 | + } | ||
390 | + | ||
391 | + Local4 [Zero] = ((Local2 << 0x10) | 0xFFFF) | ||
392 | + Local4 [One] = (Local1 & 0x03) | ||
393 | + Local0 [Local1] = Local4 | ||
394 | + Local1++ | ||
395 | + } | ||
396 | + | ||
397 | + Return (Local0) | ||
398 | + } | ||
399 | + | ||
400 | + Name (_CRS, ResourceTemplate () // _CRS: Current Resource Settings | ||
401 | + { | ||
402 | + WordBusNumber (ResourceProducer, MinFixed, MaxFixed, PosDecode, | ||
403 | + 0x0000, // Granularity | ||
404 | + 0x0010, // Range Minimum | ||
405 | + 0x0010, // Range Maximum | ||
406 | + 0x0000, // Translation Offset | ||
407 | + 0x0001, // Length | ||
408 | + ,, ) | ||
409 | + }) | ||
410 | + } | ||
411 | + } | ||
412 | + | ||
413 | Scope (\_SB.PCI0) | ||
414 | { | ||
415 | Name (_CRS, ResourceTemplate () // _CRS: Current Resource Settings | ||
416 | @@ -XXX,XX +XXX,XX @@ | ||
417 | WordBusNumber (ResourceProducer, MinFixed, MaxFixed, PosDecode, | ||
418 | 0x0000, // Granularity | ||
419 | 0x0000, // Range Minimum | ||
420 | - 0x00FF, // Range Maximum | ||
421 | + 0x000F, // Range Maximum | ||
422 | 0x0000, // Translation Offset | ||
423 | - 0x0100, // Length | ||
424 | + 0x0010, // Length | ||
425 | ,, ) | ||
426 | IO (Decode16, | ||
427 | 0x0CF8, // Range Minimum | ||
428 | @@ -XXX,XX +XXX,XX @@ | ||
429 | } | ||
430 | } | ||
431 | |||
432 | + Device (S10) | ||
433 | + { | ||
434 | + Name (_ADR, 0x00020000) // _ADR: Address | ||
435 | + } | ||
436 | + | ||
437 | + Device (S18) | ||
438 | + { | ||
439 | + Name (_ADR, 0x00030000) // _ADR: Address | ||
440 | + } | ||
441 | + | ||
442 | + Device (S20) | ||
443 | + { | ||
444 | + Name (_ADR, 0x00040000) // _ADR: Address | ||
445 | + } | ||
446 | + | ||
447 | + Device (S28) | ||
448 | + { | ||
449 | + Name (_ADR, 0x00050000) // _ADR: Address | ||
450 | + } | ||
451 | + | ||
452 | Method (PCNT, 0, NotSerialized) | ||
453 | { | ||
454 | } | ||
455 | |||
456 | Reviewed-by: Eric Auger <eric.auger@redhat.com> | ||
457 | Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org> | ||
458 | Message-id: 20211210170415.583179-8-jean-philippe@linaro.org | ||
459 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 184 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
185 | Reviewed-by: Ard Biesheuvel <ardb@kernel.org> | ||
186 | Message-id: 20240122143537.233498-4-peter.maydell@linaro.org | ||
460 | --- | 187 | --- |
461 | tests/qtest/bios-tables-test-allowed-diff.h | 2 -- | 188 | tests/qtest/bios-tables-test-allowed-diff.h | 2 -- |
462 | tests/data/acpi/q35/DSDT.viot | Bin 0 -> 9398 bytes | 189 | tests/data/acpi/virt/FACP | Bin 276 -> 276 bytes |
463 | tests/data/acpi/q35/VIOT.viot | Bin 0 -> 112 bytes | 190 | tests/data/acpi/virt/GTDT | Bin 96 -> 104 bytes |
464 | 3 files changed, 2 deletions(-) | 191 | 3 files changed, 2 deletions(-) |
465 | 192 | ||
466 | diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h | 193 | diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h |
467 | index XXXXXXX..XXXXXXX 100644 | 194 | index XXXXXXX..XXXXXXX 100644 |
468 | --- a/tests/qtest/bios-tables-test-allowed-diff.h | 195 | --- a/tests/qtest/bios-tables-test-allowed-diff.h |
469 | +++ b/tests/qtest/bios-tables-test-allowed-diff.h | 196 | +++ b/tests/qtest/bios-tables-test-allowed-diff.h |
470 | @@ -XXX,XX +XXX,XX @@ | 197 | @@ -1,3 +1 @@ |
471 | /* List of comma-separated changed AML files to ignore */ | 198 | /* List of comma-separated changed AML files to ignore */ |
472 | "tests/data/acpi/virt/VIOT", | 199 | -"tests/data/acpi/virt/FACP", |
473 | -"tests/data/acpi/q35/DSDT.viot", | 200 | -"tests/data/acpi/virt/GTDT", |
474 | -"tests/data/acpi/q35/VIOT.viot", | 201 | diff --git a/tests/data/acpi/virt/FACP b/tests/data/acpi/virt/FACP |
475 | diff --git a/tests/data/acpi/q35/DSDT.viot b/tests/data/acpi/q35/DSDT.viot | ||
476 | index XXXXXXX..XXXXXXX 100644 | 202 | index XXXXXXX..XXXXXXX 100644 |
477 | GIT binary patch | 203 | GIT binary patch |
478 | literal 9398 | 204 | delta 25 |
479 | zcmeHNO>7&-8J*>iv|O&FB}G~Oi$yp||57BBoWHhc5OS9yDTx$CQgH$r;8Idr*-4Q_ | 205 | gcmbQjG=+)F&CxkPgpq-PO=u!l<;2F$$vli407<0<)c^nh |
480 | z5(9Az1F`}niVsB-)<KW7p`g9Br(A2Gm-gmc1N78GFS!;)e2V(MnH_0{q<{#yMgn&C | 206 | |
481 | zn|*J-d9yqFhO_H6z19~`FlPL*u<DkZ*}|)JH;X@mF-FI<cPg<fti9tEN*yB^i5czN | 207 | delta 28 |
482 | zNq&q?!OZ;BE3B7{KWzJ-`Tn~f`9?Qj8~2^N8{Oc8J%57{==w%rS#;nOCp*nTr@iZ1 | 208 | kcmbQjG=+)F&CxkPgpq-PO>`nx<-|!<6Akz$^DuG%0AAS!ssI20 |
483 | zb+?i;JLQUJ=O0?8*>S~D)a>NF1~WVB6^~_B#yhJ`H+JU@=6aXs`?Yv)J2h=N?drcS | 209 | |
484 | zeLZ*n<<Bm^n}6`jfBx#u8&(W}1?)}iF9o#mZ~E2+zwdn7yK3AbIzKnxpZ>JRPm3~# | 210 | diff --git a/tests/data/acpi/virt/GTDT b/tests/data/acpi/virt/GTDT |
485 | z&ICS{+_OayRW-l=Mtk=~uaS3o8z<_udd|(wqg`&JnVPfCe>BUOO`Su3e>pff_^UW% | ||
486 | z&JE^NO`)=Amg~iqRB1pPscP?(>#ZuY8GHCmlEvD$9g3%4Db~Dfz2SATnddvrR-Oe^ | ||
487 | z;s;dJec!hnzi)ri^I6YN9vtkm{^TdUF8h7gX8-<Qe4p)GQ=)AtYx2VcwdLVAEXEjG | ||
488 | z^Mj|UHPqkj-LsWuzQem1>F3atdZn=zv3$#RmZzSHN+6-yyU#8cJb=YDilX&sl}vNm | ||
489 | znkgAR^O<3kj4if>{ly5fwRfMWuC5=lrlvKPX~i#654Cp}R_d*JS$9laZ$ra6)<ns8 | ||
490 | zFZy28G%xP(nit&F>LDi%G<tIc=TY=gl$jSD&Uv!Yat~XR46h%rI$!}a%!|xG7u8Zn | ||
491 | zeY8_|n=K>xz_v_W8VX$W-Fg-qFWcT}7MCyz{%%{ia7hZ>Law-k6NOr}VI&_48U=2l | ||
492 | zwqDKFE8eTwwozDdms#e?x?5a|v>&JF;2_v0L~z5n%BYU^52<*cWuD4|GYUm@1+?)) | ||
493 | zte^45>Rz)t*<T5V#={r>@t@{%?^i#W{i=HAZ*Dc9y59Va-+#P!jrGs;u38a{fLr`N | ||
494 | zvT@rUu>DljxJ?^&Z?-?vyJn3C>3D=qux{Y*bs5|5n)Qmi$TD^Zdn4GU$ocJS2Hh-< | ||
495 | z`xPI^^+v0nUVdjMos8k`WGl7hA`{03ju%<lrgAHSpd^DRf-*}_#Ly0mB!LSfVgWcQ | ||
496 | z&T$@~G9)JI=hz5m0vkrel+Xy{Oh7pkAu-V!j*W7rY(bO}Q$nMH2`FbGB&N)QaV4<4 | ||
497 | zo)~9JXiP9=;}NPl<C@MmXG&;XFlFNrsyfFsonxFSp<}vEgsRSQP3O3#b6nSnP}ON_ | ||
498 | zI!#Tdsp~|j>ckUB>FI=~GokB5sOq#dotCE4(sd$KbtW~PNlj-`*NIToiD#j5J#9^= | ||
499 | zt?NXn>YUJYPG~wObe#xQos*i*NloXZt`niEb4t@WrRki~bs|)CI+{*L)9L6s5vn>< | ||
500 | zn$DD_Go|Z9sOn5>I@6lYw5}7Os&iV?Ij!lO)^#FOb!If38BJ$K*NIToIiu;E(R9w} | ||
501 | zIuWWmPiZ<&X*y5oIuWWmF_XaEC!a&Jn$B5WCqh-{X-(&8P3LJ{Cqh-{8P3dyPr@^t | ||
502 | zSqL9?X9Uwd3W@23*s~h*tj0X6GZCuHa~kuU#yqDp5vt7d8uPryJg+kms?5hU=3^T3 | ||
503 | zF`bD}WnSP+=`t5MQ$FJ_2&Q~+BP6E0f^%BVIW6a$o)e+SX~IDBih-7z6{O~7YTy`& | ||
504 | zLjy&Cv?7QikV#>n0>>@MV8oK`Gmun34-FKdlm-J8SZSaNlnhir4-FI{S|bfqV8e)V | ||
505 | zss<{chX#reE#g=hsKAC%sF6d-Km}BWs!kZFsFpKfpbC@>6rprQGEjt4Ck#|zITHq| | ||
506 | zK*>M_l;<P^MJRQ`Kn0dFVW0|>3{*fllMEE0)CmI>Sk8ojDo`>|0p(0GP=xY&!axO< | ||
507 | zGhv_#lnhirIg<<&q0|Wj6<E%MfhtfkPyyvkGEjt4Ck#|zITHq|K*>M_lrzad5lWpf | ||
508 | zP=V!47^ngz0~JutBm+e#b;3XemNQ|X3X}{~Ksl2P6rt1!0~J`#gn=qhGEf2KOfpb} | ||
509 | zQYQ>lU^x>8szAv=1(Y+%KoLrvFi?TzOc<yFB?A>u&LjgxD0RX>1(q{mpbC@>R6seC | ||
510 | z3>2Z%2?G^a&V+#~P%=;f<xDbAgi<FARA4z12C6{GKn0XD$v_cGoiI>=<xCi;0wn_# | ||
511 | zP|hR+MJRQ`Kn0dFVW0|>3{*fllMEE0)CmI>Sk8ojDo`>|0p(0GP=rz^3{+q_69%e4 | ||
512 | z$v_2^Gs!>^N}VuJf#pmXr~)Me6;RG314Srx!axxz28u{EP=u<1B2)}iVZuNaCK;&0 | ||
513 | zBm-5LFi?dF167!0pbC==RAItE6($T+VUmF=Ofpb~2?JG_Fi?d_2C6X0Kouqo6p_5T | ||
514 | zFi=FeV!SiSKoR0H$dH(_Z(*Q_WZ%L-5y`$K14StNmJAdjmWs}HV4<vU_xO+1efmLq | ||
515 | zZ;W>N_U)fP6Qy6Nw5mbt9Y(#emWSi66=>tq#xoh#Ue=0qyhxi8ZOUe5y0V7VfPUhp | ||
516 | zwX=;ymc+i5%sg9Ja~lZ&8oAV@mHc>&CHP9v4R(jhtT?un;O4e9#pno)Xkh7OWgK&a | ||
517 | zyj=3Iv0OuoK_;5rOr5f(Kb~ZXDBO+V`OWYo#_C08imwChQxnjdd?wZLDou8aj;$SD | ||
518 | zGDYiA3<$Tu<JnHL(KPOChi#zrR32t83}naR$+ym4P_h?z_5#|cW-nw$XD_sOtE62l | ||
519 | zrD3@*)NVyiklt0&yF9%+klsBey&I<Y2E<!f(E8TuJte)z(|ZHyy<^gQVfx}=`q&B5 | ||
520 | z7nSryp1wGczIaUfVwiq$Fn#<4=@*ssi#+|}K>EdF(l3VTOM~ghPLRH&q%ZOGrGfON | ||
521 | zW73zx^yR_y<0nX8R??Sw`tm^f@-gYlNFSp|*<gA{q?Zp5Oe-+l#rmyYmKozi9y=P> | ||
522 | zVReJU*h=ZuVXiS$ohTbw-O#v9>(yZbGE|)?8(H1ZIKvV!jWa0>vy!3eMA^vdhQ>`s | ||
523 | zuMSg{q3T50$m)j1!HixV<}X9liL#N^4c*tL^y)CF8LCc{jjV3yKAqL8!%SzWI#H%q | ||
524 | z=bSrQ&)%JCRttF5g4Zf`6l?y@>PzD7MA^D>wBlcH6r1ucwJ<p0O%rZ?JzIY3-QdmZ | ||
525 | zzs|n>`a5r3e|z)wcUaqS>nqFQ-8x}eCF4u`OWUxqst-@1rSmUs%WmKP5e0dcb?e2N | ||
526 | z;Z|x*!);VwF|Yuhqs^khqOM!@u*jY!WYldISF(V6`BoNd&6Qfk3>X#SuD^7J>p_D= | ||
527 | zBPa51y^_n#=cpOt#Zf$ya$Ae9Mfz56n|<i!a=ELS@)%a{^NIH3SDuN<R~sah1km#P | ||
528 | zU@?*f%<rG=4W1wgfi;C?_n|W@%lm$&8YfvNOJodIg&IcIpIJQRHr<+ej11GQ6)&eF | ||
529 | z2Lam*jIH}#y0>KnY%4JQfOYS$*uU%f#@$U6`N8I3N-lV?5ErFCdv~xDmu2(wexld4 | ||
530 | z4v^;aVAT2k6GJ^m*FD(Wqc(Qg^)6a<?}h$zLoj}4;PP!+(O{@!a1y-hoAhF_7!z+6 | ||
531 | zslpAmNtYbjHrw-~#SPVk_FUf>-Obg6yV`8o$8_`PyJe_;bY5_EMBfBfWU!Q=*9HsG | ||
532 | z%_Cda{@_Krr!oHVhv9+y+T5qR8zZ2aZ>5r!$*|f$^U%yBUYfR&B!+EYy_PwL!BeUi | ||
533 | zJH^}r3r9Q+B)X@Z)fk=P13w&7x#wBtXTZ)g>WITPg5r&pQc!nmyrmk#S(>>b9xnNr | ||
534 | zx_b#v9Xv-Y><Wb%?S^0Xe&<)bbKl_=Z|3C$tf|F<bYzE*mfHB;uC)`q-?buaBe?l? | ||
535 | zcLTpK*k<49Z32`K?|nSBMFqxTK^_IE-li2fEGdK~(ZdoKBl6ab4a;Hler#`xvEXJG | ||
536 | zb?<E%EZExfX>jcOVhS*0rS~RS1dA#xhkv@Nct@#q?LyeKS<$uFec!bw>{@uu$gZ6a | ||
537 | zyVen1i{1BKd%~`D7|m$;U0a<I*3I7%^N%N%lGYdU_GS!gaR8T$NA@GzFi~z`l7hdl | ||
538 | zarZy6590|88pi(1zq;V(>38zM0sT&<zX;R5$1w3;`_JMG`;&I&0Y23DMx1%@(w(R9 | ||
539 | z4M$j;D5J+Gy%fijRQsctzFKf&cv|BAz#YLq3CZJWDdtL4u1u1|mkdcUp7|sxJC+?Y | ||
540 | z_@@s`v3j}Q7*z>6X~cwUxUL8G1KT)_XTp!KAbs;vCp{K3&~_X@+ew=-D}v`2MbFV0 | ||
541 | zQsVsL=rXi-pI*G|iiz;VTCutgUs)hDzV1+4?8KcoP3xROf<M%qC6lgVdpFt4<-|uM | ||
542 | z=#rl_b1#YjSIl6Toj2z_hOZcKupkdE(LozC(fN=FY(x|sk)ym|;Rq2E1xJWD%Z!ol | ||
543 | Gu>S+TT-130 | ||
544 | |||
545 | literal 0 | ||
546 | HcmV?d00001 | ||
547 | |||
548 | diff --git a/tests/data/acpi/q35/VIOT.viot b/tests/data/acpi/q35/VIOT.viot | ||
549 | index XXXXXXX..XXXXXXX 100644 | 211 | index XXXXXXX..XXXXXXX 100644 |
550 | GIT binary patch | 212 | GIT binary patch |
551 | literal 112 | 213 | delta 25 |
552 | zcmWIZ^baXu00LVle`k+i1*eDrX9XZ&1PX!JAex!M0Hgv8m>C3sGzdcgBZCA3T-xBj | 214 | bcmYeu;BpUf3CUn!U|^m+kt>V?$N&QXMtB4L |
553 | Q0Zb)W9Hva*zW_`e0M!8s0RR91 | 215 | |
554 | 216 | delta 16 | |
555 | literal 0 | 217 | Xcmc~u;BpUf2}xjJU|^avkt+-UB60)u |
556 | HcmV?d00001 | ||
557 | 218 | ||
558 | -- | 219 | -- |
559 | 2.25.1 | 220 | 2.34.1 |
560 | |||
561 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | The patchset adding the GMAC ethernet to this SoC crossed in the | ||
2 | mail with the patchset cleaning up the NIC handling. When we | ||
3 | create the GMAC modules we must call qemu_configure_nic_device() | ||
4 | so that the user has the opportunity to use the -nic commandline | ||
5 | option to create a network backend and connect it to the GMACs. | ||
1 | 6 | ||
7 | Add the missing call. | ||
8 | |||
9 | Fixes: 21e5326a7c ("hw/arm: Add GMAC devices to NPCM7XX SoC") | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
11 | Reviewed-by: David Woodhouse <dwmw@amazon.co.uk> | ||
12 | Message-id: 20240206171231.396392-2-peter.maydell@linaro.org | ||
13 | --- | ||
14 | hw/arm/npcm7xx.c | 1 + | ||
15 | 1 file changed, 1 insertion(+) | ||
16 | |||
17 | diff --git a/hw/arm/npcm7xx.c b/hw/arm/npcm7xx.c | ||
18 | index XXXXXXX..XXXXXXX 100644 | ||
19 | --- a/hw/arm/npcm7xx.c | ||
20 | +++ b/hw/arm/npcm7xx.c | ||
21 | @@ -XXX,XX +XXX,XX @@ static void npcm7xx_realize(DeviceState *dev, Error **errp) | ||
22 | for (i = 0; i < ARRAY_SIZE(s->gmac); i++) { | ||
23 | SysBusDevice *sbd = SYS_BUS_DEVICE(&s->gmac[i]); | ||
24 | |||
25 | + qemu_configure_nic_device(DEVICE(sbd), false, NULL); | ||
26 | /* | ||
27 | * The device exists regardless of whether it's connected to a QEMU | ||
28 | * netdev backend. So always instantiate it even if there is no | ||
29 | -- | ||
30 | 2.34.1 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | Currently QEMU will warn if there is a NIC on the board that | ||
2 | is not connected to a backend. By default the '-nic user' will | ||
3 | get used for all NICs, but if you manually connect a specific | ||
4 | NIC to a specific backend, then the other NICs on the board | ||
5 | have no backend and will be warned about: | ||
1 | 6 | ||
7 | qemu-system-arm: warning: nic npcm7xx-emc.1 has no peer | ||
8 | qemu-system-arm: warning: nic npcm-gmac.0 has no peer | ||
9 | qemu-system-arm: warning: nic npcm-gmac.1 has no peer | ||
10 | |||
11 | So suppress those warnings by manually connecting every NIC | ||
12 | on the board to some backend. | ||
13 | |||
14 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
15 | Reviewed-by: David Woodhouse <dwmw@amazon.co.uk> | ||
16 | Reviewed-by: Thomas Huth <thuth@redhat.com> | ||
17 | Message-id: 20240206171231.396392-3-peter.maydell@linaro.org | ||
18 | --- | ||
19 | tests/qtest/npcm7xx_emc-test.c | 5 ++++- | ||
20 | 1 file changed, 4 insertions(+), 1 deletion(-) | ||
21 | |||
22 | diff --git a/tests/qtest/npcm7xx_emc-test.c b/tests/qtest/npcm7xx_emc-test.c | ||
23 | index XXXXXXX..XXXXXXX 100644 | ||
24 | --- a/tests/qtest/npcm7xx_emc-test.c | ||
25 | +++ b/tests/qtest/npcm7xx_emc-test.c | ||
26 | @@ -XXX,XX +XXX,XX @@ static int *packet_test_init(int module_num, GString *cmd_line) | ||
27 | * KISS and use -nic. The driver accepts 'emc0' and 'emc1' as aliases | ||
28 | * in the 'model' field to specify the device to match. | ||
29 | */ | ||
30 | - g_string_append_printf(cmd_line, " -nic socket,fd=%d,model=emc%d ", | ||
31 | + g_string_append_printf(cmd_line, " -nic socket,fd=%d,model=emc%d " | ||
32 | + "-nic user,model=npcm7xx-emc " | ||
33 | + "-nic user,model=npcm-gmac " | ||
34 | + "-nic user,model=npcm-gmac", | ||
35 | test_sockets[1], module_num); | ||
36 | |||
37 | g_test_queue_destroy(packet_test_clear, test_sockets); | ||
38 | -- | ||
39 | 2.34.1 | diff view generated by jsdifflib |
1 | The calculation of the length of TLB range invalidate operations | 1 | It doesn't make sense to read the value of MDCR_EL2 on a non-A-profile |
---|---|---|---|
2 | in tlbi_aa64_range_get_length() is incorrect in two ways: | 2 | CPU, and in fact if you try to do it we will assert: |
3 | * the NUM field is 5 bits, but we read only 4 bits | ||
4 | * we miscalculate the page_shift value, because of an | ||
5 | off-by-one error: | ||
6 | TG 0b00 is invalid | ||
7 | TG 0b01 is 4K granule size == 4096 == 2^12 | ||
8 | TG 0b10 is 16K granule size == 16384 == 2^14 | ||
9 | TG 0b11 is 64K granule size == 65536 == 2^16 | ||
10 | so page_shift should be (TG - 1) * 2 + 12 | ||
11 | 3 | ||
12 | Thanks to the bug report submitter Cha HyunSoo for identifying | 4 | #6 0x00007ffff4b95e96 in __GI___assert_fail |
13 | both these errors. | 5 | (assertion=0x5555565a8c70 "!arm_feature(env, ARM_FEATURE_M)", file=0x5555565a6e5c "../../target/arm/helper.c", line=12600, function=0x5555565a9560 <__PRETTY_FUNCTION__.0> "arm_security_space_below_el3") at ./assert/assert.c:101 |
6 | #7 0x0000555555ebf412 in arm_security_space_below_el3 (env=0x555557bc8190) at ../../target/arm/helper.c:12600 | ||
7 | #8 0x0000555555ea6f89 in arm_is_el2_enabled (env=0x555557bc8190) at ../../target/arm/cpu.h:2595 | ||
8 | #9 0x0000555555ea942f in arm_mdcr_el2_eff (env=0x555557bc8190) at ../../target/arm/internals.h:1512 | ||
14 | 9 | ||
15 | Fixes: 84940ed82552d3c ("target/arm: Add support for FEAT_TLBIRANGE") | 10 | We might call pmu_counter_enabled() on an M-profile CPU (for example |
16 | Resolves: https://gitlab.com/qemu-project/qemu/-/issues/734 | 11 | from the migration pre/post hooks in machine.c); this should always |
12 | return false because these CPUs don't set ARM_FEATURE_PMU. | ||
13 | |||
14 | Avoid the assertion by not calling arm_mdcr_el2_eff() before we | ||
15 | have done the early return for "PMU not present". | ||
16 | |||
17 | This fixes an assertion failure if you try to do a loadvm or | ||
18 | savevm for an M-profile board. | ||
19 | |||
20 | Cc: qemu-stable@nongnu.org | ||
21 | Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2155 | ||
17 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 22 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
23 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
18 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 24 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
19 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | 25 | Message-id: 20240208153346.970021-1-peter.maydell@linaro.org |
20 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
21 | Message-id: 20211130173257.1274194-1-peter.maydell@linaro.org | ||
22 | --- | 26 | --- |
23 | target/arm/helper.c | 6 +++--- | 27 | target/arm/helper.c | 12 ++++++++++-- |
24 | 1 file changed, 3 insertions(+), 3 deletions(-) | 28 | 1 file changed, 10 insertions(+), 2 deletions(-) |
25 | 29 | ||
26 | diff --git a/target/arm/helper.c b/target/arm/helper.c | 30 | diff --git a/target/arm/helper.c b/target/arm/helper.c |
27 | index XXXXXXX..XXXXXXX 100644 | 31 | index XXXXXXX..XXXXXXX 100644 |
28 | --- a/target/arm/helper.c | 32 | --- a/target/arm/helper.c |
29 | +++ b/target/arm/helper.c | 33 | +++ b/target/arm/helper.c |
30 | @@ -XXX,XX +XXX,XX @@ static uint64_t tlbi_aa64_range_get_length(CPUARMState *env, | 34 | @@ -XXX,XX +XXX,XX @@ static bool pmu_counter_enabled(CPUARMState *env, uint8_t counter) |
31 | uint64_t exponent; | 35 | bool enabled, prohibited = false, filtered; |
32 | uint64_t length; | 36 | bool secure = arm_is_secure(env); |
33 | 37 | int el = arm_current_el(env); | |
34 | - num = extract64(value, 39, 4); | 38 | - uint64_t mdcr_el2 = arm_mdcr_el2_eff(env); |
35 | + num = extract64(value, 39, 5); | 39 | - uint8_t hpmn = mdcr_el2 & MDCR_HPMN; |
36 | scale = extract64(value, 44, 2); | 40 | + uint64_t mdcr_el2; |
37 | page_size_granule = extract64(value, 46, 2); | 41 | + uint8_t hpmn; |
38 | 42 | ||
39 | - page_shift = page_size_granule * 2 + 12; | 43 | + /* |
40 | - | 44 | + * We might be called for M-profile cores where MDCR_EL2 doesn't |
41 | if (page_size_granule == 0) { | 45 | + * exist and arm_mdcr_el2_eff() will assert, so this early-exit check |
42 | qemu_log_mask(LOG_GUEST_ERROR, "Invalid page size granule %d\n", | 46 | + * must be before we read that value. |
43 | page_size_granule); | 47 | + */ |
44 | return 0; | 48 | if (!arm_feature(env, ARM_FEATURE_PMU)) { |
49 | return false; | ||
45 | } | 50 | } |
46 | 51 | ||
47 | + page_shift = (page_size_granule - 1) * 2 + 12; | 52 | + mdcr_el2 = arm_mdcr_el2_eff(env); |
53 | + hpmn = mdcr_el2 & MDCR_HPMN; | ||
48 | + | 54 | + |
49 | exponent = (5 * scale) + 1; | 55 | if (!arm_feature(env, ARM_FEATURE_EL2) || |
50 | length = (num + 1) << (exponent + page_shift); | 56 | (counter < hpmn || counter == 31)) { |
51 | 57 | e = env->cp15.c9_pmcr & PMCRE; | |
52 | -- | 58 | -- |
53 | 2.25.1 | 59 | 2.34.1 |
54 | 60 | ||
55 | 61 | diff view generated by jsdifflib |
1 | From: Jean-Philippe Brucker <jean-philippe@linaro.org> | 1 | From: Nabih Estefan <nabihestefan@google.com> |
---|---|---|---|
2 | 2 | ||
3 | virtio-iommu is now supported with ACPI VIOT as well as device tree. | 3 | Fix the nocm_gmac-test.c file to run on a nuvoton 7xx machine instead |
4 | Remove the restriction that prevents from instantiating a virtio-iommu | 4 | of 8xx. Also fix comments referencing this and values expecting 8xx. |
5 | device under ACPI. | ||
6 | 5 | ||
7 | Acked-by: Igor Mammedov <imammedo@redhat.com> | 6 | Change-Id: Iabd0fba14910c3f1e883c4a9521350f3db9ffab8 |
8 | Reviewed-by: Eric Auger <eric.auger@redhat.com> | 7 | Signed-Off-By: Nabih Estefan <nabihestefan@google.com> |
9 | Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org> | 8 | Reviewed-by: Tyrone Ting <kfting@nuvoton.com> |
10 | Message-id: 20211210170415.583179-3-jean-philippe@linaro.org | 9 | Message-id: 20240208194759.2858582-2-nabihestefan@google.com |
10 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
11 | [PMM: commit message tweaks] | ||
11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
12 | --- | 13 | --- |
13 | hw/arm/virt.c | 10 ++-------- | 14 | tests/qtest/npcm_gmac-test.c | 84 +----------------------------------- |
14 | hw/virtio/virtio-iommu-pci.c | 12 ++---------- | 15 | tests/qtest/meson.build | 3 +- |
15 | 2 files changed, 4 insertions(+), 18 deletions(-) | 16 | 2 files changed, 4 insertions(+), 83 deletions(-) |
16 | 17 | ||
17 | diff --git a/hw/arm/virt.c b/hw/arm/virt.c | 18 | diff --git a/tests/qtest/npcm_gmac-test.c b/tests/qtest/npcm_gmac-test.c |
18 | index XXXXXXX..XXXXXXX 100644 | 19 | index XXXXXXX..XXXXXXX 100644 |
19 | --- a/hw/arm/virt.c | 20 | --- a/tests/qtest/npcm_gmac-test.c |
20 | +++ b/hw/arm/virt.c | 21 | +++ b/tests/qtest/npcm_gmac-test.c |
21 | @@ -XXX,XX +XXX,XX @@ static HotplugHandler *virt_machine_get_hotplug_handler(MachineState *machine, | 22 | @@ -XXX,XX +XXX,XX @@ typedef struct TestData { |
22 | MachineClass *mc = MACHINE_GET_CLASS(machine); | 23 | const GMACModule *module; |
23 | 24 | } TestData; | |
24 | if (device_is_dynamic_sysbus(mc, dev) || | 25 | |
25 | - (object_dynamic_cast(OBJECT(dev), TYPE_PC_DIMM))) { | 26 | -/* Values extracted from hw/arm/npcm8xx.c */ |
26 | + object_dynamic_cast(OBJECT(dev), TYPE_PC_DIMM) || | 27 | +/* Values extracted from hw/arm/npcm7xx.c */ |
27 | + object_dynamic_cast(OBJECT(dev), TYPE_VIRTIO_IOMMU_PCI)) { | 28 | static const GMACModule gmac_module_list[] = { |
28 | return HOTPLUG_HANDLER(machine); | 29 | { |
29 | } | 30 | .irq = 14, |
30 | - if (object_dynamic_cast(OBJECT(dev), TYPE_VIRTIO_IOMMU_PCI)) { | 31 | @@ -XXX,XX +XXX,XX @@ static const GMACModule gmac_module_list[] = { |
31 | - VirtMachineState *vms = VIRT_MACHINE(machine); | 32 | .irq = 15, |
33 | .base_addr = 0xf0804000 | ||
34 | }, | ||
35 | - { | ||
36 | - .irq = 16, | ||
37 | - .base_addr = 0xf0806000 | ||
38 | - }, | ||
39 | - { | ||
40 | - .irq = 17, | ||
41 | - .base_addr = 0xf0808000 | ||
42 | - } | ||
43 | }; | ||
44 | |||
45 | /* Returns the index of the GMAC module. */ | ||
46 | @@ -XXX,XX +XXX,XX @@ static uint32_t gmac_read(QTestState *qts, const GMACModule *mod, | ||
47 | return qtest_readl(qts, mod->base_addr + regno); | ||
48 | } | ||
49 | |||
50 | -static uint16_t pcs_read(QTestState *qts, const GMACModule *mod, | ||
51 | - NPCMRegister regno) | ||
52 | -{ | ||
53 | - uint32_t write_value = (regno & 0x3ffe00) >> 9; | ||
54 | - qtest_writel(qts, PCS_BASE_ADDRESS + NPCM_PCS_IND_AC_BA, write_value); | ||
55 | - uint32_t read_offset = regno & 0x1ff; | ||
56 | - return qtest_readl(qts, PCS_BASE_ADDRESS + read_offset); | ||
57 | -} | ||
32 | - | 58 | - |
33 | - if (!vms->bootinfo.firmware_loaded || !virt_is_acpi_enabled(vms)) { | 59 | /* Check that GMAC registers are reset to default value */ |
34 | - return HOTPLUG_HANDLER(machine); | 60 | static void test_init(gconstpointer test_data) |
35 | - } | 61 | { |
62 | const TestData *td = test_data; | ||
63 | const GMACModule *mod = td->module; | ||
64 | - QTestState *qts = qtest_init("-machine npcm845-evb"); | ||
65 | + QTestState *qts = qtest_init("-machine npcm750-evb"); | ||
66 | |||
67 | #define CHECK_REG32(regno, value) \ | ||
68 | do { \ | ||
69 | g_assert_cmphex(gmac_read(qts, mod, (regno)), ==, (value)); \ | ||
70 | } while (0) | ||
71 | |||
72 | -#define CHECK_REG_PCS(regno, value) \ | ||
73 | - do { \ | ||
74 | - g_assert_cmphex(pcs_read(qts, mod, (regno)), ==, (value)); \ | ||
75 | - } while (0) | ||
76 | - | ||
77 | CHECK_REG32(NPCM_DMA_BUS_MODE, 0x00020100); | ||
78 | CHECK_REG32(NPCM_DMA_XMT_POLL_DEMAND, 0); | ||
79 | CHECK_REG32(NPCM_DMA_RCV_POLL_DEMAND, 0); | ||
80 | @@ -XXX,XX +XXX,XX @@ static void test_init(gconstpointer test_data) | ||
81 | CHECK_REG32(NPCM_GMAC_PTP_TAR, 0); | ||
82 | CHECK_REG32(NPCM_GMAC_PTP_TTSR, 0); | ||
83 | |||
84 | - /* TODO Add registers PCS */ | ||
85 | - if (mod->base_addr == 0xf0802000) { | ||
86 | - CHECK_REG_PCS(NPCM_PCS_SR_CTL_ID1, 0x699e); | ||
87 | - CHECK_REG_PCS(NPCM_PCS_SR_CTL_ID2, 0); | ||
88 | - CHECK_REG_PCS(NPCM_PCS_SR_CTL_STS, 0x8000); | ||
89 | - | ||
90 | - CHECK_REG_PCS(NPCM_PCS_SR_MII_CTRL, 0x1140); | ||
91 | - CHECK_REG_PCS(NPCM_PCS_SR_MII_STS, 0x0109); | ||
92 | - CHECK_REG_PCS(NPCM_PCS_SR_MII_DEV_ID1, 0x699e); | ||
93 | - CHECK_REG_PCS(NPCM_PCS_SR_MII_DEV_ID2, 0x0ced0); | ||
94 | - CHECK_REG_PCS(NPCM_PCS_SR_MII_AN_ADV, 0x0020); | ||
95 | - CHECK_REG_PCS(NPCM_PCS_SR_MII_LP_BABL, 0); | ||
96 | - CHECK_REG_PCS(NPCM_PCS_SR_MII_AN_EXPN, 0); | ||
97 | - CHECK_REG_PCS(NPCM_PCS_SR_MII_EXT_STS, 0xc000); | ||
98 | - | ||
99 | - CHECK_REG_PCS(NPCM_PCS_SR_TIM_SYNC_ABL, 0x0003); | ||
100 | - CHECK_REG_PCS(NPCM_PCS_SR_TIM_SYNC_TX_MAX_DLY_LWR, 0x0038); | ||
101 | - CHECK_REG_PCS(NPCM_PCS_SR_TIM_SYNC_TX_MAX_DLY_UPR, 0); | ||
102 | - CHECK_REG_PCS(NPCM_PCS_SR_TIM_SYNC_TX_MIN_DLY_LWR, 0x0038); | ||
103 | - CHECK_REG_PCS(NPCM_PCS_SR_TIM_SYNC_TX_MIN_DLY_UPR, 0); | ||
104 | - CHECK_REG_PCS(NPCM_PCS_SR_TIM_SYNC_RX_MAX_DLY_LWR, 0x0058); | ||
105 | - CHECK_REG_PCS(NPCM_PCS_SR_TIM_SYNC_RX_MAX_DLY_UPR, 0); | ||
106 | - CHECK_REG_PCS(NPCM_PCS_SR_TIM_SYNC_RX_MIN_DLY_LWR, 0x0048); | ||
107 | - CHECK_REG_PCS(NPCM_PCS_SR_TIM_SYNC_RX_MIN_DLY_UPR, 0); | ||
108 | - | ||
109 | - CHECK_REG_PCS(NPCM_PCS_VR_MII_MMD_DIG_CTRL1, 0x2400); | ||
110 | - CHECK_REG_PCS(NPCM_PCS_VR_MII_AN_CTRL, 0); | ||
111 | - CHECK_REG_PCS(NPCM_PCS_VR_MII_AN_INTR_STS, 0x000a); | ||
112 | - CHECK_REG_PCS(NPCM_PCS_VR_MII_TC, 0); | ||
113 | - CHECK_REG_PCS(NPCM_PCS_VR_MII_DBG_CTRL, 0); | ||
114 | - CHECK_REG_PCS(NPCM_PCS_VR_MII_EEE_MCTRL0, 0x899c); | ||
115 | - CHECK_REG_PCS(NPCM_PCS_VR_MII_EEE_TXTIMER, 0); | ||
116 | - CHECK_REG_PCS(NPCM_PCS_VR_MII_EEE_RXTIMER, 0); | ||
117 | - CHECK_REG_PCS(NPCM_PCS_VR_MII_LINK_TIMER_CTRL, 0); | ||
118 | - CHECK_REG_PCS(NPCM_PCS_VR_MII_EEE_MCTRL1, 0); | ||
119 | - CHECK_REG_PCS(NPCM_PCS_VR_MII_DIG_STS, 0x0010); | ||
120 | - CHECK_REG_PCS(NPCM_PCS_VR_MII_ICG_ERRCNT1, 0); | ||
121 | - CHECK_REG_PCS(NPCM_PCS_VR_MII_MISC_STS, 0); | ||
122 | - CHECK_REG_PCS(NPCM_PCS_VR_MII_RX_LSTS, 0); | ||
123 | - CHECK_REG_PCS(NPCM_PCS_VR_MII_MP_TX_BSTCTRL0, 0x00a); | ||
124 | - CHECK_REG_PCS(NPCM_PCS_VR_MII_MP_TX_LVLCTRL0, 0x007f); | ||
125 | - CHECK_REG_PCS(NPCM_PCS_VR_MII_MP_TX_GENCTRL0, 0x0001); | ||
126 | - CHECK_REG_PCS(NPCM_PCS_VR_MII_MP_TX_GENCTRL1, 0); | ||
127 | - CHECK_REG_PCS(NPCM_PCS_VR_MII_MP_TX_STS, 0); | ||
128 | - CHECK_REG_PCS(NPCM_PCS_VR_MII_MP_RX_GENCTRL0, 0x0100); | ||
129 | - CHECK_REG_PCS(NPCM_PCS_VR_MII_MP_RX_GENCTRL1, 0x1100); | ||
130 | - CHECK_REG_PCS(NPCM_PCS_VR_MII_MP_RX_LOS_CTRL0, 0x000e); | ||
131 | - CHECK_REG_PCS(NPCM_PCS_VR_MII_MP_MPLL_CTRL0, 0x0100); | ||
132 | - CHECK_REG_PCS(NPCM_PCS_VR_MII_MP_MPLL_CTRL1, 0x0032); | ||
133 | - CHECK_REG_PCS(NPCM_PCS_VR_MII_MP_MPLL_STS, 0x0001); | ||
134 | - CHECK_REG_PCS(NPCM_PCS_VR_MII_MP_MISC_CTRL2, 0); | ||
135 | - CHECK_REG_PCS(NPCM_PCS_VR_MII_MP_LVL_CTRL, 0x0019); | ||
136 | - CHECK_REG_PCS(NPCM_PCS_VR_MII_MP_MISC_CTRL0, 0); | ||
137 | - CHECK_REG_PCS(NPCM_PCS_VR_MII_MP_MISC_CTRL1, 0); | ||
138 | - CHECK_REG_PCS(NPCM_PCS_VR_MII_DIG_CTRL2, 0); | ||
139 | - CHECK_REG_PCS(NPCM_PCS_VR_MII_DIG_ERRCNT_SEL, 0); | ||
36 | - } | 140 | - } |
37 | return NULL; | 141 | - |
142 | qtest_quit(qts); | ||
38 | } | 143 | } |
39 | 144 | ||
40 | diff --git a/hw/virtio/virtio-iommu-pci.c b/hw/virtio/virtio-iommu-pci.c | 145 | diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build |
41 | index XXXXXXX..XXXXXXX 100644 | 146 | index XXXXXXX..XXXXXXX 100644 |
42 | --- a/hw/virtio/virtio-iommu-pci.c | 147 | --- a/tests/qtest/meson.build |
43 | +++ b/hw/virtio/virtio-iommu-pci.c | 148 | +++ b/tests/qtest/meson.build |
44 | @@ -XXX,XX +XXX,XX @@ static void virtio_iommu_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp) | 149 | @@ -XXX,XX +XXX,XX @@ qtests_npcm7xx = \ |
45 | VirtIOIOMMU *s = VIRTIO_IOMMU(vdev); | 150 | 'npcm7xx_sdhci-test', |
46 | 151 | 'npcm7xx_smbus-test', | |
47 | if (!qdev_get_machine_hotplug_handler(DEVICE(vpci_dev))) { | 152 | 'npcm7xx_timer-test', |
48 | - MachineClass *mc = MACHINE_GET_CLASS(qdev_get_machine()); | 153 | - 'npcm7xx_watchdog_timer-test'] + \ |
49 | - | 154 | + 'npcm7xx_watchdog_timer-test', |
50 | - error_setg(errp, | 155 | + 'npcm_gmac-test'] + \ |
51 | - "%s machine fails to create iommu-map device tree bindings", | 156 | (slirp.found() ? ['npcm7xx_emc-test'] : []) |
52 | - mc->name); | 157 | qtests_aspeed = \ |
53 | - error_append_hint(errp, | 158 | ['aspeed_hace-test', |
54 | - "Check your machine implements a hotplug handler " | ||
55 | - "for the virtio-iommu-pci device\n"); | ||
56 | - error_append_hint(errp, "Check the guest is booted without FW or with " | ||
57 | - "-no-acpi\n"); | ||
58 | + error_setg(errp, "Check your machine implements a hotplug handler " | ||
59 | + "for the virtio-iommu-pci device"); | ||
60 | return; | ||
61 | } | ||
62 | for (int i = 0; i < s->nb_reserved_regions; i++) { | ||
63 | -- | 159 | -- |
64 | 2.25.1 | 160 | 2.34.1 |
65 | |||
66 | diff view generated by jsdifflib |
1 | From: Jean-Philippe Brucker <jean-philippe@linaro.org> | 1 | From: Luc Michel <luc.michel@amd.com> |
---|---|---|---|
2 | 2 | ||
3 | We do not support instantiating multiple IOMMUs. Before adding a | 3 | An access fault is raised when the Access Flag is not set in the |
4 | virtio-iommu, check that no other IOMMU is present. This will detect | 4 | looked-up PTE and the AFFD field is not set in the corresponding context |
5 | both "iommu=smmuv3" machine parameter and another virtio-iommu instance. | 5 | descriptor. This was already implemented for stage 2. Implement it for |
6 | stage 1 as well. | ||
6 | 7 | ||
7 | Fixes: 70e89132c9 ("hw/arm/virt: Add the virtio-iommu device tree mappings") | 8 | Signed-off-by: Luc Michel <luc.michel@amd.com> |
9 | Reviewed-by: Mostafa Saleh <smostafa@google.com> | ||
8 | Reviewed-by: Eric Auger <eric.auger@redhat.com> | 10 | Reviewed-by: Eric Auger <eric.auger@redhat.com> |
9 | Reviewed-by: Igor Mammedov <imammedo@redhat.com> | 11 | Tested-by: Mostafa Saleh <smostafa@google.com> |
10 | Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org> | 12 | Message-id: 20240213082211.3330400-1-luc.michel@amd.com |
11 | Message-id: 20211210170415.583179-4-jean-philippe@linaro.org | 13 | [PMM: tweaked comment text] |
12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 14 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
13 | --- | 15 | --- |
14 | hw/arm/virt.c | 5 +++++ | 16 | hw/arm/smmuv3-internal.h | 1 + |
15 | 1 file changed, 5 insertions(+) | 17 | include/hw/arm/smmu-common.h | 1 + |
18 | hw/arm/smmu-common.c | 11 +++++++++++ | ||
19 | hw/arm/smmuv3.c | 1 + | ||
20 | 4 files changed, 14 insertions(+) | ||
16 | 21 | ||
17 | diff --git a/hw/arm/virt.c b/hw/arm/virt.c | 22 | diff --git a/hw/arm/smmuv3-internal.h b/hw/arm/smmuv3-internal.h |
18 | index XXXXXXX..XXXXXXX 100644 | 23 | index XXXXXXX..XXXXXXX 100644 |
19 | --- a/hw/arm/virt.c | 24 | --- a/hw/arm/smmuv3-internal.h |
20 | +++ b/hw/arm/virt.c | 25 | +++ b/hw/arm/smmuv3-internal.h |
21 | @@ -XXX,XX +XXX,XX @@ static void virt_machine_device_pre_plug_cb(HotplugHandler *hotplug_dev, | 26 | @@ -XXX,XX +XXX,XX @@ static inline int pa_range(STE *ste) |
22 | hwaddr db_start = 0, db_end = 0; | 27 | #define CD_EPD(x, sel) extract32((x)->word[0], (16 * (sel)) + 14, 1) |
23 | char *resv_prop_str; | 28 | #define CD_ENDI(x) extract32((x)->word[0], 15, 1) |
24 | 29 | #define CD_IPS(x) extract32((x)->word[1], 0 , 3) | |
25 | + if (vms->iommu != VIRT_IOMMU_NONE) { | 30 | +#define CD_AFFD(x) extract32((x)->word[1], 3 , 1) |
26 | + error_setg(errp, "virt machine does not support multiple IOMMUs"); | 31 | #define CD_TBI(x) extract32((x)->word[1], 6 , 2) |
27 | + return; | 32 | #define CD_HD(x) extract32((x)->word[1], 10 , 1) |
33 | #define CD_HA(x) extract32((x)->word[1], 11 , 1) | ||
34 | diff --git a/include/hw/arm/smmu-common.h b/include/hw/arm/smmu-common.h | ||
35 | index XXXXXXX..XXXXXXX 100644 | ||
36 | --- a/include/hw/arm/smmu-common.h | ||
37 | +++ b/include/hw/arm/smmu-common.h | ||
38 | @@ -XXX,XX +XXX,XX @@ typedef struct SMMUTransCfg { | ||
39 | bool disabled; /* smmu is disabled */ | ||
40 | bool bypassed; /* translation is bypassed */ | ||
41 | bool aborted; /* translation is aborted */ | ||
42 | + bool affd; /* AF fault disable */ | ||
43 | uint32_t iotlb_hits; /* counts IOTLB hits */ | ||
44 | uint32_t iotlb_misses; /* counts IOTLB misses*/ | ||
45 | /* Used by stage-1 only. */ | ||
46 | diff --git a/hw/arm/smmu-common.c b/hw/arm/smmu-common.c | ||
47 | index XXXXXXX..XXXXXXX 100644 | ||
48 | --- a/hw/arm/smmu-common.c | ||
49 | +++ b/hw/arm/smmu-common.c | ||
50 | @@ -XXX,XX +XXX,XX @@ static int smmu_ptw_64_s1(SMMUTransCfg *cfg, | ||
51 | pte_addr, pte, iova, gpa, | ||
52 | block_size >> 20); | ||
53 | } | ||
54 | + | ||
55 | + /* | ||
56 | + * QEMU does not currently implement HTTU, so if AFFD and PTE.AF | ||
57 | + * are 0 we take an Access flag fault. (5.4. Context Descriptor) | ||
58 | + * An Access flag fault takes priority over a Permission fault. | ||
59 | + */ | ||
60 | + if (!PTE_AF(pte) && !cfg->affd) { | ||
61 | + info->type = SMMU_PTW_ERR_ACCESS; | ||
62 | + goto error; | ||
28 | + } | 63 | + } |
29 | + | 64 | + |
30 | switch (vms->msi_controller) { | 65 | ap = PTE_AP(pte); |
31 | case VIRT_MSI_CTRL_NONE: | 66 | if (is_permission_fault(ap, perm)) { |
32 | return; | 67 | info->type = SMMU_PTW_ERR_PERMISSION; |
68 | diff --git a/hw/arm/smmuv3.c b/hw/arm/smmuv3.c | ||
69 | index XXXXXXX..XXXXXXX 100644 | ||
70 | --- a/hw/arm/smmuv3.c | ||
71 | +++ b/hw/arm/smmuv3.c | ||
72 | @@ -XXX,XX +XXX,XX @@ static int decode_cd(SMMUTransCfg *cfg, CD *cd, SMMUEventInfo *event) | ||
73 | cfg->oas = MIN(oas2bits(SMMU_IDR5_OAS), cfg->oas); | ||
74 | cfg->tbi = CD_TBI(cd); | ||
75 | cfg->asid = CD_ASID(cd); | ||
76 | + cfg->affd = CD_AFFD(cd); | ||
77 | |||
78 | trace_smmuv3_decode_cd(cfg->oas); | ||
79 | |||
33 | -- | 80 | -- |
34 | 2.25.1 | 81 | 2.34.1 |
35 | |||
36 | diff view generated by jsdifflib |
1 | From: Joel Stanley <joel@jms.id.au> | 1 | From: Philippe Mathieu-Daudé <philmd@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | This is the latest URL for the OpenBMC CI. The old URL still works, but | 3 | Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
4 | redirects. | 4 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
5 | 5 | Message-id: 20240213155214.13619-2-philmd@linaro.org | |
6 | Reviewed-by: Cédric Le Goater <clg@kaod.org> | ||
7 | Signed-off-by: Joel Stanley <joel@jms.id.au> | ||
8 | Message-id: 20211117065752.330632-3-joel@jms.id.au | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
10 | --- | 7 | --- |
11 | docs/system/arm/aspeed.rst | 2 +- | 8 | hw/arm/stellaris.c | 6 ++++-- |
12 | 1 file changed, 1 insertion(+), 1 deletion(-) | 9 | 1 file changed, 4 insertions(+), 2 deletions(-) |
13 | 10 | ||
14 | diff --git a/docs/system/arm/aspeed.rst b/docs/system/arm/aspeed.rst | 11 | diff --git a/hw/arm/stellaris.c b/hw/arm/stellaris.c |
15 | index XXXXXXX..XXXXXXX 100644 | 12 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/docs/system/arm/aspeed.rst | 13 | --- a/hw/arm/stellaris.c |
17 | +++ b/docs/system/arm/aspeed.rst | 14 | +++ b/hw/arm/stellaris.c |
18 | @@ -XXX,XX +XXX,XX @@ The Aspeed machines can be started using the ``-kernel`` option to | 15 | @@ -XXX,XX +XXX,XX @@ static void stellaris_adc_trigger(void *opaque, int irq, int level) |
19 | load a Linux kernel or from a firmware. Images can be downloaded from | 16 | } |
20 | the OpenBMC jenkins : | 17 | } |
21 | 18 | ||
22 | - https://jenkins.openbmc.org/job/ci-openbmc/lastSuccessfulBuild/distro=ubuntu,label=docker-builder | 19 | -static void stellaris_adc_reset(StellarisADCState *s) |
23 | + https://jenkins.openbmc.org/job/ci-openbmc/lastSuccessfulBuild/ | 20 | +static void stellaris_adc_reset_hold(Object *obj) |
24 | 21 | { | |
25 | or directly from the OpenBMC GitHub release repository : | 22 | + StellarisADCState *s = STELLARIS_ADC(obj); |
23 | int n; | ||
24 | |||
25 | for (n = 0; n < 4; n++) { | ||
26 | @@ -XXX,XX +XXX,XX @@ static void stellaris_adc_init(Object *obj) | ||
27 | memory_region_init_io(&s->iomem, obj, &stellaris_adc_ops, s, | ||
28 | "adc", 0x1000); | ||
29 | sysbus_init_mmio(sbd, &s->iomem); | ||
30 | - stellaris_adc_reset(s); | ||
31 | qdev_init_gpio_in(dev, stellaris_adc_trigger, 1); | ||
32 | } | ||
33 | |||
34 | @@ -XXX,XX +XXX,XX @@ static const TypeInfo stellaris_i2c_info = { | ||
35 | static void stellaris_adc_class_init(ObjectClass *klass, void *data) | ||
36 | { | ||
37 | DeviceClass *dc = DEVICE_CLASS(klass); | ||
38 | + ResettableClass *rc = RESETTABLE_CLASS(klass); | ||
39 | |||
40 | + rc->phases.hold = stellaris_adc_reset_hold; | ||
41 | dc->vmsd = &vmstate_stellaris_adc; | ||
42 | } | ||
26 | 43 | ||
27 | -- | 44 | -- |
28 | 2.25.1 | 45 | 2.34.1 |
29 | 46 | ||
30 | 47 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | From: Philippe Mathieu-Daudé <philmd@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | For A64, any input to an indirect branch can cause this. | 3 | Suggested-by: Peter Maydell <peter.maydell@linaro.org> |
4 | 4 | Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> | |
5 | For A32, many indirect branch paths force the branch to be aligned, | 5 | Message-id: 20240213155214.13619-3-philmd@linaro.org |
6 | but BXWritePC does not. This includes the BX instruction but also | ||
7 | other interworking changes to PC. Prior to v8, this case is UNDEFINED. | ||
8 | With v8, this is CONSTRAINED UNPREDICTABLE and may either raise an | ||
9 | exception or force align the PC. | ||
10 | |||
11 | We choose to raise an exception because we have the infrastructure, | ||
12 | it makes the generated code for gen_bx simpler, and it has the | ||
13 | possibility of catching more guest bugs. | ||
14 | |||
15 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
16 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 6 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
17 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
18 | --- | 8 | --- |
19 | target/arm/helper.h | 1 + | 9 | hw/arm/stellaris.c | 26 ++++++++++++++++++++++---- |
20 | target/arm/syndrome.h | 5 ++++ | 10 | 1 file changed, 22 insertions(+), 4 deletions(-) |
21 | linux-user/aarch64/cpu_loop.c | 46 ++++++++++++++++++++--------------- | ||
22 | target/arm/tlb_helper.c | 18 ++++++++++++++ | ||
23 | target/arm/translate-a64.c | 15 ++++++++++++ | ||
24 | target/arm/translate.c | 22 ++++++++++++++++- | ||
25 | 6 files changed, 87 insertions(+), 20 deletions(-) | ||
26 | 11 | ||
27 | diff --git a/target/arm/helper.h b/target/arm/helper.h | 12 | diff --git a/hw/arm/stellaris.c b/hw/arm/stellaris.c |
28 | index XXXXXXX..XXXXXXX 100644 | 13 | index XXXXXXX..XXXXXXX 100644 |
29 | --- a/target/arm/helper.h | 14 | --- a/hw/arm/stellaris.c |
30 | +++ b/target/arm/helper.h | 15 | +++ b/hw/arm/stellaris.c |
31 | @@ -XXX,XX +XXX,XX @@ DEF_HELPER_FLAGS_3(sel_flags, TCG_CALL_NO_RWG_SE, | 16 | @@ -XXX,XX +XXX,XX @@ static void stellaris_sys_instance_init(Object *obj) |
32 | DEF_HELPER_2(exception_internal, void, env, i32) | 17 | s->sysclk = qdev_init_clock_out(DEVICE(s), "SYSCLK"); |
33 | DEF_HELPER_4(exception_with_syndrome, void, env, i32, i32, i32) | ||
34 | DEF_HELPER_2(exception_bkpt_insn, void, env, i32) | ||
35 | +DEF_HELPER_2(exception_pc_alignment, noreturn, env, tl) | ||
36 | DEF_HELPER_1(setend, void, env) | ||
37 | DEF_HELPER_2(wfi, void, env, i32) | ||
38 | DEF_HELPER_1(wfe, void, env) | ||
39 | diff --git a/target/arm/syndrome.h b/target/arm/syndrome.h | ||
40 | index XXXXXXX..XXXXXXX 100644 | ||
41 | --- a/target/arm/syndrome.h | ||
42 | +++ b/target/arm/syndrome.h | ||
43 | @@ -XXX,XX +XXX,XX @@ static inline uint32_t syn_illegalstate(void) | ||
44 | return (EC_ILLEGALSTATE << ARM_EL_EC_SHIFT) | ARM_EL_IL; | ||
45 | } | 18 | } |
46 | 19 | ||
47 | +static inline uint32_t syn_pcalignment(void) | 20 | -/* I2C controller. */ |
48 | +{ | 21 | +/* |
49 | + return (EC_PCALIGNMENT << ARM_EL_EC_SHIFT) | ARM_EL_IL; | 22 | + * I2C controller. |
23 | + * ??? For now we only implement the master interface. | ||
24 | + */ | ||
25 | |||
26 | #define TYPE_STELLARIS_I2C "stellaris-i2c" | ||
27 | OBJECT_DECLARE_SIMPLE_TYPE(stellaris_i2c_state, STELLARIS_I2C) | ||
28 | @@ -XXX,XX +XXX,XX @@ static void stellaris_i2c_write(void *opaque, hwaddr offset, | ||
29 | stellaris_i2c_update(s); | ||
30 | } | ||
31 | |||
32 | -static void stellaris_i2c_reset(stellaris_i2c_state *s) | ||
33 | +static void stellaris_i2c_reset_enter(Object *obj, ResetType type) | ||
34 | { | ||
35 | + stellaris_i2c_state *s = STELLARIS_I2C(obj); | ||
36 | + | ||
37 | if (s->mcs & STELLARIS_I2C_MCS_BUSBSY) | ||
38 | i2c_end_transfer(s->bus); | ||
50 | +} | 39 | +} |
51 | + | 40 | + |
52 | #endif /* TARGET_ARM_SYNDROME_H */ | 41 | +static void stellaris_i2c_reset_hold(Object *obj) |
53 | diff --git a/linux-user/aarch64/cpu_loop.c b/linux-user/aarch64/cpu_loop.c | ||
54 | index XXXXXXX..XXXXXXX 100644 | ||
55 | --- a/linux-user/aarch64/cpu_loop.c | ||
56 | +++ b/linux-user/aarch64/cpu_loop.c | ||
57 | @@ -XXX,XX +XXX,XX @@ void cpu_loop(CPUARMState *env) | ||
58 | break; | ||
59 | case EXCP_PREFETCH_ABORT: | ||
60 | case EXCP_DATA_ABORT: | ||
61 | - /* We should only arrive here with EC in {DATAABORT, INSNABORT}. */ | ||
62 | ec = syn_get_ec(env->exception.syndrome); | ||
63 | - assert(ec == EC_DATAABORT || ec == EC_INSNABORT); | ||
64 | - | ||
65 | - /* Both EC have the same format for FSC, or close enough. */ | ||
66 | - fsc = extract32(env->exception.syndrome, 0, 6); | ||
67 | - switch (fsc) { | ||
68 | - case 0x04 ... 0x07: /* Translation fault, level {0-3} */ | ||
69 | - si_signo = TARGET_SIGSEGV; | ||
70 | - si_code = TARGET_SEGV_MAPERR; | ||
71 | + switch (ec) { | ||
72 | + case EC_DATAABORT: | ||
73 | + case EC_INSNABORT: | ||
74 | + /* Both EC have the same format for FSC, or close enough. */ | ||
75 | + fsc = extract32(env->exception.syndrome, 0, 6); | ||
76 | + switch (fsc) { | ||
77 | + case 0x04 ... 0x07: /* Translation fault, level {0-3} */ | ||
78 | + si_signo = TARGET_SIGSEGV; | ||
79 | + si_code = TARGET_SEGV_MAPERR; | ||
80 | + break; | ||
81 | + case 0x09 ... 0x0b: /* Access flag fault, level {1-3} */ | ||
82 | + case 0x0d ... 0x0f: /* Permission fault, level {1-3} */ | ||
83 | + si_signo = TARGET_SIGSEGV; | ||
84 | + si_code = TARGET_SEGV_ACCERR; | ||
85 | + break; | ||
86 | + case 0x11: /* Synchronous Tag Check Fault */ | ||
87 | + si_signo = TARGET_SIGSEGV; | ||
88 | + si_code = TARGET_SEGV_MTESERR; | ||
89 | + break; | ||
90 | + case 0x21: /* Alignment fault */ | ||
91 | + si_signo = TARGET_SIGBUS; | ||
92 | + si_code = TARGET_BUS_ADRALN; | ||
93 | + break; | ||
94 | + default: | ||
95 | + g_assert_not_reached(); | ||
96 | + } | ||
97 | break; | ||
98 | - case 0x09 ... 0x0b: /* Access flag fault, level {1-3} */ | ||
99 | - case 0x0d ... 0x0f: /* Permission fault, level {1-3} */ | ||
100 | - si_signo = TARGET_SIGSEGV; | ||
101 | - si_code = TARGET_SEGV_ACCERR; | ||
102 | - break; | ||
103 | - case 0x11: /* Synchronous Tag Check Fault */ | ||
104 | - si_signo = TARGET_SIGSEGV; | ||
105 | - si_code = TARGET_SEGV_MTESERR; | ||
106 | - break; | ||
107 | - case 0x21: /* Alignment fault */ | ||
108 | + case EC_PCALIGNMENT: | ||
109 | si_signo = TARGET_SIGBUS; | ||
110 | si_code = TARGET_BUS_ADRALN; | ||
111 | break; | ||
112 | diff --git a/target/arm/tlb_helper.c b/target/arm/tlb_helper.c | ||
113 | index XXXXXXX..XXXXXXX 100644 | ||
114 | --- a/target/arm/tlb_helper.c | ||
115 | +++ b/target/arm/tlb_helper.c | ||
116 | @@ -XXX,XX +XXX,XX @@ | ||
117 | #include "cpu.h" | ||
118 | #include "internals.h" | ||
119 | #include "exec/exec-all.h" | ||
120 | +#include "exec/helper-proto.h" | ||
121 | |||
122 | static inline uint32_t merge_syn_data_abort(uint32_t template_syn, | ||
123 | unsigned int target_el, | ||
124 | @@ -XXX,XX +XXX,XX @@ void arm_cpu_do_unaligned_access(CPUState *cs, vaddr vaddr, | ||
125 | arm_deliver_fault(cpu, vaddr, access_type, mmu_idx, &fi); | ||
126 | } | ||
127 | |||
128 | +void helper_exception_pc_alignment(CPUARMState *env, target_ulong pc) | ||
129 | +{ | 42 | +{ |
130 | + ARMMMUFaultInfo fi = { .type = ARMFault_Alignment }; | 43 | + stellaris_i2c_state *s = STELLARIS_I2C(obj); |
131 | + int target_el = exception_target_el(env); | 44 | |
132 | + int mmu_idx = cpu_mmu_index(env, true); | 45 | s->msa = 0; |
133 | + uint32_t fsc; | 46 | s->mcs = 0; |
134 | + | 47 | @@ -XXX,XX +XXX,XX @@ static void stellaris_i2c_reset(stellaris_i2c_state *s) |
135 | + env->exception.vaddress = pc; | 48 | s->mimr = 0; |
136 | + | 49 | s->mris = 0; |
137 | + /* | 50 | s->mcr = 0; |
138 | + * Note that the fsc is not applicable to this exception, | ||
139 | + * since any syndrome is pcalignment not insn_abort. | ||
140 | + */ | ||
141 | + env->exception.fsr = compute_fsr_fsc(env, &fi, target_el, mmu_idx, &fsc); | ||
142 | + raise_exception(env, EXCP_PREFETCH_ABORT, syn_pcalignment(), target_el); | ||
143 | +} | 51 | +} |
144 | + | 52 | + |
145 | #if !defined(CONFIG_USER_ONLY) | 53 | +static void stellaris_i2c_reset_exit(Object *obj) |
146 | 54 | +{ | |
147 | /* | 55 | + stellaris_i2c_state *s = STELLARIS_I2C(obj); |
148 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c | ||
149 | index XXXXXXX..XXXXXXX 100644 | ||
150 | --- a/target/arm/translate-a64.c | ||
151 | +++ b/target/arm/translate-a64.c | ||
152 | @@ -XXX,XX +XXX,XX @@ static void aarch64_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) | ||
153 | uint64_t pc = s->base.pc_next; | ||
154 | uint32_t insn; | ||
155 | |||
156 | + /* Singlestep exceptions have the highest priority. */ | ||
157 | if (s->ss_active && !s->pstate_ss) { | ||
158 | /* Singlestep state is Active-pending. | ||
159 | * If we're in this state at the start of a TB then either | ||
160 | @@ -XXX,XX +XXX,XX @@ static void aarch64_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) | ||
161 | return; | ||
162 | } | ||
163 | |||
164 | + if (pc & 3) { | ||
165 | + /* | ||
166 | + * PC alignment fault. This has priority over the instruction abort | ||
167 | + * that we would receive from a translation fault via arm_ldl_code. | ||
168 | + * This should only be possible after an indirect branch, at the | ||
169 | + * start of the TB. | ||
170 | + */ | ||
171 | + assert(s->base.num_insns == 1); | ||
172 | + gen_helper_exception_pc_alignment(cpu_env, tcg_constant_tl(pc)); | ||
173 | + s->base.is_jmp = DISAS_NORETURN; | ||
174 | + s->base.pc_next = QEMU_ALIGN_UP(pc, 4); | ||
175 | + return; | ||
176 | + } | ||
177 | + | 56 | + |
178 | s->pc_curr = pc; | 57 | stellaris_i2c_update(s); |
179 | insn = arm_ldl_code(env, &s->base, pc, s->sctlr_b); | 58 | } |
180 | s->insn = insn; | 59 | |
181 | diff --git a/target/arm/translate.c b/target/arm/translate.c | 60 | @@ -XXX,XX +XXX,XX @@ static void stellaris_i2c_init(Object *obj) |
182 | index XXXXXXX..XXXXXXX 100644 | 61 | memory_region_init_io(&s->iomem, obj, &stellaris_i2c_ops, s, |
183 | --- a/target/arm/translate.c | 62 | "i2c", 0x1000); |
184 | +++ b/target/arm/translate.c | 63 | sysbus_init_mmio(sbd, &s->iomem); |
185 | @@ -XXX,XX +XXX,XX @@ static void arm_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) | 64 | - /* ??? For now we only implement the master interface. */ |
186 | uint32_t pc = dc->base.pc_next; | 65 | - stellaris_i2c_reset(s); |
187 | unsigned int insn; | 66 | } |
188 | 67 | ||
189 | - if (arm_check_ss_active(dc) || arm_check_kernelpage(dc)) { | 68 | /* Analogue to Digital Converter. This is only partially implemented, |
190 | + /* Singlestep exceptions have the highest priority. */ | 69 | @@ -XXX,XX +XXX,XX @@ type_init(stellaris_machine_init) |
191 | + if (arm_check_ss_active(dc)) { | 70 | static void stellaris_i2c_class_init(ObjectClass *klass, void *data) |
192 | + dc->base.pc_next = pc + 4; | 71 | { |
193 | + return; | 72 | DeviceClass *dc = DEVICE_CLASS(klass); |
194 | + } | 73 | + ResettableClass *rc = RESETTABLE_CLASS(klass); |
195 | + | 74 | |
196 | + if (pc & 3) { | 75 | + rc->phases.enter = stellaris_i2c_reset_enter; |
197 | + /* | 76 | + rc->phases.hold = stellaris_i2c_reset_hold; |
198 | + * PC alignment fault. This has priority over the instruction abort | 77 | + rc->phases.exit = stellaris_i2c_reset_exit; |
199 | + * that we would receive from a translation fault via arm_ldl_code | 78 | dc->vmsd = &vmstate_stellaris_i2c; |
200 | + * (or the execution of the kernelpage entrypoint). This should only | 79 | } |
201 | + * be possible after an indirect branch, at the start of the TB. | 80 | |
202 | + */ | ||
203 | + assert(dc->base.num_insns == 1); | ||
204 | + gen_helper_exception_pc_alignment(cpu_env, tcg_constant_tl(pc)); | ||
205 | + dc->base.is_jmp = DISAS_NORETURN; | ||
206 | + dc->base.pc_next = QEMU_ALIGN_UP(pc, 4); | ||
207 | + return; | ||
208 | + } | ||
209 | + | ||
210 | + if (arm_check_kernelpage(dc)) { | ||
211 | dc->base.pc_next = pc + 4; | ||
212 | return; | ||
213 | } | ||
214 | -- | 81 | -- |
215 | 2.25.1 | 82 | 2.34.1 |
216 | 83 | ||
217 | 84 | diff view generated by jsdifflib |
1 | From: Olivier Hériveaux <olivier.heriveaux@ledger.fr> | 1 | From: Philippe Mathieu-Daudé <philmd@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Fix issue where the data register may be overwritten by next character | 3 | QDev objects created with qdev_new() need to manually add |
4 | reception before being read and returned. | 4 | their parent relationship with object_property_add_child(). |
5 | 5 | ||
6 | Signed-off-by: Olivier Hériveaux <olivier.heriveaux@ledger.fr> | 6 | This commit plug the devices which aren't part of the SoC; |
7 | they will be plugged into a SoC container in the next one. | ||
8 | |||
9 | Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
8 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | 11 | Message-id: 20240213155214.13619-4-philmd@linaro.org |
9 | Message-id: 20211128120723.4053-1-olivier.heriveaux@ledger.fr | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
11 | --- | 13 | --- |
12 | hw/char/stm32f2xx_usart.c | 3 ++- | 14 | hw/arm/stellaris.c | 4 ++++ |
13 | 1 file changed, 2 insertions(+), 1 deletion(-) | 15 | 1 file changed, 4 insertions(+) |
14 | 16 | ||
15 | diff --git a/hw/char/stm32f2xx_usart.c b/hw/char/stm32f2xx_usart.c | 17 | diff --git a/hw/arm/stellaris.c b/hw/arm/stellaris.c |
16 | index XXXXXXX..XXXXXXX 100644 | 18 | index XXXXXXX..XXXXXXX 100644 |
17 | --- a/hw/char/stm32f2xx_usart.c | 19 | --- a/hw/arm/stellaris.c |
18 | +++ b/hw/char/stm32f2xx_usart.c | 20 | +++ b/hw/arm/stellaris.c |
19 | @@ -XXX,XX +XXX,XX @@ static uint64_t stm32f2xx_usart_read(void *opaque, hwaddr addr, | 21 | @@ -XXX,XX +XXX,XX @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board) |
20 | return retvalue; | 22 | &error_fatal); |
21 | case USART_DR: | 23 | |
22 | DB_PRINT("Value: 0x%" PRIx32 ", %c\n", s->usart_dr, (char) s->usart_dr); | 24 | ssddev = qdev_new("ssd0323"); |
23 | + retvalue = s->usart_dr & 0x3FF; | 25 | + object_property_add_child(OBJECT(ms), "oled", OBJECT(ssddev)); |
24 | s->usart_sr &= ~USART_SR_RXNE; | 26 | qdev_prop_set_uint8(ssddev, "cs", 1); |
25 | qemu_chr_fe_accept_input(&s->chr); | 27 | qdev_realize_and_unref(ssddev, bus, &error_fatal); |
26 | qemu_set_irq(s->irq, 0); | 28 | |
27 | - return s->usart_dr & 0x3FF; | 29 | gpio_d_splitter = qdev_new(TYPE_SPLIT_IRQ); |
28 | + return retvalue; | 30 | + object_property_add_child(OBJECT(ms), "splitter", |
29 | case USART_BRR: | 31 | + OBJECT(gpio_d_splitter)); |
30 | return s->usart_brr; | 32 | qdev_prop_set_uint32(gpio_d_splitter, "num-lines", 2); |
31 | case USART_CR1: | 33 | qdev_realize_and_unref(gpio_d_splitter, NULL, &error_fatal); |
34 | qdev_connect_gpio_out( | ||
35 | @@ -XXX,XX +XXX,XX @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board) | ||
36 | DeviceState *gpad; | ||
37 | |||
38 | gpad = qdev_new(TYPE_STELLARIS_GAMEPAD); | ||
39 | + object_property_add_child(OBJECT(ms), "gamepad", OBJECT(gpad)); | ||
40 | for (i = 0; i < ARRAY_SIZE(gpad_keycode); i++) { | ||
41 | qlist_append_int(gpad_keycode_list, gpad_keycode[i]); | ||
42 | } | ||
32 | -- | 43 | -- |
33 | 2.25.1 | 44 | 2.34.1 |
34 | 45 | ||
35 | 46 | diff view generated by jsdifflib |
1 | From: Joel Stanley <joel@jms.id.au> | 1 | From: Philippe Mathieu-Daudé <philmd@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | A common use case for the ASPEED machine is to boot a Linux kernel. | 3 | QDev objects created with qdev_new() need to manually add |
4 | Provide a full example command line. | 4 | their parent relationship with object_property_add_child(). |
5 | 5 | ||
6 | Reviewed-by: Cédric Le Goater <clg@kaod.org> | 6 | Since we don't model the SoC, just use a QOM container. |
7 | Signed-off-by: Joel Stanley <joel@jms.id.au> | 7 | |
8 | Message-id: 20211117065752.330632-4-joel@jms.id.au | 8 | Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
9 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | Message-id: 20240213155214.13619-5-philmd@linaro.org | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
10 | --- | 12 | --- |
11 | docs/system/arm/aspeed.rst | 15 ++++++++++++--- | 13 | hw/arm/stellaris.c | 11 ++++++++++- |
12 | 1 file changed, 12 insertions(+), 3 deletions(-) | 14 | 1 file changed, 10 insertions(+), 1 deletion(-) |
13 | 15 | ||
14 | diff --git a/docs/system/arm/aspeed.rst b/docs/system/arm/aspeed.rst | 16 | diff --git a/hw/arm/stellaris.c b/hw/arm/stellaris.c |
15 | index XXXXXXX..XXXXXXX 100644 | 17 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/docs/system/arm/aspeed.rst | 18 | --- a/hw/arm/stellaris.c |
17 | +++ b/docs/system/arm/aspeed.rst | 19 | +++ b/hw/arm/stellaris.c |
18 | @@ -XXX,XX +XXX,XX @@ Missing devices | 20 | @@ -XXX,XX +XXX,XX @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board) |
19 | Boot options | 21 | * 400fe000 system control |
20 | ------------ | 22 | */ |
21 | 23 | ||
22 | -The Aspeed machines can be started using the ``-kernel`` option to | 24 | + Object *soc_container; |
23 | -load a Linux kernel or from a firmware. Images can be downloaded from | 25 | DeviceState *gpio_dev[7], *nvic; |
24 | -the OpenBMC jenkins : | 26 | qemu_irq gpio_in[7][8]; |
25 | +The Aspeed machines can be started using the ``-kernel`` and ``-dtb`` options | 27 | qemu_irq gpio_out[7][8]; |
26 | +to load a Linux kernel or from a firmware. Images can be downloaded from the | 28 | @@ -XXX,XX +XXX,XX @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board) |
27 | +OpenBMC jenkins : | 29 | flash_size = (((board->dc0 & 0xffff) + 1) << 1) * 1024; |
28 | 30 | sram_size = ((board->dc0 >> 18) + 1) * 1024; | |
29 | https://jenkins.openbmc.org/job/ci-openbmc/lastSuccessfulBuild/ | 31 | |
30 | 32 | + soc_container = object_new("container"); | |
31 | @@ -XXX,XX +XXX,XX @@ or directly from the OpenBMC GitHub release repository : | 33 | + object_property_add_child(OBJECT(ms), "soc", soc_container); |
32 | |||
33 | https://github.com/openbmc/openbmc/releases | ||
34 | |||
35 | +To boot a kernel directly from a Linux build tree: | ||
36 | + | 34 | + |
37 | +.. code-block:: bash | 35 | /* Flash programming is done via the SCU, so pretend it is ROM. */ |
38 | + | 36 | memory_region_init_rom(flash, NULL, "stellaris.flash", flash_size, |
39 | + $ qemu-system-arm -M ast2600-evb -nographic \ | 37 | &error_fatal); |
40 | + -kernel arch/arm/boot/zImage \ | 38 | @@ -XXX,XX +XXX,XX @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board) |
41 | + -dtb arch/arm/boot/dts/aspeed-ast2600-evb.dtb \ | 39 | * need its sysclk output. |
42 | + -initrd rootfs.cpio | 40 | */ |
43 | + | 41 | ssys_dev = qdev_new(TYPE_STELLARIS_SYS); |
44 | The image should be attached as an MTD drive. Run : | 42 | + object_property_add_child(soc_container, "sys", OBJECT(ssys_dev)); |
45 | 43 | ||
46 | .. code-block:: bash | 44 | /* |
45 | * Most devices come preprogrammed with a MAC address in the user data. | ||
46 | @@ -XXX,XX +XXX,XX @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board) | ||
47 | sysbus_realize_and_unref(SYS_BUS_DEVICE(ssys_dev), &error_fatal); | ||
48 | |||
49 | nvic = qdev_new(TYPE_ARMV7M); | ||
50 | + object_property_add_child(soc_container, "v7m", OBJECT(nvic)); | ||
51 | qdev_prop_set_uint32(nvic, "num-irq", NUM_IRQ_LINES); | ||
52 | qdev_prop_set_uint8(nvic, "num-prio-bits", NUM_PRIO_BITS); | ||
53 | qdev_prop_set_string(nvic, "cpu-type", ms->cpu_type); | ||
54 | @@ -XXX,XX +XXX,XX @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board) | ||
55 | |||
56 | dev = qdev_new(TYPE_STELLARIS_GPTM); | ||
57 | sbd = SYS_BUS_DEVICE(dev); | ||
58 | + object_property_add_child(soc_container, "gptm[*]", OBJECT(dev)); | ||
59 | qdev_connect_clock_in(dev, "clk", | ||
60 | qdev_get_clock_out(ssys_dev, "SYSCLK")); | ||
61 | sysbus_realize_and_unref(sbd, &error_fatal); | ||
62 | @@ -XXX,XX +XXX,XX @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board) | ||
63 | |||
64 | if (board->dc1 & (1 << 3)) { /* watchdog present */ | ||
65 | dev = qdev_new(TYPE_LUMINARY_WATCHDOG); | ||
66 | - | ||
67 | + object_property_add_child(soc_container, "wdg", OBJECT(dev)); | ||
68 | qdev_connect_clock_in(dev, "WDOGCLK", | ||
69 | qdev_get_clock_out(ssys_dev, "SYSCLK")); | ||
70 | |||
71 | @@ -XXX,XX +XXX,XX @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board) | ||
72 | SysBusDevice *sbd; | ||
73 | |||
74 | dev = qdev_new("pl011_luminary"); | ||
75 | + object_property_add_child(soc_container, "uart[*]", OBJECT(dev)); | ||
76 | sbd = SYS_BUS_DEVICE(dev); | ||
77 | qdev_prop_set_chr(dev, "chardev", serial_hd(i)); | ||
78 | sysbus_realize_and_unref(sbd, &error_fatal); | ||
79 | @@ -XXX,XX +XXX,XX @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board) | ||
80 | DeviceState *enet; | ||
81 | |||
82 | enet = qdev_new("stellaris_enet"); | ||
83 | + object_property_add_child(soc_container, "enet", OBJECT(enet)); | ||
84 | if (nd) { | ||
85 | qdev_set_nic_properties(enet, nd); | ||
86 | } else { | ||
47 | -- | 87 | -- |
48 | 2.25.1 | 88 | 2.34.1 |
49 | 89 | ||
50 | 90 | diff view generated by jsdifflib |
1 | A lot of C files in hw/arm include qemu-common.h when they don't | 1 | We support two different encodings for the AArch32 IMPDEF |
---|---|---|---|
2 | need anything from it. Drop the include lines. | 2 | CBAR register -- older cores like the Cortex A9, A7, A15 |
3 | have this at 4, c15, c0, 0; newer cores like the | ||
4 | Cortex A35, A53, A57 and A72 have it at 1 c15 c0 0. | ||
3 | 5 | ||
4 | omap1.c, pxa2xx.c and strongarm.c retain the include because they | 6 | When we implemented this we picked which encoding to |
5 | use it for the prototype of qemu_get_timedate(). | 7 | use based on whether the CPU set ARM_FEATURE_AARCH64. |
8 | However this isn't right for three cases: | ||
9 | * the qemu-system-arm 'max' CPU, which is supposed to be | ||
10 | a variant on a Cortex-A57; it ought to use the same | ||
11 | encoding the A57 does and which the AArch64 'max' | ||
12 | exposes to AArch32 guest code | ||
13 | * the Cortex-R52, which is AArch32-only but has the CBAR | ||
14 | at the newer encoding (and where we incorrectly are | ||
15 | not yet setting ARM_FEATURE_CBAR_RO anyway) | ||
16 | * any possible future support for other v8 AArch32 | ||
17 | only CPUs, or for supporting "boot the CPU into | ||
18 | AArch32 mode" on our existing cores like the A57 etc | ||
19 | |||
20 | Make the decision of the encoding be based on whether | ||
21 | the CPU implements the ARM_FEATURE_V8 flag instead. | ||
22 | |||
23 | This changes the behaviour only for the qemu-system-arm | ||
24 | '-cpu max'. We don't expect anybody to be relying on the | ||
25 | old behaviour because: | ||
26 | * it's not what the real hardware Cortex-A57 does | ||
27 | (and that's what our ID register claims we are) | ||
28 | * we don't implement the memory-mapped GICv3 support | ||
29 | which is the only thing that exists at the peripheral | ||
30 | base address pointed to by the register | ||
6 | 31 | ||
7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 32 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
8 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 33 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
9 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 34 | Message-id: 20240206132931.38376-2-peter.maydell@linaro.org |
10 | Reviewed-by: Taylor Simpson <tsimpson@quicinc.com> | ||
11 | Reviewed-by: Yoshinori Sato <ysato@users.sourceforge.jp> | ||
12 | Message-id: 20211129200510.1233037-5-peter.maydell@linaro.org | ||
13 | --- | 35 | --- |
14 | hw/arm/boot.c | 1 - | 36 | target/arm/helper.c | 2 +- |
15 | hw/arm/digic_boards.c | 1 - | 37 | 1 file changed, 1 insertion(+), 1 deletion(-) |
16 | hw/arm/highbank.c | 1 - | ||
17 | hw/arm/npcm7xx_boards.c | 1 - | ||
18 | hw/arm/sbsa-ref.c | 1 - | ||
19 | hw/arm/stm32f405_soc.c | 1 - | ||
20 | hw/arm/vexpress.c | 1 - | ||
21 | hw/arm/virt.c | 1 - | ||
22 | 8 files changed, 8 deletions(-) | ||
23 | 38 | ||
24 | diff --git a/hw/arm/boot.c b/hw/arm/boot.c | 39 | diff --git a/target/arm/helper.c b/target/arm/helper.c |
25 | index XXXXXXX..XXXXXXX 100644 | 40 | index XXXXXXX..XXXXXXX 100644 |
26 | --- a/hw/arm/boot.c | 41 | --- a/target/arm/helper.c |
27 | +++ b/hw/arm/boot.c | 42 | +++ b/target/arm/helper.c |
28 | @@ -XXX,XX +XXX,XX @@ | 43 | @@ -XXX,XX +XXX,XX @@ void register_cp_regs_for_features(ARMCPU *cpu) |
29 | */ | 44 | * AArch64 cores we might need to add a specific feature flag |
30 | 45 | * to indicate cores with "flavour 2" CBAR. | |
31 | #include "qemu/osdep.h" | 46 | */ |
32 | -#include "qemu-common.h" | 47 | - if (arm_feature(env, ARM_FEATURE_AARCH64)) { |
33 | #include "qemu/datadir.h" | 48 | + if (arm_feature(env, ARM_FEATURE_V8)) { |
34 | #include "qemu/error-report.h" | 49 | /* 32 bit view is [31:18] 0...0 [43:32]. */ |
35 | #include "qapi/error.h" | 50 | uint32_t cbar32 = (extract64(cpu->reset_cbar, 18, 14) << 18) |
36 | diff --git a/hw/arm/digic_boards.c b/hw/arm/digic_boards.c | 51 | | extract64(cpu->reset_cbar, 32, 12); |
37 | index XXXXXXX..XXXXXXX 100644 | ||
38 | --- a/hw/arm/digic_boards.c | ||
39 | +++ b/hw/arm/digic_boards.c | ||
40 | @@ -XXX,XX +XXX,XX @@ | ||
41 | |||
42 | #include "qemu/osdep.h" | ||
43 | #include "qapi/error.h" | ||
44 | -#include "qemu-common.h" | ||
45 | #include "qemu/datadir.h" | ||
46 | #include "hw/boards.h" | ||
47 | #include "qemu/error-report.h" | ||
48 | diff --git a/hw/arm/highbank.c b/hw/arm/highbank.c | ||
49 | index XXXXXXX..XXXXXXX 100644 | ||
50 | --- a/hw/arm/highbank.c | ||
51 | +++ b/hw/arm/highbank.c | ||
52 | @@ -XXX,XX +XXX,XX @@ | ||
53 | */ | ||
54 | |||
55 | #include "qemu/osdep.h" | ||
56 | -#include "qemu-common.h" | ||
57 | #include "qemu/datadir.h" | ||
58 | #include "qapi/error.h" | ||
59 | #include "hw/sysbus.h" | ||
60 | diff --git a/hw/arm/npcm7xx_boards.c b/hw/arm/npcm7xx_boards.c | ||
61 | index XXXXXXX..XXXXXXX 100644 | ||
62 | --- a/hw/arm/npcm7xx_boards.c | ||
63 | +++ b/hw/arm/npcm7xx_boards.c | ||
64 | @@ -XXX,XX +XXX,XX @@ | ||
65 | #include "hw/qdev-core.h" | ||
66 | #include "hw/qdev-properties.h" | ||
67 | #include "qapi/error.h" | ||
68 | -#include "qemu-common.h" | ||
69 | #include "qemu/datadir.h" | ||
70 | #include "qemu/units.h" | ||
71 | #include "sysemu/blockdev.h" | ||
72 | diff --git a/hw/arm/sbsa-ref.c b/hw/arm/sbsa-ref.c | ||
73 | index XXXXXXX..XXXXXXX 100644 | ||
74 | --- a/hw/arm/sbsa-ref.c | ||
75 | +++ b/hw/arm/sbsa-ref.c | ||
76 | @@ -XXX,XX +XXX,XX @@ | ||
77 | */ | ||
78 | |||
79 | #include "qemu/osdep.h" | ||
80 | -#include "qemu-common.h" | ||
81 | #include "qemu/datadir.h" | ||
82 | #include "qapi/error.h" | ||
83 | #include "qemu/error-report.h" | ||
84 | diff --git a/hw/arm/stm32f405_soc.c b/hw/arm/stm32f405_soc.c | ||
85 | index XXXXXXX..XXXXXXX 100644 | ||
86 | --- a/hw/arm/stm32f405_soc.c | ||
87 | +++ b/hw/arm/stm32f405_soc.c | ||
88 | @@ -XXX,XX +XXX,XX @@ | ||
89 | |||
90 | #include "qemu/osdep.h" | ||
91 | #include "qapi/error.h" | ||
92 | -#include "qemu-common.h" | ||
93 | #include "exec/address-spaces.h" | ||
94 | #include "sysemu/sysemu.h" | ||
95 | #include "hw/arm/stm32f405_soc.h" | ||
96 | diff --git a/hw/arm/vexpress.c b/hw/arm/vexpress.c | ||
97 | index XXXXXXX..XXXXXXX 100644 | ||
98 | --- a/hw/arm/vexpress.c | ||
99 | +++ b/hw/arm/vexpress.c | ||
100 | @@ -XXX,XX +XXX,XX @@ | ||
101 | |||
102 | #include "qemu/osdep.h" | ||
103 | #include "qapi/error.h" | ||
104 | -#include "qemu-common.h" | ||
105 | #include "qemu/datadir.h" | ||
106 | #include "cpu.h" | ||
107 | #include "hw/sysbus.h" | ||
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 @@ | ||
113 | */ | ||
114 | |||
115 | #include "qemu/osdep.h" | ||
116 | -#include "qemu-common.h" | ||
117 | #include "qemu/datadir.h" | ||
118 | #include "qemu/units.h" | ||
119 | #include "qemu/option.h" | ||
120 | -- | 52 | -- |
121 | 2.25.1 | 53 | 2.34.1 |
122 | |||
123 | diff view generated by jsdifflib |
1 | The qemu-common.h header is not supposed to be included from any | 1 | The Cortex-R52 implements the Configuration Base Address Register |
---|---|---|---|
2 | other header files, only from .c files (as documented in a comment at | 2 | (CBAR), as a read-only register. Add ARM_FEATURE_CBAR_RO to this CPU |
3 | the start of it). | 3 | type, so that our implementation provides the register and the |
4 | 4 | associated qdev property. | |
5 | Nothing actually relies on target/rx/cpu.h including it, so we can | ||
6 | just drop the include. | ||
7 | 5 | ||
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
9 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 7 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
10 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 8 | Message-id: 20240206132931.38376-3-peter.maydell@linaro.org |
11 | Reviewed-by: Taylor Simpson <tsimpson@quicinc.com> | ||
12 | Reviewed-by: Yoshinori Sato <ysato@users.sourceforge.jp> | ||
13 | Message-id: 20211129200510.1233037-4-peter.maydell@linaro.org | ||
14 | --- | 9 | --- |
15 | target/rx/cpu.h | 1 - | 10 | target/arm/tcg/cpu32.c | 1 + |
16 | 1 file changed, 1 deletion(-) | 11 | 1 file changed, 1 insertion(+) |
17 | 12 | ||
18 | diff --git a/target/rx/cpu.h b/target/rx/cpu.h | 13 | diff --git a/target/arm/tcg/cpu32.c b/target/arm/tcg/cpu32.c |
19 | index XXXXXXX..XXXXXXX 100644 | 14 | index XXXXXXX..XXXXXXX 100644 |
20 | --- a/target/rx/cpu.h | 15 | --- a/target/arm/tcg/cpu32.c |
21 | +++ b/target/rx/cpu.h | 16 | +++ b/target/arm/tcg/cpu32.c |
22 | @@ -XXX,XX +XXX,XX @@ | 17 | @@ -XXX,XX +XXX,XX @@ static void cortex_r52_initfn(Object *obj) |
23 | #define RX_CPU_H | 18 | set_feature(&cpu->env, ARM_FEATURE_PMSA); |
24 | 19 | set_feature(&cpu->env, ARM_FEATURE_NEON); | |
25 | #include "qemu/bitops.h" | 20 | set_feature(&cpu->env, ARM_FEATURE_GENERIC_TIMER); |
26 | -#include "qemu-common.h" | 21 | + set_feature(&cpu->env, ARM_FEATURE_CBAR_RO); |
27 | #include "hw/registerfields.h" | 22 | cpu->midr = 0x411fd133; /* r1p3 */ |
28 | #include "cpu-qom.h" | 23 | cpu->revidr = 0x00000000; |
29 | 24 | cpu->reset_fpsid = 0x41034023; | |
30 | -- | 25 | -- |
31 | 2.25.1 | 26 | 2.34.1 |
32 | |||
33 | diff view generated by jsdifflib |
1 | The qemu-common.h header is not supposed to be included from any | 1 | Add the Cortex-R52 IMPDEF sysregs, by defining them here and |
---|---|---|---|
2 | other header files, only from .c files (as documented in a comment at | 2 | also by enabling the AUXCR feature which defines the ACTLR |
3 | the start of it). | 3 | and HACTLR registers. As is our usual practice, we make these |
4 | 4 | simple reads-as-zero stubs for now. | |
5 | Move the include to linux-user/hexagon/cpu_loop.c, which needs it for | ||
6 | the declaration of cpu_exec_step_atomic(). | ||
7 | 5 | ||
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
9 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 7 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
10 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 8 | Message-id: 20240206132931.38376-4-peter.maydell@linaro.org |
11 | Reviewed-by: Taylor Simpson <tsimpson@quicinc.com> | ||
12 | Message-id: 20211129200510.1233037-3-peter.maydell@linaro.org | ||
13 | --- | 9 | --- |
14 | target/hexagon/cpu.h | 1 - | 10 | target/arm/tcg/cpu32.c | 108 +++++++++++++++++++++++++++++++++++++++++ |
15 | linux-user/hexagon/cpu_loop.c | 1 + | 11 | 1 file changed, 108 insertions(+) |
16 | 2 files changed, 1 insertion(+), 1 deletion(-) | ||
17 | 12 | ||
18 | diff --git a/target/hexagon/cpu.h b/target/hexagon/cpu.h | 13 | diff --git a/target/arm/tcg/cpu32.c b/target/arm/tcg/cpu32.c |
19 | index XXXXXXX..XXXXXXX 100644 | 14 | index XXXXXXX..XXXXXXX 100644 |
20 | --- a/target/hexagon/cpu.h | 15 | --- a/target/arm/tcg/cpu32.c |
21 | +++ b/target/hexagon/cpu.h | 16 | +++ b/target/arm/tcg/cpu32.c |
22 | @@ -XXX,XX +XXX,XX @@ typedef struct CPUHexagonState CPUHexagonState; | 17 | @@ -XXX,XX +XXX,XX @@ static void cortex_r5_initfn(Object *obj) |
23 | 18 | define_arm_cp_regs(cpu, cortexr5_cp_reginfo); | |
24 | #include "fpu/softfloat-types.h" | 19 | } |
25 | 20 | ||
26 | -#include "qemu-common.h" | 21 | +static const ARMCPRegInfo cortex_r52_cp_reginfo[] = { |
27 | #include "exec/cpu-defs.h" | 22 | + { .name = "CPUACTLR", .cp = 15, .opc1 = 0, .crm = 15, |
28 | #include "hex_regs.h" | 23 | + .access = PL1_RW, .type = ARM_CP_CONST | ARM_CP_64BIT, .resetvalue = 0 }, |
29 | #include "mmvec/mmvec.h" | 24 | + { .name = "IMP_ATCMREGIONR", |
30 | diff --git a/linux-user/hexagon/cpu_loop.c b/linux-user/hexagon/cpu_loop.c | 25 | + .cp = 15, .opc1 = 0, .crn = 9, .crm = 1, .opc2 = 0, |
31 | index XXXXXXX..XXXXXXX 100644 | 26 | + .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, |
32 | --- a/linux-user/hexagon/cpu_loop.c | 27 | + { .name = "IMP_BTCMREGIONR", |
33 | +++ b/linux-user/hexagon/cpu_loop.c | 28 | + .cp = 15, .opc1 = 0, .crn = 9, .crm = 1, .opc2 = 1, |
34 | @@ -XXX,XX +XXX,XX @@ | 29 | + .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, |
35 | */ | 30 | + { .name = "IMP_CTCMREGIONR", |
36 | 31 | + .cp = 15, .opc1 = 0, .crn = 9, .crm = 1, .opc2 = 2, | |
37 | #include "qemu/osdep.h" | 32 | + .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, |
38 | +#include "qemu-common.h" | 33 | + { .name = "IMP_CSCTLR", |
39 | #include "qemu.h" | 34 | + .cp = 15, .opc1 = 1, .crn = 9, .crm = 1, .opc2 = 0, |
40 | #include "user-internals.h" | 35 | + .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, |
41 | #include "cpu_loop-common.h" | 36 | + { .name = "IMP_BPCTLR", |
37 | + .cp = 15, .opc1 = 1, .crn = 9, .crm = 1, .opc2 = 1, | ||
38 | + .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
39 | + { .name = "IMP_MEMPROTCLR", | ||
40 | + .cp = 15, .opc1 = 1, .crn = 9, .crm = 1, .opc2 = 2, | ||
41 | + .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
42 | + { .name = "IMP_SLAVEPCTLR", | ||
43 | + .cp = 15, .opc1 = 0, .crn = 11, .crm = 0, .opc2 = 0, | ||
44 | + .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
45 | + { .name = "IMP_PERIPHREGIONR", | ||
46 | + .cp = 15, .opc1 = 0, .crn = 15, .crm = 0, .opc2 = 0, | ||
47 | + .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
48 | + { .name = "IMP_FLASHIFREGIONR", | ||
49 | + .cp = 15, .opc1 = 0, .crn = 15, .crm = 0, .opc2 = 1, | ||
50 | + .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
51 | + { .name = "IMP_BUILDOPTR", | ||
52 | + .cp = 15, .opc1 = 0, .crn = 15, .crm = 2, .opc2 = 0, | ||
53 | + .access = PL1_R, .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
54 | + { .name = "IMP_PINOPTR", | ||
55 | + .cp = 15, .opc1 = 0, .crn = 15, .crm = 2, .opc2 = 7, | ||
56 | + .access = PL1_R, .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
57 | + { .name = "IMP_QOSR", | ||
58 | + .cp = 15, .opc1 = 1, .crn = 15, .crm = 3, .opc2 = 1, | ||
59 | + .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
60 | + { .name = "IMP_BUSTIMEOUTR", | ||
61 | + .cp = 15, .opc1 = 1, .crn = 15, .crm = 3, .opc2 = 2, | ||
62 | + .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
63 | + { .name = "IMP_INTMONR", | ||
64 | + .cp = 15, .opc1 = 1, .crn = 15, .crm = 3, .opc2 = 4, | ||
65 | + .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
66 | + { .name = "IMP_ICERR0", | ||
67 | + .cp = 15, .opc1 = 2, .crn = 15, .crm = 0, .opc2 = 0, | ||
68 | + .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
69 | + { .name = "IMP_ICERR1", | ||
70 | + .cp = 15, .opc1 = 2, .crn = 15, .crm = 0, .opc2 = 1, | ||
71 | + .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
72 | + { .name = "IMP_DCERR0", | ||
73 | + .cp = 15, .opc1 = 2, .crn = 15, .crm = 1, .opc2 = 0, | ||
74 | + .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
75 | + { .name = "IMP_DCERR1", | ||
76 | + .cp = 15, .opc1 = 2, .crn = 15, .crm = 1, .opc2 = 1, | ||
77 | + .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
78 | + { .name = "IMP_TCMERR0", | ||
79 | + .cp = 15, .opc1 = 2, .crn = 15, .crm = 2, .opc2 = 0, | ||
80 | + .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
81 | + { .name = "IMP_TCMERR1", | ||
82 | + .cp = 15, .opc1 = 2, .crn = 15, .crm = 2, .opc2 = 1, | ||
83 | + .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
84 | + { .name = "IMP_TCMSYNDR0", | ||
85 | + .cp = 15, .opc1 = 2, .crn = 15, .crm = 2, .opc2 = 2, | ||
86 | + .access = PL1_R, .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
87 | + { .name = "IMP_TCMSYNDR1", | ||
88 | + .cp = 15, .opc1 = 2, .crn = 15, .crm = 2, .opc2 = 3, | ||
89 | + .access = PL1_R, .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
90 | + { .name = "IMP_FLASHERR0", | ||
91 | + .cp = 15, .opc1 = 2, .crn = 15, .crm = 3, .opc2 = 0, | ||
92 | + .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
93 | + { .name = "IMP_FLASHERR1", | ||
94 | + .cp = 15, .opc1 = 2, .crn = 15, .crm = 3, .opc2 = 1, | ||
95 | + .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
96 | + { .name = "IMP_CDBGDR0", | ||
97 | + .cp = 15, .opc1 = 3, .crn = 15, .crm = 0, .opc2 = 0, | ||
98 | + .access = PL1_R, .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
99 | + { .name = "IMP_CBDGBR1", | ||
100 | + .cp = 15, .opc1 = 3, .crn = 15, .crm = 0, .opc2 = 1, | ||
101 | + .access = PL1_R, .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
102 | + { .name = "IMP_TESTR0", | ||
103 | + .cp = 15, .opc1 = 4, .crn = 15, .crm = 0, .opc2 = 0, | ||
104 | + .access = PL1_R, .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
105 | + { .name = "IMP_TESTR1", | ||
106 | + .cp = 15, .opc1 = 4, .crn = 15, .crm = 0, .opc2 = 1, | ||
107 | + .access = PL1_W, .type = ARM_CP_NOP, .resetvalue = 0 }, | ||
108 | + { .name = "IMP_CDBGDCI", | ||
109 | + .cp = 15, .opc1 = 0, .crn = 15, .crm = 15, .opc2 = 0, | ||
110 | + .access = PL1_W, .type = ARM_CP_NOP, .resetvalue = 0 }, | ||
111 | + { .name = "IMP_CDBGDCT", | ||
112 | + .cp = 15, .opc1 = 3, .crn = 15, .crm = 2, .opc2 = 0, | ||
113 | + .access = PL1_W, .type = ARM_CP_NOP, .resetvalue = 0 }, | ||
114 | + { .name = "IMP_CDBGICT", | ||
115 | + .cp = 15, .opc1 = 3, .crn = 15, .crm = 2, .opc2 = 1, | ||
116 | + .access = PL1_W, .type = ARM_CP_NOP, .resetvalue = 0 }, | ||
117 | + { .name = "IMP_CDBGDCD", | ||
118 | + .cp = 15, .opc1 = 3, .crn = 15, .crm = 4, .opc2 = 0, | ||
119 | + .access = PL1_W, .type = ARM_CP_NOP, .resetvalue = 0 }, | ||
120 | + { .name = "IMP_CDBGICD", | ||
121 | + .cp = 15, .opc1 = 3, .crn = 15, .crm = 4, .opc2 = 1, | ||
122 | + .access = PL1_W, .type = ARM_CP_NOP, .resetvalue = 0 }, | ||
123 | +}; | ||
124 | + | ||
125 | + | ||
126 | static void cortex_r52_initfn(Object *obj) | ||
127 | { | ||
128 | ARMCPU *cpu = ARM_CPU(obj); | ||
129 | @@ -XXX,XX +XXX,XX @@ static void cortex_r52_initfn(Object *obj) | ||
130 | set_feature(&cpu->env, ARM_FEATURE_NEON); | ||
131 | set_feature(&cpu->env, ARM_FEATURE_GENERIC_TIMER); | ||
132 | set_feature(&cpu->env, ARM_FEATURE_CBAR_RO); | ||
133 | + set_feature(&cpu->env, ARM_FEATURE_AUXCR); | ||
134 | cpu->midr = 0x411fd133; /* r1p3 */ | ||
135 | cpu->revidr = 0x00000000; | ||
136 | cpu->reset_fpsid = 0x41034023; | ||
137 | @@ -XXX,XX +XXX,XX @@ static void cortex_r52_initfn(Object *obj) | ||
138 | |||
139 | cpu->pmsav7_dregion = 16; | ||
140 | cpu->pmsav8r_hdregion = 16; | ||
141 | + | ||
142 | + define_arm_cp_regs(cpu, cortex_r52_cp_reginfo); | ||
143 | } | ||
144 | |||
145 | static void cortex_r5f_initfn(Object *obj) | ||
42 | -- | 146 | -- |
43 | 2.25.1 | 147 | 2.34.1 |
44 | |||
45 | diff view generated by jsdifflib |
1 | In the SSE decode function gen_sse(), we combine a byte | 1 | Architecturally, the AArch32 MSR/MRS to/from banked register |
---|---|---|---|
2 | 'b' and a value 'b1' which can be [0..3], and switch on them: | 2 | instructions are UNPREDICTABLE for attempts to access a banked |
3 | b |= (b1 << 8); | 3 | register that the guest could access in a more direct way (e.g. |
4 | switch (b) { | 4 | using this insn to access r8_fiq when already in FIQ mode). QEMU has |
5 | ... | 5 | chosen to UNDEF on all of these. |
6 | default: | ||
7 | unknown_op: | ||
8 | gen_unknown_opcode(env, s); | ||
9 | return; | ||
10 | } | ||
11 | 6 | ||
12 | In three cases inside this switch, we were then also checking for | 7 | However, for the case of accessing SPSR_hyp from hyp mode, it turns |
13 | "if (b1 >= 2) { goto unknown_op; }". | 8 | out that real hardware permits this, with the same effect as if the |
14 | However, this can never happen, because the 'case' values in each place | 9 | guest had directly written to SPSR. Further, there is some |
15 | are 0x0nn or 0x1nn and the switch will have directed the b1 == (2, 3) | 10 | guest code out there that assumes it can do this, because it |
16 | cases to the default already. | 11 | happens to work on hardware: an example Cortex-R52 startup code |
12 | fragment uses this, and it got copied into various other places, | ||
13 | including Zephyr. Zephyr was fixed to not use this: | ||
14 | https://github.com/zephyrproject-rtos/zephyr/issues/47330 | ||
15 | but other examples are still out there, like the selftest | ||
16 | binary for the MPS3-AN536. | ||
17 | 17 | ||
18 | This check was added in commit c045af25a52e9 in 2010; the added code | 18 | For convenience of being able to run guest code, permit |
19 | was unnecessary then as well, and was apparently intended only to | 19 | this UNPREDICTABLE access instead of UNDEFing it. |
20 | ensure that we never accidentally ended up indexing off the end | ||
21 | of an sse_op_table with only 2 entries as a result of future bugs | ||
22 | in the decode logic. | ||
23 | 20 | ||
24 | Change the checks to assert() instead, and make sure they're always | ||
25 | immediately before the array access they are protecting. | ||
26 | |||
27 | Fixes: Coverity CID 1460207 | ||
28 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 21 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
29 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 22 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
23 | Message-id: 20240206132931.38376-5-peter.maydell@linaro.org | ||
30 | --- | 24 | --- |
31 | target/i386/tcg/translate.c | 12 +++--------- | 25 | target/arm/tcg/op_helper.c | 43 ++++++++++++++++++++++++++------------ |
32 | 1 file changed, 3 insertions(+), 9 deletions(-) | 26 | target/arm/tcg/translate.c | 19 +++++++++++------ |
27 | 2 files changed, 43 insertions(+), 19 deletions(-) | ||
33 | 28 | ||
34 | diff --git a/target/i386/tcg/translate.c b/target/i386/tcg/translate.c | 29 | diff --git a/target/arm/tcg/op_helper.c b/target/arm/tcg/op_helper.c |
35 | index XXXXXXX..XXXXXXX 100644 | 30 | index XXXXXXX..XXXXXXX 100644 |
36 | --- a/target/i386/tcg/translate.c | 31 | --- a/target/arm/tcg/op_helper.c |
37 | +++ b/target/i386/tcg/translate.c | 32 | +++ b/target/arm/tcg/op_helper.c |
38 | @@ -XXX,XX +XXX,XX @@ static void gen_sse(CPUX86State *env, DisasContext *s, int b, | 33 | @@ -XXX,XX +XXX,XX @@ static void msr_mrs_banked_exc_checks(CPUARMState *env, uint32_t tgtmode, |
39 | case 0x171: /* shift xmm, im */ | 34 | */ |
40 | case 0x172: | 35 | int curmode = env->uncached_cpsr & CPSR_M; |
41 | case 0x173: | 36 | |
42 | - if (b1 >= 2) { | 37 | - if (regno == 17) { |
43 | - goto unknown_op; | 38 | - /* ELR_Hyp: a special case because access from tgtmode is OK */ |
44 | - } | 39 | - if (curmode != ARM_CPU_MODE_HYP && curmode != ARM_CPU_MODE_MON) { |
45 | val = x86_ldub_code(env, s); | 40 | - goto undef; |
46 | if (is_xmm) { | 41 | + if (tgtmode == ARM_CPU_MODE_HYP) { |
47 | tcg_gen_movi_tl(s->T0, val); | 42 | + /* |
48 | @@ -XXX,XX +XXX,XX @@ static void gen_sse(CPUX86State *env, DisasContext *s, int b, | 43 | + * Handle Hyp target regs first because some are special cases |
49 | offsetof(CPUX86State, mmx_t0.MMX_L(1))); | 44 | + * which don't want the usual "not accessible from tgtmode" check. |
50 | op1_offset = offsetof(CPUX86State,mmx_t0); | 45 | + */ |
51 | } | 46 | + switch (regno) { |
52 | + assert(b1 < 2); | 47 | + case 16 ... 17: /* ELR_Hyp, SPSR_Hyp */ |
53 | sse_fn_epp = sse_op_table2[((b - 1) & 3) * 8 + | 48 | + if (curmode != ARM_CPU_MODE_HYP && curmode != ARM_CPU_MODE_MON) { |
54 | (((modrm >> 3)) & 7)][b1]; | 49 | + goto undef; |
55 | if (!sse_fn_epp) { | 50 | + } |
56 | @@ -XXX,XX +XXX,XX @@ static void gen_sse(CPUX86State *env, DisasContext *s, int b, | 51 | + break; |
57 | rm = modrm & 7; | 52 | + case 13: |
58 | reg = ((modrm >> 3) & 7) | REX_R(s); | 53 | + if (curmode != ARM_CPU_MODE_MON) { |
59 | mod = (modrm >> 6) & 3; | 54 | + goto undef; |
60 | - if (b1 >= 2) { | 55 | + } |
61 | - goto unknown_op; | 56 | + break; |
62 | - } | 57 | + default: |
63 | 58 | + g_assert_not_reached(); | |
64 | + assert(b1 < 2); | 59 | } |
65 | sse_fn_epp = sse_op_table6[b].op[b1]; | 60 | return; |
66 | if (!sse_fn_epp) { | 61 | } |
67 | goto unknown_op; | 62 | @@ -XXX,XX +XXX,XX @@ static void msr_mrs_banked_exc_checks(CPUARMState *env, uint32_t tgtmode, |
68 | @@ -XXX,XX +XXX,XX @@ static void gen_sse(CPUX86State *env, DisasContext *s, int b, | 63 | } |
69 | rm = modrm & 7; | 64 | } |
70 | reg = ((modrm >> 3) & 7) | REX_R(s); | 65 | |
71 | mod = (modrm >> 6) & 3; | 66 | - if (tgtmode == ARM_CPU_MODE_HYP) { |
72 | - if (b1 >= 2) { | 67 | - /* SPSR_Hyp, r13_hyp: accessible from Monitor mode only */ |
73 | - goto unknown_op; | 68 | - if (curmode != ARM_CPU_MODE_MON) { |
74 | - } | 69 | - goto undef; |
75 | 70 | - } | |
76 | + assert(b1 < 2); | 71 | - } |
77 | sse_fn_eppi = sse_op_table7[b].op[b1]; | 72 | - |
78 | if (!sse_fn_eppi) { | 73 | return; |
79 | goto unknown_op; | 74 | |
75 | undef: | ||
76 | @@ -XXX,XX +XXX,XX @@ void HELPER(msr_banked)(CPUARMState *env, uint32_t value, uint32_t tgtmode, | ||
77 | |||
78 | switch (regno) { | ||
79 | case 16: /* SPSRs */ | ||
80 | - env->banked_spsr[bank_number(tgtmode)] = value; | ||
81 | + if (tgtmode == (env->uncached_cpsr & CPSR_M)) { | ||
82 | + /* Only happens for SPSR_Hyp access in Hyp mode */ | ||
83 | + env->spsr = value; | ||
84 | + } else { | ||
85 | + env->banked_spsr[bank_number(tgtmode)] = value; | ||
86 | + } | ||
87 | break; | ||
88 | case 17: /* ELR_Hyp */ | ||
89 | env->elr_el[2] = value; | ||
90 | @@ -XXX,XX +XXX,XX @@ uint32_t HELPER(mrs_banked)(CPUARMState *env, uint32_t tgtmode, uint32_t regno) | ||
91 | |||
92 | switch (regno) { | ||
93 | case 16: /* SPSRs */ | ||
94 | - return env->banked_spsr[bank_number(tgtmode)]; | ||
95 | + if (tgtmode == (env->uncached_cpsr & CPSR_M)) { | ||
96 | + /* Only happens for SPSR_Hyp access in Hyp mode */ | ||
97 | + return env->spsr; | ||
98 | + } else { | ||
99 | + return env->banked_spsr[bank_number(tgtmode)]; | ||
100 | + } | ||
101 | case 17: /* ELR_Hyp */ | ||
102 | return env->elr_el[2]; | ||
103 | case 13: | ||
104 | diff --git a/target/arm/tcg/translate.c b/target/arm/tcg/translate.c | ||
105 | index XXXXXXX..XXXXXXX 100644 | ||
106 | --- a/target/arm/tcg/translate.c | ||
107 | +++ b/target/arm/tcg/translate.c | ||
108 | @@ -XXX,XX +XXX,XX @@ static bool msr_banked_access_decode(DisasContext *s, int r, int sysm, int rn, | ||
109 | break; | ||
110 | case ARM_CPU_MODE_HYP: | ||
111 | /* | ||
112 | - * SPSR_hyp and r13_hyp can only be accessed from Monitor mode | ||
113 | - * (and so we can forbid accesses from EL2 or below). elr_hyp | ||
114 | - * can be accessed also from Hyp mode, so forbid accesses from | ||
115 | - * EL0 or EL1. | ||
116 | + * r13_hyp can only be accessed from Monitor mode, and so we | ||
117 | + * can forbid accesses from EL2 or below. | ||
118 | + * elr_hyp can be accessed also from Hyp mode, so forbid | ||
119 | + * accesses from EL0 or EL1. | ||
120 | + * SPSR_hyp is supposed to be in the same category as r13_hyp | ||
121 | + * and UNPREDICTABLE if accessed from anything except Monitor | ||
122 | + * mode. However there is some real-world code that will do | ||
123 | + * it because at least some hardware happens to permit the | ||
124 | + * access. (Notably a standard Cortex-R52 startup code fragment | ||
125 | + * does this.) So we permit SPSR_hyp from Hyp mode also, to allow | ||
126 | + * this (incorrect) guest code to run. | ||
127 | */ | ||
128 | - if (!arm_dc_feature(s, ARM_FEATURE_EL2) || s->current_el < 2 || | ||
129 | - (s->current_el < 3 && *regno != 17)) { | ||
130 | + if (!arm_dc_feature(s, ARM_FEATURE_EL2) || s->current_el < 2 | ||
131 | + || (s->current_el < 3 && *regno != 16 && *regno != 17)) { | ||
132 | goto undef; | ||
133 | } | ||
134 | break; | ||
80 | -- | 135 | -- |
81 | 2.25.1 | 136 | 2.34.1 |
82 | |||
83 | diff view generated by jsdifflib |
1 | From: Joel Stanley <joel@jms.id.au> | 1 | We currently guard the CFG3 register read with |
---|---|---|---|
2 | (scc_partno(s) == 0x524 && scc_partno(s) == 0x547) | ||
3 | which is clearly wrong as it is never true. | ||
2 | 4 | ||
3 | Move it to the supported list. | 5 | This register is present on all board types except AN524 |
6 | and AN527; correct the condition. | ||
4 | 7 | ||
5 | Signed-off-by: Joel Stanley <joel@jms.id.au> | 8 | Fixes: 6ac80818941829c0 ("hw/misc/mps2-scc: Implement changes for AN547") |
6 | Message-id: 20211117065752.330632-5-joel@jms.id.au | ||
7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
10 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
11 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
12 | Message-id: 20240206132931.38376-6-peter.maydell@linaro.org | ||
8 | --- | 13 | --- |
9 | docs/system/arm/aspeed.rst | 2 +- | 14 | hw/misc/mps2-scc.c | 2 +- |
10 | 1 file changed, 1 insertion(+), 1 deletion(-) | 15 | 1 file changed, 1 insertion(+), 1 deletion(-) |
11 | 16 | ||
12 | diff --git a/docs/system/arm/aspeed.rst b/docs/system/arm/aspeed.rst | 17 | diff --git a/hw/misc/mps2-scc.c b/hw/misc/mps2-scc.c |
13 | index XXXXXXX..XXXXXXX 100644 | 18 | index XXXXXXX..XXXXXXX 100644 |
14 | --- a/docs/system/arm/aspeed.rst | 19 | --- a/hw/misc/mps2-scc.c |
15 | +++ b/docs/system/arm/aspeed.rst | 20 | +++ b/hw/misc/mps2-scc.c |
16 | @@ -XXX,XX +XXX,XX @@ Supported devices | 21 | @@ -XXX,XX +XXX,XX @@ static uint64_t mps2_scc_read(void *opaque, hwaddr offset, unsigned size) |
17 | * Front LEDs (PCA9552 on I2C bus) | 22 | r = s->cfg2; |
18 | * LPC Peripheral Controller (a subset of subdevices are supported) | 23 | break; |
19 | * Hash/Crypto Engine (HACE) - Hash support only. TODO: HMAC and RSA | 24 | case A_CFG3: |
20 | + * ADC | 25 | - if (scc_partno(s) == 0x524 && scc_partno(s) == 0x547) { |
21 | 26 | + if (scc_partno(s) == 0x524 || scc_partno(s) == 0x547) { | |
22 | 27 | /* CFG3 reserved on AN524 */ | |
23 | Missing devices | 28 | goto bad_offset; |
24 | --------------- | 29 | } |
25 | |||
26 | * Coprocessor support | ||
27 | - * ADC (out of tree implementation) | ||
28 | * PWM and Fan Controller | ||
29 | * Slave GPIO Controller | ||
30 | * Super I/O Controller | ||
31 | -- | 30 | -- |
32 | 2.25.1 | 31 | 2.34.1 |
33 | 32 | ||
34 | 33 | diff view generated by jsdifflib |
1 | From: Patrick Venture <venture@google.com> | 1 | The MPS SCC device has a lot of different flavours for the various |
---|---|---|---|
2 | different MPS FPGA images, which look mostly similar but have | ||
3 | differences in how particular registers are handled. Currently we | ||
4 | deal with this with a lot of open-coded checks on scc_partno(), but | ||
5 | as we add more board types this is getting a bit hard to read. | ||
2 | 6 | ||
3 | The rx_active boolean change to true should always trigger a try_read | 7 | Factor out the conditions into some functions which we can |
4 | call that flushes the queue. | 8 | give more descriptive names to. |
5 | 9 | ||
6 | Signed-off-by: Patrick Venture <venture@google.com> | ||
7 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
8 | Message-id: 20211203221002.1719306-1-venture@google.com | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
11 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
12 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
13 | Message-id: 20240206132931.38376-7-peter.maydell@linaro.org | ||
10 | --- | 14 | --- |
11 | hw/net/npcm7xx_emc.c | 18 ++++++++---------- | 15 | hw/misc/mps2-scc.c | 45 +++++++++++++++++++++++++++++++-------------- |
12 | 1 file changed, 8 insertions(+), 10 deletions(-) | 16 | 1 file changed, 31 insertions(+), 14 deletions(-) |
13 | 17 | ||
14 | diff --git a/hw/net/npcm7xx_emc.c b/hw/net/npcm7xx_emc.c | 18 | diff --git a/hw/misc/mps2-scc.c b/hw/misc/mps2-scc.c |
15 | index XXXXXXX..XXXXXXX 100644 | 19 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/hw/net/npcm7xx_emc.c | 20 | --- a/hw/misc/mps2-scc.c |
17 | +++ b/hw/net/npcm7xx_emc.c | 21 | +++ b/hw/misc/mps2-scc.c |
18 | @@ -XXX,XX +XXX,XX @@ static void emc_halt_rx(NPCM7xxEMCState *emc, uint32_t mista_flag) | 22 | @@ -XXX,XX +XXX,XX @@ static int scc_partno(MPS2SCC *s) |
19 | emc_set_mista(emc, mista_flag); | 23 | return extract32(s->id, 4, 8); |
20 | } | 24 | } |
21 | 25 | ||
22 | +static void emc_enable_rx_and_flush(NPCM7xxEMCState *emc) | 26 | +/* Is CFG_REG2 present? */ |
27 | +static bool have_cfg2(MPS2SCC *s) | ||
23 | +{ | 28 | +{ |
24 | + emc->rx_active = true; | 29 | + return scc_partno(s) == 0x524 || scc_partno(s) == 0x547; |
25 | + qemu_flush_queued_packets(qemu_get_queue(emc->nic)); | ||
26 | +} | 30 | +} |
27 | + | 31 | + |
28 | static void emc_set_next_tx_descriptor(NPCM7xxEMCState *emc, | 32 | +/* Is CFG_REG3 present? */ |
29 | const NPCM7xxEMCTxDesc *tx_desc, | 33 | +static bool have_cfg3(MPS2SCC *s) |
30 | uint32_t desc_addr) | 34 | +{ |
31 | @@ -XXX,XX +XXX,XX @@ static ssize_t emc_receive(NetClientState *nc, const uint8_t *buf, size_t len1) | 35 | + return scc_partno(s) != 0x524 && scc_partno(s) != 0x547; |
32 | return len; | 36 | +} |
33 | } | 37 | + |
34 | 38 | +/* Is CFG_REG5 present? */ | |
35 | -static void emc_try_receive_next_packet(NPCM7xxEMCState *emc) | 39 | +static bool have_cfg5(MPS2SCC *s) |
36 | -{ | 40 | +{ |
37 | - if (emc_can_receive(qemu_get_queue(emc->nic))) { | 41 | + return scc_partno(s) == 0x524 || scc_partno(s) == 0x547; |
38 | - qemu_flush_queued_packets(qemu_get_queue(emc->nic)); | 42 | +} |
39 | - } | 43 | + |
40 | -} | 44 | +/* Is CFG_REG6 present? */ |
41 | - | 45 | +static bool have_cfg6(MPS2SCC *s) |
42 | static uint64_t npcm7xx_emc_read(void *opaque, hwaddr offset, unsigned size) | 46 | +{ |
43 | { | 47 | + return scc_partno(s) == 0x524; |
44 | NPCM7xxEMCState *emc = opaque; | 48 | +} |
45 | @@ -XXX,XX +XXX,XX @@ static void npcm7xx_emc_write(void *opaque, hwaddr offset, | 49 | + |
46 | emc->regs[REG_MGSTA] |= REG_MGSTA_RXHA; | 50 | /* Handle a write via the SYS_CFG channel to the specified function/device. |
51 | * Return false on error (reported to guest via SYS_CFGCTRL ERROR bit). | ||
52 | */ | ||
53 | @@ -XXX,XX +XXX,XX @@ static uint64_t mps2_scc_read(void *opaque, hwaddr offset, unsigned size) | ||
54 | r = s->cfg1; | ||
55 | break; | ||
56 | case A_CFG2: | ||
57 | - if (scc_partno(s) != 0x524 && scc_partno(s) != 0x547) { | ||
58 | - /* CFG2 reserved on other boards */ | ||
59 | + if (!have_cfg2(s)) { | ||
60 | goto bad_offset; | ||
47 | } | 61 | } |
48 | if (value & REG_MCMDR_RXON) { | 62 | r = s->cfg2; |
49 | - emc->rx_active = true; | 63 | break; |
50 | + emc_enable_rx_and_flush(emc); | 64 | case A_CFG3: |
51 | } else { | 65 | - if (scc_partno(s) == 0x524 || scc_partno(s) == 0x547) { |
52 | emc_halt_rx(emc, 0); | 66 | - /* CFG3 reserved on AN524 */ |
67 | + if (!have_cfg3(s)) { | ||
68 | goto bad_offset; | ||
53 | } | 69 | } |
54 | @@ -XXX,XX +XXX,XX @@ static void npcm7xx_emc_write(void *opaque, hwaddr offset, | 70 | /* These are user-settable DIP switches on the board. We don't |
71 | @@ -XXX,XX +XXX,XX @@ static uint64_t mps2_scc_read(void *opaque, hwaddr offset, unsigned size) | ||
72 | r = s->cfg4; | ||
55 | break; | 73 | break; |
56 | case REG_RSDR: | 74 | case A_CFG5: |
57 | if (emc->regs[REG_MCMDR] & REG_MCMDR_RXON) { | 75 | - if (scc_partno(s) != 0x524 && scc_partno(s) != 0x547) { |
58 | - emc->rx_active = true; | 76 | - /* CFG5 reserved on other boards */ |
59 | - emc_try_receive_next_packet(emc); | 77 | + if (!have_cfg5(s)) { |
60 | + emc_enable_rx_and_flush(emc); | 78 | goto bad_offset; |
79 | } | ||
80 | r = s->cfg5; | ||
81 | break; | ||
82 | case A_CFG6: | ||
83 | - if (scc_partno(s) != 0x524) { | ||
84 | - /* CFG6 reserved on other boards */ | ||
85 | + if (!have_cfg6(s)) { | ||
86 | goto bad_offset; | ||
87 | } | ||
88 | r = s->cfg6; | ||
89 | @@ -XXX,XX +XXX,XX @@ static void mps2_scc_write(void *opaque, hwaddr offset, uint64_t value, | ||
61 | } | 90 | } |
62 | break; | 91 | break; |
63 | case REG_MIIDA: | 92 | case A_CFG2: |
93 | - if (scc_partno(s) != 0x524 && scc_partno(s) != 0x547) { | ||
94 | - /* CFG2 reserved on other boards */ | ||
95 | + if (!have_cfg2(s)) { | ||
96 | goto bad_offset; | ||
97 | } | ||
98 | /* AN524: QSPI Select signal */ | ||
99 | s->cfg2 = value; | ||
100 | break; | ||
101 | case A_CFG5: | ||
102 | - if (scc_partno(s) != 0x524 && scc_partno(s) != 0x547) { | ||
103 | - /* CFG5 reserved on other boards */ | ||
104 | + if (!have_cfg5(s)) { | ||
105 | goto bad_offset; | ||
106 | } | ||
107 | /* AN524: ACLK frequency in Hz */ | ||
108 | s->cfg5 = value; | ||
109 | break; | ||
110 | case A_CFG6: | ||
111 | - if (scc_partno(s) != 0x524) { | ||
112 | - /* CFG6 reserved on other boards */ | ||
113 | + if (!have_cfg6(s)) { | ||
114 | goto bad_offset; | ||
115 | } | ||
116 | /* AN524: Clock divider for BRAM */ | ||
64 | -- | 117 | -- |
65 | 2.25.1 | 118 | 2.34.1 |
66 | 119 | ||
67 | 120 | diff view generated by jsdifflib |
1 | The qemu-common.h header is not supposed to be included from any | 1 | The MPS2 SCC device is broadly the same for all FPGA images, but has |
---|---|---|---|
2 | other header files, only from .c files (as documented in a comment at | 2 | minor differences in the behaviour of the CFG registers depending on |
3 | the start of it). | 3 | the image. In many cases we don't really care about the functionality |
4 | 4 | controlled by these registers and a reads-as-written or similar | |
5 | include/hw/i386/x86.h and include/hw/i386/microvm.h break this rule. | 5 | behaviour is sufficient for the moment. |
6 | In fact, the include is not required at all, so we can just drop it | 6 | |
7 | from both files. | 7 | For the AN536 the required behaviour is: |
8 | |||
9 | * A_CFG0 has CPU reset and halt bits | ||
10 | - implement as reads-as-written for the moment | ||
11 | * A_CFG1 has flash or ATCM address 0 remap handling | ||
12 | - QEMU doesn't model this; implement as reads-as-written | ||
13 | * A_CFG2 has QSPI select (like AN524) | ||
14 | - implemented (no behaviour, as with AN524) | ||
15 | * A_CFG3 is MCC_MSB_ADDR "additional MCC addressing bits" | ||
16 | - QEMU doesn't care about these, so use the existing | ||
17 | RAZ behaviour for convenience | ||
18 | * A_CFG4 is board rev (like all other images) | ||
19 | - no change needed | ||
20 | * A_CFG5 is ACLK frq in hz (like AN524) | ||
21 | - implemented as reads-as-written, as for other boards | ||
22 | * A_CFG6 is core 0 vector table base address | ||
23 | - implemented as reads-as-written for the moment | ||
24 | * A_CFG7 is core 1 vector table base address | ||
25 | - implemented as reads-as-written for the moment | ||
26 | |||
27 | Make the changes necessary for this; leave TODO comments where | ||
28 | appropriate to indicate where we might want to come back and | ||
29 | implement things like CPU reset. | ||
30 | |||
31 | The other aspects of the device specific to this FPGA image (like the | ||
32 | values of the board ID and similar registers) will be set via the | ||
33 | device's qdev properties. | ||
8 | 34 | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 35 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
10 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 36 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
11 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 37 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
12 | Message-id: 20211129200510.1233037-2-peter.maydell@linaro.org | 38 | Message-id: 20240206132931.38376-8-peter.maydell@linaro.org |
13 | --- | 39 | --- |
14 | include/hw/i386/microvm.h | 1 - | 40 | include/hw/misc/mps2-scc.h | 1 + |
15 | include/hw/i386/x86.h | 1 - | 41 | hw/misc/mps2-scc.c | 101 +++++++++++++++++++++++++++++++++---- |
16 | 2 files changed, 2 deletions(-) | 42 | 2 files changed, 92 insertions(+), 10 deletions(-) |
17 | 43 | ||
18 | diff --git a/include/hw/i386/microvm.h b/include/hw/i386/microvm.h | 44 | diff --git a/include/hw/misc/mps2-scc.h b/include/hw/misc/mps2-scc.h |
19 | index XXXXXXX..XXXXXXX 100644 | 45 | index XXXXXXX..XXXXXXX 100644 |
20 | --- a/include/hw/i386/microvm.h | 46 | --- a/include/hw/misc/mps2-scc.h |
21 | +++ b/include/hw/i386/microvm.h | 47 | +++ b/include/hw/misc/mps2-scc.h |
22 | @@ -XXX,XX +XXX,XX @@ | 48 | @@ -XXX,XX +XXX,XX @@ struct MPS2SCC { |
23 | #ifndef HW_I386_MICROVM_H | 49 | uint32_t cfg4; |
24 | #define HW_I386_MICROVM_H | 50 | uint32_t cfg5; |
25 | 51 | uint32_t cfg6; | |
26 | -#include "qemu-common.h" | 52 | + uint32_t cfg7; |
27 | #include "exec/hwaddr.h" | 53 | uint32_t cfgdata_rtn; |
28 | #include "qemu/notify.h" | 54 | uint32_t cfgdata_out; |
29 | 55 | uint32_t cfgctrl; | |
30 | diff --git a/include/hw/i386/x86.h b/include/hw/i386/x86.h | 56 | diff --git a/hw/misc/mps2-scc.c b/hw/misc/mps2-scc.c |
31 | index XXXXXXX..XXXXXXX 100644 | 57 | index XXXXXXX..XXXXXXX 100644 |
32 | --- a/include/hw/i386/x86.h | 58 | --- a/hw/misc/mps2-scc.c |
33 | +++ b/include/hw/i386/x86.h | 59 | +++ b/hw/misc/mps2-scc.c |
34 | @@ -XXX,XX +XXX,XX @@ | 60 | @@ -XXX,XX +XXX,XX @@ REG32(CFG3, 0xc) |
35 | #ifndef HW_I386_X86_H | 61 | REG32(CFG4, 0x10) |
36 | #define HW_I386_X86_H | 62 | REG32(CFG5, 0x14) |
37 | 63 | REG32(CFG6, 0x18) | |
38 | -#include "qemu-common.h" | 64 | +REG32(CFG7, 0x1c) |
39 | #include "exec/hwaddr.h" | 65 | REG32(CFGDATA_RTN, 0xa0) |
40 | #include "qemu/notify.h" | 66 | REG32(CFGDATA_OUT, 0xa4) |
67 | REG32(CFGCTRL, 0xa8) | ||
68 | @@ -XXX,XX +XXX,XX @@ static int scc_partno(MPS2SCC *s) | ||
69 | /* Is CFG_REG2 present? */ | ||
70 | static bool have_cfg2(MPS2SCC *s) | ||
71 | { | ||
72 | - return scc_partno(s) == 0x524 || scc_partno(s) == 0x547; | ||
73 | + return scc_partno(s) == 0x524 || scc_partno(s) == 0x547 || | ||
74 | + scc_partno(s) == 0x536; | ||
75 | } | ||
76 | |||
77 | /* Is CFG_REG3 present? */ | ||
78 | static bool have_cfg3(MPS2SCC *s) | ||
79 | { | ||
80 | - return scc_partno(s) != 0x524 && scc_partno(s) != 0x547; | ||
81 | + return scc_partno(s) != 0x524 && scc_partno(s) != 0x547 && | ||
82 | + scc_partno(s) != 0x536; | ||
83 | } | ||
84 | |||
85 | /* Is CFG_REG5 present? */ | ||
86 | static bool have_cfg5(MPS2SCC *s) | ||
87 | { | ||
88 | - return scc_partno(s) == 0x524 || scc_partno(s) == 0x547; | ||
89 | + return scc_partno(s) == 0x524 || scc_partno(s) == 0x547 || | ||
90 | + scc_partno(s) == 0x536; | ||
91 | } | ||
92 | |||
93 | /* Is CFG_REG6 present? */ | ||
94 | static bool have_cfg6(MPS2SCC *s) | ||
95 | { | ||
96 | - return scc_partno(s) == 0x524; | ||
97 | + return scc_partno(s) == 0x524 || scc_partno(s) == 0x536; | ||
98 | +} | ||
99 | + | ||
100 | +/* Is CFG_REG7 present? */ | ||
101 | +static bool have_cfg7(MPS2SCC *s) | ||
102 | +{ | ||
103 | + return scc_partno(s) == 0x536; | ||
104 | +} | ||
105 | + | ||
106 | +/* Does CFG_REG0 drive the 'remap' GPIO output? */ | ||
107 | +static bool cfg0_is_remap(MPS2SCC *s) | ||
108 | +{ | ||
109 | + return scc_partno(s) != 0x536; | ||
110 | +} | ||
111 | + | ||
112 | +/* Is CFG_REG1 driving a set of LEDs? */ | ||
113 | +static bool cfg1_is_leds(MPS2SCC *s) | ||
114 | +{ | ||
115 | + return scc_partno(s) != 0x536; | ||
116 | } | ||
117 | |||
118 | /* Handle a write via the SYS_CFG channel to the specified function/device. | ||
119 | @@ -XXX,XX +XXX,XX @@ static uint64_t mps2_scc_read(void *opaque, hwaddr offset, unsigned size) | ||
120 | if (!have_cfg3(s)) { | ||
121 | goto bad_offset; | ||
122 | } | ||
123 | - /* These are user-settable DIP switches on the board. We don't | ||
124 | + /* | ||
125 | + * These are user-settable DIP switches on the board. We don't | ||
126 | * model that, so just return zeroes. | ||
127 | + * | ||
128 | + * TODO: for AN536 this is MCC_MSB_ADDR "additional MCC addressing | ||
129 | + * bits". These change which part of the DDR4 the motherboard | ||
130 | + * configuration controller can see in its memory map (see the | ||
131 | + * appnote section 2.4). QEMU doesn't model the MCC at all, so these | ||
132 | + * bits are not interesting to us; read-as-zero is as good as anything | ||
133 | + * else. | ||
134 | */ | ||
135 | r = 0; | ||
136 | break; | ||
137 | @@ -XXX,XX +XXX,XX @@ static uint64_t mps2_scc_read(void *opaque, hwaddr offset, unsigned size) | ||
138 | } | ||
139 | r = s->cfg6; | ||
140 | break; | ||
141 | + case A_CFG7: | ||
142 | + if (!have_cfg7(s)) { | ||
143 | + goto bad_offset; | ||
144 | + } | ||
145 | + r = s->cfg7; | ||
146 | + break; | ||
147 | case A_CFGDATA_RTN: | ||
148 | r = s->cfgdata_rtn; | ||
149 | break; | ||
150 | @@ -XXX,XX +XXX,XX @@ static void mps2_scc_write(void *opaque, hwaddr offset, uint64_t value, | ||
151 | * we always reflect bit 0 in the 'remap' GPIO output line, | ||
152 | * and let the board wire it up or not as it chooses. | ||
153 | * TODO on some boards bit 1 is CPU_WAIT. | ||
154 | + * | ||
155 | + * TODO: on the AN536 this register controls reset and halt | ||
156 | + * for both CPUs. For the moment we don't implement this, so the | ||
157 | + * register just reads as written. | ||
158 | */ | ||
159 | s->cfg0 = value; | ||
160 | - qemu_set_irq(s->remap, s->cfg0 & 1); | ||
161 | + if (cfg0_is_remap(s)) { | ||
162 | + qemu_set_irq(s->remap, s->cfg0 & 1); | ||
163 | + } | ||
164 | break; | ||
165 | case A_CFG1: | ||
166 | s->cfg1 = value; | ||
167 | - for (size_t i = 0; i < ARRAY_SIZE(s->led); i++) { | ||
168 | - led_set_state(s->led[i], extract32(value, i, 1)); | ||
169 | + /* | ||
170 | + * On most boards this register drives LEDs. | ||
171 | + * | ||
172 | + * TODO: for AN536 this controls whether flash and ATCM are | ||
173 | + * enabled or disabled on reset. QEMU doesn't model this, and | ||
174 | + * always wires up RAM in the ATCM area and ROM in the flash area. | ||
175 | + */ | ||
176 | + if (cfg1_is_leds(s)) { | ||
177 | + for (size_t i = 0; i < ARRAY_SIZE(s->led); i++) { | ||
178 | + led_set_state(s->led[i], extract32(value, i, 1)); | ||
179 | + } | ||
180 | } | ||
181 | break; | ||
182 | case A_CFG2: | ||
183 | if (!have_cfg2(s)) { | ||
184 | goto bad_offset; | ||
185 | } | ||
186 | - /* AN524: QSPI Select signal */ | ||
187 | + /* AN524, AN536: QSPI Select signal */ | ||
188 | s->cfg2 = value; | ||
189 | break; | ||
190 | case A_CFG5: | ||
191 | if (!have_cfg5(s)) { | ||
192 | goto bad_offset; | ||
193 | } | ||
194 | - /* AN524: ACLK frequency in Hz */ | ||
195 | + /* AN524, AN536: ACLK frequency in Hz */ | ||
196 | s->cfg5 = value; | ||
197 | break; | ||
198 | case A_CFG6: | ||
199 | @@ -XXX,XX +XXX,XX @@ static void mps2_scc_write(void *opaque, hwaddr offset, uint64_t value, | ||
200 | goto bad_offset; | ||
201 | } | ||
202 | /* AN524: Clock divider for BRAM */ | ||
203 | + /* AN536: Core 0 vector table base address */ | ||
204 | + s->cfg6 = value; | ||
205 | + break; | ||
206 | + case A_CFG7: | ||
207 | + if (!have_cfg7(s)) { | ||
208 | + goto bad_offset; | ||
209 | + } | ||
210 | + /* AN536: Core 1 vector table base address */ | ||
211 | s->cfg6 = value; | ||
212 | break; | ||
213 | case A_CFGDATA_OUT: | ||
214 | @@ -XXX,XX +XXX,XX @@ static void mps2_scc_finalize(Object *obj) | ||
215 | g_free(s->oscclk_reset); | ||
216 | } | ||
217 | |||
218 | +static bool cfg7_needed(void *opaque) | ||
219 | +{ | ||
220 | + MPS2SCC *s = opaque; | ||
221 | + | ||
222 | + return have_cfg7(s); | ||
223 | +} | ||
224 | + | ||
225 | +static const VMStateDescription vmstate_cfg7 = { | ||
226 | + .name = "mps2-scc/cfg7", | ||
227 | + .version_id = 1, | ||
228 | + .minimum_version_id = 1, | ||
229 | + .needed = cfg7_needed, | ||
230 | + .fields = (const VMStateField[]) { | ||
231 | + VMSTATE_UINT32(cfg7, MPS2SCC), | ||
232 | + VMSTATE_END_OF_LIST() | ||
233 | + } | ||
234 | +}; | ||
235 | + | ||
236 | static const VMStateDescription mps2_scc_vmstate = { | ||
237 | .name = "mps2-scc", | ||
238 | .version_id = 3, | ||
239 | @@ -XXX,XX +XXX,XX @@ static const VMStateDescription mps2_scc_vmstate = { | ||
240 | VMSTATE_VARRAY_UINT32(oscclk, MPS2SCC, num_oscclk, | ||
241 | 0, vmstate_info_uint32, uint32_t), | ||
242 | VMSTATE_END_OF_LIST() | ||
243 | + }, | ||
244 | + .subsections = (const VMStateDescription * const []) { | ||
245 | + &vmstate_cfg7, | ||
246 | + NULL | ||
247 | } | ||
248 | }; | ||
41 | 249 | ||
42 | -- | 250 | -- |
43 | 2.25.1 | 251 | 2.34.1 |
44 | 252 | ||
45 | 253 | diff view generated by jsdifflib |
1 | From: Philippe Mathieu-Daudé <philmd@redhat.com> | 1 | The AN536 is another FPGA image for the MPS3 development board. Unlike |
---|---|---|---|
2 | 2 | the existing FPGA images we already model, this board uses a Cortex-R | |
3 | gicv3_set_gicv3state() is used by arm_gicv3_common.c in | 3 | family CPU, and it does not use any equivalent to the M-profile |
4 | arm_gicv3_common_realize(). Since we want to restrict | 4 | "Subsystem for Embedded" SoC-equivalent that we model in hw/arm/armsse.c. |
5 | arm_gicv3_cpuif.c to TCG, extract gicv3_set_gicv3state() | 5 | It's therefore more convenient for us to model it as a completely |
6 | to a new file. Add this file to the meson 'specific' | 6 | separate C file. |
7 | source set, since it needs access to "cpu.h". | 7 | |
8 | 8 | This commit adds the basic skeleton of the board model, and the | |
9 | Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> | 9 | code to create all the RAM and ROM. We assume that we're probably |
10 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 10 | going to want to add more images in future, so use the same |
11 | Message-id: 20211115223619.2599282-2-philmd@redhat.com | 11 | base class/subclass setup that mps2-tz.c uses, even though at |
12 | the moment there's only a single subclass. | ||
13 | |||
14 | Following commits will add the CPUs and the peripherals. | ||
15 | |||
12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 16 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
17 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
18 | Message-id: 20240206132931.38376-9-peter.maydell@linaro.org | ||
13 | --- | 19 | --- |
14 | hw/intc/arm_gicv3_cpuif.c | 10 +--------- | 20 | MAINTAINERS | 3 +- |
15 | hw/intc/arm_gicv3_cpuif_common.c | 22 ++++++++++++++++++++++ | 21 | configs/devices/arm-softmmu/default.mak | 1 + |
16 | hw/intc/meson.build | 1 + | 22 | hw/arm/mps3r.c | 239 ++++++++++++++++++++++++ |
17 | 3 files changed, 24 insertions(+), 9 deletions(-) | 23 | hw/arm/Kconfig | 5 + |
18 | create mode 100644 hw/intc/arm_gicv3_cpuif_common.c | 24 | hw/arm/meson.build | 1 + |
19 | 25 | 5 files changed, 248 insertions(+), 1 deletion(-) | |
20 | diff --git a/hw/intc/arm_gicv3_cpuif.c b/hw/intc/arm_gicv3_cpuif.c | 26 | create mode 100644 hw/arm/mps3r.c |
27 | |||
28 | diff --git a/MAINTAINERS b/MAINTAINERS | ||
21 | index XXXXXXX..XXXXXXX 100644 | 29 | index XXXXXXX..XXXXXXX 100644 |
22 | --- a/hw/intc/arm_gicv3_cpuif.c | 30 | --- a/MAINTAINERS |
23 | +++ b/hw/intc/arm_gicv3_cpuif.c | 31 | +++ b/MAINTAINERS |
24 | @@ -XXX,XX +XXX,XX @@ | 32 | @@ -XXX,XX +XXX,XX @@ F: include/hw/misc/imx7_*.h |
25 | /* | 33 | F: hw/pci-host/designware.c |
26 | - * ARM Generic Interrupt Controller v3 | 34 | F: include/hw/pci-host/designware.h |
27 | + * ARM Generic Interrupt Controller v3 (emulation) | 35 | |
28 | * | 36 | -MPS2 |
29 | * Copyright (c) 2016 Linaro Limited | 37 | +MPS2 / MPS3 |
30 | * Written by Peter Maydell | 38 | M: Peter Maydell <peter.maydell@linaro.org> |
31 | @@ -XXX,XX +XXX,XX @@ | 39 | L: qemu-arm@nongnu.org |
32 | #include "hw/irq.h" | 40 | S: Maintained |
33 | #include "cpu.h" | 41 | F: hw/arm/mps2.c |
34 | 42 | F: hw/arm/mps2-tz.c | |
35 | -void gicv3_set_gicv3state(CPUState *cpu, GICv3CPUState *s) | 43 | +F: hw/arm/mps3r.c |
36 | -{ | 44 | F: hw/misc/mps2-*.c |
37 | - ARMCPU *arm_cpu = ARM_CPU(cpu); | 45 | F: include/hw/misc/mps2-*.h |
38 | - CPUARMState *env = &arm_cpu->env; | 46 | F: hw/arm/armsse.c |
39 | - | 47 | diff --git a/configs/devices/arm-softmmu/default.mak b/configs/devices/arm-softmmu/default.mak |
40 | - env->gicv3state = (void *)s; | 48 | index XXXXXXX..XXXXXXX 100644 |
41 | -}; | 49 | --- a/configs/devices/arm-softmmu/default.mak |
42 | - | 50 | +++ b/configs/devices/arm-softmmu/default.mak |
43 | static GICv3CPUState *icc_cs_from_env(CPUARMState *env) | 51 | @@ -XXX,XX +XXX,XX @@ CONFIG_ARM_VIRT=y |
44 | { | 52 | # CONFIG_INTEGRATOR=n |
45 | return env->gicv3state; | 53 | # CONFIG_FSL_IMX31=n |
46 | diff --git a/hw/intc/arm_gicv3_cpuif_common.c b/hw/intc/arm_gicv3_cpuif_common.c | 54 | # CONFIG_MUSICPAL=n |
55 | +# CONFIG_MPS3R=n | ||
56 | # CONFIG_MUSCA=n | ||
57 | # CONFIG_CHEETAH=n | ||
58 | # CONFIG_SX1=n | ||
59 | diff --git a/hw/arm/mps3r.c b/hw/arm/mps3r.c | ||
47 | new file mode 100644 | 60 | new file mode 100644 |
48 | index XXXXXXX..XXXXXXX | 61 | index XXXXXXX..XXXXXXX |
49 | --- /dev/null | 62 | --- /dev/null |
50 | +++ b/hw/intc/arm_gicv3_cpuif_common.c | 63 | +++ b/hw/arm/mps3r.c |
51 | @@ -XXX,XX +XXX,XX @@ | 64 | @@ -XXX,XX +XXX,XX @@ |
52 | +/* SPDX-License-Identifier: GPL-2.0-or-later */ | ||
53 | +/* | 65 | +/* |
54 | + * ARM Generic Interrupt Controller v3 | 66 | + * Arm MPS3 board emulation for Cortex-R-based FPGA images. |
67 | + * (For M-profile images see mps2.c and mps2tz.c.) | ||
55 | + * | 68 | + * |
56 | + * Copyright (c) 2016 Linaro Limited | 69 | + * Copyright (c) 2017 Linaro Limited |
57 | + * Written by Peter Maydell | 70 | + * Written by Peter Maydell |
58 | + * | 71 | + * |
59 | + * This code is licensed under the GPL, version 2 or (at your option) | 72 | + * This program is free software; you can redistribute it and/or modify |
60 | + * any later version. | 73 | + * it under the terms of the GNU General Public License version 2 or |
74 | + * (at your option) any later version. | ||
61 | + */ | 75 | + */ |
62 | + | 76 | + |
77 | +/* | ||
78 | + * The MPS3 is an FPGA based dev board. This file handles FPGA images | ||
79 | + * which use the Cortex-R CPUs. We model these separately from the | ||
80 | + * M-profile images, because on M-profile the FPGA image is based on | ||
81 | + * a "Subsystem for Embedded" which is similar to an SoC, whereas | ||
82 | + * the R-profile FPGA images don't have that abstraction layer. | ||
83 | + * | ||
84 | + * We model the following FPGA images here: | ||
85 | + * "mps3-an536" -- dual Cortex-R52 as documented in Arm Application Note AN536 | ||
86 | + * | ||
87 | + * Application Note AN536: | ||
88 | + * https://developer.arm.com/documentation/dai0536/latest/ | ||
89 | + */ | ||
90 | + | ||
63 | +#include "qemu/osdep.h" | 91 | +#include "qemu/osdep.h" |
64 | +#include "gicv3_internal.h" | 92 | +#include "qemu/units.h" |
93 | +#include "qapi/error.h" | ||
94 | +#include "exec/address-spaces.h" | ||
65 | +#include "cpu.h" | 95 | +#include "cpu.h" |
66 | + | 96 | +#include "hw/boards.h" |
67 | +void gicv3_set_gicv3state(CPUState *cpu, GICv3CPUState *s) | 97 | +#include "hw/arm/boot.h" |
68 | +{ | 98 | + |
69 | + ARMCPU *arm_cpu = ARM_CPU(cpu); | 99 | +/* Define the layout of RAM and ROM in a board */ |
70 | + CPUARMState *env = &arm_cpu->env; | 100 | +typedef struct RAMInfo { |
71 | + | 101 | + const char *name; |
72 | + env->gicv3state = (void *)s; | 102 | + hwaddr base; |
103 | + hwaddr size; | ||
104 | + int mrindex; /* index into rams[]; -1 for the system RAM block */ | ||
105 | + int flags; | ||
106 | +} RAMInfo; | ||
107 | + | ||
108 | +/* | ||
109 | + * The MPS3 DDR is 3GiB, but on a 32-bit host QEMU doesn't permit | ||
110 | + * emulation of that much guest RAM, so artificially make it smaller. | ||
111 | + */ | ||
112 | +#if HOST_LONG_BITS == 32 | ||
113 | +#define MPS3_DDR_SIZE (1 * GiB) | ||
114 | +#else | ||
115 | +#define MPS3_DDR_SIZE (3 * GiB) | ||
116 | +#endif | ||
117 | + | ||
118 | +/* | ||
119 | + * Flag values: | ||
120 | + * IS_MAIN: this is the main machine RAM | ||
121 | + * IS_ROM: this area is read-only | ||
122 | + */ | ||
123 | +#define IS_MAIN 1 | ||
124 | +#define IS_ROM 2 | ||
125 | + | ||
126 | +#define MPS3R_RAM_MAX 9 | ||
127 | + | ||
128 | +typedef enum MPS3RFPGAType { | ||
129 | + FPGA_AN536, | ||
130 | +} MPS3RFPGAType; | ||
131 | + | ||
132 | +struct MPS3RMachineClass { | ||
133 | + MachineClass parent; | ||
134 | + MPS3RFPGAType fpga_type; | ||
135 | + const RAMInfo *raminfo; | ||
73 | +}; | 136 | +}; |
74 | diff --git a/hw/intc/meson.build b/hw/intc/meson.build | 137 | + |
138 | +struct MPS3RMachineState { | ||
139 | + MachineState parent; | ||
140 | + MemoryRegion ram[MPS3R_RAM_MAX]; | ||
141 | +}; | ||
142 | + | ||
143 | +#define TYPE_MPS3R_MACHINE "mps3r" | ||
144 | +#define TYPE_MPS3R_AN536_MACHINE MACHINE_TYPE_NAME("mps3-an536") | ||
145 | + | ||
146 | +OBJECT_DECLARE_TYPE(MPS3RMachineState, MPS3RMachineClass, MPS3R_MACHINE) | ||
147 | + | ||
148 | +static const RAMInfo an536_raminfo[] = { | ||
149 | + { | ||
150 | + .name = "ATCM", | ||
151 | + .base = 0x00000000, | ||
152 | + .size = 0x00008000, | ||
153 | + .mrindex = 0, | ||
154 | + }, { | ||
155 | + /* We model the QSPI flash as simple ROM for now */ | ||
156 | + .name = "QSPI", | ||
157 | + .base = 0x08000000, | ||
158 | + .size = 0x00800000, | ||
159 | + .flags = IS_ROM, | ||
160 | + .mrindex = 1, | ||
161 | + }, { | ||
162 | + .name = "BRAM", | ||
163 | + .base = 0x10000000, | ||
164 | + .size = 0x00080000, | ||
165 | + .mrindex = 2, | ||
166 | + }, { | ||
167 | + .name = "DDR", | ||
168 | + .base = 0x20000000, | ||
169 | + .size = MPS3_DDR_SIZE, | ||
170 | + .mrindex = -1, | ||
171 | + }, { | ||
172 | + .name = "ATCM0", | ||
173 | + .base = 0xee000000, | ||
174 | + .size = 0x00008000, | ||
175 | + .mrindex = 3, | ||
176 | + }, { | ||
177 | + .name = "BTCM0", | ||
178 | + .base = 0xee100000, | ||
179 | + .size = 0x00008000, | ||
180 | + .mrindex = 4, | ||
181 | + }, { | ||
182 | + .name = "CTCM0", | ||
183 | + .base = 0xee200000, | ||
184 | + .size = 0x00008000, | ||
185 | + .mrindex = 5, | ||
186 | + }, { | ||
187 | + .name = "ATCM1", | ||
188 | + .base = 0xee400000, | ||
189 | + .size = 0x00008000, | ||
190 | + .mrindex = 6, | ||
191 | + }, { | ||
192 | + .name = "BTCM1", | ||
193 | + .base = 0xee500000, | ||
194 | + .size = 0x00008000, | ||
195 | + .mrindex = 7, | ||
196 | + }, { | ||
197 | + .name = "CTCM1", | ||
198 | + .base = 0xee600000, | ||
199 | + .size = 0x00008000, | ||
200 | + .mrindex = 8, | ||
201 | + }, { | ||
202 | + .name = NULL, | ||
203 | + } | ||
204 | +}; | ||
205 | + | ||
206 | +static MemoryRegion *mr_for_raminfo(MPS3RMachineState *mms, | ||
207 | + const RAMInfo *raminfo) | ||
208 | +{ | ||
209 | + /* Return an initialized MemoryRegion for the RAMInfo. */ | ||
210 | + MemoryRegion *ram; | ||
211 | + | ||
212 | + if (raminfo->mrindex < 0) { | ||
213 | + /* Means this RAMInfo is for QEMU's "system memory" */ | ||
214 | + MachineState *machine = MACHINE(mms); | ||
215 | + assert(!(raminfo->flags & IS_ROM)); | ||
216 | + return machine->ram; | ||
217 | + } | ||
218 | + | ||
219 | + assert(raminfo->mrindex < MPS3R_RAM_MAX); | ||
220 | + ram = &mms->ram[raminfo->mrindex]; | ||
221 | + | ||
222 | + memory_region_init_ram(ram, NULL, raminfo->name, | ||
223 | + raminfo->size, &error_fatal); | ||
224 | + if (raminfo->flags & IS_ROM) { | ||
225 | + memory_region_set_readonly(ram, true); | ||
226 | + } | ||
227 | + return ram; | ||
228 | +} | ||
229 | + | ||
230 | +static void mps3r_common_init(MachineState *machine) | ||
231 | +{ | ||
232 | + MPS3RMachineState *mms = MPS3R_MACHINE(machine); | ||
233 | + MPS3RMachineClass *mmc = MPS3R_MACHINE_GET_CLASS(mms); | ||
234 | + MemoryRegion *sysmem = get_system_memory(); | ||
235 | + | ||
236 | + for (const RAMInfo *ri = mmc->raminfo; ri->name; ri++) { | ||
237 | + MemoryRegion *mr = mr_for_raminfo(mms, ri); | ||
238 | + memory_region_add_subregion(sysmem, ri->base, mr); | ||
239 | + } | ||
240 | +} | ||
241 | + | ||
242 | +static void mps3r_set_default_ram_info(MPS3RMachineClass *mmc) | ||
243 | +{ | ||
244 | + /* | ||
245 | + * Set mc->default_ram_size and default_ram_id from the | ||
246 | + * information in mmc->raminfo. | ||
247 | + */ | ||
248 | + MachineClass *mc = MACHINE_CLASS(mmc); | ||
249 | + const RAMInfo *p; | ||
250 | + | ||
251 | + for (p = mmc->raminfo; p->name; p++) { | ||
252 | + if (p->mrindex < 0) { | ||
253 | + /* Found the entry for "system memory" */ | ||
254 | + mc->default_ram_size = p->size; | ||
255 | + mc->default_ram_id = p->name; | ||
256 | + return; | ||
257 | + } | ||
258 | + } | ||
259 | + g_assert_not_reached(); | ||
260 | +} | ||
261 | + | ||
262 | +static void mps3r_class_init(ObjectClass *oc, void *data) | ||
263 | +{ | ||
264 | + MachineClass *mc = MACHINE_CLASS(oc); | ||
265 | + | ||
266 | + mc->init = mps3r_common_init; | ||
267 | +} | ||
268 | + | ||
269 | +static void mps3r_an536_class_init(ObjectClass *oc, void *data) | ||
270 | +{ | ||
271 | + MachineClass *mc = MACHINE_CLASS(oc); | ||
272 | + MPS3RMachineClass *mmc = MPS3R_MACHINE_CLASS(oc); | ||
273 | + static const char * const valid_cpu_types[] = { | ||
274 | + ARM_CPU_TYPE_NAME("cortex-r52"), | ||
275 | + NULL | ||
276 | + }; | ||
277 | + | ||
278 | + mc->desc = "ARM MPS3 with AN536 FPGA image for Cortex-R52"; | ||
279 | + mc->default_cpus = 2; | ||
280 | + mc->min_cpus = mc->default_cpus; | ||
281 | + mc->max_cpus = mc->default_cpus; | ||
282 | + mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-r52"); | ||
283 | + mc->valid_cpu_types = valid_cpu_types; | ||
284 | + mmc->raminfo = an536_raminfo; | ||
285 | + mps3r_set_default_ram_info(mmc); | ||
286 | +} | ||
287 | + | ||
288 | +static const TypeInfo mps3r_machine_types[] = { | ||
289 | + { | ||
290 | + .name = TYPE_MPS3R_MACHINE, | ||
291 | + .parent = TYPE_MACHINE, | ||
292 | + .abstract = true, | ||
293 | + .instance_size = sizeof(MPS3RMachineState), | ||
294 | + .class_size = sizeof(MPS3RMachineClass), | ||
295 | + .class_init = mps3r_class_init, | ||
296 | + }, { | ||
297 | + .name = TYPE_MPS3R_AN536_MACHINE, | ||
298 | + .parent = TYPE_MPS3R_MACHINE, | ||
299 | + .class_init = mps3r_an536_class_init, | ||
300 | + }, | ||
301 | +}; | ||
302 | + | ||
303 | +DEFINE_TYPES(mps3r_machine_types); | ||
304 | diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig | ||
75 | index XXXXXXX..XXXXXXX 100644 | 305 | index XXXXXXX..XXXXXXX 100644 |
76 | --- a/hw/intc/meson.build | 306 | --- a/hw/arm/Kconfig |
77 | +++ b/hw/intc/meson.build | 307 | +++ b/hw/arm/Kconfig |
78 | @@ -XXX,XX +XXX,XX @@ softmmu_ss.add(when: 'CONFIG_XLNX_ZYNQMP_PMU', if_true: files('xlnx-pmu-iomod-in | 308 | @@ -XXX,XX +XXX,XX @@ config MAINSTONE |
79 | 309 | select PFLASH_CFI01 | |
80 | specific_ss.add(when: 'CONFIG_ALLWINNER_A10_PIC', if_true: files('allwinner-a10-pic.c')) | 310 | select SMC91C111 |
81 | specific_ss.add(when: 'CONFIG_APIC', if_true: files('apic.c', 'apic_common.c')) | 311 | |
82 | +specific_ss.add(when: 'CONFIG_ARM_GIC', if_true: files('arm_gicv3_cpuif_common.c')) | 312 | +config MPS3R |
83 | specific_ss.add(when: 'CONFIG_ARM_GIC', if_true: files('arm_gicv3_cpuif.c')) | 313 | + bool |
84 | specific_ss.add(when: 'CONFIG_ARM_GIC_KVM', if_true: files('arm_gic_kvm.c')) | 314 | + default y |
85 | specific_ss.add(when: ['CONFIG_ARM_GIC_KVM', 'TARGET_AARCH64'], if_true: files('arm_gicv3_kvm.c', 'arm_gicv3_its_kvm.c')) | 315 | + depends on TCG && ARM |
316 | + | ||
317 | config MUSCA | ||
318 | bool | ||
319 | default y | ||
320 | diff --git a/hw/arm/meson.build b/hw/arm/meson.build | ||
321 | index XXXXXXX..XXXXXXX 100644 | ||
322 | --- a/hw/arm/meson.build | ||
323 | +++ b/hw/arm/meson.build | ||
324 | @@ -XXX,XX +XXX,XX @@ arm_ss.add(when: 'CONFIG_HIGHBANK', if_true: files('highbank.c')) | ||
325 | arm_ss.add(when: 'CONFIG_INTEGRATOR', if_true: files('integratorcp.c')) | ||
326 | arm_ss.add(when: 'CONFIG_MAINSTONE', if_true: files('mainstone.c')) | ||
327 | arm_ss.add(when: 'CONFIG_MICROBIT', if_true: files('microbit.c')) | ||
328 | +arm_ss.add(when: 'CONFIG_MPS3R', if_true: files('mps3r.c')) | ||
329 | arm_ss.add(when: 'CONFIG_MUSICPAL', if_true: files('musicpal.c')) | ||
330 | arm_ss.add(when: 'CONFIG_NETDUINOPLUS2', if_true: files('netduinoplus2.c')) | ||
331 | arm_ss.add(when: 'CONFIG_OLIMEX_STM32_H405', if_true: files('olimex-stm32-h405.c')) | ||
86 | -- | 332 | -- |
87 | 2.25.1 | 333 | 2.34.1 |
88 | 334 | ||
89 | 335 | diff view generated by jsdifflib |
1 | From: Jean-Philippe Brucker <jean-philippe@linaro.org> | 1 | Create the CPUs, the GIC, and the per-CPU RAM block for |
---|---|---|---|
2 | the mps3-an536 board. | ||
2 | 3 | ||
3 | Add two test cases for VIOT, one on the q35 machine and the other on | 4 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
4 | virt. To test complex topologies the q35 test has two PCIe buses that | 5 | Message-id: 20240206132931.38376-10-peter.maydell@linaro.org |
5 | bypass the IOMMU (and are therefore not described by VIOT), and two | 6 | --- |
6 | buses that are translated by virtio-iommu. | 7 | hw/arm/mps3r.c | 180 ++++++++++++++++++++++++++++++++++++++++++++++++- |
8 | 1 file changed, 177 insertions(+), 3 deletions(-) | ||
7 | 9 | ||
8 | Reviewed-by: Eric Auger <eric.auger@redhat.com> | 10 | diff --git a/hw/arm/mps3r.c b/hw/arm/mps3r.c |
9 | Reviewed-by: Igor Mammedov <imammedo@redhat.com> | ||
10 | Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org> | ||
11 | Message-id: 20211210170415.583179-7-jean-philippe@linaro.org | ||
12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
13 | --- | ||
14 | tests/qtest/bios-tables-test.c | 38 ++++++++++++++++++++++++++++++++++ | ||
15 | 1 file changed, 38 insertions(+) | ||
16 | |||
17 | diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c | ||
18 | index XXXXXXX..XXXXXXX 100644 | 11 | index XXXXXXX..XXXXXXX 100644 |
19 | --- a/tests/qtest/bios-tables-test.c | 12 | --- a/hw/arm/mps3r.c |
20 | +++ b/tests/qtest/bios-tables-test.c | 13 | +++ b/hw/arm/mps3r.c |
21 | @@ -XXX,XX +XXX,XX @@ static void test_acpi_virt_tcg(void) | 14 | @@ -XXX,XX +XXX,XX @@ |
22 | free_test_data(&data); | 15 | #include "qemu/osdep.h" |
16 | #include "qemu/units.h" | ||
17 | #include "qapi/error.h" | ||
18 | +#include "qapi/qmp/qlist.h" | ||
19 | #include "exec/address-spaces.h" | ||
20 | #include "cpu.h" | ||
21 | #include "hw/boards.h" | ||
22 | +#include "hw/qdev-properties.h" | ||
23 | #include "hw/arm/boot.h" | ||
24 | +#include "hw/arm/bsa.h" | ||
25 | +#include "hw/intc/arm_gicv3.h" | ||
26 | |||
27 | /* Define the layout of RAM and ROM in a board */ | ||
28 | typedef struct RAMInfo { | ||
29 | @@ -XXX,XX +XXX,XX @@ typedef struct RAMInfo { | ||
30 | #define IS_ROM 2 | ||
31 | |||
32 | #define MPS3R_RAM_MAX 9 | ||
33 | +#define MPS3R_CPU_MAX 2 | ||
34 | + | ||
35 | +#define PERIPHBASE 0xf0000000 | ||
36 | +#define NUM_SPIS 96 | ||
37 | |||
38 | typedef enum MPS3RFPGAType { | ||
39 | FPGA_AN536, | ||
40 | @@ -XXX,XX +XXX,XX @@ struct MPS3RMachineClass { | ||
41 | MachineClass parent; | ||
42 | MPS3RFPGAType fpga_type; | ||
43 | const RAMInfo *raminfo; | ||
44 | + hwaddr loader_start; | ||
45 | }; | ||
46 | |||
47 | struct MPS3RMachineState { | ||
48 | MachineState parent; | ||
49 | + struct arm_boot_info bootinfo; | ||
50 | MemoryRegion ram[MPS3R_RAM_MAX]; | ||
51 | + Object *cpu[MPS3R_CPU_MAX]; | ||
52 | + MemoryRegion cpu_sysmem[MPS3R_CPU_MAX]; | ||
53 | + MemoryRegion sysmem_alias[MPS3R_CPU_MAX]; | ||
54 | + MemoryRegion cpu_ram[MPS3R_CPU_MAX]; | ||
55 | + GICv3State gic; | ||
56 | }; | ||
57 | |||
58 | #define TYPE_MPS3R_MACHINE "mps3r" | ||
59 | @@ -XXX,XX +XXX,XX @@ static MemoryRegion *mr_for_raminfo(MPS3RMachineState *mms, | ||
60 | return ram; | ||
23 | } | 61 | } |
24 | 62 | ||
25 | +static void test_acpi_q35_viot(void) | 63 | +/* |
64 | + * There is no defined secondary boot protocol for Linux for the AN536, | ||
65 | + * because real hardware has a restriction that atomic operations between | ||
66 | + * the two CPUs do not function correctly, and so true SMP is not | ||
67 | + * possible. Therefore for cases where the user is directly booting | ||
68 | + * a kernel, we treat the system as essentially uniprocessor, and | ||
69 | + * put the secondary CPU into power-off state (as if the user on the | ||
70 | + * real hardware had configured the secondary to be halted via the | ||
71 | + * SCC config registers). | ||
72 | + * | ||
73 | + * Note that the default secondary boot code would not work here anyway | ||
74 | + * as it assumes a GICv2, and we have a GICv3. | ||
75 | + */ | ||
76 | +static void mps3r_write_secondary_boot(ARMCPU *cpu, | ||
77 | + const struct arm_boot_info *info) | ||
26 | +{ | 78 | +{ |
27 | + test_data data = { | ||
28 | + .machine = MACHINE_Q35, | ||
29 | + .variant = ".viot", | ||
30 | + }; | ||
31 | + | ||
32 | + /* | 79 | + /* |
33 | + * To keep things interesting, two buses bypass the IOMMU. | 80 | + * Power the secondary CPU off. This means we don't need to write any |
34 | + * VIOT should only describes the other two buses. | 81 | + * boot code into guest memory. Note that the 'cpu' argument to this |
82 | + * function is the primary CPU we passed to arm_load_kernel(), not | ||
83 | + * the secondary. Loop around all the other CPUs, as the boot.c | ||
84 | + * code does for the "disable secondaries if PSCI is enabled" case. | ||
35 | + */ | 85 | + */ |
36 | + test_acpi_one("-machine default_bus_bypass_iommu=on " | 86 | + for (CPUState *cs = first_cpu; cs; cs = CPU_NEXT(cs)) { |
37 | + "-device virtio-iommu-pci " | 87 | + if (cs != first_cpu) { |
38 | + "-device pxb-pcie,bus_nr=0x10,id=pcie.100,bus=pcie.0 " | 88 | + object_property_set_bool(OBJECT(cs), "start-powered-off", true, |
39 | + "-device pxb-pcie,bus_nr=0x20,id=pcie.200,bus=pcie.0,bypass_iommu=on " | 89 | + &error_abort); |
40 | + "-device pxb-pcie,bus_nr=0x30,id=pcie.300,bus=pcie.0", | 90 | + } |
41 | + &data); | 91 | + } |
42 | + free_test_data(&data); | ||
43 | +} | 92 | +} |
44 | + | 93 | + |
45 | +static void test_acpi_virt_viot(void) | 94 | +static void mps3r_secondary_cpu_reset(ARMCPU *cpu, |
95 | + const struct arm_boot_info *info) | ||
46 | +{ | 96 | +{ |
47 | + test_data data = { | 97 | + /* We don't need to do anything here because the CPU will be off */ |
48 | + .machine = "virt", | ||
49 | + .uefi_fl1 = "pc-bios/edk2-aarch64-code.fd", | ||
50 | + .uefi_fl2 = "pc-bios/edk2-arm-vars.fd", | ||
51 | + .cd = "tests/data/uefi-boot-images/bios-tables-test.aarch64.iso.qcow2", | ||
52 | + .ram_start = 0x40000000ULL, | ||
53 | + .scan_len = 128ULL * 1024 * 1024, | ||
54 | + }; | ||
55 | + | ||
56 | + test_acpi_one("-cpu cortex-a57 " | ||
57 | + "-device virtio-iommu-pci", &data); | ||
58 | + free_test_data(&data); | ||
59 | +} | 98 | +} |
60 | + | 99 | + |
61 | static void test_oem_fields(test_data *data) | 100 | +static void create_gic(MPS3RMachineState *mms, MemoryRegion *sysmem) |
101 | +{ | ||
102 | + MachineState *machine = MACHINE(mms); | ||
103 | + DeviceState *gicdev; | ||
104 | + QList *redist_region_count; | ||
105 | + | ||
106 | + object_initialize_child(OBJECT(mms), "gic", &mms->gic, TYPE_ARM_GICV3); | ||
107 | + gicdev = DEVICE(&mms->gic); | ||
108 | + qdev_prop_set_uint32(gicdev, "num-cpu", machine->smp.cpus); | ||
109 | + qdev_prop_set_uint32(gicdev, "num-irq", NUM_SPIS + GIC_INTERNAL); | ||
110 | + redist_region_count = qlist_new(); | ||
111 | + qlist_append_int(redist_region_count, machine->smp.cpus); | ||
112 | + qdev_prop_set_array(gicdev, "redist-region-count", redist_region_count); | ||
113 | + object_property_set_link(OBJECT(&mms->gic), "sysmem", | ||
114 | + OBJECT(sysmem), &error_fatal); | ||
115 | + sysbus_realize(SYS_BUS_DEVICE(&mms->gic), &error_fatal); | ||
116 | + sysbus_mmio_map(SYS_BUS_DEVICE(&mms->gic), 0, PERIPHBASE); | ||
117 | + sysbus_mmio_map(SYS_BUS_DEVICE(&mms->gic), 1, PERIPHBASE + 0x100000); | ||
118 | + /* | ||
119 | + * Wire the outputs from each CPU's generic timer and the GICv3 | ||
120 | + * maintenance interrupt signal to the appropriate GIC PPI inputs, | ||
121 | + * and the GIC's IRQ/FIQ/VIRQ/VFIQ interrupt outputs to the CPU's inputs. | ||
122 | + */ | ||
123 | + for (int i = 0; i < machine->smp.cpus; i++) { | ||
124 | + DeviceState *cpudev = DEVICE(mms->cpu[i]); | ||
125 | + SysBusDevice *gicsbd = SYS_BUS_DEVICE(&mms->gic); | ||
126 | + int intidbase = NUM_SPIS + i * GIC_INTERNAL; | ||
127 | + int irq; | ||
128 | + /* | ||
129 | + * Mapping from the output timer irq lines from the CPU to the | ||
130 | + * GIC PPI inputs used for this board. This isn't a BSA board, | ||
131 | + * but it uses the standard convention for the PPI numbers. | ||
132 | + */ | ||
133 | + const int timer_irq[] = { | ||
134 | + [GTIMER_PHYS] = ARCH_TIMER_NS_EL1_IRQ, | ||
135 | + [GTIMER_VIRT] = ARCH_TIMER_VIRT_IRQ, | ||
136 | + [GTIMER_HYP] = ARCH_TIMER_NS_EL2_IRQ, | ||
137 | + }; | ||
138 | + | ||
139 | + for (irq = 0; irq < ARRAY_SIZE(timer_irq); irq++) { | ||
140 | + qdev_connect_gpio_out(cpudev, irq, | ||
141 | + qdev_get_gpio_in(gicdev, | ||
142 | + intidbase + timer_irq[irq])); | ||
143 | + } | ||
144 | + | ||
145 | + qdev_connect_gpio_out_named(cpudev, "gicv3-maintenance-interrupt", 0, | ||
146 | + qdev_get_gpio_in(gicdev, | ||
147 | + intidbase + ARCH_GIC_MAINT_IRQ)); | ||
148 | + | ||
149 | + qdev_connect_gpio_out_named(cpudev, "pmu-interrupt", 0, | ||
150 | + qdev_get_gpio_in(gicdev, | ||
151 | + intidbase + VIRTUAL_PMU_IRQ)); | ||
152 | + | ||
153 | + sysbus_connect_irq(gicsbd, i, | ||
154 | + qdev_get_gpio_in(cpudev, ARM_CPU_IRQ)); | ||
155 | + sysbus_connect_irq(gicsbd, i + machine->smp.cpus, | ||
156 | + qdev_get_gpio_in(cpudev, ARM_CPU_FIQ)); | ||
157 | + sysbus_connect_irq(gicsbd, i + 2 * machine->smp.cpus, | ||
158 | + qdev_get_gpio_in(cpudev, ARM_CPU_VIRQ)); | ||
159 | + sysbus_connect_irq(gicsbd, i + 3 * machine->smp.cpus, | ||
160 | + qdev_get_gpio_in(cpudev, ARM_CPU_VFIQ)); | ||
161 | + } | ||
162 | +} | ||
163 | + | ||
164 | static void mps3r_common_init(MachineState *machine) | ||
62 | { | 165 | { |
63 | int i; | 166 | MPS3RMachineState *mms = MPS3R_MACHINE(machine); |
64 | @@ -XXX,XX +XXX,XX @@ int main(int argc, char *argv[]) | 167 | @@ -XXX,XX +XXX,XX @@ static void mps3r_common_init(MachineState *machine) |
65 | qtest_add_func("acpi/q35/kvm/xapic", test_acpi_q35_kvm_xapic); | 168 | MemoryRegion *mr = mr_for_raminfo(mms, ri); |
66 | qtest_add_func("acpi/q35/kvm/dmar", test_acpi_q35_kvm_dmar); | 169 | memory_region_add_subregion(sysmem, ri->base, mr); |
67 | } | 170 | } |
68 | + qtest_add_func("acpi/q35/viot", test_acpi_q35_viot); | 171 | + |
69 | } else if (strcmp(arch, "aarch64") == 0) { | 172 | + assert(machine->smp.cpus <= MPS3R_CPU_MAX); |
70 | if (has_tcg) { | 173 | + for (int i = 0; i < machine->smp.cpus; i++) { |
71 | qtest_add_func("acpi/virt", test_acpi_virt_tcg); | 174 | + g_autofree char *sysmem_name = g_strdup_printf("cpu-%d-memory", i); |
72 | @@ -XXX,XX +XXX,XX @@ int main(int argc, char *argv[]) | 175 | + g_autofree char *ramname = g_strdup_printf("cpu-%d-memory", i); |
73 | qtest_add_func("acpi/virt/memhp", test_acpi_virt_tcg_memhp); | 176 | + g_autofree char *alias_name = g_strdup_printf("sysmem-alias-%d", i); |
74 | qtest_add_func("acpi/virt/pxb", test_acpi_virt_tcg_pxb); | 177 | + |
75 | qtest_add_func("acpi/virt/oem-fields", test_acpi_oem_fields_virt); | 178 | + /* |
76 | + qtest_add_func("acpi/virt/viot", test_acpi_virt_viot); | 179 | + * Each CPU has some private RAM/peripherals, so create the container |
180 | + * which will house those, with the whole-machine system memory being | ||
181 | + * used where there's no CPU-specific device. Note that we need the | ||
182 | + * sysmem_alias aliases because we can't put one MR (the original | ||
183 | + * 'sysmem') into more than one other MR. | ||
184 | + */ | ||
185 | + memory_region_init(&mms->cpu_sysmem[i], OBJECT(machine), | ||
186 | + sysmem_name, UINT64_MAX); | ||
187 | + memory_region_init_alias(&mms->sysmem_alias[i], OBJECT(machine), | ||
188 | + alias_name, sysmem, 0, UINT64_MAX); | ||
189 | + memory_region_add_subregion_overlap(&mms->cpu_sysmem[i], 0, | ||
190 | + &mms->sysmem_alias[i], -1); | ||
191 | + | ||
192 | + mms->cpu[i] = object_new(machine->cpu_type); | ||
193 | + object_property_set_link(mms->cpu[i], "memory", | ||
194 | + OBJECT(&mms->cpu_sysmem[i]), &error_abort); | ||
195 | + object_property_set_int(mms->cpu[i], "reset-cbar", | ||
196 | + PERIPHBASE, &error_abort); | ||
197 | + qdev_realize(DEVICE(mms->cpu[i]), NULL, &error_fatal); | ||
198 | + object_unref(mms->cpu[i]); | ||
199 | + | ||
200 | + /* Per-CPU RAM */ | ||
201 | + memory_region_init_ram(&mms->cpu_ram[i], NULL, ramname, | ||
202 | + 0x1000, &error_fatal); | ||
203 | + memory_region_add_subregion(&mms->cpu_sysmem[i], 0xe7c01000, | ||
204 | + &mms->cpu_ram[i]); | ||
205 | + } | ||
206 | + | ||
207 | + create_gic(mms, sysmem); | ||
208 | + | ||
209 | + mms->bootinfo.ram_size = machine->ram_size; | ||
210 | + mms->bootinfo.board_id = -1; | ||
211 | + mms->bootinfo.loader_start = mmc->loader_start; | ||
212 | + mms->bootinfo.write_secondary_boot = mps3r_write_secondary_boot; | ||
213 | + mms->bootinfo.secondary_cpu_reset_hook = mps3r_secondary_cpu_reset; | ||
214 | + arm_load_kernel(ARM_CPU(mms->cpu[0]), machine, &mms->bootinfo); | ||
215 | } | ||
216 | |||
217 | static void mps3r_set_default_ram_info(MPS3RMachineClass *mmc) | ||
218 | @@ -XXX,XX +XXX,XX @@ static void mps3r_set_default_ram_info(MPS3RMachineClass *mmc) | ||
219 | /* Found the entry for "system memory" */ | ||
220 | mc->default_ram_size = p->size; | ||
221 | mc->default_ram_id = p->name; | ||
222 | + mmc->loader_start = p->base; | ||
223 | return; | ||
77 | } | 224 | } |
78 | } | 225 | } |
79 | ret = g_test_run(); | 226 | @@ -XXX,XX +XXX,XX @@ static void mps3r_an536_class_init(ObjectClass *oc, void *data) |
227 | }; | ||
228 | |||
229 | mc->desc = "ARM MPS3 with AN536 FPGA image for Cortex-R52"; | ||
230 | - mc->default_cpus = 2; | ||
231 | - mc->min_cpus = mc->default_cpus; | ||
232 | - mc->max_cpus = mc->default_cpus; | ||
233 | + /* | ||
234 | + * In the real FPGA image there are always two cores, but the standard | ||
235 | + * initial setting for the SCC SYSCON 0x000 register is 0x21, meaning | ||
236 | + * that the second core is held in reset and halted. Many images built for | ||
237 | + * the board do not expect the second core to run at startup (especially | ||
238 | + * since on the real FPGA image it is not possible to use LDREX/STREX | ||
239 | + * in RAM between the two cores, so a true SMP setup isn't supported). | ||
240 | + * | ||
241 | + * As QEMU's equivalent of this, we support both -smp 1 and -smp 2, | ||
242 | + * with the default being -smp 1. This seems a more intuitive UI for | ||
243 | + * QEMU users than, for instance, having a machine property to allow | ||
244 | + * the user to set the initial value of the SYSCON 0x000 register. | ||
245 | + */ | ||
246 | + mc->default_cpus = 1; | ||
247 | + mc->min_cpus = 1; | ||
248 | + mc->max_cpus = 2; | ||
249 | mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-r52"); | ||
250 | mc->valid_cpu_types = valid_cpu_types; | ||
251 | mmc->raminfo = an536_raminfo; | ||
80 | -- | 252 | -- |
81 | 2.25.1 | 253 | 2.34.1 |
82 | |||
83 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | This board has a lot of UARTs: there is one UART per CPU in the |
---|---|---|---|
2 | per-CPU peripheral part of the address map, whose interrupts are | ||
3 | connected as per-CPU interrupt lines. Then there are 4 UARTs in the | ||
4 | normal part of the peripheral space, whose interrupts are shared | ||
5 | peripheral interrupts. | ||
2 | 6 | ||
3 | We will reuse this section of arm_deliver_fault for | 7 | Connect and wire them all up; this involves some OR gates where |
4 | raising pc alignment faults. | 8 | multiple overflow interrupts are wired into one GIC input. |
5 | 9 | ||
6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
11 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
12 | Message-id: 20240206132931.38376-11-peter.maydell@linaro.org | ||
9 | --- | 13 | --- |
10 | target/arm/tlb_helper.c | 45 +++++++++++++++++++++++++---------------- | 14 | hw/arm/mps3r.c | 94 ++++++++++++++++++++++++++++++++++++++++++++++++++ |
11 | 1 file changed, 28 insertions(+), 17 deletions(-) | 15 | 1 file changed, 94 insertions(+) |
12 | 16 | ||
13 | diff --git a/target/arm/tlb_helper.c b/target/arm/tlb_helper.c | 17 | diff --git a/hw/arm/mps3r.c b/hw/arm/mps3r.c |
14 | index XXXXXXX..XXXXXXX 100644 | 18 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/target/arm/tlb_helper.c | 19 | --- a/hw/arm/mps3r.c |
16 | +++ b/target/arm/tlb_helper.c | 20 | +++ b/hw/arm/mps3r.c |
17 | @@ -XXX,XX +XXX,XX @@ static inline uint32_t merge_syn_data_abort(uint32_t template_syn, | 21 | @@ -XXX,XX +XXX,XX @@ |
18 | return syn; | 22 | #include "qapi/qmp/qlist.h" |
23 | #include "exec/address-spaces.h" | ||
24 | #include "cpu.h" | ||
25 | +#include "sysemu/sysemu.h" | ||
26 | #include "hw/boards.h" | ||
27 | +#include "hw/or-irq.h" | ||
28 | #include "hw/qdev-properties.h" | ||
29 | #include "hw/arm/boot.h" | ||
30 | #include "hw/arm/bsa.h" | ||
31 | +#include "hw/char/cmsdk-apb-uart.h" | ||
32 | #include "hw/intc/arm_gicv3.h" | ||
33 | |||
34 | /* Define the layout of RAM and ROM in a board */ | ||
35 | @@ -XXX,XX +XXX,XX @@ typedef struct RAMInfo { | ||
36 | |||
37 | #define MPS3R_RAM_MAX 9 | ||
38 | #define MPS3R_CPU_MAX 2 | ||
39 | +#define MPS3R_UART_MAX 4 /* shared UART count */ | ||
40 | |||
41 | #define PERIPHBASE 0xf0000000 | ||
42 | #define NUM_SPIS 96 | ||
43 | @@ -XXX,XX +XXX,XX @@ struct MPS3RMachineState { | ||
44 | MemoryRegion sysmem_alias[MPS3R_CPU_MAX]; | ||
45 | MemoryRegion cpu_ram[MPS3R_CPU_MAX]; | ||
46 | GICv3State gic; | ||
47 | + /* per-CPU UARTs followed by the shared UARTs */ | ||
48 | + CMSDKAPBUART uart[MPS3R_CPU_MAX + MPS3R_UART_MAX]; | ||
49 | + OrIRQState cpu_uart_oflow[MPS3R_CPU_MAX]; | ||
50 | + OrIRQState uart_oflow; | ||
51 | }; | ||
52 | |||
53 | #define TYPE_MPS3R_MACHINE "mps3r" | ||
54 | @@ -XXX,XX +XXX,XX @@ struct MPS3RMachineState { | ||
55 | |||
56 | OBJECT_DECLARE_TYPE(MPS3RMachineState, MPS3RMachineClass, MPS3R_MACHINE) | ||
57 | |||
58 | +/* | ||
59 | + * Main clock frequency CLK in Hz (50MHz). In the image there are also | ||
60 | + * ACLK, MCLK, GPUCLK and PERIPHCLK at the same frequency; for our | ||
61 | + * model we just roll them all into one. | ||
62 | + */ | ||
63 | +#define CLK_FRQ 50000000 | ||
64 | + | ||
65 | static const RAMInfo an536_raminfo[] = { | ||
66 | { | ||
67 | .name = "ATCM", | ||
68 | @@ -XXX,XX +XXX,XX @@ static void create_gic(MPS3RMachineState *mms, MemoryRegion *sysmem) | ||
69 | } | ||
19 | } | 70 | } |
20 | 71 | ||
21 | -static void QEMU_NORETURN arm_deliver_fault(ARMCPU *cpu, vaddr addr, | 72 | +/* |
22 | - MMUAccessType access_type, | 73 | + * Create UART uartno, and map it into the MemoryRegion mem at address baseaddr. |
23 | - int mmu_idx, ARMMMUFaultInfo *fi) | 74 | + * The qemu_irq arguments are where we connect the various IRQs from the UART. |
24 | +static uint32_t compute_fsr_fsc(CPUARMState *env, ARMMMUFaultInfo *fi, | 75 | + */ |
25 | + int target_el, int mmu_idx, uint32_t *ret_fsc) | 76 | +static void create_uart(MPS3RMachineState *mms, int uartno, MemoryRegion *mem, |
26 | { | 77 | + hwaddr baseaddr, qemu_irq txirq, qemu_irq rxirq, |
27 | - CPUARMState *env = &cpu->env; | 78 | + qemu_irq txoverirq, qemu_irq rxoverirq, |
28 | - int target_el; | 79 | + qemu_irq combirq) |
29 | - bool same_el; | 80 | +{ |
30 | - uint32_t syn, exc, fsr, fsc; | 81 | + g_autofree char *s = g_strdup_printf("uart%d", uartno); |
31 | ARMMMUIdx arm_mmu_idx = core_to_arm_mmu_idx(env, mmu_idx); | 82 | + SysBusDevice *sbd; |
32 | - | 83 | + |
33 | - target_el = exception_target_el(env); | 84 | + assert(uartno < ARRAY_SIZE(mms->uart)); |
34 | - if (fi->stage2) { | 85 | + object_initialize_child(OBJECT(mms), s, &mms->uart[uartno], |
35 | - target_el = 2; | 86 | + TYPE_CMSDK_APB_UART); |
36 | - env->cp15.hpfar_el2 = extract64(fi->s2addr, 12, 47) << 4; | 87 | + qdev_prop_set_uint32(DEVICE(&mms->uart[uartno]), "pclk-frq", CLK_FRQ); |
37 | - if (arm_is_secure_below_el3(env) && fi->s1ns) { | 88 | + qdev_prop_set_chr(DEVICE(&mms->uart[uartno]), "chardev", serial_hd(uartno)); |
38 | - env->cp15.hpfar_el2 |= HPFAR_NS; | 89 | + sbd = SYS_BUS_DEVICE(&mms->uart[uartno]); |
39 | - } | 90 | + sysbus_realize(sbd, &error_fatal); |
40 | - } | 91 | + memory_region_add_subregion(mem, baseaddr, |
41 | - same_el = (arm_current_el(env) == target_el); | 92 | + sysbus_mmio_get_region(sbd, 0)); |
42 | + uint32_t fsr, fsc; | 93 | + sysbus_connect_irq(sbd, 0, txirq); |
43 | 94 | + sysbus_connect_irq(sbd, 1, rxirq); | |
44 | if (target_el == 2 || arm_el_is_aa64(env, target_el) || | 95 | + sysbus_connect_irq(sbd, 2, txoverirq); |
45 | arm_s1_regime_using_lpae_format(env, arm_mmu_idx)) { | 96 | + sysbus_connect_irq(sbd, 3, rxoverirq); |
46 | @@ -XXX,XX +XXX,XX @@ static void QEMU_NORETURN arm_deliver_fault(ARMCPU *cpu, vaddr addr, | 97 | + sysbus_connect_irq(sbd, 4, combirq); |
47 | fsc = 0x3f; | ||
48 | } | ||
49 | |||
50 | + *ret_fsc = fsc; | ||
51 | + return fsr; | ||
52 | +} | 98 | +} |
53 | + | 99 | + |
54 | +static void QEMU_NORETURN arm_deliver_fault(ARMCPU *cpu, vaddr addr, | 100 | static void mps3r_common_init(MachineState *machine) |
55 | + MMUAccessType access_type, | 101 | { |
56 | + int mmu_idx, ARMMMUFaultInfo *fi) | 102 | MPS3RMachineState *mms = MPS3R_MACHINE(machine); |
57 | +{ | 103 | MPS3RMachineClass *mmc = MPS3R_MACHINE_GET_CLASS(mms); |
58 | + CPUARMState *env = &cpu->env; | 104 | MemoryRegion *sysmem = get_system_memory(); |
59 | + int target_el; | 105 | + DeviceState *gicdev; |
60 | + bool same_el; | 106 | |
61 | + uint32_t syn, exc, fsr, fsc; | 107 | for (const RAMInfo *ri = mmc->raminfo; ri->name; ri++) { |
108 | MemoryRegion *mr = mr_for_raminfo(mms, ri); | ||
109 | @@ -XXX,XX +XXX,XX @@ static void mps3r_common_init(MachineState *machine) | ||
110 | } | ||
111 | |||
112 | create_gic(mms, sysmem); | ||
113 | + gicdev = DEVICE(&mms->gic); | ||
62 | + | 114 | + |
63 | + target_el = exception_target_el(env); | 115 | + /* |
64 | + if (fi->stage2) { | 116 | + * UARTs 0 and 1 are per-CPU; their interrupts are wired to |
65 | + target_el = 2; | 117 | + * the relevant CPU's PPI 0..3, aka INTID 16..19 |
66 | + env->cp15.hpfar_el2 = extract64(fi->s2addr, 12, 47) << 4; | 118 | + */ |
67 | + if (arm_is_secure_below_el3(env) && fi->s1ns) { | 119 | + for (int i = 0; i < machine->smp.cpus; i++) { |
68 | + env->cp15.hpfar_el2 |= HPFAR_NS; | 120 | + int intidbase = NUM_SPIS + i * GIC_INTERNAL; |
69 | + } | 121 | + g_autofree char *s = g_strdup_printf("cpu-uart-oflow-orgate%d", i); |
122 | + DeviceState *orgate; | ||
123 | + | ||
124 | + /* The two overflow IRQs from the UART are ORed together into PPI 3 */ | ||
125 | + object_initialize_child(OBJECT(mms), s, &mms->cpu_uart_oflow[i], | ||
126 | + TYPE_OR_IRQ); | ||
127 | + orgate = DEVICE(&mms->cpu_uart_oflow[i]); | ||
128 | + qdev_prop_set_uint32(orgate, "num-lines", 2); | ||
129 | + qdev_realize(orgate, NULL, &error_fatal); | ||
130 | + qdev_connect_gpio_out(orgate, 0, | ||
131 | + qdev_get_gpio_in(gicdev, intidbase + 19)); | ||
132 | + | ||
133 | + create_uart(mms, i, &mms->cpu_sysmem[i], 0xe7c00000, | ||
134 | + qdev_get_gpio_in(gicdev, intidbase + 17), /* tx */ | ||
135 | + qdev_get_gpio_in(gicdev, intidbase + 16), /* rx */ | ||
136 | + qdev_get_gpio_in(orgate, 0), /* txover */ | ||
137 | + qdev_get_gpio_in(orgate, 1), /* rxover */ | ||
138 | + qdev_get_gpio_in(gicdev, intidbase + 18) /* combined */); | ||
70 | + } | 139 | + } |
71 | + same_el = (arm_current_el(env) == target_el); | 140 | + /* |
141 | + * UARTs 2 to 5 are whole-system; all overflow IRQs are ORed | ||
142 | + * together into IRQ 17 | ||
143 | + */ | ||
144 | + object_initialize_child(OBJECT(mms), "uart-oflow-orgate", | ||
145 | + &mms->uart_oflow, TYPE_OR_IRQ); | ||
146 | + qdev_prop_set_uint32(DEVICE(&mms->uart_oflow), "num-lines", | ||
147 | + MPS3R_UART_MAX * 2); | ||
148 | + qdev_realize(DEVICE(&mms->uart_oflow), NULL, &error_fatal); | ||
149 | + qdev_connect_gpio_out(DEVICE(&mms->uart_oflow), 0, | ||
150 | + qdev_get_gpio_in(gicdev, 17)); | ||
72 | + | 151 | + |
73 | + fsr = compute_fsr_fsc(env, fi, target_el, mmu_idx, &fsc); | 152 | + for (int i = 0; i < MPS3R_UART_MAX; i++) { |
153 | + hwaddr baseaddr = 0xe0205000 + i * 0x1000; | ||
154 | + int rxirq = 5 + i * 2, txirq = 6 + i * 2, combirq = 13 + i; | ||
74 | + | 155 | + |
75 | if (access_type == MMU_INST_FETCH) { | 156 | + create_uart(mms, i + MPS3R_CPU_MAX, sysmem, baseaddr, |
76 | syn = syn_insn_abort(same_el, fi->ea, fi->s1ptw, fsc); | 157 | + qdev_get_gpio_in(gicdev, txirq), |
77 | exc = EXCP_PREFETCH_ABORT; | 158 | + qdev_get_gpio_in(gicdev, rxirq), |
159 | + qdev_get_gpio_in(DEVICE(&mms->uart_oflow), i * 2), | ||
160 | + qdev_get_gpio_in(DEVICE(&mms->uart_oflow), i * 2 + 1), | ||
161 | + qdev_get_gpio_in(gicdev, combirq)); | ||
162 | + } | ||
163 | |||
164 | mms->bootinfo.ram_size = machine->ram_size; | ||
165 | mms->bootinfo.board_id = -1; | ||
78 | -- | 166 | -- |
79 | 2.25.1 | 167 | 2.34.1 |
80 | 168 | ||
81 | 169 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | Add the GPIO, watchdog, dual-timer and I2C devices to the mps3-an536 |
---|---|---|---|
2 | board. These are all simple devices that just need to be created and | ||
3 | wired up. | ||
2 | 4 | ||
3 | Both single-step and pc alignment faults have priority over | 5 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
4 | breakpoint exceptions. | 6 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
7 | Message-id: 20240206132931.38376-12-peter.maydell@linaro.org | ||
8 | --- | ||
9 | hw/arm/mps3r.c | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++ | ||
10 | 1 file changed, 59 insertions(+) | ||
5 | 11 | ||
6 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 12 | diff --git a/hw/arm/mps3r.c b/hw/arm/mps3r.c |
7 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
9 | --- | ||
10 | target/arm/debug_helper.c | 23 +++++++++++++++++++++++ | ||
11 | 1 file changed, 23 insertions(+) | ||
12 | |||
13 | diff --git a/target/arm/debug_helper.c b/target/arm/debug_helper.c | ||
14 | index XXXXXXX..XXXXXXX 100644 | 13 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/target/arm/debug_helper.c | 14 | --- a/hw/arm/mps3r.c |
16 | +++ b/target/arm/debug_helper.c | 15 | +++ b/hw/arm/mps3r.c |
17 | @@ -XXX,XX +XXX,XX @@ bool arm_debug_check_breakpoint(CPUState *cs) | 16 | @@ -XXX,XX +XXX,XX @@ |
18 | { | 17 | #include "sysemu/sysemu.h" |
19 | ARMCPU *cpu = ARM_CPU(cs); | 18 | #include "hw/boards.h" |
20 | CPUARMState *env = &cpu->env; | 19 | #include "hw/or-irq.h" |
21 | + target_ulong pc; | 20 | +#include "hw/qdev-clock.h" |
22 | int n; | 21 | #include "hw/qdev-properties.h" |
23 | 22 | #include "hw/arm/boot.h" | |
24 | /* | 23 | #include "hw/arm/bsa.h" |
25 | @@ -XXX,XX +XXX,XX @@ bool arm_debug_check_breakpoint(CPUState *cs) | 24 | #include "hw/char/cmsdk-apb-uart.h" |
26 | return false; | 25 | +#include "hw/i2c/arm_sbcon_i2c.h" |
26 | #include "hw/intc/arm_gicv3.h" | ||
27 | +#include "hw/misc/unimp.h" | ||
28 | +#include "hw/timer/cmsdk-apb-dualtimer.h" | ||
29 | +#include "hw/watchdog/cmsdk-apb-watchdog.h" | ||
30 | |||
31 | /* Define the layout of RAM and ROM in a board */ | ||
32 | typedef struct RAMInfo { | ||
33 | @@ -XXX,XX +XXX,XX @@ struct MPS3RMachineState { | ||
34 | CMSDKAPBUART uart[MPS3R_CPU_MAX + MPS3R_UART_MAX]; | ||
35 | OrIRQState cpu_uart_oflow[MPS3R_CPU_MAX]; | ||
36 | OrIRQState uart_oflow; | ||
37 | + CMSDKAPBWatchdog watchdog; | ||
38 | + CMSDKAPBDualTimer dualtimer; | ||
39 | + ArmSbconI2CState i2c[5]; | ||
40 | + Clock *clk; | ||
41 | }; | ||
42 | |||
43 | #define TYPE_MPS3R_MACHINE "mps3r" | ||
44 | @@ -XXX,XX +XXX,XX @@ static void mps3r_common_init(MachineState *machine) | ||
45 | MemoryRegion *sysmem = get_system_memory(); | ||
46 | DeviceState *gicdev; | ||
47 | |||
48 | + mms->clk = clock_new(OBJECT(machine), "CLK"); | ||
49 | + clock_set_hz(mms->clk, CLK_FRQ); | ||
50 | + | ||
51 | for (const RAMInfo *ri = mmc->raminfo; ri->name; ri++) { | ||
52 | MemoryRegion *mr = mr_for_raminfo(mms, ri); | ||
53 | memory_region_add_subregion(sysmem, ri->base, mr); | ||
54 | @@ -XXX,XX +XXX,XX @@ static void mps3r_common_init(MachineState *machine) | ||
55 | qdev_get_gpio_in(gicdev, combirq)); | ||
27 | } | 56 | } |
28 | 57 | ||
29 | + /* | 58 | + for (int i = 0; i < 4; i++) { |
30 | + * Single-step exceptions have priority over breakpoint exceptions. | 59 | + /* CMSDK GPIO controllers */ |
31 | + * If single-step state is active-pending, suppress the bp. | 60 | + g_autofree char *s = g_strdup_printf("gpio%d", i); |
32 | + */ | 61 | + create_unimplemented_device(s, 0xe0000000 + i * 0x1000, 0x1000); |
33 | + if (arm_singlestep_active(env) && !(env->pstate & PSTATE_SS)) { | ||
34 | + return false; | ||
35 | + } | 62 | + } |
36 | + | 63 | + |
37 | + /* | 64 | + object_initialize_child(OBJECT(mms), "watchdog", &mms->watchdog, |
38 | + * PC alignment faults have priority over breakpoint exceptions. | 65 | + TYPE_CMSDK_APB_WATCHDOG); |
39 | + */ | 66 | + qdev_connect_clock_in(DEVICE(&mms->watchdog), "WDOGCLK", mms->clk); |
40 | + pc = is_a64(env) ? env->pc : env->regs[15]; | 67 | + sysbus_realize(SYS_BUS_DEVICE(&mms->watchdog), &error_fatal); |
41 | + if ((is_a64(env) || !env->thumb) && (pc & 3) != 0) { | 68 | + sysbus_connect_irq(SYS_BUS_DEVICE(&mms->watchdog), 0, |
42 | + return false; | 69 | + qdev_get_gpio_in(gicdev, 0)); |
70 | + sysbus_mmio_map(SYS_BUS_DEVICE(&mms->watchdog), 0, 0xe0100000); | ||
71 | + | ||
72 | + object_initialize_child(OBJECT(mms), "dualtimer", &mms->dualtimer, | ||
73 | + TYPE_CMSDK_APB_DUALTIMER); | ||
74 | + qdev_connect_clock_in(DEVICE(&mms->dualtimer), "TIMCLK", mms->clk); | ||
75 | + sysbus_realize(SYS_BUS_DEVICE(&mms->dualtimer), &error_fatal); | ||
76 | + sysbus_connect_irq(SYS_BUS_DEVICE(&mms->dualtimer), 0, | ||
77 | + qdev_get_gpio_in(gicdev, 3)); | ||
78 | + sysbus_connect_irq(SYS_BUS_DEVICE(&mms->dualtimer), 1, | ||
79 | + qdev_get_gpio_in(gicdev, 1)); | ||
80 | + sysbus_connect_irq(SYS_BUS_DEVICE(&mms->dualtimer), 2, | ||
81 | + qdev_get_gpio_in(gicdev, 2)); | ||
82 | + sysbus_mmio_map(SYS_BUS_DEVICE(&mms->dualtimer), 0, 0xe0101000); | ||
83 | + | ||
84 | + for (int i = 0; i < ARRAY_SIZE(mms->i2c); i++) { | ||
85 | + static const hwaddr i2cbase[] = {0xe0102000, /* Touch */ | ||
86 | + 0xe0103000, /* Audio */ | ||
87 | + 0xe0107000, /* Shield0 */ | ||
88 | + 0xe0108000, /* Shield1 */ | ||
89 | + 0xe0109000}; /* DDR4 EEPROM */ | ||
90 | + g_autofree char *s = g_strdup_printf("i2c%d", i); | ||
91 | + | ||
92 | + object_initialize_child(OBJECT(mms), s, &mms->i2c[i], | ||
93 | + TYPE_ARM_SBCON_I2C); | ||
94 | + sysbus_realize(SYS_BUS_DEVICE(&mms->i2c[i]), &error_fatal); | ||
95 | + sysbus_mmio_map(SYS_BUS_DEVICE(&mms->i2c[i]), 0, i2cbase[i]); | ||
96 | + if (i != 2 && i != 3) { | ||
97 | + /* | ||
98 | + * internal-only bus: mark it full to avoid user-created | ||
99 | + * i2c devices being plugged into it. | ||
100 | + */ | ||
101 | + qbus_mark_full(qdev_get_child_bus(DEVICE(&mms->i2c[i]), "i2c")); | ||
102 | + } | ||
43 | + } | 103 | + } |
44 | + | 104 | + |
45 | + /* | 105 | mms->bootinfo.ram_size = machine->ram_size; |
46 | + * Instruction aborts have priority over breakpoint exceptions. | 106 | mms->bootinfo.board_id = -1; |
47 | + * TODO: We would need to look up the page for PC and verify that | 107 | mms->bootinfo.loader_start = mmc->loader_start; |
48 | + * it is present and executable. | ||
49 | + */ | ||
50 | + | ||
51 | for (n = 0; n < ARRAY_SIZE(env->cpu_breakpoint); n++) { | ||
52 | if (bp_wp_matches(cpu, n, false)) { | ||
53 | return true; | ||
54 | -- | 108 | -- |
55 | 2.25.1 | 109 | 2.34.1 |
56 | 110 | ||
57 | 111 | diff view generated by jsdifflib |
1 | From: Alex Bennée <alex.bennee@linaro.org> | 1 | Add the remaining devices (or unimplemented-device stubs) for |
---|---|---|---|
2 | this board: SPI controllers, SCC, FPGAIO, I2S, RTC, the | ||
3 | QSPI write-config block, and ethernet. | ||
2 | 4 | ||
3 | While trying to debug a GIC ITS failure I saw some guest errors that | 5 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
4 | had poor formatting as well as leaving me confused as to what failed. | 6 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
5 | As most of the checks aren't possible without a valid dte split that | 7 | Message-id: 20240206132931.38376-13-peter.maydell@linaro.org |
6 | check apart and then check the other conditions in steps. This avoids | 8 | --- |
7 | us relying on undefined data. | 9 | hw/arm/mps3r.c | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++ |
10 | 1 file changed, 74 insertions(+) | ||
8 | 11 | ||
9 | I still get a failure with the current kvm-unit-tests but at least I | 12 | diff --git a/hw/arm/mps3r.c b/hw/arm/mps3r.c |
10 | know (partially) why now: | ||
11 | |||
12 | Exception return from AArch64 EL1 to AArch64 EL1 PC 0x40080588 | ||
13 | PASS: gicv3: its-trigger: inv/invall: dev2/eventid=20 now triggers an LPI | ||
14 | ITS: MAPD devid=2 size = 0x8 itt=0x40430000 valid=0 | ||
15 | INT dev_id=2 event_id=20 | ||
16 | process_its_cmd: invalid command attributes: invalid dte: 0 for 2 (MEM_TX: 0) | ||
17 | PASS: gicv3: its-trigger: mapd valid=false: no LPI after device unmap | ||
18 | SUMMARY: 6 tests, 1 unexpected failures | ||
19 | |||
20 | Signed-off-by: Alex Bennée <alex.bennee@linaro.org> | ||
21 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
22 | Message-id: 20211112170454.3158925-1-alex.bennee@linaro.org | ||
23 | Cc: Shashi Mallela <shashi.mallela@linaro.org> | ||
24 | Cc: Peter Maydell <peter.maydell@linaro.org> | ||
25 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
26 | --- | ||
27 | hw/intc/arm_gicv3_its.c | 39 +++++++++++++++++++++++++++------------ | ||
28 | 1 file changed, 27 insertions(+), 12 deletions(-) | ||
29 | |||
30 | diff --git a/hw/intc/arm_gicv3_its.c b/hw/intc/arm_gicv3_its.c | ||
31 | index XXXXXXX..XXXXXXX 100644 | 13 | index XXXXXXX..XXXXXXX 100644 |
32 | --- a/hw/intc/arm_gicv3_its.c | 14 | --- a/hw/arm/mps3r.c |
33 | +++ b/hw/intc/arm_gicv3_its.c | 15 | +++ b/hw/arm/mps3r.c |
34 | @@ -XXX,XX +XXX,XX @@ static bool process_its_cmd(GICv3ITSState *s, uint64_t value, uint32_t offset, | 16 | @@ -XXX,XX +XXX,XX @@ |
35 | if (res != MEMTX_OK) { | 17 | #include "hw/char/cmsdk-apb-uart.h" |
36 | return result; | 18 | #include "hw/i2c/arm_sbcon_i2c.h" |
19 | #include "hw/intc/arm_gicv3.h" | ||
20 | +#include "hw/misc/mps2-scc.h" | ||
21 | +#include "hw/misc/mps2-fpgaio.h" | ||
22 | #include "hw/misc/unimp.h" | ||
23 | +#include "hw/net/lan9118.h" | ||
24 | +#include "hw/rtc/pl031.h" | ||
25 | +#include "hw/ssi/pl022.h" | ||
26 | #include "hw/timer/cmsdk-apb-dualtimer.h" | ||
27 | #include "hw/watchdog/cmsdk-apb-watchdog.h" | ||
28 | |||
29 | @@ -XXX,XX +XXX,XX @@ struct MPS3RMachineState { | ||
30 | CMSDKAPBWatchdog watchdog; | ||
31 | CMSDKAPBDualTimer dualtimer; | ||
32 | ArmSbconI2CState i2c[5]; | ||
33 | + PL022State spi[3]; | ||
34 | + MPS2SCC scc; | ||
35 | + MPS2FPGAIO fpgaio; | ||
36 | + UnimplementedDeviceState i2s_audio; | ||
37 | + PL031State rtc; | ||
38 | Clock *clk; | ||
39 | }; | ||
40 | |||
41 | @@ -XXX,XX +XXX,XX @@ static const RAMInfo an536_raminfo[] = { | ||
42 | } | ||
43 | }; | ||
44 | |||
45 | +static const int an536_oscclk[] = { | ||
46 | + 24000000, /* 24MHz reference for RTC and timers */ | ||
47 | + 50000000, /* 50MHz ACLK */ | ||
48 | + 50000000, /* 50MHz MCLK */ | ||
49 | + 50000000, /* 50MHz GPUCLK */ | ||
50 | + 24576000, /* 24.576MHz AUDCLK */ | ||
51 | + 23750000, /* 23.75MHz HDLCDCLK */ | ||
52 | + 100000000, /* 100MHz DDR4_REF_CLK */ | ||
53 | +}; | ||
54 | + | ||
55 | static MemoryRegion *mr_for_raminfo(MPS3RMachineState *mms, | ||
56 | const RAMInfo *raminfo) | ||
57 | { | ||
58 | @@ -XXX,XX +XXX,XX @@ static void mps3r_common_init(MachineState *machine) | ||
59 | MPS3RMachineClass *mmc = MPS3R_MACHINE_GET_CLASS(mms); | ||
60 | MemoryRegion *sysmem = get_system_memory(); | ||
61 | DeviceState *gicdev; | ||
62 | + QList *oscclk; | ||
63 | |||
64 | mms->clk = clock_new(OBJECT(machine), "CLK"); | ||
65 | clock_set_hz(mms->clk, CLK_FRQ); | ||
66 | @@ -XXX,XX +XXX,XX @@ static void mps3r_common_init(MachineState *machine) | ||
37 | } | 67 | } |
38 | + } else { | ||
39 | + qemu_log_mask(LOG_GUEST_ERROR, | ||
40 | + "%s: invalid command attributes: " | ||
41 | + "invalid dte: %"PRIx64" for %d (MEM_TX: %d)\n", | ||
42 | + __func__, dte, devid, res); | ||
43 | + return result; | ||
44 | } | 68 | } |
45 | 69 | ||
46 | - if ((devid > s->dt.maxids.max_devids) || !dte_valid || !ite_valid || | 70 | + for (int i = 0; i < ARRAY_SIZE(mms->spi); i++) { |
47 | - !cte_valid || (eventid > max_eventid)) { | 71 | + g_autofree char *s = g_strdup_printf("spi%d", i); |
72 | + hwaddr baseaddr = 0xe0104000 + i * 0x1000; | ||
73 | + | ||
74 | + object_initialize_child(OBJECT(mms), s, &mms->spi[i], TYPE_PL022); | ||
75 | + sysbus_realize(SYS_BUS_DEVICE(&mms->spi[i]), &error_fatal); | ||
76 | + sysbus_mmio_map(SYS_BUS_DEVICE(&mms->spi[i]), 0, baseaddr); | ||
77 | + sysbus_connect_irq(SYS_BUS_DEVICE(&mms->spi[i]), 0, | ||
78 | + qdev_get_gpio_in(gicdev, 22 + i)); | ||
79 | + } | ||
80 | + | ||
81 | + object_initialize_child(OBJECT(mms), "scc", &mms->scc, TYPE_MPS2_SCC); | ||
82 | + qdev_prop_set_uint32(DEVICE(&mms->scc), "scc-cfg0", 0); | ||
83 | + qdev_prop_set_uint32(DEVICE(&mms->scc), "scc-cfg4", 0x2); | ||
84 | + qdev_prop_set_uint32(DEVICE(&mms->scc), "scc-aid", 0x00200008); | ||
85 | + qdev_prop_set_uint32(DEVICE(&mms->scc), "scc-id", 0x41055360); | ||
86 | + oscclk = qlist_new(); | ||
87 | + for (int i = 0; i < ARRAY_SIZE(an536_oscclk); i++) { | ||
88 | + qlist_append_int(oscclk, an536_oscclk[i]); | ||
89 | + } | ||
90 | + qdev_prop_set_array(DEVICE(&mms->scc), "oscclk", oscclk); | ||
91 | + sysbus_realize(SYS_BUS_DEVICE(&mms->scc), &error_fatal); | ||
92 | + sysbus_mmio_map(SYS_BUS_DEVICE(&mms->scc), 0, 0xe0200000); | ||
93 | + | ||
94 | + create_unimplemented_device("i2s-audio", 0xe0201000, 0x1000); | ||
95 | + | ||
96 | + object_initialize_child(OBJECT(mms), "fpgaio", &mms->fpgaio, | ||
97 | + TYPE_MPS2_FPGAIO); | ||
98 | + qdev_prop_set_uint32(DEVICE(&mms->fpgaio), "prescale-clk", an536_oscclk[1]); | ||
99 | + qdev_prop_set_uint32(DEVICE(&mms->fpgaio), "num-leds", 10); | ||
100 | + qdev_prop_set_bit(DEVICE(&mms->fpgaio), "has-switches", true); | ||
101 | + qdev_prop_set_bit(DEVICE(&mms->fpgaio), "has-dbgctrl", false); | ||
102 | + sysbus_realize(SYS_BUS_DEVICE(&mms->fpgaio), &error_fatal); | ||
103 | + sysbus_mmio_map(SYS_BUS_DEVICE(&mms->fpgaio), 0, 0xe0202000); | ||
104 | + | ||
105 | + create_unimplemented_device("clcd", 0xe0209000, 0x1000); | ||
106 | + | ||
107 | + object_initialize_child(OBJECT(mms), "rtc", &mms->rtc, TYPE_PL031); | ||
108 | + sysbus_realize(SYS_BUS_DEVICE(&mms->rtc), &error_fatal); | ||
109 | + sysbus_mmio_map(SYS_BUS_DEVICE(&mms->rtc), 0, 0xe020a000); | ||
110 | + sysbus_connect_irq(SYS_BUS_DEVICE(&mms->rtc), 0, | ||
111 | + qdev_get_gpio_in(gicdev, 4)); | ||
48 | + | 112 | + |
49 | + /* | 113 | + /* |
50 | + * In this implementation, in case of guest errors we ignore the | 114 | + * In hardware this is a LAN9220; the LAN9118 is software compatible |
51 | + * command and move onto the next command in the queue. | 115 | + * except that it doesn't support the checksum-offload feature. |
52 | + */ | 116 | + */ |
53 | + if (devid > s->dt.maxids.max_devids) { | 117 | + lan9118_init(0xe0300000, |
54 | qemu_log_mask(LOG_GUEST_ERROR, | 118 | + qdev_get_gpio_in(gicdev, 18)); |
55 | - "%s: invalid command attributes " | ||
56 | - "devid %d or eventid %d or invalid dte %d or" | ||
57 | - "invalid cte %d or invalid ite %d\n", | ||
58 | - __func__, devid, eventid, dte_valid, cte_valid, | ||
59 | - ite_valid); | ||
60 | - /* | ||
61 | - * in this implementation, in case of error | ||
62 | - * we ignore this command and move onto the next | ||
63 | - * command in the queue | ||
64 | - */ | ||
65 | + "%s: invalid command attributes: devid %d>%d", | ||
66 | + __func__, devid, s->dt.maxids.max_devids); | ||
67 | + | 119 | + |
68 | + } else if (!dte_valid || !ite_valid || !cte_valid) { | 120 | + create_unimplemented_device("usb", 0xe0301000, 0x1000); |
69 | + qemu_log_mask(LOG_GUEST_ERROR, | 121 | + create_unimplemented_device("qspi-write-config", 0xe0600000, 0x1000); |
70 | + "%s: invalid command attributes: " | 122 | + |
71 | + "dte: %s, ite: %s, cte: %s\n", | 123 | mms->bootinfo.ram_size = machine->ram_size; |
72 | + __func__, | 124 | mms->bootinfo.board_id = -1; |
73 | + dte_valid ? "valid" : "invalid", | 125 | mms->bootinfo.loader_start = mmc->loader_start; |
74 | + ite_valid ? "valid" : "invalid", | ||
75 | + cte_valid ? "valid" : "invalid"); | ||
76 | + } else if (eventid > max_eventid) { | ||
77 | + qemu_log_mask(LOG_GUEST_ERROR, | ||
78 | + "%s: invalid command attributes: eventid %d > %d\n", | ||
79 | + __func__, eventid, max_eventid); | ||
80 | } else { | ||
81 | /* | ||
82 | * Current implementation only supports rdbase == procnum | ||
83 | -- | 126 | -- |
84 | 2.25.1 | 127 | 2.34.1 |
85 | 128 | ||
86 | 129 | diff view generated by jsdifflib |
1 | From: Joel Stanley <joel@jms.id.au> | 1 | Add documentation for the mps3-an536 board type. |
---|---|---|---|
2 | 2 | ||
3 | Add X11, FP5280G2, G220A, Rainier and Fuji. Mention that Swift will be | 3 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
4 | removed in v7.0. | 4 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
5 | Message-id: 20240206132931.38376-14-peter.maydell@linaro.org | ||
6 | --- | ||
7 | docs/system/arm/mps2.rst | 37 ++++++++++++++++++++++++++++++++++--- | ||
8 | 1 file changed, 34 insertions(+), 3 deletions(-) | ||
5 | 9 | ||
6 | Signed-off-by: Joel Stanley <joel@jms.id.au> | 10 | diff --git a/docs/system/arm/mps2.rst b/docs/system/arm/mps2.rst |
7 | Reviewed-by: Cédric Le Goater <clg@kaod.org> | ||
8 | Message-id: 20211117065752.330632-2-joel@jms.id.au | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | --- | ||
11 | docs/system/arm/aspeed.rst | 7 ++++++- | ||
12 | 1 file changed, 6 insertions(+), 1 deletion(-) | ||
13 | |||
14 | diff --git a/docs/system/arm/aspeed.rst b/docs/system/arm/aspeed.rst | ||
15 | index XXXXXXX..XXXXXXX 100644 | 11 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/docs/system/arm/aspeed.rst | 12 | --- a/docs/system/arm/mps2.rst |
17 | +++ b/docs/system/arm/aspeed.rst | 13 | +++ b/docs/system/arm/mps2.rst |
18 | @@ -XXX,XX +XXX,XX @@ AST2400 SoC based machines : | 14 | @@ -XXX,XX +XXX,XX @@ |
19 | 15 | -Arm MPS2 and MPS3 boards (``mps2-an385``, ``mps2-an386``, ``mps2-an500``, ``mps2-an505``, ``mps2-an511``, ``mps2-an521``, ``mps3-an524``, ``mps3-an547``) | |
20 | - ``palmetto-bmc`` OpenPOWER Palmetto POWER8 BMC | 16 | -========================================================================================================================================================= |
21 | - ``quanta-q71l-bmc`` OpenBMC Quanta BMC | 17 | +Arm MPS2 and MPS3 boards (``mps2-an385``, ``mps2-an386``, ``mps2-an500``, ``mps2-an505``, ``mps2-an511``, ``mps2-an521``, ``mps3-an524``, ``mps3-an536``, ``mps3-an547``) |
22 | +- ``supermicrox11-bmc`` Supermicro X11 BMC | 18 | +========================================================================================================================================================================= |
23 | 19 | ||
24 | AST2500 SoC based machines : | 20 | -These board models all use Arm M-profile CPUs. |
25 | 21 | +These board models use Arm M-profile or R-profile CPUs. | |
26 | @@ -XXX,XX +XXX,XX @@ AST2500 SoC based machines : | 22 | |
27 | - ``romulus-bmc`` OpenPOWER Romulus POWER9 BMC | 23 | The Arm MPS2, MPS2+ and MPS3 dev boards are FPGA based (the 2+ has a |
28 | - ``witherspoon-bmc`` OpenPOWER Witherspoon POWER9 BMC | 24 | bigger FPGA but is otherwise the same as the 2; the 3 has a bigger |
29 | - ``sonorapass-bmc`` OCP SonoraPass BMC | 25 | @@ -XXX,XX +XXX,XX @@ FPGA image. |
30 | -- ``swift-bmc`` OpenPOWER Swift BMC POWER9 | 26 | |
31 | +- ``swift-bmc`` OpenPOWER Swift BMC POWER9 (to be removed in v7.0) | 27 | QEMU models the following FPGA images: |
32 | +- ``fp5280g2-bmc`` Inspur FP5280G2 BMC | 28 | |
33 | +- ``g220a-bmc`` Bytedance G220A BMC | 29 | +FPGA images using M-profile CPUs: |
34 | 30 | + | |
35 | AST2600 SoC based machines : | 31 | ``mps2-an385`` |
36 | 32 | Cortex-M3 as documented in Arm Application Note AN385 | |
37 | - ``ast2600-evb`` Aspeed AST2600 Evaluation board (Cortex-A7) | 33 | ``mps2-an386`` |
38 | - ``tacoma-bmc`` OpenPOWER Witherspoon POWER9 AST2600 BMC | 34 | @@ -XXX,XX +XXX,XX @@ QEMU models the following FPGA images: |
39 | +- ``rainier-bmc`` IBM Rainier POWER10 BMC | 35 | ``mps3-an547`` |
40 | +- ``fuji-bmc`` Facebook Fuji BMC | 36 | Cortex-M55 on an MPS3, as documented in Arm Application Note AN547 |
41 | 37 | ||
42 | Supported devices | 38 | +FPGA images using R-profile CPUs: |
43 | ----------------- | 39 | + |
40 | +``mps3-an536`` | ||
41 | + Dual Cortex-R52 on an MPS3, as documented in Arm Application Note AN536 | ||
42 | + | ||
43 | Differences between QEMU and real hardware: | ||
44 | |||
45 | - AN385/AN386 remapping of low 16K of memory to either ZBT SSRAM1 or to | ||
46 | @@ -XXX,XX +XXX,XX @@ Differences between QEMU and real hardware: | ||
47 | flash, but only as simple ROM, so attempting to rewrite the flash | ||
48 | from the guest will fail | ||
49 | - QEMU does not model the USB controller in MPS3 boards | ||
50 | +- AN536 does not support runtime control of CPU reset and halt via | ||
51 | + the SCC CFG_REG0 register. | ||
52 | +- AN536 does not support enabling or disabling the flash and ATCM | ||
53 | + interfaces via the SCC CFG_REG1 register. | ||
54 | +- AN536 does not support setting of the initial vector table | ||
55 | + base address via the SCC CFG_REG6 and CFG_REG7 register config, | ||
56 | + and does not provide a mechanism for specifying these values at | ||
57 | + startup, so all guest images must be built to start from TCM | ||
58 | + (i.e. to expect the interrupt vector base at 0 from reset). | ||
59 | +- AN536 defaults to only creating a single CPU; this is the equivalent | ||
60 | + of the way the real FPGA image usually runs with the second Cortex-R52 | ||
61 | + held in halt via the initial SCC CFG_REG0 register setting. You can | ||
62 | + create the second CPU with ``-smp 2``; both CPUs will then start | ||
63 | + execution immediately on startup. | ||
64 | + | ||
65 | +Note that for the AN536 the first UART is accessible only by | ||
66 | +CPU0, and the second UART is accessible only by CPU1. The | ||
67 | +first UART accessible shared between both CPUs is the third | ||
68 | +UART. Guest software might therefore be built to use either | ||
69 | +the first UART or the third UART; if you don't see any output | ||
70 | +from the UART you are looking at, try one of the others. | ||
71 | +(Even if the AN536 machine is started with a single CPU and so | ||
72 | +no "CPU1-only UART", the UART numbering remains the same, | ||
73 | +with the third UART being the first of the shared ones.) | ||
74 | |||
75 | Machine-specific options | ||
76 | """""""""""""""""""""""" | ||
44 | -- | 77 | -- |
45 | 2.25.1 | 78 | 2.34.1 |
46 | 79 | ||
47 | 80 | diff view generated by jsdifflib |