1 | Most of this is the Neon decodetree patches, followed by Edgar's versal cleanups. | 1 | The following changes since commit 61fee7f45955cd0bf9b79be9fa9c7ebabb5e6a85: |
---|---|---|---|
2 | 2 | ||
3 | thanks | 3 | Merge remote-tracking branch 'remotes/philmd-gitlab/tags/acceptance-testing-20200622' into staging (2020-06-22 20:50:10 +0100) |
4 | -- PMM | ||
5 | |||
6 | |||
7 | The following changes since commit 2ef486e76d64436be90f7359a3071fb2a56ce835: | ||
8 | |||
9 | Merge remote-tracking branch 'remotes/marcel/tags/rdma-pull-request' into staging (2020-05-03 14:12:56 +0100) | ||
10 | 4 | ||
11 | are available in the Git repository at: | 5 | are available in the Git repository at: |
12 | 6 | ||
13 | https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20200504 | 7 | https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20200623 |
14 | 8 | ||
15 | for you to fetch changes up to 9aefc6cf9b73f66062d2f914a0136756e7a28211: | 9 | for you to fetch changes up to 539533b85fbd269f777bed931de8ccae1dd837e9: |
16 | 10 | ||
17 | target/arm: Move gen_ function typedefs to translate.h (2020-05-04 12:59:26 +0100) | 11 | arm/virt: Add memory hot remove support (2020-06-23 11:39:48 +0100) |
18 | 12 | ||
19 | ---------------------------------------------------------------- | 13 | ---------------------------------------------------------------- |
20 | target-arm queue: | 14 | target-arm queue: |
21 | * Start of conversion of Neon insns to decodetree | 15 | * util/oslib-posix : qemu_init_exec_dir implementation for Mac |
22 | * versal board: support SD and RTC | 16 | * target/arm: Last parts of neon decodetree conversion |
23 | * Implement ARMv8.2-TTS2UXN | 17 | * hw/arm/virt: Add 5.0 HW compat props |
24 | * Make VQDMULL undefined when U=1 | 18 | * hw/watchdog/cmsdk-apb-watchdog: Add trace event for lock status |
25 | * Some minor code cleanups | 19 | * mps2: Add CMSDK APB watchdog, FPGAIO block, S2I devices and I2C devices |
20 | * mps2: Add some unimplemented-device stubs for audio and GPIO | ||
21 | * mps2-tz: Use the ARM SBCon two-wire serial bus interface | ||
22 | * target/arm: Check supported KVM features globally (not per vCPU) | ||
23 | * tests/qtest/arm-cpu-features: Add feature setting tests | ||
24 | * arm/virt: Add memory hot remove support | ||
26 | 25 | ||
27 | ---------------------------------------------------------------- | 26 | ---------------------------------------------------------------- |
28 | Edgar E. Iglesias (11): | 27 | Andrew Jones (2): |
29 | hw/arm: versal: Remove inclusion of arm_gicv3_common.h | 28 | hw/arm/virt: Add 5.0 HW compat props |
30 | hw/arm: versal: Move misplaced comment | 29 | tests/qtest/arm-cpu-features: Add feature setting tests |
31 | hw/arm: versal-virt: Fix typo xlnx-ve -> xlnx-versal | ||
32 | hw/arm: versal: Embed the UARTs into the SoC type | ||
33 | hw/arm: versal: Embed the GEMs into the SoC type | ||
34 | hw/arm: versal: Embed the ADMAs into the SoC type | ||
35 | hw/arm: versal: Embed the APUs into the SoC type | ||
36 | hw/arm: versal: Add support for SD | ||
37 | hw/arm: versal: Add support for the RTC | ||
38 | hw/arm: versal-virt: Add support for SD | ||
39 | hw/arm: versal-virt: Add support for the RTC | ||
40 | 30 | ||
41 | Fredrik Strupe (1): | 31 | David CARLIER (1): |
42 | target/arm: Make VQDMULL undefined when U=1 | 32 | util/oslib-posix : qemu_init_exec_dir implementation for Mac |
43 | 33 | ||
44 | Peter Maydell (25): | 34 | Peter Maydell (23): |
45 | target/arm: Don't use a TLB for ARMMMUIdx_Stage2 | 35 | target/arm: Convert Neon 2-reg-misc VREV64 to decodetree |
46 | target/arm: Use enum constant in get_phys_addr_lpae() call | 36 | target/arm: Convert Neon 2-reg-misc pairwise ops to decodetree |
47 | target/arm: Add new 's1_is_el0' argument to get_phys_addr_lpae() | 37 | target/arm: Convert VZIP, VUZP to decodetree |
48 | target/arm: Implement ARMv8.2-TTS2UXN | 38 | target/arm: Convert Neon narrowing moves to decodetree |
49 | target/arm: Use correct variable for setting 'max' cpu's ID_AA64DFR0 | 39 | target/arm: Convert Neon 2-reg-misc VSHLL to decodetree |
50 | target/arm/translate-vfp.inc.c: Remove duplicate simd_r32 check | 40 | target/arm: Convert Neon VCVT f16/f32 insns to decodetree |
51 | target/arm: Don't allow Thumb Neon insns without FEATURE_NEON | 41 | target/arm: Convert vectorised 2-reg-misc Neon ops to decodetree |
52 | target/arm: Add stubs for AArch32 Neon decodetree | 42 | target/arm: Convert Neon 2-reg-misc crypto operations to decodetree |
53 | target/arm: Convert VCMLA (vector) to decodetree | 43 | target/arm: Rename NeonGenOneOpFn to NeonGenOne64OpFn |
54 | target/arm: Convert VCADD (vector) to decodetree | 44 | target/arm: Fix capitalization in NeonGenTwo{Single, Double}OPFn typedefs |
55 | target/arm: Convert V[US]DOT (vector) to decodetree | 45 | target/arm: Make gen_swap_half() take separate src and dest |
56 | target/arm: Convert VFM[AS]L (vector) to decodetree | 46 | target/arm: Convert Neon 2-reg-misc VREV32 and VREV16 to decodetree |
57 | target/arm: Convert VCMLA (scalar) to decodetree | 47 | target/arm: Convert remaining simple 2-reg-misc Neon ops |
58 | target/arm: Convert V[US]DOT (scalar) to decodetree | 48 | target/arm: Convert Neon VQABS, VQNEG to decodetree |
59 | target/arm: Convert VFM[AS]L (scalar) to decodetree | 49 | target/arm: Convert simple fp Neon 2-reg-misc insns |
60 | target/arm: Convert Neon load/store multiple structures to decodetree | 50 | target/arm: Convert Neon 2-reg-misc fp-compare-with-zero insns to decodetree |
61 | target/arm: Convert Neon 'load single structure to all lanes' to decodetree | 51 | target/arm: Convert Neon 2-reg-misc VRINT insns to decodetree |
62 | target/arm: Convert Neon 'load/store single structure' to decodetree | 52 | target/arm: Convert Neon 2-reg-misc VCVT insns to decodetree |
63 | target/arm: Convert Neon 3-reg-same VADD/VSUB to decodetree | 53 | target/arm: Convert Neon VSWP to decodetree |
64 | target/arm: Convert Neon 3-reg-same logic ops to decodetree | 54 | target/arm: Convert Neon VTRN to decodetree |
65 | target/arm: Convert Neon 3-reg-same VMAX/VMIN to decodetree | 55 | target/arm: Move some functions used only in translate-neon.inc.c to that file |
66 | target/arm: Convert Neon 3-reg-same comparisons to decodetree | 56 | target/arm: Remove unnecessary gen_io_end() calls |
67 | target/arm: Convert Neon 3-reg-same VQADD/VQSUB to decodetree | 57 | target/arm: Remove dead code relating to SABA and UABA |
68 | target/arm: Convert Neon 3-reg-same VMUL, VMLA, VMLS, VSHL to decodetree | ||
69 | target/arm: Move gen_ function typedefs to translate.h | ||
70 | 58 | ||
71 | Philippe Mathieu-Daudé (2): | 59 | Philippe Mathieu-Daudé (15): |
72 | hw/arm/mps2-tz: Use TYPE_IOTKIT instead of hardcoded string | 60 | hw/watchdog/cmsdk-apb-watchdog: Add trace event for lock status |
73 | target/arm: Use uint64_t for midr field in CPU state struct | 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) | ||
74 | 75 | ||
75 | include/hw/arm/xlnx-versal.h | 31 +- | 76 | Shameer Kolothum (1): |
76 | target/arm/cpu-param.h | 2 +- | 77 | arm/virt: Add memory hot remove support |
77 | target/arm/cpu.h | 38 ++- | ||
78 | target/arm/translate-a64.h | 9 - | ||
79 | target/arm/translate.h | 26 ++ | ||
80 | target/arm/neon-dp.decode | 86 +++++ | ||
81 | target/arm/neon-ls.decode | 52 +++ | ||
82 | target/arm/neon-shared.decode | 66 ++++ | ||
83 | hw/arm/mps2-tz.c | 2 +- | ||
84 | hw/arm/xlnx-versal-virt.c | 74 ++++- | ||
85 | hw/arm/xlnx-versal.c | 115 +++++-- | ||
86 | target/arm/cpu.c | 3 +- | ||
87 | target/arm/cpu64.c | 8 +- | ||
88 | target/arm/helper.c | 183 ++++------ | ||
89 | target/arm/translate-a64.c | 17 - | ||
90 | target/arm/translate-neon.inc.c | 714 +++++++++++++++++++++++++++++++++++++++ | ||
91 | target/arm/translate-vfp.inc.c | 6 - | ||
92 | target/arm/translate.c | 716 +++------------------------------------- | ||
93 | target/arm/Makefile.objs | 18 + | ||
94 | 19 files changed, 1302 insertions(+), 864 deletions(-) | ||
95 | create mode 100644 target/arm/neon-dp.decode | ||
96 | create mode 100644 target/arm/neon-ls.decode | ||
97 | create mode 100644 target/arm/neon-shared.decode | ||
98 | create mode 100644 target/arm/translate-neon.inc.c | ||
99 | 78 | ||
79 | include/hw/i2c/arm_sbcon_i2c.h | 35 ++ | ||
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 | ||
108 | diff view generated by jsdifflib |
1 | From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com> | 1 | From: Andrew Jones <drjones@redhat.com> |
---|---|---|---|
2 | 2 | ||
3 | hw/arm: versal: Add support for the RTC. | 3 | Cc: Cornelia Huck <cohuck@redhat.com> |
4 | 4 | Signed-off-by: Andrew Jones <drjones@redhat.com> | |
5 | Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | 5 | Reviewed-by: Cornelia Huck <cohuck@redhat.com> |
6 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 6 | Message-id: 20200616140803.25515-1-drjones@redhat.com |
7 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | ||
8 | Reviewed-by: Luc Michel <luc.michel@greensocs.com> | ||
9 | Message-id: 20200427181649.26851-10-edgar.iglesias@gmail.com | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
11 | --- | 8 | --- |
12 | include/hw/arm/xlnx-versal.h | 8 ++++++++ | 9 | hw/arm/virt.c | 1 + |
13 | hw/arm/xlnx-versal.c | 21 +++++++++++++++++++++ | 10 | 1 file changed, 1 insertion(+) |
14 | 2 files changed, 29 insertions(+) | ||
15 | 11 | ||
16 | diff --git a/include/hw/arm/xlnx-versal.h b/include/hw/arm/xlnx-versal.h | 12 | diff --git a/hw/arm/virt.c b/hw/arm/virt.c |
17 | index XXXXXXX..XXXXXXX 100644 | 13 | index XXXXXXX..XXXXXXX 100644 |
18 | --- a/include/hw/arm/xlnx-versal.h | 14 | --- a/hw/arm/virt.c |
19 | +++ b/include/hw/arm/xlnx-versal.h | 15 | +++ b/hw/arm/virt.c |
20 | @@ -XXX,XX +XXX,XX @@ | 16 | @@ -XXX,XX +XXX,XX @@ DEFINE_VIRT_MACHINE_AS_LATEST(5, 1) |
21 | #include "hw/char/pl011.h" | 17 | static void virt_machine_5_0_options(MachineClass *mc) |
22 | #include "hw/dma/xlnx-zdma.h" | 18 | { |
23 | #include "hw/net/cadence_gem.h" | 19 | virt_machine_5_1_options(mc); |
24 | +#include "hw/rtc/xlnx-zynqmp-rtc.h" | 20 | + compat_props_add(mc->compat_props, hw_compat_5_0, hw_compat_5_0_len); |
25 | |||
26 | #define TYPE_XLNX_VERSAL "xlnx-versal" | ||
27 | #define XLNX_VERSAL(obj) OBJECT_CHECK(Versal, (obj), TYPE_XLNX_VERSAL) | ||
28 | @@ -XXX,XX +XXX,XX @@ typedef struct Versal { | ||
29 | struct { | ||
30 | SDHCIState sd[XLNX_VERSAL_NR_SDS]; | ||
31 | } iou; | ||
32 | + | ||
33 | + XlnxZynqMPRTC rtc; | ||
34 | } pmc; | ||
35 | |||
36 | struct { | ||
37 | @@ -XXX,XX +XXX,XX @@ typedef struct Versal { | ||
38 | #define VERSAL_GEM1_IRQ_0 58 | ||
39 | #define VERSAL_GEM1_WAKE_IRQ_0 59 | ||
40 | #define VERSAL_ADMA_IRQ_0 60 | ||
41 | +#define VERSAL_RTC_APB_ERR_IRQ 121 | ||
42 | #define VERSAL_SD0_IRQ_0 126 | ||
43 | +#define VERSAL_RTC_ALARM_IRQ 142 | ||
44 | +#define VERSAL_RTC_SECONDS_IRQ 143 | ||
45 | |||
46 | /* Architecturally reserved IRQs suitable for virtualization. */ | ||
47 | #define VERSAL_RSVD_IRQ_FIRST 111 | ||
48 | @@ -XXX,XX +XXX,XX @@ typedef struct Versal { | ||
49 | #define MM_PMC_SD0_SIZE 0x10000 | ||
50 | #define MM_PMC_CRP 0xf1260000U | ||
51 | #define MM_PMC_CRP_SIZE 0x10000 | ||
52 | +#define MM_PMC_RTC 0xf12a0000 | ||
53 | +#define MM_PMC_RTC_SIZE 0x10000 | ||
54 | #endif | ||
55 | diff --git a/hw/arm/xlnx-versal.c b/hw/arm/xlnx-versal.c | ||
56 | index XXXXXXX..XXXXXXX 100644 | ||
57 | --- a/hw/arm/xlnx-versal.c | ||
58 | +++ b/hw/arm/xlnx-versal.c | ||
59 | @@ -XXX,XX +XXX,XX @@ static void versal_create_sds(Versal *s, qemu_irq *pic) | ||
60 | } | ||
61 | } | 21 | } |
62 | 22 | DEFINE_VIRT_MACHINE(5, 0) | |
63 | +static void versal_create_rtc(Versal *s, qemu_irq *pic) | ||
64 | +{ | ||
65 | + SysBusDevice *sbd; | ||
66 | + MemoryRegion *mr; | ||
67 | + | ||
68 | + sysbus_init_child_obj(OBJECT(s), "rtc", &s->pmc.rtc, sizeof(s->pmc.rtc), | ||
69 | + TYPE_XLNX_ZYNQMP_RTC); | ||
70 | + sbd = SYS_BUS_DEVICE(&s->pmc.rtc); | ||
71 | + qdev_init_nofail(DEVICE(sbd)); | ||
72 | + | ||
73 | + mr = sysbus_mmio_get_region(sbd, 0); | ||
74 | + memory_region_add_subregion(&s->mr_ps, MM_PMC_RTC, mr); | ||
75 | + | ||
76 | + /* | ||
77 | + * TODO: Connect the ALARM and SECONDS interrupts once our RTC model | ||
78 | + * supports them. | ||
79 | + */ | ||
80 | + sysbus_connect_irq(sbd, 1, pic[VERSAL_RTC_APB_ERR_IRQ]); | ||
81 | +} | ||
82 | + | ||
83 | /* This takes the board allocated linear DDR memory and creates aliases | ||
84 | * for each split DDR range/aperture on the Versal address map. | ||
85 | */ | ||
86 | @@ -XXX,XX +XXX,XX @@ static void versal_realize(DeviceState *dev, Error **errp) | ||
87 | versal_create_gems(s, pic); | ||
88 | versal_create_admas(s, pic); | ||
89 | versal_create_sds(s, pic); | ||
90 | + versal_create_rtc(s, pic); | ||
91 | versal_map_ddr(s); | ||
92 | versal_unimp(s); | ||
93 | 23 | ||
94 | -- | 24 | -- |
95 | 2.20.1 | 25 | 2.20.1 |
96 | 26 | ||
97 | 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 |
1 | Convert the VCADD (vector) insns to decodetree. | 1 | Convert the Neon VREV64 insn from the 2-reg-misc grouping to decodetree. |
---|---|---|---|
2 | 2 | ||
3 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 3 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
4 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 4 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
5 | Message-id: 20200430181003.21682-6-peter.maydell@linaro.org | 5 | Message-id: 20200616170844.13318-2-peter.maydell@linaro.org |
6 | --- | 6 | --- |
7 | target/arm/neon-shared.decode | 3 +++ | 7 | target/arm/neon-dp.decode | 12 ++++++++ |
8 | target/arm/translate-neon.inc.c | 37 +++++++++++++++++++++++++++++++++ | 8 | target/arm/translate-neon.inc.c | 50 +++++++++++++++++++++++++++++++++ |
9 | target/arm/translate.c | 11 +--------- | 9 | target/arm/translate.c | 24 ++-------------- |
10 | 3 files changed, 41 insertions(+), 10 deletions(-) | 10 | 3 files changed, 64 insertions(+), 22 deletions(-) |
11 | 11 | ||
12 | diff --git a/target/arm/neon-shared.decode b/target/arm/neon-shared.decode | 12 | diff --git a/target/arm/neon-dp.decode b/target/arm/neon-dp.decode |
13 | index XXXXXXX..XXXXXXX 100644 | 13 | index XXXXXXX..XXXXXXX 100644 |
14 | --- a/target/arm/neon-shared.decode | 14 | --- a/target/arm/neon-dp.decode |
15 | +++ b/target/arm/neon-shared.decode | 15 | +++ b/target/arm/neon-dp.decode |
16 | @@ -XXX,XX +XXX,XX @@ | 16 | @@ -XXX,XX +XXX,XX @@ Vimm_1r 1111 001 . 1 . 000 ... .... cmode:4 0 . op:1 1 .... @1reg_imm |
17 | 17 | vm=%vm_dp vd=%vd_dp size=1 | |
18 | VCMLA 1111 110 rot:2 . 1 size:1 .... .... 1000 . q:1 . 0 .... \ | 18 | VDUP_scalar 1111 001 1 1 . 11 index:1 100 .... 11 000 q:1 . 0 .... \ |
19 | vm=%vm_dp vn=%vn_dp vd=%vd_dp | 19 | vm=%vm_dp vd=%vd_dp size=2 |
20 | + | 20 | + |
21 | +VCADD 1111 110 rot:1 1 . 0 size:1 .... .... 1000 . q:1 . 0 .... \ | 21 | + ################################################################## |
22 | + vm=%vm_dp vn=%vn_dp vd=%vd_dp | 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 | ||
23 | diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c | 35 | diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c |
24 | index XXXXXXX..XXXXXXX 100644 | 36 | index XXXXXXX..XXXXXXX 100644 |
25 | --- a/target/arm/translate-neon.inc.c | 37 | --- a/target/arm/translate-neon.inc.c |
26 | +++ b/target/arm/translate-neon.inc.c | 38 | +++ b/target/arm/translate-neon.inc.c |
27 | @@ -XXX,XX +XXX,XX @@ static bool trans_VCMLA(DisasContext *s, arg_VCMLA *a) | 39 | @@ -XXX,XX +XXX,XX @@ static bool trans_VDUP_scalar(DisasContext *s, arg_VDUP_scalar *a) |
28 | tcg_temp_free_ptr(fpst); | 40 | a->q ? 16 : 8, a->q ? 16 : 8); |
29 | return true; | 41 | return true; |
30 | } | 42 | } |
31 | + | 43 | + |
32 | +static bool trans_VCADD(DisasContext *s, arg_VCADD *a) | 44 | +static bool trans_VREV64(DisasContext *s, arg_VREV64 *a) |
33 | +{ | 45 | +{ |
34 | + int opr_sz; | 46 | + int pass, half; |
35 | + TCGv_ptr fpst; | ||
36 | + gen_helper_gvec_3_ptr *fn_gvec_ptr; | ||
37 | + | 47 | + |
38 | + if (!dc_isar_feature(aa32_vcma, s) | 48 | + if (!arm_dc_feature(s, ARM_FEATURE_NEON)) { |
39 | + || (!a->size && !dc_isar_feature(aa32_fp16_arith, s))) { | ||
40 | + return false; | 49 | + return false; |
41 | + } | 50 | + } |
42 | + | 51 | + |
43 | + /* UNDEF accesses to D16-D31 if they don't exist. */ | 52 | + /* UNDEF accesses to D16-D31 if they don't exist. */ |
44 | + if (!dc_isar_feature(aa32_simd_r32, s) && | 53 | + if (!dc_isar_feature(aa32_simd_r32, s) && |
45 | + ((a->vd | a->vn | a->vm) & 0x10)) { | 54 | + ((a->vd | a->vm) & 0x10)) { |
46 | + return false; | 55 | + return false; |
47 | + } | 56 | + } |
48 | + | 57 | + |
49 | + if ((a->vn | a->vm | a->vd) & a->q) { | 58 | + if ((a->vd | a->vm) & a->q) { |
59 | + return false; | ||
60 | + } | ||
61 | + | ||
62 | + if (a->size == 3) { | ||
50 | + return false; | 63 | + return false; |
51 | + } | 64 | + } |
52 | + | 65 | + |
53 | + if (!vfp_access_check(s)) { | 66 | + if (!vfp_access_check(s)) { |
54 | + return true; | 67 | + return true; |
55 | + } | 68 | + } |
56 | + | 69 | + |
57 | + opr_sz = (1 + a->q) * 8; | 70 | + for (pass = 0; pass < (a->q ? 2 : 1); pass++) { |
58 | + fpst = get_fpstatus_ptr(1); | 71 | + TCGv_i32 tmp[2]; |
59 | + fn_gvec_ptr = a->size ? gen_helper_gvec_fcadds : gen_helper_gvec_fcaddh; | 72 | + |
60 | + tcg_gen_gvec_3_ptr(vfp_reg_offset(1, a->vd), | 73 | + for (half = 0; half < 2; half++) { |
61 | + vfp_reg_offset(1, a->vn), | 74 | + tmp[half] = neon_load_reg(a->vm, pass * 2 + half); |
62 | + vfp_reg_offset(1, a->vm), | 75 | + switch (a->size) { |
63 | + fpst, opr_sz, opr_sz, a->rot, | 76 | + case 0: |
64 | + fn_gvec_ptr); | 77 | + tcg_gen_bswap32_i32(tmp[half], tmp[half]); |
65 | + tcg_temp_free_ptr(fpst); | 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 | + } | ||
66 | + return true; | 91 | + return true; |
67 | +} | 92 | +} |
68 | diff --git a/target/arm/translate.c b/target/arm/translate.c | 93 | diff --git a/target/arm/translate.c b/target/arm/translate.c |
69 | index XXXXXXX..XXXXXXX 100644 | 94 | index XXXXXXX..XXXXXXX 100644 |
70 | --- a/target/arm/translate.c | 95 | --- a/target/arm/translate.c |
71 | +++ b/target/arm/translate.c | 96 | +++ b/target/arm/translate.c |
72 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_insn_3same_ext(DisasContext *s, uint32_t insn) | 97 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) |
73 | bool is_long = false, q = extract32(insn, 6, 1); | 98 | } |
74 | bool ptr_is_env = false; | 99 | switch (op) { |
75 | 100 | case NEON_2RM_VREV64: | |
76 | - if ((insn & 0xfea00f10) == 0xfc800800) { | 101 | - for (pass = 0; pass < (q ? 2 : 1); pass++) { |
77 | - /* VCADD -- 1111 110R 1.0S .... .... 1000 ...0 .... */ | 102 | - tmp = neon_load_reg(rm, pass * 2); |
78 | - int size = extract32(insn, 20, 1); | 103 | - tmp2 = neon_load_reg(rm, pass * 2 + 1); |
79 | - data = extract32(insn, 24, 1); /* rot */ | 104 | - switch (size) { |
80 | - if (!dc_isar_feature(aa32_vcma, s) | 105 | - case 0: tcg_gen_bswap32_i32(tmp, tmp); break; |
81 | - || (!size && !dc_isar_feature(aa32_fp16_arith, s))) { | 106 | - case 1: gen_swap_half(tmp); break; |
82 | - return 1; | 107 | - case 2: /* no-op */ break; |
83 | - } | 108 | - default: abort(); |
84 | - fn_gvec_ptr = size ? gen_helper_gvec_fcadds : gen_helper_gvec_fcaddh; | 109 | - } |
85 | - } else if ((insn & 0xfeb00f00) == 0xfc200d00) { | 110 | - neon_store_reg(rd, pass * 2 + 1, tmp); |
86 | + if ((insn & 0xfeb00f00) == 0xfc200d00) { | 111 | - if (size == 2) { |
87 | /* V[US]DOT -- 1111 1100 0.10 .... .... 1101 .Q.U .... */ | 112 | - neon_store_reg(rd, pass * 2, tmp2); |
88 | bool u = extract32(insn, 4, 1); | 113 | - } else { |
89 | if (!dc_isar_feature(aa32_dp, s)) { | 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++) { | ||
90 | -- | 128 | -- |
91 | 2.20.1 | 129 | 2.20.1 |
92 | 130 | ||
93 | 131 | diff view generated by jsdifflib |
1 | Convert the VFM[AS]L (scalar) insns in the 2reg-scalar-ext group | 1 | Convert the pairwise ops VPADDL and VPADAL in the 2-reg-misc grouping |
---|---|---|---|
2 | to decodetree. These are the last ones in the group so we can remove | 2 | to decodetree. |
3 | all the legacy decode for the group. | 3 | |
4 | 4 | At this point we can get rid of the weird CPU_V001 #define that was | |
5 | Note that in disas_thumb2_insn() the parts of this encoding space | 5 | used to avoid having to explicitly list all the arguments being |
6 | where the decodetree decoder returns false will correctly be directed | 6 | passed to some TCG gen/helper functions. |
7 | to illegal_op by the "(insn & (1 << 28))" check so they won't fall | ||
8 | into disas_coproc_insn() by mistake. | ||
9 | 7 | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
11 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 9 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
12 | Message-id: 20200430181003.21682-11-peter.maydell@linaro.org | 10 | Message-id: 20200616170844.13318-3-peter.maydell@linaro.org |
13 | --- | 11 | --- |
14 | target/arm/neon-shared.decode | 7 +++ | 12 | target/arm/neon-dp.decode | 6 ++ |
15 | target/arm/translate-neon.inc.c | 32 ++++++++++ | 13 | target/arm/translate-neon.inc.c | 149 ++++++++++++++++++++++++++++++++ |
16 | target/arm/translate.c | 107 +------------------------------- | 14 | target/arm/translate.c | 35 +------- |
17 | 3 files changed, 40 insertions(+), 106 deletions(-) | 15 | 3 files changed, 157 insertions(+), 33 deletions(-) |
18 | 16 | ||
19 | diff --git a/target/arm/neon-shared.decode b/target/arm/neon-shared.decode | 17 | diff --git a/target/arm/neon-dp.decode b/target/arm/neon-dp.decode |
20 | index XXXXXXX..XXXXXXX 100644 | 18 | index XXXXXXX..XXXXXXX 100644 |
21 | --- a/target/arm/neon-shared.decode | 19 | --- a/target/arm/neon-dp.decode |
22 | +++ b/target/arm/neon-shared.decode | 20 | +++ b/target/arm/neon-dp.decode |
23 | @@ -XXX,XX +XXX,XX @@ VCMLA_scalar 1111 1110 1 . rot:2 .... .... 1000 . q:1 . 0 .... \ | 21 | @@ -XXX,XX +XXX,XX @@ Vimm_1r 1111 001 . 1 . 000 ... .... cmode:4 0 . op:1 1 .... @1reg_imm |
24 | 22 | &2misc vm=%vm_dp vd=%vd_dp | |
25 | VDOT_scalar 1111 1110 0 . 10 .... .... 1101 . q:1 index:1 u:1 rm:4 \ | 23 | |
26 | vm=%vm_dp vn=%vn_dp vd=%vd_dp | 24 | VREV64 1111 001 11 . 11 .. 00 .... 0 0000 . . 0 .... @2misc |
27 | + | 25 | + |
28 | +%vfml_scalar_q0_rm 0:3 5:1 | 26 | + VPADDL_S 1111 001 11 . 11 .. 00 .... 0 0100 . . 0 .... @2misc |
29 | +%vfml_scalar_q1_index 5:1 3:1 | 27 | + VPADDL_U 1111 001 11 . 11 .. 00 .... 0 0101 . . 0 .... @2misc |
30 | +VFML_scalar 1111 1110 0 . 0 s:1 .... .... 1000 . 0 . 1 index:1 ... \ | 28 | + |
31 | + rm=%vfml_scalar_q0_rm vn=%vn_sp vd=%vd_dp q=0 | 29 | + VPADAL_S 1111 001 11 . 11 .. 00 .... 0 1100 . . 0 .... @2misc |
32 | +VFML_scalar 1111 1110 0 . 0 s:1 .... .... 1000 . 1 . 1 . rm:3 \ | 30 | + VPADAL_U 1111 001 11 . 11 .. 00 .... 0 1101 . . 0 .... @2misc |
33 | + index=%vfml_scalar_q1_index vn=%vn_dp vd=%vd_dp q=1 | 31 | ] |
32 | |||
33 | # Subgroup for size != 0b11 | ||
34 | diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c | 34 | diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c |
35 | index XXXXXXX..XXXXXXX 100644 | 35 | index XXXXXXX..XXXXXXX 100644 |
36 | --- a/target/arm/translate-neon.inc.c | 36 | --- a/target/arm/translate-neon.inc.c |
37 | +++ b/target/arm/translate-neon.inc.c | 37 | +++ b/target/arm/translate-neon.inc.c |
38 | @@ -XXX,XX +XXX,XX @@ static bool trans_VDOT_scalar(DisasContext *s, arg_VDOT_scalar *a) | 38 | @@ -XXX,XX +XXX,XX @@ static bool trans_VREV64(DisasContext *s, arg_VREV64 *a) |
39 | tcg_temp_free_ptr(fpst); | 39 | } |
40 | return true; | 40 | return true; |
41 | } | 41 | } |
42 | + | 42 | + |
43 | +static bool trans_VFML_scalar(DisasContext *s, arg_VFML_scalar *a) | 43 | +static bool do_2misc_pairwise(DisasContext *s, arg_2misc *a, |
44 | +{ | 44 | + NeonGenWidenFn *widenfn, |
45 | + int opr_sz; | 45 | + NeonGenTwo64OpFn *opfn, |
46 | + | 46 | + NeonGenTwo64OpFn *accfn) |
47 | + if (!dc_isar_feature(aa32_fhm, s)) { | 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)) { | ||
48 | + return false; | 56 | + return false; |
49 | + } | 57 | + } |
50 | + | 58 | + |
51 | + /* UNDEF accesses to D16-D31 if they don't exist. */ | 59 | + /* UNDEF accesses to D16-D31 if they don't exist. */ |
52 | + if (!dc_isar_feature(aa32_simd_r32, s) && | 60 | + if (!dc_isar_feature(aa32_simd_r32, s) && |
53 | + ((a->vd & 0x10) || (a->q && (a->vn & 0x10)))) { | 61 | + ((a->vd | a->vm) & 0x10)) { |
54 | + return false; | 62 | + return false; |
55 | + } | 63 | + } |
56 | + | 64 | + |
57 | + if (a->vd & a->q) { | 65 | + if ((a->vd | a->vm) & a->q) { |
66 | + return false; | ||
67 | + } | ||
68 | + | ||
69 | + if (!widenfn) { | ||
58 | + return false; | 70 | + return false; |
59 | + } | 71 | + } |
60 | + | 72 | + |
61 | + if (!vfp_access_check(s)) { | 73 | + if (!vfp_access_check(s)) { |
62 | + return true; | 74 | + return true; |
63 | + } | 75 | + } |
64 | + | 76 | + |
65 | + opr_sz = (1 + a->q) * 8; | 77 | + for (pass = 0; pass < a->q + 1; pass++) { |
66 | + tcg_gen_gvec_3_ptr(vfp_reg_offset(1, a->vd), | 78 | + TCGv_i32 tmp; |
67 | + vfp_reg_offset(a->q, a->vn), | 79 | + TCGv_i64 rm0_64, rm1_64, rd_64; |
68 | + vfp_reg_offset(a->q, a->rm), | 80 | + |
69 | + cpu_env, opr_sz, opr_sz, | 81 | + rm0_64 = tcg_temp_new_i64(); |
70 | + (a->index << 2) | a->s, /* is_2 == 0 */ | 82 | + rm1_64 = tcg_temp_new_i64(); |
71 | + gen_helper_gvec_fmlal_idx_a32); | 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 | + } | ||
72 | + return true; | 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]); | ||
73 | +} | 190 | +} |
74 | diff --git a/target/arm/translate.c b/target/arm/translate.c | 191 | diff --git a/target/arm/translate.c b/target/arm/translate.c |
75 | index XXXXXXX..XXXXXXX 100644 | 192 | index XXXXXXX..XXXXXXX 100644 |
76 | --- a/target/arm/translate.c | 193 | --- a/target/arm/translate.c |
77 | +++ b/target/arm/translate.c | 194 | +++ b/target/arm/translate.c |
78 | @@ -XXX,XX +XXX,XX @@ static int disas_dsp_insn(DisasContext *s, uint32_t insn) | 195 | @@ -XXX,XX +XXX,XX @@ static void gen_exception_return(DisasContext *s, TCGv_i32 pc) |
196 | gen_rfe(s, pc, load_cpu_field(spsr)); | ||
79 | } | 197 | } |
80 | 198 | ||
81 | #define VFP_REG_SHR(x, n) (((n) > 0) ? (x) >> (n) : (x) << -(n)) | 199 | -#define CPU_V001 cpu_V0, cpu_V0, cpu_V1 |
82 | -#define VFP_SREG(insn, bigbit, smallbit) \ | 200 | - |
83 | - ((VFP_REG_SHR(insn, bigbit - 1) & 0x1e) | (((insn) >> (smallbit)) & 1)) | 201 | static int gen_neon_unzip(int rd, int rm, int size, int q) |
84 | #define VFP_DREG(reg, insn, bigbit, smallbit) do { \ | 202 | { |
85 | if (dc_isar_feature(aa32_simd_r32, s)) { \ | 203 | TCGv_ptr pd, pm; |
86 | reg = (((insn) >> (bigbit)) & 0x0f) \ | 204 | @@ -XXX,XX +XXX,XX @@ static inline void gen_neon_widen(TCGv_i64 dest, TCGv_i32 src, int size, int u) |
87 | @@ -XXX,XX +XXX,XX @@ static int disas_dsp_insn(DisasContext *s, uint32_t insn) | 205 | tcg_temp_free_i32(src); |
88 | reg = ((insn) >> (bigbit)) & 0x0f; \ | ||
89 | }} while (0) | ||
90 | |||
91 | -#define VFP_SREG_D(insn) VFP_SREG(insn, 12, 22) | ||
92 | #define VFP_DREG_D(reg, insn) VFP_DREG(reg, insn, 12, 22) | ||
93 | -#define VFP_SREG_N(insn) VFP_SREG(insn, 16, 7) | ||
94 | #define VFP_DREG_N(reg, insn) VFP_DREG(reg, insn, 16, 7) | ||
95 | -#define VFP_SREG_M(insn) VFP_SREG(insn, 0, 5) | ||
96 | #define VFP_DREG_M(reg, insn) VFP_DREG(reg, insn, 0, 5) | ||
97 | |||
98 | static void gen_neon_dup_low16(TCGv_i32 var) | ||
99 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) | ||
100 | return 0; | ||
101 | } | 206 | } |
102 | 207 | ||
103 | -/* Advanced SIMD two registers and a scalar extension. | 208 | -static inline void gen_neon_addl(int size) |
104 | - * 31 24 23 22 20 16 12 11 10 9 8 3 0 | ||
105 | - * +-----------------+----+---+----+----+----+---+----+---+----+---------+----+ | ||
106 | - * | 1 1 1 1 1 1 1 0 | o1 | D | o2 | Vn | Vd | 1 | o3 | 0 | o4 | N Q M U | Vm | | ||
107 | - * +-----------------+----+---+----+----+----+---+----+---+----+---------+----+ | ||
108 | - * | ||
109 | - */ | ||
110 | - | ||
111 | -static int disas_neon_insn_2reg_scalar_ext(DisasContext *s, uint32_t insn) | ||
112 | -{ | 209 | -{ |
113 | - gen_helper_gvec_3 *fn_gvec = NULL; | 210 | - switch (size) { |
114 | - gen_helper_gvec_3_ptr *fn_gvec_ptr = NULL; | 211 | - case 0: gen_helper_neon_addl_u16(CPU_V001); break; |
115 | - int rd, rn, rm, opr_sz, data; | 212 | - case 1: gen_helper_neon_addl_u32(CPU_V001); break; |
116 | - int off_rn, off_rm; | 213 | - case 2: tcg_gen_add_i64(CPU_V001); break; |
117 | - bool is_long = false, q = extract32(insn, 6, 1); | 214 | - default: abort(); |
118 | - bool ptr_is_env = false; | ||
119 | - | ||
120 | - if ((insn & 0xffa00f10) == 0xfe000810) { | ||
121 | - /* VFM[AS]L -- 1111 1110 0.0S .... .... 1000 .Q.1 .... */ | ||
122 | - int is_s = extract32(insn, 20, 1); | ||
123 | - int vm20 = extract32(insn, 0, 3); | ||
124 | - int vm3 = extract32(insn, 3, 1); | ||
125 | - int m = extract32(insn, 5, 1); | ||
126 | - int index; | ||
127 | - | ||
128 | - if (!dc_isar_feature(aa32_fhm, s)) { | ||
129 | - return 1; | ||
130 | - } | ||
131 | - if (q) { | ||
132 | - rm = vm20; | ||
133 | - index = m * 2 + vm3; | ||
134 | - } else { | ||
135 | - rm = vm20 * 2 + m; | ||
136 | - index = vm3; | ||
137 | - } | ||
138 | - is_long = true; | ||
139 | - data = (index << 2) | is_s; /* is_2 == 0 */ | ||
140 | - fn_gvec_ptr = gen_helper_gvec_fmlal_idx_a32; | ||
141 | - ptr_is_env = true; | ||
142 | - } else { | ||
143 | - return 1; | ||
144 | - } | 215 | - } |
145 | - | ||
146 | - VFP_DREG_D(rd, insn); | ||
147 | - if (rd & q) { | ||
148 | - return 1; | ||
149 | - } | ||
150 | - if (q || !is_long) { | ||
151 | - VFP_DREG_N(rn, insn); | ||
152 | - if (rn & q & !is_long) { | ||
153 | - return 1; | ||
154 | - } | ||
155 | - off_rn = vfp_reg_offset(1, rn); | ||
156 | - off_rm = vfp_reg_offset(1, rm); | ||
157 | - } else { | ||
158 | - rn = VFP_SREG_N(insn); | ||
159 | - off_rn = vfp_reg_offset(0, rn); | ||
160 | - off_rm = vfp_reg_offset(0, rm); | ||
161 | - } | ||
162 | - if (s->fp_excp_el) { | ||
163 | - gen_exception_insn(s, s->pc_curr, EXCP_UDEF, | ||
164 | - syn_simd_access_trap(1, 0xe, false), s->fp_excp_el); | ||
165 | - return 0; | ||
166 | - } | ||
167 | - if (!s->vfp_enabled) { | ||
168 | - return 1; | ||
169 | - } | ||
170 | - | ||
171 | - opr_sz = (1 + q) * 8; | ||
172 | - if (fn_gvec_ptr) { | ||
173 | - TCGv_ptr ptr; | ||
174 | - if (ptr_is_env) { | ||
175 | - ptr = cpu_env; | ||
176 | - } else { | ||
177 | - ptr = get_fpstatus_ptr(1); | ||
178 | - } | ||
179 | - tcg_gen_gvec_3_ptr(vfp_reg_offset(1, rd), off_rn, off_rm, ptr, | ||
180 | - opr_sz, opr_sz, data, fn_gvec_ptr); | ||
181 | - if (!ptr_is_env) { | ||
182 | - tcg_temp_free_ptr(ptr); | ||
183 | - } | ||
184 | - } else { | ||
185 | - tcg_gen_gvec_3_ool(vfp_reg_offset(1, rd), off_rn, off_rm, | ||
186 | - opr_sz, opr_sz, data, fn_gvec); | ||
187 | - } | ||
188 | - return 0; | ||
189 | -} | 216 | -} |
190 | - | 217 | - |
191 | static int disas_coproc_insn(DisasContext *s, uint32_t insn) | 218 | static void gen_neon_narrow_op(int op, int u, int size, |
219 | TCGv_i32 dest, TCGv_i64 src) | ||
192 | { | 220 | { |
193 | int cpnum, is64, crn, crm, opc1, opc2, isread, rt, rt2; | 221 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) |
194 | @@ -XXX,XX +XXX,XX @@ static void disas_arm_insn(DisasContext *s, unsigned int insn) | ||
195 | } | ||
196 | } | 222 | } |
197 | } | 223 | switch (op) { |
198 | - } else if ((insn & 0x0f000a00) == 0x0e000800 | 224 | case NEON_2RM_VREV64: |
199 | - && arm_dc_feature(s, ARM_FEATURE_V8)) { | 225 | - /* handled by decodetree */ |
200 | - if (disas_neon_insn_2reg_scalar_ext(s, insn)) { | 226 | - return 1; |
201 | - goto illegal_op; | 227 | case NEON_2RM_VPADDL: case NEON_2RM_VPADDL_U: |
202 | - } | 228 | case NEON_2RM_VPADAL: case NEON_2RM_VPADAL_U: |
203 | - return; | 229 | - for (pass = 0; pass < q + 1; pass++) { |
204 | } | 230 | - tmp = neon_load_reg(rm, pass * 2); |
205 | goto illegal_op; | 231 | - gen_neon_widen(cpu_V0, tmp, size, op & 1); |
206 | } | 232 | - tmp = neon_load_reg(rm, pass * 2 + 1); |
207 | @@ -XXX,XX +XXX,XX @@ static void disas_thumb2_insn(DisasContext *s, uint32_t insn) | 233 | - gen_neon_widen(cpu_V1, tmp, size, op & 1); |
208 | } | 234 | - switch (size) { |
209 | break; | 235 | - case 0: gen_helper_neon_paddl_u16(CPU_V001); break; |
210 | } | 236 | - case 1: gen_helper_neon_paddl_u32(CPU_V001); break; |
211 | - if ((insn & 0xff000a00) == 0xfe000800 | 237 | - case 2: tcg_gen_add_i64(CPU_V001); break; |
212 | - && arm_dc_feature(s, ARM_FEATURE_V8)) { | 238 | - default: abort(); |
213 | - /* The Thumb2 and ARM encodings are identical. */ | 239 | - } |
214 | - if (disas_neon_insn_2reg_scalar_ext(s, insn)) { | 240 | - if (op >= NEON_2RM_VPADAL) { |
215 | - goto illegal_op; | 241 | - /* Accumulate. */ |
216 | - } | 242 | - neon_load_reg64(cpu_V1, rd + pass); |
217 | - } else if (((insn >> 24) & 3) == 3) { | 243 | - gen_neon_addl(size); |
218 | + if (((insn >> 24) & 3) == 3) { | 244 | - } |
219 | /* Translate into the equivalent ARM encoding. */ | 245 | - neon_store_reg64(cpu_V0, rd + pass); |
220 | insn = (insn & 0xe2ffffff) | ((insn & (1 << 28)) >> 4) | (1 << 28); | 246 | - } |
221 | if (disas_neon_data_insn(s, insn)) { | 247 | - break; |
248 | + /* handled by decodetree */ | ||
249 | + return 1; | ||
250 | case NEON_2RM_VTRN: | ||
251 | if (size == 2) { | ||
252 | int n; | ||
222 | -- | 253 | -- |
223 | 2.20.1 | 254 | 2.20.1 |
224 | 255 | ||
225 | 256 | diff view generated by jsdifflib |
1 | We define ARMMMUIdx_Stage2 as being an MMU index which uses a QEMU | 1 | Convert the Neon VZIP and VUZP insns in the 2-reg-misc group to |
---|---|---|---|
2 | TLB. However we never actually use the TLB -- all stage 2 lookups | 2 | decodetree. |
3 | are done by direct calls to get_phys_addr_lpae() followed by a | ||
4 | physical address load via address_space_ld*(). | ||
5 | |||
6 | Remove Stage2 from the list of ARM MMU indexes which correspond to | ||
7 | real core MMU indexes, and instead put it in the set of "NOTLB" ARM | ||
8 | MMU indexes. | ||
9 | |||
10 | This allows us to drop NB_MMU_MODES to 11. It also means we can | ||
11 | safely add support for the ARMv8.3-TTS2UXN extension, which adds | ||
12 | permission bits to the stage 2 descriptors which define execute | ||
13 | permission separatel for EL0 and EL1; supporting that while keeping | ||
14 | Stage2 in a QEMU TLB would require us to use separate TLBs for | ||
15 | "Stage2 for an EL0 access" and "Stage2 for an EL1 access", which is a | ||
16 | lot of extra complication given we aren't even using the QEMU TLB. | ||
17 | |||
18 | In the process of updating the comment on our MMU index use, | ||
19 | fix a couple of other minor errors: | ||
20 | * NS EL2 EL2&0 was missing from the list in the comment | ||
21 | * some text hadn't been updated from when we bumped NB_MMU_MODES | ||
22 | above 8 | ||
23 | 3 | ||
24 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 4 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
25 | Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | ||
26 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 5 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
27 | Message-id: 20200330210400.11724-2-peter.maydell@linaro.org | 6 | Message-id: 20200616170844.13318-4-peter.maydell@linaro.org |
28 | --- | 7 | --- |
29 | target/arm/cpu-param.h | 2 +- | 8 | target/arm/neon-dp.decode | 3 ++ |
30 | target/arm/cpu.h | 21 +++++--- | 9 | target/arm/translate-neon.inc.c | 74 ++++++++++++++++++++++++++ |
31 | target/arm/helper.c | 112 ++++------------------------------------- | 10 | target/arm/translate.c | 92 +-------------------------------- |
32 | 3 files changed, 27 insertions(+), 108 deletions(-) | 11 | 3 files changed, 79 insertions(+), 90 deletions(-) |
33 | 12 | ||
34 | diff --git a/target/arm/cpu-param.h b/target/arm/cpu-param.h | 13 | diff --git a/target/arm/neon-dp.decode b/target/arm/neon-dp.decode |
35 | index XXXXXXX..XXXXXXX 100644 | 14 | index XXXXXXX..XXXXXXX 100644 |
36 | --- a/target/arm/cpu-param.h | 15 | --- a/target/arm/neon-dp.decode |
37 | +++ b/target/arm/cpu-param.h | 16 | +++ b/target/arm/neon-dp.decode |
38 | @@ -XXX,XX +XXX,XX @@ | 17 | @@ -XXX,XX +XXX,XX @@ Vimm_1r 1111 001 . 1 . 000 ... .... cmode:4 0 . op:1 1 .... @1reg_imm |
39 | # define TARGET_PAGE_BITS_MIN 10 | 18 | |
40 | #endif | 19 | VPADAL_S 1111 001 11 . 11 .. 00 .... 0 1100 . . 0 .... @2misc |
41 | 20 | VPADAL_U 1111 001 11 . 11 .. 00 .... 0 1101 . . 0 .... @2misc | |
42 | -#define NB_MMU_MODES 12 | 21 | + |
43 | +#define NB_MMU_MODES 11 | 22 | + VUZP 1111 001 11 . 11 .. 10 .... 0 0010 . . 0 .... @2misc |
44 | 23 | + VZIP 1111 001 11 . 11 .. 10 .... 0 0011 . . 0 .... @2misc | |
45 | #endif | 24 | ] |
46 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h | 25 | |
26 | # Subgroup for size != 0b11 | ||
27 | diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c | ||
47 | index XXXXXXX..XXXXXXX 100644 | 28 | index XXXXXXX..XXXXXXX 100644 |
48 | --- a/target/arm/cpu.h | 29 | --- a/target/arm/translate-neon.inc.c |
49 | +++ b/target/arm/cpu.h | 30 | +++ b/target/arm/translate-neon.inc.c |
50 | @@ -XXX,XX +XXX,XX @@ bool write_cpustate_to_list(ARMCPU *cpu, bool kvm_sync); | 31 | @@ -XXX,XX +XXX,XX @@ static bool trans_VPADAL_U(DisasContext *s, arg_2misc *a) |
51 | * handling via the TLB. The only way to do a stage 1 translation without | 32 | return do_2misc_pairwise(s, a, widenfn[a->size], opfn[a->size], |
52 | * the immediate stage 2 translation is via the ATS or AT system insns, | 33 | accfn[a->size]); |
53 | * which can be slow-pathed and always do a page table walk. | 34 | } |
54 | + * The only use of stage 2 translations is either as part of an s1+2 | 35 | + |
55 | + * lookup or when loading the descriptors during a stage 1 page table walk, | 36 | +typedef void ZipFn(TCGv_ptr, TCGv_ptr); |
56 | + * and in both those cases we don't use the TLB. | 37 | + |
57 | * 4. we can also safely fold together the "32 bit EL3" and "64 bit EL3" | 38 | +static bool do_zip_uzp(DisasContext *s, arg_2misc *a, |
58 | * translation regimes, because they map reasonably well to each other | 39 | + ZipFn *fn) |
59 | * and they can't both be active at the same time. | 40 | +{ |
60 | @@ -XXX,XX +XXX,XX @@ bool write_cpustate_to_list(ARMCPU *cpu, bool kvm_sync); | 41 | + TCGv_ptr pd, pm; |
61 | * NS EL1 EL1&0 stage 1+2 (aka NS PL1) | 42 | + |
62 | * NS EL1 EL1&0 stage 1+2 +PAN | 43 | + if (!arm_dc_feature(s, ARM_FEATURE_NEON)) { |
63 | * NS EL0 EL2&0 | 44 | + return false; |
64 | + * NS EL2 EL2&0 | 45 | + } |
65 | * NS EL2 EL2&0 +PAN | 46 | + |
66 | * NS EL2 (aka NS PL2) | 47 | + /* UNDEF accesses to D16-D31 if they don't exist. */ |
67 | * S EL0 EL1&0 (aka S PL0) | 48 | + if (!dc_isar_feature(aa32_simd_r32, s) && |
68 | * S EL1 EL1&0 (not used if EL3 is 32 bit) | 49 | + ((a->vd | a->vm) & 0x10)) { |
69 | * S EL1 EL1&0 +PAN | 50 | + return false; |
70 | * S EL3 (aka S PL1) | 51 | + } |
71 | - * NS EL1&0 stage 2 | 52 | + |
72 | * | 53 | + if ((a->vd | a->vm) & a->q) { |
73 | - * for a total of 12 different mmu_idx. | 54 | + return false; |
74 | + * for a total of 11 different mmu_idx. | 55 | + } |
75 | * | 56 | + |
76 | * R profile CPUs have an MPU, but can use the same set of MMU indexes | 57 | + if (!fn) { |
77 | * as A profile. They only need to distinguish NS EL0 and NS EL1 (and | 58 | + /* Bad size or size/q combination */ |
78 | @@ -XXX,XX +XXX,XX @@ bool write_cpustate_to_list(ARMCPU *cpu, bool kvm_sync); | 59 | + return false; |
79 | * are not quite the same -- different CPU types (most notably M profile | 60 | + } |
80 | * vs A/R profile) would like to use MMU indexes with different semantics, | 61 | + |
81 | * but since we don't ever need to use all of those in a single CPU we | 62 | + if (!vfp_access_check(s)) { |
82 | - * can avoid setting NB_MMU_MODES to more than 8. The lower bits of | 63 | + return true; |
83 | + * can avoid having to set NB_MMU_MODES to "total number of A profile MMU | 64 | + } |
84 | + * modes + total number of M profile MMU modes". The lower bits of | 65 | + |
85 | * ARMMMUIdx are the core TLB mmu index, and the higher bits are always | 66 | + pd = vfp_reg_ptr(true, a->vd); |
86 | * the same for any particular CPU. | 67 | + pm = vfp_reg_ptr(true, a->vm); |
87 | * Variables of type ARMMUIdx are always full values, and the core | 68 | + fn(pd, pm); |
88 | @@ -XXX,XX +XXX,XX @@ typedef enum ARMMMUIdx { | 69 | + tcg_temp_free_ptr(pd); |
89 | ARMMMUIdx_SE10_1_PAN = 9 | ARM_MMU_IDX_A, | 70 | + tcg_temp_free_ptr(pm); |
90 | ARMMMUIdx_SE3 = 10 | ARM_MMU_IDX_A, | 71 | + return true; |
91 | 72 | +} | |
92 | - ARMMMUIdx_Stage2 = 11 | ARM_MMU_IDX_A, | 73 | + |
93 | - | 74 | +static bool trans_VUZP(DisasContext *s, arg_2misc *a) |
94 | /* | 75 | +{ |
95 | * These are not allocated TLBs and are used only for AT system | 76 | + static ZipFn * const fn[2][4] = { |
96 | * instructions or for the first stage of an S12 page table walk. | 77 | + { |
97 | @@ -XXX,XX +XXX,XX @@ typedef enum ARMMMUIdx { | 78 | + gen_helper_neon_unzip8, |
98 | ARMMMUIdx_Stage1_E0 = 0 | ARM_MMU_IDX_NOTLB, | 79 | + gen_helper_neon_unzip16, |
99 | ARMMMUIdx_Stage1_E1 = 1 | ARM_MMU_IDX_NOTLB, | 80 | + NULL, |
100 | ARMMMUIdx_Stage1_E1_PAN = 2 | ARM_MMU_IDX_NOTLB, | 81 | + NULL, |
101 | + /* | 82 | + }, { |
102 | + * Not allocated a TLB: used only for second stage of an S12 page | 83 | + gen_helper_neon_qunzip8, |
103 | + * table walk, or for descriptor loads during first stage of an S1 | 84 | + gen_helper_neon_qunzip16, |
104 | + * page table walk. Note that if we ever want to have a TLB for this | 85 | + gen_helper_neon_qunzip32, |
105 | + * then various TLB flush insns which currently are no-ops or flush | 86 | + NULL, |
106 | + * only stage 1 MMU indexes will need to change to flush stage 2. | 87 | + } |
107 | + */ | 88 | + }; |
108 | + ARMMMUIdx_Stage2 = 3 | ARM_MMU_IDX_NOTLB, | 89 | + return do_zip_uzp(s, a, fn[a->q][a->size]); |
109 | 90 | +} | |
110 | /* | 91 | + |
111 | * M-profile. | 92 | +static bool trans_VZIP(DisasContext *s, arg_2misc *a) |
112 | @@ -XXX,XX +XXX,XX @@ typedef enum ARMMMUIdxBit { | 93 | +{ |
113 | TO_CORE_BIT(SE10_1), | 94 | + static ZipFn * const fn[2][4] = { |
114 | TO_CORE_BIT(SE10_1_PAN), | 95 | + { |
115 | TO_CORE_BIT(SE3), | 96 | + gen_helper_neon_zip8, |
116 | - TO_CORE_BIT(Stage2), | 97 | + gen_helper_neon_zip16, |
117 | 98 | + NULL, | |
118 | TO_CORE_BIT(MUser), | 99 | + NULL, |
119 | TO_CORE_BIT(MPriv), | 100 | + }, { |
120 | diff --git a/target/arm/helper.c b/target/arm/helper.c | 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 | ||
121 | index XXXXXXX..XXXXXXX 100644 | 110 | index XXXXXXX..XXXXXXX 100644 |
122 | --- a/target/arm/helper.c | 111 | --- a/target/arm/translate.c |
123 | +++ b/target/arm/helper.c | 112 | +++ b/target/arm/translate.c |
124 | @@ -XXX,XX +XXX,XX @@ static void tlbiall_nsnh_write(CPUARMState *env, const ARMCPRegInfo *ri, | 113 | @@ -XXX,XX +XXX,XX @@ static void gen_exception_return(DisasContext *s, TCGv_i32 pc) |
125 | tlb_flush_by_mmuidx(cs, | 114 | gen_rfe(s, pc, load_cpu_field(spsr)); |
126 | ARMMMUIdxBit_E10_1 | | ||
127 | ARMMMUIdxBit_E10_1_PAN | | ||
128 | - ARMMMUIdxBit_E10_0 | | ||
129 | - ARMMMUIdxBit_Stage2); | ||
130 | + ARMMMUIdxBit_E10_0); | ||
131 | } | 115 | } |
132 | 116 | ||
133 | static void tlbiall_nsnh_is_write(CPUARMState *env, const ARMCPRegInfo *ri, | 117 | -static int gen_neon_unzip(int rd, int rm, int size, int q) |
134 | @@ -XXX,XX +XXX,XX @@ static void tlbiall_nsnh_is_write(CPUARMState *env, const ARMCPRegInfo *ri, | ||
135 | tlb_flush_by_mmuidx_all_cpus_synced(cs, | ||
136 | ARMMMUIdxBit_E10_1 | | ||
137 | ARMMMUIdxBit_E10_1_PAN | | ||
138 | - ARMMMUIdxBit_E10_0 | | ||
139 | - ARMMMUIdxBit_Stage2); | ||
140 | + ARMMMUIdxBit_E10_0); | ||
141 | } | ||
142 | |||
143 | -static void tlbiipas2_write(CPUARMState *env, const ARMCPRegInfo *ri, | ||
144 | - uint64_t value) | ||
145 | -{ | 118 | -{ |
146 | - /* Invalidate by IPA. This has to invalidate any structures that | 119 | - TCGv_ptr pd, pm; |
147 | - * contain only stage 2 translation information, but does not need | 120 | - |
148 | - * to apply to structures that contain combined stage 1 and stage 2 | 121 | - if (!q && size == 2) { |
149 | - * translation information. | 122 | - return 1; |
150 | - * This must NOP if EL2 isn't implemented or SCR_EL3.NS is zero. | 123 | - } |
151 | - */ | 124 | - pd = vfp_reg_ptr(true, rd); |
152 | - CPUState *cs = env_cpu(env); | 125 | - pm = vfp_reg_ptr(true, rm); |
153 | - uint64_t pageaddr; | 126 | - if (q) { |
154 | - | 127 | - switch (size) { |
155 | - if (!arm_feature(env, ARM_FEATURE_EL2) || !(env->cp15.scr_el3 & SCR_NS)) { | 128 | - case 0: |
156 | - return; | 129 | - gen_helper_neon_qunzip8(pd, pm); |
157 | - } | 130 | - break; |
158 | - | 131 | - case 1: |
159 | - pageaddr = sextract64(value << 12, 0, 40); | 132 | - gen_helper_neon_qunzip16(pd, pm); |
160 | - | 133 | - break; |
161 | - tlb_flush_page_by_mmuidx(cs, pageaddr, ARMMMUIdxBit_Stage2); | 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; | ||
162 | -} | 155 | -} |
163 | - | 156 | - |
164 | -static void tlbiipas2_is_write(CPUARMState *env, const ARMCPRegInfo *ri, | 157 | -static int gen_neon_zip(int rd, int rm, int size, int q) |
165 | - uint64_t value) | ||
166 | -{ | 158 | -{ |
167 | - CPUState *cs = env_cpu(env); | 159 | - TCGv_ptr pd, pm; |
168 | - uint64_t pageaddr; | ||
169 | - | 160 | - |
170 | - if (!arm_feature(env, ARM_FEATURE_EL2) || !(env->cp15.scr_el3 & SCR_NS)) { | 161 | - if (!q && size == 2) { |
171 | - return; | 162 | - return 1; |
172 | - } | 163 | - } |
173 | - | 164 | - pd = vfp_reg_ptr(true, rd); |
174 | - pageaddr = sextract64(value << 12, 0, 40); | 165 | - pm = vfp_reg_ptr(true, rm); |
175 | - | 166 | - if (q) { |
176 | - tlb_flush_page_by_mmuidx_all_cpus_synced(cs, pageaddr, | 167 | - switch (size) { |
177 | - ARMMMUIdxBit_Stage2); | 168 | - case 0: |
178 | -} | 169 | - gen_helper_neon_qzip8(pd, pm); |
179 | 170 | - break; | |
180 | static void tlbiall_hyp_write(CPUARMState *env, const ARMCPRegInfo *ri, | 171 | - case 1: |
181 | uint64_t value) | 172 | - gen_helper_neon_qzip16(pd, pm); |
182 | @@ -XXX,XX +XXX,XX @@ static void vttbr_write(CPUARMState *env, const ARMCPRegInfo *ri, | 173 | - break; |
183 | tlb_flush_by_mmuidx(cs, | 174 | - case 2: |
184 | ARMMMUIdxBit_E10_1 | | 175 | - gen_helper_neon_qzip32(pd, pm); |
185 | ARMMMUIdxBit_E10_1_PAN | | 176 | - break; |
186 | - ARMMMUIdxBit_E10_0 | | 177 | - default: |
187 | - ARMMMUIdxBit_Stage2); | 178 | - abort(); |
188 | + ARMMMUIdxBit_E10_0); | 179 | - } |
189 | raw_write(env, ri, value); | 180 | - } else { |
190 | } | 181 | - switch (size) { |
191 | } | 182 | - case 0: |
192 | @@ -XXX,XX +XXX,XX @@ static int alle1_tlbmask(CPUARMState *env) | 183 | - gen_helper_neon_zip8(pd, pm); |
193 | return ARMMMUIdxBit_SE10_1 | | 184 | - break; |
194 | ARMMMUIdxBit_SE10_1_PAN | | 185 | - case 1: |
195 | ARMMMUIdxBit_SE10_0; | 186 | - gen_helper_neon_zip16(pd, pm); |
196 | - } else if (arm_feature(env, ARM_FEATURE_EL2)) { | 187 | - break; |
197 | - return ARMMMUIdxBit_E10_1 | | 188 | - default: |
198 | - ARMMMUIdxBit_E10_1_PAN | | 189 | - abort(); |
199 | - ARMMMUIdxBit_E10_0 | | 190 | - } |
200 | - ARMMMUIdxBit_Stage2; | 191 | - } |
201 | } else { | 192 | - tcg_temp_free_ptr(pd); |
202 | return ARMMMUIdxBit_E10_1 | | 193 | - tcg_temp_free_ptr(pm); |
203 | ARMMMUIdxBit_E10_1_PAN | | 194 | - return 0; |
204 | @@ -XXX,XX +XXX,XX @@ static void tlbi_aa64_vae3is_write(CPUARMState *env, const ARMCPRegInfo *ri, | ||
205 | ARMMMUIdxBit_SE3); | ||
206 | } | ||
207 | |||
208 | -static void tlbi_aa64_ipas2e1_write(CPUARMState *env, const ARMCPRegInfo *ri, | ||
209 | - uint64_t value) | ||
210 | -{ | ||
211 | - /* Invalidate by IPA. This has to invalidate any structures that | ||
212 | - * contain only stage 2 translation information, but does not need | ||
213 | - * to apply to structures that contain combined stage 1 and stage 2 | ||
214 | - * translation information. | ||
215 | - * This must NOP if EL2 isn't implemented or SCR_EL3.NS is zero. | ||
216 | - */ | ||
217 | - ARMCPU *cpu = env_archcpu(env); | ||
218 | - CPUState *cs = CPU(cpu); | ||
219 | - uint64_t pageaddr; | ||
220 | - | ||
221 | - if (!arm_feature(env, ARM_FEATURE_EL2) || !(env->cp15.scr_el3 & SCR_NS)) { | ||
222 | - return; | ||
223 | - } | ||
224 | - | ||
225 | - pageaddr = sextract64(value << 12, 0, 48); | ||
226 | - | ||
227 | - tlb_flush_page_by_mmuidx(cs, pageaddr, ARMMMUIdxBit_Stage2); | ||
228 | -} | 195 | -} |
229 | - | 196 | - |
230 | -static void tlbi_aa64_ipas2e1is_write(CPUARMState *env, const ARMCPRegInfo *ri, | 197 | static void gen_neon_trn_u8(TCGv_i32 t0, TCGv_i32 t1) |
231 | - uint64_t value) | ||
232 | -{ | ||
233 | - CPUState *cs = env_cpu(env); | ||
234 | - uint64_t pageaddr; | ||
235 | - | ||
236 | - if (!arm_feature(env, ARM_FEATURE_EL2) || !(env->cp15.scr_el3 & SCR_NS)) { | ||
237 | - return; | ||
238 | - } | ||
239 | - | ||
240 | - pageaddr = sextract64(value << 12, 0, 48); | ||
241 | - | ||
242 | - tlb_flush_page_by_mmuidx_all_cpus_synced(cs, pageaddr, | ||
243 | - ARMMMUIdxBit_Stage2); | ||
244 | -} | ||
245 | - | ||
246 | static CPAccessResult aa64_zva_access(CPUARMState *env, const ARMCPRegInfo *ri, | ||
247 | bool isread) | ||
248 | { | 198 | { |
249 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v8_cp_reginfo[] = { | 199 | TCGv_i32 rd, tmp; |
250 | .writefn = tlbi_aa64_vae1_write }, | 200 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) |
251 | { .name = "TLBI_IPAS2E1IS", .state = ARM_CP_STATE_AA64, | 201 | case NEON_2RM_VREV64: |
252 | .opc0 = 1, .opc1 = 4, .crn = 8, .crm = 0, .opc2 = 1, | 202 | case NEON_2RM_VPADDL: case NEON_2RM_VPADDL_U: |
253 | - .access = PL2_W, .type = ARM_CP_NO_RAW, | 203 | case NEON_2RM_VPADAL: case NEON_2RM_VPADAL_U: |
254 | - .writefn = tlbi_aa64_ipas2e1is_write }, | 204 | + case NEON_2RM_VUZP: |
255 | + .access = PL2_W, .type = ARM_CP_NOP }, | 205 | + case NEON_2RM_VZIP: |
256 | { .name = "TLBI_IPAS2LE1IS", .state = ARM_CP_STATE_AA64, | 206 | /* handled by decodetree */ |
257 | .opc0 = 1, .opc1 = 4, .crn = 8, .crm = 0, .opc2 = 5, | 207 | return 1; |
258 | - .access = PL2_W, .type = ARM_CP_NO_RAW, | 208 | case NEON_2RM_VTRN: |
259 | - .writefn = tlbi_aa64_ipas2e1is_write }, | 209 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) |
260 | + .access = PL2_W, .type = ARM_CP_NOP }, | 210 | goto elementwise; |
261 | { .name = "TLBI_ALLE1IS", .state = ARM_CP_STATE_AA64, | 211 | } |
262 | .opc0 = 1, .opc1 = 4, .crn = 8, .crm = 3, .opc2 = 4, | 212 | break; |
263 | .access = PL2_W, .type = ARM_CP_NO_RAW, | 213 | - case NEON_2RM_VUZP: |
264 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v8_cp_reginfo[] = { | 214 | - if (gen_neon_unzip(rd, rm, size, q)) { |
265 | .writefn = tlbi_aa64_alle1is_write }, | 215 | - return 1; |
266 | { .name = "TLBI_IPAS2E1", .state = ARM_CP_STATE_AA64, | 216 | - } |
267 | .opc0 = 1, .opc1 = 4, .crn = 8, .crm = 4, .opc2 = 1, | 217 | - break; |
268 | - .access = PL2_W, .type = ARM_CP_NO_RAW, | 218 | - case NEON_2RM_VZIP: |
269 | - .writefn = tlbi_aa64_ipas2e1_write }, | 219 | - if (gen_neon_zip(rd, rm, size, q)) { |
270 | + .access = PL2_W, .type = ARM_CP_NOP }, | 220 | - return 1; |
271 | { .name = "TLBI_IPAS2LE1", .state = ARM_CP_STATE_AA64, | 221 | - } |
272 | .opc0 = 1, .opc1 = 4, .crn = 8, .crm = 4, .opc2 = 5, | 222 | - break; |
273 | - .access = PL2_W, .type = ARM_CP_NO_RAW, | 223 | case NEON_2RM_VMOVN: case NEON_2RM_VQMOVN: |
274 | - .writefn = tlbi_aa64_ipas2e1_write }, | 224 | /* also VQMOVUN; op field and mnemonics don't line up */ |
275 | + .access = PL2_W, .type = ARM_CP_NOP }, | 225 | if (rm & 1) { |
276 | { .name = "TLBI_ALLE1", .state = ARM_CP_STATE_AA64, | ||
277 | .opc0 = 1, .opc1 = 4, .crn = 8, .crm = 7, .opc2 = 4, | ||
278 | .access = PL2_W, .type = ARM_CP_NO_RAW, | ||
279 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v8_cp_reginfo[] = { | ||
280 | .writefn = tlbimva_hyp_is_write }, | ||
281 | { .name = "TLBIIPAS2", | ||
282 | .cp = 15, .opc1 = 4, .crn = 8, .crm = 4, .opc2 = 1, | ||
283 | - .type = ARM_CP_NO_RAW, .access = PL2_W, | ||
284 | - .writefn = tlbiipas2_write }, | ||
285 | + .type = ARM_CP_NOP, .access = PL2_W }, | ||
286 | { .name = "TLBIIPAS2IS", | ||
287 | .cp = 15, .opc1 = 4, .crn = 8, .crm = 0, .opc2 = 1, | ||
288 | - .type = ARM_CP_NO_RAW, .access = PL2_W, | ||
289 | - .writefn = tlbiipas2_is_write }, | ||
290 | + .type = ARM_CP_NOP, .access = PL2_W }, | ||
291 | { .name = "TLBIIPAS2L", | ||
292 | .cp = 15, .opc1 = 4, .crn = 8, .crm = 4, .opc2 = 5, | ||
293 | - .type = ARM_CP_NO_RAW, .access = PL2_W, | ||
294 | - .writefn = tlbiipas2_write }, | ||
295 | + .type = ARM_CP_NOP, .access = PL2_W }, | ||
296 | { .name = "TLBIIPAS2LIS", | ||
297 | .cp = 15, .opc1 = 4, .crn = 8, .crm = 0, .opc2 = 5, | ||
298 | - .type = ARM_CP_NO_RAW, .access = PL2_W, | ||
299 | - .writefn = tlbiipas2_is_write }, | ||
300 | + .type = ARM_CP_NOP, .access = PL2_W }, | ||
301 | /* 32 bit cache operations */ | ||
302 | { .name = "ICIALLUIS", .cp = 15, .opc1 = 0, .crn = 7, .crm = 1, .opc2 = 0, | ||
303 | .type = ARM_CP_NOP, .access = PL1_W, .accessfn = aa64_cacheop_pou_access }, | ||
304 | -- | 226 | -- |
305 | 2.20.1 | 227 | 2.20.1 |
306 | 228 | ||
307 | 229 | diff view generated by jsdifflib |
1 | Convert the Neon "load/store multiple structures" insns to decodetree. | 1 | Convert the Neon narrowing moves VMQNV, VQMOVN, VQMOVUN in the 2-reg-misc |
---|---|---|---|
2 | group to decodetree. | ||
2 | 3 | ||
3 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 4 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
4 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 5 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
5 | Message-id: 20200430181003.21682-12-peter.maydell@linaro.org | 6 | Message-id: 20200616170844.13318-5-peter.maydell@linaro.org |
6 | --- | 7 | --- |
7 | target/arm/neon-ls.decode | 7 ++ | 8 | target/arm/neon-dp.decode | 9 ++++ |
8 | target/arm/translate-neon.inc.c | 124 ++++++++++++++++++++++++++++++++ | 9 | target/arm/translate-neon.inc.c | 59 ++++++++++++++++++++++++ |
9 | target/arm/translate.c | 91 +---------------------- | 10 | target/arm/translate.c | 81 +-------------------------------- |
10 | 3 files changed, 133 insertions(+), 89 deletions(-) | 11 | 3 files changed, 70 insertions(+), 79 deletions(-) |
11 | 12 | ||
12 | diff --git a/target/arm/neon-ls.decode b/target/arm/neon-ls.decode | 13 | diff --git a/target/arm/neon-dp.decode b/target/arm/neon-dp.decode |
13 | index XXXXXXX..XXXXXXX 100644 | 14 | index XXXXXXX..XXXXXXX 100644 |
14 | --- a/target/arm/neon-ls.decode | 15 | --- a/target/arm/neon-dp.decode |
15 | +++ b/target/arm/neon-ls.decode | 16 | +++ b/target/arm/neon-dp.decode |
16 | @@ -XXX,XX +XXX,XX @@ | 17 | @@ -XXX,XX +XXX,XX @@ Vimm_1r 1111 001 . 1 . 000 ... .... cmode:4 0 . op:1 1 .... @1reg_imm |
17 | # 0b1111_1001_xxx0_xxxx_xxxx_xxxx_xxxx_xxxx | 18 | |
18 | # This file works on the A32 encoding only; calling code for T32 has to | 19 | @2misc .... ... .. . .. size:2 .. .... . .... q:1 . . .... \ |
19 | # transform the insn into the A32 version first. | 20 | &2misc vm=%vm_dp vd=%vd_dp |
20 | + | 21 | + @2misc_q0 .... ... .. . .. size:2 .. .... . .... . . . .... \ |
21 | +%vd_dp 22:1 12:4 | 22 | + &2misc vm=%vm_dp vd=%vd_dp q=0 |
22 | + | 23 | |
23 | +# Neon load/store multiple structures | 24 | VREV64 1111 001 11 . 11 .. 00 .... 0 0000 . . 0 .... @2misc |
24 | + | 25 | |
25 | +VLDST_multiple 1111 0100 0 . l:1 0 rn:4 .... itype:4 size:2 align:2 rm:4 \ | 26 | @@ -XXX,XX +XXX,XX @@ Vimm_1r 1111 001 . 1 . 000 ... .... cmode:4 0 . op:1 1 .... @1reg_imm |
26 | + vd=%vd_dp | 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 | ||
27 | diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c | 40 | diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c |
28 | index XXXXXXX..XXXXXXX 100644 | 41 | index XXXXXXX..XXXXXXX 100644 |
29 | --- a/target/arm/translate-neon.inc.c | 42 | --- a/target/arm/translate-neon.inc.c |
30 | +++ b/target/arm/translate-neon.inc.c | 43 | +++ b/target/arm/translate-neon.inc.c |
31 | @@ -XXX,XX +XXX,XX @@ static bool trans_VFML_scalar(DisasContext *s, arg_VFML_scalar *a) | 44 | @@ -XXX,XX +XXX,XX @@ static bool trans_VZIP(DisasContext *s, arg_2misc *a) |
32 | gen_helper_gvec_fmlal_idx_a32); | 45 | }; |
33 | return true; | 46 | return do_zip_uzp(s, a, fn[a->q][a->size]); |
34 | } | 47 | } |
35 | + | 48 | + |
36 | +static struct { | 49 | +static bool do_vmovn(DisasContext *s, arg_2misc *a, |
37 | + int nregs; | 50 | + NeonGenNarrowEnvFn *narrowfn) |
38 | + int interleave; | ||
39 | + int spacing; | ||
40 | +} const neon_ls_element_type[11] = { | ||
41 | + {1, 4, 1}, | ||
42 | + {1, 4, 2}, | ||
43 | + {4, 1, 1}, | ||
44 | + {2, 2, 2}, | ||
45 | + {1, 3, 1}, | ||
46 | + {1, 3, 2}, | ||
47 | + {3, 1, 1}, | ||
48 | + {1, 1, 1}, | ||
49 | + {1, 2, 1}, | ||
50 | + {1, 2, 2}, | ||
51 | + {2, 1, 1} | ||
52 | +}; | ||
53 | + | ||
54 | +static void gen_neon_ldst_base_update(DisasContext *s, int rm, int rn, | ||
55 | + int stride) | ||
56 | +{ | 51 | +{ |
57 | + if (rm != 15) { | 52 | + TCGv_i64 rm; |
58 | + TCGv_i32 base; | 53 | + TCGv_i32 rd0, rd1; |
59 | + | ||
60 | + base = load_reg(s, rn); | ||
61 | + if (rm == 13) { | ||
62 | + tcg_gen_addi_i32(base, base, stride); | ||
63 | + } else { | ||
64 | + TCGv_i32 index; | ||
65 | + index = load_reg(s, rm); | ||
66 | + tcg_gen_add_i32(base, base, index); | ||
67 | + tcg_temp_free_i32(index); | ||
68 | + } | ||
69 | + store_reg(s, rn, base); | ||
70 | + } | ||
71 | +} | ||
72 | + | ||
73 | +static bool trans_VLDST_multiple(DisasContext *s, arg_VLDST_multiple *a) | ||
74 | +{ | ||
75 | + /* Neon load/store multiple structures */ | ||
76 | + int nregs, interleave, spacing, reg, n; | ||
77 | + MemOp endian = s->be_data; | ||
78 | + int mmu_idx = get_mem_index(s); | ||
79 | + int size = a->size; | ||
80 | + TCGv_i64 tmp64; | ||
81 | + TCGv_i32 addr, tmp; | ||
82 | + | 54 | + |
83 | + if (!arm_dc_feature(s, ARM_FEATURE_NEON)) { | 55 | + if (!arm_dc_feature(s, ARM_FEATURE_NEON)) { |
84 | + return false; | 56 | + return false; |
85 | + } | 57 | + } |
86 | + | 58 | + |
87 | + /* UNDEF accesses to D16-D31 if they don't exist */ | 59 | + /* UNDEF accesses to D16-D31 if they don't exist. */ |
88 | + if (!dc_isar_feature(aa32_simd_r32, s) && (a->vd & 0x10)) { | 60 | + if (!dc_isar_feature(aa32_simd_r32, s) && |
89 | + return false; | 61 | + ((a->vd | a->vm) & 0x10)) { |
90 | + } | 62 | + return false; |
91 | + if (a->itype > 10) { | 63 | + } |
92 | + return false; | 64 | + |
93 | + } | 65 | + if (a->vm & 1) { |
94 | + /* Catch UNDEF cases for bad values of align field */ | 66 | + return false; |
95 | + switch (a->itype & 0xc) { | 67 | + } |
96 | + case 4: | 68 | + |
97 | + if (a->align >= 2) { | 69 | + if (!narrowfn) { |
98 | + return false; | ||
99 | + } | ||
100 | + break; | ||
101 | + case 8: | ||
102 | + if (a->align == 3) { | ||
103 | + return false; | ||
104 | + } | ||
105 | + break; | ||
106 | + default: | ||
107 | + break; | ||
108 | + } | ||
109 | + nregs = neon_ls_element_type[a->itype].nregs; | ||
110 | + interleave = neon_ls_element_type[a->itype].interleave; | ||
111 | + spacing = neon_ls_element_type[a->itype].spacing; | ||
112 | + if (size == 3 && (interleave | spacing) != 1) { | ||
113 | + return false; | 70 | + return false; |
114 | + } | 71 | + } |
115 | + | 72 | + |
116 | + if (!vfp_access_check(s)) { | 73 | + if (!vfp_access_check(s)) { |
117 | + return true; | 74 | + return true; |
118 | + } | 75 | + } |
119 | + | 76 | + |
120 | + /* For our purposes, bytes are always little-endian. */ | 77 | + rm = tcg_temp_new_i64(); |
121 | + if (size == 0) { | 78 | + rd0 = tcg_temp_new_i32(); |
122 | + endian = MO_LE; | 79 | + rd1 = tcg_temp_new_i32(); |
123 | + } | 80 | + |
124 | + /* | 81 | + neon_load_reg64(rm, a->vm); |
125 | + * Consecutive little-endian elements from a single register | 82 | + narrowfn(rd0, cpu_env, rm); |
126 | + * can be promoted to a larger little-endian operation. | 83 | + neon_load_reg64(rm, a->vm + 1); |
127 | + */ | 84 | + narrowfn(rd1, cpu_env, rm); |
128 | + if (interleave == 1 && endian == MO_LE) { | 85 | + neon_store_reg(a->vd, 0, rd0); |
129 | + size = 3; | 86 | + neon_store_reg(a->vd, 1, rd1); |
130 | + } | 87 | + tcg_temp_free_i64(rm); |
131 | + tmp64 = tcg_temp_new_i64(); | ||
132 | + addr = tcg_temp_new_i32(); | ||
133 | + tmp = tcg_const_i32(1 << size); | ||
134 | + load_reg_var(s, addr, a->rn); | ||
135 | + for (reg = 0; reg < nregs; reg++) { | ||
136 | + for (n = 0; n < 8 >> size; n++) { | ||
137 | + int xs; | ||
138 | + for (xs = 0; xs < interleave; xs++) { | ||
139 | + int tt = a->vd + reg + spacing * xs; | ||
140 | + | ||
141 | + if (a->l) { | ||
142 | + gen_aa32_ld_i64(s, tmp64, addr, mmu_idx, endian | size); | ||
143 | + neon_store_element64(tt, n, size, tmp64); | ||
144 | + } else { | ||
145 | + neon_load_element64(tmp64, tt, n, size); | ||
146 | + gen_aa32_st_i64(s, tmp64, addr, mmu_idx, endian | size); | ||
147 | + } | ||
148 | + tcg_gen_add_i32(addr, addr, tmp); | ||
149 | + } | ||
150 | + } | ||
151 | + } | ||
152 | + tcg_temp_free_i32(addr); | ||
153 | + tcg_temp_free_i32(tmp); | ||
154 | + tcg_temp_free_i64(tmp64); | ||
155 | + | ||
156 | + gen_neon_ldst_base_update(s, a->rm, a->rn, nregs * interleave * 8); | ||
157 | + return true; | 88 | + return true; |
158 | +} | 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) | ||
159 | diff --git a/target/arm/translate.c b/target/arm/translate.c | 107 | diff --git a/target/arm/translate.c b/target/arm/translate.c |
160 | index XXXXXXX..XXXXXXX 100644 | 108 | index XXXXXXX..XXXXXXX 100644 |
161 | --- a/target/arm/translate.c | 109 | --- a/target/arm/translate.c |
162 | +++ b/target/arm/translate.c | 110 | +++ b/target/arm/translate.c |
163 | @@ -XXX,XX +XXX,XX @@ static void gen_neon_trn_u16(TCGv_i32 t0, TCGv_i32 t1) | 111 | @@ -XXX,XX +XXX,XX @@ static void gen_neon_trn_u16(TCGv_i32 t0, TCGv_i32 t1) |
112 | tcg_temp_free_i32(rd); | ||
164 | } | 113 | } |
165 | 114 | ||
166 | 115 | -static inline void gen_neon_narrow(int size, TCGv_i32 dest, TCGv_i64 src) | |
167 | -static struct { | 116 | -{ |
168 | - int nregs; | 117 | - switch (size) { |
169 | - int interleave; | 118 | - case 0: gen_helper_neon_narrow_u8(dest, src); break; |
170 | - int spacing; | 119 | - case 1: gen_helper_neon_narrow_u16(dest, src); break; |
171 | -} const neon_ls_element_type[11] = { | 120 | - case 2: tcg_gen_extrl_i64_i32(dest, src); break; |
172 | - {1, 4, 1}, | 121 | - default: abort(); |
173 | - {1, 4, 2}, | 122 | - } |
174 | - {4, 1, 1}, | 123 | -} |
175 | - {2, 2, 2}, | 124 | - |
176 | - {1, 3, 1}, | 125 | -static inline void gen_neon_narrow_sats(int size, TCGv_i32 dest, TCGv_i64 src) |
177 | - {1, 3, 2}, | 126 | -{ |
178 | - {3, 1, 1}, | 127 | - switch (size) { |
179 | - {1, 1, 1}, | 128 | - case 0: gen_helper_neon_narrow_sat_s8(dest, cpu_env, src); break; |
180 | - {1, 2, 1}, | 129 | - case 1: gen_helper_neon_narrow_sat_s16(dest, cpu_env, src); break; |
181 | - {1, 2, 2}, | 130 | - case 2: gen_helper_neon_narrow_sat_s32(dest, cpu_env, src); break; |
182 | - {2, 1, 1} | 131 | - default: abort(); |
183 | -}; | 132 | - } |
184 | - | 133 | -} |
185 | /* Translate a NEON load/store element instruction. Return nonzero if the | 134 | - |
186 | instruction is invalid. */ | 135 | -static inline void gen_neon_narrow_satu(int size, TCGv_i32 dest, TCGv_i64 src) |
187 | static int disas_neon_ls_insn(DisasContext *s, uint32_t insn) | 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) | ||
188 | { | 156 | { |
189 | int rd, rn, rm; | 157 | if (u) { |
190 | - int op; | 158 | @@ -XXX,XX +XXX,XX @@ static inline void gen_neon_widen(TCGv_i64 dest, TCGv_i32 src, int size, int u) |
191 | int nregs; | 159 | tcg_temp_free_i32(src); |
192 | - int interleave; | 160 | } |
193 | - int spacing; | 161 | |
194 | int stride; | 162 | -static void gen_neon_narrow_op(int op, int u, int size, |
195 | int size; | 163 | - TCGv_i32 dest, TCGv_i64 src) |
196 | int reg; | 164 | -{ |
197 | int load; | 165 | - if (op) { |
198 | - int n; | 166 | - if (u) { |
199 | int vec_size; | 167 | - gen_neon_unarrow_sats(size, dest, src); |
200 | - int mmu_idx; | 168 | - } else { |
201 | - MemOp endian; | 169 | - gen_neon_narrow(size, dest, src); |
202 | TCGv_i32 addr; | ||
203 | TCGv_i32 tmp; | ||
204 | - TCGv_i32 tmp2; | ||
205 | - TCGv_i64 tmp64; | ||
206 | |||
207 | if (!arm_dc_feature(s, ARM_FEATURE_NEON)) { | ||
208 | return 1; | ||
209 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_ls_insn(DisasContext *s, uint32_t insn) | ||
210 | rn = (insn >> 16) & 0xf; | ||
211 | rm = insn & 0xf; | ||
212 | load = (insn & (1 << 21)) != 0; | ||
213 | - endian = s->be_data; | ||
214 | - mmu_idx = get_mem_index(s); | ||
215 | if ((insn & (1 << 23)) == 0) { | ||
216 | - /* Load store all elements. */ | ||
217 | - op = (insn >> 8) & 0xf; | ||
218 | - size = (insn >> 6) & 3; | ||
219 | - if (op > 10) | ||
220 | - return 1; | ||
221 | - /* Catch UNDEF cases for bad values of align field */ | ||
222 | - switch (op & 0xc) { | ||
223 | - case 4: | ||
224 | - if (((insn >> 5) & 1) == 1) { | ||
225 | - return 1; | ||
226 | - } | ||
227 | - break; | ||
228 | - case 8: | ||
229 | - if (((insn >> 4) & 3) == 3) { | ||
230 | - return 1; | ||
231 | - } | ||
232 | - break; | ||
233 | - default: | ||
234 | - break; | ||
235 | - } | 170 | - } |
236 | - nregs = neon_ls_element_type[op].nregs; | 171 | - } else { |
237 | - interleave = neon_ls_element_type[op].interleave; | 172 | - if (u) { |
238 | - spacing = neon_ls_element_type[op].spacing; | 173 | - gen_neon_narrow_satu(size, dest, src); |
239 | - if (size == 3 && (interleave | spacing) != 1) { | 174 | - } else { |
240 | - return 1; | 175 | - gen_neon_narrow_sats(size, dest, src); |
241 | - } | 176 | - } |
242 | - /* For our purposes, bytes are always little-endian. */ | 177 | - } |
243 | - if (size == 0) { | 178 | -} |
244 | - endian = MO_LE; | 179 | - |
245 | - } | 180 | /* Symbolic constants for op fields for Neon 2-register miscellaneous. |
246 | - /* Consecutive little-endian elements from a single register | 181 | * The values correspond to bits [17:16,10:7]; see the ARM ARM DDI0406B |
247 | - * can be promoted to a larger little-endian operation. | 182 | * table A7-13. |
248 | - */ | 183 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) |
249 | - if (interleave == 1 && endian == MO_LE) { | 184 | !arm_dc_feature(s, ARM_FEATURE_V8)) { |
250 | - size = 3; | 185 | return 1; |
251 | - } | 186 | } |
252 | - tmp64 = tcg_temp_new_i64(); | 187 | - if ((op != NEON_2RM_VMOVN && op != NEON_2RM_VQMOVN) && |
253 | - addr = tcg_temp_new_i32(); | 188 | - q && ((rm | rd) & 1)) { |
254 | - tmp2 = tcg_const_i32(1 << size); | 189 | + if (q && ((rm | rd) & 1)) { |
255 | - load_reg_var(s, addr, rn); | 190 | return 1; |
256 | - for (reg = 0; reg < nregs; reg++) { | 191 | } |
257 | - for (n = 0; n < 8 >> size; n++) { | 192 | switch (op) { |
258 | - int xs; | 193 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) |
259 | - for (xs = 0; xs < interleave; xs++) { | 194 | case NEON_2RM_VPADAL: case NEON_2RM_VPADAL_U: |
260 | - int tt = rd + reg + spacing * xs; | 195 | case NEON_2RM_VUZP: |
261 | - | 196 | case NEON_2RM_VZIP: |
262 | - if (load) { | 197 | + case NEON_2RM_VMOVN: case NEON_2RM_VQMOVN: |
263 | - gen_aa32_ld_i64(s, tmp64, addr, mmu_idx, endian | size); | 198 | /* handled by decodetree */ |
264 | - neon_store_element64(tt, n, size, tmp64); | 199 | return 1; |
265 | - } else { | 200 | case NEON_2RM_VTRN: |
266 | - neon_load_element64(tmp64, tt, n, size); | 201 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) |
267 | - gen_aa32_st_i64(s, tmp64, addr, mmu_idx, endian | size); | 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; | ||
268 | - } | 209 | - } |
269 | - tcg_gen_add_i32(addr, addr, tmp2); | 210 | - tmp2 = NULL; |
270 | - } | 211 | - for (pass = 0; pass < 2; pass++) { |
271 | - } | 212 | - neon_load_reg64(cpu_V0, rm + pass); |
272 | - } | 213 | - tmp = tcg_temp_new_i32(); |
273 | - tcg_temp_free_i32(addr); | 214 | - gen_neon_narrow_op(op == NEON_2RM_VMOVN, q, size, |
274 | - tcg_temp_free_i32(tmp2); | 215 | - tmp, cpu_V0); |
275 | - tcg_temp_free_i64(tmp64); | 216 | - if (pass == 0) { |
276 | - stride = nregs * interleave * 8; | 217 | - tmp2 = tmp; |
277 | + /* Load store all elements -- handled already by decodetree */ | 218 | - } else { |
278 | + return 1; | 219 | - neon_store_reg(rd, 0, tmp2); |
279 | } else { | 220 | - neon_store_reg(rd, 1, tmp); |
280 | size = (insn >> 10) & 3; | 221 | - } |
281 | if (size == 3) { | 222 | - } |
223 | - break; | ||
224 | case NEON_2RM_VSHLL: | ||
225 | if (q || (rd & 1)) { | ||
226 | return 1; | ||
282 | -- | 227 | -- |
283 | 2.20.1 | 228 | 2.20.1 |
284 | 229 | ||
285 | 230 | diff view generated by jsdifflib |
1 | Convert the VFM[AS]L (vector) insns to decodetree. This is the last | 1 | Convert the VSHLL insn in the 2-reg-misc Neon group to decodetree. |
---|---|---|---|
2 | insn in the legacy decoder for the 3same_ext group, so we can | ||
3 | delete the legacy decoder function for the group entirely. | ||
4 | |||
5 | Note that in disas_thumb2_insn() the parts of this encoding space | ||
6 | where the decodetree decoder returns false will correctly be directed | ||
7 | to illegal_op by the "(insn & (1 << 28))" check so they won't fall | ||
8 | into disas_coproc_insn() by mistake. | ||
9 | 2 | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 3 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
11 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 4 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
12 | Message-id: 20200430181003.21682-8-peter.maydell@linaro.org | 5 | Message-id: 20200616170844.13318-6-peter.maydell@linaro.org |
13 | --- | 6 | --- |
14 | target/arm/neon-shared.decode | 6 +++ | 7 | target/arm/neon-dp.decode | 2 ++ |
15 | target/arm/translate-neon.inc.c | 31 +++++++++++ | 8 | target/arm/translate-neon.inc.c | 52 +++++++++++++++++++++++++++++++++ |
16 | target/arm/translate.c | 92 +-------------------------------- | 9 | target/arm/translate.c | 35 +--------------------- |
17 | 3 files changed, 38 insertions(+), 91 deletions(-) | 10 | 3 files changed, 55 insertions(+), 34 deletions(-) |
18 | 11 | ||
19 | diff --git a/target/arm/neon-shared.decode b/target/arm/neon-shared.decode | 12 | diff --git a/target/arm/neon-dp.decode b/target/arm/neon-dp.decode |
20 | index XXXXXXX..XXXXXXX 100644 | 13 | index XXXXXXX..XXXXXXX 100644 |
21 | --- a/target/arm/neon-shared.decode | 14 | --- a/target/arm/neon-dp.decode |
22 | +++ b/target/arm/neon-shared.decode | 15 | +++ b/target/arm/neon-dp.decode |
23 | @@ -XXX,XX +XXX,XX @@ VCADD 1111 110 rot:1 1 . 0 size:1 .... .... 1000 . q:1 . 0 .... \ | 16 | @@ -XXX,XX +XXX,XX @@ Vimm_1r 1111 001 . 1 . 000 ... .... cmode:4 0 . op:1 1 .... @1reg_imm |
24 | # VUDOT and VSDOT | 17 | # VQMOVN: signed result, source may be signed (_S) or unsigned (_U) |
25 | VDOT 1111 110 00 . 10 .... .... 1101 . q:1 . u:1 .... \ | 18 | VQMOVN_S 1111 001 11 . 11 .. 10 .... 0 0101 0 . 0 .... @2misc_q0 |
26 | vm=%vm_dp vn=%vn_dp vd=%vd_dp | 19 | VQMOVN_U 1111 001 11 . 11 .. 10 .... 0 0101 1 . 0 .... @2misc_q0 |
27 | + | 20 | + |
28 | +# VFM[AS]L | 21 | + VSHLL 1111 001 11 . 11 .. 10 .... 0 0110 0 . 0 .... @2misc_q0 |
29 | +VFML 1111 110 0 s:1 . 10 .... .... 1000 . 0 . 1 .... \ | 22 | ] |
30 | + vm=%vm_sp vn=%vn_sp vd=%vd_dp q=0 | 23 | |
31 | +VFML 1111 110 0 s:1 . 10 .... .... 1000 . 1 . 1 .... \ | 24 | # Subgroup for size != 0b11 |
32 | + vm=%vm_dp vn=%vn_dp vd=%vd_dp q=1 | ||
33 | diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c | 25 | diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c |
34 | index XXXXXXX..XXXXXXX 100644 | 26 | index XXXXXXX..XXXXXXX 100644 |
35 | --- a/target/arm/translate-neon.inc.c | 27 | --- a/target/arm/translate-neon.inc.c |
36 | +++ b/target/arm/translate-neon.inc.c | 28 | +++ b/target/arm/translate-neon.inc.c |
37 | @@ -XXX,XX +XXX,XX @@ static bool trans_VDOT(DisasContext *s, arg_VDOT *a) | 29 | @@ -XXX,XX +XXX,XX @@ DO_VMOVN(VMOVN, gen_neon_narrow_u) |
38 | opr_sz, opr_sz, 0, fn_gvec); | 30 | DO_VMOVN(VQMOVUN, gen_helper_neon_unarrow_sat) |
39 | return true; | 31 | DO_VMOVN(VQMOVN_S, gen_helper_neon_narrow_sat_s) |
40 | } | 32 | DO_VMOVN(VQMOVN_U, gen_helper_neon_narrow_sat_u) |
41 | + | 33 | + |
42 | +static bool trans_VFML(DisasContext *s, arg_VFML *a) | 34 | +static bool trans_VSHLL(DisasContext *s, arg_2misc *a) |
43 | +{ | 35 | +{ |
44 | + int opr_sz; | 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 | + | 45 | + |
46 | + if (!dc_isar_feature(aa32_fhm, s)) { | 46 | + if (!arm_dc_feature(s, ARM_FEATURE_NEON)) { |
47 | + return false; | 47 | + return false; |
48 | + } | 48 | + } |
49 | + | 49 | + |
50 | + /* UNDEF accesses to D16-D31 if they don't exist. */ | 50 | + /* UNDEF accesses to D16-D31 if they don't exist. */ |
51 | + if (!dc_isar_feature(aa32_simd_r32, s) && | 51 | + if (!dc_isar_feature(aa32_simd_r32, s) && |
52 | + (a->vd & 0x10)) { | 52 | + ((a->vd | a->vm) & 0x10)) { |
53 | + return false; | 53 | + return false; |
54 | + } | 54 | + } |
55 | + | 55 | + |
56 | + if (a->vd & a->q) { | 56 | + if (a->vd & 1) { |
57 | + return false; | ||
58 | + } | ||
59 | + | ||
60 | + if (!widenfn) { | ||
57 | + return false; | 61 | + return false; |
58 | + } | 62 | + } |
59 | + | 63 | + |
60 | + if (!vfp_access_check(s)) { | 64 | + if (!vfp_access_check(s)) { |
61 | + return true; | 65 | + return true; |
62 | + } | 66 | + } |
63 | + | 67 | + |
64 | + opr_sz = (1 + a->q) * 8; | 68 | + rd = tcg_temp_new_i64(); |
65 | + tcg_gen_gvec_3_ptr(vfp_reg_offset(1, a->vd), | 69 | + |
66 | + vfp_reg_offset(a->q, a->vn), | 70 | + rm0 = neon_load_reg(a->vm, 0); |
67 | + vfp_reg_offset(a->q, a->vm), | 71 | + rm1 = neon_load_reg(a->vm, 1); |
68 | + cpu_env, opr_sz, opr_sz, a->s, /* is_2 == 0 */ | 72 | + |
69 | + gen_helper_gvec_fmlal_a32); | 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); | ||
70 | + return true; | 83 | + return true; |
71 | +} | 84 | +} |
72 | diff --git a/target/arm/translate.c b/target/arm/translate.c | 85 | diff --git a/target/arm/translate.c b/target/arm/translate.c |
73 | index XXXXXXX..XXXXXXX 100644 | 86 | index XXXXXXX..XXXXXXX 100644 |
74 | --- a/target/arm/translate.c | 87 | --- a/target/arm/translate.c |
75 | +++ b/target/arm/translate.c | 88 | +++ b/target/arm/translate.c |
76 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) | 89 | @@ -XXX,XX +XXX,XX @@ static void gen_neon_trn_u16(TCGv_i32 t0, TCGv_i32 t1) |
77 | return 0; | 90 | tcg_temp_free_i32(rd); |
78 | } | 91 | } |
79 | 92 | ||
80 | -/* Advanced SIMD three registers of the same length extension. | 93 | -static inline void gen_neon_widen(TCGv_i64 dest, TCGv_i32 src, int size, int u) |
81 | - * 31 25 23 22 20 16 12 11 10 9 8 3 0 | ||
82 | - * +---------------+-----+---+-----+----+----+---+----+---+----+---------+----+ | ||
83 | - * | 1 1 1 1 1 1 0 | op1 | D | op2 | Vn | Vd | 1 | o3 | 0 | o4 | N Q M U | Vm | | ||
84 | - * +---------------+-----+---+-----+----+----+---+----+---+----+---------+----+ | ||
85 | - */ | ||
86 | -static int disas_neon_insn_3same_ext(DisasContext *s, uint32_t insn) | ||
87 | -{ | 94 | -{ |
88 | - gen_helper_gvec_3 *fn_gvec = NULL; | 95 | - if (u) { |
89 | - gen_helper_gvec_3_ptr *fn_gvec_ptr = NULL; | 96 | - switch (size) { |
90 | - int rd, rn, rm, opr_sz; | 97 | - case 0: gen_helper_neon_widen_u8(dest, src); break; |
91 | - int data = 0; | 98 | - case 1: gen_helper_neon_widen_u16(dest, src); break; |
92 | - int off_rn, off_rm; | 99 | - case 2: tcg_gen_extu_i32_i64(dest, src); break; |
93 | - bool is_long = false, q = extract32(insn, 6, 1); | 100 | - default: abort(); |
94 | - bool ptr_is_env = false; | ||
95 | - | ||
96 | - if ((insn & 0xff300f10) == 0xfc200810) { | ||
97 | - /* VFM[AS]L -- 1111 1100 S.10 .... .... 1000 .Q.1 .... */ | ||
98 | - int is_s = extract32(insn, 23, 1); | ||
99 | - if (!dc_isar_feature(aa32_fhm, s)) { | ||
100 | - return 1; | ||
101 | - } | ||
102 | - is_long = true; | ||
103 | - data = is_s; /* is_2 == 0 */ | ||
104 | - fn_gvec_ptr = gen_helper_gvec_fmlal_a32; | ||
105 | - ptr_is_env = true; | ||
106 | - } else { | ||
107 | - return 1; | ||
108 | - } | ||
109 | - | ||
110 | - VFP_DREG_D(rd, insn); | ||
111 | - if (rd & q) { | ||
112 | - return 1; | ||
113 | - } | ||
114 | - if (q || !is_long) { | ||
115 | - VFP_DREG_N(rn, insn); | ||
116 | - VFP_DREG_M(rm, insn); | ||
117 | - if ((rn | rm) & q & !is_long) { | ||
118 | - return 1; | ||
119 | - } | ||
120 | - off_rn = vfp_reg_offset(1, rn); | ||
121 | - off_rm = vfp_reg_offset(1, rm); | ||
122 | - } else { | ||
123 | - rn = VFP_SREG_N(insn); | ||
124 | - rm = VFP_SREG_M(insn); | ||
125 | - off_rn = vfp_reg_offset(0, rn); | ||
126 | - off_rm = vfp_reg_offset(0, rm); | ||
127 | - } | ||
128 | - | ||
129 | - if (s->fp_excp_el) { | ||
130 | - gen_exception_insn(s, s->pc_curr, EXCP_UDEF, | ||
131 | - syn_simd_access_trap(1, 0xe, false), s->fp_excp_el); | ||
132 | - return 0; | ||
133 | - } | ||
134 | - if (!s->vfp_enabled) { | ||
135 | - return 1; | ||
136 | - } | ||
137 | - | ||
138 | - opr_sz = (1 + q) * 8; | ||
139 | - if (fn_gvec_ptr) { | ||
140 | - TCGv_ptr ptr; | ||
141 | - if (ptr_is_env) { | ||
142 | - ptr = cpu_env; | ||
143 | - } else { | ||
144 | - ptr = get_fpstatus_ptr(1); | ||
145 | - } | ||
146 | - tcg_gen_gvec_3_ptr(vfp_reg_offset(1, rd), off_rn, off_rm, ptr, | ||
147 | - opr_sz, opr_sz, data, fn_gvec_ptr); | ||
148 | - if (!ptr_is_env) { | ||
149 | - tcg_temp_free_ptr(ptr); | ||
150 | - } | 101 | - } |
151 | - } else { | 102 | - } else { |
152 | - tcg_gen_gvec_3_ool(vfp_reg_offset(1, rd), off_rn, off_rm, | 103 | - switch (size) { |
153 | - opr_sz, opr_sz, data, fn_gvec); | 104 | - case 0: gen_helper_neon_widen_s8(dest, src); break; |
105 | - case 1: gen_helper_neon_widen_s16(dest, src); break; | ||
106 | - case 2: tcg_gen_ext_i32_i64(dest, src); break; | ||
107 | - default: abort(); | ||
108 | - } | ||
154 | - } | 109 | - } |
155 | - return 0; | 110 | - tcg_temp_free_i32(src); |
156 | -} | 111 | -} |
157 | - | 112 | - |
158 | /* Advanced SIMD two registers and a scalar extension. | 113 | /* Symbolic constants for op fields for Neon 2-register miscellaneous. |
159 | * 31 24 23 22 20 16 12 11 10 9 8 3 0 | 114 | * The values correspond to bits [17:16,10:7]; see the ARM ARM DDI0406B |
160 | * +-----------------+----+---+----+----+----+---+----+---+----+---------+----+ | 115 | * table A7-13. |
161 | @@ -XXX,XX +XXX,XX @@ static void disas_arm_insn(DisasContext *s, unsigned int insn) | 116 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) |
117 | case NEON_2RM_VUZP: | ||
118 | case NEON_2RM_VZIP: | ||
119 | case NEON_2RM_VMOVN: case NEON_2RM_VQMOVN: | ||
120 | + case NEON_2RM_VSHLL: | ||
121 | /* handled by decodetree */ | ||
122 | return 1; | ||
123 | case NEON_2RM_VTRN: | ||
124 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) | ||
125 | goto elementwise; | ||
162 | } | 126 | } |
163 | } | 127 | break; |
164 | } | 128 | - case NEON_2RM_VSHLL: |
165 | - } else if ((insn & 0x0e000a00) == 0x0c000800 | 129 | - if (q || (rd & 1)) { |
166 | - && arm_dc_feature(s, ARM_FEATURE_V8)) { | 130 | - return 1; |
167 | - if (disas_neon_insn_3same_ext(s, insn)) { | 131 | - } |
168 | - goto illegal_op; | 132 | - tmp = neon_load_reg(rm, 0); |
169 | - } | 133 | - tmp2 = neon_load_reg(rm, 1); |
170 | - return; | 134 | - for (pass = 0; pass < 2; pass++) { |
171 | } else if ((insn & 0x0f000a00) == 0x0e000800 | 135 | - if (pass == 1) |
172 | && arm_dc_feature(s, ARM_FEATURE_V8)) { | 136 | - tmp = tmp2; |
173 | if (disas_neon_insn_2reg_scalar_ext(s, insn)) { | 137 | - gen_neon_widen(cpu_V0, tmp, size, 1); |
174 | @@ -XXX,XX +XXX,XX @@ static void disas_thumb2_insn(DisasContext *s, uint32_t insn) | 138 | - tcg_gen_shli_i64(cpu_V0, cpu_V0, 8 << size); |
175 | } | 139 | - neon_store_reg64(cpu_V0, rd + pass); |
176 | break; | 140 | - } |
177 | } | 141 | - break; |
178 | - if ((insn & 0xfe000a00) == 0xfc000800 | 142 | case NEON_2RM_VCVT_F16_F32: |
179 | + if ((insn & 0xff000a00) == 0xfe000800 | 143 | { |
180 | && arm_dc_feature(s, ARM_FEATURE_V8)) { | 144 | TCGv_ptr fpst; |
181 | /* The Thumb2 and ARM encodings are identical. */ | ||
182 | - if (disas_neon_insn_3same_ext(s, insn)) { | ||
183 | - goto illegal_op; | ||
184 | - } | ||
185 | - } else if ((insn & 0xff000a00) == 0xfe000800 | ||
186 | - && arm_dc_feature(s, ARM_FEATURE_V8)) { | ||
187 | - /* The Thumb2 and ARM encodings are identical. */ | ||
188 | if (disas_neon_insn_2reg_scalar_ext(s, insn)) { | ||
189 | goto illegal_op; | ||
190 | } | ||
191 | -- | 145 | -- |
192 | 2.20.1 | 146 | 2.20.1 |
193 | 147 | ||
194 | 148 | diff view generated by jsdifflib |
1 | Convert the V[US]DOT (vector) insns to decodetree. | 1 | Convert the Neon insns in the 2-reg-misc group which are |
---|---|---|---|
2 | VCVT between f32 and f16 to decodetree. | ||
2 | 3 | ||
3 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 4 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
4 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 5 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
5 | Message-id: 20200430181003.21682-7-peter.maydell@linaro.org | 6 | Message-id: 20200616170844.13318-7-peter.maydell@linaro.org |
6 | --- | 7 | --- |
7 | target/arm/neon-shared.decode | 4 ++++ | 8 | target/arm/neon-dp.decode | 3 ++ |
8 | target/arm/translate-neon.inc.c | 32 ++++++++++++++++++++++++++++++++ | 9 | target/arm/translate-neon.inc.c | 96 +++++++++++++++++++++++++++++++++ |
9 | target/arm/translate.c | 9 +-------- | 10 | target/arm/translate.c | 65 ++-------------------- |
10 | 3 files changed, 37 insertions(+), 8 deletions(-) | 11 | 3 files changed, 102 insertions(+), 62 deletions(-) |
11 | 12 | ||
12 | diff --git a/target/arm/neon-shared.decode b/target/arm/neon-shared.decode | 13 | diff --git a/target/arm/neon-dp.decode b/target/arm/neon-dp.decode |
13 | index XXXXXXX..XXXXXXX 100644 | 14 | index XXXXXXX..XXXXXXX 100644 |
14 | --- a/target/arm/neon-shared.decode | 15 | --- a/target/arm/neon-dp.decode |
15 | +++ b/target/arm/neon-shared.decode | 16 | +++ b/target/arm/neon-dp.decode |
16 | @@ -XXX,XX +XXX,XX @@ VCMLA 1111 110 rot:2 . 1 size:1 .... .... 1000 . q:1 . 0 .... \ | 17 | @@ -XXX,XX +XXX,XX @@ Vimm_1r 1111 001 . 1 . 000 ... .... cmode:4 0 . op:1 1 .... @1reg_imm |
17 | 18 | VQMOVN_U 1111 001 11 . 11 .. 10 .... 0 0101 1 . 0 .... @2misc_q0 | |
18 | VCADD 1111 110 rot:1 1 . 0 size:1 .... .... 1000 . q:1 . 0 .... \ | 19 | |
19 | vm=%vm_dp vn=%vn_dp vd=%vd_dp | 20 | VSHLL 1111 001 11 . 11 .. 10 .... 0 0110 0 . 0 .... @2misc_q0 |
20 | + | 21 | + |
21 | +# VUDOT and VSDOT | 22 | + VCVT_F16_F32 1111 001 11 . 11 .. 10 .... 0 1100 0 . 0 .... @2misc_q0 |
22 | +VDOT 1111 110 00 . 10 .... .... 1101 . q:1 . u:1 .... \ | 23 | + VCVT_F32_F16 1111 001 11 . 11 .. 10 .... 0 1110 0 . 0 .... @2misc_q0 |
23 | + vm=%vm_dp vn=%vn_dp vd=%vd_dp | 24 | ] |
25 | |||
26 | # Subgroup for size != 0b11 | ||
24 | diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c | 27 | diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c |
25 | index XXXXXXX..XXXXXXX 100644 | 28 | index XXXXXXX..XXXXXXX 100644 |
26 | --- a/target/arm/translate-neon.inc.c | 29 | --- a/target/arm/translate-neon.inc.c |
27 | +++ b/target/arm/translate-neon.inc.c | 30 | +++ b/target/arm/translate-neon.inc.c |
28 | @@ -XXX,XX +XXX,XX @@ static bool trans_VCADD(DisasContext *s, arg_VCADD *a) | 31 | @@ -XXX,XX +XXX,XX @@ static bool trans_VSHLL(DisasContext *s, arg_2misc *a) |
29 | tcg_temp_free_ptr(fpst); | 32 | tcg_temp_free_i32(rm1); |
30 | return true; | 33 | return true; |
31 | } | 34 | } |
32 | + | 35 | + |
33 | +static bool trans_VDOT(DisasContext *s, arg_VDOT *a) | 36 | +static bool trans_VCVT_F16_F32(DisasContext *s, arg_2misc *a) |
34 | +{ | 37 | +{ |
35 | + int opr_sz; | 38 | + TCGv_ptr fpst; |
36 | + gen_helper_gvec_3 *fn_gvec; | 39 | + TCGv_i32 ahp, tmp, tmp2, tmp3; |
37 | + | 40 | + |
38 | + if (!dc_isar_feature(aa32_dp, s)) { | 41 | + if (!arm_dc_feature(s, ARM_FEATURE_NEON) || |
42 | + !dc_isar_feature(aa32_fp16_spconv, s)) { | ||
39 | + return false; | 43 | + return false; |
40 | + } | 44 | + } |
41 | + | 45 | + |
42 | + /* UNDEF accesses to D16-D31 if they don't exist. */ | 46 | + /* UNDEF accesses to D16-D31 if they don't exist. */ |
43 | + if (!dc_isar_feature(aa32_simd_r32, s) && | 47 | + if (!dc_isar_feature(aa32_simd_r32, s) && |
44 | + ((a->vd | a->vn | a->vm) & 0x10)) { | 48 | + ((a->vd | a->vm) & 0x10)) { |
45 | + return false; | 49 | + return false; |
46 | + } | 50 | + } |
47 | + | 51 | + |
48 | + if ((a->vn | a->vm | a->vd) & a->q) { | 52 | + if ((a->vm & 1) || (a->size != 1)) { |
49 | + return false; | 53 | + return false; |
50 | + } | 54 | + } |
51 | + | 55 | + |
52 | + if (!vfp_access_check(s)) { | 56 | + if (!vfp_access_check(s)) { |
53 | + return true; | 57 | + return true; |
54 | + } | 58 | + } |
55 | + | 59 | + |
56 | + opr_sz = (1 + a->q) * 8; | 60 | + fpst = get_fpstatus_ptr(true); |
57 | + fn_gvec = a->u ? gen_helper_gvec_udot_b : gen_helper_gvec_sdot_b; | 61 | + ahp = get_ahp_flag(); |
58 | + tcg_gen_gvec_3_ool(vfp_reg_offset(1, a->vd), | 62 | + tmp = neon_load_reg(a->vm, 0); |
59 | + vfp_reg_offset(1, a->vn), | 63 | + gen_helper_vfp_fcvt_f32_to_f16(tmp, tmp, fpst, ahp); |
60 | + vfp_reg_offset(1, a->vm), | 64 | + tmp2 = neon_load_reg(a->vm, 1); |
61 | + opr_sz, opr_sz, 0, fn_gvec); | 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 | + | ||
62 | + return true; | 129 | + return true; |
63 | +} | 130 | +} |
64 | diff --git a/target/arm/translate.c b/target/arm/translate.c | 131 | diff --git a/target/arm/translate.c b/target/arm/translate.c |
65 | index XXXXXXX..XXXXXXX 100644 | 132 | index XXXXXXX..XXXXXXX 100644 |
66 | --- a/target/arm/translate.c | 133 | --- a/target/arm/translate.c |
67 | +++ b/target/arm/translate.c | 134 | +++ b/target/arm/translate.c |
68 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_insn_3same_ext(DisasContext *s, uint32_t insn) | 135 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) |
69 | bool is_long = false, q = extract32(insn, 6, 1); | 136 | int pass; |
70 | bool ptr_is_env = false; | 137 | int u; |
71 | 138 | int vec_size; | |
72 | - if ((insn & 0xfeb00f00) == 0xfc200d00) { | 139 | - TCGv_i32 tmp, tmp2, tmp3; |
73 | - /* V[US]DOT -- 1111 1100 0.10 .... .... 1101 .Q.U .... */ | 140 | + TCGv_i32 tmp, tmp2; |
74 | - bool u = extract32(insn, 4, 1); | 141 | |
75 | - if (!dc_isar_feature(aa32_dp, s)) { | 142 | if (!arm_dc_feature(s, ARM_FEATURE_NEON)) { |
76 | - return 1; | 143 | return 1; |
77 | - } | 144 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) |
78 | - fn_gvec = u ? gen_helper_gvec_udot_b : gen_helper_gvec_sdot_b; | 145 | case NEON_2RM_VZIP: |
79 | - } else if ((insn & 0xff300f10) == 0xfc200810) { | 146 | case NEON_2RM_VMOVN: case NEON_2RM_VQMOVN: |
80 | + if ((insn & 0xff300f10) == 0xfc200810) { | 147 | case NEON_2RM_VSHLL: |
81 | /* VFM[AS]L -- 1111 1100 S.10 .... .... 1000 .Q.1 .... */ | 148 | + case NEON_2RM_VCVT_F16_F32: |
82 | int is_s = extract32(insn, 23, 1); | 149 | + case NEON_2RM_VCVT_F32_F16: |
83 | if (!dc_isar_feature(aa32_fhm, s)) { | 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; | ||
84 | -- | 221 | -- |
85 | 2.20.1 | 222 | 2.20.1 |
86 | 223 | ||
87 | 224 | diff view generated by jsdifflib |
1 | Convert the Neon 3-reg-same VADD and VSUB insns to decodetree. | 1 | Convert to decodetree the insns in the Neon 2-reg-misc grouping which |
---|---|---|---|
2 | 2 | we implement using gvec. | |
3 | Note that we don't need the neon_3r_sizes[op] check here because all | ||
4 | size values are OK for VADD and VSUB; we'll add this when we convert | ||
5 | the first insn that has size restrictions. | ||
6 | |||
7 | For this we need one of the GVecGen*Fn typedefs currently in | ||
8 | translate-a64.h; move them all to translate.h as a block so they | ||
9 | are visible to the 32-bit decoder. | ||
10 | 3 | ||
11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 4 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
12 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 5 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
13 | Message-id: 20200430181003.21682-15-peter.maydell@linaro.org | 6 | Message-id: 20200616170844.13318-8-peter.maydell@linaro.org |
14 | --- | 7 | --- |
15 | target/arm/translate-a64.h | 9 -------- | 8 | target/arm/neon-dp.decode | 11 +++++++ |
16 | target/arm/translate.h | 9 ++++++++ | 9 | target/arm/translate-neon.inc.c | 55 +++++++++++++++++++++++++++++++++ |
17 | target/arm/neon-dp.decode | 17 +++++++++++++++ | 10 | target/arm/translate.c | 35 +++++---------------- |
18 | target/arm/translate-neon.inc.c | 38 +++++++++++++++++++++++++++++++++ | 11 | 3 files changed, 74 insertions(+), 27 deletions(-) |
19 | target/arm/translate.c | 14 ++++-------- | ||
20 | 5 files changed, 68 insertions(+), 19 deletions(-) | ||
21 | 12 | ||
22 | diff --git a/target/arm/translate-a64.h b/target/arm/translate-a64.h | ||
23 | index XXXXXXX..XXXXXXX 100644 | ||
24 | --- a/target/arm/translate-a64.h | ||
25 | +++ b/target/arm/translate-a64.h | ||
26 | @@ -XXX,XX +XXX,XX @@ static inline int vec_full_reg_size(DisasContext *s) | ||
27 | |||
28 | bool disas_sve(DisasContext *, uint32_t); | ||
29 | |||
30 | -/* Note that the gvec expanders operate on offsets + sizes. */ | ||
31 | -typedef void GVecGen2Fn(unsigned, uint32_t, uint32_t, uint32_t, uint32_t); | ||
32 | -typedef void GVecGen2iFn(unsigned, uint32_t, uint32_t, int64_t, | ||
33 | - uint32_t, uint32_t); | ||
34 | -typedef void GVecGen3Fn(unsigned, uint32_t, uint32_t, | ||
35 | - uint32_t, uint32_t, uint32_t); | ||
36 | -typedef void GVecGen4Fn(unsigned, uint32_t, uint32_t, uint32_t, | ||
37 | - uint32_t, uint32_t, uint32_t); | ||
38 | - | ||
39 | #endif /* TARGET_ARM_TRANSLATE_A64_H */ | ||
40 | diff --git a/target/arm/translate.h b/target/arm/translate.h | ||
41 | index XXXXXXX..XXXXXXX 100644 | ||
42 | --- a/target/arm/translate.h | ||
43 | +++ b/target/arm/translate.h | ||
44 | @@ -XXX,XX +XXX,XX @@ void gen_sshl_i64(TCGv_i64 d, TCGv_i64 a, TCGv_i64 b); | ||
45 | #define dc_isar_feature(name, ctx) \ | ||
46 | ({ DisasContext *ctx_ = (ctx); isar_feature_##name(ctx_->isar); }) | ||
47 | |||
48 | +/* Note that the gvec expanders operate on offsets + sizes. */ | ||
49 | +typedef void GVecGen2Fn(unsigned, uint32_t, uint32_t, uint32_t, uint32_t); | ||
50 | +typedef void GVecGen2iFn(unsigned, uint32_t, uint32_t, int64_t, | ||
51 | + uint32_t, uint32_t); | ||
52 | +typedef void GVecGen3Fn(unsigned, uint32_t, uint32_t, | ||
53 | + uint32_t, uint32_t, uint32_t); | ||
54 | +typedef void GVecGen4Fn(unsigned, uint32_t, uint32_t, uint32_t, | ||
55 | + uint32_t, uint32_t, uint32_t); | ||
56 | + | ||
57 | #endif /* TARGET_ARM_TRANSLATE_H */ | ||
58 | diff --git a/target/arm/neon-dp.decode b/target/arm/neon-dp.decode | 13 | diff --git a/target/arm/neon-dp.decode b/target/arm/neon-dp.decode |
59 | index XXXXXXX..XXXXXXX 100644 | 14 | index XXXXXXX..XXXXXXX 100644 |
60 | --- a/target/arm/neon-dp.decode | 15 | --- a/target/arm/neon-dp.decode |
61 | +++ b/target/arm/neon-dp.decode | 16 | +++ b/target/arm/neon-dp.decode |
62 | @@ -XXX,XX +XXX,XX @@ | 17 | @@ -XXX,XX +XXX,XX @@ Vimm_1r 1111 001 . 1 . 000 ... .... cmode:4 0 . op:1 1 .... @1reg_imm |
63 | # | 18 | VPADDL_S 1111 001 11 . 11 .. 00 .... 0 0100 . . 0 .... @2misc |
64 | # This file is processed by scripts/decodetree.py | 19 | VPADDL_U 1111 001 11 . 11 .. 00 .... 0 0101 . . 0 .... @2misc |
65 | # | 20 | |
66 | +# VFP/Neon register fields; same as vfp.decode | 21 | + VMVN 1111 001 11 . 11 .. 00 .... 0 1011 . . 0 .... @2misc |
67 | +%vm_dp 5:1 0:4 | ||
68 | +%vn_dp 7:1 16:4 | ||
69 | +%vd_dp 22:1 12:4 | ||
70 | |||
71 | # Encodings for Neon data processing instructions where the T32 encoding | ||
72 | # is a simple transformation of the A32 encoding. | ||
73 | @@ -XXX,XX +XXX,XX @@ | ||
74 | # 0b111p_1111_qqqq_qqqq_qqqq_qqqq_qqqq_qqqq | ||
75 | # This file works on the A32 encoding only; calling code for T32 has to | ||
76 | # transform the insn into the A32 version first. | ||
77 | + | 22 | + |
78 | +###################################################################### | 23 | VPADAL_S 1111 001 11 . 11 .. 00 .... 0 1100 . . 0 .... @2misc |
79 | +# 3-reg-same grouping: | 24 | VPADAL_U 1111 001 11 . 11 .. 00 .... 0 1101 . . 0 .... @2misc |
80 | +# 1111 001 U 0 D sz:2 Vn:4 Vd:4 opc:4 N Q M op Vm:4 | 25 | |
81 | +###################################################################### | 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 | ||
82 | + | 31 | + |
83 | +&3same vm vn vd q size | 32 | + VABS 1111 001 11 . 11 .. 01 .... 0 0110 . . 0 .... @2misc |
33 | + VNEG 1111 001 11 . 11 .. 01 .... 0 0111 . . 0 .... @2misc | ||
84 | + | 34 | + |
85 | +@3same .... ... . . . size:2 .... .... .... . q:1 . . .... \ | 35 | VUZP 1111 001 11 . 11 .. 10 .... 0 0010 . . 0 .... @2misc |
86 | + &3same vm=%vm_dp vn=%vn_dp vd=%vd_dp | 36 | VZIP 1111 001 11 . 11 .. 10 .... 0 0011 . . 0 .... @2misc |
87 | + | 37 | |
88 | +VADD_3s 1111 001 0 0 . .. .... .... 1000 . . . 0 .... @3same | ||
89 | +VSUB_3s 1111 001 1 0 . .. .... .... 1000 . . . 0 .... @3same | ||
90 | diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c | 38 | diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c |
91 | index XXXXXXX..XXXXXXX 100644 | 39 | index XXXXXXX..XXXXXXX 100644 |
92 | --- a/target/arm/translate-neon.inc.c | 40 | --- a/target/arm/translate-neon.inc.c |
93 | +++ b/target/arm/translate-neon.inc.c | 41 | +++ b/target/arm/translate-neon.inc.c |
94 | @@ -XXX,XX +XXX,XX @@ static bool trans_VLDST_single(DisasContext *s, arg_VLDST_single *a) | 42 | @@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_F32_F16(DisasContext *s, arg_2misc *a) |
95 | 43 | ||
96 | return true; | 44 | return true; |
97 | } | 45 | } |
98 | + | 46 | + |
99 | +static bool do_3same(DisasContext *s, arg_3same *a, GVecGen3Fn fn) | 47 | +static bool do_2misc_vec(DisasContext *s, arg_2misc *a, GVecGen2Fn *fn) |
100 | +{ | 48 | +{ |
101 | + int vec_size = a->q ? 16 : 8; | 49 | + int vec_size = a->q ? 16 : 8; |
102 | + int rd_ofs = neon_reg_offset(a->vd, 0); | 50 | + int rd_ofs = neon_reg_offset(a->vd, 0); |
103 | + int rn_ofs = neon_reg_offset(a->vn, 0); | ||
104 | + int rm_ofs = neon_reg_offset(a->vm, 0); | 51 | + int rm_ofs = neon_reg_offset(a->vm, 0); |
105 | + | 52 | + |
106 | + if (!arm_dc_feature(s, ARM_FEATURE_NEON)) { | 53 | + if (!arm_dc_feature(s, ARM_FEATURE_NEON)) { |
107 | + return false; | 54 | + return false; |
108 | + } | 55 | + } |
109 | + | 56 | + |
110 | + /* UNDEF accesses to D16-D31 if they don't exist. */ | 57 | + /* UNDEF accesses to D16-D31 if they don't exist. */ |
111 | + if (!dc_isar_feature(aa32_simd_r32, s) && | 58 | + if (!dc_isar_feature(aa32_simd_r32, s) && |
112 | + ((a->vd | a->vn | a->vm) & 0x10)) { | 59 | + ((a->vd | a->vm) & 0x10)) { |
113 | + return false; | 60 | + return false; |
114 | + } | 61 | + } |
115 | + | 62 | + |
116 | + if ((a->vn | a->vm | a->vd) & a->q) { | 63 | + if (a->size == 3) { |
64 | + return false; | ||
65 | + } | ||
66 | + | ||
67 | + if ((a->vd | a->vm) & a->q) { | ||
117 | + return false; | 68 | + return false; |
118 | + } | 69 | + } |
119 | + | 70 | + |
120 | + if (!vfp_access_check(s)) { | 71 | + if (!vfp_access_check(s)) { |
121 | + return true; | 72 | + return true; |
122 | + } | 73 | + } |
123 | + | 74 | + |
124 | + fn(a->size, rd_ofs, rn_ofs, rm_ofs, vec_size, vec_size); | 75 | + fn(a->size, rd_ofs, rm_ofs, vec_size, vec_size); |
76 | + | ||
125 | + return true; | 77 | + return true; |
126 | +} | 78 | +} |
127 | + | 79 | + |
128 | +#define DO_3SAME(INSN, FUNC) \ | 80 | +#define DO_2MISC_VEC(INSN, FN) \ |
129 | + static bool trans_##INSN##_3s(DisasContext *s, arg_3same *a) \ | 81 | + static bool trans_##INSN(DisasContext *s, arg_2misc *a) \ |
130 | + { \ | 82 | + { \ |
131 | + return do_3same(s, a, FUNC); \ | 83 | + return do_2misc_vec(s, a, FN); \ |
132 | + } | 84 | + } |
133 | + | 85 | + |
134 | +DO_3SAME(VADD, tcg_gen_gvec_add) | 86 | +DO_2MISC_VEC(VNEG, tcg_gen_gvec_neg) |
135 | +DO_3SAME(VSUB, tcg_gen_gvec_sub) | 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 | +} | ||
136 | diff --git a/target/arm/translate.c b/target/arm/translate.c | 101 | diff --git a/target/arm/translate.c b/target/arm/translate.c |
137 | index XXXXXXX..XXXXXXX 100644 | 102 | index XXXXXXX..XXXXXXX 100644 |
138 | --- a/target/arm/translate.c | 103 | --- a/target/arm/translate.c |
139 | +++ b/target/arm/translate.c | 104 | +++ b/target/arm/translate.c |
140 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) | 105 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) |
141 | } | 106 | int size; |
142 | return 0; | 107 | int pass; |
143 | 108 | int u; | |
144 | - case NEON_3R_VADD_VSUB: | 109 | - int vec_size; |
145 | - if (u) { | 110 | TCGv_i32 tmp, tmp2; |
146 | - tcg_gen_gvec_sub(size, rd_ofs, rn_ofs, rm_ofs, | 111 | |
147 | - vec_size, vec_size); | 112 | if (!arm_dc_feature(s, ARM_FEATURE_NEON)) { |
148 | - } else { | 113 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) |
149 | - tcg_gen_gvec_add(size, rd_ofs, rn_ofs, rm_ofs, | 114 | VFP_DREG_D(rd, insn); |
150 | - vec_size, vec_size); | 115 | VFP_DREG_M(rm, insn); |
151 | - } | 116 | size = (insn >> 20) & 3; |
152 | - return 0; | 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; | ||
153 | - | 149 | - |
154 | case NEON_3R_VQADD: | 150 | - case NEON_2RM_VCEQ0: |
155 | tcg_gen_gvec_4(rd_ofs, offsetof(CPUARMState, vfp.qc), | 151 | - gen_gvec_ceq0(size, rd_ofs, rm_ofs, vec_size, vec_size); |
156 | rn_ofs, rm_ofs, vec_size, vec_size, | 152 | - break; |
157 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) | 153 | - case NEON_2RM_VCGT0: |
158 | tcg_gen_gvec_3(rd_ofs, rm_ofs, rn_ofs, vec_size, vec_size, | 154 | - gen_gvec_cgt0(size, rd_ofs, rm_ofs, vec_size, vec_size); |
159 | u ? &ushl_op[size] : &sshl_op[size]); | 155 | - break; |
160 | return 0; | 156 | - case NEON_2RM_VCLE0: |
161 | + | 157 | - gen_gvec_cle0(size, rd_ofs, rm_ofs, vec_size, vec_size); |
162 | + case NEON_3R_VADD_VSUB: | 158 | - break; |
163 | + /* Already handled by decodetree */ | 159 | - case NEON_2RM_VCGE0: |
164 | + return 1; | 160 | - gen_gvec_cge0(size, rd_ofs, rm_ofs, vec_size, vec_size); |
165 | } | 161 | - break; |
166 | 162 | - case NEON_2RM_VCLT0: | |
167 | if (size == 3) { | 163 | - gen_gvec_clt0(size, rd_ofs, rm_ofs, vec_size, vec_size); |
164 | - break; | ||
165 | |||
166 | default: | ||
167 | elementwise: | ||
168 | -- | 168 | -- |
169 | 2.20.1 | 169 | 2.20.1 |
170 | 170 | ||
171 | 171 | diff view generated by jsdifflib |
1 | Convert the Neon VQADD/VQSUB insns in the 3-reg-same grouping | 1 | Convert the Neon-2-reg misc crypto ops (AESE, AESMC, SHA1H, SHA1SU1) |
---|---|---|---|
2 | to decodetree. | 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: Richard Henderson <richard.henderson@linaro.org> | 5 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
6 | Message-id: 20200430181003.21682-19-peter.maydell@linaro.org | 6 | Message-id: 20200616170844.13318-9-peter.maydell@linaro.org |
7 | --- | 7 | --- |
8 | target/arm/neon-dp.decode | 6 ++++++ | 8 | target/arm/neon-dp.decode | 12 ++++++++ |
9 | target/arm/translate-neon.inc.c | 15 +++++++++++++++ | 9 | target/arm/translate-neon.inc.c | 42 ++++++++++++++++++++++++++ |
10 | target/arm/translate.c | 14 ++------------ | 10 | target/arm/translate.c | 52 +++------------------------------ |
11 | 3 files changed, 23 insertions(+), 12 deletions(-) | 11 | 3 files changed, 58 insertions(+), 48 deletions(-) |
12 | 12 | ||
13 | diff --git a/target/arm/neon-dp.decode b/target/arm/neon-dp.decode | 13 | diff --git a/target/arm/neon-dp.decode b/target/arm/neon-dp.decode |
14 | index XXXXXXX..XXXXXXX 100644 | 14 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/target/arm/neon-dp.decode | 15 | --- a/target/arm/neon-dp.decode |
16 | +++ b/target/arm/neon-dp.decode | 16 | +++ b/target/arm/neon-dp.decode |
17 | @@ -XXX,XX +XXX,XX @@ | 17 | @@ -XXX,XX +XXX,XX @@ Vimm_1r 1111 001 . 1 . 000 ... .... cmode:4 0 . op:1 1 .... @1reg_imm |
18 | @3same .... ... . . . size:2 .... .... .... . q:1 . . .... \ | 18 | &2misc vm=%vm_dp vd=%vd_dp |
19 | &3same vm=%vm_dp vn=%vn_dp vd=%vd_dp | 19 | @2misc_q0 .... ... .. . .. size:2 .. .... . .... . . . .... \ |
20 | 20 | &2misc vm=%vm_dp vd=%vd_dp q=0 | |
21 | +VQADD_S_3s 1111 001 0 0 . .. .... .... 0000 . . . 1 .... @3same | 21 | + @2misc_q1 .... ... .. . .. size:2 .. .... . .... . . . .... \ |
22 | +VQADD_U_3s 1111 001 1 0 . .. .... .... 0000 . . . 1 .... @3same | 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 | ||
23 | + | 33 | + |
24 | @3same_logic .... ... . . . .. .... .... .... . q:1 .. .... \ | 34 | VMVN 1111 001 11 . 11 .. 00 .... 0 1011 . . 0 .... @2misc |
25 | &3same vm=%vm_dp vn=%vn_dp vd=%vd_dp size=0 | 35 | |
26 | 36 | VPADAL_S 1111 001 11 . 11 .. 00 .... 0 1100 . . 0 .... @2misc | |
27 | @@ -XXX,XX +XXX,XX @@ VBSL_3s 1111 001 1 0 . 01 .... .... 0001 ... 1 .... @3same_logic | 37 | @@ -XXX,XX +XXX,XX @@ Vimm_1r 1111 001 . 1 . 000 ... .... cmode:4 0 . op:1 1 .... @1reg_imm |
28 | VBIT_3s 1111 001 1 0 . 10 .... .... 0001 ... 1 .... @3same_logic | 38 | VCLE0 1111 001 11 . 11 .. 01 .... 0 0011 . . 0 .... @2misc |
29 | VBIF_3s 1111 001 1 0 . 11 .... .... 0001 ... 1 .... @3same_logic | 39 | VCLT0 1111 001 11 . 11 .. 01 .... 0 0100 . . 0 .... @2misc |
30 | 40 | ||
31 | +VQSUB_S_3s 1111 001 0 0 . .. .... .... 0010 . . . 1 .... @3same | 41 | + SHA1H 1111 001 11 . 11 .. 01 .... 0 0101 1 . 0 .... @2misc_q1 |
32 | +VQSUB_U_3s 1111 001 1 0 . .. .... .... 0010 . . . 1 .... @3same | ||
33 | + | 42 | + |
34 | VCGT_S_3s 1111 001 0 0 . .. .... .... 0011 . . . 0 .... @3same | 43 | VABS 1111 001 11 . 11 .. 01 .... 0 0110 . . 0 .... @2misc |
35 | VCGT_U_3s 1111 001 1 0 . .. .... .... 0011 . . . 0 .... @3same | 44 | VNEG 1111 001 11 . 11 .. 01 .... 0 0111 . . 0 .... @2misc |
36 | VCGE_S_3s 1111 001 0 0 . .. .... .... 0011 . . . 1 .... @3same | 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 | ] | ||
37 | diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c | 56 | diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c |
38 | index XXXXXXX..XXXXXXX 100644 | 57 | index XXXXXXX..XXXXXXX 100644 |
39 | --- a/target/arm/translate-neon.inc.c | 58 | --- a/target/arm/translate-neon.inc.c |
40 | +++ b/target/arm/translate-neon.inc.c | 59 | +++ b/target/arm/translate-neon.inc.c |
41 | @@ -XXX,XX +XXX,XX @@ static void gen_VTST_3s(unsigned vece, uint32_t rd_ofs, uint32_t rn_ofs, | 60 | @@ -XXX,XX +XXX,XX @@ static bool trans_VMVN(DisasContext *s, arg_2misc *a) |
42 | tcg_gen_gvec_3(rd_ofs, rn_ofs, rm_ofs, oprsz, maxsz, &cmtst_op[vece]); | 61 | } |
62 | return do_2misc_vec(s, a, tcg_gen_gvec_not); | ||
43 | } | 63 | } |
44 | DO_3SAME_NO_SZ_3(VTST, gen_VTST_3s) | ||
45 | + | 64 | + |
46 | +#define DO_3SAME_GVEC4(INSN, OPARRAY) \ | 65 | +#define WRAP_2M_3_OOL_FN(WRAPNAME, FUNC, DATA) \ |
47 | + static void gen_##INSN##_3s(unsigned vece, uint32_t rd_ofs, \ | 66 | + static void WRAPNAME(unsigned vece, uint32_t rd_ofs, \ |
48 | + uint32_t rn_ofs, uint32_t rm_ofs, \ | 67 | + uint32_t rm_ofs, uint32_t oprsz, \ |
49 | + uint32_t oprsz, uint32_t maxsz) \ | 68 | + uint32_t maxsz) \ |
50 | + { \ | 69 | + { \ |
51 | + tcg_gen_gvec_4(rd_ofs, offsetof(CPUARMState, vfp.qc), \ | 70 | + tcg_gen_gvec_3_ool(rd_ofs, rd_ofs, rm_ofs, oprsz, maxsz, \ |
52 | + rn_ofs, rm_ofs, oprsz, maxsz, &OPARRAY[vece]); \ | 71 | + DATA, FUNC); \ |
53 | + } \ | 72 | + } |
54 | + DO_3SAME(INSN, gen_##INSN##_3s) | ||
55 | + | 73 | + |
56 | +DO_3SAME_GVEC4(VQADD_S, sqadd_op) | 74 | +#define WRAP_2M_2_OOL_FN(WRAPNAME, FUNC, DATA) \ |
57 | +DO_3SAME_GVEC4(VQADD_U, uqadd_op) | 75 | + static void WRAPNAME(unsigned vece, uint32_t rd_ofs, \ |
58 | +DO_3SAME_GVEC4(VQSUB_S, sqsub_op) | 76 | + uint32_t rm_ofs, uint32_t oprsz, \ |
59 | +DO_3SAME_GVEC4(VQSUB_U, uqsub_op) | 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) | ||
60 | diff --git a/target/arm/translate.c b/target/arm/translate.c | 106 | diff --git a/target/arm/translate.c b/target/arm/translate.c |
61 | index XXXXXXX..XXXXXXX 100644 | 107 | index XXXXXXX..XXXXXXX 100644 |
62 | --- a/target/arm/translate.c | 108 | --- a/target/arm/translate.c |
63 | +++ b/target/arm/translate.c | 109 | +++ b/target/arm/translate.c |
64 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) | 110 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) |
65 | } | 111 | { |
66 | return 1; | 112 | int op; |
67 | 113 | int q; | |
68 | - case NEON_3R_VQADD: | 114 | - int rd, rm, rd_ofs, rm_ofs; |
69 | - tcg_gen_gvec_4(rd_ofs, offsetof(CPUARMState, vfp.qc), | 115 | + int rd, rm; |
70 | - rn_ofs, rm_ofs, vec_size, vec_size, | 116 | int size; |
71 | - (u ? uqadd_op : sqadd_op) + size); | 117 | int pass; |
72 | - return 0; | 118 | int u; |
73 | - | ||
74 | - case NEON_3R_VQSUB: | ||
75 | - tcg_gen_gvec_4(rd_ofs, offsetof(CPUARMState, vfp.qc), | ||
76 | - rn_ofs, rm_ofs, vec_size, vec_size, | ||
77 | - (u ? uqsub_op : sqsub_op) + size); | ||
78 | - return 0; | ||
79 | - | ||
80 | case NEON_3R_VMUL: /* VMUL */ | ||
81 | if (u) { | ||
82 | /* Polynomial case allows only P8. */ | ||
83 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) | 119 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) |
84 | case NEON_3R_VTST_VCEQ: | 120 | VFP_DREG_D(rd, insn); |
85 | case NEON_3R_VCGT: | 121 | VFP_DREG_M(rm, insn); |
86 | case NEON_3R_VCGE: | 122 | size = (insn >> 20) & 3; |
87 | + case NEON_3R_VQADD: | 123 | - rd_ofs = neon_reg_offset(rd, 0); |
88 | + case NEON_3R_VQSUB: | 124 | - rm_ofs = neon_reg_offset(rm, 0); |
89 | /* Already handled by decodetree */ | 125 | |
90 | return 1; | 126 | if ((insn & (1 << 23)) == 0) { |
91 | } | 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: | ||
92 | -- | 190 | -- |
93 | 2.20.1 | 191 | 2.20.1 |
94 | 192 | ||
95 | 193 | diff view generated by jsdifflib |
1 | The access_type argument to get_phys_addr_lpae() is an MMUAccessType; | 1 | The NeonGenOneOpFn typedef breaks with the pattern of the other |
---|---|---|---|
2 | use the enum constant MMU_DATA_LOAD rather than a literal 0 when we | 2 | NeonGen*Fn typedefs, because it is a TCGv_i64 -> TCGv_i64 operation |
3 | call it in S1_ptw_translate(). | 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). | ||
4 | 6 | ||
5 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
6 | Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | ||
7 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 8 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
8 | Message-id: 20200330210400.11724-3-peter.maydell@linaro.org | 9 | Message-id: 20200616170844.13318-10-peter.maydell@linaro.org |
9 | --- | 10 | --- |
10 | target/arm/helper.c | 5 +++-- | 11 | target/arm/translate.h | 2 +- |
11 | 1 file changed, 3 insertions(+), 2 deletions(-) | 12 | target/arm/translate-a64.c | 4 ++-- |
13 | 2 files changed, 3 insertions(+), 3 deletions(-) | ||
12 | 14 | ||
13 | diff --git a/target/arm/helper.c b/target/arm/helper.c | 15 | diff --git a/target/arm/translate.h b/target/arm/translate.h |
14 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/target/arm/helper.c | 17 | --- a/target/arm/translate.h |
16 | +++ b/target/arm/helper.c | 18 | +++ b/target/arm/translate.h |
17 | @@ -XXX,XX +XXX,XX @@ static hwaddr S1_ptw_translate(CPUARMState *env, ARMMMUIdx mmu_idx, | 19 | @@ -XXX,XX +XXX,XX @@ typedef void NeonGenWidenFn(TCGv_i64, TCGv_i32); |
18 | pcacheattrs = &cacheattrs; | 20 | typedef void NeonGenTwoOpWidenFn(TCGv_i64, TCGv_i32, TCGv_i32); |
19 | } | 21 | typedef void NeonGenTwoSingleOPFn(TCGv_i32, TCGv_i32, TCGv_i32, TCGv_ptr); |
20 | 22 | typedef void NeonGenTwoDoubleOPFn(TCGv_i64, TCGv_i64, TCGv_i64, TCGv_ptr); | |
21 | - ret = get_phys_addr_lpae(env, addr, 0, ARMMMUIdx_Stage2, &s2pa, | 23 | -typedef void NeonGenOneOpFn(TCGv_i64, TCGv_i64); |
22 | - &txattrs, &s2prot, &s2size, fi, pcacheattrs); | 24 | +typedef void NeonGenOne64OpFn(TCGv_i64, TCGv_i64); |
23 | + ret = get_phys_addr_lpae(env, addr, MMU_DATA_LOAD, ARMMMUIdx_Stage2, | 25 | typedef void CryptoTwoOpFn(TCGv_ptr, TCGv_ptr); |
24 | + &s2pa, &txattrs, &s2prot, &s2size, fi, | 26 | typedef void CryptoThreeOpIntFn(TCGv_ptr, TCGv_ptr, TCGv_i32); |
25 | + pcacheattrs); | 27 | typedef void CryptoThreeOpFn(TCGv_ptr, TCGv_ptr, TCGv_ptr); |
26 | if (ret) { | 28 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c |
27 | assert(fi->type != ARMFault_None); | 29 | index XXXXXXX..XXXXXXX 100644 |
28 | fi->s2addr = addr; | 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 | }; | ||
29 | -- | 43 | -- |
30 | 2.20.1 | 44 | 2.20.1 |
31 | 45 | ||
32 | 46 | diff view generated by jsdifflib |
1 | We're going to want at least some of the NeonGen* typedefs | 1 | All the other typedefs like these spell "Op" with a lowercase 'p'; |
---|---|---|---|
2 | for the refactored 32-bit Neon decoder, so move them all | 2 | remane the NeonGenTwoSingleOPFn and NeonGenTwoDoubleOPFn typedefs to |
3 | to translate.h since it makes more sense to keep them in | 3 | match. |
4 | one group. | ||
5 | 4 | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 5 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
7 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 6 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
8 | Message-id: 20200430181003.21682-23-peter.maydell@linaro.org | 7 | Message-id: 20200616170844.13318-11-peter.maydell@linaro.org |
9 | --- | 8 | --- |
10 | target/arm/translate.h | 17 +++++++++++++++++ | 9 | target/arm/translate.h | 4 ++-- |
11 | target/arm/translate-a64.c | 17 ----------------- | 10 | target/arm/translate-a64.c | 4 ++-- |
12 | 2 files changed, 17 insertions(+), 17 deletions(-) | 11 | target/arm/translate-neon.inc.c | 2 +- |
12 | 3 files changed, 5 insertions(+), 5 deletions(-) | ||
13 | 13 | ||
14 | diff --git a/target/arm/translate.h b/target/arm/translate.h | 14 | diff --git a/target/arm/translate.h b/target/arm/translate.h |
15 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/target/arm/translate.h | 16 | --- a/target/arm/translate.h |
17 | +++ b/target/arm/translate.h | 17 | +++ b/target/arm/translate.h |
18 | @@ -XXX,XX +XXX,XX @@ typedef void GVecGen3Fn(unsigned, uint32_t, uint32_t, | 18 | @@ -XXX,XX +XXX,XX @@ typedef void NeonGenNarrowFn(TCGv_i32, TCGv_i64); |
19 | typedef void GVecGen4Fn(unsigned, uint32_t, uint32_t, uint32_t, | 19 | typedef void NeonGenNarrowEnvFn(TCGv_i32, TCGv_ptr, TCGv_i64); |
20 | uint32_t, uint32_t, uint32_t); | 20 | typedef void NeonGenWidenFn(TCGv_i64, TCGv_i32); |
21 | 21 | typedef void NeonGenTwoOpWidenFn(TCGv_i64, TCGv_i32, TCGv_i32); | |
22 | +/* Function prototype for gen_ functions for calling Neon helpers */ | 22 | -typedef void NeonGenTwoSingleOPFn(TCGv_i32, TCGv_i32, TCGv_i32, TCGv_ptr); |
23 | +typedef void NeonGenOneOpEnvFn(TCGv_i32, TCGv_ptr, TCGv_i32); | 23 | -typedef void NeonGenTwoDoubleOPFn(TCGv_i64, TCGv_i64, TCGv_i64, TCGv_ptr); |
24 | +typedef void NeonGenTwoOpFn(TCGv_i32, TCGv_i32, TCGv_i32); | 24 | +typedef void NeonGenTwoSingleOpFn(TCGv_i32, TCGv_i32, TCGv_i32, TCGv_ptr); |
25 | +typedef void NeonGenTwoOpEnvFn(TCGv_i32, TCGv_ptr, TCGv_i32, TCGv_i32); | 25 | +typedef void NeonGenTwoDoubleOpFn(TCGv_i64, TCGv_i64, TCGv_i64, TCGv_ptr); |
26 | +typedef void NeonGenTwo64OpFn(TCGv_i64, TCGv_i64, TCGv_i64); | 26 | typedef void NeonGenOne64OpFn(TCGv_i64, TCGv_i64); |
27 | +typedef void NeonGenTwo64OpEnvFn(TCGv_i64, TCGv_ptr, TCGv_i64, TCGv_i64); | 27 | typedef void CryptoTwoOpFn(TCGv_ptr, TCGv_ptr); |
28 | +typedef void NeonGenNarrowFn(TCGv_i32, TCGv_i64); | 28 | typedef void CryptoThreeOpIntFn(TCGv_ptr, TCGv_ptr, TCGv_i32); |
29 | +typedef void NeonGenNarrowEnvFn(TCGv_i32, TCGv_ptr, TCGv_i64); | ||
30 | +typedef void NeonGenWidenFn(TCGv_i64, TCGv_i32); | ||
31 | +typedef void NeonGenTwoSingleOPFn(TCGv_i32, TCGv_i32, TCGv_i32, TCGv_ptr); | ||
32 | +typedef void NeonGenTwoDoubleOPFn(TCGv_i64, TCGv_i64, TCGv_i64, TCGv_ptr); | ||
33 | +typedef void NeonGenOneOpFn(TCGv_i64, TCGv_i64); | ||
34 | +typedef void CryptoTwoOpFn(TCGv_ptr, TCGv_ptr); | ||
35 | +typedef void CryptoThreeOpIntFn(TCGv_ptr, TCGv_ptr, TCGv_i32); | ||
36 | +typedef void CryptoThreeOpFn(TCGv_ptr, TCGv_ptr, TCGv_ptr); | ||
37 | +typedef void AtomicThreeOpFn(TCGv_i64, TCGv_i64, TCGv_i64, TCGArg, MemOp); | ||
38 | + | ||
39 | #endif /* TARGET_ARM_TRANSLATE_H */ | ||
40 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c | 29 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c |
41 | index XXXXXXX..XXXXXXX 100644 | 30 | index XXXXXXX..XXXXXXX 100644 |
42 | --- a/target/arm/translate-a64.c | 31 | --- a/target/arm/translate-a64.c |
43 | +++ b/target/arm/translate-a64.c | 32 | +++ b/target/arm/translate-a64.c |
44 | @@ -XXX,XX +XXX,XX @@ typedef struct AArch64DecodeTable { | 33 | @@ -XXX,XX +XXX,XX @@ static void handle_2misc_fcmp_zero(DisasContext *s, int opcode, |
45 | AArch64DecodeFn *disas_fn; | 34 | TCGv_i64 tcg_op = tcg_temp_new_i64(); |
46 | } AArch64DecodeTable; | 35 | TCGv_i64 tcg_zero = tcg_const_i64(0); |
47 | 36 | TCGv_i64 tcg_res = tcg_temp_new_i64(); | |
48 | -/* Function prototype for gen_ functions for calling Neon helpers */ | 37 | - NeonGenTwoDoubleOPFn *genfn; |
49 | -typedef void NeonGenOneOpEnvFn(TCGv_i32, TCGv_ptr, TCGv_i32); | 38 | + NeonGenTwoDoubleOpFn *genfn; |
50 | -typedef void NeonGenTwoOpFn(TCGv_i32, TCGv_i32, TCGv_i32); | 39 | bool swap = false; |
51 | -typedef void NeonGenTwoOpEnvFn(TCGv_i32, TCGv_ptr, TCGv_i32, TCGv_i32); | 40 | int pass; |
52 | -typedef void NeonGenTwo64OpFn(TCGv_i64, TCGv_i64, TCGv_i64); | 41 | |
53 | -typedef void NeonGenTwo64OpEnvFn(TCGv_i64, TCGv_ptr, TCGv_i64, TCGv_i64); | 42 | @@ -XXX,XX +XXX,XX @@ static void handle_2misc_fcmp_zero(DisasContext *s, int opcode, |
54 | -typedef void NeonGenNarrowFn(TCGv_i32, TCGv_i64); | 43 | TCGv_i32 tcg_op = tcg_temp_new_i32(); |
55 | -typedef void NeonGenNarrowEnvFn(TCGv_i32, TCGv_ptr, TCGv_i64); | 44 | TCGv_i32 tcg_zero = tcg_const_i32(0); |
56 | -typedef void NeonGenWidenFn(TCGv_i64, TCGv_i32); | 45 | TCGv_i32 tcg_res = tcg_temp_new_i32(); |
57 | -typedef void NeonGenTwoSingleOPFn(TCGv_i32, TCGv_i32, TCGv_i32, TCGv_ptr); | 46 | - NeonGenTwoSingleOPFn *genfn; |
58 | -typedef void NeonGenTwoDoubleOPFn(TCGv_i64, TCGv_i64, TCGv_i64, TCGv_ptr); | 47 | + NeonGenTwoSingleOpFn *genfn; |
59 | -typedef void NeonGenOneOpFn(TCGv_i64, TCGv_i64); | 48 | bool swap = false; |
60 | -typedef void CryptoTwoOpFn(TCGv_ptr, TCGv_ptr); | 49 | int pass, maxpasses; |
61 | -typedef void CryptoThreeOpIntFn(TCGv_ptr, TCGv_ptr, TCGv_i32); | 50 | |
62 | -typedef void CryptoThreeOpFn(TCGv_ptr, TCGv_ptr, TCGv_ptr); | 51 | diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c |
63 | -typedef void AtomicThreeOpFn(TCGv_i64, TCGv_i64, TCGv_i64, TCGArg, MemOp); | 52 | index XXXXXXX..XXXXXXX 100644 |
64 | - | 53 | --- a/target/arm/translate-neon.inc.c |
65 | /* initialize TCG globals. */ | 54 | +++ b/target/arm/translate-neon.inc.c |
66 | void a64_translate_init(void) | 55 | @@ -XXX,XX +XXX,XX @@ static bool trans_VSHLL_U_2sh(DisasContext *s, arg_2reg_shift *a) |
56 | } | ||
57 | |||
58 | static bool do_fp_2sh(DisasContext *s, arg_2reg_shift *a, | ||
59 | - NeonGenTwoSingleOPFn *fn) | ||
60 | + NeonGenTwoSingleOpFn *fn) | ||
67 | { | 61 | { |
62 | /* FP operations in 2-reg-and-shift group */ | ||
63 | TCGv_i32 tmp, shiftv; | ||
68 | -- | 64 | -- |
69 | 2.20.1 | 65 | 2.20.1 |
70 | 66 | ||
71 | 67 | diff view generated by jsdifflib |
1 | Add the infrastructure for building and invoking a decodetree decoder | 1 | Make gen_swap_half() take a source and destination TCGv_i32 rather |
---|---|---|---|
2 | for the AArch32 Neon encodings. At the moment the new decoder covers | 2 | than modifying the input TCGv_i32; we're going to want to be able to |
3 | nothing, so we always fall back to the existing hand-written decode. | 3 | use it with the more flexible function signature, and this also |
4 | 4 | brings it into line with other functions like gen_rev16() and | |
5 | We follow the same pattern we did for the VFP decodetree conversion | 5 | gen_revsh(). |
6 | (commit 78e138bc1f672c145ef6ace74617d and following): code that deals | ||
7 | with Neon will be moving gradually out to translate-neon.vfp.inc, | ||
8 | which we #include into translate.c. | ||
9 | |||
10 | In order to share the decode files between A32 and T32, we | ||
11 | split Neon into 3 parts: | ||
12 | * data-processing | ||
13 | * load-store | ||
14 | * 'shared' encodings | ||
15 | |||
16 | The first two groups of instructions have similar but not identical | ||
17 | A32 and T32 encodings, so we need to manually transform the T32 | ||
18 | encoding into the A32 one before calling the decoder; the third group | ||
19 | covers the Neon instructions which are identical in A32 and T32. | ||
20 | 6 | ||
21 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
22 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 8 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
23 | Message-id: 20200430181003.21682-4-peter.maydell@linaro.org | 9 | Message-id: 20200616170844.13318-12-peter.maydell@linaro.org |
24 | --- | 10 | --- |
25 | target/arm/neon-dp.decode | 29 ++++++++++++++++++++++++++ | 11 | target/arm/translate-neon.inc.c | 2 +- |
26 | target/arm/neon-ls.decode | 29 ++++++++++++++++++++++++++ | 12 | target/arm/translate.c | 10 +++++----- |
27 | target/arm/neon-shared.decode | 27 +++++++++++++++++++++++++ | 13 | 2 files changed, 6 insertions(+), 6 deletions(-) |
28 | target/arm/translate-neon.inc.c | 32 +++++++++++++++++++++++++++++ | ||
29 | target/arm/translate.c | 36 +++++++++++++++++++++++++++++++-- | ||
30 | target/arm/Makefile.objs | 18 +++++++++++++++++ | ||
31 | 6 files changed, 169 insertions(+), 2 deletions(-) | ||
32 | create mode 100644 target/arm/neon-dp.decode | ||
33 | create mode 100644 target/arm/neon-ls.decode | ||
34 | create mode 100644 target/arm/neon-shared.decode | ||
35 | create mode 100644 target/arm/translate-neon.inc.c | ||
36 | 14 | ||
37 | diff --git a/target/arm/neon-dp.decode b/target/arm/neon-dp.decode | ||
38 | new file mode 100644 | ||
39 | index XXXXXXX..XXXXXXX | ||
40 | --- /dev/null | ||
41 | +++ b/target/arm/neon-dp.decode | ||
42 | @@ -XXX,XX +XXX,XX @@ | ||
43 | +# AArch32 Neon data-processing instruction descriptions | ||
44 | +# | ||
45 | +# Copyright (c) 2020 Linaro, Ltd | ||
46 | +# | ||
47 | +# This library is free software; you can redistribute it and/or | ||
48 | +# modify it under the terms of the GNU Lesser General Public | ||
49 | +# License as published by the Free Software Foundation; either | ||
50 | +# version 2 of the License, or (at your option) any later version. | ||
51 | +# | ||
52 | +# This library is distributed in the hope that it will be useful, | ||
53 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
54 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
55 | +# Lesser General Public License for more details. | ||
56 | +# | ||
57 | +# You should have received a copy of the GNU Lesser General Public | ||
58 | +# License along with this library; if not, see <http://www.gnu.org/licenses/>. | ||
59 | + | ||
60 | +# | ||
61 | +# This file is processed by scripts/decodetree.py | ||
62 | +# | ||
63 | + | ||
64 | +# Encodings for Neon data processing instructions where the T32 encoding | ||
65 | +# is a simple transformation of the A32 encoding. | ||
66 | +# More specifically, this file covers instructions where the A32 encoding is | ||
67 | +# 0b1111_001p_qqqq_qqqq_qqqq_qqqq_qqqq_qqqq | ||
68 | +# and the T32 encoding is | ||
69 | +# 0b111p_1111_qqqq_qqqq_qqqq_qqqq_qqqq_qqqq | ||
70 | +# This file works on the A32 encoding only; calling code for T32 has to | ||
71 | +# transform the insn into the A32 version first. | ||
72 | diff --git a/target/arm/neon-ls.decode b/target/arm/neon-ls.decode | ||
73 | new file mode 100644 | ||
74 | index XXXXXXX..XXXXXXX | ||
75 | --- /dev/null | ||
76 | +++ b/target/arm/neon-ls.decode | ||
77 | @@ -XXX,XX +XXX,XX @@ | ||
78 | +# AArch32 Neon load/store instruction descriptions | ||
79 | +# | ||
80 | +# Copyright (c) 2020 Linaro, Ltd | ||
81 | +# | ||
82 | +# This library is free software; you can redistribute it and/or | ||
83 | +# modify it under the terms of the GNU Lesser General Public | ||
84 | +# License as published by the Free Software Foundation; either | ||
85 | +# version 2 of the License, or (at your option) any later version. | ||
86 | +# | ||
87 | +# This library is distributed in the hope that it will be useful, | ||
88 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
89 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
90 | +# Lesser General Public License for more details. | ||
91 | +# | ||
92 | +# You should have received a copy of the GNU Lesser General Public | ||
93 | +# License along with this library; if not, see <http://www.gnu.org/licenses/>. | ||
94 | + | ||
95 | +# | ||
96 | +# This file is processed by scripts/decodetree.py | ||
97 | +# | ||
98 | + | ||
99 | +# Encodings for Neon load/store instructions where the T32 encoding | ||
100 | +# is a simple transformation of the A32 encoding. | ||
101 | +# More specifically, this file covers instructions where the A32 encoding is | ||
102 | +# 0b1111_0100_xxx0_xxxx_xxxx_xxxx_xxxx_xxxx | ||
103 | +# and the T32 encoding is | ||
104 | +# 0b1111_1001_xxx0_xxxx_xxxx_xxxx_xxxx_xxxx | ||
105 | +# This file works on the A32 encoding only; calling code for T32 has to | ||
106 | +# transform the insn into the A32 version first. | ||
107 | diff --git a/target/arm/neon-shared.decode b/target/arm/neon-shared.decode | ||
108 | new file mode 100644 | ||
109 | index XXXXXXX..XXXXXXX | ||
110 | --- /dev/null | ||
111 | +++ b/target/arm/neon-shared.decode | ||
112 | @@ -XXX,XX +XXX,XX @@ | ||
113 | +# AArch32 Neon instruction descriptions | ||
114 | +# | ||
115 | +# Copyright (c) 2020 Linaro, Ltd | ||
116 | +# | ||
117 | +# This library is free software; you can redistribute it and/or | ||
118 | +# modify it under the terms of the GNU Lesser General Public | ||
119 | +# License as published by the Free Software Foundation; either | ||
120 | +# version 2 of the License, or (at your option) any later version. | ||
121 | +# | ||
122 | +# This library is distributed in the hope that it will be useful, | ||
123 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
124 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
125 | +# Lesser General Public License for more details. | ||
126 | +# | ||
127 | +# You should have received a copy of the GNU Lesser General Public | ||
128 | +# License along with this library; if not, see <http://www.gnu.org/licenses/>. | ||
129 | + | ||
130 | +# | ||
131 | +# This file is processed by scripts/decodetree.py | ||
132 | +# | ||
133 | + | ||
134 | +# Encodings for Neon instructions whose encoding is the same for | ||
135 | +# both A32 and T32. | ||
136 | + | ||
137 | +# More specifically, this covers: | ||
138 | +# 2reg scalar ext: 0b1111_1110_xxxx_xxxx_xxxx_1x0x_xxxx_xxxx | ||
139 | +# 3same ext: 0b1111_110x_xxxx_xxxx_xxxx_1x0x_xxxx_xxxx | ||
140 | diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c | 15 | diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c |
141 | new file mode 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
142 | index XXXXXXX..XXXXXXX | 17 | --- a/target/arm/translate-neon.inc.c |
143 | --- /dev/null | ||
144 | +++ b/target/arm/translate-neon.inc.c | 18 | +++ b/target/arm/translate-neon.inc.c |
145 | @@ -XXX,XX +XXX,XX @@ | 19 | @@ -XXX,XX +XXX,XX @@ static bool trans_VREV64(DisasContext *s, arg_VREV64 *a) |
146 | +/* | 20 | tcg_gen_bswap32_i32(tmp[half], tmp[half]); |
147 | + * ARM translation: AArch32 Neon instructions | 21 | break; |
148 | + * | 22 | case 1: |
149 | + * Copyright (c) 2003 Fabrice Bellard | 23 | - gen_swap_half(tmp[half]); |
150 | + * Copyright (c) 2005-2007 CodeSourcery | 24 | + gen_swap_half(tmp[half], tmp[half]); |
151 | + * Copyright (c) 2007 OpenedHand, Ltd. | 25 | break; |
152 | + * Copyright (c) 2020 Linaro, Ltd. | 26 | case 2: |
153 | + * | 27 | break; |
154 | + * This library is free software; you can redistribute it and/or | ||
155 | + * modify it under the terms of the GNU Lesser General Public | ||
156 | + * License as published by the Free Software Foundation; either | ||
157 | + * version 2 of the License, or (at your option) any later version. | ||
158 | + * | ||
159 | + * This library is distributed in the hope that it will be useful, | ||
160 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
161 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
162 | + * Lesser General Public License for more details. | ||
163 | + * | ||
164 | + * You should have received a copy of the GNU Lesser General Public | ||
165 | + * License along with this library; if not, see <http://www.gnu.org/licenses/>. | ||
166 | + */ | ||
167 | + | ||
168 | +/* | ||
169 | + * This file is intended to be included from translate.c; it uses | ||
170 | + * some macros and definitions provided by that file. | ||
171 | + * It might be possible to convert it to a standalone .c file eventually. | ||
172 | + */ | ||
173 | + | ||
174 | +/* Include the generated Neon decoder */ | ||
175 | +#include "decode-neon-dp.inc.c" | ||
176 | +#include "decode-neon-ls.inc.c" | ||
177 | +#include "decode-neon-shared.inc.c" | ||
178 | diff --git a/target/arm/translate.c b/target/arm/translate.c | 28 | diff --git a/target/arm/translate.c b/target/arm/translate.c |
179 | index XXXXXXX..XXXXXXX 100644 | 29 | index XXXXXXX..XXXXXXX 100644 |
180 | --- a/target/arm/translate.c | 30 | --- a/target/arm/translate.c |
181 | +++ b/target/arm/translate.c | 31 | +++ b/target/arm/translate.c |
182 | @@ -XXX,XX +XXX,XX @@ static TCGv_ptr vfp_reg_ptr(bool dp, int reg) | 32 | @@ -XXX,XX +XXX,XX @@ static void gen_revsh(TCGv_i32 dest, TCGv_i32 var) |
183 | 33 | } | |
184 | #define ARM_CP_RW_BIT (1 << 20) | 34 | |
185 | 35 | /* Swap low and high halfwords. */ | |
186 | -/* Include the VFP decoder */ | 36 | -static void gen_swap_half(TCGv_i32 var) |
187 | +/* Include the VFP and Neon decoders */ | 37 | +static void gen_swap_half(TCGv_i32 dest, TCGv_i32 var) |
188 | #include "translate-vfp.inc.c" | ||
189 | +#include "translate-neon.inc.c" | ||
190 | |||
191 | static inline void iwmmxt_load_reg(TCGv_i64 var, int reg) | ||
192 | { | 38 | { |
193 | @@ -XXX,XX +XXX,XX @@ static void disas_arm_insn(DisasContext *s, unsigned int insn) | 39 | - tcg_gen_rotri_i32(var, var, 16); |
194 | /* Unconditional instructions. */ | 40 | + tcg_gen_rotri_i32(dest, var, 16); |
195 | /* TODO: Perhaps merge these into one decodetree output file. */ | 41 | } |
196 | if (disas_a32_uncond(s, insn) || | 42 | |
197 | - disas_vfp_uncond(s, insn)) { | 43 | /* Dual 16-bit add. Result placed in t0 and t1 is marked as dead. |
198 | + disas_vfp_uncond(s, insn) || | 44 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) |
199 | + disas_neon_dp(s, insn) || | 45 | case NEON_2RM_VREV32: |
200 | + disas_neon_ls(s, insn) || | 46 | switch (size) { |
201 | + disas_neon_shared(s, insn)) { | 47 | case 0: tcg_gen_bswap32_i32(tmp, tmp); break; |
202 | return; | 48 | - case 1: gen_swap_half(tmp); break; |
203 | } | 49 | + case 1: gen_swap_half(tmp, tmp); break; |
204 | /* fall back to legacy decoder */ | 50 | default: abort(); |
205 | @@ -XXX,XX +XXX,XX @@ static void disas_thumb2_insn(DisasContext *s, uint32_t insn) | 51 | } |
206 | ARCH(6T2); | 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); | ||
207 | } | 59 | } |
208 | 60 | gen_smul_dual(t1, t2); | |
209 | + if ((insn & 0xef000000) == 0xef000000) { | 61 | |
210 | + /* | 62 | @@ -XXX,XX +XXX,XX @@ static bool op_smlald(DisasContext *s, arg_rrrr *a, bool m_swap, bool sub) |
211 | + * T32 encodings 0b111p_1111_qqqq_qqqq_qqqq_qqqq_qqqq_qqqq | 63 | t1 = load_reg(s, a->rn); |
212 | + * transform into | 64 | t2 = load_reg(s, a->rm); |
213 | + * A32 encodings 0b1111_001p_qqqq_qqqq_qqqq_qqqq_qqqq_qqqq | 65 | if (m_swap) { |
214 | + */ | 66 | - gen_swap_half(t2); |
215 | + uint32_t a32_insn = (insn & 0xe2ffffff) | | 67 | + gen_swap_half(t2, t2); |
216 | + ((insn & (1 << 28)) >> 4) | (1 << 28); | ||
217 | + | ||
218 | + if (disas_neon_dp(s, a32_insn)) { | ||
219 | + return; | ||
220 | + } | ||
221 | + } | ||
222 | + | ||
223 | + if ((insn & 0xff100000) == 0xf9000000) { | ||
224 | + /* | ||
225 | + * T32 encodings 0b1111_1001_ppp0_qqqq_qqqq_qqqq_qqqq_qqqq | ||
226 | + * transform into | ||
227 | + * A32 encodings 0b1111_0100_ppp0_qqqq_qqqq_qqqq_qqqq_qqqq | ||
228 | + */ | ||
229 | + uint32_t a32_insn = (insn & 0x00ffffff) | 0xf4000000; | ||
230 | + | ||
231 | + if (disas_neon_ls(s, a32_insn)) { | ||
232 | + return; | ||
233 | + } | ||
234 | + } | ||
235 | + | ||
236 | /* | ||
237 | * TODO: Perhaps merge these into one decodetree output file. | ||
238 | * Note disas_vfp is written for a32 with cond field in the | ||
239 | @@ -XXX,XX +XXX,XX @@ static void disas_thumb2_insn(DisasContext *s, uint32_t insn) | ||
240 | */ | ||
241 | if (disas_t32(s, insn) || | ||
242 | disas_vfp_uncond(s, insn) || | ||
243 | + disas_neon_shared(s, insn) || | ||
244 | ((insn >> 28) == 0xe && disas_vfp(s, insn))) { | ||
245 | return; | ||
246 | } | 68 | } |
247 | diff --git a/target/arm/Makefile.objs b/target/arm/Makefile.objs | 69 | gen_smul_dual(t1, t2); |
248 | index XXXXXXX..XXXXXXX 100644 | 70 | |
249 | --- a/target/arm/Makefile.objs | ||
250 | +++ b/target/arm/Makefile.objs | ||
251 | @@ -XXX,XX +XXX,XX @@ target/arm/decode-sve.inc.c: $(SRC_PATH)/target/arm/sve.decode $(DECODETREE) | ||
252 | $(PYTHON) $(DECODETREE) --decode disas_sve -o $@ $<,\ | ||
253 | "GEN", $(TARGET_DIR)$@) | ||
254 | |||
255 | +target/arm/decode-neon-shared.inc.c: $(SRC_PATH)/target/arm/neon-shared.decode $(DECODETREE) | ||
256 | + $(call quiet-command,\ | ||
257 | + $(PYTHON) $(DECODETREE) --static-decode disas_neon_shared -o $@ $<,\ | ||
258 | + "GEN", $(TARGET_DIR)$@) | ||
259 | + | ||
260 | +target/arm/decode-neon-dp.inc.c: $(SRC_PATH)/target/arm/neon-dp.decode $(DECODETREE) | ||
261 | + $(call quiet-command,\ | ||
262 | + $(PYTHON) $(DECODETREE) --static-decode disas_neon_dp -o $@ $<,\ | ||
263 | + "GEN", $(TARGET_DIR)$@) | ||
264 | + | ||
265 | +target/arm/decode-neon-ls.inc.c: $(SRC_PATH)/target/arm/neon-ls.decode $(DECODETREE) | ||
266 | + $(call quiet-command,\ | ||
267 | + $(PYTHON) $(DECODETREE) --static-decode disas_neon_ls -o $@ $<,\ | ||
268 | + "GEN", $(TARGET_DIR)$@) | ||
269 | + | ||
270 | target/arm/decode-vfp.inc.c: $(SRC_PATH)/target/arm/vfp.decode $(DECODETREE) | ||
271 | $(call quiet-command,\ | ||
272 | $(PYTHON) $(DECODETREE) --static-decode disas_vfp -o $@ $<,\ | ||
273 | @@ -XXX,XX +XXX,XX @@ target/arm/decode-t16.inc.c: $(SRC_PATH)/target/arm/t16.decode $(DECODETREE) | ||
274 | "GEN", $(TARGET_DIR)$@) | ||
275 | |||
276 | target/arm/translate-sve.o: target/arm/decode-sve.inc.c | ||
277 | +target/arm/translate.o: target/arm/decode-neon-shared.inc.c | ||
278 | +target/arm/translate.o: target/arm/decode-neon-dp.inc.c | ||
279 | +target/arm/translate.o: target/arm/decode-neon-ls.inc.c | ||
280 | target/arm/translate.o: target/arm/decode-vfp.inc.c | ||
281 | target/arm/translate.o: target/arm/decode-vfp-uncond.inc.c | ||
282 | target/arm/translate.o: target/arm/decode-a32.inc.c | ||
283 | -- | 71 | -- |
284 | 2.20.1 | 72 | 2.20.1 |
285 | 73 | ||
286 | 74 | diff view generated by jsdifflib |
1 | Convert the V[US]DOT (scalar) insns in the 2reg-scalar-ext group | 1 | Convert the VREV32 and VREV16 insns in the Neon 2-reg-misc group |
---|---|---|---|
2 | to decodetree. | 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: Richard Henderson <richard.henderson@linaro.org> | 5 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
6 | Message-id: 20200430181003.21682-10-peter.maydell@linaro.org | 6 | Message-id: 20200616170844.13318-13-peter.maydell@linaro.org |
7 | --- | 7 | --- |
8 | target/arm/neon-shared.decode | 3 +++ | 8 | target/arm/translate.h | 1 + |
9 | target/arm/translate-neon.inc.c | 35 +++++++++++++++++++++++++++++++++ | 9 | target/arm/neon-dp.decode | 2 ++ |
10 | target/arm/translate.c | 13 +----------- | 10 | target/arm/translate-neon.inc.c | 55 +++++++++++++++++++++++++++++++++ |
11 | 3 files changed, 39 insertions(+), 12 deletions(-) | 11 | target/arm/translate.c | 12 ++----- |
12 | 4 files changed, 60 insertions(+), 10 deletions(-) | ||
12 | 13 | ||
13 | diff --git a/target/arm/neon-shared.decode b/target/arm/neon-shared.decode | 14 | diff --git a/target/arm/translate.h b/target/arm/translate.h |
14 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/target/arm/neon-shared.decode | 16 | --- a/target/arm/translate.h |
16 | +++ b/target/arm/neon-shared.decode | 17 | +++ b/target/arm/translate.h |
17 | @@ -XXX,XX +XXX,XX @@ VCMLA_scalar 1111 1110 0 . rot:2 .... .... 1000 . q:1 index:1 0 vm:4 \ | 18 | @@ -XXX,XX +XXX,XX @@ typedef void GVecGen4Fn(unsigned, uint32_t, uint32_t, uint32_t, |
18 | vn=%vn_dp vd=%vd_dp size=0 | 19 | uint32_t, uint32_t, uint32_t); |
19 | VCMLA_scalar 1111 1110 1 . rot:2 .... .... 1000 . q:1 . 0 .... \ | 20 | |
20 | vm=%vm_dp vn=%vn_dp vd=%vd_dp size=1 index=0 | 21 | /* Function prototype for gen_ functions for calling Neon helpers */ |
21 | + | 22 | +typedef void NeonGenOneOpFn(TCGv_i32, TCGv_i32); |
22 | +VDOT_scalar 1111 1110 0 . 10 .... .... 1101 . q:1 index:1 u:1 rm:4 \ | 23 | typedef void NeonGenOneOpEnvFn(TCGv_i32, TCGv_ptr, TCGv_i32); |
23 | + vm=%vm_dp vn=%vn_dp vd=%vd_dp | 24 | typedef void NeonGenTwoOpFn(TCGv_i32, TCGv_i32, TCGv_i32); |
25 | typedef void NeonGenTwoOpEnvFn(TCGv_i32, TCGv_ptr, TCGv_i32, TCGv_i32); | ||
26 | diff --git a/target/arm/neon-dp.decode b/target/arm/neon-dp.decode | ||
27 | index XXXXXXX..XXXXXXX 100644 | ||
28 | --- a/target/arm/neon-dp.decode | ||
29 | +++ b/target/arm/neon-dp.decode | ||
30 | @@ -XXX,XX +XXX,XX @@ Vimm_1r 1111 001 . 1 . 000 ... .... cmode:4 0 . op:1 1 .... @1reg_imm | ||
31 | &2misc vm=%vm_dp vd=%vd_dp q=1 | ||
32 | |||
33 | VREV64 1111 001 11 . 11 .. 00 .... 0 0000 . . 0 .... @2misc | ||
34 | + VREV32 1111 001 11 . 11 .. 00 .... 0 0001 . . 0 .... @2misc | ||
35 | + VREV16 1111 001 11 . 11 .. 00 .... 0 0010 . . 0 .... @2misc | ||
36 | |||
37 | VPADDL_S 1111 001 11 . 11 .. 00 .... 0 0100 . . 0 .... @2misc | ||
38 | VPADDL_U 1111 001 11 . 11 .. 00 .... 0 0101 . . 0 .... @2misc | ||
24 | diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c | 39 | diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c |
25 | index XXXXXXX..XXXXXXX 100644 | 40 | index XXXXXXX..XXXXXXX 100644 |
26 | --- a/target/arm/translate-neon.inc.c | 41 | --- a/target/arm/translate-neon.inc.c |
27 | +++ b/target/arm/translate-neon.inc.c | 42 | +++ b/target/arm/translate-neon.inc.c |
28 | @@ -XXX,XX +XXX,XX @@ static bool trans_VCMLA_scalar(DisasContext *s, arg_VCMLA_scalar *a) | 43 | @@ -XXX,XX +XXX,XX @@ DO_2M_CRYPTO(AESIMC, aa32_aes, 0) |
29 | tcg_temp_free_ptr(fpst); | 44 | DO_2M_CRYPTO(SHA1H, aa32_sha1, 2) |
30 | return true; | 45 | DO_2M_CRYPTO(SHA1SU1, aa32_sha1, 2) |
31 | } | 46 | DO_2M_CRYPTO(SHA256SU0, aa32_sha2, 2) |
32 | + | 47 | + |
33 | +static bool trans_VDOT_scalar(DisasContext *s, arg_VDOT_scalar *a) | 48 | +static bool do_2misc(DisasContext *s, arg_2misc *a, NeonGenOneOpFn *fn) |
34 | +{ | 49 | +{ |
35 | + gen_helper_gvec_3 *fn_gvec; | 50 | + int pass; |
36 | + int opr_sz; | ||
37 | + TCGv_ptr fpst; | ||
38 | + | 51 | + |
39 | + if (!dc_isar_feature(aa32_dp, s)) { | 52 | + /* Handle a 2-reg-misc operation by iterating 32 bits at a time */ |
53 | + if (!arm_dc_feature(s, ARM_FEATURE_NEON)) { | ||
40 | + return false; | 54 | + return false; |
41 | + } | 55 | + } |
42 | + | 56 | + |
43 | + /* UNDEF accesses to D16-D31 if they don't exist. */ | 57 | + /* UNDEF accesses to D16-D31 if they don't exist. */ |
44 | + if (!dc_isar_feature(aa32_simd_r32, s) && | 58 | + if (!dc_isar_feature(aa32_simd_r32, s) && |
45 | + ((a->vd | a->vn) & 0x10)) { | 59 | + ((a->vd | a->vm) & 0x10)) { |
46 | + return false; | 60 | + return false; |
47 | + } | 61 | + } |
48 | + | 62 | + |
49 | + if ((a->vd | a->vn) & a->q) { | 63 | + if (!fn) { |
64 | + return false; | ||
65 | + } | ||
66 | + | ||
67 | + if ((a->vd | a->vm) & a->q) { | ||
50 | + return false; | 68 | + return false; |
51 | + } | 69 | + } |
52 | + | 70 | + |
53 | + if (!vfp_access_check(s)) { | 71 | + if (!vfp_access_check(s)) { |
54 | + return true; | 72 | + return true; |
55 | + } | 73 | + } |
56 | + | 74 | + |
57 | + fn_gvec = a->u ? gen_helper_gvec_udot_idx_b : gen_helper_gvec_sdot_idx_b; | 75 | + for (pass = 0; pass < (a->q ? 4 : 2); pass++) { |
58 | + opr_sz = (1 + a->q) * 8; | 76 | + TCGv_i32 tmp = neon_load_reg(a->vm, pass); |
59 | + fpst = get_fpstatus_ptr(1); | 77 | + fn(tmp, tmp); |
60 | + tcg_gen_gvec_3_ool(vfp_reg_offset(1, a->vd), | 78 | + neon_store_reg(a->vd, pass, tmp); |
61 | + vfp_reg_offset(1, a->vn), | 79 | + } |
62 | + vfp_reg_offset(1, a->rm), | 80 | + |
63 | + opr_sz, opr_sz, a->index, fn_gvec); | ||
64 | + tcg_temp_free_ptr(fpst); | ||
65 | + return true; | 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); | ||
66 | +} | 101 | +} |
67 | diff --git a/target/arm/translate.c b/target/arm/translate.c | 102 | diff --git a/target/arm/translate.c b/target/arm/translate.c |
68 | index XXXXXXX..XXXXXXX 100644 | 103 | index XXXXXXX..XXXXXXX 100644 |
69 | --- a/target/arm/translate.c | 104 | --- a/target/arm/translate.c |
70 | +++ b/target/arm/translate.c | 105 | +++ b/target/arm/translate.c |
71 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_insn_2reg_scalar_ext(DisasContext *s, uint32_t insn) | 106 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) |
72 | bool is_long = false, q = extract32(insn, 6, 1); | 107 | case NEON_2RM_AESE: case NEON_2RM_AESMC: |
73 | bool ptr_is_env = false; | 108 | case NEON_2RM_SHA1H: |
74 | 109 | case NEON_2RM_SHA1SU1: | |
75 | - if ((insn & 0xffb00f00) == 0xfe200d00) { | 110 | + case NEON_2RM_VREV32: |
76 | - /* V[US]DOT -- 1111 1110 0.10 .... .... 1101 .Q.U .... */ | 111 | + case NEON_2RM_VREV16: |
77 | - int u = extract32(insn, 4, 1); | 112 | /* handled by decodetree */ |
78 | - | 113 | return 1; |
79 | - if (!dc_isar_feature(aa32_dp, s)) { | 114 | case NEON_2RM_VTRN: |
80 | - return 1; | 115 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) |
81 | - } | 116 | for (pass = 0; pass < (q ? 4 : 2); pass++) { |
82 | - fn_gvec = u ? gen_helper_gvec_udot_idx_b : gen_helper_gvec_sdot_idx_b; | 117 | tmp = neon_load_reg(rm, pass); |
83 | - /* rm is just Vm, and index is M. */ | 118 | switch (op) { |
84 | - data = extract32(insn, 5, 1); /* index */ | 119 | - case NEON_2RM_VREV32: |
85 | - rm = extract32(insn, 0, 4); | 120 | - switch (size) { |
86 | - } else if ((insn & 0xffa00f10) == 0xfe000810) { | 121 | - case 0: tcg_gen_bswap32_i32(tmp, tmp); break; |
87 | + if ((insn & 0xffa00f10) == 0xfe000810) { | 122 | - case 1: gen_swap_half(tmp, tmp); break; |
88 | /* VFM[AS]L -- 1111 1110 0.0S .... .... 1000 .Q.1 .... */ | 123 | - default: abort(); |
89 | int is_s = extract32(insn, 20, 1); | 124 | - } |
90 | int vm20 = extract32(insn, 0, 3); | 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; | ||
91 | -- | 132 | -- |
92 | 2.20.1 | 133 | 2.20.1 |
93 | 134 | ||
94 | 135 | diff view generated by jsdifflib |
1 | Convert the Neon VMUL, VMLA, VMLS and VSHL insns in the | 1 | Convert the remaining ops in the Neon 2-reg-misc group which |
---|---|---|---|
2 | 3-reg-same grouping to decodetree. | 2 | can be implemented simply with our do_2misc() helper. |
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: Richard Henderson <richard.henderson@linaro.org> | 5 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
6 | Message-id: 20200430181003.21682-20-peter.maydell@linaro.org | 6 | Message-id: 20200616170844.13318-14-peter.maydell@linaro.org |
7 | --- | 7 | --- |
8 | target/arm/neon-dp.decode | 9 +++++++ | 8 | target/arm/neon-dp.decode | 10 +++++ |
9 | target/arm/translate-neon.inc.c | 44 +++++++++++++++++++++++++++++++++ | 9 | target/arm/translate-neon.inc.c | 69 +++++++++++++++++++++++++++++++++ |
10 | target/arm/translate.c | 28 +++------------------ | 10 | target/arm/translate.c | 38 ++++-------------- |
11 | 3 files changed, 56 insertions(+), 25 deletions(-) | 11 | 3 files changed, 86 insertions(+), 31 deletions(-) |
12 | 12 | ||
13 | diff --git a/target/arm/neon-dp.decode b/target/arm/neon-dp.decode | 13 | diff --git a/target/arm/neon-dp.decode b/target/arm/neon-dp.decode |
14 | index XXXXXXX..XXXXXXX 100644 | 14 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/target/arm/neon-dp.decode | 15 | --- a/target/arm/neon-dp.decode |
16 | +++ b/target/arm/neon-dp.decode | 16 | +++ b/target/arm/neon-dp.decode |
17 | @@ -XXX,XX +XXX,XX @@ VCGT_U_3s 1111 001 1 0 . .. .... .... 0011 . . . 0 .... @3same | 17 | @@ -XXX,XX +XXX,XX @@ Vimm_1r 1111 001 . 1 . 000 ... .... cmode:4 0 . op:1 1 .... @1reg_imm |
18 | VCGE_S_3s 1111 001 0 0 . .. .... .... 0011 . . . 1 .... @3same | 18 | AESMC 1111 001 11 . 11 .. 00 .... 0 0111 0 . 0 .... @2misc_q1 |
19 | VCGE_U_3s 1111 001 1 0 . .. .... .... 0011 . . . 1 .... @3same | 19 | AESIMC 1111 001 11 . 11 .. 00 .... 0 0111 1 . 0 .... @2misc_q1 |
20 | 20 | ||
21 | +VSHL_S_3s 1111 001 0 0 . .. .... .... 0100 . . . 0 .... @3same | 21 | + VCLS 1111 001 11 . 11 .. 00 .... 0 1000 . . 0 .... @2misc |
22 | +VSHL_U_3s 1111 001 1 0 . .. .... .... 0100 . . . 0 .... @3same | 22 | + VCLZ 1111 001 11 . 11 .. 00 .... 0 1001 . . 0 .... @2misc |
23 | + VCNT 1111 001 11 . 11 .. 00 .... 0 1010 . . 0 .... @2misc | ||
23 | + | 24 | + |
24 | VMAX_S_3s 1111 001 0 0 . .. .... .... 0110 . . . 0 .... @3same | 25 | VMVN 1111 001 11 . 11 .. 00 .... 0 1011 . . 0 .... @2misc |
25 | VMAX_U_3s 1111 001 1 0 . .. .... .... 0110 . . . 0 .... @3same | 26 | |
26 | VMIN_S_3s 1111 001 0 0 . .. .... .... 0110 . . . 1 .... @3same | 27 | VPADAL_S 1111 001 11 . 11 .. 00 .... 0 1100 . . 0 .... @2misc |
27 | @@ -XXX,XX +XXX,XX @@ VSUB_3s 1111 001 1 0 . .. .... .... 1000 . . . 0 .... @3same | 28 | @@ -XXX,XX +XXX,XX @@ Vimm_1r 1111 001 . 1 . 000 ... .... cmode:4 0 . op:1 1 .... @1reg_imm |
28 | 29 | VABS 1111 001 11 . 11 .. 01 .... 0 0110 . . 0 .... @2misc | |
29 | VTST_3s 1111 001 0 0 . .. .... .... 1000 . . . 1 .... @3same | 30 | VNEG 1111 001 11 . 11 .. 01 .... 0 0111 . . 0 .... @2misc |
30 | VCEQ_3s 1111 001 1 0 . .. .... .... 1000 . . . 1 .... @3same | 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 | ||
31 | + | 34 | + |
32 | +VMLA_3s 1111 001 0 0 . .. .... .... 1001 . . . 0 .... @3same | 35 | VUZP 1111 001 11 . 11 .. 10 .... 0 0010 . . 0 .... @2misc |
33 | +VMLS_3s 1111 001 1 0 . .. .... .... 1001 . . . 0 .... @3same | 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 | ||
34 | + | 42 | + |
35 | +VMUL_3s 1111 001 0 0 . .. .... .... 1001 . . . 1 .... @3same | 43 | + VRECPE 1111 001 11 . 11 .. 11 .... 0 1000 . . 0 .... @2misc |
36 | +VMUL_p_3s 1111 001 1 0 . .. .... .... 1001 . . . 1 .... @3same | 44 | + VRSQRTE 1111 001 11 . 11 .. 11 .... 0 1001 . . 0 .... @2misc |
45 | ] | ||
46 | |||
47 | # Subgroup for size != 0b11 | ||
37 | diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c | 48 | diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c |
38 | index XXXXXXX..XXXXXXX 100644 | 49 | index XXXXXXX..XXXXXXX 100644 |
39 | --- a/target/arm/translate-neon.inc.c | 50 | --- a/target/arm/translate-neon.inc.c |
40 | +++ b/target/arm/translate-neon.inc.c | 51 | +++ b/target/arm/translate-neon.inc.c |
41 | @@ -XXX,XX +XXX,XX @@ DO_3SAME_NO_SZ_3(VMAX_S, tcg_gen_gvec_smax) | 52 | @@ -XXX,XX +XXX,XX @@ static bool trans_VREV16(DisasContext *s, arg_2misc *a) |
42 | DO_3SAME_NO_SZ_3(VMAX_U, tcg_gen_gvec_umax) | 53 | } |
43 | DO_3SAME_NO_SZ_3(VMIN_S, tcg_gen_gvec_smin) | 54 | return do_2misc(s, a, gen_rev16); |
44 | DO_3SAME_NO_SZ_3(VMIN_U, tcg_gen_gvec_umin) | 55 | } |
45 | +DO_3SAME_NO_SZ_3(VMUL, tcg_gen_gvec_mul) | ||
46 | |||
47 | #define DO_3SAME_CMP(INSN, COND) \ | ||
48 | static void gen_##INSN##_3s(unsigned vece, uint32_t rd_ofs, \ | ||
49 | @@ -XXX,XX +XXX,XX @@ DO_3SAME_GVEC4(VQADD_S, sqadd_op) | ||
50 | DO_3SAME_GVEC4(VQADD_U, uqadd_op) | ||
51 | DO_3SAME_GVEC4(VQSUB_S, sqsub_op) | ||
52 | DO_3SAME_GVEC4(VQSUB_U, uqsub_op) | ||
53 | + | 56 | + |
54 | +static void gen_VMUL_p_3s(unsigned vece, uint32_t rd_ofs, uint32_t rn_ofs, | 57 | +static bool trans_VCLS(DisasContext *s, arg_2misc *a) |
55 | + uint32_t rm_ofs, uint32_t oprsz, uint32_t maxsz) | ||
56 | +{ | 58 | +{ |
57 | + tcg_gen_gvec_3_ool(rd_ofs, rn_ofs, rm_ofs, oprsz, maxsz, | 59 | + static NeonGenOneOpFn * const fn[] = { |
58 | + 0, gen_helper_gvec_pmul_b); | 60 | + gen_helper_neon_cls_s8, |
61 | + gen_helper_neon_cls_s16, | ||
62 | + gen_helper_neon_cls_s32, | ||
63 | + NULL, | ||
64 | + }; | ||
65 | + return do_2misc(s, a, fn[a->size]); | ||
59 | +} | 66 | +} |
60 | + | 67 | + |
61 | +static bool trans_VMUL_p_3s(DisasContext *s, arg_3same *a) | 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) | ||
62 | +{ | 85 | +{ |
63 | + if (a->size != 0) { | 86 | + if (a->size != 0) { |
64 | + return false; | 87 | + return false; |
65 | + } | 88 | + } |
66 | + return do_3same(s, a, gen_VMUL_p_3s); | 89 | + return do_2misc(s, a, gen_helper_neon_cnt_u8); |
67 | +} | 90 | +} |
68 | + | 91 | + |
69 | +#define DO_3SAME_GVEC3_NO_SZ_3(INSN, OPARRAY) \ | 92 | +static bool trans_VABS_F(DisasContext *s, arg_2misc *a) |
70 | + static void gen_##INSN##_3s(unsigned vece, uint32_t rd_ofs, \ | 93 | +{ |
71 | + uint32_t rn_ofs, uint32_t rm_ofs, \ | 94 | + if (a->size != 2) { |
72 | + uint32_t oprsz, uint32_t maxsz) \ | 95 | + return false; |
73 | + { \ | 96 | + } |
74 | + tcg_gen_gvec_3(rd_ofs, rn_ofs, rm_ofs, \ | 97 | + /* TODO: FP16 : size == 1 */ |
75 | + oprsz, maxsz, &OPARRAY[vece]); \ | 98 | + return do_2misc(s, a, gen_helper_vfp_abss); |
76 | + } \ | 99 | +} |
77 | + DO_3SAME_NO_SZ_3(INSN, gen_##INSN##_3s) | ||
78 | + | 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 | +} | ||
79 | + | 109 | + |
80 | +DO_3SAME_GVEC3_NO_SZ_3(VMLA, mla_op) | 110 | +static bool trans_VRECPE(DisasContext *s, arg_2misc *a) |
81 | +DO_3SAME_GVEC3_NO_SZ_3(VMLS, mls_op) | 111 | +{ |
112 | + if (a->size != 2) { | ||
113 | + return false; | ||
114 | + } | ||
115 | + return do_2misc(s, a, gen_helper_recpe_u32); | ||
116 | +} | ||
82 | + | 117 | + |
83 | +#define DO_3SAME_GVEC3_SHIFT(INSN, OPARRAY) \ | 118 | +static bool trans_VRSQRTE(DisasContext *s, arg_2misc *a) |
84 | + static void gen_##INSN##_3s(unsigned vece, uint32_t rd_ofs, \ | 119 | +{ |
85 | + uint32_t rn_ofs, uint32_t rm_ofs, \ | 120 | + if (a->size != 2) { |
86 | + uint32_t oprsz, uint32_t maxsz) \ | 121 | + return false; |
87 | + { \ | 122 | + } |
88 | + /* Note the operation is vshl vd,vm,vn */ \ | 123 | + return do_2misc(s, a, gen_helper_rsqrte_u32); |
89 | + tcg_gen_gvec_3(rd_ofs, rm_ofs, rn_ofs, \ | 124 | +} |
90 | + oprsz, maxsz, &OPARRAY[vece]); \ | ||
91 | + } \ | ||
92 | + DO_3SAME(INSN, gen_##INSN##_3s) | ||
93 | + | ||
94 | +DO_3SAME_GVEC3_SHIFT(VSHL_S, sshl_op) | ||
95 | +DO_3SAME_GVEC3_SHIFT(VSHL_U, ushl_op) | ||
96 | diff --git a/target/arm/translate.c b/target/arm/translate.c | 125 | diff --git a/target/arm/translate.c b/target/arm/translate.c |
97 | index XXXXXXX..XXXXXXX 100644 | 126 | index XXXXXXX..XXXXXXX 100644 |
98 | --- a/target/arm/translate.c | 127 | --- a/target/arm/translate.c |
99 | +++ b/target/arm/translate.c | 128 | +++ b/target/arm/translate.c |
100 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) | 129 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) |
101 | } | 130 | case NEON_2RM_SHA1SU1: |
102 | return 1; | 131 | case NEON_2RM_VREV32: |
103 | 132 | case NEON_2RM_VREV16: | |
104 | - case NEON_3R_VMUL: /* VMUL */ | 133 | + case NEON_2RM_VCLS: |
105 | - if (u) { | 134 | + case NEON_2RM_VCLZ: |
106 | - /* Polynomial case allows only P8. */ | 135 | + case NEON_2RM_VCNT: |
107 | - if (size != 0) { | 136 | + case NEON_2RM_VABS_F: |
108 | - return 1; | 137 | + case NEON_2RM_VNEG_F: |
109 | - } | 138 | + case NEON_2RM_VRECPE: |
110 | - tcg_gen_gvec_3_ool(rd_ofs, rn_ofs, rm_ofs, vec_size, vec_size, | 139 | + case NEON_2RM_VRSQRTE: |
111 | - 0, gen_helper_gvec_pmul_b); | 140 | /* handled by decodetree */ |
112 | - } else { | 141 | return 1; |
113 | - tcg_gen_gvec_mul(size, rd_ofs, rn_ofs, rm_ofs, | 142 | case NEON_2RM_VTRN: |
114 | - vec_size, vec_size); | ||
115 | - } | ||
116 | - return 0; | ||
117 | - | ||
118 | - case NEON_3R_VML: /* VMLA, VMLS */ | ||
119 | - tcg_gen_gvec_3(rd_ofs, rn_ofs, rm_ofs, vec_size, vec_size, | ||
120 | - u ? &mls_op[size] : &mla_op[size]); | ||
121 | - return 0; | ||
122 | - | ||
123 | - case NEON_3R_VSHL: | ||
124 | - /* Note the operation is vshl vd,vm,vn */ | ||
125 | - tcg_gen_gvec_3(rd_ofs, rm_ofs, rn_ofs, vec_size, vec_size, | ||
126 | - u ? &ushl_op[size] : &sshl_op[size]); | ||
127 | - return 0; | ||
128 | - | ||
129 | case NEON_3R_VADD_VSUB: | ||
130 | case NEON_3R_LOGIC: | ||
131 | case NEON_3R_VMAX: | ||
132 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) | 143 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) |
133 | case NEON_3R_VCGE: | 144 | for (pass = 0; pass < (q ? 4 : 2); pass++) { |
134 | case NEON_3R_VQADD: | 145 | tmp = neon_load_reg(rm, pass); |
135 | case NEON_3R_VQSUB: | 146 | switch (op) { |
136 | + case NEON_3R_VMUL: | 147 | - case NEON_2RM_VCLS: |
137 | + case NEON_3R_VML: | 148 | - switch (size) { |
138 | + case NEON_3R_VSHL: | 149 | - case 0: gen_helper_neon_cls_s8(tmp, tmp); break; |
139 | /* Already handled by decodetree */ | 150 | - case 1: gen_helper_neon_cls_s16(tmp, tmp); break; |
140 | return 1; | 151 | - case 2: gen_helper_neon_cls_s32(tmp, tmp); break; |
141 | } | 152 | - default: abort(); |
153 | - } | ||
154 | - break; | ||
155 | - case NEON_2RM_VCLZ: | ||
156 | - switch (size) { | ||
157 | - case 0: gen_helper_neon_clz_u8(tmp, tmp); break; | ||
158 | - case 1: gen_helper_neon_clz_u16(tmp, tmp); break; | ||
159 | - case 2: tcg_gen_clzi_i32(tmp, tmp, 32); break; | ||
160 | - default: abort(); | ||
161 | - } | ||
162 | - break; | ||
163 | - case NEON_2RM_VCNT: | ||
164 | - gen_helper_neon_cnt_u8(tmp, tmp); | ||
165 | - break; | ||
166 | case NEON_2RM_VQABS: | ||
167 | switch (size) { | ||
168 | case 0: | ||
169 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) | ||
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); | ||
142 | -- | 195 | -- |
143 | 2.20.1 | 196 | 2.20.1 |
144 | 197 | ||
145 | 198 | diff view generated by jsdifflib |
1 | Convert the Neon comparison ops in the 3-reg-same grouping | 1 | Convert the Neon VQABS and VQNEG insns to decodetree. |
---|---|---|---|
2 | to decodetree. | 2 | Since these are the only ones which need cpu_env passing to |
3 | the helper, we wrap the helper rather than creating a whole | ||
4 | new do_2misc_env() function. | ||
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 | Message-id: 20200430181003.21682-18-peter.maydell@linaro.org | 8 | Message-id: 20200616170844.13318-15-peter.maydell@linaro.org |
7 | --- | 9 | --- |
8 | target/arm/neon-dp.decode | 8 ++++++++ | 10 | target/arm/neon-dp.decode | 3 +++ |
9 | target/arm/translate-neon.inc.c | 22 ++++++++++++++++++++++ | 11 | target/arm/translate-neon.inc.c | 35 +++++++++++++++++++++++++++++++++ |
10 | target/arm/translate.c | 23 +++-------------------- | 12 | target/arm/translate.c | 30 ++-------------------------- |
11 | 3 files changed, 33 insertions(+), 20 deletions(-) | 13 | 3 files changed, 40 insertions(+), 28 deletions(-) |
12 | 14 | ||
13 | diff --git a/target/arm/neon-dp.decode b/target/arm/neon-dp.decode | 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/target/arm/neon-dp.decode | 17 | --- a/target/arm/neon-dp.decode |
16 | +++ b/target/arm/neon-dp.decode | 18 | +++ b/target/arm/neon-dp.decode |
17 | @@ -XXX,XX +XXX,XX @@ VBSL_3s 1111 001 1 0 . 01 .... .... 0001 ... 1 .... @3same_logic | 19 | @@ -XXX,XX +XXX,XX @@ Vimm_1r 1111 001 . 1 . 000 ... .... cmode:4 0 . op:1 1 .... @1reg_imm |
18 | VBIT_3s 1111 001 1 0 . 10 .... .... 0001 ... 1 .... @3same_logic | 20 | VPADAL_S 1111 001 11 . 11 .. 00 .... 0 1100 . . 0 .... @2misc |
19 | VBIF_3s 1111 001 1 0 . 11 .... .... 0001 ... 1 .... @3same_logic | 21 | VPADAL_U 1111 001 11 . 11 .. 00 .... 0 1101 . . 0 .... @2misc |
20 | 22 | ||
21 | +VCGT_S_3s 1111 001 0 0 . .. .... .... 0011 . . . 0 .... @3same | 23 | + VQABS 1111 001 11 . 11 .. 00 .... 0 1110 . . 0 .... @2misc |
22 | +VCGT_U_3s 1111 001 1 0 . .. .... .... 0011 . . . 0 .... @3same | 24 | + VQNEG 1111 001 11 . 11 .. 00 .... 0 1111 . . 0 .... @2misc |
23 | +VCGE_S_3s 1111 001 0 0 . .. .... .... 0011 . . . 1 .... @3same | ||
24 | +VCGE_U_3s 1111 001 1 0 . .. .... .... 0011 . . . 1 .... @3same | ||
25 | + | 25 | + |
26 | VMAX_S_3s 1111 001 0 0 . .. .... .... 0110 . . . 0 .... @3same | 26 | VCGT0 1111 001 11 . 11 .. 01 .... 0 0000 . . 0 .... @2misc |
27 | VMAX_U_3s 1111 001 1 0 . .. .... .... 0110 . . . 0 .... @3same | 27 | VCGE0 1111 001 11 . 11 .. 01 .... 0 0001 . . 0 .... @2misc |
28 | VMIN_S_3s 1111 001 0 0 . .. .... .... 0110 . . . 1 .... @3same | 28 | VCEQ0 1111 001 11 . 11 .. 01 .... 0 0010 . . 0 .... @2misc |
29 | @@ -XXX,XX +XXX,XX @@ VMIN_U_3s 1111 001 1 0 . .. .... .... 0110 . . . 1 .... @3same | ||
30 | |||
31 | VADD_3s 1111 001 0 0 . .. .... .... 1000 . . . 0 .... @3same | ||
32 | VSUB_3s 1111 001 1 0 . .. .... .... 1000 . . . 0 .... @3same | ||
33 | + | ||
34 | +VTST_3s 1111 001 0 0 . .. .... .... 1000 . . . 1 .... @3same | ||
35 | +VCEQ_3s 1111 001 1 0 . .. .... .... 1000 . . . 1 .... @3same | ||
36 | diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c | 29 | diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c |
37 | index XXXXXXX..XXXXXXX 100644 | 30 | index XXXXXXX..XXXXXXX 100644 |
38 | --- a/target/arm/translate-neon.inc.c | 31 | --- a/target/arm/translate-neon.inc.c |
39 | +++ b/target/arm/translate-neon.inc.c | 32 | +++ b/target/arm/translate-neon.inc.c |
40 | @@ -XXX,XX +XXX,XX @@ DO_3SAME_NO_SZ_3(VMAX_S, tcg_gen_gvec_smax) | 33 | @@ -XXX,XX +XXX,XX @@ static bool trans_VRSQRTE(DisasContext *s, arg_2misc *a) |
41 | DO_3SAME_NO_SZ_3(VMAX_U, tcg_gen_gvec_umax) | 34 | } |
42 | DO_3SAME_NO_SZ_3(VMIN_S, tcg_gen_gvec_smin) | 35 | return do_2misc(s, a, gen_helper_rsqrte_u32); |
43 | DO_3SAME_NO_SZ_3(VMIN_U, tcg_gen_gvec_umin) | 36 | } |
44 | + | 37 | + |
45 | +#define DO_3SAME_CMP(INSN, COND) \ | 38 | +#define WRAP_1OP_ENV_FN(WRAPNAME, FUNC) \ |
46 | + static void gen_##INSN##_3s(unsigned vece, uint32_t rd_ofs, \ | 39 | + static void WRAPNAME(TCGv_i32 d, TCGv_i32 m) \ |
47 | + uint32_t rn_ofs, uint32_t rm_ofs, \ | 40 | + { \ |
48 | + uint32_t oprsz, uint32_t maxsz) \ | 41 | + FUNC(d, cpu_env, m); \ |
49 | + { \ | 42 | + } |
50 | + tcg_gen_gvec_cmp(COND, vece, rd_ofs, rn_ofs, rm_ofs, oprsz, maxsz); \ | ||
51 | + } \ | ||
52 | + DO_3SAME_NO_SZ_3(INSN, gen_##INSN##_3s) | ||
53 | + | 43 | + |
54 | +DO_3SAME_CMP(VCGT_S, TCG_COND_GT) | 44 | +WRAP_1OP_ENV_FN(gen_VQABS_s8, gen_helper_neon_qabs_s8) |
55 | +DO_3SAME_CMP(VCGT_U, TCG_COND_GTU) | 45 | +WRAP_1OP_ENV_FN(gen_VQABS_s16, gen_helper_neon_qabs_s16) |
56 | +DO_3SAME_CMP(VCGE_S, TCG_COND_GE) | 46 | +WRAP_1OP_ENV_FN(gen_VQABS_s32, gen_helper_neon_qabs_s32) |
57 | +DO_3SAME_CMP(VCGE_U, TCG_COND_GEU) | 47 | +WRAP_1OP_ENV_FN(gen_VQNEG_s8, gen_helper_neon_qneg_s8) |
58 | +DO_3SAME_CMP(VCEQ, TCG_COND_EQ) | 48 | +WRAP_1OP_ENV_FN(gen_VQNEG_s16, gen_helper_neon_qneg_s16) |
49 | +WRAP_1OP_ENV_FN(gen_VQNEG_s32, gen_helper_neon_qneg_s32) | ||
59 | + | 50 | + |
60 | +static void gen_VTST_3s(unsigned vece, uint32_t rd_ofs, uint32_t rn_ofs, | 51 | +static bool trans_VQABS(DisasContext *s, arg_2misc *a) |
61 | + uint32_t rm_ofs, uint32_t oprsz, uint32_t maxsz) | ||
62 | +{ | 52 | +{ |
63 | + tcg_gen_gvec_3(rd_ofs, rn_ofs, rm_ofs, oprsz, maxsz, &cmtst_op[vece]); | 53 | + static NeonGenOneOpFn * const fn[] = { |
54 | + gen_VQABS_s8, | ||
55 | + gen_VQABS_s16, | ||
56 | + gen_VQABS_s32, | ||
57 | + NULL, | ||
58 | + }; | ||
59 | + return do_2misc(s, a, fn[a->size]); | ||
64 | +} | 60 | +} |
65 | +DO_3SAME_NO_SZ_3(VTST, gen_VTST_3s) | 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 | +} | ||
66 | diff --git a/target/arm/translate.c b/target/arm/translate.c | 72 | diff --git a/target/arm/translate.c b/target/arm/translate.c |
67 | index XXXXXXX..XXXXXXX 100644 | 73 | index XXXXXXX..XXXXXXX 100644 |
68 | --- a/target/arm/translate.c | 74 | --- a/target/arm/translate.c |
69 | +++ b/target/arm/translate.c | 75 | +++ b/target/arm/translate.c |
70 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) | 76 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) |
71 | u ? &mls_op[size] : &mla_op[size]); | 77 | case NEON_2RM_VNEG_F: |
72 | return 0; | 78 | case NEON_2RM_VRECPE: |
73 | 79 | case NEON_2RM_VRSQRTE: | |
74 | - case NEON_3R_VTST_VCEQ: | 80 | + case NEON_2RM_VQABS: |
75 | - if (u) { /* VCEQ */ | 81 | + case NEON_2RM_VQNEG: |
76 | - tcg_gen_gvec_cmp(TCG_COND_EQ, size, rd_ofs, rn_ofs, rm_ofs, | 82 | /* handled by decodetree */ |
77 | - vec_size, vec_size); | 83 | return 1; |
78 | - } else { /* VTST */ | 84 | case NEON_2RM_VTRN: |
79 | - tcg_gen_gvec_3(rd_ofs, rn_ofs, rm_ofs, | ||
80 | - vec_size, vec_size, &cmtst_op[size]); | ||
81 | - } | ||
82 | - return 0; | ||
83 | - | ||
84 | - case NEON_3R_VCGT: | ||
85 | - tcg_gen_gvec_cmp(u ? TCG_COND_GTU : TCG_COND_GT, size, | ||
86 | - rd_ofs, rn_ofs, rm_ofs, vec_size, vec_size); | ||
87 | - return 0; | ||
88 | - | ||
89 | - case NEON_3R_VCGE: | ||
90 | - tcg_gen_gvec_cmp(u ? TCG_COND_GEU : TCG_COND_GE, size, | ||
91 | - rd_ofs, rn_ofs, rm_ofs, vec_size, vec_size); | ||
92 | - return 0; | ||
93 | - | ||
94 | case NEON_3R_VSHL: | ||
95 | /* Note the operation is vshl vd,vm,vn */ | ||
96 | tcg_gen_gvec_3(rd_ofs, rm_ofs, rn_ofs, vec_size, vec_size, | ||
97 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) | 85 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) |
98 | case NEON_3R_LOGIC: | 86 | for (pass = 0; pass < (q ? 4 : 2); pass++) { |
99 | case NEON_3R_VMAX: | 87 | tmp = neon_load_reg(rm, pass); |
100 | case NEON_3R_VMIN: | 88 | switch (op) { |
101 | + case NEON_3R_VTST_VCEQ: | 89 | - case NEON_2RM_VQABS: |
102 | + case NEON_3R_VCGT: | 90 | - switch (size) { |
103 | + case NEON_3R_VCGE: | 91 | - case 0: |
104 | /* Already handled by decodetree */ | 92 | - gen_helper_neon_qabs_s8(tmp, cpu_env, tmp); |
105 | return 1; | 93 | - break; |
106 | } | 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); | ||
107 | -- | 120 | -- |
108 | 2.20.1 | 121 | 2.20.1 |
109 | 122 | ||
110 | 123 | diff view generated by jsdifflib |
1 | Convert VCMLA (scalar) in the 2reg-scalar-ext group to decodetree. | 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. | ||
2 | 4 | ||
3 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 5 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
4 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 6 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
5 | Message-id: 20200430181003.21682-9-peter.maydell@linaro.org | 7 | Message-id: 20200616170844.13318-16-peter.maydell@linaro.org |
6 | --- | 8 | --- |
7 | target/arm/neon-shared.decode | 5 +++++ | 9 | target/arm/translate.h | 1 + |
8 | target/arm/translate-neon.inc.c | 40 +++++++++++++++++++++++++++++++++ | 10 | target/arm/neon-dp.decode | 8 +++++ |
9 | target/arm/translate.c | 26 +-------------------- | 11 | target/arm/translate-neon.inc.c | 62 +++++++++++++++++++++++++++++++++ |
10 | 3 files changed, 46 insertions(+), 25 deletions(-) | 12 | target/arm/translate.c | 56 ++++------------------------- |
11 | 13 | 4 files changed, 78 insertions(+), 49 deletions(-) | |
12 | diff --git a/target/arm/neon-shared.decode b/target/arm/neon-shared.decode | 14 | |
13 | index XXXXXXX..XXXXXXX 100644 | 15 | diff --git a/target/arm/translate.h b/target/arm/translate.h |
14 | --- a/target/arm/neon-shared.decode | 16 | index XXXXXXX..XXXXXXX 100644 |
15 | +++ b/target/arm/neon-shared.decode | 17 | --- a/target/arm/translate.h |
16 | @@ -XXX,XX +XXX,XX @@ VFML 1111 110 0 s:1 . 10 .... .... 1000 . 0 . 1 .... \ | 18 | +++ b/target/arm/translate.h |
17 | vm=%vm_sp vn=%vn_sp vd=%vd_dp q=0 | 19 | @@ -XXX,XX +XXX,XX @@ typedef void NeonGenNarrowFn(TCGv_i32, TCGv_i64); |
18 | VFML 1111 110 0 s:1 . 10 .... .... 1000 . 1 . 1 .... \ | 20 | typedef void NeonGenNarrowEnvFn(TCGv_i32, TCGv_ptr, TCGv_i64); |
19 | vm=%vm_dp vn=%vn_dp vd=%vd_dp q=1 | 21 | typedef void NeonGenWidenFn(TCGv_i64, TCGv_i32); |
20 | + | 22 | typedef void NeonGenTwoOpWidenFn(TCGv_i64, TCGv_i32, TCGv_i32); |
21 | +VCMLA_scalar 1111 1110 0 . rot:2 .... .... 1000 . q:1 index:1 0 vm:4 \ | 23 | +typedef void NeonGenOneSingleOpFn(TCGv_i32, TCGv_i32, TCGv_ptr); |
22 | + vn=%vn_dp vd=%vd_dp size=0 | 24 | typedef void NeonGenTwoSingleOpFn(TCGv_i32, TCGv_i32, TCGv_i32, TCGv_ptr); |
23 | +VCMLA_scalar 1111 1110 1 . rot:2 .... .... 1000 . q:1 . 0 .... \ | 25 | typedef void NeonGenTwoDoubleOpFn(TCGv_i64, TCGv_i64, TCGv_i64, TCGv_ptr); |
24 | + vm=%vm_dp vn=%vn_dp vd=%vd_dp size=1 index=0 | 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 | ||
25 | diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c | 51 | diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c |
26 | index XXXXXXX..XXXXXXX 100644 | 52 | index XXXXXXX..XXXXXXX 100644 |
27 | --- a/target/arm/translate-neon.inc.c | 53 | --- a/target/arm/translate-neon.inc.c |
28 | +++ b/target/arm/translate-neon.inc.c | 54 | +++ b/target/arm/translate-neon.inc.c |
29 | @@ -XXX,XX +XXX,XX @@ static bool trans_VFML(DisasContext *s, arg_VFML *a) | 55 | @@ -XXX,XX +XXX,XX @@ static bool trans_VQNEG(DisasContext *s, arg_2misc *a) |
30 | gen_helper_gvec_fmlal_a32); | 56 | }; |
31 | return true; | 57 | return do_2misc(s, a, fn[a->size]); |
32 | } | 58 | } |
33 | + | 59 | + |
34 | +static bool trans_VCMLA_scalar(DisasContext *s, arg_VCMLA_scalar *a) | 60 | +static bool do_2misc_fp(DisasContext *s, arg_2misc *a, |
61 | + NeonGenOneSingleOpFn *fn) | ||
35 | +{ | 62 | +{ |
36 | + gen_helper_gvec_3_ptr *fn_gvec_ptr; | 63 | + int pass; |
37 | + int opr_sz; | ||
38 | + TCGv_ptr fpst; | 64 | + TCGv_ptr fpst; |
39 | + | 65 | + |
40 | + if (!dc_isar_feature(aa32_vcma, s)) { | 66 | + /* Handle a 2-reg-misc operation by iterating 32 bits at a time */ |
41 | + return false; | 67 | + if (!arm_dc_feature(s, ARM_FEATURE_NEON)) { |
42 | + } | ||
43 | + if (a->size == 0 && !dc_isar_feature(aa32_fp16_arith, s)) { | ||
44 | + return false; | 68 | + return false; |
45 | + } | 69 | + } |
46 | + | 70 | + |
47 | + /* UNDEF accesses to D16-D31 if they don't exist. */ | 71 | + /* UNDEF accesses to D16-D31 if they don't exist. */ |
48 | + if (!dc_isar_feature(aa32_simd_r32, s) && | 72 | + if (!dc_isar_feature(aa32_simd_r32, s) && |
49 | + ((a->vd | a->vn | a->vm) & 0x10)) { | 73 | + ((a->vd | a->vm) & 0x10)) { |
50 | + return false; | 74 | + return false; |
51 | + } | 75 | + } |
52 | + | 76 | + |
53 | + if ((a->vd | a->vn) & a->q) { | 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) { | ||
54 | + return false; | 83 | + return false; |
55 | + } | 84 | + } |
56 | + | 85 | + |
57 | + if (!vfp_access_check(s)) { | 86 | + if (!vfp_access_check(s)) { |
58 | + return true; | 87 | + return true; |
59 | + } | 88 | + } |
60 | + | 89 | + |
61 | + fn_gvec_ptr = (a->size ? gen_helper_gvec_fcmlas_idx | ||
62 | + : gen_helper_gvec_fcmlah_idx); | ||
63 | + opr_sz = (1 + a->q) * 8; | ||
64 | + fpst = get_fpstatus_ptr(1); | 90 | + fpst = get_fpstatus_ptr(1); |
65 | + tcg_gen_gvec_3_ptr(vfp_reg_offset(1, a->vd), | 91 | + for (pass = 0; pass < (a->q ? 4 : 2); pass++) { |
66 | + vfp_reg_offset(1, a->vn), | 92 | + TCGv_i32 tmp = neon_load_reg(a->vm, pass); |
67 | + vfp_reg_offset(1, a->vm), | 93 | + fn(tmp, tmp, fpst); |
68 | + fpst, opr_sz, opr_sz, | 94 | + neon_store_reg(a->vd, pass, tmp); |
69 | + (a->index << 2) | a->rot, fn_gvec_ptr); | 95 | + } |
70 | + tcg_temp_free_ptr(fpst); | 96 | + tcg_temp_free_ptr(fpst); |
97 | + | ||
71 | + return true; | 98 | + return true; |
72 | +} | 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 | +} | ||
73 | diff --git a/target/arm/translate.c b/target/arm/translate.c | 121 | diff --git a/target/arm/translate.c b/target/arm/translate.c |
74 | index XXXXXXX..XXXXXXX 100644 | 122 | index XXXXXXX..XXXXXXX 100644 |
75 | --- a/target/arm/translate.c | 123 | --- a/target/arm/translate.c |
76 | +++ b/target/arm/translate.c | 124 | +++ b/target/arm/translate.c |
77 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_insn_2reg_scalar_ext(DisasContext *s, uint32_t insn) | 125 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) |
78 | bool is_long = false, q = extract32(insn, 6, 1); | 126 | case NEON_2RM_VRSQRTE: |
79 | bool ptr_is_env = false; | 127 | case NEON_2RM_VQABS: |
80 | 128 | case NEON_2RM_VQNEG: | |
81 | - if ((insn & 0xff000f10) == 0xfe000800) { | 129 | + case NEON_2RM_VRECPE_F: |
82 | - /* VCMLA (indexed) -- 1111 1110 S.RR .... .... 1000 ...0 .... */ | 130 | + case NEON_2RM_VRSQRTE_F: |
83 | - int rot = extract32(insn, 20, 2); | 131 | + case NEON_2RM_VCVT_FS: |
84 | - int size = extract32(insn, 23, 1); | 132 | + case NEON_2RM_VCVT_FU: |
85 | - int index; | 133 | + case NEON_2RM_VCVT_SF: |
86 | - | 134 | + case NEON_2RM_VCVT_UF: |
87 | - if (!dc_isar_feature(aa32_vcma, s)) { | 135 | + case NEON_2RM_VRINTX: |
88 | - return 1; | 136 | /* handled by decodetree */ |
89 | - } | 137 | return 1; |
90 | - if (size == 0) { | 138 | case NEON_2RM_VTRN: |
91 | - if (!dc_isar_feature(aa32_fp16_arith, s)) { | 139 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) |
92 | - return 1; | 140 | tcg_temp_free_i32(tcg_rmode); |
93 | - } | 141 | break; |
94 | - /* For fp16, rm is just Vm, and index is M. */ | 142 | } |
95 | - rm = extract32(insn, 0, 4); | 143 | - case NEON_2RM_VRINTX: |
96 | - index = extract32(insn, 5, 1); | 144 | - { |
97 | - } else { | 145 | - TCGv_ptr fpstatus = get_fpstatus_ptr(1); |
98 | - /* For fp32, rm is the usual M:Vm, and index is 0. */ | 146 | - gen_helper_rints_exact(tmp, tmp, fpstatus); |
99 | - VFP_DREG_M(rm, insn); | 147 | - tcg_temp_free_ptr(fpstatus); |
100 | - index = 0; | 148 | - break; |
101 | - } | 149 | - } |
102 | - data = (index << 2) | rot; | 150 | case NEON_2RM_VCVTAU: |
103 | - fn_gvec_ptr = (size ? gen_helper_gvec_fcmlas_idx | 151 | case NEON_2RM_VCVTAS: |
104 | - : gen_helper_gvec_fcmlah_idx); | 152 | case NEON_2RM_VCVTNU: |
105 | - } else if ((insn & 0xffb00f00) == 0xfe200d00) { | 153 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) |
106 | + if ((insn & 0xffb00f00) == 0xfe200d00) { | 154 | tcg_temp_free_ptr(fpst); |
107 | /* V[US]DOT -- 1111 1110 0.10 .... .... 1101 .Q.U .... */ | 155 | break; |
108 | int u = extract32(insn, 4, 1); | 156 | } |
109 | 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. | ||
110 | -- | 202 | -- |
111 | 2.20.1 | 203 | 2.20.1 |
112 | 204 | ||
113 | 205 | diff view generated by jsdifflib |
1 | Convert the Neon 3-reg-same VMAX and VMIN insns to decodetree. | 1 | Convert the fp-compare-with-zero insns in the Neon 2-reg-misc group to |
---|---|---|---|
2 | decodetree. | ||
2 | 3 | ||
3 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 4 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
4 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 5 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
5 | Message-id: 20200430181003.21682-17-peter.maydell@linaro.org | 6 | Message-id: 20200616170844.13318-17-peter.maydell@linaro.org |
6 | --- | 7 | --- |
7 | target/arm/neon-dp.decode | 5 +++++ | 8 | target/arm/neon-dp.decode | 6 ++++ |
8 | target/arm/translate-neon.inc.c | 14 ++++++++++++++ | 9 | target/arm/translate-neon.inc.c | 28 ++++++++++++++++++ |
9 | target/arm/translate.c | 21 ++------------------- | 10 | target/arm/translate.c | 50 ++++----------------------------- |
10 | 3 files changed, 21 insertions(+), 19 deletions(-) | 11 | 3 files changed, 39 insertions(+), 45 deletions(-) |
11 | 12 | ||
12 | diff --git a/target/arm/neon-dp.decode b/target/arm/neon-dp.decode | 13 | diff --git a/target/arm/neon-dp.decode b/target/arm/neon-dp.decode |
13 | index XXXXXXX..XXXXXXX 100644 | 14 | index XXXXXXX..XXXXXXX 100644 |
14 | --- a/target/arm/neon-dp.decode | 15 | --- a/target/arm/neon-dp.decode |
15 | +++ b/target/arm/neon-dp.decode | 16 | +++ b/target/arm/neon-dp.decode |
16 | @@ -XXX,XX +XXX,XX @@ VBSL_3s 1111 001 1 0 . 01 .... .... 0001 ... 1 .... @3same_logic | 17 | @@ -XXX,XX +XXX,XX @@ Vimm_1r 1111 001 . 1 . 000 ... .... cmode:4 0 . op:1 1 .... @1reg_imm |
17 | VBIT_3s 1111 001 1 0 . 10 .... .... 0001 ... 1 .... @3same_logic | 18 | VABS 1111 001 11 . 11 .. 01 .... 0 0110 . . 0 .... @2misc |
18 | VBIF_3s 1111 001 1 0 . 11 .... .... 0001 ... 1 .... @3same_logic | 19 | VNEG 1111 001 11 . 11 .. 01 .... 0 0111 . . 0 .... @2misc |
19 | 20 | ||
20 | +VMAX_S_3s 1111 001 0 0 . .. .... .... 0110 . . . 0 .... @3same | 21 | + VCGT0_F 1111 001 11 . 11 .. 01 .... 0 1000 . . 0 .... @2misc |
21 | +VMAX_U_3s 1111 001 1 0 . .. .... .... 0110 . . . 0 .... @3same | 22 | + VCGE0_F 1111 001 11 . 11 .. 01 .... 0 1001 . . 0 .... @2misc |
22 | +VMIN_S_3s 1111 001 0 0 . .. .... .... 0110 . . . 1 .... @3same | 23 | + VCEQ0_F 1111 001 11 . 11 .. 01 .... 0 1010 . . 0 .... @2misc |
23 | +VMIN_U_3s 1111 001 1 0 . .. .... .... 0110 . . . 1 .... @3same | 24 | + VCLE0_F 1111 001 11 . 11 .. 01 .... 0 1011 . . 0 .... @2misc |
25 | + VCLT0_F 1111 001 11 . 11 .. 01 .... 0 1100 . . 0 .... @2misc | ||
24 | + | 26 | + |
25 | VADD_3s 1111 001 0 0 . .. .... .... 1000 . . . 0 .... @3same | 27 | VABS_F 1111 001 11 . 11 .. 01 .... 0 1110 . . 0 .... @2misc |
26 | VSUB_3s 1111 001 1 0 . .. .... .... 1000 . . . 0 .... @3same | 28 | VNEG_F 1111 001 11 . 11 .. 01 .... 0 1111 . . 0 .... @2misc |
29 | |||
27 | diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c | 30 | diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c |
28 | index XXXXXXX..XXXXXXX 100644 | 31 | index XXXXXXX..XXXXXXX 100644 |
29 | --- a/target/arm/translate-neon.inc.c | 32 | --- a/target/arm/translate-neon.inc.c |
30 | +++ b/target/arm/translate-neon.inc.c | 33 | +++ b/target/arm/translate-neon.inc.c |
31 | @@ -XXX,XX +XXX,XX @@ DO_3SAME(VEOR, tcg_gen_gvec_xor) | 34 | @@ -XXX,XX +XXX,XX @@ static bool trans_VRINTX(DisasContext *s, arg_2misc *a) |
32 | DO_3SAME_BITSEL(VBSL, rd_ofs, rn_ofs, rm_ofs) | 35 | } |
33 | DO_3SAME_BITSEL(VBIT, rm_ofs, rn_ofs, rd_ofs) | 36 | return do_2misc_fp(s, a, gen_helper_rints_exact); |
34 | DO_3SAME_BITSEL(VBIF, rm_ofs, rd_ofs, rn_ofs) | 37 | } |
35 | + | 38 | + |
36 | +#define DO_3SAME_NO_SZ_3(INSN, FUNC) \ | 39 | +#define WRAP_FP_CMP0_FWD(WRAPNAME, FUNC) \ |
37 | + static bool trans_##INSN##_3s(DisasContext *s, arg_3same *a) \ | 40 | + static void WRAPNAME(TCGv_i32 d, TCGv_i32 m, TCGv_ptr fpst) \ |
38 | + { \ | 41 | + { \ |
39 | + if (a->size == 3) { \ | 42 | + TCGv_i32 zero = tcg_const_i32(0); \ |
40 | + return false; \ | 43 | + FUNC(d, m, zero, fpst); \ |
41 | + } \ | 44 | + tcg_temp_free_i32(zero); \ |
42 | + return do_3same(s, a, FUNC); \ | 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); \ | ||
43 | + } | 52 | + } |
44 | + | 53 | + |
45 | +DO_3SAME_NO_SZ_3(VMAX_S, tcg_gen_gvec_smax) | 54 | +#define DO_FP_CMP0(INSN, FUNC, REV) \ |
46 | +DO_3SAME_NO_SZ_3(VMAX_U, tcg_gen_gvec_umax) | 55 | + WRAP_FP_CMP0_##REV(gen_##INSN, FUNC) \ |
47 | +DO_3SAME_NO_SZ_3(VMIN_S, tcg_gen_gvec_smin) | 56 | + static bool trans_##INSN(DisasContext *s, arg_2misc *a) \ |
48 | +DO_3SAME_NO_SZ_3(VMIN_U, tcg_gen_gvec_umin) | 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) | ||
49 | diff --git a/target/arm/translate.c b/target/arm/translate.c | 66 | diff --git a/target/arm/translate.c b/target/arm/translate.c |
50 | index XXXXXXX..XXXXXXX 100644 | 67 | index XXXXXXX..XXXXXXX 100644 |
51 | --- a/target/arm/translate.c | 68 | --- a/target/arm/translate.c |
52 | +++ b/target/arm/translate.c | 69 | +++ b/target/arm/translate.c |
53 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) | 70 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) |
54 | rd_ofs, rn_ofs, rm_ofs, vec_size, vec_size); | 71 | case NEON_2RM_VCVT_SF: |
55 | return 0; | 72 | case NEON_2RM_VCVT_UF: |
56 | 73 | case NEON_2RM_VRINTX: | |
57 | - case NEON_3R_VMAX: | 74 | + case NEON_2RM_VCGT0_F: |
58 | - if (u) { | 75 | + case NEON_2RM_VCGE0_F: |
59 | - tcg_gen_gvec_umax(size, rd_ofs, rn_ofs, rm_ofs, | 76 | + case NEON_2RM_VCEQ0_F: |
60 | - vec_size, vec_size); | 77 | + case NEON_2RM_VCLE0_F: |
61 | - } else { | 78 | + case NEON_2RM_VCLT0_F: |
62 | - tcg_gen_gvec_smax(size, rd_ofs, rn_ofs, rm_ofs, | 79 | /* handled by decodetree */ |
63 | - vec_size, vec_size); | 80 | return 1; |
64 | - } | 81 | case NEON_2RM_VTRN: |
65 | - return 0; | ||
66 | - case NEON_3R_VMIN: | ||
67 | - if (u) { | ||
68 | - tcg_gen_gvec_umin(size, rd_ofs, rn_ofs, rm_ofs, | ||
69 | - vec_size, vec_size); | ||
70 | - } else { | ||
71 | - tcg_gen_gvec_smin(size, rd_ofs, rn_ofs, rm_ofs, | ||
72 | - vec_size, vec_size); | ||
73 | - } | ||
74 | - return 0; | ||
75 | - | ||
76 | case NEON_3R_VSHL: | ||
77 | /* Note the operation is vshl vd,vm,vn */ | ||
78 | tcg_gen_gvec_3(rd_ofs, rm_ofs, rn_ofs, vec_size, vec_size, | ||
79 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) | 82 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) |
80 | 83 | for (pass = 0; pass < (q ? 4 : 2); pass++) { | |
81 | case NEON_3R_VADD_VSUB: | 84 | tmp = neon_load_reg(rm, pass); |
82 | case NEON_3R_LOGIC: | 85 | switch (op) { |
83 | + case NEON_3R_VMAX: | 86 | - case NEON_2RM_VCGT0_F: |
84 | + case NEON_3R_VMIN: | 87 | - { |
85 | /* Already handled by decodetree */ | 88 | - TCGv_ptr fpstatus = get_fpstatus_ptr(1); |
86 | return 1; | 89 | - tmp2 = tcg_const_i32(0); |
87 | } | 90 | - gen_helper_neon_cgt_f32(tmp, tmp, tmp2, fpstatus); |
91 | - tcg_temp_free_i32(tmp2); | ||
92 | - tcg_temp_free_ptr(fpstatus); | ||
93 | - break; | ||
94 | - } | ||
95 | - case NEON_2RM_VCGE0_F: | ||
96 | - { | ||
97 | - TCGv_ptr fpstatus = get_fpstatus_ptr(1); | ||
98 | - tmp2 = tcg_const_i32(0); | ||
99 | - gen_helper_neon_cge_f32(tmp, tmp, tmp2, fpstatus); | ||
100 | - tcg_temp_free_i32(tmp2); | ||
101 | - tcg_temp_free_ptr(fpstatus); | ||
102 | - break; | ||
103 | - } | ||
104 | - case NEON_2RM_VCEQ0_F: | ||
105 | - { | ||
106 | - TCGv_ptr fpstatus = get_fpstatus_ptr(1); | ||
107 | - tmp2 = tcg_const_i32(0); | ||
108 | - gen_helper_neon_ceq_f32(tmp, tmp, tmp2, fpstatus); | ||
109 | - tcg_temp_free_i32(tmp2); | ||
110 | - tcg_temp_free_ptr(fpstatus); | ||
111 | - break; | ||
112 | - } | ||
113 | - case NEON_2RM_VCLE0_F: | ||
114 | - { | ||
115 | - TCGv_ptr fpstatus = get_fpstatus_ptr(1); | ||
116 | - tmp2 = tcg_const_i32(0); | ||
117 | - gen_helper_neon_cge_f32(tmp, tmp2, tmp, fpstatus); | ||
118 | - tcg_temp_free_i32(tmp2); | ||
119 | - tcg_temp_free_ptr(fpstatus); | ||
120 | - break; | ||
121 | - } | ||
122 | - case NEON_2RM_VCLT0_F: | ||
123 | - { | ||
124 | - TCGv_ptr fpstatus = get_fpstatus_ptr(1); | ||
125 | - tmp2 = tcg_const_i32(0); | ||
126 | - gen_helper_neon_cgt_f32(tmp, tmp2, tmp, fpstatus); | ||
127 | - tcg_temp_free_i32(tmp2); | ||
128 | - tcg_temp_free_ptr(fpstatus); | ||
129 | - break; | ||
130 | - } | ||
131 | case NEON_2RM_VSWP: | ||
132 | tmp2 = neon_load_reg(rd, pass); | ||
133 | neon_store_reg(rm, pass, tmp2); | ||
88 | -- | 134 | -- |
89 | 2.20.1 | 135 | 2.20.1 |
90 | 136 | ||
91 | 137 | diff view generated by jsdifflib |
1 | Convert the Neon logic ops in the 3-reg-same grouping to decodetree. | 1 | Convert the Neon 2-reg-misc VRINT insns to decodetree. |
---|---|---|---|
2 | Note that for the logic ops the 'size' field forms part of their | 2 | Giving these insns their own do_vrint() function allows us |
3 | decode and the actual operations are always bitwise. | 3 | to change the rounding mode just once at the start and end |
4 | rather than doing it for every element in the vector. | ||
4 | 5 | ||
5 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
6 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 7 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
7 | Message-id: 20200430181003.21682-16-peter.maydell@linaro.org | 8 | Message-id: 20200616170844.13318-18-peter.maydell@linaro.org |
8 | --- | 9 | --- |
9 | target/arm/neon-dp.decode | 12 +++++++++++ | 10 | target/arm/neon-dp.decode | 8 +++++ |
10 | target/arm/translate-neon.inc.c | 19 +++++++++++++++++ | 11 | target/arm/translate-neon.inc.c | 61 +++++++++++++++++++++++++++++++++ |
11 | target/arm/translate.c | 38 +-------------------------------- | 12 | target/arm/translate.c | 31 +++-------------- |
12 | 3 files changed, 32 insertions(+), 37 deletions(-) | 13 | 3 files changed, 74 insertions(+), 26 deletions(-) |
13 | 14 | ||
14 | diff --git a/target/arm/neon-dp.decode b/target/arm/neon-dp.decode | 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/target/arm/neon-dp.decode | 17 | --- a/target/arm/neon-dp.decode |
17 | +++ b/target/arm/neon-dp.decode | 18 | +++ b/target/arm/neon-dp.decode |
18 | @@ -XXX,XX +XXX,XX @@ | 19 | @@ -XXX,XX +XXX,XX @@ Vimm_1r 1111 001 . 1 . 000 ... .... cmode:4 0 . op:1 1 .... @1reg_imm |
19 | @3same .... ... . . . size:2 .... .... .... . q:1 . . .... \ | 20 | SHA1SU1 1111 001 11 . 11 .. 10 .... 0 0111 0 . 0 .... @2misc_q1 |
20 | &3same vm=%vm_dp vn=%vn_dp vd=%vd_dp | 21 | SHA256SU0 1111 001 11 . 11 .. 10 .... 0 0111 1 . 0 .... @2misc_q1 |
21 | 22 | ||
22 | +@3same_logic .... ... . . . .. .... .... .... . q:1 .. .... \ | 23 | + VRINTN 1111 001 11 . 11 .. 10 .... 0 1000 . . 0 .... @2misc |
23 | + &3same vm=%vm_dp vn=%vn_dp vd=%vd_dp size=0 | 24 | VRINTX 1111 001 11 . 11 .. 10 .... 0 1001 . . 0 .... @2misc |
25 | + VRINTA 1111 001 11 . 11 .. 10 .... 0 1010 . . 0 .... @2misc | ||
26 | + VRINTZ 1111 001 11 . 11 .. 10 .... 0 1011 . . 0 .... @2misc | ||
27 | |||
28 | VCVT_F16_F32 1111 001 11 . 11 .. 10 .... 0 1100 0 . 0 .... @2misc_q0 | ||
24 | + | 29 | + |
25 | +VAND_3s 1111 001 0 0 . 00 .... .... 0001 ... 1 .... @3same_logic | 30 | + VRINTM 1111 001 11 . 11 .. 10 .... 0 1101 . . 0 .... @2misc |
26 | +VBIC_3s 1111 001 0 0 . 01 .... .... 0001 ... 1 .... @3same_logic | ||
27 | +VORR_3s 1111 001 0 0 . 10 .... .... 0001 ... 1 .... @3same_logic | ||
28 | +VORN_3s 1111 001 0 0 . 11 .... .... 0001 ... 1 .... @3same_logic | ||
29 | +VEOR_3s 1111 001 1 0 . 00 .... .... 0001 ... 1 .... @3same_logic | ||
30 | +VBSL_3s 1111 001 1 0 . 01 .... .... 0001 ... 1 .... @3same_logic | ||
31 | +VBIT_3s 1111 001 1 0 . 10 .... .... 0001 ... 1 .... @3same_logic | ||
32 | +VBIF_3s 1111 001 1 0 . 11 .... .... 0001 ... 1 .... @3same_logic | ||
33 | + | 31 | + |
34 | VADD_3s 1111 001 0 0 . .. .... .... 1000 . . . 0 .... @3same | 32 | VCVT_F32_F16 1111 001 11 . 11 .. 10 .... 0 1110 0 . 0 .... @2misc_q0 |
35 | VSUB_3s 1111 001 1 0 . .. .... .... 1000 . . . 0 .... @3same | 33 | |
34 | + VRINTP 1111 001 11 . 11 .. 10 .... 0 1111 . . 0 .... @2misc | ||
35 | + | ||
36 | VRECPE 1111 001 11 . 11 .. 11 .... 0 1000 . . 0 .... @2misc | ||
37 | VRSQRTE 1111 001 11 . 11 .. 11 .... 0 1001 . . 0 .... @2misc | ||
38 | VRECPE_F 1111 001 11 . 11 .. 11 .... 0 1010 . . 0 .... @2misc | ||
36 | diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c | 39 | diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c |
37 | index XXXXXXX..XXXXXXX 100644 | 40 | index XXXXXXX..XXXXXXX 100644 |
38 | --- a/target/arm/translate-neon.inc.c | 41 | --- a/target/arm/translate-neon.inc.c |
39 | +++ b/target/arm/translate-neon.inc.c | 42 | +++ b/target/arm/translate-neon.inc.c |
40 | @@ -XXX,XX +XXX,XX @@ static bool do_3same(DisasContext *s, arg_3same *a, GVecGen3Fn fn) | 43 | @@ -XXX,XX +XXX,XX @@ DO_FP_CMP0(VCGE0_F, gen_helper_neon_cge_f32, FWD) |
41 | 44 | DO_FP_CMP0(VCEQ0_F, gen_helper_neon_ceq_f32, FWD) | |
42 | DO_3SAME(VADD, tcg_gen_gvec_add) | 45 | DO_FP_CMP0(VCLE0_F, gen_helper_neon_cge_f32, REV) |
43 | DO_3SAME(VSUB, tcg_gen_gvec_sub) | 46 | DO_FP_CMP0(VCLT0_F, gen_helper_neon_cgt_f32, REV) |
44 | +DO_3SAME(VAND, tcg_gen_gvec_and) | ||
45 | +DO_3SAME(VBIC, tcg_gen_gvec_andc) | ||
46 | +DO_3SAME(VORR, tcg_gen_gvec_or) | ||
47 | +DO_3SAME(VORN, tcg_gen_gvec_orc) | ||
48 | +DO_3SAME(VEOR, tcg_gen_gvec_xor) | ||
49 | + | 47 | + |
50 | +/* These insns are all gvec_bitsel but with the inputs in various orders. */ | 48 | +static bool do_vrint(DisasContext *s, arg_2misc *a, int rmode) |
51 | +#define DO_3SAME_BITSEL(INSN, O1, O2, O3) \ | 49 | +{ |
52 | + static void gen_##INSN##_3s(unsigned vece, uint32_t rd_ofs, \ | 50 | + /* |
53 | + uint32_t rn_ofs, uint32_t rm_ofs, \ | 51 | + * Handle a VRINT* operation by iterating 32 bits at a time, |
54 | + uint32_t oprsz, uint32_t maxsz) \ | 52 | + * with a specified rounding mode in operation. |
55 | + { \ | 53 | + */ |
56 | + tcg_gen_gvec_bitsel(vece, rd_ofs, O1, O2, O3, oprsz, maxsz); \ | 54 | + int pass; |
57 | + } \ | 55 | + TCGv_ptr fpst; |
58 | + DO_3SAME(INSN, gen_##INSN##_3s) | 56 | + TCGv_i32 tcg_rmode; |
59 | + | 57 | + |
60 | +DO_3SAME_BITSEL(VBSL, rd_ofs, rn_ofs, rm_ofs) | 58 | + if (!arm_dc_feature(s, ARM_FEATURE_NEON) || |
61 | +DO_3SAME_BITSEL(VBIT, rm_ofs, rn_ofs, rd_ofs) | 59 | + !arm_dc_feature(s, ARM_FEATURE_V8)) { |
62 | +DO_3SAME_BITSEL(VBIF, rm_ofs, rd_ofs, rn_ofs) | 60 | + return false; |
61 | + } | ||
62 | + | ||
63 | + /* UNDEF accesses to D16-D31 if they don't exist. */ | ||
64 | + if (!dc_isar_feature(aa32_simd_r32, s) && | ||
65 | + ((a->vd | a->vm) & 0x10)) { | ||
66 | + return false; | ||
67 | + } | ||
68 | + | ||
69 | + if (a->size != 2) { | ||
70 | + /* TODO: FP16 will be the size == 1 case */ | ||
71 | + return false; | ||
72 | + } | ||
73 | + | ||
74 | + if ((a->vd | a->vm) & a->q) { | ||
75 | + return false; | ||
76 | + } | ||
77 | + | ||
78 | + if (!vfp_access_check(s)) { | ||
79 | + return true; | ||
80 | + } | ||
81 | + | ||
82 | + fpst = get_fpstatus_ptr(1); | ||
83 | + tcg_rmode = tcg_const_i32(arm_rmode_to_sf(rmode)); | ||
84 | + gen_helper_set_neon_rmode(tcg_rmode, tcg_rmode, cpu_env); | ||
85 | + for (pass = 0; pass < (a->q ? 4 : 2); pass++) { | ||
86 | + TCGv_i32 tmp = neon_load_reg(a->vm, pass); | ||
87 | + gen_helper_rints(tmp, tmp, fpst); | ||
88 | + neon_store_reg(a->vd, pass, tmp); | ||
89 | + } | ||
90 | + gen_helper_set_neon_rmode(tcg_rmode, tcg_rmode, cpu_env); | ||
91 | + tcg_temp_free_i32(tcg_rmode); | ||
92 | + tcg_temp_free_ptr(fpst); | ||
93 | + | ||
94 | + return true; | ||
95 | +} | ||
96 | + | ||
97 | +#define DO_VRINT(INSN, RMODE) \ | ||
98 | + static bool trans_##INSN(DisasContext *s, arg_2misc *a) \ | ||
99 | + { \ | ||
100 | + return do_vrint(s, a, RMODE); \ | ||
101 | + } | ||
102 | + | ||
103 | +DO_VRINT(VRINTN, FPROUNDING_TIEEVEN) | ||
104 | +DO_VRINT(VRINTA, FPROUNDING_TIEAWAY) | ||
105 | +DO_VRINT(VRINTZ, FPROUNDING_ZERO) | ||
106 | +DO_VRINT(VRINTM, FPROUNDING_NEGINF) | ||
107 | +DO_VRINT(VRINTP, FPROUNDING_POSINF) | ||
63 | diff --git a/target/arm/translate.c b/target/arm/translate.c | 108 | diff --git a/target/arm/translate.c b/target/arm/translate.c |
64 | index XXXXXXX..XXXXXXX 100644 | 109 | index XXXXXXX..XXXXXXX 100644 |
65 | --- a/target/arm/translate.c | 110 | --- a/target/arm/translate.c |
66 | +++ b/target/arm/translate.c | 111 | +++ b/target/arm/translate.c |
67 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) | 112 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) |
68 | } | 113 | case NEON_2RM_VCEQ0_F: |
69 | return 1; | 114 | case NEON_2RM_VCLE0_F: |
70 | 115 | case NEON_2RM_VCLT0_F: | |
71 | - case NEON_3R_LOGIC: /* Logic ops. */ | 116 | + case NEON_2RM_VRINTN: |
72 | - switch ((u << 2) | size) { | 117 | + case NEON_2RM_VRINTA: |
73 | - case 0: /* VAND */ | 118 | + case NEON_2RM_VRINTM: |
74 | - tcg_gen_gvec_and(0, rd_ofs, rn_ofs, rm_ofs, | 119 | + case NEON_2RM_VRINTP: |
75 | - vec_size, vec_size); | 120 | + case NEON_2RM_VRINTZ: |
76 | - break; | 121 | /* handled by decodetree */ |
77 | - case 1: /* VBIC */ | 122 | return 1; |
78 | - tcg_gen_gvec_andc(0, rd_ofs, rn_ofs, rm_ofs, | 123 | case NEON_2RM_VTRN: |
79 | - vec_size, vec_size); | 124 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) |
80 | - break; | 125 | } |
81 | - case 2: /* VORR */ | 126 | neon_store_reg(rm, pass, tmp2); |
82 | - tcg_gen_gvec_or(0, rd_ofs, rn_ofs, rm_ofs, | 127 | break; |
83 | - vec_size, vec_size); | 128 | - case NEON_2RM_VRINTN: |
84 | - break; | 129 | - case NEON_2RM_VRINTA: |
85 | - case 3: /* VORN */ | 130 | - case NEON_2RM_VRINTM: |
86 | - tcg_gen_gvec_orc(0, rd_ofs, rn_ofs, rm_ofs, | 131 | - case NEON_2RM_VRINTP: |
87 | - vec_size, vec_size); | 132 | - case NEON_2RM_VRINTZ: |
88 | - break; | 133 | - { |
89 | - case 4: /* VEOR */ | 134 | - TCGv_i32 tcg_rmode; |
90 | - tcg_gen_gvec_xor(0, rd_ofs, rn_ofs, rm_ofs, | 135 | - TCGv_ptr fpstatus = get_fpstatus_ptr(1); |
91 | - vec_size, vec_size); | 136 | - int rmode; |
92 | - break; | ||
93 | - case 5: /* VBSL */ | ||
94 | - tcg_gen_gvec_bitsel(MO_8, rd_ofs, rd_ofs, rn_ofs, rm_ofs, | ||
95 | - vec_size, vec_size); | ||
96 | - break; | ||
97 | - case 6: /* VBIT */ | ||
98 | - tcg_gen_gvec_bitsel(MO_8, rd_ofs, rm_ofs, rn_ofs, rd_ofs, | ||
99 | - vec_size, vec_size); | ||
100 | - break; | ||
101 | - case 7: /* VBIF */ | ||
102 | - tcg_gen_gvec_bitsel(MO_8, rd_ofs, rm_ofs, rd_ofs, rn_ofs, | ||
103 | - vec_size, vec_size); | ||
104 | - break; | ||
105 | - } | ||
106 | - return 0; | ||
107 | - | 137 | - |
108 | case NEON_3R_VQADD: | 138 | - if (op == NEON_2RM_VRINTZ) { |
109 | tcg_gen_gvec_4(rd_ofs, offsetof(CPUARMState, vfp.qc), | 139 | - rmode = FPROUNDING_ZERO; |
110 | rn_ofs, rm_ofs, vec_size, vec_size, | 140 | - } else { |
111 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) | 141 | - rmode = fp_decode_rm[((op & 0x6) >> 1) ^ 1]; |
112 | return 0; | 142 | - } |
113 | 143 | - | |
114 | case NEON_3R_VADD_VSUB: | 144 | - tcg_rmode = tcg_const_i32(arm_rmode_to_sf(rmode)); |
115 | + case NEON_3R_LOGIC: | 145 | - gen_helper_set_neon_rmode(tcg_rmode, tcg_rmode, |
116 | /* Already handled by decodetree */ | 146 | - cpu_env); |
117 | return 1; | 147 | - gen_helper_rints(tmp, tmp, fpstatus); |
118 | } | 148 | - gen_helper_set_neon_rmode(tcg_rmode, tcg_rmode, |
149 | - cpu_env); | ||
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: | ||
119 | -- | 157 | -- |
120 | 2.20.1 | 158 | 2.20.1 |
121 | 159 | ||
122 | 160 | diff view generated by jsdifflib |
1 | Convert the VCMLA (vector) insns in the 3same extension group to | 1 | Convert the VCVT instructions in the 2-reg-misc grouping to |
---|---|---|---|
2 | decodetree. | 2 | 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: Richard Henderson <richard.henderson@linaro.org> | 5 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
6 | Message-id: 20200430181003.21682-5-peter.maydell@linaro.org | 6 | Message-id: 20200616170844.13318-19-peter.maydell@linaro.org |
7 | --- | 7 | --- |
8 | target/arm/neon-shared.decode | 11 ++++++++++ | 8 | target/arm/neon-dp.decode | 9 +++++ |
9 | target/arm/translate-neon.inc.c | 37 +++++++++++++++++++++++++++++++++ | 9 | target/arm/translate-neon.inc.c | 70 +++++++++++++++++++++++++++++++++ |
10 | target/arm/translate.c | 11 +--------- | 10 | target/arm/translate.c | 70 ++++----------------------------- |
11 | 3 files changed, 49 insertions(+), 10 deletions(-) | 11 | 3 files changed, 87 insertions(+), 62 deletions(-) |
12 | 12 | ||
13 | diff --git a/target/arm/neon-shared.decode b/target/arm/neon-shared.decode | 13 | diff --git a/target/arm/neon-dp.decode b/target/arm/neon-dp.decode |
14 | index XXXXXXX..XXXXXXX 100644 | 14 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/target/arm/neon-shared.decode | 15 | --- a/target/arm/neon-dp.decode |
16 | +++ b/target/arm/neon-shared.decode | 16 | +++ b/target/arm/neon-dp.decode |
17 | @@ -XXX,XX +XXX,XX @@ | 17 | @@ -XXX,XX +XXX,XX @@ Vimm_1r 1111 001 . 1 . 000 ... .... cmode:4 0 . op:1 1 .... @1reg_imm |
18 | # More specifically, this covers: | 18 | |
19 | # 2reg scalar ext: 0b1111_1110_xxxx_xxxx_xxxx_1x0x_xxxx_xxxx | 19 | VRINTP 1111 001 11 . 11 .. 10 .... 0 1111 . . 0 .... @2misc |
20 | # 3same ext: 0b1111_110x_xxxx_xxxx_xxxx_1x0x_xxxx_xxxx | 20 | |
21 | + | 21 | + VCVTAS 1111 001 11 . 11 .. 11 .... 0 0000 . . 0 .... @2misc |
22 | +# VFP/Neon register fields; same as vfp.decode | 22 | + VCVTAU 1111 001 11 . 11 .. 11 .... 0 0001 . . 0 .... @2misc |
23 | +%vm_dp 5:1 0:4 | 23 | + VCVTNS 1111 001 11 . 11 .. 11 .... 0 0010 . . 0 .... @2misc |
24 | +%vm_sp 0:4 5:1 | 24 | + VCVTNU 1111 001 11 . 11 .. 11 .... 0 0011 . . 0 .... @2misc |
25 | +%vn_dp 7:1 16:4 | 25 | + VCVTPS 1111 001 11 . 11 .. 11 .... 0 0100 . . 0 .... @2misc |
26 | +%vn_sp 16:4 7:1 | 26 | + VCVTPU 1111 001 11 . 11 .. 11 .... 0 0101 . . 0 .... @2misc |
27 | +%vd_dp 22:1 12:4 | 27 | + VCVTMS 1111 001 11 . 11 .. 11 .... 0 0110 . . 0 .... @2misc |
28 | +%vd_sp 12:4 22:1 | 28 | + VCVTMU 1111 001 11 . 11 .. 11 .... 0 0111 . . 0 .... @2misc |
29 | + | 29 | + |
30 | +VCMLA 1111 110 rot:2 . 1 size:1 .... .... 1000 . q:1 . 0 .... \ | 30 | VRECPE 1111 001 11 . 11 .. 11 .... 0 1000 . . 0 .... @2misc |
31 | + vm=%vm_dp vn=%vn_dp vd=%vd_dp | 31 | VRSQRTE 1111 001 11 . 11 .. 11 .... 0 1001 . . 0 .... @2misc |
32 | VRECPE_F 1111 001 11 . 11 .. 11 .... 0 1010 . . 0 .... @2misc | ||
32 | diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c | 33 | diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c |
33 | index XXXXXXX..XXXXXXX 100644 | 34 | index XXXXXXX..XXXXXXX 100644 |
34 | --- a/target/arm/translate-neon.inc.c | 35 | --- a/target/arm/translate-neon.inc.c |
35 | +++ b/target/arm/translate-neon.inc.c | 36 | +++ b/target/arm/translate-neon.inc.c |
36 | @@ -XXX,XX +XXX,XX @@ | 37 | @@ -XXX,XX +XXX,XX @@ DO_VRINT(VRINTA, FPROUNDING_TIEAWAY) |
37 | #include "decode-neon-dp.inc.c" | 38 | DO_VRINT(VRINTZ, FPROUNDING_ZERO) |
38 | #include "decode-neon-ls.inc.c" | 39 | DO_VRINT(VRINTM, FPROUNDING_NEGINF) |
39 | #include "decode-neon-shared.inc.c" | 40 | DO_VRINT(VRINTP, FPROUNDING_POSINF) |
40 | + | 41 | + |
41 | +static bool trans_VCMLA(DisasContext *s, arg_VCMLA *a) | 42 | +static bool do_vcvt(DisasContext *s, arg_2misc *a, int rmode, bool is_signed) |
42 | +{ | 43 | +{ |
43 | + int opr_sz; | 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; | ||
44 | + TCGv_ptr fpst; | 49 | + TCGv_ptr fpst; |
45 | + gen_helper_gvec_3_ptr *fn_gvec_ptr; | 50 | + TCGv_i32 tcg_rmode, tcg_shift; |
46 | + | 51 | + |
47 | + if (!dc_isar_feature(aa32_vcma, s) | 52 | + if (!arm_dc_feature(s, ARM_FEATURE_NEON) || |
48 | + || (!a->size && !dc_isar_feature(aa32_fp16_arith, s))) { | 53 | + !arm_dc_feature(s, ARM_FEATURE_V8)) { |
49 | + return false; | 54 | + return false; |
50 | + } | 55 | + } |
51 | + | 56 | + |
52 | + /* UNDEF accesses to D16-D31 if they don't exist. */ | 57 | + /* UNDEF accesses to D16-D31 if they don't exist. */ |
53 | + if (!dc_isar_feature(aa32_simd_r32, s) && | 58 | + if (!dc_isar_feature(aa32_simd_r32, s) && |
54 | + ((a->vd | a->vn | a->vm) & 0x10)) { | 59 | + ((a->vd | a->vm) & 0x10)) { |
55 | + return false; | 60 | + return false; |
56 | + } | 61 | + } |
57 | + | 62 | + |
58 | + if ((a->vn | a->vm | a->vd) & a->q) { | 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) { | ||
59 | + return false; | 69 | + return false; |
60 | + } | 70 | + } |
61 | + | 71 | + |
62 | + if (!vfp_access_check(s)) { | 72 | + if (!vfp_access_check(s)) { |
63 | + return true; | 73 | + return true; |
64 | + } | 74 | + } |
65 | + | 75 | + |
66 | + opr_sz = (1 + a->q) * 8; | ||
67 | + fpst = get_fpstatus_ptr(1); | 76 | + fpst = get_fpstatus_ptr(1); |
68 | + fn_gvec_ptr = a->size ? gen_helper_gvec_fcmlas : gen_helper_gvec_fcmlah; | 77 | + tcg_shift = tcg_const_i32(0); |
69 | + tcg_gen_gvec_3_ptr(vfp_reg_offset(1, a->vd), | 78 | + tcg_rmode = tcg_const_i32(arm_rmode_to_sf(rmode)); |
70 | + vfp_reg_offset(1, a->vn), | 79 | + gen_helper_set_neon_rmode(tcg_rmode, tcg_rmode, cpu_env); |
71 | + vfp_reg_offset(1, a->vm), | 80 | + for (pass = 0; pass < (a->q ? 4 : 2); pass++) { |
72 | + fpst, opr_sz, opr_sz, a->rot, | 81 | + TCGv_i32 tmp = neon_load_reg(a->vm, pass); |
73 | + fn_gvec_ptr); | 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); | ||
74 | + tcg_temp_free_ptr(fpst); | 92 | + tcg_temp_free_ptr(fpst); |
93 | + | ||
75 | + return true; | 94 | + return true; |
76 | +} | 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) | ||
77 | diff --git a/target/arm/translate.c b/target/arm/translate.c | 111 | diff --git a/target/arm/translate.c b/target/arm/translate.c |
78 | index XXXXXXX..XXXXXXX 100644 | 112 | index XXXXXXX..XXXXXXX 100644 |
79 | --- a/target/arm/translate.c | 113 | --- a/target/arm/translate.c |
80 | +++ b/target/arm/translate.c | 114 | +++ b/target/arm/translate.c |
81 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_insn_3same_ext(DisasContext *s, uint32_t insn) | 115 | @@ -XXX,XX +XXX,XX @@ static void gen_neon_trn_u16(TCGv_i32 t0, TCGv_i32 t1) |
82 | bool is_long = false, q = extract32(insn, 6, 1); | 116 | #define NEON_2RM_VCVT_SF 62 |
83 | bool ptr_is_env = false; | 117 | #define NEON_2RM_VCVT_UF 63 |
84 | 118 | ||
85 | - if ((insn & 0xfe200f10) == 0xfc200800) { | 119 | -static bool neon_2rm_is_v8_op(int op) |
86 | - /* VCMLA -- 1111 110R R.1S .... .... 1000 ...0 .... */ | 120 | -{ |
87 | - int size = extract32(insn, 20, 1); | 121 | - /* Return true if this neon 2reg-misc op is ARMv8 and up */ |
88 | - data = extract32(insn, 23, 2); /* rot */ | 122 | - switch (op) { |
89 | - if (!dc_isar_feature(aa32_vcma, s) | 123 | - case NEON_2RM_VRINTN: |
90 | - || (!size && !dc_isar_feature(aa32_fp16_arith, s))) { | 124 | - case NEON_2RM_VRINTA: |
91 | - return 1; | 125 | - case NEON_2RM_VRINTM: |
92 | - } | 126 | - case NEON_2RM_VRINTP: |
93 | - fn_gvec_ptr = size ? gen_helper_gvec_fcmlas : gen_helper_gvec_fcmlah; | 127 | - case NEON_2RM_VRINTZ: |
94 | - } else if ((insn & 0xfea00f10) == 0xfc800800) { | 128 | - case NEON_2RM_VRINTX: |
95 | + if ((insn & 0xfea00f10) == 0xfc800800) { | 129 | - case NEON_2RM_VCVTAU: |
96 | /* VCADD -- 1111 110R 1.0S .... .... 1000 ...0 .... */ | 130 | - case NEON_2RM_VCVTAS: |
97 | int size = extract32(insn, 20, 1); | 131 | - case NEON_2RM_VCVTNU: |
98 | data = extract32(insn, 24, 1); /* rot */ | 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. | ||
99 | -- | 213 | -- |
100 | 2.20.1 | 214 | 2.20.1 |
101 | 215 | ||
102 | 216 | diff view generated by jsdifflib |
1 | Convert the Neon "load single structure to all lanes" insns to | 1 | Convert the Neon VSWP insn to decodetree. Since the new implementation |
---|---|---|---|
2 | decodetree. | 2 | doesn't have to share a pass-loop with the other 2-reg-misc operations |
3 | we can implement the swap with 64-bit accesses rather than 32-bits | ||
4 | (which brings us into line with the pseudocode and is more efficient). | ||
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 | Message-id: 20200430181003.21682-13-peter.maydell@linaro.org | 8 | Message-id: 20200616170844.13318-20-peter.maydell@linaro.org |
7 | --- | 9 | --- |
8 | target/arm/neon-ls.decode | 5 +++ | 10 | target/arm/neon-dp.decode | 2 ++ |
9 | target/arm/translate-neon.inc.c | 73 +++++++++++++++++++++++++++++++++ | 11 | target/arm/translate-neon.inc.c | 41 +++++++++++++++++++++++++++++++++ |
10 | target/arm/translate.c | 55 +------------------------ | 12 | target/arm/translate.c | 5 +--- |
11 | 3 files changed, 80 insertions(+), 53 deletions(-) | 13 | 3 files changed, 44 insertions(+), 4 deletions(-) |
12 | 14 | ||
13 | diff --git a/target/arm/neon-ls.decode b/target/arm/neon-ls.decode | 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/target/arm/neon-ls.decode | 17 | --- a/target/arm/neon-dp.decode |
16 | +++ b/target/arm/neon-ls.decode | 18 | +++ b/target/arm/neon-dp.decode |
17 | @@ -XXX,XX +XXX,XX @@ | 19 | @@ -XXX,XX +XXX,XX @@ Vimm_1r 1111 001 . 1 . 000 ... .... cmode:4 0 . op:1 1 .... @1reg_imm |
18 | 20 | VABS_F 1111 001 11 . 11 .. 01 .... 0 1110 . . 0 .... @2misc | |
19 | VLDST_multiple 1111 0100 0 . l:1 0 rn:4 .... itype:4 size:2 align:2 rm:4 \ | 21 | VNEG_F 1111 001 11 . 11 .. 01 .... 0 1111 . . 0 .... @2misc |
20 | vd=%vd_dp | 22 | |
23 | + VSWP 1111 001 11 . 11 .. 10 .... 0 0000 . . 0 .... @2misc | ||
21 | + | 24 | + |
22 | +# Neon load single element to all lanes | 25 | VUZP 1111 001 11 . 11 .. 10 .... 0 0010 . . 0 .... @2misc |
23 | + | 26 | VZIP 1111 001 11 . 11 .. 10 .... 0 0011 . . 0 .... @2misc |
24 | +VLD_all_lanes 1111 0100 1 . 1 0 rn:4 .... 11 n:2 size:2 t:1 a:1 rm:4 \ | 27 | |
25 | + vd=%vd_dp | ||
26 | diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c | 28 | diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c |
27 | index XXXXXXX..XXXXXXX 100644 | 29 | index XXXXXXX..XXXXXXX 100644 |
28 | --- a/target/arm/translate-neon.inc.c | 30 | --- a/target/arm/translate-neon.inc.c |
29 | +++ b/target/arm/translate-neon.inc.c | 31 | +++ b/target/arm/translate-neon.inc.c |
30 | @@ -XXX,XX +XXX,XX @@ static bool trans_VLDST_multiple(DisasContext *s, arg_VLDST_multiple *a) | 32 | @@ -XXX,XX +XXX,XX @@ DO_VCVT(VCVTPU, FPROUNDING_POSINF, false) |
31 | gen_neon_ldst_base_update(s, a->rm, a->rn, nregs * interleave * 8); | 33 | DO_VCVT(VCVTPS, FPROUNDING_POSINF, true) |
32 | return true; | 34 | DO_VCVT(VCVTMU, FPROUNDING_NEGINF, false) |
33 | } | 35 | DO_VCVT(VCVTMS, FPROUNDING_NEGINF, true) |
34 | + | 36 | + |
35 | +static bool trans_VLD_all_lanes(DisasContext *s, arg_VLD_all_lanes *a) | 37 | +static bool trans_VSWP(DisasContext *s, arg_2misc *a) |
36 | +{ | 38 | +{ |
37 | + /* Neon load single structure to all lanes */ | 39 | + TCGv_i64 rm, rd; |
38 | + int reg, stride, vec_size; | 40 | + int pass; |
39 | + int vd = a->vd; | ||
40 | + int size = a->size; | ||
41 | + int nregs = a->n + 1; | ||
42 | + TCGv_i32 addr, tmp; | ||
43 | + | 41 | + |
44 | + if (!arm_dc_feature(s, ARM_FEATURE_NEON)) { | 42 | + if (!arm_dc_feature(s, ARM_FEATURE_NEON)) { |
45 | + return false; | 43 | + return false; |
46 | + } | 44 | + } |
47 | + | 45 | + |
48 | + /* UNDEF accesses to D16-D31 if they don't exist */ | 46 | + /* UNDEF accesses to D16-D31 if they don't exist. */ |
49 | + if (!dc_isar_feature(aa32_simd_r32, s) && (a->vd & 0x10)) { | 47 | + if (!dc_isar_feature(aa32_simd_r32, s) && |
48 | + ((a->vd | a->vm) & 0x10)) { | ||
50 | + return false; | 49 | + return false; |
51 | + } | 50 | + } |
52 | + | 51 | + |
53 | + if (size == 3) { | 52 | + if (a->size != 0) { |
54 | + if (nregs != 4 || a->a == 0) { | ||
55 | + return false; | ||
56 | + } | ||
57 | + /* For VLD4 size == 3 a == 1 means 32 bits at 16 byte alignment */ | ||
58 | + size = 2; | ||
59 | + } | ||
60 | + if (nregs == 1 && a->a == 1 && size == 0) { | ||
61 | + return false; | 53 | + return false; |
62 | + } | 54 | + } |
63 | + if (nregs == 3 && a->a == 1) { | 55 | + |
56 | + if ((a->vd | a->vm) & a->q) { | ||
64 | + return false; | 57 | + return false; |
65 | + } | 58 | + } |
66 | + | 59 | + |
67 | + if (!vfp_access_check(s)) { | 60 | + if (!vfp_access_check(s)) { |
68 | + return true; | 61 | + return true; |
69 | + } | 62 | + } |
70 | + | 63 | + |
71 | + /* | 64 | + rm = tcg_temp_new_i64(); |
72 | + * VLD1 to all lanes: T bit indicates how many Dregs to write. | 65 | + rd = tcg_temp_new_i64(); |
73 | + * VLD2/3/4 to all lanes: T bit indicates register stride. | 66 | + for (pass = 0; pass < (a->q ? 2 : 1); pass++) { |
74 | + */ | 67 | + neon_load_reg64(rm, a->vm + pass); |
75 | + stride = a->t ? 2 : 1; | 68 | + neon_load_reg64(rd, a->vd + pass); |
76 | + vec_size = nregs == 1 ? stride * 8 : 8; | 69 | + neon_store_reg64(rm, a->vd + pass); |
77 | + | 70 | + neon_store_reg64(rd, a->vm + pass); |
78 | + tmp = tcg_temp_new_i32(); | ||
79 | + addr = tcg_temp_new_i32(); | ||
80 | + load_reg_var(s, addr, a->rn); | ||
81 | + for (reg = 0; reg < nregs; reg++) { | ||
82 | + gen_aa32_ld_i32(s, tmp, addr, get_mem_index(s), | ||
83 | + s->be_data | size); | ||
84 | + if ((vd & 1) && vec_size == 16) { | ||
85 | + /* | ||
86 | + * We cannot write 16 bytes at once because the | ||
87 | + * destination is unaligned. | ||
88 | + */ | ||
89 | + tcg_gen_gvec_dup_i32(size, neon_reg_offset(vd, 0), | ||
90 | + 8, 8, tmp); | ||
91 | + tcg_gen_gvec_mov(0, neon_reg_offset(vd + 1, 0), | ||
92 | + neon_reg_offset(vd, 0), 8, 8); | ||
93 | + } else { | ||
94 | + tcg_gen_gvec_dup_i32(size, neon_reg_offset(vd, 0), | ||
95 | + vec_size, vec_size, tmp); | ||
96 | + } | ||
97 | + tcg_gen_addi_i32(addr, addr, 1 << size); | ||
98 | + vd += stride; | ||
99 | + } | 71 | + } |
100 | + tcg_temp_free_i32(tmp); | 72 | + tcg_temp_free_i64(rm); |
101 | + tcg_temp_free_i32(addr); | 73 | + tcg_temp_free_i64(rd); |
102 | + | ||
103 | + gen_neon_ldst_base_update(s, a->rm, a->rn, (1 << size) * nregs); | ||
104 | + | 74 | + |
105 | + return true; | 75 | + return true; |
106 | +} | 76 | +} |
107 | diff --git a/target/arm/translate.c b/target/arm/translate.c | 77 | diff --git a/target/arm/translate.c b/target/arm/translate.c |
108 | index XXXXXXX..XXXXXXX 100644 | 78 | index XXXXXXX..XXXXXXX 100644 |
109 | --- a/target/arm/translate.c | 79 | --- a/target/arm/translate.c |
110 | +++ b/target/arm/translate.c | 80 | +++ b/target/arm/translate.c |
111 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_ls_insn(DisasContext *s, uint32_t insn) | 81 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) |
112 | int size; | 82 | case NEON_2RM_VCVTPS: |
113 | int reg; | 83 | case NEON_2RM_VCVTMU: |
114 | int load; | 84 | case NEON_2RM_VCVTMS: |
115 | - int vec_size; | 85 | + case NEON_2RM_VSWP: |
116 | TCGv_i32 addr; | 86 | /* handled by decodetree */ |
117 | TCGv_i32 tmp; | 87 | return 1; |
118 | 88 | case NEON_2RM_VTRN: | |
119 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_ls_insn(DisasContext *s, uint32_t insn) | 89 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) |
120 | } else { | 90 | for (pass = 0; pass < (q ? 4 : 2); pass++) { |
121 | size = (insn >> 10) & 3; | 91 | tmp = neon_load_reg(rm, pass); |
122 | if (size == 3) { | 92 | switch (op) { |
123 | - /* Load single element to all lanes. */ | 93 | - case NEON_2RM_VSWP: |
124 | - int a = (insn >> 4) & 1; | 94 | - tmp2 = neon_load_reg(rd, pass); |
125 | - if (!load) { | 95 | - neon_store_reg(rm, pass, tmp2); |
126 | - return 1; | 96 | - break; |
127 | - } | 97 | case NEON_2RM_VTRN: |
128 | - size = (insn >> 6) & 3; | 98 | tmp2 = neon_load_reg(rd, pass); |
129 | - nregs = ((insn >> 8) & 3) + 1; | 99 | switch (size) { |
130 | - | ||
131 | - if (size == 3) { | ||
132 | - if (nregs != 4 || a == 0) { | ||
133 | - return 1; | ||
134 | - } | ||
135 | - /* For VLD4 size==3 a == 1 means 32 bits at 16 byte alignment */ | ||
136 | - size = 2; | ||
137 | - } | ||
138 | - if (nregs == 1 && a == 1 && size == 0) { | ||
139 | - return 1; | ||
140 | - } | ||
141 | - if (nregs == 3 && a == 1) { | ||
142 | - return 1; | ||
143 | - } | ||
144 | - addr = tcg_temp_new_i32(); | ||
145 | - load_reg_var(s, addr, rn); | ||
146 | - | ||
147 | - /* VLD1 to all lanes: bit 5 indicates how many Dregs to write. | ||
148 | - * VLD2/3/4 to all lanes: bit 5 indicates register stride. | ||
149 | - */ | ||
150 | - stride = (insn & (1 << 5)) ? 2 : 1; | ||
151 | - vec_size = nregs == 1 ? stride * 8 : 8; | ||
152 | - | ||
153 | - tmp = tcg_temp_new_i32(); | ||
154 | - for (reg = 0; reg < nregs; reg++) { | ||
155 | - gen_aa32_ld_i32(s, tmp, addr, get_mem_index(s), | ||
156 | - s->be_data | size); | ||
157 | - if ((rd & 1) && vec_size == 16) { | ||
158 | - /* We cannot write 16 bytes at once because the | ||
159 | - * destination is unaligned. | ||
160 | - */ | ||
161 | - tcg_gen_gvec_dup_i32(size, neon_reg_offset(rd, 0), | ||
162 | - 8, 8, tmp); | ||
163 | - tcg_gen_gvec_mov(0, neon_reg_offset(rd + 1, 0), | ||
164 | - neon_reg_offset(rd, 0), 8, 8); | ||
165 | - } else { | ||
166 | - tcg_gen_gvec_dup_i32(size, neon_reg_offset(rd, 0), | ||
167 | - vec_size, vec_size, tmp); | ||
168 | - } | ||
169 | - tcg_gen_addi_i32(addr, addr, 1 << size); | ||
170 | - rd += stride; | ||
171 | - } | ||
172 | - tcg_temp_free_i32(tmp); | ||
173 | - tcg_temp_free_i32(addr); | ||
174 | - stride = (1 << size) * nregs; | ||
175 | + /* Load single element to all lanes -- handled by decodetree */ | ||
176 | + return 1; | ||
177 | } else { | ||
178 | /* Single element. */ | ||
179 | int idx = (insn >> 4) & 0xf; | ||
180 | -- | 100 | -- |
181 | 2.20.1 | 101 | 2.20.1 |
182 | 102 | ||
183 | 103 | diff view generated by jsdifflib |
1 | Convert the Neon "load/store single structure to one lane" insns to | 1 | Convert the Neon VTRN insn to decodetree. This is the last insn in the |
---|---|---|---|
2 | decodetree. | 2 | Neon data-processing group, so we can remove all the now-unused old |
3 | decoder framework. | ||
3 | 4 | ||
4 | As this is the last set of insns in the neon load/store group, | 5 | It's possible that there's a more efficient implementation of |
5 | we can remove the whole disas_neon_ls_insn() function. | 6 | VTRN, but for this conversion we just copy the existing approach. |
6 | 7 | ||
7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
8 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 9 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
9 | Message-id: 20200430181003.21682-14-peter.maydell@linaro.org | 10 | Message-id: 20200616170844.13318-21-peter.maydell@linaro.org |
10 | --- | 11 | --- |
11 | target/arm/neon-ls.decode | 11 +++ | 12 | target/arm/neon-dp.decode | 2 +- |
12 | target/arm/translate-neon.inc.c | 89 +++++++++++++++++++ | 13 | target/arm/translate-neon.inc.c | 90 ++++++++ |
13 | target/arm/translate.c | 147 -------------------------------- | 14 | target/arm/translate.c | 363 +------------------------------- |
14 | 3 files changed, 100 insertions(+), 147 deletions(-) | 15 | 3 files changed, 93 insertions(+), 362 deletions(-) |
15 | 16 | ||
16 | diff --git a/target/arm/neon-ls.decode b/target/arm/neon-ls.decode | 17 | diff --git a/target/arm/neon-dp.decode b/target/arm/neon-dp.decode |
17 | index XXXXXXX..XXXXXXX 100644 | 18 | index XXXXXXX..XXXXXXX 100644 |
18 | --- a/target/arm/neon-ls.decode | 19 | --- a/target/arm/neon-dp.decode |
19 | +++ b/target/arm/neon-ls.decode | 20 | +++ b/target/arm/neon-dp.decode |
20 | @@ -XXX,XX +XXX,XX @@ VLDST_multiple 1111 0100 0 . l:1 0 rn:4 .... itype:4 size:2 align:2 rm:4 \ | 21 | @@ -XXX,XX +XXX,XX @@ Vimm_1r 1111 001 . 1 . 000 ... .... cmode:4 0 . op:1 1 .... @1reg_imm |
21 | 22 | VNEG_F 1111 001 11 . 11 .. 01 .... 0 1111 . . 0 .... @2misc | |
22 | VLD_all_lanes 1111 0100 1 . 1 0 rn:4 .... 11 n:2 size:2 t:1 a:1 rm:4 \ | 23 | |
23 | vd=%vd_dp | 24 | VSWP 1111 001 11 . 11 .. 10 .... 0 0000 . . 0 .... @2misc |
24 | + | 25 | - |
25 | +# Neon load/store single structure to one lane | 26 | + VTRN 1111 001 11 . 11 .. 10 .... 0 0001 . . 0 .... @2misc |
26 | +%imm1_5_p1 5:1 !function=plus1 | 27 | VUZP 1111 001 11 . 11 .. 10 .... 0 0010 . . 0 .... @2misc |
27 | +%imm1_6_p1 6:1 !function=plus1 | 28 | VZIP 1111 001 11 . 11 .. 10 .... 0 0011 . . 0 .... @2misc |
28 | + | 29 | |
29 | +VLDST_single 1111 0100 1 . l:1 0 rn:4 .... 00 n:2 reg_idx:3 align:1 rm:4 \ | ||
30 | + vd=%vd_dp size=0 stride=1 | ||
31 | +VLDST_single 1111 0100 1 . l:1 0 rn:4 .... 01 n:2 reg_idx:2 align:2 rm:4 \ | ||
32 | + vd=%vd_dp size=1 stride=%imm1_5_p1 | ||
33 | +VLDST_single 1111 0100 1 . l:1 0 rn:4 .... 10 n:2 reg_idx:1 align:3 rm:4 \ | ||
34 | + vd=%vd_dp size=2 stride=%imm1_6_p1 | ||
35 | diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c | 30 | diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c |
36 | index XXXXXXX..XXXXXXX 100644 | 31 | index XXXXXXX..XXXXXXX 100644 |
37 | --- a/target/arm/translate-neon.inc.c | 32 | --- a/target/arm/translate-neon.inc.c |
38 | +++ b/target/arm/translate-neon.inc.c | 33 | +++ b/target/arm/translate-neon.inc.c |
39 | @@ -XXX,XX +XXX,XX @@ | 34 | @@ -XXX,XX +XXX,XX @@ static bool trans_VSWP(DisasContext *s, arg_2misc *a) |
40 | * It might be possible to convert it to a standalone .c file eventually. | ||
41 | */ | ||
42 | |||
43 | +static inline int plus1(DisasContext *s, int x) | ||
44 | +{ | ||
45 | + return x + 1; | ||
46 | +} | ||
47 | + | ||
48 | /* Include the generated Neon decoder */ | ||
49 | #include "decode-neon-dp.inc.c" | ||
50 | #include "decode-neon-ls.inc.c" | ||
51 | @@ -XXX,XX +XXX,XX @@ static bool trans_VLD_all_lanes(DisasContext *s, arg_VLD_all_lanes *a) | ||
52 | 35 | ||
53 | return true; | 36 | return true; |
54 | } | 37 | } |
55 | + | 38 | +static void gen_neon_trn_u8(TCGv_i32 t0, TCGv_i32 t1) |
56 | +static bool trans_VLDST_single(DisasContext *s, arg_VLDST_single *a) | ||
57 | +{ | 39 | +{ |
58 | + /* Neon load/store single structure to one lane */ | 40 | + TCGv_i32 rd, tmp; |
59 | + int reg; | 41 | + |
60 | + int nregs = a->n + 1; | 42 | + rd = tcg_temp_new_i32(); |
61 | + int vd = a->vd; | 43 | + tmp = tcg_temp_new_i32(); |
62 | + TCGv_i32 addr, tmp; | 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; | ||
63 | + | 83 | + |
64 | + if (!arm_dc_feature(s, ARM_FEATURE_NEON)) { | 84 | + if (!arm_dc_feature(s, ARM_FEATURE_NEON)) { |
65 | + return false; | 85 | + return false; |
66 | + } | 86 | + } |
67 | + | 87 | + |
68 | + /* UNDEF accesses to D16-D31 if they don't exist */ | 88 | + /* UNDEF accesses to D16-D31 if they don't exist. */ |
69 | + if (!dc_isar_feature(aa32_simd_r32, s) && (a->vd & 0x10)) { | 89 | + if (!dc_isar_feature(aa32_simd_r32, s) && |
90 | + ((a->vd | a->vm) & 0x10)) { | ||
70 | + return false; | 91 | + return false; |
71 | + } | 92 | + } |
72 | + | 93 | + |
73 | + /* Catch the UNDEF cases. This is unavoidably a bit messy. */ | 94 | + if ((a->vd | a->vm) & a->q) { |
74 | + switch (nregs) { | 95 | + return false; |
75 | + case 1: | ||
76 | + if (((a->align & (1 << a->size)) != 0) || | ||
77 | + (a->size == 2 && ((a->align & 3) == 1 || (a->align & 3) == 2))) { | ||
78 | + return false; | ||
79 | + } | ||
80 | + break; | ||
81 | + case 3: | ||
82 | + if ((a->align & 1) != 0) { | ||
83 | + return false; | ||
84 | + } | ||
85 | + /* fall through */ | ||
86 | + case 2: | ||
87 | + if (a->size == 2 && (a->align & 2) != 0) { | ||
88 | + return false; | ||
89 | + } | ||
90 | + break; | ||
91 | + case 4: | ||
92 | + if ((a->size == 2) && ((a->align & 3) == 3)) { | ||
93 | + return false; | ||
94 | + } | ||
95 | + break; | ||
96 | + default: | ||
97 | + abort(); | ||
98 | + } | 96 | + } |
99 | + if ((vd + a->stride * (nregs - 1)) > 31) { | 97 | + |
100 | + /* | 98 | + if (a->size == 3) { |
101 | + * Attempts to write off the end of the register file are | ||
102 | + * UNPREDICTABLE; we choose to UNDEF because otherwise we would | ||
103 | + * access off the end of the array that holds the register data. | ||
104 | + */ | ||
105 | + return false; | 99 | + return false; |
106 | + } | 100 | + } |
107 | + | 101 | + |
108 | + if (!vfp_access_check(s)) { | 102 | + if (!vfp_access_check(s)) { |
109 | + return true; | 103 | + return true; |
110 | + } | 104 | + } |
111 | + | 105 | + |
112 | + tmp = tcg_temp_new_i32(); | 106 | + if (a->size == 2) { |
113 | + addr = tcg_temp_new_i32(); | 107 | + for (pass = 0; pass < (a->q ? 4 : 2); pass += 2) { |
114 | + load_reg_var(s, addr, a->rn); | 108 | + tmp = neon_load_reg(a->vm, pass); |
115 | + /* | 109 | + tmp2 = neon_load_reg(a->vd, pass + 1); |
116 | + * TODO: if we implemented alignment exceptions, we should check | 110 | + neon_store_reg(a->vm, pass, tmp2); |
117 | + * addr against the alignment encoded in a->align here. | 111 | + neon_store_reg(a->vd, pass + 1, tmp); |
118 | + */ | ||
119 | + for (reg = 0; reg < nregs; reg++) { | ||
120 | + if (a->l) { | ||
121 | + gen_aa32_ld_i32(s, tmp, addr, get_mem_index(s), | ||
122 | + s->be_data | a->size); | ||
123 | + neon_store_element(vd, a->reg_idx, a->size, tmp); | ||
124 | + } else { /* Store */ | ||
125 | + neon_load_element(tmp, vd, a->reg_idx, a->size); | ||
126 | + gen_aa32_st_i32(s, tmp, addr, get_mem_index(s), | ||
127 | + s->be_data | a->size); | ||
128 | + } | 112 | + } |
129 | + vd += a->stride; | 113 | + } else { |
130 | + tcg_gen_addi_i32(addr, addr, 1 << a->size); | 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 | + } | ||
131 | + } | 125 | + } |
132 | + tcg_temp_free_i32(addr); | ||
133 | + tcg_temp_free_i32(tmp); | ||
134 | + | ||
135 | + gen_neon_ldst_base_update(s, a->rm, a->rn, (1 << a->size) * nregs); | ||
136 | + | ||
137 | + return true; | 126 | + return true; |
138 | +} | 127 | +} |
139 | diff --git a/target/arm/translate.c b/target/arm/translate.c | 128 | diff --git a/target/arm/translate.c b/target/arm/translate.c |
140 | index XXXXXXX..XXXXXXX 100644 | 129 | index XXXXXXX..XXXXXXX 100644 |
141 | --- a/target/arm/translate.c | 130 | --- a/target/arm/translate.c |
142 | +++ b/target/arm/translate.c | 131 | +++ b/target/arm/translate.c |
143 | @@ -XXX,XX +XXX,XX @@ static void gen_neon_trn_u16(TCGv_i32 t0, TCGv_i32 t1) | 132 | @@ -XXX,XX +XXX,XX @@ static void gen_exception_return(DisasContext *s, TCGv_i32 pc) |
144 | tcg_temp_free_i32(rd); | 133 | gen_rfe(s, pc, load_cpu_field(spsr)); |
145 | } | 134 | } |
146 | 135 | ||
147 | - | 136 | -static void gen_neon_trn_u8(TCGv_i32 t0, TCGv_i32 t1) |
148 | -/* Translate a NEON load/store element instruction. Return nonzero if the | ||
149 | - instruction is invalid. */ | ||
150 | -static int disas_neon_ls_insn(DisasContext *s, uint32_t insn) | ||
151 | -{ | 137 | -{ |
152 | - int rd, rn, rm; | 138 | - TCGv_i32 rd, tmp; |
153 | - int nregs; | 139 | - |
154 | - int stride; | 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; | ||
155 | - int size; | 330 | - int size; |
156 | - int reg; | 331 | - int pass; |
157 | - int load; | 332 | - int u; |
158 | - TCGv_i32 addr; | 333 | - TCGv_i32 tmp, tmp2; |
159 | - TCGv_i32 tmp; | ||
160 | - | 334 | - |
161 | - if (!arm_dc_feature(s, ARM_FEATURE_NEON)) { | 335 | - if (!arm_dc_feature(s, ARM_FEATURE_NEON)) { |
162 | - return 1; | 336 | - return 1; |
163 | - } | 337 | - } |
164 | - | 338 | - |
... | ... | ||
172 | - return 0; | 346 | - return 0; |
173 | - } | 347 | - } |
174 | - | 348 | - |
175 | - if (!s->vfp_enabled) | 349 | - if (!s->vfp_enabled) |
176 | - return 1; | 350 | - return 1; |
351 | - q = (insn & (1 << 6)) != 0; | ||
352 | - u = (insn >> 24) & 1; | ||
177 | - VFP_DREG_D(rd, insn); | 353 | - VFP_DREG_D(rd, insn); |
178 | - rn = (insn >> 16) & 0xf; | 354 | - VFP_DREG_M(rm, insn); |
179 | - rm = insn & 0xf; | 355 | - size = (insn >> 20) & 3; |
180 | - load = (insn & (1 << 21)) != 0; | 356 | - |
181 | - if ((insn & (1 << 23)) == 0) { | 357 | - if ((insn & (1 << 23)) == 0) { |
182 | - /* Load store all elements -- handled already by decodetree */ | 358 | - /* Three register same length: handled by decodetree */ |
183 | - return 1; | 359 | - return 1; |
184 | - } else { | 360 | - } else if (insn & (1 << 4)) { |
185 | - size = (insn >> 10) & 3; | 361 | - /* Two registers and shift or reg and imm: handled by decodetree */ |
186 | - if (size == 3) { | 362 | - return 1; |
187 | - /* Load single element to all lanes -- handled by decodetree */ | 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 | - */ | ||
188 | - return 1; | 369 | - return 1; |
189 | - } else { | 370 | - } else { /* size == 3 */ |
190 | - /* Single element. */ | 371 | - if (!u) { |
191 | - int idx = (insn >> 4) & 0xf; | 372 | - /* Extract: handled by decodetree */ |
192 | - int reg_idx; | 373 | - return 1; |
193 | - switch (size) { | 374 | - } else if ((insn & (1 << 11)) == 0) { |
194 | - case 0: | 375 | - /* Two register misc. */ |
195 | - reg_idx = (insn >> 5) & 7; | 376 | - op = ((insn >> 12) & 0x30) | ((insn >> 7) & 0xf); |
196 | - stride = 1; | 377 | - size = (insn >> 18) & 3; |
197 | - break; | 378 | - /* UNDEF for unknown op values and bad op-size combinations */ |
198 | - case 1: | 379 | - if ((neon_2rm_sizes[op] & (1 << size)) == 0) { |
199 | - reg_idx = (insn >> 6) & 3; | ||
200 | - stride = (insn & (1 << 5)) ? 2 : 1; | ||
201 | - break; | ||
202 | - case 2: | ||
203 | - reg_idx = (insn >> 7) & 1; | ||
204 | - stride = (insn & (1 << 6)) ? 2 : 1; | ||
205 | - break; | ||
206 | - default: | ||
207 | - abort(); | ||
208 | - } | ||
209 | - nregs = ((insn >> 8) & 3) + 1; | ||
210 | - /* Catch the UNDEF cases. This is unavoidably a bit messy. */ | ||
211 | - switch (nregs) { | ||
212 | - case 1: | ||
213 | - if (((idx & (1 << size)) != 0) || | ||
214 | - (size == 2 && ((idx & 3) == 1 || (idx & 3) == 2))) { | ||
215 | - return 1; | 380 | - return 1; |
216 | - } | 381 | - } |
217 | - break; | 382 | - if (q && ((rm | rd) & 1)) { |
218 | - case 3: | ||
219 | - if ((idx & 1) != 0) { | ||
220 | - return 1; | 383 | - return 1; |
221 | - } | 384 | - } |
222 | - /* fall through */ | 385 | - switch (op) { |
223 | - case 2: | 386 | - case NEON_2RM_VREV64: |
224 | - if (size == 2 && (idx & 2) != 0) { | 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 */ | ||
225 | - return 1; | 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; | ||
226 | - } | 482 | - } |
227 | - break; | 483 | - } else { |
228 | - case 4: | 484 | - /* VTBL, VTBX, VDUP: handled by decodetree */ |
229 | - if ((size == 2) && ((idx & 3) == 3)) { | ||
230 | - return 1; | ||
231 | - } | ||
232 | - break; | ||
233 | - default: | ||
234 | - abort(); | ||
235 | - } | ||
236 | - if ((rd + stride * (nregs - 1)) > 31) { | ||
237 | - /* Attempts to write off the end of the register file | ||
238 | - * are UNPREDICTABLE; we choose to UNDEF because otherwise | ||
239 | - * the neon_load_reg() would write off the end of the array. | ||
240 | - */ | ||
241 | - return 1; | 485 | - return 1; |
242 | - } | 486 | - } |
243 | - tmp = tcg_temp_new_i32(); | ||
244 | - addr = tcg_temp_new_i32(); | ||
245 | - load_reg_var(s, addr, rn); | ||
246 | - for (reg = 0; reg < nregs; reg++) { | ||
247 | - if (load) { | ||
248 | - gen_aa32_ld_i32(s, tmp, addr, get_mem_index(s), | ||
249 | - s->be_data | size); | ||
250 | - neon_store_element(rd, reg_idx, size, tmp); | ||
251 | - } else { /* Store */ | ||
252 | - neon_load_element(tmp, rd, reg_idx, size); | ||
253 | - gen_aa32_st_i32(s, tmp, addr, get_mem_index(s), | ||
254 | - s->be_data | size); | ||
255 | - } | ||
256 | - rd += stride; | ||
257 | - tcg_gen_addi_i32(addr, addr, 1 << size); | ||
258 | - } | ||
259 | - tcg_temp_free_i32(addr); | ||
260 | - tcg_temp_free_i32(tmp); | ||
261 | - stride = nregs * (1 << size); | ||
262 | - } | 487 | - } |
263 | - } | ||
264 | - if (rm != 15) { | ||
265 | - TCGv_i32 base; | ||
266 | - | ||
267 | - base = load_reg(s, rn); | ||
268 | - if (rm == 13) { | ||
269 | - tcg_gen_addi_i32(base, base, stride); | ||
270 | - } else { | ||
271 | - TCGv_i32 index; | ||
272 | - index = load_reg(s, rm); | ||
273 | - tcg_gen_add_i32(base, base, index); | ||
274 | - tcg_temp_free_i32(index); | ||
275 | - } | ||
276 | - store_reg(s, rn, base); | ||
277 | - } | 488 | - } |
278 | - return 0; | 489 | - return 0; |
279 | -} | 490 | -} |
280 | - | 491 | - |
281 | static inline void gen_neon_narrow(int size, TCGv_i32 dest, TCGv_i64 src) | 492 | static int disas_coproc_insn(DisasContext *s, uint32_t insn) |
282 | { | 493 | { |
283 | switch (size) { | 494 | int cpnum, is64, crn, crm, opc1, opc2, isread, rt, rt2; |
284 | @@ -XXX,XX +XXX,XX @@ static void disas_arm_insn(DisasContext *s, unsigned int insn) | 495 | @@ -XXX,XX +XXX,XX @@ static void disas_arm_insn(DisasContext *s, unsigned int insn) |
285 | } | ||
286 | return; | ||
287 | } | 496 | } |
288 | - if ((insn & 0x0f100000) == 0x04000000) { | 497 | /* fall back to legacy decoder */ |
289 | - /* NEON load/store. */ | 498 | |
290 | - if (disas_neon_ls_insn(s, insn)) { | 499 | - if (((insn >> 25) & 7) == 1) { |
500 | - /* NEON Data processing. */ | ||
501 | - if (disas_neon_data_insn(s, insn)) { | ||
291 | - goto illegal_op; | 502 | - goto illegal_op; |
292 | - } | 503 | - } |
293 | - return; | 504 | - return; |
294 | - } | 505 | - } |
295 | if ((insn & 0x0e000f00) == 0x0c000100) { | 506 | if ((insn & 0x0e000f00) == 0x0c000100) { |
296 | if (arm_dc_feature(s, ARM_FEATURE_IWMMXT)) { | 507 | if (arm_dc_feature(s, ARM_FEATURE_IWMMXT)) { |
297 | /* iWMMXt register transfer. */ | 508 | /* iWMMXt register transfer. */ |
298 | @@ -XXX,XX +XXX,XX @@ static void disas_thumb2_insn(DisasContext *s, uint32_t insn) | 509 | @@ -XXX,XX +XXX,XX @@ static void disas_thumb2_insn(DisasContext *s, uint32_t insn) |
510 | break; | ||
299 | } | 511 | } |
300 | break; | 512 | if (((insn >> 24) & 3) == 3) { |
301 | case 12: | 513 | - /* Translate into the equivalent ARM encoding. */ |
302 | - if ((insn & 0x01100000) == 0x01000000) { | 514 | - insn = (insn & 0xe2ffffff) | ((insn & (1 << 28)) >> 4) | (1 << 28); |
303 | - if (disas_neon_ls_insn(s, insn)) { | 515 | - if (disas_neon_data_insn(s, insn)) { |
304 | - goto illegal_op; | 516 | - goto illegal_op; |
305 | - } | 517 | - } |
306 | - break; | 518 | + /* Neon DP, but failed disas_neon_dp() */ |
307 | - } | 519 | + goto illegal_op; |
308 | goto illegal_op; | 520 | } else if (((insn >> 8) & 0xe) == 10) { |
309 | default: | 521 | /* VFP, but failed disas_vfp. */ |
310 | illegal_op: | 522 | goto illegal_op; |
311 | -- | 523 | -- |
312 | 2.20.1 | 524 | 2.20.1 |
313 | 525 | ||
314 | 526 | diff view generated by jsdifflib |
1 | We were accidentally permitting decode of Thumb Neon insns even if | 1 | The functions neon_element_offset(), neon_load_element(), |
---|---|---|---|
2 | the CPU didn't have the FEATURE_NEON bit set, because the feature | 2 | neon_load_element64(), neon_store_element() and |
3 | check was being done before the call to disas_neon_data_insn() and | 3 | neon_store_element64() are used only in the translate-neon.inc.c |
4 | disas_neon_ls_insn() in the Arm decoder but was omitted from the | 4 | file, so move their definitions there. |
5 | Thumb decoder. Push the feature bit check down into the called | 5 | |
6 | functions so it is done for both Arm and Thumb encodings. | 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. | ||
7 | 10 | ||
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
9 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 12 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
10 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 13 | Message-id: 20200616170844.13318-22-peter.maydell@linaro.org |
11 | Message-id: 20200430181003.21682-3-peter.maydell@linaro.org | ||
12 | --- | 14 | --- |
13 | target/arm/translate.c | 16 ++++++++-------- | 15 | target/arm/translate-neon.inc.c | 101 ++++++++++++++++++++++++++++++++ |
14 | 1 file changed, 8 insertions(+), 8 deletions(-) | 16 | target/arm/translate.c | 101 -------------------------------- |
15 | 17 | 2 files changed, 101 insertions(+), 101 deletions(-) | |
18 | |||
19 | diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c | ||
20 | index XXXXXXX..XXXXXXX 100644 | ||
21 | --- a/target/arm/translate-neon.inc.c | ||
22 | +++ b/target/arm/translate-neon.inc.c | ||
23 | @@ -XXX,XX +XXX,XX @@ static inline int rsub_8(DisasContext *s, int x) | ||
24 | #include "decode-neon-ls.inc.c" | ||
25 | #include "decode-neon-shared.inc.c" | ||
26 | |||
27 | +/* Return the offset of a 2**SIZE piece of a NEON register, at index ELE, | ||
28 | + * where 0 is the least significant end of the register. | ||
29 | + */ | ||
30 | +static inline long | ||
31 | +neon_element_offset(int reg, int element, MemOp size) | ||
32 | +{ | ||
33 | + int element_size = 1 << size; | ||
34 | + int ofs = element * element_size; | ||
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; | ||
16 | diff --git a/target/arm/translate.c b/target/arm/translate.c | 131 | diff --git a/target/arm/translate.c b/target/arm/translate.c |
17 | index XXXXXXX..XXXXXXX 100644 | 132 | index XXXXXXX..XXXXXXX 100644 |
18 | --- a/target/arm/translate.c | 133 | --- a/target/arm/translate.c |
19 | +++ b/target/arm/translate.c | 134 | +++ b/target/arm/translate.c |
20 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_ls_insn(DisasContext *s, uint32_t insn) | 135 | @@ -XXX,XX +XXX,XX @@ neon_reg_offset (int reg, int n) |
21 | TCGv_i32 tmp2; | 136 | return vfp_reg_offset(0, sreg); |
22 | TCGv_i64 tmp64; | 137 | } |
23 | 138 | ||
24 | + if (!arm_dc_feature(s, ARM_FEATURE_NEON)) { | 139 | -/* Return the offset of a 2**SIZE piece of a NEON register, at index ELE, |
25 | + return 1; | 140 | - * where 0 is the least significant end of the register. |
26 | + } | 141 | - */ |
27 | + | 142 | -static inline long |
28 | /* FIXME: this access check should not take precedence over UNDEF | 143 | -neon_element_offset(int reg, int element, MemOp size) |
29 | * for invalid encodings; we will generate incorrect syndrome information | 144 | -{ |
30 | * for attempts to execute invalid vfp/neon encodings with FP disabled. | 145 | - int element_size = 1 << size; |
31 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) | 146 | - int ofs = element * element_size; |
32 | TCGv_ptr ptr1, ptr2, ptr3; | 147 | -#ifdef HOST_WORDS_BIGENDIAN |
33 | TCGv_i64 tmp64; | 148 | - /* Calculate the offset assuming fully little-endian, |
34 | 149 | - * then XOR to account for the order of the 8-byte units. | |
35 | + if (!arm_dc_feature(s, ARM_FEATURE_NEON)) { | 150 | - */ |
36 | + return 1; | 151 | - if (element_size < 8) { |
37 | + } | 152 | - ofs ^= 8 - element_size; |
38 | + | 153 | - } |
39 | /* FIXME: this access check should not take precedence over UNDEF | 154 | -#endif |
40 | * for invalid encodings; we will generate incorrect syndrome information | 155 | - return neon_reg_offset(reg, 0) + ofs; |
41 | * for attempts to execute invalid vfp/neon encodings with FP disabled. | 156 | -} |
42 | @@ -XXX,XX +XXX,XX @@ static void disas_arm_insn(DisasContext *s, unsigned int insn) | 157 | - |
43 | 158 | static TCGv_i32 neon_load_reg(int reg, int pass) | |
44 | if (((insn >> 25) & 7) == 1) { | 159 | { |
45 | /* NEON Data processing. */ | 160 | TCGv_i32 tmp = tcg_temp_new_i32(); |
46 | - if (!arm_dc_feature(s, ARM_FEATURE_NEON)) { | 161 | @@ -XXX,XX +XXX,XX @@ static TCGv_i32 neon_load_reg(int reg, int pass) |
47 | - goto illegal_op; | 162 | return tmp; |
48 | - } | 163 | } |
49 | - | 164 | |
50 | if (disas_neon_data_insn(s, insn)) { | 165 | -static void neon_load_element(TCGv_i32 var, int reg, int ele, MemOp mop) |
51 | goto illegal_op; | 166 | -{ |
52 | } | 167 | - long offset = neon_element_offset(reg, ele, mop & MO_SIZE); |
53 | @@ -XXX,XX +XXX,XX @@ static void disas_arm_insn(DisasContext *s, unsigned int insn) | 168 | - |
54 | } | 169 | - switch (mop) { |
55 | if ((insn & 0x0f100000) == 0x04000000) { | 170 | - case MO_UB: |
56 | /* NEON load/store. */ | 171 | - tcg_gen_ld8u_i32(var, cpu_env, offset); |
57 | - if (!arm_dc_feature(s, ARM_FEATURE_NEON)) { | 172 | - break; |
58 | - goto illegal_op; | 173 | - case MO_UW: |
59 | - } | 174 | - tcg_gen_ld16u_i32(var, cpu_env, offset); |
60 | - | 175 | - break; |
61 | if (disas_neon_ls_insn(s, insn)) { | 176 | - case MO_UL: |
62 | goto illegal_op; | 177 | - tcg_gen_ld_i32(var, cpu_env, offset); |
63 | } | 178 | - break; |
179 | - default: | ||
180 | - g_assert_not_reached(); | ||
181 | - } | ||
182 | -} | ||
183 | - | ||
184 | -static void neon_load_element64(TCGv_i64 var, int reg, int ele, MemOp mop) | ||
185 | -{ | ||
186 | - long offset = neon_element_offset(reg, ele, mop & MO_SIZE); | ||
187 | - | ||
188 | - switch (mop) { | ||
189 | - case MO_UB: | ||
190 | - tcg_gen_ld8u_i64(var, cpu_env, offset); | ||
191 | - break; | ||
192 | - case MO_UW: | ||
193 | - tcg_gen_ld16u_i64(var, cpu_env, offset); | ||
194 | - break; | ||
195 | - case MO_UL: | ||
196 | - tcg_gen_ld32u_i64(var, cpu_env, offset); | ||
197 | - break; | ||
198 | - case MO_Q: | ||
199 | - tcg_gen_ld_i64(var, cpu_env, offset); | ||
200 | - break; | ||
201 | - default: | ||
202 | - g_assert_not_reached(); | ||
203 | - } | ||
204 | -} | ||
205 | - | ||
206 | static void neon_store_reg(int reg, int pass, TCGv_i32 var) | ||
207 | { | ||
208 | tcg_gen_st_i32(var, cpu_env, neon_reg_offset(reg, pass)); | ||
209 | tcg_temp_free_i32(var); | ||
210 | } | ||
211 | |||
212 | -static void neon_store_element(int reg, int ele, MemOp size, TCGv_i32 var) | ||
213 | -{ | ||
214 | - long offset = neon_element_offset(reg, ele, size); | ||
215 | - | ||
216 | - switch (size) { | ||
217 | - case MO_8: | ||
218 | - tcg_gen_st8_i32(var, cpu_env, offset); | ||
219 | - break; | ||
220 | - case MO_16: | ||
221 | - tcg_gen_st16_i32(var, cpu_env, offset); | ||
222 | - break; | ||
223 | - case MO_32: | ||
224 | - tcg_gen_st_i32(var, cpu_env, offset); | ||
225 | - break; | ||
226 | - default: | ||
227 | - g_assert_not_reached(); | ||
228 | - } | ||
229 | -} | ||
230 | - | ||
231 | -static void neon_store_element64(int reg, int ele, MemOp size, TCGv_i64 var) | ||
232 | -{ | ||
233 | - long offset = neon_element_offset(reg, ele, size); | ||
234 | - | ||
235 | - switch (size) { | ||
236 | - case MO_8: | ||
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)); | ||
64 | -- | 256 | -- |
65 | 2.20.1 | 257 | 2.20.1 |
66 | 258 | ||
67 | 259 | diff view generated by jsdifflib |
1 | Somewhere along theline we accidentally added a duplicate | 1 | Since commit ba3e7926691ed3 it has been unnecessary for target code |
---|---|---|---|
2 | "using D16-D31 when they don't exist" check to do_vfm_dp() | 2 | to call gen_io_end() after an IO instruction in icount mode; it is |
3 | (probably an artifact of a patchseries rebase). Remove it. | 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 | ||
4 | 17 | ||
5 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 18 | Signed-off-by: Peter Maydell <peter.maydell@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 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 21 | Reviewed-by: Pavel Dovgalyuk <Pavel.Dovgaluk@ispras.ru> |
8 | Message-id: 20200430181003.21682-2-peter.maydell@linaro.org | 22 | Message-id: 20200619170324.12093-1-peter.maydell@linaro.org |
9 | --- | 23 | --- |
10 | target/arm/translate-vfp.inc.c | 6 ------ | 24 | target/arm/cpu.h | 2 +- |
11 | 1 file changed, 6 deletions(-) | 25 | target/arm/translate-vfp.inc.c | 7 +++---- |
26 | target/arm/translate.c | 3 --- | ||
27 | 3 files changed, 4 insertions(+), 8 deletions(-) | ||
12 | 28 | ||
29 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h | ||
30 | index XXXXXXX..XXXXXXX 100644 | ||
31 | --- a/target/arm/cpu.h | ||
32 | +++ b/target/arm/cpu.h | ||
33 | @@ -XXX,XX +XXX,XX @@ static inline uint64_t cpreg_to_kvm_id(uint32_t cpregid) | ||
34 | * migration or KVM state synchronization. (Typically this is for "registers" | ||
35 | * which are actually used as instructions for cache maintenance and so on.) | ||
36 | * IO indicates that this register does I/O and therefore its accesses | ||
37 | - * need to be surrounded by gen_io_start()/gen_io_end(). In particular, | ||
38 | + * need to be marked with gen_io_start() and also end the TB. In particular, | ||
39 | * registers which implement clocks or timers require this. | ||
40 | * RAISES_EXC is for when the read or write hook might raise an exception; | ||
41 | * the generated code will synchronize the CPU state before calling the hook | ||
13 | diff --git a/target/arm/translate-vfp.inc.c b/target/arm/translate-vfp.inc.c | 42 | diff --git a/target/arm/translate-vfp.inc.c b/target/arm/translate-vfp.inc.c |
14 | index XXXXXXX..XXXXXXX 100644 | 43 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/target/arm/translate-vfp.inc.c | 44 | --- a/target/arm/translate-vfp.inc.c |
16 | +++ b/target/arm/translate-vfp.inc.c | 45 | +++ b/target/arm/translate-vfp.inc.c |
17 | @@ -XXX,XX +XXX,XX @@ static bool do_vfm_dp(DisasContext *s, arg_VFMA_dp *a, bool neg_n, bool neg_d) | 46 | @@ -XXX,XX +XXX,XX @@ static bool full_vfp_access_check(DisasContext *s, bool ignore_vfp_enabled) |
18 | return false; | 47 | if (s->v7m_lspact) { |
19 | } | 48 | /* |
20 | 49 | * Lazy state saving affects external memory and also the NVIC, | |
21 | - /* UNDEF accesses to D16-D31 if they don't exist. */ | 50 | - * so we must mark it as an IO operation for icount. |
22 | - if (!dc_isar_feature(aa32_simd_r32, s) && | 51 | + * so we must mark it as an IO operation for icount (and cause |
23 | - ((a->vd | a->vn | a->vm) & 0x10)) { | 52 | + * this to be the last insn in the TB). |
24 | - return false; | 53 | */ |
25 | - } | 54 | if (tb_cflags(s->base.tb) & CF_USE_ICOUNT) { |
26 | - | 55 | + s->base.is_jmp = DISAS_UPDATE; |
27 | if (!vfp_access_check(s)) { | 56 | gen_io_start(); |
28 | return true; | 57 | } |
29 | } | 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 | ||
66 | index XXXXXXX..XXXXXXX 100644 | ||
67 | --- a/target/arm/translate.c | ||
68 | +++ b/target/arm/translate.c | ||
69 | @@ -XXX,XX +XXX,XX @@ static bool do_ldm(DisasContext *s, arg_ldst_block *a, int min_n) | ||
70 | gen_io_start(); | ||
71 | } | ||
72 | gen_helper_cpsr_write_eret(cpu_env, tmp); | ||
73 | - if (tb_cflags(s->base.tb) & CF_USE_ICOUNT) { | ||
74 | - gen_io_end(); | ||
75 | - } | ||
76 | tcg_temp_free_i32(tmp); | ||
77 | /* Must exit loop to check un-masked IRQs */ | ||
78 | s->base.is_jmp = DISAS_EXIT; | ||
30 | -- | 79 | -- |
31 | 2.20.1 | 80 | 2.20.1 |
32 | 81 | ||
33 | 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 |
1 | From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com> | 1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> |
---|---|---|---|
2 | 2 | ||
3 | Embed the ADMAs into the SoC type. | 3 | Use self-explicit definitions instead of magic values. |
4 | 4 | ||
5 | Suggested-by: Peter Maydell <peter.maydell@linaro.org> | 5 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> |
6 | Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | 6 | Message-id: 20200617072539.32686-3-f4bug@amsat.org |
7 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | 7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
8 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
9 | Reviewed-by: Luc Michel <luc.michel@greensocs.com> | ||
10 | Message-id: 20200427181649.26851-7-edgar.iglesias@gmail.com | ||
11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
12 | --- | 9 | --- |
13 | include/hw/arm/xlnx-versal.h | 3 ++- | 10 | hw/i2c/versatile_i2c.c | 14 ++++++++++---- |
14 | hw/arm/xlnx-versal.c | 14 +++++++------- | 11 | 1 file changed, 10 insertions(+), 4 deletions(-) |
15 | 2 files changed, 9 insertions(+), 8 deletions(-) | ||
16 | 12 | ||
17 | diff --git a/include/hw/arm/xlnx-versal.h b/include/hw/arm/xlnx-versal.h | 13 | diff --git a/hw/i2c/versatile_i2c.c b/hw/i2c/versatile_i2c.c |
18 | index XXXXXXX..XXXXXXX 100644 | 14 | index XXXXXXX..XXXXXXX 100644 |
19 | --- a/include/hw/arm/xlnx-versal.h | 15 | --- a/hw/i2c/versatile_i2c.c |
20 | +++ b/include/hw/arm/xlnx-versal.h | 16 | +++ b/hw/i2c/versatile_i2c.c |
21 | @@ -XXX,XX +XXX,XX @@ | 17 | @@ -XXX,XX +XXX,XX @@ |
22 | #include "hw/arm/boot.h" | 18 | #include "qemu/osdep.h" |
23 | #include "hw/intc/arm_gicv3.h" | 19 | #include "hw/sysbus.h" |
24 | #include "hw/char/pl011.h" | 20 | #include "hw/i2c/bitbang_i2c.h" |
25 | +#include "hw/dma/xlnx-zdma.h" | 21 | +#include "hw/registerfields.h" |
26 | #include "hw/net/cadence_gem.h" | 22 | #include "qemu/log.h" |
27 | 23 | #include "qemu/module.h" | |
28 | #define TYPE_XLNX_VERSAL "xlnx-versal" | 24 | |
29 | @@ -XXX,XX +XXX,XX @@ typedef struct Versal { | 25 | @@ -XXX,XX +XXX,XX @@ typedef struct VersatileI2CState { |
30 | struct { | 26 | int in; |
31 | PL011State uart[XLNX_VERSAL_NR_UARTS]; | 27 | } VersatileI2CState; |
32 | CadenceGEMState gem[XLNX_VERSAL_NR_GEMS]; | 28 | |
33 | - SysBusDevice *adma[XLNX_VERSAL_NR_ADMAS]; | 29 | +REG32(CONTROL_GET, 0) |
34 | + XlnxZDMA adma[XLNX_VERSAL_NR_ADMAS]; | 30 | +REG32(CONTROL_SET, 0) |
35 | } iou; | 31 | +REG32(CONTROL_CLR, 4) |
36 | } lpd; | 32 | + |
37 | 33 | static uint64_t versatile_i2c_read(void *opaque, hwaddr offset, | |
38 | diff --git a/hw/arm/xlnx-versal.c b/hw/arm/xlnx-versal.c | 34 | unsigned size) |
39 | index XXXXXXX..XXXXXXX 100644 | 35 | { |
40 | --- a/hw/arm/xlnx-versal.c | 36 | VersatileI2CState *s = (VersatileI2CState *)opaque; |
41 | +++ b/hw/arm/xlnx-versal.c | 37 | |
42 | @@ -XXX,XX +XXX,XX @@ static void versal_create_admas(Versal *s, qemu_irq *pic) | 38 | - if (offset == 0) { |
43 | DeviceState *dev; | 39 | + switch (offset) { |
44 | MemoryRegion *mr; | 40 | + case A_CONTROL_SET: |
45 | 41 | return (s->out & 1) | (s->in << 1); | |
46 | - dev = qdev_create(NULL, "xlnx.zdma"); | 42 | - } else { |
47 | - s->lpd.iou.adma[i] = SYS_BUS_DEVICE(dev); | 43 | + default: |
48 | - object_property_set_int(OBJECT(s->lpd.iou.adma[i]), 128, "bus-width", | 44 | qemu_log_mask(LOG_GUEST_ERROR, |
49 | - &error_abort); | 45 | "%s: Bad offset 0x%x\n", __func__, (int)offset); |
50 | - object_property_add_child(OBJECT(s), name, OBJECT(dev), &error_fatal); | 46 | return -1; |
51 | + sysbus_init_child_obj(OBJECT(s), name, | 47 | @@ -XXX,XX +XXX,XX @@ static void versatile_i2c_write(void *opaque, hwaddr offset, |
52 | + &s->lpd.iou.adma[i], sizeof(s->lpd.iou.adma[i]), | 48 | VersatileI2CState *s = (VersatileI2CState *)opaque; |
53 | + TYPE_XLNX_ZDMA); | 49 | |
54 | + dev = DEVICE(&s->lpd.iou.adma[i]); | 50 | switch (offset) { |
55 | + object_property_set_int(OBJECT(dev), 128, "bus-width", &error_abort); | 51 | - case 0: |
56 | qdev_init_nofail(dev); | 52 | + case A_CONTROL_SET: |
57 | 53 | s->out |= value & 3; | |
58 | - mr = sysbus_mmio_get_region(s->lpd.iou.adma[i], 0); | 54 | break; |
59 | + mr = sysbus_mmio_get_region(SYS_BUS_DEVICE(dev), 0); | 55 | - case 4: |
60 | memory_region_add_subregion(&s->mr_ps, | 56 | + case A_CONTROL_CLR: |
61 | MM_ADMA_CH0 + i * MM_ADMA_CH0_SIZE, mr); | 57 | s->out &= ~value; |
62 | 58 | break; | |
63 | - sysbus_connect_irq(s->lpd.iou.adma[i], 0, pic[VERSAL_ADMA_IRQ_0 + i]); | 59 | default: |
64 | + sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, pic[VERSAL_ADMA_IRQ_0 + i]); | ||
65 | g_free(name); | ||
66 | } | ||
67 | } | ||
68 | -- | 60 | -- |
69 | 2.20.1 | 61 | 2.20.1 |
70 | 62 | ||
71 | 63 | diff view generated by jsdifflib |
1 | From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com> | 1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> |
---|---|---|---|
2 | 2 | ||
3 | Embed the APUs into the SoC type. | 3 | Use self-explicit definitions instead of magic values. |
4 | 4 | ||
5 | Suggested-by: Peter Maydell <peter.maydell@linaro.org> | 5 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> |
6 | Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | 6 | Message-id: 20200617072539.32686-4-f4bug@amsat.org |
7 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | 7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
8 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
9 | Reviewed-by: Luc Michel <luc.michel@greensocs.com> | ||
10 | Message-id: 20200427181649.26851-8-edgar.iglesias@gmail.com | ||
11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
12 | --- | 9 | --- |
13 | include/hw/arm/xlnx-versal.h | 2 +- | 10 | hw/i2c/versatile_i2c.c | 7 +++++-- |
14 | hw/arm/xlnx-versal-virt.c | 4 ++-- | 11 | 1 file changed, 5 insertions(+), 2 deletions(-) |
15 | hw/arm/xlnx-versal.c | 19 +++++-------------- | ||
16 | 3 files changed, 8 insertions(+), 17 deletions(-) | ||
17 | 12 | ||
18 | diff --git a/include/hw/arm/xlnx-versal.h b/include/hw/arm/xlnx-versal.h | 13 | diff --git a/hw/i2c/versatile_i2c.c b/hw/i2c/versatile_i2c.c |
19 | index XXXXXXX..XXXXXXX 100644 | 14 | index XXXXXXX..XXXXXXX 100644 |
20 | --- a/include/hw/arm/xlnx-versal.h | 15 | --- a/hw/i2c/versatile_i2c.c |
21 | +++ b/include/hw/arm/xlnx-versal.h | 16 | +++ b/hw/i2c/versatile_i2c.c |
22 | @@ -XXX,XX +XXX,XX @@ typedef struct Versal { | 17 | @@ -XXX,XX +XXX,XX @@ REG32(CONTROL_GET, 0) |
23 | struct { | 18 | REG32(CONTROL_SET, 0) |
24 | struct { | 19 | REG32(CONTROL_CLR, 4) |
25 | MemoryRegion mr; | 20 | |
26 | - ARMCPU *cpu[XLNX_VERSAL_NR_ACPUS]; | 21 | +#define SCL BIT(0) |
27 | + ARMCPU cpu[XLNX_VERSAL_NR_ACPUS]; | 22 | +#define SDA BIT(1) |
28 | GICv3State gic; | 23 | + |
29 | } apu; | 24 | static uint64_t versatile_i2c_read(void *opaque, hwaddr offset, |
30 | } fpd; | 25 | unsigned size) |
31 | diff --git a/hw/arm/xlnx-versal-virt.c b/hw/arm/xlnx-versal-virt.c | 26 | { |
32 | index XXXXXXX..XXXXXXX 100644 | 27 | @@ -XXX,XX +XXX,XX @@ static void versatile_i2c_write(void *opaque, hwaddr offset, |
33 | --- a/hw/arm/xlnx-versal-virt.c | 28 | qemu_log_mask(LOG_GUEST_ERROR, |
34 | +++ b/hw/arm/xlnx-versal-virt.c | 29 | "%s: Bad offset 0x%x\n", __func__, (int)offset); |
35 | @@ -XXX,XX +XXX,XX @@ static void versal_virt_init(MachineState *machine) | ||
36 | s->binfo.get_dtb = versal_virt_get_dtb; | ||
37 | s->binfo.modify_dtb = versal_virt_modify_dtb; | ||
38 | if (machine->kernel_filename) { | ||
39 | - arm_load_kernel(s->soc.fpd.apu.cpu[0], machine, &s->binfo); | ||
40 | + arm_load_kernel(&s->soc.fpd.apu.cpu[0], machine, &s->binfo); | ||
41 | } else { | ||
42 | - AddressSpace *as = arm_boot_address_space(s->soc.fpd.apu.cpu[0], | ||
43 | + AddressSpace *as = arm_boot_address_space(&s->soc.fpd.apu.cpu[0], | ||
44 | &s->binfo); | ||
45 | /* Some boot-loaders (e.g u-boot) don't like blobs at address 0 (NULL). | ||
46 | * Offset things by 4K. */ | ||
47 | diff --git a/hw/arm/xlnx-versal.c b/hw/arm/xlnx-versal.c | ||
48 | index XXXXXXX..XXXXXXX 100644 | ||
49 | --- a/hw/arm/xlnx-versal.c | ||
50 | +++ b/hw/arm/xlnx-versal.c | ||
51 | @@ -XXX,XX +XXX,XX @@ static void versal_create_apu_cpus(Versal *s) | ||
52 | |||
53 | for (i = 0; i < ARRAY_SIZE(s->fpd.apu.cpu); i++) { | ||
54 | Object *obj; | ||
55 | - char *name; | ||
56 | - | ||
57 | - obj = object_new(XLNX_VERSAL_ACPU_TYPE); | ||
58 | - if (!obj) { | ||
59 | - error_report("Unable to create apu.cpu[%d] of type %s", | ||
60 | - i, XLNX_VERSAL_ACPU_TYPE); | ||
61 | - exit(EXIT_FAILURE); | ||
62 | - } | ||
63 | - | ||
64 | - name = g_strdup_printf("apu-cpu[%d]", i); | ||
65 | - object_property_add_child(OBJECT(s), name, obj, &error_fatal); | ||
66 | - g_free(name); | ||
67 | |||
68 | + object_initialize_child(OBJECT(s), "apu-cpu[*]", | ||
69 | + &s->fpd.apu.cpu[i], sizeof(s->fpd.apu.cpu[i]), | ||
70 | + XLNX_VERSAL_ACPU_TYPE, &error_abort, NULL); | ||
71 | + obj = OBJECT(&s->fpd.apu.cpu[i]); | ||
72 | object_property_set_int(obj, s->cfg.psci_conduit, | ||
73 | "psci-conduit", &error_abort); | ||
74 | if (i) { | ||
75 | @@ -XXX,XX +XXX,XX @@ static void versal_create_apu_cpus(Versal *s) | ||
76 | object_property_set_link(obj, OBJECT(&s->fpd.apu.mr), "memory", | ||
77 | &error_abort); | ||
78 | object_property_set_bool(obj, true, "realized", &error_fatal); | ||
79 | - s->fpd.apu.cpu[i] = ARM_CPU(obj); | ||
80 | } | 30 | } |
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); | ||
81 | } | 35 | } |
82 | 36 | ||
83 | @@ -XXX,XX +XXX,XX @@ static void versal_create_apu_gic(Versal *s, qemu_irq *pic) | 37 | static const MemoryRegionOps versatile_i2c_ops = { |
84 | } | ||
85 | |||
86 | for (i = 0; i < nr_apu_cpus; i++) { | ||
87 | - DeviceState *cpudev = DEVICE(s->fpd.apu.cpu[i]); | ||
88 | + DeviceState *cpudev = DEVICE(&s->fpd.apu.cpu[i]); | ||
89 | int ppibase = XLNX_VERSAL_NR_IRQS + i * GIC_INTERNAL + GIC_NR_SGIS; | ||
90 | qemu_irq maint_irq; | ||
91 | int ti; | ||
92 | -- | 38 | -- |
93 | 2.20.1 | 39 | 2.20.1 |
94 | 40 | ||
95 | 41 | diff view generated by jsdifflib |
1 | From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com> | 1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> |
---|---|---|---|
2 | 2 | ||
3 | Add support for SD. | 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. | ||
4 | 6 | ||
5 | Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | 7 | Make the private VersatileI2CState structure as public |
6 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | 8 | ArmSbconI2CState. |
7 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 9 | Add the TYPE_ARM_SBCON_I2C, alias to our current |
8 | Reviewed-by: Luc Michel <luc.michel@greensocs.com> | 10 | TYPE_VERSATILE_I2C model. |
9 | Message-id: 20200427181649.26851-9-edgar.iglesias@gmail.com | 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> | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 16 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
11 | --- | 17 | --- |
12 | include/hw/arm/xlnx-versal.h | 12 ++++++++++++ | 18 | include/hw/i2c/arm_sbcon_i2c.h | 35 ++++++++++++++++++++++++++++++++++ |
13 | hw/arm/xlnx-versal.c | 31 +++++++++++++++++++++++++++++++ | 19 | hw/i2c/versatile_i2c.c | 17 +++++------------ |
14 | 2 files changed, 43 insertions(+) | 20 | MAINTAINERS | 1 + |
21 | 3 files changed, 41 insertions(+), 12 deletions(-) | ||
22 | create mode 100644 include/hw/i2c/arm_sbcon_i2c.h | ||
15 | 23 | ||
16 | diff --git a/include/hw/arm/xlnx-versal.h b/include/hw/arm/xlnx-versal.h | 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 | ||
17 | index XXXXXXX..XXXXXXX 100644 | 66 | index XXXXXXX..XXXXXXX 100644 |
18 | --- a/include/hw/arm/xlnx-versal.h | 67 | --- a/hw/i2c/versatile_i2c.c |
19 | +++ b/include/hw/arm/xlnx-versal.h | 68 | +++ b/hw/i2c/versatile_i2c.c |
20 | @@ -XXX,XX +XXX,XX @@ | 69 | @@ -XXX,XX +XXX,XX @@ |
21 | 70 | /* | |
22 | #include "hw/sysbus.h" | 71 | - * ARM Versatile I2C controller |
23 | #include "hw/arm/boot.h" | 72 | + * ARM SBCon two-wire serial bus interface (I2C bitbang) |
24 | +#include "hw/sd/sdhci.h" | 73 | + * a.k.a. ARM Versatile I2C controller |
25 | #include "hw/intc/arm_gicv3.h" | 74 | * |
26 | #include "hw/char/pl011.h" | 75 | * Copyright (c) 2006-2007 CodeSourcery. |
27 | #include "hw/dma/xlnx-zdma.h" | 76 | * Copyright (c) 2012 Oskar Andero <oskar.andero@gmail.com> |
28 | @@ -XXX,XX +XXX,XX @@ | 77 | @@ -XXX,XX +XXX,XX @@ |
29 | #define XLNX_VERSAL_NR_UARTS 2 | 78 | */ |
30 | #define XLNX_VERSAL_NR_GEMS 2 | 79 | |
31 | #define XLNX_VERSAL_NR_ADMAS 8 | 80 | #include "qemu/osdep.h" |
32 | +#define XLNX_VERSAL_NR_SDS 2 | 81 | -#include "hw/sysbus.h" |
33 | #define XLNX_VERSAL_NR_IRQS 192 | 82 | -#include "hw/i2c/bitbang_i2c.h" |
34 | 83 | +#include "hw/i2c/arm_sbcon_i2c.h" | |
35 | typedef struct Versal { | 84 | #include "hw/registerfields.h" |
36 | @@ -XXX,XX +XXX,XX @@ typedef struct Versal { | 85 | #include "qemu/log.h" |
37 | } iou; | 86 | #include "qemu/module.h" |
38 | } lpd; | 87 | |
39 | 88 | -#define TYPE_VERSATILE_I2C "versatile_i2c" | |
40 | + /* The Platform Management Controller subsystem. */ | 89 | #define VERSATILE_I2C(obj) \ |
41 | + struct { | 90 | OBJECT_CHECK(VersatileI2CState, (obj), TYPE_VERSATILE_I2C) |
42 | + struct { | 91 | |
43 | + SDHCIState sd[XLNX_VERSAL_NR_SDS]; | 92 | -typedef struct VersatileI2CState { |
44 | + } iou; | 93 | - SysBusDevice parent_obj; |
45 | + } pmc; | 94 | +typedef ArmSbconI2CState VersatileI2CState; |
46 | + | 95 | |
47 | struct { | 96 | - MemoryRegion iomem; |
48 | MemoryRegion *mr_ddr; | 97 | - bitbang_i2c_interface bitbang; |
49 | uint32_t psci_conduit; | 98 | - int out; |
50 | @@ -XXX,XX +XXX,XX @@ typedef struct Versal { | 99 | - int in; |
51 | #define VERSAL_GEM1_IRQ_0 58 | 100 | -} VersatileI2CState; |
52 | #define VERSAL_GEM1_WAKE_IRQ_0 59 | 101 | |
53 | #define VERSAL_ADMA_IRQ_0 60 | 102 | REG32(CONTROL_GET, 0) |
54 | +#define VERSAL_SD0_IRQ_0 126 | 103 | REG32(CONTROL_SET, 0) |
55 | 104 | @@ -XXX,XX +XXX,XX @@ static void versatile_i2c_init(Object *obj) | |
56 | /* Architecturally reserved IRQs suitable for virtualization. */ | 105 | bus = i2c_init_bus(dev, "i2c"); |
57 | #define VERSAL_RSVD_IRQ_FIRST 111 | 106 | bitbang_i2c_init(&s->bitbang, bus); |
58 | @@ -XXX,XX +XXX,XX @@ typedef struct Versal { | 107 | memory_region_init_io(&s->iomem, obj, &versatile_i2c_ops, s, |
59 | #define MM_FPD_CRF 0xfd1a0000U | 108 | - "versatile_i2c", 0x1000); |
60 | #define MM_FPD_CRF_SIZE 0x140000 | 109 | + "arm_sbcon_i2c", 0x1000); |
61 | 110 | sysbus_init_mmio(sbd, &s->iomem); | |
62 | +#define MM_PMC_SD0 0xf1040000U | 111 | } |
63 | +#define MM_PMC_SD0_SIZE 0x10000 | 112 | |
64 | #define MM_PMC_CRP 0xf1260000U | 113 | diff --git a/MAINTAINERS b/MAINTAINERS |
65 | #define MM_PMC_CRP_SIZE 0x10000 | ||
66 | #endif | ||
67 | diff --git a/hw/arm/xlnx-versal.c b/hw/arm/xlnx-versal.c | ||
68 | index XXXXXXX..XXXXXXX 100644 | 114 | index XXXXXXX..XXXXXXX 100644 |
69 | --- a/hw/arm/xlnx-versal.c | 115 | --- a/MAINTAINERS |
70 | +++ b/hw/arm/xlnx-versal.c | 116 | +++ b/MAINTAINERS |
71 | @@ -XXX,XX +XXX,XX @@ static void versal_create_admas(Versal *s, qemu_irq *pic) | 117 | @@ -XXX,XX +XXX,XX @@ M: Peter Maydell <peter.maydell@linaro.org> |
72 | } | 118 | L: qemu-arm@nongnu.org |
73 | } | 119 | S: Maintained |
74 | 120 | F: hw/*/versatile* | |
75 | +#define SDHCI_CAPABILITIES 0x280737ec6481 /* Same as on ZynqMP. */ | 121 | +F: include/hw/i2c/arm_sbcon_i2c.h |
76 | +static void versal_create_sds(Versal *s, qemu_irq *pic) | 122 | F: hw/misc/arm_sysctl.c |
77 | +{ | 123 | F: docs/system/arm/versatile.rst |
78 | + int i; | ||
79 | + | ||
80 | + for (i = 0; i < ARRAY_SIZE(s->pmc.iou.sd); i++) { | ||
81 | + DeviceState *dev; | ||
82 | + MemoryRegion *mr; | ||
83 | + | ||
84 | + sysbus_init_child_obj(OBJECT(s), "sd[*]", | ||
85 | + &s->pmc.iou.sd[i], sizeof(s->pmc.iou.sd[i]), | ||
86 | + TYPE_SYSBUS_SDHCI); | ||
87 | + dev = DEVICE(&s->pmc.iou.sd[i]); | ||
88 | + | ||
89 | + object_property_set_uint(OBJECT(dev), | ||
90 | + 3, "sd-spec-version", &error_fatal); | ||
91 | + object_property_set_uint(OBJECT(dev), SDHCI_CAPABILITIES, "capareg", | ||
92 | + &error_fatal); | ||
93 | + object_property_set_uint(OBJECT(dev), UHS_I, "uhs", &error_fatal); | ||
94 | + qdev_init_nofail(dev); | ||
95 | + | ||
96 | + mr = sysbus_mmio_get_region(SYS_BUS_DEVICE(dev), 0); | ||
97 | + memory_region_add_subregion(&s->mr_ps, | ||
98 | + MM_PMC_SD0 + i * MM_PMC_SD0_SIZE, mr); | ||
99 | + | ||
100 | + sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, | ||
101 | + pic[VERSAL_SD0_IRQ_0 + i * 2]); | ||
102 | + } | ||
103 | +} | ||
104 | + | ||
105 | /* This takes the board allocated linear DDR memory and creates aliases | ||
106 | * for each split DDR range/aperture on the Versal address map. | ||
107 | */ | ||
108 | @@ -XXX,XX +XXX,XX @@ static void versal_realize(DeviceState *dev, Error **errp) | ||
109 | versal_create_uarts(s, pic); | ||
110 | versal_create_gems(s, pic); | ||
111 | versal_create_admas(s, pic); | ||
112 | + versal_create_sds(s, pic); | ||
113 | versal_map_ddr(s); | ||
114 | versal_unimp(s); | ||
115 | 124 | ||
116 | -- | 125 | -- |
117 | 2.20.1 | 126 | 2.20.1 |
118 | 127 | ||
119 | 128 | diff view generated by jsdifflib |
... | ... | ||
---|---|---|---|
3 | By using the TYPE_* definitions for devices, we can: | 3 | By using the TYPE_* definitions for devices, we can: |
4 | - quickly find where devices are used with 'git-grep' | 4 | - quickly find where devices are used with 'git-grep' |
5 | - easily rename a device (one-line change). | 5 | - easily rename a device (one-line change). |
6 | 6 | ||
7 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 7 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> |
8 | Message-id: 20200428154650.21991-1-f4bug@amsat.org | 8 | Message-id: 20200617072539.32686-6-f4bug@amsat.org |
9 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
11 | --- | 11 | --- |
12 | hw/arm/mps2-tz.c | 2 +- | 12 | hw/arm/realview.c | 3 ++- |
13 | 1 file changed, 1 insertion(+), 1 deletion(-) | 13 | hw/arm/versatilepb.c | 3 ++- |
14 | hw/arm/vexpress.c | 3 ++- | ||
15 | 3 files changed, 6 insertions(+), 3 deletions(-) | ||
14 | 16 | ||
15 | diff --git a/hw/arm/mps2-tz.c b/hw/arm/mps2-tz.c | 17 | diff --git a/hw/arm/realview.c b/hw/arm/realview.c |
16 | index XXXXXXX..XXXXXXX 100644 | 18 | index XXXXXXX..XXXXXXX 100644 |
17 | --- a/hw/arm/mps2-tz.c | 19 | --- a/hw/arm/realview.c |
18 | +++ b/hw/arm/mps2-tz.c | 20 | +++ b/hw/arm/realview.c |
19 | @@ -XXX,XX +XXX,XX @@ static void mps2tz_common_init(MachineState *machine) | 21 | @@ -XXX,XX +XXX,XX @@ |
20 | exit(EXIT_FAILURE); | 22 | #include "hw/cpu/a9mpcore.h" |
23 | #include "hw/intc/realview_gic.h" | ||
24 | #include "hw/irq.h" | ||
25 | +#include "hw/i2c/arm_sbcon_i2c.h" | ||
26 | |||
27 | #define SMP_BOOT_ADDR 0xe0000000 | ||
28 | #define SMP_BOOTREG_ADDR 0x10000030 | ||
29 | @@ -XXX,XX +XXX,XX @@ static void realview_init(MachineState *machine, | ||
30 | } | ||
21 | } | 31 | } |
22 | 32 | ||
23 | - sysbus_init_child_obj(OBJECT(machine), "iotkit", &mms->iotkit, | 33 | - dev = sysbus_create_simple("versatile_i2c", 0x10002000, NULL); |
24 | + sysbus_init_child_obj(OBJECT(machine), TYPE_IOTKIT, &mms->iotkit, | 34 | + dev = sysbus_create_simple(TYPE_VERSATILE_I2C, 0x10002000, NULL); |
25 | sizeof(mms->iotkit), mmc->armsse_type); | 35 | i2c = (I2CBus *)qdev_get_child_bus(dev, "i2c"); |
26 | iotkitdev = DEVICE(&mms->iotkit); | 36 | i2c_create_slave(i2c, "ds1338", 0x68); |
27 | object_property_set_link(OBJECT(&mms->iotkit), OBJECT(system_memory), | 37 | |
38 | diff --git a/hw/arm/versatilepb.c b/hw/arm/versatilepb.c | ||
39 | index XXXXXXX..XXXXXXX 100644 | ||
40 | --- a/hw/arm/versatilepb.c | ||
41 | +++ b/hw/arm/versatilepb.c | ||
42 | @@ -XXX,XX +XXX,XX @@ | ||
43 | #include "sysemu/sysemu.h" | ||
44 | #include "hw/pci/pci.h" | ||
45 | #include "hw/i2c/i2c.h" | ||
46 | +#include "hw/i2c/arm_sbcon_i2c.h" | ||
47 | #include "hw/irq.h" | ||
48 | #include "hw/boards.h" | ||
49 | #include "exec/address-spaces.h" | ||
50 | @@ -XXX,XX +XXX,XX @@ static void versatile_init(MachineState *machine, int board_id) | ||
51 | /* Add PL031 Real Time Clock. */ | ||
52 | sysbus_create_simple("pl031", 0x101e8000, pic[10]); | ||
53 | |||
54 | - dev = sysbus_create_simple("versatile_i2c", 0x10002000, NULL); | ||
55 | + dev = sysbus_create_simple(TYPE_VERSATILE_I2C, 0x10002000, NULL); | ||
56 | i2c = (I2CBus *)qdev_get_child_bus(dev, "i2c"); | ||
57 | i2c_create_slave(i2c, "ds1338", 0x68); | ||
58 | |||
59 | diff --git a/hw/arm/vexpress.c b/hw/arm/vexpress.c | ||
60 | index XXXXXXX..XXXXXXX 100644 | ||
61 | --- a/hw/arm/vexpress.c | ||
62 | +++ b/hw/arm/vexpress.c | ||
63 | @@ -XXX,XX +XXX,XX @@ | ||
64 | #include "hw/char/pl011.h" | ||
65 | #include "hw/cpu/a9mpcore.h" | ||
66 | #include "hw/cpu/a15mpcore.h" | ||
67 | +#include "hw/i2c/arm_sbcon_i2c.h" | ||
68 | |||
69 | #define VEXPRESS_BOARD_ID 0x8e0 | ||
70 | #define VEXPRESS_FLASH_SIZE (64 * 1024 * 1024) | ||
71 | @@ -XXX,XX +XXX,XX @@ static void vexpress_common_init(MachineState *machine) | ||
72 | sysbus_create_simple("sp804", map[VE_TIMER01], pic[2]); | ||
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); | ||
79 | |||
28 | -- | 80 | -- |
29 | 2.20.1 | 81 | 2.20.1 |
30 | 82 | ||
31 | 83 | diff view generated by jsdifflib |
1 | From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com> | 1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> |
---|---|---|---|
2 | 2 | ||
3 | Fix typo xlnx-ve -> xlnx-versal. | 3 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> |
4 | 4 | Message-id: 20200617072539.32686-7-f4bug@amsat.org | |
5 | Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | 5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
6 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | ||
7 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
8 | Reviewed-by: Luc Michel <luc.michel@greensocs.com> | ||
9 | Message-id: 20200427181649.26851-4-edgar.iglesias@gmail.com | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
11 | --- | 7 | --- |
12 | hw/arm/xlnx-versal-virt.c | 2 +- | 8 | hw/arm/mps2.c | 5 ++++- |
13 | 1 file changed, 1 insertion(+), 1 deletion(-) | 9 | 1 file changed, 4 insertions(+), 1 deletion(-) |
14 | 10 | ||
15 | diff --git a/hw/arm/xlnx-versal-virt.c b/hw/arm/xlnx-versal-virt.c | 11 | diff --git a/hw/arm/mps2.c b/hw/arm/mps2.c |
16 | index XXXXXXX..XXXXXXX 100644 | 12 | index XXXXXXX..XXXXXXX 100644 |
17 | --- a/hw/arm/xlnx-versal-virt.c | 13 | --- a/hw/arm/mps2.c |
18 | +++ b/hw/arm/xlnx-versal-virt.c | 14 | +++ b/hw/arm/mps2.c |
19 | @@ -XXX,XX +XXX,XX @@ static void versal_virt_init(MachineState *machine) | 15 | @@ -XXX,XX +XXX,XX @@ typedef struct { |
20 | psci_conduit = QEMU_PSCI_CONDUIT_SMC; | 16 | MemoryRegion blockram_m2; |
17 | MemoryRegion blockram_m3; | ||
18 | MemoryRegion sram; | ||
19 | + /* FPGA APB subsystem */ | ||
20 | MPS2SCC scc; | ||
21 | + /* CMSDK APB subsystem */ | ||
22 | CMSDKAPBDualTimer dualtimer; | ||
23 | } MPS2MachineState; | ||
24 | |||
25 | @@ -XXX,XX +XXX,XX @@ static void mps2_common_init(MachineState *machine) | ||
26 | g_assert_not_reached(); | ||
21 | } | 27 | } |
22 | 28 | ||
23 | - sysbus_init_child_obj(OBJECT(machine), "xlnx-ve", &s->soc, | 29 | + /* CMSDK APB subsystem */ |
24 | + sysbus_init_child_obj(OBJECT(machine), "xlnx-versal", &s->soc, | 30 | cmsdk_apb_timer_create(0x40000000, qdev_get_gpio_in(armv7m, 8), SYSCLK_FRQ); |
25 | sizeof(s->soc), TYPE_XLNX_VERSAL); | 31 | cmsdk_apb_timer_create(0x40001000, qdev_get_gpio_in(armv7m, 9), SYSCLK_FRQ); |
26 | object_property_set_link(OBJECT(&s->soc), OBJECT(machine->ram), | 32 | - |
27 | "ddr", &error_abort); | 33 | object_initialize_child(OBJECT(mms), "dualtimer", &mms->dualtimer, |
34 | TYPE_CMSDK_APB_DUALTIMER); | ||
35 | qdev_prop_set_uint32(DEVICE(&mms->dualtimer), "pclk-frq", SYSCLK_FRQ); | ||
36 | @@ -XXX,XX +XXX,XX @@ static void mps2_common_init(MachineState *machine) | ||
37 | qdev_get_gpio_in(armv7m, 10)); | ||
38 | sysbus_mmio_map(SYS_BUS_DEVICE(&mms->dualtimer), 0, 0x40002000); | ||
39 | |||
40 | + /* FPGA APB subsystem */ | ||
41 | object_initialize_child(OBJECT(mms), "scc", &mms->scc, TYPE_MPS2_SCC); | ||
42 | sccdev = DEVICE(&mms->scc); | ||
43 | qdev_prop_set_uint32(sccdev, "scc-cfg4", 0x2); | ||
28 | -- | 44 | -- |
29 | 2.20.1 | 45 | 2.20.1 |
30 | 46 | ||
31 | 47 | diff view generated by jsdifflib |
1 | From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com> | 1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> |
---|---|---|---|
2 | 2 | ||
3 | Remove inclusion of arm_gicv3_common.h, this already gets | 3 | To differenciate with the CMSDK APB peripheral region, |
4 | included via xlnx-versal.h. | 4 | rename this region 'CMSDK AHB peripheral region'. |
5 | 5 | ||
6 | Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | 6 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
7 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | 7 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> |
8 | Reviewed-by: Luc Michel <luc.michel@greensocs.com> | 8 | Message-id: 20200617072539.32686-8-f4bug@amsat.org |
9 | Message-id: 20200427181649.26851-2-edgar.iglesias@gmail.com | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
11 | --- | 10 | --- |
12 | hw/arm/xlnx-versal.c | 1 - | 11 | hw/arm/mps2.c | 3 ++- |
13 | 1 file changed, 1 deletion(-) | 12 | 1 file changed, 2 insertions(+), 1 deletion(-) |
14 | 13 | ||
15 | diff --git a/hw/arm/xlnx-versal.c b/hw/arm/xlnx-versal.c | 14 | diff --git a/hw/arm/mps2.c b/hw/arm/mps2.c |
16 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
17 | --- a/hw/arm/xlnx-versal.c | 16 | --- a/hw/arm/mps2.c |
18 | +++ b/hw/arm/xlnx-versal.c | 17 | +++ b/hw/arm/mps2.c |
19 | @@ -XXX,XX +XXX,XX @@ | 18 | @@ -XXX,XX +XXX,XX @@ static void mps2_common_init(MachineState *machine) |
20 | #include "hw/arm/boot.h" | 19 | */ |
21 | #include "kvm_arm.h" | 20 | create_unimplemented_device("CMSDK APB peripheral region @0x40000000", |
22 | #include "hw/misc/unimp.h" | 21 | 0x40000000, 0x00010000); |
23 | -#include "hw/intc/arm_gicv3_common.h" | 22 | - create_unimplemented_device("CMSDK peripheral region @0x40010000", |
24 | #include "hw/arm/xlnx-versal.h" | 23 | + create_unimplemented_device("CMSDK AHB peripheral region @0x40010000", |
25 | #include "hw/char/pl011.h" | 24 | 0x40010000, 0x00010000); |
25 | create_unimplemented_device("Extra peripheral region @0x40020000", | ||
26 | 0x40020000, 0x00010000); | ||
27 | + | ||
28 | create_unimplemented_device("RESERVED 4", 0x40030000, 0x001D0000); | ||
29 | create_unimplemented_device("VGA", 0x41000000, 0x0200000); | ||
26 | 30 | ||
27 | -- | 31 | -- |
28 | 2.20.1 | 32 | 2.20.1 |
29 | 33 | ||
30 | 34 | diff view generated by jsdifflib |
1 | From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com> | 1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> |
---|---|---|---|
2 | 2 | ||
3 | Embed the GEMs into the SoC type. | 3 | We already model the CMSDK APB watchdog device, let's use it! |
4 | 4 | ||
5 | Suggested-by: Peter Maydell <peter.maydell@linaro.org> | 5 | Suggested-by: Peter Maydell <peter.maydell@linaro.org> |
6 | Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | 6 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> |
7 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | 7 | Message-id: 20200617072539.32686-9-f4bug@amsat.org |
8 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
9 | Reviewed-by: Luc Michel <luc.michel@greensocs.com> | ||
10 | Message-id: 20200427181649.26851-6-edgar.iglesias@gmail.com | ||
11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
12 | --- | 10 | --- |
13 | include/hw/arm/xlnx-versal.h | 3 ++- | 11 | hw/arm/mps2.c | 7 +++++++ |
14 | hw/arm/xlnx-versal.c | 15 ++++++++------- | 12 | hw/arm/Kconfig | 1 + |
15 | 2 files changed, 10 insertions(+), 8 deletions(-) | 13 | 2 files changed, 8 insertions(+) |
16 | 14 | ||
17 | diff --git a/include/hw/arm/xlnx-versal.h b/include/hw/arm/xlnx-versal.h | 15 | diff --git a/hw/arm/mps2.c b/hw/arm/mps2.c |
18 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
19 | --- a/include/hw/arm/xlnx-versal.h | 17 | --- a/hw/arm/mps2.c |
20 | +++ b/include/hw/arm/xlnx-versal.h | 18 | +++ b/hw/arm/mps2.c |
21 | @@ -XXX,XX +XXX,XX @@ | 19 | @@ -XXX,XX +XXX,XX @@ static void mps2_common_init(MachineState *machine) |
22 | #include "hw/arm/boot.h" | 20 | sysbus_connect_irq(SYS_BUS_DEVICE(&mms->dualtimer), 0, |
23 | #include "hw/intc/arm_gicv3.h" | 21 | qdev_get_gpio_in(armv7m, 10)); |
24 | #include "hw/char/pl011.h" | 22 | sysbus_mmio_map(SYS_BUS_DEVICE(&mms->dualtimer), 0, 0x40002000); |
25 | +#include "hw/net/cadence_gem.h" | 23 | + object_initialize_child(OBJECT(mms), "watchdog", &mms->watchdog, |
26 | 24 | + TYPE_CMSDK_APB_WATCHDOG); | |
27 | #define TYPE_XLNX_VERSAL "xlnx-versal" | 25 | + qdev_prop_set_uint32(DEVICE(&mms->watchdog), "wdogclk-frq", SYSCLK_FRQ); |
28 | #define XLNX_VERSAL(obj) OBJECT_CHECK(Versal, (obj), TYPE_XLNX_VERSAL) | 26 | + sysbus_realize(SYS_BUS_DEVICE(&mms->watchdog), &error_fatal); |
29 | @@ -XXX,XX +XXX,XX @@ typedef struct Versal { | 27 | + sysbus_connect_irq(SYS_BUS_DEVICE(&mms->watchdog), 0, |
30 | 28 | + qdev_get_gpio_in_named(armv7m, "NMI", 0)); | |
31 | struct { | 29 | + sysbus_mmio_map(SYS_BUS_DEVICE(&mms->watchdog), 0, 0x40008000); |
32 | PL011State uart[XLNX_VERSAL_NR_UARTS]; | 30 | |
33 | - SysBusDevice *gem[XLNX_VERSAL_NR_GEMS]; | 31 | /* FPGA APB subsystem */ |
34 | + CadenceGEMState gem[XLNX_VERSAL_NR_GEMS]; | 32 | object_initialize_child(OBJECT(mms), "scc", &mms->scc, TYPE_MPS2_SCC); |
35 | SysBusDevice *adma[XLNX_VERSAL_NR_ADMAS]; | 33 | diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig |
36 | } iou; | ||
37 | } lpd; | ||
38 | diff --git a/hw/arm/xlnx-versal.c b/hw/arm/xlnx-versal.c | ||
39 | index XXXXXXX..XXXXXXX 100644 | 34 | index XXXXXXX..XXXXXXX 100644 |
40 | --- a/hw/arm/xlnx-versal.c | 35 | --- a/hw/arm/Kconfig |
41 | +++ b/hw/arm/xlnx-versal.c | 36 | +++ b/hw/arm/Kconfig |
42 | @@ -XXX,XX +XXX,XX @@ static void versal_create_gems(Versal *s, qemu_irq *pic) | 37 | @@ -XXX,XX +XXX,XX @@ config MPS2 |
43 | DeviceState *dev; | 38 | select PL080 # DMA controller |
44 | MemoryRegion *mr; | 39 | select SPLIT_IRQ |
45 | 40 | select UNIMP | |
46 | - dev = qdev_create(NULL, "cadence_gem"); | 41 | + select CMSDK_APB_WATCHDOG |
47 | - s->lpd.iou.gem[i] = SYS_BUS_DEVICE(dev); | 42 | |
48 | - object_property_add_child(OBJECT(s), name, OBJECT(dev), &error_fatal); | 43 | config FSL_IMX7 |
49 | + sysbus_init_child_obj(OBJECT(s), name, | 44 | bool |
50 | + &s->lpd.iou.gem[i], sizeof(s->lpd.iou.gem[i]), | ||
51 | + TYPE_CADENCE_GEM); | ||
52 | + dev = DEVICE(&s->lpd.iou.gem[i]); | ||
53 | if (nd->used) { | ||
54 | qemu_check_nic_model(nd, "cadence_gem"); | ||
55 | qdev_set_nic_properties(dev, nd); | ||
56 | } | ||
57 | - object_property_set_int(OBJECT(s->lpd.iou.gem[i]), | ||
58 | + object_property_set_int(OBJECT(dev), | ||
59 | 2, "num-priority-queues", | ||
60 | &error_abort); | ||
61 | - object_property_set_link(OBJECT(s->lpd.iou.gem[i]), | ||
62 | + object_property_set_link(OBJECT(dev), | ||
63 | OBJECT(&s->mr_ps), "dma", | ||
64 | &error_abort); | ||
65 | qdev_init_nofail(dev); | ||
66 | |||
67 | - mr = sysbus_mmio_get_region(s->lpd.iou.gem[i], 0); | ||
68 | + mr = sysbus_mmio_get_region(SYS_BUS_DEVICE(dev), 0); | ||
69 | memory_region_add_subregion(&s->mr_ps, addrs[i], mr); | ||
70 | |||
71 | - sysbus_connect_irq(s->lpd.iou.gem[i], 0, pic[irqs[i]]); | ||
72 | + sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, pic[irqs[i]]); | ||
73 | g_free(name); | ||
74 | } | ||
75 | } | ||
76 | -- | 45 | -- |
77 | 2.20.1 | 46 | 2.20.1 |
78 | 47 | ||
79 | 48 | diff view generated by jsdifflib |
1 | From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com> | 1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> |
---|---|---|---|
2 | 2 | ||
3 | Embed the UARTs into the SoC type. | 3 | Register the GPIO peripherals as unimplemented to better |
4 | follow their accesses, for example booting Zephyr: | ||
4 | 5 | ||
5 | Suggested-by: Peter Maydell <peter.maydell@linaro.org> | 6 | ---------------- |
6 | Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | 7 | IN: arm_mps2_pinmux_init |
7 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | 8 | 0x00001160: f64f 0231 movw r2, #0xf831 |
8 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 9 | 0x00001164: 4b06 ldr r3, [pc, #0x18] |
9 | Reviewed-by: Luc Michel <luc.michel@greensocs.com> | 10 | 0x00001166: 2000 movs r0, #0 |
10 | Message-id: 20200427181649.26851-5-edgar.iglesias@gmail.com | 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 | ||
11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 26 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
12 | --- | 27 | --- |
13 | include/hw/arm/xlnx-versal.h | 3 ++- | 28 | hw/arm/mps2.c | 8 ++++++-- |
14 | hw/arm/xlnx-versal.c | 12 ++++++------ | 29 | 1 file changed, 6 insertions(+), 2 deletions(-) |
15 | 2 files changed, 8 insertions(+), 7 deletions(-) | ||
16 | 30 | ||
17 | diff --git a/include/hw/arm/xlnx-versal.h b/include/hw/arm/xlnx-versal.h | 31 | diff --git a/hw/arm/mps2.c b/hw/arm/mps2.c |
18 | index XXXXXXX..XXXXXXX 100644 | 32 | index XXXXXXX..XXXXXXX 100644 |
19 | --- a/include/hw/arm/xlnx-versal.h | 33 | --- a/hw/arm/mps2.c |
20 | +++ b/include/hw/arm/xlnx-versal.h | 34 | +++ b/hw/arm/mps2.c |
21 | @@ -XXX,XX +XXX,XX @@ | 35 | @@ -XXX,XX +XXX,XX @@ static void mps2_common_init(MachineState *machine) |
22 | #include "hw/sysbus.h" | 36 | MemoryRegion *system_memory = get_system_memory(); |
23 | #include "hw/arm/boot.h" | 37 | MachineClass *mc = MACHINE_GET_CLASS(machine); |
24 | #include "hw/intc/arm_gicv3.h" | 38 | DeviceState *armv7m, *sccdev; |
25 | +#include "hw/char/pl011.h" | 39 | + int i; |
26 | 40 | ||
27 | #define TYPE_XLNX_VERSAL "xlnx-versal" | 41 | if (strcmp(machine->cpu_type, mc->default_cpu_type) != 0) { |
28 | #define XLNX_VERSAL(obj) OBJECT_CHECK(Versal, (obj), TYPE_XLNX_VERSAL) | 42 | error_report("This board can only be used with CPU %s", |
29 | @@ -XXX,XX +XXX,XX @@ typedef struct Versal { | 43 | @@ -XXX,XX +XXX,XX @@ static void mps2_common_init(MachineState *machine) |
30 | MemoryRegion mr_ocm; | 44 | */ |
31 | 45 | Object *orgate; | |
32 | struct { | 46 | DeviceState *orgate_dev; |
33 | - SysBusDevice *uart[XLNX_VERSAL_NR_UARTS]; | 47 | - int i; |
34 | + PL011State uart[XLNX_VERSAL_NR_UARTS]; | 48 | |
35 | SysBusDevice *gem[XLNX_VERSAL_NR_GEMS]; | 49 | orgate = object_new(TYPE_OR_IRQ); |
36 | SysBusDevice *adma[XLNX_VERSAL_NR_ADMAS]; | 50 | object_property_set_int(orgate, 6, "num-lines", &error_fatal); |
37 | } iou; | 51 | @@ -XXX,XX +XXX,XX @@ static void mps2_common_init(MachineState *machine) |
38 | diff --git a/hw/arm/xlnx-versal.c b/hw/arm/xlnx-versal.c | 52 | */ |
39 | index XXXXXXX..XXXXXXX 100644 | 53 | Object *orgate; |
40 | --- a/hw/arm/xlnx-versal.c | 54 | DeviceState *orgate_dev; |
41 | +++ b/hw/arm/xlnx-versal.c | 55 | - int i; |
42 | @@ -XXX,XX +XXX,XX @@ | 56 | |
43 | #include "kvm_arm.h" | 57 | orgate = object_new(TYPE_OR_IRQ); |
44 | #include "hw/misc/unimp.h" | 58 | object_property_set_int(orgate, 10, "num-lines", &error_fatal); |
45 | #include "hw/arm/xlnx-versal.h" | 59 | @@ -XXX,XX +XXX,XX @@ static void mps2_common_init(MachineState *machine) |
46 | -#include "hw/char/pl011.h" | 60 | default: |
47 | 61 | g_assert_not_reached(); | |
48 | #define XLNX_VERSAL_ACPU_TYPE ARM_CPU_TYPE_NAME("cortex-a72") | ||
49 | #define GEM_REVISION 0x40070106 | ||
50 | @@ -XXX,XX +XXX,XX @@ static void versal_create_uarts(Versal *s, qemu_irq *pic) | ||
51 | DeviceState *dev; | ||
52 | MemoryRegion *mr; | ||
53 | |||
54 | - dev = qdev_create(NULL, TYPE_PL011); | ||
55 | - s->lpd.iou.uart[i] = SYS_BUS_DEVICE(dev); | ||
56 | + sysbus_init_child_obj(OBJECT(s), name, | ||
57 | + &s->lpd.iou.uart[i], sizeof(s->lpd.iou.uart[i]), | ||
58 | + TYPE_PL011); | ||
59 | + dev = DEVICE(&s->lpd.iou.uart[i]); | ||
60 | qdev_prop_set_chr(dev, "chardev", serial_hd(i)); | ||
61 | - object_property_add_child(OBJECT(s), name, OBJECT(dev), &error_fatal); | ||
62 | qdev_init_nofail(dev); | ||
63 | |||
64 | - mr = sysbus_mmio_get_region(s->lpd.iou.uart[i], 0); | ||
65 | + mr = sysbus_mmio_get_region(SYS_BUS_DEVICE(dev), 0); | ||
66 | memory_region_add_subregion(&s->mr_ps, addrs[i], mr); | ||
67 | |||
68 | - sysbus_connect_irq(s->lpd.iou.uart[i], 0, pic[irqs[i]]); | ||
69 | + sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, pic[irqs[i]]); | ||
70 | g_free(name); | ||
71 | } | 62 | } |
72 | } | 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); | ||
73 | -- | 71 | -- |
74 | 2.20.1 | 72 | 2.20.1 |
75 | 73 | ||
76 | 74 | diff view generated by jsdifflib |
1 | From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com> | 1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> |
---|---|---|---|
2 | 2 | ||
3 | Move misplaced comment. | 3 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> |
4 | 4 | Message-id: 20200617072539.32686-11-f4bug@amsat.org | |
5 | Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | 5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
6 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | ||
7 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
8 | Reviewed-by: Luc Michel <luc.michel@greensocs.com> | ||
9 | Message-id: 20200427181649.26851-3-edgar.iglesias@gmail.com | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
11 | --- | 7 | --- |
12 | hw/arm/xlnx-versal.c | 2 +- | 8 | hw/arm/mps2.c | 9 +++++++++ |
13 | 1 file changed, 1 insertion(+), 1 deletion(-) | 9 | 1 file changed, 9 insertions(+) |
14 | 10 | ||
15 | diff --git a/hw/arm/xlnx-versal.c b/hw/arm/xlnx-versal.c | 11 | diff --git a/hw/arm/mps2.c b/hw/arm/mps2.c |
16 | index XXXXXXX..XXXXXXX 100644 | 12 | index XXXXXXX..XXXXXXX 100644 |
17 | --- a/hw/arm/xlnx-versal.c | 13 | --- a/hw/arm/mps2.c |
18 | +++ b/hw/arm/xlnx-versal.c | 14 | +++ b/hw/arm/mps2.c |
19 | @@ -XXX,XX +XXX,XX @@ static void versal_create_apu_cpus(Versal *s) | 15 | @@ -XXX,XX +XXX,XX @@ |
20 | 16 | #include "hw/timer/cmsdk-apb-timer.h" | |
21 | obj = object_new(XLNX_VERSAL_ACPU_TYPE); | 17 | #include "hw/timer/cmsdk-apb-dualtimer.h" |
22 | if (!obj) { | 18 | #include "hw/misc/mps2-scc.h" |
23 | - /* Secondary CPUs start in PSCI powered-down state */ | 19 | +#include "hw/misc/mps2-fpgaio.h" |
24 | error_report("Unable to create apu.cpu[%d] of type %s", | 20 | #include "hw/net/lan9118.h" |
25 | i, XLNX_VERSAL_ACPU_TYPE); | 21 | #include "net/net.h" |
26 | exit(EXIT_FAILURE); | 22 | +#include "hw/watchdog/cmsdk-apb-watchdog.h" |
27 | @@ -XXX,XX +XXX,XX @@ static void versal_create_apu_cpus(Versal *s) | 23 | |
28 | object_property_set_int(obj, s->cfg.psci_conduit, | 24 | typedef enum MPS2FPGAType { |
29 | "psci-conduit", &error_abort); | 25 | FPGA_AN385, |
30 | if (i) { | 26 | @@ -XXX,XX +XXX,XX @@ typedef struct { |
31 | + /* Secondary CPUs start in PSCI powered-down state */ | 27 | MemoryRegion sram; |
32 | object_property_set_bool(obj, true, | 28 | /* FPGA APB subsystem */ |
33 | "start-powered-off", &error_abort); | 29 | MPS2SCC scc; |
34 | } | 30 | + MPS2FPGAIO fpgaio; |
31 | /* CMSDK APB subsystem */ | ||
32 | CMSDKAPBDualTimer dualtimer; | ||
33 | + CMSDKAPBWatchdog watchdog; | ||
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. | ||
35 | -- | 49 | -- |
36 | 2.20.1 | 50 | 2.20.1 |
37 | 51 | ||
38 | 52 | diff view generated by jsdifflib |
1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> | 1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> |
---|---|---|---|
2 | 2 | ||
3 | MIDR_EL1 is a 64-bit system register with the top 32-bit being RES0. | 3 | From 'Application Note AN385', chapter 3.9, SPI: |
4 | Represent it in QEMU's ARMCPU struct with a uint64_t, not a | ||
5 | uint32_t. | ||
6 | 4 | ||
7 | This fixes an error when compiling with -Werror=conversion | 5 | The SMM implements five PL022 SPI modules. |
8 | because we were manipulating the register value using a | ||
9 | local uint64_t variable: | ||
10 | 6 | ||
11 | target/arm/cpu64.c: In function ‘aarch64_max_initfn’: | 7 | Two pairs of modules share the same OR-gated IRQ. |
12 | target/arm/cpu64.c:628:21: error: conversion from ‘uint64_t’ {aka ‘long unsigned int’} to ‘uint32_t’ {aka ‘unsigned int’} may change value [-Werror=conversion] | ||
13 | 628 | cpu->midr = t; | ||
14 | | ^ | ||
15 | 8 | ||
16 | and future-proofs us against a possible future architecture | ||
17 | change using some of the top 32 bits. | ||
18 | |||
19 | Suggested-by: Laurent Desnogues <laurent.desnogues@gmail.com> | ||
20 | Suggested-by: Peter Maydell <peter.maydell@linaro.org> | ||
21 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 9 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> |
22 | Reviewed-by: Laurent Desnogues <laurent.desnogues@gmail.com> | 10 | Message-id: 20200617072539.32686-12-f4bug@amsat.org |
23 | Message-id: 20200428172634.29707-1-f4bug@amsat.org | ||
24 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 11 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
25 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
26 | --- | 13 | --- |
27 | target/arm/cpu.h | 2 +- | 14 | hw/arm/mps2.c | 24 ++++++++++++++++++++++++ |
28 | target/arm/cpu.c | 2 +- | 15 | hw/arm/Kconfig | 6 +++--- |
29 | 2 files changed, 2 insertions(+), 2 deletions(-) | 16 | 2 files changed, 27 insertions(+), 3 deletions(-) |
30 | 17 | ||
31 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h | 18 | diff --git a/hw/arm/mps2.c b/hw/arm/mps2.c |
32 | index XXXXXXX..XXXXXXX 100644 | 19 | index XXXXXXX..XXXXXXX 100644 |
33 | --- a/target/arm/cpu.h | 20 | --- a/hw/arm/mps2.c |
34 | +++ b/target/arm/cpu.h | 21 | +++ b/hw/arm/mps2.c |
35 | @@ -XXX,XX +XXX,XX @@ struct ARMCPU { | 22 | @@ -XXX,XX +XXX,XX @@ |
36 | uint64_t id_aa64dfr0; | 23 | #include "hw/timer/cmsdk-apb-dualtimer.h" |
37 | uint64_t id_aa64dfr1; | 24 | #include "hw/misc/mps2-scc.h" |
38 | } isar; | 25 | #include "hw/misc/mps2-fpgaio.h" |
39 | - uint32_t midr; | 26 | +#include "hw/ssi/pl022.h" |
40 | + uint64_t midr; | 27 | #include "hw/net/lan9118.h" |
41 | uint32_t revidr; | 28 | #include "net/net.h" |
42 | uint32_t reset_fpsid; | 29 | #include "hw/watchdog/cmsdk-apb-watchdog.h" |
43 | uint32_t ctr; | 30 | @@ -XXX,XX +XXX,XX @@ static void mps2_common_init(MachineState *machine) |
44 | diff --git a/target/arm/cpu.c b/target/arm/cpu.c | 31 | qdev_prop_set_uint32(DEVICE(&mms->fpgaio), "prescale-clk", 25000000); |
32 | sysbus_realize(SYS_BUS_DEVICE(&mms->fpgaio), &error_fatal); | ||
33 | sysbus_mmio_map(SYS_BUS_DEVICE(&mms->fpgaio), 0, 0x40028000); | ||
34 | + sysbus_create_simple(TYPE_PL022, 0x40025000, /* External ADC */ | ||
35 | + qdev_get_gpio_in(armv7m, 22)); | ||
36 | + for (i = 0; i < 2; i++) { | ||
37 | + static const int spi_irqno[] = {11, 24}; | ||
38 | + static const hwaddr spibase[] = {0x40020000, /* APB */ | ||
39 | + 0x40021000, /* LCD */ | ||
40 | + 0x40026000, /* Shield0 */ | ||
41 | + 0x40027000}; /* Shield1 */ | ||
42 | + DeviceState *orgate_dev; | ||
43 | + Object *orgate; | ||
44 | + int j; | ||
45 | + | ||
46 | + orgate = object_new(TYPE_OR_IRQ); | ||
47 | + object_property_set_int(orgate, 2, "num-lines", &error_fatal); | ||
48 | + orgate_dev = DEVICE(orgate); | ||
49 | + qdev_realize(orgate_dev, NULL, &error_fatal); | ||
50 | + qdev_connect_gpio_out(orgate_dev, 0, | ||
51 | + qdev_get_gpio_in(armv7m, spi_irqno[i])); | ||
52 | + for (j = 0; j < 2; j++) { | ||
53 | + sysbus_create_simple(TYPE_PL022, spibase[2 * i + j], | ||
54 | + qdev_get_gpio_in(orgate_dev, j)); | ||
55 | + } | ||
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 | ||
45 | index XXXXXXX..XXXXXXX 100644 | 61 | index XXXXXXX..XXXXXXX 100644 |
46 | --- a/target/arm/cpu.c | 62 | --- a/hw/arm/Kconfig |
47 | +++ b/target/arm/cpu.c | 63 | +++ b/hw/arm/Kconfig |
48 | @@ -XXX,XX +XXX,XX @@ static const ARMCPUInfo arm_cpus[] = { | 64 | @@ -XXX,XX +XXX,XX @@ config HIGHBANK |
49 | static Property arm_cpu_properties[] = { | 65 | select ARM_TIMER # sp804 |
50 | DEFINE_PROP_BOOL("start-powered-off", ARMCPU, start_powered_off, false), | 66 | select ARM_V7M |
51 | DEFINE_PROP_UINT32("psci-conduit", ARMCPU, psci_conduit, 0), | 67 | select PL011 # UART |
52 | - DEFINE_PROP_UINT32("midr", ARMCPU, midr, 0), | 68 | - select PL022 # Serial port |
53 | + DEFINE_PROP_UINT64("midr", ARMCPU, midr, 0), | 69 | + select PL022 # SPI |
54 | DEFINE_PROP_UINT64("mp-affinity", ARMCPU, | 70 | select PL031 # RTC |
55 | mp_affinity, ARM64_AFFINITY_INVALID), | 71 | select PL061 # GPIO |
56 | DEFINE_PROP_INT32("node-id", ARMCPU, node_id, CPU_UNSET_NUMA_NODE_ID), | 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 | ||
57 | -- | 91 | -- |
58 | 2.20.1 | 92 | 2.20.1 |
59 | 93 | ||
60 | 94 | diff view generated by jsdifflib |
1 | In aarch64_max_initfn() we update both 32-bit and 64-bit ID | 1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> |
---|---|---|---|
2 | registers. The intended pattern is that for 64-bit ID registers we | ||
3 | use FIELD_DP64 and the uint64_t 't' register, while 32-bit ID | ||
4 | registers use FIELD_DP32 and the uint32_t 'u' register. For | ||
5 | ID_AA64DFR0 we accidentally used 'u', meaning that the top 32 bits of | ||
6 | this 64-bit ID register would end up always zero. Luckily at the | ||
7 | moment that's what they should be anyway, so this bug has no visible | ||
8 | effects. | ||
9 | 2 | ||
10 | Use the right-sized variable. | 3 | From 'Application Note AN385', chapter 3.14: |
11 | 4 | ||
12 | Fixes: 3bec78447a958d481991 | 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 | ||
11 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
13 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
14 | Reviewed-by: Laurent Desnogues <laurent.desnogues@gmail.com> | ||
15 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
16 | Message-id: 20200423110915.10527-1-peter.maydell@linaro.org | ||
17 | --- | 13 | --- |
18 | target/arm/cpu64.c | 6 +++--- | 14 | hw/arm/mps2.c | 8 ++++++++ |
19 | 1 file changed, 3 insertions(+), 3 deletions(-) | 15 | hw/arm/Kconfig | 1 + |
16 | 2 files changed, 9 insertions(+) | ||
20 | 17 | ||
21 | diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c | 18 | diff --git a/hw/arm/mps2.c b/hw/arm/mps2.c |
22 | index XXXXXXX..XXXXXXX 100644 | 19 | index XXXXXXX..XXXXXXX 100644 |
23 | --- a/target/arm/cpu64.c | 20 | --- a/hw/arm/mps2.c |
24 | +++ b/target/arm/cpu64.c | 21 | +++ b/hw/arm/mps2.c |
25 | @@ -XXX,XX +XXX,XX @@ static void aarch64_max_initfn(Object *obj) | 22 | @@ -XXX,XX +XXX,XX @@ |
26 | u = FIELD_DP32(u, ID_MMFR4, XNX, 1); /* TTS2UXN */ | 23 | #include "hw/misc/mps2-scc.h" |
27 | cpu->isar.id_mmfr4 = u; | 24 | #include "hw/misc/mps2-fpgaio.h" |
28 | 25 | #include "hw/ssi/pl022.h" | |
29 | - u = cpu->isar.id_aa64dfr0; | 26 | +#include "hw/i2c/arm_sbcon_i2c.h" |
30 | - u = FIELD_DP64(u, ID_AA64DFR0, PMUVER, 5); /* v8.4-PMU */ | 27 | #include "hw/net/lan9118.h" |
31 | - cpu->isar.id_aa64dfr0 = u; | 28 | #include "net/net.h" |
32 | + t = cpu->isar.id_aa64dfr0; | 29 | #include "hw/watchdog/cmsdk-apb-watchdog.h" |
33 | + t = FIELD_DP64(t, ID_AA64DFR0, PMUVER, 5); /* v8.4-PMU */ | 30 | @@ -XXX,XX +XXX,XX @@ static void mps2_common_init(MachineState *machine) |
34 | + cpu->isar.id_aa64dfr0 = t; | 31 | qdev_get_gpio_in(orgate_dev, j)); |
35 | 32 | } | |
36 | u = cpu->isar.id_dfr0; | 33 | } |
37 | u = FIELD_DP32(u, ID_DFR0, PERFMON, 5); /* v8.4-PMU */ | 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 | ||
38 | -- | 56 | -- |
39 | 2.20.1 | 57 | 2.20.1 |
40 | 58 | ||
41 | 59 | diff view generated by jsdifflib |
1 | From: Fredrik Strupe <fredrik@strupe.net> | 1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> |
---|---|---|---|
2 | 2 | ||
3 | According to Arm ARM, VQDMULL is only valid when U=0, while having | 3 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> |
4 | U=1 is unallocated. | 4 | Message-id: 20200617072539.32686-14-f4bug@amsat.org |
5 | |||
6 | Signed-off-by: Fredrik Strupe <fredrik@strupe.net> | ||
7 | Fixes: 695272dcb976 ("target-arm: Handle UNDEF cases for Neon 3-regs-different-widths") | ||
8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
10 | --- | 7 | --- |
11 | target/arm/translate.c | 2 +- | 8 | hw/arm/mps2.c | 1 + |
12 | 1 file changed, 1 insertion(+), 1 deletion(-) | 9 | 1 file changed, 1 insertion(+) |
13 | 10 | ||
14 | diff --git a/target/arm/translate.c b/target/arm/translate.c | 11 | diff --git a/hw/arm/mps2.c b/hw/arm/mps2.c |
15 | index XXXXXXX..XXXXXXX 100644 | 12 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/target/arm/translate.c | 13 | --- a/hw/arm/mps2.c |
17 | +++ b/target/arm/translate.c | 14 | +++ b/hw/arm/mps2.c |
18 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) | 15 | @@ -XXX,XX +XXX,XX @@ static void mps2_common_init(MachineState *machine) |
19 | {0, 0, 0, 0}, /* VMLSL */ | 16 | 0x4002a000}; /* Shield1 */ |
20 | {0, 0, 0, 9}, /* VQDMLSL */ | 17 | sysbus_create_simple(TYPE_ARM_SBCON_I2C, i2cbase[i], NULL); |
21 | {0, 0, 0, 0}, /* Integer VMULL */ | 18 | } |
22 | - {0, 0, 0, 1}, /* VQDMULL */ | 19 | + create_unimplemented_device("i2s", 0x40024000, 0x400); |
23 | + {0, 0, 0, 9}, /* VQDMULL */ | 20 | |
24 | {0, 0, 0, 0xa}, /* Polynomial VMULL */ | 21 | /* In hardware this is a LAN9220; the LAN9118 is software compatible |
25 | {0, 0, 0, 7}, /* Reserved: always UNDEF */ | 22 | * except that it doesn't support the checksum-offload feature. |
26 | }; | ||
27 | -- | 23 | -- |
28 | 2.20.1 | 24 | 2.20.1 |
29 | 25 | ||
30 | 26 | diff view generated by jsdifflib |
1 | From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com> | 1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> |
---|---|---|---|
2 | 2 | ||
3 | Add support for the RTC. | 3 | From 'Application Note AN521', chapter 4.7: |
4 | 4 | ||
5 | Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | 5 | The SMM implements four SBCon serial modules: |
6 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | 6 | |
7 | Reviewed-by: Luc Michel <luc.michel@greensocs.com> | 7 | One SBCon module for use by the Color LCD touch interface. |
8 | Message-id: 20200427181649.26851-12-edgar.iglesias@gmail.com | 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> | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 16 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
10 | --- | 17 | --- |
11 | hw/arm/xlnx-versal-virt.c | 22 ++++++++++++++++++++++ | 18 | hw/arm/mps2-tz.c | 23 ++++++++++++++++++----- |
12 | 1 file changed, 22 insertions(+) | 19 | 1 file changed, 18 insertions(+), 5 deletions(-) |
13 | 20 | ||
14 | diff --git a/hw/arm/xlnx-versal-virt.c b/hw/arm/xlnx-versal-virt.c | 21 | diff --git a/hw/arm/mps2-tz.c b/hw/arm/mps2-tz.c |
15 | index XXXXXXX..XXXXXXX 100644 | 22 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/hw/arm/xlnx-versal-virt.c | 23 | --- a/hw/arm/mps2-tz.c |
17 | +++ b/hw/arm/xlnx-versal-virt.c | 24 | +++ b/hw/arm/mps2-tz.c |
18 | @@ -XXX,XX +XXX,XX @@ static void fdt_add_sd_nodes(VersalVirt *s) | 25 | @@ -XXX,XX +XXX,XX @@ |
19 | } | 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); | ||
20 | } | 44 | } |
21 | 45 | ||
22 | +static void fdt_add_rtc_node(VersalVirt *s) | 46 | +static MemoryRegion *make_i2c(MPS2TZMachineState *mms, void *opaque, |
47 | + const char *name, hwaddr size) | ||
23 | +{ | 48 | +{ |
24 | + const char compat[] = "xlnx,zynqmp-rtc"; | 49 | + ArmSbconI2CState *i2c = opaque; |
25 | + const char interrupt_names[] = "alarm\0sec"; | 50 | + SysBusDevice *s; |
26 | + char *name = g_strdup_printf("/rtc@%x", MM_PMC_RTC); | ||
27 | + | 51 | + |
28 | + qemu_fdt_add_subnode(s->fdt, name); | 52 | + object_initialize_child(OBJECT(mms), name, i2c, TYPE_ARM_SBCON_I2C); |
29 | + | 53 | + s = SYS_BUS_DEVICE(i2c); |
30 | + qemu_fdt_setprop_cells(s->fdt, name, "interrupts", | 54 | + sysbus_realize(s, &error_fatal); |
31 | + GIC_FDT_IRQ_TYPE_SPI, VERSAL_RTC_ALARM_IRQ, | 55 | + return sysbus_mmio_get_region(s, 0); |
32 | + GIC_FDT_IRQ_FLAGS_LEVEL_HI, | ||
33 | + GIC_FDT_IRQ_TYPE_SPI, VERSAL_RTC_SECONDS_IRQ, | ||
34 | + GIC_FDT_IRQ_FLAGS_LEVEL_HI); | ||
35 | + qemu_fdt_setprop(s->fdt, name, "interrupt-names", | ||
36 | + interrupt_names, sizeof(interrupt_names)); | ||
37 | + qemu_fdt_setprop_sized_cells(s->fdt, name, "reg", | ||
38 | + 2, MM_PMC_RTC, 2, MM_PMC_RTC_SIZE); | ||
39 | + qemu_fdt_setprop(s->fdt, name, "compatible", compat, sizeof(compat)); | ||
40 | + g_free(name); | ||
41 | +} | 56 | +} |
42 | + | 57 | + |
43 | static void fdt_nop_memory_nodes(void *fdt, Error **errp) | 58 | static void mps2tz_common_init(MachineState *machine) |
44 | { | 59 | { |
45 | Error *err = NULL; | 60 | MPS2TZMachineState *mms = MPS2TZ_MACHINE(machine); |
46 | @@ -XXX,XX +XXX,XX @@ static void versal_virt_init(MachineState *machine) | 61 | @@ -XXX,XX +XXX,XX @@ static void mps2tz_common_init(MachineState *machine) |
47 | fdt_add_timer_nodes(s); | 62 | { "uart2", make_uart, &mms->uart[2], 0x40202000, 0x1000 }, |
48 | fdt_add_zdma_nodes(s); | 63 | { "uart3", make_uart, &mms->uart[3], 0x40203000, 0x1000 }, |
49 | fdt_add_sd_nodes(s); | 64 | { "uart4", make_uart, &mms->uart[4], 0x40204000, 0x1000 }, |
50 | + fdt_add_rtc_node(s); | 65 | - { "i2c0", make_unimp_dev, &mms->i2c[0], 0x40207000, 0x1000 }, |
51 | fdt_add_cpu_nodes(s, psci_conduit); | 66 | - { "i2c1", make_unimp_dev, &mms->i2c[1], 0x40208000, 0x1000 }, |
52 | fdt_add_clk_node(s, "/clk125", 125000000, s->phandle.clk_125Mhz); | 67 | - { "i2c2", make_unimp_dev, &mms->i2c[2], 0x4020c000, 0x1000 }, |
53 | fdt_add_clk_node(s, "/clk25", 25000000, s->phandle.clk_25Mhz); | 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", | ||
54 | -- | 76 | -- |
55 | 2.20.1 | 77 | 2.20.1 |
56 | 78 | ||
57 | 79 | diff view generated by jsdifflib |
1 | The ARMv8.2-TTS2UXN feature extends the XN field in stage 2 | 1 | From: Philippe Mathieu-Daudé <philmd@redhat.com> |
---|---|---|---|
2 | translation table descriptors from just bit [54] to bits [54:53], | 2 | |
3 | allowing stage 2 to control execution permissions separately for EL0 | 3 | Since commit d70c996df23f, when enabling the PMU we get: |
4 | and EL1. Implement the new semantics of the XN field and enable | 4 | |
5 | the feature for our 'max' CPU. | 5 | $ qemu-system-aarch64 -cpu host,pmu=on -M virt,accel=kvm,gic-version=3 |
6 | 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> | ||
7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 48 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
8 | Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | ||
9 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
10 | Message-id: 20200330210400.11724-5-peter.maydell@linaro.org | ||
11 | --- | 49 | --- |
12 | target/arm/cpu.h | 15 +++++++++++++++ | 50 | target/arm/kvm_arm.h | 21 +++++++++------------ |
13 | target/arm/cpu.c | 1 + | 51 | target/arm/cpu.c | 2 +- |
14 | target/arm/cpu64.c | 2 ++ | 52 | target/arm/cpu64.c | 10 +++++----- |
15 | target/arm/helper.c | 37 +++++++++++++++++++++++++++++++------ | 53 | target/arm/kvm.c | 4 ++-- |
16 | 4 files changed, 49 insertions(+), 6 deletions(-) | 54 | target/arm/kvm64.c | 14 +++++--------- |
17 | 55 | 5 files changed, 22 insertions(+), 29 deletions(-) | |
18 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h | 56 | |
19 | index XXXXXXX..XXXXXXX 100644 | 57 | diff --git a/target/arm/kvm_arm.h b/target/arm/kvm_arm.h |
20 | --- a/target/arm/cpu.h | 58 | index XXXXXXX..XXXXXXX 100644 |
21 | +++ b/target/arm/cpu.h | 59 | --- a/target/arm/kvm_arm.h |
22 | @@ -XXX,XX +XXX,XX @@ static inline bool isar_feature_aa32_ccidx(const ARMISARegisters *id) | 60 | +++ b/target/arm/kvm_arm.h |
23 | return FIELD_EX32(id->id_mmfr4, ID_MMFR4, CCIDX) != 0; | 61 | @@ -XXX,XX +XXX,XX @@ void kvm_arm_add_vcpu_properties(Object *obj); |
24 | } | 62 | |
25 | 63 | /** | |
26 | +static inline bool isar_feature_aa32_tts2uxn(const ARMISARegisters *id) | 64 | * kvm_arm_aarch32_supported: |
27 | +{ | 65 | - * @cs: CPUState |
28 | + return FIELD_EX32(id->id_mmfr4, ID_MMFR4, XNX) != 0; | 66 | * |
29 | +} | 67 | - * Returns: true if the KVM VCPU can enable AArch32 mode |
30 | + | 68 | + * Returns: true if KVM can enable AArch32 mode |
31 | /* | 69 | * and false otherwise. |
32 | * 64-bit feature tests via id registers. | ||
33 | */ | 70 | */ |
34 | @@ -XXX,XX +XXX,XX @@ static inline bool isar_feature_aa64_ccidx(const ARMISARegisters *id) | 71 | -bool kvm_arm_aarch32_supported(CPUState *cs); |
35 | return FIELD_EX64(id->id_aa64mmfr2, ID_AA64MMFR2, CCIDX) != 0; | 72 | +bool kvm_arm_aarch32_supported(void); |
36 | } | 73 | |
37 | 74 | /** | |
38 | +static inline bool isar_feature_aa64_tts2uxn(const ARMISARegisters *id) | 75 | * kvm_arm_pmu_supported: |
39 | +{ | 76 | - * @cs: CPUState |
40 | + return FIELD_EX64(id->id_aa64mmfr1, ID_AA64MMFR1, XNX) != 0; | 77 | * |
41 | +} | 78 | - * Returns: true if the KVM VCPU can enable its PMU |
42 | + | 79 | + * Returns: true if KVM can enable the PMU |
43 | /* | 80 | * and false otherwise. |
44 | * Feature tests for "does this exist in either 32-bit or 64-bit?" | ||
45 | */ | 81 | */ |
46 | @@ -XXX,XX +XXX,XX @@ static inline bool isar_feature_any_ccidx(const ARMISARegisters *id) | 82 | -bool kvm_arm_pmu_supported(CPUState *cs); |
47 | return isar_feature_aa64_ccidx(id) || isar_feature_aa32_ccidx(id); | 83 | +bool kvm_arm_pmu_supported(void); |
48 | } | 84 | |
49 | 85 | /** | |
50 | +static inline bool isar_feature_any_tts2uxn(const ARMISARegisters *id) | 86 | * kvm_arm_sve_supported: |
51 | +{ | 87 | - * @cs: CPUState |
52 | + return isar_feature_aa64_tts2uxn(id) || isar_feature_aa32_tts2uxn(id); | 88 | * |
53 | +} | 89 | - * Returns true if the KVM VCPU can enable SVE and false otherwise. |
54 | + | 90 | + * Returns true if KVM can enable SVE and false otherwise. |
55 | /* | ||
56 | * Forward to the above feature tests given an ARMCPU pointer. | ||
57 | */ | 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 | } | ||
58 | diff --git a/target/arm/cpu.c b/target/arm/cpu.c | 118 | diff --git a/target/arm/cpu.c b/target/arm/cpu.c |
59 | index XXXXXXX..XXXXXXX 100644 | 119 | index XXXXXXX..XXXXXXX 100644 |
60 | --- a/target/arm/cpu.c | 120 | --- a/target/arm/cpu.c |
61 | +++ b/target/arm/cpu.c | 121 | +++ b/target/arm/cpu.c |
62 | @@ -XXX,XX +XXX,XX @@ static void arm_max_initfn(Object *obj) | 122 | @@ -XXX,XX +XXX,XX @@ static void arm_set_pmu(Object *obj, bool value, Error **errp) |
63 | t = FIELD_DP32(t, ID_MMFR4, HPDS, 1); /* AA32HPD */ | 123 | ARMCPU *cpu = ARM_CPU(obj); |
64 | t = FIELD_DP32(t, ID_MMFR4, AC2, 1); /* ACTLR2, HACTLR2 */ | 124 | |
65 | t = FIELD_DP32(t, ID_MMFR4, CNP, 1); /* TTCNP */ | 125 | if (value) { |
66 | + t = FIELD_DP32(t, ID_MMFR4, XNX, 1); /* TTS2UXN */ | 126 | - if (kvm_enabled() && !kvm_arm_pmu_supported(CPU(cpu))) { |
67 | cpu->isar.id_mmfr4 = t; | 127 | + if (kvm_enabled() && !kvm_arm_pmu_supported()) { |
128 | error_setg(errp, "'pmu' feature not supported by KVM on this host"); | ||
129 | return; | ||
68 | } | 130 | } |
69 | #endif | ||
70 | diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c | 131 | diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c |
71 | index XXXXXXX..XXXXXXX 100644 | 132 | index XXXXXXX..XXXXXXX 100644 |
72 | --- a/target/arm/cpu64.c | 133 | --- a/target/arm/cpu64.c |
73 | +++ b/target/arm/cpu64.c | 134 | +++ b/target/arm/cpu64.c |
74 | @@ -XXX,XX +XXX,XX @@ static void aarch64_max_initfn(Object *obj) | 135 | @@ -XXX,XX +XXX,XX @@ void arm_cpu_sve_finalize(ARMCPU *cpu, Error **errp) |
75 | t = FIELD_DP64(t, ID_AA64MMFR1, VH, 1); | 136 | |
76 | t = FIELD_DP64(t, ID_AA64MMFR1, PAN, 2); /* ATS1E1 */ | 137 | /* Collect the set of vector lengths supported by KVM. */ |
77 | t = FIELD_DP64(t, ID_AA64MMFR1, VMIDBITS, 2); /* VMID16 */ | 138 | bitmap_zero(kvm_supported, ARM_MAX_VQ); |
78 | + t = FIELD_DP64(t, ID_AA64MMFR1, XNX, 1); /* TTS2UXN */ | 139 | - if (kvm_enabled() && kvm_arm_sve_supported(CPU(cpu))) { |
79 | cpu->isar.id_aa64mmfr1 = t; | 140 | + if (kvm_enabled() && kvm_arm_sve_supported()) { |
80 | 141 | kvm_arm_sve_get_vls(CPU(cpu), kvm_supported); | |
81 | t = cpu->isar.id_aa64mmfr2; | 142 | } else if (kvm_enabled()) { |
82 | @@ -XXX,XX +XXX,XX @@ static void aarch64_max_initfn(Object *obj) | 143 | assert(!cpu_isar_feature(aa64_sve, cpu)); |
83 | u = FIELD_DP32(u, ID_MMFR4, HPDS, 1); /* AA32HPD */ | 144 | @@ -XXX,XX +XXX,XX @@ static void cpu_max_set_sve_max_vq(Object *obj, Visitor *v, const char *name, |
84 | u = FIELD_DP32(u, ID_MMFR4, AC2, 1); /* ACTLR2, HACTLR2 */ | 145 | return; |
85 | u = FIELD_DP32(u, ID_MMFR4, CNP, 1); /* TTCNP */ | 146 | } |
86 | + u = FIELD_DP32(u, ID_MMFR4, XNX, 1); /* TTS2UXN */ | 147 | |
87 | cpu->isar.id_mmfr4 = u; | 148 | - if (kvm_enabled() && !kvm_arm_sve_supported(CPU(cpu))) { |
88 | 149 | + if (kvm_enabled() && !kvm_arm_sve_supported()) { | |
89 | u = cpu->isar.id_aa64dfr0; | 150 | error_setg(errp, "cannot set sve-max-vq"); |
90 | diff --git a/target/arm/helper.c b/target/arm/helper.c | 151 | error_append_hint(errp, "SVE not supported by KVM on this host\n"); |
91 | index XXXXXXX..XXXXXXX 100644 | 152 | return; |
92 | --- a/target/arm/helper.c | 153 | @@ -XXX,XX +XXX,XX @@ static void cpu_arm_set_sve_vq(Object *obj, Visitor *v, const char *name, |
93 | +++ b/target/arm/helper.c | 154 | return; |
94 | @@ -XXX,XX +XXX,XX @@ simple_ap_to_rw_prot(CPUARMState *env, ARMMMUIdx mmu_idx, int ap) | 155 | } |
95 | * | 156 | |
96 | * @env: CPUARMState | 157 | - if (value && kvm_enabled() && !kvm_arm_sve_supported(CPU(cpu))) { |
97 | * @s2ap: The 2-bit stage2 access permissions (S2AP) | 158 | + if (value && kvm_enabled() && !kvm_arm_sve_supported()) { |
98 | - * @xn: XN (execute-never) bit | 159 | error_setg(errp, "cannot enable %s", name); |
99 | + * @xn: XN (execute-never) bits | 160 | error_append_hint(errp, "SVE not supported by KVM on this host\n"); |
100 | + * @s1_is_el0: true if this is S2 of an S1+2 walk for EL0 | 161 | return; |
101 | */ | 162 | @@ -XXX,XX +XXX,XX @@ static void cpu_arm_set_sve(Object *obj, Visitor *v, const char *name, |
102 | -static int get_S2prot(CPUARMState *env, int s2ap, int xn) | 163 | return; |
103 | +static int get_S2prot(CPUARMState *env, int s2ap, int xn, bool s1_is_el0) | 164 | } |
104 | { | 165 | |
105 | int prot = 0; | 166 | - if (value && kvm_enabled() && !kvm_arm_sve_supported(CPU(cpu))) { |
106 | 167 | + if (value && kvm_enabled() && !kvm_arm_sve_supported()) { | |
107 | @@ -XXX,XX +XXX,XX @@ static int get_S2prot(CPUARMState *env, int s2ap, int xn) | 168 | error_setg(errp, "'sve' feature not supported by KVM on this host"); |
108 | if (s2ap & 2) { | 169 | return; |
109 | prot |= PAGE_WRITE; | 170 | } |
110 | } | 171 | @@ -XXX,XX +XXX,XX @@ static void aarch64_cpu_set_aarch64(Object *obj, bool value, Error **errp) |
111 | - if (!xn) { | 172 | * uniform execution state like do_interrupt. |
112 | - if (arm_el_is_aa64(env, 2) || prot & PAGE_READ) { | 173 | */ |
113 | + | 174 | if (value == false) { |
114 | + if (cpu_isar_feature(any_tts2uxn, env_archcpu(env))) { | 175 | - if (!kvm_enabled() || !kvm_arm_aarch32_supported(CPU(cpu))) { |
115 | + switch (xn) { | 176 | + if (!kvm_enabled() || !kvm_arm_aarch32_supported()) { |
116 | + case 0: | 177 | error_setg(errp, "'aarch64' feature cannot be disabled " |
117 | prot |= PAGE_EXEC; | 178 | "unless KVM is enabled and 32-bit EL1 " |
118 | + break; | 179 | "is supported"); |
119 | + case 1: | 180 | diff --git a/target/arm/kvm.c b/target/arm/kvm.c |
120 | + if (s1_is_el0) { | 181 | index XXXXXXX..XXXXXXX 100644 |
121 | + prot |= PAGE_EXEC; | 182 | --- a/target/arm/kvm.c |
122 | + } | 183 | +++ b/target/arm/kvm.c |
123 | + break; | 184 | @@ -XXX,XX +XXX,XX @@ void kvm_arm_add_vcpu_properties(Object *obj) |
124 | + case 2: | 185 | } |
125 | + break; | 186 | } |
126 | + case 3: | 187 | |
127 | + if (!s1_is_el0) { | 188 | -bool kvm_arm_pmu_supported(CPUState *cpu) |
128 | + prot |= PAGE_EXEC; | 189 | +bool kvm_arm_pmu_supported(void) |
129 | + } | 190 | { |
130 | + break; | 191 | - return kvm_check_extension(cpu->kvm_state, KVM_CAP_ARM_PMU_V3); |
131 | + default: | 192 | + return kvm_check_extension(kvm_state, KVM_CAP_ARM_PMU_V3); |
132 | + g_assert_not_reached(); | 193 | } |
133 | + } | 194 | |
134 | + } else { | 195 | int kvm_arm_get_max_vm_ipa_size(MachineState *ms) |
135 | + if (!extract32(xn, 1, 1)) { | 196 | diff --git a/target/arm/kvm64.c b/target/arm/kvm64.c |
136 | + if (arm_el_is_aa64(env, 2) || prot & PAGE_READ) { | 197 | index XXXXXXX..XXXXXXX 100644 |
137 | + prot |= PAGE_EXEC; | 198 | --- a/target/arm/kvm64.c |
138 | + } | 199 | +++ b/target/arm/kvm64.c |
139 | } | 200 | @@ -XXX,XX +XXX,XX @@ bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf) |
140 | } | 201 | return true; |
141 | return prot; | 202 | } |
142 | @@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_lpae(CPUARMState *env, target_ulong address, | 203 | |
143 | } | 204 | -bool kvm_arm_aarch32_supported(CPUState *cpu) |
144 | 205 | +bool kvm_arm_aarch32_supported(void) | |
145 | ap = extract32(attrs, 4, 2); | 206 | { |
146 | - xn = extract32(attrs, 12, 1); | 207 | - KVMState *s = KVM_STATE(current_accel()); |
147 | 208 | - | |
148 | if (mmu_idx == ARMMMUIdx_Stage2) { | 209 | - return kvm_check_extension(s, KVM_CAP_ARM_EL1_32BIT); |
149 | ns = true; | 210 | + return kvm_check_extension(kvm_state, KVM_CAP_ARM_EL1_32BIT); |
150 | - *prot = get_S2prot(env, ap, xn); | 211 | } |
151 | + xn = extract32(attrs, 11, 2); | 212 | |
152 | + *prot = get_S2prot(env, ap, xn, s1_is_el0); | 213 | -bool kvm_arm_sve_supported(CPUState *cpu) |
153 | } else { | 214 | +bool kvm_arm_sve_supported(void) |
154 | ns = extract32(attrs, 3, 1); | 215 | { |
155 | + xn = extract32(attrs, 12, 1); | 216 | - KVMState *s = KVM_STATE(current_accel()); |
156 | pxn = extract32(attrs, 11, 1); | 217 | - |
157 | *prot = get_S1prot(env, mmu_idx, aarch64, ap, ns, xn, pxn); | 218 | - return kvm_check_extension(s, KVM_CAP_ARM_SVE); |
158 | } | 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 | |||
159 | -- | 232 | -- |
160 | 2.20.1 | 233 | 2.20.1 |
161 | 234 | ||
162 | 235 | diff view generated by jsdifflib |
1 | For ARMv8.2-TTS2UXN, the stage 2 page table walk wants to know | 1 | From: Andrew Jones <drjones@redhat.com> |
---|---|---|---|
2 | whether the stage 1 access is for EL0 or not, because whether | ||
3 | exec permission is given can depend on whether this is an EL0 | ||
4 | or EL1 access. Add a new argument to get_phys_addr_lpae() so | ||
5 | the call sites can pass this information in. | ||
6 | 2 | ||
7 | Since get_phys_addr_lpae() doesn't already have a doc comment, | 3 | Some cpu features may be enabled and disabled for all configurations |
8 | add one so we have a place to put the documentation of the | 4 | that support the feature. Let's test that. |
9 | semantics of the new s1_is_el0 argument. | ||
10 | 5 | ||
6 | A recent regression[*] inspired adding these tests. | ||
7 | |||
8 | [*] '-cpu host,pmu=on' caused a segfault | ||
9 | |||
10 | Signed-off-by: Andrew Jones <drjones@redhat.com> | ||
11 | Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
12 | Message-id: 20200623090622.30365-2-philmd@redhat.com | ||
13 | Message-Id: <20200623082310.17577-1-drjones@redhat.com> | ||
14 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 15 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
12 | Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | ||
13 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
14 | Message-id: 20200330210400.11724-4-peter.maydell@linaro.org | ||
15 | --- | 16 | --- |
16 | target/arm/helper.c | 29 ++++++++++++++++++++++++++++- | 17 | tests/qtest/arm-cpu-features.c | 38 ++++++++++++++++++++++++++++++---- |
17 | 1 file changed, 28 insertions(+), 1 deletion(-) | 18 | 1 file changed, 34 insertions(+), 4 deletions(-) |
18 | 19 | ||
19 | diff --git a/target/arm/helper.c b/target/arm/helper.c | 20 | diff --git a/tests/qtest/arm-cpu-features.c b/tests/qtest/arm-cpu-features.c |
20 | index XXXXXXX..XXXXXXX 100644 | 21 | index XXXXXXX..XXXXXXX 100644 |
21 | --- a/target/arm/helper.c | 22 | --- a/tests/qtest/arm-cpu-features.c |
22 | +++ b/target/arm/helper.c | 23 | +++ b/tests/qtest/arm-cpu-features.c |
23 | @@ -XXX,XX +XXX,XX @@ | 24 | @@ -XXX,XX +XXX,XX @@ static bool resp_get_feature(QDict *resp, const char *feature) |
24 | 25 | qobject_unref(_resp); \ | |
25 | static bool get_phys_addr_lpae(CPUARMState *env, target_ulong address, | 26 | }) |
26 | MMUAccessType access_type, ARMMMUIdx mmu_idx, | 27 | |
27 | + bool s1_is_el0, | 28 | -#define assert_feature(qts, cpu_type, feature, expected_value) \ |
28 | hwaddr *phys_ptr, MemTxAttrs *txattrs, int *prot, | 29 | +#define resp_assert_feature(resp, feature, expected_value) \ |
29 | target_ulong *page_size_ptr, | 30 | ({ \ |
30 | ARMMMUFaultInfo *fi, ARMCacheAttrs *cacheattrs); | 31 | - QDict *_resp, *_props; \ |
31 | @@ -XXX,XX +XXX,XX @@ static hwaddr S1_ptw_translate(CPUARMState *env, ARMMMUIdx mmu_idx, | 32 | + QDict *_props; \ |
32 | } | 33 | \ |
33 | 34 | - _resp = do_query_no_props(qts, cpu_type); \ | |
34 | ret = get_phys_addr_lpae(env, addr, MMU_DATA_LOAD, ARMMMUIdx_Stage2, | 35 | g_assert(_resp); \ |
35 | + false, | 36 | g_assert(resp_has_props(_resp)); \ |
36 | &s2pa, &txattrs, &s2prot, &s2size, fi, | 37 | _props = resp_get_props(_resp); \ |
37 | pcacheattrs); | 38 | g_assert(qdict_get(_props, feature)); \ |
38 | if (ret) { | 39 | g_assert(qdict_get_bool(_props, feature) == (expected_value)); \ |
39 | @@ -XXX,XX +XXX,XX @@ static ARMVAParameters aa32_va_parameters(CPUARMState *env, uint32_t va, | 40 | +}) |
40 | }; | 41 | + |
41 | } | 42 | +#define assert_feature(qts, cpu_type, feature, expected_value) \ |
42 | 43 | +({ \ | |
43 | +/** | 44 | + QDict *_resp; \ |
44 | + * get_phys_addr_lpae: perform one stage of page table walk, LPAE format | 45 | + \ |
45 | + * | 46 | + _resp = do_query_no_props(qts, cpu_type); \ |
46 | + * Returns false if the translation was successful. Otherwise, phys_ptr, attrs, | 47 | + g_assert(_resp); \ |
47 | + * prot and page_size may not be filled in, and the populated fsr value provides | 48 | + resp_assert_feature(_resp, feature, expected_value); \ |
48 | + * information on why the translation aborted, in the format of a long-format | 49 | + qobject_unref(_resp); \ |
49 | + * DFSR/IFSR fault register, with the following caveats: | 50 | +}) |
50 | + * * the WnR bit is never set (the caller must do this). | 51 | + |
51 | + * | 52 | +#define assert_set_feature(qts, cpu_type, feature, value) \ |
52 | + * @env: CPUARMState | 53 | +({ \ |
53 | + * @address: virtual address to get physical address for | 54 | + const char *_fmt = (value) ? "{ %s: true }" : "{ %s: false }"; \ |
54 | + * @access_type: MMU_DATA_LOAD, MMU_DATA_STORE or MMU_INST_FETCH | 55 | + QDict *_resp; \ |
55 | + * @mmu_idx: MMU index indicating required translation regime | 56 | + \ |
56 | + * @s1_is_el0: if @mmu_idx is ARMMMUIdx_Stage2 (so this is a stage 2 page table | 57 | + _resp = do_query(qts, cpu_type, _fmt, feature); \ |
57 | + * walk), must be true if this is stage 2 of a stage 1+2 walk for an | 58 | + g_assert(_resp); \ |
58 | + * EL0 access). If @mmu_idx is anything else, @s1_is_el0 is ignored. | 59 | + resp_assert_feature(_resp, feature, value); \ |
59 | + * @phys_ptr: set to the physical address corresponding to the virtual address | 60 | qobject_unref(_resp); \ |
60 | + * @attrs: set to the memory transaction attributes to use | 61 | }) |
61 | + * @prot: set to the permissions for the page containing phys_ptr | 62 | |
62 | + * @page_size_ptr: set to the size of the page containing phys_ptr | 63 | @@ -XXX,XX +XXX,XX @@ static void test_query_cpu_model_expansion(const void *data) |
63 | + * @fi: set to fault info if the translation fails | 64 | assert_error(qts, "host", "The CPU type 'host' requires KVM", NULL); |
64 | + * @cacheattrs: (if non-NULL) set to the cacheability/shareability attributes | 65 | |
65 | + */ | 66 | /* Test expected feature presence/absence for some cpu types */ |
66 | static bool get_phys_addr_lpae(CPUARMState *env, target_ulong address, | 67 | - assert_has_feature_enabled(qts, "max", "pmu"); |
67 | MMUAccessType access_type, ARMMMUIdx mmu_idx, | 68 | assert_has_feature_enabled(qts, "cortex-a15", "pmu"); |
68 | + bool s1_is_el0, | 69 | assert_has_not_feature(qts, "cortex-a15", "aarch64"); |
69 | hwaddr *phys_ptr, MemTxAttrs *txattrs, int *prot, | 70 | |
70 | target_ulong *page_size_ptr, | 71 | + /* Enabling and disabling pmu should always work. */ |
71 | ARMMMUFaultInfo *fi, ARMCacheAttrs *cacheattrs) | 72 | + assert_has_feature_enabled(qts, "max", "pmu"); |
72 | @@ -XXX,XX +XXX,XX @@ bool get_phys_addr(CPUARMState *env, target_ulong address, | 73 | + assert_set_feature(qts, "max", "pmu", false); |
73 | 74 | + assert_set_feature(qts, "max", "pmu", true); | |
74 | /* S1 is done. Now do S2 translation. */ | 75 | + |
75 | ret = get_phys_addr_lpae(env, ipa, access_type, ARMMMUIdx_Stage2, | 76 | assert_has_not_feature(qts, "max", "kvm-no-adjvtime"); |
76 | + mmu_idx == ARMMMUIdx_E10_0, | 77 | |
77 | phys_ptr, attrs, &s2_prot, | 78 | if (g_str_equal(qtest_get_arch(), "aarch64")) { |
78 | page_size, fi, | 79 | @@ -XXX,XX +XXX,XX @@ static void test_query_cpu_model_expansion_kvm(const void *data) |
79 | cacheattrs != NULL ? &cacheattrs2 : NULL); | 80 | return; |
80 | @@ -XXX,XX +XXX,XX @@ bool get_phys_addr(CPUARMState *env, target_ulong address, | ||
81 | } | 81 | } |
82 | 82 | ||
83 | if (regime_using_lpae_format(env, mmu_idx)) { | 83 | + /* Enabling and disabling kvm-no-adjvtime should always work. */ |
84 | - return get_phys_addr_lpae(env, address, access_type, mmu_idx, | 84 | assert_has_feature_disabled(qts, "host", "kvm-no-adjvtime"); |
85 | + return get_phys_addr_lpae(env, address, access_type, mmu_idx, false, | 85 | + assert_set_feature(qts, "host", "kvm-no-adjvtime", true); |
86 | phys_ptr, attrs, prot, page_size, | 86 | + assert_set_feature(qts, "host", "kvm-no-adjvtime", false); |
87 | fi, cacheattrs); | 87 | |
88 | } else if (regime_sctlr(env, mmu_idx) & SCTLR_XP) { | 88 | if (g_str_equal(qtest_get_arch(), "aarch64")) { |
89 | bool kvm_supports_sve; | ||
90 | @@ -XXX,XX +XXX,XX @@ static void test_query_cpu_model_expansion_kvm(const void *data) | ||
91 | char *error; | ||
92 | |||
93 | assert_has_feature_enabled(qts, "host", "aarch64"); | ||
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 " | ||
89 | -- | 102 | -- |
90 | 2.20.1 | 103 | 2.20.1 |
91 | 104 | ||
92 | 105 | diff view generated by jsdifflib |
1 | From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com> | 1 | From: Shameer Kolothum <shameerali.kolothum.thodi@huawei.com> |
---|---|---|---|
2 | 2 | ||
3 | Add support for SD. | 3 | This adds support for memory(pc-dimm) hot remove on arm/virt that |
4 | uses acpi ged device. | ||
4 | 5 | ||
5 | Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | 6 | NVDIMM hot removal is not yet supported. |
6 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | 7 | |
7 | Reviewed-by: Luc Michel <luc.michel@greensocs.com> | 8 | Signed-off-by: Shameer Kolothum <shameerali.kolothum.thodi@huawei.com> |
8 | Message-id: 20200427181649.26851-11-edgar.iglesias@gmail.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> | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
10 | --- | 13 | --- |
11 | hw/arm/xlnx-versal-virt.c | 46 +++++++++++++++++++++++++++++++++++++++ | 14 | hw/acpi/generic_event_device.c | 29 ++++++++++++++++ |
12 | 1 file changed, 46 insertions(+) | 15 | hw/arm/virt.c | 62 ++++++++++++++++++++++++++++++++-- |
16 | 2 files changed, 89 insertions(+), 2 deletions(-) | ||
13 | 17 | ||
14 | diff --git a/hw/arm/xlnx-versal-virt.c b/hw/arm/xlnx-versal-virt.c | 18 | diff --git a/hw/acpi/generic_event_device.c b/hw/acpi/generic_event_device.c |
15 | index XXXXXXX..XXXXXXX 100644 | 19 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/hw/arm/xlnx-versal-virt.c | 20 | --- a/hw/acpi/generic_event_device.c |
17 | +++ b/hw/arm/xlnx-versal-virt.c | 21 | +++ b/hw/acpi/generic_event_device.c |
18 | @@ -XXX,XX +XXX,XX @@ | 22 | @@ -XXX,XX +XXX,XX @@ static void acpi_ged_device_plug_cb(HotplugHandler *hotplug_dev, |
19 | #include "hw/arm/sysbus-fdt.h" | ||
20 | #include "hw/arm/fdt.h" | ||
21 | #include "cpu.h" | ||
22 | +#include "hw/qdev-properties.h" | ||
23 | #include "hw/arm/xlnx-versal.h" | ||
24 | |||
25 | #define TYPE_XLNX_VERSAL_VIRT_MACHINE MACHINE_TYPE_NAME("xlnx-versal-virt") | ||
26 | @@ -XXX,XX +XXX,XX @@ static void fdt_add_zdma_nodes(VersalVirt *s) | ||
27 | } | 23 | } |
28 | } | 24 | } |
29 | 25 | ||
30 | +static void fdt_add_sd_nodes(VersalVirt *s) | 26 | +static void acpi_ged_unplug_request_cb(HotplugHandler *hotplug_dev, |
27 | + DeviceState *dev, Error **errp) | ||
31 | +{ | 28 | +{ |
32 | + const char clocknames[] = "clk_xin\0clk_ahb"; | 29 | + AcpiGedState *s = ACPI_GED(hotplug_dev); |
33 | + const char compat[] = "arasan,sdhci-8.9a"; | ||
34 | + int i; | ||
35 | + | 30 | + |
36 | + for (i = ARRAY_SIZE(s->soc.pmc.iou.sd) - 1; i >= 0; i--) { | 31 | + if ((object_dynamic_cast(OBJECT(dev), TYPE_PC_DIMM) && |
37 | + uint64_t addr = MM_PMC_SD0 + MM_PMC_SD0_SIZE * i; | 32 | + !(object_dynamic_cast(OBJECT(dev), TYPE_NVDIMM)))) { |
38 | + char *name = g_strdup_printf("/sdhci@%" PRIx64, addr); | 33 | + acpi_memory_unplug_request_cb(hotplug_dev, &s->memhp_state, dev, errp); |
39 | + | 34 | + } else { |
40 | + qemu_fdt_add_subnode(s->fdt, name); | 35 | + error_setg(errp, "acpi: device unplug request for unsupported device" |
41 | + | 36 | + " type: %s", object_get_typename(OBJECT(dev))); |
42 | + qemu_fdt_setprop_cells(s->fdt, name, "clocks", | ||
43 | + s->phandle.clk_25Mhz, s->phandle.clk_25Mhz); | ||
44 | + qemu_fdt_setprop(s->fdt, name, "clock-names", | ||
45 | + clocknames, sizeof(clocknames)); | ||
46 | + qemu_fdt_setprop_cells(s->fdt, name, "interrupts", | ||
47 | + GIC_FDT_IRQ_TYPE_SPI, VERSAL_SD0_IRQ_0 + i * 2, | ||
48 | + GIC_FDT_IRQ_FLAGS_LEVEL_HI); | ||
49 | + qemu_fdt_setprop_sized_cells(s->fdt, name, "reg", | ||
50 | + 2, addr, 2, MM_PMC_SD0_SIZE); | ||
51 | + qemu_fdt_setprop(s->fdt, name, "compatible", compat, sizeof(compat)); | ||
52 | + g_free(name); | ||
53 | + } | 37 | + } |
54 | +} | 38 | +} |
55 | + | 39 | + |
56 | static void fdt_nop_memory_nodes(void *fdt, Error **errp) | 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) | ||
57 | { | 54 | { |
58 | Error *err = NULL; | 55 | AcpiGedState *s = ACPI_GED(adev); |
59 | @@ -XXX,XX +XXX,XX @@ static void create_virtio_regions(VersalVirt *s) | 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 | ||
66 | index XXXXXXX..XXXXXXX 100644 | ||
67 | --- a/hw/arm/virt.c | ||
68 | +++ b/hw/arm/virt.c | ||
69 | @@ -XXX,XX +XXX,XX @@ static void virt_machine_device_plug_cb(HotplugHandler *hotplug_dev, | ||
60 | } | 70 | } |
61 | } | 71 | } |
62 | 72 | ||
63 | +static void sd_plugin_card(SDHCIState *sd, DriveInfo *di) | 73 | +static void virt_dimm_unplug_request(HotplugHandler *hotplug_dev, |
74 | + DeviceState *dev, Error **errp) | ||
64 | +{ | 75 | +{ |
65 | + BlockBackend *blk = di ? blk_by_legacy_dinfo(di) : NULL; | 76 | + VirtMachineState *vms = VIRT_MACHINE(hotplug_dev); |
66 | + DeviceState *card; | 77 | + Error *local_err = NULL; |
67 | + | 78 | + |
68 | + card = qdev_create(qdev_get_child_bus(DEVICE(sd), "sd-bus"), TYPE_SD_CARD); | 79 | + if (!vms->acpi_dev) { |
69 | + object_property_add_child(OBJECT(sd), "card[*]", OBJECT(card), | 80 | + error_setg(&local_err, |
70 | + &error_fatal); | 81 | + "memory hotplug is not enabled: missing acpi-ged device"); |
71 | + qdev_prop_set_drive(card, "drive", blk, &error_fatal); | 82 | + goto out; |
72 | + object_property_set_bool(OBJECT(card), true, "realized", &error_fatal); | 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); | ||
73 | +} | 95 | +} |
74 | + | 96 | + |
75 | static void versal_virt_init(MachineState *machine) | 97 | +static void virt_dimm_unplug(HotplugHandler *hotplug_dev, |
76 | { | 98 | + DeviceState *dev, Error **errp) |
77 | VersalVirt *s = XLNX_VERSAL_VIRT_MACHINE(machine); | 99 | +{ |
78 | int psci_conduit = QEMU_PSCI_CONDUIT_DISABLED; | 100 | + VirtMachineState *vms = VIRT_MACHINE(hotplug_dev); |
79 | + int i; | 101 | + Error *local_err = NULL; |
80 | 102 | + | |
81 | /* | 103 | + hotplug_handler_unplug(HOTPLUG_HANDLER(vms->acpi_dev), dev, &local_err); |
82 | * If the user provides an Operating System to be loaded, we expect them | 104 | + if (local_err) { |
83 | @@ -XXX,XX +XXX,XX @@ static void versal_virt_init(MachineState *machine) | 105 | + goto out; |
84 | fdt_add_gic_nodes(s); | ||
85 | fdt_add_timer_nodes(s); | ||
86 | fdt_add_zdma_nodes(s); | ||
87 | + fdt_add_sd_nodes(s); | ||
88 | fdt_add_cpu_nodes(s, psci_conduit); | ||
89 | fdt_add_clk_node(s, "/clk125", 125000000, s->phandle.clk_125Mhz); | ||
90 | fdt_add_clk_node(s, "/clk25", 25000000, s->phandle.clk_25Mhz); | ||
91 | @@ -XXX,XX +XXX,XX @@ static void versal_virt_init(MachineState *machine) | ||
92 | memory_region_add_subregion_overlap(get_system_memory(), | ||
93 | 0, &s->soc.fpd.apu.mr, 0); | ||
94 | |||
95 | + /* Plugin SD cards. */ | ||
96 | + for (i = 0; i < ARRAY_SIZE(s->soc.pmc.iou.sd); i++) { | ||
97 | + sd_plugin_card(&s->soc.pmc.iou.sd[i], drive_get_next(IF_SD)); | ||
98 | + } | 106 | + } |
99 | + | 107 | + |
100 | s->binfo.ram_size = machine->ram_size; | 108 | + pc_dimm_unplug(PC_DIMM(dev), MACHINE(vms)); |
101 | s->binfo.loader_start = 0x0; | 109 | + qdev_unrealize(dev); |
102 | s->binfo.get_dtb = versal_virt_get_dtb; | 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; | ||
103 | -- | 148 | -- |
104 | 2.20.1 | 149 | 2.20.1 |
105 | 150 | ||
106 | 151 | diff view generated by jsdifflib |