1
Hi; here's the first target-arm pullreq for the 7.0 cycle.
1
The following changes since commit b11728dc3ae67ddedf34b7a4f318170e7092803c:
2
2
3
thanks
3
Merge tag 'pull-riscv-to-apply-20230224' of github.com:palmer-dabbelt/qemu into staging (2023-02-26 20:14:46 +0000)
4
-- PMM
5
6
The following changes since commit 76b56fdfc9fa43ec6e5986aee33f108c6c6a511e:
7
8
Merge tag 'block-pull-request' of https://gitlab.com/stefanha/qemu into staging (2021-12-14 12:46:18 -0800)
9
4
10
are available in the Git repository at:
5
are available in the Git repository at:
11
6
12
https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20211215
7
https://git.linaro.org/people/pmaydell/qemu-arm.git pull-target-arm-20230227
13
8
14
for you to fetch changes up to aed176558806674d030a8305d989d4e6a5073359:
9
for you to fetch changes up to e844f0c5d0bd2c4d8d3c1622eb2a88586c9c4677:
15
10
16
tests/acpi: add expected blob for VIOT test on virt machine (2021-12-15 10:35:26 +0000)
11
hw: Replace qemu_or_irq typedef by OrIRQState (2023-02-27 13:27:05 +0000)
17
12
18
----------------------------------------------------------------
13
----------------------------------------------------------------
19
target-arm queue:
14
target-arm queue:
20
* ITS: error reporting cleanup
15
* Various code cleanups
21
* aspeed: improve documentation
16
* More refactoring working towards allowing a build
22
* Fix STM32F2XX USART data register readout
17
without CONFIG_TCG
23
* allow emulated GICv3 to be disabled in non-TCG builds
24
* fix exception priority for singlestep, misaligned PC, bp, etc
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
30
18
31
----------------------------------------------------------------
19
----------------------------------------------------------------
32
Alex Bennée (1):
20
Claudio Fontana (2):
33
hw/intc: clean-up error reporting for failed ITS cmd
21
target/arm: move helpers to tcg/
22
target/arm: Move psci.c into the tcg directory
34
23
35
Jean-Philippe Brucker (8):
24
Fabiano Rosas (9):
36
hw/arm/virt-acpi-build: Add VIOT table for virtio-iommu
25
target/arm: Wrap breakpoint/watchpoint updates with tcg_enabled
37
hw/arm/virt: Remove device tree restriction for virtio-iommu
26
target/arm: Wrap TCG-only code in debug_helper.c
38
hw/arm/virt: Reject instantiation of multiple IOMMUs
27
target/arm: move translate modules to tcg/
39
hw/arm/virt: Use object_property_set instead of qdev_prop_set
28
target/arm: Wrap arm_rebuild_hflags calls with tcg_enabled
40
tests/acpi: allow updates of VIOT expected data files
29
target/arm: Move hflags code into the tcg directory
41
tests/acpi: add test case for VIOT
30
target/arm: Move regime_using_lpae_format into internal.h
42
tests/acpi: add expected blobs for VIOT test on q35 machine
31
target/arm: Don't access TCG code when debugging with KVM
43
tests/acpi: add expected blob for VIOT test on virt machine
32
cpu-defs.h: Expose CPUTLBEntryFull to non-TCG code
33
tests/avocado: add machine:none tag to version.py
44
34
45
Joel Stanley (4):
35
Philippe Mathieu-Daudé (13):
46
docs: aspeed: Add new boards
36
hw/gpio/max7310: Simplify max7310_realize()
47
docs: aspeed: Update OpenBMC image URL
37
hw/char/pl011: Un-inline pl011_create()
48
docs: aspeed: Give an example of booting a kernel
38
hw/char/pl011: Open-code pl011_luminary_create()
49
docs: aspeed: ADC is now modelled
39
hw/char/xilinx_uartlite: Expose XILINX_UARTLITE QOM type
40
hw/char/xilinx_uartlite: Open-code xilinx_uartlite_create()
41
hw/char/cmsdk-apb-uart: Open-code cmsdk_apb_uart_create()
42
hw/timer/cmsdk-apb-timer: Remove unused 'qdev-properties.h' header
43
hw/intc/armv7m_nvic: Use QOM cast CPU() macro
44
hw/arm/musicpal: Remove unused dummy MemoryRegion
45
iothread: Remove unused IOThreadClass / IOTHREAD_CLASS
46
hw/irq: Declare QOM macros using OBJECT_DECLARE_SIMPLE_TYPE()
47
hw/or-irq: Declare QOM macros using OBJECT_DECLARE_SIMPLE_TYPE()
48
hw: Replace qemu_or_irq typedef by OrIRQState
50
49
51
Olivier Hériveaux (1):
50
Thomas Huth (1):
52
Fix STM32F2XX USART data register readout
51
include/hw/arm/allwinner-a10.h: Remove superfluous includes from the header
53
52
54
Patrick Venture (1):
53
MAINTAINERS | 1 +
55
hw/net: npcm7xx_emc fix missing queue_flush
54
include/exec/cpu-defs.h | 6 +
55
include/hw/arm/allwinner-a10.h | 2 -
56
include/hw/arm/armsse.h | 6 +-
57
include/hw/arm/bcm2835_peripherals.h | 2 +-
58
include/hw/arm/exynos4210.h | 4 +-
59
include/hw/arm/stm32f205_soc.h | 2 +-
60
include/hw/arm/stm32f405_soc.h | 2 +-
61
include/hw/arm/xlnx-versal.h | 6 +-
62
include/hw/arm/xlnx-zynqmp.h | 2 +-
63
include/hw/char/cmsdk-apb-uart.h | 34 ---
64
include/hw/char/pl011.h | 36 +--
65
include/hw/char/xilinx_uartlite.h | 22 +-
66
include/hw/or-irq.h | 5 +-
67
include/hw/timer/cmsdk-apb-timer.h | 1 -
68
target/arm/internals.h | 23 +-
69
target/arm/{ => tcg}/translate-a64.h | 0
70
target/arm/{ => tcg}/translate.h | 0
71
target/arm/{ => tcg}/vec_internal.h | 0
72
target/arm/{ => tcg}/a32-uncond.decode | 0
73
target/arm/{ => tcg}/a32.decode | 0
74
target/arm/{ => tcg}/m-nocp.decode | 0
75
target/arm/{ => tcg}/mve.decode | 0
76
target/arm/{ => tcg}/neon-dp.decode | 0
77
target/arm/{ => tcg}/neon-ls.decode | 0
78
target/arm/{ => tcg}/neon-shared.decode | 0
79
target/arm/{ => tcg}/sme-fa64.decode | 0
80
target/arm/{ => tcg}/sme.decode | 0
81
target/arm/{ => tcg}/sve.decode | 0
82
target/arm/{ => tcg}/t16.decode | 0
83
target/arm/{ => tcg}/t32.decode | 0
84
target/arm/{ => tcg}/vfp-uncond.decode | 0
85
target/arm/{ => tcg}/vfp.decode | 0
86
hw/arm/allwinner-a10.c | 1 +
87
hw/arm/boot.c | 6 +-
88
hw/arm/exynos4210.c | 4 +-
89
hw/arm/mps2-tz.c | 2 +-
90
hw/arm/mps2.c | 41 ++-
91
hw/arm/musicpal.c | 4 -
92
hw/arm/stellaris.c | 11 +-
93
hw/char/pl011.c | 17 ++
94
hw/char/xilinx_uartlite.c | 4 +-
95
hw/core/irq.c | 9 +-
96
hw/core/or-irq.c | 18 +-
97
hw/gpio/max7310.c | 5 +-
98
hw/intc/armv7m_nvic.c | 26 +-
99
hw/microblaze/petalogix_s3adsp1800_mmu.c | 7 +-
100
hw/pci-host/raven.c | 2 +-
101
iothread.c | 4 -
102
target/arm/arm-powerctl.c | 7 +-
103
target/arm/cpu.c | 9 +-
104
target/arm/debug_helper.c | 490 ++++++++++++++++---------------
105
target/arm/helper.c | 411 +-------------------------
106
target/arm/machine.c | 12 +-
107
target/arm/ptw.c | 4 +
108
target/arm/tcg-stubs.c | 27 ++
109
target/arm/{ => tcg}/crypto_helper.c | 0
110
target/arm/{ => tcg}/helper-a64.c | 0
111
target/arm/tcg/hflags.c | 403 +++++++++++++++++++++++++
112
target/arm/{ => tcg}/iwmmxt_helper.c | 0
113
target/arm/{ => tcg}/m_helper.c | 0
114
target/arm/{ => tcg}/mte_helper.c | 0
115
target/arm/{ => tcg}/mve_helper.c | 0
116
target/arm/{ => tcg}/neon_helper.c | 0
117
target/arm/{ => tcg}/op_helper.c | 0
118
target/arm/{ => tcg}/pauth_helper.c | 0
119
target/arm/{ => tcg}/psci.c | 0
120
target/arm/{ => tcg}/sme_helper.c | 0
121
target/arm/{ => tcg}/sve_helper.c | 0
122
target/arm/{ => tcg}/tlb_helper.c | 18 --
123
target/arm/{ => tcg}/translate-a64.c | 0
124
target/arm/{ => tcg}/translate-m-nocp.c | 0
125
target/arm/{ => tcg}/translate-mve.c | 0
126
target/arm/{ => tcg}/translate-neon.c | 0
127
target/arm/{ => tcg}/translate-sme.c | 0
128
target/arm/{ => tcg}/translate-sve.c | 0
129
target/arm/{ => tcg}/translate-vfp.c | 0
130
target/arm/{ => tcg}/translate.c | 0
131
target/arm/{ => tcg}/vec_helper.c | 0
132
target/arm/meson.build | 46 +--
133
target/arm/tcg/meson.build | 50 ++++
134
tests/avocado/version.py | 1 +
135
82 files changed, 918 insertions(+), 875 deletions(-)
136
rename target/arm/{ => tcg}/translate-a64.h (100%)
137
rename target/arm/{ => tcg}/translate.h (100%)
138
rename target/arm/{ => tcg}/vec_internal.h (100%)
139
rename target/arm/{ => tcg}/a32-uncond.decode (100%)
140
rename target/arm/{ => tcg}/a32.decode (100%)
141
rename target/arm/{ => tcg}/m-nocp.decode (100%)
142
rename target/arm/{ => tcg}/mve.decode (100%)
143
rename target/arm/{ => tcg}/neon-dp.decode (100%)
144
rename target/arm/{ => tcg}/neon-ls.decode (100%)
145
rename target/arm/{ => tcg}/neon-shared.decode (100%)
146
rename target/arm/{ => tcg}/sme-fa64.decode (100%)
147
rename target/arm/{ => tcg}/sme.decode (100%)
148
rename target/arm/{ => tcg}/sve.decode (100%)
149
rename target/arm/{ => tcg}/t16.decode (100%)
150
rename target/arm/{ => tcg}/t32.decode (100%)
151
rename target/arm/{ => tcg}/vfp-uncond.decode (100%)
152
rename target/arm/{ => tcg}/vfp.decode (100%)
153
create mode 100644 target/arm/tcg-stubs.c
154
rename target/arm/{ => tcg}/crypto_helper.c (100%)
155
rename target/arm/{ => tcg}/helper-a64.c (100%)
156
create mode 100644 target/arm/tcg/hflags.c
157
rename target/arm/{ => tcg}/iwmmxt_helper.c (100%)
158
rename target/arm/{ => tcg}/m_helper.c (100%)
159
rename target/arm/{ => tcg}/mte_helper.c (100%)
160
rename target/arm/{ => tcg}/mve_helper.c (100%)
161
rename target/arm/{ => tcg}/neon_helper.c (100%)
162
rename target/arm/{ => tcg}/op_helper.c (100%)
163
rename target/arm/{ => tcg}/pauth_helper.c (100%)
164
rename target/arm/{ => tcg}/psci.c (100%)
165
rename target/arm/{ => tcg}/sme_helper.c (100%)
166
rename target/arm/{ => tcg}/sve_helper.c (100%)
167
rename target/arm/{ => tcg}/tlb_helper.c (94%)
168
rename target/arm/{ => tcg}/translate-a64.c (100%)
169
rename target/arm/{ => tcg}/translate-m-nocp.c (100%)
170
rename target/arm/{ => tcg}/translate-mve.c (100%)
171
rename target/arm/{ => tcg}/translate-neon.c (100%)
172
rename target/arm/{ => tcg}/translate-sme.c (100%)
173
rename target/arm/{ => tcg}/translate-sve.c (100%)
174
rename target/arm/{ => tcg}/translate-vfp.c (100%)
175
rename target/arm/{ => tcg}/translate.c (100%)
176
rename target/arm/{ => tcg}/vec_helper.c (100%)
177
create mode 100644 target/arm/tcg/meson.build
56
178
57
Peter Maydell (6):
58
target/i386: Use assert() to sanity-check b1 in SSE decode
59
include/hw/i386: Don't include qemu-common.h in .h files
60
target/hexagon/cpu.h: don't include qemu-common.h
61
target/rx/cpu.h: Don't include qemu-common.h
62
hw/arm: Don't include qemu-common.h unnecessarily
63
target/arm: Correct calculation of tlb range invalidate length
64
65
Philippe Mathieu-Daudé (2):
66
hw/intc/arm_gicv3: Extract gicv3_set_gicv3state from arm_gicv3_cpuif.c
67
hw/intc/arm_gicv3: Introduce CONFIG_ARM_GIC_TCG Kconfig selector
68
69
Richard Henderson (10):
70
target/arm: Hoist pc_next to a local variable in aarch64_tr_translate_insn
71
target/arm: Hoist pc_next to a local variable in arm_tr_translate_insn
72
target/arm: Hoist pc_next to a local variable in thumb_tr_translate_insn
73
target/arm: Split arm_pre_translate_insn
74
target/arm: Advance pc for arch single-step exception
75
target/arm: Split compute_fsr_fsc out of arm_deliver_fault
76
target/arm: Take an exception if PC is misaligned
77
target/arm: Assert thumb pc is aligned
78
target/arm: Suppress bp for exceptions with more priority
79
tests/tcg: Add arm and aarch64 pc alignment tests
80
81
docs/system/arm/aspeed.rst | 26 ++++++++++++----
82
include/hw/i386/microvm.h | 1 -
83
include/hw/i386/x86.h | 1 -
84
target/arm/helper.h | 1 +
85
target/arm/syndrome.h | 5 +++
86
target/hexagon/cpu.h | 1 -
87
target/rx/cpu.h | 1 -
88
hw/arm/boot.c | 1 -
89
hw/arm/digic_boards.c | 1 -
90
hw/arm/highbank.c | 1 -
91
hw/arm/npcm7xx_boards.c | 1 -
92
hw/arm/sbsa-ref.c | 1 -
93
hw/arm/stm32f405_soc.c | 1 -
94
hw/arm/vexpress.c | 1 -
95
hw/arm/virt-acpi-build.c | 7 +++++
96
hw/arm/virt.c | 21 ++++++-------
97
hw/char/stm32f2xx_usart.c | 3 +-
98
hw/intc/arm_gicv3.c | 2 +-
99
hw/intc/arm_gicv3_cpuif.c | 10 +-----
100
hw/intc/arm_gicv3_cpuif_common.c | 22 +++++++++++++
101
hw/intc/arm_gicv3_its.c | 39 +++++++++++++++--------
102
hw/net/npcm7xx_emc.c | 18 +++++------
103
hw/virtio/virtio-iommu-pci.c | 12 ++------
104
linux-user/aarch64/cpu_loop.c | 46 ++++++++++++++++------------
105
linux-user/hexagon/cpu_loop.c | 1 +
106
target/arm/debug_helper.c | 23 ++++++++++++++
107
target/arm/gdbstub.c | 9 ++++--
108
target/arm/helper.c | 6 ++--
109
target/arm/machine.c | 10 ++++++
110
target/arm/tlb_helper.c | 63 ++++++++++++++++++++++++++++----------
111
target/arm/translate-a64.c | 23 ++++++++++++--
112
target/arm/translate.c | 58 ++++++++++++++++++++++++++---------
113
target/i386/tcg/translate.c | 12 ++------
114
tests/qtest/bios-tables-test.c | 38 +++++++++++++++++++++++
115
tests/tcg/aarch64/pcalign-a64.c | 37 ++++++++++++++++++++++
116
tests/tcg/arm/pcalign-a32.c | 46 ++++++++++++++++++++++++++++
117
hw/arm/Kconfig | 1 +
118
hw/intc/Kconfig | 5 +++
119
hw/intc/meson.build | 11 ++++---
120
tests/data/acpi/q35/DSDT.viot | Bin 0 -> 9398 bytes
121
tests/data/acpi/q35/VIOT.viot | Bin 0 -> 112 bytes
122
tests/data/acpi/virt/VIOT | Bin 0 -> 88 bytes
123
tests/tcg/aarch64/Makefile.target | 4 +--
124
tests/tcg/arm/Makefile.target | 4 +++
125
44 files changed, 429 insertions(+), 145 deletions(-)
126
create mode 100644 hw/intc/arm_gicv3_cpuif_common.c
127
create mode 100644 tests/tcg/aarch64/pcalign-a64.c
128
create mode 100644 tests/tcg/arm/pcalign-a32.c
129
create mode 100644 tests/data/acpi/q35/DSDT.viot
130
create mode 100644 tests/data/acpi/q35/VIOT.viot
131
create mode 100644 tests/data/acpi/virt/VIOT
132
diff view generated by jsdifflib
1
From: Jean-Philippe Brucker <jean-philippe@linaro.org>
1
From: Thomas Huth <thuth@redhat.com>
2
2
3
The VIOT blob contains the following:
3
pci_device.h is not needed at all in allwinner-a10.h, and serial.h
4
is only needed by the corresponding .c file.
4
5
5
[000h 0000 4] Signature : "VIOT" [Virtual I/O Translation Table]
6
Signed-off-by: Thomas Huth <thuth@redhat.com>
6
[004h 0004 4] Table Length : 00000058
7
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
7
[008h 0008 1] Revision : 00
8
Message-id: 20230215152233.210024-1-thuth@redhat.com
8
[009h 0009 1] Checksum : 66
9
[00Ah 0010 6] Oem ID : "BOCHS "
10
[010h 0016 8] Oem Table ID : "BXPC "
11
[018h 0024 4] Oem Revision : 00000001
12
[01Ch 0028 4] Asl Compiler ID : "BXPC"
13
[020h 0032 4] Asl Compiler Revision : 00000001
14
15
[024h 0036 2] Node count : 0002
16
[026h 0038 2] Node offset : 0030
17
[028h 0040 8] Reserved : 0000000000000000
18
19
[030h 0048 1] Type : 03 [VirtIO-PCI IOMMU]
20
[031h 0049 1] Reserved : 00
21
[032h 0050 2] Length : 0010
22
23
[034h 0052 2] PCI Segment : 0000
24
[036h 0054 2] PCI BDF number : 0008
25
[038h 0056 8] Reserved : 0000000000000000
26
27
[040h 0064 1] Type : 01 [PCI Range]
28
[041h 0065 1] Reserved : 00
29
[042h 0066 2] Length : 0018
30
31
[044h 0068 4] Endpoint start : 00000000
32
[048h 0072 2] PCI Segment start : 0000
33
[04Ah 0074 2] PCI Segment end : 0000
34
[04Ch 0076 2] PCI BDF start : 0000
35
[04Eh 0078 2] PCI BDF end : 00FF
36
[050h 0080 2] Output node : 0030
37
[052h 0082 6] Reserved : 000000000000
38
39
Acked-by: Ani Sinha <ani@anisinha.ca>
40
Reviewed-by: Eric Auger <eric.auger@redhat.com>
41
Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
42
Message-id: 20211210170415.583179-9-jean-philippe@linaro.org
43
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
44
---
10
---
45
tests/qtest/bios-tables-test-allowed-diff.h | 1 -
11
include/hw/arm/allwinner-a10.h | 2 --
46
tests/data/acpi/virt/VIOT | Bin 0 -> 88 bytes
12
hw/arm/allwinner-a10.c | 1 +
47
2 files changed, 1 deletion(-)
13
2 files changed, 1 insertion(+), 2 deletions(-)
48
14
49
diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h
15
diff --git a/include/hw/arm/allwinner-a10.h b/include/hw/arm/allwinner-a10.h
50
index XXXXXXX..XXXXXXX 100644
16
index XXXXXXX..XXXXXXX 100644
51
--- a/tests/qtest/bios-tables-test-allowed-diff.h
17
--- a/include/hw/arm/allwinner-a10.h
52
+++ b/tests/qtest/bios-tables-test-allowed-diff.h
18
+++ b/include/hw/arm/allwinner-a10.h
53
@@ -1,2 +1 @@
19
@@ -XXX,XX +XXX,XX @@
54
/* List of comma-separated changed AML files to ignore */
20
#ifndef HW_ARM_ALLWINNER_A10_H
55
-"tests/data/acpi/virt/VIOT",
21
#define HW_ARM_ALLWINNER_A10_H
56
diff --git a/tests/data/acpi/virt/VIOT b/tests/data/acpi/virt/VIOT
22
23
-#include "hw/char/serial.h"
24
#include "hw/arm/boot.h"
25
-#include "hw/pci/pci_device.h"
26
#include "hw/timer/allwinner-a10-pit.h"
27
#include "hw/intc/allwinner-a10-pic.h"
28
#include "hw/net/allwinner_emac.h"
29
diff --git a/hw/arm/allwinner-a10.c b/hw/arm/allwinner-a10.c
57
index XXXXXXX..XXXXXXX 100644
30
index XXXXXXX..XXXXXXX 100644
58
GIT binary patch
31
--- a/hw/arm/allwinner-a10.c
59
literal 88
32
+++ b/hw/arm/allwinner-a10.c
60
zcmWIZ^bd((0D?3pe`k+i1*eDrX9XZ&1PX!JAexE60Hgv8m>C3sGzXN&z`)2L0cSHX
33
@@ -XXX,XX +XXX,XX @@
61
I{D-Rq0Q5fy0RR91
34
#include "qemu/osdep.h"
62
35
#include "qapi/error.h"
63
literal 0
36
#include "qemu/module.h"
64
HcmV?d00001
37
+#include "hw/char/serial.h"
65
38
#include "hw/sysbus.h"
39
#include "hw/arm/allwinner-a10.h"
40
#include "hw/misc/unimp.h"
66
--
41
--
67
2.25.1
42
2.34.1
68
43
69
44
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
From: Fabiano Rosas <farosas@suse.de>
2
2
3
Both single-step and pc alignment faults have priority over
3
This is in preparation for restricting compilation of some parts of
4
breakpoint exceptions.
4
debug_helper.c to TCG only.
5
5
6
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
6
Signed-off-by: Fabiano Rosas <farosas@suse.de>
7
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
7
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
---
9
---
10
target/arm/debug_helper.c | 23 +++++++++++++++++++++++
10
target/arm/cpu.c | 6 ++++--
11
1 file changed, 23 insertions(+)
11
target/arm/debug_helper.c | 16 ++++++++++++----
12
target/arm/machine.c | 7 +++++--
13
3 files changed, 21 insertions(+), 8 deletions(-)
12
14
15
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
16
index XXXXXXX..XXXXXXX 100644
17
--- a/target/arm/cpu.c
18
+++ b/target/arm/cpu.c
19
@@ -XXX,XX +XXX,XX @@ static void arm_cpu_reset_hold(Object *obj)
20
}
21
#endif
22
23
- hw_breakpoint_update_all(cpu);
24
- hw_watchpoint_update_all(cpu);
25
+ if (tcg_enabled()) {
26
+ hw_breakpoint_update_all(cpu);
27
+ hw_watchpoint_update_all(cpu);
28
+ }
29
arm_rebuild_hflags(env);
30
}
31
13
diff --git a/target/arm/debug_helper.c b/target/arm/debug_helper.c
32
diff --git a/target/arm/debug_helper.c b/target/arm/debug_helper.c
14
index XXXXXXX..XXXXXXX 100644
33
index XXXXXXX..XXXXXXX 100644
15
--- a/target/arm/debug_helper.c
34
--- a/target/arm/debug_helper.c
16
+++ b/target/arm/debug_helper.c
35
+++ b/target/arm/debug_helper.c
17
@@ -XXX,XX +XXX,XX @@ bool arm_debug_check_breakpoint(CPUState *cs)
36
@@ -XXX,XX +XXX,XX @@ static void dbgwvr_write(CPUARMState *env, const ARMCPRegInfo *ri,
18
{
37
value &= ~3ULL;
19
ARMCPU *cpu = ARM_CPU(cs);
38
20
CPUARMState *env = &cpu->env;
39
raw_write(env, ri, value);
21
+ target_ulong pc;
40
- hw_watchpoint_update(cpu, i);
22
int n;
41
+ if (tcg_enabled()) {
42
+ hw_watchpoint_update(cpu, i);
43
+ }
44
}
45
46
static void dbgwcr_write(CPUARMState *env, const ARMCPRegInfo *ri,
47
@@ -XXX,XX +XXX,XX @@ static void dbgwcr_write(CPUARMState *env, const ARMCPRegInfo *ri,
48
int i = ri->crm;
49
50
raw_write(env, ri, value);
51
- hw_watchpoint_update(cpu, i);
52
+ if (tcg_enabled()) {
53
+ hw_watchpoint_update(cpu, i);
54
+ }
55
}
56
57
void hw_breakpoint_update(ARMCPU *cpu, int n)
58
@@ -XXX,XX +XXX,XX @@ static void dbgbvr_write(CPUARMState *env, const ARMCPRegInfo *ri,
59
int i = ri->crm;
60
61
raw_write(env, ri, value);
62
- hw_breakpoint_update(cpu, i);
63
+ if (tcg_enabled()) {
64
+ hw_breakpoint_update(cpu, i);
65
+ }
66
}
67
68
static void dbgbcr_write(CPUARMState *env, const ARMCPRegInfo *ri,
69
@@ -XXX,XX +XXX,XX @@ static void dbgbcr_write(CPUARMState *env, const ARMCPRegInfo *ri,
70
value = deposit64(value, 8, 1, extract64(value, 7, 1));
71
72
raw_write(env, ri, value);
73
- hw_breakpoint_update(cpu, i);
74
+ if (tcg_enabled()) {
75
+ hw_breakpoint_update(cpu, i);
76
+ }
77
}
78
79
void define_debug_regs(ARMCPU *cpu)
80
diff --git a/target/arm/machine.c b/target/arm/machine.c
81
index XXXXXXX..XXXXXXX 100644
82
--- a/target/arm/machine.c
83
+++ b/target/arm/machine.c
84
@@ -XXX,XX +XXX,XX @@
85
#include "cpu.h"
86
#include "qemu/error-report.h"
87
#include "sysemu/kvm.h"
88
+#include "sysemu/tcg.h"
89
#include "kvm_arm.h"
90
#include "internals.h"
91
#include "migration/cpu.h"
92
@@ -XXX,XX +XXX,XX @@ static int cpu_post_load(void *opaque, int version_id)
93
return -1;
94
}
95
96
- hw_breakpoint_update_all(cpu);
97
- hw_watchpoint_update_all(cpu);
98
+ if (tcg_enabled()) {
99
+ hw_breakpoint_update_all(cpu);
100
+ hw_watchpoint_update_all(cpu);
101
+ }
23
102
24
/*
103
/*
25
@@ -XXX,XX +XXX,XX @@ bool arm_debug_check_breakpoint(CPUState *cs)
104
* TCG gen_update_fp_context() relies on the invariant that
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
+ }
36
+
37
+ /*
38
+ * PC alignment faults have priority over breakpoint exceptions.
39
+ */
40
+ pc = is_a64(env) ? env->pc : env->regs[15];
41
+ if ((is_a64(env) || !env->thumb) && (pc & 3) != 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;
54
--
105
--
55
2.25.1
106
2.34.1
56
57
diff view generated by jsdifflib
1
From: Jean-Philippe Brucker <jean-philippe@linaro.org>
1
From: Fabiano Rosas <farosas@suse.de>
2
2
3
Add two test cases for VIOT, one on the q35 machine and the other on
3
The next few patches will move helpers under CONFIG_TCG. We'd prefer
4
virt. To test complex topologies the q35 test has two PCIe buses that
4
to keep the debug helpers and debug registers close together, so
5
bypass the IOMMU (and are therefore not described by VIOT), and two
5
rearrange the file a bit to be able to wrap the helpers with a TCG
6
buses that are translated by virtio-iommu.
6
ifdef.
7
7
8
Reviewed-by: Eric Auger <eric.auger@redhat.com>
8
Signed-off-by: Fabiano Rosas <farosas@suse.de>
9
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
9
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
10
Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
11
Message-id: 20211210170415.583179-7-jean-philippe@linaro.org
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
---
11
---
14
tests/qtest/bios-tables-test.c | 38 ++++++++++++++++++++++++++++++++++
12
target/arm/debug_helper.c | 476 +++++++++++++++++++-------------------
15
1 file changed, 38 insertions(+)
13
1 file changed, 239 insertions(+), 237 deletions(-)
16
14
17
diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c
15
diff --git a/target/arm/debug_helper.c b/target/arm/debug_helper.c
18
index XXXXXXX..XXXXXXX 100644
16
index XXXXXXX..XXXXXXX 100644
19
--- a/tests/qtest/bios-tables-test.c
17
--- a/target/arm/debug_helper.c
20
+++ b/tests/qtest/bios-tables-test.c
18
+++ b/target/arm/debug_helper.c
21
@@ -XXX,XX +XXX,XX @@ static void test_acpi_virt_tcg(void)
19
@@ -XXX,XX +XXX,XX @@
22
free_test_data(&data);
20
#include "cpregs.h"
21
#include "exec/exec-all.h"
22
#include "exec/helper-proto.h"
23
+#include "sysemu/tcg.h"
24
25
-
26
+#ifdef CONFIG_TCG
27
/* Return the Exception Level targeted by debug exceptions. */
28
static int arm_debug_target_el(CPUARMState *env)
29
{
30
@@ -XXX,XX +XXX,XX @@ void HELPER(exception_swstep)(CPUARMState *env, uint32_t syndrome)
31
raise_exception_debug(env, EXCP_UDEF, syndrome);
23
}
32
}
24
33
25
+static void test_acpi_q35_viot(void)
34
+void hw_watchpoint_update(ARMCPU *cpu, int n)
26
+{
35
+{
27
+ test_data data = {
36
+ CPUARMState *env = &cpu->env;
28
+ .machine = MACHINE_Q35,
37
+ vaddr len = 0;
29
+ .variant = ".viot",
38
+ vaddr wvr = env->cp15.dbgwvr[n];
30
+ };
39
+ uint64_t wcr = env->cp15.dbgwcr[n];
40
+ int mask;
41
+ int flags = BP_CPU | BP_STOP_BEFORE_ACCESS;
42
+
43
+ if (env->cpu_watchpoint[n]) {
44
+ cpu_watchpoint_remove_by_ref(CPU(cpu), env->cpu_watchpoint[n]);
45
+ env->cpu_watchpoint[n] = NULL;
46
+ }
47
+
48
+ if (!FIELD_EX64(wcr, DBGWCR, E)) {
49
+ /* E bit clear : watchpoint disabled */
50
+ return;
51
+ }
52
+
53
+ switch (FIELD_EX64(wcr, DBGWCR, LSC)) {
54
+ case 0:
55
+ /* LSC 00 is reserved and must behave as if the wp is disabled */
56
+ return;
57
+ case 1:
58
+ flags |= BP_MEM_READ;
59
+ break;
60
+ case 2:
61
+ flags |= BP_MEM_WRITE;
62
+ break;
63
+ case 3:
64
+ flags |= BP_MEM_ACCESS;
65
+ break;
66
+ }
31
+
67
+
32
+ /*
68
+ /*
33
+ * To keep things interesting, two buses bypass the IOMMU.
69
+ * Attempts to use both MASK and BAS fields simultaneously are
34
+ * VIOT should only describes the other two buses.
70
+ * CONSTRAINED UNPREDICTABLE; we opt to ignore BAS in this case,
71
+ * thus generating a watchpoint for every byte in the masked region.
35
+ */
72
+ */
36
+ test_acpi_one("-machine default_bus_bypass_iommu=on "
73
+ mask = FIELD_EX64(wcr, DBGWCR, MASK);
37
+ "-device virtio-iommu-pci "
74
+ if (mask == 1 || mask == 2) {
38
+ "-device pxb-pcie,bus_nr=0x10,id=pcie.100,bus=pcie.0 "
75
+ /*
39
+ "-device pxb-pcie,bus_nr=0x20,id=pcie.200,bus=pcie.0,bypass_iommu=on "
76
+ * Reserved values of MASK; we must act as if the mask value was
40
+ "-device pxb-pcie,bus_nr=0x30,id=pcie.300,bus=pcie.0",
77
+ * some non-reserved value, or as if the watchpoint were disabled.
41
+ &data);
78
+ * We choose the latter.
42
+ free_test_data(&data);
79
+ */
80
+ return;
81
+ } else if (mask) {
82
+ /* Watchpoint covers an aligned area up to 2GB in size */
83
+ len = 1ULL << mask;
84
+ /*
85
+ * If masked bits in WVR are not zero it's CONSTRAINED UNPREDICTABLE
86
+ * whether the watchpoint fires when the unmasked bits match; we opt
87
+ * to generate the exceptions.
88
+ */
89
+ wvr &= ~(len - 1);
90
+ } else {
91
+ /* Watchpoint covers bytes defined by the byte address select bits */
92
+ int bas = FIELD_EX64(wcr, DBGWCR, BAS);
93
+ int basstart;
94
+
95
+ if (extract64(wvr, 2, 1)) {
96
+ /*
97
+ * Deprecated case of an only 4-aligned address. BAS[7:4] are
98
+ * ignored, and BAS[3:0] define which bytes to watch.
99
+ */
100
+ bas &= 0xf;
101
+ }
102
+
103
+ if (bas == 0) {
104
+ /* This must act as if the watchpoint is disabled */
105
+ return;
106
+ }
107
+
108
+ /*
109
+ * The BAS bits are supposed to be programmed to indicate a contiguous
110
+ * range of bytes. Otherwise it is CONSTRAINED UNPREDICTABLE whether
111
+ * we fire for each byte in the word/doubleword addressed by the WVR.
112
+ * We choose to ignore any non-zero bits after the first range of 1s.
113
+ */
114
+ basstart = ctz32(bas);
115
+ len = cto32(bas >> basstart);
116
+ wvr += basstart;
117
+ }
118
+
119
+ cpu_watchpoint_insert(CPU(cpu), wvr, len, flags,
120
+ &env->cpu_watchpoint[n]);
43
+}
121
+}
44
+
122
+
45
+static void test_acpi_virt_viot(void)
123
+void hw_watchpoint_update_all(ARMCPU *cpu)
46
+{
124
+{
47
+ test_data data = {
125
+ int i;
48
+ .machine = "virt",
126
+ CPUARMState *env = &cpu->env;
49
+ .uefi_fl1 = "pc-bios/edk2-aarch64-code.fd",
127
+
50
+ .uefi_fl2 = "pc-bios/edk2-arm-vars.fd",
128
+ /*
51
+ .cd = "tests/data/uefi-boot-images/bios-tables-test.aarch64.iso.qcow2",
129
+ * Completely clear out existing QEMU watchpoints and our array, to
52
+ .ram_start = 0x40000000ULL,
130
+ * avoid possible stale entries following migration load.
53
+ .scan_len = 128ULL * 1024 * 1024,
131
+ */
54
+ };
132
+ cpu_watchpoint_remove_all(CPU(cpu), BP_CPU);
55
+
133
+ memset(env->cpu_watchpoint, 0, sizeof(env->cpu_watchpoint));
56
+ test_acpi_one("-cpu cortex-a57 "
134
+
57
+ "-device virtio-iommu-pci", &data);
135
+ for (i = 0; i < ARRAY_SIZE(cpu->env.cpu_watchpoint); i++) {
58
+ free_test_data(&data);
136
+ hw_watchpoint_update(cpu, i);
137
+ }
59
+}
138
+}
60
+
139
+
61
static void test_oem_fields(test_data *data)
140
+void hw_breakpoint_update(ARMCPU *cpu, int n)
141
+{
142
+ CPUARMState *env = &cpu->env;
143
+ uint64_t bvr = env->cp15.dbgbvr[n];
144
+ uint64_t bcr = env->cp15.dbgbcr[n];
145
+ vaddr addr;
146
+ int bt;
147
+ int flags = BP_CPU;
148
+
149
+ if (env->cpu_breakpoint[n]) {
150
+ cpu_breakpoint_remove_by_ref(CPU(cpu), env->cpu_breakpoint[n]);
151
+ env->cpu_breakpoint[n] = NULL;
152
+ }
153
+
154
+ if (!extract64(bcr, 0, 1)) {
155
+ /* E bit clear : watchpoint disabled */
156
+ return;
157
+ }
158
+
159
+ bt = extract64(bcr, 20, 4);
160
+
161
+ switch (bt) {
162
+ case 4: /* unlinked address mismatch (reserved if AArch64) */
163
+ case 5: /* linked address mismatch (reserved if AArch64) */
164
+ qemu_log_mask(LOG_UNIMP,
165
+ "arm: address mismatch breakpoint types not implemented\n");
166
+ return;
167
+ case 0: /* unlinked address match */
168
+ case 1: /* linked address match */
169
+ {
170
+ /*
171
+ * Bits [1:0] are RES0.
172
+ *
173
+ * It is IMPLEMENTATION DEFINED whether bits [63:49]
174
+ * ([63:53] for FEAT_LVA) are hardwired to a copy of the sign bit
175
+ * of the VA field ([48] or [52] for FEAT_LVA), or whether the
176
+ * value is read as written. It is CONSTRAINED UNPREDICTABLE
177
+ * whether the RESS bits are ignored when comparing an address.
178
+ * Therefore we are allowed to compare the entire register, which
179
+ * lets us avoid considering whether FEAT_LVA is actually enabled.
180
+ *
181
+ * The BAS field is used to allow setting breakpoints on 16-bit
182
+ * wide instructions; it is CONSTRAINED UNPREDICTABLE whether
183
+ * a bp will fire if the addresses covered by the bp and the addresses
184
+ * covered by the insn overlap but the insn doesn't start at the
185
+ * start of the bp address range. We choose to require the insn and
186
+ * the bp to have the same address. The constraints on writing to
187
+ * BAS enforced in dbgbcr_write mean we have only four cases:
188
+ * 0b0000 => no breakpoint
189
+ * 0b0011 => breakpoint on addr
190
+ * 0b1100 => breakpoint on addr + 2
191
+ * 0b1111 => breakpoint on addr
192
+ * See also figure D2-3 in the v8 ARM ARM (DDI0487A.c).
193
+ */
194
+ int bas = extract64(bcr, 5, 4);
195
+ addr = bvr & ~3ULL;
196
+ if (bas == 0) {
197
+ return;
198
+ }
199
+ if (bas == 0xc) {
200
+ addr += 2;
201
+ }
202
+ break;
203
+ }
204
+ case 2: /* unlinked context ID match */
205
+ case 8: /* unlinked VMID match (reserved if no EL2) */
206
+ case 10: /* unlinked context ID and VMID match (reserved if no EL2) */
207
+ qemu_log_mask(LOG_UNIMP,
208
+ "arm: unlinked context breakpoint types not implemented\n");
209
+ return;
210
+ case 9: /* linked VMID match (reserved if no EL2) */
211
+ case 11: /* linked context ID and VMID match (reserved if no EL2) */
212
+ case 3: /* linked context ID match */
213
+ default:
214
+ /*
215
+ * We must generate no events for Linked context matches (unless
216
+ * they are linked to by some other bp/wp, which is handled in
217
+ * updates for the linking bp/wp). We choose to also generate no events
218
+ * for reserved values.
219
+ */
220
+ return;
221
+ }
222
+
223
+ cpu_breakpoint_insert(CPU(cpu), addr, flags, &env->cpu_breakpoint[n]);
224
+}
225
+
226
+void hw_breakpoint_update_all(ARMCPU *cpu)
227
+{
228
+ int i;
229
+ CPUARMState *env = &cpu->env;
230
+
231
+ /*
232
+ * Completely clear out existing QEMU breakpoints and our array, to
233
+ * avoid possible stale entries following migration load.
234
+ */
235
+ cpu_breakpoint_remove_all(CPU(cpu), BP_CPU);
236
+ memset(env->cpu_breakpoint, 0, sizeof(env->cpu_breakpoint));
237
+
238
+ for (i = 0; i < ARRAY_SIZE(cpu->env.cpu_breakpoint); i++) {
239
+ hw_breakpoint_update(cpu, i);
240
+ }
241
+}
242
+
243
+#if !defined(CONFIG_USER_ONLY)
244
+
245
+vaddr arm_adjust_watchpoint_address(CPUState *cs, vaddr addr, int len)
246
+{
247
+ ARMCPU *cpu = ARM_CPU(cs);
248
+ CPUARMState *env = &cpu->env;
249
+
250
+ /*
251
+ * In BE32 system mode, target memory is stored byteswapped (on a
252
+ * little-endian host system), and by the time we reach here (via an
253
+ * opcode helper) the addresses of subword accesses have been adjusted
254
+ * to account for that, which means that watchpoints will not match.
255
+ * Undo the adjustment here.
256
+ */
257
+ if (arm_sctlr_b(env)) {
258
+ if (len == 1) {
259
+ addr ^= 3;
260
+ } else if (len == 2) {
261
+ addr ^= 2;
262
+ }
263
+ }
264
+
265
+ return addr;
266
+}
267
+
268
+#endif /* !CONFIG_USER_ONLY */
269
+#endif /* CONFIG_TCG */
270
+
271
/*
272
* Check for traps to "powerdown debug" registers, which are controlled
273
* by MDCR.TDOSA
274
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo debug_lpae_cp_reginfo[] = {
275
.access = PL0_R, .type = ARM_CP_CONST | ARM_CP_64BIT, .resetvalue = 0 },
276
};
277
278
-void hw_watchpoint_update(ARMCPU *cpu, int n)
279
-{
280
- CPUARMState *env = &cpu->env;
281
- vaddr len = 0;
282
- vaddr wvr = env->cp15.dbgwvr[n];
283
- uint64_t wcr = env->cp15.dbgwcr[n];
284
- int mask;
285
- int flags = BP_CPU | BP_STOP_BEFORE_ACCESS;
286
-
287
- if (env->cpu_watchpoint[n]) {
288
- cpu_watchpoint_remove_by_ref(CPU(cpu), env->cpu_watchpoint[n]);
289
- env->cpu_watchpoint[n] = NULL;
290
- }
291
-
292
- if (!FIELD_EX64(wcr, DBGWCR, E)) {
293
- /* E bit clear : watchpoint disabled */
294
- return;
295
- }
296
-
297
- switch (FIELD_EX64(wcr, DBGWCR, LSC)) {
298
- case 0:
299
- /* LSC 00 is reserved and must behave as if the wp is disabled */
300
- return;
301
- case 1:
302
- flags |= BP_MEM_READ;
303
- break;
304
- case 2:
305
- flags |= BP_MEM_WRITE;
306
- break;
307
- case 3:
308
- flags |= BP_MEM_ACCESS;
309
- break;
310
- }
311
-
312
- /*
313
- * Attempts to use both MASK and BAS fields simultaneously are
314
- * CONSTRAINED UNPREDICTABLE; we opt to ignore BAS in this case,
315
- * thus generating a watchpoint for every byte in the masked region.
316
- */
317
- mask = FIELD_EX64(wcr, DBGWCR, MASK);
318
- if (mask == 1 || mask == 2) {
319
- /*
320
- * Reserved values of MASK; we must act as if the mask value was
321
- * some non-reserved value, or as if the watchpoint were disabled.
322
- * We choose the latter.
323
- */
324
- return;
325
- } else if (mask) {
326
- /* Watchpoint covers an aligned area up to 2GB in size */
327
- len = 1ULL << mask;
328
- /*
329
- * If masked bits in WVR are not zero it's CONSTRAINED UNPREDICTABLE
330
- * whether the watchpoint fires when the unmasked bits match; we opt
331
- * to generate the exceptions.
332
- */
333
- wvr &= ~(len - 1);
334
- } else {
335
- /* Watchpoint covers bytes defined by the byte address select bits */
336
- int bas = FIELD_EX64(wcr, DBGWCR, BAS);
337
- int basstart;
338
-
339
- if (extract64(wvr, 2, 1)) {
340
- /*
341
- * Deprecated case of an only 4-aligned address. BAS[7:4] are
342
- * ignored, and BAS[3:0] define which bytes to watch.
343
- */
344
- bas &= 0xf;
345
- }
346
-
347
- if (bas == 0) {
348
- /* This must act as if the watchpoint is disabled */
349
- return;
350
- }
351
-
352
- /*
353
- * The BAS bits are supposed to be programmed to indicate a contiguous
354
- * range of bytes. Otherwise it is CONSTRAINED UNPREDICTABLE whether
355
- * we fire for each byte in the word/doubleword addressed by the WVR.
356
- * We choose to ignore any non-zero bits after the first range of 1s.
357
- */
358
- basstart = ctz32(bas);
359
- len = cto32(bas >> basstart);
360
- wvr += basstart;
361
- }
362
-
363
- cpu_watchpoint_insert(CPU(cpu), wvr, len, flags,
364
- &env->cpu_watchpoint[n]);
365
-}
366
-
367
-void hw_watchpoint_update_all(ARMCPU *cpu)
368
-{
369
- int i;
370
- CPUARMState *env = &cpu->env;
371
-
372
- /*
373
- * Completely clear out existing QEMU watchpoints and our array, to
374
- * avoid possible stale entries following migration load.
375
- */
376
- cpu_watchpoint_remove_all(CPU(cpu), BP_CPU);
377
- memset(env->cpu_watchpoint, 0, sizeof(env->cpu_watchpoint));
378
-
379
- for (i = 0; i < ARRAY_SIZE(cpu->env.cpu_watchpoint); i++) {
380
- hw_watchpoint_update(cpu, i);
381
- }
382
-}
383
-
384
static void dbgwvr_write(CPUARMState *env, const ARMCPRegInfo *ri,
385
uint64_t value)
62
{
386
{
63
int i;
387
@@ -XXX,XX +XXX,XX @@ static void dbgwcr_write(CPUARMState *env, const ARMCPRegInfo *ri,
64
@@ -XXX,XX +XXX,XX @@ int main(int argc, char *argv[])
65
qtest_add_func("acpi/q35/kvm/xapic", test_acpi_q35_kvm_xapic);
66
qtest_add_func("acpi/q35/kvm/dmar", test_acpi_q35_kvm_dmar);
67
}
68
+ qtest_add_func("acpi/q35/viot", test_acpi_q35_viot);
69
} else if (strcmp(arch, "aarch64") == 0) {
70
if (has_tcg) {
71
qtest_add_func("acpi/virt", test_acpi_virt_tcg);
72
@@ -XXX,XX +XXX,XX @@ int main(int argc, char *argv[])
73
qtest_add_func("acpi/virt/memhp", test_acpi_virt_tcg_memhp);
74
qtest_add_func("acpi/virt/pxb", test_acpi_virt_tcg_pxb);
75
qtest_add_func("acpi/virt/oem-fields", test_acpi_oem_fields_virt);
76
+ qtest_add_func("acpi/virt/viot", test_acpi_virt_viot);
77
}
78
}
388
}
79
ret = g_test_run();
389
}
390
391
-void hw_breakpoint_update(ARMCPU *cpu, int n)
392
-{
393
- CPUARMState *env = &cpu->env;
394
- uint64_t bvr = env->cp15.dbgbvr[n];
395
- uint64_t bcr = env->cp15.dbgbcr[n];
396
- vaddr addr;
397
- int bt;
398
- int flags = BP_CPU;
399
-
400
- if (env->cpu_breakpoint[n]) {
401
- cpu_breakpoint_remove_by_ref(CPU(cpu), env->cpu_breakpoint[n]);
402
- env->cpu_breakpoint[n] = NULL;
403
- }
404
-
405
- if (!extract64(bcr, 0, 1)) {
406
- /* E bit clear : watchpoint disabled */
407
- return;
408
- }
409
-
410
- bt = extract64(bcr, 20, 4);
411
-
412
- switch (bt) {
413
- case 4: /* unlinked address mismatch (reserved if AArch64) */
414
- case 5: /* linked address mismatch (reserved if AArch64) */
415
- qemu_log_mask(LOG_UNIMP,
416
- "arm: address mismatch breakpoint types not implemented\n");
417
- return;
418
- case 0: /* unlinked address match */
419
- case 1: /* linked address match */
420
- {
421
- /*
422
- * Bits [1:0] are RES0.
423
- *
424
- * It is IMPLEMENTATION DEFINED whether bits [63:49]
425
- * ([63:53] for FEAT_LVA) are hardwired to a copy of the sign bit
426
- * of the VA field ([48] or [52] for FEAT_LVA), or whether the
427
- * value is read as written. It is CONSTRAINED UNPREDICTABLE
428
- * whether the RESS bits are ignored when comparing an address.
429
- * Therefore we are allowed to compare the entire register, which
430
- * lets us avoid considering whether FEAT_LVA is actually enabled.
431
- *
432
- * The BAS field is used to allow setting breakpoints on 16-bit
433
- * wide instructions; it is CONSTRAINED UNPREDICTABLE whether
434
- * a bp will fire if the addresses covered by the bp and the addresses
435
- * covered by the insn overlap but the insn doesn't start at the
436
- * start of the bp address range. We choose to require the insn and
437
- * the bp to have the same address. The constraints on writing to
438
- * BAS enforced in dbgbcr_write mean we have only four cases:
439
- * 0b0000 => no breakpoint
440
- * 0b0011 => breakpoint on addr
441
- * 0b1100 => breakpoint on addr + 2
442
- * 0b1111 => breakpoint on addr
443
- * See also figure D2-3 in the v8 ARM ARM (DDI0487A.c).
444
- */
445
- int bas = extract64(bcr, 5, 4);
446
- addr = bvr & ~3ULL;
447
- if (bas == 0) {
448
- return;
449
- }
450
- if (bas == 0xc) {
451
- addr += 2;
452
- }
453
- break;
454
- }
455
- case 2: /* unlinked context ID match */
456
- case 8: /* unlinked VMID match (reserved if no EL2) */
457
- case 10: /* unlinked context ID and VMID match (reserved if no EL2) */
458
- qemu_log_mask(LOG_UNIMP,
459
- "arm: unlinked context breakpoint types not implemented\n");
460
- return;
461
- case 9: /* linked VMID match (reserved if no EL2) */
462
- case 11: /* linked context ID and VMID match (reserved if no EL2) */
463
- case 3: /* linked context ID match */
464
- default:
465
- /*
466
- * We must generate no events for Linked context matches (unless
467
- * they are linked to by some other bp/wp, which is handled in
468
- * updates for the linking bp/wp). We choose to also generate no events
469
- * for reserved values.
470
- */
471
- return;
472
- }
473
-
474
- cpu_breakpoint_insert(CPU(cpu), addr, flags, &env->cpu_breakpoint[n]);
475
-}
476
-
477
-void hw_breakpoint_update_all(ARMCPU *cpu)
478
-{
479
- int i;
480
- CPUARMState *env = &cpu->env;
481
-
482
- /*
483
- * Completely clear out existing QEMU breakpoints and our array, to
484
- * avoid possible stale entries following migration load.
485
- */
486
- cpu_breakpoint_remove_all(CPU(cpu), BP_CPU);
487
- memset(env->cpu_breakpoint, 0, sizeof(env->cpu_breakpoint));
488
-
489
- for (i = 0; i < ARRAY_SIZE(cpu->env.cpu_breakpoint); i++) {
490
- hw_breakpoint_update(cpu, i);
491
- }
492
-}
493
-
494
static void dbgbvr_write(CPUARMState *env, const ARMCPRegInfo *ri,
495
uint64_t value)
496
{
497
@@ -XXX,XX +XXX,XX @@ void define_debug_regs(ARMCPU *cpu)
498
g_free(dbgwcr_el1_name);
499
}
500
}
501
-
502
-#if !defined(CONFIG_USER_ONLY)
503
-
504
-vaddr arm_adjust_watchpoint_address(CPUState *cs, vaddr addr, int len)
505
-{
506
- ARMCPU *cpu = ARM_CPU(cs);
507
- CPUARMState *env = &cpu->env;
508
-
509
- /*
510
- * In BE32 system mode, target memory is stored byteswapped (on a
511
- * little-endian host system), and by the time we reach here (via an
512
- * opcode helper) the addresses of subword accesses have been adjusted
513
- * to account for that, which means that watchpoints will not match.
514
- * Undo the adjustment here.
515
- */
516
- if (arm_sctlr_b(env)) {
517
- if (len == 1) {
518
- addr ^= 3;
519
- } else if (len == 2) {
520
- addr ^= 2;
521
- }
522
- }
523
-
524
- return addr;
525
-}
526
-
527
-#endif
80
--
528
--
81
2.25.1
529
2.34.1
82
83
diff view generated by jsdifflib
1
From: Jean-Philippe Brucker <jean-philippe@linaro.org>
1
From: Fabiano Rosas <farosas@suse.de>
2
2
3
Add expected blobs of the VIOT and DSDT table for the VIOT test on the
3
Introduce the target/arm/tcg directory. Its purpose is to hold the TCG
4
q35 machine.
4
code that is selected by CONFIG_TCG.
5
5
6
Since the test instantiates a virtio device and two PCIe expander
6
Signed-off-by: Claudio Fontana <cfontana@suse.de>
7
bridges, DSDT.viot has more blocks than the base DSDT.
7
Signed-off-by: Fabiano Rosas <farosas@suse.de>
8
8
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
9
The VIOT table generated for the q35 test is:
9
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
10
10
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
11
[000h 0000 4] Signature : "VIOT" [Virtual I/O Translation Table]
11
Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org>
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>
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
460
---
13
---
461
tests/qtest/bios-tables-test-allowed-diff.h | 2 --
14
MAINTAINERS | 1 +
462
tests/data/acpi/q35/DSDT.viot | Bin 0 -> 9398 bytes
15
target/arm/{ => tcg}/translate-a64.h | 0
463
tests/data/acpi/q35/VIOT.viot | Bin 0 -> 112 bytes
16
target/arm/{ => tcg}/translate.h | 0
464
3 files changed, 2 deletions(-)
17
target/arm/{ => tcg}/a32-uncond.decode | 0
465
18
target/arm/{ => tcg}/a32.decode | 0
466
diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h
19
target/arm/{ => tcg}/m-nocp.decode | 0
20
target/arm/{ => tcg}/mve.decode | 0
21
target/arm/{ => tcg}/neon-dp.decode | 0
22
target/arm/{ => tcg}/neon-ls.decode | 0
23
target/arm/{ => tcg}/neon-shared.decode | 0
24
target/arm/{ => tcg}/sme-fa64.decode | 0
25
target/arm/{ => tcg}/sme.decode | 0
26
target/arm/{ => tcg}/sve.decode | 0
27
target/arm/{ => tcg}/t16.decode | 0
28
target/arm/{ => tcg}/t32.decode | 0
29
target/arm/{ => tcg}/vfp-uncond.decode | 0
30
target/arm/{ => tcg}/vfp.decode | 0
31
target/arm/{ => tcg}/translate-a64.c | 0
32
target/arm/{ => tcg}/translate-m-nocp.c | 0
33
target/arm/{ => tcg}/translate-mve.c | 0
34
target/arm/{ => tcg}/translate-neon.c | 0
35
target/arm/{ => tcg}/translate-sme.c | 0
36
target/arm/{ => tcg}/translate-sve.c | 0
37
target/arm/{ => tcg}/translate-vfp.c | 0
38
target/arm/{ => tcg}/translate.c | 0
39
target/arm/meson.build | 30 +++---------------
40
target/arm/{ => tcg}/meson.build | 41 +------------------------
41
27 files changed, 6 insertions(+), 66 deletions(-)
42
rename target/arm/{ => tcg}/translate-a64.h (100%)
43
rename target/arm/{ => tcg}/translate.h (100%)
44
rename target/arm/{ => tcg}/a32-uncond.decode (100%)
45
rename target/arm/{ => tcg}/a32.decode (100%)
46
rename target/arm/{ => tcg}/m-nocp.decode (100%)
47
rename target/arm/{ => tcg}/mve.decode (100%)
48
rename target/arm/{ => tcg}/neon-dp.decode (100%)
49
rename target/arm/{ => tcg}/neon-ls.decode (100%)
50
rename target/arm/{ => tcg}/neon-shared.decode (100%)
51
rename target/arm/{ => tcg}/sme-fa64.decode (100%)
52
rename target/arm/{ => tcg}/sme.decode (100%)
53
rename target/arm/{ => tcg}/sve.decode (100%)
54
rename target/arm/{ => tcg}/t16.decode (100%)
55
rename target/arm/{ => tcg}/t32.decode (100%)
56
rename target/arm/{ => tcg}/vfp-uncond.decode (100%)
57
rename target/arm/{ => tcg}/vfp.decode (100%)
58
rename target/arm/{ => tcg}/translate-a64.c (100%)
59
rename target/arm/{ => tcg}/translate-m-nocp.c (100%)
60
rename target/arm/{ => tcg}/translate-mve.c (100%)
61
rename target/arm/{ => tcg}/translate-neon.c (100%)
62
rename target/arm/{ => tcg}/translate-sme.c (100%)
63
rename target/arm/{ => tcg}/translate-sve.c (100%)
64
rename target/arm/{ => tcg}/translate-vfp.c (100%)
65
rename target/arm/{ => tcg}/translate.c (100%)
66
copy target/arm/{ => tcg}/meson.build (64%)
67
68
diff --git a/MAINTAINERS b/MAINTAINERS
467
index XXXXXXX..XXXXXXX 100644
69
index XXXXXXX..XXXXXXX 100644
468
--- a/tests/qtest/bios-tables-test-allowed-diff.h
70
--- a/MAINTAINERS
469
+++ b/tests/qtest/bios-tables-test-allowed-diff.h
71
+++ b/MAINTAINERS
72
@@ -XXX,XX +XXX,XX @@ M: Peter Maydell <peter.maydell@linaro.org>
73
L: qemu-arm@nongnu.org
74
S: Maintained
75
F: target/arm/
76
+F: target/arm/tcg/
77
F: tests/tcg/arm/
78
F: tests/tcg/aarch64/
79
F: tests/qtest/arm-cpu-features.c
80
diff --git a/target/arm/translate-a64.h b/target/arm/tcg/translate-a64.h
81
similarity index 100%
82
rename from target/arm/translate-a64.h
83
rename to target/arm/tcg/translate-a64.h
84
diff --git a/target/arm/translate.h b/target/arm/tcg/translate.h
85
similarity index 100%
86
rename from target/arm/translate.h
87
rename to target/arm/tcg/translate.h
88
diff --git a/target/arm/a32-uncond.decode b/target/arm/tcg/a32-uncond.decode
89
similarity index 100%
90
rename from target/arm/a32-uncond.decode
91
rename to target/arm/tcg/a32-uncond.decode
92
diff --git a/target/arm/a32.decode b/target/arm/tcg/a32.decode
93
similarity index 100%
94
rename from target/arm/a32.decode
95
rename to target/arm/tcg/a32.decode
96
diff --git a/target/arm/m-nocp.decode b/target/arm/tcg/m-nocp.decode
97
similarity index 100%
98
rename from target/arm/m-nocp.decode
99
rename to target/arm/tcg/m-nocp.decode
100
diff --git a/target/arm/mve.decode b/target/arm/tcg/mve.decode
101
similarity index 100%
102
rename from target/arm/mve.decode
103
rename to target/arm/tcg/mve.decode
104
diff --git a/target/arm/neon-dp.decode b/target/arm/tcg/neon-dp.decode
105
similarity index 100%
106
rename from target/arm/neon-dp.decode
107
rename to target/arm/tcg/neon-dp.decode
108
diff --git a/target/arm/neon-ls.decode b/target/arm/tcg/neon-ls.decode
109
similarity index 100%
110
rename from target/arm/neon-ls.decode
111
rename to target/arm/tcg/neon-ls.decode
112
diff --git a/target/arm/neon-shared.decode b/target/arm/tcg/neon-shared.decode
113
similarity index 100%
114
rename from target/arm/neon-shared.decode
115
rename to target/arm/tcg/neon-shared.decode
116
diff --git a/target/arm/sme-fa64.decode b/target/arm/tcg/sme-fa64.decode
117
similarity index 100%
118
rename from target/arm/sme-fa64.decode
119
rename to target/arm/tcg/sme-fa64.decode
120
diff --git a/target/arm/sme.decode b/target/arm/tcg/sme.decode
121
similarity index 100%
122
rename from target/arm/sme.decode
123
rename to target/arm/tcg/sme.decode
124
diff --git a/target/arm/sve.decode b/target/arm/tcg/sve.decode
125
similarity index 100%
126
rename from target/arm/sve.decode
127
rename to target/arm/tcg/sve.decode
128
diff --git a/target/arm/t16.decode b/target/arm/tcg/t16.decode
129
similarity index 100%
130
rename from target/arm/t16.decode
131
rename to target/arm/tcg/t16.decode
132
diff --git a/target/arm/t32.decode b/target/arm/tcg/t32.decode
133
similarity index 100%
134
rename from target/arm/t32.decode
135
rename to target/arm/tcg/t32.decode
136
diff --git a/target/arm/vfp-uncond.decode b/target/arm/tcg/vfp-uncond.decode
137
similarity index 100%
138
rename from target/arm/vfp-uncond.decode
139
rename to target/arm/tcg/vfp-uncond.decode
140
diff --git a/target/arm/vfp.decode b/target/arm/tcg/vfp.decode
141
similarity index 100%
142
rename from target/arm/vfp.decode
143
rename to target/arm/tcg/vfp.decode
144
diff --git a/target/arm/translate-a64.c b/target/arm/tcg/translate-a64.c
145
similarity index 100%
146
rename from target/arm/translate-a64.c
147
rename to target/arm/tcg/translate-a64.c
148
diff --git a/target/arm/translate-m-nocp.c b/target/arm/tcg/translate-m-nocp.c
149
similarity index 100%
150
rename from target/arm/translate-m-nocp.c
151
rename to target/arm/tcg/translate-m-nocp.c
152
diff --git a/target/arm/translate-mve.c b/target/arm/tcg/translate-mve.c
153
similarity index 100%
154
rename from target/arm/translate-mve.c
155
rename to target/arm/tcg/translate-mve.c
156
diff --git a/target/arm/translate-neon.c b/target/arm/tcg/translate-neon.c
157
similarity index 100%
158
rename from target/arm/translate-neon.c
159
rename to target/arm/tcg/translate-neon.c
160
diff --git a/target/arm/translate-sme.c b/target/arm/tcg/translate-sme.c
161
similarity index 100%
162
rename from target/arm/translate-sme.c
163
rename to target/arm/tcg/translate-sme.c
164
diff --git a/target/arm/translate-sve.c b/target/arm/tcg/translate-sve.c
165
similarity index 100%
166
rename from target/arm/translate-sve.c
167
rename to target/arm/tcg/translate-sve.c
168
diff --git a/target/arm/translate-vfp.c b/target/arm/tcg/translate-vfp.c
169
similarity index 100%
170
rename from target/arm/translate-vfp.c
171
rename to target/arm/tcg/translate-vfp.c
172
diff --git a/target/arm/translate.c b/target/arm/tcg/translate.c
173
similarity index 100%
174
rename from target/arm/translate.c
175
rename to target/arm/tcg/translate.c
176
diff --git a/target/arm/meson.build b/target/arm/meson.build
177
index XXXXXXX..XXXXXXX 100644
178
--- a/target/arm/meson.build
179
+++ b/target/arm/meson.build
470
@@ -XXX,XX +XXX,XX @@
180
@@ -XXX,XX +XXX,XX @@
471
/* List of comma-separated changed AML files to ignore */
181
-gen = [
472
"tests/data/acpi/virt/VIOT",
182
- decodetree.process('sve.decode', extra_args: '--decode=disas_sve'),
473
-"tests/data/acpi/q35/DSDT.viot",
183
- decodetree.process('sme.decode', extra_args: '--decode=disas_sme'),
474
-"tests/data/acpi/q35/VIOT.viot",
184
- decodetree.process('sme-fa64.decode', extra_args: '--static-decode=disas_sme_fa64'),
475
diff --git a/tests/data/acpi/q35/DSDT.viot b/tests/data/acpi/q35/DSDT.viot
185
- decodetree.process('neon-shared.decode', extra_args: '--decode=disas_neon_shared'),
186
- decodetree.process('neon-dp.decode', extra_args: '--decode=disas_neon_dp'),
187
- decodetree.process('neon-ls.decode', extra_args: '--decode=disas_neon_ls'),
188
- decodetree.process('vfp.decode', extra_args: '--decode=disas_vfp'),
189
- decodetree.process('vfp-uncond.decode', extra_args: '--decode=disas_vfp_uncond'),
190
- decodetree.process('m-nocp.decode', extra_args: '--decode=disas_m_nocp'),
191
- decodetree.process('mve.decode', extra_args: '--decode=disas_mve'),
192
- decodetree.process('a32.decode', extra_args: '--static-decode=disas_a32'),
193
- decodetree.process('a32-uncond.decode', extra_args: '--static-decode=disas_a32_uncond'),
194
- decodetree.process('t32.decode', extra_args: '--static-decode=disas_t32'),
195
- decodetree.process('t16.decode', extra_args: ['-w', '16', '--static-decode=disas_t16']),
196
-]
197
-
198
arm_ss = ss.source_set()
199
-arm_ss.add(gen)
200
arm_ss.add(files(
201
'cpu.c',
202
'crypto_helper.c',
203
@@ -XXX,XX +XXX,XX @@ arm_ss.add(files(
204
'neon_helper.c',
205
'op_helper.c',
206
'tlb_helper.c',
207
- 'translate.c',
208
- 'translate-m-nocp.c',
209
- 'translate-mve.c',
210
- 'translate-neon.c',
211
- 'translate-vfp.c',
212
'vec_helper.c',
213
'vfp_helper.c',
214
'cpu_tcg.c',
215
@@ -XXX,XX +XXX,XX @@ arm_ss.add(when: 'TARGET_AARCH64', if_true: files(
216
'pauth_helper.c',
217
'sve_helper.c',
218
'sme_helper.c',
219
- 'translate-a64.c',
220
- 'translate-sve.c',
221
- 'translate-sme.c',
222
))
223
224
arm_softmmu_ss = ss.source_set()
225
@@ -XXX,XX +XXX,XX @@ arm_softmmu_ss.add(files(
226
227
subdir('hvf')
228
229
+if 'CONFIG_TCG' in config_all
230
+ subdir('tcg')
231
+endif
232
+
233
target_arch += {'arm': arm_ss}
234
target_softmmu_arch += {'arm': arm_softmmu_ss}
235
diff --git a/target/arm/meson.build b/target/arm/tcg/meson.build
236
similarity index 64%
237
copy from target/arm/meson.build
238
copy to target/arm/tcg/meson.build
476
index XXXXXXX..XXXXXXX 100644
239
index XXXXXXX..XXXXXXX 100644
477
GIT binary patch
240
--- a/target/arm/meson.build
478
literal 9398
241
+++ b/target/arm/tcg/meson.build
479
zcmeHNO>7&-8J*>iv|O&FB}G~Oi$yp||57BBoWHhc5OS9yDTx$CQgH$r;8Idr*-4Q_
242
@@ -XXX,XX +XXX,XX @@ gen = [
480
z5(9Az1F`}niVsB-)<KW7p`g9Br(A2Gm-gmc1N78GFS!;)e2V(MnH_0{q<{#yMgn&C
243
decodetree.process('t16.decode', extra_args: ['-w', '16', '--static-decode=disas_t16']),
481
zn|*J-d9yqFhO_H6z19~`FlPL*u<DkZ*}|)JH;X@mF-FI<cPg<fti9tEN*yB^i5czN
244
]
482
zNq&q?!OZ;BE3B7{KWzJ-`Tn~f`9?Qj8~2^N8{Oc8J%57{==w%rS#;nOCp*nTr@iZ1
245
483
zb+?i;JLQUJ=O0?8*>S~D)a>NF1~WVB6^~_B#yhJ`H+JU@=6aXs`?Yv)J2h=N?drcS
246
-arm_ss = ss.source_set()
484
zeLZ*n<<Bm^n}6`jfBx#u8&(W}1?)}iF9o#mZ~E2+zwdn7yK3AbIzKnxpZ>JRPm3~#
247
arm_ss.add(gen)
485
z&ICS{+_OayRW-l=Mtk=~uaS3o8z<_udd|(wqg`&JnVPfCe>BUOO`Su3e>pff_^UW%
248
+
486
z&JE^NO`)=Amg~iqRB1pPscP?(>#ZuY8GHCmlEvD$9g3%4Db~Dfz2SATnddvrR-Oe^
249
arm_ss.add(files(
487
z;s;dJec!hnzi)ri^I6YN9vtkm{^TdUF8h7gX8-<Qe4p)GQ=)AtYx2VcwdLVAEXEjG
250
- 'cpu.c',
488
z^Mj|UHPqkj-LsWuzQem1>F3atdZn=zv3$#RmZzSHN+6-yyU#8cJb=YDilX&sl}vNm
251
- 'crypto_helper.c',
489
znkgAR^O<3kj4if>{ly5fwRfMWuC5=lrlvKPX~i#654Cp}R_d*JS$9laZ$ra6)<ns8
252
- 'debug_helper.c',
490
zFZy28G%xP(nit&F>LDi%G<tIc=TY=gl$jSD&Uv!Yat~XR46h%rI$!}a%!|xG7u8Zn
253
- 'gdbstub.c',
491
zeY8_|n=K>xz_v_W8VX$W-Fg-qFWcT}7MCyz{%%{ia7hZ>Law-k6NOr}VI&_48U=2l
254
- 'helper.c',
492
zwqDKFE8eTwwozDdms#e?x?5a|v>&JF;2_v0L~z5n%BYU^52<*cWuD4|GYUm@1+?))
255
- 'iwmmxt_helper.c',
493
zte^45>Rz)t*<T5V#={r>@t@{%?^i#W{i=HAZ*Dc9y59Va-+#P!jrGs;u38a{fLr`N
256
- 'm_helper.c',
494
zvT@rUu>DljxJ?^&Z?-?vyJn3C>3D=qux{Y*bs5|5n)Qmi$TD^Zdn4GU$ocJS2Hh-<
257
- 'mve_helper.c',
495
z`xPI^^+v0nUVdjMos8k`WGl7hA`{03ju%<lrgAHSpd^DRf-*}_#Ly0mB!LSfVgWcQ
258
- 'neon_helper.c',
496
z&T$@~G9)JI=hz5m0vkrel+Xy{Oh7pkAu-V!j*W7rY(bO}Q$nMH2`FbGB&N)QaV4<4
259
- 'op_helper.c',
497
zo)~9JXiP9=;}NPl<C@MmXG&;XFlFNrsyfFsonxFSp<}vEgsRSQP3O3#b6nSnP}ON_
260
- 'tlb_helper.c',
498
zI!#Tdsp~|j>ckUB>FI=~GokB5sOq#dotCE4(sd$KbtW~PNlj-`*NIToiD#j5J#9^=
261
'translate.c',
499
zt?NXn>YUJYPG~wObe#xQos*i*NloXZt`niEb4t@WrRki~bs|)CI+{*L)9L6s5vn><
262
'translate-m-nocp.c',
500
zn$DD_Go|Z9sOn5>I@6lYw5}7Os&iV?Ij!lO)^#FOb!If38BJ$K*NIToIiu;E(R9w}
263
'translate-mve.c',
501
zIuWWmPiZ<&X*y5oIuWWmF_XaEC!a&Jn$B5WCqh-{X-(&8P3LJ{Cqh-{8P3dyPr@^t
264
'translate-neon.c',
502
zSqL9?X9Uwd3W@23*s~h*tj0X6GZCuHa~kuU#yqDp5vt7d8uPryJg+kms?5hU=3^T3
265
'translate-vfp.c',
503
zF`bD}WnSP+=`t5MQ$FJ_2&Q~+BP6E0f^%BVIW6a$o)e+SX~IDBih-7z6{O~7YTy`&
266
- 'vec_helper.c',
504
zLjy&Cv?7QikV#>n0>>@MV8oK`Gmun34-FKdlm-J8SZSaNlnhir4-FI{S|bfqV8e)V
267
- 'vfp_helper.c',
505
zss<{chX#reE#g=hsKAC%sF6d-Km}BWs!kZFsFpKfpbC@>6rprQGEjt4Ck#|zITHq|
268
- 'cpu_tcg.c',
506
zK*>M_l;<P^MJRQ`Kn0dFVW0|>3{*fllMEE0)CmI>Sk8ojDo`>|0p(0GP=xY&!axO<
269
))
507
zGhv_#lnhirIg<<&q0|Wj6<E%MfhtfkPyyvkGEjt4Ck#|zITHq|K*>M_lrzad5lWpf
270
-arm_ss.add(zlib)
508
zP=V!47^ngz0~JutBm+e#b;3XemNQ|X3X}{~Ksl2P6rt1!0~J`#gn=qhGEf2KOfpb}
271
-
509
zQYQ>lU^x>8szAv=1(Y+%KoLrvFi?TzOc<yFB?A>u&LjgxD0RX>1(q{mpbC@>R6seC
272
-arm_ss.add(when: 'CONFIG_KVM', if_true: files('kvm.c', 'kvm64.c'), if_false: files('kvm-stub.c'))
510
z3>2Z%2?G^a&V+#~P%=;f<xDbAgi<FARA4z12C6{GKn0XD$v_cGoiI>=<xCi;0wn_#
273
511
zP|hR+MJRQ`Kn0dFVW0|>3{*fllMEE0)CmI>Sk8ojDo`>|0p(0GP=rz^3{+q_69%e4
274
arm_ss.add(when: 'TARGET_AARCH64', if_true: files(
512
z$v_2^Gs!>^N}VuJf#pmXr~)Me6;RG314Srx!axxz28u{EP=u<1B2)}iVZuNaCK;&0
275
- 'cpu64.c',
513
zBm-5LFi?dF167!0pbC==RAItE6($T+VUmF=Ofpb~2?JG_Fi?d_2C6X0Kouqo6p_5T
276
- 'gdbstub64.c',
514
zFi=FeV!SiSKoR0H$dH(_Z(*Q_WZ%L-5y`$K14StNmJAdjmWs}HV4<vU_xO+1efmLq
277
- 'helper-a64.c',
515
zZ;W>N_U)fP6Qy6Nw5mbt9Y(#emWSi66=>tq#xoh#Ue=0qyhxi8ZOUe5y0V7VfPUhp
278
- 'mte_helper.c',
516
zwX=;ymc+i5%sg9Ja~lZ&8oAV@mHc>&CHP9v4R(jhtT?un;O4e9#pno)Xkh7OWgK&a
279
- 'pauth_helper.c',
517
zyj=3Iv0OuoK_;5rOr5f(Kb~ZXDBO+V`OWYo#_C08imwChQxnjdd?wZLDou8aj;$SD
280
- 'sve_helper.c',
518
zGDYiA3<$Tu<JnHL(KPOChi#zrR32t83}naR$+ym4P_h?z_5#|cW-nw$XD_sOtE62l
281
- 'sme_helper.c',
519
zrD3@*)NVyiklt0&yF9%+klsBey&I<Y2E<!f(E8TuJte)z(|ZHyy<^gQVfx}=`q&B5
282
'translate-a64.c',
520
z7nSryp1wGczIaUfVwiq$Fn#<4=@*ssi#+|}K>EdF(l3VTOM~ghPLRH&q%ZOGrGfON
283
'translate-sve.c',
521
zW73zx^yR_y<0nX8R??Sw`tm^f@-gYlNFSp|*<gA{q?Zp5Oe-+l#rmyYmKozi9y=P>
284
'translate-sme.c',
522
zVReJU*h=ZuVXiS$ohTbw-O#v9>(yZbGE|)?8(H1ZIKvV!jWa0>vy!3eMA^vdhQ>`s
285
))
523
zuMSg{q3T50$m)j1!HixV<}X9liL#N^4c*tL^y)CF8LCc{jjV3yKAqL8!%SzWI#H%q
286
-
524
z=bSrQ&)%JCRttF5g4Zf`6l?y@>PzD7MA^D>wBlcH6r1ucwJ<p0O%rZ?JzIY3-QdmZ
287
-arm_softmmu_ss = ss.source_set()
525
zzs|n>`a5r3e|z)wcUaqS>nqFQ-8x}eCF4u`OWUxqst-@1rSmUs%WmKP5e0dcb?e2N
288
-arm_softmmu_ss.add(files(
526
z;Z|x*!);VwF|Yuhqs^khqOM!@u*jY!WYldISF(V6`BoNd&6Qfk3>X#SuD^7J>p_D=
289
- 'arch_dump.c',
527
zBPa51y^_n#=cpOt#Zf$ya$Ae9Mfz56n|<i!a=ELS@)%a{^NIH3SDuN<R~sah1km#P
290
- 'arm-powerctl.c',
528
zU@?*f%<rG=4W1wgfi;C?_n|W@%lm$&8YfvNOJodIg&IcIpIJQRHr<+ej11GQ6)&eF
291
- 'machine.c',
529
z2Lam*jIH}#y0>KnY%4JQfOYS$*uU%f#@$U6`N8I3N-lV?5ErFCdv~xDmu2(wexld4
292
- 'monitor.c',
530
z4v^;aVAT2k6GJ^m*FD(Wqc(Qg^)6a<?}h$zLoj}4;PP!+(O{@!a1y-hoAhF_7!z+6
293
- 'psci.c',
531
zslpAmNtYbjHrw-~#SPVk_FUf>-Obg6yV`8o$8_`PyJe_;bY5_EMBfBfWU!Q=*9HsG
294
- 'ptw.c',
532
z%_Cda{@_Krr!oHVhv9+y+T5qR8zZ2aZ>5r!$*|f$^U%yBUYfR&B!+EYy_PwL!BeUi
295
-))
533
zJH^}r3r9Q+B)X@Z)fk=P13w&7x#wBtXTZ)g>WITPg5r&pQc!nmyrmk#S(>>b9xnNr
296
-
534
zx_b#v9Xv-Y><Wb%?S^0Xe&<)bbKl_=Z|3C$tf|F<bYzE*mfHB;uC)`q-?buaBe?l?
297
-subdir('hvf')
535
zcLTpK*k<49Z32`K?|nSBMFqxTK^_IE-li2fEGdK~(ZdoKBl6ab4a;Hler#`xvEXJG
298
-
536
zb?<E%EZExfX>jcOVhS*0rS~RS1dA#xhkv@Nct@#q?LyeKS<$uFec!bw>{@uu$gZ6a
299
-target_arch += {'arm': arm_ss}
537
zyVen1i{1BKd%~`D7|m$;U0a<I*3I7%^N%N%lGYdU_GS!gaR8T$NA@GzFi~z`l7hdl
300
-target_softmmu_arch += {'arm': arm_softmmu_ss}
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
--
301
--
559
2.25.1
302
2.34.1
560
303
561
304
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <philmd@redhat.com>
1
From: Claudio Fontana <cfontana@suse.de>
2
2
3
gicv3_set_gicv3state() is used by arm_gicv3_common.c in
3
Signed-off-by: Claudio Fontana <cfontana@suse.de>
4
arm_gicv3_common_realize(). Since we want to restrict
4
Signed-off-by: Fabiano Rosas <farosas@suse.de>
5
arm_gicv3_cpuif.c to TCG, extract gicv3_set_gicv3state()
5
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
6
to a new file. Add this file to the meson 'specific'
6
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
7
source set, since it needs access to "cpu.h".
7
Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org>
8
9
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
10
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
11
Message-id: 20211115223619.2599282-2-philmd@redhat.com
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
---
9
---
14
hw/intc/arm_gicv3_cpuif.c | 10 +---------
10
target/arm/{ => tcg}/vec_internal.h | 0
15
hw/intc/arm_gicv3_cpuif_common.c | 22 ++++++++++++++++++++++
11
target/arm/tcg-stubs.c | 23 +++++++++++++++++++++++
16
hw/intc/meson.build | 1 +
12
target/arm/{ => tcg}/crypto_helper.c | 0
17
3 files changed, 24 insertions(+), 9 deletions(-)
13
target/arm/{ => tcg}/helper-a64.c | 0
18
create mode 100644 hw/intc/arm_gicv3_cpuif_common.c
14
target/arm/{ => tcg}/iwmmxt_helper.c | 0
19
15
target/arm/{ => tcg}/m_helper.c | 0
20
diff --git a/hw/intc/arm_gicv3_cpuif.c b/hw/intc/arm_gicv3_cpuif.c
16
target/arm/{ => tcg}/mte_helper.c | 0
21
index XXXXXXX..XXXXXXX 100644
17
target/arm/{ => tcg}/mve_helper.c | 0
22
--- a/hw/intc/arm_gicv3_cpuif.c
18
target/arm/{ => tcg}/neon_helper.c | 0
23
+++ b/hw/intc/arm_gicv3_cpuif.c
19
target/arm/{ => tcg}/op_helper.c | 0
24
@@ -XXX,XX +XXX,XX @@
20
target/arm/{ => tcg}/pauth_helper.c | 0
25
/*
21
target/arm/{ => tcg}/sme_helper.c | 0
26
- * ARM Generic Interrupt Controller v3
22
target/arm/{ => tcg}/sve_helper.c | 0
27
+ * ARM Generic Interrupt Controller v3 (emulation)
23
target/arm/{ => tcg}/tlb_helper.c | 0
28
*
24
target/arm/{ => tcg}/vec_helper.c | 0
29
* Copyright (c) 2016 Linaro Limited
25
target/arm/meson.build | 15 ++-------------
30
* Written by Peter Maydell
26
target/arm/tcg/meson.build | 13 +++++++++++++
31
@@ -XXX,XX +XXX,XX @@
27
17 files changed, 38 insertions(+), 13 deletions(-)
32
#include "hw/irq.h"
28
rename target/arm/{ => tcg}/vec_internal.h (100%)
33
#include "cpu.h"
29
create mode 100644 target/arm/tcg-stubs.c
34
30
rename target/arm/{ => tcg}/crypto_helper.c (100%)
35
-void gicv3_set_gicv3state(CPUState *cpu, GICv3CPUState *s)
31
rename target/arm/{ => tcg}/helper-a64.c (100%)
36
-{
32
rename target/arm/{ => tcg}/iwmmxt_helper.c (100%)
37
- ARMCPU *arm_cpu = ARM_CPU(cpu);
33
rename target/arm/{ => tcg}/m_helper.c (100%)
38
- CPUARMState *env = &arm_cpu->env;
34
rename target/arm/{ => tcg}/mte_helper.c (100%)
39
-
35
rename target/arm/{ => tcg}/mve_helper.c (100%)
40
- env->gicv3state = (void *)s;
36
rename target/arm/{ => tcg}/neon_helper.c (100%)
41
-};
37
rename target/arm/{ => tcg}/op_helper.c (100%)
42
-
38
rename target/arm/{ => tcg}/pauth_helper.c (100%)
43
static GICv3CPUState *icc_cs_from_env(CPUARMState *env)
39
rename target/arm/{ => tcg}/sme_helper.c (100%)
44
{
40
rename target/arm/{ => tcg}/sve_helper.c (100%)
45
return env->gicv3state;
41
rename target/arm/{ => tcg}/tlb_helper.c (100%)
46
diff --git a/hw/intc/arm_gicv3_cpuif_common.c b/hw/intc/arm_gicv3_cpuif_common.c
42
rename target/arm/{ => tcg}/vec_helper.c (100%)
43
44
diff --git a/target/arm/vec_internal.h b/target/arm/tcg/vec_internal.h
45
similarity index 100%
46
rename from target/arm/vec_internal.h
47
rename to target/arm/tcg/vec_internal.h
48
diff --git a/target/arm/tcg-stubs.c b/target/arm/tcg-stubs.c
47
new file mode 100644
49
new file mode 100644
48
index XXXXXXX..XXXXXXX
50
index XXXXXXX..XXXXXXX
49
--- /dev/null
51
--- /dev/null
50
+++ b/hw/intc/arm_gicv3_cpuif_common.c
52
+++ b/target/arm/tcg-stubs.c
51
@@ -XXX,XX +XXX,XX @@
53
@@ -XXX,XX +XXX,XX @@
52
+/* SPDX-License-Identifier: GPL-2.0-or-later */
53
+/*
54
+/*
54
+ * ARM Generic Interrupt Controller v3
55
+ * QEMU ARM stubs for some TCG helper functions
55
+ *
56
+ *
56
+ * Copyright (c) 2016 Linaro Limited
57
+ * Copyright 2021 SUSE LLC
57
+ * Written by Peter Maydell
58
+ *
58
+ *
59
+ * This code is licensed under the GPL, version 2 or (at your option)
59
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
60
+ * any later version.
60
+ * See the COPYING file in the top-level directory.
61
+ */
61
+ */
62
+
62
+
63
+#include "qemu/osdep.h"
63
+#include "qemu/osdep.h"
64
+#include "gicv3_internal.h"
65
+#include "cpu.h"
64
+#include "cpu.h"
65
+#include "internals.h"
66
+
66
+
67
+void gicv3_set_gicv3state(CPUState *cpu, GICv3CPUState *s)
67
+void write_v7m_exception(CPUARMState *env, uint32_t new_exc)
68
+{
68
+{
69
+ ARMCPU *arm_cpu = ARM_CPU(cpu);
69
+ g_assert_not_reached();
70
+ CPUARMState *env = &arm_cpu->env;
70
+}
71
+
71
+
72
+ env->gicv3state = (void *)s;
72
+void raise_exception_ra(CPUARMState *env, uint32_t excp, uint32_t syndrome,
73
+};
73
+ uint32_t target_el, uintptr_t ra)
74
diff --git a/hw/intc/meson.build b/hw/intc/meson.build
74
+{
75
+ g_assert_not_reached();
76
+}
77
diff --git a/target/arm/crypto_helper.c b/target/arm/tcg/crypto_helper.c
78
similarity index 100%
79
rename from target/arm/crypto_helper.c
80
rename to target/arm/tcg/crypto_helper.c
81
diff --git a/target/arm/helper-a64.c b/target/arm/tcg/helper-a64.c
82
similarity index 100%
83
rename from target/arm/helper-a64.c
84
rename to target/arm/tcg/helper-a64.c
85
diff --git a/target/arm/iwmmxt_helper.c b/target/arm/tcg/iwmmxt_helper.c
86
similarity index 100%
87
rename from target/arm/iwmmxt_helper.c
88
rename to target/arm/tcg/iwmmxt_helper.c
89
diff --git a/target/arm/m_helper.c b/target/arm/tcg/m_helper.c
90
similarity index 100%
91
rename from target/arm/m_helper.c
92
rename to target/arm/tcg/m_helper.c
93
diff --git a/target/arm/mte_helper.c b/target/arm/tcg/mte_helper.c
94
similarity index 100%
95
rename from target/arm/mte_helper.c
96
rename to target/arm/tcg/mte_helper.c
97
diff --git a/target/arm/mve_helper.c b/target/arm/tcg/mve_helper.c
98
similarity index 100%
99
rename from target/arm/mve_helper.c
100
rename to target/arm/tcg/mve_helper.c
101
diff --git a/target/arm/neon_helper.c b/target/arm/tcg/neon_helper.c
102
similarity index 100%
103
rename from target/arm/neon_helper.c
104
rename to target/arm/tcg/neon_helper.c
105
diff --git a/target/arm/op_helper.c b/target/arm/tcg/op_helper.c
106
similarity index 100%
107
rename from target/arm/op_helper.c
108
rename to target/arm/tcg/op_helper.c
109
diff --git a/target/arm/pauth_helper.c b/target/arm/tcg/pauth_helper.c
110
similarity index 100%
111
rename from target/arm/pauth_helper.c
112
rename to target/arm/tcg/pauth_helper.c
113
diff --git a/target/arm/sme_helper.c b/target/arm/tcg/sme_helper.c
114
similarity index 100%
115
rename from target/arm/sme_helper.c
116
rename to target/arm/tcg/sme_helper.c
117
diff --git a/target/arm/sve_helper.c b/target/arm/tcg/sve_helper.c
118
similarity index 100%
119
rename from target/arm/sve_helper.c
120
rename to target/arm/tcg/sve_helper.c
121
diff --git a/target/arm/tlb_helper.c b/target/arm/tcg/tlb_helper.c
122
similarity index 100%
123
rename from target/arm/tlb_helper.c
124
rename to target/arm/tcg/tlb_helper.c
125
diff --git a/target/arm/vec_helper.c b/target/arm/tcg/vec_helper.c
126
similarity index 100%
127
rename from target/arm/vec_helper.c
128
rename to target/arm/tcg/vec_helper.c
129
diff --git a/target/arm/meson.build b/target/arm/meson.build
75
index XXXXXXX..XXXXXXX 100644
130
index XXXXXXX..XXXXXXX 100644
76
--- a/hw/intc/meson.build
131
--- a/target/arm/meson.build
77
+++ b/hw/intc/meson.build
132
+++ b/target/arm/meson.build
78
@@ -XXX,XX +XXX,XX @@ softmmu_ss.add(when: 'CONFIG_XLNX_ZYNQMP_PMU', if_true: files('xlnx-pmu-iomod-in
133
@@ -XXX,XX +XXX,XX @@
79
134
arm_ss = ss.source_set()
80
specific_ss.add(when: 'CONFIG_ALLWINNER_A10_PIC', if_true: files('allwinner-a10-pic.c'))
135
arm_ss.add(files(
81
specific_ss.add(when: 'CONFIG_APIC', if_true: files('apic.c', 'apic_common.c'))
136
'cpu.c',
82
+specific_ss.add(when: 'CONFIG_ARM_GIC', if_true: files('arm_gicv3_cpuif_common.c'))
137
- 'crypto_helper.c',
83
specific_ss.add(when: 'CONFIG_ARM_GIC', if_true: files('arm_gicv3_cpuif.c'))
138
'debug_helper.c',
84
specific_ss.add(when: 'CONFIG_ARM_GIC_KVM', if_true: files('arm_gic_kvm.c'))
139
'gdbstub.c',
85
specific_ss.add(when: ['CONFIG_ARM_GIC_KVM', 'TARGET_AARCH64'], if_true: files('arm_gicv3_kvm.c', 'arm_gicv3_its_kvm.c'))
140
'helper.c',
141
- 'iwmmxt_helper.c',
142
- 'm_helper.c',
143
- 'mve_helper.c',
144
- 'neon_helper.c',
145
- 'op_helper.c',
146
- 'tlb_helper.c',
147
- 'vec_helper.c',
148
'vfp_helper.c',
149
'cpu_tcg.c',
150
))
151
@@ -XXX,XX +XXX,XX @@ arm_ss.add(when: 'CONFIG_KVM', if_true: files('kvm.c', 'kvm64.c'), if_false: fil
152
arm_ss.add(when: 'TARGET_AARCH64', if_true: files(
153
'cpu64.c',
154
'gdbstub64.c',
155
- 'helper-a64.c',
156
- 'mte_helper.c',
157
- 'pauth_helper.c',
158
- 'sve_helper.c',
159
- 'sme_helper.c',
160
))
161
162
arm_softmmu_ss = ss.source_set()
163
@@ -XXX,XX +XXX,XX @@ subdir('hvf')
164
165
if 'CONFIG_TCG' in config_all
166
subdir('tcg')
167
+else
168
+ arm_ss.add(files('tcg-stubs.c'))
169
endif
170
171
target_arch += {'arm': arm_ss}
172
diff --git a/target/arm/tcg/meson.build b/target/arm/tcg/meson.build
173
index XXXXXXX..XXXXXXX 100644
174
--- a/target/arm/tcg/meson.build
175
+++ b/target/arm/tcg/meson.build
176
@@ -XXX,XX +XXX,XX @@ arm_ss.add(files(
177
'translate-mve.c',
178
'translate-neon.c',
179
'translate-vfp.c',
180
+ 'crypto_helper.c',
181
+ 'iwmmxt_helper.c',
182
+ 'm_helper.c',
183
+ 'mve_helper.c',
184
+ 'neon_helper.c',
185
+ 'op_helper.c',
186
+ 'tlb_helper.c',
187
+ 'vec_helper.c',
188
))
189
190
arm_ss.add(when: 'TARGET_AARCH64', if_true: files(
191
'translate-a64.c',
192
'translate-sve.c',
193
'translate-sme.c',
194
+ 'helper-a64.c',
195
+ 'mte_helper.c',
196
+ 'pauth_helper.c',
197
+ 'sme_helper.c',
198
+ 'sve_helper.c',
199
))
86
--
200
--
87
2.25.1
201
2.34.1
88
202
89
203
diff view generated by jsdifflib
1
From: Jean-Philippe Brucker <jean-philippe@linaro.org>
1
From: Claudio Fontana <cfontana@suse.de>
2
2
3
Create empty data files and allow updates for the upcoming VIOT tests.
3
Signed-off-by: Claudio Fontana <cfontana@suse.de>
4
4
Signed-off-by: Fabiano Rosas <farosas@suse.de>
5
Acked-by: Igor Mammedov <imammedo@redhat.com>
5
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
6
Reviewed-by: Eric Auger <eric.auger@redhat.com>
6
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
7
Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
7
Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org>
8
Message-id: 20211210170415.583179-6-jean-philippe@linaro.org
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
---
9
---
11
tests/qtest/bios-tables-test-allowed-diff.h | 3 +++
10
target/arm/{ => tcg}/psci.c | 0
12
tests/data/acpi/q35/DSDT.viot | 0
11
target/arm/meson.build | 1 -
13
tests/data/acpi/q35/VIOT.viot | 0
12
target/arm/tcg/meson.build | 4 ++++
14
tests/data/acpi/virt/VIOT | 0
13
3 files changed, 4 insertions(+), 1 deletion(-)
15
4 files changed, 3 insertions(+)
14
rename target/arm/{ => tcg}/psci.c (100%)
16
create mode 100644 tests/data/acpi/q35/DSDT.viot
17
create mode 100644 tests/data/acpi/q35/VIOT.viot
18
create mode 100644 tests/data/acpi/virt/VIOT
19
15
20
diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h
16
diff --git a/target/arm/psci.c b/target/arm/tcg/psci.c
17
similarity index 100%
18
rename from target/arm/psci.c
19
rename to target/arm/tcg/psci.c
20
diff --git a/target/arm/meson.build b/target/arm/meson.build
21
index XXXXXXX..XXXXXXX 100644
21
index XXXXXXX..XXXXXXX 100644
22
--- a/tests/qtest/bios-tables-test-allowed-diff.h
22
--- a/target/arm/meson.build
23
+++ b/tests/qtest/bios-tables-test-allowed-diff.h
23
+++ b/target/arm/meson.build
24
@@ -1 +1,4 @@
24
@@ -XXX,XX +XXX,XX @@ arm_softmmu_ss.add(files(
25
/* List of comma-separated changed AML files to ignore */
25
'arm-powerctl.c',
26
+"tests/data/acpi/virt/VIOT",
26
'machine.c',
27
+"tests/data/acpi/q35/DSDT.viot",
27
'monitor.c',
28
+"tests/data/acpi/q35/VIOT.viot",
28
- 'psci.c',
29
diff --git a/tests/data/acpi/q35/DSDT.viot b/tests/data/acpi/q35/DSDT.viot
29
'ptw.c',
30
new file mode 100644
30
))
31
index XXXXXXX..XXXXXXX
31
32
diff --git a/tests/data/acpi/q35/VIOT.viot b/tests/data/acpi/q35/VIOT.viot
32
diff --git a/target/arm/tcg/meson.build b/target/arm/tcg/meson.build
33
new file mode 100644
33
index XXXXXXX..XXXXXXX 100644
34
index XXXXXXX..XXXXXXX
34
--- a/target/arm/tcg/meson.build
35
diff --git a/tests/data/acpi/virt/VIOT b/tests/data/acpi/virt/VIOT
35
+++ b/target/arm/tcg/meson.build
36
new file mode 100644
36
@@ -XXX,XX +XXX,XX @@ arm_ss.add(when: 'TARGET_AARCH64', if_true: files(
37
index XXXXXXX..XXXXXXX
37
'sme_helper.c',
38
'sve_helper.c',
39
))
40
+
41
+arm_softmmu_ss.add(files(
42
+ 'psci.c',
43
+))
38
--
44
--
39
2.25.1
45
2.34.1
40
46
41
47
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
From: Fabiano Rosas <farosas@suse.de>
2
2
3
Misaligned thumb PC is architecturally impossible.
3
This is in preparation to moving the hflags code into its own file
4
Assert is better than proceeding, in case we've missed
4
under the tcg/ directory.
5
something somewhere.
5
6
6
Signed-off-by: Fabiano Rosas <farosas@suse.de>
7
Expand a comment about aligning the pc in gdbstub.
7
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
8
Fail an incoming migrate if a thumb pc is misaligned.
8
Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org>
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>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
---
10
---
14
target/arm/gdbstub.c | 9 +++++++--
11
hw/arm/boot.c | 6 +++++-
15
target/arm/machine.c | 10 ++++++++++
12
hw/intc/armv7m_nvic.c | 20 +++++++++++++-------
16
target/arm/translate.c | 3 +++
13
target/arm/arm-powerctl.c | 7 +++++--
17
3 files changed, 20 insertions(+), 2 deletions(-)
14
target/arm/cpu.c | 3 ++-
18
15
target/arm/helper.c | 18 +++++++++++++-----
19
diff --git a/target/arm/gdbstub.c b/target/arm/gdbstub.c
16
target/arm/machine.c | 5 ++++-
20
index XXXXXXX..XXXXXXX 100644
17
6 files changed, 42 insertions(+), 17 deletions(-)
21
--- a/target/arm/gdbstub.c
18
22
+++ b/target/arm/gdbstub.c
19
diff --git a/hw/arm/boot.c b/hw/arm/boot.c
23
@@ -XXX,XX +XXX,XX @@ int arm_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n)
20
index XXXXXXX..XXXXXXX 100644
24
21
--- a/hw/arm/boot.c
25
tmp = ldl_p(mem_buf);
22
+++ b/hw/arm/boot.c
26
23
@@ -XXX,XX +XXX,XX @@
27
- /* Mask out low bit of PC to workaround gdb bugs. This will probably
24
#include "hw/arm/boot.h"
28
- cause problems if we ever implement the Jazelle DBX extensions. */
25
#include "hw/arm/linux-boot-if.h"
29
+ /*
26
#include "sysemu/kvm.h"
30
+ * Mask out low bits of PC to workaround gdb bugs.
27
+#include "sysemu/tcg.h"
31
+ * This avoids an assert in thumb_tr_translate_insn, because it is
28
#include "sysemu/sysemu.h"
32
+ * architecturally impossible to misalign the pc.
29
#include "sysemu/numa.h"
33
+ * This will probably cause problems if we ever implement the
30
#include "hw/boards.h"
34
+ * Jazelle DBX extensions.
31
@@ -XXX,XX +XXX,XX @@ static void do_cpu_reset(void *opaque)
35
+ */
32
info->secondary_cpu_reset_hook(cpu, info);
36
if (n == 15) {
33
}
37
tmp &= ~1;
34
}
38
}
35
- arm_rebuild_hflags(env);
36
+
37
+ if (tcg_enabled()) {
38
+ arm_rebuild_hflags(env);
39
+ }
40
}
41
}
42
43
diff --git a/hw/intc/armv7m_nvic.c b/hw/intc/armv7m_nvic.c
44
index XXXXXXX..XXXXXXX 100644
45
--- a/hw/intc/armv7m_nvic.c
46
+++ b/hw/intc/armv7m_nvic.c
47
@@ -XXX,XX +XXX,XX @@
48
#include "hw/intc/armv7m_nvic.h"
49
#include "hw/irq.h"
50
#include "hw/qdev-properties.h"
51
+#include "sysemu/tcg.h"
52
#include "sysemu/runstate.h"
53
#include "target/arm/cpu.h"
54
#include "exec/exec-all.h"
55
@@ -XXX,XX +XXX,XX @@ static MemTxResult nvic_sysreg_write(void *opaque, hwaddr addr,
56
/* This is UNPREDICTABLE; treat as RAZ/WI */
57
58
exit_ok:
59
- /* Ensure any changes made are reflected in the cached hflags. */
60
- arm_rebuild_hflags(&s->cpu->env);
61
+ if (tcg_enabled()) {
62
+ /* Ensure any changes made are reflected in the cached hflags. */
63
+ arm_rebuild_hflags(&s->cpu->env);
64
+ }
65
return MEMTX_OK;
66
}
67
68
@@ -XXX,XX +XXX,XX @@ static void armv7m_nvic_reset(DeviceState *dev)
69
}
70
}
71
72
- /*
73
- * We updated state that affects the CPU's MMUidx and thus its hflags;
74
- * and we can't guarantee that we run before the CPU reset function.
75
- */
76
- arm_rebuild_hflags(&s->cpu->env);
77
+ if (tcg_enabled()) {
78
+ /*
79
+ * We updated state that affects the CPU's MMUidx and thus its
80
+ * hflags; and we can't guarantee that we run before the CPU
81
+ * reset function.
82
+ */
83
+ arm_rebuild_hflags(&s->cpu->env);
84
+ }
85
}
86
87
static void nvic_systick_trigger(void *opaque, int n, int level)
88
diff --git a/target/arm/arm-powerctl.c b/target/arm/arm-powerctl.c
89
index XXXXXXX..XXXXXXX 100644
90
--- a/target/arm/arm-powerctl.c
91
+++ b/target/arm/arm-powerctl.c
92
@@ -XXX,XX +XXX,XX @@
93
#include "arm-powerctl.h"
94
#include "qemu/log.h"
95
#include "qemu/main-loop.h"
96
+#include "sysemu/tcg.h"
97
98
#ifndef DEBUG_ARM_POWERCTL
99
#define DEBUG_ARM_POWERCTL 0
100
@@ -XXX,XX +XXX,XX @@ static void arm_set_cpu_on_async_work(CPUState *target_cpu_state,
101
target_cpu->env.regs[0] = info->context_id;
102
}
103
104
- /* CP15 update requires rebuilding hflags */
105
- arm_rebuild_hflags(&target_cpu->env);
106
+ if (tcg_enabled()) {
107
+ /* CP15 update requires rebuilding hflags */
108
+ arm_rebuild_hflags(&target_cpu->env);
109
+ }
110
111
/* Start the new CPU at the requested address */
112
cpu_set_pc(target_cpu_state, info->entry);
113
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
114
index XXXXXXX..XXXXXXX 100644
115
--- a/target/arm/cpu.c
116
+++ b/target/arm/cpu.c
117
@@ -XXX,XX +XXX,XX @@ static void arm_cpu_reset_hold(Object *obj)
118
if (tcg_enabled()) {
119
hw_breakpoint_update_all(cpu);
120
hw_watchpoint_update_all(cpu);
121
+
122
+ arm_rebuild_hflags(env);
123
}
124
- arm_rebuild_hflags(env);
125
}
126
127
#if defined(CONFIG_TCG) && !defined(CONFIG_USER_ONLY)
128
diff --git a/target/arm/helper.c b/target/arm/helper.c
129
index XXXXXXX..XXXXXXX 100644
130
--- a/target/arm/helper.c
131
+++ b/target/arm/helper.c
132
@@ -XXX,XX +XXX,XX @@ static void sctlr_write(CPUARMState *env, const ARMCPRegInfo *ri,
133
/* This may enable/disable the MMU, so do a TLB flush. */
134
tlb_flush(CPU(cpu));
135
136
- if (ri->type & ARM_CP_SUPPRESS_TB_END) {
137
+ if (tcg_enabled() && ri->type & ARM_CP_SUPPRESS_TB_END) {
138
/*
139
* Normally we would always end the TB on an SCTLR write; see the
140
* comment in ARMCPRegInfo sctlr initialization below for why Xscale
141
@@ -XXX,XX +XXX,XX @@ void aarch64_set_svcr(CPUARMState *env, uint64_t new, uint64_t mask)
142
memset(env->zarray, 0, sizeof(env->zarray));
143
}
144
145
- arm_rebuild_hflags(env);
146
+ if (tcg_enabled()) {
147
+ arm_rebuild_hflags(env);
148
+ }
149
}
150
151
static void svcr_write(CPUARMState *env, const ARMCPRegInfo *ri,
152
@@ -XXX,XX +XXX,XX @@ void cpsr_write(CPUARMState *env, uint32_t val, uint32_t mask,
153
}
154
mask &= ~CACHED_CPSR_BITS;
155
env->uncached_cpsr = (env->uncached_cpsr & ~mask) | (val & mask);
156
- if (rebuild_hflags) {
157
+ if (tcg_enabled() && rebuild_hflags) {
158
arm_rebuild_hflags(env);
159
}
160
}
161
@@ -XXX,XX +XXX,XX @@ static void take_aarch32_exception(CPUARMState *env, int new_mode,
162
env->regs[14] = env->regs[15] + offset;
163
}
164
env->regs[15] = newpc;
165
- arm_rebuild_hflags(env);
166
+
167
+ if (tcg_enabled()) {
168
+ arm_rebuild_hflags(env);
169
+ }
170
}
171
172
static void arm_cpu_do_interrupt_aarch32_hyp(CPUState *cs)
173
@@ -XXX,XX +XXX,XX @@ static void arm_cpu_do_interrupt_aarch64(CPUState *cs)
174
pstate_write(env, PSTATE_DAIF | new_mode);
175
env->aarch64 = true;
176
aarch64_restore_sp(env, new_el);
177
- helper_rebuild_hflags_a64(env, new_el);
178
+
179
+ if (tcg_enabled()) {
180
+ helper_rebuild_hflags_a64(env, new_el);
181
+ }
182
183
env->pc = addr;
184
39
diff --git a/target/arm/machine.c b/target/arm/machine.c
185
diff --git a/target/arm/machine.c b/target/arm/machine.c
40
index XXXXXXX..XXXXXXX 100644
186
index XXXXXXX..XXXXXXX 100644
41
--- a/target/arm/machine.c
187
--- a/target/arm/machine.c
42
+++ b/target/arm/machine.c
188
+++ b/target/arm/machine.c
43
@@ -XXX,XX +XXX,XX @@ static int cpu_post_load(void *opaque, int version_id)
189
@@ -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()) {
190
if (!kvm_enabled()) {
58
pmu_op_finish(&cpu->env);
191
pmu_op_finish(&cpu->env);
59
}
192
}
60
diff --git a/target/arm/translate.c b/target/arm/translate.c
193
- arm_rebuild_hflags(&cpu->env);
61
index XXXXXXX..XXXXXXX 100644
194
+
62
--- a/target/arm/translate.c
195
+ if (tcg_enabled()) {
63
+++ b/target/arm/translate.c
196
+ arm_rebuild_hflags(&cpu->env);
64
@@ -XXX,XX +XXX,XX @@ static void thumb_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu)
197
+ }
65
uint32_t insn;
198
66
bool is_16bit;
199
return 0;
67
200
}
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
--
201
--
75
2.25.1
202
2.34.1
76
203
77
204
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
From: Fabiano Rosas <farosas@suse.de>
2
2
3
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
3
The hflags are used only for TCG code, so introduce a new file
4
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
4
hflags.c to keep that code.
5
6
Signed-off-by: Fabiano Rosas <farosas@suse.de>
7
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
8
Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org>
5
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6
---
10
---
7
tests/tcg/aarch64/pcalign-a64.c | 37 +++++++++++++++++++++++++
11
target/arm/internals.h | 2 +
8
tests/tcg/arm/pcalign-a32.c | 46 +++++++++++++++++++++++++++++++
12
target/arm/helper.c | 393 +-----------------------------------
9
tests/tcg/aarch64/Makefile.target | 4 +--
13
target/arm/tcg-stubs.c | 4 +
10
tests/tcg/arm/Makefile.target | 4 +++
14
target/arm/tcg/hflags.c | 403 +++++++++++++++++++++++++++++++++++++
11
4 files changed, 89 insertions(+), 2 deletions(-)
15
target/arm/tcg/meson.build | 1 +
12
create mode 100644 tests/tcg/aarch64/pcalign-a64.c
16
5 files changed, 411 insertions(+), 392 deletions(-)
13
create mode 100644 tests/tcg/arm/pcalign-a32.c
17
create mode 100644 target/arm/tcg/hflags.c
14
18
15
diff --git a/tests/tcg/aarch64/pcalign-a64.c b/tests/tcg/aarch64/pcalign-a64.c
19
diff --git a/target/arm/internals.h b/target/arm/internals.h
20
index XXXXXXX..XXXXXXX 100644
21
--- a/target/arm/internals.h
22
+++ b/target/arm/internals.h
23
@@ -XXX,XX +XXX,XX @@ ARMVAParameters aa64_va_parameters(CPUARMState *env, uint64_t va,
24
25
int aa64_va_parameter_tbi(uint64_t tcr, ARMMMUIdx mmu_idx);
26
int aa64_va_parameter_tbid(uint64_t tcr, ARMMMUIdx mmu_idx);
27
+int aa64_va_parameter_tcma(uint64_t tcr, ARMMMUIdx mmu_idx);
28
29
/* Determine if allocation tags are available. */
30
static inline bool allocation_tag_access_enabled(CPUARMState *env, int el,
31
@@ -XXX,XX +XXX,XX @@ static inline bool arm_fgt_active(CPUARMState *env, int el)
32
(!arm_feature(env, ARM_FEATURE_EL3) || (env->cp15.scr_el3 & SCR_FGTEN));
33
}
34
35
+void assert_hflags_rebuild_correctly(CPUARMState *env);
36
#endif
37
diff --git a/target/arm/helper.c b/target/arm/helper.c
38
index XXXXXXX..XXXXXXX 100644
39
--- a/target/arm/helper.c
40
+++ b/target/arm/helper.c
41
@@ -XXX,XX +XXX,XX @@ int sme_exception_el(CPUARMState *env, int el)
42
return 0;
43
}
44
45
-/* This corresponds to the ARM pseudocode function IsFullA64Enabled(). */
46
-static bool sme_fa64(CPUARMState *env, int el)
47
-{
48
- if (!cpu_isar_feature(aa64_sme_fa64, env_archcpu(env))) {
49
- return false;
50
- }
51
-
52
- if (el <= 1 && !el_is_in_host(env, el)) {
53
- if (!FIELD_EX64(env->vfp.smcr_el[1], SMCR, FA64)) {
54
- return false;
55
- }
56
- }
57
- if (el <= 2 && arm_is_el2_enabled(env)) {
58
- if (!FIELD_EX64(env->vfp.smcr_el[2], SMCR, FA64)) {
59
- return false;
60
- }
61
- }
62
- if (arm_feature(env, ARM_FEATURE_EL3)) {
63
- if (!FIELD_EX64(env->vfp.smcr_el[3], SMCR, FA64)) {
64
- return false;
65
- }
66
- }
67
-
68
- return true;
69
-}
70
-
71
/*
72
* Given that SVE is enabled, return the vector length for EL.
73
*/
74
@@ -XXX,XX +XXX,XX @@ int aa64_va_parameter_tbid(uint64_t tcr, ARMMMUIdx mmu_idx)
75
}
76
}
77
78
-static int aa64_va_parameter_tcma(uint64_t tcr, ARMMMUIdx mmu_idx)
79
+int aa64_va_parameter_tcma(uint64_t tcr, ARMMMUIdx mmu_idx)
80
{
81
if (regime_has_2_ranges(mmu_idx)) {
82
return extract64(tcr, 57, 2);
83
@@ -XXX,XX +XXX,XX @@ ARMMMUIdx arm_mmu_idx(CPUARMState *env)
84
return arm_mmu_idx_el(env, arm_current_el(env));
85
}
86
87
-static inline bool fgt_svc(CPUARMState *env, int el)
88
-{
89
- /*
90
- * Assuming fine-grained-traps are active, return true if we
91
- * should be trapping on SVC instructions. Only AArch64 can
92
- * trap on an SVC at EL1, but we don't need to special-case this
93
- * because if this is AArch32 EL1 then arm_fgt_active() is false.
94
- * We also know el is 0 or 1.
95
- */
96
- return el == 0 ?
97
- FIELD_EX64(env->cp15.fgt_exec[FGTREG_HFGITR], HFGITR_EL2, SVC_EL0) :
98
- FIELD_EX64(env->cp15.fgt_exec[FGTREG_HFGITR], HFGITR_EL2, SVC_EL1);
99
-}
100
-
101
-static CPUARMTBFlags rebuild_hflags_common(CPUARMState *env, int fp_el,
102
- ARMMMUIdx mmu_idx,
103
- CPUARMTBFlags flags)
104
-{
105
- DP_TBFLAG_ANY(flags, FPEXC_EL, fp_el);
106
- DP_TBFLAG_ANY(flags, MMUIDX, arm_to_core_mmu_idx(mmu_idx));
107
-
108
- if (arm_singlestep_active(env)) {
109
- DP_TBFLAG_ANY(flags, SS_ACTIVE, 1);
110
- }
111
-
112
- return flags;
113
-}
114
-
115
-static CPUARMTBFlags rebuild_hflags_common_32(CPUARMState *env, int fp_el,
116
- ARMMMUIdx mmu_idx,
117
- CPUARMTBFlags flags)
118
-{
119
- bool sctlr_b = arm_sctlr_b(env);
120
-
121
- if (sctlr_b) {
122
- DP_TBFLAG_A32(flags, SCTLR__B, 1);
123
- }
124
- if (arm_cpu_data_is_big_endian_a32(env, sctlr_b)) {
125
- DP_TBFLAG_ANY(flags, BE_DATA, 1);
126
- }
127
- DP_TBFLAG_A32(flags, NS, !access_secure_reg(env));
128
-
129
- return rebuild_hflags_common(env, fp_el, mmu_idx, flags);
130
-}
131
-
132
-static CPUARMTBFlags rebuild_hflags_m32(CPUARMState *env, int fp_el,
133
- ARMMMUIdx mmu_idx)
134
-{
135
- CPUARMTBFlags flags = {};
136
- uint32_t ccr = env->v7m.ccr[env->v7m.secure];
137
-
138
- /* Without HaveMainExt, CCR.UNALIGN_TRP is RES1. */
139
- if (ccr & R_V7M_CCR_UNALIGN_TRP_MASK) {
140
- DP_TBFLAG_ANY(flags, ALIGN_MEM, 1);
141
- }
142
-
143
- if (arm_v7m_is_handler_mode(env)) {
144
- DP_TBFLAG_M32(flags, HANDLER, 1);
145
- }
146
-
147
- /*
148
- * v8M always applies stack limit checks unless CCR.STKOFHFNMIGN
149
- * is suppressing them because the requested execution priority
150
- * is less than 0.
151
- */
152
- if (arm_feature(env, ARM_FEATURE_V8) &&
153
- !((mmu_idx & ARM_MMU_IDX_M_NEGPRI) &&
154
- (ccr & R_V7M_CCR_STKOFHFNMIGN_MASK))) {
155
- DP_TBFLAG_M32(flags, STACKCHECK, 1);
156
- }
157
-
158
- if (arm_feature(env, ARM_FEATURE_M_SECURITY) && env->v7m.secure) {
159
- DP_TBFLAG_M32(flags, SECURE, 1);
160
- }
161
-
162
- return rebuild_hflags_common_32(env, fp_el, mmu_idx, flags);
163
-}
164
-
165
-static CPUARMTBFlags rebuild_hflags_a32(CPUARMState *env, int fp_el,
166
- ARMMMUIdx mmu_idx)
167
-{
168
- CPUARMTBFlags flags = {};
169
- int el = arm_current_el(env);
170
-
171
- if (arm_sctlr(env, el) & SCTLR_A) {
172
- DP_TBFLAG_ANY(flags, ALIGN_MEM, 1);
173
- }
174
-
175
- if (arm_el_is_aa64(env, 1)) {
176
- DP_TBFLAG_A32(flags, VFPEN, 1);
177
- }
178
-
179
- if (el < 2 && env->cp15.hstr_el2 && arm_is_el2_enabled(env) &&
180
- (arm_hcr_el2_eff(env) & (HCR_E2H | HCR_TGE)) != (HCR_E2H | HCR_TGE)) {
181
- DP_TBFLAG_A32(flags, HSTR_ACTIVE, 1);
182
- }
183
-
184
- if (arm_fgt_active(env, el)) {
185
- DP_TBFLAG_ANY(flags, FGT_ACTIVE, 1);
186
- if (fgt_svc(env, el)) {
187
- DP_TBFLAG_ANY(flags, FGT_SVC, 1);
188
- }
189
- }
190
-
191
- if (env->uncached_cpsr & CPSR_IL) {
192
- DP_TBFLAG_ANY(flags, PSTATE__IL, 1);
193
- }
194
-
195
- /*
196
- * The SME exception we are testing for is raised via
197
- * AArch64.CheckFPAdvSIMDEnabled(), as called from
198
- * AArch32.CheckAdvSIMDOrFPEnabled().
199
- */
200
- if (el == 0
201
- && FIELD_EX64(env->svcr, SVCR, SM)
202
- && (!arm_is_el2_enabled(env)
203
- || (arm_el_is_aa64(env, 2) && !(env->cp15.hcr_el2 & HCR_TGE)))
204
- && arm_el_is_aa64(env, 1)
205
- && !sme_fa64(env, el)) {
206
- DP_TBFLAG_A32(flags, SME_TRAP_NONSTREAMING, 1);
207
- }
208
-
209
- return rebuild_hflags_common_32(env, fp_el, mmu_idx, flags);
210
-}
211
-
212
-static CPUARMTBFlags rebuild_hflags_a64(CPUARMState *env, int el, int fp_el,
213
- ARMMMUIdx mmu_idx)
214
-{
215
- CPUARMTBFlags flags = {};
216
- ARMMMUIdx stage1 = stage_1_mmu_idx(mmu_idx);
217
- uint64_t tcr = regime_tcr(env, mmu_idx);
218
- uint64_t sctlr;
219
- int tbii, tbid;
220
-
221
- DP_TBFLAG_ANY(flags, AARCH64_STATE, 1);
222
-
223
- /* Get control bits for tagged addresses. */
224
- tbid = aa64_va_parameter_tbi(tcr, mmu_idx);
225
- tbii = tbid & ~aa64_va_parameter_tbid(tcr, mmu_idx);
226
-
227
- DP_TBFLAG_A64(flags, TBII, tbii);
228
- DP_TBFLAG_A64(flags, TBID, tbid);
229
-
230
- if (cpu_isar_feature(aa64_sve, env_archcpu(env))) {
231
- int sve_el = sve_exception_el(env, el);
232
-
233
- /*
234
- * If either FP or SVE are disabled, translator does not need len.
235
- * If SVE EL > FP EL, FP exception has precedence, and translator
236
- * does not need SVE EL. Save potential re-translations by forcing
237
- * the unneeded data to zero.
238
- */
239
- if (fp_el != 0) {
240
- if (sve_el > fp_el) {
241
- sve_el = 0;
242
- }
243
- } else if (sve_el == 0) {
244
- DP_TBFLAG_A64(flags, VL, sve_vqm1_for_el(env, el));
245
- }
246
- DP_TBFLAG_A64(flags, SVEEXC_EL, sve_el);
247
- }
248
- if (cpu_isar_feature(aa64_sme, env_archcpu(env))) {
249
- int sme_el = sme_exception_el(env, el);
250
- bool sm = FIELD_EX64(env->svcr, SVCR, SM);
251
-
252
- DP_TBFLAG_A64(flags, SMEEXC_EL, sme_el);
253
- if (sme_el == 0) {
254
- /* Similarly, do not compute SVL if SME is disabled. */
255
- int svl = sve_vqm1_for_el_sm(env, el, true);
256
- DP_TBFLAG_A64(flags, SVL, svl);
257
- if (sm) {
258
- /* If SVE is disabled, we will not have set VL above. */
259
- DP_TBFLAG_A64(flags, VL, svl);
260
- }
261
- }
262
- if (sm) {
263
- DP_TBFLAG_A64(flags, PSTATE_SM, 1);
264
- DP_TBFLAG_A64(flags, SME_TRAP_NONSTREAMING, !sme_fa64(env, el));
265
- }
266
- DP_TBFLAG_A64(flags, PSTATE_ZA, FIELD_EX64(env->svcr, SVCR, ZA));
267
- }
268
-
269
- sctlr = regime_sctlr(env, stage1);
270
-
271
- if (sctlr & SCTLR_A) {
272
- DP_TBFLAG_ANY(flags, ALIGN_MEM, 1);
273
- }
274
-
275
- if (arm_cpu_data_is_big_endian_a64(el, sctlr)) {
276
- DP_TBFLAG_ANY(flags, BE_DATA, 1);
277
- }
278
-
279
- if (cpu_isar_feature(aa64_pauth, env_archcpu(env))) {
280
- /*
281
- * In order to save space in flags, we record only whether
282
- * pauth is "inactive", meaning all insns are implemented as
283
- * a nop, or "active" when some action must be performed.
284
- * The decision of which action to take is left to a helper.
285
- */
286
- if (sctlr & (SCTLR_EnIA | SCTLR_EnIB | SCTLR_EnDA | SCTLR_EnDB)) {
287
- DP_TBFLAG_A64(flags, PAUTH_ACTIVE, 1);
288
- }
289
- }
290
-
291
- if (cpu_isar_feature(aa64_bti, env_archcpu(env))) {
292
- /* Note that SCTLR_EL[23].BT == SCTLR_BT1. */
293
- if (sctlr & (el == 0 ? SCTLR_BT0 : SCTLR_BT1)) {
294
- DP_TBFLAG_A64(flags, BT, 1);
295
- }
296
- }
297
-
298
- /* Compute the condition for using AccType_UNPRIV for LDTR et al. */
299
- if (!(env->pstate & PSTATE_UAO)) {
300
- switch (mmu_idx) {
301
- case ARMMMUIdx_E10_1:
302
- case ARMMMUIdx_E10_1_PAN:
303
- /* TODO: ARMv8.3-NV */
304
- DP_TBFLAG_A64(flags, UNPRIV, 1);
305
- break;
306
- case ARMMMUIdx_E20_2:
307
- case ARMMMUIdx_E20_2_PAN:
308
- /*
309
- * Note that EL20_2 is gated by HCR_EL2.E2H == 1, but EL20_0 is
310
- * gated by HCR_EL2.<E2H,TGE> == '11', and so is LDTR.
311
- */
312
- if (env->cp15.hcr_el2 & HCR_TGE) {
313
- DP_TBFLAG_A64(flags, UNPRIV, 1);
314
- }
315
- break;
316
- default:
317
- break;
318
- }
319
- }
320
-
321
- if (env->pstate & PSTATE_IL) {
322
- DP_TBFLAG_ANY(flags, PSTATE__IL, 1);
323
- }
324
-
325
- if (arm_fgt_active(env, el)) {
326
- DP_TBFLAG_ANY(flags, FGT_ACTIVE, 1);
327
- if (FIELD_EX64(env->cp15.fgt_exec[FGTREG_HFGITR], HFGITR_EL2, ERET)) {
328
- DP_TBFLAG_A64(flags, FGT_ERET, 1);
329
- }
330
- if (fgt_svc(env, el)) {
331
- DP_TBFLAG_ANY(flags, FGT_SVC, 1);
332
- }
333
- }
334
-
335
- if (cpu_isar_feature(aa64_mte, env_archcpu(env))) {
336
- /*
337
- * Set MTE_ACTIVE if any access may be Checked, and leave clear
338
- * if all accesses must be Unchecked:
339
- * 1) If no TBI, then there are no tags in the address to check,
340
- * 2) If Tag Check Override, then all accesses are Unchecked,
341
- * 3) If Tag Check Fail == 0, then Checked access have no effect,
342
- * 4) If no Allocation Tag Access, then all accesses are Unchecked.
343
- */
344
- if (allocation_tag_access_enabled(env, el, sctlr)) {
345
- DP_TBFLAG_A64(flags, ATA, 1);
346
- if (tbid
347
- && !(env->pstate & PSTATE_TCO)
348
- && (sctlr & (el == 0 ? SCTLR_TCF0 : SCTLR_TCF))) {
349
- DP_TBFLAG_A64(flags, MTE_ACTIVE, 1);
350
- }
351
- }
352
- /* And again for unprivileged accesses, if required. */
353
- if (EX_TBFLAG_A64(flags, UNPRIV)
354
- && tbid
355
- && !(env->pstate & PSTATE_TCO)
356
- && (sctlr & SCTLR_TCF0)
357
- && allocation_tag_access_enabled(env, 0, sctlr)) {
358
- DP_TBFLAG_A64(flags, MTE0_ACTIVE, 1);
359
- }
360
- /* Cache TCMA as well as TBI. */
361
- DP_TBFLAG_A64(flags, TCMA, aa64_va_parameter_tcma(tcr, mmu_idx));
362
- }
363
-
364
- return rebuild_hflags_common(env, fp_el, mmu_idx, flags);
365
-}
366
-
367
-static CPUARMTBFlags rebuild_hflags_internal(CPUARMState *env)
368
-{
369
- int el = arm_current_el(env);
370
- int fp_el = fp_exception_el(env, el);
371
- ARMMMUIdx mmu_idx = arm_mmu_idx_el(env, el);
372
-
373
- if (is_a64(env)) {
374
- return rebuild_hflags_a64(env, el, fp_el, mmu_idx);
375
- } else if (arm_feature(env, ARM_FEATURE_M)) {
376
- return rebuild_hflags_m32(env, fp_el, mmu_idx);
377
- } else {
378
- return rebuild_hflags_a32(env, fp_el, mmu_idx);
379
- }
380
-}
381
-
382
-void arm_rebuild_hflags(CPUARMState *env)
383
-{
384
- env->hflags = rebuild_hflags_internal(env);
385
-}
386
-
387
-/*
388
- * If we have triggered a EL state change we can't rely on the
389
- * translator having passed it to us, we need to recompute.
390
- */
391
-void HELPER(rebuild_hflags_m32_newel)(CPUARMState *env)
392
-{
393
- int el = arm_current_el(env);
394
- int fp_el = fp_exception_el(env, el);
395
- ARMMMUIdx mmu_idx = arm_mmu_idx_el(env, el);
396
-
397
- env->hflags = rebuild_hflags_m32(env, fp_el, mmu_idx);
398
-}
399
-
400
-void HELPER(rebuild_hflags_m32)(CPUARMState *env, int el)
401
-{
402
- int fp_el = fp_exception_el(env, el);
403
- ARMMMUIdx mmu_idx = arm_mmu_idx_el(env, el);
404
-
405
- env->hflags = rebuild_hflags_m32(env, fp_el, mmu_idx);
406
-}
407
-
408
-/*
409
- * If we have triggered a EL state change we can't rely on the
410
- * translator having passed it to us, we need to recompute.
411
- */
412
-void HELPER(rebuild_hflags_a32_newel)(CPUARMState *env)
413
-{
414
- int el = arm_current_el(env);
415
- int fp_el = fp_exception_el(env, el);
416
- ARMMMUIdx mmu_idx = arm_mmu_idx_el(env, el);
417
- env->hflags = rebuild_hflags_a32(env, fp_el, mmu_idx);
418
-}
419
-
420
-void HELPER(rebuild_hflags_a32)(CPUARMState *env, int el)
421
-{
422
- int fp_el = fp_exception_el(env, el);
423
- ARMMMUIdx mmu_idx = arm_mmu_idx_el(env, el);
424
-
425
- env->hflags = rebuild_hflags_a32(env, fp_el, mmu_idx);
426
-}
427
-
428
-void HELPER(rebuild_hflags_a64)(CPUARMState *env, int el)
429
-{
430
- int fp_el = fp_exception_el(env, el);
431
- ARMMMUIdx mmu_idx = arm_mmu_idx_el(env, el);
432
-
433
- env->hflags = rebuild_hflags_a64(env, el, fp_el, mmu_idx);
434
-}
435
-
436
-static inline void assert_hflags_rebuild_correctly(CPUARMState *env)
437
-{
438
-#ifdef CONFIG_DEBUG_TCG
439
- CPUARMTBFlags c = env->hflags;
440
- CPUARMTBFlags r = rebuild_hflags_internal(env);
441
-
442
- if (unlikely(c.flags != r.flags || c.flags2 != r.flags2)) {
443
- fprintf(stderr, "TCG hflags mismatch "
444
- "(current:(0x%08x,0x" TARGET_FMT_lx ")"
445
- " rebuilt:(0x%08x,0x" TARGET_FMT_lx ")\n",
446
- c.flags, c.flags2, r.flags, r.flags2);
447
- abort();
448
- }
449
-#endif
450
-}
451
-
452
static bool mve_no_pred(CPUARMState *env)
453
{
454
/*
455
diff --git a/target/arm/tcg-stubs.c b/target/arm/tcg-stubs.c
456
index XXXXXXX..XXXXXXX 100644
457
--- a/target/arm/tcg-stubs.c
458
+++ b/target/arm/tcg-stubs.c
459
@@ -XXX,XX +XXX,XX @@ void raise_exception_ra(CPUARMState *env, uint32_t excp, uint32_t syndrome,
460
{
461
g_assert_not_reached();
462
}
463
+/* Temporarily while cpu_get_tb_cpu_state() is still in common code */
464
+void assert_hflags_rebuild_correctly(CPUARMState *env)
465
+{
466
+}
467
diff --git a/target/arm/tcg/hflags.c b/target/arm/tcg/hflags.c
16
new file mode 100644
468
new file mode 100644
17
index XXXXXXX..XXXXXXX
469
index XXXXXXX..XXXXXXX
18
--- /dev/null
470
--- /dev/null
19
+++ b/tests/tcg/aarch64/pcalign-a64.c
471
+++ b/target/arm/tcg/hflags.c
20
@@ -XXX,XX +XXX,XX @@
472
@@ -XXX,XX +XXX,XX @@
21
+/* Test PC misalignment exception */
473
+/*
22
+
474
+ * ARM hflags
23
+#include <assert.h>
475
+ *
24
+#include <signal.h>
476
+ * This code is licensed under the GNU GPL v2 or later.
25
+#include <stdlib.h>
477
+ *
26
+#include <stdio.h>
478
+ * SPDX-License-Identifier: GPL-2.0-or-later
27
+
479
+ */
28
+static void *expected;
480
+#include "qemu/osdep.h"
29
+
481
+#include "cpu.h"
30
+static void sigbus(int sig, siginfo_t *info, void *vuc)
482
+#include "internals.h"
31
+{
483
+#include "exec/helper-proto.h"
32
+ assert(info->si_code == BUS_ADRALN);
484
+#include "cpregs.h"
33
+ assert(info->si_addr == expected);
485
+
34
+ exit(EXIT_SUCCESS);
486
+static inline bool fgt_svc(CPUARMState *env, int el)
35
+}
487
+{
36
+
488
+ /*
37
+int main()
489
+ * Assuming fine-grained-traps are active, return true if we
38
+{
490
+ * should be trapping on SVC instructions. Only AArch64 can
39
+ void *tmp;
491
+ * trap on an SVC at EL1, but we don't need to special-case this
40
+
492
+ * because if this is AArch32 EL1 then arm_fgt_active() is false.
41
+ struct sigaction sa = {
493
+ * We also know el is 0 or 1.
42
+ .sa_sigaction = sigbus,
494
+ */
43
+ .sa_flags = SA_SIGINFO
495
+ return el == 0 ?
44
+ };
496
+ FIELD_EX64(env->cp15.fgt_exec[FGTREG_HFGITR], HFGITR_EL2, SVC_EL0) :
45
+
497
+ FIELD_EX64(env->cp15.fgt_exec[FGTREG_HFGITR], HFGITR_EL2, SVC_EL1);
46
+ if (sigaction(SIGBUS, &sa, NULL) < 0) {
498
+}
47
+ perror("sigaction");
499
+
48
+ return EXIT_FAILURE;
500
+static CPUARMTBFlags rebuild_hflags_common(CPUARMState *env, int fp_el,
49
+ }
501
+ ARMMMUIdx mmu_idx,
50
+
502
+ CPUARMTBFlags flags)
51
+ asm volatile("adr %0, 1f + 1\n\t"
503
+{
52
+ "str %0, %1\n\t"
504
+ DP_TBFLAG_ANY(flags, FPEXC_EL, fp_el);
53
+ "br %0\n"
505
+ DP_TBFLAG_ANY(flags, MMUIDX, arm_to_core_mmu_idx(mmu_idx));
54
+ "1:"
506
+
55
+ : "=&r"(tmp), "=m"(expected));
507
+ if (arm_singlestep_active(env)) {
56
+ abort();
508
+ DP_TBFLAG_ANY(flags, SS_ACTIVE, 1);
57
+}
509
+ }
58
diff --git a/tests/tcg/arm/pcalign-a32.c b/tests/tcg/arm/pcalign-a32.c
510
+
59
new file mode 100644
511
+ return flags;
60
index XXXXXXX..XXXXXXX
512
+}
61
--- /dev/null
513
+
62
+++ b/tests/tcg/arm/pcalign-a32.c
514
+static CPUARMTBFlags rebuild_hflags_common_32(CPUARMState *env, int fp_el,
63
@@ -XXX,XX +XXX,XX @@
515
+ ARMMMUIdx mmu_idx,
64
+/* Test PC misalignment exception */
516
+ CPUARMTBFlags flags)
65
+
517
+{
66
+#ifdef __thumb__
518
+ bool sctlr_b = arm_sctlr_b(env);
67
+#error "This test must be compiled for ARM"
519
+
520
+ if (sctlr_b) {
521
+ DP_TBFLAG_A32(flags, SCTLR__B, 1);
522
+ }
523
+ if (arm_cpu_data_is_big_endian_a32(env, sctlr_b)) {
524
+ DP_TBFLAG_ANY(flags, BE_DATA, 1);
525
+ }
526
+ DP_TBFLAG_A32(flags, NS, !access_secure_reg(env));
527
+
528
+ return rebuild_hflags_common(env, fp_el, mmu_idx, flags);
529
+}
530
+
531
+static CPUARMTBFlags rebuild_hflags_m32(CPUARMState *env, int fp_el,
532
+ ARMMMUIdx mmu_idx)
533
+{
534
+ CPUARMTBFlags flags = {};
535
+ uint32_t ccr = env->v7m.ccr[env->v7m.secure];
536
+
537
+ /* Without HaveMainExt, CCR.UNALIGN_TRP is RES1. */
538
+ if (ccr & R_V7M_CCR_UNALIGN_TRP_MASK) {
539
+ DP_TBFLAG_ANY(flags, ALIGN_MEM, 1);
540
+ }
541
+
542
+ if (arm_v7m_is_handler_mode(env)) {
543
+ DP_TBFLAG_M32(flags, HANDLER, 1);
544
+ }
545
+
546
+ /*
547
+ * v8M always applies stack limit checks unless CCR.STKOFHFNMIGN
548
+ * is suppressing them because the requested execution priority
549
+ * is less than 0.
550
+ */
551
+ if (arm_feature(env, ARM_FEATURE_V8) &&
552
+ !((mmu_idx & ARM_MMU_IDX_M_NEGPRI) &&
553
+ (ccr & R_V7M_CCR_STKOFHFNMIGN_MASK))) {
554
+ DP_TBFLAG_M32(flags, STACKCHECK, 1);
555
+ }
556
+
557
+ if (arm_feature(env, ARM_FEATURE_M_SECURITY) && env->v7m.secure) {
558
+ DP_TBFLAG_M32(flags, SECURE, 1);
559
+ }
560
+
561
+ return rebuild_hflags_common_32(env, fp_el, mmu_idx, flags);
562
+}
563
+
564
+/* This corresponds to the ARM pseudocode function IsFullA64Enabled(). */
565
+static bool sme_fa64(CPUARMState *env, int el)
566
+{
567
+ if (!cpu_isar_feature(aa64_sme_fa64, env_archcpu(env))) {
568
+ return false;
569
+ }
570
+
571
+ if (el <= 1 && !el_is_in_host(env, el)) {
572
+ if (!FIELD_EX64(env->vfp.smcr_el[1], SMCR, FA64)) {
573
+ return false;
574
+ }
575
+ }
576
+ if (el <= 2 && arm_is_el2_enabled(env)) {
577
+ if (!FIELD_EX64(env->vfp.smcr_el[2], SMCR, FA64)) {
578
+ return false;
579
+ }
580
+ }
581
+ if (arm_feature(env, ARM_FEATURE_EL3)) {
582
+ if (!FIELD_EX64(env->vfp.smcr_el[3], SMCR, FA64)) {
583
+ return false;
584
+ }
585
+ }
586
+
587
+ return true;
588
+}
589
+
590
+static CPUARMTBFlags rebuild_hflags_a32(CPUARMState *env, int fp_el,
591
+ ARMMMUIdx mmu_idx)
592
+{
593
+ CPUARMTBFlags flags = {};
594
+ int el = arm_current_el(env);
595
+
596
+ if (arm_sctlr(env, el) & SCTLR_A) {
597
+ DP_TBFLAG_ANY(flags, ALIGN_MEM, 1);
598
+ }
599
+
600
+ if (arm_el_is_aa64(env, 1)) {
601
+ DP_TBFLAG_A32(flags, VFPEN, 1);
602
+ }
603
+
604
+ if (el < 2 && env->cp15.hstr_el2 && arm_is_el2_enabled(env) &&
605
+ (arm_hcr_el2_eff(env) & (HCR_E2H | HCR_TGE)) != (HCR_E2H | HCR_TGE)) {
606
+ DP_TBFLAG_A32(flags, HSTR_ACTIVE, 1);
607
+ }
608
+
609
+ if (arm_fgt_active(env, el)) {
610
+ DP_TBFLAG_ANY(flags, FGT_ACTIVE, 1);
611
+ if (fgt_svc(env, el)) {
612
+ DP_TBFLAG_ANY(flags, FGT_SVC, 1);
613
+ }
614
+ }
615
+
616
+ if (env->uncached_cpsr & CPSR_IL) {
617
+ DP_TBFLAG_ANY(flags, PSTATE__IL, 1);
618
+ }
619
+
620
+ /*
621
+ * The SME exception we are testing for is raised via
622
+ * AArch64.CheckFPAdvSIMDEnabled(), as called from
623
+ * AArch32.CheckAdvSIMDOrFPEnabled().
624
+ */
625
+ if (el == 0
626
+ && FIELD_EX64(env->svcr, SVCR, SM)
627
+ && (!arm_is_el2_enabled(env)
628
+ || (arm_el_is_aa64(env, 2) && !(env->cp15.hcr_el2 & HCR_TGE)))
629
+ && arm_el_is_aa64(env, 1)
630
+ && !sme_fa64(env, el)) {
631
+ DP_TBFLAG_A32(flags, SME_TRAP_NONSTREAMING, 1);
632
+ }
633
+
634
+ return rebuild_hflags_common_32(env, fp_el, mmu_idx, flags);
635
+}
636
+
637
+static CPUARMTBFlags rebuild_hflags_a64(CPUARMState *env, int el, int fp_el,
638
+ ARMMMUIdx mmu_idx)
639
+{
640
+ CPUARMTBFlags flags = {};
641
+ ARMMMUIdx stage1 = stage_1_mmu_idx(mmu_idx);
642
+ uint64_t tcr = regime_tcr(env, mmu_idx);
643
+ uint64_t sctlr;
644
+ int tbii, tbid;
645
+
646
+ DP_TBFLAG_ANY(flags, AARCH64_STATE, 1);
647
+
648
+ /* Get control bits for tagged addresses. */
649
+ tbid = aa64_va_parameter_tbi(tcr, mmu_idx);
650
+ tbii = tbid & ~aa64_va_parameter_tbid(tcr, mmu_idx);
651
+
652
+ DP_TBFLAG_A64(flags, TBII, tbii);
653
+ DP_TBFLAG_A64(flags, TBID, tbid);
654
+
655
+ if (cpu_isar_feature(aa64_sve, env_archcpu(env))) {
656
+ int sve_el = sve_exception_el(env, el);
657
+
658
+ /*
659
+ * If either FP or SVE are disabled, translator does not need len.
660
+ * If SVE EL > FP EL, FP exception has precedence, and translator
661
+ * does not need SVE EL. Save potential re-translations by forcing
662
+ * the unneeded data to zero.
663
+ */
664
+ if (fp_el != 0) {
665
+ if (sve_el > fp_el) {
666
+ sve_el = 0;
667
+ }
668
+ } else if (sve_el == 0) {
669
+ DP_TBFLAG_A64(flags, VL, sve_vqm1_for_el(env, el));
670
+ }
671
+ DP_TBFLAG_A64(flags, SVEEXC_EL, sve_el);
672
+ }
673
+ if (cpu_isar_feature(aa64_sme, env_archcpu(env))) {
674
+ int sme_el = sme_exception_el(env, el);
675
+ bool sm = FIELD_EX64(env->svcr, SVCR, SM);
676
+
677
+ DP_TBFLAG_A64(flags, SMEEXC_EL, sme_el);
678
+ if (sme_el == 0) {
679
+ /* Similarly, do not compute SVL if SME is disabled. */
680
+ int svl = sve_vqm1_for_el_sm(env, el, true);
681
+ DP_TBFLAG_A64(flags, SVL, svl);
682
+ if (sm) {
683
+ /* If SVE is disabled, we will not have set VL above. */
684
+ DP_TBFLAG_A64(flags, VL, svl);
685
+ }
686
+ }
687
+ if (sm) {
688
+ DP_TBFLAG_A64(flags, PSTATE_SM, 1);
689
+ DP_TBFLAG_A64(flags, SME_TRAP_NONSTREAMING, !sme_fa64(env, el));
690
+ }
691
+ DP_TBFLAG_A64(flags, PSTATE_ZA, FIELD_EX64(env->svcr, SVCR, ZA));
692
+ }
693
+
694
+ sctlr = regime_sctlr(env, stage1);
695
+
696
+ if (sctlr & SCTLR_A) {
697
+ DP_TBFLAG_ANY(flags, ALIGN_MEM, 1);
698
+ }
699
+
700
+ if (arm_cpu_data_is_big_endian_a64(el, sctlr)) {
701
+ DP_TBFLAG_ANY(flags, BE_DATA, 1);
702
+ }
703
+
704
+ if (cpu_isar_feature(aa64_pauth, env_archcpu(env))) {
705
+ /*
706
+ * In order to save space in flags, we record only whether
707
+ * pauth is "inactive", meaning all insns are implemented as
708
+ * a nop, or "active" when some action must be performed.
709
+ * The decision of which action to take is left to a helper.
710
+ */
711
+ if (sctlr & (SCTLR_EnIA | SCTLR_EnIB | SCTLR_EnDA | SCTLR_EnDB)) {
712
+ DP_TBFLAG_A64(flags, PAUTH_ACTIVE, 1);
713
+ }
714
+ }
715
+
716
+ if (cpu_isar_feature(aa64_bti, env_archcpu(env))) {
717
+ /* Note that SCTLR_EL[23].BT == SCTLR_BT1. */
718
+ if (sctlr & (el == 0 ? SCTLR_BT0 : SCTLR_BT1)) {
719
+ DP_TBFLAG_A64(flags, BT, 1);
720
+ }
721
+ }
722
+
723
+ /* Compute the condition for using AccType_UNPRIV for LDTR et al. */
724
+ if (!(env->pstate & PSTATE_UAO)) {
725
+ switch (mmu_idx) {
726
+ case ARMMMUIdx_E10_1:
727
+ case ARMMMUIdx_E10_1_PAN:
728
+ /* TODO: ARMv8.3-NV */
729
+ DP_TBFLAG_A64(flags, UNPRIV, 1);
730
+ break;
731
+ case ARMMMUIdx_E20_2:
732
+ case ARMMMUIdx_E20_2_PAN:
733
+ /*
734
+ * Note that EL20_2 is gated by HCR_EL2.E2H == 1, but EL20_0 is
735
+ * gated by HCR_EL2.<E2H,TGE> == '11', and so is LDTR.
736
+ */
737
+ if (env->cp15.hcr_el2 & HCR_TGE) {
738
+ DP_TBFLAG_A64(flags, UNPRIV, 1);
739
+ }
740
+ break;
741
+ default:
742
+ break;
743
+ }
744
+ }
745
+
746
+ if (env->pstate & PSTATE_IL) {
747
+ DP_TBFLAG_ANY(flags, PSTATE__IL, 1);
748
+ }
749
+
750
+ if (arm_fgt_active(env, el)) {
751
+ DP_TBFLAG_ANY(flags, FGT_ACTIVE, 1);
752
+ if (FIELD_EX64(env->cp15.fgt_exec[FGTREG_HFGITR], HFGITR_EL2, ERET)) {
753
+ DP_TBFLAG_A64(flags, FGT_ERET, 1);
754
+ }
755
+ if (fgt_svc(env, el)) {
756
+ DP_TBFLAG_ANY(flags, FGT_SVC, 1);
757
+ }
758
+ }
759
+
760
+ if (cpu_isar_feature(aa64_mte, env_archcpu(env))) {
761
+ /*
762
+ * Set MTE_ACTIVE if any access may be Checked, and leave clear
763
+ * if all accesses must be Unchecked:
764
+ * 1) If no TBI, then there are no tags in the address to check,
765
+ * 2) If Tag Check Override, then all accesses are Unchecked,
766
+ * 3) If Tag Check Fail == 0, then Checked access have no effect,
767
+ * 4) If no Allocation Tag Access, then all accesses are Unchecked.
768
+ */
769
+ if (allocation_tag_access_enabled(env, el, sctlr)) {
770
+ DP_TBFLAG_A64(flags, ATA, 1);
771
+ if (tbid
772
+ && !(env->pstate & PSTATE_TCO)
773
+ && (sctlr & (el == 0 ? SCTLR_TCF0 : SCTLR_TCF))) {
774
+ DP_TBFLAG_A64(flags, MTE_ACTIVE, 1);
775
+ }
776
+ }
777
+ /* And again for unprivileged accesses, if required. */
778
+ if (EX_TBFLAG_A64(flags, UNPRIV)
779
+ && tbid
780
+ && !(env->pstate & PSTATE_TCO)
781
+ && (sctlr & SCTLR_TCF0)
782
+ && allocation_tag_access_enabled(env, 0, sctlr)) {
783
+ DP_TBFLAG_A64(flags, MTE0_ACTIVE, 1);
784
+ }
785
+ /* Cache TCMA as well as TBI. */
786
+ DP_TBFLAG_A64(flags, TCMA, aa64_va_parameter_tcma(tcr, mmu_idx));
787
+ }
788
+
789
+ return rebuild_hflags_common(env, fp_el, mmu_idx, flags);
790
+}
791
+
792
+static CPUARMTBFlags rebuild_hflags_internal(CPUARMState *env)
793
+{
794
+ int el = arm_current_el(env);
795
+ int fp_el = fp_exception_el(env, el);
796
+ ARMMMUIdx mmu_idx = arm_mmu_idx_el(env, el);
797
+
798
+ if (is_a64(env)) {
799
+ return rebuild_hflags_a64(env, el, fp_el, mmu_idx);
800
+ } else if (arm_feature(env, ARM_FEATURE_M)) {
801
+ return rebuild_hflags_m32(env, fp_el, mmu_idx);
802
+ } else {
803
+ return rebuild_hflags_a32(env, fp_el, mmu_idx);
804
+ }
805
+}
806
+
807
+void arm_rebuild_hflags(CPUARMState *env)
808
+{
809
+ env->hflags = rebuild_hflags_internal(env);
810
+}
811
+
812
+/*
813
+ * If we have triggered a EL state change we can't rely on the
814
+ * translator having passed it to us, we need to recompute.
815
+ */
816
+void HELPER(rebuild_hflags_m32_newel)(CPUARMState *env)
817
+{
818
+ int el = arm_current_el(env);
819
+ int fp_el = fp_exception_el(env, el);
820
+ ARMMMUIdx mmu_idx = arm_mmu_idx_el(env, el);
821
+
822
+ env->hflags = rebuild_hflags_m32(env, fp_el, mmu_idx);
823
+}
824
+
825
+void HELPER(rebuild_hflags_m32)(CPUARMState *env, int el)
826
+{
827
+ int fp_el = fp_exception_el(env, el);
828
+ ARMMMUIdx mmu_idx = arm_mmu_idx_el(env, el);
829
+
830
+ env->hflags = rebuild_hflags_m32(env, fp_el, mmu_idx);
831
+}
832
+
833
+/*
834
+ * If we have triggered a EL state change we can't rely on the
835
+ * translator having passed it to us, we need to recompute.
836
+ */
837
+void HELPER(rebuild_hflags_a32_newel)(CPUARMState *env)
838
+{
839
+ int el = arm_current_el(env);
840
+ int fp_el = fp_exception_el(env, el);
841
+ ARMMMUIdx mmu_idx = arm_mmu_idx_el(env, el);
842
+ env->hflags = rebuild_hflags_a32(env, fp_el, mmu_idx);
843
+}
844
+
845
+void HELPER(rebuild_hflags_a32)(CPUARMState *env, int el)
846
+{
847
+ int fp_el = fp_exception_el(env, el);
848
+ ARMMMUIdx mmu_idx = arm_mmu_idx_el(env, el);
849
+
850
+ env->hflags = rebuild_hflags_a32(env, fp_el, mmu_idx);
851
+}
852
+
853
+void HELPER(rebuild_hflags_a64)(CPUARMState *env, int el)
854
+{
855
+ int fp_el = fp_exception_el(env, el);
856
+ ARMMMUIdx mmu_idx = arm_mmu_idx_el(env, el);
857
+
858
+ env->hflags = rebuild_hflags_a64(env, el, fp_el, mmu_idx);
859
+}
860
+
861
+void assert_hflags_rebuild_correctly(CPUARMState *env)
862
+{
863
+#ifdef CONFIG_DEBUG_TCG
864
+ CPUARMTBFlags c = env->hflags;
865
+ CPUARMTBFlags r = rebuild_hflags_internal(env);
866
+
867
+ if (unlikely(c.flags != r.flags || c.flags2 != r.flags2)) {
868
+ fprintf(stderr, "TCG hflags mismatch "
869
+ "(current:(0x%08x,0x" TARGET_FMT_lx ")"
870
+ " rebuilt:(0x%08x,0x" TARGET_FMT_lx ")\n",
871
+ c.flags, c.flags2, r.flags, r.flags2);
872
+ abort();
873
+ }
68
+#endif
874
+#endif
69
+
875
+}
70
+#include <assert.h>
876
diff --git a/target/arm/tcg/meson.build b/target/arm/tcg/meson.build
71
+#include <signal.h>
72
+#include <stdlib.h>
73
+#include <stdio.h>
74
+
75
+static void *expected;
76
+
77
+static void sigbus(int sig, siginfo_t *info, void *vuc)
78
+{
79
+ assert(info->si_code == BUS_ADRALN);
80
+ assert(info->si_addr == expected);
81
+ exit(EXIT_SUCCESS);
82
+}
83
+
84
+int main()
85
+{
86
+ void *tmp;
87
+
88
+ struct sigaction sa = {
89
+ .sa_sigaction = sigbus,
90
+ .sa_flags = SA_SIGINFO
91
+ };
92
+
93
+ if (sigaction(SIGBUS, &sa, NULL) < 0) {
94
+ perror("sigaction");
95
+ return EXIT_FAILURE;
96
+ }
97
+
98
+ asm volatile("adr %0, 1f + 2\n\t"
99
+ "str %0, %1\n\t"
100
+ "bx %0\n"
101
+ "1:"
102
+ : "=&r"(tmp), "=m"(expected));
103
+
104
+ /*
105
+ * From v8, it is CONSTRAINED UNPREDICTABLE whether BXWritePC aligns
106
+ * the address or not. If so, we can legitimately fall through.
107
+ */
108
+ return EXIT_SUCCESS;
109
+}
110
diff --git a/tests/tcg/aarch64/Makefile.target b/tests/tcg/aarch64/Makefile.target
111
index XXXXXXX..XXXXXXX 100644
877
index XXXXXXX..XXXXXXX 100644
112
--- a/tests/tcg/aarch64/Makefile.target
878
--- a/target/arm/tcg/meson.build
113
+++ b/tests/tcg/aarch64/Makefile.target
879
+++ b/target/arm/tcg/meson.build
114
@@ -XXX,XX +XXX,XX @@ VPATH         += $(ARM_SRC)
880
@@ -XXX,XX +XXX,XX @@ arm_ss.add(files(
115
AARCH64_SRC=$(SRC_PATH)/tests/tcg/aarch64
881
'translate-neon.c',
116
VPATH         += $(AARCH64_SRC)
882
'translate-vfp.c',
117
883
'crypto_helper.c',
118
-# Float-convert Tests
884
+ 'hflags.c',
119
-AARCH64_TESTS=fcvt
885
'iwmmxt_helper.c',
120
+# Base architecture tests
886
'm_helper.c',
121
+AARCH64_TESTS=fcvt pcalign-a64
887
'mve_helper.c',
122
123
fcvt: LDFLAGS+=-lm
124
125
diff --git a/tests/tcg/arm/Makefile.target b/tests/tcg/arm/Makefile.target
126
index XXXXXXX..XXXXXXX 100644
127
--- a/tests/tcg/arm/Makefile.target
128
+++ b/tests/tcg/arm/Makefile.target
129
@@ -XXX,XX +XXX,XX @@ run-fcvt: fcvt
130
    $(call run-test,fcvt,$(QEMU) $<,"$< on $(TARGET_NAME)")
131
    $(call diff-out,fcvt,$(ARM_SRC)/fcvt.ref)
132
133
+# PC alignment test
134
+ARM_TESTS += pcalign-a32
135
+pcalign-a32: CFLAGS+=-marm
136
+
137
ifeq ($(CONFIG_ARM_COMPATIBLE_SEMIHOSTING),y)
138
139
# Semihosting smoke test for linux-user
140
--
888
--
141
2.25.1
889
2.34.1
142
890
143
891
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
From: Fabiano Rosas <farosas@suse.de>
2
2
3
For A64, any input to an indirect branch can cause this.
3
This function is needed by common code (ptw.c), so move it along with
4
the other regime_* functions in internal.h. When we enable the build
5
without TCG, the tlb_helper.c file will not be present.
4
6
5
For A32, many indirect branch paths force the branch to be aligned,
7
Signed-off-by: Fabiano Rosas <farosas@suse.de>
6
but BXWritePC does not. This includes the BX instruction but also
8
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
7
other interworking changes to PC. Prior to v8, this case is UNDEFINED.
9
Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org>
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>
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
18
---
11
---
19
target/arm/helper.h | 1 +
12
target/arm/internals.h | 21 ++++++++++++++++++---
20
target/arm/syndrome.h | 5 ++++
13
target/arm/tcg/tlb_helper.c | 18 ------------------
21
linux-user/aarch64/cpu_loop.c | 46 ++++++++++++++++++++---------------
14
2 files changed, 18 insertions(+), 21 deletions(-)
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
15
27
diff --git a/target/arm/helper.h b/target/arm/helper.h
16
diff --git a/target/arm/internals.h b/target/arm/internals.h
28
index XXXXXXX..XXXXXXX 100644
17
index XXXXXXX..XXXXXXX 100644
29
--- a/target/arm/helper.h
18
--- a/target/arm/internals.h
30
+++ b/target/arm/helper.h
19
+++ b/target/arm/internals.h
31
@@ -XXX,XX +XXX,XX @@ DEF_HELPER_FLAGS_3(sel_flags, TCG_CALL_NO_RWG_SE,
20
@@ -XXX,XX +XXX,XX @@ int arm_mmu_idx_to_el(ARMMMUIdx mmu_idx);
32
DEF_HELPER_2(exception_internal, void, env, i32)
21
/* Return the MMU index for a v7M CPU in the specified security state */
33
DEF_HELPER_4(exception_with_syndrome, void, env, i32, i32, i32)
22
ARMMMUIdx arm_v7m_mmu_idx_for_secstate(CPUARMState *env, bool secstate);
34
DEF_HELPER_2(exception_bkpt_insn, void, env, i32)
23
35
+DEF_HELPER_2(exception_pc_alignment, noreturn, env, tl)
24
-/* Return true if the translation regime is using LPAE format page tables */
36
DEF_HELPER_1(setend, void, env)
25
-bool regime_using_lpae_format(CPUARMState *env, ARMMMUIdx mmu_idx);
37
DEF_HELPER_2(wfi, void, env, i32)
26
-
38
DEF_HELPER_1(wfe, void, env)
27
/*
39
diff --git a/target/arm/syndrome.h b/target/arm/syndrome.h
28
* Return true if the stage 1 translation regime is using LPAE
40
index XXXXXXX..XXXXXXX 100644
29
* format page tables
41
--- a/target/arm/syndrome.h
30
@@ -XXX,XX +XXX,XX @@ static inline uint64_t regime_tcr(CPUARMState *env, ARMMMUIdx mmu_idx)
42
+++ b/target/arm/syndrome.h
31
return env->cp15.tcr_el[regime_el(env, mmu_idx)];
43
@@ -XXX,XX +XXX,XX @@ static inline uint32_t syn_illegalstate(void)
44
return (EC_ILLEGALSTATE << ARM_EL_EC_SHIFT) | ARM_EL_IL;
45
}
32
}
46
33
47
+static inline uint32_t syn_pcalignment(void)
34
+/* Return true if the translation regime is using LPAE format page tables */
35
+static inline bool regime_using_lpae_format(CPUARMState *env, ARMMMUIdx mmu_idx)
48
+{
36
+{
49
+ return (EC_PCALIGNMENT << ARM_EL_EC_SHIFT) | ARM_EL_IL;
37
+ int el = regime_el(env, mmu_idx);
38
+ if (el == 2 || arm_el_is_aa64(env, el)) {
39
+ return true;
40
+ }
41
+ if (arm_feature(env, ARM_FEATURE_PMSA) &&
42
+ arm_feature(env, ARM_FEATURE_V8)) {
43
+ return true;
44
+ }
45
+ if (arm_feature(env, ARM_FEATURE_LPAE)
46
+ && (regime_tcr(env, mmu_idx) & TTBCR_EAE)) {
47
+ return true;
48
+ }
49
+ return false;
50
+}
50
+}
51
+
51
+
52
#endif /* TARGET_ARM_SYNDROME_H */
52
/**
53
diff --git a/linux-user/aarch64/cpu_loop.c b/linux-user/aarch64/cpu_loop.c
53
* arm_num_brps: Return number of implemented breakpoints.
54
* Note that the ID register BRPS field is "number of bps - 1",
55
diff --git a/target/arm/tcg/tlb_helper.c b/target/arm/tcg/tlb_helper.c
54
index XXXXXXX..XXXXXXX 100644
56
index XXXXXXX..XXXXXXX 100644
55
--- a/linux-user/aarch64/cpu_loop.c
57
--- a/target/arm/tcg/tlb_helper.c
56
+++ b/linux-user/aarch64/cpu_loop.c
58
+++ b/target/arm/tcg/tlb_helper.c
57
@@ -XXX,XX +XXX,XX @@ void cpu_loop(CPUARMState *env)
59
@@ -XXX,XX +XXX,XX @@
58
break;
60
#include "exec/helper-proto.h"
59
case EXCP_PREFETCH_ABORT:
61
60
case EXCP_DATA_ABORT:
62
61
- /* We should only arrive here with EC in {DATAABORT, INSNABORT}. */
63
-/* Return true if the translation regime is using LPAE format page tables */
62
ec = syn_get_ec(env->exception.syndrome);
64
-bool regime_using_lpae_format(CPUARMState *env, ARMMMUIdx mmu_idx)
63
- assert(ec == EC_DATAABORT || ec == EC_INSNABORT);
65
-{
66
- int el = regime_el(env, mmu_idx);
67
- if (el == 2 || arm_el_is_aa64(env, el)) {
68
- return true;
69
- }
70
- if (arm_feature(env, ARM_FEATURE_PMSA) &&
71
- arm_feature(env, ARM_FEATURE_V8)) {
72
- return true;
73
- }
74
- if (arm_feature(env, ARM_FEATURE_LPAE)
75
- && (regime_tcr(env, mmu_idx) & TTBCR_EAE)) {
76
- return true;
77
- }
78
- return false;
79
-}
64
-
80
-
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
/*
81
/*
148
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
82
* Returns true if the stage 1 translation regime is using LPAE format page
149
index XXXXXXX..XXXXXXX 100644
83
* tables. Used when raising alignment exceptions, whose FSR changes depending
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
--
84
--
215
2.25.1
85
2.34.1
216
86
217
87
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
From: Fabiano Rosas <farosas@suse.de>
2
2
3
We will reuse this section of arm_deliver_fault for
3
When TCG is disabled this part of the code should not be reachable, so
4
raising pc alignment faults.
4
wrap it with an ifdef for now.
5
5
6
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
6
Signed-off-by: Fabiano Rosas <farosas@suse.de>
7
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
7
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
8
Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org>
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
---
10
---
10
target/arm/tlb_helper.c | 45 +++++++++++++++++++++++++----------------
11
target/arm/ptw.c | 4 ++++
11
1 file changed, 28 insertions(+), 17 deletions(-)
12
1 file changed, 4 insertions(+)
12
13
13
diff --git a/target/arm/tlb_helper.c b/target/arm/tlb_helper.c
14
diff --git a/target/arm/ptw.c b/target/arm/ptw.c
14
index XXXXXXX..XXXXXXX 100644
15
index XXXXXXX..XXXXXXX 100644
15
--- a/target/arm/tlb_helper.c
16
--- a/target/arm/ptw.c
16
+++ b/target/arm/tlb_helper.c
17
+++ b/target/arm/ptw.c
17
@@ -XXX,XX +XXX,XX @@ static inline uint32_t merge_syn_data_abort(uint32_t template_syn,
18
@@ -XXX,XX +XXX,XX @@ static bool S1_ptw_translate(CPUARMState *env, S1Translate *ptw,
18
return syn;
19
ptw->out_host = NULL;
19
}
20
ptw->out_rw = false;
20
21
} else {
21
-static void QEMU_NORETURN arm_deliver_fault(ARMCPU *cpu, vaddr addr,
22
+#ifdef CONFIG_TCG
22
- MMUAccessType access_type,
23
CPUTLBEntryFull *full;
23
- int mmu_idx, ARMMMUFaultInfo *fi)
24
int flags;
24
+static uint32_t compute_fsr_fsc(CPUARMState *env, ARMMMUFaultInfo *fi,
25
25
+ int target_el, int mmu_idx, uint32_t *ret_fsc)
26
@@ -XXX,XX +XXX,XX @@ static bool S1_ptw_translate(CPUARMState *env, S1Translate *ptw,
26
{
27
ptw->out_rw = full->prot & PAGE_WRITE;
27
- CPUARMState *env = &cpu->env;
28
pte_attrs = full->pte_attrs;
28
- int target_el;
29
pte_secure = full->attrs.secure;
29
- bool same_el;
30
+#else
30
- uint32_t syn, exc, fsr, fsc;
31
+ g_assert_not_reached();
31
ARMMMUIdx arm_mmu_idx = core_to_arm_mmu_idx(env, mmu_idx);
32
+#endif
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
}
33
}
49
34
50
+ *ret_fsc = fsc;
35
if (regime_is_stage2(s2_mmu_idx)) {
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
--
36
--
79
2.25.1
37
2.34.1
80
38
81
39
diff view generated by jsdifflib
1
From: Jean-Philippe Brucker <jean-philippe@linaro.org>
1
From: Fabiano Rosas <farosas@suse.de>
2
2
3
To propagate errors to the caller of the pre_plug callback, use the
3
This struct has no dependencies on TCG code and it is being used in
4
object_poperty_set*() functions directly instead of the qdev_prop_set*()
4
target/arm/ptw.c to simplify the passing around of page table walk
5
helpers.
5
results. Those routines can be reached by KVM code via the gdbstub
6
breakpoint code, so take the structure out of CONFIG_TCG to make it
7
visible when building with --disable-tcg.
6
8
7
Suggested-by: Igor Mammedov <imammedo@redhat.com>
9
Signed-off-by: Fabiano Rosas <farosas@suse.de>
8
Reviewed-by: Eric Auger <eric.auger@redhat.com>
10
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
9
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
11
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
10
Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
12
Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org>
11
Message-id: 20211210170415.583179-5-jean-philippe@linaro.org
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
---
14
---
14
hw/arm/virt.c | 5 +++--
15
include/exec/cpu-defs.h | 6 ++++++
15
1 file changed, 3 insertions(+), 2 deletions(-)
16
1 file changed, 6 insertions(+)
16
17
17
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
18
diff --git a/include/exec/cpu-defs.h b/include/exec/cpu-defs.h
18
index XXXXXXX..XXXXXXX 100644
19
index XXXXXXX..XXXXXXX 100644
19
--- a/hw/arm/virt.c
20
--- a/include/exec/cpu-defs.h
20
+++ b/hw/arm/virt.c
21
+++ b/include/exec/cpu-defs.h
21
@@ -XXX,XX +XXX,XX @@ static void virt_machine_device_pre_plug_cb(HotplugHandler *hotplug_dev,
22
@@ -XXX,XX +XXX,XX @@ typedef struct CPUTLBEntry {
22
db_start, db_end,
23
23
VIRTIO_IOMMU_RESV_MEM_T_MSI);
24
QEMU_BUILD_BUG_ON(sizeof(CPUTLBEntry) != (1 << CPU_TLB_ENTRY_BITS));
24
25
25
- qdev_prop_set_uint32(dev, "len-reserved-regions", 1);
26
+
26
- qdev_prop_set_string(dev, "reserved-regions[0]", resv_prop_str);
27
+#endif /* !CONFIG_USER_ONLY && CONFIG_TCG */
27
+ object_property_set_uint(OBJECT(dev), "len-reserved-regions", 1, errp);
28
+
28
+ object_property_set_str(OBJECT(dev), "reserved-regions[0]",
29
+#if !defined(CONFIG_USER_ONLY)
29
+ resv_prop_str, errp);
30
/*
30
g_free(resv_prop_str);
31
* The full TLB entry, which is not accessed by generated TCG code,
31
}
32
* so the layout is not as critical as that of CPUTLBEntry. This is
32
}
33
@@ -XXX,XX +XXX,XX @@ typedef struct CPUTLBEntryFull {
34
TARGET_PAGE_ENTRY_EXTRA
35
#endif
36
} CPUTLBEntryFull;
37
+#endif /* !CONFIG_USER_ONLY */
38
39
+#if !defined(CONFIG_USER_ONLY) && defined(CONFIG_TCG)
40
/*
41
* Data elements that are per MMU mode, minus the bits accessed by
42
* the TCG fast path.
33
--
43
--
34
2.25.1
44
2.34.1
35
45
36
46
diff view generated by jsdifflib
1
From: Jean-Philippe Brucker <jean-philippe@linaro.org>
1
From: Fabiano Rosas <farosas@suse.de>
2
2
3
We do not support instantiating multiple IOMMUs. Before adding a
3
This test currently fails when run on a host for which the QEMU target
4
virtio-iommu, check that no other IOMMU is present. This will detect
4
has no default machine set:
5
both "iommu=smmuv3" machine parameter and another virtio-iommu instance.
6
5
7
Fixes: 70e89132c9 ("hw/arm/virt: Add the virtio-iommu device tree mappings")
6
ERROR| Output: qemu-system-aarch64: No machine specified, and there is
8
Reviewed-by: Eric Auger <eric.auger@redhat.com>
7
no default
9
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
8
10
Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
9
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
11
Message-id: 20211210170415.583179-4-jean-philippe@linaro.org
10
Signed-off-by: Fabiano Rosas <farosas@suse.de>
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
---
12
---
14
hw/arm/virt.c | 5 +++++
13
tests/avocado/version.py | 1 +
15
1 file changed, 5 insertions(+)
14
1 file changed, 1 insertion(+)
16
15
17
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
16
diff --git a/tests/avocado/version.py b/tests/avocado/version.py
18
index XXXXXXX..XXXXXXX 100644
17
index XXXXXXX..XXXXXXX 100644
19
--- a/hw/arm/virt.c
18
--- a/tests/avocado/version.py
20
+++ b/hw/arm/virt.c
19
+++ b/tests/avocado/version.py
21
@@ -XXX,XX +XXX,XX @@ static void virt_machine_device_pre_plug_cb(HotplugHandler *hotplug_dev,
20
@@ -XXX,XX +XXX,XX @@
22
hwaddr db_start = 0, db_end = 0;
21
class Version(QemuSystemTest):
23
char *resv_prop_str;
22
"""
24
23
:avocado: tags=quick
25
+ if (vms->iommu != VIRT_IOMMU_NONE) {
24
+ :avocado: tags=machine:none
26
+ error_setg(errp, "virt machine does not support multiple IOMMUs");
25
"""
27
+ return;
26
def test_qmp_human_info_version(self):
28
+ }
27
self.vm.add_args('-nodefaults')
29
+
30
switch (vms->msi_controller) {
31
case VIRT_MSI_CTRL_NONE:
32
return;
33
--
28
--
34
2.25.1
29
2.34.1
35
30
36
31
diff view generated by jsdifflib
1
From: Jean-Philippe Brucker <jean-philippe@linaro.org>
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
2
2
3
virtio-iommu is now supported with ACPI VIOT as well as device tree.
3
Since &I2C_SLAVE(dev)->qdev == dev, no need to go back and
4
Remove the restriction that prevents from instantiating a virtio-iommu
4
forth with QOM type casting. Directly use 'dev'.
5
device under ACPI.
6
5
7
Acked-by: Igor Mammedov <imammedo@redhat.com>
6
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
8
Reviewed-by: Eric Auger <eric.auger@redhat.com>
7
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
9
Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
8
Message-id: 20230220115114.25237-2-philmd@linaro.org
10
Message-id: 20211210170415.583179-3-jean-philippe@linaro.org
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
---
10
---
13
hw/arm/virt.c | 10 ++--------
11
hw/gpio/max7310.c | 5 ++---
14
hw/virtio/virtio-iommu-pci.c | 12 ++----------
12
1 file changed, 2 insertions(+), 3 deletions(-)
15
2 files changed, 4 insertions(+), 18 deletions(-)
16
13
17
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
14
diff --git a/hw/gpio/max7310.c b/hw/gpio/max7310.c
18
index XXXXXXX..XXXXXXX 100644
15
index XXXXXXX..XXXXXXX 100644
19
--- a/hw/arm/virt.c
16
--- a/hw/gpio/max7310.c
20
+++ b/hw/arm/virt.c
17
+++ b/hw/gpio/max7310.c
21
@@ -XXX,XX +XXX,XX @@ static HotplugHandler *virt_machine_get_hotplug_handler(MachineState *machine,
18
@@ -XXX,XX +XXX,XX @@ static void max7310_gpio_set(void *opaque, int line, int level)
22
MachineClass *mc = MACHINE_GET_CLASS(machine);
19
* but also accepts sequences that are not SMBus so return an I2C device. */
23
20
static void max7310_realize(DeviceState *dev, Error **errp)
24
if (device_is_dynamic_sysbus(mc, dev) ||
21
{
25
- (object_dynamic_cast(OBJECT(dev), TYPE_PC_DIMM))) {
22
- I2CSlave *i2c = I2C_SLAVE(dev);
26
+ object_dynamic_cast(OBJECT(dev), TYPE_PC_DIMM) ||
23
MAX7310State *s = MAX7310(dev);
27
+ object_dynamic_cast(OBJECT(dev), TYPE_VIRTIO_IOMMU_PCI)) {
24
28
return HOTPLUG_HANDLER(machine);
25
- qdev_init_gpio_in(&i2c->qdev, max7310_gpio_set, 8);
29
}
26
- qdev_init_gpio_out(&i2c->qdev, s->handler, 8);
30
- if (object_dynamic_cast(OBJECT(dev), TYPE_VIRTIO_IOMMU_PCI)) {
27
+ qdev_init_gpio_in(dev, max7310_gpio_set, ARRAY_SIZE(s->handler));
31
- VirtMachineState *vms = VIRT_MACHINE(machine);
28
+ qdev_init_gpio_out(dev, s->handler, ARRAY_SIZE(s->handler));
32
-
33
- if (!vms->bootinfo.firmware_loaded || !virt_is_acpi_enabled(vms)) {
34
- return HOTPLUG_HANDLER(machine);
35
- }
36
- }
37
return NULL;
38
}
29
}
39
30
40
diff --git a/hw/virtio/virtio-iommu-pci.c b/hw/virtio/virtio-iommu-pci.c
31
static void max7310_class_init(ObjectClass *klass, void *data)
41
index XXXXXXX..XXXXXXX 100644
42
--- a/hw/virtio/virtio-iommu-pci.c
43
+++ b/hw/virtio/virtio-iommu-pci.c
44
@@ -XXX,XX +XXX,XX @@ static void virtio_iommu_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp)
45
VirtIOIOMMU *s = VIRTIO_IOMMU(vdev);
46
47
if (!qdev_get_machine_hotplug_handler(DEVICE(vpci_dev))) {
48
- MachineClass *mc = MACHINE_GET_CLASS(qdev_get_machine());
49
-
50
- error_setg(errp,
51
- "%s machine fails to create iommu-map device tree bindings",
52
- mc->name);
53
- error_append_hint(errp,
54
- "Check your machine implements a hotplug handler "
55
- "for the virtio-iommu-pci device\n");
56
- error_append_hint(errp, "Check the guest is booted without FW or with "
57
- "-no-acpi\n");
58
+ error_setg(errp, "Check your machine implements a hotplug handler "
59
+ "for the virtio-iommu-pci device");
60
return;
61
}
62
for (int i = 0; i < s->nb_reserved_regions; i++) {
63
--
32
--
64
2.25.1
33
2.34.1
65
34
66
35
diff view generated by jsdifflib
1
A lot of C files in hw/arm include qemu-common.h when they don't
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
2
need anything from it. Drop the include lines.
3
2
4
omap1.c, pxa2xx.c and strongarm.c retain the include because they
3
pl011_create() is only used in DeviceRealize handlers,
5
use it for the prototype of qemu_get_timedate().
4
not a hot-path. Inlining is not justified.
6
5
6
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
7
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
8
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
9
Message-id: 20230220115114.25237-3-philmd@linaro.org
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
Signed-off-by: Peter Maydell <peter.maydell@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
13
---
11
---
14
hw/arm/boot.c | 1 -
12
include/hw/char/pl011.h | 19 +------------------
15
hw/arm/digic_boards.c | 1 -
13
hw/char/pl011.c | 17 +++++++++++++++++
16
hw/arm/highbank.c | 1 -
14
2 files changed, 18 insertions(+), 18 deletions(-)
17
hw/arm/npcm7xx_boards.c | 1 -
18
hw/arm/sbsa-ref.c | 1 -
19
hw/arm/stm32f405_soc.c | 1 -
20
hw/arm/vexpress.c | 1 -
21
hw/arm/virt.c | 1 -
22
8 files changed, 8 deletions(-)
23
15
24
diff --git a/hw/arm/boot.c b/hw/arm/boot.c
16
diff --git a/include/hw/char/pl011.h b/include/hw/char/pl011.h
25
index XXXXXXX..XXXXXXX 100644
17
index XXXXXXX..XXXXXXX 100644
26
--- a/hw/arm/boot.c
18
--- a/include/hw/char/pl011.h
27
+++ b/hw/arm/boot.c
19
+++ b/include/hw/char/pl011.h
20
@@ -XXX,XX +XXX,XX @@
21
#ifndef HW_PL011_H
22
#define HW_PL011_H
23
24
-#include "hw/qdev-properties.h"
25
#include "hw/sysbus.h"
26
#include "chardev/char-fe.h"
27
-#include "qapi/error.h"
28
#include "qom/object.h"
29
30
#define TYPE_PL011 "pl011"
31
@@ -XXX,XX +XXX,XX @@ struct PL011State {
32
const unsigned char *id;
33
};
34
35
-static inline DeviceState *pl011_create(hwaddr addr,
36
- qemu_irq irq,
37
- Chardev *chr)
38
-{
39
- DeviceState *dev;
40
- SysBusDevice *s;
41
-
42
- dev = qdev_new("pl011");
43
- s = SYS_BUS_DEVICE(dev);
44
- qdev_prop_set_chr(dev, "chardev", chr);
45
- sysbus_realize_and_unref(s, &error_fatal);
46
- sysbus_mmio_map(s, 0, addr);
47
- sysbus_connect_irq(s, 0, irq);
48
-
49
- return dev;
50
-}
51
+DeviceState *pl011_create(hwaddr addr, qemu_irq irq, Chardev *chr);
52
53
static inline DeviceState *pl011_luminary_create(hwaddr addr,
54
qemu_irq irq,
55
diff --git a/hw/char/pl011.c b/hw/char/pl011.c
56
index XXXXXXX..XXXXXXX 100644
57
--- a/hw/char/pl011.c
58
+++ b/hw/char/pl011.c
28
@@ -XXX,XX +XXX,XX @@
59
@@ -XXX,XX +XXX,XX @@
29
*/
60
*/
30
61
31
#include "qemu/osdep.h"
62
#include "qemu/osdep.h"
32
-#include "qemu-common.h"
63
+#include "qapi/error.h"
33
#include "qemu/datadir.h"
64
#include "hw/char/pl011.h"
34
#include "qemu/error-report.h"
65
#include "hw/irq.h"
35
#include "qapi/error.h"
66
#include "hw/sysbus.h"
36
diff --git a/hw/arm/digic_boards.c b/hw/arm/digic_boards.c
67
#include "hw/qdev-clock.h"
37
index XXXXXXX..XXXXXXX 100644
68
+#include "hw/qdev-properties.h"
38
--- a/hw/arm/digic_boards.c
69
#include "hw/qdev-properties-system.h"
39
+++ b/hw/arm/digic_boards.c
70
#include "migration/vmstate.h"
71
#include "chardev/char-fe.h"
40
@@ -XXX,XX +XXX,XX @@
72
@@ -XXX,XX +XXX,XX @@
41
73
#include "qemu/module.h"
42
#include "qemu/osdep.h"
74
#include "trace.h"
43
#include "qapi/error.h"
75
44
-#include "qemu-common.h"
76
+DeviceState *pl011_create(hwaddr addr, qemu_irq irq, Chardev *chr)
45
#include "qemu/datadir.h"
77
+{
46
#include "hw/boards.h"
78
+ DeviceState *dev;
47
#include "qemu/error-report.h"
79
+ SysBusDevice *s;
48
diff --git a/hw/arm/highbank.c b/hw/arm/highbank.c
80
+
49
index XXXXXXX..XXXXXXX 100644
81
+ dev = qdev_new("pl011");
50
--- a/hw/arm/highbank.c
82
+ s = SYS_BUS_DEVICE(dev);
51
+++ b/hw/arm/highbank.c
83
+ qdev_prop_set_chr(dev, "chardev", chr);
52
@@ -XXX,XX +XXX,XX @@
84
+ sysbus_realize_and_unref(s, &error_fatal);
53
*/
85
+ sysbus_mmio_map(s, 0, addr);
54
86
+ sysbus_connect_irq(s, 0, irq);
55
#include "qemu/osdep.h"
87
+
56
-#include "qemu-common.h"
88
+ return dev;
57
#include "qemu/datadir.h"
89
+}
58
#include "qapi/error.h"
90
+
59
#include "hw/sysbus.h"
91
#define PL011_INT_TX 0x20
60
diff --git a/hw/arm/npcm7xx_boards.c b/hw/arm/npcm7xx_boards.c
92
#define PL011_INT_RX 0x10
61
index XXXXXXX..XXXXXXX 100644
93
62
--- a/hw/arm/npcm7xx_boards.c
63
+++ b/hw/arm/npcm7xx_boards.c
64
@@ -XXX,XX +XXX,XX @@
65
#include "hw/qdev-core.h"
66
#include "hw/qdev-properties.h"
67
#include "qapi/error.h"
68
-#include "qemu-common.h"
69
#include "qemu/datadir.h"
70
#include "qemu/units.h"
71
#include "sysemu/blockdev.h"
72
diff --git a/hw/arm/sbsa-ref.c b/hw/arm/sbsa-ref.c
73
index XXXXXXX..XXXXXXX 100644
74
--- a/hw/arm/sbsa-ref.c
75
+++ b/hw/arm/sbsa-ref.c
76
@@ -XXX,XX +XXX,XX @@
77
*/
78
79
#include "qemu/osdep.h"
80
-#include "qemu-common.h"
81
#include "qemu/datadir.h"
82
#include "qapi/error.h"
83
#include "qemu/error-report.h"
84
diff --git a/hw/arm/stm32f405_soc.c b/hw/arm/stm32f405_soc.c
85
index XXXXXXX..XXXXXXX 100644
86
--- a/hw/arm/stm32f405_soc.c
87
+++ b/hw/arm/stm32f405_soc.c
88
@@ -XXX,XX +XXX,XX @@
89
90
#include "qemu/osdep.h"
91
#include "qapi/error.h"
92
-#include "qemu-common.h"
93
#include "exec/address-spaces.h"
94
#include "sysemu/sysemu.h"
95
#include "hw/arm/stm32f405_soc.h"
96
diff --git a/hw/arm/vexpress.c b/hw/arm/vexpress.c
97
index XXXXXXX..XXXXXXX 100644
98
--- a/hw/arm/vexpress.c
99
+++ b/hw/arm/vexpress.c
100
@@ -XXX,XX +XXX,XX @@
101
102
#include "qemu/osdep.h"
103
#include "qapi/error.h"
104
-#include "qemu-common.h"
105
#include "qemu/datadir.h"
106
#include "cpu.h"
107
#include "hw/sysbus.h"
108
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
109
index XXXXXXX..XXXXXXX 100644
110
--- a/hw/arm/virt.c
111
+++ b/hw/arm/virt.c
112
@@ -XXX,XX +XXX,XX @@
113
*/
114
115
#include "qemu/osdep.h"
116
-#include "qemu-common.h"
117
#include "qemu/datadir.h"
118
#include "qemu/units.h"
119
#include "qemu/option.h"
120
--
94
--
121
2.25.1
95
2.34.1
122
96
123
97
diff view generated by jsdifflib
1
From: Jean-Philippe Brucker <jean-philippe@linaro.org>
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
2
2
3
When a virtio-iommu is instantiated, describe it using the ACPI VIOT
3
pl011_luminary_create() is only used for the Stellaris board,
4
table.
4
open-code it.
5
5
6
Acked-by: Igor Mammedov <imammedo@redhat.com>
6
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
7
Reviewed-by: Eric Auger <eric.auger@redhat.com>
7
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
8
Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
8
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
9
Message-id: 20211210170415.583179-2-jean-philippe@linaro.org
9
Message-id: 20230220115114.25237-4-philmd@linaro.org
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
---
11
---
12
hw/arm/virt-acpi-build.c | 7 +++++++
12
include/hw/char/pl011.h | 17 -----------------
13
hw/arm/Kconfig | 1 +
13
hw/arm/stellaris.c | 11 ++++++++---
14
2 files changed, 8 insertions(+)
14
2 files changed, 8 insertions(+), 20 deletions(-)
15
15
16
diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c
16
diff --git a/include/hw/char/pl011.h b/include/hw/char/pl011.h
17
index XXXXXXX..XXXXXXX 100644
17
index XXXXXXX..XXXXXXX 100644
18
--- a/hw/arm/virt-acpi-build.c
18
--- a/include/hw/char/pl011.h
19
+++ b/hw/arm/virt-acpi-build.c
19
+++ b/include/hw/char/pl011.h
20
@@ -XXX,XX +XXX,XX @@
20
@@ -XXX,XX +XXX,XX @@ struct PL011State {
21
#include "kvm_arm.h"
21
22
#include "migration/vmstate.h"
22
DeviceState *pl011_create(hwaddr addr, qemu_irq irq, Chardev *chr);
23
#include "hw/acpi/ghes.h"
23
24
+#include "hw/acpi/viot.h"
24
-static inline DeviceState *pl011_luminary_create(hwaddr addr,
25
25
- qemu_irq irq,
26
#define ARM_SPI_BASE 32
26
- Chardev *chr)
27
27
-{
28
@@ -XXX,XX +XXX,XX @@ void virt_acpi_build(VirtMachineState *vms, AcpiBuildTables *tables)
28
- DeviceState *dev;
29
- SysBusDevice *s;
30
-
31
- dev = qdev_new("pl011_luminary");
32
- s = SYS_BUS_DEVICE(dev);
33
- qdev_prop_set_chr(dev, "chardev", chr);
34
- sysbus_realize_and_unref(s, &error_fatal);
35
- sysbus_mmio_map(s, 0, addr);
36
- sysbus_connect_irq(s, 0, irq);
37
-
38
- return dev;
39
-}
40
-
41
#endif
42
diff --git a/hw/arm/stellaris.c b/hw/arm/stellaris.c
43
index XXXXXXX..XXXXXXX 100644
44
--- a/hw/arm/stellaris.c
45
+++ b/hw/arm/stellaris.c
46
@@ -XXX,XX +XXX,XX @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board)
47
48
for (i = 0; i < 4; i++) {
49
if (board->dc2 & (1 << i)) {
50
- pl011_luminary_create(0x4000c000 + i * 0x1000,
51
- qdev_get_gpio_in(nvic, uart_irq[i]),
52
- serial_hd(i));
53
+ SysBusDevice *sbd;
54
+
55
+ dev = qdev_new("pl011_luminary");
56
+ sbd = SYS_BUS_DEVICE(dev);
57
+ qdev_prop_set_chr(dev, "chardev", serial_hd(i));
58
+ sysbus_realize_and_unref(sbd, &error_fatal);
59
+ sysbus_mmio_map(sbd, 0, 0x4000c000 + i * 0x1000);
60
+ sysbus_connect_irq(sbd, 0, qdev_get_gpio_in(nvic, uart_irq[i]));
61
}
29
}
62
}
30
#endif
63
if (board->dc2 & (1 << 4)) {
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
--
64
--
54
2.25.1
65
2.34.1
55
66
56
67
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
2
2
3
The size of the code covered by a TranslationBlock cannot be 0;
3
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
4
this is checked via assert in tb_gen_code.
4
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
5
5
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
6
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
6
Message-id: 20230220115114.25237-5-philmd@linaro.org
7
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
---
8
---
10
target/arm/translate-a64.c | 1 +
9
include/hw/char/xilinx_uartlite.h | 6 +++++-
11
1 file changed, 1 insertion(+)
10
hw/char/xilinx_uartlite.c | 4 +---
11
2 files changed, 6 insertions(+), 4 deletions(-)
12
12
13
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
13
diff --git a/include/hw/char/xilinx_uartlite.h b/include/hw/char/xilinx_uartlite.h
14
index XXXXXXX..XXXXXXX 100644
14
index XXXXXXX..XXXXXXX 100644
15
--- a/target/arm/translate-a64.c
15
--- a/include/hw/char/xilinx_uartlite.h
16
+++ b/target/arm/translate-a64.c
16
+++ b/include/hw/char/xilinx_uartlite.h
17
@@ -XXX,XX +XXX,XX @@ static void aarch64_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu)
17
@@ -XXX,XX +XXX,XX @@
18
assert(s->base.num_insns == 1);
18
#include "hw/qdev-properties.h"
19
gen_swstep_exception(s, 0, 0);
19
#include "hw/sysbus.h"
20
s->base.is_jmp = DISAS_NORETURN;
20
#include "qapi/error.h"
21
+ s->base.pc_next = pc + 4;
21
+#include "qom/object.h"
22
return;
22
+
23
}
23
+#define TYPE_XILINX_UARTLITE "xlnx.xps-uartlite"
24
+OBJECT_DECLARE_SIMPLE_TYPE(XilinxUARTLite, XILINX_UARTLITE)
25
26
static inline DeviceState *xilinx_uartlite_create(hwaddr addr,
27
qemu_irq irq,
28
@@ -XXX,XX +XXX,XX @@ static inline DeviceState *xilinx_uartlite_create(hwaddr addr,
29
DeviceState *dev;
30
SysBusDevice *s;
31
32
- dev = qdev_new("xlnx.xps-uartlite");
33
+ dev = qdev_new(TYPE_XILINX_UARTLITE);
34
s = SYS_BUS_DEVICE(dev);
35
qdev_prop_set_chr(dev, "chardev", chr);
36
sysbus_realize_and_unref(s, &error_fatal);
37
diff --git a/hw/char/xilinx_uartlite.c b/hw/char/xilinx_uartlite.c
38
index XXXXXXX..XXXXXXX 100644
39
--- a/hw/char/xilinx_uartlite.c
40
+++ b/hw/char/xilinx_uartlite.c
41
@@ -XXX,XX +XXX,XX @@
42
43
#include "qemu/osdep.h"
44
#include "qemu/log.h"
45
+#include "hw/char/xilinx_uartlite.h"
46
#include "hw/irq.h"
47
#include "hw/qdev-properties.h"
48
#include "hw/qdev-properties-system.h"
49
@@ -XXX,XX +XXX,XX @@
50
#define CONTROL_RST_RX 0x02
51
#define CONTROL_IE 0x10
52
53
-#define TYPE_XILINX_UARTLITE "xlnx.xps-uartlite"
54
-OBJECT_DECLARE_SIMPLE_TYPE(XilinxUARTLite, XILINX_UARTLITE)
55
-
56
struct XilinxUARTLite {
57
SysBusDevice parent_obj;
24
58
25
--
59
--
26
2.25.1
60
2.34.1
27
61
28
62
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
2
2
3
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
3
Open-code the single use of xilinx_uartlite_create().
4
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
4
5
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
6
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
7
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
8
Message-id: 20230220115114.25237-6-philmd@linaro.org
5
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6
---
10
---
7
target/arm/translate-a64.c | 7 ++++---
11
include/hw/char/xilinx_uartlite.h | 20 --------------------
8
1 file changed, 4 insertions(+), 3 deletions(-)
12
hw/microblaze/petalogix_s3adsp1800_mmu.c | 7 +++++--
13
2 files changed, 5 insertions(+), 22 deletions(-)
9
14
10
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
15
diff --git a/include/hw/char/xilinx_uartlite.h b/include/hw/char/xilinx_uartlite.h
11
index XXXXXXX..XXXXXXX 100644
16
index XXXXXXX..XXXXXXX 100644
12
--- a/target/arm/translate-a64.c
17
--- a/include/hw/char/xilinx_uartlite.h
13
+++ b/target/arm/translate-a64.c
18
+++ b/include/hw/char/xilinx_uartlite.h
14
@@ -XXX,XX +XXX,XX @@ static void aarch64_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu)
19
@@ -XXX,XX +XXX,XX @@
15
{
20
#ifndef XILINX_UARTLITE_H
16
DisasContext *s = container_of(dcbase, DisasContext, base);
21
#define XILINX_UARTLITE_H
17
CPUARMState *env = cpu->env_ptr;
22
18
+ uint64_t pc = s->base.pc_next;
23
-#include "hw/qdev-properties.h"
19
uint32_t insn;
24
-#include "hw/sysbus.h"
20
25
-#include "qapi/error.h"
21
if (s->ss_active && !s->pstate_ss) {
26
#include "qom/object.h"
22
@@ -XXX,XX +XXX,XX @@ static void aarch64_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu)
27
23
return;
28
#define TYPE_XILINX_UARTLITE "xlnx.xps-uartlite"
29
OBJECT_DECLARE_SIMPLE_TYPE(XilinxUARTLite, XILINX_UARTLITE)
30
31
-static inline DeviceState *xilinx_uartlite_create(hwaddr addr,
32
- qemu_irq irq,
33
- Chardev *chr)
34
-{
35
- DeviceState *dev;
36
- SysBusDevice *s;
37
-
38
- dev = qdev_new(TYPE_XILINX_UARTLITE);
39
- s = SYS_BUS_DEVICE(dev);
40
- qdev_prop_set_chr(dev, "chardev", chr);
41
- sysbus_realize_and_unref(s, &error_fatal);
42
- sysbus_mmio_map(s, 0, addr);
43
- sysbus_connect_irq(s, 0, irq);
44
-
45
- return dev;
46
-}
47
-
48
#endif
49
diff --git a/hw/microblaze/petalogix_s3adsp1800_mmu.c b/hw/microblaze/petalogix_s3adsp1800_mmu.c
50
index XXXXXXX..XXXXXXX 100644
51
--- a/hw/microblaze/petalogix_s3adsp1800_mmu.c
52
+++ b/hw/microblaze/petalogix_s3adsp1800_mmu.c
53
@@ -XXX,XX +XXX,XX @@ petalogix_s3adsp1800_init(MachineState *machine)
54
irq[i] = qdev_get_gpio_in(dev, i);
24
}
55
}
25
56
26
- s->pc_curr = s->base.pc_next;
57
- xilinx_uartlite_create(UARTLITE_BASEADDR, irq[UARTLITE_IRQ],
27
- insn = arm_ldl_code(env, &s->base, s->base.pc_next, s->sctlr_b);
58
- serial_hd(0));
28
+ s->pc_curr = pc;
59
+ dev = qdev_new(TYPE_XILINX_UARTLITE);
29
+ insn = arm_ldl_code(env, &s->base, pc, s->sctlr_b);
60
+ qdev_prop_set_chr(dev, "chardev", serial_hd(0));
30
s->insn = insn;
61
+ sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
31
- s->base.pc_next += 4;
62
+ sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, UARTLITE_BASEADDR);
32
+ s->base.pc_next = pc + 4;
63
+ sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, irq[UARTLITE_IRQ]);
33
64
34
s->fp_access_checked = false;
65
/* 2 timers at irq 2 @ 62 Mhz. */
35
s->sve_access_checked = false;
66
dev = qdev_new("xlnx.xps-timer");
36
--
67
--
37
2.25.1
68
2.34.1
38
69
39
70
diff view generated by jsdifflib
1
From: Patrick Venture <venture@google.com>
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
2
2
3
The rx_active boolean change to true should always trigger a try_read
3
cmsdk_apb_uart_create() is only used twice in the same
4
call that flushes the queue.
4
file. Open-code it.
5
5
6
Signed-off-by: Patrick Venture <venture@google.com>
6
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
7
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
7
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
8
Message-id: 20211203221002.1719306-1-venture@google.com
8
Message-id: 20230220115114.25237-7-philmd@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/net/npcm7xx_emc.c | 18 ++++++++----------
11
include/hw/char/cmsdk-apb-uart.h | 34 --------------------------
12
1 file changed, 8 insertions(+), 10 deletions(-)
12
hw/arm/mps2.c | 41 +++++++++++++++++++++-----------
13
2 files changed, 27 insertions(+), 48 deletions(-)
13
14
14
diff --git a/hw/net/npcm7xx_emc.c b/hw/net/npcm7xx_emc.c
15
diff --git a/include/hw/char/cmsdk-apb-uart.h b/include/hw/char/cmsdk-apb-uart.h
15
index XXXXXXX..XXXXXXX 100644
16
index XXXXXXX..XXXXXXX 100644
16
--- a/hw/net/npcm7xx_emc.c
17
--- a/include/hw/char/cmsdk-apb-uart.h
17
+++ b/hw/net/npcm7xx_emc.c
18
+++ b/include/hw/char/cmsdk-apb-uart.h
18
@@ -XXX,XX +XXX,XX @@ static void emc_halt_rx(NPCM7xxEMCState *emc, uint32_t mista_flag)
19
@@ -XXX,XX +XXX,XX @@
19
emc_set_mista(emc, mista_flag);
20
#ifndef CMSDK_APB_UART_H
20
}
21
#define CMSDK_APB_UART_H
21
22
22
+static void emc_enable_rx_and_flush(NPCM7xxEMCState *emc)
23
-#include "hw/qdev-properties.h"
23
+{
24
#include "hw/sysbus.h"
24
+ emc->rx_active = true;
25
#include "chardev/char-fe.h"
25
+ qemu_flush_queued_packets(qemu_get_queue(emc->nic));
26
-#include "qapi/error.h"
26
+}
27
#include "qom/object.h"
27
+
28
28
static void emc_set_next_tx_descriptor(NPCM7xxEMCState *emc,
29
#define TYPE_CMSDK_APB_UART "cmsdk-apb-uart"
29
const NPCM7xxEMCTxDesc *tx_desc,
30
@@ -XXX,XX +XXX,XX @@ struct CMSDKAPBUART {
30
uint32_t desc_addr)
31
uint8_t rxbuf;
31
@@ -XXX,XX +XXX,XX @@ static ssize_t emc_receive(NetClientState *nc, const uint8_t *buf, size_t len1)
32
};
32
return len;
33
33
}
34
-/**
34
35
- * cmsdk_apb_uart_create - convenience function to create TYPE_CMSDK_APB_UART
35
-static void emc_try_receive_next_packet(NPCM7xxEMCState *emc)
36
- * @addr: location in system memory to map registers
37
- * @chr: Chardev backend to connect UART to, or NULL if no backend
38
- * @pclk_frq: frequency in Hz of the PCLK clock (used for calculating baud rate)
39
- */
40
-static inline DeviceState *cmsdk_apb_uart_create(hwaddr addr,
41
- qemu_irq txint,
42
- qemu_irq rxint,
43
- qemu_irq txovrint,
44
- qemu_irq rxovrint,
45
- qemu_irq uartint,
46
- Chardev *chr,
47
- uint32_t pclk_frq)
36
-{
48
-{
37
- if (emc_can_receive(qemu_get_queue(emc->nic))) {
49
- DeviceState *dev;
38
- qemu_flush_queued_packets(qemu_get_queue(emc->nic));
50
- SysBusDevice *s;
39
- }
51
-
52
- dev = qdev_new(TYPE_CMSDK_APB_UART);
53
- s = SYS_BUS_DEVICE(dev);
54
- qdev_prop_set_chr(dev, "chardev", chr);
55
- qdev_prop_set_uint32(dev, "pclk-frq", pclk_frq);
56
- sysbus_realize_and_unref(s, &error_fatal);
57
- sysbus_mmio_map(s, 0, addr);
58
- sysbus_connect_irq(s, 0, txint);
59
- sysbus_connect_irq(s, 1, rxint);
60
- sysbus_connect_irq(s, 2, txovrint);
61
- sysbus_connect_irq(s, 3, rxovrint);
62
- sysbus_connect_irq(s, 4, uartint);
63
- return dev;
40
-}
64
-}
41
-
65
-
42
static uint64_t npcm7xx_emc_read(void *opaque, hwaddr offset, unsigned size)
66
#endif
43
{
67
diff --git a/hw/arm/mps2.c b/hw/arm/mps2.c
44
NPCM7xxEMCState *emc = opaque;
68
index XXXXXXX..XXXXXXX 100644
45
@@ -XXX,XX +XXX,XX @@ static void npcm7xx_emc_write(void *opaque, hwaddr offset,
69
--- a/hw/arm/mps2.c
46
emc->regs[REG_MGSTA] |= REG_MGSTA_RXHA;
70
+++ b/hw/arm/mps2.c
47
}
71
@@ -XXX,XX +XXX,XX @@
48
if (value & REG_MCMDR_RXON) {
72
#include "hw/boards.h"
49
- emc->rx_active = true;
73
#include "exec/address-spaces.h"
50
+ emc_enable_rx_and_flush(emc);
74
#include "sysemu/sysemu.h"
51
} else {
75
+#include "hw/qdev-properties.h"
52
emc_halt_rx(emc, 0);
76
#include "hw/misc/unimp.h"
53
}
77
#include "hw/char/cmsdk-apb-uart.h"
54
@@ -XXX,XX +XXX,XX @@ static void npcm7xx_emc_write(void *opaque, hwaddr offset,
78
#include "hw/timer/cmsdk-apb-timer.h"
55
break;
79
@@ -XXX,XX +XXX,XX @@ static void mps2_common_init(MachineState *machine)
56
case REG_RSDR:
80
qdev_connect_gpio_out(orgate_dev, 0, qdev_get_gpio_in(armv7m, 12));
57
if (emc->regs[REG_MCMDR] & REG_MCMDR_RXON) {
81
58
- emc->rx_active = true;
82
for (i = 0; i < 5; i++) {
59
- emc_try_receive_next_packet(emc);
83
+ DeviceState *dev;
60
+ emc_enable_rx_and_flush(emc);
84
+ SysBusDevice *s;
85
+
86
static const hwaddr uartbase[] = {0x40004000, 0x40005000,
87
0x40006000, 0x40007000,
88
0x40009000};
89
@@ -XXX,XX +XXX,XX @@ static void mps2_common_init(MachineState *machine)
90
rxovrint = qdev_get_gpio_in(orgate_dev, i * 2 + 1);
91
}
92
93
- cmsdk_apb_uart_create(uartbase[i],
94
- qdev_get_gpio_in(armv7m, uartirq[i] + 1),
95
- qdev_get_gpio_in(armv7m, uartirq[i]),
96
- txovrint, rxovrint,
97
- NULL,
98
- serial_hd(i), SYSCLK_FRQ);
99
+ dev = qdev_new(TYPE_CMSDK_APB_UART);
100
+ s = SYS_BUS_DEVICE(dev);
101
+ qdev_prop_set_chr(dev, "chardev", serial_hd(i));
102
+ qdev_prop_set_uint32(dev, "pclk-frq", SYSCLK_FRQ);
103
+ sysbus_realize_and_unref(s, &error_fatal);
104
+ sysbus_mmio_map(s, 0, uartbase[i]);
105
+ sysbus_connect_irq(s, 0, qdev_get_gpio_in(armv7m, uartirq[i] + 1));
106
+ sysbus_connect_irq(s, 1, qdev_get_gpio_in(armv7m, uartirq[i]));
107
+ sysbus_connect_irq(s, 2, txovrint);
108
+ sysbus_connect_irq(s, 3, rxovrint);
61
}
109
}
62
break;
110
break;
63
case REG_MIIDA:
111
}
112
@@ -XXX,XX +XXX,XX @@ static void mps2_common_init(MachineState *machine)
113
0x4002c000, 0x4002d000,
114
0x4002e000};
115
Object *txrx_orgate;
116
- DeviceState *txrx_orgate_dev;
117
+ DeviceState *txrx_orgate_dev, *dev;
118
+ SysBusDevice *s;
119
120
txrx_orgate = object_new(TYPE_OR_IRQ);
121
object_property_set_int(txrx_orgate, "num-lines", 2, &error_fatal);
122
@@ -XXX,XX +XXX,XX @@ static void mps2_common_init(MachineState *machine)
123
txrx_orgate_dev = DEVICE(txrx_orgate);
124
qdev_connect_gpio_out(txrx_orgate_dev, 0,
125
qdev_get_gpio_in(armv7m, uart_txrx_irqno[i]));
126
- cmsdk_apb_uart_create(uartbase[i],
127
- qdev_get_gpio_in(txrx_orgate_dev, 0),
128
- qdev_get_gpio_in(txrx_orgate_dev, 1),
129
- qdev_get_gpio_in(orgate_dev, i * 2),
130
- qdev_get_gpio_in(orgate_dev, i * 2 + 1),
131
- NULL,
132
- serial_hd(i), SYSCLK_FRQ);
133
+
134
+ dev = qdev_new(TYPE_CMSDK_APB_UART);
135
+ s = SYS_BUS_DEVICE(dev);
136
+ qdev_prop_set_chr(dev, "chardev", serial_hd(i));
137
+ qdev_prop_set_uint32(dev, "pclk-frq", SYSCLK_FRQ);
138
+ sysbus_realize_and_unref(s, &error_fatal);
139
+ sysbus_mmio_map(s, 0, uartbase[i]);
140
+ sysbus_connect_irq(s, 0, qdev_get_gpio_in(txrx_orgate_dev, 0));
141
+ sysbus_connect_irq(s, 1, qdev_get_gpio_in(txrx_orgate_dev, 1));
142
+ sysbus_connect_irq(s, 2, qdev_get_gpio_in(orgate_dev, i * 2));
143
+ sysbus_connect_irq(s, 3, qdev_get_gpio_in(orgate_dev, i * 2 + 1));
144
}
145
break;
146
}
64
--
147
--
65
2.25.1
148
2.34.1
66
149
67
150
diff view generated by jsdifflib
1
The qemu-common.h header is not supposed to be included from any
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
2
other header files, only from .c files (as documented in a comment at
3
the start of it).
4
2
5
Nothing actually relies on target/rx/cpu.h including it, so we can
3
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
6
just drop the include.
4
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
7
5
Message-id: 20230220115114.25237-8-philmd@linaro.org
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
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
14
---
7
---
15
target/rx/cpu.h | 1 -
8
include/hw/timer/cmsdk-apb-timer.h | 1 -
16
1 file changed, 1 deletion(-)
9
1 file changed, 1 deletion(-)
17
10
18
diff --git a/target/rx/cpu.h b/target/rx/cpu.h
11
diff --git a/include/hw/timer/cmsdk-apb-timer.h b/include/hw/timer/cmsdk-apb-timer.h
19
index XXXXXXX..XXXXXXX 100644
12
index XXXXXXX..XXXXXXX 100644
20
--- a/target/rx/cpu.h
13
--- a/include/hw/timer/cmsdk-apb-timer.h
21
+++ b/target/rx/cpu.h
14
+++ b/include/hw/timer/cmsdk-apb-timer.h
22
@@ -XXX,XX +XXX,XX @@
15
@@ -XXX,XX +XXX,XX @@
23
#define RX_CPU_H
16
#ifndef CMSDK_APB_TIMER_H
24
17
#define CMSDK_APB_TIMER_H
25
#include "qemu/bitops.h"
18
26
-#include "qemu-common.h"
19
-#include "hw/qdev-properties.h"
27
#include "hw/registerfields.h"
20
#include "hw/sysbus.h"
28
#include "cpu-qom.h"
21
#include "hw/ptimer.h"
29
22
#include "hw/clock.h"
30
--
23
--
31
2.25.1
24
2.34.1
32
25
33
26
diff view generated by jsdifflib
1
The calculation of the length of TLB range invalidate operations
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
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
11
2
12
Thanks to the bug report submitter Cha HyunSoo for identifying
3
Avoid accessing 'parent_obj' directly.
13
both these errors.
14
4
15
Fixes: 84940ed82552d3c ("target/arm: Add support for FEAT_TLBIRANGE")
5
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
16
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/734
6
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
7
Message-id: 20230220115114.25237-9-philmd@linaro.org
17
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8
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
22
---
9
---
23
target/arm/helper.c | 6 +++---
10
hw/intc/armv7m_nvic.c | 6 +++---
24
1 file changed, 3 insertions(+), 3 deletions(-)
11
1 file changed, 3 insertions(+), 3 deletions(-)
25
12
26
diff --git a/target/arm/helper.c b/target/arm/helper.c
13
diff --git a/hw/intc/armv7m_nvic.c b/hw/intc/armv7m_nvic.c
27
index XXXXXXX..XXXXXXX 100644
14
index XXXXXXX..XXXXXXX 100644
28
--- a/target/arm/helper.c
15
--- a/hw/intc/armv7m_nvic.c
29
+++ b/target/arm/helper.c
16
+++ b/hw/intc/armv7m_nvic.c
30
@@ -XXX,XX +XXX,XX @@ static uint64_t tlbi_aa64_range_get_length(CPUARMState *env,
17
@@ -XXX,XX +XXX,XX @@ static void do_armv7m_nvic_set_pending(void *opaque, int irq, bool secure,
31
uint64_t exponent;
18
* which saves having to have an extra argument is_terminal
32
uint64_t length;
19
* that we'd only use in one place.
33
20
*/
34
- num = extract64(value, 39, 4);
21
- cpu_abort(&s->cpu->parent_obj,
35
+ num = extract64(value, 39, 5);
22
+ cpu_abort(CPU(s->cpu),
36
scale = extract64(value, 44, 2);
23
"Lockup: can't take terminal derived exception "
37
page_size_granule = extract64(value, 46, 2);
24
"(original exception priority %d)\n",
38
25
s->vectpending_prio);
39
- page_shift = page_size_granule * 2 + 12;
26
@@ -XXX,XX +XXX,XX @@ static void do_armv7m_nvic_set_pending(void *opaque, int irq, bool secure,
40
-
27
* Lockup condition due to a guest bug. We don't model
41
if (page_size_granule == 0) {
28
* Lockup, so report via cpu_abort() instead.
42
qemu_log_mask(LOG_GUEST_ERROR, "Invalid page size granule %d\n",
29
*/
43
page_size_granule);
30
- cpu_abort(&s->cpu->parent_obj,
44
return 0;
31
+ cpu_abort(CPU(s->cpu),
45
}
32
"Lockup: can't escalate %d to HardFault "
46
33
"(current priority %d)\n", irq, running);
47
+ page_shift = (page_size_granule - 1) * 2 + 12;
34
}
48
+
35
@@ -XXX,XX +XXX,XX @@ void armv7m_nvic_set_pending_lazyfp(NVICState *s, int irq, bool secure)
49
exponent = (5 * scale) + 1;
36
* We want to escalate to HardFault but the context the
50
length = (num + 1) << (exponent + page_shift);
37
* FP state belongs to prevents the exception pre-empting.
51
38
*/
39
- cpu_abort(&s->cpu->parent_obj,
40
+ cpu_abort(CPU(s->cpu),
41
"Lockup: can't escalate to HardFault during "
42
"lazy FP register stacking\n");
43
}
52
--
44
--
53
2.25.1
45
2.34.1
54
46
55
47
diff view generated by jsdifflib
1
From: Joel Stanley <joel@jms.id.au>
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
2
2
3
This is the latest URL for the OpenBMC CI. The old URL still works, but
3
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
4
redirects.
4
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
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>
5
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
---
6
---
11
docs/system/arm/aspeed.rst | 2 +-
7
hw/arm/musicpal.c | 4 ----
12
1 file changed, 1 insertion(+), 1 deletion(-)
8
1 file changed, 4 deletions(-)
13
9
14
diff --git a/docs/system/arm/aspeed.rst b/docs/system/arm/aspeed.rst
10
diff --git a/hw/arm/musicpal.c b/hw/arm/musicpal.c
15
index XXXXXXX..XXXXXXX 100644
11
index XXXXXXX..XXXXXXX 100644
16
--- a/docs/system/arm/aspeed.rst
12
--- a/hw/arm/musicpal.c
17
+++ b/docs/system/arm/aspeed.rst
13
+++ b/hw/arm/musicpal.c
18
@@ -XXX,XX +XXX,XX @@ The Aspeed machines can be started using the ``-kernel`` option to
14
@@ -XXX,XX +XXX,XX @@ struct musicpal_key_state {
19
load a Linux kernel or from a firmware. Images can be downloaded from
15
SysBusDevice parent_obj;
20
the OpenBMC jenkins :
16
/*< public >*/
21
17
22
- https://jenkins.openbmc.org/job/ci-openbmc/lastSuccessfulBuild/distro=ubuntu,label=docker-builder
18
- MemoryRegion iomem;
23
+ https://jenkins.openbmc.org/job/ci-openbmc/lastSuccessfulBuild/
19
uint32_t kbd_extended;
24
20
uint32_t pressed_keys;
25
or directly from the OpenBMC GitHub release repository :
21
qemu_irq out[8];
22
@@ -XXX,XX +XXX,XX @@ static void musicpal_key_init(Object *obj)
23
DeviceState *dev = DEVICE(sbd);
24
musicpal_key_state *s = MUSICPAL_KEY(dev);
25
26
- memory_region_init(&s->iomem, obj, "dummy", 0);
27
- sysbus_init_mmio(sbd, &s->iomem);
28
-
29
s->kbd_extended = 0;
30
s->pressed_keys = 0;
26
31
27
--
32
--
28
2.25.1
33
2.34.1
29
34
30
35
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
2
2
3
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
3
Since commit be8d853766 ("iothread: add I/O thread object") we
4
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
4
never used IOThreadClass / IOTHREAD_CLASS() / IOTHREAD_GET_CLASS(),
5
remove these definitions.
6
7
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
8
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
9
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
10
Message-id: 20230113200138.52869-2-philmd@linaro.org
5
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6
---
12
---
7
target/arm/translate.c | 16 ++++++++--------
13
iothread.c | 4 ----
8
1 file changed, 8 insertions(+), 8 deletions(-)
14
1 file changed, 4 deletions(-)
9
15
10
diff --git a/target/arm/translate.c b/target/arm/translate.c
16
diff --git a/iothread.c b/iothread.c
11
index XXXXXXX..XXXXXXX 100644
17
index XXXXXXX..XXXXXXX 100644
12
--- a/target/arm/translate.c
18
--- a/iothread.c
13
+++ b/target/arm/translate.c
19
+++ b/iothread.c
14
@@ -XXX,XX +XXX,XX @@ static void thumb_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu)
20
@@ -XXX,XX +XXX,XX @@
15
{
21
#include "qemu/rcu.h"
16
DisasContext *dc = container_of(dcbase, DisasContext, base);
22
#include "qemu/main-loop.h"
17
CPUARMState *env = cpu->env_ptr;
23
18
+ uint32_t pc = dc->base.pc_next;
24
-typedef ObjectClass IOThreadClass;
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
-
25
-
39
+ uint32_t insn2 = arm_lduw_code(env, &dc->base, pc, dc->sctlr_b);
26
-DECLARE_CLASS_CHECKERS(IOThreadClass, IOTHREAD,
40
insn = insn << 16 | insn2;
27
- TYPE_IOTHREAD)
41
- dc->base.pc_next += 2;
28
42
+ pc += 2;
29
#ifdef CONFIG_POSIX
43
}
30
/* Benchmark results from 2016 on NVMe SSD drives show max polling times around
44
+ dc->base.pc_next = pc;
45
dc->insn = insn;
46
47
if (dc->pstate_il) {
48
--
31
--
49
2.25.1
32
2.34.1
50
33
51
34
diff view generated by jsdifflib
1
From: Alex Bennée <alex.bennee@linaro.org>
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
2
2
3
While trying to debug a GIC ITS failure I saw some guest errors that
3
QOM *DECLARE* macros expect a typedef as first argument,
4
had poor formatting as well as leaving me confused as to what failed.
4
not a structure. Replace 'struct IRQState' by 'IRQState'
5
As most of the checks aren't possible without a valid dte split that
5
to avoid when modifying the macros:
6
check apart and then check the other conditions in steps. This avoids
7
us relying on undefined data.
8
6
9
I still get a failure with the current kvm-unit-tests but at least I
7
../hw/core/irq.c:29:1: error: declaration of anonymous struct must be a definition
10
know (partially) why now:
8
DECLARE_INSTANCE_CHECKER(struct IRQState, IRQ,
9
^
11
10
12
Exception return from AArch64 EL1 to AArch64 EL1 PC 0x40080588
11
Use OBJECT_DECLARE_SIMPLE_TYPE instead of DECLARE_INSTANCE_CHECKER.
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
12
20
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
13
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
21
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
14
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
22
Message-id: 20211112170454.3158925-1-alex.bennee@linaro.org
15
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
23
Cc: Shashi Mallela <shashi.mallela@linaro.org>
16
Message-id: 20230113200138.52869-3-philmd@linaro.org
24
Cc: Peter Maydell <peter.maydell@linaro.org>
25
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
17
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
26
---
18
---
27
hw/intc/arm_gicv3_its.c | 39 +++++++++++++++++++++++++++------------
19
hw/core/irq.c | 9 ++++-----
28
1 file changed, 27 insertions(+), 12 deletions(-)
20
1 file changed, 4 insertions(+), 5 deletions(-)
29
21
30
diff --git a/hw/intc/arm_gicv3_its.c b/hw/intc/arm_gicv3_its.c
22
diff --git a/hw/core/irq.c b/hw/core/irq.c
31
index XXXXXXX..XXXXXXX 100644
23
index XXXXXXX..XXXXXXX 100644
32
--- a/hw/intc/arm_gicv3_its.c
24
--- a/hw/core/irq.c
33
+++ b/hw/intc/arm_gicv3_its.c
25
+++ b/hw/core/irq.c
34
@@ -XXX,XX +XXX,XX @@ static bool process_its_cmd(GICv3ITSState *s, uint64_t value, uint32_t offset,
26
@@ -XXX,XX +XXX,XX @@
35
if (res != MEMTX_OK) {
27
#include "hw/irq.h"
36
return result;
28
#include "qom/object.h"
37
}
29
38
+ } else {
30
-DECLARE_INSTANCE_CHECKER(struct IRQState, IRQ,
39
+ qemu_log_mask(LOG_GUEST_ERROR,
31
- TYPE_IRQ)
40
+ "%s: invalid command attributes: "
32
+OBJECT_DECLARE_SIMPLE_TYPE(IRQState, IRQ)
41
+ "invalid dte: %"PRIx64" for %d (MEM_TX: %d)\n",
33
42
+ __func__, dte, devid, res);
34
struct IRQState {
43
+ return result;
35
Object parent_obj;
44
}
36
@@ -XXX,XX +XXX,XX @@ qemu_irq *qemu_allocate_irqs(qemu_irq_handler handler, void *opaque, int n)
45
37
46
- if ((devid > s->dt.maxids.max_devids) || !dte_valid || !ite_valid ||
38
qemu_irq qemu_allocate_irq(qemu_irq_handler handler, void *opaque, int n)
47
- !cte_valid || (eventid > max_eventid)) {
39
{
48
+
40
- struct IRQState *irq;
49
+ /*
41
+ IRQState *irq;
50
+ * In this implementation, in case of guest errors we ignore the
42
51
+ * command and move onto the next command in the queue.
43
irq = IRQ(object_new(TYPE_IRQ));
52
+ */
44
irq->handler = handler;
53
+ if (devid > s->dt.maxids.max_devids) {
45
@@ -XXX,XX +XXX,XX @@ void qemu_free_irq(qemu_irq irq)
54
qemu_log_mask(LOG_GUEST_ERROR,
46
55
- "%s: invalid command attributes "
47
static void qemu_notirq(void *opaque, int line, int level)
56
- "devid %d or eventid %d or invalid dte %d or"
48
{
57
- "invalid cte %d or invalid ite %d\n",
49
- struct IRQState *irq = opaque;
58
- __func__, devid, eventid, dte_valid, cte_valid,
50
+ IRQState *irq = opaque;
59
- ite_valid);
51
60
- /*
52
irq->handler(irq->opaque, irq->n, !level);
61
- * in this implementation, in case of error
53
}
62
- * we ignore this command and move onto the next
54
@@ -XXX,XX +XXX,XX @@ void qemu_irq_intercept_in(qemu_irq *gpio_in, qemu_irq_handler handler, int n)
63
- * command in the queue
55
static const TypeInfo irq_type_info = {
64
- */
56
.name = TYPE_IRQ,
65
+ "%s: invalid command attributes: devid %d>%d",
57
.parent = TYPE_OBJECT,
66
+ __func__, devid, s->dt.maxids.max_devids);
58
- .instance_size = sizeof(struct IRQState),
67
+
59
+ .instance_size = sizeof(IRQState),
68
+ } else if (!dte_valid || !ite_valid || !cte_valid) {
60
};
69
+ qemu_log_mask(LOG_GUEST_ERROR,
61
70
+ "%s: invalid command attributes: "
62
static void irq_register_types(void)
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
--
63
--
84
2.25.1
64
2.34.1
85
65
86
66
diff view generated by jsdifflib
Deleted patch
1
From: Joel Stanley <joel@jms.id.au>
2
1
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
Deleted patch
1
From: Joel Stanley <joel@jms.id.au>
2
1
3
A common use case for the ASPEED machine is to boot a Linux kernel.
4
Provide a full example command line.
5
6
Reviewed-by: Cédric Le Goater <clg@kaod.org>
7
Signed-off-by: Joel Stanley <joel@jms.id.au>
8
Message-id: 20211117065752.330632-4-joel@jms.id.au
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
---
11
docs/system/arm/aspeed.rst | 15 ++++++++++++---
12
1 file changed, 12 insertions(+), 3 deletions(-)
13
14
diff --git a/docs/system/arm/aspeed.rst b/docs/system/arm/aspeed.rst
15
index XXXXXXX..XXXXXXX 100644
16
--- a/docs/system/arm/aspeed.rst
17
+++ b/docs/system/arm/aspeed.rst
18
@@ -XXX,XX +XXX,XX @@ Missing devices
19
Boot options
20
------------
21
22
-The Aspeed machines can be started using the ``-kernel`` option to
23
-load a Linux kernel or from a firmware. Images can be downloaded from
24
-the OpenBMC jenkins :
25
+The Aspeed machines can be started using the ``-kernel`` and ``-dtb`` options
26
+to load a Linux kernel or from a firmware. Images can be downloaded from the
27
+OpenBMC jenkins :
28
29
https://jenkins.openbmc.org/job/ci-openbmc/lastSuccessfulBuild/
30
31
@@ -XXX,XX +XXX,XX @@ or directly from the OpenBMC GitHub release repository :
32
33
https://github.com/openbmc/openbmc/releases
34
35
+To boot a kernel directly from a Linux build tree:
36
+
37
+.. code-block:: bash
38
+
39
+ $ qemu-system-arm -M ast2600-evb -nographic \
40
+ -kernel arch/arm/boot/zImage \
41
+ -dtb arch/arm/boot/dts/aspeed-ast2600-evb.dtb \
42
+ -initrd rootfs.cpio
43
+
44
The image should be attached as an MTD drive. Run :
45
46
.. code-block:: bash
47
--
48
2.25.1
49
50
diff view generated by jsdifflib
Deleted patch
1
From: Joel Stanley <joel@jms.id.au>
2
1
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
Deleted patch
1
From: Olivier Hériveaux <olivier.heriveaux@ledger.fr>
2
1
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
Deleted patch
1
From: Philippe Mathieu-Daudé <philmd@redhat.com>
2
1
3
The TYPE_ARM_GICV3 device is an emulated one. When using
4
KVM, it is recommended to use the TYPE_KVM_ARM_GICV3 device
5
(which uses in-kernel support).
6
7
When using --with-devices-FOO, it is possible to build a
8
binary with a specific set of devices. When this binary is
9
restricted to KVM accelerator, the TYPE_ARM_GICV3 device is
10
irrelevant, and it is desirable to remove it from the binary.
11
12
Therefore introduce the CONFIG_ARM_GIC_TCG Kconfig selector
13
which select the files required to have the TYPE_ARM_GICV3
14
device, but also allowing to de-select this device.
15
16
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
17
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
18
Message-id: 20211115223619.2599282-3-philmd@redhat.com
19
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
20
---
21
hw/intc/arm_gicv3.c | 2 +-
22
hw/intc/Kconfig | 5 +++++
23
hw/intc/meson.build | 10 ++++++----
24
3 files changed, 12 insertions(+), 5 deletions(-)
25
26
diff --git a/hw/intc/arm_gicv3.c b/hw/intc/arm_gicv3.c
27
index XXXXXXX..XXXXXXX 100644
28
--- a/hw/intc/arm_gicv3.c
29
+++ b/hw/intc/arm_gicv3.c
30
@@ -XXX,XX +XXX,XX @@
31
/*
32
- * ARM Generic Interrupt Controller v3
33
+ * ARM Generic Interrupt Controller v3 (emulation)
34
*
35
* Copyright (c) 2015 Huawei.
36
* Copyright (c) 2016 Linaro Limited
37
diff --git a/hw/intc/Kconfig b/hw/intc/Kconfig
38
index XXXXXXX..XXXXXXX 100644
39
--- a/hw/intc/Kconfig
40
+++ b/hw/intc/Kconfig
41
@@ -XXX,XX +XXX,XX @@ config APIC
42
select MSI_NONBROKEN
43
select I8259
44
45
+config ARM_GIC_TCG
46
+ bool
47
+ default y
48
+ depends on ARM_GIC && TCG
49
+
50
config ARM_GIC_KVM
51
bool
52
default y
53
diff --git a/hw/intc/meson.build b/hw/intc/meson.build
54
index XXXXXXX..XXXXXXX 100644
55
--- a/hw/intc/meson.build
56
+++ b/hw/intc/meson.build
57
@@ -XXX,XX +XXX,XX @@ softmmu_ss.add(when: 'CONFIG_ARM_GIC', if_true: files(
58
'arm_gic.c',
59
'arm_gic_common.c',
60
'arm_gicv2m.c',
61
- 'arm_gicv3.c',
62
'arm_gicv3_common.c',
63
- 'arm_gicv3_dist.c',
64
'arm_gicv3_its_common.c',
65
- 'arm_gicv3_redist.c',
66
+))
67
+softmmu_ss.add(when: 'CONFIG_ARM_GIC_TCG', if_true: files(
68
+ 'arm_gicv3.c',
69
+ 'arm_gicv3_dist.c',
70
'arm_gicv3_its.c',
71
+ 'arm_gicv3_redist.c',
72
))
73
softmmu_ss.add(when: 'CONFIG_ETRAXFS', if_true: files('etraxfs_pic.c'))
74
softmmu_ss.add(when: 'CONFIG_HEATHROW_PIC', if_true: files('heathrow_pic.c'))
75
@@ -XXX,XX +XXX,XX @@ softmmu_ss.add(when: 'CONFIG_XLNX_ZYNQMP_PMU', if_true: files('xlnx-pmu-iomod-in
76
specific_ss.add(when: 'CONFIG_ALLWINNER_A10_PIC', if_true: files('allwinner-a10-pic.c'))
77
specific_ss.add(when: 'CONFIG_APIC', if_true: files('apic.c', 'apic_common.c'))
78
specific_ss.add(when: 'CONFIG_ARM_GIC', if_true: files('arm_gicv3_cpuif_common.c'))
79
-specific_ss.add(when: 'CONFIG_ARM_GIC', if_true: files('arm_gicv3_cpuif.c'))
80
+specific_ss.add(when: 'CONFIG_ARM_GIC_TCG', if_true: files('arm_gicv3_cpuif.c'))
81
specific_ss.add(when: 'CONFIG_ARM_GIC_KVM', if_true: files('arm_gic_kvm.c'))
82
specific_ss.add(when: ['CONFIG_ARM_GIC_KVM', 'TARGET_AARCH64'], if_true: files('arm_gicv3_kvm.c', 'arm_gicv3_its_kvm.c'))
83
specific_ss.add(when: 'CONFIG_ARM_V7M', if_true: files('armv7m_nvic.c'))
84
--
85
2.25.1
86
87
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
2
2
3
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
3
Missed during automatic conversion from commit 8063396bf3
4
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
4
("Use OBJECT_DECLARE_SIMPLE_TYPE when possible").
5
6
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
7
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
8
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
9
Message-id: 20230113200138.52869-4-philmd@linaro.org
5
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6
---
11
---
7
target/arm/translate.c | 9 +++++----
12
include/hw/or-irq.h | 3 +--
8
1 file changed, 5 insertions(+), 4 deletions(-)
13
1 file changed, 1 insertion(+), 2 deletions(-)
9
14
10
diff --git a/target/arm/translate.c b/target/arm/translate.c
15
diff --git a/include/hw/or-irq.h b/include/hw/or-irq.h
11
index XXXXXXX..XXXXXXX 100644
16
index XXXXXXX..XXXXXXX 100644
12
--- a/target/arm/translate.c
17
--- a/include/hw/or-irq.h
13
+++ b/target/arm/translate.c
18
+++ b/include/hw/or-irq.h
14
@@ -XXX,XX +XXX,XX @@ static void arm_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu)
19
@@ -XXX,XX +XXX,XX @@
15
{
20
16
DisasContext *dc = container_of(dcbase, DisasContext, base);
21
typedef struct OrIRQState qemu_or_irq;
17
CPUARMState *env = cpu->env_ptr;
22
18
+ uint32_t pc = dc->base.pc_next;
23
-DECLARE_INSTANCE_CHECKER(qemu_or_irq, OR_IRQ,
19
unsigned int insn;
24
- TYPE_OR_IRQ)
20
25
+OBJECT_DECLARE_SIMPLE_TYPE(OrIRQState, OR_IRQ)
21
if (arm_pre_translate_insn(dc)) {
26
22
- dc->base.pc_next += 4;
27
struct OrIRQState {
23
+ dc->base.pc_next = pc + 4;
28
DeviceState parent_obj;
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
--
29
--
38
2.25.1
30
2.34.1
39
31
40
32
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
2
2
3
Create arm_check_ss_active and arm_check_kernelpage.
3
OBJECT_DECLARE_SIMPLE_TYPE() macro provides the OrIRQState
4
4
declaration for free. Besides, the QOM code style is to use
5
Reverse the order of the tests. While it doesn't matter in practice,
5
the structure name as typedef, and QEMU style is to use Camel
6
because only user-only has a kernel page and user-only never sets
6
Case, so rename qemu_or_irq as OrIRQState.
7
ss_active, ss_active has priority over execution exceptions and it
7
8
is best to keep them in the proper order.
8
Mechanical change using:
9
9
10
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
10
$ sed -i -e 's/qemu_or_irq/OrIRQState/g' $(git grep -l qemu_or_irq)
11
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
11
12
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
13
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
14
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
15
Message-id: 20230113200138.52869-5-philmd@linaro.org
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
16
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
---
17
---
14
target/arm/translate.c | 10 +++++++---
18
include/hw/arm/armsse.h | 6 +++---
15
1 file changed, 7 insertions(+), 3 deletions(-)
19
include/hw/arm/bcm2835_peripherals.h | 2 +-
16
20
include/hw/arm/exynos4210.h | 4 ++--
17
diff --git a/target/arm/translate.c b/target/arm/translate.c
21
include/hw/arm/stm32f205_soc.h | 2 +-
18
index XXXXXXX..XXXXXXX 100644
22
include/hw/arm/stm32f405_soc.h | 2 +-
19
--- a/target/arm/translate.c
23
include/hw/arm/xlnx-versal.h | 6 +++---
20
+++ b/target/arm/translate.c
24
include/hw/arm/xlnx-zynqmp.h | 2 +-
21
@@ -XXX,XX +XXX,XX @@ static void arm_tr_insn_start(DisasContextBase *dcbase, CPUState *cpu)
25
include/hw/or-irq.h | 2 --
22
dc->insn_start = tcg_last_op();
26
hw/arm/exynos4210.c | 4 ++--
27
hw/arm/mps2-tz.c | 2 +-
28
hw/core/or-irq.c | 18 +++++++++---------
29
hw/pci-host/raven.c | 2 +-
30
12 files changed, 25 insertions(+), 27 deletions(-)
31
32
diff --git a/include/hw/arm/armsse.h b/include/hw/arm/armsse.h
33
index XXXXXXX..XXXXXXX 100644
34
--- a/include/hw/arm/armsse.h
35
+++ b/include/hw/arm/armsse.h
36
@@ -XXX,XX +XXX,XX @@ struct ARMSSE {
37
TZPPC apb_ppc[NUM_INTERNAL_PPCS];
38
TZMPC mpc[IOTS_NUM_MPC];
39
CMSDKAPBTimer timer[3];
40
- qemu_or_irq ppc_irq_orgate;
41
+ OrIRQState ppc_irq_orgate;
42
SplitIRQ sec_resp_splitter;
43
SplitIRQ ppc_irq_splitter[NUM_PPCS];
44
SplitIRQ mpc_irq_splitter[IOTS_NUM_EXP_MPC + IOTS_NUM_MPC];
45
- qemu_or_irq mpc_irq_orgate;
46
- qemu_or_irq nmi_orgate;
47
+ OrIRQState mpc_irq_orgate;
48
+ OrIRQState nmi_orgate;
49
50
SplitIRQ cpu_irq_splitter[NUM_SSE_IRQS];
51
52
diff --git a/include/hw/arm/bcm2835_peripherals.h b/include/hw/arm/bcm2835_peripherals.h
53
index XXXXXXX..XXXXXXX 100644
54
--- a/include/hw/arm/bcm2835_peripherals.h
55
+++ b/include/hw/arm/bcm2835_peripherals.h
56
@@ -XXX,XX +XXX,XX @@ struct BCM2835PeripheralState {
57
BCM2835AuxState aux;
58
BCM2835FBState fb;
59
BCM2835DMAState dma;
60
- qemu_or_irq orgated_dma_irq;
61
+ OrIRQState orgated_dma_irq;
62
BCM2835ICState ic;
63
BCM2835PropertyState property;
64
BCM2835RngState rng;
65
diff --git a/include/hw/arm/exynos4210.h b/include/hw/arm/exynos4210.h
66
index XXXXXXX..XXXXXXX 100644
67
--- a/include/hw/arm/exynos4210.h
68
+++ b/include/hw/arm/exynos4210.h
69
@@ -XXX,XX +XXX,XX @@ struct Exynos4210State {
70
MemoryRegion boot_secondary;
71
MemoryRegion bootreg_mem;
72
I2CBus *i2c_if[EXYNOS4210_I2C_NUMBER];
73
- qemu_or_irq pl330_irq_orgate[EXYNOS4210_NUM_DMA];
74
- qemu_or_irq cpu_irq_orgate[EXYNOS4210_NCPUS];
75
+ OrIRQState pl330_irq_orgate[EXYNOS4210_NUM_DMA];
76
+ OrIRQState cpu_irq_orgate[EXYNOS4210_NCPUS];
77
A9MPPrivState a9mpcore;
78
Exynos4210GicState ext_gic;
79
Exynos4210CombinerState int_combiner;
80
diff --git a/include/hw/arm/stm32f205_soc.h b/include/hw/arm/stm32f205_soc.h
81
index XXXXXXX..XXXXXXX 100644
82
--- a/include/hw/arm/stm32f205_soc.h
83
+++ b/include/hw/arm/stm32f205_soc.h
84
@@ -XXX,XX +XXX,XX @@ struct STM32F205State {
85
STM32F2XXADCState adc[STM_NUM_ADCS];
86
STM32F2XXSPIState spi[STM_NUM_SPIS];
87
88
- qemu_or_irq *adc_irqs;
89
+ OrIRQState *adc_irqs;
90
91
MemoryRegion sram;
92
MemoryRegion flash;
93
diff --git a/include/hw/arm/stm32f405_soc.h b/include/hw/arm/stm32f405_soc.h
94
index XXXXXXX..XXXXXXX 100644
95
--- a/include/hw/arm/stm32f405_soc.h
96
+++ b/include/hw/arm/stm32f405_soc.h
97
@@ -XXX,XX +XXX,XX @@ struct STM32F405State {
98
STM32F4xxExtiState exti;
99
STM32F2XXUsartState usart[STM_NUM_USARTS];
100
STM32F2XXTimerState timer[STM_NUM_TIMERS];
101
- qemu_or_irq adc_irqs;
102
+ OrIRQState adc_irqs;
103
STM32F2XXADCState adc[STM_NUM_ADCS];
104
STM32F2XXSPIState spi[STM_NUM_SPIS];
105
106
diff --git a/include/hw/arm/xlnx-versal.h b/include/hw/arm/xlnx-versal.h
107
index XXXXXXX..XXXXXXX 100644
108
--- a/include/hw/arm/xlnx-versal.h
109
+++ b/include/hw/arm/xlnx-versal.h
110
@@ -XXX,XX +XXX,XX @@ struct Versal {
111
} rpu;
112
113
struct {
114
- qemu_or_irq irq_orgate;
115
+ OrIRQState irq_orgate;
116
XlnxXramCtrl ctrl[XLNX_VERSAL_NR_XRAM];
117
} xram;
118
119
@@ -XXX,XX +XXX,XX @@ struct Versal {
120
XlnxCSUDMA dma_src;
121
XlnxCSUDMA dma_dst;
122
MemoryRegion linear_mr;
123
- qemu_or_irq irq_orgate;
124
+ OrIRQState irq_orgate;
125
} ospi;
126
} iou;
127
128
@@ -XXX,XX +XXX,XX @@ struct Versal {
129
XlnxVersalEFuseCtrl efuse_ctrl;
130
XlnxVersalEFuseCache efuse_cache;
131
132
- qemu_or_irq apb_irq_orgate;
133
+ OrIRQState apb_irq_orgate;
134
} pmc;
135
136
struct {
137
diff --git a/include/hw/arm/xlnx-zynqmp.h b/include/hw/arm/xlnx-zynqmp.h
138
index XXXXXXX..XXXXXXX 100644
139
--- a/include/hw/arm/xlnx-zynqmp.h
140
+++ b/include/hw/arm/xlnx-zynqmp.h
141
@@ -XXX,XX +XXX,XX @@ struct XlnxZynqMPState {
142
XlnxZDMA gdma[XLNX_ZYNQMP_NUM_GDMA_CH];
143
XlnxZDMA adma[XLNX_ZYNQMP_NUM_ADMA_CH];
144
XlnxCSUDMA qspi_dma;
145
- qemu_or_irq qspi_irq_orgate;
146
+ OrIRQState qspi_irq_orgate;
147
XlnxZynqMPAPUCtrl apu_ctrl;
148
XlnxZynqMPCRF crf;
149
CadenceTTCState ttc[XLNX_ZYNQMP_NUM_TTC];
150
diff --git a/include/hw/or-irq.h b/include/hw/or-irq.h
151
index XXXXXXX..XXXXXXX 100644
152
--- a/include/hw/or-irq.h
153
+++ b/include/hw/or-irq.h
154
@@ -XXX,XX +XXX,XX @@
155
*/
156
#define MAX_OR_LINES 48
157
158
-typedef struct OrIRQState qemu_or_irq;
159
-
160
OBJECT_DECLARE_SIMPLE_TYPE(OrIRQState, OR_IRQ)
161
162
struct OrIRQState {
163
diff --git a/hw/arm/exynos4210.c b/hw/arm/exynos4210.c
164
index XXXXXXX..XXXXXXX 100644
165
--- a/hw/arm/exynos4210.c
166
+++ b/hw/arm/exynos4210.c
167
@@ -XXX,XX +XXX,XX @@ static uint64_t exynos4210_calc_affinity(int cpu)
168
return (0x9 << ARM_AFF1_SHIFT) | cpu;
23
}
169
}
24
170
25
-static bool arm_pre_translate_insn(DisasContext *dc)
171
-static DeviceState *pl330_create(uint32_t base, qemu_or_irq *orgate,
26
+static bool arm_check_kernelpage(DisasContext *dc)
172
+static DeviceState *pl330_create(uint32_t base, OrIRQState *orgate,
27
{
173
qemu_irq irq, int nreq, int nevents, int width)
28
#ifdef CONFIG_USER_ONLY
174
{
29
/* Intercept jump to the magic kernel page. */
175
SysBusDevice *busdev;
30
@@ -XXX,XX +XXX,XX @@ static bool arm_pre_translate_insn(DisasContext *dc)
176
@@ -XXX,XX +XXX,XX @@ static void exynos4210_init(Object *obj)
31
return true;
177
32
}
178
for (i = 0; i < ARRAY_SIZE(s->pl330_irq_orgate); i++) {
33
#endif
179
char *name = g_strdup_printf("pl330-irq-orgate%d", i);
34
+ return false;
180
- qemu_or_irq *orgate = &s->pl330_irq_orgate[i];
35
+}
181
+ OrIRQState *orgate = &s->pl330_irq_orgate[i];
36
182
37
+static bool arm_check_ss_active(DisasContext *dc)
183
object_initialize_child(obj, name, orgate, TYPE_OR_IRQ);
38
+{
184
g_free(name);
39
if (dc->ss_active && !dc->pstate_ss) {
185
diff --git a/hw/arm/mps2-tz.c b/hw/arm/mps2-tz.c
40
/* Singlestep state is Active-pending.
186
index XXXXXXX..XXXXXXX 100644
41
* If we're in this state at the start of a TB then either
187
--- a/hw/arm/mps2-tz.c
42
@@ -XXX,XX +XXX,XX @@ static void arm_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu)
188
+++ b/hw/arm/mps2-tz.c
43
uint32_t pc = dc->base.pc_next;
189
@@ -XXX,XX +XXX,XX @@ struct MPS2TZMachineState {
44
unsigned int insn;
190
TZMSC msc[4];
45
191
CMSDKAPBUART uart[6];
46
- if (arm_pre_translate_insn(dc)) {
192
SplitIRQ sec_resp_splitter;
47
+ if (arm_check_ss_active(dc) || arm_check_kernelpage(dc)) {
193
- qemu_or_irq uart_irq_orgate;
48
dc->base.pc_next = pc + 4;
194
+ OrIRQState uart_irq_orgate;
49
return;
195
DeviceState *lan9118;
50
}
196
SplitIRQ cpu_irq_splitter[MPS2TZ_NUMIRQ_MAX];
51
@@ -XXX,XX +XXX,XX @@ static void thumb_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu)
197
Clock *sysclk;
52
uint32_t insn;
198
diff --git a/hw/core/or-irq.c b/hw/core/or-irq.c
53
bool is_16bit;
199
index XXXXXXX..XXXXXXX 100644
54
200
--- a/hw/core/or-irq.c
55
- if (arm_pre_translate_insn(dc)) {
201
+++ b/hw/core/or-irq.c
56
+ if (arm_check_ss_active(dc) || arm_check_kernelpage(dc)) {
202
@@ -XXX,XX +XXX,XX @@
57
dc->base.pc_next = pc + 2;
203
58
return;
204
static void or_irq_handler(void *opaque, int n, int level)
59
}
205
{
206
- qemu_or_irq *s = OR_IRQ(opaque);
207
+ OrIRQState *s = OR_IRQ(opaque);
208
int or_level = 0;
209
int i;
210
211
@@ -XXX,XX +XXX,XX @@ static void or_irq_handler(void *opaque, int n, int level)
212
213
static void or_irq_reset(DeviceState *dev)
214
{
215
- qemu_or_irq *s = OR_IRQ(dev);
216
+ OrIRQState *s = OR_IRQ(dev);
217
int i;
218
219
for (i = 0; i < MAX_OR_LINES; i++) {
220
@@ -XXX,XX +XXX,XX @@ static void or_irq_reset(DeviceState *dev)
221
222
static void or_irq_realize(DeviceState *dev, Error **errp)
223
{
224
- qemu_or_irq *s = OR_IRQ(dev);
225
+ OrIRQState *s = OR_IRQ(dev);
226
227
assert(s->num_lines <= MAX_OR_LINES);
228
229
@@ -XXX,XX +XXX,XX @@ static void or_irq_realize(DeviceState *dev, Error **errp)
230
231
static void or_irq_init(Object *obj)
232
{
233
- qemu_or_irq *s = OR_IRQ(obj);
234
+ OrIRQState *s = OR_IRQ(obj);
235
236
qdev_init_gpio_out(DEVICE(obj), &s->out_irq, 1);
237
}
238
@@ -XXX,XX +XXX,XX @@ static void or_irq_init(Object *obj)
239
240
static bool vmstate_extras_needed(void *opaque)
241
{
242
- qemu_or_irq *s = OR_IRQ(opaque);
243
+ OrIRQState *s = OR_IRQ(opaque);
244
245
return s->num_lines >= OLD_MAX_OR_LINES;
246
}
247
@@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_or_irq_extras = {
248
.minimum_version_id = 1,
249
.needed = vmstate_extras_needed,
250
.fields = (VMStateField[]) {
251
- VMSTATE_VARRAY_UINT16_UNSAFE(levels, qemu_or_irq, num_lines, 0,
252
+ VMSTATE_VARRAY_UINT16_UNSAFE(levels, OrIRQState, num_lines, 0,
253
vmstate_info_bool, bool),
254
VMSTATE_END_OF_LIST(),
255
},
256
@@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_or_irq = {
257
.version_id = 1,
258
.minimum_version_id = 1,
259
.fields = (VMStateField[]) {
260
- VMSTATE_BOOL_SUB_ARRAY(levels, qemu_or_irq, 0, OLD_MAX_OR_LINES),
261
+ VMSTATE_BOOL_SUB_ARRAY(levels, OrIRQState, 0, OLD_MAX_OR_LINES),
262
VMSTATE_END_OF_LIST(),
263
},
264
.subsections = (const VMStateDescription*[]) {
265
@@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_or_irq = {
266
};
267
268
static Property or_irq_properties[] = {
269
- DEFINE_PROP_UINT16("num-lines", qemu_or_irq, num_lines, 1),
270
+ DEFINE_PROP_UINT16("num-lines", OrIRQState, num_lines, 1),
271
DEFINE_PROP_END_OF_LIST(),
272
};
273
274
@@ -XXX,XX +XXX,XX @@ static void or_irq_class_init(ObjectClass *klass, void *data)
275
static const TypeInfo or_irq_type_info = {
276
.name = TYPE_OR_IRQ,
277
.parent = TYPE_DEVICE,
278
- .instance_size = sizeof(qemu_or_irq),
279
+ .instance_size = sizeof(OrIRQState),
280
.instance_init = or_irq_init,
281
.class_init = or_irq_class_init,
282
};
283
diff --git a/hw/pci-host/raven.c b/hw/pci-host/raven.c
284
index XXXXXXX..XXXXXXX 100644
285
--- a/hw/pci-host/raven.c
286
+++ b/hw/pci-host/raven.c
287
@@ -XXX,XX +XXX,XX @@ DECLARE_INSTANCE_CHECKER(PREPPCIState, RAVEN_PCI_HOST_BRIDGE,
288
struct PRePPCIState {
289
PCIHostState parent_obj;
290
291
- qemu_or_irq *or_irq;
292
+ OrIRQState *or_irq;
293
qemu_irq pci_irqs[PCI_NUM_PINS];
294
PCIBus pci_bus;
295
AddressSpace pci_io_as;
60
--
296
--
61
2.25.1
297
2.34.1
62
298
63
299
diff view generated by jsdifflib
Deleted patch
1
In the SSE decode function gen_sse(), we combine a byte
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
}
11
1
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
28
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
29
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
30
---
31
target/i386/tcg/translate.c | 12 +++---------
32
1 file changed, 3 insertions(+), 9 deletions(-)
33
34
diff --git a/target/i386/tcg/translate.c b/target/i386/tcg/translate.c
35
index XXXXXXX..XXXXXXX 100644
36
--- a/target/i386/tcg/translate.c
37
+++ b/target/i386/tcg/translate.c
38
@@ -XXX,XX +XXX,XX @@ static void gen_sse(CPUX86State *env, DisasContext *s, int b,
39
case 0x171: /* shift xmm, im */
40
case 0x172:
41
case 0x173:
42
- if (b1 >= 2) {
43
- goto unknown_op;
44
- }
45
val = x86_ldub_code(env, s);
46
if (is_xmm) {
47
tcg_gen_movi_tl(s->T0, val);
48
@@ -XXX,XX +XXX,XX @@ static void gen_sse(CPUX86State *env, DisasContext *s, int b,
49
offsetof(CPUX86State, mmx_t0.MMX_L(1)));
50
op1_offset = offsetof(CPUX86State,mmx_t0);
51
}
52
+ assert(b1 < 2);
53
sse_fn_epp = sse_op_table2[((b - 1) & 3) * 8 +
54
(((modrm >> 3)) & 7)][b1];
55
if (!sse_fn_epp) {
56
@@ -XXX,XX +XXX,XX @@ static void gen_sse(CPUX86State *env, DisasContext *s, int b,
57
rm = modrm & 7;
58
reg = ((modrm >> 3) & 7) | REX_R(s);
59
mod = (modrm >> 6) & 3;
60
- if (b1 >= 2) {
61
- goto unknown_op;
62
- }
63
64
+ assert(b1 < 2);
65
sse_fn_epp = sse_op_table6[b].op[b1];
66
if (!sse_fn_epp) {
67
goto unknown_op;
68
@@ -XXX,XX +XXX,XX @@ static void gen_sse(CPUX86State *env, DisasContext *s, int b,
69
rm = modrm & 7;
70
reg = ((modrm >> 3) & 7) | REX_R(s);
71
mod = (modrm >> 6) & 3;
72
- if (b1 >= 2) {
73
- goto unknown_op;
74
- }
75
76
+ assert(b1 < 2);
77
sse_fn_eppi = sse_op_table7[b].op[b1];
78
if (!sse_fn_eppi) {
79
goto unknown_op;
80
--
81
2.25.1
82
83
diff view generated by jsdifflib
Deleted patch
1
The qemu-common.h header is not supposed to be included from any
2
other header files, only from .c files (as documented in a comment at
3
the start of it).
4
1
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.
8
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
13
---
14
include/hw/i386/microvm.h | 1 -
15
include/hw/i386/x86.h | 1 -
16
2 files changed, 2 deletions(-)
17
18
diff --git a/include/hw/i386/microvm.h b/include/hw/i386/microvm.h
19
index XXXXXXX..XXXXXXX 100644
20
--- a/include/hw/i386/microvm.h
21
+++ b/include/hw/i386/microvm.h
22
@@ -XXX,XX +XXX,XX @@
23
#ifndef HW_I386_MICROVM_H
24
#define HW_I386_MICROVM_H
25
26
-#include "qemu-common.h"
27
#include "exec/hwaddr.h"
28
#include "qemu/notify.h"
29
30
diff --git a/include/hw/i386/x86.h b/include/hw/i386/x86.h
31
index XXXXXXX..XXXXXXX 100644
32
--- a/include/hw/i386/x86.h
33
+++ b/include/hw/i386/x86.h
34
@@ -XXX,XX +XXX,XX @@
35
#ifndef HW_I386_X86_H
36
#define HW_I386_X86_H
37
38
-#include "qemu-common.h"
39
#include "exec/hwaddr.h"
40
#include "qemu/notify.h"
41
42
--
43
2.25.1
44
45
diff view generated by jsdifflib
Deleted patch
1
The qemu-common.h header is not supposed to be included from any
2
other header files, only from .c files (as documented in a comment at
3
the start of it).
4
1
5
Move the include to linux-user/hexagon/cpu_loop.c, which needs it for
6
the declaration of cpu_exec_step_atomic().
7
8
Signed-off-by: Peter Maydell <peter.maydell@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
13
---
14
target/hexagon/cpu.h | 1 -
15
linux-user/hexagon/cpu_loop.c | 1 +
16
2 files changed, 1 insertion(+), 1 deletion(-)
17
18
diff --git a/target/hexagon/cpu.h b/target/hexagon/cpu.h
19
index XXXXXXX..XXXXXXX 100644
20
--- a/target/hexagon/cpu.h
21
+++ b/target/hexagon/cpu.h
22
@@ -XXX,XX +XXX,XX @@ typedef struct CPUHexagonState CPUHexagonState;
23
24
#include "fpu/softfloat-types.h"
25
26
-#include "qemu-common.h"
27
#include "exec/cpu-defs.h"
28
#include "hex_regs.h"
29
#include "mmvec/mmvec.h"
30
diff --git a/linux-user/hexagon/cpu_loop.c b/linux-user/hexagon/cpu_loop.c
31
index XXXXXXX..XXXXXXX 100644
32
--- a/linux-user/hexagon/cpu_loop.c
33
+++ b/linux-user/hexagon/cpu_loop.c
34
@@ -XXX,XX +XXX,XX @@
35
*/
36
37
#include "qemu/osdep.h"
38
+#include "qemu-common.h"
39
#include "qemu.h"
40
#include "user-internals.h"
41
#include "cpu_loop-common.h"
42
--
43
2.25.1
44
45
diff view generated by jsdifflib