1 | The following changes since commit 4cc10cae64c51e17844dc4358481c393d7bf1ed4: | 1 | Hi; here's the first target-arm pullreq for the 7.0 cycle. |
---|---|---|---|
2 | 2 | ||
3 | Merge remote-tracking branch 'remotes/bonzini-gitlab/tags/for-upstream' into staging (2021-05-06 18:56:17 +0100) | 3 | thanks |
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) | ||
4 | 9 | ||
5 | are available in the Git repository at: | 10 | are available in the Git repository at: |
6 | 11 | ||
7 | https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20210510 | 12 | https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20211215 |
8 | 13 | ||
9 | for you to fetch changes up to 8f96812baa53005f32aece3e30b140826c20aa19: | 14 | for you to fetch changes up to aed176558806674d030a8305d989d4e6a5073359: |
10 | 15 | ||
11 | hw/arm/xlnx: Fix PHY address for xilinx-zynq-a9 (2021-05-10 13:24:09 +0100) | 16 | tests/acpi: add expected blob for VIOT test on virt machine (2021-12-15 10:35:26 +0000) |
12 | 17 | ||
13 | ---------------------------------------------------------------- | 18 | ---------------------------------------------------------------- |
14 | target-arm queue: | 19 | target-arm queue: |
15 | * docs: fix link in sbsa description | 20 | * ITS: error reporting cleanup |
16 | * linux-user/aarch64: Enable hwcap for RND, BTI, and MTE | 21 | * aspeed: improve documentation |
17 | * target/arm: Fix tlbbits calculation in tlbi_aa64_vae2is_write() | 22 | * Fix STM32F2XX USART data register readout |
18 | * target/arm: Split neon and vfp translation to their own | 23 | * allow emulated GICv3 to be disabled in non-TCG builds |
19 | compilation units | 24 | * fix exception priority for singlestep, misaligned PC, bp, etc |
20 | * target/arm: Make WFI a NOP for userspace emulators | 25 | * Correct calculation of tlb range invalidate length |
21 | * hw/sd/omap_mmc: Use device_cold_reset() instead of | 26 | * npcm7xx_emc: fix missing queue_flush |
22 | device_legacy_reset() | 27 | * virt: Add VIOT ACPI table for virtio-iommu |
23 | * include: More fixes for 'extern "C"' block use | 28 | * target/i386: Use assert() to sanity-check b1 in SSE decode |
24 | * hw/arm/imx25_pdk: Fix error message for invalid RAM size | 29 | * Don't include qemu-common unnecessarily |
25 | * hw/arm/mps2-tz: Implement AN524 memory remapping via machine property | ||
26 | * hw/arm/xlnx: Fix PHY address for xilinx-zynq-a9 | ||
27 | 30 | ||
28 | ---------------------------------------------------------------- | 31 | ---------------------------------------------------------------- |
29 | Alex Bennée (1): | 32 | Alex Bennée (1): |
30 | docs: fix link in sbsa description | 33 | hw/intc: clean-up error reporting for failed ITS cmd |
31 | 34 | ||
32 | Guenter Roeck (1): | 35 | Jean-Philippe Brucker (8): |
33 | hw/arm/xlnx: Fix PHY address for xilinx-zynq-a9 | 36 | hw/arm/virt-acpi-build: Add VIOT table for virtio-iommu |
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 | ||
34 | 44 | ||
35 | Peter Maydell (22): | 45 | Joel Stanley (4): |
36 | target/arm: Fix tlbbits calculation in tlbi_aa64_vae2is_write() | 46 | docs: aspeed: Add new boards |
37 | target/arm: Move constant expanders to translate.h | 47 | docs: aspeed: Update OpenBMC image URL |
38 | target/arm: Share unallocated_encoding() and gen_exception_insn() | 48 | docs: aspeed: Give an example of booting a kernel |
39 | target/arm: Make functions used by m-nocp global | 49 | docs: aspeed: ADC is now modelled |
40 | target/arm: Split m-nocp trans functions into their own file | ||
41 | target/arm: Move gen_aa32 functions to translate-a32.h | ||
42 | target/arm: Move vfp_{load, store}_reg{32, 64} to translate-vfp.c.inc | ||
43 | target/arm: Make functions used by translate-vfp global | ||
44 | target/arm: Make translate-vfp.c.inc its own compilation unit | ||
45 | target/arm: Move vfp_reg_ptr() to translate-neon.c.inc | ||
46 | target/arm: Delete unused typedef | ||
47 | target/arm: Move NeonGenThreeOpEnvFn typedef to translate.h | ||
48 | target/arm: Make functions used by translate-neon global | ||
49 | target/arm: Make translate-neon.c.inc its own compilation unit | ||
50 | target/arm: Make WFI a NOP for userspace emulators | ||
51 | hw/sd/omap_mmc: Use device_cold_reset() instead of device_legacy_reset() | ||
52 | osdep: Make os-win32.h and os-posix.h handle 'extern "C"' themselves | ||
53 | include/qemu/bswap.h: Handle being included outside extern "C" block | ||
54 | include/disas/dis-asm.h: Handle being included outside 'extern "C"' | ||
55 | hw/misc/mps2-scc: Add "QEMU interface" comment | ||
56 | hw/misc/mps2-scc: Support using CFG0 bit 0 for remapping | ||
57 | hw/arm/mps2-tz: Implement AN524 memory remapping via machine property | ||
58 | 50 | ||
59 | Philippe Mathieu-Daudé (1): | 51 | Olivier Hériveaux (1): |
60 | hw/arm/imx25_pdk: Fix error message for invalid RAM size | 52 | Fix STM32F2XX USART data register readout |
61 | 53 | ||
62 | Richard Henderson (1): | 54 | Patrick Venture (1): |
63 | linux-user/aarch64: Enable hwcap for RND, BTI, and MTE | 55 | hw/net: npcm7xx_emc fix missing queue_flush |
64 | 56 | ||
65 | docs/system/arm/mps2.rst | 10 + | 57 | Peter Maydell (6): |
66 | docs/system/arm/sbsa.rst | 2 +- | 58 | target/i386: Use assert() to sanity-check b1 in SSE decode |
67 | include/disas/dis-asm.h | 12 +- | 59 | include/hw/i386: Don't include qemu-common.h in .h files |
68 | include/hw/misc/mps2-scc.h | 21 ++ | 60 | target/hexagon/cpu.h: don't include qemu-common.h |
69 | include/qemu/bswap.h | 26 ++- | 61 | target/rx/cpu.h: Don't include qemu-common.h |
70 | include/qemu/osdep.h | 8 +- | 62 | hw/arm: Don't include qemu-common.h unnecessarily |
71 | include/sysemu/os-posix.h | 8 + | 63 | target/arm: Correct calculation of tlb range invalidate length |
72 | include/sysemu/os-win32.h | 8 + | ||
73 | target/arm/translate-a32.h | 144 +++++++++++++ | ||
74 | target/arm/translate-a64.h | 2 - | ||
75 | target/arm/translate.h | 29 +++ | ||
76 | hw/arm/imx25_pdk.c | 5 +- | ||
77 | hw/arm/mps2-tz.c | 108 +++++++++- | ||
78 | hw/arm/xilinx_zynq.c | 2 +- | ||
79 | hw/misc/mps2-scc.c | 13 +- | ||
80 | hw/sd/omap_mmc.c | 2 +- | ||
81 | linux-user/elfload.c | 13 ++ | ||
82 | target/arm/helper.c | 2 +- | ||
83 | target/arm/op_helper.c | 12 ++ | ||
84 | target/arm/translate-a64.c | 15 -- | ||
85 | target/arm/translate-m-nocp.c | 221 ++++++++++++++++++++ | ||
86 | .../arm/{translate-neon.c.inc => translate-neon.c} | 19 +- | ||
87 | .../arm/{translate-vfp.c.inc => translate-vfp.c} | 230 +++------------------ | ||
88 | target/arm/translate.c | 200 ++++-------------- | ||
89 | disas/arm-a64.cc | 2 - | ||
90 | disas/nanomips.cpp | 2 - | ||
91 | target/arm/meson.build | 15 +- | ||
92 | 27 files changed, 718 insertions(+), 413 deletions(-) | ||
93 | create mode 100644 target/arm/translate-a32.h | ||
94 | create mode 100644 target/arm/translate-m-nocp.c | ||
95 | rename target/arm/{translate-neon.c.inc => translate-neon.c} (99%) | ||
96 | rename target/arm/{translate-vfp.c.inc => translate-vfp.c} (94%) | ||
97 | 64 | ||
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: Alex Bennée <alex.bennee@linaro.org> | 1 | From: Alex Bennée <alex.bennee@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | A trailing _ makes all the difference to the rendered link. | 3 | While trying to debug a GIC ITS failure I saw some guest errors that |
4 | had poor formatting as well as leaving me confused as to what failed. | ||
5 | As most of the checks aren't possible without a valid dte split that | ||
6 | check apart and then check the other conditions in steps. This avoids | ||
7 | us relying on undefined data. | ||
8 | |||
9 | I still get a failure with the current kvm-unit-tests but at least I | ||
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 | ||
4 | 19 | ||
5 | Signed-off-by: Alex Bennée <alex.bennee@linaro.org> | 20 | Signed-off-by: Alex Bennée <alex.bennee@linaro.org> |
6 | Message-id: 20210428131316.31390-1-alex.bennee@linaro.org | ||
7 | Reviewed-by: Peter Maydell <peter.maydell@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> | ||
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 25 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
9 | --- | 26 | --- |
10 | docs/system/arm/sbsa.rst | 2 +- | 27 | hw/intc/arm_gicv3_its.c | 39 +++++++++++++++++++++++++++------------ |
11 | 1 file changed, 1 insertion(+), 1 deletion(-) | 28 | 1 file changed, 27 insertions(+), 12 deletions(-) |
12 | 29 | ||
13 | diff --git a/docs/system/arm/sbsa.rst b/docs/system/arm/sbsa.rst | 30 | diff --git a/hw/intc/arm_gicv3_its.c b/hw/intc/arm_gicv3_its.c |
14 | index XXXXXXX..XXXXXXX 100644 | 31 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/docs/system/arm/sbsa.rst | 32 | --- a/hw/intc/arm_gicv3_its.c |
16 | +++ b/docs/system/arm/sbsa.rst | 33 | +++ b/hw/intc/arm_gicv3_its.c |
17 | @@ -XXX,XX +XXX,XX @@ Arm Server Base System Architecture Reference board (``sbsa-ref``) | 34 | @@ -XXX,XX +XXX,XX @@ static bool process_its_cmd(GICv3ITSState *s, uint64_t value, uint32_t offset, |
18 | While the `virt` board is a generic board platform that doesn't match | 35 | if (res != MEMTX_OK) { |
19 | any real hardware the `sbsa-ref` board intends to look like real | 36 | return result; |
20 | hardware. The `Server Base System Architecture | 37 | } |
21 | -<https://developer.arm.com/documentation/den0029/latest>` defines a | 38 | + } else { |
22 | +<https://developer.arm.com/documentation/den0029/latest>`_ defines a | 39 | + qemu_log_mask(LOG_GUEST_ERROR, |
23 | minimum base line of hardware support and importantly how the firmware | 40 | + "%s: invalid command attributes: " |
24 | reports that to any operating system. It is a static system that | 41 | + "invalid dte: %"PRIx64" for %d (MEM_TX: %d)\n", |
25 | reports a very minimal DT to the firmware for non-discoverable | 42 | + __func__, dte, devid, res); |
43 | + return result; | ||
44 | } | ||
45 | |||
46 | - if ((devid > s->dt.maxids.max_devids) || !dte_valid || !ite_valid || | ||
47 | - !cte_valid || (eventid > max_eventid)) { | ||
48 | + | ||
49 | + /* | ||
50 | + * In this implementation, in case of guest errors we ignore the | ||
51 | + * command and move onto the next command in the queue. | ||
52 | + */ | ||
53 | + if (devid > s->dt.maxids.max_devids) { | ||
54 | qemu_log_mask(LOG_GUEST_ERROR, | ||
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 | + | ||
68 | + } else if (!dte_valid || !ite_valid || !cte_valid) { | ||
69 | + qemu_log_mask(LOG_GUEST_ERROR, | ||
70 | + "%s: invalid command attributes: " | ||
71 | + "dte: %s, ite: %s, cte: %s\n", | ||
72 | + __func__, | ||
73 | + dte_valid ? "valid" : "invalid", | ||
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 | ||
26 | -- | 83 | -- |
27 | 2.20.1 | 84 | 2.25.1 |
28 | 85 | ||
29 | 86 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Joel Stanley <joel@jms.id.au> | ||
1 | 2 | ||
3 | Add X11, FP5280G2, G220A, Rainier and Fuji. Mention that Swift will be | ||
4 | removed in v7.0. | ||
5 | |||
6 | Signed-off-by: Joel Stanley <joel@jms.id.au> | ||
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 | ||
16 | --- a/docs/system/arm/aspeed.rst | ||
17 | +++ b/docs/system/arm/aspeed.rst | ||
18 | @@ -XXX,XX +XXX,XX @@ AST2400 SoC based machines : | ||
19 | |||
20 | - ``palmetto-bmc`` OpenPOWER Palmetto POWER8 BMC | ||
21 | - ``quanta-q71l-bmc`` OpenBMC Quanta BMC | ||
22 | +- ``supermicrox11-bmc`` Supermicro X11 BMC | ||
23 | |||
24 | AST2500 SoC based machines : | ||
25 | |||
26 | @@ -XXX,XX +XXX,XX @@ AST2500 SoC based machines : | ||
27 | - ``romulus-bmc`` OpenPOWER Romulus POWER9 BMC | ||
28 | - ``witherspoon-bmc`` OpenPOWER Witherspoon POWER9 BMC | ||
29 | - ``sonorapass-bmc`` OCP SonoraPass BMC | ||
30 | -- ``swift-bmc`` OpenPOWER Swift BMC POWER9 | ||
31 | +- ``swift-bmc`` OpenPOWER Swift BMC POWER9 (to be removed in v7.0) | ||
32 | +- ``fp5280g2-bmc`` Inspur FP5280G2 BMC | ||
33 | +- ``g220a-bmc`` Bytedance G220A BMC | ||
34 | |||
35 | AST2600 SoC based machines : | ||
36 | |||
37 | - ``ast2600-evb`` Aspeed AST2600 Evaluation board (Cortex-A7) | ||
38 | - ``tacoma-bmc`` OpenPOWER Witherspoon POWER9 AST2600 BMC | ||
39 | +- ``rainier-bmc`` IBM Rainier POWER10 BMC | ||
40 | +- ``fuji-bmc`` Facebook Fuji BMC | ||
41 | |||
42 | Supported devices | ||
43 | ----------------- | ||
44 | -- | ||
45 | 2.25.1 | ||
46 | |||
47 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Joel Stanley <joel@jms.id.au> | ||
1 | 2 | ||
3 | This is the latest URL for the OpenBMC CI. The old URL still works, but | ||
4 | redirects. | ||
5 | |||
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> | ||
10 | --- | ||
11 | docs/system/arm/aspeed.rst | 2 +- | ||
12 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
13 | |||
14 | diff --git a/docs/system/arm/aspeed.rst b/docs/system/arm/aspeed.rst | ||
15 | index XXXXXXX..XXXXXXX 100644 | ||
16 | --- a/docs/system/arm/aspeed.rst | ||
17 | +++ b/docs/system/arm/aspeed.rst | ||
18 | @@ -XXX,XX +XXX,XX @@ The Aspeed machines can be started using the ``-kernel`` option to | ||
19 | load a Linux kernel or from a firmware. Images can be downloaded from | ||
20 | the OpenBMC jenkins : | ||
21 | |||
22 | - https://jenkins.openbmc.org/job/ci-openbmc/lastSuccessfulBuild/distro=ubuntu,label=docker-builder | ||
23 | + https://jenkins.openbmc.org/job/ci-openbmc/lastSuccessfulBuild/ | ||
24 | |||
25 | or directly from the OpenBMC GitHub release repository : | ||
26 | |||
27 | -- | ||
28 | 2.25.1 | ||
29 | |||
30 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Joel Stanley <joel@jms.id.au> | ||
1 | 2 | ||
3 | A common use case for the ASPEED machine is to boot a Linux kernel. | ||
4 | Provide a full example command line. | ||
5 | |||
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-4-joel@jms.id.au | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | --- | ||
11 | docs/system/arm/aspeed.rst | 15 ++++++++++++--- | ||
12 | 1 file changed, 12 insertions(+), 3 deletions(-) | ||
13 | |||
14 | diff --git a/docs/system/arm/aspeed.rst b/docs/system/arm/aspeed.rst | ||
15 | index XXXXXXX..XXXXXXX 100644 | ||
16 | --- a/docs/system/arm/aspeed.rst | ||
17 | +++ b/docs/system/arm/aspeed.rst | ||
18 | @@ -XXX,XX +XXX,XX @@ Missing devices | ||
19 | Boot options | ||
20 | ------------ | ||
21 | |||
22 | -The Aspeed machines can be started using the ``-kernel`` option to | ||
23 | -load a Linux kernel or from a firmware. Images can be downloaded from | ||
24 | -the OpenBMC jenkins : | ||
25 | +The Aspeed machines can be started using the ``-kernel`` and ``-dtb`` options | ||
26 | +to load a Linux kernel or from a firmware. Images can be downloaded from the | ||
27 | +OpenBMC jenkins : | ||
28 | |||
29 | https://jenkins.openbmc.org/job/ci-openbmc/lastSuccessfulBuild/ | ||
30 | |||
31 | @@ -XXX,XX +XXX,XX @@ or directly from the OpenBMC GitHub release repository : | ||
32 | |||
33 | https://github.com/openbmc/openbmc/releases | ||
34 | |||
35 | +To boot a kernel directly from a Linux build tree: | ||
36 | + | ||
37 | +.. code-block:: bash | ||
38 | + | ||
39 | + $ qemu-system-arm -M ast2600-evb -nographic \ | ||
40 | + -kernel arch/arm/boot/zImage \ | ||
41 | + -dtb arch/arm/boot/dts/aspeed-ast2600-evb.dtb \ | ||
42 | + -initrd rootfs.cpio | ||
43 | + | ||
44 | The image should be attached as an MTD drive. Run : | ||
45 | |||
46 | .. code-block:: bash | ||
47 | -- | ||
48 | 2.25.1 | ||
49 | |||
50 | diff view generated by jsdifflib |
1 | From: Guenter Roeck <linux@roeck-us.net> | 1 | From: Joel Stanley <joel@jms.id.au> |
---|---|---|---|
2 | 2 | ||
3 | Commit dfc388797cc4 ("hw/arm: xlnx: Set all boards' GEM 'phy-addr' | 3 | Move it to the supported list. |
4 | property value to 23") configured the PHY address for xilinx-zynq-a9 | ||
5 | to 23. When trying to boot xilinx-zynq-a9 with zynq-zc702.dtb or | ||
6 | zynq-zc706.dtb, this results in the following error message when | ||
7 | trying to use the Ethernet interface. | ||
8 | 4 | ||
9 | macb e000b000.ethernet eth0: Could not attach PHY (-19) | 5 | Signed-off-by: Joel Stanley <joel@jms.id.au> |
10 | 6 | Message-id: 20211117065752.330632-5-joel@jms.id.au | |
11 | The devicetree files for ZC702 and ZC706 configure PHY address 7. The | ||
12 | documentation for the ZC702 and ZC706 evaluation boards suggest that the | ||
13 | PHY address is 7, not 23. Other boards use PHY address 0, 1, 3, or 7. | ||
14 | I was unable to find a documentation or a devicetree file suggesting | ||
15 | or using PHY address 23. The Ethernet interface starts working with | ||
16 | zynq-zc702.dtb and zynq-zc706.dtb when setting the PHY address to 7, | ||
17 | so let's use it. | ||
18 | |||
19 | Cc: Bin Meng <bin.meng@windriver.com> | ||
20 | Signed-off-by: Guenter Roeck <linux@roeck-us.net> | ||
21 | Reviewed-by: Bin Meng <bmeng.cn@gmail.com> | ||
22 | Acked-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | ||
23 | Message-id: 20210504124140.1100346-1-linux@roeck-us.net | ||
24 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
25 | --- | 8 | --- |
26 | hw/arm/xilinx_zynq.c | 2 +- | 9 | docs/system/arm/aspeed.rst | 2 +- |
27 | 1 file changed, 1 insertion(+), 1 deletion(-) | 10 | 1 file changed, 1 insertion(+), 1 deletion(-) |
28 | 11 | ||
29 | diff --git a/hw/arm/xilinx_zynq.c b/hw/arm/xilinx_zynq.c | 12 | diff --git a/docs/system/arm/aspeed.rst b/docs/system/arm/aspeed.rst |
30 | index XXXXXXX..XXXXXXX 100644 | 13 | index XXXXXXX..XXXXXXX 100644 |
31 | --- a/hw/arm/xilinx_zynq.c | 14 | --- a/docs/system/arm/aspeed.rst |
32 | +++ b/hw/arm/xilinx_zynq.c | 15 | +++ b/docs/system/arm/aspeed.rst |
33 | @@ -XXX,XX +XXX,XX @@ static void gem_init(NICInfo *nd, uint32_t base, qemu_irq irq) | 16 | @@ -XXX,XX +XXX,XX @@ Supported devices |
34 | qemu_check_nic_model(nd, TYPE_CADENCE_GEM); | 17 | * Front LEDs (PCA9552 on I2C bus) |
35 | qdev_set_nic_properties(dev, nd); | 18 | * LPC Peripheral Controller (a subset of subdevices are supported) |
36 | } | 19 | * Hash/Crypto Engine (HACE) - Hash support only. TODO: HMAC and RSA |
37 | - object_property_set_int(OBJECT(dev), "phy-addr", 23, &error_abort); | 20 | + * ADC |
38 | + object_property_set_int(OBJECT(dev), "phy-addr", 7, &error_abort); | 21 | |
39 | s = SYS_BUS_DEVICE(dev); | 22 | |
40 | sysbus_realize_and_unref(s, &error_fatal); | 23 | Missing devices |
41 | sysbus_mmio_map(s, 0, base); | 24 | --------------- |
25 | |||
26 | * Coprocessor support | ||
27 | - * ADC (out of tree implementation) | ||
28 | * PWM and Fan Controller | ||
29 | * Slave GPIO Controller | ||
30 | * Super I/O Controller | ||
42 | -- | 31 | -- |
43 | 2.20.1 | 32 | 2.25.1 |
44 | 33 | ||
45 | 34 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Olivier Hériveaux <olivier.heriveaux@ledger.fr> | ||
1 | 2 | ||
3 | Fix issue where the data register may be overwritten by next character | ||
4 | reception before being read and returned. | ||
5 | |||
6 | Signed-off-by: Olivier Hériveaux <olivier.heriveaux@ledger.fr> | ||
7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
8 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | ||
9 | Message-id: 20211128120723.4053-1-olivier.heriveaux@ledger.fr | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
11 | --- | ||
12 | hw/char/stm32f2xx_usart.c | 3 ++- | ||
13 | 1 file changed, 2 insertions(+), 1 deletion(-) | ||
14 | |||
15 | diff --git a/hw/char/stm32f2xx_usart.c b/hw/char/stm32f2xx_usart.c | ||
16 | index XXXXXXX..XXXXXXX 100644 | ||
17 | --- a/hw/char/stm32f2xx_usart.c | ||
18 | +++ b/hw/char/stm32f2xx_usart.c | ||
19 | @@ -XXX,XX +XXX,XX @@ static uint64_t stm32f2xx_usart_read(void *opaque, hwaddr addr, | ||
20 | return retvalue; | ||
21 | case USART_DR: | ||
22 | DB_PRINT("Value: 0x%" PRIx32 ", %c\n", s->usart_dr, (char) s->usart_dr); | ||
23 | + retvalue = s->usart_dr & 0x3FF; | ||
24 | s->usart_sr &= ~USART_SR_RXNE; | ||
25 | qemu_chr_fe_accept_input(&s->chr); | ||
26 | qemu_set_irq(s->irq, 0); | ||
27 | - return s->usart_dr & 0x3FF; | ||
28 | + return retvalue; | ||
29 | case USART_BRR: | ||
30 | return s->usart_brr; | ||
31 | case USART_CR1: | ||
32 | -- | ||
33 | 2.25.1 | ||
34 | |||
35 | diff view generated by jsdifflib |
1 | We want to split out the .c.inc files which are currently included | 1 | From: Philippe Mathieu-Daudé <philmd@redhat.com> |
---|---|---|---|
2 | into translate.c so they are separate compilation units. To do this | ||
3 | we need to make some functions which are currently file-local to | ||
4 | translate.c have global scope; create a translate-a32.h paralleling | ||
5 | the existing translate-a64.h as a place for these declarations to | ||
6 | live, so that code moved into the new compilation units can call | ||
7 | them. | ||
8 | 2 | ||
9 | The functions made global here are those required by the | 3 | gicv3_set_gicv3state() is used by arm_gicv3_common.c in |
10 | m-nocp.decode functions, except that I have converted the whole | 4 | arm_gicv3_common_realize(). Since we want to restrict |
11 | family of {read,write}_neon_element* and also both the load_cpu and | 5 | arm_gicv3_cpuif.c to TCG, extract gicv3_set_gicv3state() |
12 | store_cpu functions for consistency, even though m-nocp only wants a | 6 | to a new file. Add this file to the meson 'specific' |
13 | few functions from each. | 7 | source set, since it needs access to "cpu.h". |
14 | 8 | ||
9 | Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
10 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
11 | Message-id: 20211115223619.2599282-2-philmd@redhat.com | ||
15 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
16 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
17 | Message-id: 20210430132740.10391-4-peter.maydell@linaro.org | ||
18 | --- | 13 | --- |
19 | target/arm/translate-a32.h | 57 ++++++++++++++++++++++++++++++++++ | 14 | hw/intc/arm_gicv3_cpuif.c | 10 +--------- |
20 | target/arm/translate.c | 39 +++++------------------ | 15 | hw/intc/arm_gicv3_cpuif_common.c | 22 ++++++++++++++++++++++ |
21 | target/arm/translate-vfp.c.inc | 2 +- | 16 | hw/intc/meson.build | 1 + |
22 | 3 files changed, 65 insertions(+), 33 deletions(-) | 17 | 3 files changed, 24 insertions(+), 9 deletions(-) |
23 | create mode 100644 target/arm/translate-a32.h | 18 | create mode 100644 hw/intc/arm_gicv3_cpuif_common.c |
24 | 19 | ||
25 | diff --git a/target/arm/translate-a32.h b/target/arm/translate-a32.h | 20 | diff --git a/hw/intc/arm_gicv3_cpuif.c b/hw/intc/arm_gicv3_cpuif.c |
21 | index XXXXXXX..XXXXXXX 100644 | ||
22 | --- a/hw/intc/arm_gicv3_cpuif.c | ||
23 | +++ b/hw/intc/arm_gicv3_cpuif.c | ||
24 | @@ -XXX,XX +XXX,XX @@ | ||
25 | /* | ||
26 | - * ARM Generic Interrupt Controller v3 | ||
27 | + * ARM Generic Interrupt Controller v3 (emulation) | ||
28 | * | ||
29 | * Copyright (c) 2016 Linaro Limited | ||
30 | * Written by Peter Maydell | ||
31 | @@ -XXX,XX +XXX,XX @@ | ||
32 | #include "hw/irq.h" | ||
33 | #include "cpu.h" | ||
34 | |||
35 | -void gicv3_set_gicv3state(CPUState *cpu, GICv3CPUState *s) | ||
36 | -{ | ||
37 | - ARMCPU *arm_cpu = ARM_CPU(cpu); | ||
38 | - CPUARMState *env = &arm_cpu->env; | ||
39 | - | ||
40 | - env->gicv3state = (void *)s; | ||
41 | -}; | ||
42 | - | ||
43 | static GICv3CPUState *icc_cs_from_env(CPUARMState *env) | ||
44 | { | ||
45 | return env->gicv3state; | ||
46 | diff --git a/hw/intc/arm_gicv3_cpuif_common.c b/hw/intc/arm_gicv3_cpuif_common.c | ||
26 | new file mode 100644 | 47 | new file mode 100644 |
27 | index XXXXXXX..XXXXXXX | 48 | index XXXXXXX..XXXXXXX |
28 | --- /dev/null | 49 | --- /dev/null |
29 | +++ b/target/arm/translate-a32.h | 50 | +++ b/hw/intc/arm_gicv3_cpuif_common.c |
30 | @@ -XXX,XX +XXX,XX @@ | 51 | @@ -XXX,XX +XXX,XX @@ |
52 | +/* SPDX-License-Identifier: GPL-2.0-or-later */ | ||
31 | +/* | 53 | +/* |
32 | + * AArch32 translation, common definitions. | 54 | + * ARM Generic Interrupt Controller v3 |
33 | + * | 55 | + * |
34 | + * Copyright (c) 2021 Linaro, Ltd. | 56 | + * Copyright (c) 2016 Linaro Limited |
57 | + * Written by Peter Maydell | ||
35 | + * | 58 | + * |
36 | + * This library is free software; you can redistribute it and/or | 59 | + * This code is licensed under the GPL, version 2 or (at your option) |
37 | + * modify it under the terms of the GNU Lesser General Public | 60 | + * any later version. |
38 | + * License as published by the Free Software Foundation; either | ||
39 | + * version 2.1 of the License, or (at your option) any later version. | ||
40 | + * | ||
41 | + * This library is distributed in the hope that it will be useful, | ||
42 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
43 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
44 | + * Lesser General Public License for more details. | ||
45 | + * | ||
46 | + * You should have received a copy of the GNU Lesser General Public | ||
47 | + * License along with this library; if not, see <http://www.gnu.org/licenses/>. | ||
48 | + */ | 61 | + */ |
49 | + | 62 | + |
50 | +#ifndef TARGET_ARM_TRANSLATE_A64_H | 63 | +#include "qemu/osdep.h" |
51 | +#define TARGET_ARM_TRANSLATE_A64_H | 64 | +#include "gicv3_internal.h" |
65 | +#include "cpu.h" | ||
52 | + | 66 | + |
53 | +void load_reg_var(DisasContext *s, TCGv_i32 var, int reg); | 67 | +void gicv3_set_gicv3state(CPUState *cpu, GICv3CPUState *s) |
54 | +void arm_gen_condlabel(DisasContext *s); | 68 | +{ |
55 | +bool vfp_access_check(DisasContext *s); | 69 | + ARMCPU *arm_cpu = ARM_CPU(cpu); |
56 | +void read_neon_element32(TCGv_i32 dest, int reg, int ele, MemOp memop); | 70 | + CPUARMState *env = &arm_cpu->env; |
57 | +void read_neon_element64(TCGv_i64 dest, int reg, int ele, MemOp memop); | ||
58 | +void write_neon_element32(TCGv_i32 src, int reg, int ele, MemOp memop); | ||
59 | +void write_neon_element64(TCGv_i64 src, int reg, int ele, MemOp memop); | ||
60 | + | 71 | + |
61 | +static inline TCGv_i32 load_cpu_offset(int offset) | 72 | + env->gicv3state = (void *)s; |
62 | +{ | 73 | +}; |
63 | + TCGv_i32 tmp = tcg_temp_new_i32(); | 74 | diff --git a/hw/intc/meson.build b/hw/intc/meson.build |
64 | + tcg_gen_ld_i32(tmp, cpu_env, offset); | ||
65 | + return tmp; | ||
66 | +} | ||
67 | + | ||
68 | +#define load_cpu_field(name) load_cpu_offset(offsetof(CPUARMState, name)) | ||
69 | + | ||
70 | +static inline void store_cpu_offset(TCGv_i32 var, int offset) | ||
71 | +{ | ||
72 | + tcg_gen_st_i32(var, cpu_env, offset); | ||
73 | + tcg_temp_free_i32(var); | ||
74 | +} | ||
75 | + | ||
76 | +#define store_cpu_field(var, name) \ | ||
77 | + store_cpu_offset(var, offsetof(CPUARMState, name)) | ||
78 | + | ||
79 | +/* Create a new temporary and set it to the value of a CPU register. */ | ||
80 | +static inline TCGv_i32 load_reg(DisasContext *s, int reg) | ||
81 | +{ | ||
82 | + TCGv_i32 tmp = tcg_temp_new_i32(); | ||
83 | + load_reg_var(s, tmp, reg); | ||
84 | + return tmp; | ||
85 | +} | ||
86 | + | ||
87 | +#endif | ||
88 | diff --git a/target/arm/translate.c b/target/arm/translate.c | ||
89 | index XXXXXXX..XXXXXXX 100644 | 75 | index XXXXXXX..XXXXXXX 100644 |
90 | --- a/target/arm/translate.c | 76 | --- a/hw/intc/meson.build |
91 | +++ b/target/arm/translate.c | 77 | +++ b/hw/intc/meson.build |
92 | @@ -XXX,XX +XXX,XX @@ | 78 | @@ -XXX,XX +XXX,XX @@ softmmu_ss.add(when: 'CONFIG_XLNX_ZYNQMP_PMU', if_true: files('xlnx-pmu-iomod-in |
93 | #define ENABLE_ARCH_8 arm_dc_feature(s, ARM_FEATURE_V8) | 79 | |
94 | 80 | specific_ss.add(when: 'CONFIG_ALLWINNER_A10_PIC', if_true: files('allwinner-a10-pic.c')) | |
95 | #include "translate.h" | 81 | specific_ss.add(when: 'CONFIG_APIC', if_true: files('apic.c', 'apic_common.c')) |
96 | +#include "translate-a32.h" | 82 | +specific_ss.add(when: 'CONFIG_ARM_GIC', if_true: files('arm_gicv3_cpuif_common.c')) |
97 | 83 | specific_ss.add(when: 'CONFIG_ARM_GIC', if_true: files('arm_gicv3_cpuif.c')) | |
98 | #if defined(CONFIG_USER_ONLY) | 84 | specific_ss.add(when: 'CONFIG_ARM_GIC_KVM', if_true: files('arm_gic_kvm.c')) |
99 | #define IS_USER(s) 1 | 85 | specific_ss.add(when: ['CONFIG_ARM_GIC_KVM', 'TARGET_AARCH64'], if_true: files('arm_gicv3_kvm.c', 'arm_gicv3_its_kvm.c')) |
100 | @@ -XXX,XX +XXX,XX @@ void arm_translate_init(void) | ||
101 | } | ||
102 | |||
103 | /* Generate a label used for skipping this instruction */ | ||
104 | -static void arm_gen_condlabel(DisasContext *s) | ||
105 | +void arm_gen_condlabel(DisasContext *s) | ||
106 | { | ||
107 | if (!s->condjmp) { | ||
108 | s->condlabel = gen_new_label(); | ||
109 | @@ -XXX,XX +XXX,XX @@ static inline int get_a32_user_mem_index(DisasContext *s) | ||
110 | } | ||
111 | } | ||
112 | |||
113 | -static inline TCGv_i32 load_cpu_offset(int offset) | ||
114 | -{ | ||
115 | - TCGv_i32 tmp = tcg_temp_new_i32(); | ||
116 | - tcg_gen_ld_i32(tmp, cpu_env, offset); | ||
117 | - return tmp; | ||
118 | -} | ||
119 | - | ||
120 | -#define load_cpu_field(name) load_cpu_offset(offsetof(CPUARMState, name)) | ||
121 | - | ||
122 | -static inline void store_cpu_offset(TCGv_i32 var, int offset) | ||
123 | -{ | ||
124 | - tcg_gen_st_i32(var, cpu_env, offset); | ||
125 | - tcg_temp_free_i32(var); | ||
126 | -} | ||
127 | - | ||
128 | -#define store_cpu_field(var, name) \ | ||
129 | - store_cpu_offset(var, offsetof(CPUARMState, name)) | ||
130 | - | ||
131 | /* The architectural value of PC. */ | ||
132 | static uint32_t read_pc(DisasContext *s) | ||
133 | { | ||
134 | @@ -XXX,XX +XXX,XX @@ static uint32_t read_pc(DisasContext *s) | ||
135 | } | ||
136 | |||
137 | /* Set a variable to the value of a CPU register. */ | ||
138 | -static void load_reg_var(DisasContext *s, TCGv_i32 var, int reg) | ||
139 | +void load_reg_var(DisasContext *s, TCGv_i32 var, int reg) | ||
140 | { | ||
141 | if (reg == 15) { | ||
142 | tcg_gen_movi_i32(var, read_pc(s)); | ||
143 | @@ -XXX,XX +XXX,XX @@ static void load_reg_var(DisasContext *s, TCGv_i32 var, int reg) | ||
144 | } | ||
145 | } | ||
146 | |||
147 | -/* Create a new temporary and set it to the value of a CPU register. */ | ||
148 | -static inline TCGv_i32 load_reg(DisasContext *s, int reg) | ||
149 | -{ | ||
150 | - TCGv_i32 tmp = tcg_temp_new_i32(); | ||
151 | - load_reg_var(s, tmp, reg); | ||
152 | - return tmp; | ||
153 | -} | ||
154 | - | ||
155 | /* | ||
156 | * Create a new temp, REG + OFS, except PC is ALIGN(PC, 4). | ||
157 | * This is used for load/store for which use of PC implies (literal), | ||
158 | @@ -XXX,XX +XXX,XX @@ static inline void vfp_store_reg32(TCGv_i32 var, int reg) | ||
159 | tcg_gen_st_i32(var, cpu_env, vfp_reg_offset(false, reg)); | ||
160 | } | ||
161 | |||
162 | -static void read_neon_element32(TCGv_i32 dest, int reg, int ele, MemOp memop) | ||
163 | +void read_neon_element32(TCGv_i32 dest, int reg, int ele, MemOp memop) | ||
164 | { | ||
165 | long off = neon_element_offset(reg, ele, memop); | ||
166 | |||
167 | @@ -XXX,XX +XXX,XX @@ static void read_neon_element32(TCGv_i32 dest, int reg, int ele, MemOp memop) | ||
168 | } | ||
169 | } | ||
170 | |||
171 | -static void read_neon_element64(TCGv_i64 dest, int reg, int ele, MemOp memop) | ||
172 | +void read_neon_element64(TCGv_i64 dest, int reg, int ele, MemOp memop) | ||
173 | { | ||
174 | long off = neon_element_offset(reg, ele, memop); | ||
175 | |||
176 | @@ -XXX,XX +XXX,XX @@ static void read_neon_element64(TCGv_i64 dest, int reg, int ele, MemOp memop) | ||
177 | } | ||
178 | } | ||
179 | |||
180 | -static void write_neon_element32(TCGv_i32 src, int reg, int ele, MemOp memop) | ||
181 | +void write_neon_element32(TCGv_i32 src, int reg, int ele, MemOp memop) | ||
182 | { | ||
183 | long off = neon_element_offset(reg, ele, memop); | ||
184 | |||
185 | @@ -XXX,XX +XXX,XX @@ static void write_neon_element32(TCGv_i32 src, int reg, int ele, MemOp memop) | ||
186 | } | ||
187 | } | ||
188 | |||
189 | -static void write_neon_element64(TCGv_i64 src, int reg, int ele, MemOp memop) | ||
190 | +void write_neon_element64(TCGv_i64 src, int reg, int ele, MemOp memop) | ||
191 | { | ||
192 | long off = neon_element_offset(reg, ele, memop); | ||
193 | |||
194 | diff --git a/target/arm/translate-vfp.c.inc b/target/arm/translate-vfp.c.inc | ||
195 | index XXXXXXX..XXXXXXX 100644 | ||
196 | --- a/target/arm/translate-vfp.c.inc | ||
197 | +++ b/target/arm/translate-vfp.c.inc | ||
198 | @@ -XXX,XX +XXX,XX @@ static bool full_vfp_access_check(DisasContext *s, bool ignore_vfp_enabled) | ||
199 | * The most usual kind of VFP access check, for everything except | ||
200 | * FMXR/FMRX to the always-available special registers. | ||
201 | */ | ||
202 | -static bool vfp_access_check(DisasContext *s) | ||
203 | +bool vfp_access_check(DisasContext *s) | ||
204 | { | ||
205 | return full_vfp_access_check(s, false); | ||
206 | } | ||
207 | -- | 86 | -- |
208 | 2.20.1 | 87 | 2.25.1 |
209 | 88 | ||
210 | 89 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
1 | 2 | ||
3 | The TYPE_ARM_GICV3 device is an emulated one. When using | ||
4 | KVM, it is recommended to use the TYPE_KVM_ARM_GICV3 device | ||
5 | (which uses in-kernel support). | ||
6 | |||
7 | When using --with-devices-FOO, it is possible to build a | ||
8 | binary with a specific set of devices. When this binary is | ||
9 | restricted to KVM accelerator, the TYPE_ARM_GICV3 device is | ||
10 | irrelevant, and it is desirable to remove it from the binary. | ||
11 | |||
12 | Therefore introduce the CONFIG_ARM_GIC_TCG Kconfig selector | ||
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 | ||
28 | --- a/hw/intc/arm_gicv3.c | ||
29 | +++ b/hw/intc/arm_gicv3.c | ||
30 | @@ -XXX,XX +XXX,XX @@ | ||
31 | /* | ||
32 | - * ARM Generic Interrupt Controller v3 | ||
33 | + * ARM Generic Interrupt Controller v3 (emulation) | ||
34 | * | ||
35 | * Copyright (c) 2015 Huawei. | ||
36 | * Copyright (c) 2016 Linaro Limited | ||
37 | diff --git a/hw/intc/Kconfig b/hw/intc/Kconfig | ||
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 | -- | ||
85 | 2.25.1 | ||
86 | |||
87 | diff view generated by jsdifflib |
1 | The unallocated_encoding() function is the same in both | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | translate-a64.c and translate.c; make the translate.c function global | ||
3 | and drop the translate-a64.c version. To do this we need to also | ||
4 | share gen_exception_insn(), which currently exists in two slightly | ||
5 | different versions for A32 and A64: merge those into a single | ||
6 | function that can work for both. | ||
7 | 2 | ||
8 | This will be useful for splitting up translate.c, which will require | 3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
9 | unallocated_encoding() to no longer be file-local. It's also | 4 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
10 | hopefully less confusing to have only one version of the function | 5 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
11 | rather than two. | 6 | --- |
7 | target/arm/translate-a64.c | 7 ++++--- | ||
8 | 1 file changed, 4 insertions(+), 3 deletions(-) | ||
12 | 9 | ||
13 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
14 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
15 | Message-id: 20210430132740.10391-3-peter.maydell@linaro.org | ||
16 | --- | ||
17 | target/arm/translate-a64.h | 2 -- | ||
18 | target/arm/translate.h | 3 +++ | ||
19 | target/arm/translate-a64.c | 15 --------------- | ||
20 | target/arm/translate.c | 14 +++++++++----- | ||
21 | 4 files changed, 12 insertions(+), 22 deletions(-) | ||
22 | |||
23 | diff --git a/target/arm/translate-a64.h b/target/arm/translate-a64.h | ||
24 | index XXXXXXX..XXXXXXX 100644 | ||
25 | --- a/target/arm/translate-a64.h | ||
26 | +++ b/target/arm/translate-a64.h | ||
27 | @@ -XXX,XX +XXX,XX @@ | ||
28 | #ifndef TARGET_ARM_TRANSLATE_A64_H | ||
29 | #define TARGET_ARM_TRANSLATE_A64_H | ||
30 | |||
31 | -void unallocated_encoding(DisasContext *s); | ||
32 | - | ||
33 | #define unsupported_encoding(s, insn) \ | ||
34 | do { \ | ||
35 | qemu_log_mask(LOG_UNIMP, \ | ||
36 | diff --git a/target/arm/translate.h b/target/arm/translate.h | ||
37 | index XXXXXXX..XXXXXXX 100644 | ||
38 | --- a/target/arm/translate.h | ||
39 | +++ b/target/arm/translate.h | ||
40 | @@ -XXX,XX +XXX,XX @@ void arm_free_cc(DisasCompare *cmp); | ||
41 | void arm_jump_cc(DisasCompare *cmp, TCGLabel *label); | ||
42 | void arm_gen_test_cc(int cc, TCGLabel *label); | ||
43 | MemOp pow2_align(unsigned i); | ||
44 | +void unallocated_encoding(DisasContext *s); | ||
45 | +void gen_exception_insn(DisasContext *s, uint64_t pc, int excp, | ||
46 | + uint32_t syn, uint32_t target_el); | ||
47 | |||
48 | /* Return state of Alternate Half-precision flag, caller frees result */ | ||
49 | static inline TCGv_i32 get_ahp_flag(void) | ||
50 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c | 10 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c |
51 | index XXXXXXX..XXXXXXX 100644 | 11 | index XXXXXXX..XXXXXXX 100644 |
52 | --- a/target/arm/translate-a64.c | 12 | --- a/target/arm/translate-a64.c |
53 | +++ b/target/arm/translate-a64.c | 13 | +++ b/target/arm/translate-a64.c |
54 | @@ -XXX,XX +XXX,XX @@ static void gen_exception_internal_insn(DisasContext *s, uint64_t pc, int excp) | 14 | @@ -XXX,XX +XXX,XX @@ static void aarch64_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) |
55 | s->base.is_jmp = DISAS_NORETURN; | ||
56 | } | ||
57 | |||
58 | -static void gen_exception_insn(DisasContext *s, uint64_t pc, int excp, | ||
59 | - uint32_t syndrome, uint32_t target_el) | ||
60 | -{ | ||
61 | - gen_a64_set_pc_im(pc); | ||
62 | - gen_exception(excp, syndrome, target_el); | ||
63 | - s->base.is_jmp = DISAS_NORETURN; | ||
64 | -} | ||
65 | - | ||
66 | static void gen_exception_bkpt_insn(DisasContext *s, uint32_t syndrome) | ||
67 | { | 15 | { |
68 | TCGv_i32 tcg_syn; | 16 | DisasContext *s = container_of(dcbase, DisasContext, base); |
69 | @@ -XXX,XX +XXX,XX @@ static inline void gen_goto_tb(DisasContext *s, int n, uint64_t dest) | 17 | CPUARMState *env = cpu->env_ptr; |
18 | + uint64_t pc = s->base.pc_next; | ||
19 | uint32_t insn; | ||
20 | |||
21 | if (s->ss_active && !s->pstate_ss) { | ||
22 | @@ -XXX,XX +XXX,XX @@ static void aarch64_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) | ||
23 | return; | ||
70 | } | 24 | } |
71 | } | 25 | |
72 | 26 | - s->pc_curr = s->base.pc_next; | |
73 | -void unallocated_encoding(DisasContext *s) | 27 | - insn = arm_ldl_code(env, &s->base, s->base.pc_next, s->sctlr_b); |
74 | -{ | 28 | + s->pc_curr = pc; |
75 | - /* Unallocated and reserved encodings are uncategorized */ | 29 | + insn = arm_ldl_code(env, &s->base, pc, s->sctlr_b); |
76 | - gen_exception_insn(s, s->pc_curr, EXCP_UDEF, syn_uncategorized(), | 30 | s->insn = insn; |
77 | - default_exception_el(s)); | 31 | - s->base.pc_next += 4; |
78 | -} | 32 | + s->base.pc_next = pc + 4; |
79 | - | 33 | |
80 | static void init_tmp_a64_array(DisasContext *s) | 34 | s->fp_access_checked = false; |
81 | { | 35 | s->sve_access_checked = false; |
82 | #ifdef CONFIG_DEBUG_TCG | ||
83 | diff --git a/target/arm/translate.c b/target/arm/translate.c | ||
84 | index XXXXXXX..XXXXXXX 100644 | ||
85 | --- a/target/arm/translate.c | ||
86 | +++ b/target/arm/translate.c | ||
87 | @@ -XXX,XX +XXX,XX @@ static void gen_exception_internal_insn(DisasContext *s, uint32_t pc, int excp) | ||
88 | s->base.is_jmp = DISAS_NORETURN; | ||
89 | } | ||
90 | |||
91 | -static void gen_exception_insn(DisasContext *s, uint32_t pc, int excp, | ||
92 | - int syn, uint32_t target_el) | ||
93 | +void gen_exception_insn(DisasContext *s, uint64_t pc, int excp, | ||
94 | + uint32_t syn, uint32_t target_el) | ||
95 | { | ||
96 | - gen_set_condexec(s); | ||
97 | - gen_set_pc_im(s, pc); | ||
98 | + if (s->aarch64) { | ||
99 | + gen_a64_set_pc_im(pc); | ||
100 | + } else { | ||
101 | + gen_set_condexec(s); | ||
102 | + gen_set_pc_im(s, pc); | ||
103 | + } | ||
104 | gen_exception(excp, syn, target_el); | ||
105 | s->base.is_jmp = DISAS_NORETURN; | ||
106 | } | ||
107 | @@ -XXX,XX +XXX,XX @@ static void gen_exception_bkpt_insn(DisasContext *s, uint32_t syn) | ||
108 | s->base.is_jmp = DISAS_NORETURN; | ||
109 | } | ||
110 | |||
111 | -static void unallocated_encoding(DisasContext *s) | ||
112 | +void unallocated_encoding(DisasContext *s) | ||
113 | { | ||
114 | /* Unallocated and reserved encodings are uncategorized */ | ||
115 | gen_exception_insn(s, s->pc_curr, EXCP_UDEF, syn_uncategorized(), | ||
116 | -- | 36 | -- |
117 | 2.20.1 | 37 | 2.25.1 |
118 | 38 | ||
119 | 39 | diff view generated by jsdifflib |
1 | The VFPGenFixPointFn typedef is unused; delete it. | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
4 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
3 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 5 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
4 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
5 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
6 | Message-id: 20210430132740.10391-11-peter.maydell@linaro.org | ||
7 | --- | 6 | --- |
8 | target/arm/translate.c | 2 -- | 7 | target/arm/translate.c | 9 +++++---- |
9 | 1 file changed, 2 deletions(-) | 8 | 1 file changed, 5 insertions(+), 4 deletions(-) |
10 | 9 | ||
11 | diff --git a/target/arm/translate.c b/target/arm/translate.c | 10 | diff --git a/target/arm/translate.c b/target/arm/translate.c |
12 | index XXXXXXX..XXXXXXX 100644 | 11 | index XXXXXXX..XXXXXXX 100644 |
13 | --- a/target/arm/translate.c | 12 | --- a/target/arm/translate.c |
14 | +++ b/target/arm/translate.c | 13 | +++ b/target/arm/translate.c |
15 | @@ -XXX,XX +XXX,XX @@ static const char * const regnames[] = | 14 | @@ -XXX,XX +XXX,XX @@ static void arm_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) |
16 | /* Function prototypes for gen_ functions calling Neon helpers. */ | 15 | { |
17 | typedef void NeonGenThreeOpEnvFn(TCGv_i32, TCGv_env, TCGv_i32, | 16 | DisasContext *dc = container_of(dcbase, DisasContext, base); |
18 | TCGv_i32, TCGv_i32); | 17 | CPUARMState *env = cpu->env_ptr; |
19 | -/* Function prototypes for gen_ functions for fix point conversions */ | 18 | + uint32_t pc = dc->base.pc_next; |
20 | -typedef void VFPGenFixPointFn(TCGv_i32, TCGv_i32, TCGv_i32, TCGv_ptr); | 19 | unsigned int insn; |
21 | 20 | ||
22 | /* initialize TCG globals. */ | 21 | if (arm_pre_translate_insn(dc)) { |
23 | void arm_translate_init(void) | 22 | - dc->base.pc_next += 4; |
23 | + dc->base.pc_next = pc + 4; | ||
24 | return; | ||
25 | } | ||
26 | |||
27 | - dc->pc_curr = dc->base.pc_next; | ||
28 | - insn = arm_ldl_code(env, &dc->base, dc->base.pc_next, dc->sctlr_b); | ||
29 | + dc->pc_curr = pc; | ||
30 | + insn = arm_ldl_code(env, &dc->base, pc, dc->sctlr_b); | ||
31 | dc->insn = insn; | ||
32 | - dc->base.pc_next += 4; | ||
33 | + dc->base.pc_next = pc + 4; | ||
34 | disas_arm_insn(dc, insn); | ||
35 | |||
36 | arm_post_translate_insn(dc); | ||
24 | -- | 37 | -- |
25 | 2.20.1 | 38 | 2.25.1 |
26 | 39 | ||
27 | 40 | diff view generated by jsdifflib |
1 | The function vfp_reg_ptr() is used only in translate-neon.c.inc; | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | move it there. | ||
3 | 2 | ||
3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
4 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
4 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 5 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
5 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
6 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Message-id: 20210430132740.10391-10-peter.maydell@linaro.org | ||
8 | --- | 6 | --- |
9 | target/arm/translate.c | 7 ------- | 7 | target/arm/translate.c | 16 ++++++++-------- |
10 | target/arm/translate-neon.c.inc | 7 +++++++ | 8 | 1 file changed, 8 insertions(+), 8 deletions(-) |
11 | 2 files changed, 7 insertions(+), 7 deletions(-) | ||
12 | 9 | ||
13 | diff --git a/target/arm/translate.c b/target/arm/translate.c | 10 | diff --git a/target/arm/translate.c b/target/arm/translate.c |
14 | index XXXXXXX..XXXXXXX 100644 | 11 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/target/arm/translate.c | 12 | --- a/target/arm/translate.c |
16 | +++ b/target/arm/translate.c | 13 | +++ b/target/arm/translate.c |
17 | @@ -XXX,XX +XXX,XX @@ void write_neon_element64(TCGv_i64 src, int reg, int ele, MemOp memop) | 14 | @@ -XXX,XX +XXX,XX @@ static void thumb_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) |
15 | { | ||
16 | DisasContext *dc = container_of(dcbase, DisasContext, base); | ||
17 | CPUARMState *env = cpu->env_ptr; | ||
18 | + uint32_t pc = dc->base.pc_next; | ||
19 | uint32_t insn; | ||
20 | bool is_16bit; | ||
21 | |||
22 | if (arm_pre_translate_insn(dc)) { | ||
23 | - dc->base.pc_next += 2; | ||
24 | + dc->base.pc_next = pc + 2; | ||
25 | return; | ||
18 | } | 26 | } |
19 | } | 27 | |
20 | 28 | - dc->pc_curr = dc->base.pc_next; | |
21 | -static TCGv_ptr vfp_reg_ptr(bool dp, int reg) | 29 | - insn = arm_lduw_code(env, &dc->base, dc->base.pc_next, dc->sctlr_b); |
22 | -{ | 30 | + dc->pc_curr = pc; |
23 | - TCGv_ptr ret = tcg_temp_new_ptr(); | 31 | + insn = arm_lduw_code(env, &dc->base, pc, dc->sctlr_b); |
24 | - tcg_gen_addi_ptr(ret, cpu_env, vfp_reg_offset(dp, reg)); | 32 | is_16bit = thumb_insn_is_16bit(dc, dc->base.pc_next, insn); |
25 | - return ret; | 33 | - dc->base.pc_next += 2; |
26 | -} | 34 | + pc += 2; |
35 | if (!is_16bit) { | ||
36 | - uint32_t insn2 = arm_lduw_code(env, &dc->base, dc->base.pc_next, | ||
37 | - dc->sctlr_b); | ||
27 | - | 38 | - |
28 | #define ARM_CP_RW_BIT (1 << 20) | 39 | + uint32_t insn2 = arm_lduw_code(env, &dc->base, pc, dc->sctlr_b); |
29 | 40 | insn = insn << 16 | insn2; | |
30 | /* Include the Neon decoder */ | 41 | - dc->base.pc_next += 2; |
31 | diff --git a/target/arm/translate-neon.c.inc b/target/arm/translate-neon.c.inc | 42 | + pc += 2; |
32 | index XXXXXXX..XXXXXXX 100644 | 43 | } |
33 | --- a/target/arm/translate-neon.c.inc | 44 | + dc->base.pc_next = pc; |
34 | +++ b/target/arm/translate-neon.c.inc | 45 | dc->insn = insn; |
35 | @@ -XXX,XX +XXX,XX @@ static inline int neon_3same_fp_size(DisasContext *s, int x) | 46 | |
36 | #include "decode-neon-ls.c.inc" | 47 | if (dc->pstate_il) { |
37 | #include "decode-neon-shared.c.inc" | ||
38 | |||
39 | +static TCGv_ptr vfp_reg_ptr(bool dp, int reg) | ||
40 | +{ | ||
41 | + TCGv_ptr ret = tcg_temp_new_ptr(); | ||
42 | + tcg_gen_addi_ptr(ret, cpu_env, vfp_reg_offset(dp, reg)); | ||
43 | + return ret; | ||
44 | +} | ||
45 | + | ||
46 | static void neon_load_element(TCGv_i32 var, int reg, int ele, MemOp mop) | ||
47 | { | ||
48 | long offset = neon_element_offset(reg, ele, mop & MO_SIZE); | ||
49 | -- | 48 | -- |
50 | 2.20.1 | 49 | 2.25.1 |
51 | 50 | ||
52 | 51 | diff view generated by jsdifflib |
1 | Make the remaining functions needed by the translate-neon code | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | global. | ||
3 | 2 | ||
3 | Create arm_check_ss_active and arm_check_kernelpage. | ||
4 | |||
5 | Reverse the order of the tests. While it doesn't matter in practice, | ||
6 | because only user-only has a kernel page and user-only never sets | ||
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> | ||
11 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
4 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
5 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
6 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Message-id: 20210430132740.10391-13-peter.maydell@linaro.org | ||
8 | --- | 13 | --- |
9 | target/arm/translate-a32.h | 8 ++++++++ | 14 | target/arm/translate.c | 10 +++++++--- |
10 | target/arm/translate.c | 10 ++-------- | 15 | 1 file changed, 7 insertions(+), 3 deletions(-) |
11 | 2 files changed, 10 insertions(+), 8 deletions(-) | ||
12 | 16 | ||
13 | diff --git a/target/arm/translate-a32.h b/target/arm/translate-a32.h | ||
14 | index XXXXXXX..XXXXXXX 100644 | ||
15 | --- a/target/arm/translate-a32.h | ||
16 | +++ b/target/arm/translate-a32.h | ||
17 | @@ -XXX,XX +XXX,XX @@ void gen_set_pc_im(DisasContext *s, target_ulong val); | ||
18 | void gen_lookup_tb(DisasContext *s); | ||
19 | long vfp_reg_offset(bool dp, unsigned reg); | ||
20 | long neon_full_reg_offset(unsigned reg); | ||
21 | +long neon_element_offset(int reg, int element, MemOp memop); | ||
22 | +void gen_rev16(TCGv_i32 dest, TCGv_i32 var); | ||
23 | |||
24 | static inline TCGv_i32 load_cpu_offset(int offset) | ||
25 | { | ||
26 | @@ -XXX,XX +XXX,XX @@ DO_GEN_ST(32, MO_UL) | ||
27 | /* Set NZCV flags from the high 4 bits of var. */ | ||
28 | #define gen_set_nzcv(var) gen_set_cpsr(var, CPSR_NZCV) | ||
29 | |||
30 | +/* Swap low and high halfwords. */ | ||
31 | +static inline void gen_swap_half(TCGv_i32 dest, TCGv_i32 var) | ||
32 | +{ | ||
33 | + tcg_gen_rotri_i32(dest, var, 16); | ||
34 | +} | ||
35 | + | ||
36 | #endif | ||
37 | diff --git a/target/arm/translate.c b/target/arm/translate.c | 17 | diff --git a/target/arm/translate.c b/target/arm/translate.c |
38 | index XXXXXXX..XXXXXXX 100644 | 18 | index XXXXXXX..XXXXXXX 100644 |
39 | --- a/target/arm/translate.c | 19 | --- a/target/arm/translate.c |
40 | +++ b/target/arm/translate.c | 20 | +++ b/target/arm/translate.c |
41 | @@ -XXX,XX +XXX,XX @@ static void gen_smul_dual(TCGv_i32 a, TCGv_i32 b) | 21 | @@ -XXX,XX +XXX,XX @@ static void arm_tr_insn_start(DisasContextBase *dcbase, CPUState *cpu) |
22 | dc->insn_start = tcg_last_op(); | ||
42 | } | 23 | } |
43 | 24 | ||
44 | /* Byteswap each halfword. */ | 25 | -static bool arm_pre_translate_insn(DisasContext *dc) |
45 | -static void gen_rev16(TCGv_i32 dest, TCGv_i32 var) | 26 | +static bool arm_check_kernelpage(DisasContext *dc) |
46 | +void gen_rev16(TCGv_i32 dest, TCGv_i32 var) | ||
47 | { | 27 | { |
48 | TCGv_i32 tmp = tcg_temp_new_i32(); | 28 | #ifdef CONFIG_USER_ONLY |
49 | TCGv_i32 mask = tcg_const_i32(0x00ff00ff); | 29 | /* Intercept jump to the magic kernel page. */ |
50 | @@ -XXX,XX +XXX,XX @@ static void gen_revsh(TCGv_i32 dest, TCGv_i32 var) | 30 | @@ -XXX,XX +XXX,XX @@ static bool arm_pre_translate_insn(DisasContext *dc) |
51 | tcg_gen_ext16s_i32(dest, var); | 31 | return true; |
52 | } | 32 | } |
53 | 33 | #endif | |
54 | -/* Swap low and high halfwords. */ | 34 | + return false; |
55 | -static void gen_swap_half(TCGv_i32 dest, TCGv_i32 var) | 35 | +} |
56 | -{ | 36 | |
57 | - tcg_gen_rotri_i32(dest, var, 16); | 37 | +static bool arm_check_ss_active(DisasContext *dc) |
58 | -} | 38 | +{ |
59 | - | 39 | if (dc->ss_active && !dc->pstate_ss) { |
60 | /* Dual 16-bit add. Result placed in t0 and t1 is marked as dead. | 40 | /* Singlestep state is Active-pending. |
61 | tmp = (t0 ^ t1) & 0x8000; | 41 | * If we're in this state at the start of a TB then either |
62 | t0 &= ~0x8000; | 42 | @@ -XXX,XX +XXX,XX @@ static void arm_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) |
63 | @@ -XXX,XX +XXX,XX @@ long neon_full_reg_offset(unsigned reg) | 43 | uint32_t pc = dc->base.pc_next; |
64 | * Return the offset of a 2**SIZE piece of a NEON register, at index ELE, | 44 | unsigned int insn; |
65 | * where 0 is the least significant end of the register. | 45 | |
66 | */ | 46 | - if (arm_pre_translate_insn(dc)) { |
67 | -static long neon_element_offset(int reg, int element, MemOp memop) | 47 | + if (arm_check_ss_active(dc) || arm_check_kernelpage(dc)) { |
68 | +long neon_element_offset(int reg, int element, MemOp memop) | 48 | dc->base.pc_next = pc + 4; |
69 | { | 49 | return; |
70 | int element_size = 1 << (memop & MO_SIZE); | 50 | } |
71 | int ofs = element * element_size; | 51 | @@ -XXX,XX +XXX,XX @@ static void thumb_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) |
52 | uint32_t insn; | ||
53 | bool is_16bit; | ||
54 | |||
55 | - if (arm_pre_translate_insn(dc)) { | ||
56 | + if (arm_check_ss_active(dc) || arm_check_kernelpage(dc)) { | ||
57 | dc->base.pc_next = pc + 2; | ||
58 | return; | ||
59 | } | ||
72 | -- | 60 | -- |
73 | 2.20.1 | 61 | 2.25.1 |
74 | 62 | ||
75 | 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 | These three features are already enabled by TCG, but are missing | 3 | The size of the code covered by a TranslationBlock cannot be 0; |
4 | their hwcap bits. Update HWCAP2 from linux v5.12. | 4 | this is checked via assert in tb_gen_code. |
5 | 5 | ||
6 | Cc: qemu-stable@nongnu.org (for 6.0.1) | ||
7 | Buglink: https://bugs.launchpad.net/bugs/1926044 | ||
8 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
9 | Message-id: 20210427214108.88503-1-richard.henderson@linaro.org | 7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
11 | --- | 9 | --- |
12 | linux-user/elfload.c | 13 +++++++++++++ | 10 | target/arm/translate-a64.c | 1 + |
13 | 1 file changed, 13 insertions(+) | 11 | 1 file changed, 1 insertion(+) |
14 | 12 | ||
15 | diff --git a/linux-user/elfload.c b/linux-user/elfload.c | 13 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c |
16 | index XXXXXXX..XXXXXXX 100644 | 14 | index XXXXXXX..XXXXXXX 100644 |
17 | --- a/linux-user/elfload.c | 15 | --- a/target/arm/translate-a64.c |
18 | +++ b/linux-user/elfload.c | 16 | +++ b/target/arm/translate-a64.c |
19 | @@ -XXX,XX +XXX,XX @@ enum { | 17 | @@ -XXX,XX +XXX,XX @@ static void aarch64_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) |
20 | ARM_HWCAP2_A64_SVESM4 = 1 << 6, | 18 | assert(s->base.num_insns == 1); |
21 | ARM_HWCAP2_A64_FLAGM2 = 1 << 7, | 19 | gen_swstep_exception(s, 0, 0); |
22 | ARM_HWCAP2_A64_FRINT = 1 << 8, | 20 | s->base.is_jmp = DISAS_NORETURN; |
23 | + ARM_HWCAP2_A64_SVEI8MM = 1 << 9, | 21 | + s->base.pc_next = pc + 4; |
24 | + ARM_HWCAP2_A64_SVEF32MM = 1 << 10, | 22 | return; |
25 | + ARM_HWCAP2_A64_SVEF64MM = 1 << 11, | 23 | } |
26 | + ARM_HWCAP2_A64_SVEBF16 = 1 << 12, | 24 | |
27 | + ARM_HWCAP2_A64_I8MM = 1 << 13, | ||
28 | + ARM_HWCAP2_A64_BF16 = 1 << 14, | ||
29 | + ARM_HWCAP2_A64_DGH = 1 << 15, | ||
30 | + ARM_HWCAP2_A64_RNG = 1 << 16, | ||
31 | + ARM_HWCAP2_A64_BTI = 1 << 17, | ||
32 | + ARM_HWCAP2_A64_MTE = 1 << 18, | ||
33 | }; | ||
34 | |||
35 | #define ELF_HWCAP get_elf_hwcap() | ||
36 | @@ -XXX,XX +XXX,XX @@ static uint32_t get_elf_hwcap2(void) | ||
37 | GET_FEATURE_ID(aa64_dcpodp, ARM_HWCAP2_A64_DCPODP); | ||
38 | GET_FEATURE_ID(aa64_condm_5, ARM_HWCAP2_A64_FLAGM2); | ||
39 | GET_FEATURE_ID(aa64_frint, ARM_HWCAP2_A64_FRINT); | ||
40 | + GET_FEATURE_ID(aa64_rndr, ARM_HWCAP2_A64_RNG); | ||
41 | + GET_FEATURE_ID(aa64_bti, ARM_HWCAP2_A64_BTI); | ||
42 | + GET_FEATURE_ID(aa64_mte, ARM_HWCAP2_A64_MTE); | ||
43 | |||
44 | return hwcaps; | ||
45 | } | ||
46 | -- | 25 | -- |
47 | 2.20.1 | 26 | 2.25.1 |
48 | 27 | ||
49 | 28 | diff view generated by jsdifflib |
1 | The omap_mmc_reset() function resets its SD card via | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | device_legacy_reset(). We know that the SD card does not have a qbus | ||
3 | of its own, so the new device_cold_reset() function (which resets | ||
4 | both the device and its child buses) is equivalent here to | ||
5 | device_legacy_reset() and we can just switch to the new API. | ||
6 | 2 | ||
3 | We will reuse this section of arm_deliver_fault for | ||
4 | raising pc alignment faults. | ||
5 | |||
6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
8 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
9 | Message-id: 20210430222348.8514-1-peter.maydell@linaro.org | ||
10 | --- | 9 | --- |
11 | hw/sd/omap_mmc.c | 2 +- | 10 | target/arm/tlb_helper.c | 45 +++++++++++++++++++++++++---------------- |
12 | 1 file changed, 1 insertion(+), 1 deletion(-) | 11 | 1 file changed, 28 insertions(+), 17 deletions(-) |
13 | 12 | ||
14 | diff --git a/hw/sd/omap_mmc.c b/hw/sd/omap_mmc.c | 13 | diff --git a/target/arm/tlb_helper.c b/target/arm/tlb_helper.c |
15 | index XXXXXXX..XXXXXXX 100644 | 14 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/hw/sd/omap_mmc.c | 15 | --- a/target/arm/tlb_helper.c |
17 | +++ b/hw/sd/omap_mmc.c | 16 | +++ b/target/arm/tlb_helper.c |
18 | @@ -XXX,XX +XXX,XX @@ void omap_mmc_reset(struct omap_mmc_s *host) | 17 | @@ -XXX,XX +XXX,XX @@ static inline uint32_t merge_syn_data_abort(uint32_t template_syn, |
19 | * into any bus, and we must reset it manually. When omap_mmc is | 18 | return syn; |
20 | * QOMified this must move into the QOM reset function. | ||
21 | */ | ||
22 | - device_legacy_reset(DEVICE(host->card)); | ||
23 | + device_cold_reset(DEVICE(host->card)); | ||
24 | } | 19 | } |
25 | 20 | ||
26 | static uint64_t omap_mmc_read(void *opaque, hwaddr offset, | 21 | -static void QEMU_NORETURN arm_deliver_fault(ARMCPU *cpu, vaddr addr, |
22 | - MMUAccessType access_type, | ||
23 | - int mmu_idx, ARMMMUFaultInfo *fi) | ||
24 | +static uint32_t compute_fsr_fsc(CPUARMState *env, ARMMMUFaultInfo *fi, | ||
25 | + int target_el, int mmu_idx, uint32_t *ret_fsc) | ||
26 | { | ||
27 | - CPUARMState *env = &cpu->env; | ||
28 | - int target_el; | ||
29 | - bool same_el; | ||
30 | - uint32_t syn, exc, fsr, fsc; | ||
31 | ARMMMUIdx arm_mmu_idx = core_to_arm_mmu_idx(env, mmu_idx); | ||
32 | - | ||
33 | - target_el = exception_target_el(env); | ||
34 | - if (fi->stage2) { | ||
35 | - target_el = 2; | ||
36 | - env->cp15.hpfar_el2 = extract64(fi->s2addr, 12, 47) << 4; | ||
37 | - if (arm_is_secure_below_el3(env) && fi->s1ns) { | ||
38 | - env->cp15.hpfar_el2 |= HPFAR_NS; | ||
39 | - } | ||
40 | - } | ||
41 | - same_el = (arm_current_el(env) == target_el); | ||
42 | + uint32_t fsr, fsc; | ||
43 | |||
44 | if (target_el == 2 || arm_el_is_aa64(env, target_el) || | ||
45 | arm_s1_regime_using_lpae_format(env, arm_mmu_idx)) { | ||
46 | @@ -XXX,XX +XXX,XX @@ static void QEMU_NORETURN arm_deliver_fault(ARMCPU *cpu, vaddr addr, | ||
47 | fsc = 0x3f; | ||
48 | } | ||
49 | |||
50 | + *ret_fsc = fsc; | ||
51 | + return fsr; | ||
52 | +} | ||
53 | + | ||
54 | +static void QEMU_NORETURN arm_deliver_fault(ARMCPU *cpu, vaddr addr, | ||
55 | + MMUAccessType access_type, | ||
56 | + int mmu_idx, ARMMMUFaultInfo *fi) | ||
57 | +{ | ||
58 | + CPUARMState *env = &cpu->env; | ||
59 | + int target_el; | ||
60 | + bool same_el; | ||
61 | + uint32_t syn, exc, fsr, fsc; | ||
62 | + | ||
63 | + target_el = exception_target_el(env); | ||
64 | + if (fi->stage2) { | ||
65 | + target_el = 2; | ||
66 | + env->cp15.hpfar_el2 = extract64(fi->s2addr, 12, 47) << 4; | ||
67 | + if (arm_is_secure_below_el3(env) && fi->s1ns) { | ||
68 | + env->cp15.hpfar_el2 |= HPFAR_NS; | ||
69 | + } | ||
70 | + } | ||
71 | + same_el = (arm_current_el(env) == target_el); | ||
72 | + | ||
73 | + fsr = compute_fsr_fsc(env, fi, target_el, mmu_idx, &fsc); | ||
74 | + | ||
75 | if (access_type == MMU_INST_FETCH) { | ||
76 | syn = syn_insn_abort(same_el, fi->ea, fi->s1ptw, fsc); | ||
77 | exc = EXCP_PREFETCH_ABORT; | ||
27 | -- | 78 | -- |
28 | 2.20.1 | 79 | 2.25.1 |
29 | 80 | ||
30 | 81 | diff view generated by jsdifflib |
1 | Some of the constant expanders defined in translate.c are generically | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | useful and will be used by the separate C files for VFP and Neon once | 2 | |
3 | they are created; move the expander definitions to translate.h. | 3 | For A64, any input to an indirect branch can cause this. |
4 | 4 | ||
5 | For A32, many indirect branch paths force the branch to be aligned, | ||
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> | ||
5 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 17 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
6 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
7 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
8 | Message-id: 20210430132740.10391-2-peter.maydell@linaro.org | ||
9 | --- | 18 | --- |
10 | target/arm/translate.h | 24 ++++++++++++++++++++++++ | 19 | target/arm/helper.h | 1 + |
11 | target/arm/translate.c | 24 ------------------------ | 20 | target/arm/syndrome.h | 5 ++++ |
12 | 2 files changed, 24 insertions(+), 24 deletions(-) | 21 | linux-user/aarch64/cpu_loop.c | 46 ++++++++++++++++++++--------------- |
13 | 22 | target/arm/tlb_helper.c | 18 ++++++++++++++ | |
14 | diff --git a/target/arm/translate.h b/target/arm/translate.h | 23 | target/arm/translate-a64.c | 15 ++++++++++++ |
15 | index XXXXXXX..XXXXXXX 100644 | 24 | target/arm/translate.c | 22 ++++++++++++++++- |
16 | --- a/target/arm/translate.h | 25 | 6 files changed, 87 insertions(+), 20 deletions(-) |
17 | +++ b/target/arm/translate.h | 26 | |
18 | @@ -XXX,XX +XXX,XX @@ extern TCGv_i32 cpu_NF, cpu_ZF, cpu_CF, cpu_VF; | 27 | diff --git a/target/arm/helper.h b/target/arm/helper.h |
19 | extern TCGv_i64 cpu_exclusive_addr; | 28 | index XXXXXXX..XXXXXXX 100644 |
20 | extern TCGv_i64 cpu_exclusive_val; | 29 | --- a/target/arm/helper.h |
21 | 30 | +++ b/target/arm/helper.h | |
22 | +/* | 31 | @@ -XXX,XX +XXX,XX @@ DEF_HELPER_FLAGS_3(sel_flags, TCG_CALL_NO_RWG_SE, |
23 | + * Constant expanders for the decoders. | 32 | DEF_HELPER_2(exception_internal, void, env, i32) |
24 | + */ | 33 | DEF_HELPER_4(exception_with_syndrome, void, env, i32, i32, i32) |
25 | + | 34 | DEF_HELPER_2(exception_bkpt_insn, void, env, i32) |
26 | +static inline int negate(DisasContext *s, int x) | 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 | } | ||
46 | |||
47 | +static inline uint32_t syn_pcalignment(void) | ||
27 | +{ | 48 | +{ |
28 | + return -x; | 49 | + return (EC_PCALIGNMENT << ARM_EL_EC_SHIFT) | ARM_EL_IL; |
29 | +} | 50 | +} |
30 | + | 51 | + |
31 | +static inline int plus_2(DisasContext *s, int x) | 52 | #endif /* TARGET_ARM_SYNDROME_H */ |
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) | ||
32 | +{ | 129 | +{ |
33 | + return x + 2; | 130 | + ARMMMUFaultInfo fi = { .type = ARMFault_Alignment }; |
131 | + int target_el = exception_target_el(env); | ||
132 | + int mmu_idx = cpu_mmu_index(env, true); | ||
133 | + uint32_t fsc; | ||
134 | + | ||
135 | + env->exception.vaddress = pc; | ||
136 | + | ||
137 | + /* | ||
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); | ||
34 | +} | 143 | +} |
35 | + | 144 | + |
36 | +static inline int times_2(DisasContext *s, int x) | 145 | #if !defined(CONFIG_USER_ONLY) |
37 | +{ | 146 | |
38 | + return x * 2; | 147 | /* |
39 | +} | 148 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c |
40 | + | 149 | index XXXXXXX..XXXXXXX 100644 |
41 | +static inline int times_4(DisasContext *s, int x) | 150 | --- a/target/arm/translate-a64.c |
42 | +{ | 151 | +++ b/target/arm/translate-a64.c |
43 | + return x * 4; | 152 | @@ -XXX,XX +XXX,XX @@ static void aarch64_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) |
44 | +} | 153 | uint64_t pc = s->base.pc_next; |
45 | + | 154 | uint32_t insn; |
46 | static inline int arm_dc_feature(DisasContext *dc, int feature) | 155 | |
47 | { | 156 | + /* Singlestep exceptions have the highest priority. */ |
48 | return (dc->features & (1ULL << feature)) != 0; | 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 | + | ||
178 | s->pc_curr = pc; | ||
179 | insn = arm_ldl_code(env, &s->base, pc, s->sctlr_b); | ||
180 | s->insn = insn; | ||
49 | diff --git a/target/arm/translate.c b/target/arm/translate.c | 181 | diff --git a/target/arm/translate.c b/target/arm/translate.c |
50 | index XXXXXXX..XXXXXXX 100644 | 182 | index XXXXXXX..XXXXXXX 100644 |
51 | --- a/target/arm/translate.c | 183 | --- a/target/arm/translate.c |
52 | +++ b/target/arm/translate.c | 184 | +++ b/target/arm/translate.c |
53 | @@ -XXX,XX +XXX,XX @@ static void arm_gen_condlabel(DisasContext *s) | 185 | @@ -XXX,XX +XXX,XX @@ static void arm_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) |
186 | uint32_t pc = dc->base.pc_next; | ||
187 | unsigned int insn; | ||
188 | |||
189 | - if (arm_check_ss_active(dc) || arm_check_kernelpage(dc)) { | ||
190 | + /* Singlestep exceptions have the highest priority. */ | ||
191 | + if (arm_check_ss_active(dc)) { | ||
192 | + dc->base.pc_next = pc + 4; | ||
193 | + return; | ||
194 | + } | ||
195 | + | ||
196 | + if (pc & 3) { | ||
197 | + /* | ||
198 | + * PC alignment fault. This has priority over the instruction abort | ||
199 | + * that we would receive from a translation fault via arm_ldl_code | ||
200 | + * (or the execution of the kernelpage entrypoint). This should only | ||
201 | + * be possible after an indirect branch, at the start of the TB. | ||
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; | ||
54 | } | 213 | } |
55 | } | ||
56 | |||
57 | -/* | ||
58 | - * Constant expanders for the decoders. | ||
59 | - */ | ||
60 | - | ||
61 | -static int negate(DisasContext *s, int x) | ||
62 | -{ | ||
63 | - return -x; | ||
64 | -} | ||
65 | - | ||
66 | -static int plus_2(DisasContext *s, int x) | ||
67 | -{ | ||
68 | - return x + 2; | ||
69 | -} | ||
70 | - | ||
71 | -static int times_2(DisasContext *s, int x) | ||
72 | -{ | ||
73 | - return x * 2; | ||
74 | -} | ||
75 | - | ||
76 | -static int times_4(DisasContext *s, int x) | ||
77 | -{ | ||
78 | - return x * 4; | ||
79 | -} | ||
80 | - | ||
81 | /* Flags for the disas_set_da_iss info argument: | ||
82 | * lower bits hold the Rt register number, higher bits are flags. | ||
83 | */ | ||
84 | -- | 214 | -- |
85 | 2.20.1 | 215 | 2.25.1 |
86 | 216 | ||
87 | 217 | diff view generated by jsdifflib |
1 | Switch translate-neon.c.inc from being #included into translate.c | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | to being its own compilation unit. | ||
3 | 2 | ||
3 | Misaligned thumb PC is architecturally impossible. | ||
4 | Assert is better than proceeding, in case we've missed | ||
5 | something somewhere. | ||
6 | |||
7 | Expand a comment about aligning the pc in gdbstub. | ||
8 | Fail an incoming migrate if a thumb pc is misaligned. | ||
9 | |||
10 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
11 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
4 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
5 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
6 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Message-id: 20210430132740.10391-14-peter.maydell@linaro.org | ||
8 | --- | 13 | --- |
9 | target/arm/translate-a32.h | 3 +++ | 14 | target/arm/gdbstub.c | 9 +++++++-- |
10 | .../arm/{translate-neon.c.inc => translate-neon.c} | 12 +++++++----- | 15 | target/arm/machine.c | 10 ++++++++++ |
11 | target/arm/translate.c | 3 --- | 16 | target/arm/translate.c | 3 +++ |
12 | target/arm/meson.build | 7 ++++--- | 17 | 3 files changed, 20 insertions(+), 2 deletions(-) |
13 | 4 files changed, 14 insertions(+), 11 deletions(-) | ||
14 | rename target/arm/{translate-neon.c.inc => translate-neon.c} (99%) | ||
15 | 18 | ||
16 | diff --git a/target/arm/translate-a32.h b/target/arm/translate-a32.h | 19 | diff --git a/target/arm/gdbstub.c b/target/arm/gdbstub.c |
17 | index XXXXXXX..XXXXXXX 100644 | 20 | index XXXXXXX..XXXXXXX 100644 |
18 | --- a/target/arm/translate-a32.h | 21 | --- a/target/arm/gdbstub.c |
19 | +++ b/target/arm/translate-a32.h | 22 | +++ b/target/arm/gdbstub.c |
20 | @@ -XXX,XX +XXX,XX @@ | 23 | @@ -XXX,XX +XXX,XX @@ int arm_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n) |
21 | bool disas_m_nocp(DisasContext *dc, uint32_t insn); | 24 | |
22 | bool disas_vfp(DisasContext *s, uint32_t insn); | 25 | tmp = ldl_p(mem_buf); |
23 | bool disas_vfp_uncond(DisasContext *s, uint32_t insn); | 26 | |
24 | +bool disas_neon_dp(DisasContext *s, uint32_t insn); | 27 | - /* Mask out low bit of PC to workaround gdb bugs. This will probably |
25 | +bool disas_neon_ls(DisasContext *s, uint32_t insn); | 28 | - cause problems if we ever implement the Jazelle DBX extensions. */ |
26 | +bool disas_neon_shared(DisasContext *s, uint32_t insn); | 29 | + /* |
27 | 30 | + * Mask out low bits of PC to workaround gdb bugs. | |
28 | void load_reg_var(DisasContext *s, TCGv_i32 var, int reg); | 31 | + * This avoids an assert in thumb_tr_translate_insn, because it is |
29 | void arm_gen_condlabel(DisasContext *s); | 32 | + * architecturally impossible to misalign the pc. |
30 | diff --git a/target/arm/translate-neon.c.inc b/target/arm/translate-neon.c | 33 | + * This will probably cause problems if we ever implement the |
31 | similarity index 99% | 34 | + * Jazelle DBX extensions. |
32 | rename from target/arm/translate-neon.c.inc | 35 | + */ |
33 | rename to target/arm/translate-neon.c | 36 | if (n == 15) { |
37 | tmp &= ~1; | ||
38 | } | ||
39 | diff --git a/target/arm/machine.c b/target/arm/machine.c | ||
34 | index XXXXXXX..XXXXXXX 100644 | 40 | index XXXXXXX..XXXXXXX 100644 |
35 | --- a/target/arm/translate-neon.c.inc | 41 | --- a/target/arm/machine.c |
36 | +++ b/target/arm/translate-neon.c | 42 | +++ b/target/arm/machine.c |
37 | @@ -XXX,XX +XXX,XX @@ | 43 | @@ -XXX,XX +XXX,XX @@ static int cpu_post_load(void *opaque, int version_id) |
38 | * License along with this library; if not, see <http://www.gnu.org/licenses/>. | 44 | return -1; |
39 | */ | 45 | } |
40 | 46 | } | |
41 | -/* | 47 | + |
42 | - * This file is intended to be included from translate.c; it uses | 48 | + /* |
43 | - * some macros and definitions provided by that file. | 49 | + * Misaligned thumb pc is architecturally impossible. |
44 | - * It might be possible to convert it to a standalone .c file eventually. | 50 | + * We have an assert in thumb_tr_translate_insn to verify this. |
45 | - */ | 51 | + * Fail an incoming migrate to avoid this assert. |
46 | +#include "qemu/osdep.h" | 52 | + */ |
47 | +#include "tcg/tcg-op.h" | 53 | + if (!is_a64(env) && env->thumb && (env->regs[15] & 1)) { |
48 | +#include "tcg/tcg-op-gvec.h" | 54 | + return -1; |
49 | +#include "exec/exec-all.h" | 55 | + } |
50 | +#include "exec/gen-icount.h" | 56 | + |
51 | +#include "translate.h" | 57 | if (!kvm_enabled()) { |
52 | +#include "translate-a32.h" | 58 | pmu_op_finish(&cpu->env); |
53 | 59 | } | |
54 | static inline int plus1(DisasContext *s, int x) | ||
55 | { | ||
56 | diff --git a/target/arm/translate.c b/target/arm/translate.c | 60 | diff --git a/target/arm/translate.c b/target/arm/translate.c |
57 | index XXXXXXX..XXXXXXX 100644 | 61 | index XXXXXXX..XXXXXXX 100644 |
58 | --- a/target/arm/translate.c | 62 | --- a/target/arm/translate.c |
59 | +++ b/target/arm/translate.c | 63 | +++ b/target/arm/translate.c |
60 | @@ -XXX,XX +XXX,XX @@ void write_neon_element64(TCGv_i64 src, int reg, int ele, MemOp memop) | 64 | @@ -XXX,XX +XXX,XX @@ static void thumb_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) |
61 | 65 | uint32_t insn; | |
62 | #define ARM_CP_RW_BIT (1 << 20) | 66 | bool is_16bit; |
63 | 67 | ||
64 | -/* Include the Neon decoder */ | 68 | + /* Misaligned thumb PC is architecturally impossible. */ |
65 | -#include "translate-neon.c.inc" | 69 | + assert((dc->base.pc_next & 1) == 0); |
66 | - | 70 | + |
67 | static inline void iwmmxt_load_reg(TCGv_i64 var, int reg) | 71 | if (arm_check_ss_active(dc) || arm_check_kernelpage(dc)) { |
68 | { | 72 | dc->base.pc_next = pc + 2; |
69 | tcg_gen_ld_i64(var, cpu_env, offsetof(CPUARMState, iwmmxt.regs[reg])); | 73 | return; |
70 | diff --git a/target/arm/meson.build b/target/arm/meson.build | ||
71 | index XXXXXXX..XXXXXXX 100644 | ||
72 | --- a/target/arm/meson.build | ||
73 | +++ b/target/arm/meson.build | ||
74 | @@ -XXX,XX +XXX,XX @@ | ||
75 | gen = [ | ||
76 | decodetree.process('sve.decode', extra_args: '--decode=disas_sve'), | ||
77 | - decodetree.process('neon-shared.decode', extra_args: '--static-decode=disas_neon_shared'), | ||
78 | - decodetree.process('neon-dp.decode', extra_args: '--static-decode=disas_neon_dp'), | ||
79 | - decodetree.process('neon-ls.decode', extra_args: '--static-decode=disas_neon_ls'), | ||
80 | + decodetree.process('neon-shared.decode', extra_args: '--decode=disas_neon_shared'), | ||
81 | + decodetree.process('neon-dp.decode', extra_args: '--decode=disas_neon_dp'), | ||
82 | + decodetree.process('neon-ls.decode', extra_args: '--decode=disas_neon_ls'), | ||
83 | decodetree.process('vfp.decode', extra_args: '--decode=disas_vfp'), | ||
84 | decodetree.process('vfp-uncond.decode', extra_args: '--decode=disas_vfp_uncond'), | ||
85 | decodetree.process('m-nocp.decode', extra_args: '--decode=disas_m_nocp'), | ||
86 | @@ -XXX,XX +XXX,XX @@ arm_ss.add(files( | ||
87 | 'tlb_helper.c', | ||
88 | 'translate.c', | ||
89 | 'translate-m-nocp.c', | ||
90 | + 'translate-neon.c', | ||
91 | 'translate-vfp.c', | ||
92 | 'vec_helper.c', | ||
93 | 'vfp_helper.c', | ||
94 | -- | 74 | -- |
95 | 2.20.1 | 75 | 2.25.1 |
96 | 76 | ||
97 | 77 | diff view generated by jsdifflib |
1 | Currently the trans functions for m-nocp.decode all live in | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | translate-vfp.inc.c; move them out into their own translation unit, | ||
3 | translate-m-nocp.c. | ||
4 | 2 | ||
5 | The trans_* functions here are pure code motion with no changes. | 3 | Both single-step and pc alignment faults have priority over |
4 | breakpoint exceptions. | ||
6 | 5 | ||
6 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
8 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
9 | Message-id: 20210430132740.10391-5-peter.maydell@linaro.org | ||
10 | --- | 9 | --- |
11 | target/arm/translate-a32.h | 3 + | 10 | target/arm/debug_helper.c | 23 +++++++++++++++++++++++ |
12 | target/arm/translate-m-nocp.c | 221 +++++++++++++++++++++++++++++++++ | 11 | 1 file changed, 23 insertions(+) |
13 | target/arm/translate.c | 1 - | ||
14 | target/arm/translate-vfp.c.inc | 196 ----------------------------- | ||
15 | target/arm/meson.build | 3 +- | ||
16 | 5 files changed, 226 insertions(+), 198 deletions(-) | ||
17 | create mode 100644 target/arm/translate-m-nocp.c | ||
18 | 12 | ||
19 | diff --git a/target/arm/translate-a32.h b/target/arm/translate-a32.h | 13 | diff --git a/target/arm/debug_helper.c b/target/arm/debug_helper.c |
20 | index XXXXXXX..XXXXXXX 100644 | 14 | index XXXXXXX..XXXXXXX 100644 |
21 | --- a/target/arm/translate-a32.h | 15 | --- a/target/arm/debug_helper.c |
22 | +++ b/target/arm/translate-a32.h | 16 | +++ b/target/arm/debug_helper.c |
23 | @@ -XXX,XX +XXX,XX @@ | 17 | @@ -XXX,XX +XXX,XX @@ bool arm_debug_check_breakpoint(CPUState *cs) |
24 | #ifndef TARGET_ARM_TRANSLATE_A64_H | 18 | { |
25 | #define TARGET_ARM_TRANSLATE_A64_H | 19 | ARMCPU *cpu = ARM_CPU(cs); |
26 | 20 | CPUARMState *env = &cpu->env; | |
27 | +/* Prototypes for autogenerated disassembler functions */ | 21 | + target_ulong pc; |
28 | +bool disas_m_nocp(DisasContext *dc, uint32_t insn); | 22 | int n; |
29 | + | 23 | |
30 | void load_reg_var(DisasContext *s, TCGv_i32 var, int reg); | 24 | /* |
31 | void arm_gen_condlabel(DisasContext *s); | 25 | @@ -XXX,XX +XXX,XX @@ bool arm_debug_check_breakpoint(CPUState *cs) |
32 | bool vfp_access_check(DisasContext *s); | 26 | return false; |
33 | diff --git a/target/arm/translate-m-nocp.c b/target/arm/translate-m-nocp.c | 27 | } |
34 | new file mode 100644 | 28 | |
35 | index XXXXXXX..XXXXXXX | 29 | + /* |
36 | --- /dev/null | 30 | + * Single-step exceptions have priority over breakpoint exceptions. |
37 | +++ b/target/arm/translate-m-nocp.c | 31 | + * If single-step state is active-pending, suppress the bp. |
38 | @@ -XXX,XX +XXX,XX @@ | 32 | + */ |
39 | +/* | 33 | + if (arm_singlestep_active(env) && !(env->pstate & PSTATE_SS)) { |
40 | + * ARM translation: M-profile NOCP special-case instructions | ||
41 | + * | ||
42 | + * Copyright (c) 2020 Linaro, Ltd. | ||
43 | + * | ||
44 | + * This library is free software; you can redistribute it and/or | ||
45 | + * modify it under the terms of the GNU Lesser General Public | ||
46 | + * License as published by the Free Software Foundation; either | ||
47 | + * version 2.1 of the License, or (at your option) any later version. | ||
48 | + * | ||
49 | + * This library is distributed in the hope that it will be useful, | ||
50 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
51 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
52 | + * Lesser General Public License for more details. | ||
53 | + * | ||
54 | + * You should have received a copy of the GNU Lesser General Public | ||
55 | + * License along with this library; if not, see <http://www.gnu.org/licenses/>. | ||
56 | + */ | ||
57 | + | ||
58 | +#include "qemu/osdep.h" | ||
59 | +#include "tcg/tcg-op.h" | ||
60 | +#include "translate.h" | ||
61 | +#include "translate-a32.h" | ||
62 | + | ||
63 | +#include "decode-m-nocp.c.inc" | ||
64 | + | ||
65 | +/* | ||
66 | + * Decode VLLDM and VLSTM are nonstandard because: | ||
67 | + * * if there is no FPU then these insns must NOP in | ||
68 | + * Secure state and UNDEF in Nonsecure state | ||
69 | + * * if there is an FPU then these insns do not have | ||
70 | + * the usual behaviour that vfp_access_check() provides of | ||
71 | + * being controlled by CPACR/NSACR enable bits or the | ||
72 | + * lazy-stacking logic. | ||
73 | + */ | ||
74 | +static bool trans_VLLDM_VLSTM(DisasContext *s, arg_VLLDM_VLSTM *a) | ||
75 | +{ | ||
76 | + TCGv_i32 fptr; | ||
77 | + | ||
78 | + if (!arm_dc_feature(s, ARM_FEATURE_M) || | ||
79 | + !arm_dc_feature(s, ARM_FEATURE_V8)) { | ||
80 | + return false; | 34 | + return false; |
81 | + } | 35 | + } |
82 | + | 36 | + |
83 | + if (a->op) { | 37 | + /* |
84 | + /* | 38 | + * PC alignment faults have priority over breakpoint exceptions. |
85 | + * T2 encoding ({D0-D31} reglist): v8.1M and up. We choose not | 39 | + */ |
86 | + * to take the IMPDEF option to make memory accesses to the stack | 40 | + pc = is_a64(env) ? env->pc : env->regs[15]; |
87 | + * slots that correspond to the D16-D31 registers (discarding | 41 | + if ((is_a64(env) || !env->thumb) && (pc & 3) != 0) { |
88 | + * read data and writing UNKNOWN values), so for us the T2 | 42 | + return false; |
89 | + * encoding behaves identically to the T1 encoding. | ||
90 | + */ | ||
91 | + if (!arm_dc_feature(s, ARM_FEATURE_V8_1M)) { | ||
92 | + return false; | ||
93 | + } | ||
94 | + } else { | ||
95 | + /* | ||
96 | + * T1 encoding ({D0-D15} reglist); undef if we have 32 Dregs. | ||
97 | + * This is currently architecturally impossible, but we add the | ||
98 | + * check to stay in line with the pseudocode. Note that we must | ||
99 | + * emit code for the UNDEF so it takes precedence over the NOCP. | ||
100 | + */ | ||
101 | + if (dc_isar_feature(aa32_simd_r32, s)) { | ||
102 | + unallocated_encoding(s); | ||
103 | + return true; | ||
104 | + } | ||
105 | + } | 43 | + } |
106 | + | 44 | + |
107 | + /* | 45 | + /* |
108 | + * If not secure, UNDEF. We must emit code for this | 46 | + * Instruction aborts have priority over breakpoint exceptions. |
109 | + * rather than returning false so that this takes | 47 | + * TODO: We would need to look up the page for PC and verify that |
110 | + * precedence over the m-nocp.decode NOCP fallback. | 48 | + * it is present and executable. |
111 | + */ | 49 | + */ |
112 | + if (!s->v8m_secure) { | ||
113 | + unallocated_encoding(s); | ||
114 | + return true; | ||
115 | + } | ||
116 | + /* If no fpu, NOP. */ | ||
117 | + if (!dc_isar_feature(aa32_vfp, s)) { | ||
118 | + return true; | ||
119 | + } | ||
120 | + | 50 | + |
121 | + fptr = load_reg(s, a->rn); | 51 | for (n = 0; n < ARRAY_SIZE(env->cpu_breakpoint); n++) { |
122 | + if (a->l) { | 52 | if (bp_wp_matches(cpu, n, false)) { |
123 | + gen_helper_v7m_vlldm(cpu_env, fptr); | 53 | return true; |
124 | + } else { | ||
125 | + gen_helper_v7m_vlstm(cpu_env, fptr); | ||
126 | + } | ||
127 | + tcg_temp_free_i32(fptr); | ||
128 | + | ||
129 | + /* End the TB, because we have updated FP control bits */ | ||
130 | + s->base.is_jmp = DISAS_UPDATE_EXIT; | ||
131 | + return true; | ||
132 | +} | ||
133 | + | ||
134 | +static bool trans_VSCCLRM(DisasContext *s, arg_VSCCLRM *a) | ||
135 | +{ | ||
136 | + int btmreg, topreg; | ||
137 | + TCGv_i64 zero; | ||
138 | + TCGv_i32 aspen, sfpa; | ||
139 | + | ||
140 | + if (!dc_isar_feature(aa32_m_sec_state, s)) { | ||
141 | + /* Before v8.1M, fall through in decode to NOCP check */ | ||
142 | + return false; | ||
143 | + } | ||
144 | + | ||
145 | + /* Explicitly UNDEF because this takes precedence over NOCP */ | ||
146 | + if (!arm_dc_feature(s, ARM_FEATURE_M_MAIN) || !s->v8m_secure) { | ||
147 | + unallocated_encoding(s); | ||
148 | + return true; | ||
149 | + } | ||
150 | + | ||
151 | + if (!dc_isar_feature(aa32_vfp_simd, s)) { | ||
152 | + /* NOP if we have neither FP nor MVE */ | ||
153 | + return true; | ||
154 | + } | ||
155 | + | ||
156 | + /* | ||
157 | + * If FPCCR.ASPEN != 0 && CONTROL_S.SFPA == 0 then there is no | ||
158 | + * active floating point context so we must NOP (without doing | ||
159 | + * any lazy state preservation or the NOCP check). | ||
160 | + */ | ||
161 | + aspen = load_cpu_field(v7m.fpccr[M_REG_S]); | ||
162 | + sfpa = load_cpu_field(v7m.control[M_REG_S]); | ||
163 | + tcg_gen_andi_i32(aspen, aspen, R_V7M_FPCCR_ASPEN_MASK); | ||
164 | + tcg_gen_xori_i32(aspen, aspen, R_V7M_FPCCR_ASPEN_MASK); | ||
165 | + tcg_gen_andi_i32(sfpa, sfpa, R_V7M_CONTROL_SFPA_MASK); | ||
166 | + tcg_gen_or_i32(sfpa, sfpa, aspen); | ||
167 | + arm_gen_condlabel(s); | ||
168 | + tcg_gen_brcondi_i32(TCG_COND_EQ, sfpa, 0, s->condlabel); | ||
169 | + | ||
170 | + if (s->fp_excp_el != 0) { | ||
171 | + gen_exception_insn(s, s->pc_curr, EXCP_NOCP, | ||
172 | + syn_uncategorized(), s->fp_excp_el); | ||
173 | + return true; | ||
174 | + } | ||
175 | + | ||
176 | + topreg = a->vd + a->imm - 1; | ||
177 | + btmreg = a->vd; | ||
178 | + | ||
179 | + /* Convert to Sreg numbers if the insn specified in Dregs */ | ||
180 | + if (a->size == 3) { | ||
181 | + topreg = topreg * 2 + 1; | ||
182 | + btmreg *= 2; | ||
183 | + } | ||
184 | + | ||
185 | + if (topreg > 63 || (topreg > 31 && !(topreg & 1))) { | ||
186 | + /* UNPREDICTABLE: we choose to undef */ | ||
187 | + unallocated_encoding(s); | ||
188 | + return true; | ||
189 | + } | ||
190 | + | ||
191 | + /* Silently ignore requests to clear D16-D31 if they don't exist */ | ||
192 | + if (topreg > 31 && !dc_isar_feature(aa32_simd_r32, s)) { | ||
193 | + topreg = 31; | ||
194 | + } | ||
195 | + | ||
196 | + if (!vfp_access_check(s)) { | ||
197 | + return true; | ||
198 | + } | ||
199 | + | ||
200 | + /* Zero the Sregs from btmreg to topreg inclusive. */ | ||
201 | + zero = tcg_const_i64(0); | ||
202 | + if (btmreg & 1) { | ||
203 | + write_neon_element64(zero, btmreg >> 1, 1, MO_32); | ||
204 | + btmreg++; | ||
205 | + } | ||
206 | + for (; btmreg + 1 <= topreg; btmreg += 2) { | ||
207 | + write_neon_element64(zero, btmreg >> 1, 0, MO_64); | ||
208 | + } | ||
209 | + if (btmreg == topreg) { | ||
210 | + write_neon_element64(zero, btmreg >> 1, 0, MO_32); | ||
211 | + btmreg++; | ||
212 | + } | ||
213 | + assert(btmreg == topreg + 1); | ||
214 | + /* TODO: when MVE is implemented, zero VPR here */ | ||
215 | + return true; | ||
216 | +} | ||
217 | + | ||
218 | +static bool trans_NOCP(DisasContext *s, arg_nocp *a) | ||
219 | +{ | ||
220 | + /* | ||
221 | + * Handle M-profile early check for disabled coprocessor: | ||
222 | + * all we need to do here is emit the NOCP exception if | ||
223 | + * the coprocessor is disabled. Otherwise we return false | ||
224 | + * and the real VFP/etc decode will handle the insn. | ||
225 | + */ | ||
226 | + assert(arm_dc_feature(s, ARM_FEATURE_M)); | ||
227 | + | ||
228 | + if (a->cp == 11) { | ||
229 | + a->cp = 10; | ||
230 | + } | ||
231 | + if (arm_dc_feature(s, ARM_FEATURE_V8_1M) && | ||
232 | + (a->cp == 8 || a->cp == 9 || a->cp == 14 || a->cp == 15)) { | ||
233 | + /* in v8.1M cp 8, 9, 14, 15 also are governed by the cp10 enable */ | ||
234 | + a->cp = 10; | ||
235 | + } | ||
236 | + | ||
237 | + if (a->cp != 10) { | ||
238 | + gen_exception_insn(s, s->pc_curr, EXCP_NOCP, | ||
239 | + syn_uncategorized(), default_exception_el(s)); | ||
240 | + return true; | ||
241 | + } | ||
242 | + | ||
243 | + if (s->fp_excp_el != 0) { | ||
244 | + gen_exception_insn(s, s->pc_curr, EXCP_NOCP, | ||
245 | + syn_uncategorized(), s->fp_excp_el); | ||
246 | + return true; | ||
247 | + } | ||
248 | + | ||
249 | + return false; | ||
250 | +} | ||
251 | + | ||
252 | +static bool trans_NOCP_8_1(DisasContext *s, arg_nocp *a) | ||
253 | +{ | ||
254 | + /* This range needs a coprocessor check for v8.1M and later only */ | ||
255 | + if (!arm_dc_feature(s, ARM_FEATURE_V8_1M)) { | ||
256 | + return false; | ||
257 | + } | ||
258 | + return trans_NOCP(s, a); | ||
259 | +} | ||
260 | diff --git a/target/arm/translate.c b/target/arm/translate.c | ||
261 | index XXXXXXX..XXXXXXX 100644 | ||
262 | --- a/target/arm/translate.c | ||
263 | +++ b/target/arm/translate.c | ||
264 | @@ -XXX,XX +XXX,XX @@ static TCGv_ptr vfp_reg_ptr(bool dp, int reg) | ||
265 | #define ARM_CP_RW_BIT (1 << 20) | ||
266 | |||
267 | /* Include the VFP and Neon decoders */ | ||
268 | -#include "decode-m-nocp.c.inc" | ||
269 | #include "translate-vfp.c.inc" | ||
270 | #include "translate-neon.c.inc" | ||
271 | |||
272 | diff --git a/target/arm/translate-vfp.c.inc b/target/arm/translate-vfp.c.inc | ||
273 | index XXXXXXX..XXXXXXX 100644 | ||
274 | --- a/target/arm/translate-vfp.c.inc | ||
275 | +++ b/target/arm/translate-vfp.c.inc | ||
276 | @@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_dp_int(DisasContext *s, arg_VCVT_dp_int *a) | ||
277 | return true; | ||
278 | } | ||
279 | |||
280 | -/* | ||
281 | - * Decode VLLDM and VLSTM are nonstandard because: | ||
282 | - * * if there is no FPU then these insns must NOP in | ||
283 | - * Secure state and UNDEF in Nonsecure state | ||
284 | - * * if there is an FPU then these insns do not have | ||
285 | - * the usual behaviour that vfp_access_check() provides of | ||
286 | - * being controlled by CPACR/NSACR enable bits or the | ||
287 | - * lazy-stacking logic. | ||
288 | - */ | ||
289 | -static bool trans_VLLDM_VLSTM(DisasContext *s, arg_VLLDM_VLSTM *a) | ||
290 | -{ | ||
291 | - TCGv_i32 fptr; | ||
292 | - | ||
293 | - if (!arm_dc_feature(s, ARM_FEATURE_M) || | ||
294 | - !arm_dc_feature(s, ARM_FEATURE_V8)) { | ||
295 | - return false; | ||
296 | - } | ||
297 | - | ||
298 | - if (a->op) { | ||
299 | - /* | ||
300 | - * T2 encoding ({D0-D31} reglist): v8.1M and up. We choose not | ||
301 | - * to take the IMPDEF option to make memory accesses to the stack | ||
302 | - * slots that correspond to the D16-D31 registers (discarding | ||
303 | - * read data and writing UNKNOWN values), so for us the T2 | ||
304 | - * encoding behaves identically to the T1 encoding. | ||
305 | - */ | ||
306 | - if (!arm_dc_feature(s, ARM_FEATURE_V8_1M)) { | ||
307 | - return false; | ||
308 | - } | ||
309 | - } else { | ||
310 | - /* | ||
311 | - * T1 encoding ({D0-D15} reglist); undef if we have 32 Dregs. | ||
312 | - * This is currently architecturally impossible, but we add the | ||
313 | - * check to stay in line with the pseudocode. Note that we must | ||
314 | - * emit code for the UNDEF so it takes precedence over the NOCP. | ||
315 | - */ | ||
316 | - if (dc_isar_feature(aa32_simd_r32, s)) { | ||
317 | - unallocated_encoding(s); | ||
318 | - return true; | ||
319 | - } | ||
320 | - } | ||
321 | - | ||
322 | - /* | ||
323 | - * If not secure, UNDEF. We must emit code for this | ||
324 | - * rather than returning false so that this takes | ||
325 | - * precedence over the m-nocp.decode NOCP fallback. | ||
326 | - */ | ||
327 | - if (!s->v8m_secure) { | ||
328 | - unallocated_encoding(s); | ||
329 | - return true; | ||
330 | - } | ||
331 | - /* If no fpu, NOP. */ | ||
332 | - if (!dc_isar_feature(aa32_vfp, s)) { | ||
333 | - return true; | ||
334 | - } | ||
335 | - | ||
336 | - fptr = load_reg(s, a->rn); | ||
337 | - if (a->l) { | ||
338 | - gen_helper_v7m_vlldm(cpu_env, fptr); | ||
339 | - } else { | ||
340 | - gen_helper_v7m_vlstm(cpu_env, fptr); | ||
341 | - } | ||
342 | - tcg_temp_free_i32(fptr); | ||
343 | - | ||
344 | - /* End the TB, because we have updated FP control bits */ | ||
345 | - s->base.is_jmp = DISAS_UPDATE_EXIT; | ||
346 | - return true; | ||
347 | -} | ||
348 | - | ||
349 | -static bool trans_VSCCLRM(DisasContext *s, arg_VSCCLRM *a) | ||
350 | -{ | ||
351 | - int btmreg, topreg; | ||
352 | - TCGv_i64 zero; | ||
353 | - TCGv_i32 aspen, sfpa; | ||
354 | - | ||
355 | - if (!dc_isar_feature(aa32_m_sec_state, s)) { | ||
356 | - /* Before v8.1M, fall through in decode to NOCP check */ | ||
357 | - return false; | ||
358 | - } | ||
359 | - | ||
360 | - /* Explicitly UNDEF because this takes precedence over NOCP */ | ||
361 | - if (!arm_dc_feature(s, ARM_FEATURE_M_MAIN) || !s->v8m_secure) { | ||
362 | - unallocated_encoding(s); | ||
363 | - return true; | ||
364 | - } | ||
365 | - | ||
366 | - if (!dc_isar_feature(aa32_vfp_simd, s)) { | ||
367 | - /* NOP if we have neither FP nor MVE */ | ||
368 | - return true; | ||
369 | - } | ||
370 | - | ||
371 | - /* | ||
372 | - * If FPCCR.ASPEN != 0 && CONTROL_S.SFPA == 0 then there is no | ||
373 | - * active floating point context so we must NOP (without doing | ||
374 | - * any lazy state preservation or the NOCP check). | ||
375 | - */ | ||
376 | - aspen = load_cpu_field(v7m.fpccr[M_REG_S]); | ||
377 | - sfpa = load_cpu_field(v7m.control[M_REG_S]); | ||
378 | - tcg_gen_andi_i32(aspen, aspen, R_V7M_FPCCR_ASPEN_MASK); | ||
379 | - tcg_gen_xori_i32(aspen, aspen, R_V7M_FPCCR_ASPEN_MASK); | ||
380 | - tcg_gen_andi_i32(sfpa, sfpa, R_V7M_CONTROL_SFPA_MASK); | ||
381 | - tcg_gen_or_i32(sfpa, sfpa, aspen); | ||
382 | - arm_gen_condlabel(s); | ||
383 | - tcg_gen_brcondi_i32(TCG_COND_EQ, sfpa, 0, s->condlabel); | ||
384 | - | ||
385 | - if (s->fp_excp_el != 0) { | ||
386 | - gen_exception_insn(s, s->pc_curr, EXCP_NOCP, | ||
387 | - syn_uncategorized(), s->fp_excp_el); | ||
388 | - return true; | ||
389 | - } | ||
390 | - | ||
391 | - topreg = a->vd + a->imm - 1; | ||
392 | - btmreg = a->vd; | ||
393 | - | ||
394 | - /* Convert to Sreg numbers if the insn specified in Dregs */ | ||
395 | - if (a->size == 3) { | ||
396 | - topreg = topreg * 2 + 1; | ||
397 | - btmreg *= 2; | ||
398 | - } | ||
399 | - | ||
400 | - if (topreg > 63 || (topreg > 31 && !(topreg & 1))) { | ||
401 | - /* UNPREDICTABLE: we choose to undef */ | ||
402 | - unallocated_encoding(s); | ||
403 | - return true; | ||
404 | - } | ||
405 | - | ||
406 | - /* Silently ignore requests to clear D16-D31 if they don't exist */ | ||
407 | - if (topreg > 31 && !dc_isar_feature(aa32_simd_r32, s)) { | ||
408 | - topreg = 31; | ||
409 | - } | ||
410 | - | ||
411 | - if (!vfp_access_check(s)) { | ||
412 | - return true; | ||
413 | - } | ||
414 | - | ||
415 | - /* Zero the Sregs from btmreg to topreg inclusive. */ | ||
416 | - zero = tcg_const_i64(0); | ||
417 | - if (btmreg & 1) { | ||
418 | - write_neon_element64(zero, btmreg >> 1, 1, MO_32); | ||
419 | - btmreg++; | ||
420 | - } | ||
421 | - for (; btmreg + 1 <= topreg; btmreg += 2) { | ||
422 | - write_neon_element64(zero, btmreg >> 1, 0, MO_64); | ||
423 | - } | ||
424 | - if (btmreg == topreg) { | ||
425 | - write_neon_element64(zero, btmreg >> 1, 0, MO_32); | ||
426 | - btmreg++; | ||
427 | - } | ||
428 | - assert(btmreg == topreg + 1); | ||
429 | - /* TODO: when MVE is implemented, zero VPR here */ | ||
430 | - return true; | ||
431 | -} | ||
432 | - | ||
433 | -static bool trans_NOCP(DisasContext *s, arg_nocp *a) | ||
434 | -{ | ||
435 | - /* | ||
436 | - * Handle M-profile early check for disabled coprocessor: | ||
437 | - * all we need to do here is emit the NOCP exception if | ||
438 | - * the coprocessor is disabled. Otherwise we return false | ||
439 | - * and the real VFP/etc decode will handle the insn. | ||
440 | - */ | ||
441 | - assert(arm_dc_feature(s, ARM_FEATURE_M)); | ||
442 | - | ||
443 | - if (a->cp == 11) { | ||
444 | - a->cp = 10; | ||
445 | - } | ||
446 | - if (arm_dc_feature(s, ARM_FEATURE_V8_1M) && | ||
447 | - (a->cp == 8 || a->cp == 9 || a->cp == 14 || a->cp == 15)) { | ||
448 | - /* in v8.1M cp 8, 9, 14, 15 also are governed by the cp10 enable */ | ||
449 | - a->cp = 10; | ||
450 | - } | ||
451 | - | ||
452 | - if (a->cp != 10) { | ||
453 | - gen_exception_insn(s, s->pc_curr, EXCP_NOCP, | ||
454 | - syn_uncategorized(), default_exception_el(s)); | ||
455 | - return true; | ||
456 | - } | ||
457 | - | ||
458 | - if (s->fp_excp_el != 0) { | ||
459 | - gen_exception_insn(s, s->pc_curr, EXCP_NOCP, | ||
460 | - syn_uncategorized(), s->fp_excp_el); | ||
461 | - return true; | ||
462 | - } | ||
463 | - | ||
464 | - return false; | ||
465 | -} | ||
466 | - | ||
467 | -static bool trans_NOCP_8_1(DisasContext *s, arg_nocp *a) | ||
468 | -{ | ||
469 | - /* This range needs a coprocessor check for v8.1M and later only */ | ||
470 | - if (!arm_dc_feature(s, ARM_FEATURE_V8_1M)) { | ||
471 | - return false; | ||
472 | - } | ||
473 | - return trans_NOCP(s, a); | ||
474 | -} | ||
475 | - | ||
476 | static bool trans_VINS(DisasContext *s, arg_VINS *a) | ||
477 | { | ||
478 | TCGv_i32 rd, rm; | ||
479 | diff --git a/target/arm/meson.build b/target/arm/meson.build | ||
480 | index XXXXXXX..XXXXXXX 100644 | ||
481 | --- a/target/arm/meson.build | ||
482 | +++ b/target/arm/meson.build | ||
483 | @@ -XXX,XX +XXX,XX @@ gen = [ | ||
484 | decodetree.process('neon-ls.decode', extra_args: '--static-decode=disas_neon_ls'), | ||
485 | decodetree.process('vfp.decode', extra_args: '--static-decode=disas_vfp'), | ||
486 | decodetree.process('vfp-uncond.decode', extra_args: '--static-decode=disas_vfp_uncond'), | ||
487 | - decodetree.process('m-nocp.decode', extra_args: '--static-decode=disas_m_nocp'), | ||
488 | + decodetree.process('m-nocp.decode', extra_args: '--decode=disas_m_nocp'), | ||
489 | decodetree.process('a32.decode', extra_args: '--static-decode=disas_a32'), | ||
490 | decodetree.process('a32-uncond.decode', extra_args: '--static-decode=disas_a32_uncond'), | ||
491 | decodetree.process('t32.decode', extra_args: '--static-decode=disas_t32'), | ||
492 | @@ -XXX,XX +XXX,XX @@ arm_ss.add(files( | ||
493 | 'op_helper.c', | ||
494 | 'tlb_helper.c', | ||
495 | 'translate.c', | ||
496 | + 'translate-m-nocp.c', | ||
497 | 'vec_helper.c', | ||
498 | 'vfp_helper.c', | ||
499 | 'cpu_tcg.c', | ||
500 | -- | 54 | -- |
501 | 2.20.1 | 55 | 2.25.1 |
502 | 56 | ||
503 | 57 | diff view generated by jsdifflib |
1 | The AN524 FPGA image supports two memory maps, which differ in where | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | the QSPI and BRAM are. In the default map, the BRAM is at | ||
3 | 0x0000_0000, and the QSPI at 0x2800_0000. In the second map, they | ||
4 | are the other way around. | ||
5 | 2 | ||
6 | In hardware, the initial mapping can be selected by the user by | 3 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
7 | writing either "REMAP: BRAM" (the default) or "REMAP: QSPI" in the | 4 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
8 | board configuration file. The board config file is acted on by the | 5 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
9 | "Motherboard Configuration Controller", which is an entirely separate | 6 | --- |
10 | microcontroller on the dev board but outside the FPGA. | 7 | tests/tcg/aarch64/pcalign-a64.c | 37 +++++++++++++++++++++++++ |
8 | tests/tcg/arm/pcalign-a32.c | 46 +++++++++++++++++++++++++++++++ | ||
9 | tests/tcg/aarch64/Makefile.target | 4 +-- | ||
10 | tests/tcg/arm/Makefile.target | 4 +++ | ||
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 | ||
11 | 14 | ||
12 | The guest can also dynamically change the mapping via the SCC | 15 | diff --git a/tests/tcg/aarch64/pcalign-a64.c b/tests/tcg/aarch64/pcalign-a64.c |
13 | CFG_REG0 register. | 16 | new file mode 100644 |
14 | 17 | index XXXXXXX..XXXXXXX | |
15 | Implement this functionality for QEMU, using a machine property | 18 | --- /dev/null |
16 | "remap" with valid values "BRAM" and "QSPI" to allow the user to set | 19 | +++ b/tests/tcg/aarch64/pcalign-a64.c |
17 | the initial mapping, in the same way they can on the FPGA, and | 20 | @@ -XXX,XX +XXX,XX @@ |
18 | wiring up the bit from the SCC register to also switch the mapping. | 21 | +/* Test PC misalignment exception */ |
19 | |||
20 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
21 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
22 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
23 | Message-id: 20210504120912.23094-4-peter.maydell@linaro.org | ||
24 | --- | ||
25 | docs/system/arm/mps2.rst | 10 ++++ | ||
26 | hw/arm/mps2-tz.c | 108 ++++++++++++++++++++++++++++++++++++++- | ||
27 | 2 files changed, 117 insertions(+), 1 deletion(-) | ||
28 | |||
29 | diff --git a/docs/system/arm/mps2.rst b/docs/system/arm/mps2.rst | ||
30 | index XXXXXXX..XXXXXXX 100644 | ||
31 | --- a/docs/system/arm/mps2.rst | ||
32 | +++ b/docs/system/arm/mps2.rst | ||
33 | @@ -XXX,XX +XXX,XX @@ Differences between QEMU and real hardware: | ||
34 | flash, but only as simple ROM, so attempting to rewrite the flash | ||
35 | from the guest will fail | ||
36 | - QEMU does not model the USB controller in MPS3 boards | ||
37 | + | 22 | + |
38 | +Machine-specific options | 23 | +#include <assert.h> |
39 | +"""""""""""""""""""""""" | 24 | +#include <signal.h> |
25 | +#include <stdlib.h> | ||
26 | +#include <stdio.h> | ||
40 | + | 27 | + |
41 | +The following machine-specific options are supported: | 28 | +static void *expected; |
42 | + | 29 | + |
43 | +remap | 30 | +static void sigbus(int sig, siginfo_t *info, void *vuc) |
44 | + Supported for ``mps3-an524`` only. | ||
45 | + Set ``BRAM``/``QSPI`` to select the initial memory mapping. The | ||
46 | + default is ``BRAM``. | ||
47 | diff --git a/hw/arm/mps2-tz.c b/hw/arm/mps2-tz.c | ||
48 | index XXXXXXX..XXXXXXX 100644 | ||
49 | --- a/hw/arm/mps2-tz.c | ||
50 | +++ b/hw/arm/mps2-tz.c | ||
51 | @@ -XXX,XX +XXX,XX @@ | ||
52 | #include "hw/boards.h" | ||
53 | #include "exec/address-spaces.h" | ||
54 | #include "sysemu/sysemu.h" | ||
55 | +#include "sysemu/reset.h" | ||
56 | #include "hw/misc/unimp.h" | ||
57 | #include "hw/char/cmsdk-apb-uart.h" | ||
58 | #include "hw/timer/cmsdk-apb-timer.h" | ||
59 | @@ -XXX,XX +XXX,XX @@ | ||
60 | #include "hw/core/split-irq.h" | ||
61 | #include "hw/qdev-clock.h" | ||
62 | #include "qom/object.h" | ||
63 | +#include "hw/irq.h" | ||
64 | |||
65 | #define MPS2TZ_NUMIRQ_MAX 96 | ||
66 | #define MPS2TZ_RAM_MAX 5 | ||
67 | @@ -XXX,XX +XXX,XX @@ struct MPS2TZMachineState { | ||
68 | SplitIRQ cpu_irq_splitter[MPS2TZ_NUMIRQ_MAX]; | ||
69 | Clock *sysclk; | ||
70 | Clock *s32kclk; | ||
71 | + | ||
72 | + bool remap; | ||
73 | + qemu_irq remap_irq; | ||
74 | }; | ||
75 | |||
76 | #define TYPE_MPS2TZ_MACHINE "mps2tz" | ||
77 | @@ -XXX,XX +XXX,XX @@ static const RAMInfo an505_raminfo[] = { { | ||
78 | }, | ||
79 | }; | ||
80 | |||
81 | +/* | ||
82 | + * Note that the addresses and MPC numbering here should match up | ||
83 | + * with those used in remap_memory(), which can swap the BRAM and QSPI. | ||
84 | + */ | ||
85 | static const RAMInfo an524_raminfo[] = { { | ||
86 | .name = "bram", | ||
87 | .base = 0x00000000, | ||
88 | @@ -XXX,XX +XXX,XX @@ static MemoryRegion *make_scc(MPS2TZMachineState *mms, void *opaque, | ||
89 | |||
90 | object_initialize_child(OBJECT(mms), "scc", scc, TYPE_MPS2_SCC); | ||
91 | sccdev = DEVICE(scc); | ||
92 | + qdev_prop_set_uint32(sccdev, "scc-cfg0", mms->remap ? 1 : 0); | ||
93 | qdev_prop_set_uint32(sccdev, "scc-cfg4", 0x2); | ||
94 | qdev_prop_set_uint32(sccdev, "scc-aid", 0x00200008); | ||
95 | qdev_prop_set_uint32(sccdev, "scc-id", mmc->scc_id); | ||
96 | @@ -XXX,XX +XXX,XX @@ static MemoryRegion *make_mpc(MPS2TZMachineState *mms, void *opaque, | ||
97 | return sysbus_mmio_get_region(SYS_BUS_DEVICE(mpc), 0); | ||
98 | } | ||
99 | |||
100 | +static hwaddr boot_mem_base(MPS2TZMachineState *mms) | ||
101 | +{ | 31 | +{ |
102 | + /* | 32 | + assert(info->si_code == BUS_ADRALN); |
103 | + * Return the canonical address of the block which will be mapped | 33 | + assert(info->si_addr == expected); |
104 | + * at address 0x0 (i.e. where the vector table is). | 34 | + exit(EXIT_SUCCESS); |
105 | + * This is usually 0, but if the AN524 alternate memory map is | ||
106 | + * enabled it will be the base address of the QSPI block. | ||
107 | + */ | ||
108 | + return mms->remap ? 0x28000000 : 0; | ||
109 | +} | 35 | +} |
110 | + | 36 | + |
111 | +static void remap_memory(MPS2TZMachineState *mms, int map) | 37 | +int main() |
112 | +{ | 38 | +{ |
113 | + /* | 39 | + void *tmp; |
114 | + * Remap the memory for the AN524. 'map' is the value of | ||
115 | + * SCC CFG_REG0 bit 0, i.e. 0 for the default map and 1 | ||
116 | + * for the "option 1" mapping where QSPI is at address 0. | ||
117 | + * | ||
118 | + * Effectively we need to swap around the "upstream" ends of | ||
119 | + * MPC 0 and MPC 1. | ||
120 | + */ | ||
121 | + MPS2TZMachineClass *mmc = MPS2TZ_MACHINE_GET_CLASS(mms); | ||
122 | + int i; | ||
123 | + | 40 | + |
124 | + if (mmc->fpga_type != FPGA_AN524) { | 41 | + struct sigaction sa = { |
125 | + return; | 42 | + .sa_sigaction = sigbus, |
43 | + .sa_flags = SA_SIGINFO | ||
44 | + }; | ||
45 | + | ||
46 | + if (sigaction(SIGBUS, &sa, NULL) < 0) { | ||
47 | + perror("sigaction"); | ||
48 | + return EXIT_FAILURE; | ||
126 | + } | 49 | + } |
127 | + | 50 | + |
128 | + memory_region_transaction_begin(); | 51 | + asm volatile("adr %0, 1f + 1\n\t" |
129 | + for (i = 0; i < 2; i++) { | 52 | + "str %0, %1\n\t" |
130 | + TZMPC *mpc = &mms->mpc[i]; | 53 | + "br %0\n" |
131 | + MemoryRegion *upstream = sysbus_mmio_get_region(SYS_BUS_DEVICE(mpc), 1); | 54 | + "1:" |
132 | + hwaddr addr = (i ^ map) ? 0x28000000 : 0; | 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 */ | ||
133 | + | 65 | + |
134 | + memory_region_set_address(upstream, addr); | 66 | +#ifdef __thumb__ |
135 | + } | 67 | +#error "This test must be compiled for ARM" |
136 | + memory_region_transaction_commit(); | 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); | ||
137 | +} | 82 | +} |
138 | + | 83 | + |
139 | +static void remap_irq_fn(void *opaque, int n, int level) | 84 | +int main() |
140 | +{ | 85 | +{ |
141 | + MPS2TZMachineState *mms = opaque; | 86 | + void *tmp; |
142 | + | 87 | + |
143 | + remap_memory(mms, level); | 88 | + struct sigaction sa = { |
144 | +} | 89 | + .sa_sigaction = sigbus, |
90 | + .sa_flags = SA_SIGINFO | ||
91 | + }; | ||
145 | + | 92 | + |
146 | static MemoryRegion *make_dma(MPS2TZMachineState *mms, void *opaque, | 93 | + if (sigaction(SIGBUS, &sa, NULL) < 0) { |
147 | const char *name, hwaddr size, | 94 | + perror("sigaction"); |
148 | const int *irqs) | 95 | + return EXIT_FAILURE; |
149 | @@ -XXX,XX +XXX,XX @@ static uint32_t boot_ram_size(MPS2TZMachineState *mms) | ||
150 | MPS2TZMachineClass *mmc = MPS2TZ_MACHINE_GET_CLASS(mms); | ||
151 | |||
152 | for (p = mmc->raminfo; p->name; p++) { | ||
153 | - if (p->base == 0) { | ||
154 | + if (p->base == boot_mem_base(mms)) { | ||
155 | return p->size; | ||
156 | } | ||
157 | } | ||
158 | @@ -XXX,XX +XXX,XX @@ static void mps2tz_common_init(MachineState *machine) | ||
159 | |||
160 | create_non_mpc_ram(mms); | ||
161 | |||
162 | + if (mmc->fpga_type == FPGA_AN524) { | ||
163 | + /* | ||
164 | + * Connect the line from the SCC so that we can remap when the | ||
165 | + * guest updates that register. | ||
166 | + */ | ||
167 | + mms->remap_irq = qemu_allocate_irq(remap_irq_fn, mms, 0); | ||
168 | + qdev_connect_gpio_out_named(DEVICE(&mms->scc), "remap", 0, | ||
169 | + mms->remap_irq); | ||
170 | + } | 96 | + } |
171 | + | 97 | + |
172 | armv7m_load_kernel(ARM_CPU(first_cpu), machine->kernel_filename, | 98 | + asm volatile("adr %0, 1f + 2\n\t" |
173 | boot_ram_size(mms)); | 99 | + "str %0, %1\n\t" |
174 | } | 100 | + "bx %0\n" |
175 | @@ -XXX,XX +XXX,XX @@ static void mps2_tz_idau_check(IDAUInterface *ii, uint32_t address, | 101 | + "1:" |
176 | *iregion = region; | 102 | + : "=&r"(tmp), "=m"(expected)); |
177 | } | ||
178 | |||
179 | +static char *mps2_get_remap(Object *obj, Error **errp) | ||
180 | +{ | ||
181 | + MPS2TZMachineState *mms = MPS2TZ_MACHINE(obj); | ||
182 | + const char *val = mms->remap ? "QSPI" : "BRAM"; | ||
183 | + return g_strdup(val); | ||
184 | +} | ||
185 | + | ||
186 | +static void mps2_set_remap(Object *obj, const char *value, Error **errp) | ||
187 | +{ | ||
188 | + MPS2TZMachineState *mms = MPS2TZ_MACHINE(obj); | ||
189 | + | ||
190 | + if (!strcmp(value, "BRAM")) { | ||
191 | + mms->remap = false; | ||
192 | + } else if (!strcmp(value, "QSPI")) { | ||
193 | + mms->remap = true; | ||
194 | + } else { | ||
195 | + error_setg(errp, "Invalid remap value"); | ||
196 | + error_append_hint(errp, "Valid values are BRAM and QSPI.\n"); | ||
197 | + } | ||
198 | +} | ||
199 | + | ||
200 | +static void mps2_machine_reset(MachineState *machine) | ||
201 | +{ | ||
202 | + MPS2TZMachineState *mms = MPS2TZ_MACHINE(machine); | ||
203 | + | 103 | + |
204 | + /* | 104 | + /* |
205 | + * Set the initial memory mapping before triggering the reset of | 105 | + * From v8, it is CONSTRAINED UNPREDICTABLE whether BXWritePC aligns |
206 | + * the rest of the system, so that the guest image loader and CPU | 106 | + * the address or not. If so, we can legitimately fall through. |
207 | + * reset see the correct mapping. | ||
208 | + */ | 107 | + */ |
209 | + remap_memory(mms, mms->remap); | 108 | + return EXIT_SUCCESS; |
210 | + qemu_devices_reset(); | ||
211 | +} | 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 | ||
212 | + | 136 | + |
213 | static void mps2tz_class_init(ObjectClass *oc, void *data) | 137 | ifeq ($(CONFIG_ARM_COMPATIBLE_SEMIHOSTING),y) |
214 | { | 138 | |
215 | MachineClass *mc = MACHINE_CLASS(oc); | 139 | # Semihosting smoke test for linux-user |
216 | IDAUInterfaceClass *iic = IDAU_INTERFACE_CLASS(oc); | ||
217 | |||
218 | mc->init = mps2tz_common_init; | ||
219 | + mc->reset = mps2_machine_reset; | ||
220 | iic->check = mps2_tz_idau_check; | ||
221 | } | ||
222 | |||
223 | @@ -XXX,XX +XXX,XX @@ static void mps3tz_an524_class_init(ObjectClass *oc, void *data) | ||
224 | mmc->raminfo = an524_raminfo; | ||
225 | mmc->armsse_type = TYPE_SSE200; | ||
226 | mps2tz_set_default_ram_info(mmc); | ||
227 | + | ||
228 | + object_class_property_add_str(oc, "remap", mps2_get_remap, mps2_set_remap); | ||
229 | + object_class_property_set_description(oc, "remap", | ||
230 | + "Set memory mapping. Valid values " | ||
231 | + "are BRAM (default) and QSPI."); | ||
232 | } | ||
233 | |||
234 | static void mps3tz_an547_class_init(ObjectClass *oc, void *data) | ||
235 | -- | 140 | -- |
236 | 2.20.1 | 141 | 2.25.1 |
237 | 142 | ||
238 | 143 | diff view generated by jsdifflib |
1 | Make bswap.h handle being included outside an 'extern "C"' block: | 1 | In the SSE decode function gen_sse(), we combine a byte |
---|---|---|---|
2 | all system headers are included first, then all declarations are | 2 | 'b' and a value 'b1' which can be [0..3], and switch on them: |
3 | put inside an 'extern "C"' block. | 3 | b |= (b1 << 8); |
4 | switch (b) { | ||
5 | ... | ||
6 | default: | ||
7 | unknown_op: | ||
8 | gen_unknown_opcode(env, s); | ||
9 | return; | ||
10 | } | ||
4 | 11 | ||
5 | This requires a little rearrangement as currently we have an ifdef | 12 | In three cases inside this switch, we were then also checking for |
6 | ladder that has some system includes and some local declarations | 13 | "if (b1 >= 2) { goto unknown_op; }". |
7 | or definitions, and we need to separate those out. | 14 | However, this can never happen, because the 'case' values in each place |
15 | are 0x0nn or 0x1nn and the switch will have directed the b1 == (2, 3) | ||
16 | cases to the default already. | ||
8 | 17 | ||
9 | We want to do this because dis-asm.h includes bswap.h, dis-asm.h | 18 | This check was added in commit c045af25a52e9 in 2010; the added code |
10 | may need to be included from C++ files, and system headers should | 19 | was unnecessary then as well, and was apparently intended only to |
11 | not be included within 'extern "C"' blocks. | 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. | ||
12 | 23 | ||
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 | ||
13 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 28 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
14 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 29 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
15 | --- | 30 | --- |
16 | include/qemu/bswap.h | 26 ++++++++++++++++++++++---- | 31 | target/i386/tcg/translate.c | 12 +++--------- |
17 | 1 file changed, 22 insertions(+), 4 deletions(-) | 32 | 1 file changed, 3 insertions(+), 9 deletions(-) |
18 | 33 | ||
19 | diff --git a/include/qemu/bswap.h b/include/qemu/bswap.h | 34 | diff --git a/target/i386/tcg/translate.c b/target/i386/tcg/translate.c |
20 | index XXXXXXX..XXXXXXX 100644 | 35 | index XXXXXXX..XXXXXXX 100644 |
21 | --- a/include/qemu/bswap.h | 36 | --- a/target/i386/tcg/translate.c |
22 | +++ b/include/qemu/bswap.h | 37 | +++ b/target/i386/tcg/translate.c |
23 | @@ -XXX,XX +XXX,XX @@ | 38 | @@ -XXX,XX +XXX,XX @@ static void gen_sse(CPUX86State *env, DisasContext *s, int b, |
24 | #ifndef BSWAP_H | 39 | case 0x171: /* shift xmm, im */ |
25 | #define BSWAP_H | 40 | case 0x172: |
26 | 41 | case 0x173: | |
27 | -#include "fpu/softfloat-types.h" | 42 | - if (b1 >= 2) { |
28 | - | 43 | - goto unknown_op; |
29 | #ifdef CONFIG_MACHINE_BSWAP_H | 44 | - } |
30 | # include <sys/endian.h> | 45 | val = x86_ldub_code(env, s); |
31 | # include <machine/bswap.h> | 46 | if (is_xmm) { |
32 | @@ -XXX,XX +XXX,XX @@ | 47 | tcg_gen_movi_tl(s->T0, val); |
33 | # include <endian.h> | 48 | @@ -XXX,XX +XXX,XX @@ static void gen_sse(CPUX86State *env, DisasContext *s, int b, |
34 | #elif defined(CONFIG_BYTESWAP_H) | 49 | offsetof(CPUX86State, mmx_t0.MMX_L(1))); |
35 | # include <byteswap.h> | 50 | op1_offset = offsetof(CPUX86State,mmx_t0); |
36 | +#define BSWAP_FROM_BYTESWAP | 51 | } |
37 | +# else | 52 | + assert(b1 < 2); |
38 | +#define BSWAP_FROM_FALLBACKS | 53 | sse_fn_epp = sse_op_table2[((b - 1) & 3) * 8 + |
39 | +#endif /* ! CONFIG_MACHINE_BSWAP_H */ | 54 | (((modrm >> 3)) & 7)][b1]; |
40 | 55 | if (!sse_fn_epp) { | |
41 | +#ifdef __cplusplus | 56 | @@ -XXX,XX +XXX,XX @@ static void gen_sse(CPUX86State *env, DisasContext *s, int b, |
42 | +extern "C" { | 57 | rm = modrm & 7; |
43 | +#endif | 58 | reg = ((modrm >> 3) & 7) | REX_R(s); |
44 | + | 59 | mod = (modrm >> 6) & 3; |
45 | +#include "fpu/softfloat-types.h" | 60 | - if (b1 >= 2) { |
46 | + | 61 | - goto unknown_op; |
47 | +#ifdef BSWAP_FROM_BYTESWAP | 62 | - } |
48 | static inline uint16_t bswap16(uint16_t x) | 63 | |
49 | { | 64 | + assert(b1 < 2); |
50 | return bswap_16(x); | 65 | sse_fn_epp = sse_op_table6[b].op[b1]; |
51 | @@ -XXX,XX +XXX,XX @@ static inline uint64_t bswap64(uint64_t x) | 66 | if (!sse_fn_epp) { |
52 | { | 67 | goto unknown_op; |
53 | return bswap_64(x); | 68 | @@ -XXX,XX +XXX,XX @@ static void gen_sse(CPUX86State *env, DisasContext *s, int b, |
54 | } | 69 | rm = modrm & 7; |
55 | -# else | 70 | reg = ((modrm >> 3) & 7) | REX_R(s); |
56 | +#endif | 71 | mod = (modrm >> 6) & 3; |
57 | + | 72 | - if (b1 >= 2) { |
58 | +#ifdef BSWAP_FROM_FALLBACKS | 73 | - goto unknown_op; |
59 | static inline uint16_t bswap16(uint16_t x) | 74 | - } |
60 | { | 75 | |
61 | return (((x & 0x00ff) << 8) | | 76 | + assert(b1 < 2); |
62 | @@ -XXX,XX +XXX,XX @@ static inline uint64_t bswap64(uint64_t x) | 77 | sse_fn_eppi = sse_op_table7[b].op[b1]; |
63 | ((x & 0x00ff000000000000ULL) >> 40) | | 78 | if (!sse_fn_eppi) { |
64 | ((x & 0xff00000000000000ULL) >> 56)); | 79 | goto unknown_op; |
65 | } | ||
66 | -#endif /* ! CONFIG_MACHINE_BSWAP_H */ | ||
67 | +#endif | ||
68 | + | ||
69 | +#undef BSWAP_FROM_BYTESWAP | ||
70 | +#undef BSWAP_FROM_FALLBACKS | ||
71 | |||
72 | static inline void bswap16s(uint16_t *s) | ||
73 | { | ||
74 | @@ -XXX,XX +XXX,XX @@ DO_STN_LDN_P(be) | ||
75 | #undef le_bswaps | ||
76 | #undef be_bswaps | ||
77 | |||
78 | +#ifdef __cplusplus | ||
79 | +} | ||
80 | +#endif | ||
81 | + | ||
82 | #endif /* BSWAP_H */ | ||
83 | -- | 80 | -- |
84 | 2.20.1 | 81 | 2.25.1 |
85 | 82 | ||
86 | 83 | diff view generated by jsdifflib |
1 | The MPS2 SCC device doesn't have any documentation of its properties; | 1 | The qemu-common.h header is not supposed to be included from any |
---|---|---|---|
2 | add a "QEMU interface" format comment describing them. | 2 | other header files, only from .c files (as documented in a comment at |
3 | the start of it). | ||
4 | |||
5 | include/hw/i386/x86.h and include/hw/i386/microvm.h break this rule. | ||
6 | In fact, the include is not required at all, so we can just drop it | ||
7 | from both files. | ||
3 | 8 | ||
4 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
5 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 10 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
6 | Message-id: 20210504120912.23094-2-peter.maydell@linaro.org | 11 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> |
12 | Message-id: 20211129200510.1233037-2-peter.maydell@linaro.org | ||
7 | --- | 13 | --- |
8 | include/hw/misc/mps2-scc.h | 12 ++++++++++++ | 14 | include/hw/i386/microvm.h | 1 - |
9 | 1 file changed, 12 insertions(+) | 15 | include/hw/i386/x86.h | 1 - |
16 | 2 files changed, 2 deletions(-) | ||
10 | 17 | ||
11 | diff --git a/include/hw/misc/mps2-scc.h b/include/hw/misc/mps2-scc.h | 18 | diff --git a/include/hw/i386/microvm.h b/include/hw/i386/microvm.h |
12 | index XXXXXXX..XXXXXXX 100644 | 19 | index XXXXXXX..XXXXXXX 100644 |
13 | --- a/include/hw/misc/mps2-scc.h | 20 | --- a/include/hw/i386/microvm.h |
14 | +++ b/include/hw/misc/mps2-scc.h | 21 | +++ b/include/hw/i386/microvm.h |
15 | @@ -XXX,XX +XXX,XX @@ | 22 | @@ -XXX,XX +XXX,XX @@ |
16 | * (at your option) any later version. | 23 | #ifndef HW_I386_MICROVM_H |
17 | */ | 24 | #define HW_I386_MICROVM_H |
18 | 25 | ||
19 | +/* | 26 | -#include "qemu-common.h" |
20 | + * This is a model of the Serial Communication Controller (SCC) | 27 | #include "exec/hwaddr.h" |
21 | + * block found in most MPS FPGA images. | 28 | #include "qemu/notify.h" |
22 | + * | 29 | |
23 | + * QEMU interface: | 30 | diff --git a/include/hw/i386/x86.h b/include/hw/i386/x86.h |
24 | + * + sysbus MMIO region 0: the register bank | 31 | index XXXXXXX..XXXXXXX 100644 |
25 | + * + QOM property "scc-cfg4": value of the read-only CFG4 register | 32 | --- a/include/hw/i386/x86.h |
26 | + * + QOM property "scc-aid": value of the read-only SCC_AID register | 33 | +++ b/include/hw/i386/x86.h |
27 | + * + QOM property "scc-id": value of the read-only SCC_ID register | 34 | @@ -XXX,XX +XXX,XX @@ |
28 | + * + QOM property array "oscclk": reset values of the OSCCLK registers | 35 | #ifndef HW_I386_X86_H |
29 | + * (which are accessed via the SYS_CFG channel provided by this device) | 36 | #define HW_I386_X86_H |
30 | + */ | 37 | |
31 | #ifndef MPS2_SCC_H | 38 | -#include "qemu-common.h" |
32 | #define MPS2_SCC_H | 39 | #include "exec/hwaddr.h" |
40 | #include "qemu/notify.h" | ||
33 | 41 | ||
34 | -- | 42 | -- |
35 | 2.20.1 | 43 | 2.25.1 |
36 | 44 | ||
37 | 45 | diff view generated by jsdifflib |
1 | On some boards, SCC config register CFG0 bit 0 controls whether | 1 | The qemu-common.h header is not supposed to be included from any |
---|---|---|---|
2 | parts of the board memory map are remapped. Support this with: | 2 | other header files, only from .c files (as documented in a comment at |
3 | * a device property scc-cfg0 so the board can specify the | 3 | the start of it). |
4 | initial value of the CFG0 register | 4 | |
5 | * an outbound GPIO line which tracks bit 0 and which the board | 5 | Move the include to linux-user/hexagon/cpu_loop.c, which needs it for |
6 | can wire up to provide the remapping | 6 | the declaration of cpu_exec_step_atomic(). |
7 | 7 | ||
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
9 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 9 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
10 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 10 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> |
11 | Message-id: 20210504120912.23094-3-peter.maydell@linaro.org | 11 | Reviewed-by: Taylor Simpson <tsimpson@quicinc.com> |
12 | Message-id: 20211129200510.1233037-3-peter.maydell@linaro.org | ||
12 | --- | 13 | --- |
13 | include/hw/misc/mps2-scc.h | 9 +++++++++ | 14 | target/hexagon/cpu.h | 1 - |
14 | hw/misc/mps2-scc.c | 13 ++++++++++--- | 15 | linux-user/hexagon/cpu_loop.c | 1 + |
15 | 2 files changed, 19 insertions(+), 3 deletions(-) | 16 | 2 files changed, 1 insertion(+), 1 deletion(-) |
16 | 17 | ||
17 | diff --git a/include/hw/misc/mps2-scc.h b/include/hw/misc/mps2-scc.h | 18 | diff --git a/target/hexagon/cpu.h b/target/hexagon/cpu.h |
18 | index XXXXXXX..XXXXXXX 100644 | 19 | index XXXXXXX..XXXXXXX 100644 |
19 | --- a/include/hw/misc/mps2-scc.h | 20 | --- a/target/hexagon/cpu.h |
20 | +++ b/include/hw/misc/mps2-scc.h | 21 | +++ b/target/hexagon/cpu.h |
22 | @@ -XXX,XX +XXX,XX @@ typedef struct CPUHexagonState CPUHexagonState; | ||
23 | |||
24 | #include "fpu/softfloat-types.h" | ||
25 | |||
26 | -#include "qemu-common.h" | ||
27 | #include "exec/cpu-defs.h" | ||
28 | #include "hex_regs.h" | ||
29 | #include "mmvec/mmvec.h" | ||
30 | diff --git a/linux-user/hexagon/cpu_loop.c b/linux-user/hexagon/cpu_loop.c | ||
31 | index XXXXXXX..XXXXXXX 100644 | ||
32 | --- a/linux-user/hexagon/cpu_loop.c | ||
33 | +++ b/linux-user/hexagon/cpu_loop.c | ||
21 | @@ -XXX,XX +XXX,XX @@ | 34 | @@ -XXX,XX +XXX,XX @@ |
22 | * + QOM property "scc-cfg4": value of the read-only CFG4 register | ||
23 | * + QOM property "scc-aid": value of the read-only SCC_AID register | ||
24 | * + QOM property "scc-id": value of the read-only SCC_ID register | ||
25 | + * + QOM property "scc-cfg0": reset value of the CFG0 register | ||
26 | * + QOM property array "oscclk": reset values of the OSCCLK registers | ||
27 | * (which are accessed via the SYS_CFG channel provided by this device) | ||
28 | + * + named GPIO output "remap": this tracks the value of CFG0 register | ||
29 | + * bit 0. Boards where this bit controls memory remapping should | ||
30 | + * connect this GPIO line to a function performing that mapping. | ||
31 | + * Boards where bit 0 has no special function should leave the GPIO | ||
32 | + * output disconnected. | ||
33 | */ | 35 | */ |
34 | #ifndef MPS2_SCC_H | 36 | |
35 | #define MPS2_SCC_H | 37 | #include "qemu/osdep.h" |
36 | @@ -XXX,XX +XXX,XX @@ struct MPS2SCC { | 38 | +#include "qemu-common.h" |
37 | uint32_t num_oscclk; | 39 | #include "qemu.h" |
38 | uint32_t *oscclk; | 40 | #include "user-internals.h" |
39 | uint32_t *oscclk_reset; | 41 | #include "cpu_loop-common.h" |
40 | + uint32_t cfg0_reset; | ||
41 | + | ||
42 | + qemu_irq remap; | ||
43 | }; | ||
44 | |||
45 | #endif | ||
46 | diff --git a/hw/misc/mps2-scc.c b/hw/misc/mps2-scc.c | ||
47 | index XXXXXXX..XXXXXXX 100644 | ||
48 | --- a/hw/misc/mps2-scc.c | ||
49 | +++ b/hw/misc/mps2-scc.c | ||
50 | @@ -XXX,XX +XXX,XX @@ | ||
51 | #include "qemu/bitops.h" | ||
52 | #include "trace.h" | ||
53 | #include "hw/sysbus.h" | ||
54 | +#include "hw/irq.h" | ||
55 | #include "migration/vmstate.h" | ||
56 | #include "hw/registerfields.h" | ||
57 | #include "hw/misc/mps2-scc.h" | ||
58 | @@ -XXX,XX +XXX,XX @@ static void mps2_scc_write(void *opaque, hwaddr offset, uint64_t value, | ||
59 | switch (offset) { | ||
60 | case A_CFG0: | ||
61 | /* | ||
62 | - * TODO on some boards bit 0 controls RAM remapping; | ||
63 | - * on others bit 1 is CPU_WAIT. | ||
64 | + * On some boards bit 0 controls board-specific remapping; | ||
65 | + * we always reflect bit 0 in the 'remap' GPIO output line, | ||
66 | + * and let the board wire it up or not as it chooses. | ||
67 | + * TODO on some boards bit 1 is CPU_WAIT. | ||
68 | */ | ||
69 | s->cfg0 = value; | ||
70 | + qemu_set_irq(s->remap, s->cfg0 & 1); | ||
71 | break; | ||
72 | case A_CFG1: | ||
73 | s->cfg1 = value; | ||
74 | @@ -XXX,XX +XXX,XX @@ static void mps2_scc_reset(DeviceState *dev) | ||
75 | int i; | ||
76 | |||
77 | trace_mps2_scc_reset(); | ||
78 | - s->cfg0 = 0; | ||
79 | + s->cfg0 = s->cfg0_reset; | ||
80 | s->cfg1 = 0; | ||
81 | s->cfg2 = 0; | ||
82 | s->cfg5 = 0; | ||
83 | @@ -XXX,XX +XXX,XX @@ static void mps2_scc_init(Object *obj) | ||
84 | |||
85 | memory_region_init_io(&s->iomem, obj, &mps2_scc_ops, s, "mps2-scc", 0x1000); | ||
86 | sysbus_init_mmio(sbd, &s->iomem); | ||
87 | + qdev_init_gpio_out_named(DEVICE(obj), &s->remap, "remap", 1); | ||
88 | } | ||
89 | |||
90 | static void mps2_scc_realize(DeviceState *dev, Error **errp) | ||
91 | @@ -XXX,XX +XXX,XX @@ static Property mps2_scc_properties[] = { | ||
92 | DEFINE_PROP_UINT32("scc-cfg4", MPS2SCC, cfg4, 0), | ||
93 | DEFINE_PROP_UINT32("scc-aid", MPS2SCC, aid, 0), | ||
94 | DEFINE_PROP_UINT32("scc-id", MPS2SCC, id, 0), | ||
95 | + /* Reset value for CFG0 register */ | ||
96 | + DEFINE_PROP_UINT32("scc-cfg0", MPS2SCC, cfg0_reset, 0), | ||
97 | /* | ||
98 | * These are the initial settings for the source clocks on the board. | ||
99 | * In hardware they can be configured via a config file read by the | ||
100 | -- | 42 | -- |
101 | 2.20.1 | 43 | 2.25.1 |
102 | 44 | ||
103 | 45 | diff view generated by jsdifflib |
1 | Move the NeonGenThreeOpEnvFn typedef to translate.h together | 1 | The qemu-common.h header is not supposed to be included from any |
---|---|---|---|
2 | with the other similar typedefs. | 2 | other header files, only from .c files (as documented in a comment at |
3 | the start of it). | ||
4 | |||
5 | Nothing actually relies on target/rx/cpu.h including it, so we can | ||
6 | just drop the include. | ||
3 | 7 | ||
4 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
5 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 9 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
6 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 10 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> |
7 | Message-id: 20210430132740.10391-12-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 | ||
8 | --- | 14 | --- |
9 | target/arm/translate.h | 2 ++ | 15 | target/rx/cpu.h | 1 - |
10 | target/arm/translate.c | 3 --- | 16 | 1 file changed, 1 deletion(-) |
11 | 2 files changed, 2 insertions(+), 3 deletions(-) | ||
12 | 17 | ||
13 | diff --git a/target/arm/translate.h b/target/arm/translate.h | 18 | diff --git a/target/rx/cpu.h b/target/rx/cpu.h |
14 | index XXXXXXX..XXXXXXX 100644 | 19 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/target/arm/translate.h | 20 | --- a/target/rx/cpu.h |
16 | +++ b/target/arm/translate.h | 21 | +++ b/target/rx/cpu.h |
17 | @@ -XXX,XX +XXX,XX @@ typedef void NeonGenOneOpFn(TCGv_i32, TCGv_i32); | 22 | @@ -XXX,XX +XXX,XX @@ |
18 | typedef void NeonGenOneOpEnvFn(TCGv_i32, TCGv_ptr, TCGv_i32); | 23 | #define RX_CPU_H |
19 | typedef void NeonGenTwoOpFn(TCGv_i32, TCGv_i32, TCGv_i32); | 24 | |
20 | typedef void NeonGenTwoOpEnvFn(TCGv_i32, TCGv_ptr, TCGv_i32, TCGv_i32); | 25 | #include "qemu/bitops.h" |
21 | +typedef void NeonGenThreeOpEnvFn(TCGv_i32, TCGv_env, TCGv_i32, | 26 | -#include "qemu-common.h" |
22 | + TCGv_i32, TCGv_i32); | 27 | #include "hw/registerfields.h" |
23 | typedef void NeonGenTwo64OpFn(TCGv_i64, TCGv_i64, TCGv_i64); | 28 | #include "cpu-qom.h" |
24 | typedef void NeonGenTwo64OpEnvFn(TCGv_i64, TCGv_ptr, TCGv_i64, TCGv_i64); | 29 | |
25 | typedef void NeonGenNarrowFn(TCGv_i32, TCGv_i64); | ||
26 | diff --git a/target/arm/translate.c b/target/arm/translate.c | ||
27 | index XXXXXXX..XXXXXXX 100644 | ||
28 | --- a/target/arm/translate.c | ||
29 | +++ b/target/arm/translate.c | ||
30 | @@ -XXX,XX +XXX,XX @@ static const char * const regnames[] = | ||
31 | { "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", | ||
32 | "r8", "r9", "r10", "r11", "r12", "r13", "r14", "pc" }; | ||
33 | |||
34 | -/* Function prototypes for gen_ functions calling Neon helpers. */ | ||
35 | -typedef void NeonGenThreeOpEnvFn(TCGv_i32, TCGv_env, TCGv_i32, | ||
36 | - TCGv_i32, TCGv_i32); | ||
37 | |||
38 | /* initialize TCG globals. */ | ||
39 | void arm_translate_init(void) | ||
40 | -- | 30 | -- |
41 | 2.20.1 | 31 | 2.25.1 |
42 | 32 | ||
43 | 33 | diff view generated by jsdifflib |
1 | Make dis-asm.h handle being included outside an 'extern "C"' block; | 1 | A lot of C files in hw/arm include qemu-common.h when they don't |
---|---|---|---|
2 | this allows us to remove the 'extern "C"' blocks that our two C++ | 2 | need anything from it. Drop the include lines. |
3 | files that include it are using. | 3 | |
4 | omap1.c, pxa2xx.c and strongarm.c retain the include because they | ||
5 | use it for the prototype of qemu_get_timedate(). | ||
4 | 6 | ||
5 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
6 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 8 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
9 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.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 | ||
7 | --- | 13 | --- |
8 | include/disas/dis-asm.h | 12 ++++++++++-- | 14 | hw/arm/boot.c | 1 - |
9 | disas/arm-a64.cc | 2 -- | 15 | hw/arm/digic_boards.c | 1 - |
10 | disas/nanomips.cpp | 2 -- | 16 | hw/arm/highbank.c | 1 - |
11 | 3 files changed, 10 insertions(+), 6 deletions(-) | 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(-) | ||
12 | 23 | ||
13 | diff --git a/include/disas/dis-asm.h b/include/disas/dis-asm.h | 24 | diff --git a/hw/arm/boot.c b/hw/arm/boot.c |
14 | index XXXXXXX..XXXXXXX 100644 | 25 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/include/disas/dis-asm.h | 26 | --- a/hw/arm/boot.c |
16 | +++ b/include/disas/dis-asm.h | 27 | +++ b/hw/arm/boot.c |
17 | @@ -XXX,XX +XXX,XX @@ | ||
18 | #ifndef DISAS_DIS_ASM_H | ||
19 | #define DISAS_DIS_ASM_H | ||
20 | |||
21 | +#include "qemu/bswap.h" | ||
22 | + | ||
23 | +#ifdef __cplusplus | ||
24 | +extern "C" { | ||
25 | +#endif | ||
26 | + | ||
27 | typedef void *PTR; | ||
28 | typedef uint64_t bfd_vma; | ||
29 | typedef int64_t bfd_signed_vma; | ||
30 | @@ -XXX,XX +XXX,XX @@ bool cap_disas_plugin(disassemble_info *info, uint64_t pc, size_t size); | ||
31 | |||
32 | /* from libbfd */ | ||
33 | |||
34 | -#include "qemu/bswap.h" | ||
35 | - | ||
36 | static inline bfd_vma bfd_getl64(const bfd_byte *addr) | ||
37 | { | ||
38 | return ldq_le_p(addr); | ||
39 | @@ -XXX,XX +XXX,XX @@ static inline bfd_vma bfd_getb16(const bfd_byte *addr) | ||
40 | |||
41 | typedef bool bfd_boolean; | ||
42 | |||
43 | +#ifdef __cplusplus | ||
44 | +} | ||
45 | +#endif | ||
46 | + | ||
47 | #endif /* DISAS_DIS_ASM_H */ | ||
48 | diff --git a/disas/arm-a64.cc b/disas/arm-a64.cc | ||
49 | index XXXXXXX..XXXXXXX 100644 | ||
50 | --- a/disas/arm-a64.cc | ||
51 | +++ b/disas/arm-a64.cc | ||
52 | @@ -XXX,XX +XXX,XX @@ | 28 | @@ -XXX,XX +XXX,XX @@ |
53 | */ | 29 | */ |
54 | 30 | ||
55 | #include "qemu/osdep.h" | 31 | #include "qemu/osdep.h" |
56 | -extern "C" { | 32 | -#include "qemu-common.h" |
57 | #include "disas/dis-asm.h" | 33 | #include "qemu/datadir.h" |
58 | -} | 34 | #include "qemu/error-report.h" |
59 | 35 | #include "qapi/error.h" | |
60 | #include "vixl/a64/disasm-a64.h" | 36 | diff --git a/hw/arm/digic_boards.c b/hw/arm/digic_boards.c |
61 | |||
62 | diff --git a/disas/nanomips.cpp b/disas/nanomips.cpp | ||
63 | index XXXXXXX..XXXXXXX 100644 | 37 | index XXXXXXX..XXXXXXX 100644 |
64 | --- a/disas/nanomips.cpp | 38 | --- a/hw/arm/digic_boards.c |
65 | +++ b/disas/nanomips.cpp | 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 | ||
66 | @@ -XXX,XX +XXX,XX @@ | 52 | @@ -XXX,XX +XXX,XX @@ |
67 | */ | 53 | */ |
68 | 54 | ||
69 | #include "qemu/osdep.h" | 55 | #include "qemu/osdep.h" |
70 | -extern "C" { | 56 | -#include "qemu-common.h" |
71 | #include "disas/dis-asm.h" | 57 | #include "qemu/datadir.h" |
72 | -} | 58 | #include "qapi/error.h" |
73 | 59 | #include "hw/sysbus.h" | |
74 | #include <cstring> | 60 | diff --git a/hw/arm/npcm7xx_boards.c b/hw/arm/npcm7xx_boards.c |
75 | #include <stdexcept> | 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" | ||
76 | -- | 120 | -- |
77 | 2.20.1 | 121 | 2.25.1 |
78 | 122 | ||
79 | 123 | diff view generated by jsdifflib |
1 | In tlbi_aa64_vae2is_write() the calculation | 1 | The calculation of the length of TLB range invalidate operations |
---|---|---|---|
2 | bits = tlbbits_for_regime(env, secure ? ARMMMUIdx_E2 : ARMMMUIdx_SE2, | 2 | in tlbi_aa64_range_get_length() is incorrect in two ways: |
3 | pageaddr) | 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 | ||
4 | 11 | ||
5 | has the two arms of the ?: expression reversed. Fix the bug. | 12 | Thanks to the bug report submitter Cha HyunSoo for identifying |
13 | both these errors. | ||
6 | 14 | ||
7 | Fixes: b6ad6062f1e5 | 15 | Fixes: 84940ed82552d3c ("target/arm: Add support for FEAT_TLBIRANGE") |
8 | Reported-by: Rebecca Cran <rebecca@nuviainc.com> | 16 | Resolves: https://gitlab.com/qemu-project/qemu/-/issues/734 |
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 17 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
18 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
19 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | ||
10 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 20 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> |
11 | Reviewed-by: Rémi Denis-Courmont <remi.denis.courmont@huawei.com> | 21 | Message-id: 20211130173257.1274194-1-peter.maydell@linaro.org |
12 | Reviewed-by: Rebecca Cran <rebecca@nuviainc.com> | ||
13 | Message-id: 20210420123106.10861-1-peter.maydell@linaro.org | ||
14 | --- | 22 | --- |
15 | target/arm/helper.c | 2 +- | 23 | target/arm/helper.c | 6 +++--- |
16 | 1 file changed, 1 insertion(+), 1 deletion(-) | 24 | 1 file changed, 3 insertions(+), 3 deletions(-) |
17 | 25 | ||
18 | diff --git a/target/arm/helper.c b/target/arm/helper.c | 26 | diff --git a/target/arm/helper.c b/target/arm/helper.c |
19 | index XXXXXXX..XXXXXXX 100644 | 27 | index XXXXXXX..XXXXXXX 100644 |
20 | --- a/target/arm/helper.c | 28 | --- a/target/arm/helper.c |
21 | +++ b/target/arm/helper.c | 29 | +++ b/target/arm/helper.c |
22 | @@ -XXX,XX +XXX,XX @@ static void tlbi_aa64_vae2is_write(CPUARMState *env, const ARMCPRegInfo *ri, | 30 | @@ -XXX,XX +XXX,XX @@ static uint64_t tlbi_aa64_range_get_length(CPUARMState *env, |
23 | uint64_t pageaddr = sextract64(value << 12, 0, 56); | 31 | uint64_t exponent; |
24 | bool secure = arm_is_secure_below_el3(env); | 32 | uint64_t length; |
25 | int mask = secure ? ARMMMUIdxBit_SE2 : ARMMMUIdxBit_E2; | 33 | |
26 | - int bits = tlbbits_for_regime(env, secure ? ARMMMUIdx_E2 : ARMMMUIdx_SE2, | 34 | - num = extract64(value, 39, 4); |
27 | + int bits = tlbbits_for_regime(env, secure ? ARMMMUIdx_SE2 : ARMMMUIdx_E2, | 35 | + num = extract64(value, 39, 5); |
28 | pageaddr); | 36 | scale = extract64(value, 44, 2); |
29 | 37 | page_size_granule = extract64(value, 46, 2); | |
30 | tlb_flush_page_bits_by_mmuidx_all_cpus_synced(cs, pageaddr, mask, bits); | 38 | |
39 | - page_shift = page_size_granule * 2 + 12; | ||
40 | - | ||
41 | if (page_size_granule == 0) { | ||
42 | qemu_log_mask(LOG_GUEST_ERROR, "Invalid page size granule %d\n", | ||
43 | page_size_granule); | ||
44 | return 0; | ||
45 | } | ||
46 | |||
47 | + page_shift = (page_size_granule - 1) * 2 + 12; | ||
48 | + | ||
49 | exponent = (5 * scale) + 1; | ||
50 | length = (num + 1) << (exponent + page_shift); | ||
51 | |||
31 | -- | 52 | -- |
32 | 2.20.1 | 53 | 2.25.1 |
33 | 54 | ||
34 | 55 | diff view generated by jsdifflib |
1 | Move the various gen_aa32* functions and macros out of translate.c | 1 | From: Patrick Venture <venture@google.com> |
---|---|---|---|
2 | and into translate-a32.h. | ||
3 | 2 | ||
3 | The rx_active boolean change to true should always trigger a try_read | ||
4 | call that flushes the queue. | ||
5 | |||
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 | ||
4 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
5 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
6 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Message-id: 20210430132740.10391-6-peter.maydell@linaro.org | ||
8 | --- | 10 | --- |
9 | target/arm/translate-a32.h | 53 ++++++++++++++++++++++++++++++++++++++ | 11 | hw/net/npcm7xx_emc.c | 18 ++++++++---------- |
10 | target/arm/translate.c | 51 ++++++++++++------------------------ | 12 | 1 file changed, 8 insertions(+), 10 deletions(-) |
11 | 2 files changed, 69 insertions(+), 35 deletions(-) | ||
12 | 13 | ||
13 | diff --git a/target/arm/translate-a32.h b/target/arm/translate-a32.h | 14 | diff --git a/hw/net/npcm7xx_emc.c b/hw/net/npcm7xx_emc.c |
14 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/target/arm/translate-a32.h | 16 | --- a/hw/net/npcm7xx_emc.c |
16 | +++ b/target/arm/translate-a32.h | 17 | +++ b/hw/net/npcm7xx_emc.c |
17 | @@ -XXX,XX +XXX,XX @@ static inline TCGv_i32 load_reg(DisasContext *s, int reg) | 18 | @@ -XXX,XX +XXX,XX @@ static void emc_halt_rx(NPCM7xxEMCState *emc, uint32_t mista_flag) |
18 | return tmp; | 19 | emc_set_mista(emc, mista_flag); |
19 | } | 20 | } |
20 | 21 | ||
21 | +void gen_aa32_ld_internal_i32(DisasContext *s, TCGv_i32 val, | 22 | +static void emc_enable_rx_and_flush(NPCM7xxEMCState *emc) |
22 | + TCGv_i32 a32, int index, MemOp opc); | ||
23 | +void gen_aa32_st_internal_i32(DisasContext *s, TCGv_i32 val, | ||
24 | + TCGv_i32 a32, int index, MemOp opc); | ||
25 | +void gen_aa32_ld_internal_i64(DisasContext *s, TCGv_i64 val, | ||
26 | + TCGv_i32 a32, int index, MemOp opc); | ||
27 | +void gen_aa32_st_internal_i64(DisasContext *s, TCGv_i64 val, | ||
28 | + TCGv_i32 a32, int index, MemOp opc); | ||
29 | +void gen_aa32_ld_i32(DisasContext *s, TCGv_i32 val, TCGv_i32 a32, | ||
30 | + int index, MemOp opc); | ||
31 | +void gen_aa32_st_i32(DisasContext *s, TCGv_i32 val, TCGv_i32 a32, | ||
32 | + int index, MemOp opc); | ||
33 | +void gen_aa32_ld_i64(DisasContext *s, TCGv_i64 val, TCGv_i32 a32, | ||
34 | + int index, MemOp opc); | ||
35 | +void gen_aa32_st_i64(DisasContext *s, TCGv_i64 val, TCGv_i32 a32, | ||
36 | + int index, MemOp opc); | ||
37 | + | ||
38 | +#define DO_GEN_LD(SUFF, OPC) \ | ||
39 | + static inline void gen_aa32_ld##SUFF(DisasContext *s, TCGv_i32 val, \ | ||
40 | + TCGv_i32 a32, int index) \ | ||
41 | + { \ | ||
42 | + gen_aa32_ld_i32(s, val, a32, index, OPC); \ | ||
43 | + } | ||
44 | + | ||
45 | +#define DO_GEN_ST(SUFF, OPC) \ | ||
46 | + static inline void gen_aa32_st##SUFF(DisasContext *s, TCGv_i32 val, \ | ||
47 | + TCGv_i32 a32, int index) \ | ||
48 | + { \ | ||
49 | + gen_aa32_st_i32(s, val, a32, index, OPC); \ | ||
50 | + } | ||
51 | + | ||
52 | +static inline void gen_aa32_ld64(DisasContext *s, TCGv_i64 val, | ||
53 | + TCGv_i32 a32, int index) | ||
54 | +{ | 23 | +{ |
55 | + gen_aa32_ld_i64(s, val, a32, index, MO_Q); | 24 | + emc->rx_active = true; |
25 | + qemu_flush_queued_packets(qemu_get_queue(emc->nic)); | ||
56 | +} | 26 | +} |
57 | + | 27 | + |
58 | +static inline void gen_aa32_st64(DisasContext *s, TCGv_i64 val, | 28 | static void emc_set_next_tx_descriptor(NPCM7xxEMCState *emc, |
59 | + TCGv_i32 a32, int index) | 29 | const NPCM7xxEMCTxDesc *tx_desc, |
60 | +{ | 30 | uint32_t desc_addr) |
61 | + gen_aa32_st_i64(s, val, a32, index, MO_Q); | 31 | @@ -XXX,XX +XXX,XX @@ static ssize_t emc_receive(NetClientState *nc, const uint8_t *buf, size_t len1) |
62 | +} | 32 | return len; |
63 | + | ||
64 | +DO_GEN_LD(8u, MO_UB) | ||
65 | +DO_GEN_LD(16u, MO_UW) | ||
66 | +DO_GEN_LD(32u, MO_UL) | ||
67 | +DO_GEN_ST(8, MO_UB) | ||
68 | +DO_GEN_ST(16, MO_UW) | ||
69 | +DO_GEN_ST(32, MO_UL) | ||
70 | + | ||
71 | +#undef DO_GEN_LD | ||
72 | +#undef DO_GEN_ST | ||
73 | + | ||
74 | #endif | ||
75 | diff --git a/target/arm/translate.c b/target/arm/translate.c | ||
76 | index XXXXXXX..XXXXXXX 100644 | ||
77 | --- a/target/arm/translate.c | ||
78 | +++ b/target/arm/translate.c | ||
79 | @@ -XXX,XX +XXX,XX @@ static TCGv gen_aa32_addr(DisasContext *s, TCGv_i32 a32, MemOp op) | ||
80 | * Internal routines are used for NEON cases where the endianness | ||
81 | * and/or alignment has already been taken into account and manipulated. | ||
82 | */ | ||
83 | -static void gen_aa32_ld_internal_i32(DisasContext *s, TCGv_i32 val, | ||
84 | - TCGv_i32 a32, int index, MemOp opc) | ||
85 | +void gen_aa32_ld_internal_i32(DisasContext *s, TCGv_i32 val, | ||
86 | + TCGv_i32 a32, int index, MemOp opc) | ||
87 | { | ||
88 | TCGv addr = gen_aa32_addr(s, a32, opc); | ||
89 | tcg_gen_qemu_ld_i32(val, addr, index, opc); | ||
90 | tcg_temp_free(addr); | ||
91 | } | 33 | } |
92 | 34 | ||
93 | -static void gen_aa32_st_internal_i32(DisasContext *s, TCGv_i32 val, | 35 | -static void emc_try_receive_next_packet(NPCM7xxEMCState *emc) |
94 | - TCGv_i32 a32, int index, MemOp opc) | ||
95 | +void gen_aa32_st_internal_i32(DisasContext *s, TCGv_i32 val, | ||
96 | + TCGv_i32 a32, int index, MemOp opc) | ||
97 | { | ||
98 | TCGv addr = gen_aa32_addr(s, a32, opc); | ||
99 | tcg_gen_qemu_st_i32(val, addr, index, opc); | ||
100 | tcg_temp_free(addr); | ||
101 | } | ||
102 | |||
103 | -static void gen_aa32_ld_internal_i64(DisasContext *s, TCGv_i64 val, | ||
104 | - TCGv_i32 a32, int index, MemOp opc) | ||
105 | +void gen_aa32_ld_internal_i64(DisasContext *s, TCGv_i64 val, | ||
106 | + TCGv_i32 a32, int index, MemOp opc) | ||
107 | { | ||
108 | TCGv addr = gen_aa32_addr(s, a32, opc); | ||
109 | |||
110 | @@ -XXX,XX +XXX,XX @@ static void gen_aa32_ld_internal_i64(DisasContext *s, TCGv_i64 val, | ||
111 | tcg_temp_free(addr); | ||
112 | } | ||
113 | |||
114 | -static void gen_aa32_st_internal_i64(DisasContext *s, TCGv_i64 val, | ||
115 | - TCGv_i32 a32, int index, MemOp opc) | ||
116 | +void gen_aa32_st_internal_i64(DisasContext *s, TCGv_i64 val, | ||
117 | + TCGv_i32 a32, int index, MemOp opc) | ||
118 | { | ||
119 | TCGv addr = gen_aa32_addr(s, a32, opc); | ||
120 | |||
121 | @@ -XXX,XX +XXX,XX @@ static void gen_aa32_st_internal_i64(DisasContext *s, TCGv_i64 val, | ||
122 | tcg_temp_free(addr); | ||
123 | } | ||
124 | |||
125 | -static void gen_aa32_ld_i32(DisasContext *s, TCGv_i32 val, TCGv_i32 a32, | ||
126 | - int index, MemOp opc) | ||
127 | +void gen_aa32_ld_i32(DisasContext *s, TCGv_i32 val, TCGv_i32 a32, | ||
128 | + int index, MemOp opc) | ||
129 | { | ||
130 | gen_aa32_ld_internal_i32(s, val, a32, index, finalize_memop(s, opc)); | ||
131 | } | ||
132 | |||
133 | -static void gen_aa32_st_i32(DisasContext *s, TCGv_i32 val, TCGv_i32 a32, | ||
134 | - int index, MemOp opc) | ||
135 | +void gen_aa32_st_i32(DisasContext *s, TCGv_i32 val, TCGv_i32 a32, | ||
136 | + int index, MemOp opc) | ||
137 | { | ||
138 | gen_aa32_st_internal_i32(s, val, a32, index, finalize_memop(s, opc)); | ||
139 | } | ||
140 | |||
141 | -static void gen_aa32_ld_i64(DisasContext *s, TCGv_i64 val, TCGv_i32 a32, | ||
142 | - int index, MemOp opc) | ||
143 | +void gen_aa32_ld_i64(DisasContext *s, TCGv_i64 val, TCGv_i32 a32, | ||
144 | + int index, MemOp opc) | ||
145 | { | ||
146 | gen_aa32_ld_internal_i64(s, val, a32, index, finalize_memop(s, opc)); | ||
147 | } | ||
148 | |||
149 | -static void gen_aa32_st_i64(DisasContext *s, TCGv_i64 val, TCGv_i32 a32, | ||
150 | - int index, MemOp opc) | ||
151 | +void gen_aa32_st_i64(DisasContext *s, TCGv_i64 val, TCGv_i32 a32, | ||
152 | + int index, MemOp opc) | ||
153 | { | ||
154 | gen_aa32_st_internal_i64(s, val, a32, index, finalize_memop(s, opc)); | ||
155 | } | ||
156 | @@ -XXX,XX +XXX,XX @@ static void gen_aa32_st_i64(DisasContext *s, TCGv_i64 val, TCGv_i32 a32, | ||
157 | gen_aa32_st_i32(s, val, a32, index, OPC); \ | ||
158 | } | ||
159 | |||
160 | -static inline void gen_aa32_ld64(DisasContext *s, TCGv_i64 val, | ||
161 | - TCGv_i32 a32, int index) | ||
162 | -{ | 36 | -{ |
163 | - gen_aa32_ld_i64(s, val, a32, index, MO_Q); | 37 | - if (emc_can_receive(qemu_get_queue(emc->nic))) { |
38 | - qemu_flush_queued_packets(qemu_get_queue(emc->nic)); | ||
39 | - } | ||
164 | -} | 40 | -} |
165 | - | 41 | - |
166 | -static inline void gen_aa32_st64(DisasContext *s, TCGv_i64 val, | 42 | static uint64_t npcm7xx_emc_read(void *opaque, hwaddr offset, unsigned size) |
167 | - TCGv_i32 a32, int index) | ||
168 | -{ | ||
169 | - gen_aa32_st_i64(s, val, a32, index, MO_Q); | ||
170 | -} | ||
171 | - | ||
172 | -DO_GEN_LD(8u, MO_UB) | ||
173 | -DO_GEN_LD(16u, MO_UW) | ||
174 | -DO_GEN_LD(32u, MO_UL) | ||
175 | -DO_GEN_ST(8, MO_UB) | ||
176 | -DO_GEN_ST(16, MO_UW) | ||
177 | -DO_GEN_ST(32, MO_UL) | ||
178 | - | ||
179 | static inline void gen_hvc(DisasContext *s, int imm16) | ||
180 | { | 43 | { |
181 | /* The pre HVC helper handles cases when HVC gets trapped | 44 | NPCM7xxEMCState *emc = opaque; |
45 | @@ -XXX,XX +XXX,XX @@ static void npcm7xx_emc_write(void *opaque, hwaddr offset, | ||
46 | emc->regs[REG_MGSTA] |= REG_MGSTA_RXHA; | ||
47 | } | ||
48 | if (value & REG_MCMDR_RXON) { | ||
49 | - emc->rx_active = true; | ||
50 | + emc_enable_rx_and_flush(emc); | ||
51 | } else { | ||
52 | emc_halt_rx(emc, 0); | ||
53 | } | ||
54 | @@ -XXX,XX +XXX,XX @@ static void npcm7xx_emc_write(void *opaque, hwaddr offset, | ||
55 | break; | ||
56 | case REG_RSDR: | ||
57 | if (emc->regs[REG_MCMDR] & REG_MCMDR_RXON) { | ||
58 | - emc->rx_active = true; | ||
59 | - emc_try_receive_next_packet(emc); | ||
60 | + emc_enable_rx_and_flush(emc); | ||
61 | } | ||
62 | break; | ||
63 | case REG_MIIDA: | ||
182 | -- | 64 | -- |
183 | 2.20.1 | 65 | 2.25.1 |
184 | 66 | ||
185 | 67 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Jean-Philippe Brucker <jean-philippe@linaro.org> | ||
1 | 2 | ||
3 | When a virtio-iommu is instantiated, describe it using the ACPI VIOT | ||
4 | table. | ||
5 | |||
6 | Acked-by: Igor Mammedov <imammedo@redhat.com> | ||
7 | Reviewed-by: Eric Auger <eric.auger@redhat.com> | ||
8 | Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org> | ||
9 | Message-id: 20211210170415.583179-2-jean-philippe@linaro.org | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
11 | --- | ||
12 | hw/arm/virt-acpi-build.c | 7 +++++++ | ||
13 | hw/arm/Kconfig | 1 + | ||
14 | 2 files changed, 8 insertions(+) | ||
15 | |||
16 | diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c | ||
17 | index XXXXXXX..XXXXXXX 100644 | ||
18 | --- a/hw/arm/virt-acpi-build.c | ||
19 | +++ b/hw/arm/virt-acpi-build.c | ||
20 | @@ -XXX,XX +XXX,XX @@ | ||
21 | #include "kvm_arm.h" | ||
22 | #include "migration/vmstate.h" | ||
23 | #include "hw/acpi/ghes.h" | ||
24 | +#include "hw/acpi/viot.h" | ||
25 | |||
26 | #define ARM_SPI_BASE 32 | ||
27 | |||
28 | @@ -XXX,XX +XXX,XX @@ void virt_acpi_build(VirtMachineState *vms, AcpiBuildTables *tables) | ||
29 | } | ||
30 | #endif | ||
31 | |||
32 | + if (vms->iommu == VIRT_IOMMU_VIRTIO) { | ||
33 | + acpi_add_table(table_offsets, tables_blob); | ||
34 | + build_viot(ms, tables_blob, tables->linker, vms->virtio_iommu_bdf, | ||
35 | + vms->oem_id, vms->oem_table_id); | ||
36 | + } | ||
37 | + | ||
38 | /* XSDT is pointed to by RSDP */ | ||
39 | xsdt = tables_blob->len; | ||
40 | build_xsdt(tables_blob, tables->linker, table_offsets, vms->oem_id, | ||
41 | diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig | ||
42 | index XXXXXXX..XXXXXXX 100644 | ||
43 | --- a/hw/arm/Kconfig | ||
44 | +++ b/hw/arm/Kconfig | ||
45 | @@ -XXX,XX +XXX,XX @@ config ARM_VIRT | ||
46 | select DIMM | ||
47 | select ACPI_HW_REDUCED | ||
48 | select ACPI_APEI | ||
49 | + select ACPI_VIOT | ||
50 | |||
51 | config CHEETAH | ||
52 | bool | ||
53 | -- | ||
54 | 2.25.1 | ||
55 | |||
56 | diff view generated by jsdifflib |
1 | The WFI insn is not system-mode only, though it doesn't usually make | 1 | From: Jean-Philippe Brucker <jean-philippe@linaro.org> |
---|---|---|---|
2 | a huge amount of sense for userspace code to execute it. Currently | ||
3 | if you try it in qemu-arm then the helper function will raise an | ||
4 | EXCP_HLT exception, which is not covered by the switch in cpu_loop() | ||
5 | and results in an abort: | ||
6 | 2 | ||
7 | qemu: unhandled CPU exception 0x10001 - aborting | 3 | virtio-iommu is now supported with ACPI VIOT as well as device tree. |
8 | R00=00000001 R01=408003e4 R02=408003ec R03=000102ec | 4 | Remove the restriction that prevents from instantiating a virtio-iommu |
9 | R04=00010a28 R05=00010158 R06=00087460 R07=00010158 | 5 | device under ACPI. |
10 | R08=00000000 R09=00000000 R10=00085b7c R11=408002a4 | ||
11 | R12=408002b8 R13=408002a0 R14=0001057c R15=000102f8 | ||
12 | PSR=60000010 -ZC- A usr32 | ||
13 | qemu:handle_cpu_signal received signal outside vCPU context @ pc=0x7fcbfa4f0a12 | ||
14 | 6 | ||
15 | Make the WFI helper function return immediately in the usermode | 7 | Acked-by: Igor Mammedov <imammedo@redhat.com> |
16 | emulator. This turns WFI into a NOP, which is OK because: | 8 | Reviewed-by: Eric Auger <eric.auger@redhat.com> |
17 | * architecturally "WFI is a NOP" is a permitted implementation | 9 | Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org> |
18 | * aarch64 Linux kernels use the SCTLR_EL1.nTWI bit to trap | 10 | Message-id: 20211210170415.583179-3-jean-philippe@linaro.org |
19 | userspace WFI and NOP it (though aarch32 kernels currently | 11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
20 | just let WFI do whatever it would do) | 12 | --- |
13 | hw/arm/virt.c | 10 ++-------- | ||
14 | hw/virtio/virtio-iommu-pci.c | 12 ++---------- | ||
15 | 2 files changed, 4 insertions(+), 18 deletions(-) | ||
21 | 16 | ||
22 | We could in theory make the translate.c code special case user-mode | 17 | diff --git a/hw/arm/virt.c b/hw/arm/virt.c |
23 | emulation and NOP the insn entirely rather than making the helper | ||
24 | do nothing, but because no real world code will be trying to | ||
25 | execute WFI we don't care about efficiency and the helper provides | ||
26 | a single place where we can make the change rather than having | ||
27 | to touch multiple places in translate.c and translate-a64.c. | ||
28 | |||
29 | Fixes: https://bugs.launchpad.net/qemu/+bug/1926759 | ||
30 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
31 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
32 | Message-id: 20210430162212.825-1-peter.maydell@linaro.org | ||
33 | --- | ||
34 | target/arm/op_helper.c | 12 ++++++++++++ | ||
35 | 1 file changed, 12 insertions(+) | ||
36 | |||
37 | diff --git a/target/arm/op_helper.c b/target/arm/op_helper.c | ||
38 | index XXXXXXX..XXXXXXX 100644 | 18 | index XXXXXXX..XXXXXXX 100644 |
39 | --- a/target/arm/op_helper.c | 19 | --- a/hw/arm/virt.c |
40 | +++ b/target/arm/op_helper.c | 20 | +++ b/hw/arm/virt.c |
41 | @@ -XXX,XX +XXX,XX @@ static inline int check_wfx_trap(CPUARMState *env, bool is_wfe) | 21 | @@ -XXX,XX +XXX,XX @@ static HotplugHandler *virt_machine_get_hotplug_handler(MachineState *machine, |
42 | 22 | MachineClass *mc = MACHINE_GET_CLASS(machine); | |
43 | void HELPER(wfi)(CPUARMState *env, uint32_t insn_len) | 23 | |
44 | { | 24 | if (device_is_dynamic_sysbus(mc, dev) || |
45 | +#ifdef CONFIG_USER_ONLY | 25 | - (object_dynamic_cast(OBJECT(dev), TYPE_PC_DIMM))) { |
46 | + /* | 26 | + object_dynamic_cast(OBJECT(dev), TYPE_PC_DIMM) || |
47 | + * WFI in the user-mode emulator is technically permitted but not | 27 | + object_dynamic_cast(OBJECT(dev), TYPE_VIRTIO_IOMMU_PCI)) { |
48 | + * something any real-world code would do. AArch64 Linux kernels | 28 | return HOTPLUG_HANDLER(machine); |
49 | + * trap it via SCTRL_EL1.nTWI and make it an (expensive) NOP; | 29 | } |
50 | + * AArch32 kernels don't trap it so it will delay a bit. | 30 | - if (object_dynamic_cast(OBJECT(dev), TYPE_VIRTIO_IOMMU_PCI)) { |
51 | + * For QEMU, make it NOP here, because trying to raise EXCP_HLT | 31 | - VirtMachineState *vms = VIRT_MACHINE(machine); |
52 | + * would trigger an abort. | 32 | - |
53 | + */ | 33 | - if (!vms->bootinfo.firmware_loaded || !virt_is_acpi_enabled(vms)) { |
54 | + return; | 34 | - return HOTPLUG_HANDLER(machine); |
55 | +#else | 35 | - } |
56 | CPUState *cs = env_cpu(env); | 36 | - } |
57 | int target_el = check_wfx_trap(env, false); | 37 | return NULL; |
58 | |||
59 | @@ -XXX,XX +XXX,XX @@ void HELPER(wfi)(CPUARMState *env, uint32_t insn_len) | ||
60 | cs->exception_index = EXCP_HLT; | ||
61 | cs->halted = 1; | ||
62 | cpu_loop_exit(cs); | ||
63 | +#endif | ||
64 | } | 38 | } |
65 | 39 | ||
66 | void HELPER(wfe)(CPUARMState *env) | 40 | diff --git a/hw/virtio/virtio-iommu-pci.c b/hw/virtio/virtio-iommu-pci.c |
41 | index XXXXXXX..XXXXXXX 100644 | ||
42 | --- a/hw/virtio/virtio-iommu-pci.c | ||
43 | +++ b/hw/virtio/virtio-iommu-pci.c | ||
44 | @@ -XXX,XX +XXX,XX @@ static void virtio_iommu_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp) | ||
45 | VirtIOIOMMU *s = VIRTIO_IOMMU(vdev); | ||
46 | |||
47 | if (!qdev_get_machine_hotplug_handler(DEVICE(vpci_dev))) { | ||
48 | - MachineClass *mc = MACHINE_GET_CLASS(qdev_get_machine()); | ||
49 | - | ||
50 | - error_setg(errp, | ||
51 | - "%s machine fails to create iommu-map device tree bindings", | ||
52 | - mc->name); | ||
53 | - error_append_hint(errp, | ||
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++) { | ||
67 | -- | 63 | -- |
68 | 2.20.1 | 64 | 2.25.1 |
69 | 65 | ||
70 | 66 | diff view generated by jsdifflib |
1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> | 1 | From: Jean-Philippe Brucker <jean-philippe@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | The i.MX25 PDK board has 2 banks for SDRAM, each can | 3 | We do not support instantiating multiple IOMMUs. Before adding a |
4 | address up to 256 MiB. So the total RAM usable for this | 4 | virtio-iommu, check that no other IOMMU is present. This will detect |
5 | board is 512M. When we ask for more we get a misleading | 5 | both "iommu=smmuv3" machine parameter and another virtio-iommu instance. |
6 | error message: | ||
7 | 6 | ||
8 | $ qemu-system-arm -M imx25-pdk -m 513M | 7 | Fixes: 70e89132c9 ("hw/arm/virt: Add the virtio-iommu device tree mappings") |
9 | qemu-system-arm: Invalid RAM size, should be 128 MiB | 8 | Reviewed-by: Eric Auger <eric.auger@redhat.com> |
10 | |||
11 | Update the error message to better match the reality: | ||
12 | |||
13 | $ qemu-system-arm -M imx25-pdk -m 513M | ||
14 | qemu-system-arm: RAM size more than 512 MiB is not supported | ||
15 | |||
16 | Fixes: bf350daae02 ("arm/imx25_pdk: drop RAM size fixup") | ||
17 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
18 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
19 | Reviewed-by: Igor Mammedov <imammedo@redhat.com> | 9 | Reviewed-by: Igor Mammedov <imammedo@redhat.com> |
20 | Message-id: 20210407225608.1882855-1-f4bug@amsat.org | 10 | Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org> |
11 | Message-id: 20211210170415.583179-4-jean-philippe@linaro.org | ||
21 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
22 | --- | 13 | --- |
23 | hw/arm/imx25_pdk.c | 5 ++--- | 14 | hw/arm/virt.c | 5 +++++ |
24 | 1 file changed, 2 insertions(+), 3 deletions(-) | 15 | 1 file changed, 5 insertions(+) |
25 | 16 | ||
26 | diff --git a/hw/arm/imx25_pdk.c b/hw/arm/imx25_pdk.c | 17 | diff --git a/hw/arm/virt.c b/hw/arm/virt.c |
27 | index XXXXXXX..XXXXXXX 100644 | 18 | index XXXXXXX..XXXXXXX 100644 |
28 | --- a/hw/arm/imx25_pdk.c | 19 | --- a/hw/arm/virt.c |
29 | +++ b/hw/arm/imx25_pdk.c | 20 | +++ b/hw/arm/virt.c |
30 | @@ -XXX,XX +XXX,XX @@ static struct arm_boot_info imx25_pdk_binfo; | 21 | @@ -XXX,XX +XXX,XX @@ static void virt_machine_device_pre_plug_cb(HotplugHandler *hotplug_dev, |
31 | 22 | hwaddr db_start = 0, db_end = 0; | |
32 | static void imx25_pdk_init(MachineState *machine) | 23 | char *resv_prop_str; |
33 | { | 24 | |
34 | - MachineClass *mc = MACHINE_GET_CLASS(machine); | 25 | + if (vms->iommu != VIRT_IOMMU_NONE) { |
35 | IMX25PDK *s = g_new0(IMX25PDK, 1); | 26 | + error_setg(errp, "virt machine does not support multiple IOMMUs"); |
36 | unsigned int ram_size; | 27 | + return; |
37 | unsigned int alias_offset; | 28 | + } |
38 | @@ -XXX,XX +XXX,XX @@ static void imx25_pdk_init(MachineState *machine) | 29 | + |
39 | 30 | switch (vms->msi_controller) { | |
40 | /* We need to initialize our memory */ | 31 | case VIRT_MSI_CTRL_NONE: |
41 | if (machine->ram_size > (FSL_IMX25_SDRAM0_SIZE + FSL_IMX25_SDRAM1_SIZE)) { | 32 | return; |
42 | - char *sz = size_to_str(mc->default_ram_size); | ||
43 | - error_report("Invalid RAM size, should be %s", sz); | ||
44 | + char *sz = size_to_str(FSL_IMX25_SDRAM0_SIZE + FSL_IMX25_SDRAM1_SIZE); | ||
45 | + error_report("RAM size more than %s is not supported", sz); | ||
46 | g_free(sz); | ||
47 | exit(EXIT_FAILURE); | ||
48 | } | ||
49 | -- | 33 | -- |
50 | 2.20.1 | 34 | 2.25.1 |
51 | 35 | ||
52 | 36 | diff view generated by jsdifflib |
1 | Make the remaining functions which are needed by translate-vfp.c.inc | 1 | From: Jean-Philippe Brucker <jean-philippe@linaro.org> |
---|---|---|---|
2 | global. | ||
3 | 2 | ||
3 | To propagate errors to the caller of the pre_plug callback, use the | ||
4 | object_poperty_set*() functions directly instead of the qdev_prop_set*() | ||
5 | helpers. | ||
6 | |||
7 | Suggested-by: Igor Mammedov <imammedo@redhat.com> | ||
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 | ||
4 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
5 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
6 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Message-id: 20210430132740.10391-8-peter.maydell@linaro.org | ||
8 | --- | 13 | --- |
9 | target/arm/translate-a32.h | 18 ++++++++++++++++++ | 14 | hw/arm/virt.c | 5 +++-- |
10 | target/arm/translate.c | 25 ++++++++----------------- | 15 | 1 file changed, 3 insertions(+), 2 deletions(-) |
11 | 2 files changed, 26 insertions(+), 17 deletions(-) | ||
12 | 16 | ||
13 | diff --git a/target/arm/translate-a32.h b/target/arm/translate-a32.h | 17 | diff --git a/hw/arm/virt.c b/hw/arm/virt.c |
14 | index XXXXXXX..XXXXXXX 100644 | 18 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/target/arm/translate-a32.h | 19 | --- a/hw/arm/virt.c |
16 | +++ b/target/arm/translate-a32.h | 20 | +++ b/hw/arm/virt.c |
17 | @@ -XXX,XX +XXX,XX @@ void read_neon_element32(TCGv_i32 dest, int reg, int ele, MemOp memop); | 21 | @@ -XXX,XX +XXX,XX @@ static void virt_machine_device_pre_plug_cb(HotplugHandler *hotplug_dev, |
18 | void read_neon_element64(TCGv_i64 dest, int reg, int ele, MemOp memop); | 22 | db_start, db_end, |
19 | void write_neon_element32(TCGv_i32 src, int reg, int ele, MemOp memop); | 23 | VIRTIO_IOMMU_RESV_MEM_T_MSI); |
20 | void write_neon_element64(TCGv_i64 src, int reg, int ele, MemOp memop); | 24 | |
21 | +TCGv_i32 add_reg_for_lit(DisasContext *s, int reg, int ofs); | 25 | - qdev_prop_set_uint32(dev, "len-reserved-regions", 1); |
22 | +void gen_set_cpsr(TCGv_i32 var, uint32_t mask); | 26 | - qdev_prop_set_string(dev, "reserved-regions[0]", resv_prop_str); |
23 | +void gen_set_condexec(DisasContext *s); | 27 | + object_property_set_uint(OBJECT(dev), "len-reserved-regions", 1, errp); |
24 | +void gen_set_pc_im(DisasContext *s, target_ulong val); | 28 | + object_property_set_str(OBJECT(dev), "reserved-regions[0]", |
25 | +void gen_lookup_tb(DisasContext *s); | 29 | + resv_prop_str, errp); |
26 | +long vfp_reg_offset(bool dp, unsigned reg); | 30 | g_free(resv_prop_str); |
27 | +long neon_full_reg_offset(unsigned reg); | ||
28 | |||
29 | static inline TCGv_i32 load_cpu_offset(int offset) | ||
30 | { | ||
31 | @@ -XXX,XX +XXX,XX @@ static inline TCGv_i32 load_reg(DisasContext *s, int reg) | ||
32 | return tmp; | ||
33 | } | ||
34 | |||
35 | +void store_reg(DisasContext *s, int reg, TCGv_i32 var); | ||
36 | + | ||
37 | void gen_aa32_ld_internal_i32(DisasContext *s, TCGv_i32 val, | ||
38 | TCGv_i32 a32, int index, MemOp opc); | ||
39 | void gen_aa32_st_internal_i32(DisasContext *s, TCGv_i32 val, | ||
40 | @@ -XXX,XX +XXX,XX @@ DO_GEN_ST(32, MO_UL) | ||
41 | #undef DO_GEN_LD | ||
42 | #undef DO_GEN_ST | ||
43 | |||
44 | +#if defined(CONFIG_USER_ONLY) | ||
45 | +#define IS_USER(s) 1 | ||
46 | +#else | ||
47 | +#define IS_USER(s) (s->user) | ||
48 | +#endif | ||
49 | + | ||
50 | +/* Set NZCV flags from the high 4 bits of var. */ | ||
51 | +#define gen_set_nzcv(var) gen_set_cpsr(var, CPSR_NZCV) | ||
52 | + | ||
53 | #endif | ||
54 | diff --git a/target/arm/translate.c b/target/arm/translate.c | ||
55 | index XXXXXXX..XXXXXXX 100644 | ||
56 | --- a/target/arm/translate.c | ||
57 | +++ b/target/arm/translate.c | ||
58 | @@ -XXX,XX +XXX,XX @@ | ||
59 | #include "translate.h" | ||
60 | #include "translate-a32.h" | ||
61 | |||
62 | -#if defined(CONFIG_USER_ONLY) | ||
63 | -#define IS_USER(s) 1 | ||
64 | -#else | ||
65 | -#define IS_USER(s) (s->user) | ||
66 | -#endif | ||
67 | - | ||
68 | /* These are TCG temporaries used only by the legacy iwMMXt decoder */ | ||
69 | static TCGv_i64 cpu_V0, cpu_V1, cpu_M0; | ||
70 | /* These are TCG globals which alias CPUARMState fields */ | ||
71 | @@ -XXX,XX +XXX,XX @@ void load_reg_var(DisasContext *s, TCGv_i32 var, int reg) | ||
72 | * This is used for load/store for which use of PC implies (literal), | ||
73 | * or ADD that implies ADR. | ||
74 | */ | ||
75 | -static TCGv_i32 add_reg_for_lit(DisasContext *s, int reg, int ofs) | ||
76 | +TCGv_i32 add_reg_for_lit(DisasContext *s, int reg, int ofs) | ||
77 | { | ||
78 | TCGv_i32 tmp = tcg_temp_new_i32(); | ||
79 | |||
80 | @@ -XXX,XX +XXX,XX @@ static TCGv_i32 add_reg_for_lit(DisasContext *s, int reg, int ofs) | ||
81 | |||
82 | /* Set a CPU register. The source must be a temporary and will be | ||
83 | marked as dead. */ | ||
84 | -static void store_reg(DisasContext *s, int reg, TCGv_i32 var) | ||
85 | +void store_reg(DisasContext *s, int reg, TCGv_i32 var) | ||
86 | { | ||
87 | if (reg == 15) { | ||
88 | /* In Thumb mode, we must ignore bit 0. | ||
89 | @@ -XXX,XX +XXX,XX @@ static void store_sp_checked(DisasContext *s, TCGv_i32 var) | ||
90 | #define gen_sxtb16(var) gen_helper_sxtb16(var, var) | ||
91 | #define gen_uxtb16(var) gen_helper_uxtb16(var, var) | ||
92 | |||
93 | - | ||
94 | -static inline void gen_set_cpsr(TCGv_i32 var, uint32_t mask) | ||
95 | +void gen_set_cpsr(TCGv_i32 var, uint32_t mask) | ||
96 | { | ||
97 | TCGv_i32 tmp_mask = tcg_const_i32(mask); | ||
98 | gen_helper_cpsr_write(cpu_env, var, tmp_mask); | ||
99 | tcg_temp_free_i32(tmp_mask); | ||
100 | } | ||
101 | -/* Set NZCV flags from the high 4 bits of var. */ | ||
102 | -#define gen_set_nzcv(var) gen_set_cpsr(var, CPSR_NZCV) | ||
103 | |||
104 | static void gen_exception_internal(int excp) | ||
105 | { | ||
106 | @@ -XXX,XX +XXX,XX @@ void arm_gen_test_cc(int cc, TCGLabel *label) | ||
107 | arm_free_cc(&cmp); | ||
108 | } | ||
109 | |||
110 | -static inline void gen_set_condexec(DisasContext *s) | ||
111 | +void gen_set_condexec(DisasContext *s) | ||
112 | { | ||
113 | if (s->condexec_mask) { | ||
114 | uint32_t val = (s->condexec_cond << 4) | (s->condexec_mask >> 1); | ||
115 | @@ -XXX,XX +XXX,XX @@ static inline void gen_set_condexec(DisasContext *s) | ||
116 | } | 31 | } |
117 | } | 32 | } |
118 | |||
119 | -static inline void gen_set_pc_im(DisasContext *s, target_ulong val) | ||
120 | +void gen_set_pc_im(DisasContext *s, target_ulong val) | ||
121 | { | ||
122 | tcg_gen_movi_i32(cpu_R[15], val); | ||
123 | } | ||
124 | @@ -XXX,XX +XXX,XX @@ static void gen_exception_el(DisasContext *s, int excp, uint32_t syn, | ||
125 | } | ||
126 | |||
127 | /* Force a TB lookup after an instruction that changes the CPU state. */ | ||
128 | -static inline void gen_lookup_tb(DisasContext *s) | ||
129 | +void gen_lookup_tb(DisasContext *s) | ||
130 | { | ||
131 | tcg_gen_movi_i32(cpu_R[15], s->base.pc_next); | ||
132 | s->base.is_jmp = DISAS_EXIT; | ||
133 | @@ -XXX,XX +XXX,XX @@ static inline void gen_hlt(DisasContext *s, int imm) | ||
134 | /* | ||
135 | * Return the offset of a "full" NEON Dreg. | ||
136 | */ | ||
137 | -static long neon_full_reg_offset(unsigned reg) | ||
138 | +long neon_full_reg_offset(unsigned reg) | ||
139 | { | ||
140 | return offsetof(CPUARMState, vfp.zregs[reg >> 1].d[reg & 1]); | ||
141 | } | ||
142 | @@ -XXX,XX +XXX,XX @@ static long neon_element_offset(int reg, int element, MemOp memop) | ||
143 | } | ||
144 | |||
145 | /* Return the offset of a VFP Dreg (dp = true) or VFP Sreg (dp = false). */ | ||
146 | -static long vfp_reg_offset(bool dp, unsigned reg) | ||
147 | +long vfp_reg_offset(bool dp, unsigned reg) | ||
148 | { | ||
149 | if (dp) { | ||
150 | return neon_element_offset(reg, 0, MO_64); | ||
151 | -- | 33 | -- |
152 | 2.20.1 | 34 | 2.25.1 |
153 | 35 | ||
154 | 36 | diff view generated by jsdifflib |
1 | Both os-win32.h and os-posix.h include system header files. Instead | 1 | From: Jean-Philippe Brucker <jean-philippe@linaro.org> |
---|---|---|---|
2 | of having osdep.h include them inside its 'extern "C"' block, make | ||
3 | these headers handle that themselves, so that we don't include the | ||
4 | system headers inside 'extern "C"'. | ||
5 | 2 | ||
6 | This doesn't fix any current problems, but it's conceptually the | 3 | Create empty data files and allow updates for the upcoming VIOT tests. |
7 | right way to handle system headers. | ||
8 | 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> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
10 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
11 | --- | 10 | --- |
12 | include/qemu/osdep.h | 8 ++++---- | 11 | tests/qtest/bios-tables-test-allowed-diff.h | 3 +++ |
13 | include/sysemu/os-posix.h | 8 ++++++++ | 12 | tests/data/acpi/q35/DSDT.viot | 0 |
14 | include/sysemu/os-win32.h | 8 ++++++++ | 13 | tests/data/acpi/q35/VIOT.viot | 0 |
15 | 3 files changed, 20 insertions(+), 4 deletions(-) | 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 | ||
16 | 19 | ||
17 | diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h | 20 | diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h |
18 | index XXXXXXX..XXXXXXX 100644 | 21 | index XXXXXXX..XXXXXXX 100644 |
19 | --- a/include/qemu/osdep.h | 22 | --- a/tests/qtest/bios-tables-test-allowed-diff.h |
20 | +++ b/include/qemu/osdep.h | 23 | +++ b/tests/qtest/bios-tables-test-allowed-diff.h |
21 | @@ -XXX,XX +XXX,XX @@ QEMU_EXTERN_C int daemon(int, int); | 24 | @@ -1 +1,4 @@ |
22 | */ | 25 | /* List of comma-separated changed AML files to ignore */ |
23 | #include "glib-compat.h" | 26 | +"tests/data/acpi/virt/VIOT", |
24 | 27 | +"tests/data/acpi/q35/DSDT.viot", | |
25 | -#ifdef __cplusplus | 28 | +"tests/data/acpi/q35/VIOT.viot", |
26 | -extern "C" { | 29 | diff --git a/tests/data/acpi/q35/DSDT.viot b/tests/data/acpi/q35/DSDT.viot |
27 | -#endif | 30 | new file mode 100644 |
28 | - | 31 | index XXXXXXX..XXXXXXX |
29 | #ifdef _WIN32 | 32 | diff --git a/tests/data/acpi/q35/VIOT.viot b/tests/data/acpi/q35/VIOT.viot |
30 | #include "sysemu/os-win32.h" | 33 | new file mode 100644 |
31 | #endif | 34 | index XXXXXXX..XXXXXXX |
32 | @@ -XXX,XX +XXX,XX @@ extern "C" { | 35 | diff --git a/tests/data/acpi/virt/VIOT b/tests/data/acpi/virt/VIOT |
33 | #include "sysemu/os-posix.h" | 36 | new file mode 100644 |
34 | #endif | 37 | index XXXXXXX..XXXXXXX |
35 | |||
36 | +#ifdef __cplusplus | ||
37 | +extern "C" { | ||
38 | +#endif | ||
39 | + | ||
40 | #include "qemu/typedefs.h" | ||
41 | |||
42 | /* | ||
43 | diff --git a/include/sysemu/os-posix.h b/include/sysemu/os-posix.h | ||
44 | index XXXXXXX..XXXXXXX 100644 | ||
45 | --- a/include/sysemu/os-posix.h | ||
46 | +++ b/include/sysemu/os-posix.h | ||
47 | @@ -XXX,XX +XXX,XX @@ | ||
48 | #include <sys/sysmacros.h> | ||
49 | #endif | ||
50 | |||
51 | +#ifdef __cplusplus | ||
52 | +extern "C" { | ||
53 | +#endif | ||
54 | + | ||
55 | void os_set_line_buffering(void); | ||
56 | void os_set_proc_name(const char *s); | ||
57 | void os_setup_signal_handling(void); | ||
58 | @@ -XXX,XX +XXX,XX @@ static inline void qemu_funlockfile(FILE *f) | ||
59 | funlockfile(f); | ||
60 | } | ||
61 | |||
62 | +#ifdef __cplusplus | ||
63 | +} | ||
64 | +#endif | ||
65 | + | ||
66 | #endif | ||
67 | diff --git a/include/sysemu/os-win32.h b/include/sysemu/os-win32.h | ||
68 | index XXXXXXX..XXXXXXX 100644 | ||
69 | --- a/include/sysemu/os-win32.h | ||
70 | +++ b/include/sysemu/os-win32.h | ||
71 | @@ -XXX,XX +XXX,XX @@ | ||
72 | #include <windows.h> | ||
73 | #include <ws2tcpip.h> | ||
74 | |||
75 | +#ifdef __cplusplus | ||
76 | +extern "C" { | ||
77 | +#endif | ||
78 | + | ||
79 | #if defined(_WIN64) | ||
80 | /* On w64, setjmp is implemented by _setjmp which needs a second parameter. | ||
81 | * If this parameter is NULL, longjump does no stack unwinding. | ||
82 | @@ -XXX,XX +XXX,XX @@ ssize_t qemu_recv_wrap(int sockfd, void *buf, size_t len, int flags); | ||
83 | ssize_t qemu_recvfrom_wrap(int sockfd, void *buf, size_t len, int flags, | ||
84 | struct sockaddr *addr, socklen_t *addrlen); | ||
85 | |||
86 | +#ifdef __cplusplus | ||
87 | +} | ||
88 | +#endif | ||
89 | + | ||
90 | #endif | ||
91 | -- | 38 | -- |
92 | 2.20.1 | 39 | 2.25.1 |
93 | 40 | ||
94 | 41 | diff view generated by jsdifflib |
1 | The functions vfp_load_reg32(), vfp_load_reg64(), vfp_store_reg32() | 1 | From: Jean-Philippe Brucker <jean-philippe@linaro.org> |
---|---|---|---|
2 | and vfp_store_reg64() are used only in translate-vfp.c.inc. Move | ||
3 | them to that file. | ||
4 | 2 | ||
3 | Add two test cases for VIOT, one on the q35 machine and the other on | ||
4 | virt. To test complex topologies the q35 test has two PCIe buses that | ||
5 | bypass the IOMMU (and are therefore not described by VIOT), and two | ||
6 | buses that are translated by virtio-iommu. | ||
7 | |||
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-7-jean-philippe@linaro.org | ||
5 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
6 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
7 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
8 | Message-id: 20210430132740.10391-7-peter.maydell@linaro.org | ||
9 | --- | 13 | --- |
10 | target/arm/translate.c | 20 -------------------- | 14 | tests/qtest/bios-tables-test.c | 38 ++++++++++++++++++++++++++++++++++ |
11 | target/arm/translate-vfp.c.inc | 20 ++++++++++++++++++++ | 15 | 1 file changed, 38 insertions(+) |
12 | 2 files changed, 20 insertions(+), 20 deletions(-) | ||
13 | 16 | ||
14 | diff --git a/target/arm/translate.c b/target/arm/translate.c | 17 | diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c |
15 | index XXXXXXX..XXXXXXX 100644 | 18 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/target/arm/translate.c | 19 | --- a/tests/qtest/bios-tables-test.c |
17 | +++ b/target/arm/translate.c | 20 | +++ b/tests/qtest/bios-tables-test.c |
18 | @@ -XXX,XX +XXX,XX @@ static long vfp_reg_offset(bool dp, unsigned reg) | 21 | @@ -XXX,XX +XXX,XX @@ static void test_acpi_virt_tcg(void) |
19 | } | 22 | free_test_data(&data); |
20 | } | 23 | } |
21 | 24 | ||
22 | -static inline void vfp_load_reg64(TCGv_i64 var, int reg) | 25 | +static void test_acpi_q35_viot(void) |
23 | -{ | ||
24 | - tcg_gen_ld_i64(var, cpu_env, vfp_reg_offset(true, reg)); | ||
25 | -} | ||
26 | - | ||
27 | -static inline void vfp_store_reg64(TCGv_i64 var, int reg) | ||
28 | -{ | ||
29 | - tcg_gen_st_i64(var, cpu_env, vfp_reg_offset(true, reg)); | ||
30 | -} | ||
31 | - | ||
32 | -static inline void vfp_load_reg32(TCGv_i32 var, int reg) | ||
33 | -{ | ||
34 | - tcg_gen_ld_i32(var, cpu_env, vfp_reg_offset(false, reg)); | ||
35 | -} | ||
36 | - | ||
37 | -static inline void vfp_store_reg32(TCGv_i32 var, int reg) | ||
38 | -{ | ||
39 | - tcg_gen_st_i32(var, cpu_env, vfp_reg_offset(false, reg)); | ||
40 | -} | ||
41 | - | ||
42 | void read_neon_element32(TCGv_i32 dest, int reg, int ele, MemOp memop) | ||
43 | { | ||
44 | long off = neon_element_offset(reg, ele, memop); | ||
45 | diff --git a/target/arm/translate-vfp.c.inc b/target/arm/translate-vfp.c.inc | ||
46 | index XXXXXXX..XXXXXXX 100644 | ||
47 | --- a/target/arm/translate-vfp.c.inc | ||
48 | +++ b/target/arm/translate-vfp.c.inc | ||
49 | @@ -XXX,XX +XXX,XX @@ | ||
50 | #include "decode-vfp.c.inc" | ||
51 | #include "decode-vfp-uncond.c.inc" | ||
52 | |||
53 | +static inline void vfp_load_reg64(TCGv_i64 var, int reg) | ||
54 | +{ | 26 | +{ |
55 | + tcg_gen_ld_i64(var, cpu_env, vfp_reg_offset(true, reg)); | 27 | + test_data data = { |
28 | + .machine = MACHINE_Q35, | ||
29 | + .variant = ".viot", | ||
30 | + }; | ||
31 | + | ||
32 | + /* | ||
33 | + * To keep things interesting, two buses bypass the IOMMU. | ||
34 | + * VIOT should only describes the other two buses. | ||
35 | + */ | ||
36 | + test_acpi_one("-machine default_bus_bypass_iommu=on " | ||
37 | + "-device virtio-iommu-pci " | ||
38 | + "-device pxb-pcie,bus_nr=0x10,id=pcie.100,bus=pcie.0 " | ||
39 | + "-device pxb-pcie,bus_nr=0x20,id=pcie.200,bus=pcie.0,bypass_iommu=on " | ||
40 | + "-device pxb-pcie,bus_nr=0x30,id=pcie.300,bus=pcie.0", | ||
41 | + &data); | ||
42 | + free_test_data(&data); | ||
56 | +} | 43 | +} |
57 | + | 44 | + |
58 | +static inline void vfp_store_reg64(TCGv_i64 var, int reg) | 45 | +static void test_acpi_virt_viot(void) |
59 | +{ | 46 | +{ |
60 | + tcg_gen_st_i64(var, cpu_env, vfp_reg_offset(true, reg)); | 47 | + test_data data = { |
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); | ||
61 | +} | 59 | +} |
62 | + | 60 | + |
63 | +static inline void vfp_load_reg32(TCGv_i32 var, int reg) | 61 | static void test_oem_fields(test_data *data) |
64 | +{ | 62 | { |
65 | + tcg_gen_ld_i32(var, cpu_env, vfp_reg_offset(false, reg)); | 63 | int i; |
66 | +} | 64 | @@ -XXX,XX +XXX,XX @@ int main(int argc, char *argv[]) |
67 | + | 65 | qtest_add_func("acpi/q35/kvm/xapic", test_acpi_q35_kvm_xapic); |
68 | +static inline void vfp_store_reg32(TCGv_i32 var, int reg) | 66 | qtest_add_func("acpi/q35/kvm/dmar", test_acpi_q35_kvm_dmar); |
69 | +{ | 67 | } |
70 | + tcg_gen_st_i32(var, cpu_env, vfp_reg_offset(false, reg)); | 68 | + qtest_add_func("acpi/q35/viot", test_acpi_q35_viot); |
71 | +} | 69 | } else if (strcmp(arch, "aarch64") == 0) { |
72 | + | 70 | if (has_tcg) { |
73 | /* | 71 | qtest_add_func("acpi/virt", test_acpi_virt_tcg); |
74 | * The imm8 encodes the sign bit, enough bits to represent an exponent in | 72 | @@ -XXX,XX +XXX,XX @@ int main(int argc, char *argv[]) |
75 | * the range 01....1xx to 10....0xx, and the most significant 4 bits of | 73 | qtest_add_func("acpi/virt/memhp", test_acpi_virt_tcg_memhp); |
74 | qtest_add_func("acpi/virt/pxb", test_acpi_virt_tcg_pxb); | ||
75 | qtest_add_func("acpi/virt/oem-fields", test_acpi_oem_fields_virt); | ||
76 | + qtest_add_func("acpi/virt/viot", test_acpi_virt_viot); | ||
77 | } | ||
78 | } | ||
79 | ret = g_test_run(); | ||
76 | -- | 80 | -- |
77 | 2.20.1 | 81 | 2.25.1 |
78 | 82 | ||
79 | 83 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | 1 | From: Jean-Philippe Brucker <jean-philippe@linaro.org> | |
2 | |||
3 | Add expected blobs of the VIOT and DSDT table for the VIOT test on the | ||
4 | q35 machine. | ||
5 | |||
6 | Since the test instantiates a virtio device and two PCIe expander | ||
7 | bridges, DSDT.viot has more blocks than the base DSDT. | ||
8 | |||
9 | The VIOT table generated for the q35 test is: | ||
10 | |||
11 | [000h 0000 4] Signature : "VIOT" [Virtual I/O Translation Table] | ||
12 | [004h 0004 4] Table Length : 00000070 | ||
13 | [008h 0008 1] Revision : 00 | ||
14 | [009h 0009 1] Checksum : 3D | ||
15 | [00Ah 0010 6] Oem ID : "BOCHS " | ||
16 | [010h 0016 8] Oem Table ID : "BXPC " | ||
17 | [018h 0024 4] Oem Revision : 00000001 | ||
18 | [01Ch 0028 4] Asl Compiler ID : "BXPC" | ||
19 | [020h 0032 4] Asl Compiler Revision : 00000001 | ||
20 | |||
21 | [024h 0036 2] Node count : 0003 | ||
22 | [026h 0038 2] Node offset : 0030 | ||
23 | [028h 0040 8] Reserved : 0000000000000000 | ||
24 | |||
25 | [030h 0048 1] Type : 03 [VirtIO-PCI IOMMU] | ||
26 | [031h 0049 1] Reserved : 00 | ||
27 | [032h 0050 2] Length : 0010 | ||
28 | |||
29 | [034h 0052 2] PCI Segment : 0000 | ||
30 | [036h 0054 2] PCI BDF number : 0010 | ||
31 | [038h 0056 8] Reserved : 0000000000000000 | ||
32 | |||
33 | [040h 0064 1] Type : 01 [PCI Range] | ||
34 | [041h 0065 1] Reserved : 00 | ||
35 | [042h 0066 2] Length : 0018 | ||
36 | |||
37 | [044h 0068 4] Endpoint start : 00003000 | ||
38 | [048h 0072 2] PCI Segment start : 0000 | ||
39 | [04Ah 0074 2] PCI Segment end : 0000 | ||
40 | [04Ch 0076 2] PCI BDF start : 3000 | ||
41 | [04Eh 0078 2] PCI BDF end : 30FF | ||
42 | [050h 0080 2] Output node : 0030 | ||
43 | [052h 0082 6] Reserved : 000000000000 | ||
44 | |||
45 | [058h 0088 1] Type : 01 [PCI Range] | ||
46 | [059h 0089 1] Reserved : 00 | ||
47 | [05Ah 0090 2] Length : 0018 | ||
48 | |||
49 | [05Ch 0092 4] Endpoint start : 00001000 | ||
50 | [060h 0096 2] PCI Segment start : 0000 | ||
51 | [062h 0098 2] PCI Segment end : 0000 | ||
52 | [064h 0100 2] PCI BDF start : 1000 | ||
53 | [066h 0102 2] PCI BDF end : 10FF | ||
54 | [068h 0104 2] Output node : 0030 | ||
55 | [06Ah 0106 6] Reserved : 000000000000 | ||
56 | |||
57 | And the DSDT diff is: | ||
58 | |||
59 | @@ -XXX,XX +XXX,XX @@ | ||
60 | * | ||
61 | * Disassembling to symbolic ASL+ operators | ||
62 | * | ||
63 | - * Disassembly of tests/data/acpi/q35/DSDT, Fri Dec 10 15:03:08 2021 | ||
64 | + * Disassembly of /tmp/aml-H9Y5D1, Fri Dec 10 15:02:27 2021 | ||
65 | * | ||
66 | * Original Table Header: | ||
67 | * Signature "DSDT" | ||
68 | - * Length 0x00002061 (8289) | ||
69 | + * Length 0x000024B6 (9398) | ||
70 | * Revision 0x01 **** 32-bit table (V1), no 64-bit math support | ||
71 | - * Checksum 0xFA | ||
72 | + * Checksum 0xA7 | ||
73 | * OEM ID "BOCHS " | ||
74 | * OEM Table ID "BXPC " | ||
75 | * OEM Revision 0x00000001 (1) | ||
76 | @@ -XXX,XX +XXX,XX @@ | ||
77 | } | ||
78 | } | ||
79 | |||
80 | + Scope (\_SB) | ||
81 | + { | ||
82 | + Device (PC30) | ||
83 | + { | ||
84 | + Name (_UID, 0x30) // _UID: Unique ID | ||
85 | + Name (_BBN, 0x30) // _BBN: BIOS Bus Number | ||
86 | + Name (_HID, EisaId ("PNP0A08") /* PCI Express Bus */) // _HID: Hardware ID | ||
87 | + Name (_CID, EisaId ("PNP0A03") /* PCI Bus */) // _CID: Compatible ID | ||
88 | + Method (_OSC, 4, NotSerialized) // _OSC: Operating System Capabilities | ||
89 | + { | ||
90 | + CreateDWordField (Arg3, Zero, CDW1) | ||
91 | + If ((Arg0 == ToUUID ("33db4d5b-1ff7-401c-9657-7441c03dd766") /* PCI Host Bridge Device */)) | ||
92 | + { | ||
93 | + CreateDWordField (Arg3, 0x04, CDW2) | ||
94 | + CreateDWordField (Arg3, 0x08, CDW3) | ||
95 | + Local0 = CDW3 /* \_SB_.PC30._OSC.CDW3 */ | ||
96 | + Local0 &= 0x1F | ||
97 | + If ((Arg1 != One)) | ||
98 | + { | ||
99 | + CDW1 |= 0x08 | ||
100 | + } | ||
101 | + | ||
102 | + If ((CDW3 != Local0)) | ||
103 | + { | ||
104 | + CDW1 |= 0x10 | ||
105 | + } | ||
106 | + | ||
107 | + CDW3 = Local0 | ||
108 | + } | ||
109 | + Else | ||
110 | + { | ||
111 | + CDW1 |= 0x04 | ||
112 | + } | ||
113 | + | ||
114 | + Return (Arg3) | ||
115 | + } | ||
116 | + | ||
117 | + Method (_PRT, 0, NotSerialized) // _PRT: PCI Routing Table | ||
118 | + { | ||
119 | + Local0 = Package (0x80){} | ||
120 | + Local1 = Zero | ||
121 | + While ((Local1 < 0x80)) | ||
122 | + { | ||
123 | + Local2 = (Local1 >> 0x02) | ||
124 | + Local3 = ((Local1 + Local2) & 0x03) | ||
125 | + If ((Local3 == Zero)) | ||
126 | + { | ||
127 | + Local4 = Package (0x04) | ||
128 | + { | ||
129 | + Zero, | ||
130 | + Zero, | ||
131 | + LNKD, | ||
132 | + Zero | ||
133 | + } | ||
134 | + } | ||
135 | + | ||
136 | + If ((Local3 == One)) | ||
137 | + { | ||
138 | + Local4 = Package (0x04) | ||
139 | + { | ||
140 | + Zero, | ||
141 | + Zero, | ||
142 | + LNKA, | ||
143 | + Zero | ||
144 | + } | ||
145 | + } | ||
146 | + | ||
147 | + If ((Local3 == 0x02)) | ||
148 | + { | ||
149 | + Local4 = Package (0x04) | ||
150 | + { | ||
151 | + Zero, | ||
152 | + Zero, | ||
153 | + LNKB, | ||
154 | + Zero | ||
155 | + } | ||
156 | + } | ||
157 | + | ||
158 | + If ((Local3 == 0x03)) | ||
159 | + { | ||
160 | + Local4 = Package (0x04) | ||
161 | + { | ||
162 | + Zero, | ||
163 | + Zero, | ||
164 | + LNKC, | ||
165 | + Zero | ||
166 | + } | ||
167 | + } | ||
168 | + | ||
169 | + Local4 [Zero] = ((Local2 << 0x10) | 0xFFFF) | ||
170 | + Local4 [One] = (Local1 & 0x03) | ||
171 | + Local0 [Local1] = Local4 | ||
172 | + Local1++ | ||
173 | + } | ||
174 | + | ||
175 | + Return (Local0) | ||
176 | + } | ||
177 | + | ||
178 | + Name (_CRS, ResourceTemplate () // _CRS: Current Resource Settings | ||
179 | + { | ||
180 | + WordBusNumber (ResourceProducer, MinFixed, MaxFixed, PosDecode, | ||
181 | + 0x0000, // Granularity | ||
182 | + 0x0030, // Range Minimum | ||
183 | + 0x0030, // Range Maximum | ||
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> | ||
460 | --- | ||
461 | tests/qtest/bios-tables-test-allowed-diff.h | 2 -- | ||
462 | tests/data/acpi/q35/DSDT.viot | Bin 0 -> 9398 bytes | ||
463 | tests/data/acpi/q35/VIOT.viot | Bin 0 -> 112 bytes | ||
464 | 3 files changed, 2 deletions(-) | ||
465 | |||
466 | 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 | ||
468 | --- a/tests/qtest/bios-tables-test-allowed-diff.h | ||
469 | +++ b/tests/qtest/bios-tables-test-allowed-diff.h | ||
470 | @@ -XXX,XX +XXX,XX @@ | ||
471 | /* List of comma-separated changed AML files to ignore */ | ||
472 | "tests/data/acpi/virt/VIOT", | ||
473 | -"tests/data/acpi/q35/DSDT.viot", | ||
474 | -"tests/data/acpi/q35/VIOT.viot", | ||
475 | diff --git a/tests/data/acpi/q35/DSDT.viot b/tests/data/acpi/q35/DSDT.viot | ||
476 | index XXXXXXX..XXXXXXX 100644 | ||
477 | GIT binary patch | ||
478 | literal 9398 | ||
479 | zcmeHNO>7&-8J*>iv|O&FB}G~Oi$yp||57BBoWHhc5OS9yDTx$CQgH$r;8Idr*-4Q_ | ||
480 | z5(9Az1F`}niVsB-)<KW7p`g9Br(A2Gm-gmc1N78GFS!;)e2V(MnH_0{q<{#yMgn&C | ||
481 | zn|*J-d9yqFhO_H6z19~`FlPL*u<DkZ*}|)JH;X@mF-FI<cPg<fti9tEN*yB^i5czN | ||
482 | zNq&q?!OZ;BE3B7{KWzJ-`Tn~f`9?Qj8~2^N8{Oc8J%57{==w%rS#;nOCp*nTr@iZ1 | ||
483 | zb+?i;JLQUJ=O0?8*>S~D)a>NF1~WVB6^~_B#yhJ`H+JU@=6aXs`?Yv)J2h=N?drcS | ||
484 | zeLZ*n<<Bm^n}6`jfBx#u8&(W}1?)}iF9o#mZ~E2+zwdn7yK3AbIzKnxpZ>JRPm3~# | ||
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 | ||
550 | GIT binary patch | ||
551 | literal 112 | ||
552 | zcmWIZ^baXu00LVle`k+i1*eDrX9XZ&1PX!JAex!M0Hgv8m>C3sGzdcgBZCA3T-xBj | ||
553 | Q0Zb)W9Hva*zW_`e0M!8s0RR91 | ||
554 | |||
555 | literal 0 | ||
556 | HcmV?d00001 | ||
557 | |||
558 | -- | ||
559 | 2.25.1 | ||
560 | |||
561 | diff view generated by jsdifflib |
1 | Switch translate-vfp.c.inc from being #included into translate.c | 1 | From: Jean-Philippe Brucker <jean-philippe@linaro.org> |
---|---|---|---|
2 | to being its own compilation unit. | ||
3 | 2 | ||
3 | The VIOT blob contains the following: | ||
4 | |||
5 | [000h 0000 4] Signature : "VIOT" [Virtual I/O Translation Table] | ||
6 | [004h 0004 4] Table Length : 00000058 | ||
7 | [008h 0008 1] Revision : 00 | ||
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 | ||
4 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 43 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
5 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
6 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Message-id: 20210430132740.10391-9-peter.maydell@linaro.org | ||
8 | --- | 44 | --- |
9 | target/arm/translate-a32.h | 2 ++ | 45 | tests/qtest/bios-tables-test-allowed-diff.h | 1 - |
10 | target/arm/{translate-vfp.c.inc => translate-vfp.c} | 12 +++++++----- | 46 | tests/data/acpi/virt/VIOT | Bin 0 -> 88 bytes |
11 | target/arm/translate.c | 3 +-- | 47 | 2 files changed, 1 deletion(-) |
12 | target/arm/meson.build | 5 +++-- | ||
13 | 4 files changed, 13 insertions(+), 9 deletions(-) | ||
14 | rename target/arm/{translate-vfp.c.inc => translate-vfp.c} (99%) | ||
15 | 48 | ||
16 | diff --git a/target/arm/translate-a32.h b/target/arm/translate-a32.h | 49 | diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h |
17 | index XXXXXXX..XXXXXXX 100644 | 50 | index XXXXXXX..XXXXXXX 100644 |
18 | --- a/target/arm/translate-a32.h | 51 | --- a/tests/qtest/bios-tables-test-allowed-diff.h |
19 | +++ b/target/arm/translate-a32.h | 52 | +++ b/tests/qtest/bios-tables-test-allowed-diff.h |
20 | @@ -XXX,XX +XXX,XX @@ | 53 | @@ -1,2 +1 @@ |
21 | 54 | /* List of comma-separated changed AML files to ignore */ | |
22 | /* Prototypes for autogenerated disassembler functions */ | 55 | -"tests/data/acpi/virt/VIOT", |
23 | bool disas_m_nocp(DisasContext *dc, uint32_t insn); | 56 | diff --git a/tests/data/acpi/virt/VIOT b/tests/data/acpi/virt/VIOT |
24 | +bool disas_vfp(DisasContext *s, uint32_t insn); | ||
25 | +bool disas_vfp_uncond(DisasContext *s, uint32_t insn); | ||
26 | |||
27 | void load_reg_var(DisasContext *s, TCGv_i32 var, int reg); | ||
28 | void arm_gen_condlabel(DisasContext *s); | ||
29 | diff --git a/target/arm/translate-vfp.c.inc b/target/arm/translate-vfp.c | ||
30 | similarity index 99% | ||
31 | rename from target/arm/translate-vfp.c.inc | ||
32 | rename to target/arm/translate-vfp.c | ||
33 | index XXXXXXX..XXXXXXX 100644 | 57 | index XXXXXXX..XXXXXXX 100644 |
34 | --- a/target/arm/translate-vfp.c.inc | 58 | GIT binary patch |
35 | +++ b/target/arm/translate-vfp.c | 59 | literal 88 |
36 | @@ -XXX,XX +XXX,XX @@ | 60 | zcmWIZ^bd((0D?3pe`k+i1*eDrX9XZ&1PX!JAexE60Hgv8m>C3sGzXN&z`)2L0cSHX |
37 | * License along with this library; if not, see <http://www.gnu.org/licenses/>. | 61 | I{D-Rq0Q5fy0RR91 |
38 | */ | 62 | |
39 | 63 | literal 0 | |
40 | -/* | 64 | HcmV?d00001 |
41 | - * This file is intended to be included from translate.c; it uses | 65 | |
42 | - * some macros and definitions provided by that file. | ||
43 | - * It might be possible to convert it to a standalone .c file eventually. | ||
44 | - */ | ||
45 | +#include "qemu/osdep.h" | ||
46 | +#include "tcg/tcg-op.h" | ||
47 | +#include "tcg/tcg-op-gvec.h" | ||
48 | +#include "exec/exec-all.h" | ||
49 | +#include "exec/gen-icount.h" | ||
50 | +#include "translate.h" | ||
51 | +#include "translate-a32.h" | ||
52 | |||
53 | /* Include the generated VFP decoder */ | ||
54 | #include "decode-vfp.c.inc" | ||
55 | diff --git a/target/arm/translate.c b/target/arm/translate.c | ||
56 | index XXXXXXX..XXXXXXX 100644 | ||
57 | --- a/target/arm/translate.c | ||
58 | +++ b/target/arm/translate.c | ||
59 | @@ -XXX,XX +XXX,XX @@ static TCGv_ptr vfp_reg_ptr(bool dp, int reg) | ||
60 | |||
61 | #define ARM_CP_RW_BIT (1 << 20) | ||
62 | |||
63 | -/* Include the VFP and Neon decoders */ | ||
64 | -#include "translate-vfp.c.inc" | ||
65 | +/* Include the Neon decoder */ | ||
66 | #include "translate-neon.c.inc" | ||
67 | |||
68 | static inline void iwmmxt_load_reg(TCGv_i64 var, int reg) | ||
69 | diff --git a/target/arm/meson.build b/target/arm/meson.build | ||
70 | index XXXXXXX..XXXXXXX 100644 | ||
71 | --- a/target/arm/meson.build | ||
72 | +++ b/target/arm/meson.build | ||
73 | @@ -XXX,XX +XXX,XX @@ gen = [ | ||
74 | decodetree.process('neon-shared.decode', extra_args: '--static-decode=disas_neon_shared'), | ||
75 | decodetree.process('neon-dp.decode', extra_args: '--static-decode=disas_neon_dp'), | ||
76 | decodetree.process('neon-ls.decode', extra_args: '--static-decode=disas_neon_ls'), | ||
77 | - decodetree.process('vfp.decode', extra_args: '--static-decode=disas_vfp'), | ||
78 | - decodetree.process('vfp-uncond.decode', extra_args: '--static-decode=disas_vfp_uncond'), | ||
79 | + decodetree.process('vfp.decode', extra_args: '--decode=disas_vfp'), | ||
80 | + decodetree.process('vfp-uncond.decode', extra_args: '--decode=disas_vfp_uncond'), | ||
81 | decodetree.process('m-nocp.decode', extra_args: '--decode=disas_m_nocp'), | ||
82 | decodetree.process('a32.decode', extra_args: '--static-decode=disas_a32'), | ||
83 | decodetree.process('a32-uncond.decode', extra_args: '--static-decode=disas_a32_uncond'), | ||
84 | @@ -XXX,XX +XXX,XX @@ arm_ss.add(files( | ||
85 | 'tlb_helper.c', | ||
86 | 'translate.c', | ||
87 | 'translate-m-nocp.c', | ||
88 | + 'translate-vfp.c', | ||
89 | 'vec_helper.c', | ||
90 | 'vfp_helper.c', | ||
91 | 'cpu_tcg.c', | ||
92 | -- | 66 | -- |
93 | 2.20.1 | 67 | 2.25.1 |
94 | 68 | ||
95 | 69 | diff view generated by jsdifflib |