1 | target-arm queue. This has the "plumb txattrs through various | 1 | The following changes since commit b11728dc3ae67ddedf34b7a4f318170e7092803c: |
---|---|---|---|
2 | bits of exec.c" patches, and a collection of bug fixes from | ||
3 | various people. | ||
4 | 2 | ||
5 | thanks | 3 | Merge tag 'pull-riscv-to-apply-20230224' of github.com:palmer-dabbelt/qemu into staging (2023-02-26 20:14:46 +0000) |
6 | -- PMM | ||
7 | |||
8 | |||
9 | |||
10 | The following changes since commit a3ac12fba028df90f7b3dbec924995c126c41022: | ||
11 | |||
12 | Merge remote-tracking branch 'remotes/ehabkost/tags/numa-next-pull-request' into staging (2018-05-31 11:12:36 +0100) | ||
13 | 4 | ||
14 | are available in the Git repository at: | 5 | are available in the Git repository at: |
15 | 6 | ||
16 | git://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20180531 | 7 | https://git.linaro.org/people/pmaydell/qemu-arm.git pull-target-arm-20230227 |
17 | 8 | ||
18 | for you to fetch changes up to 49d1dca0520ea71bc21867fab6647f474fcf857b: | 9 | for you to fetch changes up to e844f0c5d0bd2c4d8d3c1622eb2a88586c9c4677: |
19 | 10 | ||
20 | KVM: GIC: Fix memory leak due to calling kvm_init_irq_routing twice (2018-05-31 14:52:53 +0100) | 11 | hw: Replace qemu_or_irq typedef by OrIRQState (2023-02-27 13:27:05 +0000) |
21 | 12 | ||
22 | ---------------------------------------------------------------- | 13 | ---------------------------------------------------------------- |
23 | target-arm queue: | 14 | target-arm queue: |
24 | * target/arm: Honour FPCR.FZ in FRECPX | 15 | * Various code cleanups |
25 | * MAINTAINERS: Add entries for newer MPS2 boards and devices | 16 | * More refactoring working towards allowing a build |
26 | * hw/intc/arm_gicv3: Fix APxR<n> register dispatching | 17 | without CONFIG_TCG |
27 | * arm_gicv3_kvm: fix bug in writing zero bits back to the in-kernel | ||
28 | GIC state | ||
29 | * tcg: Fix helper function vs host abi for float16 | ||
30 | * arm: fix qemu crash on startup with -bios option | ||
31 | * arm: fix malloc type mismatch | ||
32 | * xlnx-zdma: Correct mem leaks and memset to zero on desc unaligned errors | ||
33 | * Correct CPACR reset value for v7 cores | ||
34 | * memory.h: Improve IOMMU related documentation | ||
35 | * exec: Plumb transaction attributes through various functions in | ||
36 | preparation for allowing IOMMUs to see them | ||
37 | * vmstate.h: Provide VMSTATE_BOOL_SUB_ARRAY | ||
38 | * ARM: ACPI: Fix use-after-free due to memory realloc | ||
39 | * KVM: GIC: Fix memory leak due to calling kvm_init_irq_routing twice | ||
40 | 18 | ||
41 | ---------------------------------------------------------------- | 19 | ---------------------------------------------------------------- |
42 | Francisco Iglesias (1): | 20 | Claudio Fontana (2): |
43 | xlnx-zdma: Correct mem leaks and memset to zero on desc unaligned errors | 21 | target/arm: move helpers to tcg/ |
22 | target/arm: Move psci.c into the tcg directory | ||
44 | 23 | ||
45 | Igor Mammedov (1): | 24 | Fabiano Rosas (9): |
46 | arm: fix qemu crash on startup with -bios option | 25 | target/arm: Wrap breakpoint/watchpoint updates with tcg_enabled |
26 | target/arm: Wrap TCG-only code in debug_helper.c | ||
27 | target/arm: move translate modules to tcg/ | ||
28 | target/arm: Wrap arm_rebuild_hflags calls with tcg_enabled | ||
29 | target/arm: Move hflags code into the tcg directory | ||
30 | target/arm: Move regime_using_lpae_format into internal.h | ||
31 | target/arm: Don't access TCG code when debugging with KVM | ||
32 | cpu-defs.h: Expose CPUTLBEntryFull to non-TCG code | ||
33 | tests/avocado: add machine:none tag to version.py | ||
47 | 34 | ||
48 | Jan Kiszka (1): | 35 | Philippe Mathieu-Daudé (13): |
49 | hw/intc/arm_gicv3: Fix APxR<n> register dispatching | 36 | hw/gpio/max7310: Simplify max7310_realize() |
37 | hw/char/pl011: Un-inline pl011_create() | ||
38 | hw/char/pl011: Open-code pl011_luminary_create() | ||
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 | Paolo Bonzini (1): | 50 | Thomas Huth (1): |
52 | arm: fix malloc type mismatch | 51 | include/hw/arm/allwinner-a10.h: Remove superfluous includes from the header |
53 | 52 | ||
54 | Peter Maydell (17): | 53 | MAINTAINERS | 1 + |
55 | target/arm: Honour FPCR.FZ in FRECPX | 54 | include/exec/cpu-defs.h | 6 + |
56 | MAINTAINERS: Add entries for newer MPS2 boards and devices | 55 | include/hw/arm/allwinner-a10.h | 2 - |
57 | Correct CPACR reset value for v7 cores | 56 | include/hw/arm/armsse.h | 6 +- |
58 | memory.h: Improve IOMMU related documentation | 57 | include/hw/arm/bcm2835_peripherals.h | 2 +- |
59 | Make tb_invalidate_phys_addr() take a MemTxAttrs argument | 58 | include/hw/arm/exynos4210.h | 4 +- |
60 | Make address_space_translate{, _cached}() take a MemTxAttrs argument | 59 | include/hw/arm/stm32f205_soc.h | 2 +- |
61 | Make address_space_map() take a MemTxAttrs argument | 60 | include/hw/arm/stm32f405_soc.h | 2 +- |
62 | Make address_space_access_valid() take a MemTxAttrs argument | 61 | include/hw/arm/xlnx-versal.h | 6 +- |
63 | Make flatview_extend_translation() take a MemTxAttrs argument | 62 | include/hw/arm/xlnx-zynqmp.h | 2 +- |
64 | Make memory_region_access_valid() take a MemTxAttrs argument | 63 | include/hw/char/cmsdk-apb-uart.h | 34 --- |
65 | Make MemoryRegion valid.accepts callback take a MemTxAttrs argument | 64 | include/hw/char/pl011.h | 36 +-- |
66 | Make flatview_access_valid() take a MemTxAttrs argument | 65 | include/hw/char/xilinx_uartlite.h | 22 +- |
67 | Make flatview_translate() take a MemTxAttrs argument | 66 | include/hw/or-irq.h | 5 +- |
68 | Make address_space_get_iotlb_entry() take a MemTxAttrs argument | 67 | include/hw/timer/cmsdk-apb-timer.h | 1 - |
69 | Make flatview_do_translate() take a MemTxAttrs argument | 68 | target/arm/internals.h | 23 +- |
70 | Make address_space_translate_iommu take a MemTxAttrs argument | 69 | target/arm/{ => tcg}/translate-a64.h | 0 |
71 | vmstate.h: Provide VMSTATE_BOOL_SUB_ARRAY | 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 | ||
72 | 178 | ||
73 | Richard Henderson (1): | ||
74 | tcg: Fix helper function vs host abi for float16 | ||
75 | |||
76 | Shannon Zhao (3): | ||
77 | arm_gicv3_kvm: increase clroffset accordingly | ||
78 | ARM: ACPI: Fix use-after-free due to memory realloc | ||
79 | KVM: GIC: Fix memory leak due to calling kvm_init_irq_routing twice | ||
80 | |||
81 | include/exec/exec-all.h | 5 +- | ||
82 | include/exec/helper-head.h | 2 +- | ||
83 | include/exec/memory-internal.h | 3 +- | ||
84 | include/exec/memory.h | 128 +++++++++++++++++++++++++++++++++++------ | ||
85 | include/migration/vmstate.h | 3 + | ||
86 | include/sysemu/dma.h | 6 +- | ||
87 | accel/tcg/translate-all.c | 4 +- | ||
88 | exec.c | 95 ++++++++++++++++++------------ | ||
89 | hw/arm/boot.c | 18 +++--- | ||
90 | hw/arm/virt-acpi-build.c | 20 +++++-- | ||
91 | hw/dma/xlnx-zdma.c | 10 +++- | ||
92 | hw/hppa/dino.c | 3 +- | ||
93 | hw/intc/arm_gic_kvm.c | 1 - | ||
94 | hw/intc/arm_gicv3_cpuif.c | 12 ++-- | ||
95 | hw/intc/arm_gicv3_kvm.c | 2 +- | ||
96 | hw/nvram/fw_cfg.c | 12 ++-- | ||
97 | hw/s390x/s390-pci-inst.c | 3 +- | ||
98 | hw/scsi/esp.c | 3 +- | ||
99 | hw/vfio/common.c | 3 +- | ||
100 | hw/virtio/vhost.c | 3 +- | ||
101 | hw/xen/xen_pt_msi.c | 3 +- | ||
102 | memory.c | 12 ++-- | ||
103 | memory_ldst.inc.c | 18 +++--- | ||
104 | target/arm/gdbstub.c | 3 +- | ||
105 | target/arm/helper-a64.c | 41 +++++++------ | ||
106 | target/arm/helper.c | 90 ++++++++++++++++------------- | ||
107 | target/ppc/mmu-hash64.c | 3 +- | ||
108 | target/riscv/helper.c | 2 +- | ||
109 | target/s390x/diag.c | 6 +- | ||
110 | target/s390x/excp_helper.c | 3 +- | ||
111 | target/s390x/mmu_helper.c | 3 +- | ||
112 | target/s390x/sigp.c | 3 +- | ||
113 | target/xtensa/op_helper.c | 3 +- | ||
114 | MAINTAINERS | 9 ++- | ||
115 | 34 files changed, 353 insertions(+), 182 deletions(-) | ||
116 | diff view generated by jsdifflib |
1 | Provide a VMSTATE_BOOL_SUB_ARRAY to go with VMSTATE_UINT8_SUB_ARRAY | 1 | From: Thomas Huth <thuth@redhat.com> |
---|---|---|---|
2 | and friends. | ||
3 | 2 | ||
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. | ||
5 | |||
6 | Signed-off-by: Thomas Huth <thuth@redhat.com> | ||
7 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | ||
8 | Message-id: 20230215152233.210024-1-thuth@redhat.com | ||
4 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
5 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | ||
6 | Message-id: 20180521140402.23318-23-peter.maydell@linaro.org | ||
7 | --- | 10 | --- |
8 | include/migration/vmstate.h | 3 +++ | 11 | include/hw/arm/allwinner-a10.h | 2 -- |
9 | 1 file changed, 3 insertions(+) | 12 | hw/arm/allwinner-a10.c | 1 + |
13 | 2 files changed, 1 insertion(+), 2 deletions(-) | ||
10 | 14 | ||
11 | diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h | 15 | diff --git a/include/hw/arm/allwinner-a10.h b/include/hw/arm/allwinner-a10.h |
12 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
13 | --- a/include/migration/vmstate.h | 17 | --- a/include/hw/arm/allwinner-a10.h |
14 | +++ b/include/migration/vmstate.h | 18 | +++ b/include/hw/arm/allwinner-a10.h |
15 | @@ -XXX,XX +XXX,XX @@ extern const VMStateInfo vmstate_info_qtailq; | 19 | @@ -XXX,XX +XXX,XX @@ |
16 | #define VMSTATE_BOOL_ARRAY(_f, _s, _n) \ | 20 | #ifndef HW_ARM_ALLWINNER_A10_H |
17 | VMSTATE_BOOL_ARRAY_V(_f, _s, _n, 0) | 21 | #define HW_ARM_ALLWINNER_A10_H |
18 | 22 | ||
19 | +#define VMSTATE_BOOL_SUB_ARRAY(_f, _s, _start, _num) \ | 23 | -#include "hw/char/serial.h" |
20 | + VMSTATE_SUB_ARRAY(_f, _s, _start, _num, 0, vmstate_info_bool, bool) | 24 | #include "hw/arm/boot.h" |
21 | + | 25 | -#include "hw/pci/pci_device.h" |
22 | #define VMSTATE_UINT16_ARRAY_V(_f, _s, _n, _v) \ | 26 | #include "hw/timer/allwinner-a10-pit.h" |
23 | VMSTATE_ARRAY(_f, _s, _n, _v, vmstate_info_uint16, uint16_t) | 27 | #include "hw/intc/allwinner-a10-pic.h" |
24 | 28 | #include "hw/net/allwinner_emac.h" | |
29 | diff --git a/hw/arm/allwinner-a10.c b/hw/arm/allwinner-a10.c | ||
30 | index XXXXXXX..XXXXXXX 100644 | ||
31 | --- a/hw/arm/allwinner-a10.c | ||
32 | +++ b/hw/arm/allwinner-a10.c | ||
33 | @@ -XXX,XX +XXX,XX @@ | ||
34 | #include "qemu/osdep.h" | ||
35 | #include "qapi/error.h" | ||
36 | #include "qemu/module.h" | ||
37 | +#include "hw/char/serial.h" | ||
38 | #include "hw/sysbus.h" | ||
39 | #include "hw/arm/allwinner-a10.h" | ||
40 | #include "hw/misc/unimp.h" | ||
25 | -- | 41 | -- |
26 | 2.17.1 | 42 | 2.34.1 |
27 | 43 | ||
28 | 44 | diff view generated by jsdifflib |
1 | As part of plumbing MemTxAttrs down to the IOMMU translate method, | 1 | From: Fabiano Rosas <farosas@suse.de> |
---|---|---|---|
2 | add MemTxAttrs as an argument to flatview_access_valid(). | ||
3 | Its callers now all have an attrs value to hand, so we can | ||
4 | correct our earlier temporary use of MEMTXATTRS_UNSPECIFIED. | ||
5 | 2 | ||
3 | This is in preparation for restricting compilation of some parts of | ||
4 | debug_helper.c to TCG only. | ||
5 | |||
6 | Signed-off-by: Fabiano Rosas <farosas@suse.de> | ||
7 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
7 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | ||
8 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
9 | Message-id: 20180521140402.23318-10-peter.maydell@linaro.org | ||
10 | --- | 9 | --- |
11 | exec.c | 12 +++++------- | 10 | target/arm/cpu.c | 6 ++++-- |
12 | 1 file changed, 5 insertions(+), 7 deletions(-) | 11 | target/arm/debug_helper.c | 16 ++++++++++++---- |
12 | target/arm/machine.c | 7 +++++-- | ||
13 | 3 files changed, 21 insertions(+), 8 deletions(-) | ||
13 | 14 | ||
14 | diff --git a/exec.c b/exec.c | 15 | diff --git a/target/arm/cpu.c b/target/arm/cpu.c |
15 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/exec.c | 17 | --- a/target/arm/cpu.c |
17 | +++ b/exec.c | 18 | +++ b/target/arm/cpu.c |
18 | @@ -XXX,XX +XXX,XX @@ static MemTxResult flatview_read(FlatView *fv, hwaddr addr, | 19 | @@ -XXX,XX +XXX,XX @@ static void arm_cpu_reset_hold(Object *obj) |
19 | static MemTxResult flatview_write(FlatView *fv, hwaddr addr, MemTxAttrs attrs, | 20 | } |
20 | const uint8_t *buf, int len); | ||
21 | static bool flatview_access_valid(FlatView *fv, hwaddr addr, int len, | ||
22 | - bool is_write); | ||
23 | + bool is_write, MemTxAttrs attrs); | ||
24 | |||
25 | static MemTxResult subpage_read(void *opaque, hwaddr addr, uint64_t *data, | ||
26 | unsigned len, MemTxAttrs attrs) | ||
27 | @@ -XXX,XX +XXX,XX @@ static bool subpage_accepts(void *opaque, hwaddr addr, | ||
28 | #endif | 21 | #endif |
29 | 22 | ||
30 | return flatview_access_valid(subpage->fv, addr + subpage->base, | 23 | - hw_breakpoint_update_all(cpu); |
31 | - len, is_write); | 24 | - hw_watchpoint_update_all(cpu); |
32 | + len, is_write, attrs); | 25 | + if (tcg_enabled()) { |
26 | + hw_breakpoint_update_all(cpu); | ||
27 | + hw_watchpoint_update_all(cpu); | ||
28 | + } | ||
29 | arm_rebuild_hflags(env); | ||
33 | } | 30 | } |
34 | 31 | ||
35 | static const MemoryRegionOps subpage_ops = { | 32 | diff --git a/target/arm/debug_helper.c b/target/arm/debug_helper.c |
36 | @@ -XXX,XX +XXX,XX @@ static void cpu_notify_map_clients(void) | 33 | index XXXXXXX..XXXXXXX 100644 |
34 | --- a/target/arm/debug_helper.c | ||
35 | +++ b/target/arm/debug_helper.c | ||
36 | @@ -XXX,XX +XXX,XX @@ static void dbgwvr_write(CPUARMState *env, const ARMCPRegInfo *ri, | ||
37 | value &= ~3ULL; | ||
38 | |||
39 | raw_write(env, ri, value); | ||
40 | - hw_watchpoint_update(cpu, i); | ||
41 | + if (tcg_enabled()) { | ||
42 | + hw_watchpoint_update(cpu, i); | ||
43 | + } | ||
37 | } | 44 | } |
38 | 45 | ||
39 | static bool flatview_access_valid(FlatView *fv, hwaddr addr, int len, | 46 | static void dbgwcr_write(CPUARMState *env, const ARMCPRegInfo *ri, |
40 | - bool is_write) | 47 | @@ -XXX,XX +XXX,XX @@ static void dbgwcr_write(CPUARMState *env, const ARMCPRegInfo *ri, |
41 | + bool is_write, MemTxAttrs attrs) | 48 | int i = ri->crm; |
42 | { | 49 | |
43 | MemoryRegion *mr; | 50 | raw_write(env, ri, value); |
44 | hwaddr l, xlat; | 51 | - hw_watchpoint_update(cpu, i); |
45 | @@ -XXX,XX +XXX,XX @@ static bool flatview_access_valid(FlatView *fv, hwaddr addr, int len, | 52 | + if (tcg_enabled()) { |
46 | mr = flatview_translate(fv, addr, &xlat, &l, is_write); | 53 | + hw_watchpoint_update(cpu, i); |
47 | if (!memory_access_is_direct(mr, is_write)) { | 54 | + } |
48 | l = memory_access_size(mr, l, addr); | ||
49 | - /* When our callers all have attrs we'll pass them through here */ | ||
50 | - if (!memory_region_access_valid(mr, xlat, l, is_write, | ||
51 | - MEMTXATTRS_UNSPECIFIED)) { | ||
52 | + if (!memory_region_access_valid(mr, xlat, l, is_write, attrs)) { | ||
53 | return false; | ||
54 | } | ||
55 | } | ||
56 | @@ -XXX,XX +XXX,XX @@ bool address_space_access_valid(AddressSpace *as, hwaddr addr, | ||
57 | |||
58 | rcu_read_lock(); | ||
59 | fv = address_space_to_flatview(as); | ||
60 | - result = flatview_access_valid(fv, addr, len, is_write); | ||
61 | + result = flatview_access_valid(fv, addr, len, is_write, attrs); | ||
62 | rcu_read_unlock(); | ||
63 | return result; | ||
64 | } | 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 | + } | ||
102 | |||
103 | /* | ||
104 | * TCG gen_update_fp_context() relies on the invariant that | ||
65 | -- | 105 | -- |
66 | 2.17.1 | 106 | 2.34.1 |
67 | |||
68 | diff view generated by jsdifflib |
1 | As part of plumbing MemTxAttrs down to the IOMMU translate method, | 1 | From: Fabiano Rosas <farosas@suse.de> |
---|---|---|---|
2 | add MemTxAttrs as an argument to tb_invalidate_phys_addr(). | ||
3 | Its callers either have an attrs value to hand, or don't care | ||
4 | and can use MEMTXATTRS_UNSPECIFIED. | ||
5 | 2 | ||
3 | The next few patches will move helpers under CONFIG_TCG. We'd prefer | ||
4 | to keep the debug helpers and debug registers close together, so | ||
5 | rearrange the file a bit to be able to wrap the helpers with a TCG | ||
6 | ifdef. | ||
7 | |||
8 | Signed-off-by: Fabiano Rosas <farosas@suse.de> | ||
9 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
7 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
8 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | ||
9 | Message-id: 20180521140402.23318-3-peter.maydell@linaro.org | ||
10 | --- | 11 | --- |
11 | include/exec/exec-all.h | 5 +++-- | 12 | target/arm/debug_helper.c | 476 +++++++++++++++++++------------------- |
12 | accel/tcg/translate-all.c | 2 +- | 13 | 1 file changed, 239 insertions(+), 237 deletions(-) |
13 | exec.c | 2 +- | ||
14 | target/xtensa/op_helper.c | 3 ++- | ||
15 | 4 files changed, 7 insertions(+), 5 deletions(-) | ||
16 | 14 | ||
17 | diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h | 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/include/exec/exec-all.h | 17 | --- a/target/arm/debug_helper.c |
20 | +++ b/include/exec/exec-all.h | 18 | +++ b/target/arm/debug_helper.c |
21 | @@ -XXX,XX +XXX,XX @@ void tlb_set_page_with_attrs(CPUState *cpu, target_ulong vaddr, | 19 | @@ -XXX,XX +XXX,XX @@ |
22 | void tlb_set_page(CPUState *cpu, target_ulong vaddr, | 20 | #include "cpregs.h" |
23 | hwaddr paddr, int prot, | 21 | #include "exec/exec-all.h" |
24 | int mmu_idx, target_ulong size); | 22 | #include "exec/helper-proto.h" |
25 | -void tb_invalidate_phys_addr(AddressSpace *as, hwaddr addr); | 23 | +#include "sysemu/tcg.h" |
26 | +void tb_invalidate_phys_addr(AddressSpace *as, hwaddr addr, MemTxAttrs attrs); | 24 | |
27 | void probe_write(CPUArchState *env, target_ulong addr, int size, int mmu_idx, | 25 | - |
28 | uintptr_t retaddr); | 26 | +#ifdef CONFIG_TCG |
29 | #else | 27 | /* Return the Exception Level targeted by debug exceptions. */ |
30 | @@ -XXX,XX +XXX,XX @@ static inline void tlb_flush_by_mmuidx_all_cpus_synced(CPUState *cpu, | 28 | static int arm_debug_target_el(CPUARMState *env) |
31 | uint16_t idxmap) | ||
32 | { | 29 | { |
30 | @@ -XXX,XX +XXX,XX @@ void HELPER(exception_swstep)(CPUARMState *env, uint32_t syndrome) | ||
31 | raise_exception_debug(env, EXCP_UDEF, syndrome); | ||
33 | } | 32 | } |
34 | -static inline void tb_invalidate_phys_addr(AddressSpace *as, hwaddr addr) | 33 | |
35 | +static inline void tb_invalidate_phys_addr(AddressSpace *as, hwaddr addr, | 34 | +void hw_watchpoint_update(ARMCPU *cpu, int n) |
36 | + MemTxAttrs attrs) | 35 | +{ |
36 | + CPUARMState *env = &cpu->env; | ||
37 | + vaddr len = 0; | ||
38 | + vaddr wvr = env->cp15.dbgwvr[n]; | ||
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 | + } | ||
67 | + | ||
68 | + /* | ||
69 | + * Attempts to use both MASK and BAS fields simultaneously are | ||
70 | + * CONSTRAINED UNPREDICTABLE; we opt to ignore BAS in this case, | ||
71 | + * thus generating a watchpoint for every byte in the masked region. | ||
72 | + */ | ||
73 | + mask = FIELD_EX64(wcr, DBGWCR, MASK); | ||
74 | + if (mask == 1 || mask == 2) { | ||
75 | + /* | ||
76 | + * Reserved values of MASK; we must act as if the mask value was | ||
77 | + * some non-reserved value, or as if the watchpoint were disabled. | ||
78 | + * We choose the latter. | ||
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]); | ||
121 | +} | ||
122 | + | ||
123 | +void hw_watchpoint_update_all(ARMCPU *cpu) | ||
124 | +{ | ||
125 | + int i; | ||
126 | + CPUARMState *env = &cpu->env; | ||
127 | + | ||
128 | + /* | ||
129 | + * Completely clear out existing QEMU watchpoints and our array, to | ||
130 | + * avoid possible stale entries following migration load. | ||
131 | + */ | ||
132 | + cpu_watchpoint_remove_all(CPU(cpu), BP_CPU); | ||
133 | + memset(env->cpu_watchpoint, 0, sizeof(env->cpu_watchpoint)); | ||
134 | + | ||
135 | + for (i = 0; i < ARRAY_SIZE(cpu->env.cpu_watchpoint); i++) { | ||
136 | + hw_watchpoint_update(cpu, i); | ||
137 | + } | ||
138 | +} | ||
139 | + | ||
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) | ||
37 | { | 386 | { |
38 | } | 387 | @@ -XXX,XX +XXX,XX @@ static void dbgwcr_write(CPUARMState *env, const ARMCPRegInfo *ri, |
39 | #endif | ||
40 | diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c | ||
41 | index XXXXXXX..XXXXXXX 100644 | ||
42 | --- a/accel/tcg/translate-all.c | ||
43 | +++ b/accel/tcg/translate-all.c | ||
44 | @@ -XXX,XX +XXX,XX @@ static TranslationBlock *tb_find_pc(uintptr_t tc_ptr) | ||
45 | } | ||
46 | |||
47 | #if !defined(CONFIG_USER_ONLY) | ||
48 | -void tb_invalidate_phys_addr(AddressSpace *as, hwaddr addr) | ||
49 | +void tb_invalidate_phys_addr(AddressSpace *as, hwaddr addr, MemTxAttrs attrs) | ||
50 | { | ||
51 | ram_addr_t ram_addr; | ||
52 | MemoryRegion *mr; | ||
53 | diff --git a/exec.c b/exec.c | ||
54 | index XXXXXXX..XXXXXXX 100644 | ||
55 | --- a/exec.c | ||
56 | +++ b/exec.c | ||
57 | @@ -XXX,XX +XXX,XX @@ static void breakpoint_invalidate(CPUState *cpu, target_ulong pc) | ||
58 | if (phys != -1) { | ||
59 | /* Locks grabbed by tb_invalidate_phys_addr */ | ||
60 | tb_invalidate_phys_addr(cpu->cpu_ases[asidx].as, | ||
61 | - phys | (pc & ~TARGET_PAGE_MASK)); | ||
62 | + phys | (pc & ~TARGET_PAGE_MASK), attrs); | ||
63 | } | 388 | } |
64 | } | 389 | } |
65 | #endif | 390 | |
66 | diff --git a/target/xtensa/op_helper.c b/target/xtensa/op_helper.c | 391 | -void hw_breakpoint_update(ARMCPU *cpu, int n) |
67 | index XXXXXXX..XXXXXXX 100644 | 392 | -{ |
68 | --- a/target/xtensa/op_helper.c | 393 | - CPUARMState *env = &cpu->env; |
69 | +++ b/target/xtensa/op_helper.c | 394 | - uint64_t bvr = env->cp15.dbgbvr[n]; |
70 | @@ -XXX,XX +XXX,XX @@ static void tb_invalidate_virtual_addr(CPUXtensaState *env, uint32_t vaddr) | 395 | - uint64_t bcr = env->cp15.dbgbcr[n]; |
71 | int ret = xtensa_get_physical_addr(env, false, vaddr, 2, 0, | 396 | - vaddr addr; |
72 | &paddr, &page_size, &access); | 397 | - int bt; |
73 | if (ret == 0) { | 398 | - int flags = BP_CPU; |
74 | - tb_invalidate_phys_addr(&address_space_memory, paddr); | 399 | - |
75 | + tb_invalidate_phys_addr(&address_space_memory, paddr, | 400 | - if (env->cpu_breakpoint[n]) { |
76 | + MEMTXATTRS_UNSPECIFIED); | 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); | ||
77 | } | 499 | } |
78 | } | 500 | } |
79 | 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.17.1 | 529 | 2.34.1 |
82 | |||
83 | diff view generated by jsdifflib |
1 | Add entries to MAINTAINERS to cover the newer MPS2 boards and | 1 | From: Fabiano Rosas <farosas@suse.de> |
---|---|---|---|
2 | the new devices they use. | 2 | |
3 | 3 | Introduce the target/arm/tcg directory. Its purpose is to hold the TCG | |
4 | code that is selected by CONFIG_TCG. | ||
5 | |||
6 | Signed-off-by: Claudio Fontana <cfontana@suse.de> | ||
7 | Signed-off-by: Fabiano Rosas <farosas@suse.de> | ||
8 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
9 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | ||
10 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
11 | Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
4 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
5 | Message-id: 20180518153157.14899-1-peter.maydell@linaro.org | ||
6 | --- | 13 | --- |
7 | MAINTAINERS | 9 +++++++-- | 14 | MAINTAINERS | 1 + |
8 | 1 file changed, 7 insertions(+), 2 deletions(-) | 15 | target/arm/{ => tcg}/translate-a64.h | 0 |
16 | target/arm/{ => tcg}/translate.h | 0 | ||
17 | target/arm/{ => tcg}/a32-uncond.decode | 0 | ||
18 | target/arm/{ => tcg}/a32.decode | 0 | ||
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%) | ||
9 | 67 | ||
10 | diff --git a/MAINTAINERS b/MAINTAINERS | 68 | diff --git a/MAINTAINERS b/MAINTAINERS |
11 | index XXXXXXX..XXXXXXX 100644 | 69 | index XXXXXXX..XXXXXXX 100644 |
12 | --- a/MAINTAINERS | 70 | --- a/MAINTAINERS |
13 | +++ b/MAINTAINERS | 71 | +++ b/MAINTAINERS |
14 | @@ -XXX,XX +XXX,XX @@ F: hw/timer/cmsdk-apb-timer.c | ||
15 | F: include/hw/timer/cmsdk-apb-timer.h | ||
16 | F: hw/char/cmsdk-apb-uart.c | ||
17 | F: include/hw/char/cmsdk-apb-uart.h | ||
18 | +F: hw/misc/tz-ppc.c | ||
19 | +F: include/hw/misc/tz-ppc.h | ||
20 | |||
21 | ARM cores | ||
22 | M: Peter Maydell <peter.maydell@linaro.org> | ||
23 | @@ -XXX,XX +XXX,XX @@ M: Peter Maydell <peter.maydell@linaro.org> | 72 | @@ -XXX,XX +XXX,XX @@ M: Peter Maydell <peter.maydell@linaro.org> |
24 | L: qemu-arm@nongnu.org | 73 | L: qemu-arm@nongnu.org |
25 | S: Maintained | 74 | S: Maintained |
26 | F: hw/arm/mps2.c | 75 | F: target/arm/ |
27 | -F: hw/misc/mps2-scc.c | 76 | +F: target/arm/tcg/ |
28 | -F: include/hw/misc/mps2-scc.h | 77 | F: tests/tcg/arm/ |
29 | +F: hw/arm/mps2-tz.c | 78 | F: tests/tcg/aarch64/ |
30 | +F: hw/misc/mps2-*.c | 79 | F: tests/qtest/arm-cpu-features.c |
31 | +F: include/hw/misc/mps2-*.h | 80 | diff --git a/target/arm/translate-a64.h b/target/arm/tcg/translate-a64.h |
32 | +F: hw/arm/iotkit.c | 81 | similarity index 100% |
33 | +F: include/hw/arm/iotkit.h | 82 | rename from target/arm/translate-a64.h |
34 | 83 | rename to target/arm/tcg/translate-a64.h | |
35 | Musicpal | 84 | diff --git a/target/arm/translate.h b/target/arm/tcg/translate.h |
36 | M: Jan Kiszka <jan.kiszka@web.de> | 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 | ||
180 | @@ -XXX,XX +XXX,XX @@ | ||
181 | -gen = [ | ||
182 | - decodetree.process('sve.decode', extra_args: '--decode=disas_sve'), | ||
183 | - decodetree.process('sme.decode', extra_args: '--decode=disas_sme'), | ||
184 | - decodetree.process('sme-fa64.decode', extra_args: '--static-decode=disas_sme_fa64'), | ||
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 | ||
239 | index XXXXXXX..XXXXXXX 100644 | ||
240 | --- a/target/arm/meson.build | ||
241 | +++ b/target/arm/tcg/meson.build | ||
242 | @@ -XXX,XX +XXX,XX @@ gen = [ | ||
243 | decodetree.process('t16.decode', extra_args: ['-w', '16', '--static-decode=disas_t16']), | ||
244 | ] | ||
245 | |||
246 | -arm_ss = ss.source_set() | ||
247 | arm_ss.add(gen) | ||
248 | + | ||
249 | arm_ss.add(files( | ||
250 | - 'cpu.c', | ||
251 | - 'crypto_helper.c', | ||
252 | - 'debug_helper.c', | ||
253 | - 'gdbstub.c', | ||
254 | - 'helper.c', | ||
255 | - 'iwmmxt_helper.c', | ||
256 | - 'm_helper.c', | ||
257 | - 'mve_helper.c', | ||
258 | - 'neon_helper.c', | ||
259 | - 'op_helper.c', | ||
260 | - 'tlb_helper.c', | ||
261 | 'translate.c', | ||
262 | 'translate-m-nocp.c', | ||
263 | 'translate-mve.c', | ||
264 | 'translate-neon.c', | ||
265 | 'translate-vfp.c', | ||
266 | - 'vec_helper.c', | ||
267 | - 'vfp_helper.c', | ||
268 | - 'cpu_tcg.c', | ||
269 | )) | ||
270 | -arm_ss.add(zlib) | ||
271 | - | ||
272 | -arm_ss.add(when: 'CONFIG_KVM', if_true: files('kvm.c', 'kvm64.c'), if_false: files('kvm-stub.c')) | ||
273 | |||
274 | arm_ss.add(when: 'TARGET_AARCH64', if_true: files( | ||
275 | - 'cpu64.c', | ||
276 | - 'gdbstub64.c', | ||
277 | - 'helper-a64.c', | ||
278 | - 'mte_helper.c', | ||
279 | - 'pauth_helper.c', | ||
280 | - 'sve_helper.c', | ||
281 | - 'sme_helper.c', | ||
282 | 'translate-a64.c', | ||
283 | 'translate-sve.c', | ||
284 | 'translate-sme.c', | ||
285 | )) | ||
286 | - | ||
287 | -arm_softmmu_ss = ss.source_set() | ||
288 | -arm_softmmu_ss.add(files( | ||
289 | - 'arch_dump.c', | ||
290 | - 'arm-powerctl.c', | ||
291 | - 'machine.c', | ||
292 | - 'monitor.c', | ||
293 | - 'psci.c', | ||
294 | - 'ptw.c', | ||
295 | -)) | ||
296 | - | ||
297 | -subdir('hvf') | ||
298 | - | ||
299 | -target_arch += {'arm': arm_ss} | ||
300 | -target_softmmu_arch += {'arm': arm_softmmu_ss} | ||
37 | -- | 301 | -- |
38 | 2.17.1 | 302 | 2.34.1 |
39 | 303 | ||
40 | 304 | diff view generated by jsdifflib |
1 | As part of plumbing MemTxAttrs down to the IOMMU translate method, | 1 | From: Claudio Fontana <cfontana@suse.de> |
---|---|---|---|
2 | add MemTxAttrs as an argument to flatview_do_translate(). | 2 | |
3 | 3 | Signed-off-by: Claudio Fontana <cfontana@suse.de> | |
4 | Signed-off-by: Fabiano Rosas <farosas@suse.de> | ||
5 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
6 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
7 | Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
4 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
5 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | ||
6 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Message-id: 20180521140402.23318-13-peter.maydell@linaro.org | ||
8 | --- | 9 | --- |
9 | exec.c | 9 ++++++--- | 10 | target/arm/{ => tcg}/vec_internal.h | 0 |
10 | 1 file changed, 6 insertions(+), 3 deletions(-) | 11 | target/arm/tcg-stubs.c | 23 +++++++++++++++++++++++ |
11 | 12 | target/arm/{ => tcg}/crypto_helper.c | 0 | |
12 | diff --git a/exec.c b/exec.c | 13 | target/arm/{ => tcg}/helper-a64.c | 0 |
14 | target/arm/{ => tcg}/iwmmxt_helper.c | 0 | ||
15 | target/arm/{ => tcg}/m_helper.c | 0 | ||
16 | target/arm/{ => tcg}/mte_helper.c | 0 | ||
17 | target/arm/{ => tcg}/mve_helper.c | 0 | ||
18 | target/arm/{ => tcg}/neon_helper.c | 0 | ||
19 | target/arm/{ => tcg}/op_helper.c | 0 | ||
20 | target/arm/{ => tcg}/pauth_helper.c | 0 | ||
21 | target/arm/{ => tcg}/sme_helper.c | 0 | ||
22 | target/arm/{ => tcg}/sve_helper.c | 0 | ||
23 | target/arm/{ => tcg}/tlb_helper.c | 0 | ||
24 | target/arm/{ => tcg}/vec_helper.c | 0 | ||
25 | target/arm/meson.build | 15 ++------------- | ||
26 | target/arm/tcg/meson.build | 13 +++++++++++++ | ||
27 | 17 files changed, 38 insertions(+), 13 deletions(-) | ||
28 | rename target/arm/{ => tcg}/vec_internal.h (100%) | ||
29 | create mode 100644 target/arm/tcg-stubs.c | ||
30 | rename target/arm/{ => tcg}/crypto_helper.c (100%) | ||
31 | rename target/arm/{ => tcg}/helper-a64.c (100%) | ||
32 | rename target/arm/{ => tcg}/iwmmxt_helper.c (100%) | ||
33 | rename target/arm/{ => tcg}/m_helper.c (100%) | ||
34 | rename target/arm/{ => tcg}/mte_helper.c (100%) | ||
35 | rename target/arm/{ => tcg}/mve_helper.c (100%) | ||
36 | rename target/arm/{ => tcg}/neon_helper.c (100%) | ||
37 | rename target/arm/{ => tcg}/op_helper.c (100%) | ||
38 | rename target/arm/{ => tcg}/pauth_helper.c (100%) | ||
39 | rename target/arm/{ => tcg}/sme_helper.c (100%) | ||
40 | rename target/arm/{ => tcg}/sve_helper.c (100%) | ||
41 | rename target/arm/{ => tcg}/tlb_helper.c (100%) | ||
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 | ||
49 | new file mode 100644 | ||
50 | index XXXXXXX..XXXXXXX | ||
51 | --- /dev/null | ||
52 | +++ b/target/arm/tcg-stubs.c | ||
53 | @@ -XXX,XX +XXX,XX @@ | ||
54 | +/* | ||
55 | + * QEMU ARM stubs for some TCG helper functions | ||
56 | + * | ||
57 | + * Copyright 2021 SUSE LLC | ||
58 | + * | ||
59 | + * This work is licensed under the terms of the GNU GPL, version 2 or later. | ||
60 | + * See the COPYING file in the top-level directory. | ||
61 | + */ | ||
62 | + | ||
63 | +#include "qemu/osdep.h" | ||
64 | +#include "cpu.h" | ||
65 | +#include "internals.h" | ||
66 | + | ||
67 | +void write_v7m_exception(CPUARMState *env, uint32_t new_exc) | ||
68 | +{ | ||
69 | + g_assert_not_reached(); | ||
70 | +} | ||
71 | + | ||
72 | +void raise_exception_ra(CPUARMState *env, uint32_t excp, uint32_t syndrome, | ||
73 | + uint32_t target_el, uintptr_t ra) | ||
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 | ||
13 | index XXXXXXX..XXXXXXX 100644 | 130 | index XXXXXXX..XXXXXXX 100644 |
14 | --- a/exec.c | 131 | --- a/target/arm/meson.build |
15 | +++ b/exec.c | 132 | +++ b/target/arm/meson.build |
16 | @@ -XXX,XX +XXX,XX @@ unassigned: | 133 | @@ -XXX,XX +XXX,XX @@ |
17 | * @is_write: whether the translation operation is for write | 134 | arm_ss = ss.source_set() |
18 | * @is_mmio: whether this can be MMIO, set true if it can | 135 | arm_ss.add(files( |
19 | * @target_as: the address space targeted by the IOMMU | 136 | 'cpu.c', |
20 | + * @attrs: memory transaction attributes | 137 | - 'crypto_helper.c', |
21 | * | 138 | 'debug_helper.c', |
22 | * This function is called from RCU critical section | 139 | 'gdbstub.c', |
23 | */ | 140 | 'helper.c', |
24 | @@ -XXX,XX +XXX,XX @@ static MemoryRegionSection flatview_do_translate(FlatView *fv, | 141 | - 'iwmmxt_helper.c', |
25 | hwaddr *page_mask_out, | 142 | - 'm_helper.c', |
26 | bool is_write, | 143 | - 'mve_helper.c', |
27 | bool is_mmio, | 144 | - 'neon_helper.c', |
28 | - AddressSpace **target_as) | 145 | - 'op_helper.c', |
29 | + AddressSpace **target_as, | 146 | - 'tlb_helper.c', |
30 | + MemTxAttrs attrs) | 147 | - 'vec_helper.c', |
31 | { | 148 | 'vfp_helper.c', |
32 | MemoryRegionSection *section; | 149 | 'cpu_tcg.c', |
33 | IOMMUMemoryRegion *iommu_mr; | 150 | )) |
34 | @@ -XXX,XX +XXX,XX @@ IOMMUTLBEntry address_space_get_iotlb_entry(AddressSpace *as, hwaddr addr, | 151 | @@ -XXX,XX +XXX,XX @@ arm_ss.add(when: 'CONFIG_KVM', if_true: files('kvm.c', 'kvm64.c'), if_false: fil |
35 | * but page mask. | 152 | arm_ss.add(when: 'TARGET_AARCH64', if_true: files( |
36 | */ | 153 | 'cpu64.c', |
37 | section = flatview_do_translate(address_space_to_flatview(as), addr, &xlat, | 154 | 'gdbstub64.c', |
38 | - NULL, &page_mask, is_write, false, &as); | 155 | - 'helper-a64.c', |
39 | + NULL, &page_mask, is_write, false, &as, | 156 | - 'mte_helper.c', |
40 | + attrs); | 157 | - 'pauth_helper.c', |
41 | 158 | - 'sve_helper.c', | |
42 | /* Illegal translation */ | 159 | - 'sme_helper.c', |
43 | if (section.mr == &io_mem_unassigned) { | 160 | )) |
44 | @@ -XXX,XX +XXX,XX @@ MemoryRegion *flatview_translate(FlatView *fv, hwaddr addr, hwaddr *xlat, | 161 | |
45 | 162 | arm_softmmu_ss = ss.source_set() | |
46 | /* This can be MMIO, so setup MMIO bit. */ | 163 | @@ -XXX,XX +XXX,XX @@ subdir('hvf') |
47 | section = flatview_do_translate(fv, addr, xlat, plen, NULL, | 164 | |
48 | - is_write, true, &as); | 165 | if 'CONFIG_TCG' in config_all |
49 | + is_write, true, &as, attrs); | 166 | subdir('tcg') |
50 | mr = section.mr; | 167 | +else |
51 | 168 | + arm_ss.add(files('tcg-stubs.c')) | |
52 | if (xen_enabled() && memory_access_is_direct(mr, is_write)) { | 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 | )) | ||
53 | -- | 200 | -- |
54 | 2.17.1 | 201 | 2.34.1 |
55 | 202 | ||
56 | 203 | diff view generated by jsdifflib |
1 | As part of plumbing MemTxAttrs down to the IOMMU translate method, | 1 | From: Claudio Fontana <cfontana@suse.de> |
---|---|---|---|
2 | add MemTxAttrs as an argument to address_space_get_iotlb_entry(). | ||
3 | 2 | ||
3 | Signed-off-by: Claudio Fontana <cfontana@suse.de> | ||
4 | Signed-off-by: Fabiano Rosas <farosas@suse.de> | ||
5 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
6 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | ||
7 | Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
4 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
5 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | ||
6 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Message-id: 20180521140402.23318-12-peter.maydell@linaro.org | ||
8 | --- | 9 | --- |
9 | include/exec/memory.h | 2 +- | 10 | target/arm/{ => tcg}/psci.c | 0 |
10 | exec.c | 2 +- | 11 | target/arm/meson.build | 1 - |
11 | hw/virtio/vhost.c | 3 ++- | 12 | target/arm/tcg/meson.build | 4 ++++ |
12 | 3 files changed, 4 insertions(+), 3 deletions(-) | 13 | 3 files changed, 4 insertions(+), 1 deletion(-) |
14 | rename target/arm/{ => tcg}/psci.c (100%) | ||
13 | 15 | ||
14 | diff --git a/include/exec/memory.h b/include/exec/memory.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 | ||
15 | index XXXXXXX..XXXXXXX 100644 | 21 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/include/exec/memory.h | 22 | --- a/target/arm/meson.build |
17 | +++ b/include/exec/memory.h | 23 | +++ b/target/arm/meson.build |
18 | @@ -XXX,XX +XXX,XX @@ void address_space_cache_destroy(MemoryRegionCache *cache); | 24 | @@ -XXX,XX +XXX,XX @@ arm_softmmu_ss.add(files( |
19 | * entry. Should be called from an RCU critical section. | 25 | 'arm-powerctl.c', |
20 | */ | 26 | 'machine.c', |
21 | IOMMUTLBEntry address_space_get_iotlb_entry(AddressSpace *as, hwaddr addr, | 27 | 'monitor.c', |
22 | - bool is_write); | 28 | - 'psci.c', |
23 | + bool is_write, MemTxAttrs attrs); | 29 | 'ptw.c', |
24 | 30 | )) | |
25 | /* address_space_translate: translate an address range into an address space | 31 | |
26 | * into a MemoryRegion and an address range into that section. Should be | 32 | diff --git a/target/arm/tcg/meson.build b/target/arm/tcg/meson.build |
27 | diff --git a/exec.c b/exec.c | ||
28 | index XXXXXXX..XXXXXXX 100644 | 33 | index XXXXXXX..XXXXXXX 100644 |
29 | --- a/exec.c | 34 | --- a/target/arm/tcg/meson.build |
30 | +++ b/exec.c | 35 | +++ b/target/arm/tcg/meson.build |
31 | @@ -XXX,XX +XXX,XX @@ static MemoryRegionSection flatview_do_translate(FlatView *fv, | 36 | @@ -XXX,XX +XXX,XX @@ arm_ss.add(when: 'TARGET_AARCH64', if_true: files( |
32 | 37 | 'sme_helper.c', | |
33 | /* Called from RCU critical section */ | 38 | 'sve_helper.c', |
34 | IOMMUTLBEntry address_space_get_iotlb_entry(AddressSpace *as, hwaddr addr, | 39 | )) |
35 | - bool is_write) | 40 | + |
36 | + bool is_write, MemTxAttrs attrs) | 41 | +arm_softmmu_ss.add(files( |
37 | { | 42 | + 'psci.c', |
38 | MemoryRegionSection section; | 43 | +)) |
39 | hwaddr xlat, page_mask; | ||
40 | diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c | ||
41 | index XXXXXXX..XXXXXXX 100644 | ||
42 | --- a/hw/virtio/vhost.c | ||
43 | +++ b/hw/virtio/vhost.c | ||
44 | @@ -XXX,XX +XXX,XX @@ int vhost_device_iotlb_miss(struct vhost_dev *dev, uint64_t iova, int write) | ||
45 | trace_vhost_iotlb_miss(dev, 1); | ||
46 | |||
47 | iotlb = address_space_get_iotlb_entry(dev->vdev->dma_as, | ||
48 | - iova, write); | ||
49 | + iova, write, | ||
50 | + MEMTXATTRS_UNSPECIFIED); | ||
51 | if (iotlb.target_as != NULL) { | ||
52 | ret = vhost_memory_region_lookup(dev, iotlb.translated_addr, | ||
53 | &uaddr, &len); | ||
54 | -- | 44 | -- |
55 | 2.17.1 | 45 | 2.34.1 |
56 | 46 | ||
57 | 47 | diff view generated by jsdifflib |
1 | From: Igor Mammedov <imammedo@redhat.com> | 1 | From: Fabiano Rosas <farosas@suse.de> |
---|---|---|---|
2 | 2 | ||
3 | When QEMU is started with following CLI | 3 | This is in preparation to moving the hflags code into its own file |
4 | -machine virt,gic-version=3,accel=kvm -cpu host -bios AAVMF_CODE.fd | 4 | under the tcg/ directory. |
5 | it crashes with abort at | 5 | |
6 | accel/kvm/kvm-all.c:2164: | 6 | Signed-off-by: Fabiano Rosas <farosas@suse.de> |
7 | KVM_SET_DEVICE_ATTR failed: Group 6 attr 0x000000000000c665: Invalid argument | 7 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
8 | 8 | Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org> | |
9 | Which is caused by implicit dependency of kvm_arm_gicv3_reset() on | ||
10 | arm_gicv3_icc_reset() where the later is called by CPU reset | ||
11 | reset callback. | ||
12 | |||
13 | However commit: | ||
14 | 3b77f6c arm/boot: split load_dtb() from arm_load_kernel() | ||
15 | broke CPU reset callback registration in case | ||
16 | |||
17 | arm_load_kernel() | ||
18 | ... | ||
19 | if (!info->kernel_filename || info->firmware_loaded) | ||
20 | |||
21 | branch is taken, i.e. it's sufficient to provide a firmware | ||
22 | or do not provide kernel on CLI to skip cpu reset callback | ||
23 | registration, where before offending commit the callback | ||
24 | has been registered unconditionally. | ||
25 | |||
26 | Fix it by registering the callback right at the beginning of | ||
27 | arm_load_kernel() unconditionally instead of doing it at the end. | ||
28 | |||
29 | NOTE: | ||
30 | we probably should eliminate that dependency anyways as well as | ||
31 | separate arch CPU reset parts from arm_load_kernel() into CPU | ||
32 | itself, but that refactoring that I probably would have to do | ||
33 | anyways later for CPU hotplug to work. | ||
34 | |||
35 | Reported-by: Auger Eric <eric.auger@redhat.com> | ||
36 | Signed-off-by: Igor Mammedov <imammedo@redhat.com> | ||
37 | Reviewed-by: Eric Auger <eric.auger@redhat.com> | ||
38 | Tested-by: Eric Auger <eric.auger@redhat.com> | ||
39 | Message-id: 1527070950-208350-1-git-send-email-imammedo@redhat.com | ||
40 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
41 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
42 | --- | 10 | --- |
43 | hw/arm/boot.c | 18 +++++++++--------- | 11 | hw/arm/boot.c | 6 +++++- |
44 | 1 file changed, 9 insertions(+), 9 deletions(-) | 12 | hw/intc/armv7m_nvic.c | 20 +++++++++++++------- |
13 | target/arm/arm-powerctl.c | 7 +++++-- | ||
14 | target/arm/cpu.c | 3 ++- | ||
15 | target/arm/helper.c | 18 +++++++++++++----- | ||
16 | target/arm/machine.c | 5 ++++- | ||
17 | 6 files changed, 42 insertions(+), 17 deletions(-) | ||
45 | 18 | ||
46 | diff --git a/hw/arm/boot.c b/hw/arm/boot.c | 19 | diff --git a/hw/arm/boot.c b/hw/arm/boot.c |
47 | index XXXXXXX..XXXXXXX 100644 | 20 | index XXXXXXX..XXXXXXX 100644 |
48 | --- a/hw/arm/boot.c | 21 | --- a/hw/arm/boot.c |
49 | +++ b/hw/arm/boot.c | 22 | +++ b/hw/arm/boot.c |
50 | @@ -XXX,XX +XXX,XX @@ void arm_load_kernel(ARMCPU *cpu, struct arm_boot_info *info) | 23 | @@ -XXX,XX +XXX,XX @@ |
51 | static const ARMInsnFixup *primary_loader; | 24 | #include "hw/arm/boot.h" |
52 | AddressSpace *as = arm_boot_address_space(cpu, info); | 25 | #include "hw/arm/linux-boot-if.h" |
53 | 26 | #include "sysemu/kvm.h" | |
54 | + /* CPU objects (unlike devices) are not automatically reset on system | 27 | +#include "sysemu/tcg.h" |
55 | + * reset, so we must always register a handler to do so. If we're | 28 | #include "sysemu/sysemu.h" |
56 | + * actually loading a kernel, the handler is also responsible for | 29 | #include "sysemu/numa.h" |
57 | + * arranging that we start it correctly. | 30 | #include "hw/boards.h" |
58 | + */ | 31 | @@ -XXX,XX +XXX,XX @@ static void do_cpu_reset(void *opaque) |
59 | + for (cs = first_cpu; cs; cs = CPU_NEXT(cs)) { | 32 | info->secondary_cpu_reset_hook(cpu, info); |
60 | + qemu_register_reset(do_cpu_reset, ARM_CPU(cs)); | 33 | } |
61 | + } | 34 | } |
62 | + | 35 | - arm_rebuild_hflags(env); |
63 | /* The board code is not supposed to set secure_board_setup unless | 36 | + |
64 | * running its code in secure mode is actually possible, and KVM | 37 | + if (tcg_enabled()) { |
65 | * doesn't support secure. | 38 | + arm_rebuild_hflags(env); |
66 | @@ -XXX,XX +XXX,XX @@ void arm_load_kernel(ARMCPU *cpu, struct arm_boot_info *info) | 39 | + } |
67 | ARM_CPU(cs)->env.boot_info = info; | 40 | } |
68 | } | 41 | } |
69 | 42 | ||
70 | - /* CPU objects (unlike devices) are not automatically reset on system | 43 | diff --git a/hw/intc/armv7m_nvic.c b/hw/intc/armv7m_nvic.c |
71 | - * reset, so we must always register a handler to do so. If we're | 44 | index XXXXXXX..XXXXXXX 100644 |
72 | - * actually loading a kernel, the handler is also responsible for | 45 | --- a/hw/intc/armv7m_nvic.c |
73 | - * arranging that we start it correctly. | 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. | ||
74 | - */ | 75 | - */ |
75 | - for (cs = first_cpu; cs; cs = CPU_NEXT(cs)) { | 76 | - arm_rebuild_hflags(&s->cpu->env); |
76 | - qemu_register_reset(do_cpu_reset, ARM_CPU(cs)); | 77 | + if (tcg_enabled()) { |
77 | - } | 78 | + /* |
78 | - | 79 | + * We updated state that affects the CPU's MMUidx and thus its |
79 | if (!info->skip_dtb_autoload && have_dtb(info)) { | 80 | + * hflags; and we can't guarantee that we run before the CPU |
80 | if (arm_load_dtb(info->dtb_start, info, info->dtb_limit, as) < 0) { | 81 | + * reset function. |
81 | exit(1); | 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 | |||
185 | diff --git a/target/arm/machine.c b/target/arm/machine.c | ||
186 | index XXXXXXX..XXXXXXX 100644 | ||
187 | --- a/target/arm/machine.c | ||
188 | +++ b/target/arm/machine.c | ||
189 | @@ -XXX,XX +XXX,XX @@ static int cpu_post_load(void *opaque, int version_id) | ||
190 | if (!kvm_enabled()) { | ||
191 | pmu_op_finish(&cpu->env); | ||
192 | } | ||
193 | - arm_rebuild_hflags(&cpu->env); | ||
194 | + | ||
195 | + if (tcg_enabled()) { | ||
196 | + arm_rebuild_hflags(&cpu->env); | ||
197 | + } | ||
198 | |||
199 | return 0; | ||
200 | } | ||
82 | -- | 201 | -- |
83 | 2.17.1 | 202 | 2.34.1 |
84 | 203 | ||
85 | 204 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | From: Fabiano Rosas <farosas@suse.de> |
---|---|---|---|
2 | 2 | ||
3 | Depending on the host abi, float16, aka uint16_t, values are | 3 | The hflags are used only for TCG code, so introduce a new file |
4 | passed and returned either zero-extended in the host register | 4 | hflags.c to keep that code. |
5 | or with garbage at the top of the host register. | ||
6 | 5 | ||
7 | The tcg code generator has so far been assuming garbage, as that | 6 | Signed-off-by: Fabiano Rosas <farosas@suse.de> |
8 | matches the x86 abi, but this is incorrect for other host abis. | 7 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
9 | Further, target/arm has so far been assuming zero-extended results, | 8 | Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
10 | so that it may store the 16-bit value into a 32-bit slot with the | ||
11 | high 16-bits already clear. | ||
12 | |||
13 | Rectify both problems by mapping "f16" in the helper definition | ||
14 | to uint32_t instead of (a typedef for) uint16_t. This forces | ||
15 | the host compiler to assume garbage in the upper 16 bits on input | ||
16 | and to zero-extend the result on output. | ||
17 | |||
18 | Cc: qemu-stable@nongnu.org | ||
19 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
20 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
21 | Tested-by: Laurent Desnogues <laurent.desnogues@gmail.com> | ||
22 | Message-id: 20180522175629.24932-1-richard.henderson@linaro.org | ||
23 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
24 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
25 | --- | 10 | --- |
26 | include/exec/helper-head.h | 2 +- | 11 | target/arm/internals.h | 2 + |
27 | target/arm/helper-a64.c | 35 +++++++++-------- | 12 | target/arm/helper.c | 393 +----------------------------------- |
28 | target/arm/helper.c | 80 +++++++++++++++++++------------------- | 13 | target/arm/tcg-stubs.c | 4 + |
29 | 3 files changed, 59 insertions(+), 58 deletions(-) | 14 | target/arm/tcg/hflags.c | 403 +++++++++++++++++++++++++++++++++++++ |
15 | target/arm/tcg/meson.build | 1 + | ||
16 | 5 files changed, 411 insertions(+), 392 deletions(-) | ||
17 | create mode 100644 target/arm/tcg/hflags.c | ||
30 | 18 | ||
31 | diff --git a/include/exec/helper-head.h b/include/exec/helper-head.h | 19 | diff --git a/target/arm/internals.h b/target/arm/internals.h |
32 | index XXXXXXX..XXXXXXX 100644 | 20 | index XXXXXXX..XXXXXXX 100644 |
33 | --- a/include/exec/helper-head.h | 21 | --- a/target/arm/internals.h |
34 | +++ b/include/exec/helper-head.h | 22 | +++ b/target/arm/internals.h |
35 | @@ -XXX,XX +XXX,XX @@ | 23 | @@ -XXX,XX +XXX,XX @@ ARMVAParameters aa64_va_parameters(CPUARMState *env, uint64_t va, |
36 | #define dh_ctype_int int | 24 | |
37 | #define dh_ctype_i64 uint64_t | 25 | int aa64_va_parameter_tbi(uint64_t tcr, ARMMMUIdx mmu_idx); |
38 | #define dh_ctype_s64 int64_t | 26 | int aa64_va_parameter_tbid(uint64_t tcr, ARMMMUIdx mmu_idx); |
39 | -#define dh_ctype_f16 float16 | 27 | +int aa64_va_parameter_tcma(uint64_t tcr, ARMMMUIdx mmu_idx); |
40 | +#define dh_ctype_f16 uint32_t | 28 | |
41 | #define dh_ctype_f32 float32 | 29 | /* Determine if allocation tags are available. */ |
42 | #define dh_ctype_f64 float64 | 30 | static inline bool allocation_tag_access_enabled(CPUARMState *env, int el, |
43 | #define dh_ctype_ptr void * | 31 | @@ -XXX,XX +XXX,XX @@ static inline bool arm_fgt_active(CPUARMState *env, int el) |
44 | diff --git a/target/arm/helper-a64.c b/target/arm/helper-a64.c | 32 | (!arm_feature(env, ARM_FEATURE_EL3) || (env->cp15.scr_el3 & SCR_FGTEN)); |
45 | index XXXXXXX..XXXXXXX 100644 | ||
46 | --- a/target/arm/helper-a64.c | ||
47 | +++ b/target/arm/helper-a64.c | ||
48 | @@ -XXX,XX +XXX,XX @@ static inline uint32_t float_rel_to_flags(int res) | ||
49 | return flags; | ||
50 | } | 33 | } |
51 | 34 | ||
52 | -uint64_t HELPER(vfp_cmph_a64)(float16 x, float16 y, void *fp_status) | 35 | +void assert_hflags_rebuild_correctly(CPUARMState *env); |
53 | +uint64_t HELPER(vfp_cmph_a64)(uint32_t x, uint32_t y, void *fp_status) | 36 | #endif |
54 | { | ||
55 | return float_rel_to_flags(float16_compare_quiet(x, y, fp_status)); | ||
56 | } | ||
57 | |||
58 | -uint64_t HELPER(vfp_cmpeh_a64)(float16 x, float16 y, void *fp_status) | ||
59 | +uint64_t HELPER(vfp_cmpeh_a64)(uint32_t x, uint32_t y, void *fp_status) | ||
60 | { | ||
61 | return float_rel_to_flags(float16_compare(x, y, fp_status)); | ||
62 | } | ||
63 | @@ -XXX,XX +XXX,XX @@ uint64_t HELPER(neon_cgt_f64)(float64 a, float64 b, void *fpstp) | ||
64 | #define float64_three make_float64(0x4008000000000000ULL) | ||
65 | #define float64_one_point_five make_float64(0x3FF8000000000000ULL) | ||
66 | |||
67 | -float16 HELPER(recpsf_f16)(float16 a, float16 b, void *fpstp) | ||
68 | +uint32_t HELPER(recpsf_f16)(uint32_t a, uint32_t b, void *fpstp) | ||
69 | { | ||
70 | float_status *fpst = fpstp; | ||
71 | |||
72 | @@ -XXX,XX +XXX,XX @@ float64 HELPER(recpsf_f64)(float64 a, float64 b, void *fpstp) | ||
73 | return float64_muladd(a, b, float64_two, 0, fpst); | ||
74 | } | ||
75 | |||
76 | -float16 HELPER(rsqrtsf_f16)(float16 a, float16 b, void *fpstp) | ||
77 | +uint32_t HELPER(rsqrtsf_f16)(uint32_t a, uint32_t b, void *fpstp) | ||
78 | { | ||
79 | float_status *fpst = fpstp; | ||
80 | |||
81 | @@ -XXX,XX +XXX,XX @@ uint64_t HELPER(neon_addlp_u16)(uint64_t a) | ||
82 | } | ||
83 | |||
84 | /* Floating-point reciprocal exponent - see FPRecpX in ARM ARM */ | ||
85 | -float16 HELPER(frecpx_f16)(float16 a, void *fpstp) | ||
86 | +uint32_t HELPER(frecpx_f16)(uint32_t a, void *fpstp) | ||
87 | { | ||
88 | float_status *fpst = fpstp; | ||
89 | uint16_t val16, sbit; | ||
90 | @@ -XXX,XX +XXX,XX @@ void HELPER(casp_be_parallel)(CPUARMState *env, uint32_t rs, uint64_t addr, | ||
91 | #define ADVSIMD_HELPER(name, suffix) HELPER(glue(glue(advsimd_, name), suffix)) | ||
92 | |||
93 | #define ADVSIMD_HALFOP(name) \ | ||
94 | -float16 ADVSIMD_HELPER(name, h)(float16 a, float16 b, void *fpstp) \ | ||
95 | +uint32_t ADVSIMD_HELPER(name, h)(uint32_t a, uint32_t b, void *fpstp) \ | ||
96 | { \ | ||
97 | float_status *fpst = fpstp; \ | ||
98 | return float16_ ## name(a, b, fpst); \ | ||
99 | @@ -XXX,XX +XXX,XX @@ ADVSIMD_HALFOP(mulx) | ||
100 | ADVSIMD_TWOHALFOP(mulx) | ||
101 | |||
102 | /* fused multiply-accumulate */ | ||
103 | -float16 HELPER(advsimd_muladdh)(float16 a, float16 b, float16 c, void *fpstp) | ||
104 | +uint32_t HELPER(advsimd_muladdh)(uint32_t a, uint32_t b, uint32_t c, | ||
105 | + void *fpstp) | ||
106 | { | ||
107 | float_status *fpst = fpstp; | ||
108 | return float16_muladd(a, b, c, 0, fpst); | ||
109 | @@ -XXX,XX +XXX,XX @@ uint32_t HELPER(advsimd_muladd2h)(uint32_t two_a, uint32_t two_b, | ||
110 | |||
111 | #define ADVSIMD_CMPRES(test) (test) ? 0xffff : 0 | ||
112 | |||
113 | -uint32_t HELPER(advsimd_ceq_f16)(float16 a, float16 b, void *fpstp) | ||
114 | +uint32_t HELPER(advsimd_ceq_f16)(uint32_t a, uint32_t b, void *fpstp) | ||
115 | { | ||
116 | float_status *fpst = fpstp; | ||
117 | int compare = float16_compare_quiet(a, b, fpst); | ||
118 | return ADVSIMD_CMPRES(compare == float_relation_equal); | ||
119 | } | ||
120 | |||
121 | -uint32_t HELPER(advsimd_cge_f16)(float16 a, float16 b, void *fpstp) | ||
122 | +uint32_t HELPER(advsimd_cge_f16)(uint32_t a, uint32_t b, void *fpstp) | ||
123 | { | ||
124 | float_status *fpst = fpstp; | ||
125 | int compare = float16_compare(a, b, fpst); | ||
126 | @@ -XXX,XX +XXX,XX @@ uint32_t HELPER(advsimd_cge_f16)(float16 a, float16 b, void *fpstp) | ||
127 | compare == float_relation_equal); | ||
128 | } | ||
129 | |||
130 | -uint32_t HELPER(advsimd_cgt_f16)(float16 a, float16 b, void *fpstp) | ||
131 | +uint32_t HELPER(advsimd_cgt_f16)(uint32_t a, uint32_t b, void *fpstp) | ||
132 | { | ||
133 | float_status *fpst = fpstp; | ||
134 | int compare = float16_compare(a, b, fpst); | ||
135 | return ADVSIMD_CMPRES(compare == float_relation_greater); | ||
136 | } | ||
137 | |||
138 | -uint32_t HELPER(advsimd_acge_f16)(float16 a, float16 b, void *fpstp) | ||
139 | +uint32_t HELPER(advsimd_acge_f16)(uint32_t a, uint32_t b, void *fpstp) | ||
140 | { | ||
141 | float_status *fpst = fpstp; | ||
142 | float16 f0 = float16_abs(a); | ||
143 | @@ -XXX,XX +XXX,XX @@ uint32_t HELPER(advsimd_acge_f16)(float16 a, float16 b, void *fpstp) | ||
144 | compare == float_relation_equal); | ||
145 | } | ||
146 | |||
147 | -uint32_t HELPER(advsimd_acgt_f16)(float16 a, float16 b, void *fpstp) | ||
148 | +uint32_t HELPER(advsimd_acgt_f16)(uint32_t a, uint32_t b, void *fpstp) | ||
149 | { | ||
150 | float_status *fpst = fpstp; | ||
151 | float16 f0 = float16_abs(a); | ||
152 | @@ -XXX,XX +XXX,XX @@ uint32_t HELPER(advsimd_acgt_f16)(float16 a, float16 b, void *fpstp) | ||
153 | } | ||
154 | |||
155 | /* round to integral */ | ||
156 | -float16 HELPER(advsimd_rinth_exact)(float16 x, void *fp_status) | ||
157 | +uint32_t HELPER(advsimd_rinth_exact)(uint32_t x, void *fp_status) | ||
158 | { | ||
159 | return float16_round_to_int(x, fp_status); | ||
160 | } | ||
161 | |||
162 | -float16 HELPER(advsimd_rinth)(float16 x, void *fp_status) | ||
163 | +uint32_t HELPER(advsimd_rinth)(uint32_t x, void *fp_status) | ||
164 | { | ||
165 | int old_flags = get_float_exception_flags(fp_status), new_flags; | ||
166 | float16 ret; | ||
167 | @@ -XXX,XX +XXX,XX @@ float16 HELPER(advsimd_rinth)(float16 x, void *fp_status) | ||
168 | * setting the mode appropriately before calling the helper. | ||
169 | */ | ||
170 | |||
171 | -uint32_t HELPER(advsimd_f16tosinth)(float16 a, void *fpstp) | ||
172 | +uint32_t HELPER(advsimd_f16tosinth)(uint32_t a, void *fpstp) | ||
173 | { | ||
174 | float_status *fpst = fpstp; | ||
175 | |||
176 | @@ -XXX,XX +XXX,XX @@ uint32_t HELPER(advsimd_f16tosinth)(float16 a, void *fpstp) | ||
177 | return float16_to_int16(a, fpst); | ||
178 | } | ||
179 | |||
180 | -uint32_t HELPER(advsimd_f16touinth)(float16 a, void *fpstp) | ||
181 | +uint32_t HELPER(advsimd_f16touinth)(uint32_t a, void *fpstp) | ||
182 | { | ||
183 | float_status *fpst = fpstp; | ||
184 | |||
185 | @@ -XXX,XX +XXX,XX @@ uint32_t HELPER(advsimd_f16touinth)(float16 a, void *fpstp) | ||
186 | * Square Root and Reciprocal square root | ||
187 | */ | ||
188 | |||
189 | -float16 HELPER(sqrt_f16)(float16 a, void *fpstp) | ||
190 | +uint32_t HELPER(sqrt_f16)(uint32_t a, void *fpstp) | ||
191 | { | ||
192 | float_status *s = fpstp; | ||
193 | |||
194 | diff --git a/target/arm/helper.c b/target/arm/helper.c | 37 | diff --git a/target/arm/helper.c b/target/arm/helper.c |
195 | index XXXXXXX..XXXXXXX 100644 | 38 | index XXXXXXX..XXXXXXX 100644 |
196 | --- a/target/arm/helper.c | 39 | --- a/target/arm/helper.c |
197 | +++ b/target/arm/helper.c | 40 | +++ b/target/arm/helper.c |
198 | @@ -XXX,XX +XXX,XX @@ DO_VFP_cmp(d, float64) | 41 | @@ -XXX,XX +XXX,XX @@ int sme_exception_el(CPUARMState *env, int el) |
199 | 42 | return 0; | |
200 | /* Integer to float and float to integer conversions */ | ||
201 | |||
202 | -#define CONV_ITOF(name, fsz, sign) \ | ||
203 | - float##fsz HELPER(name)(uint32_t x, void *fpstp) \ | ||
204 | -{ \ | ||
205 | - float_status *fpst = fpstp; \ | ||
206 | - return sign##int32_to_##float##fsz((sign##int32_t)x, fpst); \ | ||
207 | +#define CONV_ITOF(name, ftype, fsz, sign) \ | ||
208 | +ftype HELPER(name)(uint32_t x, void *fpstp) \ | ||
209 | +{ \ | ||
210 | + float_status *fpst = fpstp; \ | ||
211 | + return sign##int32_to_##float##fsz((sign##int32_t)x, fpst); \ | ||
212 | } | 43 | } |
213 | 44 | ||
214 | -#define CONV_FTOI(name, fsz, sign, round) \ | 45 | -/* This corresponds to the ARM pseudocode function IsFullA64Enabled(). */ |
215 | -uint32_t HELPER(name)(float##fsz x, void *fpstp) \ | 46 | -static bool sme_fa64(CPUARMState *env, int el) |
216 | -{ \ | 47 | -{ |
217 | - float_status *fpst = fpstp; \ | 48 | - if (!cpu_isar_feature(aa64_sme_fa64, env_archcpu(env))) { |
218 | - if (float##fsz##_is_any_nan(x)) { \ | 49 | - return false; |
219 | - float_raise(float_flag_invalid, fpst); \ | 50 | - } |
220 | - return 0; \ | 51 | - |
221 | - } \ | 52 | - if (el <= 1 && !el_is_in_host(env, el)) { |
222 | - return float##fsz##_to_##sign##int32##round(x, fpst); \ | 53 | - if (!FIELD_EX64(env->vfp.smcr_el[1], SMCR, FA64)) { |
223 | +#define CONV_FTOI(name, ftype, fsz, sign, round) \ | 54 | - return false; |
224 | +uint32_t HELPER(name)(ftype x, void *fpstp) \ | 55 | - } |
225 | +{ \ | 56 | - } |
226 | + float_status *fpst = fpstp; \ | 57 | - if (el <= 2 && arm_is_el2_enabled(env)) { |
227 | + if (float##fsz##_is_any_nan(x)) { \ | 58 | - if (!FIELD_EX64(env->vfp.smcr_el[2], SMCR, FA64)) { |
228 | + float_raise(float_flag_invalid, fpst); \ | 59 | - return false; |
229 | + return 0; \ | 60 | - } |
230 | + } \ | 61 | - } |
231 | + return float##fsz##_to_##sign##int32##round(x, fpst); \ | 62 | - if (arm_feature(env, ARM_FEATURE_EL3)) { |
232 | } | 63 | - if (!FIELD_EX64(env->vfp.smcr_el[3], SMCR, FA64)) { |
233 | 64 | - return false; | |
234 | -#define FLOAT_CONVS(name, p, fsz, sign) \ | 65 | - } |
235 | -CONV_ITOF(vfp_##name##to##p, fsz, sign) \ | 66 | - } |
236 | -CONV_FTOI(vfp_to##name##p, fsz, sign, ) \ | 67 | - |
237 | -CONV_FTOI(vfp_to##name##z##p, fsz, sign, _round_to_zero) | 68 | - return true; |
238 | +#define FLOAT_CONVS(name, p, ftype, fsz, sign) \ | 69 | -} |
239 | + CONV_ITOF(vfp_##name##to##p, ftype, fsz, sign) \ | 70 | - |
240 | + CONV_FTOI(vfp_to##name##p, ftype, fsz, sign, ) \ | 71 | /* |
241 | + CONV_FTOI(vfp_to##name##z##p, ftype, fsz, sign, _round_to_zero) | 72 | * Given that SVE is enabled, return the vector length for EL. |
242 | 73 | */ | |
243 | -FLOAT_CONVS(si, h, 16, ) | 74 | @@ -XXX,XX +XXX,XX @@ int aa64_va_parameter_tbid(uint64_t tcr, ARMMMUIdx mmu_idx) |
244 | -FLOAT_CONVS(si, s, 32, ) | ||
245 | -FLOAT_CONVS(si, d, 64, ) | ||
246 | -FLOAT_CONVS(ui, h, 16, u) | ||
247 | -FLOAT_CONVS(ui, s, 32, u) | ||
248 | -FLOAT_CONVS(ui, d, 64, u) | ||
249 | +FLOAT_CONVS(si, h, uint32_t, 16, ) | ||
250 | +FLOAT_CONVS(si, s, float32, 32, ) | ||
251 | +FLOAT_CONVS(si, d, float64, 64, ) | ||
252 | +FLOAT_CONVS(ui, h, uint32_t, 16, u) | ||
253 | +FLOAT_CONVS(ui, s, float32, 32, u) | ||
254 | +FLOAT_CONVS(ui, d, float64, 64, u) | ||
255 | |||
256 | #undef CONV_ITOF | ||
257 | #undef CONV_FTOI | ||
258 | @@ -XXX,XX +XXX,XX @@ static float16 do_postscale_fp16(float64 f, int shift, float_status *fpst) | ||
259 | return float64_to_float16(float64_scalbn(f, -shift, fpst), true, fpst); | ||
260 | } | ||
261 | |||
262 | -float16 HELPER(vfp_sltoh)(uint32_t x, uint32_t shift, void *fpst) | ||
263 | +uint32_t HELPER(vfp_sltoh)(uint32_t x, uint32_t shift, void *fpst) | ||
264 | { | ||
265 | return do_postscale_fp16(int32_to_float64(x, fpst), shift, fpst); | ||
266 | } | ||
267 | |||
268 | -float16 HELPER(vfp_ultoh)(uint32_t x, uint32_t shift, void *fpst) | ||
269 | +uint32_t HELPER(vfp_ultoh)(uint32_t x, uint32_t shift, void *fpst) | ||
270 | { | ||
271 | return do_postscale_fp16(uint32_to_float64(x, fpst), shift, fpst); | ||
272 | } | ||
273 | |||
274 | -float16 HELPER(vfp_sqtoh)(uint64_t x, uint32_t shift, void *fpst) | ||
275 | +uint32_t HELPER(vfp_sqtoh)(uint64_t x, uint32_t shift, void *fpst) | ||
276 | { | ||
277 | return do_postscale_fp16(int64_to_float64(x, fpst), shift, fpst); | ||
278 | } | ||
279 | |||
280 | -float16 HELPER(vfp_uqtoh)(uint64_t x, uint32_t shift, void *fpst) | ||
281 | +uint32_t HELPER(vfp_uqtoh)(uint64_t x, uint32_t shift, void *fpst) | ||
282 | { | ||
283 | return do_postscale_fp16(uint64_to_float64(x, fpst), shift, fpst); | ||
284 | } | ||
285 | @@ -XXX,XX +XXX,XX @@ static float64 do_prescale_fp16(float16 f, int shift, float_status *fpst) | ||
286 | } | 75 | } |
287 | } | 76 | } |
288 | 77 | ||
289 | -uint32_t HELPER(vfp_toshh)(float16 x, uint32_t shift, void *fpst) | 78 | -static int aa64_va_parameter_tcma(uint64_t tcr, ARMMMUIdx mmu_idx) |
290 | +uint32_t HELPER(vfp_toshh)(uint32_t x, uint32_t shift, void *fpst) | 79 | +int aa64_va_parameter_tcma(uint64_t tcr, ARMMMUIdx mmu_idx) |
291 | { | 80 | { |
292 | return float64_to_int16(do_prescale_fp16(x, shift, fpst), fpst); | 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)); | ||
293 | } | 85 | } |
294 | 86 | ||
295 | -uint32_t HELPER(vfp_touhh)(float16 x, uint32_t shift, void *fpst) | 87 | -static inline bool fgt_svc(CPUARMState *env, int el) |
296 | +uint32_t HELPER(vfp_touhh)(uint32_t x, uint32_t shift, void *fpst) | 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) | ||
297 | { | 453 | { |
298 | return float64_to_uint16(do_prescale_fp16(x, shift, fpst), fpst); | 454 | /* |
299 | } | 455 | diff --git a/target/arm/tcg-stubs.c b/target/arm/tcg-stubs.c |
300 | 456 | index XXXXXXX..XXXXXXX 100644 | |
301 | -uint32_t HELPER(vfp_toslh)(float16 x, uint32_t shift, void *fpst) | 457 | --- a/target/arm/tcg-stubs.c |
302 | +uint32_t HELPER(vfp_toslh)(uint32_t x, uint32_t shift, void *fpst) | 458 | +++ b/target/arm/tcg-stubs.c |
459 | @@ -XXX,XX +XXX,XX @@ void raise_exception_ra(CPUARMState *env, uint32_t excp, uint32_t syndrome, | ||
303 | { | 460 | { |
304 | return float64_to_int32(do_prescale_fp16(x, shift, fpst), fpst); | ||
305 | } | ||
306 | |||
307 | -uint32_t HELPER(vfp_toulh)(float16 x, uint32_t shift, void *fpst) | ||
308 | +uint32_t HELPER(vfp_toulh)(uint32_t x, uint32_t shift, void *fpst) | ||
309 | { | ||
310 | return float64_to_uint32(do_prescale_fp16(x, shift, fpst), fpst); | ||
311 | } | ||
312 | |||
313 | -uint64_t HELPER(vfp_tosqh)(float16 x, uint32_t shift, void *fpst) | ||
314 | +uint64_t HELPER(vfp_tosqh)(uint32_t x, uint32_t shift, void *fpst) | ||
315 | { | ||
316 | return float64_to_int64(do_prescale_fp16(x, shift, fpst), fpst); | ||
317 | } | ||
318 | |||
319 | -uint64_t HELPER(vfp_touqh)(float16 x, uint32_t shift, void *fpst) | ||
320 | +uint64_t HELPER(vfp_touqh)(uint32_t x, uint32_t shift, void *fpst) | ||
321 | { | ||
322 | return float64_to_uint64(do_prescale_fp16(x, shift, fpst), fpst); | ||
323 | } | ||
324 | @@ -XXX,XX +XXX,XX @@ uint32_t HELPER(set_neon_rmode)(uint32_t rmode, CPUARMState *env) | ||
325 | } | ||
326 | |||
327 | /* Half precision conversions. */ | ||
328 | -float32 HELPER(vfp_fcvt_f16_to_f32)(float16 a, void *fpstp, uint32_t ahp_mode) | ||
329 | +float32 HELPER(vfp_fcvt_f16_to_f32)(uint32_t a, void *fpstp, uint32_t ahp_mode) | ||
330 | { | ||
331 | /* Squash FZ16 to 0 for the duration of conversion. In this case, | ||
332 | * it would affect flushing input denormals. | ||
333 | @@ -XXX,XX +XXX,XX @@ float32 HELPER(vfp_fcvt_f16_to_f32)(float16 a, void *fpstp, uint32_t ahp_mode) | ||
334 | return r; | ||
335 | } | ||
336 | |||
337 | -float16 HELPER(vfp_fcvt_f32_to_f16)(float32 a, void *fpstp, uint32_t ahp_mode) | ||
338 | +uint32_t HELPER(vfp_fcvt_f32_to_f16)(float32 a, void *fpstp, uint32_t ahp_mode) | ||
339 | { | ||
340 | /* Squash FZ16 to 0 for the duration of conversion. In this case, | ||
341 | * it would affect flushing output denormals. | ||
342 | @@ -XXX,XX +XXX,XX @@ float16 HELPER(vfp_fcvt_f32_to_f16)(float32 a, void *fpstp, uint32_t ahp_mode) | ||
343 | return r; | ||
344 | } | ||
345 | |||
346 | -float64 HELPER(vfp_fcvt_f16_to_f64)(float16 a, void *fpstp, uint32_t ahp_mode) | ||
347 | +float64 HELPER(vfp_fcvt_f16_to_f64)(uint32_t a, void *fpstp, uint32_t ahp_mode) | ||
348 | { | ||
349 | /* Squash FZ16 to 0 for the duration of conversion. In this case, | ||
350 | * it would affect flushing input denormals. | ||
351 | @@ -XXX,XX +XXX,XX @@ float64 HELPER(vfp_fcvt_f16_to_f64)(float16 a, void *fpstp, uint32_t ahp_mode) | ||
352 | return r; | ||
353 | } | ||
354 | |||
355 | -float16 HELPER(vfp_fcvt_f64_to_f16)(float64 a, void *fpstp, uint32_t ahp_mode) | ||
356 | +uint32_t HELPER(vfp_fcvt_f64_to_f16)(float64 a, void *fpstp, uint32_t ahp_mode) | ||
357 | { | ||
358 | /* Squash FZ16 to 0 for the duration of conversion. In this case, | ||
359 | * it would affect flushing output denormals. | ||
360 | @@ -XXX,XX +XXX,XX @@ static bool round_to_inf(float_status *fpst, bool sign_bit) | ||
361 | g_assert_not_reached(); | 461 | g_assert_not_reached(); |
362 | } | 462 | } |
363 | 463 | +/* Temporarily while cpu_get_tb_cpu_state() is still in common code */ | |
364 | -float16 HELPER(recpe_f16)(float16 input, void *fpstp) | 464 | +void assert_hflags_rebuild_correctly(CPUARMState *env) |
365 | +uint32_t HELPER(recpe_f16)(uint32_t input, void *fpstp) | 465 | +{ |
366 | { | 466 | +} |
367 | float_status *fpst = fpstp; | 467 | diff --git a/target/arm/tcg/hflags.c b/target/arm/tcg/hflags.c |
368 | float16 f16 = float16_squash_input_denormal(input, fpst); | 468 | new file mode 100644 |
369 | @@ -XXX,XX +XXX,XX @@ static uint64_t recip_sqrt_estimate(int *exp , int exp_off, uint64_t frac) | 469 | index XXXXXXX..XXXXXXX |
370 | return extract64(estimate, 0, 8) << 44; | 470 | --- /dev/null |
371 | } | 471 | +++ b/target/arm/tcg/hflags.c |
372 | 472 | @@ -XXX,XX +XXX,XX @@ | |
373 | -float16 HELPER(rsqrte_f16)(float16 input, void *fpstp) | 473 | +/* |
374 | +uint32_t HELPER(rsqrte_f16)(uint32_t input, void *fpstp) | 474 | + * ARM hflags |
375 | { | 475 | + * |
376 | float_status *s = fpstp; | 476 | + * This code is licensed under the GNU GPL v2 or later. |
377 | float16 f16 = float16_squash_input_denormal(input, s); | 477 | + * |
478 | + * SPDX-License-Identifier: GPL-2.0-or-later | ||
479 | + */ | ||
480 | +#include "qemu/osdep.h" | ||
481 | +#include "cpu.h" | ||
482 | +#include "internals.h" | ||
483 | +#include "exec/helper-proto.h" | ||
484 | +#include "cpregs.h" | ||
485 | + | ||
486 | +static inline bool fgt_svc(CPUARMState *env, int el) | ||
487 | +{ | ||
488 | + /* | ||
489 | + * Assuming fine-grained-traps are active, return true if we | ||
490 | + * should be trapping on SVC instructions. Only AArch64 can | ||
491 | + * trap on an SVC at EL1, but we don't need to special-case this | ||
492 | + * because if this is AArch32 EL1 then arm_fgt_active() is false. | ||
493 | + * We also know el is 0 or 1. | ||
494 | + */ | ||
495 | + return el == 0 ? | ||
496 | + FIELD_EX64(env->cp15.fgt_exec[FGTREG_HFGITR], HFGITR_EL2, SVC_EL0) : | ||
497 | + FIELD_EX64(env->cp15.fgt_exec[FGTREG_HFGITR], HFGITR_EL2, SVC_EL1); | ||
498 | +} | ||
499 | + | ||
500 | +static CPUARMTBFlags rebuild_hflags_common(CPUARMState *env, int fp_el, | ||
501 | + ARMMMUIdx mmu_idx, | ||
502 | + CPUARMTBFlags flags) | ||
503 | +{ | ||
504 | + DP_TBFLAG_ANY(flags, FPEXC_EL, fp_el); | ||
505 | + DP_TBFLAG_ANY(flags, MMUIDX, arm_to_core_mmu_idx(mmu_idx)); | ||
506 | + | ||
507 | + if (arm_singlestep_active(env)) { | ||
508 | + DP_TBFLAG_ANY(flags, SS_ACTIVE, 1); | ||
509 | + } | ||
510 | + | ||
511 | + return flags; | ||
512 | +} | ||
513 | + | ||
514 | +static CPUARMTBFlags rebuild_hflags_common_32(CPUARMState *env, int fp_el, | ||
515 | + ARMMMUIdx mmu_idx, | ||
516 | + CPUARMTBFlags flags) | ||
517 | +{ | ||
518 | + bool sctlr_b = arm_sctlr_b(env); | ||
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 | + } | ||
874 | +#endif | ||
875 | +} | ||
876 | diff --git a/target/arm/tcg/meson.build b/target/arm/tcg/meson.build | ||
877 | index XXXXXXX..XXXXXXX 100644 | ||
878 | --- a/target/arm/tcg/meson.build | ||
879 | +++ b/target/arm/tcg/meson.build | ||
880 | @@ -XXX,XX +XXX,XX @@ arm_ss.add(files( | ||
881 | 'translate-neon.c', | ||
882 | 'translate-vfp.c', | ||
883 | 'crypto_helper.c', | ||
884 | + 'hflags.c', | ||
885 | 'iwmmxt_helper.c', | ||
886 | 'm_helper.c', | ||
887 | 'mve_helper.c', | ||
378 | -- | 888 | -- |
379 | 2.17.1 | 889 | 2.34.1 |
380 | 890 | ||
381 | 891 | diff view generated by jsdifflib |
1 | As part of plumbing MemTxAttrs down to the IOMMU translate method, | 1 | From: Fabiano Rosas <farosas@suse.de> |
---|---|---|---|
2 | add MemTxAttrs as an argument to flatview_translate(); all its | ||
3 | callers now have attrs available. | ||
4 | 2 | ||
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. | ||
6 | |||
7 | Signed-off-by: Fabiano Rosas <farosas@suse.de> | ||
8 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
9 | Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
5 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
6 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | ||
7 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
8 | Message-id: 20180521140402.23318-11-peter.maydell@linaro.org | ||
9 | --- | 11 | --- |
10 | include/exec/memory.h | 7 ++++--- | 12 | target/arm/internals.h | 21 ++++++++++++++++++--- |
11 | exec.c | 17 +++++++++-------- | 13 | target/arm/tcg/tlb_helper.c | 18 ------------------ |
12 | 2 files changed, 13 insertions(+), 11 deletions(-) | 14 | 2 files changed, 18 insertions(+), 21 deletions(-) |
13 | 15 | ||
14 | diff --git a/include/exec/memory.h b/include/exec/memory.h | 16 | diff --git a/target/arm/internals.h b/target/arm/internals.h |
15 | index XXXXXXX..XXXXXXX 100644 | 17 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/include/exec/memory.h | 18 | --- a/target/arm/internals.h |
17 | +++ b/include/exec/memory.h | 19 | +++ b/target/arm/internals.h |
18 | @@ -XXX,XX +XXX,XX @@ IOMMUTLBEntry address_space_get_iotlb_entry(AddressSpace *as, hwaddr addr, | 20 | @@ -XXX,XX +XXX,XX @@ int arm_mmu_idx_to_el(ARMMMUIdx mmu_idx); |
19 | */ | 21 | /* Return the MMU index for a v7M CPU in the specified security state */ |
20 | MemoryRegion *flatview_translate(FlatView *fv, | 22 | ARMMMUIdx arm_v7m_mmu_idx_for_secstate(CPUARMState *env, bool secstate); |
21 | hwaddr addr, hwaddr *xlat, | 23 | |
22 | - hwaddr *len, bool is_write); | 24 | -/* Return true if the translation regime is using LPAE format page tables */ |
23 | + hwaddr *len, bool is_write, | 25 | -bool regime_using_lpae_format(CPUARMState *env, ARMMMUIdx mmu_idx); |
24 | + MemTxAttrs attrs); | 26 | - |
25 | 27 | /* | |
26 | static inline MemoryRegion *address_space_translate(AddressSpace *as, | 28 | * Return true if the stage 1 translation regime is using LPAE |
27 | hwaddr addr, hwaddr *xlat, | 29 | * format page tables |
28 | @@ -XXX,XX +XXX,XX @@ static inline MemoryRegion *address_space_translate(AddressSpace *as, | 30 | @@ -XXX,XX +XXX,XX @@ static inline uint64_t regime_tcr(CPUARMState *env, ARMMMUIdx mmu_idx) |
29 | MemTxAttrs attrs) | 31 | return env->cp15.tcr_el[regime_el(env, mmu_idx)]; |
30 | { | ||
31 | return flatview_translate(address_space_to_flatview(as), | ||
32 | - addr, xlat, len, is_write); | ||
33 | + addr, xlat, len, is_write, attrs); | ||
34 | } | 32 | } |
35 | 33 | ||
36 | /* address_space_access_valid: check for validity of accessing an address | 34 | +/* Return true if the translation regime is using LPAE format page tables */ |
37 | @@ -XXX,XX +XXX,XX @@ MemTxResult address_space_read(AddressSpace *as, hwaddr addr, | 35 | +static inline bool regime_using_lpae_format(CPUARMState *env, ARMMMUIdx mmu_idx) |
38 | rcu_read_lock(); | 36 | +{ |
39 | fv = address_space_to_flatview(as); | 37 | + int el = regime_el(env, mmu_idx); |
40 | l = len; | 38 | + if (el == 2 || arm_el_is_aa64(env, el)) { |
41 | - mr = flatview_translate(fv, addr, &addr1, &l, false); | 39 | + return true; |
42 | + mr = flatview_translate(fv, addr, &addr1, &l, false, attrs); | 40 | + } |
43 | if (len == l && memory_access_is_direct(mr, false)) { | 41 | + if (arm_feature(env, ARM_FEATURE_PMSA) && |
44 | ptr = qemu_map_ram_ptr(mr->ram_block, addr1); | 42 | + arm_feature(env, ARM_FEATURE_V8)) { |
45 | memcpy(buf, ptr, len); | 43 | + return true; |
46 | diff --git a/exec.c b/exec.c | 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 | +} | ||
51 | + | ||
52 | /** | ||
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 | ||
47 | index XXXXXXX..XXXXXXX 100644 | 56 | index XXXXXXX..XXXXXXX 100644 |
48 | --- a/exec.c | 57 | --- a/target/arm/tcg/tlb_helper.c |
49 | +++ b/exec.c | 58 | +++ b/target/arm/tcg/tlb_helper.c |
50 | @@ -XXX,XX +XXX,XX @@ iotlb_fail: | 59 | @@ -XXX,XX +XXX,XX @@ |
51 | 60 | #include "exec/helper-proto.h" | |
52 | /* Called from RCU critical section */ | 61 | |
53 | MemoryRegion *flatview_translate(FlatView *fv, hwaddr addr, hwaddr *xlat, | 62 | |
54 | - hwaddr *plen, bool is_write) | 63 | -/* Return true if the translation regime is using LPAE format page tables */ |
55 | + hwaddr *plen, bool is_write, | 64 | -bool regime_using_lpae_format(CPUARMState *env, ARMMMUIdx mmu_idx) |
56 | + MemTxAttrs attrs) | 65 | -{ |
57 | { | 66 | - int el = regime_el(env, mmu_idx); |
58 | MemoryRegion *mr; | 67 | - if (el == 2 || arm_el_is_aa64(env, el)) { |
59 | MemoryRegionSection section; | 68 | - return true; |
60 | @@ -XXX,XX +XXX,XX @@ static MemTxResult flatview_write_continue(FlatView *fv, hwaddr addr, | 69 | - } |
61 | } | 70 | - if (arm_feature(env, ARM_FEATURE_PMSA) && |
62 | 71 | - arm_feature(env, ARM_FEATURE_V8)) { | |
63 | l = len; | 72 | - return true; |
64 | - mr = flatview_translate(fv, addr, &addr1, &l, true); | 73 | - } |
65 | + mr = flatview_translate(fv, addr, &addr1, &l, true, attrs); | 74 | - if (arm_feature(env, ARM_FEATURE_LPAE) |
66 | } | 75 | - && (regime_tcr(env, mmu_idx) & TTBCR_EAE)) { |
67 | 76 | - return true; | |
68 | return result; | 77 | - } |
69 | @@ -XXX,XX +XXX,XX @@ static MemTxResult flatview_write(FlatView *fv, hwaddr addr, MemTxAttrs attrs, | 78 | - return false; |
70 | MemTxResult result = MEMTX_OK; | 79 | -} |
71 | 80 | - | |
72 | l = len; | 81 | /* |
73 | - mr = flatview_translate(fv, addr, &addr1, &l, true); | 82 | * Returns true if the stage 1 translation regime is using LPAE format page |
74 | + mr = flatview_translate(fv, addr, &addr1, &l, true, attrs); | 83 | * tables. Used when raising alignment exceptions, whose FSR changes depending |
75 | result = flatview_write_continue(fv, addr, attrs, buf, len, | ||
76 | addr1, l, mr); | ||
77 | |||
78 | @@ -XXX,XX +XXX,XX @@ MemTxResult flatview_read_continue(FlatView *fv, hwaddr addr, | ||
79 | } | ||
80 | |||
81 | l = len; | ||
82 | - mr = flatview_translate(fv, addr, &addr1, &l, false); | ||
83 | + mr = flatview_translate(fv, addr, &addr1, &l, false, attrs); | ||
84 | } | ||
85 | |||
86 | return result; | ||
87 | @@ -XXX,XX +XXX,XX @@ static MemTxResult flatview_read(FlatView *fv, hwaddr addr, | ||
88 | MemoryRegion *mr; | ||
89 | |||
90 | l = len; | ||
91 | - mr = flatview_translate(fv, addr, &addr1, &l, false); | ||
92 | + mr = flatview_translate(fv, addr, &addr1, &l, false, attrs); | ||
93 | return flatview_read_continue(fv, addr, attrs, buf, len, | ||
94 | addr1, l, mr); | ||
95 | } | ||
96 | @@ -XXX,XX +XXX,XX @@ static bool flatview_access_valid(FlatView *fv, hwaddr addr, int len, | ||
97 | |||
98 | while (len > 0) { | ||
99 | l = len; | ||
100 | - mr = flatview_translate(fv, addr, &xlat, &l, is_write); | ||
101 | + mr = flatview_translate(fv, addr, &xlat, &l, is_write, attrs); | ||
102 | if (!memory_access_is_direct(mr, is_write)) { | ||
103 | l = memory_access_size(mr, l, addr); | ||
104 | if (!memory_region_access_valid(mr, xlat, l, is_write, attrs)) { | ||
105 | @@ -XXX,XX +XXX,XX @@ flatview_extend_translation(FlatView *fv, hwaddr addr, | ||
106 | |||
107 | len = target_len; | ||
108 | this_mr = flatview_translate(fv, addr, &xlat, | ||
109 | - &len, is_write); | ||
110 | + &len, is_write, attrs); | ||
111 | if (this_mr != mr || xlat != base + done) { | ||
112 | return done; | ||
113 | } | ||
114 | @@ -XXX,XX +XXX,XX @@ void *address_space_map(AddressSpace *as, | ||
115 | l = len; | ||
116 | rcu_read_lock(); | ||
117 | fv = address_space_to_flatview(as); | ||
118 | - mr = flatview_translate(fv, addr, &xlat, &l, is_write); | ||
119 | + mr = flatview_translate(fv, addr, &xlat, &l, is_write, attrs); | ||
120 | |||
121 | if (!memory_access_is_direct(mr, is_write)) { | ||
122 | if (atomic_xchg(&bounce.in_use, true)) { | ||
123 | -- | 84 | -- |
124 | 2.17.1 | 85 | 2.34.1 |
125 | 86 | ||
126 | 87 | diff view generated by jsdifflib |
1 | From: Shannon Zhao <zhaoshenglong@huawei.com> | 1 | From: Fabiano Rosas <farosas@suse.de> |
---|---|---|---|
2 | 2 | ||
3 | acpi_data_push uses g_array_set_size to resize the memory size. If there | 3 | When TCG is disabled this part of the code should not be reachable, so |
4 | is no enough contiguous memory, the address will be changed. So previous | 4 | wrap it with an ifdef for now. |
5 | pointer could not be used any more. It must update the pointer and use | ||
6 | the new one. | ||
7 | 5 | ||
8 | Also, previous codes wrongly use le32 conversion of iort->node_offset | 6 | Signed-off-by: Fabiano Rosas <farosas@suse.de> |
9 | for subsequent computations that will result incorrect value if host is | 7 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
10 | not litlle endian. So use the non-converted one instead. | 8 | Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
11 | |||
12 | Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com> | ||
13 | Reviewed-by: Eric Auger <eric.auger@redhat.com> | ||
14 | Message-id: 1527663951-14552-1-git-send-email-zhaoshenglong@huawei.com | ||
15 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
16 | --- | 10 | --- |
17 | hw/arm/virt-acpi-build.c | 20 +++++++++++++++----- | 11 | target/arm/ptw.c | 4 ++++ |
18 | 1 file changed, 15 insertions(+), 5 deletions(-) | 12 | 1 file changed, 4 insertions(+) |
19 | 13 | ||
20 | diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c | 14 | diff --git a/target/arm/ptw.c b/target/arm/ptw.c |
21 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
22 | --- a/hw/arm/virt-acpi-build.c | 16 | --- a/target/arm/ptw.c |
23 | +++ b/hw/arm/virt-acpi-build.c | 17 | +++ b/target/arm/ptw.c |
24 | @@ -XXX,XX +XXX,XX @@ build_iort(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms) | 18 | @@ -XXX,XX +XXX,XX @@ static bool S1_ptw_translate(CPUARMState *env, S1Translate *ptw, |
25 | AcpiIortItsGroup *its; | 19 | ptw->out_host = NULL; |
26 | AcpiIortTable *iort; | 20 | ptw->out_rw = false; |
27 | AcpiIortSmmu3 *smmu; | 21 | } else { |
28 | - size_t node_size, iort_length, smmu_offset = 0; | 22 | +#ifdef CONFIG_TCG |
29 | + size_t node_size, iort_node_offset, iort_length, smmu_offset = 0; | 23 | CPUTLBEntryFull *full; |
30 | AcpiIortRC *rc; | 24 | int flags; |
31 | 25 | ||
32 | iort = acpi_data_push(table_data, sizeof(*iort)); | 26 | @@ -XXX,XX +XXX,XX @@ static bool S1_ptw_translate(CPUARMState *env, S1Translate *ptw, |
33 | @@ -XXX,XX +XXX,XX @@ build_iort(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms) | 27 | ptw->out_rw = full->prot & PAGE_WRITE; |
34 | 28 | pte_attrs = full->pte_attrs; | |
35 | iort_length = sizeof(*iort); | 29 | pte_secure = full->attrs.secure; |
36 | iort->node_count = cpu_to_le32(nb_nodes); | 30 | +#else |
37 | - iort->node_offset = cpu_to_le32(sizeof(*iort)); | 31 | + g_assert_not_reached(); |
38 | + /* | 32 | +#endif |
39 | + * Use a copy in case table_data->data moves during acpi_data_push | ||
40 | + * operations. | ||
41 | + */ | ||
42 | + iort_node_offset = sizeof(*iort); | ||
43 | + iort->node_offset = cpu_to_le32(iort_node_offset); | ||
44 | |||
45 | /* ITS group node */ | ||
46 | node_size = sizeof(*its) + sizeof(uint32_t); | ||
47 | @@ -XXX,XX +XXX,XX @@ build_iort(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms) | ||
48 | int irq = vms->irqmap[VIRT_SMMU]; | ||
49 | |||
50 | /* SMMUv3 node */ | ||
51 | - smmu_offset = iort->node_offset + node_size; | ||
52 | + smmu_offset = iort_node_offset + node_size; | ||
53 | node_size = sizeof(*smmu) + sizeof(*idmap); | ||
54 | iort_length += node_size; | ||
55 | smmu = acpi_data_push(table_data, node_size); | ||
56 | @@ -XXX,XX +XXX,XX @@ build_iort(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms) | ||
57 | idmap->id_count = cpu_to_le32(0xFFFF); | ||
58 | idmap->output_base = 0; | ||
59 | /* output IORT node is the ITS group node (the first node) */ | ||
60 | - idmap->output_reference = cpu_to_le32(iort->node_offset); | ||
61 | + idmap->output_reference = cpu_to_le32(iort_node_offset); | ||
62 | } | 33 | } |
63 | 34 | ||
64 | /* Root Complex Node */ | 35 | if (regime_is_stage2(s2_mmu_idx)) { |
65 | @@ -XXX,XX +XXX,XX @@ build_iort(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms) | ||
66 | idmap->output_reference = cpu_to_le32(smmu_offset); | ||
67 | } else { | ||
68 | /* output IORT node is the ITS group node (the first node) */ | ||
69 | - idmap->output_reference = cpu_to_le32(iort->node_offset); | ||
70 | + idmap->output_reference = cpu_to_le32(iort_node_offset); | ||
71 | } | ||
72 | |||
73 | + /* | ||
74 | + * Update the pointer address in case table_data->data moves during above | ||
75 | + * acpi_data_push operations. | ||
76 | + */ | ||
77 | + iort = (AcpiIortTable *)(table_data->data + iort_start); | ||
78 | iort->length = cpu_to_le32(iort_length); | ||
79 | |||
80 | build_header(linker, table_data, (void *)(table_data->data + iort_start), | ||
81 | -- | 36 | -- |
82 | 2.17.1 | 37 | 2.34.1 |
83 | 38 | ||
84 | 39 | diff view generated by jsdifflib |
1 | The FRECPX instructions should (like most other floating point operations) | 1 | From: Fabiano Rosas <farosas@suse.de> |
---|---|---|---|
2 | honour the FPCR.FZ bit which specifies whether input denormals should | ||
3 | be flushed to zero (or FZ16 for the half-precision version). | ||
4 | We forgot to implement this, which doesn't affect the results (since | ||
5 | the calculation doesn't actually care about the mantissa bits) but did | ||
6 | mean we were failing to set the FPSR.IDC bit. | ||
7 | 2 | ||
3 | This struct has no dependencies on TCG code and it is being used in | ||
4 | target/arm/ptw.c to simplify the passing around of page table walk | ||
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. | ||
8 | |||
9 | Signed-off-by: Fabiano Rosas <farosas@suse.de> | ||
10 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
11 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
12 | Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 13 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
9 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
10 | Message-id: 20180521172712.19930-1-peter.maydell@linaro.org | ||
11 | --- | 14 | --- |
12 | target/arm/helper-a64.c | 6 ++++++ | 15 | include/exec/cpu-defs.h | 6 ++++++ |
13 | 1 file changed, 6 insertions(+) | 16 | 1 file changed, 6 insertions(+) |
14 | 17 | ||
15 | diff --git a/target/arm/helper-a64.c b/target/arm/helper-a64.c | 18 | diff --git a/include/exec/cpu-defs.h b/include/exec/cpu-defs.h |
16 | index XXXXXXX..XXXXXXX 100644 | 19 | index XXXXXXX..XXXXXXX 100644 |
17 | --- a/target/arm/helper-a64.c | 20 | --- a/include/exec/cpu-defs.h |
18 | +++ b/target/arm/helper-a64.c | 21 | +++ b/include/exec/cpu-defs.h |
19 | @@ -XXX,XX +XXX,XX @@ float16 HELPER(frecpx_f16)(float16 a, void *fpstp) | 22 | @@ -XXX,XX +XXX,XX @@ typedef struct CPUTLBEntry { |
20 | return nan; | 23 | |
21 | } | 24 | QEMU_BUILD_BUG_ON(sizeof(CPUTLBEntry) != (1 << CPU_TLB_ENTRY_BITS)); |
22 | 25 | ||
23 | + a = float16_squash_input_denormal(a, fpst); | ||
24 | + | 26 | + |
25 | val16 = float16_val(a); | 27 | +#endif /* !CONFIG_USER_ONLY && CONFIG_TCG */ |
26 | sbit = 0x8000 & val16; | ||
27 | exp = extract32(val16, 10, 5); | ||
28 | @@ -XXX,XX +XXX,XX @@ float32 HELPER(frecpx_f32)(float32 a, void *fpstp) | ||
29 | return nan; | ||
30 | } | ||
31 | |||
32 | + a = float32_squash_input_denormal(a, fpst); | ||
33 | + | 28 | + |
34 | val32 = float32_val(a); | 29 | +#if !defined(CONFIG_USER_ONLY) |
35 | sbit = 0x80000000ULL & val32; | 30 | /* |
36 | exp = extract32(val32, 23, 8); | 31 | * The full TLB entry, which is not accessed by generated TCG code, |
37 | @@ -XXX,XX +XXX,XX @@ float64 HELPER(frecpx_f64)(float64 a, void *fpstp) | 32 | * so the layout is not as critical as that of CPUTLBEntry. This is |
38 | return nan; | 33 | @@ -XXX,XX +XXX,XX @@ typedef struct CPUTLBEntryFull { |
39 | } | 34 | TARGET_PAGE_ENTRY_EXTRA |
40 | 35 | #endif | |
41 | + a = float64_squash_input_denormal(a, fpst); | 36 | } CPUTLBEntryFull; |
42 | + | 37 | +#endif /* !CONFIG_USER_ONLY */ |
43 | val64 = float64_val(a); | 38 | |
44 | sbit = 0x8000000000000000ULL & val64; | 39 | +#if !defined(CONFIG_USER_ONLY) && defined(CONFIG_TCG) |
45 | exp = extract64(float64_val(a), 52, 11); | 40 | /* |
41 | * Data elements that are per MMU mode, minus the bits accessed by | ||
42 | * the TCG fast path. | ||
46 | -- | 43 | -- |
47 | 2.17.1 | 44 | 2.34.1 |
48 | 45 | ||
49 | 46 | diff view generated by jsdifflib |
1 | From: Shannon Zhao <zhaoshenglong@huawei.com> | 1 | From: Fabiano Rosas <farosas@suse.de> |
---|---|---|---|
2 | 2 | ||
3 | It forgot to increase clroffset during the loop. So it only clear the | 3 | This test currently fails when run on a host for which the QEMU target |
4 | first 4 bytes. | 4 | has no default machine set: |
5 | 5 | ||
6 | Fixes: 367b9f527becdd20ddf116e17a3c0c2bbc486920 | 6 | ERROR| Output: qemu-system-aarch64: No machine specified, and there is |
7 | Cc: qemu-stable@nongnu.org | 7 | no default |
8 | Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com> | 8 | |
9 | Reviewed-by: Eric Auger <eric.auger@redhat.com> | 9 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
10 | Message-id: 1527047633-12368-1-git-send-email-zhaoshenglong@huawei.com | 10 | Signed-off-by: Fabiano Rosas <farosas@suse.de> |
11 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
13 | --- | 12 | --- |
14 | hw/intc/arm_gicv3_kvm.c | 1 + | 13 | tests/avocado/version.py | 1 + |
15 | 1 file changed, 1 insertion(+) | 14 | 1 file changed, 1 insertion(+) |
16 | 15 | ||
17 | diff --git a/hw/intc/arm_gicv3_kvm.c b/hw/intc/arm_gicv3_kvm.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/intc/arm_gicv3_kvm.c | 18 | --- a/tests/avocado/version.py |
20 | +++ b/hw/intc/arm_gicv3_kvm.c | 19 | +++ b/tests/avocado/version.py |
21 | @@ -XXX,XX +XXX,XX @@ static void kvm_dist_putbmp(GICv3State *s, uint32_t offset, | 20 | @@ -XXX,XX +XXX,XX @@ |
22 | if (clroffset != 0) { | 21 | class Version(QemuSystemTest): |
23 | reg = 0; | 22 | """ |
24 | kvm_gicd_access(s, clroffset, ®, true); | 23 | :avocado: tags=quick |
25 | + clroffset += 4; | 24 | + :avocado: tags=machine:none |
26 | } | 25 | """ |
27 | reg = *gic_bmp_ptr32(bmp, irq); | 26 | def test_qmp_human_info_version(self): |
28 | kvm_gicd_access(s, offset, ®, true); | 27 | self.vm.add_args('-nodefaults') |
29 | -- | 28 | -- |
30 | 2.17.1 | 29 | 2.34.1 |
31 | 30 | ||
32 | 31 | diff view generated by jsdifflib |
1 | As part of plumbing MemTxAttrs down to the IOMMU translate method, | 1 | From: Philippe Mathieu-Daudé <philmd@linaro.org> |
---|---|---|---|
2 | add MemTxAttrs as an argument to address_space_access_valid(). | ||
3 | Its callers either have an attrs value to hand, or don't care | ||
4 | and can use MEMTXATTRS_UNSPECIFIED. | ||
5 | 2 | ||
3 | Since &I2C_SLAVE(dev)->qdev == dev, no need to go back and | ||
4 | forth with QOM type casting. Directly use 'dev'. | ||
5 | |||
6 | Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
7 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
8 | Message-id: 20230220115114.25237-2-philmd@linaro.org | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
7 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | ||
8 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
9 | Message-id: 20180521140402.23318-6-peter.maydell@linaro.org | ||
10 | --- | 10 | --- |
11 | include/exec/memory.h | 4 +++- | 11 | hw/gpio/max7310.c | 5 ++--- |
12 | include/sysemu/dma.h | 3 ++- | 12 | 1 file changed, 2 insertions(+), 3 deletions(-) |
13 | exec.c | 3 ++- | ||
14 | target/s390x/diag.c | 6 ++++-- | ||
15 | target/s390x/excp_helper.c | 3 ++- | ||
16 | target/s390x/mmu_helper.c | 3 ++- | ||
17 | target/s390x/sigp.c | 3 ++- | ||
18 | 7 files changed, 17 insertions(+), 8 deletions(-) | ||
19 | 13 | ||
20 | diff --git a/include/exec/memory.h b/include/exec/memory.h | 14 | diff --git a/hw/gpio/max7310.c b/hw/gpio/max7310.c |
21 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
22 | --- a/include/exec/memory.h | 16 | --- a/hw/gpio/max7310.c |
23 | +++ b/include/exec/memory.h | 17 | +++ b/hw/gpio/max7310.c |
24 | @@ -XXX,XX +XXX,XX @@ static inline MemoryRegion *address_space_translate(AddressSpace *as, | 18 | @@ -XXX,XX +XXX,XX @@ static void max7310_gpio_set(void *opaque, int line, int level) |
25 | * @addr: address within that address space | 19 | * but also accepts sequences that are not SMBus so return an I2C device. */ |
26 | * @len: length of the area to be checked | 20 | static void max7310_realize(DeviceState *dev, Error **errp) |
27 | * @is_write: indicates the transfer direction | ||
28 | + * @attrs: memory attributes | ||
29 | */ | ||
30 | -bool address_space_access_valid(AddressSpace *as, hwaddr addr, int len, bool is_write); | ||
31 | +bool address_space_access_valid(AddressSpace *as, hwaddr addr, int len, | ||
32 | + bool is_write, MemTxAttrs attrs); | ||
33 | |||
34 | /* address_space_map: map a physical memory region into a host virtual address | ||
35 | * | ||
36 | diff --git a/include/sysemu/dma.h b/include/sysemu/dma.h | ||
37 | index XXXXXXX..XXXXXXX 100644 | ||
38 | --- a/include/sysemu/dma.h | ||
39 | +++ b/include/sysemu/dma.h | ||
40 | @@ -XXX,XX +XXX,XX @@ static inline bool dma_memory_valid(AddressSpace *as, | ||
41 | DMADirection dir) | ||
42 | { | 21 | { |
43 | return address_space_access_valid(as, addr, len, | 22 | - I2CSlave *i2c = I2C_SLAVE(dev); |
44 | - dir == DMA_DIRECTION_FROM_DEVICE); | 23 | MAX7310State *s = MAX7310(dev); |
45 | + dir == DMA_DIRECTION_FROM_DEVICE, | 24 | |
46 | + MEMTXATTRS_UNSPECIFIED); | 25 | - qdev_init_gpio_in(&i2c->qdev, max7310_gpio_set, 8); |
26 | - qdev_init_gpio_out(&i2c->qdev, s->handler, 8); | ||
27 | + qdev_init_gpio_in(dev, max7310_gpio_set, ARRAY_SIZE(s->handler)); | ||
28 | + qdev_init_gpio_out(dev, s->handler, ARRAY_SIZE(s->handler)); | ||
47 | } | 29 | } |
48 | 30 | ||
49 | static inline int dma_memory_rw_relaxed(AddressSpace *as, dma_addr_t addr, | 31 | static void max7310_class_init(ObjectClass *klass, void *data) |
50 | diff --git a/exec.c b/exec.c | ||
51 | index XXXXXXX..XXXXXXX 100644 | ||
52 | --- a/exec.c | ||
53 | +++ b/exec.c | ||
54 | @@ -XXX,XX +XXX,XX @@ static bool flatview_access_valid(FlatView *fv, hwaddr addr, int len, | ||
55 | } | ||
56 | |||
57 | bool address_space_access_valid(AddressSpace *as, hwaddr addr, | ||
58 | - int len, bool is_write) | ||
59 | + int len, bool is_write, | ||
60 | + MemTxAttrs attrs) | ||
61 | { | ||
62 | FlatView *fv; | ||
63 | bool result; | ||
64 | diff --git a/target/s390x/diag.c b/target/s390x/diag.c | ||
65 | index XXXXXXX..XXXXXXX 100644 | ||
66 | --- a/target/s390x/diag.c | ||
67 | +++ b/target/s390x/diag.c | ||
68 | @@ -XXX,XX +XXX,XX @@ void handle_diag_308(CPUS390XState *env, uint64_t r1, uint64_t r3, uintptr_t ra) | ||
69 | return; | ||
70 | } | ||
71 | if (!address_space_access_valid(&address_space_memory, addr, | ||
72 | - sizeof(IplParameterBlock), false)) { | ||
73 | + sizeof(IplParameterBlock), false, | ||
74 | + MEMTXATTRS_UNSPECIFIED)) { | ||
75 | s390_program_interrupt(env, PGM_ADDRESSING, ILEN_AUTO, ra); | ||
76 | return; | ||
77 | } | ||
78 | @@ -XXX,XX +XXX,XX @@ out: | ||
79 | return; | ||
80 | } | ||
81 | if (!address_space_access_valid(&address_space_memory, addr, | ||
82 | - sizeof(IplParameterBlock), true)) { | ||
83 | + sizeof(IplParameterBlock), true, | ||
84 | + MEMTXATTRS_UNSPECIFIED)) { | ||
85 | s390_program_interrupt(env, PGM_ADDRESSING, ILEN_AUTO, ra); | ||
86 | return; | ||
87 | } | ||
88 | diff --git a/target/s390x/excp_helper.c b/target/s390x/excp_helper.c | ||
89 | index XXXXXXX..XXXXXXX 100644 | ||
90 | --- a/target/s390x/excp_helper.c | ||
91 | +++ b/target/s390x/excp_helper.c | ||
92 | @@ -XXX,XX +XXX,XX @@ int s390_cpu_handle_mmu_fault(CPUState *cs, vaddr orig_vaddr, int size, | ||
93 | |||
94 | /* check out of RAM access */ | ||
95 | if (!address_space_access_valid(&address_space_memory, raddr, | ||
96 | - TARGET_PAGE_SIZE, rw)) { | ||
97 | + TARGET_PAGE_SIZE, rw, | ||
98 | + MEMTXATTRS_UNSPECIFIED)) { | ||
99 | DPRINTF("%s: raddr %" PRIx64 " > ram_size %" PRIx64 "\n", __func__, | ||
100 | (uint64_t)raddr, (uint64_t)ram_size); | ||
101 | trigger_pgm_exception(env, PGM_ADDRESSING, ILEN_AUTO); | ||
102 | diff --git a/target/s390x/mmu_helper.c b/target/s390x/mmu_helper.c | ||
103 | index XXXXXXX..XXXXXXX 100644 | ||
104 | --- a/target/s390x/mmu_helper.c | ||
105 | +++ b/target/s390x/mmu_helper.c | ||
106 | @@ -XXX,XX +XXX,XX @@ static int translate_pages(S390CPU *cpu, vaddr addr, int nr_pages, | ||
107 | return ret; | ||
108 | } | ||
109 | if (!address_space_access_valid(&address_space_memory, pages[i], | ||
110 | - TARGET_PAGE_SIZE, is_write)) { | ||
111 | + TARGET_PAGE_SIZE, is_write, | ||
112 | + MEMTXATTRS_UNSPECIFIED)) { | ||
113 | trigger_access_exception(env, PGM_ADDRESSING, ILEN_AUTO, 0); | ||
114 | return -EFAULT; | ||
115 | } | ||
116 | diff --git a/target/s390x/sigp.c b/target/s390x/sigp.c | ||
117 | index XXXXXXX..XXXXXXX 100644 | ||
118 | --- a/target/s390x/sigp.c | ||
119 | +++ b/target/s390x/sigp.c | ||
120 | @@ -XXX,XX +XXX,XX @@ static void sigp_set_prefix(CPUState *cs, run_on_cpu_data arg) | ||
121 | cpu_synchronize_state(cs); | ||
122 | |||
123 | if (!address_space_access_valid(&address_space_memory, addr, | ||
124 | - sizeof(struct LowCore), false)) { | ||
125 | + sizeof(struct LowCore), false, | ||
126 | + MEMTXATTRS_UNSPECIFIED)) { | ||
127 | set_sigp_status(si, SIGP_STAT_INVALID_PARAMETER); | ||
128 | return; | ||
129 | } | ||
130 | -- | 32 | -- |
131 | 2.17.1 | 33 | 2.34.1 |
132 | 34 | ||
133 | 35 | diff view generated by jsdifflib |
1 | As part of plumbing MemTxAttrs down to the IOMMU translate method, | 1 | From: Philippe Mathieu-Daudé <philmd@linaro.org> |
---|---|---|---|
2 | add MemTxAttrs as an argument to flatview_extend_translation(). | ||
3 | Its callers either have an attrs value to hand, or don't care | ||
4 | and can use MEMTXATTRS_UNSPECIFIED. | ||
5 | 2 | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 3 | pl011_create() is only used in DeviceRealize handlers, |
4 | not a hot-path. Inlining is not justified. | ||
5 | |||
6 | Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
7 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | 7 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> |
8 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 8 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
9 | Message-id: 20180521140402.23318-7-peter.maydell@linaro.org | 9 | Message-id: 20230220115114.25237-3-philmd@linaro.org |
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | --- | 11 | --- |
11 | exec.c | 15 ++++++++++----- | 12 | include/hw/char/pl011.h | 19 +------------------ |
12 | 1 file changed, 10 insertions(+), 5 deletions(-) | 13 | hw/char/pl011.c | 17 +++++++++++++++++ |
14 | 2 files changed, 18 insertions(+), 18 deletions(-) | ||
13 | 15 | ||
14 | diff --git a/exec.c b/exec.c | 16 | diff --git a/include/hw/char/pl011.h b/include/hw/char/pl011.h |
15 | index XXXXXXX..XXXXXXX 100644 | 17 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/exec.c | 18 | --- a/include/hw/char/pl011.h |
17 | +++ b/exec.c | 19 | +++ b/include/hw/char/pl011.h |
18 | @@ -XXX,XX +XXX,XX @@ bool address_space_access_valid(AddressSpace *as, hwaddr addr, | 20 | @@ -XXX,XX +XXX,XX @@ |
19 | 21 | #ifndef HW_PL011_H | |
20 | static hwaddr | 22 | #define HW_PL011_H |
21 | flatview_extend_translation(FlatView *fv, hwaddr addr, | 23 | |
22 | - hwaddr target_len, | 24 | -#include "hw/qdev-properties.h" |
23 | - MemoryRegion *mr, hwaddr base, hwaddr len, | 25 | #include "hw/sysbus.h" |
24 | - bool is_write) | 26 | #include "chardev/char-fe.h" |
25 | + hwaddr target_len, | 27 | -#include "qapi/error.h" |
26 | + MemoryRegion *mr, hwaddr base, hwaddr len, | 28 | #include "qom/object.h" |
27 | + bool is_write, MemTxAttrs attrs) | 29 | |
28 | { | 30 | #define TYPE_PL011 "pl011" |
29 | hwaddr done = 0; | 31 | @@ -XXX,XX +XXX,XX @@ struct PL011State { |
30 | hwaddr xlat; | 32 | const unsigned char *id; |
31 | @@ -XXX,XX +XXX,XX @@ void *address_space_map(AddressSpace *as, | 33 | }; |
32 | 34 | ||
33 | memory_region_ref(mr); | 35 | -static inline DeviceState *pl011_create(hwaddr addr, |
34 | *plen = flatview_extend_translation(fv, addr, len, mr, xlat, | 36 | - qemu_irq irq, |
35 | - l, is_write); | 37 | - Chardev *chr) |
36 | + l, is_write, attrs); | 38 | -{ |
37 | ptr = qemu_ram_ptr_length(mr->ram_block, xlat, plen, true); | 39 | - DeviceState *dev; |
38 | rcu_read_unlock(); | 40 | - SysBusDevice *s; |
39 | 41 | - | |
40 | @@ -XXX,XX +XXX,XX @@ int64_t address_space_cache_init(MemoryRegionCache *cache, | 42 | - dev = qdev_new("pl011"); |
41 | mr = cache->mrs.mr; | 43 | - s = SYS_BUS_DEVICE(dev); |
42 | memory_region_ref(mr); | 44 | - qdev_prop_set_chr(dev, "chardev", chr); |
43 | if (memory_access_is_direct(mr, is_write)) { | 45 | - sysbus_realize_and_unref(s, &error_fatal); |
44 | + /* We don't care about the memory attributes here as we're only | 46 | - sysbus_mmio_map(s, 0, addr); |
45 | + * doing this if we found actual RAM, which behaves the same | 47 | - sysbus_connect_irq(s, 0, irq); |
46 | + * regardless of attributes; so UNSPECIFIED is fine. | 48 | - |
47 | + */ | 49 | - return dev; |
48 | l = flatview_extend_translation(cache->fv, addr, len, mr, | 50 | -} |
49 | - cache->xlat, l, is_write); | 51 | +DeviceState *pl011_create(hwaddr addr, qemu_irq irq, Chardev *chr); |
50 | + cache->xlat, l, is_write, | 52 | |
51 | + MEMTXATTRS_UNSPECIFIED); | 53 | static inline DeviceState *pl011_luminary_create(hwaddr addr, |
52 | cache->ptr = qemu_ram_ptr_length(mr->ram_block, cache->xlat, &l, true); | 54 | qemu_irq irq, |
53 | } else { | 55 | diff --git a/hw/char/pl011.c b/hw/char/pl011.c |
54 | cache->ptr = NULL; | 56 | index XXXXXXX..XXXXXXX 100644 |
57 | --- a/hw/char/pl011.c | ||
58 | +++ b/hw/char/pl011.c | ||
59 | @@ -XXX,XX +XXX,XX @@ | ||
60 | */ | ||
61 | |||
62 | #include "qemu/osdep.h" | ||
63 | +#include "qapi/error.h" | ||
64 | #include "hw/char/pl011.h" | ||
65 | #include "hw/irq.h" | ||
66 | #include "hw/sysbus.h" | ||
67 | #include "hw/qdev-clock.h" | ||
68 | +#include "hw/qdev-properties.h" | ||
69 | #include "hw/qdev-properties-system.h" | ||
70 | #include "migration/vmstate.h" | ||
71 | #include "chardev/char-fe.h" | ||
72 | @@ -XXX,XX +XXX,XX @@ | ||
73 | #include "qemu/module.h" | ||
74 | #include "trace.h" | ||
75 | |||
76 | +DeviceState *pl011_create(hwaddr addr, qemu_irq irq, Chardev *chr) | ||
77 | +{ | ||
78 | + DeviceState *dev; | ||
79 | + SysBusDevice *s; | ||
80 | + | ||
81 | + dev = qdev_new("pl011"); | ||
82 | + s = SYS_BUS_DEVICE(dev); | ||
83 | + qdev_prop_set_chr(dev, "chardev", chr); | ||
84 | + sysbus_realize_and_unref(s, &error_fatal); | ||
85 | + sysbus_mmio_map(s, 0, addr); | ||
86 | + sysbus_connect_irq(s, 0, irq); | ||
87 | + | ||
88 | + return dev; | ||
89 | +} | ||
90 | + | ||
91 | #define PL011_INT_TX 0x20 | ||
92 | #define PL011_INT_RX 0x10 | ||
93 | |||
55 | -- | 94 | -- |
56 | 2.17.1 | 95 | 2.34.1 |
57 | 96 | ||
58 | 97 | diff view generated by jsdifflib |
1 | As part of plumbing MemTxAttrs down to the IOMMU translate method, | 1 | From: Philippe Mathieu-Daudé <philmd@linaro.org> |
---|---|---|---|
2 | add MemTxAttrs as an argument to the MemoryRegion valid.accepts | ||
3 | callback. We'll need this for subpage_accepts(). | ||
4 | 2 | ||
5 | We could take the approach we used with the read and write | 3 | pl011_luminary_create() is only used for the Stellaris board, |
6 | callbacks and add new a new _with_attrs version, but since there | 4 | open-code it. |
7 | are so few implementations of the accepts hook we just change | ||
8 | them all. | ||
9 | 5 | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 6 | Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
11 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | 7 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> |
12 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 8 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
13 | Message-id: 20180521140402.23318-9-peter.maydell@linaro.org | 9 | Message-id: 20230220115114.25237-4-philmd@linaro.org |
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
14 | --- | 11 | --- |
15 | include/exec/memory.h | 3 ++- | 12 | include/hw/char/pl011.h | 17 ----------------- |
16 | exec.c | 9 ++++++--- | 13 | hw/arm/stellaris.c | 11 ++++++++--- |
17 | hw/hppa/dino.c | 3 ++- | 14 | 2 files changed, 8 insertions(+), 20 deletions(-) |
18 | hw/nvram/fw_cfg.c | 12 ++++++++---- | ||
19 | hw/scsi/esp.c | 3 ++- | ||
20 | hw/xen/xen_pt_msi.c | 3 ++- | ||
21 | memory.c | 5 +++-- | ||
22 | 7 files changed, 25 insertions(+), 13 deletions(-) | ||
23 | 15 | ||
24 | diff --git a/include/exec/memory.h b/include/exec/memory.h | 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/include/exec/memory.h | 18 | --- a/include/hw/char/pl011.h |
27 | +++ b/include/exec/memory.h | 19 | +++ b/include/hw/char/pl011.h |
28 | @@ -XXX,XX +XXX,XX @@ struct MemoryRegionOps { | 20 | @@ -XXX,XX +XXX,XX @@ struct PL011State { |
29 | * as a machine check exception). | 21 | |
30 | */ | 22 | DeviceState *pl011_create(hwaddr addr, qemu_irq irq, Chardev *chr); |
31 | bool (*accepts)(void *opaque, hwaddr addr, | 23 | |
32 | - unsigned size, bool is_write); | 24 | -static inline DeviceState *pl011_luminary_create(hwaddr addr, |
33 | + unsigned size, bool is_write, | 25 | - qemu_irq irq, |
34 | + MemTxAttrs attrs); | 26 | - Chardev *chr) |
35 | } valid; | 27 | -{ |
36 | /* Internal implementation constraints: */ | 28 | - DeviceState *dev; |
37 | struct { | 29 | - SysBusDevice *s; |
38 | diff --git a/exec.c b/exec.c | 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 | ||
39 | index XXXXXXX..XXXXXXX 100644 | 43 | index XXXXXXX..XXXXXXX 100644 |
40 | --- a/exec.c | 44 | --- a/hw/arm/stellaris.c |
41 | +++ b/exec.c | 45 | +++ b/hw/arm/stellaris.c |
42 | @@ -XXX,XX +XXX,XX @@ static void notdirty_mem_write(void *opaque, hwaddr ram_addr, | 46 | @@ -XXX,XX +XXX,XX @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board) |
43 | } | 47 | |
44 | 48 | for (i = 0; i < 4; i++) { | |
45 | static bool notdirty_mem_accepts(void *opaque, hwaddr addr, | 49 | if (board->dc2 & (1 << i)) { |
46 | - unsigned size, bool is_write) | 50 | - pl011_luminary_create(0x4000c000 + i * 0x1000, |
47 | + unsigned size, bool is_write, | 51 | - qdev_get_gpio_in(nvic, uart_irq[i]), |
48 | + MemTxAttrs attrs) | 52 | - serial_hd(i)); |
49 | { | 53 | + SysBusDevice *sbd; |
50 | return is_write; | 54 | + |
51 | } | 55 | + dev = qdev_new("pl011_luminary"); |
52 | @@ -XXX,XX +XXX,XX @@ static MemTxResult subpage_write(void *opaque, hwaddr addr, | 56 | + sbd = SYS_BUS_DEVICE(dev); |
53 | } | 57 | + qdev_prop_set_chr(dev, "chardev", serial_hd(i)); |
54 | 58 | + sysbus_realize_and_unref(sbd, &error_fatal); | |
55 | static bool subpage_accepts(void *opaque, hwaddr addr, | 59 | + sysbus_mmio_map(sbd, 0, 0x4000c000 + i * 0x1000); |
56 | - unsigned len, bool is_write) | 60 | + sysbus_connect_irq(sbd, 0, qdev_get_gpio_in(nvic, uart_irq[i])); |
57 | + unsigned len, bool is_write, | ||
58 | + MemTxAttrs attrs) | ||
59 | { | ||
60 | subpage_t *subpage = opaque; | ||
61 | #if defined(DEBUG_SUBPAGE) | ||
62 | @@ -XXX,XX +XXX,XX @@ static void readonly_mem_write(void *opaque, hwaddr addr, | ||
63 | } | ||
64 | |||
65 | static bool readonly_mem_accepts(void *opaque, hwaddr addr, | ||
66 | - unsigned size, bool is_write) | ||
67 | + unsigned size, bool is_write, | ||
68 | + MemTxAttrs attrs) | ||
69 | { | ||
70 | return is_write; | ||
71 | } | ||
72 | diff --git a/hw/hppa/dino.c b/hw/hppa/dino.c | ||
73 | index XXXXXXX..XXXXXXX 100644 | ||
74 | --- a/hw/hppa/dino.c | ||
75 | +++ b/hw/hppa/dino.c | ||
76 | @@ -XXX,XX +XXX,XX @@ static void gsc_to_pci_forwarding(DinoState *s) | ||
77 | } | ||
78 | |||
79 | static bool dino_chip_mem_valid(void *opaque, hwaddr addr, | ||
80 | - unsigned size, bool is_write) | ||
81 | + unsigned size, bool is_write, | ||
82 | + MemTxAttrs attrs) | ||
83 | { | ||
84 | switch (addr) { | ||
85 | case DINO_IAR0: | ||
86 | diff --git a/hw/nvram/fw_cfg.c b/hw/nvram/fw_cfg.c | ||
87 | index XXXXXXX..XXXXXXX 100644 | ||
88 | --- a/hw/nvram/fw_cfg.c | ||
89 | +++ b/hw/nvram/fw_cfg.c | ||
90 | @@ -XXX,XX +XXX,XX @@ static void fw_cfg_dma_mem_write(void *opaque, hwaddr addr, | ||
91 | } | ||
92 | |||
93 | static bool fw_cfg_dma_mem_valid(void *opaque, hwaddr addr, | ||
94 | - unsigned size, bool is_write) | ||
95 | + unsigned size, bool is_write, | ||
96 | + MemTxAttrs attrs) | ||
97 | { | ||
98 | return !is_write || ((size == 4 && (addr == 0 || addr == 4)) || | ||
99 | (size == 8 && addr == 0)); | ||
100 | } | ||
101 | |||
102 | static bool fw_cfg_data_mem_valid(void *opaque, hwaddr addr, | ||
103 | - unsigned size, bool is_write) | ||
104 | + unsigned size, bool is_write, | ||
105 | + MemTxAttrs attrs) | ||
106 | { | ||
107 | return addr == 0; | ||
108 | } | ||
109 | @@ -XXX,XX +XXX,XX @@ static void fw_cfg_ctl_mem_write(void *opaque, hwaddr addr, | ||
110 | } | ||
111 | |||
112 | static bool fw_cfg_ctl_mem_valid(void *opaque, hwaddr addr, | ||
113 | - unsigned size, bool is_write) | ||
114 | + unsigned size, bool is_write, | ||
115 | + MemTxAttrs attrs) | ||
116 | { | ||
117 | return is_write && size == 2; | ||
118 | } | ||
119 | @@ -XXX,XX +XXX,XX @@ static void fw_cfg_comb_write(void *opaque, hwaddr addr, | ||
120 | } | ||
121 | |||
122 | static bool fw_cfg_comb_valid(void *opaque, hwaddr addr, | ||
123 | - unsigned size, bool is_write) | ||
124 | + unsigned size, bool is_write, | ||
125 | + MemTxAttrs attrs) | ||
126 | { | ||
127 | return (size == 1) || (is_write && size == 2); | ||
128 | } | ||
129 | diff --git a/hw/scsi/esp.c b/hw/scsi/esp.c | ||
130 | index XXXXXXX..XXXXXXX 100644 | ||
131 | --- a/hw/scsi/esp.c | ||
132 | +++ b/hw/scsi/esp.c | ||
133 | @@ -XXX,XX +XXX,XX @@ void esp_reg_write(ESPState *s, uint32_t saddr, uint64_t val) | ||
134 | } | ||
135 | |||
136 | static bool esp_mem_accepts(void *opaque, hwaddr addr, | ||
137 | - unsigned size, bool is_write) | ||
138 | + unsigned size, bool is_write, | ||
139 | + MemTxAttrs attrs) | ||
140 | { | ||
141 | return (size == 1) || (is_write && size == 4); | ||
142 | } | ||
143 | diff --git a/hw/xen/xen_pt_msi.c b/hw/xen/xen_pt_msi.c | ||
144 | index XXXXXXX..XXXXXXX 100644 | ||
145 | --- a/hw/xen/xen_pt_msi.c | ||
146 | +++ b/hw/xen/xen_pt_msi.c | ||
147 | @@ -XXX,XX +XXX,XX @@ static uint64_t pci_msix_read(void *opaque, hwaddr addr, | ||
148 | } | ||
149 | |||
150 | static bool pci_msix_accepts(void *opaque, hwaddr addr, | ||
151 | - unsigned size, bool is_write) | ||
152 | + unsigned size, bool is_write, | ||
153 | + MemTxAttrs attrs) | ||
154 | { | ||
155 | return !(addr & (size - 1)); | ||
156 | } | ||
157 | diff --git a/memory.c b/memory.c | ||
158 | index XXXXXXX..XXXXXXX 100644 | ||
159 | --- a/memory.c | ||
160 | +++ b/memory.c | ||
161 | @@ -XXX,XX +XXX,XX @@ static void unassigned_mem_write(void *opaque, hwaddr addr, | ||
162 | } | ||
163 | |||
164 | static bool unassigned_mem_accepts(void *opaque, hwaddr addr, | ||
165 | - unsigned size, bool is_write) | ||
166 | + unsigned size, bool is_write, | ||
167 | + MemTxAttrs attrs) | ||
168 | { | ||
169 | return false; | ||
170 | } | ||
171 | @@ -XXX,XX +XXX,XX @@ bool memory_region_access_valid(MemoryRegion *mr, | ||
172 | access_size = MAX(MIN(size, access_size_max), access_size_min); | ||
173 | for (i = 0; i < size; i += access_size) { | ||
174 | if (!mr->ops->valid.accepts(mr->opaque, addr + i, access_size, | ||
175 | - is_write)) { | ||
176 | + is_write, attrs)) { | ||
177 | return false; | ||
178 | } | 61 | } |
179 | } | 62 | } |
63 | if (board->dc2 & (1 << 4)) { | ||
180 | -- | 64 | -- |
181 | 2.17.1 | 65 | 2.34.1 |
182 | 66 | ||
183 | 67 | diff view generated by jsdifflib |
1 | As part of plumbing MemTxAttrs down to the IOMMU translate method, | 1 | From: Philippe Mathieu-Daudé <philmd@linaro.org> |
---|---|---|---|
2 | add MemTxAttrs as an argument to address_space_translate_iommu(). | ||
3 | 2 | ||
4 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 3 | Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
5 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | 4 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> |
6 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 5 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
7 | Message-id: 20180521140402.23318-14-peter.maydell@linaro.org | 6 | Message-id: 20230220115114.25237-5-philmd@linaro.org |
7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
8 | --- | 8 | --- |
9 | exec.c | 8 +++++--- | 9 | include/hw/char/xilinx_uartlite.h | 6 +++++- |
10 | 1 file changed, 5 insertions(+), 3 deletions(-) | 10 | hw/char/xilinx_uartlite.c | 4 +--- |
11 | 2 files changed, 6 insertions(+), 4 deletions(-) | ||
11 | 12 | ||
12 | diff --git a/exec.c b/exec.c | 13 | diff --git a/include/hw/char/xilinx_uartlite.h b/include/hw/char/xilinx_uartlite.h |
13 | index XXXXXXX..XXXXXXX 100644 | 14 | index XXXXXXX..XXXXXXX 100644 |
14 | --- a/exec.c | 15 | --- a/include/hw/char/xilinx_uartlite.h |
15 | +++ b/exec.c | 16 | +++ b/include/hw/char/xilinx_uartlite.h |
16 | @@ -XXX,XX +XXX,XX @@ address_space_translate_internal(AddressSpaceDispatch *d, hwaddr addr, hwaddr *x | 17 | @@ -XXX,XX +XXX,XX @@ |
17 | * @is_write: whether the translation operation is for write | 18 | #include "hw/qdev-properties.h" |
18 | * @is_mmio: whether this can be MMIO, set true if it can | 19 | #include "hw/sysbus.h" |
19 | * @target_as: the address space targeted by the IOMMU | 20 | #include "qapi/error.h" |
20 | + * @attrs: transaction attributes | 21 | +#include "qom/object.h" |
21 | * | 22 | + |
22 | * This function is called from RCU critical section. It is the common | 23 | +#define TYPE_XILINX_UARTLITE "xlnx.xps-uartlite" |
23 | * part of flatview_do_translate and address_space_translate_cached. | 24 | +OBJECT_DECLARE_SIMPLE_TYPE(XilinxUARTLite, XILINX_UARTLITE) |
24 | @@ -XXX,XX +XXX,XX @@ static MemoryRegionSection address_space_translate_iommu(IOMMUMemoryRegion *iomm | 25 | |
25 | hwaddr *page_mask_out, | 26 | static inline DeviceState *xilinx_uartlite_create(hwaddr addr, |
26 | bool is_write, | 27 | qemu_irq irq, |
27 | bool is_mmio, | 28 | @@ -XXX,XX +XXX,XX @@ static inline DeviceState *xilinx_uartlite_create(hwaddr addr, |
28 | - AddressSpace **target_as) | 29 | DeviceState *dev; |
29 | + AddressSpace **target_as, | 30 | SysBusDevice *s; |
30 | + MemTxAttrs attrs) | 31 | |
31 | { | 32 | - dev = qdev_new("xlnx.xps-uartlite"); |
32 | MemoryRegionSection *section; | 33 | + dev = qdev_new(TYPE_XILINX_UARTLITE); |
33 | hwaddr page_mask = (hwaddr)-1; | 34 | s = SYS_BUS_DEVICE(dev); |
34 | @@ -XXX,XX +XXX,XX @@ static MemoryRegionSection flatview_do_translate(FlatView *fv, | 35 | qdev_prop_set_chr(dev, "chardev", chr); |
35 | return address_space_translate_iommu(iommu_mr, xlat, | 36 | sysbus_realize_and_unref(s, &error_fatal); |
36 | plen_out, page_mask_out, | 37 | diff --git a/hw/char/xilinx_uartlite.c b/hw/char/xilinx_uartlite.c |
37 | is_write, is_mmio, | 38 | index XXXXXXX..XXXXXXX 100644 |
38 | - target_as); | 39 | --- a/hw/char/xilinx_uartlite.c |
39 | + target_as, attrs); | 40 | +++ b/hw/char/xilinx_uartlite.c |
40 | } | 41 | @@ -XXX,XX +XXX,XX @@ |
41 | if (page_mask_out) { | 42 | |
42 | /* Not behind an IOMMU, use default page size. */ | 43 | #include "qemu/osdep.h" |
43 | @@ -XXX,XX +XXX,XX @@ static inline MemoryRegion *address_space_translate_cached( | 44 | #include "qemu/log.h" |
44 | 45 | +#include "hw/char/xilinx_uartlite.h" | |
45 | section = address_space_translate_iommu(iommu_mr, xlat, plen, | 46 | #include "hw/irq.h" |
46 | NULL, is_write, true, | 47 | #include "hw/qdev-properties.h" |
47 | - &target_as); | 48 | #include "hw/qdev-properties-system.h" |
48 | + &target_as, attrs); | 49 | @@ -XXX,XX +XXX,XX @@ |
49 | return section.mr; | 50 | #define CONTROL_RST_RX 0x02 |
50 | } | 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; | ||
51 | 58 | ||
52 | -- | 59 | -- |
53 | 2.17.1 | 60 | 2.34.1 |
54 | 61 | ||
55 | 62 | diff view generated by jsdifflib |
1 | As part of plumbing MemTxAttrs down to the IOMMU translate method, | 1 | From: Philippe Mathieu-Daudé <philmd@linaro.org> |
---|---|---|---|
2 | add MemTxAttrs as an argument to address_space_map(). | ||
3 | Its callers either have an attrs value to hand, or don't care | ||
4 | and can use MEMTXATTRS_UNSPECIFIED. | ||
5 | 2 | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 3 | Open-code the single use of xilinx_uartlite_create(). |
4 | |||
5 | Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
7 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | 6 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> |
8 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 7 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
9 | Message-id: 20180521140402.23318-5-peter.maydell@linaro.org | 8 | Message-id: 20230220115114.25237-6-philmd@linaro.org |
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | --- | 10 | --- |
11 | include/exec/memory.h | 3 ++- | 11 | include/hw/char/xilinx_uartlite.h | 20 -------------------- |
12 | include/sysemu/dma.h | 3 ++- | 12 | hw/microblaze/petalogix_s3adsp1800_mmu.c | 7 +++++-- |
13 | exec.c | 6 ++++-- | 13 | 2 files changed, 5 insertions(+), 22 deletions(-) |
14 | target/ppc/mmu-hash64.c | 3 ++- | ||
15 | 4 files changed, 10 insertions(+), 5 deletions(-) | ||
16 | 14 | ||
17 | diff --git a/include/exec/memory.h b/include/exec/memory.h | 15 | diff --git a/include/hw/char/xilinx_uartlite.h b/include/hw/char/xilinx_uartlite.h |
18 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
19 | --- a/include/exec/memory.h | 17 | --- a/include/hw/char/xilinx_uartlite.h |
20 | +++ b/include/exec/memory.h | 18 | +++ b/include/hw/char/xilinx_uartlite.h |
21 | @@ -XXX,XX +XXX,XX @@ bool address_space_access_valid(AddressSpace *as, hwaddr addr, int len, bool is_ | 19 | @@ -XXX,XX +XXX,XX @@ |
22 | * @addr: address within that address space | 20 | #ifndef XILINX_UARTLITE_H |
23 | * @plen: pointer to length of buffer; updated on return | 21 | #define XILINX_UARTLITE_H |
24 | * @is_write: indicates the transfer direction | 22 | |
25 | + * @attrs: memory attributes | 23 | -#include "hw/qdev-properties.h" |
26 | */ | 24 | -#include "hw/sysbus.h" |
27 | void *address_space_map(AddressSpace *as, hwaddr addr, | 25 | -#include "qapi/error.h" |
28 | - hwaddr *plen, bool is_write); | 26 | #include "qom/object.h" |
29 | + hwaddr *plen, bool is_write, MemTxAttrs attrs); | 27 | |
30 | 28 | #define TYPE_XILINX_UARTLITE "xlnx.xps-uartlite" | |
31 | /* address_space_unmap: Unmaps a memory region previously mapped by address_space_map() | 29 | OBJECT_DECLARE_SIMPLE_TYPE(XilinxUARTLite, XILINX_UARTLITE) |
32 | * | 30 | |
33 | diff --git a/include/sysemu/dma.h b/include/sysemu/dma.h | 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 | ||
34 | index XXXXXXX..XXXXXXX 100644 | 50 | index XXXXXXX..XXXXXXX 100644 |
35 | --- a/include/sysemu/dma.h | 51 | --- a/hw/microblaze/petalogix_s3adsp1800_mmu.c |
36 | +++ b/include/sysemu/dma.h | 52 | +++ b/hw/microblaze/petalogix_s3adsp1800_mmu.c |
37 | @@ -XXX,XX +XXX,XX @@ static inline void *dma_memory_map(AddressSpace *as, | 53 | @@ -XXX,XX +XXX,XX @@ petalogix_s3adsp1800_init(MachineState *machine) |
38 | hwaddr xlen = *len; | 54 | irq[i] = qdev_get_gpio_in(dev, i); |
39 | void *p; | ||
40 | |||
41 | - p = address_space_map(as, addr, &xlen, dir == DMA_DIRECTION_FROM_DEVICE); | ||
42 | + p = address_space_map(as, addr, &xlen, dir == DMA_DIRECTION_FROM_DEVICE, | ||
43 | + MEMTXATTRS_UNSPECIFIED); | ||
44 | *len = xlen; | ||
45 | return p; | ||
46 | } | ||
47 | diff --git a/exec.c b/exec.c | ||
48 | index XXXXXXX..XXXXXXX 100644 | ||
49 | --- a/exec.c | ||
50 | +++ b/exec.c | ||
51 | @@ -XXX,XX +XXX,XX @@ flatview_extend_translation(FlatView *fv, hwaddr addr, | ||
52 | void *address_space_map(AddressSpace *as, | ||
53 | hwaddr addr, | ||
54 | hwaddr *plen, | ||
55 | - bool is_write) | ||
56 | + bool is_write, | ||
57 | + MemTxAttrs attrs) | ||
58 | { | ||
59 | hwaddr len = *plen; | ||
60 | hwaddr l, xlat; | ||
61 | @@ -XXX,XX +XXX,XX @@ void *cpu_physical_memory_map(hwaddr addr, | ||
62 | hwaddr *plen, | ||
63 | int is_write) | ||
64 | { | ||
65 | - return address_space_map(&address_space_memory, addr, plen, is_write); | ||
66 | + return address_space_map(&address_space_memory, addr, plen, is_write, | ||
67 | + MEMTXATTRS_UNSPECIFIED); | ||
68 | } | ||
69 | |||
70 | void cpu_physical_memory_unmap(void *buffer, hwaddr len, | ||
71 | diff --git a/target/ppc/mmu-hash64.c b/target/ppc/mmu-hash64.c | ||
72 | index XXXXXXX..XXXXXXX 100644 | ||
73 | --- a/target/ppc/mmu-hash64.c | ||
74 | +++ b/target/ppc/mmu-hash64.c | ||
75 | @@ -XXX,XX +XXX,XX @@ const ppc_hash_pte64_t *ppc_hash64_map_hptes(PowerPCCPU *cpu, | ||
76 | return NULL; | ||
77 | } | 55 | } |
78 | 56 | ||
79 | - hptes = address_space_map(CPU(cpu)->as, base + pte_offset, &plen, false); | 57 | - xilinx_uartlite_create(UARTLITE_BASEADDR, irq[UARTLITE_IRQ], |
80 | + hptes = address_space_map(CPU(cpu)->as, base + pte_offset, &plen, false, | 58 | - serial_hd(0)); |
81 | + MEMTXATTRS_UNSPECIFIED); | 59 | + dev = qdev_new(TYPE_XILINX_UARTLITE); |
82 | if (plen < (n * HASH_PTE_SIZE_64)) { | 60 | + qdev_prop_set_chr(dev, "chardev", serial_hd(0)); |
83 | hw_error("%s: Unable to map all requested HPTEs\n", __func__); | 61 | + sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); |
84 | } | 62 | + sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, UARTLITE_BASEADDR); |
63 | + sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, irq[UARTLITE_IRQ]); | ||
64 | |||
65 | /* 2 timers at irq 2 @ 62 Mhz. */ | ||
66 | dev = qdev_new("xlnx.xps-timer"); | ||
85 | -- | 67 | -- |
86 | 2.17.1 | 68 | 2.34.1 |
87 | 69 | ||
88 | 70 | diff view generated by jsdifflib |
1 | As part of plumbing MemTxAttrs down to the IOMMU translate method, | 1 | From: Philippe Mathieu-Daudé <philmd@linaro.org> |
---|---|---|---|
2 | add MemTxAttrs as an argument to memory_region_access_valid(). | ||
3 | Its callers either have an attrs value to hand, or don't care | ||
4 | and can use MEMTXATTRS_UNSPECIFIED. | ||
5 | 2 | ||
6 | The callsite in flatview_access_valid() is part of a recursive | 3 | cmsdk_apb_uart_create() is only used twice in the same |
7 | loop flatview_access_valid() -> memory_region_access_valid() -> | 4 | file. Open-code it. |
8 | subpage_accepts() -> flatview_access_valid(); we make it pass | ||
9 | MEMTXATTRS_UNSPECIFIED for now, until the next several commits | ||
10 | have plumbed an attrs parameter through the rest of the loop | ||
11 | and we can add an attrs parameter to flatview_access_valid(). | ||
12 | 5 | ||
6 | Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
8 | Message-id: 20230220115114.25237-7-philmd@linaro.org | ||
13 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
14 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | ||
15 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
16 | Message-id: 20180521140402.23318-8-peter.maydell@linaro.org | ||
17 | --- | 10 | --- |
18 | include/exec/memory-internal.h | 3 ++- | 11 | include/hw/char/cmsdk-apb-uart.h | 34 -------------------------- |
19 | exec.c | 4 +++- | 12 | hw/arm/mps2.c | 41 +++++++++++++++++++++----------- |
20 | hw/s390x/s390-pci-inst.c | 3 ++- | 13 | 2 files changed, 27 insertions(+), 48 deletions(-) |
21 | memory.c | 7 ++++--- | ||
22 | 4 files changed, 11 insertions(+), 6 deletions(-) | ||
23 | 14 | ||
24 | diff --git a/include/exec/memory-internal.h b/include/exec/memory-internal.h | 15 | diff --git a/include/hw/char/cmsdk-apb-uart.h b/include/hw/char/cmsdk-apb-uart.h |
25 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
26 | --- a/include/exec/memory-internal.h | 17 | --- a/include/hw/char/cmsdk-apb-uart.h |
27 | +++ b/include/exec/memory-internal.h | 18 | +++ b/include/hw/char/cmsdk-apb-uart.h |
28 | @@ -XXX,XX +XXX,XX @@ void flatview_unref(FlatView *view); | 19 | @@ -XXX,XX +XXX,XX @@ |
29 | extern const MemoryRegionOps unassigned_mem_ops; | 20 | #ifndef CMSDK_APB_UART_H |
30 | 21 | #define CMSDK_APB_UART_H | |
31 | bool memory_region_access_valid(MemoryRegion *mr, hwaddr addr, | 22 | |
32 | - unsigned size, bool is_write); | 23 | -#include "hw/qdev-properties.h" |
33 | + unsigned size, bool is_write, | 24 | #include "hw/sysbus.h" |
34 | + MemTxAttrs attrs); | 25 | #include "chardev/char-fe.h" |
35 | 26 | -#include "qapi/error.h" | |
36 | void flatview_add_to_dispatch(FlatView *fv, MemoryRegionSection *section); | 27 | #include "qom/object.h" |
37 | AddressSpaceDispatch *address_space_dispatch_new(FlatView *fv); | 28 | |
38 | diff --git a/exec.c b/exec.c | 29 | #define TYPE_CMSDK_APB_UART "cmsdk-apb-uart" |
30 | @@ -XXX,XX +XXX,XX @@ struct CMSDKAPBUART { | ||
31 | uint8_t rxbuf; | ||
32 | }; | ||
33 | |||
34 | -/** | ||
35 | - * cmsdk_apb_uart_create - convenience function to create TYPE_CMSDK_APB_UART | ||
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) | ||
48 | -{ | ||
49 | - DeviceState *dev; | ||
50 | - SysBusDevice *s; | ||
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; | ||
64 | -} | ||
65 | - | ||
66 | #endif | ||
67 | diff --git a/hw/arm/mps2.c b/hw/arm/mps2.c | ||
39 | index XXXXXXX..XXXXXXX 100644 | 68 | index XXXXXXX..XXXXXXX 100644 |
40 | --- a/exec.c | 69 | --- a/hw/arm/mps2.c |
41 | +++ b/exec.c | 70 | +++ b/hw/arm/mps2.c |
42 | @@ -XXX,XX +XXX,XX @@ static bool flatview_access_valid(FlatView *fv, hwaddr addr, int len, | 71 | @@ -XXX,XX +XXX,XX @@ |
43 | mr = flatview_translate(fv, addr, &xlat, &l, is_write); | 72 | #include "hw/boards.h" |
44 | if (!memory_access_is_direct(mr, is_write)) { | 73 | #include "exec/address-spaces.h" |
45 | l = memory_access_size(mr, l, addr); | 74 | #include "sysemu/sysemu.h" |
46 | - if (!memory_region_access_valid(mr, xlat, l, is_write)) { | 75 | +#include "hw/qdev-properties.h" |
47 | + /* When our callers all have attrs we'll pass them through here */ | 76 | #include "hw/misc/unimp.h" |
48 | + if (!memory_region_access_valid(mr, xlat, l, is_write, | 77 | #include "hw/char/cmsdk-apb-uart.h" |
49 | + MEMTXATTRS_UNSPECIFIED)) { | 78 | #include "hw/timer/cmsdk-apb-timer.h" |
50 | return false; | 79 | @@ -XXX,XX +XXX,XX @@ static void mps2_common_init(MachineState *machine) |
80 | qdev_connect_gpio_out(orgate_dev, 0, qdev_get_gpio_in(armv7m, 12)); | ||
81 | |||
82 | for (i = 0; i < 5; i++) { | ||
83 | + DeviceState *dev; | ||
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); | ||
51 | } | 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); | ||
52 | } | 109 | } |
53 | diff --git a/hw/s390x/s390-pci-inst.c b/hw/s390x/s390-pci-inst.c | 110 | break; |
54 | index XXXXXXX..XXXXXXX 100644 | ||
55 | --- a/hw/s390x/s390-pci-inst.c | ||
56 | +++ b/hw/s390x/s390-pci-inst.c | ||
57 | @@ -XXX,XX +XXX,XX @@ int pcistb_service_call(S390CPU *cpu, uint8_t r1, uint8_t r3, uint64_t gaddr, | ||
58 | mr = s390_get_subregion(mr, offset, len); | ||
59 | offset -= mr->addr; | ||
60 | |||
61 | - if (!memory_region_access_valid(mr, offset, len, true)) { | ||
62 | + if (!memory_region_access_valid(mr, offset, len, true, | ||
63 | + MEMTXATTRS_UNSPECIFIED)) { | ||
64 | s390_program_interrupt(env, PGM_OPERAND, 6, ra); | ||
65 | return 0; | ||
66 | } | 111 | } |
67 | diff --git a/memory.c b/memory.c | 112 | @@ -XXX,XX +XXX,XX @@ static void mps2_common_init(MachineState *machine) |
68 | index XXXXXXX..XXXXXXX 100644 | 113 | 0x4002c000, 0x4002d000, |
69 | --- a/memory.c | 114 | 0x4002e000}; |
70 | +++ b/memory.c | 115 | Object *txrx_orgate; |
71 | @@ -XXX,XX +XXX,XX @@ static const MemoryRegionOps ram_device_mem_ops = { | 116 | - DeviceState *txrx_orgate_dev; |
72 | bool memory_region_access_valid(MemoryRegion *mr, | 117 | + DeviceState *txrx_orgate_dev, *dev; |
73 | hwaddr addr, | 118 | + SysBusDevice *s; |
74 | unsigned size, | 119 | |
75 | - bool is_write) | 120 | txrx_orgate = object_new(TYPE_OR_IRQ); |
76 | + bool is_write, | 121 | object_property_set_int(txrx_orgate, "num-lines", 2, &error_fatal); |
77 | + MemTxAttrs attrs) | 122 | @@ -XXX,XX +XXX,XX @@ static void mps2_common_init(MachineState *machine) |
78 | { | 123 | txrx_orgate_dev = DEVICE(txrx_orgate); |
79 | int access_size_min, access_size_max; | 124 | qdev_connect_gpio_out(txrx_orgate_dev, 0, |
80 | int access_size, i; | 125 | qdev_get_gpio_in(armv7m, uart_txrx_irqno[i])); |
81 | @@ -XXX,XX +XXX,XX @@ MemTxResult memory_region_dispatch_read(MemoryRegion *mr, | 126 | - cmsdk_apb_uart_create(uartbase[i], |
82 | { | 127 | - qdev_get_gpio_in(txrx_orgate_dev, 0), |
83 | MemTxResult r; | 128 | - qdev_get_gpio_in(txrx_orgate_dev, 1), |
84 | 129 | - qdev_get_gpio_in(orgate_dev, i * 2), | |
85 | - if (!memory_region_access_valid(mr, addr, size, false)) { | 130 | - qdev_get_gpio_in(orgate_dev, i * 2 + 1), |
86 | + if (!memory_region_access_valid(mr, addr, size, false, attrs)) { | 131 | - NULL, |
87 | *pval = unassigned_mem_read(mr, addr, size); | 132 | - serial_hd(i), SYSCLK_FRQ); |
88 | return MEMTX_DECODE_ERROR; | 133 | + |
89 | } | 134 | + dev = qdev_new(TYPE_CMSDK_APB_UART); |
90 | @@ -XXX,XX +XXX,XX @@ MemTxResult memory_region_dispatch_write(MemoryRegion *mr, | 135 | + s = SYS_BUS_DEVICE(dev); |
91 | unsigned size, | 136 | + qdev_prop_set_chr(dev, "chardev", serial_hd(i)); |
92 | MemTxAttrs attrs) | 137 | + qdev_prop_set_uint32(dev, "pclk-frq", SYSCLK_FRQ); |
93 | { | 138 | + sysbus_realize_and_unref(s, &error_fatal); |
94 | - if (!memory_region_access_valid(mr, addr, size, true)) { | 139 | + sysbus_mmio_map(s, 0, uartbase[i]); |
95 | + if (!memory_region_access_valid(mr, addr, size, true, attrs)) { | 140 | + sysbus_connect_irq(s, 0, qdev_get_gpio_in(txrx_orgate_dev, 0)); |
96 | unassigned_mem_write(mr, addr, data, size); | 141 | + sysbus_connect_irq(s, 1, qdev_get_gpio_in(txrx_orgate_dev, 1)); |
97 | return MEMTX_DECODE_ERROR; | 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; | ||
98 | } | 146 | } |
99 | -- | 147 | -- |
100 | 2.17.1 | 148 | 2.34.1 |
101 | 149 | ||
102 | 150 | diff view generated by jsdifflib |
1 | As part of plumbing MemTxAttrs down to the IOMMU translate method, | 1 | From: Philippe Mathieu-Daudé <philmd@linaro.org> |
---|---|---|---|
2 | add MemTxAttrs as an argument to address_space_translate() | ||
3 | and address_space_translate_cached(). Callers either have an | ||
4 | attrs value to hand, or don't care and can use MEMTXATTRS_UNSPECIFIED. | ||
5 | 2 | ||
3 | Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
4 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | ||
5 | Message-id: 20230220115114.25237-8-philmd@linaro.org | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
7 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | ||
8 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
9 | Message-id: 20180521140402.23318-4-peter.maydell@linaro.org | ||
10 | --- | 7 | --- |
11 | include/exec/memory.h | 4 +++- | 8 | include/hw/timer/cmsdk-apb-timer.h | 1 - |
12 | accel/tcg/translate-all.c | 2 +- | 9 | 1 file changed, 1 deletion(-) |
13 | exec.c | 14 +++++++++----- | ||
14 | hw/vfio/common.c | 3 ++- | ||
15 | memory_ldst.inc.c | 18 +++++++++--------- | ||
16 | target/riscv/helper.c | 2 +- | ||
17 | 6 files changed, 25 insertions(+), 18 deletions(-) | ||
18 | 10 | ||
19 | diff --git a/include/exec/memory.h b/include/exec/memory.h | 11 | diff --git a/include/hw/timer/cmsdk-apb-timer.h b/include/hw/timer/cmsdk-apb-timer.h |
20 | index XXXXXXX..XXXXXXX 100644 | 12 | index XXXXXXX..XXXXXXX 100644 |
21 | --- a/include/exec/memory.h | 13 | --- a/include/hw/timer/cmsdk-apb-timer.h |
22 | +++ b/include/exec/memory.h | 14 | +++ b/include/hw/timer/cmsdk-apb-timer.h |
23 | @@ -XXX,XX +XXX,XX @@ IOMMUTLBEntry address_space_get_iotlb_entry(AddressSpace *as, hwaddr addr, | 15 | @@ -XXX,XX +XXX,XX @@ |
24 | * #MemoryRegion. | 16 | #ifndef CMSDK_APB_TIMER_H |
25 | * @len: pointer to length | 17 | #define CMSDK_APB_TIMER_H |
26 | * @is_write: indicates the transfer direction | 18 | |
27 | + * @attrs: memory attributes | 19 | -#include "hw/qdev-properties.h" |
28 | */ | 20 | #include "hw/sysbus.h" |
29 | MemoryRegion *flatview_translate(FlatView *fv, | 21 | #include "hw/ptimer.h" |
30 | hwaddr addr, hwaddr *xlat, | 22 | #include "hw/clock.h" |
31 | @@ -XXX,XX +XXX,XX @@ MemoryRegion *flatview_translate(FlatView *fv, | ||
32 | |||
33 | static inline MemoryRegion *address_space_translate(AddressSpace *as, | ||
34 | hwaddr addr, hwaddr *xlat, | ||
35 | - hwaddr *len, bool is_write) | ||
36 | + hwaddr *len, bool is_write, | ||
37 | + MemTxAttrs attrs) | ||
38 | { | ||
39 | return flatview_translate(address_space_to_flatview(as), | ||
40 | addr, xlat, len, is_write); | ||
41 | diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c | ||
42 | index XXXXXXX..XXXXXXX 100644 | ||
43 | --- a/accel/tcg/translate-all.c | ||
44 | +++ b/accel/tcg/translate-all.c | ||
45 | @@ -XXX,XX +XXX,XX @@ void tb_invalidate_phys_addr(AddressSpace *as, hwaddr addr, MemTxAttrs attrs) | ||
46 | hwaddr l = 1; | ||
47 | |||
48 | rcu_read_lock(); | ||
49 | - mr = address_space_translate(as, addr, &addr, &l, false); | ||
50 | + mr = address_space_translate(as, addr, &addr, &l, false, attrs); | ||
51 | if (!(memory_region_is_ram(mr) | ||
52 | || memory_region_is_romd(mr))) { | ||
53 | rcu_read_unlock(); | ||
54 | diff --git a/exec.c b/exec.c | ||
55 | index XXXXXXX..XXXXXXX 100644 | ||
56 | --- a/exec.c | ||
57 | +++ b/exec.c | ||
58 | @@ -XXX,XX +XXX,XX @@ static inline void cpu_physical_memory_write_rom_internal(AddressSpace *as, | ||
59 | rcu_read_lock(); | ||
60 | while (len > 0) { | ||
61 | l = len; | ||
62 | - mr = address_space_translate(as, addr, &addr1, &l, true); | ||
63 | + mr = address_space_translate(as, addr, &addr1, &l, true, | ||
64 | + MEMTXATTRS_UNSPECIFIED); | ||
65 | |||
66 | if (!(memory_region_is_ram(mr) || | ||
67 | memory_region_is_romd(mr))) { | ||
68 | @@ -XXX,XX +XXX,XX @@ void address_space_cache_destroy(MemoryRegionCache *cache) | ||
69 | */ | ||
70 | static inline MemoryRegion *address_space_translate_cached( | ||
71 | MemoryRegionCache *cache, hwaddr addr, hwaddr *xlat, | ||
72 | - hwaddr *plen, bool is_write) | ||
73 | + hwaddr *plen, bool is_write, MemTxAttrs attrs) | ||
74 | { | ||
75 | MemoryRegionSection section; | ||
76 | MemoryRegion *mr; | ||
77 | @@ -XXX,XX +XXX,XX @@ address_space_read_cached_slow(MemoryRegionCache *cache, hwaddr addr, | ||
78 | MemoryRegion *mr; | ||
79 | |||
80 | l = len; | ||
81 | - mr = address_space_translate_cached(cache, addr, &addr1, &l, false); | ||
82 | + mr = address_space_translate_cached(cache, addr, &addr1, &l, false, | ||
83 | + MEMTXATTRS_UNSPECIFIED); | ||
84 | flatview_read_continue(cache->fv, | ||
85 | addr, MEMTXATTRS_UNSPECIFIED, buf, len, | ||
86 | addr1, l, mr); | ||
87 | @@ -XXX,XX +XXX,XX @@ address_space_write_cached_slow(MemoryRegionCache *cache, hwaddr addr, | ||
88 | MemoryRegion *mr; | ||
89 | |||
90 | l = len; | ||
91 | - mr = address_space_translate_cached(cache, addr, &addr1, &l, true); | ||
92 | + mr = address_space_translate_cached(cache, addr, &addr1, &l, true, | ||
93 | + MEMTXATTRS_UNSPECIFIED); | ||
94 | flatview_write_continue(cache->fv, | ||
95 | addr, MEMTXATTRS_UNSPECIFIED, buf, len, | ||
96 | addr1, l, mr); | ||
97 | @@ -XXX,XX +XXX,XX @@ bool cpu_physical_memory_is_io(hwaddr phys_addr) | ||
98 | |||
99 | rcu_read_lock(); | ||
100 | mr = address_space_translate(&address_space_memory, | ||
101 | - phys_addr, &phys_addr, &l, false); | ||
102 | + phys_addr, &phys_addr, &l, false, | ||
103 | + MEMTXATTRS_UNSPECIFIED); | ||
104 | |||
105 | res = !(memory_region_is_ram(mr) || memory_region_is_romd(mr)); | ||
106 | rcu_read_unlock(); | ||
107 | diff --git a/hw/vfio/common.c b/hw/vfio/common.c | ||
108 | index XXXXXXX..XXXXXXX 100644 | ||
109 | --- a/hw/vfio/common.c | ||
110 | +++ b/hw/vfio/common.c | ||
111 | @@ -XXX,XX +XXX,XX @@ static bool vfio_get_vaddr(IOMMUTLBEntry *iotlb, void **vaddr, | ||
112 | */ | ||
113 | mr = address_space_translate(&address_space_memory, | ||
114 | iotlb->translated_addr, | ||
115 | - &xlat, &len, writable); | ||
116 | + &xlat, &len, writable, | ||
117 | + MEMTXATTRS_UNSPECIFIED); | ||
118 | if (!memory_region_is_ram(mr)) { | ||
119 | error_report("iommu map to non memory area %"HWADDR_PRIx"", | ||
120 | xlat); | ||
121 | diff --git a/memory_ldst.inc.c b/memory_ldst.inc.c | ||
122 | index XXXXXXX..XXXXXXX 100644 | ||
123 | --- a/memory_ldst.inc.c | ||
124 | +++ b/memory_ldst.inc.c | ||
125 | @@ -XXX,XX +XXX,XX @@ static inline uint32_t glue(address_space_ldl_internal, SUFFIX)(ARG1_DECL, | ||
126 | bool release_lock = false; | ||
127 | |||
128 | RCU_READ_LOCK(); | ||
129 | - mr = TRANSLATE(addr, &addr1, &l, false); | ||
130 | + mr = TRANSLATE(addr, &addr1, &l, false, attrs); | ||
131 | if (l < 4 || !IS_DIRECT(mr, false)) { | ||
132 | release_lock |= prepare_mmio_access(mr); | ||
133 | |||
134 | @@ -XXX,XX +XXX,XX @@ static inline uint64_t glue(address_space_ldq_internal, SUFFIX)(ARG1_DECL, | ||
135 | bool release_lock = false; | ||
136 | |||
137 | RCU_READ_LOCK(); | ||
138 | - mr = TRANSLATE(addr, &addr1, &l, false); | ||
139 | + mr = TRANSLATE(addr, &addr1, &l, false, attrs); | ||
140 | if (l < 8 || !IS_DIRECT(mr, false)) { | ||
141 | release_lock |= prepare_mmio_access(mr); | ||
142 | |||
143 | @@ -XXX,XX +XXX,XX @@ uint32_t glue(address_space_ldub, SUFFIX)(ARG1_DECL, | ||
144 | bool release_lock = false; | ||
145 | |||
146 | RCU_READ_LOCK(); | ||
147 | - mr = TRANSLATE(addr, &addr1, &l, false); | ||
148 | + mr = TRANSLATE(addr, &addr1, &l, false, attrs); | ||
149 | if (!IS_DIRECT(mr, false)) { | ||
150 | release_lock |= prepare_mmio_access(mr); | ||
151 | |||
152 | @@ -XXX,XX +XXX,XX @@ static inline uint32_t glue(address_space_lduw_internal, SUFFIX)(ARG1_DECL, | ||
153 | bool release_lock = false; | ||
154 | |||
155 | RCU_READ_LOCK(); | ||
156 | - mr = TRANSLATE(addr, &addr1, &l, false); | ||
157 | + mr = TRANSLATE(addr, &addr1, &l, false, attrs); | ||
158 | if (l < 2 || !IS_DIRECT(mr, false)) { | ||
159 | release_lock |= prepare_mmio_access(mr); | ||
160 | |||
161 | @@ -XXX,XX +XXX,XX @@ void glue(address_space_stl_notdirty, SUFFIX)(ARG1_DECL, | ||
162 | bool release_lock = false; | ||
163 | |||
164 | RCU_READ_LOCK(); | ||
165 | - mr = TRANSLATE(addr, &addr1, &l, true); | ||
166 | + mr = TRANSLATE(addr, &addr1, &l, true, attrs); | ||
167 | if (l < 4 || !IS_DIRECT(mr, true)) { | ||
168 | release_lock |= prepare_mmio_access(mr); | ||
169 | |||
170 | @@ -XXX,XX +XXX,XX @@ static inline void glue(address_space_stl_internal, SUFFIX)(ARG1_DECL, | ||
171 | bool release_lock = false; | ||
172 | |||
173 | RCU_READ_LOCK(); | ||
174 | - mr = TRANSLATE(addr, &addr1, &l, true); | ||
175 | + mr = TRANSLATE(addr, &addr1, &l, true, attrs); | ||
176 | if (l < 4 || !IS_DIRECT(mr, true)) { | ||
177 | release_lock |= prepare_mmio_access(mr); | ||
178 | |||
179 | @@ -XXX,XX +XXX,XX @@ void glue(address_space_stb, SUFFIX)(ARG1_DECL, | ||
180 | bool release_lock = false; | ||
181 | |||
182 | RCU_READ_LOCK(); | ||
183 | - mr = TRANSLATE(addr, &addr1, &l, true); | ||
184 | + mr = TRANSLATE(addr, &addr1, &l, true, attrs); | ||
185 | if (!IS_DIRECT(mr, true)) { | ||
186 | release_lock |= prepare_mmio_access(mr); | ||
187 | r = memory_region_dispatch_write(mr, addr1, val, 1, attrs); | ||
188 | @@ -XXX,XX +XXX,XX @@ static inline void glue(address_space_stw_internal, SUFFIX)(ARG1_DECL, | ||
189 | bool release_lock = false; | ||
190 | |||
191 | RCU_READ_LOCK(); | ||
192 | - mr = TRANSLATE(addr, &addr1, &l, true); | ||
193 | + mr = TRANSLATE(addr, &addr1, &l, true, attrs); | ||
194 | if (l < 2 || !IS_DIRECT(mr, true)) { | ||
195 | release_lock |= prepare_mmio_access(mr); | ||
196 | |||
197 | @@ -XXX,XX +XXX,XX @@ static void glue(address_space_stq_internal, SUFFIX)(ARG1_DECL, | ||
198 | bool release_lock = false; | ||
199 | |||
200 | RCU_READ_LOCK(); | ||
201 | - mr = TRANSLATE(addr, &addr1, &l, true); | ||
202 | + mr = TRANSLATE(addr, &addr1, &l, true, attrs); | ||
203 | if (l < 8 || !IS_DIRECT(mr, true)) { | ||
204 | release_lock |= prepare_mmio_access(mr); | ||
205 | |||
206 | diff --git a/target/riscv/helper.c b/target/riscv/helper.c | ||
207 | index XXXXXXX..XXXXXXX 100644 | ||
208 | --- a/target/riscv/helper.c | ||
209 | +++ b/target/riscv/helper.c | ||
210 | @@ -XXX,XX +XXX,XX @@ restart: | ||
211 | MemoryRegion *mr; | ||
212 | hwaddr l = sizeof(target_ulong), addr1; | ||
213 | mr = address_space_translate(cs->as, pte_addr, | ||
214 | - &addr1, &l, false); | ||
215 | + &addr1, &l, false, MEMTXATTRS_UNSPECIFIED); | ||
216 | if (memory_access_is_direct(mr, true)) { | ||
217 | target_ulong *pte_pa = | ||
218 | qemu_map_ram_ptr(mr->ram_block, addr1); | ||
219 | -- | 23 | -- |
220 | 2.17.1 | 24 | 2.34.1 |
221 | 25 | ||
222 | 26 | diff view generated by jsdifflib |
1 | From: Shannon Zhao <zhaoshenglong@huawei.com> | 1 | From: Philippe Mathieu-Daudé <philmd@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | kvm_irqchip_create called by kvm_init will call kvm_init_irq_routing to | 3 | Avoid accessing 'parent_obj' directly. |
4 | initialize global capability variables. If we call kvm_init_irq_routing in | ||
5 | GIC realize function, previous allocated memory will leak. | ||
6 | 4 | ||
7 | Fix this by deleting the unnecessary call. | 5 | Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
8 | 6 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | |
9 | Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com> | 7 | Message-id: 20230220115114.25237-9-philmd@linaro.org |
10 | Reviewed-by: Eric Auger <eric.auger@redhat.com> | ||
11 | Message-id: 1527750994-14360-1-git-send-email-zhaoshenglong@huawei.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_gic_kvm.c | 1 - | 10 | hw/intc/armv7m_nvic.c | 6 +++--- |
15 | hw/intc/arm_gicv3_kvm.c | 1 - | 11 | 1 file changed, 3 insertions(+), 3 deletions(-) |
16 | 2 files changed, 2 deletions(-) | ||
17 | 12 | ||
18 | diff --git a/hw/intc/arm_gic_kvm.c b/hw/intc/arm_gic_kvm.c | 13 | diff --git a/hw/intc/armv7m_nvic.c b/hw/intc/armv7m_nvic.c |
19 | index XXXXXXX..XXXXXXX 100644 | 14 | index XXXXXXX..XXXXXXX 100644 |
20 | --- a/hw/intc/arm_gic_kvm.c | 15 | --- a/hw/intc/armv7m_nvic.c |
21 | +++ b/hw/intc/arm_gic_kvm.c | 16 | +++ b/hw/intc/armv7m_nvic.c |
22 | @@ -XXX,XX +XXX,XX @@ static void kvm_arm_gic_realize(DeviceState *dev, Error **errp) | 17 | @@ -XXX,XX +XXX,XX @@ static void do_armv7m_nvic_set_pending(void *opaque, int irq, bool secure, |
23 | 18 | * which saves having to have an extra argument is_terminal | |
24 | if (kvm_has_gsi_routing()) { | 19 | * that we'd only use in one place. |
25 | /* set up irq routing */ | 20 | */ |
26 | - kvm_init_irq_routing(kvm_state); | 21 | - cpu_abort(&s->cpu->parent_obj, |
27 | for (i = 0; i < s->num_irq - GIC_INTERNAL; ++i) { | 22 | + cpu_abort(CPU(s->cpu), |
28 | kvm_irqchip_add_irq_route(kvm_state, i, 0, i); | 23 | "Lockup: can't take terminal derived exception " |
29 | } | 24 | "(original exception priority %d)\n", |
30 | diff --git a/hw/intc/arm_gicv3_kvm.c b/hw/intc/arm_gicv3_kvm.c | 25 | s->vectpending_prio); |
31 | index XXXXXXX..XXXXXXX 100644 | 26 | @@ -XXX,XX +XXX,XX @@ static void do_armv7m_nvic_set_pending(void *opaque, int irq, bool secure, |
32 | --- a/hw/intc/arm_gicv3_kvm.c | 27 | * Lockup condition due to a guest bug. We don't model |
33 | +++ b/hw/intc/arm_gicv3_kvm.c | 28 | * Lockup, so report via cpu_abort() instead. |
34 | @@ -XXX,XX +XXX,XX @@ static void kvm_arm_gicv3_realize(DeviceState *dev, Error **errp) | 29 | */ |
35 | 30 | - cpu_abort(&s->cpu->parent_obj, | |
36 | if (kvm_has_gsi_routing()) { | 31 | + cpu_abort(CPU(s->cpu), |
37 | /* set up irq routing */ | 32 | "Lockup: can't escalate %d to HardFault " |
38 | - kvm_init_irq_routing(kvm_state); | 33 | "(current priority %d)\n", irq, running); |
39 | for (i = 0; i < s->num_irq - GIC_INTERNAL; ++i) { | 34 | } |
40 | kvm_irqchip_add_irq_route(kvm_state, i, 0, i); | 35 | @@ -XXX,XX +XXX,XX @@ void armv7m_nvic_set_pending_lazyfp(NVICState *s, int irq, bool secure) |
36 | * We want to escalate to HardFault but the context the | ||
37 | * FP state belongs to prevents the exception pre-empting. | ||
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"); | ||
41 | } | 43 | } |
42 | -- | 44 | -- |
43 | 2.17.1 | 45 | 2.34.1 |
44 | 46 | ||
45 | 47 | diff view generated by jsdifflib |
1 | From: Jan Kiszka <jan.kiszka@siemens.com> | 1 | From: Philippe Mathieu-Daudé <philmd@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | There was a nasty flip in identifying which register group an access is | 3 | Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
4 | targeting. The issue caused spuriously raised priorities of the guest | 4 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
5 | when handing CPUs over in the Jailhouse hypervisor. | ||
6 | |||
7 | Cc: qemu-stable@nongnu.org | ||
8 | Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> | ||
9 | Message-id: 28b927d3-da58-bce4-cc13-bfec7f9b1cb9@siemens.com | ||
10 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 5 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
12 | --- | 6 | --- |
13 | hw/intc/arm_gicv3_cpuif.c | 12 ++++++------ | 7 | hw/arm/musicpal.c | 4 ---- |
14 | 1 file changed, 6 insertions(+), 6 deletions(-) | 8 | 1 file changed, 4 deletions(-) |
15 | 9 | ||
16 | diff --git a/hw/intc/arm_gicv3_cpuif.c b/hw/intc/arm_gicv3_cpuif.c | 10 | diff --git a/hw/arm/musicpal.c b/hw/arm/musicpal.c |
17 | index XXXXXXX..XXXXXXX 100644 | 11 | index XXXXXXX..XXXXXXX 100644 |
18 | --- a/hw/intc/arm_gicv3_cpuif.c | 12 | --- a/hw/arm/musicpal.c |
19 | +++ b/hw/intc/arm_gicv3_cpuif.c | 13 | +++ b/hw/arm/musicpal.c |
20 | @@ -XXX,XX +XXX,XX @@ static uint64_t icv_ap_read(CPUARMState *env, const ARMCPRegInfo *ri) | 14 | @@ -XXX,XX +XXX,XX @@ struct musicpal_key_state { |
21 | { | 15 | SysBusDevice parent_obj; |
22 | GICv3CPUState *cs = icc_cs_from_env(env); | 16 | /*< public >*/ |
23 | int regno = ri->opc2 & 3; | 17 | |
24 | - int grp = ri->crm & 1 ? GICV3_G0 : GICV3_G1NS; | 18 | - MemoryRegion iomem; |
25 | + int grp = (ri->crm & 1) ? GICV3_G1NS : GICV3_G0; | 19 | uint32_t kbd_extended; |
26 | uint64_t value = cs->ich_apr[grp][regno]; | 20 | uint32_t pressed_keys; |
27 | 21 | qemu_irq out[8]; | |
28 | trace_gicv3_icv_ap_read(ri->crm & 1, regno, gicv3_redist_affid(cs), value); | 22 | @@ -XXX,XX +XXX,XX @@ static void musicpal_key_init(Object *obj) |
29 | @@ -XXX,XX +XXX,XX @@ static void icv_ap_write(CPUARMState *env, const ARMCPRegInfo *ri, | 23 | DeviceState *dev = DEVICE(sbd); |
30 | { | 24 | musicpal_key_state *s = MUSICPAL_KEY(dev); |
31 | GICv3CPUState *cs = icc_cs_from_env(env); | 25 | |
32 | int regno = ri->opc2 & 3; | 26 | - memory_region_init(&s->iomem, obj, "dummy", 0); |
33 | - int grp = ri->crm & 1 ? GICV3_G0 : GICV3_G1NS; | 27 | - sysbus_init_mmio(sbd, &s->iomem); |
34 | + int grp = (ri->crm & 1) ? GICV3_G1NS : GICV3_G0; | 28 | - |
35 | 29 | s->kbd_extended = 0; | |
36 | trace_gicv3_icv_ap_write(ri->crm & 1, regno, gicv3_redist_affid(cs), value); | 30 | s->pressed_keys = 0; |
37 | |||
38 | @@ -XXX,XX +XXX,XX @@ static uint64_t icc_ap_read(CPUARMState *env, const ARMCPRegInfo *ri) | ||
39 | uint64_t value; | ||
40 | |||
41 | int regno = ri->opc2 & 3; | ||
42 | - int grp = ri->crm & 1 ? GICV3_G0 : GICV3_G1; | ||
43 | + int grp = (ri->crm & 1) ? GICV3_G1 : GICV3_G0; | ||
44 | |||
45 | if (icv_access(env, grp == GICV3_G0 ? HCR_FMO : HCR_IMO)) { | ||
46 | return icv_ap_read(env, ri); | ||
47 | @@ -XXX,XX +XXX,XX @@ static void icc_ap_write(CPUARMState *env, const ARMCPRegInfo *ri, | ||
48 | GICv3CPUState *cs = icc_cs_from_env(env); | ||
49 | |||
50 | int regno = ri->opc2 & 3; | ||
51 | - int grp = ri->crm & 1 ? GICV3_G0 : GICV3_G1; | ||
52 | + int grp = (ri->crm & 1) ? GICV3_G1 : GICV3_G0; | ||
53 | |||
54 | if (icv_access(env, grp == GICV3_G0 ? HCR_FMO : HCR_IMO)) { | ||
55 | icv_ap_write(env, ri, value); | ||
56 | @@ -XXX,XX +XXX,XX @@ static uint64_t ich_ap_read(CPUARMState *env, const ARMCPRegInfo *ri) | ||
57 | { | ||
58 | GICv3CPUState *cs = icc_cs_from_env(env); | ||
59 | int regno = ri->opc2 & 3; | ||
60 | - int grp = ri->crm & 1 ? GICV3_G0 : GICV3_G1NS; | ||
61 | + int grp = (ri->crm & 1) ? GICV3_G1NS : GICV3_G0; | ||
62 | uint64_t value; | ||
63 | |||
64 | value = cs->ich_apr[grp][regno]; | ||
65 | @@ -XXX,XX +XXX,XX @@ static void ich_ap_write(CPUARMState *env, const ARMCPRegInfo *ri, | ||
66 | { | ||
67 | GICv3CPUState *cs = icc_cs_from_env(env); | ||
68 | int regno = ri->opc2 & 3; | ||
69 | - int grp = ri->crm & 1 ? GICV3_G0 : GICV3_G1NS; | ||
70 | + int grp = (ri->crm & 1) ? GICV3_G1NS : GICV3_G0; | ||
71 | |||
72 | trace_gicv3_ich_ap_write(ri->crm & 1, regno, gicv3_redist_affid(cs), value); | ||
73 | 31 | ||
74 | -- | 32 | -- |
75 | 2.17.1 | 33 | 2.34.1 |
76 | 34 | ||
77 | 35 | diff view generated by jsdifflib |
1 | From: Francisco Iglesias <frasse.iglesias@gmail.com> | 1 | From: Philippe Mathieu-Daudé <philmd@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Coverity found that the string return by 'object_get_canonical_path' was not | 3 | Since commit be8d853766 ("iothread: add I/O thread object") we |
4 | being freed at two locations in the model (CID 1391294 and CID 1391293) and | 4 | never used IOThreadClass / IOTHREAD_CLASS() / IOTHREAD_GET_CLASS(), |
5 | also that a memset was being called with a value greater than the max of a byte | 5 | remove these definitions. |
6 | on the second argument (CID 1391286). This patch corrects this by adding the | ||
7 | freeing of the strings and also changing to memset to zero instead on | ||
8 | descriptor unaligned errors. | ||
9 | 6 | ||
10 | Signed-off-by: Francisco Iglesias <frasse.iglesias@gmail.com> | 7 | Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
11 | Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | 8 | Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> |
12 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 9 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> |
13 | Message-id: 20180528184859.3530-1-frasse.iglesias@gmail.com | 10 | Message-id: 20230113200138.52869-2-philmd@linaro.org |
14 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
15 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
16 | --- | 12 | --- |
17 | hw/dma/xlnx-zdma.c | 10 +++++++--- | 13 | iothread.c | 4 ---- |
18 | 1 file changed, 7 insertions(+), 3 deletions(-) | 14 | 1 file changed, 4 deletions(-) |
19 | 15 | ||
20 | diff --git a/hw/dma/xlnx-zdma.c b/hw/dma/xlnx-zdma.c | 16 | diff --git a/iothread.c b/iothread.c |
21 | index XXXXXXX..XXXXXXX 100644 | 17 | index XXXXXXX..XXXXXXX 100644 |
22 | --- a/hw/dma/xlnx-zdma.c | 18 | --- a/iothread.c |
23 | +++ b/hw/dma/xlnx-zdma.c | 19 | +++ b/iothread.c |
24 | @@ -XXX,XX +XXX,XX @@ static bool zdma_load_descriptor(XlnxZDMA *s, uint64_t addr, void *buf) | 20 | @@ -XXX,XX +XXX,XX @@ |
25 | qemu_log_mask(LOG_GUEST_ERROR, | 21 | #include "qemu/rcu.h" |
26 | "zdma: unaligned descriptor at %" PRIx64, | 22 | #include "qemu/main-loop.h" |
27 | addr); | 23 | |
28 | - memset(buf, 0xdeadbeef, sizeof(XlnxZDMADescr)); | 24 | -typedef ObjectClass IOThreadClass; |
29 | + memset(buf, 0x0, sizeof(XlnxZDMADescr)); | 25 | - |
30 | s->error = true; | 26 | -DECLARE_CLASS_CHECKERS(IOThreadClass, IOTHREAD, |
31 | return false; | 27 | - TYPE_IOTHREAD) |
32 | } | 28 | |
33 | @@ -XXX,XX +XXX,XX @@ static uint64_t zdma_read(void *opaque, hwaddr addr, unsigned size) | 29 | #ifdef CONFIG_POSIX |
34 | RegisterInfo *r = &s->regs_info[addr / 4]; | 30 | /* Benchmark results from 2016 on NVMe SSD drives show max polling times around |
35 | |||
36 | if (!r->data) { | ||
37 | + gchar *path = object_get_canonical_path(OBJECT(s)); | ||
38 | qemu_log("%s: Decode error: read from %" HWADDR_PRIx "\n", | ||
39 | - object_get_canonical_path(OBJECT(s)), | ||
40 | + path, | ||
41 | addr); | ||
42 | + g_free(path); | ||
43 | ARRAY_FIELD_DP32(s->regs, ZDMA_CH_ISR, INV_APB, true); | ||
44 | zdma_ch_imr_update_irq(s); | ||
45 | return 0; | ||
46 | @@ -XXX,XX +XXX,XX @@ static void zdma_write(void *opaque, hwaddr addr, uint64_t value, | ||
47 | RegisterInfo *r = &s->regs_info[addr / 4]; | ||
48 | |||
49 | if (!r->data) { | ||
50 | + gchar *path = object_get_canonical_path(OBJECT(s)); | ||
51 | qemu_log("%s: Decode error: write to %" HWADDR_PRIx "=%" PRIx64 "\n", | ||
52 | - object_get_canonical_path(OBJECT(s)), | ||
53 | + path, | ||
54 | addr, value); | ||
55 | + g_free(path); | ||
56 | ARRAY_FIELD_DP32(s->regs, ZDMA_CH_ISR, INV_APB, true); | ||
57 | zdma_ch_imr_update_irq(s); | ||
58 | return; | ||
59 | -- | 31 | -- |
60 | 2.17.1 | 32 | 2.34.1 |
61 | 33 | ||
62 | 34 | diff view generated by jsdifflib |
1 | Add more detail to the documentation for memory_region_init_iommu() | 1 | From: Philippe Mathieu-Daudé <philmd@linaro.org> |
---|---|---|---|
2 | and other IOMMU-related functions and data structures. | ||
3 | 2 | ||
3 | QOM *DECLARE* macros expect a typedef as first argument, | ||
4 | not a structure. Replace 'struct IRQState' by 'IRQState' | ||
5 | to avoid when modifying the macros: | ||
6 | |||
7 | ../hw/core/irq.c:29:1: error: declaration of anonymous struct must be a definition | ||
8 | DECLARE_INSTANCE_CHECKER(struct IRQState, IRQ, | ||
9 | ^ | ||
10 | |||
11 | Use OBJECT_DECLARE_SIMPLE_TYPE instead of DECLARE_INSTANCE_CHECKER. | ||
12 | |||
13 | Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
14 | Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> | ||
15 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | ||
16 | Message-id: 20230113200138.52869-3-philmd@linaro.org | ||
4 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 17 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
5 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
6 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | ||
7 | Reviewed-by: Eric Auger <eric.auger@redhat.com> | ||
8 | Message-id: 20180521140402.23318-2-peter.maydell@linaro.org | ||
9 | --- | 18 | --- |
10 | include/exec/memory.h | 105 ++++++++++++++++++++++++++++++++++++++---- | 19 | hw/core/irq.c | 9 ++++----- |
11 | 1 file changed, 95 insertions(+), 10 deletions(-) | 20 | 1 file changed, 4 insertions(+), 5 deletions(-) |
12 | 21 | ||
13 | diff --git a/include/exec/memory.h b/include/exec/memory.h | 22 | diff --git a/hw/core/irq.c b/hw/core/irq.c |
14 | index XXXXXXX..XXXXXXX 100644 | 23 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/include/exec/memory.h | 24 | --- a/hw/core/irq.c |
16 | +++ b/include/exec/memory.h | 25 | +++ b/hw/core/irq.c |
17 | @@ -XXX,XX +XXX,XX @@ enum IOMMUMemoryRegionAttr { | 26 | @@ -XXX,XX +XXX,XX @@ |
18 | IOMMU_ATTR_SPAPR_TCE_FD | 27 | #include "hw/irq.h" |
28 | #include "qom/object.h" | ||
29 | |||
30 | -DECLARE_INSTANCE_CHECKER(struct IRQState, IRQ, | ||
31 | - TYPE_IRQ) | ||
32 | +OBJECT_DECLARE_SIMPLE_TYPE(IRQState, IRQ) | ||
33 | |||
34 | struct IRQState { | ||
35 | Object parent_obj; | ||
36 | @@ -XXX,XX +XXX,XX @@ qemu_irq *qemu_allocate_irqs(qemu_irq_handler handler, void *opaque, int n) | ||
37 | |||
38 | qemu_irq qemu_allocate_irq(qemu_irq_handler handler, void *opaque, int n) | ||
39 | { | ||
40 | - struct IRQState *irq; | ||
41 | + IRQState *irq; | ||
42 | |||
43 | irq = IRQ(object_new(TYPE_IRQ)); | ||
44 | irq->handler = handler; | ||
45 | @@ -XXX,XX +XXX,XX @@ void qemu_free_irq(qemu_irq irq) | ||
46 | |||
47 | static void qemu_notirq(void *opaque, int line, int level) | ||
48 | { | ||
49 | - struct IRQState *irq = opaque; | ||
50 | + IRQState *irq = opaque; | ||
51 | |||
52 | irq->handler(irq->opaque, irq->n, !level); | ||
53 | } | ||
54 | @@ -XXX,XX +XXX,XX @@ void qemu_irq_intercept_in(qemu_irq *gpio_in, qemu_irq_handler handler, int n) | ||
55 | static const TypeInfo irq_type_info = { | ||
56 | .name = TYPE_IRQ, | ||
57 | .parent = TYPE_OBJECT, | ||
58 | - .instance_size = sizeof(struct IRQState), | ||
59 | + .instance_size = sizeof(IRQState), | ||
19 | }; | 60 | }; |
20 | 61 | ||
21 | +/** | 62 | static void irq_register_types(void) |
22 | + * IOMMUMemoryRegionClass: | ||
23 | + * | ||
24 | + * All IOMMU implementations need to subclass TYPE_IOMMU_MEMORY_REGION | ||
25 | + * and provide an implementation of at least the @translate method here | ||
26 | + * to handle requests to the memory region. Other methods are optional. | ||
27 | + * | ||
28 | + * The IOMMU implementation must use the IOMMU notifier infrastructure | ||
29 | + * to report whenever mappings are changed, by calling | ||
30 | + * memory_region_notify_iommu() (or, if necessary, by calling | ||
31 | + * memory_region_notify_one() for each registered notifier). | ||
32 | + */ | ||
33 | typedef struct IOMMUMemoryRegionClass { | ||
34 | /* private */ | ||
35 | struct DeviceClass parent_class; | ||
36 | |||
37 | /* | ||
38 | - * Return a TLB entry that contains a given address. Flag should | ||
39 | - * be the access permission of this translation operation. We can | ||
40 | - * set flag to IOMMU_NONE to mean that we don't need any | ||
41 | - * read/write permission checks, like, when for region replay. | ||
42 | + * Return a TLB entry that contains a given address. | ||
43 | + * | ||
44 | + * The IOMMUAccessFlags indicated via @flag are optional and may | ||
45 | + * be specified as IOMMU_NONE to indicate that the caller needs | ||
46 | + * the full translation information for both reads and writes. If | ||
47 | + * the access flags are specified then the IOMMU implementation | ||
48 | + * may use this as an optimization, to stop doing a page table | ||
49 | + * walk as soon as it knows that the requested permissions are not | ||
50 | + * allowed. If IOMMU_NONE is passed then the IOMMU must do the | ||
51 | + * full page table walk and report the permissions in the returned | ||
52 | + * IOMMUTLBEntry. (Note that this implies that an IOMMU may not | ||
53 | + * return different mappings for reads and writes.) | ||
54 | + * | ||
55 | + * The returned information remains valid while the caller is | ||
56 | + * holding the big QEMU lock or is inside an RCU critical section; | ||
57 | + * if the caller wishes to cache the mapping beyond that it must | ||
58 | + * register an IOMMU notifier so it can invalidate its cached | ||
59 | + * information when the IOMMU mapping changes. | ||
60 | + * | ||
61 | + * @iommu: the IOMMUMemoryRegion | ||
62 | + * @hwaddr: address to be translated within the memory region | ||
63 | + * @flag: requested access permissions | ||
64 | */ | ||
65 | IOMMUTLBEntry (*translate)(IOMMUMemoryRegion *iommu, hwaddr addr, | ||
66 | IOMMUAccessFlags flag); | ||
67 | - /* Returns minimum supported page size */ | ||
68 | + /* Returns minimum supported page size in bytes. | ||
69 | + * If this method is not provided then the minimum is assumed to | ||
70 | + * be TARGET_PAGE_SIZE. | ||
71 | + * | ||
72 | + * @iommu: the IOMMUMemoryRegion | ||
73 | + */ | ||
74 | uint64_t (*get_min_page_size)(IOMMUMemoryRegion *iommu); | ||
75 | - /* Called when IOMMU Notifier flag changed */ | ||
76 | + /* Called when IOMMU Notifier flag changes (ie when the set of | ||
77 | + * events which IOMMU users are requesting notification for changes). | ||
78 | + * Optional method -- need not be provided if the IOMMU does not | ||
79 | + * need to know exactly which events must be notified. | ||
80 | + * | ||
81 | + * @iommu: the IOMMUMemoryRegion | ||
82 | + * @old_flags: events which previously needed to be notified | ||
83 | + * @new_flags: events which now need to be notified | ||
84 | + */ | ||
85 | void (*notify_flag_changed)(IOMMUMemoryRegion *iommu, | ||
86 | IOMMUNotifierFlag old_flags, | ||
87 | IOMMUNotifierFlag new_flags); | ||
88 | - /* Set this up to provide customized IOMMU replay function */ | ||
89 | + /* Called to handle memory_region_iommu_replay(). | ||
90 | + * | ||
91 | + * The default implementation of memory_region_iommu_replay() is to | ||
92 | + * call the IOMMU translate method for every page in the address space | ||
93 | + * with flag == IOMMU_NONE and then call the notifier if translate | ||
94 | + * returns a valid mapping. If this method is implemented then it | ||
95 | + * overrides the default behaviour, and must provide the full semantics | ||
96 | + * of memory_region_iommu_replay(), by calling @notifier for every | ||
97 | + * translation present in the IOMMU. | ||
98 | + * | ||
99 | + * Optional method -- an IOMMU only needs to provide this method | ||
100 | + * if the default is inefficient or produces undesirable side effects. | ||
101 | + * | ||
102 | + * Note: this is not related to record-and-replay functionality. | ||
103 | + */ | ||
104 | void (*replay)(IOMMUMemoryRegion *iommu, IOMMUNotifier *notifier); | ||
105 | |||
106 | - /* Get IOMMU misc attributes */ | ||
107 | - int (*get_attr)(IOMMUMemoryRegion *iommu, enum IOMMUMemoryRegionAttr, | ||
108 | + /* Get IOMMU misc attributes. This is an optional method that | ||
109 | + * can be used to allow users of the IOMMU to get implementation-specific | ||
110 | + * information. The IOMMU implements this method to handle calls | ||
111 | + * by IOMMU users to memory_region_iommu_get_attr() by filling in | ||
112 | + * the arbitrary data pointer for any IOMMUMemoryRegionAttr values that | ||
113 | + * the IOMMU supports. If the method is unimplemented then | ||
114 | + * memory_region_iommu_get_attr() will always return -EINVAL. | ||
115 | + * | ||
116 | + * @iommu: the IOMMUMemoryRegion | ||
117 | + * @attr: attribute being queried | ||
118 | + * @data: memory to fill in with the attribute data | ||
119 | + * | ||
120 | + * Returns 0 on success, or a negative errno; in particular | ||
121 | + * returns -EINVAL for unrecognized or unimplemented attribute types. | ||
122 | + */ | ||
123 | + int (*get_attr)(IOMMUMemoryRegion *iommu, enum IOMMUMemoryRegionAttr attr, | ||
124 | void *data); | ||
125 | } IOMMUMemoryRegionClass; | ||
126 | |||
127 | @@ -XXX,XX +XXX,XX @@ static inline void memory_region_init_reservation(MemoryRegion *mr, | ||
128 | * An IOMMU region translates addresses and forwards accesses to a target | ||
129 | * memory region. | ||
130 | * | ||
131 | + * The IOMMU implementation must define a subclass of TYPE_IOMMU_MEMORY_REGION. | ||
132 | + * @_iommu_mr should be a pointer to enough memory for an instance of | ||
133 | + * that subclass, @instance_size is the size of that subclass, and | ||
134 | + * @mrtypename is its name. This function will initialize @_iommu_mr as an | ||
135 | + * instance of the subclass, and its methods will then be called to handle | ||
136 | + * accesses to the memory region. See the documentation of | ||
137 | + * #IOMMUMemoryRegionClass for further details. | ||
138 | + * | ||
139 | * @_iommu_mr: the #IOMMUMemoryRegion to be initialized | ||
140 | * @instance_size: the IOMMUMemoryRegion subclass instance size | ||
141 | * @mrtypename: the type name of the #IOMMUMemoryRegion | ||
142 | @@ -XXX,XX +XXX,XX @@ void memory_region_register_iommu_notifier(MemoryRegion *mr, | ||
143 | * a notifier with the minimum page granularity returned by | ||
144 | * mr->iommu_ops->get_page_size(). | ||
145 | * | ||
146 | + * Note: this is not related to record-and-replay functionality. | ||
147 | + * | ||
148 | * @iommu_mr: the memory region to observe | ||
149 | * @n: the notifier to which to replay iommu mappings | ||
150 | */ | ||
151 | @@ -XXX,XX +XXX,XX @@ void memory_region_iommu_replay(IOMMUMemoryRegion *iommu_mr, IOMMUNotifier *n); | ||
152 | * memory_region_iommu_replay_all: replay existing IOMMU translations | ||
153 | * to all the notifiers registered. | ||
154 | * | ||
155 | + * Note: this is not related to record-and-replay functionality. | ||
156 | + * | ||
157 | * @iommu_mr: the memory region to observe | ||
158 | */ | ||
159 | void memory_region_iommu_replay_all(IOMMUMemoryRegion *iommu_mr); | ||
160 | @@ -XXX,XX +XXX,XX @@ void memory_region_unregister_iommu_notifier(MemoryRegion *mr, | ||
161 | * memory_region_iommu_get_attr: return an IOMMU attr if get_attr() is | ||
162 | * defined on the IOMMU. | ||
163 | * | ||
164 | - * Returns 0 if succeded, error code otherwise. | ||
165 | + * Returns 0 on success, or a negative errno otherwise. In particular, | ||
166 | + * -EINVAL indicates that the IOMMU does not support the requested | ||
167 | + * attribute. | ||
168 | * | ||
169 | * @iommu_mr: the memory region | ||
170 | * @attr: the requested attribute | ||
171 | -- | 63 | -- |
172 | 2.17.1 | 64 | 2.34.1 |
173 | 65 | ||
174 | 66 | diff view generated by jsdifflib |
1 | From: Paolo Bonzini <pbonzini@redhat.com> | 1 | From: Philippe Mathieu-Daudé <philmd@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | cpregs_keys is an uint32_t* so the allocation should use uint32_t. | 3 | Missed during automatic conversion from commit 8063396bf3 |
4 | g_new is even better because it is type-safe. | 4 | ("Use OBJECT_DECLARE_SIMPLE_TYPE when possible"). |
5 | 5 | ||
6 | Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> | 6 | Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 7 | Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> |
8 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 8 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> |
9 | Message-id: 20230113200138.52869-4-philmd@linaro.org | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
10 | --- | 11 | --- |
11 | target/arm/gdbstub.c | 3 +-- | 12 | include/hw/or-irq.h | 3 +-- |
12 | 1 file changed, 1 insertion(+), 2 deletions(-) | 13 | 1 file changed, 1 insertion(+), 2 deletions(-) |
13 | 14 | ||
14 | diff --git a/target/arm/gdbstub.c b/target/arm/gdbstub.c | 15 | diff --git a/include/hw/or-irq.h b/include/hw/or-irq.h |
15 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/target/arm/gdbstub.c | 17 | --- a/include/hw/or-irq.h |
17 | +++ b/target/arm/gdbstub.c | 18 | +++ b/include/hw/or-irq.h |
18 | @@ -XXX,XX +XXX,XX @@ int arm_gen_dynamic_xml(CPUState *cs) | 19 | @@ -XXX,XX +XXX,XX @@ |
19 | RegisterSysregXmlParam param = {cs, s}; | 20 | |
20 | 21 | typedef struct OrIRQState qemu_or_irq; | |
21 | cpu->dyn_xml.num_cpregs = 0; | 22 | |
22 | - cpu->dyn_xml.cpregs_keys = g_malloc(sizeof(uint32_t *) * | 23 | -DECLARE_INSTANCE_CHECKER(qemu_or_irq, OR_IRQ, |
23 | - g_hash_table_size(cpu->cp_regs)); | 24 | - TYPE_OR_IRQ) |
24 | + cpu->dyn_xml.cpregs_keys = g_new(uint32_t, g_hash_table_size(cpu->cp_regs)); | 25 | +OBJECT_DECLARE_SIMPLE_TYPE(OrIRQState, OR_IRQ) |
25 | g_string_printf(s, "<?xml version=\"1.0\"?>"); | 26 | |
26 | g_string_append_printf(s, "<!DOCTYPE target SYSTEM \"gdb-target.dtd\">"); | 27 | struct OrIRQState { |
27 | g_string_append_printf(s, "<feature name=\"org.qemu.gdb.arm.sys.regs\">"); | 28 | DeviceState parent_obj; |
28 | -- | 29 | -- |
29 | 2.17.1 | 30 | 2.34.1 |
30 | 31 | ||
31 | 32 | diff view generated by jsdifflib |
1 | In commit f0aff255700 we made cpacr_write() enforce that some CPACR | 1 | From: Philippe Mathieu-Daudé <philmd@linaro.org> |
---|---|---|---|
2 | bits are RAZ/WI and some are RAO/WI for ARMv7 cores. Unfortunately | 2 | |
3 | we forgot to also update the register's reset value. The effect | 3 | OBJECT_DECLARE_SIMPLE_TYPE() macro provides the OrIRQState |
4 | was that (a) a guest that read CPACR on reset would not see ones in | 4 | declaration for free. Besides, the QOM code style is to use |
5 | the RAO bits, and (b) if you did a migration before the guest did | 5 | the structure name as typedef, and QEMU style is to use Camel |
6 | a write to the CPACR then the migration would fail because the | 6 | Case, so rename qemu_or_irq as OrIRQState. |
7 | destination would enforce the RAO bits and then complain that they | 7 | |
8 | didn't match the zero value from the source. | 8 | Mechanical change using: |
9 | 9 | ||
10 | Implement reset for the CPACR using a custom reset function | 10 | $ sed -i -e 's/qemu_or_irq/OrIRQState/g' $(git grep -l qemu_or_irq) |
11 | that just calls cpacr_write(), to avoid having to duplicate | 11 | |
12 | the logic for which bits are RAO. | 12 | Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
13 | 13 | Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> | |
14 | This bug would affect migration for TCG CPUs which are ARMv7 | 14 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> |
15 | with VFP but without one of Neon or VFPv3. | 15 | Message-id: 20230113200138.52869-5-philmd@linaro.org |
16 | |||
17 | Reported-by: Cédric Le Goater <clg@kaod.org> | ||
18 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 16 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
19 | Tested-by: Cédric Le Goater <clg@kaod.org> | ||
20 | Message-id: 20180522173713.26282-1-peter.maydell@linaro.org | ||
21 | --- | 17 | --- |
22 | target/arm/helper.c | 10 +++++++++- | 18 | include/hw/arm/armsse.h | 6 +++--- |
23 | 1 file changed, 9 insertions(+), 1 deletion(-) | 19 | include/hw/arm/bcm2835_peripherals.h | 2 +- |
24 | 20 | include/hw/arm/exynos4210.h | 4 ++-- | |
25 | diff --git a/target/arm/helper.c b/target/arm/helper.c | 21 | include/hw/arm/stm32f205_soc.h | 2 +- |
26 | index XXXXXXX..XXXXXXX 100644 | 22 | include/hw/arm/stm32f405_soc.h | 2 +- |
27 | --- a/target/arm/helper.c | 23 | include/hw/arm/xlnx-versal.h | 6 +++--- |
28 | +++ b/target/arm/helper.c | 24 | include/hw/arm/xlnx-zynqmp.h | 2 +- |
29 | @@ -XXX,XX +XXX,XX @@ static void cpacr_write(CPUARMState *env, const ARMCPRegInfo *ri, | 25 | include/hw/or-irq.h | 2 -- |
30 | env->cp15.cpacr_el1 = value; | 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; | ||
31 | } | 169 | } |
32 | 170 | ||
33 | +static void cpacr_reset(CPUARMState *env, const ARMCPRegInfo *ri) | 171 | -static DeviceState *pl330_create(uint32_t base, qemu_or_irq *orgate, |
34 | +{ | 172 | +static DeviceState *pl330_create(uint32_t base, OrIRQState *orgate, |
35 | + /* Call cpacr_write() so that we reset with the correct RAO bits set | 173 | qemu_irq irq, int nreq, int nevents, int width) |
36 | + * for our CPU features. | 174 | { |
37 | + */ | 175 | SysBusDevice *busdev; |
38 | + cpacr_write(env, ri, 0); | 176 | @@ -XXX,XX +XXX,XX @@ static void exynos4210_init(Object *obj) |
39 | +} | 177 | |
40 | + | 178 | for (i = 0; i < ARRAY_SIZE(s->pl330_irq_orgate); i++) { |
41 | static CPAccessResult cpacr_access(CPUARMState *env, const ARMCPRegInfo *ri, | 179 | char *name = g_strdup_printf("pl330-irq-orgate%d", i); |
42 | bool isread) | 180 | - qemu_or_irq *orgate = &s->pl330_irq_orgate[i]; |
43 | { | 181 | + OrIRQState *orgate = &s->pl330_irq_orgate[i]; |
44 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v6_cp_reginfo[] = { | 182 | |
45 | { .name = "CPACR", .state = ARM_CP_STATE_BOTH, .opc0 = 3, | 183 | object_initialize_child(obj, name, orgate, TYPE_OR_IRQ); |
46 | .crn = 1, .crm = 0, .opc1 = 0, .opc2 = 2, .accessfn = cpacr_access, | 184 | g_free(name); |
47 | .access = PL1_RW, .fieldoffset = offsetof(CPUARMState, cp15.cpacr_el1), | 185 | diff --git a/hw/arm/mps2-tz.c b/hw/arm/mps2-tz.c |
48 | - .resetvalue = 0, .writefn = cpacr_write }, | 186 | index XXXXXXX..XXXXXXX 100644 |
49 | + .resetfn = cpacr_reset, .writefn = cpacr_write }, | 187 | --- a/hw/arm/mps2-tz.c |
50 | REGINFO_SENTINEL | 188 | +++ b/hw/arm/mps2-tz.c |
189 | @@ -XXX,XX +XXX,XX @@ struct MPS2TZMachineState { | ||
190 | TZMSC msc[4]; | ||
191 | CMSDKAPBUART uart[6]; | ||
192 | SplitIRQ sec_resp_splitter; | ||
193 | - qemu_or_irq uart_irq_orgate; | ||
194 | + OrIRQState uart_irq_orgate; | ||
195 | DeviceState *lan9118; | ||
196 | SplitIRQ cpu_irq_splitter[MPS2TZ_NUMIRQ_MAX]; | ||
197 | Clock *sysclk; | ||
198 | diff --git a/hw/core/or-irq.c b/hw/core/or-irq.c | ||
199 | index XXXXXXX..XXXXXXX 100644 | ||
200 | --- a/hw/core/or-irq.c | ||
201 | +++ b/hw/core/or-irq.c | ||
202 | @@ -XXX,XX +XXX,XX @@ | ||
203 | |||
204 | static void or_irq_handler(void *opaque, int n, int level) | ||
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 = { | ||
51 | }; | 266 | }; |
52 | 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; | ||
53 | -- | 296 | -- |
54 | 2.17.1 | 297 | 2.34.1 |
55 | 298 | ||
56 | 299 | diff view generated by jsdifflib |