1 | target-arm queue. This has the "plumb txattrs through various | 1 | The following changes since commit 61fee7f45955cd0bf9b79be9fa9c7ebabb5e6a85: |
---|---|---|---|
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/philmd-gitlab/tags/acceptance-testing-20200622' into staging (2020-06-22 20:50:10 +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-20200623 |
17 | 8 | ||
18 | for you to fetch changes up to 49d1dca0520ea71bc21867fab6647f474fcf857b: | 9 | for you to fetch changes up to 539533b85fbd269f777bed931de8ccae1dd837e9: |
19 | 10 | ||
20 | KVM: GIC: Fix memory leak due to calling kvm_init_irq_routing twice (2018-05-31 14:52:53 +0100) | 11 | arm/virt: Add memory hot remove support (2020-06-23 11:39:48 +0100) |
21 | 12 | ||
22 | ---------------------------------------------------------------- | 13 | ---------------------------------------------------------------- |
23 | target-arm queue: | 14 | target-arm queue: |
24 | * target/arm: Honour FPCR.FZ in FRECPX | 15 | * util/oslib-posix : qemu_init_exec_dir implementation for Mac |
25 | * MAINTAINERS: Add entries for newer MPS2 boards and devices | 16 | * target/arm: Last parts of neon decodetree conversion |
26 | * hw/intc/arm_gicv3: Fix APxR<n> register dispatching | 17 | * hw/arm/virt: Add 5.0 HW compat props |
27 | * arm_gicv3_kvm: fix bug in writing zero bits back to the in-kernel | 18 | * hw/watchdog/cmsdk-apb-watchdog: Add trace event for lock status |
28 | GIC state | 19 | * mps2: Add CMSDK APB watchdog, FPGAIO block, S2I devices and I2C devices |
29 | * tcg: Fix helper function vs host abi for float16 | 20 | * mps2: Add some unimplemented-device stubs for audio and GPIO |
30 | * arm: fix qemu crash on startup with -bios option | 21 | * mps2-tz: Use the ARM SBCon two-wire serial bus interface |
31 | * arm: fix malloc type mismatch | 22 | * target/arm: Check supported KVM features globally (not per vCPU) |
32 | * xlnx-zdma: Correct mem leaks and memset to zero on desc unaligned errors | 23 | * tests/qtest/arm-cpu-features: Add feature setting tests |
33 | * Correct CPACR reset value for v7 cores | 24 | * arm/virt: Add memory hot remove support |
34 | * memory.h: Improve IOMMU related documentation | ||
35 | * exec: Plumb transaction attributes through various functions in | ||
36 | preparation for allowing IOMMUs to see them | ||
37 | * vmstate.h: Provide VMSTATE_BOOL_SUB_ARRAY | ||
38 | * ARM: ACPI: Fix use-after-free due to memory realloc | ||
39 | * KVM: GIC: Fix memory leak due to calling kvm_init_irq_routing twice | ||
40 | 25 | ||
41 | ---------------------------------------------------------------- | 26 | ---------------------------------------------------------------- |
42 | Francisco Iglesias (1): | 27 | Andrew Jones (2): |
43 | xlnx-zdma: Correct mem leaks and memset to zero on desc unaligned errors | 28 | hw/arm/virt: Add 5.0 HW compat props |
29 | tests/qtest/arm-cpu-features: Add feature setting tests | ||
44 | 30 | ||
45 | Igor Mammedov (1): | 31 | David CARLIER (1): |
46 | arm: fix qemu crash on startup with -bios option | 32 | util/oslib-posix : qemu_init_exec_dir implementation for Mac |
47 | 33 | ||
48 | Jan Kiszka (1): | 34 | Peter Maydell (23): |
49 | hw/intc/arm_gicv3: Fix APxR<n> register dispatching | 35 | target/arm: Convert Neon 2-reg-misc VREV64 to decodetree |
36 | target/arm: Convert Neon 2-reg-misc pairwise ops to decodetree | ||
37 | target/arm: Convert VZIP, VUZP to decodetree | ||
38 | target/arm: Convert Neon narrowing moves to decodetree | ||
39 | target/arm: Convert Neon 2-reg-misc VSHLL to decodetree | ||
40 | target/arm: Convert Neon VCVT f16/f32 insns to decodetree | ||
41 | target/arm: Convert vectorised 2-reg-misc Neon ops to decodetree | ||
42 | target/arm: Convert Neon 2-reg-misc crypto operations to decodetree | ||
43 | target/arm: Rename NeonGenOneOpFn to NeonGenOne64OpFn | ||
44 | target/arm: Fix capitalization in NeonGenTwo{Single, Double}OPFn typedefs | ||
45 | target/arm: Make gen_swap_half() take separate src and dest | ||
46 | target/arm: Convert Neon 2-reg-misc VREV32 and VREV16 to decodetree | ||
47 | target/arm: Convert remaining simple 2-reg-misc Neon ops | ||
48 | target/arm: Convert Neon VQABS, VQNEG to decodetree | ||
49 | target/arm: Convert simple fp Neon 2-reg-misc insns | ||
50 | target/arm: Convert Neon 2-reg-misc fp-compare-with-zero insns to decodetree | ||
51 | target/arm: Convert Neon 2-reg-misc VRINT insns to decodetree | ||
52 | target/arm: Convert Neon 2-reg-misc VCVT insns to decodetree | ||
53 | target/arm: Convert Neon VSWP to decodetree | ||
54 | target/arm: Convert Neon VTRN to decodetree | ||
55 | target/arm: Move some functions used only in translate-neon.inc.c to that file | ||
56 | target/arm: Remove unnecessary gen_io_end() calls | ||
57 | target/arm: Remove dead code relating to SABA and UABA | ||
50 | 58 | ||
51 | Paolo Bonzini (1): | 59 | Philippe Mathieu-Daudé (15): |
52 | arm: fix malloc type mismatch | 60 | hw/watchdog/cmsdk-apb-watchdog: Add trace event for lock status |
61 | hw/i2c/versatile_i2c: Add definitions for register addresses | ||
62 | hw/i2c/versatile_i2c: Add SCL/SDA definitions | ||
63 | hw/i2c: Add header for ARM SBCon two-wire serial bus interface | ||
64 | hw/arm: Use TYPE_VERSATILE_I2C instead of hardcoded string | ||
65 | hw/arm/mps2: Document CMSDK/FPGA APB subsystem sections | ||
66 | hw/arm/mps2: Rename CMSDK AHB peripheral region | ||
67 | hw/arm/mps2: Add CMSDK APB watchdog device | ||
68 | hw/arm/mps2: Add CMSDK AHB GPIO peripherals as unimplemented devices | ||
69 | hw/arm/mps2: Map the FPGA I/O block | ||
70 | hw/arm/mps2: Add SPI devices | ||
71 | hw/arm/mps2: Add I2C devices | ||
72 | hw/arm/mps2: Add audio I2S interface as unimplemented device | ||
73 | hw/arm/mps2-tz: Use the ARM SBCon two-wire serial bus interface | ||
74 | target/arm: Check supported KVM features globally (not per vCPU) | ||
53 | 75 | ||
54 | Peter Maydell (17): | 76 | Shameer Kolothum (1): |
55 | target/arm: Honour FPCR.FZ in FRECPX | 77 | arm/virt: Add memory hot remove support |
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 | 78 | ||
73 | Richard Henderson (1): | 79 | include/hw/i2c/arm_sbcon_i2c.h | 35 ++ |
74 | tcg: Fix helper function vs host abi for float16 | 80 | target/arm/cpu.h | 2 +- |
81 | target/arm/kvm_arm.h | 21 +- | ||
82 | target/arm/translate.h | 8 +- | ||
83 | target/arm/neon-dp.decode | 106 ++++ | ||
84 | hw/acpi/generic_event_device.c | 29 + | ||
85 | hw/arm/mps2-tz.c | 23 +- | ||
86 | hw/arm/mps2.c | 65 ++- | ||
87 | hw/arm/realview.c | 3 +- | ||
88 | hw/arm/versatilepb.c | 3 +- | ||
89 | hw/arm/vexpress.c | 3 +- | ||
90 | hw/arm/virt.c | 63 +- | ||
91 | hw/i2c/versatile_i2c.c | 38 +- | ||
92 | hw/watchdog/cmsdk-apb-watchdog.c | 1 + | ||
93 | target/arm/cpu.c | 2 +- | ||
94 | target/arm/cpu64.c | 10 +- | ||
95 | target/arm/kvm.c | 4 +- | ||
96 | target/arm/kvm64.c | 14 +- | ||
97 | target/arm/translate-a64.c | 20 +- | ||
98 | target/arm/translate-neon.inc.c | 1191 +++++++++++++++++++++++++++++++++++++- | ||
99 | target/arm/translate-vfp.inc.c | 7 +- | ||
100 | target/arm/translate.c | 1064 +--------------------------------- | ||
101 | tests/qtest/arm-cpu-features.c | 38 +- | ||
102 | util/oslib-posix.c | 15 + | ||
103 | MAINTAINERS | 1 + | ||
104 | hw/arm/Kconfig | 8 +- | ||
105 | hw/watchdog/trace-events | 1 + | ||
106 | 27 files changed, 1624 insertions(+), 1151 deletions(-) | ||
107 | create mode 100644 include/hw/i2c/arm_sbcon_i2c.h | ||
75 | 108 | ||
76 | Shannon Zhao (3): | ||
77 | arm_gicv3_kvm: increase clroffset accordingly | ||
78 | ARM: ACPI: Fix use-after-free due to memory realloc | ||
79 | KVM: GIC: Fix memory leak due to calling kvm_init_irq_routing twice | ||
80 | |||
81 | include/exec/exec-all.h | 5 +- | ||
82 | include/exec/helper-head.h | 2 +- | ||
83 | include/exec/memory-internal.h | 3 +- | ||
84 | include/exec/memory.h | 128 +++++++++++++++++++++++++++++++++++------ | ||
85 | include/migration/vmstate.h | 3 + | ||
86 | include/sysemu/dma.h | 6 +- | ||
87 | accel/tcg/translate-all.c | 4 +- | ||
88 | exec.c | 95 ++++++++++++++++++------------ | ||
89 | hw/arm/boot.c | 18 +++--- | ||
90 | hw/arm/virt-acpi-build.c | 20 +++++-- | ||
91 | hw/dma/xlnx-zdma.c | 10 +++- | ||
92 | hw/hppa/dino.c | 3 +- | ||
93 | hw/intc/arm_gic_kvm.c | 1 - | ||
94 | hw/intc/arm_gicv3_cpuif.c | 12 ++-- | ||
95 | hw/intc/arm_gicv3_kvm.c | 2 +- | ||
96 | hw/nvram/fw_cfg.c | 12 ++-- | ||
97 | hw/s390x/s390-pci-inst.c | 3 +- | ||
98 | hw/scsi/esp.c | 3 +- | ||
99 | hw/vfio/common.c | 3 +- | ||
100 | hw/virtio/vhost.c | 3 +- | ||
101 | hw/xen/xen_pt_msi.c | 3 +- | ||
102 | memory.c | 12 ++-- | ||
103 | memory_ldst.inc.c | 18 +++--- | ||
104 | target/arm/gdbstub.c | 3 +- | ||
105 | target/arm/helper-a64.c | 41 +++++++------ | ||
106 | target/arm/helper.c | 90 ++++++++++++++++------------- | ||
107 | target/ppc/mmu-hash64.c | 3 +- | ||
108 | target/riscv/helper.c | 2 +- | ||
109 | target/s390x/diag.c | 6 +- | ||
110 | target/s390x/excp_helper.c | 3 +- | ||
111 | target/s390x/mmu_helper.c | 3 +- | ||
112 | target/s390x/sigp.c | 3 +- | ||
113 | target/xtensa/op_helper.c | 3 +- | ||
114 | MAINTAINERS | 9 ++- | ||
115 | 34 files changed, 353 insertions(+), 182 deletions(-) | ||
116 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Andrew Jones <drjones@redhat.com> | ||
1 | 2 | ||
3 | Cc: Cornelia Huck <cohuck@redhat.com> | ||
4 | Signed-off-by: Andrew Jones <drjones@redhat.com> | ||
5 | Reviewed-by: Cornelia Huck <cohuck@redhat.com> | ||
6 | Message-id: 20200616140803.25515-1-drjones@redhat.com | ||
7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
8 | --- | ||
9 | hw/arm/virt.c | 1 + | ||
10 | 1 file changed, 1 insertion(+) | ||
11 | |||
12 | diff --git a/hw/arm/virt.c b/hw/arm/virt.c | ||
13 | index XXXXXXX..XXXXXXX 100644 | ||
14 | --- a/hw/arm/virt.c | ||
15 | +++ b/hw/arm/virt.c | ||
16 | @@ -XXX,XX +XXX,XX @@ DEFINE_VIRT_MACHINE_AS_LATEST(5, 1) | ||
17 | static void virt_machine_5_0_options(MachineClass *mc) | ||
18 | { | ||
19 | virt_machine_5_1_options(mc); | ||
20 | + compat_props_add(mc->compat_props, hw_compat_5_0, hw_compat_5_0_len); | ||
21 | } | ||
22 | DEFINE_VIRT_MACHINE(5, 0) | ||
23 | |||
24 | -- | ||
25 | 2.20.1 | ||
26 | |||
27 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: David CARLIER <devnexen@gmail.com> | ||
1 | 2 | ||
3 | From 3025a0ce3fdf7d3559fc35a52c659f635f5c750c Mon Sep 17 00:00:00 2001 | ||
4 | From: David Carlier <devnexen@gmail.com> | ||
5 | Date: Tue, 26 May 2020 21:35:27 +0100 | ||
6 | Subject: [PATCH] util/oslib-posix : qemu_init_exec_dir implementation for Mac | ||
7 | |||
8 | Using dyld API to get the full path of the current process. | ||
9 | |||
10 | Signed-off-by: David Carlier <devnexen@gmail.com> | ||
11 | Message-id: CA+XhMqxwC10XHVs4Z-JfE0-WLAU3ztDuU9QKVi31mjr59HWCxg@mail.gmail.com | ||
12 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
13 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
14 | --- | ||
15 | util/oslib-posix.c | 15 +++++++++++++++ | ||
16 | 1 file changed, 15 insertions(+) | ||
17 | |||
18 | diff --git a/util/oslib-posix.c b/util/oslib-posix.c | ||
19 | index XXXXXXX..XXXXXXX 100644 | ||
20 | --- a/util/oslib-posix.c | ||
21 | +++ b/util/oslib-posix.c | ||
22 | @@ -XXX,XX +XXX,XX @@ | ||
23 | #include <lwp.h> | ||
24 | #endif | ||
25 | |||
26 | +#ifdef __APPLE__ | ||
27 | +#include <mach-o/dyld.h> | ||
28 | +#endif | ||
29 | + | ||
30 | #include "qemu/mmap-alloc.h" | ||
31 | |||
32 | #ifdef CONFIG_DEBUG_STACK_USAGE | ||
33 | @@ -XXX,XX +XXX,XX @@ void qemu_init_exec_dir(const char *argv0) | ||
34 | p = buf; | ||
35 | } | ||
36 | } | ||
37 | +#elif defined(__APPLE__) | ||
38 | + { | ||
39 | + char fpath[PATH_MAX]; | ||
40 | + uint32_t len = sizeof(fpath); | ||
41 | + if (_NSGetExecutablePath(fpath, &len) == 0) { | ||
42 | + p = realpath(fpath, buf); | ||
43 | + if (!p) { | ||
44 | + return; | ||
45 | + } | ||
46 | + } | ||
47 | + } | ||
48 | #endif | ||
49 | /* If we don't have any way of figuring out the actual executable | ||
50 | location then try argv[0]. */ | ||
51 | -- | ||
52 | 2.20.1 | ||
53 | |||
54 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | Convert the Neon VREV64 insn from the 2-reg-misc grouping to decodetree. | ||
1 | 2 | ||
3 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
4 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
5 | Message-id: 20200616170844.13318-2-peter.maydell@linaro.org | ||
6 | --- | ||
7 | target/arm/neon-dp.decode | 12 ++++++++ | ||
8 | target/arm/translate-neon.inc.c | 50 +++++++++++++++++++++++++++++++++ | ||
9 | target/arm/translate.c | 24 ++-------------- | ||
10 | 3 files changed, 64 insertions(+), 22 deletions(-) | ||
11 | |||
12 | diff --git a/target/arm/neon-dp.decode b/target/arm/neon-dp.decode | ||
13 | index XXXXXXX..XXXXXXX 100644 | ||
14 | --- a/target/arm/neon-dp.decode | ||
15 | +++ b/target/arm/neon-dp.decode | ||
16 | @@ -XXX,XX +XXX,XX @@ Vimm_1r 1111 001 . 1 . 000 ... .... cmode:4 0 . op:1 1 .... @1reg_imm | ||
17 | vm=%vm_dp vd=%vd_dp size=1 | ||
18 | VDUP_scalar 1111 001 1 1 . 11 index:1 100 .... 11 000 q:1 . 0 .... \ | ||
19 | vm=%vm_dp vd=%vd_dp size=2 | ||
20 | + | ||
21 | + ################################################################## | ||
22 | + # 2-reg-misc grouping: | ||
23 | + # 1111 001 11 D 11 size:2 opc1:2 Vd:4 0 opc2:4 q:1 M 0 Vm:4 | ||
24 | + ################################################################## | ||
25 | + | ||
26 | + &2misc vd vm q size | ||
27 | + | ||
28 | + @2misc .... ... .. . .. size:2 .. .... . .... q:1 . . .... \ | ||
29 | + &2misc vm=%vm_dp vd=%vd_dp | ||
30 | + | ||
31 | + VREV64 1111 001 11 . 11 .. 00 .... 0 0000 . . 0 .... @2misc | ||
32 | ] | ||
33 | |||
34 | # Subgroup for size != 0b11 | ||
35 | diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c | ||
36 | index XXXXXXX..XXXXXXX 100644 | ||
37 | --- a/target/arm/translate-neon.inc.c | ||
38 | +++ b/target/arm/translate-neon.inc.c | ||
39 | @@ -XXX,XX +XXX,XX @@ static bool trans_VDUP_scalar(DisasContext *s, arg_VDUP_scalar *a) | ||
40 | a->q ? 16 : 8, a->q ? 16 : 8); | ||
41 | return true; | ||
42 | } | ||
43 | + | ||
44 | +static bool trans_VREV64(DisasContext *s, arg_VREV64 *a) | ||
45 | +{ | ||
46 | + int pass, half; | ||
47 | + | ||
48 | + if (!arm_dc_feature(s, ARM_FEATURE_NEON)) { | ||
49 | + return false; | ||
50 | + } | ||
51 | + | ||
52 | + /* UNDEF accesses to D16-D31 if they don't exist. */ | ||
53 | + if (!dc_isar_feature(aa32_simd_r32, s) && | ||
54 | + ((a->vd | a->vm) & 0x10)) { | ||
55 | + return false; | ||
56 | + } | ||
57 | + | ||
58 | + if ((a->vd | a->vm) & a->q) { | ||
59 | + return false; | ||
60 | + } | ||
61 | + | ||
62 | + if (a->size == 3) { | ||
63 | + return false; | ||
64 | + } | ||
65 | + | ||
66 | + if (!vfp_access_check(s)) { | ||
67 | + return true; | ||
68 | + } | ||
69 | + | ||
70 | + for (pass = 0; pass < (a->q ? 2 : 1); pass++) { | ||
71 | + TCGv_i32 tmp[2]; | ||
72 | + | ||
73 | + for (half = 0; half < 2; half++) { | ||
74 | + tmp[half] = neon_load_reg(a->vm, pass * 2 + half); | ||
75 | + switch (a->size) { | ||
76 | + case 0: | ||
77 | + tcg_gen_bswap32_i32(tmp[half], tmp[half]); | ||
78 | + break; | ||
79 | + case 1: | ||
80 | + gen_swap_half(tmp[half]); | ||
81 | + break; | ||
82 | + case 2: | ||
83 | + break; | ||
84 | + default: | ||
85 | + g_assert_not_reached(); | ||
86 | + } | ||
87 | + } | ||
88 | + neon_store_reg(a->vd, pass * 2, tmp[1]); | ||
89 | + neon_store_reg(a->vd, pass * 2 + 1, tmp[0]); | ||
90 | + } | ||
91 | + return true; | ||
92 | +} | ||
93 | diff --git a/target/arm/translate.c b/target/arm/translate.c | ||
94 | index XXXXXXX..XXXXXXX 100644 | ||
95 | --- a/target/arm/translate.c | ||
96 | +++ b/target/arm/translate.c | ||
97 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) | ||
98 | } | ||
99 | switch (op) { | ||
100 | case NEON_2RM_VREV64: | ||
101 | - for (pass = 0; pass < (q ? 2 : 1); pass++) { | ||
102 | - tmp = neon_load_reg(rm, pass * 2); | ||
103 | - tmp2 = neon_load_reg(rm, pass * 2 + 1); | ||
104 | - switch (size) { | ||
105 | - case 0: tcg_gen_bswap32_i32(tmp, tmp); break; | ||
106 | - case 1: gen_swap_half(tmp); break; | ||
107 | - case 2: /* no-op */ break; | ||
108 | - default: abort(); | ||
109 | - } | ||
110 | - neon_store_reg(rd, pass * 2 + 1, tmp); | ||
111 | - if (size == 2) { | ||
112 | - neon_store_reg(rd, pass * 2, tmp2); | ||
113 | - } else { | ||
114 | - switch (size) { | ||
115 | - case 0: tcg_gen_bswap32_i32(tmp2, tmp2); break; | ||
116 | - case 1: gen_swap_half(tmp2); break; | ||
117 | - default: abort(); | ||
118 | - } | ||
119 | - neon_store_reg(rd, pass * 2, tmp2); | ||
120 | - } | ||
121 | - } | ||
122 | - break; | ||
123 | + /* handled by decodetree */ | ||
124 | + return 1; | ||
125 | case NEON_2RM_VPADDL: case NEON_2RM_VPADDL_U: | ||
126 | case NEON_2RM_VPADAL: case NEON_2RM_VPADAL_U: | ||
127 | for (pass = 0; pass < q + 1; pass++) { | ||
128 | -- | ||
129 | 2.20.1 | ||
130 | |||
131 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | 1 | Convert the pairwise ops VPADDL and VPADAL in the 2-reg-misc grouping | |
2 | to decodetree. | ||
3 | |||
4 | At this point we can get rid of the weird CPU_V001 #define that was | ||
5 | used to avoid having to explicitly list all the arguments being | ||
6 | passed to some TCG gen/helper functions. | ||
7 | |||
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
9 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
10 | Message-id: 20200616170844.13318-3-peter.maydell@linaro.org | ||
11 | --- | ||
12 | target/arm/neon-dp.decode | 6 ++ | ||
13 | target/arm/translate-neon.inc.c | 149 ++++++++++++++++++++++++++++++++ | ||
14 | target/arm/translate.c | 35 +------- | ||
15 | 3 files changed, 157 insertions(+), 33 deletions(-) | ||
16 | |||
17 | diff --git a/target/arm/neon-dp.decode b/target/arm/neon-dp.decode | ||
18 | index XXXXXXX..XXXXXXX 100644 | ||
19 | --- a/target/arm/neon-dp.decode | ||
20 | +++ b/target/arm/neon-dp.decode | ||
21 | @@ -XXX,XX +XXX,XX @@ Vimm_1r 1111 001 . 1 . 000 ... .... cmode:4 0 . op:1 1 .... @1reg_imm | ||
22 | &2misc vm=%vm_dp vd=%vd_dp | ||
23 | |||
24 | VREV64 1111 001 11 . 11 .. 00 .... 0 0000 . . 0 .... @2misc | ||
25 | + | ||
26 | + VPADDL_S 1111 001 11 . 11 .. 00 .... 0 0100 . . 0 .... @2misc | ||
27 | + VPADDL_U 1111 001 11 . 11 .. 00 .... 0 0101 . . 0 .... @2misc | ||
28 | + | ||
29 | + VPADAL_S 1111 001 11 . 11 .. 00 .... 0 1100 . . 0 .... @2misc | ||
30 | + VPADAL_U 1111 001 11 . 11 .. 00 .... 0 1101 . . 0 .... @2misc | ||
31 | ] | ||
32 | |||
33 | # Subgroup for size != 0b11 | ||
34 | diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c | ||
35 | index XXXXXXX..XXXXXXX 100644 | ||
36 | --- a/target/arm/translate-neon.inc.c | ||
37 | +++ b/target/arm/translate-neon.inc.c | ||
38 | @@ -XXX,XX +XXX,XX @@ static bool trans_VREV64(DisasContext *s, arg_VREV64 *a) | ||
39 | } | ||
40 | return true; | ||
41 | } | ||
42 | + | ||
43 | +static bool do_2misc_pairwise(DisasContext *s, arg_2misc *a, | ||
44 | + NeonGenWidenFn *widenfn, | ||
45 | + NeonGenTwo64OpFn *opfn, | ||
46 | + NeonGenTwo64OpFn *accfn) | ||
47 | +{ | ||
48 | + /* | ||
49 | + * Pairwise long operations: widen both halves of the pair, | ||
50 | + * combine the pairs with the opfn, and then possibly accumulate | ||
51 | + * into the destination with the accfn. | ||
52 | + */ | ||
53 | + int pass; | ||
54 | + | ||
55 | + if (!arm_dc_feature(s, ARM_FEATURE_NEON)) { | ||
56 | + return false; | ||
57 | + } | ||
58 | + | ||
59 | + /* UNDEF accesses to D16-D31 if they don't exist. */ | ||
60 | + if (!dc_isar_feature(aa32_simd_r32, s) && | ||
61 | + ((a->vd | a->vm) & 0x10)) { | ||
62 | + return false; | ||
63 | + } | ||
64 | + | ||
65 | + if ((a->vd | a->vm) & a->q) { | ||
66 | + return false; | ||
67 | + } | ||
68 | + | ||
69 | + if (!widenfn) { | ||
70 | + return false; | ||
71 | + } | ||
72 | + | ||
73 | + if (!vfp_access_check(s)) { | ||
74 | + return true; | ||
75 | + } | ||
76 | + | ||
77 | + for (pass = 0; pass < a->q + 1; pass++) { | ||
78 | + TCGv_i32 tmp; | ||
79 | + TCGv_i64 rm0_64, rm1_64, rd_64; | ||
80 | + | ||
81 | + rm0_64 = tcg_temp_new_i64(); | ||
82 | + rm1_64 = tcg_temp_new_i64(); | ||
83 | + rd_64 = tcg_temp_new_i64(); | ||
84 | + tmp = neon_load_reg(a->vm, pass * 2); | ||
85 | + widenfn(rm0_64, tmp); | ||
86 | + tcg_temp_free_i32(tmp); | ||
87 | + tmp = neon_load_reg(a->vm, pass * 2 + 1); | ||
88 | + widenfn(rm1_64, tmp); | ||
89 | + tcg_temp_free_i32(tmp); | ||
90 | + opfn(rd_64, rm0_64, rm1_64); | ||
91 | + tcg_temp_free_i64(rm0_64); | ||
92 | + tcg_temp_free_i64(rm1_64); | ||
93 | + | ||
94 | + if (accfn) { | ||
95 | + TCGv_i64 tmp64 = tcg_temp_new_i64(); | ||
96 | + neon_load_reg64(tmp64, a->vd + pass); | ||
97 | + accfn(rd_64, tmp64, rd_64); | ||
98 | + tcg_temp_free_i64(tmp64); | ||
99 | + } | ||
100 | + neon_store_reg64(rd_64, a->vd + pass); | ||
101 | + tcg_temp_free_i64(rd_64); | ||
102 | + } | ||
103 | + return true; | ||
104 | +} | ||
105 | + | ||
106 | +static bool trans_VPADDL_S(DisasContext *s, arg_2misc *a) | ||
107 | +{ | ||
108 | + static NeonGenWidenFn * const widenfn[] = { | ||
109 | + gen_helper_neon_widen_s8, | ||
110 | + gen_helper_neon_widen_s16, | ||
111 | + tcg_gen_ext_i32_i64, | ||
112 | + NULL, | ||
113 | + }; | ||
114 | + static NeonGenTwo64OpFn * const opfn[] = { | ||
115 | + gen_helper_neon_paddl_u16, | ||
116 | + gen_helper_neon_paddl_u32, | ||
117 | + tcg_gen_add_i64, | ||
118 | + NULL, | ||
119 | + }; | ||
120 | + | ||
121 | + return do_2misc_pairwise(s, a, widenfn[a->size], opfn[a->size], NULL); | ||
122 | +} | ||
123 | + | ||
124 | +static bool trans_VPADDL_U(DisasContext *s, arg_2misc *a) | ||
125 | +{ | ||
126 | + static NeonGenWidenFn * const widenfn[] = { | ||
127 | + gen_helper_neon_widen_u8, | ||
128 | + gen_helper_neon_widen_u16, | ||
129 | + tcg_gen_extu_i32_i64, | ||
130 | + NULL, | ||
131 | + }; | ||
132 | + static NeonGenTwo64OpFn * const opfn[] = { | ||
133 | + gen_helper_neon_paddl_u16, | ||
134 | + gen_helper_neon_paddl_u32, | ||
135 | + tcg_gen_add_i64, | ||
136 | + NULL, | ||
137 | + }; | ||
138 | + | ||
139 | + return do_2misc_pairwise(s, a, widenfn[a->size], opfn[a->size], NULL); | ||
140 | +} | ||
141 | + | ||
142 | +static bool trans_VPADAL_S(DisasContext *s, arg_2misc *a) | ||
143 | +{ | ||
144 | + static NeonGenWidenFn * const widenfn[] = { | ||
145 | + gen_helper_neon_widen_s8, | ||
146 | + gen_helper_neon_widen_s16, | ||
147 | + tcg_gen_ext_i32_i64, | ||
148 | + NULL, | ||
149 | + }; | ||
150 | + static NeonGenTwo64OpFn * const opfn[] = { | ||
151 | + gen_helper_neon_paddl_u16, | ||
152 | + gen_helper_neon_paddl_u32, | ||
153 | + tcg_gen_add_i64, | ||
154 | + NULL, | ||
155 | + }; | ||
156 | + static NeonGenTwo64OpFn * const accfn[] = { | ||
157 | + gen_helper_neon_addl_u16, | ||
158 | + gen_helper_neon_addl_u32, | ||
159 | + tcg_gen_add_i64, | ||
160 | + NULL, | ||
161 | + }; | ||
162 | + | ||
163 | + return do_2misc_pairwise(s, a, widenfn[a->size], opfn[a->size], | ||
164 | + accfn[a->size]); | ||
165 | +} | ||
166 | + | ||
167 | +static bool trans_VPADAL_U(DisasContext *s, arg_2misc *a) | ||
168 | +{ | ||
169 | + static NeonGenWidenFn * const widenfn[] = { | ||
170 | + gen_helper_neon_widen_u8, | ||
171 | + gen_helper_neon_widen_u16, | ||
172 | + tcg_gen_extu_i32_i64, | ||
173 | + NULL, | ||
174 | + }; | ||
175 | + static NeonGenTwo64OpFn * const opfn[] = { | ||
176 | + gen_helper_neon_paddl_u16, | ||
177 | + gen_helper_neon_paddl_u32, | ||
178 | + tcg_gen_add_i64, | ||
179 | + NULL, | ||
180 | + }; | ||
181 | + static NeonGenTwo64OpFn * const accfn[] = { | ||
182 | + gen_helper_neon_addl_u16, | ||
183 | + gen_helper_neon_addl_u32, | ||
184 | + tcg_gen_add_i64, | ||
185 | + NULL, | ||
186 | + }; | ||
187 | + | ||
188 | + return do_2misc_pairwise(s, a, widenfn[a->size], opfn[a->size], | ||
189 | + accfn[a->size]); | ||
190 | +} | ||
191 | diff --git a/target/arm/translate.c b/target/arm/translate.c | ||
192 | index XXXXXXX..XXXXXXX 100644 | ||
193 | --- a/target/arm/translate.c | ||
194 | +++ b/target/arm/translate.c | ||
195 | @@ -XXX,XX +XXX,XX @@ static void gen_exception_return(DisasContext *s, TCGv_i32 pc) | ||
196 | gen_rfe(s, pc, load_cpu_field(spsr)); | ||
197 | } | ||
198 | |||
199 | -#define CPU_V001 cpu_V0, cpu_V0, cpu_V1 | ||
200 | - | ||
201 | static int gen_neon_unzip(int rd, int rm, int size, int q) | ||
202 | { | ||
203 | TCGv_ptr pd, pm; | ||
204 | @@ -XXX,XX +XXX,XX @@ static inline void gen_neon_widen(TCGv_i64 dest, TCGv_i32 src, int size, int u) | ||
205 | tcg_temp_free_i32(src); | ||
206 | } | ||
207 | |||
208 | -static inline void gen_neon_addl(int size) | ||
209 | -{ | ||
210 | - switch (size) { | ||
211 | - case 0: gen_helper_neon_addl_u16(CPU_V001); break; | ||
212 | - case 1: gen_helper_neon_addl_u32(CPU_V001); break; | ||
213 | - case 2: tcg_gen_add_i64(CPU_V001); break; | ||
214 | - default: abort(); | ||
215 | - } | ||
216 | -} | ||
217 | - | ||
218 | static void gen_neon_narrow_op(int op, int u, int size, | ||
219 | TCGv_i32 dest, TCGv_i64 src) | ||
220 | { | ||
221 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) | ||
222 | } | ||
223 | switch (op) { | ||
224 | case NEON_2RM_VREV64: | ||
225 | - /* handled by decodetree */ | ||
226 | - return 1; | ||
227 | case NEON_2RM_VPADDL: case NEON_2RM_VPADDL_U: | ||
228 | case NEON_2RM_VPADAL: case NEON_2RM_VPADAL_U: | ||
229 | - for (pass = 0; pass < q + 1; pass++) { | ||
230 | - tmp = neon_load_reg(rm, pass * 2); | ||
231 | - gen_neon_widen(cpu_V0, tmp, size, op & 1); | ||
232 | - tmp = neon_load_reg(rm, pass * 2 + 1); | ||
233 | - gen_neon_widen(cpu_V1, tmp, size, op & 1); | ||
234 | - switch (size) { | ||
235 | - case 0: gen_helper_neon_paddl_u16(CPU_V001); break; | ||
236 | - case 1: gen_helper_neon_paddl_u32(CPU_V001); break; | ||
237 | - case 2: tcg_gen_add_i64(CPU_V001); break; | ||
238 | - default: abort(); | ||
239 | - } | ||
240 | - if (op >= NEON_2RM_VPADAL) { | ||
241 | - /* Accumulate. */ | ||
242 | - neon_load_reg64(cpu_V1, rd + pass); | ||
243 | - gen_neon_addl(size); | ||
244 | - } | ||
245 | - neon_store_reg64(cpu_V0, rd + pass); | ||
246 | - } | ||
247 | - break; | ||
248 | + /* handled by decodetree */ | ||
249 | + return 1; | ||
250 | case NEON_2RM_VTRN: | ||
251 | if (size == 2) { | ||
252 | int n; | ||
253 | -- | ||
254 | 2.20.1 | ||
255 | |||
256 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | 1 | Convert the Neon VZIP and VUZP insns in the 2-reg-misc group to | |
2 | decodetree. | ||
3 | |||
4 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
5 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
6 | Message-id: 20200616170844.13318-4-peter.maydell@linaro.org | ||
7 | --- | ||
8 | target/arm/neon-dp.decode | 3 ++ | ||
9 | target/arm/translate-neon.inc.c | 74 ++++++++++++++++++++++++++ | ||
10 | target/arm/translate.c | 92 +-------------------------------- | ||
11 | 3 files changed, 79 insertions(+), 90 deletions(-) | ||
12 | |||
13 | diff --git a/target/arm/neon-dp.decode b/target/arm/neon-dp.decode | ||
14 | index XXXXXXX..XXXXXXX 100644 | ||
15 | --- a/target/arm/neon-dp.decode | ||
16 | +++ b/target/arm/neon-dp.decode | ||
17 | @@ -XXX,XX +XXX,XX @@ Vimm_1r 1111 001 . 1 . 000 ... .... cmode:4 0 . op:1 1 .... @1reg_imm | ||
18 | |||
19 | VPADAL_S 1111 001 11 . 11 .. 00 .... 0 1100 . . 0 .... @2misc | ||
20 | VPADAL_U 1111 001 11 . 11 .. 00 .... 0 1101 . . 0 .... @2misc | ||
21 | + | ||
22 | + VUZP 1111 001 11 . 11 .. 10 .... 0 0010 . . 0 .... @2misc | ||
23 | + VZIP 1111 001 11 . 11 .. 10 .... 0 0011 . . 0 .... @2misc | ||
24 | ] | ||
25 | |||
26 | # Subgroup for size != 0b11 | ||
27 | diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c | ||
28 | index XXXXXXX..XXXXXXX 100644 | ||
29 | --- a/target/arm/translate-neon.inc.c | ||
30 | +++ b/target/arm/translate-neon.inc.c | ||
31 | @@ -XXX,XX +XXX,XX @@ static bool trans_VPADAL_U(DisasContext *s, arg_2misc *a) | ||
32 | return do_2misc_pairwise(s, a, widenfn[a->size], opfn[a->size], | ||
33 | accfn[a->size]); | ||
34 | } | ||
35 | + | ||
36 | +typedef void ZipFn(TCGv_ptr, TCGv_ptr); | ||
37 | + | ||
38 | +static bool do_zip_uzp(DisasContext *s, arg_2misc *a, | ||
39 | + ZipFn *fn) | ||
40 | +{ | ||
41 | + TCGv_ptr pd, pm; | ||
42 | + | ||
43 | + if (!arm_dc_feature(s, ARM_FEATURE_NEON)) { | ||
44 | + return false; | ||
45 | + } | ||
46 | + | ||
47 | + /* UNDEF accesses to D16-D31 if they don't exist. */ | ||
48 | + if (!dc_isar_feature(aa32_simd_r32, s) && | ||
49 | + ((a->vd | a->vm) & 0x10)) { | ||
50 | + return false; | ||
51 | + } | ||
52 | + | ||
53 | + if ((a->vd | a->vm) & a->q) { | ||
54 | + return false; | ||
55 | + } | ||
56 | + | ||
57 | + if (!fn) { | ||
58 | + /* Bad size or size/q combination */ | ||
59 | + return false; | ||
60 | + } | ||
61 | + | ||
62 | + if (!vfp_access_check(s)) { | ||
63 | + return true; | ||
64 | + } | ||
65 | + | ||
66 | + pd = vfp_reg_ptr(true, a->vd); | ||
67 | + pm = vfp_reg_ptr(true, a->vm); | ||
68 | + fn(pd, pm); | ||
69 | + tcg_temp_free_ptr(pd); | ||
70 | + tcg_temp_free_ptr(pm); | ||
71 | + return true; | ||
72 | +} | ||
73 | + | ||
74 | +static bool trans_VUZP(DisasContext *s, arg_2misc *a) | ||
75 | +{ | ||
76 | + static ZipFn * const fn[2][4] = { | ||
77 | + { | ||
78 | + gen_helper_neon_unzip8, | ||
79 | + gen_helper_neon_unzip16, | ||
80 | + NULL, | ||
81 | + NULL, | ||
82 | + }, { | ||
83 | + gen_helper_neon_qunzip8, | ||
84 | + gen_helper_neon_qunzip16, | ||
85 | + gen_helper_neon_qunzip32, | ||
86 | + NULL, | ||
87 | + } | ||
88 | + }; | ||
89 | + return do_zip_uzp(s, a, fn[a->q][a->size]); | ||
90 | +} | ||
91 | + | ||
92 | +static bool trans_VZIP(DisasContext *s, arg_2misc *a) | ||
93 | +{ | ||
94 | + static ZipFn * const fn[2][4] = { | ||
95 | + { | ||
96 | + gen_helper_neon_zip8, | ||
97 | + gen_helper_neon_zip16, | ||
98 | + NULL, | ||
99 | + NULL, | ||
100 | + }, { | ||
101 | + gen_helper_neon_qzip8, | ||
102 | + gen_helper_neon_qzip16, | ||
103 | + gen_helper_neon_qzip32, | ||
104 | + NULL, | ||
105 | + } | ||
106 | + }; | ||
107 | + return do_zip_uzp(s, a, fn[a->q][a->size]); | ||
108 | +} | ||
109 | diff --git a/target/arm/translate.c b/target/arm/translate.c | ||
110 | index XXXXXXX..XXXXXXX 100644 | ||
111 | --- a/target/arm/translate.c | ||
112 | +++ b/target/arm/translate.c | ||
113 | @@ -XXX,XX +XXX,XX @@ static void gen_exception_return(DisasContext *s, TCGv_i32 pc) | ||
114 | gen_rfe(s, pc, load_cpu_field(spsr)); | ||
115 | } | ||
116 | |||
117 | -static int gen_neon_unzip(int rd, int rm, int size, int q) | ||
118 | -{ | ||
119 | - TCGv_ptr pd, pm; | ||
120 | - | ||
121 | - if (!q && size == 2) { | ||
122 | - return 1; | ||
123 | - } | ||
124 | - pd = vfp_reg_ptr(true, rd); | ||
125 | - pm = vfp_reg_ptr(true, rm); | ||
126 | - if (q) { | ||
127 | - switch (size) { | ||
128 | - case 0: | ||
129 | - gen_helper_neon_qunzip8(pd, pm); | ||
130 | - break; | ||
131 | - case 1: | ||
132 | - gen_helper_neon_qunzip16(pd, pm); | ||
133 | - break; | ||
134 | - case 2: | ||
135 | - gen_helper_neon_qunzip32(pd, pm); | ||
136 | - break; | ||
137 | - default: | ||
138 | - abort(); | ||
139 | - } | ||
140 | - } else { | ||
141 | - switch (size) { | ||
142 | - case 0: | ||
143 | - gen_helper_neon_unzip8(pd, pm); | ||
144 | - break; | ||
145 | - case 1: | ||
146 | - gen_helper_neon_unzip16(pd, pm); | ||
147 | - break; | ||
148 | - default: | ||
149 | - abort(); | ||
150 | - } | ||
151 | - } | ||
152 | - tcg_temp_free_ptr(pd); | ||
153 | - tcg_temp_free_ptr(pm); | ||
154 | - return 0; | ||
155 | -} | ||
156 | - | ||
157 | -static int gen_neon_zip(int rd, int rm, int size, int q) | ||
158 | -{ | ||
159 | - TCGv_ptr pd, pm; | ||
160 | - | ||
161 | - if (!q && size == 2) { | ||
162 | - return 1; | ||
163 | - } | ||
164 | - pd = vfp_reg_ptr(true, rd); | ||
165 | - pm = vfp_reg_ptr(true, rm); | ||
166 | - if (q) { | ||
167 | - switch (size) { | ||
168 | - case 0: | ||
169 | - gen_helper_neon_qzip8(pd, pm); | ||
170 | - break; | ||
171 | - case 1: | ||
172 | - gen_helper_neon_qzip16(pd, pm); | ||
173 | - break; | ||
174 | - case 2: | ||
175 | - gen_helper_neon_qzip32(pd, pm); | ||
176 | - break; | ||
177 | - default: | ||
178 | - abort(); | ||
179 | - } | ||
180 | - } else { | ||
181 | - switch (size) { | ||
182 | - case 0: | ||
183 | - gen_helper_neon_zip8(pd, pm); | ||
184 | - break; | ||
185 | - case 1: | ||
186 | - gen_helper_neon_zip16(pd, pm); | ||
187 | - break; | ||
188 | - default: | ||
189 | - abort(); | ||
190 | - } | ||
191 | - } | ||
192 | - tcg_temp_free_ptr(pd); | ||
193 | - tcg_temp_free_ptr(pm); | ||
194 | - return 0; | ||
195 | -} | ||
196 | - | ||
197 | static void gen_neon_trn_u8(TCGv_i32 t0, TCGv_i32 t1) | ||
198 | { | ||
199 | TCGv_i32 rd, tmp; | ||
200 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) | ||
201 | case NEON_2RM_VREV64: | ||
202 | case NEON_2RM_VPADDL: case NEON_2RM_VPADDL_U: | ||
203 | case NEON_2RM_VPADAL: case NEON_2RM_VPADAL_U: | ||
204 | + case NEON_2RM_VUZP: | ||
205 | + case NEON_2RM_VZIP: | ||
206 | /* handled by decodetree */ | ||
207 | return 1; | ||
208 | case NEON_2RM_VTRN: | ||
209 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) | ||
210 | goto elementwise; | ||
211 | } | ||
212 | break; | ||
213 | - case NEON_2RM_VUZP: | ||
214 | - if (gen_neon_unzip(rd, rm, size, q)) { | ||
215 | - return 1; | ||
216 | - } | ||
217 | - break; | ||
218 | - case NEON_2RM_VZIP: | ||
219 | - if (gen_neon_zip(rd, rm, size, q)) { | ||
220 | - return 1; | ||
221 | - } | ||
222 | - break; | ||
223 | case NEON_2RM_VMOVN: case NEON_2RM_VQMOVN: | ||
224 | /* also VQMOVUN; op field and mnemonics don't line up */ | ||
225 | if (rm & 1) { | ||
226 | -- | ||
227 | 2.20.1 | ||
228 | |||
229 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | 1 | Convert the Neon narrowing moves VMQNV, VQMOVN, VQMOVUN in the 2-reg-misc | |
2 | group to decodetree. | ||
3 | |||
4 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
5 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
6 | Message-id: 20200616170844.13318-5-peter.maydell@linaro.org | ||
7 | --- | ||
8 | target/arm/neon-dp.decode | 9 ++++ | ||
9 | target/arm/translate-neon.inc.c | 59 ++++++++++++++++++++++++ | ||
10 | target/arm/translate.c | 81 +-------------------------------- | ||
11 | 3 files changed, 70 insertions(+), 79 deletions(-) | ||
12 | |||
13 | diff --git a/target/arm/neon-dp.decode b/target/arm/neon-dp.decode | ||
14 | index XXXXXXX..XXXXXXX 100644 | ||
15 | --- a/target/arm/neon-dp.decode | ||
16 | +++ b/target/arm/neon-dp.decode | ||
17 | @@ -XXX,XX +XXX,XX @@ Vimm_1r 1111 001 . 1 . 000 ... .... cmode:4 0 . op:1 1 .... @1reg_imm | ||
18 | |||
19 | @2misc .... ... .. . .. size:2 .. .... . .... q:1 . . .... \ | ||
20 | &2misc vm=%vm_dp vd=%vd_dp | ||
21 | + @2misc_q0 .... ... .. . .. size:2 .. .... . .... . . . .... \ | ||
22 | + &2misc vm=%vm_dp vd=%vd_dp q=0 | ||
23 | |||
24 | VREV64 1111 001 11 . 11 .. 00 .... 0 0000 . . 0 .... @2misc | ||
25 | |||
26 | @@ -XXX,XX +XXX,XX @@ Vimm_1r 1111 001 . 1 . 000 ... .... cmode:4 0 . op:1 1 .... @1reg_imm | ||
27 | |||
28 | VUZP 1111 001 11 . 11 .. 10 .... 0 0010 . . 0 .... @2misc | ||
29 | VZIP 1111 001 11 . 11 .. 10 .... 0 0011 . . 0 .... @2misc | ||
30 | + | ||
31 | + VMOVN 1111 001 11 . 11 .. 10 .... 0 0100 0 . 0 .... @2misc_q0 | ||
32 | + # VQMOVUN: unsigned result (source is always signed) | ||
33 | + VQMOVUN 1111 001 11 . 11 .. 10 .... 0 0100 1 . 0 .... @2misc_q0 | ||
34 | + # VQMOVN: signed result, source may be signed (_S) or unsigned (_U) | ||
35 | + VQMOVN_S 1111 001 11 . 11 .. 10 .... 0 0101 0 . 0 .... @2misc_q0 | ||
36 | + VQMOVN_U 1111 001 11 . 11 .. 10 .... 0 0101 1 . 0 .... @2misc_q0 | ||
37 | ] | ||
38 | |||
39 | # Subgroup for size != 0b11 | ||
40 | diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c | ||
41 | index XXXXXXX..XXXXXXX 100644 | ||
42 | --- a/target/arm/translate-neon.inc.c | ||
43 | +++ b/target/arm/translate-neon.inc.c | ||
44 | @@ -XXX,XX +XXX,XX @@ static bool trans_VZIP(DisasContext *s, arg_2misc *a) | ||
45 | }; | ||
46 | return do_zip_uzp(s, a, fn[a->q][a->size]); | ||
47 | } | ||
48 | + | ||
49 | +static bool do_vmovn(DisasContext *s, arg_2misc *a, | ||
50 | + NeonGenNarrowEnvFn *narrowfn) | ||
51 | +{ | ||
52 | + TCGv_i64 rm; | ||
53 | + TCGv_i32 rd0, rd1; | ||
54 | + | ||
55 | + if (!arm_dc_feature(s, ARM_FEATURE_NEON)) { | ||
56 | + return false; | ||
57 | + } | ||
58 | + | ||
59 | + /* UNDEF accesses to D16-D31 if they don't exist. */ | ||
60 | + if (!dc_isar_feature(aa32_simd_r32, s) && | ||
61 | + ((a->vd | a->vm) & 0x10)) { | ||
62 | + return false; | ||
63 | + } | ||
64 | + | ||
65 | + if (a->vm & 1) { | ||
66 | + return false; | ||
67 | + } | ||
68 | + | ||
69 | + if (!narrowfn) { | ||
70 | + return false; | ||
71 | + } | ||
72 | + | ||
73 | + if (!vfp_access_check(s)) { | ||
74 | + return true; | ||
75 | + } | ||
76 | + | ||
77 | + rm = tcg_temp_new_i64(); | ||
78 | + rd0 = tcg_temp_new_i32(); | ||
79 | + rd1 = tcg_temp_new_i32(); | ||
80 | + | ||
81 | + neon_load_reg64(rm, a->vm); | ||
82 | + narrowfn(rd0, cpu_env, rm); | ||
83 | + neon_load_reg64(rm, a->vm + 1); | ||
84 | + narrowfn(rd1, cpu_env, rm); | ||
85 | + neon_store_reg(a->vd, 0, rd0); | ||
86 | + neon_store_reg(a->vd, 1, rd1); | ||
87 | + tcg_temp_free_i64(rm); | ||
88 | + return true; | ||
89 | +} | ||
90 | + | ||
91 | +#define DO_VMOVN(INSN, FUNC) \ | ||
92 | + static bool trans_##INSN(DisasContext *s, arg_2misc *a) \ | ||
93 | + { \ | ||
94 | + static NeonGenNarrowEnvFn * const narrowfn[] = { \ | ||
95 | + FUNC##8, \ | ||
96 | + FUNC##16, \ | ||
97 | + FUNC##32, \ | ||
98 | + NULL, \ | ||
99 | + }; \ | ||
100 | + return do_vmovn(s, a, narrowfn[a->size]); \ | ||
101 | + } | ||
102 | + | ||
103 | +DO_VMOVN(VMOVN, gen_neon_narrow_u) | ||
104 | +DO_VMOVN(VQMOVUN, gen_helper_neon_unarrow_sat) | ||
105 | +DO_VMOVN(VQMOVN_S, gen_helper_neon_narrow_sat_s) | ||
106 | +DO_VMOVN(VQMOVN_U, gen_helper_neon_narrow_sat_u) | ||
107 | diff --git a/target/arm/translate.c b/target/arm/translate.c | ||
108 | index XXXXXXX..XXXXXXX 100644 | ||
109 | --- a/target/arm/translate.c | ||
110 | +++ b/target/arm/translate.c | ||
111 | @@ -XXX,XX +XXX,XX @@ static void gen_neon_trn_u16(TCGv_i32 t0, TCGv_i32 t1) | ||
112 | tcg_temp_free_i32(rd); | ||
113 | } | ||
114 | |||
115 | -static inline void gen_neon_narrow(int size, TCGv_i32 dest, TCGv_i64 src) | ||
116 | -{ | ||
117 | - switch (size) { | ||
118 | - case 0: gen_helper_neon_narrow_u8(dest, src); break; | ||
119 | - case 1: gen_helper_neon_narrow_u16(dest, src); break; | ||
120 | - case 2: tcg_gen_extrl_i64_i32(dest, src); break; | ||
121 | - default: abort(); | ||
122 | - } | ||
123 | -} | ||
124 | - | ||
125 | -static inline void gen_neon_narrow_sats(int size, TCGv_i32 dest, TCGv_i64 src) | ||
126 | -{ | ||
127 | - switch (size) { | ||
128 | - case 0: gen_helper_neon_narrow_sat_s8(dest, cpu_env, src); break; | ||
129 | - case 1: gen_helper_neon_narrow_sat_s16(dest, cpu_env, src); break; | ||
130 | - case 2: gen_helper_neon_narrow_sat_s32(dest, cpu_env, src); break; | ||
131 | - default: abort(); | ||
132 | - } | ||
133 | -} | ||
134 | - | ||
135 | -static inline void gen_neon_narrow_satu(int size, TCGv_i32 dest, TCGv_i64 src) | ||
136 | -{ | ||
137 | - switch (size) { | ||
138 | - case 0: gen_helper_neon_narrow_sat_u8(dest, cpu_env, src); break; | ||
139 | - case 1: gen_helper_neon_narrow_sat_u16(dest, cpu_env, src); break; | ||
140 | - case 2: gen_helper_neon_narrow_sat_u32(dest, cpu_env, src); break; | ||
141 | - default: abort(); | ||
142 | - } | ||
143 | -} | ||
144 | - | ||
145 | -static inline void gen_neon_unarrow_sats(int size, TCGv_i32 dest, TCGv_i64 src) | ||
146 | -{ | ||
147 | - switch (size) { | ||
148 | - case 0: gen_helper_neon_unarrow_sat8(dest, cpu_env, src); break; | ||
149 | - case 1: gen_helper_neon_unarrow_sat16(dest, cpu_env, src); break; | ||
150 | - case 2: gen_helper_neon_unarrow_sat32(dest, cpu_env, src); break; | ||
151 | - default: abort(); | ||
152 | - } | ||
153 | -} | ||
154 | - | ||
155 | static inline void gen_neon_widen(TCGv_i64 dest, TCGv_i32 src, int size, int u) | ||
156 | { | ||
157 | if (u) { | ||
158 | @@ -XXX,XX +XXX,XX @@ static inline void gen_neon_widen(TCGv_i64 dest, TCGv_i32 src, int size, int u) | ||
159 | tcg_temp_free_i32(src); | ||
160 | } | ||
161 | |||
162 | -static void gen_neon_narrow_op(int op, int u, int size, | ||
163 | - TCGv_i32 dest, TCGv_i64 src) | ||
164 | -{ | ||
165 | - if (op) { | ||
166 | - if (u) { | ||
167 | - gen_neon_unarrow_sats(size, dest, src); | ||
168 | - } else { | ||
169 | - gen_neon_narrow(size, dest, src); | ||
170 | - } | ||
171 | - } else { | ||
172 | - if (u) { | ||
173 | - gen_neon_narrow_satu(size, dest, src); | ||
174 | - } else { | ||
175 | - gen_neon_narrow_sats(size, dest, src); | ||
176 | - } | ||
177 | - } | ||
178 | -} | ||
179 | - | ||
180 | /* Symbolic constants for op fields for Neon 2-register miscellaneous. | ||
181 | * The values correspond to bits [17:16,10:7]; see the ARM ARM DDI0406B | ||
182 | * table A7-13. | ||
183 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) | ||
184 | !arm_dc_feature(s, ARM_FEATURE_V8)) { | ||
185 | return 1; | ||
186 | } | ||
187 | - if ((op != NEON_2RM_VMOVN && op != NEON_2RM_VQMOVN) && | ||
188 | - q && ((rm | rd) & 1)) { | ||
189 | + if (q && ((rm | rd) & 1)) { | ||
190 | return 1; | ||
191 | } | ||
192 | switch (op) { | ||
193 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) | ||
194 | case NEON_2RM_VPADAL: case NEON_2RM_VPADAL_U: | ||
195 | case NEON_2RM_VUZP: | ||
196 | case NEON_2RM_VZIP: | ||
197 | + case NEON_2RM_VMOVN: case NEON_2RM_VQMOVN: | ||
198 | /* handled by decodetree */ | ||
199 | return 1; | ||
200 | case NEON_2RM_VTRN: | ||
201 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) | ||
202 | goto elementwise; | ||
203 | } | ||
204 | break; | ||
205 | - case NEON_2RM_VMOVN: case NEON_2RM_VQMOVN: | ||
206 | - /* also VQMOVUN; op field and mnemonics don't line up */ | ||
207 | - if (rm & 1) { | ||
208 | - return 1; | ||
209 | - } | ||
210 | - tmp2 = NULL; | ||
211 | - for (pass = 0; pass < 2; pass++) { | ||
212 | - neon_load_reg64(cpu_V0, rm + pass); | ||
213 | - tmp = tcg_temp_new_i32(); | ||
214 | - gen_neon_narrow_op(op == NEON_2RM_VMOVN, q, size, | ||
215 | - tmp, cpu_V0); | ||
216 | - if (pass == 0) { | ||
217 | - tmp2 = tmp; | ||
218 | - } else { | ||
219 | - neon_store_reg(rd, 0, tmp2); | ||
220 | - neon_store_reg(rd, 1, tmp); | ||
221 | - } | ||
222 | - } | ||
223 | - break; | ||
224 | case NEON_2RM_VSHLL: | ||
225 | if (q || (rd & 1)) { | ||
226 | return 1; | ||
227 | -- | ||
228 | 2.20.1 | ||
229 | |||
230 | diff view generated by jsdifflib |
1 | As part of plumbing MemTxAttrs down to the IOMMU translate method, | 1 | Convert the VSHLL insn in the 2-reg-misc Neon group to decodetree. |
---|---|---|---|
2 | add MemTxAttrs as an argument to flatview_translate(); all its | ||
3 | callers now have attrs available. | ||
4 | 2 | ||
5 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 3 | 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> | 4 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
8 | Message-id: 20180521140402.23318-11-peter.maydell@linaro.org | 5 | Message-id: 20200616170844.13318-6-peter.maydell@linaro.org |
9 | --- | 6 | --- |
10 | include/exec/memory.h | 7 ++++--- | 7 | target/arm/neon-dp.decode | 2 ++ |
11 | exec.c | 17 +++++++++-------- | 8 | target/arm/translate-neon.inc.c | 52 +++++++++++++++++++++++++++++++++ |
12 | 2 files changed, 13 insertions(+), 11 deletions(-) | 9 | target/arm/translate.c | 35 +--------------------- |
10 | 3 files changed, 55 insertions(+), 34 deletions(-) | ||
13 | 11 | ||
14 | diff --git a/include/exec/memory.h b/include/exec/memory.h | 12 | diff --git a/target/arm/neon-dp.decode b/target/arm/neon-dp.decode |
15 | index XXXXXXX..XXXXXXX 100644 | 13 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/include/exec/memory.h | 14 | --- a/target/arm/neon-dp.decode |
17 | +++ b/include/exec/memory.h | 15 | +++ b/target/arm/neon-dp.decode |
18 | @@ -XXX,XX +XXX,XX @@ IOMMUTLBEntry address_space_get_iotlb_entry(AddressSpace *as, hwaddr addr, | 16 | @@ -XXX,XX +XXX,XX @@ Vimm_1r 1111 001 . 1 . 000 ... .... cmode:4 0 . op:1 1 .... @1reg_imm |
19 | */ | 17 | # VQMOVN: signed result, source may be signed (_S) or unsigned (_U) |
20 | MemoryRegion *flatview_translate(FlatView *fv, | 18 | VQMOVN_S 1111 001 11 . 11 .. 10 .... 0 0101 0 . 0 .... @2misc_q0 |
21 | hwaddr addr, hwaddr *xlat, | 19 | VQMOVN_U 1111 001 11 . 11 .. 10 .... 0 0101 1 . 0 .... @2misc_q0 |
22 | - hwaddr *len, bool is_write); | 20 | + |
23 | + hwaddr *len, bool is_write, | 21 | + VSHLL 1111 001 11 . 11 .. 10 .... 0 0110 0 . 0 .... @2misc_q0 |
24 | + MemTxAttrs attrs); | 22 | ] |
25 | 23 | ||
26 | static inline MemoryRegion *address_space_translate(AddressSpace *as, | 24 | # Subgroup for size != 0b11 |
27 | hwaddr addr, hwaddr *xlat, | 25 | diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c |
28 | @@ -XXX,XX +XXX,XX @@ static inline MemoryRegion *address_space_translate(AddressSpace *as, | 26 | index XXXXXXX..XXXXXXX 100644 |
29 | MemTxAttrs attrs) | 27 | --- a/target/arm/translate-neon.inc.c |
30 | { | 28 | +++ b/target/arm/translate-neon.inc.c |
31 | return flatview_translate(address_space_to_flatview(as), | 29 | @@ -XXX,XX +XXX,XX @@ DO_VMOVN(VMOVN, gen_neon_narrow_u) |
32 | - addr, xlat, len, is_write); | 30 | DO_VMOVN(VQMOVUN, gen_helper_neon_unarrow_sat) |
33 | + addr, xlat, len, is_write, attrs); | 31 | DO_VMOVN(VQMOVN_S, gen_helper_neon_narrow_sat_s) |
32 | DO_VMOVN(VQMOVN_U, gen_helper_neon_narrow_sat_u) | ||
33 | + | ||
34 | +static bool trans_VSHLL(DisasContext *s, arg_2misc *a) | ||
35 | +{ | ||
36 | + TCGv_i32 rm0, rm1; | ||
37 | + TCGv_i64 rd; | ||
38 | + static NeonGenWidenFn * const widenfns[] = { | ||
39 | + gen_helper_neon_widen_u8, | ||
40 | + gen_helper_neon_widen_u16, | ||
41 | + tcg_gen_extu_i32_i64, | ||
42 | + NULL, | ||
43 | + }; | ||
44 | + NeonGenWidenFn *widenfn = widenfns[a->size]; | ||
45 | + | ||
46 | + if (!arm_dc_feature(s, ARM_FEATURE_NEON)) { | ||
47 | + return false; | ||
48 | + } | ||
49 | + | ||
50 | + /* UNDEF accesses to D16-D31 if they don't exist. */ | ||
51 | + if (!dc_isar_feature(aa32_simd_r32, s) && | ||
52 | + ((a->vd | a->vm) & 0x10)) { | ||
53 | + return false; | ||
54 | + } | ||
55 | + | ||
56 | + if (a->vd & 1) { | ||
57 | + return false; | ||
58 | + } | ||
59 | + | ||
60 | + if (!widenfn) { | ||
61 | + return false; | ||
62 | + } | ||
63 | + | ||
64 | + if (!vfp_access_check(s)) { | ||
65 | + return true; | ||
66 | + } | ||
67 | + | ||
68 | + rd = tcg_temp_new_i64(); | ||
69 | + | ||
70 | + rm0 = neon_load_reg(a->vm, 0); | ||
71 | + rm1 = neon_load_reg(a->vm, 1); | ||
72 | + | ||
73 | + widenfn(rd, rm0); | ||
74 | + tcg_gen_shli_i64(rd, rd, 8 << a->size); | ||
75 | + neon_store_reg64(rd, a->vd); | ||
76 | + widenfn(rd, rm1); | ||
77 | + tcg_gen_shli_i64(rd, rd, 8 << a->size); | ||
78 | + neon_store_reg64(rd, a->vd + 1); | ||
79 | + | ||
80 | + tcg_temp_free_i64(rd); | ||
81 | + tcg_temp_free_i32(rm0); | ||
82 | + tcg_temp_free_i32(rm1); | ||
83 | + return true; | ||
84 | +} | ||
85 | diff --git a/target/arm/translate.c b/target/arm/translate.c | ||
86 | index XXXXXXX..XXXXXXX 100644 | ||
87 | --- a/target/arm/translate.c | ||
88 | +++ b/target/arm/translate.c | ||
89 | @@ -XXX,XX +XXX,XX @@ static void gen_neon_trn_u16(TCGv_i32 t0, TCGv_i32 t1) | ||
90 | tcg_temp_free_i32(rd); | ||
34 | } | 91 | } |
35 | 92 | ||
36 | /* address_space_access_valid: check for validity of accessing an address | 93 | -static inline void gen_neon_widen(TCGv_i64 dest, TCGv_i32 src, int size, int u) |
37 | @@ -XXX,XX +XXX,XX @@ MemTxResult address_space_read(AddressSpace *as, hwaddr addr, | 94 | -{ |
38 | rcu_read_lock(); | 95 | - if (u) { |
39 | fv = address_space_to_flatview(as); | 96 | - switch (size) { |
40 | l = len; | 97 | - case 0: gen_helper_neon_widen_u8(dest, src); break; |
41 | - mr = flatview_translate(fv, addr, &addr1, &l, false); | 98 | - case 1: gen_helper_neon_widen_u16(dest, src); break; |
42 | + mr = flatview_translate(fv, addr, &addr1, &l, false, attrs); | 99 | - case 2: tcg_gen_extu_i32_i64(dest, src); break; |
43 | if (len == l && memory_access_is_direct(mr, false)) { | 100 | - default: abort(); |
44 | ptr = qemu_map_ram_ptr(mr->ram_block, addr1); | 101 | - } |
45 | memcpy(buf, ptr, len); | 102 | - } else { |
46 | diff --git a/exec.c b/exec.c | 103 | - switch (size) { |
47 | index XXXXXXX..XXXXXXX 100644 | 104 | - case 0: gen_helper_neon_widen_s8(dest, src); break; |
48 | --- a/exec.c | 105 | - case 1: gen_helper_neon_widen_s16(dest, src); break; |
49 | +++ b/exec.c | 106 | - case 2: tcg_gen_ext_i32_i64(dest, src); break; |
50 | @@ -XXX,XX +XXX,XX @@ iotlb_fail: | 107 | - default: abort(); |
51 | 108 | - } | |
52 | /* Called from RCU critical section */ | 109 | - } |
53 | MemoryRegion *flatview_translate(FlatView *fv, hwaddr addr, hwaddr *xlat, | 110 | - tcg_temp_free_i32(src); |
54 | - hwaddr *plen, bool is_write) | 111 | -} |
55 | + hwaddr *plen, bool is_write, | 112 | - |
56 | + MemTxAttrs attrs) | 113 | /* Symbolic constants for op fields for Neon 2-register miscellaneous. |
57 | { | 114 | * The values correspond to bits [17:16,10:7]; see the ARM ARM DDI0406B |
58 | MemoryRegion *mr; | 115 | * table A7-13. |
59 | MemoryRegionSection section; | 116 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) |
60 | @@ -XXX,XX +XXX,XX @@ static MemTxResult flatview_write_continue(FlatView *fv, hwaddr addr, | 117 | case NEON_2RM_VUZP: |
61 | } | 118 | case NEON_2RM_VZIP: |
62 | 119 | case NEON_2RM_VMOVN: case NEON_2RM_VQMOVN: | |
63 | l = len; | 120 | + case NEON_2RM_VSHLL: |
64 | - mr = flatview_translate(fv, addr, &addr1, &l, true); | 121 | /* handled by decodetree */ |
65 | + mr = flatview_translate(fv, addr, &addr1, &l, true, attrs); | 122 | return 1; |
66 | } | 123 | case NEON_2RM_VTRN: |
67 | 124 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) | |
68 | return result; | 125 | goto elementwise; |
69 | @@ -XXX,XX +XXX,XX @@ static MemTxResult flatview_write(FlatView *fv, hwaddr addr, MemTxAttrs attrs, | 126 | } |
70 | MemTxResult result = MEMTX_OK; | 127 | break; |
71 | 128 | - case NEON_2RM_VSHLL: | |
72 | l = len; | 129 | - if (q || (rd & 1)) { |
73 | - mr = flatview_translate(fv, addr, &addr1, &l, true); | 130 | - return 1; |
74 | + mr = flatview_translate(fv, addr, &addr1, &l, true, attrs); | 131 | - } |
75 | result = flatview_write_continue(fv, addr, attrs, buf, len, | 132 | - tmp = neon_load_reg(rm, 0); |
76 | addr1, l, mr); | 133 | - tmp2 = neon_load_reg(rm, 1); |
77 | 134 | - for (pass = 0; pass < 2; pass++) { | |
78 | @@ -XXX,XX +XXX,XX @@ MemTxResult flatview_read_continue(FlatView *fv, hwaddr addr, | 135 | - if (pass == 1) |
79 | } | 136 | - tmp = tmp2; |
80 | 137 | - gen_neon_widen(cpu_V0, tmp, size, 1); | |
81 | l = len; | 138 | - tcg_gen_shli_i64(cpu_V0, cpu_V0, 8 << size); |
82 | - mr = flatview_translate(fv, addr, &addr1, &l, false); | 139 | - neon_store_reg64(cpu_V0, rd + pass); |
83 | + mr = flatview_translate(fv, addr, &addr1, &l, false, attrs); | 140 | - } |
84 | } | 141 | - break; |
85 | 142 | case NEON_2RM_VCVT_F16_F32: | |
86 | return result; | 143 | { |
87 | @@ -XXX,XX +XXX,XX @@ static MemTxResult flatview_read(FlatView *fv, hwaddr addr, | 144 | TCGv_ptr fpst; |
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 | -- | 145 | -- |
124 | 2.17.1 | 146 | 2.20.1 |
125 | 147 | ||
126 | 148 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | 1 | Convert the Neon insns in the 2-reg-misc group which are | |
2 | VCVT between f32 and f16 to decodetree. | ||
3 | |||
4 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
5 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
6 | Message-id: 20200616170844.13318-7-peter.maydell@linaro.org | ||
7 | --- | ||
8 | target/arm/neon-dp.decode | 3 ++ | ||
9 | target/arm/translate-neon.inc.c | 96 +++++++++++++++++++++++++++++++++ | ||
10 | target/arm/translate.c | 65 ++-------------------- | ||
11 | 3 files changed, 102 insertions(+), 62 deletions(-) | ||
12 | |||
13 | diff --git a/target/arm/neon-dp.decode b/target/arm/neon-dp.decode | ||
14 | index XXXXXXX..XXXXXXX 100644 | ||
15 | --- a/target/arm/neon-dp.decode | ||
16 | +++ b/target/arm/neon-dp.decode | ||
17 | @@ -XXX,XX +XXX,XX @@ Vimm_1r 1111 001 . 1 . 000 ... .... cmode:4 0 . op:1 1 .... @1reg_imm | ||
18 | VQMOVN_U 1111 001 11 . 11 .. 10 .... 0 0101 1 . 0 .... @2misc_q0 | ||
19 | |||
20 | VSHLL 1111 001 11 . 11 .. 10 .... 0 0110 0 . 0 .... @2misc_q0 | ||
21 | + | ||
22 | + VCVT_F16_F32 1111 001 11 . 11 .. 10 .... 0 1100 0 . 0 .... @2misc_q0 | ||
23 | + VCVT_F32_F16 1111 001 11 . 11 .. 10 .... 0 1110 0 . 0 .... @2misc_q0 | ||
24 | ] | ||
25 | |||
26 | # Subgroup for size != 0b11 | ||
27 | diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c | ||
28 | index XXXXXXX..XXXXXXX 100644 | ||
29 | --- a/target/arm/translate-neon.inc.c | ||
30 | +++ b/target/arm/translate-neon.inc.c | ||
31 | @@ -XXX,XX +XXX,XX @@ static bool trans_VSHLL(DisasContext *s, arg_2misc *a) | ||
32 | tcg_temp_free_i32(rm1); | ||
33 | return true; | ||
34 | } | ||
35 | + | ||
36 | +static bool trans_VCVT_F16_F32(DisasContext *s, arg_2misc *a) | ||
37 | +{ | ||
38 | + TCGv_ptr fpst; | ||
39 | + TCGv_i32 ahp, tmp, tmp2, tmp3; | ||
40 | + | ||
41 | + if (!arm_dc_feature(s, ARM_FEATURE_NEON) || | ||
42 | + !dc_isar_feature(aa32_fp16_spconv, s)) { | ||
43 | + return false; | ||
44 | + } | ||
45 | + | ||
46 | + /* UNDEF accesses to D16-D31 if they don't exist. */ | ||
47 | + if (!dc_isar_feature(aa32_simd_r32, s) && | ||
48 | + ((a->vd | a->vm) & 0x10)) { | ||
49 | + return false; | ||
50 | + } | ||
51 | + | ||
52 | + if ((a->vm & 1) || (a->size != 1)) { | ||
53 | + return false; | ||
54 | + } | ||
55 | + | ||
56 | + if (!vfp_access_check(s)) { | ||
57 | + return true; | ||
58 | + } | ||
59 | + | ||
60 | + fpst = get_fpstatus_ptr(true); | ||
61 | + ahp = get_ahp_flag(); | ||
62 | + tmp = neon_load_reg(a->vm, 0); | ||
63 | + gen_helper_vfp_fcvt_f32_to_f16(tmp, tmp, fpst, ahp); | ||
64 | + tmp2 = neon_load_reg(a->vm, 1); | ||
65 | + gen_helper_vfp_fcvt_f32_to_f16(tmp2, tmp2, fpst, ahp); | ||
66 | + tcg_gen_shli_i32(tmp2, tmp2, 16); | ||
67 | + tcg_gen_or_i32(tmp2, tmp2, tmp); | ||
68 | + tcg_temp_free_i32(tmp); | ||
69 | + tmp = neon_load_reg(a->vm, 2); | ||
70 | + gen_helper_vfp_fcvt_f32_to_f16(tmp, tmp, fpst, ahp); | ||
71 | + tmp3 = neon_load_reg(a->vm, 3); | ||
72 | + neon_store_reg(a->vd, 0, tmp2); | ||
73 | + gen_helper_vfp_fcvt_f32_to_f16(tmp3, tmp3, fpst, ahp); | ||
74 | + tcg_gen_shli_i32(tmp3, tmp3, 16); | ||
75 | + tcg_gen_or_i32(tmp3, tmp3, tmp); | ||
76 | + neon_store_reg(a->vd, 1, tmp3); | ||
77 | + tcg_temp_free_i32(tmp); | ||
78 | + tcg_temp_free_i32(ahp); | ||
79 | + tcg_temp_free_ptr(fpst); | ||
80 | + | ||
81 | + return true; | ||
82 | +} | ||
83 | + | ||
84 | +static bool trans_VCVT_F32_F16(DisasContext *s, arg_2misc *a) | ||
85 | +{ | ||
86 | + TCGv_ptr fpst; | ||
87 | + TCGv_i32 ahp, tmp, tmp2, tmp3; | ||
88 | + | ||
89 | + if (!arm_dc_feature(s, ARM_FEATURE_NEON) || | ||
90 | + !dc_isar_feature(aa32_fp16_spconv, s)) { | ||
91 | + return false; | ||
92 | + } | ||
93 | + | ||
94 | + /* UNDEF accesses to D16-D31 if they don't exist. */ | ||
95 | + if (!dc_isar_feature(aa32_simd_r32, s) && | ||
96 | + ((a->vd | a->vm) & 0x10)) { | ||
97 | + return false; | ||
98 | + } | ||
99 | + | ||
100 | + if ((a->vd & 1) || (a->size != 1)) { | ||
101 | + return false; | ||
102 | + } | ||
103 | + | ||
104 | + if (!vfp_access_check(s)) { | ||
105 | + return true; | ||
106 | + } | ||
107 | + | ||
108 | + fpst = get_fpstatus_ptr(true); | ||
109 | + ahp = get_ahp_flag(); | ||
110 | + tmp3 = tcg_temp_new_i32(); | ||
111 | + tmp = neon_load_reg(a->vm, 0); | ||
112 | + tmp2 = neon_load_reg(a->vm, 1); | ||
113 | + tcg_gen_ext16u_i32(tmp3, tmp); | ||
114 | + gen_helper_vfp_fcvt_f16_to_f32(tmp3, tmp3, fpst, ahp); | ||
115 | + neon_store_reg(a->vd, 0, tmp3); | ||
116 | + tcg_gen_shri_i32(tmp, tmp, 16); | ||
117 | + gen_helper_vfp_fcvt_f16_to_f32(tmp, tmp, fpst, ahp); | ||
118 | + neon_store_reg(a->vd, 1, tmp); | ||
119 | + tmp3 = tcg_temp_new_i32(); | ||
120 | + tcg_gen_ext16u_i32(tmp3, tmp2); | ||
121 | + gen_helper_vfp_fcvt_f16_to_f32(tmp3, tmp3, fpst, ahp); | ||
122 | + neon_store_reg(a->vd, 2, tmp3); | ||
123 | + tcg_gen_shri_i32(tmp2, tmp2, 16); | ||
124 | + gen_helper_vfp_fcvt_f16_to_f32(tmp2, tmp2, fpst, ahp); | ||
125 | + neon_store_reg(a->vd, 3, tmp2); | ||
126 | + tcg_temp_free_i32(ahp); | ||
127 | + tcg_temp_free_ptr(fpst); | ||
128 | + | ||
129 | + return true; | ||
130 | +} | ||
131 | diff --git a/target/arm/translate.c b/target/arm/translate.c | ||
132 | index XXXXXXX..XXXXXXX 100644 | ||
133 | --- a/target/arm/translate.c | ||
134 | +++ b/target/arm/translate.c | ||
135 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) | ||
136 | int pass; | ||
137 | int u; | ||
138 | int vec_size; | ||
139 | - TCGv_i32 tmp, tmp2, tmp3; | ||
140 | + TCGv_i32 tmp, tmp2; | ||
141 | |||
142 | if (!arm_dc_feature(s, ARM_FEATURE_NEON)) { | ||
143 | return 1; | ||
144 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) | ||
145 | case NEON_2RM_VZIP: | ||
146 | case NEON_2RM_VMOVN: case NEON_2RM_VQMOVN: | ||
147 | case NEON_2RM_VSHLL: | ||
148 | + case NEON_2RM_VCVT_F16_F32: | ||
149 | + case NEON_2RM_VCVT_F32_F16: | ||
150 | /* handled by decodetree */ | ||
151 | return 1; | ||
152 | case NEON_2RM_VTRN: | ||
153 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) | ||
154 | goto elementwise; | ||
155 | } | ||
156 | break; | ||
157 | - case NEON_2RM_VCVT_F16_F32: | ||
158 | - { | ||
159 | - TCGv_ptr fpst; | ||
160 | - TCGv_i32 ahp; | ||
161 | - | ||
162 | - if (!dc_isar_feature(aa32_fp16_spconv, s) || | ||
163 | - q || (rm & 1)) { | ||
164 | - return 1; | ||
165 | - } | ||
166 | - fpst = get_fpstatus_ptr(true); | ||
167 | - ahp = get_ahp_flag(); | ||
168 | - tmp = neon_load_reg(rm, 0); | ||
169 | - gen_helper_vfp_fcvt_f32_to_f16(tmp, tmp, fpst, ahp); | ||
170 | - tmp2 = neon_load_reg(rm, 1); | ||
171 | - gen_helper_vfp_fcvt_f32_to_f16(tmp2, tmp2, fpst, ahp); | ||
172 | - tcg_gen_shli_i32(tmp2, tmp2, 16); | ||
173 | - tcg_gen_or_i32(tmp2, tmp2, tmp); | ||
174 | - tcg_temp_free_i32(tmp); | ||
175 | - tmp = neon_load_reg(rm, 2); | ||
176 | - gen_helper_vfp_fcvt_f32_to_f16(tmp, tmp, fpst, ahp); | ||
177 | - tmp3 = neon_load_reg(rm, 3); | ||
178 | - neon_store_reg(rd, 0, tmp2); | ||
179 | - gen_helper_vfp_fcvt_f32_to_f16(tmp3, tmp3, fpst, ahp); | ||
180 | - tcg_gen_shli_i32(tmp3, tmp3, 16); | ||
181 | - tcg_gen_or_i32(tmp3, tmp3, tmp); | ||
182 | - neon_store_reg(rd, 1, tmp3); | ||
183 | - tcg_temp_free_i32(tmp); | ||
184 | - tcg_temp_free_i32(ahp); | ||
185 | - tcg_temp_free_ptr(fpst); | ||
186 | - break; | ||
187 | - } | ||
188 | - case NEON_2RM_VCVT_F32_F16: | ||
189 | - { | ||
190 | - TCGv_ptr fpst; | ||
191 | - TCGv_i32 ahp; | ||
192 | - if (!dc_isar_feature(aa32_fp16_spconv, s) || | ||
193 | - q || (rd & 1)) { | ||
194 | - return 1; | ||
195 | - } | ||
196 | - fpst = get_fpstatus_ptr(true); | ||
197 | - ahp = get_ahp_flag(); | ||
198 | - tmp3 = tcg_temp_new_i32(); | ||
199 | - tmp = neon_load_reg(rm, 0); | ||
200 | - tmp2 = neon_load_reg(rm, 1); | ||
201 | - tcg_gen_ext16u_i32(tmp3, tmp); | ||
202 | - gen_helper_vfp_fcvt_f16_to_f32(tmp3, tmp3, fpst, ahp); | ||
203 | - neon_store_reg(rd, 0, tmp3); | ||
204 | - tcg_gen_shri_i32(tmp, tmp, 16); | ||
205 | - gen_helper_vfp_fcvt_f16_to_f32(tmp, tmp, fpst, ahp); | ||
206 | - neon_store_reg(rd, 1, tmp); | ||
207 | - tmp3 = tcg_temp_new_i32(); | ||
208 | - tcg_gen_ext16u_i32(tmp3, tmp2); | ||
209 | - gen_helper_vfp_fcvt_f16_to_f32(tmp3, tmp3, fpst, ahp); | ||
210 | - neon_store_reg(rd, 2, tmp3); | ||
211 | - tcg_gen_shri_i32(tmp2, tmp2, 16); | ||
212 | - gen_helper_vfp_fcvt_f16_to_f32(tmp2, tmp2, fpst, ahp); | ||
213 | - neon_store_reg(rd, 3, tmp2); | ||
214 | - tcg_temp_free_i32(ahp); | ||
215 | - tcg_temp_free_ptr(fpst); | ||
216 | - break; | ||
217 | - } | ||
218 | case NEON_2RM_AESE: case NEON_2RM_AESMC: | ||
219 | if (!dc_isar_feature(aa32_aes, s) || ((rm | rd) & 1)) { | ||
220 | return 1; | ||
221 | -- | ||
222 | 2.20.1 | ||
223 | |||
224 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | Convert to decodetree the insns in the Neon 2-reg-misc grouping which | ||
2 | we implement using gvec. | ||
1 | 3 | ||
4 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
5 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
6 | Message-id: 20200616170844.13318-8-peter.maydell@linaro.org | ||
7 | --- | ||
8 | target/arm/neon-dp.decode | 11 +++++++ | ||
9 | target/arm/translate-neon.inc.c | 55 +++++++++++++++++++++++++++++++++ | ||
10 | target/arm/translate.c | 35 +++++---------------- | ||
11 | 3 files changed, 74 insertions(+), 27 deletions(-) | ||
12 | |||
13 | diff --git a/target/arm/neon-dp.decode b/target/arm/neon-dp.decode | ||
14 | index XXXXXXX..XXXXXXX 100644 | ||
15 | --- a/target/arm/neon-dp.decode | ||
16 | +++ b/target/arm/neon-dp.decode | ||
17 | @@ -XXX,XX +XXX,XX @@ Vimm_1r 1111 001 . 1 . 000 ... .... cmode:4 0 . op:1 1 .... @1reg_imm | ||
18 | VPADDL_S 1111 001 11 . 11 .. 00 .... 0 0100 . . 0 .... @2misc | ||
19 | VPADDL_U 1111 001 11 . 11 .. 00 .... 0 0101 . . 0 .... @2misc | ||
20 | |||
21 | + VMVN 1111 001 11 . 11 .. 00 .... 0 1011 . . 0 .... @2misc | ||
22 | + | ||
23 | VPADAL_S 1111 001 11 . 11 .. 00 .... 0 1100 . . 0 .... @2misc | ||
24 | VPADAL_U 1111 001 11 . 11 .. 00 .... 0 1101 . . 0 .... @2misc | ||
25 | |||
26 | + VCGT0 1111 001 11 . 11 .. 01 .... 0 0000 . . 0 .... @2misc | ||
27 | + VCGE0 1111 001 11 . 11 .. 01 .... 0 0001 . . 0 .... @2misc | ||
28 | + VCEQ0 1111 001 11 . 11 .. 01 .... 0 0010 . . 0 .... @2misc | ||
29 | + VCLE0 1111 001 11 . 11 .. 01 .... 0 0011 . . 0 .... @2misc | ||
30 | + VCLT0 1111 001 11 . 11 .. 01 .... 0 0100 . . 0 .... @2misc | ||
31 | + | ||
32 | + VABS 1111 001 11 . 11 .. 01 .... 0 0110 . . 0 .... @2misc | ||
33 | + VNEG 1111 001 11 . 11 .. 01 .... 0 0111 . . 0 .... @2misc | ||
34 | + | ||
35 | VUZP 1111 001 11 . 11 .. 10 .... 0 0010 . . 0 .... @2misc | ||
36 | VZIP 1111 001 11 . 11 .. 10 .... 0 0011 . . 0 .... @2misc | ||
37 | |||
38 | diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c | ||
39 | index XXXXXXX..XXXXXXX 100644 | ||
40 | --- a/target/arm/translate-neon.inc.c | ||
41 | +++ b/target/arm/translate-neon.inc.c | ||
42 | @@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_F32_F16(DisasContext *s, arg_2misc *a) | ||
43 | |||
44 | return true; | ||
45 | } | ||
46 | + | ||
47 | +static bool do_2misc_vec(DisasContext *s, arg_2misc *a, GVecGen2Fn *fn) | ||
48 | +{ | ||
49 | + int vec_size = a->q ? 16 : 8; | ||
50 | + int rd_ofs = neon_reg_offset(a->vd, 0); | ||
51 | + int rm_ofs = neon_reg_offset(a->vm, 0); | ||
52 | + | ||
53 | + if (!arm_dc_feature(s, ARM_FEATURE_NEON)) { | ||
54 | + return false; | ||
55 | + } | ||
56 | + | ||
57 | + /* UNDEF accesses to D16-D31 if they don't exist. */ | ||
58 | + if (!dc_isar_feature(aa32_simd_r32, s) && | ||
59 | + ((a->vd | a->vm) & 0x10)) { | ||
60 | + return false; | ||
61 | + } | ||
62 | + | ||
63 | + if (a->size == 3) { | ||
64 | + return false; | ||
65 | + } | ||
66 | + | ||
67 | + if ((a->vd | a->vm) & a->q) { | ||
68 | + return false; | ||
69 | + } | ||
70 | + | ||
71 | + if (!vfp_access_check(s)) { | ||
72 | + return true; | ||
73 | + } | ||
74 | + | ||
75 | + fn(a->size, rd_ofs, rm_ofs, vec_size, vec_size); | ||
76 | + | ||
77 | + return true; | ||
78 | +} | ||
79 | + | ||
80 | +#define DO_2MISC_VEC(INSN, FN) \ | ||
81 | + static bool trans_##INSN(DisasContext *s, arg_2misc *a) \ | ||
82 | + { \ | ||
83 | + return do_2misc_vec(s, a, FN); \ | ||
84 | + } | ||
85 | + | ||
86 | +DO_2MISC_VEC(VNEG, tcg_gen_gvec_neg) | ||
87 | +DO_2MISC_VEC(VABS, tcg_gen_gvec_abs) | ||
88 | +DO_2MISC_VEC(VCEQ0, gen_gvec_ceq0) | ||
89 | +DO_2MISC_VEC(VCGT0, gen_gvec_cgt0) | ||
90 | +DO_2MISC_VEC(VCLE0, gen_gvec_cle0) | ||
91 | +DO_2MISC_VEC(VCGE0, gen_gvec_cge0) | ||
92 | +DO_2MISC_VEC(VCLT0, gen_gvec_clt0) | ||
93 | + | ||
94 | +static bool trans_VMVN(DisasContext *s, arg_2misc *a) | ||
95 | +{ | ||
96 | + if (a->size != 0) { | ||
97 | + return false; | ||
98 | + } | ||
99 | + return do_2misc_vec(s, a, tcg_gen_gvec_not); | ||
100 | +} | ||
101 | diff --git a/target/arm/translate.c b/target/arm/translate.c | ||
102 | index XXXXXXX..XXXXXXX 100644 | ||
103 | --- a/target/arm/translate.c | ||
104 | +++ b/target/arm/translate.c | ||
105 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) | ||
106 | int size; | ||
107 | int pass; | ||
108 | int u; | ||
109 | - int vec_size; | ||
110 | TCGv_i32 tmp, tmp2; | ||
111 | |||
112 | if (!arm_dc_feature(s, ARM_FEATURE_NEON)) { | ||
113 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) | ||
114 | VFP_DREG_D(rd, insn); | ||
115 | VFP_DREG_M(rm, insn); | ||
116 | size = (insn >> 20) & 3; | ||
117 | - vec_size = q ? 16 : 8; | ||
118 | rd_ofs = neon_reg_offset(rd, 0); | ||
119 | rm_ofs = neon_reg_offset(rm, 0); | ||
120 | |||
121 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) | ||
122 | case NEON_2RM_VSHLL: | ||
123 | case NEON_2RM_VCVT_F16_F32: | ||
124 | case NEON_2RM_VCVT_F32_F16: | ||
125 | + case NEON_2RM_VMVN: | ||
126 | + case NEON_2RM_VNEG: | ||
127 | + case NEON_2RM_VABS: | ||
128 | + case NEON_2RM_VCEQ0: | ||
129 | + case NEON_2RM_VCGT0: | ||
130 | + case NEON_2RM_VCLE0: | ||
131 | + case NEON_2RM_VCGE0: | ||
132 | + case NEON_2RM_VCLT0: | ||
133 | /* handled by decodetree */ | ||
134 | return 1; | ||
135 | case NEON_2RM_VTRN: | ||
136 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) | ||
137 | q ? gen_helper_crypto_sha256su0 | ||
138 | : gen_helper_crypto_sha1su1); | ||
139 | break; | ||
140 | - case NEON_2RM_VMVN: | ||
141 | - tcg_gen_gvec_not(0, rd_ofs, rm_ofs, vec_size, vec_size); | ||
142 | - break; | ||
143 | - case NEON_2RM_VNEG: | ||
144 | - tcg_gen_gvec_neg(size, rd_ofs, rm_ofs, vec_size, vec_size); | ||
145 | - break; | ||
146 | - case NEON_2RM_VABS: | ||
147 | - tcg_gen_gvec_abs(size, rd_ofs, rm_ofs, vec_size, vec_size); | ||
148 | - break; | ||
149 | - | ||
150 | - case NEON_2RM_VCEQ0: | ||
151 | - gen_gvec_ceq0(size, rd_ofs, rm_ofs, vec_size, vec_size); | ||
152 | - break; | ||
153 | - case NEON_2RM_VCGT0: | ||
154 | - gen_gvec_cgt0(size, rd_ofs, rm_ofs, vec_size, vec_size); | ||
155 | - break; | ||
156 | - case NEON_2RM_VCLE0: | ||
157 | - gen_gvec_cle0(size, rd_ofs, rm_ofs, vec_size, vec_size); | ||
158 | - break; | ||
159 | - case NEON_2RM_VCGE0: | ||
160 | - gen_gvec_cge0(size, rd_ofs, rm_ofs, vec_size, vec_size); | ||
161 | - break; | ||
162 | - case NEON_2RM_VCLT0: | ||
163 | - gen_gvec_clt0(size, rd_ofs, rm_ofs, vec_size, vec_size); | ||
164 | - break; | ||
165 | |||
166 | default: | ||
167 | elementwise: | ||
168 | -- | ||
169 | 2.20.1 | ||
170 | |||
171 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | Convert the Neon-2-reg misc crypto ops (AESE, AESMC, SHA1H, SHA1SU1) | ||
2 | to decodetree. | ||
1 | 3 | ||
4 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
5 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
6 | Message-id: 20200616170844.13318-9-peter.maydell@linaro.org | ||
7 | --- | ||
8 | target/arm/neon-dp.decode | 12 ++++++++ | ||
9 | target/arm/translate-neon.inc.c | 42 ++++++++++++++++++++++++++ | ||
10 | target/arm/translate.c | 52 +++------------------------------ | ||
11 | 3 files changed, 58 insertions(+), 48 deletions(-) | ||
12 | |||
13 | diff --git a/target/arm/neon-dp.decode b/target/arm/neon-dp.decode | ||
14 | index XXXXXXX..XXXXXXX 100644 | ||
15 | --- a/target/arm/neon-dp.decode | ||
16 | +++ b/target/arm/neon-dp.decode | ||
17 | @@ -XXX,XX +XXX,XX @@ Vimm_1r 1111 001 . 1 . 000 ... .... cmode:4 0 . op:1 1 .... @1reg_imm | ||
18 | &2misc vm=%vm_dp vd=%vd_dp | ||
19 | @2misc_q0 .... ... .. . .. size:2 .. .... . .... . . . .... \ | ||
20 | &2misc vm=%vm_dp vd=%vd_dp q=0 | ||
21 | + @2misc_q1 .... ... .. . .. size:2 .. .... . .... . . . .... \ | ||
22 | + &2misc vm=%vm_dp vd=%vd_dp q=1 | ||
23 | |||
24 | VREV64 1111 001 11 . 11 .. 00 .... 0 0000 . . 0 .... @2misc | ||
25 | |||
26 | VPADDL_S 1111 001 11 . 11 .. 00 .... 0 0100 . . 0 .... @2misc | ||
27 | VPADDL_U 1111 001 11 . 11 .. 00 .... 0 0101 . . 0 .... @2misc | ||
28 | |||
29 | + AESE 1111 001 11 . 11 .. 00 .... 0 0110 0 . 0 .... @2misc_q1 | ||
30 | + AESD 1111 001 11 . 11 .. 00 .... 0 0110 1 . 0 .... @2misc_q1 | ||
31 | + AESMC 1111 001 11 . 11 .. 00 .... 0 0111 0 . 0 .... @2misc_q1 | ||
32 | + AESIMC 1111 001 11 . 11 .. 00 .... 0 0111 1 . 0 .... @2misc_q1 | ||
33 | + | ||
34 | VMVN 1111 001 11 . 11 .. 00 .... 0 1011 . . 0 .... @2misc | ||
35 | |||
36 | VPADAL_S 1111 001 11 . 11 .. 00 .... 0 1100 . . 0 .... @2misc | ||
37 | @@ -XXX,XX +XXX,XX @@ Vimm_1r 1111 001 . 1 . 000 ... .... cmode:4 0 . op:1 1 .... @1reg_imm | ||
38 | VCLE0 1111 001 11 . 11 .. 01 .... 0 0011 . . 0 .... @2misc | ||
39 | VCLT0 1111 001 11 . 11 .. 01 .... 0 0100 . . 0 .... @2misc | ||
40 | |||
41 | + SHA1H 1111 001 11 . 11 .. 01 .... 0 0101 1 . 0 .... @2misc_q1 | ||
42 | + | ||
43 | VABS 1111 001 11 . 11 .. 01 .... 0 0110 . . 0 .... @2misc | ||
44 | VNEG 1111 001 11 . 11 .. 01 .... 0 0111 . . 0 .... @2misc | ||
45 | |||
46 | @@ -XXX,XX +XXX,XX @@ Vimm_1r 1111 001 . 1 . 000 ... .... cmode:4 0 . op:1 1 .... @1reg_imm | ||
47 | |||
48 | VSHLL 1111 001 11 . 11 .. 10 .... 0 0110 0 . 0 .... @2misc_q0 | ||
49 | |||
50 | + SHA1SU1 1111 001 11 . 11 .. 10 .... 0 0111 0 . 0 .... @2misc_q1 | ||
51 | + SHA256SU0 1111 001 11 . 11 .. 10 .... 0 0111 1 . 0 .... @2misc_q1 | ||
52 | + | ||
53 | VCVT_F16_F32 1111 001 11 . 11 .. 10 .... 0 1100 0 . 0 .... @2misc_q0 | ||
54 | VCVT_F32_F16 1111 001 11 . 11 .. 10 .... 0 1110 0 . 0 .... @2misc_q0 | ||
55 | ] | ||
56 | diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c | ||
57 | index XXXXXXX..XXXXXXX 100644 | ||
58 | --- a/target/arm/translate-neon.inc.c | ||
59 | +++ b/target/arm/translate-neon.inc.c | ||
60 | @@ -XXX,XX +XXX,XX @@ static bool trans_VMVN(DisasContext *s, arg_2misc *a) | ||
61 | } | ||
62 | return do_2misc_vec(s, a, tcg_gen_gvec_not); | ||
63 | } | ||
64 | + | ||
65 | +#define WRAP_2M_3_OOL_FN(WRAPNAME, FUNC, DATA) \ | ||
66 | + static void WRAPNAME(unsigned vece, uint32_t rd_ofs, \ | ||
67 | + uint32_t rm_ofs, uint32_t oprsz, \ | ||
68 | + uint32_t maxsz) \ | ||
69 | + { \ | ||
70 | + tcg_gen_gvec_3_ool(rd_ofs, rd_ofs, rm_ofs, oprsz, maxsz, \ | ||
71 | + DATA, FUNC); \ | ||
72 | + } | ||
73 | + | ||
74 | +#define WRAP_2M_2_OOL_FN(WRAPNAME, FUNC, DATA) \ | ||
75 | + static void WRAPNAME(unsigned vece, uint32_t rd_ofs, \ | ||
76 | + uint32_t rm_ofs, uint32_t oprsz, \ | ||
77 | + uint32_t maxsz) \ | ||
78 | + { \ | ||
79 | + tcg_gen_gvec_2_ool(rd_ofs, rm_ofs, oprsz, maxsz, DATA, FUNC); \ | ||
80 | + } | ||
81 | + | ||
82 | +WRAP_2M_3_OOL_FN(gen_AESE, gen_helper_crypto_aese, 0) | ||
83 | +WRAP_2M_3_OOL_FN(gen_AESD, gen_helper_crypto_aese, 1) | ||
84 | +WRAP_2M_2_OOL_FN(gen_AESMC, gen_helper_crypto_aesmc, 0) | ||
85 | +WRAP_2M_2_OOL_FN(gen_AESIMC, gen_helper_crypto_aesmc, 1) | ||
86 | +WRAP_2M_2_OOL_FN(gen_SHA1H, gen_helper_crypto_sha1h, 0) | ||
87 | +WRAP_2M_2_OOL_FN(gen_SHA1SU1, gen_helper_crypto_sha1su1, 0) | ||
88 | +WRAP_2M_2_OOL_FN(gen_SHA256SU0, gen_helper_crypto_sha256su0, 0) | ||
89 | + | ||
90 | +#define DO_2M_CRYPTO(INSN, FEATURE, SIZE) \ | ||
91 | + static bool trans_##INSN(DisasContext *s, arg_2misc *a) \ | ||
92 | + { \ | ||
93 | + if (!dc_isar_feature(FEATURE, s) || a->size != SIZE) { \ | ||
94 | + return false; \ | ||
95 | + } \ | ||
96 | + return do_2misc_vec(s, a, gen_##INSN); \ | ||
97 | + } | ||
98 | + | ||
99 | +DO_2M_CRYPTO(AESE, aa32_aes, 0) | ||
100 | +DO_2M_CRYPTO(AESD, aa32_aes, 0) | ||
101 | +DO_2M_CRYPTO(AESMC, aa32_aes, 0) | ||
102 | +DO_2M_CRYPTO(AESIMC, aa32_aes, 0) | ||
103 | +DO_2M_CRYPTO(SHA1H, aa32_sha1, 2) | ||
104 | +DO_2M_CRYPTO(SHA1SU1, aa32_sha1, 2) | ||
105 | +DO_2M_CRYPTO(SHA256SU0, aa32_sha2, 2) | ||
106 | diff --git a/target/arm/translate.c b/target/arm/translate.c | ||
107 | index XXXXXXX..XXXXXXX 100644 | ||
108 | --- a/target/arm/translate.c | ||
109 | +++ b/target/arm/translate.c | ||
110 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) | ||
111 | { | ||
112 | int op; | ||
113 | int q; | ||
114 | - int rd, rm, rd_ofs, rm_ofs; | ||
115 | + int rd, rm; | ||
116 | int size; | ||
117 | int pass; | ||
118 | int u; | ||
119 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) | ||
120 | VFP_DREG_D(rd, insn); | ||
121 | VFP_DREG_M(rm, insn); | ||
122 | size = (insn >> 20) & 3; | ||
123 | - rd_ofs = neon_reg_offset(rd, 0); | ||
124 | - rm_ofs = neon_reg_offset(rm, 0); | ||
125 | |||
126 | if ((insn & (1 << 23)) == 0) { | ||
127 | /* Three register same length: handled by decodetree */ | ||
128 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) | ||
129 | case NEON_2RM_VCLE0: | ||
130 | case NEON_2RM_VCGE0: | ||
131 | case NEON_2RM_VCLT0: | ||
132 | + case NEON_2RM_AESE: case NEON_2RM_AESMC: | ||
133 | + case NEON_2RM_SHA1H: | ||
134 | + case NEON_2RM_SHA1SU1: | ||
135 | /* handled by decodetree */ | ||
136 | return 1; | ||
137 | case NEON_2RM_VTRN: | ||
138 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) | ||
139 | goto elementwise; | ||
140 | } | ||
141 | break; | ||
142 | - case NEON_2RM_AESE: case NEON_2RM_AESMC: | ||
143 | - if (!dc_isar_feature(aa32_aes, s) || ((rm | rd) & 1)) { | ||
144 | - return 1; | ||
145 | - } | ||
146 | - /* | ||
147 | - * Bit 6 is the lowest opcode bit; it distinguishes | ||
148 | - * between encryption (AESE/AESMC) and decryption | ||
149 | - * (AESD/AESIMC). | ||
150 | - */ | ||
151 | - if (op == NEON_2RM_AESE) { | ||
152 | - tcg_gen_gvec_3_ool(vfp_reg_offset(true, rd), | ||
153 | - vfp_reg_offset(true, rd), | ||
154 | - vfp_reg_offset(true, rm), | ||
155 | - 16, 16, extract32(insn, 6, 1), | ||
156 | - gen_helper_crypto_aese); | ||
157 | - } else { | ||
158 | - tcg_gen_gvec_2_ool(vfp_reg_offset(true, rd), | ||
159 | - vfp_reg_offset(true, rm), | ||
160 | - 16, 16, extract32(insn, 6, 1), | ||
161 | - gen_helper_crypto_aesmc); | ||
162 | - } | ||
163 | - break; | ||
164 | - case NEON_2RM_SHA1H: | ||
165 | - if (!dc_isar_feature(aa32_sha1, s) || ((rm | rd) & 1)) { | ||
166 | - return 1; | ||
167 | - } | ||
168 | - tcg_gen_gvec_2_ool(rd_ofs, rm_ofs, 16, 16, 0, | ||
169 | - gen_helper_crypto_sha1h); | ||
170 | - break; | ||
171 | - case NEON_2RM_SHA1SU1: | ||
172 | - if ((rm | rd) & 1) { | ||
173 | - return 1; | ||
174 | - } | ||
175 | - /* bit 6 (q): set -> SHA256SU0, cleared -> SHA1SU1 */ | ||
176 | - if (q) { | ||
177 | - if (!dc_isar_feature(aa32_sha2, s)) { | ||
178 | - return 1; | ||
179 | - } | ||
180 | - } else if (!dc_isar_feature(aa32_sha1, s)) { | ||
181 | - return 1; | ||
182 | - } | ||
183 | - tcg_gen_gvec_2_ool(rd_ofs, rm_ofs, 16, 16, 0, | ||
184 | - q ? gen_helper_crypto_sha256su0 | ||
185 | - : gen_helper_crypto_sha1su1); | ||
186 | - break; | ||
187 | |||
188 | default: | ||
189 | elementwise: | ||
190 | -- | ||
191 | 2.20.1 | ||
192 | |||
193 | diff view generated by jsdifflib |
1 | Provide a VMSTATE_BOOL_SUB_ARRAY to go with VMSTATE_UINT8_SUB_ARRAY | 1 | The NeonGenOneOpFn typedef breaks with the pattern of the other |
---|---|---|---|
2 | and friends. | 2 | NeonGen*Fn typedefs, because it is a TCGv_i64 -> TCGv_i64 operation |
3 | but it does not have '64' in its name. Rename it to NeonGenOne64OpFn, | ||
4 | so that the old name is available for a TCGv_i32 -> TCGv_i32 operation | ||
5 | (which we will need in a subsequent commit). | ||
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: Richard Henderson <richard.henderson@linaro.org> |
6 | Message-id: 20180521140402.23318-23-peter.maydell@linaro.org | 9 | Message-id: 20200616170844.13318-10-peter.maydell@linaro.org |
7 | --- | 10 | --- |
8 | include/migration/vmstate.h | 3 +++ | 11 | target/arm/translate.h | 2 +- |
9 | 1 file changed, 3 insertions(+) | 12 | target/arm/translate-a64.c | 4 ++-- |
13 | 2 files changed, 3 insertions(+), 3 deletions(-) | ||
10 | 14 | ||
11 | diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h | 15 | diff --git a/target/arm/translate.h b/target/arm/translate.h |
12 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
13 | --- a/include/migration/vmstate.h | 17 | --- a/target/arm/translate.h |
14 | +++ b/include/migration/vmstate.h | 18 | +++ b/target/arm/translate.h |
15 | @@ -XXX,XX +XXX,XX @@ extern const VMStateInfo vmstate_info_qtailq; | 19 | @@ -XXX,XX +XXX,XX @@ typedef void NeonGenWidenFn(TCGv_i64, TCGv_i32); |
16 | #define VMSTATE_BOOL_ARRAY(_f, _s, _n) \ | 20 | typedef void NeonGenTwoOpWidenFn(TCGv_i64, TCGv_i32, TCGv_i32); |
17 | VMSTATE_BOOL_ARRAY_V(_f, _s, _n, 0) | 21 | typedef void NeonGenTwoSingleOPFn(TCGv_i32, TCGv_i32, TCGv_i32, TCGv_ptr); |
18 | 22 | typedef void NeonGenTwoDoubleOPFn(TCGv_i64, TCGv_i64, TCGv_i64, TCGv_ptr); | |
19 | +#define VMSTATE_BOOL_SUB_ARRAY(_f, _s, _start, _num) \ | 23 | -typedef void NeonGenOneOpFn(TCGv_i64, TCGv_i64); |
20 | + VMSTATE_SUB_ARRAY(_f, _s, _start, _num, 0, vmstate_info_bool, bool) | 24 | +typedef void NeonGenOne64OpFn(TCGv_i64, TCGv_i64); |
21 | + | 25 | typedef void CryptoTwoOpFn(TCGv_ptr, TCGv_ptr); |
22 | #define VMSTATE_UINT16_ARRAY_V(_f, _s, _n, _v) \ | 26 | typedef void CryptoThreeOpIntFn(TCGv_ptr, TCGv_ptr, TCGv_i32); |
23 | VMSTATE_ARRAY(_f, _s, _n, _v, vmstate_info_uint16, uint16_t) | 27 | typedef void CryptoThreeOpFn(TCGv_ptr, TCGv_ptr, TCGv_ptr); |
24 | 28 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c | |
29 | index XXXXXXX..XXXXXXX 100644 | ||
30 | --- a/target/arm/translate-a64.c | ||
31 | +++ b/target/arm/translate-a64.c | ||
32 | @@ -XXX,XX +XXX,XX @@ static void handle_2misc_pairwise(DisasContext *s, int opcode, bool u, | ||
33 | } else { | ||
34 | for (pass = 0; pass < maxpass; pass++) { | ||
35 | TCGv_i64 tcg_op = tcg_temp_new_i64(); | ||
36 | - NeonGenOneOpFn *genfn; | ||
37 | - static NeonGenOneOpFn * const fns[2][2] = { | ||
38 | + NeonGenOne64OpFn *genfn; | ||
39 | + static NeonGenOne64OpFn * const fns[2][2] = { | ||
40 | { gen_helper_neon_addlp_s8, gen_helper_neon_addlp_u8 }, | ||
41 | { gen_helper_neon_addlp_s16, gen_helper_neon_addlp_u16 }, | ||
42 | }; | ||
25 | -- | 43 | -- |
26 | 2.17.1 | 44 | 2.20.1 |
27 | 45 | ||
28 | 46 | diff view generated by jsdifflib |
1 | As part of plumbing MemTxAttrs down to the IOMMU translate method, | 1 | All the other typedefs like these spell "Op" with a lowercase 'p'; |
---|---|---|---|
2 | add MemTxAttrs as an argument to the MemoryRegion valid.accepts | 2 | remane the NeonGenTwoSingleOPFn and NeonGenTwoDoubleOPFn typedefs to |
3 | callback. We'll need this for subpage_accepts(). | 3 | match. |
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 | 4 | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 5 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
11 | Reviewed-by: Alex Bennée <alex.bennee@linaro.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: 20200616170844.13318-11-peter.maydell@linaro.org |
14 | --- | 8 | --- |
15 | include/exec/memory.h | 3 ++- | 9 | target/arm/translate.h | 4 ++-- |
16 | exec.c | 9 ++++++--- | 10 | target/arm/translate-a64.c | 4 ++-- |
17 | hw/hppa/dino.c | 3 ++- | 11 | target/arm/translate-neon.inc.c | 2 +- |
18 | hw/nvram/fw_cfg.c | 12 ++++++++---- | 12 | 3 files changed, 5 insertions(+), 5 deletions(-) |
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 | 13 | ||
24 | diff --git a/include/exec/memory.h b/include/exec/memory.h | 14 | diff --git a/target/arm/translate.h b/target/arm/translate.h |
25 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
26 | --- a/include/exec/memory.h | 16 | --- a/target/arm/translate.h |
27 | +++ b/include/exec/memory.h | 17 | +++ b/target/arm/translate.h |
28 | @@ -XXX,XX +XXX,XX @@ struct MemoryRegionOps { | 18 | @@ -XXX,XX +XXX,XX @@ typedef void NeonGenNarrowFn(TCGv_i32, TCGv_i64); |
29 | * as a machine check exception). | 19 | typedef void NeonGenNarrowEnvFn(TCGv_i32, TCGv_ptr, TCGv_i64); |
30 | */ | 20 | typedef void NeonGenWidenFn(TCGv_i64, TCGv_i32); |
31 | bool (*accepts)(void *opaque, hwaddr addr, | 21 | typedef void NeonGenTwoOpWidenFn(TCGv_i64, TCGv_i32, TCGv_i32); |
32 | - unsigned size, bool is_write); | 22 | -typedef void NeonGenTwoSingleOPFn(TCGv_i32, TCGv_i32, TCGv_i32, TCGv_ptr); |
33 | + unsigned size, bool is_write, | 23 | -typedef void NeonGenTwoDoubleOPFn(TCGv_i64, TCGv_i64, TCGv_i64, TCGv_ptr); |
34 | + MemTxAttrs attrs); | 24 | +typedef void NeonGenTwoSingleOpFn(TCGv_i32, TCGv_i32, TCGv_i32, TCGv_ptr); |
35 | } valid; | 25 | +typedef void NeonGenTwoDoubleOpFn(TCGv_i64, TCGv_i64, TCGv_i64, TCGv_ptr); |
36 | /* Internal implementation constraints: */ | 26 | typedef void NeonGenOne64OpFn(TCGv_i64, TCGv_i64); |
37 | struct { | 27 | typedef void CryptoTwoOpFn(TCGv_ptr, TCGv_ptr); |
38 | diff --git a/exec.c b/exec.c | 28 | typedef void CryptoThreeOpIntFn(TCGv_ptr, TCGv_ptr, TCGv_i32); |
29 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c | ||
39 | index XXXXXXX..XXXXXXX 100644 | 30 | index XXXXXXX..XXXXXXX 100644 |
40 | --- a/exec.c | 31 | --- a/target/arm/translate-a64.c |
41 | +++ b/exec.c | 32 | +++ b/target/arm/translate-a64.c |
42 | @@ -XXX,XX +XXX,XX @@ static void notdirty_mem_write(void *opaque, hwaddr ram_addr, | 33 | @@ -XXX,XX +XXX,XX @@ static void handle_2misc_fcmp_zero(DisasContext *s, int opcode, |
34 | TCGv_i64 tcg_op = tcg_temp_new_i64(); | ||
35 | TCGv_i64 tcg_zero = tcg_const_i64(0); | ||
36 | TCGv_i64 tcg_res = tcg_temp_new_i64(); | ||
37 | - NeonGenTwoDoubleOPFn *genfn; | ||
38 | + NeonGenTwoDoubleOpFn *genfn; | ||
39 | bool swap = false; | ||
40 | int pass; | ||
41 | |||
42 | @@ -XXX,XX +XXX,XX @@ static void handle_2misc_fcmp_zero(DisasContext *s, int opcode, | ||
43 | TCGv_i32 tcg_op = tcg_temp_new_i32(); | ||
44 | TCGv_i32 tcg_zero = tcg_const_i32(0); | ||
45 | TCGv_i32 tcg_res = tcg_temp_new_i32(); | ||
46 | - NeonGenTwoSingleOPFn *genfn; | ||
47 | + NeonGenTwoSingleOpFn *genfn; | ||
48 | bool swap = false; | ||
49 | int pass, maxpasses; | ||
50 | |||
51 | diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c | ||
52 | index XXXXXXX..XXXXXXX 100644 | ||
53 | --- a/target/arm/translate-neon.inc.c | ||
54 | +++ b/target/arm/translate-neon.inc.c | ||
55 | @@ -XXX,XX +XXX,XX @@ static bool trans_VSHLL_U_2sh(DisasContext *s, arg_2reg_shift *a) | ||
43 | } | 56 | } |
44 | 57 | ||
45 | static bool notdirty_mem_accepts(void *opaque, hwaddr addr, | 58 | static bool do_fp_2sh(DisasContext *s, arg_2reg_shift *a, |
46 | - unsigned size, bool is_write) | 59 | - NeonGenTwoSingleOPFn *fn) |
47 | + unsigned size, bool is_write, | 60 | + NeonGenTwoSingleOpFn *fn) |
48 | + MemTxAttrs attrs) | ||
49 | { | 61 | { |
50 | return is_write; | 62 | /* FP operations in 2-reg-and-shift group */ |
51 | } | 63 | TCGv_i32 tmp, shiftv; |
52 | @@ -XXX,XX +XXX,XX @@ static MemTxResult subpage_write(void *opaque, hwaddr addr, | ||
53 | } | ||
54 | |||
55 | static bool subpage_accepts(void *opaque, hwaddr addr, | ||
56 | - unsigned len, bool is_write) | ||
57 | + unsigned len, bool is_write, | ||
58 | + MemTxAttrs attrs) | ||
59 | { | ||
60 | subpage_t *subpage = opaque; | ||
61 | #if defined(DEBUG_SUBPAGE) | ||
62 | @@ -XXX,XX +XXX,XX @@ static void readonly_mem_write(void *opaque, hwaddr addr, | ||
63 | } | ||
64 | |||
65 | static bool readonly_mem_accepts(void *opaque, hwaddr addr, | ||
66 | - unsigned size, bool is_write) | ||
67 | + unsigned size, bool is_write, | ||
68 | + MemTxAttrs attrs) | ||
69 | { | ||
70 | return is_write; | ||
71 | } | ||
72 | diff --git a/hw/hppa/dino.c b/hw/hppa/dino.c | ||
73 | index XXXXXXX..XXXXXXX 100644 | ||
74 | --- a/hw/hppa/dino.c | ||
75 | +++ b/hw/hppa/dino.c | ||
76 | @@ -XXX,XX +XXX,XX @@ static void gsc_to_pci_forwarding(DinoState *s) | ||
77 | } | ||
78 | |||
79 | static bool dino_chip_mem_valid(void *opaque, hwaddr addr, | ||
80 | - unsigned size, bool is_write) | ||
81 | + unsigned size, bool is_write, | ||
82 | + MemTxAttrs attrs) | ||
83 | { | ||
84 | switch (addr) { | ||
85 | case DINO_IAR0: | ||
86 | diff --git a/hw/nvram/fw_cfg.c b/hw/nvram/fw_cfg.c | ||
87 | index XXXXXXX..XXXXXXX 100644 | ||
88 | --- a/hw/nvram/fw_cfg.c | ||
89 | +++ b/hw/nvram/fw_cfg.c | ||
90 | @@ -XXX,XX +XXX,XX @@ static void fw_cfg_dma_mem_write(void *opaque, hwaddr addr, | ||
91 | } | ||
92 | |||
93 | static bool fw_cfg_dma_mem_valid(void *opaque, hwaddr addr, | ||
94 | - unsigned size, bool is_write) | ||
95 | + unsigned size, bool is_write, | ||
96 | + MemTxAttrs attrs) | ||
97 | { | ||
98 | return !is_write || ((size == 4 && (addr == 0 || addr == 4)) || | ||
99 | (size == 8 && addr == 0)); | ||
100 | } | ||
101 | |||
102 | static bool fw_cfg_data_mem_valid(void *opaque, hwaddr addr, | ||
103 | - unsigned size, bool is_write) | ||
104 | + unsigned size, bool is_write, | ||
105 | + MemTxAttrs attrs) | ||
106 | { | ||
107 | return addr == 0; | ||
108 | } | ||
109 | @@ -XXX,XX +XXX,XX @@ static void fw_cfg_ctl_mem_write(void *opaque, hwaddr addr, | ||
110 | } | ||
111 | |||
112 | static bool fw_cfg_ctl_mem_valid(void *opaque, hwaddr addr, | ||
113 | - unsigned size, bool is_write) | ||
114 | + unsigned size, bool is_write, | ||
115 | + MemTxAttrs attrs) | ||
116 | { | ||
117 | return is_write && size == 2; | ||
118 | } | ||
119 | @@ -XXX,XX +XXX,XX @@ static void fw_cfg_comb_write(void *opaque, hwaddr addr, | ||
120 | } | ||
121 | |||
122 | static bool fw_cfg_comb_valid(void *opaque, hwaddr addr, | ||
123 | - unsigned size, bool is_write) | ||
124 | + unsigned size, bool is_write, | ||
125 | + MemTxAttrs attrs) | ||
126 | { | ||
127 | return (size == 1) || (is_write && size == 2); | ||
128 | } | ||
129 | diff --git a/hw/scsi/esp.c b/hw/scsi/esp.c | ||
130 | index XXXXXXX..XXXXXXX 100644 | ||
131 | --- a/hw/scsi/esp.c | ||
132 | +++ b/hw/scsi/esp.c | ||
133 | @@ -XXX,XX +XXX,XX @@ void esp_reg_write(ESPState *s, uint32_t saddr, uint64_t val) | ||
134 | } | ||
135 | |||
136 | static bool esp_mem_accepts(void *opaque, hwaddr addr, | ||
137 | - unsigned size, bool is_write) | ||
138 | + unsigned size, bool is_write, | ||
139 | + MemTxAttrs attrs) | ||
140 | { | ||
141 | return (size == 1) || (is_write && size == 4); | ||
142 | } | ||
143 | diff --git a/hw/xen/xen_pt_msi.c b/hw/xen/xen_pt_msi.c | ||
144 | index XXXXXXX..XXXXXXX 100644 | ||
145 | --- a/hw/xen/xen_pt_msi.c | ||
146 | +++ b/hw/xen/xen_pt_msi.c | ||
147 | @@ -XXX,XX +XXX,XX @@ static uint64_t pci_msix_read(void *opaque, hwaddr addr, | ||
148 | } | ||
149 | |||
150 | static bool pci_msix_accepts(void *opaque, hwaddr addr, | ||
151 | - unsigned size, bool is_write) | ||
152 | + unsigned size, bool is_write, | ||
153 | + MemTxAttrs attrs) | ||
154 | { | ||
155 | return !(addr & (size - 1)); | ||
156 | } | ||
157 | diff --git a/memory.c b/memory.c | ||
158 | index XXXXXXX..XXXXXXX 100644 | ||
159 | --- a/memory.c | ||
160 | +++ b/memory.c | ||
161 | @@ -XXX,XX +XXX,XX @@ static void unassigned_mem_write(void *opaque, hwaddr addr, | ||
162 | } | ||
163 | |||
164 | static bool unassigned_mem_accepts(void *opaque, hwaddr addr, | ||
165 | - unsigned size, bool is_write) | ||
166 | + unsigned size, bool is_write, | ||
167 | + MemTxAttrs attrs) | ||
168 | { | ||
169 | return false; | ||
170 | } | ||
171 | @@ -XXX,XX +XXX,XX @@ bool memory_region_access_valid(MemoryRegion *mr, | ||
172 | access_size = MAX(MIN(size, access_size_max), access_size_min); | ||
173 | for (i = 0; i < size; i += access_size) { | ||
174 | if (!mr->ops->valid.accepts(mr->opaque, addr + i, access_size, | ||
175 | - is_write)) { | ||
176 | + is_write, attrs)) { | ||
177 | return false; | ||
178 | } | ||
179 | } | ||
180 | -- | 64 | -- |
181 | 2.17.1 | 65 | 2.20.1 |
182 | 66 | ||
183 | 67 | diff view generated by jsdifflib |
1 | As part of plumbing MemTxAttrs down to the IOMMU translate method, | 1 | Make gen_swap_half() take a source and destination TCGv_i32 rather |
---|---|---|---|
2 | add MemTxAttrs as an argument to address_space_map(). | 2 | than modifying the input TCGv_i32; we're going to want to be able to |
3 | Its callers either have an attrs value to hand, or don't care | 3 | use it with the more flexible function signature, and this also |
4 | and can use MEMTXATTRS_UNSPECIFIED. | 4 | brings it into line with other functions like gen_rev16() and |
5 | gen_revsh(). | ||
5 | 6 | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 7 | 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> | 8 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
9 | Message-id: 20180521140402.23318-5-peter.maydell@linaro.org | 9 | Message-id: 20200616170844.13318-12-peter.maydell@linaro.org |
10 | --- | 10 | --- |
11 | include/exec/memory.h | 3 ++- | 11 | target/arm/translate-neon.inc.c | 2 +- |
12 | include/sysemu/dma.h | 3 ++- | 12 | target/arm/translate.c | 10 +++++----- |
13 | exec.c | 6 ++++-- | 13 | 2 files changed, 6 insertions(+), 6 deletions(-) |
14 | target/ppc/mmu-hash64.c | 3 ++- | ||
15 | 4 files changed, 10 insertions(+), 5 deletions(-) | ||
16 | 14 | ||
17 | diff --git a/include/exec/memory.h b/include/exec/memory.h | 15 | diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c |
18 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
19 | --- a/include/exec/memory.h | 17 | --- a/target/arm/translate-neon.inc.c |
20 | +++ b/include/exec/memory.h | 18 | +++ b/target/arm/translate-neon.inc.c |
21 | @@ -XXX,XX +XXX,XX @@ bool address_space_access_valid(AddressSpace *as, hwaddr addr, int len, bool is_ | 19 | @@ -XXX,XX +XXX,XX @@ static bool trans_VREV64(DisasContext *s, arg_VREV64 *a) |
22 | * @addr: address within that address space | 20 | tcg_gen_bswap32_i32(tmp[half], tmp[half]); |
23 | * @plen: pointer to length of buffer; updated on return | 21 | break; |
24 | * @is_write: indicates the transfer direction | 22 | case 1: |
25 | + * @attrs: memory attributes | 23 | - gen_swap_half(tmp[half]); |
26 | */ | 24 | + gen_swap_half(tmp[half], tmp[half]); |
27 | void *address_space_map(AddressSpace *as, hwaddr addr, | 25 | break; |
28 | - hwaddr *plen, bool is_write); | 26 | case 2: |
29 | + hwaddr *plen, bool is_write, MemTxAttrs attrs); | 27 | break; |
30 | 28 | diff --git a/target/arm/translate.c b/target/arm/translate.c | |
31 | /* address_space_unmap: Unmaps a memory region previously mapped by address_space_map() | ||
32 | * | ||
33 | diff --git a/include/sysemu/dma.h b/include/sysemu/dma.h | ||
34 | index XXXXXXX..XXXXXXX 100644 | 29 | index XXXXXXX..XXXXXXX 100644 |
35 | --- a/include/sysemu/dma.h | 30 | --- a/target/arm/translate.c |
36 | +++ b/include/sysemu/dma.h | 31 | +++ b/target/arm/translate.c |
37 | @@ -XXX,XX +XXX,XX @@ static inline void *dma_memory_map(AddressSpace *as, | 32 | @@ -XXX,XX +XXX,XX @@ static void gen_revsh(TCGv_i32 dest, TCGv_i32 var) |
38 | hwaddr xlen = *len; | ||
39 | void *p; | ||
40 | |||
41 | - p = address_space_map(as, addr, &xlen, dir == DMA_DIRECTION_FROM_DEVICE); | ||
42 | + p = address_space_map(as, addr, &xlen, dir == DMA_DIRECTION_FROM_DEVICE, | ||
43 | + MEMTXATTRS_UNSPECIFIED); | ||
44 | *len = xlen; | ||
45 | return p; | ||
46 | } | 33 | } |
47 | diff --git a/exec.c b/exec.c | 34 | |
48 | index XXXXXXX..XXXXXXX 100644 | 35 | /* Swap low and high halfwords. */ |
49 | --- a/exec.c | 36 | -static void gen_swap_half(TCGv_i32 var) |
50 | +++ b/exec.c | 37 | +static void gen_swap_half(TCGv_i32 dest, TCGv_i32 var) |
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 | { | 38 | { |
59 | hwaddr len = *plen; | 39 | - tcg_gen_rotri_i32(var, var, 16); |
60 | hwaddr l, xlat; | 40 | + tcg_gen_rotri_i32(dest, var, 16); |
61 | @@ -XXX,XX +XXX,XX @@ void *cpu_physical_memory_map(hwaddr addr, | ||
62 | hwaddr *plen, | ||
63 | int is_write) | ||
64 | { | ||
65 | - return address_space_map(&address_space_memory, addr, plen, is_write); | ||
66 | + return address_space_map(&address_space_memory, addr, plen, is_write, | ||
67 | + MEMTXATTRS_UNSPECIFIED); | ||
68 | } | 41 | } |
69 | 42 | ||
70 | void cpu_physical_memory_unmap(void *buffer, hwaddr len, | 43 | /* Dual 16-bit add. Result placed in t0 and t1 is marked as dead. |
71 | diff --git a/target/ppc/mmu-hash64.c b/target/ppc/mmu-hash64.c | 44 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) |
72 | index XXXXXXX..XXXXXXX 100644 | 45 | case NEON_2RM_VREV32: |
73 | --- a/target/ppc/mmu-hash64.c | 46 | switch (size) { |
74 | +++ b/target/ppc/mmu-hash64.c | 47 | case 0: tcg_gen_bswap32_i32(tmp, tmp); break; |
75 | @@ -XXX,XX +XXX,XX @@ const ppc_hash_pte64_t *ppc_hash64_map_hptes(PowerPCCPU *cpu, | 48 | - case 1: gen_swap_half(tmp); break; |
76 | return NULL; | 49 | + case 1: gen_swap_half(tmp, tmp); break; |
50 | default: abort(); | ||
51 | } | ||
52 | break; | ||
53 | @@ -XXX,XX +XXX,XX @@ static bool op_smlad(DisasContext *s, arg_rrrr *a, bool m_swap, bool sub) | ||
54 | t1 = load_reg(s, a->rn); | ||
55 | t2 = load_reg(s, a->rm); | ||
56 | if (m_swap) { | ||
57 | - gen_swap_half(t2); | ||
58 | + gen_swap_half(t2, t2); | ||
77 | } | 59 | } |
78 | 60 | gen_smul_dual(t1, t2); | |
79 | - hptes = address_space_map(CPU(cpu)->as, base + pte_offset, &plen, false); | 61 | |
80 | + hptes = address_space_map(CPU(cpu)->as, base + pte_offset, &plen, false, | 62 | @@ -XXX,XX +XXX,XX @@ static bool op_smlald(DisasContext *s, arg_rrrr *a, bool m_swap, bool sub) |
81 | + MEMTXATTRS_UNSPECIFIED); | 63 | t1 = load_reg(s, a->rn); |
82 | if (plen < (n * HASH_PTE_SIZE_64)) { | 64 | t2 = load_reg(s, a->rm); |
83 | hw_error("%s: Unable to map all requested HPTEs\n", __func__); | 65 | if (m_swap) { |
66 | - gen_swap_half(t2); | ||
67 | + gen_swap_half(t2, t2); | ||
84 | } | 68 | } |
69 | gen_smul_dual(t1, t2); | ||
70 | |||
85 | -- | 71 | -- |
86 | 2.17.1 | 72 | 2.20.1 |
87 | 73 | ||
88 | 74 | diff view generated by jsdifflib |
1 | As part of plumbing MemTxAttrs down to the IOMMU translate method, | 1 | Convert the VREV32 and VREV16 insns in the Neon 2-reg-misc group |
---|---|---|---|
2 | add MemTxAttrs as an argument to flatview_do_translate(). | 2 | to decodetree. |
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> | ||
6 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 5 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
7 | Message-id: 20180521140402.23318-13-peter.maydell@linaro.org | 6 | Message-id: 20200616170844.13318-13-peter.maydell@linaro.org |
8 | --- | 7 | --- |
9 | exec.c | 9 ++++++--- | 8 | target/arm/translate.h | 1 + |
10 | 1 file changed, 6 insertions(+), 3 deletions(-) | 9 | target/arm/neon-dp.decode | 2 ++ |
10 | target/arm/translate-neon.inc.c | 55 +++++++++++++++++++++++++++++++++ | ||
11 | target/arm/translate.c | 12 ++----- | ||
12 | 4 files changed, 60 insertions(+), 10 deletions(-) | ||
11 | 13 | ||
12 | diff --git a/exec.c b/exec.c | 14 | diff --git a/target/arm/translate.h b/target/arm/translate.h |
13 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
14 | --- a/exec.c | 16 | --- a/target/arm/translate.h |
15 | +++ b/exec.c | 17 | +++ b/target/arm/translate.h |
16 | @@ -XXX,XX +XXX,XX @@ unassigned: | 18 | @@ -XXX,XX +XXX,XX @@ typedef void GVecGen4Fn(unsigned, uint32_t, uint32_t, uint32_t, |
17 | * @is_write: whether the translation operation is for write | 19 | uint32_t, uint32_t, uint32_t); |
18 | * @is_mmio: whether this can be MMIO, set true if it can | 20 | |
19 | * @target_as: the address space targeted by the IOMMU | 21 | /* Function prototype for gen_ functions for calling Neon helpers */ |
20 | + * @attrs: memory transaction attributes | 22 | +typedef void NeonGenOneOpFn(TCGv_i32, TCGv_i32); |
21 | * | 23 | typedef void NeonGenOneOpEnvFn(TCGv_i32, TCGv_ptr, TCGv_i32); |
22 | * This function is called from RCU critical section | 24 | typedef void NeonGenTwoOpFn(TCGv_i32, TCGv_i32, TCGv_i32); |
23 | */ | 25 | typedef void NeonGenTwoOpEnvFn(TCGv_i32, TCGv_ptr, TCGv_i32, TCGv_i32); |
24 | @@ -XXX,XX +XXX,XX @@ static MemoryRegionSection flatview_do_translate(FlatView *fv, | 26 | diff --git a/target/arm/neon-dp.decode b/target/arm/neon-dp.decode |
25 | hwaddr *page_mask_out, | 27 | index XXXXXXX..XXXXXXX 100644 |
26 | bool is_write, | 28 | --- a/target/arm/neon-dp.decode |
27 | bool is_mmio, | 29 | +++ b/target/arm/neon-dp.decode |
28 | - AddressSpace **target_as) | 30 | @@ -XXX,XX +XXX,XX @@ Vimm_1r 1111 001 . 1 . 000 ... .... cmode:4 0 . op:1 1 .... @1reg_imm |
29 | + AddressSpace **target_as, | 31 | &2misc vm=%vm_dp vd=%vd_dp q=1 |
30 | + MemTxAttrs attrs) | 32 | |
31 | { | 33 | VREV64 1111 001 11 . 11 .. 00 .... 0 0000 . . 0 .... @2misc |
32 | MemoryRegionSection *section; | 34 | + VREV32 1111 001 11 . 11 .. 00 .... 0 0001 . . 0 .... @2misc |
33 | IOMMUMemoryRegion *iommu_mr; | 35 | + VREV16 1111 001 11 . 11 .. 00 .... 0 0010 . . 0 .... @2misc |
34 | @@ -XXX,XX +XXX,XX @@ IOMMUTLBEntry address_space_get_iotlb_entry(AddressSpace *as, hwaddr addr, | 36 | |
35 | * but page mask. | 37 | VPADDL_S 1111 001 11 . 11 .. 00 .... 0 0100 . . 0 .... @2misc |
36 | */ | 38 | VPADDL_U 1111 001 11 . 11 .. 00 .... 0 0101 . . 0 .... @2misc |
37 | section = flatview_do_translate(address_space_to_flatview(as), addr, &xlat, | 39 | diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c |
38 | - NULL, &page_mask, is_write, false, &as); | 40 | index XXXXXXX..XXXXXXX 100644 |
39 | + NULL, &page_mask, is_write, false, &as, | 41 | --- a/target/arm/translate-neon.inc.c |
40 | + attrs); | 42 | +++ b/target/arm/translate-neon.inc.c |
41 | 43 | @@ -XXX,XX +XXX,XX @@ DO_2M_CRYPTO(AESIMC, aa32_aes, 0) | |
42 | /* Illegal translation */ | 44 | DO_2M_CRYPTO(SHA1H, aa32_sha1, 2) |
43 | if (section.mr == &io_mem_unassigned) { | 45 | DO_2M_CRYPTO(SHA1SU1, aa32_sha1, 2) |
44 | @@ -XXX,XX +XXX,XX @@ MemoryRegion *flatview_translate(FlatView *fv, hwaddr addr, hwaddr *xlat, | 46 | DO_2M_CRYPTO(SHA256SU0, aa32_sha2, 2) |
45 | 47 | + | |
46 | /* This can be MMIO, so setup MMIO bit. */ | 48 | +static bool do_2misc(DisasContext *s, arg_2misc *a, NeonGenOneOpFn *fn) |
47 | section = flatview_do_translate(fv, addr, xlat, plen, NULL, | 49 | +{ |
48 | - is_write, true, &as); | 50 | + int pass; |
49 | + is_write, true, &as, attrs); | 51 | + |
50 | mr = section.mr; | 52 | + /* Handle a 2-reg-misc operation by iterating 32 bits at a time */ |
51 | 53 | + if (!arm_dc_feature(s, ARM_FEATURE_NEON)) { | |
52 | if (xen_enabled() && memory_access_is_direct(mr, is_write)) { | 54 | + return false; |
55 | + } | ||
56 | + | ||
57 | + /* UNDEF accesses to D16-D31 if they don't exist. */ | ||
58 | + if (!dc_isar_feature(aa32_simd_r32, s) && | ||
59 | + ((a->vd | a->vm) & 0x10)) { | ||
60 | + return false; | ||
61 | + } | ||
62 | + | ||
63 | + if (!fn) { | ||
64 | + return false; | ||
65 | + } | ||
66 | + | ||
67 | + if ((a->vd | a->vm) & a->q) { | ||
68 | + return false; | ||
69 | + } | ||
70 | + | ||
71 | + if (!vfp_access_check(s)) { | ||
72 | + return true; | ||
73 | + } | ||
74 | + | ||
75 | + for (pass = 0; pass < (a->q ? 4 : 2); pass++) { | ||
76 | + TCGv_i32 tmp = neon_load_reg(a->vm, pass); | ||
77 | + fn(tmp, tmp); | ||
78 | + neon_store_reg(a->vd, pass, tmp); | ||
79 | + } | ||
80 | + | ||
81 | + return true; | ||
82 | +} | ||
83 | + | ||
84 | +static bool trans_VREV32(DisasContext *s, arg_2misc *a) | ||
85 | +{ | ||
86 | + static NeonGenOneOpFn * const fn[] = { | ||
87 | + tcg_gen_bswap32_i32, | ||
88 | + gen_swap_half, | ||
89 | + NULL, | ||
90 | + NULL, | ||
91 | + }; | ||
92 | + return do_2misc(s, a, fn[a->size]); | ||
93 | +} | ||
94 | + | ||
95 | +static bool trans_VREV16(DisasContext *s, arg_2misc *a) | ||
96 | +{ | ||
97 | + if (a->size != 0) { | ||
98 | + return false; | ||
99 | + } | ||
100 | + return do_2misc(s, a, gen_rev16); | ||
101 | +} | ||
102 | diff --git a/target/arm/translate.c b/target/arm/translate.c | ||
103 | index XXXXXXX..XXXXXXX 100644 | ||
104 | --- a/target/arm/translate.c | ||
105 | +++ b/target/arm/translate.c | ||
106 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) | ||
107 | case NEON_2RM_AESE: case NEON_2RM_AESMC: | ||
108 | case NEON_2RM_SHA1H: | ||
109 | case NEON_2RM_SHA1SU1: | ||
110 | + case NEON_2RM_VREV32: | ||
111 | + case NEON_2RM_VREV16: | ||
112 | /* handled by decodetree */ | ||
113 | return 1; | ||
114 | case NEON_2RM_VTRN: | ||
115 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) | ||
116 | for (pass = 0; pass < (q ? 4 : 2); pass++) { | ||
117 | tmp = neon_load_reg(rm, pass); | ||
118 | switch (op) { | ||
119 | - case NEON_2RM_VREV32: | ||
120 | - switch (size) { | ||
121 | - case 0: tcg_gen_bswap32_i32(tmp, tmp); break; | ||
122 | - case 1: gen_swap_half(tmp, tmp); break; | ||
123 | - default: abort(); | ||
124 | - } | ||
125 | - break; | ||
126 | - case NEON_2RM_VREV16: | ||
127 | - gen_rev16(tmp, tmp); | ||
128 | - break; | ||
129 | case NEON_2RM_VCLS: | ||
130 | switch (size) { | ||
131 | case 0: gen_helper_neon_cls_s8(tmp, tmp); break; | ||
53 | -- | 132 | -- |
54 | 2.17.1 | 133 | 2.20.1 |
55 | 134 | ||
56 | 135 | diff view generated by jsdifflib |
1 | As part of plumbing MemTxAttrs down to the IOMMU translate method, | 1 | Convert the remaining ops in the Neon 2-reg-misc group which |
---|---|---|---|
2 | add MemTxAttrs as an argument to memory_region_access_valid(). | 2 | can be implemented simply with our do_2misc() helper. |
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 | 3 | ||
13 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 4 | 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> | 5 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
16 | Message-id: 20180521140402.23318-8-peter.maydell@linaro.org | 6 | Message-id: 20200616170844.13318-14-peter.maydell@linaro.org |
17 | --- | 7 | --- |
18 | include/exec/memory-internal.h | 3 ++- | 8 | target/arm/neon-dp.decode | 10 +++++ |
19 | exec.c | 4 +++- | 9 | target/arm/translate-neon.inc.c | 69 +++++++++++++++++++++++++++++++++ |
20 | hw/s390x/s390-pci-inst.c | 3 ++- | 10 | target/arm/translate.c | 38 ++++-------------- |
21 | memory.c | 7 ++++--- | 11 | 3 files changed, 86 insertions(+), 31 deletions(-) |
22 | 4 files changed, 11 insertions(+), 6 deletions(-) | ||
23 | 12 | ||
24 | diff --git a/include/exec/memory-internal.h b/include/exec/memory-internal.h | 13 | diff --git a/target/arm/neon-dp.decode b/target/arm/neon-dp.decode |
25 | index XXXXXXX..XXXXXXX 100644 | 14 | index XXXXXXX..XXXXXXX 100644 |
26 | --- a/include/exec/memory-internal.h | 15 | --- a/target/arm/neon-dp.decode |
27 | +++ b/include/exec/memory-internal.h | 16 | +++ b/target/arm/neon-dp.decode |
28 | @@ -XXX,XX +XXX,XX @@ void flatview_unref(FlatView *view); | 17 | @@ -XXX,XX +XXX,XX @@ Vimm_1r 1111 001 . 1 . 000 ... .... cmode:4 0 . op:1 1 .... @1reg_imm |
29 | extern const MemoryRegionOps unassigned_mem_ops; | 18 | AESMC 1111 001 11 . 11 .. 00 .... 0 0111 0 . 0 .... @2misc_q1 |
30 | 19 | AESIMC 1111 001 11 . 11 .. 00 .... 0 0111 1 . 0 .... @2misc_q1 | |
31 | bool memory_region_access_valid(MemoryRegion *mr, hwaddr addr, | 20 | |
32 | - unsigned size, bool is_write); | 21 | + VCLS 1111 001 11 . 11 .. 00 .... 0 1000 . . 0 .... @2misc |
33 | + unsigned size, bool is_write, | 22 | + VCLZ 1111 001 11 . 11 .. 00 .... 0 1001 . . 0 .... @2misc |
34 | + MemTxAttrs attrs); | 23 | + VCNT 1111 001 11 . 11 .. 00 .... 0 1010 . . 0 .... @2misc |
35 | 24 | + | |
36 | void flatview_add_to_dispatch(FlatView *fv, MemoryRegionSection *section); | 25 | VMVN 1111 001 11 . 11 .. 00 .... 0 1011 . . 0 .... @2misc |
37 | AddressSpaceDispatch *address_space_dispatch_new(FlatView *fv); | 26 | |
38 | diff --git a/exec.c b/exec.c | 27 | VPADAL_S 1111 001 11 . 11 .. 00 .... 0 1100 . . 0 .... @2misc |
28 | @@ -XXX,XX +XXX,XX @@ Vimm_1r 1111 001 . 1 . 000 ... .... cmode:4 0 . op:1 1 .... @1reg_imm | ||
29 | VABS 1111 001 11 . 11 .. 01 .... 0 0110 . . 0 .... @2misc | ||
30 | VNEG 1111 001 11 . 11 .. 01 .... 0 0111 . . 0 .... @2misc | ||
31 | |||
32 | + VABS_F 1111 001 11 . 11 .. 01 .... 0 1110 . . 0 .... @2misc | ||
33 | + VNEG_F 1111 001 11 . 11 .. 01 .... 0 1111 . . 0 .... @2misc | ||
34 | + | ||
35 | VUZP 1111 001 11 . 11 .. 10 .... 0 0010 . . 0 .... @2misc | ||
36 | VZIP 1111 001 11 . 11 .. 10 .... 0 0011 . . 0 .... @2misc | ||
37 | |||
38 | @@ -XXX,XX +XXX,XX @@ Vimm_1r 1111 001 . 1 . 000 ... .... cmode:4 0 . op:1 1 .... @1reg_imm | ||
39 | |||
40 | VCVT_F16_F32 1111 001 11 . 11 .. 10 .... 0 1100 0 . 0 .... @2misc_q0 | ||
41 | VCVT_F32_F16 1111 001 11 . 11 .. 10 .... 0 1110 0 . 0 .... @2misc_q0 | ||
42 | + | ||
43 | + VRECPE 1111 001 11 . 11 .. 11 .... 0 1000 . . 0 .... @2misc | ||
44 | + VRSQRTE 1111 001 11 . 11 .. 11 .... 0 1001 . . 0 .... @2misc | ||
45 | ] | ||
46 | |||
47 | # Subgroup for size != 0b11 | ||
48 | diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c | ||
39 | index XXXXXXX..XXXXXXX 100644 | 49 | index XXXXXXX..XXXXXXX 100644 |
40 | --- a/exec.c | 50 | --- a/target/arm/translate-neon.inc.c |
41 | +++ b/exec.c | 51 | +++ b/target/arm/translate-neon.inc.c |
42 | @@ -XXX,XX +XXX,XX @@ static bool flatview_access_valid(FlatView *fv, hwaddr addr, int len, | 52 | @@ -XXX,XX +XXX,XX @@ static bool trans_VREV16(DisasContext *s, arg_2misc *a) |
43 | mr = flatview_translate(fv, addr, &xlat, &l, is_write); | 53 | } |
44 | if (!memory_access_is_direct(mr, is_write)) { | 54 | return do_2misc(s, a, gen_rev16); |
45 | l = memory_access_size(mr, l, addr); | 55 | } |
46 | - if (!memory_region_access_valid(mr, xlat, l, is_write)) { | 56 | + |
47 | + /* When our callers all have attrs we'll pass them through here */ | 57 | +static bool trans_VCLS(DisasContext *s, arg_2misc *a) |
48 | + if (!memory_region_access_valid(mr, xlat, l, is_write, | 58 | +{ |
49 | + MEMTXATTRS_UNSPECIFIED)) { | 59 | + static NeonGenOneOpFn * const fn[] = { |
50 | return false; | 60 | + gen_helper_neon_cls_s8, |
51 | } | 61 | + gen_helper_neon_cls_s16, |
52 | } | 62 | + gen_helper_neon_cls_s32, |
53 | diff --git a/hw/s390x/s390-pci-inst.c b/hw/s390x/s390-pci-inst.c | 63 | + NULL, |
64 | + }; | ||
65 | + return do_2misc(s, a, fn[a->size]); | ||
66 | +} | ||
67 | + | ||
68 | +static void do_VCLZ_32(TCGv_i32 rd, TCGv_i32 rm) | ||
69 | +{ | ||
70 | + tcg_gen_clzi_i32(rd, rm, 32); | ||
71 | +} | ||
72 | + | ||
73 | +static bool trans_VCLZ(DisasContext *s, arg_2misc *a) | ||
74 | +{ | ||
75 | + static NeonGenOneOpFn * const fn[] = { | ||
76 | + gen_helper_neon_clz_u8, | ||
77 | + gen_helper_neon_clz_u16, | ||
78 | + do_VCLZ_32, | ||
79 | + NULL, | ||
80 | + }; | ||
81 | + return do_2misc(s, a, fn[a->size]); | ||
82 | +} | ||
83 | + | ||
84 | +static bool trans_VCNT(DisasContext *s, arg_2misc *a) | ||
85 | +{ | ||
86 | + if (a->size != 0) { | ||
87 | + return false; | ||
88 | + } | ||
89 | + return do_2misc(s, a, gen_helper_neon_cnt_u8); | ||
90 | +} | ||
91 | + | ||
92 | +static bool trans_VABS_F(DisasContext *s, arg_2misc *a) | ||
93 | +{ | ||
94 | + if (a->size != 2) { | ||
95 | + return false; | ||
96 | + } | ||
97 | + /* TODO: FP16 : size == 1 */ | ||
98 | + return do_2misc(s, a, gen_helper_vfp_abss); | ||
99 | +} | ||
100 | + | ||
101 | +static bool trans_VNEG_F(DisasContext *s, arg_2misc *a) | ||
102 | +{ | ||
103 | + if (a->size != 2) { | ||
104 | + return false; | ||
105 | + } | ||
106 | + /* TODO: FP16 : size == 1 */ | ||
107 | + return do_2misc(s, a, gen_helper_vfp_negs); | ||
108 | +} | ||
109 | + | ||
110 | +static bool trans_VRECPE(DisasContext *s, arg_2misc *a) | ||
111 | +{ | ||
112 | + if (a->size != 2) { | ||
113 | + return false; | ||
114 | + } | ||
115 | + return do_2misc(s, a, gen_helper_recpe_u32); | ||
116 | +} | ||
117 | + | ||
118 | +static bool trans_VRSQRTE(DisasContext *s, arg_2misc *a) | ||
119 | +{ | ||
120 | + if (a->size != 2) { | ||
121 | + return false; | ||
122 | + } | ||
123 | + return do_2misc(s, a, gen_helper_rsqrte_u32); | ||
124 | +} | ||
125 | diff --git a/target/arm/translate.c b/target/arm/translate.c | ||
54 | index XXXXXXX..XXXXXXX 100644 | 126 | index XXXXXXX..XXXXXXX 100644 |
55 | --- a/hw/s390x/s390-pci-inst.c | 127 | --- a/target/arm/translate.c |
56 | +++ b/hw/s390x/s390-pci-inst.c | 128 | +++ b/target/arm/translate.c |
57 | @@ -XXX,XX +XXX,XX @@ int pcistb_service_call(S390CPU *cpu, uint8_t r1, uint8_t r3, uint64_t gaddr, | 129 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) |
58 | mr = s390_get_subregion(mr, offset, len); | 130 | case NEON_2RM_SHA1SU1: |
59 | offset -= mr->addr; | 131 | case NEON_2RM_VREV32: |
60 | 132 | case NEON_2RM_VREV16: | |
61 | - if (!memory_region_access_valid(mr, offset, len, true)) { | 133 | + case NEON_2RM_VCLS: |
62 | + if (!memory_region_access_valid(mr, offset, len, true, | 134 | + case NEON_2RM_VCLZ: |
63 | + MEMTXATTRS_UNSPECIFIED)) { | 135 | + case NEON_2RM_VCNT: |
64 | s390_program_interrupt(env, PGM_OPERAND, 6, ra); | 136 | + case NEON_2RM_VABS_F: |
65 | return 0; | 137 | + case NEON_2RM_VNEG_F: |
66 | } | 138 | + case NEON_2RM_VRECPE: |
67 | diff --git a/memory.c b/memory.c | 139 | + case NEON_2RM_VRSQRTE: |
68 | index XXXXXXX..XXXXXXX 100644 | 140 | /* handled by decodetree */ |
69 | --- a/memory.c | 141 | return 1; |
70 | +++ b/memory.c | 142 | case NEON_2RM_VTRN: |
71 | @@ -XXX,XX +XXX,XX @@ static const MemoryRegionOps ram_device_mem_ops = { | 143 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) |
72 | bool memory_region_access_valid(MemoryRegion *mr, | 144 | for (pass = 0; pass < (q ? 4 : 2); pass++) { |
73 | hwaddr addr, | 145 | tmp = neon_load_reg(rm, pass); |
74 | unsigned size, | 146 | switch (op) { |
75 | - bool is_write) | 147 | - case NEON_2RM_VCLS: |
76 | + bool is_write, | 148 | - switch (size) { |
77 | + MemTxAttrs attrs) | 149 | - case 0: gen_helper_neon_cls_s8(tmp, tmp); break; |
78 | { | 150 | - case 1: gen_helper_neon_cls_s16(tmp, tmp); break; |
79 | int access_size_min, access_size_max; | 151 | - case 2: gen_helper_neon_cls_s32(tmp, tmp); break; |
80 | int access_size, i; | 152 | - default: abort(); |
81 | @@ -XXX,XX +XXX,XX @@ MemTxResult memory_region_dispatch_read(MemoryRegion *mr, | 153 | - } |
82 | { | 154 | - break; |
83 | MemTxResult r; | 155 | - case NEON_2RM_VCLZ: |
84 | 156 | - switch (size) { | |
85 | - if (!memory_region_access_valid(mr, addr, size, false)) { | 157 | - case 0: gen_helper_neon_clz_u8(tmp, tmp); break; |
86 | + if (!memory_region_access_valid(mr, addr, size, false, attrs)) { | 158 | - case 1: gen_helper_neon_clz_u16(tmp, tmp); break; |
87 | *pval = unassigned_mem_read(mr, addr, size); | 159 | - case 2: tcg_gen_clzi_i32(tmp, tmp, 32); break; |
88 | return MEMTX_DECODE_ERROR; | 160 | - default: abort(); |
89 | } | 161 | - } |
90 | @@ -XXX,XX +XXX,XX @@ MemTxResult memory_region_dispatch_write(MemoryRegion *mr, | 162 | - break; |
91 | unsigned size, | 163 | - case NEON_2RM_VCNT: |
92 | MemTxAttrs attrs) | 164 | - gen_helper_neon_cnt_u8(tmp, tmp); |
93 | { | 165 | - break; |
94 | - if (!memory_region_access_valid(mr, addr, size, true)) { | 166 | case NEON_2RM_VQABS: |
95 | + if (!memory_region_access_valid(mr, addr, size, true, attrs)) { | 167 | switch (size) { |
96 | unassigned_mem_write(mr, addr, data, size); | 168 | case 0: |
97 | return MEMTX_DECODE_ERROR; | 169 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) |
98 | } | 170 | tcg_temp_free_ptr(fpstatus); |
171 | break; | ||
172 | } | ||
173 | - case NEON_2RM_VABS_F: | ||
174 | - gen_helper_vfp_abss(tmp, tmp); | ||
175 | - break; | ||
176 | - case NEON_2RM_VNEG_F: | ||
177 | - gen_helper_vfp_negs(tmp, tmp); | ||
178 | - break; | ||
179 | case NEON_2RM_VSWP: | ||
180 | tmp2 = neon_load_reg(rd, pass); | ||
181 | neon_store_reg(rm, pass, tmp2); | ||
182 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) | ||
183 | tcg_temp_free_ptr(fpst); | ||
184 | break; | ||
185 | } | ||
186 | - case NEON_2RM_VRECPE: | ||
187 | - gen_helper_recpe_u32(tmp, tmp); | ||
188 | - break; | ||
189 | - case NEON_2RM_VRSQRTE: | ||
190 | - gen_helper_rsqrte_u32(tmp, tmp); | ||
191 | - break; | ||
192 | case NEON_2RM_VRECPE_F: | ||
193 | { | ||
194 | TCGv_ptr fpstatus = get_fpstatus_ptr(1); | ||
99 | -- | 195 | -- |
100 | 2.17.1 | 196 | 2.20.1 |
101 | 197 | ||
102 | 198 | diff view generated by jsdifflib |
1 | As part of plumbing MemTxAttrs down to the IOMMU translate method, | 1 | Convert the Neon VQABS and VQNEG insns to decodetree. |
---|---|---|---|
2 | add MemTxAttrs as an argument to flatview_extend_translation(). | 2 | Since these are the only ones which need cpu_env passing to |
3 | Its callers either have an attrs value to hand, or don't care | 3 | the helper, we wrap the helper rather than creating a whole |
4 | and can use MEMTXATTRS_UNSPECIFIED. | 4 | new do_2misc_env() function. |
5 | 5 | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
7 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | ||
8 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 7 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
9 | Message-id: 20180521140402.23318-7-peter.maydell@linaro.org | 8 | Message-id: 20200616170844.13318-15-peter.maydell@linaro.org |
10 | --- | 9 | --- |
11 | exec.c | 15 ++++++++++----- | 10 | target/arm/neon-dp.decode | 3 +++ |
12 | 1 file changed, 10 insertions(+), 5 deletions(-) | 11 | target/arm/translate-neon.inc.c | 35 +++++++++++++++++++++++++++++++++ |
12 | target/arm/translate.c | 30 ++-------------------------- | ||
13 | 3 files changed, 40 insertions(+), 28 deletions(-) | ||
13 | 14 | ||
14 | diff --git a/exec.c b/exec.c | 15 | diff --git a/target/arm/neon-dp.decode b/target/arm/neon-dp.decode |
15 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/exec.c | 17 | --- a/target/arm/neon-dp.decode |
17 | +++ b/exec.c | 18 | +++ b/target/arm/neon-dp.decode |
18 | @@ -XXX,XX +XXX,XX @@ bool address_space_access_valid(AddressSpace *as, hwaddr addr, | 19 | @@ -XXX,XX +XXX,XX @@ Vimm_1r 1111 001 . 1 . 000 ... .... cmode:4 0 . op:1 1 .... @1reg_imm |
19 | 20 | VPADAL_S 1111 001 11 . 11 .. 00 .... 0 1100 . . 0 .... @2misc | |
20 | static hwaddr | 21 | VPADAL_U 1111 001 11 . 11 .. 00 .... 0 1101 . . 0 .... @2misc |
21 | flatview_extend_translation(FlatView *fv, hwaddr addr, | 22 | |
22 | - hwaddr target_len, | 23 | + VQABS 1111 001 11 . 11 .. 00 .... 0 1110 . . 0 .... @2misc |
23 | - MemoryRegion *mr, hwaddr base, hwaddr len, | 24 | + VQNEG 1111 001 11 . 11 .. 00 .... 0 1111 . . 0 .... @2misc |
24 | - bool is_write) | 25 | + |
25 | + hwaddr target_len, | 26 | VCGT0 1111 001 11 . 11 .. 01 .... 0 0000 . . 0 .... @2misc |
26 | + MemoryRegion *mr, hwaddr base, hwaddr len, | 27 | VCGE0 1111 001 11 . 11 .. 01 .... 0 0001 . . 0 .... @2misc |
27 | + bool is_write, MemTxAttrs attrs) | 28 | VCEQ0 1111 001 11 . 11 .. 01 .... 0 0010 . . 0 .... @2misc |
28 | { | 29 | diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c |
29 | hwaddr done = 0; | 30 | index XXXXXXX..XXXXXXX 100644 |
30 | hwaddr xlat; | 31 | --- a/target/arm/translate-neon.inc.c |
31 | @@ -XXX,XX +XXX,XX @@ void *address_space_map(AddressSpace *as, | 32 | +++ b/target/arm/translate-neon.inc.c |
32 | 33 | @@ -XXX,XX +XXX,XX @@ static bool trans_VRSQRTE(DisasContext *s, arg_2misc *a) | |
33 | memory_region_ref(mr); | 34 | } |
34 | *plen = flatview_extend_translation(fv, addr, len, mr, xlat, | 35 | return do_2misc(s, a, gen_helper_rsqrte_u32); |
35 | - l, is_write); | 36 | } |
36 | + l, is_write, attrs); | 37 | + |
37 | ptr = qemu_ram_ptr_length(mr->ram_block, xlat, plen, true); | 38 | +#define WRAP_1OP_ENV_FN(WRAPNAME, FUNC) \ |
38 | rcu_read_unlock(); | 39 | + static void WRAPNAME(TCGv_i32 d, TCGv_i32 m) \ |
39 | 40 | + { \ | |
40 | @@ -XXX,XX +XXX,XX @@ int64_t address_space_cache_init(MemoryRegionCache *cache, | 41 | + FUNC(d, cpu_env, m); \ |
41 | mr = cache->mrs.mr; | 42 | + } |
42 | memory_region_ref(mr); | 43 | + |
43 | if (memory_access_is_direct(mr, is_write)) { | 44 | +WRAP_1OP_ENV_FN(gen_VQABS_s8, gen_helper_neon_qabs_s8) |
44 | + /* We don't care about the memory attributes here as we're only | 45 | +WRAP_1OP_ENV_FN(gen_VQABS_s16, gen_helper_neon_qabs_s16) |
45 | + * doing this if we found actual RAM, which behaves the same | 46 | +WRAP_1OP_ENV_FN(gen_VQABS_s32, gen_helper_neon_qabs_s32) |
46 | + * regardless of attributes; so UNSPECIFIED is fine. | 47 | +WRAP_1OP_ENV_FN(gen_VQNEG_s8, gen_helper_neon_qneg_s8) |
47 | + */ | 48 | +WRAP_1OP_ENV_FN(gen_VQNEG_s16, gen_helper_neon_qneg_s16) |
48 | l = flatview_extend_translation(cache->fv, addr, len, mr, | 49 | +WRAP_1OP_ENV_FN(gen_VQNEG_s32, gen_helper_neon_qneg_s32) |
49 | - cache->xlat, l, is_write); | 50 | + |
50 | + cache->xlat, l, is_write, | 51 | +static bool trans_VQABS(DisasContext *s, arg_2misc *a) |
51 | + MEMTXATTRS_UNSPECIFIED); | 52 | +{ |
52 | cache->ptr = qemu_ram_ptr_length(mr->ram_block, cache->xlat, &l, true); | 53 | + static NeonGenOneOpFn * const fn[] = { |
53 | } else { | 54 | + gen_VQABS_s8, |
54 | cache->ptr = NULL; | 55 | + gen_VQABS_s16, |
56 | + gen_VQABS_s32, | ||
57 | + NULL, | ||
58 | + }; | ||
59 | + return do_2misc(s, a, fn[a->size]); | ||
60 | +} | ||
61 | + | ||
62 | +static bool trans_VQNEG(DisasContext *s, arg_2misc *a) | ||
63 | +{ | ||
64 | + static NeonGenOneOpFn * const fn[] = { | ||
65 | + gen_VQNEG_s8, | ||
66 | + gen_VQNEG_s16, | ||
67 | + gen_VQNEG_s32, | ||
68 | + NULL, | ||
69 | + }; | ||
70 | + return do_2misc(s, a, fn[a->size]); | ||
71 | +} | ||
72 | diff --git a/target/arm/translate.c b/target/arm/translate.c | ||
73 | index XXXXXXX..XXXXXXX 100644 | ||
74 | --- a/target/arm/translate.c | ||
75 | +++ b/target/arm/translate.c | ||
76 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) | ||
77 | case NEON_2RM_VNEG_F: | ||
78 | case NEON_2RM_VRECPE: | ||
79 | case NEON_2RM_VRSQRTE: | ||
80 | + case NEON_2RM_VQABS: | ||
81 | + case NEON_2RM_VQNEG: | ||
82 | /* handled by decodetree */ | ||
83 | return 1; | ||
84 | case NEON_2RM_VTRN: | ||
85 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) | ||
86 | for (pass = 0; pass < (q ? 4 : 2); pass++) { | ||
87 | tmp = neon_load_reg(rm, pass); | ||
88 | switch (op) { | ||
89 | - case NEON_2RM_VQABS: | ||
90 | - switch (size) { | ||
91 | - case 0: | ||
92 | - gen_helper_neon_qabs_s8(tmp, cpu_env, tmp); | ||
93 | - break; | ||
94 | - case 1: | ||
95 | - gen_helper_neon_qabs_s16(tmp, cpu_env, tmp); | ||
96 | - break; | ||
97 | - case 2: | ||
98 | - gen_helper_neon_qabs_s32(tmp, cpu_env, tmp); | ||
99 | - break; | ||
100 | - default: abort(); | ||
101 | - } | ||
102 | - break; | ||
103 | - case NEON_2RM_VQNEG: | ||
104 | - switch (size) { | ||
105 | - case 0: | ||
106 | - gen_helper_neon_qneg_s8(tmp, cpu_env, tmp); | ||
107 | - break; | ||
108 | - case 1: | ||
109 | - gen_helper_neon_qneg_s16(tmp, cpu_env, tmp); | ||
110 | - break; | ||
111 | - case 2: | ||
112 | - gen_helper_neon_qneg_s32(tmp, cpu_env, tmp); | ||
113 | - break; | ||
114 | - default: abort(); | ||
115 | - } | ||
116 | - break; | ||
117 | case NEON_2RM_VCGT0_F: | ||
118 | { | ||
119 | TCGv_ptr fpstatus = get_fpstatus_ptr(1); | ||
55 | -- | 120 | -- |
56 | 2.17.1 | 121 | 2.20.1 |
57 | 122 | ||
58 | 123 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | 1 | Convert the Neon 2-reg-misc insns which are implemented with | |
2 | simple calls to functions that take the input, output and | ||
3 | fpstatus pointer. | ||
4 | |||
5 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
6 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Message-id: 20200616170844.13318-16-peter.maydell@linaro.org | ||
8 | --- | ||
9 | target/arm/translate.h | 1 + | ||
10 | target/arm/neon-dp.decode | 8 +++++ | ||
11 | target/arm/translate-neon.inc.c | 62 +++++++++++++++++++++++++++++++++ | ||
12 | target/arm/translate.c | 56 ++++------------------------- | ||
13 | 4 files changed, 78 insertions(+), 49 deletions(-) | ||
14 | |||
15 | diff --git a/target/arm/translate.h b/target/arm/translate.h | ||
16 | index XXXXXXX..XXXXXXX 100644 | ||
17 | --- a/target/arm/translate.h | ||
18 | +++ b/target/arm/translate.h | ||
19 | @@ -XXX,XX +XXX,XX @@ typedef void NeonGenNarrowFn(TCGv_i32, TCGv_i64); | ||
20 | typedef void NeonGenNarrowEnvFn(TCGv_i32, TCGv_ptr, TCGv_i64); | ||
21 | typedef void NeonGenWidenFn(TCGv_i64, TCGv_i32); | ||
22 | typedef void NeonGenTwoOpWidenFn(TCGv_i64, TCGv_i32, TCGv_i32); | ||
23 | +typedef void NeonGenOneSingleOpFn(TCGv_i32, TCGv_i32, TCGv_ptr); | ||
24 | typedef void NeonGenTwoSingleOpFn(TCGv_i32, TCGv_i32, TCGv_i32, TCGv_ptr); | ||
25 | typedef void NeonGenTwoDoubleOpFn(TCGv_i64, TCGv_i64, TCGv_i64, TCGv_ptr); | ||
26 | typedef void NeonGenOne64OpFn(TCGv_i64, TCGv_i64); | ||
27 | diff --git a/target/arm/neon-dp.decode b/target/arm/neon-dp.decode | ||
28 | index XXXXXXX..XXXXXXX 100644 | ||
29 | --- a/target/arm/neon-dp.decode | ||
30 | +++ b/target/arm/neon-dp.decode | ||
31 | @@ -XXX,XX +XXX,XX @@ Vimm_1r 1111 001 . 1 . 000 ... .... cmode:4 0 . op:1 1 .... @1reg_imm | ||
32 | SHA1SU1 1111 001 11 . 11 .. 10 .... 0 0111 0 . 0 .... @2misc_q1 | ||
33 | SHA256SU0 1111 001 11 . 11 .. 10 .... 0 0111 1 . 0 .... @2misc_q1 | ||
34 | |||
35 | + VRINTX 1111 001 11 . 11 .. 10 .... 0 1001 . . 0 .... @2misc | ||
36 | + | ||
37 | VCVT_F16_F32 1111 001 11 . 11 .. 10 .... 0 1100 0 . 0 .... @2misc_q0 | ||
38 | VCVT_F32_F16 1111 001 11 . 11 .. 10 .... 0 1110 0 . 0 .... @2misc_q0 | ||
39 | |||
40 | VRECPE 1111 001 11 . 11 .. 11 .... 0 1000 . . 0 .... @2misc | ||
41 | VRSQRTE 1111 001 11 . 11 .. 11 .... 0 1001 . . 0 .... @2misc | ||
42 | + VRECPE_F 1111 001 11 . 11 .. 11 .... 0 1010 . . 0 .... @2misc | ||
43 | + VRSQRTE_F 1111 001 11 . 11 .. 11 .... 0 1011 . . 0 .... @2misc | ||
44 | + VCVT_FS 1111 001 11 . 11 .. 11 .... 0 1100 . . 0 .... @2misc | ||
45 | + VCVT_FU 1111 001 11 . 11 .. 11 .... 0 1101 . . 0 .... @2misc | ||
46 | + VCVT_SF 1111 001 11 . 11 .. 11 .... 0 1110 . . 0 .... @2misc | ||
47 | + VCVT_UF 1111 001 11 . 11 .. 11 .... 0 1111 . . 0 .... @2misc | ||
48 | ] | ||
49 | |||
50 | # Subgroup for size != 0b11 | ||
51 | diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c | ||
52 | index XXXXXXX..XXXXXXX 100644 | ||
53 | --- a/target/arm/translate-neon.inc.c | ||
54 | +++ b/target/arm/translate-neon.inc.c | ||
55 | @@ -XXX,XX +XXX,XX @@ static bool trans_VQNEG(DisasContext *s, arg_2misc *a) | ||
56 | }; | ||
57 | return do_2misc(s, a, fn[a->size]); | ||
58 | } | ||
59 | + | ||
60 | +static bool do_2misc_fp(DisasContext *s, arg_2misc *a, | ||
61 | + NeonGenOneSingleOpFn *fn) | ||
62 | +{ | ||
63 | + int pass; | ||
64 | + TCGv_ptr fpst; | ||
65 | + | ||
66 | + /* Handle a 2-reg-misc operation by iterating 32 bits at a time */ | ||
67 | + if (!arm_dc_feature(s, ARM_FEATURE_NEON)) { | ||
68 | + return false; | ||
69 | + } | ||
70 | + | ||
71 | + /* UNDEF accesses to D16-D31 if they don't exist. */ | ||
72 | + if (!dc_isar_feature(aa32_simd_r32, s) && | ||
73 | + ((a->vd | a->vm) & 0x10)) { | ||
74 | + return false; | ||
75 | + } | ||
76 | + | ||
77 | + if (a->size != 2) { | ||
78 | + /* TODO: FP16 will be the size == 1 case */ | ||
79 | + return false; | ||
80 | + } | ||
81 | + | ||
82 | + if ((a->vd | a->vm) & a->q) { | ||
83 | + return false; | ||
84 | + } | ||
85 | + | ||
86 | + if (!vfp_access_check(s)) { | ||
87 | + return true; | ||
88 | + } | ||
89 | + | ||
90 | + fpst = get_fpstatus_ptr(1); | ||
91 | + for (pass = 0; pass < (a->q ? 4 : 2); pass++) { | ||
92 | + TCGv_i32 tmp = neon_load_reg(a->vm, pass); | ||
93 | + fn(tmp, tmp, fpst); | ||
94 | + neon_store_reg(a->vd, pass, tmp); | ||
95 | + } | ||
96 | + tcg_temp_free_ptr(fpst); | ||
97 | + | ||
98 | + return true; | ||
99 | +} | ||
100 | + | ||
101 | +#define DO_2MISC_FP(INSN, FUNC) \ | ||
102 | + static bool trans_##INSN(DisasContext *s, arg_2misc *a) \ | ||
103 | + { \ | ||
104 | + return do_2misc_fp(s, a, FUNC); \ | ||
105 | + } | ||
106 | + | ||
107 | +DO_2MISC_FP(VRECPE_F, gen_helper_recpe_f32) | ||
108 | +DO_2MISC_FP(VRSQRTE_F, gen_helper_rsqrte_f32) | ||
109 | +DO_2MISC_FP(VCVT_FS, gen_helper_vfp_sitos) | ||
110 | +DO_2MISC_FP(VCVT_FU, gen_helper_vfp_uitos) | ||
111 | +DO_2MISC_FP(VCVT_SF, gen_helper_vfp_tosizs) | ||
112 | +DO_2MISC_FP(VCVT_UF, gen_helper_vfp_touizs) | ||
113 | + | ||
114 | +static bool trans_VRINTX(DisasContext *s, arg_2misc *a) | ||
115 | +{ | ||
116 | + if (!arm_dc_feature(s, ARM_FEATURE_V8)) { | ||
117 | + return false; | ||
118 | + } | ||
119 | + return do_2misc_fp(s, a, gen_helper_rints_exact); | ||
120 | +} | ||
121 | diff --git a/target/arm/translate.c b/target/arm/translate.c | ||
122 | index XXXXXXX..XXXXXXX 100644 | ||
123 | --- a/target/arm/translate.c | ||
124 | +++ b/target/arm/translate.c | ||
125 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) | ||
126 | case NEON_2RM_VRSQRTE: | ||
127 | case NEON_2RM_VQABS: | ||
128 | case NEON_2RM_VQNEG: | ||
129 | + case NEON_2RM_VRECPE_F: | ||
130 | + case NEON_2RM_VRSQRTE_F: | ||
131 | + case NEON_2RM_VCVT_FS: | ||
132 | + case NEON_2RM_VCVT_FU: | ||
133 | + case NEON_2RM_VCVT_SF: | ||
134 | + case NEON_2RM_VCVT_UF: | ||
135 | + case NEON_2RM_VRINTX: | ||
136 | /* handled by decodetree */ | ||
137 | return 1; | ||
138 | case NEON_2RM_VTRN: | ||
139 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) | ||
140 | tcg_temp_free_i32(tcg_rmode); | ||
141 | break; | ||
142 | } | ||
143 | - case NEON_2RM_VRINTX: | ||
144 | - { | ||
145 | - TCGv_ptr fpstatus = get_fpstatus_ptr(1); | ||
146 | - gen_helper_rints_exact(tmp, tmp, fpstatus); | ||
147 | - tcg_temp_free_ptr(fpstatus); | ||
148 | - break; | ||
149 | - } | ||
150 | case NEON_2RM_VCVTAU: | ||
151 | case NEON_2RM_VCVTAS: | ||
152 | case NEON_2RM_VCVTNU: | ||
153 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) | ||
154 | tcg_temp_free_ptr(fpst); | ||
155 | break; | ||
156 | } | ||
157 | - case NEON_2RM_VRECPE_F: | ||
158 | - { | ||
159 | - TCGv_ptr fpstatus = get_fpstatus_ptr(1); | ||
160 | - gen_helper_recpe_f32(tmp, tmp, fpstatus); | ||
161 | - tcg_temp_free_ptr(fpstatus); | ||
162 | - break; | ||
163 | - } | ||
164 | - case NEON_2RM_VRSQRTE_F: | ||
165 | - { | ||
166 | - TCGv_ptr fpstatus = get_fpstatus_ptr(1); | ||
167 | - gen_helper_rsqrte_f32(tmp, tmp, fpstatus); | ||
168 | - tcg_temp_free_ptr(fpstatus); | ||
169 | - break; | ||
170 | - } | ||
171 | - case NEON_2RM_VCVT_FS: /* VCVT.F32.S32 */ | ||
172 | - { | ||
173 | - TCGv_ptr fpstatus = get_fpstatus_ptr(1); | ||
174 | - gen_helper_vfp_sitos(tmp, tmp, fpstatus); | ||
175 | - tcg_temp_free_ptr(fpstatus); | ||
176 | - break; | ||
177 | - } | ||
178 | - case NEON_2RM_VCVT_FU: /* VCVT.F32.U32 */ | ||
179 | - { | ||
180 | - TCGv_ptr fpstatus = get_fpstatus_ptr(1); | ||
181 | - gen_helper_vfp_uitos(tmp, tmp, fpstatus); | ||
182 | - tcg_temp_free_ptr(fpstatus); | ||
183 | - break; | ||
184 | - } | ||
185 | - case NEON_2RM_VCVT_SF: /* VCVT.S32.F32 */ | ||
186 | - { | ||
187 | - TCGv_ptr fpstatus = get_fpstatus_ptr(1); | ||
188 | - gen_helper_vfp_tosizs(tmp, tmp, fpstatus); | ||
189 | - tcg_temp_free_ptr(fpstatus); | ||
190 | - break; | ||
191 | - } | ||
192 | - case NEON_2RM_VCVT_UF: /* VCVT.U32.F32 */ | ||
193 | - { | ||
194 | - TCGv_ptr fpstatus = get_fpstatus_ptr(1); | ||
195 | - gen_helper_vfp_touizs(tmp, tmp, fpstatus); | ||
196 | - tcg_temp_free_ptr(fpstatus); | ||
197 | - break; | ||
198 | - } | ||
199 | default: | ||
200 | /* Reserved op values were caught by the | ||
201 | * neon_2rm_sizes[] check earlier. | ||
202 | -- | ||
203 | 2.20.1 | ||
204 | |||
205 | diff view generated by jsdifflib |
1 | As part of plumbing MemTxAttrs down to the IOMMU translate method, | 1 | Convert the fp-compare-with-zero insns in the Neon 2-reg-misc group to |
---|---|---|---|
2 | add MemTxAttrs as an argument to address_space_translate() | 2 | decodetree. |
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> | ||
8 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 5 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
9 | Message-id: 20180521140402.23318-4-peter.maydell@linaro.org | 6 | Message-id: 20200616170844.13318-17-peter.maydell@linaro.org |
10 | --- | 7 | --- |
11 | include/exec/memory.h | 4 +++- | 8 | target/arm/neon-dp.decode | 6 ++++ |
12 | accel/tcg/translate-all.c | 2 +- | 9 | target/arm/translate-neon.inc.c | 28 ++++++++++++++++++ |
13 | exec.c | 14 +++++++++----- | 10 | target/arm/translate.c | 50 ++++----------------------------- |
14 | hw/vfio/common.c | 3 ++- | 11 | 3 files changed, 39 insertions(+), 45 deletions(-) |
15 | memory_ldst.inc.c | 18 +++++++++--------- | ||
16 | target/riscv/helper.c | 2 +- | ||
17 | 6 files changed, 25 insertions(+), 18 deletions(-) | ||
18 | 12 | ||
19 | diff --git a/include/exec/memory.h b/include/exec/memory.h | 13 | diff --git a/target/arm/neon-dp.decode b/target/arm/neon-dp.decode |
20 | index XXXXXXX..XXXXXXX 100644 | 14 | index XXXXXXX..XXXXXXX 100644 |
21 | --- a/include/exec/memory.h | 15 | --- a/target/arm/neon-dp.decode |
22 | +++ b/include/exec/memory.h | 16 | +++ b/target/arm/neon-dp.decode |
23 | @@ -XXX,XX +XXX,XX @@ IOMMUTLBEntry address_space_get_iotlb_entry(AddressSpace *as, hwaddr addr, | 17 | @@ -XXX,XX +XXX,XX @@ Vimm_1r 1111 001 . 1 . 000 ... .... cmode:4 0 . op:1 1 .... @1reg_imm |
24 | * #MemoryRegion. | 18 | VABS 1111 001 11 . 11 .. 01 .... 0 0110 . . 0 .... @2misc |
25 | * @len: pointer to length | 19 | VNEG 1111 001 11 . 11 .. 01 .... 0 0111 . . 0 .... @2misc |
26 | * @is_write: indicates the transfer direction | 20 | |
27 | + * @attrs: memory attributes | 21 | + VCGT0_F 1111 001 11 . 11 .. 01 .... 0 1000 . . 0 .... @2misc |
28 | */ | 22 | + VCGE0_F 1111 001 11 . 11 .. 01 .... 0 1001 . . 0 .... @2misc |
29 | MemoryRegion *flatview_translate(FlatView *fv, | 23 | + VCEQ0_F 1111 001 11 . 11 .. 01 .... 0 1010 . . 0 .... @2misc |
30 | hwaddr addr, hwaddr *xlat, | 24 | + VCLE0_F 1111 001 11 . 11 .. 01 .... 0 1011 . . 0 .... @2misc |
31 | @@ -XXX,XX +XXX,XX @@ MemoryRegion *flatview_translate(FlatView *fv, | 25 | + VCLT0_F 1111 001 11 . 11 .. 01 .... 0 1100 . . 0 .... @2misc |
32 | 26 | + | |
33 | static inline MemoryRegion *address_space_translate(AddressSpace *as, | 27 | VABS_F 1111 001 11 . 11 .. 01 .... 0 1110 . . 0 .... @2misc |
34 | hwaddr addr, hwaddr *xlat, | 28 | VNEG_F 1111 001 11 . 11 .. 01 .... 0 1111 . . 0 .... @2misc |
35 | - hwaddr *len, bool is_write) | 29 | |
36 | + hwaddr *len, bool is_write, | 30 | diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c |
37 | + MemTxAttrs attrs) | ||
38 | { | ||
39 | return flatview_translate(address_space_to_flatview(as), | ||
40 | addr, xlat, len, is_write); | ||
41 | diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c | ||
42 | index XXXXXXX..XXXXXXX 100644 | 31 | index XXXXXXX..XXXXXXX 100644 |
43 | --- a/accel/tcg/translate-all.c | 32 | --- a/target/arm/translate-neon.inc.c |
44 | +++ b/accel/tcg/translate-all.c | 33 | +++ b/target/arm/translate-neon.inc.c |
45 | @@ -XXX,XX +XXX,XX @@ void tb_invalidate_phys_addr(AddressSpace *as, hwaddr addr, MemTxAttrs attrs) | 34 | @@ -XXX,XX +XXX,XX @@ static bool trans_VRINTX(DisasContext *s, arg_2misc *a) |
46 | hwaddr l = 1; | 35 | } |
47 | 36 | return do_2misc_fp(s, a, gen_helper_rints_exact); | |
48 | rcu_read_lock(); | 37 | } |
49 | - mr = address_space_translate(as, addr, &addr, &l, false); | 38 | + |
50 | + mr = address_space_translate(as, addr, &addr, &l, false, attrs); | 39 | +#define WRAP_FP_CMP0_FWD(WRAPNAME, FUNC) \ |
51 | if (!(memory_region_is_ram(mr) | 40 | + static void WRAPNAME(TCGv_i32 d, TCGv_i32 m, TCGv_ptr fpst) \ |
52 | || memory_region_is_romd(mr))) { | 41 | + { \ |
53 | rcu_read_unlock(); | 42 | + TCGv_i32 zero = tcg_const_i32(0); \ |
54 | diff --git a/exec.c b/exec.c | 43 | + FUNC(d, m, zero, fpst); \ |
44 | + tcg_temp_free_i32(zero); \ | ||
45 | + } | ||
46 | +#define WRAP_FP_CMP0_REV(WRAPNAME, FUNC) \ | ||
47 | + static void WRAPNAME(TCGv_i32 d, TCGv_i32 m, TCGv_ptr fpst) \ | ||
48 | + { \ | ||
49 | + TCGv_i32 zero = tcg_const_i32(0); \ | ||
50 | + FUNC(d, zero, m, fpst); \ | ||
51 | + tcg_temp_free_i32(zero); \ | ||
52 | + } | ||
53 | + | ||
54 | +#define DO_FP_CMP0(INSN, FUNC, REV) \ | ||
55 | + WRAP_FP_CMP0_##REV(gen_##INSN, FUNC) \ | ||
56 | + static bool trans_##INSN(DisasContext *s, arg_2misc *a) \ | ||
57 | + { \ | ||
58 | + return do_2misc_fp(s, a, gen_##INSN); \ | ||
59 | + } | ||
60 | + | ||
61 | +DO_FP_CMP0(VCGT0_F, gen_helper_neon_cgt_f32, FWD) | ||
62 | +DO_FP_CMP0(VCGE0_F, gen_helper_neon_cge_f32, FWD) | ||
63 | +DO_FP_CMP0(VCEQ0_F, gen_helper_neon_ceq_f32, FWD) | ||
64 | +DO_FP_CMP0(VCLE0_F, gen_helper_neon_cge_f32, REV) | ||
65 | +DO_FP_CMP0(VCLT0_F, gen_helper_neon_cgt_f32, REV) | ||
66 | diff --git a/target/arm/translate.c b/target/arm/translate.c | ||
55 | index XXXXXXX..XXXXXXX 100644 | 67 | index XXXXXXX..XXXXXXX 100644 |
56 | --- a/exec.c | 68 | --- a/target/arm/translate.c |
57 | +++ b/exec.c | 69 | +++ b/target/arm/translate.c |
58 | @@ -XXX,XX +XXX,XX @@ static inline void cpu_physical_memory_write_rom_internal(AddressSpace *as, | 70 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) |
59 | rcu_read_lock(); | 71 | case NEON_2RM_VCVT_SF: |
60 | while (len > 0) { | 72 | case NEON_2RM_VCVT_UF: |
61 | l = len; | 73 | case NEON_2RM_VRINTX: |
62 | - mr = address_space_translate(as, addr, &addr1, &l, true); | 74 | + case NEON_2RM_VCGT0_F: |
63 | + mr = address_space_translate(as, addr, &addr1, &l, true, | 75 | + case NEON_2RM_VCGE0_F: |
64 | + MEMTXATTRS_UNSPECIFIED); | 76 | + case NEON_2RM_VCEQ0_F: |
65 | 77 | + case NEON_2RM_VCLE0_F: | |
66 | if (!(memory_region_is_ram(mr) || | 78 | + case NEON_2RM_VCLT0_F: |
67 | memory_region_is_romd(mr))) { | 79 | /* handled by decodetree */ |
68 | @@ -XXX,XX +XXX,XX @@ void address_space_cache_destroy(MemoryRegionCache *cache) | 80 | return 1; |
69 | */ | 81 | case NEON_2RM_VTRN: |
70 | static inline MemoryRegion *address_space_translate_cached( | 82 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) |
71 | MemoryRegionCache *cache, hwaddr addr, hwaddr *xlat, | 83 | for (pass = 0; pass < (q ? 4 : 2); pass++) { |
72 | - hwaddr *plen, bool is_write) | 84 | tmp = neon_load_reg(rm, pass); |
73 | + hwaddr *plen, bool is_write, MemTxAttrs attrs) | 85 | switch (op) { |
74 | { | 86 | - case NEON_2RM_VCGT0_F: |
75 | MemoryRegionSection section; | 87 | - { |
76 | MemoryRegion *mr; | 88 | - TCGv_ptr fpstatus = get_fpstatus_ptr(1); |
77 | @@ -XXX,XX +XXX,XX @@ address_space_read_cached_slow(MemoryRegionCache *cache, hwaddr addr, | 89 | - tmp2 = tcg_const_i32(0); |
78 | MemoryRegion *mr; | 90 | - gen_helper_neon_cgt_f32(tmp, tmp, tmp2, fpstatus); |
79 | 91 | - tcg_temp_free_i32(tmp2); | |
80 | l = len; | 92 | - tcg_temp_free_ptr(fpstatus); |
81 | - mr = address_space_translate_cached(cache, addr, &addr1, &l, false); | 93 | - break; |
82 | + mr = address_space_translate_cached(cache, addr, &addr1, &l, false, | 94 | - } |
83 | + MEMTXATTRS_UNSPECIFIED); | 95 | - case NEON_2RM_VCGE0_F: |
84 | flatview_read_continue(cache->fv, | 96 | - { |
85 | addr, MEMTXATTRS_UNSPECIFIED, buf, len, | 97 | - TCGv_ptr fpstatus = get_fpstatus_ptr(1); |
86 | addr1, l, mr); | 98 | - tmp2 = tcg_const_i32(0); |
87 | @@ -XXX,XX +XXX,XX @@ address_space_write_cached_slow(MemoryRegionCache *cache, hwaddr addr, | 99 | - gen_helper_neon_cge_f32(tmp, tmp, tmp2, fpstatus); |
88 | MemoryRegion *mr; | 100 | - tcg_temp_free_i32(tmp2); |
89 | 101 | - tcg_temp_free_ptr(fpstatus); | |
90 | l = len; | 102 | - break; |
91 | - mr = address_space_translate_cached(cache, addr, &addr1, &l, true); | 103 | - } |
92 | + mr = address_space_translate_cached(cache, addr, &addr1, &l, true, | 104 | - case NEON_2RM_VCEQ0_F: |
93 | + MEMTXATTRS_UNSPECIFIED); | 105 | - { |
94 | flatview_write_continue(cache->fv, | 106 | - TCGv_ptr fpstatus = get_fpstatus_ptr(1); |
95 | addr, MEMTXATTRS_UNSPECIFIED, buf, len, | 107 | - tmp2 = tcg_const_i32(0); |
96 | addr1, l, mr); | 108 | - gen_helper_neon_ceq_f32(tmp, tmp, tmp2, fpstatus); |
97 | @@ -XXX,XX +XXX,XX @@ bool cpu_physical_memory_is_io(hwaddr phys_addr) | 109 | - tcg_temp_free_i32(tmp2); |
98 | 110 | - tcg_temp_free_ptr(fpstatus); | |
99 | rcu_read_lock(); | 111 | - break; |
100 | mr = address_space_translate(&address_space_memory, | 112 | - } |
101 | - phys_addr, &phys_addr, &l, false); | 113 | - case NEON_2RM_VCLE0_F: |
102 | + phys_addr, &phys_addr, &l, false, | 114 | - { |
103 | + MEMTXATTRS_UNSPECIFIED); | 115 | - TCGv_ptr fpstatus = get_fpstatus_ptr(1); |
104 | 116 | - tmp2 = tcg_const_i32(0); | |
105 | res = !(memory_region_is_ram(mr) || memory_region_is_romd(mr)); | 117 | - gen_helper_neon_cge_f32(tmp, tmp2, tmp, fpstatus); |
106 | rcu_read_unlock(); | 118 | - tcg_temp_free_i32(tmp2); |
107 | diff --git a/hw/vfio/common.c b/hw/vfio/common.c | 119 | - tcg_temp_free_ptr(fpstatus); |
108 | index XXXXXXX..XXXXXXX 100644 | 120 | - break; |
109 | --- a/hw/vfio/common.c | 121 | - } |
110 | +++ b/hw/vfio/common.c | 122 | - case NEON_2RM_VCLT0_F: |
111 | @@ -XXX,XX +XXX,XX @@ static bool vfio_get_vaddr(IOMMUTLBEntry *iotlb, void **vaddr, | 123 | - { |
112 | */ | 124 | - TCGv_ptr fpstatus = get_fpstatus_ptr(1); |
113 | mr = address_space_translate(&address_space_memory, | 125 | - tmp2 = tcg_const_i32(0); |
114 | iotlb->translated_addr, | 126 | - gen_helper_neon_cgt_f32(tmp, tmp2, tmp, fpstatus); |
115 | - &xlat, &len, writable); | 127 | - tcg_temp_free_i32(tmp2); |
116 | + &xlat, &len, writable, | 128 | - tcg_temp_free_ptr(fpstatus); |
117 | + MEMTXATTRS_UNSPECIFIED); | 129 | - break; |
118 | if (!memory_region_is_ram(mr)) { | 130 | - } |
119 | error_report("iommu map to non memory area %"HWADDR_PRIx"", | 131 | case NEON_2RM_VSWP: |
120 | xlat); | 132 | tmp2 = neon_load_reg(rd, pass); |
121 | diff --git a/memory_ldst.inc.c b/memory_ldst.inc.c | 133 | neon_store_reg(rm, pass, tmp2); |
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 | -- | 134 | -- |
220 | 2.17.1 | 135 | 2.20.1 |
221 | 136 | ||
222 | 137 | diff view generated by jsdifflib |
1 | Add more detail to the documentation for memory_region_init_iommu() | 1 | Convert the Neon 2-reg-misc VRINT insns to decodetree. |
---|---|---|---|
2 | and other IOMMU-related functions and data structures. | 2 | Giving these insns their own do_vrint() function allows us |
3 | to change the rounding mode just once at the start and end | ||
4 | rather than doing it for every element in the vector. | ||
3 | 5 | ||
4 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
5 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 7 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
6 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | 8 | Message-id: 20200616170844.13318-18-peter.maydell@linaro.org |
7 | Reviewed-by: Eric Auger <eric.auger@redhat.com> | ||
8 | Message-id: 20180521140402.23318-2-peter.maydell@linaro.org | ||
9 | --- | 9 | --- |
10 | include/exec/memory.h | 105 ++++++++++++++++++++++++++++++++++++++---- | 10 | target/arm/neon-dp.decode | 8 +++++ |
11 | 1 file changed, 95 insertions(+), 10 deletions(-) | 11 | target/arm/translate-neon.inc.c | 61 +++++++++++++++++++++++++++++++++ |
12 | target/arm/translate.c | 31 +++-------------- | ||
13 | 3 files changed, 74 insertions(+), 26 deletions(-) | ||
12 | 14 | ||
13 | diff --git a/include/exec/memory.h b/include/exec/memory.h | 15 | diff --git a/target/arm/neon-dp.decode b/target/arm/neon-dp.decode |
14 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/include/exec/memory.h | 17 | --- a/target/arm/neon-dp.decode |
16 | +++ b/include/exec/memory.h | 18 | +++ b/target/arm/neon-dp.decode |
17 | @@ -XXX,XX +XXX,XX @@ enum IOMMUMemoryRegionAttr { | 19 | @@ -XXX,XX +XXX,XX @@ Vimm_1r 1111 001 . 1 . 000 ... .... cmode:4 0 . op:1 1 .... @1reg_imm |
18 | IOMMU_ATTR_SPAPR_TCE_FD | 20 | SHA1SU1 1111 001 11 . 11 .. 10 .... 0 0111 0 . 0 .... @2misc_q1 |
19 | }; | 21 | SHA256SU0 1111 001 11 . 11 .. 10 .... 0 0111 1 . 0 .... @2misc_q1 |
20 | 22 | ||
21 | +/** | 23 | + VRINTN 1111 001 11 . 11 .. 10 .... 0 1000 . . 0 .... @2misc |
22 | + * IOMMUMemoryRegionClass: | 24 | VRINTX 1111 001 11 . 11 .. 10 .... 0 1001 . . 0 .... @2misc |
23 | + * | 25 | + VRINTA 1111 001 11 . 11 .. 10 .... 0 1010 . . 0 .... @2misc |
24 | + * All IOMMU implementations need to subclass TYPE_IOMMU_MEMORY_REGION | 26 | + VRINTZ 1111 001 11 . 11 .. 10 .... 0 1011 . . 0 .... @2misc |
25 | + * and provide an implementation of at least the @translate method here | 27 | |
26 | + * to handle requests to the memory region. Other methods are optional. | 28 | VCVT_F16_F32 1111 001 11 . 11 .. 10 .... 0 1100 0 . 0 .... @2misc_q0 |
27 | + * | 29 | + |
28 | + * The IOMMU implementation must use the IOMMU notifier infrastructure | 30 | + VRINTM 1111 001 11 . 11 .. 10 .... 0 1101 . . 0 .... @2misc |
29 | + * to report whenever mappings are changed, by calling | 31 | + |
30 | + * memory_region_notify_iommu() (or, if necessary, by calling | 32 | VCVT_F32_F16 1111 001 11 . 11 .. 10 .... 0 1110 0 . 0 .... @2misc_q0 |
31 | + * memory_region_notify_one() for each registered notifier). | 33 | |
32 | + */ | 34 | + VRINTP 1111 001 11 . 11 .. 10 .... 0 1111 . . 0 .... @2misc |
33 | typedef struct IOMMUMemoryRegionClass { | 35 | + |
34 | /* private */ | 36 | VRECPE 1111 001 11 . 11 .. 11 .... 0 1000 . . 0 .... @2misc |
35 | struct DeviceClass parent_class; | 37 | VRSQRTE 1111 001 11 . 11 .. 11 .... 0 1001 . . 0 .... @2misc |
36 | 38 | VRECPE_F 1111 001 11 . 11 .. 11 .... 0 1010 . . 0 .... @2misc | |
37 | /* | 39 | diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c |
38 | - * Return a TLB entry that contains a given address. Flag should | 40 | index XXXXXXX..XXXXXXX 100644 |
39 | - * be the access permission of this translation operation. We can | 41 | --- a/target/arm/translate-neon.inc.c |
40 | - * set flag to IOMMU_NONE to mean that we don't need any | 42 | +++ b/target/arm/translate-neon.inc.c |
41 | - * read/write permission checks, like, when for region replay. | 43 | @@ -XXX,XX +XXX,XX @@ DO_FP_CMP0(VCGE0_F, gen_helper_neon_cge_f32, FWD) |
42 | + * Return a TLB entry that contains a given address. | 44 | DO_FP_CMP0(VCEQ0_F, gen_helper_neon_ceq_f32, FWD) |
43 | + * | 45 | DO_FP_CMP0(VCLE0_F, gen_helper_neon_cge_f32, REV) |
44 | + * The IOMMUAccessFlags indicated via @flag are optional and may | 46 | DO_FP_CMP0(VCLT0_F, gen_helper_neon_cgt_f32, REV) |
45 | + * be specified as IOMMU_NONE to indicate that the caller needs | 47 | + |
46 | + * the full translation information for both reads and writes. If | 48 | +static bool do_vrint(DisasContext *s, arg_2misc *a, int rmode) |
47 | + * the access flags are specified then the IOMMU implementation | 49 | +{ |
48 | + * may use this as an optimization, to stop doing a page table | 50 | + /* |
49 | + * walk as soon as it knows that the requested permissions are not | 51 | + * Handle a VRINT* operation by iterating 32 bits at a time, |
50 | + * allowed. If IOMMU_NONE is passed then the IOMMU must do the | 52 | + * with a specified rounding mode in operation. |
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 | + */ | 53 | + */ |
74 | uint64_t (*get_min_page_size)(IOMMUMemoryRegion *iommu); | 54 | + int pass; |
75 | - /* Called when IOMMU Notifier flag changed */ | 55 | + TCGv_ptr fpst; |
76 | + /* Called when IOMMU Notifier flag changes (ie when the set of | 56 | + TCGv_i32 tcg_rmode; |
77 | + * events which IOMMU users are requesting notification for changes). | 57 | + |
78 | + * Optional method -- need not be provided if the IOMMU does not | 58 | + if (!arm_dc_feature(s, ARM_FEATURE_NEON) || |
79 | + * need to know exactly which events must be notified. | 59 | + !arm_dc_feature(s, ARM_FEATURE_V8)) { |
80 | + * | 60 | + return false; |
81 | + * @iommu: the IOMMUMemoryRegion | 61 | + } |
82 | + * @old_flags: events which previously needed to be notified | 62 | + |
83 | + * @new_flags: events which now need to be notified | 63 | + /* UNDEF accesses to D16-D31 if they don't exist. */ |
84 | + */ | 64 | + if (!dc_isar_feature(aa32_simd_r32, s) && |
85 | void (*notify_flag_changed)(IOMMUMemoryRegion *iommu, | 65 | + ((a->vd | a->vm) & 0x10)) { |
86 | IOMMUNotifierFlag old_flags, | 66 | + return false; |
87 | IOMMUNotifierFlag new_flags); | 67 | + } |
88 | - /* Set this up to provide customized IOMMU replay function */ | 68 | + |
89 | + /* Called to handle memory_region_iommu_replay(). | 69 | + if (a->size != 2) { |
90 | + * | 70 | + /* TODO: FP16 will be the size == 1 case */ |
91 | + * The default implementation of memory_region_iommu_replay() is to | 71 | + return false; |
92 | + * call the IOMMU translate method for every page in the address space | 72 | + } |
93 | + * with flag == IOMMU_NONE and then call the notifier if translate | 73 | + |
94 | + * returns a valid mapping. If this method is implemented then it | 74 | + if ((a->vd | a->vm) & a->q) { |
95 | + * overrides the default behaviour, and must provide the full semantics | 75 | + return false; |
96 | + * of memory_region_iommu_replay(), by calling @notifier for every | 76 | + } |
97 | + * translation present in the IOMMU. | 77 | + |
98 | + * | 78 | + if (!vfp_access_check(s)) { |
99 | + * Optional method -- an IOMMU only needs to provide this method | 79 | + return true; |
100 | + * if the default is inefficient or produces undesirable side effects. | 80 | + } |
101 | + * | 81 | + |
102 | + * Note: this is not related to record-and-replay functionality. | 82 | + fpst = get_fpstatus_ptr(1); |
103 | + */ | 83 | + tcg_rmode = tcg_const_i32(arm_rmode_to_sf(rmode)); |
104 | void (*replay)(IOMMUMemoryRegion *iommu, IOMMUNotifier *notifier); | 84 | + gen_helper_set_neon_rmode(tcg_rmode, tcg_rmode, cpu_env); |
105 | 85 | + for (pass = 0; pass < (a->q ? 4 : 2); pass++) { | |
106 | - /* Get IOMMU misc attributes */ | 86 | + TCGv_i32 tmp = neon_load_reg(a->vm, pass); |
107 | - int (*get_attr)(IOMMUMemoryRegion *iommu, enum IOMMUMemoryRegionAttr, | 87 | + gen_helper_rints(tmp, tmp, fpst); |
108 | + /* Get IOMMU misc attributes. This is an optional method that | 88 | + neon_store_reg(a->vd, pass, tmp); |
109 | + * can be used to allow users of the IOMMU to get implementation-specific | 89 | + } |
110 | + * information. The IOMMU implements this method to handle calls | 90 | + gen_helper_set_neon_rmode(tcg_rmode, tcg_rmode, cpu_env); |
111 | + * by IOMMU users to memory_region_iommu_get_attr() by filling in | 91 | + tcg_temp_free_i32(tcg_rmode); |
112 | + * the arbitrary data pointer for any IOMMUMemoryRegionAttr values that | 92 | + tcg_temp_free_ptr(fpst); |
113 | + * the IOMMU supports. If the method is unimplemented then | 93 | + |
114 | + * memory_region_iommu_get_attr() will always return -EINVAL. | 94 | + return true; |
115 | + * | 95 | +} |
116 | + * @iommu: the IOMMUMemoryRegion | 96 | + |
117 | + * @attr: attribute being queried | 97 | +#define DO_VRINT(INSN, RMODE) \ |
118 | + * @data: memory to fill in with the attribute data | 98 | + static bool trans_##INSN(DisasContext *s, arg_2misc *a) \ |
119 | + * | 99 | + { \ |
120 | + * Returns 0 on success, or a negative errno; in particular | 100 | + return do_vrint(s, a, RMODE); \ |
121 | + * returns -EINVAL for unrecognized or unimplemented attribute types. | 101 | + } |
122 | + */ | 102 | + |
123 | + int (*get_attr)(IOMMUMemoryRegion *iommu, enum IOMMUMemoryRegionAttr attr, | 103 | +DO_VRINT(VRINTN, FPROUNDING_TIEEVEN) |
124 | void *data); | 104 | +DO_VRINT(VRINTA, FPROUNDING_TIEAWAY) |
125 | } IOMMUMemoryRegionClass; | 105 | +DO_VRINT(VRINTZ, FPROUNDING_ZERO) |
126 | 106 | +DO_VRINT(VRINTM, FPROUNDING_NEGINF) | |
127 | @@ -XXX,XX +XXX,XX @@ static inline void memory_region_init_reservation(MemoryRegion *mr, | 107 | +DO_VRINT(VRINTP, FPROUNDING_POSINF) |
128 | * An IOMMU region translates addresses and forwards accesses to a target | 108 | diff --git a/target/arm/translate.c b/target/arm/translate.c |
129 | * memory region. | 109 | index XXXXXXX..XXXXXXX 100644 |
130 | * | 110 | --- a/target/arm/translate.c |
131 | + * The IOMMU implementation must define a subclass of TYPE_IOMMU_MEMORY_REGION. | 111 | +++ b/target/arm/translate.c |
132 | + * @_iommu_mr should be a pointer to enough memory for an instance of | 112 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) |
133 | + * that subclass, @instance_size is the size of that subclass, and | 113 | case NEON_2RM_VCEQ0_F: |
134 | + * @mrtypename is its name. This function will initialize @_iommu_mr as an | 114 | case NEON_2RM_VCLE0_F: |
135 | + * instance of the subclass, and its methods will then be called to handle | 115 | case NEON_2RM_VCLT0_F: |
136 | + * accesses to the memory region. See the documentation of | 116 | + case NEON_2RM_VRINTN: |
137 | + * #IOMMUMemoryRegionClass for further details. | 117 | + case NEON_2RM_VRINTA: |
138 | + * | 118 | + case NEON_2RM_VRINTM: |
139 | * @_iommu_mr: the #IOMMUMemoryRegion to be initialized | 119 | + case NEON_2RM_VRINTP: |
140 | * @instance_size: the IOMMUMemoryRegion subclass instance size | 120 | + case NEON_2RM_VRINTZ: |
141 | * @mrtypename: the type name of the #IOMMUMemoryRegion | 121 | /* handled by decodetree */ |
142 | @@ -XXX,XX +XXX,XX @@ void memory_region_register_iommu_notifier(MemoryRegion *mr, | 122 | return 1; |
143 | * a notifier with the minimum page granularity returned by | 123 | case NEON_2RM_VTRN: |
144 | * mr->iommu_ops->get_page_size(). | 124 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) |
145 | * | 125 | } |
146 | + * Note: this is not related to record-and-replay functionality. | 126 | neon_store_reg(rm, pass, tmp2); |
147 | + * | 127 | break; |
148 | * @iommu_mr: the memory region to observe | 128 | - case NEON_2RM_VRINTN: |
149 | * @n: the notifier to which to replay iommu mappings | 129 | - case NEON_2RM_VRINTA: |
150 | */ | 130 | - case NEON_2RM_VRINTM: |
151 | @@ -XXX,XX +XXX,XX @@ void memory_region_iommu_replay(IOMMUMemoryRegion *iommu_mr, IOMMUNotifier *n); | 131 | - case NEON_2RM_VRINTP: |
152 | * memory_region_iommu_replay_all: replay existing IOMMU translations | 132 | - case NEON_2RM_VRINTZ: |
153 | * to all the notifiers registered. | 133 | - { |
154 | * | 134 | - TCGv_i32 tcg_rmode; |
155 | + * Note: this is not related to record-and-replay functionality. | 135 | - TCGv_ptr fpstatus = get_fpstatus_ptr(1); |
156 | + * | 136 | - int rmode; |
157 | * @iommu_mr: the memory region to observe | 137 | - |
158 | */ | 138 | - if (op == NEON_2RM_VRINTZ) { |
159 | void memory_region_iommu_replay_all(IOMMUMemoryRegion *iommu_mr); | 139 | - rmode = FPROUNDING_ZERO; |
160 | @@ -XXX,XX +XXX,XX @@ void memory_region_unregister_iommu_notifier(MemoryRegion *mr, | 140 | - } else { |
161 | * memory_region_iommu_get_attr: return an IOMMU attr if get_attr() is | 141 | - rmode = fp_decode_rm[((op & 0x6) >> 1) ^ 1]; |
162 | * defined on the IOMMU. | 142 | - } |
163 | * | 143 | - |
164 | - * Returns 0 if succeded, error code otherwise. | 144 | - tcg_rmode = tcg_const_i32(arm_rmode_to_sf(rmode)); |
165 | + * Returns 0 on success, or a negative errno otherwise. In particular, | 145 | - gen_helper_set_neon_rmode(tcg_rmode, tcg_rmode, |
166 | + * -EINVAL indicates that the IOMMU does not support the requested | 146 | - cpu_env); |
167 | + * attribute. | 147 | - gen_helper_rints(tmp, tmp, fpstatus); |
168 | * | 148 | - gen_helper_set_neon_rmode(tcg_rmode, tcg_rmode, |
169 | * @iommu_mr: the memory region | 149 | - cpu_env); |
170 | * @attr: the requested attribute | 150 | - tcg_temp_free_ptr(fpstatus); |
151 | - tcg_temp_free_i32(tcg_rmode); | ||
152 | - break; | ||
153 | - } | ||
154 | case NEON_2RM_VCVTAU: | ||
155 | case NEON_2RM_VCVTAS: | ||
156 | case NEON_2RM_VCVTNU: | ||
171 | -- | 157 | -- |
172 | 2.17.1 | 158 | 2.20.1 |
173 | 159 | ||
174 | 160 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | 1 | Convert the VCVT instructions in the 2-reg-misc grouping to | |
2 | decodetree. | ||
3 | |||
4 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
5 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
6 | Message-id: 20200616170844.13318-19-peter.maydell@linaro.org | ||
7 | --- | ||
8 | target/arm/neon-dp.decode | 9 +++++ | ||
9 | target/arm/translate-neon.inc.c | 70 +++++++++++++++++++++++++++++++++ | ||
10 | target/arm/translate.c | 70 ++++----------------------------- | ||
11 | 3 files changed, 87 insertions(+), 62 deletions(-) | ||
12 | |||
13 | diff --git a/target/arm/neon-dp.decode b/target/arm/neon-dp.decode | ||
14 | index XXXXXXX..XXXXXXX 100644 | ||
15 | --- a/target/arm/neon-dp.decode | ||
16 | +++ b/target/arm/neon-dp.decode | ||
17 | @@ -XXX,XX +XXX,XX @@ Vimm_1r 1111 001 . 1 . 000 ... .... cmode:4 0 . op:1 1 .... @1reg_imm | ||
18 | |||
19 | VRINTP 1111 001 11 . 11 .. 10 .... 0 1111 . . 0 .... @2misc | ||
20 | |||
21 | + VCVTAS 1111 001 11 . 11 .. 11 .... 0 0000 . . 0 .... @2misc | ||
22 | + VCVTAU 1111 001 11 . 11 .. 11 .... 0 0001 . . 0 .... @2misc | ||
23 | + VCVTNS 1111 001 11 . 11 .. 11 .... 0 0010 . . 0 .... @2misc | ||
24 | + VCVTNU 1111 001 11 . 11 .. 11 .... 0 0011 . . 0 .... @2misc | ||
25 | + VCVTPS 1111 001 11 . 11 .. 11 .... 0 0100 . . 0 .... @2misc | ||
26 | + VCVTPU 1111 001 11 . 11 .. 11 .... 0 0101 . . 0 .... @2misc | ||
27 | + VCVTMS 1111 001 11 . 11 .. 11 .... 0 0110 . . 0 .... @2misc | ||
28 | + VCVTMU 1111 001 11 . 11 .. 11 .... 0 0111 . . 0 .... @2misc | ||
29 | + | ||
30 | VRECPE 1111 001 11 . 11 .. 11 .... 0 1000 . . 0 .... @2misc | ||
31 | VRSQRTE 1111 001 11 . 11 .. 11 .... 0 1001 . . 0 .... @2misc | ||
32 | VRECPE_F 1111 001 11 . 11 .. 11 .... 0 1010 . . 0 .... @2misc | ||
33 | diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c | ||
34 | index XXXXXXX..XXXXXXX 100644 | ||
35 | --- a/target/arm/translate-neon.inc.c | ||
36 | +++ b/target/arm/translate-neon.inc.c | ||
37 | @@ -XXX,XX +XXX,XX @@ DO_VRINT(VRINTA, FPROUNDING_TIEAWAY) | ||
38 | DO_VRINT(VRINTZ, FPROUNDING_ZERO) | ||
39 | DO_VRINT(VRINTM, FPROUNDING_NEGINF) | ||
40 | DO_VRINT(VRINTP, FPROUNDING_POSINF) | ||
41 | + | ||
42 | +static bool do_vcvt(DisasContext *s, arg_2misc *a, int rmode, bool is_signed) | ||
43 | +{ | ||
44 | + /* | ||
45 | + * Handle a VCVT* operation by iterating 32 bits at a time, | ||
46 | + * with a specified rounding mode in operation. | ||
47 | + */ | ||
48 | + int pass; | ||
49 | + TCGv_ptr fpst; | ||
50 | + TCGv_i32 tcg_rmode, tcg_shift; | ||
51 | + | ||
52 | + if (!arm_dc_feature(s, ARM_FEATURE_NEON) || | ||
53 | + !arm_dc_feature(s, ARM_FEATURE_V8)) { | ||
54 | + return false; | ||
55 | + } | ||
56 | + | ||
57 | + /* UNDEF accesses to D16-D31 if they don't exist. */ | ||
58 | + if (!dc_isar_feature(aa32_simd_r32, s) && | ||
59 | + ((a->vd | a->vm) & 0x10)) { | ||
60 | + return false; | ||
61 | + } | ||
62 | + | ||
63 | + if (a->size != 2) { | ||
64 | + /* TODO: FP16 will be the size == 1 case */ | ||
65 | + return false; | ||
66 | + } | ||
67 | + | ||
68 | + if ((a->vd | a->vm) & a->q) { | ||
69 | + return false; | ||
70 | + } | ||
71 | + | ||
72 | + if (!vfp_access_check(s)) { | ||
73 | + return true; | ||
74 | + } | ||
75 | + | ||
76 | + fpst = get_fpstatus_ptr(1); | ||
77 | + tcg_shift = tcg_const_i32(0); | ||
78 | + tcg_rmode = tcg_const_i32(arm_rmode_to_sf(rmode)); | ||
79 | + gen_helper_set_neon_rmode(tcg_rmode, tcg_rmode, cpu_env); | ||
80 | + for (pass = 0; pass < (a->q ? 4 : 2); pass++) { | ||
81 | + TCGv_i32 tmp = neon_load_reg(a->vm, pass); | ||
82 | + if (is_signed) { | ||
83 | + gen_helper_vfp_tosls(tmp, tmp, tcg_shift, fpst); | ||
84 | + } else { | ||
85 | + gen_helper_vfp_touls(tmp, tmp, tcg_shift, fpst); | ||
86 | + } | ||
87 | + neon_store_reg(a->vd, pass, tmp); | ||
88 | + } | ||
89 | + gen_helper_set_neon_rmode(tcg_rmode, tcg_rmode, cpu_env); | ||
90 | + tcg_temp_free_i32(tcg_rmode); | ||
91 | + tcg_temp_free_i32(tcg_shift); | ||
92 | + tcg_temp_free_ptr(fpst); | ||
93 | + | ||
94 | + return true; | ||
95 | +} | ||
96 | + | ||
97 | +#define DO_VCVT(INSN, RMODE, SIGNED) \ | ||
98 | + static bool trans_##INSN(DisasContext *s, arg_2misc *a) \ | ||
99 | + { \ | ||
100 | + return do_vcvt(s, a, RMODE, SIGNED); \ | ||
101 | + } | ||
102 | + | ||
103 | +DO_VCVT(VCVTAU, FPROUNDING_TIEAWAY, false) | ||
104 | +DO_VCVT(VCVTAS, FPROUNDING_TIEAWAY, true) | ||
105 | +DO_VCVT(VCVTNU, FPROUNDING_TIEEVEN, false) | ||
106 | +DO_VCVT(VCVTNS, FPROUNDING_TIEEVEN, true) | ||
107 | +DO_VCVT(VCVTPU, FPROUNDING_POSINF, false) | ||
108 | +DO_VCVT(VCVTPS, FPROUNDING_POSINF, true) | ||
109 | +DO_VCVT(VCVTMU, FPROUNDING_NEGINF, false) | ||
110 | +DO_VCVT(VCVTMS, FPROUNDING_NEGINF, true) | ||
111 | diff --git a/target/arm/translate.c b/target/arm/translate.c | ||
112 | index XXXXXXX..XXXXXXX 100644 | ||
113 | --- a/target/arm/translate.c | ||
114 | +++ b/target/arm/translate.c | ||
115 | @@ -XXX,XX +XXX,XX @@ static void gen_neon_trn_u16(TCGv_i32 t0, TCGv_i32 t1) | ||
116 | #define NEON_2RM_VCVT_SF 62 | ||
117 | #define NEON_2RM_VCVT_UF 63 | ||
118 | |||
119 | -static bool neon_2rm_is_v8_op(int op) | ||
120 | -{ | ||
121 | - /* Return true if this neon 2reg-misc op is ARMv8 and up */ | ||
122 | - switch (op) { | ||
123 | - case NEON_2RM_VRINTN: | ||
124 | - case NEON_2RM_VRINTA: | ||
125 | - case NEON_2RM_VRINTM: | ||
126 | - case NEON_2RM_VRINTP: | ||
127 | - case NEON_2RM_VRINTZ: | ||
128 | - case NEON_2RM_VRINTX: | ||
129 | - case NEON_2RM_VCVTAU: | ||
130 | - case NEON_2RM_VCVTAS: | ||
131 | - case NEON_2RM_VCVTNU: | ||
132 | - case NEON_2RM_VCVTNS: | ||
133 | - case NEON_2RM_VCVTPU: | ||
134 | - case NEON_2RM_VCVTPS: | ||
135 | - case NEON_2RM_VCVTMU: | ||
136 | - case NEON_2RM_VCVTMS: | ||
137 | - return true; | ||
138 | - default: | ||
139 | - return false; | ||
140 | - } | ||
141 | -} | ||
142 | - | ||
143 | /* Each entry in this array has bit n set if the insn allows | ||
144 | * size value n (otherwise it will UNDEF). Since unallocated | ||
145 | * op values will have no bits set they always UNDEF. | ||
146 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) | ||
147 | if ((neon_2rm_sizes[op] & (1 << size)) == 0) { | ||
148 | return 1; | ||
149 | } | ||
150 | - if (neon_2rm_is_v8_op(op) && | ||
151 | - !arm_dc_feature(s, ARM_FEATURE_V8)) { | ||
152 | - return 1; | ||
153 | - } | ||
154 | if (q && ((rm | rd) & 1)) { | ||
155 | return 1; | ||
156 | } | ||
157 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) | ||
158 | case NEON_2RM_VRINTM: | ||
159 | case NEON_2RM_VRINTP: | ||
160 | case NEON_2RM_VRINTZ: | ||
161 | + case NEON_2RM_VCVTAU: | ||
162 | + case NEON_2RM_VCVTAS: | ||
163 | + case NEON_2RM_VCVTNU: | ||
164 | + case NEON_2RM_VCVTNS: | ||
165 | + case NEON_2RM_VCVTPU: | ||
166 | + case NEON_2RM_VCVTPS: | ||
167 | + case NEON_2RM_VCVTMU: | ||
168 | + case NEON_2RM_VCVTMS: | ||
169 | /* handled by decodetree */ | ||
170 | return 1; | ||
171 | case NEON_2RM_VTRN: | ||
172 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) | ||
173 | } | ||
174 | neon_store_reg(rm, pass, tmp2); | ||
175 | break; | ||
176 | - case NEON_2RM_VCVTAU: | ||
177 | - case NEON_2RM_VCVTAS: | ||
178 | - case NEON_2RM_VCVTNU: | ||
179 | - case NEON_2RM_VCVTNS: | ||
180 | - case NEON_2RM_VCVTPU: | ||
181 | - case NEON_2RM_VCVTPS: | ||
182 | - case NEON_2RM_VCVTMU: | ||
183 | - case NEON_2RM_VCVTMS: | ||
184 | - { | ||
185 | - bool is_signed = !extract32(insn, 7, 1); | ||
186 | - TCGv_ptr fpst = get_fpstatus_ptr(1); | ||
187 | - TCGv_i32 tcg_rmode, tcg_shift; | ||
188 | - int rmode = fp_decode_rm[extract32(insn, 8, 2)]; | ||
189 | - | ||
190 | - tcg_shift = tcg_const_i32(0); | ||
191 | - tcg_rmode = tcg_const_i32(arm_rmode_to_sf(rmode)); | ||
192 | - gen_helper_set_neon_rmode(tcg_rmode, tcg_rmode, | ||
193 | - cpu_env); | ||
194 | - | ||
195 | - if (is_signed) { | ||
196 | - gen_helper_vfp_tosls(tmp, tmp, | ||
197 | - tcg_shift, fpst); | ||
198 | - } else { | ||
199 | - gen_helper_vfp_touls(tmp, tmp, | ||
200 | - tcg_shift, fpst); | ||
201 | - } | ||
202 | - | ||
203 | - gen_helper_set_neon_rmode(tcg_rmode, tcg_rmode, | ||
204 | - cpu_env); | ||
205 | - tcg_temp_free_i32(tcg_rmode); | ||
206 | - tcg_temp_free_i32(tcg_shift); | ||
207 | - tcg_temp_free_ptr(fpst); | ||
208 | - break; | ||
209 | - } | ||
210 | default: | ||
211 | /* Reserved op values were caught by the | ||
212 | * neon_2rm_sizes[] check earlier. | ||
213 | -- | ||
214 | 2.20.1 | ||
215 | |||
216 | diff view generated by jsdifflib |
1 | The FRECPX instructions should (like most other floating point operations) | 1 | Convert the Neon VSWP insn to decodetree. Since the new implementation |
---|---|---|---|
2 | honour the FPCR.FZ bit which specifies whether input denormals should | 2 | doesn't have to share a pass-loop with the other 2-reg-misc operations |
3 | be flushed to zero (or FZ16 for the half-precision version). | 3 | we can implement the swap with 64-bit accesses rather than 32-bits |
4 | We forgot to implement this, which doesn't affect the results (since | 4 | (which brings us into line with the pseudocode and is more efficient). |
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 | 5 | ||
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
9 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 7 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
10 | Message-id: 20180521172712.19930-1-peter.maydell@linaro.org | 8 | Message-id: 20200616170844.13318-20-peter.maydell@linaro.org |
11 | --- | 9 | --- |
12 | target/arm/helper-a64.c | 6 ++++++ | 10 | target/arm/neon-dp.decode | 2 ++ |
13 | 1 file changed, 6 insertions(+) | 11 | target/arm/translate-neon.inc.c | 41 +++++++++++++++++++++++++++++++++ |
12 | target/arm/translate.c | 5 +--- | ||
13 | 3 files changed, 44 insertions(+), 4 deletions(-) | ||
14 | 14 | ||
15 | diff --git a/target/arm/helper-a64.c b/target/arm/helper-a64.c | 15 | diff --git a/target/arm/neon-dp.decode b/target/arm/neon-dp.decode |
16 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
17 | --- a/target/arm/helper-a64.c | 17 | --- a/target/arm/neon-dp.decode |
18 | +++ b/target/arm/helper-a64.c | 18 | +++ b/target/arm/neon-dp.decode |
19 | @@ -XXX,XX +XXX,XX @@ float16 HELPER(frecpx_f16)(float16 a, void *fpstp) | 19 | @@ -XXX,XX +XXX,XX @@ Vimm_1r 1111 001 . 1 . 000 ... .... cmode:4 0 . op:1 1 .... @1reg_imm |
20 | return nan; | 20 | VABS_F 1111 001 11 . 11 .. 01 .... 0 1110 . . 0 .... @2misc |
21 | } | 21 | VNEG_F 1111 001 11 . 11 .. 01 .... 0 1111 . . 0 .... @2misc |
22 | 22 | ||
23 | + a = float16_squash_input_denormal(a, fpst); | 23 | + VSWP 1111 001 11 . 11 .. 10 .... 0 0000 . . 0 .... @2misc |
24 | + | 24 | + |
25 | val16 = float16_val(a); | 25 | VUZP 1111 001 11 . 11 .. 10 .... 0 0010 . . 0 .... @2misc |
26 | sbit = 0x8000 & val16; | 26 | VZIP 1111 001 11 . 11 .. 10 .... 0 0011 . . 0 .... @2misc |
27 | exp = extract32(val16, 10, 5); | 27 | |
28 | @@ -XXX,XX +XXX,XX @@ float32 HELPER(frecpx_f32)(float32 a, void *fpstp) | 28 | diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c |
29 | return nan; | 29 | index XXXXXXX..XXXXXXX 100644 |
30 | } | 30 | --- a/target/arm/translate-neon.inc.c |
31 | 31 | +++ b/target/arm/translate-neon.inc.c | |
32 | + a = float32_squash_input_denormal(a, fpst); | 32 | @@ -XXX,XX +XXX,XX @@ DO_VCVT(VCVTPU, FPROUNDING_POSINF, false) |
33 | DO_VCVT(VCVTPS, FPROUNDING_POSINF, true) | ||
34 | DO_VCVT(VCVTMU, FPROUNDING_NEGINF, false) | ||
35 | DO_VCVT(VCVTMS, FPROUNDING_NEGINF, true) | ||
33 | + | 36 | + |
34 | val32 = float32_val(a); | 37 | +static bool trans_VSWP(DisasContext *s, arg_2misc *a) |
35 | sbit = 0x80000000ULL & val32; | 38 | +{ |
36 | exp = extract32(val32, 23, 8); | 39 | + TCGv_i64 rm, rd; |
37 | @@ -XXX,XX +XXX,XX @@ float64 HELPER(frecpx_f64)(float64 a, void *fpstp) | 40 | + int pass; |
38 | return nan; | ||
39 | } | ||
40 | |||
41 | + a = float64_squash_input_denormal(a, fpst); | ||
42 | + | 41 | + |
43 | val64 = float64_val(a); | 42 | + if (!arm_dc_feature(s, ARM_FEATURE_NEON)) { |
44 | sbit = 0x8000000000000000ULL & val64; | 43 | + return false; |
45 | exp = extract64(float64_val(a), 52, 11); | 44 | + } |
45 | + | ||
46 | + /* UNDEF accesses to D16-D31 if they don't exist. */ | ||
47 | + if (!dc_isar_feature(aa32_simd_r32, s) && | ||
48 | + ((a->vd | a->vm) & 0x10)) { | ||
49 | + return false; | ||
50 | + } | ||
51 | + | ||
52 | + if (a->size != 0) { | ||
53 | + return false; | ||
54 | + } | ||
55 | + | ||
56 | + if ((a->vd | a->vm) & a->q) { | ||
57 | + return false; | ||
58 | + } | ||
59 | + | ||
60 | + if (!vfp_access_check(s)) { | ||
61 | + return true; | ||
62 | + } | ||
63 | + | ||
64 | + rm = tcg_temp_new_i64(); | ||
65 | + rd = tcg_temp_new_i64(); | ||
66 | + for (pass = 0; pass < (a->q ? 2 : 1); pass++) { | ||
67 | + neon_load_reg64(rm, a->vm + pass); | ||
68 | + neon_load_reg64(rd, a->vd + pass); | ||
69 | + neon_store_reg64(rm, a->vd + pass); | ||
70 | + neon_store_reg64(rd, a->vm + pass); | ||
71 | + } | ||
72 | + tcg_temp_free_i64(rm); | ||
73 | + tcg_temp_free_i64(rd); | ||
74 | + | ||
75 | + return true; | ||
76 | +} | ||
77 | diff --git a/target/arm/translate.c b/target/arm/translate.c | ||
78 | index XXXXXXX..XXXXXXX 100644 | ||
79 | --- a/target/arm/translate.c | ||
80 | +++ b/target/arm/translate.c | ||
81 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) | ||
82 | case NEON_2RM_VCVTPS: | ||
83 | case NEON_2RM_VCVTMU: | ||
84 | case NEON_2RM_VCVTMS: | ||
85 | + case NEON_2RM_VSWP: | ||
86 | /* handled by decodetree */ | ||
87 | return 1; | ||
88 | case NEON_2RM_VTRN: | ||
89 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) | ||
90 | for (pass = 0; pass < (q ? 4 : 2); pass++) { | ||
91 | tmp = neon_load_reg(rm, pass); | ||
92 | switch (op) { | ||
93 | - case NEON_2RM_VSWP: | ||
94 | - tmp2 = neon_load_reg(rd, pass); | ||
95 | - neon_store_reg(rm, pass, tmp2); | ||
96 | - break; | ||
97 | case NEON_2RM_VTRN: | ||
98 | tmp2 = neon_load_reg(rd, pass); | ||
99 | switch (size) { | ||
46 | -- | 100 | -- |
47 | 2.17.1 | 101 | 2.20.1 |
48 | 102 | ||
49 | 103 | diff view generated by jsdifflib |
1 | As part of plumbing MemTxAttrs down to the IOMMU translate method, | 1 | Convert the Neon VTRN insn to decodetree. This is the last insn in the |
---|---|---|---|
2 | add MemTxAttrs as an argument to flatview_access_valid(). | 2 | Neon data-processing group, so we can remove all the now-unused old |
3 | Its callers now all have an attrs value to hand, so we can | 3 | decoder framework. |
4 | correct our earlier temporary use of MEMTXATTRS_UNSPECIFIED. | 4 | |
5 | It's possible that there's a more efficient implementation of | ||
6 | VTRN, but for this conversion we just copy the existing approach. | ||
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-10-peter.maydell@linaro.org | 10 | Message-id: 20200616170844.13318-21-peter.maydell@linaro.org |
10 | --- | 11 | --- |
11 | exec.c | 12 +++++------- | 12 | target/arm/neon-dp.decode | 2 +- |
12 | 1 file changed, 5 insertions(+), 7 deletions(-) | 13 | target/arm/translate-neon.inc.c | 90 ++++++++ |
14 | target/arm/translate.c | 363 +------------------------------- | ||
15 | 3 files changed, 93 insertions(+), 362 deletions(-) | ||
13 | 16 | ||
14 | diff --git a/exec.c b/exec.c | 17 | diff --git a/target/arm/neon-dp.decode b/target/arm/neon-dp.decode |
15 | index XXXXXXX..XXXXXXX 100644 | 18 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/exec.c | 19 | --- a/target/arm/neon-dp.decode |
17 | +++ b/exec.c | 20 | +++ b/target/arm/neon-dp.decode |
18 | @@ -XXX,XX +XXX,XX @@ static MemTxResult flatview_read(FlatView *fv, hwaddr addr, | 21 | @@ -XXX,XX +XXX,XX @@ Vimm_1r 1111 001 . 1 . 000 ... .... cmode:4 0 . op:1 1 .... @1reg_imm |
19 | static MemTxResult flatview_write(FlatView *fv, hwaddr addr, MemTxAttrs attrs, | 22 | VNEG_F 1111 001 11 . 11 .. 01 .... 0 1111 . . 0 .... @2misc |
20 | const uint8_t *buf, int len); | 23 | |
21 | static bool flatview_access_valid(FlatView *fv, hwaddr addr, int len, | 24 | VSWP 1111 001 11 . 11 .. 10 .... 0 0000 . . 0 .... @2misc |
22 | - bool is_write); | 25 | - |
23 | + bool is_write, MemTxAttrs attrs); | 26 | + VTRN 1111 001 11 . 11 .. 10 .... 0 0001 . . 0 .... @2misc |
24 | 27 | VUZP 1111 001 11 . 11 .. 10 .... 0 0010 . . 0 .... @2misc | |
25 | static MemTxResult subpage_read(void *opaque, hwaddr addr, uint64_t *data, | 28 | VZIP 1111 001 11 . 11 .. 10 .... 0 0011 . . 0 .... @2misc |
26 | unsigned len, MemTxAttrs attrs) | 29 | |
27 | @@ -XXX,XX +XXX,XX @@ static bool subpage_accepts(void *opaque, hwaddr addr, | 30 | diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c |
28 | #endif | 31 | index XXXXXXX..XXXXXXX 100644 |
29 | 32 | --- a/target/arm/translate-neon.inc.c | |
30 | return flatview_access_valid(subpage->fv, addr + subpage->base, | 33 | +++ b/target/arm/translate-neon.inc.c |
31 | - len, is_write); | 34 | @@ -XXX,XX +XXX,XX @@ static bool trans_VSWP(DisasContext *s, arg_2misc *a) |
32 | + len, is_write, attrs); | 35 | |
36 | return true; | ||
33 | } | 37 | } |
34 | 38 | +static void gen_neon_trn_u8(TCGv_i32 t0, TCGv_i32 t1) | |
35 | static const MemoryRegionOps subpage_ops = { | 39 | +{ |
36 | @@ -XXX,XX +XXX,XX @@ static void cpu_notify_map_clients(void) | 40 | + TCGv_i32 rd, tmp; |
41 | + | ||
42 | + rd = tcg_temp_new_i32(); | ||
43 | + tmp = tcg_temp_new_i32(); | ||
44 | + | ||
45 | + tcg_gen_shli_i32(rd, t0, 8); | ||
46 | + tcg_gen_andi_i32(rd, rd, 0xff00ff00); | ||
47 | + tcg_gen_andi_i32(tmp, t1, 0x00ff00ff); | ||
48 | + tcg_gen_or_i32(rd, rd, tmp); | ||
49 | + | ||
50 | + tcg_gen_shri_i32(t1, t1, 8); | ||
51 | + tcg_gen_andi_i32(t1, t1, 0x00ff00ff); | ||
52 | + tcg_gen_andi_i32(tmp, t0, 0xff00ff00); | ||
53 | + tcg_gen_or_i32(t1, t1, tmp); | ||
54 | + tcg_gen_mov_i32(t0, rd); | ||
55 | + | ||
56 | + tcg_temp_free_i32(tmp); | ||
57 | + tcg_temp_free_i32(rd); | ||
58 | +} | ||
59 | + | ||
60 | +static void gen_neon_trn_u16(TCGv_i32 t0, TCGv_i32 t1) | ||
61 | +{ | ||
62 | + TCGv_i32 rd, tmp; | ||
63 | + | ||
64 | + rd = tcg_temp_new_i32(); | ||
65 | + tmp = tcg_temp_new_i32(); | ||
66 | + | ||
67 | + tcg_gen_shli_i32(rd, t0, 16); | ||
68 | + tcg_gen_andi_i32(tmp, t1, 0xffff); | ||
69 | + tcg_gen_or_i32(rd, rd, tmp); | ||
70 | + tcg_gen_shri_i32(t1, t1, 16); | ||
71 | + tcg_gen_andi_i32(tmp, t0, 0xffff0000); | ||
72 | + tcg_gen_or_i32(t1, t1, tmp); | ||
73 | + tcg_gen_mov_i32(t0, rd); | ||
74 | + | ||
75 | + tcg_temp_free_i32(tmp); | ||
76 | + tcg_temp_free_i32(rd); | ||
77 | +} | ||
78 | + | ||
79 | +static bool trans_VTRN(DisasContext *s, arg_2misc *a) | ||
80 | +{ | ||
81 | + TCGv_i32 tmp, tmp2; | ||
82 | + int pass; | ||
83 | + | ||
84 | + if (!arm_dc_feature(s, ARM_FEATURE_NEON)) { | ||
85 | + return false; | ||
86 | + } | ||
87 | + | ||
88 | + /* UNDEF accesses to D16-D31 if they don't exist. */ | ||
89 | + if (!dc_isar_feature(aa32_simd_r32, s) && | ||
90 | + ((a->vd | a->vm) & 0x10)) { | ||
91 | + return false; | ||
92 | + } | ||
93 | + | ||
94 | + if ((a->vd | a->vm) & a->q) { | ||
95 | + return false; | ||
96 | + } | ||
97 | + | ||
98 | + if (a->size == 3) { | ||
99 | + return false; | ||
100 | + } | ||
101 | + | ||
102 | + if (!vfp_access_check(s)) { | ||
103 | + return true; | ||
104 | + } | ||
105 | + | ||
106 | + if (a->size == 2) { | ||
107 | + for (pass = 0; pass < (a->q ? 4 : 2); pass += 2) { | ||
108 | + tmp = neon_load_reg(a->vm, pass); | ||
109 | + tmp2 = neon_load_reg(a->vd, pass + 1); | ||
110 | + neon_store_reg(a->vm, pass, tmp2); | ||
111 | + neon_store_reg(a->vd, pass + 1, tmp); | ||
112 | + } | ||
113 | + } else { | ||
114 | + for (pass = 0; pass < (a->q ? 4 : 2); pass++) { | ||
115 | + tmp = neon_load_reg(a->vm, pass); | ||
116 | + tmp2 = neon_load_reg(a->vd, pass); | ||
117 | + if (a->size == 0) { | ||
118 | + gen_neon_trn_u8(tmp, tmp2); | ||
119 | + } else { | ||
120 | + gen_neon_trn_u16(tmp, tmp2); | ||
121 | + } | ||
122 | + neon_store_reg(a->vm, pass, tmp2); | ||
123 | + neon_store_reg(a->vd, pass, tmp); | ||
124 | + } | ||
125 | + } | ||
126 | + return true; | ||
127 | +} | ||
128 | diff --git a/target/arm/translate.c b/target/arm/translate.c | ||
129 | index XXXXXXX..XXXXXXX 100644 | ||
130 | --- a/target/arm/translate.c | ||
131 | +++ b/target/arm/translate.c | ||
132 | @@ -XXX,XX +XXX,XX @@ static void gen_exception_return(DisasContext *s, TCGv_i32 pc) | ||
133 | gen_rfe(s, pc, load_cpu_field(spsr)); | ||
37 | } | 134 | } |
38 | 135 | ||
39 | static bool flatview_access_valid(FlatView *fv, hwaddr addr, int len, | 136 | -static void gen_neon_trn_u8(TCGv_i32 t0, TCGv_i32 t1) |
40 | - bool is_write) | 137 | -{ |
41 | + bool is_write, MemTxAttrs attrs) | 138 | - TCGv_i32 rd, tmp; |
139 | - | ||
140 | - rd = tcg_temp_new_i32(); | ||
141 | - tmp = tcg_temp_new_i32(); | ||
142 | - | ||
143 | - tcg_gen_shli_i32(rd, t0, 8); | ||
144 | - tcg_gen_andi_i32(rd, rd, 0xff00ff00); | ||
145 | - tcg_gen_andi_i32(tmp, t1, 0x00ff00ff); | ||
146 | - tcg_gen_or_i32(rd, rd, tmp); | ||
147 | - | ||
148 | - tcg_gen_shri_i32(t1, t1, 8); | ||
149 | - tcg_gen_andi_i32(t1, t1, 0x00ff00ff); | ||
150 | - tcg_gen_andi_i32(tmp, t0, 0xff00ff00); | ||
151 | - tcg_gen_or_i32(t1, t1, tmp); | ||
152 | - tcg_gen_mov_i32(t0, rd); | ||
153 | - | ||
154 | - tcg_temp_free_i32(tmp); | ||
155 | - tcg_temp_free_i32(rd); | ||
156 | -} | ||
157 | - | ||
158 | -static void gen_neon_trn_u16(TCGv_i32 t0, TCGv_i32 t1) | ||
159 | -{ | ||
160 | - TCGv_i32 rd, tmp; | ||
161 | - | ||
162 | - rd = tcg_temp_new_i32(); | ||
163 | - tmp = tcg_temp_new_i32(); | ||
164 | - | ||
165 | - tcg_gen_shli_i32(rd, t0, 16); | ||
166 | - tcg_gen_andi_i32(tmp, t1, 0xffff); | ||
167 | - tcg_gen_or_i32(rd, rd, tmp); | ||
168 | - tcg_gen_shri_i32(t1, t1, 16); | ||
169 | - tcg_gen_andi_i32(tmp, t0, 0xffff0000); | ||
170 | - tcg_gen_or_i32(t1, t1, tmp); | ||
171 | - tcg_gen_mov_i32(t0, rd); | ||
172 | - | ||
173 | - tcg_temp_free_i32(tmp); | ||
174 | - tcg_temp_free_i32(rd); | ||
175 | -} | ||
176 | - | ||
177 | -/* Symbolic constants for op fields for Neon 2-register miscellaneous. | ||
178 | - * The values correspond to bits [17:16,10:7]; see the ARM ARM DDI0406B | ||
179 | - * table A7-13. | ||
180 | - */ | ||
181 | -#define NEON_2RM_VREV64 0 | ||
182 | -#define NEON_2RM_VREV32 1 | ||
183 | -#define NEON_2RM_VREV16 2 | ||
184 | -#define NEON_2RM_VPADDL 4 | ||
185 | -#define NEON_2RM_VPADDL_U 5 | ||
186 | -#define NEON_2RM_AESE 6 /* Includes AESD */ | ||
187 | -#define NEON_2RM_AESMC 7 /* Includes AESIMC */ | ||
188 | -#define NEON_2RM_VCLS 8 | ||
189 | -#define NEON_2RM_VCLZ 9 | ||
190 | -#define NEON_2RM_VCNT 10 | ||
191 | -#define NEON_2RM_VMVN 11 | ||
192 | -#define NEON_2RM_VPADAL 12 | ||
193 | -#define NEON_2RM_VPADAL_U 13 | ||
194 | -#define NEON_2RM_VQABS 14 | ||
195 | -#define NEON_2RM_VQNEG 15 | ||
196 | -#define NEON_2RM_VCGT0 16 | ||
197 | -#define NEON_2RM_VCGE0 17 | ||
198 | -#define NEON_2RM_VCEQ0 18 | ||
199 | -#define NEON_2RM_VCLE0 19 | ||
200 | -#define NEON_2RM_VCLT0 20 | ||
201 | -#define NEON_2RM_SHA1H 21 | ||
202 | -#define NEON_2RM_VABS 22 | ||
203 | -#define NEON_2RM_VNEG 23 | ||
204 | -#define NEON_2RM_VCGT0_F 24 | ||
205 | -#define NEON_2RM_VCGE0_F 25 | ||
206 | -#define NEON_2RM_VCEQ0_F 26 | ||
207 | -#define NEON_2RM_VCLE0_F 27 | ||
208 | -#define NEON_2RM_VCLT0_F 28 | ||
209 | -#define NEON_2RM_VABS_F 30 | ||
210 | -#define NEON_2RM_VNEG_F 31 | ||
211 | -#define NEON_2RM_VSWP 32 | ||
212 | -#define NEON_2RM_VTRN 33 | ||
213 | -#define NEON_2RM_VUZP 34 | ||
214 | -#define NEON_2RM_VZIP 35 | ||
215 | -#define NEON_2RM_VMOVN 36 /* Includes VQMOVN, VQMOVUN */ | ||
216 | -#define NEON_2RM_VQMOVN 37 /* Includes VQMOVUN */ | ||
217 | -#define NEON_2RM_VSHLL 38 | ||
218 | -#define NEON_2RM_SHA1SU1 39 /* Includes SHA256SU0 */ | ||
219 | -#define NEON_2RM_VRINTN 40 | ||
220 | -#define NEON_2RM_VRINTX 41 | ||
221 | -#define NEON_2RM_VRINTA 42 | ||
222 | -#define NEON_2RM_VRINTZ 43 | ||
223 | -#define NEON_2RM_VCVT_F16_F32 44 | ||
224 | -#define NEON_2RM_VRINTM 45 | ||
225 | -#define NEON_2RM_VCVT_F32_F16 46 | ||
226 | -#define NEON_2RM_VRINTP 47 | ||
227 | -#define NEON_2RM_VCVTAU 48 | ||
228 | -#define NEON_2RM_VCVTAS 49 | ||
229 | -#define NEON_2RM_VCVTNU 50 | ||
230 | -#define NEON_2RM_VCVTNS 51 | ||
231 | -#define NEON_2RM_VCVTPU 52 | ||
232 | -#define NEON_2RM_VCVTPS 53 | ||
233 | -#define NEON_2RM_VCVTMU 54 | ||
234 | -#define NEON_2RM_VCVTMS 55 | ||
235 | -#define NEON_2RM_VRECPE 56 | ||
236 | -#define NEON_2RM_VRSQRTE 57 | ||
237 | -#define NEON_2RM_VRECPE_F 58 | ||
238 | -#define NEON_2RM_VRSQRTE_F 59 | ||
239 | -#define NEON_2RM_VCVT_FS 60 | ||
240 | -#define NEON_2RM_VCVT_FU 61 | ||
241 | -#define NEON_2RM_VCVT_SF 62 | ||
242 | -#define NEON_2RM_VCVT_UF 63 | ||
243 | - | ||
244 | -/* Each entry in this array has bit n set if the insn allows | ||
245 | - * size value n (otherwise it will UNDEF). Since unallocated | ||
246 | - * op values will have no bits set they always UNDEF. | ||
247 | - */ | ||
248 | -static const uint8_t neon_2rm_sizes[] = { | ||
249 | - [NEON_2RM_VREV64] = 0x7, | ||
250 | - [NEON_2RM_VREV32] = 0x3, | ||
251 | - [NEON_2RM_VREV16] = 0x1, | ||
252 | - [NEON_2RM_VPADDL] = 0x7, | ||
253 | - [NEON_2RM_VPADDL_U] = 0x7, | ||
254 | - [NEON_2RM_AESE] = 0x1, | ||
255 | - [NEON_2RM_AESMC] = 0x1, | ||
256 | - [NEON_2RM_VCLS] = 0x7, | ||
257 | - [NEON_2RM_VCLZ] = 0x7, | ||
258 | - [NEON_2RM_VCNT] = 0x1, | ||
259 | - [NEON_2RM_VMVN] = 0x1, | ||
260 | - [NEON_2RM_VPADAL] = 0x7, | ||
261 | - [NEON_2RM_VPADAL_U] = 0x7, | ||
262 | - [NEON_2RM_VQABS] = 0x7, | ||
263 | - [NEON_2RM_VQNEG] = 0x7, | ||
264 | - [NEON_2RM_VCGT0] = 0x7, | ||
265 | - [NEON_2RM_VCGE0] = 0x7, | ||
266 | - [NEON_2RM_VCEQ0] = 0x7, | ||
267 | - [NEON_2RM_VCLE0] = 0x7, | ||
268 | - [NEON_2RM_VCLT0] = 0x7, | ||
269 | - [NEON_2RM_SHA1H] = 0x4, | ||
270 | - [NEON_2RM_VABS] = 0x7, | ||
271 | - [NEON_2RM_VNEG] = 0x7, | ||
272 | - [NEON_2RM_VCGT0_F] = 0x4, | ||
273 | - [NEON_2RM_VCGE0_F] = 0x4, | ||
274 | - [NEON_2RM_VCEQ0_F] = 0x4, | ||
275 | - [NEON_2RM_VCLE0_F] = 0x4, | ||
276 | - [NEON_2RM_VCLT0_F] = 0x4, | ||
277 | - [NEON_2RM_VABS_F] = 0x4, | ||
278 | - [NEON_2RM_VNEG_F] = 0x4, | ||
279 | - [NEON_2RM_VSWP] = 0x1, | ||
280 | - [NEON_2RM_VTRN] = 0x7, | ||
281 | - [NEON_2RM_VUZP] = 0x7, | ||
282 | - [NEON_2RM_VZIP] = 0x7, | ||
283 | - [NEON_2RM_VMOVN] = 0x7, | ||
284 | - [NEON_2RM_VQMOVN] = 0x7, | ||
285 | - [NEON_2RM_VSHLL] = 0x7, | ||
286 | - [NEON_2RM_SHA1SU1] = 0x4, | ||
287 | - [NEON_2RM_VRINTN] = 0x4, | ||
288 | - [NEON_2RM_VRINTX] = 0x4, | ||
289 | - [NEON_2RM_VRINTA] = 0x4, | ||
290 | - [NEON_2RM_VRINTZ] = 0x4, | ||
291 | - [NEON_2RM_VCVT_F16_F32] = 0x2, | ||
292 | - [NEON_2RM_VRINTM] = 0x4, | ||
293 | - [NEON_2RM_VCVT_F32_F16] = 0x2, | ||
294 | - [NEON_2RM_VRINTP] = 0x4, | ||
295 | - [NEON_2RM_VCVTAU] = 0x4, | ||
296 | - [NEON_2RM_VCVTAS] = 0x4, | ||
297 | - [NEON_2RM_VCVTNU] = 0x4, | ||
298 | - [NEON_2RM_VCVTNS] = 0x4, | ||
299 | - [NEON_2RM_VCVTPU] = 0x4, | ||
300 | - [NEON_2RM_VCVTPS] = 0x4, | ||
301 | - [NEON_2RM_VCVTMU] = 0x4, | ||
302 | - [NEON_2RM_VCVTMS] = 0x4, | ||
303 | - [NEON_2RM_VRECPE] = 0x4, | ||
304 | - [NEON_2RM_VRSQRTE] = 0x4, | ||
305 | - [NEON_2RM_VRECPE_F] = 0x4, | ||
306 | - [NEON_2RM_VRSQRTE_F] = 0x4, | ||
307 | - [NEON_2RM_VCVT_FS] = 0x4, | ||
308 | - [NEON_2RM_VCVT_FU] = 0x4, | ||
309 | - [NEON_2RM_VCVT_SF] = 0x4, | ||
310 | - [NEON_2RM_VCVT_UF] = 0x4, | ||
311 | -}; | ||
312 | - | ||
313 | static void gen_gvec_fn3_qc(uint32_t rd_ofs, uint32_t rn_ofs, uint32_t rm_ofs, | ||
314 | uint32_t opr_sz, uint32_t max_sz, | ||
315 | gen_helper_gvec_3_ptr *fn) | ||
316 | @@ -XXX,XX +XXX,XX @@ void gen_gvec_uaba(unsigned vece, uint32_t rd_ofs, uint32_t rn_ofs, | ||
317 | tcg_gen_gvec_3(rd_ofs, rn_ofs, rm_ofs, opr_sz, max_sz, &ops[vece]); | ||
318 | } | ||
319 | |||
320 | -/* Translate a NEON data processing instruction. Return nonzero if the | ||
321 | - instruction is invalid. | ||
322 | - We process data in a mixture of 32-bit and 64-bit chunks. | ||
323 | - Mostly we use 32-bit chunks so we can use normal scalar instructions. */ | ||
324 | - | ||
325 | -static int disas_neon_data_insn(DisasContext *s, uint32_t insn) | ||
326 | -{ | ||
327 | - int op; | ||
328 | - int q; | ||
329 | - int rd, rm; | ||
330 | - int size; | ||
331 | - int pass; | ||
332 | - int u; | ||
333 | - TCGv_i32 tmp, tmp2; | ||
334 | - | ||
335 | - if (!arm_dc_feature(s, ARM_FEATURE_NEON)) { | ||
336 | - return 1; | ||
337 | - } | ||
338 | - | ||
339 | - /* FIXME: this access check should not take precedence over UNDEF | ||
340 | - * for invalid encodings; we will generate incorrect syndrome information | ||
341 | - * for attempts to execute invalid vfp/neon encodings with FP disabled. | ||
342 | - */ | ||
343 | - if (s->fp_excp_el) { | ||
344 | - gen_exception_insn(s, s->pc_curr, EXCP_UDEF, | ||
345 | - syn_simd_access_trap(1, 0xe, false), s->fp_excp_el); | ||
346 | - return 0; | ||
347 | - } | ||
348 | - | ||
349 | - if (!s->vfp_enabled) | ||
350 | - return 1; | ||
351 | - q = (insn & (1 << 6)) != 0; | ||
352 | - u = (insn >> 24) & 1; | ||
353 | - VFP_DREG_D(rd, insn); | ||
354 | - VFP_DREG_M(rm, insn); | ||
355 | - size = (insn >> 20) & 3; | ||
356 | - | ||
357 | - if ((insn & (1 << 23)) == 0) { | ||
358 | - /* Three register same length: handled by decodetree */ | ||
359 | - return 1; | ||
360 | - } else if (insn & (1 << 4)) { | ||
361 | - /* Two registers and shift or reg and imm: handled by decodetree */ | ||
362 | - return 1; | ||
363 | - } else { /* (insn & 0x00800010 == 0x00800000) */ | ||
364 | - if (size != 3) { | ||
365 | - /* | ||
366 | - * Three registers of different lengths, or two registers and | ||
367 | - * a scalar: handled by decodetree | ||
368 | - */ | ||
369 | - return 1; | ||
370 | - } else { /* size == 3 */ | ||
371 | - if (!u) { | ||
372 | - /* Extract: handled by decodetree */ | ||
373 | - return 1; | ||
374 | - } else if ((insn & (1 << 11)) == 0) { | ||
375 | - /* Two register misc. */ | ||
376 | - op = ((insn >> 12) & 0x30) | ((insn >> 7) & 0xf); | ||
377 | - size = (insn >> 18) & 3; | ||
378 | - /* UNDEF for unknown op values and bad op-size combinations */ | ||
379 | - if ((neon_2rm_sizes[op] & (1 << size)) == 0) { | ||
380 | - return 1; | ||
381 | - } | ||
382 | - if (q && ((rm | rd) & 1)) { | ||
383 | - return 1; | ||
384 | - } | ||
385 | - switch (op) { | ||
386 | - case NEON_2RM_VREV64: | ||
387 | - case NEON_2RM_VPADDL: case NEON_2RM_VPADDL_U: | ||
388 | - case NEON_2RM_VPADAL: case NEON_2RM_VPADAL_U: | ||
389 | - case NEON_2RM_VUZP: | ||
390 | - case NEON_2RM_VZIP: | ||
391 | - case NEON_2RM_VMOVN: case NEON_2RM_VQMOVN: | ||
392 | - case NEON_2RM_VSHLL: | ||
393 | - case NEON_2RM_VCVT_F16_F32: | ||
394 | - case NEON_2RM_VCVT_F32_F16: | ||
395 | - case NEON_2RM_VMVN: | ||
396 | - case NEON_2RM_VNEG: | ||
397 | - case NEON_2RM_VABS: | ||
398 | - case NEON_2RM_VCEQ0: | ||
399 | - case NEON_2RM_VCGT0: | ||
400 | - case NEON_2RM_VCLE0: | ||
401 | - case NEON_2RM_VCGE0: | ||
402 | - case NEON_2RM_VCLT0: | ||
403 | - case NEON_2RM_AESE: case NEON_2RM_AESMC: | ||
404 | - case NEON_2RM_SHA1H: | ||
405 | - case NEON_2RM_SHA1SU1: | ||
406 | - case NEON_2RM_VREV32: | ||
407 | - case NEON_2RM_VREV16: | ||
408 | - case NEON_2RM_VCLS: | ||
409 | - case NEON_2RM_VCLZ: | ||
410 | - case NEON_2RM_VCNT: | ||
411 | - case NEON_2RM_VABS_F: | ||
412 | - case NEON_2RM_VNEG_F: | ||
413 | - case NEON_2RM_VRECPE: | ||
414 | - case NEON_2RM_VRSQRTE: | ||
415 | - case NEON_2RM_VQABS: | ||
416 | - case NEON_2RM_VQNEG: | ||
417 | - case NEON_2RM_VRECPE_F: | ||
418 | - case NEON_2RM_VRSQRTE_F: | ||
419 | - case NEON_2RM_VCVT_FS: | ||
420 | - case NEON_2RM_VCVT_FU: | ||
421 | - case NEON_2RM_VCVT_SF: | ||
422 | - case NEON_2RM_VCVT_UF: | ||
423 | - case NEON_2RM_VRINTX: | ||
424 | - case NEON_2RM_VCGT0_F: | ||
425 | - case NEON_2RM_VCGE0_F: | ||
426 | - case NEON_2RM_VCEQ0_F: | ||
427 | - case NEON_2RM_VCLE0_F: | ||
428 | - case NEON_2RM_VCLT0_F: | ||
429 | - case NEON_2RM_VRINTN: | ||
430 | - case NEON_2RM_VRINTA: | ||
431 | - case NEON_2RM_VRINTM: | ||
432 | - case NEON_2RM_VRINTP: | ||
433 | - case NEON_2RM_VRINTZ: | ||
434 | - case NEON_2RM_VCVTAU: | ||
435 | - case NEON_2RM_VCVTAS: | ||
436 | - case NEON_2RM_VCVTNU: | ||
437 | - case NEON_2RM_VCVTNS: | ||
438 | - case NEON_2RM_VCVTPU: | ||
439 | - case NEON_2RM_VCVTPS: | ||
440 | - case NEON_2RM_VCVTMU: | ||
441 | - case NEON_2RM_VCVTMS: | ||
442 | - case NEON_2RM_VSWP: | ||
443 | - /* handled by decodetree */ | ||
444 | - return 1; | ||
445 | - case NEON_2RM_VTRN: | ||
446 | - if (size == 2) { | ||
447 | - int n; | ||
448 | - for (n = 0; n < (q ? 4 : 2); n += 2) { | ||
449 | - tmp = neon_load_reg(rm, n); | ||
450 | - tmp2 = neon_load_reg(rd, n + 1); | ||
451 | - neon_store_reg(rm, n, tmp2); | ||
452 | - neon_store_reg(rd, n + 1, tmp); | ||
453 | - } | ||
454 | - } else { | ||
455 | - goto elementwise; | ||
456 | - } | ||
457 | - break; | ||
458 | - | ||
459 | - default: | ||
460 | - elementwise: | ||
461 | - for (pass = 0; pass < (q ? 4 : 2); pass++) { | ||
462 | - tmp = neon_load_reg(rm, pass); | ||
463 | - switch (op) { | ||
464 | - case NEON_2RM_VTRN: | ||
465 | - tmp2 = neon_load_reg(rd, pass); | ||
466 | - switch (size) { | ||
467 | - case 0: gen_neon_trn_u8(tmp, tmp2); break; | ||
468 | - case 1: gen_neon_trn_u16(tmp, tmp2); break; | ||
469 | - default: abort(); | ||
470 | - } | ||
471 | - neon_store_reg(rm, pass, tmp2); | ||
472 | - break; | ||
473 | - default: | ||
474 | - /* Reserved op values were caught by the | ||
475 | - * neon_2rm_sizes[] check earlier. | ||
476 | - */ | ||
477 | - abort(); | ||
478 | - } | ||
479 | - neon_store_reg(rd, pass, tmp); | ||
480 | - } | ||
481 | - break; | ||
482 | - } | ||
483 | - } else { | ||
484 | - /* VTBL, VTBX, VDUP: handled by decodetree */ | ||
485 | - return 1; | ||
486 | - } | ||
487 | - } | ||
488 | - } | ||
489 | - return 0; | ||
490 | -} | ||
491 | - | ||
492 | static int disas_coproc_insn(DisasContext *s, uint32_t insn) | ||
42 | { | 493 | { |
43 | MemoryRegion *mr; | 494 | int cpnum, is64, crn, crm, opc1, opc2, isread, rt, rt2; |
44 | hwaddr l, xlat; | 495 | @@ -XXX,XX +XXX,XX @@ static void disas_arm_insn(DisasContext *s, unsigned int insn) |
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 | } | 496 | } |
56 | @@ -XXX,XX +XXX,XX @@ bool address_space_access_valid(AddressSpace *as, hwaddr addr, | 497 | /* fall back to legacy decoder */ |
57 | 498 | ||
58 | rcu_read_lock(); | 499 | - if (((insn >> 25) & 7) == 1) { |
59 | fv = address_space_to_flatview(as); | 500 | - /* NEON Data processing. */ |
60 | - result = flatview_access_valid(fv, addr, len, is_write); | 501 | - if (disas_neon_data_insn(s, insn)) { |
61 | + result = flatview_access_valid(fv, addr, len, is_write, attrs); | 502 | - goto illegal_op; |
62 | rcu_read_unlock(); | 503 | - } |
63 | return result; | 504 | - return; |
64 | } | 505 | - } |
506 | if ((insn & 0x0e000f00) == 0x0c000100) { | ||
507 | if (arm_dc_feature(s, ARM_FEATURE_IWMMXT)) { | ||
508 | /* iWMMXt register transfer. */ | ||
509 | @@ -XXX,XX +XXX,XX @@ static void disas_thumb2_insn(DisasContext *s, uint32_t insn) | ||
510 | break; | ||
511 | } | ||
512 | if (((insn >> 24) & 3) == 3) { | ||
513 | - /* Translate into the equivalent ARM encoding. */ | ||
514 | - insn = (insn & 0xe2ffffff) | ((insn & (1 << 28)) >> 4) | (1 << 28); | ||
515 | - if (disas_neon_data_insn(s, insn)) { | ||
516 | - goto illegal_op; | ||
517 | - } | ||
518 | + /* Neon DP, but failed disas_neon_dp() */ | ||
519 | + goto illegal_op; | ||
520 | } else if (((insn >> 8) & 0xe) == 10) { | ||
521 | /* VFP, but failed disas_vfp. */ | ||
522 | goto illegal_op; | ||
65 | -- | 523 | -- |
66 | 2.17.1 | 524 | 2.20.1 |
67 | 525 | ||
68 | 526 | diff view generated by jsdifflib |
1 | As part of plumbing MemTxAttrs down to the IOMMU translate method, | 1 | The functions neon_element_offset(), neon_load_element(), |
---|---|---|---|
2 | add MemTxAttrs as an argument to address_space_access_valid(). | 2 | neon_load_element64(), neon_store_element() and |
3 | Its callers either have an attrs value to hand, or don't care | 3 | neon_store_element64() are used only in the translate-neon.inc.c |
4 | and can use MEMTXATTRS_UNSPECIFIED. | 4 | file, so move their definitions there. |
5 | |||
6 | Since the .inc.c file is #included in translate.c this doesn't make | ||
7 | much difference currently, but it's a more logical place to put the | ||
8 | functions and it might be helpful if we ever decide to try to make | ||
9 | the .inc.c files genuinely separate compilation units. | ||
5 | 10 | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 11 | 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> | 12 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
9 | Message-id: 20180521140402.23318-6-peter.maydell@linaro.org | 13 | Message-id: 20200616170844.13318-22-peter.maydell@linaro.org |
10 | --- | 14 | --- |
11 | include/exec/memory.h | 4 +++- | 15 | target/arm/translate-neon.inc.c | 101 ++++++++++++++++++++++++++++++++ |
12 | include/sysemu/dma.h | 3 ++- | 16 | target/arm/translate.c | 101 -------------------------------- |
13 | exec.c | 3 ++- | 17 | 2 files changed, 101 insertions(+), 101 deletions(-) |
14 | target/s390x/diag.c | 6 ++++-- | 18 | |
15 | target/s390x/excp_helper.c | 3 ++- | 19 | diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c |
16 | target/s390x/mmu_helper.c | 3 ++- | ||
17 | target/s390x/sigp.c | 3 ++- | ||
18 | 7 files changed, 17 insertions(+), 8 deletions(-) | ||
19 | |||
20 | diff --git a/include/exec/memory.h b/include/exec/memory.h | ||
21 | index XXXXXXX..XXXXXXX 100644 | 20 | index XXXXXXX..XXXXXXX 100644 |
22 | --- a/include/exec/memory.h | 21 | --- a/target/arm/translate-neon.inc.c |
23 | +++ b/include/exec/memory.h | 22 | +++ b/target/arm/translate-neon.inc.c |
24 | @@ -XXX,XX +XXX,XX @@ static inline MemoryRegion *address_space_translate(AddressSpace *as, | 23 | @@ -XXX,XX +XXX,XX @@ static inline int rsub_8(DisasContext *s, int x) |
25 | * @addr: address within that address space | 24 | #include "decode-neon-ls.inc.c" |
26 | * @len: length of the area to be checked | 25 | #include "decode-neon-shared.inc.c" |
27 | * @is_write: indicates the transfer direction | 26 | |
28 | + * @attrs: memory attributes | 27 | +/* Return the offset of a 2**SIZE piece of a NEON register, at index ELE, |
29 | */ | 28 | + * where 0 is the least significant end of the register. |
30 | -bool address_space_access_valid(AddressSpace *as, hwaddr addr, int len, bool is_write); | 29 | + */ |
31 | +bool address_space_access_valid(AddressSpace *as, hwaddr addr, int len, | 30 | +static inline long |
32 | + bool is_write, MemTxAttrs attrs); | 31 | +neon_element_offset(int reg, int element, MemOp size) |
33 | 32 | +{ | |
34 | /* address_space_map: map a physical memory region into a host virtual address | 33 | + int element_size = 1 << size; |
35 | * | 34 | + int ofs = element * element_size; |
36 | diff --git a/include/sysemu/dma.h b/include/sysemu/dma.h | 35 | +#ifdef HOST_WORDS_BIGENDIAN |
36 | + /* Calculate the offset assuming fully little-endian, | ||
37 | + * then XOR to account for the order of the 8-byte units. | ||
38 | + */ | ||
39 | + if (element_size < 8) { | ||
40 | + ofs ^= 8 - element_size; | ||
41 | + } | ||
42 | +#endif | ||
43 | + return neon_reg_offset(reg, 0) + ofs; | ||
44 | +} | ||
45 | + | ||
46 | +static void neon_load_element(TCGv_i32 var, int reg, int ele, MemOp mop) | ||
47 | +{ | ||
48 | + long offset = neon_element_offset(reg, ele, mop & MO_SIZE); | ||
49 | + | ||
50 | + switch (mop) { | ||
51 | + case MO_UB: | ||
52 | + tcg_gen_ld8u_i32(var, cpu_env, offset); | ||
53 | + break; | ||
54 | + case MO_UW: | ||
55 | + tcg_gen_ld16u_i32(var, cpu_env, offset); | ||
56 | + break; | ||
57 | + case MO_UL: | ||
58 | + tcg_gen_ld_i32(var, cpu_env, offset); | ||
59 | + break; | ||
60 | + default: | ||
61 | + g_assert_not_reached(); | ||
62 | + } | ||
63 | +} | ||
64 | + | ||
65 | +static void neon_load_element64(TCGv_i64 var, int reg, int ele, MemOp mop) | ||
66 | +{ | ||
67 | + long offset = neon_element_offset(reg, ele, mop & MO_SIZE); | ||
68 | + | ||
69 | + switch (mop) { | ||
70 | + case MO_UB: | ||
71 | + tcg_gen_ld8u_i64(var, cpu_env, offset); | ||
72 | + break; | ||
73 | + case MO_UW: | ||
74 | + tcg_gen_ld16u_i64(var, cpu_env, offset); | ||
75 | + break; | ||
76 | + case MO_UL: | ||
77 | + tcg_gen_ld32u_i64(var, cpu_env, offset); | ||
78 | + break; | ||
79 | + case MO_Q: | ||
80 | + tcg_gen_ld_i64(var, cpu_env, offset); | ||
81 | + break; | ||
82 | + default: | ||
83 | + g_assert_not_reached(); | ||
84 | + } | ||
85 | +} | ||
86 | + | ||
87 | +static void neon_store_element(int reg, int ele, MemOp size, TCGv_i32 var) | ||
88 | +{ | ||
89 | + long offset = neon_element_offset(reg, ele, size); | ||
90 | + | ||
91 | + switch (size) { | ||
92 | + case MO_8: | ||
93 | + tcg_gen_st8_i32(var, cpu_env, offset); | ||
94 | + break; | ||
95 | + case MO_16: | ||
96 | + tcg_gen_st16_i32(var, cpu_env, offset); | ||
97 | + break; | ||
98 | + case MO_32: | ||
99 | + tcg_gen_st_i32(var, cpu_env, offset); | ||
100 | + break; | ||
101 | + default: | ||
102 | + g_assert_not_reached(); | ||
103 | + } | ||
104 | +} | ||
105 | + | ||
106 | +static void neon_store_element64(int reg, int ele, MemOp size, TCGv_i64 var) | ||
107 | +{ | ||
108 | + long offset = neon_element_offset(reg, ele, size); | ||
109 | + | ||
110 | + switch (size) { | ||
111 | + case MO_8: | ||
112 | + tcg_gen_st8_i64(var, cpu_env, offset); | ||
113 | + break; | ||
114 | + case MO_16: | ||
115 | + tcg_gen_st16_i64(var, cpu_env, offset); | ||
116 | + break; | ||
117 | + case MO_32: | ||
118 | + tcg_gen_st32_i64(var, cpu_env, offset); | ||
119 | + break; | ||
120 | + case MO_64: | ||
121 | + tcg_gen_st_i64(var, cpu_env, offset); | ||
122 | + break; | ||
123 | + default: | ||
124 | + g_assert_not_reached(); | ||
125 | + } | ||
126 | +} | ||
127 | + | ||
128 | static bool trans_VCMLA(DisasContext *s, arg_VCMLA *a) | ||
129 | { | ||
130 | int opr_sz; | ||
131 | diff --git a/target/arm/translate.c b/target/arm/translate.c | ||
37 | index XXXXXXX..XXXXXXX 100644 | 132 | index XXXXXXX..XXXXXXX 100644 |
38 | --- a/include/sysemu/dma.h | 133 | --- a/target/arm/translate.c |
39 | +++ b/include/sysemu/dma.h | 134 | +++ b/target/arm/translate.c |
40 | @@ -XXX,XX +XXX,XX @@ static inline bool dma_memory_valid(AddressSpace *as, | 135 | @@ -XXX,XX +XXX,XX @@ neon_reg_offset (int reg, int n) |
41 | DMADirection dir) | 136 | return vfp_reg_offset(0, sreg); |
42 | { | ||
43 | return address_space_access_valid(as, addr, len, | ||
44 | - dir == DMA_DIRECTION_FROM_DEVICE); | ||
45 | + dir == DMA_DIRECTION_FROM_DEVICE, | ||
46 | + MEMTXATTRS_UNSPECIFIED); | ||
47 | } | 137 | } |
48 | 138 | ||
49 | static inline int dma_memory_rw_relaxed(AddressSpace *as, dma_addr_t addr, | 139 | -/* Return the offset of a 2**SIZE piece of a NEON register, at index ELE, |
50 | diff --git a/exec.c b/exec.c | 140 | - * where 0 is the least significant end of the register. |
51 | index XXXXXXX..XXXXXXX 100644 | 141 | - */ |
52 | --- a/exec.c | 142 | -static inline long |
53 | +++ b/exec.c | 143 | -neon_element_offset(int reg, int element, MemOp size) |
54 | @@ -XXX,XX +XXX,XX @@ static bool flatview_access_valid(FlatView *fv, hwaddr addr, int len, | 144 | -{ |
145 | - int element_size = 1 << size; | ||
146 | - int ofs = element * element_size; | ||
147 | -#ifdef HOST_WORDS_BIGENDIAN | ||
148 | - /* Calculate the offset assuming fully little-endian, | ||
149 | - * then XOR to account for the order of the 8-byte units. | ||
150 | - */ | ||
151 | - if (element_size < 8) { | ||
152 | - ofs ^= 8 - element_size; | ||
153 | - } | ||
154 | -#endif | ||
155 | - return neon_reg_offset(reg, 0) + ofs; | ||
156 | -} | ||
157 | - | ||
158 | static TCGv_i32 neon_load_reg(int reg, int pass) | ||
159 | { | ||
160 | TCGv_i32 tmp = tcg_temp_new_i32(); | ||
161 | @@ -XXX,XX +XXX,XX @@ static TCGv_i32 neon_load_reg(int reg, int pass) | ||
162 | return tmp; | ||
55 | } | 163 | } |
56 | 164 | ||
57 | bool address_space_access_valid(AddressSpace *as, hwaddr addr, | 165 | -static void neon_load_element(TCGv_i32 var, int reg, int ele, MemOp mop) |
58 | - int len, bool is_write) | 166 | -{ |
59 | + int len, bool is_write, | 167 | - long offset = neon_element_offset(reg, ele, mop & MO_SIZE); |
60 | + MemTxAttrs attrs) | 168 | - |
61 | { | 169 | - switch (mop) { |
62 | FlatView *fv; | 170 | - case MO_UB: |
63 | bool result; | 171 | - tcg_gen_ld8u_i32(var, cpu_env, offset); |
64 | diff --git a/target/s390x/diag.c b/target/s390x/diag.c | 172 | - break; |
65 | index XXXXXXX..XXXXXXX 100644 | 173 | - case MO_UW: |
66 | --- a/target/s390x/diag.c | 174 | - tcg_gen_ld16u_i32(var, cpu_env, offset); |
67 | +++ b/target/s390x/diag.c | 175 | - break; |
68 | @@ -XXX,XX +XXX,XX @@ void handle_diag_308(CPUS390XState *env, uint64_t r1, uint64_t r3, uintptr_t ra) | 176 | - case MO_UL: |
69 | return; | 177 | - tcg_gen_ld_i32(var, cpu_env, offset); |
70 | } | 178 | - break; |
71 | if (!address_space_access_valid(&address_space_memory, addr, | 179 | - default: |
72 | - sizeof(IplParameterBlock), false)) { | 180 | - g_assert_not_reached(); |
73 | + sizeof(IplParameterBlock), false, | 181 | - } |
74 | + MEMTXATTRS_UNSPECIFIED)) { | 182 | -} |
75 | s390_program_interrupt(env, PGM_ADDRESSING, ILEN_AUTO, ra); | 183 | - |
76 | return; | 184 | -static void neon_load_element64(TCGv_i64 var, int reg, int ele, MemOp mop) |
77 | } | 185 | -{ |
78 | @@ -XXX,XX +XXX,XX @@ out: | 186 | - long offset = neon_element_offset(reg, ele, mop & MO_SIZE); |
79 | return; | 187 | - |
80 | } | 188 | - switch (mop) { |
81 | if (!address_space_access_valid(&address_space_memory, addr, | 189 | - case MO_UB: |
82 | - sizeof(IplParameterBlock), true)) { | 190 | - tcg_gen_ld8u_i64(var, cpu_env, offset); |
83 | + sizeof(IplParameterBlock), true, | 191 | - break; |
84 | + MEMTXATTRS_UNSPECIFIED)) { | 192 | - case MO_UW: |
85 | s390_program_interrupt(env, PGM_ADDRESSING, ILEN_AUTO, ra); | 193 | - tcg_gen_ld16u_i64(var, cpu_env, offset); |
86 | return; | 194 | - break; |
87 | } | 195 | - case MO_UL: |
88 | diff --git a/target/s390x/excp_helper.c b/target/s390x/excp_helper.c | 196 | - tcg_gen_ld32u_i64(var, cpu_env, offset); |
89 | index XXXXXXX..XXXXXXX 100644 | 197 | - break; |
90 | --- a/target/s390x/excp_helper.c | 198 | - case MO_Q: |
91 | +++ b/target/s390x/excp_helper.c | 199 | - tcg_gen_ld_i64(var, cpu_env, offset); |
92 | @@ -XXX,XX +XXX,XX @@ int s390_cpu_handle_mmu_fault(CPUState *cs, vaddr orig_vaddr, int size, | 200 | - break; |
93 | 201 | - default: | |
94 | /* check out of RAM access */ | 202 | - g_assert_not_reached(); |
95 | if (!address_space_access_valid(&address_space_memory, raddr, | 203 | - } |
96 | - TARGET_PAGE_SIZE, rw)) { | 204 | -} |
97 | + TARGET_PAGE_SIZE, rw, | 205 | - |
98 | + MEMTXATTRS_UNSPECIFIED)) { | 206 | static void neon_store_reg(int reg, int pass, TCGv_i32 var) |
99 | DPRINTF("%s: raddr %" PRIx64 " > ram_size %" PRIx64 "\n", __func__, | 207 | { |
100 | (uint64_t)raddr, (uint64_t)ram_size); | 208 | tcg_gen_st_i32(var, cpu_env, neon_reg_offset(reg, pass)); |
101 | trigger_pgm_exception(env, PGM_ADDRESSING, ILEN_AUTO); | 209 | tcg_temp_free_i32(var); |
102 | diff --git a/target/s390x/mmu_helper.c b/target/s390x/mmu_helper.c | 210 | } |
103 | index XXXXXXX..XXXXXXX 100644 | 211 | |
104 | --- a/target/s390x/mmu_helper.c | 212 | -static void neon_store_element(int reg, int ele, MemOp size, TCGv_i32 var) |
105 | +++ b/target/s390x/mmu_helper.c | 213 | -{ |
106 | @@ -XXX,XX +XXX,XX @@ static int translate_pages(S390CPU *cpu, vaddr addr, int nr_pages, | 214 | - long offset = neon_element_offset(reg, ele, size); |
107 | return ret; | 215 | - |
108 | } | 216 | - switch (size) { |
109 | if (!address_space_access_valid(&address_space_memory, pages[i], | 217 | - case MO_8: |
110 | - TARGET_PAGE_SIZE, is_write)) { | 218 | - tcg_gen_st8_i32(var, cpu_env, offset); |
111 | + TARGET_PAGE_SIZE, is_write, | 219 | - break; |
112 | + MEMTXATTRS_UNSPECIFIED)) { | 220 | - case MO_16: |
113 | trigger_access_exception(env, PGM_ADDRESSING, ILEN_AUTO, 0); | 221 | - tcg_gen_st16_i32(var, cpu_env, offset); |
114 | return -EFAULT; | 222 | - break; |
115 | } | 223 | - case MO_32: |
116 | diff --git a/target/s390x/sigp.c b/target/s390x/sigp.c | 224 | - tcg_gen_st_i32(var, cpu_env, offset); |
117 | index XXXXXXX..XXXXXXX 100644 | 225 | - break; |
118 | --- a/target/s390x/sigp.c | 226 | - default: |
119 | +++ b/target/s390x/sigp.c | 227 | - g_assert_not_reached(); |
120 | @@ -XXX,XX +XXX,XX @@ static void sigp_set_prefix(CPUState *cs, run_on_cpu_data arg) | 228 | - } |
121 | cpu_synchronize_state(cs); | 229 | -} |
122 | 230 | - | |
123 | if (!address_space_access_valid(&address_space_memory, addr, | 231 | -static void neon_store_element64(int reg, int ele, MemOp size, TCGv_i64 var) |
124 | - sizeof(struct LowCore), false)) { | 232 | -{ |
125 | + sizeof(struct LowCore), false, | 233 | - long offset = neon_element_offset(reg, ele, size); |
126 | + MEMTXATTRS_UNSPECIFIED)) { | 234 | - |
127 | set_sigp_status(si, SIGP_STAT_INVALID_PARAMETER); | 235 | - switch (size) { |
128 | return; | 236 | - case MO_8: |
129 | } | 237 | - tcg_gen_st8_i64(var, cpu_env, offset); |
238 | - break; | ||
239 | - case MO_16: | ||
240 | - tcg_gen_st16_i64(var, cpu_env, offset); | ||
241 | - break; | ||
242 | - case MO_32: | ||
243 | - tcg_gen_st32_i64(var, cpu_env, offset); | ||
244 | - break; | ||
245 | - case MO_64: | ||
246 | - tcg_gen_st_i64(var, cpu_env, offset); | ||
247 | - break; | ||
248 | - default: | ||
249 | - g_assert_not_reached(); | ||
250 | - } | ||
251 | -} | ||
252 | - | ||
253 | static inline void neon_load_reg64(TCGv_i64 var, int reg) | ||
254 | { | ||
255 | tcg_gen_ld_i64(var, cpu_env, vfp_reg_offset(1, reg)); | ||
130 | -- | 256 | -- |
131 | 2.17.1 | 257 | 2.20.1 |
132 | 258 | ||
133 | 259 | diff view generated by jsdifflib |
1 | As part of plumbing MemTxAttrs down to the IOMMU translate method, | 1 | Since commit ba3e7926691ed3 it has been unnecessary for target code |
---|---|---|---|
2 | add MemTxAttrs as an argument to address_space_get_iotlb_entry(). | 2 | to call gen_io_end() after an IO instruction in icount mode; it is |
3 | sufficient to call gen_io_start() before it and to force the end of | ||
4 | the TB. | ||
5 | |||
6 | Many now-unnecessary calls to gen_io_end() were removed in commit | ||
7 | 9e9b10c6491153b, but some were missed or accidentally added later. | ||
8 | Remove unneeded calls from the arm target: | ||
9 | |||
10 | * the call in the handling of exception-return-via-LDM is | ||
11 | unnecessary, and the code is already forcing end-of-TB | ||
12 | * the call in the VFP access check code is more complicated: | ||
13 | we weren't ending the TB, so we need to add the code to | ||
14 | force that by setting DISAS_UPDATE | ||
15 | * the doc comment for ARM_CP_IO doesn't need to mention | ||
16 | gen_io_end() any more | ||
3 | 17 | ||
4 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 18 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
5 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | 19 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> |
6 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 20 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
7 | Message-id: 20180521140402.23318-12-peter.maydell@linaro.org | 21 | Reviewed-by: Pavel Dovgalyuk <Pavel.Dovgaluk@ispras.ru> |
22 | Message-id: 20200619170324.12093-1-peter.maydell@linaro.org | ||
8 | --- | 23 | --- |
9 | include/exec/memory.h | 2 +- | 24 | target/arm/cpu.h | 2 +- |
10 | exec.c | 2 +- | 25 | target/arm/translate-vfp.inc.c | 7 +++---- |
11 | hw/virtio/vhost.c | 3 ++- | 26 | target/arm/translate.c | 3 --- |
12 | 3 files changed, 4 insertions(+), 3 deletions(-) | 27 | 3 files changed, 4 insertions(+), 8 deletions(-) |
13 | 28 | ||
14 | diff --git a/include/exec/memory.h b/include/exec/memory.h | 29 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h |
15 | index XXXXXXX..XXXXXXX 100644 | 30 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/include/exec/memory.h | 31 | --- a/target/arm/cpu.h |
17 | +++ b/include/exec/memory.h | 32 | +++ b/target/arm/cpu.h |
18 | @@ -XXX,XX +XXX,XX @@ void address_space_cache_destroy(MemoryRegionCache *cache); | 33 | @@ -XXX,XX +XXX,XX @@ static inline uint64_t cpreg_to_kvm_id(uint32_t cpregid) |
19 | * entry. Should be called from an RCU critical section. | 34 | * migration or KVM state synchronization. (Typically this is for "registers" |
20 | */ | 35 | * which are actually used as instructions for cache maintenance and so on.) |
21 | IOMMUTLBEntry address_space_get_iotlb_entry(AddressSpace *as, hwaddr addr, | 36 | * IO indicates that this register does I/O and therefore its accesses |
22 | - bool is_write); | 37 | - * need to be surrounded by gen_io_start()/gen_io_end(). In particular, |
23 | + bool is_write, MemTxAttrs attrs); | 38 | + * need to be marked with gen_io_start() and also end the TB. In particular, |
24 | 39 | * registers which implement clocks or timers require this. | |
25 | /* address_space_translate: translate an address range into an address space | 40 | * RAISES_EXC is for when the read or write hook might raise an exception; |
26 | * into a MemoryRegion and an address range into that section. Should be | 41 | * the generated code will synchronize the CPU state before calling the hook |
27 | diff --git a/exec.c b/exec.c | 42 | diff --git a/target/arm/translate-vfp.inc.c b/target/arm/translate-vfp.inc.c |
28 | index XXXXXXX..XXXXXXX 100644 | 43 | index XXXXXXX..XXXXXXX 100644 |
29 | --- a/exec.c | 44 | --- a/target/arm/translate-vfp.inc.c |
30 | +++ b/exec.c | 45 | +++ b/target/arm/translate-vfp.inc.c |
31 | @@ -XXX,XX +XXX,XX @@ static MemoryRegionSection flatview_do_translate(FlatView *fv, | 46 | @@ -XXX,XX +XXX,XX @@ static bool full_vfp_access_check(DisasContext *s, bool ignore_vfp_enabled) |
32 | 47 | if (s->v7m_lspact) { | |
33 | /* Called from RCU critical section */ | 48 | /* |
34 | IOMMUTLBEntry address_space_get_iotlb_entry(AddressSpace *as, hwaddr addr, | 49 | * Lazy state saving affects external memory and also the NVIC, |
35 | - bool is_write) | 50 | - * so we must mark it as an IO operation for icount. |
36 | + bool is_write, MemTxAttrs attrs) | 51 | + * so we must mark it as an IO operation for icount (and cause |
37 | { | 52 | + * this to be the last insn in the TB). |
38 | MemoryRegionSection section; | 53 | */ |
39 | hwaddr xlat, page_mask; | 54 | if (tb_cflags(s->base.tb) & CF_USE_ICOUNT) { |
40 | diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c | 55 | + s->base.is_jmp = DISAS_UPDATE; |
56 | gen_io_start(); | ||
57 | } | ||
58 | gen_helper_v7m_preserve_fp_state(cpu_env); | ||
59 | - if (tb_cflags(s->base.tb) & CF_USE_ICOUNT) { | ||
60 | - gen_io_end(); | ||
61 | - } | ||
62 | /* | ||
63 | * If the preserve_fp_state helper doesn't throw an exception | ||
64 | * then it will clear LSPACT; we don't need to repeat this for | ||
65 | diff --git a/target/arm/translate.c b/target/arm/translate.c | ||
41 | index XXXXXXX..XXXXXXX 100644 | 66 | index XXXXXXX..XXXXXXX 100644 |
42 | --- a/hw/virtio/vhost.c | 67 | --- a/target/arm/translate.c |
43 | +++ b/hw/virtio/vhost.c | 68 | +++ b/target/arm/translate.c |
44 | @@ -XXX,XX +XXX,XX @@ int vhost_device_iotlb_miss(struct vhost_dev *dev, uint64_t iova, int write) | 69 | @@ -XXX,XX +XXX,XX @@ static bool do_ldm(DisasContext *s, arg_ldst_block *a, int min_n) |
45 | trace_vhost_iotlb_miss(dev, 1); | 70 | gen_io_start(); |
46 | 71 | } | |
47 | iotlb = address_space_get_iotlb_entry(dev->vdev->dma_as, | 72 | gen_helper_cpsr_write_eret(cpu_env, tmp); |
48 | - iova, write); | 73 | - if (tb_cflags(s->base.tb) & CF_USE_ICOUNT) { |
49 | + iova, write, | 74 | - gen_io_end(); |
50 | + MEMTXATTRS_UNSPECIFIED); | 75 | - } |
51 | if (iotlb.target_as != NULL) { | 76 | tcg_temp_free_i32(tmp); |
52 | ret = vhost_memory_region_lookup(dev, iotlb.translated_addr, | 77 | /* Must exit loop to check un-masked IRQs */ |
53 | &uaddr, &len); | 78 | s->base.is_jmp = DISAS_EXIT; |
54 | -- | 79 | -- |
55 | 2.17.1 | 80 | 2.20.1 |
56 | 81 | ||
57 | 82 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | In commit cfdb2c0c95ae9205b0 ("target/arm: Vectorize SABA/UABA") we | ||
2 | replaced the old handling of SABA/UABA with a vectorized implementation | ||
3 | which returns early rather than falling into the loop-ever-elements | ||
4 | code. We forgot to delete the part of the old looping code that | ||
5 | did the accumulate step, and Coverity correctly warns (CID 1428955) | ||
6 | that this code is now dead. Delete it. | ||
1 | 7 | ||
8 | Fixes: cfdb2c0c95ae9205b0 | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
11 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
12 | Message-id: 20200619171547.29780-1-peter.maydell@linaro.org | ||
13 | --- | ||
14 | target/arm/translate-a64.c | 12 ------------ | ||
15 | 1 file changed, 12 deletions(-) | ||
16 | |||
17 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c | ||
18 | index XXXXXXX..XXXXXXX 100644 | ||
19 | --- a/target/arm/translate-a64.c | ||
20 | +++ b/target/arm/translate-a64.c | ||
21 | @@ -XXX,XX +XXX,XX @@ static void disas_simd_3same_int(DisasContext *s, uint32_t insn) | ||
22 | genfn(tcg_res, tcg_op1, tcg_op2); | ||
23 | } | ||
24 | |||
25 | - if (opcode == 0xf) { | ||
26 | - /* SABA, UABA: accumulating ops */ | ||
27 | - static NeonGenTwoOpFn * const fns[3] = { | ||
28 | - gen_helper_neon_add_u8, | ||
29 | - gen_helper_neon_add_u16, | ||
30 | - tcg_gen_add_i32, | ||
31 | - }; | ||
32 | - | ||
33 | - read_vec_element_i32(s, tcg_op1, rd, pass, MO_32); | ||
34 | - fns[size](tcg_res, tcg_op1, tcg_res); | ||
35 | - } | ||
36 | - | ||
37 | write_vec_element_i32(s, tcg_res, rd, pass, MO_32); | ||
38 | |||
39 | tcg_temp_free_i32(tcg_res); | ||
40 | -- | ||
41 | 2.20.1 | ||
42 | |||
43 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
1 | 2 | ||
3 | Add a trace event to see when a guest disable/enable the watchdog. | ||
4 | |||
5 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
6 | Message-id: 20200617072539.32686-2-f4bug@amsat.org | ||
7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
9 | --- | ||
10 | hw/watchdog/cmsdk-apb-watchdog.c | 1 + | ||
11 | hw/watchdog/trace-events | 1 + | ||
12 | 2 files changed, 2 insertions(+) | ||
13 | |||
14 | diff --git a/hw/watchdog/cmsdk-apb-watchdog.c b/hw/watchdog/cmsdk-apb-watchdog.c | ||
15 | index XXXXXXX..XXXXXXX 100644 | ||
16 | --- a/hw/watchdog/cmsdk-apb-watchdog.c | ||
17 | +++ b/hw/watchdog/cmsdk-apb-watchdog.c | ||
18 | @@ -XXX,XX +XXX,XX @@ static void cmsdk_apb_watchdog_write(void *opaque, hwaddr offset, | ||
19 | break; | ||
20 | case A_WDOGLOCK: | ||
21 | s->lock = (value != WDOG_UNLOCK_VALUE); | ||
22 | + trace_cmsdk_apb_watchdog_lock(s->lock); | ||
23 | break; | ||
24 | case A_WDOGITCR: | ||
25 | if (s->is_luminary) { | ||
26 | diff --git a/hw/watchdog/trace-events b/hw/watchdog/trace-events | ||
27 | index XXXXXXX..XXXXXXX 100644 | ||
28 | --- a/hw/watchdog/trace-events | ||
29 | +++ b/hw/watchdog/trace-events | ||
30 | @@ -XXX,XX +XXX,XX @@ | ||
31 | cmsdk_apb_watchdog_read(uint64_t offset, uint64_t data, unsigned size) "CMSDK APB watchdog read: offset 0x%" PRIx64 " data 0x%" PRIx64 " size %u" | ||
32 | cmsdk_apb_watchdog_write(uint64_t offset, uint64_t data, unsigned size) "CMSDK APB watchdog write: offset 0x%" PRIx64 " data 0x%" PRIx64 " size %u" | ||
33 | cmsdk_apb_watchdog_reset(void) "CMSDK APB watchdog: reset" | ||
34 | +cmsdk_apb_watchdog_lock(uint32_t lock) "CMSDK APB watchdog: lock %" PRIu32 | ||
35 | -- | ||
36 | 2.20.1 | ||
37 | |||
38 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
1 | 2 | ||
3 | Use self-explicit definitions instead of magic values. | ||
4 | |||
5 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
6 | Message-id: 20200617072539.32686-3-f4bug@amsat.org | ||
7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
9 | --- | ||
10 | hw/i2c/versatile_i2c.c | 14 ++++++++++---- | ||
11 | 1 file changed, 10 insertions(+), 4 deletions(-) | ||
12 | |||
13 | diff --git a/hw/i2c/versatile_i2c.c b/hw/i2c/versatile_i2c.c | ||
14 | index XXXXXXX..XXXXXXX 100644 | ||
15 | --- a/hw/i2c/versatile_i2c.c | ||
16 | +++ b/hw/i2c/versatile_i2c.c | ||
17 | @@ -XXX,XX +XXX,XX @@ | ||
18 | #include "qemu/osdep.h" | ||
19 | #include "hw/sysbus.h" | ||
20 | #include "hw/i2c/bitbang_i2c.h" | ||
21 | +#include "hw/registerfields.h" | ||
22 | #include "qemu/log.h" | ||
23 | #include "qemu/module.h" | ||
24 | |||
25 | @@ -XXX,XX +XXX,XX @@ typedef struct VersatileI2CState { | ||
26 | int in; | ||
27 | } VersatileI2CState; | ||
28 | |||
29 | +REG32(CONTROL_GET, 0) | ||
30 | +REG32(CONTROL_SET, 0) | ||
31 | +REG32(CONTROL_CLR, 4) | ||
32 | + | ||
33 | static uint64_t versatile_i2c_read(void *opaque, hwaddr offset, | ||
34 | unsigned size) | ||
35 | { | ||
36 | VersatileI2CState *s = (VersatileI2CState *)opaque; | ||
37 | |||
38 | - if (offset == 0) { | ||
39 | + switch (offset) { | ||
40 | + case A_CONTROL_SET: | ||
41 | return (s->out & 1) | (s->in << 1); | ||
42 | - } else { | ||
43 | + default: | ||
44 | qemu_log_mask(LOG_GUEST_ERROR, | ||
45 | "%s: Bad offset 0x%x\n", __func__, (int)offset); | ||
46 | return -1; | ||
47 | @@ -XXX,XX +XXX,XX @@ static void versatile_i2c_write(void *opaque, hwaddr offset, | ||
48 | VersatileI2CState *s = (VersatileI2CState *)opaque; | ||
49 | |||
50 | switch (offset) { | ||
51 | - case 0: | ||
52 | + case A_CONTROL_SET: | ||
53 | s->out |= value & 3; | ||
54 | break; | ||
55 | - case 4: | ||
56 | + case A_CONTROL_CLR: | ||
57 | s->out &= ~value; | ||
58 | break; | ||
59 | default: | ||
60 | -- | ||
61 | 2.20.1 | ||
62 | |||
63 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> |
---|---|---|---|
2 | 2 | ||
3 | Depending on the host abi, float16, aka uint16_t, values are | 3 | Use self-explicit definitions instead of magic values. |
4 | passed and returned either zero-extended in the host register | ||
5 | or with garbage at the top of the host register. | ||
6 | 4 | ||
7 | The tcg code generator has so far been assuming garbage, as that | 5 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> |
8 | matches the x86 abi, but this is incorrect for other host abis. | 6 | Message-id: 20200617072539.32686-4-f4bug@amsat.org |
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> | 7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
24 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
25 | --- | 9 | --- |
26 | include/exec/helper-head.h | 2 +- | 10 | hw/i2c/versatile_i2c.c | 7 +++++-- |
27 | target/arm/helper-a64.c | 35 +++++++++-------- | 11 | 1 file changed, 5 insertions(+), 2 deletions(-) |
28 | target/arm/helper.c | 80 +++++++++++++++++++------------------- | ||
29 | 3 files changed, 59 insertions(+), 58 deletions(-) | ||
30 | 12 | ||
31 | diff --git a/include/exec/helper-head.h b/include/exec/helper-head.h | 13 | diff --git a/hw/i2c/versatile_i2c.c b/hw/i2c/versatile_i2c.c |
32 | index XXXXXXX..XXXXXXX 100644 | 14 | index XXXXXXX..XXXXXXX 100644 |
33 | --- a/include/exec/helper-head.h | 15 | --- a/hw/i2c/versatile_i2c.c |
34 | +++ b/include/exec/helper-head.h | 16 | +++ b/hw/i2c/versatile_i2c.c |
35 | @@ -XXX,XX +XXX,XX @@ | 17 | @@ -XXX,XX +XXX,XX @@ REG32(CONTROL_GET, 0) |
36 | #define dh_ctype_int int | 18 | REG32(CONTROL_SET, 0) |
37 | #define dh_ctype_i64 uint64_t | 19 | REG32(CONTROL_CLR, 4) |
38 | #define dh_ctype_s64 int64_t | 20 | |
39 | -#define dh_ctype_f16 float16 | 21 | +#define SCL BIT(0) |
40 | +#define dh_ctype_f16 uint32_t | 22 | +#define SDA BIT(1) |
41 | #define dh_ctype_f32 float32 | 23 | + |
42 | #define dh_ctype_f64 float64 | 24 | static uint64_t versatile_i2c_read(void *opaque, hwaddr offset, |
43 | #define dh_ctype_ptr void * | 25 | unsigned size) |
44 | diff --git a/target/arm/helper-a64.c b/target/arm/helper-a64.c | 26 | { |
45 | index XXXXXXX..XXXXXXX 100644 | 27 | @@ -XXX,XX +XXX,XX @@ static void versatile_i2c_write(void *opaque, hwaddr offset, |
46 | --- a/target/arm/helper-a64.c | 28 | qemu_log_mask(LOG_GUEST_ERROR, |
47 | +++ b/target/arm/helper-a64.c | 29 | "%s: Bad offset 0x%x\n", __func__, (int)offset); |
48 | @@ -XXX,XX +XXX,XX @@ static inline uint32_t float_rel_to_flags(int res) | 30 | } |
49 | return flags; | 31 | - bitbang_i2c_set(&s->bitbang, BITBANG_I2C_SCL, (s->out & 1) != 0); |
32 | - s->in = bitbang_i2c_set(&s->bitbang, BITBANG_I2C_SDA, (s->out & 2) != 0); | ||
33 | + bitbang_i2c_set(&s->bitbang, BITBANG_I2C_SCL, (s->out & SCL) != 0); | ||
34 | + s->in = bitbang_i2c_set(&s->bitbang, BITBANG_I2C_SDA, (s->out & SDA) != 0); | ||
50 | } | 35 | } |
51 | 36 | ||
52 | -uint64_t HELPER(vfp_cmph_a64)(float16 x, float16 y, void *fp_status) | 37 | static const MemoryRegionOps versatile_i2c_ops = { |
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 | } | ||
287 | } | ||
288 | |||
289 | -uint32_t HELPER(vfp_toshh)(float16 x, uint32_t shift, void *fpst) | ||
290 | +uint32_t HELPER(vfp_toshh)(uint32_t x, uint32_t shift, void *fpst) | ||
291 | { | ||
292 | return float64_to_int16(do_prescale_fp16(x, shift, fpst), fpst); | ||
293 | } | ||
294 | |||
295 | -uint32_t HELPER(vfp_touhh)(float16 x, uint32_t shift, void *fpst) | ||
296 | +uint32_t HELPER(vfp_touhh)(uint32_t x, uint32_t shift, void *fpst) | ||
297 | { | ||
298 | return float64_to_uint16(do_prescale_fp16(x, shift, fpst), fpst); | ||
299 | } | ||
300 | |||
301 | -uint32_t HELPER(vfp_toslh)(float16 x, uint32_t shift, void *fpst) | ||
302 | +uint32_t HELPER(vfp_toslh)(uint32_t x, uint32_t shift, void *fpst) | ||
303 | { | ||
304 | return float64_to_int32(do_prescale_fp16(x, shift, fpst), fpst); | ||
305 | } | ||
306 | |||
307 | -uint32_t HELPER(vfp_toulh)(float16 x, uint32_t shift, void *fpst) | ||
308 | +uint32_t HELPER(vfp_toulh)(uint32_t x, uint32_t shift, void *fpst) | ||
309 | { | ||
310 | return float64_to_uint32(do_prescale_fp16(x, shift, fpst), fpst); | ||
311 | } | ||
312 | |||
313 | -uint64_t HELPER(vfp_tosqh)(float16 x, uint32_t shift, void *fpst) | ||
314 | +uint64_t HELPER(vfp_tosqh)(uint32_t x, uint32_t shift, void *fpst) | ||
315 | { | ||
316 | return float64_to_int64(do_prescale_fp16(x, shift, fpst), fpst); | ||
317 | } | ||
318 | |||
319 | -uint64_t HELPER(vfp_touqh)(float16 x, uint32_t shift, void *fpst) | ||
320 | +uint64_t HELPER(vfp_touqh)(uint32_t x, uint32_t shift, void *fpst) | ||
321 | { | ||
322 | return float64_to_uint64(do_prescale_fp16(x, shift, fpst), fpst); | ||
323 | } | ||
324 | @@ -XXX,XX +XXX,XX @@ uint32_t HELPER(set_neon_rmode)(uint32_t rmode, CPUARMState *env) | ||
325 | } | ||
326 | |||
327 | /* Half precision conversions. */ | ||
328 | -float32 HELPER(vfp_fcvt_f16_to_f32)(float16 a, void *fpstp, uint32_t ahp_mode) | ||
329 | +float32 HELPER(vfp_fcvt_f16_to_f32)(uint32_t a, void *fpstp, uint32_t ahp_mode) | ||
330 | { | ||
331 | /* Squash FZ16 to 0 for the duration of conversion. In this case, | ||
332 | * it would affect flushing input denormals. | ||
333 | @@ -XXX,XX +XXX,XX @@ float32 HELPER(vfp_fcvt_f16_to_f32)(float16 a, void *fpstp, uint32_t ahp_mode) | ||
334 | return r; | ||
335 | } | ||
336 | |||
337 | -float16 HELPER(vfp_fcvt_f32_to_f16)(float32 a, void *fpstp, uint32_t ahp_mode) | ||
338 | +uint32_t HELPER(vfp_fcvt_f32_to_f16)(float32 a, void *fpstp, uint32_t ahp_mode) | ||
339 | { | ||
340 | /* Squash FZ16 to 0 for the duration of conversion. In this case, | ||
341 | * it would affect flushing output denormals. | ||
342 | @@ -XXX,XX +XXX,XX @@ float16 HELPER(vfp_fcvt_f32_to_f16)(float32 a, void *fpstp, uint32_t ahp_mode) | ||
343 | return r; | ||
344 | } | ||
345 | |||
346 | -float64 HELPER(vfp_fcvt_f16_to_f64)(float16 a, void *fpstp, uint32_t ahp_mode) | ||
347 | +float64 HELPER(vfp_fcvt_f16_to_f64)(uint32_t a, void *fpstp, uint32_t ahp_mode) | ||
348 | { | ||
349 | /* Squash FZ16 to 0 for the duration of conversion. In this case, | ||
350 | * it would affect flushing input denormals. | ||
351 | @@ -XXX,XX +XXX,XX @@ float64 HELPER(vfp_fcvt_f16_to_f64)(float16 a, void *fpstp, uint32_t ahp_mode) | ||
352 | return r; | ||
353 | } | ||
354 | |||
355 | -float16 HELPER(vfp_fcvt_f64_to_f16)(float64 a, void *fpstp, uint32_t ahp_mode) | ||
356 | +uint32_t HELPER(vfp_fcvt_f64_to_f16)(float64 a, void *fpstp, uint32_t ahp_mode) | ||
357 | { | ||
358 | /* Squash FZ16 to 0 for the duration of conversion. In this case, | ||
359 | * it would affect flushing output denormals. | ||
360 | @@ -XXX,XX +XXX,XX @@ static bool round_to_inf(float_status *fpst, bool sign_bit) | ||
361 | g_assert_not_reached(); | ||
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 | -- | 38 | -- |
379 | 2.17.1 | 39 | 2.20.1 |
380 | 40 | ||
381 | 41 | diff view generated by jsdifflib |
1 | Add entries to MAINTAINERS to cover the newer MPS2 boards and | 1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> |
---|---|---|---|
2 | the new devices they use. | ||
3 | 2 | ||
3 | 'ARM SBCon two-wire serial bus interface' is the official | ||
4 | name describing the pair of registers used to bitbanging | ||
5 | I2C in the Versatile boards. | ||
6 | |||
7 | Make the private VersatileI2CState structure as public | ||
8 | ArmSbconI2CState. | ||
9 | Add the TYPE_ARM_SBCON_I2C, alias to our current | ||
10 | TYPE_VERSATILE_I2C model. | ||
11 | Rename the memory region description as 'arm_sbcon_i2c'. | ||
12 | |||
13 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
14 | Message-id: 20200617072539.32686-5-f4bug@amsat.org | ||
15 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
4 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 16 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
5 | Message-id: 20180518153157.14899-1-peter.maydell@linaro.org | ||
6 | --- | 17 | --- |
7 | MAINTAINERS | 9 +++++++-- | 18 | include/hw/i2c/arm_sbcon_i2c.h | 35 ++++++++++++++++++++++++++++++++++ |
8 | 1 file changed, 7 insertions(+), 2 deletions(-) | 19 | hw/i2c/versatile_i2c.c | 17 +++++------------ |
20 | MAINTAINERS | 1 + | ||
21 | 3 files changed, 41 insertions(+), 12 deletions(-) | ||
22 | create mode 100644 include/hw/i2c/arm_sbcon_i2c.h | ||
9 | 23 | ||
24 | diff --git a/include/hw/i2c/arm_sbcon_i2c.h b/include/hw/i2c/arm_sbcon_i2c.h | ||
25 | new file mode 100644 | ||
26 | index XXXXXXX..XXXXXXX | ||
27 | --- /dev/null | ||
28 | +++ b/include/hw/i2c/arm_sbcon_i2c.h | ||
29 | @@ -XXX,XX +XXX,XX @@ | ||
30 | +/* | ||
31 | + * ARM SBCon two-wire serial bus interface (I2C bitbang) | ||
32 | + * a.k.a. | ||
33 | + * ARM Versatile I2C controller | ||
34 | + * | ||
35 | + * Copyright (c) 2006-2007 CodeSourcery. | ||
36 | + * Copyright (c) 2012 Oskar Andero <oskar.andero@gmail.com> | ||
37 | + * Copyright (C) 2020 Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
38 | + * | ||
39 | + * SPDX-License-Identifier: GPL-2.0-or-later | ||
40 | + */ | ||
41 | +#ifndef HW_I2C_ARM_SBCON_H | ||
42 | +#define HW_I2C_ARM_SBCON_H | ||
43 | + | ||
44 | +#include "hw/sysbus.h" | ||
45 | +#include "hw/i2c/bitbang_i2c.h" | ||
46 | + | ||
47 | +#define TYPE_VERSATILE_I2C "versatile_i2c" | ||
48 | +#define TYPE_ARM_SBCON_I2C TYPE_VERSATILE_I2C | ||
49 | + | ||
50 | +#define ARM_SBCON_I2C(obj) \ | ||
51 | + OBJECT_CHECK(ArmSbconI2CState, (obj), TYPE_ARM_SBCON_I2C) | ||
52 | + | ||
53 | +typedef struct ArmSbconI2CState { | ||
54 | + /*< private >*/ | ||
55 | + SysBusDevice parent_obj; | ||
56 | + /*< public >*/ | ||
57 | + | ||
58 | + MemoryRegion iomem; | ||
59 | + bitbang_i2c_interface bitbang; | ||
60 | + int out; | ||
61 | + int in; | ||
62 | +} ArmSbconI2CState; | ||
63 | + | ||
64 | +#endif /* HW_I2C_ARM_SBCON_H */ | ||
65 | diff --git a/hw/i2c/versatile_i2c.c b/hw/i2c/versatile_i2c.c | ||
66 | index XXXXXXX..XXXXXXX 100644 | ||
67 | --- a/hw/i2c/versatile_i2c.c | ||
68 | +++ b/hw/i2c/versatile_i2c.c | ||
69 | @@ -XXX,XX +XXX,XX @@ | ||
70 | /* | ||
71 | - * ARM Versatile I2C controller | ||
72 | + * ARM SBCon two-wire serial bus interface (I2C bitbang) | ||
73 | + * a.k.a. ARM Versatile I2C controller | ||
74 | * | ||
75 | * Copyright (c) 2006-2007 CodeSourcery. | ||
76 | * Copyright (c) 2012 Oskar Andero <oskar.andero@gmail.com> | ||
77 | @@ -XXX,XX +XXX,XX @@ | ||
78 | */ | ||
79 | |||
80 | #include "qemu/osdep.h" | ||
81 | -#include "hw/sysbus.h" | ||
82 | -#include "hw/i2c/bitbang_i2c.h" | ||
83 | +#include "hw/i2c/arm_sbcon_i2c.h" | ||
84 | #include "hw/registerfields.h" | ||
85 | #include "qemu/log.h" | ||
86 | #include "qemu/module.h" | ||
87 | |||
88 | -#define TYPE_VERSATILE_I2C "versatile_i2c" | ||
89 | #define VERSATILE_I2C(obj) \ | ||
90 | OBJECT_CHECK(VersatileI2CState, (obj), TYPE_VERSATILE_I2C) | ||
91 | |||
92 | -typedef struct VersatileI2CState { | ||
93 | - SysBusDevice parent_obj; | ||
94 | +typedef ArmSbconI2CState VersatileI2CState; | ||
95 | |||
96 | - MemoryRegion iomem; | ||
97 | - bitbang_i2c_interface bitbang; | ||
98 | - int out; | ||
99 | - int in; | ||
100 | -} VersatileI2CState; | ||
101 | |||
102 | REG32(CONTROL_GET, 0) | ||
103 | REG32(CONTROL_SET, 0) | ||
104 | @@ -XXX,XX +XXX,XX @@ static void versatile_i2c_init(Object *obj) | ||
105 | bus = i2c_init_bus(dev, "i2c"); | ||
106 | bitbang_i2c_init(&s->bitbang, bus); | ||
107 | memory_region_init_io(&s->iomem, obj, &versatile_i2c_ops, s, | ||
108 | - "versatile_i2c", 0x1000); | ||
109 | + "arm_sbcon_i2c", 0x1000); | ||
110 | sysbus_init_mmio(sbd, &s->iomem); | ||
111 | } | ||
112 | |||
10 | diff --git a/MAINTAINERS b/MAINTAINERS | 113 | diff --git a/MAINTAINERS b/MAINTAINERS |
11 | index XXXXXXX..XXXXXXX 100644 | 114 | index XXXXXXX..XXXXXXX 100644 |
12 | --- a/MAINTAINERS | 115 | --- a/MAINTAINERS |
13 | +++ b/MAINTAINERS | 116 | +++ b/MAINTAINERS |
14 | @@ -XXX,XX +XXX,XX @@ F: hw/timer/cmsdk-apb-timer.c | ||
15 | F: include/hw/timer/cmsdk-apb-timer.h | ||
16 | F: hw/char/cmsdk-apb-uart.c | ||
17 | F: include/hw/char/cmsdk-apb-uart.h | ||
18 | +F: hw/misc/tz-ppc.c | ||
19 | +F: include/hw/misc/tz-ppc.h | ||
20 | |||
21 | ARM cores | ||
22 | M: Peter Maydell <peter.maydell@linaro.org> | ||
23 | @@ -XXX,XX +XXX,XX @@ M: Peter Maydell <peter.maydell@linaro.org> | 117 | @@ -XXX,XX +XXX,XX @@ M: Peter Maydell <peter.maydell@linaro.org> |
24 | L: qemu-arm@nongnu.org | 118 | L: qemu-arm@nongnu.org |
25 | S: Maintained | 119 | S: Maintained |
26 | F: hw/arm/mps2.c | 120 | F: hw/*/versatile* |
27 | -F: hw/misc/mps2-scc.c | 121 | +F: include/hw/i2c/arm_sbcon_i2c.h |
28 | -F: include/hw/misc/mps2-scc.h | 122 | F: hw/misc/arm_sysctl.c |
29 | +F: hw/arm/mps2-tz.c | 123 | F: docs/system/arm/versatile.rst |
30 | +F: hw/misc/mps2-*.c | 124 | |
31 | +F: include/hw/misc/mps2-*.h | ||
32 | +F: hw/arm/iotkit.c | ||
33 | +F: include/hw/arm/iotkit.h | ||
34 | |||
35 | Musicpal | ||
36 | M: Jan Kiszka <jan.kiszka@web.de> | ||
37 | -- | 125 | -- |
38 | 2.17.1 | 126 | 2.20.1 |
39 | 127 | ||
40 | 128 | diff view generated by jsdifflib |
1 | From: Jan Kiszka <jan.kiszka@siemens.com> | 1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> |
---|---|---|---|
2 | 2 | ||
3 | There was a nasty flip in identifying which register group an access is | 3 | By using the TYPE_* definitions for devices, we can: |
4 | targeting. The issue caused spuriously raised priorities of the guest | 4 | - quickly find where devices are used with 'git-grep' |
5 | when handing CPUs over in the Jailhouse hypervisor. | 5 | - easily rename a device (one-line change). |
6 | 6 | ||
7 | Cc: qemu-stable@nongnu.org | 7 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> |
8 | Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> | 8 | Message-id: 20200617072539.32686-6-f4bug@amsat.org |
9 | Message-id: 28b927d3-da58-bce4-cc13-bfec7f9b1cb9@siemens.com | ||
10 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
12 | --- | 11 | --- |
13 | hw/intc/arm_gicv3_cpuif.c | 12 ++++++------ | 12 | hw/arm/realview.c | 3 ++- |
14 | 1 file changed, 6 insertions(+), 6 deletions(-) | 13 | hw/arm/versatilepb.c | 3 ++- |
14 | hw/arm/vexpress.c | 3 ++- | ||
15 | 3 files changed, 6 insertions(+), 3 deletions(-) | ||
15 | 16 | ||
16 | diff --git a/hw/intc/arm_gicv3_cpuif.c b/hw/intc/arm_gicv3_cpuif.c | 17 | diff --git a/hw/arm/realview.c b/hw/arm/realview.c |
17 | index XXXXXXX..XXXXXXX 100644 | 18 | index XXXXXXX..XXXXXXX 100644 |
18 | --- a/hw/intc/arm_gicv3_cpuif.c | 19 | --- a/hw/arm/realview.c |
19 | +++ b/hw/intc/arm_gicv3_cpuif.c | 20 | +++ b/hw/arm/realview.c |
20 | @@ -XXX,XX +XXX,XX @@ static uint64_t icv_ap_read(CPUARMState *env, const ARMCPRegInfo *ri) | 21 | @@ -XXX,XX +XXX,XX @@ |
21 | { | 22 | #include "hw/cpu/a9mpcore.h" |
22 | GICv3CPUState *cs = icc_cs_from_env(env); | 23 | #include "hw/intc/realview_gic.h" |
23 | int regno = ri->opc2 & 3; | 24 | #include "hw/irq.h" |
24 | - int grp = ri->crm & 1 ? GICV3_G0 : GICV3_G1NS; | 25 | +#include "hw/i2c/arm_sbcon_i2c.h" |
25 | + int grp = (ri->crm & 1) ? GICV3_G1NS : GICV3_G0; | 26 | |
26 | uint64_t value = cs->ich_apr[grp][regno]; | 27 | #define SMP_BOOT_ADDR 0xe0000000 |
27 | 28 | #define SMP_BOOTREG_ADDR 0x10000030 | |
28 | trace_gicv3_icv_ap_read(ri->crm & 1, regno, gicv3_redist_affid(cs), value); | 29 | @@ -XXX,XX +XXX,XX @@ static void realview_init(MachineState *machine, |
29 | @@ -XXX,XX +XXX,XX @@ static void icv_ap_write(CPUARMState *env, const ARMCPRegInfo *ri, | 30 | } |
30 | { | 31 | } |
31 | GICv3CPUState *cs = icc_cs_from_env(env); | 32 | |
32 | int regno = ri->opc2 & 3; | 33 | - dev = sysbus_create_simple("versatile_i2c", 0x10002000, NULL); |
33 | - int grp = ri->crm & 1 ? GICV3_G0 : GICV3_G1NS; | 34 | + dev = sysbus_create_simple(TYPE_VERSATILE_I2C, 0x10002000, NULL); |
34 | + int grp = (ri->crm & 1) ? GICV3_G1NS : GICV3_G0; | 35 | i2c = (I2CBus *)qdev_get_child_bus(dev, "i2c"); |
35 | 36 | i2c_create_slave(i2c, "ds1338", 0x68); | |
36 | trace_gicv3_icv_ap_write(ri->crm & 1, regno, gicv3_redist_affid(cs), value); | 37 | |
37 | 38 | diff --git a/hw/arm/versatilepb.c b/hw/arm/versatilepb.c | |
38 | @@ -XXX,XX +XXX,XX @@ static uint64_t icc_ap_read(CPUARMState *env, const ARMCPRegInfo *ri) | 39 | index XXXXXXX..XXXXXXX 100644 |
39 | uint64_t value; | 40 | --- a/hw/arm/versatilepb.c |
40 | 41 | +++ b/hw/arm/versatilepb.c | |
41 | int regno = ri->opc2 & 3; | 42 | @@ -XXX,XX +XXX,XX @@ |
42 | - int grp = ri->crm & 1 ? GICV3_G0 : GICV3_G1; | 43 | #include "sysemu/sysemu.h" |
43 | + int grp = (ri->crm & 1) ? GICV3_G1 : GICV3_G0; | 44 | #include "hw/pci/pci.h" |
44 | 45 | #include "hw/i2c/i2c.h" | |
45 | if (icv_access(env, grp == GICV3_G0 ? HCR_FMO : HCR_IMO)) { | 46 | +#include "hw/i2c/arm_sbcon_i2c.h" |
46 | return icv_ap_read(env, ri); | 47 | #include "hw/irq.h" |
47 | @@ -XXX,XX +XXX,XX @@ static void icc_ap_write(CPUARMState *env, const ARMCPRegInfo *ri, | 48 | #include "hw/boards.h" |
48 | GICv3CPUState *cs = icc_cs_from_env(env); | 49 | #include "exec/address-spaces.h" |
49 | 50 | @@ -XXX,XX +XXX,XX @@ static void versatile_init(MachineState *machine, int board_id) | |
50 | int regno = ri->opc2 & 3; | 51 | /* Add PL031 Real Time Clock. */ |
51 | - int grp = ri->crm & 1 ? GICV3_G0 : GICV3_G1; | 52 | sysbus_create_simple("pl031", 0x101e8000, pic[10]); |
52 | + int grp = (ri->crm & 1) ? GICV3_G1 : GICV3_G0; | 53 | |
53 | 54 | - dev = sysbus_create_simple("versatile_i2c", 0x10002000, NULL); | |
54 | if (icv_access(env, grp == GICV3_G0 ? HCR_FMO : HCR_IMO)) { | 55 | + dev = sysbus_create_simple(TYPE_VERSATILE_I2C, 0x10002000, NULL); |
55 | icv_ap_write(env, ri, value); | 56 | i2c = (I2CBus *)qdev_get_child_bus(dev, "i2c"); |
56 | @@ -XXX,XX +XXX,XX @@ static uint64_t ich_ap_read(CPUARMState *env, const ARMCPRegInfo *ri) | 57 | i2c_create_slave(i2c, "ds1338", 0x68); |
57 | { | 58 | |
58 | GICv3CPUState *cs = icc_cs_from_env(env); | 59 | diff --git a/hw/arm/vexpress.c b/hw/arm/vexpress.c |
59 | int regno = ri->opc2 & 3; | 60 | index XXXXXXX..XXXXXXX 100644 |
60 | - int grp = ri->crm & 1 ? GICV3_G0 : GICV3_G1NS; | 61 | --- a/hw/arm/vexpress.c |
61 | + int grp = (ri->crm & 1) ? GICV3_G1NS : GICV3_G0; | 62 | +++ b/hw/arm/vexpress.c |
62 | uint64_t value; | 63 | @@ -XXX,XX +XXX,XX @@ |
63 | 64 | #include "hw/char/pl011.h" | |
64 | value = cs->ich_apr[grp][regno]; | 65 | #include "hw/cpu/a9mpcore.h" |
65 | @@ -XXX,XX +XXX,XX @@ static void ich_ap_write(CPUARMState *env, const ARMCPRegInfo *ri, | 66 | #include "hw/cpu/a15mpcore.h" |
66 | { | 67 | +#include "hw/i2c/arm_sbcon_i2c.h" |
67 | GICv3CPUState *cs = icc_cs_from_env(env); | 68 | |
68 | int regno = ri->opc2 & 3; | 69 | #define VEXPRESS_BOARD_ID 0x8e0 |
69 | - int grp = ri->crm & 1 ? GICV3_G0 : GICV3_G1NS; | 70 | #define VEXPRESS_FLASH_SIZE (64 * 1024 * 1024) |
70 | + int grp = (ri->crm & 1) ? GICV3_G1NS : GICV3_G0; | 71 | @@ -XXX,XX +XXX,XX @@ static void vexpress_common_init(MachineState *machine) |
71 | 72 | sysbus_create_simple("sp804", map[VE_TIMER01], pic[2]); | |
72 | trace_gicv3_ich_ap_write(ri->crm & 1, regno, gicv3_redist_affid(cs), value); | 73 | sysbus_create_simple("sp804", map[VE_TIMER23], pic[3]); |
74 | |||
75 | - dev = sysbus_create_simple("versatile_i2c", map[VE_SERIALDVI], NULL); | ||
76 | + dev = sysbus_create_simple(TYPE_VERSATILE_I2C, map[VE_SERIALDVI], NULL); | ||
77 | i2c = (I2CBus *)qdev_get_child_bus(dev, "i2c"); | ||
78 | i2c_create_slave(i2c, "sii9022", 0x39); | ||
73 | 79 | ||
74 | -- | 80 | -- |
75 | 2.17.1 | 81 | 2.20.1 |
76 | 82 | ||
77 | 83 | 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 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> |
4 | is no enough contiguous memory, the address will be changed. So previous | 4 | Message-id: 20200617072539.32686-7-f4bug@amsat.org |
5 | pointer could not be used any more. It must update the pointer and use | 5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
6 | the new one. | ||
7 | |||
8 | Also, previous codes wrongly use le32 conversion of iort->node_offset | ||
9 | for subsequent computations that will result incorrect value if host is | ||
10 | not litlle endian. So use the non-converted one instead. | ||
11 | |||
12 | Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com> | ||
13 | Reviewed-by: Eric Auger <eric.auger@redhat.com> | ||
14 | Message-id: 1527663951-14552-1-git-send-email-zhaoshenglong@huawei.com | ||
15 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
16 | --- | 7 | --- |
17 | hw/arm/virt-acpi-build.c | 20 +++++++++++++++----- | 8 | hw/arm/mps2.c | 5 ++++- |
18 | 1 file changed, 15 insertions(+), 5 deletions(-) | 9 | 1 file changed, 4 insertions(+), 1 deletion(-) |
19 | 10 | ||
20 | diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c | 11 | diff --git a/hw/arm/mps2.c b/hw/arm/mps2.c |
21 | index XXXXXXX..XXXXXXX 100644 | 12 | index XXXXXXX..XXXXXXX 100644 |
22 | --- a/hw/arm/virt-acpi-build.c | 13 | --- a/hw/arm/mps2.c |
23 | +++ b/hw/arm/virt-acpi-build.c | 14 | +++ b/hw/arm/mps2.c |
24 | @@ -XXX,XX +XXX,XX @@ build_iort(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms) | 15 | @@ -XXX,XX +XXX,XX @@ typedef struct { |
25 | AcpiIortItsGroup *its; | 16 | MemoryRegion blockram_m2; |
26 | AcpiIortTable *iort; | 17 | MemoryRegion blockram_m3; |
27 | AcpiIortSmmu3 *smmu; | 18 | MemoryRegion sram; |
28 | - size_t node_size, iort_length, smmu_offset = 0; | 19 | + /* FPGA APB subsystem */ |
29 | + size_t node_size, iort_node_offset, iort_length, smmu_offset = 0; | 20 | MPS2SCC scc; |
30 | AcpiIortRC *rc; | 21 | + /* CMSDK APB subsystem */ |
31 | 22 | CMSDKAPBDualTimer dualtimer; | |
32 | iort = acpi_data_push(table_data, sizeof(*iort)); | 23 | } MPS2MachineState; |
33 | @@ -XXX,XX +XXX,XX @@ build_iort(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms) | 24 | |
34 | 25 | @@ -XXX,XX +XXX,XX @@ static void mps2_common_init(MachineState *machine) | |
35 | iort_length = sizeof(*iort); | 26 | g_assert_not_reached(); |
36 | iort->node_count = cpu_to_le32(nb_nodes); | ||
37 | - iort->node_offset = cpu_to_le32(sizeof(*iort)); | ||
38 | + /* | ||
39 | + * Use a copy in case table_data->data moves during acpi_data_push | ||
40 | + * operations. | ||
41 | + */ | ||
42 | + iort_node_offset = sizeof(*iort); | ||
43 | + iort->node_offset = cpu_to_le32(iort_node_offset); | ||
44 | |||
45 | /* ITS group node */ | ||
46 | node_size = sizeof(*its) + sizeof(uint32_t); | ||
47 | @@ -XXX,XX +XXX,XX @@ build_iort(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms) | ||
48 | int irq = vms->irqmap[VIRT_SMMU]; | ||
49 | |||
50 | /* SMMUv3 node */ | ||
51 | - smmu_offset = iort->node_offset + node_size; | ||
52 | + smmu_offset = iort_node_offset + node_size; | ||
53 | node_size = sizeof(*smmu) + sizeof(*idmap); | ||
54 | iort_length += node_size; | ||
55 | smmu = acpi_data_push(table_data, node_size); | ||
56 | @@ -XXX,XX +XXX,XX @@ build_iort(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms) | ||
57 | idmap->id_count = cpu_to_le32(0xFFFF); | ||
58 | idmap->output_base = 0; | ||
59 | /* output IORT node is the ITS group node (the first node) */ | ||
60 | - idmap->output_reference = cpu_to_le32(iort->node_offset); | ||
61 | + idmap->output_reference = cpu_to_le32(iort_node_offset); | ||
62 | } | 27 | } |
63 | 28 | ||
64 | /* Root Complex Node */ | 29 | + /* CMSDK APB subsystem */ |
65 | @@ -XXX,XX +XXX,XX @@ build_iort(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms) | 30 | cmsdk_apb_timer_create(0x40000000, qdev_get_gpio_in(armv7m, 8), SYSCLK_FRQ); |
66 | idmap->output_reference = cpu_to_le32(smmu_offset); | 31 | cmsdk_apb_timer_create(0x40001000, qdev_get_gpio_in(armv7m, 9), SYSCLK_FRQ); |
67 | } else { | 32 | - |
68 | /* output IORT node is the ITS group node (the first node) */ | 33 | object_initialize_child(OBJECT(mms), "dualtimer", &mms->dualtimer, |
69 | - idmap->output_reference = cpu_to_le32(iort->node_offset); | 34 | TYPE_CMSDK_APB_DUALTIMER); |
70 | + idmap->output_reference = cpu_to_le32(iort_node_offset); | 35 | qdev_prop_set_uint32(DEVICE(&mms->dualtimer), "pclk-frq", SYSCLK_FRQ); |
71 | } | 36 | @@ -XXX,XX +XXX,XX @@ static void mps2_common_init(MachineState *machine) |
72 | 37 | qdev_get_gpio_in(armv7m, 10)); | |
73 | + /* | 38 | sysbus_mmio_map(SYS_BUS_DEVICE(&mms->dualtimer), 0, 0x40002000); |
74 | + * Update the pointer address in case table_data->data moves during above | 39 | |
75 | + * acpi_data_push operations. | 40 | + /* FPGA APB subsystem */ |
76 | + */ | 41 | object_initialize_child(OBJECT(mms), "scc", &mms->scc, TYPE_MPS2_SCC); |
77 | + iort = (AcpiIortTable *)(table_data->data + iort_start); | 42 | sccdev = DEVICE(&mms->scc); |
78 | iort->length = cpu_to_le32(iort_length); | 43 | qdev_prop_set_uint32(sccdev, "scc-cfg4", 0x2); |
79 | |||
80 | build_header(linker, table_data, (void *)(table_data->data + iort_start), | ||
81 | -- | 44 | -- |
82 | 2.17.1 | 45 | 2.20.1 |
83 | 46 | ||
84 | 47 | diff view generated by jsdifflib |
1 | As part of plumbing MemTxAttrs down to the IOMMU translate method, | 1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> |
---|---|---|---|
2 | add MemTxAttrs as an argument to address_space_translate_iommu(). | ||
3 | 2 | ||
3 | To differenciate with the CMSDK APB peripheral region, | ||
4 | rename this region 'CMSDK AHB peripheral region'. | ||
5 | |||
6 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
8 | Message-id: 20200617072539.32686-8-f4bug@amsat.org | ||
4 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
5 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | ||
6 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Message-id: 20180521140402.23318-14-peter.maydell@linaro.org | ||
8 | --- | 10 | --- |
9 | exec.c | 8 +++++--- | 11 | hw/arm/mps2.c | 3 ++- |
10 | 1 file changed, 5 insertions(+), 3 deletions(-) | 12 | 1 file changed, 2 insertions(+), 1 deletion(-) |
11 | 13 | ||
12 | diff --git a/exec.c b/exec.c | 14 | diff --git a/hw/arm/mps2.c b/hw/arm/mps2.c |
13 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
14 | --- a/exec.c | 16 | --- a/hw/arm/mps2.c |
15 | +++ b/exec.c | 17 | +++ b/hw/arm/mps2.c |
16 | @@ -XXX,XX +XXX,XX @@ address_space_translate_internal(AddressSpaceDispatch *d, hwaddr addr, hwaddr *x | 18 | @@ -XXX,XX +XXX,XX @@ static void mps2_common_init(MachineState *machine) |
17 | * @is_write: whether the translation operation is for write | 19 | */ |
18 | * @is_mmio: whether this can be MMIO, set true if it can | 20 | create_unimplemented_device("CMSDK APB peripheral region @0x40000000", |
19 | * @target_as: the address space targeted by the IOMMU | 21 | 0x40000000, 0x00010000); |
20 | + * @attrs: transaction attributes | 22 | - create_unimplemented_device("CMSDK peripheral region @0x40010000", |
21 | * | 23 | + create_unimplemented_device("CMSDK AHB peripheral region @0x40010000", |
22 | * This function is called from RCU critical section. It is the common | 24 | 0x40010000, 0x00010000); |
23 | * part of flatview_do_translate and address_space_translate_cached. | 25 | create_unimplemented_device("Extra peripheral region @0x40020000", |
24 | @@ -XXX,XX +XXX,XX @@ static MemoryRegionSection address_space_translate_iommu(IOMMUMemoryRegion *iomm | 26 | 0x40020000, 0x00010000); |
25 | hwaddr *page_mask_out, | 27 | + |
26 | bool is_write, | 28 | create_unimplemented_device("RESERVED 4", 0x40030000, 0x001D0000); |
27 | bool is_mmio, | 29 | create_unimplemented_device("VGA", 0x41000000, 0x0200000); |
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 | } | ||
51 | 30 | ||
52 | -- | 31 | -- |
53 | 2.17.1 | 32 | 2.20.1 |
54 | 33 | ||
55 | 34 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
1 | 2 | ||
3 | We already model the CMSDK APB watchdog device, let's use it! | ||
4 | |||
5 | Suggested-by: Peter Maydell <peter.maydell@linaro.org> | ||
6 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
7 | Message-id: 20200617072539.32686-9-f4bug@amsat.org | ||
8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | --- | ||
11 | hw/arm/mps2.c | 7 +++++++ | ||
12 | hw/arm/Kconfig | 1 + | ||
13 | 2 files changed, 8 insertions(+) | ||
14 | |||
15 | diff --git a/hw/arm/mps2.c b/hw/arm/mps2.c | ||
16 | index XXXXXXX..XXXXXXX 100644 | ||
17 | --- a/hw/arm/mps2.c | ||
18 | +++ b/hw/arm/mps2.c | ||
19 | @@ -XXX,XX +XXX,XX @@ static void mps2_common_init(MachineState *machine) | ||
20 | sysbus_connect_irq(SYS_BUS_DEVICE(&mms->dualtimer), 0, | ||
21 | qdev_get_gpio_in(armv7m, 10)); | ||
22 | sysbus_mmio_map(SYS_BUS_DEVICE(&mms->dualtimer), 0, 0x40002000); | ||
23 | + object_initialize_child(OBJECT(mms), "watchdog", &mms->watchdog, | ||
24 | + TYPE_CMSDK_APB_WATCHDOG); | ||
25 | + qdev_prop_set_uint32(DEVICE(&mms->watchdog), "wdogclk-frq", SYSCLK_FRQ); | ||
26 | + sysbus_realize(SYS_BUS_DEVICE(&mms->watchdog), &error_fatal); | ||
27 | + sysbus_connect_irq(SYS_BUS_DEVICE(&mms->watchdog), 0, | ||
28 | + qdev_get_gpio_in_named(armv7m, "NMI", 0)); | ||
29 | + sysbus_mmio_map(SYS_BUS_DEVICE(&mms->watchdog), 0, 0x40008000); | ||
30 | |||
31 | /* FPGA APB subsystem */ | ||
32 | object_initialize_child(OBJECT(mms), "scc", &mms->scc, TYPE_MPS2_SCC); | ||
33 | diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig | ||
34 | index XXXXXXX..XXXXXXX 100644 | ||
35 | --- a/hw/arm/Kconfig | ||
36 | +++ b/hw/arm/Kconfig | ||
37 | @@ -XXX,XX +XXX,XX @@ config MPS2 | ||
38 | select PL080 # DMA controller | ||
39 | select SPLIT_IRQ | ||
40 | select UNIMP | ||
41 | + select CMSDK_APB_WATCHDOG | ||
42 | |||
43 | config FSL_IMX7 | ||
44 | bool | ||
45 | -- | ||
46 | 2.20.1 | ||
47 | |||
48 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
1 | 2 | ||
3 | Register the GPIO peripherals as unimplemented to better | ||
4 | follow their accesses, for example booting Zephyr: | ||
5 | |||
6 | ---------------- | ||
7 | IN: arm_mps2_pinmux_init | ||
8 | 0x00001160: f64f 0231 movw r2, #0xf831 | ||
9 | 0x00001164: 4b06 ldr r3, [pc, #0x18] | ||
10 | 0x00001166: 2000 movs r0, #0 | ||
11 | 0x00001168: 619a str r2, [r3, #0x18] | ||
12 | 0x0000116a: f24c 426f movw r2, #0xc46f | ||
13 | 0x0000116e: f503 5380 add.w r3, r3, #0x1000 | ||
14 | 0x00001172: 619a str r2, [r3, #0x18] | ||
15 | 0x00001174: f44f 529e mov.w r2, #0x13c0 | ||
16 | 0x00001178: f503 5380 add.w r3, r3, #0x1000 | ||
17 | 0x0000117c: 619a str r2, [r3, #0x18] | ||
18 | 0x0000117e: 4770 bx lr | ||
19 | cmsdk-ahb-gpio: unimplemented device write (size 4, value 0xf831, offset 0x18) | ||
20 | cmsdk-ahb-gpio: unimplemented device write (size 4, value 0xc46f, offset 0x18) | ||
21 | cmsdk-ahb-gpio: unimplemented device write (size 4, value 0x13c0, offset 0x18) | ||
22 | |||
23 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
24 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
25 | Message-id: 20200617072539.32686-10-f4bug@amsat.org | ||
26 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
27 | --- | ||
28 | hw/arm/mps2.c | 8 ++++++-- | ||
29 | 1 file changed, 6 insertions(+), 2 deletions(-) | ||
30 | |||
31 | diff --git a/hw/arm/mps2.c b/hw/arm/mps2.c | ||
32 | index XXXXXXX..XXXXXXX 100644 | ||
33 | --- a/hw/arm/mps2.c | ||
34 | +++ b/hw/arm/mps2.c | ||
35 | @@ -XXX,XX +XXX,XX @@ static void mps2_common_init(MachineState *machine) | ||
36 | MemoryRegion *system_memory = get_system_memory(); | ||
37 | MachineClass *mc = MACHINE_GET_CLASS(machine); | ||
38 | DeviceState *armv7m, *sccdev; | ||
39 | + int i; | ||
40 | |||
41 | if (strcmp(machine->cpu_type, mc->default_cpu_type) != 0) { | ||
42 | error_report("This board can only be used with CPU %s", | ||
43 | @@ -XXX,XX +XXX,XX @@ static void mps2_common_init(MachineState *machine) | ||
44 | */ | ||
45 | Object *orgate; | ||
46 | DeviceState *orgate_dev; | ||
47 | - int i; | ||
48 | |||
49 | orgate = object_new(TYPE_OR_IRQ); | ||
50 | object_property_set_int(orgate, 6, "num-lines", &error_fatal); | ||
51 | @@ -XXX,XX +XXX,XX @@ static void mps2_common_init(MachineState *machine) | ||
52 | */ | ||
53 | Object *orgate; | ||
54 | DeviceState *orgate_dev; | ||
55 | - int i; | ||
56 | |||
57 | orgate = object_new(TYPE_OR_IRQ); | ||
58 | object_property_set_int(orgate, 10, "num-lines", &error_fatal); | ||
59 | @@ -XXX,XX +XXX,XX @@ static void mps2_common_init(MachineState *machine) | ||
60 | default: | ||
61 | g_assert_not_reached(); | ||
62 | } | ||
63 | + for (i = 0; i < 4; i++) { | ||
64 | + static const hwaddr gpiobase[] = {0x40010000, 0x40011000, | ||
65 | + 0x40012000, 0x40013000}; | ||
66 | + create_unimplemented_device("cmsdk-ahb-gpio", gpiobase[i], 0x1000); | ||
67 | + } | ||
68 | |||
69 | /* CMSDK APB subsystem */ | ||
70 | cmsdk_apb_timer_create(0x40000000, qdev_get_gpio_in(armv7m, 8), SYSCLK_FRQ); | ||
71 | -- | ||
72 | 2.20.1 | ||
73 | |||
74 | diff view generated by jsdifflib |
1 | From: Shannon Zhao <zhaoshenglong@huawei.com> | 1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> |
---|---|---|---|
2 | 2 | ||
3 | kvm_irqchip_create called by kvm_init will call kvm_init_irq_routing to | 3 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> |
4 | initialize global capability variables. If we call kvm_init_irq_routing in | 4 | Message-id: 20200617072539.32686-11-f4bug@amsat.org |
5 | GIC realize function, previous allocated memory will leak. | 5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
6 | |||
7 | Fix this by deleting the unnecessary call. | ||
8 | |||
9 | Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com> | ||
10 | Reviewed-by: Eric Auger <eric.auger@redhat.com> | ||
11 | Message-id: 1527750994-14360-1-git-send-email-zhaoshenglong@huawei.com | ||
12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
13 | --- | 7 | --- |
14 | hw/intc/arm_gic_kvm.c | 1 - | 8 | hw/arm/mps2.c | 9 +++++++++ |
15 | hw/intc/arm_gicv3_kvm.c | 1 - | 9 | 1 file changed, 9 insertions(+) |
16 | 2 files changed, 2 deletions(-) | ||
17 | 10 | ||
18 | diff --git a/hw/intc/arm_gic_kvm.c b/hw/intc/arm_gic_kvm.c | 11 | diff --git a/hw/arm/mps2.c b/hw/arm/mps2.c |
19 | index XXXXXXX..XXXXXXX 100644 | 12 | index XXXXXXX..XXXXXXX 100644 |
20 | --- a/hw/intc/arm_gic_kvm.c | 13 | --- a/hw/arm/mps2.c |
21 | +++ b/hw/intc/arm_gic_kvm.c | 14 | +++ b/hw/arm/mps2.c |
22 | @@ -XXX,XX +XXX,XX @@ static void kvm_arm_gic_realize(DeviceState *dev, Error **errp) | 15 | @@ -XXX,XX +XXX,XX @@ |
23 | 16 | #include "hw/timer/cmsdk-apb-timer.h" | |
24 | if (kvm_has_gsi_routing()) { | 17 | #include "hw/timer/cmsdk-apb-dualtimer.h" |
25 | /* set up irq routing */ | 18 | #include "hw/misc/mps2-scc.h" |
26 | - kvm_init_irq_routing(kvm_state); | 19 | +#include "hw/misc/mps2-fpgaio.h" |
27 | for (i = 0; i < s->num_irq - GIC_INTERNAL; ++i) { | 20 | #include "hw/net/lan9118.h" |
28 | kvm_irqchip_add_irq_route(kvm_state, i, 0, i); | 21 | #include "net/net.h" |
29 | } | 22 | +#include "hw/watchdog/cmsdk-apb-watchdog.h" |
30 | diff --git a/hw/intc/arm_gicv3_kvm.c b/hw/intc/arm_gicv3_kvm.c | 23 | |
31 | index XXXXXXX..XXXXXXX 100644 | 24 | typedef enum MPS2FPGAType { |
32 | --- a/hw/intc/arm_gicv3_kvm.c | 25 | FPGA_AN385, |
33 | +++ b/hw/intc/arm_gicv3_kvm.c | 26 | @@ -XXX,XX +XXX,XX @@ typedef struct { |
34 | @@ -XXX,XX +XXX,XX @@ static void kvm_arm_gicv3_realize(DeviceState *dev, Error **errp) | 27 | MemoryRegion sram; |
35 | 28 | /* FPGA APB subsystem */ | |
36 | if (kvm_has_gsi_routing()) { | 29 | MPS2SCC scc; |
37 | /* set up irq routing */ | 30 | + MPS2FPGAIO fpgaio; |
38 | - kvm_init_irq_routing(kvm_state); | 31 | /* CMSDK APB subsystem */ |
39 | for (i = 0; i < s->num_irq - GIC_INTERNAL; ++i) { | 32 | CMSDKAPBDualTimer dualtimer; |
40 | kvm_irqchip_add_irq_route(kvm_state, i, 0, i); | 33 | + CMSDKAPBWatchdog watchdog; |
41 | } | 34 | } MPS2MachineState; |
35 | |||
36 | #define TYPE_MPS2_MACHINE "mps2" | ||
37 | @@ -XXX,XX +XXX,XX @@ static void mps2_common_init(MachineState *machine) | ||
38 | qdev_prop_set_uint32(sccdev, "scc-id", mmc->scc_id); | ||
39 | sysbus_realize(SYS_BUS_DEVICE(&mms->scc), &error_fatal); | ||
40 | sysbus_mmio_map(SYS_BUS_DEVICE(sccdev), 0, 0x4002f000); | ||
41 | + object_initialize_child(OBJECT(mms), "fpgaio", | ||
42 | + &mms->fpgaio, TYPE_MPS2_FPGAIO); | ||
43 | + qdev_prop_set_uint32(DEVICE(&mms->fpgaio), "prescale-clk", 25000000); | ||
44 | + sysbus_realize(SYS_BUS_DEVICE(&mms->fpgaio), &error_fatal); | ||
45 | + sysbus_mmio_map(SYS_BUS_DEVICE(&mms->fpgaio), 0, 0x40028000); | ||
46 | |||
47 | /* In hardware this is a LAN9220; the LAN9118 is software compatible | ||
48 | * except that it doesn't support the checksum-offload feature. | ||
42 | -- | 49 | -- |
43 | 2.17.1 | 50 | 2.20.1 |
44 | 51 | ||
45 | 52 | diff view generated by jsdifflib |
1 | From: Francisco Iglesias <frasse.iglesias@gmail.com> | 1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> |
---|---|---|---|
2 | 2 | ||
3 | Coverity found that the string return by 'object_get_canonical_path' was not | 3 | From 'Application Note AN385', chapter 3.9, SPI: |
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 | The SMM implements five PL022 SPI modules. |
11 | Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | 6 | |
12 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 7 | Two pairs of modules share the same OR-gated IRQ. |
13 | Message-id: 20180528184859.3530-1-frasse.iglesias@gmail.com | 8 | |
9 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
10 | Message-id: 20200617072539.32686-12-f4bug@amsat.org | ||
14 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 11 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
15 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
16 | --- | 13 | --- |
17 | hw/dma/xlnx-zdma.c | 10 +++++++--- | 14 | hw/arm/mps2.c | 24 ++++++++++++++++++++++++ |
18 | 1 file changed, 7 insertions(+), 3 deletions(-) | 15 | hw/arm/Kconfig | 6 +++--- |
16 | 2 files changed, 27 insertions(+), 3 deletions(-) | ||
19 | 17 | ||
20 | diff --git a/hw/dma/xlnx-zdma.c b/hw/dma/xlnx-zdma.c | 18 | diff --git a/hw/arm/mps2.c b/hw/arm/mps2.c |
21 | index XXXXXXX..XXXXXXX 100644 | 19 | index XXXXXXX..XXXXXXX 100644 |
22 | --- a/hw/dma/xlnx-zdma.c | 20 | --- a/hw/arm/mps2.c |
23 | +++ b/hw/dma/xlnx-zdma.c | 21 | +++ b/hw/arm/mps2.c |
24 | @@ -XXX,XX +XXX,XX @@ static bool zdma_load_descriptor(XlnxZDMA *s, uint64_t addr, void *buf) | 22 | @@ -XXX,XX +XXX,XX @@ |
25 | qemu_log_mask(LOG_GUEST_ERROR, | 23 | #include "hw/timer/cmsdk-apb-dualtimer.h" |
26 | "zdma: unaligned descriptor at %" PRIx64, | 24 | #include "hw/misc/mps2-scc.h" |
27 | addr); | 25 | #include "hw/misc/mps2-fpgaio.h" |
28 | - memset(buf, 0xdeadbeef, sizeof(XlnxZDMADescr)); | 26 | +#include "hw/ssi/pl022.h" |
29 | + memset(buf, 0x0, sizeof(XlnxZDMADescr)); | 27 | #include "hw/net/lan9118.h" |
30 | s->error = true; | 28 | #include "net/net.h" |
31 | return false; | 29 | #include "hw/watchdog/cmsdk-apb-watchdog.h" |
32 | } | 30 | @@ -XXX,XX +XXX,XX @@ static void mps2_common_init(MachineState *machine) |
33 | @@ -XXX,XX +XXX,XX @@ static uint64_t zdma_read(void *opaque, hwaddr addr, unsigned size) | 31 | qdev_prop_set_uint32(DEVICE(&mms->fpgaio), "prescale-clk", 25000000); |
34 | RegisterInfo *r = &s->regs_info[addr / 4]; | 32 | sysbus_realize(SYS_BUS_DEVICE(&mms->fpgaio), &error_fatal); |
35 | 33 | sysbus_mmio_map(SYS_BUS_DEVICE(&mms->fpgaio), 0, 0x40028000); | |
36 | if (!r->data) { | 34 | + sysbus_create_simple(TYPE_PL022, 0x40025000, /* External ADC */ |
37 | + gchar *path = object_get_canonical_path(OBJECT(s)); | 35 | + qdev_get_gpio_in(armv7m, 22)); |
38 | qemu_log("%s: Decode error: read from %" HWADDR_PRIx "\n", | 36 | + for (i = 0; i < 2; i++) { |
39 | - object_get_canonical_path(OBJECT(s)), | 37 | + static const int spi_irqno[] = {11, 24}; |
40 | + path, | 38 | + static const hwaddr spibase[] = {0x40020000, /* APB */ |
41 | addr); | 39 | + 0x40021000, /* LCD */ |
42 | + g_free(path); | 40 | + 0x40026000, /* Shield0 */ |
43 | ARRAY_FIELD_DP32(s->regs, ZDMA_CH_ISR, INV_APB, true); | 41 | + 0x40027000}; /* Shield1 */ |
44 | zdma_ch_imr_update_irq(s); | 42 | + DeviceState *orgate_dev; |
45 | return 0; | 43 | + Object *orgate; |
46 | @@ -XXX,XX +XXX,XX @@ static void zdma_write(void *opaque, hwaddr addr, uint64_t value, | 44 | + int j; |
47 | RegisterInfo *r = &s->regs_info[addr / 4]; | 45 | + |
48 | 46 | + orgate = object_new(TYPE_OR_IRQ); | |
49 | if (!r->data) { | 47 | + object_property_set_int(orgate, 2, "num-lines", &error_fatal); |
50 | + gchar *path = object_get_canonical_path(OBJECT(s)); | 48 | + orgate_dev = DEVICE(orgate); |
51 | qemu_log("%s: Decode error: write to %" HWADDR_PRIx "=%" PRIx64 "\n", | 49 | + qdev_realize(orgate_dev, NULL, &error_fatal); |
52 | - object_get_canonical_path(OBJECT(s)), | 50 | + qdev_connect_gpio_out(orgate_dev, 0, |
53 | + path, | 51 | + qdev_get_gpio_in(armv7m, spi_irqno[i])); |
54 | addr, value); | 52 | + for (j = 0; j < 2; j++) { |
55 | + g_free(path); | 53 | + sysbus_create_simple(TYPE_PL022, spibase[2 * i + j], |
56 | ARRAY_FIELD_DP32(s->regs, ZDMA_CH_ISR, INV_APB, true); | 54 | + qdev_get_gpio_in(orgate_dev, j)); |
57 | zdma_ch_imr_update_irq(s); | 55 | + } |
58 | return; | 56 | + } |
57 | |||
58 | /* In hardware this is a LAN9220; the LAN9118 is software compatible | ||
59 | * except that it doesn't support the checksum-offload feature. | ||
60 | diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig | ||
61 | index XXXXXXX..XXXXXXX 100644 | ||
62 | --- a/hw/arm/Kconfig | ||
63 | +++ b/hw/arm/Kconfig | ||
64 | @@ -XXX,XX +XXX,XX @@ config HIGHBANK | ||
65 | select ARM_TIMER # sp804 | ||
66 | select ARM_V7M | ||
67 | select PL011 # UART | ||
68 | - select PL022 # Serial port | ||
69 | + select PL022 # SPI | ||
70 | select PL031 # RTC | ||
71 | select PL061 # GPIO | ||
72 | select PL310 # cache controller | ||
73 | @@ -XXX,XX +XXX,XX @@ config STELLARIS | ||
74 | select CMSDK_APB_WATCHDOG | ||
75 | select I2C | ||
76 | select PL011 # UART | ||
77 | - select PL022 # Serial port | ||
78 | + select PL022 # SPI | ||
79 | select PL061 # GPIO | ||
80 | select SSD0303 # OLED display | ||
81 | select SSD0323 # OLED display | ||
82 | @@ -XXX,XX +XXX,XX @@ config MPS2 | ||
83 | select MPS2_FPGAIO | ||
84 | select MPS2_SCC | ||
85 | select OR_IRQ | ||
86 | - select PL022 # Serial port | ||
87 | + select PL022 # SPI | ||
88 | select PL080 # DMA controller | ||
89 | select SPLIT_IRQ | ||
90 | select UNIMP | ||
59 | -- | 91 | -- |
60 | 2.17.1 | 92 | 2.20.1 |
61 | 93 | ||
62 | 94 | diff view generated by jsdifflib |
1 | From: Paolo Bonzini <pbonzini@redhat.com> | 1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> |
---|---|---|---|
2 | 2 | ||
3 | cpregs_keys is an uint32_t* so the allocation should use uint32_t. | 3 | From 'Application Note AN385', chapter 3.14: |
4 | g_new is even better because it is type-safe. | ||
5 | 4 | ||
6 | Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> | 5 | The SMM implements a simple SBCon interface based on I2C. |
6 | |||
7 | There are 4 SBCon interfaces on the FPGA APB subsystem. | ||
8 | |||
9 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
10 | Message-id: 20200617072539.32686-13-f4bug@amsat.org | ||
7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 11 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
8 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
10 | --- | 13 | --- |
11 | target/arm/gdbstub.c | 3 +-- | 14 | hw/arm/mps2.c | 8 ++++++++ |
12 | 1 file changed, 1 insertion(+), 2 deletions(-) | 15 | hw/arm/Kconfig | 1 + |
16 | 2 files changed, 9 insertions(+) | ||
13 | 17 | ||
14 | diff --git a/target/arm/gdbstub.c b/target/arm/gdbstub.c | 18 | diff --git a/hw/arm/mps2.c b/hw/arm/mps2.c |
15 | index XXXXXXX..XXXXXXX 100644 | 19 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/target/arm/gdbstub.c | 20 | --- a/hw/arm/mps2.c |
17 | +++ b/target/arm/gdbstub.c | 21 | +++ b/hw/arm/mps2.c |
18 | @@ -XXX,XX +XXX,XX @@ int arm_gen_dynamic_xml(CPUState *cs) | 22 | @@ -XXX,XX +XXX,XX @@ |
19 | RegisterSysregXmlParam param = {cs, s}; | 23 | #include "hw/misc/mps2-scc.h" |
20 | 24 | #include "hw/misc/mps2-fpgaio.h" | |
21 | cpu->dyn_xml.num_cpregs = 0; | 25 | #include "hw/ssi/pl022.h" |
22 | - cpu->dyn_xml.cpregs_keys = g_malloc(sizeof(uint32_t *) * | 26 | +#include "hw/i2c/arm_sbcon_i2c.h" |
23 | - g_hash_table_size(cpu->cp_regs)); | 27 | #include "hw/net/lan9118.h" |
24 | + cpu->dyn_xml.cpregs_keys = g_new(uint32_t, g_hash_table_size(cpu->cp_regs)); | 28 | #include "net/net.h" |
25 | g_string_printf(s, "<?xml version=\"1.0\"?>"); | 29 | #include "hw/watchdog/cmsdk-apb-watchdog.h" |
26 | g_string_append_printf(s, "<!DOCTYPE target SYSTEM \"gdb-target.dtd\">"); | 30 | @@ -XXX,XX +XXX,XX @@ static void mps2_common_init(MachineState *machine) |
27 | g_string_append_printf(s, "<feature name=\"org.qemu.gdb.arm.sys.regs\">"); | 31 | qdev_get_gpio_in(orgate_dev, j)); |
32 | } | ||
33 | } | ||
34 | + for (i = 0; i < 4; i++) { | ||
35 | + static const hwaddr i2cbase[] = {0x40022000, /* Touch */ | ||
36 | + 0x40023000, /* Audio */ | ||
37 | + 0x40029000, /* Shield0 */ | ||
38 | + 0x4002a000}; /* Shield1 */ | ||
39 | + sysbus_create_simple(TYPE_ARM_SBCON_I2C, i2cbase[i], NULL); | ||
40 | + } | ||
41 | |||
42 | /* In hardware this is a LAN9220; the LAN9118 is software compatible | ||
43 | * except that it doesn't support the checksum-offload feature. | ||
44 | diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig | ||
45 | index XXXXXXX..XXXXXXX 100644 | ||
46 | --- a/hw/arm/Kconfig | ||
47 | +++ b/hw/arm/Kconfig | ||
48 | @@ -XXX,XX +XXX,XX @@ config MPS2 | ||
49 | select SPLIT_IRQ | ||
50 | select UNIMP | ||
51 | select CMSDK_APB_WATCHDOG | ||
52 | + select VERSATILE_I2C | ||
53 | |||
54 | config FSL_IMX7 | ||
55 | bool | ||
28 | -- | 56 | -- |
29 | 2.17.1 | 57 | 2.20.1 |
30 | 58 | ||
31 | 59 | diff view generated by jsdifflib |
1 | From: Shannon Zhao <zhaoshenglong@huawei.com> | 1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> |
---|---|---|---|
2 | 2 | ||
3 | It forgot to increase clroffset during the loop. So it only clear the | 3 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> |
4 | first 4 bytes. | 4 | Message-id: 20200617072539.32686-14-f4bug@amsat.org |
5 | |||
6 | Fixes: 367b9f527becdd20ddf116e17a3c0c2bbc486920 | ||
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> | 5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
13 | --- | 7 | --- |
14 | hw/intc/arm_gicv3_kvm.c | 1 + | 8 | hw/arm/mps2.c | 1 + |
15 | 1 file changed, 1 insertion(+) | 9 | 1 file changed, 1 insertion(+) |
16 | 10 | ||
17 | diff --git a/hw/intc/arm_gicv3_kvm.c b/hw/intc/arm_gicv3_kvm.c | 11 | diff --git a/hw/arm/mps2.c b/hw/arm/mps2.c |
18 | index XXXXXXX..XXXXXXX 100644 | 12 | index XXXXXXX..XXXXXXX 100644 |
19 | --- a/hw/intc/arm_gicv3_kvm.c | 13 | --- a/hw/arm/mps2.c |
20 | +++ b/hw/intc/arm_gicv3_kvm.c | 14 | +++ b/hw/arm/mps2.c |
21 | @@ -XXX,XX +XXX,XX @@ static void kvm_dist_putbmp(GICv3State *s, uint32_t offset, | 15 | @@ -XXX,XX +XXX,XX @@ static void mps2_common_init(MachineState *machine) |
22 | if (clroffset != 0) { | 16 | 0x4002a000}; /* Shield1 */ |
23 | reg = 0; | 17 | sysbus_create_simple(TYPE_ARM_SBCON_I2C, i2cbase[i], NULL); |
24 | kvm_gicd_access(s, clroffset, ®, true); | 18 | } |
25 | + clroffset += 4; | 19 | + create_unimplemented_device("i2s", 0x40024000, 0x400); |
26 | } | 20 | |
27 | reg = *gic_bmp_ptr32(bmp, irq); | 21 | /* In hardware this is a LAN9220; the LAN9118 is software compatible |
28 | kvm_gicd_access(s, offset, ®, true); | 22 | * except that it doesn't support the checksum-offload feature. |
29 | -- | 23 | -- |
30 | 2.17.1 | 24 | 2.20.1 |
31 | 25 | ||
32 | 26 | diff view generated by jsdifflib |
1 | In commit f0aff255700 we made cpacr_write() enforce that some CPACR | 1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> |
---|---|---|---|
2 | bits are RAZ/WI and some are RAO/WI for ARMv7 cores. Unfortunately | ||
3 | we forgot to also update the register's reset value. The effect | ||
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 | 2 | ||
10 | Implement reset for the CPACR using a custom reset function | 3 | From 'Application Note AN521', chapter 4.7: |
11 | that just calls cpacr_write(), to avoid having to duplicate | ||
12 | the logic for which bits are RAO. | ||
13 | 4 | ||
14 | This bug would affect migration for TCG CPUs which are ARMv7 | 5 | The SMM implements four SBCon serial modules: |
15 | with VFP but without one of Neon or VFPv3. | ||
16 | 6 | ||
17 | Reported-by: Cédric Le Goater <clg@kaod.org> | 7 | One SBCon module for use by the Color LCD touch interface. |
8 | One SBCon module to configure the audio controller. | ||
9 | Two general purpose SBCon modules, that connect to the | ||
10 | Expansion headers J7 and J8, are intended for use with the | ||
11 | V2C-Shield1 which provide an I2C interface on the headers. | ||
12 | |||
13 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
14 | Message-id: 20200617072539.32686-15-f4bug@amsat.org | ||
15 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
18 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 16 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
19 | Tested-by: Cédric Le Goater <clg@kaod.org> | ||
20 | Message-id: 20180522173713.26282-1-peter.maydell@linaro.org | ||
21 | --- | 17 | --- |
22 | target/arm/helper.c | 10 +++++++++- | 18 | hw/arm/mps2-tz.c | 23 ++++++++++++++++++----- |
23 | 1 file changed, 9 insertions(+), 1 deletion(-) | 19 | 1 file changed, 18 insertions(+), 5 deletions(-) |
24 | 20 | ||
25 | diff --git a/target/arm/helper.c b/target/arm/helper.c | 21 | diff --git a/hw/arm/mps2-tz.c b/hw/arm/mps2-tz.c |
26 | index XXXXXXX..XXXXXXX 100644 | 22 | index XXXXXXX..XXXXXXX 100644 |
27 | --- a/target/arm/helper.c | 23 | --- a/hw/arm/mps2-tz.c |
28 | +++ b/target/arm/helper.c | 24 | +++ b/hw/arm/mps2-tz.c |
29 | @@ -XXX,XX +XXX,XX @@ static void cpacr_write(CPUARMState *env, const ARMCPRegInfo *ri, | 25 | @@ -XXX,XX +XXX,XX @@ |
30 | env->cp15.cpacr_el1 = value; | 26 | #include "hw/arm/armsse.h" |
27 | #include "hw/dma/pl080.h" | ||
28 | #include "hw/ssi/pl022.h" | ||
29 | +#include "hw/i2c/arm_sbcon_i2c.h" | ||
30 | #include "hw/net/lan9118.h" | ||
31 | #include "net/net.h" | ||
32 | #include "hw/core/split-irq.h" | ||
33 | @@ -XXX,XX +XXX,XX @@ typedef struct { | ||
34 | TZPPC ppc[5]; | ||
35 | TZMPC ssram_mpc[3]; | ||
36 | PL022State spi[5]; | ||
37 | - UnimplementedDeviceState i2c[4]; | ||
38 | + ArmSbconI2CState i2c[4]; | ||
39 | UnimplementedDeviceState i2s_audio; | ||
40 | UnimplementedDeviceState gpio[4]; | ||
41 | UnimplementedDeviceState gfx; | ||
42 | @@ -XXX,XX +XXX,XX @@ static MemoryRegion *make_spi(MPS2TZMachineState *mms, void *opaque, | ||
43 | return sysbus_mmio_get_region(s, 0); | ||
31 | } | 44 | } |
32 | 45 | ||
33 | +static void cpacr_reset(CPUARMState *env, const ARMCPRegInfo *ri) | 46 | +static MemoryRegion *make_i2c(MPS2TZMachineState *mms, void *opaque, |
47 | + const char *name, hwaddr size) | ||
34 | +{ | 48 | +{ |
35 | + /* Call cpacr_write() so that we reset with the correct RAO bits set | 49 | + ArmSbconI2CState *i2c = opaque; |
36 | + * for our CPU features. | 50 | + SysBusDevice *s; |
37 | + */ | 51 | + |
38 | + cpacr_write(env, ri, 0); | 52 | + object_initialize_child(OBJECT(mms), name, i2c, TYPE_ARM_SBCON_I2C); |
53 | + s = SYS_BUS_DEVICE(i2c); | ||
54 | + sysbus_realize(s, &error_fatal); | ||
55 | + return sysbus_mmio_get_region(s, 0); | ||
39 | +} | 56 | +} |
40 | + | 57 | + |
41 | static CPAccessResult cpacr_access(CPUARMState *env, const ARMCPRegInfo *ri, | 58 | static void mps2tz_common_init(MachineState *machine) |
42 | bool isread) | ||
43 | { | 59 | { |
44 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v6_cp_reginfo[] = { | 60 | MPS2TZMachineState *mms = MPS2TZ_MACHINE(machine); |
45 | { .name = "CPACR", .state = ARM_CP_STATE_BOTH, .opc0 = 3, | 61 | @@ -XXX,XX +XXX,XX @@ static void mps2tz_common_init(MachineState *machine) |
46 | .crn = 1, .crm = 0, .opc1 = 0, .opc2 = 2, .accessfn = cpacr_access, | 62 | { "uart2", make_uart, &mms->uart[2], 0x40202000, 0x1000 }, |
47 | .access = PL1_RW, .fieldoffset = offsetof(CPUARMState, cp15.cpacr_el1), | 63 | { "uart3", make_uart, &mms->uart[3], 0x40203000, 0x1000 }, |
48 | - .resetvalue = 0, .writefn = cpacr_write }, | 64 | { "uart4", make_uart, &mms->uart[4], 0x40204000, 0x1000 }, |
49 | + .resetfn = cpacr_reset, .writefn = cpacr_write }, | 65 | - { "i2c0", make_unimp_dev, &mms->i2c[0], 0x40207000, 0x1000 }, |
50 | REGINFO_SENTINEL | 66 | - { "i2c1", make_unimp_dev, &mms->i2c[1], 0x40208000, 0x1000 }, |
51 | }; | 67 | - { "i2c2", make_unimp_dev, &mms->i2c[2], 0x4020c000, 0x1000 }, |
52 | 68 | - { "i2c3", make_unimp_dev, &mms->i2c[3], 0x4020d000, 0x1000 }, | |
69 | + { "i2c0", make_i2c, &mms->i2c[0], 0x40207000, 0x1000 }, | ||
70 | + { "i2c1", make_i2c, &mms->i2c[1], 0x40208000, 0x1000 }, | ||
71 | + { "i2c2", make_i2c, &mms->i2c[2], 0x4020c000, 0x1000 }, | ||
72 | + { "i2c3", make_i2c, &mms->i2c[3], 0x4020d000, 0x1000 }, | ||
73 | }, | ||
74 | }, { | ||
75 | .name = "apb_ppcexp2", | ||
53 | -- | 76 | -- |
54 | 2.17.1 | 77 | 2.20.1 |
55 | 78 | ||
56 | 79 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | 1 | From: Philippe Mathieu-Daudé <philmd@redhat.com> | |
2 | |||
3 | Since commit d70c996df23f, when enabling the PMU we get: | ||
4 | |||
5 | $ qemu-system-aarch64 -cpu host,pmu=on -M virt,accel=kvm,gic-version=3 | ||
6 | Segmentation fault (core dumped) | ||
7 | |||
8 | Thread 1 "qemu-system-aar" received signal SIGSEGV, Segmentation fault. | ||
9 | 0x0000aaaaaae356d0 in kvm_ioctl (s=0x0, type=44547) at accel/kvm/kvm-all.c:2588 | ||
10 | 2588 ret = ioctl(s->fd, type, arg); | ||
11 | (gdb) bt | ||
12 | #0 0x0000aaaaaae356d0 in kvm_ioctl (s=0x0, type=44547) at accel/kvm/kvm-all.c:2588 | ||
13 | #1 0x0000aaaaaae31568 in kvm_check_extension (s=0x0, extension=126) at accel/kvm/kvm-all.c:916 | ||
14 | #2 0x0000aaaaaafce254 in kvm_arm_pmu_supported (cpu=0xaaaaac214ab0) at target/arm/kvm.c:213 | ||
15 | #3 0x0000aaaaaafc0f94 in arm_set_pmu (obj=0xaaaaac214ab0, value=true, errp=0xffffffffe438) at target/arm/cpu.c:1111 | ||
16 | #4 0x0000aaaaab5533ac in property_set_bool (obj=0xaaaaac214ab0, v=0xaaaaac223a80, name=0xaaaaac11a970 "pmu", opaque=0xaaaaac222730, errp=0xffffffffe438) at qom/object.c:2170 | ||
17 | #5 0x0000aaaaab5512f0 in object_property_set (obj=0xaaaaac214ab0, v=0xaaaaac223a80, name=0xaaaaac11a970 "pmu", errp=0xffffffffe438) at qom/object.c:1328 | ||
18 | #6 0x0000aaaaab551e10 in object_property_parse (obj=0xaaaaac214ab0, string=0xaaaaac11b4c0 "on", name=0xaaaaac11a970 "pmu", errp=0xffffffffe438) at qom/object.c:1561 | ||
19 | #7 0x0000aaaaab54ee8c in object_apply_global_props (obj=0xaaaaac214ab0, props=0xaaaaac018e20, errp=0xaaaaabd6fd88 <error_fatal>) at qom/object.c:407 | ||
20 | #8 0x0000aaaaab1dd5a4 in qdev_prop_set_globals (dev=0xaaaaac214ab0) at hw/core/qdev-properties.c:1218 | ||
21 | #9 0x0000aaaaab1d9fac in device_post_init (obj=0xaaaaac214ab0) at hw/core/qdev.c:1050 | ||
22 | ... | ||
23 | #15 0x0000aaaaab54f310 in object_initialize_with_type (obj=0xaaaaac214ab0, size=52208, type=0xaaaaabe237f0) at qom/object.c:512 | ||
24 | #16 0x0000aaaaab54fa24 in object_new_with_type (type=0xaaaaabe237f0) at qom/object.c:687 | ||
25 | #17 0x0000aaaaab54fa80 in object_new (typename=0xaaaaabe23970 "host-arm-cpu") at qom/object.c:702 | ||
26 | #18 0x0000aaaaaaf04a74 in machvirt_init (machine=0xaaaaac0a8550) at hw/arm/virt.c:1770 | ||
27 | #19 0x0000aaaaab1e8720 in machine_run_board_init (machine=0xaaaaac0a8550) at hw/core/machine.c:1138 | ||
28 | #20 0x0000aaaaaaf95394 in qemu_init (argc=5, argv=0xffffffffea58, envp=0xffffffffea88) at softmmu/vl.c:4348 | ||
29 | #21 0x0000aaaaaada3f74 in main (argc=<optimized out>, argv=<optimized out>, envp=<optimized out>) at softmmu/main.c:48 | ||
30 | |||
31 | This is because in frame #2, cpu->kvm_state is still NULL | ||
32 | (the vCPU is not yet realized). | ||
33 | |||
34 | KVM has a hard requirement of all cores supporting the same | ||
35 | feature set. We only need to check if the accelerator supports | ||
36 | a feature, not each vCPU individually. | ||
37 | |||
38 | Fix by removing the 'CPUState *cpu' argument from the | ||
39 | kvm_arm_<FEATURE>_supported() functions. | ||
40 | |||
41 | Fixes: d70c996df23f ('Use CPUState::kvm_state in kvm_arm_pmu_supported') | ||
42 | Reported-by: Haibo Xu <haibo.xu@linaro.org> | ||
43 | Reviewed-by: Andrew Jones <drjones@redhat.com> | ||
44 | Acked-by: Paolo Bonzini <pbonzini@redhat.com> | ||
45 | Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
46 | Suggested-by: Paolo Bonzini <pbonzini@redhat.com> | ||
47 | Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
48 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
49 | --- | ||
50 | target/arm/kvm_arm.h | 21 +++++++++------------ | ||
51 | target/arm/cpu.c | 2 +- | ||
52 | target/arm/cpu64.c | 10 +++++----- | ||
53 | target/arm/kvm.c | 4 ++-- | ||
54 | target/arm/kvm64.c | 14 +++++--------- | ||
55 | 5 files changed, 22 insertions(+), 29 deletions(-) | ||
56 | |||
57 | diff --git a/target/arm/kvm_arm.h b/target/arm/kvm_arm.h | ||
58 | index XXXXXXX..XXXXXXX 100644 | ||
59 | --- a/target/arm/kvm_arm.h | ||
60 | +++ b/target/arm/kvm_arm.h | ||
61 | @@ -XXX,XX +XXX,XX @@ void kvm_arm_add_vcpu_properties(Object *obj); | ||
62 | |||
63 | /** | ||
64 | * kvm_arm_aarch32_supported: | ||
65 | - * @cs: CPUState | ||
66 | * | ||
67 | - * Returns: true if the KVM VCPU can enable AArch32 mode | ||
68 | + * Returns: true if KVM can enable AArch32 mode | ||
69 | * and false otherwise. | ||
70 | */ | ||
71 | -bool kvm_arm_aarch32_supported(CPUState *cs); | ||
72 | +bool kvm_arm_aarch32_supported(void); | ||
73 | |||
74 | /** | ||
75 | * kvm_arm_pmu_supported: | ||
76 | - * @cs: CPUState | ||
77 | * | ||
78 | - * Returns: true if the KVM VCPU can enable its PMU | ||
79 | + * Returns: true if KVM can enable the PMU | ||
80 | * and false otherwise. | ||
81 | */ | ||
82 | -bool kvm_arm_pmu_supported(CPUState *cs); | ||
83 | +bool kvm_arm_pmu_supported(void); | ||
84 | |||
85 | /** | ||
86 | * kvm_arm_sve_supported: | ||
87 | - * @cs: CPUState | ||
88 | * | ||
89 | - * Returns true if the KVM VCPU can enable SVE and false otherwise. | ||
90 | + * Returns true if KVM can enable SVE and false otherwise. | ||
91 | */ | ||
92 | -bool kvm_arm_sve_supported(CPUState *cs); | ||
93 | +bool kvm_arm_sve_supported(void); | ||
94 | |||
95 | /** | ||
96 | * kvm_arm_get_max_vm_ipa_size: | ||
97 | @@ -XXX,XX +XXX,XX @@ static inline void kvm_arm_set_cpu_features_from_host(ARMCPU *cpu) | ||
98 | |||
99 | static inline void kvm_arm_add_vcpu_properties(Object *obj) {} | ||
100 | |||
101 | -static inline bool kvm_arm_aarch32_supported(CPUState *cs) | ||
102 | +static inline bool kvm_arm_aarch32_supported(void) | ||
103 | { | ||
104 | return false; | ||
105 | } | ||
106 | |||
107 | -static inline bool kvm_arm_pmu_supported(CPUState *cs) | ||
108 | +static inline bool kvm_arm_pmu_supported(void) | ||
109 | { | ||
110 | return false; | ||
111 | } | ||
112 | |||
113 | -static inline bool kvm_arm_sve_supported(CPUState *cs) | ||
114 | +static inline bool kvm_arm_sve_supported(void) | ||
115 | { | ||
116 | return false; | ||
117 | } | ||
118 | diff --git a/target/arm/cpu.c b/target/arm/cpu.c | ||
119 | index XXXXXXX..XXXXXXX 100644 | ||
120 | --- a/target/arm/cpu.c | ||
121 | +++ b/target/arm/cpu.c | ||
122 | @@ -XXX,XX +XXX,XX @@ static void arm_set_pmu(Object *obj, bool value, Error **errp) | ||
123 | ARMCPU *cpu = ARM_CPU(obj); | ||
124 | |||
125 | if (value) { | ||
126 | - if (kvm_enabled() && !kvm_arm_pmu_supported(CPU(cpu))) { | ||
127 | + if (kvm_enabled() && !kvm_arm_pmu_supported()) { | ||
128 | error_setg(errp, "'pmu' feature not supported by KVM on this host"); | ||
129 | return; | ||
130 | } | ||
131 | diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c | ||
132 | index XXXXXXX..XXXXXXX 100644 | ||
133 | --- a/target/arm/cpu64.c | ||
134 | +++ b/target/arm/cpu64.c | ||
135 | @@ -XXX,XX +XXX,XX @@ void arm_cpu_sve_finalize(ARMCPU *cpu, Error **errp) | ||
136 | |||
137 | /* Collect the set of vector lengths supported by KVM. */ | ||
138 | bitmap_zero(kvm_supported, ARM_MAX_VQ); | ||
139 | - if (kvm_enabled() && kvm_arm_sve_supported(CPU(cpu))) { | ||
140 | + if (kvm_enabled() && kvm_arm_sve_supported()) { | ||
141 | kvm_arm_sve_get_vls(CPU(cpu), kvm_supported); | ||
142 | } else if (kvm_enabled()) { | ||
143 | assert(!cpu_isar_feature(aa64_sve, cpu)); | ||
144 | @@ -XXX,XX +XXX,XX @@ static void cpu_max_set_sve_max_vq(Object *obj, Visitor *v, const char *name, | ||
145 | return; | ||
146 | } | ||
147 | |||
148 | - if (kvm_enabled() && !kvm_arm_sve_supported(CPU(cpu))) { | ||
149 | + if (kvm_enabled() && !kvm_arm_sve_supported()) { | ||
150 | error_setg(errp, "cannot set sve-max-vq"); | ||
151 | error_append_hint(errp, "SVE not supported by KVM on this host\n"); | ||
152 | return; | ||
153 | @@ -XXX,XX +XXX,XX @@ static void cpu_arm_set_sve_vq(Object *obj, Visitor *v, const char *name, | ||
154 | return; | ||
155 | } | ||
156 | |||
157 | - if (value && kvm_enabled() && !kvm_arm_sve_supported(CPU(cpu))) { | ||
158 | + if (value && kvm_enabled() && !kvm_arm_sve_supported()) { | ||
159 | error_setg(errp, "cannot enable %s", name); | ||
160 | error_append_hint(errp, "SVE not supported by KVM on this host\n"); | ||
161 | return; | ||
162 | @@ -XXX,XX +XXX,XX @@ static void cpu_arm_set_sve(Object *obj, Visitor *v, const char *name, | ||
163 | return; | ||
164 | } | ||
165 | |||
166 | - if (value && kvm_enabled() && !kvm_arm_sve_supported(CPU(cpu))) { | ||
167 | + if (value && kvm_enabled() && !kvm_arm_sve_supported()) { | ||
168 | error_setg(errp, "'sve' feature not supported by KVM on this host"); | ||
169 | return; | ||
170 | } | ||
171 | @@ -XXX,XX +XXX,XX @@ static void aarch64_cpu_set_aarch64(Object *obj, bool value, Error **errp) | ||
172 | * uniform execution state like do_interrupt. | ||
173 | */ | ||
174 | if (value == false) { | ||
175 | - if (!kvm_enabled() || !kvm_arm_aarch32_supported(CPU(cpu))) { | ||
176 | + if (!kvm_enabled() || !kvm_arm_aarch32_supported()) { | ||
177 | error_setg(errp, "'aarch64' feature cannot be disabled " | ||
178 | "unless KVM is enabled and 32-bit EL1 " | ||
179 | "is supported"); | ||
180 | diff --git a/target/arm/kvm.c b/target/arm/kvm.c | ||
181 | index XXXXXXX..XXXXXXX 100644 | ||
182 | --- a/target/arm/kvm.c | ||
183 | +++ b/target/arm/kvm.c | ||
184 | @@ -XXX,XX +XXX,XX @@ void kvm_arm_add_vcpu_properties(Object *obj) | ||
185 | } | ||
186 | } | ||
187 | |||
188 | -bool kvm_arm_pmu_supported(CPUState *cpu) | ||
189 | +bool kvm_arm_pmu_supported(void) | ||
190 | { | ||
191 | - return kvm_check_extension(cpu->kvm_state, KVM_CAP_ARM_PMU_V3); | ||
192 | + return kvm_check_extension(kvm_state, KVM_CAP_ARM_PMU_V3); | ||
193 | } | ||
194 | |||
195 | int kvm_arm_get_max_vm_ipa_size(MachineState *ms) | ||
196 | diff --git a/target/arm/kvm64.c b/target/arm/kvm64.c | ||
197 | index XXXXXXX..XXXXXXX 100644 | ||
198 | --- a/target/arm/kvm64.c | ||
199 | +++ b/target/arm/kvm64.c | ||
200 | @@ -XXX,XX +XXX,XX @@ bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf) | ||
201 | return true; | ||
202 | } | ||
203 | |||
204 | -bool kvm_arm_aarch32_supported(CPUState *cpu) | ||
205 | +bool kvm_arm_aarch32_supported(void) | ||
206 | { | ||
207 | - KVMState *s = KVM_STATE(current_accel()); | ||
208 | - | ||
209 | - return kvm_check_extension(s, KVM_CAP_ARM_EL1_32BIT); | ||
210 | + return kvm_check_extension(kvm_state, KVM_CAP_ARM_EL1_32BIT); | ||
211 | } | ||
212 | |||
213 | -bool kvm_arm_sve_supported(CPUState *cpu) | ||
214 | +bool kvm_arm_sve_supported(void) | ||
215 | { | ||
216 | - KVMState *s = KVM_STATE(current_accel()); | ||
217 | - | ||
218 | - return kvm_check_extension(s, KVM_CAP_ARM_SVE); | ||
219 | + return kvm_check_extension(kvm_state, KVM_CAP_ARM_SVE); | ||
220 | } | ||
221 | |||
222 | QEMU_BUILD_BUG_ON(KVM_ARM64_SVE_VQ_MIN != 1); | ||
223 | @@ -XXX,XX +XXX,XX @@ int kvm_arch_init_vcpu(CPUState *cs) | ||
224 | env->features &= ~(1ULL << ARM_FEATURE_PMU); | ||
225 | } | ||
226 | if (cpu_isar_feature(aa64_sve, cpu)) { | ||
227 | - assert(kvm_arm_sve_supported(cs)); | ||
228 | + assert(kvm_arm_sve_supported()); | ||
229 | cpu->kvm_init_features[0] |= 1 << KVM_ARM_VCPU_SVE; | ||
230 | } | ||
231 | |||
232 | -- | ||
233 | 2.20.1 | ||
234 | |||
235 | diff view generated by jsdifflib |
1 | From: Igor Mammedov <imammedo@redhat.com> | 1 | From: Andrew Jones <drjones@redhat.com> |
---|---|---|---|
2 | 2 | ||
3 | When QEMU is started with following CLI | 3 | Some cpu features may be enabled and disabled for all configurations |
4 | -machine virt,gic-version=3,accel=kvm -cpu host -bios AAVMF_CODE.fd | 4 | that support the feature. Let's test that. |
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 | A recent regression[*] inspired adding these tests. |
10 | arm_gicv3_icc_reset() where the later is called by CPU reset | ||
11 | reset callback. | ||
12 | 7 | ||
13 | However commit: | 8 | [*] '-cpu host,pmu=on' caused a segfault |
14 | 3b77f6c arm/boot: split load_dtb() from arm_load_kernel() | ||
15 | broke CPU reset callback registration in case | ||
16 | 9 | ||
17 | arm_load_kernel() | 10 | Signed-off-by: Andrew Jones <drjones@redhat.com> |
18 | ... | 11 | Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> |
19 | if (!info->kernel_filename || info->firmware_loaded) | 12 | Message-id: 20200623090622.30365-2-philmd@redhat.com |
20 | 13 | Message-Id: <20200623082310.17577-1-drjones@redhat.com> | |
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> | 14 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
41 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 15 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
42 | --- | 16 | --- |
43 | hw/arm/boot.c | 18 +++++++++--------- | 17 | tests/qtest/arm-cpu-features.c | 38 ++++++++++++++++++++++++++++++---- |
44 | 1 file changed, 9 insertions(+), 9 deletions(-) | 18 | 1 file changed, 34 insertions(+), 4 deletions(-) |
45 | 19 | ||
46 | diff --git a/hw/arm/boot.c b/hw/arm/boot.c | 20 | diff --git a/tests/qtest/arm-cpu-features.c b/tests/qtest/arm-cpu-features.c |
47 | index XXXXXXX..XXXXXXX 100644 | 21 | index XXXXXXX..XXXXXXX 100644 |
48 | --- a/hw/arm/boot.c | 22 | --- a/tests/qtest/arm-cpu-features.c |
49 | +++ b/hw/arm/boot.c | 23 | +++ b/tests/qtest/arm-cpu-features.c |
50 | @@ -XXX,XX +XXX,XX @@ void arm_load_kernel(ARMCPU *cpu, struct arm_boot_info *info) | 24 | @@ -XXX,XX +XXX,XX @@ static bool resp_get_feature(QDict *resp, const char *feature) |
51 | static const ARMInsnFixup *primary_loader; | 25 | qobject_unref(_resp); \ |
52 | AddressSpace *as = arm_boot_address_space(cpu, info); | 26 | }) |
53 | 27 | ||
54 | + /* CPU objects (unlike devices) are not automatically reset on system | 28 | -#define assert_feature(qts, cpu_type, feature, expected_value) \ |
55 | + * reset, so we must always register a handler to do so. If we're | 29 | +#define resp_assert_feature(resp, feature, expected_value) \ |
56 | + * actually loading a kernel, the handler is also responsible for | 30 | ({ \ |
57 | + * arranging that we start it correctly. | 31 | - QDict *_resp, *_props; \ |
58 | + */ | 32 | + QDict *_props; \ |
59 | + for (cs = first_cpu; cs; cs = CPU_NEXT(cs)) { | 33 | \ |
60 | + qemu_register_reset(do_cpu_reset, ARM_CPU(cs)); | 34 | - _resp = do_query_no_props(qts, cpu_type); \ |
61 | + } | 35 | g_assert(_resp); \ |
36 | g_assert(resp_has_props(_resp)); \ | ||
37 | _props = resp_get_props(_resp); \ | ||
38 | g_assert(qdict_get(_props, feature)); \ | ||
39 | g_assert(qdict_get_bool(_props, feature) == (expected_value)); \ | ||
40 | +}) | ||
62 | + | 41 | + |
63 | /* The board code is not supposed to set secure_board_setup unless | 42 | +#define assert_feature(qts, cpu_type, feature, expected_value) \ |
64 | * running its code in secure mode is actually possible, and KVM | 43 | +({ \ |
65 | * doesn't support secure. | 44 | + QDict *_resp; \ |
66 | @@ -XXX,XX +XXX,XX @@ void arm_load_kernel(ARMCPU *cpu, struct arm_boot_info *info) | 45 | + \ |
67 | ARM_CPU(cs)->env.boot_info = info; | 46 | + _resp = do_query_no_props(qts, cpu_type); \ |
47 | + g_assert(_resp); \ | ||
48 | + resp_assert_feature(_resp, feature, expected_value); \ | ||
49 | + qobject_unref(_resp); \ | ||
50 | +}) | ||
51 | + | ||
52 | +#define assert_set_feature(qts, cpu_type, feature, value) \ | ||
53 | +({ \ | ||
54 | + const char *_fmt = (value) ? "{ %s: true }" : "{ %s: false }"; \ | ||
55 | + QDict *_resp; \ | ||
56 | + \ | ||
57 | + _resp = do_query(qts, cpu_type, _fmt, feature); \ | ||
58 | + g_assert(_resp); \ | ||
59 | + resp_assert_feature(_resp, feature, value); \ | ||
60 | qobject_unref(_resp); \ | ||
61 | }) | ||
62 | |||
63 | @@ -XXX,XX +XXX,XX @@ static void test_query_cpu_model_expansion(const void *data) | ||
64 | assert_error(qts, "host", "The CPU type 'host' requires KVM", NULL); | ||
65 | |||
66 | /* Test expected feature presence/absence for some cpu types */ | ||
67 | - assert_has_feature_enabled(qts, "max", "pmu"); | ||
68 | assert_has_feature_enabled(qts, "cortex-a15", "pmu"); | ||
69 | assert_has_not_feature(qts, "cortex-a15", "aarch64"); | ||
70 | |||
71 | + /* Enabling and disabling pmu should always work. */ | ||
72 | + assert_has_feature_enabled(qts, "max", "pmu"); | ||
73 | + assert_set_feature(qts, "max", "pmu", false); | ||
74 | + assert_set_feature(qts, "max", "pmu", true); | ||
75 | + | ||
76 | assert_has_not_feature(qts, "max", "kvm-no-adjvtime"); | ||
77 | |||
78 | if (g_str_equal(qtest_get_arch(), "aarch64")) { | ||
79 | @@ -XXX,XX +XXX,XX @@ static void test_query_cpu_model_expansion_kvm(const void *data) | ||
80 | return; | ||
68 | } | 81 | } |
69 | 82 | ||
70 | - /* CPU objects (unlike devices) are not automatically reset on system | 83 | + /* Enabling and disabling kvm-no-adjvtime should always work. */ |
71 | - * reset, so we must always register a handler to do so. If we're | 84 | assert_has_feature_disabled(qts, "host", "kvm-no-adjvtime"); |
72 | - * actually loading a kernel, the handler is also responsible for | 85 | + assert_set_feature(qts, "host", "kvm-no-adjvtime", true); |
73 | - * arranging that we start it correctly. | 86 | + assert_set_feature(qts, "host", "kvm-no-adjvtime", false); |
74 | - */ | 87 | |
75 | - for (cs = first_cpu; cs; cs = CPU_NEXT(cs)) { | 88 | if (g_str_equal(qtest_get_arch(), "aarch64")) { |
76 | - qemu_register_reset(do_cpu_reset, ARM_CPU(cs)); | 89 | bool kvm_supports_sve; |
77 | - } | 90 | @@ -XXX,XX +XXX,XX @@ static void test_query_cpu_model_expansion_kvm(const void *data) |
78 | - | 91 | char *error; |
79 | if (!info->skip_dtb_autoload && have_dtb(info)) { | 92 | |
80 | if (arm_load_dtb(info->dtb_start, info, info->dtb_limit, as) < 0) { | 93 | assert_has_feature_enabled(qts, "host", "aarch64"); |
81 | exit(1); | 94 | + |
95 | + /* Enabling and disabling pmu should always work. */ | ||
96 | assert_has_feature_enabled(qts, "host", "pmu"); | ||
97 | + assert_set_feature(qts, "host", "pmu", false); | ||
98 | + assert_set_feature(qts, "host", "pmu", true); | ||
99 | |||
100 | assert_error(qts, "cortex-a15", | ||
101 | "We cannot guarantee the CPU type 'cortex-a15' works " | ||
82 | -- | 102 | -- |
83 | 2.17.1 | 103 | 2.20.1 |
84 | 104 | ||
85 | 105 | diff view generated by jsdifflib |
1 | As part of plumbing MemTxAttrs down to the IOMMU translate method, | 1 | From: Shameer Kolothum <shameerali.kolothum.thodi@huawei.com> |
---|---|---|---|
2 | add MemTxAttrs as an argument to tb_invalidate_phys_addr(). | ||
3 | Its callers either have an attrs value to hand, or don't care | ||
4 | and can use MEMTXATTRS_UNSPECIFIED. | ||
5 | 2 | ||
3 | This adds support for memory(pc-dimm) hot remove on arm/virt that | ||
4 | uses acpi ged device. | ||
5 | |||
6 | NVDIMM hot removal is not yet supported. | ||
7 | |||
8 | Signed-off-by: Shameer Kolothum <shameerali.kolothum.thodi@huawei.com> | ||
9 | Message-id: 20200622124157.20360-1-shameerali.kolothum.thodi@huawei.com | ||
10 | Reviewed-by: Eric Auger <eric.auger@redhat.com> | ||
11 | Tested-by: Eric Auger <eric.auger@redhat.com> | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
7 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
8 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | ||
9 | Message-id: 20180521140402.23318-3-peter.maydell@linaro.org | ||
10 | --- | 13 | --- |
11 | include/exec/exec-all.h | 5 +++-- | 14 | hw/acpi/generic_event_device.c | 29 ++++++++++++++++ |
12 | accel/tcg/translate-all.c | 2 +- | 15 | hw/arm/virt.c | 62 ++++++++++++++++++++++++++++++++-- |
13 | exec.c | 2 +- | 16 | 2 files changed, 89 insertions(+), 2 deletions(-) |
14 | target/xtensa/op_helper.c | 3 ++- | ||
15 | 4 files changed, 7 insertions(+), 5 deletions(-) | ||
16 | 17 | ||
17 | diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h | 18 | diff --git a/hw/acpi/generic_event_device.c b/hw/acpi/generic_event_device.c |
18 | index XXXXXXX..XXXXXXX 100644 | 19 | index XXXXXXX..XXXXXXX 100644 |
19 | --- a/include/exec/exec-all.h | 20 | --- a/hw/acpi/generic_event_device.c |
20 | +++ b/include/exec/exec-all.h | 21 | +++ b/hw/acpi/generic_event_device.c |
21 | @@ -XXX,XX +XXX,XX @@ void tlb_set_page_with_attrs(CPUState *cpu, target_ulong vaddr, | 22 | @@ -XXX,XX +XXX,XX @@ static void acpi_ged_device_plug_cb(HotplugHandler *hotplug_dev, |
22 | void tlb_set_page(CPUState *cpu, target_ulong vaddr, | ||
23 | hwaddr paddr, int prot, | ||
24 | int mmu_idx, target_ulong size); | ||
25 | -void tb_invalidate_phys_addr(AddressSpace *as, hwaddr addr); | ||
26 | +void tb_invalidate_phys_addr(AddressSpace *as, hwaddr addr, MemTxAttrs attrs); | ||
27 | void probe_write(CPUArchState *env, target_ulong addr, int size, int mmu_idx, | ||
28 | uintptr_t retaddr); | ||
29 | #else | ||
30 | @@ -XXX,XX +XXX,XX @@ static inline void tlb_flush_by_mmuidx_all_cpus_synced(CPUState *cpu, | ||
31 | uint16_t idxmap) | ||
32 | { | ||
33 | } | ||
34 | -static inline void tb_invalidate_phys_addr(AddressSpace *as, hwaddr addr) | ||
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 | } | 23 | } |
64 | } | 24 | } |
65 | #endif | 25 | |
66 | diff --git a/target/xtensa/op_helper.c b/target/xtensa/op_helper.c | 26 | +static void acpi_ged_unplug_request_cb(HotplugHandler *hotplug_dev, |
27 | + DeviceState *dev, Error **errp) | ||
28 | +{ | ||
29 | + AcpiGedState *s = ACPI_GED(hotplug_dev); | ||
30 | + | ||
31 | + if ((object_dynamic_cast(OBJECT(dev), TYPE_PC_DIMM) && | ||
32 | + !(object_dynamic_cast(OBJECT(dev), TYPE_NVDIMM)))) { | ||
33 | + acpi_memory_unplug_request_cb(hotplug_dev, &s->memhp_state, dev, errp); | ||
34 | + } else { | ||
35 | + error_setg(errp, "acpi: device unplug request for unsupported device" | ||
36 | + " type: %s", object_get_typename(OBJECT(dev))); | ||
37 | + } | ||
38 | +} | ||
39 | + | ||
40 | +static void acpi_ged_unplug_cb(HotplugHandler *hotplug_dev, | ||
41 | + DeviceState *dev, Error **errp) | ||
42 | +{ | ||
43 | + AcpiGedState *s = ACPI_GED(hotplug_dev); | ||
44 | + | ||
45 | + if (object_dynamic_cast(OBJECT(dev), TYPE_PC_DIMM)) { | ||
46 | + acpi_memory_unplug_cb(&s->memhp_state, dev, errp); | ||
47 | + } else { | ||
48 | + error_setg(errp, "acpi: device unplug for unsupported device" | ||
49 | + " type: %s", object_get_typename(OBJECT(dev))); | ||
50 | + } | ||
51 | +} | ||
52 | + | ||
53 | static void acpi_ged_send_event(AcpiDeviceIf *adev, AcpiEventStatusBits ev) | ||
54 | { | ||
55 | AcpiGedState *s = ACPI_GED(adev); | ||
56 | @@ -XXX,XX +XXX,XX @@ static void acpi_ged_class_init(ObjectClass *class, void *data) | ||
57 | dc->vmsd = &vmstate_acpi_ged; | ||
58 | |||
59 | hc->plug = acpi_ged_device_plug_cb; | ||
60 | + hc->unplug_request = acpi_ged_unplug_request_cb; | ||
61 | + hc->unplug = acpi_ged_unplug_cb; | ||
62 | |||
63 | adevc->send_event = acpi_ged_send_event; | ||
64 | } | ||
65 | diff --git a/hw/arm/virt.c b/hw/arm/virt.c | ||
67 | index XXXXXXX..XXXXXXX 100644 | 66 | index XXXXXXX..XXXXXXX 100644 |
68 | --- a/target/xtensa/op_helper.c | 67 | --- a/hw/arm/virt.c |
69 | +++ b/target/xtensa/op_helper.c | 68 | +++ b/hw/arm/virt.c |
70 | @@ -XXX,XX +XXX,XX @@ static void tb_invalidate_virtual_addr(CPUXtensaState *env, uint32_t vaddr) | 69 | @@ -XXX,XX +XXX,XX @@ static void virt_machine_device_plug_cb(HotplugHandler *hotplug_dev, |
71 | int ret = xtensa_get_physical_addr(env, false, vaddr, 2, 0, | ||
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 | } | 70 | } |
78 | } | 71 | } |
79 | 72 | ||
73 | +static void virt_dimm_unplug_request(HotplugHandler *hotplug_dev, | ||
74 | + DeviceState *dev, Error **errp) | ||
75 | +{ | ||
76 | + VirtMachineState *vms = VIRT_MACHINE(hotplug_dev); | ||
77 | + Error *local_err = NULL; | ||
78 | + | ||
79 | + if (!vms->acpi_dev) { | ||
80 | + error_setg(&local_err, | ||
81 | + "memory hotplug is not enabled: missing acpi-ged device"); | ||
82 | + goto out; | ||
83 | + } | ||
84 | + | ||
85 | + if (object_dynamic_cast(OBJECT(dev), TYPE_NVDIMM)) { | ||
86 | + error_setg(&local_err, | ||
87 | + "nvdimm device hot unplug is not supported yet."); | ||
88 | + goto out; | ||
89 | + } | ||
90 | + | ||
91 | + hotplug_handler_unplug_request(HOTPLUG_HANDLER(vms->acpi_dev), dev, | ||
92 | + &local_err); | ||
93 | +out: | ||
94 | + error_propagate(errp, local_err); | ||
95 | +} | ||
96 | + | ||
97 | +static void virt_dimm_unplug(HotplugHandler *hotplug_dev, | ||
98 | + DeviceState *dev, Error **errp) | ||
99 | +{ | ||
100 | + VirtMachineState *vms = VIRT_MACHINE(hotplug_dev); | ||
101 | + Error *local_err = NULL; | ||
102 | + | ||
103 | + hotplug_handler_unplug(HOTPLUG_HANDLER(vms->acpi_dev), dev, &local_err); | ||
104 | + if (local_err) { | ||
105 | + goto out; | ||
106 | + } | ||
107 | + | ||
108 | + pc_dimm_unplug(PC_DIMM(dev), MACHINE(vms)); | ||
109 | + qdev_unrealize(dev); | ||
110 | + | ||
111 | +out: | ||
112 | + error_propagate(errp, local_err); | ||
113 | +} | ||
114 | + | ||
115 | static void virt_machine_device_unplug_request_cb(HotplugHandler *hotplug_dev, | ||
116 | DeviceState *dev, Error **errp) | ||
117 | { | ||
118 | - error_setg(errp, "device unplug request for unsupported device" | ||
119 | - " type: %s", object_get_typename(OBJECT(dev))); | ||
120 | + if (object_dynamic_cast(OBJECT(dev), TYPE_PC_DIMM)) { | ||
121 | + virt_dimm_unplug_request(hotplug_dev, dev, errp); | ||
122 | + } else { | ||
123 | + error_setg(errp, "device unplug request for unsupported device" | ||
124 | + " type: %s", object_get_typename(OBJECT(dev))); | ||
125 | + } | ||
126 | +} | ||
127 | + | ||
128 | +static void virt_machine_device_unplug_cb(HotplugHandler *hotplug_dev, | ||
129 | + DeviceState *dev, Error **errp) | ||
130 | +{ | ||
131 | + if (object_dynamic_cast(OBJECT(dev), TYPE_PC_DIMM)) { | ||
132 | + virt_dimm_unplug(hotplug_dev, dev, errp); | ||
133 | + } else { | ||
134 | + error_setg(errp, "virt: device unplug for unsupported device" | ||
135 | + " type: %s", object_get_typename(OBJECT(dev))); | ||
136 | + } | ||
137 | } | ||
138 | |||
139 | static HotplugHandler *virt_machine_get_hotplug_handler(MachineState *machine, | ||
140 | @@ -XXX,XX +XXX,XX @@ static void virt_machine_class_init(ObjectClass *oc, void *data) | ||
141 | hc->pre_plug = virt_machine_device_pre_plug_cb; | ||
142 | hc->plug = virt_machine_device_plug_cb; | ||
143 | hc->unplug_request = virt_machine_device_unplug_request_cb; | ||
144 | + hc->unplug = virt_machine_device_unplug_cb; | ||
145 | mc->numa_mem_supported = true; | ||
146 | mc->nvdimm_supported = true; | ||
147 | mc->auto_enable_numa_with_memhp = true; | ||
80 | -- | 148 | -- |
81 | 2.17.1 | 149 | 2.20.1 |
82 | 150 | ||
83 | 151 | diff view generated by jsdifflib |