1 | Most of this is the Neon decodetree patches, followed by Edgar's versal cleanups. | 1 | Hi; this pullreq contains mainly a chunk of RTH's refactoring |
---|---|---|---|
2 | of the Arm pagetable walk code, plus a series from me fixing | ||
3 | configure checkpatch warnings, and some old patches to various | ||
4 | files all over the tree getting rid of dynamic stack allocation. | ||
2 | 5 | ||
3 | thanks | 6 | thanks |
4 | -- PMM | 7 | -- PMM |
5 | 8 | ||
9 | The following changes since commit 6338c30111d596d955e6bc933a82184a0b910c43: | ||
6 | 10 | ||
7 | The following changes since commit 2ef486e76d64436be90f7359a3071fb2a56ce835: | 11 | Merge tag 'm68k-for-7.2-pull-request' of https://github.com/vivier/qemu-m68k into staging (2022-09-21 13:12:36 -0400) |
8 | |||
9 | Merge remote-tracking branch 'remotes/marcel/tags/rdma-pull-request' into staging (2020-05-03 14:12:56 +0100) | ||
10 | 12 | ||
11 | are available in the Git repository at: | 13 | are available in the Git repository at: |
12 | 14 | ||
13 | https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20200504 | 15 | https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20220922 |
14 | 16 | ||
15 | for you to fetch changes up to 9aefc6cf9b73f66062d2f914a0136756e7a28211: | 17 | for you to fetch changes up to b3b5472db0ab7a53499441c1fe1dedec05b1e285: |
16 | 18 | ||
17 | target/arm: Move gen_ function typedefs to translate.h (2020-05-04 12:59:26 +0100) | 19 | configure: Avoid use of 'local' as it is non-POSIX (2022-09-22 16:38:29 +0100) |
18 | 20 | ||
19 | ---------------------------------------------------------------- | 21 | ---------------------------------------------------------------- |
20 | target-arm queue: | 22 | target-arm queue: |
21 | * Start of conversion of Neon insns to decodetree | 23 | * hw/net/can: fix Xilinx ZynqMP CAN RX FIFO logic |
22 | * versal board: support SD and RTC | 24 | * Fix alignment for Neon VLD4.32 |
23 | * Implement ARMv8.2-TTS2UXN | 25 | * Refactoring of page-table-walk code |
24 | * Make VQDMULL undefined when U=1 | 26 | * hw/acpi: Add ospm_status hook implementation for acpi-ged |
25 | * Some minor code cleanups | 27 | * hw/net/lan9118: Signal TSFL_INT flag when TX FIFO reaches specified level |
28 | * chardev/baum: avoid variable-length arrays | ||
29 | * io/channel-websock: avoid variable-length arrays | ||
30 | * hw/net/e1000e_core: Use definition to avoid dynamic stack allocation | ||
31 | * hw/ppc/pnv: Avoid dynamic stack allocation | ||
32 | * hw/intc/xics: Avoid dynamic stack allocation | ||
33 | * hw/i386/multiboot: Avoid dynamic stack allocation | ||
34 | * hw/usb/hcd-ohci: Use definition to avoid dynamic stack allocation | ||
35 | * ui/curses: Avoid dynamic stack allocation | ||
36 | * tests/unit/test-vmstate: Avoid dynamic stack allocation | ||
37 | * configure: fix various shellcheck-spotted issues and nits | ||
26 | 38 | ||
27 | ---------------------------------------------------------------- | 39 | ---------------------------------------------------------------- |
28 | Edgar E. Iglesias (11): | 40 | Anton Kochkov (1): |
29 | hw/arm: versal: Remove inclusion of arm_gicv3_common.h | 41 | hw/net/can: fix Xilinx ZynqMP CAN RX FIFO logic |
30 | hw/arm: versal: Move misplaced comment | ||
31 | hw/arm: versal-virt: Fix typo xlnx-ve -> xlnx-versal | ||
32 | hw/arm: versal: Embed the UARTs into the SoC type | ||
33 | hw/arm: versal: Embed the GEMs into the SoC type | ||
34 | hw/arm: versal: Embed the ADMAs into the SoC type | ||
35 | hw/arm: versal: Embed the APUs into the SoC type | ||
36 | hw/arm: versal: Add support for SD | ||
37 | hw/arm: versal: Add support for the RTC | ||
38 | hw/arm: versal-virt: Add support for SD | ||
39 | hw/arm: versal-virt: Add support for the RTC | ||
40 | 42 | ||
41 | Fredrik Strupe (1): | 43 | Clément Chigot (1): |
42 | target/arm: Make VQDMULL undefined when U=1 | 44 | target/arm: Fix alignment for VLD4.32 |
43 | 45 | ||
44 | Peter Maydell (25): | 46 | Keqian Zhu (1): |
45 | target/arm: Don't use a TLB for ARMMMUIdx_Stage2 | 47 | hw/acpi: Add ospm_status hook implementation for acpi-ged |
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 | 48 | ||
71 | Philippe Mathieu-Daudé (2): | 49 | Lucas Dietrich (1): |
72 | hw/arm/mps2-tz: Use TYPE_IOTKIT instead of hardcoded string | 50 | hw/net/lan9118: Signal TSFL_INT flag when TX FIFO reaches specified level |
73 | target/arm: Use uint64_t for midr field in CPU state struct | ||
74 | 51 | ||
75 | include/hw/arm/xlnx-versal.h | 31 +- | 52 | Peter Maydell (7): |
76 | target/arm/cpu-param.h | 2 +- | 53 | configure: Remove unused python_version variable |
77 | target/arm/cpu.h | 38 ++- | 54 | configure: Remove unused meson_args variable |
78 | target/arm/translate-a64.h | 9 - | 55 | configure: Add missing quoting for some easy cases |
79 | target/arm/translate.h | 26 ++ | 56 | configure: Add './' on front of glob of */config-devices.mak.d |
80 | target/arm/neon-dp.decode | 86 +++++ | 57 | configure: Remove use of backtick `...` syntax |
81 | target/arm/neon-ls.decode | 52 +++ | 58 | configure: Check mkdir result directly, not via $? |
82 | target/arm/neon-shared.decode | 66 ++++ | 59 | configure: Avoid use of 'local' as it is non-POSIX |
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 | 60 | ||
61 | Philippe Mathieu-Daudé (11): | ||
62 | chardev/baum: Replace magic values by X_MAX / Y_MAX definitions | ||
63 | chardev/baum: Use definitions to avoid dynamic stack allocation | ||
64 | chardev/baum: Avoid dynamic stack allocation | ||
65 | io/channel-websock: Replace strlen(const_str) by sizeof(const_str) - 1 | ||
66 | hw/net/e1000e_core: Use definition to avoid dynamic stack allocation | ||
67 | hw/ppc/pnv: Avoid dynamic stack allocation | ||
68 | hw/intc/xics: Avoid dynamic stack allocation | ||
69 | hw/i386/multiboot: Avoid dynamic stack allocation | ||
70 | hw/usb/hcd-ohci: Use definition to avoid dynamic stack allocation | ||
71 | ui/curses: Avoid dynamic stack allocation | ||
72 | tests/unit/test-vmstate: Avoid dynamic stack allocation | ||
73 | |||
74 | Richard Henderson (17): | ||
75 | target/arm: Create GetPhysAddrResult | ||
76 | target/arm: Use GetPhysAddrResult in get_phys_addr_lpae | ||
77 | target/arm: Use GetPhysAddrResult in get_phys_addr_v6 | ||
78 | target/arm: Use GetPhysAddrResult in get_phys_addr_v5 | ||
79 | target/arm: Use GetPhysAddrResult in get_phys_addr_pmsav5 | ||
80 | target/arm: Use GetPhysAddrResult in get_phys_addr_pmsav7 | ||
81 | target/arm: Use GetPhysAddrResult in get_phys_addr_pmsav8 | ||
82 | target/arm: Use GetPhysAddrResult in pmsav8_mpu_lookup | ||
83 | target/arm: Remove is_subpage argument to pmsav8_mpu_lookup | ||
84 | target/arm: Add is_secure parameter to v8m_security_lookup | ||
85 | target/arm: Add secure parameter to pmsav8_mpu_lookup | ||
86 | target/arm: Add is_secure parameter to get_phys_addr_v5 | ||
87 | target/arm: Add is_secure parameter to get_phys_addr_v6 | ||
88 | target/arm: Add secure parameter to get_phys_addr_pmsav8 | ||
89 | target/arm: Add is_secure parameter to pmsav7_use_background_region | ||
90 | target/arm: Add secure parameter to get_phys_addr_pmsav7 | ||
91 | target/arm: Add is_secure parameter to get_phys_addr_pmsav5 | ||
92 | |||
93 | configure | 82 +++++----- | ||
94 | target/arm/internals.h | 26 +-- | ||
95 | chardev/baum.c | 22 ++- | ||
96 | hw/acpi/generic_event_device.c | 8 + | ||
97 | hw/i386/multiboot.c | 5 +- | ||
98 | hw/intc/xics.c | 2 +- | ||
99 | hw/net/can/xlnx-zynqmp-can.c | 32 ++-- | ||
100 | hw/net/e1000e_core.c | 7 +- | ||
101 | hw/net/lan9118.c | 8 + | ||
102 | hw/ppc/pnv.c | 4 +- | ||
103 | hw/ppc/spapr.c | 8 +- | ||
104 | hw/ppc/spapr_pci_nvlink2.c | 2 +- | ||
105 | hw/usb/hcd-ohci.c | 7 +- | ||
106 | io/channel-websock.c | 2 +- | ||
107 | target/arm/helper.c | 27 ++- | ||
108 | target/arm/m_helper.c | 78 ++++----- | ||
109 | target/arm/ptw.c | 364 +++++++++++++++++++---------------------- | ||
110 | target/arm/tlb_helper.c | 22 +-- | ||
111 | target/arm/translate-neon.c | 6 +- | ||
112 | tests/unit/test-vmstate.c | 7 +- | ||
113 | ui/curses.c | 2 +- | ||
114 | 21 files changed, 347 insertions(+), 374 deletions(-) | ||
115 | diff view generated by jsdifflib |
1 | We're going to want at least some of the NeonGen* typedefs | 1 | From: Anton Kochkov <anton.kochkov@proton.me> |
---|---|---|---|
2 | for the refactored 32-bit Neon decoder, so move them all | ||
3 | to translate.h since it makes more sense to keep them in | ||
4 | one group. | ||
5 | 2 | ||
3 | For consistency, function "update_rx_fifo()" should use the RX FIFO | ||
4 | register field names, not the TX FIFO ones, even if they refer to the | ||
5 | same bit positions in the register. | ||
6 | |||
7 | Signed-off-by: Anton Kochkov <anton.kochkov@proton.me> | ||
8 | Reviewed-by: Francisco Iglesias <frasse.iglesias@gmail.com> | ||
9 | Message-id: 20220817141754.2105981-1-anton.kochkov@proton.me | ||
10 | Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1123 | ||
11 | [PMM: tweaked commit message] | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
7 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
8 | Message-id: 20200430181003.21682-23-peter.maydell@linaro.org | ||
9 | --- | 13 | --- |
10 | target/arm/translate.h | 17 +++++++++++++++++ | 14 | hw/net/can/xlnx-zynqmp-can.c | 32 ++++++++++++++++---------------- |
11 | target/arm/translate-a64.c | 17 ----------------- | 15 | 1 file changed, 16 insertions(+), 16 deletions(-) |
12 | 2 files changed, 17 insertions(+), 17 deletions(-) | ||
13 | 16 | ||
14 | diff --git a/target/arm/translate.h b/target/arm/translate.h | 17 | diff --git a/hw/net/can/xlnx-zynqmp-can.c b/hw/net/can/xlnx-zynqmp-can.c |
15 | index XXXXXXX..XXXXXXX 100644 | 18 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/target/arm/translate.h | 19 | --- a/hw/net/can/xlnx-zynqmp-can.c |
17 | +++ b/target/arm/translate.h | 20 | +++ b/hw/net/can/xlnx-zynqmp-can.c |
18 | @@ -XXX,XX +XXX,XX @@ typedef void GVecGen3Fn(unsigned, uint32_t, uint32_t, | 21 | @@ -XXX,XX +XXX,XX @@ static void update_rx_fifo(XlnxZynqMPCANState *s, const qemu_can_frame *frame) |
19 | typedef void GVecGen4Fn(unsigned, uint32_t, uint32_t, uint32_t, | 22 | timestamp)); |
20 | uint32_t, uint32_t, uint32_t); | 23 | |
21 | 24 | /* First 32 bit of the data. */ | |
22 | +/* Function prototype for gen_ functions for calling Neon helpers */ | 25 | - fifo32_push(&s->rx_fifo, deposit32(0, R_TXFIFO_DATA1_DB3_SHIFT, |
23 | +typedef void NeonGenOneOpEnvFn(TCGv_i32, TCGv_ptr, TCGv_i32); | 26 | - R_TXFIFO_DATA1_DB3_LENGTH, |
24 | +typedef void NeonGenTwoOpFn(TCGv_i32, TCGv_i32, TCGv_i32); | 27 | + fifo32_push(&s->rx_fifo, deposit32(0, R_RXFIFO_DATA1_DB3_SHIFT, |
25 | +typedef void NeonGenTwoOpEnvFn(TCGv_i32, TCGv_ptr, TCGv_i32, TCGv_i32); | 28 | + R_RXFIFO_DATA1_DB3_LENGTH, |
26 | +typedef void NeonGenTwo64OpFn(TCGv_i64, TCGv_i64, TCGv_i64); | 29 | frame->data[0]) | |
27 | +typedef void NeonGenTwo64OpEnvFn(TCGv_i64, TCGv_ptr, TCGv_i64, TCGv_i64); | 30 | - deposit32(0, R_TXFIFO_DATA1_DB2_SHIFT, |
28 | +typedef void NeonGenNarrowFn(TCGv_i32, TCGv_i64); | 31 | - R_TXFIFO_DATA1_DB2_LENGTH, |
29 | +typedef void NeonGenNarrowEnvFn(TCGv_i32, TCGv_ptr, TCGv_i64); | 32 | + deposit32(0, R_RXFIFO_DATA1_DB2_SHIFT, |
30 | +typedef void NeonGenWidenFn(TCGv_i64, TCGv_i32); | 33 | + R_RXFIFO_DATA1_DB2_LENGTH, |
31 | +typedef void NeonGenTwoSingleOPFn(TCGv_i32, TCGv_i32, TCGv_i32, TCGv_ptr); | 34 | frame->data[1]) | |
32 | +typedef void NeonGenTwoDoubleOPFn(TCGv_i64, TCGv_i64, TCGv_i64, TCGv_ptr); | 35 | - deposit32(0, R_TXFIFO_DATA1_DB1_SHIFT, |
33 | +typedef void NeonGenOneOpFn(TCGv_i64, TCGv_i64); | 36 | - R_TXFIFO_DATA1_DB1_LENGTH, |
34 | +typedef void CryptoTwoOpFn(TCGv_ptr, TCGv_ptr); | 37 | + deposit32(0, R_RXFIFO_DATA1_DB1_SHIFT, |
35 | +typedef void CryptoThreeOpIntFn(TCGv_ptr, TCGv_ptr, TCGv_i32); | 38 | + R_RXFIFO_DATA1_DB1_LENGTH, |
36 | +typedef void CryptoThreeOpFn(TCGv_ptr, TCGv_ptr, TCGv_ptr); | 39 | frame->data[2]) | |
37 | +typedef void AtomicThreeOpFn(TCGv_i64, TCGv_i64, TCGv_i64, TCGArg, MemOp); | 40 | - deposit32(0, R_TXFIFO_DATA1_DB0_SHIFT, |
38 | + | 41 | - R_TXFIFO_DATA1_DB0_LENGTH, |
39 | #endif /* TARGET_ARM_TRANSLATE_H */ | 42 | + deposit32(0, R_RXFIFO_DATA1_DB0_SHIFT, |
40 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c | 43 | + R_RXFIFO_DATA1_DB0_LENGTH, |
41 | index XXXXXXX..XXXXXXX 100644 | 44 | frame->data[3])); |
42 | --- a/target/arm/translate-a64.c | 45 | /* Last 32 bit of the data. */ |
43 | +++ b/target/arm/translate-a64.c | 46 | - fifo32_push(&s->rx_fifo, deposit32(0, R_TXFIFO_DATA2_DB7_SHIFT, |
44 | @@ -XXX,XX +XXX,XX @@ typedef struct AArch64DecodeTable { | 47 | - R_TXFIFO_DATA2_DB7_LENGTH, |
45 | AArch64DecodeFn *disas_fn; | 48 | + fifo32_push(&s->rx_fifo, deposit32(0, R_RXFIFO_DATA2_DB7_SHIFT, |
46 | } AArch64DecodeTable; | 49 | + R_RXFIFO_DATA2_DB7_LENGTH, |
47 | 50 | frame->data[4]) | | |
48 | -/* Function prototype for gen_ functions for calling Neon helpers */ | 51 | - deposit32(0, R_TXFIFO_DATA2_DB6_SHIFT, |
49 | -typedef void NeonGenOneOpEnvFn(TCGv_i32, TCGv_ptr, TCGv_i32); | 52 | - R_TXFIFO_DATA2_DB6_LENGTH, |
50 | -typedef void NeonGenTwoOpFn(TCGv_i32, TCGv_i32, TCGv_i32); | 53 | + deposit32(0, R_RXFIFO_DATA2_DB6_SHIFT, |
51 | -typedef void NeonGenTwoOpEnvFn(TCGv_i32, TCGv_ptr, TCGv_i32, TCGv_i32); | 54 | + R_RXFIFO_DATA2_DB6_LENGTH, |
52 | -typedef void NeonGenTwo64OpFn(TCGv_i64, TCGv_i64, TCGv_i64); | 55 | frame->data[5]) | |
53 | -typedef void NeonGenTwo64OpEnvFn(TCGv_i64, TCGv_ptr, TCGv_i64, TCGv_i64); | 56 | - deposit32(0, R_TXFIFO_DATA2_DB5_SHIFT, |
54 | -typedef void NeonGenNarrowFn(TCGv_i32, TCGv_i64); | 57 | - R_TXFIFO_DATA2_DB5_LENGTH, |
55 | -typedef void NeonGenNarrowEnvFn(TCGv_i32, TCGv_ptr, TCGv_i64); | 58 | + deposit32(0, R_RXFIFO_DATA2_DB5_SHIFT, |
56 | -typedef void NeonGenWidenFn(TCGv_i64, TCGv_i32); | 59 | + R_RXFIFO_DATA2_DB5_LENGTH, |
57 | -typedef void NeonGenTwoSingleOPFn(TCGv_i32, TCGv_i32, TCGv_i32, TCGv_ptr); | 60 | frame->data[6]) | |
58 | -typedef void NeonGenTwoDoubleOPFn(TCGv_i64, TCGv_i64, TCGv_i64, TCGv_ptr); | 61 | - deposit32(0, R_TXFIFO_DATA2_DB4_SHIFT, |
59 | -typedef void NeonGenOneOpFn(TCGv_i64, TCGv_i64); | 62 | - R_TXFIFO_DATA2_DB4_LENGTH, |
60 | -typedef void CryptoTwoOpFn(TCGv_ptr, TCGv_ptr); | 63 | + deposit32(0, R_RXFIFO_DATA2_DB4_SHIFT, |
61 | -typedef void CryptoThreeOpIntFn(TCGv_ptr, TCGv_ptr, TCGv_i32); | 64 | + R_RXFIFO_DATA2_DB4_LENGTH, |
62 | -typedef void CryptoThreeOpFn(TCGv_ptr, TCGv_ptr, TCGv_ptr); | 65 | frame->data[7])); |
63 | -typedef void AtomicThreeOpFn(TCGv_i64, TCGv_i64, TCGv_i64, TCGArg, MemOp); | 66 | |
64 | - | 67 | ARRAY_FIELD_DP32(s->regs, INTERRUPT_STATUS_REGISTER, RXOK, 1); |
65 | /* initialize TCG globals. */ | ||
66 | void a64_translate_init(void) | ||
67 | { | ||
68 | -- | 68 | -- |
69 | 2.20.1 | 69 | 2.25.1 |
70 | |||
71 | diff view generated by jsdifflib |
1 | Convert the Neon VMUL, VMLA, VMLS and VSHL insns in the | 1 | From: Clément Chigot <chigot@adacore.com> |
---|---|---|---|
2 | 3-reg-same grouping to decodetree. | ||
3 | 2 | ||
3 | When requested, the alignment for VLD4.32 is 8 and not 16. | ||
4 | |||
5 | See ARM documentation about VLD4 encoding: | ||
6 | ebytes = 1 << UInt(size); | ||
7 | if size == '10' then | ||
8 | alignment = if a == '0' then 1 else 8; | ||
9 | else | ||
10 | alignment = if a == '0' then 1 else 4*ebytes; | ||
11 | |||
12 | Signed-off-by: Clément Chigot <chigot@adacore.com> | ||
13 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
14 | Message-id: 20220914105058.2787404-1-chigot@adacore.com | ||
4 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 15 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
5 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
6 | Message-id: 20200430181003.21682-20-peter.maydell@linaro.org | ||
7 | --- | 16 | --- |
8 | target/arm/neon-dp.decode | 9 +++++++ | 17 | target/arm/translate-neon.c | 6 +++++- |
9 | target/arm/translate-neon.inc.c | 44 +++++++++++++++++++++++++++++++++ | 18 | 1 file changed, 5 insertions(+), 1 deletion(-) |
10 | target/arm/translate.c | 28 +++------------------ | ||
11 | 3 files changed, 56 insertions(+), 25 deletions(-) | ||
12 | 19 | ||
13 | diff --git a/target/arm/neon-dp.decode b/target/arm/neon-dp.decode | 20 | diff --git a/target/arm/translate-neon.c b/target/arm/translate-neon.c |
14 | index XXXXXXX..XXXXXXX 100644 | 21 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/target/arm/neon-dp.decode | 22 | --- a/target/arm/translate-neon.c |
16 | +++ b/target/arm/neon-dp.decode | 23 | +++ b/target/arm/translate-neon.c |
17 | @@ -XXX,XX +XXX,XX @@ VCGT_U_3s 1111 001 1 0 . .. .... .... 0011 . . . 0 .... @3same | 24 | @@ -XXX,XX +XXX,XX @@ static bool trans_VLD_all_lanes(DisasContext *s, arg_VLD_all_lanes *a) |
18 | VCGE_S_3s 1111 001 0 0 . .. .... .... 0011 . . . 1 .... @3same | 25 | case 3: |
19 | VCGE_U_3s 1111 001 1 0 . .. .... .... 0011 . . . 1 .... @3same | 26 | return false; |
20 | 27 | case 4: | |
21 | +VSHL_S_3s 1111 001 0 0 . .. .... .... 0100 . . . 0 .... @3same | 28 | - align = pow2_align(size + 2); |
22 | +VSHL_U_3s 1111 001 1 0 . .. .... .... 0100 . . . 0 .... @3same | 29 | + if (size == 2) { |
23 | + | 30 | + align = pow2_align(3); |
24 | VMAX_S_3s 1111 001 0 0 . .. .... .... 0110 . . . 0 .... @3same | 31 | + } else { |
25 | VMAX_U_3s 1111 001 1 0 . .. .... .... 0110 . . . 0 .... @3same | 32 | + align = pow2_align(size + 2); |
26 | VMIN_S_3s 1111 001 0 0 . .. .... .... 0110 . . . 1 .... @3same | 33 | + } |
27 | @@ -XXX,XX +XXX,XX @@ VSUB_3s 1111 001 1 0 . .. .... .... 1000 . . . 0 .... @3same | 34 | break; |
28 | 35 | default: | |
29 | VTST_3s 1111 001 0 0 . .. .... .... 1000 . . . 1 .... @3same | 36 | g_assert_not_reached(); |
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 | } | ||
102 | return 1; | ||
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 | } | ||
142 | -- | 37 | -- |
143 | 2.20.1 | 38 | 2.25.1 |
144 | 39 | ||
145 | 40 | diff view generated by jsdifflib |
1 | We define ARMMMUIdx_Stage2 as being an MMU index which uses a QEMU | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | TLB. However we never actually use the TLB -- all stage 2 lookups | ||
3 | are done by direct calls to get_phys_addr_lpae() followed by a | ||
4 | physical address load via address_space_ld*(). | ||
5 | 2 | ||
6 | Remove Stage2 from the list of ARM MMU indexes which correspond to | 3 | Combine 5 output pointer arguments from get_phys_addr |
7 | real core MMU indexes, and instead put it in the set of "NOTLB" ARM | 4 | into a single struct. Adjust all callers. |
8 | MMU indexes. | ||
9 | 5 | ||
10 | This allows us to drop NB_MMU_MODES to 11. It also means we can | 6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
11 | safely add support for the ARMv8.3-TTS2UXN extension, which adds | 7 | Message-id: 20220822152741.1617527-2-richard.henderson@linaro.org |
12 | permission bits to the stage 2 descriptors which define execute | 8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
13 | permission separatel for EL0 and EL1; supporting that while keeping | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
14 | Stage2 in a QEMU TLB would require us to use separate TLBs for | 10 | --- |
15 | "Stage2 for an EL0 access" and "Stage2 for an EL1 access", which is a | 11 | target/arm/internals.h | 13 ++++- |
16 | lot of extra complication given we aren't even using the QEMU TLB. | 12 | target/arm/helper.c | 27 ++++----- |
13 | target/arm/m_helper.c | 52 ++++++----------- | ||
14 | target/arm/ptw.c | 120 +++++++++++++++++++++------------------- | ||
15 | target/arm/tlb_helper.c | 22 +++----- | ||
16 | 5 files changed, 109 insertions(+), 125 deletions(-) | ||
17 | 17 | ||
18 | In the process of updating the comment on our MMU index use, | 18 | diff --git a/target/arm/internals.h b/target/arm/internals.h |
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 | |||
24 | 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> | ||
27 | Message-id: 20200330210400.11724-2-peter.maydell@linaro.org | ||
28 | --- | ||
29 | target/arm/cpu-param.h | 2 +- | ||
30 | target/arm/cpu.h | 21 +++++--- | ||
31 | target/arm/helper.c | 112 ++++------------------------------------- | ||
32 | 3 files changed, 27 insertions(+), 108 deletions(-) | ||
33 | |||
34 | diff --git a/target/arm/cpu-param.h b/target/arm/cpu-param.h | ||
35 | index XXXXXXX..XXXXXXX 100644 | 19 | index XXXXXXX..XXXXXXX 100644 |
36 | --- a/target/arm/cpu-param.h | 20 | --- a/target/arm/internals.h |
37 | +++ b/target/arm/cpu-param.h | 21 | +++ b/target/arm/internals.h |
38 | @@ -XXX,XX +XXX,XX @@ | 22 | @@ -XXX,XX +XXX,XX @@ typedef struct ARMCacheAttrs { |
39 | # define TARGET_PAGE_BITS_MIN 10 | 23 | bool is_s2_format:1; |
40 | #endif | 24 | } ARMCacheAttrs; |
41 | 25 | ||
42 | -#define NB_MMU_MODES 12 | 26 | +/* Fields that are valid upon success. */ |
43 | +#define NB_MMU_MODES 11 | 27 | +typedef struct GetPhysAddrResult { |
44 | 28 | + hwaddr phys; | |
45 | #endif | 29 | + target_ulong page_size; |
46 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h | 30 | + int prot; |
47 | index XXXXXXX..XXXXXXX 100644 | 31 | + MemTxAttrs attrs; |
48 | --- a/target/arm/cpu.h | 32 | + ARMCacheAttrs cacheattrs; |
49 | +++ b/target/arm/cpu.h | 33 | +} GetPhysAddrResult; |
50 | @@ -XXX,XX +XXX,XX @@ bool write_cpustate_to_list(ARMCPU *cpu, bool kvm_sync); | 34 | + |
51 | * handling via the TLB. The only way to do a stage 1 translation without | 35 | bool get_phys_addr(CPUARMState *env, target_ulong address, |
52 | * the immediate stage 2 translation is via the ATS or AT system insns, | 36 | MMUAccessType access_type, ARMMMUIdx mmu_idx, |
53 | * which can be slow-pathed and always do a page table walk. | 37 | - hwaddr *phys_ptr, MemTxAttrs *attrs, int *prot, |
54 | + * The only use of stage 2 translations is either as part of an s1+2 | 38 | - target_ulong *page_size, |
55 | + * lookup or when loading the descriptors during a stage 1 page table walk, | 39 | - ARMMMUFaultInfo *fi, ARMCacheAttrs *cacheattrs) |
56 | + * and in both those cases we don't use the TLB. | 40 | + GetPhysAddrResult *result, ARMMMUFaultInfo *fi) |
57 | * 4. we can also safely fold together the "32 bit EL3" and "64 bit EL3" | 41 | __attribute__((nonnull)); |
58 | * translation regimes, because they map reasonably well to each other | 42 | |
59 | * and they can't both be active at the same time. | 43 | void arm_log_exception(CPUState *cs); |
60 | @@ -XXX,XX +XXX,XX @@ bool write_cpustate_to_list(ARMCPU *cpu, bool kvm_sync); | ||
61 | * NS EL1 EL1&0 stage 1+2 (aka NS PL1) | ||
62 | * NS EL1 EL1&0 stage 1+2 +PAN | ||
63 | * NS EL0 EL2&0 | ||
64 | + * NS EL2 EL2&0 | ||
65 | * NS EL2 EL2&0 +PAN | ||
66 | * NS EL2 (aka NS PL2) | ||
67 | * S EL0 EL1&0 (aka S PL0) | ||
68 | * S EL1 EL1&0 (not used if EL3 is 32 bit) | ||
69 | * S EL1 EL1&0 +PAN | ||
70 | * S EL3 (aka S PL1) | ||
71 | - * NS EL1&0 stage 2 | ||
72 | * | ||
73 | - * for a total of 12 different mmu_idx. | ||
74 | + * for a total of 11 different mmu_idx. | ||
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 | 44 | diff --git a/target/arm/helper.c b/target/arm/helper.c |
121 | index XXXXXXX..XXXXXXX 100644 | 45 | index XXXXXXX..XXXXXXX 100644 |
122 | --- a/target/arm/helper.c | 46 | --- a/target/arm/helper.c |
123 | +++ b/target/arm/helper.c | 47 | +++ b/target/arm/helper.c |
124 | @@ -XXX,XX +XXX,XX @@ static void tlbiall_nsnh_write(CPUARMState *env, const ARMCPRegInfo *ri, | 48 | @@ -XXX,XX +XXX,XX @@ static CPAccessResult ats_access(CPUARMState *env, const ARMCPRegInfo *ri, |
125 | tlb_flush_by_mmuidx(cs, | 49 | static uint64_t do_ats_write(CPUARMState *env, uint64_t value, |
126 | ARMMMUIdxBit_E10_1 | | 50 | MMUAccessType access_type, ARMMMUIdx mmu_idx) |
127 | ARMMMUIdxBit_E10_1_PAN | | 51 | { |
128 | - ARMMMUIdxBit_E10_0 | | 52 | - hwaddr phys_addr; |
129 | - ARMMMUIdxBit_Stage2); | 53 | - target_ulong page_size; |
130 | + ARMMMUIdxBit_E10_0); | 54 | - int prot; |
55 | bool ret; | ||
56 | uint64_t par64; | ||
57 | bool format64 = false; | ||
58 | - MemTxAttrs attrs = {}; | ||
59 | ARMMMUFaultInfo fi = {}; | ||
60 | - ARMCacheAttrs cacheattrs = {}; | ||
61 | + GetPhysAddrResult res = {}; | ||
62 | |||
63 | - ret = get_phys_addr(env, value, access_type, mmu_idx, &phys_addr, &attrs, | ||
64 | - &prot, &page_size, &fi, &cacheattrs); | ||
65 | + ret = get_phys_addr(env, value, access_type, mmu_idx, &res, &fi); | ||
66 | |||
67 | /* | ||
68 | * ATS operations only do S1 or S1+S2 translations, so we never | ||
69 | * have to deal with the ARMCacheAttrs format for S2 only. | ||
70 | */ | ||
71 | - assert(!cacheattrs.is_s2_format); | ||
72 | + assert(!res.cacheattrs.is_s2_format); | ||
73 | |||
74 | if (ret) { | ||
75 | /* | ||
76 | @@ -XXX,XX +XXX,XX @@ static uint64_t do_ats_write(CPUARMState *env, uint64_t value, | ||
77 | /* Create a 64-bit PAR */ | ||
78 | par64 = (1 << 11); /* LPAE bit always set */ | ||
79 | if (!ret) { | ||
80 | - par64 |= phys_addr & ~0xfffULL; | ||
81 | - if (!attrs.secure) { | ||
82 | + par64 |= res.phys & ~0xfffULL; | ||
83 | + if (!res.attrs.secure) { | ||
84 | par64 |= (1 << 9); /* NS */ | ||
85 | } | ||
86 | - par64 |= (uint64_t)cacheattrs.attrs << 56; /* ATTR */ | ||
87 | - par64 |= cacheattrs.shareability << 7; /* SH */ | ||
88 | + par64 |= (uint64_t)res.cacheattrs.attrs << 56; /* ATTR */ | ||
89 | + par64 |= res.cacheattrs.shareability << 7; /* SH */ | ||
90 | } else { | ||
91 | uint32_t fsr = arm_fi_to_lfsc(&fi); | ||
92 | |||
93 | @@ -XXX,XX +XXX,XX @@ static uint64_t do_ats_write(CPUARMState *env, uint64_t value, | ||
94 | */ | ||
95 | if (!ret) { | ||
96 | /* We do not set any attribute bits in the PAR */ | ||
97 | - if (page_size == (1 << 24) | ||
98 | + if (res.page_size == (1 << 24) | ||
99 | && arm_feature(env, ARM_FEATURE_V7)) { | ||
100 | - par64 = (phys_addr & 0xff000000) | (1 << 1); | ||
101 | + par64 = (res.phys & 0xff000000) | (1 << 1); | ||
102 | } else { | ||
103 | - par64 = phys_addr & 0xfffff000; | ||
104 | + par64 = res.phys & 0xfffff000; | ||
105 | } | ||
106 | - if (!attrs.secure) { | ||
107 | + if (!res.attrs.secure) { | ||
108 | par64 |= (1 << 9); /* NS */ | ||
109 | } | ||
110 | } else { | ||
111 | diff --git a/target/arm/m_helper.c b/target/arm/m_helper.c | ||
112 | index XXXXXXX..XXXXXXX 100644 | ||
113 | --- a/target/arm/m_helper.c | ||
114 | +++ b/target/arm/m_helper.c | ||
115 | @@ -XXX,XX +XXX,XX @@ static bool v7m_stack_write(ARMCPU *cpu, uint32_t addr, uint32_t value, | ||
116 | { | ||
117 | CPUState *cs = CPU(cpu); | ||
118 | CPUARMState *env = &cpu->env; | ||
119 | - MemTxAttrs attrs = {}; | ||
120 | MemTxResult txres; | ||
121 | - target_ulong page_size; | ||
122 | - hwaddr physaddr; | ||
123 | - int prot; | ||
124 | + GetPhysAddrResult res = {}; | ||
125 | ARMMMUFaultInfo fi = {}; | ||
126 | - ARMCacheAttrs cacheattrs = {}; | ||
127 | bool secure = mmu_idx & ARM_MMU_IDX_M_S; | ||
128 | int exc; | ||
129 | bool exc_secure; | ||
130 | |||
131 | - if (get_phys_addr(env, addr, MMU_DATA_STORE, mmu_idx, &physaddr, | ||
132 | - &attrs, &prot, &page_size, &fi, &cacheattrs)) { | ||
133 | + if (get_phys_addr(env, addr, MMU_DATA_STORE, mmu_idx, &res, &fi)) { | ||
134 | /* MPU/SAU lookup failed */ | ||
135 | if (fi.type == ARMFault_QEMU_SFault) { | ||
136 | if (mode == STACK_LAZYFP) { | ||
137 | @@ -XXX,XX +XXX,XX @@ static bool v7m_stack_write(ARMCPU *cpu, uint32_t addr, uint32_t value, | ||
138 | } | ||
139 | goto pend_fault; | ||
140 | } | ||
141 | - address_space_stl_le(arm_addressspace(cs, attrs), physaddr, value, | ||
142 | - attrs, &txres); | ||
143 | + address_space_stl_le(arm_addressspace(cs, res.attrs), res.phys, value, | ||
144 | + res.attrs, &txres); | ||
145 | if (txres != MEMTX_OK) { | ||
146 | /* BusFault trying to write the data */ | ||
147 | if (mode == STACK_LAZYFP) { | ||
148 | @@ -XXX,XX +XXX,XX @@ static bool v7m_stack_read(ARMCPU *cpu, uint32_t *dest, uint32_t addr, | ||
149 | { | ||
150 | CPUState *cs = CPU(cpu); | ||
151 | CPUARMState *env = &cpu->env; | ||
152 | - MemTxAttrs attrs = {}; | ||
153 | MemTxResult txres; | ||
154 | - target_ulong page_size; | ||
155 | - hwaddr physaddr; | ||
156 | - int prot; | ||
157 | + GetPhysAddrResult res = {}; | ||
158 | ARMMMUFaultInfo fi = {}; | ||
159 | - ARMCacheAttrs cacheattrs = {}; | ||
160 | bool secure = mmu_idx & ARM_MMU_IDX_M_S; | ||
161 | int exc; | ||
162 | bool exc_secure; | ||
163 | uint32_t value; | ||
164 | |||
165 | - if (get_phys_addr(env, addr, MMU_DATA_LOAD, mmu_idx, &physaddr, | ||
166 | - &attrs, &prot, &page_size, &fi, &cacheattrs)) { | ||
167 | + if (get_phys_addr(env, addr, MMU_DATA_LOAD, mmu_idx, &res, &fi)) { | ||
168 | /* MPU/SAU lookup failed */ | ||
169 | if (fi.type == ARMFault_QEMU_SFault) { | ||
170 | qemu_log_mask(CPU_LOG_INT, | ||
171 | @@ -XXX,XX +XXX,XX @@ static bool v7m_stack_read(ARMCPU *cpu, uint32_t *dest, uint32_t addr, | ||
172 | goto pend_fault; | ||
173 | } | ||
174 | |||
175 | - value = address_space_ldl(arm_addressspace(cs, attrs), physaddr, | ||
176 | - attrs, &txres); | ||
177 | + value = address_space_ldl(arm_addressspace(cs, res.attrs), res.phys, | ||
178 | + res.attrs, &txres); | ||
179 | if (txres != MEMTX_OK) { | ||
180 | /* BusFault trying to read the data */ | ||
181 | qemu_log_mask(CPU_LOG_INT, "...BusFault with BFSR.UNSTKERR\n"); | ||
182 | @@ -XXX,XX +XXX,XX @@ static bool v7m_read_half_insn(ARMCPU *cpu, ARMMMUIdx mmu_idx, | ||
183 | CPUState *cs = CPU(cpu); | ||
184 | CPUARMState *env = &cpu->env; | ||
185 | V8M_SAttributes sattrs = {}; | ||
186 | - MemTxAttrs attrs = {}; | ||
187 | + GetPhysAddrResult res = {}; | ||
188 | ARMMMUFaultInfo fi = {}; | ||
189 | - ARMCacheAttrs cacheattrs = {}; | ||
190 | MemTxResult txres; | ||
191 | - target_ulong page_size; | ||
192 | - hwaddr physaddr; | ||
193 | - int prot; | ||
194 | |||
195 | v8m_security_lookup(env, addr, MMU_INST_FETCH, mmu_idx, &sattrs); | ||
196 | if (!sattrs.nsc || sattrs.ns) { | ||
197 | @@ -XXX,XX +XXX,XX @@ static bool v7m_read_half_insn(ARMCPU *cpu, ARMMMUIdx mmu_idx, | ||
198 | "...really SecureFault with SFSR.INVEP\n"); | ||
199 | return false; | ||
200 | } | ||
201 | - if (get_phys_addr(env, addr, MMU_INST_FETCH, mmu_idx, &physaddr, | ||
202 | - &attrs, &prot, &page_size, &fi, &cacheattrs)) { | ||
203 | + if (get_phys_addr(env, addr, MMU_INST_FETCH, mmu_idx, &res, &fi)) { | ||
204 | /* the MPU lookup failed */ | ||
205 | env->v7m.cfsr[env->v7m.secure] |= R_V7M_CFSR_IACCVIOL_MASK; | ||
206 | armv7m_nvic_set_pending(env->nvic, ARMV7M_EXCP_MEM, env->v7m.secure); | ||
207 | qemu_log_mask(CPU_LOG_INT, "...really MemManage with CFSR.IACCVIOL\n"); | ||
208 | return false; | ||
209 | } | ||
210 | - *insn = address_space_lduw_le(arm_addressspace(cs, attrs), physaddr, | ||
211 | - attrs, &txres); | ||
212 | + *insn = address_space_lduw_le(arm_addressspace(cs, res.attrs), res.phys, | ||
213 | + res.attrs, &txres); | ||
214 | if (txres != MEMTX_OK) { | ||
215 | env->v7m.cfsr[M_REG_NS] |= R_V7M_CFSR_IBUSERR_MASK; | ||
216 | armv7m_nvic_set_pending(env->nvic, ARMV7M_EXCP_BUS, false); | ||
217 | @@ -XXX,XX +XXX,XX @@ static bool v7m_read_sg_stack_word(ARMCPU *cpu, ARMMMUIdx mmu_idx, | ||
218 | */ | ||
219 | CPUState *cs = CPU(cpu); | ||
220 | CPUARMState *env = &cpu->env; | ||
221 | - MemTxAttrs attrs = {}; | ||
222 | MemTxResult txres; | ||
223 | - target_ulong page_size; | ||
224 | - hwaddr physaddr; | ||
225 | - int prot; | ||
226 | + GetPhysAddrResult res = {}; | ||
227 | ARMMMUFaultInfo fi = {}; | ||
228 | - ARMCacheAttrs cacheattrs = {}; | ||
229 | uint32_t value; | ||
230 | |||
231 | - if (get_phys_addr(env, addr, MMU_DATA_LOAD, mmu_idx, &physaddr, | ||
232 | - &attrs, &prot, &page_size, &fi, &cacheattrs)) { | ||
233 | + if (get_phys_addr(env, addr, MMU_DATA_LOAD, mmu_idx, &res, &fi)) { | ||
234 | /* MPU/SAU lookup failed */ | ||
235 | if (fi.type == ARMFault_QEMU_SFault) { | ||
236 | qemu_log_mask(CPU_LOG_INT, | ||
237 | @@ -XXX,XX +XXX,XX @@ static bool v7m_read_sg_stack_word(ARMCPU *cpu, ARMMMUIdx mmu_idx, | ||
238 | } | ||
239 | return false; | ||
240 | } | ||
241 | - value = address_space_ldl(arm_addressspace(cs, attrs), physaddr, | ||
242 | - attrs, &txres); | ||
243 | + value = address_space_ldl(arm_addressspace(cs, res.attrs), res.phys, | ||
244 | + res.attrs, &txres); | ||
245 | if (txres != MEMTX_OK) { | ||
246 | /* BusFault trying to read the data */ | ||
247 | qemu_log_mask(CPU_LOG_INT, | ||
248 | diff --git a/target/arm/ptw.c b/target/arm/ptw.c | ||
249 | index XXXXXXX..XXXXXXX 100644 | ||
250 | --- a/target/arm/ptw.c | ||
251 | +++ b/target/arm/ptw.c | ||
252 | @@ -XXX,XX +XXX,XX @@ static ARMCacheAttrs combine_cacheattrs(CPUARMState *env, | ||
253 | * @address: virtual address to get physical address for | ||
254 | * @access_type: 0 for read, 1 for write, 2 for execute | ||
255 | * @mmu_idx: MMU index indicating required translation regime | ||
256 | - * @phys_ptr: set to the physical address corresponding to the virtual address | ||
257 | - * @attrs: set to the memory transaction attributes to use | ||
258 | - * @prot: set to the permissions for the page containing phys_ptr | ||
259 | - * @page_size: set to the size of the page containing phys_ptr | ||
260 | + * @result: set on translation success. | ||
261 | * @fi: set to fault info if the translation fails | ||
262 | - * @cacheattrs: (if non-NULL) set to the cacheability/shareability attributes | ||
263 | */ | ||
264 | bool get_phys_addr(CPUARMState *env, target_ulong address, | ||
265 | MMUAccessType access_type, ARMMMUIdx mmu_idx, | ||
266 | - hwaddr *phys_ptr, MemTxAttrs *attrs, int *prot, | ||
267 | - target_ulong *page_size, | ||
268 | - ARMMMUFaultInfo *fi, ARMCacheAttrs *cacheattrs) | ||
269 | + GetPhysAddrResult *result, ARMMMUFaultInfo *fi) | ||
270 | { | ||
271 | ARMMMUIdx s1_mmu_idx = stage_1_mmu_idx(mmu_idx); | ||
272 | |||
273 | @@ -XXX,XX +XXX,XX @@ bool get_phys_addr(CPUARMState *env, target_ulong address, | ||
274 | */ | ||
275 | if (arm_feature(env, ARM_FEATURE_EL2)) { | ||
276 | hwaddr ipa; | ||
277 | - int s2_prot; | ||
278 | + int s1_prot; | ||
279 | int ret; | ||
280 | bool ipa_secure; | ||
281 | - ARMCacheAttrs cacheattrs2 = {}; | ||
282 | + ARMCacheAttrs cacheattrs1; | ||
283 | ARMMMUIdx s2_mmu_idx; | ||
284 | bool is_el0; | ||
285 | |||
286 | - ret = get_phys_addr(env, address, access_type, s1_mmu_idx, &ipa, | ||
287 | - attrs, prot, page_size, fi, cacheattrs); | ||
288 | + ret = get_phys_addr(env, address, access_type, s1_mmu_idx, | ||
289 | + result, fi); | ||
290 | |||
291 | /* If S1 fails or S2 is disabled, return early. */ | ||
292 | if (ret || regime_translation_disabled(env, ARMMMUIdx_Stage2)) { | ||
293 | - *phys_ptr = ipa; | ||
294 | return ret; | ||
295 | } | ||
296 | |||
297 | - ipa_secure = attrs->secure; | ||
298 | + ipa = result->phys; | ||
299 | + ipa_secure = result->attrs.secure; | ||
300 | if (arm_is_secure_below_el3(env)) { | ||
301 | if (ipa_secure) { | ||
302 | - attrs->secure = !(env->cp15.vstcr_el2 & VSTCR_SW); | ||
303 | + result->attrs.secure = !(env->cp15.vstcr_el2 & VSTCR_SW); | ||
304 | } else { | ||
305 | - attrs->secure = !(env->cp15.vtcr_el2 & VTCR_NSW); | ||
306 | + result->attrs.secure = !(env->cp15.vtcr_el2 & VTCR_NSW); | ||
307 | } | ||
308 | } else { | ||
309 | assert(!ipa_secure); | ||
310 | } | ||
311 | |||
312 | - s2_mmu_idx = attrs->secure ? ARMMMUIdx_Stage2_S : ARMMMUIdx_Stage2; | ||
313 | + s2_mmu_idx = (result->attrs.secure | ||
314 | + ? ARMMMUIdx_Stage2_S : ARMMMUIdx_Stage2); | ||
315 | is_el0 = mmu_idx == ARMMMUIdx_E10_0 || mmu_idx == ARMMMUIdx_SE10_0; | ||
316 | |||
317 | - /* S1 is done. Now do S2 translation. */ | ||
318 | + /* | ||
319 | + * S1 is done, now do S2 translation. | ||
320 | + * Save the stage1 results so that we may merge | ||
321 | + * prot and cacheattrs later. | ||
322 | + */ | ||
323 | + s1_prot = result->prot; | ||
324 | + cacheattrs1 = result->cacheattrs; | ||
325 | + memset(result, 0, sizeof(*result)); | ||
326 | + | ||
327 | ret = get_phys_addr_lpae(env, ipa, access_type, s2_mmu_idx, is_el0, | ||
328 | - phys_ptr, attrs, &s2_prot, | ||
329 | - page_size, fi, &cacheattrs2); | ||
330 | + &result->phys, &result->attrs, | ||
331 | + &result->prot, &result->page_size, | ||
332 | + fi, &result->cacheattrs); | ||
333 | fi->s2addr = ipa; | ||
334 | + | ||
335 | /* Combine the S1 and S2 perms. */ | ||
336 | - *prot &= s2_prot; | ||
337 | + result->prot &= s1_prot; | ||
338 | |||
339 | /* If S2 fails, return early. */ | ||
340 | if (ret) { | ||
341 | @@ -XXX,XX +XXX,XX @@ bool get_phys_addr(CPUARMState *env, target_ulong address, | ||
342 | * Outer Write-Back Read-Allocate Write-Allocate. | ||
343 | * Do not overwrite Tagged within attrs. | ||
344 | */ | ||
345 | - if (cacheattrs->attrs != 0xf0) { | ||
346 | - cacheattrs->attrs = 0xff; | ||
347 | + if (cacheattrs1.attrs != 0xf0) { | ||
348 | + cacheattrs1.attrs = 0xff; | ||
349 | } | ||
350 | - cacheattrs->shareability = 0; | ||
351 | + cacheattrs1.shareability = 0; | ||
352 | } | ||
353 | - *cacheattrs = combine_cacheattrs(env, *cacheattrs, cacheattrs2); | ||
354 | + result->cacheattrs = combine_cacheattrs(env, cacheattrs1, | ||
355 | + result->cacheattrs); | ||
356 | |||
357 | /* Check if IPA translates to secure or non-secure PA space. */ | ||
358 | if (arm_is_secure_below_el3(env)) { | ||
359 | if (ipa_secure) { | ||
360 | - attrs->secure = | ||
361 | + result->attrs.secure = | ||
362 | !(env->cp15.vstcr_el2 & (VSTCR_SA | VSTCR_SW)); | ||
363 | } else { | ||
364 | - attrs->secure = | ||
365 | + result->attrs.secure = | ||
366 | !((env->cp15.vtcr_el2 & (VTCR_NSA | VTCR_NSW)) | ||
367 | || (env->cp15.vstcr_el2 & (VSTCR_SA | VSTCR_SW))); | ||
368 | } | ||
369 | @@ -XXX,XX +XXX,XX @@ bool get_phys_addr(CPUARMState *env, target_ulong address, | ||
370 | * cannot upgrade an non-secure translation regime's attributes | ||
371 | * to secure. | ||
372 | */ | ||
373 | - attrs->secure = regime_is_secure(env, mmu_idx); | ||
374 | - attrs->user = regime_is_user(env, mmu_idx); | ||
375 | + result->attrs.secure = regime_is_secure(env, mmu_idx); | ||
376 | + result->attrs.user = regime_is_user(env, mmu_idx); | ||
377 | |||
378 | /* | ||
379 | * Fast Context Switch Extension. This doesn't exist at all in v8. | ||
380 | @@ -XXX,XX +XXX,XX @@ bool get_phys_addr(CPUARMState *env, target_ulong address, | ||
381 | |||
382 | if (arm_feature(env, ARM_FEATURE_PMSA)) { | ||
383 | bool ret; | ||
384 | - *page_size = TARGET_PAGE_SIZE; | ||
385 | + result->page_size = TARGET_PAGE_SIZE; | ||
386 | |||
387 | if (arm_feature(env, ARM_FEATURE_V8)) { | ||
388 | /* PMSAv8 */ | ||
389 | ret = get_phys_addr_pmsav8(env, address, access_type, mmu_idx, | ||
390 | - phys_ptr, attrs, prot, page_size, fi); | ||
391 | + &result->phys, &result->attrs, | ||
392 | + &result->prot, &result->page_size, fi); | ||
393 | } else if (arm_feature(env, ARM_FEATURE_V7)) { | ||
394 | /* PMSAv7 */ | ||
395 | ret = get_phys_addr_pmsav7(env, address, access_type, mmu_idx, | ||
396 | - phys_ptr, prot, page_size, fi); | ||
397 | + &result->phys, &result->prot, | ||
398 | + &result->page_size, fi); | ||
399 | } else { | ||
400 | /* Pre-v7 MPU */ | ||
401 | ret = get_phys_addr_pmsav5(env, address, access_type, mmu_idx, | ||
402 | - phys_ptr, prot, fi); | ||
403 | + &result->phys, &result->prot, fi); | ||
404 | } | ||
405 | qemu_log_mask(CPU_LOG_MMU, "PMSA MPU lookup for %s at 0x%08" PRIx32 | ||
406 | " mmu_idx %u -> %s (prot %c%c%c)\n", | ||
407 | @@ -XXX,XX +XXX,XX @@ bool get_phys_addr(CPUARMState *env, target_ulong address, | ||
408 | (access_type == MMU_DATA_STORE ? "writing" : "execute"), | ||
409 | (uint32_t)address, mmu_idx, | ||
410 | ret ? "Miss" : "Hit", | ||
411 | - *prot & PAGE_READ ? 'r' : '-', | ||
412 | - *prot & PAGE_WRITE ? 'w' : '-', | ||
413 | - *prot & PAGE_EXEC ? 'x' : '-'); | ||
414 | + result->prot & PAGE_READ ? 'r' : '-', | ||
415 | + result->prot & PAGE_WRITE ? 'w' : '-', | ||
416 | + result->prot & PAGE_EXEC ? 'x' : '-'); | ||
417 | |||
418 | return ret; | ||
419 | } | ||
420 | @@ -XXX,XX +XXX,XX @@ bool get_phys_addr(CPUARMState *env, target_ulong address, | ||
421 | address = extract64(address, 0, 52); | ||
422 | } | ||
423 | } | ||
424 | - *phys_ptr = address; | ||
425 | - *prot = PAGE_READ | PAGE_WRITE | PAGE_EXEC; | ||
426 | - *page_size = TARGET_PAGE_SIZE; | ||
427 | + result->phys = address; | ||
428 | + result->prot = PAGE_READ | PAGE_WRITE | PAGE_EXEC; | ||
429 | + result->page_size = TARGET_PAGE_SIZE; | ||
430 | |||
431 | /* Fill in cacheattr a-la AArch64.TranslateAddressS1Off. */ | ||
432 | hcr = arm_hcr_el2_eff(env); | ||
433 | - cacheattrs->shareability = 0; | ||
434 | - cacheattrs->is_s2_format = false; | ||
435 | + result->cacheattrs.shareability = 0; | ||
436 | + result->cacheattrs.is_s2_format = false; | ||
437 | if (hcr & HCR_DC) { | ||
438 | if (hcr & HCR_DCT) { | ||
439 | memattr = 0xf0; /* Tagged, Normal, WB, RWA */ | ||
440 | @@ -XXX,XX +XXX,XX @@ bool get_phys_addr(CPUARMState *env, target_ulong address, | ||
441 | } else { | ||
442 | memattr = 0x44; /* Normal, NC, No */ | ||
443 | } | ||
444 | - cacheattrs->shareability = 2; /* outer sharable */ | ||
445 | + result->cacheattrs.shareability = 2; /* outer sharable */ | ||
446 | } else { | ||
447 | memattr = 0x00; /* Device, nGnRnE */ | ||
448 | } | ||
449 | - cacheattrs->attrs = memattr; | ||
450 | + result->cacheattrs.attrs = memattr; | ||
451 | return 0; | ||
452 | } | ||
453 | |||
454 | if (regime_using_lpae_format(env, mmu_idx)) { | ||
455 | return get_phys_addr_lpae(env, address, access_type, mmu_idx, false, | ||
456 | - phys_ptr, attrs, prot, page_size, | ||
457 | - fi, cacheattrs); | ||
458 | + &result->phys, &result->attrs, | ||
459 | + &result->prot, &result->page_size, | ||
460 | + fi, &result->cacheattrs); | ||
461 | } else if (regime_sctlr(env, mmu_idx) & SCTLR_XP) { | ||
462 | return get_phys_addr_v6(env, address, access_type, mmu_idx, | ||
463 | - phys_ptr, attrs, prot, page_size, fi); | ||
464 | + &result->phys, &result->attrs, | ||
465 | + &result->prot, &result->page_size, fi); | ||
466 | } else { | ||
467 | return get_phys_addr_v5(env, address, access_type, mmu_idx, | ||
468 | - phys_ptr, prot, page_size, fi); | ||
469 | + &result->phys, &result->prot, | ||
470 | + &result->page_size, fi); | ||
471 | } | ||
131 | } | 472 | } |
132 | 473 | ||
133 | static void tlbiall_nsnh_is_write(CPUARMState *env, const ARMCPRegInfo *ri, | 474 | @@ -XXX,XX +XXX,XX @@ hwaddr arm_cpu_get_phys_page_attrs_debug(CPUState *cs, vaddr addr, |
134 | @@ -XXX,XX +XXX,XX @@ static void tlbiall_nsnh_is_write(CPUARMState *env, const ARMCPRegInfo *ri, | 475 | { |
135 | tlb_flush_by_mmuidx_all_cpus_synced(cs, | 476 | ARMCPU *cpu = ARM_CPU(cs); |
136 | ARMMMUIdxBit_E10_1 | | 477 | CPUARMState *env = &cpu->env; |
137 | ARMMMUIdxBit_E10_1_PAN | | 478 | - hwaddr phys_addr; |
138 | - ARMMMUIdxBit_E10_0 | | 479 | - target_ulong page_size; |
139 | - ARMMMUIdxBit_Stage2); | 480 | - int prot; |
140 | + ARMMMUIdxBit_E10_0); | 481 | - bool ret; |
482 | + GetPhysAddrResult res = {}; | ||
483 | ARMMMUFaultInfo fi = {}; | ||
484 | ARMMMUIdx mmu_idx = arm_mmu_idx(env); | ||
485 | - ARMCacheAttrs cacheattrs = {}; | ||
486 | + bool ret; | ||
487 | |||
488 | - *attrs = (MemTxAttrs) {}; | ||
489 | - | ||
490 | - ret = get_phys_addr(env, addr, MMU_DATA_LOAD, mmu_idx, &phys_addr, | ||
491 | - attrs, &prot, &page_size, &fi, &cacheattrs); | ||
492 | + ret = get_phys_addr(env, addr, MMU_DATA_LOAD, mmu_idx, &res, &fi); | ||
493 | + *attrs = res.attrs; | ||
494 | |||
495 | if (ret) { | ||
496 | return -1; | ||
497 | } | ||
498 | - return phys_addr; | ||
499 | + return res.phys; | ||
141 | } | 500 | } |
142 | 501 | diff --git a/target/arm/tlb_helper.c b/target/arm/tlb_helper.c | |
143 | -static void tlbiipas2_write(CPUARMState *env, const ARMCPRegInfo *ri, | 502 | index XXXXXXX..XXXXXXX 100644 |
144 | - uint64_t value) | 503 | --- a/target/arm/tlb_helper.c |
145 | -{ | 504 | +++ b/target/arm/tlb_helper.c |
146 | - /* Invalidate by IPA. This has to invalidate any structures that | 505 | @@ -XXX,XX +XXX,XX @@ bool arm_cpu_tlb_fill(CPUState *cs, vaddr address, int size, |
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 | { | 506 | { |
249 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v8_cp_reginfo[] = { | 507 | ARMCPU *cpu = ARM_CPU(cs); |
250 | .writefn = tlbi_aa64_vae1_write }, | 508 | ARMMMUFaultInfo fi = {}; |
251 | { .name = "TLBI_IPAS2E1IS", .state = ARM_CP_STATE_AA64, | 509 | - hwaddr phys_addr; |
252 | .opc0 = 1, .opc1 = 4, .crn = 8, .crm = 0, .opc2 = 1, | 510 | - target_ulong page_size; |
253 | - .access = PL2_W, .type = ARM_CP_NO_RAW, | 511 | - int prot, ret; |
254 | - .writefn = tlbi_aa64_ipas2e1is_write }, | 512 | - MemTxAttrs attrs = {}; |
255 | + .access = PL2_W, .type = ARM_CP_NOP }, | 513 | - ARMCacheAttrs cacheattrs = {}; |
256 | { .name = "TLBI_IPAS2LE1IS", .state = ARM_CP_STATE_AA64, | 514 | + GetPhysAddrResult res = {}; |
257 | .opc0 = 1, .opc1 = 4, .crn = 8, .crm = 0, .opc2 = 5, | 515 | + int ret; |
258 | - .access = PL2_W, .type = ARM_CP_NO_RAW, | 516 | |
259 | - .writefn = tlbi_aa64_ipas2e1is_write }, | 517 | /* |
260 | + .access = PL2_W, .type = ARM_CP_NOP }, | 518 | * Walk the page table and (if the mapping exists) add the page |
261 | { .name = "TLBI_ALLE1IS", .state = ARM_CP_STATE_AA64, | 519 | @@ -XXX,XX +XXX,XX @@ bool arm_cpu_tlb_fill(CPUState *cs, vaddr address, int size, |
262 | .opc0 = 1, .opc1 = 4, .crn = 8, .crm = 3, .opc2 = 4, | 520 | */ |
263 | .access = PL2_W, .type = ARM_CP_NO_RAW, | 521 | ret = get_phys_addr(&cpu->env, address, access_type, |
264 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v8_cp_reginfo[] = { | 522 | core_to_arm_mmu_idx(&cpu->env, mmu_idx), |
265 | .writefn = tlbi_aa64_alle1is_write }, | 523 | - &phys_addr, &attrs, &prot, &page_size, |
266 | { .name = "TLBI_IPAS2E1", .state = ARM_CP_STATE_AA64, | 524 | - &fi, &cacheattrs); |
267 | .opc0 = 1, .opc1 = 4, .crn = 8, .crm = 4, .opc2 = 1, | 525 | + &res, &fi); |
268 | - .access = PL2_W, .type = ARM_CP_NO_RAW, | 526 | if (likely(!ret)) { |
269 | - .writefn = tlbi_aa64_ipas2e1_write }, | 527 | /* |
270 | + .access = PL2_W, .type = ARM_CP_NOP }, | 528 | * Map a single [sub]page. Regions smaller than our declared |
271 | { .name = "TLBI_IPAS2LE1", .state = ARM_CP_STATE_AA64, | 529 | * target page size are handled specially, so for those we |
272 | .opc0 = 1, .opc1 = 4, .crn = 8, .crm = 4, .opc2 = 5, | 530 | * pass in the exact addresses. |
273 | - .access = PL2_W, .type = ARM_CP_NO_RAW, | 531 | */ |
274 | - .writefn = tlbi_aa64_ipas2e1_write }, | 532 | - if (page_size >= TARGET_PAGE_SIZE) { |
275 | + .access = PL2_W, .type = ARM_CP_NOP }, | 533 | - phys_addr &= TARGET_PAGE_MASK; |
276 | { .name = "TLBI_ALLE1", .state = ARM_CP_STATE_AA64, | 534 | + if (res.page_size >= TARGET_PAGE_SIZE) { |
277 | .opc0 = 1, .opc1 = 4, .crn = 8, .crm = 7, .opc2 = 4, | 535 | + res.phys &= TARGET_PAGE_MASK; |
278 | .access = PL2_W, .type = ARM_CP_NO_RAW, | 536 | address &= TARGET_PAGE_MASK; |
279 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v8_cp_reginfo[] = { | 537 | } |
280 | .writefn = tlbimva_hyp_is_write }, | 538 | /* Notice and record tagged memory. */ |
281 | { .name = "TLBIIPAS2", | 539 | - if (cpu_isar_feature(aa64_mte, cpu) && cacheattrs.attrs == 0xf0) { |
282 | .cp = 15, .opc1 = 4, .crn = 8, .crm = 4, .opc2 = 1, | 540 | - arm_tlb_mte_tagged(&attrs) = true; |
283 | - .type = ARM_CP_NO_RAW, .access = PL2_W, | 541 | + if (cpu_isar_feature(aa64_mte, cpu) && res.cacheattrs.attrs == 0xf0) { |
284 | - .writefn = tlbiipas2_write }, | 542 | + arm_tlb_mte_tagged(&res.attrs) = true; |
285 | + .type = ARM_CP_NOP, .access = PL2_W }, | 543 | } |
286 | { .name = "TLBIIPAS2IS", | 544 | |
287 | .cp = 15, .opc1 = 4, .crn = 8, .crm = 0, .opc2 = 1, | 545 | - tlb_set_page_with_attrs(cs, address, phys_addr, attrs, |
288 | - .type = ARM_CP_NO_RAW, .access = PL2_W, | 546 | - prot, mmu_idx, page_size); |
289 | - .writefn = tlbiipas2_is_write }, | 547 | + tlb_set_page_with_attrs(cs, address, res.phys, res.attrs, |
290 | + .type = ARM_CP_NOP, .access = PL2_W }, | 548 | + res.prot, mmu_idx, res.page_size); |
291 | { .name = "TLBIIPAS2L", | 549 | return true; |
292 | .cp = 15, .opc1 = 4, .crn = 8, .crm = 4, .opc2 = 5, | 550 | } else if (probe) { |
293 | - .type = ARM_CP_NO_RAW, .access = PL2_W, | 551 | return false; |
294 | - .writefn = tlbiipas2_write }, | ||
295 | + .type = ARM_CP_NOP, .access = PL2_W }, | ||
296 | { .name = "TLBIIPAS2LIS", | ||
297 | .cp = 15, .opc1 = 4, .crn = 8, .crm = 0, .opc2 = 5, | ||
298 | - .type = ARM_CP_NO_RAW, .access = PL2_W, | ||
299 | - .writefn = tlbiipas2_is_write }, | ||
300 | + .type = ARM_CP_NOP, .access = PL2_W }, | ||
301 | /* 32 bit cache operations */ | ||
302 | { .name = "ICIALLUIS", .cp = 15, .opc1 = 0, .crn = 7, .crm = 1, .opc2 = 0, | ||
303 | .type = ARM_CP_NOP, .access = PL1_W, .accessfn = aa64_cacheop_pou_access }, | ||
304 | -- | 552 | -- |
305 | 2.20.1 | 553 | 2.25.1 |
306 | |||
307 | diff view generated by jsdifflib |
1 | The access_type argument to get_phys_addr_lpae() is an MMUAccessType; | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | use the enum constant MMU_DATA_LOAD rather than a literal 0 when we | ||
3 | call it in S1_ptw_translate(). | ||
4 | 2 | ||
3 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | ||
4 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
5 | Message-id: 20220822152741.1617527-4-richard.henderson@linaro.org | ||
6 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
5 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
6 | Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | ||
7 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
8 | Message-id: 20200330210400.11724-3-peter.maydell@linaro.org | ||
9 | --- | 8 | --- |
10 | target/arm/helper.c | 5 +++-- | 9 | target/arm/ptw.c | 69 ++++++++++++++++++------------------------------ |
11 | 1 file changed, 3 insertions(+), 2 deletions(-) | 10 | 1 file changed, 26 insertions(+), 43 deletions(-) |
12 | 11 | ||
13 | diff --git a/target/arm/helper.c b/target/arm/helper.c | 12 | diff --git a/target/arm/ptw.c b/target/arm/ptw.c |
14 | index XXXXXXX..XXXXXXX 100644 | 13 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/target/arm/helper.c | 14 | --- a/target/arm/ptw.c |
16 | +++ b/target/arm/helper.c | 15 | +++ b/target/arm/ptw.c |
16 | @@ -XXX,XX +XXX,XX @@ | ||
17 | |||
18 | static bool get_phys_addr_lpae(CPUARMState *env, uint64_t address, | ||
19 | MMUAccessType access_type, ARMMMUIdx mmu_idx, | ||
20 | - bool s1_is_el0, hwaddr *phys_ptr, | ||
21 | - MemTxAttrs *txattrs, int *prot, | ||
22 | - target_ulong *page_size_ptr, | ||
23 | - ARMMMUFaultInfo *fi, ARMCacheAttrs *cacheattrs) | ||
24 | + bool s1_is_el0, GetPhysAddrResult *result, | ||
25 | + ARMMMUFaultInfo *fi) | ||
26 | __attribute__((nonnull)); | ||
27 | |||
28 | /* This mapping is common between ID_AA64MMFR0.PARANGE and TCR_ELx.{I}PS. */ | ||
17 | @@ -XXX,XX +XXX,XX @@ static hwaddr S1_ptw_translate(CPUARMState *env, ARMMMUIdx mmu_idx, | 29 | @@ -XXX,XX +XXX,XX @@ static hwaddr S1_ptw_translate(CPUARMState *env, ARMMMUIdx mmu_idx, |
18 | pcacheattrs = &cacheattrs; | 30 | { |
19 | } | 31 | if (arm_mmu_idx_is_stage1_of_2(mmu_idx) && |
20 | 32 | !regime_translation_disabled(env, ARMMMUIdx_Stage2)) { | |
21 | - ret = get_phys_addr_lpae(env, addr, 0, ARMMMUIdx_Stage2, &s2pa, | 33 | - target_ulong s2size; |
22 | - &txattrs, &s2prot, &s2size, fi, pcacheattrs); | 34 | - hwaddr s2pa; |
23 | + ret = get_phys_addr_lpae(env, addr, MMU_DATA_LOAD, ARMMMUIdx_Stage2, | 35 | - int s2prot; |
24 | + &s2pa, &txattrs, &s2prot, &s2size, fi, | 36 | - int ret; |
25 | + pcacheattrs); | 37 | ARMMMUIdx s2_mmu_idx = *is_secure ? ARMMMUIdx_Stage2_S |
38 | : ARMMMUIdx_Stage2; | ||
39 | - ARMCacheAttrs cacheattrs = {}; | ||
40 | - MemTxAttrs txattrs = {}; | ||
41 | + GetPhysAddrResult s2 = {}; | ||
42 | + int ret; | ||
43 | |||
44 | ret = get_phys_addr_lpae(env, addr, MMU_DATA_LOAD, s2_mmu_idx, false, | ||
45 | - &s2pa, &txattrs, &s2prot, &s2size, fi, | ||
46 | - &cacheattrs); | ||
47 | + &s2, fi); | ||
26 | if (ret) { | 48 | if (ret) { |
27 | assert(fi->type != ARMFault_None); | 49 | assert(fi->type != ARMFault_None); |
28 | fi->s2addr = addr; | 50 | fi->s2addr = addr; |
51 | @@ -XXX,XX +XXX,XX @@ static hwaddr S1_ptw_translate(CPUARMState *env, ARMMMUIdx mmu_idx, | ||
52 | return ~0; | ||
53 | } | ||
54 | if ((arm_hcr_el2_eff(env) & HCR_PTW) && | ||
55 | - ptw_attrs_are_device(env, cacheattrs)) { | ||
56 | + ptw_attrs_are_device(env, s2.cacheattrs)) { | ||
57 | /* | ||
58 | * PTW set and S1 walk touched S2 Device memory: | ||
59 | * generate Permission fault. | ||
60 | @@ -XXX,XX +XXX,XX @@ static hwaddr S1_ptw_translate(CPUARMState *env, ARMMMUIdx mmu_idx, | ||
61 | assert(!*is_secure); | ||
62 | } | ||
63 | |||
64 | - addr = s2pa; | ||
65 | + addr = s2.phys; | ||
66 | } | ||
67 | return addr; | ||
68 | } | ||
69 | @@ -XXX,XX +XXX,XX @@ static bool check_s2_mmu_setup(ARMCPU *cpu, bool is_aa64, int level, | ||
70 | * table walk), must be true if this is stage 2 of a stage 1+2 | ||
71 | * walk for an EL0 access. If @mmu_idx is anything else, | ||
72 | * @s1_is_el0 is ignored. | ||
73 | - * @phys_ptr: set to the physical address corresponding to the virtual address | ||
74 | - * @attrs: set to the memory transaction attributes to use | ||
75 | - * @prot: set to the permissions for the page containing phys_ptr | ||
76 | - * @page_size_ptr: set to the size of the page containing phys_ptr | ||
77 | + * @result: set on translation success, | ||
78 | * @fi: set to fault info if the translation fails | ||
79 | - * @cacheattrs: (if non-NULL) set to the cacheability/shareability attributes | ||
80 | */ | ||
81 | static bool get_phys_addr_lpae(CPUARMState *env, uint64_t address, | ||
82 | MMUAccessType access_type, ARMMMUIdx mmu_idx, | ||
83 | - bool s1_is_el0, hwaddr *phys_ptr, | ||
84 | - MemTxAttrs *txattrs, int *prot, | ||
85 | - target_ulong *page_size_ptr, | ||
86 | - ARMMMUFaultInfo *fi, ARMCacheAttrs *cacheattrs) | ||
87 | + bool s1_is_el0, GetPhysAddrResult *result, | ||
88 | + ARMMMUFaultInfo *fi) | ||
89 | { | ||
90 | ARMCPU *cpu = env_archcpu(env); | ||
91 | /* Read an LPAE long-descriptor translation table. */ | ||
92 | @@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_lpae(CPUARMState *env, uint64_t address, | ||
93 | if (mmu_idx == ARMMMUIdx_Stage2 || mmu_idx == ARMMMUIdx_Stage2_S) { | ||
94 | ns = mmu_idx == ARMMMUIdx_Stage2; | ||
95 | xn = extract32(attrs, 11, 2); | ||
96 | - *prot = get_S2prot(env, ap, xn, s1_is_el0); | ||
97 | + result->prot = get_S2prot(env, ap, xn, s1_is_el0); | ||
98 | } else { | ||
99 | ns = extract32(attrs, 3, 1); | ||
100 | xn = extract32(attrs, 12, 1); | ||
101 | pxn = extract32(attrs, 11, 1); | ||
102 | - *prot = get_S1prot(env, mmu_idx, aarch64, ap, ns, xn, pxn); | ||
103 | + result->prot = get_S1prot(env, mmu_idx, aarch64, ap, ns, xn, pxn); | ||
104 | } | ||
105 | |||
106 | fault_type = ARMFault_Permission; | ||
107 | - if (!(*prot & (1 << access_type))) { | ||
108 | + if (!(result->prot & (1 << access_type))) { | ||
109 | goto do_fault; | ||
110 | } | ||
111 | |||
112 | @@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_lpae(CPUARMState *env, uint64_t address, | ||
113 | * the CPU doesn't support TZ or this is a non-secure translation | ||
114 | * regime, because the attribute will already be non-secure. | ||
115 | */ | ||
116 | - txattrs->secure = false; | ||
117 | + result->attrs.secure = false; | ||
118 | } | ||
119 | /* When in aarch64 mode, and BTI is enabled, remember GP in the IOTLB. */ | ||
120 | if (aarch64 && guarded && cpu_isar_feature(aa64_bti, cpu)) { | ||
121 | - arm_tlb_bti_gp(txattrs) = true; | ||
122 | + arm_tlb_bti_gp(&result->attrs) = true; | ||
123 | } | ||
124 | |||
125 | if (mmu_idx == ARMMMUIdx_Stage2 || mmu_idx == ARMMMUIdx_Stage2_S) { | ||
126 | - cacheattrs->is_s2_format = true; | ||
127 | - cacheattrs->attrs = extract32(attrs, 0, 4); | ||
128 | + result->cacheattrs.is_s2_format = true; | ||
129 | + result->cacheattrs.attrs = extract32(attrs, 0, 4); | ||
130 | } else { | ||
131 | /* Index into MAIR registers for cache attributes */ | ||
132 | uint8_t attrindx = extract32(attrs, 0, 3); | ||
133 | uint64_t mair = env->cp15.mair_el[regime_el(env, mmu_idx)]; | ||
134 | assert(attrindx <= 7); | ||
135 | - cacheattrs->is_s2_format = false; | ||
136 | - cacheattrs->attrs = extract64(mair, attrindx * 8, 8); | ||
137 | + result->cacheattrs.is_s2_format = false; | ||
138 | + result->cacheattrs.attrs = extract64(mair, attrindx * 8, 8); | ||
139 | } | ||
140 | |||
141 | /* | ||
142 | @@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_lpae(CPUARMState *env, uint64_t address, | ||
143 | * that case comes from TCR_ELx, which we extracted earlier. | ||
144 | */ | ||
145 | if (param.ds) { | ||
146 | - cacheattrs->shareability = param.sh; | ||
147 | + result->cacheattrs.shareability = param.sh; | ||
148 | } else { | ||
149 | - cacheattrs->shareability = extract32(attrs, 6, 2); | ||
150 | + result->cacheattrs.shareability = extract32(attrs, 6, 2); | ||
151 | } | ||
152 | |||
153 | - *phys_ptr = descaddr; | ||
154 | - *page_size_ptr = page_size; | ||
155 | + result->phys = descaddr; | ||
156 | + result->page_size = page_size; | ||
157 | return false; | ||
158 | |||
159 | do_fault: | ||
160 | @@ -XXX,XX +XXX,XX @@ bool get_phys_addr(CPUARMState *env, target_ulong address, | ||
161 | cacheattrs1 = result->cacheattrs; | ||
162 | memset(result, 0, sizeof(*result)); | ||
163 | |||
164 | - ret = get_phys_addr_lpae(env, ipa, access_type, s2_mmu_idx, is_el0, | ||
165 | - &result->phys, &result->attrs, | ||
166 | - &result->prot, &result->page_size, | ||
167 | - fi, &result->cacheattrs); | ||
168 | + ret = get_phys_addr_lpae(env, ipa, access_type, s2_mmu_idx, | ||
169 | + is_el0, result, fi); | ||
170 | fi->s2addr = ipa; | ||
171 | |||
172 | /* Combine the S1 and S2 perms. */ | ||
173 | @@ -XXX,XX +XXX,XX @@ bool get_phys_addr(CPUARMState *env, target_ulong address, | ||
174 | |||
175 | if (regime_using_lpae_format(env, mmu_idx)) { | ||
176 | return get_phys_addr_lpae(env, address, access_type, mmu_idx, false, | ||
177 | - &result->phys, &result->attrs, | ||
178 | - &result->prot, &result->page_size, | ||
179 | - fi, &result->cacheattrs); | ||
180 | + result, fi); | ||
181 | } else if (regime_sctlr(env, mmu_idx) & SCTLR_XP) { | ||
182 | return get_phys_addr_v6(env, address, access_type, mmu_idx, | ||
183 | &result->phys, &result->attrs, | ||
29 | -- | 184 | -- |
30 | 2.20.1 | 185 | 2.25.1 |
31 | 186 | ||
32 | 187 | diff view generated by jsdifflib |
1 | Convert the Neon VQADD/VQSUB insns in the 3-reg-same grouping | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | to decodetree. | ||
3 | 2 | ||
3 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | ||
4 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
5 | Message-id: 20220822152741.1617527-5-richard.henderson@linaro.org | ||
6 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
4 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
5 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
6 | Message-id: 20200430181003.21682-19-peter.maydell@linaro.org | ||
7 | --- | 8 | --- |
8 | target/arm/neon-dp.decode | 6 ++++++ | 9 | target/arm/ptw.c | 30 ++++++++++++++---------------- |
9 | target/arm/translate-neon.inc.c | 15 +++++++++++++++ | 10 | 1 file changed, 14 insertions(+), 16 deletions(-) |
10 | target/arm/translate.c | 14 ++------------ | ||
11 | 3 files changed, 23 insertions(+), 12 deletions(-) | ||
12 | 11 | ||
13 | diff --git a/target/arm/neon-dp.decode b/target/arm/neon-dp.decode | 12 | diff --git a/target/arm/ptw.c b/target/arm/ptw.c |
14 | index XXXXXXX..XXXXXXX 100644 | 13 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/target/arm/neon-dp.decode | 14 | --- a/target/arm/ptw.c |
16 | +++ b/target/arm/neon-dp.decode | 15 | +++ b/target/arm/ptw.c |
17 | @@ -XXX,XX +XXX,XX @@ | 16 | @@ -XXX,XX +XXX,XX @@ do_fault: |
18 | @3same .... ... . . . size:2 .... .... .... . q:1 . . .... \ | 17 | |
19 | &3same vm=%vm_dp vn=%vn_dp vd=%vd_dp | 18 | static bool get_phys_addr_v6(CPUARMState *env, uint32_t address, |
20 | 19 | MMUAccessType access_type, ARMMMUIdx mmu_idx, | |
21 | +VQADD_S_3s 1111 001 0 0 . .. .... .... 0000 . . . 1 .... @3same | 20 | - hwaddr *phys_ptr, MemTxAttrs *attrs, int *prot, |
22 | +VQADD_U_3s 1111 001 1 0 . .. .... .... 0000 . . . 1 .... @3same | 21 | - target_ulong *page_size, ARMMMUFaultInfo *fi) |
23 | + | 22 | + GetPhysAddrResult *result, ARMMMUFaultInfo *fi) |
24 | @3same_logic .... ... . . . .. .... .... .... . q:1 .. .... \ | 23 | { |
25 | &3same vm=%vm_dp vn=%vn_dp vd=%vd_dp size=0 | 24 | ARMCPU *cpu = env_archcpu(env); |
26 | 25 | int level = 1; | |
27 | @@ -XXX,XX +XXX,XX @@ VBSL_3s 1111 001 1 0 . 01 .... .... 0001 ... 1 .... @3same_logic | 26 | @@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_v6(CPUARMState *env, uint32_t address, |
28 | VBIT_3s 1111 001 1 0 . 10 .... .... 0001 ... 1 .... @3same_logic | 27 | phys_addr = (desc & 0xff000000) | (address & 0x00ffffff); |
29 | VBIF_3s 1111 001 1 0 . 11 .... .... 0001 ... 1 .... @3same_logic | 28 | phys_addr |= (uint64_t)extract32(desc, 20, 4) << 32; |
30 | 29 | phys_addr |= (uint64_t)extract32(desc, 5, 4) << 36; | |
31 | +VQSUB_S_3s 1111 001 0 0 . .. .... .... 0010 . . . 1 .... @3same | 30 | - *page_size = 0x1000000; |
32 | +VQSUB_U_3s 1111 001 1 0 . .. .... .... 0010 . . . 1 .... @3same | 31 | + result->page_size = 0x1000000; |
33 | + | 32 | } else { |
34 | VCGT_S_3s 1111 001 0 0 . .. .... .... 0011 . . . 0 .... @3same | 33 | /* Section. */ |
35 | VCGT_U_3s 1111 001 1 0 . .. .... .... 0011 . . . 0 .... @3same | 34 | phys_addr = (desc & 0xfff00000) | (address & 0x000fffff); |
36 | VCGE_S_3s 1111 001 0 0 . .. .... .... 0011 . . . 1 .... @3same | 35 | - *page_size = 0x100000; |
37 | diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c | 36 | + result->page_size = 0x100000; |
38 | index XXXXXXX..XXXXXXX 100644 | 37 | } |
39 | --- a/target/arm/translate-neon.inc.c | 38 | ap = ((desc >> 10) & 3) | ((desc >> 13) & 4); |
40 | +++ b/target/arm/translate-neon.inc.c | 39 | xn = desc & (1 << 4); |
41 | @@ -XXX,XX +XXX,XX @@ static void gen_VTST_3s(unsigned vece, uint32_t rd_ofs, uint32_t rn_ofs, | 40 | @@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_v6(CPUARMState *env, uint32_t address, |
42 | tcg_gen_gvec_3(rd_ofs, rn_ofs, rm_ofs, oprsz, maxsz, &cmtst_op[vece]); | 41 | case 1: /* 64k page. */ |
43 | } | 42 | phys_addr = (desc & 0xffff0000) | (address & 0xffff); |
44 | DO_3SAME_NO_SZ_3(VTST, gen_VTST_3s) | 43 | xn = desc & (1 << 15); |
45 | + | 44 | - *page_size = 0x10000; |
46 | +#define DO_3SAME_GVEC4(INSN, OPARRAY) \ | 45 | + result->page_size = 0x10000; |
47 | + static void gen_##INSN##_3s(unsigned vece, uint32_t rd_ofs, \ | 46 | break; |
48 | + uint32_t rn_ofs, uint32_t rm_ofs, \ | 47 | case 2: case 3: /* 4k page. */ |
49 | + uint32_t oprsz, uint32_t maxsz) \ | 48 | phys_addr = (desc & 0xfffff000) | (address & 0xfff); |
50 | + { \ | 49 | xn = desc & 1; |
51 | + tcg_gen_gvec_4(rd_ofs, offsetof(CPUARMState, vfp.qc), \ | 50 | - *page_size = 0x1000; |
52 | + rn_ofs, rm_ofs, oprsz, maxsz, &OPARRAY[vece]); \ | 51 | + result->page_size = 0x1000; |
53 | + } \ | 52 | break; |
54 | + DO_3SAME(INSN, gen_##INSN##_3s) | 53 | default: |
55 | + | 54 | /* Never happens, but compiler isn't smart enough to tell. */ |
56 | +DO_3SAME_GVEC4(VQADD_S, sqadd_op) | 55 | @@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_v6(CPUARMState *env, uint32_t address, |
57 | +DO_3SAME_GVEC4(VQADD_U, uqadd_op) | 56 | } |
58 | +DO_3SAME_GVEC4(VQSUB_S, sqsub_op) | 57 | } |
59 | +DO_3SAME_GVEC4(VQSUB_U, uqsub_op) | 58 | if (domain_prot == 3) { |
60 | diff --git a/target/arm/translate.c b/target/arm/translate.c | 59 | - *prot = PAGE_READ | PAGE_WRITE | PAGE_EXEC; |
61 | index XXXXXXX..XXXXXXX 100644 | 60 | + result->prot = PAGE_READ | PAGE_WRITE | PAGE_EXEC; |
62 | --- a/target/arm/translate.c | 61 | } else { |
63 | +++ b/target/arm/translate.c | 62 | if (pxn && !regime_is_user(env, mmu_idx)) { |
64 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) | 63 | xn = 1; |
64 | @@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_v6(CPUARMState *env, uint32_t address, | ||
65 | fi->type = ARMFault_AccessFlag; | ||
66 | goto do_fault; | ||
65 | } | 67 | } |
66 | return 1; | 68 | - *prot = simple_ap_to_rw_prot(env, mmu_idx, ap >> 1); |
67 | 69 | + result->prot = simple_ap_to_rw_prot(env, mmu_idx, ap >> 1); | |
68 | - case NEON_3R_VQADD: | 70 | } else { |
69 | - tcg_gen_gvec_4(rd_ofs, offsetof(CPUARMState, vfp.qc), | 71 | - *prot = ap_to_rw_prot(env, mmu_idx, ap, domain_prot); |
70 | - rn_ofs, rm_ofs, vec_size, vec_size, | 72 | + result->prot = ap_to_rw_prot(env, mmu_idx, ap, domain_prot); |
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 | } | 73 | } |
74 | - if (*prot && !xn) { | ||
75 | - *prot |= PAGE_EXEC; | ||
76 | + if (result->prot && !xn) { | ||
77 | + result->prot |= PAGE_EXEC; | ||
78 | } | ||
79 | - if (!(*prot & (1 << access_type))) { | ||
80 | + if (!(result->prot & (1 << access_type))) { | ||
81 | /* Access permission fault. */ | ||
82 | fi->type = ARMFault_Permission; | ||
83 | goto do_fault; | ||
84 | @@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_v6(CPUARMState *env, uint32_t address, | ||
85 | * the CPU doesn't support TZ or this is a non-secure translation | ||
86 | * regime, because the attribute will already be non-secure. | ||
87 | */ | ||
88 | - attrs->secure = false; | ||
89 | + result->attrs.secure = false; | ||
90 | } | ||
91 | - *phys_ptr = phys_addr; | ||
92 | + result->phys = phys_addr; | ||
93 | return false; | ||
94 | do_fault: | ||
95 | fi->domain = domain; | ||
96 | @@ -XXX,XX +XXX,XX @@ bool get_phys_addr(CPUARMState *env, target_ulong address, | ||
97 | result, fi); | ||
98 | } else if (regime_sctlr(env, mmu_idx) & SCTLR_XP) { | ||
99 | return get_phys_addr_v6(env, address, access_type, mmu_idx, | ||
100 | - &result->phys, &result->attrs, | ||
101 | - &result->prot, &result->page_size, fi); | ||
102 | + result, fi); | ||
103 | } else { | ||
104 | return get_phys_addr_v5(env, address, access_type, mmu_idx, | ||
105 | &result->phys, &result->prot, | ||
92 | -- | 106 | -- |
93 | 2.20.1 | 107 | 2.25.1 |
94 | 108 | ||
95 | 109 | 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 | Embed the UARTs into the SoC type. | 3 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> |
4 | 4 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | |
5 | Suggested-by: Peter Maydell <peter.maydell@linaro.org> | 5 | Message-id: 20220822152741.1617527-6-richard.henderson@linaro.org |
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> | ||
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> | 7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
12 | --- | 8 | --- |
13 | include/hw/arm/xlnx-versal.h | 3 ++- | 9 | target/arm/ptw.c | 25 +++++++++++-------------- |
14 | hw/arm/xlnx-versal.c | 12 ++++++------ | 10 | 1 file changed, 11 insertions(+), 14 deletions(-) |
15 | 2 files changed, 8 insertions(+), 7 deletions(-) | ||
16 | 11 | ||
17 | diff --git a/include/hw/arm/xlnx-versal.h b/include/hw/arm/xlnx-versal.h | 12 | diff --git a/target/arm/ptw.c b/target/arm/ptw.c |
18 | index XXXXXXX..XXXXXXX 100644 | 13 | index XXXXXXX..XXXXXXX 100644 |
19 | --- a/include/hw/arm/xlnx-versal.h | 14 | --- a/target/arm/ptw.c |
20 | +++ b/include/hw/arm/xlnx-versal.h | 15 | +++ b/target/arm/ptw.c |
21 | @@ -XXX,XX +XXX,XX @@ | 16 | @@ -XXX,XX +XXX,XX @@ static int simple_ap_to_rw_prot(CPUARMState *env, ARMMMUIdx mmu_idx, int ap) |
22 | #include "hw/sysbus.h" | 17 | |
23 | #include "hw/arm/boot.h" | 18 | static bool get_phys_addr_v5(CPUARMState *env, uint32_t address, |
24 | #include "hw/intc/arm_gicv3.h" | 19 | MMUAccessType access_type, ARMMMUIdx mmu_idx, |
25 | +#include "hw/char/pl011.h" | 20 | - hwaddr *phys_ptr, int *prot, |
26 | 21 | - target_ulong *page_size, | |
27 | #define TYPE_XLNX_VERSAL "xlnx-versal" | 22 | - ARMMMUFaultInfo *fi) |
28 | #define XLNX_VERSAL(obj) OBJECT_CHECK(Versal, (obj), TYPE_XLNX_VERSAL) | 23 | + GetPhysAddrResult *result, ARMMMUFaultInfo *fi) |
29 | @@ -XXX,XX +XXX,XX @@ typedef struct Versal { | 24 | { |
30 | MemoryRegion mr_ocm; | 25 | int level = 1; |
31 | 26 | uint32_t table; | |
32 | struct { | 27 | @@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_v5(CPUARMState *env, uint32_t address, |
33 | - SysBusDevice *uart[XLNX_VERSAL_NR_UARTS]; | 28 | /* 1Mb section. */ |
34 | + PL011State uart[XLNX_VERSAL_NR_UARTS]; | 29 | phys_addr = (desc & 0xfff00000) | (address & 0x000fffff); |
35 | SysBusDevice *gem[XLNX_VERSAL_NR_GEMS]; | 30 | ap = (desc >> 10) & 3; |
36 | SysBusDevice *adma[XLNX_VERSAL_NR_ADMAS]; | 31 | - *page_size = 1024 * 1024; |
37 | } iou; | 32 | + result->page_size = 1024 * 1024; |
38 | diff --git a/hw/arm/xlnx-versal.c b/hw/arm/xlnx-versal.c | 33 | } else { |
39 | index XXXXXXX..XXXXXXX 100644 | 34 | /* Lookup l2 entry. */ |
40 | --- a/hw/arm/xlnx-versal.c | 35 | if (type == 1) { |
41 | +++ b/hw/arm/xlnx-versal.c | 36 | @@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_v5(CPUARMState *env, uint32_t address, |
42 | @@ -XXX,XX +XXX,XX @@ | 37 | case 1: /* 64k page. */ |
43 | #include "kvm_arm.h" | 38 | phys_addr = (desc & 0xffff0000) | (address & 0xffff); |
44 | #include "hw/misc/unimp.h" | 39 | ap = (desc >> (4 + ((address >> 13) & 6))) & 3; |
45 | #include "hw/arm/xlnx-versal.h" | 40 | - *page_size = 0x10000; |
46 | -#include "hw/char/pl011.h" | 41 | + result->page_size = 0x10000; |
47 | 42 | break; | |
48 | #define XLNX_VERSAL_ACPU_TYPE ARM_CPU_TYPE_NAME("cortex-a72") | 43 | case 2: /* 4k page. */ |
49 | #define GEM_REVISION 0x40070106 | 44 | phys_addr = (desc & 0xfffff000) | (address & 0xfff); |
50 | @@ -XXX,XX +XXX,XX @@ static void versal_create_uarts(Versal *s, qemu_irq *pic) | 45 | ap = (desc >> (4 + ((address >> 9) & 6))) & 3; |
51 | DeviceState *dev; | 46 | - *page_size = 0x1000; |
52 | MemoryRegion *mr; | 47 | + result->page_size = 0x1000; |
53 | 48 | break; | |
54 | - dev = qdev_create(NULL, TYPE_PL011); | 49 | case 3: /* 1k page, or ARMv6/XScale "extended small (4k) page" */ |
55 | - s->lpd.iou.uart[i] = SYS_BUS_DEVICE(dev); | 50 | if (type == 1) { |
56 | + sysbus_init_child_obj(OBJECT(s), name, | 51 | @@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_v5(CPUARMState *env, uint32_t address, |
57 | + &s->lpd.iou.uart[i], sizeof(s->lpd.iou.uart[i]), | 52 | if (arm_feature(env, ARM_FEATURE_XSCALE) |
58 | + TYPE_PL011); | 53 | || arm_feature(env, ARM_FEATURE_V6)) { |
59 | + dev = DEVICE(&s->lpd.iou.uart[i]); | 54 | phys_addr = (desc & 0xfffff000) | (address & 0xfff); |
60 | qdev_prop_set_chr(dev, "chardev", serial_hd(i)); | 55 | - *page_size = 0x1000; |
61 | - object_property_add_child(OBJECT(s), name, OBJECT(dev), &error_fatal); | 56 | + result->page_size = 0x1000; |
62 | qdev_init_nofail(dev); | 57 | } else { |
63 | 58 | /* | |
64 | - mr = sysbus_mmio_get_region(s->lpd.iou.uart[i], 0); | 59 | * UNPREDICTABLE in ARMv5; we choose to take a |
65 | + mr = sysbus_mmio_get_region(SYS_BUS_DEVICE(dev), 0); | 60 | @@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_v5(CPUARMState *env, uint32_t address, |
66 | memory_region_add_subregion(&s->mr_ps, addrs[i], mr); | 61 | } |
67 | 62 | } else { | |
68 | - sysbus_connect_irq(s->lpd.iou.uart[i], 0, pic[irqs[i]]); | 63 | phys_addr = (desc & 0xfffffc00) | (address & 0x3ff); |
69 | + sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, pic[irqs[i]]); | 64 | - *page_size = 0x400; |
70 | g_free(name); | 65 | + result->page_size = 0x400; |
66 | } | ||
67 | ap = (desc >> 4) & 3; | ||
68 | break; | ||
69 | @@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_v5(CPUARMState *env, uint32_t address, | ||
70 | g_assert_not_reached(); | ||
71 | } | ||
72 | } | ||
73 | - *prot = ap_to_rw_prot(env, mmu_idx, ap, domain_prot); | ||
74 | - *prot |= *prot ? PAGE_EXEC : 0; | ||
75 | - if (!(*prot & (1 << access_type))) { | ||
76 | + result->prot = ap_to_rw_prot(env, mmu_idx, ap, domain_prot); | ||
77 | + result->prot |= result->prot ? PAGE_EXEC : 0; | ||
78 | + if (!(result->prot & (1 << access_type))) { | ||
79 | /* Access permission fault. */ | ||
80 | fi->type = ARMFault_Permission; | ||
81 | goto do_fault; | ||
82 | } | ||
83 | - *phys_ptr = phys_addr; | ||
84 | + result->phys = phys_addr; | ||
85 | return false; | ||
86 | do_fault: | ||
87 | fi->domain = domain; | ||
88 | @@ -XXX,XX +XXX,XX @@ bool get_phys_addr(CPUARMState *env, target_ulong address, | ||
89 | result, fi); | ||
90 | } else { | ||
91 | return get_phys_addr_v5(env, address, access_type, mmu_idx, | ||
92 | - &result->phys, &result->prot, | ||
93 | - &result->page_size, fi); | ||
94 | + result, fi); | ||
71 | } | 95 | } |
72 | } | 96 | } |
97 | |||
73 | -- | 98 | -- |
74 | 2.20.1 | 99 | 2.25.1 |
75 | 100 | ||
76 | 101 | diff view generated by jsdifflib |
1 | Somewhere along theline we accidentally added a duplicate | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
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 | 2 | ||
3 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | ||
4 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
5 | Message-id: 20220822152741.1617527-7-richard.henderson@linaro.org | ||
6 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
5 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 7 | 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 | --- | 8 | --- |
10 | target/arm/translate-vfp.inc.c | 6 ------ | 9 | target/arm/ptw.c | 24 ++++++++++++------------ |
11 | 1 file changed, 6 deletions(-) | 10 | 1 file changed, 12 insertions(+), 12 deletions(-) |
12 | 11 | ||
13 | diff --git a/target/arm/translate-vfp.inc.c b/target/arm/translate-vfp.inc.c | 12 | diff --git a/target/arm/ptw.c b/target/arm/ptw.c |
14 | index XXXXXXX..XXXXXXX 100644 | 13 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/target/arm/translate-vfp.inc.c | 14 | --- a/target/arm/ptw.c |
16 | +++ b/target/arm/translate-vfp.inc.c | 15 | +++ b/target/arm/ptw.c |
17 | @@ -XXX,XX +XXX,XX @@ static bool do_vfm_dp(DisasContext *s, arg_VFMA_dp *a, bool neg_n, bool neg_d) | 16 | @@ -XXX,XX +XXX,XX @@ do_fault: |
17 | |||
18 | static bool get_phys_addr_pmsav5(CPUARMState *env, uint32_t address, | ||
19 | MMUAccessType access_type, ARMMMUIdx mmu_idx, | ||
20 | - hwaddr *phys_ptr, int *prot, | ||
21 | + GetPhysAddrResult *result, | ||
22 | ARMMMUFaultInfo *fi) | ||
23 | { | ||
24 | int n; | ||
25 | @@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_pmsav5(CPUARMState *env, uint32_t address, | ||
26 | |||
27 | if (regime_translation_disabled(env, mmu_idx)) { | ||
28 | /* MPU disabled. */ | ||
29 | - *phys_ptr = address; | ||
30 | - *prot = PAGE_READ | PAGE_WRITE | PAGE_EXEC; | ||
31 | + result->phys = address; | ||
32 | + result->prot = PAGE_READ | PAGE_WRITE | PAGE_EXEC; | ||
18 | return false; | 33 | return false; |
19 | } | 34 | } |
20 | 35 | ||
21 | - /* UNDEF accesses to D16-D31 if they don't exist. */ | 36 | - *phys_ptr = address; |
22 | - if (!dc_isar_feature(aa32_simd_r32, s) && | 37 | + result->phys = address; |
23 | - ((a->vd | a->vn | a->vm) & 0x10)) { | 38 | for (n = 7; n >= 0; n--) { |
24 | - return false; | 39 | base = env->cp15.c6_region[n]; |
25 | - } | 40 | if ((base & 1) == 0) { |
26 | - | 41 | @@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_pmsav5(CPUARMState *env, uint32_t address, |
27 | if (!vfp_access_check(s)) { | 42 | fi->level = 1; |
43 | return true; | ||
44 | } | ||
45 | - *prot = PAGE_READ | PAGE_WRITE; | ||
46 | + result->prot = PAGE_READ | PAGE_WRITE; | ||
47 | break; | ||
48 | case 2: | ||
49 | - *prot = PAGE_READ; | ||
50 | + result->prot = PAGE_READ; | ||
51 | if (!is_user) { | ||
52 | - *prot |= PAGE_WRITE; | ||
53 | + result->prot |= PAGE_WRITE; | ||
54 | } | ||
55 | break; | ||
56 | case 3: | ||
57 | - *prot = PAGE_READ | PAGE_WRITE; | ||
58 | + result->prot = PAGE_READ | PAGE_WRITE; | ||
59 | break; | ||
60 | case 5: | ||
61 | if (is_user) { | ||
62 | @@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_pmsav5(CPUARMState *env, uint32_t address, | ||
63 | fi->level = 1; | ||
64 | return true; | ||
65 | } | ||
66 | - *prot = PAGE_READ; | ||
67 | + result->prot = PAGE_READ; | ||
68 | break; | ||
69 | case 6: | ||
70 | - *prot = PAGE_READ; | ||
71 | + result->prot = PAGE_READ; | ||
72 | break; | ||
73 | default: | ||
74 | /* Bad permission. */ | ||
75 | @@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_pmsav5(CPUARMState *env, uint32_t address, | ||
76 | fi->level = 1; | ||
28 | return true; | 77 | return true; |
29 | } | 78 | } |
79 | - *prot |= PAGE_EXEC; | ||
80 | + result->prot |= PAGE_EXEC; | ||
81 | return false; | ||
82 | } | ||
83 | |||
84 | @@ -XXX,XX +XXX,XX @@ bool get_phys_addr(CPUARMState *env, target_ulong address, | ||
85 | } else { | ||
86 | /* Pre-v7 MPU */ | ||
87 | ret = get_phys_addr_pmsav5(env, address, access_type, mmu_idx, | ||
88 | - &result->phys, &result->prot, fi); | ||
89 | + result, fi); | ||
90 | } | ||
91 | qemu_log_mask(CPU_LOG_MMU, "PMSA MPU lookup for %s at 0x%08" PRIx32 | ||
92 | " mmu_idx %u -> %s (prot %c%c%c)\n", | ||
30 | -- | 93 | -- |
31 | 2.20.1 | 94 | 2.25.1 |
32 | 95 | ||
33 | 96 | diff view generated by jsdifflib |
1 | Convert the VFM[AS]L (scalar) insns in the 2reg-scalar-ext group | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | to decodetree. These are the last ones in the group so we can remove | ||
3 | all the legacy decode for the group. | ||
4 | 2 | ||
5 | Note that in disas_thumb2_insn() the parts of this encoding space | 3 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> |
6 | where the decodetree decoder returns false will correctly be directed | 4 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
7 | to illegal_op by the "(insn & (1 << 28))" check so they won't fall | 5 | Message-id: 20220822152741.1617527-8-richard.henderson@linaro.org |
8 | into disas_coproc_insn() by mistake. | 6 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
8 | --- | ||
9 | target/arm/ptw.c | 36 +++++++++++++++++------------------- | ||
10 | 1 file changed, 17 insertions(+), 19 deletions(-) | ||
9 | 11 | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 12 | diff --git a/target/arm/ptw.c b/target/arm/ptw.c |
11 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
12 | Message-id: 20200430181003.21682-11-peter.maydell@linaro.org | ||
13 | --- | ||
14 | target/arm/neon-shared.decode | 7 +++ | ||
15 | target/arm/translate-neon.inc.c | 32 ++++++++++ | ||
16 | target/arm/translate.c | 107 +------------------------------- | ||
17 | 3 files changed, 40 insertions(+), 106 deletions(-) | ||
18 | |||
19 | diff --git a/target/arm/neon-shared.decode b/target/arm/neon-shared.decode | ||
20 | index XXXXXXX..XXXXXXX 100644 | 13 | index XXXXXXX..XXXXXXX 100644 |
21 | --- a/target/arm/neon-shared.decode | 14 | --- a/target/arm/ptw.c |
22 | +++ b/target/arm/neon-shared.decode | 15 | +++ b/target/arm/ptw.c |
23 | @@ -XXX,XX +XXX,XX @@ VCMLA_scalar 1111 1110 1 . rot:2 .... .... 1000 . q:1 . 0 .... \ | 16 | @@ -XXX,XX +XXX,XX @@ static bool pmsav7_use_background_region(ARMCPU *cpu, ARMMMUIdx mmu_idx, |
24 | 17 | ||
25 | VDOT_scalar 1111 1110 0 . 10 .... .... 1101 . q:1 index:1 u:1 rm:4 \ | 18 | static bool get_phys_addr_pmsav7(CPUARMState *env, uint32_t address, |
26 | vm=%vm_dp vn=%vn_dp vd=%vd_dp | 19 | MMUAccessType access_type, ARMMMUIdx mmu_idx, |
27 | + | 20 | - hwaddr *phys_ptr, int *prot, |
28 | +%vfml_scalar_q0_rm 0:3 5:1 | 21 | - target_ulong *page_size, |
29 | +%vfml_scalar_q1_index 5:1 3:1 | 22 | + GetPhysAddrResult *result, |
30 | +VFML_scalar 1111 1110 0 . 0 s:1 .... .... 1000 . 0 . 1 index:1 ... \ | 23 | ARMMMUFaultInfo *fi) |
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 | + } | ||
50 | + | ||
51 | + /* UNDEF accesses to D16-D31 if they don't exist. */ | ||
52 | + if (!dc_isar_feature(aa32_simd_r32, s) && | ||
53 | + ((a->vd & 0x10) || (a->q && (a->vn & 0x10)))) { | ||
54 | + return false; | ||
55 | + } | ||
56 | + | ||
57 | + if (a->vd & a->q) { | ||
58 | + return false; | ||
59 | + } | ||
60 | + | ||
61 | + if (!vfp_access_check(s)) { | ||
62 | + return true; | ||
63 | + } | ||
64 | + | ||
65 | + opr_sz = (1 + a->q) * 8; | ||
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 | - } | ||
145 | - | ||
146 | - VFP_DREG_D(rd, insn); | ||
147 | - if (rd & q) { | ||
148 | - return 1; | ||
149 | - } | ||
150 | - if (q || !is_long) { | ||
151 | - VFP_DREG_N(rn, insn); | ||
152 | - if (rn & q & !is_long) { | ||
153 | - return 1; | ||
154 | - } | ||
155 | - off_rn = vfp_reg_offset(1, rn); | ||
156 | - off_rm = vfp_reg_offset(1, rm); | ||
157 | - } else { | ||
158 | - rn = VFP_SREG_N(insn); | ||
159 | - off_rn = vfp_reg_offset(0, rn); | ||
160 | - off_rm = vfp_reg_offset(0, rm); | ||
161 | - } | ||
162 | - if (s->fp_excp_el) { | ||
163 | - gen_exception_insn(s, s->pc_curr, EXCP_UDEF, | ||
164 | - syn_simd_access_trap(1, 0xe, false), s->fp_excp_el); | ||
165 | - return 0; | ||
166 | - } | ||
167 | - if (!s->vfp_enabled) { | ||
168 | - return 1; | ||
169 | - } | ||
170 | - | ||
171 | - opr_sz = (1 + q) * 8; | ||
172 | - if (fn_gvec_ptr) { | ||
173 | - TCGv_ptr ptr; | ||
174 | - if (ptr_is_env) { | ||
175 | - ptr = cpu_env; | ||
176 | - } else { | ||
177 | - ptr = get_fpstatus_ptr(1); | ||
178 | - } | ||
179 | - tcg_gen_gvec_3_ptr(vfp_reg_offset(1, rd), off_rn, off_rm, ptr, | ||
180 | - opr_sz, opr_sz, data, fn_gvec_ptr); | ||
181 | - if (!ptr_is_env) { | ||
182 | - tcg_temp_free_ptr(ptr); | ||
183 | - } | ||
184 | - } else { | ||
185 | - tcg_gen_gvec_3_ool(vfp_reg_offset(1, rd), off_rn, off_rm, | ||
186 | - opr_sz, opr_sz, data, fn_gvec); | ||
187 | - } | ||
188 | - return 0; | ||
189 | -} | ||
190 | - | ||
191 | static int disas_coproc_insn(DisasContext *s, uint32_t insn) | ||
192 | { | 24 | { |
193 | int cpnum, is64, crn, crm, opc1, opc2, isread, rt, rt2; | 25 | ARMCPU *cpu = env_archcpu(env); |
194 | @@ -XXX,XX +XXX,XX @@ static void disas_arm_insn(DisasContext *s, unsigned int insn) | 26 | int n; |
195 | } | 27 | bool is_user = regime_is_user(env, mmu_idx); |
28 | |||
29 | - *phys_ptr = address; | ||
30 | - *page_size = TARGET_PAGE_SIZE; | ||
31 | - *prot = 0; | ||
32 | + result->phys = address; | ||
33 | + result->page_size = TARGET_PAGE_SIZE; | ||
34 | + result->prot = 0; | ||
35 | |||
36 | if (regime_translation_disabled(env, mmu_idx) || | ||
37 | m_is_ppb_region(env, address)) { | ||
38 | @@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_pmsav7(CPUARMState *env, uint32_t address, | ||
39 | * which always does a direct read using address_space_ldl(), rather | ||
40 | * than going via this function, so we don't need to check that here. | ||
41 | */ | ||
42 | - get_phys_addr_pmsav7_default(env, mmu_idx, address, prot); | ||
43 | + get_phys_addr_pmsav7_default(env, mmu_idx, address, &result->prot); | ||
44 | } else { /* MPU enabled */ | ||
45 | for (n = (int)cpu->pmsav7_dregion - 1; n >= 0; n--) { | ||
46 | /* region search */ | ||
47 | @@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_pmsav7(CPUARMState *env, uint32_t address, | ||
48 | if (ranges_overlap(base, rmask, | ||
49 | address & TARGET_PAGE_MASK, | ||
50 | TARGET_PAGE_SIZE)) { | ||
51 | - *page_size = 1; | ||
52 | + result->page_size = 1; | ||
196 | } | 53 | } |
54 | continue; | ||
197 | } | 55 | } |
198 | - } else if ((insn & 0x0f000a00) == 0x0e000800 | 56 | @@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_pmsav7(CPUARMState *env, uint32_t address, |
199 | - && arm_dc_feature(s, ARM_FEATURE_V8)) { | 57 | continue; |
200 | - if (disas_neon_insn_2reg_scalar_ext(s, insn)) { | 58 | } |
201 | - goto illegal_op; | 59 | if (rsize < TARGET_PAGE_BITS) { |
202 | - } | 60 | - *page_size = 1 << rsize; |
203 | - return; | 61 | + result->page_size = 1 << rsize; |
204 | } | ||
205 | goto illegal_op; | ||
206 | } | ||
207 | @@ -XXX,XX +XXX,XX @@ static void disas_thumb2_insn(DisasContext *s, uint32_t insn) | ||
208 | } | 62 | } |
209 | break; | 63 | break; |
210 | } | 64 | } |
211 | - if ((insn & 0xff000a00) == 0xfe000800 | 65 | @@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_pmsav7(CPUARMState *env, uint32_t address, |
212 | - && arm_dc_feature(s, ARM_FEATURE_V8)) { | 66 | fi->type = ARMFault_Background; |
213 | - /* The Thumb2 and ARM encodings are identical. */ | 67 | return true; |
214 | - if (disas_neon_insn_2reg_scalar_ext(s, insn)) { | 68 | } |
215 | - goto illegal_op; | 69 | - get_phys_addr_pmsav7_default(env, mmu_idx, address, prot); |
216 | - } | 70 | + get_phys_addr_pmsav7_default(env, mmu_idx, address, &result->prot); |
217 | - } else if (((insn >> 24) & 3) == 3) { | 71 | } else { /* a MPU hit! */ |
218 | + if (((insn >> 24) & 3) == 3) { | 72 | uint32_t ap = extract32(env->pmsav7.dracr[n], 8, 3); |
219 | /* Translate into the equivalent ARM encoding. */ | 73 | uint32_t xn = extract32(env->pmsav7.dracr[n], 12, 1); |
220 | insn = (insn & 0xe2ffffff) | ((insn & (1 << 28)) >> 4) | (1 << 28); | 74 | @@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_pmsav7(CPUARMState *env, uint32_t address, |
221 | if (disas_neon_data_insn(s, insn)) { | 75 | case 5: |
76 | break; /* no access */ | ||
77 | case 3: | ||
78 | - *prot |= PAGE_WRITE; | ||
79 | + result->prot |= PAGE_WRITE; | ||
80 | /* fall through */ | ||
81 | case 2: | ||
82 | case 6: | ||
83 | - *prot |= PAGE_READ | PAGE_EXEC; | ||
84 | + result->prot |= PAGE_READ | PAGE_EXEC; | ||
85 | break; | ||
86 | case 7: | ||
87 | /* for v7M, same as 6; for R profile a reserved value */ | ||
88 | if (arm_feature(env, ARM_FEATURE_M)) { | ||
89 | - *prot |= PAGE_READ | PAGE_EXEC; | ||
90 | + result->prot |= PAGE_READ | PAGE_EXEC; | ||
91 | break; | ||
92 | } | ||
93 | /* fall through */ | ||
94 | @@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_pmsav7(CPUARMState *env, uint32_t address, | ||
95 | case 1: | ||
96 | case 2: | ||
97 | case 3: | ||
98 | - *prot |= PAGE_WRITE; | ||
99 | + result->prot |= PAGE_WRITE; | ||
100 | /* fall through */ | ||
101 | case 5: | ||
102 | case 6: | ||
103 | - *prot |= PAGE_READ | PAGE_EXEC; | ||
104 | + result->prot |= PAGE_READ | PAGE_EXEC; | ||
105 | break; | ||
106 | case 7: | ||
107 | /* for v7M, same as 6; for R profile a reserved value */ | ||
108 | if (arm_feature(env, ARM_FEATURE_M)) { | ||
109 | - *prot |= PAGE_READ | PAGE_EXEC; | ||
110 | + result->prot |= PAGE_READ | PAGE_EXEC; | ||
111 | break; | ||
112 | } | ||
113 | /* fall through */ | ||
114 | @@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_pmsav7(CPUARMState *env, uint32_t address, | ||
115 | |||
116 | /* execute never */ | ||
117 | if (xn) { | ||
118 | - *prot &= ~PAGE_EXEC; | ||
119 | + result->prot &= ~PAGE_EXEC; | ||
120 | } | ||
121 | } | ||
122 | } | ||
123 | |||
124 | fi->type = ARMFault_Permission; | ||
125 | fi->level = 1; | ||
126 | - return !(*prot & (1 << access_type)); | ||
127 | + return !(result->prot & (1 << access_type)); | ||
128 | } | ||
129 | |||
130 | bool pmsav8_mpu_lookup(CPUARMState *env, uint32_t address, | ||
131 | @@ -XXX,XX +XXX,XX @@ bool get_phys_addr(CPUARMState *env, target_ulong address, | ||
132 | } else if (arm_feature(env, ARM_FEATURE_V7)) { | ||
133 | /* PMSAv7 */ | ||
134 | ret = get_phys_addr_pmsav7(env, address, access_type, mmu_idx, | ||
135 | - &result->phys, &result->prot, | ||
136 | - &result->page_size, fi); | ||
137 | + result, fi); | ||
138 | } else { | ||
139 | /* Pre-v7 MPU */ | ||
140 | ret = get_phys_addr_pmsav5(env, address, access_type, mmu_idx, | ||
222 | -- | 141 | -- |
223 | 2.20.1 | 142 | 2.25.1 |
224 | 143 | ||
225 | 144 | 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 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> |
4 | 4 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | |
5 | Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | 5 | Message-id: 20220822152741.1617527-9-richard.henderson@linaro.org |
6 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | 6 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
7 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
8 | Reviewed-by: Luc Michel <luc.michel@greensocs.com> | ||
9 | Message-id: 20200427181649.26851-4-edgar.iglesias@gmail.com | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
11 | --- | 8 | --- |
12 | hw/arm/xlnx-versal-virt.c | 2 +- | 9 | target/arm/ptw.c | 28 ++++++++++++++-------------- |
13 | 1 file changed, 1 insertion(+), 1 deletion(-) | 10 | 1 file changed, 14 insertions(+), 14 deletions(-) |
14 | 11 | ||
15 | diff --git a/hw/arm/xlnx-versal-virt.c b/hw/arm/xlnx-versal-virt.c | 12 | diff --git a/target/arm/ptw.c b/target/arm/ptw.c |
16 | index XXXXXXX..XXXXXXX 100644 | 13 | index XXXXXXX..XXXXXXX 100644 |
17 | --- a/hw/arm/xlnx-versal-virt.c | 14 | --- a/target/arm/ptw.c |
18 | +++ b/hw/arm/xlnx-versal-virt.c | 15 | +++ b/target/arm/ptw.c |
19 | @@ -XXX,XX +XXX,XX @@ static void versal_virt_init(MachineState *machine) | 16 | @@ -XXX,XX +XXX,XX @@ void v8m_security_lookup(CPUARMState *env, uint32_t address, |
20 | psci_conduit = QEMU_PSCI_CONDUIT_SMC; | 17 | |
18 | static bool get_phys_addr_pmsav8(CPUARMState *env, uint32_t address, | ||
19 | MMUAccessType access_type, ARMMMUIdx mmu_idx, | ||
20 | - hwaddr *phys_ptr, MemTxAttrs *txattrs, | ||
21 | - int *prot, target_ulong *page_size, | ||
22 | + GetPhysAddrResult *result, | ||
23 | ARMMMUFaultInfo *fi) | ||
24 | { | ||
25 | uint32_t secure = regime_is_secure(env, mmu_idx); | ||
26 | @@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_pmsav8(CPUARMState *env, uint32_t address, | ||
27 | } else { | ||
28 | fi->type = ARMFault_QEMU_SFault; | ||
29 | } | ||
30 | - *page_size = sattrs.subpage ? 1 : TARGET_PAGE_SIZE; | ||
31 | - *phys_ptr = address; | ||
32 | - *prot = 0; | ||
33 | + result->page_size = sattrs.subpage ? 1 : TARGET_PAGE_SIZE; | ||
34 | + result->phys = address; | ||
35 | + result->prot = 0; | ||
36 | return true; | ||
37 | } | ||
38 | } else { | ||
39 | @@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_pmsav8(CPUARMState *env, uint32_t address, | ||
40 | * might downgrade a secure access to nonsecure. | ||
41 | */ | ||
42 | if (sattrs.ns) { | ||
43 | - txattrs->secure = false; | ||
44 | + result->attrs.secure = false; | ||
45 | } else if (!secure) { | ||
46 | /* | ||
47 | * NS access to S memory must fault. | ||
48 | @@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_pmsav8(CPUARMState *env, uint32_t address, | ||
49 | * for M_FAKE_FSR_SFAULT in arm_v7m_cpu_do_interrupt(). | ||
50 | */ | ||
51 | fi->type = ARMFault_QEMU_SFault; | ||
52 | - *page_size = sattrs.subpage ? 1 : TARGET_PAGE_SIZE; | ||
53 | - *phys_ptr = address; | ||
54 | - *prot = 0; | ||
55 | + result->page_size = sattrs.subpage ? 1 : TARGET_PAGE_SIZE; | ||
56 | + result->phys = address; | ||
57 | + result->prot = 0; | ||
58 | return true; | ||
59 | } | ||
60 | } | ||
21 | } | 61 | } |
22 | 62 | ||
23 | - sysbus_init_child_obj(OBJECT(machine), "xlnx-ve", &s->soc, | 63 | - ret = pmsav8_mpu_lookup(env, address, access_type, mmu_idx, phys_ptr, |
24 | + sysbus_init_child_obj(OBJECT(machine), "xlnx-versal", &s->soc, | 64 | - txattrs, prot, &mpu_is_subpage, fi, NULL); |
25 | sizeof(s->soc), TYPE_XLNX_VERSAL); | 65 | - *page_size = sattrs.subpage || mpu_is_subpage ? 1 : TARGET_PAGE_SIZE; |
26 | object_property_set_link(OBJECT(&s->soc), OBJECT(machine->ram), | 66 | + ret = pmsav8_mpu_lookup(env, address, access_type, mmu_idx, |
27 | "ddr", &error_abort); | 67 | + &result->phys, &result->attrs, &result->prot, |
68 | + &mpu_is_subpage, fi, NULL); | ||
69 | + result->page_size = | ||
70 | + sattrs.subpage || mpu_is_subpage ? 1 : TARGET_PAGE_SIZE; | ||
71 | return ret; | ||
72 | } | ||
73 | |||
74 | @@ -XXX,XX +XXX,XX @@ bool get_phys_addr(CPUARMState *env, target_ulong address, | ||
75 | if (arm_feature(env, ARM_FEATURE_V8)) { | ||
76 | /* PMSAv8 */ | ||
77 | ret = get_phys_addr_pmsav8(env, address, access_type, mmu_idx, | ||
78 | - &result->phys, &result->attrs, | ||
79 | - &result->prot, &result->page_size, fi); | ||
80 | + result, fi); | ||
81 | } else if (arm_feature(env, ARM_FEATURE_V7)) { | ||
82 | /* PMSAv7 */ | ||
83 | ret = get_phys_addr_pmsav7(env, address, access_type, mmu_idx, | ||
28 | -- | 84 | -- |
29 | 2.20.1 | 85 | 2.25.1 |
30 | 86 | ||
31 | 87 | 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 | Embed the APUs into the SoC type. | 3 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> |
4 | 4 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | |
5 | Suggested-by: Peter Maydell <peter.maydell@linaro.org> | 5 | Message-id: 20220822152741.1617527-10-richard.henderson@linaro.org |
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> | ||
8 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
9 | Reviewed-by: Luc Michel <luc.michel@greensocs.com> | ||
10 | Message-id: 20200427181649.26851-8-edgar.iglesias@gmail.com | ||
11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
12 | --- | 8 | --- |
13 | include/hw/arm/xlnx-versal.h | 2 +- | 9 | target/arm/internals.h | 11 +++++------ |
14 | hw/arm/xlnx-versal-virt.c | 4 ++-- | 10 | target/arm/m_helper.c | 16 +++++++--------- |
15 | hw/arm/xlnx-versal.c | 19 +++++-------------- | 11 | target/arm/ptw.c | 20 +++++++++----------- |
16 | 3 files changed, 8 insertions(+), 17 deletions(-) | 12 | 3 files changed, 21 insertions(+), 26 deletions(-) |
17 | 13 | ||
18 | diff --git a/include/hw/arm/xlnx-versal.h b/include/hw/arm/xlnx-versal.h | 14 | diff --git a/target/arm/internals.h b/target/arm/internals.h |
19 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
20 | --- a/include/hw/arm/xlnx-versal.h | 16 | --- a/target/arm/internals.h |
21 | +++ b/include/hw/arm/xlnx-versal.h | 17 | +++ b/target/arm/internals.h |
22 | @@ -XXX,XX +XXX,XX @@ typedef struct Versal { | 18 | @@ -XXX,XX +XXX,XX @@ void v8m_security_lookup(CPUARMState *env, uint32_t address, |
23 | struct { | 19 | MMUAccessType access_type, ARMMMUIdx mmu_idx, |
24 | struct { | 20 | V8M_SAttributes *sattrs); |
25 | MemoryRegion mr; | 21 | |
26 | - ARMCPU *cpu[XLNX_VERSAL_NR_ACPUS]; | 22 | -bool pmsav8_mpu_lookup(CPUARMState *env, uint32_t address, |
27 | + ARMCPU cpu[XLNX_VERSAL_NR_ACPUS]; | 23 | - MMUAccessType access_type, ARMMMUIdx mmu_idx, |
28 | GICv3State gic; | 24 | - hwaddr *phys_ptr, MemTxAttrs *txattrs, |
29 | } apu; | 25 | - int *prot, bool *is_subpage, |
30 | } fpd; | 26 | - ARMMMUFaultInfo *fi, uint32_t *mregion); |
31 | diff --git a/hw/arm/xlnx-versal-virt.c b/hw/arm/xlnx-versal-virt.c | 27 | - |
28 | /* Cacheability and shareability attributes for a memory access */ | ||
29 | typedef struct ARMCacheAttrs { | ||
30 | /* | ||
31 | @@ -XXX,XX +XXX,XX @@ bool get_phys_addr(CPUARMState *env, target_ulong address, | ||
32 | GetPhysAddrResult *result, ARMMMUFaultInfo *fi) | ||
33 | __attribute__((nonnull)); | ||
34 | |||
35 | +bool pmsav8_mpu_lookup(CPUARMState *env, uint32_t address, | ||
36 | + MMUAccessType access_type, ARMMMUIdx mmu_idx, | ||
37 | + GetPhysAddrResult *result, bool *is_subpage, | ||
38 | + ARMMMUFaultInfo *fi, uint32_t *mregion); | ||
39 | + | ||
40 | void arm_log_exception(CPUState *cs); | ||
41 | |||
42 | #endif /* !CONFIG_USER_ONLY */ | ||
43 | diff --git a/target/arm/m_helper.c b/target/arm/m_helper.c | ||
32 | index XXXXXXX..XXXXXXX 100644 | 44 | index XXXXXXX..XXXXXXX 100644 |
33 | --- a/hw/arm/xlnx-versal-virt.c | 45 | --- a/target/arm/m_helper.c |
34 | +++ b/hw/arm/xlnx-versal-virt.c | 46 | +++ b/target/arm/m_helper.c |
35 | @@ -XXX,XX +XXX,XX @@ static void versal_virt_init(MachineState *machine) | 47 | @@ -XXX,XX +XXX,XX @@ uint32_t HELPER(v7m_tt)(CPUARMState *env, uint32_t addr, uint32_t op) |
36 | s->binfo.get_dtb = versal_virt_get_dtb; | 48 | V8M_SAttributes sattrs = {}; |
37 | s->binfo.modify_dtb = versal_virt_modify_dtb; | 49 | uint32_t tt_resp; |
38 | if (machine->kernel_filename) { | 50 | bool r, rw, nsr, nsrw, mrvalid; |
39 | - arm_load_kernel(s->soc.fpd.apu.cpu[0], machine, &s->binfo); | 51 | - int prot; |
40 | + arm_load_kernel(&s->soc.fpd.apu.cpu[0], machine, &s->binfo); | 52 | - ARMMMUFaultInfo fi = {}; |
53 | - MemTxAttrs attrs = {}; | ||
54 | - hwaddr phys_addr; | ||
55 | ARMMMUIdx mmu_idx; | ||
56 | uint32_t mregion; | ||
57 | bool targetpriv; | ||
58 | bool targetsec = env->v7m.secure; | ||
59 | - bool is_subpage; | ||
60 | |||
61 | /* | ||
62 | * Work out what the security state and privilege level we're | ||
63 | @@ -XXX,XX +XXX,XX @@ uint32_t HELPER(v7m_tt)(CPUARMState *env, uint32_t addr, uint32_t op) | ||
64 | * inspecting the other MPU state. | ||
65 | */ | ||
66 | if (arm_current_el(env) != 0 || alt) { | ||
67 | + GetPhysAddrResult res = {}; | ||
68 | + ARMMMUFaultInfo fi = {}; | ||
69 | + bool is_subpage; | ||
70 | + | ||
71 | /* We can ignore the return value as prot is always set */ | ||
72 | pmsav8_mpu_lookup(env, addr, MMU_DATA_LOAD, mmu_idx, | ||
73 | - &phys_addr, &attrs, &prot, &is_subpage, | ||
74 | - &fi, &mregion); | ||
75 | + &res, &is_subpage, &fi, &mregion); | ||
76 | if (mregion == -1) { | ||
77 | mrvalid = false; | ||
78 | mregion = 0; | ||
79 | } else { | ||
80 | mrvalid = true; | ||
81 | } | ||
82 | - r = prot & PAGE_READ; | ||
83 | - rw = prot & PAGE_WRITE; | ||
84 | + r = res.prot & PAGE_READ; | ||
85 | + rw = res.prot & PAGE_WRITE; | ||
41 | } else { | 86 | } else { |
42 | - AddressSpace *as = arm_boot_address_space(s->soc.fpd.apu.cpu[0], | 87 | r = false; |
43 | + AddressSpace *as = arm_boot_address_space(&s->soc.fpd.apu.cpu[0], | 88 | rw = false; |
44 | &s->binfo); | 89 | diff --git a/target/arm/ptw.c b/target/arm/ptw.c |
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 | 90 | index XXXXXXX..XXXXXXX 100644 |
49 | --- a/hw/arm/xlnx-versal.c | 91 | --- a/target/arm/ptw.c |
50 | +++ b/hw/arm/xlnx-versal.c | 92 | +++ b/target/arm/ptw.c |
51 | @@ -XXX,XX +XXX,XX @@ static void versal_create_apu_cpus(Versal *s) | 93 | @@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_pmsav7(CPUARMState *env, uint32_t address, |
52 | 94 | ||
53 | for (i = 0; i < ARRAY_SIZE(s->fpd.apu.cpu); i++) { | 95 | bool pmsav8_mpu_lookup(CPUARMState *env, uint32_t address, |
54 | Object *obj; | 96 | MMUAccessType access_type, ARMMMUIdx mmu_idx, |
55 | - char *name; | 97 | - hwaddr *phys_ptr, MemTxAttrs *txattrs, |
56 | - | 98 | - int *prot, bool *is_subpage, |
57 | - obj = object_new(XLNX_VERSAL_ACPU_TYPE); | 99 | + GetPhysAddrResult *result, bool *is_subpage, |
58 | - if (!obj) { | 100 | ARMMMUFaultInfo *fi, uint32_t *mregion) |
59 | - error_report("Unable to create apu.cpu[%d] of type %s", | 101 | { |
60 | - i, XLNX_VERSAL_ACPU_TYPE); | 102 | /* |
61 | - exit(EXIT_FAILURE); | 103 | @@ -XXX,XX +XXX,XX @@ bool pmsav8_mpu_lookup(CPUARMState *env, uint32_t address, |
62 | - } | 104 | uint32_t addr_page_limit = addr_page_base + (TARGET_PAGE_SIZE - 1); |
63 | - | 105 | |
64 | - name = g_strdup_printf("apu-cpu[%d]", i); | 106 | *is_subpage = false; |
65 | - object_property_add_child(OBJECT(s), name, obj, &error_fatal); | 107 | - *phys_ptr = address; |
66 | - g_free(name); | 108 | - *prot = 0; |
67 | 109 | + result->phys = address; | |
68 | + object_initialize_child(OBJECT(s), "apu-cpu[*]", | 110 | + result->prot = 0; |
69 | + &s->fpd.apu.cpu[i], sizeof(s->fpd.apu.cpu[i]), | 111 | if (mregion) { |
70 | + XLNX_VERSAL_ACPU_TYPE, &error_abort, NULL); | 112 | *mregion = -1; |
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 | } | 113 | } |
114 | @@ -XXX,XX +XXX,XX @@ bool pmsav8_mpu_lookup(CPUARMState *env, uint32_t address, | ||
115 | |||
116 | if (matchregion == -1) { | ||
117 | /* hit using the background region */ | ||
118 | - get_phys_addr_pmsav7_default(env, mmu_idx, address, prot); | ||
119 | + get_phys_addr_pmsav7_default(env, mmu_idx, address, &result->prot); | ||
120 | } else { | ||
121 | uint32_t ap = extract32(env->pmsav8.rbar[secure][matchregion], 1, 2); | ||
122 | uint32_t xn = extract32(env->pmsav8.rbar[secure][matchregion], 0, 1); | ||
123 | @@ -XXX,XX +XXX,XX @@ bool pmsav8_mpu_lookup(CPUARMState *env, uint32_t address, | ||
124 | xn = 1; | ||
125 | } | ||
126 | |||
127 | - *prot = simple_ap_to_rw_prot(env, mmu_idx, ap); | ||
128 | - if (*prot && !xn && !(pxn && !is_user)) { | ||
129 | - *prot |= PAGE_EXEC; | ||
130 | + result->prot = simple_ap_to_rw_prot(env, mmu_idx, ap); | ||
131 | + if (result->prot && !xn && !(pxn && !is_user)) { | ||
132 | + result->prot |= PAGE_EXEC; | ||
133 | } | ||
134 | /* | ||
135 | * We don't need to look the attribute up in the MAIR0/MAIR1 | ||
136 | @@ -XXX,XX +XXX,XX @@ bool pmsav8_mpu_lookup(CPUARMState *env, uint32_t address, | ||
137 | |||
138 | fi->type = ARMFault_Permission; | ||
139 | fi->level = 1; | ||
140 | - return !(*prot & (1 << access_type)); | ||
141 | + return !(result->prot & (1 << access_type)); | ||
81 | } | 142 | } |
82 | 143 | ||
83 | @@ -XXX,XX +XXX,XX @@ static void versal_create_apu_gic(Versal *s, qemu_irq *pic) | 144 | static bool v8m_is_sau_exempt(CPUARMState *env, |
145 | @@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_pmsav8(CPUARMState *env, uint32_t address, | ||
84 | } | 146 | } |
85 | 147 | ||
86 | for (i = 0; i < nr_apu_cpus; i++) { | 148 | ret = pmsav8_mpu_lookup(env, address, access_type, mmu_idx, |
87 | - DeviceState *cpudev = DEVICE(s->fpd.apu.cpu[i]); | 149 | - &result->phys, &result->attrs, &result->prot, |
88 | + DeviceState *cpudev = DEVICE(&s->fpd.apu.cpu[i]); | 150 | - &mpu_is_subpage, fi, NULL); |
89 | int ppibase = XLNX_VERSAL_NR_IRQS + i * GIC_INTERNAL + GIC_NR_SGIS; | 151 | + result, &mpu_is_subpage, fi, NULL); |
90 | qemu_irq maint_irq; | 152 | result->page_size = |
91 | int ti; | 153 | sattrs.subpage || mpu_is_subpage ? 1 : TARGET_PAGE_SIZE; |
154 | return ret; | ||
92 | -- | 155 | -- |
93 | 2.20.1 | 156 | 2.25.1 |
94 | 157 | ||
95 | 158 | 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 | Remove inclusion of arm_gicv3_common.h, this already gets | 3 | This can be made redundant with result->page_size, by moving the basic |
4 | included via xlnx-versal.h. | 4 | set of page_size from get_phys_addr_pmsav8. We still need to overwrite |
5 | page_size when v8m_security_lookup signals a subpage. | ||
5 | 6 | ||
6 | Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | 7 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
7 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | 8 | Message-id: 20220822152741.1617527-11-richard.henderson@linaro.org |
8 | Reviewed-by: Luc Michel <luc.michel@greensocs.com> | 9 | [PMM: Update a comment that used to refer to is_subpage] |
9 | Message-id: 20200427181649.26851-2-edgar.iglesias@gmail.com | 10 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
11 | --- | 12 | --- |
12 | hw/arm/xlnx-versal.c | 1 - | 13 | target/arm/internals.h | 4 ++-- |
13 | 1 file changed, 1 deletion(-) | 14 | target/arm/m_helper.c | 3 +-- |
15 | target/arm/ptw.c | 23 ++++++++++++----------- | ||
16 | 3 files changed, 15 insertions(+), 15 deletions(-) | ||
14 | 17 | ||
15 | diff --git a/hw/arm/xlnx-versal.c b/hw/arm/xlnx-versal.c | 18 | diff --git a/target/arm/internals.h b/target/arm/internals.h |
16 | index XXXXXXX..XXXXXXX 100644 | 19 | index XXXXXXX..XXXXXXX 100644 |
17 | --- a/hw/arm/xlnx-versal.c | 20 | --- a/target/arm/internals.h |
18 | +++ b/hw/arm/xlnx-versal.c | 21 | +++ b/target/arm/internals.h |
19 | @@ -XXX,XX +XXX,XX @@ | 22 | @@ -XXX,XX +XXX,XX @@ bool get_phys_addr(CPUARMState *env, target_ulong address, |
20 | #include "hw/arm/boot.h" | 23 | |
21 | #include "kvm_arm.h" | 24 | bool pmsav8_mpu_lookup(CPUARMState *env, uint32_t address, |
22 | #include "hw/misc/unimp.h" | 25 | MMUAccessType access_type, ARMMMUIdx mmu_idx, |
23 | -#include "hw/intc/arm_gicv3_common.h" | 26 | - GetPhysAddrResult *result, bool *is_subpage, |
24 | #include "hw/arm/xlnx-versal.h" | 27 | - ARMMMUFaultInfo *fi, uint32_t *mregion); |
25 | #include "hw/char/pl011.h" | 28 | + GetPhysAddrResult *result, ARMMMUFaultInfo *fi, |
29 | + uint32_t *mregion); | ||
30 | |||
31 | void arm_log_exception(CPUState *cs); | ||
32 | |||
33 | diff --git a/target/arm/m_helper.c b/target/arm/m_helper.c | ||
34 | index XXXXXXX..XXXXXXX 100644 | ||
35 | --- a/target/arm/m_helper.c | ||
36 | +++ b/target/arm/m_helper.c | ||
37 | @@ -XXX,XX +XXX,XX @@ uint32_t HELPER(v7m_tt)(CPUARMState *env, uint32_t addr, uint32_t op) | ||
38 | if (arm_current_el(env) != 0 || alt) { | ||
39 | GetPhysAddrResult res = {}; | ||
40 | ARMMMUFaultInfo fi = {}; | ||
41 | - bool is_subpage; | ||
42 | |||
43 | /* We can ignore the return value as prot is always set */ | ||
44 | pmsav8_mpu_lookup(env, addr, MMU_DATA_LOAD, mmu_idx, | ||
45 | - &res, &is_subpage, &fi, &mregion); | ||
46 | + &res, &fi, &mregion); | ||
47 | if (mregion == -1) { | ||
48 | mrvalid = false; | ||
49 | mregion = 0; | ||
50 | diff --git a/target/arm/ptw.c b/target/arm/ptw.c | ||
51 | index XXXXXXX..XXXXXXX 100644 | ||
52 | --- a/target/arm/ptw.c | ||
53 | +++ b/target/arm/ptw.c | ||
54 | @@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_pmsav7(CPUARMState *env, uint32_t address, | ||
55 | |||
56 | bool pmsav8_mpu_lookup(CPUARMState *env, uint32_t address, | ||
57 | MMUAccessType access_type, ARMMMUIdx mmu_idx, | ||
58 | - GetPhysAddrResult *result, bool *is_subpage, | ||
59 | - ARMMMUFaultInfo *fi, uint32_t *mregion) | ||
60 | + GetPhysAddrResult *result, ARMMMUFaultInfo *fi, | ||
61 | + uint32_t *mregion) | ||
62 | { | ||
63 | /* | ||
64 | * Perform a PMSAv8 MPU lookup (without also doing the SAU check | ||
65 | @@ -XXX,XX +XXX,XX @@ bool pmsav8_mpu_lookup(CPUARMState *env, uint32_t address, | ||
66 | * mregion is (if not NULL) set to the region number which matched, | ||
67 | * or -1 if no region number is returned (MPU off, address did not | ||
68 | * hit a region, address hit in multiple regions). | ||
69 | - * We set is_subpage to true if the region hit doesn't cover the | ||
70 | - * entire TARGET_PAGE the address is within. | ||
71 | + * If the region hit doesn't cover the entire TARGET_PAGE the address | ||
72 | + * is within, then we set the result page_size to 1 to force the | ||
73 | + * memory system to use a subpage. | ||
74 | */ | ||
75 | ARMCPU *cpu = env_archcpu(env); | ||
76 | bool is_user = regime_is_user(env, mmu_idx); | ||
77 | @@ -XXX,XX +XXX,XX @@ bool pmsav8_mpu_lookup(CPUARMState *env, uint32_t address, | ||
78 | uint32_t addr_page_base = address & TARGET_PAGE_MASK; | ||
79 | uint32_t addr_page_limit = addr_page_base + (TARGET_PAGE_SIZE - 1); | ||
80 | |||
81 | - *is_subpage = false; | ||
82 | + result->page_size = TARGET_PAGE_SIZE; | ||
83 | result->phys = address; | ||
84 | result->prot = 0; | ||
85 | if (mregion) { | ||
86 | @@ -XXX,XX +XXX,XX @@ bool pmsav8_mpu_lookup(CPUARMState *env, uint32_t address, | ||
87 | ranges_overlap(base, limit - base + 1, | ||
88 | addr_page_base, | ||
89 | TARGET_PAGE_SIZE)) { | ||
90 | - *is_subpage = true; | ||
91 | + result->page_size = 1; | ||
92 | } | ||
93 | continue; | ||
94 | } | ||
95 | |||
96 | if (base > addr_page_base || limit < addr_page_limit) { | ||
97 | - *is_subpage = true; | ||
98 | + result->page_size = 1; | ||
99 | } | ||
100 | |||
101 | if (matchregion != -1) { | ||
102 | @@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_pmsav8(CPUARMState *env, uint32_t address, | ||
103 | uint32_t secure = regime_is_secure(env, mmu_idx); | ||
104 | V8M_SAttributes sattrs = {}; | ||
105 | bool ret; | ||
106 | - bool mpu_is_subpage; | ||
107 | |||
108 | if (arm_feature(env, ARM_FEATURE_M_SECURITY)) { | ||
109 | v8m_security_lookup(env, address, access_type, mmu_idx, &sattrs); | ||
110 | @@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_pmsav8(CPUARMState *env, uint32_t address, | ||
111 | } | ||
112 | |||
113 | ret = pmsav8_mpu_lookup(env, address, access_type, mmu_idx, | ||
114 | - result, &mpu_is_subpage, fi, NULL); | ||
115 | - result->page_size = | ||
116 | - sattrs.subpage || mpu_is_subpage ? 1 : TARGET_PAGE_SIZE; | ||
117 | + result, fi, NULL); | ||
118 | + if (sattrs.subpage) { | ||
119 | + result->page_size = 1; | ||
120 | + } | ||
121 | return ret; | ||
122 | } | ||
26 | 123 | ||
27 | -- | 124 | -- |
28 | 2.20.1 | 125 | 2.25.1 |
29 | |||
30 | diff view generated by jsdifflib |
1 | Add the infrastructure for building and invoking a decodetree decoder | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | for the AArch32 Neon encodings. At the moment the new decoder covers | ||
3 | nothing, so we always fall back to the existing hand-written decode. | ||
4 | 2 | ||
5 | We follow the same pattern we did for the VFP decodetree conversion | 3 | Remove the use of regime_is_secure from v8m_security_lookup, |
6 | (commit 78e138bc1f672c145ef6ace74617d and following): code that deals | 4 | passing the new parameter to the lookup instead. |
7 | with Neon will be moving gradually out to translate-neon.vfp.inc, | ||
8 | which we #include into translate.c. | ||
9 | 5 | ||
10 | In order to share the decode files between A32 and T32, we | 6 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> |
11 | split Neon into 3 parts: | 7 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
12 | * data-processing | 8 | Message-id: 20220822152741.1617527-12-richard.henderson@linaro.org |
13 | * load-store | 9 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
14 | * 'shared' encodings | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
11 | --- | ||
12 | target/arm/internals.h | 2 +- | ||
13 | target/arm/m_helper.c | 9 ++++++--- | ||
14 | target/arm/ptw.c | 9 +++++---- | ||
15 | 3 files changed, 12 insertions(+), 8 deletions(-) | ||
15 | 16 | ||
16 | The first two groups of instructions have similar but not identical | 17 | diff --git a/target/arm/internals.h b/target/arm/internals.h |
17 | A32 and T32 encodings, so we need to manually transform the T32 | ||
18 | encoding into the A32 one before calling the decoder; the third group | ||
19 | covers the Neon instructions which are identical in A32 and T32. | ||
20 | |||
21 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
22 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
23 | Message-id: 20200430181003.21682-4-peter.maydell@linaro.org | ||
24 | --- | ||
25 | target/arm/neon-dp.decode | 29 ++++++++++++++++++++++++++ | ||
26 | target/arm/neon-ls.decode | 29 ++++++++++++++++++++++++++ | ||
27 | target/arm/neon-shared.decode | 27 +++++++++++++++++++++++++ | ||
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 | |||
37 | diff --git a/target/arm/neon-dp.decode b/target/arm/neon-dp.decode | ||
38 | new file mode 100644 | ||
39 | index XXXXXXX..XXXXXXX | ||
40 | --- /dev/null | ||
41 | +++ b/target/arm/neon-dp.decode | ||
42 | @@ -XXX,XX +XXX,XX @@ | ||
43 | +# AArch32 Neon data-processing instruction descriptions | ||
44 | +# | ||
45 | +# Copyright (c) 2020 Linaro, Ltd | ||
46 | +# | ||
47 | +# This library is free software; you can redistribute it and/or | ||
48 | +# modify it under the terms of the GNU Lesser General Public | ||
49 | +# License as published by the Free Software Foundation; either | ||
50 | +# version 2 of the License, or (at your option) any later version. | ||
51 | +# | ||
52 | +# This library is distributed in the hope that it will be useful, | ||
53 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
54 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
55 | +# Lesser General Public License for more details. | ||
56 | +# | ||
57 | +# You should have received a copy of the GNU Lesser General Public | ||
58 | +# License along with this library; if not, see <http://www.gnu.org/licenses/>. | ||
59 | + | ||
60 | +# | ||
61 | +# This file is processed by scripts/decodetree.py | ||
62 | +# | ||
63 | + | ||
64 | +# Encodings for Neon data processing instructions where the T32 encoding | ||
65 | +# is a simple transformation of the A32 encoding. | ||
66 | +# More specifically, this file covers instructions where the A32 encoding is | ||
67 | +# 0b1111_001p_qqqq_qqqq_qqqq_qqqq_qqqq_qqqq | ||
68 | +# and the T32 encoding is | ||
69 | +# 0b111p_1111_qqqq_qqqq_qqqq_qqqq_qqqq_qqqq | ||
70 | +# This file works on the A32 encoding only; calling code for T32 has to | ||
71 | +# transform the insn into the A32 version first. | ||
72 | diff --git a/target/arm/neon-ls.decode b/target/arm/neon-ls.decode | ||
73 | new file mode 100644 | ||
74 | index XXXXXXX..XXXXXXX | ||
75 | --- /dev/null | ||
76 | +++ b/target/arm/neon-ls.decode | ||
77 | @@ -XXX,XX +XXX,XX @@ | ||
78 | +# AArch32 Neon load/store instruction descriptions | ||
79 | +# | ||
80 | +# Copyright (c) 2020 Linaro, Ltd | ||
81 | +# | ||
82 | +# This library is free software; you can redistribute it and/or | ||
83 | +# modify it under the terms of the GNU Lesser General Public | ||
84 | +# License as published by the Free Software Foundation; either | ||
85 | +# version 2 of the License, or (at your option) any later version. | ||
86 | +# | ||
87 | +# This library is distributed in the hope that it will be useful, | ||
88 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
89 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
90 | +# Lesser General Public License for more details. | ||
91 | +# | ||
92 | +# You should have received a copy of the GNU Lesser General Public | ||
93 | +# License along with this library; if not, see <http://www.gnu.org/licenses/>. | ||
94 | + | ||
95 | +# | ||
96 | +# This file is processed by scripts/decodetree.py | ||
97 | +# | ||
98 | + | ||
99 | +# Encodings for Neon load/store instructions where the T32 encoding | ||
100 | +# is a simple transformation of the A32 encoding. | ||
101 | +# More specifically, this file covers instructions where the A32 encoding is | ||
102 | +# 0b1111_0100_xxx0_xxxx_xxxx_xxxx_xxxx_xxxx | ||
103 | +# and the T32 encoding is | ||
104 | +# 0b1111_1001_xxx0_xxxx_xxxx_xxxx_xxxx_xxxx | ||
105 | +# This file works on the A32 encoding only; calling code for T32 has to | ||
106 | +# transform the insn into the A32 version first. | ||
107 | diff --git a/target/arm/neon-shared.decode b/target/arm/neon-shared.decode | ||
108 | new file mode 100644 | ||
109 | index XXXXXXX..XXXXXXX | ||
110 | --- /dev/null | ||
111 | +++ b/target/arm/neon-shared.decode | ||
112 | @@ -XXX,XX +XXX,XX @@ | ||
113 | +# AArch32 Neon instruction descriptions | ||
114 | +# | ||
115 | +# Copyright (c) 2020 Linaro, Ltd | ||
116 | +# | ||
117 | +# This library is free software; you can redistribute it and/or | ||
118 | +# modify it under the terms of the GNU Lesser General Public | ||
119 | +# License as published by the Free Software Foundation; either | ||
120 | +# version 2 of the License, or (at your option) any later version. | ||
121 | +# | ||
122 | +# This library is distributed in the hope that it will be useful, | ||
123 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
124 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
125 | +# Lesser General Public License for more details. | ||
126 | +# | ||
127 | +# You should have received a copy of the GNU Lesser General Public | ||
128 | +# License along with this library; if not, see <http://www.gnu.org/licenses/>. | ||
129 | + | ||
130 | +# | ||
131 | +# This file is processed by scripts/decodetree.py | ||
132 | +# | ||
133 | + | ||
134 | +# Encodings for Neon instructions whose encoding is the same for | ||
135 | +# both A32 and T32. | ||
136 | + | ||
137 | +# More specifically, this covers: | ||
138 | +# 2reg scalar ext: 0b1111_1110_xxxx_xxxx_xxxx_1x0x_xxxx_xxxx | ||
139 | +# 3same ext: 0b1111_110x_xxxx_xxxx_xxxx_1x0x_xxxx_xxxx | ||
140 | diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c | ||
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 | ||
179 | index XXXXXXX..XXXXXXX 100644 | 18 | index XXXXXXX..XXXXXXX 100644 |
180 | --- a/target/arm/translate.c | 19 | --- a/target/arm/internals.h |
181 | +++ b/target/arm/translate.c | 20 | +++ b/target/arm/internals.h |
182 | @@ -XXX,XX +XXX,XX @@ static TCGv_ptr vfp_reg_ptr(bool dp, int reg) | 21 | @@ -XXX,XX +XXX,XX @@ typedef struct V8M_SAttributes { |
183 | 22 | ||
184 | #define ARM_CP_RW_BIT (1 << 20) | 23 | void v8m_security_lookup(CPUARMState *env, uint32_t address, |
185 | 24 | MMUAccessType access_type, ARMMMUIdx mmu_idx, | |
186 | -/* Include the VFP decoder */ | 25 | - V8M_SAttributes *sattrs); |
187 | +/* Include the VFP and Neon decoders */ | 26 | + bool secure, V8M_SAttributes *sattrs); |
188 | #include "translate-vfp.inc.c" | 27 | |
189 | +#include "translate-neon.inc.c" | 28 | /* Cacheability and shareability attributes for a memory access */ |
190 | 29 | typedef struct ARMCacheAttrs { | |
191 | static inline void iwmmxt_load_reg(TCGv_i64 var, int reg) | 30 | diff --git a/target/arm/m_helper.c b/target/arm/m_helper.c |
31 | index XXXXXXX..XXXXXXX 100644 | ||
32 | --- a/target/arm/m_helper.c | ||
33 | +++ b/target/arm/m_helper.c | ||
34 | @@ -XXX,XX +XXX,XX @@ static bool arm_v7m_load_vector(ARMCPU *cpu, int exc, bool targets_secure, | ||
35 | if (arm_feature(env, ARM_FEATURE_M_SECURITY)) { | ||
36 | V8M_SAttributes sattrs = {}; | ||
37 | |||
38 | - v8m_security_lookup(env, addr, MMU_DATA_LOAD, mmu_idx, &sattrs); | ||
39 | + v8m_security_lookup(env, addr, MMU_DATA_LOAD, mmu_idx, | ||
40 | + targets_secure, &sattrs); | ||
41 | if (sattrs.ns) { | ||
42 | attrs.secure = false; | ||
43 | } else if (!targets_secure) { | ||
44 | @@ -XXX,XX +XXX,XX @@ static bool v7m_read_half_insn(ARMCPU *cpu, ARMMMUIdx mmu_idx, | ||
45 | ARMMMUFaultInfo fi = {}; | ||
46 | MemTxResult txres; | ||
47 | |||
48 | - v8m_security_lookup(env, addr, MMU_INST_FETCH, mmu_idx, &sattrs); | ||
49 | + v8m_security_lookup(env, addr, MMU_INST_FETCH, mmu_idx, | ||
50 | + regime_is_secure(env, mmu_idx), &sattrs); | ||
51 | if (!sattrs.nsc || sattrs.ns) { | ||
52 | /* | ||
53 | * This must be the second half of the insn, and it straddles a | ||
54 | @@ -XXX,XX +XXX,XX @@ uint32_t HELPER(v7m_tt)(CPUARMState *env, uint32_t addr, uint32_t op) | ||
55 | } | ||
56 | |||
57 | if (env->v7m.secure) { | ||
58 | - v8m_security_lookup(env, addr, MMU_DATA_LOAD, mmu_idx, &sattrs); | ||
59 | + v8m_security_lookup(env, addr, MMU_DATA_LOAD, mmu_idx, | ||
60 | + targetsec, &sattrs); | ||
61 | nsr = sattrs.ns && r; | ||
62 | nsrw = sattrs.ns && rw; | ||
63 | } else { | ||
64 | diff --git a/target/arm/ptw.c b/target/arm/ptw.c | ||
65 | index XXXXXXX..XXXXXXX 100644 | ||
66 | --- a/target/arm/ptw.c | ||
67 | +++ b/target/arm/ptw.c | ||
68 | @@ -XXX,XX +XXX,XX @@ static bool v8m_is_sau_exempt(CPUARMState *env, | ||
69 | } | ||
70 | |||
71 | void v8m_security_lookup(CPUARMState *env, uint32_t address, | ||
72 | - MMUAccessType access_type, ARMMMUIdx mmu_idx, | ||
73 | - V8M_SAttributes *sattrs) | ||
74 | + MMUAccessType access_type, ARMMMUIdx mmu_idx, | ||
75 | + bool is_secure, V8M_SAttributes *sattrs) | ||
192 | { | 76 | { |
193 | @@ -XXX,XX +XXX,XX @@ static void disas_arm_insn(DisasContext *s, unsigned int insn) | 77 | /* |
194 | /* Unconditional instructions. */ | 78 | * Look up the security attributes for this address. Compare the |
195 | /* TODO: Perhaps merge these into one decodetree output file. */ | 79 | @@ -XXX,XX +XXX,XX @@ void v8m_security_lookup(CPUARMState *env, uint32_t address, |
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 | } | 80 | } |
208 | 81 | ||
209 | + if ((insn & 0xef000000) == 0xef000000) { | 82 | if (idau_exempt || v8m_is_sau_exempt(env, address, access_type)) { |
210 | + /* | 83 | - sattrs->ns = !regime_is_secure(env, mmu_idx); |
211 | + * T32 encodings 0b111p_1111_qqqq_qqqq_qqqq_qqqq_qqqq_qqqq | 84 | + sattrs->ns = !is_secure; |
212 | + * transform into | ||
213 | + * A32 encodings 0b1111_001p_qqqq_qqqq_qqqq_qqqq_qqqq_qqqq | ||
214 | + */ | ||
215 | + uint32_t a32_insn = (insn & 0xe2ffffff) | | ||
216 | + ((insn & (1 << 28)) >> 4) | (1 << 28); | ||
217 | + | ||
218 | + if (disas_neon_dp(s, a32_insn)) { | ||
219 | + return; | ||
220 | + } | ||
221 | + } | ||
222 | + | ||
223 | + if ((insn & 0xff100000) == 0xf9000000) { | ||
224 | + /* | ||
225 | + * T32 encodings 0b1111_1001_ppp0_qqqq_qqqq_qqqq_qqqq_qqqq | ||
226 | + * transform into | ||
227 | + * A32 encodings 0b1111_0100_ppp0_qqqq_qqqq_qqqq_qqqq_qqqq | ||
228 | + */ | ||
229 | + uint32_t a32_insn = (insn & 0x00ffffff) | 0xf4000000; | ||
230 | + | ||
231 | + if (disas_neon_ls(s, a32_insn)) { | ||
232 | + return; | ||
233 | + } | ||
234 | + } | ||
235 | + | ||
236 | /* | ||
237 | * TODO: Perhaps merge these into one decodetree output file. | ||
238 | * Note disas_vfp is written for a32 with cond field in the | ||
239 | @@ -XXX,XX +XXX,XX @@ static void disas_thumb2_insn(DisasContext *s, uint32_t insn) | ||
240 | */ | ||
241 | if (disas_t32(s, insn) || | ||
242 | disas_vfp_uncond(s, insn) || | ||
243 | + disas_neon_shared(s, insn) || | ||
244 | ((insn >> 28) == 0xe && disas_vfp(s, insn))) { | ||
245 | return; | 85 | return; |
246 | } | 86 | } |
247 | diff --git a/target/arm/Makefile.objs b/target/arm/Makefile.objs | 87 | |
248 | index XXXXXXX..XXXXXXX 100644 | 88 | @@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_pmsav8(CPUARMState *env, uint32_t address, |
249 | --- a/target/arm/Makefile.objs | 89 | bool ret; |
250 | +++ b/target/arm/Makefile.objs | 90 | |
251 | @@ -XXX,XX +XXX,XX @@ target/arm/decode-sve.inc.c: $(SRC_PATH)/target/arm/sve.decode $(DECODETREE) | 91 | if (arm_feature(env, ARM_FEATURE_M_SECURITY)) { |
252 | $(PYTHON) $(DECODETREE) --decode disas_sve -o $@ $<,\ | 92 | - v8m_security_lookup(env, address, access_type, mmu_idx, &sattrs); |
253 | "GEN", $(TARGET_DIR)$@) | 93 | + v8m_security_lookup(env, address, access_type, mmu_idx, |
254 | 94 | + secure, &sattrs); | |
255 | +target/arm/decode-neon-shared.inc.c: $(SRC_PATH)/target/arm/neon-shared.decode $(DECODETREE) | 95 | if (access_type == MMU_INST_FETCH) { |
256 | + $(call quiet-command,\ | 96 | /* |
257 | + $(PYTHON) $(DECODETREE) --static-decode disas_neon_shared -o $@ $<,\ | 97 | * Instruction fetches always use the MMU bank and the |
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 | -- | 98 | -- |
284 | 2.20.1 | 99 | 2.25.1 |
285 | 100 | ||
286 | 101 | diff view generated by jsdifflib |
1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | By using the TYPE_* definitions for devices, we can: | 3 | Remove the use of regime_is_secure from pmsav8_mpu_lookup, |
4 | - quickly find where devices are used with 'git-grep' | 4 | passing the new parameter to the lookup instead. |
5 | - easily rename a device (one-line change). | ||
6 | 5 | ||
7 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 6 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> |
8 | Message-id: 20200428154650.21991-1-f4bug@amsat.org | 7 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
8 | Message-id: 20220822152741.1617527-13-richard.henderson@linaro.org | ||
9 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
11 | --- | 11 | --- |
12 | hw/arm/mps2-tz.c | 2 +- | 12 | target/arm/internals.h | 4 ++-- |
13 | 1 file changed, 1 insertion(+), 1 deletion(-) | 13 | target/arm/m_helper.c | 2 +- |
14 | target/arm/ptw.c | 7 +++---- | ||
15 | 3 files changed, 6 insertions(+), 7 deletions(-) | ||
14 | 16 | ||
15 | diff --git a/hw/arm/mps2-tz.c b/hw/arm/mps2-tz.c | 17 | diff --git a/target/arm/internals.h b/target/arm/internals.h |
16 | index XXXXXXX..XXXXXXX 100644 | 18 | index XXXXXXX..XXXXXXX 100644 |
17 | --- a/hw/arm/mps2-tz.c | 19 | --- a/target/arm/internals.h |
18 | +++ b/hw/arm/mps2-tz.c | 20 | +++ b/target/arm/internals.h |
19 | @@ -XXX,XX +XXX,XX @@ static void mps2tz_common_init(MachineState *machine) | 21 | @@ -XXX,XX +XXX,XX @@ bool get_phys_addr(CPUARMState *env, target_ulong address, |
20 | exit(EXIT_FAILURE); | 22 | |
23 | bool pmsav8_mpu_lookup(CPUARMState *env, uint32_t address, | ||
24 | MMUAccessType access_type, ARMMMUIdx mmu_idx, | ||
25 | - GetPhysAddrResult *result, ARMMMUFaultInfo *fi, | ||
26 | - uint32_t *mregion); | ||
27 | + bool is_secure, GetPhysAddrResult *result, | ||
28 | + ARMMMUFaultInfo *fi, uint32_t *mregion); | ||
29 | |||
30 | void arm_log_exception(CPUState *cs); | ||
31 | |||
32 | diff --git a/target/arm/m_helper.c b/target/arm/m_helper.c | ||
33 | index XXXXXXX..XXXXXXX 100644 | ||
34 | --- a/target/arm/m_helper.c | ||
35 | +++ b/target/arm/m_helper.c | ||
36 | @@ -XXX,XX +XXX,XX @@ uint32_t HELPER(v7m_tt)(CPUARMState *env, uint32_t addr, uint32_t op) | ||
37 | ARMMMUFaultInfo fi = {}; | ||
38 | |||
39 | /* We can ignore the return value as prot is always set */ | ||
40 | - pmsav8_mpu_lookup(env, addr, MMU_DATA_LOAD, mmu_idx, | ||
41 | + pmsav8_mpu_lookup(env, addr, MMU_DATA_LOAD, mmu_idx, targetsec, | ||
42 | &res, &fi, &mregion); | ||
43 | if (mregion == -1) { | ||
44 | mrvalid = false; | ||
45 | diff --git a/target/arm/ptw.c b/target/arm/ptw.c | ||
46 | index XXXXXXX..XXXXXXX 100644 | ||
47 | --- a/target/arm/ptw.c | ||
48 | +++ b/target/arm/ptw.c | ||
49 | @@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_pmsav7(CPUARMState *env, uint32_t address, | ||
50 | |||
51 | bool pmsav8_mpu_lookup(CPUARMState *env, uint32_t address, | ||
52 | MMUAccessType access_type, ARMMMUIdx mmu_idx, | ||
53 | - GetPhysAddrResult *result, ARMMMUFaultInfo *fi, | ||
54 | - uint32_t *mregion) | ||
55 | + bool secure, GetPhysAddrResult *result, | ||
56 | + ARMMMUFaultInfo *fi, uint32_t *mregion) | ||
57 | { | ||
58 | /* | ||
59 | * Perform a PMSAv8 MPU lookup (without also doing the SAU check | ||
60 | @@ -XXX,XX +XXX,XX @@ bool pmsav8_mpu_lookup(CPUARMState *env, uint32_t address, | ||
61 | */ | ||
62 | ARMCPU *cpu = env_archcpu(env); | ||
63 | bool is_user = regime_is_user(env, mmu_idx); | ||
64 | - uint32_t secure = regime_is_secure(env, mmu_idx); | ||
65 | int n; | ||
66 | int matchregion = -1; | ||
67 | bool hit = false; | ||
68 | @@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_pmsav8(CPUARMState *env, uint32_t address, | ||
69 | } | ||
21 | } | 70 | } |
22 | 71 | ||
23 | - sysbus_init_child_obj(OBJECT(machine), "iotkit", &mms->iotkit, | 72 | - ret = pmsav8_mpu_lookup(env, address, access_type, mmu_idx, |
24 | + sysbus_init_child_obj(OBJECT(machine), TYPE_IOTKIT, &mms->iotkit, | 73 | + ret = pmsav8_mpu_lookup(env, address, access_type, mmu_idx, secure, |
25 | sizeof(mms->iotkit), mmc->armsse_type); | 74 | result, fi, NULL); |
26 | iotkitdev = DEVICE(&mms->iotkit); | 75 | if (sattrs.subpage) { |
27 | object_property_set_link(OBJECT(&mms->iotkit), OBJECT(system_memory), | 76 | result->page_size = 1; |
28 | -- | 77 | -- |
29 | 2.20.1 | 78 | 2.25.1 |
30 | 79 | ||
31 | 80 | 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 | Add support for the RTC. | 3 | Remove the use of regime_is_secure from get_phys_addr_v5, |
4 | passing the new parameter to the lookup instead. | ||
4 | 5 | ||
5 | Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | 6 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> |
6 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | 7 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
7 | Reviewed-by: Luc Michel <luc.michel@greensocs.com> | 8 | [PMM: Folded in definition of local is_secure in get_phys_addr(), |
8 | Message-id: 20200427181649.26851-12-edgar.iglesias@gmail.com | 9 | since I dropped the earlier patch that would have provided it] |
10 | Message-id: 20220822152741.1617527-14-richard.henderson@linaro.org | ||
11 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
10 | --- | 13 | --- |
11 | hw/arm/xlnx-versal-virt.c | 22 ++++++++++++++++++++++ | 14 | target/arm/ptw.c | 14 +++++++------- |
12 | 1 file changed, 22 insertions(+) | 15 | 1 file changed, 7 insertions(+), 7 deletions(-) |
13 | 16 | ||
14 | diff --git a/hw/arm/xlnx-versal-virt.c b/hw/arm/xlnx-versal-virt.c | 17 | diff --git a/target/arm/ptw.c b/target/arm/ptw.c |
15 | index XXXXXXX..XXXXXXX 100644 | 18 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/hw/arm/xlnx-versal-virt.c | 19 | --- a/target/arm/ptw.c |
17 | +++ b/hw/arm/xlnx-versal-virt.c | 20 | +++ b/target/arm/ptw.c |
18 | @@ -XXX,XX +XXX,XX @@ static void fdt_add_sd_nodes(VersalVirt *s) | 21 | @@ -XXX,XX +XXX,XX @@ static int simple_ap_to_rw_prot(CPUARMState *env, ARMMMUIdx mmu_idx, int ap) |
22 | |||
23 | static bool get_phys_addr_v5(CPUARMState *env, uint32_t address, | ||
24 | MMUAccessType access_type, ARMMMUIdx mmu_idx, | ||
25 | - GetPhysAddrResult *result, ARMMMUFaultInfo *fi) | ||
26 | + bool is_secure, GetPhysAddrResult *result, | ||
27 | + ARMMMUFaultInfo *fi) | ||
28 | { | ||
29 | int level = 1; | ||
30 | uint32_t table; | ||
31 | @@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_v5(CPUARMState *env, uint32_t address, | ||
32 | fi->type = ARMFault_Translation; | ||
33 | goto do_fault; | ||
34 | } | ||
35 | - desc = arm_ldl_ptw(env, table, regime_is_secure(env, mmu_idx), | ||
36 | - mmu_idx, fi); | ||
37 | + desc = arm_ldl_ptw(env, table, is_secure, mmu_idx, fi); | ||
38 | if (fi->type != ARMFault_None) { | ||
39 | goto do_fault; | ||
40 | } | ||
41 | @@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_v5(CPUARMState *env, uint32_t address, | ||
42 | /* Fine pagetable. */ | ||
43 | table = (desc & 0xfffff000) | ((address >> 8) & 0xffc); | ||
44 | } | ||
45 | - desc = arm_ldl_ptw(env, table, regime_is_secure(env, mmu_idx), | ||
46 | - mmu_idx, fi); | ||
47 | + desc = arm_ldl_ptw(env, table, is_secure, mmu_idx, fi); | ||
48 | if (fi->type != ARMFault_None) { | ||
49 | goto do_fault; | ||
50 | } | ||
51 | @@ -XXX,XX +XXX,XX @@ bool get_phys_addr(CPUARMState *env, target_ulong address, | ||
52 | GetPhysAddrResult *result, ARMMMUFaultInfo *fi) | ||
53 | { | ||
54 | ARMMMUIdx s1_mmu_idx = stage_1_mmu_idx(mmu_idx); | ||
55 | + bool is_secure = regime_is_secure(env, mmu_idx); | ||
56 | |||
57 | if (mmu_idx != s1_mmu_idx) { | ||
58 | /* | ||
59 | @@ -XXX,XX +XXX,XX @@ bool get_phys_addr(CPUARMState *env, target_ulong address, | ||
60 | * cannot upgrade an non-secure translation regime's attributes | ||
61 | * to secure. | ||
62 | */ | ||
63 | - result->attrs.secure = regime_is_secure(env, mmu_idx); | ||
64 | + result->attrs.secure = is_secure; | ||
65 | result->attrs.user = regime_is_user(env, mmu_idx); | ||
66 | |||
67 | /* | ||
68 | @@ -XXX,XX +XXX,XX @@ bool get_phys_addr(CPUARMState *env, target_ulong address, | ||
69 | result, fi); | ||
70 | } else { | ||
71 | return get_phys_addr_v5(env, address, access_type, mmu_idx, | ||
72 | - result, fi); | ||
73 | + is_secure, result, fi); | ||
19 | } | 74 | } |
20 | } | 75 | } |
21 | 76 | ||
22 | +static void fdt_add_rtc_node(VersalVirt *s) | ||
23 | +{ | ||
24 | + const char compat[] = "xlnx,zynqmp-rtc"; | ||
25 | + const char interrupt_names[] = "alarm\0sec"; | ||
26 | + char *name = g_strdup_printf("/rtc@%x", MM_PMC_RTC); | ||
27 | + | ||
28 | + qemu_fdt_add_subnode(s->fdt, name); | ||
29 | + | ||
30 | + qemu_fdt_setprop_cells(s->fdt, name, "interrupts", | ||
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 | +} | ||
42 | + | ||
43 | static void fdt_nop_memory_nodes(void *fdt, Error **errp) | ||
44 | { | ||
45 | Error *err = NULL; | ||
46 | @@ -XXX,XX +XXX,XX @@ static void versal_virt_init(MachineState *machine) | ||
47 | fdt_add_timer_nodes(s); | ||
48 | fdt_add_zdma_nodes(s); | ||
49 | fdt_add_sd_nodes(s); | ||
50 | + fdt_add_rtc_node(s); | ||
51 | fdt_add_cpu_nodes(s, psci_conduit); | ||
52 | fdt_add_clk_node(s, "/clk125", 125000000, s->phandle.clk_125Mhz); | ||
53 | fdt_add_clk_node(s, "/clk25", 25000000, s->phandle.clk_25Mhz); | ||
54 | -- | 77 | -- |
55 | 2.20.1 | 78 | 2.25.1 |
56 | 79 | ||
57 | 80 | 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 | Embed the GEMs into the SoC type. | 3 | Remove the use of regime_is_secure from get_phys_addr_v6, |
4 | passing the new parameter to the lookup instead. | ||
4 | 5 | ||
5 | Suggested-by: Peter Maydell <peter.maydell@linaro.org> | 6 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> |
6 | Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | 7 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
7 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | 8 | Message-id: 20220822152741.1617527-15-richard.henderson@linaro.org |
8 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 9 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
9 | Reviewed-by: Luc Michel <luc.michel@greensocs.com> | ||
10 | Message-id: 20200427181649.26851-6-edgar.iglesias@gmail.com | ||
11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
12 | --- | 11 | --- |
13 | include/hw/arm/xlnx-versal.h | 3 ++- | 12 | target/arm/ptw.c | 11 +++++------ |
14 | hw/arm/xlnx-versal.c | 15 ++++++++------- | 13 | 1 file changed, 5 insertions(+), 6 deletions(-) |
15 | 2 files changed, 10 insertions(+), 8 deletions(-) | ||
16 | 14 | ||
17 | diff --git a/include/hw/arm/xlnx-versal.h b/include/hw/arm/xlnx-versal.h | 15 | diff --git a/target/arm/ptw.c b/target/arm/ptw.c |
18 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
19 | --- a/include/hw/arm/xlnx-versal.h | 17 | --- a/target/arm/ptw.c |
20 | +++ b/include/hw/arm/xlnx-versal.h | 18 | +++ b/target/arm/ptw.c |
21 | @@ -XXX,XX +XXX,XX @@ | 19 | @@ -XXX,XX +XXX,XX @@ do_fault: |
22 | #include "hw/arm/boot.h" | 20 | |
23 | #include "hw/intc/arm_gicv3.h" | 21 | static bool get_phys_addr_v6(CPUARMState *env, uint32_t address, |
24 | #include "hw/char/pl011.h" | 22 | MMUAccessType access_type, ARMMMUIdx mmu_idx, |
25 | +#include "hw/net/cadence_gem.h" | 23 | - GetPhysAddrResult *result, ARMMMUFaultInfo *fi) |
26 | 24 | + bool is_secure, GetPhysAddrResult *result, | |
27 | #define TYPE_XLNX_VERSAL "xlnx-versal" | 25 | + ARMMMUFaultInfo *fi) |
28 | #define XLNX_VERSAL(obj) OBJECT_CHECK(Versal, (obj), TYPE_XLNX_VERSAL) | 26 | { |
29 | @@ -XXX,XX +XXX,XX @@ typedef struct Versal { | 27 | ARMCPU *cpu = env_archcpu(env); |
30 | 28 | int level = 1; | |
31 | struct { | 29 | @@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_v6(CPUARMState *env, uint32_t address, |
32 | PL011State uart[XLNX_VERSAL_NR_UARTS]; | 30 | fi->type = ARMFault_Translation; |
33 | - SysBusDevice *gem[XLNX_VERSAL_NR_GEMS]; | 31 | goto do_fault; |
34 | + CadenceGEMState gem[XLNX_VERSAL_NR_GEMS]; | 32 | } |
35 | SysBusDevice *adma[XLNX_VERSAL_NR_ADMAS]; | 33 | - desc = arm_ldl_ptw(env, table, regime_is_secure(env, mmu_idx), |
36 | } iou; | 34 | - mmu_idx, fi); |
37 | } lpd; | 35 | + desc = arm_ldl_ptw(env, table, is_secure, mmu_idx, fi); |
38 | diff --git a/hw/arm/xlnx-versal.c b/hw/arm/xlnx-versal.c | 36 | if (fi->type != ARMFault_None) { |
39 | index XXXXXXX..XXXXXXX 100644 | 37 | goto do_fault; |
40 | --- a/hw/arm/xlnx-versal.c | 38 | } |
41 | +++ b/hw/arm/xlnx-versal.c | 39 | @@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_v6(CPUARMState *env, uint32_t address, |
42 | @@ -XXX,XX +XXX,XX @@ static void versal_create_gems(Versal *s, qemu_irq *pic) | 40 | ns = extract32(desc, 3, 1); |
43 | DeviceState *dev; | 41 | /* Lookup l2 entry. */ |
44 | MemoryRegion *mr; | 42 | table = (desc & 0xfffffc00) | ((address >> 10) & 0x3fc); |
45 | 43 | - desc = arm_ldl_ptw(env, table, regime_is_secure(env, mmu_idx), | |
46 | - dev = qdev_create(NULL, "cadence_gem"); | 44 | - mmu_idx, fi); |
47 | - s->lpd.iou.gem[i] = SYS_BUS_DEVICE(dev); | 45 | + desc = arm_ldl_ptw(env, table, is_secure, mmu_idx, fi); |
48 | - object_property_add_child(OBJECT(s), name, OBJECT(dev), &error_fatal); | 46 | if (fi->type != ARMFault_None) { |
49 | + sysbus_init_child_obj(OBJECT(s), name, | 47 | goto do_fault; |
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 | } | 48 | } |
57 | - object_property_set_int(OBJECT(s->lpd.iou.gem[i]), | 49 | @@ -XXX,XX +XXX,XX @@ bool get_phys_addr(CPUARMState *env, target_ulong address, |
58 | + object_property_set_int(OBJECT(dev), | 50 | result, fi); |
59 | 2, "num-priority-queues", | 51 | } else if (regime_sctlr(env, mmu_idx) & SCTLR_XP) { |
60 | &error_abort); | 52 | return get_phys_addr_v6(env, address, access_type, mmu_idx, |
61 | - object_property_set_link(OBJECT(s->lpd.iou.gem[i]), | 53 | - result, fi); |
62 | + object_property_set_link(OBJECT(dev), | 54 | + is_secure, result, fi); |
63 | OBJECT(&s->mr_ps), "dma", | 55 | } else { |
64 | &error_abort); | 56 | return get_phys_addr_v5(env, address, access_type, mmu_idx, |
65 | qdev_init_nofail(dev); | 57 | is_secure, result, fi); |
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 | -- | 58 | -- |
77 | 2.20.1 | 59 | 2.25.1 |
78 | 60 | ||
79 | 61 | diff view generated by jsdifflib |
1 | From: Fredrik Strupe <fredrik@strupe.net> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | According to Arm ARM, VQDMULL is only valid when U=0, while having | 3 | Remove the use of regime_is_secure from get_phys_addr_pmsav8. |
4 | U=1 is unallocated. | 4 | Since we already had a local variable named secure, use that. |
5 | 5 | ||
6 | Signed-off-by: Fredrik Strupe <fredrik@strupe.net> | 6 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> |
7 | Fixes: 695272dcb976 ("target-arm: Handle UNDEF cases for Neon 3-regs-different-widths") | 7 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
8 | Message-id: 20220822152741.1617527-16-richard.henderson@linaro.org | ||
8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
10 | --- | 11 | --- |
11 | target/arm/translate.c | 2 +- | 12 | target/arm/ptw.c | 5 ++--- |
12 | 1 file changed, 1 insertion(+), 1 deletion(-) | 13 | 1 file changed, 2 insertions(+), 3 deletions(-) |
13 | 14 | ||
14 | diff --git a/target/arm/translate.c b/target/arm/translate.c | 15 | diff --git a/target/arm/ptw.c b/target/arm/ptw.c |
15 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/target/arm/translate.c | 17 | --- a/target/arm/ptw.c |
17 | +++ b/target/arm/translate.c | 18 | +++ b/target/arm/ptw.c |
18 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) | 19 | @@ -XXX,XX +XXX,XX @@ void v8m_security_lookup(CPUARMState *env, uint32_t address, |
19 | {0, 0, 0, 0}, /* VMLSL */ | 20 | |
20 | {0, 0, 0, 9}, /* VQDMLSL */ | 21 | static bool get_phys_addr_pmsav8(CPUARMState *env, uint32_t address, |
21 | {0, 0, 0, 0}, /* Integer VMULL */ | 22 | MMUAccessType access_type, ARMMMUIdx mmu_idx, |
22 | - {0, 0, 0, 1}, /* VQDMULL */ | 23 | - GetPhysAddrResult *result, |
23 | + {0, 0, 0, 9}, /* VQDMULL */ | 24 | + bool secure, GetPhysAddrResult *result, |
24 | {0, 0, 0, 0xa}, /* Polynomial VMULL */ | 25 | ARMMMUFaultInfo *fi) |
25 | {0, 0, 0, 7}, /* Reserved: always UNDEF */ | 26 | { |
26 | }; | 27 | - uint32_t secure = regime_is_secure(env, mmu_idx); |
28 | V8M_SAttributes sattrs = {}; | ||
29 | bool ret; | ||
30 | |||
31 | @@ -XXX,XX +XXX,XX @@ bool get_phys_addr(CPUARMState *env, target_ulong address, | ||
32 | if (arm_feature(env, ARM_FEATURE_V8)) { | ||
33 | /* PMSAv8 */ | ||
34 | ret = get_phys_addr_pmsav8(env, address, access_type, mmu_idx, | ||
35 | - result, fi); | ||
36 | + is_secure, result, fi); | ||
37 | } else if (arm_feature(env, ARM_FEATURE_V7)) { | ||
38 | /* PMSAv7 */ | ||
39 | ret = get_phys_addr_pmsav7(env, address, access_type, mmu_idx, | ||
27 | -- | 40 | -- |
28 | 2.20.1 | 41 | 2.25.1 |
29 | 42 | ||
30 | 43 | diff view generated by jsdifflib |
1 | Convert the Neon 3-reg-same VADD and VSUB insns to decodetree. | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Note that we don't need the neon_3r_sizes[op] check here because all | 3 | Remove the use of regime_is_secure from pmsav7_use_background_region, |
4 | size values are OK for VADD and VSUB; we'll add this when we convert | 4 | using the new parameter instead. |
5 | the first insn that has size restrictions. | ||
6 | 5 | ||
7 | For this we need one of the GVecGen*Fn typedefs currently in | 6 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> |
8 | translate-a64.h; move them all to translate.h as a block so they | 7 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
9 | are visible to the 32-bit decoder. | 8 | Message-id: 20220822152741.1617527-17-richard.henderson@linaro.org |
9 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
11 | --- | ||
12 | target/arm/ptw.c | 10 +++++----- | ||
13 | 1 file changed, 5 insertions(+), 5 deletions(-) | ||
10 | 14 | ||
11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 15 | diff --git a/target/arm/ptw.c b/target/arm/ptw.c |
12 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
13 | Message-id: 20200430181003.21682-15-peter.maydell@linaro.org | ||
14 | --- | ||
15 | target/arm/translate-a64.h | 9 -------- | ||
16 | target/arm/translate.h | 9 ++++++++ | ||
17 | target/arm/neon-dp.decode | 17 +++++++++++++++ | ||
18 | target/arm/translate-neon.inc.c | 38 +++++++++++++++++++++++++++++++++ | ||
19 | target/arm/translate.c | 14 ++++-------- | ||
20 | 5 files changed, 68 insertions(+), 19 deletions(-) | ||
21 | |||
22 | diff --git a/target/arm/translate-a64.h b/target/arm/translate-a64.h | ||
23 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
24 | --- a/target/arm/translate-a64.h | 17 | --- a/target/arm/ptw.c |
25 | +++ b/target/arm/translate-a64.h | 18 | +++ b/target/arm/ptw.c |
26 | @@ -XXX,XX +XXX,XX @@ static inline int vec_full_reg_size(DisasContext *s) | 19 | @@ -XXX,XX +XXX,XX @@ static bool m_is_system_region(CPUARMState *env, uint32_t address) |
27 | |||
28 | bool disas_sve(DisasContext *, uint32_t); | ||
29 | |||
30 | -/* Note that the gvec expanders operate on offsets + sizes. */ | ||
31 | -typedef void GVecGen2Fn(unsigned, uint32_t, uint32_t, uint32_t, uint32_t); | ||
32 | -typedef void GVecGen2iFn(unsigned, uint32_t, uint32_t, int64_t, | ||
33 | - uint32_t, uint32_t); | ||
34 | -typedef void GVecGen3Fn(unsigned, uint32_t, uint32_t, | ||
35 | - uint32_t, uint32_t, uint32_t); | ||
36 | -typedef void GVecGen4Fn(unsigned, uint32_t, uint32_t, uint32_t, | ||
37 | - uint32_t, uint32_t, uint32_t); | ||
38 | - | ||
39 | #endif /* TARGET_ARM_TRANSLATE_A64_H */ | ||
40 | diff --git a/target/arm/translate.h b/target/arm/translate.h | ||
41 | index XXXXXXX..XXXXXXX 100644 | ||
42 | --- a/target/arm/translate.h | ||
43 | +++ b/target/arm/translate.h | ||
44 | @@ -XXX,XX +XXX,XX @@ void gen_sshl_i64(TCGv_i64 d, TCGv_i64 a, TCGv_i64 b); | ||
45 | #define dc_isar_feature(name, ctx) \ | ||
46 | ({ DisasContext *ctx_ = (ctx); isar_feature_##name(ctx_->isar); }) | ||
47 | |||
48 | +/* Note that the gvec expanders operate on offsets + sizes. */ | ||
49 | +typedef void GVecGen2Fn(unsigned, uint32_t, uint32_t, uint32_t, uint32_t); | ||
50 | +typedef void GVecGen2iFn(unsigned, uint32_t, uint32_t, int64_t, | ||
51 | + uint32_t, uint32_t); | ||
52 | +typedef void GVecGen3Fn(unsigned, uint32_t, uint32_t, | ||
53 | + uint32_t, uint32_t, uint32_t); | ||
54 | +typedef void GVecGen4Fn(unsigned, uint32_t, uint32_t, uint32_t, | ||
55 | + uint32_t, uint32_t, uint32_t); | ||
56 | + | ||
57 | #endif /* TARGET_ARM_TRANSLATE_H */ | ||
58 | diff --git a/target/arm/neon-dp.decode b/target/arm/neon-dp.decode | ||
59 | index XXXXXXX..XXXXXXX 100644 | ||
60 | --- a/target/arm/neon-dp.decode | ||
61 | +++ b/target/arm/neon-dp.decode | ||
62 | @@ -XXX,XX +XXX,XX @@ | ||
63 | # | ||
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 | } | 20 | } |
98 | + | 21 | |
99 | +static bool do_3same(DisasContext *s, arg_3same *a, GVecGen3Fn fn) | 22 | static bool pmsav7_use_background_region(ARMCPU *cpu, ARMMMUIdx mmu_idx, |
100 | +{ | 23 | - bool is_user) |
101 | + int vec_size = a->q ? 16 : 8; | 24 | + bool is_secure, bool is_user) |
102 | + int rd_ofs = neon_reg_offset(a->vd, 0); | 25 | { |
103 | + int rn_ofs = neon_reg_offset(a->vn, 0); | 26 | /* |
104 | + int rm_ofs = neon_reg_offset(a->vm, 0); | 27 | * Return true if we should use the default memory map as a |
105 | + | 28 | @@ -XXX,XX +XXX,XX @@ static bool pmsav7_use_background_region(ARMCPU *cpu, ARMMMUIdx mmu_idx, |
106 | + if (!arm_dc_feature(s, ARM_FEATURE_NEON)) { | 29 | } |
107 | + return false; | 30 | |
108 | + } | 31 | if (arm_feature(env, ARM_FEATURE_M)) { |
109 | + | 32 | - return env->v7m.mpu_ctrl[regime_is_secure(env, mmu_idx)] |
110 | + /* UNDEF accesses to D16-D31 if they don't exist. */ | 33 | - & R_V7M_MPU_CTRL_PRIVDEFENA_MASK; |
111 | + if (!dc_isar_feature(aa32_simd_r32, s) && | 34 | + return env->v7m.mpu_ctrl[is_secure] & R_V7M_MPU_CTRL_PRIVDEFENA_MASK; |
112 | + ((a->vd | a->vn | a->vm) & 0x10)) { | 35 | } else { |
113 | + return false; | 36 | return regime_sctlr(env, mmu_idx) & SCTLR_BR; |
114 | + } | 37 | } |
115 | + | 38 | @@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_pmsav7(CPUARMState *env, uint32_t address, |
116 | + if ((a->vn | a->vm | a->vd) & a->q) { | 39 | { |
117 | + return false; | 40 | ARMCPU *cpu = env_archcpu(env); |
118 | + } | 41 | int n; |
119 | + | 42 | + bool secure = regime_is_secure(env, mmu_idx); |
120 | + if (!vfp_access_check(s)) { | 43 | bool is_user = regime_is_user(env, mmu_idx); |
121 | + return true; | 44 | |
122 | + } | 45 | result->phys = address; |
123 | + | 46 | @@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_pmsav7(CPUARMState *env, uint32_t address, |
124 | + fn(a->size, rd_ofs, rn_ofs, rm_ofs, vec_size, vec_size); | ||
125 | + return true; | ||
126 | +} | ||
127 | + | ||
128 | +#define DO_3SAME(INSN, FUNC) \ | ||
129 | + static bool trans_##INSN##_3s(DisasContext *s, arg_3same *a) \ | ||
130 | + { \ | ||
131 | + return do_3same(s, a, FUNC); \ | ||
132 | + } | ||
133 | + | ||
134 | +DO_3SAME(VADD, tcg_gen_gvec_add) | ||
135 | +DO_3SAME(VSUB, tcg_gen_gvec_sub) | ||
136 | diff --git a/target/arm/translate.c b/target/arm/translate.c | ||
137 | index XXXXXXX..XXXXXXX 100644 | ||
138 | --- a/target/arm/translate.c | ||
139 | +++ b/target/arm/translate.c | ||
140 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) | ||
141 | } | ||
142 | return 0; | ||
143 | |||
144 | - case NEON_3R_VADD_VSUB: | ||
145 | - if (u) { | ||
146 | - tcg_gen_gvec_sub(size, rd_ofs, rn_ofs, rm_ofs, | ||
147 | - vec_size, vec_size); | ||
148 | - } else { | ||
149 | - tcg_gen_gvec_add(size, rd_ofs, rn_ofs, rm_ofs, | ||
150 | - vec_size, vec_size); | ||
151 | - } | ||
152 | - return 0; | ||
153 | - | ||
154 | case NEON_3R_VQADD: | ||
155 | tcg_gen_gvec_4(rd_ofs, offsetof(CPUARMState, vfp.qc), | ||
156 | rn_ofs, rm_ofs, vec_size, vec_size, | ||
157 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) | ||
158 | tcg_gen_gvec_3(rd_ofs, rm_ofs, rn_ofs, vec_size, vec_size, | ||
159 | u ? &ushl_op[size] : &sshl_op[size]); | ||
160 | return 0; | ||
161 | + | ||
162 | + case NEON_3R_VADD_VSUB: | ||
163 | + /* Already handled by decodetree */ | ||
164 | + return 1; | ||
165 | } | 47 | } |
166 | 48 | ||
167 | if (size == 3) { | 49 | if (n == -1) { /* no hits */ |
50 | - if (!pmsav7_use_background_region(cpu, mmu_idx, is_user)) { | ||
51 | + if (!pmsav7_use_background_region(cpu, mmu_idx, secure, is_user)) { | ||
52 | /* background fault */ | ||
53 | fi->type = ARMFault_Background; | ||
54 | return true; | ||
55 | @@ -XXX,XX +XXX,XX @@ bool pmsav8_mpu_lookup(CPUARMState *env, uint32_t address, | ||
56 | } else if (m_is_ppb_region(env, address)) { | ||
57 | hit = true; | ||
58 | } else { | ||
59 | - if (pmsav7_use_background_region(cpu, mmu_idx, is_user)) { | ||
60 | + if (pmsav7_use_background_region(cpu, mmu_idx, secure, is_user)) { | ||
61 | hit = true; | ||
62 | } | ||
63 | |||
168 | -- | 64 | -- |
169 | 2.20.1 | 65 | 2.25.1 |
170 | 66 | ||
171 | 67 | 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 | Embed the ADMAs into the SoC type. | 3 | Remove the use of regime_is_secure from get_phys_addr_pmsav7, |
4 | using the new parameter instead. | ||
4 | 5 | ||
5 | Suggested-by: Peter Maydell <peter.maydell@linaro.org> | 6 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> |
6 | Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | 7 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
7 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | 8 | Message-id: 20220822152741.1617527-19-richard.henderson@linaro.org |
8 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 9 | Reviewed-by: Peter Maydell <peter.maydell@linaro.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> | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
12 | --- | 11 | --- |
13 | include/hw/arm/xlnx-versal.h | 3 ++- | 12 | target/arm/ptw.c | 5 ++--- |
14 | hw/arm/xlnx-versal.c | 14 +++++++------- | 13 | 1 file changed, 2 insertions(+), 3 deletions(-) |
15 | 2 files changed, 9 insertions(+), 8 deletions(-) | ||
16 | 14 | ||
17 | diff --git a/include/hw/arm/xlnx-versal.h b/include/hw/arm/xlnx-versal.h | 15 | diff --git a/target/arm/ptw.c b/target/arm/ptw.c |
18 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
19 | --- a/include/hw/arm/xlnx-versal.h | 17 | --- a/target/arm/ptw.c |
20 | +++ b/include/hw/arm/xlnx-versal.h | 18 | +++ b/target/arm/ptw.c |
21 | @@ -XXX,XX +XXX,XX @@ | 19 | @@ -XXX,XX +XXX,XX @@ static bool pmsav7_use_background_region(ARMCPU *cpu, ARMMMUIdx mmu_idx, |
22 | #include "hw/arm/boot.h" | 20 | |
23 | #include "hw/intc/arm_gicv3.h" | 21 | static bool get_phys_addr_pmsav7(CPUARMState *env, uint32_t address, |
24 | #include "hw/char/pl011.h" | 22 | MMUAccessType access_type, ARMMMUIdx mmu_idx, |
25 | +#include "hw/dma/xlnx-zdma.h" | 23 | - GetPhysAddrResult *result, |
26 | #include "hw/net/cadence_gem.h" | 24 | + bool secure, GetPhysAddrResult *result, |
27 | 25 | ARMMMUFaultInfo *fi) | |
28 | #define TYPE_XLNX_VERSAL "xlnx-versal" | 26 | { |
29 | @@ -XXX,XX +XXX,XX @@ typedef struct Versal { | 27 | ARMCPU *cpu = env_archcpu(env); |
30 | struct { | 28 | int n; |
31 | PL011State uart[XLNX_VERSAL_NR_UARTS]; | 29 | - bool secure = regime_is_secure(env, mmu_idx); |
32 | CadenceGEMState gem[XLNX_VERSAL_NR_GEMS]; | 30 | bool is_user = regime_is_user(env, mmu_idx); |
33 | - SysBusDevice *adma[XLNX_VERSAL_NR_ADMAS]; | 31 | |
34 | + XlnxZDMA adma[XLNX_VERSAL_NR_ADMAS]; | 32 | result->phys = address; |
35 | } iou; | 33 | @@ -XXX,XX +XXX,XX @@ bool get_phys_addr(CPUARMState *env, target_ulong address, |
36 | } lpd; | 34 | } else if (arm_feature(env, ARM_FEATURE_V7)) { |
37 | 35 | /* PMSAv7 */ | |
38 | diff --git a/hw/arm/xlnx-versal.c b/hw/arm/xlnx-versal.c | 36 | ret = get_phys_addr_pmsav7(env, address, access_type, mmu_idx, |
39 | index XXXXXXX..XXXXXXX 100644 | 37 | - result, fi); |
40 | --- a/hw/arm/xlnx-versal.c | 38 | + is_secure, result, fi); |
41 | +++ b/hw/arm/xlnx-versal.c | 39 | } else { |
42 | @@ -XXX,XX +XXX,XX @@ static void versal_create_admas(Versal *s, qemu_irq *pic) | 40 | /* Pre-v7 MPU */ |
43 | DeviceState *dev; | 41 | ret = get_phys_addr_pmsav5(env, address, access_type, mmu_idx, |
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 | -- | 42 | -- |
69 | 2.20.1 | 43 | 2.25.1 |
70 | 44 | ||
71 | 45 | diff view generated by jsdifflib |
1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | MIDR_EL1 is a 64-bit system register with the top 32-bit being RES0. | 3 | Remove the use of regime_is_secure from get_phys_addr_pmsav5. |
4 | Represent it in QEMU's ARMCPU struct with a uint64_t, not a | ||
5 | uint32_t. | ||
6 | 4 | ||
7 | This fixes an error when compiling with -Werror=conversion | 5 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> |
8 | because we were manipulating the register value using a | 6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
9 | local uint64_t variable: | 7 | Message-id: 20220822152741.1617527-21-richard.henderson@linaro.org |
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> | 8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
25 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
26 | --- | 10 | --- |
27 | target/arm/cpu.h | 2 +- | 11 | target/arm/ptw.c | 4 ++-- |
28 | target/arm/cpu.c | 2 +- | 12 | 1 file changed, 2 insertions(+), 2 deletions(-) |
29 | 2 files changed, 2 insertions(+), 2 deletions(-) | ||
30 | 13 | ||
31 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h | 14 | diff --git a/target/arm/ptw.c b/target/arm/ptw.c |
32 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
33 | --- a/target/arm/cpu.h | 16 | --- a/target/arm/ptw.c |
34 | +++ b/target/arm/cpu.h | 17 | +++ b/target/arm/ptw.c |
35 | @@ -XXX,XX +XXX,XX @@ struct ARMCPU { | 18 | @@ -XXX,XX +XXX,XX @@ do_fault: |
36 | uint64_t id_aa64dfr0; | 19 | |
37 | uint64_t id_aa64dfr1; | 20 | static bool get_phys_addr_pmsav5(CPUARMState *env, uint32_t address, |
38 | } isar; | 21 | MMUAccessType access_type, ARMMMUIdx mmu_idx, |
39 | - uint32_t midr; | 22 | - GetPhysAddrResult *result, |
40 | + uint64_t midr; | 23 | + bool is_secure, GetPhysAddrResult *result, |
41 | uint32_t revidr; | 24 | ARMMMUFaultInfo *fi) |
42 | uint32_t reset_fpsid; | 25 | { |
43 | uint32_t ctr; | 26 | int n; |
44 | diff --git a/target/arm/cpu.c b/target/arm/cpu.c | 27 | @@ -XXX,XX +XXX,XX @@ bool get_phys_addr(CPUARMState *env, target_ulong address, |
45 | index XXXXXXX..XXXXXXX 100644 | 28 | } else { |
46 | --- a/target/arm/cpu.c | 29 | /* Pre-v7 MPU */ |
47 | +++ b/target/arm/cpu.c | 30 | ret = get_phys_addr_pmsav5(env, address, access_type, mmu_idx, |
48 | @@ -XXX,XX +XXX,XX @@ static const ARMCPUInfo arm_cpus[] = { | 31 | - result, fi); |
49 | static Property arm_cpu_properties[] = { | 32 | + is_secure, result, fi); |
50 | DEFINE_PROP_BOOL("start-powered-off", ARMCPU, start_powered_off, false), | 33 | } |
51 | DEFINE_PROP_UINT32("psci-conduit", ARMCPU, psci_conduit, 0), | 34 | qemu_log_mask(CPU_LOG_MMU, "PMSA MPU lookup for %s at 0x%08" PRIx32 |
52 | - DEFINE_PROP_UINT32("midr", ARMCPU, midr, 0), | 35 | " mmu_idx %u -> %s (prot %c%c%c)\n", |
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 | -- | 36 | -- |
58 | 2.20.1 | 37 | 2.25.1 |
59 | 38 | ||
60 | 39 | diff view generated by jsdifflib |
1 | From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com> | 1 | From: Keqian Zhu <zhukeqian1@huawei.com> |
---|---|---|---|
2 | 2 | ||
3 | Add support for SD. | 3 | Setup an ARM virtual machine of machine virt and execute qmp "query-acpi-ospm-status" |
4 | causes segmentation fault with following dumpstack: | ||
5 | #1 0x0000aaaaab64235c in qmp_query_acpi_ospm_status (errp=errp@entry=0xfffffffff030) at ../monitor/qmp-cmds.c:312 | ||
6 | #2 0x0000aaaaabfc4e20 in qmp_marshal_query_acpi_ospm_status (args=<optimized out>, ret=0xffffea4ffe90, errp=0xffffea4ffe88) at qapi/qapi-commands-acpi.c:63 | ||
7 | #3 0x0000aaaaabff8ba0 in do_qmp_dispatch_bh (opaque=0xffffea4ffe98) at ../qapi/qmp-dispatch.c:128 | ||
8 | #4 0x0000aaaaac02e594 in aio_bh_call (bh=0xffffe0004d80) at ../util/async.c:150 | ||
9 | #5 aio_bh_poll (ctx=ctx@entry=0xaaaaad0f6040) at ../util/async.c:178 | ||
10 | #6 0x0000aaaaac00bd40 in aio_dispatch (ctx=ctx@entry=0xaaaaad0f6040) at ../util/aio-posix.c:421 | ||
11 | #7 0x0000aaaaac02e010 in aio_ctx_dispatch (source=0xaaaaad0f6040, callback=<optimized out>, user_data=<optimized out>) at ../util/async.c:320 | ||
12 | #8 0x0000fffff76f6884 in g_main_context_dispatch () at /usr/lib64/libglib-2.0.so.0 | ||
13 | #9 0x0000aaaaac0452d4 in glib_pollfds_poll () at ../util/main-loop.c:297 | ||
14 | #10 os_host_main_loop_wait (timeout=0) at ../util/main-loop.c:320 | ||
15 | #11 main_loop_wait (nonblocking=nonblocking@entry=0) at ../util/main-loop.c:596 | ||
16 | #12 0x0000aaaaab5c9e50 in qemu_main_loop () at ../softmmu/runstate.c:734 | ||
17 | #13 0x0000aaaaab185370 in qemu_main (argc=argc@entry=47, argv=argv@entry=0xfffffffff518, envp=envp@entry=0x0) at ../softmmu/main.c:38 | ||
18 | #14 0x0000aaaaab16f99c in main (argc=47, argv=0xfffffffff518) at ../softmmu/main.c:47 | ||
4 | 19 | ||
5 | Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | 20 | Fixes: ebb62075021a ("hw/acpi: Add ACPI Generic Event Device Support") |
6 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | 21 | Signed-off-by: Keqian Zhu <zhukeqian1@huawei.com> |
7 | Reviewed-by: Luc Michel <luc.michel@greensocs.com> | 22 | Reviewed-by: Igor Mammedov <imammedo@redhat.com> |
8 | Message-id: 20200427181649.26851-11-edgar.iglesias@gmail.com | 23 | Message-id: 20220816094957.31700-1-zhukeqian1@huawei.com |
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 24 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
10 | --- | 25 | --- |
11 | hw/arm/xlnx-versal-virt.c | 46 +++++++++++++++++++++++++++++++++++++++ | 26 | hw/acpi/generic_event_device.c | 8 ++++++++ |
12 | 1 file changed, 46 insertions(+) | 27 | 1 file changed, 8 insertions(+) |
13 | 28 | ||
14 | diff --git a/hw/arm/xlnx-versal-virt.c b/hw/arm/xlnx-versal-virt.c | 29 | diff --git a/hw/acpi/generic_event_device.c b/hw/acpi/generic_event_device.c |
15 | index XXXXXXX..XXXXXXX 100644 | 30 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/hw/arm/xlnx-versal-virt.c | 31 | --- a/hw/acpi/generic_event_device.c |
17 | +++ b/hw/arm/xlnx-versal-virt.c | 32 | +++ b/hw/acpi/generic_event_device.c |
18 | @@ -XXX,XX +XXX,XX @@ | 33 | @@ -XXX,XX +XXX,XX @@ static void acpi_ged_unplug_cb(HotplugHandler *hotplug_dev, |
19 | #include "hw/arm/sysbus-fdt.h" | ||
20 | #include "hw/arm/fdt.h" | ||
21 | #include "cpu.h" | ||
22 | +#include "hw/qdev-properties.h" | ||
23 | #include "hw/arm/xlnx-versal.h" | ||
24 | |||
25 | #define TYPE_XLNX_VERSAL_VIRT_MACHINE MACHINE_TYPE_NAME("xlnx-versal-virt") | ||
26 | @@ -XXX,XX +XXX,XX @@ static void fdt_add_zdma_nodes(VersalVirt *s) | ||
27 | } | 34 | } |
28 | } | 35 | } |
29 | 36 | ||
30 | +static void fdt_add_sd_nodes(VersalVirt *s) | 37 | +static void acpi_ged_ospm_status(AcpiDeviceIf *adev, ACPIOSTInfoList ***list) |
31 | +{ | 38 | +{ |
32 | + const char clocknames[] = "clk_xin\0clk_ahb"; | 39 | + AcpiGedState *s = ACPI_GED(adev); |
33 | + const char compat[] = "arasan,sdhci-8.9a"; | ||
34 | + int i; | ||
35 | + | 40 | + |
36 | + for (i = ARRAY_SIZE(s->soc.pmc.iou.sd) - 1; i >= 0; i--) { | 41 | + acpi_memory_ospm_status(&s->memhp_state, list); |
37 | + uint64_t addr = MM_PMC_SD0 + MM_PMC_SD0_SIZE * i; | ||
38 | + char *name = g_strdup_printf("/sdhci@%" PRIx64, addr); | ||
39 | + | ||
40 | + qemu_fdt_add_subnode(s->fdt, name); | ||
41 | + | ||
42 | + qemu_fdt_setprop_cells(s->fdt, name, "clocks", | ||
43 | + s->phandle.clk_25Mhz, s->phandle.clk_25Mhz); | ||
44 | + qemu_fdt_setprop(s->fdt, name, "clock-names", | ||
45 | + clocknames, sizeof(clocknames)); | ||
46 | + qemu_fdt_setprop_cells(s->fdt, name, "interrupts", | ||
47 | + GIC_FDT_IRQ_TYPE_SPI, VERSAL_SD0_IRQ_0 + i * 2, | ||
48 | + GIC_FDT_IRQ_FLAGS_LEVEL_HI); | ||
49 | + qemu_fdt_setprop_sized_cells(s->fdt, name, "reg", | ||
50 | + 2, addr, 2, MM_PMC_SD0_SIZE); | ||
51 | + qemu_fdt_setprop(s->fdt, name, "compatible", compat, sizeof(compat)); | ||
52 | + g_free(name); | ||
53 | + } | ||
54 | +} | 42 | +} |
55 | + | 43 | + |
56 | static void fdt_nop_memory_nodes(void *fdt, Error **errp) | 44 | static void acpi_ged_send_event(AcpiDeviceIf *adev, AcpiEventStatusBits ev) |
57 | { | 45 | { |
58 | Error *err = NULL; | 46 | AcpiGedState *s = ACPI_GED(adev); |
59 | @@ -XXX,XX +XXX,XX @@ static void create_virtio_regions(VersalVirt *s) | 47 | @@ -XXX,XX +XXX,XX @@ static void acpi_ged_class_init(ObjectClass *class, void *data) |
60 | } | 48 | hc->unplug_request = acpi_ged_unplug_request_cb; |
49 | hc->unplug = acpi_ged_unplug_cb; | ||
50 | |||
51 | + adevc->ospm_status = acpi_ged_ospm_status; | ||
52 | adevc->send_event = acpi_ged_send_event; | ||
61 | } | 53 | } |
62 | 54 | ||
63 | +static void sd_plugin_card(SDHCIState *sd, DriveInfo *di) | ||
64 | +{ | ||
65 | + BlockBackend *blk = di ? blk_by_legacy_dinfo(di) : NULL; | ||
66 | + DeviceState *card; | ||
67 | + | ||
68 | + card = qdev_create(qdev_get_child_bus(DEVICE(sd), "sd-bus"), TYPE_SD_CARD); | ||
69 | + object_property_add_child(OBJECT(sd), "card[*]", OBJECT(card), | ||
70 | + &error_fatal); | ||
71 | + qdev_prop_set_drive(card, "drive", blk, &error_fatal); | ||
72 | + object_property_set_bool(OBJECT(card), true, "realized", &error_fatal); | ||
73 | +} | ||
74 | + | ||
75 | static void versal_virt_init(MachineState *machine) | ||
76 | { | ||
77 | VersalVirt *s = XLNX_VERSAL_VIRT_MACHINE(machine); | ||
78 | int psci_conduit = QEMU_PSCI_CONDUIT_DISABLED; | ||
79 | + int i; | ||
80 | |||
81 | /* | ||
82 | * If the user provides an Operating System to be loaded, we expect them | ||
83 | @@ -XXX,XX +XXX,XX @@ static void versal_virt_init(MachineState *machine) | ||
84 | fdt_add_gic_nodes(s); | ||
85 | fdt_add_timer_nodes(s); | ||
86 | fdt_add_zdma_nodes(s); | ||
87 | + fdt_add_sd_nodes(s); | ||
88 | fdt_add_cpu_nodes(s, psci_conduit); | ||
89 | fdt_add_clk_node(s, "/clk125", 125000000, s->phandle.clk_125Mhz); | ||
90 | fdt_add_clk_node(s, "/clk25", 25000000, s->phandle.clk_25Mhz); | ||
91 | @@ -XXX,XX +XXX,XX @@ static void versal_virt_init(MachineState *machine) | ||
92 | memory_region_add_subregion_overlap(get_system_memory(), | ||
93 | 0, &s->soc.fpd.apu.mr, 0); | ||
94 | |||
95 | + /* Plugin SD cards. */ | ||
96 | + for (i = 0; i < ARRAY_SIZE(s->soc.pmc.iou.sd); i++) { | ||
97 | + sd_plugin_card(&s->soc.pmc.iou.sd[i], drive_get_next(IF_SD)); | ||
98 | + } | ||
99 | + | ||
100 | s->binfo.ram_size = machine->ram_size; | ||
101 | s->binfo.loader_start = 0x0; | ||
102 | s->binfo.get_dtb = versal_virt_get_dtb; | ||
103 | -- | 55 | -- |
104 | 2.20.1 | 56 | 2.25.1 |
105 | |||
106 | diff view generated by jsdifflib |
1 | From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com> | 1 | From: Lucas Dietrich <ld.adecy@gmail.com> |
---|---|---|---|
2 | 2 | ||
3 | hw/arm: versal: Add support for the RTC. | 3 | The LAN9118 allows the guest to specify a level for both the TX and |
4 | RX FIFOs at which an interrupt will be generated. We implement the | ||
5 | RSFL_INT interrupt for the RX FIFO but are missing the handling of | ||
6 | the equivalent TSFL_INT for the TX FIFO. Add the missing test to set | ||
7 | the interrupt if the TX FIFO has exceeded the guest-specified level. | ||
4 | 8 | ||
5 | Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | 9 | This flag is required for Micrium lan911x ethernet driver to work. |
6 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 10 | |
7 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | 11 | Signed-off-by: Lucas Dietrich <ld.adecy@gmail.com> |
8 | Reviewed-by: Luc Michel <luc.michel@greensocs.com> | 12 | [PMM: Tweaked commit message and comment] |
9 | Message-id: 20200427181649.26851-10-edgar.iglesias@gmail.com | 13 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 14 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
11 | --- | 15 | --- |
12 | include/hw/arm/xlnx-versal.h | 8 ++++++++ | 16 | hw/net/lan9118.c | 8 ++++++++ |
13 | hw/arm/xlnx-versal.c | 21 +++++++++++++++++++++ | 17 | 1 file changed, 8 insertions(+) |
14 | 2 files changed, 29 insertions(+) | ||
15 | 18 | ||
16 | diff --git a/include/hw/arm/xlnx-versal.h b/include/hw/arm/xlnx-versal.h | 19 | diff --git a/hw/net/lan9118.c b/hw/net/lan9118.c |
17 | index XXXXXXX..XXXXXXX 100644 | 20 | index XXXXXXX..XXXXXXX 100644 |
18 | --- a/include/hw/arm/xlnx-versal.h | 21 | --- a/hw/net/lan9118.c |
19 | +++ b/include/hw/arm/xlnx-versal.h | 22 | +++ b/hw/net/lan9118.c |
20 | @@ -XXX,XX +XXX,XX @@ | 23 | @@ -XXX,XX +XXX,XX @@ static void do_tx_packet(lan9118_state *s) |
21 | #include "hw/char/pl011.h" | 24 | n = (s->tx_status_fifo_head + s->tx_status_fifo_used) & 511; |
22 | #include "hw/dma/xlnx-zdma.h" | 25 | s->tx_status_fifo[n] = status; |
23 | #include "hw/net/cadence_gem.h" | 26 | s->tx_status_fifo_used++; |
24 | +#include "hw/rtc/xlnx-zynqmp-rtc.h" | ||
25 | |||
26 | #define TYPE_XLNX_VERSAL "xlnx-versal" | ||
27 | #define XLNX_VERSAL(obj) OBJECT_CHECK(Versal, (obj), TYPE_XLNX_VERSAL) | ||
28 | @@ -XXX,XX +XXX,XX @@ typedef struct Versal { | ||
29 | struct { | ||
30 | SDHCIState sd[XLNX_VERSAL_NR_SDS]; | ||
31 | } iou; | ||
32 | + | ||
33 | + XlnxZynqMPRTC rtc; | ||
34 | } pmc; | ||
35 | |||
36 | struct { | ||
37 | @@ -XXX,XX +XXX,XX @@ typedef struct Versal { | ||
38 | #define VERSAL_GEM1_IRQ_0 58 | ||
39 | #define VERSAL_GEM1_WAKE_IRQ_0 59 | ||
40 | #define VERSAL_ADMA_IRQ_0 60 | ||
41 | +#define VERSAL_RTC_APB_ERR_IRQ 121 | ||
42 | #define VERSAL_SD0_IRQ_0 126 | ||
43 | +#define VERSAL_RTC_ALARM_IRQ 142 | ||
44 | +#define VERSAL_RTC_SECONDS_IRQ 143 | ||
45 | |||
46 | /* Architecturally reserved IRQs suitable for virtualization. */ | ||
47 | #define VERSAL_RSVD_IRQ_FIRST 111 | ||
48 | @@ -XXX,XX +XXX,XX @@ typedef struct Versal { | ||
49 | #define MM_PMC_SD0_SIZE 0x10000 | ||
50 | #define MM_PMC_CRP 0xf1260000U | ||
51 | #define MM_PMC_CRP_SIZE 0x10000 | ||
52 | +#define MM_PMC_RTC 0xf12a0000 | ||
53 | +#define MM_PMC_RTC_SIZE 0x10000 | ||
54 | #endif | ||
55 | diff --git a/hw/arm/xlnx-versal.c b/hw/arm/xlnx-versal.c | ||
56 | index XXXXXXX..XXXXXXX 100644 | ||
57 | --- a/hw/arm/xlnx-versal.c | ||
58 | +++ b/hw/arm/xlnx-versal.c | ||
59 | @@ -XXX,XX +XXX,XX @@ static void versal_create_sds(Versal *s, qemu_irq *pic) | ||
60 | } | ||
61 | } | ||
62 | |||
63 | +static void versal_create_rtc(Versal *s, qemu_irq *pic) | ||
64 | +{ | ||
65 | + SysBusDevice *sbd; | ||
66 | + MemoryRegion *mr; | ||
67 | + | ||
68 | + sysbus_init_child_obj(OBJECT(s), "rtc", &s->pmc.rtc, sizeof(s->pmc.rtc), | ||
69 | + TYPE_XLNX_ZYNQMP_RTC); | ||
70 | + sbd = SYS_BUS_DEVICE(&s->pmc.rtc); | ||
71 | + qdev_init_nofail(DEVICE(sbd)); | ||
72 | + | ||
73 | + mr = sysbus_mmio_get_region(sbd, 0); | ||
74 | + memory_region_add_subregion(&s->mr_ps, MM_PMC_RTC, mr); | ||
75 | + | 27 | + |
76 | + /* | 28 | + /* |
77 | + * TODO: Connect the ALARM and SECONDS interrupts once our RTC model | 29 | + * Generate TSFL interrupt if TX FIFO level exceeds the level |
78 | + * supports them. | 30 | + * specified in the FIFO_INT TX Status Level field. |
79 | + */ | 31 | + */ |
80 | + sysbus_connect_irq(sbd, 1, pic[VERSAL_RTC_APB_ERR_IRQ]); | 32 | + if (s->tx_status_fifo_used > ((s->fifo_int >> 16) & 0xff)) { |
81 | +} | 33 | + s->int_sts |= TSFL_INT; |
82 | + | 34 | + } |
83 | /* This takes the board allocated linear DDR memory and creates aliases | 35 | if (s->tx_status_fifo_used == 512) { |
84 | * for each split DDR range/aperture on the Versal address map. | 36 | s->int_sts |= TSFF_INT; |
85 | */ | 37 | /* TODO: Stop transmission. */ |
86 | @@ -XXX,XX +XXX,XX @@ static void versal_realize(DeviceState *dev, Error **errp) | ||
87 | versal_create_gems(s, pic); | ||
88 | versal_create_admas(s, pic); | ||
89 | versal_create_sds(s, pic); | ||
90 | + versal_create_rtc(s, pic); | ||
91 | versal_map_ddr(s); | ||
92 | versal_unimp(s); | ||
93 | |||
94 | -- | 38 | -- |
95 | 2.20.1 | 39 | 2.25.1 |
96 | |||
97 | diff view generated by jsdifflib |
1 | Convert the Neon "load single structure to all lanes" insns to | 1 | From: Philippe Mathieu-Daudé <philmd@redhat.com> |
---|---|---|---|
2 | decodetree. | ||
3 | 2 | ||
3 | Replace '84' magic value by the X_MAX definition, and '1' by Y_MAX. | ||
4 | |||
5 | Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
6 | Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> | ||
7 | Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org> | ||
4 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
5 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 9 | Message-id: 20220819153931.3147384-2-peter.maydell@linaro.org |
6 | Message-id: 20200430181003.21682-13-peter.maydell@linaro.org | ||
7 | --- | 10 | --- |
8 | target/arm/neon-ls.decode | 5 +++ | 11 | chardev/baum.c | 11 +++++++---- |
9 | target/arm/translate-neon.inc.c | 73 +++++++++++++++++++++++++++++++++ | 12 | 1 file changed, 7 insertions(+), 4 deletions(-) |
10 | target/arm/translate.c | 55 +------------------------ | ||
11 | 3 files changed, 80 insertions(+), 53 deletions(-) | ||
12 | 13 | ||
13 | diff --git a/target/arm/neon-ls.decode b/target/arm/neon-ls.decode | 14 | diff --git a/chardev/baum.c b/chardev/baum.c |
14 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/target/arm/neon-ls.decode | 16 | --- a/chardev/baum.c |
16 | +++ b/target/arm/neon-ls.decode | 17 | +++ b/chardev/baum.c |
17 | @@ -XXX,XX +XXX,XX @@ | 18 | @@ -XXX,XX +XXX,XX @@ |
18 | 19 | ||
19 | VLDST_multiple 1111 0100 0 . l:1 0 rn:4 .... itype:4 size:2 align:2 rm:4 \ | 20 | #define BUF_SIZE 256 |
20 | vd=%vd_dp | 21 | |
22 | +#define X_MAX 84 | ||
23 | +#define Y_MAX 1 | ||
21 | + | 24 | + |
22 | +# Neon load single element to all lanes | 25 | struct BaumChardev { |
23 | + | 26 | Chardev parent; |
24 | +VLD_all_lanes 1111 0100 1 . 1 0 rn:4 .... 11 n:2 size:2 t:1 a:1 rm:4 \ | 27 | |
25 | + vd=%vd_dp | 28 | @@ -XXX,XX +XXX,XX @@ static int baum_deferred_init(BaumChardev *baum) |
26 | diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c | 29 | brlapi_perror("baum: brlapi__getDisplaySize"); |
27 | index XXXXXXX..XXXXXXX 100644 | 30 | return 0; |
28 | --- a/target/arm/translate-neon.inc.c | 31 | } |
29 | +++ b/target/arm/translate-neon.inc.c | 32 | - if (baum->y > 1) { |
30 | @@ -XXX,XX +XXX,XX @@ static bool trans_VLDST_multiple(DisasContext *s, arg_VLDST_multiple *a) | 33 | - baum->y = 1; |
31 | gen_neon_ldst_base_update(s, a->rm, a->rn, nregs * interleave * 8); | 34 | + if (baum->y > Y_MAX) { |
32 | return true; | 35 | + baum->y = Y_MAX; |
33 | } | 36 | } |
34 | + | 37 | - if (baum->x > 84) { |
35 | +static bool trans_VLD_all_lanes(DisasContext *s, arg_VLD_all_lanes *a) | 38 | - baum->x = 84; |
36 | +{ | 39 | + if (baum->x > X_MAX) { |
37 | + /* Neon load single structure to all lanes */ | 40 | + baum->x = X_MAX; |
38 | + int reg, stride, vec_size; | 41 | } |
39 | + int vd = a->vd; | 42 | |
40 | + int size = a->size; | 43 | con = qemu_console_lookup_by_index(0); |
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 | + } | ||
47 | + | ||
48 | + /* UNDEF accesses to D16-D31 if they don't exist */ | ||
49 | + if (!dc_isar_feature(aa32_simd_r32, s) && (a->vd & 0x10)) { | ||
50 | + return false; | ||
51 | + } | ||
52 | + | ||
53 | + if (size == 3) { | ||
54 | + if (nregs != 4 || a->a == 0) { | ||
55 | + return false; | ||
56 | + } | ||
57 | + /* For VLD4 size == 3 a == 1 means 32 bits at 16 byte alignment */ | ||
58 | + size = 2; | ||
59 | + } | ||
60 | + if (nregs == 1 && a->a == 1 && size == 0) { | ||
61 | + return false; | ||
62 | + } | ||
63 | + if (nregs == 3 && a->a == 1) { | ||
64 | + return false; | ||
65 | + } | ||
66 | + | ||
67 | + if (!vfp_access_check(s)) { | ||
68 | + return true; | ||
69 | + } | ||
70 | + | ||
71 | + /* | ||
72 | + * VLD1 to all lanes: T bit indicates how many Dregs to write. | ||
73 | + * VLD2/3/4 to all lanes: T bit indicates register stride. | ||
74 | + */ | ||
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 | -- | 44 | -- |
181 | 2.20.1 | 45 | 2.25.1 |
182 | 46 | ||
183 | 47 | diff view generated by jsdifflib |
1 | Convert the Neon comparison ops in the 3-reg-same grouping | 1 | From: Philippe Mathieu-Daudé <philmd@redhat.com> |
---|---|---|---|
2 | to decodetree. | ||
3 | 2 | ||
3 | We know 'x * y' will be at most 'X_MAX * Y_MAX' (which is not | ||
4 | a big value, it is actually 84). Instead of having the compiler | ||
5 | use variable-length array, declare an array able to hold the | ||
6 | maximum 'x * y'. | ||
7 | |||
8 | Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
9 | Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> | ||
10 | Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org> | ||
4 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
5 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 12 | Message-id: 20220819153931.3147384-3-peter.maydell@linaro.org |
6 | Message-id: 20200430181003.21682-18-peter.maydell@linaro.org | ||
7 | --- | 13 | --- |
8 | target/arm/neon-dp.decode | 8 ++++++++ | 14 | chardev/baum.c | 8 ++++---- |
9 | target/arm/translate-neon.inc.c | 22 ++++++++++++++++++++++ | 15 | 1 file changed, 4 insertions(+), 4 deletions(-) |
10 | target/arm/translate.c | 23 +++-------------------- | ||
11 | 3 files changed, 33 insertions(+), 20 deletions(-) | ||
12 | 16 | ||
13 | diff --git a/target/arm/neon-dp.decode b/target/arm/neon-dp.decode | 17 | diff --git a/chardev/baum.c b/chardev/baum.c |
14 | index XXXXXXX..XXXXXXX 100644 | 18 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/target/arm/neon-dp.decode | 19 | --- a/chardev/baum.c |
16 | +++ b/target/arm/neon-dp.decode | 20 | +++ b/chardev/baum.c |
17 | @@ -XXX,XX +XXX,XX @@ VBSL_3s 1111 001 1 0 . 01 .... .... 0001 ... 1 .... @3same_logic | 21 | @@ -XXX,XX +XXX,XX @@ static int baum_eat_packet(BaumChardev *baum, const uint8_t *buf, int len) |
18 | VBIT_3s 1111 001 1 0 . 10 .... .... 0001 ... 1 .... @3same_logic | 22 | switch (req) { |
19 | VBIF_3s 1111 001 1 0 . 11 .... .... 0001 ... 1 .... @3same_logic | 23 | case BAUM_REQ_DisplayData: |
20 | 24 | { | |
21 | +VCGT_S_3s 1111 001 0 0 . .. .... .... 0011 . . . 0 .... @3same | 25 | - uint8_t cells[baum->x * baum->y], c; |
22 | +VCGT_U_3s 1111 001 1 0 . .. .... .... 0011 . . . 0 .... @3same | 26 | - uint8_t text[baum->x * baum->y]; |
23 | +VCGE_S_3s 1111 001 0 0 . .. .... .... 0011 . . . 1 .... @3same | 27 | - uint8_t zero[baum->x * baum->y]; |
24 | +VCGE_U_3s 1111 001 1 0 . .. .... .... 0011 . . . 1 .... @3same | 28 | + uint8_t cells[X_MAX * Y_MAX], c; |
25 | + | 29 | + uint8_t text[X_MAX * Y_MAX]; |
26 | VMAX_S_3s 1111 001 0 0 . .. .... .... 0110 . . . 0 .... @3same | 30 | + uint8_t zero[X_MAX * Y_MAX]; |
27 | VMAX_U_3s 1111 001 1 0 . .. .... .... 0110 . . . 0 .... @3same | 31 | int cursor = BRLAPI_CURSOR_OFF; |
28 | VMIN_S_3s 1111 001 0 0 . .. .... .... 0110 . . . 1 .... @3same | 32 | int i; |
29 | @@ -XXX,XX +XXX,XX @@ VMIN_U_3s 1111 001 1 0 . .. .... .... 0110 . . . 1 .... @3same | 33 | |
30 | 34 | @@ -XXX,XX +XXX,XX @@ static int baum_eat_packet(BaumChardev *baum, const uint8_t *buf, int len) | |
31 | VADD_3s 1111 001 0 0 . .. .... .... 1000 . . . 0 .... @3same | ||
32 | VSUB_3s 1111 001 1 0 . .. .... .... 1000 . . . 0 .... @3same | ||
33 | + | ||
34 | +VTST_3s 1111 001 0 0 . .. .... .... 1000 . . . 1 .... @3same | ||
35 | +VCEQ_3s 1111 001 1 0 . .. .... .... 1000 . . . 1 .... @3same | ||
36 | diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c | ||
37 | index XXXXXXX..XXXXXXX 100644 | ||
38 | --- a/target/arm/translate-neon.inc.c | ||
39 | +++ b/target/arm/translate-neon.inc.c | ||
40 | @@ -XXX,XX +XXX,XX @@ DO_3SAME_NO_SZ_3(VMAX_S, tcg_gen_gvec_smax) | ||
41 | DO_3SAME_NO_SZ_3(VMAX_U, tcg_gen_gvec_umax) | ||
42 | DO_3SAME_NO_SZ_3(VMIN_S, tcg_gen_gvec_smin) | ||
43 | DO_3SAME_NO_SZ_3(VMIN_U, tcg_gen_gvec_umin) | ||
44 | + | ||
45 | +#define DO_3SAME_CMP(INSN, COND) \ | ||
46 | + static void gen_##INSN##_3s(unsigned vece, uint32_t rd_ofs, \ | ||
47 | + uint32_t rn_ofs, uint32_t rm_ofs, \ | ||
48 | + uint32_t oprsz, uint32_t maxsz) \ | ||
49 | + { \ | ||
50 | + tcg_gen_gvec_cmp(COND, vece, rd_ofs, rn_ofs, rm_ofs, oprsz, maxsz); \ | ||
51 | + } \ | ||
52 | + DO_3SAME_NO_SZ_3(INSN, gen_##INSN##_3s) | ||
53 | + | ||
54 | +DO_3SAME_CMP(VCGT_S, TCG_COND_GT) | ||
55 | +DO_3SAME_CMP(VCGT_U, TCG_COND_GTU) | ||
56 | +DO_3SAME_CMP(VCGE_S, TCG_COND_GE) | ||
57 | +DO_3SAME_CMP(VCGE_U, TCG_COND_GEU) | ||
58 | +DO_3SAME_CMP(VCEQ, TCG_COND_EQ) | ||
59 | + | ||
60 | +static void gen_VTST_3s(unsigned vece, uint32_t rd_ofs, uint32_t rn_ofs, | ||
61 | + uint32_t rm_ofs, uint32_t oprsz, uint32_t maxsz) | ||
62 | +{ | ||
63 | + tcg_gen_gvec_3(rd_ofs, rn_ofs, rm_ofs, oprsz, maxsz, &cmtst_op[vece]); | ||
64 | +} | ||
65 | +DO_3SAME_NO_SZ_3(VTST, gen_VTST_3s) | ||
66 | diff --git a/target/arm/translate.c b/target/arm/translate.c | ||
67 | index XXXXXXX..XXXXXXX 100644 | ||
68 | --- a/target/arm/translate.c | ||
69 | +++ b/target/arm/translate.c | ||
70 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) | ||
71 | u ? &mls_op[size] : &mla_op[size]); | ||
72 | return 0; | ||
73 | |||
74 | - case NEON_3R_VTST_VCEQ: | ||
75 | - if (u) { /* VCEQ */ | ||
76 | - tcg_gen_gvec_cmp(TCG_COND_EQ, size, rd_ofs, rn_ofs, rm_ofs, | ||
77 | - vec_size, vec_size); | ||
78 | - } else { /* VTST */ | ||
79 | - tcg_gen_gvec_3(rd_ofs, rn_ofs, rm_ofs, | ||
80 | - vec_size, vec_size, &cmtst_op[size]); | ||
81 | - } | ||
82 | - return 0; | ||
83 | - | ||
84 | - case NEON_3R_VCGT: | ||
85 | - tcg_gen_gvec_cmp(u ? TCG_COND_GTU : TCG_COND_GT, size, | ||
86 | - rd_ofs, rn_ofs, rm_ofs, vec_size, vec_size); | ||
87 | - return 0; | ||
88 | - | ||
89 | - case NEON_3R_VCGE: | ||
90 | - tcg_gen_gvec_cmp(u ? TCG_COND_GEU : TCG_COND_GE, size, | ||
91 | - rd_ofs, rn_ofs, rm_ofs, vec_size, vec_size); | ||
92 | - return 0; | ||
93 | - | ||
94 | case NEON_3R_VSHL: | ||
95 | /* Note the operation is vshl vd,vm,vn */ | ||
96 | tcg_gen_gvec_3(rd_ofs, rm_ofs, rn_ofs, vec_size, vec_size, | ||
97 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) | ||
98 | case NEON_3R_LOGIC: | ||
99 | case NEON_3R_VMAX: | ||
100 | case NEON_3R_VMIN: | ||
101 | + case NEON_3R_VTST_VCEQ: | ||
102 | + case NEON_3R_VCGT: | ||
103 | + case NEON_3R_VCGE: | ||
104 | /* Already handled by decodetree */ | ||
105 | return 1; | ||
106 | } | 35 | } |
36 | timer_del(baum->cellCount_timer); | ||
37 | |||
38 | - memset(zero, 0, sizeof(zero)); | ||
39 | + memset(zero, 0, baum->x * baum->y); | ||
40 | |||
41 | brlapi_writeArguments_t wa = { | ||
42 | .displayNumber = BRLAPI_DISPLAY_DEFAULT, | ||
107 | -- | 43 | -- |
108 | 2.20.1 | 44 | 2.25.1 |
109 | 45 | ||
110 | 46 | diff view generated by jsdifflib |
1 | Convert the Neon 3-reg-same VMAX and VMIN insns to decodetree. | 1 | From: Philippe Mathieu-Daudé <philmd@redhat.com> |
---|---|---|---|
2 | 2 | ||
3 | Use autofree heap allocation instead of variable-length | ||
4 | array on the stack. | ||
5 | |||
6 | Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
7 | Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> | ||
8 | Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org> | ||
3 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
4 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 10 | Message-id: 20220819153931.3147384-4-peter.maydell@linaro.org |
5 | Message-id: 20200430181003.21682-17-peter.maydell@linaro.org | ||
6 | --- | 11 | --- |
7 | target/arm/neon-dp.decode | 5 +++++ | 12 | chardev/baum.c | 3 ++- |
8 | target/arm/translate-neon.inc.c | 14 ++++++++++++++ | 13 | 1 file changed, 2 insertions(+), 1 deletion(-) |
9 | target/arm/translate.c | 21 ++------------------- | ||
10 | 3 files changed, 21 insertions(+), 19 deletions(-) | ||
11 | 14 | ||
12 | diff --git a/target/arm/neon-dp.decode b/target/arm/neon-dp.decode | 15 | diff --git a/chardev/baum.c b/chardev/baum.c |
13 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
14 | --- a/target/arm/neon-dp.decode | 17 | --- a/chardev/baum.c |
15 | +++ b/target/arm/neon-dp.decode | 18 | +++ b/chardev/baum.c |
16 | @@ -XXX,XX +XXX,XX @@ VBSL_3s 1111 001 1 0 . 01 .... .... 0001 ... 1 .... @3same_logic | 19 | @@ -XXX,XX +XXX,XX @@ static void baum_chr_accept_input(struct Chardev *chr) |
17 | VBIT_3s 1111 001 1 0 . 10 .... .... 0001 ... 1 .... @3same_logic | 20 | static void baum_write_packet(BaumChardev *baum, const uint8_t *buf, int len) |
18 | VBIF_3s 1111 001 1 0 . 11 .... .... 0001 ... 1 .... @3same_logic | 21 | { |
19 | 22 | Chardev *chr = CHARDEV(baum); | |
20 | +VMAX_S_3s 1111 001 0 0 . .. .... .... 0110 . . . 0 .... @3same | 23 | - uint8_t io_buf[1 + 2 * len], *cur = io_buf; |
21 | +VMAX_U_3s 1111 001 1 0 . .. .... .... 0110 . . . 0 .... @3same | 24 | + g_autofree uint8_t *io_buf = g_malloc(1 + 2 * len); |
22 | +VMIN_S_3s 1111 001 0 0 . .. .... .... 0110 . . . 1 .... @3same | 25 | + uint8_t *cur = io_buf; |
23 | +VMIN_U_3s 1111 001 1 0 . .. .... .... 0110 . . . 1 .... @3same | 26 | int room; |
24 | + | 27 | *cur++ = ESC; |
25 | VADD_3s 1111 001 0 0 . .. .... .... 1000 . . . 0 .... @3same | 28 | while (len--) |
26 | VSUB_3s 1111 001 1 0 . .. .... .... 1000 . . . 0 .... @3same | ||
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 @@ DO_3SAME(VEOR, tcg_gen_gvec_xor) | ||
32 | DO_3SAME_BITSEL(VBSL, rd_ofs, rn_ofs, rm_ofs) | ||
33 | DO_3SAME_BITSEL(VBIT, rm_ofs, rn_ofs, rd_ofs) | ||
34 | DO_3SAME_BITSEL(VBIF, rm_ofs, rd_ofs, rn_ofs) | ||
35 | + | ||
36 | +#define DO_3SAME_NO_SZ_3(INSN, FUNC) \ | ||
37 | + static bool trans_##INSN##_3s(DisasContext *s, arg_3same *a) \ | ||
38 | + { \ | ||
39 | + if (a->size == 3) { \ | ||
40 | + return false; \ | ||
41 | + } \ | ||
42 | + return do_3same(s, a, FUNC); \ | ||
43 | + } | ||
44 | + | ||
45 | +DO_3SAME_NO_SZ_3(VMAX_S, tcg_gen_gvec_smax) | ||
46 | +DO_3SAME_NO_SZ_3(VMAX_U, tcg_gen_gvec_umax) | ||
47 | +DO_3SAME_NO_SZ_3(VMIN_S, tcg_gen_gvec_smin) | ||
48 | +DO_3SAME_NO_SZ_3(VMIN_U, tcg_gen_gvec_umin) | ||
49 | diff --git a/target/arm/translate.c b/target/arm/translate.c | ||
50 | index XXXXXXX..XXXXXXX 100644 | ||
51 | --- a/target/arm/translate.c | ||
52 | +++ b/target/arm/translate.c | ||
53 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) | ||
54 | rd_ofs, rn_ofs, rm_ofs, vec_size, vec_size); | ||
55 | return 0; | ||
56 | |||
57 | - case NEON_3R_VMAX: | ||
58 | - if (u) { | ||
59 | - tcg_gen_gvec_umax(size, rd_ofs, rn_ofs, rm_ofs, | ||
60 | - vec_size, vec_size); | ||
61 | - } else { | ||
62 | - tcg_gen_gvec_smax(size, rd_ofs, rn_ofs, rm_ofs, | ||
63 | - vec_size, vec_size); | ||
64 | - } | ||
65 | - return 0; | ||
66 | - case NEON_3R_VMIN: | ||
67 | - if (u) { | ||
68 | - tcg_gen_gvec_umin(size, rd_ofs, rn_ofs, rm_ofs, | ||
69 | - vec_size, vec_size); | ||
70 | - } else { | ||
71 | - tcg_gen_gvec_smin(size, rd_ofs, rn_ofs, rm_ofs, | ||
72 | - vec_size, vec_size); | ||
73 | - } | ||
74 | - return 0; | ||
75 | - | ||
76 | case NEON_3R_VSHL: | ||
77 | /* Note the operation is vshl vd,vm,vn */ | ||
78 | tcg_gen_gvec_3(rd_ofs, rm_ofs, rn_ofs, vec_size, vec_size, | ||
79 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) | ||
80 | |||
81 | case NEON_3R_VADD_VSUB: | ||
82 | case NEON_3R_LOGIC: | ||
83 | + case NEON_3R_VMAX: | ||
84 | + case NEON_3R_VMIN: | ||
85 | /* Already handled by decodetree */ | ||
86 | return 1; | ||
87 | } | ||
88 | -- | 29 | -- |
89 | 2.20.1 | 30 | 2.25.1 |
90 | 31 | ||
91 | 32 | diff view generated by jsdifflib |
1 | Convert the VCADD (vector) insns to decodetree. | 1 | From: Philippe Mathieu-Daudé <philmd@redhat.com> |
---|---|---|---|
2 | 2 | ||
3 | The combined_key[... QIO_CHANNEL_WEBSOCK_GUID_LEN ...] array in | ||
4 | qio_channel_websock_handshake_send_res_ok() expands to a call | ||
5 | to strlen(QIO_CHANNEL_WEBSOCK_GUID), and the compiler doesn't | ||
6 | realize the string is const, so consider combined_key[] being | ||
7 | a variable-length array. | ||
8 | |||
9 | To remove the variable-length array, we provide it a hint to | ||
10 | the compiler by using sizeof() - 1 instead of strlen(). | ||
11 | |||
12 | Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
13 | Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> | ||
3 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 14 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
4 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 15 | Message-id: 20220819153931.3147384-5-peter.maydell@linaro.org |
5 | Message-id: 20200430181003.21682-6-peter.maydell@linaro.org | ||
6 | --- | 16 | --- |
7 | target/arm/neon-shared.decode | 3 +++ | 17 | io/channel-websock.c | 2 +- |
8 | target/arm/translate-neon.inc.c | 37 +++++++++++++++++++++++++++++++++ | 18 | 1 file changed, 1 insertion(+), 1 deletion(-) |
9 | target/arm/translate.c | 11 +--------- | ||
10 | 3 files changed, 41 insertions(+), 10 deletions(-) | ||
11 | 19 | ||
12 | diff --git a/target/arm/neon-shared.decode b/target/arm/neon-shared.decode | 20 | diff --git a/io/channel-websock.c b/io/channel-websock.c |
13 | index XXXXXXX..XXXXXXX 100644 | 21 | index XXXXXXX..XXXXXXX 100644 |
14 | --- a/target/arm/neon-shared.decode | 22 | --- a/io/channel-websock.c |
15 | +++ b/target/arm/neon-shared.decode | 23 | +++ b/io/channel-websock.c |
16 | @@ -XXX,XX +XXX,XX @@ | 24 | @@ -XXX,XX +XXX,XX @@ |
17 | 25 | ||
18 | VCMLA 1111 110 rot:2 . 1 size:1 .... .... 1000 . q:1 . 0 .... \ | 26 | #define QIO_CHANNEL_WEBSOCK_CLIENT_KEY_LEN 24 |
19 | vm=%vm_dp vn=%vn_dp vd=%vd_dp | 27 | #define QIO_CHANNEL_WEBSOCK_GUID "258EAFA5-E914-47DA-95CA-C5AB0DC85B11" |
20 | + | 28 | -#define QIO_CHANNEL_WEBSOCK_GUID_LEN strlen(QIO_CHANNEL_WEBSOCK_GUID) |
21 | +VCADD 1111 110 rot:1 1 . 0 size:1 .... .... 1000 . q:1 . 0 .... \ | 29 | +#define QIO_CHANNEL_WEBSOCK_GUID_LEN (sizeof(QIO_CHANNEL_WEBSOCK_GUID) - 1) |
22 | + vm=%vm_dp vn=%vn_dp vd=%vd_dp | 30 | |
23 | diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c | 31 | #define QIO_CHANNEL_WEBSOCK_HEADER_PROTOCOL "sec-websocket-protocol" |
24 | index XXXXXXX..XXXXXXX 100644 | 32 | #define QIO_CHANNEL_WEBSOCK_HEADER_VERSION "sec-websocket-version" |
25 | --- a/target/arm/translate-neon.inc.c | ||
26 | +++ b/target/arm/translate-neon.inc.c | ||
27 | @@ -XXX,XX +XXX,XX @@ static bool trans_VCMLA(DisasContext *s, arg_VCMLA *a) | ||
28 | tcg_temp_free_ptr(fpst); | ||
29 | return true; | ||
30 | } | ||
31 | + | ||
32 | +static bool trans_VCADD(DisasContext *s, arg_VCADD *a) | ||
33 | +{ | ||
34 | + int opr_sz; | ||
35 | + TCGv_ptr fpst; | ||
36 | + gen_helper_gvec_3_ptr *fn_gvec_ptr; | ||
37 | + | ||
38 | + if (!dc_isar_feature(aa32_vcma, s) | ||
39 | + || (!a->size && !dc_isar_feature(aa32_fp16_arith, s))) { | ||
40 | + return false; | ||
41 | + } | ||
42 | + | ||
43 | + /* UNDEF accesses to D16-D31 if they don't exist. */ | ||
44 | + if (!dc_isar_feature(aa32_simd_r32, s) && | ||
45 | + ((a->vd | a->vn | a->vm) & 0x10)) { | ||
46 | + return false; | ||
47 | + } | ||
48 | + | ||
49 | + if ((a->vn | a->vm | a->vd) & a->q) { | ||
50 | + return false; | ||
51 | + } | ||
52 | + | ||
53 | + if (!vfp_access_check(s)) { | ||
54 | + return true; | ||
55 | + } | ||
56 | + | ||
57 | + opr_sz = (1 + a->q) * 8; | ||
58 | + fpst = get_fpstatus_ptr(1); | ||
59 | + fn_gvec_ptr = a->size ? gen_helper_gvec_fcadds : gen_helper_gvec_fcaddh; | ||
60 | + tcg_gen_gvec_3_ptr(vfp_reg_offset(1, a->vd), | ||
61 | + vfp_reg_offset(1, a->vn), | ||
62 | + vfp_reg_offset(1, a->vm), | ||
63 | + fpst, opr_sz, opr_sz, a->rot, | ||
64 | + fn_gvec_ptr); | ||
65 | + tcg_temp_free_ptr(fpst); | ||
66 | + return true; | ||
67 | +} | ||
68 | diff --git a/target/arm/translate.c b/target/arm/translate.c | ||
69 | index XXXXXXX..XXXXXXX 100644 | ||
70 | --- a/target/arm/translate.c | ||
71 | +++ b/target/arm/translate.c | ||
72 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_insn_3same_ext(DisasContext *s, uint32_t insn) | ||
73 | bool is_long = false, q = extract32(insn, 6, 1); | ||
74 | bool ptr_is_env = false; | ||
75 | |||
76 | - if ((insn & 0xfea00f10) == 0xfc800800) { | ||
77 | - /* VCADD -- 1111 110R 1.0S .... .... 1000 ...0 .... */ | ||
78 | - int size = extract32(insn, 20, 1); | ||
79 | - data = extract32(insn, 24, 1); /* rot */ | ||
80 | - if (!dc_isar_feature(aa32_vcma, s) | ||
81 | - || (!size && !dc_isar_feature(aa32_fp16_arith, s))) { | ||
82 | - return 1; | ||
83 | - } | ||
84 | - fn_gvec_ptr = size ? gen_helper_gvec_fcadds : gen_helper_gvec_fcaddh; | ||
85 | - } else if ((insn & 0xfeb00f00) == 0xfc200d00) { | ||
86 | + if ((insn & 0xfeb00f00) == 0xfc200d00) { | ||
87 | /* V[US]DOT -- 1111 1100 0.10 .... .... 1101 .Q.U .... */ | ||
88 | bool u = extract32(insn, 4, 1); | ||
89 | if (!dc_isar_feature(aa32_dp, s)) { | ||
90 | -- | 33 | -- |
91 | 2.20.1 | 34 | 2.25.1 |
92 | 35 | ||
93 | 36 | diff view generated by jsdifflib |
1 | From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com> | 1 | From: Philippe Mathieu-Daudé <philmd@redhat.com> |
---|---|---|---|
2 | 2 | ||
3 | Add support for SD. | 3 | The compiler isn't clever enough to figure 'min_buf_size' |
4 | is a constant, so help it by using a definitions instead. | ||
4 | 5 | ||
5 | Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | 6 | Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> |
6 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | 7 | Acked-by: Jason Wang <jasowang@redhat.com> |
7 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 8 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
8 | Reviewed-by: Luc Michel <luc.michel@greensocs.com> | ||
9 | Message-id: 20200427181649.26851-9-edgar.iglesias@gmail.com | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
10 | Message-id: 20220819153931.3147384-6-peter.maydell@linaro.org | ||
11 | --- | 11 | --- |
12 | include/hw/arm/xlnx-versal.h | 12 ++++++++++++ | 12 | hw/net/e1000e_core.c | 7 ++++--- |
13 | hw/arm/xlnx-versal.c | 31 +++++++++++++++++++++++++++++++ | 13 | 1 file changed, 4 insertions(+), 3 deletions(-) |
14 | 2 files changed, 43 insertions(+) | ||
15 | 14 | ||
16 | diff --git a/include/hw/arm/xlnx-versal.h b/include/hw/arm/xlnx-versal.h | 15 | diff --git a/hw/net/e1000e_core.c b/hw/net/e1000e_core.c |
17 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
18 | --- a/include/hw/arm/xlnx-versal.h | 17 | --- a/hw/net/e1000e_core.c |
19 | +++ b/include/hw/arm/xlnx-versal.h | 18 | +++ b/hw/net/e1000e_core.c |
20 | @@ -XXX,XX +XXX,XX @@ | 19 | @@ -XXX,XX +XXX,XX @@ e1000e_rx_fix_l4_csum(E1000ECore *core, struct NetRxPkt *pkt) |
21 | |||
22 | #include "hw/sysbus.h" | ||
23 | #include "hw/arm/boot.h" | ||
24 | +#include "hw/sd/sdhci.h" | ||
25 | #include "hw/intc/arm_gicv3.h" | ||
26 | #include "hw/char/pl011.h" | ||
27 | #include "hw/dma/xlnx-zdma.h" | ||
28 | @@ -XXX,XX +XXX,XX @@ | ||
29 | #define XLNX_VERSAL_NR_UARTS 2 | ||
30 | #define XLNX_VERSAL_NR_GEMS 2 | ||
31 | #define XLNX_VERSAL_NR_ADMAS 8 | ||
32 | +#define XLNX_VERSAL_NR_SDS 2 | ||
33 | #define XLNX_VERSAL_NR_IRQS 192 | ||
34 | |||
35 | typedef struct Versal { | ||
36 | @@ -XXX,XX +XXX,XX @@ typedef struct Versal { | ||
37 | } iou; | ||
38 | } lpd; | ||
39 | |||
40 | + /* The Platform Management Controller subsystem. */ | ||
41 | + struct { | ||
42 | + struct { | ||
43 | + SDHCIState sd[XLNX_VERSAL_NR_SDS]; | ||
44 | + } iou; | ||
45 | + } pmc; | ||
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 | ||
69 | --- a/hw/arm/xlnx-versal.c | ||
70 | +++ b/hw/arm/xlnx-versal.c | ||
71 | @@ -XXX,XX +XXX,XX @@ static void versal_create_admas(Versal *s, qemu_irq *pic) | ||
72 | } | 20 | } |
73 | } | 21 | } |
74 | 22 | ||
75 | +#define SDHCI_CAPABILITIES 0x280737ec6481 /* Same as on ZynqMP. */ | 23 | +/* Min. octets in an ethernet frame sans FCS */ |
76 | +static void versal_create_sds(Versal *s, qemu_irq *pic) | 24 | +#define MIN_BUF_SIZE 60 |
77 | +{ | ||
78 | + int i; | ||
79 | + | 25 | + |
80 | + for (i = 0; i < ARRAY_SIZE(s->pmc.iou.sd); i++) { | 26 | ssize_t |
81 | + DeviceState *dev; | 27 | e1000e_receive_iov(E1000ECore *core, const struct iovec *iov, int iovcnt) |
82 | + MemoryRegion *mr; | 28 | { |
83 | + | 29 | static const int maximum_ethernet_hdr_len = (14 + 4); |
84 | + sysbus_init_child_obj(OBJECT(s), "sd[*]", | 30 | - /* Min. octets in an ethernet frame sans FCS */ |
85 | + &s->pmc.iou.sd[i], sizeof(s->pmc.iou.sd[i]), | 31 | - static const int min_buf_size = 60; |
86 | + TYPE_SYSBUS_SDHCI); | 32 | |
87 | + dev = DEVICE(&s->pmc.iou.sd[i]); | 33 | uint32_t n = 0; |
88 | + | 34 | - uint8_t min_buf[min_buf_size]; |
89 | + object_property_set_uint(OBJECT(dev), | 35 | + uint8_t min_buf[MIN_BUF_SIZE]; |
90 | + 3, "sd-spec-version", &error_fatal); | 36 | struct iovec min_iov; |
91 | + object_property_set_uint(OBJECT(dev), SDHCI_CAPABILITIES, "capareg", | 37 | uint8_t *filter_buf; |
92 | + &error_fatal); | 38 | size_t size, orig_size; |
93 | + object_property_set_uint(OBJECT(dev), UHS_I, "uhs", &error_fatal); | ||
94 | + qdev_init_nofail(dev); | ||
95 | + | ||
96 | + mr = sysbus_mmio_get_region(SYS_BUS_DEVICE(dev), 0); | ||
97 | + memory_region_add_subregion(&s->mr_ps, | ||
98 | + MM_PMC_SD0 + i * MM_PMC_SD0_SIZE, mr); | ||
99 | + | ||
100 | + sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, | ||
101 | + pic[VERSAL_SD0_IRQ_0 + i * 2]); | ||
102 | + } | ||
103 | +} | ||
104 | + | ||
105 | /* This takes the board allocated linear DDR memory and creates aliases | ||
106 | * for each split DDR range/aperture on the Versal address map. | ||
107 | */ | ||
108 | @@ -XXX,XX +XXX,XX @@ static void versal_realize(DeviceState *dev, Error **errp) | ||
109 | versal_create_uarts(s, pic); | ||
110 | versal_create_gems(s, pic); | ||
111 | versal_create_admas(s, pic); | ||
112 | + versal_create_sds(s, pic); | ||
113 | versal_map_ddr(s); | ||
114 | versal_unimp(s); | ||
115 | |||
116 | -- | 39 | -- |
117 | 2.20.1 | 40 | 2.25.1 |
118 | 41 | ||
119 | 42 | diff view generated by jsdifflib |
1 | Convert the Neon logic ops in the 3-reg-same grouping to decodetree. | 1 | From: Philippe Mathieu-Daudé <philmd@redhat.com> |
---|---|---|---|
2 | Note that for the logic ops the 'size' field forms part of their | ||
3 | decode and the actual operations are always bitwise. | ||
4 | 2 | ||
3 | Use autofree heap allocation instead of variable-length | ||
4 | array on the stack. | ||
5 | |||
6 | Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
7 | Acked-by: David Gibson <david@gibson.dropbear.id.au> | ||
5 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
6 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 9 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
7 | Message-id: 20200430181003.21682-16-peter.maydell@linaro.org | 10 | Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com> |
11 | Message-id: 20220819153931.3147384-7-peter.maydell@linaro.org | ||
8 | --- | 12 | --- |
9 | target/arm/neon-dp.decode | 12 +++++++++++ | 13 | hw/ppc/pnv.c | 4 ++-- |
10 | target/arm/translate-neon.inc.c | 19 +++++++++++++++++ | 14 | hw/ppc/spapr.c | 8 ++++---- |
11 | target/arm/translate.c | 38 +-------------------------------- | 15 | hw/ppc/spapr_pci_nvlink2.c | 2 +- |
12 | 3 files changed, 32 insertions(+), 37 deletions(-) | 16 | 3 files changed, 7 insertions(+), 7 deletions(-) |
13 | 17 | ||
14 | diff --git a/target/arm/neon-dp.decode b/target/arm/neon-dp.decode | 18 | diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c |
15 | index XXXXXXX..XXXXXXX 100644 | 19 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/target/arm/neon-dp.decode | 20 | --- a/hw/ppc/pnv.c |
17 | +++ b/target/arm/neon-dp.decode | 21 | +++ b/hw/ppc/pnv.c |
18 | @@ -XXX,XX +XXX,XX @@ | 22 | @@ -XXX,XX +XXX,XX @@ static void pnv_dt_core(PnvChip *chip, PnvCore *pc, void *fdt) |
19 | @3same .... ... . . . size:2 .... .... .... . q:1 . . .... \ | 23 | int smt_threads = CPU_CORE(pc)->nr_threads; |
20 | &3same vm=%vm_dp vn=%vn_dp vd=%vd_dp | 24 | CPUPPCState *env = &cpu->env; |
21 | 25 | PowerPCCPUClass *pcc = POWERPC_CPU_GET_CLASS(cs); | |
22 | +@3same_logic .... ... . . . .. .... .... .... . q:1 .. .... \ | 26 | - uint32_t servers_prop[smt_threads]; |
23 | + &3same vm=%vm_dp vn=%vn_dp vd=%vd_dp size=0 | 27 | + g_autofree uint32_t *servers_prop = g_new(uint32_t, smt_threads); |
24 | + | 28 | int i; |
25 | +VAND_3s 1111 001 0 0 . 00 .... .... 0001 ... 1 .... @3same_logic | 29 | uint32_t segs[] = {cpu_to_be32(28), cpu_to_be32(40), |
26 | +VBIC_3s 1111 001 0 0 . 01 .... .... 0001 ... 1 .... @3same_logic | 30 | 0xffffffff, 0xffffffff}; |
27 | +VORR_3s 1111 001 0 0 . 10 .... .... 0001 ... 1 .... @3same_logic | 31 | @@ -XXX,XX +XXX,XX @@ static void pnv_dt_core(PnvChip *chip, PnvCore *pc, void *fdt) |
28 | +VORN_3s 1111 001 0 0 . 11 .... .... 0001 ... 1 .... @3same_logic | 32 | servers_prop[i] = cpu_to_be32(pc->pir + i); |
29 | +VEOR_3s 1111 001 1 0 . 00 .... .... 0001 ... 1 .... @3same_logic | 33 | } |
30 | +VBSL_3s 1111 001 1 0 . 01 .... .... 0001 ... 1 .... @3same_logic | 34 | _FDT((fdt_setprop(fdt, offset, "ibm,ppc-interrupt-server#s", |
31 | +VBIT_3s 1111 001 1 0 . 10 .... .... 0001 ... 1 .... @3same_logic | 35 | - servers_prop, sizeof(servers_prop)))); |
32 | +VBIF_3s 1111 001 1 0 . 11 .... .... 0001 ... 1 .... @3same_logic | 36 | + servers_prop, sizeof(*servers_prop) * smt_threads))); |
33 | + | 37 | } |
34 | VADD_3s 1111 001 0 0 . .. .... .... 1000 . . . 0 .... @3same | 38 | |
35 | VSUB_3s 1111 001 1 0 . .. .... .... 1000 . . . 0 .... @3same | 39 | static void pnv_dt_icp(PnvChip *chip, void *fdt, uint32_t pir, |
36 | diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c | 40 | diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c |
37 | index XXXXXXX..XXXXXXX 100644 | 41 | index XXXXXXX..XXXXXXX 100644 |
38 | --- a/target/arm/translate-neon.inc.c | 42 | --- a/hw/ppc/spapr.c |
39 | +++ b/target/arm/translate-neon.inc.c | 43 | +++ b/hw/ppc/spapr.c |
40 | @@ -XXX,XX +XXX,XX @@ static bool do_3same(DisasContext *s, arg_3same *a, GVecGen3Fn fn) | 44 | @@ -XXX,XX +XXX,XX @@ static int spapr_fixup_cpu_smt_dt(void *fdt, int offset, PowerPCCPU *cpu, |
41 | 45 | int smt_threads) | |
42 | DO_3SAME(VADD, tcg_gen_gvec_add) | 46 | { |
43 | DO_3SAME(VSUB, tcg_gen_gvec_sub) | 47 | int i, ret = 0; |
44 | +DO_3SAME(VAND, tcg_gen_gvec_and) | 48 | - uint32_t servers_prop[smt_threads]; |
45 | +DO_3SAME(VBIC, tcg_gen_gvec_andc) | 49 | - uint32_t gservers_prop[smt_threads * 2]; |
46 | +DO_3SAME(VORR, tcg_gen_gvec_or) | 50 | + g_autofree uint32_t *servers_prop = g_new(uint32_t, smt_threads); |
47 | +DO_3SAME(VORN, tcg_gen_gvec_orc) | 51 | + g_autofree uint32_t *gservers_prop = g_new(uint32_t, smt_threads * 2); |
48 | +DO_3SAME(VEOR, tcg_gen_gvec_xor) | 52 | int index = spapr_get_vcpu_id(cpu); |
49 | + | 53 | |
50 | +/* These insns are all gvec_bitsel but with the inputs in various orders. */ | 54 | if (cpu->compat_pvr) { |
51 | +#define DO_3SAME_BITSEL(INSN, O1, O2, O3) \ | 55 | @@ -XXX,XX +XXX,XX @@ static int spapr_fixup_cpu_smt_dt(void *fdt, int offset, PowerPCCPU *cpu, |
52 | + static void gen_##INSN##_3s(unsigned vece, uint32_t rd_ofs, \ | 56 | gservers_prop[i*2 + 1] = 0; |
53 | + uint32_t rn_ofs, uint32_t rm_ofs, \ | 57 | } |
54 | + uint32_t oprsz, uint32_t maxsz) \ | 58 | ret = fdt_setprop(fdt, offset, "ibm,ppc-interrupt-server#s", |
55 | + { \ | 59 | - servers_prop, sizeof(servers_prop)); |
56 | + tcg_gen_gvec_bitsel(vece, rd_ofs, O1, O2, O3, oprsz, maxsz); \ | 60 | + servers_prop, sizeof(*servers_prop) * smt_threads); |
57 | + } \ | 61 | if (ret < 0) { |
58 | + DO_3SAME(INSN, gen_##INSN##_3s) | 62 | return ret; |
59 | + | 63 | } |
60 | +DO_3SAME_BITSEL(VBSL, rd_ofs, rn_ofs, rm_ofs) | 64 | ret = fdt_setprop(fdt, offset, "ibm,ppc-interrupt-gserver#s", |
61 | +DO_3SAME_BITSEL(VBIT, rm_ofs, rn_ofs, rd_ofs) | 65 | - gservers_prop, sizeof(gservers_prop)); |
62 | +DO_3SAME_BITSEL(VBIF, rm_ofs, rd_ofs, rn_ofs) | 66 | + gservers_prop, sizeof(*gservers_prop) * smt_threads * 2); |
63 | diff --git a/target/arm/translate.c b/target/arm/translate.c | 67 | |
68 | return ret; | ||
69 | } | ||
70 | diff --git a/hw/ppc/spapr_pci_nvlink2.c b/hw/ppc/spapr_pci_nvlink2.c | ||
64 | index XXXXXXX..XXXXXXX 100644 | 71 | index XXXXXXX..XXXXXXX 100644 |
65 | --- a/target/arm/translate.c | 72 | --- a/hw/ppc/spapr_pci_nvlink2.c |
66 | +++ b/target/arm/translate.c | 73 | +++ b/hw/ppc/spapr_pci_nvlink2.c |
67 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) | 74 | @@ -XXX,XX +XXX,XX @@ void spapr_phb_nvgpu_populate_pcidev_dt(PCIDevice *dev, void *fdt, int offset, |
68 | } | 75 | continue; |
69 | return 1; | ||
70 | |||
71 | - case NEON_3R_LOGIC: /* Logic ops. */ | ||
72 | - switch ((u << 2) | size) { | ||
73 | - case 0: /* VAND */ | ||
74 | - tcg_gen_gvec_and(0, rd_ofs, rn_ofs, rm_ofs, | ||
75 | - vec_size, vec_size); | ||
76 | - break; | ||
77 | - case 1: /* VBIC */ | ||
78 | - tcg_gen_gvec_andc(0, rd_ofs, rn_ofs, rm_ofs, | ||
79 | - vec_size, vec_size); | ||
80 | - break; | ||
81 | - case 2: /* VORR */ | ||
82 | - tcg_gen_gvec_or(0, rd_ofs, rn_ofs, rm_ofs, | ||
83 | - vec_size, vec_size); | ||
84 | - break; | ||
85 | - case 3: /* VORN */ | ||
86 | - tcg_gen_gvec_orc(0, rd_ofs, rn_ofs, rm_ofs, | ||
87 | - vec_size, vec_size); | ||
88 | - break; | ||
89 | - case 4: /* VEOR */ | ||
90 | - tcg_gen_gvec_xor(0, rd_ofs, rn_ofs, rm_ofs, | ||
91 | - vec_size, vec_size); | ||
92 | - break; | ||
93 | - case 5: /* VBSL */ | ||
94 | - tcg_gen_gvec_bitsel(MO_8, rd_ofs, rd_ofs, rn_ofs, rm_ofs, | ||
95 | - vec_size, vec_size); | ||
96 | - break; | ||
97 | - case 6: /* VBIT */ | ||
98 | - tcg_gen_gvec_bitsel(MO_8, rd_ofs, rm_ofs, rn_ofs, rd_ofs, | ||
99 | - vec_size, vec_size); | ||
100 | - break; | ||
101 | - case 7: /* VBIF */ | ||
102 | - tcg_gen_gvec_bitsel(MO_8, rd_ofs, rm_ofs, rd_ofs, rn_ofs, | ||
103 | - vec_size, vec_size); | ||
104 | - break; | ||
105 | - } | ||
106 | - return 0; | ||
107 | - | ||
108 | case NEON_3R_VQADD: | ||
109 | tcg_gen_gvec_4(rd_ofs, offsetof(CPUARMState, vfp.qc), | ||
110 | rn_ofs, rm_ofs, vec_size, vec_size, | ||
111 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) | ||
112 | return 0; | ||
113 | |||
114 | case NEON_3R_VADD_VSUB: | ||
115 | + case NEON_3R_LOGIC: | ||
116 | /* Already handled by decodetree */ | ||
117 | return 1; | ||
118 | } | 76 | } |
77 | if (dev == nvslot->gpdev) { | ||
78 | - uint32_t npus[nvslot->linknum]; | ||
79 | + g_autofree uint32_t *npus = g_new(uint32_t, nvslot->linknum); | ||
80 | |||
81 | for (j = 0; j < nvslot->linknum; ++j) { | ||
82 | PCIDevice *npdev = nvslot->links[j].npdev; | ||
119 | -- | 83 | -- |
120 | 2.20.1 | 84 | 2.25.1 |
121 | 85 | ||
122 | 86 | diff view generated by jsdifflib |
1 | Convert the Neon "load/store single structure to one lane" insns to | 1 | From: Philippe Mathieu-Daudé <philmd@redhat.com> |
---|---|---|---|
2 | decodetree. | ||
3 | 2 | ||
4 | As this is the last set of insns in the neon load/store group, | 3 | Use autofree heap allocation instead of variable-length |
5 | we can remove the whole disas_neon_ls_insn() function. | 4 | array on the stack. |
6 | 5 | ||
6 | Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
7 | Acked-by: David Gibson <david@gibson.dropbear.id.au> | ||
8 | Reviewed-by: Greg Kurz <groug@kaod.org> | ||
7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
8 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 10 | Message-id: 20220819153931.3147384-8-peter.maydell@linaro.org |
9 | Message-id: 20200430181003.21682-14-peter.maydell@linaro.org | ||
10 | --- | 11 | --- |
11 | target/arm/neon-ls.decode | 11 +++ | 12 | hw/intc/xics.c | 2 +- |
12 | target/arm/translate-neon.inc.c | 89 +++++++++++++++++++ | 13 | 1 file changed, 1 insertion(+), 1 deletion(-) |
13 | target/arm/translate.c | 147 -------------------------------- | ||
14 | 3 files changed, 100 insertions(+), 147 deletions(-) | ||
15 | 14 | ||
16 | diff --git a/target/arm/neon-ls.decode b/target/arm/neon-ls.decode | 15 | diff --git a/hw/intc/xics.c b/hw/intc/xics.c |
17 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
18 | --- a/target/arm/neon-ls.decode | 17 | --- a/hw/intc/xics.c |
19 | +++ b/target/arm/neon-ls.decode | 18 | +++ b/hw/intc/xics.c |
20 | @@ -XXX,XX +XXX,XX @@ VLDST_multiple 1111 0100 0 . l:1 0 rn:4 .... itype:4 size:2 align:2 rm:4 \ | 19 | @@ -XXX,XX +XXX,XX @@ static void ics_reset_irq(ICSIRQState *irq) |
21 | 20 | static void ics_reset(DeviceState *dev) | |
22 | VLD_all_lanes 1111 0100 1 . 1 0 rn:4 .... 11 n:2 size:2 t:1 a:1 rm:4 \ | ||
23 | vd=%vd_dp | ||
24 | + | ||
25 | +# Neon load/store single structure to one lane | ||
26 | +%imm1_5_p1 5:1 !function=plus1 | ||
27 | +%imm1_6_p1 6:1 !function=plus1 | ||
28 | + | ||
29 | +VLDST_single 1111 0100 1 . l:1 0 rn:4 .... 00 n:2 reg_idx:3 align:1 rm:4 \ | ||
30 | + vd=%vd_dp size=0 stride=1 | ||
31 | +VLDST_single 1111 0100 1 . l:1 0 rn:4 .... 01 n:2 reg_idx:2 align:2 rm:4 \ | ||
32 | + vd=%vd_dp size=1 stride=%imm1_5_p1 | ||
33 | +VLDST_single 1111 0100 1 . l:1 0 rn:4 .... 10 n:2 reg_idx:1 align:3 rm:4 \ | ||
34 | + vd=%vd_dp size=2 stride=%imm1_6_p1 | ||
35 | diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c | ||
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 | +} | ||
47 | + | ||
48 | /* Include the generated Neon decoder */ | ||
49 | #include "decode-neon-dp.inc.c" | ||
50 | #include "decode-neon-ls.inc.c" | ||
51 | @@ -XXX,XX +XXX,XX @@ static bool trans_VLD_all_lanes(DisasContext *s, arg_VLD_all_lanes *a) | ||
52 | |||
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 | { | 21 | { |
283 | switch (size) { | 22 | ICSState *ics = ICS(dev); |
284 | @@ -XXX,XX +XXX,XX @@ static void disas_arm_insn(DisasContext *s, unsigned int insn) | 23 | + g_autofree uint8_t *flags = g_malloc(ics->nr_irqs); |
285 | } | 24 | int i; |
286 | return; | 25 | - uint8_t flags[ics->nr_irqs]; |
287 | } | 26 | |
288 | - if ((insn & 0x0f100000) == 0x04000000) { | 27 | for (i = 0; i < ics->nr_irqs; i++) { |
289 | - /* NEON load/store. */ | 28 | flags[i] = ics->irqs[i].flags; |
290 | - if (disas_neon_ls_insn(s, insn)) { | ||
291 | - goto illegal_op; | ||
292 | - } | ||
293 | - return; | ||
294 | - } | ||
295 | if ((insn & 0x0e000f00) == 0x0c000100) { | ||
296 | if (arm_dc_feature(s, ARM_FEATURE_IWMMXT)) { | ||
297 | /* iWMMXt register transfer. */ | ||
298 | @@ -XXX,XX +XXX,XX @@ static void disas_thumb2_insn(DisasContext *s, uint32_t insn) | ||
299 | } | ||
300 | break; | ||
301 | case 12: | ||
302 | - if ((insn & 0x01100000) == 0x01000000) { | ||
303 | - if (disas_neon_ls_insn(s, insn)) { | ||
304 | - goto illegal_op; | ||
305 | - } | ||
306 | - break; | ||
307 | - } | ||
308 | goto illegal_op; | ||
309 | default: | ||
310 | illegal_op: | ||
311 | -- | 29 | -- |
312 | 2.20.1 | 30 | 2.25.1 |
313 | 31 | ||
314 | 32 | diff view generated by jsdifflib |
1 | Convert the Neon "load/store multiple structures" insns to decodetree. | 1 | From: Philippe Mathieu-Daudé <philmd@redhat.com> |
---|---|---|---|
2 | 2 | ||
3 | Use autofree heap allocation instead of variable-length array on | ||
4 | the stack. Replace the snprintf() call by g_strdup_printf(). | ||
5 | |||
6 | Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
7 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
3 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
4 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 9 | Message-id: 20220819153931.3147384-9-peter.maydell@linaro.org |
5 | Message-id: 20200430181003.21682-12-peter.maydell@linaro.org | ||
6 | --- | 10 | --- |
7 | target/arm/neon-ls.decode | 7 ++ | 11 | hw/i386/multiboot.c | 5 ++--- |
8 | target/arm/translate-neon.inc.c | 124 ++++++++++++++++++++++++++++++++ | 12 | 1 file changed, 2 insertions(+), 3 deletions(-) |
9 | target/arm/translate.c | 91 +---------------------- | ||
10 | 3 files changed, 133 insertions(+), 89 deletions(-) | ||
11 | 13 | ||
12 | diff --git a/target/arm/neon-ls.decode b/target/arm/neon-ls.decode | 14 | diff --git a/hw/i386/multiboot.c b/hw/i386/multiboot.c |
13 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
14 | --- a/target/arm/neon-ls.decode | 16 | --- a/hw/i386/multiboot.c |
15 | +++ b/target/arm/neon-ls.decode | 17 | +++ b/hw/i386/multiboot.c |
16 | @@ -XXX,XX +XXX,XX @@ | 18 | @@ -XXX,XX +XXX,XX @@ int load_multiboot(X86MachineState *x86ms, |
17 | # 0b1111_1001_xxx0_xxxx_xxxx_xxxx_xxxx_xxxx | 19 | uint8_t *mb_bootinfo_data; |
18 | # This file works on the A32 encoding only; calling code for T32 has to | 20 | uint32_t cmdline_len; |
19 | # transform the insn into the A32 version first. | 21 | GList *mods = NULL; |
20 | + | 22 | + g_autofree char *kcmdline = NULL; |
21 | +%vd_dp 22:1 12:4 | 23 | |
22 | + | 24 | /* Ok, let's see if it is a multiboot image. |
23 | +# Neon load/store multiple structures | 25 | The header is 12x32bit long, so the latest entry may be 8192 - 48. */ |
24 | + | 26 | @@ -XXX,XX +XXX,XX @@ int load_multiboot(X86MachineState *x86ms, |
25 | +VLDST_multiple 1111 0100 0 . l:1 0 rn:4 .... itype:4 size:2 align:2 rm:4 \ | 27 | } |
26 | + vd=%vd_dp | 28 | |
27 | diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c | 29 | /* Commandline support */ |
28 | index XXXXXXX..XXXXXXX 100644 | 30 | - char kcmdline[strlen(kernel_filename) + strlen(kernel_cmdline) + 2]; |
29 | --- a/target/arm/translate-neon.inc.c | 31 | - snprintf(kcmdline, sizeof(kcmdline), "%s %s", |
30 | +++ b/target/arm/translate-neon.inc.c | 32 | - kernel_filename, kernel_cmdline); |
31 | @@ -XXX,XX +XXX,XX @@ static bool trans_VFML_scalar(DisasContext *s, arg_VFML_scalar *a) | 33 | + kcmdline = g_strdup_printf("%s %s", kernel_filename, kernel_cmdline); |
32 | gen_helper_gvec_fmlal_idx_a32); | 34 | stl_p(bootinfo + MBI_CMDLINE, mb_add_cmdline(&mbs, kcmdline)); |
33 | return true; | 35 | |
34 | } | 36 | stl_p(bootinfo + MBI_BOOTLOADER, mb_add_bootloader(&mbs, bootloader_name)); |
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 | ||
160 | index XXXXXXX..XXXXXXX 100644 | ||
161 | --- a/target/arm/translate.c | ||
162 | +++ b/target/arm/translate.c | ||
163 | @@ -XXX,XX +XXX,XX @@ static void gen_neon_trn_u16(TCGv_i32 t0, TCGv_i32 t1) | ||
164 | } | ||
165 | |||
166 | |||
167 | -static struct { | ||
168 | - int nregs; | ||
169 | - int interleave; | ||
170 | - int spacing; | ||
171 | -} const neon_ls_element_type[11] = { | ||
172 | - {1, 4, 1}, | ||
173 | - {1, 4, 2}, | ||
174 | - {4, 1, 1}, | ||
175 | - {2, 2, 2}, | ||
176 | - {1, 3, 1}, | ||
177 | - {1, 3, 2}, | ||
178 | - {3, 1, 1}, | ||
179 | - {1, 1, 1}, | ||
180 | - {1, 2, 1}, | ||
181 | - {1, 2, 2}, | ||
182 | - {2, 1, 1} | ||
183 | -}; | ||
184 | - | ||
185 | /* Translate a NEON load/store element instruction. Return nonzero if the | ||
186 | instruction is invalid. */ | ||
187 | static int disas_neon_ls_insn(DisasContext *s, uint32_t insn) | ||
188 | { | ||
189 | int rd, rn, rm; | ||
190 | - int op; | ||
191 | int nregs; | ||
192 | - int interleave; | ||
193 | - int spacing; | ||
194 | int stride; | ||
195 | int size; | ||
196 | int reg; | ||
197 | int load; | ||
198 | - int n; | ||
199 | int vec_size; | ||
200 | - int mmu_idx; | ||
201 | - MemOp endian; | ||
202 | TCGv_i32 addr; | ||
203 | TCGv_i32 tmp; | ||
204 | - TCGv_i32 tmp2; | ||
205 | - TCGv_i64 tmp64; | ||
206 | |||
207 | if (!arm_dc_feature(s, ARM_FEATURE_NEON)) { | ||
208 | return 1; | ||
209 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_ls_insn(DisasContext *s, uint32_t insn) | ||
210 | rn = (insn >> 16) & 0xf; | ||
211 | rm = insn & 0xf; | ||
212 | load = (insn & (1 << 21)) != 0; | ||
213 | - endian = s->be_data; | ||
214 | - mmu_idx = get_mem_index(s); | ||
215 | if ((insn & (1 << 23)) == 0) { | ||
216 | - /* Load store all elements. */ | ||
217 | - op = (insn >> 8) & 0xf; | ||
218 | - size = (insn >> 6) & 3; | ||
219 | - if (op > 10) | ||
220 | - return 1; | ||
221 | - /* Catch UNDEF cases for bad values of align field */ | ||
222 | - switch (op & 0xc) { | ||
223 | - case 4: | ||
224 | - if (((insn >> 5) & 1) == 1) { | ||
225 | - return 1; | ||
226 | - } | ||
227 | - break; | ||
228 | - case 8: | ||
229 | - if (((insn >> 4) & 3) == 3) { | ||
230 | - return 1; | ||
231 | - } | ||
232 | - break; | ||
233 | - default: | ||
234 | - break; | ||
235 | - } | ||
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 | - | ||
262 | - if (load) { | ||
263 | - gen_aa32_ld_i64(s, tmp64, addr, mmu_idx, endian | size); | ||
264 | - neon_store_element64(tt, n, size, tmp64); | ||
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 | -- | 37 | -- |
283 | 2.20.1 | 38 | 2.25.1 |
284 | 39 | ||
285 | 40 | diff view generated by jsdifflib |
1 | For ARMv8.2-TTS2UXN, the stage 2 page table walk wants to know | 1 | From: Philippe Mathieu-Daudé <philmd@redhat.com> |
---|---|---|---|
2 | whether the stage 1 access is for EL0 or not, because whether | ||
3 | exec permission is given can depend on whether this is an EL0 | ||
4 | or EL1 access. Add a new argument to get_phys_addr_lpae() so | ||
5 | the call sites can pass this information in. | ||
6 | 2 | ||
7 | Since get_phys_addr_lpae() doesn't already have a doc comment, | 3 | The compiler isn't clever enough to figure 'width' is a constant, |
8 | add one so we have a place to put the documentation of the | 4 | so help it by using a definitions instead. |
9 | semantics of the new s1_is_el0 argument. | ||
10 | 5 | ||
6 | Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
7 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
12 | Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | 9 | Message-id: 20220819153931.3147384-10-peter.maydell@linaro.org |
13 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
14 | Message-id: 20200330210400.11724-4-peter.maydell@linaro.org | ||
15 | --- | 10 | --- |
16 | target/arm/helper.c | 29 ++++++++++++++++++++++++++++- | 11 | hw/usb/hcd-ohci.c | 7 ++++--- |
17 | 1 file changed, 28 insertions(+), 1 deletion(-) | 12 | 1 file changed, 4 insertions(+), 3 deletions(-) |
18 | 13 | ||
19 | diff --git a/target/arm/helper.c b/target/arm/helper.c | 14 | diff --git a/hw/usb/hcd-ohci.c b/hw/usb/hcd-ohci.c |
20 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
21 | --- a/target/arm/helper.c | 16 | --- a/hw/usb/hcd-ohci.c |
22 | +++ b/target/arm/helper.c | 17 | +++ b/hw/usb/hcd-ohci.c |
23 | @@ -XXX,XX +XXX,XX @@ | 18 | @@ -XXX,XX +XXX,XX @@ static int ohci_service_iso_td(OHCIState *ohci, struct ohci_ed *ed) |
24 | 19 | return 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 | } | 20 | } |
42 | 21 | ||
43 | +/** | 22 | +#define HEX_CHAR_PER_LINE 16 |
44 | + * get_phys_addr_lpae: perform one stage of page table walk, LPAE format | 23 | + |
45 | + * | 24 | static void ohci_td_pkt(const char *msg, const uint8_t *buf, size_t len) |
46 | + * Returns false if the translation was successful. Otherwise, phys_ptr, attrs, | 25 | { |
47 | + * prot and page_size may not be filled in, and the populated fsr value provides | 26 | bool print16; |
48 | + * information on why the translation aborted, in the format of a long-format | 27 | bool printall; |
49 | + * DFSR/IFSR fault register, with the following caveats: | 28 | - const int width = 16; |
50 | + * * the WnR bit is never set (the caller must do this). | 29 | int i; |
51 | + * | 30 | - char tmp[3 * width + 1]; |
52 | + * @env: CPUARMState | 31 | + char tmp[3 * HEX_CHAR_PER_LINE + 1]; |
53 | + * @address: virtual address to get physical address for | 32 | char *p = tmp; |
54 | + * @access_type: MMU_DATA_LOAD, MMU_DATA_STORE or MMU_INST_FETCH | 33 | |
55 | + * @mmu_idx: MMU index indicating required translation regime | 34 | print16 = !!trace_event_get_state_backends(TRACE_USB_OHCI_TD_PKT_SHORT); |
56 | + * @s1_is_el0: if @mmu_idx is ARMMMUIdx_Stage2 (so this is a stage 2 page table | 35 | @@ -XXX,XX +XXX,XX @@ static void ohci_td_pkt(const char *msg, const uint8_t *buf, size_t len) |
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 | } | 36 | } |
82 | 37 | ||
83 | if (regime_using_lpae_format(env, mmu_idx)) { | 38 | for (i = 0; ; i++) { |
84 | - return get_phys_addr_lpae(env, address, access_type, mmu_idx, | 39 | - if (i && (!(i % width) || (i == len))) { |
85 | + return get_phys_addr_lpae(env, address, access_type, mmu_idx, false, | 40 | + if (i && (!(i % HEX_CHAR_PER_LINE) || (i == len))) { |
86 | phys_ptr, attrs, prot, page_size, | 41 | if (!printall) { |
87 | fi, cacheattrs); | 42 | trace_usb_ohci_td_pkt_short(msg, tmp); |
88 | } else if (regime_sctlr(env, mmu_idx) & SCTLR_XP) { | 43 | break; |
89 | -- | 44 | -- |
90 | 2.20.1 | 45 | 2.25.1 |
91 | 46 | ||
92 | 47 | diff view generated by jsdifflib |
1 | From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com> | 1 | From: Philippe Mathieu-Daudé <philmd@redhat.com> |
---|---|---|---|
2 | 2 | ||
3 | Move misplaced comment. | 3 | Use autofree heap allocation instead of variable-length |
4 | array on the stack. | ||
4 | 5 | ||
5 | Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | 6 | Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> |
6 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | 7 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
7 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
8 | Reviewed-by: Luc Michel <luc.michel@greensocs.com> | ||
9 | Message-id: 20200427181649.26851-3-edgar.iglesias@gmail.com | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
9 | Message-id: 20220819153931.3147384-11-peter.maydell@linaro.org | ||
11 | --- | 10 | --- |
12 | hw/arm/xlnx-versal.c | 2 +- | 11 | ui/curses.c | 2 +- |
13 | 1 file changed, 1 insertion(+), 1 deletion(-) | 12 | 1 file changed, 1 insertion(+), 1 deletion(-) |
14 | 13 | ||
15 | diff --git a/hw/arm/xlnx-versal.c b/hw/arm/xlnx-versal.c | 14 | diff --git a/ui/curses.c b/ui/curses.c |
16 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
17 | --- a/hw/arm/xlnx-versal.c | 16 | --- a/ui/curses.c |
18 | +++ b/hw/arm/xlnx-versal.c | 17 | +++ b/ui/curses.c |
19 | @@ -XXX,XX +XXX,XX @@ static void versal_create_apu_cpus(Versal *s) | 18 | @@ -XXX,XX +XXX,XX @@ static void curses_update(DisplayChangeListener *dcl, |
20 | 19 | int x, int y, int w, int h) | |
21 | obj = object_new(XLNX_VERSAL_ACPU_TYPE); | 20 | { |
22 | if (!obj) { | 21 | console_ch_t *line; |
23 | - /* Secondary CPUs start in PSCI powered-down state */ | 22 | - cchar_t curses_line[width]; |
24 | error_report("Unable to create apu.cpu[%d] of type %s", | 23 | + g_autofree cchar_t *curses_line = g_new(cchar_t, width); |
25 | i, XLNX_VERSAL_ACPU_TYPE); | 24 | wchar_t wch[CCHARW_MAX]; |
26 | exit(EXIT_FAILURE); | 25 | attr_t attrs; |
27 | @@ -XXX,XX +XXX,XX @@ static void versal_create_apu_cpus(Versal *s) | 26 | short colors; |
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 | } | ||
35 | -- | 27 | -- |
36 | 2.20.1 | 28 | 2.25.1 |
37 | 29 | ||
38 | 30 | diff view generated by jsdifflib |
1 | In aarch64_max_initfn() we update both 32-bit and 64-bit ID | 1 | From: Philippe Mathieu-Daudé <philmd@redhat.com> |
---|---|---|---|
2 | registers. The intended pattern is that for 64-bit ID registers we | ||
3 | use FIELD_DP64 and the uint64_t 't' register, while 32-bit ID | ||
4 | registers use FIELD_DP32 and the uint32_t 'u' register. For | ||
5 | ID_AA64DFR0 we accidentally used 'u', meaning that the top 32 bits of | ||
6 | this 64-bit ID register would end up always zero. Luckily at the | ||
7 | moment that's what they should be anyway, so this bug has no visible | ||
8 | effects. | ||
9 | 2 | ||
10 | Use the right-sized variable. | 3 | Use autofree heap allocation instead of variable-length |
4 | array on the stack. | ||
11 | 5 | ||
12 | Fixes: 3bec78447a958d481991 | 6 | Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> |
7 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
13 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
14 | Reviewed-by: Laurent Desnogues <laurent.desnogues@gmail.com> | 9 | Message-id: 20220819153931.3147384-12-peter.maydell@linaro.org |
15 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
16 | Message-id: 20200423110915.10527-1-peter.maydell@linaro.org | ||
17 | --- | 10 | --- |
18 | target/arm/cpu64.c | 6 +++--- | 11 | tests/unit/test-vmstate.c | 7 +++---- |
19 | 1 file changed, 3 insertions(+), 3 deletions(-) | 12 | 1 file changed, 3 insertions(+), 4 deletions(-) |
20 | 13 | ||
21 | diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c | 14 | diff --git a/tests/unit/test-vmstate.c b/tests/unit/test-vmstate.c |
22 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
23 | --- a/target/arm/cpu64.c | 16 | --- a/tests/unit/test-vmstate.c |
24 | +++ b/target/arm/cpu64.c | 17 | +++ b/tests/unit/test-vmstate.c |
25 | @@ -XXX,XX +XXX,XX @@ static void aarch64_max_initfn(Object *obj) | 18 | @@ -XXX,XX +XXX,XX @@ static void save_buffer(const uint8_t *buf, size_t buf_size) |
26 | u = FIELD_DP32(u, ID_MMFR4, XNX, 1); /* TTS2UXN */ | 19 | static void compare_vmstate(const uint8_t *wire, size_t size) |
27 | cpu->isar.id_mmfr4 = u; | 20 | { |
28 | 21 | QEMUFile *f = open_test_file(false); | |
29 | - u = cpu->isar.id_aa64dfr0; | 22 | - uint8_t result[size]; |
30 | - u = FIELD_DP64(u, ID_AA64DFR0, PMUVER, 5); /* v8.4-PMU */ | 23 | + g_autofree uint8_t *result = g_malloc(size); |
31 | - cpu->isar.id_aa64dfr0 = u; | 24 | |
32 | + t = cpu->isar.id_aa64dfr0; | 25 | /* read back as binary */ |
33 | + t = FIELD_DP64(t, ID_AA64DFR0, PMUVER, 5); /* v8.4-PMU */ | 26 | |
34 | + cpu->isar.id_aa64dfr0 = t; | 27 | - g_assert_cmpint(qemu_get_buffer(f, result, sizeof(result)), ==, |
35 | 28 | - sizeof(result)); | |
36 | u = cpu->isar.id_dfr0; | 29 | + g_assert_cmpint(qemu_get_buffer(f, result, size), ==, size); |
37 | u = FIELD_DP32(u, ID_DFR0, PERFMON, 5); /* v8.4-PMU */ | 30 | g_assert(!qemu_file_get_error(f)); |
31 | |||
32 | /* Compare that what is on the file is the same that what we | ||
33 | expected to be there */ | ||
34 | - SUCCESS(memcmp(result, wire, sizeof(result))); | ||
35 | + SUCCESS(memcmp(result, wire, size)); | ||
36 | |||
37 | /* Must reach EOF */ | ||
38 | qemu_get_byte(f); | ||
38 | -- | 39 | -- |
39 | 2.20.1 | 40 | 2.25.1 |
40 | 41 | ||
41 | 42 | diff view generated by jsdifflib |
1 | Convert VCMLA (scalar) in the 2reg-scalar-ext group to decodetree. | 1 | Shellcheck correctly reports that we set python_version and never use |
---|---|---|---|
2 | it. This is a leftover from commit f9332757898a7: we used to use | ||
3 | python_version purely to as part of the summary information printed | ||
4 | at the end of a configure run, and that commit changed to printing | ||
5 | the information from meson (which looks up the python version | ||
6 | itself). Remove the unused variable. | ||
2 | 7 | ||
3 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
4 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 9 | Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> |
5 | Message-id: 20200430181003.21682-9-peter.maydell@linaro.org | 10 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> |
11 | Message-id: 20220825150703.4074125-2-peter.maydell@linaro.org | ||
6 | --- | 12 | --- |
7 | target/arm/neon-shared.decode | 5 +++++ | 13 | configure | 3 --- |
8 | target/arm/translate-neon.inc.c | 40 +++++++++++++++++++++++++++++++++ | 14 | 1 file changed, 3 deletions(-) |
9 | target/arm/translate.c | 26 +-------------------- | ||
10 | 3 files changed, 46 insertions(+), 25 deletions(-) | ||
11 | 15 | ||
12 | diff --git a/target/arm/neon-shared.decode b/target/arm/neon-shared.decode | 16 | diff --git a/configure b/configure |
13 | index XXXXXXX..XXXXXXX 100644 | 17 | index XXXXXXX..XXXXXXX 100755 |
14 | --- a/target/arm/neon-shared.decode | 18 | --- a/configure |
15 | +++ b/target/arm/neon-shared.decode | 19 | +++ b/configure |
16 | @@ -XXX,XX +XXX,XX @@ VFML 1111 110 0 s:1 . 10 .... .... 1000 . 0 . 1 .... \ | 20 | @@ -XXX,XX +XXX,XX @@ if ! $python -c 'import sys; sys.exit(sys.version_info < (3,6))'; then |
17 | vm=%vm_sp vn=%vn_sp vd=%vd_dp q=0 | 21 | "Use --python=/path/to/python to specify a supported Python." |
18 | VFML 1111 110 0 s:1 . 10 .... .... 1000 . 1 . 1 .... \ | 22 | fi |
19 | vm=%vm_dp vn=%vn_dp vd=%vd_dp q=1 | 23 | |
20 | + | 24 | -# Preserve python version since some functionality is dependent on it |
21 | +VCMLA_scalar 1111 1110 0 . rot:2 .... .... 1000 . q:1 index:1 0 vm:4 \ | 25 | -python_version=$($python -c 'import sys; print("%d.%d.%d" % (sys.version_info[0], sys.version_info[1], sys.version_info[2]))' 2>/dev/null) |
22 | + vn=%vn_dp vd=%vd_dp size=0 | ||
23 | +VCMLA_scalar 1111 1110 1 . rot:2 .... .... 1000 . q:1 . 0 .... \ | ||
24 | + vm=%vm_dp vn=%vn_dp vd=%vd_dp size=1 index=0 | ||
25 | diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c | ||
26 | index XXXXXXX..XXXXXXX 100644 | ||
27 | --- a/target/arm/translate-neon.inc.c | ||
28 | +++ b/target/arm/translate-neon.inc.c | ||
29 | @@ -XXX,XX +XXX,XX @@ static bool trans_VFML(DisasContext *s, arg_VFML *a) | ||
30 | gen_helper_gvec_fmlal_a32); | ||
31 | return true; | ||
32 | } | ||
33 | + | ||
34 | +static bool trans_VCMLA_scalar(DisasContext *s, arg_VCMLA_scalar *a) | ||
35 | +{ | ||
36 | + gen_helper_gvec_3_ptr *fn_gvec_ptr; | ||
37 | + int opr_sz; | ||
38 | + TCGv_ptr fpst; | ||
39 | + | ||
40 | + if (!dc_isar_feature(aa32_vcma, s)) { | ||
41 | + return false; | ||
42 | + } | ||
43 | + if (a->size == 0 && !dc_isar_feature(aa32_fp16_arith, s)) { | ||
44 | + return false; | ||
45 | + } | ||
46 | + | ||
47 | + /* UNDEF accesses to D16-D31 if they don't exist. */ | ||
48 | + if (!dc_isar_feature(aa32_simd_r32, s) && | ||
49 | + ((a->vd | a->vn | a->vm) & 0x10)) { | ||
50 | + return false; | ||
51 | + } | ||
52 | + | ||
53 | + if ((a->vd | a->vn) & a->q) { | ||
54 | + return false; | ||
55 | + } | ||
56 | + | ||
57 | + if (!vfp_access_check(s)) { | ||
58 | + return true; | ||
59 | + } | ||
60 | + | ||
61 | + fn_gvec_ptr = (a->size ? gen_helper_gvec_fcmlas_idx | ||
62 | + : gen_helper_gvec_fcmlah_idx); | ||
63 | + opr_sz = (1 + a->q) * 8; | ||
64 | + fpst = get_fpstatus_ptr(1); | ||
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 | - | 26 | - |
87 | - if (!dc_isar_feature(aa32_vcma, s)) { | 27 | # Suppress writing compiled files |
88 | - return 1; | 28 | python="$python -B" |
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 | 29 | ||
110 | -- | 30 | -- |
111 | 2.20.1 | 31 | 2.25.1 |
112 | 32 | ||
113 | 33 | diff view generated by jsdifflib |
1 | Convert the V[US]DOT (scalar) insns in the 2reg-scalar-ext group | 1 | The meson_args variable was added in commit 3b4da13293482134b, but |
---|---|---|---|
2 | to decodetree. | 2 | was not used in that commit and isn't used today. Delete the |
3 | unnecessary assignment. | ||
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: Marc-André Lureau <marcandre.lureau@redhat.com> |
6 | Message-id: 20200430181003.21682-10-peter.maydell@linaro.org | 7 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> |
8 | Message-id: 20220825150703.4074125-3-peter.maydell@linaro.org | ||
7 | --- | 9 | --- |
8 | target/arm/neon-shared.decode | 3 +++ | 10 | configure | 1 - |
9 | target/arm/translate-neon.inc.c | 35 +++++++++++++++++++++++++++++++++ | 11 | 1 file changed, 1 deletion(-) |
10 | target/arm/translate.c | 13 +----------- | ||
11 | 3 files changed, 39 insertions(+), 12 deletions(-) | ||
12 | 12 | ||
13 | diff --git a/target/arm/neon-shared.decode b/target/arm/neon-shared.decode | 13 | diff --git a/configure b/configure |
14 | index XXXXXXX..XXXXXXX 100644 | 14 | index XXXXXXX..XXXXXXX 100755 |
15 | --- a/target/arm/neon-shared.decode | 15 | --- a/configure |
16 | +++ b/target/arm/neon-shared.decode | 16 | +++ b/configure |
17 | @@ -XXX,XX +XXX,XX @@ VCMLA_scalar 1111 1110 0 . rot:2 .... .... 1000 . q:1 index:1 0 vm:4 \ | 17 | @@ -XXX,XX +XXX,XX @@ pie="" |
18 | vn=%vn_dp vd=%vd_dp size=0 | 18 | coroutine="" |
19 | VCMLA_scalar 1111 1110 1 . rot:2 .... .... 1000 . q:1 . 0 .... \ | 19 | plugins="$default_feature" |
20 | vm=%vm_dp vn=%vn_dp vd=%vd_dp size=1 index=0 | 20 | meson="" |
21 | + | 21 | -meson_args="" |
22 | +VDOT_scalar 1111 1110 0 . 10 .... .... 1101 . q:1 index:1 u:1 rm:4 \ | 22 | ninja="" |
23 | + vm=%vm_dp vn=%vn_dp vd=%vd_dp | 23 | bindir="bin" |
24 | diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c | 24 | skip_meson=no |
25 | index XXXXXXX..XXXXXXX 100644 | ||
26 | --- a/target/arm/translate-neon.inc.c | ||
27 | +++ b/target/arm/translate-neon.inc.c | ||
28 | @@ -XXX,XX +XXX,XX @@ static bool trans_VCMLA_scalar(DisasContext *s, arg_VCMLA_scalar *a) | ||
29 | tcg_temp_free_ptr(fpst); | ||
30 | return true; | ||
31 | } | ||
32 | + | ||
33 | +static bool trans_VDOT_scalar(DisasContext *s, arg_VDOT_scalar *a) | ||
34 | +{ | ||
35 | + gen_helper_gvec_3 *fn_gvec; | ||
36 | + int opr_sz; | ||
37 | + TCGv_ptr fpst; | ||
38 | + | ||
39 | + if (!dc_isar_feature(aa32_dp, s)) { | ||
40 | + return false; | ||
41 | + } | ||
42 | + | ||
43 | + /* UNDEF accesses to D16-D31 if they don't exist. */ | ||
44 | + if (!dc_isar_feature(aa32_simd_r32, s) && | ||
45 | + ((a->vd | a->vn) & 0x10)) { | ||
46 | + return false; | ||
47 | + } | ||
48 | + | ||
49 | + if ((a->vd | a->vn) & a->q) { | ||
50 | + return false; | ||
51 | + } | ||
52 | + | ||
53 | + if (!vfp_access_check(s)) { | ||
54 | + return true; | ||
55 | + } | ||
56 | + | ||
57 | + fn_gvec = a->u ? gen_helper_gvec_udot_idx_b : gen_helper_gvec_sdot_idx_b; | ||
58 | + opr_sz = (1 + a->q) * 8; | ||
59 | + fpst = get_fpstatus_ptr(1); | ||
60 | + tcg_gen_gvec_3_ool(vfp_reg_offset(1, a->vd), | ||
61 | + vfp_reg_offset(1, a->vn), | ||
62 | + vfp_reg_offset(1, a->rm), | ||
63 | + opr_sz, opr_sz, a->index, fn_gvec); | ||
64 | + tcg_temp_free_ptr(fpst); | ||
65 | + return true; | ||
66 | +} | ||
67 | diff --git a/target/arm/translate.c b/target/arm/translate.c | ||
68 | index XXXXXXX..XXXXXXX 100644 | ||
69 | --- a/target/arm/translate.c | ||
70 | +++ b/target/arm/translate.c | ||
71 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_insn_2reg_scalar_ext(DisasContext *s, uint32_t insn) | ||
72 | bool is_long = false, q = extract32(insn, 6, 1); | ||
73 | bool ptr_is_env = false; | ||
74 | |||
75 | - if ((insn & 0xffb00f00) == 0xfe200d00) { | ||
76 | - /* V[US]DOT -- 1111 1110 0.10 .... .... 1101 .Q.U .... */ | ||
77 | - int u = extract32(insn, 4, 1); | ||
78 | - | ||
79 | - if (!dc_isar_feature(aa32_dp, s)) { | ||
80 | - return 1; | ||
81 | - } | ||
82 | - fn_gvec = u ? gen_helper_gvec_udot_idx_b : gen_helper_gvec_sdot_idx_b; | ||
83 | - /* rm is just Vm, and index is M. */ | ||
84 | - data = extract32(insn, 5, 1); /* index */ | ||
85 | - rm = extract32(insn, 0, 4); | ||
86 | - } else if ((insn & 0xffa00f10) == 0xfe000810) { | ||
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 | -- | 25 | -- |
92 | 2.20.1 | 26 | 2.25.1 |
93 | 27 | ||
94 | 28 | diff view generated by jsdifflib |
1 | The ARMv8.2-TTS2UXN feature extends the XN field in stage 2 | 1 | This commit adds quotes in some places which: |
---|---|---|---|
2 | translation table descriptors from just bit [54] to bits [54:53], | 2 | * are spotted by shellcheck |
3 | allowing stage 2 to control execution permissions separately for EL0 | 3 | * are obviously incorrect |
4 | and EL1. Implement the new semantics of the XN field and enable | 4 | * are easy to fix just by adding the quotes |
5 | the feature for our 'max' CPU. | 5 | |
6 | It doesn't attempt fix all of the places shellcheck finds errors, | ||
7 | or even all the ones which are easy to fix. It's just a random | ||
8 | sampling which is hopefully easy to review and which cuts | ||
9 | down the size of the problem for next time somebody wants to | ||
10 | try to look at shellcheck errors. | ||
6 | 11 | ||
7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
8 | Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | 13 | Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> |
9 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 14 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> |
10 | Message-id: 20200330210400.11724-5-peter.maydell@linaro.org | 15 | Message-id: 20220825150703.4074125-4-peter.maydell@linaro.org |
11 | --- | 16 | --- |
12 | target/arm/cpu.h | 15 +++++++++++++++ | 17 | configure | 64 +++++++++++++++++++++++++++---------------------------- |
13 | target/arm/cpu.c | 1 + | 18 | 1 file changed, 32 insertions(+), 32 deletions(-) |
14 | target/arm/cpu64.c | 2 ++ | 19 | |
15 | target/arm/helper.c | 37 +++++++++++++++++++++++++++++++------ | 20 | diff --git a/configure b/configure |
16 | 4 files changed, 49 insertions(+), 6 deletions(-) | 21 | index XXXXXXX..XXXXXXX 100755 |
17 | 22 | --- a/configure | |
18 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h | 23 | +++ b/configure |
19 | index XXXXXXX..XXXXXXX 100644 | 24 | @@ -XXX,XX +XXX,XX @@ GNUmakefile: ; |
20 | --- a/target/arm/cpu.h | 25 | |
21 | +++ b/target/arm/cpu.h | 26 | EOF |
22 | @@ -XXX,XX +XXX,XX @@ static inline bool isar_feature_aa32_ccidx(const ARMISARegisters *id) | 27 | cd build |
23 | return FIELD_EX32(id->id_mmfr4, ID_MMFR4, CCIDX) != 0; | 28 | - exec $source_path/configure "$@" |
29 | + exec "$source_path/configure" "$@" | ||
30 | fi | ||
31 | |||
32 | # Temporary directory used for files created while | ||
33 | @@ -XXX,XX +XXX,XX @@ meson_option_build_array() { | ||
34 | printf ']\n' | ||
24 | } | 35 | } |
25 | 36 | ||
26 | +static inline bool isar_feature_aa32_tts2uxn(const ARMISARegisters *id) | 37 | -. $source_path/scripts/meson-buildoptions.sh |
27 | +{ | 38 | +. "$source_path/scripts/meson-buildoptions.sh" |
28 | + return FIELD_EX32(id->id_mmfr4, ID_MMFR4, XNX) != 0; | 39 | |
29 | +} | 40 | meson_options= |
30 | + | 41 | meson_option_add() { |
31 | /* | 42 | @@ -XXX,XX +XXX,XX @@ for opt do |
32 | * 64-bit feature tests via id registers. | 43 | case "$opt" in |
33 | */ | 44 | --help|-h) show_help=yes |
34 | @@ -XXX,XX +XXX,XX @@ static inline bool isar_feature_aa64_ccidx(const ARMISARegisters *id) | 45 | ;; |
35 | return FIELD_EX64(id->id_aa64mmfr2, ID_AA64MMFR2, CCIDX) != 0; | 46 | - --version|-V) exec cat $source_path/VERSION |
36 | } | 47 | + --version|-V) exec cat "$source_path/VERSION" |
37 | 48 | ;; | |
38 | +static inline bool isar_feature_aa64_tts2uxn(const ARMISARegisters *id) | 49 | --prefix=*) prefix="$optarg" |
39 | +{ | 50 | ;; |
40 | + return FIELD_EX64(id->id_aa64mmfr1, ID_AA64MMFR1, XNX) != 0; | 51 | @@ -XXX,XX +XXX,XX @@ default_target_list="" |
41 | +} | 52 | mak_wilds="" |
42 | + | 53 | |
43 | /* | 54 | if [ "$linux_user" != no ]; then |
44 | * Feature tests for "does this exist in either 32-bit or 64-bit?" | 55 | - if [ "$targetos" = linux ] && [ -d $source_path/linux-user/include/host/$cpu ]; then |
45 | */ | 56 | + if [ "$targetos" = linux ] && [ -d "$source_path/linux-user/include/host/$cpu" ]; then |
46 | @@ -XXX,XX +XXX,XX @@ static inline bool isar_feature_any_ccidx(const ARMISARegisters *id) | 57 | linux_user=yes |
47 | return isar_feature_aa64_ccidx(id) || isar_feature_aa32_ccidx(id); | 58 | elif [ "$linux_user" = yes ]; then |
48 | } | 59 | error_exit "linux-user not supported on this architecture" |
49 | 60 | @@ -XXX,XX +XXX,XX @@ if [ "$bsd_user" != no ]; then | |
50 | +static inline bool isar_feature_any_tts2uxn(const ARMISARegisters *id) | 61 | if [ "$bsd_user" = "" ]; then |
51 | +{ | 62 | test $targetos = freebsd && bsd_user=yes |
52 | + return isar_feature_aa64_tts2uxn(id) || isar_feature_aa32_tts2uxn(id); | 63 | fi |
53 | +} | 64 | - if [ "$bsd_user" = yes ] && ! [ -d $source_path/bsd-user/$targetos ]; then |
54 | + | 65 | + if [ "$bsd_user" = yes ] && ! [ -d "$source_path/bsd-user/$targetos" ]; then |
55 | /* | 66 | error_exit "bsd-user not supported on this host OS" |
56 | * Forward to the above feature tests given an ARMCPU pointer. | 67 | fi |
57 | */ | 68 | fi |
58 | diff --git a/target/arm/cpu.c b/target/arm/cpu.c | 69 | @@ -XXX,XX +XXX,XX @@ python="$python -B" |
59 | index XXXXXXX..XXXXXXX 100644 | 70 | if test -z "$meson"; then |
60 | --- a/target/arm/cpu.c | 71 | if test "$explicit_python" = no && has meson && version_ge "$(meson --version)" 0.59.3; then |
61 | +++ b/target/arm/cpu.c | 72 | meson=meson |
62 | @@ -XXX,XX +XXX,XX @@ static void arm_max_initfn(Object *obj) | 73 | - elif test $git_submodules_action != 'ignore' ; then |
63 | t = FIELD_DP32(t, ID_MMFR4, HPDS, 1); /* AA32HPD */ | 74 | + elif test "$git_submodules_action" != 'ignore' ; then |
64 | t = FIELD_DP32(t, ID_MMFR4, AC2, 1); /* ACTLR2, HACTLR2 */ | 75 | meson=git |
65 | t = FIELD_DP32(t, ID_MMFR4, CNP, 1); /* TTCNP */ | 76 | elif test -e "${source_path}/meson/meson.py" ; then |
66 | + t = FIELD_DP32(t, ID_MMFR4, XNX, 1); /* TTS2UXN */ | 77 | meson=internal |
67 | cpu->isar.id_mmfr4 = t; | 78 | @@ -XXX,XX +XXX,XX @@ esac |
68 | } | 79 | container="no" |
69 | #endif | 80 | if test $use_containers = "yes"; then |
70 | diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c | 81 | if has "docker" || has "podman"; then |
71 | index XXXXXXX..XXXXXXX 100644 | 82 | - container=$($python $source_path/tests/docker/docker.py probe) |
72 | --- a/target/arm/cpu64.c | 83 | + container=$($python "$source_path"/tests/docker/docker.py probe) |
73 | +++ b/target/arm/cpu64.c | 84 | fi |
74 | @@ -XXX,XX +XXX,XX @@ static void aarch64_max_initfn(Object *obj) | 85 | fi |
75 | t = FIELD_DP64(t, ID_AA64MMFR1, VH, 1); | 86 | |
76 | t = FIELD_DP64(t, ID_AA64MMFR1, PAN, 2); /* ATS1E1 */ | 87 | @@ -XXX,XX +XXX,XX @@ if test "$QEMU_GA_DISTRO" = ""; then |
77 | t = FIELD_DP64(t, ID_AA64MMFR1, VMIDBITS, 2); /* VMID16 */ | 88 | QEMU_GA_DISTRO=Linux |
78 | + t = FIELD_DP64(t, ID_AA64MMFR1, XNX, 1); /* TTS2UXN */ | 89 | fi |
79 | cpu->isar.id_aa64mmfr1 = t; | 90 | if test "$QEMU_GA_VERSION" = ""; then |
80 | 91 | - QEMU_GA_VERSION=$(cat $source_path/VERSION) | |
81 | t = cpu->isar.id_aa64mmfr2; | 92 | + QEMU_GA_VERSION=$(cat "$source_path"/VERSION) |
82 | @@ -XXX,XX +XXX,XX @@ static void aarch64_max_initfn(Object *obj) | 93 | fi |
83 | u = FIELD_DP32(u, ID_MMFR4, HPDS, 1); /* AA32HPD */ | 94 | |
84 | u = FIELD_DP32(u, ID_MMFR4, AC2, 1); /* ACTLR2, HACTLR2 */ | 95 | |
85 | u = FIELD_DP32(u, ID_MMFR4, CNP, 1); /* TTCNP */ | 96 | @@ -XXX,XX +XXX,XX @@ fi |
86 | + u = FIELD_DP32(u, ID_MMFR4, XNX, 1); /* TTS2UXN */ | 97 | for target in $target_list; do |
87 | cpu->isar.id_mmfr4 = u; | 98 | target_dir="$target" |
88 | 99 | target_name=$(echo $target | cut -d '-' -f 1)$EXESUF | |
89 | u = cpu->isar.id_aa64dfr0; | 100 | - mkdir -p $target_dir |
90 | diff --git a/target/arm/helper.c b/target/arm/helper.c | 101 | + mkdir -p "$target_dir" |
91 | index XXXXXXX..XXXXXXX 100644 | 102 | case $target in |
92 | --- a/target/arm/helper.c | 103 | *-user) symlink "../qemu-$target_name" "$target_dir/qemu-$target_name" ;; |
93 | +++ b/target/arm/helper.c | 104 | *) symlink "../qemu-system-$target_name" "$target_dir/qemu-system-$target_name" ;; |
94 | @@ -XXX,XX +XXX,XX @@ simple_ap_to_rw_prot(CPUARMState *env, ARMMMUIdx mmu_idx, int ap) | 105 | @@ -XXX,XX +XXX,XX @@ for target in $target_list; do |
95 | * | 106 | config_target_mak=tests/tcg/config-$target.mak |
96 | * @env: CPUARMState | 107 | |
97 | * @s2ap: The 2-bit stage2 access permissions (S2AP) | 108 | echo "# Automatically generated by configure - do not modify" > $config_target_mak |
98 | - * @xn: XN (execute-never) bit | 109 | - echo "TARGET_NAME=$arch" >> $config_target_mak |
99 | + * @xn: XN (execute-never) bits | 110 | + echo "TARGET_NAME=$arch" >> "$config_target_mak" |
100 | + * @s1_is_el0: true if this is S2 of an S1+2 walk for EL0 | 111 | case $target in |
101 | */ | 112 | xtensa*-linux-user) |
102 | -static int get_S2prot(CPUARMState *env, int s2ap, int xn) | 113 | # the toolchain is not complete with headers, only build softmmu tests |
103 | +static int get_S2prot(CPUARMState *env, int s2ap, int xn, bool s1_is_el0) | 114 | continue |
104 | { | 115 | ;; |
105 | int prot = 0; | 116 | *-softmmu) |
106 | 117 | - test -f $source_path/tests/tcg/$arch/Makefile.softmmu-target || continue | |
107 | @@ -XXX,XX +XXX,XX @@ static int get_S2prot(CPUARMState *env, int s2ap, int xn) | 118 | + test -f "$source_path/tests/tcg/$arch/Makefile.softmmu-target" || continue |
108 | if (s2ap & 2) { | 119 | qemu="qemu-system-$arch" |
109 | prot |= PAGE_WRITE; | 120 | ;; |
110 | } | 121 | *-linux-user|*-bsd-user) |
111 | - if (!xn) { | 122 | @@ -XXX,XX +XXX,XX @@ for target in $target_list; do |
112 | - if (arm_el_is_aa64(env, 2) || prot & PAGE_READ) { | 123 | # compilers is a requirememt for adding a new test that needs a |
113 | + | 124 | # compiler feature. |
114 | + if (cpu_isar_feature(any_tts2uxn, env_archcpu(env))) { | 125 | |
115 | + switch (xn) { | 126 | - echo "BUILD_STATIC=$build_static" >> $config_target_mak |
116 | + case 0: | 127 | - write_target_makefile >> $config_target_mak |
117 | prot |= PAGE_EXEC; | 128 | + echo "BUILD_STATIC=$build_static" >> "$config_target_mak" |
118 | + break; | 129 | + write_target_makefile >> "$config_target_mak" |
119 | + case 1: | 130 | case $target in |
120 | + if (s1_is_el0) { | 131 | aarch64-*) |
121 | + prot |= PAGE_EXEC; | 132 | if do_compiler "$target_cc" $target_cflags \ |
122 | + } | 133 | -march=armv8.1-a+sve -o $TMPE $TMPC; then |
123 | + break; | 134 | - echo "CROSS_CC_HAS_SVE=y" >> $config_target_mak |
124 | + case 2: | 135 | + echo "CROSS_CC_HAS_SVE=y" >> "$config_target_mak" |
125 | + break; | 136 | fi |
126 | + case 3: | 137 | if do_compiler "$target_cc" $target_cflags \ |
127 | + if (!s1_is_el0) { | 138 | -march=armv8.1-a+sve2 -o $TMPE $TMPC; then |
128 | + prot |= PAGE_EXEC; | 139 | - echo "CROSS_CC_HAS_SVE2=y" >> $config_target_mak |
129 | + } | 140 | + echo "CROSS_CC_HAS_SVE2=y" >> "$config_target_mak" |
130 | + break; | 141 | fi |
131 | + default: | 142 | if do_compiler "$target_cc" $target_cflags \ |
132 | + g_assert_not_reached(); | 143 | -march=armv8.3-a -o $TMPE $TMPC; then |
133 | + } | 144 | - echo "CROSS_CC_HAS_ARMV8_3=y" >> $config_target_mak |
134 | + } else { | 145 | + echo "CROSS_CC_HAS_ARMV8_3=y" >> "$config_target_mak" |
135 | + if (!extract32(xn, 1, 1)) { | 146 | fi |
136 | + if (arm_el_is_aa64(env, 2) || prot & PAGE_READ) { | 147 | if do_compiler "$target_cc" $target_cflags \ |
137 | + prot |= PAGE_EXEC; | 148 | -mbranch-protection=standard -o $TMPE $TMPC; then |
138 | + } | 149 | - echo "CROSS_CC_HAS_ARMV8_BTI=y" >> $config_target_mak |
139 | } | 150 | + echo "CROSS_CC_HAS_ARMV8_BTI=y" >> "$config_target_mak" |
140 | } | 151 | fi |
141 | return prot; | 152 | if do_compiler "$target_cc" $target_cflags \ |
142 | @@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_lpae(CPUARMState *env, target_ulong address, | 153 | -march=armv8.5-a+memtag -o $TMPE $TMPC; then |
143 | } | 154 | - echo "CROSS_CC_HAS_ARMV8_MTE=y" >> $config_target_mak |
144 | 155 | + echo "CROSS_CC_HAS_ARMV8_MTE=y" >> "$config_target_mak" | |
145 | ap = extract32(attrs, 4, 2); | 156 | fi |
146 | - xn = extract32(attrs, 12, 1); | 157 | ;; |
147 | 158 | ppc*) | |
148 | if (mmu_idx == ARMMMUIdx_Stage2) { | 159 | if do_compiler "$target_cc" $target_cflags \ |
149 | ns = true; | 160 | -mpower8-vector -o $TMPE $TMPC; then |
150 | - *prot = get_S2prot(env, ap, xn); | 161 | - echo "CROSS_CC_HAS_POWER8_VECTOR=y" >> $config_target_mak |
151 | + xn = extract32(attrs, 11, 2); | 162 | + echo "CROSS_CC_HAS_POWER8_VECTOR=y" >> "$config_target_mak" |
152 | + *prot = get_S2prot(env, ap, xn, s1_is_el0); | 163 | fi |
153 | } else { | 164 | if do_compiler "$target_cc" $target_cflags \ |
154 | ns = extract32(attrs, 3, 1); | 165 | -mpower10 -o $TMPE $TMPC; then |
155 | + xn = extract32(attrs, 12, 1); | 166 | - echo "CROSS_CC_HAS_POWER10=y" >> $config_target_mak |
156 | pxn = extract32(attrs, 11, 1); | 167 | + echo "CROSS_CC_HAS_POWER10=y" >> "$config_target_mak" |
157 | *prot = get_S1prot(env, mmu_idx, aarch64, ap, ns, xn, pxn); | 168 | fi |
158 | } | 169 | ;; |
170 | i386-linux-user) | ||
171 | if do_compiler "$target_cc" $target_cflags \ | ||
172 | -Werror -fno-pie -o $TMPE $TMPC; then | ||
173 | - echo "CROSS_CC_HAS_I386_NOPIE=y" >> $config_target_mak | ||
174 | + echo "CROSS_CC_HAS_I386_NOPIE=y" >> "$config_target_mak" | ||
175 | fi | ||
176 | ;; | ||
177 | esac | ||
178 | elif test -n "$container_image"; then | ||
179 | echo "build-tcg-tests-$target: docker-image-$container_image" >> $makefile | ||
180 | - echo "BUILD_STATIC=y" >> $config_target_mak | ||
181 | - write_container_target_makefile >> $config_target_mak | ||
182 | + echo "BUILD_STATIC=y" >> "$config_target_mak" | ||
183 | + write_container_target_makefile >> "$config_target_mak" | ||
184 | case $target in | ||
185 | aarch64-*) | ||
186 | - echo "CROSS_CC_HAS_SVE=y" >> $config_target_mak | ||
187 | - echo "CROSS_CC_HAS_SVE2=y" >> $config_target_mak | ||
188 | - echo "CROSS_CC_HAS_ARMV8_3=y" >> $config_target_mak | ||
189 | - echo "CROSS_CC_HAS_ARMV8_BTI=y" >> $config_target_mak | ||
190 | - echo "CROSS_CC_HAS_ARMV8_MTE=y" >> $config_target_mak | ||
191 | + echo "CROSS_CC_HAS_SVE=y" >> "$config_target_mak" | ||
192 | + echo "CROSS_CC_HAS_SVE2=y" >> "$config_target_mak" | ||
193 | + echo "CROSS_CC_HAS_ARMV8_3=y" >> "$config_target_mak" | ||
194 | + echo "CROSS_CC_HAS_ARMV8_BTI=y" >> "$config_target_mak" | ||
195 | + echo "CROSS_CC_HAS_ARMV8_MTE=y" >> "$config_target_mak" | ||
196 | ;; | ||
197 | ppc*) | ||
198 | - echo "CROSS_CC_HAS_POWER8_VECTOR=y" >> $config_target_mak | ||
199 | - echo "CROSS_CC_HAS_POWER10=y" >> $config_target_mak | ||
200 | + echo "CROSS_CC_HAS_POWER8_VECTOR=y" >> "$config_target_mak" | ||
201 | + echo "CROSS_CC_HAS_POWER10=y" >> "$config_target_mak" | ||
202 | ;; | ||
203 | i386-linux-user) | ||
204 | - echo "CROSS_CC_HAS_I386_NOPIE=y" >> $config_target_mak | ||
205 | + echo "CROSS_CC_HAS_I386_NOPIE=y" >> "$config_target_mak" | ||
206 | ;; | ||
207 | esac | ||
208 | got_cross_cc=yes | ||
209 | fi | ||
210 | if test $got_cross_cc = yes; then | ||
211 | mkdir -p tests/tcg/$target | ||
212 | - echo "QEMU=$PWD/$qemu" >> $config_target_mak | ||
213 | + echo "QEMU=$PWD/$qemu" >> "$config_target_mak" | ||
214 | echo "run-tcg-tests-$target: $qemu\$(EXESUF)" >> $makefile | ||
215 | tcg_tests_targets="$tcg_tests_targets $target" | ||
216 | fi | ||
159 | -- | 217 | -- |
160 | 2.20.1 | 218 | 2.25.1 |
161 | 219 | ||
162 | 220 | diff view generated by jsdifflib |
1 | Convert the VFM[AS]L (vector) insns to decodetree. This is the last | 1 | Shellcheck warns that in |
---|---|---|---|
2 | insn in the legacy decoder for the 3same_ext group, so we can | 2 | rm -f */config-devices.mak.d |
3 | delete the legacy decoder function for the group entirely. | 3 | the glob might expand to something with a '-' in it, which would |
4 | 4 | then be misinterpreted as an option to rm. Fix this by adding './'. | |
5 | Note that in disas_thumb2_insn() the parts of this encoding space | ||
6 | where the decodetree decoder returns false will correctly be directed | ||
7 | to illegal_op by the "(insn & (1 << 28))" check so they won't fall | ||
8 | into disas_coproc_insn() by mistake. | ||
9 | 5 | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
11 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 7 | Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> |
12 | Message-id: 20200430181003.21682-8-peter.maydell@linaro.org | 8 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> |
9 | Message-id: 20220825150703.4074125-5-peter.maydell@linaro.org | ||
13 | --- | 10 | --- |
14 | target/arm/neon-shared.decode | 6 +++ | 11 | configure | 2 +- |
15 | target/arm/translate-neon.inc.c | 31 +++++++++++ | 12 | 1 file changed, 1 insertion(+), 1 deletion(-) |
16 | target/arm/translate.c | 92 +-------------------------------- | ||
17 | 3 files changed, 38 insertions(+), 91 deletions(-) | ||
18 | 13 | ||
19 | diff --git a/target/arm/neon-shared.decode b/target/arm/neon-shared.decode | 14 | diff --git a/configure b/configure |
20 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100755 |
21 | --- a/target/arm/neon-shared.decode | 16 | --- a/configure |
22 | +++ b/target/arm/neon-shared.decode | 17 | +++ b/configure |
23 | @@ -XXX,XX +XXX,XX @@ VCADD 1111 110 rot:1 1 . 0 size:1 .... .... 1000 . q:1 . 0 .... \ | 18 | @@ -XXX,XX +XXX,XX @@ exit 0 |
24 | # VUDOT and VSDOT | 19 | fi |
25 | VDOT 1111 110 00 . 10 .... .... 1101 . q:1 . u:1 .... \ | 20 | |
26 | vm=%vm_dp vn=%vn_dp vd=%vd_dp | 21 | # Remove old dependency files to make sure that they get properly regenerated |
27 | + | 22 | -rm -f */config-devices.mak.d |
28 | +# VFM[AS]L | 23 | +rm -f ./*/config-devices.mak.d |
29 | +VFML 1111 110 0 s:1 . 10 .... .... 1000 . 0 . 1 .... \ | 24 | |
30 | + vm=%vm_sp vn=%vn_sp vd=%vd_dp q=0 | 25 | if test -z "$python" |
31 | +VFML 1111 110 0 s:1 . 10 .... .... 1000 . 1 . 1 .... \ | 26 | then |
32 | + vm=%vm_dp vn=%vn_dp vd=%vd_dp q=1 | ||
33 | diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c | ||
34 | index XXXXXXX..XXXXXXX 100644 | ||
35 | --- a/target/arm/translate-neon.inc.c | ||
36 | +++ b/target/arm/translate-neon.inc.c | ||
37 | @@ -XXX,XX +XXX,XX @@ static bool trans_VDOT(DisasContext *s, arg_VDOT *a) | ||
38 | opr_sz, opr_sz, 0, fn_gvec); | ||
39 | return true; | ||
40 | } | ||
41 | + | ||
42 | +static bool trans_VFML(DisasContext *s, arg_VFML *a) | ||
43 | +{ | ||
44 | + int opr_sz; | ||
45 | + | ||
46 | + if (!dc_isar_feature(aa32_fhm, s)) { | ||
47 | + return false; | ||
48 | + } | ||
49 | + | ||
50 | + /* UNDEF accesses to D16-D31 if they don't exist. */ | ||
51 | + if (!dc_isar_feature(aa32_simd_r32, s) && | ||
52 | + (a->vd & 0x10)) { | ||
53 | + return false; | ||
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 | ||
74 | --- a/target/arm/translate.c | ||
75 | +++ b/target/arm/translate.c | ||
76 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) | ||
77 | return 0; | ||
78 | } | ||
79 | |||
80 | -/* Advanced SIMD three registers of the same length extension. | ||
81 | - * 31 25 23 22 20 16 12 11 10 9 8 3 0 | ||
82 | - * +---------------+-----+---+-----+----+----+---+----+---+----+---------+----+ | ||
83 | - * | 1 1 1 1 1 1 0 | op1 | D | op2 | Vn | Vd | 1 | o3 | 0 | o4 | N Q M U | Vm | | ||
84 | - * +---------------+-----+---+-----+----+----+---+----+---+----+---------+----+ | ||
85 | - */ | ||
86 | -static int disas_neon_insn_3same_ext(DisasContext *s, uint32_t insn) | ||
87 | -{ | ||
88 | - gen_helper_gvec_3 *fn_gvec = NULL; | ||
89 | - gen_helper_gvec_3_ptr *fn_gvec_ptr = NULL; | ||
90 | - int rd, rn, rm, opr_sz; | ||
91 | - int data = 0; | ||
92 | - int off_rn, off_rm; | ||
93 | - bool is_long = false, q = extract32(insn, 6, 1); | ||
94 | - bool ptr_is_env = false; | ||
95 | - | ||
96 | - if ((insn & 0xff300f10) == 0xfc200810) { | ||
97 | - /* VFM[AS]L -- 1111 1100 S.10 .... .... 1000 .Q.1 .... */ | ||
98 | - int is_s = extract32(insn, 23, 1); | ||
99 | - if (!dc_isar_feature(aa32_fhm, s)) { | ||
100 | - return 1; | ||
101 | - } | ||
102 | - is_long = true; | ||
103 | - data = is_s; /* is_2 == 0 */ | ||
104 | - fn_gvec_ptr = gen_helper_gvec_fmlal_a32; | ||
105 | - ptr_is_env = true; | ||
106 | - } else { | ||
107 | - return 1; | ||
108 | - } | ||
109 | - | ||
110 | - VFP_DREG_D(rd, insn); | ||
111 | - if (rd & q) { | ||
112 | - return 1; | ||
113 | - } | ||
114 | - if (q || !is_long) { | ||
115 | - VFP_DREG_N(rn, insn); | ||
116 | - VFP_DREG_M(rm, insn); | ||
117 | - if ((rn | rm) & q & !is_long) { | ||
118 | - return 1; | ||
119 | - } | ||
120 | - off_rn = vfp_reg_offset(1, rn); | ||
121 | - off_rm = vfp_reg_offset(1, rm); | ||
122 | - } else { | ||
123 | - rn = VFP_SREG_N(insn); | ||
124 | - rm = VFP_SREG_M(insn); | ||
125 | - off_rn = vfp_reg_offset(0, rn); | ||
126 | - off_rm = vfp_reg_offset(0, rm); | ||
127 | - } | ||
128 | - | ||
129 | - if (s->fp_excp_el) { | ||
130 | - gen_exception_insn(s, s->pc_curr, EXCP_UDEF, | ||
131 | - syn_simd_access_trap(1, 0xe, false), s->fp_excp_el); | ||
132 | - return 0; | ||
133 | - } | ||
134 | - if (!s->vfp_enabled) { | ||
135 | - return 1; | ||
136 | - } | ||
137 | - | ||
138 | - opr_sz = (1 + q) * 8; | ||
139 | - if (fn_gvec_ptr) { | ||
140 | - TCGv_ptr ptr; | ||
141 | - if (ptr_is_env) { | ||
142 | - ptr = cpu_env; | ||
143 | - } else { | ||
144 | - ptr = get_fpstatus_ptr(1); | ||
145 | - } | ||
146 | - tcg_gen_gvec_3_ptr(vfp_reg_offset(1, rd), off_rn, off_rm, ptr, | ||
147 | - opr_sz, opr_sz, data, fn_gvec_ptr); | ||
148 | - if (!ptr_is_env) { | ||
149 | - tcg_temp_free_ptr(ptr); | ||
150 | - } | ||
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 | -- | 27 | -- |
192 | 2.20.1 | 28 | 2.25.1 |
193 | 29 | ||
194 | 30 | diff view generated by jsdifflib |
1 | Convert the V[US]DOT (vector) insns to decodetree. | 1 | There's only one place in configure where we use `...` to execute a |
---|---|---|---|
2 | command and capture the result. Switch to $() to match the rest of | ||
3 | the script. This silences a shellcheck warning. | ||
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: Marc-André Lureau <marcandre.lureau@redhat.com> |
5 | Message-id: 20200430181003.21682-7-peter.maydell@linaro.org | 7 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> |
8 | Message-id: 20220825150703.4074125-6-peter.maydell@linaro.org | ||
6 | --- | 9 | --- |
7 | target/arm/neon-shared.decode | 4 ++++ | 10 | configure | 2 +- |
8 | target/arm/translate-neon.inc.c | 32 ++++++++++++++++++++++++++++++++ | 11 | 1 file changed, 1 insertion(+), 1 deletion(-) |
9 | target/arm/translate.c | 9 +-------- | ||
10 | 3 files changed, 37 insertions(+), 8 deletions(-) | ||
11 | 12 | ||
12 | diff --git a/target/arm/neon-shared.decode b/target/arm/neon-shared.decode | 13 | diff --git a/configure b/configure |
13 | index XXXXXXX..XXXXXXX 100644 | 14 | index XXXXXXX..XXXXXXX 100755 |
14 | --- a/target/arm/neon-shared.decode | 15 | --- a/configure |
15 | +++ b/target/arm/neon-shared.decode | 16 | +++ b/configure |
16 | @@ -XXX,XX +XXX,XX @@ VCMLA 1111 110 rot:2 . 1 size:1 .... .... 1000 . q:1 . 0 .... \ | 17 | @@ -XXX,XX +XXX,XX @@ LINKS="$LINKS python" |
17 | 18 | LINKS="$LINKS contrib/plugins/Makefile " | |
18 | VCADD 1111 110 rot:1 1 . 0 size:1 .... .... 1000 . q:1 . 0 .... \ | 19 | for f in $LINKS ; do |
19 | vm=%vm_dp vn=%vn_dp vd=%vd_dp | 20 | if [ -e "$source_path/$f" ]; then |
20 | + | 21 | - mkdir -p `dirname ./$f` |
21 | +# VUDOT and VSDOT | 22 | + mkdir -p "$(dirname ./"$f")" |
22 | +VDOT 1111 110 00 . 10 .... .... 1101 . q:1 . u:1 .... \ | 23 | symlink "$source_path/$f" "$f" |
23 | + vm=%vm_dp vn=%vn_dp vd=%vd_dp | 24 | fi |
24 | diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c | 25 | done |
25 | index XXXXXXX..XXXXXXX 100644 | ||
26 | --- a/target/arm/translate-neon.inc.c | ||
27 | +++ b/target/arm/translate-neon.inc.c | ||
28 | @@ -XXX,XX +XXX,XX @@ static bool trans_VCADD(DisasContext *s, arg_VCADD *a) | ||
29 | tcg_temp_free_ptr(fpst); | ||
30 | return true; | ||
31 | } | ||
32 | + | ||
33 | +static bool trans_VDOT(DisasContext *s, arg_VDOT *a) | ||
34 | +{ | ||
35 | + int opr_sz; | ||
36 | + gen_helper_gvec_3 *fn_gvec; | ||
37 | + | ||
38 | + if (!dc_isar_feature(aa32_dp, s)) { | ||
39 | + return false; | ||
40 | + } | ||
41 | + | ||
42 | + /* UNDEF accesses to D16-D31 if they don't exist. */ | ||
43 | + if (!dc_isar_feature(aa32_simd_r32, s) && | ||
44 | + ((a->vd | a->vn | a->vm) & 0x10)) { | ||
45 | + return false; | ||
46 | + } | ||
47 | + | ||
48 | + if ((a->vn | a->vm | a->vd) & a->q) { | ||
49 | + return false; | ||
50 | + } | ||
51 | + | ||
52 | + if (!vfp_access_check(s)) { | ||
53 | + return true; | ||
54 | + } | ||
55 | + | ||
56 | + opr_sz = (1 + a->q) * 8; | ||
57 | + fn_gvec = a->u ? gen_helper_gvec_udot_b : gen_helper_gvec_sdot_b; | ||
58 | + tcg_gen_gvec_3_ool(vfp_reg_offset(1, a->vd), | ||
59 | + vfp_reg_offset(1, a->vn), | ||
60 | + vfp_reg_offset(1, a->vm), | ||
61 | + opr_sz, opr_sz, 0, fn_gvec); | ||
62 | + return true; | ||
63 | +} | ||
64 | diff --git a/target/arm/translate.c b/target/arm/translate.c | ||
65 | index XXXXXXX..XXXXXXX 100644 | ||
66 | --- a/target/arm/translate.c | ||
67 | +++ b/target/arm/translate.c | ||
68 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_insn_3same_ext(DisasContext *s, uint32_t insn) | ||
69 | bool is_long = false, q = extract32(insn, 6, 1); | ||
70 | bool ptr_is_env = false; | ||
71 | |||
72 | - if ((insn & 0xfeb00f00) == 0xfc200d00) { | ||
73 | - /* V[US]DOT -- 1111 1100 0.10 .... .... 1101 .Q.U .... */ | ||
74 | - bool u = extract32(insn, 4, 1); | ||
75 | - if (!dc_isar_feature(aa32_dp, s)) { | ||
76 | - return 1; | ||
77 | - } | ||
78 | - fn_gvec = u ? gen_helper_gvec_udot_b : gen_helper_gvec_sdot_b; | ||
79 | - } else if ((insn & 0xff300f10) == 0xfc200810) { | ||
80 | + if ((insn & 0xff300f10) == 0xfc200810) { | ||
81 | /* VFM[AS]L -- 1111 1100 S.10 .... .... 1000 .Q.1 .... */ | ||
82 | int is_s = extract32(insn, 23, 1); | ||
83 | if (!dc_isar_feature(aa32_fhm, s)) { | ||
84 | -- | 26 | -- |
85 | 2.20.1 | 27 | 2.25.1 |
86 | 28 | ||
87 | 29 | diff view generated by jsdifflib |
1 | Convert the VCMLA (vector) insns in the 3same extension group to | 1 | Shellcheck warns that we have one place where we run a command and |
---|---|---|---|
2 | decodetree. | 2 | then check if it failed using $?; this is better written to simply |
3 | check the command in the 'if' statement directly. | ||
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: Marc-André Lureau <marcandre.lureau@redhat.com> |
6 | Message-id: 20200430181003.21682-5-peter.maydell@linaro.org | 7 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> |
8 | Message-id: 20220825150703.4074125-7-peter.maydell@linaro.org | ||
7 | --- | 9 | --- |
8 | target/arm/neon-shared.decode | 11 ++++++++++ | 10 | configure | 3 +-- |
9 | target/arm/translate-neon.inc.c | 37 +++++++++++++++++++++++++++++++++ | 11 | 1 file changed, 1 insertion(+), 2 deletions(-) |
10 | target/arm/translate.c | 11 +--------- | ||
11 | 3 files changed, 49 insertions(+), 10 deletions(-) | ||
12 | 12 | ||
13 | diff --git a/target/arm/neon-shared.decode b/target/arm/neon-shared.decode | 13 | diff --git a/configure b/configure |
14 | index XXXXXXX..XXXXXXX 100644 | 14 | index XXXXXXX..XXXXXXX 100755 |
15 | --- a/target/arm/neon-shared.decode | 15 | --- a/configure |
16 | +++ b/target/arm/neon-shared.decode | 16 | +++ b/configure |
17 | @@ -XXX,XX +XXX,XX @@ | 17 | @@ -XXX,XX +XXX,XX @@ fi |
18 | # More specifically, this covers: | 18 | # it when configure exits.) |
19 | # 2reg scalar ext: 0b1111_1110_xxxx_xxxx_xxxx_1x0x_xxxx_xxxx | 19 | TMPDIR1="config-temp" |
20 | # 3same ext: 0b1111_110x_xxxx_xxxx_xxxx_1x0x_xxxx_xxxx | 20 | rm -rf "${TMPDIR1}" |
21 | + | 21 | -mkdir -p "${TMPDIR1}" |
22 | +# VFP/Neon register fields; same as vfp.decode | 22 | -if [ $? -ne 0 ]; then |
23 | +%vm_dp 5:1 0:4 | 23 | +if ! mkdir -p "${TMPDIR1}"; then |
24 | +%vm_sp 0:4 5:1 | 24 | echo "ERROR: failed to create temporary directory" |
25 | +%vn_dp 7:1 16:4 | 25 | exit 1 |
26 | +%vn_sp 16:4 7:1 | 26 | fi |
27 | +%vd_dp 22:1 12:4 | ||
28 | +%vd_sp 12:4 22:1 | ||
29 | + | ||
30 | +VCMLA 1111 110 rot:2 . 1 size:1 .... .... 1000 . q:1 . 0 .... \ | ||
31 | + vm=%vm_dp vn=%vn_dp vd=%vd_dp | ||
32 | diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c | ||
33 | index XXXXXXX..XXXXXXX 100644 | ||
34 | --- a/target/arm/translate-neon.inc.c | ||
35 | +++ b/target/arm/translate-neon.inc.c | ||
36 | @@ -XXX,XX +XXX,XX @@ | ||
37 | #include "decode-neon-dp.inc.c" | ||
38 | #include "decode-neon-ls.inc.c" | ||
39 | #include "decode-neon-shared.inc.c" | ||
40 | + | ||
41 | +static bool trans_VCMLA(DisasContext *s, arg_VCMLA *a) | ||
42 | +{ | ||
43 | + int opr_sz; | ||
44 | + TCGv_ptr fpst; | ||
45 | + gen_helper_gvec_3_ptr *fn_gvec_ptr; | ||
46 | + | ||
47 | + if (!dc_isar_feature(aa32_vcma, s) | ||
48 | + || (!a->size && !dc_isar_feature(aa32_fp16_arith, s))) { | ||
49 | + return false; | ||
50 | + } | ||
51 | + | ||
52 | + /* UNDEF accesses to D16-D31 if they don't exist. */ | ||
53 | + if (!dc_isar_feature(aa32_simd_r32, s) && | ||
54 | + ((a->vd | a->vn | a->vm) & 0x10)) { | ||
55 | + return false; | ||
56 | + } | ||
57 | + | ||
58 | + if ((a->vn | a->vm | a->vd) & a->q) { | ||
59 | + return false; | ||
60 | + } | ||
61 | + | ||
62 | + if (!vfp_access_check(s)) { | ||
63 | + return true; | ||
64 | + } | ||
65 | + | ||
66 | + opr_sz = (1 + a->q) * 8; | ||
67 | + fpst = get_fpstatus_ptr(1); | ||
68 | + fn_gvec_ptr = a->size ? gen_helper_gvec_fcmlas : gen_helper_gvec_fcmlah; | ||
69 | + tcg_gen_gvec_3_ptr(vfp_reg_offset(1, a->vd), | ||
70 | + vfp_reg_offset(1, a->vn), | ||
71 | + vfp_reg_offset(1, a->vm), | ||
72 | + fpst, opr_sz, opr_sz, a->rot, | ||
73 | + fn_gvec_ptr); | ||
74 | + tcg_temp_free_ptr(fpst); | ||
75 | + return true; | ||
76 | +} | ||
77 | diff --git a/target/arm/translate.c b/target/arm/translate.c | ||
78 | index XXXXXXX..XXXXXXX 100644 | ||
79 | --- a/target/arm/translate.c | ||
80 | +++ b/target/arm/translate.c | ||
81 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_insn_3same_ext(DisasContext *s, uint32_t insn) | ||
82 | bool is_long = false, q = extract32(insn, 6, 1); | ||
83 | bool ptr_is_env = false; | ||
84 | |||
85 | - if ((insn & 0xfe200f10) == 0xfc200800) { | ||
86 | - /* VCMLA -- 1111 110R R.1S .... .... 1000 ...0 .... */ | ||
87 | - int size = extract32(insn, 20, 1); | ||
88 | - data = extract32(insn, 23, 2); /* rot */ | ||
89 | - if (!dc_isar_feature(aa32_vcma, s) | ||
90 | - || (!size && !dc_isar_feature(aa32_fp16_arith, s))) { | ||
91 | - return 1; | ||
92 | - } | ||
93 | - fn_gvec_ptr = size ? gen_helper_gvec_fcmlas : gen_helper_gvec_fcmlah; | ||
94 | - } else if ((insn & 0xfea00f10) == 0xfc800800) { | ||
95 | + if ((insn & 0xfea00f10) == 0xfc800800) { | ||
96 | /* VCADD -- 1111 110R 1.0S .... .... 1000 ...0 .... */ | ||
97 | int size = extract32(insn, 20, 1); | ||
98 | data = extract32(insn, 24, 1); /* rot */ | ||
99 | -- | 27 | -- |
100 | 2.20.1 | 28 | 2.25.1 |
101 | 29 | ||
102 | 30 | diff view generated by jsdifflib |
1 | We were accidentally permitting decode of Thumb Neon insns even if | 1 | We use the non-POSIX 'local' keyword in just two places in configure; |
---|---|---|---|
2 | the CPU didn't have the FEATURE_NEON bit set, because the feature | 2 | rewrite to avoid it. |
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 | In do_compiler(), just drop the 'local' keyword. The variable |
5 | Thumb decoder. Push the feature bit check down into the called | 5 | 'compiler' is only used elsewhere in the do_compiler_werror() |
6 | functions so it is done for both Arm and Thumb encodings. | 6 | function, which already uses the variable as a normal non-local one. |
7 | |||
8 | In probe_target_compiler(), $try and $t are both local; make them | ||
9 | normal variables and use a more obviously distinct variable name | ||
10 | for $t. | ||
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: Marc-André Lureau <marcandre.lureau@redhat.com> |
10 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 14 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> |
11 | Message-id: 20200430181003.21682-3-peter.maydell@linaro.org | 15 | Message-id: 20220825150703.4074125-8-peter.maydell@linaro.org |
12 | --- | 16 | --- |
13 | target/arm/translate.c | 16 ++++++++-------- | 17 | configure | 7 +++---- |
14 | 1 file changed, 8 insertions(+), 8 deletions(-) | 18 | 1 file changed, 3 insertions(+), 4 deletions(-) |
15 | 19 | ||
16 | diff --git a/target/arm/translate.c b/target/arm/translate.c | 20 | diff --git a/configure b/configure |
17 | index XXXXXXX..XXXXXXX 100644 | 21 | index XXXXXXX..XXXXXXX 100755 |
18 | --- a/target/arm/translate.c | 22 | --- a/configure |
19 | +++ b/target/arm/translate.c | 23 | +++ b/configure |
20 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_ls_insn(DisasContext *s, uint32_t insn) | 24 | @@ -XXX,XX +XXX,XX @@ error_exit() { |
21 | TCGv_i32 tmp2; | 25 | do_compiler() { |
22 | TCGv_i64 tmp64; | 26 | # Run the compiler, capturing its output to the log. First argument |
23 | 27 | # is compiler binary to execute. | |
24 | + if (!arm_dc_feature(s, ARM_FEATURE_NEON)) { | 28 | - local compiler="$1" |
25 | + return 1; | 29 | + compiler="$1" |
26 | + } | 30 | shift |
27 | + | 31 | if test -n "$BASH_VERSION"; then eval ' |
28 | /* FIXME: this access check should not take precedence over UNDEF | 32 | echo >>config.log " |
29 | * for invalid encodings; we will generate incorrect syndrome information | 33 | @@ -XXX,XX +XXX,XX @@ probe_target_compiler() { |
30 | * for attempts to execute invalid vfp/neon encodings with FP disabled. | 34 | : ${container_cross_strip:=${container_cross_prefix}strip} |
31 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) | 35 | done |
32 | TCGv_ptr ptr1, ptr2, ptr3; | 36 | |
33 | TCGv_i64 tmp64; | 37 | - local t try |
34 | 38 | try=cross | |
35 | + if (!arm_dc_feature(s, ARM_FEATURE_NEON)) { | 39 | case "$target_arch:$cpu" in |
36 | + return 1; | 40 | aarch64_be:aarch64 | \ |
37 | + } | 41 | @@ -XXX,XX +XXX,XX @@ probe_target_compiler() { |
38 | + | 42 | try='native cross' ;; |
39 | /* FIXME: this access check should not take precedence over UNDEF | 43 | esac |
40 | * for invalid encodings; we will generate incorrect syndrome information | 44 | eval "target_cflags=\${cross_cc_cflags_$target_arch}" |
41 | * for attempts to execute invalid vfp/neon encodings with FP disabled. | 45 | - for t in $try; do |
42 | @@ -XXX,XX +XXX,XX @@ static void disas_arm_insn(DisasContext *s, unsigned int insn) | 46 | - case $t in |
43 | 47 | + for thistry in $try; do | |
44 | if (((insn >> 25) & 7) == 1) { | 48 | + case $thistry in |
45 | /* NEON Data processing. */ | 49 | native) |
46 | - if (!arm_dc_feature(s, ARM_FEATURE_NEON)) { | 50 | target_cc=$cc |
47 | - goto illegal_op; | 51 | target_ccas=$ccas |
48 | - } | ||
49 | - | ||
50 | if (disas_neon_data_insn(s, insn)) { | ||
51 | goto illegal_op; | ||
52 | } | ||
53 | @@ -XXX,XX +XXX,XX @@ static void disas_arm_insn(DisasContext *s, unsigned int insn) | ||
54 | } | ||
55 | if ((insn & 0x0f100000) == 0x04000000) { | ||
56 | /* NEON load/store. */ | ||
57 | - if (!arm_dc_feature(s, ARM_FEATURE_NEON)) { | ||
58 | - goto illegal_op; | ||
59 | - } | ||
60 | - | ||
61 | if (disas_neon_ls_insn(s, insn)) { | ||
62 | goto illegal_op; | ||
63 | } | ||
64 | -- | 52 | -- |
65 | 2.20.1 | 53 | 2.25.1 |
66 | 54 | ||
67 | 55 | diff view generated by jsdifflib |