1
target-arm queue. This has the "plumb txattrs through various
1
The following changes since commit 4cc10cae64c51e17844dc4358481c393d7bf1ed4:
2
bits of exec.c" patches, and a collection of bug fixes from
3
various people.
4
2
5
thanks
3
Merge remote-tracking branch 'remotes/bonzini-gitlab/tags/for-upstream' into staging (2021-05-06 18:56:17 +0100)
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 tags/pull-target-arm-20210510
17
8
18
for you to fetch changes up to 49d1dca0520ea71bc21867fab6647f474fcf857b:
9
for you to fetch changes up to 8f96812baa53005f32aece3e30b140826c20aa19:
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/arm/xlnx: Fix PHY address for xilinx-zynq-a9 (2021-05-10 13:24:09 +0100)
21
12
22
----------------------------------------------------------------
13
----------------------------------------------------------------
23
target-arm queue:
14
target-arm queue:
24
* target/arm: Honour FPCR.FZ in FRECPX
15
* docs: fix link in sbsa description
25
* MAINTAINERS: Add entries for newer MPS2 boards and devices
16
* linux-user/aarch64: Enable hwcap for RND, BTI, and MTE
26
* hw/intc/arm_gicv3: Fix APxR<n> register dispatching
17
* target/arm: Fix tlbbits calculation in tlbi_aa64_vae2is_write()
27
* arm_gicv3_kvm: fix bug in writing zero bits back to the in-kernel
18
* target/arm: Split neon and vfp translation to their own
28
GIC state
19
compilation units
29
* tcg: Fix helper function vs host abi for float16
20
* target/arm: Make WFI a NOP for userspace emulators
30
* arm: fix qemu crash on startup with -bios option
21
* hw/sd/omap_mmc: Use device_cold_reset() instead of
31
* arm: fix malloc type mismatch
22
device_legacy_reset()
32
* xlnx-zdma: Correct mem leaks and memset to zero on desc unaligned errors
23
* include: More fixes for 'extern "C"' block use
33
* Correct CPACR reset value for v7 cores
24
* hw/arm/imx25_pdk: Fix error message for invalid RAM size
34
* memory.h: Improve IOMMU related documentation
25
* hw/arm/mps2-tz: Implement AN524 memory remapping via machine property
35
* exec: Plumb transaction attributes through various functions in
26
* hw/arm/xlnx: Fix PHY address for xilinx-zynq-a9
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
27
41
----------------------------------------------------------------
28
----------------------------------------------------------------
42
Francisco Iglesias (1):
29
Alex Bennée (1):
43
xlnx-zdma: Correct mem leaks and memset to zero on desc unaligned errors
30
docs: fix link in sbsa description
44
31
45
Igor Mammedov (1):
32
Guenter Roeck (1):
46
arm: fix qemu crash on startup with -bios option
33
hw/arm/xlnx: Fix PHY address for xilinx-zynq-a9
47
34
48
Jan Kiszka (1):
35
Peter Maydell (22):
49
hw/intc/arm_gicv3: Fix APxR<n> register dispatching
36
target/arm: Fix tlbbits calculation in tlbi_aa64_vae2is_write()
37
target/arm: Move constant expanders to translate.h
38
target/arm: Share unallocated_encoding() and gen_exception_insn()
39
target/arm: Make functions used by m-nocp global
40
target/arm: Split m-nocp trans functions into their own file
41
target/arm: Move gen_aa32 functions to translate-a32.h
42
target/arm: Move vfp_{load, store}_reg{32, 64} to translate-vfp.c.inc
43
target/arm: Make functions used by translate-vfp global
44
target/arm: Make translate-vfp.c.inc its own compilation unit
45
target/arm: Move vfp_reg_ptr() to translate-neon.c.inc
46
target/arm: Delete unused typedef
47
target/arm: Move NeonGenThreeOpEnvFn typedef to translate.h
48
target/arm: Make functions used by translate-neon global
49
target/arm: Make translate-neon.c.inc its own compilation unit
50
target/arm: Make WFI a NOP for userspace emulators
51
hw/sd/omap_mmc: Use device_cold_reset() instead of device_legacy_reset()
52
osdep: Make os-win32.h and os-posix.h handle 'extern "C"' themselves
53
include/qemu/bswap.h: Handle being included outside extern "C" block
54
include/disas/dis-asm.h: Handle being included outside 'extern "C"'
55
hw/misc/mps2-scc: Add "QEMU interface" comment
56
hw/misc/mps2-scc: Support using CFG0 bit 0 for remapping
57
hw/arm/mps2-tz: Implement AN524 memory remapping via machine property
50
58
51
Paolo Bonzini (1):
59
Philippe Mathieu-Daudé (1):
52
arm: fix malloc type mismatch
60
hw/arm/imx25_pdk: Fix error message for invalid RAM size
53
54
Peter Maydell (17):
55
target/arm: Honour FPCR.FZ in FRECPX
56
MAINTAINERS: Add entries for newer MPS2 boards and devices
57
Correct CPACR reset value for v7 cores
58
memory.h: Improve IOMMU related documentation
59
Make tb_invalidate_phys_addr() take a MemTxAttrs argument
60
Make address_space_translate{, _cached}() take a MemTxAttrs argument
61
Make address_space_map() take a MemTxAttrs argument
62
Make address_space_access_valid() take a MemTxAttrs argument
63
Make flatview_extend_translation() take a MemTxAttrs argument
64
Make memory_region_access_valid() take a MemTxAttrs argument
65
Make MemoryRegion valid.accepts callback take a MemTxAttrs argument
66
Make flatview_access_valid() take a MemTxAttrs argument
67
Make flatview_translate() take a MemTxAttrs argument
68
Make address_space_get_iotlb_entry() take a MemTxAttrs argument
69
Make flatview_do_translate() take a MemTxAttrs argument
70
Make address_space_translate_iommu take a MemTxAttrs argument
71
vmstate.h: Provide VMSTATE_BOOL_SUB_ARRAY
72
61
73
Richard Henderson (1):
62
Richard Henderson (1):
74
tcg: Fix helper function vs host abi for float16
63
linux-user/aarch64: Enable hwcap for RND, BTI, and MTE
75
64
76
Shannon Zhao (3):
65
docs/system/arm/mps2.rst | 10 +
77
arm_gicv3_kvm: increase clroffset accordingly
66
docs/system/arm/sbsa.rst | 2 +-
78
ARM: ACPI: Fix use-after-free due to memory realloc
67
include/disas/dis-asm.h | 12 +-
79
KVM: GIC: Fix memory leak due to calling kvm_init_irq_routing twice
68
include/hw/misc/mps2-scc.h | 21 ++
69
include/qemu/bswap.h | 26 ++-
70
include/qemu/osdep.h | 8 +-
71
include/sysemu/os-posix.h | 8 +
72
include/sysemu/os-win32.h | 8 +
73
target/arm/translate-a32.h | 144 +++++++++++++
74
target/arm/translate-a64.h | 2 -
75
target/arm/translate.h | 29 +++
76
hw/arm/imx25_pdk.c | 5 +-
77
hw/arm/mps2-tz.c | 108 +++++++++-
78
hw/arm/xilinx_zynq.c | 2 +-
79
hw/misc/mps2-scc.c | 13 +-
80
hw/sd/omap_mmc.c | 2 +-
81
linux-user/elfload.c | 13 ++
82
target/arm/helper.c | 2 +-
83
target/arm/op_helper.c | 12 ++
84
target/arm/translate-a64.c | 15 --
85
target/arm/translate-m-nocp.c | 221 ++++++++++++++++++++
86
.../arm/{translate-neon.c.inc => translate-neon.c} | 19 +-
87
.../arm/{translate-vfp.c.inc => translate-vfp.c} | 230 +++------------------
88
target/arm/translate.c | 200 ++++--------------
89
disas/arm-a64.cc | 2 -
90
disas/nanomips.cpp | 2 -
91
target/arm/meson.build | 15 +-
92
27 files changed, 718 insertions(+), 413 deletions(-)
93
create mode 100644 target/arm/translate-a32.h
94
create mode 100644 target/arm/translate-m-nocp.c
95
rename target/arm/{translate-neon.c.inc => translate-neon.c} (99%)
96
rename target/arm/{translate-vfp.c.inc => translate-vfp.c} (94%)
80
97
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
From: Francisco Iglesias <frasse.iglesias@gmail.com>
1
From: Alex Bennée <alex.bennee@linaro.org>
2
2
3
Coverity found that the string return by 'object_get_canonical_path' was not
3
A trailing _ makes all the difference to the rendered link.
4
being freed at two locations in the model (CID 1391294 and CID 1391293) and
5
also that a memset was being called with a value greater than the max of a byte
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
4
10
Signed-off-by: Francisco Iglesias <frasse.iglesias@gmail.com>
5
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
11
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
6
Message-id: 20210428131316.31390-1-alex.bennee@linaro.org
12
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
13
Message-id: 20180528184859.3530-1-frasse.iglesias@gmail.com
14
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
7
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
15
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
16
---
9
---
17
hw/dma/xlnx-zdma.c | 10 +++++++---
10
docs/system/arm/sbsa.rst | 2 +-
18
1 file changed, 7 insertions(+), 3 deletions(-)
11
1 file changed, 1 insertion(+), 1 deletion(-)
19
12
20
diff --git a/hw/dma/xlnx-zdma.c b/hw/dma/xlnx-zdma.c
13
diff --git a/docs/system/arm/sbsa.rst b/docs/system/arm/sbsa.rst
21
index XXXXXXX..XXXXXXX 100644
14
index XXXXXXX..XXXXXXX 100644
22
--- a/hw/dma/xlnx-zdma.c
15
--- a/docs/system/arm/sbsa.rst
23
+++ b/hw/dma/xlnx-zdma.c
16
+++ b/docs/system/arm/sbsa.rst
24
@@ -XXX,XX +XXX,XX @@ static bool zdma_load_descriptor(XlnxZDMA *s, uint64_t addr, void *buf)
17
@@ -XXX,XX +XXX,XX @@ Arm Server Base System Architecture Reference board (``sbsa-ref``)
25
qemu_log_mask(LOG_GUEST_ERROR,
18
While the `virt` board is a generic board platform that doesn't match
26
"zdma: unaligned descriptor at %" PRIx64,
19
any real hardware the `sbsa-ref` board intends to look like real
27
addr);
20
hardware. The `Server Base System Architecture
28
- memset(buf, 0xdeadbeef, sizeof(XlnxZDMADescr));
21
-<https://developer.arm.com/documentation/den0029/latest>` defines a
29
+ memset(buf, 0x0, sizeof(XlnxZDMADescr));
22
+<https://developer.arm.com/documentation/den0029/latest>`_ defines a
30
s->error = true;
23
minimum base line of hardware support and importantly how the firmware
31
return false;
24
reports that to any operating system. It is a static system that
32
}
25
reports a very minimal DT to the firmware for non-discoverable
33
@@ -XXX,XX +XXX,XX @@ static uint64_t zdma_read(void *opaque, hwaddr addr, unsigned size)
34
RegisterInfo *r = &s->regs_info[addr / 4];
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
--
26
--
60
2.17.1
27
2.20.1
61
28
62
29
diff view generated by jsdifflib
1
From: Igor Mammedov <imammedo@redhat.com>
1
From: Richard Henderson <richard.henderson@linaro.org>
2
2
3
When QEMU is started with following CLI
3
These three features are already enabled by TCG, but are missing
4
-machine virt,gic-version=3,accel=kvm -cpu host -bios AAVMF_CODE.fd
4
their hwcap bits. Update HWCAP2 from linux v5.12.
5
it crashes with abort at
6
accel/kvm/kvm-all.c:2164:
7
KVM_SET_DEVICE_ATTR failed: Group 6 attr 0x000000000000c665: Invalid argument
8
5
9
Which is caused by implicit dependency of kvm_arm_gicv3_reset() on
6
Cc: qemu-stable@nongnu.org (for 6.0.1)
10
arm_gicv3_icc_reset() where the later is called by CPU reset
7
Buglink: https://bugs.launchpad.net/bugs/1926044
11
reset callback.
8
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
12
9
Message-id: 20210427214108.88503-1-richard.henderson@linaro.org
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>
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
42
---
11
---
43
hw/arm/boot.c | 18 +++++++++---------
12
linux-user/elfload.c | 13 +++++++++++++
44
1 file changed, 9 insertions(+), 9 deletions(-)
13
1 file changed, 13 insertions(+)
45
14
46
diff --git a/hw/arm/boot.c b/hw/arm/boot.c
15
diff --git a/linux-user/elfload.c b/linux-user/elfload.c
47
index XXXXXXX..XXXXXXX 100644
16
index XXXXXXX..XXXXXXX 100644
48
--- a/hw/arm/boot.c
17
--- a/linux-user/elfload.c
49
+++ b/hw/arm/boot.c
18
+++ b/linux-user/elfload.c
50
@@ -XXX,XX +XXX,XX @@ void arm_load_kernel(ARMCPU *cpu, struct arm_boot_info *info)
19
@@ -XXX,XX +XXX,XX @@ enum {
51
static const ARMInsnFixup *primary_loader;
20
ARM_HWCAP2_A64_SVESM4 = 1 << 6,
52
AddressSpace *as = arm_boot_address_space(cpu, info);
21
ARM_HWCAP2_A64_FLAGM2 = 1 << 7,
53
22
ARM_HWCAP2_A64_FRINT = 1 << 8,
54
+ /* CPU objects (unlike devices) are not automatically reset on system
23
+ ARM_HWCAP2_A64_SVEI8MM = 1 << 9,
55
+ * reset, so we must always register a handler to do so. If we're
24
+ ARM_HWCAP2_A64_SVEF32MM = 1 << 10,
56
+ * actually loading a kernel, the handler is also responsible for
25
+ ARM_HWCAP2_A64_SVEF64MM = 1 << 11,
57
+ * arranging that we start it correctly.
26
+ ARM_HWCAP2_A64_SVEBF16 = 1 << 12,
58
+ */
27
+ ARM_HWCAP2_A64_I8MM = 1 << 13,
59
+ for (cs = first_cpu; cs; cs = CPU_NEXT(cs)) {
28
+ ARM_HWCAP2_A64_BF16 = 1 << 14,
60
+ qemu_register_reset(do_cpu_reset, ARM_CPU(cs));
29
+ ARM_HWCAP2_A64_DGH = 1 << 15,
61
+ }
30
+ ARM_HWCAP2_A64_RNG = 1 << 16,
62
+
31
+ ARM_HWCAP2_A64_BTI = 1 << 17,
63
/* The board code is not supposed to set secure_board_setup unless
32
+ ARM_HWCAP2_A64_MTE = 1 << 18,
64
* running its code in secure mode is actually possible, and KVM
33
};
65
* doesn't support secure.
34
66
@@ -XXX,XX +XXX,XX @@ void arm_load_kernel(ARMCPU *cpu, struct arm_boot_info *info)
35
#define ELF_HWCAP get_elf_hwcap()
67
ARM_CPU(cs)->env.boot_info = info;
36
@@ -XXX,XX +XXX,XX @@ static uint32_t get_elf_hwcap2(void)
68
}
37
GET_FEATURE_ID(aa64_dcpodp, ARM_HWCAP2_A64_DCPODP);
69
38
GET_FEATURE_ID(aa64_condm_5, ARM_HWCAP2_A64_FLAGM2);
70
- /* CPU objects (unlike devices) are not automatically reset on system
39
GET_FEATURE_ID(aa64_frint, ARM_HWCAP2_A64_FRINT);
71
- * reset, so we must always register a handler to do so. If we're
40
+ GET_FEATURE_ID(aa64_rndr, ARM_HWCAP2_A64_RNG);
72
- * actually loading a kernel, the handler is also responsible for
41
+ GET_FEATURE_ID(aa64_bti, ARM_HWCAP2_A64_BTI);
73
- * arranging that we start it correctly.
42
+ GET_FEATURE_ID(aa64_mte, ARM_HWCAP2_A64_MTE);
74
- */
43
75
- for (cs = first_cpu; cs; cs = CPU_NEXT(cs)) {
44
return hwcaps;
76
- qemu_register_reset(do_cpu_reset, ARM_CPU(cs));
45
}
77
- }
78
-
79
if (!info->skip_dtb_autoload && have_dtb(info)) {
80
if (arm_load_dtb(info->dtb_start, info, info->dtb_limit, as) < 0) {
81
exit(1);
82
--
46
--
83
2.17.1
47
2.20.1
84
48
85
49
diff view generated by jsdifflib
1
In commit f0aff255700 we made cpacr_write() enforce that some CPACR
1
In tlbi_aa64_vae2is_write() the calculation
2
bits are RAZ/WI and some are RAO/WI for ARMv7 cores. Unfortunately
2
bits = tlbbits_for_regime(env, secure ? ARMMMUIdx_E2 : ARMMMUIdx_SE2,
3
we forgot to also update the register's reset value. The effect
3
pageaddr)
4
was that (a) a guest that read CPACR on reset would not see ones in
5
the RAO bits, and (b) if you did a migration before the guest did
6
a write to the CPACR then the migration would fail because the
7
destination would enforce the RAO bits and then complain that they
8
didn't match the zero value from the source.
9
4
10
Implement reset for the CPACR using a custom reset function
5
has the two arms of the ?: expression reversed. Fix the bug.
11
that just calls cpacr_write(), to avoid having to duplicate
12
the logic for which bits are RAO.
13
6
14
This bug would affect migration for TCG CPUs which are ARMv7
7
Fixes: b6ad6062f1e5
15
with VFP but without one of Neon or VFPv3.
8
Reported-by: Rebecca Cran <rebecca@nuviainc.com>
16
17
Reported-by: Cédric Le Goater <clg@kaod.org>
18
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
19
Tested-by: Cédric Le Goater <clg@kaod.org>
10
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
20
Message-id: 20180522173713.26282-1-peter.maydell@linaro.org
11
Reviewed-by: Rémi Denis-Courmont <remi.denis.courmont@huawei.com>
12
Reviewed-by: Rebecca Cran <rebecca@nuviainc.com>
13
Message-id: 20210420123106.10861-1-peter.maydell@linaro.org
21
---
14
---
22
target/arm/helper.c | 10 +++++++++-
15
target/arm/helper.c | 2 +-
23
1 file changed, 9 insertions(+), 1 deletion(-)
16
1 file changed, 1 insertion(+), 1 deletion(-)
24
17
25
diff --git a/target/arm/helper.c b/target/arm/helper.c
18
diff --git a/target/arm/helper.c b/target/arm/helper.c
26
index XXXXXXX..XXXXXXX 100644
19
index XXXXXXX..XXXXXXX 100644
27
--- a/target/arm/helper.c
20
--- a/target/arm/helper.c
28
+++ b/target/arm/helper.c
21
+++ b/target/arm/helper.c
29
@@ -XXX,XX +XXX,XX @@ static void cpacr_write(CPUARMState *env, const ARMCPRegInfo *ri,
22
@@ -XXX,XX +XXX,XX @@ static void tlbi_aa64_vae2is_write(CPUARMState *env, const ARMCPRegInfo *ri,
30
env->cp15.cpacr_el1 = value;
23
uint64_t pageaddr = sextract64(value << 12, 0, 56);
31
}
24
bool secure = arm_is_secure_below_el3(env);
32
25
int mask = secure ? ARMMMUIdxBit_SE2 : ARMMMUIdxBit_E2;
33
+static void cpacr_reset(CPUARMState *env, const ARMCPRegInfo *ri)
26
- int bits = tlbbits_for_regime(env, secure ? ARMMMUIdx_E2 : ARMMMUIdx_SE2,
34
+{
27
+ int bits = tlbbits_for_regime(env, secure ? ARMMMUIdx_SE2 : ARMMMUIdx_E2,
35
+ /* Call cpacr_write() so that we reset with the correct RAO bits set
28
pageaddr);
36
+ * for our CPU features.
29
37
+ */
30
tlb_flush_page_bits_by_mmuidx_all_cpus_synced(cs, pageaddr, mask, bits);
38
+ cpacr_write(env, ri, 0);
39
+}
40
+
41
static CPAccessResult cpacr_access(CPUARMState *env, const ARMCPRegInfo *ri,
42
bool isread)
43
{
44
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v6_cp_reginfo[] = {
45
{ .name = "CPACR", .state = ARM_CP_STATE_BOTH, .opc0 = 3,
46
.crn = 1, .crm = 0, .opc1 = 0, .opc2 = 2, .accessfn = cpacr_access,
47
.access = PL1_RW, .fieldoffset = offsetof(CPUARMState, cp15.cpacr_el1),
48
- .resetvalue = 0, .writefn = cpacr_write },
49
+ .resetfn = cpacr_reset, .writefn = cpacr_write },
50
REGINFO_SENTINEL
51
};
52
53
--
31
--
54
2.17.1
32
2.20.1
55
33
56
34
diff view generated by jsdifflib
1
From: Shannon Zhao <zhaoshenglong@huawei.com>
1
Some of the constant expanders defined in translate.c are generically
2
useful and will be used by the separate C files for VFP and Neon once
3
they are created; move the expander definitions to translate.h.
2
4
3
It forgot to increase clroffset during the loop. So it only clear the
5
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4
first 4 bytes.
6
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
7
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
8
Message-id: 20210430132740.10391-2-peter.maydell@linaro.org
9
---
10
target/arm/translate.h | 24 ++++++++++++++++++++++++
11
target/arm/translate.c | 24 ------------------------
12
2 files changed, 24 insertions(+), 24 deletions(-)
5
13
6
Fixes: 367b9f527becdd20ddf116e17a3c0c2bbc486920
14
diff --git a/target/arm/translate.h b/target/arm/translate.h
7
Cc: qemu-stable@nongnu.org
8
Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com>
9
Reviewed-by: Eric Auger <eric.auger@redhat.com>
10
Message-id: 1527047633-12368-1-git-send-email-zhaoshenglong@huawei.com
11
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
---
14
hw/intc/arm_gicv3_kvm.c | 1 +
15
1 file changed, 1 insertion(+)
16
17
diff --git a/hw/intc/arm_gicv3_kvm.c b/hw/intc/arm_gicv3_kvm.c
18
index XXXXXXX..XXXXXXX 100644
15
index XXXXXXX..XXXXXXX 100644
19
--- a/hw/intc/arm_gicv3_kvm.c
16
--- a/target/arm/translate.h
20
+++ b/hw/intc/arm_gicv3_kvm.c
17
+++ b/target/arm/translate.h
21
@@ -XXX,XX +XXX,XX @@ static void kvm_dist_putbmp(GICv3State *s, uint32_t offset,
18
@@ -XXX,XX +XXX,XX @@ extern TCGv_i32 cpu_NF, cpu_ZF, cpu_CF, cpu_VF;
22
if (clroffset != 0) {
19
extern TCGv_i64 cpu_exclusive_addr;
23
reg = 0;
20
extern TCGv_i64 cpu_exclusive_val;
24
kvm_gicd_access(s, clroffset, &reg, true);
21
25
+ clroffset += 4;
22
+/*
26
}
23
+ * Constant expanders for the decoders.
27
reg = *gic_bmp_ptr32(bmp, irq);
24
+ */
28
kvm_gicd_access(s, offset, &reg, true);
25
+
26
+static inline int negate(DisasContext *s, int x)
27
+{
28
+ return -x;
29
+}
30
+
31
+static inline int plus_2(DisasContext *s, int x)
32
+{
33
+ return x + 2;
34
+}
35
+
36
+static inline int times_2(DisasContext *s, int x)
37
+{
38
+ return x * 2;
39
+}
40
+
41
+static inline int times_4(DisasContext *s, int x)
42
+{
43
+ return x * 4;
44
+}
45
+
46
static inline int arm_dc_feature(DisasContext *dc, int feature)
47
{
48
return (dc->features & (1ULL << feature)) != 0;
49
diff --git a/target/arm/translate.c b/target/arm/translate.c
50
index XXXXXXX..XXXXXXX 100644
51
--- a/target/arm/translate.c
52
+++ b/target/arm/translate.c
53
@@ -XXX,XX +XXX,XX @@ static void arm_gen_condlabel(DisasContext *s)
54
}
55
}
56
57
-/*
58
- * Constant expanders for the decoders.
59
- */
60
-
61
-static int negate(DisasContext *s, int x)
62
-{
63
- return -x;
64
-}
65
-
66
-static int plus_2(DisasContext *s, int x)
67
-{
68
- return x + 2;
69
-}
70
-
71
-static int times_2(DisasContext *s, int x)
72
-{
73
- return x * 2;
74
-}
75
-
76
-static int times_4(DisasContext *s, int x)
77
-{
78
- return x * 4;
79
-}
80
-
81
/* Flags for the disas_set_da_iss info argument:
82
* lower bits hold the Rt register number, higher bits are flags.
83
*/
29
--
84
--
30
2.17.1
85
2.20.1
31
86
32
87
diff view generated by jsdifflib
1
As part of plumbing MemTxAttrs down to the IOMMU translate method,
1
The unallocated_encoding() function is the same in both
2
add MemTxAttrs as an argument to tb_invalidate_phys_addr().
2
translate-a64.c and translate.c; make the translate.c function global
3
Its callers either have an attrs value to hand, or don't care
3
and drop the translate-a64.c version. To do this we need to also
4
and can use MEMTXATTRS_UNSPECIFIED.
4
share gen_exception_insn(), which currently exists in two slightly
5
different versions for A32 and A64: merge those into a single
6
function that can work for both.
7
8
This will be useful for splitting up translate.c, which will require
9
unallocated_encoding() to no longer be file-local. It's also
10
hopefully less confusing to have only one version of the function
11
rather than two.
5
12
6
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
14
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
8
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
15
Message-id: 20210430132740.10391-3-peter.maydell@linaro.org
9
Message-id: 20180521140402.23318-3-peter.maydell@linaro.org
10
---
16
---
11
include/exec/exec-all.h | 5 +++--
17
target/arm/translate-a64.h | 2 --
12
accel/tcg/translate-all.c | 2 +-
18
target/arm/translate.h | 3 +++
13
exec.c | 2 +-
19
target/arm/translate-a64.c | 15 ---------------
14
target/xtensa/op_helper.c | 3 ++-
20
target/arm/translate.c | 14 +++++++++-----
15
4 files changed, 7 insertions(+), 5 deletions(-)
21
4 files changed, 12 insertions(+), 22 deletions(-)
16
22
17
diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h
23
diff --git a/target/arm/translate-a64.h b/target/arm/translate-a64.h
18
index XXXXXXX..XXXXXXX 100644
24
index XXXXXXX..XXXXXXX 100644
19
--- a/include/exec/exec-all.h
25
--- a/target/arm/translate-a64.h
20
+++ b/include/exec/exec-all.h
26
+++ b/target/arm/translate-a64.h
21
@@ -XXX,XX +XXX,XX @@ void tlb_set_page_with_attrs(CPUState *cpu, target_ulong vaddr,
27
@@ -XXX,XX +XXX,XX @@
22
void tlb_set_page(CPUState *cpu, target_ulong vaddr,
28
#ifndef TARGET_ARM_TRANSLATE_A64_H
23
hwaddr paddr, int prot,
29
#define TARGET_ARM_TRANSLATE_A64_H
24
int mmu_idx, target_ulong size);
30
25
-void tb_invalidate_phys_addr(AddressSpace *as, hwaddr addr);
31
-void unallocated_encoding(DisasContext *s);
26
+void tb_invalidate_phys_addr(AddressSpace *as, hwaddr addr, MemTxAttrs attrs);
32
-
27
void probe_write(CPUArchState *env, target_ulong addr, int size, int mmu_idx,
33
#define unsupported_encoding(s, insn) \
28
uintptr_t retaddr);
34
do { \
29
#else
35
qemu_log_mask(LOG_UNIMP, \
30
@@ -XXX,XX +XXX,XX @@ static inline void tlb_flush_by_mmuidx_all_cpus_synced(CPUState *cpu,
36
diff --git a/target/arm/translate.h b/target/arm/translate.h
31
uint16_t idxmap)
37
index XXXXXXX..XXXXXXX 100644
38
--- a/target/arm/translate.h
39
+++ b/target/arm/translate.h
40
@@ -XXX,XX +XXX,XX @@ void arm_free_cc(DisasCompare *cmp);
41
void arm_jump_cc(DisasCompare *cmp, TCGLabel *label);
42
void arm_gen_test_cc(int cc, TCGLabel *label);
43
MemOp pow2_align(unsigned i);
44
+void unallocated_encoding(DisasContext *s);
45
+void gen_exception_insn(DisasContext *s, uint64_t pc, int excp,
46
+ uint32_t syn, uint32_t target_el);
47
48
/* Return state of Alternate Half-precision flag, caller frees result */
49
static inline TCGv_i32 get_ahp_flag(void)
50
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
51
index XXXXXXX..XXXXXXX 100644
52
--- a/target/arm/translate-a64.c
53
+++ b/target/arm/translate-a64.c
54
@@ -XXX,XX +XXX,XX @@ static void gen_exception_internal_insn(DisasContext *s, uint64_t pc, int excp)
55
s->base.is_jmp = DISAS_NORETURN;
56
}
57
58
-static void gen_exception_insn(DisasContext *s, uint64_t pc, int excp,
59
- uint32_t syndrome, uint32_t target_el)
60
-{
61
- gen_a64_set_pc_im(pc);
62
- gen_exception(excp, syndrome, target_el);
63
- s->base.is_jmp = DISAS_NORETURN;
64
-}
65
-
66
static void gen_exception_bkpt_insn(DisasContext *s, uint32_t syndrome)
32
{
67
{
33
}
68
TCGv_i32 tcg_syn;
34
-static inline void tb_invalidate_phys_addr(AddressSpace *as, hwaddr addr)
69
@@ -XXX,XX +XXX,XX @@ static inline void gen_goto_tb(DisasContext *s, int n, uint64_t dest)
35
+static inline void tb_invalidate_phys_addr(AddressSpace *as, hwaddr addr,
36
+ MemTxAttrs attrs)
37
{
38
}
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
}
70
}
64
}
71
}
65
#endif
72
66
diff --git a/target/xtensa/op_helper.c b/target/xtensa/op_helper.c
73
-void unallocated_encoding(DisasContext *s)
74
-{
75
- /* Unallocated and reserved encodings are uncategorized */
76
- gen_exception_insn(s, s->pc_curr, EXCP_UDEF, syn_uncategorized(),
77
- default_exception_el(s));
78
-}
79
-
80
static void init_tmp_a64_array(DisasContext *s)
81
{
82
#ifdef CONFIG_DEBUG_TCG
83
diff --git a/target/arm/translate.c b/target/arm/translate.c
67
index XXXXXXX..XXXXXXX 100644
84
index XXXXXXX..XXXXXXX 100644
68
--- a/target/xtensa/op_helper.c
85
--- a/target/arm/translate.c
69
+++ b/target/xtensa/op_helper.c
86
+++ b/target/arm/translate.c
70
@@ -XXX,XX +XXX,XX @@ static void tb_invalidate_virtual_addr(CPUXtensaState *env, uint32_t vaddr)
87
@@ -XXX,XX +XXX,XX @@ static void gen_exception_internal_insn(DisasContext *s, uint32_t pc, int excp)
71
int ret = xtensa_get_physical_addr(env, false, vaddr, 2, 0,
88
s->base.is_jmp = DISAS_NORETURN;
72
&paddr, &page_size, &access);
73
if (ret == 0) {
74
- tb_invalidate_phys_addr(&address_space_memory, paddr);
75
+ tb_invalidate_phys_addr(&address_space_memory, paddr,
76
+ MEMTXATTRS_UNSPECIFIED);
77
}
78
}
89
}
79
90
91
-static void gen_exception_insn(DisasContext *s, uint32_t pc, int excp,
92
- int syn, uint32_t target_el)
93
+void gen_exception_insn(DisasContext *s, uint64_t pc, int excp,
94
+ uint32_t syn, uint32_t target_el)
95
{
96
- gen_set_condexec(s);
97
- gen_set_pc_im(s, pc);
98
+ if (s->aarch64) {
99
+ gen_a64_set_pc_im(pc);
100
+ } else {
101
+ gen_set_condexec(s);
102
+ gen_set_pc_im(s, pc);
103
+ }
104
gen_exception(excp, syn, target_el);
105
s->base.is_jmp = DISAS_NORETURN;
106
}
107
@@ -XXX,XX +XXX,XX @@ static void gen_exception_bkpt_insn(DisasContext *s, uint32_t syn)
108
s->base.is_jmp = DISAS_NORETURN;
109
}
110
111
-static void unallocated_encoding(DisasContext *s)
112
+void unallocated_encoding(DisasContext *s)
113
{
114
/* Unallocated and reserved encodings are uncategorized */
115
gen_exception_insn(s, s->pc_curr, EXCP_UDEF, syn_uncategorized(),
80
--
116
--
81
2.17.1
117
2.20.1
82
118
83
119
diff view generated by jsdifflib
New patch
1
1
We want to split out the .c.inc files which are currently included
2
into translate.c so they are separate compilation units. To do this
3
we need to make some functions which are currently file-local to
4
translate.c have global scope; create a translate-a32.h paralleling
5
the existing translate-a64.h as a place for these declarations to
6
live, so that code moved into the new compilation units can call
7
them.
8
9
The functions made global here are those required by the
10
m-nocp.decode functions, except that I have converted the whole
11
family of {read,write}_neon_element* and also both the load_cpu and
12
store_cpu functions for consistency, even though m-nocp only wants a
13
few functions from each.
14
15
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
16
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
17
Message-id: 20210430132740.10391-4-peter.maydell@linaro.org
18
---
19
target/arm/translate-a32.h | 57 ++++++++++++++++++++++++++++++++++
20
target/arm/translate.c | 39 +++++------------------
21
target/arm/translate-vfp.c.inc | 2 +-
22
3 files changed, 65 insertions(+), 33 deletions(-)
23
create mode 100644 target/arm/translate-a32.h
24
25
diff --git a/target/arm/translate-a32.h b/target/arm/translate-a32.h
26
new file mode 100644
27
index XXXXXXX..XXXXXXX
28
--- /dev/null
29
+++ b/target/arm/translate-a32.h
30
@@ -XXX,XX +XXX,XX @@
31
+/*
32
+ * AArch32 translation, common definitions.
33
+ *
34
+ * Copyright (c) 2021 Linaro, Ltd.
35
+ *
36
+ * This library is free software; you can redistribute it and/or
37
+ * modify it under the terms of the GNU Lesser General Public
38
+ * License as published by the Free Software Foundation; either
39
+ * version 2.1 of the License, or (at your option) any later version.
40
+ *
41
+ * This library is distributed in the hope that it will be useful,
42
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
43
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
44
+ * Lesser General Public License for more details.
45
+ *
46
+ * You should have received a copy of the GNU Lesser General Public
47
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
48
+ */
49
+
50
+#ifndef TARGET_ARM_TRANSLATE_A64_H
51
+#define TARGET_ARM_TRANSLATE_A64_H
52
+
53
+void load_reg_var(DisasContext *s, TCGv_i32 var, int reg);
54
+void arm_gen_condlabel(DisasContext *s);
55
+bool vfp_access_check(DisasContext *s);
56
+void read_neon_element32(TCGv_i32 dest, int reg, int ele, MemOp memop);
57
+void read_neon_element64(TCGv_i64 dest, int reg, int ele, MemOp memop);
58
+void write_neon_element32(TCGv_i32 src, int reg, int ele, MemOp memop);
59
+void write_neon_element64(TCGv_i64 src, int reg, int ele, MemOp memop);
60
+
61
+static inline TCGv_i32 load_cpu_offset(int offset)
62
+{
63
+ TCGv_i32 tmp = tcg_temp_new_i32();
64
+ tcg_gen_ld_i32(tmp, cpu_env, offset);
65
+ return tmp;
66
+}
67
+
68
+#define load_cpu_field(name) load_cpu_offset(offsetof(CPUARMState, name))
69
+
70
+static inline void store_cpu_offset(TCGv_i32 var, int offset)
71
+{
72
+ tcg_gen_st_i32(var, cpu_env, offset);
73
+ tcg_temp_free_i32(var);
74
+}
75
+
76
+#define store_cpu_field(var, name) \
77
+ store_cpu_offset(var, offsetof(CPUARMState, name))
78
+
79
+/* Create a new temporary and set it to the value of a CPU register. */
80
+static inline TCGv_i32 load_reg(DisasContext *s, int reg)
81
+{
82
+ TCGv_i32 tmp = tcg_temp_new_i32();
83
+ load_reg_var(s, tmp, reg);
84
+ return tmp;
85
+}
86
+
87
+#endif
88
diff --git a/target/arm/translate.c b/target/arm/translate.c
89
index XXXXXXX..XXXXXXX 100644
90
--- a/target/arm/translate.c
91
+++ b/target/arm/translate.c
92
@@ -XXX,XX +XXX,XX @@
93
#define ENABLE_ARCH_8 arm_dc_feature(s, ARM_FEATURE_V8)
94
95
#include "translate.h"
96
+#include "translate-a32.h"
97
98
#if defined(CONFIG_USER_ONLY)
99
#define IS_USER(s) 1
100
@@ -XXX,XX +XXX,XX @@ void arm_translate_init(void)
101
}
102
103
/* Generate a label used for skipping this instruction */
104
-static void arm_gen_condlabel(DisasContext *s)
105
+void arm_gen_condlabel(DisasContext *s)
106
{
107
if (!s->condjmp) {
108
s->condlabel = gen_new_label();
109
@@ -XXX,XX +XXX,XX @@ static inline int get_a32_user_mem_index(DisasContext *s)
110
}
111
}
112
113
-static inline TCGv_i32 load_cpu_offset(int offset)
114
-{
115
- TCGv_i32 tmp = tcg_temp_new_i32();
116
- tcg_gen_ld_i32(tmp, cpu_env, offset);
117
- return tmp;
118
-}
119
-
120
-#define load_cpu_field(name) load_cpu_offset(offsetof(CPUARMState, name))
121
-
122
-static inline void store_cpu_offset(TCGv_i32 var, int offset)
123
-{
124
- tcg_gen_st_i32(var, cpu_env, offset);
125
- tcg_temp_free_i32(var);
126
-}
127
-
128
-#define store_cpu_field(var, name) \
129
- store_cpu_offset(var, offsetof(CPUARMState, name))
130
-
131
/* The architectural value of PC. */
132
static uint32_t read_pc(DisasContext *s)
133
{
134
@@ -XXX,XX +XXX,XX @@ static uint32_t read_pc(DisasContext *s)
135
}
136
137
/* Set a variable to the value of a CPU register. */
138
-static void load_reg_var(DisasContext *s, TCGv_i32 var, int reg)
139
+void load_reg_var(DisasContext *s, TCGv_i32 var, int reg)
140
{
141
if (reg == 15) {
142
tcg_gen_movi_i32(var, read_pc(s));
143
@@ -XXX,XX +XXX,XX @@ static void load_reg_var(DisasContext *s, TCGv_i32 var, int reg)
144
}
145
}
146
147
-/* Create a new temporary and set it to the value of a CPU register. */
148
-static inline TCGv_i32 load_reg(DisasContext *s, int reg)
149
-{
150
- TCGv_i32 tmp = tcg_temp_new_i32();
151
- load_reg_var(s, tmp, reg);
152
- return tmp;
153
-}
154
-
155
/*
156
* Create a new temp, REG + OFS, except PC is ALIGN(PC, 4).
157
* This is used for load/store for which use of PC implies (literal),
158
@@ -XXX,XX +XXX,XX @@ static inline void vfp_store_reg32(TCGv_i32 var, int reg)
159
tcg_gen_st_i32(var, cpu_env, vfp_reg_offset(false, reg));
160
}
161
162
-static void read_neon_element32(TCGv_i32 dest, int reg, int ele, MemOp memop)
163
+void read_neon_element32(TCGv_i32 dest, int reg, int ele, MemOp memop)
164
{
165
long off = neon_element_offset(reg, ele, memop);
166
167
@@ -XXX,XX +XXX,XX @@ static void read_neon_element32(TCGv_i32 dest, int reg, int ele, MemOp memop)
168
}
169
}
170
171
-static void read_neon_element64(TCGv_i64 dest, int reg, int ele, MemOp memop)
172
+void read_neon_element64(TCGv_i64 dest, int reg, int ele, MemOp memop)
173
{
174
long off = neon_element_offset(reg, ele, memop);
175
176
@@ -XXX,XX +XXX,XX @@ static void read_neon_element64(TCGv_i64 dest, int reg, int ele, MemOp memop)
177
}
178
}
179
180
-static void write_neon_element32(TCGv_i32 src, int reg, int ele, MemOp memop)
181
+void write_neon_element32(TCGv_i32 src, int reg, int ele, MemOp memop)
182
{
183
long off = neon_element_offset(reg, ele, memop);
184
185
@@ -XXX,XX +XXX,XX @@ static void write_neon_element32(TCGv_i32 src, int reg, int ele, MemOp memop)
186
}
187
}
188
189
-static void write_neon_element64(TCGv_i64 src, int reg, int ele, MemOp memop)
190
+void write_neon_element64(TCGv_i64 src, int reg, int ele, MemOp memop)
191
{
192
long off = neon_element_offset(reg, ele, memop);
193
194
diff --git a/target/arm/translate-vfp.c.inc b/target/arm/translate-vfp.c.inc
195
index XXXXXXX..XXXXXXX 100644
196
--- a/target/arm/translate-vfp.c.inc
197
+++ b/target/arm/translate-vfp.c.inc
198
@@ -XXX,XX +XXX,XX @@ static bool full_vfp_access_check(DisasContext *s, bool ignore_vfp_enabled)
199
* The most usual kind of VFP access check, for everything except
200
* FMXR/FMRX to the always-available special registers.
201
*/
202
-static bool vfp_access_check(DisasContext *s)
203
+bool vfp_access_check(DisasContext *s)
204
{
205
return full_vfp_access_check(s, false);
206
}
207
--
208
2.20.1
209
210
diff view generated by jsdifflib
1
From: Jan Kiszka <jan.kiszka@siemens.com>
1
Currently the trans functions for m-nocp.decode all live in
2
translate-vfp.inc.c; move them out into their own translation unit,
3
translate-m-nocp.c.
2
4
3
There was a nasty flip in identifying which register group an access is
5
The trans_* functions here are pure code motion with no changes.
4
targeting. The issue caused spuriously raised priorities of the guest
5
when handing CPUs over in the Jailhouse hypervisor.
6
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>
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
9
Message-id: 20210430132740.10391-5-peter.maydell@linaro.org
12
---
10
---
13
hw/intc/arm_gicv3_cpuif.c | 12 ++++++------
11
target/arm/translate-a32.h | 3 +
14
1 file changed, 6 insertions(+), 6 deletions(-)
12
target/arm/translate-m-nocp.c | 221 +++++++++++++++++++++++++++++++++
13
target/arm/translate.c | 1 -
14
target/arm/translate-vfp.c.inc | 196 -----------------------------
15
target/arm/meson.build | 3 +-
16
5 files changed, 226 insertions(+), 198 deletions(-)
17
create mode 100644 target/arm/translate-m-nocp.c
15
18
16
diff --git a/hw/intc/arm_gicv3_cpuif.c b/hw/intc/arm_gicv3_cpuif.c
19
diff --git a/target/arm/translate-a32.h b/target/arm/translate-a32.h
17
index XXXXXXX..XXXXXXX 100644
20
index XXXXXXX..XXXXXXX 100644
18
--- a/hw/intc/arm_gicv3_cpuif.c
21
--- a/target/arm/translate-a32.h
19
+++ b/hw/intc/arm_gicv3_cpuif.c
22
+++ b/target/arm/translate-a32.h
20
@@ -XXX,XX +XXX,XX @@ static uint64_t icv_ap_read(CPUARMState *env, const ARMCPRegInfo *ri)
23
@@ -XXX,XX +XXX,XX @@
24
#ifndef TARGET_ARM_TRANSLATE_A64_H
25
#define TARGET_ARM_TRANSLATE_A64_H
26
27
+/* Prototypes for autogenerated disassembler functions */
28
+bool disas_m_nocp(DisasContext *dc, uint32_t insn);
29
+
30
void load_reg_var(DisasContext *s, TCGv_i32 var, int reg);
31
void arm_gen_condlabel(DisasContext *s);
32
bool vfp_access_check(DisasContext *s);
33
diff --git a/target/arm/translate-m-nocp.c b/target/arm/translate-m-nocp.c
34
new file mode 100644
35
index XXXXXXX..XXXXXXX
36
--- /dev/null
37
+++ b/target/arm/translate-m-nocp.c
38
@@ -XXX,XX +XXX,XX @@
39
+/*
40
+ * ARM translation: M-profile NOCP special-case instructions
41
+ *
42
+ * Copyright (c) 2020 Linaro, Ltd.
43
+ *
44
+ * This library is free software; you can redistribute it and/or
45
+ * modify it under the terms of the GNU Lesser General Public
46
+ * License as published by the Free Software Foundation; either
47
+ * version 2.1 of the License, or (at your option) any later version.
48
+ *
49
+ * This library is distributed in the hope that it will be useful,
50
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
51
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
52
+ * Lesser General Public License for more details.
53
+ *
54
+ * You should have received a copy of the GNU Lesser General Public
55
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
56
+ */
57
+
58
+#include "qemu/osdep.h"
59
+#include "tcg/tcg-op.h"
60
+#include "translate.h"
61
+#include "translate-a32.h"
62
+
63
+#include "decode-m-nocp.c.inc"
64
+
65
+/*
66
+ * Decode VLLDM and VLSTM are nonstandard because:
67
+ * * if there is no FPU then these insns must NOP in
68
+ * Secure state and UNDEF in Nonsecure state
69
+ * * if there is an FPU then these insns do not have
70
+ * the usual behaviour that vfp_access_check() provides of
71
+ * being controlled by CPACR/NSACR enable bits or the
72
+ * lazy-stacking logic.
73
+ */
74
+static bool trans_VLLDM_VLSTM(DisasContext *s, arg_VLLDM_VLSTM *a)
75
+{
76
+ TCGv_i32 fptr;
77
+
78
+ if (!arm_dc_feature(s, ARM_FEATURE_M) ||
79
+ !arm_dc_feature(s, ARM_FEATURE_V8)) {
80
+ return false;
81
+ }
82
+
83
+ if (a->op) {
84
+ /*
85
+ * T2 encoding ({D0-D31} reglist): v8.1M and up. We choose not
86
+ * to take the IMPDEF option to make memory accesses to the stack
87
+ * slots that correspond to the D16-D31 registers (discarding
88
+ * read data and writing UNKNOWN values), so for us the T2
89
+ * encoding behaves identically to the T1 encoding.
90
+ */
91
+ if (!arm_dc_feature(s, ARM_FEATURE_V8_1M)) {
92
+ return false;
93
+ }
94
+ } else {
95
+ /*
96
+ * T1 encoding ({D0-D15} reglist); undef if we have 32 Dregs.
97
+ * This is currently architecturally impossible, but we add the
98
+ * check to stay in line with the pseudocode. Note that we must
99
+ * emit code for the UNDEF so it takes precedence over the NOCP.
100
+ */
101
+ if (dc_isar_feature(aa32_simd_r32, s)) {
102
+ unallocated_encoding(s);
103
+ return true;
104
+ }
105
+ }
106
+
107
+ /*
108
+ * If not secure, UNDEF. We must emit code for this
109
+ * rather than returning false so that this takes
110
+ * precedence over the m-nocp.decode NOCP fallback.
111
+ */
112
+ if (!s->v8m_secure) {
113
+ unallocated_encoding(s);
114
+ return true;
115
+ }
116
+ /* If no fpu, NOP. */
117
+ if (!dc_isar_feature(aa32_vfp, s)) {
118
+ return true;
119
+ }
120
+
121
+ fptr = load_reg(s, a->rn);
122
+ if (a->l) {
123
+ gen_helper_v7m_vlldm(cpu_env, fptr);
124
+ } else {
125
+ gen_helper_v7m_vlstm(cpu_env, fptr);
126
+ }
127
+ tcg_temp_free_i32(fptr);
128
+
129
+ /* End the TB, because we have updated FP control bits */
130
+ s->base.is_jmp = DISAS_UPDATE_EXIT;
131
+ return true;
132
+}
133
+
134
+static bool trans_VSCCLRM(DisasContext *s, arg_VSCCLRM *a)
135
+{
136
+ int btmreg, topreg;
137
+ TCGv_i64 zero;
138
+ TCGv_i32 aspen, sfpa;
139
+
140
+ if (!dc_isar_feature(aa32_m_sec_state, s)) {
141
+ /* Before v8.1M, fall through in decode to NOCP check */
142
+ return false;
143
+ }
144
+
145
+ /* Explicitly UNDEF because this takes precedence over NOCP */
146
+ if (!arm_dc_feature(s, ARM_FEATURE_M_MAIN) || !s->v8m_secure) {
147
+ unallocated_encoding(s);
148
+ return true;
149
+ }
150
+
151
+ if (!dc_isar_feature(aa32_vfp_simd, s)) {
152
+ /* NOP if we have neither FP nor MVE */
153
+ return true;
154
+ }
155
+
156
+ /*
157
+ * If FPCCR.ASPEN != 0 && CONTROL_S.SFPA == 0 then there is no
158
+ * active floating point context so we must NOP (without doing
159
+ * any lazy state preservation or the NOCP check).
160
+ */
161
+ aspen = load_cpu_field(v7m.fpccr[M_REG_S]);
162
+ sfpa = load_cpu_field(v7m.control[M_REG_S]);
163
+ tcg_gen_andi_i32(aspen, aspen, R_V7M_FPCCR_ASPEN_MASK);
164
+ tcg_gen_xori_i32(aspen, aspen, R_V7M_FPCCR_ASPEN_MASK);
165
+ tcg_gen_andi_i32(sfpa, sfpa, R_V7M_CONTROL_SFPA_MASK);
166
+ tcg_gen_or_i32(sfpa, sfpa, aspen);
167
+ arm_gen_condlabel(s);
168
+ tcg_gen_brcondi_i32(TCG_COND_EQ, sfpa, 0, s->condlabel);
169
+
170
+ if (s->fp_excp_el != 0) {
171
+ gen_exception_insn(s, s->pc_curr, EXCP_NOCP,
172
+ syn_uncategorized(), s->fp_excp_el);
173
+ return true;
174
+ }
175
+
176
+ topreg = a->vd + a->imm - 1;
177
+ btmreg = a->vd;
178
+
179
+ /* Convert to Sreg numbers if the insn specified in Dregs */
180
+ if (a->size == 3) {
181
+ topreg = topreg * 2 + 1;
182
+ btmreg *= 2;
183
+ }
184
+
185
+ if (topreg > 63 || (topreg > 31 && !(topreg & 1))) {
186
+ /* UNPREDICTABLE: we choose to undef */
187
+ unallocated_encoding(s);
188
+ return true;
189
+ }
190
+
191
+ /* Silently ignore requests to clear D16-D31 if they don't exist */
192
+ if (topreg > 31 && !dc_isar_feature(aa32_simd_r32, s)) {
193
+ topreg = 31;
194
+ }
195
+
196
+ if (!vfp_access_check(s)) {
197
+ return true;
198
+ }
199
+
200
+ /* Zero the Sregs from btmreg to topreg inclusive. */
201
+ zero = tcg_const_i64(0);
202
+ if (btmreg & 1) {
203
+ write_neon_element64(zero, btmreg >> 1, 1, MO_32);
204
+ btmreg++;
205
+ }
206
+ for (; btmreg + 1 <= topreg; btmreg += 2) {
207
+ write_neon_element64(zero, btmreg >> 1, 0, MO_64);
208
+ }
209
+ if (btmreg == topreg) {
210
+ write_neon_element64(zero, btmreg >> 1, 0, MO_32);
211
+ btmreg++;
212
+ }
213
+ assert(btmreg == topreg + 1);
214
+ /* TODO: when MVE is implemented, zero VPR here */
215
+ return true;
216
+}
217
+
218
+static bool trans_NOCP(DisasContext *s, arg_nocp *a)
219
+{
220
+ /*
221
+ * Handle M-profile early check for disabled coprocessor:
222
+ * all we need to do here is emit the NOCP exception if
223
+ * the coprocessor is disabled. Otherwise we return false
224
+ * and the real VFP/etc decode will handle the insn.
225
+ */
226
+ assert(arm_dc_feature(s, ARM_FEATURE_M));
227
+
228
+ if (a->cp == 11) {
229
+ a->cp = 10;
230
+ }
231
+ if (arm_dc_feature(s, ARM_FEATURE_V8_1M) &&
232
+ (a->cp == 8 || a->cp == 9 || a->cp == 14 || a->cp == 15)) {
233
+ /* in v8.1M cp 8, 9, 14, 15 also are governed by the cp10 enable */
234
+ a->cp = 10;
235
+ }
236
+
237
+ if (a->cp != 10) {
238
+ gen_exception_insn(s, s->pc_curr, EXCP_NOCP,
239
+ syn_uncategorized(), default_exception_el(s));
240
+ return true;
241
+ }
242
+
243
+ if (s->fp_excp_el != 0) {
244
+ gen_exception_insn(s, s->pc_curr, EXCP_NOCP,
245
+ syn_uncategorized(), s->fp_excp_el);
246
+ return true;
247
+ }
248
+
249
+ return false;
250
+}
251
+
252
+static bool trans_NOCP_8_1(DisasContext *s, arg_nocp *a)
253
+{
254
+ /* This range needs a coprocessor check for v8.1M and later only */
255
+ if (!arm_dc_feature(s, ARM_FEATURE_V8_1M)) {
256
+ return false;
257
+ }
258
+ return trans_NOCP(s, a);
259
+}
260
diff --git a/target/arm/translate.c b/target/arm/translate.c
261
index XXXXXXX..XXXXXXX 100644
262
--- a/target/arm/translate.c
263
+++ b/target/arm/translate.c
264
@@ -XXX,XX +XXX,XX @@ static TCGv_ptr vfp_reg_ptr(bool dp, int reg)
265
#define ARM_CP_RW_BIT (1 << 20)
266
267
/* Include the VFP and Neon decoders */
268
-#include "decode-m-nocp.c.inc"
269
#include "translate-vfp.c.inc"
270
#include "translate-neon.c.inc"
271
272
diff --git a/target/arm/translate-vfp.c.inc b/target/arm/translate-vfp.c.inc
273
index XXXXXXX..XXXXXXX 100644
274
--- a/target/arm/translate-vfp.c.inc
275
+++ b/target/arm/translate-vfp.c.inc
276
@@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_dp_int(DisasContext *s, arg_VCVT_dp_int *a)
277
return true;
278
}
279
280
-/*
281
- * Decode VLLDM and VLSTM are nonstandard because:
282
- * * if there is no FPU then these insns must NOP in
283
- * Secure state and UNDEF in Nonsecure state
284
- * * if there is an FPU then these insns do not have
285
- * the usual behaviour that vfp_access_check() provides of
286
- * being controlled by CPACR/NSACR enable bits or the
287
- * lazy-stacking logic.
288
- */
289
-static bool trans_VLLDM_VLSTM(DisasContext *s, arg_VLLDM_VLSTM *a)
290
-{
291
- TCGv_i32 fptr;
292
-
293
- if (!arm_dc_feature(s, ARM_FEATURE_M) ||
294
- !arm_dc_feature(s, ARM_FEATURE_V8)) {
295
- return false;
296
- }
297
-
298
- if (a->op) {
299
- /*
300
- * T2 encoding ({D0-D31} reglist): v8.1M and up. We choose not
301
- * to take the IMPDEF option to make memory accesses to the stack
302
- * slots that correspond to the D16-D31 registers (discarding
303
- * read data and writing UNKNOWN values), so for us the T2
304
- * encoding behaves identically to the T1 encoding.
305
- */
306
- if (!arm_dc_feature(s, ARM_FEATURE_V8_1M)) {
307
- return false;
308
- }
309
- } else {
310
- /*
311
- * T1 encoding ({D0-D15} reglist); undef if we have 32 Dregs.
312
- * This is currently architecturally impossible, but we add the
313
- * check to stay in line with the pseudocode. Note that we must
314
- * emit code for the UNDEF so it takes precedence over the NOCP.
315
- */
316
- if (dc_isar_feature(aa32_simd_r32, s)) {
317
- unallocated_encoding(s);
318
- return true;
319
- }
320
- }
321
-
322
- /*
323
- * If not secure, UNDEF. We must emit code for this
324
- * rather than returning false so that this takes
325
- * precedence over the m-nocp.decode NOCP fallback.
326
- */
327
- if (!s->v8m_secure) {
328
- unallocated_encoding(s);
329
- return true;
330
- }
331
- /* If no fpu, NOP. */
332
- if (!dc_isar_feature(aa32_vfp, s)) {
333
- return true;
334
- }
335
-
336
- fptr = load_reg(s, a->rn);
337
- if (a->l) {
338
- gen_helper_v7m_vlldm(cpu_env, fptr);
339
- } else {
340
- gen_helper_v7m_vlstm(cpu_env, fptr);
341
- }
342
- tcg_temp_free_i32(fptr);
343
-
344
- /* End the TB, because we have updated FP control bits */
345
- s->base.is_jmp = DISAS_UPDATE_EXIT;
346
- return true;
347
-}
348
-
349
-static bool trans_VSCCLRM(DisasContext *s, arg_VSCCLRM *a)
350
-{
351
- int btmreg, topreg;
352
- TCGv_i64 zero;
353
- TCGv_i32 aspen, sfpa;
354
-
355
- if (!dc_isar_feature(aa32_m_sec_state, s)) {
356
- /* Before v8.1M, fall through in decode to NOCP check */
357
- return false;
358
- }
359
-
360
- /* Explicitly UNDEF because this takes precedence over NOCP */
361
- if (!arm_dc_feature(s, ARM_FEATURE_M_MAIN) || !s->v8m_secure) {
362
- unallocated_encoding(s);
363
- return true;
364
- }
365
-
366
- if (!dc_isar_feature(aa32_vfp_simd, s)) {
367
- /* NOP if we have neither FP nor MVE */
368
- return true;
369
- }
370
-
371
- /*
372
- * If FPCCR.ASPEN != 0 && CONTROL_S.SFPA == 0 then there is no
373
- * active floating point context so we must NOP (without doing
374
- * any lazy state preservation or the NOCP check).
375
- */
376
- aspen = load_cpu_field(v7m.fpccr[M_REG_S]);
377
- sfpa = load_cpu_field(v7m.control[M_REG_S]);
378
- tcg_gen_andi_i32(aspen, aspen, R_V7M_FPCCR_ASPEN_MASK);
379
- tcg_gen_xori_i32(aspen, aspen, R_V7M_FPCCR_ASPEN_MASK);
380
- tcg_gen_andi_i32(sfpa, sfpa, R_V7M_CONTROL_SFPA_MASK);
381
- tcg_gen_or_i32(sfpa, sfpa, aspen);
382
- arm_gen_condlabel(s);
383
- tcg_gen_brcondi_i32(TCG_COND_EQ, sfpa, 0, s->condlabel);
384
-
385
- if (s->fp_excp_el != 0) {
386
- gen_exception_insn(s, s->pc_curr, EXCP_NOCP,
387
- syn_uncategorized(), s->fp_excp_el);
388
- return true;
389
- }
390
-
391
- topreg = a->vd + a->imm - 1;
392
- btmreg = a->vd;
393
-
394
- /* Convert to Sreg numbers if the insn specified in Dregs */
395
- if (a->size == 3) {
396
- topreg = topreg * 2 + 1;
397
- btmreg *= 2;
398
- }
399
-
400
- if (topreg > 63 || (topreg > 31 && !(topreg & 1))) {
401
- /* UNPREDICTABLE: we choose to undef */
402
- unallocated_encoding(s);
403
- return true;
404
- }
405
-
406
- /* Silently ignore requests to clear D16-D31 if they don't exist */
407
- if (topreg > 31 && !dc_isar_feature(aa32_simd_r32, s)) {
408
- topreg = 31;
409
- }
410
-
411
- if (!vfp_access_check(s)) {
412
- return true;
413
- }
414
-
415
- /* Zero the Sregs from btmreg to topreg inclusive. */
416
- zero = tcg_const_i64(0);
417
- if (btmreg & 1) {
418
- write_neon_element64(zero, btmreg >> 1, 1, MO_32);
419
- btmreg++;
420
- }
421
- for (; btmreg + 1 <= topreg; btmreg += 2) {
422
- write_neon_element64(zero, btmreg >> 1, 0, MO_64);
423
- }
424
- if (btmreg == topreg) {
425
- write_neon_element64(zero, btmreg >> 1, 0, MO_32);
426
- btmreg++;
427
- }
428
- assert(btmreg == topreg + 1);
429
- /* TODO: when MVE is implemented, zero VPR here */
430
- return true;
431
-}
432
-
433
-static bool trans_NOCP(DisasContext *s, arg_nocp *a)
434
-{
435
- /*
436
- * Handle M-profile early check for disabled coprocessor:
437
- * all we need to do here is emit the NOCP exception if
438
- * the coprocessor is disabled. Otherwise we return false
439
- * and the real VFP/etc decode will handle the insn.
440
- */
441
- assert(arm_dc_feature(s, ARM_FEATURE_M));
442
-
443
- if (a->cp == 11) {
444
- a->cp = 10;
445
- }
446
- if (arm_dc_feature(s, ARM_FEATURE_V8_1M) &&
447
- (a->cp == 8 || a->cp == 9 || a->cp == 14 || a->cp == 15)) {
448
- /* in v8.1M cp 8, 9, 14, 15 also are governed by the cp10 enable */
449
- a->cp = 10;
450
- }
451
-
452
- if (a->cp != 10) {
453
- gen_exception_insn(s, s->pc_curr, EXCP_NOCP,
454
- syn_uncategorized(), default_exception_el(s));
455
- return true;
456
- }
457
-
458
- if (s->fp_excp_el != 0) {
459
- gen_exception_insn(s, s->pc_curr, EXCP_NOCP,
460
- syn_uncategorized(), s->fp_excp_el);
461
- return true;
462
- }
463
-
464
- return false;
465
-}
466
-
467
-static bool trans_NOCP_8_1(DisasContext *s, arg_nocp *a)
468
-{
469
- /* This range needs a coprocessor check for v8.1M and later only */
470
- if (!arm_dc_feature(s, ARM_FEATURE_V8_1M)) {
471
- return false;
472
- }
473
- return trans_NOCP(s, a);
474
-}
475
-
476
static bool trans_VINS(DisasContext *s, arg_VINS *a)
21
{
477
{
22
GICv3CPUState *cs = icc_cs_from_env(env);
478
TCGv_i32 rd, rm;
23
int regno = ri->opc2 & 3;
479
diff --git a/target/arm/meson.build b/target/arm/meson.build
24
- int grp = ri->crm & 1 ? GICV3_G0 : GICV3_G1NS;
480
index XXXXXXX..XXXXXXX 100644
25
+ int grp = (ri->crm & 1) ? GICV3_G1NS : GICV3_G0;
481
--- a/target/arm/meson.build
26
uint64_t value = cs->ich_apr[grp][regno];
482
+++ b/target/arm/meson.build
27
483
@@ -XXX,XX +XXX,XX @@ gen = [
28
trace_gicv3_icv_ap_read(ri->crm & 1, regno, gicv3_redist_affid(cs), value);
484
decodetree.process('neon-ls.decode', extra_args: '--static-decode=disas_neon_ls'),
29
@@ -XXX,XX +XXX,XX @@ static void icv_ap_write(CPUARMState *env, const ARMCPRegInfo *ri,
485
decodetree.process('vfp.decode', extra_args: '--static-decode=disas_vfp'),
30
{
486
decodetree.process('vfp-uncond.decode', extra_args: '--static-decode=disas_vfp_uncond'),
31
GICv3CPUState *cs = icc_cs_from_env(env);
487
- decodetree.process('m-nocp.decode', extra_args: '--static-decode=disas_m_nocp'),
32
int regno = ri->opc2 & 3;
488
+ decodetree.process('m-nocp.decode', extra_args: '--decode=disas_m_nocp'),
33
- int grp = ri->crm & 1 ? GICV3_G0 : GICV3_G1NS;
489
decodetree.process('a32.decode', extra_args: '--static-decode=disas_a32'),
34
+ int grp = (ri->crm & 1) ? GICV3_G1NS : GICV3_G0;
490
decodetree.process('a32-uncond.decode', extra_args: '--static-decode=disas_a32_uncond'),
35
491
decodetree.process('t32.decode', extra_args: '--static-decode=disas_t32'),
36
trace_gicv3_icv_ap_write(ri->crm & 1, regno, gicv3_redist_affid(cs), value);
492
@@ -XXX,XX +XXX,XX @@ arm_ss.add(files(
37
493
'op_helper.c',
38
@@ -XXX,XX +XXX,XX @@ static uint64_t icc_ap_read(CPUARMState *env, const ARMCPRegInfo *ri)
494
'tlb_helper.c',
39
uint64_t value;
495
'translate.c',
40
496
+ 'translate-m-nocp.c',
41
int regno = ri->opc2 & 3;
497
'vec_helper.c',
42
- int grp = ri->crm & 1 ? GICV3_G0 : GICV3_G1;
498
'vfp_helper.c',
43
+ int grp = (ri->crm & 1) ? GICV3_G1 : GICV3_G0;
499
'cpu_tcg.c',
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
74
--
500
--
75
2.17.1
501
2.20.1
76
502
77
503
diff view generated by jsdifflib
1
As part of plumbing MemTxAttrs down to the IOMMU translate method,
1
Move the various gen_aa32* functions and macros out of translate.c
2
add MemTxAttrs as an argument to the MemoryRegion valid.accepts
2
and into translate-a32.h.
3
callback. We'll need this for subpage_accepts().
4
5
We could take the approach we used with the read and write
6
callbacks and add new a new _with_attrs version, but since there
7
are so few implementations of the accepts hook we just change
8
them all.
9
3
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
5
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
12
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
6
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
13
Message-id: 20180521140402.23318-9-peter.maydell@linaro.org
7
Message-id: 20210430132740.10391-6-peter.maydell@linaro.org
14
---
8
---
15
include/exec/memory.h | 3 ++-
9
target/arm/translate-a32.h | 53 ++++++++++++++++++++++++++++++++++++++
16
exec.c | 9 ++++++---
10
target/arm/translate.c | 51 ++++++++++++------------------------
17
hw/hppa/dino.c | 3 ++-
11
2 files changed, 69 insertions(+), 35 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
12
24
diff --git a/include/exec/memory.h b/include/exec/memory.h
13
diff --git a/target/arm/translate-a32.h b/target/arm/translate-a32.h
25
index XXXXXXX..XXXXXXX 100644
14
index XXXXXXX..XXXXXXX 100644
26
--- a/include/exec/memory.h
15
--- a/target/arm/translate-a32.h
27
+++ b/include/exec/memory.h
16
+++ b/target/arm/translate-a32.h
28
@@ -XXX,XX +XXX,XX @@ struct MemoryRegionOps {
17
@@ -XXX,XX +XXX,XX @@ static inline TCGv_i32 load_reg(DisasContext *s, int reg)
29
* as a machine check exception).
18
return tmp;
30
*/
19
}
31
bool (*accepts)(void *opaque, hwaddr addr,
20
32
- unsigned size, bool is_write);
21
+void gen_aa32_ld_internal_i32(DisasContext *s, TCGv_i32 val,
33
+ unsigned size, bool is_write,
22
+ TCGv_i32 a32, int index, MemOp opc);
34
+ MemTxAttrs attrs);
23
+void gen_aa32_st_internal_i32(DisasContext *s, TCGv_i32 val,
35
} valid;
24
+ TCGv_i32 a32, int index, MemOp opc);
36
/* Internal implementation constraints: */
25
+void gen_aa32_ld_internal_i64(DisasContext *s, TCGv_i64 val,
37
struct {
26
+ TCGv_i32 a32, int index, MemOp opc);
38
diff --git a/exec.c b/exec.c
27
+void gen_aa32_st_internal_i64(DisasContext *s, TCGv_i64 val,
28
+ TCGv_i32 a32, int index, MemOp opc);
29
+void gen_aa32_ld_i32(DisasContext *s, TCGv_i32 val, TCGv_i32 a32,
30
+ int index, MemOp opc);
31
+void gen_aa32_st_i32(DisasContext *s, TCGv_i32 val, TCGv_i32 a32,
32
+ int index, MemOp opc);
33
+void gen_aa32_ld_i64(DisasContext *s, TCGv_i64 val, TCGv_i32 a32,
34
+ int index, MemOp opc);
35
+void gen_aa32_st_i64(DisasContext *s, TCGv_i64 val, TCGv_i32 a32,
36
+ int index, MemOp opc);
37
+
38
+#define DO_GEN_LD(SUFF, OPC) \
39
+ static inline void gen_aa32_ld##SUFF(DisasContext *s, TCGv_i32 val, \
40
+ TCGv_i32 a32, int index) \
41
+ { \
42
+ gen_aa32_ld_i32(s, val, a32, index, OPC); \
43
+ }
44
+
45
+#define DO_GEN_ST(SUFF, OPC) \
46
+ static inline void gen_aa32_st##SUFF(DisasContext *s, TCGv_i32 val, \
47
+ TCGv_i32 a32, int index) \
48
+ { \
49
+ gen_aa32_st_i32(s, val, a32, index, OPC); \
50
+ }
51
+
52
+static inline void gen_aa32_ld64(DisasContext *s, TCGv_i64 val,
53
+ TCGv_i32 a32, int index)
54
+{
55
+ gen_aa32_ld_i64(s, val, a32, index, MO_Q);
56
+}
57
+
58
+static inline void gen_aa32_st64(DisasContext *s, TCGv_i64 val,
59
+ TCGv_i32 a32, int index)
60
+{
61
+ gen_aa32_st_i64(s, val, a32, index, MO_Q);
62
+}
63
+
64
+DO_GEN_LD(8u, MO_UB)
65
+DO_GEN_LD(16u, MO_UW)
66
+DO_GEN_LD(32u, MO_UL)
67
+DO_GEN_ST(8, MO_UB)
68
+DO_GEN_ST(16, MO_UW)
69
+DO_GEN_ST(32, MO_UL)
70
+
71
+#undef DO_GEN_LD
72
+#undef DO_GEN_ST
73
+
74
#endif
75
diff --git a/target/arm/translate.c b/target/arm/translate.c
39
index XXXXXXX..XXXXXXX 100644
76
index XXXXXXX..XXXXXXX 100644
40
--- a/exec.c
77
--- a/target/arm/translate.c
41
+++ b/exec.c
78
+++ b/target/arm/translate.c
42
@@ -XXX,XX +XXX,XX @@ static void notdirty_mem_write(void *opaque, hwaddr ram_addr,
79
@@ -XXX,XX +XXX,XX @@ static TCGv gen_aa32_addr(DisasContext *s, TCGv_i32 a32, MemOp op)
80
* Internal routines are used for NEON cases where the endianness
81
* and/or alignment has already been taken into account and manipulated.
82
*/
83
-static void gen_aa32_ld_internal_i32(DisasContext *s, TCGv_i32 val,
84
- TCGv_i32 a32, int index, MemOp opc)
85
+void gen_aa32_ld_internal_i32(DisasContext *s, TCGv_i32 val,
86
+ TCGv_i32 a32, int index, MemOp opc)
87
{
88
TCGv addr = gen_aa32_addr(s, a32, opc);
89
tcg_gen_qemu_ld_i32(val, addr, index, opc);
90
tcg_temp_free(addr);
43
}
91
}
44
92
45
static bool notdirty_mem_accepts(void *opaque, hwaddr addr,
93
-static void gen_aa32_st_internal_i32(DisasContext *s, TCGv_i32 val,
46
- unsigned size, bool is_write)
94
- TCGv_i32 a32, int index, MemOp opc)
47
+ unsigned size, bool is_write,
95
+void gen_aa32_st_internal_i32(DisasContext *s, TCGv_i32 val,
48
+ MemTxAttrs attrs)
96
+ TCGv_i32 a32, int index, MemOp opc)
49
{
97
{
50
return is_write;
98
TCGv addr = gen_aa32_addr(s, a32, opc);
99
tcg_gen_qemu_st_i32(val, addr, index, opc);
100
tcg_temp_free(addr);
51
}
101
}
52
@@ -XXX,XX +XXX,XX @@ static MemTxResult subpage_write(void *opaque, hwaddr addr,
102
103
-static void gen_aa32_ld_internal_i64(DisasContext *s, TCGv_i64 val,
104
- TCGv_i32 a32, int index, MemOp opc)
105
+void gen_aa32_ld_internal_i64(DisasContext *s, TCGv_i64 val,
106
+ TCGv_i32 a32, int index, MemOp opc)
107
{
108
TCGv addr = gen_aa32_addr(s, a32, opc);
109
110
@@ -XXX,XX +XXX,XX @@ static void gen_aa32_ld_internal_i64(DisasContext *s, TCGv_i64 val,
111
tcg_temp_free(addr);
53
}
112
}
54
113
55
static bool subpage_accepts(void *opaque, hwaddr addr,
114
-static void gen_aa32_st_internal_i64(DisasContext *s, TCGv_i64 val,
56
- unsigned len, bool is_write)
115
- TCGv_i32 a32, int index, MemOp opc)
57
+ unsigned len, bool is_write,
116
+void gen_aa32_st_internal_i64(DisasContext *s, TCGv_i64 val,
58
+ MemTxAttrs attrs)
117
+ TCGv_i32 a32, int index, MemOp opc)
59
{
118
{
60
subpage_t *subpage = opaque;
119
TCGv addr = gen_aa32_addr(s, a32, opc);
61
#if defined(DEBUG_SUBPAGE)
120
62
@@ -XXX,XX +XXX,XX @@ static void readonly_mem_write(void *opaque, hwaddr addr,
121
@@ -XXX,XX +XXX,XX @@ static void gen_aa32_st_internal_i64(DisasContext *s, TCGv_i64 val,
122
tcg_temp_free(addr);
63
}
123
}
64
124
65
static bool readonly_mem_accepts(void *opaque, hwaddr addr,
125
-static void gen_aa32_ld_i32(DisasContext *s, TCGv_i32 val, TCGv_i32 a32,
66
- unsigned size, bool is_write)
126
- int index, MemOp opc)
67
+ unsigned size, bool is_write,
127
+void gen_aa32_ld_i32(DisasContext *s, TCGv_i32 val, TCGv_i32 a32,
68
+ MemTxAttrs attrs)
128
+ int index, MemOp opc)
69
{
129
{
70
return is_write;
130
gen_aa32_ld_internal_i32(s, val, a32, index, finalize_memop(s, opc));
71
}
131
}
72
diff --git a/hw/hppa/dino.c b/hw/hppa/dino.c
132
73
index XXXXXXX..XXXXXXX 100644
133
-static void gen_aa32_st_i32(DisasContext *s, TCGv_i32 val, TCGv_i32 a32,
74
--- a/hw/hppa/dino.c
134
- int index, MemOp opc)
75
+++ b/hw/hppa/dino.c
135
+void gen_aa32_st_i32(DisasContext *s, TCGv_i32 val, TCGv_i32 a32,
76
@@ -XXX,XX +XXX,XX @@ static void gsc_to_pci_forwarding(DinoState *s)
136
+ int index, MemOp opc)
137
{
138
gen_aa32_st_internal_i32(s, val, a32, index, finalize_memop(s, opc));
77
}
139
}
78
140
79
static bool dino_chip_mem_valid(void *opaque, hwaddr addr,
141
-static void gen_aa32_ld_i64(DisasContext *s, TCGv_i64 val, TCGv_i32 a32,
80
- unsigned size, bool is_write)
142
- int index, MemOp opc)
81
+ unsigned size, bool is_write,
143
+void gen_aa32_ld_i64(DisasContext *s, TCGv_i64 val, TCGv_i32 a32,
82
+ MemTxAttrs attrs)
144
+ int index, MemOp opc)
83
{
145
{
84
switch (addr) {
146
gen_aa32_ld_internal_i64(s, val, a32, index, finalize_memop(s, opc));
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
}
147
}
92
148
93
static bool fw_cfg_dma_mem_valid(void *opaque, hwaddr addr,
149
-static void gen_aa32_st_i64(DisasContext *s, TCGv_i64 val, TCGv_i32 a32,
94
- unsigned size, bool is_write)
150
- int index, MemOp opc)
95
+ unsigned size, bool is_write,
151
+void gen_aa32_st_i64(DisasContext *s, TCGv_i64 val, TCGv_i32 a32,
96
+ MemTxAttrs attrs)
152
+ int index, MemOp opc)
97
{
153
{
98
return !is_write || ((size == 4 && (addr == 0 || addr == 4)) ||
154
gen_aa32_st_internal_i64(s, val, a32, index, finalize_memop(s, opc));
99
(size == 8 && addr == 0));
100
}
155
}
101
156
@@ -XXX,XX +XXX,XX @@ static void gen_aa32_st_i64(DisasContext *s, TCGv_i64 val, TCGv_i32 a32,
102
static bool fw_cfg_data_mem_valid(void *opaque, hwaddr addr,
157
gen_aa32_st_i32(s, val, a32, index, OPC); \
103
- unsigned size, bool is_write)
158
}
104
+ unsigned size, bool is_write,
159
105
+ MemTxAttrs attrs)
160
-static inline void gen_aa32_ld64(DisasContext *s, TCGv_i64 val,
161
- TCGv_i32 a32, int index)
162
-{
163
- gen_aa32_ld_i64(s, val, a32, index, MO_Q);
164
-}
165
-
166
-static inline void gen_aa32_st64(DisasContext *s, TCGv_i64 val,
167
- TCGv_i32 a32, int index)
168
-{
169
- gen_aa32_st_i64(s, val, a32, index, MO_Q);
170
-}
171
-
172
-DO_GEN_LD(8u, MO_UB)
173
-DO_GEN_LD(16u, MO_UW)
174
-DO_GEN_LD(32u, MO_UL)
175
-DO_GEN_ST(8, MO_UB)
176
-DO_GEN_ST(16, MO_UW)
177
-DO_GEN_ST(32, MO_UL)
178
-
179
static inline void gen_hvc(DisasContext *s, int imm16)
106
{
180
{
107
return addr == 0;
181
/* The pre HVC helper handles cases when HVC gets trapped
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
}
179
}
180
--
182
--
181
2.17.1
183
2.20.1
182
184
183
185
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
The functions vfp_load_reg32(), vfp_load_reg64(), vfp_store_reg32()
2
and vfp_store_reg64() are used only in translate-vfp.c.inc. Move
3
them to that file.
2
4
3
Depending on the host abi, float16, aka uint16_t, values are
5
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4
passed and returned either zero-extended in the host register
6
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
5
or with garbage at the top of the host register.
7
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
8
Message-id: 20210430132740.10391-7-peter.maydell@linaro.org
9
---
10
target/arm/translate.c | 20 --------------------
11
target/arm/translate-vfp.c.inc | 20 ++++++++++++++++++++
12
2 files changed, 20 insertions(+), 20 deletions(-)
6
13
7
The tcg code generator has so far been assuming garbage, as that
14
diff --git a/target/arm/translate.c b/target/arm/translate.c
8
matches the x86 abi, but this is incorrect for other host abis.
9
Further, target/arm has so far been assuming zero-extended results,
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>
25
---
26
include/exec/helper-head.h | 2 +-
27
target/arm/helper-a64.c | 35 +++++++++--------
28
target/arm/helper.c | 80 +++++++++++++++++++-------------------
29
3 files changed, 59 insertions(+), 58 deletions(-)
30
31
diff --git a/include/exec/helper-head.h b/include/exec/helper-head.h
32
index XXXXXXX..XXXXXXX 100644
15
index XXXXXXX..XXXXXXX 100644
33
--- a/include/exec/helper-head.h
16
--- a/target/arm/translate.c
34
+++ b/include/exec/helper-head.h
17
+++ b/target/arm/translate.c
35
@@ -XXX,XX +XXX,XX @@
18
@@ -XXX,XX +XXX,XX @@ static long vfp_reg_offset(bool dp, unsigned reg)
36
#define dh_ctype_int int
37
#define dh_ctype_i64 uint64_t
38
#define dh_ctype_s64 int64_t
39
-#define dh_ctype_f16 float16
40
+#define dh_ctype_f16 uint32_t
41
#define dh_ctype_f32 float32
42
#define dh_ctype_f64 float64
43
#define dh_ctype_ptr void *
44
diff --git a/target/arm/helper-a64.c b/target/arm/helper-a64.c
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
}
51
52
-uint64_t HELPER(vfp_cmph_a64)(float16 x, float16 y, void *fp_status)
53
+uint64_t HELPER(vfp_cmph_a64)(uint32_t x, uint32_t y, void *fp_status)
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
195
index XXXXXXX..XXXXXXX 100644
196
--- a/target/arm/helper.c
197
+++ b/target/arm/helper.c
198
@@ -XXX,XX +XXX,XX @@ DO_VFP_cmp(d, float64)
199
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
}
213
214
-#define CONV_FTOI(name, fsz, sign, round) \
215
-uint32_t HELPER(name)(float##fsz x, void *fpstp) \
216
-{ \
217
- float_status *fpst = fpstp; \
218
- if (float##fsz##_is_any_nan(x)) { \
219
- float_raise(float_flag_invalid, fpst); \
220
- return 0; \
221
- } \
222
- return float##fsz##_to_##sign##int32##round(x, fpst); \
223
+#define CONV_FTOI(name, ftype, fsz, sign, round) \
224
+uint32_t HELPER(name)(ftype x, void *fpstp) \
225
+{ \
226
+ float_status *fpst = fpstp; \
227
+ if (float##fsz##_is_any_nan(x)) { \
228
+ float_raise(float_flag_invalid, fpst); \
229
+ return 0; \
230
+ } \
231
+ return float##fsz##_to_##sign##int32##round(x, fpst); \
232
}
233
234
-#define FLOAT_CONVS(name, p, fsz, sign) \
235
-CONV_ITOF(vfp_##name##to##p, fsz, sign) \
236
-CONV_FTOI(vfp_to##name##p, fsz, sign, ) \
237
-CONV_FTOI(vfp_to##name##z##p, fsz, sign, _round_to_zero)
238
+#define FLOAT_CONVS(name, p, ftype, fsz, sign) \
239
+ CONV_ITOF(vfp_##name##to##p, ftype, fsz, sign) \
240
+ CONV_FTOI(vfp_to##name##p, ftype, fsz, sign, ) \
241
+ CONV_FTOI(vfp_to##name##z##p, ftype, fsz, sign, _round_to_zero)
242
243
-FLOAT_CONVS(si, h, 16, )
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
}
19
}
287
}
20
}
288
21
289
-uint32_t HELPER(vfp_toshh)(float16 x, uint32_t shift, void *fpst)
22
-static inline void vfp_load_reg64(TCGv_i64 var, int reg)
290
+uint32_t HELPER(vfp_toshh)(uint32_t x, uint32_t shift, void *fpst)
23
-{
24
- tcg_gen_ld_i64(var, cpu_env, vfp_reg_offset(true, reg));
25
-}
26
-
27
-static inline void vfp_store_reg64(TCGv_i64 var, int reg)
28
-{
29
- tcg_gen_st_i64(var, cpu_env, vfp_reg_offset(true, reg));
30
-}
31
-
32
-static inline void vfp_load_reg32(TCGv_i32 var, int reg)
33
-{
34
- tcg_gen_ld_i32(var, cpu_env, vfp_reg_offset(false, reg));
35
-}
36
-
37
-static inline void vfp_store_reg32(TCGv_i32 var, int reg)
38
-{
39
- tcg_gen_st_i32(var, cpu_env, vfp_reg_offset(false, reg));
40
-}
41
-
42
void read_neon_element32(TCGv_i32 dest, int reg, int ele, MemOp memop)
291
{
43
{
292
return float64_to_int16(do_prescale_fp16(x, shift, fpst), fpst);
44
long off = neon_element_offset(reg, ele, memop);
293
}
45
diff --git a/target/arm/translate-vfp.c.inc b/target/arm/translate-vfp.c.inc
294
46
index XXXXXXX..XXXXXXX 100644
295
-uint32_t HELPER(vfp_touhh)(float16 x, uint32_t shift, void *fpst)
47
--- a/target/arm/translate-vfp.c.inc
296
+uint32_t HELPER(vfp_touhh)(uint32_t x, uint32_t shift, void *fpst)
48
+++ b/target/arm/translate-vfp.c.inc
297
{
49
@@ -XXX,XX +XXX,XX @@
298
return float64_to_uint16(do_prescale_fp16(x, shift, fpst), fpst);
50
#include "decode-vfp.c.inc"
299
}
51
#include "decode-vfp-uncond.c.inc"
300
52
301
-uint32_t HELPER(vfp_toslh)(float16 x, uint32_t shift, void *fpst)
53
+static inline void vfp_load_reg64(TCGv_i64 var, int reg)
302
+uint32_t HELPER(vfp_toslh)(uint32_t x, uint32_t shift, void *fpst)
54
+{
303
{
55
+ tcg_gen_ld_i64(var, cpu_env, vfp_reg_offset(true, reg));
304
return float64_to_int32(do_prescale_fp16(x, shift, fpst), fpst);
56
+}
305
}
57
+
306
58
+static inline void vfp_store_reg64(TCGv_i64 var, int reg)
307
-uint32_t HELPER(vfp_toulh)(float16 x, uint32_t shift, void *fpst)
59
+{
308
+uint32_t HELPER(vfp_toulh)(uint32_t x, uint32_t shift, void *fpst)
60
+ tcg_gen_st_i64(var, cpu_env, vfp_reg_offset(true, reg));
309
{
61
+}
310
return float64_to_uint32(do_prescale_fp16(x, shift, fpst), fpst);
62
+
311
}
63
+static inline void vfp_load_reg32(TCGv_i32 var, int reg)
312
64
+{
313
-uint64_t HELPER(vfp_tosqh)(float16 x, uint32_t shift, void *fpst)
65
+ tcg_gen_ld_i32(var, cpu_env, vfp_reg_offset(false, reg));
314
+uint64_t HELPER(vfp_tosqh)(uint32_t x, uint32_t shift, void *fpst)
66
+}
315
{
67
+
316
return float64_to_int64(do_prescale_fp16(x, shift, fpst), fpst);
68
+static inline void vfp_store_reg32(TCGv_i32 var, int reg)
317
}
69
+{
318
70
+ tcg_gen_st_i32(var, cpu_env, vfp_reg_offset(false, reg));
319
-uint64_t HELPER(vfp_touqh)(float16 x, uint32_t shift, void *fpst)
71
+}
320
+uint64_t HELPER(vfp_touqh)(uint32_t x, uint32_t shift, void *fpst)
72
+
321
{
73
/*
322
return float64_to_uint64(do_prescale_fp16(x, shift, fpst), fpst);
74
* The imm8 encodes the sign bit, enough bits to represent an exponent in
323
}
75
* the range 01....1xx to 10....0xx, and the most significant 4 bits of
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();
362
}
363
364
-float16 HELPER(recpe_f16)(float16 input, void *fpstp)
365
+uint32_t HELPER(recpe_f16)(uint32_t input, void *fpstp)
366
{
367
float_status *fpst = fpstp;
368
float16 f16 = float16_squash_input_denormal(input, fpst);
369
@@ -XXX,XX +XXX,XX @@ static uint64_t recip_sqrt_estimate(int *exp , int exp_off, uint64_t frac)
370
return extract64(estimate, 0, 8) << 44;
371
}
372
373
-float16 HELPER(rsqrte_f16)(float16 input, void *fpstp)
374
+uint32_t HELPER(rsqrte_f16)(uint32_t input, void *fpstp)
375
{
376
float_status *s = fpstp;
377
float16 f16 = float16_squash_input_denormal(input, s);
378
--
76
--
379
2.17.1
77
2.20.1
380
78
381
79
diff view generated by jsdifflib
1
As part of plumbing MemTxAttrs down to the IOMMU translate method,
1
Make the remaining functions which are needed by translate-vfp.c.inc
2
add MemTxAttrs as an argument to address_space_map().
2
global.
3
Its callers either have an attrs value to hand, or don't care
4
and can use MEMTXATTRS_UNSPECIFIED.
5
3
6
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
5
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
8
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
6
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
9
Message-id: 20180521140402.23318-5-peter.maydell@linaro.org
7
Message-id: 20210430132740.10391-8-peter.maydell@linaro.org
10
---
8
---
11
include/exec/memory.h | 3 ++-
9
target/arm/translate-a32.h | 18 ++++++++++++++++++
12
include/sysemu/dma.h | 3 ++-
10
target/arm/translate.c | 25 ++++++++-----------------
13
exec.c | 6 ++++--
11
2 files changed, 26 insertions(+), 17 deletions(-)
14
target/ppc/mmu-hash64.c | 3 ++-
15
4 files changed, 10 insertions(+), 5 deletions(-)
16
12
17
diff --git a/include/exec/memory.h b/include/exec/memory.h
13
diff --git a/target/arm/translate-a32.h b/target/arm/translate-a32.h
18
index XXXXXXX..XXXXXXX 100644
14
index XXXXXXX..XXXXXXX 100644
19
--- a/include/exec/memory.h
15
--- a/target/arm/translate-a32.h
20
+++ b/include/exec/memory.h
16
+++ b/target/arm/translate-a32.h
21
@@ -XXX,XX +XXX,XX @@ bool address_space_access_valid(AddressSpace *as, hwaddr addr, int len, bool is_
17
@@ -XXX,XX +XXX,XX @@ void read_neon_element32(TCGv_i32 dest, int reg, int ele, MemOp memop);
22
* @addr: address within that address space
18
void read_neon_element64(TCGv_i64 dest, int reg, int ele, MemOp memop);
23
* @plen: pointer to length of buffer; updated on return
19
void write_neon_element32(TCGv_i32 src, int reg, int ele, MemOp memop);
24
* @is_write: indicates the transfer direction
20
void write_neon_element64(TCGv_i64 src, int reg, int ele, MemOp memop);
25
+ * @attrs: memory attributes
21
+TCGv_i32 add_reg_for_lit(DisasContext *s, int reg, int ofs);
22
+void gen_set_cpsr(TCGv_i32 var, uint32_t mask);
23
+void gen_set_condexec(DisasContext *s);
24
+void gen_set_pc_im(DisasContext *s, target_ulong val);
25
+void gen_lookup_tb(DisasContext *s);
26
+long vfp_reg_offset(bool dp, unsigned reg);
27
+long neon_full_reg_offset(unsigned reg);
28
29
static inline TCGv_i32 load_cpu_offset(int offset)
30
{
31
@@ -XXX,XX +XXX,XX @@ static inline TCGv_i32 load_reg(DisasContext *s, int reg)
32
return tmp;
33
}
34
35
+void store_reg(DisasContext *s, int reg, TCGv_i32 var);
36
+
37
void gen_aa32_ld_internal_i32(DisasContext *s, TCGv_i32 val,
38
TCGv_i32 a32, int index, MemOp opc);
39
void gen_aa32_st_internal_i32(DisasContext *s, TCGv_i32 val,
40
@@ -XXX,XX +XXX,XX @@ DO_GEN_ST(32, MO_UL)
41
#undef DO_GEN_LD
42
#undef DO_GEN_ST
43
44
+#if defined(CONFIG_USER_ONLY)
45
+#define IS_USER(s) 1
46
+#else
47
+#define IS_USER(s) (s->user)
48
+#endif
49
+
50
+/* Set NZCV flags from the high 4 bits of var. */
51
+#define gen_set_nzcv(var) gen_set_cpsr(var, CPSR_NZCV)
52
+
53
#endif
54
diff --git a/target/arm/translate.c b/target/arm/translate.c
55
index XXXXXXX..XXXXXXX 100644
56
--- a/target/arm/translate.c
57
+++ b/target/arm/translate.c
58
@@ -XXX,XX +XXX,XX @@
59
#include "translate.h"
60
#include "translate-a32.h"
61
62
-#if defined(CONFIG_USER_ONLY)
63
-#define IS_USER(s) 1
64
-#else
65
-#define IS_USER(s) (s->user)
66
-#endif
67
-
68
/* These are TCG temporaries used only by the legacy iwMMXt decoder */
69
static TCGv_i64 cpu_V0, cpu_V1, cpu_M0;
70
/* These are TCG globals which alias CPUARMState fields */
71
@@ -XXX,XX +XXX,XX @@ void load_reg_var(DisasContext *s, TCGv_i32 var, int reg)
72
* This is used for load/store for which use of PC implies (literal),
73
* or ADD that implies ADR.
26
*/
74
*/
27
void *address_space_map(AddressSpace *as, hwaddr addr,
75
-static TCGv_i32 add_reg_for_lit(DisasContext *s, int reg, int ofs)
28
- hwaddr *plen, bool is_write);
76
+TCGv_i32 add_reg_for_lit(DisasContext *s, int reg, int ofs)
29
+ hwaddr *plen, bool is_write, MemTxAttrs attrs);
77
{
30
78
TCGv_i32 tmp = tcg_temp_new_i32();
31
/* address_space_unmap: Unmaps a memory region previously mapped by address_space_map()
79
32
*
80
@@ -XXX,XX +XXX,XX @@ static TCGv_i32 add_reg_for_lit(DisasContext *s, int reg, int ofs)
33
diff --git a/include/sysemu/dma.h b/include/sysemu/dma.h
81
34
index XXXXXXX..XXXXXXX 100644
82
/* Set a CPU register. The source must be a temporary and will be
35
--- a/include/sysemu/dma.h
83
marked as dead. */
36
+++ b/include/sysemu/dma.h
84
-static void store_reg(DisasContext *s, int reg, TCGv_i32 var)
37
@@ -XXX,XX +XXX,XX @@ static inline void *dma_memory_map(AddressSpace *as,
85
+void store_reg(DisasContext *s, int reg, TCGv_i32 var)
38
hwaddr xlen = *len;
86
{
39
void *p;
87
if (reg == 15) {
40
88
/* In Thumb mode, we must ignore bit 0.
41
- p = address_space_map(as, addr, &xlen, dir == DMA_DIRECTION_FROM_DEVICE);
89
@@ -XXX,XX +XXX,XX @@ static void store_sp_checked(DisasContext *s, TCGv_i32 var)
42
+ p = address_space_map(as, addr, &xlen, dir == DMA_DIRECTION_FROM_DEVICE,
90
#define gen_sxtb16(var) gen_helper_sxtb16(var, var)
43
+ MEMTXATTRS_UNSPECIFIED);
91
#define gen_uxtb16(var) gen_helper_uxtb16(var, var)
44
*len = xlen;
92
45
return p;
93
-
94
-static inline void gen_set_cpsr(TCGv_i32 var, uint32_t mask)
95
+void gen_set_cpsr(TCGv_i32 var, uint32_t mask)
96
{
97
TCGv_i32 tmp_mask = tcg_const_i32(mask);
98
gen_helper_cpsr_write(cpu_env, var, tmp_mask);
99
tcg_temp_free_i32(tmp_mask);
46
}
100
}
47
diff --git a/exec.c b/exec.c
101
-/* Set NZCV flags from the high 4 bits of var. */
48
index XXXXXXX..XXXXXXX 100644
102
-#define gen_set_nzcv(var) gen_set_cpsr(var, CPSR_NZCV)
49
--- a/exec.c
103
50
+++ b/exec.c
104
static void gen_exception_internal(int excp)
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
{
105
{
59
hwaddr len = *plen;
106
@@ -XXX,XX +XXX,XX @@ void arm_gen_test_cc(int cc, TCGLabel *label)
60
hwaddr l, xlat;
107
arm_free_cc(&cmp);
61
@@ -XXX,XX +XXX,XX @@ void *cpu_physical_memory_map(hwaddr addr,
108
}
62
hwaddr *plen,
109
63
int is_write)
110
-static inline void gen_set_condexec(DisasContext *s)
111
+void gen_set_condexec(DisasContext *s)
64
{
112
{
65
- return address_space_map(&address_space_memory, addr, plen, is_write);
113
if (s->condexec_mask) {
66
+ return address_space_map(&address_space_memory, addr, plen, is_write,
114
uint32_t val = (s->condexec_cond << 4) | (s->condexec_mask >> 1);
67
+ MEMTXATTRS_UNSPECIFIED);
115
@@ -XXX,XX +XXX,XX @@ static inline void gen_set_condexec(DisasContext *s)
116
}
68
}
117
}
69
118
70
void cpu_physical_memory_unmap(void *buffer, hwaddr len,
119
-static inline void gen_set_pc_im(DisasContext *s, target_ulong val)
71
diff --git a/target/ppc/mmu-hash64.c b/target/ppc/mmu-hash64.c
120
+void gen_set_pc_im(DisasContext *s, target_ulong val)
72
index XXXXXXX..XXXXXXX 100644
121
{
73
--- a/target/ppc/mmu-hash64.c
122
tcg_gen_movi_i32(cpu_R[15], val);
74
+++ b/target/ppc/mmu-hash64.c
123
}
75
@@ -XXX,XX +XXX,XX @@ const ppc_hash_pte64_t *ppc_hash64_map_hptes(PowerPCCPU *cpu,
124
@@ -XXX,XX +XXX,XX @@ static void gen_exception_el(DisasContext *s, int excp, uint32_t syn,
76
return NULL;
125
}
77
}
126
78
127
/* Force a TB lookup after an instruction that changes the CPU state. */
79
- hptes = address_space_map(CPU(cpu)->as, base + pte_offset, &plen, false);
128
-static inline void gen_lookup_tb(DisasContext *s)
80
+ hptes = address_space_map(CPU(cpu)->as, base + pte_offset, &plen, false,
129
+void gen_lookup_tb(DisasContext *s)
81
+ MEMTXATTRS_UNSPECIFIED);
130
{
82
if (plen < (n * HASH_PTE_SIZE_64)) {
131
tcg_gen_movi_i32(cpu_R[15], s->base.pc_next);
83
hw_error("%s: Unable to map all requested HPTEs\n", __func__);
132
s->base.is_jmp = DISAS_EXIT;
84
}
133
@@ -XXX,XX +XXX,XX @@ static inline void gen_hlt(DisasContext *s, int imm)
134
/*
135
* Return the offset of a "full" NEON Dreg.
136
*/
137
-static long neon_full_reg_offset(unsigned reg)
138
+long neon_full_reg_offset(unsigned reg)
139
{
140
return offsetof(CPUARMState, vfp.zregs[reg >> 1].d[reg & 1]);
141
}
142
@@ -XXX,XX +XXX,XX @@ static long neon_element_offset(int reg, int element, MemOp memop)
143
}
144
145
/* Return the offset of a VFP Dreg (dp = true) or VFP Sreg (dp = false). */
146
-static long vfp_reg_offset(bool dp, unsigned reg)
147
+long vfp_reg_offset(bool dp, unsigned reg)
148
{
149
if (dp) {
150
return neon_element_offset(reg, 0, MO_64);
85
--
151
--
86
2.17.1
152
2.20.1
87
153
88
154
diff view generated by jsdifflib
1
As part of plumbing MemTxAttrs down to the IOMMU translate method,
1
Switch translate-vfp.c.inc from being #included into translate.c
2
add MemTxAttrs as an argument to flatview_do_translate().
2
to being its own compilation unit.
3
3
4
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
5
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
6
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
6
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
7
Message-id: 20180521140402.23318-13-peter.maydell@linaro.org
7
Message-id: 20210430132740.10391-9-peter.maydell@linaro.org
8
---
8
---
9
exec.c | 9 ++++++---
9
target/arm/translate-a32.h | 2 ++
10
1 file changed, 6 insertions(+), 3 deletions(-)
10
target/arm/{translate-vfp.c.inc => translate-vfp.c} | 12 +++++++-----
11
target/arm/translate.c | 3 +--
12
target/arm/meson.build | 5 +++--
13
4 files changed, 13 insertions(+), 9 deletions(-)
14
rename target/arm/{translate-vfp.c.inc => translate-vfp.c} (99%)
11
15
12
diff --git a/exec.c b/exec.c
16
diff --git a/target/arm/translate-a32.h b/target/arm/translate-a32.h
13
index XXXXXXX..XXXXXXX 100644
17
index XXXXXXX..XXXXXXX 100644
14
--- a/exec.c
18
--- a/target/arm/translate-a32.h
15
+++ b/exec.c
19
+++ b/target/arm/translate-a32.h
16
@@ -XXX,XX +XXX,XX @@ unassigned:
20
@@ -XXX,XX +XXX,XX @@
17
* @is_write: whether the translation operation is for write
21
18
* @is_mmio: whether this can be MMIO, set true if it can
22
/* Prototypes for autogenerated disassembler functions */
19
* @target_as: the address space targeted by the IOMMU
23
bool disas_m_nocp(DisasContext *dc, uint32_t insn);
20
+ * @attrs: memory transaction attributes
24
+bool disas_vfp(DisasContext *s, uint32_t insn);
21
*
25
+bool disas_vfp_uncond(DisasContext *s, uint32_t insn);
22
* This function is called from RCU critical section
26
27
void load_reg_var(DisasContext *s, TCGv_i32 var, int reg);
28
void arm_gen_condlabel(DisasContext *s);
29
diff --git a/target/arm/translate-vfp.c.inc b/target/arm/translate-vfp.c
30
similarity index 99%
31
rename from target/arm/translate-vfp.c.inc
32
rename to target/arm/translate-vfp.c
33
index XXXXXXX..XXXXXXX 100644
34
--- a/target/arm/translate-vfp.c.inc
35
+++ b/target/arm/translate-vfp.c
36
@@ -XXX,XX +XXX,XX @@
37
* License along with this library; if not, see <http://www.gnu.org/licenses/>.
23
*/
38
*/
24
@@ -XXX,XX +XXX,XX @@ static MemoryRegionSection flatview_do_translate(FlatView *fv,
39
25
hwaddr *page_mask_out,
40
-/*
26
bool is_write,
41
- * This file is intended to be included from translate.c; it uses
27
bool is_mmio,
42
- * some macros and definitions provided by that file.
28
- AddressSpace **target_as)
43
- * It might be possible to convert it to a standalone .c file eventually.
29
+ AddressSpace **target_as,
44
- */
30
+ MemTxAttrs attrs)
45
+#include "qemu/osdep.h"
31
{
46
+#include "tcg/tcg-op.h"
32
MemoryRegionSection *section;
47
+#include "tcg/tcg-op-gvec.h"
33
IOMMUMemoryRegion *iommu_mr;
48
+#include "exec/exec-all.h"
34
@@ -XXX,XX +XXX,XX @@ IOMMUTLBEntry address_space_get_iotlb_entry(AddressSpace *as, hwaddr addr,
49
+#include "exec/gen-icount.h"
35
* but page mask.
50
+#include "translate.h"
36
*/
51
+#include "translate-a32.h"
37
section = flatview_do_translate(address_space_to_flatview(as), addr, &xlat,
52
38
- NULL, &page_mask, is_write, false, &as);
53
/* Include the generated VFP decoder */
39
+ NULL, &page_mask, is_write, false, &as,
54
#include "decode-vfp.c.inc"
40
+ attrs);
55
diff --git a/target/arm/translate.c b/target/arm/translate.c
41
56
index XXXXXXX..XXXXXXX 100644
42
/* Illegal translation */
57
--- a/target/arm/translate.c
43
if (section.mr == &io_mem_unassigned) {
58
+++ b/target/arm/translate.c
44
@@ -XXX,XX +XXX,XX @@ MemoryRegion *flatview_translate(FlatView *fv, hwaddr addr, hwaddr *xlat,
59
@@ -XXX,XX +XXX,XX @@ static TCGv_ptr vfp_reg_ptr(bool dp, int reg)
45
60
46
/* This can be MMIO, so setup MMIO bit. */
61
#define ARM_CP_RW_BIT (1 << 20)
47
section = flatview_do_translate(fv, addr, xlat, plen, NULL,
62
48
- is_write, true, &as);
63
-/* Include the VFP and Neon decoders */
49
+ is_write, true, &as, attrs);
64
-#include "translate-vfp.c.inc"
50
mr = section.mr;
65
+/* Include the Neon decoder */
51
66
#include "translate-neon.c.inc"
52
if (xen_enabled() && memory_access_is_direct(mr, is_write)) {
67
68
static inline void iwmmxt_load_reg(TCGv_i64 var, int reg)
69
diff --git a/target/arm/meson.build b/target/arm/meson.build
70
index XXXXXXX..XXXXXXX 100644
71
--- a/target/arm/meson.build
72
+++ b/target/arm/meson.build
73
@@ -XXX,XX +XXX,XX @@ gen = [
74
decodetree.process('neon-shared.decode', extra_args: '--static-decode=disas_neon_shared'),
75
decodetree.process('neon-dp.decode', extra_args: '--static-decode=disas_neon_dp'),
76
decodetree.process('neon-ls.decode', extra_args: '--static-decode=disas_neon_ls'),
77
- decodetree.process('vfp.decode', extra_args: '--static-decode=disas_vfp'),
78
- decodetree.process('vfp-uncond.decode', extra_args: '--static-decode=disas_vfp_uncond'),
79
+ decodetree.process('vfp.decode', extra_args: '--decode=disas_vfp'),
80
+ decodetree.process('vfp-uncond.decode', extra_args: '--decode=disas_vfp_uncond'),
81
decodetree.process('m-nocp.decode', extra_args: '--decode=disas_m_nocp'),
82
decodetree.process('a32.decode', extra_args: '--static-decode=disas_a32'),
83
decodetree.process('a32-uncond.decode', extra_args: '--static-decode=disas_a32_uncond'),
84
@@ -XXX,XX +XXX,XX @@ arm_ss.add(files(
85
'tlb_helper.c',
86
'translate.c',
87
'translate-m-nocp.c',
88
+ 'translate-vfp.c',
89
'vec_helper.c',
90
'vfp_helper.c',
91
'cpu_tcg.c',
53
--
92
--
54
2.17.1
93
2.20.1
55
94
56
95
diff view generated by jsdifflib
1
As part of plumbing MemTxAttrs down to the IOMMU translate method,
1
The function vfp_reg_ptr() is used only in translate-neon.c.inc;
2
add MemTxAttrs as an argument to address_space_get_iotlb_entry().
2
move it there.
3
3
4
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
5
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
6
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
6
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
7
Message-id: 20180521140402.23318-12-peter.maydell@linaro.org
7
Message-id: 20210430132740.10391-10-peter.maydell@linaro.org
8
---
8
---
9
include/exec/memory.h | 2 +-
9
target/arm/translate.c | 7 -------
10
exec.c | 2 +-
10
target/arm/translate-neon.c.inc | 7 +++++++
11
hw/virtio/vhost.c | 3 ++-
11
2 files changed, 7 insertions(+), 7 deletions(-)
12
3 files changed, 4 insertions(+), 3 deletions(-)
13
12
14
diff --git a/include/exec/memory.h b/include/exec/memory.h
13
diff --git a/target/arm/translate.c b/target/arm/translate.c
15
index XXXXXXX..XXXXXXX 100644
14
index XXXXXXX..XXXXXXX 100644
16
--- a/include/exec/memory.h
15
--- a/target/arm/translate.c
17
+++ b/include/exec/memory.h
16
+++ b/target/arm/translate.c
18
@@ -XXX,XX +XXX,XX @@ void address_space_cache_destroy(MemoryRegionCache *cache);
17
@@ -XXX,XX +XXX,XX @@ void write_neon_element64(TCGv_i64 src, int reg, int ele, MemOp memop)
19
* entry. Should be called from an RCU critical section.
18
}
20
*/
19
}
21
IOMMUTLBEntry address_space_get_iotlb_entry(AddressSpace *as, hwaddr addr,
20
22
- bool is_write);
21
-static TCGv_ptr vfp_reg_ptr(bool dp, int reg)
23
+ bool is_write, MemTxAttrs attrs);
22
-{
24
23
- TCGv_ptr ret = tcg_temp_new_ptr();
25
/* address_space_translate: translate an address range into an address space
24
- tcg_gen_addi_ptr(ret, cpu_env, vfp_reg_offset(dp, reg));
26
* into a MemoryRegion and an address range into that section. Should be
25
- return ret;
27
diff --git a/exec.c b/exec.c
26
-}
27
-
28
#define ARM_CP_RW_BIT (1 << 20)
29
30
/* Include the Neon decoder */
31
diff --git a/target/arm/translate-neon.c.inc b/target/arm/translate-neon.c.inc
28
index XXXXXXX..XXXXXXX 100644
32
index XXXXXXX..XXXXXXX 100644
29
--- a/exec.c
33
--- a/target/arm/translate-neon.c.inc
30
+++ b/exec.c
34
+++ b/target/arm/translate-neon.c.inc
31
@@ -XXX,XX +XXX,XX @@ static MemoryRegionSection flatview_do_translate(FlatView *fv,
35
@@ -XXX,XX +XXX,XX @@ static inline int neon_3same_fp_size(DisasContext *s, int x)
32
36
#include "decode-neon-ls.c.inc"
33
/* Called from RCU critical section */
37
#include "decode-neon-shared.c.inc"
34
IOMMUTLBEntry address_space_get_iotlb_entry(AddressSpace *as, hwaddr addr,
38
35
- bool is_write)
39
+static TCGv_ptr vfp_reg_ptr(bool dp, int reg)
36
+ bool is_write, MemTxAttrs attrs)
40
+{
41
+ TCGv_ptr ret = tcg_temp_new_ptr();
42
+ tcg_gen_addi_ptr(ret, cpu_env, vfp_reg_offset(dp, reg));
43
+ return ret;
44
+}
45
+
46
static void neon_load_element(TCGv_i32 var, int reg, int ele, MemOp mop)
37
{
47
{
38
MemoryRegionSection section;
48
long offset = neon_element_offset(reg, ele, mop & MO_SIZE);
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
--
49
--
55
2.17.1
50
2.20.1
56
51
57
52
diff view generated by jsdifflib
1
As part of plumbing MemTxAttrs down to the IOMMU translate method,
1
The VFPGenFixPointFn typedef is unused; delete it.
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
6
The callsite in flatview_access_valid() is part of a recursive
7
loop flatview_access_valid() -> memory_region_access_valid() ->
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
2
13
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
3
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>
4
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
16
Message-id: 20180521140402.23318-8-peter.maydell@linaro.org
5
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
6
Message-id: 20210430132740.10391-11-peter.maydell@linaro.org
17
---
7
---
18
include/exec/memory-internal.h | 3 ++-
8
target/arm/translate.c | 2 --
19
exec.c | 4 +++-
9
1 file changed, 2 deletions(-)
20
hw/s390x/s390-pci-inst.c | 3 ++-
21
memory.c | 7 ++++---
22
4 files changed, 11 insertions(+), 6 deletions(-)
23
10
24
diff --git a/include/exec/memory-internal.h b/include/exec/memory-internal.h
11
diff --git a/target/arm/translate.c b/target/arm/translate.c
25
index XXXXXXX..XXXXXXX 100644
12
index XXXXXXX..XXXXXXX 100644
26
--- a/include/exec/memory-internal.h
13
--- a/target/arm/translate.c
27
+++ b/include/exec/memory-internal.h
14
+++ b/target/arm/translate.c
28
@@ -XXX,XX +XXX,XX @@ void flatview_unref(FlatView *view);
15
@@ -XXX,XX +XXX,XX @@ static const char * const regnames[] =
29
extern const MemoryRegionOps unassigned_mem_ops;
16
/* Function prototypes for gen_ functions calling Neon helpers. */
30
17
typedef void NeonGenThreeOpEnvFn(TCGv_i32, TCGv_env, TCGv_i32,
31
bool memory_region_access_valid(MemoryRegion *mr, hwaddr addr,
18
TCGv_i32, TCGv_i32);
32
- unsigned size, bool is_write);
19
-/* Function prototypes for gen_ functions for fix point conversions */
33
+ unsigned size, bool is_write,
20
-typedef void VFPGenFixPointFn(TCGv_i32, TCGv_i32, TCGv_i32, TCGv_ptr);
34
+ MemTxAttrs attrs);
21
35
22
/* initialize TCG globals. */
36
void flatview_add_to_dispatch(FlatView *fv, MemoryRegionSection *section);
23
void arm_translate_init(void)
37
AddressSpaceDispatch *address_space_dispatch_new(FlatView *fv);
38
diff --git a/exec.c b/exec.c
39
index XXXXXXX..XXXXXXX 100644
40
--- a/exec.c
41
+++ b/exec.c
42
@@ -XXX,XX +XXX,XX @@ static bool flatview_access_valid(FlatView *fv, hwaddr addr, int len,
43
mr = flatview_translate(fv, addr, &xlat, &l, is_write);
44
if (!memory_access_is_direct(mr, is_write)) {
45
l = memory_access_size(mr, l, addr);
46
- if (!memory_region_access_valid(mr, xlat, l, is_write)) {
47
+ /* When our callers all have attrs we'll pass them through here */
48
+ if (!memory_region_access_valid(mr, xlat, l, is_write,
49
+ MEMTXATTRS_UNSPECIFIED)) {
50
return false;
51
}
52
}
53
diff --git a/hw/s390x/s390-pci-inst.c b/hw/s390x/s390-pci-inst.c
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
}
67
diff --git a/memory.c b/memory.c
68
index XXXXXXX..XXXXXXX 100644
69
--- a/memory.c
70
+++ b/memory.c
71
@@ -XXX,XX +XXX,XX @@ static const MemoryRegionOps ram_device_mem_ops = {
72
bool memory_region_access_valid(MemoryRegion *mr,
73
hwaddr addr,
74
unsigned size,
75
- bool is_write)
76
+ bool is_write,
77
+ MemTxAttrs attrs)
78
{
79
int access_size_min, access_size_max;
80
int access_size, i;
81
@@ -XXX,XX +XXX,XX @@ MemTxResult memory_region_dispatch_read(MemoryRegion *mr,
82
{
83
MemTxResult r;
84
85
- if (!memory_region_access_valid(mr, addr, size, false)) {
86
+ if (!memory_region_access_valid(mr, addr, size, false, attrs)) {
87
*pval = unassigned_mem_read(mr, addr, size);
88
return MEMTX_DECODE_ERROR;
89
}
90
@@ -XXX,XX +XXX,XX @@ MemTxResult memory_region_dispatch_write(MemoryRegion *mr,
91
unsigned size,
92
MemTxAttrs attrs)
93
{
94
- if (!memory_region_access_valid(mr, addr, size, true)) {
95
+ if (!memory_region_access_valid(mr, addr, size, true, attrs)) {
96
unassigned_mem_write(mr, addr, data, size);
97
return MEMTX_DECODE_ERROR;
98
}
99
--
24
--
100
2.17.1
25
2.20.1
101
26
102
27
diff view generated by jsdifflib
1
As part of plumbing MemTxAttrs down to the IOMMU translate method,
1
Move the NeonGenThreeOpEnvFn typedef to translate.h together
2
add MemTxAttrs as an argument to flatview_extend_translation().
2
with the other similar typedefs.
3
Its callers either have an attrs value to hand, or don't care
4
and can use MEMTXATTRS_UNSPECIFIED.
5
3
6
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4
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>
5
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
9
Message-id: 20180521140402.23318-7-peter.maydell@linaro.org
6
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
7
Message-id: 20210430132740.10391-12-peter.maydell@linaro.org
10
---
8
---
11
exec.c | 15 ++++++++++-----
9
target/arm/translate.h | 2 ++
12
1 file changed, 10 insertions(+), 5 deletions(-)
10
target/arm/translate.c | 3 ---
11
2 files changed, 2 insertions(+), 3 deletions(-)
13
12
14
diff --git a/exec.c b/exec.c
13
diff --git a/target/arm/translate.h b/target/arm/translate.h
15
index XXXXXXX..XXXXXXX 100644
14
index XXXXXXX..XXXXXXX 100644
16
--- a/exec.c
15
--- a/target/arm/translate.h
17
+++ b/exec.c
16
+++ b/target/arm/translate.h
18
@@ -XXX,XX +XXX,XX @@ bool address_space_access_valid(AddressSpace *as, hwaddr addr,
17
@@ -XXX,XX +XXX,XX @@ typedef void NeonGenOneOpFn(TCGv_i32, TCGv_i32);
19
18
typedef void NeonGenOneOpEnvFn(TCGv_i32, TCGv_ptr, TCGv_i32);
20
static hwaddr
19
typedef void NeonGenTwoOpFn(TCGv_i32, TCGv_i32, TCGv_i32);
21
flatview_extend_translation(FlatView *fv, hwaddr addr,
20
typedef void NeonGenTwoOpEnvFn(TCGv_i32, TCGv_ptr, TCGv_i32, TCGv_i32);
22
- hwaddr target_len,
21
+typedef void NeonGenThreeOpEnvFn(TCGv_i32, TCGv_env, TCGv_i32,
23
- MemoryRegion *mr, hwaddr base, hwaddr len,
22
+ TCGv_i32, TCGv_i32);
24
- bool is_write)
23
typedef void NeonGenTwo64OpFn(TCGv_i64, TCGv_i64, TCGv_i64);
25
+ hwaddr target_len,
24
typedef void NeonGenTwo64OpEnvFn(TCGv_i64, TCGv_ptr, TCGv_i64, TCGv_i64);
26
+ MemoryRegion *mr, hwaddr base, hwaddr len,
25
typedef void NeonGenNarrowFn(TCGv_i32, TCGv_i64);
27
+ bool is_write, MemTxAttrs attrs)
26
diff --git a/target/arm/translate.c b/target/arm/translate.c
28
{
27
index XXXXXXX..XXXXXXX 100644
29
hwaddr done = 0;
28
--- a/target/arm/translate.c
30
hwaddr xlat;
29
+++ b/target/arm/translate.c
31
@@ -XXX,XX +XXX,XX @@ void *address_space_map(AddressSpace *as,
30
@@ -XXX,XX +XXX,XX @@ static const char * const regnames[] =
32
31
{ "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
33
memory_region_ref(mr);
32
"r8", "r9", "r10", "r11", "r12", "r13", "r14", "pc" };
34
*plen = flatview_extend_translation(fv, addr, len, mr, xlat,
33
35
- l, is_write);
34
-/* Function prototypes for gen_ functions calling Neon helpers. */
36
+ l, is_write, attrs);
35
-typedef void NeonGenThreeOpEnvFn(TCGv_i32, TCGv_env, TCGv_i32,
37
ptr = qemu_ram_ptr_length(mr->ram_block, xlat, plen, true);
36
- TCGv_i32, TCGv_i32);
38
rcu_read_unlock();
37
39
38
/* initialize TCG globals. */
40
@@ -XXX,XX +XXX,XX @@ int64_t address_space_cache_init(MemoryRegionCache *cache,
39
void arm_translate_init(void)
41
mr = cache->mrs.mr;
42
memory_region_ref(mr);
43
if (memory_access_is_direct(mr, is_write)) {
44
+ /* We don't care about the memory attributes here as we're only
45
+ * doing this if we found actual RAM, which behaves the same
46
+ * regardless of attributes; so UNSPECIFIED is fine.
47
+ */
48
l = flatview_extend_translation(cache->fv, addr, len, mr,
49
- cache->xlat, l, is_write);
50
+ cache->xlat, l, is_write,
51
+ MEMTXATTRS_UNSPECIFIED);
52
cache->ptr = qemu_ram_ptr_length(mr->ram_block, cache->xlat, &l, true);
53
} else {
54
cache->ptr = NULL;
55
--
40
--
56
2.17.1
41
2.20.1
57
42
58
43
diff view generated by jsdifflib
1
As part of plumbing MemTxAttrs down to the IOMMU translate method,
1
Make the remaining functions needed by the translate-neon code
2
add MemTxAttrs as an argument to flatview_access_valid().
2
global.
3
Its callers now all have an attrs value to hand, so we can
4
correct our earlier temporary use of MEMTXATTRS_UNSPECIFIED.
5
3
6
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
5
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
8
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
6
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
9
Message-id: 20180521140402.23318-10-peter.maydell@linaro.org
7
Message-id: 20210430132740.10391-13-peter.maydell@linaro.org
10
---
8
---
11
exec.c | 12 +++++-------
9
target/arm/translate-a32.h | 8 ++++++++
12
1 file changed, 5 insertions(+), 7 deletions(-)
10
target/arm/translate.c | 10 ++--------
11
2 files changed, 10 insertions(+), 8 deletions(-)
13
12
14
diff --git a/exec.c b/exec.c
13
diff --git a/target/arm/translate-a32.h b/target/arm/translate-a32.h
15
index XXXXXXX..XXXXXXX 100644
14
index XXXXXXX..XXXXXXX 100644
16
--- a/exec.c
15
--- a/target/arm/translate-a32.h
17
+++ b/exec.c
16
+++ b/target/arm/translate-a32.h
18
@@ -XXX,XX +XXX,XX @@ static MemTxResult flatview_read(FlatView *fv, hwaddr addr,
17
@@ -XXX,XX +XXX,XX @@ void gen_set_pc_im(DisasContext *s, target_ulong val);
19
static MemTxResult flatview_write(FlatView *fv, hwaddr addr, MemTxAttrs attrs,
18
void gen_lookup_tb(DisasContext *s);
20
const uint8_t *buf, int len);
19
long vfp_reg_offset(bool dp, unsigned reg);
21
static bool flatview_access_valid(FlatView *fv, hwaddr addr, int len,
20
long neon_full_reg_offset(unsigned reg);
22
- bool is_write);
21
+long neon_element_offset(int reg, int element, MemOp memop);
23
+ bool is_write, MemTxAttrs attrs);
22
+void gen_rev16(TCGv_i32 dest, TCGv_i32 var);
24
23
25
static MemTxResult subpage_read(void *opaque, hwaddr addr, uint64_t *data,
24
static inline TCGv_i32 load_cpu_offset(int offset)
26
unsigned len, MemTxAttrs attrs)
25
{
27
@@ -XXX,XX +XXX,XX @@ static bool subpage_accepts(void *opaque, hwaddr addr,
26
@@ -XXX,XX +XXX,XX @@ DO_GEN_ST(32, MO_UL)
27
/* Set NZCV flags from the high 4 bits of var. */
28
#define gen_set_nzcv(var) gen_set_cpsr(var, CPSR_NZCV)
29
30
+/* Swap low and high halfwords. */
31
+static inline void gen_swap_half(TCGv_i32 dest, TCGv_i32 var)
32
+{
33
+ tcg_gen_rotri_i32(dest, var, 16);
34
+}
35
+
28
#endif
36
#endif
29
37
diff --git a/target/arm/translate.c b/target/arm/translate.c
30
return flatview_access_valid(subpage->fv, addr + subpage->base,
38
index XXXXXXX..XXXXXXX 100644
31
- len, is_write);
39
--- a/target/arm/translate.c
32
+ len, is_write, attrs);
40
+++ b/target/arm/translate.c
41
@@ -XXX,XX +XXX,XX @@ static void gen_smul_dual(TCGv_i32 a, TCGv_i32 b)
33
}
42
}
34
43
35
static const MemoryRegionOps subpage_ops = {
44
/* Byteswap each halfword. */
36
@@ -XXX,XX +XXX,XX @@ static void cpu_notify_map_clients(void)
45
-static void gen_rev16(TCGv_i32 dest, TCGv_i32 var)
46
+void gen_rev16(TCGv_i32 dest, TCGv_i32 var)
47
{
48
TCGv_i32 tmp = tcg_temp_new_i32();
49
TCGv_i32 mask = tcg_const_i32(0x00ff00ff);
50
@@ -XXX,XX +XXX,XX @@ static void gen_revsh(TCGv_i32 dest, TCGv_i32 var)
51
tcg_gen_ext16s_i32(dest, var);
37
}
52
}
38
53
39
static bool flatview_access_valid(FlatView *fv, hwaddr addr, int len,
54
-/* Swap low and high halfwords. */
40
- bool is_write)
55
-static void gen_swap_half(TCGv_i32 dest, TCGv_i32 var)
41
+ bool is_write, MemTxAttrs attrs)
56
-{
57
- tcg_gen_rotri_i32(dest, var, 16);
58
-}
59
-
60
/* Dual 16-bit add. Result placed in t0 and t1 is marked as dead.
61
tmp = (t0 ^ t1) & 0x8000;
62
t0 &= ~0x8000;
63
@@ -XXX,XX +XXX,XX @@ long neon_full_reg_offset(unsigned reg)
64
* Return the offset of a 2**SIZE piece of a NEON register, at index ELE,
65
* where 0 is the least significant end of the register.
66
*/
67
-static long neon_element_offset(int reg, int element, MemOp memop)
68
+long neon_element_offset(int reg, int element, MemOp memop)
42
{
69
{
43
MemoryRegion *mr;
70
int element_size = 1 << (memop & MO_SIZE);
44
hwaddr l, xlat;
71
int ofs = element * element_size;
45
@@ -XXX,XX +XXX,XX @@ static bool flatview_access_valid(FlatView *fv, hwaddr addr, int len,
46
mr = flatview_translate(fv, addr, &xlat, &l, is_write);
47
if (!memory_access_is_direct(mr, is_write)) {
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
}
65
--
72
--
66
2.17.1
73
2.20.1
67
74
68
75
diff view generated by jsdifflib
1
As part of plumbing MemTxAttrs down to the IOMMU translate method,
1
Switch translate-neon.c.inc from being #included into translate.c
2
add MemTxAttrs as an argument to address_space_translate()
2
to being its own compilation unit.
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
3
6
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
5
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
8
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
6
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
9
Message-id: 20180521140402.23318-4-peter.maydell@linaro.org
7
Message-id: 20210430132740.10391-14-peter.maydell@linaro.org
10
---
8
---
11
include/exec/memory.h | 4 +++-
9
target/arm/translate-a32.h | 3 +++
12
accel/tcg/translate-all.c | 2 +-
10
.../arm/{translate-neon.c.inc => translate-neon.c} | 12 +++++++-----
13
exec.c | 14 +++++++++-----
11
target/arm/translate.c | 3 ---
14
hw/vfio/common.c | 3 ++-
12
target/arm/meson.build | 7 ++++---
15
memory_ldst.inc.c | 18 +++++++++---------
13
4 files changed, 14 insertions(+), 11 deletions(-)
16
target/riscv/helper.c | 2 +-
14
rename target/arm/{translate-neon.c.inc => translate-neon.c} (99%)
17
6 files changed, 25 insertions(+), 18 deletions(-)
18
15
19
diff --git a/include/exec/memory.h b/include/exec/memory.h
16
diff --git a/target/arm/translate-a32.h b/target/arm/translate-a32.h
20
index XXXXXXX..XXXXXXX 100644
17
index XXXXXXX..XXXXXXX 100644
21
--- a/include/exec/memory.h
18
--- a/target/arm/translate-a32.h
22
+++ b/include/exec/memory.h
19
+++ b/target/arm/translate-a32.h
23
@@ -XXX,XX +XXX,XX @@ IOMMUTLBEntry address_space_get_iotlb_entry(AddressSpace *as, hwaddr addr,
20
@@ -XXX,XX +XXX,XX @@
24
* #MemoryRegion.
21
bool disas_m_nocp(DisasContext *dc, uint32_t insn);
25
* @len: pointer to length
22
bool disas_vfp(DisasContext *s, uint32_t insn);
26
* @is_write: indicates the transfer direction
23
bool disas_vfp_uncond(DisasContext *s, uint32_t insn);
27
+ * @attrs: memory attributes
24
+bool disas_neon_dp(DisasContext *s, uint32_t insn);
25
+bool disas_neon_ls(DisasContext *s, uint32_t insn);
26
+bool disas_neon_shared(DisasContext *s, uint32_t insn);
27
28
void load_reg_var(DisasContext *s, TCGv_i32 var, int reg);
29
void arm_gen_condlabel(DisasContext *s);
30
diff --git a/target/arm/translate-neon.c.inc b/target/arm/translate-neon.c
31
similarity index 99%
32
rename from target/arm/translate-neon.c.inc
33
rename to target/arm/translate-neon.c
34
index XXXXXXX..XXXXXXX 100644
35
--- a/target/arm/translate-neon.c.inc
36
+++ b/target/arm/translate-neon.c
37
@@ -XXX,XX +XXX,XX @@
38
* License along with this library; if not, see <http://www.gnu.org/licenses/>.
28
*/
39
*/
29
MemoryRegion *flatview_translate(FlatView *fv,
40
30
hwaddr addr, hwaddr *xlat,
41
-/*
31
@@ -XXX,XX +XXX,XX @@ MemoryRegion *flatview_translate(FlatView *fv,
42
- * This file is intended to be included from translate.c; it uses
32
43
- * some macros and definitions provided by that file.
33
static inline MemoryRegion *address_space_translate(AddressSpace *as,
44
- * It might be possible to convert it to a standalone .c file eventually.
34
hwaddr addr, hwaddr *xlat,
45
- */
35
- hwaddr *len, bool is_write)
46
+#include "qemu/osdep.h"
36
+ hwaddr *len, bool is_write,
47
+#include "tcg/tcg-op.h"
37
+ MemTxAttrs attrs)
48
+#include "tcg/tcg-op-gvec.h"
49
+#include "exec/exec-all.h"
50
+#include "exec/gen-icount.h"
51
+#include "translate.h"
52
+#include "translate-a32.h"
53
54
static inline int plus1(DisasContext *s, int x)
38
{
55
{
39
return flatview_translate(address_space_to_flatview(as),
56
diff --git a/target/arm/translate.c b/target/arm/translate.c
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
57
index XXXXXXX..XXXXXXX 100644
43
--- a/accel/tcg/translate-all.c
58
--- a/target/arm/translate.c
44
+++ b/accel/tcg/translate-all.c
59
+++ b/target/arm/translate.c
45
@@ -XXX,XX +XXX,XX @@ void tb_invalidate_phys_addr(AddressSpace *as, hwaddr addr, MemTxAttrs attrs)
60
@@ -XXX,XX +XXX,XX @@ void write_neon_element64(TCGv_i64 src, int reg, int ele, MemOp memop)
46
hwaddr l = 1;
61
47
62
#define ARM_CP_RW_BIT (1 << 20)
48
rcu_read_lock();
63
49
- mr = address_space_translate(as, addr, &addr, &l, false);
64
-/* Include the Neon decoder */
50
+ mr = address_space_translate(as, addr, &addr, &l, false, attrs);
65
-#include "translate-neon.c.inc"
51
if (!(memory_region_is_ram(mr)
66
-
52
|| memory_region_is_romd(mr))) {
67
static inline void iwmmxt_load_reg(TCGv_i64 var, int reg)
53
rcu_read_unlock();
68
{
54
diff --git a/exec.c b/exec.c
69
tcg_gen_ld_i64(var, cpu_env, offsetof(CPUARMState, iwmmxt.regs[reg]));
70
diff --git a/target/arm/meson.build b/target/arm/meson.build
55
index XXXXXXX..XXXXXXX 100644
71
index XXXXXXX..XXXXXXX 100644
56
--- a/exec.c
72
--- a/target/arm/meson.build
57
+++ b/exec.c
73
+++ b/target/arm/meson.build
58
@@ -XXX,XX +XXX,XX @@ static inline void cpu_physical_memory_write_rom_internal(AddressSpace *as,
74
@@ -XXX,XX +XXX,XX @@
59
rcu_read_lock();
75
gen = [
60
while (len > 0) {
76
decodetree.process('sve.decode', extra_args: '--decode=disas_sve'),
61
l = len;
77
- decodetree.process('neon-shared.decode', extra_args: '--static-decode=disas_neon_shared'),
62
- mr = address_space_translate(as, addr, &addr1, &l, true);
78
- decodetree.process('neon-dp.decode', extra_args: '--static-decode=disas_neon_dp'),
63
+ mr = address_space_translate(as, addr, &addr1, &l, true,
79
- decodetree.process('neon-ls.decode', extra_args: '--static-decode=disas_neon_ls'),
64
+ MEMTXATTRS_UNSPECIFIED);
80
+ decodetree.process('neon-shared.decode', extra_args: '--decode=disas_neon_shared'),
65
81
+ decodetree.process('neon-dp.decode', extra_args: '--decode=disas_neon_dp'),
66
if (!(memory_region_is_ram(mr) ||
82
+ decodetree.process('neon-ls.decode', extra_args: '--decode=disas_neon_ls'),
67
memory_region_is_romd(mr))) {
83
decodetree.process('vfp.decode', extra_args: '--decode=disas_vfp'),
68
@@ -XXX,XX +XXX,XX @@ void address_space_cache_destroy(MemoryRegionCache *cache)
84
decodetree.process('vfp-uncond.decode', extra_args: '--decode=disas_vfp_uncond'),
69
*/
85
decodetree.process('m-nocp.decode', extra_args: '--decode=disas_m_nocp'),
70
static inline MemoryRegion *address_space_translate_cached(
86
@@ -XXX,XX +XXX,XX @@ arm_ss.add(files(
71
MemoryRegionCache *cache, hwaddr addr, hwaddr *xlat,
87
'tlb_helper.c',
72
- hwaddr *plen, bool is_write)
88
'translate.c',
73
+ hwaddr *plen, bool is_write, MemTxAttrs attrs)
89
'translate-m-nocp.c',
74
{
90
+ 'translate-neon.c',
75
MemoryRegionSection section;
91
'translate-vfp.c',
76
MemoryRegion *mr;
92
'vec_helper.c',
77
@@ -XXX,XX +XXX,XX @@ address_space_read_cached_slow(MemoryRegionCache *cache, hwaddr addr,
93
'vfp_helper.c',
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
--
94
--
220
2.17.1
95
2.20.1
221
96
222
97
diff view generated by jsdifflib
1
From: Shannon Zhao <zhaoshenglong@huawei.com>
1
The WFI insn is not system-mode only, though it doesn't usually make
2
a huge amount of sense for userspace code to execute it. Currently
3
if you try it in qemu-arm then the helper function will raise an
4
EXCP_HLT exception, which is not covered by the switch in cpu_loop()
5
and results in an abort:
2
6
3
kvm_irqchip_create called by kvm_init will call kvm_init_irq_routing to
7
qemu: unhandled CPU exception 0x10001 - aborting
4
initialize global capability variables. If we call kvm_init_irq_routing in
8
R00=00000001 R01=408003e4 R02=408003ec R03=000102ec
5
GIC realize function, previous allocated memory will leak.
9
R04=00010a28 R05=00010158 R06=00087460 R07=00010158
10
R08=00000000 R09=00000000 R10=00085b7c R11=408002a4
11
R12=408002b8 R13=408002a0 R14=0001057c R15=000102f8
12
PSR=60000010 -ZC- A usr32
13
qemu:handle_cpu_signal received signal outside vCPU context @ pc=0x7fcbfa4f0a12
6
14
7
Fix this by deleting the unnecessary call.
15
Make the WFI helper function return immediately in the usermode
16
emulator. This turns WFI into a NOP, which is OK because:
17
* architecturally "WFI is a NOP" is a permitted implementation
18
* aarch64 Linux kernels use the SCTLR_EL1.nTWI bit to trap
19
userspace WFI and NOP it (though aarch32 kernels currently
20
just let WFI do whatever it would do)
8
21
9
Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com>
22
We could in theory make the translate.c code special case user-mode
10
Reviewed-by: Eric Auger <eric.auger@redhat.com>
23
emulation and NOP the insn entirely rather than making the helper
11
Message-id: 1527750994-14360-1-git-send-email-zhaoshenglong@huawei.com
24
do nothing, but because no real world code will be trying to
25
execute WFI we don't care about efficiency and the helper provides
26
a single place where we can make the change rather than having
27
to touch multiple places in translate.c and translate-a64.c.
28
29
Fixes: https://bugs.launchpad.net/qemu/+bug/1926759
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
30
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
31
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
32
Message-id: 20210430162212.825-1-peter.maydell@linaro.org
13
---
33
---
14
hw/intc/arm_gic_kvm.c | 1 -
34
target/arm/op_helper.c | 12 ++++++++++++
15
hw/intc/arm_gicv3_kvm.c | 1 -
35
1 file changed, 12 insertions(+)
16
2 files changed, 2 deletions(-)
17
36
18
diff --git a/hw/intc/arm_gic_kvm.c b/hw/intc/arm_gic_kvm.c
37
diff --git a/target/arm/op_helper.c b/target/arm/op_helper.c
19
index XXXXXXX..XXXXXXX 100644
38
index XXXXXXX..XXXXXXX 100644
20
--- a/hw/intc/arm_gic_kvm.c
39
--- a/target/arm/op_helper.c
21
+++ b/hw/intc/arm_gic_kvm.c
40
+++ b/target/arm/op_helper.c
22
@@ -XXX,XX +XXX,XX @@ static void kvm_arm_gic_realize(DeviceState *dev, Error **errp)
41
@@ -XXX,XX +XXX,XX @@ static inline int check_wfx_trap(CPUARMState *env, bool is_wfe)
23
42
24
if (kvm_has_gsi_routing()) {
43
void HELPER(wfi)(CPUARMState *env, uint32_t insn_len)
25
/* set up irq routing */
44
{
26
- kvm_init_irq_routing(kvm_state);
45
+#ifdef CONFIG_USER_ONLY
27
for (i = 0; i < s->num_irq - GIC_INTERNAL; ++i) {
46
+ /*
28
kvm_irqchip_add_irq_route(kvm_state, i, 0, i);
47
+ * WFI in the user-mode emulator is technically permitted but not
29
}
48
+ * something any real-world code would do. AArch64 Linux kernels
30
diff --git a/hw/intc/arm_gicv3_kvm.c b/hw/intc/arm_gicv3_kvm.c
49
+ * trap it via SCTRL_EL1.nTWI and make it an (expensive) NOP;
31
index XXXXXXX..XXXXXXX 100644
50
+ * AArch32 kernels don't trap it so it will delay a bit.
32
--- a/hw/intc/arm_gicv3_kvm.c
51
+ * For QEMU, make it NOP here, because trying to raise EXCP_HLT
33
+++ b/hw/intc/arm_gicv3_kvm.c
52
+ * would trigger an abort.
34
@@ -XXX,XX +XXX,XX @@ static void kvm_arm_gicv3_realize(DeviceState *dev, Error **errp)
53
+ */
35
54
+ return;
36
if (kvm_has_gsi_routing()) {
55
+#else
37
/* set up irq routing */
56
CPUState *cs = env_cpu(env);
38
- kvm_init_irq_routing(kvm_state);
57
int target_el = check_wfx_trap(env, false);
39
for (i = 0; i < s->num_irq - GIC_INTERNAL; ++i) {
58
40
kvm_irqchip_add_irq_route(kvm_state, i, 0, i);
59
@@ -XXX,XX +XXX,XX @@ void HELPER(wfi)(CPUARMState *env, uint32_t insn_len)
41
}
60
cs->exception_index = EXCP_HLT;
61
cs->halted = 1;
62
cpu_loop_exit(cs);
63
+#endif
64
}
65
66
void HELPER(wfe)(CPUARMState *env)
42
--
67
--
43
2.17.1
68
2.20.1
44
69
45
70
diff view generated by jsdifflib
1
As part of plumbing MemTxAttrs down to the IOMMU translate method,
1
The omap_mmc_reset() function resets its SD card via
2
add MemTxAttrs as an argument to address_space_translate_iommu().
2
device_legacy_reset(). We know that the SD card does not have a qbus
3
of its own, so the new device_cold_reset() function (which resets
4
both the device and its child buses) is equivalent here to
5
device_legacy_reset() and we can just switch to the new API.
3
6
4
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
8
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
6
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
9
Message-id: 20210430222348.8514-1-peter.maydell@linaro.org
7
Message-id: 20180521140402.23318-14-peter.maydell@linaro.org
8
---
10
---
9
exec.c | 8 +++++---
11
hw/sd/omap_mmc.c | 2 +-
10
1 file changed, 5 insertions(+), 3 deletions(-)
12
1 file changed, 1 insertion(+), 1 deletion(-)
11
13
12
diff --git a/exec.c b/exec.c
14
diff --git a/hw/sd/omap_mmc.c b/hw/sd/omap_mmc.c
13
index XXXXXXX..XXXXXXX 100644
15
index XXXXXXX..XXXXXXX 100644
14
--- a/exec.c
16
--- a/hw/sd/omap_mmc.c
15
+++ b/exec.c
17
+++ b/hw/sd/omap_mmc.c
16
@@ -XXX,XX +XXX,XX @@ address_space_translate_internal(AddressSpaceDispatch *d, hwaddr addr, hwaddr *x
18
@@ -XXX,XX +XXX,XX @@ void omap_mmc_reset(struct omap_mmc_s *host)
17
* @is_write: whether the translation operation is for write
19
* into any bus, and we must reset it manually. When omap_mmc is
18
* @is_mmio: whether this can be MMIO, set true if it can
20
* QOMified this must move into the QOM reset function.
19
* @target_as: the address space targeted by the IOMMU
21
*/
20
+ * @attrs: transaction attributes
22
- device_legacy_reset(DEVICE(host->card));
21
*
23
+ device_cold_reset(DEVICE(host->card));
22
* This function is called from RCU critical section. It is the common
23
* part of flatview_do_translate and address_space_translate_cached.
24
@@ -XXX,XX +XXX,XX @@ static MemoryRegionSection address_space_translate_iommu(IOMMUMemoryRegion *iomm
25
hwaddr *page_mask_out,
26
bool is_write,
27
bool is_mmio,
28
- AddressSpace **target_as)
29
+ AddressSpace **target_as,
30
+ MemTxAttrs attrs)
31
{
32
MemoryRegionSection *section;
33
hwaddr page_mask = (hwaddr)-1;
34
@@ -XXX,XX +XXX,XX @@ static MemoryRegionSection flatview_do_translate(FlatView *fv,
35
return address_space_translate_iommu(iommu_mr, xlat,
36
plen_out, page_mask_out,
37
is_write, is_mmio,
38
- target_as);
39
+ target_as, attrs);
40
}
41
if (page_mask_out) {
42
/* Not behind an IOMMU, use default page size. */
43
@@ -XXX,XX +XXX,XX @@ static inline MemoryRegion *address_space_translate_cached(
44
45
section = address_space_translate_iommu(iommu_mr, xlat, plen,
46
NULL, is_write, true,
47
- &target_as);
48
+ &target_as, attrs);
49
return section.mr;
50
}
24
}
51
25
26
static uint64_t omap_mmc_read(void *opaque, hwaddr offset,
52
--
27
--
53
2.17.1
28
2.20.1
54
29
55
30
diff view generated by jsdifflib
1
As part of plumbing MemTxAttrs down to the IOMMU translate method,
1
Both os-win32.h and os-posix.h include system header files. Instead
2
add MemTxAttrs as an argument to flatview_translate(); all its
2
of having osdep.h include them inside its 'extern "C"' block, make
3
callers now have attrs available.
3
these headers handle that themselves, so that we don't include the
4
system headers inside 'extern "C"'.
5
6
This doesn't fix any current problems, but it's conceptually the
7
right way to handle system headers.
4
8
5
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
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>
10
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
include/qemu/osdep.h | 8 ++++----
11
exec.c | 17 +++++++++--------
13
include/sysemu/os-posix.h | 8 ++++++++
12
2 files changed, 13 insertions(+), 11 deletions(-)
14
include/sysemu/os-win32.h | 8 ++++++++
15
3 files changed, 20 insertions(+), 4 deletions(-)
13
16
14
diff --git a/include/exec/memory.h b/include/exec/memory.h
17
diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h
15
index XXXXXXX..XXXXXXX 100644
18
index XXXXXXX..XXXXXXX 100644
16
--- a/include/exec/memory.h
19
--- a/include/qemu/osdep.h
17
+++ b/include/exec/memory.h
20
+++ b/include/qemu/osdep.h
18
@@ -XXX,XX +XXX,XX @@ IOMMUTLBEntry address_space_get_iotlb_entry(AddressSpace *as, hwaddr addr,
21
@@ -XXX,XX +XXX,XX @@ QEMU_EXTERN_C int daemon(int, int);
19
*/
22
*/
20
MemoryRegion *flatview_translate(FlatView *fv,
23
#include "glib-compat.h"
21
hwaddr addr, hwaddr *xlat,
24
22
- hwaddr *len, bool is_write);
25
-#ifdef __cplusplus
23
+ hwaddr *len, bool is_write,
26
-extern "C" {
24
+ MemTxAttrs attrs);
27
-#endif
25
28
-
26
static inline MemoryRegion *address_space_translate(AddressSpace *as,
29
#ifdef _WIN32
27
hwaddr addr, hwaddr *xlat,
30
#include "sysemu/os-win32.h"
28
@@ -XXX,XX +XXX,XX @@ static inline MemoryRegion *address_space_translate(AddressSpace *as,
31
#endif
29
MemTxAttrs attrs)
32
@@ -XXX,XX +XXX,XX @@ extern "C" {
30
{
33
#include "sysemu/os-posix.h"
31
return flatview_translate(address_space_to_flatview(as),
34
#endif
32
- addr, xlat, len, is_write);
35
33
+ addr, xlat, len, is_write, attrs);
36
+#ifdef __cplusplus
37
+extern "C" {
38
+#endif
39
+
40
#include "qemu/typedefs.h"
41
42
/*
43
diff --git a/include/sysemu/os-posix.h b/include/sysemu/os-posix.h
44
index XXXXXXX..XXXXXXX 100644
45
--- a/include/sysemu/os-posix.h
46
+++ b/include/sysemu/os-posix.h
47
@@ -XXX,XX +XXX,XX @@
48
#include <sys/sysmacros.h>
49
#endif
50
51
+#ifdef __cplusplus
52
+extern "C" {
53
+#endif
54
+
55
void os_set_line_buffering(void);
56
void os_set_proc_name(const char *s);
57
void os_setup_signal_handling(void);
58
@@ -XXX,XX +XXX,XX @@ static inline void qemu_funlockfile(FILE *f)
59
funlockfile(f);
34
}
60
}
35
61
36
/* address_space_access_valid: check for validity of accessing an address
62
+#ifdef __cplusplus
37
@@ -XXX,XX +XXX,XX @@ MemTxResult address_space_read(AddressSpace *as, hwaddr addr,
63
+}
38
rcu_read_lock();
64
+#endif
39
fv = address_space_to_flatview(as);
65
+
40
l = len;
66
#endif
41
- mr = flatview_translate(fv, addr, &addr1, &l, false);
67
diff --git a/include/sysemu/os-win32.h b/include/sysemu/os-win32.h
42
+ mr = flatview_translate(fv, addr, &addr1, &l, false, attrs);
43
if (len == l && memory_access_is_direct(mr, false)) {
44
ptr = qemu_map_ram_ptr(mr->ram_block, addr1);
45
memcpy(buf, ptr, len);
46
diff --git a/exec.c b/exec.c
47
index XXXXXXX..XXXXXXX 100644
68
index XXXXXXX..XXXXXXX 100644
48
--- a/exec.c
69
--- a/include/sysemu/os-win32.h
49
+++ b/exec.c
70
+++ b/include/sysemu/os-win32.h
50
@@ -XXX,XX +XXX,XX @@ iotlb_fail:
71
@@ -XXX,XX +XXX,XX @@
51
72
#include <windows.h>
52
/* Called from RCU critical section */
73
#include <ws2tcpip.h>
53
MemoryRegion *flatview_translate(FlatView *fv, hwaddr addr, hwaddr *xlat,
74
54
- hwaddr *plen, bool is_write)
75
+#ifdef __cplusplus
55
+ hwaddr *plen, bool is_write,
76
+extern "C" {
56
+ MemTxAttrs attrs)
77
+#endif
57
{
78
+
58
MemoryRegion *mr;
79
#if defined(_WIN64)
59
MemoryRegionSection section;
80
/* On w64, setjmp is implemented by _setjmp which needs a second parameter.
60
@@ -XXX,XX +XXX,XX @@ static MemTxResult flatview_write_continue(FlatView *fv, hwaddr addr,
81
* If this parameter is NULL, longjump does no stack unwinding.
61
}
82
@@ -XXX,XX +XXX,XX @@ ssize_t qemu_recv_wrap(int sockfd, void *buf, size_t len, int flags);
62
83
ssize_t qemu_recvfrom_wrap(int sockfd, void *buf, size_t len, int flags,
63
l = len;
84
struct sockaddr *addr, socklen_t *addrlen);
64
- mr = flatview_translate(fv, addr, &addr1, &l, true);
85
65
+ mr = flatview_translate(fv, addr, &addr1, &l, true, attrs);
86
+#ifdef __cplusplus
66
}
87
+}
67
88
+#endif
68
return result;
89
+
69
@@ -XXX,XX +XXX,XX @@ static MemTxResult flatview_write(FlatView *fv, hwaddr addr, MemTxAttrs attrs,
90
#endif
70
MemTxResult result = MEMTX_OK;
71
72
l = len;
73
- mr = flatview_translate(fv, addr, &addr1, &l, true);
74
+ mr = flatview_translate(fv, addr, &addr1, &l, true, attrs);
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
--
91
--
124
2.17.1
92
2.20.1
125
93
126
94
diff view generated by jsdifflib
1
Add entries to MAINTAINERS to cover the newer MPS2 boards and
1
Make bswap.h handle being included outside an 'extern "C"' block:
2
the new devices they use.
2
all system headers are included first, then all declarations are
3
put inside an 'extern "C"' block.
4
5
This requires a little rearrangement as currently we have an ifdef
6
ladder that has some system includes and some local declarations
7
or definitions, and we need to separate those out.
8
9
We want to do this because dis-asm.h includes bswap.h, dis-asm.h
10
may need to be included from C++ files, and system headers should
11
not be included within 'extern "C"' blocks.
3
12
4
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5
Message-id: 20180518153157.14899-1-peter.maydell@linaro.org
14
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
6
---
15
---
7
MAINTAINERS | 9 +++++++--
16
include/qemu/bswap.h | 26 ++++++++++++++++++++++----
8
1 file changed, 7 insertions(+), 2 deletions(-)
17
1 file changed, 22 insertions(+), 4 deletions(-)
9
18
10
diff --git a/MAINTAINERS b/MAINTAINERS
19
diff --git a/include/qemu/bswap.h b/include/qemu/bswap.h
11
index XXXXXXX..XXXXXXX 100644
20
index XXXXXXX..XXXXXXX 100644
12
--- a/MAINTAINERS
21
--- a/include/qemu/bswap.h
13
+++ b/MAINTAINERS
22
+++ b/include/qemu/bswap.h
14
@@ -XXX,XX +XXX,XX @@ F: hw/timer/cmsdk-apb-timer.c
23
@@ -XXX,XX +XXX,XX @@
15
F: include/hw/timer/cmsdk-apb-timer.h
24
#ifndef BSWAP_H
16
F: hw/char/cmsdk-apb-uart.c
25
#define BSWAP_H
17
F: include/hw/char/cmsdk-apb-uart.h
26
18
+F: hw/misc/tz-ppc.c
27
-#include "fpu/softfloat-types.h"
19
+F: include/hw/misc/tz-ppc.h
28
-
20
29
#ifdef CONFIG_MACHINE_BSWAP_H
21
ARM cores
30
# include <sys/endian.h>
22
M: Peter Maydell <peter.maydell@linaro.org>
31
# include <machine/bswap.h>
23
@@ -XXX,XX +XXX,XX @@ M: Peter Maydell <peter.maydell@linaro.org>
32
@@ -XXX,XX +XXX,XX @@
24
L: qemu-arm@nongnu.org
33
# include <endian.h>
25
S: Maintained
34
#elif defined(CONFIG_BYTESWAP_H)
26
F: hw/arm/mps2.c
35
# include <byteswap.h>
27
-F: hw/misc/mps2-scc.c
36
+#define BSWAP_FROM_BYTESWAP
28
-F: include/hw/misc/mps2-scc.h
37
+# else
29
+F: hw/arm/mps2-tz.c
38
+#define BSWAP_FROM_FALLBACKS
30
+F: hw/misc/mps2-*.c
39
+#endif /* ! CONFIG_MACHINE_BSWAP_H */
31
+F: include/hw/misc/mps2-*.h
40
32
+F: hw/arm/iotkit.c
41
+#ifdef __cplusplus
33
+F: include/hw/arm/iotkit.h
42
+extern "C" {
34
43
+#endif
35
Musicpal
44
+
36
M: Jan Kiszka <jan.kiszka@web.de>
45
+#include "fpu/softfloat-types.h"
46
+
47
+#ifdef BSWAP_FROM_BYTESWAP
48
static inline uint16_t bswap16(uint16_t x)
49
{
50
return bswap_16(x);
51
@@ -XXX,XX +XXX,XX @@ static inline uint64_t bswap64(uint64_t x)
52
{
53
return bswap_64(x);
54
}
55
-# else
56
+#endif
57
+
58
+#ifdef BSWAP_FROM_FALLBACKS
59
static inline uint16_t bswap16(uint16_t x)
60
{
61
return (((x & 0x00ff) << 8) |
62
@@ -XXX,XX +XXX,XX @@ static inline uint64_t bswap64(uint64_t x)
63
((x & 0x00ff000000000000ULL) >> 40) |
64
((x & 0xff00000000000000ULL) >> 56));
65
}
66
-#endif /* ! CONFIG_MACHINE_BSWAP_H */
67
+#endif
68
+
69
+#undef BSWAP_FROM_BYTESWAP
70
+#undef BSWAP_FROM_FALLBACKS
71
72
static inline void bswap16s(uint16_t *s)
73
{
74
@@ -XXX,XX +XXX,XX @@ DO_STN_LDN_P(be)
75
#undef le_bswaps
76
#undef be_bswaps
77
78
+#ifdef __cplusplus
79
+}
80
+#endif
81
+
82
#endif /* BSWAP_H */
37
--
83
--
38
2.17.1
84
2.20.1
39
85
40
86
diff view generated by jsdifflib
1
The FRECPX instructions should (like most other floating point operations)
1
Make dis-asm.h handle being included outside an 'extern "C"' block;
2
honour the FPCR.FZ bit which specifies whether input denormals should
2
this allows us to remove the 'extern "C"' blocks that our two C++
3
be flushed to zero (or FZ16 for the half-precision version).
3
files that include it are using.
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
4
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
6
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
10
Message-id: 20180521172712.19930-1-peter.maydell@linaro.org
11
---
7
---
12
target/arm/helper-a64.c | 6 ++++++
8
include/disas/dis-asm.h | 12 ++++++++++--
13
1 file changed, 6 insertions(+)
9
disas/arm-a64.cc | 2 --
10
disas/nanomips.cpp | 2 --
11
3 files changed, 10 insertions(+), 6 deletions(-)
14
12
15
diff --git a/target/arm/helper-a64.c b/target/arm/helper-a64.c
13
diff --git a/include/disas/dis-asm.h b/include/disas/dis-asm.h
16
index XXXXXXX..XXXXXXX 100644
14
index XXXXXXX..XXXXXXX 100644
17
--- a/target/arm/helper-a64.c
15
--- a/include/disas/dis-asm.h
18
+++ b/target/arm/helper-a64.c
16
+++ b/include/disas/dis-asm.h
19
@@ -XXX,XX +XXX,XX @@ float16 HELPER(frecpx_f16)(float16 a, void *fpstp)
17
@@ -XXX,XX +XXX,XX @@
20
return nan;
18
#ifndef DISAS_DIS_ASM_H
21
}
19
#define DISAS_DIS_ASM_H
22
20
23
+ a = float16_squash_input_denormal(a, fpst);
21
+#include "qemu/bswap.h"
24
+
22
+
25
val16 = float16_val(a);
23
+#ifdef __cplusplus
26
sbit = 0x8000 & val16;
24
+extern "C" {
27
exp = extract32(val16, 10, 5);
25
+#endif
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
+
26
+
34
val32 = float32_val(a);
27
typedef void *PTR;
35
sbit = 0x80000000ULL & val32;
28
typedef uint64_t bfd_vma;
36
exp = extract32(val32, 23, 8);
29
typedef int64_t bfd_signed_vma;
37
@@ -XXX,XX +XXX,XX @@ float64 HELPER(frecpx_f64)(float64 a, void *fpstp)
30
@@ -XXX,XX +XXX,XX @@ bool cap_disas_plugin(disassemble_info *info, uint64_t pc, size_t size);
38
return nan;
31
39
}
32
/* from libbfd */
40
33
41
+ a = float64_squash_input_denormal(a, fpst);
34
-#include "qemu/bswap.h"
35
-
36
static inline bfd_vma bfd_getl64(const bfd_byte *addr)
37
{
38
return ldq_le_p(addr);
39
@@ -XXX,XX +XXX,XX @@ static inline bfd_vma bfd_getb16(const bfd_byte *addr)
40
41
typedef bool bfd_boolean;
42
43
+#ifdef __cplusplus
44
+}
45
+#endif
42
+
46
+
43
val64 = float64_val(a);
47
#endif /* DISAS_DIS_ASM_H */
44
sbit = 0x8000000000000000ULL & val64;
48
diff --git a/disas/arm-a64.cc b/disas/arm-a64.cc
45
exp = extract64(float64_val(a), 52, 11);
49
index XXXXXXX..XXXXXXX 100644
50
--- a/disas/arm-a64.cc
51
+++ b/disas/arm-a64.cc
52
@@ -XXX,XX +XXX,XX @@
53
*/
54
55
#include "qemu/osdep.h"
56
-extern "C" {
57
#include "disas/dis-asm.h"
58
-}
59
60
#include "vixl/a64/disasm-a64.h"
61
62
diff --git a/disas/nanomips.cpp b/disas/nanomips.cpp
63
index XXXXXXX..XXXXXXX 100644
64
--- a/disas/nanomips.cpp
65
+++ b/disas/nanomips.cpp
66
@@ -XXX,XX +XXX,XX @@
67
*/
68
69
#include "qemu/osdep.h"
70
-extern "C" {
71
#include "disas/dis-asm.h"
72
-}
73
74
#include <cstring>
75
#include <stdexcept>
46
--
76
--
47
2.17.1
77
2.20.1
48
78
49
79
diff view generated by jsdifflib
1
From: Shannon Zhao <zhaoshenglong@huawei.com>
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
2
2
3
acpi_data_push uses g_array_set_size to resize the memory size. If there
3
The i.MX25 PDK board has 2 banks for SDRAM, each can
4
is no enough contiguous memory, the address will be changed. So previous
4
address up to 256 MiB. So the total RAM usable for this
5
pointer could not be used any more. It must update the pointer and use
5
board is 512M. When we ask for more we get a misleading
6
the new one.
6
error message:
7
7
8
Also, previous codes wrongly use le32 conversion of iort->node_offset
8
$ qemu-system-arm -M imx25-pdk -m 513M
9
for subsequent computations that will result incorrect value if host is
9
qemu-system-arm: Invalid RAM size, should be 128 MiB
10
not litlle endian. So use the non-converted one instead.
11
10
12
Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com>
11
Update the error message to better match the reality:
13
Reviewed-by: Eric Auger <eric.auger@redhat.com>
12
14
Message-id: 1527663951-14552-1-git-send-email-zhaoshenglong@huawei.com
13
$ qemu-system-arm -M imx25-pdk -m 513M
14
qemu-system-arm: RAM size more than 512 MiB is not supported
15
16
Fixes: bf350daae02 ("arm/imx25_pdk: drop RAM size fixup")
17
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
18
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
19
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
20
Message-id: 20210407225608.1882855-1-f4bug@amsat.org
15
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
21
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
16
---
22
---
17
hw/arm/virt-acpi-build.c | 20 +++++++++++++++-----
23
hw/arm/imx25_pdk.c | 5 ++---
18
1 file changed, 15 insertions(+), 5 deletions(-)
24
1 file changed, 2 insertions(+), 3 deletions(-)
19
25
20
diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c
26
diff --git a/hw/arm/imx25_pdk.c b/hw/arm/imx25_pdk.c
21
index XXXXXXX..XXXXXXX 100644
27
index XXXXXXX..XXXXXXX 100644
22
--- a/hw/arm/virt-acpi-build.c
28
--- a/hw/arm/imx25_pdk.c
23
+++ b/hw/arm/virt-acpi-build.c
29
+++ b/hw/arm/imx25_pdk.c
24
@@ -XXX,XX +XXX,XX @@ build_iort(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
30
@@ -XXX,XX +XXX,XX @@ static struct arm_boot_info imx25_pdk_binfo;
25
AcpiIortItsGroup *its;
31
26
AcpiIortTable *iort;
32
static void imx25_pdk_init(MachineState *machine)
27
AcpiIortSmmu3 *smmu;
33
{
28
- size_t node_size, iort_length, smmu_offset = 0;
34
- MachineClass *mc = MACHINE_GET_CLASS(machine);
29
+ size_t node_size, iort_node_offset, iort_length, smmu_offset = 0;
35
IMX25PDK *s = g_new0(IMX25PDK, 1);
30
AcpiIortRC *rc;
36
unsigned int ram_size;
31
37
unsigned int alias_offset;
32
iort = acpi_data_push(table_data, sizeof(*iort));
38
@@ -XXX,XX +XXX,XX @@ static void imx25_pdk_init(MachineState *machine)
33
@@ -XXX,XX +XXX,XX @@ build_iort(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
39
34
40
/* We need to initialize our memory */
35
iort_length = sizeof(*iort);
41
if (machine->ram_size > (FSL_IMX25_SDRAM0_SIZE + FSL_IMX25_SDRAM1_SIZE)) {
36
iort->node_count = cpu_to_le32(nb_nodes);
42
- char *sz = size_to_str(mc->default_ram_size);
37
- iort->node_offset = cpu_to_le32(sizeof(*iort));
43
- error_report("Invalid RAM size, should be %s", sz);
38
+ /*
44
+ char *sz = size_to_str(FSL_IMX25_SDRAM0_SIZE + FSL_IMX25_SDRAM1_SIZE);
39
+ * Use a copy in case table_data->data moves during acpi_data_push
45
+ error_report("RAM size more than %s is not supported", sz);
40
+ * operations.
46
g_free(sz);
41
+ */
47
exit(EXIT_FAILURE);
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
}
48
}
63
64
/* Root Complex Node */
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
--
49
--
82
2.17.1
50
2.20.1
83
51
84
52
diff view generated by jsdifflib
1
Provide a VMSTATE_BOOL_SUB_ARRAY to go with VMSTATE_UINT8_SUB_ARRAY
1
The MPS2 SCC device doesn't have any documentation of its properties;
2
and friends.
2
add a "QEMU interface" format comment describing them.
3
3
4
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
5
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
6
Message-id: 20180521140402.23318-23-peter.maydell@linaro.org
6
Message-id: 20210504120912.23094-2-peter.maydell@linaro.org
7
---
7
---
8
include/migration/vmstate.h | 3 +++
8
include/hw/misc/mps2-scc.h | 12 ++++++++++++
9
1 file changed, 3 insertions(+)
9
1 file changed, 12 insertions(+)
10
10
11
diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h
11
diff --git a/include/hw/misc/mps2-scc.h b/include/hw/misc/mps2-scc.h
12
index XXXXXXX..XXXXXXX 100644
12
index XXXXXXX..XXXXXXX 100644
13
--- a/include/migration/vmstate.h
13
--- a/include/hw/misc/mps2-scc.h
14
+++ b/include/migration/vmstate.h
14
+++ b/include/hw/misc/mps2-scc.h
15
@@ -XXX,XX +XXX,XX @@ extern const VMStateInfo vmstate_info_qtailq;
15
@@ -XXX,XX +XXX,XX @@
16
#define VMSTATE_BOOL_ARRAY(_f, _s, _n) \
16
* (at your option) any later version.
17
VMSTATE_BOOL_ARRAY_V(_f, _s, _n, 0)
17
*/
18
18
19
+#define VMSTATE_BOOL_SUB_ARRAY(_f, _s, _start, _num) \
19
+/*
20
+ VMSTATE_SUB_ARRAY(_f, _s, _start, _num, 0, vmstate_info_bool, bool)
20
+ * This is a model of the Serial Communication Controller (SCC)
21
+
21
+ * block found in most MPS FPGA images.
22
#define VMSTATE_UINT16_ARRAY_V(_f, _s, _n, _v) \
22
+ *
23
VMSTATE_ARRAY(_f, _s, _n, _v, vmstate_info_uint16, uint16_t)
23
+ * QEMU interface:
24
+ * + sysbus MMIO region 0: the register bank
25
+ * + QOM property "scc-cfg4": value of the read-only CFG4 register
26
+ * + QOM property "scc-aid": value of the read-only SCC_AID register
27
+ * + QOM property "scc-id": value of the read-only SCC_ID register
28
+ * + QOM property array "oscclk": reset values of the OSCCLK registers
29
+ * (which are accessed via the SYS_CFG channel provided by this device)
30
+ */
31
#ifndef MPS2_SCC_H
32
#define MPS2_SCC_H
24
33
25
--
34
--
26
2.17.1
35
2.20.1
27
36
28
37
diff view generated by jsdifflib
1
As part of plumbing MemTxAttrs down to the IOMMU translate method,
1
On some boards, SCC config register CFG0 bit 0 controls whether
2
add MemTxAttrs as an argument to address_space_access_valid().
2
parts of the board memory map are remapped. Support this with:
3
Its callers either have an attrs value to hand, or don't care
3
* a device property scc-cfg0 so the board can specify the
4
and can use MEMTXATTRS_UNSPECIFIED.
4
initial value of the CFG0 register
5
* an outbound GPIO line which tracks bit 0 and which the board
6
can wire up to provide the remapping
5
7
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
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
9
Message-id: 20180521140402.23318-6-peter.maydell@linaro.org
10
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
11
Message-id: 20210504120912.23094-3-peter.maydell@linaro.org
10
---
12
---
11
include/exec/memory.h | 4 +++-
13
include/hw/misc/mps2-scc.h | 9 +++++++++
12
include/sysemu/dma.h | 3 ++-
14
hw/misc/mps2-scc.c | 13 ++++++++++---
13
exec.c | 3 ++-
15
2 files changed, 19 insertions(+), 3 deletions(-)
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
16
20
diff --git a/include/exec/memory.h b/include/exec/memory.h
17
diff --git a/include/hw/misc/mps2-scc.h b/include/hw/misc/mps2-scc.h
21
index XXXXXXX..XXXXXXX 100644
18
index XXXXXXX..XXXXXXX 100644
22
--- a/include/exec/memory.h
19
--- a/include/hw/misc/mps2-scc.h
23
+++ b/include/exec/memory.h
20
+++ b/include/hw/misc/mps2-scc.h
24
@@ -XXX,XX +XXX,XX @@ static inline MemoryRegion *address_space_translate(AddressSpace *as,
21
@@ -XXX,XX +XXX,XX @@
25
* @addr: address within that address space
22
* + QOM property "scc-cfg4": value of the read-only CFG4 register
26
* @len: length of the area to be checked
23
* + QOM property "scc-aid": value of the read-only SCC_AID register
27
* @is_write: indicates the transfer direction
24
* + QOM property "scc-id": value of the read-only SCC_ID register
28
+ * @attrs: memory attributes
25
+ * + QOM property "scc-cfg0": reset value of the CFG0 register
26
* + QOM property array "oscclk": reset values of the OSCCLK registers
27
* (which are accessed via the SYS_CFG channel provided by this device)
28
+ * + named GPIO output "remap": this tracks the value of CFG0 register
29
+ * bit 0. Boards where this bit controls memory remapping should
30
+ * connect this GPIO line to a function performing that mapping.
31
+ * Boards where bit 0 has no special function should leave the GPIO
32
+ * output disconnected.
29
*/
33
*/
30
-bool address_space_access_valid(AddressSpace *as, hwaddr addr, int len, bool is_write);
34
#ifndef MPS2_SCC_H
31
+bool address_space_access_valid(AddressSpace *as, hwaddr addr, int len,
35
#define MPS2_SCC_H
32
+ bool is_write, MemTxAttrs attrs);
36
@@ -XXX,XX +XXX,XX @@ struct MPS2SCC {
33
37
uint32_t num_oscclk;
34
/* address_space_map: map a physical memory region into a host virtual address
38
uint32_t *oscclk;
35
*
39
uint32_t *oscclk_reset;
36
diff --git a/include/sysemu/dma.h b/include/sysemu/dma.h
40
+ uint32_t cfg0_reset;
41
+
42
+ qemu_irq remap;
43
};
44
45
#endif
46
diff --git a/hw/misc/mps2-scc.c b/hw/misc/mps2-scc.c
37
index XXXXXXX..XXXXXXX 100644
47
index XXXXXXX..XXXXXXX 100644
38
--- a/include/sysemu/dma.h
48
--- a/hw/misc/mps2-scc.c
39
+++ b/include/sysemu/dma.h
49
+++ b/hw/misc/mps2-scc.c
40
@@ -XXX,XX +XXX,XX @@ static inline bool dma_memory_valid(AddressSpace *as,
50
@@ -XXX,XX +XXX,XX @@
41
DMADirection dir)
51
#include "qemu/bitops.h"
42
{
52
#include "trace.h"
43
return address_space_access_valid(as, addr, len,
53
#include "hw/sysbus.h"
44
- dir == DMA_DIRECTION_FROM_DEVICE);
54
+#include "hw/irq.h"
45
+ dir == DMA_DIRECTION_FROM_DEVICE,
55
#include "migration/vmstate.h"
46
+ MEMTXATTRS_UNSPECIFIED);
56
#include "hw/registerfields.h"
57
#include "hw/misc/mps2-scc.h"
58
@@ -XXX,XX +XXX,XX @@ static void mps2_scc_write(void *opaque, hwaddr offset, uint64_t value,
59
switch (offset) {
60
case A_CFG0:
61
/*
62
- * TODO on some boards bit 0 controls RAM remapping;
63
- * on others bit 1 is CPU_WAIT.
64
+ * On some boards bit 0 controls board-specific remapping;
65
+ * we always reflect bit 0 in the 'remap' GPIO output line,
66
+ * and let the board wire it up or not as it chooses.
67
+ * TODO on some boards bit 1 is CPU_WAIT.
68
*/
69
s->cfg0 = value;
70
+ qemu_set_irq(s->remap, s->cfg0 & 1);
71
break;
72
case A_CFG1:
73
s->cfg1 = value;
74
@@ -XXX,XX +XXX,XX @@ static void mps2_scc_reset(DeviceState *dev)
75
int i;
76
77
trace_mps2_scc_reset();
78
- s->cfg0 = 0;
79
+ s->cfg0 = s->cfg0_reset;
80
s->cfg1 = 0;
81
s->cfg2 = 0;
82
s->cfg5 = 0;
83
@@ -XXX,XX +XXX,XX @@ static void mps2_scc_init(Object *obj)
84
85
memory_region_init_io(&s->iomem, obj, &mps2_scc_ops, s, "mps2-scc", 0x1000);
86
sysbus_init_mmio(sbd, &s->iomem);
87
+ qdev_init_gpio_out_named(DEVICE(obj), &s->remap, "remap", 1);
47
}
88
}
48
89
49
static inline int dma_memory_rw_relaxed(AddressSpace *as, dma_addr_t addr,
90
static void mps2_scc_realize(DeviceState *dev, Error **errp)
50
diff --git a/exec.c b/exec.c
91
@@ -XXX,XX +XXX,XX @@ static Property mps2_scc_properties[] = {
51
index XXXXXXX..XXXXXXX 100644
92
DEFINE_PROP_UINT32("scc-cfg4", MPS2SCC, cfg4, 0),
52
--- a/exec.c
93
DEFINE_PROP_UINT32("scc-aid", MPS2SCC, aid, 0),
53
+++ b/exec.c
94
DEFINE_PROP_UINT32("scc-id", MPS2SCC, id, 0),
54
@@ -XXX,XX +XXX,XX @@ static bool flatview_access_valid(FlatView *fv, hwaddr addr, int len,
95
+ /* Reset value for CFG0 register */
55
}
96
+ DEFINE_PROP_UINT32("scc-cfg0", MPS2SCC, cfg0_reset, 0),
56
97
/*
57
bool address_space_access_valid(AddressSpace *as, hwaddr addr,
98
* These are the initial settings for the source clocks on the board.
58
- int len, bool is_write)
99
* In hardware they can be configured via a config file read by the
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
--
100
--
131
2.17.1
101
2.20.1
132
102
133
103
diff view generated by jsdifflib
1
Add more detail to the documentation for memory_region_init_iommu()
1
The AN524 FPGA image supports two memory maps, which differ in where
2
and other IOMMU-related functions and data structures.
2
the QSPI and BRAM are. In the default map, the BRAM is at
3
0x0000_0000, and the QSPI at 0x2800_0000. In the second map, they
4
are the other way around.
5
6
In hardware, the initial mapping can be selected by the user by
7
writing either "REMAP: BRAM" (the default) or "REMAP: QSPI" in the
8
board configuration file. The board config file is acted on by the
9
"Motherboard Configuration Controller", which is an entirely separate
10
microcontroller on the dev board but outside the FPGA.
11
12
The guest can also dynamically change the mapping via the SCC
13
CFG_REG0 register.
14
15
Implement this functionality for QEMU, using a machine property
16
"remap" with valid values "BRAM" and "QSPI" to allow the user to set
17
the initial mapping, in the same way they can on the FPGA, and
18
wiring up the bit from the SCC register to also switch the mapping.
3
19
4
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
20
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
21
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
6
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
22
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
7
Reviewed-by: Eric Auger <eric.auger@redhat.com>
23
Message-id: 20210504120912.23094-4-peter.maydell@linaro.org
8
Message-id: 20180521140402.23318-2-peter.maydell@linaro.org
9
---
24
---
10
include/exec/memory.h | 105 ++++++++++++++++++++++++++++++++++++++----
25
docs/system/arm/mps2.rst | 10 ++++
11
1 file changed, 95 insertions(+), 10 deletions(-)
26
hw/arm/mps2-tz.c | 108 ++++++++++++++++++++++++++++++++++++++-
12
27
2 files changed, 117 insertions(+), 1 deletion(-)
13
diff --git a/include/exec/memory.h b/include/exec/memory.h
28
29
diff --git a/docs/system/arm/mps2.rst b/docs/system/arm/mps2.rst
14
index XXXXXXX..XXXXXXX 100644
30
index XXXXXXX..XXXXXXX 100644
15
--- a/include/exec/memory.h
31
--- a/docs/system/arm/mps2.rst
16
+++ b/include/exec/memory.h
32
+++ b/docs/system/arm/mps2.rst
17
@@ -XXX,XX +XXX,XX @@ enum IOMMUMemoryRegionAttr {
33
@@ -XXX,XX +XXX,XX @@ Differences between QEMU and real hardware:
18
IOMMU_ATTR_SPAPR_TCE_FD
34
flash, but only as simple ROM, so attempting to rewrite the flash
35
from the guest will fail
36
- QEMU does not model the USB controller in MPS3 boards
37
+
38
+Machine-specific options
39
+""""""""""""""""""""""""
40
+
41
+The following machine-specific options are supported:
42
+
43
+remap
44
+ Supported for ``mps3-an524`` only.
45
+ Set ``BRAM``/``QSPI`` to select the initial memory mapping. The
46
+ default is ``BRAM``.
47
diff --git a/hw/arm/mps2-tz.c b/hw/arm/mps2-tz.c
48
index XXXXXXX..XXXXXXX 100644
49
--- a/hw/arm/mps2-tz.c
50
+++ b/hw/arm/mps2-tz.c
51
@@ -XXX,XX +XXX,XX @@
52
#include "hw/boards.h"
53
#include "exec/address-spaces.h"
54
#include "sysemu/sysemu.h"
55
+#include "sysemu/reset.h"
56
#include "hw/misc/unimp.h"
57
#include "hw/char/cmsdk-apb-uart.h"
58
#include "hw/timer/cmsdk-apb-timer.h"
59
@@ -XXX,XX +XXX,XX @@
60
#include "hw/core/split-irq.h"
61
#include "hw/qdev-clock.h"
62
#include "qom/object.h"
63
+#include "hw/irq.h"
64
65
#define MPS2TZ_NUMIRQ_MAX 96
66
#define MPS2TZ_RAM_MAX 5
67
@@ -XXX,XX +XXX,XX @@ struct MPS2TZMachineState {
68
SplitIRQ cpu_irq_splitter[MPS2TZ_NUMIRQ_MAX];
69
Clock *sysclk;
70
Clock *s32kclk;
71
+
72
+ bool remap;
73
+ qemu_irq remap_irq;
19
};
74
};
20
75
21
+/**
76
#define TYPE_MPS2TZ_MACHINE "mps2tz"
22
+ * IOMMUMemoryRegionClass:
77
@@ -XXX,XX +XXX,XX @@ static const RAMInfo an505_raminfo[] = { {
23
+ *
78
},
24
+ * All IOMMU implementations need to subclass TYPE_IOMMU_MEMORY_REGION
79
};
25
+ * and provide an implementation of at least the @translate method here
80
26
+ * to handle requests to the memory region. Other methods are optional.
81
+/*
27
+ *
82
+ * Note that the addresses and MPC numbering here should match up
28
+ * The IOMMU implementation must use the IOMMU notifier infrastructure
83
+ * with those used in remap_memory(), which can swap the BRAM and QSPI.
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
+ */
84
+ */
33
typedef struct IOMMUMemoryRegionClass {
85
static const RAMInfo an524_raminfo[] = { {
34
/* private */
86
.name = "bram",
35
struct DeviceClass parent_class;
87
.base = 0x00000000,
36
88
@@ -XXX,XX +XXX,XX @@ static MemoryRegion *make_scc(MPS2TZMachineState *mms, void *opaque,
37
/*
89
38
- * Return a TLB entry that contains a given address. Flag should
90
object_initialize_child(OBJECT(mms), "scc", scc, TYPE_MPS2_SCC);
39
- * be the access permission of this translation operation. We can
91
sccdev = DEVICE(scc);
40
- * set flag to IOMMU_NONE to mean that we don't need any
92
+ qdev_prop_set_uint32(sccdev, "scc-cfg0", mms->remap ? 1 : 0);
41
- * read/write permission checks, like, when for region replay.
93
qdev_prop_set_uint32(sccdev, "scc-cfg4", 0x2);
42
+ * Return a TLB entry that contains a given address.
94
qdev_prop_set_uint32(sccdev, "scc-aid", 0x00200008);
95
qdev_prop_set_uint32(sccdev, "scc-id", mmc->scc_id);
96
@@ -XXX,XX +XXX,XX @@ static MemoryRegion *make_mpc(MPS2TZMachineState *mms, void *opaque,
97
return sysbus_mmio_get_region(SYS_BUS_DEVICE(mpc), 0);
98
}
99
100
+static hwaddr boot_mem_base(MPS2TZMachineState *mms)
101
+{
102
+ /*
103
+ * Return the canonical address of the block which will be mapped
104
+ * at address 0x0 (i.e. where the vector table is).
105
+ * This is usually 0, but if the AN524 alternate memory map is
106
+ * enabled it will be the base address of the QSPI block.
107
+ */
108
+ return mms->remap ? 0x28000000 : 0;
109
+}
110
+
111
+static void remap_memory(MPS2TZMachineState *mms, int map)
112
+{
113
+ /*
114
+ * Remap the memory for the AN524. 'map' is the value of
115
+ * SCC CFG_REG0 bit 0, i.e. 0 for the default map and 1
116
+ * for the "option 1" mapping where QSPI is at address 0.
43
+ *
117
+ *
44
+ * The IOMMUAccessFlags indicated via @flag are optional and may
118
+ * Effectively we need to swap around the "upstream" ends of
45
+ * be specified as IOMMU_NONE to indicate that the caller needs
119
+ * MPC 0 and MPC 1.
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
+ */
120
+ */
74
uint64_t (*get_min_page_size)(IOMMUMemoryRegion *iommu);
121
+ MPS2TZMachineClass *mmc = MPS2TZ_MACHINE_GET_CLASS(mms);
75
- /* Called when IOMMU Notifier flag changed */
122
+ int i;
76
+ /* Called when IOMMU Notifier flag changes (ie when the set of
123
+
77
+ * events which IOMMU users are requesting notification for changes).
124
+ if (mmc->fpga_type != FPGA_AN524) {
78
+ * Optional method -- need not be provided if the IOMMU does not
125
+ return;
79
+ * need to know exactly which events must be notified.
126
+ }
80
+ *
127
+
81
+ * @iommu: the IOMMUMemoryRegion
128
+ memory_region_transaction_begin();
82
+ * @old_flags: events which previously needed to be notified
129
+ for (i = 0; i < 2; i++) {
83
+ * @new_flags: events which now need to be notified
130
+ TZMPC *mpc = &mms->mpc[i];
131
+ MemoryRegion *upstream = sysbus_mmio_get_region(SYS_BUS_DEVICE(mpc), 1);
132
+ hwaddr addr = (i ^ map) ? 0x28000000 : 0;
133
+
134
+ memory_region_set_address(upstream, addr);
135
+ }
136
+ memory_region_transaction_commit();
137
+}
138
+
139
+static void remap_irq_fn(void *opaque, int n, int level)
140
+{
141
+ MPS2TZMachineState *mms = opaque;
142
+
143
+ remap_memory(mms, level);
144
+}
145
+
146
static MemoryRegion *make_dma(MPS2TZMachineState *mms, void *opaque,
147
const char *name, hwaddr size,
148
const int *irqs)
149
@@ -XXX,XX +XXX,XX @@ static uint32_t boot_ram_size(MPS2TZMachineState *mms)
150
MPS2TZMachineClass *mmc = MPS2TZ_MACHINE_GET_CLASS(mms);
151
152
for (p = mmc->raminfo; p->name; p++) {
153
- if (p->base == 0) {
154
+ if (p->base == boot_mem_base(mms)) {
155
return p->size;
156
}
157
}
158
@@ -XXX,XX +XXX,XX @@ static void mps2tz_common_init(MachineState *machine)
159
160
create_non_mpc_ram(mms);
161
162
+ if (mmc->fpga_type == FPGA_AN524) {
163
+ /*
164
+ * Connect the line from the SCC so that we can remap when the
165
+ * guest updates that register.
166
+ */
167
+ mms->remap_irq = qemu_allocate_irq(remap_irq_fn, mms, 0);
168
+ qdev_connect_gpio_out_named(DEVICE(&mms->scc), "remap", 0,
169
+ mms->remap_irq);
170
+ }
171
+
172
armv7m_load_kernel(ARM_CPU(first_cpu), machine->kernel_filename,
173
boot_ram_size(mms));
174
}
175
@@ -XXX,XX +XXX,XX @@ static void mps2_tz_idau_check(IDAUInterface *ii, uint32_t address,
176
*iregion = region;
177
}
178
179
+static char *mps2_get_remap(Object *obj, Error **errp)
180
+{
181
+ MPS2TZMachineState *mms = MPS2TZ_MACHINE(obj);
182
+ const char *val = mms->remap ? "QSPI" : "BRAM";
183
+ return g_strdup(val);
184
+}
185
+
186
+static void mps2_set_remap(Object *obj, const char *value, Error **errp)
187
+{
188
+ MPS2TZMachineState *mms = MPS2TZ_MACHINE(obj);
189
+
190
+ if (!strcmp(value, "BRAM")) {
191
+ mms->remap = false;
192
+ } else if (!strcmp(value, "QSPI")) {
193
+ mms->remap = true;
194
+ } else {
195
+ error_setg(errp, "Invalid remap value");
196
+ error_append_hint(errp, "Valid values are BRAM and QSPI.\n");
197
+ }
198
+}
199
+
200
+static void mps2_machine_reset(MachineState *machine)
201
+{
202
+ MPS2TZMachineState *mms = MPS2TZ_MACHINE(machine);
203
+
204
+ /*
205
+ * Set the initial memory mapping before triggering the reset of
206
+ * the rest of the system, so that the guest image loader and CPU
207
+ * reset see the correct mapping.
84
+ */
208
+ */
85
void (*notify_flag_changed)(IOMMUMemoryRegion *iommu,
209
+ remap_memory(mms, mms->remap);
86
IOMMUNotifierFlag old_flags,
210
+ qemu_devices_reset();
87
IOMMUNotifierFlag new_flags);
211
+}
88
- /* Set this up to provide customized IOMMU replay function */
212
+
89
+ /* Called to handle memory_region_iommu_replay().
213
static void mps2tz_class_init(ObjectClass *oc, void *data)
90
+ *
214
{
91
+ * The default implementation of memory_region_iommu_replay() is to
215
MachineClass *mc = MACHINE_CLASS(oc);
92
+ * call the IOMMU translate method for every page in the address space
216
IDAUInterfaceClass *iic = IDAU_INTERFACE_CLASS(oc);
93
+ * with flag == IOMMU_NONE and then call the notifier if translate
217
94
+ * returns a valid mapping. If this method is implemented then it
218
mc->init = mps2tz_common_init;
95
+ * overrides the default behaviour, and must provide the full semantics
219
+ mc->reset = mps2_machine_reset;
96
+ * of memory_region_iommu_replay(), by calling @notifier for every
220
iic->check = mps2_tz_idau_check;
97
+ * translation present in the IOMMU.
221
}
98
+ *
222
99
+ * Optional method -- an IOMMU only needs to provide this method
223
@@ -XXX,XX +XXX,XX @@ static void mps3tz_an524_class_init(ObjectClass *oc, void *data)
100
+ * if the default is inefficient or produces undesirable side effects.
224
mmc->raminfo = an524_raminfo;
101
+ *
225
mmc->armsse_type = TYPE_SSE200;
102
+ * Note: this is not related to record-and-replay functionality.
226
mps2tz_set_default_ram_info(mmc);
103
+ */
227
+
104
void (*replay)(IOMMUMemoryRegion *iommu, IOMMUNotifier *notifier);
228
+ object_class_property_add_str(oc, "remap", mps2_get_remap, mps2_set_remap);
105
229
+ object_class_property_set_description(oc, "remap",
106
- /* Get IOMMU misc attributes */
230
+ "Set memory mapping. Valid values "
107
- int (*get_attr)(IOMMUMemoryRegion *iommu, enum IOMMUMemoryRegionAttr,
231
+ "are BRAM (default) and QSPI.");
108
+ /* Get IOMMU misc attributes. This is an optional method that
232
}
109
+ * can be used to allow users of the IOMMU to get implementation-specific
233
110
+ * information. The IOMMU implements this method to handle calls
234
static void mps3tz_an547_class_init(ObjectClass *oc, void *data)
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
--
235
--
172
2.17.1
236
2.20.1
173
237
174
238
diff view generated by jsdifflib
1
From: Paolo Bonzini <pbonzini@redhat.com>
1
From: Guenter Roeck <linux@roeck-us.net>
2
2
3
cpregs_keys is an uint32_t* so the allocation should use uint32_t.
3
Commit dfc388797cc4 ("hw/arm: xlnx: Set all boards' GEM 'phy-addr'
4
g_new is even better because it is type-safe.
4
property value to 23") configured the PHY address for xilinx-zynq-a9
5
to 23. When trying to boot xilinx-zynq-a9 with zynq-zc702.dtb or
6
zynq-zc706.dtb, this results in the following error message when
7
trying to use the Ethernet interface.
5
8
6
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
9
macb e000b000.ethernet eth0: Could not attach PHY (-19)
7
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
10
8
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
11
The devicetree files for ZC702 and ZC706 configure PHY address 7. The
12
documentation for the ZC702 and ZC706 evaluation boards suggest that the
13
PHY address is 7, not 23. Other boards use PHY address 0, 1, 3, or 7.
14
I was unable to find a documentation or a devicetree file suggesting
15
or using PHY address 23. The Ethernet interface starts working with
16
zynq-zc702.dtb and zynq-zc706.dtb when setting the PHY address to 7,
17
so let's use it.
18
19
Cc: Bin Meng <bin.meng@windriver.com>
20
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
21
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
22
Acked-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
23
Message-id: 20210504124140.1100346-1-linux@roeck-us.net
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
24
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
---
25
---
11
target/arm/gdbstub.c | 3 +--
26
hw/arm/xilinx_zynq.c | 2 +-
12
1 file changed, 1 insertion(+), 2 deletions(-)
27
1 file changed, 1 insertion(+), 1 deletion(-)
13
28
14
diff --git a/target/arm/gdbstub.c b/target/arm/gdbstub.c
29
diff --git a/hw/arm/xilinx_zynq.c b/hw/arm/xilinx_zynq.c
15
index XXXXXXX..XXXXXXX 100644
30
index XXXXXXX..XXXXXXX 100644
16
--- a/target/arm/gdbstub.c
31
--- a/hw/arm/xilinx_zynq.c
17
+++ b/target/arm/gdbstub.c
32
+++ b/hw/arm/xilinx_zynq.c
18
@@ -XXX,XX +XXX,XX @@ int arm_gen_dynamic_xml(CPUState *cs)
33
@@ -XXX,XX +XXX,XX @@ static void gem_init(NICInfo *nd, uint32_t base, qemu_irq irq)
19
RegisterSysregXmlParam param = {cs, s};
34
qemu_check_nic_model(nd, TYPE_CADENCE_GEM);
20
35
qdev_set_nic_properties(dev, nd);
21
cpu->dyn_xml.num_cpregs = 0;
36
}
22
- cpu->dyn_xml.cpregs_keys = g_malloc(sizeof(uint32_t *) *
37
- object_property_set_int(OBJECT(dev), "phy-addr", 23, &error_abort);
23
- g_hash_table_size(cpu->cp_regs));
38
+ object_property_set_int(OBJECT(dev), "phy-addr", 7, &error_abort);
24
+ cpu->dyn_xml.cpregs_keys = g_new(uint32_t, g_hash_table_size(cpu->cp_regs));
39
s = SYS_BUS_DEVICE(dev);
25
g_string_printf(s, "<?xml version=\"1.0\"?>");
40
sysbus_realize_and_unref(s, &error_fatal);
26
g_string_append_printf(s, "<!DOCTYPE target SYSTEM \"gdb-target.dtd\">");
41
sysbus_mmio_map(s, 0, base);
27
g_string_append_printf(s, "<feature name=\"org.qemu.gdb.arm.sys.regs\">");
28
--
42
--
29
2.17.1
43
2.20.1
30
44
31
45
diff view generated by jsdifflib