1 | Arm changes for before softfreeze: mostly my PL061/GPIO patches, | 1 | Hi; here's the first target-arm pullreq for the 7.0 cycle. |
---|---|---|---|
2 | but also a new M-profile board and various other things. | ||
3 | 2 | ||
4 | thanks | 3 | thanks |
5 | -- PMM | 4 | -- PMM |
6 | 5 | ||
7 | The following changes since commit 05de778b5b8ab0b402996769117b88c7ea5c7c61: | 6 | The following changes since commit 76b56fdfc9fa43ec6e5986aee33f108c6c6a511e: |
8 | 7 | ||
9 | Merge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging (2021-07-09 14:30:01 +0100) | 8 | Merge tag 'block-pull-request' of https://gitlab.com/stefanha/qemu into staging (2021-12-14 12:46:18 -0800) |
10 | 9 | ||
11 | are available in the Git repository at: | 10 | are available in the Git repository at: |
12 | 11 | ||
13 | https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20210709 | 12 | https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20211215 |
14 | 13 | ||
15 | for you to fetch changes up to 05449abb1d4c5f0c69ceb3d8d03cbc75de39b646: | 14 | for you to fetch changes up to aed176558806674d030a8305d989d4e6a5073359: |
16 | 15 | ||
17 | hw/intc: Improve formatting of MEMTX_ERROR guest error message (2021-07-09 16:09:12 +0100) | 16 | tests/acpi: add expected blob for VIOT test on virt machine (2021-12-15 10:35:26 +0000) |
18 | 17 | ||
19 | ---------------------------------------------------------------- | 18 | ---------------------------------------------------------------- |
20 | target-arm queue: | 19 | target-arm queue: |
21 | * New machine type: stm32vldiscovery | 20 | * ITS: error reporting cleanup |
22 | * hw/intc/arm_gicv3_cpuif: Fix virtual irq number check in icv_[dir|eoir]_write | 21 | * aspeed: improve documentation |
23 | * hw/gpio/pl061: Honour Luminary PL061 PUR and PDR registers | 22 | * Fix STM32F2XX USART data register readout |
24 | * virt: Fix implementation of GPIO-based powerdown/shutdown mechanism | 23 | * allow emulated GICv3 to be disabled in non-TCG builds |
25 | * Correct the encoding of MDCCSR_EL0 and DBGDSCRint | 24 | * fix exception priority for singlestep, misaligned PC, bp, etc |
26 | * hw/intc: Improve formatting of MEMTX_ERROR guest error message | 25 | * Correct calculation of tlb range invalidate length |
26 | * npcm7xx_emc: fix missing queue_flush | ||
27 | * virt: Add VIOT ACPI table for virtio-iommu | ||
28 | * target/i386: Use assert() to sanity-check b1 in SSE decode | ||
29 | * Don't include qemu-common unnecessarily | ||
27 | 30 | ||
28 | ---------------------------------------------------------------- | 31 | ---------------------------------------------------------------- |
29 | Alexandre Iooss (4): | 32 | Alex Bennée (1): |
30 | stm32f100: Add the stm32f100 SoC | 33 | hw/intc: clean-up error reporting for failed ITS cmd |
31 | stm32vldiscovery: Add the STM32VLDISCOVERY Machine | ||
32 | docs/system: arm: Add stm32 boards description | ||
33 | tests/boot-serial-test: Add STM32VLDISCOVERY board testcase | ||
34 | 34 | ||
35 | Peter Maydell (10): | 35 | Jean-Philippe Brucker (8): |
36 | hw/gpio/pl061: Convert DPRINTF to tracepoints | 36 | hw/arm/virt-acpi-build: Add VIOT table for virtio-iommu |
37 | hw/gpio/pl061: Clean up read/write offset handling logic | 37 | hw/arm/virt: Remove device tree restriction for virtio-iommu |
38 | hw/gpio/pl061: Add tracepoints for register read and write | 38 | hw/arm/virt: Reject instantiation of multiple IOMMUs |
39 | hw/gpio/pl061: Document the interface of this device | 39 | hw/arm/virt: Use object_property_set instead of qdev_prop_set |
40 | hw/gpio/pl061: Honour Luminary PL061 PUR and PDR registers | 40 | tests/acpi: allow updates of VIOT expected data files |
41 | hw/gpio/pl061: Make pullup/pulldown of outputs configurable | 41 | tests/acpi: add test case for VIOT |
42 | hw/arm/virt: Make PL061 GPIO lines pulled low, not high | 42 | tests/acpi: add expected blobs for VIOT test on q35 machine |
43 | hw/gpio/pl061: Convert to 3-phase reset and assert GPIO lines correctly on reset | 43 | tests/acpi: add expected blob for VIOT test on virt machine |
44 | hw/gpio/pl061: Document a shortcoming in our implementation | ||
45 | hw/arm/stellaris: Expand comment about handling of OLED chipselect | ||
46 | 44 | ||
47 | Rebecca Cran (1): | 45 | Joel Stanley (4): |
48 | hw/intc: Improve formatting of MEMTX_ERROR guest error message | 46 | docs: aspeed: Add new boards |
47 | docs: aspeed: Update OpenBMC image URL | ||
48 | docs: aspeed: Give an example of booting a kernel | ||
49 | docs: aspeed: ADC is now modelled | ||
49 | 50 | ||
50 | Ricardo Koller (1): | 51 | Olivier Hériveaux (1): |
51 | hw/intc/arm_gicv3_cpuif: Fix virtual irq number check in icv_[dir|eoir]_write | 52 | Fix STM32F2XX USART data register readout |
52 | 53 | ||
53 | hnick@vmware.com (1): | 54 | Patrick Venture (1): |
54 | target/arm: Correct the encoding of MDCCSR_EL0 and DBGDSCRint | 55 | hw/net: npcm7xx_emc fix missing queue_flush |
55 | 56 | ||
56 | docs/system/arm/stm32.rst | 66 +++++++ | 57 | Peter Maydell (6): |
57 | docs/system/target-arm.rst | 1 + | 58 | target/i386: Use assert() to sanity-check b1 in SSE decode |
58 | default-configs/devices/arm-softmmu.mak | 1 + | 59 | include/hw/i386: Don't include qemu-common.h in .h files |
59 | include/hw/arm/stm32f100_soc.h | 57 ++++++ | 60 | target/hexagon/cpu.h: don't include qemu-common.h |
60 | hw/arm/stellaris.c | 56 +++++- | 61 | target/rx/cpu.h: Don't include qemu-common.h |
61 | hw/arm/stm32f100_soc.c | 182 +++++++++++++++++ | 62 | hw/arm: Don't include qemu-common.h unnecessarily |
62 | hw/arm/stm32vldiscovery.c | 66 +++++++ | 63 | target/arm: Correct calculation of tlb range invalidate length |
63 | hw/arm/virt.c | 3 + | ||
64 | hw/gpio/pl061.c | 341 +++++++++++++++++++++++++------- | ||
65 | hw/intc/arm_gicv3_cpuif.c | 4 +- | ||
66 | hw/intc/arm_gicv3_redist.c | 4 +- | ||
67 | target/arm/helper.c | 16 +- | ||
68 | tests/qtest/boot-serial-test.c | 37 ++++ | ||
69 | MAINTAINERS | 13 ++ | ||
70 | hw/arm/Kconfig | 10 + | ||
71 | hw/arm/meson.build | 2 + | ||
72 | hw/gpio/trace-events | 9 + | ||
73 | 17 files changed, 790 insertions(+), 78 deletions(-) | ||
74 | create mode 100644 docs/system/arm/stm32.rst | ||
75 | create mode 100644 include/hw/arm/stm32f100_soc.h | ||
76 | create mode 100644 hw/arm/stm32f100_soc.c | ||
77 | create mode 100644 hw/arm/stm32vldiscovery.c | ||
78 | 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 |
New patch | |||
---|---|---|---|
1 | From: Alex Bennée <alex.bennee@linaro.org> | ||
1 | 2 | ||
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 | ||
19 | |||
20 | Signed-off-by: Alex Bennée <alex.bennee@linaro.org> | ||
21 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
22 | Message-id: 20211112170454.3158925-1-alex.bennee@linaro.org | ||
23 | Cc: Shashi Mallela <shashi.mallela@linaro.org> | ||
24 | Cc: Peter Maydell <peter.maydell@linaro.org> | ||
25 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
26 | --- | ||
27 | hw/intc/arm_gicv3_its.c | 39 +++++++++++++++++++++++++++------------ | ||
28 | 1 file changed, 27 insertions(+), 12 deletions(-) | ||
29 | |||
30 | diff --git a/hw/intc/arm_gicv3_its.c b/hw/intc/arm_gicv3_its.c | ||
31 | index XXXXXXX..XXXXXXX 100644 | ||
32 | --- a/hw/intc/arm_gicv3_its.c | ||
33 | +++ b/hw/intc/arm_gicv3_its.c | ||
34 | @@ -XXX,XX +XXX,XX @@ static bool process_its_cmd(GICv3ITSState *s, uint64_t value, uint32_t offset, | ||
35 | if (res != MEMTX_OK) { | ||
36 | return result; | ||
37 | } | ||
38 | + } else { | ||
39 | + qemu_log_mask(LOG_GUEST_ERROR, | ||
40 | + "%s: invalid command attributes: " | ||
41 | + "invalid dte: %"PRIx64" for %d (MEM_TX: %d)\n", | ||
42 | + __func__, dte, devid, res); | ||
43 | + return result; | ||
44 | } | ||
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 | ||
83 | -- | ||
84 | 2.25.1 | ||
85 | |||
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 |
1 | From: Alexandre Iooss <erdnaxe@crans.org> | 1 | From: Joel Stanley <joel@jms.id.au> |
---|---|---|---|
2 | 2 | ||
3 | This adds the target guide for Netduino 2, Netduino Plus 2 and STM32VLDISCOVERY. | 3 | A common use case for the ASPEED machine is to boot a Linux kernel. |
4 | Provide a full example command line. | ||
4 | 5 | ||
5 | Signed-off-by: Alexandre Iooss <erdnaxe@crans.org> | 6 | Reviewed-by: Cédric Le Goater <clg@kaod.org> |
6 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | 7 | Signed-off-by: Joel Stanley <joel@jms.id.au> |
7 | Message-id: 20210617165647.2575955-4-erdnaxe@crans.org | 8 | Message-id: 20211117065752.330632-4-joel@jms.id.au |
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
9 | --- | 10 | --- |
10 | docs/system/arm/stm32.rst | 66 ++++++++++++++++++++++++++++++++++++++ | 11 | docs/system/arm/aspeed.rst | 15 ++++++++++++--- |
11 | docs/system/target-arm.rst | 1 + | 12 | 1 file changed, 12 insertions(+), 3 deletions(-) |
12 | MAINTAINERS | 1 + | ||
13 | 3 files changed, 68 insertions(+) | ||
14 | create mode 100644 docs/system/arm/stm32.rst | ||
15 | 13 | ||
16 | diff --git a/docs/system/arm/stm32.rst b/docs/system/arm/stm32.rst | 14 | diff --git a/docs/system/arm/aspeed.rst b/docs/system/arm/aspeed.rst |
17 | new file mode 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
18 | index XXXXXXX..XXXXXXX | 16 | --- a/docs/system/arm/aspeed.rst |
19 | --- /dev/null | 17 | +++ b/docs/system/arm/aspeed.rst |
20 | +++ b/docs/system/arm/stm32.rst | 18 | @@ -XXX,XX +XXX,XX @@ Missing devices |
21 | @@ -XXX,XX +XXX,XX @@ | 19 | Boot options |
22 | +STMicroelectronics STM32 boards (``netduino2``, ``netduinoplus2``, ``stm32vldiscovery``) | 20 | ------------ |
23 | +======================================================================================== | 21 | |
24 | + | 22 | -The Aspeed machines can be started using the ``-kernel`` option to |
25 | +The `STM32`_ chips are a family of 32-bit ARM-based microcontroller by | 23 | -load a Linux kernel or from a firmware. Images can be downloaded from |
26 | +STMicroelectronics. | 24 | -the OpenBMC jenkins : |
27 | + | 25 | +The Aspeed machines can be started using the ``-kernel`` and ``-dtb`` options |
28 | +.. _STM32: https://www.st.com/en/microcontrollers-microprocessors/stm32-32-bit-arm-cortex-mcus.html | 26 | +to load a Linux kernel or from a firmware. Images can be downloaded from the |
29 | + | 27 | +OpenBMC jenkins : |
30 | +The STM32F1 series is based on ARM Cortex-M3 core. The following machines are | 28 | |
31 | +based on this chip : | 29 | https://jenkins.openbmc.org/job/ci-openbmc/lastSuccessfulBuild/ |
32 | + | 30 | |
33 | +- ``stm32vldiscovery`` STM32VLDISCOVERY board with STM32F100RBT6 microcontroller | 31 | @@ -XXX,XX +XXX,XX @@ or directly from the OpenBMC GitHub release repository : |
34 | + | 32 | |
35 | +The STM32F2 series is based on ARM Cortex-M3 core. The following machines are | 33 | https://github.com/openbmc/openbmc/releases |
36 | +based on this chip : | 34 | |
37 | + | 35 | +To boot a kernel directly from a Linux build tree: |
38 | +- ``netduino2`` Netduino 2 board with STM32F205RFT6 microcontroller | ||
39 | + | ||
40 | +The STM32F4 series is based on ARM Cortex-M4F core. This series is pin-to-pin | ||
41 | +compatible with STM32F2 series. The following machines are based on this chip : | ||
42 | + | ||
43 | +- ``netduinoplus2`` Netduino Plus 2 board with STM32F405RGT6 microcontroller | ||
44 | + | ||
45 | +There are many other STM32 series that are currently not supported by QEMU. | ||
46 | + | ||
47 | +Supported devices | ||
48 | +----------------- | ||
49 | + | ||
50 | + * ARM Cortex-M3, Cortex M4F | ||
51 | + * Analog to Digital Converter (ADC) | ||
52 | + * EXTI interrupt | ||
53 | + * Serial ports (USART) | ||
54 | + * SPI controller | ||
55 | + * System configuration (SYSCFG) | ||
56 | + * Timer controller (TIMER) | ||
57 | + | ||
58 | +Missing devices | ||
59 | +--------------- | ||
60 | + | ||
61 | + * Camera interface (DCMI) | ||
62 | + * Controller Area Network (CAN) | ||
63 | + * Cycle Redundancy Check (CRC) calculation unit | ||
64 | + * Digital to Analog Converter (DAC) | ||
65 | + * DMA controller | ||
66 | + * Ethernet controller | ||
67 | + * Flash Interface Unit | ||
68 | + * GPIO controller | ||
69 | + * I2C controller | ||
70 | + * Inter-Integrated Sound (I2S) controller | ||
71 | + * Power supply configuration (PWR) | ||
72 | + * Random Number Generator (RNG) | ||
73 | + * Real-Time Clock (RTC) controller | ||
74 | + * Reset and Clock Controller (RCC) | ||
75 | + * Secure Digital Input/Output (SDIO) interface | ||
76 | + * USB OTG | ||
77 | + * Watchdog controller (IWDG, WWDG) | ||
78 | + | ||
79 | +Boot options | ||
80 | +------------ | ||
81 | + | ||
82 | +The STM32 machines can be started using the ``-kernel`` option to load a | ||
83 | +firmware. Example: | ||
84 | + | 36 | + |
85 | +.. code-block:: bash | 37 | +.. code-block:: bash |
86 | + | 38 | + |
87 | + $ qemu-system-arm -M stm32vldiscovery -kernel firmware.bin | 39 | + $ qemu-system-arm -M ast2600-evb -nographic \ |
88 | diff --git a/docs/system/target-arm.rst b/docs/system/target-arm.rst | 40 | + -kernel arch/arm/boot/zImage \ |
89 | index XXXXXXX..XXXXXXX 100644 | 41 | + -dtb arch/arm/boot/dts/aspeed-ast2600-evb.dtb \ |
90 | --- a/docs/system/target-arm.rst | 42 | + -initrd rootfs.cpio |
91 | +++ b/docs/system/target-arm.rst | 43 | + |
92 | @@ -XXX,XX +XXX,XX @@ undocumented; you can get a complete list by running | 44 | The image should be attached as an MTD drive. Run : |
93 | arm/collie | 45 | |
94 | arm/sx1 | 46 | .. code-block:: bash |
95 | arm/stellaris | ||
96 | + arm/stm32 | ||
97 | arm/virt | ||
98 | arm/xlnx-versal-virt | ||
99 | |||
100 | diff --git a/MAINTAINERS b/MAINTAINERS | ||
101 | index XXXXXXX..XXXXXXX 100644 | ||
102 | --- a/MAINTAINERS | ||
103 | +++ b/MAINTAINERS | ||
104 | @@ -XXX,XX +XXX,XX @@ M: Alexandre Iooss <erdnaxe@crans.org> | ||
105 | L: qemu-arm@nongnu.org | ||
106 | S: Maintained | ||
107 | F: hw/arm/stm32vldiscovery.c | ||
108 | +F: docs/system/arm/stm32.rst | ||
109 | |||
110 | Versatile Express | ||
111 | M: Peter Maydell <peter.maydell@linaro.org> | ||
112 | -- | 47 | -- |
113 | 2.20.1 | 48 | 2.25.1 |
114 | 49 | ||
115 | 50 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Joel Stanley <joel@jms.id.au> | ||
1 | 2 | ||
3 | Move it to the supported list. | ||
4 | |||
5 | Signed-off-by: Joel Stanley <joel@jms.id.au> | ||
6 | Message-id: 20211117065752.330632-5-joel@jms.id.au | ||
7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
8 | --- | ||
9 | docs/system/arm/aspeed.rst | 2 +- | ||
10 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
11 | |||
12 | diff --git a/docs/system/arm/aspeed.rst b/docs/system/arm/aspeed.rst | ||
13 | index XXXXXXX..XXXXXXX 100644 | ||
14 | --- a/docs/system/arm/aspeed.rst | ||
15 | +++ b/docs/system/arm/aspeed.rst | ||
16 | @@ -XXX,XX +XXX,XX @@ Supported devices | ||
17 | * Front LEDs (PCA9552 on I2C bus) | ||
18 | * LPC Peripheral Controller (a subset of subdevices are supported) | ||
19 | * Hash/Crypto Engine (HACE) - Hash support only. TODO: HMAC and RSA | ||
20 | + * ADC | ||
21 | |||
22 | |||
23 | Missing devices | ||
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 | ||
31 | -- | ||
32 | 2.25.1 | ||
33 | |||
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 | From: Alexandre Iooss <erdnaxe@crans.org> | 1 | From: Philippe Mathieu-Daudé <philmd@redhat.com> |
---|---|---|---|
2 | 2 | ||
3 | This is a Cortex-M3 based machine. Information can be found at: | 3 | gicv3_set_gicv3state() is used by arm_gicv3_common.c in |
4 | https://www.st.com/en/evaluation-tools/stm32vldiscovery.html | 4 | arm_gicv3_common_realize(). Since we want to restrict |
5 | arm_gicv3_cpuif.c to TCG, extract gicv3_set_gicv3state() | ||
6 | to a new file. Add this file to the meson 'specific' | ||
7 | source set, since it needs access to "cpu.h". | ||
5 | 8 | ||
6 | Signed-off-by: Alexandre Iooss <erdnaxe@crans.org> | 9 | Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> |
7 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | 10 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
8 | Message-id: 20210617165647.2575955-3-erdnaxe@crans.org | 11 | Message-id: 20211115223619.2599282-2-philmd@redhat.com |
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
10 | --- | 13 | --- |
11 | default-configs/devices/arm-softmmu.mak | 1 + | 14 | hw/intc/arm_gicv3_cpuif.c | 10 +--------- |
12 | hw/arm/stm32vldiscovery.c | 66 +++++++++++++++++++++++++ | 15 | hw/intc/arm_gicv3_cpuif_common.c | 22 ++++++++++++++++++++++ |
13 | MAINTAINERS | 6 +++ | 16 | hw/intc/meson.build | 1 + |
14 | hw/arm/Kconfig | 4 ++ | 17 | 3 files changed, 24 insertions(+), 9 deletions(-) |
15 | hw/arm/meson.build | 1 + | 18 | create mode 100644 hw/intc/arm_gicv3_cpuif_common.c |
16 | 5 files changed, 78 insertions(+) | ||
17 | create mode 100644 hw/arm/stm32vldiscovery.c | ||
18 | 19 | ||
19 | diff --git a/default-configs/devices/arm-softmmu.mak b/default-configs/devices/arm-softmmu.mak | 20 | diff --git a/hw/intc/arm_gicv3_cpuif.c b/hw/intc/arm_gicv3_cpuif.c |
20 | index XXXXXXX..XXXXXXX 100644 | 21 | index XXXXXXX..XXXXXXX 100644 |
21 | --- a/default-configs/devices/arm-softmmu.mak | 22 | --- a/hw/intc/arm_gicv3_cpuif.c |
22 | +++ b/default-configs/devices/arm-softmmu.mak | 23 | +++ b/hw/intc/arm_gicv3_cpuif.c |
23 | @@ -XXX,XX +XXX,XX @@ CONFIG_CHEETAH=y | 24 | @@ -XXX,XX +XXX,XX @@ |
24 | CONFIG_SX1=y | 25 | /* |
25 | CONFIG_NSERIES=y | 26 | - * ARM Generic Interrupt Controller v3 |
26 | CONFIG_STELLARIS=y | 27 | + * ARM Generic Interrupt Controller v3 (emulation) |
27 | +CONFIG_STM32VLDISCOVERY=y | 28 | * |
28 | CONFIG_REALVIEW=y | 29 | * Copyright (c) 2016 Linaro Limited |
29 | CONFIG_VERSATILE=y | 30 | * Written by Peter Maydell |
30 | CONFIG_VEXPRESS=y | 31 | @@ -XXX,XX +XXX,XX @@ |
31 | diff --git a/hw/arm/stm32vldiscovery.c b/hw/arm/stm32vldiscovery.c | 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 | ||
32 | new file mode 100644 | 47 | new file mode 100644 |
33 | index XXXXXXX..XXXXXXX | 48 | index XXXXXXX..XXXXXXX |
34 | --- /dev/null | 49 | --- /dev/null |
35 | +++ b/hw/arm/stm32vldiscovery.c | 50 | +++ b/hw/intc/arm_gicv3_cpuif_common.c |
36 | @@ -XXX,XX +XXX,XX @@ | 51 | @@ -XXX,XX +XXX,XX @@ |
52 | +/* SPDX-License-Identifier: GPL-2.0-or-later */ | ||
37 | +/* | 53 | +/* |
38 | + * ST STM32VLDISCOVERY machine | 54 | + * ARM Generic Interrupt Controller v3 |
39 | + * | 55 | + * |
40 | + * Copyright (c) 2021 Alexandre Iooss <erdnaxe@crans.org> | 56 | + * Copyright (c) 2016 Linaro Limited |
41 | + * Copyright (c) 2014 Alistair Francis <alistair@alistair23.me> | 57 | + * Written by Peter Maydell |
42 | + * | 58 | + * |
43 | + * Permission is hereby granted, free of charge, to any person obtaining a copy | 59 | + * This code is licensed under the GPL, version 2 or (at your option) |
44 | + * of this software and associated documentation files (the "Software"), to deal | 60 | + * any later version. |
45 | + * in the Software without restriction, including without limitation the rights | ||
46 | + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
47 | + * copies of the Software, and to permit persons to whom the Software is | ||
48 | + * furnished to do so, subject to the following conditions: | ||
49 | + * | ||
50 | + * The above copyright notice and this permission notice shall be included in | ||
51 | + * all copies or substantial portions of the Software. | ||
52 | + * | ||
53 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
54 | + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
55 | + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
56 | + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
57 | + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
58 | + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
59 | + * THE SOFTWARE. | ||
60 | + */ | 61 | + */ |
61 | + | 62 | + |
62 | +#include "qemu/osdep.h" | 63 | +#include "qemu/osdep.h" |
63 | +#include "qapi/error.h" | 64 | +#include "gicv3_internal.h" |
64 | +#include "hw/boards.h" | 65 | +#include "cpu.h" |
65 | +#include "hw/qdev-properties.h" | ||
66 | +#include "qemu/error-report.h" | ||
67 | +#include "hw/arm/stm32f100_soc.h" | ||
68 | +#include "hw/arm/boot.h" | ||
69 | + | 66 | + |
70 | +/* stm32vldiscovery implementation is derived from netduinoplus2 */ | 67 | +void gicv3_set_gicv3state(CPUState *cpu, GICv3CPUState *s) |
68 | +{ | ||
69 | + ARMCPU *arm_cpu = ARM_CPU(cpu); | ||
70 | + CPUARMState *env = &arm_cpu->env; | ||
71 | + | 71 | + |
72 | +/* Main SYSCLK frequency in Hz (24MHz) */ | 72 | + env->gicv3state = (void *)s; |
73 | +#define SYSCLK_FRQ 24000000ULL | 73 | +}; |
74 | + | 74 | diff --git a/hw/intc/meson.build b/hw/intc/meson.build |
75 | +static void stm32vldiscovery_init(MachineState *machine) | ||
76 | +{ | ||
77 | + DeviceState *dev; | ||
78 | + | ||
79 | + /* | ||
80 | + * TODO: ideally we would model the SoC RCC and let it handle | ||
81 | + * system_clock_scale, including its ability to define different | ||
82 | + * possible SYSCLK sources. | ||
83 | + */ | ||
84 | + system_clock_scale = NANOSECONDS_PER_SECOND / SYSCLK_FRQ; | ||
85 | + | ||
86 | + dev = qdev_new(TYPE_STM32F100_SOC); | ||
87 | + qdev_prop_set_string(dev, "cpu-type", ARM_CPU_TYPE_NAME("cortex-m3")); | ||
88 | + sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); | ||
89 | + | ||
90 | + armv7m_load_kernel(ARM_CPU(first_cpu), | ||
91 | + machine->kernel_filename, | ||
92 | + FLASH_SIZE); | ||
93 | +} | ||
94 | + | ||
95 | +static void stm32vldiscovery_machine_init(MachineClass *mc) | ||
96 | +{ | ||
97 | + mc->desc = "ST STM32VLDISCOVERY (Cortex-M3)"; | ||
98 | + mc->init = stm32vldiscovery_init; | ||
99 | +} | ||
100 | + | ||
101 | +DEFINE_MACHINE("stm32vldiscovery", stm32vldiscovery_machine_init) | ||
102 | + | ||
103 | diff --git a/MAINTAINERS b/MAINTAINERS | ||
104 | index XXXXXXX..XXXXXXX 100644 | 75 | index XXXXXXX..XXXXXXX 100644 |
105 | --- a/MAINTAINERS | 76 | --- a/hw/intc/meson.build |
106 | +++ b/MAINTAINERS | 77 | +++ b/hw/intc/meson.build |
107 | @@ -XXX,XX +XXX,XX @@ F: hw/*/stellaris* | 78 | @@ -XXX,XX +XXX,XX @@ softmmu_ss.add(when: 'CONFIG_XLNX_ZYNQMP_PMU', if_true: files('xlnx-pmu-iomod-in |
108 | F: include/hw/input/gamepad.h | 79 | |
109 | F: docs/system/arm/stellaris.rst | 80 | specific_ss.add(when: 'CONFIG_ALLWINNER_A10_PIC', if_true: files('allwinner-a10-pic.c')) |
110 | 81 | specific_ss.add(when: 'CONFIG_APIC', if_true: files('apic.c', 'apic_common.c')) | |
111 | +STM32VLDISCOVERY | 82 | +specific_ss.add(when: 'CONFIG_ARM_GIC', if_true: files('arm_gicv3_cpuif_common.c')) |
112 | +M: Alexandre Iooss <erdnaxe@crans.org> | 83 | specific_ss.add(when: 'CONFIG_ARM_GIC', if_true: files('arm_gicv3_cpuif.c')) |
113 | +L: qemu-arm@nongnu.org | 84 | specific_ss.add(when: 'CONFIG_ARM_GIC_KVM', if_true: files('arm_gic_kvm.c')) |
114 | +S: Maintained | 85 | specific_ss.add(when: ['CONFIG_ARM_GIC_KVM', 'TARGET_AARCH64'], if_true: files('arm_gicv3_kvm.c', 'arm_gicv3_its_kvm.c')) |
115 | +F: hw/arm/stm32vldiscovery.c | ||
116 | + | ||
117 | Versatile Express | ||
118 | M: Peter Maydell <peter.maydell@linaro.org> | ||
119 | L: qemu-arm@nongnu.org | ||
120 | diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig | ||
121 | index XXXXXXX..XXXXXXX 100644 | ||
122 | --- a/hw/arm/Kconfig | ||
123 | +++ b/hw/arm/Kconfig | ||
124 | @@ -XXX,XX +XXX,XX @@ config STELLARIS | ||
125 | select STELLARIS_ENET # ethernet | ||
126 | select UNIMP | ||
127 | |||
128 | +config STM32VLDISCOVERY | ||
129 | + bool | ||
130 | + select STM32F100_SOC | ||
131 | + | ||
132 | config STRONGARM | ||
133 | bool | ||
134 | select PXA2XX | ||
135 | diff --git a/hw/arm/meson.build b/hw/arm/meson.build | ||
136 | index XXXXXXX..XXXXXXX 100644 | ||
137 | --- a/hw/arm/meson.build | ||
138 | +++ b/hw/arm/meson.build | ||
139 | @@ -XXX,XX +XXX,XX @@ arm_ss.add(when: 'CONFIG_Z2', if_true: files('z2.c')) | ||
140 | arm_ss.add(when: 'CONFIG_REALVIEW', if_true: files('realview.c')) | ||
141 | arm_ss.add(when: 'CONFIG_SBSA_REF', if_true: files('sbsa-ref.c')) | ||
142 | arm_ss.add(when: 'CONFIG_STELLARIS', if_true: files('stellaris.c')) | ||
143 | +arm_ss.add(when: 'CONFIG_STM32VLDISCOVERY', if_true: files('stm32vldiscovery.c')) | ||
144 | arm_ss.add(when: 'CONFIG_COLLIE', if_true: files('collie.c')) | ||
145 | arm_ss.add(when: 'CONFIG_VERSATILE', if_true: files('versatilepb.c')) | ||
146 | arm_ss.add(when: 'CONFIG_VEXPRESS', if_true: files('vexpress.c')) | ||
147 | -- | 86 | -- |
148 | 2.20.1 | 87 | 2.25.1 |
149 | 88 | ||
150 | 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 |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
4 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
5 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
6 | --- | ||
7 | target/arm/translate-a64.c | 7 ++++--- | ||
8 | 1 file changed, 4 insertions(+), 3 deletions(-) | ||
9 | |||
10 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c | ||
11 | index XXXXXXX..XXXXXXX 100644 | ||
12 | --- a/target/arm/translate-a64.c | ||
13 | +++ b/target/arm/translate-a64.c | ||
14 | @@ -XXX,XX +XXX,XX @@ static void aarch64_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) | ||
15 | { | ||
16 | DisasContext *s = container_of(dcbase, DisasContext, base); | ||
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; | ||
24 | } | ||
25 | |||
26 | - s->pc_curr = s->base.pc_next; | ||
27 | - insn = arm_ldl_code(env, &s->base, s->base.pc_next, s->sctlr_b); | ||
28 | + s->pc_curr = pc; | ||
29 | + insn = arm_ldl_code(env, &s->base, pc, s->sctlr_b); | ||
30 | s->insn = insn; | ||
31 | - s->base.pc_next += 4; | ||
32 | + s->base.pc_next = pc + 4; | ||
33 | |||
34 | s->fp_access_checked = false; | ||
35 | s->sve_access_checked = false; | ||
36 | -- | ||
37 | 2.25.1 | ||
38 | |||
39 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
4 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
5 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
6 | --- | ||
7 | target/arm/translate.c | 9 +++++---- | ||
8 | 1 file changed, 5 insertions(+), 4 deletions(-) | ||
9 | |||
10 | diff --git a/target/arm/translate.c b/target/arm/translate.c | ||
11 | index XXXXXXX..XXXXXXX 100644 | ||
12 | --- a/target/arm/translate.c | ||
13 | +++ b/target/arm/translate.c | ||
14 | @@ -XXX,XX +XXX,XX @@ static void arm_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 | unsigned int insn; | ||
20 | |||
21 | if (arm_pre_translate_insn(dc)) { | ||
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); | ||
37 | -- | ||
38 | 2.25.1 | ||
39 | |||
40 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
4 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
5 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
6 | --- | ||
7 | target/arm/translate.c | 16 ++++++++-------- | ||
8 | 1 file changed, 8 insertions(+), 8 deletions(-) | ||
9 | |||
10 | diff --git a/target/arm/translate.c b/target/arm/translate.c | ||
11 | index XXXXXXX..XXXXXXX 100644 | ||
12 | --- a/target/arm/translate.c | ||
13 | +++ b/target/arm/translate.c | ||
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; | ||
26 | } | ||
27 | |||
28 | - dc->pc_curr = dc->base.pc_next; | ||
29 | - insn = arm_lduw_code(env, &dc->base, dc->base.pc_next, dc->sctlr_b); | ||
30 | + dc->pc_curr = pc; | ||
31 | + insn = arm_lduw_code(env, &dc->base, pc, dc->sctlr_b); | ||
32 | is_16bit = thumb_insn_is_16bit(dc, dc->base.pc_next, insn); | ||
33 | - dc->base.pc_next += 2; | ||
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); | ||
38 | - | ||
39 | + uint32_t insn2 = arm_lduw_code(env, &dc->base, pc, dc->sctlr_b); | ||
40 | insn = insn << 16 | insn2; | ||
41 | - dc->base.pc_next += 2; | ||
42 | + pc += 2; | ||
43 | } | ||
44 | + dc->base.pc_next = pc; | ||
45 | dc->insn = insn; | ||
46 | |||
47 | if (dc->pstate_il) { | ||
48 | -- | ||
49 | 2.25.1 | ||
50 | |||
51 | diff view generated by jsdifflib |
1 | From: Ricardo Koller <ricarkol@google.com> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | icv_eoir_write() and icv_dir_write() ignore invalid virtual IRQ numbers | 3 | Create arm_check_ss_active and arm_check_kernelpage. |
4 | (like LPIs). The issue is that these functions check against the number | ||
5 | of implemented IRQs (QEMU's default is num_irq=288) which can be lower | ||
6 | than the maximum virtual IRQ number (1020 - 1). The consequence is that | ||
7 | if a hypervisor creates an LR for an IRQ between 288 and 1020, then the | ||
8 | guest is unable to deactivate the resulting IRQ. Note that other | ||
9 | functions that deal with large IRQ numbers, like icv_iar_read, check | ||
10 | against 1020 and not against num_irq. | ||
11 | 4 | ||
12 | Fix the checks by using GICV3_MAXIRQ (1020) instead of the number of | 5 | Reverse the order of the tests. While it doesn't matter in practice, |
13 | implemented IRQs. | 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. | ||
14 | 9 | ||
15 | Signed-off-by: Ricardo Koller <ricarkol@google.com> | 10 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
16 | Message-id: 20210702233701.3369-1-ricarkol@google.com | ||
17 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 11 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
18 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
19 | --- | 13 | --- |
20 | hw/intc/arm_gicv3_cpuif.c | 4 ++-- | 14 | target/arm/translate.c | 10 +++++++--- |
21 | 1 file changed, 2 insertions(+), 2 deletions(-) | 15 | 1 file changed, 7 insertions(+), 3 deletions(-) |
22 | 16 | ||
23 | diff --git a/hw/intc/arm_gicv3_cpuif.c b/hw/intc/arm_gicv3_cpuif.c | 17 | diff --git a/target/arm/translate.c b/target/arm/translate.c |
24 | index XXXXXXX..XXXXXXX 100644 | 18 | index XXXXXXX..XXXXXXX 100644 |
25 | --- a/hw/intc/arm_gicv3_cpuif.c | 19 | --- a/target/arm/translate.c |
26 | +++ b/hw/intc/arm_gicv3_cpuif.c | 20 | +++ b/target/arm/translate.c |
27 | @@ -XXX,XX +XXX,XX @@ static void icv_dir_write(CPUARMState *env, const ARMCPRegInfo *ri, | 21 | @@ -XXX,XX +XXX,XX @@ static void arm_tr_insn_start(DisasContextBase *dcbase, CPUState *cpu) |
28 | 22 | dc->insn_start = tcg_last_op(); | |
29 | trace_gicv3_icv_dir_write(gicv3_redist_affid(cs), value); | 23 | } |
30 | 24 | ||
31 | - if (irq >= cs->gic->num_irq) { | 25 | -static bool arm_pre_translate_insn(DisasContext *dc) |
32 | + if (irq >= GICV3_MAXIRQ) { | 26 | +static bool arm_check_kernelpage(DisasContext *dc) |
33 | /* Also catches special interrupt numbers and LPIs */ | 27 | { |
28 | #ifdef CONFIG_USER_ONLY | ||
29 | /* Intercept jump to the magic kernel page. */ | ||
30 | @@ -XXX,XX +XXX,XX @@ static bool arm_pre_translate_insn(DisasContext *dc) | ||
31 | return true; | ||
32 | } | ||
33 | #endif | ||
34 | + return false; | ||
35 | +} | ||
36 | |||
37 | +static bool arm_check_ss_active(DisasContext *dc) | ||
38 | +{ | ||
39 | if (dc->ss_active && !dc->pstate_ss) { | ||
40 | /* Singlestep state is Active-pending. | ||
41 | * If we're in this state at the start of a TB then either | ||
42 | @@ -XXX,XX +XXX,XX @@ static void arm_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) | ||
43 | uint32_t pc = dc->base.pc_next; | ||
44 | unsigned int insn; | ||
45 | |||
46 | - if (arm_pre_translate_insn(dc)) { | ||
47 | + if (arm_check_ss_active(dc) || arm_check_kernelpage(dc)) { | ||
48 | dc->base.pc_next = pc + 4; | ||
34 | return; | 49 | return; |
35 | } | 50 | } |
36 | @@ -XXX,XX +XXX,XX @@ static void icv_eoir_write(CPUARMState *env, const ARMCPRegInfo *ri, | 51 | @@ -XXX,XX +XXX,XX @@ static void thumb_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) |
37 | trace_gicv3_icv_eoir_write(ri->crm == 8 ? 0 : 1, | 52 | uint32_t insn; |
38 | gicv3_redist_affid(cs), value); | 53 | bool is_16bit; |
39 | 54 | ||
40 | - if (irq >= cs->gic->num_irq) { | 55 | - if (arm_pre_translate_insn(dc)) { |
41 | + if (irq >= GICV3_MAXIRQ) { | 56 | + if (arm_check_ss_active(dc) || arm_check_kernelpage(dc)) { |
42 | /* Also catches special interrupt numbers and LPIs */ | 57 | dc->base.pc_next = pc + 2; |
43 | return; | 58 | return; |
44 | } | 59 | } |
45 | -- | 60 | -- |
46 | 2.20.1 | 61 | 2.25.1 |
47 | 62 | ||
48 | 63 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | The size of the code covered by a TranslationBlock cannot be 0; | ||
4 | this is checked via assert in tb_gen_code. | ||
5 | |||
6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
9 | --- | ||
10 | target/arm/translate-a64.c | 1 + | ||
11 | 1 file changed, 1 insertion(+) | ||
12 | |||
13 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c | ||
14 | index XXXXXXX..XXXXXXX 100644 | ||
15 | --- a/target/arm/translate-a64.c | ||
16 | +++ b/target/arm/translate-a64.c | ||
17 | @@ -XXX,XX +XXX,XX @@ static void aarch64_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) | ||
18 | assert(s->base.num_insns == 1); | ||
19 | gen_swstep_exception(s, 0, 0); | ||
20 | s->base.is_jmp = DISAS_NORETURN; | ||
21 | + s->base.pc_next = pc + 4; | ||
22 | return; | ||
23 | } | ||
24 | |||
25 | -- | ||
26 | 2.25.1 | ||
27 | |||
28 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 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> | ||
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
9 | --- | ||
10 | target/arm/tlb_helper.c | 45 +++++++++++++++++++++++++---------------- | ||
11 | 1 file changed, 28 insertions(+), 17 deletions(-) | ||
12 | |||
13 | diff --git a/target/arm/tlb_helper.c b/target/arm/tlb_helper.c | ||
14 | index XXXXXXX..XXXXXXX 100644 | ||
15 | --- a/target/arm/tlb_helper.c | ||
16 | +++ b/target/arm/tlb_helper.c | ||
17 | @@ -XXX,XX +XXX,XX @@ static inline uint32_t merge_syn_data_abort(uint32_t template_syn, | ||
18 | return syn; | ||
19 | } | ||
20 | |||
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; | ||
78 | -- | ||
79 | 2.25.1 | ||
80 | |||
81 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | 1 | From: Richard Henderson <richard.henderson@linaro.org> | |
2 | |||
3 | For A64, any input to an indirect branch can cause this. | ||
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> | ||
17 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
18 | --- | ||
19 | target/arm/helper.h | 1 + | ||
20 | target/arm/syndrome.h | 5 ++++ | ||
21 | linux-user/aarch64/cpu_loop.c | 46 ++++++++++++++++++++--------------- | ||
22 | target/arm/tlb_helper.c | 18 ++++++++++++++ | ||
23 | target/arm/translate-a64.c | 15 ++++++++++++ | ||
24 | target/arm/translate.c | 22 ++++++++++++++++- | ||
25 | 6 files changed, 87 insertions(+), 20 deletions(-) | ||
26 | |||
27 | diff --git a/target/arm/helper.h b/target/arm/helper.h | ||
28 | index XXXXXXX..XXXXXXX 100644 | ||
29 | --- a/target/arm/helper.h | ||
30 | +++ b/target/arm/helper.h | ||
31 | @@ -XXX,XX +XXX,XX @@ DEF_HELPER_FLAGS_3(sel_flags, TCG_CALL_NO_RWG_SE, | ||
32 | DEF_HELPER_2(exception_internal, void, env, i32) | ||
33 | DEF_HELPER_4(exception_with_syndrome, void, env, i32, i32, i32) | ||
34 | DEF_HELPER_2(exception_bkpt_insn, void, env, i32) | ||
35 | +DEF_HELPER_2(exception_pc_alignment, noreturn, env, tl) | ||
36 | DEF_HELPER_1(setend, void, env) | ||
37 | DEF_HELPER_2(wfi, void, env, i32) | ||
38 | DEF_HELPER_1(wfe, void, env) | ||
39 | diff --git a/target/arm/syndrome.h b/target/arm/syndrome.h | ||
40 | index XXXXXXX..XXXXXXX 100644 | ||
41 | --- a/target/arm/syndrome.h | ||
42 | +++ b/target/arm/syndrome.h | ||
43 | @@ -XXX,XX +XXX,XX @@ static inline uint32_t syn_illegalstate(void) | ||
44 | return (EC_ILLEGALSTATE << ARM_EL_EC_SHIFT) | ARM_EL_IL; | ||
45 | } | ||
46 | |||
47 | +static inline uint32_t syn_pcalignment(void) | ||
48 | +{ | ||
49 | + return (EC_PCALIGNMENT << ARM_EL_EC_SHIFT) | ARM_EL_IL; | ||
50 | +} | ||
51 | + | ||
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) | ||
129 | +{ | ||
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); | ||
143 | +} | ||
144 | + | ||
145 | #if !defined(CONFIG_USER_ONLY) | ||
146 | |||
147 | /* | ||
148 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c | ||
149 | index XXXXXXX..XXXXXXX 100644 | ||
150 | --- a/target/arm/translate-a64.c | ||
151 | +++ b/target/arm/translate-a64.c | ||
152 | @@ -XXX,XX +XXX,XX @@ static void aarch64_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) | ||
153 | uint64_t pc = s->base.pc_next; | ||
154 | uint32_t insn; | ||
155 | |||
156 | + /* Singlestep exceptions have the highest priority. */ | ||
157 | if (s->ss_active && !s->pstate_ss) { | ||
158 | /* Singlestep state is Active-pending. | ||
159 | * If we're in this state at the start of a TB then either | ||
160 | @@ -XXX,XX +XXX,XX @@ static void aarch64_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) | ||
161 | return; | ||
162 | } | ||
163 | |||
164 | + if (pc & 3) { | ||
165 | + /* | ||
166 | + * PC alignment fault. This has priority over the instruction abort | ||
167 | + * that we would receive from a translation fault via arm_ldl_code. | ||
168 | + * This should only be possible after an indirect branch, at the | ||
169 | + * start of the TB. | ||
170 | + */ | ||
171 | + assert(s->base.num_insns == 1); | ||
172 | + gen_helper_exception_pc_alignment(cpu_env, tcg_constant_tl(pc)); | ||
173 | + s->base.is_jmp = DISAS_NORETURN; | ||
174 | + s->base.pc_next = QEMU_ALIGN_UP(pc, 4); | ||
175 | + return; | ||
176 | + } | ||
177 | + | ||
178 | s->pc_curr = pc; | ||
179 | insn = arm_ldl_code(env, &s->base, pc, s->sctlr_b); | ||
180 | s->insn = insn; | ||
181 | diff --git a/target/arm/translate.c b/target/arm/translate.c | ||
182 | index XXXXXXX..XXXXXXX 100644 | ||
183 | --- a/target/arm/translate.c | ||
184 | +++ b/target/arm/translate.c | ||
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; | ||
213 | } | ||
214 | -- | ||
215 | 2.25.1 | ||
216 | |||
217 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 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> | ||
12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
13 | --- | ||
14 | target/arm/gdbstub.c | 9 +++++++-- | ||
15 | target/arm/machine.c | 10 ++++++++++ | ||
16 | target/arm/translate.c | 3 +++ | ||
17 | 3 files changed, 20 insertions(+), 2 deletions(-) | ||
18 | |||
19 | diff --git a/target/arm/gdbstub.c b/target/arm/gdbstub.c | ||
20 | index XXXXXXX..XXXXXXX 100644 | ||
21 | --- a/target/arm/gdbstub.c | ||
22 | +++ b/target/arm/gdbstub.c | ||
23 | @@ -XXX,XX +XXX,XX @@ int arm_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n) | ||
24 | |||
25 | tmp = ldl_p(mem_buf); | ||
26 | |||
27 | - /* Mask out low bit of PC to workaround gdb bugs. This will probably | ||
28 | - cause problems if we ever implement the Jazelle DBX extensions. */ | ||
29 | + /* | ||
30 | + * Mask out low bits of PC to workaround gdb bugs. | ||
31 | + * This avoids an assert in thumb_tr_translate_insn, because it is | ||
32 | + * architecturally impossible to misalign the pc. | ||
33 | + * This will probably cause problems if we ever implement the | ||
34 | + * Jazelle DBX extensions. | ||
35 | + */ | ||
36 | if (n == 15) { | ||
37 | tmp &= ~1; | ||
38 | } | ||
39 | diff --git a/target/arm/machine.c b/target/arm/machine.c | ||
40 | index XXXXXXX..XXXXXXX 100644 | ||
41 | --- a/target/arm/machine.c | ||
42 | +++ b/target/arm/machine.c | ||
43 | @@ -XXX,XX +XXX,XX @@ static int cpu_post_load(void *opaque, int version_id) | ||
44 | return -1; | ||
45 | } | ||
46 | } | ||
47 | + | ||
48 | + /* | ||
49 | + * Misaligned thumb pc is architecturally impossible. | ||
50 | + * We have an assert in thumb_tr_translate_insn to verify this. | ||
51 | + * Fail an incoming migrate to avoid this assert. | ||
52 | + */ | ||
53 | + if (!is_a64(env) && env->thumb && (env->regs[15] & 1)) { | ||
54 | + return -1; | ||
55 | + } | ||
56 | + | ||
57 | if (!kvm_enabled()) { | ||
58 | pmu_op_finish(&cpu->env); | ||
59 | } | ||
60 | diff --git a/target/arm/translate.c b/target/arm/translate.c | ||
61 | index XXXXXXX..XXXXXXX 100644 | ||
62 | --- a/target/arm/translate.c | ||
63 | +++ b/target/arm/translate.c | ||
64 | @@ -XXX,XX +XXX,XX @@ static void thumb_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) | ||
65 | uint32_t insn; | ||
66 | bool is_16bit; | ||
67 | |||
68 | + /* Misaligned thumb PC is architecturally impossible. */ | ||
69 | + assert((dc->base.pc_next & 1) == 0); | ||
70 | + | ||
71 | if (arm_check_ss_active(dc) || arm_check_kernelpage(dc)) { | ||
72 | dc->base.pc_next = pc + 2; | ||
73 | return; | ||
74 | -- | ||
75 | 2.25.1 | ||
76 | |||
77 | diff view generated by jsdifflib |
1 | The Luminary PL061s in the Stellaris LM3S9695 don't all have the same | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | reset value for GPIOPUR. We can get away with not letting the board | ||
3 | configure the PUR reset value because we don't actually wire anything | ||
4 | up to the lines which should reset to pull-up. Add a comment noting | ||
5 | this omission. | ||
6 | 2 | ||
3 | Both single-step and pc alignment faults have priority over | ||
4 | breakpoint exceptions. | ||
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: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
9 | --- | 9 | --- |
10 | hw/gpio/pl061.c | 9 +++++++++ | 10 | target/arm/debug_helper.c | 23 +++++++++++++++++++++++ |
11 | 1 file changed, 9 insertions(+) | 11 | 1 file changed, 23 insertions(+) |
12 | 12 | ||
13 | diff --git a/hw/gpio/pl061.c b/hw/gpio/pl061.c | 13 | diff --git a/target/arm/debug_helper.c b/target/arm/debug_helper.c |
14 | index XXXXXXX..XXXXXXX 100644 | 14 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/hw/gpio/pl061.c | 15 | --- a/target/arm/debug_helper.c |
16 | +++ b/hw/gpio/pl061.c | 16 | +++ b/target/arm/debug_helper.c |
17 | @@ -XXX,XX +XXX,XX @@ static void pl061_enter_reset(Object *obj, ResetType type) | 17 | @@ -XXX,XX +XXX,XX @@ bool arm_debug_check_breakpoint(CPUState *cs) |
18 | trace_pl061_reset(DEVICE(s)->canonical_path); | 18 | { |
19 | 19 | ARMCPU *cpu = ARM_CPU(cs); | |
20 | /* reset values from PL061 TRM, Stellaris LM3S5P31 & LM3S8962 Data Sheet */ | 20 | CPUARMState *env = &cpu->env; |
21 | + target_ulong pc; | ||
22 | int n; | ||
23 | |||
24 | /* | ||
25 | @@ -XXX,XX +XXX,XX @@ bool arm_debug_check_breakpoint(CPUState *cs) | ||
26 | return false; | ||
27 | } | ||
28 | |||
29 | + /* | ||
30 | + * Single-step exceptions have priority over breakpoint exceptions. | ||
31 | + * If single-step state is active-pending, suppress the bp. | ||
32 | + */ | ||
33 | + if (arm_singlestep_active(env) && !(env->pstate & PSTATE_SS)) { | ||
34 | + return false; | ||
35 | + } | ||
21 | + | 36 | + |
22 | + /* | 37 | + /* |
23 | + * FIXME: For the LM3S6965, not all of the PL061 instances have the | 38 | + * PC alignment faults have priority over breakpoint exceptions. |
24 | + * same reset values for GPIOPUR, GPIOAFSEL and GPIODEN, so in theory | ||
25 | + * we should allow the board to configure these via properties. | ||
26 | + * In practice, we don't wire anything up to the affected GPIO lines | ||
27 | + * (PB7, PC0, PC1, PC2, PC3 -- they're used for JTAG), so we can | ||
28 | + * get away with this inaccuracy. | ||
29 | + */ | 39 | + */ |
30 | s->data = 0; | 40 | + pc = is_a64(env) ? env->pc : env->regs[15]; |
31 | s->old_in_data = 0; | 41 | + if ((is_a64(env) || !env->thumb) && (pc & 3) != 0) { |
32 | s->dir = 0; | 42 | + return false; |
43 | + } | ||
44 | + | ||
45 | + /* | ||
46 | + * Instruction aborts have priority over breakpoint exceptions. | ||
47 | + * TODO: We would need to look up the page for PC and verify that | ||
48 | + * it is present and executable. | ||
49 | + */ | ||
50 | + | ||
51 | for (n = 0; n < ARRAY_SIZE(env->cpu_breakpoint); n++) { | ||
52 | if (bp_wp_matches(cpu, n, false)) { | ||
53 | return true; | ||
33 | -- | 54 | -- |
34 | 2.20.1 | 55 | 2.25.1 |
35 | 56 | ||
36 | 57 | diff view generated by jsdifflib |
1 | From: Alexandre Iooss <erdnaxe@crans.org> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | This SoC is similar to stm32f205 SoC. | 3 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
4 | This will be used by the STM32VLDISCOVERY to create a machine. | 4 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
5 | |||
6 | Signed-off-by: Alexandre Iooss <erdnaxe@crans.org> | ||
7 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | ||
8 | Message-id: 20210617165647.2575955-2-erdnaxe@crans.org | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 5 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
10 | --- | 6 | --- |
11 | include/hw/arm/stm32f100_soc.h | 57 +++++++++++ | 7 | tests/tcg/aarch64/pcalign-a64.c | 37 +++++++++++++++++++++++++ |
12 | hw/arm/stm32f100_soc.c | 182 +++++++++++++++++++++++++++++++++ | 8 | tests/tcg/arm/pcalign-a32.c | 46 +++++++++++++++++++++++++++++++ |
13 | MAINTAINERS | 6 ++ | 9 | tests/tcg/aarch64/Makefile.target | 4 +-- |
14 | hw/arm/Kconfig | 6 ++ | 10 | tests/tcg/arm/Makefile.target | 4 +++ |
15 | hw/arm/meson.build | 1 + | 11 | 4 files changed, 89 insertions(+), 2 deletions(-) |
16 | 5 files changed, 252 insertions(+) | 12 | create mode 100644 tests/tcg/aarch64/pcalign-a64.c |
17 | create mode 100644 include/hw/arm/stm32f100_soc.h | 13 | create mode 100644 tests/tcg/arm/pcalign-a32.c |
18 | create mode 100644 hw/arm/stm32f100_soc.c | ||
19 | 14 | ||
20 | diff --git a/include/hw/arm/stm32f100_soc.h b/include/hw/arm/stm32f100_soc.h | 15 | diff --git a/tests/tcg/aarch64/pcalign-a64.c b/tests/tcg/aarch64/pcalign-a64.c |
21 | new file mode 100644 | 16 | new file mode 100644 |
22 | index XXXXXXX..XXXXXXX | 17 | index XXXXXXX..XXXXXXX |
23 | --- /dev/null | 18 | --- /dev/null |
24 | +++ b/include/hw/arm/stm32f100_soc.h | 19 | +++ b/tests/tcg/aarch64/pcalign-a64.c |
25 | @@ -XXX,XX +XXX,XX @@ | 20 | @@ -XXX,XX +XXX,XX @@ |
26 | +/* | 21 | +/* Test PC misalignment exception */ |
27 | + * STM32F100 SoC | ||
28 | + * | ||
29 | + * Copyright (c) 2021 Alexandre Iooss <erdnaxe@crans.org> | ||
30 | + * | ||
31 | + * Permission is hereby granted, free of charge, to any person obtaining a copy | ||
32 | + * of this software and associated documentation files (the "Software"), to deal | ||
33 | + * in the Software without restriction, including without limitation the rights | ||
34 | + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
35 | + * copies of the Software, and to permit persons to whom the Software is | ||
36 | + * furnished to do so, subject to the following conditions: | ||
37 | + * | ||
38 | + * The above copyright notice and this permission notice shall be included in | ||
39 | + * all copies or substantial portions of the Software. | ||
40 | + * | ||
41 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
42 | + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
43 | + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
44 | + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
45 | + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
46 | + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
47 | + * THE SOFTWARE. | ||
48 | + */ | ||
49 | + | 22 | + |
50 | +#ifndef HW_ARM_STM32F100_SOC_H | 23 | +#include <assert.h> |
51 | +#define HW_ARM_STM32F100_SOC_H | 24 | +#include <signal.h> |
25 | +#include <stdlib.h> | ||
26 | +#include <stdio.h> | ||
52 | + | 27 | + |
53 | +#include "hw/char/stm32f2xx_usart.h" | 28 | +static void *expected; |
54 | +#include "hw/ssi/stm32f2xx_spi.h" | ||
55 | +#include "hw/arm/armv7m.h" | ||
56 | +#include "qom/object.h" | ||
57 | + | 29 | + |
58 | +#define TYPE_STM32F100_SOC "stm32f100-soc" | 30 | +static void sigbus(int sig, siginfo_t *info, void *vuc) |
59 | +OBJECT_DECLARE_SIMPLE_TYPE(STM32F100State, STM32F100_SOC) | 31 | +{ |
32 | + assert(info->si_code == BUS_ADRALN); | ||
33 | + assert(info->si_addr == expected); | ||
34 | + exit(EXIT_SUCCESS); | ||
35 | +} | ||
60 | + | 36 | + |
61 | +#define STM_NUM_USARTS 3 | 37 | +int main() |
62 | +#define STM_NUM_SPIS 2 | 38 | +{ |
39 | + void *tmp; | ||
63 | + | 40 | + |
64 | +#define FLASH_BASE_ADDRESS 0x08000000 | 41 | + struct sigaction sa = { |
65 | +#define FLASH_SIZE (128 * 1024) | 42 | + .sa_sigaction = sigbus, |
66 | +#define SRAM_BASE_ADDRESS 0x20000000 | 43 | + .sa_flags = SA_SIGINFO |
67 | +#define SRAM_SIZE (8 * 1024) | 44 | + }; |
68 | + | 45 | + |
69 | +struct STM32F100State { | 46 | + if (sigaction(SIGBUS, &sa, NULL) < 0) { |
70 | + /*< private >*/ | 47 | + perror("sigaction"); |
71 | + SysBusDevice parent_obj; | 48 | + return EXIT_FAILURE; |
49 | + } | ||
72 | + | 50 | + |
73 | + /*< public >*/ | 51 | + asm volatile("adr %0, 1f + 1\n\t" |
74 | + char *cpu_type; | 52 | + "str %0, %1\n\t" |
75 | + | 53 | + "br %0\n" |
76 | + ARMv7MState armv7m; | 54 | + "1:" |
77 | + | 55 | + : "=&r"(tmp), "=m"(expected)); |
78 | + STM32F2XXUsartState usart[STM_NUM_USARTS]; | 56 | + abort(); |
79 | + STM32F2XXSPIState spi[STM_NUM_SPIS]; | 57 | +} |
80 | +}; | 58 | diff --git a/tests/tcg/arm/pcalign-a32.c b/tests/tcg/arm/pcalign-a32.c |
81 | + | ||
82 | +#endif | ||
83 | diff --git a/hw/arm/stm32f100_soc.c b/hw/arm/stm32f100_soc.c | ||
84 | new file mode 100644 | 59 | new file mode 100644 |
85 | index XXXXXXX..XXXXXXX | 60 | index XXXXXXX..XXXXXXX |
86 | --- /dev/null | 61 | --- /dev/null |
87 | +++ b/hw/arm/stm32f100_soc.c | 62 | +++ b/tests/tcg/arm/pcalign-a32.c |
88 | @@ -XXX,XX +XXX,XX @@ | 63 | @@ -XXX,XX +XXX,XX @@ |
89 | +/* | 64 | +/* Test PC misalignment exception */ |
90 | + * STM32F100 SoC | ||
91 | + * | ||
92 | + * Copyright (c) 2021 Alexandre Iooss <erdnaxe@crans.org> | ||
93 | + * Copyright (c) 2014 Alistair Francis <alistair@alistair23.me> | ||
94 | + * | ||
95 | + * Permission is hereby granted, free of charge, to any person obtaining a copy | ||
96 | + * of this software and associated documentation files (the "Software"), to deal | ||
97 | + * in the Software without restriction, including without limitation the rights | ||
98 | + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
99 | + * copies of the Software, and to permit persons to whom the Software is | ||
100 | + * furnished to do so, subject to the following conditions: | ||
101 | + * | ||
102 | + * The above copyright notice and this permission notice shall be included in | ||
103 | + * all copies or substantial portions of the Software. | ||
104 | + * | ||
105 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
106 | + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
107 | + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
108 | + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
109 | + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
110 | + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
111 | + * THE SOFTWARE. | ||
112 | + */ | ||
113 | + | 65 | + |
114 | +#include "qemu/osdep.h" | 66 | +#ifdef __thumb__ |
115 | +#include "qapi/error.h" | 67 | +#error "This test must be compiled for ARM" |
116 | +#include "qemu/module.h" | 68 | +#endif |
117 | +#include "hw/arm/boot.h" | ||
118 | +#include "exec/address-spaces.h" | ||
119 | +#include "hw/arm/stm32f100_soc.h" | ||
120 | +#include "hw/qdev-properties.h" | ||
121 | +#include "hw/misc/unimp.h" | ||
122 | +#include "sysemu/sysemu.h" | ||
123 | + | 69 | + |
124 | +/* stm32f100_soc implementation is derived from stm32f205_soc */ | 70 | +#include <assert.h> |
71 | +#include <signal.h> | ||
72 | +#include <stdlib.h> | ||
73 | +#include <stdio.h> | ||
125 | + | 74 | + |
126 | +static const uint32_t usart_addr[STM_NUM_USARTS] = { 0x40013800, 0x40004400, | 75 | +static void *expected; |
127 | + 0x40004800 }; | ||
128 | +static const uint32_t spi_addr[STM_NUM_SPIS] = { 0x40013000, 0x40003800 }; | ||
129 | + | 76 | + |
130 | +static const int usart_irq[STM_NUM_USARTS] = {37, 38, 39}; | 77 | +static void sigbus(int sig, siginfo_t *info, void *vuc) |
131 | +static const int spi_irq[STM_NUM_SPIS] = {35, 36}; | 78 | +{ |
79 | + assert(info->si_code == BUS_ADRALN); | ||
80 | + assert(info->si_addr == expected); | ||
81 | + exit(EXIT_SUCCESS); | ||
82 | +} | ||
132 | + | 83 | + |
133 | +static void stm32f100_soc_initfn(Object *obj) | 84 | +int main() |
134 | +{ | 85 | +{ |
135 | + STM32F100State *s = STM32F100_SOC(obj); | 86 | + void *tmp; |
136 | + int i; | ||
137 | + | 87 | + |
138 | + object_initialize_child(obj, "armv7m", &s->armv7m, TYPE_ARMV7M); | 88 | + struct sigaction sa = { |
89 | + .sa_sigaction = sigbus, | ||
90 | + .sa_flags = SA_SIGINFO | ||
91 | + }; | ||
139 | + | 92 | + |
140 | + for (i = 0; i < STM_NUM_USARTS; i++) { | 93 | + if (sigaction(SIGBUS, &sa, NULL) < 0) { |
141 | + object_initialize_child(obj, "usart[*]", &s->usart[i], | 94 | + perror("sigaction"); |
142 | + TYPE_STM32F2XX_USART); | 95 | + return EXIT_FAILURE; |
143 | + } | 96 | + } |
144 | + | 97 | + |
145 | + for (i = 0; i < STM_NUM_SPIS; i++) { | 98 | + asm volatile("adr %0, 1f + 2\n\t" |
146 | + object_initialize_child(obj, "spi[*]", &s->spi[i], TYPE_STM32F2XX_SPI); | 99 | + "str %0, %1\n\t" |
147 | + } | 100 | + "bx %0\n" |
148 | +} | 101 | + "1:" |
149 | + | 102 | + : "=&r"(tmp), "=m"(expected)); |
150 | +static void stm32f100_soc_realize(DeviceState *dev_soc, Error **errp) | ||
151 | +{ | ||
152 | + STM32F100State *s = STM32F100_SOC(dev_soc); | ||
153 | + DeviceState *dev, *armv7m; | ||
154 | + SysBusDevice *busdev; | ||
155 | + int i; | ||
156 | + | ||
157 | + MemoryRegion *system_memory = get_system_memory(); | ||
158 | + MemoryRegion *sram = g_new(MemoryRegion, 1); | ||
159 | + MemoryRegion *flash = g_new(MemoryRegion, 1); | ||
160 | + MemoryRegion *flash_alias = g_new(MemoryRegion, 1); | ||
161 | + | 103 | + |
162 | + /* | 104 | + /* |
163 | + * Init flash region | 105 | + * From v8, it is CONSTRAINED UNPREDICTABLE whether BXWritePC aligns |
164 | + * Flash starts at 0x08000000 and then is aliased to boot memory at 0x0 | 106 | + * the address or not. If so, we can legitimately fall through. |
165 | + */ | 107 | + */ |
166 | + memory_region_init_rom(flash, OBJECT(dev_soc), "STM32F100.flash", | 108 | + return EXIT_SUCCESS; |
167 | + FLASH_SIZE, &error_fatal); | 109 | +} |
168 | + memory_region_init_alias(flash_alias, OBJECT(dev_soc), | 110 | diff --git a/tests/tcg/aarch64/Makefile.target b/tests/tcg/aarch64/Makefile.target |
169 | + "STM32F100.flash.alias", flash, 0, FLASH_SIZE); | 111 | index XXXXXXX..XXXXXXX 100644 |
170 | + memory_region_add_subregion(system_memory, FLASH_BASE_ADDRESS, flash); | 112 | --- a/tests/tcg/aarch64/Makefile.target |
171 | + memory_region_add_subregion(system_memory, 0, flash_alias); | 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 | ||
172 | + | 136 | + |
173 | + /* Init SRAM region */ | 137 | ifeq ($(CONFIG_ARM_COMPATIBLE_SEMIHOSTING),y) |
174 | + memory_region_init_ram(sram, NULL, "STM32F100.sram", SRAM_SIZE, | 138 | |
175 | + &error_fatal); | 139 | # Semihosting smoke test for linux-user |
176 | + memory_region_add_subregion(system_memory, SRAM_BASE_ADDRESS, sram); | ||
177 | + | ||
178 | + /* Init ARMv7m */ | ||
179 | + armv7m = DEVICE(&s->armv7m); | ||
180 | + qdev_prop_set_uint32(armv7m, "num-irq", 61); | ||
181 | + qdev_prop_set_string(armv7m, "cpu-type", s->cpu_type); | ||
182 | + qdev_prop_set_bit(armv7m, "enable-bitband", true); | ||
183 | + object_property_set_link(OBJECT(&s->armv7m), "memory", | ||
184 | + OBJECT(get_system_memory()), &error_abort); | ||
185 | + if (!sysbus_realize(SYS_BUS_DEVICE(&s->armv7m), errp)) { | ||
186 | + return; | ||
187 | + } | ||
188 | + | ||
189 | + /* Attach UART (uses USART registers) and USART controllers */ | ||
190 | + for (i = 0; i < STM_NUM_USARTS; i++) { | ||
191 | + dev = DEVICE(&(s->usart[i])); | ||
192 | + qdev_prop_set_chr(dev, "chardev", serial_hd(i)); | ||
193 | + if (!sysbus_realize(SYS_BUS_DEVICE(&s->usart[i]), errp)) { | ||
194 | + return; | ||
195 | + } | ||
196 | + busdev = SYS_BUS_DEVICE(dev); | ||
197 | + sysbus_mmio_map(busdev, 0, usart_addr[i]); | ||
198 | + sysbus_connect_irq(busdev, 0, qdev_get_gpio_in(armv7m, usart_irq[i])); | ||
199 | + } | ||
200 | + | ||
201 | + /* SPI 1 and 2 */ | ||
202 | + for (i = 0; i < STM_NUM_SPIS; i++) { | ||
203 | + dev = DEVICE(&(s->spi[i])); | ||
204 | + if (!sysbus_realize(SYS_BUS_DEVICE(&s->spi[i]), errp)) { | ||
205 | + return; | ||
206 | + } | ||
207 | + busdev = SYS_BUS_DEVICE(dev); | ||
208 | + sysbus_mmio_map(busdev, 0, spi_addr[i]); | ||
209 | + sysbus_connect_irq(busdev, 0, qdev_get_gpio_in(armv7m, spi_irq[i])); | ||
210 | + } | ||
211 | + | ||
212 | + create_unimplemented_device("timer[2]", 0x40000000, 0x400); | ||
213 | + create_unimplemented_device("timer[3]", 0x40000400, 0x400); | ||
214 | + create_unimplemented_device("timer[4]", 0x40000800, 0x400); | ||
215 | + create_unimplemented_device("timer[6]", 0x40001000, 0x400); | ||
216 | + create_unimplemented_device("timer[7]", 0x40001400, 0x400); | ||
217 | + create_unimplemented_device("RTC", 0x40002800, 0x400); | ||
218 | + create_unimplemented_device("WWDG", 0x40002C00, 0x400); | ||
219 | + create_unimplemented_device("IWDG", 0x40003000, 0x400); | ||
220 | + create_unimplemented_device("I2C1", 0x40005400, 0x400); | ||
221 | + create_unimplemented_device("I2C2", 0x40005800, 0x400); | ||
222 | + create_unimplemented_device("BKP", 0x40006C00, 0x400); | ||
223 | + create_unimplemented_device("PWR", 0x40007000, 0x400); | ||
224 | + create_unimplemented_device("DAC", 0x40007400, 0x400); | ||
225 | + create_unimplemented_device("CEC", 0x40007800, 0x400); | ||
226 | + create_unimplemented_device("AFIO", 0x40010000, 0x400); | ||
227 | + create_unimplemented_device("EXTI", 0x40010400, 0x400); | ||
228 | + create_unimplemented_device("GPIOA", 0x40010800, 0x400); | ||
229 | + create_unimplemented_device("GPIOB", 0x40010C00, 0x400); | ||
230 | + create_unimplemented_device("GPIOC", 0x40011000, 0x400); | ||
231 | + create_unimplemented_device("GPIOD", 0x40011400, 0x400); | ||
232 | + create_unimplemented_device("GPIOE", 0x40011800, 0x400); | ||
233 | + create_unimplemented_device("ADC1", 0x40012400, 0x400); | ||
234 | + create_unimplemented_device("timer[1]", 0x40012C00, 0x400); | ||
235 | + create_unimplemented_device("timer[15]", 0x40014000, 0x400); | ||
236 | + create_unimplemented_device("timer[16]", 0x40014400, 0x400); | ||
237 | + create_unimplemented_device("timer[17]", 0x40014800, 0x400); | ||
238 | + create_unimplemented_device("DMA", 0x40020000, 0x400); | ||
239 | + create_unimplemented_device("RCC", 0x40021000, 0x400); | ||
240 | + create_unimplemented_device("Flash Int", 0x40022000, 0x400); | ||
241 | + create_unimplemented_device("CRC", 0x40023000, 0x400); | ||
242 | +} | ||
243 | + | ||
244 | +static Property stm32f100_soc_properties[] = { | ||
245 | + DEFINE_PROP_STRING("cpu-type", STM32F100State, cpu_type), | ||
246 | + DEFINE_PROP_END_OF_LIST(), | ||
247 | +}; | ||
248 | + | ||
249 | +static void stm32f100_soc_class_init(ObjectClass *klass, void *data) | ||
250 | +{ | ||
251 | + DeviceClass *dc = DEVICE_CLASS(klass); | ||
252 | + | ||
253 | + dc->realize = stm32f100_soc_realize; | ||
254 | + device_class_set_props(dc, stm32f100_soc_properties); | ||
255 | +} | ||
256 | + | ||
257 | +static const TypeInfo stm32f100_soc_info = { | ||
258 | + .name = TYPE_STM32F100_SOC, | ||
259 | + .parent = TYPE_SYS_BUS_DEVICE, | ||
260 | + .instance_size = sizeof(STM32F100State), | ||
261 | + .instance_init = stm32f100_soc_initfn, | ||
262 | + .class_init = stm32f100_soc_class_init, | ||
263 | +}; | ||
264 | + | ||
265 | +static void stm32f100_soc_types(void) | ||
266 | +{ | ||
267 | + type_register_static(&stm32f100_soc_info); | ||
268 | +} | ||
269 | + | ||
270 | +type_init(stm32f100_soc_types) | ||
271 | diff --git a/MAINTAINERS b/MAINTAINERS | ||
272 | index XXXXXXX..XXXXXXX 100644 | ||
273 | --- a/MAINTAINERS | ||
274 | +++ b/MAINTAINERS | ||
275 | @@ -XXX,XX +XXX,XX @@ L: qemu-arm@nongnu.org | ||
276 | S: Maintained | ||
277 | F: hw/arm/virt-acpi-build.c | ||
278 | |||
279 | +STM32F100 | ||
280 | +M: Alexandre Iooss <erdnaxe@crans.org> | ||
281 | +L: qemu-arm@nongnu.org | ||
282 | +S: Maintained | ||
283 | +F: hw/arm/stm32f100_soc.c | ||
284 | + | ||
285 | STM32F205 | ||
286 | M: Alistair Francis <alistair@alistair23.me> | ||
287 | M: Peter Maydell <peter.maydell@linaro.org> | ||
288 | diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig | ||
289 | index XXXXXXX..XXXXXXX 100644 | ||
290 | --- a/hw/arm/Kconfig | ||
291 | +++ b/hw/arm/Kconfig | ||
292 | @@ -XXX,XX +XXX,XX @@ config RASPI | ||
293 | select SDHCI | ||
294 | select USB_DWC2 | ||
295 | |||
296 | +config STM32F100_SOC | ||
297 | + bool | ||
298 | + select ARM_V7M | ||
299 | + select STM32F2XX_USART | ||
300 | + select STM32F2XX_SPI | ||
301 | + | ||
302 | config STM32F205_SOC | ||
303 | bool | ||
304 | select ARM_V7M | ||
305 | diff --git a/hw/arm/meson.build b/hw/arm/meson.build | ||
306 | index XXXXXXX..XXXXXXX 100644 | ||
307 | --- a/hw/arm/meson.build | ||
308 | +++ b/hw/arm/meson.build | ||
309 | @@ -XXX,XX +XXX,XX @@ arm_ss.add(when: 'CONFIG_STRONGARM', if_true: files('strongarm.c')) | ||
310 | arm_ss.add(when: 'CONFIG_ALLWINNER_A10', if_true: files('allwinner-a10.c', 'cubieboard.c')) | ||
311 | arm_ss.add(when: 'CONFIG_ALLWINNER_H3', if_true: files('allwinner-h3.c', 'orangepi.c')) | ||
312 | arm_ss.add(when: 'CONFIG_RASPI', if_true: files('bcm2835_peripherals.c', 'bcm2836.c', 'raspi.c')) | ||
313 | +arm_ss.add(when: 'CONFIG_STM32F100_SOC', if_true: files('stm32f100_soc.c')) | ||
314 | arm_ss.add(when: 'CONFIG_STM32F205_SOC', if_true: files('stm32f205_soc.c')) | ||
315 | arm_ss.add(when: 'CONFIG_STM32F405_SOC', if_true: files('stm32f405_soc.c')) | ||
316 | arm_ss.add(when: 'CONFIG_XLNX_ZYNQMP_ARM', if_true: files('xlnx-zynqmp.c', 'xlnx-zcu102.c')) | ||
317 | -- | 140 | -- |
318 | 2.20.1 | 141 | 2.25.1 |
319 | 142 | ||
320 | 143 | diff view generated by jsdifflib |
1 | Convert the use of the DPRINTF debug macro in the PL061 model to | 1 | In the SSE decode function gen_sse(), we combine a byte |
---|---|---|---|
2 | use tracepoints. | 2 | 'b' and a value 'b1' which can be [0..3], and switch on them: |
3 | b |= (b1 << 8); | ||
4 | switch (b) { | ||
5 | ... | ||
6 | default: | ||
7 | unknown_op: | ||
8 | gen_unknown_opcode(env, s); | ||
9 | return; | ||
10 | } | ||
3 | 11 | ||
12 | In three cases inside this switch, we were then also checking for | ||
13 | "if (b1 >= 2) { goto unknown_op; }". | ||
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. | ||
17 | |||
18 | This check was added in commit c045af25a52e9 in 2010; the added code | ||
19 | was unnecessary then as well, and was apparently intended only to | ||
20 | ensure that we never accidentally ended up indexing off the end | ||
21 | of an sse_op_table with only 2 entries as a result of future bugs | ||
22 | in the decode logic. | ||
23 | |||
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 | ||
4 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 28 | 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> | 29 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
7 | --- | 30 | --- |
8 | hw/gpio/pl061.c | 27 +++++++++------------------ | 31 | target/i386/tcg/translate.c | 12 +++--------- |
9 | hw/gpio/trace-events | 6 ++++++ | 32 | 1 file changed, 3 insertions(+), 9 deletions(-) |
10 | 2 files changed, 15 insertions(+), 18 deletions(-) | ||
11 | 33 | ||
12 | diff --git a/hw/gpio/pl061.c b/hw/gpio/pl061.c | 34 | diff --git a/target/i386/tcg/translate.c b/target/i386/tcg/translate.c |
13 | index XXXXXXX..XXXXXXX 100644 | 35 | index XXXXXXX..XXXXXXX 100644 |
14 | --- a/hw/gpio/pl061.c | 36 | --- a/target/i386/tcg/translate.c |
15 | +++ b/hw/gpio/pl061.c | 37 | +++ b/target/i386/tcg/translate.c |
16 | @@ -XXX,XX +XXX,XX @@ | 38 | @@ -XXX,XX +XXX,XX @@ static void gen_sse(CPUX86State *env, DisasContext *s, int b, |
17 | #include "qemu/log.h" | 39 | case 0x171: /* shift xmm, im */ |
18 | #include "qemu/module.h" | 40 | case 0x172: |
19 | #include "qom/object.h" | 41 | case 0x173: |
20 | - | 42 | - if (b1 >= 2) { |
21 | -//#define DEBUG_PL061 1 | 43 | - goto unknown_op; |
22 | - | 44 | - } |
23 | -#ifdef DEBUG_PL061 | 45 | val = x86_ldub_code(env, s); |
24 | -#define DPRINTF(fmt, ...) \ | 46 | if (is_xmm) { |
25 | -do { printf("pl061: " fmt , ## __VA_ARGS__); } while (0) | 47 | tcg_gen_movi_tl(s->T0, val); |
26 | -#define BADF(fmt, ...) \ | 48 | @@ -XXX,XX +XXX,XX @@ static void gen_sse(CPUX86State *env, DisasContext *s, int b, |
27 | -do { fprintf(stderr, "pl061: error: " fmt , ## __VA_ARGS__); exit(1);} while (0) | 49 | offsetof(CPUX86State, mmx_t0.MMX_L(1))); |
28 | -#else | 50 | op1_offset = offsetof(CPUX86State,mmx_t0); |
29 | -#define DPRINTF(fmt, ...) do {} while(0) | ||
30 | -#define BADF(fmt, ...) \ | ||
31 | -do { fprintf(stderr, "pl061: error: " fmt , ## __VA_ARGS__);} while (0) | ||
32 | -#endif | ||
33 | +#include "trace.h" | ||
34 | |||
35 | static const uint8_t pl061_id[12] = | ||
36 | { 0x00, 0x00, 0x00, 0x00, 0x61, 0x10, 0x04, 0x00, 0x0d, 0xf0, 0x05, 0xb1 }; | ||
37 | @@ -XXX,XX +XXX,XX @@ static void pl061_update(PL061State *s) | ||
38 | uint8_t out; | ||
39 | int i; | ||
40 | |||
41 | - DPRINTF("dir = %d, data = %d\n", s->dir, s->data); | ||
42 | + trace_pl061_update(DEVICE(s)->canonical_path, s->dir, s->data); | ||
43 | |||
44 | /* Outputs float high. */ | ||
45 | /* FIXME: This is board dependent. */ | ||
46 | @@ -XXX,XX +XXX,XX @@ static void pl061_update(PL061State *s) | ||
47 | for (i = 0; i < N_GPIOS; i++) { | ||
48 | mask = 1 << i; | ||
49 | if (changed & mask) { | ||
50 | - DPRINTF("Set output %d = %d\n", i, (out & mask) != 0); | ||
51 | - qemu_set_irq(s->out[i], (out & mask) != 0); | ||
52 | + int level = (out & mask) != 0; | ||
53 | + trace_pl061_set_output(DEVICE(s)->canonical_path, i, level); | ||
54 | + qemu_set_irq(s->out[i], level); | ||
55 | } | 51 | } |
56 | } | 52 | + assert(b1 < 2); |
57 | } | 53 | sse_fn_epp = sse_op_table2[((b - 1) & 3) * 8 + |
58 | @@ -XXX,XX +XXX,XX @@ static void pl061_update(PL061State *s) | 54 | (((modrm >> 3)) & 7)][b1]; |
59 | for (i = 0; i < N_GPIOS; i++) { | 55 | if (!sse_fn_epp) { |
60 | mask = 1 << i; | 56 | @@ -XXX,XX +XXX,XX @@ static void gen_sse(CPUX86State *env, DisasContext *s, int b, |
61 | if (changed & mask) { | 57 | rm = modrm & 7; |
62 | - DPRINTF("Changed input %d = %d\n", i, (s->data & mask) != 0); | 58 | reg = ((modrm >> 3) & 7) | REX_R(s); |
63 | + trace_pl061_input_change(DEVICE(s)->canonical_path, i, | 59 | mod = (modrm >> 6) & 3; |
64 | + (s->data & mask) != 0); | 60 | - if (b1 >= 2) { |
65 | 61 | - goto unknown_op; | |
66 | if (!(s->isense & mask)) { | 62 | - } |
67 | /* Edge interrupt */ | 63 | |
68 | @@ -XXX,XX +XXX,XX @@ static void pl061_update(PL061State *s) | 64 | + assert(b1 < 2); |
69 | /* Level interrupt */ | 65 | sse_fn_epp = sse_op_table6[b].op[b1]; |
70 | s->istate |= ~(s->data ^ s->iev) & s->isense; | 66 | if (!sse_fn_epp) { |
71 | 67 | goto unknown_op; | |
72 | - DPRINTF("istate = %02X\n", s->istate); | 68 | @@ -XXX,XX +XXX,XX @@ static void gen_sse(CPUX86State *env, DisasContext *s, int b, |
73 | + trace_pl061_update_istate(DEVICE(s)->canonical_path, | 69 | rm = modrm & 7; |
74 | + s->istate, s->im, (s->istate & s->im) != 0); | 70 | reg = ((modrm >> 3) & 7) | REX_R(s); |
75 | 71 | mod = (modrm >> 6) & 3; | |
76 | qemu_set_irq(s->irq, (s->istate & s->im) != 0); | 72 | - if (b1 >= 2) { |
77 | } | 73 | - goto unknown_op; |
78 | diff --git a/hw/gpio/trace-events b/hw/gpio/trace-events | 74 | - } |
79 | index XXXXXXX..XXXXXXX 100644 | 75 | |
80 | --- a/hw/gpio/trace-events | 76 | + assert(b1 < 2); |
81 | +++ b/hw/gpio/trace-events | 77 | sse_fn_eppi = sse_op_table7[b].op[b1]; |
82 | @@ -XXX,XX +XXX,XX @@ nrf51_gpio_write(uint64_t offset, uint64_t value) "offset 0x%" PRIx64 " value 0x | 78 | if (!sse_fn_eppi) { |
83 | nrf51_gpio_set(int64_t line, int64_t value) "line %" PRIi64 " value %" PRIi64 | 79 | goto unknown_op; |
84 | nrf51_gpio_update_output_irq(int64_t line, int64_t value) "line %" PRIi64 " value %" PRIi64 | ||
85 | |||
86 | +# pl061.c | ||
87 | +pl061_update(const char *id, uint32_t dir, uint32_t data) "%s GPIODIR 0x%x GPIODATA 0x%x" | ||
88 | +pl061_set_output(const char *id, int gpio, int level) "%s setting output %d to %d" | ||
89 | +pl061_input_change(const char *id, int gpio, int level) "%s input %d changed to %d" | ||
90 | +pl061_update_istate(const char *id, uint32_t istate, uint32_t im, int level) "%s GPIORIS 0x%x GPIOIE 0x%x interrupt level %d" | ||
91 | + | ||
92 | # sifive_gpio.c | ||
93 | sifive_gpio_read(uint64_t offset, uint64_t r) "offset 0x%" PRIx64 " value 0x%" PRIx64 | ||
94 | sifive_gpio_write(uint64_t offset, uint64_t value) "offset 0x%" PRIx64 " value 0x%" PRIx64 | ||
95 | -- | 80 | -- |
96 | 2.20.1 | 81 | 2.25.1 |
97 | 82 | ||
98 | 83 | diff view generated by jsdifflib |
1 | The stellaris board doesn't emulate the handling of the OLED | 1 | The qemu-common.h header is not supposed to be included from any |
---|---|---|---|
2 | chipselect line correctly. Expand the comment describing this, | 2 | other header files, only from .c files (as documented in a comment at |
3 | including a sketch of the theoretical correct way to do it. | 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. | ||
4 | 8 | ||
5 | 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 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
12 | Message-id: 20211129200510.1233037-2-peter.maydell@linaro.org | ||
6 | --- | 13 | --- |
7 | hw/arm/stellaris.c | 56 +++++++++++++++++++++++++++++++++++++++++++++- | 14 | include/hw/i386/microvm.h | 1 - |
8 | 1 file changed, 55 insertions(+), 1 deletion(-) | 15 | include/hw/i386/x86.h | 1 - |
16 | 2 files changed, 2 deletions(-) | ||
9 | 17 | ||
10 | diff --git a/hw/arm/stellaris.c b/hw/arm/stellaris.c | 18 | diff --git a/include/hw/i386/microvm.h b/include/hw/i386/microvm.h |
11 | index XXXXXXX..XXXXXXX 100644 | 19 | index XXXXXXX..XXXXXXX 100644 |
12 | --- a/hw/arm/stellaris.c | 20 | --- a/include/hw/i386/microvm.h |
13 | +++ b/hw/arm/stellaris.c | 21 | +++ b/include/hw/i386/microvm.h |
14 | @@ -XXX,XX +XXX,XX @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board) | 22 | @@ -XXX,XX +XXX,XX @@ |
15 | DeviceState *sddev; | 23 | #ifndef HW_I386_MICROVM_H |
16 | DeviceState *ssddev; | 24 | #define HW_I386_MICROVM_H |
17 | 25 | ||
18 | - /* Some boards have both an OLED controller and SD card connected to | 26 | -#include "qemu-common.h" |
19 | + /* | 27 | #include "exec/hwaddr.h" |
20 | + * Some boards have both an OLED controller and SD card connected to | 28 | #include "qemu/notify.h" |
21 | * the same SSI port, with the SD card chip select connected to a | 29 | |
22 | * GPIO pin. Technically the OLED chip select is connected to the | 30 | diff --git a/include/hw/i386/x86.h b/include/hw/i386/x86.h |
23 | * SSI Fss pin. We do not bother emulating that as both devices | 31 | index XXXXXXX..XXXXXXX 100644 |
24 | * should never be selected simultaneously, and our OLED controller | 32 | --- a/include/hw/i386/x86.h |
25 | * ignores stray 0xff commands that occur when deselecting the SD | 33 | +++ b/include/hw/i386/x86.h |
26 | * card. | 34 | @@ -XXX,XX +XXX,XX @@ |
27 | + * | 35 | #ifndef HW_I386_X86_H |
28 | + * The h/w wiring is: | 36 | #define HW_I386_X86_H |
29 | + * - GPIO pin D0 is wired to the active-low SD card chip select | 37 | |
30 | + * - GPIO pin A3 is wired to the active-low OLED chip select | 38 | -#include "qemu-common.h" |
31 | + * - The SoC wiring of the PL061 "auxiliary function" for A3 is | 39 | #include "exec/hwaddr.h" |
32 | + * SSI0Fss ("frame signal"), which is an output from the SoC's | 40 | #include "qemu/notify.h" |
33 | + * SSI controller. The SSI controller takes SSI0Fss low when it | ||
34 | + * transmits a frame, so it can work as a chip-select signal. | ||
35 | + * - GPIO A4 is aux-function SSI0Rx, and wired to the SD card Tx | ||
36 | + * (the OLED never sends data to the CPU, so no wiring needed) | ||
37 | + * - GPIO A5 is aux-function SSI0Tx, and wired to the SD card Rx | ||
38 | + * and the OLED display-data-in | ||
39 | + * - GPIO A2 is aux-function SSI0Clk, wired to SD card and OLED | ||
40 | + * serial-clock input | ||
41 | + * So a guest that wants to use the OLED can configure the PL061 | ||
42 | + * to make pins A2, A3, A5 aux-function, so they are connected | ||
43 | + * directly to the SSI controller. When the SSI controller sends | ||
44 | + * data it asserts SSI0Fss which selects the OLED. | ||
45 | + * A guest that wants to use the SD card configures A2, A4 and A5 | ||
46 | + * as aux-function, but leaves A3 as a software-controlled GPIO | ||
47 | + * line. It asserts the SD card chip-select by using the PL061 | ||
48 | + * to control pin D0, and lets the SSI controller handle Clk, Tx | ||
49 | + * and Rx. (The SSI controller asserts Fss during tx cycles as | ||
50 | + * usual, but because A3 is not set to aux-function this is not | ||
51 | + * forwarded to the OLED, and so the OLED stays unselected.) | ||
52 | + * | ||
53 | + * The QEMU implementation instead is: | ||
54 | + * - GPIO pin D0 is wired to the active-low SD card chip select, | ||
55 | + * and also to the OLED chip-select which is implemented | ||
56 | + * as *active-high* | ||
57 | + * - SSI controller signals go to the devices regardless of | ||
58 | + * whether the guest programs A2, A4, A5 as aux-function or not | ||
59 | + * | ||
60 | + * The problem with this implementation is if the guest doesn't | ||
61 | + * care about the SD card and only uses the OLED. In that case it | ||
62 | + * may choose never to do anything with D0 (leaving it in its | ||
63 | + * default floating state, which reliably leaves the card disabled | ||
64 | + * because an SD card has a pullup on CS within the card itself), | ||
65 | + * and only set up A2, A3, A5. This for us would mean the OLED | ||
66 | + * never gets the chip-select assert it needs. We work around | ||
67 | + * this with a manual raise of D0 here (despite board creation | ||
68 | + * code being the wrong place to raise IRQ lines) to put the OLED | ||
69 | + * into an initially selected state. | ||
70 | + * | ||
71 | + * In theory the right way to model this would be: | ||
72 | + * - Implement aux-function support in the PL061, with an | ||
73 | + * extra set of AFIN and AFOUT GPIO lines (set up so that | ||
74 | + * if a GPIO line is in auxfn mode the main GPIO in and out | ||
75 | + * track the AFIN and AFOUT lines) | ||
76 | + * - Wire the AFOUT for D0 up to either a line from the | ||
77 | + * SSI controller that's pulled low around every transmit, | ||
78 | + * or at least to an always-0 line here on the board | ||
79 | + * - Make the ssd0323 OLED controller chipselect active-low | ||
80 | */ | ||
81 | bus = qdev_get_child_bus(dev, "ssi"); | ||
82 | 41 | ||
83 | -- | 42 | -- |
84 | 2.20.1 | 43 | 2.25.1 |
85 | 44 | ||
86 | 45 | diff view generated by jsdifflib |
1 | The PL061 GPIO does not itself include pullup or pulldown resistors | 1 | The qemu-common.h header is not supposed to be included from any |
---|---|---|---|
2 | to set the value of a GPIO line treated as an output when it is | 2 | other header files, only from .c files (as documented in a comment at |
3 | configured as an input (ie when the PL061 itself is not driving it). | 3 | the start of it). |
4 | In real hardware it is up to the board to add suitable pullups or | ||
5 | pulldowns. Currently our implementation hardwires this to "outputs | ||
6 | pulled high", which is correct for some boards (eg the realview ones: | ||
7 | see figure 3-29 in the "RealView Platform Baseboard for ARM926EJ-S | ||
8 | User Guide" DUI0224I), but wrong for others. | ||
9 | 4 | ||
10 | In particular, the wiring in the 'virt' board and the gpio-pwr device | 5 | Move the include to linux-user/hexagon/cpu_loop.c, which needs it for |
11 | assumes that wires should be pulled low, because otherwise the | 6 | the declaration of cpu_exec_step_atomic(). |
12 | pull-to-high will trigger a shutdown or reset action. (The only | ||
13 | reason this doesn't happen immediately on startup is due to another | ||
14 | bug in the PL061, where we don't assert the GPIOs to the correct | ||
15 | value on reset, but will do so as soon as the guest touches a | ||
16 | register and pl061_update() gets called.) | ||
17 | |||
18 | Add properties to the pl061 so the board can configure whether it | ||
19 | wants GPIO lines to have pullup, pulldown, or neither. | ||
20 | 7 | ||
21 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
22 | 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> | ||
11 | Reviewed-by: Taylor Simpson <tsimpson@quicinc.com> | ||
12 | Message-id: 20211129200510.1233037-3-peter.maydell@linaro.org | ||
23 | --- | 13 | --- |
24 | hw/gpio/pl061.c | 51 +++++++++++++++++++++++++++++++++++++++++++++---- | 14 | target/hexagon/cpu.h | 1 - |
25 | 1 file changed, 47 insertions(+), 4 deletions(-) | 15 | linux-user/hexagon/cpu_loop.c | 1 + |
16 | 2 files changed, 1 insertion(+), 1 deletion(-) | ||
26 | 17 | ||
27 | diff --git a/hw/gpio/pl061.c b/hw/gpio/pl061.c | 18 | diff --git a/target/hexagon/cpu.h b/target/hexagon/cpu.h |
28 | index XXXXXXX..XXXXXXX 100644 | 19 | index XXXXXXX..XXXXXXX 100644 |
29 | --- a/hw/gpio/pl061.c | 20 | --- a/target/hexagon/cpu.h |
30 | +++ b/hw/gpio/pl061.c | 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 | ||
31 | @@ -XXX,XX +XXX,XX @@ | 34 | @@ -XXX,XX +XXX,XX @@ |
32 | * + unnamed GPIO inputs 0..7: inputs to connect to the emulated GPIO lines | ||
33 | * + unnamed GPIO outputs 0..7: the emulated GPIO lines, considered as | ||
34 | * outputs | ||
35 | + * + QOM property "pullups": an integer defining whether non-floating lines | ||
36 | + * configured as inputs should be pulled up to logical 1 (ie whether in | ||
37 | + * real hardware they have a pullup resistor on the line out of the PL061). | ||
38 | + * This should be an 8-bit value, where bit 0 is 1 if GPIO line 0 should | ||
39 | + * be pulled high, bit 1 configures line 1, and so on. The default is 0xff, | ||
40 | + * indicating that all GPIO lines are pulled up to logical 1. | ||
41 | + * + QOM property "pulldowns": an integer defining whether non-floating lines | ||
42 | + * configured as inputs should be pulled down to logical 0 (ie whether in | ||
43 | + * real hardware they have a pulldown resistor on the line out of the PL061). | ||
44 | + * This should be an 8-bit value, where bit 0 is 1 if GPIO line 0 should | ||
45 | + * be pulled low, bit 1 configures line 1, and so on. The default is 0x0. | ||
46 | + * It is an error to set a bit in both "pullups" and "pulldowns". If a bit | ||
47 | + * is 0 in both, then the line is considered to be floating, and it will | ||
48 | + * not have qemu_set_irq() called on it when it is configured as an input. | ||
49 | */ | 35 | */ |
50 | 36 | ||
51 | #include "qemu/osdep.h" | 37 | #include "qemu/osdep.h" |
52 | #include "hw/irq.h" | 38 | +#include "qemu-common.h" |
53 | #include "hw/sysbus.h" | 39 | #include "qemu.h" |
54 | +#include "hw/qdev-properties.h" | 40 | #include "user-internals.h" |
55 | #include "migration/vmstate.h" | 41 | #include "cpu_loop-common.h" |
56 | +#include "qapi/error.h" | ||
57 | #include "qemu/log.h" | ||
58 | #include "qemu/module.h" | ||
59 | #include "qom/object.h" | ||
60 | @@ -XXX,XX +XXX,XX @@ struct PL061State { | ||
61 | qemu_irq irq; | ||
62 | qemu_irq out[N_GPIOS]; | ||
63 | const unsigned char *id; | ||
64 | + /* Properties, for non-Luminary PL061 */ | ||
65 | + uint32_t pullups; | ||
66 | + uint32_t pulldowns; | ||
67 | }; | ||
68 | |||
69 | static const VMStateDescription vmstate_pl061 = { | ||
70 | @@ -XXX,XX +XXX,XX @@ static uint8_t pl061_floating(PL061State *s) | ||
71 | */ | ||
72 | floating = ~(s->pur | s->pdr); | ||
73 | } else { | ||
74 | - /* Assume outputs are pulled high. FIXME: this is board dependent. */ | ||
75 | - floating = 0; | ||
76 | + floating = ~(s->pullups | s->pulldowns); | ||
77 | } | ||
78 | return floating & ~s->dir; | ||
79 | } | ||
80 | @@ -XXX,XX +XXX,XX @@ static uint8_t pl061_pullups(PL061State *s) | ||
81 | */ | ||
82 | pullups = s->pur; | ||
83 | } else { | ||
84 | - /* Assume outputs are pulled high. FIXME: this is board dependent. */ | ||
85 | - pullups = 0xff; | ||
86 | + pullups = s->pullups; | ||
87 | } | ||
88 | return pullups & ~s->dir; | ||
89 | } | ||
90 | @@ -XXX,XX +XXX,XX @@ static void pl061_init(Object *obj) | ||
91 | qdev_init_gpio_out(dev, s->out, N_GPIOS); | ||
92 | } | ||
93 | |||
94 | +static void pl061_realize(DeviceState *dev, Error **errp) | ||
95 | +{ | ||
96 | + PL061State *s = PL061(dev); | ||
97 | + | ||
98 | + if (s->pullups > 0xff) { | ||
99 | + error_setg(errp, "pullups property must be between 0 and 0xff"); | ||
100 | + return; | ||
101 | + } | ||
102 | + if (s->pulldowns > 0xff) { | ||
103 | + error_setg(errp, "pulldowns property must be between 0 and 0xff"); | ||
104 | + return; | ||
105 | + } | ||
106 | + if (s->pullups & s->pulldowns) { | ||
107 | + error_setg(errp, "no bit may be set both in pullups and pulldowns"); | ||
108 | + return; | ||
109 | + } | ||
110 | +} | ||
111 | + | ||
112 | +static Property pl061_props[] = { | ||
113 | + DEFINE_PROP_UINT32("pullups", PL061State, pullups, 0xff), | ||
114 | + DEFINE_PROP_UINT32("pulldowns", PL061State, pulldowns, 0x0), | ||
115 | + DEFINE_PROP_END_OF_LIST() | ||
116 | +}; | ||
117 | + | ||
118 | static void pl061_class_init(ObjectClass *klass, void *data) | ||
119 | { | ||
120 | DeviceClass *dc = DEVICE_CLASS(klass); | ||
121 | |||
122 | dc->vmsd = &vmstate_pl061; | ||
123 | dc->reset = &pl061_reset; | ||
124 | + dc->realize = pl061_realize; | ||
125 | + device_class_set_props(dc, pl061_props); | ||
126 | } | ||
127 | |||
128 | static const TypeInfo pl061_info = { | ||
129 | -- | 42 | -- |
130 | 2.20.1 | 43 | 2.25.1 |
131 | 44 | ||
132 | 45 | diff view generated by jsdifflib |
1 | Currently the pl061_read() and pl061_write() functions handle offsets | 1 | The qemu-common.h header is not supposed to be included from any |
---|---|---|---|
2 | using a combination of three if() statements and a switch(). Clean | 2 | other header files, only from .c files (as documented in a comment at |
3 | this up to use just a switch, using case ranges. | 3 | the start of it). |
4 | 4 | ||
5 | This requires that instead of catching accesses to the luminary-only | 5 | Nothing actually relies on target/rx/cpu.h including it, so we can |
6 | registers on a stock PL061 via a check on s->rsvd_start we use | 6 | just drop the include. |
7 | an "is this luminary?" check in the cases for each luminary-only | ||
8 | register. | ||
9 | 7 | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
11 | 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> | ||
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 | ||
12 | --- | 14 | --- |
13 | hw/gpio/pl061.c | 104 ++++++++++++++++++++++++++++++++++++------------ | 15 | target/rx/cpu.h | 1 - |
14 | 1 file changed, 79 insertions(+), 25 deletions(-) | 16 | 1 file changed, 1 deletion(-) |
15 | 17 | ||
16 | diff --git a/hw/gpio/pl061.c b/hw/gpio/pl061.c | 18 | diff --git a/target/rx/cpu.h b/target/rx/cpu.h |
17 | index XXXXXXX..XXXXXXX 100644 | 19 | index XXXXXXX..XXXXXXX 100644 |
18 | --- a/hw/gpio/pl061.c | 20 | --- a/target/rx/cpu.h |
19 | +++ b/hw/gpio/pl061.c | 21 | +++ b/target/rx/cpu.h |
20 | @@ -XXX,XX +XXX,XX @@ struct PL061State { | 22 | @@ -XXX,XX +XXX,XX @@ |
21 | qemu_irq irq; | 23 | #define RX_CPU_H |
22 | qemu_irq out[N_GPIOS]; | 24 | |
23 | const unsigned char *id; | 25 | #include "qemu/bitops.h" |
24 | - uint32_t rsvd_start; /* reserved area: [rsvd_start, 0xfcc] */ | 26 | -#include "qemu-common.h" |
25 | }; | 27 | #include "hw/registerfields.h" |
26 | 28 | #include "cpu-qom.h" | |
27 | static const VMStateDescription vmstate_pl061 = { | 29 | |
28 | @@ -XXX,XX +XXX,XX @@ static uint64_t pl061_read(void *opaque, hwaddr offset, | ||
29 | { | ||
30 | PL061State *s = (PL061State *)opaque; | ||
31 | |||
32 | - if (offset < 0x400) { | ||
33 | - return s->data & (offset >> 2); | ||
34 | - } | ||
35 | - if (offset >= s->rsvd_start && offset <= 0xfcc) { | ||
36 | - goto err_out; | ||
37 | - } | ||
38 | - if (offset >= 0xfd0 && offset < 0x1000) { | ||
39 | - return s->id[(offset - 0xfd0) >> 2]; | ||
40 | - } | ||
41 | switch (offset) { | ||
42 | + case 0x0 ... 0x3ff: /* Data */ | ||
43 | + return s->data & (offset >> 2); | ||
44 | case 0x400: /* Direction */ | ||
45 | return s->dir; | ||
46 | case 0x404: /* Interrupt sense */ | ||
47 | @@ -XXX,XX +XXX,XX @@ static uint64_t pl061_read(void *opaque, hwaddr offset, | ||
48 | case 0x420: /* Alternate function select */ | ||
49 | return s->afsel; | ||
50 | case 0x500: /* 2mA drive */ | ||
51 | + if (s->id != pl061_id_luminary) { | ||
52 | + goto bad_offset; | ||
53 | + } | ||
54 | return s->dr2r; | ||
55 | case 0x504: /* 4mA drive */ | ||
56 | + if (s->id != pl061_id_luminary) { | ||
57 | + goto bad_offset; | ||
58 | + } | ||
59 | return s->dr4r; | ||
60 | case 0x508: /* 8mA drive */ | ||
61 | + if (s->id != pl061_id_luminary) { | ||
62 | + goto bad_offset; | ||
63 | + } | ||
64 | return s->dr8r; | ||
65 | case 0x50c: /* Open drain */ | ||
66 | + if (s->id != pl061_id_luminary) { | ||
67 | + goto bad_offset; | ||
68 | + } | ||
69 | return s->odr; | ||
70 | case 0x510: /* Pull-up */ | ||
71 | + if (s->id != pl061_id_luminary) { | ||
72 | + goto bad_offset; | ||
73 | + } | ||
74 | return s->pur; | ||
75 | case 0x514: /* Pull-down */ | ||
76 | + if (s->id != pl061_id_luminary) { | ||
77 | + goto bad_offset; | ||
78 | + } | ||
79 | return s->pdr; | ||
80 | case 0x518: /* Slew rate control */ | ||
81 | + if (s->id != pl061_id_luminary) { | ||
82 | + goto bad_offset; | ||
83 | + } | ||
84 | return s->slr; | ||
85 | case 0x51c: /* Digital enable */ | ||
86 | + if (s->id != pl061_id_luminary) { | ||
87 | + goto bad_offset; | ||
88 | + } | ||
89 | return s->den; | ||
90 | case 0x520: /* Lock */ | ||
91 | + if (s->id != pl061_id_luminary) { | ||
92 | + goto bad_offset; | ||
93 | + } | ||
94 | return s->locked; | ||
95 | case 0x524: /* Commit */ | ||
96 | + if (s->id != pl061_id_luminary) { | ||
97 | + goto bad_offset; | ||
98 | + } | ||
99 | return s->cr; | ||
100 | case 0x528: /* Analog mode select */ | ||
101 | + if (s->id != pl061_id_luminary) { | ||
102 | + goto bad_offset; | ||
103 | + } | ||
104 | return s->amsel; | ||
105 | + case 0xfd0 ... 0xfff: /* ID registers */ | ||
106 | + return s->id[(offset - 0xfd0) >> 2]; | ||
107 | default: | ||
108 | + bad_offset: | ||
109 | + qemu_log_mask(LOG_GUEST_ERROR, | ||
110 | + "pl061_read: Bad offset %x\n", (int)offset); | ||
111 | break; | ||
112 | } | ||
113 | -err_out: | ||
114 | - qemu_log_mask(LOG_GUEST_ERROR, | ||
115 | - "pl061_read: Bad offset %x\n", (int)offset); | ||
116 | return 0; | ||
117 | } | ||
118 | |||
119 | @@ -XXX,XX +XXX,XX @@ static void pl061_write(void *opaque, hwaddr offset, | ||
120 | PL061State *s = (PL061State *)opaque; | ||
121 | uint8_t mask; | ||
122 | |||
123 | - if (offset < 0x400) { | ||
124 | + switch (offset) { | ||
125 | + case 0 ... 0x3ff: | ||
126 | mask = (offset >> 2) & s->dir; | ||
127 | s->data = (s->data & ~mask) | (value & mask); | ||
128 | pl061_update(s); | ||
129 | return; | ||
130 | - } | ||
131 | - if (offset >= s->rsvd_start) { | ||
132 | - goto err_out; | ||
133 | - } | ||
134 | - switch (offset) { | ||
135 | case 0x400: /* Direction */ | ||
136 | s->dir = value & 0xff; | ||
137 | break; | ||
138 | @@ -XXX,XX +XXX,XX @@ static void pl061_write(void *opaque, hwaddr offset, | ||
139 | s->afsel = (s->afsel & ~mask) | (value & mask); | ||
140 | break; | ||
141 | case 0x500: /* 2mA drive */ | ||
142 | + if (s->id != pl061_id_luminary) { | ||
143 | + goto bad_offset; | ||
144 | + } | ||
145 | s->dr2r = value & 0xff; | ||
146 | break; | ||
147 | case 0x504: /* 4mA drive */ | ||
148 | + if (s->id != pl061_id_luminary) { | ||
149 | + goto bad_offset; | ||
150 | + } | ||
151 | s->dr4r = value & 0xff; | ||
152 | break; | ||
153 | case 0x508: /* 8mA drive */ | ||
154 | + if (s->id != pl061_id_luminary) { | ||
155 | + goto bad_offset; | ||
156 | + } | ||
157 | s->dr8r = value & 0xff; | ||
158 | break; | ||
159 | case 0x50c: /* Open drain */ | ||
160 | + if (s->id != pl061_id_luminary) { | ||
161 | + goto bad_offset; | ||
162 | + } | ||
163 | s->odr = value & 0xff; | ||
164 | break; | ||
165 | case 0x510: /* Pull-up */ | ||
166 | + if (s->id != pl061_id_luminary) { | ||
167 | + goto bad_offset; | ||
168 | + } | ||
169 | s->pur = value & 0xff; | ||
170 | break; | ||
171 | case 0x514: /* Pull-down */ | ||
172 | + if (s->id != pl061_id_luminary) { | ||
173 | + goto bad_offset; | ||
174 | + } | ||
175 | s->pdr = value & 0xff; | ||
176 | break; | ||
177 | case 0x518: /* Slew rate control */ | ||
178 | + if (s->id != pl061_id_luminary) { | ||
179 | + goto bad_offset; | ||
180 | + } | ||
181 | s->slr = value & 0xff; | ||
182 | break; | ||
183 | case 0x51c: /* Digital enable */ | ||
184 | + if (s->id != pl061_id_luminary) { | ||
185 | + goto bad_offset; | ||
186 | + } | ||
187 | s->den = value & 0xff; | ||
188 | break; | ||
189 | case 0x520: /* Lock */ | ||
190 | + if (s->id != pl061_id_luminary) { | ||
191 | + goto bad_offset; | ||
192 | + } | ||
193 | s->locked = (value != 0xacce551); | ||
194 | break; | ||
195 | case 0x524: /* Commit */ | ||
196 | + if (s->id != pl061_id_luminary) { | ||
197 | + goto bad_offset; | ||
198 | + } | ||
199 | if (!s->locked) | ||
200 | s->cr = value & 0xff; | ||
201 | break; | ||
202 | case 0x528: | ||
203 | + if (s->id != pl061_id_luminary) { | ||
204 | + goto bad_offset; | ||
205 | + } | ||
206 | s->amsel = value & 0xff; | ||
207 | break; | ||
208 | default: | ||
209 | - goto err_out; | ||
210 | + bad_offset: | ||
211 | + qemu_log_mask(LOG_GUEST_ERROR, | ||
212 | + "pl061_write: Bad offset %x\n", (int)offset); | ||
213 | + return; | ||
214 | } | ||
215 | pl061_update(s); | ||
216 | return; | ||
217 | -err_out: | ||
218 | - qemu_log_mask(LOG_GUEST_ERROR, | ||
219 | - "pl061_write: Bad offset %x\n", (int)offset); | ||
220 | } | ||
221 | |||
222 | static void pl061_reset(DeviceState *dev) | ||
223 | @@ -XXX,XX +XXX,XX @@ static void pl061_luminary_init(Object *obj) | ||
224 | PL061State *s = PL061(obj); | ||
225 | |||
226 | s->id = pl061_id_luminary; | ||
227 | - s->rsvd_start = 0x52c; | ||
228 | } | ||
229 | |||
230 | static void pl061_init(Object *obj) | ||
231 | @@ -XXX,XX +XXX,XX @@ static void pl061_init(Object *obj) | ||
232 | SysBusDevice *sbd = SYS_BUS_DEVICE(obj); | ||
233 | |||
234 | s->id = pl061_id; | ||
235 | - s->rsvd_start = 0x424; | ||
236 | |||
237 | memory_region_init_io(&s->iomem, obj, &pl061_ops, s, "pl061", 0x1000); | ||
238 | sysbus_init_mmio(sbd, &s->iomem); | ||
239 | -- | 30 | -- |
240 | 2.20.1 | 31 | 2.25.1 |
241 | 32 | ||
242 | 33 | diff view generated by jsdifflib |
1 | Add a comment documenting the "QEMU interface" of this device: | 1 | A lot of C files in hw/arm include qemu-common.h when they don't |
---|---|---|---|
2 | which MMIO regions, IRQ lines, GPIO lines, etc it exposes. | 2 | need anything from it. Drop the include lines. |
3 | |||
4 | omap1.c, pxa2xx.c and strongarm.c retain the include because they | ||
5 | use it for the prototype of qemu_get_timedate(). | ||
3 | 6 | ||
4 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
5 | 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 | ||
6 | --- | 13 | --- |
7 | hw/gpio/pl061.c | 7 +++++++ | 14 | hw/arm/boot.c | 1 - |
8 | 1 file changed, 7 insertions(+) | 15 | hw/arm/digic_boards.c | 1 - |
16 | hw/arm/highbank.c | 1 - | ||
17 | hw/arm/npcm7xx_boards.c | 1 - | ||
18 | hw/arm/sbsa-ref.c | 1 - | ||
19 | hw/arm/stm32f405_soc.c | 1 - | ||
20 | hw/arm/vexpress.c | 1 - | ||
21 | hw/arm/virt.c | 1 - | ||
22 | 8 files changed, 8 deletions(-) | ||
9 | 23 | ||
10 | diff --git a/hw/gpio/pl061.c b/hw/gpio/pl061.c | 24 | diff --git a/hw/arm/boot.c b/hw/arm/boot.c |
11 | index XXXXXXX..XXXXXXX 100644 | 25 | index XXXXXXX..XXXXXXX 100644 |
12 | --- a/hw/gpio/pl061.c | 26 | --- a/hw/arm/boot.c |
13 | +++ b/hw/gpio/pl061.c | 27 | +++ b/hw/arm/boot.c |
14 | @@ -XXX,XX +XXX,XX @@ | 28 | @@ -XXX,XX +XXX,XX @@ |
15 | * Written by Paul Brook | ||
16 | * | ||
17 | * This code is licensed under the GPL. | ||
18 | + * | ||
19 | + * QEMU interface: | ||
20 | + * + sysbus MMIO region 0: the device registers | ||
21 | + * + sysbus IRQ: the GPIOINTR interrupt line | ||
22 | + * + unnamed GPIO inputs 0..7: inputs to connect to the emulated GPIO lines | ||
23 | + * + unnamed GPIO outputs 0..7: the emulated GPIO lines, considered as | ||
24 | + * outputs | ||
25 | */ | 29 | */ |
26 | 30 | ||
27 | #include "qemu/osdep.h" | 31 | #include "qemu/osdep.h" |
32 | -#include "qemu-common.h" | ||
33 | #include "qemu/datadir.h" | ||
34 | #include "qemu/error-report.h" | ||
35 | #include "qapi/error.h" | ||
36 | diff --git a/hw/arm/digic_boards.c b/hw/arm/digic_boards.c | ||
37 | index XXXXXXX..XXXXXXX 100644 | ||
38 | --- a/hw/arm/digic_boards.c | ||
39 | +++ b/hw/arm/digic_boards.c | ||
40 | @@ -XXX,XX +XXX,XX @@ | ||
41 | |||
42 | #include "qemu/osdep.h" | ||
43 | #include "qapi/error.h" | ||
44 | -#include "qemu-common.h" | ||
45 | #include "qemu/datadir.h" | ||
46 | #include "hw/boards.h" | ||
47 | #include "qemu/error-report.h" | ||
48 | diff --git a/hw/arm/highbank.c b/hw/arm/highbank.c | ||
49 | index XXXXXXX..XXXXXXX 100644 | ||
50 | --- a/hw/arm/highbank.c | ||
51 | +++ b/hw/arm/highbank.c | ||
52 | @@ -XXX,XX +XXX,XX @@ | ||
53 | */ | ||
54 | |||
55 | #include "qemu/osdep.h" | ||
56 | -#include "qemu-common.h" | ||
57 | #include "qemu/datadir.h" | ||
58 | #include "qapi/error.h" | ||
59 | #include "hw/sysbus.h" | ||
60 | diff --git a/hw/arm/npcm7xx_boards.c b/hw/arm/npcm7xx_boards.c | ||
61 | index XXXXXXX..XXXXXXX 100644 | ||
62 | --- a/hw/arm/npcm7xx_boards.c | ||
63 | +++ b/hw/arm/npcm7xx_boards.c | ||
64 | @@ -XXX,XX +XXX,XX @@ | ||
65 | #include "hw/qdev-core.h" | ||
66 | #include "hw/qdev-properties.h" | ||
67 | #include "qapi/error.h" | ||
68 | -#include "qemu-common.h" | ||
69 | #include "qemu/datadir.h" | ||
70 | #include "qemu/units.h" | ||
71 | #include "sysemu/blockdev.h" | ||
72 | diff --git a/hw/arm/sbsa-ref.c b/hw/arm/sbsa-ref.c | ||
73 | index XXXXXXX..XXXXXXX 100644 | ||
74 | --- a/hw/arm/sbsa-ref.c | ||
75 | +++ b/hw/arm/sbsa-ref.c | ||
76 | @@ -XXX,XX +XXX,XX @@ | ||
77 | */ | ||
78 | |||
79 | #include "qemu/osdep.h" | ||
80 | -#include "qemu-common.h" | ||
81 | #include "qemu/datadir.h" | ||
82 | #include "qapi/error.h" | ||
83 | #include "qemu/error-report.h" | ||
84 | diff --git a/hw/arm/stm32f405_soc.c b/hw/arm/stm32f405_soc.c | ||
85 | index XXXXXXX..XXXXXXX 100644 | ||
86 | --- a/hw/arm/stm32f405_soc.c | ||
87 | +++ b/hw/arm/stm32f405_soc.c | ||
88 | @@ -XXX,XX +XXX,XX @@ | ||
89 | |||
90 | #include "qemu/osdep.h" | ||
91 | #include "qapi/error.h" | ||
92 | -#include "qemu-common.h" | ||
93 | #include "exec/address-spaces.h" | ||
94 | #include "sysemu/sysemu.h" | ||
95 | #include "hw/arm/stm32f405_soc.h" | ||
96 | diff --git a/hw/arm/vexpress.c b/hw/arm/vexpress.c | ||
97 | index XXXXXXX..XXXXXXX 100644 | ||
98 | --- a/hw/arm/vexpress.c | ||
99 | +++ b/hw/arm/vexpress.c | ||
100 | @@ -XXX,XX +XXX,XX @@ | ||
101 | |||
102 | #include "qemu/osdep.h" | ||
103 | #include "qapi/error.h" | ||
104 | -#include "qemu-common.h" | ||
105 | #include "qemu/datadir.h" | ||
106 | #include "cpu.h" | ||
107 | #include "hw/sysbus.h" | ||
108 | diff --git a/hw/arm/virt.c b/hw/arm/virt.c | ||
109 | index XXXXXXX..XXXXXXX 100644 | ||
110 | --- a/hw/arm/virt.c | ||
111 | +++ b/hw/arm/virt.c | ||
112 | @@ -XXX,XX +XXX,XX @@ | ||
113 | */ | ||
114 | |||
115 | #include "qemu/osdep.h" | ||
116 | -#include "qemu-common.h" | ||
117 | #include "qemu/datadir.h" | ||
118 | #include "qemu/units.h" | ||
119 | #include "qemu/option.h" | ||
28 | -- | 120 | -- |
29 | 2.20.1 | 121 | 2.25.1 |
30 | 122 | ||
31 | 123 | diff view generated by jsdifflib |
1 | From: "hnick@vmware.com" <hnick@vmware.com> | 1 | The calculation of the length of TLB range invalidate operations |
---|---|---|---|
2 | in tlbi_aa64_range_get_length() is incorrect in two ways: | ||
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 | ||
2 | 11 | ||
3 | Signed-off-by: Nick Hudson <hnick@vmware.com> | 12 | Thanks to the bug report submitter Cha HyunSoo for identifying |
4 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 13 | both these errors. |
14 | |||
15 | Fixes: 84940ed82552d3c ("target/arm: Add support for FEAT_TLBIRANGE") | ||
16 | Resolves: https://gitlab.com/qemu-project/qemu/-/issues/734 | ||
5 | 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> | ||
20 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
21 | Message-id: 20211130173257.1274194-1-peter.maydell@linaro.org | ||
6 | --- | 22 | --- |
7 | target/arm/helper.c | 16 +++++++++++++--- | 23 | target/arm/helper.c | 6 +++--- |
8 | 1 file changed, 13 insertions(+), 3 deletions(-) | 24 | 1 file changed, 3 insertions(+), 3 deletions(-) |
9 | 25 | ||
10 | 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 |
11 | index XXXXXXX..XXXXXXX 100644 | 27 | index XXXXXXX..XXXXXXX 100644 |
12 | --- a/target/arm/helper.c | 28 | --- a/target/arm/helper.c |
13 | +++ b/target/arm/helper.c | 29 | +++ b/target/arm/helper.c |
14 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo debug_cp_reginfo[] = { | 30 | @@ -XXX,XX +XXX,XX @@ static uint64_t tlbi_aa64_range_get_length(CPUARMState *env, |
15 | .access = PL1_RW, .accessfn = access_tda, | 31 | uint64_t exponent; |
16 | .fieldoffset = offsetof(CPUARMState, cp15.mdscr_el1), | 32 | uint64_t length; |
17 | .resetvalue = 0 }, | 33 | |
18 | - /* MDCCSR_EL0, aka DBGDSCRint. This is a read-only mirror of MDSCR_EL1. | 34 | - num = extract64(value, 39, 4); |
19 | + /* | 35 | + num = extract64(value, 39, 5); |
20 | + * MDCCSR_EL0[30:29] map to EDSCR[30:29]. Simply RAZ as the external | 36 | scale = extract64(value, 44, 2); |
21 | + * Debug Communication Channel is not implemented. | 37 | page_size_granule = extract64(value, 46, 2); |
22 | + */ | 38 | |
23 | + { .name = "MDCCSR_EL0", .state = ARM_CP_STATE_AA64, | 39 | - page_shift = page_size_granule * 2 + 12; |
24 | + .opc0 = 2, .opc1 = 3, .crn = 0, .crm = 1, .opc2 = 0, | 40 | - |
25 | + .access = PL0_R, .accessfn = access_tda, | 41 | if (page_size_granule == 0) { |
26 | + .type = ARM_CP_CONST, .resetvalue = 0 }, | 42 | qemu_log_mask(LOG_GUEST_ERROR, "Invalid page size granule %d\n", |
27 | + /* | 43 | page_size_granule); |
28 | + * DBGDSCRint[15,12,5:2] map to MDSCR_EL1[15,12,5:2]. Map all bits as | 44 | return 0; |
29 | + * it is unlikely a guest will care. | 45 | } |
30 | * We don't implement the configurable EL0 access. | 46 | |
31 | */ | 47 | + page_shift = (page_size_granule - 1) * 2 + 12; |
32 | - { .name = "MDCCSR_EL0", .state = ARM_CP_STATE_BOTH, | 48 | + |
33 | - .cp = 14, .opc0 = 2, .opc1 = 0, .crn = 0, .crm = 1, .opc2 = 0, | 49 | exponent = (5 * scale) + 1; |
34 | + { .name = "DBGDSCRint", .state = ARM_CP_STATE_AA32, | 50 | length = (num + 1) << (exponent + page_shift); |
35 | + .cp = 14, .opc1 = 0, .crn = 0, .crm = 1, .opc2 = 0, | 51 | |
36 | .type = ARM_CP_ALIAS, | ||
37 | .access = PL1_R, .accessfn = access_tda, | ||
38 | .fieldoffset = offsetof(CPUARMState, cp15.mdscr_el1), }, | ||
39 | -- | 52 | -- |
40 | 2.20.1 | 53 | 2.25.1 |
41 | 54 | ||
42 | 55 | diff view generated by jsdifflib |
1 | The PL061 comes out of reset with all its lines configured as input, | 1 | From: Patrick Venture <venture@google.com> |
---|---|---|---|
2 | which means they might need to be pulled to 0 or 1 depending on the | ||
3 | 'pullups' and 'pulldowns' properties. Currently we do not assert | ||
4 | these lines on reset; they will only be set whenever the guest first | ||
5 | touches a register that triggers a call to pl061_update(). | ||
6 | 2 | ||
7 | Convert the device to three-phase reset so we have a place where we | 3 | The rx_active boolean change to true should always trigger a try_read |
8 | can safely call qemu_set_irq() to set the floating lines to their | 4 | call that flushes the queue. |
9 | correct values. | ||
10 | 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 | ||
11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
12 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
13 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
14 | --- | 10 | --- |
15 | hw/gpio/pl061.c | 29 +++++++++++++++++++++++++---- | 11 | hw/net/npcm7xx_emc.c | 18 ++++++++---------- |
16 | hw/gpio/trace-events | 1 + | 12 | 1 file changed, 8 insertions(+), 10 deletions(-) |
17 | 2 files changed, 26 insertions(+), 4 deletions(-) | ||
18 | 13 | ||
19 | diff --git a/hw/gpio/pl061.c b/hw/gpio/pl061.c | 14 | diff --git a/hw/net/npcm7xx_emc.c b/hw/net/npcm7xx_emc.c |
20 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
21 | --- a/hw/gpio/pl061.c | 16 | --- a/hw/net/npcm7xx_emc.c |
22 | +++ b/hw/gpio/pl061.c | 17 | +++ b/hw/net/npcm7xx_emc.c |
23 | @@ -XXX,XX +XXX,XX @@ static void pl061_write(void *opaque, hwaddr offset, | 18 | @@ -XXX,XX +XXX,XX @@ static void emc_halt_rx(NPCM7xxEMCState *emc, uint32_t mista_flag) |
24 | return; | 19 | emc_set_mista(emc, mista_flag); |
25 | } | 20 | } |
26 | 21 | ||
27 | -static void pl061_reset(DeviceState *dev) | 22 | +static void emc_enable_rx_and_flush(NPCM7xxEMCState *emc) |
28 | +static void pl061_enter_reset(Object *obj, ResetType type) | ||
29 | { | ||
30 | - PL061State *s = PL061(dev); | ||
31 | + PL061State *s = PL061(obj); | ||
32 | + | ||
33 | + trace_pl061_reset(DEVICE(s)->canonical_path); | ||
34 | |||
35 | /* reset values from PL061 TRM, Stellaris LM3S5P31 & LM3S8962 Data Sheet */ | ||
36 | s->data = 0; | ||
37 | - s->old_out_data = 0; | ||
38 | s->old_in_data = 0; | ||
39 | s->dir = 0; | ||
40 | s->isense = 0; | ||
41 | @@ -XXX,XX +XXX,XX @@ static void pl061_reset(DeviceState *dev) | ||
42 | s->amsel = 0; | ||
43 | } | ||
44 | |||
45 | +static void pl061_hold_reset(Object *obj) | ||
46 | +{ | 23 | +{ |
47 | + PL061State *s = PL061(obj); | 24 | + emc->rx_active = true; |
48 | + int i, level; | 25 | + qemu_flush_queued_packets(qemu_get_queue(emc->nic)); |
49 | + uint8_t floating = pl061_floating(s); | ||
50 | + uint8_t pullups = pl061_pullups(s); | ||
51 | + | ||
52 | + for (i = 0; i < N_GPIOS; i++) { | ||
53 | + if (extract32(floating, i, 1)) { | ||
54 | + continue; | ||
55 | + } | ||
56 | + level = extract32(pullups, i, 1); | ||
57 | + trace_pl061_set_output(DEVICE(s)->canonical_path, i, level); | ||
58 | + qemu_set_irq(s->out[i], level); | ||
59 | + } | ||
60 | + s->old_out_data = pullups; | ||
61 | +} | 26 | +} |
62 | + | 27 | + |
63 | static void pl061_set_irq(void * opaque, int irq, int level) | 28 | static void emc_set_next_tx_descriptor(NPCM7xxEMCState *emc, |
29 | const NPCM7xxEMCTxDesc *tx_desc, | ||
30 | uint32_t desc_addr) | ||
31 | @@ -XXX,XX +XXX,XX @@ static ssize_t emc_receive(NetClientState *nc, const uint8_t *buf, size_t len1) | ||
32 | return len; | ||
33 | } | ||
34 | |||
35 | -static void emc_try_receive_next_packet(NPCM7xxEMCState *emc) | ||
36 | -{ | ||
37 | - if (emc_can_receive(qemu_get_queue(emc->nic))) { | ||
38 | - qemu_flush_queued_packets(qemu_get_queue(emc->nic)); | ||
39 | - } | ||
40 | -} | ||
41 | - | ||
42 | static uint64_t npcm7xx_emc_read(void *opaque, hwaddr offset, unsigned size) | ||
64 | { | 43 | { |
65 | PL061State *s = (PL061State *)opaque; | 44 | NPCM7xxEMCState *emc = opaque; |
66 | @@ -XXX,XX +XXX,XX @@ static Property pl061_props[] = { | 45 | @@ -XXX,XX +XXX,XX @@ static void npcm7xx_emc_write(void *opaque, hwaddr offset, |
67 | static void pl061_class_init(ObjectClass *klass, void *data) | 46 | emc->regs[REG_MGSTA] |= REG_MGSTA_RXHA; |
68 | { | 47 | } |
69 | DeviceClass *dc = DEVICE_CLASS(klass); | 48 | if (value & REG_MCMDR_RXON) { |
70 | + ResettableClass *rc = RESETTABLE_CLASS(klass); | 49 | - emc->rx_active = true; |
71 | 50 | + emc_enable_rx_and_flush(emc); | |
72 | dc->vmsd = &vmstate_pl061; | 51 | } else { |
73 | - dc->reset = &pl061_reset; | 52 | emc_halt_rx(emc, 0); |
74 | dc->realize = pl061_realize; | 53 | } |
75 | device_class_set_props(dc, pl061_props); | 54 | @@ -XXX,XX +XXX,XX @@ static void npcm7xx_emc_write(void *opaque, hwaddr offset, |
76 | + rc->phases.enter = pl061_enter_reset; | 55 | break; |
77 | + rc->phases.hold = pl061_hold_reset; | 56 | case REG_RSDR: |
78 | } | 57 | if (emc->regs[REG_MCMDR] & REG_MCMDR_RXON) { |
79 | 58 | - emc->rx_active = true; | |
80 | static const TypeInfo pl061_info = { | 59 | - emc_try_receive_next_packet(emc); |
81 | diff --git a/hw/gpio/trace-events b/hw/gpio/trace-events | 60 | + emc_enable_rx_and_flush(emc); |
82 | index XXXXXXX..XXXXXXX 100644 | 61 | } |
83 | --- a/hw/gpio/trace-events | 62 | break; |
84 | +++ b/hw/gpio/trace-events | 63 | case REG_MIIDA: |
85 | @@ -XXX,XX +XXX,XX @@ pl061_input_change(const char *id, int gpio, int level) "%s input %d changed to | ||
86 | pl061_update_istate(const char *id, uint32_t istate, uint32_t im, int level) "%s GPIORIS 0x%x GPIOIE 0x%x interrupt level %d" | ||
87 | pl061_read(const char *id, uint64_t offset, uint64_t r) "%s offset 0x%" PRIx64 " value 0x%" PRIx64 | ||
88 | pl061_write(const char *id, uint64_t offset, uint64_t value) "%s offset 0x%" PRIx64 " value 0x%" PRIx64 | ||
89 | +pl061_reset(const char *id) "%s reset" | ||
90 | |||
91 | # sifive_gpio.c | ||
92 | sifive_gpio_read(uint64_t offset, uint64_t r) "offset 0x%" PRIx64 " value 0x%" PRIx64 | ||
93 | -- | 64 | -- |
94 | 2.20.1 | 65 | 2.25.1 |
95 | 66 | ||
96 | 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 | Add tracepoints for reads and writes to the PL061 registers. This requires | 1 | From: Jean-Philippe Brucker <jean-philippe@linaro.org> |
---|---|---|---|
2 | restructuring pl061_read() to only return after the tracepoint, rather | ||
3 | than having lots of early-returns. | ||
4 | 2 | ||
3 | virtio-iommu is now supported with ACPI VIOT as well as device tree. | ||
4 | Remove the restriction that prevents from instantiating a virtio-iommu | ||
5 | device under ACPI. | ||
6 | |||
7 | Acked-by: Igor Mammedov <imammedo@redhat.com> | ||
8 | Reviewed-by: Eric Auger <eric.auger@redhat.com> | ||
9 | Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org> | ||
10 | Message-id: 20211210170415.583179-3-jean-philippe@linaro.org | ||
5 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 11 | 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 | --- | 12 | --- |
9 | hw/gpio/pl061.c | 70 ++++++++++++++++++++++++++++++-------------- | 13 | hw/arm/virt.c | 10 ++-------- |
10 | hw/gpio/trace-events | 2 ++ | 14 | hw/virtio/virtio-iommu-pci.c | 12 ++---------- |
11 | 2 files changed, 50 insertions(+), 22 deletions(-) | 15 | 2 files changed, 4 insertions(+), 18 deletions(-) |
12 | 16 | ||
13 | diff --git a/hw/gpio/pl061.c b/hw/gpio/pl061.c | 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/hw/gpio/pl061.c | 19 | --- a/hw/arm/virt.c |
16 | +++ b/hw/gpio/pl061.c | 20 | +++ b/hw/arm/virt.c |
17 | @@ -XXX,XX +XXX,XX @@ static uint64_t pl061_read(void *opaque, hwaddr offset, | 21 | @@ -XXX,XX +XXX,XX @@ static HotplugHandler *virt_machine_get_hotplug_handler(MachineState *machine, |
18 | unsigned size) | 22 | MachineClass *mc = MACHINE_GET_CLASS(machine); |
19 | { | 23 | |
20 | PL061State *s = (PL061State *)opaque; | 24 | if (device_is_dynamic_sysbus(mc, dev) || |
21 | + uint64_t r = 0; | 25 | - (object_dynamic_cast(OBJECT(dev), TYPE_PC_DIMM))) { |
22 | 26 | + object_dynamic_cast(OBJECT(dev), TYPE_PC_DIMM) || | |
23 | switch (offset) { | 27 | + object_dynamic_cast(OBJECT(dev), TYPE_VIRTIO_IOMMU_PCI)) { |
24 | case 0x0 ... 0x3ff: /* Data */ | 28 | return HOTPLUG_HANDLER(machine); |
25 | - return s->data & (offset >> 2); | ||
26 | + r = s->data & (offset >> 2); | ||
27 | + break; | ||
28 | case 0x400: /* Direction */ | ||
29 | - return s->dir; | ||
30 | + r = s->dir; | ||
31 | + break; | ||
32 | case 0x404: /* Interrupt sense */ | ||
33 | - return s->isense; | ||
34 | + r = s->isense; | ||
35 | + break; | ||
36 | case 0x408: /* Interrupt both edges */ | ||
37 | - return s->ibe; | ||
38 | + r = s->ibe; | ||
39 | + break; | ||
40 | case 0x40c: /* Interrupt event */ | ||
41 | - return s->iev; | ||
42 | + r = s->iev; | ||
43 | + break; | ||
44 | case 0x410: /* Interrupt mask */ | ||
45 | - return s->im; | ||
46 | + r = s->im; | ||
47 | + break; | ||
48 | case 0x414: /* Raw interrupt status */ | ||
49 | - return s->istate; | ||
50 | + r = s->istate; | ||
51 | + break; | ||
52 | case 0x418: /* Masked interrupt status */ | ||
53 | - return s->istate & s->im; | ||
54 | + r = s->istate & s->im; | ||
55 | + break; | ||
56 | case 0x420: /* Alternate function select */ | ||
57 | - return s->afsel; | ||
58 | + r = s->afsel; | ||
59 | + break; | ||
60 | case 0x500: /* 2mA drive */ | ||
61 | if (s->id != pl061_id_luminary) { | ||
62 | goto bad_offset; | ||
63 | } | ||
64 | - return s->dr2r; | ||
65 | + r = s->dr2r; | ||
66 | + break; | ||
67 | case 0x504: /* 4mA drive */ | ||
68 | if (s->id != pl061_id_luminary) { | ||
69 | goto bad_offset; | ||
70 | } | ||
71 | - return s->dr4r; | ||
72 | + r = s->dr4r; | ||
73 | + break; | ||
74 | case 0x508: /* 8mA drive */ | ||
75 | if (s->id != pl061_id_luminary) { | ||
76 | goto bad_offset; | ||
77 | } | ||
78 | - return s->dr8r; | ||
79 | + r = s->dr8r; | ||
80 | + break; | ||
81 | case 0x50c: /* Open drain */ | ||
82 | if (s->id != pl061_id_luminary) { | ||
83 | goto bad_offset; | ||
84 | } | ||
85 | - return s->odr; | ||
86 | + r = s->odr; | ||
87 | + break; | ||
88 | case 0x510: /* Pull-up */ | ||
89 | if (s->id != pl061_id_luminary) { | ||
90 | goto bad_offset; | ||
91 | } | ||
92 | - return s->pur; | ||
93 | + r = s->pur; | ||
94 | + break; | ||
95 | case 0x514: /* Pull-down */ | ||
96 | if (s->id != pl061_id_luminary) { | ||
97 | goto bad_offset; | ||
98 | } | ||
99 | - return s->pdr; | ||
100 | + r = s->pdr; | ||
101 | + break; | ||
102 | case 0x518: /* Slew rate control */ | ||
103 | if (s->id != pl061_id_luminary) { | ||
104 | goto bad_offset; | ||
105 | } | ||
106 | - return s->slr; | ||
107 | + r = s->slr; | ||
108 | + break; | ||
109 | case 0x51c: /* Digital enable */ | ||
110 | if (s->id != pl061_id_luminary) { | ||
111 | goto bad_offset; | ||
112 | } | ||
113 | - return s->den; | ||
114 | + r = s->den; | ||
115 | + break; | ||
116 | case 0x520: /* Lock */ | ||
117 | if (s->id != pl061_id_luminary) { | ||
118 | goto bad_offset; | ||
119 | } | ||
120 | - return s->locked; | ||
121 | + r = s->locked; | ||
122 | + break; | ||
123 | case 0x524: /* Commit */ | ||
124 | if (s->id != pl061_id_luminary) { | ||
125 | goto bad_offset; | ||
126 | } | ||
127 | - return s->cr; | ||
128 | + r = s->cr; | ||
129 | + break; | ||
130 | case 0x528: /* Analog mode select */ | ||
131 | if (s->id != pl061_id_luminary) { | ||
132 | goto bad_offset; | ||
133 | } | ||
134 | - return s->amsel; | ||
135 | + r = s->amsel; | ||
136 | + break; | ||
137 | case 0xfd0 ... 0xfff: /* ID registers */ | ||
138 | - return s->id[(offset - 0xfd0) >> 2]; | ||
139 | + r = s->id[(offset - 0xfd0) >> 2]; | ||
140 | + break; | ||
141 | default: | ||
142 | bad_offset: | ||
143 | qemu_log_mask(LOG_GUEST_ERROR, | ||
144 | "pl061_read: Bad offset %x\n", (int)offset); | ||
145 | break; | ||
146 | } | 29 | } |
147 | - return 0; | 30 | - if (object_dynamic_cast(OBJECT(dev), TYPE_VIRTIO_IOMMU_PCI)) { |
148 | + | 31 | - VirtMachineState *vms = VIRT_MACHINE(machine); |
149 | + trace_pl061_read(DEVICE(s)->canonical_path, offset, r); | 32 | - |
150 | + return r; | 33 | - if (!vms->bootinfo.firmware_loaded || !virt_is_acpi_enabled(vms)) { |
34 | - return HOTPLUG_HANDLER(machine); | ||
35 | - } | ||
36 | - } | ||
37 | return NULL; | ||
151 | } | 38 | } |
152 | 39 | ||
153 | static void pl061_write(void *opaque, hwaddr offset, | 40 | diff --git a/hw/virtio/virtio-iommu-pci.c b/hw/virtio/virtio-iommu-pci.c |
154 | @@ -XXX,XX +XXX,XX @@ static void pl061_write(void *opaque, hwaddr offset, | ||
155 | PL061State *s = (PL061State *)opaque; | ||
156 | uint8_t mask; | ||
157 | |||
158 | + trace_pl061_write(DEVICE(s)->canonical_path, offset, value); | ||
159 | + | ||
160 | switch (offset) { | ||
161 | case 0 ... 0x3ff: | ||
162 | mask = (offset >> 2) & s->dir; | ||
163 | diff --git a/hw/gpio/trace-events b/hw/gpio/trace-events | ||
164 | index XXXXXXX..XXXXXXX 100644 | 41 | index XXXXXXX..XXXXXXX 100644 |
165 | --- a/hw/gpio/trace-events | 42 | --- a/hw/virtio/virtio-iommu-pci.c |
166 | +++ b/hw/gpio/trace-events | 43 | +++ b/hw/virtio/virtio-iommu-pci.c |
167 | @@ -XXX,XX +XXX,XX @@ pl061_update(const char *id, uint32_t dir, uint32_t data) "%s GPIODIR 0x%x GPIOD | 44 | @@ -XXX,XX +XXX,XX @@ static void virtio_iommu_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp) |
168 | pl061_set_output(const char *id, int gpio, int level) "%s setting output %d to %d" | 45 | VirtIOIOMMU *s = VIRTIO_IOMMU(vdev); |
169 | pl061_input_change(const char *id, int gpio, int level) "%s input %d changed to %d" | 46 | |
170 | pl061_update_istate(const char *id, uint32_t istate, uint32_t im, int level) "%s GPIORIS 0x%x GPIOIE 0x%x interrupt level %d" | 47 | if (!qdev_get_machine_hotplug_handler(DEVICE(vpci_dev))) { |
171 | +pl061_read(const char *id, uint64_t offset, uint64_t r) "%s offset 0x%" PRIx64 " value 0x%" PRIx64 | 48 | - MachineClass *mc = MACHINE_GET_CLASS(qdev_get_machine()); |
172 | +pl061_write(const char *id, uint64_t offset, uint64_t value) "%s offset 0x%" PRIx64 " value 0x%" PRIx64 | 49 | - |
173 | 50 | - error_setg(errp, | |
174 | # sifive_gpio.c | 51 | - "%s machine fails to create iommu-map device tree bindings", |
175 | sifive_gpio_read(uint64_t offset, uint64_t r) "offset 0x%" PRIx64 " value 0x%" PRIx64 | 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++) { | ||
176 | -- | 63 | -- |
177 | 2.20.1 | 64 | 2.25.1 |
178 | 65 | ||
179 | 66 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Jean-Philippe Brucker <jean-philippe@linaro.org> | ||
1 | 2 | ||
3 | We do not support instantiating multiple IOMMUs. Before adding a | ||
4 | virtio-iommu, check that no other IOMMU is present. This will detect | ||
5 | both "iommu=smmuv3" machine parameter and another virtio-iommu instance. | ||
6 | |||
7 | Fixes: 70e89132c9 ("hw/arm/virt: Add the virtio-iommu device tree mappings") | ||
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-4-jean-philippe@linaro.org | ||
12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
13 | --- | ||
14 | hw/arm/virt.c | 5 +++++ | ||
15 | 1 file changed, 5 insertions(+) | ||
16 | |||
17 | diff --git a/hw/arm/virt.c b/hw/arm/virt.c | ||
18 | index XXXXXXX..XXXXXXX 100644 | ||
19 | --- a/hw/arm/virt.c | ||
20 | +++ b/hw/arm/virt.c | ||
21 | @@ -XXX,XX +XXX,XX @@ static void virt_machine_device_pre_plug_cb(HotplugHandler *hotplug_dev, | ||
22 | hwaddr db_start = 0, db_end = 0; | ||
23 | char *resv_prop_str; | ||
24 | |||
25 | + if (vms->iommu != VIRT_IOMMU_NONE) { | ||
26 | + error_setg(errp, "virt machine does not support multiple IOMMUs"); | ||
27 | + return; | ||
28 | + } | ||
29 | + | ||
30 | switch (vms->msi_controller) { | ||
31 | case VIRT_MSI_CTRL_NONE: | ||
32 | return; | ||
33 | -- | ||
34 | 2.25.1 | ||
35 | |||
36 | diff view generated by jsdifflib |
1 | For the virt board we have two PL061 devices -- one for NonSecure which | 1 | From: Jean-Philippe Brucker <jean-philippe@linaro.org> |
---|---|---|---|
2 | is inputs only, and one for Secure which is outputs only. For the former, | ||
3 | we don't care whether its outputs are pulled low or high when the line is | ||
4 | configured as an input, because we don't connect them. For the latter, | ||
5 | we do care, because we wire the lines up to the gpio-pwr device, which | ||
6 | assumes that level 1 means "do the action" and 1 means "do nothing". | ||
7 | For consistency in case we add more outputs in future, configure both | ||
8 | PL061s to pull GPIO lines down to 0. | ||
9 | 2 | ||
10 | Reported-by: Maxim Uvarov <maxim.uvarov@linaro.org> | 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 | ||
11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
12 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
13 | --- | 13 | --- |
14 | hw/arm/virt.c | 3 +++ | 14 | hw/arm/virt.c | 5 +++-- |
15 | 1 file changed, 3 insertions(+) | 15 | 1 file changed, 3 insertions(+), 2 deletions(-) |
16 | 16 | ||
17 | diff --git a/hw/arm/virt.c b/hw/arm/virt.c | 17 | diff --git a/hw/arm/virt.c b/hw/arm/virt.c |
18 | index XXXXXXX..XXXXXXX 100644 | 18 | index XXXXXXX..XXXXXXX 100644 |
19 | --- a/hw/arm/virt.c | 19 | --- a/hw/arm/virt.c |
20 | +++ b/hw/arm/virt.c | 20 | +++ b/hw/arm/virt.c |
21 | @@ -XXX,XX +XXX,XX @@ static void create_gpio_devices(const VirtMachineState *vms, int gpio, | 21 | @@ -XXX,XX +XXX,XX @@ static void virt_machine_device_pre_plug_cb(HotplugHandler *hotplug_dev, |
22 | MachineState *ms = MACHINE(vms); | 22 | db_start, db_end, |
23 | 23 | VIRTIO_IOMMU_RESV_MEM_T_MSI); | |
24 | pl061_dev = qdev_new("pl061"); | 24 | |
25 | + /* Pull lines down to 0 if not driven by the PL061 */ | 25 | - qdev_prop_set_uint32(dev, "len-reserved-regions", 1); |
26 | + qdev_prop_set_uint32(pl061_dev, "pullups", 0); | 26 | - qdev_prop_set_string(dev, "reserved-regions[0]", resv_prop_str); |
27 | + qdev_prop_set_uint32(pl061_dev, "pulldowns", 0xff); | 27 | + object_property_set_uint(OBJECT(dev), "len-reserved-regions", 1, errp); |
28 | s = SYS_BUS_DEVICE(pl061_dev); | 28 | + object_property_set_str(OBJECT(dev), "reserved-regions[0]", |
29 | sysbus_realize_and_unref(s, &error_fatal); | 29 | + resv_prop_str, errp); |
30 | memory_region_add_subregion(mem, base, sysbus_mmio_get_region(s, 0)); | 30 | g_free(resv_prop_str); |
31 | } | ||
32 | } | ||
31 | -- | 33 | -- |
32 | 2.20.1 | 34 | 2.25.1 |
33 | 35 | ||
34 | 36 | diff view generated by jsdifflib |
1 | From: Rebecca Cran <rebecca@nuviainc.com> | 1 | From: Jean-Philippe Brucker <jean-philippe@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Add a space in the message printed when gicr_read*/gicr_write* returns | 3 | Create empty data files and allow updates for the upcoming VIOT tests. |
4 | MEMTX_ERROR in arm_gicv3_redist.c. | ||
5 | 4 | ||
6 | Signed-off-by: Rebecca Cran <rebecca@nuviainc.com> | 5 | Acked-by: Igor Mammedov <imammedo@redhat.com> |
7 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 6 | Reviewed-by: Eric Auger <eric.auger@redhat.com> |
8 | Message-id: 20210706211432.31902-1-rebecca@nuviainc.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 | --- | 10 | --- |
11 | hw/intc/arm_gicv3_redist.c | 4 ++-- | 11 | tests/qtest/bios-tables-test-allowed-diff.h | 3 +++ |
12 | 1 file changed, 2 insertions(+), 2 deletions(-) | 12 | tests/data/acpi/q35/DSDT.viot | 0 |
13 | tests/data/acpi/q35/VIOT.viot | 0 | ||
14 | tests/data/acpi/virt/VIOT | 0 | ||
15 | 4 files changed, 3 insertions(+) | ||
16 | create mode 100644 tests/data/acpi/q35/DSDT.viot | ||
17 | create mode 100644 tests/data/acpi/q35/VIOT.viot | ||
18 | create mode 100644 tests/data/acpi/virt/VIOT | ||
13 | 19 | ||
14 | diff --git a/hw/intc/arm_gicv3_redist.c b/hw/intc/arm_gicv3_redist.c | 20 | diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h |
15 | index XXXXXXX..XXXXXXX 100644 | 21 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/hw/intc/arm_gicv3_redist.c | 22 | --- a/tests/qtest/bios-tables-test-allowed-diff.h |
17 | +++ b/hw/intc/arm_gicv3_redist.c | 23 | +++ b/tests/qtest/bios-tables-test-allowed-diff.h |
18 | @@ -XXX,XX +XXX,XX @@ MemTxResult gicv3_redist_read(void *opaque, hwaddr offset, uint64_t *data, | 24 | @@ -1 +1,4 @@ |
19 | if (r == MEMTX_ERROR) { | 25 | /* List of comma-separated changed AML files to ignore */ |
20 | qemu_log_mask(LOG_GUEST_ERROR, | 26 | +"tests/data/acpi/virt/VIOT", |
21 | "%s: invalid guest read at offset " TARGET_FMT_plx | 27 | +"tests/data/acpi/q35/DSDT.viot", |
22 | - "size %u\n", __func__, offset, size); | 28 | +"tests/data/acpi/q35/VIOT.viot", |
23 | + " size %u\n", __func__, offset, size); | 29 | diff --git a/tests/data/acpi/q35/DSDT.viot b/tests/data/acpi/q35/DSDT.viot |
24 | trace_gicv3_redist_badread(gicv3_redist_affid(cs), offset, | 30 | new file mode 100644 |
25 | size, attrs.secure); | 31 | index XXXXXXX..XXXXXXX |
26 | /* The spec requires that reserved registers are RAZ/WI; | 32 | diff --git a/tests/data/acpi/q35/VIOT.viot b/tests/data/acpi/q35/VIOT.viot |
27 | @@ -XXX,XX +XXX,XX @@ MemTxResult gicv3_redist_write(void *opaque, hwaddr offset, uint64_t data, | 33 | new file mode 100644 |
28 | if (r == MEMTX_ERROR) { | 34 | index XXXXXXX..XXXXXXX |
29 | qemu_log_mask(LOG_GUEST_ERROR, | 35 | diff --git a/tests/data/acpi/virt/VIOT b/tests/data/acpi/virt/VIOT |
30 | "%s: invalid guest write at offset " TARGET_FMT_plx | 36 | new file mode 100644 |
31 | - "size %u\n", __func__, offset, size); | 37 | index XXXXXXX..XXXXXXX |
32 | + " size %u\n", __func__, offset, size); | ||
33 | trace_gicv3_redist_badwrite(gicv3_redist_affid(cs), offset, data, | ||
34 | size, attrs.secure); | ||
35 | /* The spec requires that reserved registers are RAZ/WI; | ||
36 | -- | 38 | -- |
37 | 2.20.1 | 39 | 2.25.1 |
38 | 40 | ||
39 | 41 | diff view generated by jsdifflib |
1 | The Luminary variant of the PL061 has registers GPIOPUR and GPIOPDR | 1 | From: Jean-Philippe Brucker <jean-philippe@linaro.org> |
---|---|---|---|
2 | which lets the guest configure whether the GPIO lines are pull-up, | ||
3 | pull-down, or truly floating. Instead of assuming all lines are pulled | ||
4 | high, honour the PUR and PDR registers. | ||
5 | 2 | ||
6 | For the plain PL061, continue to assume that lines have an external | 3 | Add two test cases for VIOT, one on the q35 machine and the other on |
7 | pull-up resistor, as we did before. | 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. | ||
8 | 7 | ||
9 | The stellaris board actually relies on this behaviour -- the CD line | 8 | Reviewed-by: Eric Auger <eric.auger@redhat.com> |
10 | of the ssd0323 display device is connected to GPIO output C7, and it | 9 | Reviewed-by: Igor Mammedov <imammedo@redhat.com> |
11 | is only because of a different bug which we're about to fix that we | 10 | Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org> |
12 | weren't incorrectly driving this line high on reset and putting the | 11 | Message-id: 20211210170415.583179-7-jean-philippe@linaro.org |
13 | ssd0323 into data mode. | 12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
13 | --- | ||
14 | tests/qtest/bios-tables-test.c | 38 ++++++++++++++++++++++++++++++++++ | ||
15 | 1 file changed, 38 insertions(+) | ||
14 | 16 | ||
15 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 17 | diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c |
16 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
17 | --- | ||
18 | hw/gpio/pl061.c | 58 +++++++++++++++++++++++++++++++++++++++++--- | ||
19 | hw/gpio/trace-events | 2 +- | ||
20 | 2 files changed, 55 insertions(+), 5 deletions(-) | ||
21 | |||
22 | diff --git a/hw/gpio/pl061.c b/hw/gpio/pl061.c | ||
23 | index XXXXXXX..XXXXXXX 100644 | 18 | index XXXXXXX..XXXXXXX 100644 |
24 | --- a/hw/gpio/pl061.c | 19 | --- a/tests/qtest/bios-tables-test.c |
25 | +++ b/hw/gpio/pl061.c | 20 | +++ b/tests/qtest/bios-tables-test.c |
26 | @@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_pl061 = { | 21 | @@ -XXX,XX +XXX,XX @@ static void test_acpi_virt_tcg(void) |
27 | } | 22 | free_test_data(&data); |
28 | }; | 23 | } |
29 | 24 | ||
30 | +static uint8_t pl061_floating(PL061State *s) | 25 | +static void test_acpi_q35_viot(void) |
31 | +{ | 26 | +{ |
27 | + test_data data = { | ||
28 | + .machine = MACHINE_Q35, | ||
29 | + .variant = ".viot", | ||
30 | + }; | ||
31 | + | ||
32 | + /* | 32 | + /* |
33 | + * Return mask of bits which correspond to pins configured as inputs | 33 | + * To keep things interesting, two buses bypass the IOMMU. |
34 | + * and which are floating (neither pulled up to 1 nor down to 0). | 34 | + * VIOT should only describes the other two buses. |
35 | + */ | 35 | + */ |
36 | + uint8_t floating; | 36 | + test_acpi_one("-machine default_bus_bypass_iommu=on " |
37 | + | 37 | + "-device virtio-iommu-pci " |
38 | + if (s->id == pl061_id_luminary) { | 38 | + "-device pxb-pcie,bus_nr=0x10,id=pcie.100,bus=pcie.0 " |
39 | + /* | 39 | + "-device pxb-pcie,bus_nr=0x20,id=pcie.200,bus=pcie.0,bypass_iommu=on " |
40 | + * If both PUR and PDR bits are clear, there is neither a pullup | 40 | + "-device pxb-pcie,bus_nr=0x30,id=pcie.300,bus=pcie.0", |
41 | + * nor a pulldown in place, and the output truly floats. | 41 | + &data); |
42 | + */ | 42 | + free_test_data(&data); |
43 | + floating = ~(s->pur | s->pdr); | ||
44 | + } else { | ||
45 | + /* Assume outputs are pulled high. FIXME: this is board dependent. */ | ||
46 | + floating = 0; | ||
47 | + } | ||
48 | + return floating & ~s->dir; | ||
49 | +} | 43 | +} |
50 | + | 44 | + |
51 | +static uint8_t pl061_pullups(PL061State *s) | 45 | +static void test_acpi_virt_viot(void) |
52 | +{ | 46 | +{ |
53 | + /* | 47 | + test_data data = { |
54 | + * Return mask of bits which correspond to pins configured as inputs | 48 | + .machine = "virt", |
55 | + * and which are pulled up to 1. | 49 | + .uefi_fl1 = "pc-bios/edk2-aarch64-code.fd", |
56 | + */ | 50 | + .uefi_fl2 = "pc-bios/edk2-arm-vars.fd", |
57 | + uint8_t pullups; | 51 | + .cd = "tests/data/uefi-boot-images/bios-tables-test.aarch64.iso.qcow2", |
52 | + .ram_start = 0x40000000ULL, | ||
53 | + .scan_len = 128ULL * 1024 * 1024, | ||
54 | + }; | ||
58 | + | 55 | + |
59 | + if (s->id == pl061_id_luminary) { | 56 | + test_acpi_one("-cpu cortex-a57 " |
60 | + /* | 57 | + "-device virtio-iommu-pci", &data); |
61 | + * The Luminary variant of the PL061 has an extra registers which | 58 | + free_test_data(&data); |
62 | + * the guest can use to configure whether lines should be pullup | ||
63 | + * or pulldown. | ||
64 | + */ | ||
65 | + pullups = s->pur; | ||
66 | + } else { | ||
67 | + /* Assume outputs are pulled high. FIXME: this is board dependent. */ | ||
68 | + pullups = 0xff; | ||
69 | + } | ||
70 | + return pullups & ~s->dir; | ||
71 | +} | 59 | +} |
72 | + | 60 | + |
73 | static void pl061_update(PL061State *s) | 61 | static void test_oem_fields(test_data *data) |
74 | { | 62 | { |
75 | uint8_t changed; | ||
76 | uint8_t mask; | ||
77 | uint8_t out; | ||
78 | int i; | 63 | int i; |
79 | + uint8_t pullups = pl061_pullups(s); | 64 | @@ -XXX,XX +XXX,XX @@ int main(int argc, char *argv[]) |
80 | + uint8_t floating = pl061_floating(s); | 65 | qtest_add_func("acpi/q35/kvm/xapic", test_acpi_q35_kvm_xapic); |
81 | 66 | qtest_add_func("acpi/q35/kvm/dmar", test_acpi_q35_kvm_dmar); | |
82 | - trace_pl061_update(DEVICE(s)->canonical_path, s->dir, s->data); | 67 | } |
83 | + trace_pl061_update(DEVICE(s)->canonical_path, s->dir, s->data, | 68 | + qtest_add_func("acpi/q35/viot", test_acpi_q35_viot); |
84 | + pullups, floating); | 69 | } else if (strcmp(arch, "aarch64") == 0) { |
85 | 70 | if (has_tcg) { | |
86 | - /* Outputs float high. */ | 71 | qtest_add_func("acpi/virt", test_acpi_virt_tcg); |
87 | - /* FIXME: This is board dependent. */ | 72 | @@ -XXX,XX +XXX,XX @@ int main(int argc, char *argv[]) |
88 | - out = (s->data & s->dir) | ~s->dir; | 73 | qtest_add_func("acpi/virt/memhp", test_acpi_virt_tcg_memhp); |
89 | + /* | 74 | qtest_add_func("acpi/virt/pxb", test_acpi_virt_tcg_pxb); |
90 | + * Pins configured as output are driven from the data register; | 75 | qtest_add_func("acpi/virt/oem-fields", test_acpi_oem_fields_virt); |
91 | + * otherwise if they're pulled up they're 1, and if they're floating | 76 | + qtest_add_func("acpi/virt/viot", test_acpi_virt_viot); |
92 | + * then we give them the same value they had previously, so we don't | 77 | } |
93 | + * report any change to the other end. | 78 | } |
94 | + */ | 79 | ret = g_test_run(); |
95 | + out = (s->data & s->dir) | pullups | (s->old_out_data & floating); | ||
96 | changed = s->old_out_data ^ out; | ||
97 | if (changed) { | ||
98 | s->old_out_data = out; | ||
99 | diff --git a/hw/gpio/trace-events b/hw/gpio/trace-events | ||
100 | index XXXXXXX..XXXXXXX 100644 | ||
101 | --- a/hw/gpio/trace-events | ||
102 | +++ b/hw/gpio/trace-events | ||
103 | @@ -XXX,XX +XXX,XX @@ nrf51_gpio_set(int64_t line, int64_t value) "line %" PRIi64 " value %" PRIi64 | ||
104 | nrf51_gpio_update_output_irq(int64_t line, int64_t value) "line %" PRIi64 " value %" PRIi64 | ||
105 | |||
106 | # pl061.c | ||
107 | -pl061_update(const char *id, uint32_t dir, uint32_t data) "%s GPIODIR 0x%x GPIODATA 0x%x" | ||
108 | +pl061_update(const char *id, uint32_t dir, uint32_t data, uint32_t pullups, uint32_t floating) "%s GPIODIR 0x%x GPIODATA 0x%x pullups 0x%x floating 0x%x" | ||
109 | pl061_set_output(const char *id, int gpio, int level) "%s setting output %d to %d" | ||
110 | pl061_input_change(const char *id, int gpio, int level) "%s input %d changed to %d" | ||
111 | pl061_update_istate(const char *id, uint32_t istate, uint32_t im, int level) "%s GPIORIS 0x%x GPIOIE 0x%x interrupt level %d" | ||
112 | -- | 80 | -- |
113 | 2.20.1 | 81 | 2.25.1 |
114 | 82 | ||
115 | 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 | From: Alexandre Iooss <erdnaxe@crans.org> | 1 | From: Jean-Philippe Brucker <jean-philippe@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | New mini-kernel test for STM32VLDISCOVERY USART1. | 3 | The VIOT blob contains the following: |
4 | 4 | ||
5 | Signed-off-by: Alexandre Iooss <erdnaxe@crans.org> | 5 | [000h 0000 4] Signature : "VIOT" [Virtual I/O Translation Table] |
6 | Acked-by: Thomas Huth <thuth@redhat.com> | 6 | [004h 0004 4] Table Length : 00000058 |
7 | Acked-by: Alistair Francis <alistair.francis@wdc.com> | 7 | [008h 0008 1] Revision : 00 |
8 | Message-id: 20210617165647.2575955-5-erdnaxe@crans.org | 8 | [009h 0009 1] Checksum : 66 |
9 | [00Ah 0010 6] Oem ID : "BOCHS " | ||
10 | [010h 0016 8] Oem Table ID : "BXPC " | ||
11 | [018h 0024 4] Oem Revision : 00000001 | ||
12 | [01Ch 0028 4] Asl Compiler ID : "BXPC" | ||
13 | [020h 0032 4] Asl Compiler Revision : 00000001 | ||
14 | |||
15 | [024h 0036 2] Node count : 0002 | ||
16 | [026h 0038 2] Node offset : 0030 | ||
17 | [028h 0040 8] Reserved : 0000000000000000 | ||
18 | |||
19 | [030h 0048 1] Type : 03 [VirtIO-PCI IOMMU] | ||
20 | [031h 0049 1] Reserved : 00 | ||
21 | [032h 0050 2] Length : 0010 | ||
22 | |||
23 | [034h 0052 2] PCI Segment : 0000 | ||
24 | [036h 0054 2] PCI BDF number : 0008 | ||
25 | [038h 0056 8] Reserved : 0000000000000000 | ||
26 | |||
27 | [040h 0064 1] Type : 01 [PCI Range] | ||
28 | [041h 0065 1] Reserved : 00 | ||
29 | [042h 0066 2] Length : 0018 | ||
30 | |||
31 | [044h 0068 4] Endpoint start : 00000000 | ||
32 | [048h 0072 2] PCI Segment start : 0000 | ||
33 | [04Ah 0074 2] PCI Segment end : 0000 | ||
34 | [04Ch 0076 2] PCI BDF start : 0000 | ||
35 | [04Eh 0078 2] PCI BDF end : 00FF | ||
36 | [050h 0080 2] Output node : 0030 | ||
37 | [052h 0082 6] Reserved : 000000000000 | ||
38 | |||
39 | Acked-by: Ani Sinha <ani@anisinha.ca> | ||
40 | Reviewed-by: Eric Auger <eric.auger@redhat.com> | ||
41 | Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org> | ||
42 | Message-id: 20211210170415.583179-9-jean-philippe@linaro.org | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 43 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
10 | --- | 44 | --- |
11 | tests/qtest/boot-serial-test.c | 37 ++++++++++++++++++++++++++++++++++ | 45 | tests/qtest/bios-tables-test-allowed-diff.h | 1 - |
12 | 1 file changed, 37 insertions(+) | 46 | tests/data/acpi/virt/VIOT | Bin 0 -> 88 bytes |
47 | 2 files changed, 1 deletion(-) | ||
13 | 48 | ||
14 | diff --git a/tests/qtest/boot-serial-test.c b/tests/qtest/boot-serial-test.c | 49 | diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h |
15 | index XXXXXXX..XXXXXXX 100644 | 50 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/tests/qtest/boot-serial-test.c | 51 | --- a/tests/qtest/bios-tables-test-allowed-diff.h |
17 | +++ b/tests/qtest/boot-serial-test.c | 52 | +++ b/tests/qtest/bios-tables-test-allowed-diff.h |
18 | @@ -XXX,XX +XXX,XX @@ static const uint8_t kernel_nrf51[] = { | 53 | @@ -1,2 +1 @@ |
19 | 0x1c, 0x25, 0x00, 0x40 /* 0x4000251c = UART TXD */ | 54 | /* List of comma-separated changed AML files to ignore */ |
20 | }; | 55 | -"tests/data/acpi/virt/VIOT", |
21 | 56 | diff --git a/tests/data/acpi/virt/VIOT b/tests/data/acpi/virt/VIOT | |
22 | +static const uint8_t kernel_stm32vldiscovery[] = { | 57 | index XXXXXXX..XXXXXXX 100644 |
23 | + 0x00, 0x00, 0x00, 0x00, /* Stack top address */ | 58 | GIT binary patch |
24 | + 0x1d, 0x00, 0x00, 0x00, /* Reset handler address */ | 59 | literal 88 |
25 | + 0x00, 0x00, 0x00, 0x00, /* NMI */ | 60 | zcmWIZ^bd((0D?3pe`k+i1*eDrX9XZ&1PX!JAexE60Hgv8m>C3sGzXN&z`)2L0cSHX |
26 | + 0x00, 0x00, 0x00, 0x00, /* Hard fault */ | 61 | I{D-Rq0Q5fy0RR91 |
27 | + 0x00, 0x00, 0x00, 0x00, /* Memory management fault */ | 62 | |
28 | + 0x00, 0x00, 0x00, 0x00, /* Bus fault */ | 63 | literal 0 |
29 | + 0x00, 0x00, 0x00, 0x00, /* Usage fault */ | 64 | HcmV?d00001 |
30 | + 0x0b, 0x4b, /* ldr r3, [pc, #44] Get RCC */ | 65 | |
31 | + 0x44, 0xf2, 0x04, 0x02, /* movw r2, #16388 */ | ||
32 | + 0x1a, 0x60, /* str r2, [r3] */ | ||
33 | + 0x0a, 0x4b, /* ldr r3, [pc, #40] Get GPIOA */ | ||
34 | + 0x1a, 0x68, /* ldr r2, [r3] */ | ||
35 | + 0x22, 0xf0, 0xf0, 0x02, /* bic r2, r2, #240 */ | ||
36 | + 0x1a, 0x60, /* str r2, [r3] */ | ||
37 | + 0x1a, 0x68, /* ldr r2, [r3] */ | ||
38 | + 0x42, 0xf0, 0xb0, 0x02, /* orr r2, r2, #176 */ | ||
39 | + 0x1a, 0x60, /* str r2, [r3] */ | ||
40 | + 0x07, 0x4b, /* ldr r3, [pc, #26] Get BAUD */ | ||
41 | + 0x45, 0x22, /* movs r2, #69 */ | ||
42 | + 0x1a, 0x60, /* str r2, [r3] */ | ||
43 | + 0x06, 0x4b, /* ldr r3, [pc, #24] Get ENABLE */ | ||
44 | + 0x42, 0xf2, 0x08, 0x02, /* movw r2, #8200 */ | ||
45 | + 0x1a, 0x60, /* str r2, [r3] */ | ||
46 | + 0x05, 0x4b, /* ldr r3, [pc, #20] Get TXD */ | ||
47 | + 0x54, 0x22, /* movs r2, 'T' */ | ||
48 | + 0x1a, 0x60, /* str r2, [r3] */ | ||
49 | + 0xfe, 0xe7, /* b . */ | ||
50 | + 0x18, 0x10, 0x02, 0x40, /* 0x40021018 = RCC */ | ||
51 | + 0x04, 0x08, 0x01, 0x40, /* 0x40010804 = GPIOA */ | ||
52 | + 0x08, 0x38, 0x01, 0x40, /* 0x40013808 = USART1 BAUD */ | ||
53 | + 0x0c, 0x38, 0x01, 0x40, /* 0x4001380c = USART1 ENABLE */ | ||
54 | + 0x04, 0x38, 0x01, 0x40 /* 0x40013804 = USART1 TXD */ | ||
55 | +}; | ||
56 | + | ||
57 | typedef struct testdef { | ||
58 | const char *arch; /* Target architecture */ | ||
59 | const char *machine; /* Name of the machine */ | ||
60 | @@ -XXX,XX +XXX,XX @@ static testdef_t tests[] = { | ||
61 | { "aarch64", "virt", "-cpu max", "TT", sizeof(kernel_aarch64), | ||
62 | kernel_aarch64 }, | ||
63 | { "arm", "microbit", "", "T", sizeof(kernel_nrf51), kernel_nrf51 }, | ||
64 | + { "arm", "stm32vldiscovery", "", "T", | ||
65 | + sizeof(kernel_stm32vldiscovery), kernel_stm32vldiscovery }, | ||
66 | |||
67 | { NULL } | ||
68 | }; | ||
69 | -- | 66 | -- |
70 | 2.20.1 | 67 | 2.25.1 |
71 | 68 | ||
72 | 69 | diff view generated by jsdifflib |