1 | Most of this is the Neon decodetree patches, followed by Edgar's versal cleanups. | 1 | The following changes since commit bf4460a8d9a86f6cfe05d7a7f470c48e3a93d8b2: |
---|---|---|---|
2 | 2 | ||
3 | thanks | 3 | Merge tag 'pull-tcg-20230123' of https://gitlab.com/rth7680/qemu into staging (2023-02-03 09:30:45 +0000) |
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-20230203 |
14 | 8 | ||
15 | for you to fetch changes up to 9aefc6cf9b73f66062d2f914a0136756e7a28211: | 9 | for you to fetch changes up to bb18151d8bd9bedc497ee9d4e8d81b39a4e5bbf6: |
16 | 10 | ||
17 | target/arm: Move gen_ function typedefs to translate.h (2020-05-04 12:59:26 +0100) | 11 | target/arm: Enable FEAT_FGT on '-cpu max' (2023-02-03 12:59:24 +0000) |
18 | 12 | ||
19 | ---------------------------------------------------------------- | 13 | ---------------------------------------------------------------- |
20 | target-arm queue: | 14 | target-arm queue: |
21 | * Start of conversion of Neon insns to decodetree | 15 | * Fix physical address resolution for Stage2 |
22 | * versal board: support SD and RTC | 16 | * pl011: refactoring, implement reset method |
23 | * Implement ARMv8.2-TTS2UXN | 17 | * Support GICv3 with hvf acceleration |
24 | * Make VQDMULL undefined when U=1 | 18 | * sbsa-ref: remove cortex-a76 from list of supported cpus |
25 | * Some minor code cleanups | 19 | * Correct syndrome for ATS12NSO* traps at Secure EL1 |
20 | * Fix priority of HSTR_EL2 traps vs UNDEFs | ||
21 | * Implement FEAT_FGT for '-cpu max' | ||
26 | 22 | ||
27 | ---------------------------------------------------------------- | 23 | ---------------------------------------------------------------- |
28 | Edgar E. Iglesias (11): | 24 | Alexander Graf (3): |
29 | hw/arm: versal: Remove inclusion of arm_gicv3_common.h | 25 | hvf: arm: Add support for GICv3 |
30 | hw/arm: versal: Move misplaced comment | 26 | hw/arm/virt: Consolidate GIC finalize logic |
31 | hw/arm: versal-virt: Fix typo xlnx-ve -> xlnx-versal | 27 | hw/arm/virt: Make accels in GIC finalize logic explicit |
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 | 28 | ||
41 | Fredrik Strupe (1): | 29 | Evgeny Iakovlev (4): |
42 | target/arm: Make VQDMULL undefined when U=1 | 30 | hw/char/pl011: refactor FIFO depth handling code |
31 | hw/char/pl011: add post_load hook for backwards-compatibility | ||
32 | hw/char/pl011: implement a reset method | ||
33 | hw/char/pl011: better handling of FIFO flags on LCR reset | ||
43 | 34 | ||
44 | Peter Maydell (25): | 35 | Marcin Juszkiewicz (1): |
45 | target/arm: Don't use a TLB for ARMMMUIdx_Stage2 | 36 | sbsa-ref: remove cortex-a76 from list of supported cpus |
46 | target/arm: Use enum constant in get_phys_addr_lpae() call | ||
47 | target/arm: Add new 's1_is_el0' argument to get_phys_addr_lpae() | ||
48 | target/arm: Implement ARMv8.2-TTS2UXN | ||
49 | target/arm: Use correct variable for setting 'max' cpu's ID_AA64DFR0 | ||
50 | target/arm/translate-vfp.inc.c: Remove duplicate simd_r32 check | ||
51 | target/arm: Don't allow Thumb Neon insns without FEATURE_NEON | ||
52 | target/arm: Add stubs for AArch32 Neon decodetree | ||
53 | target/arm: Convert VCMLA (vector) to decodetree | ||
54 | target/arm: Convert VCADD (vector) to decodetree | ||
55 | target/arm: Convert V[US]DOT (vector) to decodetree | ||
56 | target/arm: Convert VFM[AS]L (vector) to decodetree | ||
57 | target/arm: Convert VCMLA (scalar) to decodetree | ||
58 | target/arm: Convert V[US]DOT (scalar) to decodetree | ||
59 | target/arm: Convert VFM[AS]L (scalar) to decodetree | ||
60 | target/arm: Convert Neon load/store multiple structures to decodetree | ||
61 | target/arm: Convert Neon 'load single structure to all lanes' to decodetree | ||
62 | target/arm: Convert Neon 'load/store single structure' to decodetree | ||
63 | target/arm: Convert Neon 3-reg-same VADD/VSUB to decodetree | ||
64 | target/arm: Convert Neon 3-reg-same logic ops to decodetree | ||
65 | target/arm: Convert Neon 3-reg-same VMAX/VMIN to decodetree | ||
66 | target/arm: Convert Neon 3-reg-same comparisons to decodetree | ||
67 | target/arm: Convert Neon 3-reg-same VQADD/VQSUB to decodetree | ||
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 | 37 | ||
71 | Philippe Mathieu-Daudé (2): | 38 | Peter Maydell (23): |
72 | hw/arm/mps2-tz: Use TYPE_IOTKIT instead of hardcoded string | 39 | target/arm: Name AT_S1E1RP and AT_S1E1WP cpregs correctly |
73 | target/arm: Use uint64_t for midr field in CPU state struct | 40 | target/arm: Correct syndrome for ATS12NSO* at Secure EL1 |
41 | target/arm: Remove CP_ACCESS_TRAP_UNCATEGORIZED_{EL2, EL3} | ||
42 | target/arm: Move do_coproc_insn() syndrome calculation earlier | ||
43 | target/arm: All UNDEF-at-EL0 traps take priority over HSTR_EL2 traps | ||
44 | target/arm: Make HSTR_EL2 traps take priority over UNDEF-at-EL1 | ||
45 | target/arm: Disable HSTR_EL2 traps if EL2 is not enabled | ||
46 | target/arm: Define the FEAT_FGT registers | ||
47 | target/arm: Implement FGT trapping infrastructure | ||
48 | target/arm: Mark up sysregs for HFGRTR bits 0..11 | ||
49 | target/arm: Mark up sysregs for HFGRTR bits 12..23 | ||
50 | target/arm: Mark up sysregs for HFGRTR bits 24..35 | ||
51 | target/arm: Mark up sysregs for HFGRTR bits 36..63 | ||
52 | target/arm: Mark up sysregs for HDFGRTR bits 0..11 | ||
53 | target/arm: Mark up sysregs for HDFGRTR bits 12..63 | ||
54 | target/arm: Mark up sysregs for HFGITR bits 0..11 | ||
55 | target/arm: Mark up sysregs for HFGITR bits 12..17 | ||
56 | target/arm: Mark up sysregs for HFGITR bits 18..47 | ||
57 | target/arm: Mark up sysregs for HFGITR bits 48..63 | ||
58 | target/arm: Implement the HFGITR_EL2.ERET trap | ||
59 | target/arm: Implement the HFGITR_EL2.SVC_EL0 and SVC_EL1 traps | ||
60 | target/arm: Implement MDCR_EL2.TDCC and MDCR_EL3.TDCC traps | ||
61 | target/arm: Enable FEAT_FGT on '-cpu max' | ||
74 | 62 | ||
75 | include/hw/arm/xlnx-versal.h | 31 +- | 63 | Richard Henderson (2): |
76 | target/arm/cpu-param.h | 2 +- | 64 | hw/arm: Use TYPE_ARM_SMMUV3 |
77 | target/arm/cpu.h | 38 ++- | 65 | target/arm: Fix physical address resolution for Stage2 |
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 | 66 | ||
67 | docs/system/arm/emulation.rst | 1 + | ||
68 | include/hw/arm/virt.h | 15 +- | ||
69 | include/hw/char/pl011.h | 5 +- | ||
70 | target/arm/cpregs.h | 484 +++++++++++++++++++++++++++++++++++++++++- | ||
71 | target/arm/cpu.h | 18 ++ | ||
72 | target/arm/internals.h | 20 ++ | ||
73 | target/arm/syndrome.h | 10 + | ||
74 | target/arm/translate.h | 6 + | ||
75 | hw/arm/sbsa-ref.c | 4 +- | ||
76 | hw/arm/virt.c | 203 +++++++++--------- | ||
77 | hw/char/pl011.c | 93 ++++++-- | ||
78 | hw/intc/arm_gicv3_cpuif.c | 18 +- | ||
79 | target/arm/cpu64.c | 1 + | ||
80 | target/arm/debug_helper.c | 46 +++- | ||
81 | target/arm/helper.c | 245 ++++++++++++++++++++- | ||
82 | target/arm/hvf/hvf.c | 151 +++++++++++++ | ||
83 | target/arm/op_helper.c | 58 ++++- | ||
84 | target/arm/ptw.c | 2 +- | ||
85 | target/arm/translate-a64.c | 22 +- | ||
86 | target/arm/translate.c | 125 +++++++---- | ||
87 | target/arm/hvf/trace-events | 2 + | ||
88 | 21 files changed, 1340 insertions(+), 189 deletions(-) | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Fredrik Strupe <fredrik@strupe.net> | ||
2 | 1 | ||
3 | According to Arm ARM, VQDMULL is only valid when U=0, while having | ||
4 | U=1 is unallocated. | ||
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> | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | --- | ||
11 | target/arm/translate.c | 2 +- | ||
12 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
13 | |||
14 | diff --git a/target/arm/translate.c b/target/arm/translate.c | ||
15 | index XXXXXXX..XXXXXXX 100644 | ||
16 | --- a/target/arm/translate.c | ||
17 | +++ b/target/arm/translate.c | ||
18 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) | ||
19 | {0, 0, 0, 0}, /* VMLSL */ | ||
20 | {0, 0, 0, 9}, /* VQDMLSL */ | ||
21 | {0, 0, 0, 0}, /* Integer VMULL */ | ||
22 | - {0, 0, 0, 1}, /* VQDMULL */ | ||
23 | + {0, 0, 0, 9}, /* VQDMULL */ | ||
24 | {0, 0, 0, 0xa}, /* Polynomial VMULL */ | ||
25 | {0, 0, 0, 7}, /* Reserved: always UNDEF */ | ||
26 | }; | ||
27 | -- | ||
28 | 2.20.1 | ||
29 | |||
30 | diff view generated by jsdifflib |
1 | From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Fix typo xlnx-ve -> xlnx-versal. | 3 | Use the macro instead of two explicit string literals. |
4 | 4 | ||
5 | Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | 5 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
6 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | 6 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
7 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 7 | Reviewed-by: Eric Auger <eric.auger@redhat.com> |
8 | Reviewed-by: Luc Michel <luc.michel@greensocs.com> | 8 | Message-id: 20230124232059.4017615-1-richard.henderson@linaro.org |
9 | Message-id: 20200427181649.26851-4-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-virt.c | 2 +- | 11 | hw/arm/sbsa-ref.c | 3 ++- |
13 | 1 file changed, 1 insertion(+), 1 deletion(-) | 12 | hw/arm/virt.c | 2 +- |
13 | 2 files changed, 3 insertions(+), 2 deletions(-) | ||
14 | 14 | ||
15 | diff --git a/hw/arm/xlnx-versal-virt.c b/hw/arm/xlnx-versal-virt.c | 15 | diff --git a/hw/arm/sbsa-ref.c b/hw/arm/sbsa-ref.c |
16 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
17 | --- a/hw/arm/xlnx-versal-virt.c | 17 | --- a/hw/arm/sbsa-ref.c |
18 | +++ b/hw/arm/xlnx-versal-virt.c | 18 | +++ b/hw/arm/sbsa-ref.c |
19 | @@ -XXX,XX +XXX,XX @@ static void versal_virt_init(MachineState *machine) | 19 | @@ -XXX,XX +XXX,XX @@ |
20 | psci_conduit = QEMU_PSCI_CONDUIT_SMC; | 20 | #include "exec/hwaddr.h" |
21 | #include "kvm_arm.h" | ||
22 | #include "hw/arm/boot.h" | ||
23 | +#include "hw/arm/smmuv3.h" | ||
24 | #include "hw/block/flash.h" | ||
25 | #include "hw/boards.h" | ||
26 | #include "hw/ide/internal.h" | ||
27 | @@ -XXX,XX +XXX,XX @@ static void create_smmu(const SBSAMachineState *sms, PCIBus *bus) | ||
28 | DeviceState *dev; | ||
29 | int i; | ||
30 | |||
31 | - dev = qdev_new("arm-smmuv3"); | ||
32 | + dev = qdev_new(TYPE_ARM_SMMUV3); | ||
33 | |||
34 | object_property_set_link(OBJECT(dev), "primary-bus", OBJECT(bus), | ||
35 | &error_abort); | ||
36 | diff --git a/hw/arm/virt.c b/hw/arm/virt.c | ||
37 | index XXXXXXX..XXXXXXX 100644 | ||
38 | --- a/hw/arm/virt.c | ||
39 | +++ b/hw/arm/virt.c | ||
40 | @@ -XXX,XX +XXX,XX @@ static void create_smmu(const VirtMachineState *vms, | ||
41 | return; | ||
21 | } | 42 | } |
22 | 43 | ||
23 | - sysbus_init_child_obj(OBJECT(machine), "xlnx-ve", &s->soc, | 44 | - dev = qdev_new("arm-smmuv3"); |
24 | + sysbus_init_child_obj(OBJECT(machine), "xlnx-versal", &s->soc, | 45 | + dev = qdev_new(TYPE_ARM_SMMUV3); |
25 | sizeof(s->soc), TYPE_XLNX_VERSAL); | 46 | |
26 | object_property_set_link(OBJECT(&s->soc), OBJECT(machine->ram), | 47 | object_property_set_link(OBJECT(dev), "primary-bus", OBJECT(bus), |
27 | "ddr", &error_abort); | 48 | &error_abort); |
28 | -- | 49 | -- |
29 | 2.20.1 | 50 | 2.34.1 |
30 | 51 | ||
31 | 52 | diff view generated by jsdifflib |
1 | From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Move misplaced comment. | 3 | Conversion to probe_access_full missed applying the page offset. |
4 | 4 | ||
5 | Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | 5 | Cc: qemu-stable@nongnu.org |
6 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | 6 | Reported-by: Sid Manning <sidneym@quicinc.com> |
7 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 7 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
8 | Reviewed-by: Luc Michel <luc.michel@greensocs.com> | 8 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
9 | Message-id: 20200427181649.26851-3-edgar.iglesias@gmail.com | 9 | Message-id: 20230126233134.103193-1-richard.henderson@linaro.org |
10 | Fixes: f3639a64f602 ("target/arm: Use softmmu tlbs for page table walking") | ||
11 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
11 | --- | 13 | --- |
12 | hw/arm/xlnx-versal.c | 2 +- | 14 | target/arm/ptw.c | 2 +- |
13 | 1 file changed, 1 insertion(+), 1 deletion(-) | 15 | 1 file changed, 1 insertion(+), 1 deletion(-) |
14 | 16 | ||
15 | diff --git a/hw/arm/xlnx-versal.c b/hw/arm/xlnx-versal.c | 17 | diff --git a/target/arm/ptw.c b/target/arm/ptw.c |
16 | index XXXXXXX..XXXXXXX 100644 | 18 | index XXXXXXX..XXXXXXX 100644 |
17 | --- a/hw/arm/xlnx-versal.c | 19 | --- a/target/arm/ptw.c |
18 | +++ b/hw/arm/xlnx-versal.c | 20 | +++ b/target/arm/ptw.c |
19 | @@ -XXX,XX +XXX,XX @@ static void versal_create_apu_cpus(Versal *s) | 21 | @@ -XXX,XX +XXX,XX @@ static bool S1_ptw_translate(CPUARMState *env, S1Translate *ptw, |
20 | 22 | if (unlikely(flags & TLB_INVALID_MASK)) { | |
21 | obj = object_new(XLNX_VERSAL_ACPU_TYPE); | 23 | goto fail; |
22 | if (!obj) { | ||
23 | - /* Secondary CPUs start in PSCI powered-down state */ | ||
24 | error_report("Unable to create apu.cpu[%d] of type %s", | ||
25 | i, XLNX_VERSAL_ACPU_TYPE); | ||
26 | exit(EXIT_FAILURE); | ||
27 | @@ -XXX,XX +XXX,XX @@ static void versal_create_apu_cpus(Versal *s) | ||
28 | object_property_set_int(obj, s->cfg.psci_conduit, | ||
29 | "psci-conduit", &error_abort); | ||
30 | if (i) { | ||
31 | + /* Secondary CPUs start in PSCI powered-down state */ | ||
32 | object_property_set_bool(obj, true, | ||
33 | "start-powered-off", &error_abort); | ||
34 | } | 24 | } |
25 | - ptw->out_phys = full->phys_addr; | ||
26 | + ptw->out_phys = full->phys_addr | (addr & ~TARGET_PAGE_MASK); | ||
27 | ptw->out_rw = full->prot & PAGE_WRITE; | ||
28 | pte_attrs = full->pte_attrs; | ||
29 | pte_secure = full->attrs.secure; | ||
35 | -- | 30 | -- |
36 | 2.20.1 | 31 | 2.34.1 |
37 | 32 | ||
38 | 33 | diff view generated by jsdifflib |
1 | From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com> | 1 | From: Evgeny Iakovlev <eiakovlev@linux.microsoft.com> |
---|---|---|---|
2 | 2 | ||
3 | hw/arm: versal: Add support for the RTC. | 3 | PL011 can be in either of 2 modes depending guest config: FIFO and |
4 | single register. The last mode could be viewed as a 1-element-deep FIFO. | ||
4 | 5 | ||
5 | Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | 6 | Current code open-codes a bunch of depth-dependent logic. Refactor FIFO |
6 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 7 | depth handling code to isolate calculating current FIFO depth. |
7 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | 8 | |
8 | Reviewed-by: Luc Michel <luc.michel@greensocs.com> | 9 | One functional (albeit guest-invisible) side-effect of this change is |
9 | Message-id: 20200427181649.26851-10-edgar.iglesias@gmail.com | 10 | that previously we would always increment s->read_pos in UARTDR read |
11 | handler even if FIFO was disabled, now we are limiting read_pos to not | ||
12 | exceed FIFO depth (read_pos itself is reset to 0 if user disables FIFO). | ||
13 | |||
14 | Signed-off-by: Evgeny Iakovlev <eiakovlev@linux.microsoft.com> | ||
15 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
16 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
17 | Message-id: 20230123162304.26254-2-eiakovlev@linux.microsoft.com | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 18 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
11 | --- | 19 | --- |
12 | include/hw/arm/xlnx-versal.h | 8 ++++++++ | 20 | include/hw/char/pl011.h | 5 ++++- |
13 | hw/arm/xlnx-versal.c | 21 +++++++++++++++++++++ | 21 | hw/char/pl011.c | 30 ++++++++++++++++++------------ |
14 | 2 files changed, 29 insertions(+) | 22 | 2 files changed, 22 insertions(+), 13 deletions(-) |
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/char/pl011.h b/include/hw/char/pl011.h |
17 | index XXXXXXX..XXXXXXX 100644 | 25 | index XXXXXXX..XXXXXXX 100644 |
18 | --- a/include/hw/arm/xlnx-versal.h | 26 | --- a/include/hw/char/pl011.h |
19 | +++ b/include/hw/arm/xlnx-versal.h | 27 | +++ b/include/hw/char/pl011.h |
20 | @@ -XXX,XX +XXX,XX @@ | 28 | @@ -XXX,XX +XXX,XX @@ OBJECT_DECLARE_SIMPLE_TYPE(PL011State, PL011) |
21 | #include "hw/char/pl011.h" | 29 | /* This shares the same struct (and cast macro) as the base pl011 device */ |
22 | #include "hw/dma/xlnx-zdma.h" | 30 | #define TYPE_PL011_LUMINARY "pl011_luminary" |
23 | #include "hw/net/cadence_gem.h" | 31 | |
24 | +#include "hw/rtc/xlnx-zynqmp-rtc.h" | 32 | +/* Depth of UART FIFO in bytes, when FIFO mode is enabled (else depth == 1) */ |
25 | 33 | +#define PL011_FIFO_DEPTH 16 | |
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 | + | 34 | + |
33 | + XlnxZynqMPRTC rtc; | 35 | struct PL011State { |
34 | } pmc; | 36 | SysBusDevice parent_obj; |
35 | 37 | ||
36 | struct { | 38 | @@ -XXX,XX +XXX,XX @@ struct PL011State { |
37 | @@ -XXX,XX +XXX,XX @@ typedef struct Versal { | 39 | uint32_t dmacr; |
38 | #define VERSAL_GEM1_IRQ_0 58 | 40 | uint32_t int_enabled; |
39 | #define VERSAL_GEM1_WAKE_IRQ_0 59 | 41 | uint32_t int_level; |
40 | #define VERSAL_ADMA_IRQ_0 60 | 42 | - uint32_t read_fifo[16]; |
41 | +#define VERSAL_RTC_APB_ERR_IRQ 121 | 43 | + uint32_t read_fifo[PL011_FIFO_DEPTH]; |
42 | #define VERSAL_SD0_IRQ_0 126 | 44 | uint32_t ilpr; |
43 | +#define VERSAL_RTC_ALARM_IRQ 142 | 45 | uint32_t ibrd; |
44 | +#define VERSAL_RTC_SECONDS_IRQ 143 | 46 | uint32_t fbrd; |
45 | 47 | diff --git a/hw/char/pl011.c b/hw/char/pl011.c | |
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 | 48 | index XXXXXXX..XXXXXXX 100644 |
57 | --- a/hw/arm/xlnx-versal.c | 49 | --- a/hw/char/pl011.c |
58 | +++ b/hw/arm/xlnx-versal.c | 50 | +++ b/hw/char/pl011.c |
59 | @@ -XXX,XX +XXX,XX @@ static void versal_create_sds(Versal *s, qemu_irq *pic) | 51 | @@ -XXX,XX +XXX,XX @@ static void pl011_update(PL011State *s) |
60 | } | 52 | } |
61 | } | 53 | } |
62 | 54 | ||
63 | +static void versal_create_rtc(Versal *s, qemu_irq *pic) | 55 | +static bool pl011_is_fifo_enabled(PL011State *s) |
64 | +{ | 56 | +{ |
65 | + SysBusDevice *sbd; | 57 | + return (s->lcr & 0x10) != 0; |
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 | +} | 58 | +} |
82 | + | 59 | + |
83 | /* This takes the board allocated linear DDR memory and creates aliases | 60 | +static inline unsigned pl011_get_fifo_depth(PL011State *s) |
84 | * for each split DDR range/aperture on the Versal address map. | 61 | +{ |
85 | */ | 62 | + /* Note: FIFO depth is expected to be power-of-2 */ |
86 | @@ -XXX,XX +XXX,XX @@ static void versal_realize(DeviceState *dev, Error **errp) | 63 | + return pl011_is_fifo_enabled(s) ? PL011_FIFO_DEPTH : 1; |
87 | versal_create_gems(s, pic); | 64 | +} |
88 | versal_create_admas(s, pic); | 65 | + |
89 | versal_create_sds(s, pic); | 66 | static uint64_t pl011_read(void *opaque, hwaddr offset, |
90 | + versal_create_rtc(s, pic); | 67 | unsigned size) |
91 | versal_map_ddr(s); | 68 | { |
92 | versal_unimp(s); | 69 | @@ -XXX,XX +XXX,XX @@ static uint64_t pl011_read(void *opaque, hwaddr offset, |
93 | 70 | c = s->read_fifo[s->read_pos]; | |
71 | if (s->read_count > 0) { | ||
72 | s->read_count--; | ||
73 | - if (++s->read_pos == 16) | ||
74 | - s->read_pos = 0; | ||
75 | + s->read_pos = (s->read_pos + 1) & (pl011_get_fifo_depth(s) - 1); | ||
76 | } | ||
77 | if (s->read_count == 0) { | ||
78 | s->flags |= PL011_FLAG_RXFE; | ||
79 | @@ -XXX,XX +XXX,XX @@ static int pl011_can_receive(void *opaque) | ||
80 | PL011State *s = (PL011State *)opaque; | ||
81 | int r; | ||
82 | |||
83 | - if (s->lcr & 0x10) { | ||
84 | - r = s->read_count < 16; | ||
85 | - } else { | ||
86 | - r = s->read_count < 1; | ||
87 | - } | ||
88 | + r = s->read_count < pl011_get_fifo_depth(s); | ||
89 | trace_pl011_can_receive(s->lcr, s->read_count, r); | ||
90 | return r; | ||
91 | } | ||
92 | @@ -XXX,XX +XXX,XX @@ static void pl011_put_fifo(void *opaque, uint32_t value) | ||
93 | { | ||
94 | PL011State *s = (PL011State *)opaque; | ||
95 | int slot; | ||
96 | + unsigned pipe_depth; | ||
97 | |||
98 | - slot = s->read_pos + s->read_count; | ||
99 | - if (slot >= 16) | ||
100 | - slot -= 16; | ||
101 | + pipe_depth = pl011_get_fifo_depth(s); | ||
102 | + slot = (s->read_pos + s->read_count) & (pipe_depth - 1); | ||
103 | s->read_fifo[slot] = value; | ||
104 | s->read_count++; | ||
105 | s->flags &= ~PL011_FLAG_RXFE; | ||
106 | trace_pl011_put_fifo(value, s->read_count); | ||
107 | - if (!(s->lcr & 0x10) || s->read_count == 16) { | ||
108 | + if (s->read_count == pipe_depth) { | ||
109 | trace_pl011_put_fifo_full(); | ||
110 | s->flags |= PL011_FLAG_RXFF; | ||
111 | } | ||
112 | @@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_pl011 = { | ||
113 | VMSTATE_UINT32(dmacr, PL011State), | ||
114 | VMSTATE_UINT32(int_enabled, PL011State), | ||
115 | VMSTATE_UINT32(int_level, PL011State), | ||
116 | - VMSTATE_UINT32_ARRAY(read_fifo, PL011State, 16), | ||
117 | + VMSTATE_UINT32_ARRAY(read_fifo, PL011State, PL011_FIFO_DEPTH), | ||
118 | VMSTATE_UINT32(ilpr, PL011State), | ||
119 | VMSTATE_UINT32(ibrd, PL011State), | ||
120 | VMSTATE_UINT32(fbrd, PL011State), | ||
94 | -- | 121 | -- |
95 | 2.20.1 | 122 | 2.34.1 |
96 | 123 | ||
97 | 124 | diff view generated by jsdifflib |
1 | Convert the Neon "load single structure to all lanes" insns to | 1 | From: Evgeny Iakovlev <eiakovlev@linux.microsoft.com> |
---|---|---|---|
2 | decodetree. | ||
3 | 2 | ||
3 | Previous change slightly modified the way we handle data writes when | ||
4 | FIFO is disabled. Previously we kept incrementing read_pos and were | ||
5 | storing data at that position, although we only have a | ||
6 | single-register-deep FIFO now. Then we changed it to always store data | ||
7 | at pos 0. | ||
8 | |||
9 | If guest disables FIFO and the proceeds to read data, it will work out | ||
10 | fine, because we still read from current read_pos before setting it to | ||
11 | 0. | ||
12 | |||
13 | However, to make code less fragile, introduce a post_load hook for | ||
14 | PL011State and move fixup read FIFO state when FIFO is disabled. Since | ||
15 | we are introducing a post_load hook, also do some sanity checking on | ||
16 | untrusted incoming input state. | ||
17 | |||
18 | Signed-off-by: Evgeny Iakovlev <eiakovlev@linux.microsoft.com> | ||
19 | Message-id: 20230123162304.26254-3-eiakovlev@linux.microsoft.com | ||
4 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 20 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
5 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
6 | Message-id: 20200430181003.21682-13-peter.maydell@linaro.org | ||
7 | --- | 21 | --- |
8 | target/arm/neon-ls.decode | 5 +++ | 22 | hw/char/pl011.c | 25 +++++++++++++++++++++++++ |
9 | target/arm/translate-neon.inc.c | 73 +++++++++++++++++++++++++++++++++ | 23 | 1 file changed, 25 insertions(+) |
10 | target/arm/translate.c | 55 +------------------------ | ||
11 | 3 files changed, 80 insertions(+), 53 deletions(-) | ||
12 | 24 | ||
13 | diff --git a/target/arm/neon-ls.decode b/target/arm/neon-ls.decode | 25 | diff --git a/hw/char/pl011.c b/hw/char/pl011.c |
14 | index XXXXXXX..XXXXXXX 100644 | 26 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/target/arm/neon-ls.decode | 27 | --- a/hw/char/pl011.c |
16 | +++ b/target/arm/neon-ls.decode | 28 | +++ b/hw/char/pl011.c |
17 | @@ -XXX,XX +XXX,XX @@ | 29 | @@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_pl011_clock = { |
18 | 30 | } | |
19 | VLDST_multiple 1111 0100 0 . l:1 0 rn:4 .... itype:4 size:2 align:2 rm:4 \ | 31 | }; |
20 | vd=%vd_dp | 32 | |
33 | +static int pl011_post_load(void *opaque, int version_id) | ||
34 | +{ | ||
35 | + PL011State* s = opaque; | ||
21 | + | 36 | + |
22 | +# Neon load single element to all lanes | 37 | + /* Sanity-check input state */ |
23 | + | 38 | + if (s->read_pos >= ARRAY_SIZE(s->read_fifo) || |
24 | +VLD_all_lanes 1111 0100 1 . 1 0 rn:4 .... 11 n:2 size:2 t:1 a:1 rm:4 \ | 39 | + s->read_count > ARRAY_SIZE(s->read_fifo)) { |
25 | + vd=%vd_dp | 40 | + return -1; |
26 | diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c | ||
27 | index XXXXXXX..XXXXXXX 100644 | ||
28 | --- a/target/arm/translate-neon.inc.c | ||
29 | +++ b/target/arm/translate-neon.inc.c | ||
30 | @@ -XXX,XX +XXX,XX @@ static bool trans_VLDST_multiple(DisasContext *s, arg_VLDST_multiple *a) | ||
31 | gen_neon_ldst_base_update(s, a->rm, a->rn, nregs * interleave * 8); | ||
32 | return true; | ||
33 | } | ||
34 | + | ||
35 | +static bool trans_VLD_all_lanes(DisasContext *s, arg_VLD_all_lanes *a) | ||
36 | +{ | ||
37 | + /* Neon load single structure to all lanes */ | ||
38 | + int reg, stride, vec_size; | ||
39 | + int vd = a->vd; | ||
40 | + int size = a->size; | ||
41 | + int nregs = a->n + 1; | ||
42 | + TCGv_i32 addr, tmp; | ||
43 | + | ||
44 | + if (!arm_dc_feature(s, ARM_FEATURE_NEON)) { | ||
45 | + return false; | ||
46 | + } | 41 | + } |
47 | + | 42 | + |
48 | + /* UNDEF accesses to D16-D31 if they don't exist */ | 43 | + if (!pl011_is_fifo_enabled(s) && s->read_count > 0 && s->read_pos > 0) { |
49 | + if (!dc_isar_feature(aa32_simd_r32, s) && (a->vd & 0x10)) { | 44 | + /* |
50 | + return false; | 45 | + * Older versions of PL011 didn't ensure that the single |
46 | + * character in the FIFO in FIFO-disabled mode is in | ||
47 | + * element 0 of the array; convert to follow the current | ||
48 | + * code's assumptions. | ||
49 | + */ | ||
50 | + s->read_fifo[0] = s->read_fifo[s->read_pos]; | ||
51 | + s->read_pos = 0; | ||
51 | + } | 52 | + } |
52 | + | 53 | + |
53 | + if (size == 3) { | 54 | + return 0; |
54 | + if (nregs != 4 || a->a == 0) { | 55 | +} |
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; | ||
62 | + } | ||
63 | + if (nregs == 3 && a->a == 1) { | ||
64 | + return false; | ||
65 | + } | ||
66 | + | 56 | + |
67 | + if (!vfp_access_check(s)) { | 57 | static const VMStateDescription vmstate_pl011 = { |
68 | + return true; | 58 | .name = "pl011", |
69 | + } | 59 | .version_id = 2, |
70 | + | 60 | .minimum_version_id = 2, |
71 | + /* | 61 | + .post_load = pl011_post_load, |
72 | + * VLD1 to all lanes: T bit indicates how many Dregs to write. | 62 | .fields = (VMStateField[]) { |
73 | + * VLD2/3/4 to all lanes: T bit indicates register stride. | 63 | VMSTATE_UINT32(readbuff, PL011State), |
74 | + */ | 64 | VMSTATE_UINT32(flags, PL011State), |
75 | + stride = a->t ? 2 : 1; | ||
76 | + vec_size = nregs == 1 ? stride * 8 : 8; | ||
77 | + | ||
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 | + } | ||
100 | + tcg_temp_free_i32(tmp); | ||
101 | + tcg_temp_free_i32(addr); | ||
102 | + | ||
103 | + gen_neon_ldst_base_update(s, a->rm, a->rn, (1 << size) * nregs); | ||
104 | + | ||
105 | + return true; | ||
106 | +} | ||
107 | diff --git a/target/arm/translate.c b/target/arm/translate.c | ||
108 | index XXXXXXX..XXXXXXX 100644 | ||
109 | --- a/target/arm/translate.c | ||
110 | +++ b/target/arm/translate.c | ||
111 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_ls_insn(DisasContext *s, uint32_t insn) | ||
112 | int size; | ||
113 | int reg; | ||
114 | int load; | ||
115 | - int vec_size; | ||
116 | TCGv_i32 addr; | ||
117 | TCGv_i32 tmp; | ||
118 | |||
119 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_ls_insn(DisasContext *s, uint32_t insn) | ||
120 | } else { | ||
121 | size = (insn >> 10) & 3; | ||
122 | if (size == 3) { | ||
123 | - /* Load single element to all lanes. */ | ||
124 | - int a = (insn >> 4) & 1; | ||
125 | - if (!load) { | ||
126 | - return 1; | ||
127 | - } | ||
128 | - size = (insn >> 6) & 3; | ||
129 | - nregs = ((insn >> 8) & 3) + 1; | ||
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 | -- | 65 | -- |
181 | 2.20.1 | 66 | 2.34.1 |
182 | |||
183 | diff view generated by jsdifflib |
1 | From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com> | 1 | From: Evgeny Iakovlev <eiakovlev@linux.microsoft.com> |
---|---|---|---|
2 | 2 | ||
3 | Embed the APUs into the SoC type. | 3 | PL011 currently lacks a reset method. Implement it. |
4 | 4 | ||
5 | Suggested-by: Peter Maydell <peter.maydell@linaro.org> | 5 | Signed-off-by: Evgeny Iakovlev <eiakovlev@linux.microsoft.com> |
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 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
8 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 8 | Message-id: 20230123162304.26254-4-eiakovlev@linux.microsoft.com |
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> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
12 | --- | 10 | --- |
13 | include/hw/arm/xlnx-versal.h | 2 +- | 11 | hw/char/pl011.c | 26 +++++++++++++++++++++----- |
14 | hw/arm/xlnx-versal-virt.c | 4 ++-- | 12 | 1 file changed, 21 insertions(+), 5 deletions(-) |
15 | hw/arm/xlnx-versal.c | 19 +++++-------------- | ||
16 | 3 files changed, 8 insertions(+), 17 deletions(-) | ||
17 | 13 | ||
18 | diff --git a/include/hw/arm/xlnx-versal.h b/include/hw/arm/xlnx-versal.h | 14 | diff --git a/hw/char/pl011.c b/hw/char/pl011.c |
19 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
20 | --- a/include/hw/arm/xlnx-versal.h | 16 | --- a/hw/char/pl011.c |
21 | +++ b/include/hw/arm/xlnx-versal.h | 17 | +++ b/hw/char/pl011.c |
22 | @@ -XXX,XX +XXX,XX @@ typedef struct Versal { | 18 | @@ -XXX,XX +XXX,XX @@ static void pl011_init(Object *obj) |
23 | struct { | 19 | s->clk = qdev_init_clock_in(DEVICE(obj), "clk", pl011_clock_update, s, |
24 | struct { | 20 | ClockUpdate); |
25 | MemoryRegion mr; | 21 | |
26 | - ARMCPU *cpu[XLNX_VERSAL_NR_ACPUS]; | 22 | - s->read_trigger = 1; |
27 | + ARMCPU cpu[XLNX_VERSAL_NR_ACPUS]; | 23 | - s->ifl = 0x12; |
28 | GICv3State gic; | 24 | - s->cr = 0x300; |
29 | } apu; | 25 | - s->flags = 0x90; |
30 | } fpd; | ||
31 | diff --git a/hw/arm/xlnx-versal-virt.c b/hw/arm/xlnx-versal-virt.c | ||
32 | index XXXXXXX..XXXXXXX 100644 | ||
33 | --- a/hw/arm/xlnx-versal-virt.c | ||
34 | +++ b/hw/arm/xlnx-versal-virt.c | ||
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 | - | 26 | - |
57 | - obj = object_new(XLNX_VERSAL_ACPU_TYPE); | 27 | s->id = pl011_id_arm; |
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 | } | ||
81 | } | 28 | } |
82 | 29 | ||
83 | @@ -XXX,XX +XXX,XX @@ static void versal_create_apu_gic(Versal *s, qemu_irq *pic) | 30 | @@ -XXX,XX +XXX,XX @@ static void pl011_realize(DeviceState *dev, Error **errp) |
84 | } | 31 | pl011_event, NULL, s, NULL, true); |
85 | 32 | } | |
86 | for (i = 0; i < nr_apu_cpus; i++) { | 33 | |
87 | - DeviceState *cpudev = DEVICE(s->fpd.apu.cpu[i]); | 34 | +static void pl011_reset(DeviceState *dev) |
88 | + DeviceState *cpudev = DEVICE(&s->fpd.apu.cpu[i]); | 35 | +{ |
89 | int ppibase = XLNX_VERSAL_NR_IRQS + i * GIC_INTERNAL + GIC_NR_SGIS; | 36 | + PL011State *s = PL011(dev); |
90 | qemu_irq maint_irq; | 37 | + |
91 | int ti; | 38 | + s->lcr = 0; |
39 | + s->rsr = 0; | ||
40 | + s->dmacr = 0; | ||
41 | + s->int_enabled = 0; | ||
42 | + s->int_level = 0; | ||
43 | + s->ilpr = 0; | ||
44 | + s->ibrd = 0; | ||
45 | + s->fbrd = 0; | ||
46 | + s->read_pos = 0; | ||
47 | + s->read_count = 0; | ||
48 | + s->read_trigger = 1; | ||
49 | + s->ifl = 0x12; | ||
50 | + s->cr = 0x300; | ||
51 | + s->flags = 0x90; | ||
52 | +} | ||
53 | + | ||
54 | static void pl011_class_init(ObjectClass *oc, void *data) | ||
55 | { | ||
56 | DeviceClass *dc = DEVICE_CLASS(oc); | ||
57 | |||
58 | dc->realize = pl011_realize; | ||
59 | + dc->reset = pl011_reset; | ||
60 | dc->vmsd = &vmstate_pl011; | ||
61 | device_class_set_props(dc, pl011_properties); | ||
62 | } | ||
92 | -- | 63 | -- |
93 | 2.20.1 | 64 | 2.34.1 |
94 | 65 | ||
95 | 66 | diff view generated by jsdifflib |
1 | From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com> | 1 | From: Evgeny Iakovlev <eiakovlev@linux.microsoft.com> |
---|---|---|---|
2 | 2 | ||
3 | Add support for the RTC. | 3 | Current FIFO handling code does not reset RXFE/RXFF flags when guest |
4 | resets FIFO by writing to UARTLCR register, although internal FIFO state | ||
5 | is reset to 0 read count. Actual guest-visible flag update will happen | ||
6 | only on next data read or write attempt. As a result of that any guest | ||
7 | that expects RXFE flag to be set (and RXFF to be cleared) after resetting | ||
8 | FIFO will never see that happen. | ||
4 | 9 | ||
5 | Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | 10 | Signed-off-by: Evgeny Iakovlev <eiakovlev@linux.microsoft.com> |
6 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | 11 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
7 | Reviewed-by: Luc Michel <luc.michel@greensocs.com> | 12 | Message-id: 20230123162304.26254-5-eiakovlev@linux.microsoft.com |
8 | Message-id: 20200427181649.26851-12-edgar.iglesias@gmail.com | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 13 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
10 | --- | 14 | --- |
11 | hw/arm/xlnx-versal-virt.c | 22 ++++++++++++++++++++++ | 15 | hw/char/pl011.c | 18 +++++++++++++----- |
12 | 1 file changed, 22 insertions(+) | 16 | 1 file changed, 13 insertions(+), 5 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/char/pl011.c b/hw/char/pl011.c |
15 | index XXXXXXX..XXXXXXX 100644 | 19 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/hw/arm/xlnx-versal-virt.c | 20 | --- a/hw/char/pl011.c |
17 | +++ b/hw/arm/xlnx-versal-virt.c | 21 | +++ b/hw/char/pl011.c |
18 | @@ -XXX,XX +XXX,XX @@ static void fdt_add_sd_nodes(VersalVirt *s) | 22 | @@ -XXX,XX +XXX,XX @@ static inline unsigned pl011_get_fifo_depth(PL011State *s) |
19 | } | 23 | return pl011_is_fifo_enabled(s) ? PL011_FIFO_DEPTH : 1; |
20 | } | 24 | } |
21 | 25 | ||
22 | +static void fdt_add_rtc_node(VersalVirt *s) | 26 | +static inline void pl011_reset_fifo(PL011State *s) |
23 | +{ | 27 | +{ |
24 | + const char compat[] = "xlnx,zynqmp-rtc"; | 28 | + s->read_count = 0; |
25 | + const char interrupt_names[] = "alarm\0sec"; | 29 | + s->read_pos = 0; |
26 | + char *name = g_strdup_printf("/rtc@%x", MM_PMC_RTC); | ||
27 | + | 30 | + |
28 | + qemu_fdt_add_subnode(s->fdt, name); | 31 | + /* Reset FIFO flags */ |
29 | + | 32 | + s->flags &= ~(PL011_FLAG_RXFF | PL011_FLAG_TXFF); |
30 | + qemu_fdt_setprop_cells(s->fdt, name, "interrupts", | 33 | + s->flags |= PL011_FLAG_RXFE | PL011_FLAG_TXFE; |
31 | + GIC_FDT_IRQ_TYPE_SPI, VERSAL_RTC_ALARM_IRQ, | ||
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 | +} | 34 | +} |
42 | + | 35 | + |
43 | static void fdt_nop_memory_nodes(void *fdt, Error **errp) | 36 | static uint64_t pl011_read(void *opaque, hwaddr offset, |
37 | unsigned size) | ||
44 | { | 38 | { |
45 | Error *err = NULL; | 39 | @@ -XXX,XX +XXX,XX @@ static void pl011_write(void *opaque, hwaddr offset, |
46 | @@ -XXX,XX +XXX,XX @@ static void versal_virt_init(MachineState *machine) | 40 | case 11: /* UARTLCR_H */ |
47 | fdt_add_timer_nodes(s); | 41 | /* Reset the FIFO state on FIFO enable or disable */ |
48 | fdt_add_zdma_nodes(s); | 42 | if ((s->lcr ^ value) & 0x10) { |
49 | fdt_add_sd_nodes(s); | 43 | - s->read_count = 0; |
50 | + fdt_add_rtc_node(s); | 44 | - s->read_pos = 0; |
51 | fdt_add_cpu_nodes(s, psci_conduit); | 45 | + pl011_reset_fifo(s); |
52 | fdt_add_clk_node(s, "/clk125", 125000000, s->phandle.clk_125Mhz); | 46 | } |
53 | fdt_add_clk_node(s, "/clk25", 25000000, s->phandle.clk_25Mhz); | 47 | if ((s->lcr ^ value) & 0x1) { |
48 | int break_enable = value & 0x1; | ||
49 | @@ -XXX,XX +XXX,XX @@ static void pl011_reset(DeviceState *dev) | ||
50 | s->ilpr = 0; | ||
51 | s->ibrd = 0; | ||
52 | s->fbrd = 0; | ||
53 | - s->read_pos = 0; | ||
54 | - s->read_count = 0; | ||
55 | s->read_trigger = 1; | ||
56 | s->ifl = 0x12; | ||
57 | s->cr = 0x300; | ||
58 | - s->flags = 0x90; | ||
59 | + s->flags = 0; | ||
60 | + pl011_reset_fifo(s); | ||
61 | } | ||
62 | |||
63 | static void pl011_class_init(ObjectClass *oc, void *data) | ||
54 | -- | 64 | -- |
55 | 2.20.1 | 65 | 2.34.1 |
56 | |||
57 | diff view generated by jsdifflib |
1 | From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com> | 1 | From: Alexander Graf <agraf@csgraf.de> |
---|---|---|---|
2 | 2 | ||
3 | Add support for SD. | 3 | We currently only support GICv2 emulation. To also support GICv3, we will |
4 | 4 | need to pass a few system registers into their respective handler functions. | |
5 | Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | 5 | |
6 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | 6 | This patch adds support for HVF to call into the TCG callbacks for GICv3 |
7 | Reviewed-by: Luc Michel <luc.michel@greensocs.com> | 7 | system register handlers. This is safe because the GICv3 TCG code is generic |
8 | Message-id: 20200427181649.26851-11-edgar.iglesias@gmail.com | 8 | as long as we limit ourselves to EL0 and EL1 - which are the only modes |
9 | supported by HVF. | ||
10 | |||
11 | To make sure nobody trips over that, we also annotate callbacks that don't | ||
12 | work in HVF mode, such as EL state change hooks. | ||
13 | |||
14 | With GICv3 support in place, we can run with more than 8 vCPUs. | ||
15 | |||
16 | Signed-off-by: Alexander Graf <agraf@csgraf.de> | ||
17 | Message-id: 20230128224459.70676-1-agraf@csgraf.de | ||
18 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 19 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
10 | --- | 20 | --- |
11 | hw/arm/xlnx-versal-virt.c | 46 +++++++++++++++++++++++++++++++++++++++ | 21 | hw/intc/arm_gicv3_cpuif.c | 16 +++- |
12 | 1 file changed, 46 insertions(+) | 22 | target/arm/hvf/hvf.c | 151 ++++++++++++++++++++++++++++++++++++ |
13 | 23 | target/arm/hvf/trace-events | 2 + | |
14 | diff --git a/hw/arm/xlnx-versal-virt.c b/hw/arm/xlnx-versal-virt.c | 24 | 3 files changed, 168 insertions(+), 1 deletion(-) |
25 | |||
26 | diff --git a/hw/intc/arm_gicv3_cpuif.c b/hw/intc/arm_gicv3_cpuif.c | ||
15 | index XXXXXXX..XXXXXXX 100644 | 27 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/hw/arm/xlnx-versal-virt.c | 28 | --- a/hw/intc/arm_gicv3_cpuif.c |
17 | +++ b/hw/arm/xlnx-versal-virt.c | 29 | +++ b/hw/intc/arm_gicv3_cpuif.c |
18 | @@ -XXX,XX +XXX,XX @@ | 30 | @@ -XXX,XX +XXX,XX @@ |
19 | #include "hw/arm/sysbus-fdt.h" | 31 | #include "hw/irq.h" |
20 | #include "hw/arm/fdt.h" | ||
21 | #include "cpu.h" | 32 | #include "cpu.h" |
22 | +#include "hw/qdev-properties.h" | 33 | #include "target/arm/cpregs.h" |
23 | #include "hw/arm/xlnx-versal.h" | 34 | +#include "sysemu/tcg.h" |
24 | 35 | +#include "sysemu/qtest.h" | |
25 | #define TYPE_XLNX_VERSAL_VIRT_MACHINE MACHINE_TYPE_NAME("xlnx-versal-virt") | 36 | |
26 | @@ -XXX,XX +XXX,XX @@ static void fdt_add_zdma_nodes(VersalVirt *s) | 37 | /* |
38 | * Special case return value from hppvi_index(); must be larger than | ||
39 | @@ -XXX,XX +XXX,XX @@ void gicv3_init_cpuif(GICv3State *s) | ||
40 | * which case we'd get the wrong value. | ||
41 | * So instead we define the regs with no ri->opaque info, and | ||
42 | * get back to the GICv3CPUState from the CPUARMState. | ||
43 | + * | ||
44 | + * These CP regs callbacks can be called from either TCG or HVF code. | ||
45 | */ | ||
46 | define_arm_cp_regs(cpu, gicv3_cpuif_reginfo); | ||
47 | |||
48 | @@ -XXX,XX +XXX,XX @@ void gicv3_init_cpuif(GICv3State *s) | ||
49 | define_arm_cp_regs(cpu, gicv3_cpuif_ich_apxr23_reginfo); | ||
50 | } | ||
51 | } | ||
52 | - arm_register_el_change_hook(cpu, gicv3_cpuif_el_change_hook, cs); | ||
53 | + if (tcg_enabled() || qtest_enabled()) { | ||
54 | + /* | ||
55 | + * We can only trap EL changes with TCG. However the GIC interrupt | ||
56 | + * state only changes on EL changes involving EL2 or EL3, so for | ||
57 | + * the non-TCG case this is OK, as EL2 and EL3 can't exist. | ||
58 | + */ | ||
59 | + arm_register_el_change_hook(cpu, gicv3_cpuif_el_change_hook, cs); | ||
60 | + } else { | ||
61 | + assert(!arm_feature(&cpu->env, ARM_FEATURE_EL2)); | ||
62 | + assert(!arm_feature(&cpu->env, ARM_FEATURE_EL3)); | ||
63 | + } | ||
27 | } | 64 | } |
28 | } | 65 | } |
29 | 66 | diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c | |
30 | +static void fdt_add_sd_nodes(VersalVirt *s) | 67 | index XXXXXXX..XXXXXXX 100644 |
68 | --- a/target/arm/hvf/hvf.c | ||
69 | +++ b/target/arm/hvf/hvf.c | ||
70 | @@ -XXX,XX +XXX,XX @@ | ||
71 | #define SYSREG_PMCCNTR_EL0 SYSREG(3, 3, 9, 13, 0) | ||
72 | #define SYSREG_PMCCFILTR_EL0 SYSREG(3, 3, 14, 15, 7) | ||
73 | |||
74 | +#define SYSREG_ICC_AP0R0_EL1 SYSREG(3, 0, 12, 8, 4) | ||
75 | +#define SYSREG_ICC_AP0R1_EL1 SYSREG(3, 0, 12, 8, 5) | ||
76 | +#define SYSREG_ICC_AP0R2_EL1 SYSREG(3, 0, 12, 8, 6) | ||
77 | +#define SYSREG_ICC_AP0R3_EL1 SYSREG(3, 0, 12, 8, 7) | ||
78 | +#define SYSREG_ICC_AP1R0_EL1 SYSREG(3, 0, 12, 9, 0) | ||
79 | +#define SYSREG_ICC_AP1R1_EL1 SYSREG(3, 0, 12, 9, 1) | ||
80 | +#define SYSREG_ICC_AP1R2_EL1 SYSREG(3, 0, 12, 9, 2) | ||
81 | +#define SYSREG_ICC_AP1R3_EL1 SYSREG(3, 0, 12, 9, 3) | ||
82 | +#define SYSREG_ICC_ASGI1R_EL1 SYSREG(3, 0, 12, 11, 6) | ||
83 | +#define SYSREG_ICC_BPR0_EL1 SYSREG(3, 0, 12, 8, 3) | ||
84 | +#define SYSREG_ICC_BPR1_EL1 SYSREG(3, 0, 12, 12, 3) | ||
85 | +#define SYSREG_ICC_CTLR_EL1 SYSREG(3, 0, 12, 12, 4) | ||
86 | +#define SYSREG_ICC_DIR_EL1 SYSREG(3, 0, 12, 11, 1) | ||
87 | +#define SYSREG_ICC_EOIR0_EL1 SYSREG(3, 0, 12, 8, 1) | ||
88 | +#define SYSREG_ICC_EOIR1_EL1 SYSREG(3, 0, 12, 12, 1) | ||
89 | +#define SYSREG_ICC_HPPIR0_EL1 SYSREG(3, 0, 12, 8, 2) | ||
90 | +#define SYSREG_ICC_HPPIR1_EL1 SYSREG(3, 0, 12, 12, 2) | ||
91 | +#define SYSREG_ICC_IAR0_EL1 SYSREG(3, 0, 12, 8, 0) | ||
92 | +#define SYSREG_ICC_IAR1_EL1 SYSREG(3, 0, 12, 12, 0) | ||
93 | +#define SYSREG_ICC_IGRPEN0_EL1 SYSREG(3, 0, 12, 12, 6) | ||
94 | +#define SYSREG_ICC_IGRPEN1_EL1 SYSREG(3, 0, 12, 12, 7) | ||
95 | +#define SYSREG_ICC_PMR_EL1 SYSREG(3, 0, 4, 6, 0) | ||
96 | +#define SYSREG_ICC_RPR_EL1 SYSREG(3, 0, 12, 11, 3) | ||
97 | +#define SYSREG_ICC_SGI0R_EL1 SYSREG(3, 0, 12, 11, 7) | ||
98 | +#define SYSREG_ICC_SGI1R_EL1 SYSREG(3, 0, 12, 11, 5) | ||
99 | +#define SYSREG_ICC_SRE_EL1 SYSREG(3, 0, 12, 12, 5) | ||
100 | + | ||
101 | #define WFX_IS_WFE (1 << 0) | ||
102 | |||
103 | #define TMR_CTL_ENABLE (1 << 0) | ||
104 | @@ -XXX,XX +XXX,XX @@ static bool is_id_sysreg(uint32_t reg) | ||
105 | SYSREG_CRM(reg) < 8; | ||
106 | } | ||
107 | |||
108 | +static uint32_t hvf_reg2cp_reg(uint32_t reg) | ||
31 | +{ | 109 | +{ |
32 | + const char clocknames[] = "clk_xin\0clk_ahb"; | 110 | + return ENCODE_AA64_CP_REG(CP_REG_ARM64_SYSREG_CP, |
33 | + const char compat[] = "arasan,sdhci-8.9a"; | 111 | + (reg >> SYSREG_CRN_SHIFT) & SYSREG_CRN_MASK, |
34 | + int i; | 112 | + (reg >> SYSREG_CRM_SHIFT) & SYSREG_CRM_MASK, |
35 | + | 113 | + (reg >> SYSREG_OP0_SHIFT) & SYSREG_OP0_MASK, |
36 | + for (i = ARRAY_SIZE(s->soc.pmc.iou.sd) - 1; i >= 0; i--) { | 114 | + (reg >> SYSREG_OP1_SHIFT) & SYSREG_OP1_MASK, |
37 | + uint64_t addr = MM_PMC_SD0 + MM_PMC_SD0_SIZE * i; | 115 | + (reg >> SYSREG_OP2_SHIFT) & SYSREG_OP2_MASK); |
38 | + char *name = g_strdup_printf("/sdhci@%" PRIx64, addr); | 116 | +} |
39 | + | 117 | + |
40 | + qemu_fdt_add_subnode(s->fdt, name); | 118 | +static bool hvf_sysreg_read_cp(CPUState *cpu, uint32_t reg, uint64_t *val) |
41 | + | 119 | +{ |
42 | + qemu_fdt_setprop_cells(s->fdt, name, "clocks", | 120 | + ARMCPU *arm_cpu = ARM_CPU(cpu); |
43 | + s->phandle.clk_25Mhz, s->phandle.clk_25Mhz); | 121 | + CPUARMState *env = &arm_cpu->env; |
44 | + qemu_fdt_setprop(s->fdt, name, "clock-names", | 122 | + const ARMCPRegInfo *ri; |
45 | + clocknames, sizeof(clocknames)); | 123 | + |
46 | + qemu_fdt_setprop_cells(s->fdt, name, "interrupts", | 124 | + ri = get_arm_cp_reginfo(arm_cpu->cp_regs, hvf_reg2cp_reg(reg)); |
47 | + GIC_FDT_IRQ_TYPE_SPI, VERSAL_SD0_IRQ_0 + i * 2, | 125 | + if (ri) { |
48 | + GIC_FDT_IRQ_FLAGS_LEVEL_HI); | 126 | + if (ri->accessfn) { |
49 | + qemu_fdt_setprop_sized_cells(s->fdt, name, "reg", | 127 | + if (ri->accessfn(env, ri, true) != CP_ACCESS_OK) { |
50 | + 2, addr, 2, MM_PMC_SD0_SIZE); | 128 | + return false; |
51 | + qemu_fdt_setprop(s->fdt, name, "compatible", compat, sizeof(compat)); | 129 | + } |
52 | + g_free(name); | 130 | + } |
131 | + if (ri->type & ARM_CP_CONST) { | ||
132 | + *val = ri->resetvalue; | ||
133 | + } else if (ri->readfn) { | ||
134 | + *val = ri->readfn(env, ri); | ||
135 | + } else { | ||
136 | + *val = CPREG_FIELD64(env, ri); | ||
137 | + } | ||
138 | + trace_hvf_vgic_read(ri->name, *val); | ||
139 | + return true; | ||
53 | + } | 140 | + } |
141 | + | ||
142 | + return false; | ||
54 | +} | 143 | +} |
55 | + | 144 | + |
56 | static void fdt_nop_memory_nodes(void *fdt, Error **errp) | 145 | static int hvf_sysreg_read(CPUState *cpu, uint32_t reg, uint32_t rt) |
57 | { | 146 | { |
58 | Error *err = NULL; | 147 | ARMCPU *arm_cpu = ARM_CPU(cpu); |
59 | @@ -XXX,XX +XXX,XX @@ static void create_virtio_regions(VersalVirt *s) | 148 | @@ -XXX,XX +XXX,XX @@ static int hvf_sysreg_read(CPUState *cpu, uint32_t reg, uint32_t rt) |
149 | case SYSREG_OSDLR_EL1: | ||
150 | /* Dummy register */ | ||
151 | break; | ||
152 | + case SYSREG_ICC_AP0R0_EL1: | ||
153 | + case SYSREG_ICC_AP0R1_EL1: | ||
154 | + case SYSREG_ICC_AP0R2_EL1: | ||
155 | + case SYSREG_ICC_AP0R3_EL1: | ||
156 | + case SYSREG_ICC_AP1R0_EL1: | ||
157 | + case SYSREG_ICC_AP1R1_EL1: | ||
158 | + case SYSREG_ICC_AP1R2_EL1: | ||
159 | + case SYSREG_ICC_AP1R3_EL1: | ||
160 | + case SYSREG_ICC_ASGI1R_EL1: | ||
161 | + case SYSREG_ICC_BPR0_EL1: | ||
162 | + case SYSREG_ICC_BPR1_EL1: | ||
163 | + case SYSREG_ICC_DIR_EL1: | ||
164 | + case SYSREG_ICC_EOIR0_EL1: | ||
165 | + case SYSREG_ICC_EOIR1_EL1: | ||
166 | + case SYSREG_ICC_HPPIR0_EL1: | ||
167 | + case SYSREG_ICC_HPPIR1_EL1: | ||
168 | + case SYSREG_ICC_IAR0_EL1: | ||
169 | + case SYSREG_ICC_IAR1_EL1: | ||
170 | + case SYSREG_ICC_IGRPEN0_EL1: | ||
171 | + case SYSREG_ICC_IGRPEN1_EL1: | ||
172 | + case SYSREG_ICC_PMR_EL1: | ||
173 | + case SYSREG_ICC_SGI0R_EL1: | ||
174 | + case SYSREG_ICC_SGI1R_EL1: | ||
175 | + case SYSREG_ICC_SRE_EL1: | ||
176 | + case SYSREG_ICC_CTLR_EL1: | ||
177 | + /* Call the TCG sysreg handler. This is only safe for GICv3 regs. */ | ||
178 | + if (!hvf_sysreg_read_cp(cpu, reg, &val)) { | ||
179 | + hvf_raise_exception(cpu, EXCP_UDEF, syn_uncategorized()); | ||
180 | + } | ||
181 | + break; | ||
182 | default: | ||
183 | if (is_id_sysreg(reg)) { | ||
184 | /* ID system registers read as RES0 */ | ||
185 | @@ -XXX,XX +XXX,XX @@ static void pmswinc_write(CPUARMState *env, uint64_t value) | ||
60 | } | 186 | } |
61 | } | 187 | } |
62 | 188 | ||
63 | +static void sd_plugin_card(SDHCIState *sd, DriveInfo *di) | 189 | +static bool hvf_sysreg_write_cp(CPUState *cpu, uint32_t reg, uint64_t val) |
64 | +{ | 190 | +{ |
65 | + BlockBackend *blk = di ? blk_by_legacy_dinfo(di) : NULL; | 191 | + ARMCPU *arm_cpu = ARM_CPU(cpu); |
66 | + DeviceState *card; | 192 | + CPUARMState *env = &arm_cpu->env; |
67 | + | 193 | + const ARMCPRegInfo *ri; |
68 | + card = qdev_create(qdev_get_child_bus(DEVICE(sd), "sd-bus"), TYPE_SD_CARD); | 194 | + |
69 | + object_property_add_child(OBJECT(sd), "card[*]", OBJECT(card), | 195 | + ri = get_arm_cp_reginfo(arm_cpu->cp_regs, hvf_reg2cp_reg(reg)); |
70 | + &error_fatal); | 196 | + |
71 | + qdev_prop_set_drive(card, "drive", blk, &error_fatal); | 197 | + if (ri) { |
72 | + object_property_set_bool(OBJECT(card), true, "realized", &error_fatal); | 198 | + if (ri->accessfn) { |
199 | + if (ri->accessfn(env, ri, false) != CP_ACCESS_OK) { | ||
200 | + return false; | ||
201 | + } | ||
202 | + } | ||
203 | + if (ri->writefn) { | ||
204 | + ri->writefn(env, ri, val); | ||
205 | + } else { | ||
206 | + CPREG_FIELD64(env, ri) = val; | ||
207 | + } | ||
208 | + | ||
209 | + trace_hvf_vgic_write(ri->name, val); | ||
210 | + return true; | ||
211 | + } | ||
212 | + | ||
213 | + return false; | ||
73 | +} | 214 | +} |
74 | + | 215 | + |
75 | static void versal_virt_init(MachineState *machine) | 216 | static int hvf_sysreg_write(CPUState *cpu, uint32_t reg, uint64_t val) |
76 | { | 217 | { |
77 | VersalVirt *s = XLNX_VERSAL_VIRT_MACHINE(machine); | 218 | ARMCPU *arm_cpu = ARM_CPU(cpu); |
78 | int psci_conduit = QEMU_PSCI_CONDUIT_DISABLED; | 219 | @@ -XXX,XX +XXX,XX @@ static int hvf_sysreg_write(CPUState *cpu, uint32_t reg, uint64_t val) |
79 | + int i; | 220 | case SYSREG_OSDLR_EL1: |
80 | 221 | /* Dummy register */ | |
81 | /* | 222 | break; |
82 | * If the user provides an Operating System to be loaded, we expect them | 223 | + case SYSREG_ICC_AP0R0_EL1: |
83 | @@ -XXX,XX +XXX,XX @@ static void versal_virt_init(MachineState *machine) | 224 | + case SYSREG_ICC_AP0R1_EL1: |
84 | fdt_add_gic_nodes(s); | 225 | + case SYSREG_ICC_AP0R2_EL1: |
85 | fdt_add_timer_nodes(s); | 226 | + case SYSREG_ICC_AP0R3_EL1: |
86 | fdt_add_zdma_nodes(s); | 227 | + case SYSREG_ICC_AP1R0_EL1: |
87 | + fdt_add_sd_nodes(s); | 228 | + case SYSREG_ICC_AP1R1_EL1: |
88 | fdt_add_cpu_nodes(s, psci_conduit); | 229 | + case SYSREG_ICC_AP1R2_EL1: |
89 | fdt_add_clk_node(s, "/clk125", 125000000, s->phandle.clk_125Mhz); | 230 | + case SYSREG_ICC_AP1R3_EL1: |
90 | fdt_add_clk_node(s, "/clk25", 25000000, s->phandle.clk_25Mhz); | 231 | + case SYSREG_ICC_ASGI1R_EL1: |
91 | @@ -XXX,XX +XXX,XX @@ static void versal_virt_init(MachineState *machine) | 232 | + case SYSREG_ICC_BPR0_EL1: |
92 | memory_region_add_subregion_overlap(get_system_memory(), | 233 | + case SYSREG_ICC_BPR1_EL1: |
93 | 0, &s->soc.fpd.apu.mr, 0); | 234 | + case SYSREG_ICC_CTLR_EL1: |
94 | 235 | + case SYSREG_ICC_DIR_EL1: | |
95 | + /* Plugin SD cards. */ | 236 | + case SYSREG_ICC_EOIR0_EL1: |
96 | + for (i = 0; i < ARRAY_SIZE(s->soc.pmc.iou.sd); i++) { | 237 | + case SYSREG_ICC_EOIR1_EL1: |
97 | + sd_plugin_card(&s->soc.pmc.iou.sd[i], drive_get_next(IF_SD)); | 238 | + case SYSREG_ICC_HPPIR0_EL1: |
98 | + } | 239 | + case SYSREG_ICC_HPPIR1_EL1: |
99 | + | 240 | + case SYSREG_ICC_IAR0_EL1: |
100 | s->binfo.ram_size = machine->ram_size; | 241 | + case SYSREG_ICC_IAR1_EL1: |
101 | s->binfo.loader_start = 0x0; | 242 | + case SYSREG_ICC_IGRPEN0_EL1: |
102 | s->binfo.get_dtb = versal_virt_get_dtb; | 243 | + case SYSREG_ICC_IGRPEN1_EL1: |
244 | + case SYSREG_ICC_PMR_EL1: | ||
245 | + case SYSREG_ICC_SGI0R_EL1: | ||
246 | + case SYSREG_ICC_SGI1R_EL1: | ||
247 | + case SYSREG_ICC_SRE_EL1: | ||
248 | + /* Call the TCG sysreg handler. This is only safe for GICv3 regs. */ | ||
249 | + if (!hvf_sysreg_write_cp(cpu, reg, val)) { | ||
250 | + hvf_raise_exception(cpu, EXCP_UDEF, syn_uncategorized()); | ||
251 | + } | ||
252 | + break; | ||
253 | default: | ||
254 | cpu_synchronize_state(cpu); | ||
255 | trace_hvf_unhandled_sysreg_write(env->pc, reg, | ||
256 | diff --git a/target/arm/hvf/trace-events b/target/arm/hvf/trace-events | ||
257 | index XXXXXXX..XXXXXXX 100644 | ||
258 | --- a/target/arm/hvf/trace-events | ||
259 | +++ b/target/arm/hvf/trace-events | ||
260 | @@ -XXX,XX +XXX,XX @@ hvf_unknown_hvc(uint64_t x0) "unknown HVC! 0x%016"PRIx64 | ||
261 | hvf_unknown_smc(uint64_t x0) "unknown SMC! 0x%016"PRIx64 | ||
262 | hvf_exit(uint64_t syndrome, uint32_t ec, uint64_t pc) "exit: 0x%"PRIx64" [ec=0x%x pc=0x%"PRIx64"]" | ||
263 | hvf_psci_call(uint64_t x0, uint64_t x1, uint64_t x2, uint64_t x3, uint32_t cpuid) "PSCI Call x0=0x%016"PRIx64" x1=0x%016"PRIx64" x2=0x%016"PRIx64" x3=0x%016"PRIx64" cpu=0x%x" | ||
264 | +hvf_vgic_write(const char *name, uint64_t val) "vgic write to %s [val=0x%016"PRIx64"]" | ||
265 | +hvf_vgic_read(const char *name, uint64_t val) "vgic read from %s [val=0x%016"PRIx64"]" | ||
103 | -- | 266 | -- |
104 | 2.20.1 | 267 | 2.34.1 |
105 | |||
106 | diff view generated by jsdifflib |
1 | From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com> | 1 | From: Alexander Graf <agraf@csgraf.de> |
---|---|---|---|
2 | 2 | ||
3 | Add support for SD. | 3 | Up to now, the finalize_gic_version() code open coded what is essentially |
4 | 4 | a support bitmap match between host/emulation environment and desired | |
5 | Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | 5 | target GIC type. |
6 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | 6 | |
7 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 7 | This open coding leads to undesirable side effects. For example, a VM with |
8 | Reviewed-by: Luc Michel <luc.michel@greensocs.com> | 8 | KVM and -smp 10 will automatically choose GICv3 while the same command |
9 | Message-id: 20200427181649.26851-9-edgar.iglesias@gmail.com | 9 | line with TCG will stay on GICv2 and fail the launch. |
10 | |||
11 | This patch combines the TCG and KVM matching code paths by making | ||
12 | everything a 2 pass process. First, we determine which GIC versions the | ||
13 | current environment is able to support, then we go through a single | ||
14 | state machine to determine which target GIC mode that means for us. | ||
15 | |||
16 | After this patch, the only user noticable changes should be consolidated | ||
17 | error messages as well as TCG -M virt supporting -smp > 8 automatically. | ||
18 | |||
19 | Signed-off-by: Alexander Graf <agraf@csgraf.de> | ||
20 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
21 | Reviewed-by: Cornelia Huck <cohuck@redhat.com> | ||
22 | Reviewed-by: Zenghui Yu <yuzenghui@huawei.com> | ||
23 | Message-id: 20221223090107.98888-2-agraf@csgraf.de | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 24 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
11 | --- | 25 | --- |
12 | include/hw/arm/xlnx-versal.h | 12 ++++++++++++ | 26 | include/hw/arm/virt.h | 15 ++-- |
13 | hw/arm/xlnx-versal.c | 31 +++++++++++++++++++++++++++++++ | 27 | hw/arm/virt.c | 198 ++++++++++++++++++++++-------------------- |
14 | 2 files changed, 43 insertions(+) | 28 | 2 files changed, 112 insertions(+), 101 deletions(-) |
15 | 29 | ||
16 | diff --git a/include/hw/arm/xlnx-versal.h b/include/hw/arm/xlnx-versal.h | 30 | diff --git a/include/hw/arm/virt.h b/include/hw/arm/virt.h |
17 | index XXXXXXX..XXXXXXX 100644 | 31 | index XXXXXXX..XXXXXXX 100644 |
18 | --- a/include/hw/arm/xlnx-versal.h | 32 | --- a/include/hw/arm/virt.h |
19 | +++ b/include/hw/arm/xlnx-versal.h | 33 | +++ b/include/hw/arm/virt.h |
20 | @@ -XXX,XX +XXX,XX @@ | 34 | @@ -XXX,XX +XXX,XX @@ typedef enum VirtMSIControllerType { |
21 | 35 | } VirtMSIControllerType; | |
22 | #include "hw/sysbus.h" | 36 | |
23 | #include "hw/arm/boot.h" | 37 | typedef enum VirtGICType { |
24 | +#include "hw/sd/sdhci.h" | 38 | - VIRT_GIC_VERSION_MAX, |
25 | #include "hw/intc/arm_gicv3.h" | 39 | - VIRT_GIC_VERSION_HOST, |
26 | #include "hw/char/pl011.h" | 40 | - VIRT_GIC_VERSION_2, |
27 | #include "hw/dma/xlnx-zdma.h" | 41 | - VIRT_GIC_VERSION_3, |
28 | @@ -XXX,XX +XXX,XX @@ | 42 | - VIRT_GIC_VERSION_4, |
29 | #define XLNX_VERSAL_NR_UARTS 2 | 43 | + VIRT_GIC_VERSION_MAX = 0, |
30 | #define XLNX_VERSAL_NR_GEMS 2 | 44 | + VIRT_GIC_VERSION_HOST = 1, |
31 | #define XLNX_VERSAL_NR_ADMAS 8 | 45 | + /* The concrete GIC values have to match the GIC version number */ |
32 | +#define XLNX_VERSAL_NR_SDS 2 | 46 | + VIRT_GIC_VERSION_2 = 2, |
33 | #define XLNX_VERSAL_NR_IRQS 192 | 47 | + VIRT_GIC_VERSION_3 = 3, |
34 | 48 | + VIRT_GIC_VERSION_4 = 4, | |
35 | typedef struct Versal { | 49 | VIRT_GIC_VERSION_NOSEL, |
36 | @@ -XXX,XX +XXX,XX @@ typedef struct Versal { | 50 | } VirtGICType; |
37 | } iou; | 51 | |
38 | } lpd; | 52 | +#define VIRT_GIC_VERSION_2_MASK BIT(VIRT_GIC_VERSION_2) |
39 | 53 | +#define VIRT_GIC_VERSION_3_MASK BIT(VIRT_GIC_VERSION_3) | |
40 | + /* The Platform Management Controller subsystem. */ | 54 | +#define VIRT_GIC_VERSION_4_MASK BIT(VIRT_GIC_VERSION_4) |
41 | + struct { | 55 | + |
42 | + struct { | 56 | struct VirtMachineClass { |
43 | + SDHCIState sd[XLNX_VERSAL_NR_SDS]; | 57 | MachineClass parent; |
44 | + } iou; | 58 | bool disallow_affinity_adjustment; |
45 | + } pmc; | 59 | diff --git a/hw/arm/virt.c b/hw/arm/virt.c |
46 | + | ||
47 | struct { | ||
48 | MemoryRegion *mr_ddr; | ||
49 | uint32_t psci_conduit; | ||
50 | @@ -XXX,XX +XXX,XX @@ typedef struct Versal { | ||
51 | #define VERSAL_GEM1_IRQ_0 58 | ||
52 | #define VERSAL_GEM1_WAKE_IRQ_0 59 | ||
53 | #define VERSAL_ADMA_IRQ_0 60 | ||
54 | +#define VERSAL_SD0_IRQ_0 126 | ||
55 | |||
56 | /* Architecturally reserved IRQs suitable for virtualization. */ | ||
57 | #define VERSAL_RSVD_IRQ_FIRST 111 | ||
58 | @@ -XXX,XX +XXX,XX @@ typedef struct Versal { | ||
59 | #define MM_FPD_CRF 0xfd1a0000U | ||
60 | #define MM_FPD_CRF_SIZE 0x140000 | ||
61 | |||
62 | +#define MM_PMC_SD0 0xf1040000U | ||
63 | +#define MM_PMC_SD0_SIZE 0x10000 | ||
64 | #define MM_PMC_CRP 0xf1260000U | ||
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 | 60 | index XXXXXXX..XXXXXXX 100644 |
69 | --- a/hw/arm/xlnx-versal.c | 61 | --- a/hw/arm/virt.c |
70 | +++ b/hw/arm/xlnx-versal.c | 62 | +++ b/hw/arm/virt.c |
71 | @@ -XXX,XX +XXX,XX @@ static void versal_create_admas(Versal *s, qemu_irq *pic) | 63 | @@ -XXX,XX +XXX,XX @@ static void virt_set_memmap(VirtMachineState *vms, int pa_bits) |
72 | } | 64 | } |
73 | } | 65 | } |
74 | 66 | ||
75 | +#define SDHCI_CAPABILITIES 0x280737ec6481 /* Same as on ZynqMP. */ | 67 | +static VirtGICType finalize_gic_version_do(const char *accel_name, |
76 | +static void versal_create_sds(Versal *s, qemu_irq *pic) | 68 | + VirtGICType gic_version, |
69 | + int gics_supported, | ||
70 | + unsigned int max_cpus) | ||
77 | +{ | 71 | +{ |
78 | + int i; | 72 | + /* Convert host/max/nosel to GIC version number */ |
79 | + | 73 | + switch (gic_version) { |
80 | + for (i = 0; i < ARRAY_SIZE(s->pmc.iou.sd); i++) { | 74 | + case VIRT_GIC_VERSION_HOST: |
81 | + DeviceState *dev; | 75 | + if (!kvm_enabled()) { |
82 | + MemoryRegion *mr; | 76 | + error_report("gic-version=host requires KVM"); |
83 | + | 77 | + exit(1); |
84 | + sysbus_init_child_obj(OBJECT(s), "sd[*]", | 78 | + } |
85 | + &s->pmc.iou.sd[i], sizeof(s->pmc.iou.sd[i]), | 79 | + |
86 | + TYPE_SYSBUS_SDHCI); | 80 | + /* For KVM, gic-version=host means gic-version=max */ |
87 | + dev = DEVICE(&s->pmc.iou.sd[i]); | 81 | + return finalize_gic_version_do(accel_name, VIRT_GIC_VERSION_MAX, |
88 | + | 82 | + gics_supported, max_cpus); |
89 | + object_property_set_uint(OBJECT(dev), | 83 | + case VIRT_GIC_VERSION_MAX: |
90 | + 3, "sd-spec-version", &error_fatal); | 84 | + if (gics_supported & VIRT_GIC_VERSION_4_MASK) { |
91 | + object_property_set_uint(OBJECT(dev), SDHCI_CAPABILITIES, "capareg", | 85 | + gic_version = VIRT_GIC_VERSION_4; |
92 | + &error_fatal); | 86 | + } else if (gics_supported & VIRT_GIC_VERSION_3_MASK) { |
93 | + object_property_set_uint(OBJECT(dev), UHS_I, "uhs", &error_fatal); | 87 | + gic_version = VIRT_GIC_VERSION_3; |
94 | + qdev_init_nofail(dev); | 88 | + } else { |
95 | + | 89 | + gic_version = VIRT_GIC_VERSION_2; |
96 | + mr = sysbus_mmio_get_region(SYS_BUS_DEVICE(dev), 0); | 90 | + } |
97 | + memory_region_add_subregion(&s->mr_ps, | 91 | + break; |
98 | + MM_PMC_SD0 + i * MM_PMC_SD0_SIZE, mr); | 92 | + case VIRT_GIC_VERSION_NOSEL: |
99 | + | 93 | + if ((gics_supported & VIRT_GIC_VERSION_2_MASK) && |
100 | + sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, | 94 | + max_cpus <= GIC_NCPU) { |
101 | + pic[VERSAL_SD0_IRQ_0 + i * 2]); | 95 | + gic_version = VIRT_GIC_VERSION_2; |
96 | + } else if (gics_supported & VIRT_GIC_VERSION_3_MASK) { | ||
97 | + /* | ||
98 | + * in case the host does not support v2 emulation or | ||
99 | + * the end-user requested more than 8 VCPUs we now default | ||
100 | + * to v3. In any case defaulting to v2 would be broken. | ||
101 | + */ | ||
102 | + gic_version = VIRT_GIC_VERSION_3; | ||
103 | + } else if (max_cpus > GIC_NCPU) { | ||
104 | + error_report("%s only supports GICv2 emulation but more than 8 " | ||
105 | + "vcpus are requested", accel_name); | ||
106 | + exit(1); | ||
107 | + } | ||
108 | + break; | ||
109 | + case VIRT_GIC_VERSION_2: | ||
110 | + case VIRT_GIC_VERSION_3: | ||
111 | + case VIRT_GIC_VERSION_4: | ||
112 | + break; | ||
102 | + } | 113 | + } |
114 | + | ||
115 | + /* Check chosen version is effectively supported */ | ||
116 | + switch (gic_version) { | ||
117 | + case VIRT_GIC_VERSION_2: | ||
118 | + if (!(gics_supported & VIRT_GIC_VERSION_2_MASK)) { | ||
119 | + error_report("%s does not support GICv2 emulation", accel_name); | ||
120 | + exit(1); | ||
121 | + } | ||
122 | + break; | ||
123 | + case VIRT_GIC_VERSION_3: | ||
124 | + if (!(gics_supported & VIRT_GIC_VERSION_3_MASK)) { | ||
125 | + error_report("%s does not support GICv3 emulation", accel_name); | ||
126 | + exit(1); | ||
127 | + } | ||
128 | + break; | ||
129 | + case VIRT_GIC_VERSION_4: | ||
130 | + if (!(gics_supported & VIRT_GIC_VERSION_4_MASK)) { | ||
131 | + error_report("%s does not support GICv4 emulation, is virtualization=on?", | ||
132 | + accel_name); | ||
133 | + exit(1); | ||
134 | + } | ||
135 | + break; | ||
136 | + default: | ||
137 | + error_report("logic error in finalize_gic_version"); | ||
138 | + exit(1); | ||
139 | + break; | ||
140 | + } | ||
141 | + | ||
142 | + return gic_version; | ||
103 | +} | 143 | +} |
104 | + | 144 | + |
105 | /* This takes the board allocated linear DDR memory and creates aliases | 145 | /* |
106 | * for each split DDR range/aperture on the Versal address map. | 146 | * finalize_gic_version - Determines the final gic_version |
147 | * according to the gic-version property | ||
148 | @@ -XXX,XX +XXX,XX @@ static void virt_set_memmap(VirtMachineState *vms, int pa_bits) | ||
107 | */ | 149 | */ |
108 | @@ -XXX,XX +XXX,XX @@ static void versal_realize(DeviceState *dev, Error **errp) | 150 | static void finalize_gic_version(VirtMachineState *vms) |
109 | versal_create_uarts(s, pic); | 151 | { |
110 | versal_create_gems(s, pic); | 152 | + const char *accel_name = current_accel_name(); |
111 | versal_create_admas(s, pic); | 153 | unsigned int max_cpus = MACHINE(vms)->smp.max_cpus; |
112 | + versal_create_sds(s, pic); | 154 | + int gics_supported = 0; |
113 | versal_map_ddr(s); | 155 | |
114 | versal_unimp(s); | 156 | - if (kvm_enabled()) { |
115 | 157 | - int probe_bitmap; | |
158 | + /* Determine which GIC versions the current environment supports */ | ||
159 | + if (kvm_enabled() && kvm_irqchip_in_kernel()) { | ||
160 | + int probe_bitmap = kvm_arm_vgic_probe(); | ||
161 | |||
162 | - if (!kvm_irqchip_in_kernel()) { | ||
163 | - switch (vms->gic_version) { | ||
164 | - case VIRT_GIC_VERSION_HOST: | ||
165 | - warn_report( | ||
166 | - "gic-version=host not relevant with kernel-irqchip=off " | ||
167 | - "as only userspace GICv2 is supported. Using v2 ..."); | ||
168 | - return; | ||
169 | - case VIRT_GIC_VERSION_MAX: | ||
170 | - case VIRT_GIC_VERSION_NOSEL: | ||
171 | - vms->gic_version = VIRT_GIC_VERSION_2; | ||
172 | - return; | ||
173 | - case VIRT_GIC_VERSION_2: | ||
174 | - return; | ||
175 | - case VIRT_GIC_VERSION_3: | ||
176 | - error_report( | ||
177 | - "gic-version=3 is not supported with kernel-irqchip=off"); | ||
178 | - exit(1); | ||
179 | - case VIRT_GIC_VERSION_4: | ||
180 | - error_report( | ||
181 | - "gic-version=4 is not supported with kernel-irqchip=off"); | ||
182 | - exit(1); | ||
183 | - } | ||
184 | - } | ||
185 | - | ||
186 | - probe_bitmap = kvm_arm_vgic_probe(); | ||
187 | if (!probe_bitmap) { | ||
188 | error_report("Unable to determine GIC version supported by host"); | ||
189 | exit(1); | ||
190 | } | ||
191 | |||
192 | - switch (vms->gic_version) { | ||
193 | - case VIRT_GIC_VERSION_HOST: | ||
194 | - case VIRT_GIC_VERSION_MAX: | ||
195 | - if (probe_bitmap & KVM_ARM_VGIC_V3) { | ||
196 | - vms->gic_version = VIRT_GIC_VERSION_3; | ||
197 | - } else { | ||
198 | - vms->gic_version = VIRT_GIC_VERSION_2; | ||
199 | - } | ||
200 | - return; | ||
201 | - case VIRT_GIC_VERSION_NOSEL: | ||
202 | - if ((probe_bitmap & KVM_ARM_VGIC_V2) && max_cpus <= GIC_NCPU) { | ||
203 | - vms->gic_version = VIRT_GIC_VERSION_2; | ||
204 | - } else if (probe_bitmap & KVM_ARM_VGIC_V3) { | ||
205 | - /* | ||
206 | - * in case the host does not support v2 in-kernel emulation or | ||
207 | - * the end-user requested more than 8 VCPUs we now default | ||
208 | - * to v3. In any case defaulting to v2 would be broken. | ||
209 | - */ | ||
210 | - vms->gic_version = VIRT_GIC_VERSION_3; | ||
211 | - } else if (max_cpus > GIC_NCPU) { | ||
212 | - error_report("host only supports in-kernel GICv2 emulation " | ||
213 | - "but more than 8 vcpus are requested"); | ||
214 | - exit(1); | ||
215 | - } | ||
216 | - break; | ||
217 | - case VIRT_GIC_VERSION_2: | ||
218 | - case VIRT_GIC_VERSION_3: | ||
219 | - break; | ||
220 | - case VIRT_GIC_VERSION_4: | ||
221 | - error_report("gic-version=4 is not supported with KVM"); | ||
222 | - exit(1); | ||
223 | + if (probe_bitmap & KVM_ARM_VGIC_V2) { | ||
224 | + gics_supported |= VIRT_GIC_VERSION_2_MASK; | ||
225 | } | ||
226 | - | ||
227 | - /* Check chosen version is effectively supported by the host */ | ||
228 | - if (vms->gic_version == VIRT_GIC_VERSION_2 && | ||
229 | - !(probe_bitmap & KVM_ARM_VGIC_V2)) { | ||
230 | - error_report("host does not support in-kernel GICv2 emulation"); | ||
231 | - exit(1); | ||
232 | - } else if (vms->gic_version == VIRT_GIC_VERSION_3 && | ||
233 | - !(probe_bitmap & KVM_ARM_VGIC_V3)) { | ||
234 | - error_report("host does not support in-kernel GICv3 emulation"); | ||
235 | - exit(1); | ||
236 | + if (probe_bitmap & KVM_ARM_VGIC_V3) { | ||
237 | + gics_supported |= VIRT_GIC_VERSION_3_MASK; | ||
238 | } | ||
239 | - return; | ||
240 | - } | ||
241 | - | ||
242 | - /* TCG mode */ | ||
243 | - switch (vms->gic_version) { | ||
244 | - case VIRT_GIC_VERSION_NOSEL: | ||
245 | - vms->gic_version = VIRT_GIC_VERSION_2; | ||
246 | - break; | ||
247 | - case VIRT_GIC_VERSION_MAX: | ||
248 | + } else if (kvm_enabled() && !kvm_irqchip_in_kernel()) { | ||
249 | + /* KVM w/o kernel irqchip can only deal with GICv2 */ | ||
250 | + gics_supported |= VIRT_GIC_VERSION_2_MASK; | ||
251 | + accel_name = "KVM with kernel-irqchip=off"; | ||
252 | + } else { | ||
253 | + gics_supported |= VIRT_GIC_VERSION_2_MASK; | ||
254 | if (module_object_class_by_name("arm-gicv3")) { | ||
255 | - /* CONFIG_ARM_GICV3_TCG was set */ | ||
256 | + gics_supported |= VIRT_GIC_VERSION_3_MASK; | ||
257 | if (vms->virt) { | ||
258 | /* GICv4 only makes sense if CPU has EL2 */ | ||
259 | - vms->gic_version = VIRT_GIC_VERSION_4; | ||
260 | - } else { | ||
261 | - vms->gic_version = VIRT_GIC_VERSION_3; | ||
262 | + gics_supported |= VIRT_GIC_VERSION_4_MASK; | ||
263 | } | ||
264 | - } else { | ||
265 | - vms->gic_version = VIRT_GIC_VERSION_2; | ||
266 | } | ||
267 | - break; | ||
268 | - case VIRT_GIC_VERSION_HOST: | ||
269 | - error_report("gic-version=host requires KVM"); | ||
270 | - exit(1); | ||
271 | - case VIRT_GIC_VERSION_4: | ||
272 | - if (!vms->virt) { | ||
273 | - error_report("gic-version=4 requires virtualization enabled"); | ||
274 | - exit(1); | ||
275 | - } | ||
276 | - break; | ||
277 | - case VIRT_GIC_VERSION_2: | ||
278 | - case VIRT_GIC_VERSION_3: | ||
279 | - break; | ||
280 | } | ||
281 | + | ||
282 | + /* | ||
283 | + * Then convert helpers like host/max to concrete GIC versions and ensure | ||
284 | + * the desired version is supported | ||
285 | + */ | ||
286 | + vms->gic_version = finalize_gic_version_do(accel_name, vms->gic_version, | ||
287 | + gics_supported, max_cpus); | ||
288 | } | ||
289 | |||
290 | /* | ||
116 | -- | 291 | -- |
117 | 2.20.1 | 292 | 2.34.1 |
118 | |||
119 | diff view generated by jsdifflib |
1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> | 1 | From: Alexander Graf <agraf@csgraf.de> |
---|---|---|---|
2 | 2 | ||
3 | By using the TYPE_* definitions for devices, we can: | 3 | Let's explicitly list out all accelerators that we support when trying to |
4 | - quickly find where devices are used with 'git-grep' | 4 | determine the supported set of GIC versions. KVM was already separate, so |
5 | - easily rename a device (one-line change). | 5 | the only missing one is HVF which simply reuses all of TCG's emulation |
6 | code and thus has the same compatibility matrix. | ||
6 | 7 | ||
7 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 8 | Signed-off-by: Alexander Graf <agraf@csgraf.de> |
8 | Message-id: 20200428154650.21991-1-f4bug@amsat.org | 9 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
9 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Reviewed-by: Cornelia Huck <cohuck@redhat.com> |
11 | Reviewed-by: Zenghui Yu <yuzenghui@huawei.com> | ||
12 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
13 | Message-id: 20221223090107.98888-3-agraf@csgraf.de | ||
14 | [PMM: Added qtest to the list of accelerators] | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 15 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
11 | --- | 16 | --- |
12 | hw/arm/mps2-tz.c | 2 +- | 17 | hw/arm/virt.c | 7 ++++++- |
13 | 1 file changed, 1 insertion(+), 1 deletion(-) | 18 | 1 file changed, 6 insertions(+), 1 deletion(-) |
14 | 19 | ||
15 | diff --git a/hw/arm/mps2-tz.c b/hw/arm/mps2-tz.c | 20 | diff --git a/hw/arm/virt.c b/hw/arm/virt.c |
16 | index XXXXXXX..XXXXXXX 100644 | 21 | index XXXXXXX..XXXXXXX 100644 |
17 | --- a/hw/arm/mps2-tz.c | 22 | --- a/hw/arm/virt.c |
18 | +++ b/hw/arm/mps2-tz.c | 23 | +++ b/hw/arm/virt.c |
19 | @@ -XXX,XX +XXX,XX @@ static void mps2tz_common_init(MachineState *machine) | 24 | @@ -XXX,XX +XXX,XX @@ |
20 | exit(EXIT_FAILURE); | 25 | #include "sysemu/numa.h" |
26 | #include "sysemu/runstate.h" | ||
27 | #include "sysemu/tpm.h" | ||
28 | +#include "sysemu/tcg.h" | ||
29 | #include "sysemu/kvm.h" | ||
30 | #include "sysemu/hvf.h" | ||
31 | +#include "sysemu/qtest.h" | ||
32 | #include "hw/loader.h" | ||
33 | #include "qapi/error.h" | ||
34 | #include "qemu/bitops.h" | ||
35 | @@ -XXX,XX +XXX,XX @@ static void finalize_gic_version(VirtMachineState *vms) | ||
36 | /* KVM w/o kernel irqchip can only deal with GICv2 */ | ||
37 | gics_supported |= VIRT_GIC_VERSION_2_MASK; | ||
38 | accel_name = "KVM with kernel-irqchip=off"; | ||
39 | - } else { | ||
40 | + } else if (tcg_enabled() || hvf_enabled() || qtest_enabled()) { | ||
41 | gics_supported |= VIRT_GIC_VERSION_2_MASK; | ||
42 | if (module_object_class_by_name("arm-gicv3")) { | ||
43 | gics_supported |= VIRT_GIC_VERSION_3_MASK; | ||
44 | @@ -XXX,XX +XXX,XX @@ static void finalize_gic_version(VirtMachineState *vms) | ||
45 | gics_supported |= VIRT_GIC_VERSION_4_MASK; | ||
46 | } | ||
47 | } | ||
48 | + } else { | ||
49 | + error_report("Unsupported accelerator, can not determine GIC support"); | ||
50 | + exit(1); | ||
21 | } | 51 | } |
22 | 52 | ||
23 | - sysbus_init_child_obj(OBJECT(machine), "iotkit", &mms->iotkit, | 53 | /* |
24 | + sysbus_init_child_obj(OBJECT(machine), TYPE_IOTKIT, &mms->iotkit, | ||
25 | sizeof(mms->iotkit), mmc->armsse_type); | ||
26 | iotkitdev = DEVICE(&mms->iotkit); | ||
27 | object_property_set_link(OBJECT(&mms->iotkit), OBJECT(system_memory), | ||
28 | -- | 54 | -- |
29 | 2.20.1 | 55 | 2.34.1 |
30 | 56 | ||
31 | 57 | diff view generated by jsdifflib |
1 | From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com> | 1 | From: Marcin Juszkiewicz <marcin.juszkiewicz@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Remove inclusion of arm_gicv3_common.h, this already gets | 3 | Cortex-A76 supports 40bits of address space. sbsa-ref's memory |
4 | included via xlnx-versal.h. | 4 | starts above this limit. |
5 | 5 | ||
6 | Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | 6 | Signed-off-by: Marcin Juszkiewicz <marcin.juszkiewicz@linaro.org> |
7 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | 7 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> |
8 | Reviewed-by: Luc Michel <luc.michel@greensocs.com> | 8 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
9 | Message-id: 20200427181649.26851-2-edgar.iglesias@gmail.com | 9 | Message-id: 20230126114416.2447685-1-marcin.juszkiewicz@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/xlnx-versal.c | 1 - | 12 | hw/arm/sbsa-ref.c | 1 - |
13 | 1 file changed, 1 deletion(-) | 13 | 1 file changed, 1 deletion(-) |
14 | 14 | ||
15 | diff --git a/hw/arm/xlnx-versal.c b/hw/arm/xlnx-versal.c | 15 | diff --git a/hw/arm/sbsa-ref.c b/hw/arm/sbsa-ref.c |
16 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
17 | --- a/hw/arm/xlnx-versal.c | 17 | --- a/hw/arm/sbsa-ref.c |
18 | +++ b/hw/arm/xlnx-versal.c | 18 | +++ b/hw/arm/sbsa-ref.c |
19 | @@ -XXX,XX +XXX,XX @@ | 19 | @@ -XXX,XX +XXX,XX @@ static const int sbsa_ref_irqmap[] = { |
20 | #include "hw/arm/boot.h" | 20 | static const char * const valid_cpus[] = { |
21 | #include "kvm_arm.h" | 21 | ARM_CPU_TYPE_NAME("cortex-a57"), |
22 | #include "hw/misc/unimp.h" | 22 | ARM_CPU_TYPE_NAME("cortex-a72"), |
23 | -#include "hw/intc/arm_gicv3_common.h" | 23 | - ARM_CPU_TYPE_NAME("cortex-a76"), |
24 | #include "hw/arm/xlnx-versal.h" | 24 | ARM_CPU_TYPE_NAME("neoverse-n1"), |
25 | #include "hw/char/pl011.h" | 25 | ARM_CPU_TYPE_NAME("max"), |
26 | 26 | }; | |
27 | -- | 27 | -- |
28 | 2.20.1 | 28 | 2.34.1 |
29 | 29 | ||
30 | 30 | diff view generated by jsdifflib |
1 | The access_type argument to get_phys_addr_lpae() is an MMUAccessType; | 1 | The encodings 0,0,C7,C9,0 and 0,0,C7,C9,1 are AT SP1E1RP and AT |
---|---|---|---|
2 | use the enum constant MMU_DATA_LOAD rather than a literal 0 when we | 2 | S1E1WP, but our ARMCPRegInfo definitions for them incorrectly name |
3 | call it in S1_ptw_translate(). | 3 | them AT S1E1R and AT S1E1W (which are entirely different |
4 | instructions). Fix the names. | ||
5 | |||
6 | (This has no guest-visible effect as the names are for debug purposes | ||
7 | only.) | ||
4 | 8 | ||
5 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
6 | Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | ||
7 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 10 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
8 | Message-id: 20200330210400.11724-3-peter.maydell@linaro.org | 11 | Tested-by: Fuad Tabba <tabba@google.com> |
12 | Message-id: 20230130182459.3309057-2-peter.maydell@linaro.org | ||
13 | Message-id: 20230127175507.2895013-2-peter.maydell@linaro.org | ||
9 | --- | 14 | --- |
10 | target/arm/helper.c | 5 +++-- | 15 | target/arm/helper.c | 4 ++-- |
11 | 1 file changed, 3 insertions(+), 2 deletions(-) | 16 | 1 file changed, 2 insertions(+), 2 deletions(-) |
12 | 17 | ||
13 | diff --git a/target/arm/helper.c b/target/arm/helper.c | 18 | diff --git a/target/arm/helper.c b/target/arm/helper.c |
14 | index XXXXXXX..XXXXXXX 100644 | 19 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/target/arm/helper.c | 20 | --- a/target/arm/helper.c |
16 | +++ b/target/arm/helper.c | 21 | +++ b/target/arm/helper.c |
17 | @@ -XXX,XX +XXX,XX @@ static hwaddr S1_ptw_translate(CPUARMState *env, ARMMMUIdx mmu_idx, | 22 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo vhe_reginfo[] = { |
18 | pcacheattrs = &cacheattrs; | 23 | |
19 | } | 24 | #ifndef CONFIG_USER_ONLY |
20 | 25 | static const ARMCPRegInfo ats1e1_reginfo[] = { | |
21 | - ret = get_phys_addr_lpae(env, addr, 0, ARMMMUIdx_Stage2, &s2pa, | 26 | - { .name = "AT_S1E1R", .state = ARM_CP_STATE_AA64, |
22 | - &txattrs, &s2prot, &s2size, fi, pcacheattrs); | 27 | + { .name = "AT_S1E1RP", .state = ARM_CP_STATE_AA64, |
23 | + ret = get_phys_addr_lpae(env, addr, MMU_DATA_LOAD, ARMMMUIdx_Stage2, | 28 | .opc0 = 1, .opc1 = 0, .crn = 7, .crm = 9, .opc2 = 0, |
24 | + &s2pa, &txattrs, &s2prot, &s2size, fi, | 29 | .access = PL1_W, .type = ARM_CP_NO_RAW | ARM_CP_RAISES_EXC, |
25 | + pcacheattrs); | 30 | .writefn = ats_write64 }, |
26 | if (ret) { | 31 | - { .name = "AT_S1E1W", .state = ARM_CP_STATE_AA64, |
27 | assert(fi->type != ARMFault_None); | 32 | + { .name = "AT_S1E1WP", .state = ARM_CP_STATE_AA64, |
28 | fi->s2addr = addr; | 33 | .opc0 = 1, .opc1 = 0, .crn = 7, .crm = 9, .opc2 = 1, |
34 | .access = PL1_W, .type = ARM_CP_NO_RAW | ARM_CP_RAISES_EXC, | ||
35 | .writefn = ats_write64 }, | ||
29 | -- | 36 | -- |
30 | 2.20.1 | 37 | 2.34.1 |
31 | |||
32 | diff view generated by jsdifflib |
1 | Convert the Neon VMUL, VMLA, VMLS and VSHL insns in the | 1 | The AArch32 ATS12NSO* address translation operations are supposed to |
---|---|---|---|
2 | 3-reg-same grouping to decodetree. | 2 | trap to either EL2 or EL3 if they're executed at Secure EL1 (which |
3 | can only happen if EL3 is AArch64). We implement this, but we got | ||
4 | the syndrome value wrong: like other traps to EL2 or EL3 on an | ||
5 | AArch32 cpreg access, they should report the 0x3 syndrome, not the | ||
6 | 0x0 'uncategorized' syndrome. This is clear in the access pseudocode | ||
7 | for these instructions. | ||
8 | |||
9 | Fix the syndrome value for these operations by correcting the | ||
10 | returned value from the ats_access() function. | ||
3 | 11 | ||
4 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
5 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 13 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
6 | Message-id: 20200430181003.21682-20-peter.maydell@linaro.org | 14 | Tested-by: Fuad Tabba <tabba@google.com> |
15 | Message-id: 20230130182459.3309057-3-peter.maydell@linaro.org | ||
16 | Message-id: 20230127175507.2895013-3-peter.maydell@linaro.org | ||
7 | --- | 17 | --- |
8 | target/arm/neon-dp.decode | 9 +++++++ | 18 | target/arm/helper.c | 4 ++-- |
9 | target/arm/translate-neon.inc.c | 44 +++++++++++++++++++++++++++++++++ | 19 | 1 file changed, 2 insertions(+), 2 deletions(-) |
10 | target/arm/translate.c | 28 +++------------------ | ||
11 | 3 files changed, 56 insertions(+), 25 deletions(-) | ||
12 | 20 | ||
13 | diff --git a/target/arm/neon-dp.decode b/target/arm/neon-dp.decode | 21 | diff --git a/target/arm/helper.c b/target/arm/helper.c |
14 | index XXXXXXX..XXXXXXX 100644 | 22 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/target/arm/neon-dp.decode | 23 | --- a/target/arm/helper.c |
16 | +++ b/target/arm/neon-dp.decode | 24 | +++ b/target/arm/helper.c |
17 | @@ -XXX,XX +XXX,XX @@ VCGT_U_3s 1111 001 1 0 . .. .... .... 0011 . . . 0 .... @3same | 25 | @@ -XXX,XX +XXX,XX @@ static CPAccessResult ats_access(CPUARMState *env, const ARMCPRegInfo *ri, |
18 | VCGE_S_3s 1111 001 0 0 . .. .... .... 0011 . . . 1 .... @3same | 26 | if (arm_current_el(env) == 1) { |
19 | VCGE_U_3s 1111 001 1 0 . .. .... .... 0011 . . . 1 .... @3same | 27 | if (arm_is_secure_below_el3(env)) { |
20 | 28 | if (env->cp15.scr_el3 & SCR_EEL2) { | |
21 | +VSHL_S_3s 1111 001 0 0 . .. .... .... 0100 . . . 0 .... @3same | 29 | - return CP_ACCESS_TRAP_UNCATEGORIZED_EL2; |
22 | +VSHL_U_3s 1111 001 1 0 . .. .... .... 0100 . . . 0 .... @3same | 30 | + return CP_ACCESS_TRAP_EL2; |
23 | + | 31 | } |
24 | VMAX_S_3s 1111 001 0 0 . .. .... .... 0110 . . . 0 .... @3same | 32 | - return CP_ACCESS_TRAP_UNCATEGORIZED_EL3; |
25 | VMAX_U_3s 1111 001 1 0 . .. .... .... 0110 . . . 0 .... @3same | 33 | + return CP_ACCESS_TRAP_EL3; |
26 | VMIN_S_3s 1111 001 0 0 . .. .... .... 0110 . . . 1 .... @3same | ||
27 | @@ -XXX,XX +XXX,XX @@ VSUB_3s 1111 001 1 0 . .. .... .... 1000 . . . 0 .... @3same | ||
28 | |||
29 | VTST_3s 1111 001 0 0 . .. .... .... 1000 . . . 1 .... @3same | ||
30 | VCEQ_3s 1111 001 1 0 . .. .... .... 1000 . . . 1 .... @3same | ||
31 | + | ||
32 | +VMLA_3s 1111 001 0 0 . .. .... .... 1001 . . . 0 .... @3same | ||
33 | +VMLS_3s 1111 001 1 0 . .. .... .... 1001 . . . 0 .... @3same | ||
34 | + | ||
35 | +VMUL_3s 1111 001 0 0 . .. .... .... 1001 . . . 1 .... @3same | ||
36 | +VMUL_p_3s 1111 001 1 0 . .. .... .... 1001 . . . 1 .... @3same | ||
37 | diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c | ||
38 | index XXXXXXX..XXXXXXX 100644 | ||
39 | --- a/target/arm/translate-neon.inc.c | ||
40 | +++ b/target/arm/translate-neon.inc.c | ||
41 | @@ -XXX,XX +XXX,XX @@ DO_3SAME_NO_SZ_3(VMAX_S, tcg_gen_gvec_smax) | ||
42 | DO_3SAME_NO_SZ_3(VMAX_U, tcg_gen_gvec_umax) | ||
43 | DO_3SAME_NO_SZ_3(VMIN_S, tcg_gen_gvec_smin) | ||
44 | DO_3SAME_NO_SZ_3(VMIN_U, tcg_gen_gvec_umin) | ||
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 | + | ||
54 | +static void gen_VMUL_p_3s(unsigned vece, uint32_t rd_ofs, uint32_t rn_ofs, | ||
55 | + uint32_t rm_ofs, uint32_t oprsz, uint32_t maxsz) | ||
56 | +{ | ||
57 | + tcg_gen_gvec_3_ool(rd_ofs, rn_ofs, rm_ofs, oprsz, maxsz, | ||
58 | + 0, gen_helper_gvec_pmul_b); | ||
59 | +} | ||
60 | + | ||
61 | +static bool trans_VMUL_p_3s(DisasContext *s, arg_3same *a) | ||
62 | +{ | ||
63 | + if (a->size != 0) { | ||
64 | + return false; | ||
65 | + } | ||
66 | + return do_3same(s, a, gen_VMUL_p_3s); | ||
67 | +} | ||
68 | + | ||
69 | +#define DO_3SAME_GVEC3_NO_SZ_3(INSN, OPARRAY) \ | ||
70 | + static void gen_##INSN##_3s(unsigned vece, uint32_t rd_ofs, \ | ||
71 | + uint32_t rn_ofs, uint32_t rm_ofs, \ | ||
72 | + uint32_t oprsz, uint32_t maxsz) \ | ||
73 | + { \ | ||
74 | + tcg_gen_gvec_3(rd_ofs, rn_ofs, rm_ofs, \ | ||
75 | + oprsz, maxsz, &OPARRAY[vece]); \ | ||
76 | + } \ | ||
77 | + DO_3SAME_NO_SZ_3(INSN, gen_##INSN##_3s) | ||
78 | + | ||
79 | + | ||
80 | +DO_3SAME_GVEC3_NO_SZ_3(VMLA, mla_op) | ||
81 | +DO_3SAME_GVEC3_NO_SZ_3(VMLS, mls_op) | ||
82 | + | ||
83 | +#define DO_3SAME_GVEC3_SHIFT(INSN, OPARRAY) \ | ||
84 | + static void gen_##INSN##_3s(unsigned vece, uint32_t rd_ofs, \ | ||
85 | + uint32_t rn_ofs, uint32_t rm_ofs, \ | ||
86 | + uint32_t oprsz, uint32_t maxsz) \ | ||
87 | + { \ | ||
88 | + /* Note the operation is vshl vd,vm,vn */ \ | ||
89 | + tcg_gen_gvec_3(rd_ofs, rm_ofs, rn_ofs, \ | ||
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 | ||
97 | index XXXXXXX..XXXXXXX 100644 | ||
98 | --- a/target/arm/translate.c | ||
99 | +++ b/target/arm/translate.c | ||
100 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) | ||
101 | } | 34 | } |
102 | return 1; | 35 | return CP_ACCESS_TRAP_UNCATEGORIZED; |
103 | |||
104 | - case NEON_3R_VMUL: /* VMUL */ | ||
105 | - if (u) { | ||
106 | - /* Polynomial case allows only P8. */ | ||
107 | - if (size != 0) { | ||
108 | - return 1; | ||
109 | - } | ||
110 | - tcg_gen_gvec_3_ool(rd_ofs, rn_ofs, rm_ofs, vec_size, vec_size, | ||
111 | - 0, gen_helper_gvec_pmul_b); | ||
112 | - } else { | ||
113 | - tcg_gen_gvec_mul(size, rd_ofs, rn_ofs, rm_ofs, | ||
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) | ||
133 | case NEON_3R_VCGE: | ||
134 | case NEON_3R_VQADD: | ||
135 | case NEON_3R_VQSUB: | ||
136 | + case NEON_3R_VMUL: | ||
137 | + case NEON_3R_VML: | ||
138 | + case NEON_3R_VSHL: | ||
139 | /* Already handled by decodetree */ | ||
140 | return 1; | ||
141 | } | 36 | } |
142 | -- | 37 | -- |
143 | 2.20.1 | 38 | 2.34.1 |
144 | |||
145 | diff view generated by jsdifflib |
1 | Convert the Neon VQADD/VQSUB insns in the 3-reg-same grouping | 1 | We added the CPAccessResult values CP_ACCESS_TRAP_UNCATEGORIZED_EL2 |
---|---|---|---|
2 | to decodetree. | 2 | and CP_ACCESS_TRAP_UNCATEGORIZED_EL3 purely in order to use them in |
3 | the ats_access() function, but doing so was incorrect (a bug fixed in | ||
4 | a previous commit). There aren't any cases where we want an access | ||
5 | function to be able to request a trap to EL2 or EL3 with a zero | ||
6 | syndrome value, so remove these enum values. | ||
7 | |||
8 | As well as cleaning up dead code, the motivation here is that | ||
9 | we'd like to implement fine-grained-trap handling in | ||
10 | helper_access_check_cp_reg(). Although the fine-grained traps | ||
11 | to EL2 are always lower priority than trap-to-same-EL and | ||
12 | higher priority than trap-to-EL3, they are in the middle of | ||
13 | various other kinds of trap-to-EL2. Knowing that a trap-to-EL2 | ||
14 | must always for us have the same syndrome (ie that an access | ||
15 | function will return CP_ACCESS_TRAP_EL2 and there is no other | ||
16 | kind of trap-to-EL2 enum value) means we don't have to try | ||
17 | to choose which of the two syndrome values to report if the | ||
18 | access would trap to EL2 both for the fine-grained-trap and | ||
19 | because the access function requires it. | ||
3 | 20 | ||
4 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 21 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
5 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 22 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
6 | Message-id: 20200430181003.21682-19-peter.maydell@linaro.org | 23 | Tested-by: Fuad Tabba <tabba@google.com> |
24 | Message-id: 20230130182459.3309057-4-peter.maydell@linaro.org | ||
25 | Message-id: 20230127175507.2895013-4-peter.maydell@linaro.org | ||
7 | --- | 26 | --- |
8 | target/arm/neon-dp.decode | 6 ++++++ | 27 | target/arm/cpregs.h | 4 ++-- |
9 | target/arm/translate-neon.inc.c | 15 +++++++++++++++ | 28 | target/arm/op_helper.c | 2 ++ |
10 | target/arm/translate.c | 14 ++------------ | 29 | 2 files changed, 4 insertions(+), 2 deletions(-) |
11 | 3 files changed, 23 insertions(+), 12 deletions(-) | ||
12 | 30 | ||
13 | diff --git a/target/arm/neon-dp.decode b/target/arm/neon-dp.decode | 31 | diff --git a/target/arm/cpregs.h b/target/arm/cpregs.h |
14 | index XXXXXXX..XXXXXXX 100644 | 32 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/target/arm/neon-dp.decode | 33 | --- a/target/arm/cpregs.h |
16 | +++ b/target/arm/neon-dp.decode | 34 | +++ b/target/arm/cpregs.h |
17 | @@ -XXX,XX +XXX,XX @@ | 35 | @@ -XXX,XX +XXX,XX @@ typedef enum CPAccessResult { |
18 | @3same .... ... . . . size:2 .... .... .... . q:1 . . .... \ | 36 | * Access fails and results in an exception syndrome 0x0 ("uncategorized"). |
19 | &3same vm=%vm_dp vn=%vn_dp vd=%vd_dp | 37 | * Note that this is not a catch-all case -- the set of cases which may |
20 | 38 | * result in this failure is specifically defined by the architecture. | |
21 | +VQADD_S_3s 1111 001 0 0 . .. .... .... 0000 . . . 1 .... @3same | 39 | + * This trap is always to the usual target EL, never directly to a |
22 | +VQADD_U_3s 1111 001 1 0 . .. .... .... 0000 . . . 1 .... @3same | 40 | + * specified target EL. |
23 | + | 41 | */ |
24 | @3same_logic .... ... . . . .. .... .... .... . q:1 .. .... \ | 42 | CP_ACCESS_TRAP_UNCATEGORIZED = (2 << 2), |
25 | &3same vm=%vm_dp vn=%vn_dp vd=%vd_dp size=0 | 43 | - CP_ACCESS_TRAP_UNCATEGORIZED_EL2 = CP_ACCESS_TRAP_UNCATEGORIZED | 2, |
26 | 44 | - CP_ACCESS_TRAP_UNCATEGORIZED_EL3 = CP_ACCESS_TRAP_UNCATEGORIZED | 3, | |
27 | @@ -XXX,XX +XXX,XX @@ VBSL_3s 1111 001 1 0 . 01 .... .... 0001 ... 1 .... @3same_logic | 45 | } CPAccessResult; |
28 | VBIT_3s 1111 001 1 0 . 10 .... .... 0001 ... 1 .... @3same_logic | 46 | |
29 | VBIF_3s 1111 001 1 0 . 11 .... .... 0001 ... 1 .... @3same_logic | 47 | typedef struct ARMCPRegInfo ARMCPRegInfo; |
30 | 48 | diff --git a/target/arm/op_helper.c b/target/arm/op_helper.c | |
31 | +VQSUB_S_3s 1111 001 0 0 . .. .... .... 0010 . . . 1 .... @3same | ||
32 | +VQSUB_U_3s 1111 001 1 0 . .. .... .... 0010 . . . 1 .... @3same | ||
33 | + | ||
34 | VCGT_S_3s 1111 001 0 0 . .. .... .... 0011 . . . 0 .... @3same | ||
35 | VCGT_U_3s 1111 001 1 0 . .. .... .... 0011 . . . 0 .... @3same | ||
36 | VCGE_S_3s 1111 001 0 0 . .. .... .... 0011 . . . 1 .... @3same | ||
37 | 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/op_helper.c |
40 | +++ b/target/arm/translate-neon.inc.c | 51 | +++ b/target/arm/op_helper.c |
41 | @@ -XXX,XX +XXX,XX @@ static void gen_VTST_3s(unsigned vece, uint32_t rd_ofs, uint32_t rn_ofs, | 52 | @@ -XXX,XX +XXX,XX @@ const void *HELPER(access_check_cp_reg)(CPUARMState *env, uint32_t key, |
42 | tcg_gen_gvec_3(rd_ofs, rn_ofs, rm_ofs, oprsz, maxsz, &cmtst_op[vece]); | 53 | case CP_ACCESS_TRAP: |
43 | } | 54 | break; |
44 | DO_3SAME_NO_SZ_3(VTST, gen_VTST_3s) | 55 | case CP_ACCESS_TRAP_UNCATEGORIZED: |
45 | + | 56 | + /* Only CP_ACCESS_TRAP traps are direct to a specified EL */ |
46 | +#define DO_3SAME_GVEC4(INSN, OPARRAY) \ | 57 | + assert((res & CP_ACCESS_EL_MASK) == 0); |
47 | + static void gen_##INSN##_3s(unsigned vece, uint32_t rd_ofs, \ | 58 | if (cpu_isar_feature(aa64_ids, cpu) && isread && |
48 | + uint32_t rn_ofs, uint32_t rm_ofs, \ | 59 | arm_cpreg_in_idspace(ri)) { |
49 | + uint32_t oprsz, uint32_t maxsz) \ | 60 | /* |
50 | + { \ | ||
51 | + tcg_gen_gvec_4(rd_ofs, offsetof(CPUARMState, vfp.qc), \ | ||
52 | + rn_ofs, rm_ofs, oprsz, maxsz, &OPARRAY[vece]); \ | ||
53 | + } \ | ||
54 | + DO_3SAME(INSN, gen_##INSN##_3s) | ||
55 | + | ||
56 | +DO_3SAME_GVEC4(VQADD_S, sqadd_op) | ||
57 | +DO_3SAME_GVEC4(VQADD_U, uqadd_op) | ||
58 | +DO_3SAME_GVEC4(VQSUB_S, sqsub_op) | ||
59 | +DO_3SAME_GVEC4(VQSUB_U, uqsub_op) | ||
60 | diff --git a/target/arm/translate.c b/target/arm/translate.c | ||
61 | index XXXXXXX..XXXXXXX 100644 | ||
62 | --- a/target/arm/translate.c | ||
63 | +++ b/target/arm/translate.c | ||
64 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) | ||
65 | } | ||
66 | return 1; | ||
67 | |||
68 | - case NEON_3R_VQADD: | ||
69 | - tcg_gen_gvec_4(rd_ofs, offsetof(CPUARMState, vfp.qc), | ||
70 | - rn_ofs, rm_ofs, vec_size, vec_size, | ||
71 | - (u ? uqadd_op : sqadd_op) + size); | ||
72 | - return 0; | ||
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) | ||
84 | case NEON_3R_VTST_VCEQ: | ||
85 | case NEON_3R_VCGT: | ||
86 | case NEON_3R_VCGE: | ||
87 | + case NEON_3R_VQADD: | ||
88 | + case NEON_3R_VQSUB: | ||
89 | /* Already handled by decodetree */ | ||
90 | return 1; | ||
91 | } | ||
92 | -- | 61 | -- |
93 | 2.20.1 | 62 | 2.34.1 |
94 | |||
95 | diff view generated by jsdifflib |
1 | Convert the Neon "load/store multiple structures" insns to decodetree. | 1 | Rearrange the code in do_coproc_insn() so that we calculate the |
---|---|---|---|
2 | syndrome value for a potential trap early; we're about to add a | ||
3 | second check that wants this value earlier than where it is currently | ||
4 | determined. | ||
5 | |||
6 | (Specifically, a trap to EL2 because of HSTR_EL2 should take | ||
7 | priority over an UNDEF to EL1, even when the UNDEF is because | ||
8 | the register does not exist at all or because its ri->access | ||
9 | bits non-configurably fail the access. So the check we put in | ||
10 | for HSTR_EL2 trapping at EL1 (which needs the syndrome) is | ||
11 | going to have to be done before the check "is the ARMCPRegInfo | ||
12 | pointer NULL".) | ||
13 | |||
14 | This commit is just code motion; the change to HSTR_EL2 | ||
15 | handling that will use the 'syndrome' variable is in a | ||
16 | subsequent commit. | ||
2 | 17 | ||
3 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 18 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
4 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 19 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
5 | Message-id: 20200430181003.21682-12-peter.maydell@linaro.org | 20 | Tested-by: Fuad Tabba <tabba@google.com> |
21 | Message-id: 20230130182459.3309057-5-peter.maydell@linaro.org | ||
22 | Message-id: 20230127175507.2895013-5-peter.maydell@linaro.org | ||
6 | --- | 23 | --- |
7 | target/arm/neon-ls.decode | 7 ++ | 24 | target/arm/translate.c | 83 +++++++++++++++++++++--------------------- |
8 | target/arm/translate-neon.inc.c | 124 ++++++++++++++++++++++++++++++++ | 25 | 1 file changed, 41 insertions(+), 42 deletions(-) |
9 | target/arm/translate.c | 91 +---------------------- | ||
10 | 3 files changed, 133 insertions(+), 89 deletions(-) | ||
11 | 26 | ||
12 | diff --git a/target/arm/neon-ls.decode b/target/arm/neon-ls.decode | ||
13 | index XXXXXXX..XXXXXXX 100644 | ||
14 | --- a/target/arm/neon-ls.decode | ||
15 | +++ b/target/arm/neon-ls.decode | ||
16 | @@ -XXX,XX +XXX,XX @@ | ||
17 | # 0b1111_1001_xxx0_xxxx_xxxx_xxxx_xxxx_xxxx | ||
18 | # This file works on the A32 encoding only; calling code for T32 has to | ||
19 | # transform the insn into the A32 version first. | ||
20 | + | ||
21 | +%vd_dp 22:1 12:4 | ||
22 | + | ||
23 | +# Neon load/store multiple structures | ||
24 | + | ||
25 | +VLDST_multiple 1111 0100 0 . l:1 0 rn:4 .... itype:4 size:2 align:2 rm:4 \ | ||
26 | + vd=%vd_dp | ||
27 | diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c | ||
28 | index XXXXXXX..XXXXXXX 100644 | ||
29 | --- a/target/arm/translate-neon.inc.c | ||
30 | +++ b/target/arm/translate-neon.inc.c | ||
31 | @@ -XXX,XX +XXX,XX @@ static bool trans_VFML_scalar(DisasContext *s, arg_VFML_scalar *a) | ||
32 | gen_helper_gvec_fmlal_idx_a32); | ||
33 | return true; | ||
34 | } | ||
35 | + | ||
36 | +static struct { | ||
37 | + int nregs; | ||
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 | +{ | ||
57 | + if (rm != 15) { | ||
58 | + TCGv_i32 base; | ||
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 | + | ||
83 | + if (!arm_dc_feature(s, ARM_FEATURE_NEON)) { | ||
84 | + return false; | ||
85 | + } | ||
86 | + | ||
87 | + /* UNDEF accesses to D16-D31 if they don't exist */ | ||
88 | + if (!dc_isar_feature(aa32_simd_r32, s) && (a->vd & 0x10)) { | ||
89 | + return false; | ||
90 | + } | ||
91 | + if (a->itype > 10) { | ||
92 | + return false; | ||
93 | + } | ||
94 | + /* Catch UNDEF cases for bad values of align field */ | ||
95 | + switch (a->itype & 0xc) { | ||
96 | + case 4: | ||
97 | + if (a->align >= 2) { | ||
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; | ||
114 | + } | ||
115 | + | ||
116 | + if (!vfp_access_check(s)) { | ||
117 | + return true; | ||
118 | + } | ||
119 | + | ||
120 | + /* For our purposes, bytes are always little-endian. */ | ||
121 | + if (size == 0) { | ||
122 | + endian = MO_LE; | ||
123 | + } | ||
124 | + /* | ||
125 | + * Consecutive little-endian elements from a single register | ||
126 | + * can be promoted to a larger little-endian operation. | ||
127 | + */ | ||
128 | + if (interleave == 1 && endian == MO_LE) { | ||
129 | + size = 3; | ||
130 | + } | ||
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; | ||
158 | +} | ||
159 | diff --git a/target/arm/translate.c b/target/arm/translate.c | 27 | diff --git a/target/arm/translate.c b/target/arm/translate.c |
160 | index XXXXXXX..XXXXXXX 100644 | 28 | index XXXXXXX..XXXXXXX 100644 |
161 | --- a/target/arm/translate.c | 29 | --- a/target/arm/translate.c |
162 | +++ b/target/arm/translate.c | 30 | +++ b/target/arm/translate.c |
163 | @@ -XXX,XX +XXX,XX @@ static void gen_neon_trn_u16(TCGv_i32 t0, TCGv_i32 t1) | 31 | @@ -XXX,XX +XXX,XX @@ static void do_coproc_insn(DisasContext *s, int cpnum, int is64, |
164 | } | 32 | const ARMCPRegInfo *ri = get_arm_cp_reginfo(s->cp_regs, key); |
165 | 33 | TCGv_ptr tcg_ri = NULL; | |
166 | 34 | bool need_exit_tb; | |
167 | -static struct { | 35 | + uint32_t syndrome; |
168 | - int nregs; | 36 | + |
169 | - int interleave; | 37 | + /* |
170 | - int spacing; | 38 | + * Note that since we are an implementation which takes an |
171 | -} const neon_ls_element_type[11] = { | 39 | + * exception on a trapped conditional instruction only if the |
172 | - {1, 4, 1}, | 40 | + * instruction passes its condition code check, we can take |
173 | - {1, 4, 2}, | 41 | + * advantage of the clause in the ARM ARM that allows us to set |
174 | - {4, 1, 1}, | 42 | + * the COND field in the instruction to 0xE in all cases. |
175 | - {2, 2, 2}, | 43 | + * We could fish the actual condition out of the insn (ARM) |
176 | - {1, 3, 1}, | 44 | + * or the condexec bits (Thumb) but it isn't necessary. |
177 | - {1, 3, 2}, | 45 | + */ |
178 | - {3, 1, 1}, | 46 | + switch (cpnum) { |
179 | - {1, 1, 1}, | 47 | + case 14: |
180 | - {1, 2, 1}, | 48 | + if (is64) { |
181 | - {1, 2, 2}, | 49 | + syndrome = syn_cp14_rrt_trap(1, 0xe, opc1, crm, rt, rt2, |
182 | - {2, 1, 1} | 50 | + isread, false); |
183 | -}; | 51 | + } else { |
52 | + syndrome = syn_cp14_rt_trap(1, 0xe, opc1, opc2, crn, crm, | ||
53 | + rt, isread, false); | ||
54 | + } | ||
55 | + break; | ||
56 | + case 15: | ||
57 | + if (is64) { | ||
58 | + syndrome = syn_cp15_rrt_trap(1, 0xe, opc1, crm, rt, rt2, | ||
59 | + isread, false); | ||
60 | + } else { | ||
61 | + syndrome = syn_cp15_rt_trap(1, 0xe, opc1, opc2, crn, crm, | ||
62 | + rt, isread, false); | ||
63 | + } | ||
64 | + break; | ||
65 | + default: | ||
66 | + /* | ||
67 | + * ARMv8 defines that only coprocessors 14 and 15 exist, | ||
68 | + * so this can only happen if this is an ARMv7 or earlier CPU, | ||
69 | + * in which case the syndrome information won't actually be | ||
70 | + * guest visible. | ||
71 | + */ | ||
72 | + assert(!arm_dc_feature(s, ARM_FEATURE_V8)); | ||
73 | + syndrome = syn_uncategorized(); | ||
74 | + break; | ||
75 | + } | ||
76 | |||
77 | if (!ri) { | ||
78 | /* | ||
79 | @@ -XXX,XX +XXX,XX @@ static void do_coproc_insn(DisasContext *s, int cpnum, int is64, | ||
80 | * Note that on XScale all cp0..c13 registers do an access check | ||
81 | * call in order to handle c15_cpar. | ||
82 | */ | ||
83 | - uint32_t syndrome; | ||
184 | - | 84 | - |
185 | /* Translate a NEON load/store element instruction. Return nonzero if the | 85 | - /* |
186 | instruction is invalid. */ | 86 | - * Note that since we are an implementation which takes an |
187 | static int disas_neon_ls_insn(DisasContext *s, uint32_t insn) | 87 | - * exception on a trapped conditional instruction only if the |
188 | { | 88 | - * instruction passes its condition code check, we can take |
189 | int rd, rn, rm; | 89 | - * advantage of the clause in the ARM ARM that allows us to set |
190 | - int op; | 90 | - * the COND field in the instruction to 0xE in all cases. |
191 | int nregs; | 91 | - * We could fish the actual condition out of the insn (ARM) |
192 | - int interleave; | 92 | - * or the condexec bits (Thumb) but it isn't necessary. |
193 | - int spacing; | 93 | - */ |
194 | int stride; | 94 | - switch (cpnum) { |
195 | int size; | 95 | - case 14: |
196 | int reg; | 96 | - if (is64) { |
197 | int load; | 97 | - syndrome = syn_cp14_rrt_trap(1, 0xe, opc1, crm, rt, rt2, |
198 | - int n; | 98 | - isread, false); |
199 | int vec_size; | 99 | - } else { |
200 | - int mmu_idx; | 100 | - syndrome = syn_cp14_rt_trap(1, 0xe, opc1, opc2, crn, crm, |
201 | - MemOp endian; | 101 | - rt, isread, false); |
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 | - } | 102 | - } |
227 | - break; | 103 | - break; |
228 | - case 8: | 104 | - case 15: |
229 | - if (((insn >> 4) & 3) == 3) { | 105 | - if (is64) { |
230 | - return 1; | 106 | - syndrome = syn_cp15_rrt_trap(1, 0xe, opc1, crm, rt, rt2, |
107 | - isread, false); | ||
108 | - } else { | ||
109 | - syndrome = syn_cp15_rt_trap(1, 0xe, opc1, opc2, crn, crm, | ||
110 | - rt, isread, false); | ||
231 | - } | 111 | - } |
232 | - break; | 112 | - break; |
233 | - default: | 113 | - default: |
114 | - /* | ||
115 | - * ARMv8 defines that only coprocessors 14 and 15 exist, | ||
116 | - * so this can only happen if this is an ARMv7 or earlier CPU, | ||
117 | - * in which case the syndrome information won't actually be | ||
118 | - * guest visible. | ||
119 | - */ | ||
120 | - assert(!arm_dc_feature(s, ARM_FEATURE_V8)); | ||
121 | - syndrome = syn_uncategorized(); | ||
234 | - break; | 122 | - break; |
235 | - } | 123 | - } |
236 | - nregs = neon_ls_element_type[op].nregs; | ||
237 | - interleave = neon_ls_element_type[op].interleave; | ||
238 | - spacing = neon_ls_element_type[op].spacing; | ||
239 | - if (size == 3 && (interleave | spacing) != 1) { | ||
240 | - return 1; | ||
241 | - } | ||
242 | - /* For our purposes, bytes are always little-endian. */ | ||
243 | - if (size == 0) { | ||
244 | - endian = MO_LE; | ||
245 | - } | ||
246 | - /* Consecutive little-endian elements from a single register | ||
247 | - * can be promoted to a larger little-endian operation. | ||
248 | - */ | ||
249 | - if (interleave == 1 && endian == MO_LE) { | ||
250 | - size = 3; | ||
251 | - } | ||
252 | - tmp64 = tcg_temp_new_i64(); | ||
253 | - addr = tcg_temp_new_i32(); | ||
254 | - tmp2 = tcg_const_i32(1 << size); | ||
255 | - load_reg_var(s, addr, rn); | ||
256 | - for (reg = 0; reg < nregs; reg++) { | ||
257 | - for (n = 0; n < 8 >> size; n++) { | ||
258 | - int xs; | ||
259 | - for (xs = 0; xs < interleave; xs++) { | ||
260 | - int tt = rd + reg + spacing * xs; | ||
261 | - | 124 | - |
262 | - if (load) { | 125 | gen_set_condexec(s); |
263 | - gen_aa32_ld_i64(s, tmp64, addr, mmu_idx, endian | size); | 126 | gen_update_pc(s, 0); |
264 | - neon_store_element64(tt, n, size, tmp64); | 127 | tcg_ri = tcg_temp_new_ptr(); |
265 | - } else { | ||
266 | - neon_load_element64(tmp64, tt, n, size); | ||
267 | - gen_aa32_st_i64(s, tmp64, addr, mmu_idx, endian | size); | ||
268 | - } | ||
269 | - tcg_gen_add_i32(addr, addr, tmp2); | ||
270 | - } | ||
271 | - } | ||
272 | - } | ||
273 | - tcg_temp_free_i32(addr); | ||
274 | - tcg_temp_free_i32(tmp2); | ||
275 | - tcg_temp_free_i64(tmp64); | ||
276 | - stride = nregs * interleave * 8; | ||
277 | + /* Load store all elements -- handled already by decodetree */ | ||
278 | + return 1; | ||
279 | } else { | ||
280 | size = (insn >> 10) & 3; | ||
281 | if (size == 3) { | ||
282 | -- | 128 | -- |
283 | 2.20.1 | 129 | 2.34.1 |
284 | |||
285 | diff view generated by jsdifflib |
1 | Convert the VFM[AS]L (scalar) insns in the 2reg-scalar-ext group | 1 | The HSTR_EL2 register has a collection of trap bits which allow |
---|---|---|---|
2 | to decodetree. These are the last ones in the group so we can remove | 2 | trapping to EL2 for AArch32 EL0 or EL1 accesses to coprocessor |
3 | all the legacy decode for the group. | 3 | registers. The specification of these bits is that when the bit is |
4 | set we should trap | ||
5 | * EL1 accesses | ||
6 | * EL0 accesses, if the access is not UNDEFINED when the | ||
7 | trap bit is 0 | ||
4 | 8 | ||
5 | Note that in disas_thumb2_insn() the parts of this encoding space | 9 | In other words, all UNDEF traps from EL0 to EL1 take precedence over |
6 | where the decodetree decoder returns false will correctly be directed | 10 | the HSTR_EL2 trap to EL2. (Since this is all AArch32, the only kind |
7 | to illegal_op by the "(insn & (1 << 28))" check so they won't fall | 11 | of trap-to-EL1 is the UNDEF.) |
8 | into disas_coproc_insn() by mistake. | 12 | |
13 | Our implementation doesn't quite get this right -- we check for traps | ||
14 | in the order: | ||
15 | * no such register | ||
16 | * ARMCPRegInfo::access bits | ||
17 | * HSTR_EL2 trap bits | ||
18 | * ARMCPRegInfo::accessfn | ||
19 | |||
20 | So UNDEFs that happen because of the access bits or because the | ||
21 | register doesn't exist at all correctly take priority over the | ||
22 | HSTR_EL2 trap, but where a register can UNDEF at EL0 because of the | ||
23 | accessfn we are incorrectly always taking the HSTR_EL2 trap. There | ||
24 | aren't many of these, but one example is the PMCR; if you look at the | ||
25 | access pseudocode for this register you can see that UNDEFs taken | ||
26 | because of the value of PMUSERENR.EN are checked before the HSTR_EL2 | ||
27 | bit. | ||
28 | |||
29 | Rearrange helper_access_check_cp_reg() so that we always call the | ||
30 | accessfn, and use its return value if it indicates that the access | ||
31 | traps to EL0 rather than continuing to do the HSTR_EL2 check. | ||
9 | 32 | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 33 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
11 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 34 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
12 | Message-id: 20200430181003.21682-11-peter.maydell@linaro.org | 35 | Tested-by: Fuad Tabba <tabba@google.com> |
36 | Message-id: 20230130182459.3309057-6-peter.maydell@linaro.org | ||
37 | Message-id: 20230127175507.2895013-6-peter.maydell@linaro.org | ||
13 | --- | 38 | --- |
14 | target/arm/neon-shared.decode | 7 +++ | 39 | target/arm/op_helper.c | 21 ++++++++++++++++----- |
15 | target/arm/translate-neon.inc.c | 32 ++++++++++ | 40 | 1 file changed, 16 insertions(+), 5 deletions(-) |
16 | target/arm/translate.c | 107 +------------------------------- | ||
17 | 3 files changed, 40 insertions(+), 106 deletions(-) | ||
18 | 41 | ||
19 | diff --git a/target/arm/neon-shared.decode b/target/arm/neon-shared.decode | 42 | diff --git a/target/arm/op_helper.c b/target/arm/op_helper.c |
20 | index XXXXXXX..XXXXXXX 100644 | 43 | index XXXXXXX..XXXXXXX 100644 |
21 | --- a/target/arm/neon-shared.decode | 44 | --- a/target/arm/op_helper.c |
22 | +++ b/target/arm/neon-shared.decode | 45 | +++ b/target/arm/op_helper.c |
23 | @@ -XXX,XX +XXX,XX @@ VCMLA_scalar 1111 1110 1 . rot:2 .... .... 1000 . q:1 . 0 .... \ | 46 | @@ -XXX,XX +XXX,XX @@ const void *HELPER(access_check_cp_reg)(CPUARMState *env, uint32_t key, |
24 | 47 | goto fail; | |
25 | VDOT_scalar 1111 1110 0 . 10 .... .... 1101 . q:1 index:1 u:1 rm:4 \ | 48 | } |
26 | vm=%vm_dp vn=%vn_dp vd=%vd_dp | 49 | |
27 | + | 50 | + if (ri->accessfn) { |
28 | +%vfml_scalar_q0_rm 0:3 5:1 | 51 | + res = ri->accessfn(env, ri, isread); |
29 | +%vfml_scalar_q1_index 5:1 3:1 | ||
30 | +VFML_scalar 1111 1110 0 . 0 s:1 .... .... 1000 . 0 . 1 index:1 ... \ | ||
31 | + rm=%vfml_scalar_q0_rm vn=%vn_sp vd=%vd_dp q=0 | ||
32 | +VFML_scalar 1111 1110 0 . 0 s:1 .... .... 1000 . 1 . 1 . rm:3 \ | ||
33 | + index=%vfml_scalar_q1_index vn=%vn_dp vd=%vd_dp q=1 | ||
34 | diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c | ||
35 | index XXXXXXX..XXXXXXX 100644 | ||
36 | --- a/target/arm/translate-neon.inc.c | ||
37 | +++ b/target/arm/translate-neon.inc.c | ||
38 | @@ -XXX,XX +XXX,XX @@ static bool trans_VDOT_scalar(DisasContext *s, arg_VDOT_scalar *a) | ||
39 | tcg_temp_free_ptr(fpst); | ||
40 | return true; | ||
41 | } | ||
42 | + | ||
43 | +static bool trans_VFML_scalar(DisasContext *s, arg_VFML_scalar *a) | ||
44 | +{ | ||
45 | + int opr_sz; | ||
46 | + | ||
47 | + if (!dc_isar_feature(aa32_fhm, s)) { | ||
48 | + return false; | ||
49 | + } | 52 | + } |
50 | + | 53 | + |
51 | + /* UNDEF accesses to D16-D31 if they don't exist. */ | 54 | /* |
52 | + if (!dc_isar_feature(aa32_simd_r32, s) && | 55 | - * Check for an EL2 trap due to HSTR_EL2. We expect EL0 accesses |
53 | + ((a->vd & 0x10) || (a->q && (a->vn & 0x10)))) { | 56 | - * to sysregs non accessible at EL0 to have UNDEF-ed already. |
54 | + return false; | 57 | + * If the access function indicates a trap from EL0 to EL1 then |
58 | + * that always takes priority over the HSTR_EL2 trap. (If it indicates | ||
59 | + * a trap to EL3, then the HSTR_EL2 trap takes priority; if it indicates | ||
60 | + * a trap to EL2, then the syndrome is the same either way so we don't | ||
61 | + * care whether technically the architecture says that HSTR_EL2 trap or | ||
62 | + * the other trap takes priority. So we take the "check HSTR_EL2" path | ||
63 | + * for all of those cases.) | ||
64 | */ | ||
65 | + if (res != CP_ACCESS_OK && ((res & CP_ACCESS_EL_MASK) == 0) && | ||
66 | + arm_current_el(env) == 0) { | ||
67 | + goto fail; | ||
55 | + } | 68 | + } |
56 | + | 69 | + |
57 | + if (a->vd & a->q) { | 70 | if (!is_a64(env) && arm_current_el(env) < 2 && ri->cp == 15 && |
58 | + return false; | 71 | (arm_hcr_el2_eff(env) & (HCR_E2H | HCR_TGE)) != (HCR_E2H | HCR_TGE)) { |
59 | + } | 72 | uint32_t mask = 1 << ri->crn; |
60 | + | 73 | @@ -XXX,XX +XXX,XX @@ const void *HELPER(access_check_cp_reg)(CPUARMState *env, uint32_t key, |
61 | + if (!vfp_access_check(s)) { | 74 | } |
62 | + return true; | 75 | } |
63 | + } | 76 | |
64 | + | 77 | - if (ri->accessfn) { |
65 | + opr_sz = (1 + a->q) * 8; | 78 | - res = ri->accessfn(env, ri, isread); |
66 | + tcg_gen_gvec_3_ptr(vfp_reg_offset(1, a->vd), | ||
67 | + vfp_reg_offset(a->q, a->vn), | ||
68 | + vfp_reg_offset(a->q, a->rm), | ||
69 | + cpu_env, opr_sz, opr_sz, | ||
70 | + (a->index << 2) | a->s, /* is_2 == 0 */ | ||
71 | + gen_helper_gvec_fmlal_idx_a32); | ||
72 | + return true; | ||
73 | +} | ||
74 | diff --git a/target/arm/translate.c b/target/arm/translate.c | ||
75 | index XXXXXXX..XXXXXXX 100644 | ||
76 | --- a/target/arm/translate.c | ||
77 | +++ b/target/arm/translate.c | ||
78 | @@ -XXX,XX +XXX,XX @@ static int disas_dsp_insn(DisasContext *s, uint32_t insn) | ||
79 | } | ||
80 | |||
81 | #define VFP_REG_SHR(x, n) (((n) > 0) ? (x) >> (n) : (x) << -(n)) | ||
82 | -#define VFP_SREG(insn, bigbit, smallbit) \ | ||
83 | - ((VFP_REG_SHR(insn, bigbit - 1) & 0x1e) | (((insn) >> (smallbit)) & 1)) | ||
84 | #define VFP_DREG(reg, insn, bigbit, smallbit) do { \ | ||
85 | if (dc_isar_feature(aa32_simd_r32, s)) { \ | ||
86 | reg = (((insn) >> (bigbit)) & 0x0f) \ | ||
87 | @@ -XXX,XX +XXX,XX @@ static int disas_dsp_insn(DisasContext *s, uint32_t insn) | ||
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 | } | ||
102 | |||
103 | -/* Advanced SIMD two registers and a scalar extension. | ||
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 | -{ | ||
113 | - gen_helper_gvec_3 *fn_gvec = NULL; | ||
114 | - gen_helper_gvec_3_ptr *fn_gvec_ptr = NULL; | ||
115 | - int rd, rn, rm, opr_sz, data; | ||
116 | - int off_rn, off_rm; | ||
117 | - bool is_long = false, q = extract32(insn, 6, 1); | ||
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 | - } | 79 | - } |
145 | - | 80 | if (likely(res == CP_ACCESS_OK)) { |
146 | - VFP_DREG_D(rd, insn); | 81 | return ri; |
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 | -} | ||
190 | - | ||
191 | static int disas_coproc_insn(DisasContext *s, uint32_t insn) | ||
192 | { | ||
193 | int cpnum, is64, crn, crm, opc1, opc2, isread, rt, rt2; | ||
194 | @@ -XXX,XX +XXX,XX @@ static void disas_arm_insn(DisasContext *s, unsigned int insn) | ||
195 | } | ||
196 | } | ||
197 | } | ||
198 | - } else if ((insn & 0x0f000a00) == 0x0e000800 | ||
199 | - && arm_dc_feature(s, ARM_FEATURE_V8)) { | ||
200 | - if (disas_neon_insn_2reg_scalar_ext(s, insn)) { | ||
201 | - goto illegal_op; | ||
202 | - } | ||
203 | - return; | ||
204 | } | ||
205 | goto illegal_op; | ||
206 | } | 82 | } |
207 | @@ -XXX,XX +XXX,XX @@ static void disas_thumb2_insn(DisasContext *s, uint32_t insn) | ||
208 | } | ||
209 | break; | ||
210 | } | ||
211 | - if ((insn & 0xff000a00) == 0xfe000800 | ||
212 | - && arm_dc_feature(s, ARM_FEATURE_V8)) { | ||
213 | - /* The Thumb2 and ARM encodings are identical. */ | ||
214 | - if (disas_neon_insn_2reg_scalar_ext(s, insn)) { | ||
215 | - goto illegal_op; | ||
216 | - } | ||
217 | - } else if (((insn >> 24) & 3) == 3) { | ||
218 | + if (((insn >> 24) & 3) == 3) { | ||
219 | /* Translate into the equivalent ARM encoding. */ | ||
220 | insn = (insn & 0xe2ffffff) | ((insn & (1 << 28)) >> 4) | (1 << 28); | ||
221 | if (disas_neon_data_insn(s, insn)) { | ||
222 | -- | 83 | -- |
223 | 2.20.1 | 84 | 2.34.1 |
224 | |||
225 | diff view generated by jsdifflib |
1 | Add the infrastructure for building and invoking a decodetree decoder | 1 | The semantics of HSTR_EL2 require that it traps cpreg accesses |
---|---|---|---|
2 | for the AArch32 Neon encodings. At the moment the new decoder covers | 2 | to EL2 for: |
3 | nothing, so we always fall back to the existing hand-written decode. | 3 | * EL1 accesses |
4 | * EL0 accesses, if the access is not UNDEFINED when the | ||
5 | trap bit is 0 | ||
4 | 6 | ||
5 | We follow the same pattern we did for the VFP decodetree conversion | 7 | (You can see this in the I_ZFGJP priority ordering, where HSTR_EL2 |
6 | (commit 78e138bc1f672c145ef6ace74617d and following): code that deals | 8 | traps from EL1 to EL2 are priority 12, UNDEFs are priority 13, and |
7 | with Neon will be moving gradually out to translate-neon.vfp.inc, | 9 | HSTR_EL2 traps from EL0 are priority 15.) |
8 | which we #include into translate.c. | ||
9 | 10 | ||
10 | In order to share the decode files between A32 and T32, we | 11 | However, we don't get this right for EL1 accesses which UNDEF because |
11 | split Neon into 3 parts: | 12 | the register doesn't exist at all or because its ri->access bits |
12 | * data-processing | 13 | non-configurably forbid the access. At EL1, check for the HSTR_EL2 |
13 | * load-store | 14 | trap early, before either of these UNDEF reasons. |
14 | * 'shared' encodings | ||
15 | 15 | ||
16 | The first two groups of instructions have similar but not identical | 16 | We have to retain the HSTR_EL2 check in access_check_cp_reg(), |
17 | A32 and T32 encodings, so we need to manually transform the T32 | 17 | because at EL0 any kind of UNDEF-to-EL1 (including "no such |
18 | encoding into the A32 one before calling the decoder; the third group | 18 | register", "bad ri->access" and "ri->accessfn returns 'trap to EL1'") |
19 | covers the Neon instructions which are identical in A32 and T32. | 19 | takes precedence over the trap to EL2. But we only need to do that |
20 | check for EL0 now. | ||
20 | 21 | ||
21 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 22 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
23 | Tested-by: Fuad Tabba <tabba@google.com> | ||
22 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 24 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
23 | Message-id: 20200430181003.21682-4-peter.maydell@linaro.org | 25 | Message-id: 20230130182459.3309057-7-peter.maydell@linaro.org |
26 | Message-id: 20230127175507.2895013-7-peter.maydell@linaro.org | ||
24 | --- | 27 | --- |
25 | target/arm/neon-dp.decode | 29 ++++++++++++++++++++++++++ | 28 | target/arm/op_helper.c | 6 +++++- |
26 | target/arm/neon-ls.decode | 29 ++++++++++++++++++++++++++ | 29 | target/arm/translate.c | 28 +++++++++++++++++++++++++++- |
27 | target/arm/neon-shared.decode | 27 +++++++++++++++++++++++++ | 30 | 2 files changed, 32 insertions(+), 2 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 | 31 | ||
37 | diff --git a/target/arm/neon-dp.decode b/target/arm/neon-dp.decode | 32 | diff --git a/target/arm/op_helper.c b/target/arm/op_helper.c |
38 | new file mode 100644 | 33 | index XXXXXXX..XXXXXXX 100644 |
39 | index XXXXXXX..XXXXXXX | 34 | --- a/target/arm/op_helper.c |
40 | --- /dev/null | 35 | +++ b/target/arm/op_helper.c |
41 | +++ b/target/arm/neon-dp.decode | 36 | @@ -XXX,XX +XXX,XX @@ const void *HELPER(access_check_cp_reg)(CPUARMState *env, uint32_t key, |
42 | @@ -XXX,XX +XXX,XX @@ | 37 | goto fail; |
43 | +# AArch32 Neon data-processing instruction descriptions | 38 | } |
44 | +# | 39 | |
45 | +# Copyright (c) 2020 Linaro, Ltd | 40 | - if (!is_a64(env) && arm_current_el(env) < 2 && ri->cp == 15 && |
46 | +# | 41 | + /* |
47 | +# This library is free software; you can redistribute it and/or | 42 | + * HSTR_EL2 traps from EL1 are checked earlier, in generated code; |
48 | +# modify it under the terms of the GNU Lesser General Public | 43 | + * we only need to check here for traps from EL0. |
49 | +# License as published by the Free Software Foundation; either | 44 | + */ |
50 | +# version 2 of the License, or (at your option) any later version. | 45 | + if (!is_a64(env) && arm_current_el(env) == 0 && ri->cp == 15 && |
51 | +# | 46 | (arm_hcr_el2_eff(env) & (HCR_E2H | HCR_TGE)) != (HCR_E2H | HCR_TGE)) { |
52 | +# This library is distributed in the hope that it will be useful, | 47 | uint32_t mask = 1 << ri->crn; |
53 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of | 48 | |
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 | ||
141 | new file mode 100644 | ||
142 | index XXXXXXX..XXXXXXX | ||
143 | --- /dev/null | ||
144 | +++ b/target/arm/translate-neon.inc.c | ||
145 | @@ -XXX,XX +XXX,XX @@ | ||
146 | +/* | ||
147 | + * ARM translation: AArch32 Neon instructions | ||
148 | + * | ||
149 | + * Copyright (c) 2003 Fabrice Bellard | ||
150 | + * Copyright (c) 2005-2007 CodeSourcery | ||
151 | + * Copyright (c) 2007 OpenedHand, Ltd. | ||
152 | + * Copyright (c) 2020 Linaro, Ltd. | ||
153 | + * | ||
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 | 49 | diff --git a/target/arm/translate.c b/target/arm/translate.c |
179 | index XXXXXXX..XXXXXXX 100644 | 50 | index XXXXXXX..XXXXXXX 100644 |
180 | --- a/target/arm/translate.c | 51 | --- a/target/arm/translate.c |
181 | +++ b/target/arm/translate.c | 52 | +++ b/target/arm/translate.c |
182 | @@ -XXX,XX +XXX,XX @@ static TCGv_ptr vfp_reg_ptr(bool dp, int reg) | 53 | @@ -XXX,XX +XXX,XX @@ static void do_coproc_insn(DisasContext *s, int cpnum, int is64, |
183 | 54 | break; | |
184 | #define ARM_CP_RW_BIT (1 << 20) | ||
185 | |||
186 | -/* Include the VFP decoder */ | ||
187 | +/* Include the VFP and Neon decoders */ | ||
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 | { | ||
193 | @@ -XXX,XX +XXX,XX @@ static void disas_arm_insn(DisasContext *s, unsigned int insn) | ||
194 | /* Unconditional instructions. */ | ||
195 | /* TODO: Perhaps merge these into one decodetree output file. */ | ||
196 | if (disas_a32_uncond(s, insn) || | ||
197 | - disas_vfp_uncond(s, insn)) { | ||
198 | + disas_vfp_uncond(s, insn) || | ||
199 | + disas_neon_dp(s, insn) || | ||
200 | + disas_neon_ls(s, insn) || | ||
201 | + disas_neon_shared(s, insn)) { | ||
202 | return; | ||
203 | } | ||
204 | /* fall back to legacy decoder */ | ||
205 | @@ -XXX,XX +XXX,XX @@ static void disas_thumb2_insn(DisasContext *s, uint32_t insn) | ||
206 | ARCH(6T2); | ||
207 | } | 55 | } |
208 | 56 | ||
209 | + if ((insn & 0xef000000) == 0xef000000) { | 57 | + if (s->hstr_active && cpnum == 15 && s->current_el == 1) { |
210 | + /* | 58 | + /* |
211 | + * T32 encodings 0b111p_1111_qqqq_qqqq_qqqq_qqqq_qqqq_qqqq | 59 | + * At EL1, check for a HSTR_EL2 trap, which must take precedence |
212 | + * transform into | 60 | + * over the UNDEF for "no such register" or the UNDEF for "access |
213 | + * A32 encodings 0b1111_001p_qqqq_qqqq_qqqq_qqqq_qqqq_qqqq | 61 | + * permissions forbid this EL1 access". HSTR_EL2 traps from EL0 |
62 | + * only happen if the cpreg doesn't UNDEF at EL0, so we do those in | ||
63 | + * access_check_cp_reg(), after the checks for whether the access | ||
64 | + * configurably trapped to EL1. | ||
214 | + */ | 65 | + */ |
215 | + uint32_t a32_insn = (insn & 0xe2ffffff) | | 66 | + uint32_t maskbit = is64 ? crm : crn; |
216 | + ((insn & (1 << 28)) >> 4) | (1 << 28); | ||
217 | + | 67 | + |
218 | + if (disas_neon_dp(s, a32_insn)) { | 68 | + if (maskbit != 4 && maskbit != 14) { |
219 | + return; | 69 | + /* T4 and T14 are RES0 so never cause traps */ |
70 | + TCGv_i32 t; | ||
71 | + DisasLabel over = gen_disas_label(s); | ||
72 | + | ||
73 | + t = load_cpu_offset(offsetoflow32(CPUARMState, cp15.hstr_el2)); | ||
74 | + tcg_gen_andi_i32(t, t, 1u << maskbit); | ||
75 | + tcg_gen_brcondi_i32(TCG_COND_EQ, t, 0, over.label); | ||
76 | + tcg_temp_free_i32(t); | ||
77 | + | ||
78 | + gen_exception_insn(s, 0, EXCP_UDEF, syndrome); | ||
79 | + set_disas_label(s, over); | ||
220 | + } | 80 | + } |
221 | + } | 81 | + } |
222 | + | 82 | + |
223 | + if ((insn & 0xff100000) == 0xf9000000) { | 83 | if (!ri) { |
224 | + /* | 84 | /* |
225 | + * T32 encodings 0b1111_1001_ppp0_qqqq_qqqq_qqqq_qqqq_qqqq | 85 | * Unknown register; this might be a guest error or a QEMU |
226 | + * transform into | 86 | @@ -XXX,XX +XXX,XX @@ static void do_coproc_insn(DisasContext *s, int cpnum, int is64, |
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; | 87 | return; |
246 | } | 88 | } |
247 | diff --git a/target/arm/Makefile.objs b/target/arm/Makefile.objs | 89 | |
248 | index XXXXXXX..XXXXXXX 100644 | 90 | - if (s->hstr_active || ri->accessfn || |
249 | --- a/target/arm/Makefile.objs | 91 | + if ((s->hstr_active && s->current_el == 0) || ri->accessfn || |
250 | +++ b/target/arm/Makefile.objs | 92 | (arm_dc_feature(s, ARM_FEATURE_XSCALE) && cpnum < 14)) { |
251 | @@ -XXX,XX +XXX,XX @@ target/arm/decode-sve.inc.c: $(SRC_PATH)/target/arm/sve.decode $(DECODETREE) | 93 | /* |
252 | $(PYTHON) $(DECODETREE) --decode disas_sve -o $@ $<,\ | 94 | * Emit code to perform further access permissions checks at |
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 | -- | 95 | -- |
284 | 2.20.1 | 96 | 2.34.1 |
285 | |||
286 | diff view generated by jsdifflib |
1 | For ARMv8.2-TTS2UXN, the stage 2 page table walk wants to know | 1 | The HSTR_EL2 register is not supposed to have an effect unless EL2 is |
---|---|---|---|
2 | whether the stage 1 access is for EL0 or not, because whether | 2 | enabled in the current security state. We weren't checking for this, |
3 | exec permission is given can depend on whether this is an EL0 | 3 | which meant that if the guest set up the HSTR_EL2 register we would |
4 | or EL1 access. Add a new argument to get_phys_addr_lpae() so | 4 | incorrectly trap even for accesses from Secure EL0 and EL1. |
5 | the call sites can pass this information in. | ||
6 | 5 | ||
7 | Since get_phys_addr_lpae() doesn't already have a doc comment, | 6 | Add the missing checks. (Other places where we look at HSTR_EL2 |
8 | add one so we have a place to put the documentation of the | 7 | for the not-in-v8A bits TTEE and TJDBX are already checking that |
9 | semantics of the new s1_is_el0 argument. | 8 | we are in NS EL0 or EL1, so there we alredy know EL2 is enabled.) |
10 | 9 | ||
11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 10 | 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> | 11 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
14 | Message-id: 20200330210400.11724-4-peter.maydell@linaro.org | 12 | Tested-by: Fuad Tabba <tabba@google.com> |
13 | Message-id: 20230130182459.3309057-8-peter.maydell@linaro.org | ||
14 | Message-id: 20230127175507.2895013-8-peter.maydell@linaro.org | ||
15 | --- | 15 | --- |
16 | target/arm/helper.c | 29 ++++++++++++++++++++++++++++- | 16 | target/arm/helper.c | 2 +- |
17 | 1 file changed, 28 insertions(+), 1 deletion(-) | 17 | target/arm/op_helper.c | 1 + |
18 | 2 files changed, 2 insertions(+), 1 deletion(-) | ||
18 | 19 | ||
19 | diff --git a/target/arm/helper.c b/target/arm/helper.c | 20 | diff --git a/target/arm/helper.c b/target/arm/helper.c |
20 | index XXXXXXX..XXXXXXX 100644 | 21 | index XXXXXXX..XXXXXXX 100644 |
21 | --- a/target/arm/helper.c | 22 | --- a/target/arm/helper.c |
22 | +++ b/target/arm/helper.c | 23 | +++ b/target/arm/helper.c |
23 | @@ -XXX,XX +XXX,XX @@ | 24 | @@ -XXX,XX +XXX,XX @@ static CPUARMTBFlags rebuild_hflags_a32(CPUARMState *env, int fp_el, |
24 | 25 | DP_TBFLAG_A32(flags, VFPEN, 1); | |
25 | static bool get_phys_addr_lpae(CPUARMState *env, target_ulong address, | ||
26 | MMUAccessType access_type, ARMMMUIdx mmu_idx, | ||
27 | + bool s1_is_el0, | ||
28 | hwaddr *phys_ptr, MemTxAttrs *txattrs, int *prot, | ||
29 | target_ulong *page_size_ptr, | ||
30 | ARMMMUFaultInfo *fi, ARMCacheAttrs *cacheattrs); | ||
31 | @@ -XXX,XX +XXX,XX @@ static hwaddr S1_ptw_translate(CPUARMState *env, ARMMMUIdx mmu_idx, | ||
32 | } | ||
33 | |||
34 | ret = get_phys_addr_lpae(env, addr, MMU_DATA_LOAD, ARMMMUIdx_Stage2, | ||
35 | + false, | ||
36 | &s2pa, &txattrs, &s2prot, &s2size, fi, | ||
37 | pcacheattrs); | ||
38 | if (ret) { | ||
39 | @@ -XXX,XX +XXX,XX @@ static ARMVAParameters aa32_va_parameters(CPUARMState *env, uint32_t va, | ||
40 | }; | ||
41 | } | ||
42 | |||
43 | +/** | ||
44 | + * get_phys_addr_lpae: perform one stage of page table walk, LPAE format | ||
45 | + * | ||
46 | + * Returns false if the translation was successful. Otherwise, phys_ptr, attrs, | ||
47 | + * prot and page_size may not be filled in, and the populated fsr value provides | ||
48 | + * information on why the translation aborted, in the format of a long-format | ||
49 | + * DFSR/IFSR fault register, with the following caveats: | ||
50 | + * * the WnR bit is never set (the caller must do this). | ||
51 | + * | ||
52 | + * @env: CPUARMState | ||
53 | + * @address: virtual address to get physical address for | ||
54 | + * @access_type: MMU_DATA_LOAD, MMU_DATA_STORE or MMU_INST_FETCH | ||
55 | + * @mmu_idx: MMU index indicating required translation regime | ||
56 | + * @s1_is_el0: if @mmu_idx is ARMMMUIdx_Stage2 (so this is a stage 2 page table | ||
57 | + * walk), must be true if this is stage 2 of a stage 1+2 walk for an | ||
58 | + * EL0 access). If @mmu_idx is anything else, @s1_is_el0 is ignored. | ||
59 | + * @phys_ptr: set to the physical address corresponding to the virtual address | ||
60 | + * @attrs: set to the memory transaction attributes to use | ||
61 | + * @prot: set to the permissions for the page containing phys_ptr | ||
62 | + * @page_size_ptr: set to the size of the page containing phys_ptr | ||
63 | + * @fi: set to fault info if the translation fails | ||
64 | + * @cacheattrs: (if non-NULL) set to the cacheability/shareability attributes | ||
65 | + */ | ||
66 | static bool get_phys_addr_lpae(CPUARMState *env, target_ulong address, | ||
67 | MMUAccessType access_type, ARMMMUIdx mmu_idx, | ||
68 | + bool s1_is_el0, | ||
69 | hwaddr *phys_ptr, MemTxAttrs *txattrs, int *prot, | ||
70 | target_ulong *page_size_ptr, | ||
71 | ARMMMUFaultInfo *fi, ARMCacheAttrs *cacheattrs) | ||
72 | @@ -XXX,XX +XXX,XX @@ bool get_phys_addr(CPUARMState *env, target_ulong address, | ||
73 | |||
74 | /* S1 is done. Now do S2 translation. */ | ||
75 | ret = get_phys_addr_lpae(env, ipa, access_type, ARMMMUIdx_Stage2, | ||
76 | + mmu_idx == ARMMMUIdx_E10_0, | ||
77 | phys_ptr, attrs, &s2_prot, | ||
78 | page_size, fi, | ||
79 | cacheattrs != NULL ? &cacheattrs2 : NULL); | ||
80 | @@ -XXX,XX +XXX,XX @@ bool get_phys_addr(CPUARMState *env, target_ulong address, | ||
81 | } | 26 | } |
82 | 27 | ||
83 | if (regime_using_lpae_format(env, mmu_idx)) { | 28 | - if (el < 2 && env->cp15.hstr_el2 && |
84 | - return get_phys_addr_lpae(env, address, access_type, mmu_idx, | 29 | + if (el < 2 && env->cp15.hstr_el2 && arm_is_el2_enabled(env) && |
85 | + return get_phys_addr_lpae(env, address, access_type, mmu_idx, false, | 30 | (arm_hcr_el2_eff(env) & (HCR_E2H | HCR_TGE)) != (HCR_E2H | HCR_TGE)) { |
86 | phys_ptr, attrs, prot, page_size, | 31 | DP_TBFLAG_A32(flags, HSTR_ACTIVE, 1); |
87 | fi, cacheattrs); | 32 | } |
88 | } else if (regime_sctlr(env, mmu_idx) & SCTLR_XP) { | 33 | diff --git a/target/arm/op_helper.c b/target/arm/op_helper.c |
34 | index XXXXXXX..XXXXXXX 100644 | ||
35 | --- a/target/arm/op_helper.c | ||
36 | +++ b/target/arm/op_helper.c | ||
37 | @@ -XXX,XX +XXX,XX @@ const void *HELPER(access_check_cp_reg)(CPUARMState *env, uint32_t key, | ||
38 | * we only need to check here for traps from EL0. | ||
39 | */ | ||
40 | if (!is_a64(env) && arm_current_el(env) == 0 && ri->cp == 15 && | ||
41 | + arm_is_el2_enabled(env) && | ||
42 | (arm_hcr_el2_eff(env) & (HCR_E2H | HCR_TGE)) != (HCR_E2H | HCR_TGE)) { | ||
43 | uint32_t mask = 1 << ri->crn; | ||
44 | |||
89 | -- | 45 | -- |
90 | 2.20.1 | 46 | 2.34.1 |
91 | |||
92 | diff view generated by jsdifflib |
1 | The ARMv8.2-TTS2UXN feature extends the XN field in stage 2 | 1 | Define the system registers which are provided by the |
---|---|---|---|
2 | translation table descriptors from just bit [54] to bits [54:53], | 2 | FEAT_FGT fine-grained trap architectural feature: |
3 | allowing stage 2 to control execution permissions separately for EL0 | 3 | HFGRTR_EL2, HFGWTR_EL2, HDFGRTR_EL2, HDFGWTR_EL2, HFGITR_EL2 |
4 | and EL1. Implement the new semantics of the XN field and enable | 4 | |
5 | the feature for our 'max' CPU. | 5 | All these registers are a set of bit fields, where each bit is set |
6 | for a trap and clear to not trap on a particular system register | ||
7 | access. The R and W register pairs are for system registers, | ||
8 | allowing trapping to be done separately for reads and writes; the I | ||
9 | register is for system instructions where trapping is on instruction | ||
10 | execution. | ||
11 | |||
12 | The data storage in the CPU state struct is arranged as a set of | ||
13 | arrays rather than separate fields so that when we're looking up the | ||
14 | bits for a system register access we can just index into the array | ||
15 | rather than having to use a switch to select a named struct member. | ||
16 | The later FEAT_FGT2 will add extra elements to these arrays. | ||
17 | |||
18 | The field definitions for the new registers are in cpregs.h because | ||
19 | in practice the code that needs them is code that also needs | ||
20 | the cpregs information; cpu.h is included in a lot more files. | ||
21 | We're also going to add some FGT-specific definitions to cpregs.h | ||
22 | in the next commit. | ||
23 | |||
24 | We do not implement HAFGRTR_EL2, because we don't implement | ||
25 | FEAT_AMUv1. | ||
6 | 26 | ||
7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 27 | 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> | 28 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
10 | Message-id: 20200330210400.11724-5-peter.maydell@linaro.org | 29 | Tested-by: Fuad Tabba <tabba@google.com> |
30 | Message-id: 20230130182459.3309057-9-peter.maydell@linaro.org | ||
31 | Message-id: 20230127175507.2895013-9-peter.maydell@linaro.org | ||
11 | --- | 32 | --- |
12 | target/arm/cpu.h | 15 +++++++++++++++ | 33 | target/arm/cpregs.h | 285 ++++++++++++++++++++++++++++++++++++++++++++ |
13 | target/arm/cpu.c | 1 + | 34 | target/arm/cpu.h | 15 +++ |
14 | target/arm/cpu64.c | 2 ++ | 35 | target/arm/helper.c | 40 +++++++ |
15 | target/arm/helper.c | 37 +++++++++++++++++++++++++++++++------ | 36 | 3 files changed, 340 insertions(+) |
16 | 4 files changed, 49 insertions(+), 6 deletions(-) | 37 | |
17 | 38 | diff --git a/target/arm/cpregs.h b/target/arm/cpregs.h | |
39 | index XXXXXXX..XXXXXXX 100644 | ||
40 | --- a/target/arm/cpregs.h | ||
41 | +++ b/target/arm/cpregs.h | ||
42 | @@ -XXX,XX +XXX,XX @@ typedef enum CPAccessResult { | ||
43 | CP_ACCESS_TRAP_UNCATEGORIZED = (2 << 2), | ||
44 | } CPAccessResult; | ||
45 | |||
46 | +/* Indexes into fgt_read[] */ | ||
47 | +#define FGTREG_HFGRTR 0 | ||
48 | +#define FGTREG_HDFGRTR 1 | ||
49 | +/* Indexes into fgt_write[] */ | ||
50 | +#define FGTREG_HFGWTR 0 | ||
51 | +#define FGTREG_HDFGWTR 1 | ||
52 | +/* Indexes into fgt_exec[] */ | ||
53 | +#define FGTREG_HFGITR 0 | ||
54 | + | ||
55 | +FIELD(HFGRTR_EL2, AFSR0_EL1, 0, 1) | ||
56 | +FIELD(HFGRTR_EL2, AFSR1_EL1, 1, 1) | ||
57 | +FIELD(HFGRTR_EL2, AIDR_EL1, 2, 1) | ||
58 | +FIELD(HFGRTR_EL2, AMAIR_EL1, 3, 1) | ||
59 | +FIELD(HFGRTR_EL2, APDAKEY, 4, 1) | ||
60 | +FIELD(HFGRTR_EL2, APDBKEY, 5, 1) | ||
61 | +FIELD(HFGRTR_EL2, APGAKEY, 6, 1) | ||
62 | +FIELD(HFGRTR_EL2, APIAKEY, 7, 1) | ||
63 | +FIELD(HFGRTR_EL2, APIBKEY, 8, 1) | ||
64 | +FIELD(HFGRTR_EL2, CCSIDR_EL1, 9, 1) | ||
65 | +FIELD(HFGRTR_EL2, CLIDR_EL1, 10, 1) | ||
66 | +FIELD(HFGRTR_EL2, CONTEXTIDR_EL1, 11, 1) | ||
67 | +FIELD(HFGRTR_EL2, CPACR_EL1, 12, 1) | ||
68 | +FIELD(HFGRTR_EL2, CSSELR_EL1, 13, 1) | ||
69 | +FIELD(HFGRTR_EL2, CTR_EL0, 14, 1) | ||
70 | +FIELD(HFGRTR_EL2, DCZID_EL0, 15, 1) | ||
71 | +FIELD(HFGRTR_EL2, ESR_EL1, 16, 1) | ||
72 | +FIELD(HFGRTR_EL2, FAR_EL1, 17, 1) | ||
73 | +FIELD(HFGRTR_EL2, ISR_EL1, 18, 1) | ||
74 | +FIELD(HFGRTR_EL2, LORC_EL1, 19, 1) | ||
75 | +FIELD(HFGRTR_EL2, LOREA_EL1, 20, 1) | ||
76 | +FIELD(HFGRTR_EL2, LORID_EL1, 21, 1) | ||
77 | +FIELD(HFGRTR_EL2, LORN_EL1, 22, 1) | ||
78 | +FIELD(HFGRTR_EL2, LORSA_EL1, 23, 1) | ||
79 | +FIELD(HFGRTR_EL2, MAIR_EL1, 24, 1) | ||
80 | +FIELD(HFGRTR_EL2, MIDR_EL1, 25, 1) | ||
81 | +FIELD(HFGRTR_EL2, MPIDR_EL1, 26, 1) | ||
82 | +FIELD(HFGRTR_EL2, PAR_EL1, 27, 1) | ||
83 | +FIELD(HFGRTR_EL2, REVIDR_EL1, 28, 1) | ||
84 | +FIELD(HFGRTR_EL2, SCTLR_EL1, 29, 1) | ||
85 | +FIELD(HFGRTR_EL2, SCXTNUM_EL1, 30, 1) | ||
86 | +FIELD(HFGRTR_EL2, SCXTNUM_EL0, 31, 1) | ||
87 | +FIELD(HFGRTR_EL2, TCR_EL1, 32, 1) | ||
88 | +FIELD(HFGRTR_EL2, TPIDR_EL1, 33, 1) | ||
89 | +FIELD(HFGRTR_EL2, TPIDRRO_EL0, 34, 1) | ||
90 | +FIELD(HFGRTR_EL2, TPIDR_EL0, 35, 1) | ||
91 | +FIELD(HFGRTR_EL2, TTBR0_EL1, 36, 1) | ||
92 | +FIELD(HFGRTR_EL2, TTBR1_EL1, 37, 1) | ||
93 | +FIELD(HFGRTR_EL2, VBAR_EL1, 38, 1) | ||
94 | +FIELD(HFGRTR_EL2, ICC_IGRPENN_EL1, 39, 1) | ||
95 | +FIELD(HFGRTR_EL2, ERRIDR_EL1, 40, 1) | ||
96 | +FIELD(HFGRTR_EL2, ERRSELR_EL1, 41, 1) | ||
97 | +FIELD(HFGRTR_EL2, ERXFR_EL1, 42, 1) | ||
98 | +FIELD(HFGRTR_EL2, ERXCTLR_EL1, 43, 1) | ||
99 | +FIELD(HFGRTR_EL2, ERXSTATUS_EL1, 44, 1) | ||
100 | +FIELD(HFGRTR_EL2, ERXMISCN_EL1, 45, 1) | ||
101 | +FIELD(HFGRTR_EL2, ERXPFGF_EL1, 46, 1) | ||
102 | +FIELD(HFGRTR_EL2, ERXPFGCTL_EL1, 47, 1) | ||
103 | +FIELD(HFGRTR_EL2, ERXPFGCDN_EL1, 48, 1) | ||
104 | +FIELD(HFGRTR_EL2, ERXADDR_EL1, 49, 1) | ||
105 | +FIELD(HFGRTR_EL2, NACCDATA_EL1, 50, 1) | ||
106 | +/* 51-53: RES0 */ | ||
107 | +FIELD(HFGRTR_EL2, NSMPRI_EL1, 54, 1) | ||
108 | +FIELD(HFGRTR_EL2, NTPIDR2_EL0, 55, 1) | ||
109 | +/* 56-63: RES0 */ | ||
110 | + | ||
111 | +/* These match HFGRTR but bits for RO registers are RES0 */ | ||
112 | +FIELD(HFGWTR_EL2, AFSR0_EL1, 0, 1) | ||
113 | +FIELD(HFGWTR_EL2, AFSR1_EL1, 1, 1) | ||
114 | +FIELD(HFGWTR_EL2, AMAIR_EL1, 3, 1) | ||
115 | +FIELD(HFGWTR_EL2, APDAKEY, 4, 1) | ||
116 | +FIELD(HFGWTR_EL2, APDBKEY, 5, 1) | ||
117 | +FIELD(HFGWTR_EL2, APGAKEY, 6, 1) | ||
118 | +FIELD(HFGWTR_EL2, APIAKEY, 7, 1) | ||
119 | +FIELD(HFGWTR_EL2, APIBKEY, 8, 1) | ||
120 | +FIELD(HFGWTR_EL2, CONTEXTIDR_EL1, 11, 1) | ||
121 | +FIELD(HFGWTR_EL2, CPACR_EL1, 12, 1) | ||
122 | +FIELD(HFGWTR_EL2, CSSELR_EL1, 13, 1) | ||
123 | +FIELD(HFGWTR_EL2, ESR_EL1, 16, 1) | ||
124 | +FIELD(HFGWTR_EL2, FAR_EL1, 17, 1) | ||
125 | +FIELD(HFGWTR_EL2, LORC_EL1, 19, 1) | ||
126 | +FIELD(HFGWTR_EL2, LOREA_EL1, 20, 1) | ||
127 | +FIELD(HFGWTR_EL2, LORN_EL1, 22, 1) | ||
128 | +FIELD(HFGWTR_EL2, LORSA_EL1, 23, 1) | ||
129 | +FIELD(HFGWTR_EL2, MAIR_EL1, 24, 1) | ||
130 | +FIELD(HFGWTR_EL2, PAR_EL1, 27, 1) | ||
131 | +FIELD(HFGWTR_EL2, SCTLR_EL1, 29, 1) | ||
132 | +FIELD(HFGWTR_EL2, SCXTNUM_EL1, 30, 1) | ||
133 | +FIELD(HFGWTR_EL2, SCXTNUM_EL0, 31, 1) | ||
134 | +FIELD(HFGWTR_EL2, TCR_EL1, 32, 1) | ||
135 | +FIELD(HFGWTR_EL2, TPIDR_EL1, 33, 1) | ||
136 | +FIELD(HFGWTR_EL2, TPIDRRO_EL0, 34, 1) | ||
137 | +FIELD(HFGWTR_EL2, TPIDR_EL0, 35, 1) | ||
138 | +FIELD(HFGWTR_EL2, TTBR0_EL1, 36, 1) | ||
139 | +FIELD(HFGWTR_EL2, TTBR1_EL1, 37, 1) | ||
140 | +FIELD(HFGWTR_EL2, VBAR_EL1, 38, 1) | ||
141 | +FIELD(HFGWTR_EL2, ICC_IGRPENN_EL1, 39, 1) | ||
142 | +FIELD(HFGWTR_EL2, ERRSELR_EL1, 41, 1) | ||
143 | +FIELD(HFGWTR_EL2, ERXCTLR_EL1, 43, 1) | ||
144 | +FIELD(HFGWTR_EL2, ERXSTATUS_EL1, 44, 1) | ||
145 | +FIELD(HFGWTR_EL2, ERXMISCN_EL1, 45, 1) | ||
146 | +FIELD(HFGWTR_EL2, ERXPFGCTL_EL1, 47, 1) | ||
147 | +FIELD(HFGWTR_EL2, ERXPFGCDN_EL1, 48, 1) | ||
148 | +FIELD(HFGWTR_EL2, ERXADDR_EL1, 49, 1) | ||
149 | +FIELD(HFGWTR_EL2, NACCDATA_EL1, 50, 1) | ||
150 | +FIELD(HFGWTR_EL2, NSMPRI_EL1, 54, 1) | ||
151 | +FIELD(HFGWTR_EL2, NTPIDR2_EL0, 55, 1) | ||
152 | + | ||
153 | +FIELD(HFGITR_EL2, ICIALLUIS, 0, 1) | ||
154 | +FIELD(HFGITR_EL2, ICIALLU, 1, 1) | ||
155 | +FIELD(HFGITR_EL2, ICIVAU, 2, 1) | ||
156 | +FIELD(HFGITR_EL2, DCIVAC, 3, 1) | ||
157 | +FIELD(HFGITR_EL2, DCISW, 4, 1) | ||
158 | +FIELD(HFGITR_EL2, DCCSW, 5, 1) | ||
159 | +FIELD(HFGITR_EL2, DCCISW, 6, 1) | ||
160 | +FIELD(HFGITR_EL2, DCCVAU, 7, 1) | ||
161 | +FIELD(HFGITR_EL2, DCCVAP, 8, 1) | ||
162 | +FIELD(HFGITR_EL2, DCCVADP, 9, 1) | ||
163 | +FIELD(HFGITR_EL2, DCCIVAC, 10, 1) | ||
164 | +FIELD(HFGITR_EL2, DCZVA, 11, 1) | ||
165 | +FIELD(HFGITR_EL2, ATS1E1R, 12, 1) | ||
166 | +FIELD(HFGITR_EL2, ATS1E1W, 13, 1) | ||
167 | +FIELD(HFGITR_EL2, ATS1E0R, 14, 1) | ||
168 | +FIELD(HFGITR_EL2, ATS1E0W, 15, 1) | ||
169 | +FIELD(HFGITR_EL2, ATS1E1RP, 16, 1) | ||
170 | +FIELD(HFGITR_EL2, ATS1E1WP, 17, 1) | ||
171 | +FIELD(HFGITR_EL2, TLBIVMALLE1OS, 18, 1) | ||
172 | +FIELD(HFGITR_EL2, TLBIVAE1OS, 19, 1) | ||
173 | +FIELD(HFGITR_EL2, TLBIASIDE1OS, 20, 1) | ||
174 | +FIELD(HFGITR_EL2, TLBIVAAE1OS, 21, 1) | ||
175 | +FIELD(HFGITR_EL2, TLBIVALE1OS, 22, 1) | ||
176 | +FIELD(HFGITR_EL2, TLBIVAALE1OS, 23, 1) | ||
177 | +FIELD(HFGITR_EL2, TLBIRVAE1OS, 24, 1) | ||
178 | +FIELD(HFGITR_EL2, TLBIRVAAE1OS, 25, 1) | ||
179 | +FIELD(HFGITR_EL2, TLBIRVALE1OS, 26, 1) | ||
180 | +FIELD(HFGITR_EL2, TLBIRVAALE1OS, 27, 1) | ||
181 | +FIELD(HFGITR_EL2, TLBIVMALLE1IS, 28, 1) | ||
182 | +FIELD(HFGITR_EL2, TLBIVAE1IS, 29, 1) | ||
183 | +FIELD(HFGITR_EL2, TLBIASIDE1IS, 30, 1) | ||
184 | +FIELD(HFGITR_EL2, TLBIVAAE1IS, 31, 1) | ||
185 | +FIELD(HFGITR_EL2, TLBIVALE1IS, 32, 1) | ||
186 | +FIELD(HFGITR_EL2, TLBIVAALE1IS, 33, 1) | ||
187 | +FIELD(HFGITR_EL2, TLBIRVAE1IS, 34, 1) | ||
188 | +FIELD(HFGITR_EL2, TLBIRVAAE1IS, 35, 1) | ||
189 | +FIELD(HFGITR_EL2, TLBIRVALE1IS, 36, 1) | ||
190 | +FIELD(HFGITR_EL2, TLBIRVAALE1IS, 37, 1) | ||
191 | +FIELD(HFGITR_EL2, TLBIRVAE1, 38, 1) | ||
192 | +FIELD(HFGITR_EL2, TLBIRVAAE1, 39, 1) | ||
193 | +FIELD(HFGITR_EL2, TLBIRVALE1, 40, 1) | ||
194 | +FIELD(HFGITR_EL2, TLBIRVAALE1, 41, 1) | ||
195 | +FIELD(HFGITR_EL2, TLBIVMALLE1, 42, 1) | ||
196 | +FIELD(HFGITR_EL2, TLBIVAE1, 43, 1) | ||
197 | +FIELD(HFGITR_EL2, TLBIASIDE1, 44, 1) | ||
198 | +FIELD(HFGITR_EL2, TLBIVAAE1, 45, 1) | ||
199 | +FIELD(HFGITR_EL2, TLBIVALE1, 46, 1) | ||
200 | +FIELD(HFGITR_EL2, TLBIVAALE1, 47, 1) | ||
201 | +FIELD(HFGITR_EL2, CFPRCTX, 48, 1) | ||
202 | +FIELD(HFGITR_EL2, DVPRCTX, 49, 1) | ||
203 | +FIELD(HFGITR_EL2, CPPRCTX, 50, 1) | ||
204 | +FIELD(HFGITR_EL2, ERET, 51, 1) | ||
205 | +FIELD(HFGITR_EL2, SVC_EL0, 52, 1) | ||
206 | +FIELD(HFGITR_EL2, SVC_EL1, 53, 1) | ||
207 | +FIELD(HFGITR_EL2, DCCVAC, 54, 1) | ||
208 | +FIELD(HFGITR_EL2, NBRBINJ, 55, 1) | ||
209 | +FIELD(HFGITR_EL2, NBRBIALL, 56, 1) | ||
210 | + | ||
211 | +FIELD(HDFGRTR_EL2, DBGBCRN_EL1, 0, 1) | ||
212 | +FIELD(HDFGRTR_EL2, DBGBVRN_EL1, 1, 1) | ||
213 | +FIELD(HDFGRTR_EL2, DBGWCRN_EL1, 2, 1) | ||
214 | +FIELD(HDFGRTR_EL2, DBGWVRN_EL1, 3, 1) | ||
215 | +FIELD(HDFGRTR_EL2, MDSCR_EL1, 4, 1) | ||
216 | +FIELD(HDFGRTR_EL2, DBGCLAIM, 5, 1) | ||
217 | +FIELD(HDFGRTR_EL2, DBGAUTHSTATUS_EL1, 6, 1) | ||
218 | +FIELD(HDFGRTR_EL2, DBGPRCR_EL1, 7, 1) | ||
219 | +/* 8: RES0: OSLAR_EL1 is WO */ | ||
220 | +FIELD(HDFGRTR_EL2, OSLSR_EL1, 9, 1) | ||
221 | +FIELD(HDFGRTR_EL2, OSECCR_EL1, 10, 1) | ||
222 | +FIELD(HDFGRTR_EL2, OSDLR_EL1, 11, 1) | ||
223 | +FIELD(HDFGRTR_EL2, PMEVCNTRN_EL0, 12, 1) | ||
224 | +FIELD(HDFGRTR_EL2, PMEVTYPERN_EL0, 13, 1) | ||
225 | +FIELD(HDFGRTR_EL2, PMCCFILTR_EL0, 14, 1) | ||
226 | +FIELD(HDFGRTR_EL2, PMCCNTR_EL0, 15, 1) | ||
227 | +FIELD(HDFGRTR_EL2, PMCNTEN, 16, 1) | ||
228 | +FIELD(HDFGRTR_EL2, PMINTEN, 17, 1) | ||
229 | +FIELD(HDFGRTR_EL2, PMOVS, 18, 1) | ||
230 | +FIELD(HDFGRTR_EL2, PMSELR_EL0, 19, 1) | ||
231 | +/* 20: RES0: PMSWINC_EL0 is WO */ | ||
232 | +/* 21: RES0: PMCR_EL0 is WO */ | ||
233 | +FIELD(HDFGRTR_EL2, PMMIR_EL1, 22, 1) | ||
234 | +FIELD(HDFGRTR_EL2, PMBLIMITR_EL1, 23, 1) | ||
235 | +FIELD(HDFGRTR_EL2, PMBPTR_EL1, 24, 1) | ||
236 | +FIELD(HDFGRTR_EL2, PMBSR_EL1, 25, 1) | ||
237 | +FIELD(HDFGRTR_EL2, PMSCR_EL1, 26, 1) | ||
238 | +FIELD(HDFGRTR_EL2, PMSEVFR_EL1, 27, 1) | ||
239 | +FIELD(HDFGRTR_EL2, PMSFCR_EL1, 28, 1) | ||
240 | +FIELD(HDFGRTR_EL2, PMSICR_EL1, 29, 1) | ||
241 | +FIELD(HDFGRTR_EL2, PMSIDR_EL1, 30, 1) | ||
242 | +FIELD(HDFGRTR_EL2, PMSIRR_EL1, 31, 1) | ||
243 | +FIELD(HDFGRTR_EL2, PMSLATFR_EL1, 32, 1) | ||
244 | +FIELD(HDFGRTR_EL2, TRC, 33, 1) | ||
245 | +FIELD(HDFGRTR_EL2, TRCAUTHSTATUS, 34, 1) | ||
246 | +FIELD(HDFGRTR_EL2, TRCAUXCTLR, 35, 1) | ||
247 | +FIELD(HDFGRTR_EL2, TRCCLAIM, 36, 1) | ||
248 | +FIELD(HDFGRTR_EL2, TRCCNTVRn, 37, 1) | ||
249 | +/* 38, 39: RES0 */ | ||
250 | +FIELD(HDFGRTR_EL2, TRCID, 40, 1) | ||
251 | +FIELD(HDFGRTR_EL2, TRCIMSPECN, 41, 1) | ||
252 | +/* 42: RES0: TRCOSLAR is WO */ | ||
253 | +FIELD(HDFGRTR_EL2, TRCOSLSR, 43, 1) | ||
254 | +FIELD(HDFGRTR_EL2, TRCPRGCTLR, 44, 1) | ||
255 | +FIELD(HDFGRTR_EL2, TRCSEQSTR, 45, 1) | ||
256 | +FIELD(HDFGRTR_EL2, TRCSSCSRN, 46, 1) | ||
257 | +FIELD(HDFGRTR_EL2, TRCSTATR, 47, 1) | ||
258 | +FIELD(HDFGRTR_EL2, TRCVICTLR, 48, 1) | ||
259 | +/* 49: RES0: TRFCR_EL1 is WO */ | ||
260 | +FIELD(HDFGRTR_EL2, TRBBASER_EL1, 50, 1) | ||
261 | +FIELD(HDFGRTR_EL2, TRBIDR_EL1, 51, 1) | ||
262 | +FIELD(HDFGRTR_EL2, TRBLIMITR_EL1, 52, 1) | ||
263 | +FIELD(HDFGRTR_EL2, TRBMAR_EL1, 53, 1) | ||
264 | +FIELD(HDFGRTR_EL2, TRBPTR_EL1, 54, 1) | ||
265 | +FIELD(HDFGRTR_EL2, TRBSR_EL1, 55, 1) | ||
266 | +FIELD(HDFGRTR_EL2, TRBTRG_EL1, 56, 1) | ||
267 | +FIELD(HDFGRTR_EL2, PMUSERENR_EL0, 57, 1) | ||
268 | +FIELD(HDFGRTR_EL2, PMCEIDN_EL0, 58, 1) | ||
269 | +FIELD(HDFGRTR_EL2, NBRBIDR, 59, 1) | ||
270 | +FIELD(HDFGRTR_EL2, NBRBCTL, 60, 1) | ||
271 | +FIELD(HDFGRTR_EL2, NBRBDATA, 61, 1) | ||
272 | +FIELD(HDFGRTR_EL2, NPMSNEVFR_EL1, 62, 1) | ||
273 | +FIELD(HDFGRTR_EL2, PMBIDR_EL1, 63, 1) | ||
274 | + | ||
275 | +/* | ||
276 | + * These match HDFGRTR_EL2, but bits for RO registers are RES0. | ||
277 | + * A few bits are for WO registers, where the HDFGRTR_EL2 bit is RES0. | ||
278 | + */ | ||
279 | +FIELD(HDFGWTR_EL2, DBGBCRN_EL1, 0, 1) | ||
280 | +FIELD(HDFGWTR_EL2, DBGBVRN_EL1, 1, 1) | ||
281 | +FIELD(HDFGWTR_EL2, DBGWCRN_EL1, 2, 1) | ||
282 | +FIELD(HDFGWTR_EL2, DBGWVRN_EL1, 3, 1) | ||
283 | +FIELD(HDFGWTR_EL2, MDSCR_EL1, 4, 1) | ||
284 | +FIELD(HDFGWTR_EL2, DBGCLAIM, 5, 1) | ||
285 | +FIELD(HDFGWTR_EL2, DBGPRCR_EL1, 7, 1) | ||
286 | +FIELD(HDFGWTR_EL2, OSLAR_EL1, 8, 1) | ||
287 | +FIELD(HDFGWTR_EL2, OSLSR_EL1, 9, 1) | ||
288 | +FIELD(HDFGWTR_EL2, OSECCR_EL1, 10, 1) | ||
289 | +FIELD(HDFGWTR_EL2, OSDLR_EL1, 11, 1) | ||
290 | +FIELD(HDFGWTR_EL2, PMEVCNTRN_EL0, 12, 1) | ||
291 | +FIELD(HDFGWTR_EL2, PMEVTYPERN_EL0, 13, 1) | ||
292 | +FIELD(HDFGWTR_EL2, PMCCFILTR_EL0, 14, 1) | ||
293 | +FIELD(HDFGWTR_EL2, PMCCNTR_EL0, 15, 1) | ||
294 | +FIELD(HDFGWTR_EL2, PMCNTEN, 16, 1) | ||
295 | +FIELD(HDFGWTR_EL2, PMINTEN, 17, 1) | ||
296 | +FIELD(HDFGWTR_EL2, PMOVS, 18, 1) | ||
297 | +FIELD(HDFGWTR_EL2, PMSELR_EL0, 19, 1) | ||
298 | +FIELD(HDFGWTR_EL2, PMSWINC_EL0, 20, 1) | ||
299 | +FIELD(HDFGWTR_EL2, PMCR_EL0, 21, 1) | ||
300 | +FIELD(HDFGWTR_EL2, PMBLIMITR_EL1, 23, 1) | ||
301 | +FIELD(HDFGWTR_EL2, PMBPTR_EL1, 24, 1) | ||
302 | +FIELD(HDFGWTR_EL2, PMBSR_EL1, 25, 1) | ||
303 | +FIELD(HDFGWTR_EL2, PMSCR_EL1, 26, 1) | ||
304 | +FIELD(HDFGWTR_EL2, PMSEVFR_EL1, 27, 1) | ||
305 | +FIELD(HDFGWTR_EL2, PMSFCR_EL1, 28, 1) | ||
306 | +FIELD(HDFGWTR_EL2, PMSICR_EL1, 29, 1) | ||
307 | +FIELD(HDFGWTR_EL2, PMSIRR_EL1, 31, 1) | ||
308 | +FIELD(HDFGWTR_EL2, PMSLATFR_EL1, 32, 1) | ||
309 | +FIELD(HDFGWTR_EL2, TRC, 33, 1) | ||
310 | +FIELD(HDFGWTR_EL2, TRCAUXCTLR, 35, 1) | ||
311 | +FIELD(HDFGWTR_EL2, TRCCLAIM, 36, 1) | ||
312 | +FIELD(HDFGWTR_EL2, TRCCNTVRn, 37, 1) | ||
313 | +FIELD(HDFGWTR_EL2, TRCIMSPECN, 41, 1) | ||
314 | +FIELD(HDFGWTR_EL2, TRCOSLAR, 42, 1) | ||
315 | +FIELD(HDFGWTR_EL2, TRCPRGCTLR, 44, 1) | ||
316 | +FIELD(HDFGWTR_EL2, TRCSEQSTR, 45, 1) | ||
317 | +FIELD(HDFGWTR_EL2, TRCSSCSRN, 46, 1) | ||
318 | +FIELD(HDFGWTR_EL2, TRCVICTLR, 48, 1) | ||
319 | +FIELD(HDFGWTR_EL2, TRFCR_EL1, 49, 1) | ||
320 | +FIELD(HDFGWTR_EL2, TRBBASER_EL1, 50, 1) | ||
321 | +FIELD(HDFGWTR_EL2, TRBLIMITR_EL1, 52, 1) | ||
322 | +FIELD(HDFGWTR_EL2, TRBMAR_EL1, 53, 1) | ||
323 | +FIELD(HDFGWTR_EL2, TRBPTR_EL1, 54, 1) | ||
324 | +FIELD(HDFGWTR_EL2, TRBSR_EL1, 55, 1) | ||
325 | +FIELD(HDFGWTR_EL2, TRBTRG_EL1, 56, 1) | ||
326 | +FIELD(HDFGWTR_EL2, PMUSERENR_EL0, 57, 1) | ||
327 | +FIELD(HDFGWTR_EL2, NBRBCTL, 60, 1) | ||
328 | +FIELD(HDFGWTR_EL2, NBRBDATA, 61, 1) | ||
329 | +FIELD(HDFGWTR_EL2, NPMSNEVFR_EL1, 62, 1) | ||
330 | + | ||
331 | typedef struct ARMCPRegInfo ARMCPRegInfo; | ||
332 | |||
333 | /* | ||
18 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h | 334 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h |
19 | index XXXXXXX..XXXXXXX 100644 | 335 | index XXXXXXX..XXXXXXX 100644 |
20 | --- a/target/arm/cpu.h | 336 | --- a/target/arm/cpu.h |
21 | +++ b/target/arm/cpu.h | 337 | +++ b/target/arm/cpu.h |
22 | @@ -XXX,XX +XXX,XX @@ static inline bool isar_feature_aa32_ccidx(const ARMISARegisters *id) | 338 | @@ -XXX,XX +XXX,XX @@ typedef struct CPUArchState { |
23 | return FIELD_EX32(id->id_mmfr4, ID_MMFR4, CCIDX) != 0; | 339 | uint64_t disr_el1; |
340 | uint64_t vdisr_el2; | ||
341 | uint64_t vsesr_el2; | ||
342 | + | ||
343 | + /* | ||
344 | + * Fine-Grained Trap registers. We store these as arrays so the | ||
345 | + * access checking code doesn't have to manually select | ||
346 | + * HFGRTR_EL2 vs HFDFGRTR_EL2 etc when looking up the bit to test. | ||
347 | + * FEAT_FGT2 will add more elements to these arrays. | ||
348 | + */ | ||
349 | + uint64_t fgt_read[2]; /* HFGRTR, HDFGRTR */ | ||
350 | + uint64_t fgt_write[2]; /* HFGWTR, HDFGWTR */ | ||
351 | + uint64_t fgt_exec[1]; /* HFGITR */ | ||
352 | } cp15; | ||
353 | |||
354 | struct { | ||
355 | @@ -XXX,XX +XXX,XX @@ static inline bool isar_feature_aa64_tgran64_2(const ARMISARegisters *id) | ||
356 | return t >= 2 || (t == 0 && isar_feature_aa64_tgran64(id)); | ||
24 | } | 357 | } |
25 | 358 | ||
26 | +static inline bool isar_feature_aa32_tts2uxn(const ARMISARegisters *id) | 359 | +static inline bool isar_feature_aa64_fgt(const ARMISARegisters *id) |
27 | +{ | 360 | +{ |
28 | + return FIELD_EX32(id->id_mmfr4, ID_MMFR4, XNX) != 0; | 361 | + return FIELD_EX64(id->id_aa64mmfr0, ID_AA64MMFR0, FGT) != 0; |
29 | +} | 362 | +} |
30 | + | 363 | + |
31 | /* | 364 | static inline bool isar_feature_aa64_ccidx(const ARMISARegisters *id) |
32 | * 64-bit feature tests via id registers. | 365 | { |
33 | */ | ||
34 | @@ -XXX,XX +XXX,XX @@ static inline bool isar_feature_aa64_ccidx(const ARMISARegisters *id) | ||
35 | return FIELD_EX64(id->id_aa64mmfr2, ID_AA64MMFR2, CCIDX) != 0; | 366 | return FIELD_EX64(id->id_aa64mmfr2, ID_AA64MMFR2, CCIDX) != 0; |
36 | } | ||
37 | |||
38 | +static inline bool isar_feature_aa64_tts2uxn(const ARMISARegisters *id) | ||
39 | +{ | ||
40 | + return FIELD_EX64(id->id_aa64mmfr1, ID_AA64MMFR1, XNX) != 0; | ||
41 | +} | ||
42 | + | ||
43 | /* | ||
44 | * Feature tests for "does this exist in either 32-bit or 64-bit?" | ||
45 | */ | ||
46 | @@ -XXX,XX +XXX,XX @@ static inline bool isar_feature_any_ccidx(const ARMISARegisters *id) | ||
47 | return isar_feature_aa64_ccidx(id) || isar_feature_aa32_ccidx(id); | ||
48 | } | ||
49 | |||
50 | +static inline bool isar_feature_any_tts2uxn(const ARMISARegisters *id) | ||
51 | +{ | ||
52 | + return isar_feature_aa64_tts2uxn(id) || isar_feature_aa32_tts2uxn(id); | ||
53 | +} | ||
54 | + | ||
55 | /* | ||
56 | * Forward to the above feature tests given an ARMCPU pointer. | ||
57 | */ | ||
58 | diff --git a/target/arm/cpu.c b/target/arm/cpu.c | ||
59 | index XXXXXXX..XXXXXXX 100644 | ||
60 | --- a/target/arm/cpu.c | ||
61 | +++ b/target/arm/cpu.c | ||
62 | @@ -XXX,XX +XXX,XX @@ static void arm_max_initfn(Object *obj) | ||
63 | t = FIELD_DP32(t, ID_MMFR4, HPDS, 1); /* AA32HPD */ | ||
64 | t = FIELD_DP32(t, ID_MMFR4, AC2, 1); /* ACTLR2, HACTLR2 */ | ||
65 | t = FIELD_DP32(t, ID_MMFR4, CNP, 1); /* TTCNP */ | ||
66 | + t = FIELD_DP32(t, ID_MMFR4, XNX, 1); /* TTS2UXN */ | ||
67 | cpu->isar.id_mmfr4 = t; | ||
68 | } | ||
69 | #endif | ||
70 | diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c | ||
71 | index XXXXXXX..XXXXXXX 100644 | ||
72 | --- a/target/arm/cpu64.c | ||
73 | +++ b/target/arm/cpu64.c | ||
74 | @@ -XXX,XX +XXX,XX @@ static void aarch64_max_initfn(Object *obj) | ||
75 | t = FIELD_DP64(t, ID_AA64MMFR1, VH, 1); | ||
76 | t = FIELD_DP64(t, ID_AA64MMFR1, PAN, 2); /* ATS1E1 */ | ||
77 | t = FIELD_DP64(t, ID_AA64MMFR1, VMIDBITS, 2); /* VMID16 */ | ||
78 | + t = FIELD_DP64(t, ID_AA64MMFR1, XNX, 1); /* TTS2UXN */ | ||
79 | cpu->isar.id_aa64mmfr1 = t; | ||
80 | |||
81 | t = cpu->isar.id_aa64mmfr2; | ||
82 | @@ -XXX,XX +XXX,XX @@ static void aarch64_max_initfn(Object *obj) | ||
83 | u = FIELD_DP32(u, ID_MMFR4, HPDS, 1); /* AA32HPD */ | ||
84 | u = FIELD_DP32(u, ID_MMFR4, AC2, 1); /* ACTLR2, HACTLR2 */ | ||
85 | u = FIELD_DP32(u, ID_MMFR4, CNP, 1); /* TTCNP */ | ||
86 | + u = FIELD_DP32(u, ID_MMFR4, XNX, 1); /* TTS2UXN */ | ||
87 | cpu->isar.id_mmfr4 = u; | ||
88 | |||
89 | u = cpu->isar.id_aa64dfr0; | ||
90 | diff --git a/target/arm/helper.c b/target/arm/helper.c | 367 | diff --git a/target/arm/helper.c b/target/arm/helper.c |
91 | index XXXXXXX..XXXXXXX 100644 | 368 | index XXXXXXX..XXXXXXX 100644 |
92 | --- a/target/arm/helper.c | 369 | --- a/target/arm/helper.c |
93 | +++ b/target/arm/helper.c | 370 | +++ b/target/arm/helper.c |
94 | @@ -XXX,XX +XXX,XX @@ simple_ap_to_rw_prot(CPUARMState *env, ARMMMUIdx mmu_idx, int ap) | 371 | @@ -XXX,XX +XXX,XX @@ static void scr_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value) |
95 | * | 372 | if (cpu_isar_feature(aa64_hcx, cpu)) { |
96 | * @env: CPUARMState | 373 | valid_mask |= SCR_HXEN; |
97 | * @s2ap: The 2-bit stage2 access permissions (S2AP) | 374 | } |
98 | - * @xn: XN (execute-never) bit | 375 | + if (cpu_isar_feature(aa64_fgt, cpu)) { |
99 | + * @xn: XN (execute-never) bits | 376 | + valid_mask |= SCR_FGTEN; |
100 | + * @s1_is_el0: true if this is S2 of an S1+2 walk for EL0 | 377 | + } |
101 | */ | 378 | } else { |
102 | -static int get_S2prot(CPUARMState *env, int s2ap, int xn) | 379 | valid_mask &= ~(SCR_RW | SCR_ST); |
103 | +static int get_S2prot(CPUARMState *env, int s2ap, int xn, bool s1_is_el0) | 380 | if (cpu_isar_feature(aa32_ras, cpu)) { |
104 | { | 381 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo scxtnum_reginfo[] = { |
105 | int prot = 0; | 382 | .access = PL3_RW, |
106 | 383 | .fieldoffset = offsetof(CPUARMState, scxtnum_el[3]) }, | |
107 | @@ -XXX,XX +XXX,XX @@ static int get_S2prot(CPUARMState *env, int s2ap, int xn) | 384 | }; |
108 | if (s2ap & 2) { | 385 | + |
109 | prot |= PAGE_WRITE; | 386 | +static CPAccessResult access_fgt(CPUARMState *env, const ARMCPRegInfo *ri, |
387 | + bool isread) | ||
388 | +{ | ||
389 | + if (arm_current_el(env) == 2 && | ||
390 | + arm_feature(env, ARM_FEATURE_EL3) && !(env->cp15.scr_el3 & SCR_FGTEN)) { | ||
391 | + return CP_ACCESS_TRAP_EL3; | ||
392 | + } | ||
393 | + return CP_ACCESS_OK; | ||
394 | +} | ||
395 | + | ||
396 | +static const ARMCPRegInfo fgt_reginfo[] = { | ||
397 | + { .name = "HFGRTR_EL2", .state = ARM_CP_STATE_AA64, | ||
398 | + .opc0 = 3, .opc1 = 4, .crn = 1, .crm = 1, .opc2 = 4, | ||
399 | + .access = PL2_RW, .accessfn = access_fgt, | ||
400 | + .fieldoffset = offsetof(CPUARMState, cp15.fgt_read[FGTREG_HFGRTR]) }, | ||
401 | + { .name = "HFGWTR_EL2", .state = ARM_CP_STATE_AA64, | ||
402 | + .opc0 = 3, .opc1 = 4, .crn = 1, .crm = 1, .opc2 = 5, | ||
403 | + .access = PL2_RW, .accessfn = access_fgt, | ||
404 | + .fieldoffset = offsetof(CPUARMState, cp15.fgt_write[FGTREG_HFGWTR]) }, | ||
405 | + { .name = "HDFGRTR_EL2", .state = ARM_CP_STATE_AA64, | ||
406 | + .opc0 = 3, .opc1 = 4, .crn = 3, .crm = 1, .opc2 = 4, | ||
407 | + .access = PL2_RW, .accessfn = access_fgt, | ||
408 | + .fieldoffset = offsetof(CPUARMState, cp15.fgt_read[FGTREG_HDFGRTR]) }, | ||
409 | + { .name = "HDFGWTR_EL2", .state = ARM_CP_STATE_AA64, | ||
410 | + .opc0 = 3, .opc1 = 4, .crn = 3, .crm = 1, .opc2 = 5, | ||
411 | + .access = PL2_RW, .accessfn = access_fgt, | ||
412 | + .fieldoffset = offsetof(CPUARMState, cp15.fgt_write[FGTREG_HDFGWTR]) }, | ||
413 | + { .name = "HFGITR_EL2", .state = ARM_CP_STATE_AA64, | ||
414 | + .opc0 = 3, .opc1 = 4, .crn = 1, .crm = 1, .opc2 = 6, | ||
415 | + .access = PL2_RW, .accessfn = access_fgt, | ||
416 | + .fieldoffset = offsetof(CPUARMState, cp15.fgt_exec[FGTREG_HFGITR]) }, | ||
417 | +}; | ||
418 | #endif /* TARGET_AARCH64 */ | ||
419 | |||
420 | static CPAccessResult access_predinv(CPUARMState *env, const ARMCPRegInfo *ri, | ||
421 | @@ -XXX,XX +XXX,XX @@ void register_cp_regs_for_features(ARMCPU *cpu) | ||
422 | if (cpu_isar_feature(aa64_scxtnum, cpu)) { | ||
423 | define_arm_cp_regs(cpu, scxtnum_reginfo); | ||
110 | } | 424 | } |
111 | - if (!xn) { | 425 | + |
112 | - if (arm_el_is_aa64(env, 2) || prot & PAGE_READ) { | 426 | + if (cpu_isar_feature(aa64_fgt, cpu)) { |
113 | + | 427 | + define_arm_cp_regs(cpu, fgt_reginfo); |
114 | + if (cpu_isar_feature(any_tts2uxn, env_archcpu(env))) { | 428 | + } |
115 | + switch (xn) { | 429 | #endif |
116 | + case 0: | 430 | |
117 | prot |= PAGE_EXEC; | 431 | if (cpu_isar_feature(any_predinv, cpu)) { |
118 | + break; | ||
119 | + case 1: | ||
120 | + if (s1_is_el0) { | ||
121 | + prot |= PAGE_EXEC; | ||
122 | + } | ||
123 | + break; | ||
124 | + case 2: | ||
125 | + break; | ||
126 | + case 3: | ||
127 | + if (!s1_is_el0) { | ||
128 | + prot |= PAGE_EXEC; | ||
129 | + } | ||
130 | + break; | ||
131 | + default: | ||
132 | + g_assert_not_reached(); | ||
133 | + } | ||
134 | + } else { | ||
135 | + if (!extract32(xn, 1, 1)) { | ||
136 | + if (arm_el_is_aa64(env, 2) || prot & PAGE_READ) { | ||
137 | + prot |= PAGE_EXEC; | ||
138 | + } | ||
139 | } | ||
140 | } | ||
141 | return prot; | ||
142 | @@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_lpae(CPUARMState *env, target_ulong address, | ||
143 | } | ||
144 | |||
145 | ap = extract32(attrs, 4, 2); | ||
146 | - xn = extract32(attrs, 12, 1); | ||
147 | |||
148 | if (mmu_idx == ARMMMUIdx_Stage2) { | ||
149 | ns = true; | ||
150 | - *prot = get_S2prot(env, ap, xn); | ||
151 | + xn = extract32(attrs, 11, 2); | ||
152 | + *prot = get_S2prot(env, ap, xn, s1_is_el0); | ||
153 | } else { | ||
154 | ns = extract32(attrs, 3, 1); | ||
155 | + xn = extract32(attrs, 12, 1); | ||
156 | pxn = extract32(attrs, 11, 1); | ||
157 | *prot = get_S1prot(env, mmu_idx, aarch64, ap, ns, xn, pxn); | ||
158 | } | ||
159 | -- | 432 | -- |
160 | 2.20.1 | 433 | 2.34.1 |
161 | |||
162 | diff view generated by jsdifflib |
1 | Convert the V[US]DOT (scalar) insns in the 2reg-scalar-ext group | 1 | Implement the machinery for fine-grained traps on normal sysregs. |
---|---|---|---|
2 | to decodetree. | 2 | Any sysreg with a fine-grained trap will set the new field to |
3 | indicate which FGT register bit it should trap on. | ||
4 | |||
5 | FGT traps only happen when an AArch64 EL2 enables them for | ||
6 | an AArch64 EL1. They therefore are only relevant for AArch32 | ||
7 | cpregs when the cpreg can be accessed from EL0. The logic | ||
8 | in access_check_cp_reg() will check this, so it is safe to | ||
9 | add a .fgt marking to an ARM_CP_STATE_BOTH ARMCPRegInfo. | ||
10 | |||
11 | The DO_BIT and DO_REV_BIT macros define enum constants FGT_##bitname | ||
12 | which can be used to specify the FGT bit, eg | ||
13 | .fgt = FGT_AFSR0_EL1 | ||
14 | (We assume that there is no bit name duplication across the FGT | ||
15 | registers, for brevity's sake.) | ||
16 | |||
17 | Subsequent commits will add the .fgt fields to the relevant register | ||
18 | definitions and define the FGT_nnn values for them. | ||
19 | |||
20 | Note that some of the FGT traps are for instructions that we don't | ||
21 | handle via the cpregs mechanisms (mostly these are instruction traps). | ||
22 | Those we will have to handle separately. | ||
3 | 23 | ||
4 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 24 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
5 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 25 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
6 | Message-id: 20200430181003.21682-10-peter.maydell@linaro.org | 26 | Tested-by: Fuad Tabba <tabba@google.com> |
27 | Message-id: 20230130182459.3309057-10-peter.maydell@linaro.org | ||
28 | Message-id: 20230127175507.2895013-10-peter.maydell@linaro.org | ||
7 | --- | 29 | --- |
8 | target/arm/neon-shared.decode | 3 +++ | 30 | target/arm/cpregs.h | 72 ++++++++++++++++++++++++++++++++++++++ |
9 | target/arm/translate-neon.inc.c | 35 +++++++++++++++++++++++++++++++++ | 31 | target/arm/cpu.h | 1 + |
10 | target/arm/translate.c | 13 +----------- | 32 | target/arm/internals.h | 20 +++++++++++ |
11 | 3 files changed, 39 insertions(+), 12 deletions(-) | 33 | target/arm/translate.h | 2 ++ |
12 | 34 | target/arm/helper.c | 9 +++++ | |
13 | diff --git a/target/arm/neon-shared.decode b/target/arm/neon-shared.decode | 35 | target/arm/op_helper.c | 30 ++++++++++++++++ |
14 | index XXXXXXX..XXXXXXX 100644 | 36 | target/arm/translate-a64.c | 3 +- |
15 | --- a/target/arm/neon-shared.decode | 37 | target/arm/translate.c | 2 ++ |
16 | +++ b/target/arm/neon-shared.decode | 38 | 8 files changed, 138 insertions(+), 1 deletion(-) |
17 | @@ -XXX,XX +XXX,XX @@ VCMLA_scalar 1111 1110 0 . rot:2 .... .... 1000 . q:1 index:1 0 vm:4 \ | 39 | |
18 | vn=%vn_dp vd=%vd_dp size=0 | 40 | diff --git a/target/arm/cpregs.h b/target/arm/cpregs.h |
19 | VCMLA_scalar 1111 1110 1 . rot:2 .... .... 1000 . q:1 . 0 .... \ | 41 | index XXXXXXX..XXXXXXX 100644 |
20 | vm=%vm_dp vn=%vn_dp vd=%vd_dp size=1 index=0 | 42 | --- a/target/arm/cpregs.h |
21 | + | 43 | +++ b/target/arm/cpregs.h |
22 | +VDOT_scalar 1111 1110 0 . 10 .... .... 1101 . q:1 index:1 u:1 rm:4 \ | 44 | @@ -XXX,XX +XXX,XX @@ FIELD(HDFGWTR_EL2, NBRBCTL, 60, 1) |
23 | + vm=%vm_dp vn=%vn_dp vd=%vd_dp | 45 | FIELD(HDFGWTR_EL2, NBRBDATA, 61, 1) |
24 | diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c | 46 | FIELD(HDFGWTR_EL2, NPMSNEVFR_EL1, 62, 1) |
25 | index XXXXXXX..XXXXXXX 100644 | 47 | |
26 | --- a/target/arm/translate-neon.inc.c | 48 | +/* Which fine-grained trap bit register to check, if any */ |
27 | +++ b/target/arm/translate-neon.inc.c | 49 | +FIELD(FGT, TYPE, 10, 3) |
28 | @@ -XXX,XX +XXX,XX @@ static bool trans_VCMLA_scalar(DisasContext *s, arg_VCMLA_scalar *a) | 50 | +FIELD(FGT, REV, 9, 1) /* Is bit sense reversed? */ |
29 | tcg_temp_free_ptr(fpst); | 51 | +FIELD(FGT, IDX, 6, 3) /* Index within a uint64_t[] array */ |
30 | return true; | 52 | +FIELD(FGT, BITPOS, 0, 6) /* Bit position within the uint64_t */ |
53 | + | ||
54 | +/* | ||
55 | + * Macros to define FGT_##bitname enum constants to use in ARMCPRegInfo::fgt | ||
56 | + * fields. We assume for brevity's sake that there are no duplicated | ||
57 | + * bit names across the various FGT registers. | ||
58 | + */ | ||
59 | +#define DO_BIT(REG, BITNAME) \ | ||
60 | + FGT_##BITNAME = FGT_##REG | R_##REG##_EL2_##BITNAME##_SHIFT | ||
61 | + | ||
62 | +/* Some bits have reversed sense, so 0 means trap and 1 means not */ | ||
63 | +#define DO_REV_BIT(REG, BITNAME) \ | ||
64 | + FGT_##BITNAME = FGT_##REG | FGT_REV | R_##REG##_EL2_##BITNAME##_SHIFT | ||
65 | + | ||
66 | +typedef enum FGTBit { | ||
67 | + /* | ||
68 | + * These bits tell us which register arrays to use: | ||
69 | + * if FGT_R is set then reads are checked against fgt_read[]; | ||
70 | + * if FGT_W is set then writes are checked against fgt_write[]; | ||
71 | + * if FGT_EXEC is set then all accesses are checked against fgt_exec[]. | ||
72 | + * | ||
73 | + * For almost all bits in the R/W register pairs, the bit exists in | ||
74 | + * both registers for a RW register, in HFGRTR/HDFGRTR for a RO register | ||
75 | + * with the corresponding HFGWTR/HDFGTWTR bit being RES0, and vice-versa | ||
76 | + * for a WO register. There are unfortunately a couple of exceptions | ||
77 | + * (PMCR_EL0, TRFCR_EL1) where the register being trapped is RW but | ||
78 | + * the FGT system only allows trapping of writes, not reads. | ||
79 | + * | ||
80 | + * Note that we arrange these bits so that a 0 FGTBit means "no trap". | ||
81 | + */ | ||
82 | + FGT_R = 1 << R_FGT_TYPE_SHIFT, | ||
83 | + FGT_W = 2 << R_FGT_TYPE_SHIFT, | ||
84 | + FGT_EXEC = 4 << R_FGT_TYPE_SHIFT, | ||
85 | + FGT_RW = FGT_R | FGT_W, | ||
86 | + /* Bit to identify whether trap bit is reversed sense */ | ||
87 | + FGT_REV = R_FGT_REV_MASK, | ||
88 | + | ||
89 | + /* | ||
90 | + * If a bit exists in HFGRTR/HDFGRTR then either the register being | ||
91 | + * trapped is RO or the bit also exists in HFGWTR/HDFGWTR, so we either | ||
92 | + * want to trap for both reads and writes or else it's harmless to mark | ||
93 | + * it as trap-on-writes. | ||
94 | + * If a bit exists only in HFGWTR/HDFGWTR then either the register being | ||
95 | + * trapped is WO, or else it is one of the two oddball special cases | ||
96 | + * which are RW but have only a write trap. We mark these as only | ||
97 | + * FGT_W so we get the right behaviour for those special cases. | ||
98 | + * (If a bit was added in future that provided only a read trap for an | ||
99 | + * RW register we'd need to do something special to get the FGT_R bit | ||
100 | + * only. But this seems unlikely to happen.) | ||
101 | + * | ||
102 | + * So for the DO_BIT/DO_REV_BIT macros: use FGT_HFGRTR/FGT_HDFGRTR if | ||
103 | + * the bit exists in that register. Otherwise use FGT_HFGWTR/FGT_HDFGWTR. | ||
104 | + */ | ||
105 | + FGT_HFGRTR = FGT_RW | (FGTREG_HFGRTR << R_FGT_IDX_SHIFT), | ||
106 | + FGT_HFGWTR = FGT_W | (FGTREG_HFGWTR << R_FGT_IDX_SHIFT), | ||
107 | + FGT_HDFGRTR = FGT_RW | (FGTREG_HDFGRTR << R_FGT_IDX_SHIFT), | ||
108 | + FGT_HDFGWTR = FGT_W | (FGTREG_HDFGWTR << R_FGT_IDX_SHIFT), | ||
109 | + FGT_HFGITR = FGT_EXEC | (FGTREG_HFGITR << R_FGT_IDX_SHIFT), | ||
110 | +} FGTBit; | ||
111 | + | ||
112 | +#undef DO_BIT | ||
113 | +#undef DO_REV_BIT | ||
114 | + | ||
115 | typedef struct ARMCPRegInfo ARMCPRegInfo; | ||
116 | |||
117 | /* | ||
118 | @@ -XXX,XX +XXX,XX @@ struct ARMCPRegInfo { | ||
119 | CPAccessRights access; | ||
120 | /* Security state: ARM_CP_SECSTATE_* bits/values */ | ||
121 | CPSecureState secure; | ||
122 | + /* | ||
123 | + * Which fine-grained trap register bit to check, if any. This | ||
124 | + * value encodes both the trap register and bit within it. | ||
125 | + */ | ||
126 | + FGTBit fgt; | ||
127 | /* | ||
128 | * The opaque pointer passed to define_arm_cp_regs_with_opaque() when | ||
129 | * this register was defined: can be used to hand data through to the | ||
130 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h | ||
131 | index XXXXXXX..XXXXXXX 100644 | ||
132 | --- a/target/arm/cpu.h | ||
133 | +++ b/target/arm/cpu.h | ||
134 | @@ -XXX,XX +XXX,XX @@ FIELD(TBFLAG_ANY, FPEXC_EL, 8, 2) | ||
135 | /* Memory operations require alignment: SCTLR_ELx.A or CCR.UNALIGN_TRP */ | ||
136 | FIELD(TBFLAG_ANY, ALIGN_MEM, 10, 1) | ||
137 | FIELD(TBFLAG_ANY, PSTATE__IL, 11, 1) | ||
138 | +FIELD(TBFLAG_ANY, FGT_ACTIVE, 12, 1) | ||
139 | |||
140 | /* | ||
141 | * Bit usage when in AArch32 state, both A- and M-profile. | ||
142 | diff --git a/target/arm/internals.h b/target/arm/internals.h | ||
143 | index XXXXXXX..XXXXXXX 100644 | ||
144 | --- a/target/arm/internals.h | ||
145 | +++ b/target/arm/internals.h | ||
146 | @@ -XXX,XX +XXX,XX @@ static inline uint64_t arm_mdcr_el2_eff(CPUARMState *env) | ||
147 | ((1 << (1 - 1)) | (1 << (2 - 1)) | \ | ||
148 | (1 << (4 - 1)) | (1 << (8 - 1)) | (1 << (16 - 1))) | ||
149 | |||
150 | +/* | ||
151 | + * Return true if it is possible to take a fine-grained-trap to EL2. | ||
152 | + */ | ||
153 | +static inline bool arm_fgt_active(CPUARMState *env, int el) | ||
154 | +{ | ||
155 | + /* | ||
156 | + * The Arm ARM only requires the "{E2H,TGE} != {1,1}" test for traps | ||
157 | + * that can affect EL0, but it is harmless to do the test also for | ||
158 | + * traps on registers that are only accessible at EL1 because if the test | ||
159 | + * returns true then we can't be executing at EL1 anyway. | ||
160 | + * FGT traps only happen when EL2 is enabled and EL1 is AArch64; | ||
161 | + * traps from AArch32 only happen for the EL0 is AArch32 case. | ||
162 | + */ | ||
163 | + return cpu_isar_feature(aa64_fgt, env_archcpu(env)) && | ||
164 | + el < 2 && arm_is_el2_enabled(env) && | ||
165 | + arm_el_is_aa64(env, 1) && | ||
166 | + (arm_hcr_el2_eff(env) & (HCR_E2H | HCR_TGE)) != (HCR_E2H | HCR_TGE) && | ||
167 | + (!arm_feature(env, ARM_FEATURE_EL3) || (env->cp15.scr_el3 & SCR_FGTEN)); | ||
168 | +} | ||
169 | + | ||
170 | #endif | ||
171 | diff --git a/target/arm/translate.h b/target/arm/translate.h | ||
172 | index XXXXXXX..XXXXXXX 100644 | ||
173 | --- a/target/arm/translate.h | ||
174 | +++ b/target/arm/translate.h | ||
175 | @@ -XXX,XX +XXX,XX @@ typedef struct DisasContext { | ||
176 | bool is_nonstreaming; | ||
177 | /* True if MVE insns are definitely not predicated by VPR or LTPSIZE */ | ||
178 | bool mve_no_pred; | ||
179 | + /* True if fine-grained traps are active */ | ||
180 | + bool fgt_active; | ||
181 | /* | ||
182 | * >= 0, a copy of PSTATE.BTYPE, which will be 0 without v8.5-BTI. | ||
183 | * < 0, set by the current instruction. | ||
184 | diff --git a/target/arm/helper.c b/target/arm/helper.c | ||
185 | index XXXXXXX..XXXXXXX 100644 | ||
186 | --- a/target/arm/helper.c | ||
187 | +++ b/target/arm/helper.c | ||
188 | @@ -XXX,XX +XXX,XX @@ static CPUARMTBFlags rebuild_hflags_common(CPUARMState *env, int fp_el, | ||
189 | if (arm_singlestep_active(env)) { | ||
190 | DP_TBFLAG_ANY(flags, SS_ACTIVE, 1); | ||
191 | } | ||
192 | + | ||
193 | return flags; | ||
31 | } | 194 | } |
32 | + | 195 | |
33 | +static bool trans_VDOT_scalar(DisasContext *s, arg_VDOT_scalar *a) | 196 | @@ -XXX,XX +XXX,XX @@ static CPUARMTBFlags rebuild_hflags_a32(CPUARMState *env, int fp_el, |
34 | +{ | 197 | DP_TBFLAG_A32(flags, HSTR_ACTIVE, 1); |
35 | + gen_helper_gvec_3 *fn_gvec; | 198 | } |
36 | + int opr_sz; | 199 | |
37 | + TCGv_ptr fpst; | 200 | + if (arm_fgt_active(env, el)) { |
38 | + | 201 | + DP_TBFLAG_ANY(flags, FGT_ACTIVE, 1); |
39 | + if (!dc_isar_feature(aa32_dp, s)) { | ||
40 | + return false; | ||
41 | + } | 202 | + } |
42 | + | 203 | + |
43 | + /* UNDEF accesses to D16-D31 if they don't exist. */ | 204 | if (env->uncached_cpsr & CPSR_IL) { |
44 | + if (!dc_isar_feature(aa32_simd_r32, s) && | 205 | DP_TBFLAG_ANY(flags, PSTATE__IL, 1); |
45 | + ((a->vd | a->vn) & 0x10)) { | 206 | } |
46 | + return false; | 207 | @@ -XXX,XX +XXX,XX @@ static CPUARMTBFlags rebuild_hflags_a64(CPUARMState *env, int el, int fp_el, |
208 | DP_TBFLAG_ANY(flags, PSTATE__IL, 1); | ||
209 | } | ||
210 | |||
211 | + if (arm_fgt_active(env, el)) { | ||
212 | + DP_TBFLAG_ANY(flags, FGT_ACTIVE, 1); | ||
47 | + } | 213 | + } |
48 | + | 214 | + |
49 | + if ((a->vd | a->vn) & a->q) { | 215 | if (cpu_isar_feature(aa64_mte, env_archcpu(env))) { |
50 | + return false; | 216 | /* |
217 | * Set MTE_ACTIVE if any access may be Checked, and leave clear | ||
218 | diff --git a/target/arm/op_helper.c b/target/arm/op_helper.c | ||
219 | index XXXXXXX..XXXXXXX 100644 | ||
220 | --- a/target/arm/op_helper.c | ||
221 | +++ b/target/arm/op_helper.c | ||
222 | @@ -XXX,XX +XXX,XX @@ const void *HELPER(access_check_cp_reg)(CPUARMState *env, uint32_t key, | ||
223 | } | ||
224 | } | ||
225 | |||
226 | + /* | ||
227 | + * Fine-grained traps also are lower priority than undef-to-EL1, | ||
228 | + * higher priority than trap-to-EL3, and we don't care about priority | ||
229 | + * order with other EL2 traps because the syndrome value is the same. | ||
230 | + */ | ||
231 | + if (arm_fgt_active(env, arm_current_el(env))) { | ||
232 | + uint64_t trapword = 0; | ||
233 | + unsigned int idx = FIELD_EX32(ri->fgt, FGT, IDX); | ||
234 | + unsigned int bitpos = FIELD_EX32(ri->fgt, FGT, BITPOS); | ||
235 | + bool rev = FIELD_EX32(ri->fgt, FGT, REV); | ||
236 | + bool trapbit; | ||
237 | + | ||
238 | + if (ri->fgt & FGT_EXEC) { | ||
239 | + assert(idx < ARRAY_SIZE(env->cp15.fgt_exec)); | ||
240 | + trapword = env->cp15.fgt_exec[idx]; | ||
241 | + } else if (isread && (ri->fgt & FGT_R)) { | ||
242 | + assert(idx < ARRAY_SIZE(env->cp15.fgt_read)); | ||
243 | + trapword = env->cp15.fgt_read[idx]; | ||
244 | + } else if (!isread && (ri->fgt & FGT_W)) { | ||
245 | + assert(idx < ARRAY_SIZE(env->cp15.fgt_write)); | ||
246 | + trapword = env->cp15.fgt_write[idx]; | ||
247 | + } | ||
248 | + | ||
249 | + trapbit = extract64(trapword, bitpos, 1); | ||
250 | + if (trapbit != rev) { | ||
251 | + res = CP_ACCESS_TRAP_EL2; | ||
252 | + goto fail; | ||
253 | + } | ||
51 | + } | 254 | + } |
52 | + | 255 | + |
53 | + if (!vfp_access_check(s)) { | 256 | if (likely(res == CP_ACCESS_OK)) { |
54 | + return true; | 257 | return ri; |
55 | + } | 258 | } |
56 | + | 259 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c |
57 | + fn_gvec = a->u ? gen_helper_gvec_udot_idx_b : gen_helper_gvec_sdot_idx_b; | 260 | index XXXXXXX..XXXXXXX 100644 |
58 | + opr_sz = (1 + a->q) * 8; | 261 | --- a/target/arm/translate-a64.c |
59 | + fpst = get_fpstatus_ptr(1); | 262 | +++ b/target/arm/translate-a64.c |
60 | + tcg_gen_gvec_3_ool(vfp_reg_offset(1, a->vd), | 263 | @@ -XXX,XX +XXX,XX @@ static void handle_sys(DisasContext *s, uint32_t insn, bool isread, |
61 | + vfp_reg_offset(1, a->vn), | 264 | return; |
62 | + vfp_reg_offset(1, a->rm), | 265 | } |
63 | + opr_sz, opr_sz, a->index, fn_gvec); | 266 | |
64 | + tcg_temp_free_ptr(fpst); | 267 | - if (ri->accessfn) { |
65 | + return true; | 268 | + if (ri->accessfn || (ri->fgt && s->fgt_active)) { |
66 | +} | 269 | /* Emit code to perform further access permissions checks at |
270 | * runtime; this may result in an exception. | ||
271 | */ | ||
272 | @@ -XXX,XX +XXX,XX @@ static void aarch64_tr_init_disas_context(DisasContextBase *dcbase, | ||
273 | dc->fp_excp_el = EX_TBFLAG_ANY(tb_flags, FPEXC_EL); | ||
274 | dc->align_mem = EX_TBFLAG_ANY(tb_flags, ALIGN_MEM); | ||
275 | dc->pstate_il = EX_TBFLAG_ANY(tb_flags, PSTATE__IL); | ||
276 | + dc->fgt_active = EX_TBFLAG_ANY(tb_flags, FGT_ACTIVE); | ||
277 | dc->sve_excp_el = EX_TBFLAG_A64(tb_flags, SVEEXC_EL); | ||
278 | dc->sme_excp_el = EX_TBFLAG_A64(tb_flags, SMEEXC_EL); | ||
279 | dc->vl = (EX_TBFLAG_A64(tb_flags, VL) + 1) * 16; | ||
67 | diff --git a/target/arm/translate.c b/target/arm/translate.c | 280 | diff --git a/target/arm/translate.c b/target/arm/translate.c |
68 | index XXXXXXX..XXXXXXX 100644 | 281 | index XXXXXXX..XXXXXXX 100644 |
69 | --- a/target/arm/translate.c | 282 | --- a/target/arm/translate.c |
70 | +++ b/target/arm/translate.c | 283 | +++ b/target/arm/translate.c |
71 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_insn_2reg_scalar_ext(DisasContext *s, uint32_t insn) | 284 | @@ -XXX,XX +XXX,XX @@ static void do_coproc_insn(DisasContext *s, int cpnum, int is64, |
72 | bool is_long = false, q = extract32(insn, 6, 1); | 285 | } |
73 | bool ptr_is_env = false; | 286 | |
74 | 287 | if ((s->hstr_active && s->current_el == 0) || ri->accessfn || | |
75 | - if ((insn & 0xffb00f00) == 0xfe200d00) { | 288 | + (ri->fgt && s->fgt_active) || |
76 | - /* V[US]DOT -- 1111 1110 0.10 .... .... 1101 .Q.U .... */ | 289 | (arm_dc_feature(s, ARM_FEATURE_XSCALE) && cpnum < 14)) { |
77 | - int u = extract32(insn, 4, 1); | 290 | /* |
78 | - | 291 | * Emit code to perform further access permissions checks at |
79 | - if (!dc_isar_feature(aa32_dp, s)) { | 292 | @@ -XXX,XX +XXX,XX @@ static void arm_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs) |
80 | - return 1; | 293 | dc->fp_excp_el = EX_TBFLAG_ANY(tb_flags, FPEXC_EL); |
81 | - } | 294 | dc->align_mem = EX_TBFLAG_ANY(tb_flags, ALIGN_MEM); |
82 | - fn_gvec = u ? gen_helper_gvec_udot_idx_b : gen_helper_gvec_sdot_idx_b; | 295 | dc->pstate_il = EX_TBFLAG_ANY(tb_flags, PSTATE__IL); |
83 | - /* rm is just Vm, and index is M. */ | 296 | + dc->fgt_active = EX_TBFLAG_ANY(tb_flags, FGT_ACTIVE); |
84 | - data = extract32(insn, 5, 1); /* index */ | 297 | |
85 | - rm = extract32(insn, 0, 4); | 298 | if (arm_feature(env, ARM_FEATURE_M)) { |
86 | - } else if ((insn & 0xffa00f10) == 0xfe000810) { | 299 | dc->vfp_enabled = 1; |
87 | + if ((insn & 0xffa00f10) == 0xfe000810) { | ||
88 | /* VFM[AS]L -- 1111 1110 0.0S .... .... 1000 .Q.1 .... */ | ||
89 | int is_s = extract32(insn, 20, 1); | ||
90 | int vm20 = extract32(insn, 0, 3); | ||
91 | -- | 300 | -- |
92 | 2.20.1 | 301 | 2.34.1 |
93 | |||
94 | diff view generated by jsdifflib |
1 | Convert the Neon comparison ops in the 3-reg-same grouping | 1 | Mark up the sysreg definitions for the registers trapped |
---|---|---|---|
2 | to decodetree. | 2 | by HFGRTR/HFGWTR bits 0..11. |
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-18-peter.maydell@linaro.org | 6 | Tested-by: Fuad Tabba <tabba@google.com> |
7 | Message-id: 20230130182459.3309057-11-peter.maydell@linaro.org | ||
8 | Message-id: 20230127175507.2895013-11-peter.maydell@linaro.org | ||
7 | --- | 9 | --- |
8 | target/arm/neon-dp.decode | 8 ++++++++ | 10 | target/arm/cpregs.h | 14 ++++++++++++++ |
9 | target/arm/translate-neon.inc.c | 22 ++++++++++++++++++++++ | 11 | target/arm/helper.c | 17 +++++++++++++++++ |
10 | target/arm/translate.c | 23 +++-------------------- | 12 | 2 files changed, 31 insertions(+) |
11 | 3 files changed, 33 insertions(+), 20 deletions(-) | ||
12 | 13 | ||
13 | diff --git a/target/arm/neon-dp.decode b/target/arm/neon-dp.decode | 14 | diff --git a/target/arm/cpregs.h b/target/arm/cpregs.h |
14 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/target/arm/neon-dp.decode | 16 | --- a/target/arm/cpregs.h |
16 | +++ b/target/arm/neon-dp.decode | 17 | +++ b/target/arm/cpregs.h |
17 | @@ -XXX,XX +XXX,XX @@ VBSL_3s 1111 001 1 0 . 01 .... .... 0001 ... 1 .... @3same_logic | 18 | @@ -XXX,XX +XXX,XX @@ typedef enum FGTBit { |
18 | VBIT_3s 1111 001 1 0 . 10 .... .... 0001 ... 1 .... @3same_logic | 19 | FGT_HDFGRTR = FGT_RW | (FGTREG_HDFGRTR << R_FGT_IDX_SHIFT), |
19 | VBIF_3s 1111 001 1 0 . 11 .... .... 0001 ... 1 .... @3same_logic | 20 | FGT_HDFGWTR = FGT_W | (FGTREG_HDFGWTR << R_FGT_IDX_SHIFT), |
20 | 21 | FGT_HFGITR = FGT_EXEC | (FGTREG_HFGITR << R_FGT_IDX_SHIFT), | |
21 | +VCGT_S_3s 1111 001 0 0 . .. .... .... 0011 . . . 0 .... @3same | ||
22 | +VCGT_U_3s 1111 001 1 0 . .. .... .... 0011 . . . 0 .... @3same | ||
23 | +VCGE_S_3s 1111 001 0 0 . .. .... .... 0011 . . . 1 .... @3same | ||
24 | +VCGE_U_3s 1111 001 1 0 . .. .... .... 0011 . . . 1 .... @3same | ||
25 | + | 22 | + |
26 | VMAX_S_3s 1111 001 0 0 . .. .... .... 0110 . . . 0 .... @3same | 23 | + /* Trap bits in HFGRTR_EL2 / HFGWTR_EL2, starting from bit 0. */ |
27 | VMAX_U_3s 1111 001 1 0 . .. .... .... 0110 . . . 0 .... @3same | 24 | + DO_BIT(HFGRTR, AFSR0_EL1), |
28 | VMIN_S_3s 1111 001 0 0 . .. .... .... 0110 . . . 1 .... @3same | 25 | + DO_BIT(HFGRTR, AFSR1_EL1), |
29 | @@ -XXX,XX +XXX,XX @@ VMIN_U_3s 1111 001 1 0 . .. .... .... 0110 . . . 1 .... @3same | 26 | + DO_BIT(HFGRTR, AIDR_EL1), |
30 | 27 | + DO_BIT(HFGRTR, AMAIR_EL1), | |
31 | VADD_3s 1111 001 0 0 . .. .... .... 1000 . . . 0 .... @3same | 28 | + DO_BIT(HFGRTR, APDAKEY), |
32 | VSUB_3s 1111 001 1 0 . .. .... .... 1000 . . . 0 .... @3same | 29 | + DO_BIT(HFGRTR, APDBKEY), |
33 | + | 30 | + DO_BIT(HFGRTR, APGAKEY), |
34 | +VTST_3s 1111 001 0 0 . .. .... .... 1000 . . . 1 .... @3same | 31 | + DO_BIT(HFGRTR, APIAKEY), |
35 | +VCEQ_3s 1111 001 1 0 . .. .... .... 1000 . . . 1 .... @3same | 32 | + DO_BIT(HFGRTR, APIBKEY), |
36 | diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c | 33 | + DO_BIT(HFGRTR, CCSIDR_EL1), |
34 | + DO_BIT(HFGRTR, CLIDR_EL1), | ||
35 | + DO_BIT(HFGRTR, CONTEXTIDR_EL1), | ||
36 | } FGTBit; | ||
37 | |||
38 | #undef DO_BIT | ||
39 | diff --git a/target/arm/helper.c b/target/arm/helper.c | ||
37 | index XXXXXXX..XXXXXXX 100644 | 40 | index XXXXXXX..XXXXXXX 100644 |
38 | --- a/target/arm/translate-neon.inc.c | 41 | --- a/target/arm/helper.c |
39 | +++ b/target/arm/translate-neon.inc.c | 42 | +++ b/target/arm/helper.c |
40 | @@ -XXX,XX +XXX,XX @@ DO_3SAME_NO_SZ_3(VMAX_S, tcg_gen_gvec_smax) | 43 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo cp_reginfo[] = { |
41 | DO_3SAME_NO_SZ_3(VMAX_U, tcg_gen_gvec_umax) | 44 | { .name = "CONTEXTIDR_EL1", .state = ARM_CP_STATE_BOTH, |
42 | DO_3SAME_NO_SZ_3(VMIN_S, tcg_gen_gvec_smin) | 45 | .opc0 = 3, .opc1 = 0, .crn = 13, .crm = 0, .opc2 = 1, |
43 | DO_3SAME_NO_SZ_3(VMIN_U, tcg_gen_gvec_umin) | 46 | .access = PL1_RW, .accessfn = access_tvm_trvm, |
44 | + | 47 | + .fgt = FGT_CONTEXTIDR_EL1, |
45 | +#define DO_3SAME_CMP(INSN, COND) \ | 48 | .secure = ARM_CP_SECSTATE_NS, |
46 | + static void gen_##INSN##_3s(unsigned vece, uint32_t rd_ofs, \ | 49 | .fieldoffset = offsetof(CPUARMState, cp15.contextidr_el[1]), |
47 | + uint32_t rn_ofs, uint32_t rm_ofs, \ | 50 | .resetvalue = 0, .writefn = contextidr_write, .raw_writefn = raw_write, }, |
48 | + uint32_t oprsz, uint32_t maxsz) \ | 51 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v7_cp_reginfo[] = { |
49 | + { \ | 52 | .opc0 = 3, .crn = 0, .crm = 0, .opc1 = 1, .opc2 = 0, |
50 | + tcg_gen_gvec_cmp(COND, vece, rd_ofs, rn_ofs, rm_ofs, oprsz, maxsz); \ | 53 | .access = PL1_R, |
51 | + } \ | 54 | .accessfn = access_tid4, |
52 | + DO_3SAME_NO_SZ_3(INSN, gen_##INSN##_3s) | 55 | + .fgt = FGT_CCSIDR_EL1, |
53 | + | 56 | .readfn = ccsidr_read, .type = ARM_CP_NO_RAW }, |
54 | +DO_3SAME_CMP(VCGT_S, TCG_COND_GT) | 57 | { .name = "CSSELR", .state = ARM_CP_STATE_BOTH, |
55 | +DO_3SAME_CMP(VCGT_U, TCG_COND_GTU) | 58 | .opc0 = 3, .crn = 0, .crm = 0, .opc1 = 2, .opc2 = 0, |
56 | +DO_3SAME_CMP(VCGE_S, TCG_COND_GE) | 59 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v7_cp_reginfo[] = { |
57 | +DO_3SAME_CMP(VCGE_U, TCG_COND_GEU) | 60 | .opc0 = 3, .opc1 = 1, .crn = 0, .crm = 0, .opc2 = 7, |
58 | +DO_3SAME_CMP(VCEQ, TCG_COND_EQ) | 61 | .access = PL1_R, .type = ARM_CP_CONST, |
59 | + | 62 | .accessfn = access_aa64_tid1, |
60 | +static void gen_VTST_3s(unsigned vece, uint32_t rd_ofs, uint32_t rn_ofs, | 63 | + .fgt = FGT_AIDR_EL1, |
61 | + uint32_t rm_ofs, uint32_t oprsz, uint32_t maxsz) | 64 | .resetvalue = 0 }, |
62 | +{ | 65 | /* |
63 | + tcg_gen_gvec_3(rd_ofs, rn_ofs, rm_ofs, oprsz, maxsz, &cmtst_op[vece]); | 66 | * Auxiliary fault status registers: these also are IMPDEF, and we |
64 | +} | 67 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v7_cp_reginfo[] = { |
65 | +DO_3SAME_NO_SZ_3(VTST, gen_VTST_3s) | 68 | { .name = "AFSR0_EL1", .state = ARM_CP_STATE_BOTH, |
66 | diff --git a/target/arm/translate.c b/target/arm/translate.c | 69 | .opc0 = 3, .opc1 = 0, .crn = 5, .crm = 1, .opc2 = 0, |
67 | index XXXXXXX..XXXXXXX 100644 | 70 | .access = PL1_RW, .accessfn = access_tvm_trvm, |
68 | --- a/target/arm/translate.c | 71 | + .fgt = FGT_AFSR0_EL1, |
69 | +++ b/target/arm/translate.c | 72 | .type = ARM_CP_CONST, .resetvalue = 0 }, |
70 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) | 73 | { .name = "AFSR1_EL1", .state = ARM_CP_STATE_BOTH, |
71 | u ? &mls_op[size] : &mla_op[size]); | 74 | .opc0 = 3, .opc1 = 0, .crn = 5, .crm = 1, .opc2 = 1, |
72 | return 0; | 75 | .access = PL1_RW, .accessfn = access_tvm_trvm, |
73 | 76 | + .fgt = FGT_AFSR1_EL1, | |
74 | - case NEON_3R_VTST_VCEQ: | 77 | .type = ARM_CP_CONST, .resetvalue = 0 }, |
75 | - if (u) { /* VCEQ */ | 78 | /* |
76 | - tcg_gen_gvec_cmp(TCG_COND_EQ, size, rd_ofs, rn_ofs, rm_ofs, | 79 | * MAIR can just read-as-written because we don't implement caches |
77 | - vec_size, vec_size); | 80 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo lpae_cp_reginfo[] = { |
78 | - } else { /* VTST */ | 81 | { .name = "AMAIR0", .state = ARM_CP_STATE_BOTH, |
79 | - tcg_gen_gvec_3(rd_ofs, rn_ofs, rm_ofs, | 82 | .opc0 = 3, .crn = 10, .crm = 3, .opc1 = 0, .opc2 = 0, |
80 | - vec_size, vec_size, &cmtst_op[size]); | 83 | .access = PL1_RW, .accessfn = access_tvm_trvm, |
81 | - } | 84 | + .fgt = FGT_AMAIR_EL1, |
82 | - return 0; | 85 | .type = ARM_CP_CONST, .resetvalue = 0 }, |
83 | - | 86 | /* AMAIR1 is mapped to AMAIR_EL1[63:32] */ |
84 | - case NEON_3R_VCGT: | 87 | { .name = "AMAIR1", .cp = 15, .crn = 10, .crm = 3, .opc1 = 0, .opc2 = 1, |
85 | - tcg_gen_gvec_cmp(u ? TCG_COND_GTU : TCG_COND_GT, size, | 88 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo pauth_reginfo[] = { |
86 | - rd_ofs, rn_ofs, rm_ofs, vec_size, vec_size); | 89 | { .name = "APDAKEYLO_EL1", .state = ARM_CP_STATE_AA64, |
87 | - return 0; | 90 | .opc0 = 3, .opc1 = 0, .crn = 2, .crm = 2, .opc2 = 0, |
88 | - | 91 | .access = PL1_RW, .accessfn = access_pauth, |
89 | - case NEON_3R_VCGE: | 92 | + .fgt = FGT_APDAKEY, |
90 | - tcg_gen_gvec_cmp(u ? TCG_COND_GEU : TCG_COND_GE, size, | 93 | .fieldoffset = offsetof(CPUARMState, keys.apda.lo) }, |
91 | - rd_ofs, rn_ofs, rm_ofs, vec_size, vec_size); | 94 | { .name = "APDAKEYHI_EL1", .state = ARM_CP_STATE_AA64, |
92 | - return 0; | 95 | .opc0 = 3, .opc1 = 0, .crn = 2, .crm = 2, .opc2 = 1, |
93 | - | 96 | .access = PL1_RW, .accessfn = access_pauth, |
94 | case NEON_3R_VSHL: | 97 | + .fgt = FGT_APDAKEY, |
95 | /* Note the operation is vshl vd,vm,vn */ | 98 | .fieldoffset = offsetof(CPUARMState, keys.apda.hi) }, |
96 | tcg_gen_gvec_3(rd_ofs, rm_ofs, rn_ofs, vec_size, vec_size, | 99 | { .name = "APDBKEYLO_EL1", .state = ARM_CP_STATE_AA64, |
97 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) | 100 | .opc0 = 3, .opc1 = 0, .crn = 2, .crm = 2, .opc2 = 2, |
98 | case NEON_3R_LOGIC: | 101 | .access = PL1_RW, .accessfn = access_pauth, |
99 | case NEON_3R_VMAX: | 102 | + .fgt = FGT_APDBKEY, |
100 | case NEON_3R_VMIN: | 103 | .fieldoffset = offsetof(CPUARMState, keys.apdb.lo) }, |
101 | + case NEON_3R_VTST_VCEQ: | 104 | { .name = "APDBKEYHI_EL1", .state = ARM_CP_STATE_AA64, |
102 | + case NEON_3R_VCGT: | 105 | .opc0 = 3, .opc1 = 0, .crn = 2, .crm = 2, .opc2 = 3, |
103 | + case NEON_3R_VCGE: | 106 | .access = PL1_RW, .accessfn = access_pauth, |
104 | /* Already handled by decodetree */ | 107 | + .fgt = FGT_APDBKEY, |
105 | return 1; | 108 | .fieldoffset = offsetof(CPUARMState, keys.apdb.hi) }, |
106 | } | 109 | { .name = "APGAKEYLO_EL1", .state = ARM_CP_STATE_AA64, |
110 | .opc0 = 3, .opc1 = 0, .crn = 2, .crm = 3, .opc2 = 0, | ||
111 | .access = PL1_RW, .accessfn = access_pauth, | ||
112 | + .fgt = FGT_APGAKEY, | ||
113 | .fieldoffset = offsetof(CPUARMState, keys.apga.lo) }, | ||
114 | { .name = "APGAKEYHI_EL1", .state = ARM_CP_STATE_AA64, | ||
115 | .opc0 = 3, .opc1 = 0, .crn = 2, .crm = 3, .opc2 = 1, | ||
116 | .access = PL1_RW, .accessfn = access_pauth, | ||
117 | + .fgt = FGT_APGAKEY, | ||
118 | .fieldoffset = offsetof(CPUARMState, keys.apga.hi) }, | ||
119 | { .name = "APIAKEYLO_EL1", .state = ARM_CP_STATE_AA64, | ||
120 | .opc0 = 3, .opc1 = 0, .crn = 2, .crm = 1, .opc2 = 0, | ||
121 | .access = PL1_RW, .accessfn = access_pauth, | ||
122 | + .fgt = FGT_APIAKEY, | ||
123 | .fieldoffset = offsetof(CPUARMState, keys.apia.lo) }, | ||
124 | { .name = "APIAKEYHI_EL1", .state = ARM_CP_STATE_AA64, | ||
125 | .opc0 = 3, .opc1 = 0, .crn = 2, .crm = 1, .opc2 = 1, | ||
126 | .access = PL1_RW, .accessfn = access_pauth, | ||
127 | + .fgt = FGT_APIAKEY, | ||
128 | .fieldoffset = offsetof(CPUARMState, keys.apia.hi) }, | ||
129 | { .name = "APIBKEYLO_EL1", .state = ARM_CP_STATE_AA64, | ||
130 | .opc0 = 3, .opc1 = 0, .crn = 2, .crm = 1, .opc2 = 2, | ||
131 | .access = PL1_RW, .accessfn = access_pauth, | ||
132 | + .fgt = FGT_APIBKEY, | ||
133 | .fieldoffset = offsetof(CPUARMState, keys.apib.lo) }, | ||
134 | { .name = "APIBKEYHI_EL1", .state = ARM_CP_STATE_AA64, | ||
135 | .opc0 = 3, .opc1 = 0, .crn = 2, .crm = 1, .opc2 = 3, | ||
136 | .access = PL1_RW, .accessfn = access_pauth, | ||
137 | + .fgt = FGT_APIBKEY, | ||
138 | .fieldoffset = offsetof(CPUARMState, keys.apib.hi) }, | ||
139 | }; | ||
140 | |||
141 | @@ -XXX,XX +XXX,XX @@ void register_cp_regs_for_features(ARMCPU *cpu) | ||
142 | .opc0 = 3, .crn = 0, .crm = 0, .opc1 = 1, .opc2 = 1, | ||
143 | .access = PL1_R, .type = ARM_CP_CONST, | ||
144 | .accessfn = access_tid4, | ||
145 | + .fgt = FGT_CLIDR_EL1, | ||
146 | .resetvalue = cpu->clidr | ||
147 | }; | ||
148 | define_one_arm_cp_reg(cpu, &clidr); | ||
107 | -- | 149 | -- |
108 | 2.20.1 | 150 | 2.34.1 |
109 | |||
110 | diff view generated by jsdifflib |
1 | Convert the Neon 3-reg-same VMAX and VMIN insns to decodetree. | 1 | Mark up the sysreg definitions for the registers trapped |
---|---|---|---|
2 | by HFGRTR/HFGWTR bits 12..23. | ||
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 | Tested-by: Fuad Tabba <tabba@google.com> |
7 | Message-id: 20230130182459.3309057-12-peter.maydell@linaro.org | ||
8 | Message-id: 20230127175507.2895013-12-peter.maydell@linaro.org | ||
6 | --- | 9 | --- |
7 | target/arm/neon-dp.decode | 5 +++++ | 10 | target/arm/cpregs.h | 12 ++++++++++++ |
8 | target/arm/translate-neon.inc.c | 14 ++++++++++++++ | 11 | target/arm/helper.c | 12 ++++++++++++ |
9 | target/arm/translate.c | 21 ++------------------- | 12 | 2 files changed, 24 insertions(+) |
10 | 3 files changed, 21 insertions(+), 19 deletions(-) | ||
11 | 13 | ||
12 | diff --git a/target/arm/neon-dp.decode b/target/arm/neon-dp.decode | 14 | diff --git a/target/arm/cpregs.h b/target/arm/cpregs.h |
13 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
14 | --- a/target/arm/neon-dp.decode | 16 | --- a/target/arm/cpregs.h |
15 | +++ b/target/arm/neon-dp.decode | 17 | +++ b/target/arm/cpregs.h |
16 | @@ -XXX,XX +XXX,XX @@ VBSL_3s 1111 001 1 0 . 01 .... .... 0001 ... 1 .... @3same_logic | 18 | @@ -XXX,XX +XXX,XX @@ typedef enum FGTBit { |
17 | VBIT_3s 1111 001 1 0 . 10 .... .... 0001 ... 1 .... @3same_logic | 19 | DO_BIT(HFGRTR, CCSIDR_EL1), |
18 | VBIF_3s 1111 001 1 0 . 11 .... .... 0001 ... 1 .... @3same_logic | 20 | DO_BIT(HFGRTR, CLIDR_EL1), |
19 | 21 | DO_BIT(HFGRTR, CONTEXTIDR_EL1), | |
20 | +VMAX_S_3s 1111 001 0 0 . .. .... .... 0110 . . . 0 .... @3same | 22 | + DO_BIT(HFGRTR, CPACR_EL1), |
21 | +VMAX_U_3s 1111 001 1 0 . .. .... .... 0110 . . . 0 .... @3same | 23 | + DO_BIT(HFGRTR, CSSELR_EL1), |
22 | +VMIN_S_3s 1111 001 0 0 . .. .... .... 0110 . . . 1 .... @3same | 24 | + DO_BIT(HFGRTR, CTR_EL0), |
23 | +VMIN_U_3s 1111 001 1 0 . .. .... .... 0110 . . . 1 .... @3same | 25 | + DO_BIT(HFGRTR, DCZID_EL0), |
24 | + | 26 | + DO_BIT(HFGRTR, ESR_EL1), |
25 | VADD_3s 1111 001 0 0 . .. .... .... 1000 . . . 0 .... @3same | 27 | + DO_BIT(HFGRTR, FAR_EL1), |
26 | VSUB_3s 1111 001 1 0 . .. .... .... 1000 . . . 0 .... @3same | 28 | + DO_BIT(HFGRTR, ISR_EL1), |
27 | diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c | 29 | + DO_BIT(HFGRTR, LORC_EL1), |
30 | + DO_BIT(HFGRTR, LOREA_EL1), | ||
31 | + DO_BIT(HFGRTR, LORID_EL1), | ||
32 | + DO_BIT(HFGRTR, LORN_EL1), | ||
33 | + DO_BIT(HFGRTR, LORSA_EL1), | ||
34 | } FGTBit; | ||
35 | |||
36 | #undef DO_BIT | ||
37 | diff --git a/target/arm/helper.c b/target/arm/helper.c | ||
28 | index XXXXXXX..XXXXXXX 100644 | 38 | index XXXXXXX..XXXXXXX 100644 |
29 | --- a/target/arm/translate-neon.inc.c | 39 | --- a/target/arm/helper.c |
30 | +++ b/target/arm/translate-neon.inc.c | 40 | +++ b/target/arm/helper.c |
31 | @@ -XXX,XX +XXX,XX @@ DO_3SAME(VEOR, tcg_gen_gvec_xor) | 41 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v6_cp_reginfo[] = { |
32 | DO_3SAME_BITSEL(VBSL, rd_ofs, rn_ofs, rm_ofs) | 42 | .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0, }, |
33 | DO_3SAME_BITSEL(VBIT, rm_ofs, rn_ofs, rd_ofs) | 43 | { .name = "CPACR", .state = ARM_CP_STATE_BOTH, .opc0 = 3, |
34 | DO_3SAME_BITSEL(VBIF, rm_ofs, rd_ofs, rn_ofs) | 44 | .crn = 1, .crm = 0, .opc1 = 0, .opc2 = 2, .accessfn = cpacr_access, |
35 | + | 45 | + .fgt = FGT_CPACR_EL1, |
36 | +#define DO_3SAME_NO_SZ_3(INSN, FUNC) \ | 46 | .access = PL1_RW, .fieldoffset = offsetof(CPUARMState, cp15.cpacr_el1), |
37 | + static bool trans_##INSN##_3s(DisasContext *s, arg_3same *a) \ | 47 | .resetfn = cpacr_reset, .writefn = cpacr_write, .readfn = cpacr_read }, |
38 | + { \ | 48 | }; |
39 | + if (a->size == 3) { \ | 49 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v7_cp_reginfo[] = { |
40 | + return false; \ | 50 | .opc0 = 3, .crn = 0, .crm = 0, .opc1 = 2, .opc2 = 0, |
41 | + } \ | 51 | .access = PL1_RW, |
42 | + return do_3same(s, a, FUNC); \ | 52 | .accessfn = access_tid4, |
43 | + } | 53 | + .fgt = FGT_CSSELR_EL1, |
44 | + | 54 | .writefn = csselr_write, .resetvalue = 0, |
45 | +DO_3SAME_NO_SZ_3(VMAX_S, tcg_gen_gvec_smax) | 55 | .bank_fieldoffsets = { offsetof(CPUARMState, cp15.csselr_s), |
46 | +DO_3SAME_NO_SZ_3(VMAX_U, tcg_gen_gvec_umax) | 56 | offsetof(CPUARMState, cp15.csselr_ns) } }, |
47 | +DO_3SAME_NO_SZ_3(VMIN_S, tcg_gen_gvec_smin) | 57 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v7_cp_reginfo[] = { |
48 | +DO_3SAME_NO_SZ_3(VMIN_U, tcg_gen_gvec_umin) | 58 | .resetfn = arm_cp_reset_ignore }, |
49 | diff --git a/target/arm/translate.c b/target/arm/translate.c | 59 | { .name = "ISR_EL1", .state = ARM_CP_STATE_BOTH, |
50 | index XXXXXXX..XXXXXXX 100644 | 60 | .opc0 = 3, .opc1 = 0, .crn = 12, .crm = 1, .opc2 = 0, |
51 | --- a/target/arm/translate.c | 61 | + .fgt = FGT_ISR_EL1, |
52 | +++ b/target/arm/translate.c | 62 | .type = ARM_CP_NO_RAW, .access = PL1_R, .readfn = isr_read }, |
53 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) | 63 | /* 32 bit ITLB invalidates */ |
54 | rd_ofs, rn_ofs, rm_ofs, vec_size, vec_size); | 64 | { .name = "ITLBIALL", .cp = 15, .opc1 = 0, .crn = 8, .crm = 5, .opc2 = 0, |
55 | return 0; | 65 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo vmsa_pmsa_cp_reginfo[] = { |
56 | 66 | { .name = "FAR_EL1", .state = ARM_CP_STATE_AA64, | |
57 | - case NEON_3R_VMAX: | 67 | .opc0 = 3, .crn = 6, .crm = 0, .opc1 = 0, .opc2 = 0, |
58 | - if (u) { | 68 | .access = PL1_RW, .accessfn = access_tvm_trvm, |
59 | - tcg_gen_gvec_umax(size, rd_ofs, rn_ofs, rm_ofs, | 69 | + .fgt = FGT_FAR_EL1, |
60 | - vec_size, vec_size); | 70 | .fieldoffset = offsetof(CPUARMState, cp15.far_el[1]), |
61 | - } else { | 71 | .resetvalue = 0, }, |
62 | - tcg_gen_gvec_smax(size, rd_ofs, rn_ofs, rm_ofs, | 72 | }; |
63 | - vec_size, vec_size); | 73 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo vmsa_cp_reginfo[] = { |
64 | - } | 74 | { .name = "ESR_EL1", .state = ARM_CP_STATE_AA64, |
65 | - return 0; | 75 | .opc0 = 3, .crn = 5, .crm = 2, .opc1 = 0, .opc2 = 0, |
66 | - case NEON_3R_VMIN: | 76 | .access = PL1_RW, .accessfn = access_tvm_trvm, |
67 | - if (u) { | 77 | + .fgt = FGT_ESR_EL1, |
68 | - tcg_gen_gvec_umin(size, rd_ofs, rn_ofs, rm_ofs, | 78 | .fieldoffset = offsetof(CPUARMState, cp15.esr_el[1]), .resetvalue = 0, }, |
69 | - vec_size, vec_size); | 79 | { .name = "TTBR0_EL1", .state = ARM_CP_STATE_BOTH, |
70 | - } else { | 80 | .opc0 = 3, .opc1 = 0, .crn = 2, .crm = 0, .opc2 = 0, |
71 | - tcg_gen_gvec_smin(size, rd_ofs, rn_ofs, rm_ofs, | 81 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v8_cp_reginfo[] = { |
72 | - vec_size, vec_size); | 82 | { .name = "DCZID_EL0", .state = ARM_CP_STATE_AA64, |
73 | - } | 83 | .opc0 = 3, .opc1 = 3, .opc2 = 7, .crn = 0, .crm = 0, |
74 | - return 0; | 84 | .access = PL0_R, .type = ARM_CP_NO_RAW, |
75 | - | 85 | + .fgt = FGT_DCZID_EL0, |
76 | case NEON_3R_VSHL: | 86 | .readfn = aa64_dczid_read }, |
77 | /* Note the operation is vshl vd,vm,vn */ | 87 | { .name = "DC_ZVA", .state = ARM_CP_STATE_AA64, |
78 | tcg_gen_gvec_3(rd_ofs, rm_ofs, rn_ofs, vec_size, vec_size, | 88 | .opc0 = 1, .opc1 = 3, .crn = 7, .crm = 4, .opc2 = 1, |
79 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) | 89 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo lor_reginfo[] = { |
80 | 90 | { .name = "LORSA_EL1", .state = ARM_CP_STATE_AA64, | |
81 | case NEON_3R_VADD_VSUB: | 91 | .opc0 = 3, .opc1 = 0, .crn = 10, .crm = 4, .opc2 = 0, |
82 | case NEON_3R_LOGIC: | 92 | .access = PL1_RW, .accessfn = access_lor_other, |
83 | + case NEON_3R_VMAX: | 93 | + .fgt = FGT_LORSA_EL1, |
84 | + case NEON_3R_VMIN: | 94 | .type = ARM_CP_CONST, .resetvalue = 0 }, |
85 | /* Already handled by decodetree */ | 95 | { .name = "LOREA_EL1", .state = ARM_CP_STATE_AA64, |
86 | return 1; | 96 | .opc0 = 3, .opc1 = 0, .crn = 10, .crm = 4, .opc2 = 1, |
87 | } | 97 | .access = PL1_RW, .accessfn = access_lor_other, |
98 | + .fgt = FGT_LOREA_EL1, | ||
99 | .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
100 | { .name = "LORN_EL1", .state = ARM_CP_STATE_AA64, | ||
101 | .opc0 = 3, .opc1 = 0, .crn = 10, .crm = 4, .opc2 = 2, | ||
102 | .access = PL1_RW, .accessfn = access_lor_other, | ||
103 | + .fgt = FGT_LORN_EL1, | ||
104 | .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
105 | { .name = "LORC_EL1", .state = ARM_CP_STATE_AA64, | ||
106 | .opc0 = 3, .opc1 = 0, .crn = 10, .crm = 4, .opc2 = 3, | ||
107 | .access = PL1_RW, .accessfn = access_lor_other, | ||
108 | + .fgt = FGT_LORC_EL1, | ||
109 | .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
110 | { .name = "LORID_EL1", .state = ARM_CP_STATE_AA64, | ||
111 | .opc0 = 3, .opc1 = 0, .crn = 10, .crm = 4, .opc2 = 7, | ||
112 | .access = PL1_R, .accessfn = access_lor_ns, | ||
113 | + .fgt = FGT_LORID_EL1, | ||
114 | .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
115 | }; | ||
116 | |||
117 | @@ -XXX,XX +XXX,XX @@ void register_cp_regs_for_features(ARMCPU *cpu) | ||
118 | { .name = "CTR_EL0", .state = ARM_CP_STATE_AA64, | ||
119 | .opc0 = 3, .opc1 = 3, .opc2 = 1, .crn = 0, .crm = 0, | ||
120 | .access = PL0_R, .accessfn = ctr_el0_access, | ||
121 | + .fgt = FGT_CTR_EL0, | ||
122 | .type = ARM_CP_CONST, .resetvalue = cpu->ctr }, | ||
123 | /* TCMTR and TLBTR exist in v8 but have no 64-bit versions */ | ||
124 | { .name = "TCMTR", | ||
88 | -- | 125 | -- |
89 | 2.20.1 | 126 | 2.34.1 |
90 | |||
91 | diff view generated by jsdifflib |
1 | Convert the Neon logic ops in the 3-reg-same grouping to decodetree. | 1 | Mark up the sysreg definitions for the registers trapped |
---|---|---|---|
2 | Note that for the logic ops the 'size' field forms part of their | 2 | by HFGRTR/HFGWTR bits 24..35. |
3 | decode and the actual operations are always bitwise. | ||
4 | 3 | ||
5 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 4 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
6 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 5 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
7 | Message-id: 20200430181003.21682-16-peter.maydell@linaro.org | 6 | Tested-by: Fuad Tabba <tabba@google.com> |
7 | Message-id: 20230130182459.3309057-13-peter.maydell@linaro.org | ||
8 | Message-id: 20230127175507.2895013-13-peter.maydell@linaro.org | ||
8 | --- | 9 | --- |
9 | target/arm/neon-dp.decode | 12 +++++++++++ | 10 | target/arm/cpregs.h | 12 ++++++++++++ |
10 | target/arm/translate-neon.inc.c | 19 +++++++++++++++++ | 11 | target/arm/helper.c | 14 ++++++++++++++ |
11 | target/arm/translate.c | 38 +-------------------------------- | 12 | 2 files changed, 26 insertions(+) |
12 | 3 files changed, 32 insertions(+), 37 deletions(-) | ||
13 | 13 | ||
14 | diff --git a/target/arm/neon-dp.decode b/target/arm/neon-dp.decode | 14 | diff --git a/target/arm/cpregs.h b/target/arm/cpregs.h |
15 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/target/arm/neon-dp.decode | 16 | --- a/target/arm/cpregs.h |
17 | +++ b/target/arm/neon-dp.decode | 17 | +++ b/target/arm/cpregs.h |
18 | @@ -XXX,XX +XXX,XX @@ | 18 | @@ -XXX,XX +XXX,XX @@ typedef enum FGTBit { |
19 | @3same .... ... . . . size:2 .... .... .... . q:1 . . .... \ | 19 | DO_BIT(HFGRTR, LORID_EL1), |
20 | &3same vm=%vm_dp vn=%vn_dp vd=%vd_dp | 20 | DO_BIT(HFGRTR, LORN_EL1), |
21 | 21 | DO_BIT(HFGRTR, LORSA_EL1), | |
22 | +@3same_logic .... ... . . . .. .... .... .... . q:1 .. .... \ | 22 | + DO_BIT(HFGRTR, MAIR_EL1), |
23 | + &3same vm=%vm_dp vn=%vn_dp vd=%vd_dp size=0 | 23 | + DO_BIT(HFGRTR, MIDR_EL1), |
24 | + | 24 | + DO_BIT(HFGRTR, MPIDR_EL1), |
25 | +VAND_3s 1111 001 0 0 . 00 .... .... 0001 ... 1 .... @3same_logic | 25 | + DO_BIT(HFGRTR, PAR_EL1), |
26 | +VBIC_3s 1111 001 0 0 . 01 .... .... 0001 ... 1 .... @3same_logic | 26 | + DO_BIT(HFGRTR, REVIDR_EL1), |
27 | +VORR_3s 1111 001 0 0 . 10 .... .... 0001 ... 1 .... @3same_logic | 27 | + DO_BIT(HFGRTR, SCTLR_EL1), |
28 | +VORN_3s 1111 001 0 0 . 11 .... .... 0001 ... 1 .... @3same_logic | 28 | + DO_BIT(HFGRTR, SCXTNUM_EL1), |
29 | +VEOR_3s 1111 001 1 0 . 00 .... .... 0001 ... 1 .... @3same_logic | 29 | + DO_BIT(HFGRTR, SCXTNUM_EL0), |
30 | +VBSL_3s 1111 001 1 0 . 01 .... .... 0001 ... 1 .... @3same_logic | 30 | + DO_BIT(HFGRTR, TCR_EL1), |
31 | +VBIT_3s 1111 001 1 0 . 10 .... .... 0001 ... 1 .... @3same_logic | 31 | + DO_BIT(HFGRTR, TPIDR_EL1), |
32 | +VBIF_3s 1111 001 1 0 . 11 .... .... 0001 ... 1 .... @3same_logic | 32 | + DO_BIT(HFGRTR, TPIDRRO_EL0), |
33 | + | 33 | + DO_BIT(HFGRTR, TPIDR_EL0), |
34 | VADD_3s 1111 001 0 0 . .. .... .... 1000 . . . 0 .... @3same | 34 | } FGTBit; |
35 | VSUB_3s 1111 001 1 0 . .. .... .... 1000 . . . 0 .... @3same | 35 | |
36 | diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c | 36 | #undef DO_BIT |
37 | diff --git a/target/arm/helper.c b/target/arm/helper.c | ||
37 | index XXXXXXX..XXXXXXX 100644 | 38 | index XXXXXXX..XXXXXXX 100644 |
38 | --- a/target/arm/translate-neon.inc.c | 39 | --- a/target/arm/helper.c |
39 | +++ b/target/arm/translate-neon.inc.c | 40 | +++ b/target/arm/helper.c |
40 | @@ -XXX,XX +XXX,XX @@ static bool do_3same(DisasContext *s, arg_3same *a, GVecGen3Fn fn) | 41 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v7_cp_reginfo[] = { |
41 | 42 | { .name = "MAIR_EL1", .state = ARM_CP_STATE_AA64, | |
42 | DO_3SAME(VADD, tcg_gen_gvec_add) | 43 | .opc0 = 3, .opc1 = 0, .crn = 10, .crm = 2, .opc2 = 0, |
43 | DO_3SAME(VSUB, tcg_gen_gvec_sub) | 44 | .access = PL1_RW, .accessfn = access_tvm_trvm, |
44 | +DO_3SAME(VAND, tcg_gen_gvec_and) | 45 | + .fgt = FGT_MAIR_EL1, |
45 | +DO_3SAME(VBIC, tcg_gen_gvec_andc) | 46 | .fieldoffset = offsetof(CPUARMState, cp15.mair_el[1]), |
46 | +DO_3SAME(VORR, tcg_gen_gvec_or) | 47 | .resetvalue = 0 }, |
47 | +DO_3SAME(VORN, tcg_gen_gvec_orc) | 48 | { .name = "MAIR_EL3", .state = ARM_CP_STATE_AA64, |
48 | +DO_3SAME(VEOR, tcg_gen_gvec_xor) | 49 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v6k_cp_reginfo[] = { |
49 | + | 50 | { .name = "TPIDR_EL0", .state = ARM_CP_STATE_AA64, |
50 | +/* These insns are all gvec_bitsel but with the inputs in various orders. */ | 51 | .opc0 = 3, .opc1 = 3, .opc2 = 2, .crn = 13, .crm = 0, |
51 | +#define DO_3SAME_BITSEL(INSN, O1, O2, O3) \ | 52 | .access = PL0_RW, |
52 | + static void gen_##INSN##_3s(unsigned vece, uint32_t rd_ofs, \ | 53 | + .fgt = FGT_TPIDR_EL0, |
53 | + uint32_t rn_ofs, uint32_t rm_ofs, \ | 54 | .fieldoffset = offsetof(CPUARMState, cp15.tpidr_el[0]), .resetvalue = 0 }, |
54 | + uint32_t oprsz, uint32_t maxsz) \ | 55 | { .name = "TPIDRURW", .cp = 15, .crn = 13, .crm = 0, .opc1 = 0, .opc2 = 2, |
55 | + { \ | 56 | .access = PL0_RW, |
56 | + tcg_gen_gvec_bitsel(vece, rd_ofs, O1, O2, O3, oprsz, maxsz); \ | 57 | + .fgt = FGT_TPIDR_EL0, |
57 | + } \ | 58 | .bank_fieldoffsets = { offsetoflow32(CPUARMState, cp15.tpidrurw_s), |
58 | + DO_3SAME(INSN, gen_##INSN##_3s) | 59 | offsetoflow32(CPUARMState, cp15.tpidrurw_ns) }, |
59 | + | 60 | .resetfn = arm_cp_reset_ignore }, |
60 | +DO_3SAME_BITSEL(VBSL, rd_ofs, rn_ofs, rm_ofs) | 61 | { .name = "TPIDRRO_EL0", .state = ARM_CP_STATE_AA64, |
61 | +DO_3SAME_BITSEL(VBIT, rm_ofs, rn_ofs, rd_ofs) | 62 | .opc0 = 3, .opc1 = 3, .opc2 = 3, .crn = 13, .crm = 0, |
62 | +DO_3SAME_BITSEL(VBIF, rm_ofs, rd_ofs, rn_ofs) | 63 | .access = PL0_R | PL1_W, |
63 | diff --git a/target/arm/translate.c b/target/arm/translate.c | 64 | + .fgt = FGT_TPIDRRO_EL0, |
64 | index XXXXXXX..XXXXXXX 100644 | 65 | .fieldoffset = offsetof(CPUARMState, cp15.tpidrro_el[0]), |
65 | --- a/target/arm/translate.c | 66 | .resetvalue = 0}, |
66 | +++ b/target/arm/translate.c | 67 | { .name = "TPIDRURO", .cp = 15, .crn = 13, .crm = 0, .opc1 = 0, .opc2 = 3, |
67 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) | 68 | .access = PL0_R | PL1_W, |
68 | } | 69 | + .fgt = FGT_TPIDRRO_EL0, |
69 | return 1; | 70 | .bank_fieldoffsets = { offsetoflow32(CPUARMState, cp15.tpidruro_s), |
70 | 71 | offsetoflow32(CPUARMState, cp15.tpidruro_ns) }, | |
71 | - case NEON_3R_LOGIC: /* Logic ops. */ | 72 | .resetfn = arm_cp_reset_ignore }, |
72 | - switch ((u << 2) | size) { | 73 | { .name = "TPIDR_EL1", .state = ARM_CP_STATE_AA64, |
73 | - case 0: /* VAND */ | 74 | .opc0 = 3, .opc1 = 0, .opc2 = 4, .crn = 13, .crm = 0, |
74 | - tcg_gen_gvec_and(0, rd_ofs, rn_ofs, rm_ofs, | 75 | .access = PL1_RW, |
75 | - vec_size, vec_size); | 76 | + .fgt = FGT_TPIDR_EL1, |
76 | - break; | 77 | .fieldoffset = offsetof(CPUARMState, cp15.tpidr_el[1]), .resetvalue = 0 }, |
77 | - case 1: /* VBIC */ | 78 | { .name = "TPIDRPRW", .opc1 = 0, .cp = 15, .crn = 13, .crm = 0, .opc2 = 4, |
78 | - tcg_gen_gvec_andc(0, rd_ofs, rn_ofs, rm_ofs, | 79 | .access = PL1_RW, |
79 | - vec_size, vec_size); | 80 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo vmsa_cp_reginfo[] = { |
80 | - break; | 81 | { .name = "TCR_EL1", .state = ARM_CP_STATE_AA64, |
81 | - case 2: /* VORR */ | 82 | .opc0 = 3, .crn = 2, .crm = 0, .opc1 = 0, .opc2 = 2, |
82 | - tcg_gen_gvec_or(0, rd_ofs, rn_ofs, rm_ofs, | 83 | .access = PL1_RW, .accessfn = access_tvm_trvm, |
83 | - vec_size, vec_size); | 84 | + .fgt = FGT_TCR_EL1, |
84 | - break; | 85 | .writefn = vmsa_tcr_el12_write, |
85 | - case 3: /* VORN */ | 86 | .raw_writefn = raw_write, |
86 | - tcg_gen_gvec_orc(0, rd_ofs, rn_ofs, rm_ofs, | 87 | .resetvalue = 0, |
87 | - vec_size, vec_size); | 88 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v8_cp_reginfo[] = { |
88 | - break; | 89 | .type = ARM_CP_ALIAS, |
89 | - case 4: /* VEOR */ | 90 | .opc0 = 3, .opc1 = 0, .crn = 7, .crm = 4, .opc2 = 0, |
90 | - tcg_gen_gvec_xor(0, rd_ofs, rn_ofs, rm_ofs, | 91 | .access = PL1_RW, .resetvalue = 0, |
91 | - vec_size, vec_size); | 92 | + .fgt = FGT_PAR_EL1, |
92 | - break; | 93 | .fieldoffset = offsetof(CPUARMState, cp15.par_el[1]), |
93 | - case 5: /* VBSL */ | 94 | .writefn = par_write }, |
94 | - tcg_gen_gvec_bitsel(MO_8, rd_ofs, rd_ofs, rn_ofs, rm_ofs, | 95 | #endif |
95 | - vec_size, vec_size); | 96 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo scxtnum_reginfo[] = { |
96 | - break; | 97 | { .name = "SCXTNUM_EL0", .state = ARM_CP_STATE_AA64, |
97 | - case 6: /* VBIT */ | 98 | .opc0 = 3, .opc1 = 3, .crn = 13, .crm = 0, .opc2 = 7, |
98 | - tcg_gen_gvec_bitsel(MO_8, rd_ofs, rm_ofs, rn_ofs, rd_ofs, | 99 | .access = PL0_RW, .accessfn = access_scxtnum, |
99 | - vec_size, vec_size); | 100 | + .fgt = FGT_SCXTNUM_EL0, |
100 | - break; | 101 | .fieldoffset = offsetof(CPUARMState, scxtnum_el[0]) }, |
101 | - case 7: /* VBIF */ | 102 | { .name = "SCXTNUM_EL1", .state = ARM_CP_STATE_AA64, |
102 | - tcg_gen_gvec_bitsel(MO_8, rd_ofs, rm_ofs, rd_ofs, rn_ofs, | 103 | .opc0 = 3, .opc1 = 0, .crn = 13, .crm = 0, .opc2 = 7, |
103 | - vec_size, vec_size); | 104 | .access = PL1_RW, .accessfn = access_scxtnum, |
104 | - break; | 105 | + .fgt = FGT_SCXTNUM_EL1, |
105 | - } | 106 | .fieldoffset = offsetof(CPUARMState, scxtnum_el[1]) }, |
106 | - return 0; | 107 | { .name = "SCXTNUM_EL2", .state = ARM_CP_STATE_AA64, |
107 | - | 108 | .opc0 = 3, .opc1 = 4, .crn = 13, .crm = 0, .opc2 = 7, |
108 | case NEON_3R_VQADD: | 109 | @@ -XXX,XX +XXX,XX @@ void register_cp_regs_for_features(ARMCPU *cpu) |
109 | tcg_gen_gvec_4(rd_ofs, offsetof(CPUARMState, vfp.qc), | 110 | { .name = "MIDR_EL1", .state = ARM_CP_STATE_BOTH, |
110 | rn_ofs, rm_ofs, vec_size, vec_size, | 111 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 0, .opc2 = 0, |
111 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) | 112 | .access = PL1_R, .type = ARM_CP_NO_RAW, .resetvalue = cpu->midr, |
112 | return 0; | 113 | + .fgt = FGT_MIDR_EL1, |
113 | 114 | .fieldoffset = offsetof(CPUARMState, cp15.c0_cpuid), | |
114 | case NEON_3R_VADD_VSUB: | 115 | .readfn = midr_read }, |
115 | + case NEON_3R_LOGIC: | 116 | /* crn = 0 op1 = 0 crm = 0 op2 = 7 : AArch32 aliases of MIDR */ |
116 | /* Already handled by decodetree */ | 117 | @@ -XXX,XX +XXX,XX @@ void register_cp_regs_for_features(ARMCPU *cpu) |
117 | return 1; | 118 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 0, .opc2 = 6, |
118 | } | 119 | .access = PL1_R, |
120 | .accessfn = access_aa64_tid1, | ||
121 | + .fgt = FGT_REVIDR_EL1, | ||
122 | .type = ARM_CP_CONST, .resetvalue = cpu->revidr }, | ||
123 | }; | ||
124 | ARMCPRegInfo id_v8_midr_alias_cp_reginfo = { | ||
125 | @@ -XXX,XX +XXX,XX @@ void register_cp_regs_for_features(ARMCPU *cpu) | ||
126 | ARMCPRegInfo mpidr_cp_reginfo[] = { | ||
127 | { .name = "MPIDR_EL1", .state = ARM_CP_STATE_BOTH, | ||
128 | .opc0 = 3, .crn = 0, .crm = 0, .opc1 = 0, .opc2 = 5, | ||
129 | + .fgt = FGT_MPIDR_EL1, | ||
130 | .access = PL1_R, .readfn = mpidr_read, .type = ARM_CP_NO_RAW }, | ||
131 | }; | ||
132 | #ifdef CONFIG_USER_ONLY | ||
133 | @@ -XXX,XX +XXX,XX @@ void register_cp_regs_for_features(ARMCPU *cpu) | ||
134 | .name = "SCTLR", .state = ARM_CP_STATE_BOTH, | ||
135 | .opc0 = 3, .opc1 = 0, .crn = 1, .crm = 0, .opc2 = 0, | ||
136 | .access = PL1_RW, .accessfn = access_tvm_trvm, | ||
137 | + .fgt = FGT_SCTLR_EL1, | ||
138 | .bank_fieldoffsets = { offsetof(CPUARMState, cp15.sctlr_s), | ||
139 | offsetof(CPUARMState, cp15.sctlr_ns) }, | ||
140 | .writefn = sctlr_write, .resetvalue = cpu->reset_sctlr, | ||
119 | -- | 141 | -- |
120 | 2.20.1 | 142 | 2.34.1 |
121 | |||
122 | diff view generated by jsdifflib |
1 | Convert the VFM[AS]L (vector) insns to decodetree. This is the last | 1 | Mark up the sysreg definitions for the registers trapped |
---|---|---|---|
2 | insn in the legacy decoder for the 3same_ext group, so we can | 2 | by HFGRTR/HFGWTR bits 36..63. |
3 | delete the legacy decoder function for the group entirely. | ||
4 | 3 | ||
5 | Note that in disas_thumb2_insn() the parts of this encoding space | 4 | Of these, some correspond to RAS registers which we implement as |
6 | where the decodetree decoder returns false will correctly be directed | 5 | always-UNDEF: these don't need any extra handling for FGT because the |
7 | to illegal_op by the "(insn & (1 << 28))" check so they won't fall | 6 | UNDEF-to-EL1 always takes priority over any theoretical |
8 | into disas_coproc_insn() by mistake. | 7 | FGT-trap-to-EL2. |
8 | |||
9 | Bit 50 (NACCDATA_EL1) is for the ACCDATA_EL1 register which is part | ||
10 | of the FEAT_LS64_ACCDATA feature which we don't yet implement. | ||
9 | 11 | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
11 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 13 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
12 | Message-id: 20200430181003.21682-8-peter.maydell@linaro.org | 14 | Tested-by: Fuad Tabba <tabba@google.com> |
15 | Message-id: 20230130182459.3309057-14-peter.maydell@linaro.org | ||
16 | Message-id: 20230127175507.2895013-14-peter.maydell@linaro.org | ||
13 | --- | 17 | --- |
14 | target/arm/neon-shared.decode | 6 +++ | 18 | target/arm/cpregs.h | 7 +++++++ |
15 | target/arm/translate-neon.inc.c | 31 +++++++++++ | 19 | hw/intc/arm_gicv3_cpuif.c | 2 ++ |
16 | target/arm/translate.c | 92 +-------------------------------- | 20 | target/arm/helper.c | 10 ++++++++++ |
17 | 3 files changed, 38 insertions(+), 91 deletions(-) | 21 | 3 files changed, 19 insertions(+) |
18 | 22 | ||
19 | diff --git a/target/arm/neon-shared.decode b/target/arm/neon-shared.decode | 23 | diff --git a/target/arm/cpregs.h b/target/arm/cpregs.h |
20 | index XXXXXXX..XXXXXXX 100644 | 24 | index XXXXXXX..XXXXXXX 100644 |
21 | --- a/target/arm/neon-shared.decode | 25 | --- a/target/arm/cpregs.h |
22 | +++ b/target/arm/neon-shared.decode | 26 | +++ b/target/arm/cpregs.h |
23 | @@ -XXX,XX +XXX,XX @@ VCADD 1111 110 rot:1 1 . 0 size:1 .... .... 1000 . q:1 . 0 .... \ | 27 | @@ -XXX,XX +XXX,XX @@ typedef enum FGTBit { |
24 | # VUDOT and VSDOT | 28 | DO_BIT(HFGRTR, TPIDR_EL1), |
25 | VDOT 1111 110 00 . 10 .... .... 1101 . q:1 . u:1 .... \ | 29 | DO_BIT(HFGRTR, TPIDRRO_EL0), |
26 | vm=%vm_dp vn=%vn_dp vd=%vd_dp | 30 | DO_BIT(HFGRTR, TPIDR_EL0), |
27 | + | 31 | + DO_BIT(HFGRTR, TTBR0_EL1), |
28 | +# VFM[AS]L | 32 | + DO_BIT(HFGRTR, TTBR1_EL1), |
29 | +VFML 1111 110 0 s:1 . 10 .... .... 1000 . 0 . 1 .... \ | 33 | + DO_BIT(HFGRTR, VBAR_EL1), |
30 | + vm=%vm_sp vn=%vn_sp vd=%vd_dp q=0 | 34 | + DO_BIT(HFGRTR, ICC_IGRPENN_EL1), |
31 | +VFML 1111 110 0 s:1 . 10 .... .... 1000 . 1 . 1 .... \ | 35 | + DO_BIT(HFGRTR, ERRIDR_EL1), |
32 | + vm=%vm_dp vn=%vn_dp vd=%vd_dp q=1 | 36 | + DO_REV_BIT(HFGRTR, NSMPRI_EL1), |
33 | diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c | 37 | + DO_REV_BIT(HFGRTR, NTPIDR2_EL0), |
38 | } FGTBit; | ||
39 | |||
40 | #undef DO_BIT | ||
41 | diff --git a/hw/intc/arm_gicv3_cpuif.c b/hw/intc/arm_gicv3_cpuif.c | ||
34 | index XXXXXXX..XXXXXXX 100644 | 42 | index XXXXXXX..XXXXXXX 100644 |
35 | --- a/target/arm/translate-neon.inc.c | 43 | --- a/hw/intc/arm_gicv3_cpuif.c |
36 | +++ b/target/arm/translate-neon.inc.c | 44 | +++ b/hw/intc/arm_gicv3_cpuif.c |
37 | @@ -XXX,XX +XXX,XX @@ static bool trans_VDOT(DisasContext *s, arg_VDOT *a) | 45 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo gicv3_cpuif_reginfo[] = { |
38 | opr_sz, opr_sz, 0, fn_gvec); | 46 | .opc0 = 3, .opc1 = 0, .crn = 12, .crm = 12, .opc2 = 6, |
39 | return true; | 47 | .type = ARM_CP_IO | ARM_CP_NO_RAW, |
40 | } | 48 | .access = PL1_RW, .accessfn = gicv3_fiq_access, |
41 | + | 49 | + .fgt = FGT_ICC_IGRPENN_EL1, |
42 | +static bool trans_VFML(DisasContext *s, arg_VFML *a) | 50 | .readfn = icc_igrpen_read, |
43 | +{ | 51 | .writefn = icc_igrpen_write, |
44 | + int opr_sz; | 52 | }, |
45 | + | 53 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo gicv3_cpuif_reginfo[] = { |
46 | + if (!dc_isar_feature(aa32_fhm, s)) { | 54 | .opc0 = 3, .opc1 = 0, .crn = 12, .crm = 12, .opc2 = 7, |
47 | + return false; | 55 | .type = ARM_CP_IO | ARM_CP_NO_RAW, |
48 | + } | 56 | .access = PL1_RW, .accessfn = gicv3_irq_access, |
49 | + | 57 | + .fgt = FGT_ICC_IGRPENN_EL1, |
50 | + /* UNDEF accesses to D16-D31 if they don't exist. */ | 58 | .readfn = icc_igrpen_read, |
51 | + if (!dc_isar_feature(aa32_simd_r32, s) && | 59 | .writefn = icc_igrpen_write, |
52 | + (a->vd & 0x10)) { | 60 | }, |
53 | + return false; | 61 | diff --git a/target/arm/helper.c b/target/arm/helper.c |
54 | + } | ||
55 | + | ||
56 | + if (a->vd & a->q) { | ||
57 | + return false; | ||
58 | + } | ||
59 | + | ||
60 | + if (!vfp_access_check(s)) { | ||
61 | + return true; | ||
62 | + } | ||
63 | + | ||
64 | + opr_sz = (1 + a->q) * 8; | ||
65 | + tcg_gen_gvec_3_ptr(vfp_reg_offset(1, a->vd), | ||
66 | + vfp_reg_offset(a->q, a->vn), | ||
67 | + vfp_reg_offset(a->q, a->vm), | ||
68 | + cpu_env, opr_sz, opr_sz, a->s, /* is_2 == 0 */ | ||
69 | + gen_helper_gvec_fmlal_a32); | ||
70 | + return true; | ||
71 | +} | ||
72 | diff --git a/target/arm/translate.c b/target/arm/translate.c | ||
73 | index XXXXXXX..XXXXXXX 100644 | 62 | index XXXXXXX..XXXXXXX 100644 |
74 | --- a/target/arm/translate.c | 63 | --- a/target/arm/helper.c |
75 | +++ b/target/arm/translate.c | 64 | +++ b/target/arm/helper.c |
76 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) | 65 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo vmsa_cp_reginfo[] = { |
77 | return 0; | 66 | { .name = "TTBR0_EL1", .state = ARM_CP_STATE_BOTH, |
78 | } | 67 | .opc0 = 3, .opc1 = 0, .crn = 2, .crm = 0, .opc2 = 0, |
79 | 68 | .access = PL1_RW, .accessfn = access_tvm_trvm, | |
80 | -/* Advanced SIMD three registers of the same length extension. | 69 | + .fgt = FGT_TTBR0_EL1, |
81 | - * 31 25 23 22 20 16 12 11 10 9 8 3 0 | 70 | .writefn = vmsa_ttbr_write, .resetvalue = 0, |
82 | - * +---------------+-----+---+-----+----+----+---+----+---+----+---------+----+ | 71 | .bank_fieldoffsets = { offsetof(CPUARMState, cp15.ttbr0_s), |
83 | - * | 1 1 1 1 1 1 0 | op1 | D | op2 | Vn | Vd | 1 | o3 | 0 | o4 | N Q M U | Vm | | 72 | offsetof(CPUARMState, cp15.ttbr0_ns) } }, |
84 | - * +---------------+-----+---+-----+----+----+---+----+---+----+---------+----+ | 73 | { .name = "TTBR1_EL1", .state = ARM_CP_STATE_BOTH, |
85 | - */ | 74 | .opc0 = 3, .opc1 = 0, .crn = 2, .crm = 0, .opc2 = 1, |
86 | -static int disas_neon_insn_3same_ext(DisasContext *s, uint32_t insn) | 75 | .access = PL1_RW, .accessfn = access_tvm_trvm, |
87 | -{ | 76 | + .fgt = FGT_TTBR1_EL1, |
88 | - gen_helper_gvec_3 *fn_gvec = NULL; | 77 | .writefn = vmsa_ttbr_write, .resetvalue = 0, |
89 | - gen_helper_gvec_3_ptr *fn_gvec_ptr = NULL; | 78 | .bank_fieldoffsets = { offsetof(CPUARMState, cp15.ttbr1_s), |
90 | - int rd, rn, rm, opr_sz; | 79 | offsetof(CPUARMState, cp15.ttbr1_ns) } }, |
91 | - int data = 0; | 80 | @@ -XXX,XX +XXX,XX @@ static void disr_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t val) |
92 | - int off_rn, off_rm; | 81 | * ERRSELR_EL1 |
93 | - bool is_long = false, q = extract32(insn, 6, 1); | 82 | * may generate UNDEFINED, which is the effect we get by not |
94 | - bool ptr_is_env = false; | 83 | * listing them at all. |
95 | - | 84 | + * |
96 | - if ((insn & 0xff300f10) == 0xfc200810) { | 85 | + * These registers have fine-grained trap bits, but UNDEF-to-EL1 |
97 | - /* VFM[AS]L -- 1111 1100 S.10 .... .... 1000 .Q.1 .... */ | 86 | + * is higher priority than FGT-to-EL2 so we do not need to list them |
98 | - int is_s = extract32(insn, 23, 1); | 87 | + * in order to check for an FGT. |
99 | - if (!dc_isar_feature(aa32_fhm, s)) { | 88 | */ |
100 | - return 1; | 89 | static const ARMCPRegInfo minimal_ras_reginfo[] = { |
101 | - } | 90 | { .name = "DISR_EL1", .state = ARM_CP_STATE_BOTH, |
102 | - is_long = true; | 91 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo minimal_ras_reginfo[] = { |
103 | - data = is_s; /* is_2 == 0 */ | 92 | { .name = "ERRIDR_EL1", .state = ARM_CP_STATE_BOTH, |
104 | - fn_gvec_ptr = gen_helper_gvec_fmlal_a32; | 93 | .opc0 = 3, .opc1 = 0, .crn = 5, .crm = 3, .opc2 = 0, |
105 | - ptr_is_env = true; | 94 | .access = PL1_R, .accessfn = access_terr, |
106 | - } else { | 95 | + .fgt = FGT_ERRIDR_EL1, |
107 | - return 1; | 96 | .type = ARM_CP_CONST, .resetvalue = 0 }, |
108 | - } | 97 | { .name = "VDISR_EL2", .state = ARM_CP_STATE_BOTH, |
109 | - | 98 | .opc0 = 3, .opc1 = 4, .crn = 12, .crm = 1, .opc2 = 1, |
110 | - VFP_DREG_D(rd, insn); | 99 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo sme_reginfo[] = { |
111 | - if (rd & q) { | 100 | { .name = "TPIDR2_EL0", .state = ARM_CP_STATE_AA64, |
112 | - return 1; | 101 | .opc0 = 3, .opc1 = 3, .crn = 13, .crm = 0, .opc2 = 5, |
113 | - } | 102 | .access = PL0_RW, .accessfn = access_tpidr2, |
114 | - if (q || !is_long) { | 103 | + .fgt = FGT_NTPIDR2_EL0, |
115 | - VFP_DREG_N(rn, insn); | 104 | .fieldoffset = offsetof(CPUARMState, cp15.tpidr2_el0) }, |
116 | - VFP_DREG_M(rm, insn); | 105 | { .name = "SVCR", .state = ARM_CP_STATE_AA64, |
117 | - if ((rn | rm) & q & !is_long) { | 106 | .opc0 = 3, .opc1 = 3, .crn = 4, .crm = 2, .opc2 = 2, |
118 | - return 1; | 107 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo sme_reginfo[] = { |
119 | - } | 108 | { .name = "SMPRI_EL1", .state = ARM_CP_STATE_AA64, |
120 | - off_rn = vfp_reg_offset(1, rn); | 109 | .opc0 = 3, .opc1 = 0, .crn = 1, .crm = 2, .opc2 = 4, |
121 | - off_rm = vfp_reg_offset(1, rm); | 110 | .access = PL1_RW, .accessfn = access_esm, |
122 | - } else { | 111 | + .fgt = FGT_NSMPRI_EL1, |
123 | - rn = VFP_SREG_N(insn); | 112 | .type = ARM_CP_CONST, .resetvalue = 0 }, |
124 | - rm = VFP_SREG_M(insn); | 113 | { .name = "SMPRIMAP_EL2", .state = ARM_CP_STATE_AA64, |
125 | - off_rn = vfp_reg_offset(0, rn); | 114 | .opc0 = 3, .opc1 = 4, .crn = 1, .crm = 2, .opc2 = 5, |
126 | - off_rm = vfp_reg_offset(0, rm); | 115 | @@ -XXX,XX +XXX,XX @@ void register_cp_regs_for_features(ARMCPU *cpu) |
127 | - } | 116 | { .name = "VBAR", .state = ARM_CP_STATE_BOTH, |
128 | - | 117 | .opc0 = 3, .crn = 12, .crm = 0, .opc1 = 0, .opc2 = 0, |
129 | - if (s->fp_excp_el) { | 118 | .access = PL1_RW, .writefn = vbar_write, |
130 | - gen_exception_insn(s, s->pc_curr, EXCP_UDEF, | 119 | + .fgt = FGT_VBAR_EL1, |
131 | - syn_simd_access_trap(1, 0xe, false), s->fp_excp_el); | 120 | .bank_fieldoffsets = { offsetof(CPUARMState, cp15.vbar_s), |
132 | - return 0; | 121 | offsetof(CPUARMState, cp15.vbar_ns) }, |
133 | - } | 122 | .resetvalue = 0 }, |
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 | - } | ||
151 | - } else { | ||
152 | - tcg_gen_gvec_3_ool(vfp_reg_offset(1, rd), off_rn, off_rm, | ||
153 | - opr_sz, opr_sz, data, fn_gvec); | ||
154 | - } | ||
155 | - return 0; | ||
156 | -} | ||
157 | - | ||
158 | /* Advanced SIMD two registers and a scalar extension. | ||
159 | * 31 24 23 22 20 16 12 11 10 9 8 3 0 | ||
160 | * +-----------------+----+---+----+----+----+---+----+---+----+---------+----+ | ||
161 | @@ -XXX,XX +XXX,XX @@ static void disas_arm_insn(DisasContext *s, unsigned int insn) | ||
162 | } | ||
163 | } | ||
164 | } | ||
165 | - } else if ((insn & 0x0e000a00) == 0x0c000800 | ||
166 | - && arm_dc_feature(s, ARM_FEATURE_V8)) { | ||
167 | - if (disas_neon_insn_3same_ext(s, insn)) { | ||
168 | - goto illegal_op; | ||
169 | - } | ||
170 | - return; | ||
171 | } else if ((insn & 0x0f000a00) == 0x0e000800 | ||
172 | && arm_dc_feature(s, ARM_FEATURE_V8)) { | ||
173 | if (disas_neon_insn_2reg_scalar_ext(s, insn)) { | ||
174 | @@ -XXX,XX +XXX,XX @@ static void disas_thumb2_insn(DisasContext *s, uint32_t insn) | ||
175 | } | ||
176 | break; | ||
177 | } | ||
178 | - if ((insn & 0xfe000a00) == 0xfc000800 | ||
179 | + if ((insn & 0xff000a00) == 0xfe000800 | ||
180 | && arm_dc_feature(s, ARM_FEATURE_V8)) { | ||
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 | -- | 123 | -- |
192 | 2.20.1 | 124 | 2.34.1 |
193 | |||
194 | diff view generated by jsdifflib |
1 | Convert the V[US]DOT (vector) insns to decodetree. | 1 | Mark up the sysreg definitons for the registers trapped |
---|---|---|---|
2 | by HDFGRTR/HDFGWTR bits 0..11. These cover various debug | ||
3 | related registers. | ||
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-7-peter.maydell@linaro.org | 7 | Tested-by: Fuad Tabba <tabba@google.com> |
8 | Message-id: 20230130182459.3309057-15-peter.maydell@linaro.org | ||
9 | Message-id: 20230127175507.2895013-15-peter.maydell@linaro.org | ||
6 | --- | 10 | --- |
7 | target/arm/neon-shared.decode | 4 ++++ | 11 | target/arm/cpregs.h | 12 ++++++++++++ |
8 | target/arm/translate-neon.inc.c | 32 ++++++++++++++++++++++++++++++++ | 12 | target/arm/debug_helper.c | 11 +++++++++++ |
9 | target/arm/translate.c | 9 +-------- | 13 | 2 files changed, 23 insertions(+) |
10 | 3 files changed, 37 insertions(+), 8 deletions(-) | ||
11 | 14 | ||
12 | diff --git a/target/arm/neon-shared.decode b/target/arm/neon-shared.decode | 15 | diff --git a/target/arm/cpregs.h b/target/arm/cpregs.h |
13 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
14 | --- a/target/arm/neon-shared.decode | 17 | --- a/target/arm/cpregs.h |
15 | +++ b/target/arm/neon-shared.decode | 18 | +++ b/target/arm/cpregs.h |
16 | @@ -XXX,XX +XXX,XX @@ VCMLA 1111 110 rot:2 . 1 size:1 .... .... 1000 . q:1 . 0 .... \ | 19 | @@ -XXX,XX +XXX,XX @@ typedef enum FGTBit { |
17 | 20 | DO_BIT(HFGRTR, ERRIDR_EL1), | |
18 | VCADD 1111 110 rot:1 1 . 0 size:1 .... .... 1000 . q:1 . 0 .... \ | 21 | DO_REV_BIT(HFGRTR, NSMPRI_EL1), |
19 | vm=%vm_dp vn=%vn_dp vd=%vd_dp | 22 | DO_REV_BIT(HFGRTR, NTPIDR2_EL0), |
20 | + | 23 | + |
21 | +# VUDOT and VSDOT | 24 | + /* Trap bits in HDFGRTR_EL2 / HDFGWTR_EL2, starting from bit 0. */ |
22 | +VDOT 1111 110 00 . 10 .... .... 1101 . q:1 . u:1 .... \ | 25 | + DO_BIT(HDFGRTR, DBGBCRN_EL1), |
23 | + vm=%vm_dp vn=%vn_dp vd=%vd_dp | 26 | + DO_BIT(HDFGRTR, DBGBVRN_EL1), |
24 | diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c | 27 | + DO_BIT(HDFGRTR, DBGWCRN_EL1), |
28 | + DO_BIT(HDFGRTR, DBGWVRN_EL1), | ||
29 | + DO_BIT(HDFGRTR, MDSCR_EL1), | ||
30 | + DO_BIT(HDFGRTR, DBGCLAIM), | ||
31 | + DO_BIT(HDFGWTR, OSLAR_EL1), | ||
32 | + DO_BIT(HDFGRTR, OSLSR_EL1), | ||
33 | + DO_BIT(HDFGRTR, OSECCR_EL1), | ||
34 | + DO_BIT(HDFGRTR, OSDLR_EL1), | ||
35 | } FGTBit; | ||
36 | |||
37 | #undef DO_BIT | ||
38 | diff --git a/target/arm/debug_helper.c b/target/arm/debug_helper.c | ||
25 | index XXXXXXX..XXXXXXX 100644 | 39 | index XXXXXXX..XXXXXXX 100644 |
26 | --- a/target/arm/translate-neon.inc.c | 40 | --- a/target/arm/debug_helper.c |
27 | +++ b/target/arm/translate-neon.inc.c | 41 | +++ b/target/arm/debug_helper.c |
28 | @@ -XXX,XX +XXX,XX @@ static bool trans_VCADD(DisasContext *s, arg_VCADD *a) | 42 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo debug_cp_reginfo[] = { |
29 | tcg_temp_free_ptr(fpst); | 43 | { .name = "MDSCR_EL1", .state = ARM_CP_STATE_BOTH, |
30 | return true; | 44 | .cp = 14, .opc0 = 2, .opc1 = 0, .crn = 0, .crm = 2, .opc2 = 2, |
31 | } | 45 | .access = PL1_RW, .accessfn = access_tda, |
32 | + | 46 | + .fgt = FGT_MDSCR_EL1, |
33 | +static bool trans_VDOT(DisasContext *s, arg_VDOT *a) | 47 | .fieldoffset = offsetof(CPUARMState, cp15.mdscr_el1), |
34 | +{ | 48 | .resetvalue = 0 }, |
35 | + int opr_sz; | 49 | /* |
36 | + gen_helper_gvec_3 *fn_gvec; | 50 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo debug_cp_reginfo[] = { |
37 | + | 51 | { .name = "OSECCR_EL1", .state = ARM_CP_STATE_BOTH, .cp = 14, |
38 | + if (!dc_isar_feature(aa32_dp, s)) { | 52 | .opc0 = 2, .opc1 = 0, .crn = 0, .crm = 6, .opc2 = 2, |
39 | + return false; | 53 | .access = PL1_RW, .accessfn = access_tda, |
40 | + } | 54 | + .fgt = FGT_OSECCR_EL1, |
41 | + | 55 | .type = ARM_CP_CONST, .resetvalue = 0 }, |
42 | + /* UNDEF accesses to D16-D31 if they don't exist. */ | 56 | /* |
43 | + if (!dc_isar_feature(aa32_simd_r32, s) && | 57 | * DBGDSCRint[15,12,5:2] map to MDSCR_EL1[15,12,5:2]. Map all bits as |
44 | + ((a->vd | a->vn | a->vm) & 0x10)) { | 58 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo debug_cp_reginfo[] = { |
45 | + return false; | 59 | .cp = 14, .opc0 = 2, .opc1 = 0, .crn = 1, .crm = 0, .opc2 = 4, |
46 | + } | 60 | .access = PL1_W, .type = ARM_CP_NO_RAW, |
47 | + | 61 | .accessfn = access_tdosa, |
48 | + if ((a->vn | a->vm | a->vd) & a->q) { | 62 | + .fgt = FGT_OSLAR_EL1, |
49 | + return false; | 63 | .writefn = oslar_write }, |
50 | + } | 64 | { .name = "OSLSR_EL1", .state = ARM_CP_STATE_BOTH, |
51 | + | 65 | .cp = 14, .opc0 = 2, .opc1 = 0, .crn = 1, .crm = 1, .opc2 = 4, |
52 | + if (!vfp_access_check(s)) { | 66 | .access = PL1_R, .resetvalue = 10, |
53 | + return true; | 67 | .accessfn = access_tdosa, |
54 | + } | 68 | + .fgt = FGT_OSLSR_EL1, |
55 | + | 69 | .fieldoffset = offsetof(CPUARMState, cp15.oslsr_el1) }, |
56 | + opr_sz = (1 + a->q) * 8; | 70 | /* Dummy OSDLR_EL1: 32-bit Linux will read this */ |
57 | + fn_gvec = a->u ? gen_helper_gvec_udot_b : gen_helper_gvec_sdot_b; | 71 | { .name = "OSDLR_EL1", .state = ARM_CP_STATE_BOTH, |
58 | + tcg_gen_gvec_3_ool(vfp_reg_offset(1, a->vd), | 72 | .cp = 14, .opc0 = 2, .opc1 = 0, .crn = 1, .crm = 3, .opc2 = 4, |
59 | + vfp_reg_offset(1, a->vn), | 73 | .access = PL1_RW, .accessfn = access_tdosa, |
60 | + vfp_reg_offset(1, a->vm), | 74 | + .fgt = FGT_OSDLR_EL1, |
61 | + opr_sz, opr_sz, 0, fn_gvec); | 75 | .writefn = osdlr_write, |
62 | + return true; | 76 | .fieldoffset = offsetof(CPUARMState, cp15.osdlr_el1) }, |
63 | +} | 77 | /* |
64 | diff --git a/target/arm/translate.c b/target/arm/translate.c | 78 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo debug_cp_reginfo[] = { |
65 | index XXXXXXX..XXXXXXX 100644 | 79 | .cp = 14, .opc0 = 2, .opc1 = 0, .crn = 7, .crm = 8, .opc2 = 6, |
66 | --- a/target/arm/translate.c | 80 | .type = ARM_CP_ALIAS, |
67 | +++ b/target/arm/translate.c | 81 | .access = PL1_RW, .accessfn = access_tda, |
68 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_insn_3same_ext(DisasContext *s, uint32_t insn) | 82 | + .fgt = FGT_DBGCLAIM, |
69 | bool is_long = false, q = extract32(insn, 6, 1); | 83 | .writefn = dbgclaimset_write, .readfn = dbgclaimset_read }, |
70 | bool ptr_is_env = false; | 84 | { .name = "DBGCLAIMCLR_EL1", .state = ARM_CP_STATE_BOTH, |
71 | 85 | .cp = 14, .opc0 = 2, .opc1 = 0, .crn = 7, .crm = 9, .opc2 = 6, | |
72 | - if ((insn & 0xfeb00f00) == 0xfc200d00) { | 86 | .access = PL1_RW, .accessfn = access_tda, |
73 | - /* V[US]DOT -- 1111 1100 0.10 .... .... 1101 .Q.U .... */ | 87 | + .fgt = FGT_DBGCLAIM, |
74 | - bool u = extract32(insn, 4, 1); | 88 | .writefn = dbgclaimclr_write, .raw_writefn = raw_write, |
75 | - if (!dc_isar_feature(aa32_dp, s)) { | 89 | .fieldoffset = offsetof(CPUARMState, cp15.dbgclaim) }, |
76 | - return 1; | 90 | }; |
77 | - } | 91 | @@ -XXX,XX +XXX,XX @@ void define_debug_regs(ARMCPU *cpu) |
78 | - fn_gvec = u ? gen_helper_gvec_udot_b : gen_helper_gvec_sdot_b; | 92 | { .name = dbgbvr_el1_name, .state = ARM_CP_STATE_BOTH, |
79 | - } else if ((insn & 0xff300f10) == 0xfc200810) { | 93 | .cp = 14, .opc0 = 2, .opc1 = 0, .crn = 0, .crm = i, .opc2 = 4, |
80 | + if ((insn & 0xff300f10) == 0xfc200810) { | 94 | .access = PL1_RW, .accessfn = access_tda, |
81 | /* VFM[AS]L -- 1111 1100 S.10 .... .... 1000 .Q.1 .... */ | 95 | + .fgt = FGT_DBGBVRN_EL1, |
82 | int is_s = extract32(insn, 23, 1); | 96 | .fieldoffset = offsetof(CPUARMState, cp15.dbgbvr[i]), |
83 | if (!dc_isar_feature(aa32_fhm, s)) { | 97 | .writefn = dbgbvr_write, .raw_writefn = raw_write |
98 | }, | ||
99 | { .name = dbgbcr_el1_name, .state = ARM_CP_STATE_BOTH, | ||
100 | .cp = 14, .opc0 = 2, .opc1 = 0, .crn = 0, .crm = i, .opc2 = 5, | ||
101 | .access = PL1_RW, .accessfn = access_tda, | ||
102 | + .fgt = FGT_DBGBCRN_EL1, | ||
103 | .fieldoffset = offsetof(CPUARMState, cp15.dbgbcr[i]), | ||
104 | .writefn = dbgbcr_write, .raw_writefn = raw_write | ||
105 | }, | ||
106 | @@ -XXX,XX +XXX,XX @@ void define_debug_regs(ARMCPU *cpu) | ||
107 | { .name = dbgwvr_el1_name, .state = ARM_CP_STATE_BOTH, | ||
108 | .cp = 14, .opc0 = 2, .opc1 = 0, .crn = 0, .crm = i, .opc2 = 6, | ||
109 | .access = PL1_RW, .accessfn = access_tda, | ||
110 | + .fgt = FGT_DBGWVRN_EL1, | ||
111 | .fieldoffset = offsetof(CPUARMState, cp15.dbgwvr[i]), | ||
112 | .writefn = dbgwvr_write, .raw_writefn = raw_write | ||
113 | }, | ||
114 | { .name = dbgwcr_el1_name, .state = ARM_CP_STATE_BOTH, | ||
115 | .cp = 14, .opc0 = 2, .opc1 = 0, .crn = 0, .crm = i, .opc2 = 7, | ||
116 | .access = PL1_RW, .accessfn = access_tda, | ||
117 | + .fgt = FGT_DBGWCRN_EL1, | ||
118 | .fieldoffset = offsetof(CPUARMState, cp15.dbgwcr[i]), | ||
119 | .writefn = dbgwcr_write, .raw_writefn = raw_write | ||
120 | }, | ||
84 | -- | 121 | -- |
85 | 2.20.1 | 122 | 2.34.1 |
86 | |||
87 | diff view generated by jsdifflib |
1 | Convert the VCADD (vector) insns to decodetree. | 1 | Mark up the sysreg definitions for the registers trapped |
---|---|---|---|
2 | by HDFGRTR/HDFGWTR bits 12..x. | ||
3 | |||
4 | Bits 12..22 and bit 58 are for PMU registers. | ||
5 | |||
6 | The remaining bits in HDFGRTR/HDFGWTR are for traps on | ||
7 | registers that are part of features we don't implement: | ||
8 | |||
9 | Bits 23..32 and 63 : FEAT_SPE | ||
10 | Bits 33..48 : FEAT_ETE | ||
11 | Bits 50..56 : FEAT_TRBE | ||
12 | Bits 59..61 : FEAT_BRBE | ||
13 | Bit 62 : FEAT_SPEv1p2. | ||
2 | 14 | ||
3 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 15 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
4 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 16 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
5 | Message-id: 20200430181003.21682-6-peter.maydell@linaro.org | 17 | Tested-by: Fuad Tabba <tabba@google.com> |
18 | Message-id: 20230130182459.3309057-16-peter.maydell@linaro.org | ||
19 | Message-id: 20230127175507.2895013-16-peter.maydell@linaro.org | ||
6 | --- | 20 | --- |
7 | target/arm/neon-shared.decode | 3 +++ | 21 | target/arm/cpregs.h | 12 ++++++++++++ |
8 | target/arm/translate-neon.inc.c | 37 +++++++++++++++++++++++++++++++++ | 22 | target/arm/helper.c | 37 +++++++++++++++++++++++++++++++++++++ |
9 | target/arm/translate.c | 11 +--------- | 23 | 2 files changed, 49 insertions(+) |
10 | 3 files changed, 41 insertions(+), 10 deletions(-) | 24 | |
11 | 25 | diff --git a/target/arm/cpregs.h b/target/arm/cpregs.h | |
12 | diff --git a/target/arm/neon-shared.decode b/target/arm/neon-shared.decode | ||
13 | index XXXXXXX..XXXXXXX 100644 | 26 | index XXXXXXX..XXXXXXX 100644 |
14 | --- a/target/arm/neon-shared.decode | 27 | --- a/target/arm/cpregs.h |
15 | +++ b/target/arm/neon-shared.decode | 28 | +++ b/target/arm/cpregs.h |
16 | @@ -XXX,XX +XXX,XX @@ | 29 | @@ -XXX,XX +XXX,XX @@ typedef enum FGTBit { |
17 | 30 | DO_BIT(HDFGRTR, OSLSR_EL1), | |
18 | VCMLA 1111 110 rot:2 . 1 size:1 .... .... 1000 . q:1 . 0 .... \ | 31 | DO_BIT(HDFGRTR, OSECCR_EL1), |
19 | vm=%vm_dp vn=%vn_dp vd=%vd_dp | 32 | DO_BIT(HDFGRTR, OSDLR_EL1), |
20 | + | 33 | + DO_BIT(HDFGRTR, PMEVCNTRN_EL0), |
21 | +VCADD 1111 110 rot:1 1 . 0 size:1 .... .... 1000 . q:1 . 0 .... \ | 34 | + DO_BIT(HDFGRTR, PMEVTYPERN_EL0), |
22 | + vm=%vm_dp vn=%vn_dp vd=%vd_dp | 35 | + DO_BIT(HDFGRTR, PMCCFILTR_EL0), |
23 | diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c | 36 | + DO_BIT(HDFGRTR, PMCCNTR_EL0), |
37 | + DO_BIT(HDFGRTR, PMCNTEN), | ||
38 | + DO_BIT(HDFGRTR, PMINTEN), | ||
39 | + DO_BIT(HDFGRTR, PMOVS), | ||
40 | + DO_BIT(HDFGRTR, PMSELR_EL0), | ||
41 | + DO_BIT(HDFGWTR, PMSWINC_EL0), | ||
42 | + DO_BIT(HDFGWTR, PMCR_EL0), | ||
43 | + DO_BIT(HDFGRTR, PMMIR_EL1), | ||
44 | + DO_BIT(HDFGRTR, PMCEIDN_EL0), | ||
45 | } FGTBit; | ||
46 | |||
47 | #undef DO_BIT | ||
48 | diff --git a/target/arm/helper.c b/target/arm/helper.c | ||
24 | index XXXXXXX..XXXXXXX 100644 | 49 | index XXXXXXX..XXXXXXX 100644 |
25 | --- a/target/arm/translate-neon.inc.c | 50 | --- a/target/arm/helper.c |
26 | +++ b/target/arm/translate-neon.inc.c | 51 | +++ b/target/arm/helper.c |
27 | @@ -XXX,XX +XXX,XX @@ static bool trans_VCMLA(DisasContext *s, arg_VCMLA *a) | 52 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v7_cp_reginfo[] = { |
28 | tcg_temp_free_ptr(fpst); | 53 | .fieldoffset = offsetoflow32(CPUARMState, cp15.c9_pmcnten), |
29 | return true; | 54 | .writefn = pmcntenset_write, |
30 | } | 55 | .accessfn = pmreg_access, |
31 | + | 56 | + .fgt = FGT_PMCNTEN, |
32 | +static bool trans_VCADD(DisasContext *s, arg_VCADD *a) | 57 | .raw_writefn = raw_write }, |
33 | +{ | 58 | { .name = "PMCNTENSET_EL0", .state = ARM_CP_STATE_AA64, .type = ARM_CP_IO, |
34 | + int opr_sz; | 59 | .opc0 = 3, .opc1 = 3, .crn = 9, .crm = 12, .opc2 = 1, |
35 | + TCGv_ptr fpst; | 60 | .access = PL0_RW, .accessfn = pmreg_access, |
36 | + gen_helper_gvec_3_ptr *fn_gvec_ptr; | 61 | + .fgt = FGT_PMCNTEN, |
37 | + | 62 | .fieldoffset = offsetof(CPUARMState, cp15.c9_pmcnten), .resetvalue = 0, |
38 | + if (!dc_isar_feature(aa32_vcma, s) | 63 | .writefn = pmcntenset_write, .raw_writefn = raw_write }, |
39 | + || (!a->size && !dc_isar_feature(aa32_fp16_arith, s))) { | 64 | { .name = "PMCNTENCLR", .cp = 15, .crn = 9, .crm = 12, .opc1 = 0, .opc2 = 2, |
40 | + return false; | 65 | .access = PL0_RW, |
41 | + } | 66 | .fieldoffset = offsetoflow32(CPUARMState, cp15.c9_pmcnten), |
42 | + | 67 | .accessfn = pmreg_access, |
43 | + /* UNDEF accesses to D16-D31 if they don't exist. */ | 68 | + .fgt = FGT_PMCNTEN, |
44 | + if (!dc_isar_feature(aa32_simd_r32, s) && | 69 | .writefn = pmcntenclr_write, |
45 | + ((a->vd | a->vn | a->vm) & 0x10)) { | 70 | .type = ARM_CP_ALIAS | ARM_CP_IO }, |
46 | + return false; | 71 | { .name = "PMCNTENCLR_EL0", .state = ARM_CP_STATE_AA64, |
47 | + } | 72 | .opc0 = 3, .opc1 = 3, .crn = 9, .crm = 12, .opc2 = 2, |
48 | + | 73 | .access = PL0_RW, .accessfn = pmreg_access, |
49 | + if ((a->vn | a->vm | a->vd) & a->q) { | 74 | + .fgt = FGT_PMCNTEN, |
50 | + return false; | 75 | .type = ARM_CP_ALIAS | ARM_CP_IO, |
51 | + } | 76 | .fieldoffset = offsetof(CPUARMState, cp15.c9_pmcnten), |
52 | + | 77 | .writefn = pmcntenclr_write }, |
53 | + if (!vfp_access_check(s)) { | 78 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v7_cp_reginfo[] = { |
54 | + return true; | 79 | .access = PL0_RW, .type = ARM_CP_IO, |
55 | + } | 80 | .fieldoffset = offsetoflow32(CPUARMState, cp15.c9_pmovsr), |
56 | + | 81 | .accessfn = pmreg_access, |
57 | + opr_sz = (1 + a->q) * 8; | 82 | + .fgt = FGT_PMOVS, |
58 | + fpst = get_fpstatus_ptr(1); | 83 | .writefn = pmovsr_write, |
59 | + fn_gvec_ptr = a->size ? gen_helper_gvec_fcadds : gen_helper_gvec_fcaddh; | 84 | .raw_writefn = raw_write }, |
60 | + tcg_gen_gvec_3_ptr(vfp_reg_offset(1, a->vd), | 85 | { .name = "PMOVSCLR_EL0", .state = ARM_CP_STATE_AA64, |
61 | + vfp_reg_offset(1, a->vn), | 86 | .opc0 = 3, .opc1 = 3, .crn = 9, .crm = 12, .opc2 = 3, |
62 | + vfp_reg_offset(1, a->vm), | 87 | .access = PL0_RW, .accessfn = pmreg_access, |
63 | + fpst, opr_sz, opr_sz, a->rot, | 88 | + .fgt = FGT_PMOVS, |
64 | + fn_gvec_ptr); | 89 | .type = ARM_CP_ALIAS | ARM_CP_IO, |
65 | + tcg_temp_free_ptr(fpst); | 90 | .fieldoffset = offsetof(CPUARMState, cp15.c9_pmovsr), |
66 | + return true; | 91 | .writefn = pmovsr_write, |
67 | +} | 92 | .raw_writefn = raw_write }, |
68 | diff --git a/target/arm/translate.c b/target/arm/translate.c | 93 | { .name = "PMSWINC", .cp = 15, .crn = 9, .crm = 12, .opc1 = 0, .opc2 = 4, |
69 | index XXXXXXX..XXXXXXX 100644 | 94 | .access = PL0_W, .accessfn = pmreg_access_swinc, |
70 | --- a/target/arm/translate.c | 95 | + .fgt = FGT_PMSWINC_EL0, |
71 | +++ b/target/arm/translate.c | 96 | .type = ARM_CP_NO_RAW | ARM_CP_IO, |
72 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_insn_3same_ext(DisasContext *s, uint32_t insn) | 97 | .writefn = pmswinc_write }, |
73 | bool is_long = false, q = extract32(insn, 6, 1); | 98 | { .name = "PMSWINC_EL0", .state = ARM_CP_STATE_AA64, |
74 | bool ptr_is_env = false; | 99 | .opc0 = 3, .opc1 = 3, .crn = 9, .crm = 12, .opc2 = 4, |
75 | 100 | .access = PL0_W, .accessfn = pmreg_access_swinc, | |
76 | - if ((insn & 0xfea00f10) == 0xfc800800) { | 101 | + .fgt = FGT_PMSWINC_EL0, |
77 | - /* VCADD -- 1111 110R 1.0S .... .... 1000 ...0 .... */ | 102 | .type = ARM_CP_NO_RAW | ARM_CP_IO, |
78 | - int size = extract32(insn, 20, 1); | 103 | .writefn = pmswinc_write }, |
79 | - data = extract32(insn, 24, 1); /* rot */ | 104 | { .name = "PMSELR", .cp = 15, .crn = 9, .crm = 12, .opc1 = 0, .opc2 = 5, |
80 | - if (!dc_isar_feature(aa32_vcma, s) | 105 | .access = PL0_RW, .type = ARM_CP_ALIAS, |
81 | - || (!size && !dc_isar_feature(aa32_fp16_arith, s))) { | 106 | + .fgt = FGT_PMSELR_EL0, |
82 | - return 1; | 107 | .fieldoffset = offsetoflow32(CPUARMState, cp15.c9_pmselr), |
83 | - } | 108 | .accessfn = pmreg_access_selr, .writefn = pmselr_write, |
84 | - fn_gvec_ptr = size ? gen_helper_gvec_fcadds : gen_helper_gvec_fcaddh; | 109 | .raw_writefn = raw_write}, |
85 | - } else if ((insn & 0xfeb00f00) == 0xfc200d00) { | 110 | { .name = "PMSELR_EL0", .state = ARM_CP_STATE_AA64, |
86 | + if ((insn & 0xfeb00f00) == 0xfc200d00) { | 111 | .opc0 = 3, .opc1 = 3, .crn = 9, .crm = 12, .opc2 = 5, |
87 | /* V[US]DOT -- 1111 1100 0.10 .... .... 1101 .Q.U .... */ | 112 | .access = PL0_RW, .accessfn = pmreg_access_selr, |
88 | bool u = extract32(insn, 4, 1); | 113 | + .fgt = FGT_PMSELR_EL0, |
89 | if (!dc_isar_feature(aa32_dp, s)) { | 114 | .fieldoffset = offsetof(CPUARMState, cp15.c9_pmselr), |
115 | .writefn = pmselr_write, .raw_writefn = raw_write, }, | ||
116 | { .name = "PMCCNTR", .cp = 15, .crn = 9, .crm = 13, .opc1 = 0, .opc2 = 0, | ||
117 | .access = PL0_RW, .resetvalue = 0, .type = ARM_CP_ALIAS | ARM_CP_IO, | ||
118 | + .fgt = FGT_PMCCNTR_EL0, | ||
119 | .readfn = pmccntr_read, .writefn = pmccntr_write32, | ||
120 | .accessfn = pmreg_access_ccntr }, | ||
121 | { .name = "PMCCNTR_EL0", .state = ARM_CP_STATE_AA64, | ||
122 | .opc0 = 3, .opc1 = 3, .crn = 9, .crm = 13, .opc2 = 0, | ||
123 | .access = PL0_RW, .accessfn = pmreg_access_ccntr, | ||
124 | + .fgt = FGT_PMCCNTR_EL0, | ||
125 | .type = ARM_CP_IO, | ||
126 | .fieldoffset = offsetof(CPUARMState, cp15.c15_ccnt), | ||
127 | .readfn = pmccntr_read, .writefn = pmccntr_write, | ||
128 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v7_cp_reginfo[] = { | ||
129 | { .name = "PMCCFILTR", .cp = 15, .opc1 = 0, .crn = 14, .crm = 15, .opc2 = 7, | ||
130 | .writefn = pmccfiltr_write_a32, .readfn = pmccfiltr_read_a32, | ||
131 | .access = PL0_RW, .accessfn = pmreg_access, | ||
132 | + .fgt = FGT_PMCCFILTR_EL0, | ||
133 | .type = ARM_CP_ALIAS | ARM_CP_IO, | ||
134 | .resetvalue = 0, }, | ||
135 | { .name = "PMCCFILTR_EL0", .state = ARM_CP_STATE_AA64, | ||
136 | .opc0 = 3, .opc1 = 3, .crn = 14, .crm = 15, .opc2 = 7, | ||
137 | .writefn = pmccfiltr_write, .raw_writefn = raw_write, | ||
138 | .access = PL0_RW, .accessfn = pmreg_access, | ||
139 | + .fgt = FGT_PMCCFILTR_EL0, | ||
140 | .type = ARM_CP_IO, | ||
141 | .fieldoffset = offsetof(CPUARMState, cp15.pmccfiltr_el0), | ||
142 | .resetvalue = 0, }, | ||
143 | { .name = "PMXEVTYPER", .cp = 15, .crn = 9, .crm = 13, .opc1 = 0, .opc2 = 1, | ||
144 | .access = PL0_RW, .type = ARM_CP_NO_RAW | ARM_CP_IO, | ||
145 | .accessfn = pmreg_access, | ||
146 | + .fgt = FGT_PMEVTYPERN_EL0, | ||
147 | .writefn = pmxevtyper_write, .readfn = pmxevtyper_read }, | ||
148 | { .name = "PMXEVTYPER_EL0", .state = ARM_CP_STATE_AA64, | ||
149 | .opc0 = 3, .opc1 = 3, .crn = 9, .crm = 13, .opc2 = 1, | ||
150 | .access = PL0_RW, .type = ARM_CP_NO_RAW | ARM_CP_IO, | ||
151 | .accessfn = pmreg_access, | ||
152 | + .fgt = FGT_PMEVTYPERN_EL0, | ||
153 | .writefn = pmxevtyper_write, .readfn = pmxevtyper_read }, | ||
154 | { .name = "PMXEVCNTR", .cp = 15, .crn = 9, .crm = 13, .opc1 = 0, .opc2 = 2, | ||
155 | .access = PL0_RW, .type = ARM_CP_NO_RAW | ARM_CP_IO, | ||
156 | .accessfn = pmreg_access_xevcntr, | ||
157 | + .fgt = FGT_PMEVCNTRN_EL0, | ||
158 | .writefn = pmxevcntr_write, .readfn = pmxevcntr_read }, | ||
159 | { .name = "PMXEVCNTR_EL0", .state = ARM_CP_STATE_AA64, | ||
160 | .opc0 = 3, .opc1 = 3, .crn = 9, .crm = 13, .opc2 = 2, | ||
161 | .access = PL0_RW, .type = ARM_CP_NO_RAW | ARM_CP_IO, | ||
162 | .accessfn = pmreg_access_xevcntr, | ||
163 | + .fgt = FGT_PMEVCNTRN_EL0, | ||
164 | .writefn = pmxevcntr_write, .readfn = pmxevcntr_read }, | ||
165 | { .name = "PMUSERENR", .cp = 15, .crn = 9, .crm = 14, .opc1 = 0, .opc2 = 0, | ||
166 | .access = PL0_R | PL1_RW, .accessfn = access_tpm, | ||
167 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v7_cp_reginfo[] = { | ||
168 | .writefn = pmuserenr_write, .raw_writefn = raw_write }, | ||
169 | { .name = "PMINTENSET", .cp = 15, .crn = 9, .crm = 14, .opc1 = 0, .opc2 = 1, | ||
170 | .access = PL1_RW, .accessfn = access_tpm, | ||
171 | + .fgt = FGT_PMINTEN, | ||
172 | .type = ARM_CP_ALIAS | ARM_CP_IO, | ||
173 | .fieldoffset = offsetoflow32(CPUARMState, cp15.c9_pminten), | ||
174 | .resetvalue = 0, | ||
175 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v7_cp_reginfo[] = { | ||
176 | { .name = "PMINTENSET_EL1", .state = ARM_CP_STATE_AA64, | ||
177 | .opc0 = 3, .opc1 = 0, .crn = 9, .crm = 14, .opc2 = 1, | ||
178 | .access = PL1_RW, .accessfn = access_tpm, | ||
179 | + .fgt = FGT_PMINTEN, | ||
180 | .type = ARM_CP_IO, | ||
181 | .fieldoffset = offsetof(CPUARMState, cp15.c9_pminten), | ||
182 | .writefn = pmintenset_write, .raw_writefn = raw_write, | ||
183 | .resetvalue = 0x0 }, | ||
184 | { .name = "PMINTENCLR", .cp = 15, .crn = 9, .crm = 14, .opc1 = 0, .opc2 = 2, | ||
185 | .access = PL1_RW, .accessfn = access_tpm, | ||
186 | + .fgt = FGT_PMINTEN, | ||
187 | .type = ARM_CP_ALIAS | ARM_CP_IO | ARM_CP_NO_RAW, | ||
188 | .fieldoffset = offsetof(CPUARMState, cp15.c9_pminten), | ||
189 | .writefn = pmintenclr_write, }, | ||
190 | { .name = "PMINTENCLR_EL1", .state = ARM_CP_STATE_AA64, | ||
191 | .opc0 = 3, .opc1 = 0, .crn = 9, .crm = 14, .opc2 = 2, | ||
192 | .access = PL1_RW, .accessfn = access_tpm, | ||
193 | + .fgt = FGT_PMINTEN, | ||
194 | .type = ARM_CP_ALIAS | ARM_CP_IO | ARM_CP_NO_RAW, | ||
195 | .fieldoffset = offsetof(CPUARMState, cp15.c9_pminten), | ||
196 | .writefn = pmintenclr_write }, | ||
197 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo pmovsset_cp_reginfo[] = { | ||
198 | /* PMOVSSET is not implemented in v7 before v7ve */ | ||
199 | { .name = "PMOVSSET", .cp = 15, .opc1 = 0, .crn = 9, .crm = 14, .opc2 = 3, | ||
200 | .access = PL0_RW, .accessfn = pmreg_access, | ||
201 | + .fgt = FGT_PMOVS, | ||
202 | .type = ARM_CP_ALIAS | ARM_CP_IO, | ||
203 | .fieldoffset = offsetoflow32(CPUARMState, cp15.c9_pmovsr), | ||
204 | .writefn = pmovsset_write, | ||
205 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo pmovsset_cp_reginfo[] = { | ||
206 | { .name = "PMOVSSET_EL0", .state = ARM_CP_STATE_AA64, | ||
207 | .opc0 = 3, .opc1 = 3, .crn = 9, .crm = 14, .opc2 = 3, | ||
208 | .access = PL0_RW, .accessfn = pmreg_access, | ||
209 | + .fgt = FGT_PMOVS, | ||
210 | .type = ARM_CP_ALIAS | ARM_CP_IO, | ||
211 | .fieldoffset = offsetof(CPUARMState, cp15.c9_pmovsr), | ||
212 | .writefn = pmovsset_write, | ||
213 | @@ -XXX,XX +XXX,XX @@ static void define_pmu_regs(ARMCPU *cpu) | ||
214 | ARMCPRegInfo pmcr = { | ||
215 | .name = "PMCR", .cp = 15, .crn = 9, .crm = 12, .opc1 = 0, .opc2 = 0, | ||
216 | .access = PL0_RW, | ||
217 | + .fgt = FGT_PMCR_EL0, | ||
218 | .type = ARM_CP_IO | ARM_CP_ALIAS, | ||
219 | .fieldoffset = offsetoflow32(CPUARMState, cp15.c9_pmcr), | ||
220 | .accessfn = pmreg_access, .writefn = pmcr_write, | ||
221 | @@ -XXX,XX +XXX,XX @@ static void define_pmu_regs(ARMCPU *cpu) | ||
222 | .name = "PMCR_EL0", .state = ARM_CP_STATE_AA64, | ||
223 | .opc0 = 3, .opc1 = 3, .crn = 9, .crm = 12, .opc2 = 0, | ||
224 | .access = PL0_RW, .accessfn = pmreg_access, | ||
225 | + .fgt = FGT_PMCR_EL0, | ||
226 | .type = ARM_CP_IO, | ||
227 | .fieldoffset = offsetof(CPUARMState, cp15.c9_pmcr), | ||
228 | .resetvalue = cpu->isar.reset_pmcr_el0, | ||
229 | @@ -XXX,XX +XXX,XX @@ static void define_pmu_regs(ARMCPU *cpu) | ||
230 | { .name = pmevcntr_name, .cp = 15, .crn = 14, | ||
231 | .crm = 8 | (3 & (i >> 3)), .opc1 = 0, .opc2 = i & 7, | ||
232 | .access = PL0_RW, .type = ARM_CP_IO | ARM_CP_ALIAS, | ||
233 | + .fgt = FGT_PMEVCNTRN_EL0, | ||
234 | .readfn = pmevcntr_readfn, .writefn = pmevcntr_writefn, | ||
235 | .accessfn = pmreg_access_xevcntr }, | ||
236 | { .name = pmevcntr_el0_name, .state = ARM_CP_STATE_AA64, | ||
237 | .opc0 = 3, .opc1 = 3, .crn = 14, .crm = 8 | (3 & (i >> 3)), | ||
238 | .opc2 = i & 7, .access = PL0_RW, .accessfn = pmreg_access_xevcntr, | ||
239 | .type = ARM_CP_IO, | ||
240 | + .fgt = FGT_PMEVCNTRN_EL0, | ||
241 | .readfn = pmevcntr_readfn, .writefn = pmevcntr_writefn, | ||
242 | .raw_readfn = pmevcntr_rawread, | ||
243 | .raw_writefn = pmevcntr_rawwrite }, | ||
244 | { .name = pmevtyper_name, .cp = 15, .crn = 14, | ||
245 | .crm = 12 | (3 & (i >> 3)), .opc1 = 0, .opc2 = i & 7, | ||
246 | .access = PL0_RW, .type = ARM_CP_IO | ARM_CP_ALIAS, | ||
247 | + .fgt = FGT_PMEVTYPERN_EL0, | ||
248 | .readfn = pmevtyper_readfn, .writefn = pmevtyper_writefn, | ||
249 | .accessfn = pmreg_access }, | ||
250 | { .name = pmevtyper_el0_name, .state = ARM_CP_STATE_AA64, | ||
251 | .opc0 = 3, .opc1 = 3, .crn = 14, .crm = 12 | (3 & (i >> 3)), | ||
252 | .opc2 = i & 7, .access = PL0_RW, .accessfn = pmreg_access, | ||
253 | + .fgt = FGT_PMEVTYPERN_EL0, | ||
254 | .type = ARM_CP_IO, | ||
255 | .readfn = pmevtyper_readfn, .writefn = pmevtyper_writefn, | ||
256 | .raw_writefn = pmevtyper_rawwrite }, | ||
257 | @@ -XXX,XX +XXX,XX @@ static void define_pmu_regs(ARMCPU *cpu) | ||
258 | { .name = "PMCEID2", .state = ARM_CP_STATE_AA32, | ||
259 | .cp = 15, .opc1 = 0, .crn = 9, .crm = 14, .opc2 = 4, | ||
260 | .access = PL0_R, .accessfn = pmreg_access, .type = ARM_CP_CONST, | ||
261 | + .fgt = FGT_PMCEIDN_EL0, | ||
262 | .resetvalue = extract64(cpu->pmceid0, 32, 32) }, | ||
263 | { .name = "PMCEID3", .state = ARM_CP_STATE_AA32, | ||
264 | .cp = 15, .opc1 = 0, .crn = 9, .crm = 14, .opc2 = 5, | ||
265 | .access = PL0_R, .accessfn = pmreg_access, .type = ARM_CP_CONST, | ||
266 | + .fgt = FGT_PMCEIDN_EL0, | ||
267 | .resetvalue = extract64(cpu->pmceid1, 32, 32) }, | ||
268 | }; | ||
269 | define_arm_cp_regs(cpu, v81_pmu_regs); | ||
270 | @@ -XXX,XX +XXX,XX @@ static void define_pmu_regs(ARMCPU *cpu) | ||
271 | .name = "PMMIR_EL1", .state = ARM_CP_STATE_BOTH, | ||
272 | .opc0 = 3, .opc1 = 0, .crn = 9, .crm = 14, .opc2 = 6, | ||
273 | .access = PL1_R, .accessfn = pmreg_access, .type = ARM_CP_CONST, | ||
274 | + .fgt = FGT_PMMIR_EL1, | ||
275 | .resetvalue = 0 | ||
276 | }; | ||
277 | define_one_arm_cp_reg(cpu, &v84_pmmir); | ||
278 | @@ -XXX,XX +XXX,XX @@ void register_cp_regs_for_features(ARMCPU *cpu) | ||
279 | { .name = "PMCEID0", .state = ARM_CP_STATE_AA32, | ||
280 | .cp = 15, .opc1 = 0, .crn = 9, .crm = 12, .opc2 = 6, | ||
281 | .access = PL0_R, .accessfn = pmreg_access, .type = ARM_CP_CONST, | ||
282 | + .fgt = FGT_PMCEIDN_EL0, | ||
283 | .resetvalue = extract64(cpu->pmceid0, 0, 32) }, | ||
284 | { .name = "PMCEID0_EL0", .state = ARM_CP_STATE_AA64, | ||
285 | .opc0 = 3, .opc1 = 3, .crn = 9, .crm = 12, .opc2 = 6, | ||
286 | .access = PL0_R, .accessfn = pmreg_access, .type = ARM_CP_CONST, | ||
287 | + .fgt = FGT_PMCEIDN_EL0, | ||
288 | .resetvalue = cpu->pmceid0 }, | ||
289 | { .name = "PMCEID1", .state = ARM_CP_STATE_AA32, | ||
290 | .cp = 15, .opc1 = 0, .crn = 9, .crm = 12, .opc2 = 7, | ||
291 | .access = PL0_R, .accessfn = pmreg_access, .type = ARM_CP_CONST, | ||
292 | + .fgt = FGT_PMCEIDN_EL0, | ||
293 | .resetvalue = extract64(cpu->pmceid1, 0, 32) }, | ||
294 | { .name = "PMCEID1_EL0", .state = ARM_CP_STATE_AA64, | ||
295 | .opc0 = 3, .opc1 = 3, .crn = 9, .crm = 12, .opc2 = 7, | ||
296 | .access = PL0_R, .accessfn = pmreg_access, .type = ARM_CP_CONST, | ||
297 | + .fgt = FGT_PMCEIDN_EL0, | ||
298 | .resetvalue = cpu->pmceid1 }, | ||
299 | }; | ||
300 | #ifdef CONFIG_USER_ONLY | ||
90 | -- | 301 | -- |
91 | 2.20.1 | 302 | 2.34.1 |
92 | |||
93 | diff view generated by jsdifflib |
1 | Convert the VCMLA (vector) insns in the 3same extension group to | 1 | Mark up the sysreg definitions for the system instructions |
---|---|---|---|
2 | decodetree. | 2 | trapped by HFGITR bits 0..11. These bits cover various |
3 | cache maintenance operations. | ||
3 | 4 | ||
4 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 5 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
5 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 6 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
6 | Message-id: 20200430181003.21682-5-peter.maydell@linaro.org | 7 | Tested-by: Fuad Tabba <tabba@google.com> |
8 | Message-id: 20230130182459.3309057-17-peter.maydell@linaro.org | ||
9 | Message-id: 20230127175507.2895013-17-peter.maydell@linaro.org | ||
7 | --- | 10 | --- |
8 | target/arm/neon-shared.decode | 11 ++++++++++ | 11 | target/arm/cpregs.h | 14 ++++++++++++++ |
9 | target/arm/translate-neon.inc.c | 37 +++++++++++++++++++++++++++++++++ | 12 | target/arm/helper.c | 28 ++++++++++++++++++++++++++++ |
10 | target/arm/translate.c | 11 +--------- | 13 | 2 files changed, 42 insertions(+) |
11 | 3 files changed, 49 insertions(+), 10 deletions(-) | ||
12 | 14 | ||
13 | diff --git a/target/arm/neon-shared.decode b/target/arm/neon-shared.decode | 15 | diff --git a/target/arm/cpregs.h b/target/arm/cpregs.h |
14 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/target/arm/neon-shared.decode | 17 | --- a/target/arm/cpregs.h |
16 | +++ b/target/arm/neon-shared.decode | 18 | +++ b/target/arm/cpregs.h |
17 | @@ -XXX,XX +XXX,XX @@ | 19 | @@ -XXX,XX +XXX,XX @@ typedef enum FGTBit { |
18 | # More specifically, this covers: | 20 | DO_BIT(HDFGWTR, PMCR_EL0), |
19 | # 2reg scalar ext: 0b1111_1110_xxxx_xxxx_xxxx_1x0x_xxxx_xxxx | 21 | DO_BIT(HDFGRTR, PMMIR_EL1), |
20 | # 3same ext: 0b1111_110x_xxxx_xxxx_xxxx_1x0x_xxxx_xxxx | 22 | DO_BIT(HDFGRTR, PMCEIDN_EL0), |
21 | + | 23 | + |
22 | +# VFP/Neon register fields; same as vfp.decode | 24 | + /* Trap bits in HFGITR_EL2, starting from bit 0 */ |
23 | +%vm_dp 5:1 0:4 | 25 | + DO_BIT(HFGITR, ICIALLUIS), |
24 | +%vm_sp 0:4 5:1 | 26 | + DO_BIT(HFGITR, ICIALLU), |
25 | +%vn_dp 7:1 16:4 | 27 | + DO_BIT(HFGITR, ICIVAU), |
26 | +%vn_sp 16:4 7:1 | 28 | + DO_BIT(HFGITR, DCIVAC), |
27 | +%vd_dp 22:1 12:4 | 29 | + DO_BIT(HFGITR, DCISW), |
28 | +%vd_sp 12:4 22:1 | 30 | + DO_BIT(HFGITR, DCCSW), |
29 | + | 31 | + DO_BIT(HFGITR, DCCISW), |
30 | +VCMLA 1111 110 rot:2 . 1 size:1 .... .... 1000 . q:1 . 0 .... \ | 32 | + DO_BIT(HFGITR, DCCVAU), |
31 | + vm=%vm_dp vn=%vn_dp vd=%vd_dp | 33 | + DO_BIT(HFGITR, DCCVAP), |
32 | diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c | 34 | + DO_BIT(HFGITR, DCCVADP), |
35 | + DO_BIT(HFGITR, DCCIVAC), | ||
36 | + DO_BIT(HFGITR, DCZVA), | ||
37 | } FGTBit; | ||
38 | |||
39 | #undef DO_BIT | ||
40 | diff --git a/target/arm/helper.c b/target/arm/helper.c | ||
33 | index XXXXXXX..XXXXXXX 100644 | 41 | index XXXXXXX..XXXXXXX 100644 |
34 | --- a/target/arm/translate-neon.inc.c | 42 | --- a/target/arm/helper.c |
35 | +++ b/target/arm/translate-neon.inc.c | 43 | +++ b/target/arm/helper.c |
36 | @@ -XXX,XX +XXX,XX @@ | 44 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v8_cp_reginfo[] = { |
37 | #include "decode-neon-dp.inc.c" | 45 | #ifndef CONFIG_USER_ONLY |
38 | #include "decode-neon-ls.inc.c" | 46 | /* Avoid overhead of an access check that always passes in user-mode */ |
39 | #include "decode-neon-shared.inc.c" | 47 | .accessfn = aa64_zva_access, |
40 | + | 48 | + .fgt = FGT_DCZVA, |
41 | +static bool trans_VCMLA(DisasContext *s, arg_VCMLA *a) | 49 | #endif |
42 | +{ | 50 | }, |
43 | + int opr_sz; | 51 | { .name = "CURRENTEL", .state = ARM_CP_STATE_AA64, |
44 | + TCGv_ptr fpst; | 52 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v8_cp_reginfo[] = { |
45 | + gen_helper_gvec_3_ptr *fn_gvec_ptr; | 53 | { .name = "IC_IALLUIS", .state = ARM_CP_STATE_AA64, |
46 | + | 54 | .opc0 = 1, .opc1 = 0, .crn = 7, .crm = 1, .opc2 = 0, |
47 | + if (!dc_isar_feature(aa32_vcma, s) | 55 | .access = PL1_W, .type = ARM_CP_NOP, |
48 | + || (!a->size && !dc_isar_feature(aa32_fp16_arith, s))) { | 56 | + .fgt = FGT_ICIALLUIS, |
49 | + return false; | 57 | .accessfn = access_ticab }, |
50 | + } | 58 | { .name = "IC_IALLU", .state = ARM_CP_STATE_AA64, |
51 | + | 59 | .opc0 = 1, .opc1 = 0, .crn = 7, .crm = 5, .opc2 = 0, |
52 | + /* UNDEF accesses to D16-D31 if they don't exist. */ | 60 | .access = PL1_W, .type = ARM_CP_NOP, |
53 | + if (!dc_isar_feature(aa32_simd_r32, s) && | 61 | + .fgt = FGT_ICIALLU, |
54 | + ((a->vd | a->vn | a->vm) & 0x10)) { | 62 | .accessfn = access_tocu }, |
55 | + return false; | 63 | { .name = "IC_IVAU", .state = ARM_CP_STATE_AA64, |
56 | + } | 64 | .opc0 = 1, .opc1 = 3, .crn = 7, .crm = 5, .opc2 = 1, |
57 | + | 65 | .access = PL0_W, .type = ARM_CP_NOP, |
58 | + if ((a->vn | a->vm | a->vd) & a->q) { | 66 | + .fgt = FGT_ICIVAU, |
59 | + return false; | 67 | .accessfn = access_tocu }, |
60 | + } | 68 | { .name = "DC_IVAC", .state = ARM_CP_STATE_AA64, |
61 | + | 69 | .opc0 = 1, .opc1 = 0, .crn = 7, .crm = 6, .opc2 = 1, |
62 | + if (!vfp_access_check(s)) { | 70 | .access = PL1_W, .accessfn = aa64_cacheop_poc_access, |
63 | + return true; | 71 | + .fgt = FGT_DCIVAC, |
64 | + } | 72 | .type = ARM_CP_NOP }, |
65 | + | 73 | { .name = "DC_ISW", .state = ARM_CP_STATE_AA64, |
66 | + opr_sz = (1 + a->q) * 8; | 74 | .opc0 = 1, .opc1 = 0, .crn = 7, .crm = 6, .opc2 = 2, |
67 | + fpst = get_fpstatus_ptr(1); | 75 | + .fgt = FGT_DCISW, |
68 | + fn_gvec_ptr = a->size ? gen_helper_gvec_fcmlas : gen_helper_gvec_fcmlah; | 76 | .access = PL1_W, .accessfn = access_tsw, .type = ARM_CP_NOP }, |
69 | + tcg_gen_gvec_3_ptr(vfp_reg_offset(1, a->vd), | 77 | { .name = "DC_CVAC", .state = ARM_CP_STATE_AA64, |
70 | + vfp_reg_offset(1, a->vn), | 78 | .opc0 = 1, .opc1 = 3, .crn = 7, .crm = 10, .opc2 = 1, |
71 | + vfp_reg_offset(1, a->vm), | 79 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v8_cp_reginfo[] = { |
72 | + fpst, opr_sz, opr_sz, a->rot, | 80 | .accessfn = aa64_cacheop_poc_access }, |
73 | + fn_gvec_ptr); | 81 | { .name = "DC_CSW", .state = ARM_CP_STATE_AA64, |
74 | + tcg_temp_free_ptr(fpst); | 82 | .opc0 = 1, .opc1 = 0, .crn = 7, .crm = 10, .opc2 = 2, |
75 | + return true; | 83 | + .fgt = FGT_DCCSW, |
76 | +} | 84 | .access = PL1_W, .accessfn = access_tsw, .type = ARM_CP_NOP }, |
77 | diff --git a/target/arm/translate.c b/target/arm/translate.c | 85 | { .name = "DC_CVAU", .state = ARM_CP_STATE_AA64, |
78 | index XXXXXXX..XXXXXXX 100644 | 86 | .opc0 = 1, .opc1 = 3, .crn = 7, .crm = 11, .opc2 = 1, |
79 | --- a/target/arm/translate.c | 87 | .access = PL0_W, .type = ARM_CP_NOP, |
80 | +++ b/target/arm/translate.c | 88 | + .fgt = FGT_DCCVAU, |
81 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_insn_3same_ext(DisasContext *s, uint32_t insn) | 89 | .accessfn = access_tocu }, |
82 | bool is_long = false, q = extract32(insn, 6, 1); | 90 | { .name = "DC_CIVAC", .state = ARM_CP_STATE_AA64, |
83 | bool ptr_is_env = false; | 91 | .opc0 = 1, .opc1 = 3, .crn = 7, .crm = 14, .opc2 = 1, |
84 | 92 | .access = PL0_W, .type = ARM_CP_NOP, | |
85 | - if ((insn & 0xfe200f10) == 0xfc200800) { | 93 | + .fgt = FGT_DCCIVAC, |
86 | - /* VCMLA -- 1111 110R R.1S .... .... 1000 ...0 .... */ | 94 | .accessfn = aa64_cacheop_poc_access }, |
87 | - int size = extract32(insn, 20, 1); | 95 | { .name = "DC_CISW", .state = ARM_CP_STATE_AA64, |
88 | - data = extract32(insn, 23, 2); /* rot */ | 96 | .opc0 = 1, .opc1 = 0, .crn = 7, .crm = 14, .opc2 = 2, |
89 | - if (!dc_isar_feature(aa32_vcma, s) | 97 | + .fgt = FGT_DCCISW, |
90 | - || (!size && !dc_isar_feature(aa32_fp16_arith, s))) { | 98 | .access = PL1_W, .accessfn = access_tsw, .type = ARM_CP_NOP }, |
91 | - return 1; | 99 | /* TLBI operations */ |
92 | - } | 100 | { .name = "TLBI_VMALLE1IS", .state = ARM_CP_STATE_AA64, |
93 | - fn_gvec_ptr = size ? gen_helper_gvec_fcmlas : gen_helper_gvec_fcmlah; | 101 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo dcpop_reg[] = { |
94 | - } else if ((insn & 0xfea00f10) == 0xfc800800) { | 102 | { .name = "DC_CVAP", .state = ARM_CP_STATE_AA64, |
95 | + if ((insn & 0xfea00f10) == 0xfc800800) { | 103 | .opc0 = 1, .opc1 = 3, .crn = 7, .crm = 12, .opc2 = 1, |
96 | /* VCADD -- 1111 110R 1.0S .... .... 1000 ...0 .... */ | 104 | .access = PL0_W, .type = ARM_CP_NO_RAW | ARM_CP_SUPPRESS_TB_END, |
97 | int size = extract32(insn, 20, 1); | 105 | + .fgt = FGT_DCCVAP, |
98 | data = extract32(insn, 24, 1); /* rot */ | 106 | .accessfn = aa64_cacheop_poc_access, .writefn = dccvap_writefn }, |
107 | }; | ||
108 | |||
109 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo dcpodp_reg[] = { | ||
110 | { .name = "DC_CVADP", .state = ARM_CP_STATE_AA64, | ||
111 | .opc0 = 1, .opc1 = 3, .crn = 7, .crm = 13, .opc2 = 1, | ||
112 | .access = PL0_W, .type = ARM_CP_NO_RAW | ARM_CP_SUPPRESS_TB_END, | ||
113 | + .fgt = FGT_DCCVADP, | ||
114 | .accessfn = aa64_cacheop_poc_access, .writefn = dccvap_writefn }, | ||
115 | }; | ||
116 | #endif /*CONFIG_USER_ONLY*/ | ||
117 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo mte_reginfo[] = { | ||
118 | { .name = "DC_IGVAC", .state = ARM_CP_STATE_AA64, | ||
119 | .opc0 = 1, .opc1 = 0, .crn = 7, .crm = 6, .opc2 = 3, | ||
120 | .type = ARM_CP_NOP, .access = PL1_W, | ||
121 | + .fgt = FGT_DCIVAC, | ||
122 | .accessfn = aa64_cacheop_poc_access }, | ||
123 | { .name = "DC_IGSW", .state = ARM_CP_STATE_AA64, | ||
124 | .opc0 = 1, .opc1 = 0, .crn = 7, .crm = 6, .opc2 = 4, | ||
125 | + .fgt = FGT_DCISW, | ||
126 | .type = ARM_CP_NOP, .access = PL1_W, .accessfn = access_tsw }, | ||
127 | { .name = "DC_IGDVAC", .state = ARM_CP_STATE_AA64, | ||
128 | .opc0 = 1, .opc1 = 0, .crn = 7, .crm = 6, .opc2 = 5, | ||
129 | .type = ARM_CP_NOP, .access = PL1_W, | ||
130 | + .fgt = FGT_DCIVAC, | ||
131 | .accessfn = aa64_cacheop_poc_access }, | ||
132 | { .name = "DC_IGDSW", .state = ARM_CP_STATE_AA64, | ||
133 | .opc0 = 1, .opc1 = 0, .crn = 7, .crm = 6, .opc2 = 6, | ||
134 | + .fgt = FGT_DCISW, | ||
135 | .type = ARM_CP_NOP, .access = PL1_W, .accessfn = access_tsw }, | ||
136 | { .name = "DC_CGSW", .state = ARM_CP_STATE_AA64, | ||
137 | .opc0 = 1, .opc1 = 0, .crn = 7, .crm = 10, .opc2 = 4, | ||
138 | + .fgt = FGT_DCCSW, | ||
139 | .type = ARM_CP_NOP, .access = PL1_W, .accessfn = access_tsw }, | ||
140 | { .name = "DC_CGDSW", .state = ARM_CP_STATE_AA64, | ||
141 | .opc0 = 1, .opc1 = 0, .crn = 7, .crm = 10, .opc2 = 6, | ||
142 | + .fgt = FGT_DCCSW, | ||
143 | .type = ARM_CP_NOP, .access = PL1_W, .accessfn = access_tsw }, | ||
144 | { .name = "DC_CIGSW", .state = ARM_CP_STATE_AA64, | ||
145 | .opc0 = 1, .opc1 = 0, .crn = 7, .crm = 14, .opc2 = 4, | ||
146 | + .fgt = FGT_DCCISW, | ||
147 | .type = ARM_CP_NOP, .access = PL1_W, .accessfn = access_tsw }, | ||
148 | { .name = "DC_CIGDSW", .state = ARM_CP_STATE_AA64, | ||
149 | .opc0 = 1, .opc1 = 0, .crn = 7, .crm = 14, .opc2 = 6, | ||
150 | + .fgt = FGT_DCCISW, | ||
151 | .type = ARM_CP_NOP, .access = PL1_W, .accessfn = access_tsw }, | ||
152 | }; | ||
153 | |||
154 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo mte_el0_cacheop_reginfo[] = { | ||
155 | { .name = "DC_CGVAP", .state = ARM_CP_STATE_AA64, | ||
156 | .opc0 = 1, .opc1 = 3, .crn = 7, .crm = 12, .opc2 = 3, | ||
157 | .type = ARM_CP_NOP, .access = PL0_W, | ||
158 | + .fgt = FGT_DCCVAP, | ||
159 | .accessfn = aa64_cacheop_poc_access }, | ||
160 | { .name = "DC_CGDVAP", .state = ARM_CP_STATE_AA64, | ||
161 | .opc0 = 1, .opc1 = 3, .crn = 7, .crm = 12, .opc2 = 5, | ||
162 | .type = ARM_CP_NOP, .access = PL0_W, | ||
163 | + .fgt = FGT_DCCVAP, | ||
164 | .accessfn = aa64_cacheop_poc_access }, | ||
165 | { .name = "DC_CGVADP", .state = ARM_CP_STATE_AA64, | ||
166 | .opc0 = 1, .opc1 = 3, .crn = 7, .crm = 13, .opc2 = 3, | ||
167 | .type = ARM_CP_NOP, .access = PL0_W, | ||
168 | + .fgt = FGT_DCCVADP, | ||
169 | .accessfn = aa64_cacheop_poc_access }, | ||
170 | { .name = "DC_CGDVADP", .state = ARM_CP_STATE_AA64, | ||
171 | .opc0 = 1, .opc1 = 3, .crn = 7, .crm = 13, .opc2 = 5, | ||
172 | .type = ARM_CP_NOP, .access = PL0_W, | ||
173 | + .fgt = FGT_DCCVADP, | ||
174 | .accessfn = aa64_cacheop_poc_access }, | ||
175 | { .name = "DC_CIGVAC", .state = ARM_CP_STATE_AA64, | ||
176 | .opc0 = 1, .opc1 = 3, .crn = 7, .crm = 14, .opc2 = 3, | ||
177 | .type = ARM_CP_NOP, .access = PL0_W, | ||
178 | + .fgt = FGT_DCCIVAC, | ||
179 | .accessfn = aa64_cacheop_poc_access }, | ||
180 | { .name = "DC_CIGDVAC", .state = ARM_CP_STATE_AA64, | ||
181 | .opc0 = 1, .opc1 = 3, .crn = 7, .crm = 14, .opc2 = 5, | ||
182 | .type = ARM_CP_NOP, .access = PL0_W, | ||
183 | + .fgt = FGT_DCCIVAC, | ||
184 | .accessfn = aa64_cacheop_poc_access }, | ||
185 | { .name = "DC_GVA", .state = ARM_CP_STATE_AA64, | ||
186 | .opc0 = 1, .opc1 = 3, .crn = 7, .crm = 4, .opc2 = 3, | ||
187 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo mte_el0_cacheop_reginfo[] = { | ||
188 | #ifndef CONFIG_USER_ONLY | ||
189 | /* Avoid overhead of an access check that always passes in user-mode */ | ||
190 | .accessfn = aa64_zva_access, | ||
191 | + .fgt = FGT_DCZVA, | ||
192 | #endif | ||
193 | }, | ||
194 | { .name = "DC_GZVA", .state = ARM_CP_STATE_AA64, | ||
195 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo mte_el0_cacheop_reginfo[] = { | ||
196 | #ifndef CONFIG_USER_ONLY | ||
197 | /* Avoid overhead of an access check that always passes in user-mode */ | ||
198 | .accessfn = aa64_zva_access, | ||
199 | + .fgt = FGT_DCZVA, | ||
200 | #endif | ||
201 | }, | ||
202 | }; | ||
99 | -- | 203 | -- |
100 | 2.20.1 | 204 | 2.34.1 |
101 | |||
102 | diff view generated by jsdifflib |
1 | Convert VCMLA (scalar) in the 2reg-scalar-ext group to decodetree. | 1 | Mark up the sysreg definitions for the system instructions |
---|---|---|---|
2 | trapped by HFGITR bits 12..17. These bits cover AT address | ||
3 | translation instructions. | ||
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 | Tested-by: Fuad Tabba <tabba@google.com> |
8 | Message-id: 20230130182459.3309057-18-peter.maydell@linaro.org | ||
9 | Message-id: 20230127175507.2895013-18-peter.maydell@linaro.org | ||
6 | --- | 10 | --- |
7 | target/arm/neon-shared.decode | 5 +++++ | 11 | target/arm/cpregs.h | 6 ++++++ |
8 | target/arm/translate-neon.inc.c | 40 +++++++++++++++++++++++++++++++++ | 12 | target/arm/helper.c | 6 ++++++ |
9 | target/arm/translate.c | 26 +-------------------- | 13 | 2 files changed, 12 insertions(+) |
10 | 3 files changed, 46 insertions(+), 25 deletions(-) | ||
11 | 14 | ||
12 | diff --git a/target/arm/neon-shared.decode b/target/arm/neon-shared.decode | 15 | diff --git a/target/arm/cpregs.h b/target/arm/cpregs.h |
13 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
14 | --- a/target/arm/neon-shared.decode | 17 | --- a/target/arm/cpregs.h |
15 | +++ b/target/arm/neon-shared.decode | 18 | +++ b/target/arm/cpregs.h |
16 | @@ -XXX,XX +XXX,XX @@ VFML 1111 110 0 s:1 . 10 .... .... 1000 . 0 . 1 .... \ | 19 | @@ -XXX,XX +XXX,XX @@ typedef enum FGTBit { |
17 | vm=%vm_sp vn=%vn_sp vd=%vd_dp q=0 | 20 | DO_BIT(HFGITR, DCCVADP), |
18 | VFML 1111 110 0 s:1 . 10 .... .... 1000 . 1 . 1 .... \ | 21 | DO_BIT(HFGITR, DCCIVAC), |
19 | vm=%vm_dp vn=%vn_dp vd=%vd_dp q=1 | 22 | DO_BIT(HFGITR, DCZVA), |
20 | + | 23 | + DO_BIT(HFGITR, ATS1E1R), |
21 | +VCMLA_scalar 1111 1110 0 . rot:2 .... .... 1000 . q:1 index:1 0 vm:4 \ | 24 | + DO_BIT(HFGITR, ATS1E1W), |
22 | + vn=%vn_dp vd=%vd_dp size=0 | 25 | + DO_BIT(HFGITR, ATS1E0R), |
23 | +VCMLA_scalar 1111 1110 1 . rot:2 .... .... 1000 . q:1 . 0 .... \ | 26 | + DO_BIT(HFGITR, ATS1E0W), |
24 | + vm=%vm_dp vn=%vn_dp vd=%vd_dp size=1 index=0 | 27 | + DO_BIT(HFGITR, ATS1E1RP), |
25 | diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c | 28 | + DO_BIT(HFGITR, ATS1E1WP), |
29 | } FGTBit; | ||
30 | |||
31 | #undef DO_BIT | ||
32 | diff --git a/target/arm/helper.c b/target/arm/helper.c | ||
26 | index XXXXXXX..XXXXXXX 100644 | 33 | index XXXXXXX..XXXXXXX 100644 |
27 | --- a/target/arm/translate-neon.inc.c | 34 | --- a/target/arm/helper.c |
28 | +++ b/target/arm/translate-neon.inc.c | 35 | +++ b/target/arm/helper.c |
29 | @@ -XXX,XX +XXX,XX @@ static bool trans_VFML(DisasContext *s, arg_VFML *a) | 36 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v8_cp_reginfo[] = { |
30 | gen_helper_gvec_fmlal_a32); | 37 | { .name = "AT_S1E1R", .state = ARM_CP_STATE_AA64, |
31 | return true; | 38 | .opc0 = 1, .opc1 = 0, .crn = 7, .crm = 8, .opc2 = 0, |
32 | } | 39 | .access = PL1_W, .type = ARM_CP_NO_RAW | ARM_CP_RAISES_EXC, |
33 | + | 40 | + .fgt = FGT_ATS1E1R, |
34 | +static bool trans_VCMLA_scalar(DisasContext *s, arg_VCMLA_scalar *a) | 41 | .writefn = ats_write64 }, |
35 | +{ | 42 | { .name = "AT_S1E1W", .state = ARM_CP_STATE_AA64, |
36 | + gen_helper_gvec_3_ptr *fn_gvec_ptr; | 43 | .opc0 = 1, .opc1 = 0, .crn = 7, .crm = 8, .opc2 = 1, |
37 | + int opr_sz; | 44 | .access = PL1_W, .type = ARM_CP_NO_RAW | ARM_CP_RAISES_EXC, |
38 | + TCGv_ptr fpst; | 45 | + .fgt = FGT_ATS1E1W, |
39 | + | 46 | .writefn = ats_write64 }, |
40 | + if (!dc_isar_feature(aa32_vcma, s)) { | 47 | { .name = "AT_S1E0R", .state = ARM_CP_STATE_AA64, |
41 | + return false; | 48 | .opc0 = 1, .opc1 = 0, .crn = 7, .crm = 8, .opc2 = 2, |
42 | + } | 49 | .access = PL1_W, .type = ARM_CP_NO_RAW | ARM_CP_RAISES_EXC, |
43 | + if (a->size == 0 && !dc_isar_feature(aa32_fp16_arith, s)) { | 50 | + .fgt = FGT_ATS1E0R, |
44 | + return false; | 51 | .writefn = ats_write64 }, |
45 | + } | 52 | { .name = "AT_S1E0W", .state = ARM_CP_STATE_AA64, |
46 | + | 53 | .opc0 = 1, .opc1 = 0, .crn = 7, .crm = 8, .opc2 = 3, |
47 | + /* UNDEF accesses to D16-D31 if they don't exist. */ | 54 | .access = PL1_W, .type = ARM_CP_NO_RAW | ARM_CP_RAISES_EXC, |
48 | + if (!dc_isar_feature(aa32_simd_r32, s) && | 55 | + .fgt = FGT_ATS1E0W, |
49 | + ((a->vd | a->vn | a->vm) & 0x10)) { | 56 | .writefn = ats_write64 }, |
50 | + return false; | 57 | { .name = "AT_S12E1R", .state = ARM_CP_STATE_AA64, |
51 | + } | 58 | .opc0 = 1, .opc1 = 4, .crn = 7, .crm = 8, .opc2 = 4, |
52 | + | 59 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo ats1e1_reginfo[] = { |
53 | + if ((a->vd | a->vn) & a->q) { | 60 | { .name = "AT_S1E1RP", .state = ARM_CP_STATE_AA64, |
54 | + return false; | 61 | .opc0 = 1, .opc1 = 0, .crn = 7, .crm = 9, .opc2 = 0, |
55 | + } | 62 | .access = PL1_W, .type = ARM_CP_NO_RAW | ARM_CP_RAISES_EXC, |
56 | + | 63 | + .fgt = FGT_ATS1E1RP, |
57 | + if (!vfp_access_check(s)) { | 64 | .writefn = ats_write64 }, |
58 | + return true; | 65 | { .name = "AT_S1E1WP", .state = ARM_CP_STATE_AA64, |
59 | + } | 66 | .opc0 = 1, .opc1 = 0, .crn = 7, .crm = 9, .opc2 = 1, |
60 | + | 67 | .access = PL1_W, .type = ARM_CP_NO_RAW | ARM_CP_RAISES_EXC, |
61 | + fn_gvec_ptr = (a->size ? gen_helper_gvec_fcmlas_idx | 68 | + .fgt = FGT_ATS1E1WP, |
62 | + : gen_helper_gvec_fcmlah_idx); | 69 | .writefn = ats_write64 }, |
63 | + opr_sz = (1 + a->q) * 8; | 70 | }; |
64 | + fpst = get_fpstatus_ptr(1); | ||
65 | + tcg_gen_gvec_3_ptr(vfp_reg_offset(1, a->vd), | ||
66 | + vfp_reg_offset(1, a->vn), | ||
67 | + vfp_reg_offset(1, a->vm), | ||
68 | + fpst, opr_sz, opr_sz, | ||
69 | + (a->index << 2) | a->rot, fn_gvec_ptr); | ||
70 | + tcg_temp_free_ptr(fpst); | ||
71 | + return true; | ||
72 | +} | ||
73 | diff --git a/target/arm/translate.c b/target/arm/translate.c | ||
74 | index XXXXXXX..XXXXXXX 100644 | ||
75 | --- a/target/arm/translate.c | ||
76 | +++ b/target/arm/translate.c | ||
77 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_insn_2reg_scalar_ext(DisasContext *s, uint32_t insn) | ||
78 | bool is_long = false, q = extract32(insn, 6, 1); | ||
79 | bool ptr_is_env = false; | ||
80 | |||
81 | - if ((insn & 0xff000f10) == 0xfe000800) { | ||
82 | - /* VCMLA (indexed) -- 1111 1110 S.RR .... .... 1000 ...0 .... */ | ||
83 | - int rot = extract32(insn, 20, 2); | ||
84 | - int size = extract32(insn, 23, 1); | ||
85 | - int index; | ||
86 | - | ||
87 | - if (!dc_isar_feature(aa32_vcma, s)) { | ||
88 | - return 1; | ||
89 | - } | ||
90 | - if (size == 0) { | ||
91 | - if (!dc_isar_feature(aa32_fp16_arith, s)) { | ||
92 | - return 1; | ||
93 | - } | ||
94 | - /* For fp16, rm is just Vm, and index is M. */ | ||
95 | - rm = extract32(insn, 0, 4); | ||
96 | - index = extract32(insn, 5, 1); | ||
97 | - } else { | ||
98 | - /* For fp32, rm is the usual M:Vm, and index is 0. */ | ||
99 | - VFP_DREG_M(rm, insn); | ||
100 | - index = 0; | ||
101 | - } | ||
102 | - data = (index << 2) | rot; | ||
103 | - fn_gvec_ptr = (size ? gen_helper_gvec_fcmlas_idx | ||
104 | - : gen_helper_gvec_fcmlah_idx); | ||
105 | - } else if ((insn & 0xffb00f00) == 0xfe200d00) { | ||
106 | + if ((insn & 0xffb00f00) == 0xfe200d00) { | ||
107 | /* V[US]DOT -- 1111 1110 0.10 .... .... 1101 .Q.U .... */ | ||
108 | int u = extract32(insn, 4, 1); | ||
109 | 71 | ||
110 | -- | 72 | -- |
111 | 2.20.1 | 73 | 2.34.1 |
112 | |||
113 | diff view generated by jsdifflib |
1 | We define ARMMMUIdx_Stage2 as being an MMU index which uses a QEMU | 1 | Mark up the sysreg definitions for the system instructions |
---|---|---|---|
2 | TLB. However we never actually use the TLB -- all stage 2 lookups | 2 | trapped by HFGITR bits 18..47. These bits cover TLBI |
3 | are done by direct calls to get_phys_addr_lpae() followed by a | 3 | TLB maintenance instructions. |
4 | physical address load via address_space_ld*(). | ||
5 | 4 | ||
6 | Remove Stage2 from the list of ARM MMU indexes which correspond to | 5 | (If we implemented FEAT_XS we would need to trap some of the |
7 | real core MMU indexes, and instead put it in the set of "NOTLB" ARM | 6 | instructions added by that feature using these bits; but we don't |
8 | MMU indexes. | 7 | yet, so will need to add the .fgt markup when we do.) |
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 | 8 | ||
24 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | 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> | 10 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
27 | Message-id: 20200330210400.11724-2-peter.maydell@linaro.org | 11 | Tested-by: Fuad Tabba <tabba@google.com> |
12 | Message-id: 20230130182459.3309057-19-peter.maydell@linaro.org | ||
13 | Message-id: 20230127175507.2895013-19-peter.maydell@linaro.org | ||
28 | --- | 14 | --- |
29 | target/arm/cpu-param.h | 2 +- | 15 | target/arm/cpregs.h | 30 ++++++++++++++++++++++++++++++ |
30 | target/arm/cpu.h | 21 +++++--- | 16 | target/arm/helper.c | 30 ++++++++++++++++++++++++++++++ |
31 | target/arm/helper.c | 112 ++++------------------------------------- | 17 | 2 files changed, 60 insertions(+) |
32 | 3 files changed, 27 insertions(+), 108 deletions(-) | ||
33 | 18 | ||
34 | diff --git a/target/arm/cpu-param.h b/target/arm/cpu-param.h | 19 | diff --git a/target/arm/cpregs.h b/target/arm/cpregs.h |
35 | index XXXXXXX..XXXXXXX 100644 | 20 | index XXXXXXX..XXXXXXX 100644 |
36 | --- a/target/arm/cpu-param.h | 21 | --- a/target/arm/cpregs.h |
37 | +++ b/target/arm/cpu-param.h | 22 | +++ b/target/arm/cpregs.h |
38 | @@ -XXX,XX +XXX,XX @@ | 23 | @@ -XXX,XX +XXX,XX @@ typedef enum FGTBit { |
39 | # define TARGET_PAGE_BITS_MIN 10 | 24 | DO_BIT(HFGITR, ATS1E0W), |
40 | #endif | 25 | DO_BIT(HFGITR, ATS1E1RP), |
41 | 26 | DO_BIT(HFGITR, ATS1E1WP), | |
42 | -#define NB_MMU_MODES 12 | 27 | + DO_BIT(HFGITR, TLBIVMALLE1OS), |
43 | +#define NB_MMU_MODES 11 | 28 | + DO_BIT(HFGITR, TLBIVAE1OS), |
44 | 29 | + DO_BIT(HFGITR, TLBIASIDE1OS), | |
45 | #endif | 30 | + DO_BIT(HFGITR, TLBIVAAE1OS), |
46 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h | 31 | + DO_BIT(HFGITR, TLBIVALE1OS), |
47 | index XXXXXXX..XXXXXXX 100644 | 32 | + DO_BIT(HFGITR, TLBIVAALE1OS), |
48 | --- a/target/arm/cpu.h | 33 | + DO_BIT(HFGITR, TLBIRVAE1OS), |
49 | +++ b/target/arm/cpu.h | 34 | + DO_BIT(HFGITR, TLBIRVAAE1OS), |
50 | @@ -XXX,XX +XXX,XX @@ bool write_cpustate_to_list(ARMCPU *cpu, bool kvm_sync); | 35 | + DO_BIT(HFGITR, TLBIRVALE1OS), |
51 | * handling via the TLB. The only way to do a stage 1 translation without | 36 | + DO_BIT(HFGITR, TLBIRVAALE1OS), |
52 | * the immediate stage 2 translation is via the ATS or AT system insns, | 37 | + DO_BIT(HFGITR, TLBIVMALLE1IS), |
53 | * which can be slow-pathed and always do a page table walk. | 38 | + DO_BIT(HFGITR, TLBIVAE1IS), |
54 | + * The only use of stage 2 translations is either as part of an s1+2 | 39 | + DO_BIT(HFGITR, TLBIASIDE1IS), |
55 | + * lookup or when loading the descriptors during a stage 1 page table walk, | 40 | + DO_BIT(HFGITR, TLBIVAAE1IS), |
56 | + * and in both those cases we don't use the TLB. | 41 | + DO_BIT(HFGITR, TLBIVALE1IS), |
57 | * 4. we can also safely fold together the "32 bit EL3" and "64 bit EL3" | 42 | + DO_BIT(HFGITR, TLBIVAALE1IS), |
58 | * translation regimes, because they map reasonably well to each other | 43 | + DO_BIT(HFGITR, TLBIRVAE1IS), |
59 | * and they can't both be active at the same time. | 44 | + DO_BIT(HFGITR, TLBIRVAAE1IS), |
60 | @@ -XXX,XX +XXX,XX @@ bool write_cpustate_to_list(ARMCPU *cpu, bool kvm_sync); | 45 | + DO_BIT(HFGITR, TLBIRVALE1IS), |
61 | * NS EL1 EL1&0 stage 1+2 (aka NS PL1) | 46 | + DO_BIT(HFGITR, TLBIRVAALE1IS), |
62 | * NS EL1 EL1&0 stage 1+2 +PAN | 47 | + DO_BIT(HFGITR, TLBIRVAE1), |
63 | * NS EL0 EL2&0 | 48 | + DO_BIT(HFGITR, TLBIRVAAE1), |
64 | + * NS EL2 EL2&0 | 49 | + DO_BIT(HFGITR, TLBIRVALE1), |
65 | * NS EL2 EL2&0 +PAN | 50 | + DO_BIT(HFGITR, TLBIRVAALE1), |
66 | * NS EL2 (aka NS PL2) | 51 | + DO_BIT(HFGITR, TLBIVMALLE1), |
67 | * S EL0 EL1&0 (aka S PL0) | 52 | + DO_BIT(HFGITR, TLBIVAE1), |
68 | * S EL1 EL1&0 (not used if EL3 is 32 bit) | 53 | + DO_BIT(HFGITR, TLBIASIDE1), |
69 | * S EL1 EL1&0 +PAN | 54 | + DO_BIT(HFGITR, TLBIVAAE1), |
70 | * S EL3 (aka S PL1) | 55 | + DO_BIT(HFGITR, TLBIVALE1), |
71 | - * NS EL1&0 stage 2 | 56 | + DO_BIT(HFGITR, TLBIVAALE1), |
72 | * | 57 | } FGTBit; |
73 | - * for a total of 12 different mmu_idx. | 58 | |
74 | + * for a total of 11 different mmu_idx. | 59 | #undef DO_BIT |
75 | * | ||
76 | * R profile CPUs have an MPU, but can use the same set of MMU indexes | ||
77 | * as A profile. They only need to distinguish NS EL0 and NS EL1 (and | ||
78 | @@ -XXX,XX +XXX,XX @@ bool write_cpustate_to_list(ARMCPU *cpu, bool kvm_sync); | ||
79 | * are not quite the same -- different CPU types (most notably M profile | ||
80 | * vs A/R profile) would like to use MMU indexes with different semantics, | ||
81 | * but since we don't ever need to use all of those in a single CPU we | ||
82 | - * can avoid setting NB_MMU_MODES to more than 8. The lower bits of | ||
83 | + * can avoid having to set NB_MMU_MODES to "total number of A profile MMU | ||
84 | + * modes + total number of M profile MMU modes". The lower bits of | ||
85 | * ARMMMUIdx are the core TLB mmu index, and the higher bits are always | ||
86 | * the same for any particular CPU. | ||
87 | * Variables of type ARMMUIdx are always full values, and the core | ||
88 | @@ -XXX,XX +XXX,XX @@ typedef enum ARMMMUIdx { | ||
89 | ARMMMUIdx_SE10_1_PAN = 9 | ARM_MMU_IDX_A, | ||
90 | ARMMMUIdx_SE3 = 10 | ARM_MMU_IDX_A, | ||
91 | |||
92 | - ARMMMUIdx_Stage2 = 11 | ARM_MMU_IDX_A, | ||
93 | - | ||
94 | /* | ||
95 | * These are not allocated TLBs and are used only for AT system | ||
96 | * instructions or for the first stage of an S12 page table walk. | ||
97 | @@ -XXX,XX +XXX,XX @@ typedef enum ARMMMUIdx { | ||
98 | ARMMMUIdx_Stage1_E0 = 0 | ARM_MMU_IDX_NOTLB, | ||
99 | ARMMMUIdx_Stage1_E1 = 1 | ARM_MMU_IDX_NOTLB, | ||
100 | ARMMMUIdx_Stage1_E1_PAN = 2 | ARM_MMU_IDX_NOTLB, | ||
101 | + /* | ||
102 | + * Not allocated a TLB: used only for second stage of an S12 page | ||
103 | + * table walk, or for descriptor loads during first stage of an S1 | ||
104 | + * page table walk. Note that if we ever want to have a TLB for this | ||
105 | + * then various TLB flush insns which currently are no-ops or flush | ||
106 | + * only stage 1 MMU indexes will need to change to flush stage 2. | ||
107 | + */ | ||
108 | + ARMMMUIdx_Stage2 = 3 | ARM_MMU_IDX_NOTLB, | ||
109 | |||
110 | /* | ||
111 | * M-profile. | ||
112 | @@ -XXX,XX +XXX,XX @@ typedef enum ARMMMUIdxBit { | ||
113 | TO_CORE_BIT(SE10_1), | ||
114 | TO_CORE_BIT(SE10_1_PAN), | ||
115 | TO_CORE_BIT(SE3), | ||
116 | - TO_CORE_BIT(Stage2), | ||
117 | |||
118 | TO_CORE_BIT(MUser), | ||
119 | TO_CORE_BIT(MPriv), | ||
120 | diff --git a/target/arm/helper.c b/target/arm/helper.c | 60 | diff --git a/target/arm/helper.c b/target/arm/helper.c |
121 | index XXXXXXX..XXXXXXX 100644 | 61 | index XXXXXXX..XXXXXXX 100644 |
122 | --- a/target/arm/helper.c | 62 | --- a/target/arm/helper.c |
123 | +++ b/target/arm/helper.c | 63 | +++ b/target/arm/helper.c |
124 | @@ -XXX,XX +XXX,XX @@ static void tlbiall_nsnh_write(CPUARMState *env, const ARMCPRegInfo *ri, | ||
125 | tlb_flush_by_mmuidx(cs, | ||
126 | ARMMMUIdxBit_E10_1 | | ||
127 | ARMMMUIdxBit_E10_1_PAN | | ||
128 | - ARMMMUIdxBit_E10_0 | | ||
129 | - ARMMMUIdxBit_Stage2); | ||
130 | + ARMMMUIdxBit_E10_0); | ||
131 | } | ||
132 | |||
133 | static void tlbiall_nsnh_is_write(CPUARMState *env, const ARMCPRegInfo *ri, | ||
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 | -{ | ||
146 | - /* Invalidate by IPA. This has to invalidate any structures that | ||
147 | - * contain only stage 2 translation information, but does not need | ||
148 | - * to apply to structures that contain combined stage 1 and stage 2 | ||
149 | - * translation information. | ||
150 | - * This must NOP if EL2 isn't implemented or SCR_EL3.NS is zero. | ||
151 | - */ | ||
152 | - CPUState *cs = env_cpu(env); | ||
153 | - uint64_t pageaddr; | ||
154 | - | ||
155 | - if (!arm_feature(env, ARM_FEATURE_EL2) || !(env->cp15.scr_el3 & SCR_NS)) { | ||
156 | - return; | ||
157 | - } | ||
158 | - | ||
159 | - pageaddr = sextract64(value << 12, 0, 40); | ||
160 | - | ||
161 | - tlb_flush_page_by_mmuidx(cs, pageaddr, ARMMMUIdxBit_Stage2); | ||
162 | -} | ||
163 | - | ||
164 | -static void tlbiipas2_is_write(CPUARMState *env, const ARMCPRegInfo *ri, | ||
165 | - uint64_t value) | ||
166 | -{ | ||
167 | - CPUState *cs = env_cpu(env); | ||
168 | - uint64_t pageaddr; | ||
169 | - | ||
170 | - if (!arm_feature(env, ARM_FEATURE_EL2) || !(env->cp15.scr_el3 & SCR_NS)) { | ||
171 | - return; | ||
172 | - } | ||
173 | - | ||
174 | - pageaddr = sextract64(value << 12, 0, 40); | ||
175 | - | ||
176 | - tlb_flush_page_by_mmuidx_all_cpus_synced(cs, pageaddr, | ||
177 | - ARMMMUIdxBit_Stage2); | ||
178 | -} | ||
179 | |||
180 | static void tlbiall_hyp_write(CPUARMState *env, const ARMCPRegInfo *ri, | ||
181 | uint64_t value) | ||
182 | @@ -XXX,XX +XXX,XX @@ static void vttbr_write(CPUARMState *env, const ARMCPRegInfo *ri, | ||
183 | tlb_flush_by_mmuidx(cs, | ||
184 | ARMMMUIdxBit_E10_1 | | ||
185 | ARMMMUIdxBit_E10_1_PAN | | ||
186 | - ARMMMUIdxBit_E10_0 | | ||
187 | - ARMMMUIdxBit_Stage2); | ||
188 | + ARMMMUIdxBit_E10_0); | ||
189 | raw_write(env, ri, value); | ||
190 | } | ||
191 | } | ||
192 | @@ -XXX,XX +XXX,XX @@ static int alle1_tlbmask(CPUARMState *env) | ||
193 | return ARMMMUIdxBit_SE10_1 | | ||
194 | ARMMMUIdxBit_SE10_1_PAN | | ||
195 | ARMMMUIdxBit_SE10_0; | ||
196 | - } else if (arm_feature(env, ARM_FEATURE_EL2)) { | ||
197 | - return ARMMMUIdxBit_E10_1 | | ||
198 | - ARMMMUIdxBit_E10_1_PAN | | ||
199 | - ARMMMUIdxBit_E10_0 | | ||
200 | - ARMMMUIdxBit_Stage2; | ||
201 | } else { | ||
202 | return ARMMMUIdxBit_E10_1 | | ||
203 | ARMMMUIdxBit_E10_1_PAN | | ||
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 | -} | ||
229 | - | ||
230 | -static void tlbi_aa64_ipas2e1is_write(CPUARMState *env, const ARMCPRegInfo *ri, | ||
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 | { | ||
249 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v8_cp_reginfo[] = { | 64 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v8_cp_reginfo[] = { |
65 | { .name = "TLBI_VMALLE1IS", .state = ARM_CP_STATE_AA64, | ||
66 | .opc0 = 1, .opc1 = 0, .crn = 8, .crm = 3, .opc2 = 0, | ||
67 | .access = PL1_W, .accessfn = access_ttlbis, .type = ARM_CP_NO_RAW, | ||
68 | + .fgt = FGT_TLBIVMALLE1IS, | ||
69 | .writefn = tlbi_aa64_vmalle1is_write }, | ||
70 | { .name = "TLBI_VAE1IS", .state = ARM_CP_STATE_AA64, | ||
71 | .opc0 = 1, .opc1 = 0, .crn = 8, .crm = 3, .opc2 = 1, | ||
72 | .access = PL1_W, .accessfn = access_ttlbis, .type = ARM_CP_NO_RAW, | ||
73 | + .fgt = FGT_TLBIVAE1IS, | ||
74 | .writefn = tlbi_aa64_vae1is_write }, | ||
75 | { .name = "TLBI_ASIDE1IS", .state = ARM_CP_STATE_AA64, | ||
76 | .opc0 = 1, .opc1 = 0, .crn = 8, .crm = 3, .opc2 = 2, | ||
77 | .access = PL1_W, .accessfn = access_ttlbis, .type = ARM_CP_NO_RAW, | ||
78 | + .fgt = FGT_TLBIASIDE1IS, | ||
79 | .writefn = tlbi_aa64_vmalle1is_write }, | ||
80 | { .name = "TLBI_VAAE1IS", .state = ARM_CP_STATE_AA64, | ||
81 | .opc0 = 1, .opc1 = 0, .crn = 8, .crm = 3, .opc2 = 3, | ||
82 | .access = PL1_W, .accessfn = access_ttlbis, .type = ARM_CP_NO_RAW, | ||
83 | + .fgt = FGT_TLBIVAAE1IS, | ||
84 | .writefn = tlbi_aa64_vae1is_write }, | ||
85 | { .name = "TLBI_VALE1IS", .state = ARM_CP_STATE_AA64, | ||
86 | .opc0 = 1, .opc1 = 0, .crn = 8, .crm = 3, .opc2 = 5, | ||
87 | .access = PL1_W, .accessfn = access_ttlbis, .type = ARM_CP_NO_RAW, | ||
88 | + .fgt = FGT_TLBIVALE1IS, | ||
89 | .writefn = tlbi_aa64_vae1is_write }, | ||
90 | { .name = "TLBI_VAALE1IS", .state = ARM_CP_STATE_AA64, | ||
91 | .opc0 = 1, .opc1 = 0, .crn = 8, .crm = 3, .opc2 = 7, | ||
92 | .access = PL1_W, .accessfn = access_ttlbis, .type = ARM_CP_NO_RAW, | ||
93 | + .fgt = FGT_TLBIVAALE1IS, | ||
94 | .writefn = tlbi_aa64_vae1is_write }, | ||
95 | { .name = "TLBI_VMALLE1", .state = ARM_CP_STATE_AA64, | ||
96 | .opc0 = 1, .opc1 = 0, .crn = 8, .crm = 7, .opc2 = 0, | ||
97 | .access = PL1_W, .accessfn = access_ttlb, .type = ARM_CP_NO_RAW, | ||
98 | + .fgt = FGT_TLBIVMALLE1, | ||
99 | .writefn = tlbi_aa64_vmalle1_write }, | ||
100 | { .name = "TLBI_VAE1", .state = ARM_CP_STATE_AA64, | ||
101 | .opc0 = 1, .opc1 = 0, .crn = 8, .crm = 7, .opc2 = 1, | ||
102 | .access = PL1_W, .accessfn = access_ttlb, .type = ARM_CP_NO_RAW, | ||
103 | + .fgt = FGT_TLBIVAE1, | ||
104 | .writefn = tlbi_aa64_vae1_write }, | ||
105 | { .name = "TLBI_ASIDE1", .state = ARM_CP_STATE_AA64, | ||
106 | .opc0 = 1, .opc1 = 0, .crn = 8, .crm = 7, .opc2 = 2, | ||
107 | .access = PL1_W, .accessfn = access_ttlb, .type = ARM_CP_NO_RAW, | ||
108 | + .fgt = FGT_TLBIASIDE1, | ||
109 | .writefn = tlbi_aa64_vmalle1_write }, | ||
110 | { .name = "TLBI_VAAE1", .state = ARM_CP_STATE_AA64, | ||
111 | .opc0 = 1, .opc1 = 0, .crn = 8, .crm = 7, .opc2 = 3, | ||
112 | .access = PL1_W, .accessfn = access_ttlb, .type = ARM_CP_NO_RAW, | ||
113 | + .fgt = FGT_TLBIVAAE1, | ||
114 | .writefn = tlbi_aa64_vae1_write }, | ||
115 | { .name = "TLBI_VALE1", .state = ARM_CP_STATE_AA64, | ||
116 | .opc0 = 1, .opc1 = 0, .crn = 8, .crm = 7, .opc2 = 5, | ||
117 | .access = PL1_W, .accessfn = access_ttlb, .type = ARM_CP_NO_RAW, | ||
118 | + .fgt = FGT_TLBIVALE1, | ||
119 | .writefn = tlbi_aa64_vae1_write }, | ||
120 | { .name = "TLBI_VAALE1", .state = ARM_CP_STATE_AA64, | ||
121 | .opc0 = 1, .opc1 = 0, .crn = 8, .crm = 7, .opc2 = 7, | ||
122 | .access = PL1_W, .accessfn = access_ttlb, .type = ARM_CP_NO_RAW, | ||
123 | + .fgt = FGT_TLBIVAALE1, | ||
250 | .writefn = tlbi_aa64_vae1_write }, | 124 | .writefn = tlbi_aa64_vae1_write }, |
251 | { .name = "TLBI_IPAS2E1IS", .state = ARM_CP_STATE_AA64, | 125 | { .name = "TLBI_IPAS2E1IS", .state = ARM_CP_STATE_AA64, |
252 | .opc0 = 1, .opc1 = 4, .crn = 8, .crm = 0, .opc2 = 1, | 126 | .opc0 = 1, .opc1 = 4, .crn = 8, .crm = 0, .opc2 = 1, |
253 | - .access = PL2_W, .type = ARM_CP_NO_RAW, | 127 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo tlbirange_reginfo[] = { |
254 | - .writefn = tlbi_aa64_ipas2e1is_write }, | 128 | { .name = "TLBI_RVAE1IS", .state = ARM_CP_STATE_AA64, |
255 | + .access = PL2_W, .type = ARM_CP_NOP }, | 129 | .opc0 = 1, .opc1 = 0, .crn = 8, .crm = 2, .opc2 = 1, |
256 | { .name = "TLBI_IPAS2LE1IS", .state = ARM_CP_STATE_AA64, | 130 | .access = PL1_W, .accessfn = access_ttlbis, .type = ARM_CP_NO_RAW, |
257 | .opc0 = 1, .opc1 = 4, .crn = 8, .crm = 0, .opc2 = 5, | 131 | + .fgt = FGT_TLBIRVAE1IS, |
258 | - .access = PL2_W, .type = ARM_CP_NO_RAW, | 132 | .writefn = tlbi_aa64_rvae1is_write }, |
259 | - .writefn = tlbi_aa64_ipas2e1is_write }, | 133 | { .name = "TLBI_RVAAE1IS", .state = ARM_CP_STATE_AA64, |
260 | + .access = PL2_W, .type = ARM_CP_NOP }, | 134 | .opc0 = 1, .opc1 = 0, .crn = 8, .crm = 2, .opc2 = 3, |
261 | { .name = "TLBI_ALLE1IS", .state = ARM_CP_STATE_AA64, | 135 | .access = PL1_W, .accessfn = access_ttlbis, .type = ARM_CP_NO_RAW, |
262 | .opc0 = 1, .opc1 = 4, .crn = 8, .crm = 3, .opc2 = 4, | 136 | + .fgt = FGT_TLBIRVAAE1IS, |
263 | .access = PL2_W, .type = ARM_CP_NO_RAW, | 137 | .writefn = tlbi_aa64_rvae1is_write }, |
264 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v8_cp_reginfo[] = { | 138 | { .name = "TLBI_RVALE1IS", .state = ARM_CP_STATE_AA64, |
265 | .writefn = tlbi_aa64_alle1is_write }, | 139 | .opc0 = 1, .opc1 = 0, .crn = 8, .crm = 2, .opc2 = 5, |
266 | { .name = "TLBI_IPAS2E1", .state = ARM_CP_STATE_AA64, | 140 | .access = PL1_W, .accessfn = access_ttlbis, .type = ARM_CP_NO_RAW, |
267 | .opc0 = 1, .opc1 = 4, .crn = 8, .crm = 4, .opc2 = 1, | 141 | + .fgt = FGT_TLBIRVALE1IS, |
268 | - .access = PL2_W, .type = ARM_CP_NO_RAW, | 142 | .writefn = tlbi_aa64_rvae1is_write }, |
269 | - .writefn = tlbi_aa64_ipas2e1_write }, | 143 | { .name = "TLBI_RVAALE1IS", .state = ARM_CP_STATE_AA64, |
270 | + .access = PL2_W, .type = ARM_CP_NOP }, | 144 | .opc0 = 1, .opc1 = 0, .crn = 8, .crm = 2, .opc2 = 7, |
271 | { .name = "TLBI_IPAS2LE1", .state = ARM_CP_STATE_AA64, | 145 | .access = PL1_W, .accessfn = access_ttlbis, .type = ARM_CP_NO_RAW, |
272 | .opc0 = 1, .opc1 = 4, .crn = 8, .crm = 4, .opc2 = 5, | 146 | + .fgt = FGT_TLBIRVAALE1IS, |
273 | - .access = PL2_W, .type = ARM_CP_NO_RAW, | 147 | .writefn = tlbi_aa64_rvae1is_write }, |
274 | - .writefn = tlbi_aa64_ipas2e1_write }, | 148 | { .name = "TLBI_RVAE1OS", .state = ARM_CP_STATE_AA64, |
275 | + .access = PL2_W, .type = ARM_CP_NOP }, | 149 | .opc0 = 1, .opc1 = 0, .crn = 8, .crm = 5, .opc2 = 1, |
276 | { .name = "TLBI_ALLE1", .state = ARM_CP_STATE_AA64, | 150 | .access = PL1_W, .accessfn = access_ttlbos, .type = ARM_CP_NO_RAW, |
277 | .opc0 = 1, .opc1 = 4, .crn = 8, .crm = 7, .opc2 = 4, | 151 | + .fgt = FGT_TLBIRVAE1OS, |
278 | .access = PL2_W, .type = ARM_CP_NO_RAW, | 152 | .writefn = tlbi_aa64_rvae1is_write }, |
279 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v8_cp_reginfo[] = { | 153 | { .name = "TLBI_RVAAE1OS", .state = ARM_CP_STATE_AA64, |
280 | .writefn = tlbimva_hyp_is_write }, | 154 | .opc0 = 1, .opc1 = 0, .crn = 8, .crm = 5, .opc2 = 3, |
281 | { .name = "TLBIIPAS2", | 155 | .access = PL1_W, .accessfn = access_ttlbos, .type = ARM_CP_NO_RAW, |
282 | .cp = 15, .opc1 = 4, .crn = 8, .crm = 4, .opc2 = 1, | 156 | + .fgt = FGT_TLBIRVAAE1OS, |
283 | - .type = ARM_CP_NO_RAW, .access = PL2_W, | 157 | .writefn = tlbi_aa64_rvae1is_write }, |
284 | - .writefn = tlbiipas2_write }, | 158 | { .name = "TLBI_RVALE1OS", .state = ARM_CP_STATE_AA64, |
285 | + .type = ARM_CP_NOP, .access = PL2_W }, | 159 | .opc0 = 1, .opc1 = 0, .crn = 8, .crm = 5, .opc2 = 5, |
286 | { .name = "TLBIIPAS2IS", | 160 | .access = PL1_W, .accessfn = access_ttlbos, .type = ARM_CP_NO_RAW, |
287 | .cp = 15, .opc1 = 4, .crn = 8, .crm = 0, .opc2 = 1, | 161 | + .fgt = FGT_TLBIRVALE1OS, |
288 | - .type = ARM_CP_NO_RAW, .access = PL2_W, | 162 | .writefn = tlbi_aa64_rvae1is_write }, |
289 | - .writefn = tlbiipas2_is_write }, | 163 | { .name = "TLBI_RVAALE1OS", .state = ARM_CP_STATE_AA64, |
290 | + .type = ARM_CP_NOP, .access = PL2_W }, | 164 | .opc0 = 1, .opc1 = 0, .crn = 8, .crm = 5, .opc2 = 7, |
291 | { .name = "TLBIIPAS2L", | 165 | .access = PL1_W, .accessfn = access_ttlbos, .type = ARM_CP_NO_RAW, |
292 | .cp = 15, .opc1 = 4, .crn = 8, .crm = 4, .opc2 = 5, | 166 | + .fgt = FGT_TLBIRVAALE1OS, |
293 | - .type = ARM_CP_NO_RAW, .access = PL2_W, | 167 | .writefn = tlbi_aa64_rvae1is_write }, |
294 | - .writefn = tlbiipas2_write }, | 168 | { .name = "TLBI_RVAE1", .state = ARM_CP_STATE_AA64, |
295 | + .type = ARM_CP_NOP, .access = PL2_W }, | 169 | .opc0 = 1, .opc1 = 0, .crn = 8, .crm = 6, .opc2 = 1, |
296 | { .name = "TLBIIPAS2LIS", | 170 | .access = PL1_W, .accessfn = access_ttlb, .type = ARM_CP_NO_RAW, |
297 | .cp = 15, .opc1 = 4, .crn = 8, .crm = 0, .opc2 = 5, | 171 | + .fgt = FGT_TLBIRVAE1, |
298 | - .type = ARM_CP_NO_RAW, .access = PL2_W, | 172 | .writefn = tlbi_aa64_rvae1_write }, |
299 | - .writefn = tlbiipas2_is_write }, | 173 | { .name = "TLBI_RVAAE1", .state = ARM_CP_STATE_AA64, |
300 | + .type = ARM_CP_NOP, .access = PL2_W }, | 174 | .opc0 = 1, .opc1 = 0, .crn = 8, .crm = 6, .opc2 = 3, |
301 | /* 32 bit cache operations */ | 175 | .access = PL1_W, .accessfn = access_ttlb, .type = ARM_CP_NO_RAW, |
302 | { .name = "ICIALLUIS", .cp = 15, .opc1 = 0, .crn = 7, .crm = 1, .opc2 = 0, | 176 | + .fgt = FGT_TLBIRVAAE1, |
303 | .type = ARM_CP_NOP, .access = PL1_W, .accessfn = aa64_cacheop_pou_access }, | 177 | .writefn = tlbi_aa64_rvae1_write }, |
178 | { .name = "TLBI_RVALE1", .state = ARM_CP_STATE_AA64, | ||
179 | .opc0 = 1, .opc1 = 0, .crn = 8, .crm = 6, .opc2 = 5, | ||
180 | .access = PL1_W, .accessfn = access_ttlb, .type = ARM_CP_NO_RAW, | ||
181 | + .fgt = FGT_TLBIRVALE1, | ||
182 | .writefn = tlbi_aa64_rvae1_write }, | ||
183 | { .name = "TLBI_RVAALE1", .state = ARM_CP_STATE_AA64, | ||
184 | .opc0 = 1, .opc1 = 0, .crn = 8, .crm = 6, .opc2 = 7, | ||
185 | .access = PL1_W, .accessfn = access_ttlb, .type = ARM_CP_NO_RAW, | ||
186 | + .fgt = FGT_TLBIRVAALE1, | ||
187 | .writefn = tlbi_aa64_rvae1_write }, | ||
188 | { .name = "TLBI_RIPAS2E1IS", .state = ARM_CP_STATE_AA64, | ||
189 | .opc0 = 1, .opc1 = 4, .crn = 8, .crm = 0, .opc2 = 2, | ||
190 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo tlbios_reginfo[] = { | ||
191 | { .name = "TLBI_VMALLE1OS", .state = ARM_CP_STATE_AA64, | ||
192 | .opc0 = 1, .opc1 = 0, .crn = 8, .crm = 1, .opc2 = 0, | ||
193 | .access = PL1_W, .accessfn = access_ttlbos, .type = ARM_CP_NO_RAW, | ||
194 | + .fgt = FGT_TLBIVMALLE1OS, | ||
195 | .writefn = tlbi_aa64_vmalle1is_write }, | ||
196 | { .name = "TLBI_VAE1OS", .state = ARM_CP_STATE_AA64, | ||
197 | .opc0 = 1, .opc1 = 0, .crn = 8, .crm = 1, .opc2 = 1, | ||
198 | + .fgt = FGT_TLBIVAE1OS, | ||
199 | .access = PL1_W, .accessfn = access_ttlbos, .type = ARM_CP_NO_RAW, | ||
200 | .writefn = tlbi_aa64_vae1is_write }, | ||
201 | { .name = "TLBI_ASIDE1OS", .state = ARM_CP_STATE_AA64, | ||
202 | .opc0 = 1, .opc1 = 0, .crn = 8, .crm = 1, .opc2 = 2, | ||
203 | .access = PL1_W, .accessfn = access_ttlbos, .type = ARM_CP_NO_RAW, | ||
204 | + .fgt = FGT_TLBIASIDE1OS, | ||
205 | .writefn = tlbi_aa64_vmalle1is_write }, | ||
206 | { .name = "TLBI_VAAE1OS", .state = ARM_CP_STATE_AA64, | ||
207 | .opc0 = 1, .opc1 = 0, .crn = 8, .crm = 1, .opc2 = 3, | ||
208 | .access = PL1_W, .accessfn = access_ttlbos, .type = ARM_CP_NO_RAW, | ||
209 | + .fgt = FGT_TLBIVAAE1OS, | ||
210 | .writefn = tlbi_aa64_vae1is_write }, | ||
211 | { .name = "TLBI_VALE1OS", .state = ARM_CP_STATE_AA64, | ||
212 | .opc0 = 1, .opc1 = 0, .crn = 8, .crm = 1, .opc2 = 5, | ||
213 | .access = PL1_W, .accessfn = access_ttlbos, .type = ARM_CP_NO_RAW, | ||
214 | + .fgt = FGT_TLBIVALE1OS, | ||
215 | .writefn = tlbi_aa64_vae1is_write }, | ||
216 | { .name = "TLBI_VAALE1OS", .state = ARM_CP_STATE_AA64, | ||
217 | .opc0 = 1, .opc1 = 0, .crn = 8, .crm = 1, .opc2 = 7, | ||
218 | .access = PL1_W, .accessfn = access_ttlbos, .type = ARM_CP_NO_RAW, | ||
219 | + .fgt = FGT_TLBIVAALE1OS, | ||
220 | .writefn = tlbi_aa64_vae1is_write }, | ||
221 | { .name = "TLBI_ALLE2OS", .state = ARM_CP_STATE_AA64, | ||
222 | .opc0 = 1, .opc1 = 4, .crn = 8, .crm = 1, .opc2 = 0, | ||
304 | -- | 223 | -- |
305 | 2.20.1 | 224 | 2.34.1 |
306 | |||
307 | diff view generated by jsdifflib |
1 | We were accidentally permitting decode of Thumb Neon insns even if | 1 | Mark up the sysreg definitions for the system instructions |
---|---|---|---|
2 | the CPU didn't have the FEATURE_NEON bit set, because the feature | 2 | trapped by HFGITR bits 48..63. |
3 | check was being done before the call to disas_neon_data_insn() and | 3 | |
4 | disas_neon_ls_insn() in the Arm decoder but was omitted from the | 4 | Some of these bits are for trapping instructions which are |
5 | Thumb decoder. Push the feature bit check down into the called | 5 | not in the system instruction encoding (i.e. which are |
6 | functions so it is done for both Arm and Thumb encodings. | 6 | not handled by the ARMCPRegInfo mechanism): |
7 | * ERET, ERETAA, ERETAB | ||
8 | * SVC | ||
9 | |||
10 | We will have to handle those separately and manually. | ||
7 | 11 | ||
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
9 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 13 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
10 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 14 | Tested-by: Fuad Tabba <tabba@google.com> |
11 | Message-id: 20200430181003.21682-3-peter.maydell@linaro.org | 15 | Message-id: 20230130182459.3309057-20-peter.maydell@linaro.org |
16 | Message-id: 20230127175507.2895013-20-peter.maydell@linaro.org | ||
12 | --- | 17 | --- |
13 | target/arm/translate.c | 16 ++++++++-------- | 18 | target/arm/cpregs.h | 4 ++++ |
14 | 1 file changed, 8 insertions(+), 8 deletions(-) | 19 | target/arm/helper.c | 9 +++++++++ |
20 | 2 files changed, 13 insertions(+) | ||
15 | 21 | ||
16 | diff --git a/target/arm/translate.c b/target/arm/translate.c | 22 | diff --git a/target/arm/cpregs.h b/target/arm/cpregs.h |
17 | index XXXXXXX..XXXXXXX 100644 | 23 | index XXXXXXX..XXXXXXX 100644 |
18 | --- a/target/arm/translate.c | 24 | --- a/target/arm/cpregs.h |
19 | +++ b/target/arm/translate.c | 25 | +++ b/target/arm/cpregs.h |
20 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_ls_insn(DisasContext *s, uint32_t insn) | 26 | @@ -XXX,XX +XXX,XX @@ typedef enum FGTBit { |
21 | TCGv_i32 tmp2; | 27 | DO_BIT(HFGITR, TLBIVAAE1), |
22 | TCGv_i64 tmp64; | 28 | DO_BIT(HFGITR, TLBIVALE1), |
23 | 29 | DO_BIT(HFGITR, TLBIVAALE1), | |
24 | + if (!arm_dc_feature(s, ARM_FEATURE_NEON)) { | 30 | + DO_BIT(HFGITR, CFPRCTX), |
25 | + return 1; | 31 | + DO_BIT(HFGITR, DVPRCTX), |
26 | + } | 32 | + DO_BIT(HFGITR, CPPRCTX), |
27 | + | 33 | + DO_BIT(HFGITR, DCCVAC), |
28 | /* FIXME: this access check should not take precedence over UNDEF | 34 | } FGTBit; |
29 | * for invalid encodings; we will generate incorrect syndrome information | 35 | |
30 | * for attempts to execute invalid vfp/neon encodings with FP disabled. | 36 | #undef DO_BIT |
31 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) | 37 | diff --git a/target/arm/helper.c b/target/arm/helper.c |
32 | TCGv_ptr ptr1, ptr2, ptr3; | 38 | index XXXXXXX..XXXXXXX 100644 |
33 | TCGv_i64 tmp64; | 39 | --- a/target/arm/helper.c |
34 | 40 | +++ b/target/arm/helper.c | |
35 | + if (!arm_dc_feature(s, ARM_FEATURE_NEON)) { | 41 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v8_cp_reginfo[] = { |
36 | + return 1; | 42 | { .name = "DC_CVAC", .state = ARM_CP_STATE_AA64, |
37 | + } | 43 | .opc0 = 1, .opc1 = 3, .crn = 7, .crm = 10, .opc2 = 1, |
38 | + | 44 | .access = PL0_W, .type = ARM_CP_NOP, |
39 | /* FIXME: this access check should not take precedence over UNDEF | 45 | + .fgt = FGT_DCCVAC, |
40 | * for invalid encodings; we will generate incorrect syndrome information | 46 | .accessfn = aa64_cacheop_poc_access }, |
41 | * for attempts to execute invalid vfp/neon encodings with FP disabled. | 47 | { .name = "DC_CSW", .state = ARM_CP_STATE_AA64, |
42 | @@ -XXX,XX +XXX,XX @@ static void disas_arm_insn(DisasContext *s, unsigned int insn) | 48 | .opc0 = 1, .opc1 = 0, .crn = 7, .crm = 10, .opc2 = 2, |
43 | 49 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo mte_el0_cacheop_reginfo[] = { | |
44 | if (((insn >> 25) & 7) == 1) { | 50 | { .name = "DC_CGVAC", .state = ARM_CP_STATE_AA64, |
45 | /* NEON Data processing. */ | 51 | .opc0 = 1, .opc1 = 3, .crn = 7, .crm = 10, .opc2 = 3, |
46 | - if (!arm_dc_feature(s, ARM_FEATURE_NEON)) { | 52 | .type = ARM_CP_NOP, .access = PL0_W, |
47 | - goto illegal_op; | 53 | + .fgt = FGT_DCCVAC, |
48 | - } | 54 | .accessfn = aa64_cacheop_poc_access }, |
49 | - | 55 | { .name = "DC_CGDVAC", .state = ARM_CP_STATE_AA64, |
50 | if (disas_neon_data_insn(s, insn)) { | 56 | .opc0 = 1, .opc1 = 3, .crn = 7, .crm = 10, .opc2 = 5, |
51 | goto illegal_op; | 57 | .type = ARM_CP_NOP, .access = PL0_W, |
52 | } | 58 | + .fgt = FGT_DCCVAC, |
53 | @@ -XXX,XX +XXX,XX @@ static void disas_arm_insn(DisasContext *s, unsigned int insn) | 59 | .accessfn = aa64_cacheop_poc_access }, |
54 | } | 60 | { .name = "DC_CGVAP", .state = ARM_CP_STATE_AA64, |
55 | if ((insn & 0x0f100000) == 0x04000000) { | 61 | .opc0 = 1, .opc1 = 3, .crn = 7, .crm = 12, .opc2 = 3, |
56 | /* NEON load/store. */ | 62 | @@ -XXX,XX +XXX,XX @@ static CPAccessResult access_predinv(CPUARMState *env, const ARMCPRegInfo *ri, |
57 | - if (!arm_dc_feature(s, ARM_FEATURE_NEON)) { | 63 | static const ARMCPRegInfo predinv_reginfo[] = { |
58 | - goto illegal_op; | 64 | { .name = "CFP_RCTX", .state = ARM_CP_STATE_AA64, |
59 | - } | 65 | .opc0 = 1, .opc1 = 3, .crn = 7, .crm = 3, .opc2 = 4, |
60 | - | 66 | + .fgt = FGT_CFPRCTX, |
61 | if (disas_neon_ls_insn(s, insn)) { | 67 | .type = ARM_CP_NOP, .access = PL0_W, .accessfn = access_predinv }, |
62 | goto illegal_op; | 68 | { .name = "DVP_RCTX", .state = ARM_CP_STATE_AA64, |
63 | } | 69 | .opc0 = 1, .opc1 = 3, .crn = 7, .crm = 3, .opc2 = 5, |
70 | + .fgt = FGT_DVPRCTX, | ||
71 | .type = ARM_CP_NOP, .access = PL0_W, .accessfn = access_predinv }, | ||
72 | { .name = "CPP_RCTX", .state = ARM_CP_STATE_AA64, | ||
73 | .opc0 = 1, .opc1 = 3, .crn = 7, .crm = 3, .opc2 = 7, | ||
74 | + .fgt = FGT_CPPRCTX, | ||
75 | .type = ARM_CP_NOP, .access = PL0_W, .accessfn = access_predinv }, | ||
76 | /* | ||
77 | * Note the AArch32 opcodes have a different OPC1. | ||
78 | */ | ||
79 | { .name = "CFPRCTX", .state = ARM_CP_STATE_AA32, | ||
80 | .cp = 15, .opc1 = 0, .crn = 7, .crm = 3, .opc2 = 4, | ||
81 | + .fgt = FGT_CFPRCTX, | ||
82 | .type = ARM_CP_NOP, .access = PL0_W, .accessfn = access_predinv }, | ||
83 | { .name = "DVPRCTX", .state = ARM_CP_STATE_AA32, | ||
84 | .cp = 15, .opc1 = 0, .crn = 7, .crm = 3, .opc2 = 5, | ||
85 | + .fgt = FGT_DVPRCTX, | ||
86 | .type = ARM_CP_NOP, .access = PL0_W, .accessfn = access_predinv }, | ||
87 | { .name = "CPPRCTX", .state = ARM_CP_STATE_AA32, | ||
88 | .cp = 15, .opc1 = 0, .crn = 7, .crm = 3, .opc2 = 7, | ||
89 | + .fgt = FGT_CPPRCTX, | ||
90 | .type = ARM_CP_NOP, .access = PL0_W, .accessfn = access_predinv }, | ||
91 | }; | ||
92 | |||
64 | -- | 93 | -- |
65 | 2.20.1 | 94 | 2.34.1 |
66 | |||
67 | diff view generated by jsdifflib |
1 | We're going to want at least some of the NeonGen* typedefs | 1 | Implement the HFGITR_EL2.ERET fine-grained trap. This traps |
---|---|---|---|
2 | for the refactored 32-bit Neon decoder, so move them all | 2 | execution from AArch64 EL1 of ERET, ERETAA and ERETAB. The trap is |
3 | to translate.h since it makes more sense to keep them in | 3 | reported with a syndrome value of 0x1a. |
4 | one group. | 4 | |
5 | The trap must take precedence over a possible pointer-authentication | ||
6 | trap for ERETAA and ERETAB. | ||
5 | 7 | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
7 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 9 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
8 | Message-id: 20200430181003.21682-23-peter.maydell@linaro.org | 10 | Tested-by: Fuad Tabba <tabba@google.com> |
11 | Message-id: 20230130182459.3309057-21-peter.maydell@linaro.org | ||
12 | Message-id: 20230127175507.2895013-21-peter.maydell@linaro.org | ||
9 | --- | 13 | --- |
10 | target/arm/translate.h | 17 +++++++++++++++++ | 14 | target/arm/cpu.h | 1 + |
11 | target/arm/translate-a64.c | 17 ----------------- | 15 | target/arm/syndrome.h | 10 ++++++++++ |
12 | 2 files changed, 17 insertions(+), 17 deletions(-) | 16 | target/arm/translate.h | 2 ++ |
17 | target/arm/helper.c | 3 +++ | ||
18 | target/arm/translate-a64.c | 10 ++++++++++ | ||
19 | 5 files changed, 26 insertions(+) | ||
13 | 20 | ||
21 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h | ||
22 | index XXXXXXX..XXXXXXX 100644 | ||
23 | --- a/target/arm/cpu.h | ||
24 | +++ b/target/arm/cpu.h | ||
25 | @@ -XXX,XX +XXX,XX @@ FIELD(TBFLAG_A64, PSTATE_ZA, 23, 1) | ||
26 | FIELD(TBFLAG_A64, SVL, 24, 4) | ||
27 | /* Indicates that SME Streaming mode is active, and SMCR_ELx.FA64 is not. */ | ||
28 | FIELD(TBFLAG_A64, SME_TRAP_NONSTREAMING, 28, 1) | ||
29 | +FIELD(TBFLAG_A64, FGT_ERET, 29, 1) | ||
30 | |||
31 | /* | ||
32 | * Helpers for using the above. | ||
33 | diff --git a/target/arm/syndrome.h b/target/arm/syndrome.h | ||
34 | index XXXXXXX..XXXXXXX 100644 | ||
35 | --- a/target/arm/syndrome.h | ||
36 | +++ b/target/arm/syndrome.h | ||
37 | @@ -XXX,XX +XXX,XX @@ enum arm_exception_class { | ||
38 | EC_AA64_SMC = 0x17, | ||
39 | EC_SYSTEMREGISTERTRAP = 0x18, | ||
40 | EC_SVEACCESSTRAP = 0x19, | ||
41 | + EC_ERETTRAP = 0x1a, | ||
42 | EC_SMETRAP = 0x1d, | ||
43 | EC_INSNABORT = 0x20, | ||
44 | EC_INSNABORT_SAME_EL = 0x21, | ||
45 | @@ -XXX,XX +XXX,XX @@ static inline uint32_t syn_sve_access_trap(void) | ||
46 | return EC_SVEACCESSTRAP << ARM_EL_EC_SHIFT; | ||
47 | } | ||
48 | |||
49 | +/* | ||
50 | + * eret_op is bits [1:0] of the ERET instruction, so: | ||
51 | + * 0 for ERET, 2 for ERETAA, 3 for ERETAB. | ||
52 | + */ | ||
53 | +static inline uint32_t syn_erettrap(int eret_op) | ||
54 | +{ | ||
55 | + return (EC_ERETTRAP << ARM_EL_EC_SHIFT) | ARM_EL_IL | eret_op; | ||
56 | +} | ||
57 | + | ||
58 | static inline uint32_t syn_smetrap(SMEExceptionType etype, bool is_16bit) | ||
59 | { | ||
60 | return (EC_SMETRAP << ARM_EL_EC_SHIFT) | ||
14 | diff --git a/target/arm/translate.h b/target/arm/translate.h | 61 | diff --git a/target/arm/translate.h b/target/arm/translate.h |
15 | index XXXXXXX..XXXXXXX 100644 | 62 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/target/arm/translate.h | 63 | --- a/target/arm/translate.h |
17 | +++ b/target/arm/translate.h | 64 | +++ b/target/arm/translate.h |
18 | @@ -XXX,XX +XXX,XX @@ typedef void GVecGen3Fn(unsigned, uint32_t, uint32_t, | 65 | @@ -XXX,XX +XXX,XX @@ typedef struct DisasContext { |
19 | typedef void GVecGen4Fn(unsigned, uint32_t, uint32_t, uint32_t, | 66 | bool mve_no_pred; |
20 | uint32_t, uint32_t, uint32_t); | 67 | /* True if fine-grained traps are active */ |
21 | 68 | bool fgt_active; | |
22 | +/* Function prototype for gen_ functions for calling Neon helpers */ | 69 | + /* True if fine-grained trap on ERET is enabled */ |
23 | +typedef void NeonGenOneOpEnvFn(TCGv_i32, TCGv_ptr, TCGv_i32); | 70 | + bool fgt_eret; |
24 | +typedef void NeonGenTwoOpFn(TCGv_i32, TCGv_i32, TCGv_i32); | 71 | /* |
25 | +typedef void NeonGenTwoOpEnvFn(TCGv_i32, TCGv_ptr, TCGv_i32, TCGv_i32); | 72 | * >= 0, a copy of PSTATE.BTYPE, which will be 0 without v8.5-BTI. |
26 | +typedef void NeonGenTwo64OpFn(TCGv_i64, TCGv_i64, TCGv_i64); | 73 | * < 0, set by the current instruction. |
27 | +typedef void NeonGenTwo64OpEnvFn(TCGv_i64, TCGv_ptr, TCGv_i64, TCGv_i64); | 74 | diff --git a/target/arm/helper.c b/target/arm/helper.c |
28 | +typedef void NeonGenNarrowFn(TCGv_i32, TCGv_i64); | 75 | index XXXXXXX..XXXXXXX 100644 |
29 | +typedef void NeonGenNarrowEnvFn(TCGv_i32, TCGv_ptr, TCGv_i64); | 76 | --- a/target/arm/helper.c |
30 | +typedef void NeonGenWidenFn(TCGv_i64, TCGv_i32); | 77 | +++ b/target/arm/helper.c |
31 | +typedef void NeonGenTwoSingleOPFn(TCGv_i32, TCGv_i32, TCGv_i32, TCGv_ptr); | 78 | @@ -XXX,XX +XXX,XX @@ static CPUARMTBFlags rebuild_hflags_a64(CPUARMState *env, int el, int fp_el, |
32 | +typedef void NeonGenTwoDoubleOPFn(TCGv_i64, TCGv_i64, TCGv_i64, TCGv_ptr); | 79 | |
33 | +typedef void NeonGenOneOpFn(TCGv_i64, TCGv_i64); | 80 | if (arm_fgt_active(env, el)) { |
34 | +typedef void CryptoTwoOpFn(TCGv_ptr, TCGv_ptr); | 81 | DP_TBFLAG_ANY(flags, FGT_ACTIVE, 1); |
35 | +typedef void CryptoThreeOpIntFn(TCGv_ptr, TCGv_ptr, TCGv_i32); | 82 | + if (FIELD_EX64(env->cp15.fgt_exec[FGTREG_HFGITR], HFGITR_EL2, ERET)) { |
36 | +typedef void CryptoThreeOpFn(TCGv_ptr, TCGv_ptr, TCGv_ptr); | 83 | + DP_TBFLAG_A64(flags, FGT_ERET, 1); |
37 | +typedef void AtomicThreeOpFn(TCGv_i64, TCGv_i64, TCGv_i64, TCGArg, MemOp); | 84 | + } |
38 | + | 85 | } |
39 | #endif /* TARGET_ARM_TRANSLATE_H */ | 86 | |
87 | if (cpu_isar_feature(aa64_mte, env_archcpu(env))) { | ||
40 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c | 88 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c |
41 | index XXXXXXX..XXXXXXX 100644 | 89 | index XXXXXXX..XXXXXXX 100644 |
42 | --- a/target/arm/translate-a64.c | 90 | --- a/target/arm/translate-a64.c |
43 | +++ b/target/arm/translate-a64.c | 91 | +++ b/target/arm/translate-a64.c |
44 | @@ -XXX,XX +XXX,XX @@ typedef struct AArch64DecodeTable { | 92 | @@ -XXX,XX +XXX,XX @@ static void disas_uncond_b_reg(DisasContext *s, uint32_t insn) |
45 | AArch64DecodeFn *disas_fn; | 93 | if (op4 != 0) { |
46 | } AArch64DecodeTable; | 94 | goto do_unallocated; |
47 | 95 | } | |
48 | -/* Function prototype for gen_ functions for calling Neon helpers */ | 96 | + if (s->fgt_eret) { |
49 | -typedef void NeonGenOneOpEnvFn(TCGv_i32, TCGv_ptr, TCGv_i32); | 97 | + gen_exception_insn_el(s, 0, EXCP_UDEF, syn_erettrap(op3), 2); |
50 | -typedef void NeonGenTwoOpFn(TCGv_i32, TCGv_i32, TCGv_i32); | 98 | + return; |
51 | -typedef void NeonGenTwoOpEnvFn(TCGv_i32, TCGv_ptr, TCGv_i32, TCGv_i32); | 99 | + } |
52 | -typedef void NeonGenTwo64OpFn(TCGv_i64, TCGv_i64, TCGv_i64); | 100 | dst = tcg_temp_new_i64(); |
53 | -typedef void NeonGenTwo64OpEnvFn(TCGv_i64, TCGv_ptr, TCGv_i64, TCGv_i64); | 101 | tcg_gen_ld_i64(dst, cpu_env, |
54 | -typedef void NeonGenNarrowFn(TCGv_i32, TCGv_i64); | 102 | offsetof(CPUARMState, elr_el[s->current_el])); |
55 | -typedef void NeonGenNarrowEnvFn(TCGv_i32, TCGv_ptr, TCGv_i64); | 103 | @@ -XXX,XX +XXX,XX @@ static void disas_uncond_b_reg(DisasContext *s, uint32_t insn) |
56 | -typedef void NeonGenWidenFn(TCGv_i64, TCGv_i32); | 104 | if (rn != 0x1f || op4 != 0x1f) { |
57 | -typedef void NeonGenTwoSingleOPFn(TCGv_i32, TCGv_i32, TCGv_i32, TCGv_ptr); | 105 | goto do_unallocated; |
58 | -typedef void NeonGenTwoDoubleOPFn(TCGv_i64, TCGv_i64, TCGv_i64, TCGv_ptr); | 106 | } |
59 | -typedef void NeonGenOneOpFn(TCGv_i64, TCGv_i64); | 107 | + /* The FGT trap takes precedence over an auth trap. */ |
60 | -typedef void CryptoTwoOpFn(TCGv_ptr, TCGv_ptr); | 108 | + if (s->fgt_eret) { |
61 | -typedef void CryptoThreeOpIntFn(TCGv_ptr, TCGv_ptr, TCGv_i32); | 109 | + gen_exception_insn_el(s, 0, EXCP_UDEF, syn_erettrap(op3), 2); |
62 | -typedef void CryptoThreeOpFn(TCGv_ptr, TCGv_ptr, TCGv_ptr); | 110 | + return; |
63 | -typedef void AtomicThreeOpFn(TCGv_i64, TCGv_i64, TCGv_i64, TCGArg, MemOp); | 111 | + } |
64 | - | 112 | dst = tcg_temp_new_i64(); |
65 | /* initialize TCG globals. */ | 113 | tcg_gen_ld_i64(dst, cpu_env, |
66 | void a64_translate_init(void) | 114 | offsetof(CPUARMState, elr_el[s->current_el])); |
67 | { | 115 | @@ -XXX,XX +XXX,XX @@ static void aarch64_tr_init_disas_context(DisasContextBase *dcbase, |
116 | dc->align_mem = EX_TBFLAG_ANY(tb_flags, ALIGN_MEM); | ||
117 | dc->pstate_il = EX_TBFLAG_ANY(tb_flags, PSTATE__IL); | ||
118 | dc->fgt_active = EX_TBFLAG_ANY(tb_flags, FGT_ACTIVE); | ||
119 | + dc->fgt_eret = EX_TBFLAG_A64(tb_flags, FGT_ERET); | ||
120 | dc->sve_excp_el = EX_TBFLAG_A64(tb_flags, SVEEXC_EL); | ||
121 | dc->sme_excp_el = EX_TBFLAG_A64(tb_flags, SMEEXC_EL); | ||
122 | dc->vl = (EX_TBFLAG_A64(tb_flags, VL) + 1) * 16; | ||
68 | -- | 123 | -- |
69 | 2.20.1 | 124 | 2.34.1 |
70 | |||
71 | diff view generated by jsdifflib |
1 | Convert the Neon 3-reg-same VADD and VSUB insns to decodetree. | 1 | Implement the HFGITR_EL2.SVC_EL0 and SVC_EL1 fine-grained traps. |
---|---|---|---|
2 | 2 | These trap execution of the SVC instruction from AArch32 and AArch64. | |
3 | Note that we don't need the neon_3r_sizes[op] check here because all | 3 | (As usual, AArch32 can only trap from EL0, as fine grained traps are |
4 | size values are OK for VADD and VSUB; we'll add this when we convert | 4 | disabled with an AArch32 EL1.) |
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 | 5 | ||
11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
12 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 7 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
13 | Message-id: 20200430181003.21682-15-peter.maydell@linaro.org | 8 | Tested-by: Fuad Tabba <tabba@google.com> |
9 | Message-id: 20230130182459.3309057-22-peter.maydell@linaro.org | ||
10 | Message-id: 20230127175507.2895013-22-peter.maydell@linaro.org | ||
14 | --- | 11 | --- |
15 | target/arm/translate-a64.h | 9 -------- | 12 | target/arm/cpu.h | 1 + |
16 | target/arm/translate.h | 9 ++++++++ | 13 | target/arm/translate.h | 2 ++ |
17 | target/arm/neon-dp.decode | 17 +++++++++++++++ | 14 | target/arm/helper.c | 20 ++++++++++++++++++++ |
18 | target/arm/translate-neon.inc.c | 38 +++++++++++++++++++++++++++++++++ | 15 | target/arm/translate-a64.c | 9 ++++++++- |
19 | target/arm/translate.c | 14 ++++-------- | 16 | target/arm/translate.c | 12 +++++++++--- |
20 | 5 files changed, 68 insertions(+), 19 deletions(-) | 17 | 5 files changed, 40 insertions(+), 4 deletions(-) |
21 | 18 | ||
22 | diff --git a/target/arm/translate-a64.h b/target/arm/translate-a64.h | 19 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h |
23 | index XXXXXXX..XXXXXXX 100644 | 20 | index XXXXXXX..XXXXXXX 100644 |
24 | --- a/target/arm/translate-a64.h | 21 | --- a/target/arm/cpu.h |
25 | +++ b/target/arm/translate-a64.h | 22 | +++ b/target/arm/cpu.h |
26 | @@ -XXX,XX +XXX,XX @@ static inline int vec_full_reg_size(DisasContext *s) | 23 | @@ -XXX,XX +XXX,XX @@ FIELD(TBFLAG_ANY, FPEXC_EL, 8, 2) |
27 | 24 | FIELD(TBFLAG_ANY, ALIGN_MEM, 10, 1) | |
28 | bool disas_sve(DisasContext *, uint32_t); | 25 | FIELD(TBFLAG_ANY, PSTATE__IL, 11, 1) |
29 | 26 | FIELD(TBFLAG_ANY, FGT_ACTIVE, 12, 1) | |
30 | -/* Note that the gvec expanders operate on offsets + sizes. */ | 27 | +FIELD(TBFLAG_ANY, FGT_SVC, 13, 1) |
31 | -typedef void GVecGen2Fn(unsigned, uint32_t, uint32_t, uint32_t, uint32_t); | 28 | |
32 | -typedef void GVecGen2iFn(unsigned, uint32_t, uint32_t, int64_t, | 29 | /* |
33 | - uint32_t, uint32_t); | 30 | * Bit usage when in AArch32 state, both A- and M-profile. |
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 | 31 | diff --git a/target/arm/translate.h b/target/arm/translate.h |
41 | index XXXXXXX..XXXXXXX 100644 | 32 | index XXXXXXX..XXXXXXX 100644 |
42 | --- a/target/arm/translate.h | 33 | --- a/target/arm/translate.h |
43 | +++ b/target/arm/translate.h | 34 | +++ b/target/arm/translate.h |
44 | @@ -XXX,XX +XXX,XX @@ void gen_sshl_i64(TCGv_i64 d, TCGv_i64 a, TCGv_i64 b); | 35 | @@ -XXX,XX +XXX,XX @@ typedef struct DisasContext { |
45 | #define dc_isar_feature(name, ctx) \ | 36 | bool fgt_active; |
46 | ({ DisasContext *ctx_ = (ctx); isar_feature_##name(ctx_->isar); }) | 37 | /* True if fine-grained trap on ERET is enabled */ |
47 | 38 | bool fgt_eret; | |
48 | +/* Note that the gvec expanders operate on offsets + sizes. */ | 39 | + /* True if fine-grained trap on SVC is enabled */ |
49 | +typedef void GVecGen2Fn(unsigned, uint32_t, uint32_t, uint32_t, uint32_t); | 40 | + bool fgt_svc; |
50 | +typedef void GVecGen2iFn(unsigned, uint32_t, uint32_t, int64_t, | 41 | /* |
51 | + uint32_t, uint32_t); | 42 | * >= 0, a copy of PSTATE.BTYPE, which will be 0 without v8.5-BTI. |
52 | +typedef void GVecGen3Fn(unsigned, uint32_t, uint32_t, | 43 | * < 0, set by the current instruction. |
53 | + uint32_t, uint32_t, uint32_t); | 44 | diff --git a/target/arm/helper.c b/target/arm/helper.c |
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 | ||
59 | index XXXXXXX..XXXXXXX 100644 | 45 | index XXXXXXX..XXXXXXX 100644 |
60 | --- a/target/arm/neon-dp.decode | 46 | --- a/target/arm/helper.c |
61 | +++ b/target/arm/neon-dp.decode | 47 | +++ b/target/arm/helper.c |
62 | @@ -XXX,XX +XXX,XX @@ | 48 | @@ -XXX,XX +XXX,XX @@ ARMMMUIdx arm_mmu_idx(CPUARMState *env) |
63 | # | 49 | return arm_mmu_idx_el(env, arm_current_el(env)); |
64 | # This file is processed by scripts/decodetree.py | ||
65 | # | ||
66 | +# VFP/Neon register fields; same as vfp.decode | ||
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 | + | ||
78 | +###################################################################### | ||
79 | +# 3-reg-same grouping: | ||
80 | +# 1111 001 U 0 D sz:2 Vn:4 Vd:4 opc:4 N Q M op Vm:4 | ||
81 | +###################################################################### | ||
82 | + | ||
83 | +&3same vm vn vd q size | ||
84 | + | ||
85 | +@3same .... ... . . . size:2 .... .... .... . q:1 . . .... \ | ||
86 | + &3same vm=%vm_dp vn=%vn_dp vd=%vd_dp | ||
87 | + | ||
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 | ||
91 | index XXXXXXX..XXXXXXX 100644 | ||
92 | --- a/target/arm/translate-neon.inc.c | ||
93 | +++ b/target/arm/translate-neon.inc.c | ||
94 | @@ -XXX,XX +XXX,XX @@ static bool trans_VLDST_single(DisasContext *s, arg_VLDST_single *a) | ||
95 | |||
96 | return true; | ||
97 | } | 50 | } |
98 | + | 51 | |
99 | +static bool do_3same(DisasContext *s, arg_3same *a, GVecGen3Fn fn) | 52 | +static inline bool fgt_svc(CPUARMState *env, int el) |
100 | +{ | 53 | +{ |
101 | + int vec_size = a->q ? 16 : 8; | 54 | + /* |
102 | + int rd_ofs = neon_reg_offset(a->vd, 0); | 55 | + * Assuming fine-grained-traps are active, return true if we |
103 | + int rn_ofs = neon_reg_offset(a->vn, 0); | 56 | + * should be trapping on SVC instructions. Only AArch64 can |
104 | + int rm_ofs = neon_reg_offset(a->vm, 0); | 57 | + * trap on an SVC at EL1, but we don't need to special-case this |
105 | + | 58 | + * because if this is AArch32 EL1 then arm_fgt_active() is false. |
106 | + if (!arm_dc_feature(s, ARM_FEATURE_NEON)) { | 59 | + * We also know el is 0 or 1. |
107 | + return false; | 60 | + */ |
108 | + } | 61 | + return el == 0 ? |
109 | + | 62 | + FIELD_EX64(env->cp15.fgt_exec[FGTREG_HFGITR], HFGITR_EL2, SVC_EL0) : |
110 | + /* UNDEF accesses to D16-D31 if they don't exist. */ | 63 | + FIELD_EX64(env->cp15.fgt_exec[FGTREG_HFGITR], HFGITR_EL2, SVC_EL1); |
111 | + if (!dc_isar_feature(aa32_simd_r32, s) && | ||
112 | + ((a->vd | a->vn | a->vm) & 0x10)) { | ||
113 | + return false; | ||
114 | + } | ||
115 | + | ||
116 | + if ((a->vn | a->vm | a->vd) & a->q) { | ||
117 | + return false; | ||
118 | + } | ||
119 | + | ||
120 | + if (!vfp_access_check(s)) { | ||
121 | + return true; | ||
122 | + } | ||
123 | + | ||
124 | + fn(a->size, rd_ofs, rn_ofs, rm_ofs, vec_size, vec_size); | ||
125 | + return true; | ||
126 | +} | 64 | +} |
127 | + | 65 | + |
128 | +#define DO_3SAME(INSN, FUNC) \ | 66 | static CPUARMTBFlags rebuild_hflags_common(CPUARMState *env, int fp_el, |
129 | + static bool trans_##INSN##_3s(DisasContext *s, arg_3same *a) \ | 67 | ARMMMUIdx mmu_idx, |
130 | + { \ | 68 | CPUARMTBFlags flags) |
131 | + return do_3same(s, a, FUNC); \ | 69 | @@ -XXX,XX +XXX,XX @@ static CPUARMTBFlags rebuild_hflags_a32(CPUARMState *env, int fp_el, |
132 | + } | 70 | |
133 | + | 71 | if (arm_fgt_active(env, el)) { |
134 | +DO_3SAME(VADD, tcg_gen_gvec_add) | 72 | DP_TBFLAG_ANY(flags, FGT_ACTIVE, 1); |
135 | +DO_3SAME(VSUB, tcg_gen_gvec_sub) | 73 | + if (fgt_svc(env, el)) { |
74 | + DP_TBFLAG_ANY(flags, FGT_SVC, 1); | ||
75 | + } | ||
76 | } | ||
77 | |||
78 | if (env->uncached_cpsr & CPSR_IL) { | ||
79 | @@ -XXX,XX +XXX,XX @@ static CPUARMTBFlags rebuild_hflags_a64(CPUARMState *env, int el, int fp_el, | ||
80 | if (FIELD_EX64(env->cp15.fgt_exec[FGTREG_HFGITR], HFGITR_EL2, ERET)) { | ||
81 | DP_TBFLAG_A64(flags, FGT_ERET, 1); | ||
82 | } | ||
83 | + if (fgt_svc(env, el)) { | ||
84 | + DP_TBFLAG_ANY(flags, FGT_SVC, 1); | ||
85 | + } | ||
86 | } | ||
87 | |||
88 | if (cpu_isar_feature(aa64_mte, env_archcpu(env))) { | ||
89 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c | ||
90 | index XXXXXXX..XXXXXXX 100644 | ||
91 | --- a/target/arm/translate-a64.c | ||
92 | +++ b/target/arm/translate-a64.c | ||
93 | @@ -XXX,XX +XXX,XX @@ static void disas_exc(DisasContext *s, uint32_t insn) | ||
94 | int opc = extract32(insn, 21, 3); | ||
95 | int op2_ll = extract32(insn, 0, 5); | ||
96 | int imm16 = extract32(insn, 5, 16); | ||
97 | + uint32_t syndrome; | ||
98 | |||
99 | switch (opc) { | ||
100 | case 0: | ||
101 | @@ -XXX,XX +XXX,XX @@ static void disas_exc(DisasContext *s, uint32_t insn) | ||
102 | */ | ||
103 | switch (op2_ll) { | ||
104 | case 1: /* SVC */ | ||
105 | + syndrome = syn_aa64_svc(imm16); | ||
106 | + if (s->fgt_svc) { | ||
107 | + gen_exception_insn_el(s, 0, EXCP_UDEF, syndrome, 2); | ||
108 | + break; | ||
109 | + } | ||
110 | gen_ss_advance(s); | ||
111 | - gen_exception_insn(s, 4, EXCP_SWI, syn_aa64_svc(imm16)); | ||
112 | + gen_exception_insn(s, 4, EXCP_SWI, syndrome); | ||
113 | break; | ||
114 | case 2: /* HVC */ | ||
115 | if (s->current_el == 0) { | ||
116 | @@ -XXX,XX +XXX,XX @@ static void aarch64_tr_init_disas_context(DisasContextBase *dcbase, | ||
117 | dc->align_mem = EX_TBFLAG_ANY(tb_flags, ALIGN_MEM); | ||
118 | dc->pstate_il = EX_TBFLAG_ANY(tb_flags, PSTATE__IL); | ||
119 | dc->fgt_active = EX_TBFLAG_ANY(tb_flags, FGT_ACTIVE); | ||
120 | + dc->fgt_svc = EX_TBFLAG_ANY(tb_flags, FGT_SVC); | ||
121 | dc->fgt_eret = EX_TBFLAG_A64(tb_flags, FGT_ERET); | ||
122 | dc->sve_excp_el = EX_TBFLAG_A64(tb_flags, SVEEXC_EL); | ||
123 | dc->sme_excp_el = EX_TBFLAG_A64(tb_flags, SMEEXC_EL); | ||
136 | diff --git a/target/arm/translate.c b/target/arm/translate.c | 124 | diff --git a/target/arm/translate.c b/target/arm/translate.c |
137 | index XXXXXXX..XXXXXXX 100644 | 125 | index XXXXXXX..XXXXXXX 100644 |
138 | --- a/target/arm/translate.c | 126 | --- a/target/arm/translate.c |
139 | +++ b/target/arm/translate.c | 127 | +++ b/target/arm/translate.c |
140 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) | 128 | @@ -XXX,XX +XXX,XX @@ static bool trans_SVC(DisasContext *s, arg_SVC *a) |
141 | } | 129 | (a->imm == semihost_imm)) { |
142 | return 0; | 130 | gen_exception_internal_insn(s, EXCP_SEMIHOST); |
143 | 131 | } else { | |
144 | - case NEON_3R_VADD_VSUB: | 132 | - gen_update_pc(s, curr_insn_len(s)); |
145 | - if (u) { | 133 | - s->svc_imm = a->imm; |
146 | - tcg_gen_gvec_sub(size, rd_ofs, rn_ofs, rm_ofs, | 134 | - s->base.is_jmp = DISAS_SWI; |
147 | - vec_size, vec_size); | 135 | + if (s->fgt_svc) { |
148 | - } else { | 136 | + uint32_t syndrome = syn_aa32_svc(a->imm, s->thumb); |
149 | - tcg_gen_gvec_add(size, rd_ofs, rn_ofs, rm_ofs, | 137 | + gen_exception_insn_el(s, 0, EXCP_UDEF, syndrome, 2); |
150 | - vec_size, vec_size); | 138 | + } else { |
151 | - } | 139 | + gen_update_pc(s, curr_insn_len(s)); |
152 | - return 0; | 140 | + s->svc_imm = a->imm; |
153 | - | 141 | + s->base.is_jmp = DISAS_SWI; |
154 | case NEON_3R_VQADD: | 142 | + } |
155 | tcg_gen_gvec_4(rd_ofs, offsetof(CPUARMState, vfp.qc), | 143 | } |
156 | rn_ofs, rm_ofs, vec_size, vec_size, | 144 | return true; |
157 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) | 145 | } |
158 | tcg_gen_gvec_3(rd_ofs, rm_ofs, rn_ofs, vec_size, vec_size, | 146 | @@ -XXX,XX +XXX,XX @@ static void arm_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs) |
159 | u ? &ushl_op[size] : &sshl_op[size]); | 147 | dc->align_mem = EX_TBFLAG_ANY(tb_flags, ALIGN_MEM); |
160 | return 0; | 148 | dc->pstate_il = EX_TBFLAG_ANY(tb_flags, PSTATE__IL); |
161 | + | 149 | dc->fgt_active = EX_TBFLAG_ANY(tb_flags, FGT_ACTIVE); |
162 | + case NEON_3R_VADD_VSUB: | 150 | + dc->fgt_svc = EX_TBFLAG_ANY(tb_flags, FGT_SVC); |
163 | + /* Already handled by decodetree */ | 151 | |
164 | + return 1; | 152 | if (arm_feature(env, ARM_FEATURE_M)) { |
165 | } | 153 | dc->vfp_enabled = 1; |
166 | |||
167 | if (size == 3) { | ||
168 | -- | 154 | -- |
169 | 2.20.1 | 155 | 2.34.1 |
170 | |||
171 | diff view generated by jsdifflib |
1 | Convert the Neon "load/store single structure to one lane" insns to | 1 | FEAT_FGT also implements an extra trap bit in the MDCR_EL2 and |
---|---|---|---|
2 | decodetree. | 2 | MDCR_EL3 registers: bit TDCC enables trapping of use of the Debug |
3 | Comms Channel registers OSDTRRX_EL1, OSDTRTX_EL1, MDCCSR_EL0, | ||
4 | MDCCINT_EL0, DBGDTR_EL0, DBGDTRRX_EL0 and DBGDTRTX_EL0 (and their | ||
5 | AArch32 equivalents). This trapping is independent of whether | ||
6 | fine-grained traps are enabled or not. | ||
3 | 7 | ||
4 | As this is the last set of insns in the neon load/store group, | 8 | Implement these extra traps. (We don't implement DBGDTR_EL0, |
5 | we can remove the whole disas_neon_ls_insn() function. | 9 | DBGDTRRX_EL0 and DBGDTRTX_EL0.) |
6 | 10 | ||
7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
8 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 12 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
9 | Message-id: 20200430181003.21682-14-peter.maydell@linaro.org | 13 | Tested-by: Fuad Tabba <tabba@google.com> |
14 | Message-id: 20230130182459.3309057-23-peter.maydell@linaro.org | ||
15 | Message-id: 20230127175507.2895013-23-peter.maydell@linaro.org | ||
10 | --- | 16 | --- |
11 | target/arm/neon-ls.decode | 11 +++ | 17 | target/arm/debug_helper.c | 35 +++++++++++++++++++++++++++++++---- |
12 | target/arm/translate-neon.inc.c | 89 +++++++++++++++++++ | 18 | 1 file changed, 31 insertions(+), 4 deletions(-) |
13 | target/arm/translate.c | 147 -------------------------------- | ||
14 | 3 files changed, 100 insertions(+), 147 deletions(-) | ||
15 | 19 | ||
16 | diff --git a/target/arm/neon-ls.decode b/target/arm/neon-ls.decode | 20 | diff --git a/target/arm/debug_helper.c b/target/arm/debug_helper.c |
17 | index XXXXXXX..XXXXXXX 100644 | 21 | index XXXXXXX..XXXXXXX 100644 |
18 | --- a/target/arm/neon-ls.decode | 22 | --- a/target/arm/debug_helper.c |
19 | +++ b/target/arm/neon-ls.decode | 23 | +++ b/target/arm/debug_helper.c |
20 | @@ -XXX,XX +XXX,XX @@ VLDST_multiple 1111 0100 0 . l:1 0 rn:4 .... itype:4 size:2 align:2 rm:4 \ | 24 | @@ -XXX,XX +XXX,XX @@ static CPAccessResult access_tda(CPUARMState *env, const ARMCPRegInfo *ri, |
21 | 25 | return CP_ACCESS_OK; | |
22 | VLD_all_lanes 1111 0100 1 . 1 0 rn:4 .... 11 n:2 size:2 t:1 a:1 rm:4 \ | 26 | } |
23 | vd=%vd_dp | 27 | |
28 | +/* | ||
29 | + * Check for traps to Debug Comms Channel registers. If FEAT_FGT | ||
30 | + * is implemented then these are controlled by MDCR_EL2.TDCC for | ||
31 | + * EL2 and MDCR_EL3.TDCC for EL3. They are also controlled by | ||
32 | + * the general debug access trap bits MDCR_EL2.TDA and MDCR_EL3.TDA. | ||
33 | + */ | ||
34 | +static CPAccessResult access_tdcc(CPUARMState *env, const ARMCPRegInfo *ri, | ||
35 | + bool isread) | ||
36 | +{ | ||
37 | + int el = arm_current_el(env); | ||
38 | + uint64_t mdcr_el2 = arm_mdcr_el2_eff(env); | ||
39 | + bool mdcr_el2_tda = (mdcr_el2 & MDCR_TDA) || (mdcr_el2 & MDCR_TDE) || | ||
40 | + (arm_hcr_el2_eff(env) & HCR_TGE); | ||
41 | + bool mdcr_el2_tdcc = cpu_isar_feature(aa64_fgt, env_archcpu(env)) && | ||
42 | + (mdcr_el2 & MDCR_TDCC); | ||
43 | + bool mdcr_el3_tdcc = cpu_isar_feature(aa64_fgt, env_archcpu(env)) && | ||
44 | + (env->cp15.mdcr_el3 & MDCR_TDCC); | ||
24 | + | 45 | + |
25 | +# Neon load/store single structure to one lane | 46 | + if (el < 2 && (mdcr_el2_tda || mdcr_el2_tdcc)) { |
26 | +%imm1_5_p1 5:1 !function=plus1 | 47 | + return CP_ACCESS_TRAP_EL2; |
27 | +%imm1_6_p1 6:1 !function=plus1 | 48 | + } |
28 | + | 49 | + if (el < 3 && ((env->cp15.mdcr_el3 & MDCR_TDA) || mdcr_el3_tdcc)) { |
29 | +VLDST_single 1111 0100 1 . l:1 0 rn:4 .... 00 n:2 reg_idx:3 align:1 rm:4 \ | 50 | + return CP_ACCESS_TRAP_EL3; |
30 | + vd=%vd_dp size=0 stride=1 | 51 | + } |
31 | +VLDST_single 1111 0100 1 . l:1 0 rn:4 .... 01 n:2 reg_idx:2 align:2 rm:4 \ | 52 | + return CP_ACCESS_OK; |
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 | ||
36 | index XXXXXXX..XXXXXXX 100644 | ||
37 | --- a/target/arm/translate-neon.inc.c | ||
38 | +++ b/target/arm/translate-neon.inc.c | ||
39 | @@ -XXX,XX +XXX,XX @@ | ||
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 | +} | 53 | +} |
47 | + | 54 | + |
48 | /* Include the generated Neon decoder */ | 55 | static void oslar_write(CPUARMState *env, const ARMCPRegInfo *ri, |
49 | #include "decode-neon-dp.inc.c" | 56 | uint64_t value) |
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 | |||
53 | return true; | ||
54 | } | ||
55 | + | ||
56 | +static bool trans_VLDST_single(DisasContext *s, arg_VLDST_single *a) | ||
57 | +{ | ||
58 | + /* Neon load/store single structure to one lane */ | ||
59 | + int reg; | ||
60 | + int nregs = a->n + 1; | ||
61 | + int vd = a->vd; | ||
62 | + TCGv_i32 addr, tmp; | ||
63 | + | ||
64 | + if (!arm_dc_feature(s, ARM_FEATURE_NEON)) { | ||
65 | + return false; | ||
66 | + } | ||
67 | + | ||
68 | + /* UNDEF accesses to D16-D31 if they don't exist */ | ||
69 | + if (!dc_isar_feature(aa32_simd_r32, s) && (a->vd & 0x10)) { | ||
70 | + return false; | ||
71 | + } | ||
72 | + | ||
73 | + /* Catch the UNDEF cases. This is unavoidably a bit messy. */ | ||
74 | + switch (nregs) { | ||
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 | + } | ||
99 | + if ((vd + a->stride * (nregs - 1)) > 31) { | ||
100 | + /* | ||
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; | ||
106 | + } | ||
107 | + | ||
108 | + if (!vfp_access_check(s)) { | ||
109 | + return true; | ||
110 | + } | ||
111 | + | ||
112 | + tmp = tcg_temp_new_i32(); | ||
113 | + addr = tcg_temp_new_i32(); | ||
114 | + load_reg_var(s, addr, a->rn); | ||
115 | + /* | ||
116 | + * TODO: if we implemented alignment exceptions, we should check | ||
117 | + * addr against the alignment encoded in a->align here. | ||
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 | + } | ||
129 | + vd += a->stride; | ||
130 | + tcg_gen_addi_i32(addr, addr, 1 << a->size); | ||
131 | + } | ||
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; | ||
138 | +} | ||
139 | diff --git a/target/arm/translate.c b/target/arm/translate.c | ||
140 | index XXXXXXX..XXXXXXX 100644 | ||
141 | --- a/target/arm/translate.c | ||
142 | +++ b/target/arm/translate.c | ||
143 | @@ -XXX,XX +XXX,XX @@ static void gen_neon_trn_u16(TCGv_i32 t0, TCGv_i32 t1) | ||
144 | tcg_temp_free_i32(rd); | ||
145 | } | ||
146 | |||
147 | - | ||
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 | -{ | ||
152 | - int rd, rn, rm; | ||
153 | - int nregs; | ||
154 | - int stride; | ||
155 | - int size; | ||
156 | - int reg; | ||
157 | - int load; | ||
158 | - TCGv_i32 addr; | ||
159 | - TCGv_i32 tmp; | ||
160 | - | ||
161 | - if (!arm_dc_feature(s, ARM_FEATURE_NEON)) { | ||
162 | - return 1; | ||
163 | - } | ||
164 | - | ||
165 | - /* FIXME: this access check should not take precedence over UNDEF | ||
166 | - * for invalid encodings; we will generate incorrect syndrome information | ||
167 | - * for attempts to execute invalid vfp/neon encodings with FP disabled. | ||
168 | - */ | ||
169 | - if (s->fp_excp_el) { | ||
170 | - gen_exception_insn(s, s->pc_curr, EXCP_UDEF, | ||
171 | - syn_simd_access_trap(1, 0xe, false), s->fp_excp_el); | ||
172 | - return 0; | ||
173 | - } | ||
174 | - | ||
175 | - if (!s->vfp_enabled) | ||
176 | - return 1; | ||
177 | - VFP_DREG_D(rd, insn); | ||
178 | - rn = (insn >> 16) & 0xf; | ||
179 | - rm = insn & 0xf; | ||
180 | - load = (insn & (1 << 21)) != 0; | ||
181 | - if ((insn & (1 << 23)) == 0) { | ||
182 | - /* Load store all elements -- handled already by decodetree */ | ||
183 | - return 1; | ||
184 | - } else { | ||
185 | - size = (insn >> 10) & 3; | ||
186 | - if (size == 3) { | ||
187 | - /* Load single element to all lanes -- handled by decodetree */ | ||
188 | - return 1; | ||
189 | - } else { | ||
190 | - /* Single element. */ | ||
191 | - int idx = (insn >> 4) & 0xf; | ||
192 | - int reg_idx; | ||
193 | - switch (size) { | ||
194 | - case 0: | ||
195 | - reg_idx = (insn >> 5) & 7; | ||
196 | - stride = 1; | ||
197 | - break; | ||
198 | - case 1: | ||
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; | ||
216 | - } | ||
217 | - break; | ||
218 | - case 3: | ||
219 | - if ((idx & 1) != 0) { | ||
220 | - return 1; | ||
221 | - } | ||
222 | - /* fall through */ | ||
223 | - case 2: | ||
224 | - if (size == 2 && (idx & 2) != 0) { | ||
225 | - return 1; | ||
226 | - } | ||
227 | - break; | ||
228 | - case 4: | ||
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; | ||
242 | - } | ||
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 | - } | ||
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 | - } | ||
278 | - return 0; | ||
279 | -} | ||
280 | - | ||
281 | static inline void gen_neon_narrow(int size, TCGv_i32 dest, TCGv_i64 src) | ||
282 | { | 57 | { |
283 | switch (size) { | 58 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo debug_cp_reginfo[] = { |
284 | @@ -XXX,XX +XXX,XX @@ static void disas_arm_insn(DisasContext *s, unsigned int insn) | 59 | */ |
285 | } | 60 | { .name = "MDCCSR_EL0", .state = ARM_CP_STATE_AA64, |
286 | return; | 61 | .opc0 = 2, .opc1 = 3, .crn = 0, .crm = 1, .opc2 = 0, |
287 | } | 62 | - .access = PL0_R, .accessfn = access_tda, |
288 | - if ((insn & 0x0f100000) == 0x04000000) { | 63 | + .access = PL0_R, .accessfn = access_tdcc, |
289 | - /* NEON load/store. */ | 64 | .type = ARM_CP_CONST, .resetvalue = 0 }, |
290 | - if (disas_neon_ls_insn(s, insn)) { | 65 | /* |
291 | - goto illegal_op; | 66 | * OSDTRRX_EL1/OSDTRTX_EL1 are used for save and restore of DBGDTRRX_EL0. |
292 | - } | 67 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo debug_cp_reginfo[] = { |
293 | - return; | 68 | */ |
294 | - } | 69 | { .name = "OSDTRRX_EL1", .state = ARM_CP_STATE_BOTH, .cp = 14, |
295 | if ((insn & 0x0e000f00) == 0x0c000100) { | 70 | .opc0 = 2, .opc1 = 0, .crn = 0, .crm = 0, .opc2 = 2, |
296 | if (arm_dc_feature(s, ARM_FEATURE_IWMMXT)) { | 71 | - .access = PL1_RW, .accessfn = access_tda, |
297 | /* iWMMXt register transfer. */ | 72 | + .access = PL1_RW, .accessfn = access_tdcc, |
298 | @@ -XXX,XX +XXX,XX @@ static void disas_thumb2_insn(DisasContext *s, uint32_t insn) | 73 | .type = ARM_CP_CONST, .resetvalue = 0 }, |
299 | } | 74 | { .name = "OSDTRTX_EL1", .state = ARM_CP_STATE_BOTH, .cp = 14, |
300 | break; | 75 | .opc0 = 2, .opc1 = 0, .crn = 0, .crm = 3, .opc2 = 2, |
301 | case 12: | 76 | - .access = PL1_RW, .accessfn = access_tda, |
302 | - if ((insn & 0x01100000) == 0x01000000) { | 77 | + .access = PL1_RW, .accessfn = access_tdcc, |
303 | - if (disas_neon_ls_insn(s, insn)) { | 78 | .type = ARM_CP_CONST, .resetvalue = 0 }, |
304 | - goto illegal_op; | 79 | /* |
305 | - } | 80 | * OSECCR_EL1 provides a mechanism for an operating system |
306 | - break; | 81 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo debug_cp_reginfo[] = { |
307 | - } | 82 | */ |
308 | goto illegal_op; | 83 | { .name = "MDCCINT_EL1", .state = ARM_CP_STATE_BOTH, |
309 | default: | 84 | .cp = 14, .opc0 = 2, .opc1 = 0, .crn = 0, .crm = 2, .opc2 = 0, |
310 | illegal_op: | 85 | - .access = PL1_RW, .accessfn = access_tda, |
86 | + .access = PL1_RW, .accessfn = access_tdcc, | ||
87 | .type = ARM_CP_NOP }, | ||
88 | /* | ||
89 | * Dummy DBGCLAIM registers. | ||
311 | -- | 90 | -- |
312 | 2.20.1 | 91 | 2.34.1 |
313 | |||
314 | diff view generated by jsdifflib |
1 | In aarch64_max_initfn() we update both 32-bit and 64-bit ID | 1 | Update the ID registers for TCG's '-cpu max' to report the |
---|---|---|---|
2 | registers. The intended pattern is that for 64-bit ID registers we | 2 | presence of FEAT_FGT Fine-Grained Traps support. |
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 | 3 | ||
10 | Use the right-sized variable. | 4 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
5 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
6 | Tested-by: Fuad Tabba <tabba@google.com> | ||
7 | Message-id: 20230130182459.3309057-24-peter.maydell@linaro.org | ||
8 | Message-id: 20230127175507.2895013-24-peter.maydell@linaro.org | ||
9 | --- | ||
10 | docs/system/arm/emulation.rst | 1 + | ||
11 | target/arm/cpu64.c | 1 + | ||
12 | 2 files changed, 2 insertions(+) | ||
11 | 13 | ||
12 | Fixes: 3bec78447a958d481991 | 14 | diff --git a/docs/system/arm/emulation.rst b/docs/system/arm/emulation.rst |
13 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 15 | index XXXXXXX..XXXXXXX 100644 |
14 | Reviewed-by: Laurent Desnogues <laurent.desnogues@gmail.com> | 16 | --- a/docs/system/arm/emulation.rst |
15 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 17 | +++ b/docs/system/arm/emulation.rst |
16 | Message-id: 20200423110915.10527-1-peter.maydell@linaro.org | 18 | @@ -XXX,XX +XXX,XX @@ the following architecture extensions: |
17 | --- | 19 | - FEAT_ETS (Enhanced Translation Synchronization) |
18 | target/arm/cpu64.c | 6 +++--- | 20 | - FEAT_EVT (Enhanced Virtualization Traps) |
19 | 1 file changed, 3 insertions(+), 3 deletions(-) | 21 | - FEAT_FCMA (Floating-point complex number instructions) |
20 | 22 | +- FEAT_FGT (Fine-Grained Traps) | |
23 | - FEAT_FHM (Floating-point half-precision multiplication instructions) | ||
24 | - FEAT_FP16 (Half-precision floating-point data processing) | ||
25 | - FEAT_FRINTTS (Floating-point to integer instructions) | ||
21 | diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c | 26 | diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c |
22 | index XXXXXXX..XXXXXXX 100644 | 27 | index XXXXXXX..XXXXXXX 100644 |
23 | --- a/target/arm/cpu64.c | 28 | --- a/target/arm/cpu64.c |
24 | +++ b/target/arm/cpu64.c | 29 | +++ b/target/arm/cpu64.c |
25 | @@ -XXX,XX +XXX,XX @@ static void aarch64_max_initfn(Object *obj) | 30 | @@ -XXX,XX +XXX,XX @@ static void aarch64_max_initfn(Object *obj) |
26 | u = FIELD_DP32(u, ID_MMFR4, XNX, 1); /* TTS2UXN */ | 31 | t = FIELD_DP64(t, ID_AA64MMFR0, TGRAN16_2, 2); /* 16k stage2 supported */ |
27 | cpu->isar.id_mmfr4 = u; | 32 | t = FIELD_DP64(t, ID_AA64MMFR0, TGRAN64_2, 2); /* 64k stage2 supported */ |
28 | 33 | t = FIELD_DP64(t, ID_AA64MMFR0, TGRAN4_2, 2); /* 4k stage2 supported */ | |
29 | - u = cpu->isar.id_aa64dfr0; | 34 | + t = FIELD_DP64(t, ID_AA64MMFR0, FGT, 1); /* FEAT_FGT */ |
30 | - u = FIELD_DP64(u, ID_AA64DFR0, PMUVER, 5); /* v8.4-PMU */ | 35 | cpu->isar.id_aa64mmfr0 = t; |
31 | - cpu->isar.id_aa64dfr0 = u; | 36 | |
32 | + t = cpu->isar.id_aa64dfr0; | 37 | t = cpu->isar.id_aa64mmfr1; |
33 | + t = FIELD_DP64(t, ID_AA64DFR0, PMUVER, 5); /* v8.4-PMU */ | ||
34 | + cpu->isar.id_aa64dfr0 = t; | ||
35 | |||
36 | u = cpu->isar.id_dfr0; | ||
37 | u = FIELD_DP32(u, ID_DFR0, PERFMON, 5); /* v8.4-PMU */ | ||
38 | -- | 38 | -- |
39 | 2.20.1 | 39 | 2.34.1 |
40 | |||
41 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
2 | 1 | ||
3 | MIDR_EL1 is a 64-bit system register with the top 32-bit being RES0. | ||
4 | Represent it in QEMU's ARMCPU struct with a uint64_t, not a | ||
5 | uint32_t. | ||
6 | |||
7 | This fixes an error when compiling with -Werror=conversion | ||
8 | because we were manipulating the register value using a | ||
9 | local uint64_t variable: | ||
10 | |||
11 | target/arm/cpu64.c: In function ‘aarch64_max_initfn’: | ||
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 | |||
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> | ||
22 | Reviewed-by: Laurent Desnogues <laurent.desnogues@gmail.com> | ||
23 | Message-id: 20200428172634.29707-1-f4bug@amsat.org | ||
24 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
25 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
26 | --- | ||
27 | target/arm/cpu.h | 2 +- | ||
28 | target/arm/cpu.c | 2 +- | ||
29 | 2 files changed, 2 insertions(+), 2 deletions(-) | ||
30 | |||
31 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h | ||
32 | index XXXXXXX..XXXXXXX 100644 | ||
33 | --- a/target/arm/cpu.h | ||
34 | +++ b/target/arm/cpu.h | ||
35 | @@ -XXX,XX +XXX,XX @@ struct ARMCPU { | ||
36 | uint64_t id_aa64dfr0; | ||
37 | uint64_t id_aa64dfr1; | ||
38 | } isar; | ||
39 | - uint32_t midr; | ||
40 | + uint64_t midr; | ||
41 | uint32_t revidr; | ||
42 | uint32_t reset_fpsid; | ||
43 | uint32_t ctr; | ||
44 | diff --git a/target/arm/cpu.c b/target/arm/cpu.c | ||
45 | index XXXXXXX..XXXXXXX 100644 | ||
46 | --- a/target/arm/cpu.c | ||
47 | +++ b/target/arm/cpu.c | ||
48 | @@ -XXX,XX +XXX,XX @@ static const ARMCPUInfo arm_cpus[] = { | ||
49 | static Property arm_cpu_properties[] = { | ||
50 | DEFINE_PROP_BOOL("start-powered-off", ARMCPU, start_powered_off, false), | ||
51 | DEFINE_PROP_UINT32("psci-conduit", ARMCPU, psci_conduit, 0), | ||
52 | - DEFINE_PROP_UINT32("midr", ARMCPU, midr, 0), | ||
53 | + DEFINE_PROP_UINT64("midr", ARMCPU, midr, 0), | ||
54 | DEFINE_PROP_UINT64("mp-affinity", ARMCPU, | ||
55 | mp_affinity, ARM64_AFFINITY_INVALID), | ||
56 | DEFINE_PROP_INT32("node-id", ARMCPU, node_id, CPU_UNSET_NUMA_NODE_ID), | ||
57 | -- | ||
58 | 2.20.1 | ||
59 | |||
60 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com> | ||
2 | 1 | ||
3 | Embed the UARTs into the SoC type. | ||
4 | |||
5 | Suggested-by: Peter Maydell <peter.maydell@linaro.org> | ||
6 | Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | ||
7 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | ||
8 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
9 | Reviewed-by: Luc Michel <luc.michel@greensocs.com> | ||
10 | Message-id: 20200427181649.26851-5-edgar.iglesias@gmail.com | ||
11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
12 | --- | ||
13 | include/hw/arm/xlnx-versal.h | 3 ++- | ||
14 | hw/arm/xlnx-versal.c | 12 ++++++------ | ||
15 | 2 files changed, 8 insertions(+), 7 deletions(-) | ||
16 | |||
17 | diff --git a/include/hw/arm/xlnx-versal.h b/include/hw/arm/xlnx-versal.h | ||
18 | index XXXXXXX..XXXXXXX 100644 | ||
19 | --- a/include/hw/arm/xlnx-versal.h | ||
20 | +++ b/include/hw/arm/xlnx-versal.h | ||
21 | @@ -XXX,XX +XXX,XX @@ | ||
22 | #include "hw/sysbus.h" | ||
23 | #include "hw/arm/boot.h" | ||
24 | #include "hw/intc/arm_gicv3.h" | ||
25 | +#include "hw/char/pl011.h" | ||
26 | |||
27 | #define TYPE_XLNX_VERSAL "xlnx-versal" | ||
28 | #define XLNX_VERSAL(obj) OBJECT_CHECK(Versal, (obj), TYPE_XLNX_VERSAL) | ||
29 | @@ -XXX,XX +XXX,XX @@ typedef struct Versal { | ||
30 | MemoryRegion mr_ocm; | ||
31 | |||
32 | struct { | ||
33 | - SysBusDevice *uart[XLNX_VERSAL_NR_UARTS]; | ||
34 | + PL011State uart[XLNX_VERSAL_NR_UARTS]; | ||
35 | SysBusDevice *gem[XLNX_VERSAL_NR_GEMS]; | ||
36 | SysBusDevice *adma[XLNX_VERSAL_NR_ADMAS]; | ||
37 | } iou; | ||
38 | diff --git a/hw/arm/xlnx-versal.c b/hw/arm/xlnx-versal.c | ||
39 | index XXXXXXX..XXXXXXX 100644 | ||
40 | --- a/hw/arm/xlnx-versal.c | ||
41 | +++ b/hw/arm/xlnx-versal.c | ||
42 | @@ -XXX,XX +XXX,XX @@ | ||
43 | #include "kvm_arm.h" | ||
44 | #include "hw/misc/unimp.h" | ||
45 | #include "hw/arm/xlnx-versal.h" | ||
46 | -#include "hw/char/pl011.h" | ||
47 | |||
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 | } | ||
72 | } | ||
73 | -- | ||
74 | 2.20.1 | ||
75 | |||
76 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com> | ||
2 | 1 | ||
3 | Embed the GEMs into the SoC type. | ||
4 | |||
5 | Suggested-by: Peter Maydell <peter.maydell@linaro.org> | ||
6 | Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | ||
7 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | ||
8 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.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> | ||
12 | --- | ||
13 | include/hw/arm/xlnx-versal.h | 3 ++- | ||
14 | hw/arm/xlnx-versal.c | 15 ++++++++------- | ||
15 | 2 files changed, 10 insertions(+), 8 deletions(-) | ||
16 | |||
17 | diff --git a/include/hw/arm/xlnx-versal.h b/include/hw/arm/xlnx-versal.h | ||
18 | index XXXXXXX..XXXXXXX 100644 | ||
19 | --- a/include/hw/arm/xlnx-versal.h | ||
20 | +++ b/include/hw/arm/xlnx-versal.h | ||
21 | @@ -XXX,XX +XXX,XX @@ | ||
22 | #include "hw/arm/boot.h" | ||
23 | #include "hw/intc/arm_gicv3.h" | ||
24 | #include "hw/char/pl011.h" | ||
25 | +#include "hw/net/cadence_gem.h" | ||
26 | |||
27 | #define TYPE_XLNX_VERSAL "xlnx-versal" | ||
28 | #define XLNX_VERSAL(obj) OBJECT_CHECK(Versal, (obj), TYPE_XLNX_VERSAL) | ||
29 | @@ -XXX,XX +XXX,XX @@ typedef struct Versal { | ||
30 | |||
31 | struct { | ||
32 | PL011State uart[XLNX_VERSAL_NR_UARTS]; | ||
33 | - SysBusDevice *gem[XLNX_VERSAL_NR_GEMS]; | ||
34 | + CadenceGEMState gem[XLNX_VERSAL_NR_GEMS]; | ||
35 | SysBusDevice *adma[XLNX_VERSAL_NR_ADMAS]; | ||
36 | } iou; | ||
37 | } lpd; | ||
38 | diff --git a/hw/arm/xlnx-versal.c b/hw/arm/xlnx-versal.c | ||
39 | index XXXXXXX..XXXXXXX 100644 | ||
40 | --- a/hw/arm/xlnx-versal.c | ||
41 | +++ b/hw/arm/xlnx-versal.c | ||
42 | @@ -XXX,XX +XXX,XX @@ static void versal_create_gems(Versal *s, qemu_irq *pic) | ||
43 | DeviceState *dev; | ||
44 | MemoryRegion *mr; | ||
45 | |||
46 | - dev = qdev_create(NULL, "cadence_gem"); | ||
47 | - s->lpd.iou.gem[i] = SYS_BUS_DEVICE(dev); | ||
48 | - object_property_add_child(OBJECT(s), name, OBJECT(dev), &error_fatal); | ||
49 | + sysbus_init_child_obj(OBJECT(s), name, | ||
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 | -- | ||
77 | 2.20.1 | ||
78 | |||
79 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com> | ||
2 | 1 | ||
3 | Embed the ADMAs into the SoC type. | ||
4 | |||
5 | Suggested-by: Peter Maydell <peter.maydell@linaro.org> | ||
6 | Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | ||
7 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | ||
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> | ||
12 | --- | ||
13 | include/hw/arm/xlnx-versal.h | 3 ++- | ||
14 | hw/arm/xlnx-versal.c | 14 +++++++------- | ||
15 | 2 files changed, 9 insertions(+), 8 deletions(-) | ||
16 | |||
17 | diff --git a/include/hw/arm/xlnx-versal.h b/include/hw/arm/xlnx-versal.h | ||
18 | index XXXXXXX..XXXXXXX 100644 | ||
19 | --- a/include/hw/arm/xlnx-versal.h | ||
20 | +++ b/include/hw/arm/xlnx-versal.h | ||
21 | @@ -XXX,XX +XXX,XX @@ | ||
22 | #include "hw/arm/boot.h" | ||
23 | #include "hw/intc/arm_gicv3.h" | ||
24 | #include "hw/char/pl011.h" | ||
25 | +#include "hw/dma/xlnx-zdma.h" | ||
26 | #include "hw/net/cadence_gem.h" | ||
27 | |||
28 | #define TYPE_XLNX_VERSAL "xlnx-versal" | ||
29 | @@ -XXX,XX +XXX,XX @@ typedef struct Versal { | ||
30 | struct { | ||
31 | PL011State uart[XLNX_VERSAL_NR_UARTS]; | ||
32 | CadenceGEMState gem[XLNX_VERSAL_NR_GEMS]; | ||
33 | - SysBusDevice *adma[XLNX_VERSAL_NR_ADMAS]; | ||
34 | + XlnxZDMA adma[XLNX_VERSAL_NR_ADMAS]; | ||
35 | } iou; | ||
36 | } lpd; | ||
37 | |||
38 | diff --git a/hw/arm/xlnx-versal.c b/hw/arm/xlnx-versal.c | ||
39 | index XXXXXXX..XXXXXXX 100644 | ||
40 | --- a/hw/arm/xlnx-versal.c | ||
41 | +++ b/hw/arm/xlnx-versal.c | ||
42 | @@ -XXX,XX +XXX,XX @@ static void versal_create_admas(Versal *s, qemu_irq *pic) | ||
43 | DeviceState *dev; | ||
44 | MemoryRegion *mr; | ||
45 | |||
46 | - dev = qdev_create(NULL, "xlnx.zdma"); | ||
47 | - s->lpd.iou.adma[i] = SYS_BUS_DEVICE(dev); | ||
48 | - object_property_set_int(OBJECT(s->lpd.iou.adma[i]), 128, "bus-width", | ||
49 | - &error_abort); | ||
50 | - object_property_add_child(OBJECT(s), name, OBJECT(dev), &error_fatal); | ||
51 | + sysbus_init_child_obj(OBJECT(s), name, | ||
52 | + &s->lpd.iou.adma[i], sizeof(s->lpd.iou.adma[i]), | ||
53 | + TYPE_XLNX_ZDMA); | ||
54 | + dev = DEVICE(&s->lpd.iou.adma[i]); | ||
55 | + object_property_set_int(OBJECT(dev), 128, "bus-width", &error_abort); | ||
56 | qdev_init_nofail(dev); | ||
57 | |||
58 | - mr = sysbus_mmio_get_region(s->lpd.iou.adma[i], 0); | ||
59 | + mr = sysbus_mmio_get_region(SYS_BUS_DEVICE(dev), 0); | ||
60 | memory_region_add_subregion(&s->mr_ps, | ||
61 | MM_ADMA_CH0 + i * MM_ADMA_CH0_SIZE, mr); | ||
62 | |||
63 | - sysbus_connect_irq(s->lpd.iou.adma[i], 0, pic[VERSAL_ADMA_IRQ_0 + i]); | ||
64 | + sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, pic[VERSAL_ADMA_IRQ_0 + i]); | ||
65 | g_free(name); | ||
66 | } | ||
67 | } | ||
68 | -- | ||
69 | 2.20.1 | ||
70 | |||
71 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | Somewhere along theline we accidentally added a duplicate | ||
2 | "using D16-D31 when they don't exist" check to do_vfm_dp() | ||
3 | (probably an artifact of a patchseries rebase). Remove it. | ||
4 | 1 | ||
5 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
6 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
8 | Message-id: 20200430181003.21682-2-peter.maydell@linaro.org | ||
9 | --- | ||
10 | target/arm/translate-vfp.inc.c | 6 ------ | ||
11 | 1 file changed, 6 deletions(-) | ||
12 | |||
13 | diff --git a/target/arm/translate-vfp.inc.c b/target/arm/translate-vfp.inc.c | ||
14 | index XXXXXXX..XXXXXXX 100644 | ||
15 | --- a/target/arm/translate-vfp.inc.c | ||
16 | +++ 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) | ||
18 | return false; | ||
19 | } | ||
20 | |||
21 | - /* UNDEF accesses to D16-D31 if they don't exist. */ | ||
22 | - if (!dc_isar_feature(aa32_simd_r32, s) && | ||
23 | - ((a->vd | a->vn | a->vm) & 0x10)) { | ||
24 | - return false; | ||
25 | - } | ||
26 | - | ||
27 | if (!vfp_access_check(s)) { | ||
28 | return true; | ||
29 | } | ||
30 | -- | ||
31 | 2.20.1 | ||
32 | |||
33 | diff view generated by jsdifflib |