1 | Most of this is the Neon decodetree patches, followed by Edgar's versal cleanups. | 1 | Hi; here's the latest target-arm queue. Mostly this is refactoring |
---|---|---|---|
2 | and cleanup type patches. | ||
2 | 3 | ||
3 | thanks | 4 | thanks |
4 | -- PMM | 5 | -- PMM |
5 | 6 | ||
7 | The following changes since commit c60be6e3e38cb36dc66129e757ec4b34152232be: | ||
6 | 8 | ||
7 | The following changes since commit 2ef486e76d64436be90f7359a3071fb2a56ce835: | 9 | Merge tag 'pull-sp-20231025' of https://gitlab.com/rth7680/qemu into staging (2023-10-27 09:43:53 +0900) |
8 | |||
9 | Merge remote-tracking branch 'remotes/marcel/tags/rdma-pull-request' into staging (2020-05-03 14:12:56 +0100) | ||
10 | 10 | ||
11 | are available in the Git repository at: | 11 | are available in the Git repository at: |
12 | 12 | ||
13 | https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20200504 | 13 | https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20231027 |
14 | 14 | ||
15 | for you to fetch changes up to 9aefc6cf9b73f66062d2f914a0136756e7a28211: | 15 | for you to fetch changes up to df93de987f423a0ed918c425f5dbd9a25d3c6229: |
16 | 16 | ||
17 | target/arm: Move gen_ function typedefs to translate.h (2020-05-04 12:59:26 +0100) | 17 | hw/net/cadence_gem: enforce 32 bits variable size for CRC (2023-10-27 15:27:06 +0100) |
18 | 18 | ||
19 | ---------------------------------------------------------------- | 19 | ---------------------------------------------------------------- |
20 | target-arm queue: | 20 | target-arm queue: |
21 | * Start of conversion of Neon insns to decodetree | 21 | * Correct minor errors in Cortex-A710 definition |
22 | * versal board: support SD and RTC | 22 | * Implement Neoverse N2 CPU model |
23 | * Implement ARMv8.2-TTS2UXN | 23 | * Refactor feature test functions out into separate header |
24 | * Make VQDMULL undefined when U=1 | 24 | * Fix syndrome for FGT traps on ERET |
25 | * Some minor code cleanups | 25 | * Remove 'hw/arm/boot.h' includes from various header files |
26 | * pxa2xx: Refactoring/cleanup | ||
27 | * Avoid using 'first_cpu' when first ARM CPU is reachable | ||
28 | * misc/led: LED state is set opposite of what is expected | ||
29 | * hw/net/cadence_gen: clean up to use FIELD macros | ||
30 | * hw/net/cadence_gem: perform PHY access on write only | ||
31 | * hw/net/cadence_gem: enforce 32 bits variable size for CRC | ||
26 | 32 | ||
27 | ---------------------------------------------------------------- | 33 | ---------------------------------------------------------------- |
28 | Edgar E. Iglesias (11): | 34 | Glenn Miles (1): |
29 | hw/arm: versal: Remove inclusion of arm_gicv3_common.h | 35 | misc/led: LED state is set opposite of what is expected |
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 | 36 | ||
41 | Fredrik Strupe (1): | 37 | Luc Michel (11): |
42 | target/arm: Make VQDMULL undefined when U=1 | 38 | hw/net/cadence_gem: use REG32 macro for register definitions |
39 | hw/net/cadence_gem: use FIELD for screening registers | ||
40 | hw/net/cadence_gem: use FIELD to describe NWCTRL register fields | ||
41 | hw/net/cadence_gem: use FIELD to describe NWCFG register fields | ||
42 | hw/net/cadence_gem: use FIELD to describe DMACFG register fields | ||
43 | hw/net/cadence_gem: use FIELD to describe [TX|RX]STATUS register fields | ||
44 | hw/net/cadence_gem: use FIELD to describe IRQ register fields | ||
45 | hw/net/cadence_gem: use FIELD to describe DESCONF6 register fields | ||
46 | hw/net/cadence_gem: use FIELD to describe PHYMNTNC register fields | ||
47 | hw/net/cadence_gem: perform PHY access on write only | ||
48 | hw/net/cadence_gem: enforce 32 bits variable size for CRC | ||
43 | 49 | ||
44 | Peter Maydell (25): | 50 | Peter Maydell (9): |
45 | target/arm: Don't use a TLB for ARMMMUIdx_Stage2 | 51 | target/arm: Correct minor errors in Cortex-A710 definition |
46 | target/arm: Use enum constant in get_phys_addr_lpae() call | 52 | target/arm: Implement Neoverse N2 CPU model |
47 | target/arm: Add new 's1_is_el0' argument to get_phys_addr_lpae() | 53 | target/arm: Move feature test functions to their own header |
48 | target/arm: Implement ARMv8.2-TTS2UXN | 54 | target/arm: Move ID_AA64MMFR1 and ID_AA64MMFR2 tests together |
49 | target/arm: Use correct variable for setting 'max' cpu's ID_AA64DFR0 | 55 | target/arm: Move ID_AA64MMFR0 tests up to before MMFR1 and MMFR2 |
50 | target/arm/translate-vfp.inc.c: Remove duplicate simd_r32 check | 56 | target/arm: Move ID_AA64ISAR* test functions together |
51 | target/arm: Don't allow Thumb Neon insns without FEATURE_NEON | 57 | target/arm: Move ID_AA64PFR* tests together |
52 | target/arm: Add stubs for AArch32 Neon decodetree | 58 | target/arm: Move ID_AA64DFR* feature tests together |
53 | target/arm: Convert VCMLA (vector) to decodetree | 59 | target/arm: Fix syndrome for FGT traps on ERET |
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 | 60 | ||
71 | Philippe Mathieu-Daudé (2): | 61 | Philippe Mathieu-Daudé (20): |
72 | hw/arm/mps2-tz: Use TYPE_IOTKIT instead of hardcoded string | 62 | hw/arm/allwinner-a10: Remove 'hw/arm/boot.h' from header |
73 | target/arm: Use uint64_t for midr field in CPU state struct | 63 | hw/arm/allwinner-h3: Remove 'hw/arm/boot.h' from header |
64 | hw/arm/allwinner-r40: Remove 'hw/arm/boot.h' from header | ||
65 | hw/arm/fsl-imx25: Remove 'hw/arm/boot.h' from header | ||
66 | hw/arm/fsl-imx31: Remove 'hw/arm/boot.h' from header | ||
67 | hw/arm/fsl-imx6: Remove 'hw/arm/boot.h' from header | ||
68 | hw/arm/fsl-imx6ul: Remove 'hw/arm/boot.h' from header | ||
69 | hw/arm/fsl-imx7: Remove 'hw/arm/boot.h' from header | ||
70 | hw/arm/xlnx-versal: Remove 'hw/arm/boot.h' from header | ||
71 | hw/arm/xlnx-zynqmp: Remove 'hw/arm/boot.h' from header | ||
72 | hw/sd/pxa2xx: Realize sysbus device before accessing it | ||
73 | hw/sd/pxa2xx: Do not open-code sysbus_create_simple() | ||
74 | hw/pcmcia/pxa2xx: Realize sysbus device before accessing it | ||
75 | hw/pcmcia/pxa2xx: Do not open-code sysbus_create_simple() | ||
76 | hw/pcmcia/pxa2xx: Inline pxa2xx_pcmcia_init() | ||
77 | hw/intc/pxa2xx: Convert to Resettable interface | ||
78 | hw/intc/pxa2xx: Pass CPU reference using QOM link property | ||
79 | hw/intc/pxa2xx: Factor pxa2xx_pic_realize() out of pxa2xx_pic_init() | ||
80 | hw/arm/pxa2xx: Realize PXA2XX_I2C device before accessing it | ||
81 | hw/arm: Avoid using 'first_cpu' when first ARM CPU is reachable | ||
74 | 82 | ||
75 | include/hw/arm/xlnx-versal.h | 31 +- | 83 | docs/system/arm/virt.rst | 1 + |
76 | target/arm/cpu-param.h | 2 +- | 84 | bsd-user/arm/target_arch.h | 1 + |
77 | target/arm/cpu.h | 38 ++- | 85 | include/hw/arm/allwinner-a10.h | 1 - |
78 | target/arm/translate-a64.h | 9 - | 86 | include/hw/arm/allwinner-h3.h | 1 - |
79 | target/arm/translate.h | 26 ++ | 87 | include/hw/arm/allwinner-r40.h | 1 - |
80 | target/arm/neon-dp.decode | 86 +++++ | 88 | include/hw/arm/fsl-imx25.h | 1 - |
81 | target/arm/neon-ls.decode | 52 +++ | 89 | include/hw/arm/fsl-imx31.h | 1 - |
82 | target/arm/neon-shared.decode | 66 ++++ | 90 | include/hw/arm/fsl-imx6.h | 1 - |
83 | hw/arm/mps2-tz.c | 2 +- | 91 | include/hw/arm/fsl-imx6ul.h | 1 - |
84 | hw/arm/xlnx-versal-virt.c | 74 ++++- | 92 | include/hw/arm/fsl-imx7.h | 1 - |
85 | hw/arm/xlnx-versal.c | 115 +++++-- | 93 | include/hw/arm/pxa.h | 2 - |
86 | target/arm/cpu.c | 3 +- | 94 | include/hw/arm/xlnx-versal.h | 1 - |
87 | target/arm/cpu64.c | 8 +- | 95 | include/hw/arm/xlnx-zynqmp.h | 1 - |
88 | target/arm/helper.c | 183 ++++------ | 96 | linux-user/aarch64/target_prctl.h | 2 + |
89 | target/arm/translate-a64.c | 17 - | 97 | target/arm/cpu-features.h | 994 ++++++++++++++++++++++++++++++++++++++ |
90 | target/arm/translate-neon.inc.c | 714 +++++++++++++++++++++++++++++++++++++++ | 98 | target/arm/cpu.h | 971 ------------------------------------- |
91 | target/arm/translate-vfp.inc.c | 6 - | 99 | target/arm/internals.h | 1 + |
92 | target/arm/translate.c | 716 +++------------------------------------- | 100 | target/arm/tcg/translate.h | 2 +- |
93 | target/arm/Makefile.objs | 18 + | 101 | hw/arm/armv7m.c | 1 + |
94 | 19 files changed, 1302 insertions(+), 864 deletions(-) | 102 | hw/arm/bananapi_m2u.c | 3 +- |
95 | create mode 100644 target/arm/neon-dp.decode | 103 | hw/arm/cubieboard.c | 1 + |
96 | create mode 100644 target/arm/neon-ls.decode | 104 | hw/arm/exynos4_boards.c | 7 +- |
97 | create mode 100644 target/arm/neon-shared.decode | 105 | hw/arm/imx25_pdk.c | 1 + |
98 | create mode 100644 target/arm/translate-neon.inc.c | 106 | hw/arm/kzm.c | 1 + |
107 | hw/arm/mcimx6ul-evk.c | 1 + | ||
108 | hw/arm/mcimx7d-sabre.c | 1 + | ||
109 | hw/arm/orangepi.c | 3 +- | ||
110 | hw/arm/pxa2xx.c | 17 +- | ||
111 | hw/arm/pxa2xx_pic.c | 38 +- | ||
112 | hw/arm/realview.c | 2 +- | ||
113 | hw/arm/sabrelite.c | 1 + | ||
114 | hw/arm/sbsa-ref.c | 1 + | ||
115 | hw/arm/virt.c | 1 + | ||
116 | hw/arm/xilinx_zynq.c | 2 +- | ||
117 | hw/arm/xlnx-versal-virt.c | 1 + | ||
118 | hw/arm/xlnx-zcu102.c | 1 + | ||
119 | hw/intc/armv7m_nvic.c | 1 + | ||
120 | hw/misc/led.c | 2 +- | ||
121 | hw/net/cadence_gem.c | 884 ++++++++++++++++++--------------- | ||
122 | hw/pcmcia/pxa2xx.c | 15 - | ||
123 | hw/sd/pxa2xx_mmci.c | 7 +- | ||
124 | linux-user/aarch64/cpu_loop.c | 1 + | ||
125 | linux-user/aarch64/signal.c | 1 + | ||
126 | linux-user/arm/signal.c | 1 + | ||
127 | linux-user/elfload.c | 4 + | ||
128 | linux-user/mmap.c | 4 + | ||
129 | target/arm/arch_dump.c | 1 + | ||
130 | target/arm/cpu.c | 1 + | ||
131 | target/arm/cpu64.c | 1 + | ||
132 | target/arm/debug_helper.c | 1 + | ||
133 | target/arm/gdbstub.c | 1 + | ||
134 | target/arm/helper.c | 1 + | ||
135 | target/arm/kvm64.c | 1 + | ||
136 | target/arm/machine.c | 1 + | ||
137 | target/arm/ptw.c | 1 + | ||
138 | target/arm/tcg/cpu64.c | 115 ++++- | ||
139 | target/arm/tcg/hflags.c | 1 + | ||
140 | target/arm/tcg/m_helper.c | 1 + | ||
141 | target/arm/tcg/op_helper.c | 1 + | ||
142 | target/arm/tcg/pauth_helper.c | 1 + | ||
143 | target/arm/tcg/tlb_helper.c | 1 + | ||
144 | target/arm/tcg/translate-a64.c | 4 +- | ||
145 | target/arm/vfp_helper.c | 1 + | ||
146 | 63 files changed, 1702 insertions(+), 1419 deletions(-) | ||
147 | create mode 100644 target/arm/cpu-features.h | ||
99 | 148 | diff view generated by jsdifflib |
1 | We're going to want at least some of the NeonGen* typedefs | 1 | Correct a couple of minor errors in the Cortex-A710 definition: |
---|---|---|---|
2 | for the refactored 32-bit Neon decoder, so move them all | 2 | * ID_AA64DFR0_EL1.DebugVer is 9 (indicating Armv8.4 debug architecture) |
3 | to translate.h since it makes more sense to keep them in | 3 | * ID_AA64ISAR1_EL1.APA is 5 (indicating more PAuth support) |
4 | one group. | 4 | * there is an IMPDEF CPUCFR_EL1, like that on the Neoverse-N1 |
5 | 5 | ||
6 | Fixes: e3d45c0a89576 ("target/arm: Implement cortex-a710") | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
7 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 8 | Tested-by: Marcin Juszkiewicz <marcin.juszkiewicz@linaro.org> |
8 | Message-id: 20200430181003.21682-23-peter.maydell@linaro.org | 9 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> |
10 | Message-id: 20230915185453.1871167-2-peter.maydell@linaro.org | ||
9 | --- | 11 | --- |
10 | target/arm/translate.h | 17 +++++++++++++++++ | 12 | target/arm/tcg/cpu64.c | 11 +++++++++-- |
11 | target/arm/translate-a64.c | 17 ----------------- | 13 | 1 file changed, 9 insertions(+), 2 deletions(-) |
12 | 2 files changed, 17 insertions(+), 17 deletions(-) | ||
13 | 14 | ||
14 | diff --git a/target/arm/translate.h b/target/arm/translate.h | 15 | diff --git a/target/arm/tcg/cpu64.c b/target/arm/tcg/cpu64.c |
15 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/target/arm/translate.h | 17 | --- a/target/arm/tcg/cpu64.c |
17 | +++ b/target/arm/translate.h | 18 | +++ b/target/arm/tcg/cpu64.c |
18 | @@ -XXX,XX +XXX,XX @@ typedef void GVecGen3Fn(unsigned, uint32_t, uint32_t, | 19 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo cortex_a710_cp_reginfo[] = { |
19 | typedef void GVecGen4Fn(unsigned, uint32_t, uint32_t, uint32_t, | 20 | { .name = "CPUPFR_EL3", .state = ARM_CP_STATE_AA64, |
20 | uint32_t, uint32_t, uint32_t); | 21 | .opc0 = 3, .opc1 = 6, .crn = 15, .crm = 8, .opc2 = 6, |
21 | 22 | .access = PL3_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, | |
22 | +/* Function prototype for gen_ functions for calling Neon helpers */ | 23 | + /* |
23 | +typedef void NeonGenOneOpEnvFn(TCGv_i32, TCGv_ptr, TCGv_i32); | 24 | + * Report CPUCFR_EL1.SCU as 1, as we do not implement the DSU |
24 | +typedef void NeonGenTwoOpFn(TCGv_i32, TCGv_i32, TCGv_i32); | 25 | + * (and in particular its system registers). |
25 | +typedef void NeonGenTwoOpEnvFn(TCGv_i32, TCGv_ptr, TCGv_i32, TCGv_i32); | 26 | + */ |
26 | +typedef void NeonGenTwo64OpFn(TCGv_i64, TCGv_i64, TCGv_i64); | 27 | + { .name = "CPUCFR_EL1", .state = ARM_CP_STATE_AA64, |
27 | +typedef void NeonGenTwo64OpEnvFn(TCGv_i64, TCGv_ptr, TCGv_i64, TCGv_i64); | 28 | + .opc0 = 3, .opc1 = 0, .crn = 15, .crm = 0, .opc2 = 0, |
28 | +typedef void NeonGenNarrowFn(TCGv_i32, TCGv_i64); | 29 | + .access = PL1_R, .type = ARM_CP_CONST, .resetvalue = 4 }, |
29 | +typedef void NeonGenNarrowEnvFn(TCGv_i32, TCGv_ptr, TCGv_i64); | 30 | |
30 | +typedef void NeonGenWidenFn(TCGv_i64, TCGv_i32); | 31 | /* |
31 | +typedef void NeonGenTwoSingleOPFn(TCGv_i32, TCGv_i32, TCGv_i32, TCGv_ptr); | 32 | * Stub RAMINDEX, as we don't actually implement caches, BTB, |
32 | +typedef void NeonGenTwoDoubleOPFn(TCGv_i64, TCGv_i64, TCGv_i64, TCGv_ptr); | 33 | @@ -XXX,XX +XXX,XX @@ static void aarch64_a710_initfn(Object *obj) |
33 | +typedef void NeonGenOneOpFn(TCGv_i64, TCGv_i64); | 34 | cpu->isar.id_aa64pfr0 = 0x1201111120111112ull; /* GIC filled in later */ |
34 | +typedef void CryptoTwoOpFn(TCGv_ptr, TCGv_ptr); | 35 | cpu->isar.id_aa64pfr1 = 0x0000000000000221ull; |
35 | +typedef void CryptoThreeOpIntFn(TCGv_ptr, TCGv_ptr, TCGv_i32); | 36 | cpu->isar.id_aa64zfr0 = 0x0000110100110021ull; /* with Crypto */ |
36 | +typedef void CryptoThreeOpFn(TCGv_ptr, TCGv_ptr, TCGv_ptr); | 37 | - cpu->isar.id_aa64dfr0 = 0x000011f010305611ull; |
37 | +typedef void AtomicThreeOpFn(TCGv_i64, TCGv_i64, TCGv_i64, TCGArg, MemOp); | 38 | + cpu->isar.id_aa64dfr0 = 0x000011f010305619ull; |
38 | + | 39 | cpu->isar.id_aa64dfr1 = 0; |
39 | #endif /* TARGET_ARM_TRANSLATE_H */ | 40 | cpu->id_aa64afr0 = 0; |
40 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c | 41 | cpu->id_aa64afr1 = 0; |
41 | index XXXXXXX..XXXXXXX 100644 | 42 | cpu->isar.id_aa64isar0 = 0x0221111110212120ull; /* with Crypto */ |
42 | --- a/target/arm/translate-a64.c | 43 | - cpu->isar.id_aa64isar1 = 0x0010111101211032ull; |
43 | +++ b/target/arm/translate-a64.c | 44 | + cpu->isar.id_aa64isar1 = 0x0010111101211052ull; |
44 | @@ -XXX,XX +XXX,XX @@ typedef struct AArch64DecodeTable { | 45 | cpu->isar.id_aa64mmfr0 = 0x0000022200101122ull; |
45 | AArch64DecodeFn *disas_fn; | 46 | cpu->isar.id_aa64mmfr1 = 0x0000000010212122ull; |
46 | } AArch64DecodeTable; | 47 | cpu->isar.id_aa64mmfr2 = 0x1221011110101011ull; |
47 | |||
48 | -/* Function prototype for gen_ functions for calling Neon helpers */ | ||
49 | -typedef void NeonGenOneOpEnvFn(TCGv_i32, TCGv_ptr, TCGv_i32); | ||
50 | -typedef void NeonGenTwoOpFn(TCGv_i32, TCGv_i32, TCGv_i32); | ||
51 | -typedef void NeonGenTwoOpEnvFn(TCGv_i32, TCGv_ptr, TCGv_i32, TCGv_i32); | ||
52 | -typedef void NeonGenTwo64OpFn(TCGv_i64, TCGv_i64, TCGv_i64); | ||
53 | -typedef void NeonGenTwo64OpEnvFn(TCGv_i64, TCGv_ptr, TCGv_i64, TCGv_i64); | ||
54 | -typedef void NeonGenNarrowFn(TCGv_i32, TCGv_i64); | ||
55 | -typedef void NeonGenNarrowEnvFn(TCGv_i32, TCGv_ptr, TCGv_i64); | ||
56 | -typedef void NeonGenWidenFn(TCGv_i64, TCGv_i32); | ||
57 | -typedef void NeonGenTwoSingleOPFn(TCGv_i32, TCGv_i32, TCGv_i32, TCGv_ptr); | ||
58 | -typedef void NeonGenTwoDoubleOPFn(TCGv_i64, TCGv_i64, TCGv_i64, TCGv_ptr); | ||
59 | -typedef void NeonGenOneOpFn(TCGv_i64, TCGv_i64); | ||
60 | -typedef void CryptoTwoOpFn(TCGv_ptr, TCGv_ptr); | ||
61 | -typedef void CryptoThreeOpIntFn(TCGv_ptr, TCGv_ptr, TCGv_i32); | ||
62 | -typedef void CryptoThreeOpFn(TCGv_ptr, TCGv_ptr, TCGv_ptr); | ||
63 | -typedef void AtomicThreeOpFn(TCGv_i64, TCGv_i64, TCGv_i64, TCGArg, MemOp); | ||
64 | - | ||
65 | /* initialize TCG globals. */ | ||
66 | void a64_translate_init(void) | ||
67 | { | ||
68 | -- | 48 | -- |
69 | 2.20.1 | 49 | 2.34.1 |
70 | 50 | ||
71 | 51 | diff view generated by jsdifflib |
1 | Convert the Neon "load single structure to all lanes" insns to | 1 | Implement a model of the Neoverse N2 CPU. This is an Armv9.0-A |
---|---|---|---|
2 | decodetree. | 2 | processor very similar to the Cortex-A710. The differences are: |
3 | * no FEAT_EVT | ||
4 | * FEAT_DGH (data gathering hint) | ||
5 | * FEAT_NV (not yet implemented in QEMU) | ||
6 | * Statistical Profiling Extension (not implemented in QEMU) | ||
7 | * 48 bit physical address range, not 40 | ||
8 | * CTR_EL0.DIC = 1 (no explicit icache cleaning needed) | ||
9 | * PMCR_EL0.N = 6 (always 6 PMU counters, not 20) | ||
10 | |||
11 | Because it has 48-bit physical address support, we can use | ||
12 | this CPU in the sbsa-ref board as well as the virt board. | ||
3 | 13 | ||
4 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 14 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
5 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 15 | Tested-by: Marcin Juszkiewicz <marcin.juszkiewicz@linaro.org> |
6 | Message-id: 20200430181003.21682-13-peter.maydell@linaro.org | 16 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> |
17 | Message-id: 20230915185453.1871167-3-peter.maydell@linaro.org | ||
7 | --- | 18 | --- |
8 | target/arm/neon-ls.decode | 5 +++ | 19 | docs/system/arm/virt.rst | 1 + |
9 | target/arm/translate-neon.inc.c | 73 +++++++++++++++++++++++++++++++++ | 20 | hw/arm/sbsa-ref.c | 1 + |
10 | target/arm/translate.c | 55 +------------------------ | 21 | hw/arm/virt.c | 1 + |
11 | 3 files changed, 80 insertions(+), 53 deletions(-) | 22 | target/arm/tcg/cpu64.c | 103 +++++++++++++++++++++++++++++++++++++++ |
23 | 4 files changed, 106 insertions(+) | ||
12 | 24 | ||
13 | diff --git a/target/arm/neon-ls.decode b/target/arm/neon-ls.decode | 25 | diff --git a/docs/system/arm/virt.rst b/docs/system/arm/virt.rst |
14 | index XXXXXXX..XXXXXXX 100644 | 26 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/target/arm/neon-ls.decode | 27 | --- a/docs/system/arm/virt.rst |
16 | +++ b/target/arm/neon-ls.decode | 28 | +++ b/docs/system/arm/virt.rst |
17 | @@ -XXX,XX +XXX,XX @@ | 29 | @@ -XXX,XX +XXX,XX @@ Supported guest CPU types: |
18 | 30 | - ``host`` (with KVM only) | |
19 | VLDST_multiple 1111 0100 0 . l:1 0 rn:4 .... itype:4 size:2 align:2 rm:4 \ | 31 | - ``neoverse-n1`` (64-bit) |
20 | vd=%vd_dp | 32 | - ``neoverse-v1`` (64-bit) |
33 | +- ``neoverse-n2`` (64-bit) | ||
34 | - ``max`` (same as ``host`` for KVM; best possible emulation with TCG) | ||
35 | |||
36 | Note that the default is ``cortex-a15``, so for an AArch64 guest you must | ||
37 | diff --git a/hw/arm/sbsa-ref.c b/hw/arm/sbsa-ref.c | ||
38 | index XXXXXXX..XXXXXXX 100644 | ||
39 | --- a/hw/arm/sbsa-ref.c | ||
40 | +++ b/hw/arm/sbsa-ref.c | ||
41 | @@ -XXX,XX +XXX,XX @@ static const char * const valid_cpus[] = { | ||
42 | ARM_CPU_TYPE_NAME("cortex-a72"), | ||
43 | ARM_CPU_TYPE_NAME("neoverse-n1"), | ||
44 | ARM_CPU_TYPE_NAME("neoverse-v1"), | ||
45 | + ARM_CPU_TYPE_NAME("neoverse-n2"), | ||
46 | ARM_CPU_TYPE_NAME("max"), | ||
47 | }; | ||
48 | |||
49 | diff --git a/hw/arm/virt.c b/hw/arm/virt.c | ||
50 | index XXXXXXX..XXXXXXX 100644 | ||
51 | --- a/hw/arm/virt.c | ||
52 | +++ b/hw/arm/virt.c | ||
53 | @@ -XXX,XX +XXX,XX @@ static const char *valid_cpus[] = { | ||
54 | ARM_CPU_TYPE_NAME("a64fx"), | ||
55 | ARM_CPU_TYPE_NAME("neoverse-n1"), | ||
56 | ARM_CPU_TYPE_NAME("neoverse-v1"), | ||
57 | + ARM_CPU_TYPE_NAME("neoverse-n2"), | ||
58 | #endif | ||
59 | ARM_CPU_TYPE_NAME("cortex-a53"), | ||
60 | ARM_CPU_TYPE_NAME("cortex-a57"), | ||
61 | diff --git a/target/arm/tcg/cpu64.c b/target/arm/tcg/cpu64.c | ||
62 | index XXXXXXX..XXXXXXX 100644 | ||
63 | --- a/target/arm/tcg/cpu64.c | ||
64 | +++ b/target/arm/tcg/cpu64.c | ||
65 | @@ -XXX,XX +XXX,XX @@ static void aarch64_a710_initfn(Object *obj) | ||
66 | aarch64_add_sve_properties(obj); | ||
67 | } | ||
68 | |||
69 | +/* Extra IMPDEF regs in the N2 beyond those in the A710 */ | ||
70 | +static const ARMCPRegInfo neoverse_n2_cp_reginfo[] = { | ||
71 | + { .name = "CPURNDBR_EL3", .state = ARM_CP_STATE_AA64, | ||
72 | + .opc0 = 3, .opc1 = 6, .crn = 15, .crm = 3, .opc2 = 0, | ||
73 | + .access = PL3_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
74 | + { .name = "CPURNDPEID_EL3", .state = ARM_CP_STATE_AA64, | ||
75 | + .opc0 = 3, .opc1 = 6, .crn = 15, .crm = 3, .opc2 = 1, | ||
76 | + .access = PL3_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
77 | +}; | ||
21 | + | 78 | + |
22 | +# Neon load single element to all lanes | 79 | +static void aarch64_neoverse_n2_initfn(Object *obj) |
80 | +{ | ||
81 | + ARMCPU *cpu = ARM_CPU(obj); | ||
23 | + | 82 | + |
24 | +VLD_all_lanes 1111 0100 1 . 1 0 rn:4 .... 11 n:2 size:2 t:1 a:1 rm:4 \ | 83 | + cpu->dtb_compatible = "arm,neoverse-n2"; |
25 | + vd=%vd_dp | 84 | + set_feature(&cpu->env, ARM_FEATURE_V8); |
26 | diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c | 85 | + set_feature(&cpu->env, ARM_FEATURE_NEON); |
27 | index XXXXXXX..XXXXXXX 100644 | 86 | + set_feature(&cpu->env, ARM_FEATURE_GENERIC_TIMER); |
28 | --- a/target/arm/translate-neon.inc.c | 87 | + set_feature(&cpu->env, ARM_FEATURE_AARCH64); |
29 | +++ b/target/arm/translate-neon.inc.c | 88 | + set_feature(&cpu->env, ARM_FEATURE_CBAR_RO); |
30 | @@ -XXX,XX +XXX,XX @@ static bool trans_VLDST_multiple(DisasContext *s, arg_VLDST_multiple *a) | 89 | + set_feature(&cpu->env, ARM_FEATURE_EL2); |
31 | gen_neon_ldst_base_update(s, a->rm, a->rn, nregs * interleave * 8); | 90 | + set_feature(&cpu->env, ARM_FEATURE_EL3); |
32 | return true; | 91 | + set_feature(&cpu->env, ARM_FEATURE_PMU); |
33 | } | ||
34 | + | 92 | + |
35 | +static bool trans_VLD_all_lanes(DisasContext *s, arg_VLD_all_lanes *a) | 93 | + /* Ordered by Section B.5: AArch64 ID registers */ |
36 | +{ | 94 | + cpu->midr = 0x410FD493; /* r0p3 */ |
37 | + /* Neon load single structure to all lanes */ | 95 | + cpu->revidr = 0; |
38 | + int reg, stride, vec_size; | 96 | + cpu->isar.id_pfr0 = 0x21110131; |
39 | + int vd = a->vd; | 97 | + cpu->isar.id_pfr1 = 0x00010000; /* GIC filled in later */ |
40 | + int size = a->size; | 98 | + cpu->isar.id_dfr0 = 0x16011099; |
41 | + int nregs = a->n + 1; | 99 | + cpu->id_afr0 = 0; |
42 | + TCGv_i32 addr, tmp; | 100 | + cpu->isar.id_mmfr0 = 0x10201105; |
101 | + cpu->isar.id_mmfr1 = 0x40000000; | ||
102 | + cpu->isar.id_mmfr2 = 0x01260000; | ||
103 | + cpu->isar.id_mmfr3 = 0x02122211; | ||
104 | + cpu->isar.id_isar0 = 0x02101110; | ||
105 | + cpu->isar.id_isar1 = 0x13112111; | ||
106 | + cpu->isar.id_isar2 = 0x21232042; | ||
107 | + cpu->isar.id_isar3 = 0x01112131; | ||
108 | + cpu->isar.id_isar4 = 0x00010142; | ||
109 | + cpu->isar.id_isar5 = 0x11011121; /* with Crypto */ | ||
110 | + cpu->isar.id_mmfr4 = 0x01021110; | ||
111 | + cpu->isar.id_isar6 = 0x01111111; | ||
112 | + cpu->isar.mvfr0 = 0x10110222; | ||
113 | + cpu->isar.mvfr1 = 0x13211111; | ||
114 | + cpu->isar.mvfr2 = 0x00000043; | ||
115 | + cpu->isar.id_pfr2 = 0x00000011; | ||
116 | + cpu->isar.id_aa64pfr0 = 0x1201111120111112ull; /* GIC filled in later */ | ||
117 | + cpu->isar.id_aa64pfr1 = 0x0000000000000221ull; | ||
118 | + cpu->isar.id_aa64zfr0 = 0x0000110100110021ull; /* with Crypto */ | ||
119 | + cpu->isar.id_aa64dfr0 = 0x000011f210305619ull; | ||
120 | + cpu->isar.id_aa64dfr1 = 0; | ||
121 | + cpu->id_aa64afr0 = 0; | ||
122 | + cpu->id_aa64afr1 = 0; | ||
123 | + cpu->isar.id_aa64isar0 = 0x0221111110212120ull; /* with Crypto */ | ||
124 | + cpu->isar.id_aa64isar1 = 0x0011111101211052ull; | ||
125 | + cpu->isar.id_aa64mmfr0 = 0x0000022200101125ull; | ||
126 | + cpu->isar.id_aa64mmfr1 = 0x0000000010212122ull; | ||
127 | + cpu->isar.id_aa64mmfr2 = 0x1221011112101011ull; | ||
128 | + cpu->clidr = 0x0000001482000023ull; | ||
129 | + cpu->gm_blocksize = 4; | ||
130 | + cpu->ctr = 0x00000004b444c004ull; | ||
131 | + cpu->dcz_blocksize = 4; | ||
132 | + /* TODO FEAT_MPAM: mpamidr_el1 = 0x0000_0001_001e_01ff */ | ||
43 | + | 133 | + |
44 | + if (!arm_dc_feature(s, ARM_FEATURE_NEON)) { | 134 | + /* Section B.7.2: PMCR_EL0 */ |
45 | + return false; | 135 | + cpu->isar.reset_pmcr_el0 = 0x3000; /* with 6 counters */ |
46 | + } | ||
47 | + | 136 | + |
48 | + /* UNDEF accesses to D16-D31 if they don't exist */ | 137 | + /* Section B.8.9: ICH_VTR_EL2 */ |
49 | + if (!dc_isar_feature(aa32_simd_r32, s) && (a->vd & 0x10)) { | 138 | + cpu->gic_num_lrs = 4; |
50 | + return false; | 139 | + cpu->gic_vpribits = 5; |
51 | + } | 140 | + cpu->gic_vprebits = 5; |
141 | + cpu->gic_pribits = 5; | ||
52 | + | 142 | + |
53 | + if (size == 3) { | 143 | + /* Section 14: Scalable Vector Extensions support */ |
54 | + if (nregs != 4 || a->a == 0) { | 144 | + cpu->sve_vq.supported = 1 << 0; /* 128bit */ |
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 | + | 145 | + |
71 | + /* | 146 | + /* |
72 | + * VLD1 to all lanes: T bit indicates how many Dregs to write. | 147 | + * The Neoverse N2 TRM does not list CCSIDR values. The layout of |
73 | + * VLD2/3/4 to all lanes: T bit indicates register stride. | 148 | + * the caches are in text in Table 7-1, Table 8-1, and Table 9-1. |
149 | + * | ||
150 | + * L1: 4-way set associative 64-byte line size, total 64K. | ||
151 | + * L2: 8-way set associative 64 byte line size, total either 512K or 1024K. | ||
74 | + */ | 152 | + */ |
75 | + stride = a->t ? 2 : 1; | 153 | + cpu->ccsidr[0] = make_ccsidr64(4, 64, 64 * KiB); /* L1 dcache */ |
76 | + vec_size = nregs == 1 ? stride * 8 : 8; | 154 | + cpu->ccsidr[1] = cpu->ccsidr[0]; /* L1 icache */ |
155 | + cpu->ccsidr[2] = make_ccsidr64(8, 64, 512 * KiB); /* L2 cache */ | ||
77 | + | 156 | + |
78 | + tmp = tcg_temp_new_i32(); | 157 | + /* FIXME: Not documented -- copied from neoverse-v1 */ |
79 | + addr = tcg_temp_new_i32(); | 158 | + cpu->reset_sctlr = 0x30c50838; |
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 | + | 159 | + |
103 | + gen_neon_ldst_base_update(s, a->rm, a->rn, (1 << size) * nregs); | 160 | + /* |
161 | + * The Neoverse N2 has all of the Cortex-A710 IMPDEF registers, | ||
162 | + * and a few more RNG related ones. | ||
163 | + */ | ||
164 | + define_arm_cp_regs(cpu, cortex_a710_cp_reginfo); | ||
165 | + define_arm_cp_regs(cpu, neoverse_n2_cp_reginfo); | ||
104 | + | 166 | + |
105 | + return true; | 167 | + aarch64_add_pauth_properties(obj); |
168 | + aarch64_add_sve_properties(obj); | ||
106 | +} | 169 | +} |
107 | diff --git a/target/arm/translate.c b/target/arm/translate.c | 170 | + |
108 | index XXXXXXX..XXXXXXX 100644 | 171 | /* |
109 | --- a/target/arm/translate.c | 172 | * -cpu max: a CPU with as many features enabled as our emulation supports. |
110 | +++ b/target/arm/translate.c | 173 | * The version of '-cpu max' for qemu-system-arm is defined in cpu32.c; |
111 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_ls_insn(DisasContext *s, uint32_t insn) | 174 | @@ -XXX,XX +XXX,XX @@ static const ARMCPUInfo aarch64_cpus[] = { |
112 | int size; | 175 | { .name = "a64fx", .initfn = aarch64_a64fx_initfn }, |
113 | int reg; | 176 | { .name = "neoverse-n1", .initfn = aarch64_neoverse_n1_initfn }, |
114 | int load; | 177 | { .name = "neoverse-v1", .initfn = aarch64_neoverse_v1_initfn }, |
115 | - int vec_size; | 178 | + { .name = "neoverse-n2", .initfn = aarch64_neoverse_n2_initfn }, |
116 | TCGv_i32 addr; | 179 | }; |
117 | TCGv_i32 tmp; | 180 | |
118 | 181 | static void aarch64_cpu_register_types(void) | |
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 | -- | 182 | -- |
181 | 2.20.1 | 183 | 2.34.1 |
182 | 184 | ||
183 | 185 | diff view generated by jsdifflib |
1 | Add the infrastructure for building and invoking a decodetree decoder | 1 | The feature test functions isar_feature_*() now take up nearly |
---|---|---|---|
2 | for the AArch32 Neon encodings. At the moment the new decoder covers | 2 | a thousand lines in target/arm/cpu.h. This header file is included |
3 | nothing, so we always fall back to the existing hand-written decode. | 3 | by a lot of source files, most of which don't need these functions. |
4 | 4 | Move the feature test functions to their own header file. | |
5 | We follow the same pattern we did for the VFP decodetree conversion | ||
6 | (commit 78e138bc1f672c145ef6ace74617d and following): code that deals | ||
7 | with Neon will be moving gradually out to translate-neon.vfp.inc, | ||
8 | which we #include into translate.c. | ||
9 | |||
10 | In order to share the decode files between A32 and T32, we | ||
11 | split Neon into 3 parts: | ||
12 | * data-processing | ||
13 | * load-store | ||
14 | * 'shared' encodings | ||
15 | |||
16 | The first two groups of instructions have similar but not identical | ||
17 | A32 and T32 encodings, so we need to manually transform the T32 | ||
18 | encoding into the A32 one before calling the decoder; the third group | ||
19 | covers the Neon instructions which are identical in A32 and T32. | ||
20 | 5 | ||
21 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
7 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
22 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 8 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
23 | Message-id: 20200430181003.21682-4-peter.maydell@linaro.org | 9 | Message-id: 20231024163510.2972081-2-peter.maydell@linaro.org |
24 | --- | 10 | --- |
25 | target/arm/neon-dp.decode | 29 ++++++++++++++++++++++++++ | 11 | bsd-user/arm/target_arch.h | 1 + |
26 | target/arm/neon-ls.decode | 29 ++++++++++++++++++++++++++ | 12 | linux-user/aarch64/target_prctl.h | 2 + |
27 | target/arm/neon-shared.decode | 27 +++++++++++++++++++++++++ | 13 | target/arm/cpu-features.h | 994 ++++++++++++++++++++++++++++++ |
28 | target/arm/translate-neon.inc.c | 32 +++++++++++++++++++++++++++++ | 14 | target/arm/cpu.h | 971 ----------------------------- |
29 | target/arm/translate.c | 36 +++++++++++++++++++++++++++++++-- | 15 | target/arm/internals.h | 1 + |
30 | target/arm/Makefile.objs | 18 +++++++++++++++++ | 16 | target/arm/tcg/translate.h | 2 +- |
31 | 6 files changed, 169 insertions(+), 2 deletions(-) | 17 | hw/arm/armv7m.c | 1 + |
32 | create mode 100644 target/arm/neon-dp.decode | 18 | hw/intc/armv7m_nvic.c | 1 + |
33 | create mode 100644 target/arm/neon-ls.decode | 19 | linux-user/aarch64/cpu_loop.c | 1 + |
34 | create mode 100644 target/arm/neon-shared.decode | 20 | linux-user/aarch64/signal.c | 1 + |
35 | create mode 100644 target/arm/translate-neon.inc.c | 21 | linux-user/arm/signal.c | 1 + |
22 | linux-user/elfload.c | 4 + | ||
23 | linux-user/mmap.c | 4 + | ||
24 | target/arm/arch_dump.c | 1 + | ||
25 | target/arm/cpu.c | 1 + | ||
26 | target/arm/cpu64.c | 1 + | ||
27 | target/arm/debug_helper.c | 1 + | ||
28 | target/arm/gdbstub.c | 1 + | ||
29 | target/arm/helper.c | 1 + | ||
30 | target/arm/kvm64.c | 1 + | ||
31 | target/arm/machine.c | 1 + | ||
32 | target/arm/ptw.c | 1 + | ||
33 | target/arm/tcg/cpu64.c | 1 + | ||
34 | target/arm/tcg/hflags.c | 1 + | ||
35 | target/arm/tcg/m_helper.c | 1 + | ||
36 | target/arm/tcg/op_helper.c | 1 + | ||
37 | target/arm/tcg/pauth_helper.c | 1 + | ||
38 | target/arm/tcg/tlb_helper.c | 1 + | ||
39 | target/arm/vfp_helper.c | 1 + | ||
40 | 29 files changed, 1028 insertions(+), 972 deletions(-) | ||
41 | create mode 100644 target/arm/cpu-features.h | ||
36 | 42 | ||
37 | diff --git a/target/arm/neon-dp.decode b/target/arm/neon-dp.decode | 43 | diff --git a/bsd-user/arm/target_arch.h b/bsd-user/arm/target_arch.h |
44 | index XXXXXXX..XXXXXXX 100644 | ||
45 | --- a/bsd-user/arm/target_arch.h | ||
46 | +++ b/bsd-user/arm/target_arch.h | ||
47 | @@ -XXX,XX +XXX,XX @@ | ||
48 | #define TARGET_ARCH_H | ||
49 | |||
50 | #include "qemu.h" | ||
51 | +#include "target/arm/cpu-features.h" | ||
52 | |||
53 | void target_cpu_set_tls(CPUARMState *env, target_ulong newtls); | ||
54 | target_ulong target_cpu_get_tls(CPUARMState *env); | ||
55 | diff --git a/linux-user/aarch64/target_prctl.h b/linux-user/aarch64/target_prctl.h | ||
56 | index XXXXXXX..XXXXXXX 100644 | ||
57 | --- a/linux-user/aarch64/target_prctl.h | ||
58 | +++ b/linux-user/aarch64/target_prctl.h | ||
59 | @@ -XXX,XX +XXX,XX @@ | ||
60 | #ifndef AARCH64_TARGET_PRCTL_H | ||
61 | #define AARCH64_TARGET_PRCTL_H | ||
62 | |||
63 | +#include "target/arm/cpu-features.h" | ||
64 | + | ||
65 | static abi_long do_prctl_sve_get_vl(CPUArchState *env) | ||
66 | { | ||
67 | ARMCPU *cpu = env_archcpu(env); | ||
68 | diff --git a/target/arm/cpu-features.h b/target/arm/cpu-features.h | ||
38 | new file mode 100644 | 69 | new file mode 100644 |
39 | index XXXXXXX..XXXXXXX | 70 | index XXXXXXX..XXXXXXX |
40 | --- /dev/null | 71 | --- /dev/null |
41 | +++ b/target/arm/neon-dp.decode | 72 | +++ b/target/arm/cpu-features.h |
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 @@ | 73 | @@ -XXX,XX +XXX,XX @@ |
146 | +/* | 74 | +/* |
147 | + * ARM translation: AArch32 Neon instructions | 75 | + * QEMU Arm CPU -- feature test functions |
148 | + * | 76 | + * |
149 | + * Copyright (c) 2003 Fabrice Bellard | 77 | + * Copyright (c) 2023 Linaro Ltd |
150 | + * Copyright (c) 2005-2007 CodeSourcery | ||
151 | + * Copyright (c) 2007 OpenedHand, Ltd. | ||
152 | + * Copyright (c) 2020 Linaro, Ltd. | ||
153 | + * | 78 | + * |
154 | + * This library is free software; you can redistribute it and/or | 79 | + * This library is free software; you can redistribute it and/or |
155 | + * modify it under the terms of the GNU Lesser General Public | 80 | + * modify it under the terms of the GNU Lesser General Public |
156 | + * License as published by the Free Software Foundation; either | 81 | + * License as published by the Free Software Foundation; either |
157 | + * version 2 of the License, or (at your option) any later version. | 82 | + * version 2.1 of the License, or (at your option) any later version. |
158 | + * | 83 | + * |
159 | + * This library is distributed in the hope that it will be useful, | 84 | + * This library is distributed in the hope that it will be useful, |
160 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | 85 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
161 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 86 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
162 | + * Lesser General Public License for more details. | 87 | + * Lesser General Public License for more details. |
163 | + * | 88 | + * |
164 | + * You should have received a copy of the GNU Lesser General Public | 89 | + * 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/>. | 90 | + * License along with this library; if not, see <http://www.gnu.org/licenses/>. |
166 | + */ | 91 | + */ |
167 | + | 92 | + |
93 | +#ifndef TARGET_ARM_FEATURES_H | ||
94 | +#define TARGET_ARM_FEATURES_H | ||
95 | + | ||
168 | +/* | 96 | +/* |
169 | + * This file is intended to be included from translate.c; it uses | 97 | + * Naming convention for isar_feature functions: |
170 | + * some macros and definitions provided by that file. | 98 | + * Functions which test 32-bit ID registers should have _aa32_ in |
171 | + * It might be possible to convert it to a standalone .c file eventually. | 99 | + * their name. Functions which test 64-bit ID registers should have |
100 | + * _aa64_ in their name. These must only be used in code where we | ||
101 | + * know for certain that the CPU has AArch32 or AArch64 respectively | ||
102 | + * or where the correct answer for a CPU which doesn't implement that | ||
103 | + * CPU state is "false" (eg when generating A32 or A64 code, if adding | ||
104 | + * system registers that are specific to that CPU state, for "should | ||
105 | + * we let this system register bit be set" tests where the 32-bit | ||
106 | + * flavour of the register doesn't have the bit, and so on). | ||
107 | + * Functions which simply ask "does this feature exist at all" have | ||
108 | + * _any_ in their name, and always return the logical OR of the _aa64_ | ||
109 | + * and the _aa32_ function. | ||
172 | + */ | 110 | + */ |
173 | + | 111 | + |
174 | +/* Include the generated Neon decoder */ | 112 | +/* |
175 | +#include "decode-neon-dp.inc.c" | 113 | + * 32-bit feature tests via id registers. |
176 | +#include "decode-neon-ls.inc.c" | 114 | + */ |
177 | +#include "decode-neon-shared.inc.c" | 115 | +static inline bool isar_feature_aa32_thumb_div(const ARMISARegisters *id) |
178 | diff --git a/target/arm/translate.c b/target/arm/translate.c | 116 | +{ |
179 | index XXXXXXX..XXXXXXX 100644 | 117 | + return FIELD_EX32(id->id_isar0, ID_ISAR0, DIVIDE) != 0; |
180 | --- a/target/arm/translate.c | 118 | +} |
181 | +++ b/target/arm/translate.c | 119 | + |
182 | @@ -XXX,XX +XXX,XX @@ static TCGv_ptr vfp_reg_ptr(bool dp, int reg) | 120 | +static inline bool isar_feature_aa32_arm_div(const ARMISARegisters *id) |
183 | 121 | +{ | |
184 | #define ARM_CP_RW_BIT (1 << 20) | 122 | + return FIELD_EX32(id->id_isar0, ID_ISAR0, DIVIDE) > 1; |
185 | 123 | +} | |
186 | -/* Include the VFP decoder */ | 124 | + |
187 | +/* Include the VFP and Neon decoders */ | 125 | +static inline bool isar_feature_aa32_lob(const ARMISARegisters *id) |
188 | #include "translate-vfp.inc.c" | 126 | +{ |
189 | +#include "translate-neon.inc.c" | 127 | + /* (M-profile) low-overhead loops and branch future */ |
190 | 128 | + return FIELD_EX32(id->id_isar0, ID_ISAR0, CMPBRANCH) >= 3; | |
191 | static inline void iwmmxt_load_reg(TCGv_i64 var, int reg) | 129 | +} |
192 | { | 130 | + |
193 | @@ -XXX,XX +XXX,XX @@ static void disas_arm_insn(DisasContext *s, unsigned int insn) | 131 | +static inline bool isar_feature_aa32_jazelle(const ARMISARegisters *id) |
194 | /* Unconditional instructions. */ | 132 | +{ |
195 | /* TODO: Perhaps merge these into one decodetree output file. */ | 133 | + return FIELD_EX32(id->id_isar1, ID_ISAR1, JAZELLE) != 0; |
196 | if (disas_a32_uncond(s, insn) || | 134 | +} |
197 | - disas_vfp_uncond(s, insn)) { | 135 | + |
198 | + disas_vfp_uncond(s, insn) || | 136 | +static inline bool isar_feature_aa32_aes(const ARMISARegisters *id) |
199 | + disas_neon_dp(s, insn) || | 137 | +{ |
200 | + disas_neon_ls(s, insn) || | 138 | + return FIELD_EX32(id->id_isar5, ID_ISAR5, AES) != 0; |
201 | + disas_neon_shared(s, insn)) { | 139 | +} |
202 | return; | 140 | + |
203 | } | 141 | +static inline bool isar_feature_aa32_pmull(const ARMISARegisters *id) |
204 | /* fall back to legacy decoder */ | 142 | +{ |
205 | @@ -XXX,XX +XXX,XX @@ static void disas_thumb2_insn(DisasContext *s, uint32_t insn) | 143 | + return FIELD_EX32(id->id_isar5, ID_ISAR5, AES) > 1; |
206 | ARCH(6T2); | 144 | +} |
207 | } | 145 | + |
208 | 146 | +static inline bool isar_feature_aa32_sha1(const ARMISARegisters *id) | |
209 | + if ((insn & 0xef000000) == 0xef000000) { | 147 | +{ |
210 | + /* | 148 | + return FIELD_EX32(id->id_isar5, ID_ISAR5, SHA1) != 0; |
211 | + * T32 encodings 0b111p_1111_qqqq_qqqq_qqqq_qqqq_qqqq_qqqq | 149 | +} |
212 | + * transform into | 150 | + |
213 | + * A32 encodings 0b1111_001p_qqqq_qqqq_qqqq_qqqq_qqqq_qqqq | 151 | +static inline bool isar_feature_aa32_sha2(const ARMISARegisters *id) |
214 | + */ | 152 | +{ |
215 | + uint32_t a32_insn = (insn & 0xe2ffffff) | | 153 | + return FIELD_EX32(id->id_isar5, ID_ISAR5, SHA2) != 0; |
216 | + ((insn & (1 << 28)) >> 4) | (1 << 28); | 154 | +} |
217 | + | 155 | + |
218 | + if (disas_neon_dp(s, a32_insn)) { | 156 | +static inline bool isar_feature_aa32_crc32(const ARMISARegisters *id) |
219 | + return; | 157 | +{ |
220 | + } | 158 | + return FIELD_EX32(id->id_isar5, ID_ISAR5, CRC32) != 0; |
159 | +} | ||
160 | + | ||
161 | +static inline bool isar_feature_aa32_rdm(const ARMISARegisters *id) | ||
162 | +{ | ||
163 | + return FIELD_EX32(id->id_isar5, ID_ISAR5, RDM) != 0; | ||
164 | +} | ||
165 | + | ||
166 | +static inline bool isar_feature_aa32_vcma(const ARMISARegisters *id) | ||
167 | +{ | ||
168 | + return FIELD_EX32(id->id_isar5, ID_ISAR5, VCMA) != 0; | ||
169 | +} | ||
170 | + | ||
171 | +static inline bool isar_feature_aa32_jscvt(const ARMISARegisters *id) | ||
172 | +{ | ||
173 | + return FIELD_EX32(id->id_isar6, ID_ISAR6, JSCVT) != 0; | ||
174 | +} | ||
175 | + | ||
176 | +static inline bool isar_feature_aa32_dp(const ARMISARegisters *id) | ||
177 | +{ | ||
178 | + return FIELD_EX32(id->id_isar6, ID_ISAR6, DP) != 0; | ||
179 | +} | ||
180 | + | ||
181 | +static inline bool isar_feature_aa32_fhm(const ARMISARegisters *id) | ||
182 | +{ | ||
183 | + return FIELD_EX32(id->id_isar6, ID_ISAR6, FHM) != 0; | ||
184 | +} | ||
185 | + | ||
186 | +static inline bool isar_feature_aa32_sb(const ARMISARegisters *id) | ||
187 | +{ | ||
188 | + return FIELD_EX32(id->id_isar6, ID_ISAR6, SB) != 0; | ||
189 | +} | ||
190 | + | ||
191 | +static inline bool isar_feature_aa32_predinv(const ARMISARegisters *id) | ||
192 | +{ | ||
193 | + return FIELD_EX32(id->id_isar6, ID_ISAR6, SPECRES) != 0; | ||
194 | +} | ||
195 | + | ||
196 | +static inline bool isar_feature_aa32_bf16(const ARMISARegisters *id) | ||
197 | +{ | ||
198 | + return FIELD_EX32(id->id_isar6, ID_ISAR6, BF16) != 0; | ||
199 | +} | ||
200 | + | ||
201 | +static inline bool isar_feature_aa32_i8mm(const ARMISARegisters *id) | ||
202 | +{ | ||
203 | + return FIELD_EX32(id->id_isar6, ID_ISAR6, I8MM) != 0; | ||
204 | +} | ||
205 | + | ||
206 | +static inline bool isar_feature_aa32_ras(const ARMISARegisters *id) | ||
207 | +{ | ||
208 | + return FIELD_EX32(id->id_pfr0, ID_PFR0, RAS) != 0; | ||
209 | +} | ||
210 | + | ||
211 | +static inline bool isar_feature_aa32_mprofile(const ARMISARegisters *id) | ||
212 | +{ | ||
213 | + return FIELD_EX32(id->id_pfr1, ID_PFR1, MPROGMOD) != 0; | ||
214 | +} | ||
215 | + | ||
216 | +static inline bool isar_feature_aa32_m_sec_state(const ARMISARegisters *id) | ||
217 | +{ | ||
218 | + /* | ||
219 | + * Return true if M-profile state handling insns | ||
220 | + * (VSCCLRM, CLRM, FPCTX access insns) are implemented | ||
221 | + */ | ||
222 | + return FIELD_EX32(id->id_pfr1, ID_PFR1, SECURITY) >= 3; | ||
223 | +} | ||
224 | + | ||
225 | +static inline bool isar_feature_aa32_fp16_arith(const ARMISARegisters *id) | ||
226 | +{ | ||
227 | + /* Sadly this is encoded differently for A-profile and M-profile */ | ||
228 | + if (isar_feature_aa32_mprofile(id)) { | ||
229 | + return FIELD_EX32(id->mvfr1, MVFR1, FP16) > 0; | ||
230 | + } else { | ||
231 | + return FIELD_EX32(id->mvfr1, MVFR1, FPHP) >= 3; | ||
221 | + } | 232 | + } |
222 | + | 233 | +} |
223 | + if ((insn & 0xff100000) == 0xf9000000) { | 234 | + |
224 | + /* | 235 | +static inline bool isar_feature_aa32_mve(const ARMISARegisters *id) |
225 | + * T32 encodings 0b1111_1001_ppp0_qqqq_qqqq_qqqq_qqqq_qqqq | 236 | +{ |
226 | + * transform into | 237 | + /* |
227 | + * A32 encodings 0b1111_0100_ppp0_qqqq_qqqq_qqqq_qqqq_qqqq | 238 | + * Return true if MVE is supported (either integer or floating point). |
228 | + */ | 239 | + * We must check for M-profile as the MVFR1 field means something |
229 | + uint32_t a32_insn = (insn & 0x00ffffff) | 0xf4000000; | 240 | + * else for A-profile. |
230 | + | 241 | + */ |
231 | + if (disas_neon_ls(s, a32_insn)) { | 242 | + return isar_feature_aa32_mprofile(id) && |
232 | + return; | 243 | + FIELD_EX32(id->mvfr1, MVFR1, MVE) > 0; |
233 | + } | 244 | +} |
245 | + | ||
246 | +static inline bool isar_feature_aa32_mve_fp(const ARMISARegisters *id) | ||
247 | +{ | ||
248 | + /* | ||
249 | + * Return true if MVE is supported (either integer or floating point). | ||
250 | + * We must check for M-profile as the MVFR1 field means something | ||
251 | + * else for A-profile. | ||
252 | + */ | ||
253 | + return isar_feature_aa32_mprofile(id) && | ||
254 | + FIELD_EX32(id->mvfr1, MVFR1, MVE) >= 2; | ||
255 | +} | ||
256 | + | ||
257 | +static inline bool isar_feature_aa32_vfp_simd(const ARMISARegisters *id) | ||
258 | +{ | ||
259 | + /* | ||
260 | + * Return true if either VFP or SIMD is implemented. | ||
261 | + * In this case, a minimum of VFP w/ D0-D15. | ||
262 | + */ | ||
263 | + return FIELD_EX32(id->mvfr0, MVFR0, SIMDREG) > 0; | ||
264 | +} | ||
265 | + | ||
266 | +static inline bool isar_feature_aa32_simd_r32(const ARMISARegisters *id) | ||
267 | +{ | ||
268 | + /* Return true if D16-D31 are implemented */ | ||
269 | + return FIELD_EX32(id->mvfr0, MVFR0, SIMDREG) >= 2; | ||
270 | +} | ||
271 | + | ||
272 | +static inline bool isar_feature_aa32_fpshvec(const ARMISARegisters *id) | ||
273 | +{ | ||
274 | + return FIELD_EX32(id->mvfr0, MVFR0, FPSHVEC) > 0; | ||
275 | +} | ||
276 | + | ||
277 | +static inline bool isar_feature_aa32_fpsp_v2(const ARMISARegisters *id) | ||
278 | +{ | ||
279 | + /* Return true if CPU supports single precision floating point, VFPv2 */ | ||
280 | + return FIELD_EX32(id->mvfr0, MVFR0, FPSP) > 0; | ||
281 | +} | ||
282 | + | ||
283 | +static inline bool isar_feature_aa32_fpsp_v3(const ARMISARegisters *id) | ||
284 | +{ | ||
285 | + /* Return true if CPU supports single precision floating point, VFPv3 */ | ||
286 | + return FIELD_EX32(id->mvfr0, MVFR0, FPSP) >= 2; | ||
287 | +} | ||
288 | + | ||
289 | +static inline bool isar_feature_aa32_fpdp_v2(const ARMISARegisters *id) | ||
290 | +{ | ||
291 | + /* Return true if CPU supports double precision floating point, VFPv2 */ | ||
292 | + return FIELD_EX32(id->mvfr0, MVFR0, FPDP) > 0; | ||
293 | +} | ||
294 | + | ||
295 | +static inline bool isar_feature_aa32_fpdp_v3(const ARMISARegisters *id) | ||
296 | +{ | ||
297 | + /* Return true if CPU supports double precision floating point, VFPv3 */ | ||
298 | + return FIELD_EX32(id->mvfr0, MVFR0, FPDP) >= 2; | ||
299 | +} | ||
300 | + | ||
301 | +static inline bool isar_feature_aa32_vfp(const ARMISARegisters *id) | ||
302 | +{ | ||
303 | + return isar_feature_aa32_fpsp_v2(id) || isar_feature_aa32_fpdp_v2(id); | ||
304 | +} | ||
305 | + | ||
306 | +/* | ||
307 | + * We always set the FP and SIMD FP16 fields to indicate identical | ||
308 | + * levels of support (assuming SIMD is implemented at all), so | ||
309 | + * we only need one set of accessors. | ||
310 | + */ | ||
311 | +static inline bool isar_feature_aa32_fp16_spconv(const ARMISARegisters *id) | ||
312 | +{ | ||
313 | + return FIELD_EX32(id->mvfr1, MVFR1, FPHP) > 0; | ||
314 | +} | ||
315 | + | ||
316 | +static inline bool isar_feature_aa32_fp16_dpconv(const ARMISARegisters *id) | ||
317 | +{ | ||
318 | + return FIELD_EX32(id->mvfr1, MVFR1, FPHP) > 1; | ||
319 | +} | ||
320 | + | ||
321 | +/* | ||
322 | + * Note that this ID register field covers both VFP and Neon FMAC, | ||
323 | + * so should usually be tested in combination with some other | ||
324 | + * check that confirms the presence of whichever of VFP or Neon is | ||
325 | + * relevant, to avoid accidentally enabling a Neon feature on | ||
326 | + * a VFP-no-Neon core or vice-versa. | ||
327 | + */ | ||
328 | +static inline bool isar_feature_aa32_simdfmac(const ARMISARegisters *id) | ||
329 | +{ | ||
330 | + return FIELD_EX32(id->mvfr1, MVFR1, SIMDFMAC) != 0; | ||
331 | +} | ||
332 | + | ||
333 | +static inline bool isar_feature_aa32_vsel(const ARMISARegisters *id) | ||
334 | +{ | ||
335 | + return FIELD_EX32(id->mvfr2, MVFR2, FPMISC) >= 1; | ||
336 | +} | ||
337 | + | ||
338 | +static inline bool isar_feature_aa32_vcvt_dr(const ARMISARegisters *id) | ||
339 | +{ | ||
340 | + return FIELD_EX32(id->mvfr2, MVFR2, FPMISC) >= 2; | ||
341 | +} | ||
342 | + | ||
343 | +static inline bool isar_feature_aa32_vrint(const ARMISARegisters *id) | ||
344 | +{ | ||
345 | + return FIELD_EX32(id->mvfr2, MVFR2, FPMISC) >= 3; | ||
346 | +} | ||
347 | + | ||
348 | +static inline bool isar_feature_aa32_vminmaxnm(const ARMISARegisters *id) | ||
349 | +{ | ||
350 | + return FIELD_EX32(id->mvfr2, MVFR2, FPMISC) >= 4; | ||
351 | +} | ||
352 | + | ||
353 | +static inline bool isar_feature_aa32_pxn(const ARMISARegisters *id) | ||
354 | +{ | ||
355 | + return FIELD_EX32(id->id_mmfr0, ID_MMFR0, VMSA) >= 4; | ||
356 | +} | ||
357 | + | ||
358 | +static inline bool isar_feature_aa32_pan(const ARMISARegisters *id) | ||
359 | +{ | ||
360 | + return FIELD_EX32(id->id_mmfr3, ID_MMFR3, PAN) != 0; | ||
361 | +} | ||
362 | + | ||
363 | +static inline bool isar_feature_aa32_ats1e1(const ARMISARegisters *id) | ||
364 | +{ | ||
365 | + return FIELD_EX32(id->id_mmfr3, ID_MMFR3, PAN) >= 2; | ||
366 | +} | ||
367 | + | ||
368 | +static inline bool isar_feature_aa32_pmuv3p1(const ARMISARegisters *id) | ||
369 | +{ | ||
370 | + /* 0xf means "non-standard IMPDEF PMU" */ | ||
371 | + return FIELD_EX32(id->id_dfr0, ID_DFR0, PERFMON) >= 4 && | ||
372 | + FIELD_EX32(id->id_dfr0, ID_DFR0, PERFMON) != 0xf; | ||
373 | +} | ||
374 | + | ||
375 | +static inline bool isar_feature_aa32_pmuv3p4(const ARMISARegisters *id) | ||
376 | +{ | ||
377 | + /* 0xf means "non-standard IMPDEF PMU" */ | ||
378 | + return FIELD_EX32(id->id_dfr0, ID_DFR0, PERFMON) >= 5 && | ||
379 | + FIELD_EX32(id->id_dfr0, ID_DFR0, PERFMON) != 0xf; | ||
380 | +} | ||
381 | + | ||
382 | +static inline bool isar_feature_aa32_pmuv3p5(const ARMISARegisters *id) | ||
383 | +{ | ||
384 | + /* 0xf means "non-standard IMPDEF PMU" */ | ||
385 | + return FIELD_EX32(id->id_dfr0, ID_DFR0, PERFMON) >= 6 && | ||
386 | + FIELD_EX32(id->id_dfr0, ID_DFR0, PERFMON) != 0xf; | ||
387 | +} | ||
388 | + | ||
389 | +static inline bool isar_feature_aa32_hpd(const ARMISARegisters *id) | ||
390 | +{ | ||
391 | + return FIELD_EX32(id->id_mmfr4, ID_MMFR4, HPDS) != 0; | ||
392 | +} | ||
393 | + | ||
394 | +static inline bool isar_feature_aa32_ac2(const ARMISARegisters *id) | ||
395 | +{ | ||
396 | + return FIELD_EX32(id->id_mmfr4, ID_MMFR4, AC2) != 0; | ||
397 | +} | ||
398 | + | ||
399 | +static inline bool isar_feature_aa32_ccidx(const ARMISARegisters *id) | ||
400 | +{ | ||
401 | + return FIELD_EX32(id->id_mmfr4, ID_MMFR4, CCIDX) != 0; | ||
402 | +} | ||
403 | + | ||
404 | +static inline bool isar_feature_aa32_tts2uxn(const ARMISARegisters *id) | ||
405 | +{ | ||
406 | + return FIELD_EX32(id->id_mmfr4, ID_MMFR4, XNX) != 0; | ||
407 | +} | ||
408 | + | ||
409 | +static inline bool isar_feature_aa32_half_evt(const ARMISARegisters *id) | ||
410 | +{ | ||
411 | + return FIELD_EX32(id->id_mmfr4, ID_MMFR4, EVT) >= 1; | ||
412 | +} | ||
413 | + | ||
414 | +static inline bool isar_feature_aa32_evt(const ARMISARegisters *id) | ||
415 | +{ | ||
416 | + return FIELD_EX32(id->id_mmfr4, ID_MMFR4, EVT) >= 2; | ||
417 | +} | ||
418 | + | ||
419 | +static inline bool isar_feature_aa32_dit(const ARMISARegisters *id) | ||
420 | +{ | ||
421 | + return FIELD_EX32(id->id_pfr0, ID_PFR0, DIT) != 0; | ||
422 | +} | ||
423 | + | ||
424 | +static inline bool isar_feature_aa32_ssbs(const ARMISARegisters *id) | ||
425 | +{ | ||
426 | + return FIELD_EX32(id->id_pfr2, ID_PFR2, SSBS) != 0; | ||
427 | +} | ||
428 | + | ||
429 | +static inline bool isar_feature_aa32_debugv7p1(const ARMISARegisters *id) | ||
430 | +{ | ||
431 | + return FIELD_EX32(id->id_dfr0, ID_DFR0, COPDBG) >= 5; | ||
432 | +} | ||
433 | + | ||
434 | +static inline bool isar_feature_aa32_debugv8p2(const ARMISARegisters *id) | ||
435 | +{ | ||
436 | + return FIELD_EX32(id->id_dfr0, ID_DFR0, COPDBG) >= 8; | ||
437 | +} | ||
438 | + | ||
439 | +static inline bool isar_feature_aa32_doublelock(const ARMISARegisters *id) | ||
440 | +{ | ||
441 | + return FIELD_EX32(id->dbgdevid, DBGDEVID, DOUBLELOCK) > 0; | ||
442 | +} | ||
443 | + | ||
444 | +/* | ||
445 | + * 64-bit feature tests via id registers. | ||
446 | + */ | ||
447 | +static inline bool isar_feature_aa64_aes(const ARMISARegisters *id) | ||
448 | +{ | ||
449 | + return FIELD_EX64(id->id_aa64isar0, ID_AA64ISAR0, AES) != 0; | ||
450 | +} | ||
451 | + | ||
452 | +static inline bool isar_feature_aa64_pmull(const ARMISARegisters *id) | ||
453 | +{ | ||
454 | + return FIELD_EX64(id->id_aa64isar0, ID_AA64ISAR0, AES) > 1; | ||
455 | +} | ||
456 | + | ||
457 | +static inline bool isar_feature_aa64_sha1(const ARMISARegisters *id) | ||
458 | +{ | ||
459 | + return FIELD_EX64(id->id_aa64isar0, ID_AA64ISAR0, SHA1) != 0; | ||
460 | +} | ||
461 | + | ||
462 | +static inline bool isar_feature_aa64_sha256(const ARMISARegisters *id) | ||
463 | +{ | ||
464 | + return FIELD_EX64(id->id_aa64isar0, ID_AA64ISAR0, SHA2) != 0; | ||
465 | +} | ||
466 | + | ||
467 | +static inline bool isar_feature_aa64_sha512(const ARMISARegisters *id) | ||
468 | +{ | ||
469 | + return FIELD_EX64(id->id_aa64isar0, ID_AA64ISAR0, SHA2) > 1; | ||
470 | +} | ||
471 | + | ||
472 | +static inline bool isar_feature_aa64_crc32(const ARMISARegisters *id) | ||
473 | +{ | ||
474 | + return FIELD_EX64(id->id_aa64isar0, ID_AA64ISAR0, CRC32) != 0; | ||
475 | +} | ||
476 | + | ||
477 | +static inline bool isar_feature_aa64_atomics(const ARMISARegisters *id) | ||
478 | +{ | ||
479 | + return FIELD_EX64(id->id_aa64isar0, ID_AA64ISAR0, ATOMIC) != 0; | ||
480 | +} | ||
481 | + | ||
482 | +static inline bool isar_feature_aa64_rdm(const ARMISARegisters *id) | ||
483 | +{ | ||
484 | + return FIELD_EX64(id->id_aa64isar0, ID_AA64ISAR0, RDM) != 0; | ||
485 | +} | ||
486 | + | ||
487 | +static inline bool isar_feature_aa64_sha3(const ARMISARegisters *id) | ||
488 | +{ | ||
489 | + return FIELD_EX64(id->id_aa64isar0, ID_AA64ISAR0, SHA3) != 0; | ||
490 | +} | ||
491 | + | ||
492 | +static inline bool isar_feature_aa64_sm3(const ARMISARegisters *id) | ||
493 | +{ | ||
494 | + return FIELD_EX64(id->id_aa64isar0, ID_AA64ISAR0, SM3) != 0; | ||
495 | +} | ||
496 | + | ||
497 | +static inline bool isar_feature_aa64_sm4(const ARMISARegisters *id) | ||
498 | +{ | ||
499 | + return FIELD_EX64(id->id_aa64isar0, ID_AA64ISAR0, SM4) != 0; | ||
500 | +} | ||
501 | + | ||
502 | +static inline bool isar_feature_aa64_dp(const ARMISARegisters *id) | ||
503 | +{ | ||
504 | + return FIELD_EX64(id->id_aa64isar0, ID_AA64ISAR0, DP) != 0; | ||
505 | +} | ||
506 | + | ||
507 | +static inline bool isar_feature_aa64_fhm(const ARMISARegisters *id) | ||
508 | +{ | ||
509 | + return FIELD_EX64(id->id_aa64isar0, ID_AA64ISAR0, FHM) != 0; | ||
510 | +} | ||
511 | + | ||
512 | +static inline bool isar_feature_aa64_condm_4(const ARMISARegisters *id) | ||
513 | +{ | ||
514 | + return FIELD_EX64(id->id_aa64isar0, ID_AA64ISAR0, TS) != 0; | ||
515 | +} | ||
516 | + | ||
517 | +static inline bool isar_feature_aa64_condm_5(const ARMISARegisters *id) | ||
518 | +{ | ||
519 | + return FIELD_EX64(id->id_aa64isar0, ID_AA64ISAR0, TS) >= 2; | ||
520 | +} | ||
521 | + | ||
522 | +static inline bool isar_feature_aa64_rndr(const ARMISARegisters *id) | ||
523 | +{ | ||
524 | + return FIELD_EX64(id->id_aa64isar0, ID_AA64ISAR0, RNDR) != 0; | ||
525 | +} | ||
526 | + | ||
527 | +static inline bool isar_feature_aa64_jscvt(const ARMISARegisters *id) | ||
528 | +{ | ||
529 | + return FIELD_EX64(id->id_aa64isar1, ID_AA64ISAR1, JSCVT) != 0; | ||
530 | +} | ||
531 | + | ||
532 | +static inline bool isar_feature_aa64_fcma(const ARMISARegisters *id) | ||
533 | +{ | ||
534 | + return FIELD_EX64(id->id_aa64isar1, ID_AA64ISAR1, FCMA) != 0; | ||
535 | +} | ||
536 | + | ||
537 | +/* | ||
538 | + * These are the values from APA/API/APA3. | ||
539 | + * In general these must be compared '>=', per the normal Arm ARM | ||
540 | + * treatment of fields in ID registers. | ||
541 | + */ | ||
542 | +typedef enum { | ||
543 | + PauthFeat_None = 0, | ||
544 | + PauthFeat_1 = 1, | ||
545 | + PauthFeat_EPAC = 2, | ||
546 | + PauthFeat_2 = 3, | ||
547 | + PauthFeat_FPAC = 4, | ||
548 | + PauthFeat_FPACCOMBINED = 5, | ||
549 | +} ARMPauthFeature; | ||
550 | + | ||
551 | +static inline ARMPauthFeature | ||
552 | +isar_feature_pauth_feature(const ARMISARegisters *id) | ||
553 | +{ | ||
554 | + /* | ||
555 | + * Architecturally, only one of {APA,API,APA3} may be active (non-zero) | ||
556 | + * and the other two must be zero. Thus we may avoid conditionals. | ||
557 | + */ | ||
558 | + return (FIELD_EX64(id->id_aa64isar1, ID_AA64ISAR1, APA) | | ||
559 | + FIELD_EX64(id->id_aa64isar1, ID_AA64ISAR1, API) | | ||
560 | + FIELD_EX64(id->id_aa64isar2, ID_AA64ISAR2, APA3)); | ||
561 | +} | ||
562 | + | ||
563 | +static inline bool isar_feature_aa64_pauth(const ARMISARegisters *id) | ||
564 | +{ | ||
565 | + /* | ||
566 | + * Return true if any form of pauth is enabled, as this | ||
567 | + * predicate controls migration of the 128-bit keys. | ||
568 | + */ | ||
569 | + return isar_feature_pauth_feature(id) != PauthFeat_None; | ||
570 | +} | ||
571 | + | ||
572 | +static inline bool isar_feature_aa64_pauth_qarma5(const ARMISARegisters *id) | ||
573 | +{ | ||
574 | + /* | ||
575 | + * Return true if pauth is enabled with the architected QARMA5 algorithm. | ||
576 | + * QEMU will always enable or disable both APA and GPA. | ||
577 | + */ | ||
578 | + return FIELD_EX64(id->id_aa64isar1, ID_AA64ISAR1, APA) != 0; | ||
579 | +} | ||
580 | + | ||
581 | +static inline bool isar_feature_aa64_pauth_qarma3(const ARMISARegisters *id) | ||
582 | +{ | ||
583 | + /* | ||
584 | + * Return true if pauth is enabled with the architected QARMA3 algorithm. | ||
585 | + * QEMU will always enable or disable both APA3 and GPA3. | ||
586 | + */ | ||
587 | + return FIELD_EX64(id->id_aa64isar2, ID_AA64ISAR2, APA3) != 0; | ||
588 | +} | ||
589 | + | ||
590 | +static inline bool isar_feature_aa64_tlbirange(const ARMISARegisters *id) | ||
591 | +{ | ||
592 | + return FIELD_EX64(id->id_aa64isar0, ID_AA64ISAR0, TLB) == 2; | ||
593 | +} | ||
594 | + | ||
595 | +static inline bool isar_feature_aa64_tlbios(const ARMISARegisters *id) | ||
596 | +{ | ||
597 | + return FIELD_EX64(id->id_aa64isar0, ID_AA64ISAR0, TLB) != 0; | ||
598 | +} | ||
599 | + | ||
600 | +static inline bool isar_feature_aa64_sb(const ARMISARegisters *id) | ||
601 | +{ | ||
602 | + return FIELD_EX64(id->id_aa64isar1, ID_AA64ISAR1, SB) != 0; | ||
603 | +} | ||
604 | + | ||
605 | +static inline bool isar_feature_aa64_predinv(const ARMISARegisters *id) | ||
606 | +{ | ||
607 | + return FIELD_EX64(id->id_aa64isar1, ID_AA64ISAR1, SPECRES) != 0; | ||
608 | +} | ||
609 | + | ||
610 | +static inline bool isar_feature_aa64_frint(const ARMISARegisters *id) | ||
611 | +{ | ||
612 | + return FIELD_EX64(id->id_aa64isar1, ID_AA64ISAR1, FRINTTS) != 0; | ||
613 | +} | ||
614 | + | ||
615 | +static inline bool isar_feature_aa64_dcpop(const ARMISARegisters *id) | ||
616 | +{ | ||
617 | + return FIELD_EX64(id->id_aa64isar1, ID_AA64ISAR1, DPB) != 0; | ||
618 | +} | ||
619 | + | ||
620 | +static inline bool isar_feature_aa64_dcpodp(const ARMISARegisters *id) | ||
621 | +{ | ||
622 | + return FIELD_EX64(id->id_aa64isar1, ID_AA64ISAR1, DPB) >= 2; | ||
623 | +} | ||
624 | + | ||
625 | +static inline bool isar_feature_aa64_bf16(const ARMISARegisters *id) | ||
626 | +{ | ||
627 | + return FIELD_EX64(id->id_aa64isar1, ID_AA64ISAR1, BF16) != 0; | ||
628 | +} | ||
629 | + | ||
630 | +static inline bool isar_feature_aa64_fp_simd(const ARMISARegisters *id) | ||
631 | +{ | ||
632 | + /* We always set the AdvSIMD and FP fields identically. */ | ||
633 | + return FIELD_EX64(id->id_aa64pfr0, ID_AA64PFR0, FP) != 0xf; | ||
634 | +} | ||
635 | + | ||
636 | +static inline bool isar_feature_aa64_fp16(const ARMISARegisters *id) | ||
637 | +{ | ||
638 | + /* We always set the AdvSIMD and FP fields identically wrt FP16. */ | ||
639 | + return FIELD_EX64(id->id_aa64pfr0, ID_AA64PFR0, FP) == 1; | ||
640 | +} | ||
641 | + | ||
642 | +static inline bool isar_feature_aa64_aa32(const ARMISARegisters *id) | ||
643 | +{ | ||
644 | + return FIELD_EX64(id->id_aa64pfr0, ID_AA64PFR0, EL0) >= 2; | ||
645 | +} | ||
646 | + | ||
647 | +static inline bool isar_feature_aa64_aa32_el1(const ARMISARegisters *id) | ||
648 | +{ | ||
649 | + return FIELD_EX64(id->id_aa64pfr0, ID_AA64PFR0, EL1) >= 2; | ||
650 | +} | ||
651 | + | ||
652 | +static inline bool isar_feature_aa64_aa32_el2(const ARMISARegisters *id) | ||
653 | +{ | ||
654 | + return FIELD_EX64(id->id_aa64pfr0, ID_AA64PFR0, EL2) >= 2; | ||
655 | +} | ||
656 | + | ||
657 | +static inline bool isar_feature_aa64_ras(const ARMISARegisters *id) | ||
658 | +{ | ||
659 | + return FIELD_EX64(id->id_aa64pfr0, ID_AA64PFR0, RAS) != 0; | ||
660 | +} | ||
661 | + | ||
662 | +static inline bool isar_feature_aa64_doublefault(const ARMISARegisters *id) | ||
663 | +{ | ||
664 | + return FIELD_EX64(id->id_aa64pfr0, ID_AA64PFR0, RAS) >= 2; | ||
665 | +} | ||
666 | + | ||
667 | +static inline bool isar_feature_aa64_sve(const ARMISARegisters *id) | ||
668 | +{ | ||
669 | + return FIELD_EX64(id->id_aa64pfr0, ID_AA64PFR0, SVE) != 0; | ||
670 | +} | ||
671 | + | ||
672 | +static inline bool isar_feature_aa64_sel2(const ARMISARegisters *id) | ||
673 | +{ | ||
674 | + return FIELD_EX64(id->id_aa64pfr0, ID_AA64PFR0, SEL2) != 0; | ||
675 | +} | ||
676 | + | ||
677 | +static inline bool isar_feature_aa64_rme(const ARMISARegisters *id) | ||
678 | +{ | ||
679 | + return FIELD_EX64(id->id_aa64pfr0, ID_AA64PFR0, RME) != 0; | ||
680 | +} | ||
681 | + | ||
682 | +static inline bool isar_feature_aa64_vh(const ARMISARegisters *id) | ||
683 | +{ | ||
684 | + return FIELD_EX64(id->id_aa64mmfr1, ID_AA64MMFR1, VH) != 0; | ||
685 | +} | ||
686 | + | ||
687 | +static inline bool isar_feature_aa64_lor(const ARMISARegisters *id) | ||
688 | +{ | ||
689 | + return FIELD_EX64(id->id_aa64mmfr1, ID_AA64MMFR1, LO) != 0; | ||
690 | +} | ||
691 | + | ||
692 | +static inline bool isar_feature_aa64_pan(const ARMISARegisters *id) | ||
693 | +{ | ||
694 | + return FIELD_EX64(id->id_aa64mmfr1, ID_AA64MMFR1, PAN) != 0; | ||
695 | +} | ||
696 | + | ||
697 | +static inline bool isar_feature_aa64_ats1e1(const ARMISARegisters *id) | ||
698 | +{ | ||
699 | + return FIELD_EX64(id->id_aa64mmfr1, ID_AA64MMFR1, PAN) >= 2; | ||
700 | +} | ||
701 | + | ||
702 | +static inline bool isar_feature_aa64_pan3(const ARMISARegisters *id) | ||
703 | +{ | ||
704 | + return FIELD_EX64(id->id_aa64mmfr1, ID_AA64MMFR1, PAN) >= 3; | ||
705 | +} | ||
706 | + | ||
707 | +static inline bool isar_feature_aa64_hcx(const ARMISARegisters *id) | ||
708 | +{ | ||
709 | + return FIELD_EX64(id->id_aa64mmfr1, ID_AA64MMFR1, HCX) != 0; | ||
710 | +} | ||
711 | + | ||
712 | +static inline bool isar_feature_aa64_tidcp1(const ARMISARegisters *id) | ||
713 | +{ | ||
714 | + return FIELD_EX64(id->id_aa64mmfr2, ID_AA64MMFR1, TIDCP1) != 0; | ||
715 | +} | ||
716 | + | ||
717 | +static inline bool isar_feature_aa64_uao(const ARMISARegisters *id) | ||
718 | +{ | ||
719 | + return FIELD_EX64(id->id_aa64mmfr2, ID_AA64MMFR2, UAO) != 0; | ||
720 | +} | ||
721 | + | ||
722 | +static inline bool isar_feature_aa64_st(const ARMISARegisters *id) | ||
723 | +{ | ||
724 | + return FIELD_EX64(id->id_aa64mmfr2, ID_AA64MMFR2, ST) != 0; | ||
725 | +} | ||
726 | + | ||
727 | +static inline bool isar_feature_aa64_lse2(const ARMISARegisters *id) | ||
728 | +{ | ||
729 | + return FIELD_EX64(id->id_aa64mmfr2, ID_AA64MMFR2, AT) != 0; | ||
730 | +} | ||
731 | + | ||
732 | +static inline bool isar_feature_aa64_fwb(const ARMISARegisters *id) | ||
733 | +{ | ||
734 | + return FIELD_EX64(id->id_aa64mmfr2, ID_AA64MMFR2, FWB) != 0; | ||
735 | +} | ||
736 | + | ||
737 | +static inline bool isar_feature_aa64_ids(const ARMISARegisters *id) | ||
738 | +{ | ||
739 | + return FIELD_EX64(id->id_aa64mmfr2, ID_AA64MMFR2, IDS) != 0; | ||
740 | +} | ||
741 | + | ||
742 | +static inline bool isar_feature_aa64_half_evt(const ARMISARegisters *id) | ||
743 | +{ | ||
744 | + return FIELD_EX64(id->id_aa64mmfr2, ID_AA64MMFR2, EVT) >= 1; | ||
745 | +} | ||
746 | + | ||
747 | +static inline bool isar_feature_aa64_evt(const ARMISARegisters *id) | ||
748 | +{ | ||
749 | + return FIELD_EX64(id->id_aa64mmfr2, ID_AA64MMFR2, EVT) >= 2; | ||
750 | +} | ||
751 | + | ||
752 | +static inline bool isar_feature_aa64_bti(const ARMISARegisters *id) | ||
753 | +{ | ||
754 | + return FIELD_EX64(id->id_aa64pfr1, ID_AA64PFR1, BT) != 0; | ||
755 | +} | ||
756 | + | ||
757 | +static inline bool isar_feature_aa64_mte_insn_reg(const ARMISARegisters *id) | ||
758 | +{ | ||
759 | + return FIELD_EX64(id->id_aa64pfr1, ID_AA64PFR1, MTE) != 0; | ||
760 | +} | ||
761 | + | ||
762 | +static inline bool isar_feature_aa64_mte(const ARMISARegisters *id) | ||
763 | +{ | ||
764 | + return FIELD_EX64(id->id_aa64pfr1, ID_AA64PFR1, MTE) >= 2; | ||
765 | +} | ||
766 | + | ||
767 | +static inline bool isar_feature_aa64_sme(const ARMISARegisters *id) | ||
768 | +{ | ||
769 | + return FIELD_EX64(id->id_aa64pfr1, ID_AA64PFR1, SME) != 0; | ||
770 | +} | ||
771 | + | ||
772 | +static inline bool isar_feature_aa64_pmuv3p1(const ARMISARegisters *id) | ||
773 | +{ | ||
774 | + return FIELD_EX64(id->id_aa64dfr0, ID_AA64DFR0, PMUVER) >= 4 && | ||
775 | + FIELD_EX64(id->id_aa64dfr0, ID_AA64DFR0, PMUVER) != 0xf; | ||
776 | +} | ||
777 | + | ||
778 | +static inline bool isar_feature_aa64_pmuv3p4(const ARMISARegisters *id) | ||
779 | +{ | ||
780 | + return FIELD_EX64(id->id_aa64dfr0, ID_AA64DFR0, PMUVER) >= 5 && | ||
781 | + FIELD_EX64(id->id_aa64dfr0, ID_AA64DFR0, PMUVER) != 0xf; | ||
782 | +} | ||
783 | + | ||
784 | +static inline bool isar_feature_aa64_pmuv3p5(const ARMISARegisters *id) | ||
785 | +{ | ||
786 | + return FIELD_EX64(id->id_aa64dfr0, ID_AA64DFR0, PMUVER) >= 6 && | ||
787 | + FIELD_EX64(id->id_aa64dfr0, ID_AA64DFR0, PMUVER) != 0xf; | ||
788 | +} | ||
789 | + | ||
790 | +static inline bool isar_feature_aa64_rcpc_8_3(const ARMISARegisters *id) | ||
791 | +{ | ||
792 | + return FIELD_EX64(id->id_aa64isar1, ID_AA64ISAR1, LRCPC) != 0; | ||
793 | +} | ||
794 | + | ||
795 | +static inline bool isar_feature_aa64_rcpc_8_4(const ARMISARegisters *id) | ||
796 | +{ | ||
797 | + return FIELD_EX64(id->id_aa64isar1, ID_AA64ISAR1, LRCPC) >= 2; | ||
798 | +} | ||
799 | + | ||
800 | +static inline bool isar_feature_aa64_i8mm(const ARMISARegisters *id) | ||
801 | +{ | ||
802 | + return FIELD_EX64(id->id_aa64isar1, ID_AA64ISAR1, I8MM) != 0; | ||
803 | +} | ||
804 | + | ||
805 | +static inline bool isar_feature_aa64_hbc(const ARMISARegisters *id) | ||
806 | +{ | ||
807 | + return FIELD_EX64(id->id_aa64isar2, ID_AA64ISAR2, BC) != 0; | ||
808 | +} | ||
809 | + | ||
810 | +static inline bool isar_feature_aa64_tgran4_lpa2(const ARMISARegisters *id) | ||
811 | +{ | ||
812 | + return FIELD_SEX64(id->id_aa64mmfr0, ID_AA64MMFR0, TGRAN4) >= 1; | ||
813 | +} | ||
814 | + | ||
815 | +static inline bool isar_feature_aa64_tgran4_2_lpa2(const ARMISARegisters *id) | ||
816 | +{ | ||
817 | + unsigned t = FIELD_EX64(id->id_aa64mmfr0, ID_AA64MMFR0, TGRAN4_2); | ||
818 | + return t >= 3 || (t == 0 && isar_feature_aa64_tgran4_lpa2(id)); | ||
819 | +} | ||
820 | + | ||
821 | +static inline bool isar_feature_aa64_tgran16_lpa2(const ARMISARegisters *id) | ||
822 | +{ | ||
823 | + return FIELD_EX64(id->id_aa64mmfr0, ID_AA64MMFR0, TGRAN16) >= 2; | ||
824 | +} | ||
825 | + | ||
826 | +static inline bool isar_feature_aa64_tgran16_2_lpa2(const ARMISARegisters *id) | ||
827 | +{ | ||
828 | + unsigned t = FIELD_EX64(id->id_aa64mmfr0, ID_AA64MMFR0, TGRAN16_2); | ||
829 | + return t >= 3 || (t == 0 && isar_feature_aa64_tgran16_lpa2(id)); | ||
830 | +} | ||
831 | + | ||
832 | +static inline bool isar_feature_aa64_tgran4(const ARMISARegisters *id) | ||
833 | +{ | ||
834 | + return FIELD_SEX64(id->id_aa64mmfr0, ID_AA64MMFR0, TGRAN4) >= 0; | ||
835 | +} | ||
836 | + | ||
837 | +static inline bool isar_feature_aa64_tgran16(const ARMISARegisters *id) | ||
838 | +{ | ||
839 | + return FIELD_EX64(id->id_aa64mmfr0, ID_AA64MMFR0, TGRAN16) >= 1; | ||
840 | +} | ||
841 | + | ||
842 | +static inline bool isar_feature_aa64_tgran64(const ARMISARegisters *id) | ||
843 | +{ | ||
844 | + return FIELD_SEX64(id->id_aa64mmfr0, ID_AA64MMFR0, TGRAN64) >= 0; | ||
845 | +} | ||
846 | + | ||
847 | +static inline bool isar_feature_aa64_tgran4_2(const ARMISARegisters *id) | ||
848 | +{ | ||
849 | + unsigned t = FIELD_EX64(id->id_aa64mmfr0, ID_AA64MMFR0, TGRAN4_2); | ||
850 | + return t >= 2 || (t == 0 && isar_feature_aa64_tgran4(id)); | ||
851 | +} | ||
852 | + | ||
853 | +static inline bool isar_feature_aa64_tgran16_2(const ARMISARegisters *id) | ||
854 | +{ | ||
855 | + unsigned t = FIELD_EX64(id->id_aa64mmfr0, ID_AA64MMFR0, TGRAN16_2); | ||
856 | + return t >= 2 || (t == 0 && isar_feature_aa64_tgran16(id)); | ||
857 | +} | ||
858 | + | ||
859 | +static inline bool isar_feature_aa64_tgran64_2(const ARMISARegisters *id) | ||
860 | +{ | ||
861 | + unsigned t = FIELD_EX64(id->id_aa64mmfr0, ID_AA64MMFR0, TGRAN64_2); | ||
862 | + return t >= 2 || (t == 0 && isar_feature_aa64_tgran64(id)); | ||
863 | +} | ||
864 | + | ||
865 | +static inline bool isar_feature_aa64_fgt(const ARMISARegisters *id) | ||
866 | +{ | ||
867 | + return FIELD_EX64(id->id_aa64mmfr0, ID_AA64MMFR0, FGT) != 0; | ||
868 | +} | ||
869 | + | ||
870 | +static inline bool isar_feature_aa64_ccidx(const ARMISARegisters *id) | ||
871 | +{ | ||
872 | + return FIELD_EX64(id->id_aa64mmfr2, ID_AA64MMFR2, CCIDX) != 0; | ||
873 | +} | ||
874 | + | ||
875 | +static inline bool isar_feature_aa64_lva(const ARMISARegisters *id) | ||
876 | +{ | ||
877 | + return FIELD_EX64(id->id_aa64mmfr2, ID_AA64MMFR2, VARANGE) != 0; | ||
878 | +} | ||
879 | + | ||
880 | +static inline bool isar_feature_aa64_e0pd(const ARMISARegisters *id) | ||
881 | +{ | ||
882 | + return FIELD_EX64(id->id_aa64mmfr2, ID_AA64MMFR2, E0PD) != 0; | ||
883 | +} | ||
884 | + | ||
885 | +static inline bool isar_feature_aa64_hafs(const ARMISARegisters *id) | ||
886 | +{ | ||
887 | + return FIELD_EX64(id->id_aa64mmfr1, ID_AA64MMFR1, HAFDBS) != 0; | ||
888 | +} | ||
889 | + | ||
890 | +static inline bool isar_feature_aa64_hdbs(const ARMISARegisters *id) | ||
891 | +{ | ||
892 | + return FIELD_EX64(id->id_aa64mmfr1, ID_AA64MMFR1, HAFDBS) >= 2; | ||
893 | +} | ||
894 | + | ||
895 | +static inline bool isar_feature_aa64_tts2uxn(const ARMISARegisters *id) | ||
896 | +{ | ||
897 | + return FIELD_EX64(id->id_aa64mmfr1, ID_AA64MMFR1, XNX) != 0; | ||
898 | +} | ||
899 | + | ||
900 | +static inline bool isar_feature_aa64_dit(const ARMISARegisters *id) | ||
901 | +{ | ||
902 | + return FIELD_EX64(id->id_aa64pfr0, ID_AA64PFR0, DIT) != 0; | ||
903 | +} | ||
904 | + | ||
905 | +static inline bool isar_feature_aa64_scxtnum(const ARMISARegisters *id) | ||
906 | +{ | ||
907 | + int key = FIELD_EX64(id->id_aa64pfr0, ID_AA64PFR0, CSV2); | ||
908 | + if (key >= 2) { | ||
909 | + return true; /* FEAT_CSV2_2 */ | ||
234 | + } | 910 | + } |
235 | + | 911 | + if (key == 1) { |
236 | /* | 912 | + key = FIELD_EX64(id->id_aa64pfr1, ID_AA64PFR1, CSV2_FRAC); |
237 | * TODO: Perhaps merge these into one decodetree output file. | 913 | + return key >= 2; /* FEAT_CSV2_1p2 */ |
238 | * Note disas_vfp is written for a32 with cond field in the | 914 | + } |
239 | @@ -XXX,XX +XXX,XX @@ static void disas_thumb2_insn(DisasContext *s, uint32_t insn) | 915 | + return false; |
240 | */ | 916 | +} |
241 | if (disas_t32(s, insn) || | 917 | + |
242 | disas_vfp_uncond(s, insn) || | 918 | +static inline bool isar_feature_aa64_ssbs(const ARMISARegisters *id) |
243 | + disas_neon_shared(s, insn) || | 919 | +{ |
244 | ((insn >> 28) == 0xe && disas_vfp(s, insn))) { | 920 | + return FIELD_EX64(id->id_aa64pfr1, ID_AA64PFR1, SSBS) != 0; |
245 | return; | 921 | +} |
246 | } | 922 | + |
247 | diff --git a/target/arm/Makefile.objs b/target/arm/Makefile.objs | 923 | +static inline bool isar_feature_aa64_debugv8p2(const ARMISARegisters *id) |
248 | index XXXXXXX..XXXXXXX 100644 | 924 | +{ |
249 | --- a/target/arm/Makefile.objs | 925 | + return FIELD_EX64(id->id_aa64dfr0, ID_AA64DFR0, DEBUGVER) >= 8; |
250 | +++ b/target/arm/Makefile.objs | 926 | +} |
251 | @@ -XXX,XX +XXX,XX @@ target/arm/decode-sve.inc.c: $(SRC_PATH)/target/arm/sve.decode $(DECODETREE) | 927 | + |
252 | $(PYTHON) $(DECODETREE) --decode disas_sve -o $@ $<,\ | 928 | +static inline bool isar_feature_aa64_sve2(const ARMISARegisters *id) |
253 | "GEN", $(TARGET_DIR)$@) | 929 | +{ |
254 | 930 | + return FIELD_EX64(id->id_aa64zfr0, ID_AA64ZFR0, SVEVER) != 0; | |
255 | +target/arm/decode-neon-shared.inc.c: $(SRC_PATH)/target/arm/neon-shared.decode $(DECODETREE) | 931 | +} |
256 | + $(call quiet-command,\ | 932 | + |
257 | + $(PYTHON) $(DECODETREE) --static-decode disas_neon_shared -o $@ $<,\ | 933 | +static inline bool isar_feature_aa64_sve2_aes(const ARMISARegisters *id) |
258 | + "GEN", $(TARGET_DIR)$@) | 934 | +{ |
259 | + | 935 | + return FIELD_EX64(id->id_aa64zfr0, ID_AA64ZFR0, AES) != 0; |
260 | +target/arm/decode-neon-dp.inc.c: $(SRC_PATH)/target/arm/neon-dp.decode $(DECODETREE) | 936 | +} |
261 | + $(call quiet-command,\ | 937 | + |
262 | + $(PYTHON) $(DECODETREE) --static-decode disas_neon_dp -o $@ $<,\ | 938 | +static inline bool isar_feature_aa64_sve2_pmull128(const ARMISARegisters *id) |
263 | + "GEN", $(TARGET_DIR)$@) | 939 | +{ |
264 | + | 940 | + return FIELD_EX64(id->id_aa64zfr0, ID_AA64ZFR0, AES) >= 2; |
265 | +target/arm/decode-neon-ls.inc.c: $(SRC_PATH)/target/arm/neon-ls.decode $(DECODETREE) | 941 | +} |
266 | + $(call quiet-command,\ | 942 | + |
267 | + $(PYTHON) $(DECODETREE) --static-decode disas_neon_ls -o $@ $<,\ | 943 | +static inline bool isar_feature_aa64_sve2_bitperm(const ARMISARegisters *id) |
268 | + "GEN", $(TARGET_DIR)$@) | 944 | +{ |
269 | + | 945 | + return FIELD_EX64(id->id_aa64zfr0, ID_AA64ZFR0, BITPERM) != 0; |
270 | target/arm/decode-vfp.inc.c: $(SRC_PATH)/target/arm/vfp.decode $(DECODETREE) | 946 | +} |
271 | $(call quiet-command,\ | 947 | + |
272 | $(PYTHON) $(DECODETREE) --static-decode disas_vfp -o $@ $<,\ | 948 | +static inline bool isar_feature_aa64_sve_bf16(const ARMISARegisters *id) |
273 | @@ -XXX,XX +XXX,XX @@ target/arm/decode-t16.inc.c: $(SRC_PATH)/target/arm/t16.decode $(DECODETREE) | 949 | +{ |
274 | "GEN", $(TARGET_DIR)$@) | 950 | + return FIELD_EX64(id->id_aa64zfr0, ID_AA64ZFR0, BFLOAT16) != 0; |
275 | 951 | +} | |
276 | target/arm/translate-sve.o: target/arm/decode-sve.inc.c | 952 | + |
277 | +target/arm/translate.o: target/arm/decode-neon-shared.inc.c | 953 | +static inline bool isar_feature_aa64_sve2_sha3(const ARMISARegisters *id) |
278 | +target/arm/translate.o: target/arm/decode-neon-dp.inc.c | 954 | +{ |
279 | +target/arm/translate.o: target/arm/decode-neon-ls.inc.c | 955 | + return FIELD_EX64(id->id_aa64zfr0, ID_AA64ZFR0, SHA3) != 0; |
280 | target/arm/translate.o: target/arm/decode-vfp.inc.c | 956 | +} |
281 | target/arm/translate.o: target/arm/decode-vfp-uncond.inc.c | 957 | + |
282 | target/arm/translate.o: target/arm/decode-a32.inc.c | 958 | +static inline bool isar_feature_aa64_sve2_sm4(const ARMISARegisters *id) |
959 | +{ | ||
960 | + return FIELD_EX64(id->id_aa64zfr0, ID_AA64ZFR0, SM4) != 0; | ||
961 | +} | ||
962 | + | ||
963 | +static inline bool isar_feature_aa64_sve_i8mm(const ARMISARegisters *id) | ||
964 | +{ | ||
965 | + return FIELD_EX64(id->id_aa64zfr0, ID_AA64ZFR0, I8MM) != 0; | ||
966 | +} | ||
967 | + | ||
968 | +static inline bool isar_feature_aa64_sve_f32mm(const ARMISARegisters *id) | ||
969 | +{ | ||
970 | + return FIELD_EX64(id->id_aa64zfr0, ID_AA64ZFR0, F32MM) != 0; | ||
971 | +} | ||
972 | + | ||
973 | +static inline bool isar_feature_aa64_sve_f64mm(const ARMISARegisters *id) | ||
974 | +{ | ||
975 | + return FIELD_EX64(id->id_aa64zfr0, ID_AA64ZFR0, F64MM) != 0; | ||
976 | +} | ||
977 | + | ||
978 | +static inline bool isar_feature_aa64_sme_f64f64(const ARMISARegisters *id) | ||
979 | +{ | ||
980 | + return FIELD_EX64(id->id_aa64smfr0, ID_AA64SMFR0, F64F64); | ||
981 | +} | ||
982 | + | ||
983 | +static inline bool isar_feature_aa64_sme_i16i64(const ARMISARegisters *id) | ||
984 | +{ | ||
985 | + return FIELD_EX64(id->id_aa64smfr0, ID_AA64SMFR0, I16I64) == 0xf; | ||
986 | +} | ||
987 | + | ||
988 | +static inline bool isar_feature_aa64_sme_fa64(const ARMISARegisters *id) | ||
989 | +{ | ||
990 | + return FIELD_EX64(id->id_aa64smfr0, ID_AA64SMFR0, FA64); | ||
991 | +} | ||
992 | + | ||
993 | +static inline bool isar_feature_aa64_doublelock(const ARMISARegisters *id) | ||
994 | +{ | ||
995 | + return FIELD_SEX64(id->id_aa64dfr0, ID_AA64DFR0, DOUBLELOCK) >= 0; | ||
996 | +} | ||
997 | + | ||
998 | +static inline bool isar_feature_aa64_mops(const ARMISARegisters *id) | ||
999 | +{ | ||
1000 | + return FIELD_EX64(id->id_aa64isar2, ID_AA64ISAR2, MOPS); | ||
1001 | +} | ||
1002 | + | ||
1003 | +/* | ||
1004 | + * Feature tests for "does this exist in either 32-bit or 64-bit?" | ||
1005 | + */ | ||
1006 | +static inline bool isar_feature_any_fp16(const ARMISARegisters *id) | ||
1007 | +{ | ||
1008 | + return isar_feature_aa64_fp16(id) || isar_feature_aa32_fp16_arith(id); | ||
1009 | +} | ||
1010 | + | ||
1011 | +static inline bool isar_feature_any_predinv(const ARMISARegisters *id) | ||
1012 | +{ | ||
1013 | + return isar_feature_aa64_predinv(id) || isar_feature_aa32_predinv(id); | ||
1014 | +} | ||
1015 | + | ||
1016 | +static inline bool isar_feature_any_pmuv3p1(const ARMISARegisters *id) | ||
1017 | +{ | ||
1018 | + return isar_feature_aa64_pmuv3p1(id) || isar_feature_aa32_pmuv3p1(id); | ||
1019 | +} | ||
1020 | + | ||
1021 | +static inline bool isar_feature_any_pmuv3p4(const ARMISARegisters *id) | ||
1022 | +{ | ||
1023 | + return isar_feature_aa64_pmuv3p4(id) || isar_feature_aa32_pmuv3p4(id); | ||
1024 | +} | ||
1025 | + | ||
1026 | +static inline bool isar_feature_any_pmuv3p5(const ARMISARegisters *id) | ||
1027 | +{ | ||
1028 | + return isar_feature_aa64_pmuv3p5(id) || isar_feature_aa32_pmuv3p5(id); | ||
1029 | +} | ||
1030 | + | ||
1031 | +static inline bool isar_feature_any_ccidx(const ARMISARegisters *id) | ||
1032 | +{ | ||
1033 | + return isar_feature_aa64_ccidx(id) || isar_feature_aa32_ccidx(id); | ||
1034 | +} | ||
1035 | + | ||
1036 | +static inline bool isar_feature_any_tts2uxn(const ARMISARegisters *id) | ||
1037 | +{ | ||
1038 | + return isar_feature_aa64_tts2uxn(id) || isar_feature_aa32_tts2uxn(id); | ||
1039 | +} | ||
1040 | + | ||
1041 | +static inline bool isar_feature_any_debugv8p2(const ARMISARegisters *id) | ||
1042 | +{ | ||
1043 | + return isar_feature_aa64_debugv8p2(id) || isar_feature_aa32_debugv8p2(id); | ||
1044 | +} | ||
1045 | + | ||
1046 | +static inline bool isar_feature_any_ras(const ARMISARegisters *id) | ||
1047 | +{ | ||
1048 | + return isar_feature_aa64_ras(id) || isar_feature_aa32_ras(id); | ||
1049 | +} | ||
1050 | + | ||
1051 | +static inline bool isar_feature_any_half_evt(const ARMISARegisters *id) | ||
1052 | +{ | ||
1053 | + return isar_feature_aa64_half_evt(id) || isar_feature_aa32_half_evt(id); | ||
1054 | +} | ||
1055 | + | ||
1056 | +static inline bool isar_feature_any_evt(const ARMISARegisters *id) | ||
1057 | +{ | ||
1058 | + return isar_feature_aa64_evt(id) || isar_feature_aa32_evt(id); | ||
1059 | +} | ||
1060 | + | ||
1061 | +/* | ||
1062 | + * Forward to the above feature tests given an ARMCPU pointer. | ||
1063 | + */ | ||
1064 | +#define cpu_isar_feature(name, cpu) \ | ||
1065 | + ({ ARMCPU *cpu_ = (cpu); isar_feature_##name(&cpu_->isar); }) | ||
1066 | + | ||
1067 | +#endif | ||
1068 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h | ||
1069 | index XXXXXXX..XXXXXXX 100644 | ||
1070 | --- a/target/arm/cpu.h | ||
1071 | +++ b/target/arm/cpu.h | ||
1072 | @@ -XXX,XX +XXX,XX @@ static inline target_ulong cpu_untagged_addr(CPUState *cs, target_ulong x) | ||
1073 | } | ||
1074 | #endif | ||
1075 | |||
1076 | -/* | ||
1077 | - * Naming convention for isar_feature functions: | ||
1078 | - * Functions which test 32-bit ID registers should have _aa32_ in | ||
1079 | - * their name. Functions which test 64-bit ID registers should have | ||
1080 | - * _aa64_ in their name. These must only be used in code where we | ||
1081 | - * know for certain that the CPU has AArch32 or AArch64 respectively | ||
1082 | - * or where the correct answer for a CPU which doesn't implement that | ||
1083 | - * CPU state is "false" (eg when generating A32 or A64 code, if adding | ||
1084 | - * system registers that are specific to that CPU state, for "should | ||
1085 | - * we let this system register bit be set" tests where the 32-bit | ||
1086 | - * flavour of the register doesn't have the bit, and so on). | ||
1087 | - * Functions which simply ask "does this feature exist at all" have | ||
1088 | - * _any_ in their name, and always return the logical OR of the _aa64_ | ||
1089 | - * and the _aa32_ function. | ||
1090 | - */ | ||
1091 | - | ||
1092 | -/* | ||
1093 | - * 32-bit feature tests via id registers. | ||
1094 | - */ | ||
1095 | -static inline bool isar_feature_aa32_thumb_div(const ARMISARegisters *id) | ||
1096 | -{ | ||
1097 | - return FIELD_EX32(id->id_isar0, ID_ISAR0, DIVIDE) != 0; | ||
1098 | -} | ||
1099 | - | ||
1100 | -static inline bool isar_feature_aa32_arm_div(const ARMISARegisters *id) | ||
1101 | -{ | ||
1102 | - return FIELD_EX32(id->id_isar0, ID_ISAR0, DIVIDE) > 1; | ||
1103 | -} | ||
1104 | - | ||
1105 | -static inline bool isar_feature_aa32_lob(const ARMISARegisters *id) | ||
1106 | -{ | ||
1107 | - /* (M-profile) low-overhead loops and branch future */ | ||
1108 | - return FIELD_EX32(id->id_isar0, ID_ISAR0, CMPBRANCH) >= 3; | ||
1109 | -} | ||
1110 | - | ||
1111 | -static inline bool isar_feature_aa32_jazelle(const ARMISARegisters *id) | ||
1112 | -{ | ||
1113 | - return FIELD_EX32(id->id_isar1, ID_ISAR1, JAZELLE) != 0; | ||
1114 | -} | ||
1115 | - | ||
1116 | -static inline bool isar_feature_aa32_aes(const ARMISARegisters *id) | ||
1117 | -{ | ||
1118 | - return FIELD_EX32(id->id_isar5, ID_ISAR5, AES) != 0; | ||
1119 | -} | ||
1120 | - | ||
1121 | -static inline bool isar_feature_aa32_pmull(const ARMISARegisters *id) | ||
1122 | -{ | ||
1123 | - return FIELD_EX32(id->id_isar5, ID_ISAR5, AES) > 1; | ||
1124 | -} | ||
1125 | - | ||
1126 | -static inline bool isar_feature_aa32_sha1(const ARMISARegisters *id) | ||
1127 | -{ | ||
1128 | - return FIELD_EX32(id->id_isar5, ID_ISAR5, SHA1) != 0; | ||
1129 | -} | ||
1130 | - | ||
1131 | -static inline bool isar_feature_aa32_sha2(const ARMISARegisters *id) | ||
1132 | -{ | ||
1133 | - return FIELD_EX32(id->id_isar5, ID_ISAR5, SHA2) != 0; | ||
1134 | -} | ||
1135 | - | ||
1136 | -static inline bool isar_feature_aa32_crc32(const ARMISARegisters *id) | ||
1137 | -{ | ||
1138 | - return FIELD_EX32(id->id_isar5, ID_ISAR5, CRC32) != 0; | ||
1139 | -} | ||
1140 | - | ||
1141 | -static inline bool isar_feature_aa32_rdm(const ARMISARegisters *id) | ||
1142 | -{ | ||
1143 | - return FIELD_EX32(id->id_isar5, ID_ISAR5, RDM) != 0; | ||
1144 | -} | ||
1145 | - | ||
1146 | -static inline bool isar_feature_aa32_vcma(const ARMISARegisters *id) | ||
1147 | -{ | ||
1148 | - return FIELD_EX32(id->id_isar5, ID_ISAR5, VCMA) != 0; | ||
1149 | -} | ||
1150 | - | ||
1151 | -static inline bool isar_feature_aa32_jscvt(const ARMISARegisters *id) | ||
1152 | -{ | ||
1153 | - return FIELD_EX32(id->id_isar6, ID_ISAR6, JSCVT) != 0; | ||
1154 | -} | ||
1155 | - | ||
1156 | -static inline bool isar_feature_aa32_dp(const ARMISARegisters *id) | ||
1157 | -{ | ||
1158 | - return FIELD_EX32(id->id_isar6, ID_ISAR6, DP) != 0; | ||
1159 | -} | ||
1160 | - | ||
1161 | -static inline bool isar_feature_aa32_fhm(const ARMISARegisters *id) | ||
1162 | -{ | ||
1163 | - return FIELD_EX32(id->id_isar6, ID_ISAR6, FHM) != 0; | ||
1164 | -} | ||
1165 | - | ||
1166 | -static inline bool isar_feature_aa32_sb(const ARMISARegisters *id) | ||
1167 | -{ | ||
1168 | - return FIELD_EX32(id->id_isar6, ID_ISAR6, SB) != 0; | ||
1169 | -} | ||
1170 | - | ||
1171 | -static inline bool isar_feature_aa32_predinv(const ARMISARegisters *id) | ||
1172 | -{ | ||
1173 | - return FIELD_EX32(id->id_isar6, ID_ISAR6, SPECRES) != 0; | ||
1174 | -} | ||
1175 | - | ||
1176 | -static inline bool isar_feature_aa32_bf16(const ARMISARegisters *id) | ||
1177 | -{ | ||
1178 | - return FIELD_EX32(id->id_isar6, ID_ISAR6, BF16) != 0; | ||
1179 | -} | ||
1180 | - | ||
1181 | -static inline bool isar_feature_aa32_i8mm(const ARMISARegisters *id) | ||
1182 | -{ | ||
1183 | - return FIELD_EX32(id->id_isar6, ID_ISAR6, I8MM) != 0; | ||
1184 | -} | ||
1185 | - | ||
1186 | -static inline bool isar_feature_aa32_ras(const ARMISARegisters *id) | ||
1187 | -{ | ||
1188 | - return FIELD_EX32(id->id_pfr0, ID_PFR0, RAS) != 0; | ||
1189 | -} | ||
1190 | - | ||
1191 | -static inline bool isar_feature_aa32_mprofile(const ARMISARegisters *id) | ||
1192 | -{ | ||
1193 | - return FIELD_EX32(id->id_pfr1, ID_PFR1, MPROGMOD) != 0; | ||
1194 | -} | ||
1195 | - | ||
1196 | -static inline bool isar_feature_aa32_m_sec_state(const ARMISARegisters *id) | ||
1197 | -{ | ||
1198 | - /* | ||
1199 | - * Return true if M-profile state handling insns | ||
1200 | - * (VSCCLRM, CLRM, FPCTX access insns) are implemented | ||
1201 | - */ | ||
1202 | - return FIELD_EX32(id->id_pfr1, ID_PFR1, SECURITY) >= 3; | ||
1203 | -} | ||
1204 | - | ||
1205 | -static inline bool isar_feature_aa32_fp16_arith(const ARMISARegisters *id) | ||
1206 | -{ | ||
1207 | - /* Sadly this is encoded differently for A-profile and M-profile */ | ||
1208 | - if (isar_feature_aa32_mprofile(id)) { | ||
1209 | - return FIELD_EX32(id->mvfr1, MVFR1, FP16) > 0; | ||
1210 | - } else { | ||
1211 | - return FIELD_EX32(id->mvfr1, MVFR1, FPHP) >= 3; | ||
1212 | - } | ||
1213 | -} | ||
1214 | - | ||
1215 | -static inline bool isar_feature_aa32_mve(const ARMISARegisters *id) | ||
1216 | -{ | ||
1217 | - /* | ||
1218 | - * Return true if MVE is supported (either integer or floating point). | ||
1219 | - * We must check for M-profile as the MVFR1 field means something | ||
1220 | - * else for A-profile. | ||
1221 | - */ | ||
1222 | - return isar_feature_aa32_mprofile(id) && | ||
1223 | - FIELD_EX32(id->mvfr1, MVFR1, MVE) > 0; | ||
1224 | -} | ||
1225 | - | ||
1226 | -static inline bool isar_feature_aa32_mve_fp(const ARMISARegisters *id) | ||
1227 | -{ | ||
1228 | - /* | ||
1229 | - * Return true if MVE is supported (either integer or floating point). | ||
1230 | - * We must check for M-profile as the MVFR1 field means something | ||
1231 | - * else for A-profile. | ||
1232 | - */ | ||
1233 | - return isar_feature_aa32_mprofile(id) && | ||
1234 | - FIELD_EX32(id->mvfr1, MVFR1, MVE) >= 2; | ||
1235 | -} | ||
1236 | - | ||
1237 | -static inline bool isar_feature_aa32_vfp_simd(const ARMISARegisters *id) | ||
1238 | -{ | ||
1239 | - /* | ||
1240 | - * Return true if either VFP or SIMD is implemented. | ||
1241 | - * In this case, a minimum of VFP w/ D0-D15. | ||
1242 | - */ | ||
1243 | - return FIELD_EX32(id->mvfr0, MVFR0, SIMDREG) > 0; | ||
1244 | -} | ||
1245 | - | ||
1246 | -static inline bool isar_feature_aa32_simd_r32(const ARMISARegisters *id) | ||
1247 | -{ | ||
1248 | - /* Return true if D16-D31 are implemented */ | ||
1249 | - return FIELD_EX32(id->mvfr0, MVFR0, SIMDREG) >= 2; | ||
1250 | -} | ||
1251 | - | ||
1252 | -static inline bool isar_feature_aa32_fpshvec(const ARMISARegisters *id) | ||
1253 | -{ | ||
1254 | - return FIELD_EX32(id->mvfr0, MVFR0, FPSHVEC) > 0; | ||
1255 | -} | ||
1256 | - | ||
1257 | -static inline bool isar_feature_aa32_fpsp_v2(const ARMISARegisters *id) | ||
1258 | -{ | ||
1259 | - /* Return true if CPU supports single precision floating point, VFPv2 */ | ||
1260 | - return FIELD_EX32(id->mvfr0, MVFR0, FPSP) > 0; | ||
1261 | -} | ||
1262 | - | ||
1263 | -static inline bool isar_feature_aa32_fpsp_v3(const ARMISARegisters *id) | ||
1264 | -{ | ||
1265 | - /* Return true if CPU supports single precision floating point, VFPv3 */ | ||
1266 | - return FIELD_EX32(id->mvfr0, MVFR0, FPSP) >= 2; | ||
1267 | -} | ||
1268 | - | ||
1269 | -static inline bool isar_feature_aa32_fpdp_v2(const ARMISARegisters *id) | ||
1270 | -{ | ||
1271 | - /* Return true if CPU supports double precision floating point, VFPv2 */ | ||
1272 | - return FIELD_EX32(id->mvfr0, MVFR0, FPDP) > 0; | ||
1273 | -} | ||
1274 | - | ||
1275 | -static inline bool isar_feature_aa32_fpdp_v3(const ARMISARegisters *id) | ||
1276 | -{ | ||
1277 | - /* Return true if CPU supports double precision floating point, VFPv3 */ | ||
1278 | - return FIELD_EX32(id->mvfr0, MVFR0, FPDP) >= 2; | ||
1279 | -} | ||
1280 | - | ||
1281 | -static inline bool isar_feature_aa32_vfp(const ARMISARegisters *id) | ||
1282 | -{ | ||
1283 | - return isar_feature_aa32_fpsp_v2(id) || isar_feature_aa32_fpdp_v2(id); | ||
1284 | -} | ||
1285 | - | ||
1286 | -/* | ||
1287 | - * We always set the FP and SIMD FP16 fields to indicate identical | ||
1288 | - * levels of support (assuming SIMD is implemented at all), so | ||
1289 | - * we only need one set of accessors. | ||
1290 | - */ | ||
1291 | -static inline bool isar_feature_aa32_fp16_spconv(const ARMISARegisters *id) | ||
1292 | -{ | ||
1293 | - return FIELD_EX32(id->mvfr1, MVFR1, FPHP) > 0; | ||
1294 | -} | ||
1295 | - | ||
1296 | -static inline bool isar_feature_aa32_fp16_dpconv(const ARMISARegisters *id) | ||
1297 | -{ | ||
1298 | - return FIELD_EX32(id->mvfr1, MVFR1, FPHP) > 1; | ||
1299 | -} | ||
1300 | - | ||
1301 | -/* | ||
1302 | - * Note that this ID register field covers both VFP and Neon FMAC, | ||
1303 | - * so should usually be tested in combination with some other | ||
1304 | - * check that confirms the presence of whichever of VFP or Neon is | ||
1305 | - * relevant, to avoid accidentally enabling a Neon feature on | ||
1306 | - * a VFP-no-Neon core or vice-versa. | ||
1307 | - */ | ||
1308 | -static inline bool isar_feature_aa32_simdfmac(const ARMISARegisters *id) | ||
1309 | -{ | ||
1310 | - return FIELD_EX32(id->mvfr1, MVFR1, SIMDFMAC) != 0; | ||
1311 | -} | ||
1312 | - | ||
1313 | -static inline bool isar_feature_aa32_vsel(const ARMISARegisters *id) | ||
1314 | -{ | ||
1315 | - return FIELD_EX32(id->mvfr2, MVFR2, FPMISC) >= 1; | ||
1316 | -} | ||
1317 | - | ||
1318 | -static inline bool isar_feature_aa32_vcvt_dr(const ARMISARegisters *id) | ||
1319 | -{ | ||
1320 | - return FIELD_EX32(id->mvfr2, MVFR2, FPMISC) >= 2; | ||
1321 | -} | ||
1322 | - | ||
1323 | -static inline bool isar_feature_aa32_vrint(const ARMISARegisters *id) | ||
1324 | -{ | ||
1325 | - return FIELD_EX32(id->mvfr2, MVFR2, FPMISC) >= 3; | ||
1326 | -} | ||
1327 | - | ||
1328 | -static inline bool isar_feature_aa32_vminmaxnm(const ARMISARegisters *id) | ||
1329 | -{ | ||
1330 | - return FIELD_EX32(id->mvfr2, MVFR2, FPMISC) >= 4; | ||
1331 | -} | ||
1332 | - | ||
1333 | -static inline bool isar_feature_aa32_pxn(const ARMISARegisters *id) | ||
1334 | -{ | ||
1335 | - return FIELD_EX32(id->id_mmfr0, ID_MMFR0, VMSA) >= 4; | ||
1336 | -} | ||
1337 | - | ||
1338 | -static inline bool isar_feature_aa32_pan(const ARMISARegisters *id) | ||
1339 | -{ | ||
1340 | - return FIELD_EX32(id->id_mmfr3, ID_MMFR3, PAN) != 0; | ||
1341 | -} | ||
1342 | - | ||
1343 | -static inline bool isar_feature_aa32_ats1e1(const ARMISARegisters *id) | ||
1344 | -{ | ||
1345 | - return FIELD_EX32(id->id_mmfr3, ID_MMFR3, PAN) >= 2; | ||
1346 | -} | ||
1347 | - | ||
1348 | -static inline bool isar_feature_aa32_pmuv3p1(const ARMISARegisters *id) | ||
1349 | -{ | ||
1350 | - /* 0xf means "non-standard IMPDEF PMU" */ | ||
1351 | - return FIELD_EX32(id->id_dfr0, ID_DFR0, PERFMON) >= 4 && | ||
1352 | - FIELD_EX32(id->id_dfr0, ID_DFR0, PERFMON) != 0xf; | ||
1353 | -} | ||
1354 | - | ||
1355 | -static inline bool isar_feature_aa32_pmuv3p4(const ARMISARegisters *id) | ||
1356 | -{ | ||
1357 | - /* 0xf means "non-standard IMPDEF PMU" */ | ||
1358 | - return FIELD_EX32(id->id_dfr0, ID_DFR0, PERFMON) >= 5 && | ||
1359 | - FIELD_EX32(id->id_dfr0, ID_DFR0, PERFMON) != 0xf; | ||
1360 | -} | ||
1361 | - | ||
1362 | -static inline bool isar_feature_aa32_pmuv3p5(const ARMISARegisters *id) | ||
1363 | -{ | ||
1364 | - /* 0xf means "non-standard IMPDEF PMU" */ | ||
1365 | - return FIELD_EX32(id->id_dfr0, ID_DFR0, PERFMON) >= 6 && | ||
1366 | - FIELD_EX32(id->id_dfr0, ID_DFR0, PERFMON) != 0xf; | ||
1367 | -} | ||
1368 | - | ||
1369 | -static inline bool isar_feature_aa32_hpd(const ARMISARegisters *id) | ||
1370 | -{ | ||
1371 | - return FIELD_EX32(id->id_mmfr4, ID_MMFR4, HPDS) != 0; | ||
1372 | -} | ||
1373 | - | ||
1374 | -static inline bool isar_feature_aa32_ac2(const ARMISARegisters *id) | ||
1375 | -{ | ||
1376 | - return FIELD_EX32(id->id_mmfr4, ID_MMFR4, AC2) != 0; | ||
1377 | -} | ||
1378 | - | ||
1379 | -static inline bool isar_feature_aa32_ccidx(const ARMISARegisters *id) | ||
1380 | -{ | ||
1381 | - return FIELD_EX32(id->id_mmfr4, ID_MMFR4, CCIDX) != 0; | ||
1382 | -} | ||
1383 | - | ||
1384 | -static inline bool isar_feature_aa32_tts2uxn(const ARMISARegisters *id) | ||
1385 | -{ | ||
1386 | - return FIELD_EX32(id->id_mmfr4, ID_MMFR4, XNX) != 0; | ||
1387 | -} | ||
1388 | - | ||
1389 | -static inline bool isar_feature_aa32_half_evt(const ARMISARegisters *id) | ||
1390 | -{ | ||
1391 | - return FIELD_EX32(id->id_mmfr4, ID_MMFR4, EVT) >= 1; | ||
1392 | -} | ||
1393 | - | ||
1394 | -static inline bool isar_feature_aa32_evt(const ARMISARegisters *id) | ||
1395 | -{ | ||
1396 | - return FIELD_EX32(id->id_mmfr4, ID_MMFR4, EVT) >= 2; | ||
1397 | -} | ||
1398 | - | ||
1399 | -static inline bool isar_feature_aa32_dit(const ARMISARegisters *id) | ||
1400 | -{ | ||
1401 | - return FIELD_EX32(id->id_pfr0, ID_PFR0, DIT) != 0; | ||
1402 | -} | ||
1403 | - | ||
1404 | -static inline bool isar_feature_aa32_ssbs(const ARMISARegisters *id) | ||
1405 | -{ | ||
1406 | - return FIELD_EX32(id->id_pfr2, ID_PFR2, SSBS) != 0; | ||
1407 | -} | ||
1408 | - | ||
1409 | -static inline bool isar_feature_aa32_debugv7p1(const ARMISARegisters *id) | ||
1410 | -{ | ||
1411 | - return FIELD_EX32(id->id_dfr0, ID_DFR0, COPDBG) >= 5; | ||
1412 | -} | ||
1413 | - | ||
1414 | -static inline bool isar_feature_aa32_debugv8p2(const ARMISARegisters *id) | ||
1415 | -{ | ||
1416 | - return FIELD_EX32(id->id_dfr0, ID_DFR0, COPDBG) >= 8; | ||
1417 | -} | ||
1418 | - | ||
1419 | -static inline bool isar_feature_aa32_doublelock(const ARMISARegisters *id) | ||
1420 | -{ | ||
1421 | - return FIELD_EX32(id->dbgdevid, DBGDEVID, DOUBLELOCK) > 0; | ||
1422 | -} | ||
1423 | - | ||
1424 | -/* | ||
1425 | - * 64-bit feature tests via id registers. | ||
1426 | - */ | ||
1427 | -static inline bool isar_feature_aa64_aes(const ARMISARegisters *id) | ||
1428 | -{ | ||
1429 | - return FIELD_EX64(id->id_aa64isar0, ID_AA64ISAR0, AES) != 0; | ||
1430 | -} | ||
1431 | - | ||
1432 | -static inline bool isar_feature_aa64_pmull(const ARMISARegisters *id) | ||
1433 | -{ | ||
1434 | - return FIELD_EX64(id->id_aa64isar0, ID_AA64ISAR0, AES) > 1; | ||
1435 | -} | ||
1436 | - | ||
1437 | -static inline bool isar_feature_aa64_sha1(const ARMISARegisters *id) | ||
1438 | -{ | ||
1439 | - return FIELD_EX64(id->id_aa64isar0, ID_AA64ISAR0, SHA1) != 0; | ||
1440 | -} | ||
1441 | - | ||
1442 | -static inline bool isar_feature_aa64_sha256(const ARMISARegisters *id) | ||
1443 | -{ | ||
1444 | - return FIELD_EX64(id->id_aa64isar0, ID_AA64ISAR0, SHA2) != 0; | ||
1445 | -} | ||
1446 | - | ||
1447 | -static inline bool isar_feature_aa64_sha512(const ARMISARegisters *id) | ||
1448 | -{ | ||
1449 | - return FIELD_EX64(id->id_aa64isar0, ID_AA64ISAR0, SHA2) > 1; | ||
1450 | -} | ||
1451 | - | ||
1452 | -static inline bool isar_feature_aa64_crc32(const ARMISARegisters *id) | ||
1453 | -{ | ||
1454 | - return FIELD_EX64(id->id_aa64isar0, ID_AA64ISAR0, CRC32) != 0; | ||
1455 | -} | ||
1456 | - | ||
1457 | -static inline bool isar_feature_aa64_atomics(const ARMISARegisters *id) | ||
1458 | -{ | ||
1459 | - return FIELD_EX64(id->id_aa64isar0, ID_AA64ISAR0, ATOMIC) != 0; | ||
1460 | -} | ||
1461 | - | ||
1462 | -static inline bool isar_feature_aa64_rdm(const ARMISARegisters *id) | ||
1463 | -{ | ||
1464 | - return FIELD_EX64(id->id_aa64isar0, ID_AA64ISAR0, RDM) != 0; | ||
1465 | -} | ||
1466 | - | ||
1467 | -static inline bool isar_feature_aa64_sha3(const ARMISARegisters *id) | ||
1468 | -{ | ||
1469 | - return FIELD_EX64(id->id_aa64isar0, ID_AA64ISAR0, SHA3) != 0; | ||
1470 | -} | ||
1471 | - | ||
1472 | -static inline bool isar_feature_aa64_sm3(const ARMISARegisters *id) | ||
1473 | -{ | ||
1474 | - return FIELD_EX64(id->id_aa64isar0, ID_AA64ISAR0, SM3) != 0; | ||
1475 | -} | ||
1476 | - | ||
1477 | -static inline bool isar_feature_aa64_sm4(const ARMISARegisters *id) | ||
1478 | -{ | ||
1479 | - return FIELD_EX64(id->id_aa64isar0, ID_AA64ISAR0, SM4) != 0; | ||
1480 | -} | ||
1481 | - | ||
1482 | -static inline bool isar_feature_aa64_dp(const ARMISARegisters *id) | ||
1483 | -{ | ||
1484 | - return FIELD_EX64(id->id_aa64isar0, ID_AA64ISAR0, DP) != 0; | ||
1485 | -} | ||
1486 | - | ||
1487 | -static inline bool isar_feature_aa64_fhm(const ARMISARegisters *id) | ||
1488 | -{ | ||
1489 | - return FIELD_EX64(id->id_aa64isar0, ID_AA64ISAR0, FHM) != 0; | ||
1490 | -} | ||
1491 | - | ||
1492 | -static inline bool isar_feature_aa64_condm_4(const ARMISARegisters *id) | ||
1493 | -{ | ||
1494 | - return FIELD_EX64(id->id_aa64isar0, ID_AA64ISAR0, TS) != 0; | ||
1495 | -} | ||
1496 | - | ||
1497 | -static inline bool isar_feature_aa64_condm_5(const ARMISARegisters *id) | ||
1498 | -{ | ||
1499 | - return FIELD_EX64(id->id_aa64isar0, ID_AA64ISAR0, TS) >= 2; | ||
1500 | -} | ||
1501 | - | ||
1502 | -static inline bool isar_feature_aa64_rndr(const ARMISARegisters *id) | ||
1503 | -{ | ||
1504 | - return FIELD_EX64(id->id_aa64isar0, ID_AA64ISAR0, RNDR) != 0; | ||
1505 | -} | ||
1506 | - | ||
1507 | -static inline bool isar_feature_aa64_jscvt(const ARMISARegisters *id) | ||
1508 | -{ | ||
1509 | - return FIELD_EX64(id->id_aa64isar1, ID_AA64ISAR1, JSCVT) != 0; | ||
1510 | -} | ||
1511 | - | ||
1512 | -static inline bool isar_feature_aa64_fcma(const ARMISARegisters *id) | ||
1513 | -{ | ||
1514 | - return FIELD_EX64(id->id_aa64isar1, ID_AA64ISAR1, FCMA) != 0; | ||
1515 | -} | ||
1516 | - | ||
1517 | -/* | ||
1518 | - * These are the values from APA/API/APA3. | ||
1519 | - * In general these must be compared '>=', per the normal Arm ARM | ||
1520 | - * treatment of fields in ID registers. | ||
1521 | - */ | ||
1522 | -typedef enum { | ||
1523 | - PauthFeat_None = 0, | ||
1524 | - PauthFeat_1 = 1, | ||
1525 | - PauthFeat_EPAC = 2, | ||
1526 | - PauthFeat_2 = 3, | ||
1527 | - PauthFeat_FPAC = 4, | ||
1528 | - PauthFeat_FPACCOMBINED = 5, | ||
1529 | -} ARMPauthFeature; | ||
1530 | - | ||
1531 | -static inline ARMPauthFeature | ||
1532 | -isar_feature_pauth_feature(const ARMISARegisters *id) | ||
1533 | -{ | ||
1534 | - /* | ||
1535 | - * Architecturally, only one of {APA,API,APA3} may be active (non-zero) | ||
1536 | - * and the other two must be zero. Thus we may avoid conditionals. | ||
1537 | - */ | ||
1538 | - return (FIELD_EX64(id->id_aa64isar1, ID_AA64ISAR1, APA) | | ||
1539 | - FIELD_EX64(id->id_aa64isar1, ID_AA64ISAR1, API) | | ||
1540 | - FIELD_EX64(id->id_aa64isar2, ID_AA64ISAR2, APA3)); | ||
1541 | -} | ||
1542 | - | ||
1543 | -static inline bool isar_feature_aa64_pauth(const ARMISARegisters *id) | ||
1544 | -{ | ||
1545 | - /* | ||
1546 | - * Return true if any form of pauth is enabled, as this | ||
1547 | - * predicate controls migration of the 128-bit keys. | ||
1548 | - */ | ||
1549 | - return isar_feature_pauth_feature(id) != PauthFeat_None; | ||
1550 | -} | ||
1551 | - | ||
1552 | -static inline bool isar_feature_aa64_pauth_qarma5(const ARMISARegisters *id) | ||
1553 | -{ | ||
1554 | - /* | ||
1555 | - * Return true if pauth is enabled with the architected QARMA5 algorithm. | ||
1556 | - * QEMU will always enable or disable both APA and GPA. | ||
1557 | - */ | ||
1558 | - return FIELD_EX64(id->id_aa64isar1, ID_AA64ISAR1, APA) != 0; | ||
1559 | -} | ||
1560 | - | ||
1561 | -static inline bool isar_feature_aa64_pauth_qarma3(const ARMISARegisters *id) | ||
1562 | -{ | ||
1563 | - /* | ||
1564 | - * Return true if pauth is enabled with the architected QARMA3 algorithm. | ||
1565 | - * QEMU will always enable or disable both APA3 and GPA3. | ||
1566 | - */ | ||
1567 | - return FIELD_EX64(id->id_aa64isar2, ID_AA64ISAR2, APA3) != 0; | ||
1568 | -} | ||
1569 | - | ||
1570 | -static inline bool isar_feature_aa64_tlbirange(const ARMISARegisters *id) | ||
1571 | -{ | ||
1572 | - return FIELD_EX64(id->id_aa64isar0, ID_AA64ISAR0, TLB) == 2; | ||
1573 | -} | ||
1574 | - | ||
1575 | -static inline bool isar_feature_aa64_tlbios(const ARMISARegisters *id) | ||
1576 | -{ | ||
1577 | - return FIELD_EX64(id->id_aa64isar0, ID_AA64ISAR0, TLB) != 0; | ||
1578 | -} | ||
1579 | - | ||
1580 | -static inline bool isar_feature_aa64_sb(const ARMISARegisters *id) | ||
1581 | -{ | ||
1582 | - return FIELD_EX64(id->id_aa64isar1, ID_AA64ISAR1, SB) != 0; | ||
1583 | -} | ||
1584 | - | ||
1585 | -static inline bool isar_feature_aa64_predinv(const ARMISARegisters *id) | ||
1586 | -{ | ||
1587 | - return FIELD_EX64(id->id_aa64isar1, ID_AA64ISAR1, SPECRES) != 0; | ||
1588 | -} | ||
1589 | - | ||
1590 | -static inline bool isar_feature_aa64_frint(const ARMISARegisters *id) | ||
1591 | -{ | ||
1592 | - return FIELD_EX64(id->id_aa64isar1, ID_AA64ISAR1, FRINTTS) != 0; | ||
1593 | -} | ||
1594 | - | ||
1595 | -static inline bool isar_feature_aa64_dcpop(const ARMISARegisters *id) | ||
1596 | -{ | ||
1597 | - return FIELD_EX64(id->id_aa64isar1, ID_AA64ISAR1, DPB) != 0; | ||
1598 | -} | ||
1599 | - | ||
1600 | -static inline bool isar_feature_aa64_dcpodp(const ARMISARegisters *id) | ||
1601 | -{ | ||
1602 | - return FIELD_EX64(id->id_aa64isar1, ID_AA64ISAR1, DPB) >= 2; | ||
1603 | -} | ||
1604 | - | ||
1605 | -static inline bool isar_feature_aa64_bf16(const ARMISARegisters *id) | ||
1606 | -{ | ||
1607 | - return FIELD_EX64(id->id_aa64isar1, ID_AA64ISAR1, BF16) != 0; | ||
1608 | -} | ||
1609 | - | ||
1610 | -static inline bool isar_feature_aa64_fp_simd(const ARMISARegisters *id) | ||
1611 | -{ | ||
1612 | - /* We always set the AdvSIMD and FP fields identically. */ | ||
1613 | - return FIELD_EX64(id->id_aa64pfr0, ID_AA64PFR0, FP) != 0xf; | ||
1614 | -} | ||
1615 | - | ||
1616 | -static inline bool isar_feature_aa64_fp16(const ARMISARegisters *id) | ||
1617 | -{ | ||
1618 | - /* We always set the AdvSIMD and FP fields identically wrt FP16. */ | ||
1619 | - return FIELD_EX64(id->id_aa64pfr0, ID_AA64PFR0, FP) == 1; | ||
1620 | -} | ||
1621 | - | ||
1622 | -static inline bool isar_feature_aa64_aa32(const ARMISARegisters *id) | ||
1623 | -{ | ||
1624 | - return FIELD_EX64(id->id_aa64pfr0, ID_AA64PFR0, EL0) >= 2; | ||
1625 | -} | ||
1626 | - | ||
1627 | -static inline bool isar_feature_aa64_aa32_el1(const ARMISARegisters *id) | ||
1628 | -{ | ||
1629 | - return FIELD_EX64(id->id_aa64pfr0, ID_AA64PFR0, EL1) >= 2; | ||
1630 | -} | ||
1631 | - | ||
1632 | -static inline bool isar_feature_aa64_aa32_el2(const ARMISARegisters *id) | ||
1633 | -{ | ||
1634 | - return FIELD_EX64(id->id_aa64pfr0, ID_AA64PFR0, EL2) >= 2; | ||
1635 | -} | ||
1636 | - | ||
1637 | -static inline bool isar_feature_aa64_ras(const ARMISARegisters *id) | ||
1638 | -{ | ||
1639 | - return FIELD_EX64(id->id_aa64pfr0, ID_AA64PFR0, RAS) != 0; | ||
1640 | -} | ||
1641 | - | ||
1642 | -static inline bool isar_feature_aa64_doublefault(const ARMISARegisters *id) | ||
1643 | -{ | ||
1644 | - return FIELD_EX64(id->id_aa64pfr0, ID_AA64PFR0, RAS) >= 2; | ||
1645 | -} | ||
1646 | - | ||
1647 | -static inline bool isar_feature_aa64_sve(const ARMISARegisters *id) | ||
1648 | -{ | ||
1649 | - return FIELD_EX64(id->id_aa64pfr0, ID_AA64PFR0, SVE) != 0; | ||
1650 | -} | ||
1651 | - | ||
1652 | -static inline bool isar_feature_aa64_sel2(const ARMISARegisters *id) | ||
1653 | -{ | ||
1654 | - return FIELD_EX64(id->id_aa64pfr0, ID_AA64PFR0, SEL2) != 0; | ||
1655 | -} | ||
1656 | - | ||
1657 | -static inline bool isar_feature_aa64_rme(const ARMISARegisters *id) | ||
1658 | -{ | ||
1659 | - return FIELD_EX64(id->id_aa64pfr0, ID_AA64PFR0, RME) != 0; | ||
1660 | -} | ||
1661 | - | ||
1662 | -static inline bool isar_feature_aa64_vh(const ARMISARegisters *id) | ||
1663 | -{ | ||
1664 | - return FIELD_EX64(id->id_aa64mmfr1, ID_AA64MMFR1, VH) != 0; | ||
1665 | -} | ||
1666 | - | ||
1667 | -static inline bool isar_feature_aa64_lor(const ARMISARegisters *id) | ||
1668 | -{ | ||
1669 | - return FIELD_EX64(id->id_aa64mmfr1, ID_AA64MMFR1, LO) != 0; | ||
1670 | -} | ||
1671 | - | ||
1672 | -static inline bool isar_feature_aa64_pan(const ARMISARegisters *id) | ||
1673 | -{ | ||
1674 | - return FIELD_EX64(id->id_aa64mmfr1, ID_AA64MMFR1, PAN) != 0; | ||
1675 | -} | ||
1676 | - | ||
1677 | -static inline bool isar_feature_aa64_ats1e1(const ARMISARegisters *id) | ||
1678 | -{ | ||
1679 | - return FIELD_EX64(id->id_aa64mmfr1, ID_AA64MMFR1, PAN) >= 2; | ||
1680 | -} | ||
1681 | - | ||
1682 | -static inline bool isar_feature_aa64_pan3(const ARMISARegisters *id) | ||
1683 | -{ | ||
1684 | - return FIELD_EX64(id->id_aa64mmfr1, ID_AA64MMFR1, PAN) >= 3; | ||
1685 | -} | ||
1686 | - | ||
1687 | -static inline bool isar_feature_aa64_hcx(const ARMISARegisters *id) | ||
1688 | -{ | ||
1689 | - return FIELD_EX64(id->id_aa64mmfr1, ID_AA64MMFR1, HCX) != 0; | ||
1690 | -} | ||
1691 | - | ||
1692 | -static inline bool isar_feature_aa64_tidcp1(const ARMISARegisters *id) | ||
1693 | -{ | ||
1694 | - return FIELD_EX64(id->id_aa64mmfr2, ID_AA64MMFR1, TIDCP1) != 0; | ||
1695 | -} | ||
1696 | - | ||
1697 | -static inline bool isar_feature_aa64_uao(const ARMISARegisters *id) | ||
1698 | -{ | ||
1699 | - return FIELD_EX64(id->id_aa64mmfr2, ID_AA64MMFR2, UAO) != 0; | ||
1700 | -} | ||
1701 | - | ||
1702 | -static inline bool isar_feature_aa64_st(const ARMISARegisters *id) | ||
1703 | -{ | ||
1704 | - return FIELD_EX64(id->id_aa64mmfr2, ID_AA64MMFR2, ST) != 0; | ||
1705 | -} | ||
1706 | - | ||
1707 | -static inline bool isar_feature_aa64_lse2(const ARMISARegisters *id) | ||
1708 | -{ | ||
1709 | - return FIELD_EX64(id->id_aa64mmfr2, ID_AA64MMFR2, AT) != 0; | ||
1710 | -} | ||
1711 | - | ||
1712 | -static inline bool isar_feature_aa64_fwb(const ARMISARegisters *id) | ||
1713 | -{ | ||
1714 | - return FIELD_EX64(id->id_aa64mmfr2, ID_AA64MMFR2, FWB) != 0; | ||
1715 | -} | ||
1716 | - | ||
1717 | -static inline bool isar_feature_aa64_ids(const ARMISARegisters *id) | ||
1718 | -{ | ||
1719 | - return FIELD_EX64(id->id_aa64mmfr2, ID_AA64MMFR2, IDS) != 0; | ||
1720 | -} | ||
1721 | - | ||
1722 | -static inline bool isar_feature_aa64_half_evt(const ARMISARegisters *id) | ||
1723 | -{ | ||
1724 | - return FIELD_EX64(id->id_aa64mmfr2, ID_AA64MMFR2, EVT) >= 1; | ||
1725 | -} | ||
1726 | - | ||
1727 | -static inline bool isar_feature_aa64_evt(const ARMISARegisters *id) | ||
1728 | -{ | ||
1729 | - return FIELD_EX64(id->id_aa64mmfr2, ID_AA64MMFR2, EVT) >= 2; | ||
1730 | -} | ||
1731 | - | ||
1732 | -static inline bool isar_feature_aa64_bti(const ARMISARegisters *id) | ||
1733 | -{ | ||
1734 | - return FIELD_EX64(id->id_aa64pfr1, ID_AA64PFR1, BT) != 0; | ||
1735 | -} | ||
1736 | - | ||
1737 | -static inline bool isar_feature_aa64_mte_insn_reg(const ARMISARegisters *id) | ||
1738 | -{ | ||
1739 | - return FIELD_EX64(id->id_aa64pfr1, ID_AA64PFR1, MTE) != 0; | ||
1740 | -} | ||
1741 | - | ||
1742 | -static inline bool isar_feature_aa64_mte(const ARMISARegisters *id) | ||
1743 | -{ | ||
1744 | - return FIELD_EX64(id->id_aa64pfr1, ID_AA64PFR1, MTE) >= 2; | ||
1745 | -} | ||
1746 | - | ||
1747 | -static inline bool isar_feature_aa64_sme(const ARMISARegisters *id) | ||
1748 | -{ | ||
1749 | - return FIELD_EX64(id->id_aa64pfr1, ID_AA64PFR1, SME) != 0; | ||
1750 | -} | ||
1751 | - | ||
1752 | -static inline bool isar_feature_aa64_pmuv3p1(const ARMISARegisters *id) | ||
1753 | -{ | ||
1754 | - return FIELD_EX64(id->id_aa64dfr0, ID_AA64DFR0, PMUVER) >= 4 && | ||
1755 | - FIELD_EX64(id->id_aa64dfr0, ID_AA64DFR0, PMUVER) != 0xf; | ||
1756 | -} | ||
1757 | - | ||
1758 | -static inline bool isar_feature_aa64_pmuv3p4(const ARMISARegisters *id) | ||
1759 | -{ | ||
1760 | - return FIELD_EX64(id->id_aa64dfr0, ID_AA64DFR0, PMUVER) >= 5 && | ||
1761 | - FIELD_EX64(id->id_aa64dfr0, ID_AA64DFR0, PMUVER) != 0xf; | ||
1762 | -} | ||
1763 | - | ||
1764 | -static inline bool isar_feature_aa64_pmuv3p5(const ARMISARegisters *id) | ||
1765 | -{ | ||
1766 | - return FIELD_EX64(id->id_aa64dfr0, ID_AA64DFR0, PMUVER) >= 6 && | ||
1767 | - FIELD_EX64(id->id_aa64dfr0, ID_AA64DFR0, PMUVER) != 0xf; | ||
1768 | -} | ||
1769 | - | ||
1770 | -static inline bool isar_feature_aa64_rcpc_8_3(const ARMISARegisters *id) | ||
1771 | -{ | ||
1772 | - return FIELD_EX64(id->id_aa64isar1, ID_AA64ISAR1, LRCPC) != 0; | ||
1773 | -} | ||
1774 | - | ||
1775 | -static inline bool isar_feature_aa64_rcpc_8_4(const ARMISARegisters *id) | ||
1776 | -{ | ||
1777 | - return FIELD_EX64(id->id_aa64isar1, ID_AA64ISAR1, LRCPC) >= 2; | ||
1778 | -} | ||
1779 | - | ||
1780 | -static inline bool isar_feature_aa64_i8mm(const ARMISARegisters *id) | ||
1781 | -{ | ||
1782 | - return FIELD_EX64(id->id_aa64isar1, ID_AA64ISAR1, I8MM) != 0; | ||
1783 | -} | ||
1784 | - | ||
1785 | -static inline bool isar_feature_aa64_hbc(const ARMISARegisters *id) | ||
1786 | -{ | ||
1787 | - return FIELD_EX64(id->id_aa64isar2, ID_AA64ISAR2, BC) != 0; | ||
1788 | -} | ||
1789 | - | ||
1790 | -static inline bool isar_feature_aa64_tgran4_lpa2(const ARMISARegisters *id) | ||
1791 | -{ | ||
1792 | - return FIELD_SEX64(id->id_aa64mmfr0, ID_AA64MMFR0, TGRAN4) >= 1; | ||
1793 | -} | ||
1794 | - | ||
1795 | -static inline bool isar_feature_aa64_tgran4_2_lpa2(const ARMISARegisters *id) | ||
1796 | -{ | ||
1797 | - unsigned t = FIELD_EX64(id->id_aa64mmfr0, ID_AA64MMFR0, TGRAN4_2); | ||
1798 | - return t >= 3 || (t == 0 && isar_feature_aa64_tgran4_lpa2(id)); | ||
1799 | -} | ||
1800 | - | ||
1801 | -static inline bool isar_feature_aa64_tgran16_lpa2(const ARMISARegisters *id) | ||
1802 | -{ | ||
1803 | - return FIELD_EX64(id->id_aa64mmfr0, ID_AA64MMFR0, TGRAN16) >= 2; | ||
1804 | -} | ||
1805 | - | ||
1806 | -static inline bool isar_feature_aa64_tgran16_2_lpa2(const ARMISARegisters *id) | ||
1807 | -{ | ||
1808 | - unsigned t = FIELD_EX64(id->id_aa64mmfr0, ID_AA64MMFR0, TGRAN16_2); | ||
1809 | - return t >= 3 || (t == 0 && isar_feature_aa64_tgran16_lpa2(id)); | ||
1810 | -} | ||
1811 | - | ||
1812 | -static inline bool isar_feature_aa64_tgran4(const ARMISARegisters *id) | ||
1813 | -{ | ||
1814 | - return FIELD_SEX64(id->id_aa64mmfr0, ID_AA64MMFR0, TGRAN4) >= 0; | ||
1815 | -} | ||
1816 | - | ||
1817 | -static inline bool isar_feature_aa64_tgran16(const ARMISARegisters *id) | ||
1818 | -{ | ||
1819 | - return FIELD_EX64(id->id_aa64mmfr0, ID_AA64MMFR0, TGRAN16) >= 1; | ||
1820 | -} | ||
1821 | - | ||
1822 | -static inline bool isar_feature_aa64_tgran64(const ARMISARegisters *id) | ||
1823 | -{ | ||
1824 | - return FIELD_SEX64(id->id_aa64mmfr0, ID_AA64MMFR0, TGRAN64) >= 0; | ||
1825 | -} | ||
1826 | - | ||
1827 | -static inline bool isar_feature_aa64_tgran4_2(const ARMISARegisters *id) | ||
1828 | -{ | ||
1829 | - unsigned t = FIELD_EX64(id->id_aa64mmfr0, ID_AA64MMFR0, TGRAN4_2); | ||
1830 | - return t >= 2 || (t == 0 && isar_feature_aa64_tgran4(id)); | ||
1831 | -} | ||
1832 | - | ||
1833 | -static inline bool isar_feature_aa64_tgran16_2(const ARMISARegisters *id) | ||
1834 | -{ | ||
1835 | - unsigned t = FIELD_EX64(id->id_aa64mmfr0, ID_AA64MMFR0, TGRAN16_2); | ||
1836 | - return t >= 2 || (t == 0 && isar_feature_aa64_tgran16(id)); | ||
1837 | -} | ||
1838 | - | ||
1839 | -static inline bool isar_feature_aa64_tgran64_2(const ARMISARegisters *id) | ||
1840 | -{ | ||
1841 | - unsigned t = FIELD_EX64(id->id_aa64mmfr0, ID_AA64MMFR0, TGRAN64_2); | ||
1842 | - return t >= 2 || (t == 0 && isar_feature_aa64_tgran64(id)); | ||
1843 | -} | ||
1844 | - | ||
1845 | -static inline bool isar_feature_aa64_fgt(const ARMISARegisters *id) | ||
1846 | -{ | ||
1847 | - return FIELD_EX64(id->id_aa64mmfr0, ID_AA64MMFR0, FGT) != 0; | ||
1848 | -} | ||
1849 | - | ||
1850 | -static inline bool isar_feature_aa64_ccidx(const ARMISARegisters *id) | ||
1851 | -{ | ||
1852 | - return FIELD_EX64(id->id_aa64mmfr2, ID_AA64MMFR2, CCIDX) != 0; | ||
1853 | -} | ||
1854 | - | ||
1855 | -static inline bool isar_feature_aa64_lva(const ARMISARegisters *id) | ||
1856 | -{ | ||
1857 | - return FIELD_EX64(id->id_aa64mmfr2, ID_AA64MMFR2, VARANGE) != 0; | ||
1858 | -} | ||
1859 | - | ||
1860 | -static inline bool isar_feature_aa64_e0pd(const ARMISARegisters *id) | ||
1861 | -{ | ||
1862 | - return FIELD_EX64(id->id_aa64mmfr2, ID_AA64MMFR2, E0PD) != 0; | ||
1863 | -} | ||
1864 | - | ||
1865 | -static inline bool isar_feature_aa64_hafs(const ARMISARegisters *id) | ||
1866 | -{ | ||
1867 | - return FIELD_EX64(id->id_aa64mmfr1, ID_AA64MMFR1, HAFDBS) != 0; | ||
1868 | -} | ||
1869 | - | ||
1870 | -static inline bool isar_feature_aa64_hdbs(const ARMISARegisters *id) | ||
1871 | -{ | ||
1872 | - return FIELD_EX64(id->id_aa64mmfr1, ID_AA64MMFR1, HAFDBS) >= 2; | ||
1873 | -} | ||
1874 | - | ||
1875 | -static inline bool isar_feature_aa64_tts2uxn(const ARMISARegisters *id) | ||
1876 | -{ | ||
1877 | - return FIELD_EX64(id->id_aa64mmfr1, ID_AA64MMFR1, XNX) != 0; | ||
1878 | -} | ||
1879 | - | ||
1880 | -static inline bool isar_feature_aa64_dit(const ARMISARegisters *id) | ||
1881 | -{ | ||
1882 | - return FIELD_EX64(id->id_aa64pfr0, ID_AA64PFR0, DIT) != 0; | ||
1883 | -} | ||
1884 | - | ||
1885 | -static inline bool isar_feature_aa64_scxtnum(const ARMISARegisters *id) | ||
1886 | -{ | ||
1887 | - int key = FIELD_EX64(id->id_aa64pfr0, ID_AA64PFR0, CSV2); | ||
1888 | - if (key >= 2) { | ||
1889 | - return true; /* FEAT_CSV2_2 */ | ||
1890 | - } | ||
1891 | - if (key == 1) { | ||
1892 | - key = FIELD_EX64(id->id_aa64pfr1, ID_AA64PFR1, CSV2_FRAC); | ||
1893 | - return key >= 2; /* FEAT_CSV2_1p2 */ | ||
1894 | - } | ||
1895 | - return false; | ||
1896 | -} | ||
1897 | - | ||
1898 | -static inline bool isar_feature_aa64_ssbs(const ARMISARegisters *id) | ||
1899 | -{ | ||
1900 | - return FIELD_EX64(id->id_aa64pfr1, ID_AA64PFR1, SSBS) != 0; | ||
1901 | -} | ||
1902 | - | ||
1903 | -static inline bool isar_feature_aa64_debugv8p2(const ARMISARegisters *id) | ||
1904 | -{ | ||
1905 | - return FIELD_EX64(id->id_aa64dfr0, ID_AA64DFR0, DEBUGVER) >= 8; | ||
1906 | -} | ||
1907 | - | ||
1908 | -static inline bool isar_feature_aa64_sve2(const ARMISARegisters *id) | ||
1909 | -{ | ||
1910 | - return FIELD_EX64(id->id_aa64zfr0, ID_AA64ZFR0, SVEVER) != 0; | ||
1911 | -} | ||
1912 | - | ||
1913 | -static inline bool isar_feature_aa64_sve2_aes(const ARMISARegisters *id) | ||
1914 | -{ | ||
1915 | - return FIELD_EX64(id->id_aa64zfr0, ID_AA64ZFR0, AES) != 0; | ||
1916 | -} | ||
1917 | - | ||
1918 | -static inline bool isar_feature_aa64_sve2_pmull128(const ARMISARegisters *id) | ||
1919 | -{ | ||
1920 | - return FIELD_EX64(id->id_aa64zfr0, ID_AA64ZFR0, AES) >= 2; | ||
1921 | -} | ||
1922 | - | ||
1923 | -static inline bool isar_feature_aa64_sve2_bitperm(const ARMISARegisters *id) | ||
1924 | -{ | ||
1925 | - return FIELD_EX64(id->id_aa64zfr0, ID_AA64ZFR0, BITPERM) != 0; | ||
1926 | -} | ||
1927 | - | ||
1928 | -static inline bool isar_feature_aa64_sve_bf16(const ARMISARegisters *id) | ||
1929 | -{ | ||
1930 | - return FIELD_EX64(id->id_aa64zfr0, ID_AA64ZFR0, BFLOAT16) != 0; | ||
1931 | -} | ||
1932 | - | ||
1933 | -static inline bool isar_feature_aa64_sve2_sha3(const ARMISARegisters *id) | ||
1934 | -{ | ||
1935 | - return FIELD_EX64(id->id_aa64zfr0, ID_AA64ZFR0, SHA3) != 0; | ||
1936 | -} | ||
1937 | - | ||
1938 | -static inline bool isar_feature_aa64_sve2_sm4(const ARMISARegisters *id) | ||
1939 | -{ | ||
1940 | - return FIELD_EX64(id->id_aa64zfr0, ID_AA64ZFR0, SM4) != 0; | ||
1941 | -} | ||
1942 | - | ||
1943 | -static inline bool isar_feature_aa64_sve_i8mm(const ARMISARegisters *id) | ||
1944 | -{ | ||
1945 | - return FIELD_EX64(id->id_aa64zfr0, ID_AA64ZFR0, I8MM) != 0; | ||
1946 | -} | ||
1947 | - | ||
1948 | -static inline bool isar_feature_aa64_sve_f32mm(const ARMISARegisters *id) | ||
1949 | -{ | ||
1950 | - return FIELD_EX64(id->id_aa64zfr0, ID_AA64ZFR0, F32MM) != 0; | ||
1951 | -} | ||
1952 | - | ||
1953 | -static inline bool isar_feature_aa64_sve_f64mm(const ARMISARegisters *id) | ||
1954 | -{ | ||
1955 | - return FIELD_EX64(id->id_aa64zfr0, ID_AA64ZFR0, F64MM) != 0; | ||
1956 | -} | ||
1957 | - | ||
1958 | -static inline bool isar_feature_aa64_sme_f64f64(const ARMISARegisters *id) | ||
1959 | -{ | ||
1960 | - return FIELD_EX64(id->id_aa64smfr0, ID_AA64SMFR0, F64F64); | ||
1961 | -} | ||
1962 | - | ||
1963 | -static inline bool isar_feature_aa64_sme_i16i64(const ARMISARegisters *id) | ||
1964 | -{ | ||
1965 | - return FIELD_EX64(id->id_aa64smfr0, ID_AA64SMFR0, I16I64) == 0xf; | ||
1966 | -} | ||
1967 | - | ||
1968 | -static inline bool isar_feature_aa64_sme_fa64(const ARMISARegisters *id) | ||
1969 | -{ | ||
1970 | - return FIELD_EX64(id->id_aa64smfr0, ID_AA64SMFR0, FA64); | ||
1971 | -} | ||
1972 | - | ||
1973 | -static inline bool isar_feature_aa64_doublelock(const ARMISARegisters *id) | ||
1974 | -{ | ||
1975 | - return FIELD_SEX64(id->id_aa64dfr0, ID_AA64DFR0, DOUBLELOCK) >= 0; | ||
1976 | -} | ||
1977 | - | ||
1978 | -static inline bool isar_feature_aa64_mops(const ARMISARegisters *id) | ||
1979 | -{ | ||
1980 | - return FIELD_EX64(id->id_aa64isar2, ID_AA64ISAR2, MOPS); | ||
1981 | -} | ||
1982 | - | ||
1983 | -/* | ||
1984 | - * Feature tests for "does this exist in either 32-bit or 64-bit?" | ||
1985 | - */ | ||
1986 | -static inline bool isar_feature_any_fp16(const ARMISARegisters *id) | ||
1987 | -{ | ||
1988 | - return isar_feature_aa64_fp16(id) || isar_feature_aa32_fp16_arith(id); | ||
1989 | -} | ||
1990 | - | ||
1991 | -static inline bool isar_feature_any_predinv(const ARMISARegisters *id) | ||
1992 | -{ | ||
1993 | - return isar_feature_aa64_predinv(id) || isar_feature_aa32_predinv(id); | ||
1994 | -} | ||
1995 | - | ||
1996 | -static inline bool isar_feature_any_pmuv3p1(const ARMISARegisters *id) | ||
1997 | -{ | ||
1998 | - return isar_feature_aa64_pmuv3p1(id) || isar_feature_aa32_pmuv3p1(id); | ||
1999 | -} | ||
2000 | - | ||
2001 | -static inline bool isar_feature_any_pmuv3p4(const ARMISARegisters *id) | ||
2002 | -{ | ||
2003 | - return isar_feature_aa64_pmuv3p4(id) || isar_feature_aa32_pmuv3p4(id); | ||
2004 | -} | ||
2005 | - | ||
2006 | -static inline bool isar_feature_any_pmuv3p5(const ARMISARegisters *id) | ||
2007 | -{ | ||
2008 | - return isar_feature_aa64_pmuv3p5(id) || isar_feature_aa32_pmuv3p5(id); | ||
2009 | -} | ||
2010 | - | ||
2011 | -static inline bool isar_feature_any_ccidx(const ARMISARegisters *id) | ||
2012 | -{ | ||
2013 | - return isar_feature_aa64_ccidx(id) || isar_feature_aa32_ccidx(id); | ||
2014 | -} | ||
2015 | - | ||
2016 | -static inline bool isar_feature_any_tts2uxn(const ARMISARegisters *id) | ||
2017 | -{ | ||
2018 | - return isar_feature_aa64_tts2uxn(id) || isar_feature_aa32_tts2uxn(id); | ||
2019 | -} | ||
2020 | - | ||
2021 | -static inline bool isar_feature_any_debugv8p2(const ARMISARegisters *id) | ||
2022 | -{ | ||
2023 | - return isar_feature_aa64_debugv8p2(id) || isar_feature_aa32_debugv8p2(id); | ||
2024 | -} | ||
2025 | - | ||
2026 | -static inline bool isar_feature_any_ras(const ARMISARegisters *id) | ||
2027 | -{ | ||
2028 | - return isar_feature_aa64_ras(id) || isar_feature_aa32_ras(id); | ||
2029 | -} | ||
2030 | - | ||
2031 | -static inline bool isar_feature_any_half_evt(const ARMISARegisters *id) | ||
2032 | -{ | ||
2033 | - return isar_feature_aa64_half_evt(id) || isar_feature_aa32_half_evt(id); | ||
2034 | -} | ||
2035 | - | ||
2036 | -static inline bool isar_feature_any_evt(const ARMISARegisters *id) | ||
2037 | -{ | ||
2038 | - return isar_feature_aa64_evt(id) || isar_feature_aa32_evt(id); | ||
2039 | -} | ||
2040 | - | ||
2041 | -/* | ||
2042 | - * Forward to the above feature tests given an ARMCPU pointer. | ||
2043 | - */ | ||
2044 | -#define cpu_isar_feature(name, cpu) \ | ||
2045 | - ({ ARMCPU *cpu_ = (cpu); isar_feature_##name(&cpu_->isar); }) | ||
2046 | - | ||
2047 | #endif | ||
2048 | diff --git a/target/arm/internals.h b/target/arm/internals.h | ||
2049 | index XXXXXXX..XXXXXXX 100644 | ||
2050 | --- a/target/arm/internals.h | ||
2051 | +++ b/target/arm/internals.h | ||
2052 | @@ -XXX,XX +XXX,XX @@ | ||
2053 | #include "hw/registerfields.h" | ||
2054 | #include "tcg/tcg-gvec-desc.h" | ||
2055 | #include "syndrome.h" | ||
2056 | +#include "cpu-features.h" | ||
2057 | |||
2058 | /* register banks for CPU modes */ | ||
2059 | #define BANK_USRSYS 0 | ||
2060 | diff --git a/target/arm/tcg/translate.h b/target/arm/tcg/translate.h | ||
2061 | index XXXXXXX..XXXXXXX 100644 | ||
2062 | --- a/target/arm/tcg/translate.h | ||
2063 | +++ b/target/arm/tcg/translate.h | ||
2064 | @@ -XXX,XX +XXX,XX @@ | ||
2065 | #include "exec/translator.h" | ||
2066 | #include "exec/helper-gen.h" | ||
2067 | #include "internals.h" | ||
2068 | - | ||
2069 | +#include "cpu-features.h" | ||
2070 | |||
2071 | /* internal defines */ | ||
2072 | |||
2073 | diff --git a/hw/arm/armv7m.c b/hw/arm/armv7m.c | ||
2074 | index XXXXXXX..XXXXXXX 100644 | ||
2075 | --- a/hw/arm/armv7m.c | ||
2076 | +++ b/hw/arm/armv7m.c | ||
2077 | @@ -XXX,XX +XXX,XX @@ | ||
2078 | #include "qemu/module.h" | ||
2079 | #include "qemu/log.h" | ||
2080 | #include "target/arm/idau.h" | ||
2081 | +#include "target/arm/cpu-features.h" | ||
2082 | #include "migration/vmstate.h" | ||
2083 | |||
2084 | /* Bitbanded IO. Each word corresponds to a single bit. */ | ||
2085 | diff --git a/hw/intc/armv7m_nvic.c b/hw/intc/armv7m_nvic.c | ||
2086 | index XXXXXXX..XXXXXXX 100644 | ||
2087 | --- a/hw/intc/armv7m_nvic.c | ||
2088 | +++ b/hw/intc/armv7m_nvic.c | ||
2089 | @@ -XXX,XX +XXX,XX @@ | ||
2090 | #include "sysemu/tcg.h" | ||
2091 | #include "sysemu/runstate.h" | ||
2092 | #include "target/arm/cpu.h" | ||
2093 | +#include "target/arm/cpu-features.h" | ||
2094 | #include "exec/exec-all.h" | ||
2095 | #include "exec/memop.h" | ||
2096 | #include "qemu/log.h" | ||
2097 | diff --git a/linux-user/aarch64/cpu_loop.c b/linux-user/aarch64/cpu_loop.c | ||
2098 | index XXXXXXX..XXXXXXX 100644 | ||
2099 | --- a/linux-user/aarch64/cpu_loop.c | ||
2100 | +++ b/linux-user/aarch64/cpu_loop.c | ||
2101 | @@ -XXX,XX +XXX,XX @@ | ||
2102 | #include "qemu/guest-random.h" | ||
2103 | #include "semihosting/common-semi.h" | ||
2104 | #include "target/arm/syndrome.h" | ||
2105 | +#include "target/arm/cpu-features.h" | ||
2106 | |||
2107 | #define get_user_code_u32(x, gaddr, env) \ | ||
2108 | ({ abi_long __r = get_user_u32((x), (gaddr)); \ | ||
2109 | diff --git a/linux-user/aarch64/signal.c b/linux-user/aarch64/signal.c | ||
2110 | index XXXXXXX..XXXXXXX 100644 | ||
2111 | --- a/linux-user/aarch64/signal.c | ||
2112 | +++ b/linux-user/aarch64/signal.c | ||
2113 | @@ -XXX,XX +XXX,XX @@ | ||
2114 | #include "user-internals.h" | ||
2115 | #include "signal-common.h" | ||
2116 | #include "linux-user/trace.h" | ||
2117 | +#include "target/arm/cpu-features.h" | ||
2118 | |||
2119 | struct target_sigcontext { | ||
2120 | uint64_t fault_address; | ||
2121 | diff --git a/linux-user/arm/signal.c b/linux-user/arm/signal.c | ||
2122 | index XXXXXXX..XXXXXXX 100644 | ||
2123 | --- a/linux-user/arm/signal.c | ||
2124 | +++ b/linux-user/arm/signal.c | ||
2125 | @@ -XXX,XX +XXX,XX @@ | ||
2126 | #include "user-internals.h" | ||
2127 | #include "signal-common.h" | ||
2128 | #include "linux-user/trace.h" | ||
2129 | +#include "target/arm/cpu-features.h" | ||
2130 | |||
2131 | struct target_sigcontext { | ||
2132 | abi_ulong trap_no; | ||
2133 | diff --git a/linux-user/elfload.c b/linux-user/elfload.c | ||
2134 | index XXXXXXX..XXXXXXX 100644 | ||
2135 | --- a/linux-user/elfload.c | ||
2136 | +++ b/linux-user/elfload.c | ||
2137 | @@ -XXX,XX +XXX,XX @@ | ||
2138 | #include "target_signal.h" | ||
2139 | #include "accel/tcg/debuginfo.h" | ||
2140 | |||
2141 | +#ifdef TARGET_ARM | ||
2142 | +#include "target/arm/cpu-features.h" | ||
2143 | +#endif | ||
2144 | + | ||
2145 | #ifdef _ARCH_PPC64 | ||
2146 | #undef ARCH_DLINFO | ||
2147 | #undef ELF_PLATFORM | ||
2148 | diff --git a/linux-user/mmap.c b/linux-user/mmap.c | ||
2149 | index XXXXXXX..XXXXXXX 100644 | ||
2150 | --- a/linux-user/mmap.c | ||
2151 | +++ b/linux-user/mmap.c | ||
2152 | @@ -XXX,XX +XXX,XX @@ | ||
2153 | #include "target_mman.h" | ||
2154 | #include "qemu/interval-tree.h" | ||
2155 | |||
2156 | +#ifdef TARGET_ARM | ||
2157 | +#include "target/arm/cpu-features.h" | ||
2158 | +#endif | ||
2159 | + | ||
2160 | static pthread_mutex_t mmap_mutex = PTHREAD_MUTEX_INITIALIZER; | ||
2161 | static __thread int mmap_lock_count; | ||
2162 | |||
2163 | diff --git a/target/arm/arch_dump.c b/target/arm/arch_dump.c | ||
2164 | index XXXXXXX..XXXXXXX 100644 | ||
2165 | --- a/target/arm/arch_dump.c | ||
2166 | +++ b/target/arm/arch_dump.c | ||
2167 | @@ -XXX,XX +XXX,XX @@ | ||
2168 | #include "cpu.h" | ||
2169 | #include "elf.h" | ||
2170 | #include "sysemu/dump.h" | ||
2171 | +#include "cpu-features.h" | ||
2172 | |||
2173 | /* struct user_pt_regs from arch/arm64/include/uapi/asm/ptrace.h */ | ||
2174 | struct aarch64_user_regs { | ||
2175 | diff --git a/target/arm/cpu.c b/target/arm/cpu.c | ||
2176 | index XXXXXXX..XXXXXXX 100644 | ||
2177 | --- a/target/arm/cpu.c | ||
2178 | +++ b/target/arm/cpu.c | ||
2179 | @@ -XXX,XX +XXX,XX @@ | ||
2180 | #include "hw/core/tcg-cpu-ops.h" | ||
2181 | #endif /* CONFIG_TCG */ | ||
2182 | #include "internals.h" | ||
2183 | +#include "cpu-features.h" | ||
2184 | #include "exec/exec-all.h" | ||
2185 | #include "hw/qdev-properties.h" | ||
2186 | #if !defined(CONFIG_USER_ONLY) | ||
2187 | diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c | ||
2188 | index XXXXXXX..XXXXXXX 100644 | ||
2189 | --- a/target/arm/cpu64.c | ||
2190 | +++ b/target/arm/cpu64.c | ||
2191 | @@ -XXX,XX +XXX,XX @@ | ||
2192 | #include "qapi/visitor.h" | ||
2193 | #include "hw/qdev-properties.h" | ||
2194 | #include "internals.h" | ||
2195 | +#include "cpu-features.h" | ||
2196 | #include "cpregs.h" | ||
2197 | |||
2198 | void arm_cpu_sve_finalize(ARMCPU *cpu, Error **errp) | ||
2199 | diff --git a/target/arm/debug_helper.c b/target/arm/debug_helper.c | ||
2200 | index XXXXXXX..XXXXXXX 100644 | ||
2201 | --- a/target/arm/debug_helper.c | ||
2202 | +++ b/target/arm/debug_helper.c | ||
2203 | @@ -XXX,XX +XXX,XX @@ | ||
2204 | #include "qemu/log.h" | ||
2205 | #include "cpu.h" | ||
2206 | #include "internals.h" | ||
2207 | +#include "cpu-features.h" | ||
2208 | #include "cpregs.h" | ||
2209 | #include "exec/exec-all.h" | ||
2210 | #include "exec/helper-proto.h" | ||
2211 | diff --git a/target/arm/gdbstub.c b/target/arm/gdbstub.c | ||
2212 | index XXXXXXX..XXXXXXX 100644 | ||
2213 | --- a/target/arm/gdbstub.c | ||
2214 | +++ b/target/arm/gdbstub.c | ||
2215 | @@ -XXX,XX +XXX,XX @@ | ||
2216 | #include "gdbstub/helpers.h" | ||
2217 | #include "sysemu/tcg.h" | ||
2218 | #include "internals.h" | ||
2219 | +#include "cpu-features.h" | ||
2220 | #include "cpregs.h" | ||
2221 | |||
2222 | typedef struct RegisterSysregXmlParam { | ||
2223 | diff --git a/target/arm/helper.c b/target/arm/helper.c | ||
2224 | index XXXXXXX..XXXXXXX 100644 | ||
2225 | --- a/target/arm/helper.c | ||
2226 | +++ b/target/arm/helper.c | ||
2227 | @@ -XXX,XX +XXX,XX @@ | ||
2228 | #include "trace.h" | ||
2229 | #include "cpu.h" | ||
2230 | #include "internals.h" | ||
2231 | +#include "cpu-features.h" | ||
2232 | #include "exec/helper-proto.h" | ||
2233 | #include "qemu/main-loop.h" | ||
2234 | #include "qemu/timer.h" | ||
2235 | diff --git a/target/arm/kvm64.c b/target/arm/kvm64.c | ||
2236 | index XXXXXXX..XXXXXXX 100644 | ||
2237 | --- a/target/arm/kvm64.c | ||
2238 | +++ b/target/arm/kvm64.c | ||
2239 | @@ -XXX,XX +XXX,XX @@ | ||
2240 | #include "sysemu/kvm_int.h" | ||
2241 | #include "kvm_arm.h" | ||
2242 | #include "internals.h" | ||
2243 | +#include "cpu-features.h" | ||
2244 | #include "hw/acpi/acpi.h" | ||
2245 | #include "hw/acpi/ghes.h" | ||
2246 | |||
2247 | diff --git a/target/arm/machine.c b/target/arm/machine.c | ||
2248 | index XXXXXXX..XXXXXXX 100644 | ||
2249 | --- a/target/arm/machine.c | ||
2250 | +++ b/target/arm/machine.c | ||
2251 | @@ -XXX,XX +XXX,XX @@ | ||
2252 | #include "sysemu/tcg.h" | ||
2253 | #include "kvm_arm.h" | ||
2254 | #include "internals.h" | ||
2255 | +#include "cpu-features.h" | ||
2256 | #include "migration/cpu.h" | ||
2257 | |||
2258 | static bool vfp_needed(void *opaque) | ||
2259 | diff --git a/target/arm/ptw.c b/target/arm/ptw.c | ||
2260 | index XXXXXXX..XXXXXXX 100644 | ||
2261 | --- a/target/arm/ptw.c | ||
2262 | +++ b/target/arm/ptw.c | ||
2263 | @@ -XXX,XX +XXX,XX @@ | ||
2264 | #include "exec/exec-all.h" | ||
2265 | #include "cpu.h" | ||
2266 | #include "internals.h" | ||
2267 | +#include "cpu-features.h" | ||
2268 | #include "idau.h" | ||
2269 | #ifdef CONFIG_TCG | ||
2270 | # include "tcg/oversized-guest.h" | ||
2271 | diff --git a/target/arm/tcg/cpu64.c b/target/arm/tcg/cpu64.c | ||
2272 | index XXXXXXX..XXXXXXX 100644 | ||
2273 | --- a/target/arm/tcg/cpu64.c | ||
2274 | +++ b/target/arm/tcg/cpu64.c | ||
2275 | @@ -XXX,XX +XXX,XX @@ | ||
2276 | #include "hw/qdev-properties.h" | ||
2277 | #include "qemu/units.h" | ||
2278 | #include "internals.h" | ||
2279 | +#include "cpu-features.h" | ||
2280 | #include "cpregs.h" | ||
2281 | |||
2282 | static uint64_t make_ccsidr64(unsigned assoc, unsigned linesize, | ||
2283 | diff --git a/target/arm/tcg/hflags.c b/target/arm/tcg/hflags.c | ||
2284 | index XXXXXXX..XXXXXXX 100644 | ||
2285 | --- a/target/arm/tcg/hflags.c | ||
2286 | +++ b/target/arm/tcg/hflags.c | ||
2287 | @@ -XXX,XX +XXX,XX @@ | ||
2288 | #include "qemu/osdep.h" | ||
2289 | #include "cpu.h" | ||
2290 | #include "internals.h" | ||
2291 | +#include "cpu-features.h" | ||
2292 | #include "exec/helper-proto.h" | ||
2293 | #include "cpregs.h" | ||
2294 | |||
2295 | diff --git a/target/arm/tcg/m_helper.c b/target/arm/tcg/m_helper.c | ||
2296 | index XXXXXXX..XXXXXXX 100644 | ||
2297 | --- a/target/arm/tcg/m_helper.c | ||
2298 | +++ b/target/arm/tcg/m_helper.c | ||
2299 | @@ -XXX,XX +XXX,XX @@ | ||
2300 | #include "qemu/osdep.h" | ||
2301 | #include "cpu.h" | ||
2302 | #include "internals.h" | ||
2303 | +#include "cpu-features.h" | ||
2304 | #include "gdbstub/helpers.h" | ||
2305 | #include "exec/helper-proto.h" | ||
2306 | #include "qemu/main-loop.h" | ||
2307 | diff --git a/target/arm/tcg/op_helper.c b/target/arm/tcg/op_helper.c | ||
2308 | index XXXXXXX..XXXXXXX 100644 | ||
2309 | --- a/target/arm/tcg/op_helper.c | ||
2310 | +++ b/target/arm/tcg/op_helper.c | ||
2311 | @@ -XXX,XX +XXX,XX @@ | ||
2312 | #include "cpu.h" | ||
2313 | #include "exec/helper-proto.h" | ||
2314 | #include "internals.h" | ||
2315 | +#include "cpu-features.h" | ||
2316 | #include "exec/exec-all.h" | ||
2317 | #include "exec/cpu_ldst.h" | ||
2318 | #include "cpregs.h" | ||
2319 | diff --git a/target/arm/tcg/pauth_helper.c b/target/arm/tcg/pauth_helper.c | ||
2320 | index XXXXXXX..XXXXXXX 100644 | ||
2321 | --- a/target/arm/tcg/pauth_helper.c | ||
2322 | +++ b/target/arm/tcg/pauth_helper.c | ||
2323 | @@ -XXX,XX +XXX,XX @@ | ||
2324 | #include "qemu/osdep.h" | ||
2325 | #include "cpu.h" | ||
2326 | #include "internals.h" | ||
2327 | +#include "cpu-features.h" | ||
2328 | #include "exec/exec-all.h" | ||
2329 | #include "exec/cpu_ldst.h" | ||
2330 | #include "exec/helper-proto.h" | ||
2331 | diff --git a/target/arm/tcg/tlb_helper.c b/target/arm/tcg/tlb_helper.c | ||
2332 | index XXXXXXX..XXXXXXX 100644 | ||
2333 | --- a/target/arm/tcg/tlb_helper.c | ||
2334 | +++ b/target/arm/tcg/tlb_helper.c | ||
2335 | @@ -XXX,XX +XXX,XX @@ | ||
2336 | #include "qemu/osdep.h" | ||
2337 | #include "cpu.h" | ||
2338 | #include "internals.h" | ||
2339 | +#include "cpu-features.h" | ||
2340 | #include "exec/exec-all.h" | ||
2341 | #include "exec/helper-proto.h" | ||
2342 | |||
2343 | diff --git a/target/arm/vfp_helper.c b/target/arm/vfp_helper.c | ||
2344 | index XXXXXXX..XXXXXXX 100644 | ||
2345 | --- a/target/arm/vfp_helper.c | ||
2346 | +++ b/target/arm/vfp_helper.c | ||
2347 | @@ -XXX,XX +XXX,XX @@ | ||
2348 | #include "cpu.h" | ||
2349 | #include "exec/helper-proto.h" | ||
2350 | #include "internals.h" | ||
2351 | +#include "cpu-features.h" | ||
2352 | #ifdef CONFIG_TCG | ||
2353 | #include "qemu/log.h" | ||
2354 | #include "fpu/softfloat.h" | ||
283 | -- | 2355 | -- |
284 | 2.20.1 | 2356 | 2.34.1 |
285 | 2357 | ||
286 | 2358 | diff view generated by jsdifflib |
1 | The ARMv8.2-TTS2UXN feature extends the XN field in stage 2 | 1 | Our list of isar_feature functions is not in any particular order, |
---|---|---|---|
2 | translation table descriptors from just bit [54] to bits [54:53], | 2 | but tests on fields of the same ID register tend to be grouped |
3 | allowing stage 2 to control execution permissions separately for EL0 | 3 | together. A few functions that are tests of fields in ID_AA64MMFR1 |
4 | and EL1. Implement the new semantics of the XN field and enable | 4 | and ID_AA64MMFR2 are not in the same place as the rest; move them |
5 | the feature for our 'max' CPU. | 5 | into their groups. |
6 | 6 | ||
7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
8 | Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | 8 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
9 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 9 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
10 | Message-id: 20200330210400.11724-5-peter.maydell@linaro.org | 10 | Message-id: 20231024163510.2972081-3-peter.maydell@linaro.org |
11 | --- | 11 | --- |
12 | target/arm/cpu.h | 15 +++++++++++++++ | 12 | target/arm/cpu-features.h | 60 +++++++++++++++++++-------------------- |
13 | target/arm/cpu.c | 1 + | 13 | 1 file changed, 30 insertions(+), 30 deletions(-) |
14 | target/arm/cpu64.c | 2 ++ | ||
15 | target/arm/helper.c | 37 +++++++++++++++++++++++++++++++------ | ||
16 | 4 files changed, 49 insertions(+), 6 deletions(-) | ||
17 | 14 | ||
18 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h | 15 | diff --git a/target/arm/cpu-features.h b/target/arm/cpu-features.h |
19 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
20 | --- a/target/arm/cpu.h | 17 | --- a/target/arm/cpu-features.h |
21 | +++ b/target/arm/cpu.h | 18 | +++ b/target/arm/cpu-features.h |
22 | @@ -XXX,XX +XXX,XX @@ static inline bool isar_feature_aa32_ccidx(const ARMISARegisters *id) | 19 | @@ -XXX,XX +XXX,XX @@ static inline bool isar_feature_aa64_tidcp1(const ARMISARegisters *id) |
23 | return FIELD_EX32(id->id_mmfr4, ID_MMFR4, CCIDX) != 0; | 20 | return FIELD_EX64(id->id_aa64mmfr2, ID_AA64MMFR1, TIDCP1) != 0; |
24 | } | 21 | } |
25 | 22 | ||
26 | +static inline bool isar_feature_aa32_tts2uxn(const ARMISARegisters *id) | 23 | +static inline bool isar_feature_aa64_hafs(const ARMISARegisters *id) |
27 | +{ | 24 | +{ |
28 | + return FIELD_EX32(id->id_mmfr4, ID_MMFR4, XNX) != 0; | 25 | + return FIELD_EX64(id->id_aa64mmfr1, ID_AA64MMFR1, HAFDBS) != 0; |
29 | +} | 26 | +} |
30 | + | 27 | + |
31 | /* | 28 | +static inline bool isar_feature_aa64_hdbs(const ARMISARegisters *id) |
32 | * 64-bit feature tests via id registers. | 29 | +{ |
33 | */ | 30 | + return FIELD_EX64(id->id_aa64mmfr1, ID_AA64MMFR1, HAFDBS) >= 2; |
34 | @@ -XXX,XX +XXX,XX @@ static inline bool isar_feature_aa64_ccidx(const ARMISARegisters *id) | 31 | +} |
35 | return FIELD_EX64(id->id_aa64mmfr2, ID_AA64MMFR2, CCIDX) != 0; | 32 | + |
36 | } | ||
37 | |||
38 | +static inline bool isar_feature_aa64_tts2uxn(const ARMISARegisters *id) | 33 | +static inline bool isar_feature_aa64_tts2uxn(const ARMISARegisters *id) |
39 | +{ | 34 | +{ |
40 | + return FIELD_EX64(id->id_aa64mmfr1, ID_AA64MMFR1, XNX) != 0; | 35 | + return FIELD_EX64(id->id_aa64mmfr1, ID_AA64MMFR1, XNX) != 0; |
41 | +} | 36 | +} |
42 | + | 37 | + |
43 | /* | 38 | static inline bool isar_feature_aa64_uao(const ARMISARegisters *id) |
44 | * Feature tests for "does this exist in either 32-bit or 64-bit?" | 39 | { |
45 | */ | 40 | return FIELD_EX64(id->id_aa64mmfr2, ID_AA64MMFR2, UAO) != 0; |
46 | @@ -XXX,XX +XXX,XX @@ static inline bool isar_feature_any_ccidx(const ARMISARegisters *id) | 41 | @@ -XXX,XX +XXX,XX @@ static inline bool isar_feature_aa64_evt(const ARMISARegisters *id) |
47 | return isar_feature_aa64_ccidx(id) || isar_feature_aa32_ccidx(id); | 42 | return FIELD_EX64(id->id_aa64mmfr2, ID_AA64MMFR2, EVT) >= 2; |
48 | } | 43 | } |
49 | 44 | ||
50 | +static inline bool isar_feature_any_tts2uxn(const ARMISARegisters *id) | 45 | +static inline bool isar_feature_aa64_ccidx(const ARMISARegisters *id) |
51 | +{ | 46 | +{ |
52 | + return isar_feature_aa64_tts2uxn(id) || isar_feature_aa32_tts2uxn(id); | 47 | + return FIELD_EX64(id->id_aa64mmfr2, ID_AA64MMFR2, CCIDX) != 0; |
53 | +} | 48 | +} |
54 | + | 49 | + |
55 | /* | 50 | +static inline bool isar_feature_aa64_lva(const ARMISARegisters *id) |
56 | * Forward to the above feature tests given an ARMCPU pointer. | 51 | +{ |
57 | */ | 52 | + return FIELD_EX64(id->id_aa64mmfr2, ID_AA64MMFR2, VARANGE) != 0; |
58 | diff --git a/target/arm/cpu.c b/target/arm/cpu.c | 53 | +} |
59 | index XXXXXXX..XXXXXXX 100644 | 54 | + |
60 | --- a/target/arm/cpu.c | 55 | +static inline bool isar_feature_aa64_e0pd(const ARMISARegisters *id) |
61 | +++ b/target/arm/cpu.c | 56 | +{ |
62 | @@ -XXX,XX +XXX,XX @@ static void arm_max_initfn(Object *obj) | 57 | + return FIELD_EX64(id->id_aa64mmfr2, ID_AA64MMFR2, E0PD) != 0; |
63 | t = FIELD_DP32(t, ID_MMFR4, HPDS, 1); /* AA32HPD */ | 58 | +} |
64 | t = FIELD_DP32(t, ID_MMFR4, AC2, 1); /* ACTLR2, HACTLR2 */ | 59 | + |
65 | t = FIELD_DP32(t, ID_MMFR4, CNP, 1); /* TTCNP */ | 60 | static inline bool isar_feature_aa64_bti(const ARMISARegisters *id) |
66 | + t = FIELD_DP32(t, ID_MMFR4, XNX, 1); /* TTS2UXN */ | ||
67 | cpu->isar.id_mmfr4 = t; | ||
68 | } | ||
69 | #endif | ||
70 | diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c | ||
71 | index XXXXXXX..XXXXXXX 100644 | ||
72 | --- a/target/arm/cpu64.c | ||
73 | +++ b/target/arm/cpu64.c | ||
74 | @@ -XXX,XX +XXX,XX @@ static void aarch64_max_initfn(Object *obj) | ||
75 | t = FIELD_DP64(t, ID_AA64MMFR1, VH, 1); | ||
76 | t = FIELD_DP64(t, ID_AA64MMFR1, PAN, 2); /* ATS1E1 */ | ||
77 | t = FIELD_DP64(t, ID_AA64MMFR1, VMIDBITS, 2); /* VMID16 */ | ||
78 | + t = FIELD_DP64(t, ID_AA64MMFR1, XNX, 1); /* TTS2UXN */ | ||
79 | cpu->isar.id_aa64mmfr1 = t; | ||
80 | |||
81 | t = cpu->isar.id_aa64mmfr2; | ||
82 | @@ -XXX,XX +XXX,XX @@ static void aarch64_max_initfn(Object *obj) | ||
83 | u = FIELD_DP32(u, ID_MMFR4, HPDS, 1); /* AA32HPD */ | ||
84 | u = FIELD_DP32(u, ID_MMFR4, AC2, 1); /* ACTLR2, HACTLR2 */ | ||
85 | u = FIELD_DP32(u, ID_MMFR4, CNP, 1); /* TTCNP */ | ||
86 | + u = FIELD_DP32(u, ID_MMFR4, XNX, 1); /* TTS2UXN */ | ||
87 | cpu->isar.id_mmfr4 = u; | ||
88 | |||
89 | u = cpu->isar.id_aa64dfr0; | ||
90 | diff --git a/target/arm/helper.c b/target/arm/helper.c | ||
91 | index XXXXXXX..XXXXXXX 100644 | ||
92 | --- a/target/arm/helper.c | ||
93 | +++ b/target/arm/helper.c | ||
94 | @@ -XXX,XX +XXX,XX @@ simple_ap_to_rw_prot(CPUARMState *env, ARMMMUIdx mmu_idx, int ap) | ||
95 | * | ||
96 | * @env: CPUARMState | ||
97 | * @s2ap: The 2-bit stage2 access permissions (S2AP) | ||
98 | - * @xn: XN (execute-never) bit | ||
99 | + * @xn: XN (execute-never) bits | ||
100 | + * @s1_is_el0: true if this is S2 of an S1+2 walk for EL0 | ||
101 | */ | ||
102 | -static int get_S2prot(CPUARMState *env, int s2ap, int xn) | ||
103 | +static int get_S2prot(CPUARMState *env, int s2ap, int xn, bool s1_is_el0) | ||
104 | { | 61 | { |
105 | int prot = 0; | 62 | return FIELD_EX64(id->id_aa64pfr1, ID_AA64PFR1, BT) != 0; |
106 | 63 | @@ -XXX,XX +XXX,XX @@ static inline bool isar_feature_aa64_fgt(const ARMISARegisters *id) | |
107 | @@ -XXX,XX +XXX,XX @@ static int get_S2prot(CPUARMState *env, int s2ap, int xn) | 64 | return FIELD_EX64(id->id_aa64mmfr0, ID_AA64MMFR0, FGT) != 0; |
108 | if (s2ap & 2) { | 65 | } |
109 | prot |= PAGE_WRITE; | 66 | |
110 | } | 67 | -static inline bool isar_feature_aa64_ccidx(const ARMISARegisters *id) |
111 | - if (!xn) { | 68 | -{ |
112 | - if (arm_el_is_aa64(env, 2) || prot & PAGE_READ) { | 69 | - return FIELD_EX64(id->id_aa64mmfr2, ID_AA64MMFR2, CCIDX) != 0; |
113 | + | 70 | -} |
114 | + if (cpu_isar_feature(any_tts2uxn, env_archcpu(env))) { | 71 | - |
115 | + switch (xn) { | 72 | -static inline bool isar_feature_aa64_lva(const ARMISARegisters *id) |
116 | + case 0: | 73 | -{ |
117 | prot |= PAGE_EXEC; | 74 | - return FIELD_EX64(id->id_aa64mmfr2, ID_AA64MMFR2, VARANGE) != 0; |
118 | + break; | 75 | -} |
119 | + case 1: | 76 | - |
120 | + if (s1_is_el0) { | 77 | -static inline bool isar_feature_aa64_e0pd(const ARMISARegisters *id) |
121 | + prot |= PAGE_EXEC; | 78 | -{ |
122 | + } | 79 | - return FIELD_EX64(id->id_aa64mmfr2, ID_AA64MMFR2, E0PD) != 0; |
123 | + break; | 80 | -} |
124 | + case 2: | 81 | - |
125 | + break; | 82 | -static inline bool isar_feature_aa64_hafs(const ARMISARegisters *id) |
126 | + case 3: | 83 | -{ |
127 | + if (!s1_is_el0) { | 84 | - return FIELD_EX64(id->id_aa64mmfr1, ID_AA64MMFR1, HAFDBS) != 0; |
128 | + prot |= PAGE_EXEC; | 85 | -} |
129 | + } | 86 | - |
130 | + break; | 87 | -static inline bool isar_feature_aa64_hdbs(const ARMISARegisters *id) |
131 | + default: | 88 | -{ |
132 | + g_assert_not_reached(); | 89 | - return FIELD_EX64(id->id_aa64mmfr1, ID_AA64MMFR1, HAFDBS) >= 2; |
133 | + } | 90 | -} |
134 | + } else { | 91 | - |
135 | + if (!extract32(xn, 1, 1)) { | 92 | -static inline bool isar_feature_aa64_tts2uxn(const ARMISARegisters *id) |
136 | + if (arm_el_is_aa64(env, 2) || prot & PAGE_READ) { | 93 | -{ |
137 | + prot |= PAGE_EXEC; | 94 | - return FIELD_EX64(id->id_aa64mmfr1, ID_AA64MMFR1, XNX) != 0; |
138 | + } | 95 | -} |
139 | } | 96 | - |
140 | } | 97 | static inline bool isar_feature_aa64_dit(const ARMISARegisters *id) |
141 | return prot; | 98 | { |
142 | @@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_lpae(CPUARMState *env, target_ulong address, | 99 | return FIELD_EX64(id->id_aa64pfr0, ID_AA64PFR0, DIT) != 0; |
143 | } | ||
144 | |||
145 | ap = extract32(attrs, 4, 2); | ||
146 | - xn = extract32(attrs, 12, 1); | ||
147 | |||
148 | if (mmu_idx == ARMMMUIdx_Stage2) { | ||
149 | ns = true; | ||
150 | - *prot = get_S2prot(env, ap, xn); | ||
151 | + xn = extract32(attrs, 11, 2); | ||
152 | + *prot = get_S2prot(env, ap, xn, s1_is_el0); | ||
153 | } else { | ||
154 | ns = extract32(attrs, 3, 1); | ||
155 | + xn = extract32(attrs, 12, 1); | ||
156 | pxn = extract32(attrs, 11, 1); | ||
157 | *prot = get_S1prot(env, mmu_idx, aarch64, ap, ns, xn, pxn); | ||
158 | } | ||
159 | -- | 100 | -- |
160 | 2.20.1 | 101 | 2.34.1 |
161 | 102 | ||
162 | 103 | diff view generated by jsdifflib |
1 | Convert the VFM[AS]L (vector) insns to decodetree. This is the last | 1 | Move the ID_AA64MMFR0 feature test functions up so they are |
---|---|---|---|
2 | insn in the legacy decoder for the 3same_ext group, so we can | 2 | before the ones for ID_AA64MMFR1 and ID_AA64MMFR2. |
3 | delete the legacy decoder function for the group entirely. | ||
4 | |||
5 | Note that in disas_thumb2_insn() the parts of this encoding space | ||
6 | where the decodetree decoder returns false will correctly be directed | ||
7 | to illegal_op by the "(insn & (1 << 28))" check so they won't fall | ||
8 | into disas_coproc_insn() by mistake. | ||
9 | 3 | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 4 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
5 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
11 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 6 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
12 | Message-id: 20200430181003.21682-8-peter.maydell@linaro.org | 7 | Message-id: 20231024163510.2972081-4-peter.maydell@linaro.org |
13 | --- | 8 | --- |
14 | target/arm/neon-shared.decode | 6 +++ | 9 | target/arm/cpu-features.h | 120 +++++++++++++++++++------------------- |
15 | target/arm/translate-neon.inc.c | 31 +++++++++++ | 10 | 1 file changed, 60 insertions(+), 60 deletions(-) |
16 | target/arm/translate.c | 92 +-------------------------------- | ||
17 | 3 files changed, 38 insertions(+), 91 deletions(-) | ||
18 | 11 | ||
19 | diff --git a/target/arm/neon-shared.decode b/target/arm/neon-shared.decode | 12 | diff --git a/target/arm/cpu-features.h b/target/arm/cpu-features.h |
20 | index XXXXXXX..XXXXXXX 100644 | 13 | index XXXXXXX..XXXXXXX 100644 |
21 | --- a/target/arm/neon-shared.decode | 14 | --- a/target/arm/cpu-features.h |
22 | +++ b/target/arm/neon-shared.decode | 15 | +++ b/target/arm/cpu-features.h |
23 | @@ -XXX,XX +XXX,XX @@ VCADD 1111 110 rot:1 1 . 0 size:1 .... .... 1000 . q:1 . 0 .... \ | 16 | @@ -XXX,XX +XXX,XX @@ static inline bool isar_feature_aa64_rme(const ARMISARegisters *id) |
24 | # VUDOT and VSDOT | 17 | return FIELD_EX64(id->id_aa64pfr0, ID_AA64PFR0, RME) != 0; |
25 | VDOT 1111 110 00 . 10 .... .... 1101 . q:1 . u:1 .... \ | 18 | } |
26 | vm=%vm_dp vn=%vn_dp vd=%vd_dp | 19 | |
20 | +static inline bool isar_feature_aa64_tgran4_lpa2(const ARMISARegisters *id) | ||
21 | +{ | ||
22 | + return FIELD_SEX64(id->id_aa64mmfr0, ID_AA64MMFR0, TGRAN4) >= 1; | ||
23 | +} | ||
27 | + | 24 | + |
28 | +# VFM[AS]L | 25 | +static inline bool isar_feature_aa64_tgran4_2_lpa2(const ARMISARegisters *id) |
29 | +VFML 1111 110 0 s:1 . 10 .... .... 1000 . 0 . 1 .... \ | 26 | +{ |
30 | + vm=%vm_sp vn=%vn_sp vd=%vd_dp q=0 | 27 | + unsigned t = FIELD_EX64(id->id_aa64mmfr0, ID_AA64MMFR0, TGRAN4_2); |
31 | +VFML 1111 110 0 s:1 . 10 .... .... 1000 . 1 . 1 .... \ | 28 | + return t >= 3 || (t == 0 && isar_feature_aa64_tgran4_lpa2(id)); |
32 | + vm=%vm_dp vn=%vn_dp vd=%vd_dp q=1 | 29 | +} |
33 | diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c | 30 | + |
34 | index XXXXXXX..XXXXXXX 100644 | 31 | +static inline bool isar_feature_aa64_tgran16_lpa2(const ARMISARegisters *id) |
35 | --- a/target/arm/translate-neon.inc.c | 32 | +{ |
36 | +++ b/target/arm/translate-neon.inc.c | 33 | + return FIELD_EX64(id->id_aa64mmfr0, ID_AA64MMFR0, TGRAN16) >= 2; |
37 | @@ -XXX,XX +XXX,XX @@ static bool trans_VDOT(DisasContext *s, arg_VDOT *a) | 34 | +} |
38 | opr_sz, opr_sz, 0, fn_gvec); | 35 | + |
39 | return true; | 36 | +static inline bool isar_feature_aa64_tgran16_2_lpa2(const ARMISARegisters *id) |
37 | +{ | ||
38 | + unsigned t = FIELD_EX64(id->id_aa64mmfr0, ID_AA64MMFR0, TGRAN16_2); | ||
39 | + return t >= 3 || (t == 0 && isar_feature_aa64_tgran16_lpa2(id)); | ||
40 | +} | ||
41 | + | ||
42 | +static inline bool isar_feature_aa64_tgran4(const ARMISARegisters *id) | ||
43 | +{ | ||
44 | + return FIELD_SEX64(id->id_aa64mmfr0, ID_AA64MMFR0, TGRAN4) >= 0; | ||
45 | +} | ||
46 | + | ||
47 | +static inline bool isar_feature_aa64_tgran16(const ARMISARegisters *id) | ||
48 | +{ | ||
49 | + return FIELD_EX64(id->id_aa64mmfr0, ID_AA64MMFR0, TGRAN16) >= 1; | ||
50 | +} | ||
51 | + | ||
52 | +static inline bool isar_feature_aa64_tgran64(const ARMISARegisters *id) | ||
53 | +{ | ||
54 | + return FIELD_SEX64(id->id_aa64mmfr0, ID_AA64MMFR0, TGRAN64) >= 0; | ||
55 | +} | ||
56 | + | ||
57 | +static inline bool isar_feature_aa64_tgran4_2(const ARMISARegisters *id) | ||
58 | +{ | ||
59 | + unsigned t = FIELD_EX64(id->id_aa64mmfr0, ID_AA64MMFR0, TGRAN4_2); | ||
60 | + return t >= 2 || (t == 0 && isar_feature_aa64_tgran4(id)); | ||
61 | +} | ||
62 | + | ||
63 | +static inline bool isar_feature_aa64_tgran16_2(const ARMISARegisters *id) | ||
64 | +{ | ||
65 | + unsigned t = FIELD_EX64(id->id_aa64mmfr0, ID_AA64MMFR0, TGRAN16_2); | ||
66 | + return t >= 2 || (t == 0 && isar_feature_aa64_tgran16(id)); | ||
67 | +} | ||
68 | + | ||
69 | +static inline bool isar_feature_aa64_tgran64_2(const ARMISARegisters *id) | ||
70 | +{ | ||
71 | + unsigned t = FIELD_EX64(id->id_aa64mmfr0, ID_AA64MMFR0, TGRAN64_2); | ||
72 | + return t >= 2 || (t == 0 && isar_feature_aa64_tgran64(id)); | ||
73 | +} | ||
74 | + | ||
75 | +static inline bool isar_feature_aa64_fgt(const ARMISARegisters *id) | ||
76 | +{ | ||
77 | + return FIELD_EX64(id->id_aa64mmfr0, ID_AA64MMFR0, FGT) != 0; | ||
78 | +} | ||
79 | + | ||
80 | static inline bool isar_feature_aa64_vh(const ARMISARegisters *id) | ||
81 | { | ||
82 | return FIELD_EX64(id->id_aa64mmfr1, ID_AA64MMFR1, VH) != 0; | ||
83 | @@ -XXX,XX +XXX,XX @@ static inline bool isar_feature_aa64_hbc(const ARMISARegisters *id) | ||
84 | return FIELD_EX64(id->id_aa64isar2, ID_AA64ISAR2, BC) != 0; | ||
40 | } | 85 | } |
41 | + | 86 | |
42 | +static bool trans_VFML(DisasContext *s, arg_VFML *a) | 87 | -static inline bool isar_feature_aa64_tgran4_lpa2(const ARMISARegisters *id) |
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 | -{ |
88 | - gen_helper_gvec_3 *fn_gvec = NULL; | 89 | - return FIELD_SEX64(id->id_aa64mmfr0, ID_AA64MMFR0, TGRAN4) >= 1; |
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 | -} | 90 | -} |
157 | - | 91 | - |
158 | /* Advanced SIMD two registers and a scalar extension. | 92 | -static inline bool isar_feature_aa64_tgran4_2_lpa2(const ARMISARegisters *id) |
159 | * 31 24 23 22 20 16 12 11 10 9 8 3 0 | 93 | -{ |
160 | * +-----------------+----+---+----+----+----+---+----+---+----+---------+----+ | 94 | - unsigned t = FIELD_EX64(id->id_aa64mmfr0, ID_AA64MMFR0, TGRAN4_2); |
161 | @@ -XXX,XX +XXX,XX @@ static void disas_arm_insn(DisasContext *s, unsigned int insn) | 95 | - return t >= 3 || (t == 0 && isar_feature_aa64_tgran4_lpa2(id)); |
162 | } | 96 | -} |
163 | } | 97 | - |
164 | } | 98 | -static inline bool isar_feature_aa64_tgran16_lpa2(const ARMISARegisters *id) |
165 | - } else if ((insn & 0x0e000a00) == 0x0c000800 | 99 | -{ |
166 | - && arm_dc_feature(s, ARM_FEATURE_V8)) { | 100 | - return FIELD_EX64(id->id_aa64mmfr0, ID_AA64MMFR0, TGRAN16) >= 2; |
167 | - if (disas_neon_insn_3same_ext(s, insn)) { | 101 | -} |
168 | - goto illegal_op; | 102 | - |
169 | - } | 103 | -static inline bool isar_feature_aa64_tgran16_2_lpa2(const ARMISARegisters *id) |
170 | - return; | 104 | -{ |
171 | } else if ((insn & 0x0f000a00) == 0x0e000800 | 105 | - unsigned t = FIELD_EX64(id->id_aa64mmfr0, ID_AA64MMFR0, TGRAN16_2); |
172 | && arm_dc_feature(s, ARM_FEATURE_V8)) { | 106 | - return t >= 3 || (t == 0 && isar_feature_aa64_tgran16_lpa2(id)); |
173 | if (disas_neon_insn_2reg_scalar_ext(s, insn)) { | 107 | -} |
174 | @@ -XXX,XX +XXX,XX @@ static void disas_thumb2_insn(DisasContext *s, uint32_t insn) | 108 | - |
175 | } | 109 | -static inline bool isar_feature_aa64_tgran4(const ARMISARegisters *id) |
176 | break; | 110 | -{ |
177 | } | 111 | - return FIELD_SEX64(id->id_aa64mmfr0, ID_AA64MMFR0, TGRAN4) >= 0; |
178 | - if ((insn & 0xfe000a00) == 0xfc000800 | 112 | -} |
179 | + if ((insn & 0xff000a00) == 0xfe000800 | 113 | - |
180 | && arm_dc_feature(s, ARM_FEATURE_V8)) { | 114 | -static inline bool isar_feature_aa64_tgran16(const ARMISARegisters *id) |
181 | /* The Thumb2 and ARM encodings are identical. */ | 115 | -{ |
182 | - if (disas_neon_insn_3same_ext(s, insn)) { | 116 | - return FIELD_EX64(id->id_aa64mmfr0, ID_AA64MMFR0, TGRAN16) >= 1; |
183 | - goto illegal_op; | 117 | -} |
184 | - } | 118 | - |
185 | - } else if ((insn & 0xff000a00) == 0xfe000800 | 119 | -static inline bool isar_feature_aa64_tgran64(const ARMISARegisters *id) |
186 | - && arm_dc_feature(s, ARM_FEATURE_V8)) { | 120 | -{ |
187 | - /* The Thumb2 and ARM encodings are identical. */ | 121 | - return FIELD_SEX64(id->id_aa64mmfr0, ID_AA64MMFR0, TGRAN64) >= 0; |
188 | if (disas_neon_insn_2reg_scalar_ext(s, insn)) { | 122 | -} |
189 | goto illegal_op; | 123 | - |
190 | } | 124 | -static inline bool isar_feature_aa64_tgran4_2(const ARMISARegisters *id) |
125 | -{ | ||
126 | - unsigned t = FIELD_EX64(id->id_aa64mmfr0, ID_AA64MMFR0, TGRAN4_2); | ||
127 | - return t >= 2 || (t == 0 && isar_feature_aa64_tgran4(id)); | ||
128 | -} | ||
129 | - | ||
130 | -static inline bool isar_feature_aa64_tgran16_2(const ARMISARegisters *id) | ||
131 | -{ | ||
132 | - unsigned t = FIELD_EX64(id->id_aa64mmfr0, ID_AA64MMFR0, TGRAN16_2); | ||
133 | - return t >= 2 || (t == 0 && isar_feature_aa64_tgran16(id)); | ||
134 | -} | ||
135 | - | ||
136 | -static inline bool isar_feature_aa64_tgran64_2(const ARMISARegisters *id) | ||
137 | -{ | ||
138 | - unsigned t = FIELD_EX64(id->id_aa64mmfr0, ID_AA64MMFR0, TGRAN64_2); | ||
139 | - return t >= 2 || (t == 0 && isar_feature_aa64_tgran64(id)); | ||
140 | -} | ||
141 | - | ||
142 | -static inline bool isar_feature_aa64_fgt(const ARMISARegisters *id) | ||
143 | -{ | ||
144 | - return FIELD_EX64(id->id_aa64mmfr0, ID_AA64MMFR0, FGT) != 0; | ||
145 | -} | ||
146 | - | ||
147 | static inline bool isar_feature_aa64_dit(const ARMISARegisters *id) | ||
148 | { | ||
149 | return FIELD_EX64(id->id_aa64pfr0, ID_AA64PFR0, DIT) != 0; | ||
191 | -- | 150 | -- |
192 | 2.20.1 | 151 | 2.34.1 |
193 | 152 | ||
194 | 153 | diff view generated by jsdifflib |
1 | Convert the Neon VMUL, VMLA, VMLS and VSHL insns in the | 1 | Move the feature test functions that test ID_AA64ISAR* fields |
---|---|---|---|
2 | 3-reg-same grouping to decodetree. | 2 | together. |
3 | 3 | ||
4 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 4 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
5 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
5 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 6 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
6 | Message-id: 20200430181003.21682-20-peter.maydell@linaro.org | 7 | Message-id: 20231024163510.2972081-5-peter.maydell@linaro.org |
7 | --- | 8 | --- |
8 | target/arm/neon-dp.decode | 9 +++++++ | 9 | target/arm/cpu-features.h | 70 +++++++++++++++++++-------------------- |
9 | target/arm/translate-neon.inc.c | 44 +++++++++++++++++++++++++++++++++ | 10 | 1 file changed, 35 insertions(+), 35 deletions(-) |
10 | target/arm/translate.c | 28 +++------------------ | ||
11 | 3 files changed, 56 insertions(+), 25 deletions(-) | ||
12 | 11 | ||
13 | diff --git a/target/arm/neon-dp.decode b/target/arm/neon-dp.decode | 12 | diff --git a/target/arm/cpu-features.h b/target/arm/cpu-features.h |
14 | index XXXXXXX..XXXXXXX 100644 | 13 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/target/arm/neon-dp.decode | 14 | --- a/target/arm/cpu-features.h |
16 | +++ b/target/arm/neon-dp.decode | 15 | +++ b/target/arm/cpu-features.h |
17 | @@ -XXX,XX +XXX,XX @@ VCGT_U_3s 1111 001 1 0 . .. .... .... 0011 . . . 0 .... @3same | 16 | @@ -XXX,XX +XXX,XX @@ static inline bool isar_feature_aa64_rndr(const ARMISARegisters *id) |
18 | VCGE_S_3s 1111 001 0 0 . .. .... .... 0011 . . . 1 .... @3same | 17 | return FIELD_EX64(id->id_aa64isar0, ID_AA64ISAR0, RNDR) != 0; |
19 | VCGE_U_3s 1111 001 1 0 . .. .... .... 0011 . . . 1 .... @3same | 18 | } |
20 | 19 | ||
21 | +VSHL_S_3s 1111 001 0 0 . .. .... .... 0100 . . . 0 .... @3same | 20 | +static inline bool isar_feature_aa64_tlbirange(const ARMISARegisters *id) |
22 | +VSHL_U_3s 1111 001 1 0 . .. .... .... 0100 . . . 0 .... @3same | ||
23 | + | ||
24 | VMAX_S_3s 1111 001 0 0 . .. .... .... 0110 . . . 0 .... @3same | ||
25 | VMAX_U_3s 1111 001 1 0 . .. .... .... 0110 . . . 0 .... @3same | ||
26 | VMIN_S_3s 1111 001 0 0 . .. .... .... 0110 . . . 1 .... @3same | ||
27 | @@ -XXX,XX +XXX,XX @@ VSUB_3s 1111 001 1 0 . .. .... .... 1000 . . . 0 .... @3same | ||
28 | |||
29 | VTST_3s 1111 001 0 0 . .. .... .... 1000 . . . 1 .... @3same | ||
30 | VCEQ_3s 1111 001 1 0 . .. .... .... 1000 . . . 1 .... @3same | ||
31 | + | ||
32 | +VMLA_3s 1111 001 0 0 . .. .... .... 1001 . . . 0 .... @3same | ||
33 | +VMLS_3s 1111 001 1 0 . .. .... .... 1001 . . . 0 .... @3same | ||
34 | + | ||
35 | +VMUL_3s 1111 001 0 0 . .. .... .... 1001 . . . 1 .... @3same | ||
36 | +VMUL_p_3s 1111 001 1 0 . .. .... .... 1001 . . . 1 .... @3same | ||
37 | diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c | ||
38 | index XXXXXXX..XXXXXXX 100644 | ||
39 | --- a/target/arm/translate-neon.inc.c | ||
40 | +++ b/target/arm/translate-neon.inc.c | ||
41 | @@ -XXX,XX +XXX,XX @@ DO_3SAME_NO_SZ_3(VMAX_S, tcg_gen_gvec_smax) | ||
42 | DO_3SAME_NO_SZ_3(VMAX_U, tcg_gen_gvec_umax) | ||
43 | DO_3SAME_NO_SZ_3(VMIN_S, tcg_gen_gvec_smin) | ||
44 | DO_3SAME_NO_SZ_3(VMIN_U, tcg_gen_gvec_umin) | ||
45 | +DO_3SAME_NO_SZ_3(VMUL, tcg_gen_gvec_mul) | ||
46 | |||
47 | #define DO_3SAME_CMP(INSN, COND) \ | ||
48 | static void gen_##INSN##_3s(unsigned vece, uint32_t rd_ofs, \ | ||
49 | @@ -XXX,XX +XXX,XX @@ DO_3SAME_GVEC4(VQADD_S, sqadd_op) | ||
50 | DO_3SAME_GVEC4(VQADD_U, uqadd_op) | ||
51 | DO_3SAME_GVEC4(VQSUB_S, sqsub_op) | ||
52 | DO_3SAME_GVEC4(VQSUB_U, uqsub_op) | ||
53 | + | ||
54 | +static void gen_VMUL_p_3s(unsigned vece, uint32_t rd_ofs, uint32_t rn_ofs, | ||
55 | + uint32_t rm_ofs, uint32_t oprsz, uint32_t maxsz) | ||
56 | +{ | 21 | +{ |
57 | + tcg_gen_gvec_3_ool(rd_ofs, rn_ofs, rm_ofs, oprsz, maxsz, | 22 | + return FIELD_EX64(id->id_aa64isar0, ID_AA64ISAR0, TLB) == 2; |
58 | + 0, gen_helper_gvec_pmul_b); | ||
59 | +} | 23 | +} |
60 | + | 24 | + |
61 | +static bool trans_VMUL_p_3s(DisasContext *s, arg_3same *a) | 25 | +static inline bool isar_feature_aa64_tlbios(const ARMISARegisters *id) |
62 | +{ | 26 | +{ |
63 | + if (a->size != 0) { | 27 | + return FIELD_EX64(id->id_aa64isar0, ID_AA64ISAR0, TLB) != 0; |
64 | + return false; | ||
65 | + } | ||
66 | + return do_3same(s, a, gen_VMUL_p_3s); | ||
67 | +} | 28 | +} |
68 | + | 29 | + |
69 | +#define DO_3SAME_GVEC3_NO_SZ_3(INSN, OPARRAY) \ | 30 | static inline bool isar_feature_aa64_jscvt(const ARMISARegisters *id) |
70 | + static void gen_##INSN##_3s(unsigned vece, uint32_t rd_ofs, \ | 31 | { |
71 | + uint32_t rn_ofs, uint32_t rm_ofs, \ | 32 | return FIELD_EX64(id->id_aa64isar1, ID_AA64ISAR1, JSCVT) != 0; |
72 | + uint32_t oprsz, uint32_t maxsz) \ | 33 | @@ -XXX,XX +XXX,XX @@ static inline bool isar_feature_aa64_pauth_qarma3(const ARMISARegisters *id) |
73 | + { \ | 34 | return FIELD_EX64(id->id_aa64isar2, ID_AA64ISAR2, APA3) != 0; |
74 | + tcg_gen_gvec_3(rd_ofs, rn_ofs, rm_ofs, \ | 35 | } |
75 | + oprsz, maxsz, &OPARRAY[vece]); \ | 36 | |
76 | + } \ | 37 | -static inline bool isar_feature_aa64_tlbirange(const ARMISARegisters *id) |
77 | + DO_3SAME_NO_SZ_3(INSN, gen_##INSN##_3s) | 38 | -{ |
39 | - return FIELD_EX64(id->id_aa64isar0, ID_AA64ISAR0, TLB) == 2; | ||
40 | -} | ||
41 | - | ||
42 | -static inline bool isar_feature_aa64_tlbios(const ARMISARegisters *id) | ||
43 | -{ | ||
44 | - return FIELD_EX64(id->id_aa64isar0, ID_AA64ISAR0, TLB) != 0; | ||
45 | -} | ||
46 | - | ||
47 | static inline bool isar_feature_aa64_sb(const ARMISARegisters *id) | ||
48 | { | ||
49 | return FIELD_EX64(id->id_aa64isar1, ID_AA64ISAR1, SB) != 0; | ||
50 | @@ -XXX,XX +XXX,XX @@ static inline bool isar_feature_aa64_bf16(const ARMISARegisters *id) | ||
51 | return FIELD_EX64(id->id_aa64isar1, ID_AA64ISAR1, BF16) != 0; | ||
52 | } | ||
53 | |||
54 | +static inline bool isar_feature_aa64_rcpc_8_3(const ARMISARegisters *id) | ||
55 | +{ | ||
56 | + return FIELD_EX64(id->id_aa64isar1, ID_AA64ISAR1, LRCPC) != 0; | ||
57 | +} | ||
78 | + | 58 | + |
59 | +static inline bool isar_feature_aa64_rcpc_8_4(const ARMISARegisters *id) | ||
60 | +{ | ||
61 | + return FIELD_EX64(id->id_aa64isar1, ID_AA64ISAR1, LRCPC) >= 2; | ||
62 | +} | ||
79 | + | 63 | + |
80 | +DO_3SAME_GVEC3_NO_SZ_3(VMLA, mla_op) | 64 | +static inline bool isar_feature_aa64_i8mm(const ARMISARegisters *id) |
81 | +DO_3SAME_GVEC3_NO_SZ_3(VMLS, mls_op) | 65 | +{ |
66 | + return FIELD_EX64(id->id_aa64isar1, ID_AA64ISAR1, I8MM) != 0; | ||
67 | +} | ||
82 | + | 68 | + |
83 | +#define DO_3SAME_GVEC3_SHIFT(INSN, OPARRAY) \ | 69 | +static inline bool isar_feature_aa64_hbc(const ARMISARegisters *id) |
84 | + static void gen_##INSN##_3s(unsigned vece, uint32_t rd_ofs, \ | 70 | +{ |
85 | + uint32_t rn_ofs, uint32_t rm_ofs, \ | 71 | + return FIELD_EX64(id->id_aa64isar2, ID_AA64ISAR2, BC) != 0; |
86 | + uint32_t oprsz, uint32_t maxsz) \ | 72 | +} |
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 | + | 73 | + |
94 | +DO_3SAME_GVEC3_SHIFT(VSHL_S, sshl_op) | 74 | +static inline bool isar_feature_aa64_mops(const ARMISARegisters *id) |
95 | +DO_3SAME_GVEC3_SHIFT(VSHL_U, ushl_op) | 75 | +{ |
96 | diff --git a/target/arm/translate.c b/target/arm/translate.c | 76 | + return FIELD_EX64(id->id_aa64isar2, ID_AA64ISAR2, MOPS); |
97 | index XXXXXXX..XXXXXXX 100644 | 77 | +} |
98 | --- a/target/arm/translate.c | 78 | + |
99 | +++ b/target/arm/translate.c | 79 | static inline bool isar_feature_aa64_fp_simd(const ARMISARegisters *id) |
100 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) | 80 | { |
101 | } | 81 | /* We always set the AdvSIMD and FP fields identically. */ |
102 | return 1; | 82 | @@ -XXX,XX +XXX,XX @@ static inline bool isar_feature_aa64_pmuv3p5(const ARMISARegisters *id) |
103 | 83 | FIELD_EX64(id->id_aa64dfr0, ID_AA64DFR0, PMUVER) != 0xf; | |
104 | - case NEON_3R_VMUL: /* VMUL */ | 84 | } |
105 | - if (u) { | 85 | |
106 | - /* Polynomial case allows only P8. */ | 86 | -static inline bool isar_feature_aa64_rcpc_8_3(const ARMISARegisters *id) |
107 | - if (size != 0) { | 87 | -{ |
108 | - return 1; | 88 | - return FIELD_EX64(id->id_aa64isar1, ID_AA64ISAR1, LRCPC) != 0; |
109 | - } | 89 | -} |
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 | - | 90 | - |
118 | - case NEON_3R_VML: /* VMLA, VMLS */ | 91 | -static inline bool isar_feature_aa64_rcpc_8_4(const ARMISARegisters *id) |
119 | - tcg_gen_gvec_3(rd_ofs, rn_ofs, rm_ofs, vec_size, vec_size, | 92 | -{ |
120 | - u ? &mls_op[size] : &mla_op[size]); | 93 | - return FIELD_EX64(id->id_aa64isar1, ID_AA64ISAR1, LRCPC) >= 2; |
121 | - return 0; | 94 | -} |
122 | - | 95 | - |
123 | - case NEON_3R_VSHL: | 96 | -static inline bool isar_feature_aa64_i8mm(const ARMISARegisters *id) |
124 | - /* Note the operation is vshl vd,vm,vn */ | 97 | -{ |
125 | - tcg_gen_gvec_3(rd_ofs, rm_ofs, rn_ofs, vec_size, vec_size, | 98 | - return FIELD_EX64(id->id_aa64isar1, ID_AA64ISAR1, I8MM) != 0; |
126 | - u ? &ushl_op[size] : &sshl_op[size]); | 99 | -} |
127 | - return 0; | ||
128 | - | 100 | - |
129 | case NEON_3R_VADD_VSUB: | 101 | -static inline bool isar_feature_aa64_hbc(const ARMISARegisters *id) |
130 | case NEON_3R_LOGIC: | 102 | -{ |
131 | case NEON_3R_VMAX: | 103 | - return FIELD_EX64(id->id_aa64isar2, ID_AA64ISAR2, BC) != 0; |
132 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) | 104 | -} |
133 | case NEON_3R_VCGE: | 105 | - |
134 | case NEON_3R_VQADD: | 106 | static inline bool isar_feature_aa64_dit(const ARMISARegisters *id) |
135 | case NEON_3R_VQSUB: | 107 | { |
136 | + case NEON_3R_VMUL: | 108 | return FIELD_EX64(id->id_aa64pfr0, ID_AA64PFR0, DIT) != 0; |
137 | + case NEON_3R_VML: | 109 | @@ -XXX,XX +XXX,XX @@ static inline bool isar_feature_aa64_doublelock(const ARMISARegisters *id) |
138 | + case NEON_3R_VSHL: | 110 | return FIELD_SEX64(id->id_aa64dfr0, ID_AA64DFR0, DOUBLELOCK) >= 0; |
139 | /* Already handled by decodetree */ | 111 | } |
140 | return 1; | 112 | |
141 | } | 113 | -static inline bool isar_feature_aa64_mops(const ARMISARegisters *id) |
114 | -{ | ||
115 | - return FIELD_EX64(id->id_aa64isar2, ID_AA64ISAR2, MOPS); | ||
116 | -} | ||
117 | - | ||
118 | /* | ||
119 | * Feature tests for "does this exist in either 32-bit or 64-bit?" | ||
120 | */ | ||
142 | -- | 121 | -- |
143 | 2.20.1 | 122 | 2.34.1 |
144 | 123 | ||
145 | 124 | diff view generated by jsdifflib |
1 | We define ARMMMUIdx_Stage2 as being an MMU index which uses a QEMU | 1 | Move all the ID_AA64PFR* feature test functions together. |
---|---|---|---|
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 | |||
6 | Remove Stage2 from the list of ARM MMU indexes which correspond to | ||
7 | real core MMU indexes, and instead put it in the set of "NOTLB" ARM | ||
8 | MMU indexes. | ||
9 | |||
10 | This allows us to drop NB_MMU_MODES to 11. It also means we can | ||
11 | safely add support for the ARMv8.3-TTS2UXN extension, which adds | ||
12 | permission bits to the stage 2 descriptors which define execute | ||
13 | permission separatel for EL0 and EL1; supporting that while keeping | ||
14 | Stage2 in a QEMU TLB would require us to use separate TLBs for | ||
15 | "Stage2 for an EL0 access" and "Stage2 for an EL1 access", which is a | ||
16 | lot of extra complication given we aren't even using the QEMU TLB. | ||
17 | |||
18 | In the process of updating the comment on our MMU index use, | ||
19 | fix a couple of other minor errors: | ||
20 | * NS EL2 EL2&0 was missing from the list in the comment | ||
21 | * some text hadn't been updated from when we bumped NB_MMU_MODES | ||
22 | above 8 | ||
23 | 2 | ||
24 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 3 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
25 | Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | 4 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
26 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 5 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
27 | Message-id: 20200330210400.11724-2-peter.maydell@linaro.org | 6 | Message-id: 20231024163510.2972081-6-peter.maydell@linaro.org |
28 | --- | 7 | --- |
29 | target/arm/cpu-param.h | 2 +- | 8 | target/arm/cpu-features.h | 86 +++++++++++++++++++-------------------- |
30 | target/arm/cpu.h | 21 +++++--- | 9 | 1 file changed, 43 insertions(+), 43 deletions(-) |
31 | target/arm/helper.c | 112 ++++------------------------------------- | ||
32 | 3 files changed, 27 insertions(+), 108 deletions(-) | ||
33 | 10 | ||
34 | diff --git a/target/arm/cpu-param.h b/target/arm/cpu-param.h | 11 | diff --git a/target/arm/cpu-features.h b/target/arm/cpu-features.h |
35 | index XXXXXXX..XXXXXXX 100644 | 12 | index XXXXXXX..XXXXXXX 100644 |
36 | --- a/target/arm/cpu-param.h | 13 | --- a/target/arm/cpu-features.h |
37 | +++ b/target/arm/cpu-param.h | 14 | +++ b/target/arm/cpu-features.h |
38 | @@ -XXX,XX +XXX,XX @@ | 15 | @@ -XXX,XX +XXX,XX @@ static inline bool isar_feature_aa64_rme(const ARMISARegisters *id) |
39 | # define TARGET_PAGE_BITS_MIN 10 | 16 | return FIELD_EX64(id->id_aa64pfr0, ID_AA64PFR0, RME) != 0; |
40 | #endif | ||
41 | |||
42 | -#define NB_MMU_MODES 12 | ||
43 | +#define NB_MMU_MODES 11 | ||
44 | |||
45 | #endif | ||
46 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h | ||
47 | index XXXXXXX..XXXXXXX 100644 | ||
48 | --- a/target/arm/cpu.h | ||
49 | +++ b/target/arm/cpu.h | ||
50 | @@ -XXX,XX +XXX,XX @@ bool write_cpustate_to_list(ARMCPU *cpu, bool kvm_sync); | ||
51 | * handling via the TLB. The only way to do a stage 1 translation without | ||
52 | * the immediate stage 2 translation is via the ATS or AT system insns, | ||
53 | * which can be slow-pathed and always do a page table walk. | ||
54 | + * The only use of stage 2 translations is either as part of an s1+2 | ||
55 | + * lookup or when loading the descriptors during a stage 1 page table walk, | ||
56 | + * and in both those cases we don't use the TLB. | ||
57 | * 4. we can also safely fold together the "32 bit EL3" and "64 bit EL3" | ||
58 | * translation regimes, because they map reasonably well to each other | ||
59 | * and they can't both be active at the same time. | ||
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 | ||
121 | index XXXXXXX..XXXXXXX 100644 | ||
122 | --- a/target/arm/helper.c | ||
123 | +++ b/target/arm/helper.c | ||
124 | @@ -XXX,XX +XXX,XX @@ static void tlbiall_nsnh_write(CPUARMState *env, const ARMCPRegInfo *ri, | ||
125 | tlb_flush_by_mmuidx(cs, | ||
126 | ARMMMUIdxBit_E10_1 | | ||
127 | ARMMMUIdxBit_E10_1_PAN | | ||
128 | - ARMMMUIdxBit_E10_0 | | ||
129 | - ARMMMUIdxBit_Stage2); | ||
130 | + ARMMMUIdxBit_E10_0); | ||
131 | } | 17 | } |
132 | 18 | ||
133 | static void tlbiall_nsnh_is_write(CPUARMState *env, const ARMCPRegInfo *ri, | 19 | +static inline bool isar_feature_aa64_dit(const ARMISARegisters *id) |
134 | @@ -XXX,XX +XXX,XX @@ static void tlbiall_nsnh_is_write(CPUARMState *env, const ARMCPRegInfo *ri, | 20 | +{ |
135 | tlb_flush_by_mmuidx_all_cpus_synced(cs, | 21 | + return FIELD_EX64(id->id_aa64pfr0, ID_AA64PFR0, DIT) != 0; |
136 | ARMMMUIdxBit_E10_1 | | 22 | +} |
137 | ARMMMUIdxBit_E10_1_PAN | | 23 | + |
138 | - ARMMMUIdxBit_E10_0 | | 24 | +static inline bool isar_feature_aa64_scxtnum(const ARMISARegisters *id) |
139 | - ARMMMUIdxBit_Stage2); | 25 | +{ |
140 | + ARMMMUIdxBit_E10_0); | 26 | + int key = FIELD_EX64(id->id_aa64pfr0, ID_AA64PFR0, CSV2); |
27 | + if (key >= 2) { | ||
28 | + return true; /* FEAT_CSV2_2 */ | ||
29 | + } | ||
30 | + if (key == 1) { | ||
31 | + key = FIELD_EX64(id->id_aa64pfr1, ID_AA64PFR1, CSV2_FRAC); | ||
32 | + return key >= 2; /* FEAT_CSV2_1p2 */ | ||
33 | + } | ||
34 | + return false; | ||
35 | +} | ||
36 | + | ||
37 | +static inline bool isar_feature_aa64_ssbs(const ARMISARegisters *id) | ||
38 | +{ | ||
39 | + return FIELD_EX64(id->id_aa64pfr1, ID_AA64PFR1, SSBS) != 0; | ||
40 | +} | ||
41 | + | ||
42 | +static inline bool isar_feature_aa64_bti(const ARMISARegisters *id) | ||
43 | +{ | ||
44 | + return FIELD_EX64(id->id_aa64pfr1, ID_AA64PFR1, BT) != 0; | ||
45 | +} | ||
46 | + | ||
47 | +static inline bool isar_feature_aa64_mte_insn_reg(const ARMISARegisters *id) | ||
48 | +{ | ||
49 | + return FIELD_EX64(id->id_aa64pfr1, ID_AA64PFR1, MTE) != 0; | ||
50 | +} | ||
51 | + | ||
52 | +static inline bool isar_feature_aa64_mte(const ARMISARegisters *id) | ||
53 | +{ | ||
54 | + return FIELD_EX64(id->id_aa64pfr1, ID_AA64PFR1, MTE) >= 2; | ||
55 | +} | ||
56 | + | ||
57 | +static inline bool isar_feature_aa64_sme(const ARMISARegisters *id) | ||
58 | +{ | ||
59 | + return FIELD_EX64(id->id_aa64pfr1, ID_AA64PFR1, SME) != 0; | ||
60 | +} | ||
61 | + | ||
62 | static inline bool isar_feature_aa64_tgran4_lpa2(const ARMISARegisters *id) | ||
63 | { | ||
64 | return FIELD_SEX64(id->id_aa64mmfr0, ID_AA64MMFR0, TGRAN4) >= 1; | ||
65 | @@ -XXX,XX +XXX,XX @@ static inline bool isar_feature_aa64_e0pd(const ARMISARegisters *id) | ||
66 | return FIELD_EX64(id->id_aa64mmfr2, ID_AA64MMFR2, E0PD) != 0; | ||
141 | } | 67 | } |
142 | 68 | ||
143 | -static void tlbiipas2_write(CPUARMState *env, const ARMCPRegInfo *ri, | 69 | -static inline bool isar_feature_aa64_bti(const ARMISARegisters *id) |
144 | - uint64_t value) | ||
145 | -{ | 70 | -{ |
146 | - /* Invalidate by IPA. This has to invalidate any structures that | 71 | - return FIELD_EX64(id->id_aa64pfr1, ID_AA64PFR1, BT) != 0; |
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 | -} | 72 | -} |
163 | - | 73 | - |
164 | -static void tlbiipas2_is_write(CPUARMState *env, const ARMCPRegInfo *ri, | 74 | -static inline bool isar_feature_aa64_mte_insn_reg(const ARMISARegisters *id) |
165 | - uint64_t value) | ||
166 | -{ | 75 | -{ |
167 | - CPUState *cs = env_cpu(env); | 76 | - return FIELD_EX64(id->id_aa64pfr1, ID_AA64PFR1, MTE) != 0; |
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 | -} | 77 | -} |
229 | - | 78 | - |
230 | -static void tlbi_aa64_ipas2e1is_write(CPUARMState *env, const ARMCPRegInfo *ri, | 79 | -static inline bool isar_feature_aa64_mte(const ARMISARegisters *id) |
231 | - uint64_t value) | ||
232 | -{ | 80 | -{ |
233 | - CPUState *cs = env_cpu(env); | 81 | - return FIELD_EX64(id->id_aa64pfr1, ID_AA64PFR1, MTE) >= 2; |
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 | -} | 82 | -} |
245 | - | 83 | - |
246 | static CPAccessResult aa64_zva_access(CPUARMState *env, const ARMCPRegInfo *ri, | 84 | -static inline bool isar_feature_aa64_sme(const ARMISARegisters *id) |
247 | bool isread) | 85 | -{ |
86 | - return FIELD_EX64(id->id_aa64pfr1, ID_AA64PFR1, SME) != 0; | ||
87 | -} | ||
88 | - | ||
89 | static inline bool isar_feature_aa64_pmuv3p1(const ARMISARegisters *id) | ||
248 | { | 90 | { |
249 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v8_cp_reginfo[] = { | 91 | return FIELD_EX64(id->id_aa64dfr0, ID_AA64DFR0, PMUVER) >= 4 && |
250 | .writefn = tlbi_aa64_vae1_write }, | 92 | @@ -XXX,XX +XXX,XX @@ static inline bool isar_feature_aa64_pmuv3p5(const ARMISARegisters *id) |
251 | { .name = "TLBI_IPAS2E1IS", .state = ARM_CP_STATE_AA64, | 93 | FIELD_EX64(id->id_aa64dfr0, ID_AA64DFR0, PMUVER) != 0xf; |
252 | .opc0 = 1, .opc1 = 4, .crn = 8, .crm = 0, .opc2 = 1, | 94 | } |
253 | - .access = PL2_W, .type = ARM_CP_NO_RAW, | 95 | |
254 | - .writefn = tlbi_aa64_ipas2e1is_write }, | 96 | -static inline bool isar_feature_aa64_dit(const ARMISARegisters *id) |
255 | + .access = PL2_W, .type = ARM_CP_NOP }, | 97 | -{ |
256 | { .name = "TLBI_IPAS2LE1IS", .state = ARM_CP_STATE_AA64, | 98 | - return FIELD_EX64(id->id_aa64pfr0, ID_AA64PFR0, DIT) != 0; |
257 | .opc0 = 1, .opc1 = 4, .crn = 8, .crm = 0, .opc2 = 5, | 99 | -} |
258 | - .access = PL2_W, .type = ARM_CP_NO_RAW, | 100 | - |
259 | - .writefn = tlbi_aa64_ipas2e1is_write }, | 101 | -static inline bool isar_feature_aa64_scxtnum(const ARMISARegisters *id) |
260 | + .access = PL2_W, .type = ARM_CP_NOP }, | 102 | -{ |
261 | { .name = "TLBI_ALLE1IS", .state = ARM_CP_STATE_AA64, | 103 | - int key = FIELD_EX64(id->id_aa64pfr0, ID_AA64PFR0, CSV2); |
262 | .opc0 = 1, .opc1 = 4, .crn = 8, .crm = 3, .opc2 = 4, | 104 | - if (key >= 2) { |
263 | .access = PL2_W, .type = ARM_CP_NO_RAW, | 105 | - return true; /* FEAT_CSV2_2 */ |
264 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v8_cp_reginfo[] = { | 106 | - } |
265 | .writefn = tlbi_aa64_alle1is_write }, | 107 | - if (key == 1) { |
266 | { .name = "TLBI_IPAS2E1", .state = ARM_CP_STATE_AA64, | 108 | - key = FIELD_EX64(id->id_aa64pfr1, ID_AA64PFR1, CSV2_FRAC); |
267 | .opc0 = 1, .opc1 = 4, .crn = 8, .crm = 4, .opc2 = 1, | 109 | - return key >= 2; /* FEAT_CSV2_1p2 */ |
268 | - .access = PL2_W, .type = ARM_CP_NO_RAW, | 110 | - } |
269 | - .writefn = tlbi_aa64_ipas2e1_write }, | 111 | - return false; |
270 | + .access = PL2_W, .type = ARM_CP_NOP }, | 112 | -} |
271 | { .name = "TLBI_IPAS2LE1", .state = ARM_CP_STATE_AA64, | 113 | - |
272 | .opc0 = 1, .opc1 = 4, .crn = 8, .crm = 4, .opc2 = 5, | 114 | -static inline bool isar_feature_aa64_ssbs(const ARMISARegisters *id) |
273 | - .access = PL2_W, .type = ARM_CP_NO_RAW, | 115 | -{ |
274 | - .writefn = tlbi_aa64_ipas2e1_write }, | 116 | - return FIELD_EX64(id->id_aa64pfr1, ID_AA64PFR1, SSBS) != 0; |
275 | + .access = PL2_W, .type = ARM_CP_NOP }, | 117 | -} |
276 | { .name = "TLBI_ALLE1", .state = ARM_CP_STATE_AA64, | 118 | - |
277 | .opc0 = 1, .opc1 = 4, .crn = 8, .crm = 7, .opc2 = 4, | 119 | static inline bool isar_feature_aa64_debugv8p2(const ARMISARegisters *id) |
278 | .access = PL2_W, .type = ARM_CP_NO_RAW, | 120 | { |
279 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v8_cp_reginfo[] = { | 121 | return FIELD_EX64(id->id_aa64dfr0, ID_AA64DFR0, DEBUGVER) >= 8; |
280 | .writefn = tlbimva_hyp_is_write }, | ||
281 | { .name = "TLBIIPAS2", | ||
282 | .cp = 15, .opc1 = 4, .crn = 8, .crm = 4, .opc2 = 1, | ||
283 | - .type = ARM_CP_NO_RAW, .access = PL2_W, | ||
284 | - .writefn = tlbiipas2_write }, | ||
285 | + .type = ARM_CP_NOP, .access = PL2_W }, | ||
286 | { .name = "TLBIIPAS2IS", | ||
287 | .cp = 15, .opc1 = 4, .crn = 8, .crm = 0, .opc2 = 1, | ||
288 | - .type = ARM_CP_NO_RAW, .access = PL2_W, | ||
289 | - .writefn = tlbiipas2_is_write }, | ||
290 | + .type = ARM_CP_NOP, .access = PL2_W }, | ||
291 | { .name = "TLBIIPAS2L", | ||
292 | .cp = 15, .opc1 = 4, .crn = 8, .crm = 4, .opc2 = 5, | ||
293 | - .type = ARM_CP_NO_RAW, .access = PL2_W, | ||
294 | - .writefn = tlbiipas2_write }, | ||
295 | + .type = ARM_CP_NOP, .access = PL2_W }, | ||
296 | { .name = "TLBIIPAS2LIS", | ||
297 | .cp = 15, .opc1 = 4, .crn = 8, .crm = 0, .opc2 = 5, | ||
298 | - .type = ARM_CP_NO_RAW, .access = PL2_W, | ||
299 | - .writefn = tlbiipas2_is_write }, | ||
300 | + .type = ARM_CP_NOP, .access = PL2_W }, | ||
301 | /* 32 bit cache operations */ | ||
302 | { .name = "ICIALLUIS", .cp = 15, .opc1 = 0, .crn = 7, .crm = 1, .opc2 = 0, | ||
303 | .type = ARM_CP_NOP, .access = PL1_W, .accessfn = aa64_cacheop_pou_access }, | ||
304 | -- | 122 | -- |
305 | 2.20.1 | 123 | 2.34.1 |
306 | 124 | ||
307 | 125 | diff view generated by jsdifflib |
1 | Convert the Neon "load/store single structure to one lane" insns to | 1 | Move all the ID_AA64DFR* feature test functions together. |
---|---|---|---|
2 | decodetree. | ||
3 | |||
4 | As this is the last set of insns in the neon load/store group, | ||
5 | we can remove the whole disas_neon_ls_insn() function. | ||
6 | 2 | ||
7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 3 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
4 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
8 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 5 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
9 | Message-id: 20200430181003.21682-14-peter.maydell@linaro.org | 6 | Message-id: 20231024163510.2972081-7-peter.maydell@linaro.org |
10 | --- | 7 | --- |
11 | target/arm/neon-ls.decode | 11 +++ | 8 | target/arm/cpu-features.h | 10 +++++----- |
12 | target/arm/translate-neon.inc.c | 89 +++++++++++++++++++ | 9 | 1 file changed, 5 insertions(+), 5 deletions(-) |
13 | target/arm/translate.c | 147 -------------------------------- | ||
14 | 3 files changed, 100 insertions(+), 147 deletions(-) | ||
15 | 10 | ||
16 | diff --git a/target/arm/neon-ls.decode b/target/arm/neon-ls.decode | 11 | diff --git a/target/arm/cpu-features.h b/target/arm/cpu-features.h |
17 | index XXXXXXX..XXXXXXX 100644 | 12 | index XXXXXXX..XXXXXXX 100644 |
18 | --- a/target/arm/neon-ls.decode | 13 | --- a/target/arm/cpu-features.h |
19 | +++ b/target/arm/neon-ls.decode | 14 | +++ b/target/arm/cpu-features.h |
20 | @@ -XXX,XX +XXX,XX @@ VLDST_multiple 1111 0100 0 . l:1 0 rn:4 .... itype:4 size:2 align:2 rm:4 \ | 15 | @@ -XXX,XX +XXX,XX @@ static inline bool isar_feature_aa64_debugv8p2(const ARMISARegisters *id) |
21 | 16 | return FIELD_EX64(id->id_aa64dfr0, ID_AA64DFR0, DEBUGVER) >= 8; | |
22 | VLD_all_lanes 1111 0100 1 . 1 0 rn:4 .... 11 n:2 size:2 t:1 a:1 rm:4 \ | 17 | } |
23 | vd=%vd_dp | 18 | |
24 | + | 19 | +static inline bool isar_feature_aa64_doublelock(const ARMISARegisters *id) |
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 | +{ | 20 | +{ |
45 | + return x + 1; | 21 | + return FIELD_SEX64(id->id_aa64dfr0, ID_AA64DFR0, DOUBLELOCK) >= 0; |
46 | +} | 22 | +} |
47 | + | 23 | + |
48 | /* Include the generated Neon decoder */ | 24 | static inline bool isar_feature_aa64_sve2(const ARMISARegisters *id) |
49 | #include "decode-neon-dp.inc.c" | 25 | { |
50 | #include "decode-neon-ls.inc.c" | 26 | return FIELD_EX64(id->id_aa64zfr0, ID_AA64ZFR0, SVEVER) != 0; |
51 | @@ -XXX,XX +XXX,XX @@ static bool trans_VLD_all_lanes(DisasContext *s, arg_VLD_all_lanes *a) | 27 | @@ -XXX,XX +XXX,XX @@ static inline bool isar_feature_aa64_sme_fa64(const ARMISARegisters *id) |
52 | 28 | return FIELD_EX64(id->id_aa64smfr0, ID_AA64SMFR0, FA64); | |
53 | return true; | ||
54 | } | 29 | } |
55 | + | 30 | |
56 | +static bool trans_VLDST_single(DisasContext *s, arg_VLDST_single *a) | 31 | -static inline bool isar_feature_aa64_doublelock(const ARMISARegisters *id) |
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 | -{ | 32 | -{ |
152 | - int rd, rn, rm; | 33 | - return FIELD_SEX64(id->id_aa64dfr0, ID_AA64DFR0, DOUBLELOCK) >= 0; |
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 | -} | 34 | -} |
280 | - | 35 | - |
281 | static inline void gen_neon_narrow(int size, TCGv_i32 dest, TCGv_i64 src) | 36 | /* |
282 | { | 37 | * Feature tests for "does this exist in either 32-bit or 64-bit?" |
283 | switch (size) { | 38 | */ |
284 | @@ -XXX,XX +XXX,XX @@ static void disas_arm_insn(DisasContext *s, unsigned int insn) | ||
285 | } | ||
286 | return; | ||
287 | } | ||
288 | - if ((insn & 0x0f100000) == 0x04000000) { | ||
289 | - /* NEON load/store. */ | ||
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 | -- | 39 | -- |
312 | 2.20.1 | 40 | 2.34.1 |
313 | 41 | ||
314 | 42 | diff view generated by jsdifflib |
1 | Somewhere along theline we accidentally added a duplicate | 1 | In commit 442c9d682c94fc2 when we converted the ERET, ERETAA, ERETAB |
---|---|---|---|
2 | "using D16-D31 when they don't exist" check to do_vfm_dp() | 2 | instructions to decodetree, the conversion accidentally lost the |
3 | (probably an artifact of a patchseries rebase). Remove it. | 3 | correct setting of the syndrome register when taking a trap because |
4 | of the FEAT_FGT HFGITR_EL1.ERET bit. Instead of reporting a correct | ||
5 | full syndrome value with the EC and IL bits, we only reported the low | ||
6 | two bits of the syndrome, because the call to syn_erettrap() got | ||
7 | dropped. | ||
4 | 8 | ||
9 | Fix the syndrome values for these traps by reinstating the | ||
10 | syn_erettrap() calls. | ||
11 | |||
12 | Fixes: 442c9d682c94fc2 ("target/arm: Convert ERET, ERETAA, ERETAB to decodetree") | ||
13 | Cc: qemu-stable@nongnu.org | ||
5 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 14 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
6 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 15 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
7 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 16 | Message-id: 20231024172438.2990945-1-peter.maydell@linaro.org |
8 | Message-id: 20200430181003.21682-2-peter.maydell@linaro.org | ||
9 | --- | 17 | --- |
10 | target/arm/translate-vfp.inc.c | 6 ------ | 18 | target/arm/tcg/translate-a64.c | 4 ++-- |
11 | 1 file changed, 6 deletions(-) | 19 | 1 file changed, 2 insertions(+), 2 deletions(-) |
12 | 20 | ||
13 | diff --git a/target/arm/translate-vfp.inc.c b/target/arm/translate-vfp.inc.c | 21 | diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c |
14 | index XXXXXXX..XXXXXXX 100644 | 22 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/target/arm/translate-vfp.inc.c | 23 | --- a/target/arm/tcg/translate-a64.c |
16 | +++ b/target/arm/translate-vfp.inc.c | 24 | +++ b/target/arm/tcg/translate-a64.c |
17 | @@ -XXX,XX +XXX,XX @@ static bool do_vfm_dp(DisasContext *s, arg_VFMA_dp *a, bool neg_n, bool neg_d) | 25 | @@ -XXX,XX +XXX,XX @@ static bool trans_ERET(DisasContext *s, arg_ERET *a) |
18 | return false; | 26 | return false; |
19 | } | 27 | } |
20 | 28 | if (s->fgt_eret) { | |
21 | - /* UNDEF accesses to D16-D31 if they don't exist. */ | 29 | - gen_exception_insn_el(s, 0, EXCP_UDEF, 0, 2); |
22 | - if (!dc_isar_feature(aa32_simd_r32, s) && | 30 | + gen_exception_insn_el(s, 0, EXCP_UDEF, syn_erettrap(0), 2); |
23 | - ((a->vd | a->vn | a->vm) & 0x10)) { | ||
24 | - return false; | ||
25 | - } | ||
26 | - | ||
27 | if (!vfp_access_check(s)) { | ||
28 | return true; | 31 | return true; |
29 | } | 32 | } |
33 | dst = tcg_temp_new_i64(); | ||
34 | @@ -XXX,XX +XXX,XX @@ static bool trans_ERETA(DisasContext *s, arg_reta *a) | ||
35 | } | ||
36 | /* The FGT trap takes precedence over an auth trap. */ | ||
37 | if (s->fgt_eret) { | ||
38 | - gen_exception_insn_el(s, 0, EXCP_UDEF, a->m ? 3 : 2, 2); | ||
39 | + gen_exception_insn_el(s, 0, EXCP_UDEF, syn_erettrap(a->m ? 3 : 2), 2); | ||
40 | return true; | ||
41 | } | ||
42 | dst = tcg_temp_new_i64(); | ||
30 | -- | 43 | -- |
31 | 2.20.1 | 44 | 2.34.1 |
32 | |||
33 | diff view generated by jsdifflib |
1 | Convert the Neon VQADD/VQSUB insns in the 3-reg-same grouping | 1 | From: Philippe Mathieu-Daudé <philmd@linaro.org> |
---|---|---|---|
2 | to decodetree. | ||
3 | 2 | ||
3 | "hw/arm/boot.h" is only required on the source file. | ||
4 | |||
5 | Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
6 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Reviewed-by: Luc Michel <luc.michel@amd.com> | ||
8 | Message-id: 20231025065316.56817-2-philmd@linaro.org | ||
4 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | 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 | --- | 10 | --- |
8 | target/arm/neon-dp.decode | 6 ++++++ | 11 | include/hw/arm/allwinner-a10.h | 1 - |
9 | target/arm/translate-neon.inc.c | 15 +++++++++++++++ | 12 | hw/arm/cubieboard.c | 1 + |
10 | target/arm/translate.c | 14 ++------------ | 13 | 2 files changed, 1 insertion(+), 1 deletion(-) |
11 | 3 files changed, 23 insertions(+), 12 deletions(-) | ||
12 | 14 | ||
13 | diff --git a/target/arm/neon-dp.decode b/target/arm/neon-dp.decode | 15 | diff --git a/include/hw/arm/allwinner-a10.h b/include/hw/arm/allwinner-a10.h |
14 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/target/arm/neon-dp.decode | 17 | --- a/include/hw/arm/allwinner-a10.h |
16 | +++ b/target/arm/neon-dp.decode | 18 | +++ b/include/hw/arm/allwinner-a10.h |
17 | @@ -XXX,XX +XXX,XX @@ | 19 | @@ -XXX,XX +XXX,XX @@ |
18 | @3same .... ... . . . size:2 .... .... .... . q:1 . . .... \ | 20 | #ifndef HW_ARM_ALLWINNER_A10_H |
19 | &3same vm=%vm_dp vn=%vn_dp vd=%vd_dp | 21 | #define HW_ARM_ALLWINNER_A10_H |
20 | 22 | ||
21 | +VQADD_S_3s 1111 001 0 0 . .. .... .... 0000 . . . 1 .... @3same | 23 | -#include "hw/arm/boot.h" |
22 | +VQADD_U_3s 1111 001 1 0 . .. .... .... 0000 . . . 1 .... @3same | 24 | #include "hw/timer/allwinner-a10-pit.h" |
23 | + | 25 | #include "hw/intc/allwinner-a10-pic.h" |
24 | @3same_logic .... ... . . . .. .... .... .... . q:1 .. .... \ | 26 | #include "hw/net/allwinner_emac.h" |
25 | &3same vm=%vm_dp vn=%vn_dp vd=%vd_dp size=0 | 27 | diff --git a/hw/arm/cubieboard.c b/hw/arm/cubieboard.c |
26 | |||
27 | @@ -XXX,XX +XXX,XX @@ VBSL_3s 1111 001 1 0 . 01 .... .... 0001 ... 1 .... @3same_logic | ||
28 | VBIT_3s 1111 001 1 0 . 10 .... .... 0001 ... 1 .... @3same_logic | ||
29 | VBIF_3s 1111 001 1 0 . 11 .... .... 0001 ... 1 .... @3same_logic | ||
30 | |||
31 | +VQSUB_S_3s 1111 001 0 0 . .. .... .... 0010 . . . 1 .... @3same | ||
32 | +VQSUB_U_3s 1111 001 1 0 . .. .... .... 0010 . . . 1 .... @3same | ||
33 | + | ||
34 | VCGT_S_3s 1111 001 0 0 . .. .... .... 0011 . . . 0 .... @3same | ||
35 | VCGT_U_3s 1111 001 1 0 . .. .... .... 0011 . . . 0 .... @3same | ||
36 | VCGE_S_3s 1111 001 0 0 . .. .... .... 0011 . . . 1 .... @3same | ||
37 | diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c | ||
38 | index XXXXXXX..XXXXXXX 100644 | 28 | index XXXXXXX..XXXXXXX 100644 |
39 | --- a/target/arm/translate-neon.inc.c | 29 | --- a/hw/arm/cubieboard.c |
40 | +++ b/target/arm/translate-neon.inc.c | 30 | +++ b/hw/arm/cubieboard.c |
41 | @@ -XXX,XX +XXX,XX @@ static void gen_VTST_3s(unsigned vece, uint32_t rd_ofs, uint32_t rn_ofs, | 31 | @@ -XXX,XX +XXX,XX @@ |
42 | tcg_gen_gvec_3(rd_ofs, rn_ofs, rm_ofs, oprsz, maxsz, &cmtst_op[vece]); | 32 | #include "hw/boards.h" |
43 | } | 33 | #include "hw/qdev-properties.h" |
44 | DO_3SAME_NO_SZ_3(VTST, gen_VTST_3s) | 34 | #include "hw/arm/allwinner-a10.h" |
45 | + | 35 | +#include "hw/arm/boot.h" |
46 | +#define DO_3SAME_GVEC4(INSN, OPARRAY) \ | 36 | #include "hw/i2c/i2c.h" |
47 | + static void gen_##INSN##_3s(unsigned vece, uint32_t rd_ofs, \ | 37 | |
48 | + uint32_t rn_ofs, uint32_t rm_ofs, \ | 38 | static struct arm_boot_info cubieboard_binfo = { |
49 | + uint32_t oprsz, uint32_t maxsz) \ | ||
50 | + { \ | ||
51 | + tcg_gen_gvec_4(rd_ofs, offsetof(CPUARMState, vfp.qc), \ | ||
52 | + rn_ofs, rm_ofs, oprsz, maxsz, &OPARRAY[vece]); \ | ||
53 | + } \ | ||
54 | + DO_3SAME(INSN, gen_##INSN##_3s) | ||
55 | + | ||
56 | +DO_3SAME_GVEC4(VQADD_S, sqadd_op) | ||
57 | +DO_3SAME_GVEC4(VQADD_U, uqadd_op) | ||
58 | +DO_3SAME_GVEC4(VQSUB_S, sqsub_op) | ||
59 | +DO_3SAME_GVEC4(VQSUB_U, uqsub_op) | ||
60 | diff --git a/target/arm/translate.c b/target/arm/translate.c | ||
61 | index XXXXXXX..XXXXXXX 100644 | ||
62 | --- a/target/arm/translate.c | ||
63 | +++ b/target/arm/translate.c | ||
64 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) | ||
65 | } | ||
66 | return 1; | ||
67 | |||
68 | - case NEON_3R_VQADD: | ||
69 | - tcg_gen_gvec_4(rd_ofs, offsetof(CPUARMState, vfp.qc), | ||
70 | - rn_ofs, rm_ofs, vec_size, vec_size, | ||
71 | - (u ? uqadd_op : sqadd_op) + size); | ||
72 | - return 0; | ||
73 | - | ||
74 | - case NEON_3R_VQSUB: | ||
75 | - tcg_gen_gvec_4(rd_ofs, offsetof(CPUARMState, vfp.qc), | ||
76 | - rn_ofs, rm_ofs, vec_size, vec_size, | ||
77 | - (u ? uqsub_op : sqsub_op) + size); | ||
78 | - return 0; | ||
79 | - | ||
80 | case NEON_3R_VMUL: /* VMUL */ | ||
81 | if (u) { | ||
82 | /* Polynomial case allows only P8. */ | ||
83 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) | ||
84 | case NEON_3R_VTST_VCEQ: | ||
85 | case NEON_3R_VCGT: | ||
86 | case NEON_3R_VCGE: | ||
87 | + case NEON_3R_VQADD: | ||
88 | + case NEON_3R_VQSUB: | ||
89 | /* Already handled by decodetree */ | ||
90 | return 1; | ||
91 | } | ||
92 | -- | 39 | -- |
93 | 2.20.1 | 40 | 2.34.1 |
94 | 41 | ||
95 | 42 | diff view generated by jsdifflib |
1 | Convert the Neon comparison ops in the 3-reg-same grouping | 1 | From: Philippe Mathieu-Daudé <philmd@linaro.org> |
---|---|---|---|
2 | to decodetree. | ||
3 | 2 | ||
3 | "hw/arm/boot.h" is only required on the source file. | ||
4 | |||
5 | Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
6 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Reviewed-by: Luc Michel <luc.michel@amd.com> | ||
8 | Message-id: 20231025065316.56817-3-philmd@linaro.org | ||
4 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
5 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
6 | Message-id: 20200430181003.21682-18-peter.maydell@linaro.org | ||
7 | --- | 10 | --- |
8 | target/arm/neon-dp.decode | 8 ++++++++ | 11 | include/hw/arm/allwinner-h3.h | 1 - |
9 | target/arm/translate-neon.inc.c | 22 ++++++++++++++++++++++ | 12 | hw/arm/orangepi.c | 1 + |
10 | target/arm/translate.c | 23 +++-------------------- | 13 | 2 files changed, 1 insertion(+), 1 deletion(-) |
11 | 3 files changed, 33 insertions(+), 20 deletions(-) | ||
12 | 14 | ||
13 | diff --git a/target/arm/neon-dp.decode b/target/arm/neon-dp.decode | 15 | diff --git a/include/hw/arm/allwinner-h3.h b/include/hw/arm/allwinner-h3.h |
14 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/target/arm/neon-dp.decode | 17 | --- a/include/hw/arm/allwinner-h3.h |
16 | +++ b/target/arm/neon-dp.decode | 18 | +++ b/include/hw/arm/allwinner-h3.h |
17 | @@ -XXX,XX +XXX,XX @@ VBSL_3s 1111 001 1 0 . 01 .... .... 0001 ... 1 .... @3same_logic | 19 | @@ -XXX,XX +XXX,XX @@ |
18 | VBIT_3s 1111 001 1 0 . 10 .... .... 0001 ... 1 .... @3same_logic | 20 | #define HW_ARM_ALLWINNER_H3_H |
19 | VBIF_3s 1111 001 1 0 . 11 .... .... 0001 ... 1 .... @3same_logic | 21 | |
20 | 22 | #include "qom/object.h" | |
21 | +VCGT_S_3s 1111 001 0 0 . .. .... .... 0011 . . . 0 .... @3same | 23 | -#include "hw/arm/boot.h" |
22 | +VCGT_U_3s 1111 001 1 0 . .. .... .... 0011 . . . 0 .... @3same | 24 | #include "hw/timer/allwinner-a10-pit.h" |
23 | +VCGE_S_3s 1111 001 0 0 . .. .... .... 0011 . . . 1 .... @3same | 25 | #include "hw/intc/arm_gic.h" |
24 | +VCGE_U_3s 1111 001 1 0 . .. .... .... 0011 . . . 1 .... @3same | 26 | #include "hw/misc/allwinner-h3-ccu.h" |
25 | + | 27 | diff --git a/hw/arm/orangepi.c b/hw/arm/orangepi.c |
26 | VMAX_S_3s 1111 001 0 0 . .. .... .... 0110 . . . 0 .... @3same | ||
27 | VMAX_U_3s 1111 001 1 0 . .. .... .... 0110 . . . 0 .... @3same | ||
28 | VMIN_S_3s 1111 001 0 0 . .. .... .... 0110 . . . 1 .... @3same | ||
29 | @@ -XXX,XX +XXX,XX @@ VMIN_U_3s 1111 001 1 0 . .. .... .... 0110 . . . 1 .... @3same | ||
30 | |||
31 | VADD_3s 1111 001 0 0 . .. .... .... 1000 . . . 0 .... @3same | ||
32 | VSUB_3s 1111 001 1 0 . .. .... .... 1000 . . . 0 .... @3same | ||
33 | + | ||
34 | +VTST_3s 1111 001 0 0 . .. .... .... 1000 . . . 1 .... @3same | ||
35 | +VCEQ_3s 1111 001 1 0 . .. .... .... 1000 . . . 1 .... @3same | ||
36 | diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c | ||
37 | index XXXXXXX..XXXXXXX 100644 | 28 | index XXXXXXX..XXXXXXX 100644 |
38 | --- a/target/arm/translate-neon.inc.c | 29 | --- a/hw/arm/orangepi.c |
39 | +++ b/target/arm/translate-neon.inc.c | 30 | +++ b/hw/arm/orangepi.c |
40 | @@ -XXX,XX +XXX,XX @@ DO_3SAME_NO_SZ_3(VMAX_S, tcg_gen_gvec_smax) | 31 | @@ -XXX,XX +XXX,XX @@ |
41 | DO_3SAME_NO_SZ_3(VMAX_U, tcg_gen_gvec_umax) | 32 | #include "hw/boards.h" |
42 | DO_3SAME_NO_SZ_3(VMIN_S, tcg_gen_gvec_smin) | 33 | #include "hw/qdev-properties.h" |
43 | DO_3SAME_NO_SZ_3(VMIN_U, tcg_gen_gvec_umin) | 34 | #include "hw/arm/allwinner-h3.h" |
44 | + | 35 | +#include "hw/arm/boot.h" |
45 | +#define DO_3SAME_CMP(INSN, COND) \ | 36 | |
46 | + static void gen_##INSN##_3s(unsigned vece, uint32_t rd_ofs, \ | 37 | static struct arm_boot_info orangepi_binfo; |
47 | + uint32_t rn_ofs, uint32_t rm_ofs, \ | 38 | |
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 | } | ||
107 | -- | 39 | -- |
108 | 2.20.1 | 40 | 2.34.1 |
109 | 41 | ||
110 | 42 | diff view generated by jsdifflib |
1 | Convert VCMLA (scalar) in the 2reg-scalar-ext group to decodetree. | 1 | From: Philippe Mathieu-Daudé <philmd@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | "hw/arm/boot.h" is only required on the source file. | ||
4 | |||
5 | Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
6 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Reviewed-by: Luc Michel <luc.michel@amd.com> | ||
8 | Message-id: 20231025065316.56817-4-philmd@linaro.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> | ||
5 | Message-id: 20200430181003.21682-9-peter.maydell@linaro.org | ||
6 | --- | 10 | --- |
7 | target/arm/neon-shared.decode | 5 +++++ | 11 | include/hw/arm/allwinner-r40.h | 1 - |
8 | target/arm/translate-neon.inc.c | 40 +++++++++++++++++++++++++++++++++ | 12 | hw/arm/bananapi_m2u.c | 1 + |
9 | target/arm/translate.c | 26 +-------------------- | 13 | 2 files changed, 1 insertion(+), 1 deletion(-) |
10 | 3 files changed, 46 insertions(+), 25 deletions(-) | ||
11 | 14 | ||
12 | diff --git a/target/arm/neon-shared.decode b/target/arm/neon-shared.decode | 15 | diff --git a/include/hw/arm/allwinner-r40.h b/include/hw/arm/allwinner-r40.h |
13 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
14 | --- a/target/arm/neon-shared.decode | 17 | --- a/include/hw/arm/allwinner-r40.h |
15 | +++ b/target/arm/neon-shared.decode | 18 | +++ b/include/hw/arm/allwinner-r40.h |
16 | @@ -XXX,XX +XXX,XX @@ VFML 1111 110 0 s:1 . 10 .... .... 1000 . 0 . 1 .... \ | 19 | @@ -XXX,XX +XXX,XX @@ |
17 | vm=%vm_sp vn=%vn_sp vd=%vd_dp q=0 | 20 | #define HW_ARM_ALLWINNER_R40_H |
18 | VFML 1111 110 0 s:1 . 10 .... .... 1000 . 1 . 1 .... \ | 21 | |
19 | vm=%vm_dp vn=%vn_dp vd=%vd_dp q=1 | 22 | #include "qom/object.h" |
20 | + | 23 | -#include "hw/arm/boot.h" |
21 | +VCMLA_scalar 1111 1110 0 . rot:2 .... .... 1000 . q:1 index:1 0 vm:4 \ | 24 | #include "hw/timer/allwinner-a10-pit.h" |
22 | + vn=%vn_dp vd=%vd_dp size=0 | 25 | #include "hw/intc/arm_gic.h" |
23 | +VCMLA_scalar 1111 1110 1 . rot:2 .... .... 1000 . q:1 . 0 .... \ | 26 | #include "hw/sd/allwinner-sdhost.h" |
24 | + vm=%vm_dp vn=%vn_dp vd=%vd_dp size=1 index=0 | 27 | diff --git a/hw/arm/bananapi_m2u.c b/hw/arm/bananapi_m2u.c |
25 | diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c | ||
26 | index XXXXXXX..XXXXXXX 100644 | 28 | index XXXXXXX..XXXXXXX 100644 |
27 | --- a/target/arm/translate-neon.inc.c | 29 | --- a/hw/arm/bananapi_m2u.c |
28 | +++ b/target/arm/translate-neon.inc.c | 30 | +++ b/hw/arm/bananapi_m2u.c |
29 | @@ -XXX,XX +XXX,XX @@ static bool trans_VFML(DisasContext *s, arg_VFML *a) | 31 | @@ -XXX,XX +XXX,XX @@ |
30 | gen_helper_gvec_fmlal_a32); | 32 | #include "hw/i2c/i2c.h" |
31 | return true; | 33 | #include "hw/qdev-properties.h" |
32 | } | 34 | #include "hw/arm/allwinner-r40.h" |
33 | + | 35 | +#include "hw/arm/boot.h" |
34 | +static bool trans_VCMLA_scalar(DisasContext *s, arg_VCMLA_scalar *a) | 36 | |
35 | +{ | 37 | static struct arm_boot_info bpim2u_binfo; |
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 | - | ||
87 | - if (!dc_isar_feature(aa32_vcma, s)) { | ||
88 | - return 1; | ||
89 | - } | ||
90 | - if (size == 0) { | ||
91 | - if (!dc_isar_feature(aa32_fp16_arith, s)) { | ||
92 | - return 1; | ||
93 | - } | ||
94 | - /* For fp16, rm is just Vm, and index is M. */ | ||
95 | - rm = extract32(insn, 0, 4); | ||
96 | - index = extract32(insn, 5, 1); | ||
97 | - } else { | ||
98 | - /* For fp32, rm is the usual M:Vm, and index is 0. */ | ||
99 | - VFP_DREG_M(rm, insn); | ||
100 | - index = 0; | ||
101 | - } | ||
102 | - data = (index << 2) | rot; | ||
103 | - fn_gvec_ptr = (size ? gen_helper_gvec_fcmlas_idx | ||
104 | - : gen_helper_gvec_fcmlah_idx); | ||
105 | - } else if ((insn & 0xffb00f00) == 0xfe200d00) { | ||
106 | + if ((insn & 0xffb00f00) == 0xfe200d00) { | ||
107 | /* V[US]DOT -- 1111 1110 0.10 .... .... 1101 .Q.U .... */ | ||
108 | int u = extract32(insn, 4, 1); | ||
109 | 38 | ||
110 | -- | 39 | -- |
111 | 2.20.1 | 40 | 2.34.1 |
112 | 41 | ||
113 | 42 | diff view generated by jsdifflib |
1 | Convert the V[US]DOT (scalar) insns in the 2reg-scalar-ext group | 1 | From: Philippe Mathieu-Daudé <philmd@linaro.org> |
---|---|---|---|
2 | to decodetree. | ||
3 | 2 | ||
3 | "hw/arm/boot.h" is only required on the source file. | ||
4 | |||
5 | Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
6 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Reviewed-by: Luc Michel <luc.michel@amd.com> | ||
8 | Message-id: 20231025065316.56817-5-philmd@linaro.org | ||
4 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
5 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
6 | Message-id: 20200430181003.21682-10-peter.maydell@linaro.org | ||
7 | --- | 10 | --- |
8 | target/arm/neon-shared.decode | 3 +++ | 11 | include/hw/arm/fsl-imx25.h | 1 - |
9 | target/arm/translate-neon.inc.c | 35 +++++++++++++++++++++++++++++++++ | 12 | hw/arm/imx25_pdk.c | 1 + |
10 | target/arm/translate.c | 13 +----------- | 13 | 2 files changed, 1 insertion(+), 1 deletion(-) |
11 | 3 files changed, 39 insertions(+), 12 deletions(-) | ||
12 | 14 | ||
13 | diff --git a/target/arm/neon-shared.decode b/target/arm/neon-shared.decode | 15 | diff --git a/include/hw/arm/fsl-imx25.h b/include/hw/arm/fsl-imx25.h |
14 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/target/arm/neon-shared.decode | 17 | --- a/include/hw/arm/fsl-imx25.h |
16 | +++ b/target/arm/neon-shared.decode | 18 | +++ b/include/hw/arm/fsl-imx25.h |
17 | @@ -XXX,XX +XXX,XX @@ VCMLA_scalar 1111 1110 0 . rot:2 .... .... 1000 . q:1 index:1 0 vm:4 \ | 19 | @@ -XXX,XX +XXX,XX @@ |
18 | vn=%vn_dp vd=%vd_dp size=0 | 20 | #ifndef FSL_IMX25_H |
19 | VCMLA_scalar 1111 1110 1 . rot:2 .... .... 1000 . q:1 . 0 .... \ | 21 | #define FSL_IMX25_H |
20 | vm=%vm_dp vn=%vn_dp vd=%vd_dp size=1 index=0 | 22 | |
21 | + | 23 | -#include "hw/arm/boot.h" |
22 | +VDOT_scalar 1111 1110 0 . 10 .... .... 1101 . q:1 index:1 u:1 rm:4 \ | 24 | #include "hw/intc/imx_avic.h" |
23 | + vm=%vm_dp vn=%vn_dp vd=%vd_dp | 25 | #include "hw/misc/imx25_ccm.h" |
24 | diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c | 26 | #include "hw/char/imx_serial.h" |
27 | diff --git a/hw/arm/imx25_pdk.c b/hw/arm/imx25_pdk.c | ||
25 | index XXXXXXX..XXXXXXX 100644 | 28 | index XXXXXXX..XXXXXXX 100644 |
26 | --- a/target/arm/translate-neon.inc.c | 29 | --- a/hw/arm/imx25_pdk.c |
27 | +++ b/target/arm/translate-neon.inc.c | 30 | +++ b/hw/arm/imx25_pdk.c |
28 | @@ -XXX,XX +XXX,XX @@ static bool trans_VCMLA_scalar(DisasContext *s, arg_VCMLA_scalar *a) | 31 | @@ -XXX,XX +XXX,XX @@ |
29 | tcg_temp_free_ptr(fpst); | 32 | #include "qapi/error.h" |
30 | return true; | 33 | #include "hw/qdev-properties.h" |
31 | } | 34 | #include "hw/arm/fsl-imx25.h" |
32 | + | 35 | +#include "hw/arm/boot.h" |
33 | +static bool trans_VDOT_scalar(DisasContext *s, arg_VDOT_scalar *a) | 36 | #include "hw/boards.h" |
34 | +{ | 37 | #include "qemu/error-report.h" |
35 | + gen_helper_gvec_3 *fn_gvec; | 38 | #include "sysemu/qtest.h" |
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 | -- | 39 | -- |
92 | 2.20.1 | 40 | 2.34.1 |
93 | 41 | ||
94 | 42 | diff view generated by jsdifflib |
1 | Convert the V[US]DOT (vector) insns to decodetree. | 1 | From: Philippe Mathieu-Daudé <philmd@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | "hw/arm/boot.h" is only required on the source file. | ||
4 | |||
5 | Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
6 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Reviewed-by: Luc Michel <luc.michel@amd.com> | ||
8 | Message-id: 20231025065316.56817-6-philmd@linaro.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> | ||
5 | Message-id: 20200430181003.21682-7-peter.maydell@linaro.org | ||
6 | --- | 10 | --- |
7 | target/arm/neon-shared.decode | 4 ++++ | 11 | include/hw/arm/fsl-imx31.h | 1 - |
8 | target/arm/translate-neon.inc.c | 32 ++++++++++++++++++++++++++++++++ | 12 | hw/arm/kzm.c | 1 + |
9 | target/arm/translate.c | 9 +-------- | 13 | 2 files changed, 1 insertion(+), 1 deletion(-) |
10 | 3 files changed, 37 insertions(+), 8 deletions(-) | ||
11 | 14 | ||
12 | diff --git a/target/arm/neon-shared.decode b/target/arm/neon-shared.decode | 15 | diff --git a/include/hw/arm/fsl-imx31.h b/include/hw/arm/fsl-imx31.h |
13 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
14 | --- a/target/arm/neon-shared.decode | 17 | --- a/include/hw/arm/fsl-imx31.h |
15 | +++ b/target/arm/neon-shared.decode | 18 | +++ b/include/hw/arm/fsl-imx31.h |
16 | @@ -XXX,XX +XXX,XX @@ VCMLA 1111 110 rot:2 . 1 size:1 .... .... 1000 . q:1 . 0 .... \ | 19 | @@ -XXX,XX +XXX,XX @@ |
17 | 20 | #ifndef FSL_IMX31_H | |
18 | VCADD 1111 110 rot:1 1 . 0 size:1 .... .... 1000 . q:1 . 0 .... \ | 21 | #define FSL_IMX31_H |
19 | vm=%vm_dp vn=%vn_dp vd=%vd_dp | 22 | |
20 | + | 23 | -#include "hw/arm/boot.h" |
21 | +# VUDOT and VSDOT | 24 | #include "hw/intc/imx_avic.h" |
22 | +VDOT 1111 110 00 . 10 .... .... 1101 . q:1 . u:1 .... \ | 25 | #include "hw/misc/imx31_ccm.h" |
23 | + vm=%vm_dp vn=%vn_dp vd=%vd_dp | 26 | #include "hw/char/imx_serial.h" |
24 | diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c | 27 | diff --git a/hw/arm/kzm.c b/hw/arm/kzm.c |
25 | index XXXXXXX..XXXXXXX 100644 | 28 | index XXXXXXX..XXXXXXX 100644 |
26 | --- a/target/arm/translate-neon.inc.c | 29 | --- a/hw/arm/kzm.c |
27 | +++ b/target/arm/translate-neon.inc.c | 30 | +++ b/hw/arm/kzm.c |
28 | @@ -XXX,XX +XXX,XX @@ static bool trans_VCADD(DisasContext *s, arg_VCADD *a) | 31 | @@ -XXX,XX +XXX,XX @@ |
29 | tcg_temp_free_ptr(fpst); | 32 | #include "qemu/osdep.h" |
30 | return true; | 33 | #include "qapi/error.h" |
31 | } | 34 | #include "hw/arm/fsl-imx31.h" |
32 | + | 35 | +#include "hw/arm/boot.h" |
33 | +static bool trans_VDOT(DisasContext *s, arg_VDOT *a) | 36 | #include "hw/boards.h" |
34 | +{ | 37 | #include "qemu/error-report.h" |
35 | + int opr_sz; | 38 | #include "exec/address-spaces.h" |
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 | -- | 39 | -- |
85 | 2.20.1 | 40 | 2.34.1 |
86 | 41 | ||
87 | 42 | diff view generated by jsdifflib |
1 | Convert the VCADD (vector) insns to decodetree. | 1 | From: Philippe Mathieu-Daudé <philmd@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | "hw/arm/boot.h" is only required on the source file. | ||
4 | |||
5 | Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
6 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Reviewed-by: Luc Michel <luc.michel@amd.com> | ||
8 | Message-id: 20231025065316.56817-7-philmd@linaro.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> | ||
5 | Message-id: 20200430181003.21682-6-peter.maydell@linaro.org | ||
6 | --- | 10 | --- |
7 | target/arm/neon-shared.decode | 3 +++ | 11 | include/hw/arm/fsl-imx6.h | 1 - |
8 | target/arm/translate-neon.inc.c | 37 +++++++++++++++++++++++++++++++++ | 12 | hw/arm/sabrelite.c | 1 + |
9 | target/arm/translate.c | 11 +--------- | 13 | 2 files changed, 1 insertion(+), 1 deletion(-) |
10 | 3 files changed, 41 insertions(+), 10 deletions(-) | ||
11 | 14 | ||
12 | diff --git a/target/arm/neon-shared.decode b/target/arm/neon-shared.decode | 15 | diff --git a/include/hw/arm/fsl-imx6.h b/include/hw/arm/fsl-imx6.h |
13 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
14 | --- a/target/arm/neon-shared.decode | 17 | --- a/include/hw/arm/fsl-imx6.h |
15 | +++ b/target/arm/neon-shared.decode | 18 | +++ b/include/hw/arm/fsl-imx6.h |
16 | @@ -XXX,XX +XXX,XX @@ | 19 | @@ -XXX,XX +XXX,XX @@ |
17 | 20 | #ifndef FSL_IMX6_H | |
18 | VCMLA 1111 110 rot:2 . 1 size:1 .... .... 1000 . q:1 . 0 .... \ | 21 | #define FSL_IMX6_H |
19 | vm=%vm_dp vn=%vn_dp vd=%vd_dp | 22 | |
20 | + | 23 | -#include "hw/arm/boot.h" |
21 | +VCADD 1111 110 rot:1 1 . 0 size:1 .... .... 1000 . q:1 . 0 .... \ | 24 | #include "hw/cpu/a9mpcore.h" |
22 | + vm=%vm_dp vn=%vn_dp vd=%vd_dp | 25 | #include "hw/misc/imx6_ccm.h" |
23 | diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c | 26 | #include "hw/misc/imx6_src.h" |
27 | diff --git a/hw/arm/sabrelite.c b/hw/arm/sabrelite.c | ||
24 | index XXXXXXX..XXXXXXX 100644 | 28 | index XXXXXXX..XXXXXXX 100644 |
25 | --- a/target/arm/translate-neon.inc.c | 29 | --- a/hw/arm/sabrelite.c |
26 | +++ b/target/arm/translate-neon.inc.c | 30 | +++ b/hw/arm/sabrelite.c |
27 | @@ -XXX,XX +XXX,XX @@ static bool trans_VCMLA(DisasContext *s, arg_VCMLA *a) | 31 | @@ -XXX,XX +XXX,XX @@ |
28 | tcg_temp_free_ptr(fpst); | 32 | #include "qemu/osdep.h" |
29 | return true; | 33 | #include "qapi/error.h" |
30 | } | 34 | #include "hw/arm/fsl-imx6.h" |
31 | + | 35 | +#include "hw/arm/boot.h" |
32 | +static bool trans_VCADD(DisasContext *s, arg_VCADD *a) | 36 | #include "hw/boards.h" |
33 | +{ | 37 | #include "hw/qdev-properties.h" |
34 | + int opr_sz; | 38 | #include "qemu/error-report.h" |
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 | -- | 39 | -- |
91 | 2.20.1 | 40 | 2.34.1 |
92 | 41 | ||
93 | 42 | diff view generated by jsdifflib |
1 | Convert the VCMLA (vector) insns in the 3same extension group to | 1 | From: Philippe Mathieu-Daudé <philmd@linaro.org> |
---|---|---|---|
2 | decodetree. | ||
3 | 2 | ||
3 | "hw/arm/boot.h" is only required on the source file. | ||
4 | |||
5 | Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
6 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Reviewed-by: Luc Michel <luc.michel@amd.com> | ||
8 | Message-id: 20231025065316.56817-8-philmd@linaro.org | ||
4 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
5 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
6 | Message-id: 20200430181003.21682-5-peter.maydell@linaro.org | ||
7 | --- | 10 | --- |
8 | target/arm/neon-shared.decode | 11 ++++++++++ | 11 | include/hw/arm/fsl-imx6ul.h | 1 - |
9 | target/arm/translate-neon.inc.c | 37 +++++++++++++++++++++++++++++++++ | 12 | hw/arm/mcimx6ul-evk.c | 1 + |
10 | target/arm/translate.c | 11 +--------- | 13 | 2 files changed, 1 insertion(+), 1 deletion(-) |
11 | 3 files changed, 49 insertions(+), 10 deletions(-) | ||
12 | 14 | ||
13 | diff --git a/target/arm/neon-shared.decode b/target/arm/neon-shared.decode | 15 | diff --git a/include/hw/arm/fsl-imx6ul.h b/include/hw/arm/fsl-imx6ul.h |
14 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/target/arm/neon-shared.decode | 17 | --- a/include/hw/arm/fsl-imx6ul.h |
16 | +++ b/target/arm/neon-shared.decode | 18 | +++ b/include/hw/arm/fsl-imx6ul.h |
17 | @@ -XXX,XX +XXX,XX @@ | 19 | @@ -XXX,XX +XXX,XX @@ |
18 | # More specifically, this covers: | 20 | #ifndef FSL_IMX6UL_H |
19 | # 2reg scalar ext: 0b1111_1110_xxxx_xxxx_xxxx_1x0x_xxxx_xxxx | 21 | #define FSL_IMX6UL_H |
20 | # 3same ext: 0b1111_110x_xxxx_xxxx_xxxx_1x0x_xxxx_xxxx | 22 | |
21 | + | 23 | -#include "hw/arm/boot.h" |
22 | +# VFP/Neon register fields; same as vfp.decode | 24 | #include "hw/cpu/a15mpcore.h" |
23 | +%vm_dp 5:1 0:4 | 25 | #include "hw/misc/imx6ul_ccm.h" |
24 | +%vm_sp 0:4 5:1 | 26 | #include "hw/misc/imx6_src.h" |
25 | +%vn_dp 7:1 16:4 | 27 | diff --git a/hw/arm/mcimx6ul-evk.c b/hw/arm/mcimx6ul-evk.c |
26 | +%vn_sp 16:4 7:1 | ||
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 | 28 | index XXXXXXX..XXXXXXX 100644 |
34 | --- a/target/arm/translate-neon.inc.c | 29 | --- a/hw/arm/mcimx6ul-evk.c |
35 | +++ b/target/arm/translate-neon.inc.c | 30 | +++ b/hw/arm/mcimx6ul-evk.c |
36 | @@ -XXX,XX +XXX,XX @@ | 31 | @@ -XXX,XX +XXX,XX @@ |
37 | #include "decode-neon-dp.inc.c" | 32 | #include "qemu/osdep.h" |
38 | #include "decode-neon-ls.inc.c" | 33 | #include "qapi/error.h" |
39 | #include "decode-neon-shared.inc.c" | 34 | #include "hw/arm/fsl-imx6ul.h" |
40 | + | 35 | +#include "hw/arm/boot.h" |
41 | +static bool trans_VCMLA(DisasContext *s, arg_VCMLA *a) | 36 | #include "hw/boards.h" |
42 | +{ | 37 | #include "hw/qdev-properties.h" |
43 | + int opr_sz; | 38 | #include "qemu/error-report.h" |
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 | -- | 39 | -- |
100 | 2.20.1 | 40 | 2.34.1 |
101 | 41 | ||
102 | 42 | diff view generated by jsdifflib |
1 | We were accidentally permitting decode of Thumb Neon insns even if | 1 | From: Philippe Mathieu-Daudé <philmd@linaro.org> |
---|---|---|---|
2 | the CPU didn't have the FEATURE_NEON bit set, because the feature | ||
3 | check was being done before the call to disas_neon_data_insn() and | ||
4 | disas_neon_ls_insn() in the Arm decoder but was omitted from the | ||
5 | Thumb decoder. Push the feature bit check down into the called | ||
6 | functions so it is done for both Arm and Thumb encodings. | ||
7 | 2 | ||
3 | "hw/arm/boot.h" is only required on the source file. | ||
4 | |||
5 | Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
6 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Reviewed-by: Luc Michel <luc.michel@amd.com> | ||
8 | Message-id: 20231025065316.56817-9-philmd@linaro.org | ||
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
9 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
10 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
11 | Message-id: 20200430181003.21682-3-peter.maydell@linaro.org | ||
12 | --- | 10 | --- |
13 | target/arm/translate.c | 16 ++++++++-------- | 11 | include/hw/arm/fsl-imx7.h | 1 - |
14 | 1 file changed, 8 insertions(+), 8 deletions(-) | 12 | hw/arm/mcimx7d-sabre.c | 1 + |
13 | 2 files changed, 1 insertion(+), 1 deletion(-) | ||
15 | 14 | ||
16 | diff --git a/target/arm/translate.c b/target/arm/translate.c | 15 | diff --git a/include/hw/arm/fsl-imx7.h b/include/hw/arm/fsl-imx7.h |
17 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
18 | --- a/target/arm/translate.c | 17 | --- a/include/hw/arm/fsl-imx7.h |
19 | +++ b/target/arm/translate.c | 18 | +++ b/include/hw/arm/fsl-imx7.h |
20 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_ls_insn(DisasContext *s, uint32_t insn) | 19 | @@ -XXX,XX +XXX,XX @@ |
21 | TCGv_i32 tmp2; | 20 | #ifndef FSL_IMX7_H |
22 | TCGv_i64 tmp64; | 21 | #define FSL_IMX7_H |
23 | 22 | ||
24 | + if (!arm_dc_feature(s, ARM_FEATURE_NEON)) { | 23 | -#include "hw/arm/boot.h" |
25 | + return 1; | 24 | #include "hw/cpu/a15mpcore.h" |
26 | + } | 25 | #include "hw/intc/imx_gpcv2.h" |
27 | + | 26 | #include "hw/misc/imx7_ccm.h" |
28 | /* FIXME: this access check should not take precedence over UNDEF | 27 | diff --git a/hw/arm/mcimx7d-sabre.c b/hw/arm/mcimx7d-sabre.c |
29 | * for invalid encodings; we will generate incorrect syndrome information | 28 | index XXXXXXX..XXXXXXX 100644 |
30 | * for attempts to execute invalid vfp/neon encodings with FP disabled. | 29 | --- a/hw/arm/mcimx7d-sabre.c |
31 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) | 30 | +++ b/hw/arm/mcimx7d-sabre.c |
32 | TCGv_ptr ptr1, ptr2, ptr3; | 31 | @@ -XXX,XX +XXX,XX @@ |
33 | TCGv_i64 tmp64; | 32 | #include "qemu/osdep.h" |
34 | 33 | #include "qapi/error.h" | |
35 | + if (!arm_dc_feature(s, ARM_FEATURE_NEON)) { | 34 | #include "hw/arm/fsl-imx7.h" |
36 | + return 1; | 35 | +#include "hw/arm/boot.h" |
37 | + } | 36 | #include "hw/boards.h" |
38 | + | 37 | #include "hw/qdev-properties.h" |
39 | /* FIXME: this access check should not take precedence over UNDEF | 38 | #include "qemu/error-report.h" |
40 | * for invalid encodings; we will generate incorrect syndrome information | ||
41 | * for attempts to execute invalid vfp/neon encodings with FP disabled. | ||
42 | @@ -XXX,XX +XXX,XX @@ static void disas_arm_insn(DisasContext *s, unsigned int insn) | ||
43 | |||
44 | if (((insn >> 25) & 7) == 1) { | ||
45 | /* NEON Data processing. */ | ||
46 | - if (!arm_dc_feature(s, ARM_FEATURE_NEON)) { | ||
47 | - goto illegal_op; | ||
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 | -- | 39 | -- |
65 | 2.20.1 | 40 | 2.34.1 |
66 | 41 | ||
67 | 42 | diff view generated by jsdifflib |
1 | From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com> | 1 | From: Philippe Mathieu-Daudé <philmd@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Embed the APUs into the SoC type. | 3 | "hw/arm/boot.h" is only required on the source file. |
4 | 4 | ||
5 | Suggested-by: Peter Maydell <peter.maydell@linaro.org> | 5 | Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
6 | Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | 6 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
7 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | 7 | Reviewed-by: Luc Michel <luc.michel@amd.com> |
8 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 8 | Message-id: 20231025065316.56817-10-philmd@linaro.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> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
12 | --- | 10 | --- |
13 | include/hw/arm/xlnx-versal.h | 2 +- | 11 | include/hw/arm/xlnx-versal.h | 1 - |
14 | hw/arm/xlnx-versal-virt.c | 4 ++-- | 12 | hw/arm/xlnx-versal-virt.c | 1 + |
15 | hw/arm/xlnx-versal.c | 19 +++++-------------- | 13 | 2 files changed, 1 insertion(+), 1 deletion(-) |
16 | 3 files changed, 8 insertions(+), 17 deletions(-) | ||
17 | 14 | ||
18 | diff --git a/include/hw/arm/xlnx-versal.h b/include/hw/arm/xlnx-versal.h | 15 | diff --git a/include/hw/arm/xlnx-versal.h b/include/hw/arm/xlnx-versal.h |
19 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
20 | --- a/include/hw/arm/xlnx-versal.h | 17 | --- a/include/hw/arm/xlnx-versal.h |
21 | +++ b/include/hw/arm/xlnx-versal.h | 18 | +++ b/include/hw/arm/xlnx-versal.h |
22 | @@ -XXX,XX +XXX,XX @@ typedef struct Versal { | 19 | @@ -XXX,XX +XXX,XX @@ |
23 | struct { | 20 | #define XLNX_VERSAL_H |
24 | struct { | 21 | |
25 | MemoryRegion mr; | 22 | #include "hw/sysbus.h" |
26 | - ARMCPU *cpu[XLNX_VERSAL_NR_ACPUS]; | 23 | -#include "hw/arm/boot.h" |
27 | + ARMCPU cpu[XLNX_VERSAL_NR_ACPUS]; | 24 | #include "hw/cpu/cluster.h" |
28 | GICv3State gic; | 25 | #include "hw/or-irq.h" |
29 | } apu; | 26 | #include "hw/sd/sdhci.h" |
30 | } fpd; | ||
31 | diff --git a/hw/arm/xlnx-versal-virt.c b/hw/arm/xlnx-versal-virt.c | 27 | diff --git a/hw/arm/xlnx-versal-virt.c b/hw/arm/xlnx-versal-virt.c |
32 | index XXXXXXX..XXXXXXX 100644 | 28 | index XXXXXXX..XXXXXXX 100644 |
33 | --- a/hw/arm/xlnx-versal-virt.c | 29 | --- a/hw/arm/xlnx-versal-virt.c |
34 | +++ b/hw/arm/xlnx-versal-virt.c | 30 | +++ b/hw/arm/xlnx-versal-virt.c |
35 | @@ -XXX,XX +XXX,XX @@ static void versal_virt_init(MachineState *machine) | 31 | @@ -XXX,XX +XXX,XX @@ |
36 | s->binfo.get_dtb = versal_virt_get_dtb; | 32 | #include "cpu.h" |
37 | s->binfo.modify_dtb = versal_virt_modify_dtb; | 33 | #include "hw/qdev-properties.h" |
38 | if (machine->kernel_filename) { | 34 | #include "hw/arm/xlnx-versal.h" |
39 | - arm_load_kernel(s->soc.fpd.apu.cpu[0], machine, &s->binfo); | 35 | +#include "hw/arm/boot.h" |
40 | + arm_load_kernel(&s->soc.fpd.apu.cpu[0], machine, &s->binfo); | 36 | #include "qom/object.h" |
41 | } else { | 37 | |
42 | - AddressSpace *as = arm_boot_address_space(s->soc.fpd.apu.cpu[0], | 38 | #define TYPE_XLNX_VERSAL_VIRT_MACHINE MACHINE_TYPE_NAME("xlnx-versal-virt") |
43 | + AddressSpace *as = arm_boot_address_space(&s->soc.fpd.apu.cpu[0], | ||
44 | &s->binfo); | ||
45 | /* Some boot-loaders (e.g u-boot) don't like blobs at address 0 (NULL). | ||
46 | * Offset things by 4K. */ | ||
47 | diff --git a/hw/arm/xlnx-versal.c b/hw/arm/xlnx-versal.c | ||
48 | index XXXXXXX..XXXXXXX 100644 | ||
49 | --- a/hw/arm/xlnx-versal.c | ||
50 | +++ b/hw/arm/xlnx-versal.c | ||
51 | @@ -XXX,XX +XXX,XX @@ static void versal_create_apu_cpus(Versal *s) | ||
52 | |||
53 | for (i = 0; i < ARRAY_SIZE(s->fpd.apu.cpu); i++) { | ||
54 | Object *obj; | ||
55 | - char *name; | ||
56 | - | ||
57 | - obj = object_new(XLNX_VERSAL_ACPU_TYPE); | ||
58 | - if (!obj) { | ||
59 | - error_report("Unable to create apu.cpu[%d] of type %s", | ||
60 | - i, XLNX_VERSAL_ACPU_TYPE); | ||
61 | - exit(EXIT_FAILURE); | ||
62 | - } | ||
63 | - | ||
64 | - name = g_strdup_printf("apu-cpu[%d]", i); | ||
65 | - object_property_add_child(OBJECT(s), name, obj, &error_fatal); | ||
66 | - g_free(name); | ||
67 | |||
68 | + object_initialize_child(OBJECT(s), "apu-cpu[*]", | ||
69 | + &s->fpd.apu.cpu[i], sizeof(s->fpd.apu.cpu[i]), | ||
70 | + XLNX_VERSAL_ACPU_TYPE, &error_abort, NULL); | ||
71 | + obj = OBJECT(&s->fpd.apu.cpu[i]); | ||
72 | object_property_set_int(obj, s->cfg.psci_conduit, | ||
73 | "psci-conduit", &error_abort); | ||
74 | if (i) { | ||
75 | @@ -XXX,XX +XXX,XX @@ static void versal_create_apu_cpus(Versal *s) | ||
76 | object_property_set_link(obj, OBJECT(&s->fpd.apu.mr), "memory", | ||
77 | &error_abort); | ||
78 | object_property_set_bool(obj, true, "realized", &error_fatal); | ||
79 | - s->fpd.apu.cpu[i] = ARM_CPU(obj); | ||
80 | } | ||
81 | } | ||
82 | |||
83 | @@ -XXX,XX +XXX,XX @@ static void versal_create_apu_gic(Versal *s, qemu_irq *pic) | ||
84 | } | ||
85 | |||
86 | for (i = 0; i < nr_apu_cpus; i++) { | ||
87 | - DeviceState *cpudev = DEVICE(s->fpd.apu.cpu[i]); | ||
88 | + DeviceState *cpudev = DEVICE(&s->fpd.apu.cpu[i]); | ||
89 | int ppibase = XLNX_VERSAL_NR_IRQS + i * GIC_INTERNAL + GIC_NR_SGIS; | ||
90 | qemu_irq maint_irq; | ||
91 | int ti; | ||
92 | -- | 39 | -- |
93 | 2.20.1 | 40 | 2.34.1 |
94 | 41 | ||
95 | 42 | diff view generated by jsdifflib |
1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> | 1 | From: Philippe Mathieu-Daudé <philmd@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | MIDR_EL1 is a 64-bit system register with the top 32-bit being RES0. | 3 | "hw/arm/boot.h" is only required on the source file. |
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 | Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
8 | because we were manipulating the register value using a | 6 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
9 | local uint64_t variable: | 7 | Reviewed-by: Luc Michel <luc.michel@amd.com> |
10 | 8 | Message-id: 20231025065316.56817-11-philmd@linaro.org | |
11 | target/arm/cpu64.c: In function ‘aarch64_max_initfn’: | ||
12 | target/arm/cpu64.c:628:21: error: conversion from ‘uint64_t’ {aka ‘long unsigned int’} to ‘uint32_t’ {aka ‘unsigned int’} may change value [-Werror=conversion] | ||
13 | 628 | cpu->midr = t; | ||
14 | | ^ | ||
15 | |||
16 | and future-proofs us against a possible future architecture | ||
17 | change using some of the top 32 bits. | ||
18 | |||
19 | Suggested-by: Laurent Desnogues <laurent.desnogues@gmail.com> | ||
20 | Suggested-by: Peter Maydell <peter.maydell@linaro.org> | ||
21 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
22 | Reviewed-by: Laurent Desnogues <laurent.desnogues@gmail.com> | ||
23 | Message-id: 20200428172634.29707-1-f4bug@amsat.org | ||
24 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
25 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
26 | --- | 10 | --- |
27 | target/arm/cpu.h | 2 +- | 11 | include/hw/arm/xlnx-zynqmp.h | 1 - |
28 | target/arm/cpu.c | 2 +- | 12 | hw/arm/xlnx-zcu102.c | 1 + |
29 | 2 files changed, 2 insertions(+), 2 deletions(-) | 13 | 2 files changed, 1 insertion(+), 1 deletion(-) |
30 | 14 | ||
31 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h | 15 | diff --git a/include/hw/arm/xlnx-zynqmp.h b/include/hw/arm/xlnx-zynqmp.h |
32 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
33 | --- a/target/arm/cpu.h | 17 | --- a/include/hw/arm/xlnx-zynqmp.h |
34 | +++ b/target/arm/cpu.h | 18 | +++ b/include/hw/arm/xlnx-zynqmp.h |
35 | @@ -XXX,XX +XXX,XX @@ struct ARMCPU { | 19 | @@ -XXX,XX +XXX,XX @@ |
36 | uint64_t id_aa64dfr0; | 20 | #ifndef XLNX_ZYNQMP_H |
37 | uint64_t id_aa64dfr1; | 21 | #define XLNX_ZYNQMP_H |
38 | } isar; | 22 | |
39 | - uint32_t midr; | 23 | -#include "hw/arm/boot.h" |
40 | + uint64_t midr; | 24 | #include "hw/intc/arm_gic.h" |
41 | uint32_t revidr; | 25 | #include "hw/net/cadence_gem.h" |
42 | uint32_t reset_fpsid; | 26 | #include "hw/char/cadence_uart.h" |
43 | uint32_t ctr; | 27 | diff --git a/hw/arm/xlnx-zcu102.c b/hw/arm/xlnx-zcu102.c |
44 | diff --git a/target/arm/cpu.c b/target/arm/cpu.c | ||
45 | index XXXXXXX..XXXXXXX 100644 | 28 | index XXXXXXX..XXXXXXX 100644 |
46 | --- a/target/arm/cpu.c | 29 | --- a/hw/arm/xlnx-zcu102.c |
47 | +++ b/target/arm/cpu.c | 30 | +++ b/hw/arm/xlnx-zcu102.c |
48 | @@ -XXX,XX +XXX,XX @@ static const ARMCPUInfo arm_cpus[] = { | 31 | @@ -XXX,XX +XXX,XX @@ |
49 | static Property arm_cpu_properties[] = { | 32 | #include "qemu/osdep.h" |
50 | DEFINE_PROP_BOOL("start-powered-off", ARMCPU, start_powered_off, false), | 33 | #include "qapi/error.h" |
51 | DEFINE_PROP_UINT32("psci-conduit", ARMCPU, psci_conduit, 0), | 34 | #include "hw/arm/xlnx-zynqmp.h" |
52 | - DEFINE_PROP_UINT32("midr", ARMCPU, midr, 0), | 35 | +#include "hw/arm/boot.h" |
53 | + DEFINE_PROP_UINT64("midr", ARMCPU, midr, 0), | 36 | #include "hw/boards.h" |
54 | DEFINE_PROP_UINT64("mp-affinity", ARMCPU, | 37 | #include "qemu/error-report.h" |
55 | mp_affinity, ARM64_AFFINITY_INVALID), | 38 | #include "qemu/log.h" |
56 | DEFINE_PROP_INT32("node-id", ARMCPU, node_id, CPU_UNSET_NUMA_NODE_ID), | ||
57 | -- | 39 | -- |
58 | 2.20.1 | 40 | 2.34.1 |
59 | 41 | ||
60 | 42 | diff view generated by jsdifflib |
1 | From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com> | 1 | From: Philippe Mathieu-Daudé <philmd@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Embed the ADMAs into the SoC type. | 3 | sysbus_mmio_map() and sysbus_connect_irq() should not be |
4 | called on unrealized device. | ||
4 | 5 | ||
5 | Suggested-by: Peter Maydell <peter.maydell@linaro.org> | 6 | Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
6 | Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | 7 | Reviewed-by: Thomas Huth <thuth@redhat.com> |
7 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | 8 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
8 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 9 | Message-id: 20231020130331.50048-2-philmd@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 | hw/sd/pxa2xx_mmci.c | 2 +- |
14 | hw/arm/xlnx-versal.c | 14 +++++++------- | 13 | 1 file changed, 1 insertion(+), 1 deletion(-) |
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/hw/sd/pxa2xx_mmci.c b/hw/sd/pxa2xx_mmci.c |
18 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
19 | --- a/include/hw/arm/xlnx-versal.h | 17 | --- a/hw/sd/pxa2xx_mmci.c |
20 | +++ b/include/hw/arm/xlnx-versal.h | 18 | +++ b/hw/sd/pxa2xx_mmci.c |
21 | @@ -XXX,XX +XXX,XX @@ | 19 | @@ -XXX,XX +XXX,XX @@ PXA2xxMMCIState *pxa2xx_mmci_init(MemoryRegion *sysmem, |
22 | #include "hw/arm/boot.h" | 20 | |
23 | #include "hw/intc/arm_gicv3.h" | 21 | dev = qdev_new(TYPE_PXA2XX_MMCI); |
24 | #include "hw/char/pl011.h" | 22 | sbd = SYS_BUS_DEVICE(dev); |
25 | +#include "hw/dma/xlnx-zdma.h" | 23 | + sysbus_realize_and_unref(sbd, &error_fatal); |
26 | #include "hw/net/cadence_gem.h" | 24 | sysbus_mmio_map(sbd, 0, base); |
27 | 25 | sysbus_connect_irq(sbd, 0, irq); | |
28 | #define TYPE_XLNX_VERSAL "xlnx-versal" | 26 | qdev_connect_gpio_out_named(dev, "rx-dma", 0, rx_dma); |
29 | @@ -XXX,XX +XXX,XX @@ typedef struct Versal { | 27 | qdev_connect_gpio_out_named(dev, "tx-dma", 0, tx_dma); |
30 | struct { | 28 | - sysbus_realize_and_unref(sbd, &error_fatal); |
31 | PL011State uart[XLNX_VERSAL_NR_UARTS]; | 29 | |
32 | CadenceGEMState gem[XLNX_VERSAL_NR_GEMS]; | 30 | return PXA2XX_MMCI(dev); |
33 | - SysBusDevice *adma[XLNX_VERSAL_NR_ADMAS]; | ||
34 | + XlnxZDMA adma[XLNX_VERSAL_NR_ADMAS]; | ||
35 | } iou; | ||
36 | } lpd; | ||
37 | |||
38 | diff --git a/hw/arm/xlnx-versal.c b/hw/arm/xlnx-versal.c | ||
39 | index XXXXXXX..XXXXXXX 100644 | ||
40 | --- a/hw/arm/xlnx-versal.c | ||
41 | +++ b/hw/arm/xlnx-versal.c | ||
42 | @@ -XXX,XX +XXX,XX @@ static void versal_create_admas(Versal *s, qemu_irq *pic) | ||
43 | DeviceState *dev; | ||
44 | MemoryRegion *mr; | ||
45 | |||
46 | - dev = qdev_create(NULL, "xlnx.zdma"); | ||
47 | - s->lpd.iou.adma[i] = SYS_BUS_DEVICE(dev); | ||
48 | - object_property_set_int(OBJECT(s->lpd.iou.adma[i]), 128, "bus-width", | ||
49 | - &error_abort); | ||
50 | - object_property_add_child(OBJECT(s), name, OBJECT(dev), &error_fatal); | ||
51 | + sysbus_init_child_obj(OBJECT(s), name, | ||
52 | + &s->lpd.iou.adma[i], sizeof(s->lpd.iou.adma[i]), | ||
53 | + TYPE_XLNX_ZDMA); | ||
54 | + dev = DEVICE(&s->lpd.iou.adma[i]); | ||
55 | + object_property_set_int(OBJECT(dev), 128, "bus-width", &error_abort); | ||
56 | qdev_init_nofail(dev); | ||
57 | |||
58 | - mr = sysbus_mmio_get_region(s->lpd.iou.adma[i], 0); | ||
59 | + mr = sysbus_mmio_get_region(SYS_BUS_DEVICE(dev), 0); | ||
60 | memory_region_add_subregion(&s->mr_ps, | ||
61 | MM_ADMA_CH0 + i * MM_ADMA_CH0_SIZE, mr); | ||
62 | |||
63 | - sysbus_connect_irq(s->lpd.iou.adma[i], 0, pic[VERSAL_ADMA_IRQ_0 + i]); | ||
64 | + sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, pic[VERSAL_ADMA_IRQ_0 + i]); | ||
65 | g_free(name); | ||
66 | } | ||
67 | } | 31 | } |
68 | -- | 32 | -- |
69 | 2.20.1 | 33 | 2.34.1 |
70 | 34 | ||
71 | 35 | diff view generated by jsdifflib |
1 | From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com> | 1 | From: Philippe Mathieu-Daudé <philmd@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | hw/arm: versal: Add support for the RTC. | 3 | Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
4 | 4 | Reviewed-by: Thomas Huth <thuth@redhat.com> | |
5 | Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | 5 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
6 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 6 | Message-id: 20231020130331.50048-3-philmd@linaro.org |
7 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | ||
8 | Reviewed-by: Luc Michel <luc.michel@greensocs.com> | ||
9 | Message-id: 20200427181649.26851-10-edgar.iglesias@gmail.com | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
11 | --- | 8 | --- |
12 | include/hw/arm/xlnx-versal.h | 8 ++++++++ | 9 | hw/sd/pxa2xx_mmci.c | 7 +------ |
13 | hw/arm/xlnx-versal.c | 21 +++++++++++++++++++++ | 10 | 1 file changed, 1 insertion(+), 6 deletions(-) |
14 | 2 files changed, 29 insertions(+) | ||
15 | 11 | ||
16 | diff --git a/include/hw/arm/xlnx-versal.h b/include/hw/arm/xlnx-versal.h | 12 | diff --git a/hw/sd/pxa2xx_mmci.c b/hw/sd/pxa2xx_mmci.c |
17 | index XXXXXXX..XXXXXXX 100644 | 13 | index XXXXXXX..XXXXXXX 100644 |
18 | --- a/include/hw/arm/xlnx-versal.h | 14 | --- a/hw/sd/pxa2xx_mmci.c |
19 | +++ b/include/hw/arm/xlnx-versal.h | 15 | +++ b/hw/sd/pxa2xx_mmci.c |
20 | @@ -XXX,XX +XXX,XX @@ | 16 | @@ -XXX,XX +XXX,XX @@ PXA2xxMMCIState *pxa2xx_mmci_init(MemoryRegion *sysmem, |
21 | #include "hw/char/pl011.h" | 17 | qemu_irq irq, qemu_irq rx_dma, qemu_irq tx_dma) |
22 | #include "hw/dma/xlnx-zdma.h" | 18 | { |
23 | #include "hw/net/cadence_gem.h" | 19 | DeviceState *dev; |
24 | +#include "hw/rtc/xlnx-zynqmp-rtc.h" | 20 | - SysBusDevice *sbd; |
25 | 21 | ||
26 | #define TYPE_XLNX_VERSAL "xlnx-versal" | 22 | - dev = qdev_new(TYPE_PXA2XX_MMCI); |
27 | #define XLNX_VERSAL(obj) OBJECT_CHECK(Versal, (obj), TYPE_XLNX_VERSAL) | 23 | - sbd = SYS_BUS_DEVICE(dev); |
28 | @@ -XXX,XX +XXX,XX @@ typedef struct Versal { | 24 | - sysbus_realize_and_unref(sbd, &error_fatal); |
29 | struct { | 25 | - sysbus_mmio_map(sbd, 0, base); |
30 | SDHCIState sd[XLNX_VERSAL_NR_SDS]; | 26 | - sysbus_connect_irq(sbd, 0, irq); |
31 | } iou; | 27 | + dev = sysbus_create_simple(TYPE_PXA2XX_MMCI, base, irq); |
32 | + | 28 | qdev_connect_gpio_out_named(dev, "rx-dma", 0, rx_dma); |
33 | + XlnxZynqMPRTC rtc; | 29 | qdev_connect_gpio_out_named(dev, "tx-dma", 0, tx_dma); |
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 | + | ||
76 | + /* | ||
77 | + * TODO: Connect the ALARM and SECONDS interrupts once our RTC model | ||
78 | + * supports them. | ||
79 | + */ | ||
80 | + sysbus_connect_irq(sbd, 1, pic[VERSAL_RTC_APB_ERR_IRQ]); | ||
81 | +} | ||
82 | + | ||
83 | /* This takes the board allocated linear DDR memory and creates aliases | ||
84 | * for each split DDR range/aperture on the Versal address map. | ||
85 | */ | ||
86 | @@ -XXX,XX +XXX,XX @@ static void versal_realize(DeviceState *dev, Error **errp) | ||
87 | versal_create_gems(s, pic); | ||
88 | versal_create_admas(s, pic); | ||
89 | versal_create_sds(s, pic); | ||
90 | + versal_create_rtc(s, pic); | ||
91 | versal_map_ddr(s); | ||
92 | versal_unimp(s); | ||
93 | 30 | ||
94 | -- | 31 | -- |
95 | 2.20.1 | 32 | 2.34.1 |
96 | 33 | ||
97 | 34 | diff view generated by jsdifflib |
1 | From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com> | 1 | From: Philippe Mathieu-Daudé <philmd@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Add support for the RTC. | 3 | sysbus_mmio_map() should not be called on unrealized device. |
4 | 4 | ||
5 | Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | 5 | Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
6 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | 6 | Reviewed-by: Thomas Huth <thuth@redhat.com> |
7 | Reviewed-by: Luc Michel <luc.michel@greensocs.com> | 7 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
8 | Message-id: 20200427181649.26851-12-edgar.iglesias@gmail.com | 8 | Message-id: 20231020130331.50048-4-philmd@linaro.org |
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
10 | --- | 10 | --- |
11 | hw/arm/xlnx-versal-virt.c | 22 ++++++++++++++++++++++ | 11 | hw/pcmcia/pxa2xx.c | 7 ++----- |
12 | 1 file changed, 22 insertions(+) | 12 | 1 file changed, 2 insertions(+), 5 deletions(-) |
13 | 13 | ||
14 | diff --git a/hw/arm/xlnx-versal-virt.c b/hw/arm/xlnx-versal-virt.c | 14 | diff --git a/hw/pcmcia/pxa2xx.c b/hw/pcmcia/pxa2xx.c |
15 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/hw/arm/xlnx-versal-virt.c | 16 | --- a/hw/pcmcia/pxa2xx.c |
17 | +++ b/hw/arm/xlnx-versal-virt.c | 17 | +++ b/hw/pcmcia/pxa2xx.c |
18 | @@ -XXX,XX +XXX,XX @@ static void fdt_add_sd_nodes(VersalVirt *s) | 18 | @@ -XXX,XX +XXX,XX @@ PXA2xxPCMCIAState *pxa2xx_pcmcia_init(MemoryRegion *sysmem, |
19 | } | 19 | hwaddr base) |
20 | { | ||
21 | DeviceState *dev; | ||
22 | - PXA2xxPCMCIAState *s; | ||
23 | |||
24 | dev = qdev_new(TYPE_PXA2XX_PCMCIA); | ||
25 | - sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, base); | ||
26 | - s = PXA2XX_PCMCIA(dev); | ||
27 | - | ||
28 | sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); | ||
29 | + sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, base); | ||
30 | |||
31 | - return s; | ||
32 | + return PXA2XX_PCMCIA(dev); | ||
20 | } | 33 | } |
21 | 34 | ||
22 | +static void fdt_add_rtc_node(VersalVirt *s) | 35 | static void pxa2xx_pcmcia_initfn(Object *obj) |
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 | -- | 36 | -- |
55 | 2.20.1 | 37 | 2.34.1 |
56 | 38 | ||
57 | 39 | diff view generated by jsdifflib |
1 | From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com> | 1 | From: Philippe Mathieu-Daudé <philmd@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Embed the UARTs into the SoC type. | 3 | Reviewed-by: Thomas Huth <thuth@redhat.com> |
4 | 4 | Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> | |
5 | Suggested-by: Peter Maydell <peter.maydell@linaro.org> | 5 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
6 | Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | 6 | Message-id: 20231020130331.50048-5-philmd@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 | hw/pcmcia/pxa2xx.c | 4 +--- |
14 | hw/arm/xlnx-versal.c | 12 ++++++------ | 10 | 1 file changed, 1 insertion(+), 3 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/hw/pcmcia/pxa2xx.c b/hw/pcmcia/pxa2xx.c |
18 | index XXXXXXX..XXXXXXX 100644 | 13 | index XXXXXXX..XXXXXXX 100644 |
19 | --- a/include/hw/arm/xlnx-versal.h | 14 | --- a/hw/pcmcia/pxa2xx.c |
20 | +++ b/include/hw/arm/xlnx-versal.h | 15 | +++ b/hw/pcmcia/pxa2xx.c |
21 | @@ -XXX,XX +XXX,XX @@ | 16 | @@ -XXX,XX +XXX,XX @@ PXA2xxPCMCIAState *pxa2xx_pcmcia_init(MemoryRegion *sysmem, |
22 | #include "hw/sysbus.h" | 17 | { |
23 | #include "hw/arm/boot.h" | 18 | DeviceState *dev; |
24 | #include "hw/intc/arm_gicv3.h" | 19 | |
25 | +#include "hw/char/pl011.h" | 20 | - dev = qdev_new(TYPE_PXA2XX_PCMCIA); |
26 | 21 | - sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); | |
27 | #define TYPE_XLNX_VERSAL "xlnx-versal" | 22 | - sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, base); |
28 | #define XLNX_VERSAL(obj) OBJECT_CHECK(Versal, (obj), TYPE_XLNX_VERSAL) | 23 | + dev = sysbus_create_simple(TYPE_PXA2XX_PCMCIA, base, NULL); |
29 | @@ -XXX,XX +XXX,XX @@ typedef struct Versal { | 24 | |
30 | MemoryRegion mr_ocm; | 25 | return PXA2XX_PCMCIA(dev); |
31 | |||
32 | struct { | ||
33 | - SysBusDevice *uart[XLNX_VERSAL_NR_UARTS]; | ||
34 | + PL011State uart[XLNX_VERSAL_NR_UARTS]; | ||
35 | SysBusDevice *gem[XLNX_VERSAL_NR_GEMS]; | ||
36 | SysBusDevice *adma[XLNX_VERSAL_NR_ADMAS]; | ||
37 | } iou; | ||
38 | diff --git a/hw/arm/xlnx-versal.c b/hw/arm/xlnx-versal.c | ||
39 | index XXXXXXX..XXXXXXX 100644 | ||
40 | --- a/hw/arm/xlnx-versal.c | ||
41 | +++ b/hw/arm/xlnx-versal.c | ||
42 | @@ -XXX,XX +XXX,XX @@ | ||
43 | #include "kvm_arm.h" | ||
44 | #include "hw/misc/unimp.h" | ||
45 | #include "hw/arm/xlnx-versal.h" | ||
46 | -#include "hw/char/pl011.h" | ||
47 | |||
48 | #define XLNX_VERSAL_ACPU_TYPE ARM_CPU_TYPE_NAME("cortex-a72") | ||
49 | #define GEM_REVISION 0x40070106 | ||
50 | @@ -XXX,XX +XXX,XX @@ static void versal_create_uarts(Versal *s, qemu_irq *pic) | ||
51 | DeviceState *dev; | ||
52 | MemoryRegion *mr; | ||
53 | |||
54 | - dev = qdev_create(NULL, TYPE_PL011); | ||
55 | - s->lpd.iou.uart[i] = SYS_BUS_DEVICE(dev); | ||
56 | + sysbus_init_child_obj(OBJECT(s), name, | ||
57 | + &s->lpd.iou.uart[i], sizeof(s->lpd.iou.uart[i]), | ||
58 | + TYPE_PL011); | ||
59 | + dev = DEVICE(&s->lpd.iou.uart[i]); | ||
60 | qdev_prop_set_chr(dev, "chardev", serial_hd(i)); | ||
61 | - object_property_add_child(OBJECT(s), name, OBJECT(dev), &error_fatal); | ||
62 | qdev_init_nofail(dev); | ||
63 | |||
64 | - mr = sysbus_mmio_get_region(s->lpd.iou.uart[i], 0); | ||
65 | + mr = sysbus_mmio_get_region(SYS_BUS_DEVICE(dev), 0); | ||
66 | memory_region_add_subregion(&s->mr_ps, addrs[i], mr); | ||
67 | |||
68 | - sysbus_connect_irq(s->lpd.iou.uart[i], 0, pic[irqs[i]]); | ||
69 | + sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, pic[irqs[i]]); | ||
70 | g_free(name); | ||
71 | } | ||
72 | } | 26 | } |
73 | -- | 27 | -- |
74 | 2.20.1 | 28 | 2.34.1 |
75 | 29 | ||
76 | 30 | diff view generated by jsdifflib |
1 | From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com> | 1 | From: Philippe Mathieu-Daudé <philmd@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Fix typo xlnx-ve -> xlnx-versal. | 3 | Reviewed-by: Thomas Huth <thuth@redhat.com> |
4 | 4 | Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> | |
5 | Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | 5 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
6 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | 6 | Message-id: 20231020130331.50048-6-philmd@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 | include/hw/arm/pxa.h | 2 -- |
13 | 1 file changed, 1 insertion(+), 1 deletion(-) | 10 | hw/arm/pxa2xx.c | 12 ++++++++---- |
11 | hw/pcmcia/pxa2xx.c | 10 ---------- | ||
12 | 3 files changed, 8 insertions(+), 16 deletions(-) | ||
14 | 13 | ||
15 | diff --git a/hw/arm/xlnx-versal-virt.c b/hw/arm/xlnx-versal-virt.c | 14 | diff --git a/include/hw/arm/pxa.h b/include/hw/arm/pxa.h |
16 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
17 | --- a/hw/arm/xlnx-versal-virt.c | 16 | --- a/include/hw/arm/pxa.h |
18 | +++ b/hw/arm/xlnx-versal-virt.c | 17 | +++ b/include/hw/arm/pxa.h |
19 | @@ -XXX,XX +XXX,XX @@ static void versal_virt_init(MachineState *machine) | 18 | @@ -XXX,XX +XXX,XX @@ void pxa2xx_mmci_handlers(PXA2xxMMCIState *s, qemu_irq readonly, |
20 | psci_conduit = QEMU_PSCI_CONDUIT_SMC; | 19 | #define TYPE_PXA2XX_PCMCIA "pxa2xx-pcmcia" |
20 | OBJECT_DECLARE_SIMPLE_TYPE(PXA2xxPCMCIAState, PXA2XX_PCMCIA) | ||
21 | |||
22 | -PXA2xxPCMCIAState *pxa2xx_pcmcia_init(MemoryRegion *sysmem, | ||
23 | - hwaddr base); | ||
24 | int pxa2xx_pcmcia_attach(void *opaque, PCMCIACardState *card); | ||
25 | int pxa2xx_pcmcia_detach(void *opaque); | ||
26 | void pxa2xx_pcmcia_set_irq_cb(void *opaque, qemu_irq irq, qemu_irq cd_irq); | ||
27 | diff --git a/hw/arm/pxa2xx.c b/hw/arm/pxa2xx.c | ||
28 | index XXXXXXX..XXXXXXX 100644 | ||
29 | --- a/hw/arm/pxa2xx.c | ||
30 | +++ b/hw/arm/pxa2xx.c | ||
31 | @@ -XXX,XX +XXX,XX @@ PXA2xxState *pxa270_init(unsigned int sdram_size, const char *cpu_type) | ||
32 | sysbus_create_simple("sysbus-ohci", 0x4c000000, | ||
33 | qdev_get_gpio_in(s->pic, PXA2XX_PIC_USBH1)); | ||
34 | |||
35 | - s->pcmcia[0] = pxa2xx_pcmcia_init(address_space, 0x20000000); | ||
36 | - s->pcmcia[1] = pxa2xx_pcmcia_init(address_space, 0x30000000); | ||
37 | + s->pcmcia[0] = PXA2XX_PCMCIA(sysbus_create_simple(TYPE_PXA2XX_PCMCIA, | ||
38 | + 0x20000000, NULL)); | ||
39 | + s->pcmcia[1] = PXA2XX_PCMCIA(sysbus_create_simple(TYPE_PXA2XX_PCMCIA, | ||
40 | + 0x30000000, NULL)); | ||
41 | |||
42 | sysbus_create_simple(TYPE_PXA2XX_RTC, 0x40900000, | ||
43 | qdev_get_gpio_in(s->pic, PXA2XX_PIC_RTCALARM)); | ||
44 | @@ -XXX,XX +XXX,XX @@ PXA2xxState *pxa255_init(unsigned int sdram_size) | ||
45 | s->ssp[i] = (SSIBus *)qdev_get_child_bus(dev, "ssi"); | ||
21 | } | 46 | } |
22 | 47 | ||
23 | - sysbus_init_child_obj(OBJECT(machine), "xlnx-ve", &s->soc, | 48 | - s->pcmcia[0] = pxa2xx_pcmcia_init(address_space, 0x20000000); |
24 | + sysbus_init_child_obj(OBJECT(machine), "xlnx-versal", &s->soc, | 49 | - s->pcmcia[1] = pxa2xx_pcmcia_init(address_space, 0x30000000); |
25 | sizeof(s->soc), TYPE_XLNX_VERSAL); | 50 | + s->pcmcia[0] = PXA2XX_PCMCIA(sysbus_create_simple(TYPE_PXA2XX_PCMCIA, |
26 | object_property_set_link(OBJECT(&s->soc), OBJECT(machine->ram), | 51 | + 0x20000000, NULL)); |
27 | "ddr", &error_abort); | 52 | + s->pcmcia[1] = PXA2XX_PCMCIA(sysbus_create_simple(TYPE_PXA2XX_PCMCIA, |
53 | + 0x30000000, NULL)); | ||
54 | |||
55 | sysbus_create_simple(TYPE_PXA2XX_RTC, 0x40900000, | ||
56 | qdev_get_gpio_in(s->pic, PXA2XX_PIC_RTCALARM)); | ||
57 | diff --git a/hw/pcmcia/pxa2xx.c b/hw/pcmcia/pxa2xx.c | ||
58 | index XXXXXXX..XXXXXXX 100644 | ||
59 | --- a/hw/pcmcia/pxa2xx.c | ||
60 | +++ b/hw/pcmcia/pxa2xx.c | ||
61 | @@ -XXX,XX +XXX,XX @@ static void pxa2xx_pcmcia_set_irq(void *opaque, int line, int level) | ||
62 | qemu_set_irq(s->irq, level); | ||
63 | } | ||
64 | |||
65 | -PXA2xxPCMCIAState *pxa2xx_pcmcia_init(MemoryRegion *sysmem, | ||
66 | - hwaddr base) | ||
67 | -{ | ||
68 | - DeviceState *dev; | ||
69 | - | ||
70 | - dev = sysbus_create_simple(TYPE_PXA2XX_PCMCIA, base, NULL); | ||
71 | - | ||
72 | - return PXA2XX_PCMCIA(dev); | ||
73 | -} | ||
74 | - | ||
75 | static void pxa2xx_pcmcia_initfn(Object *obj) | ||
76 | { | ||
77 | SysBusDevice *sbd = SYS_BUS_DEVICE(obj); | ||
28 | -- | 78 | -- |
29 | 2.20.1 | 79 | 2.34.1 |
30 | 80 | ||
31 | 81 | diff view generated by jsdifflib |
1 | From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com> | 1 | From: Philippe Mathieu-Daudé <philmd@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Add support for SD. | 3 | Factor reset code out of the DeviceRealize() handler. |
4 | 4 | ||
5 | Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | 5 | Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
6 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | 6 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
7 | Reviewed-by: Luc Michel <luc.michel@greensocs.com> | 7 | Reviewed-by: Thomas Huth <thuth@redhat.com> |
8 | Message-id: 20200427181649.26851-11-edgar.iglesias@gmail.com | 8 | Message-id: 20231020130331.50048-7-philmd@linaro.org |
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
10 | --- | 10 | --- |
11 | hw/arm/xlnx-versal-virt.c | 46 +++++++++++++++++++++++++++++++++++++++ | 11 | hw/arm/pxa2xx_pic.c | 17 ++++++++++++----- |
12 | 1 file changed, 46 insertions(+) | 12 | 1 file changed, 12 insertions(+), 5 deletions(-) |
13 | 13 | ||
14 | diff --git a/hw/arm/xlnx-versal-virt.c b/hw/arm/xlnx-versal-virt.c | 14 | diff --git a/hw/arm/pxa2xx_pic.c b/hw/arm/pxa2xx_pic.c |
15 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/hw/arm/xlnx-versal-virt.c | 16 | --- a/hw/arm/pxa2xx_pic.c |
17 | +++ b/hw/arm/xlnx-versal-virt.c | 17 | +++ b/hw/arm/pxa2xx_pic.c |
18 | @@ -XXX,XX +XXX,XX @@ | 18 | @@ -XXX,XX +XXX,XX @@ static int pxa2xx_pic_post_load(void *opaque, int version_id) |
19 | #include "hw/arm/sysbus-fdt.h" | 19 | return 0; |
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 | } | ||
28 | } | 20 | } |
29 | 21 | ||
30 | +static void fdt_add_sd_nodes(VersalVirt *s) | 22 | -DeviceState *pxa2xx_pic_init(hwaddr base, ARMCPU *cpu) |
31 | +{ | 23 | +static void pxa2xx_pic_reset_hold(Object *obj) |
32 | + const char clocknames[] = "clk_xin\0clk_ahb"; | 24 | { |
33 | + const char compat[] = "arasan,sdhci-8.9a"; | 25 | - DeviceState *dev = qdev_new(TYPE_PXA2XX_PIC); |
34 | + int i; | 26 | - PXA2xxPICState *s = PXA2XX_PIC(dev); |
35 | + | 27 | - |
36 | + for (i = ARRAY_SIZE(s->soc.pmc.iou.sd) - 1; i >= 0; i--) { | 28 | - s->cpu = cpu; |
37 | + uint64_t addr = MM_PMC_SD0 + MM_PMC_SD0_SIZE * i; | 29 | + PXA2xxPICState *s = PXA2XX_PIC(obj); |
38 | + char *name = g_strdup_printf("/sdhci@%" PRIx64, addr); | 30 | |
39 | + | 31 | s->int_pending[0] = 0; |
40 | + qemu_fdt_add_subnode(s->fdt, name); | 32 | s->int_pending[1] = 0; |
41 | + | 33 | @@ -XXX,XX +XXX,XX @@ DeviceState *pxa2xx_pic_init(hwaddr base, ARMCPU *cpu) |
42 | + qemu_fdt_setprop_cells(s->fdt, name, "clocks", | 34 | s->int_enabled[1] = 0; |
43 | + s->phandle.clk_25Mhz, s->phandle.clk_25Mhz); | 35 | s->is_fiq[0] = 0; |
44 | + qemu_fdt_setprop(s->fdt, name, "clock-names", | 36 | s->is_fiq[1] = 0; |
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 | +} | 37 | +} |
55 | + | 38 | + |
56 | static void fdt_nop_memory_nodes(void *fdt, Error **errp) | 39 | +DeviceState *pxa2xx_pic_init(hwaddr base, ARMCPU *cpu) |
40 | +{ | ||
41 | + DeviceState *dev = qdev_new(TYPE_PXA2XX_PIC); | ||
42 | + PXA2xxPICState *s = PXA2XX_PIC(dev); | ||
43 | + | ||
44 | + s->cpu = cpu; | ||
45 | |||
46 | sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); | ||
47 | |||
48 | @@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_pxa2xx_pic_regs = { | ||
49 | static void pxa2xx_pic_class_init(ObjectClass *klass, void *data) | ||
57 | { | 50 | { |
58 | Error *err = NULL; | 51 | DeviceClass *dc = DEVICE_CLASS(klass); |
59 | @@ -XXX,XX +XXX,XX @@ static void create_virtio_regions(VersalVirt *s) | 52 | + ResettableClass *rc = RESETTABLE_CLASS(klass); |
60 | } | 53 | |
54 | dc->desc = "PXA2xx PIC"; | ||
55 | dc->vmsd = &vmstate_pxa2xx_pic_regs; | ||
56 | + rc->phases.hold = pxa2xx_pic_reset_hold; | ||
61 | } | 57 | } |
62 | 58 | ||
63 | +static void sd_plugin_card(SDHCIState *sd, DriveInfo *di) | 59 | static const TypeInfo pxa2xx_pic_info = { |
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 | -- | 60 | -- |
104 | 2.20.1 | 61 | 2.34.1 |
105 | 62 | ||
106 | 63 | 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@linaro.org> |
---|---|---|---|
2 | registers. The intended pattern is that for 64-bit ID registers we | ||
3 | use FIELD_DP64 and the uint64_t 't' register, while 32-bit ID | ||
4 | registers use FIELD_DP32 and the uint32_t 'u' register. For | ||
5 | ID_AA64DFR0 we accidentally used 'u', meaning that the top 32 bits of | ||
6 | this 64-bit ID register would end up always zero. Luckily at the | ||
7 | moment that's what they should be anyway, so this bug has no visible | ||
8 | effects. | ||
9 | 2 | ||
10 | Use the right-sized variable. | 3 | QOM objects shouldn't access each other internals fields |
4 | except using the QOM API. | ||
11 | 5 | ||
12 | Fixes: 3bec78447a958d481991 | 6 | Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
7 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
8 | Reviewed-by: Thomas Huth <thuth@redhat.com> | ||
9 | Message-id: 20231020130331.50048-8-philmd@linaro.org | ||
13 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
14 | Reviewed-by: Laurent Desnogues <laurent.desnogues@gmail.com> | ||
15 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
16 | Message-id: 20200423110915.10527-1-peter.maydell@linaro.org | ||
17 | --- | 11 | --- |
18 | target/arm/cpu64.c | 6 +++--- | 12 | hw/arm/pxa2xx_pic.c | 11 ++++++++++- |
19 | 1 file changed, 3 insertions(+), 3 deletions(-) | 13 | 1 file changed, 10 insertions(+), 1 deletion(-) |
20 | 14 | ||
21 | diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c | 15 | diff --git a/hw/arm/pxa2xx_pic.c b/hw/arm/pxa2xx_pic.c |
22 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
23 | --- a/target/arm/cpu64.c | 17 | --- a/hw/arm/pxa2xx_pic.c |
24 | +++ b/target/arm/cpu64.c | 18 | +++ b/hw/arm/pxa2xx_pic.c |
25 | @@ -XXX,XX +XXX,XX @@ static void aarch64_max_initfn(Object *obj) | 19 | @@ -XXX,XX +XXX,XX @@ |
26 | u = FIELD_DP32(u, ID_MMFR4, XNX, 1); /* TTS2UXN */ | 20 | #include "cpu.h" |
27 | cpu->isar.id_mmfr4 = u; | 21 | #include "hw/arm/pxa.h" |
28 | 22 | #include "hw/sysbus.h" | |
29 | - u = cpu->isar.id_aa64dfr0; | 23 | +#include "hw/qdev-properties.h" |
30 | - u = FIELD_DP64(u, ID_AA64DFR0, PMUVER, 5); /* v8.4-PMU */ | 24 | #include "migration/vmstate.h" |
31 | - cpu->isar.id_aa64dfr0 = u; | 25 | #include "qom/object.h" |
32 | + t = cpu->isar.id_aa64dfr0; | 26 | #include "target/arm/cpregs.h" |
33 | + t = FIELD_DP64(t, ID_AA64DFR0, PMUVER, 5); /* v8.4-PMU */ | 27 | @@ -XXX,XX +XXX,XX @@ DeviceState *pxa2xx_pic_init(hwaddr base, ARMCPU *cpu) |
34 | + cpu->isar.id_aa64dfr0 = t; | 28 | DeviceState *dev = qdev_new(TYPE_PXA2XX_PIC); |
35 | 29 | PXA2xxPICState *s = PXA2XX_PIC(dev); | |
36 | u = cpu->isar.id_dfr0; | 30 | |
37 | u = FIELD_DP32(u, ID_DFR0, PERFMON, 5); /* v8.4-PMU */ | 31 | - s->cpu = cpu; |
32 | + object_property_set_link(OBJECT(dev), "arm-cpu", | ||
33 | + OBJECT(cpu), &error_abort); | ||
34 | |||
35 | sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); | ||
36 | |||
37 | @@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_pxa2xx_pic_regs = { | ||
38 | }, | ||
39 | }; | ||
40 | |||
41 | +static Property pxa2xx_pic_properties[] = { | ||
42 | + DEFINE_PROP_LINK("arm-cpu", PXA2xxPICState, cpu, | ||
43 | + TYPE_ARM_CPU, ARMCPU *), | ||
44 | + DEFINE_PROP_END_OF_LIST(), | ||
45 | +}; | ||
46 | + | ||
47 | static void pxa2xx_pic_class_init(ObjectClass *klass, void *data) | ||
48 | { | ||
49 | DeviceClass *dc = DEVICE_CLASS(klass); | ||
50 | ResettableClass *rc = RESETTABLE_CLASS(klass); | ||
51 | |||
52 | + device_class_set_props(dc, pxa2xx_pic_properties); | ||
53 | dc->desc = "PXA2xx PIC"; | ||
54 | dc->vmsd = &vmstate_pxa2xx_pic_regs; | ||
55 | rc->phases.hold = pxa2xx_pic_reset_hold; | ||
38 | -- | 56 | -- |
39 | 2.20.1 | 57 | 2.34.1 |
40 | 58 | ||
41 | 59 | diff view generated by jsdifflib |
1 | Convert the Neon "load/store multiple structures" insns to decodetree. | 1 | From: Philippe Mathieu-Daudé <philmd@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
4 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
5 | Reviewed-by: Thomas Huth <thuth@redhat.com> | ||
6 | Message-id: 20231020130331.50048-9-philmd@linaro.org | ||
3 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
4 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
5 | Message-id: 20200430181003.21682-12-peter.maydell@linaro.org | ||
6 | --- | 8 | --- |
7 | target/arm/neon-ls.decode | 7 ++ | 9 | hw/arm/pxa2xx_pic.c | 16 ++++++++++------ |
8 | target/arm/translate-neon.inc.c | 124 ++++++++++++++++++++++++++++++++ | 10 | 1 file changed, 10 insertions(+), 6 deletions(-) |
9 | target/arm/translate.c | 91 +---------------------- | ||
10 | 3 files changed, 133 insertions(+), 89 deletions(-) | ||
11 | 11 | ||
12 | diff --git a/target/arm/neon-ls.decode b/target/arm/neon-ls.decode | 12 | diff --git a/hw/arm/pxa2xx_pic.c b/hw/arm/pxa2xx_pic.c |
13 | index XXXXXXX..XXXXXXX 100644 | 13 | index XXXXXXX..XXXXXXX 100644 |
14 | --- a/target/arm/neon-ls.decode | 14 | --- a/hw/arm/pxa2xx_pic.c |
15 | +++ b/target/arm/neon-ls.decode | 15 | +++ b/hw/arm/pxa2xx_pic.c |
16 | @@ -XXX,XX +XXX,XX @@ | 16 | @@ -XXX,XX +XXX,XX @@ static void pxa2xx_pic_reset_hold(Object *obj) |
17 | # 0b1111_1001_xxx0_xxxx_xxxx_xxxx_xxxx_xxxx | 17 | DeviceState *pxa2xx_pic_init(hwaddr base, ARMCPU *cpu) |
18 | # This file works on the A32 encoding only; calling code for T32 has to | 18 | { |
19 | # transform the insn into the A32 version first. | 19 | DeviceState *dev = qdev_new(TYPE_PXA2XX_PIC); |
20 | - PXA2xxPICState *s = PXA2XX_PIC(dev); | ||
21 | |||
22 | object_property_set_link(OBJECT(dev), "arm-cpu", | ||
23 | OBJECT(cpu), &error_abort); | ||
24 | - | ||
25 | sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); | ||
26 | + sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, base); | ||
20 | + | 27 | + |
21 | +%vd_dp 22:1 12:4 | 28 | + return dev; |
22 | + | ||
23 | +# Neon load/store multiple structures | ||
24 | + | ||
25 | +VLDST_multiple 1111 0100 0 . l:1 0 rn:4 .... itype:4 size:2 align:2 rm:4 \ | ||
26 | + vd=%vd_dp | ||
27 | diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c | ||
28 | index XXXXXXX..XXXXXXX 100644 | ||
29 | --- a/target/arm/translate-neon.inc.c | ||
30 | +++ b/target/arm/translate-neon.inc.c | ||
31 | @@ -XXX,XX +XXX,XX @@ static bool trans_VFML_scalar(DisasContext *s, arg_VFML_scalar *a) | ||
32 | gen_helper_gvec_fmlal_idx_a32); | ||
33 | return true; | ||
34 | } | ||
35 | + | ||
36 | +static struct { | ||
37 | + int nregs; | ||
38 | + int interleave; | ||
39 | + int spacing; | ||
40 | +} const neon_ls_element_type[11] = { | ||
41 | + {1, 4, 1}, | ||
42 | + {1, 4, 2}, | ||
43 | + {4, 1, 1}, | ||
44 | + {2, 2, 2}, | ||
45 | + {1, 3, 1}, | ||
46 | + {1, 3, 2}, | ||
47 | + {3, 1, 1}, | ||
48 | + {1, 1, 1}, | ||
49 | + {1, 2, 1}, | ||
50 | + {1, 2, 2}, | ||
51 | + {2, 1, 1} | ||
52 | +}; | ||
53 | + | ||
54 | +static void gen_neon_ldst_base_update(DisasContext *s, int rm, int rn, | ||
55 | + int stride) | ||
56 | +{ | ||
57 | + if (rm != 15) { | ||
58 | + TCGv_i32 base; | ||
59 | + | ||
60 | + base = load_reg(s, rn); | ||
61 | + if (rm == 13) { | ||
62 | + tcg_gen_addi_i32(base, base, stride); | ||
63 | + } else { | ||
64 | + TCGv_i32 index; | ||
65 | + index = load_reg(s, rm); | ||
66 | + tcg_gen_add_i32(base, base, index); | ||
67 | + tcg_temp_free_i32(index); | ||
68 | + } | ||
69 | + store_reg(s, rn, base); | ||
70 | + } | ||
71 | +} | 29 | +} |
72 | + | 30 | + |
73 | +static bool trans_VLDST_multiple(DisasContext *s, arg_VLDST_multiple *a) | 31 | +static void pxa2xx_pic_realize(DeviceState *dev, Error **errp) |
74 | +{ | 32 | +{ |
75 | + /* Neon load/store multiple structures */ | 33 | + PXA2xxPICState *s = PXA2XX_PIC(dev); |
76 | + int nregs, interleave, spacing, reg, n; | 34 | |
77 | + MemOp endian = s->be_data; | 35 | qdev_init_gpio_in(dev, pxa2xx_pic_set_irq, PXA2XX_PIC_SRCS); |
78 | + int mmu_idx = get_mem_index(s); | 36 | |
79 | + int size = a->size; | 37 | @@ -XXX,XX +XXX,XX @@ DeviceState *pxa2xx_pic_init(hwaddr base, ARMCPU *cpu) |
80 | + TCGv_i64 tmp64; | 38 | memory_region_init_io(&s->iomem, OBJECT(s), &pxa2xx_pic_ops, s, |
81 | + TCGv_i32 addr, tmp; | 39 | "pxa2xx-pic", 0x00100000); |
82 | + | 40 | sysbus_init_mmio(SYS_BUS_DEVICE(dev), &s->iomem); |
83 | + if (!arm_dc_feature(s, ARM_FEATURE_NEON)) { | 41 | - sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, base); |
84 | + return false; | 42 | |
85 | + } | 43 | /* Enable IC coprocessor access. */ |
86 | + | 44 | - define_arm_cp_regs_with_opaque(cpu, pxa_pic_cp_reginfo, s); |
87 | + /* UNDEF accesses to D16-D31 if they don't exist */ | 45 | - |
88 | + if (!dc_isar_feature(aa32_simd_r32, s) && (a->vd & 0x10)) { | 46 | - return dev; |
89 | + return false; | 47 | + define_arm_cp_regs_with_opaque(s->cpu, pxa_pic_cp_reginfo, s); |
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 | } | 48 | } |
165 | 49 | ||
166 | 50 | static const VMStateDescription vmstate_pxa2xx_pic_regs = { | |
167 | -static struct { | 51 | @@ -XXX,XX +XXX,XX @@ static void pxa2xx_pic_class_init(ObjectClass *klass, void *data) |
168 | - int nregs; | 52 | ResettableClass *rc = RESETTABLE_CLASS(klass); |
169 | - int interleave; | 53 | |
170 | - int spacing; | 54 | device_class_set_props(dc, pxa2xx_pic_properties); |
171 | -} const neon_ls_element_type[11] = { | 55 | + dc->realize = pxa2xx_pic_realize; |
172 | - {1, 4, 1}, | 56 | dc->desc = "PXA2xx PIC"; |
173 | - {1, 4, 2}, | 57 | dc->vmsd = &vmstate_pxa2xx_pic_regs; |
174 | - {4, 1, 1}, | 58 | rc->phases.hold = pxa2xx_pic_reset_hold; |
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 | -- | 59 | -- |
283 | 2.20.1 | 60 | 2.34.1 |
284 | 61 | ||
285 | 62 | diff view generated by jsdifflib |
1 | The access_type argument to get_phys_addr_lpae() is an MMUAccessType; | 1 | From: Philippe Mathieu-Daudé <philmd@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 | qbus_new(), called in i2c_init_bus(), should not be called | ||
4 | on unrealized device. | ||
5 | |||
6 | Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
7 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
8 | Reviewed-by: Thomas Huth <thuth@redhat.com> | ||
9 | Message-id: 20231020130331.50048-10-philmd@linaro.org | ||
5 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 10 | 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 | --- | 11 | --- |
10 | target/arm/helper.c | 5 +++-- | 12 | hw/arm/pxa2xx.c | 5 +++-- |
11 | 1 file changed, 3 insertions(+), 2 deletions(-) | 13 | 1 file changed, 3 insertions(+), 2 deletions(-) |
12 | 14 | ||
13 | diff --git a/target/arm/helper.c b/target/arm/helper.c | 15 | diff --git a/hw/arm/pxa2xx.c b/hw/arm/pxa2xx.c |
14 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/target/arm/helper.c | 17 | --- a/hw/arm/pxa2xx.c |
16 | +++ b/target/arm/helper.c | 18 | +++ b/hw/arm/pxa2xx.c |
17 | @@ -XXX,XX +XXX,XX @@ static hwaddr S1_ptw_translate(CPUARMState *env, ARMMMUIdx mmu_idx, | 19 | @@ -XXX,XX +XXX,XX @@ PXA2xxI2CState *pxa2xx_i2c_init(hwaddr base, |
18 | pcacheattrs = &cacheattrs; | 20 | qdev_prop_set_uint32(dev, "size", region_size + 1); |
19 | } | 21 | qdev_prop_set_uint32(dev, "offset", base & region_size); |
20 | 22 | ||
21 | - ret = get_phys_addr_lpae(env, addr, 0, ARMMMUIdx_Stage2, &s2pa, | 23 | + /* FIXME: Should the slave device really be on a separate bus? */ |
22 | - &txattrs, &s2prot, &s2size, fi, pcacheattrs); | 24 | + i2cbus = i2c_init_bus(dev, "dummy"); |
23 | + ret = get_phys_addr_lpae(env, addr, MMU_DATA_LOAD, ARMMMUIdx_Stage2, | 25 | + |
24 | + &s2pa, &txattrs, &s2prot, &s2size, fi, | 26 | i2c_dev = SYS_BUS_DEVICE(dev); |
25 | + pcacheattrs); | 27 | sysbus_realize_and_unref(i2c_dev, &error_fatal); |
26 | if (ret) { | 28 | sysbus_mmio_map(i2c_dev, 0, base & ~region_size); |
27 | assert(fi->type != ARMFault_None); | 29 | sysbus_connect_irq(i2c_dev, 0, irq); |
28 | fi->s2addr = addr; | 30 | |
31 | s = PXA2XX_I2C(i2c_dev); | ||
32 | - /* FIXME: Should the slave device really be on a separate bus? */ | ||
33 | - i2cbus = i2c_init_bus(dev, "dummy"); | ||
34 | s->slave = PXA2XX_I2C_SLAVE(i2c_slave_create_simple(i2cbus, | ||
35 | TYPE_PXA2XX_I2C_SLAVE, | ||
36 | 0)); | ||
29 | -- | 37 | -- |
30 | 2.20.1 | 38 | 2.34.1 |
31 | 39 | ||
32 | 40 | diff view generated by jsdifflib |
1 | Convert the VFM[AS]L (scalar) insns in the 2reg-scalar-ext group | 1 | From: Philippe Mathieu-Daudé <philmd@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 | Prefer using a well known local first CPU rather than a global one. |
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 | 4 | ||
5 | Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
6 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Message-id: 20231025065909.57344-1-philmd@linaro.org | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
11 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
12 | Message-id: 20200430181003.21682-11-peter.maydell@linaro.org | ||
13 | --- | 9 | --- |
14 | target/arm/neon-shared.decode | 7 +++ | 10 | hw/arm/bananapi_m2u.c | 2 +- |
15 | target/arm/translate-neon.inc.c | 32 ++++++++++ | 11 | hw/arm/exynos4_boards.c | 7 ++++--- |
16 | target/arm/translate.c | 107 +------------------------------- | 12 | hw/arm/orangepi.c | 2 +- |
17 | 3 files changed, 40 insertions(+), 106 deletions(-) | 13 | hw/arm/realview.c | 2 +- |
14 | hw/arm/xilinx_zynq.c | 2 +- | ||
15 | 5 files changed, 8 insertions(+), 7 deletions(-) | ||
18 | 16 | ||
19 | diff --git a/target/arm/neon-shared.decode b/target/arm/neon-shared.decode | 17 | diff --git a/hw/arm/bananapi_m2u.c b/hw/arm/bananapi_m2u.c |
20 | index XXXXXXX..XXXXXXX 100644 | 18 | index XXXXXXX..XXXXXXX 100644 |
21 | --- a/target/arm/neon-shared.decode | 19 | --- a/hw/arm/bananapi_m2u.c |
22 | +++ b/target/arm/neon-shared.decode | 20 | +++ b/hw/arm/bananapi_m2u.c |
23 | @@ -XXX,XX +XXX,XX @@ VCMLA_scalar 1111 1110 1 . rot:2 .... .... 1000 . q:1 . 0 .... \ | 21 | @@ -XXX,XX +XXX,XX @@ static void bpim2u_init(MachineState *machine) |
24 | 22 | bpim2u_binfo.loader_start = r40->memmap[AW_R40_DEV_SDRAM]; | |
25 | VDOT_scalar 1111 1110 0 . 10 .... .... 1101 . q:1 index:1 u:1 rm:4 \ | 23 | bpim2u_binfo.ram_size = machine->ram_size; |
26 | vm=%vm_dp vn=%vn_dp vd=%vd_dp | 24 | bpim2u_binfo.psci_conduit = QEMU_PSCI_CONDUIT_SMC; |
27 | + | 25 | - arm_load_kernel(ARM_CPU(first_cpu), machine, &bpim2u_binfo); |
28 | +%vfml_scalar_q0_rm 0:3 5:1 | 26 | + arm_load_kernel(&r40->cpus[0], machine, &bpim2u_binfo); |
29 | +%vfml_scalar_q1_index 5:1 3:1 | 27 | } |
30 | +VFML_scalar 1111 1110 0 . 0 s:1 .... .... 1000 . 0 . 1 index:1 ... \ | 28 | |
31 | + rm=%vfml_scalar_q0_rm vn=%vn_sp vd=%vd_dp q=0 | 29 | static void bpim2u_machine_init(MachineClass *mc) |
32 | +VFML_scalar 1111 1110 0 . 0 s:1 .... .... 1000 . 1 . 1 . rm:3 \ | 30 | diff --git a/hw/arm/exynos4_boards.c b/hw/arm/exynos4_boards.c |
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 | 31 | index XXXXXXX..XXXXXXX 100644 |
36 | --- a/target/arm/translate-neon.inc.c | 32 | --- a/hw/arm/exynos4_boards.c |
37 | +++ b/target/arm/translate-neon.inc.c | 33 | +++ b/hw/arm/exynos4_boards.c |
38 | @@ -XXX,XX +XXX,XX @@ static bool trans_VDOT_scalar(DisasContext *s, arg_VDOT_scalar *a) | 34 | @@ -XXX,XX +XXX,XX @@ exynos4_boards_init_common(MachineState *machine, |
39 | tcg_temp_free_ptr(fpst); | 35 | |
40 | return true; | 36 | static void nuri_init(MachineState *machine) |
37 | { | ||
38 | - exynos4_boards_init_common(machine, EXYNOS4_BOARD_NURI); | ||
39 | + Exynos4BoardState *s = exynos4_boards_init_common(machine, | ||
40 | + EXYNOS4_BOARD_NURI); | ||
41 | |||
42 | - arm_load_kernel(ARM_CPU(first_cpu), machine, &exynos4_board_binfo); | ||
43 | + arm_load_kernel(s->soc.cpu[0], machine, &exynos4_board_binfo); | ||
41 | } | 44 | } |
42 | + | 45 | |
43 | +static bool trans_VFML_scalar(DisasContext *s, arg_VFML_scalar *a) | 46 | static void smdkc210_init(MachineState *machine) |
44 | +{ | 47 | @@ -XXX,XX +XXX,XX @@ static void smdkc210_init(MachineState *machine) |
45 | + int opr_sz; | 48 | |
46 | + | 49 | lan9215_init(SMDK_LAN9118_BASE_ADDR, |
47 | + if (!dc_isar_feature(aa32_fhm, s)) { | 50 | qemu_irq_invert(s->soc.irq_table[exynos4210_get_irq(37, 1)])); |
48 | + return false; | 51 | - arm_load_kernel(ARM_CPU(first_cpu), machine, &exynos4_board_binfo); |
49 | + } | 52 | + arm_load_kernel(s->soc.cpu[0], machine, &exynos4_board_binfo); |
50 | + | 53 | } |
51 | + /* UNDEF accesses to D16-D31 if they don't exist. */ | 54 | |
52 | + if (!dc_isar_feature(aa32_simd_r32, s) && | 55 | static void nuri_class_init(ObjectClass *oc, void *data) |
53 | + ((a->vd & 0x10) || (a->q && (a->vn & 0x10)))) { | 56 | diff --git a/hw/arm/orangepi.c b/hw/arm/orangepi.c |
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 | 57 | index XXXXXXX..XXXXXXX 100644 |
76 | --- a/target/arm/translate.c | 58 | --- a/hw/arm/orangepi.c |
77 | +++ b/target/arm/translate.c | 59 | +++ b/hw/arm/orangepi.c |
78 | @@ -XXX,XX +XXX,XX @@ static int disas_dsp_insn(DisasContext *s, uint32_t insn) | 60 | @@ -XXX,XX +XXX,XX @@ static void orangepi_init(MachineState *machine) |
61 | orangepi_binfo.loader_start = h3->memmap[AW_H3_DEV_SDRAM]; | ||
62 | orangepi_binfo.ram_size = machine->ram_size; | ||
63 | orangepi_binfo.psci_conduit = QEMU_PSCI_CONDUIT_SMC; | ||
64 | - arm_load_kernel(ARM_CPU(first_cpu), machine, &orangepi_binfo); | ||
65 | + arm_load_kernel(&h3->cpus[0], machine, &orangepi_binfo); | ||
79 | } | 66 | } |
80 | 67 | ||
81 | #define VFP_REG_SHR(x, n) (((n) > 0) ? (x) >> (n) : (x) << -(n)) | 68 | static void orangepi_machine_init(MachineClass *mc) |
82 | -#define VFP_SREG(insn, bigbit, smallbit) \ | 69 | diff --git a/hw/arm/realview.c b/hw/arm/realview.c |
83 | - ((VFP_REG_SHR(insn, bigbit - 1) & 0x1e) | (((insn) >> (smallbit)) & 1)) | 70 | index XXXXXXX..XXXXXXX 100644 |
84 | #define VFP_DREG(reg, insn, bigbit, smallbit) do { \ | 71 | --- a/hw/arm/realview.c |
85 | if (dc_isar_feature(aa32_simd_r32, s)) { \ | 72 | +++ b/hw/arm/realview.c |
86 | reg = (((insn) >> (bigbit)) & 0x0f) \ | 73 | @@ -XXX,XX +XXX,XX @@ static void realview_init(MachineState *machine, |
87 | @@ -XXX,XX +XXX,XX @@ static int disas_dsp_insn(DisasContext *s, uint32_t insn) | 74 | realview_binfo.ram_size = ram_size; |
88 | reg = ((insn) >> (bigbit)) & 0x0f; \ | 75 | realview_binfo.board_id = realview_board_id[board_type]; |
89 | }} while (0) | 76 | realview_binfo.loader_start = (board_type == BOARD_PB_A8 ? 0x70000000 : 0); |
90 | 77 | - arm_load_kernel(ARM_CPU(first_cpu), machine, &realview_binfo); | |
91 | -#define VFP_SREG_D(insn) VFP_SREG(insn, 12, 22) | 78 | + arm_load_kernel(cpu, machine, &realview_binfo); |
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 | } | 79 | } |
102 | 80 | ||
103 | -/* Advanced SIMD two registers and a scalar extension. | 81 | static void realview_eb_init(MachineState *machine) |
104 | - * 31 24 23 22 20 16 12 11 10 9 8 3 0 | 82 | diff --git a/hw/arm/xilinx_zynq.c b/hw/arm/xilinx_zynq.c |
105 | - * +-----------------+----+---+----+----+----+---+----+---+----+---------+----+ | 83 | index XXXXXXX..XXXXXXX 100644 |
106 | - * | 1 1 1 1 1 1 1 0 | o1 | D | o2 | Vn | Vd | 1 | o3 | 0 | o4 | N Q M U | Vm | | 84 | --- a/hw/arm/xilinx_zynq.c |
107 | - * +-----------------+----+---+----+----+----+---+----+---+----+---------+----+ | 85 | +++ b/hw/arm/xilinx_zynq.c |
108 | - * | 86 | @@ -XXX,XX +XXX,XX @@ static void zynq_init(MachineState *machine) |
109 | - */ | 87 | zynq_binfo.board_setup_addr = BOARD_SETUP_ADDR; |
110 | - | 88 | zynq_binfo.write_board_setup = zynq_write_board_setup; |
111 | -static int disas_neon_insn_2reg_scalar_ext(DisasContext *s, uint32_t insn) | 89 | |
112 | -{ | 90 | - arm_load_kernel(ARM_CPU(first_cpu), machine, &zynq_binfo); |
113 | - gen_helper_gvec_3 *fn_gvec = NULL; | 91 | + arm_load_kernel(cpu, machine, &zynq_binfo); |
114 | - gen_helper_gvec_3_ptr *fn_gvec_ptr = NULL; | 92 | } |
115 | - int rd, rn, rm, opr_sz, data; | 93 | |
116 | - int off_rn, off_rm; | 94 | static void zynq_machine_class_init(ObjectClass *oc, void *data) |
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 | { | ||
193 | int cpnum, is64, crn, crm, opc1, opc2, isread, rt, rt2; | ||
194 | @@ -XXX,XX +XXX,XX @@ static void disas_arm_insn(DisasContext *s, unsigned int insn) | ||
195 | } | ||
196 | } | ||
197 | } | ||
198 | - } else if ((insn & 0x0f000a00) == 0x0e000800 | ||
199 | - && arm_dc_feature(s, ARM_FEATURE_V8)) { | ||
200 | - if (disas_neon_insn_2reg_scalar_ext(s, insn)) { | ||
201 | - goto illegal_op; | ||
202 | - } | ||
203 | - return; | ||
204 | } | ||
205 | goto illegal_op; | ||
206 | } | ||
207 | @@ -XXX,XX +XXX,XX @@ static void disas_thumb2_insn(DisasContext *s, uint32_t insn) | ||
208 | } | ||
209 | break; | ||
210 | } | ||
211 | - if ((insn & 0xff000a00) == 0xfe000800 | ||
212 | - && arm_dc_feature(s, ARM_FEATURE_V8)) { | ||
213 | - /* The Thumb2 and ARM encodings are identical. */ | ||
214 | - if (disas_neon_insn_2reg_scalar_ext(s, insn)) { | ||
215 | - goto illegal_op; | ||
216 | - } | ||
217 | - } else if (((insn >> 24) & 3) == 3) { | ||
218 | + if (((insn >> 24) & 3) == 3) { | ||
219 | /* Translate into the equivalent ARM encoding. */ | ||
220 | insn = (insn & 0xe2ffffff) | ((insn & (1 << 28)) >> 4) | (1 << 28); | ||
221 | if (disas_neon_data_insn(s, insn)) { | ||
222 | -- | 95 | -- |
223 | 2.20.1 | 96 | 2.34.1 |
224 | 97 | ||
225 | 98 | diff view generated by jsdifflib |
1 | From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com> | 1 | From: Glenn Miles <milesg@linux.vnet.ibm.com> |
---|---|---|---|
2 | 2 | ||
3 | Move misplaced comment. | 3 | Testing of the LED state showed that when the LED polarity was |
4 | set to GPIO_POLARITY_ACTIVE_LOW and a low logic value was set on | ||
5 | the input GPIO of the LED, the LED was being turn off when it was | ||
6 | expected to be turned on. | ||
4 | 7 | ||
5 | Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | 8 | Fixes: ddb67f6402 ("hw/misc/led: Allow connecting from GPIO output") |
6 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | 9 | Signed-off-by: Glenn Miles <milesg@linux.vnet.ibm.com> |
7 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 10 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
8 | Reviewed-by: Luc Michel <luc.michel@greensocs.com> | 11 | Reviewed-by: Andrew Jeffery <andrew@codeconstruct.com.au> |
9 | Message-id: 20200427181649.26851-3-edgar.iglesias@gmail.com | 12 | Message-id: 20231024191945.4135036-1-milesg@linux.vnet.ibm.com |
13 | Reviewed-by: Philippe Mathieu-Daudé <philmd@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 | hw/arm/xlnx-versal.c | 2 +- | 16 | hw/misc/led.c | 2 +- |
13 | 1 file changed, 1 insertion(+), 1 deletion(-) | 17 | 1 file changed, 1 insertion(+), 1 deletion(-) |
14 | 18 | ||
15 | diff --git a/hw/arm/xlnx-versal.c b/hw/arm/xlnx-versal.c | 19 | diff --git a/hw/misc/led.c b/hw/misc/led.c |
16 | index XXXXXXX..XXXXXXX 100644 | 20 | index XXXXXXX..XXXXXXX 100644 |
17 | --- a/hw/arm/xlnx-versal.c | 21 | --- a/hw/misc/led.c |
18 | +++ b/hw/arm/xlnx-versal.c | 22 | +++ b/hw/misc/led.c |
19 | @@ -XXX,XX +XXX,XX @@ static void versal_create_apu_cpus(Versal *s) | 23 | @@ -XXX,XX +XXX,XX @@ static void led_set_state_gpio_handler(void *opaque, int line, int new_state) |
20 | 24 | LEDState *s = LED(opaque); | |
21 | obj = object_new(XLNX_VERSAL_ACPU_TYPE); | 25 | |
22 | if (!obj) { | 26 | assert(line == 0); |
23 | - /* Secondary CPUs start in PSCI powered-down state */ | 27 | - led_set_state(s, !!new_state != s->gpio_active_high); |
24 | error_report("Unable to create apu.cpu[%d] of type %s", | 28 | + led_set_state(s, !!new_state == s->gpio_active_high); |
25 | i, XLNX_VERSAL_ACPU_TYPE); | 29 | } |
26 | exit(EXIT_FAILURE); | 30 | |
27 | @@ -XXX,XX +XXX,XX @@ static void versal_create_apu_cpus(Versal *s) | 31 | static void led_reset(DeviceState *dev) |
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 | -- | 32 | -- |
36 | 2.20.1 | 33 | 2.34.1 |
37 | 34 | ||
38 | 35 | diff view generated by jsdifflib |
1 | From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com> | 1 | From: Luc Michel <luc.michel@amd.com> |
---|---|---|---|
2 | 2 | ||
3 | Embed the GEMs into the SoC type. | 3 | Replace register defines with the REG32 macro from registerfields.h in |
4 | the Cadence GEM device. | ||
4 | 5 | ||
5 | Suggested-by: Peter Maydell <peter.maydell@linaro.org> | 6 | Signed-off-by: Luc Michel <luc.michel@amd.com> |
6 | Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | 7 | Reviewed-by: sai.pavan.boddu@amd.com |
7 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | 8 | Message-id: 20231017194422.4124691-2-luc.michel@amd.com |
8 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
9 | Reviewed-by: Luc Michel <luc.michel@greensocs.com> | ||
10 | Message-id: 20200427181649.26851-6-edgar.iglesias@gmail.com | ||
11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
12 | --- | 10 | --- |
13 | include/hw/arm/xlnx-versal.h | 3 ++- | 11 | hw/net/cadence_gem.c | 527 +++++++++++++++++++++---------------------- |
14 | hw/arm/xlnx-versal.c | 15 ++++++++------- | 12 | 1 file changed, 261 insertions(+), 266 deletions(-) |
15 | 2 files changed, 10 insertions(+), 8 deletions(-) | ||
16 | 13 | ||
17 | diff --git a/include/hw/arm/xlnx-versal.h b/include/hw/arm/xlnx-versal.h | 14 | diff --git a/hw/net/cadence_gem.c b/hw/net/cadence_gem.c |
18 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
19 | --- a/include/hw/arm/xlnx-versal.h | 16 | --- a/hw/net/cadence_gem.c |
20 | +++ b/include/hw/arm/xlnx-versal.h | 17 | +++ b/hw/net/cadence_gem.c |
21 | @@ -XXX,XX +XXX,XX @@ | 18 | @@ -XXX,XX +XXX,XX @@ |
22 | #include "hw/arm/boot.h" | 19 | #include "hw/irq.h" |
23 | #include "hw/intc/arm_gicv3.h" | 20 | #include "hw/net/cadence_gem.h" |
24 | #include "hw/char/pl011.h" | 21 | #include "hw/qdev-properties.h" |
25 | +#include "hw/net/cadence_gem.h" | 22 | +#include "hw/registerfields.h" |
26 | 23 | #include "migration/vmstate.h" | |
27 | #define TYPE_XLNX_VERSAL "xlnx-versal" | 24 | #include "qapi/error.h" |
28 | #define XLNX_VERSAL(obj) OBJECT_CHECK(Versal, (obj), TYPE_XLNX_VERSAL) | 25 | #include "qemu/log.h" |
29 | @@ -XXX,XX +XXX,XX @@ typedef struct Versal { | 26 | @@ -XXX,XX +XXX,XX @@ |
30 | 27 | } \ | |
31 | struct { | 28 | } while (0) |
32 | PL011State uart[XLNX_VERSAL_NR_UARTS]; | 29 | |
33 | - SysBusDevice *gem[XLNX_VERSAL_NR_GEMS]; | 30 | -#define GEM_NWCTRL (0x00000000 / 4) /* Network Control reg */ |
34 | + CadenceGEMState gem[XLNX_VERSAL_NR_GEMS]; | 31 | -#define GEM_NWCFG (0x00000004 / 4) /* Network Config reg */ |
35 | SysBusDevice *adma[XLNX_VERSAL_NR_ADMAS]; | 32 | -#define GEM_NWSTATUS (0x00000008 / 4) /* Network Status reg */ |
36 | } iou; | 33 | -#define GEM_USERIO (0x0000000C / 4) /* User IO reg */ |
37 | } lpd; | 34 | -#define GEM_DMACFG (0x00000010 / 4) /* DMA Control reg */ |
38 | diff --git a/hw/arm/xlnx-versal.c b/hw/arm/xlnx-versal.c | 35 | -#define GEM_TXSTATUS (0x00000014 / 4) /* TX Status reg */ |
39 | index XXXXXXX..XXXXXXX 100644 | 36 | -#define GEM_RXQBASE (0x00000018 / 4) /* RX Q Base address reg */ |
40 | --- a/hw/arm/xlnx-versal.c | 37 | -#define GEM_TXQBASE (0x0000001C / 4) /* TX Q Base address reg */ |
41 | +++ b/hw/arm/xlnx-versal.c | 38 | -#define GEM_RXSTATUS (0x00000020 / 4) /* RX Status reg */ |
42 | @@ -XXX,XX +XXX,XX @@ static void versal_create_gems(Versal *s, qemu_irq *pic) | 39 | -#define GEM_ISR (0x00000024 / 4) /* Interrupt Status reg */ |
43 | DeviceState *dev; | 40 | -#define GEM_IER (0x00000028 / 4) /* Interrupt Enable reg */ |
44 | MemoryRegion *mr; | 41 | -#define GEM_IDR (0x0000002C / 4) /* Interrupt Disable reg */ |
45 | 42 | -#define GEM_IMR (0x00000030 / 4) /* Interrupt Mask reg */ | |
46 | - dev = qdev_create(NULL, "cadence_gem"); | 43 | -#define GEM_PHYMNTNC (0x00000034 / 4) /* Phy Maintenance reg */ |
47 | - s->lpd.iou.gem[i] = SYS_BUS_DEVICE(dev); | 44 | -#define GEM_RXPAUSE (0x00000038 / 4) /* RX Pause Time reg */ |
48 | - object_property_add_child(OBJECT(s), name, OBJECT(dev), &error_fatal); | 45 | -#define GEM_TXPAUSE (0x0000003C / 4) /* TX Pause Time reg */ |
49 | + sysbus_init_child_obj(OBJECT(s), name, | 46 | -#define GEM_TXPARTIALSF (0x00000040 / 4) /* TX Partial Store and Forward */ |
50 | + &s->lpd.iou.gem[i], sizeof(s->lpd.iou.gem[i]), | 47 | -#define GEM_RXPARTIALSF (0x00000044 / 4) /* RX Partial Store and Forward */ |
51 | + TYPE_CADENCE_GEM); | 48 | -#define GEM_JUMBO_MAX_LEN (0x00000048 / 4) /* Max Jumbo Frame Size */ |
52 | + dev = DEVICE(&s->lpd.iou.gem[i]); | 49 | -#define GEM_HASHLO (0x00000080 / 4) /* Hash Low address reg */ |
53 | if (nd->used) { | 50 | -#define GEM_HASHHI (0x00000084 / 4) /* Hash High address reg */ |
54 | qemu_check_nic_model(nd, "cadence_gem"); | 51 | -#define GEM_SPADDR1LO (0x00000088 / 4) /* Specific addr 1 low reg */ |
55 | qdev_set_nic_properties(dev, nd); | 52 | -#define GEM_SPADDR1HI (0x0000008C / 4) /* Specific addr 1 high reg */ |
53 | -#define GEM_SPADDR2LO (0x00000090 / 4) /* Specific addr 2 low reg */ | ||
54 | -#define GEM_SPADDR2HI (0x00000094 / 4) /* Specific addr 2 high reg */ | ||
55 | -#define GEM_SPADDR3LO (0x00000098 / 4) /* Specific addr 3 low reg */ | ||
56 | -#define GEM_SPADDR3HI (0x0000009C / 4) /* Specific addr 3 high reg */ | ||
57 | -#define GEM_SPADDR4LO (0x000000A0 / 4) /* Specific addr 4 low reg */ | ||
58 | -#define GEM_SPADDR4HI (0x000000A4 / 4) /* Specific addr 4 high reg */ | ||
59 | -#define GEM_TIDMATCH1 (0x000000A8 / 4) /* Type ID1 Match reg */ | ||
60 | -#define GEM_TIDMATCH2 (0x000000AC / 4) /* Type ID2 Match reg */ | ||
61 | -#define GEM_TIDMATCH3 (0x000000B0 / 4) /* Type ID3 Match reg */ | ||
62 | -#define GEM_TIDMATCH4 (0x000000B4 / 4) /* Type ID4 Match reg */ | ||
63 | -#define GEM_WOLAN (0x000000B8 / 4) /* Wake on LAN reg */ | ||
64 | -#define GEM_IPGSTRETCH (0x000000BC / 4) /* IPG Stretch reg */ | ||
65 | -#define GEM_SVLAN (0x000000C0 / 4) /* Stacked VLAN reg */ | ||
66 | -#define GEM_MODID (0x000000FC / 4) /* Module ID reg */ | ||
67 | -#define GEM_OCTTXLO (0x00000100 / 4) /* Octets transmitted Low reg */ | ||
68 | -#define GEM_OCTTXHI (0x00000104 / 4) /* Octets transmitted High reg */ | ||
69 | -#define GEM_TXCNT (0x00000108 / 4) /* Error-free Frames transmitted */ | ||
70 | -#define GEM_TXBCNT (0x0000010C / 4) /* Error-free Broadcast Frames */ | ||
71 | -#define GEM_TXMCNT (0x00000110 / 4) /* Error-free Multicast Frame */ | ||
72 | -#define GEM_TXPAUSECNT (0x00000114 / 4) /* Pause Frames Transmitted */ | ||
73 | -#define GEM_TX64CNT (0x00000118 / 4) /* Error-free 64 TX */ | ||
74 | -#define GEM_TX65CNT (0x0000011C / 4) /* Error-free 65-127 TX */ | ||
75 | -#define GEM_TX128CNT (0x00000120 / 4) /* Error-free 128-255 TX */ | ||
76 | -#define GEM_TX256CNT (0x00000124 / 4) /* Error-free 256-511 */ | ||
77 | -#define GEM_TX512CNT (0x00000128 / 4) /* Error-free 512-1023 TX */ | ||
78 | -#define GEM_TX1024CNT (0x0000012C / 4) /* Error-free 1024-1518 TX */ | ||
79 | -#define GEM_TX1519CNT (0x00000130 / 4) /* Error-free larger than 1519 TX */ | ||
80 | -#define GEM_TXURUNCNT (0x00000134 / 4) /* TX under run error counter */ | ||
81 | -#define GEM_SINGLECOLLCNT (0x00000138 / 4) /* Single Collision Frames */ | ||
82 | -#define GEM_MULTCOLLCNT (0x0000013C / 4) /* Multiple Collision Frames */ | ||
83 | -#define GEM_EXCESSCOLLCNT (0x00000140 / 4) /* Excessive Collision Frames */ | ||
84 | -#define GEM_LATECOLLCNT (0x00000144 / 4) /* Late Collision Frames */ | ||
85 | -#define GEM_DEFERTXCNT (0x00000148 / 4) /* Deferred Transmission Frames */ | ||
86 | -#define GEM_CSENSECNT (0x0000014C / 4) /* Carrier Sense Error Counter */ | ||
87 | -#define GEM_OCTRXLO (0x00000150 / 4) /* Octets Received register Low */ | ||
88 | -#define GEM_OCTRXHI (0x00000154 / 4) /* Octets Received register High */ | ||
89 | -#define GEM_RXCNT (0x00000158 / 4) /* Error-free Frames Received */ | ||
90 | -#define GEM_RXBROADCNT (0x0000015C / 4) /* Error-free Broadcast Frames RX */ | ||
91 | -#define GEM_RXMULTICNT (0x00000160 / 4) /* Error-free Multicast Frames RX */ | ||
92 | -#define GEM_RXPAUSECNT (0x00000164 / 4) /* Pause Frames Received Counter */ | ||
93 | -#define GEM_RX64CNT (0x00000168 / 4) /* Error-free 64 byte Frames RX */ | ||
94 | -#define GEM_RX65CNT (0x0000016C / 4) /* Error-free 65-127B Frames RX */ | ||
95 | -#define GEM_RX128CNT (0x00000170 / 4) /* Error-free 128-255B Frames RX */ | ||
96 | -#define GEM_RX256CNT (0x00000174 / 4) /* Error-free 256-512B Frames RX */ | ||
97 | -#define GEM_RX512CNT (0x00000178 / 4) /* Error-free 512-1023B Frames RX */ | ||
98 | -#define GEM_RX1024CNT (0x0000017C / 4) /* Error-free 1024-1518B Frames RX */ | ||
99 | -#define GEM_RX1519CNT (0x00000180 / 4) /* Error-free 1519-max Frames RX */ | ||
100 | -#define GEM_RXUNDERCNT (0x00000184 / 4) /* Undersize Frames Received */ | ||
101 | -#define GEM_RXOVERCNT (0x00000188 / 4) /* Oversize Frames Received */ | ||
102 | -#define GEM_RXJABCNT (0x0000018C / 4) /* Jabbers Received Counter */ | ||
103 | -#define GEM_RXFCSCNT (0x00000190 / 4) /* Frame Check seq. Error Counter */ | ||
104 | -#define GEM_RXLENERRCNT (0x00000194 / 4) /* Length Field Error Counter */ | ||
105 | -#define GEM_RXSYMERRCNT (0x00000198 / 4) /* Symbol Error Counter */ | ||
106 | -#define GEM_RXALIGNERRCNT (0x0000019C / 4) /* Alignment Error Counter */ | ||
107 | -#define GEM_RXRSCERRCNT (0x000001A0 / 4) /* Receive Resource Error Counter */ | ||
108 | -#define GEM_RXORUNCNT (0x000001A4 / 4) /* Receive Overrun Counter */ | ||
109 | -#define GEM_RXIPCSERRCNT (0x000001A8 / 4) /* IP header Checksum Err Counter */ | ||
110 | -#define GEM_RXTCPCCNT (0x000001AC / 4) /* TCP Checksum Error Counter */ | ||
111 | -#define GEM_RXUDPCCNT (0x000001B0 / 4) /* UDP Checksum Error Counter */ | ||
112 | +REG32(NWCTRL, 0x0) /* Network Control reg */ | ||
113 | +REG32(NWCFG, 0x4) /* Network Config reg */ | ||
114 | +REG32(NWSTATUS, 0x8) /* Network Status reg */ | ||
115 | +REG32(USERIO, 0xc) /* User IO reg */ | ||
116 | +REG32(DMACFG, 0x10) /* DMA Control reg */ | ||
117 | +REG32(TXSTATUS, 0x14) /* TX Status reg */ | ||
118 | +REG32(RXQBASE, 0x18) /* RX Q Base address reg */ | ||
119 | +REG32(TXQBASE, 0x1c) /* TX Q Base address reg */ | ||
120 | +REG32(RXSTATUS, 0x20) /* RX Status reg */ | ||
121 | +REG32(ISR, 0x24) /* Interrupt Status reg */ | ||
122 | +REG32(IER, 0x28) /* Interrupt Enable reg */ | ||
123 | +REG32(IDR, 0x2c) /* Interrupt Disable reg */ | ||
124 | +REG32(IMR, 0x30) /* Interrupt Mask reg */ | ||
125 | +REG32(PHYMNTNC, 0x34) /* Phy Maintenance reg */ | ||
126 | +REG32(RXPAUSE, 0x38) /* RX Pause Time reg */ | ||
127 | +REG32(TXPAUSE, 0x3c) /* TX Pause Time reg */ | ||
128 | +REG32(TXPARTIALSF, 0x40) /* TX Partial Store and Forward */ | ||
129 | +REG32(RXPARTIALSF, 0x44) /* RX Partial Store and Forward */ | ||
130 | +REG32(JUMBO_MAX_LEN, 0x48) /* Max Jumbo Frame Size */ | ||
131 | +REG32(HASHLO, 0x80) /* Hash Low address reg */ | ||
132 | +REG32(HASHHI, 0x84) /* Hash High address reg */ | ||
133 | +REG32(SPADDR1LO, 0x88) /* Specific addr 1 low reg */ | ||
134 | +REG32(SPADDR1HI, 0x8c) /* Specific addr 1 high reg */ | ||
135 | +REG32(SPADDR2LO, 0x90) /* Specific addr 2 low reg */ | ||
136 | +REG32(SPADDR2HI, 0x94) /* Specific addr 2 high reg */ | ||
137 | +REG32(SPADDR3LO, 0x98) /* Specific addr 3 low reg */ | ||
138 | +REG32(SPADDR3HI, 0x9c) /* Specific addr 3 high reg */ | ||
139 | +REG32(SPADDR4LO, 0xa0) /* Specific addr 4 low reg */ | ||
140 | +REG32(SPADDR4HI, 0xa4) /* Specific addr 4 high reg */ | ||
141 | +REG32(TIDMATCH1, 0xa8) /* Type ID1 Match reg */ | ||
142 | +REG32(TIDMATCH2, 0xac) /* Type ID2 Match reg */ | ||
143 | +REG32(TIDMATCH3, 0xb0) /* Type ID3 Match reg */ | ||
144 | +REG32(TIDMATCH4, 0xb4) /* Type ID4 Match reg */ | ||
145 | +REG32(WOLAN, 0xb8) /* Wake on LAN reg */ | ||
146 | +REG32(IPGSTRETCH, 0xbc) /* IPG Stretch reg */ | ||
147 | +REG32(SVLAN, 0xc0) /* Stacked VLAN reg */ | ||
148 | +REG32(MODID, 0xfc) /* Module ID reg */ | ||
149 | +REG32(OCTTXLO, 0x100) /* Octects transmitted Low reg */ | ||
150 | +REG32(OCTTXHI, 0x104) /* Octects transmitted High reg */ | ||
151 | +REG32(TXCNT, 0x108) /* Error-free Frames transmitted */ | ||
152 | +REG32(TXBCNT, 0x10c) /* Error-free Broadcast Frames */ | ||
153 | +REG32(TXMCNT, 0x110) /* Error-free Multicast Frame */ | ||
154 | +REG32(TXPAUSECNT, 0x114) /* Pause Frames Transmitted */ | ||
155 | +REG32(TX64CNT, 0x118) /* Error-free 64 TX */ | ||
156 | +REG32(TX65CNT, 0x11c) /* Error-free 65-127 TX */ | ||
157 | +REG32(TX128CNT, 0x120) /* Error-free 128-255 TX */ | ||
158 | +REG32(TX256CNT, 0x124) /* Error-free 256-511 */ | ||
159 | +REG32(TX512CNT, 0x128) /* Error-free 512-1023 TX */ | ||
160 | +REG32(TX1024CNT, 0x12c) /* Error-free 1024-1518 TX */ | ||
161 | +REG32(TX1519CNT, 0x130) /* Error-free larger than 1519 TX */ | ||
162 | +REG32(TXURUNCNT, 0x134) /* TX under run error counter */ | ||
163 | +REG32(SINGLECOLLCNT, 0x138) /* Single Collision Frames */ | ||
164 | +REG32(MULTCOLLCNT, 0x13c) /* Multiple Collision Frames */ | ||
165 | +REG32(EXCESSCOLLCNT, 0x140) /* Excessive Collision Frames */ | ||
166 | +REG32(LATECOLLCNT, 0x144) /* Late Collision Frames */ | ||
167 | +REG32(DEFERTXCNT, 0x148) /* Deferred Transmission Frames */ | ||
168 | +REG32(CSENSECNT, 0x14c) /* Carrier Sense Error Counter */ | ||
169 | +REG32(OCTRXLO, 0x150) /* Octects Received register Low */ | ||
170 | +REG32(OCTRXHI, 0x154) /* Octects Received register High */ | ||
171 | +REG32(RXCNT, 0x158) /* Error-free Frames Received */ | ||
172 | +REG32(RXBROADCNT, 0x15c) /* Error-free Broadcast Frames RX */ | ||
173 | +REG32(RXMULTICNT, 0x160) /* Error-free Multicast Frames RX */ | ||
174 | +REG32(RXPAUSECNT, 0x164) /* Pause Frames Received Counter */ | ||
175 | +REG32(RX64CNT, 0x168) /* Error-free 64 byte Frames RX */ | ||
176 | +REG32(RX65CNT, 0x16c) /* Error-free 65-127B Frames RX */ | ||
177 | +REG32(RX128CNT, 0x170) /* Error-free 128-255B Frames RX */ | ||
178 | +REG32(RX256CNT, 0x174) /* Error-free 256-512B Frames RX */ | ||
179 | +REG32(RX512CNT, 0x178) /* Error-free 512-1023B Frames RX */ | ||
180 | +REG32(RX1024CNT, 0x17c) /* Error-free 1024-1518B Frames RX */ | ||
181 | +REG32(RX1519CNT, 0x180) /* Error-free 1519-max Frames RX */ | ||
182 | +REG32(RXUNDERCNT, 0x184) /* Undersize Frames Received */ | ||
183 | +REG32(RXOVERCNT, 0x188) /* Oversize Frames Received */ | ||
184 | +REG32(RXJABCNT, 0x18c) /* Jabbers Received Counter */ | ||
185 | +REG32(RXFCSCNT, 0x190) /* Frame Check seq. Error Counter */ | ||
186 | +REG32(RXLENERRCNT, 0x194) /* Length Field Error Counter */ | ||
187 | +REG32(RXSYMERRCNT, 0x198) /* Symbol Error Counter */ | ||
188 | +REG32(RXALIGNERRCNT, 0x19c) /* Alignment Error Counter */ | ||
189 | +REG32(RXRSCERRCNT, 0x1a0) /* Receive Resource Error Counter */ | ||
190 | +REG32(RXORUNCNT, 0x1a4) /* Receive Overrun Counter */ | ||
191 | +REG32(RXIPCSERRCNT, 0x1a8) /* IP header Checksum Err Counter */ | ||
192 | +REG32(RXTCPCCNT, 0x1ac) /* TCP Checksum Error Counter */ | ||
193 | +REG32(RXUDPCCNT, 0x1b0) /* UDP Checksum Error Counter */ | ||
194 | |||
195 | -#define GEM_1588S (0x000001D0 / 4) /* 1588 Timer Seconds */ | ||
196 | -#define GEM_1588NS (0x000001D4 / 4) /* 1588 Timer Nanoseconds */ | ||
197 | -#define GEM_1588ADJ (0x000001D8 / 4) /* 1588 Timer Adjust */ | ||
198 | -#define GEM_1588INC (0x000001DC / 4) /* 1588 Timer Increment */ | ||
199 | -#define GEM_PTPETXS (0x000001E0 / 4) /* PTP Event Frame Transmitted (s) */ | ||
200 | -#define GEM_PTPETXNS (0x000001E4 / 4) /* | ||
201 | - * PTP Event Frame Transmitted (ns) | ||
202 | - */ | ||
203 | -#define GEM_PTPERXS (0x000001E8 / 4) /* PTP Event Frame Received (s) */ | ||
204 | -#define GEM_PTPERXNS (0x000001EC / 4) /* PTP Event Frame Received (ns) */ | ||
205 | -#define GEM_PTPPTXS (0x000001E0 / 4) /* PTP Peer Frame Transmitted (s) */ | ||
206 | -#define GEM_PTPPTXNS (0x000001E4 / 4) /* PTP Peer Frame Transmitted (ns) */ | ||
207 | -#define GEM_PTPPRXS (0x000001E8 / 4) /* PTP Peer Frame Received (s) */ | ||
208 | -#define GEM_PTPPRXNS (0x000001EC / 4) /* PTP Peer Frame Received (ns) */ | ||
209 | +REG32(1588S, 0x1d0) /* 1588 Timer Seconds */ | ||
210 | +REG32(1588NS, 0x1d4) /* 1588 Timer Nanoseconds */ | ||
211 | +REG32(1588ADJ, 0x1d8) /* 1588 Timer Adjust */ | ||
212 | +REG32(1588INC, 0x1dc) /* 1588 Timer Increment */ | ||
213 | +REG32(PTPETXS, 0x1e0) /* PTP Event Frame Transmitted (s) */ | ||
214 | +REG32(PTPETXNS, 0x1e4) /* PTP Event Frame Transmitted (ns) */ | ||
215 | +REG32(PTPERXS, 0x1e8) /* PTP Event Frame Received (s) */ | ||
216 | +REG32(PTPERXNS, 0x1ec) /* PTP Event Frame Received (ns) */ | ||
217 | +REG32(PTPPTXS, 0x1e0) /* PTP Peer Frame Transmitted (s) */ | ||
218 | +REG32(PTPPTXNS, 0x1e4) /* PTP Peer Frame Transmitted (ns) */ | ||
219 | +REG32(PTPPRXS, 0x1e8) /* PTP Peer Frame Received (s) */ | ||
220 | +REG32(PTPPRXNS, 0x1ec) /* PTP Peer Frame Received (ns) */ | ||
221 | |||
222 | /* Design Configuration Registers */ | ||
223 | -#define GEM_DESCONF (0x00000280 / 4) | ||
224 | -#define GEM_DESCONF2 (0x00000284 / 4) | ||
225 | -#define GEM_DESCONF3 (0x00000288 / 4) | ||
226 | -#define GEM_DESCONF4 (0x0000028C / 4) | ||
227 | -#define GEM_DESCONF5 (0x00000290 / 4) | ||
228 | -#define GEM_DESCONF6 (0x00000294 / 4) | ||
229 | +REG32(DESCONF, 0x280) | ||
230 | +REG32(DESCONF2, 0x284) | ||
231 | +REG32(DESCONF3, 0x288) | ||
232 | +REG32(DESCONF4, 0x28c) | ||
233 | +REG32(DESCONF5, 0x290) | ||
234 | +REG32(DESCONF6, 0x294) | ||
235 | #define GEM_DESCONF6_64B_MASK (1U << 23) | ||
236 | -#define GEM_DESCONF7 (0x00000298 / 4) | ||
237 | +REG32(DESCONF7, 0x298) | ||
238 | |||
239 | -#define GEM_INT_Q1_STATUS (0x00000400 / 4) | ||
240 | -#define GEM_INT_Q1_MASK (0x00000640 / 4) | ||
241 | +REG32(INT_Q1_STATUS, 0x400) | ||
242 | +REG32(INT_Q1_MASK, 0x640) | ||
243 | |||
244 | -#define GEM_TRANSMIT_Q1_PTR (0x00000440 / 4) | ||
245 | -#define GEM_TRANSMIT_Q7_PTR (GEM_TRANSMIT_Q1_PTR + 6) | ||
246 | +REG32(TRANSMIT_Q1_PTR, 0x440) | ||
247 | +REG32(TRANSMIT_Q7_PTR, 0x458) | ||
248 | |||
249 | -#define GEM_RECEIVE_Q1_PTR (0x00000480 / 4) | ||
250 | -#define GEM_RECEIVE_Q7_PTR (GEM_RECEIVE_Q1_PTR + 6) | ||
251 | +REG32(RECEIVE_Q1_PTR, 0x480) | ||
252 | +REG32(RECEIVE_Q7_PTR, 0x498) | ||
253 | |||
254 | -#define GEM_TBQPH (0x000004C8 / 4) | ||
255 | -#define GEM_RBQPH (0x000004D4 / 4) | ||
256 | +REG32(TBQPH, 0x4c8) | ||
257 | +REG32(RBQPH, 0x4d4) | ||
258 | |||
259 | -#define GEM_INT_Q1_ENABLE (0x00000600 / 4) | ||
260 | -#define GEM_INT_Q7_ENABLE (GEM_INT_Q1_ENABLE + 6) | ||
261 | +REG32(INT_Q1_ENABLE, 0x600) | ||
262 | +REG32(INT_Q7_ENABLE, 0x618) | ||
263 | |||
264 | -#define GEM_INT_Q1_DISABLE (0x00000620 / 4) | ||
265 | -#define GEM_INT_Q7_DISABLE (GEM_INT_Q1_DISABLE + 6) | ||
266 | +REG32(INT_Q1_DISABLE, 0x620) | ||
267 | +REG32(INT_Q7_DISABLE, 0x638) | ||
268 | |||
269 | -#define GEM_INT_Q1_MASK (0x00000640 / 4) | ||
270 | -#define GEM_INT_Q7_MASK (GEM_INT_Q1_MASK + 6) | ||
271 | - | ||
272 | -#define GEM_SCREENING_TYPE1_REGISTER_0 (0x00000500 / 4) | ||
273 | +REG32(SCREENING_TYPE1_REG0, 0x500) | ||
274 | |||
275 | #define GEM_ST1R_UDP_PORT_MATCH_ENABLE (1 << 29) | ||
276 | #define GEM_ST1R_DSTC_ENABLE (1 << 28) | ||
277 | @@ -XXX,XX +XXX,XX @@ | ||
278 | #define GEM_ST1R_QUEUE_SHIFT (0) | ||
279 | #define GEM_ST1R_QUEUE_WIDTH (3 - GEM_ST1R_QUEUE_SHIFT + 1) | ||
280 | |||
281 | -#define GEM_SCREENING_TYPE2_REGISTER_0 (0x00000540 / 4) | ||
282 | +REG32(SCREENING_TYPE2_REG0, 0x540) | ||
283 | |||
284 | #define GEM_ST2R_COMPARE_A_ENABLE (1 << 18) | ||
285 | #define GEM_ST2R_COMPARE_A_SHIFT (13) | ||
286 | @@ -XXX,XX +XXX,XX @@ | ||
287 | #define GEM_ST2R_QUEUE_SHIFT (0) | ||
288 | #define GEM_ST2R_QUEUE_WIDTH (3 - GEM_ST2R_QUEUE_SHIFT + 1) | ||
289 | |||
290 | -#define GEM_SCREENING_TYPE2_ETHERTYPE_REG_0 (0x000006e0 / 4) | ||
291 | -#define GEM_TYPE2_COMPARE_0_WORD_0 (0x00000700 / 4) | ||
292 | +REG32(SCREENING_TYPE2_ETHERTYPE_REG0, 0x6e0) | ||
293 | +REG32(TYPE2_COMPARE_0_WORD_0, 0x700) | ||
294 | |||
295 | #define GEM_T2CW1_COMPARE_OFFSET_SHIFT (7) | ||
296 | #define GEM_T2CW1_COMPARE_OFFSET_WIDTH (8 - GEM_T2CW1_COMPARE_OFFSET_SHIFT + 1) | ||
297 | @@ -XXX,XX +XXX,XX @@ static inline uint64_t tx_desc_get_buffer(CadenceGEMState *s, uint32_t *desc) | ||
298 | { | ||
299 | uint64_t ret = desc[0]; | ||
300 | |||
301 | - if (s->regs[GEM_DMACFG] & GEM_DMACFG_ADDR_64B) { | ||
302 | + if (s->regs[R_DMACFG] & GEM_DMACFG_ADDR_64B) { | ||
303 | ret |= (uint64_t)desc[2] << 32; | ||
304 | } | ||
305 | return ret; | ||
306 | @@ -XXX,XX +XXX,XX @@ static inline uint64_t rx_desc_get_buffer(CadenceGEMState *s, uint32_t *desc) | ||
307 | { | ||
308 | uint64_t ret = desc[0] & ~0x3UL; | ||
309 | |||
310 | - if (s->regs[GEM_DMACFG] & GEM_DMACFG_ADDR_64B) { | ||
311 | + if (s->regs[R_DMACFG] & GEM_DMACFG_ADDR_64B) { | ||
312 | ret |= (uint64_t)desc[2] << 32; | ||
313 | } | ||
314 | return ret; | ||
315 | @@ -XXX,XX +XXX,XX @@ static inline int gem_get_desc_len(CadenceGEMState *s, bool rx_n_tx) | ||
316 | { | ||
317 | int ret = 2; | ||
318 | |||
319 | - if (s->regs[GEM_DMACFG] & GEM_DMACFG_ADDR_64B) { | ||
320 | + if (s->regs[R_DMACFG] & GEM_DMACFG_ADDR_64B) { | ||
321 | ret += 2; | ||
322 | } | ||
323 | - if (s->regs[GEM_DMACFG] & (rx_n_tx ? GEM_DMACFG_RX_BD_EXT | ||
324 | + if (s->regs[R_DMACFG] & (rx_n_tx ? GEM_DMACFG_RX_BD_EXT | ||
325 | : GEM_DMACFG_TX_BD_EXT)) { | ||
326 | ret += 2; | ||
327 | } | ||
328 | @@ -XXX,XX +XXX,XX @@ static const uint8_t broadcast_addr[] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; | ||
329 | static uint32_t gem_get_max_buf_len(CadenceGEMState *s, bool tx) | ||
330 | { | ||
331 | uint32_t size; | ||
332 | - if (s->regs[GEM_NWCFG] & GEM_NWCFG_JUMBO_FRAME) { | ||
333 | - size = s->regs[GEM_JUMBO_MAX_LEN]; | ||
334 | + if (s->regs[R_NWCFG] & GEM_NWCFG_JUMBO_FRAME) { | ||
335 | + size = s->regs[R_JUMBO_MAX_LEN]; | ||
336 | if (size > s->jumbo_max_len) { | ||
337 | size = s->jumbo_max_len; | ||
338 | qemu_log_mask(LOG_GUEST_ERROR, "GEM_JUMBO_MAX_LEN reg cannot be" | ||
339 | @@ -XXX,XX +XXX,XX @@ static uint32_t gem_get_max_buf_len(CadenceGEMState *s, bool tx) | ||
340 | } else if (tx) { | ||
341 | size = 1518; | ||
342 | } else { | ||
343 | - size = s->regs[GEM_NWCFG] & GEM_NWCFG_RCV_1538 ? 1538 : 1518; | ||
344 | + size = s->regs[R_NWCFG] & GEM_NWCFG_RCV_1538 ? 1538 : 1518; | ||
345 | } | ||
346 | return size; | ||
347 | } | ||
348 | @@ -XXX,XX +XXX,XX @@ static uint32_t gem_get_max_buf_len(CadenceGEMState *s, bool tx) | ||
349 | static void gem_set_isr(CadenceGEMState *s, int q, uint32_t flag) | ||
350 | { | ||
351 | if (q == 0) { | ||
352 | - s->regs[GEM_ISR] |= flag & ~(s->regs[GEM_IMR]); | ||
353 | + s->regs[R_ISR] |= flag & ~(s->regs[R_IMR]); | ||
354 | } else { | ||
355 | - s->regs[GEM_INT_Q1_STATUS + q - 1] |= flag & | ||
356 | - ~(s->regs[GEM_INT_Q1_MASK + q - 1]); | ||
357 | + s->regs[R_INT_Q1_STATUS + q - 1] |= flag & | ||
358 | + ~(s->regs[R_INT_Q1_MASK + q - 1]); | ||
359 | } | ||
360 | } | ||
361 | |||
362 | @@ -XXX,XX +XXX,XX @@ static void gem_init_register_masks(CadenceGEMState *s) | ||
363 | unsigned int i; | ||
364 | /* Mask of register bits which are read only */ | ||
365 | memset(&s->regs_ro[0], 0, sizeof(s->regs_ro)); | ||
366 | - s->regs_ro[GEM_NWCTRL] = 0xFFF80000; | ||
367 | - s->regs_ro[GEM_NWSTATUS] = 0xFFFFFFFF; | ||
368 | - s->regs_ro[GEM_DMACFG] = 0x8E00F000; | ||
369 | - s->regs_ro[GEM_TXSTATUS] = 0xFFFFFE08; | ||
370 | - s->regs_ro[GEM_RXQBASE] = 0x00000003; | ||
371 | - s->regs_ro[GEM_TXQBASE] = 0x00000003; | ||
372 | - s->regs_ro[GEM_RXSTATUS] = 0xFFFFFFF0; | ||
373 | - s->regs_ro[GEM_ISR] = 0xFFFFFFFF; | ||
374 | - s->regs_ro[GEM_IMR] = 0xFFFFFFFF; | ||
375 | - s->regs_ro[GEM_MODID] = 0xFFFFFFFF; | ||
376 | + s->regs_ro[R_NWCTRL] = 0xFFF80000; | ||
377 | + s->regs_ro[R_NWSTATUS] = 0xFFFFFFFF; | ||
378 | + s->regs_ro[R_DMACFG] = 0x8E00F000; | ||
379 | + s->regs_ro[R_TXSTATUS] = 0xFFFFFE08; | ||
380 | + s->regs_ro[R_RXQBASE] = 0x00000003; | ||
381 | + s->regs_ro[R_TXQBASE] = 0x00000003; | ||
382 | + s->regs_ro[R_RXSTATUS] = 0xFFFFFFF0; | ||
383 | + s->regs_ro[R_ISR] = 0xFFFFFFFF; | ||
384 | + s->regs_ro[R_IMR] = 0xFFFFFFFF; | ||
385 | + s->regs_ro[R_MODID] = 0xFFFFFFFF; | ||
386 | for (i = 0; i < s->num_priority_queues; i++) { | ||
387 | - s->regs_ro[GEM_INT_Q1_STATUS + i] = 0xFFFFFFFF; | ||
388 | - s->regs_ro[GEM_INT_Q1_ENABLE + i] = 0xFFFFF319; | ||
389 | - s->regs_ro[GEM_INT_Q1_DISABLE + i] = 0xFFFFF319; | ||
390 | - s->regs_ro[GEM_INT_Q1_MASK + i] = 0xFFFFFFFF; | ||
391 | + s->regs_ro[R_INT_Q1_STATUS + i] = 0xFFFFFFFF; | ||
392 | + s->regs_ro[R_INT_Q1_ENABLE + i] = 0xFFFFF319; | ||
393 | + s->regs_ro[R_INT_Q1_DISABLE + i] = 0xFFFFF319; | ||
394 | + s->regs_ro[R_INT_Q1_MASK + i] = 0xFFFFFFFF; | ||
395 | } | ||
396 | |||
397 | /* Mask of register bits which are clear on read */ | ||
398 | memset(&s->regs_rtc[0], 0, sizeof(s->regs_rtc)); | ||
399 | - s->regs_rtc[GEM_ISR] = 0xFFFFFFFF; | ||
400 | + s->regs_rtc[R_ISR] = 0xFFFFFFFF; | ||
401 | for (i = 0; i < s->num_priority_queues; i++) { | ||
402 | - s->regs_rtc[GEM_INT_Q1_STATUS + i] = 0x00000CE6; | ||
403 | + s->regs_rtc[R_INT_Q1_STATUS + i] = 0x00000CE6; | ||
404 | } | ||
405 | |||
406 | /* Mask of register bits which are write 1 to clear */ | ||
407 | memset(&s->regs_w1c[0], 0, sizeof(s->regs_w1c)); | ||
408 | - s->regs_w1c[GEM_TXSTATUS] = 0x000001F7; | ||
409 | - s->regs_w1c[GEM_RXSTATUS] = 0x0000000F; | ||
410 | + s->regs_w1c[R_TXSTATUS] = 0x000001F7; | ||
411 | + s->regs_w1c[R_RXSTATUS] = 0x0000000F; | ||
412 | |||
413 | /* Mask of register bits which are write only */ | ||
414 | memset(&s->regs_wo[0], 0, sizeof(s->regs_wo)); | ||
415 | - s->regs_wo[GEM_NWCTRL] = 0x00073E60; | ||
416 | - s->regs_wo[GEM_IER] = 0x07FFFFFF; | ||
417 | - s->regs_wo[GEM_IDR] = 0x07FFFFFF; | ||
418 | + s->regs_wo[R_NWCTRL] = 0x00073E60; | ||
419 | + s->regs_wo[R_IER] = 0x07FFFFFF; | ||
420 | + s->regs_wo[R_IDR] = 0x07FFFFFF; | ||
421 | for (i = 0; i < s->num_priority_queues; i++) { | ||
422 | - s->regs_wo[GEM_INT_Q1_ENABLE + i] = 0x00000CE6; | ||
423 | - s->regs_wo[GEM_INT_Q1_DISABLE + i] = 0x00000CE6; | ||
424 | + s->regs_wo[R_INT_Q1_ENABLE + i] = 0x00000CE6; | ||
425 | + s->regs_wo[R_INT_Q1_DISABLE + i] = 0x00000CE6; | ||
426 | } | ||
427 | } | ||
428 | |||
429 | @@ -XXX,XX +XXX,XX @@ static bool gem_can_receive(NetClientState *nc) | ||
430 | s = qemu_get_nic_opaque(nc); | ||
431 | |||
432 | /* Do nothing if receive is not enabled. */ | ||
433 | - if (!(s->regs[GEM_NWCTRL] & GEM_NWCTRL_RXENA)) { | ||
434 | + if (!(s->regs[R_NWCTRL] & GEM_NWCTRL_RXENA)) { | ||
435 | if (s->can_rx_state != 1) { | ||
436 | s->can_rx_state = 1; | ||
437 | DB_PRINT("can't receive - no enable\n"); | ||
438 | @@ -XXX,XX +XXX,XX @@ static void gem_update_int_status(CadenceGEMState *s) | ||
439 | { | ||
440 | int i; | ||
441 | |||
442 | - qemu_set_irq(s->irq[0], !!s->regs[GEM_ISR]); | ||
443 | + qemu_set_irq(s->irq[0], !!s->regs[R_ISR]); | ||
444 | |||
445 | for (i = 1; i < s->num_priority_queues; ++i) { | ||
446 | - qemu_set_irq(s->irq[i], !!s->regs[GEM_INT_Q1_STATUS + i - 1]); | ||
447 | + qemu_set_irq(s->irq[i], !!s->regs[R_INT_Q1_STATUS + i - 1]); | ||
448 | } | ||
449 | } | ||
450 | |||
451 | @@ -XXX,XX +XXX,XX @@ static void gem_receive_updatestats(CadenceGEMState *s, const uint8_t *packet, | ||
452 | uint64_t octets; | ||
453 | |||
454 | /* Total octets (bytes) received */ | ||
455 | - octets = ((uint64_t)(s->regs[GEM_OCTRXLO]) << 32) | | ||
456 | - s->regs[GEM_OCTRXHI]; | ||
457 | + octets = ((uint64_t)(s->regs[R_OCTRXLO]) << 32) | | ||
458 | + s->regs[R_OCTRXHI]; | ||
459 | octets += bytes; | ||
460 | - s->regs[GEM_OCTRXLO] = octets >> 32; | ||
461 | - s->regs[GEM_OCTRXHI] = octets; | ||
462 | + s->regs[R_OCTRXLO] = octets >> 32; | ||
463 | + s->regs[R_OCTRXHI] = octets; | ||
464 | |||
465 | /* Error-free Frames received */ | ||
466 | - s->regs[GEM_RXCNT]++; | ||
467 | + s->regs[R_RXCNT]++; | ||
468 | |||
469 | /* Error-free Broadcast Frames counter */ | ||
470 | if (!memcmp(packet, broadcast_addr, 6)) { | ||
471 | - s->regs[GEM_RXBROADCNT]++; | ||
472 | + s->regs[R_RXBROADCNT]++; | ||
473 | } | ||
474 | |||
475 | /* Error-free Multicast Frames counter */ | ||
476 | if (packet[0] == 0x01) { | ||
477 | - s->regs[GEM_RXMULTICNT]++; | ||
478 | + s->regs[R_RXMULTICNT]++; | ||
479 | } | ||
480 | |||
481 | if (bytes <= 64) { | ||
482 | - s->regs[GEM_RX64CNT]++; | ||
483 | + s->regs[R_RX64CNT]++; | ||
484 | } else if (bytes <= 127) { | ||
485 | - s->regs[GEM_RX65CNT]++; | ||
486 | + s->regs[R_RX65CNT]++; | ||
487 | } else if (bytes <= 255) { | ||
488 | - s->regs[GEM_RX128CNT]++; | ||
489 | + s->regs[R_RX128CNT]++; | ||
490 | } else if (bytes <= 511) { | ||
491 | - s->regs[GEM_RX256CNT]++; | ||
492 | + s->regs[R_RX256CNT]++; | ||
493 | } else if (bytes <= 1023) { | ||
494 | - s->regs[GEM_RX512CNT]++; | ||
495 | + s->regs[R_RX512CNT]++; | ||
496 | } else if (bytes <= 1518) { | ||
497 | - s->regs[GEM_RX1024CNT]++; | ||
498 | + s->regs[R_RX1024CNT]++; | ||
499 | } else { | ||
500 | - s->regs[GEM_RX1519CNT]++; | ||
501 | + s->regs[R_RX1519CNT]++; | ||
502 | } | ||
503 | } | ||
504 | |||
505 | @@ -XXX,XX +XXX,XX @@ static int gem_mac_address_filter(CadenceGEMState *s, const uint8_t *packet) | ||
506 | int i, is_mc; | ||
507 | |||
508 | /* Promiscuous mode? */ | ||
509 | - if (s->regs[GEM_NWCFG] & GEM_NWCFG_PROMISC) { | ||
510 | + if (s->regs[R_NWCFG] & GEM_NWCFG_PROMISC) { | ||
511 | return GEM_RX_PROMISCUOUS_ACCEPT; | ||
512 | } | ||
513 | |||
514 | if (!memcmp(packet, broadcast_addr, 6)) { | ||
515 | /* Reject broadcast packets? */ | ||
516 | - if (s->regs[GEM_NWCFG] & GEM_NWCFG_BCAST_REJ) { | ||
517 | + if (s->regs[R_NWCFG] & GEM_NWCFG_BCAST_REJ) { | ||
518 | return GEM_RX_REJECT; | ||
56 | } | 519 | } |
57 | - object_property_set_int(OBJECT(s->lpd.iou.gem[i]), | 520 | return GEM_RX_BROADCAST_ACCEPT; |
58 | + object_property_set_int(OBJECT(dev), | 521 | @@ -XXX,XX +XXX,XX @@ static int gem_mac_address_filter(CadenceGEMState *s, const uint8_t *packet) |
59 | 2, "num-priority-queues", | 522 | |
60 | &error_abort); | 523 | /* Accept packets -w- hash match? */ |
61 | - object_property_set_link(OBJECT(s->lpd.iou.gem[i]), | 524 | is_mc = is_multicast_ether_addr(packet); |
62 | + object_property_set_link(OBJECT(dev), | 525 | - if ((is_mc && (s->regs[GEM_NWCFG] & GEM_NWCFG_MCAST_HASH)) || |
63 | OBJECT(&s->mr_ps), "dma", | 526 | - (!is_mc && (s->regs[GEM_NWCFG] & GEM_NWCFG_UCAST_HASH))) { |
64 | &error_abort); | 527 | + if ((is_mc && (s->regs[R_NWCFG] & GEM_NWCFG_MCAST_HASH)) || |
65 | qdev_init_nofail(dev); | 528 | + (!is_mc && (s->regs[R_NWCFG] & GEM_NWCFG_UCAST_HASH))) { |
66 | 529 | uint64_t buckets; | |
67 | - mr = sysbus_mmio_get_region(s->lpd.iou.gem[i], 0); | 530 | unsigned hash_index; |
68 | + mr = sysbus_mmio_get_region(SYS_BUS_DEVICE(dev), 0); | 531 | |
69 | memory_region_add_subregion(&s->mr_ps, addrs[i], mr); | 532 | hash_index = calc_mac_hash(packet); |
70 | 533 | - buckets = ((uint64_t)s->regs[GEM_HASHHI] << 32) | s->regs[GEM_HASHLO]; | |
71 | - sysbus_connect_irq(s->lpd.iou.gem[i], 0, pic[irqs[i]]); | 534 | + buckets = ((uint64_t)s->regs[R_HASHHI] << 32) | s->regs[R_HASHLO]; |
72 | + sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, pic[irqs[i]]); | 535 | if ((buckets >> hash_index) & 1) { |
73 | g_free(name); | 536 | return is_mc ? GEM_RX_MULTICAST_HASH_ACCEPT |
537 | : GEM_RX_UNICAST_HASH_ACCEPT; | ||
538 | @@ -XXX,XX +XXX,XX @@ static int gem_mac_address_filter(CadenceGEMState *s, const uint8_t *packet) | ||
539 | } | ||
540 | |||
541 | /* Check all 4 specific addresses */ | ||
542 | - gem_spaddr = (uint8_t *)&(s->regs[GEM_SPADDR1LO]); | ||
543 | + gem_spaddr = (uint8_t *)&(s->regs[R_SPADDR1LO]); | ||
544 | for (i = 3; i >= 0; i--) { | ||
545 | if (s->sar_active[i] && !memcmp(packet, gem_spaddr + 8 * i, 6)) { | ||
546 | return GEM_RX_SAR_ACCEPT + i; | ||
547 | @@ -XXX,XX +XXX,XX @@ static int get_queue_from_screen(CadenceGEMState *s, uint8_t *rxbuf_ptr, | ||
548 | int i, j; | ||
549 | |||
550 | for (i = 0; i < s->num_type1_screeners; i++) { | ||
551 | - reg = s->regs[GEM_SCREENING_TYPE1_REGISTER_0 + i]; | ||
552 | + reg = s->regs[R_SCREENING_TYPE1_REG0 + i]; | ||
553 | matched = false; | ||
554 | mismatched = false; | ||
555 | |||
556 | @@ -XXX,XX +XXX,XX @@ static int get_queue_from_screen(CadenceGEMState *s, uint8_t *rxbuf_ptr, | ||
557 | } | ||
558 | |||
559 | for (i = 0; i < s->num_type2_screeners; i++) { | ||
560 | - reg = s->regs[GEM_SCREENING_TYPE2_REGISTER_0 + i]; | ||
561 | + reg = s->regs[R_SCREENING_TYPE2_REG0 + i]; | ||
562 | matched = false; | ||
563 | mismatched = false; | ||
564 | |||
565 | @@ -XXX,XX +XXX,XX @@ static int get_queue_from_screen(CadenceGEMState *s, uint8_t *rxbuf_ptr, | ||
566 | qemu_log_mask(LOG_GUEST_ERROR, "Out of range ethertype " | ||
567 | "register index: %d\n", et_idx); | ||
568 | } | ||
569 | - if (type == s->regs[GEM_SCREENING_TYPE2_ETHERTYPE_REG_0 + | ||
570 | + if (type == s->regs[R_SCREENING_TYPE2_ETHERTYPE_REG0 + | ||
571 | et_idx]) { | ||
572 | matched = true; | ||
573 | } else { | ||
574 | @@ -XXX,XX +XXX,XX @@ static int get_queue_from_screen(CadenceGEMState *s, uint8_t *rxbuf_ptr, | ||
575 | "register index: %d\n", cr_idx); | ||
576 | } | ||
577 | |||
578 | - cr0 = s->regs[GEM_TYPE2_COMPARE_0_WORD_0 + cr_idx * 2]; | ||
579 | - cr1 = s->regs[GEM_TYPE2_COMPARE_0_WORD_0 + cr_idx * 2 + 1]; | ||
580 | + cr0 = s->regs[R_TYPE2_COMPARE_0_WORD_0 + cr_idx * 2]; | ||
581 | + cr1 = s->regs[R_TYPE2_COMPARE_0_WORD_0 + cr_idx * 2 + 1]; | ||
582 | offset = extract32(cr1, GEM_T2CW1_OFFSET_VALUE_SHIFT, | ||
583 | GEM_T2CW1_OFFSET_VALUE_WIDTH); | ||
584 | |||
585 | @@ -XXX,XX +XXX,XX @@ static uint32_t gem_get_queue_base_addr(CadenceGEMState *s, bool tx, int q) | ||
586 | |||
587 | switch (q) { | ||
588 | case 0: | ||
589 | - base_addr = s->regs[tx ? GEM_TXQBASE : GEM_RXQBASE]; | ||
590 | + base_addr = s->regs[tx ? R_TXQBASE : R_RXQBASE]; | ||
591 | break; | ||
592 | case 1 ... (MAX_PRIORITY_QUEUES - 1): | ||
593 | - base_addr = s->regs[(tx ? GEM_TRANSMIT_Q1_PTR : | ||
594 | - GEM_RECEIVE_Q1_PTR) + q - 1]; | ||
595 | + base_addr = s->regs[(tx ? R_TRANSMIT_Q1_PTR : | ||
596 | + R_RECEIVE_Q1_PTR) + q - 1]; | ||
597 | break; | ||
598 | default: | ||
599 | g_assert_not_reached(); | ||
600 | @@ -XXX,XX +XXX,XX @@ static hwaddr gem_get_desc_addr(CadenceGEMState *s, bool tx, int q) | ||
601 | { | ||
602 | hwaddr desc_addr = 0; | ||
603 | |||
604 | - if (s->regs[GEM_DMACFG] & GEM_DMACFG_ADDR_64B) { | ||
605 | - desc_addr = s->regs[tx ? GEM_TBQPH : GEM_RBQPH]; | ||
606 | + if (s->regs[R_DMACFG] & GEM_DMACFG_ADDR_64B) { | ||
607 | + desc_addr = s->regs[tx ? R_TBQPH : R_RBQPH]; | ||
608 | } | ||
609 | desc_addr <<= 32; | ||
610 | desc_addr |= tx ? s->tx_desc_addr[q] : s->rx_desc_addr[q]; | ||
611 | @@ -XXX,XX +XXX,XX @@ static void gem_get_rx_desc(CadenceGEMState *s, int q) | ||
612 | /* Descriptor owned by software ? */ | ||
613 | if (rx_desc_get_ownership(s->rx_desc[q]) == 1) { | ||
614 | DB_PRINT("descriptor 0x%" HWADDR_PRIx " owned by sw.\n", desc_addr); | ||
615 | - s->regs[GEM_RXSTATUS] |= GEM_RXSTATUS_NOBUF; | ||
616 | + s->regs[R_RXSTATUS] |= GEM_RXSTATUS_NOBUF; | ||
617 | gem_set_isr(s, q, GEM_INT_RXUSED); | ||
618 | /* Handle interrupt consequences */ | ||
619 | gem_update_int_status(s); | ||
620 | @@ -XXX,XX +XXX,XX @@ static ssize_t gem_receive(NetClientState *nc, const uint8_t *buf, size_t size) | ||
621 | } | ||
622 | |||
623 | /* Discard packets with receive length error enabled ? */ | ||
624 | - if (s->regs[GEM_NWCFG] & GEM_NWCFG_LERR_DISC) { | ||
625 | + if (s->regs[R_NWCFG] & GEM_NWCFG_LERR_DISC) { | ||
626 | unsigned type_len; | ||
627 | |||
628 | /* Fish the ethertype / length field out of the RX packet */ | ||
629 | @@ -XXX,XX +XXX,XX @@ static ssize_t gem_receive(NetClientState *nc, const uint8_t *buf, size_t size) | ||
630 | /* | ||
631 | * Determine configured receive buffer offset (probably 0) | ||
632 | */ | ||
633 | - rxbuf_offset = (s->regs[GEM_NWCFG] & GEM_NWCFG_BUFF_OFST_M) >> | ||
634 | + rxbuf_offset = (s->regs[R_NWCFG] & GEM_NWCFG_BUFF_OFST_M) >> | ||
635 | GEM_NWCFG_BUFF_OFST_S; | ||
636 | |||
637 | /* The configure size of each receive buffer. Determines how many | ||
638 | * buffers needed to hold this packet. | ||
639 | */ | ||
640 | - rxbufsize = ((s->regs[GEM_DMACFG] & GEM_DMACFG_RBUFSZ_M) >> | ||
641 | + rxbufsize = ((s->regs[R_DMACFG] & GEM_DMACFG_RBUFSZ_M) >> | ||
642 | GEM_DMACFG_RBUFSZ_S) * GEM_DMACFG_RBUFSZ_MUL; | ||
643 | bytes_to_copy = size; | ||
644 | |||
645 | @@ -XXX,XX +XXX,XX @@ static ssize_t gem_receive(NetClientState *nc, const uint8_t *buf, size_t size) | ||
646 | } | ||
647 | |||
648 | /* Strip of FCS field ? (usually yes) */ | ||
649 | - if (s->regs[GEM_NWCFG] & GEM_NWCFG_STRIP_FCS) { | ||
650 | + if (s->regs[R_NWCFG] & GEM_NWCFG_STRIP_FCS) { | ||
651 | rxbuf_ptr = (void *)buf; | ||
652 | } else { | ||
653 | unsigned crc_val; | ||
654 | @@ -XXX,XX +XXX,XX @@ static ssize_t gem_receive(NetClientState *nc, const uint8_t *buf, size_t size) | ||
655 | /* Count it */ | ||
656 | gem_receive_updatestats(s, buf, size); | ||
657 | |||
658 | - s->regs[GEM_RXSTATUS] |= GEM_RXSTATUS_FRMRCVD; | ||
659 | + s->regs[R_RXSTATUS] |= GEM_RXSTATUS_FRMRCVD; | ||
660 | gem_set_isr(s, q, GEM_INT_RXCMPL); | ||
661 | |||
662 | /* Handle interrupt consequences */ | ||
663 | @@ -XXX,XX +XXX,XX @@ static void gem_transmit_updatestats(CadenceGEMState *s, const uint8_t *packet, | ||
664 | uint64_t octets; | ||
665 | |||
666 | /* Total octets (bytes) transmitted */ | ||
667 | - octets = ((uint64_t)(s->regs[GEM_OCTTXLO]) << 32) | | ||
668 | - s->regs[GEM_OCTTXHI]; | ||
669 | + octets = ((uint64_t)(s->regs[R_OCTTXLO]) << 32) | | ||
670 | + s->regs[R_OCTTXHI]; | ||
671 | octets += bytes; | ||
672 | - s->regs[GEM_OCTTXLO] = octets >> 32; | ||
673 | - s->regs[GEM_OCTTXHI] = octets; | ||
674 | + s->regs[R_OCTTXLO] = octets >> 32; | ||
675 | + s->regs[R_OCTTXHI] = octets; | ||
676 | |||
677 | /* Error-free Frames transmitted */ | ||
678 | - s->regs[GEM_TXCNT]++; | ||
679 | + s->regs[R_TXCNT]++; | ||
680 | |||
681 | /* Error-free Broadcast Frames counter */ | ||
682 | if (!memcmp(packet, broadcast_addr, 6)) { | ||
683 | - s->regs[GEM_TXBCNT]++; | ||
684 | + s->regs[R_TXBCNT]++; | ||
685 | } | ||
686 | |||
687 | /* Error-free Multicast Frames counter */ | ||
688 | if (packet[0] == 0x01) { | ||
689 | - s->regs[GEM_TXMCNT]++; | ||
690 | + s->regs[R_TXMCNT]++; | ||
691 | } | ||
692 | |||
693 | if (bytes <= 64) { | ||
694 | - s->regs[GEM_TX64CNT]++; | ||
695 | + s->regs[R_TX64CNT]++; | ||
696 | } else if (bytes <= 127) { | ||
697 | - s->regs[GEM_TX65CNT]++; | ||
698 | + s->regs[R_TX65CNT]++; | ||
699 | } else if (bytes <= 255) { | ||
700 | - s->regs[GEM_TX128CNT]++; | ||
701 | + s->regs[R_TX128CNT]++; | ||
702 | } else if (bytes <= 511) { | ||
703 | - s->regs[GEM_TX256CNT]++; | ||
704 | + s->regs[R_TX256CNT]++; | ||
705 | } else if (bytes <= 1023) { | ||
706 | - s->regs[GEM_TX512CNT]++; | ||
707 | + s->regs[R_TX512CNT]++; | ||
708 | } else if (bytes <= 1518) { | ||
709 | - s->regs[GEM_TX1024CNT]++; | ||
710 | + s->regs[R_TX1024CNT]++; | ||
711 | } else { | ||
712 | - s->regs[GEM_TX1519CNT]++; | ||
713 | + s->regs[R_TX1519CNT]++; | ||
74 | } | 714 | } |
75 | } | 715 | } |
716 | |||
717 | @@ -XXX,XX +XXX,XX @@ static void gem_transmit(CadenceGEMState *s) | ||
718 | int q = 0; | ||
719 | |||
720 | /* Do nothing if transmit is not enabled. */ | ||
721 | - if (!(s->regs[GEM_NWCTRL] & GEM_NWCTRL_TXENA)) { | ||
722 | + if (!(s->regs[R_NWCTRL] & GEM_NWCTRL_TXENA)) { | ||
723 | return; | ||
724 | } | ||
725 | |||
726 | @@ -XXX,XX +XXX,XX @@ static void gem_transmit(CadenceGEMState *s) | ||
727 | while (tx_desc_get_used(desc) == 0) { | ||
728 | |||
729 | /* Do nothing if transmit is not enabled. */ | ||
730 | - if (!(s->regs[GEM_NWCTRL] & GEM_NWCTRL_TXENA)) { | ||
731 | + if (!(s->regs[R_NWCTRL] & GEM_NWCTRL_TXENA)) { | ||
732 | return; | ||
733 | } | ||
734 | print_gem_tx_desc(desc, q); | ||
735 | @@ -XXX,XX +XXX,XX @@ static void gem_transmit(CadenceGEMState *s) | ||
736 | } | ||
737 | DB_PRINT("TX descriptor next: 0x%08x\n", s->tx_desc_addr[q]); | ||
738 | |||
739 | - s->regs[GEM_TXSTATUS] |= GEM_TXSTATUS_TXCMPL; | ||
740 | + s->regs[R_TXSTATUS] |= GEM_TXSTATUS_TXCMPL; | ||
741 | gem_set_isr(s, q, GEM_INT_TXCMPL); | ||
742 | |||
743 | /* Handle interrupt consequences */ | ||
744 | gem_update_int_status(s); | ||
745 | |||
746 | /* Is checksum offload enabled? */ | ||
747 | - if (s->regs[GEM_DMACFG] & GEM_DMACFG_TXCSUM_OFFL) { | ||
748 | + if (s->regs[R_DMACFG] & GEM_DMACFG_TXCSUM_OFFL) { | ||
749 | net_checksum_calculate(s->tx_packet, total_bytes, CSUM_ALL); | ||
750 | } | ||
751 | |||
752 | @@ -XXX,XX +XXX,XX @@ static void gem_transmit(CadenceGEMState *s) | ||
753 | gem_transmit_updatestats(s, s->tx_packet, total_bytes); | ||
754 | |||
755 | /* Send the packet somewhere */ | ||
756 | - if (s->phy_loop || (s->regs[GEM_NWCTRL] & | ||
757 | + if (s->phy_loop || (s->regs[R_NWCTRL] & | ||
758 | GEM_NWCTRL_LOCALLOOP)) { | ||
759 | qemu_receive_packet(qemu_get_queue(s->nic), s->tx_packet, | ||
760 | total_bytes); | ||
761 | @@ -XXX,XX +XXX,XX @@ static void gem_transmit(CadenceGEMState *s) | ||
762 | |||
763 | /* read next descriptor */ | ||
764 | if (tx_desc_get_wrap(desc)) { | ||
765 | - | ||
766 | - if (s->regs[GEM_DMACFG] & GEM_DMACFG_ADDR_64B) { | ||
767 | - packet_desc_addr = s->regs[GEM_TBQPH]; | ||
768 | + if (s->regs[R_DMACFG] & GEM_DMACFG_ADDR_64B) { | ||
769 | + packet_desc_addr = s->regs[R_TBQPH]; | ||
770 | packet_desc_addr <<= 32; | ||
771 | } else { | ||
772 | packet_desc_addr = 0; | ||
773 | @@ -XXX,XX +XXX,XX @@ static void gem_transmit(CadenceGEMState *s) | ||
774 | } | ||
775 | |||
776 | if (tx_desc_get_used(desc)) { | ||
777 | - s->regs[GEM_TXSTATUS] |= GEM_TXSTATUS_USED; | ||
778 | + s->regs[R_TXSTATUS] |= GEM_TXSTATUS_USED; | ||
779 | /* IRQ TXUSED is defined only for queue 0 */ | ||
780 | if (q == 0) { | ||
781 | gem_set_isr(s, 0, GEM_INT_TXUSED); | ||
782 | @@ -XXX,XX +XXX,XX @@ static void gem_reset(DeviceState *d) | ||
783 | |||
784 | /* Set post reset register values */ | ||
785 | memset(&s->regs[0], 0, sizeof(s->regs)); | ||
786 | - s->regs[GEM_NWCFG] = 0x00080000; | ||
787 | - s->regs[GEM_NWSTATUS] = 0x00000006; | ||
788 | - s->regs[GEM_DMACFG] = 0x00020784; | ||
789 | - s->regs[GEM_IMR] = 0x07ffffff; | ||
790 | - s->regs[GEM_TXPAUSE] = 0x0000ffff; | ||
791 | - s->regs[GEM_TXPARTIALSF] = 0x000003ff; | ||
792 | - s->regs[GEM_RXPARTIALSF] = 0x000003ff; | ||
793 | - s->regs[GEM_MODID] = s->revision; | ||
794 | - s->regs[GEM_DESCONF] = 0x02D00111; | ||
795 | - s->regs[GEM_DESCONF2] = 0x2ab10000 | s->jumbo_max_len; | ||
796 | - s->regs[GEM_DESCONF5] = 0x002f2045; | ||
797 | - s->regs[GEM_DESCONF6] = GEM_DESCONF6_64B_MASK; | ||
798 | - s->regs[GEM_INT_Q1_MASK] = 0x00000CE6; | ||
799 | - s->regs[GEM_JUMBO_MAX_LEN] = s->jumbo_max_len; | ||
800 | + s->regs[R_NWCFG] = 0x00080000; | ||
801 | + s->regs[R_NWSTATUS] = 0x00000006; | ||
802 | + s->regs[R_DMACFG] = 0x00020784; | ||
803 | + s->regs[R_IMR] = 0x07ffffff; | ||
804 | + s->regs[R_TXPAUSE] = 0x0000ffff; | ||
805 | + s->regs[R_TXPARTIALSF] = 0x000003ff; | ||
806 | + s->regs[R_RXPARTIALSF] = 0x000003ff; | ||
807 | + s->regs[R_MODID] = s->revision; | ||
808 | + s->regs[R_DESCONF] = 0x02D00111; | ||
809 | + s->regs[R_DESCONF2] = 0x2ab10000 | s->jumbo_max_len; | ||
810 | + s->regs[R_DESCONF5] = 0x002f2045; | ||
811 | + s->regs[R_DESCONF6] = GEM_DESCONF6_64B_MASK; | ||
812 | + s->regs[R_INT_Q1_MASK] = 0x00000CE6; | ||
813 | + s->regs[R_JUMBO_MAX_LEN] = s->jumbo_max_len; | ||
814 | |||
815 | if (s->num_priority_queues > 1) { | ||
816 | queues_mask = MAKE_64BIT_MASK(1, s->num_priority_queues - 1); | ||
817 | - s->regs[GEM_DESCONF6] |= queues_mask; | ||
818 | + s->regs[R_DESCONF6] |= queues_mask; | ||
819 | } | ||
820 | |||
821 | /* Set MAC address */ | ||
822 | a = &s->conf.macaddr.a[0]; | ||
823 | - s->regs[GEM_SPADDR1LO] = a[0] | (a[1] << 8) | (a[2] << 16) | (a[3] << 24); | ||
824 | - s->regs[GEM_SPADDR1HI] = a[4] | (a[5] << 8); | ||
825 | + s->regs[R_SPADDR1LO] = a[0] | (a[1] << 8) | (a[2] << 16) | (a[3] << 24); | ||
826 | + s->regs[R_SPADDR1HI] = a[4] | (a[5] << 8); | ||
827 | |||
828 | for (i = 0; i < 4; i++) { | ||
829 | s->sar_active[i] = false; | ||
830 | @@ -XXX,XX +XXX,XX @@ static uint64_t gem_read(void *opaque, hwaddr offset, unsigned size) | ||
831 | DB_PRINT("offset: 0x%04x read: 0x%08x\n", (unsigned)offset*4, retval); | ||
832 | |||
833 | switch (offset) { | ||
834 | - case GEM_ISR: | ||
835 | + case R_ISR: | ||
836 | DB_PRINT("lowering irqs on ISR read\n"); | ||
837 | /* The interrupts get updated at the end of the function. */ | ||
838 | break; | ||
839 | - case GEM_PHYMNTNC: | ||
840 | + case R_PHYMNTNC: | ||
841 | if (retval & GEM_PHYMNTNC_OP_R) { | ||
842 | uint32_t phy_addr, reg_num; | ||
843 | |||
844 | @@ -XXX,XX +XXX,XX @@ static void gem_write(void *opaque, hwaddr offset, uint64_t val, | ||
845 | |||
846 | /* Handle register write side effects */ | ||
847 | switch (offset) { | ||
848 | - case GEM_NWCTRL: | ||
849 | + case R_NWCTRL: | ||
850 | if (val & GEM_NWCTRL_RXENA) { | ||
851 | for (i = 0; i < s->num_priority_queues; ++i) { | ||
852 | gem_get_rx_desc(s, i); | ||
853 | @@ -XXX,XX +XXX,XX @@ static void gem_write(void *opaque, hwaddr offset, uint64_t val, | ||
854 | } | ||
855 | break; | ||
856 | |||
857 | - case GEM_TXSTATUS: | ||
858 | + case R_TXSTATUS: | ||
859 | gem_update_int_status(s); | ||
860 | break; | ||
861 | - case GEM_RXQBASE: | ||
862 | + case R_RXQBASE: | ||
863 | s->rx_desc_addr[0] = val; | ||
864 | break; | ||
865 | - case GEM_RECEIVE_Q1_PTR ... GEM_RECEIVE_Q7_PTR: | ||
866 | - s->rx_desc_addr[offset - GEM_RECEIVE_Q1_PTR + 1] = val; | ||
867 | + case R_RECEIVE_Q1_PTR ... R_RECEIVE_Q7_PTR: | ||
868 | + s->rx_desc_addr[offset - R_RECEIVE_Q1_PTR + 1] = val; | ||
869 | break; | ||
870 | - case GEM_TXQBASE: | ||
871 | + case R_TXQBASE: | ||
872 | s->tx_desc_addr[0] = val; | ||
873 | break; | ||
874 | - case GEM_TRANSMIT_Q1_PTR ... GEM_TRANSMIT_Q7_PTR: | ||
875 | - s->tx_desc_addr[offset - GEM_TRANSMIT_Q1_PTR + 1] = val; | ||
876 | + case R_TRANSMIT_Q1_PTR ... R_TRANSMIT_Q7_PTR: | ||
877 | + s->tx_desc_addr[offset - R_TRANSMIT_Q1_PTR + 1] = val; | ||
878 | break; | ||
879 | - case GEM_RXSTATUS: | ||
880 | + case R_RXSTATUS: | ||
881 | gem_update_int_status(s); | ||
882 | break; | ||
883 | - case GEM_IER: | ||
884 | - s->regs[GEM_IMR] &= ~val; | ||
885 | + case R_IER: | ||
886 | + s->regs[R_IMR] &= ~val; | ||
887 | gem_update_int_status(s); | ||
888 | break; | ||
889 | - case GEM_JUMBO_MAX_LEN: | ||
890 | - s->regs[GEM_JUMBO_MAX_LEN] = val & MAX_JUMBO_FRAME_SIZE_MASK; | ||
891 | + case R_JUMBO_MAX_LEN: | ||
892 | + s->regs[R_JUMBO_MAX_LEN] = val & MAX_JUMBO_FRAME_SIZE_MASK; | ||
893 | break; | ||
894 | - case GEM_INT_Q1_ENABLE ... GEM_INT_Q7_ENABLE: | ||
895 | - s->regs[GEM_INT_Q1_MASK + offset - GEM_INT_Q1_ENABLE] &= ~val; | ||
896 | + case R_INT_Q1_ENABLE ... R_INT_Q7_ENABLE: | ||
897 | + s->regs[R_INT_Q1_MASK + offset - R_INT_Q1_ENABLE] &= ~val; | ||
898 | gem_update_int_status(s); | ||
899 | break; | ||
900 | - case GEM_IDR: | ||
901 | - s->regs[GEM_IMR] |= val; | ||
902 | + case R_IDR: | ||
903 | + s->regs[R_IMR] |= val; | ||
904 | gem_update_int_status(s); | ||
905 | break; | ||
906 | - case GEM_INT_Q1_DISABLE ... GEM_INT_Q7_DISABLE: | ||
907 | - s->regs[GEM_INT_Q1_MASK + offset - GEM_INT_Q1_DISABLE] |= val; | ||
908 | + case R_INT_Q1_DISABLE ... R_INT_Q7_DISABLE: | ||
909 | + s->regs[R_INT_Q1_MASK + offset - R_INT_Q1_DISABLE] |= val; | ||
910 | gem_update_int_status(s); | ||
911 | break; | ||
912 | - case GEM_SPADDR1LO: | ||
913 | - case GEM_SPADDR2LO: | ||
914 | - case GEM_SPADDR3LO: | ||
915 | - case GEM_SPADDR4LO: | ||
916 | - s->sar_active[(offset - GEM_SPADDR1LO) / 2] = false; | ||
917 | + case R_SPADDR1LO: | ||
918 | + case R_SPADDR2LO: | ||
919 | + case R_SPADDR3LO: | ||
920 | + case R_SPADDR4LO: | ||
921 | + s->sar_active[(offset - R_SPADDR1LO) / 2] = false; | ||
922 | break; | ||
923 | - case GEM_SPADDR1HI: | ||
924 | - case GEM_SPADDR2HI: | ||
925 | - case GEM_SPADDR3HI: | ||
926 | - case GEM_SPADDR4HI: | ||
927 | - s->sar_active[(offset - GEM_SPADDR1HI) / 2] = true; | ||
928 | + case R_SPADDR1HI: | ||
929 | + case R_SPADDR2HI: | ||
930 | + case R_SPADDR3HI: | ||
931 | + case R_SPADDR4HI: | ||
932 | + s->sar_active[(offset - R_SPADDR1HI) / 2] = true; | ||
933 | break; | ||
934 | - case GEM_PHYMNTNC: | ||
935 | + case R_PHYMNTNC: | ||
936 | if (val & GEM_PHYMNTNC_OP_W) { | ||
937 | uint32_t phy_addr, reg_num; | ||
938 | |||
76 | -- | 939 | -- |
77 | 2.20.1 | 940 | 2.34.1 |
78 | |||
79 | diff view generated by jsdifflib |
1 | For ARMv8.2-TTS2UXN, the stage 2 page table walk wants to know | 1 | From: Luc Michel <luc.michel@amd.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 | Describe screening registers fields using the FIELD macros. |
8 | add one so we have a place to put the documentation of the | ||
9 | semantics of the new s1_is_el0 argument. | ||
10 | 4 | ||
5 | Signed-off-by: Luc Michel <luc.michel@amd.com> | ||
6 | Reviewed-by: sai.pavan.boddu@amd.com | ||
7 | Message-id: 20231017194422.4124691-3-luc.michel@amd.com | ||
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> | ||
13 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
14 | Message-id: 20200330210400.11724-4-peter.maydell@linaro.org | ||
15 | --- | 9 | --- |
16 | target/arm/helper.c | 29 ++++++++++++++++++++++++++++- | 10 | hw/net/cadence_gem.c | 94 ++++++++++++++++++++++---------------------- |
17 | 1 file changed, 28 insertions(+), 1 deletion(-) | 11 | 1 file changed, 48 insertions(+), 46 deletions(-) |
18 | 12 | ||
19 | diff --git a/target/arm/helper.c b/target/arm/helper.c | 13 | diff --git a/hw/net/cadence_gem.c b/hw/net/cadence_gem.c |
20 | index XXXXXXX..XXXXXXX 100644 | 14 | index XXXXXXX..XXXXXXX 100644 |
21 | --- a/target/arm/helper.c | 15 | --- a/hw/net/cadence_gem.c |
22 | +++ b/target/arm/helper.c | 16 | +++ b/hw/net/cadence_gem.c |
23 | @@ -XXX,XX +XXX,XX @@ | 17 | @@ -XXX,XX +XXX,XX @@ REG32(INT_Q1_DISABLE, 0x620) |
24 | 18 | REG32(INT_Q7_DISABLE, 0x638) | |
25 | static bool get_phys_addr_lpae(CPUARMState *env, target_ulong address, | 19 | |
26 | MMUAccessType access_type, ARMMMUIdx mmu_idx, | 20 | REG32(SCREENING_TYPE1_REG0, 0x500) |
27 | + bool s1_is_el0, | 21 | - |
28 | hwaddr *phys_ptr, MemTxAttrs *txattrs, int *prot, | 22 | -#define GEM_ST1R_UDP_PORT_MATCH_ENABLE (1 << 29) |
29 | target_ulong *page_size_ptr, | 23 | -#define GEM_ST1R_DSTC_ENABLE (1 << 28) |
30 | ARMMMUFaultInfo *fi, ARMCacheAttrs *cacheattrs); | 24 | -#define GEM_ST1R_UDP_PORT_MATCH_SHIFT (12) |
31 | @@ -XXX,XX +XXX,XX @@ static hwaddr S1_ptw_translate(CPUARMState *env, ARMMMUIdx mmu_idx, | 25 | -#define GEM_ST1R_UDP_PORT_MATCH_WIDTH (27 - GEM_ST1R_UDP_PORT_MATCH_SHIFT + 1) |
26 | -#define GEM_ST1R_DSTC_MATCH_SHIFT (4) | ||
27 | -#define GEM_ST1R_DSTC_MATCH_WIDTH (11 - GEM_ST1R_DSTC_MATCH_SHIFT + 1) | ||
28 | -#define GEM_ST1R_QUEUE_SHIFT (0) | ||
29 | -#define GEM_ST1R_QUEUE_WIDTH (3 - GEM_ST1R_QUEUE_SHIFT + 1) | ||
30 | + FIELD(SCREENING_TYPE1_REG0, QUEUE_NUM, 0, 4) | ||
31 | + FIELD(SCREENING_TYPE1_REG0, DSTC_MATCH, 4, 8) | ||
32 | + FIELD(SCREENING_TYPE1_REG0, UDP_PORT_MATCH, 12, 16) | ||
33 | + FIELD(SCREENING_TYPE1_REG0, DSTC_ENABLE, 28, 1) | ||
34 | + FIELD(SCREENING_TYPE1_REG0, UDP_PORT_MATCH_EN, 29, 1) | ||
35 | + FIELD(SCREENING_TYPE1_REG0, DROP_ON_MATCH, 30, 1) | ||
36 | |||
37 | REG32(SCREENING_TYPE2_REG0, 0x540) | ||
38 | - | ||
39 | -#define GEM_ST2R_COMPARE_A_ENABLE (1 << 18) | ||
40 | -#define GEM_ST2R_COMPARE_A_SHIFT (13) | ||
41 | -#define GEM_ST2R_COMPARE_WIDTH (17 - GEM_ST2R_COMPARE_A_SHIFT + 1) | ||
42 | -#define GEM_ST2R_ETHERTYPE_ENABLE (1 << 12) | ||
43 | -#define GEM_ST2R_ETHERTYPE_INDEX_SHIFT (9) | ||
44 | -#define GEM_ST2R_ETHERTYPE_INDEX_WIDTH (11 - GEM_ST2R_ETHERTYPE_INDEX_SHIFT \ | ||
45 | - + 1) | ||
46 | -#define GEM_ST2R_QUEUE_SHIFT (0) | ||
47 | -#define GEM_ST2R_QUEUE_WIDTH (3 - GEM_ST2R_QUEUE_SHIFT + 1) | ||
48 | + FIELD(SCREENING_TYPE2_REG0, QUEUE_NUM, 0, 4) | ||
49 | + FIELD(SCREENING_TYPE2_REG0, VLAN_PRIORITY, 4, 3) | ||
50 | + FIELD(SCREENING_TYPE2_REG0, VLAN_ENABLE, 8, 1) | ||
51 | + FIELD(SCREENING_TYPE2_REG0, ETHERTYPE_REG_INDEX, 9, 3) | ||
52 | + FIELD(SCREENING_TYPE2_REG0, ETHERTYPE_ENABLE, 12, 1) | ||
53 | + FIELD(SCREENING_TYPE2_REG0, COMPARE_A, 13, 5) | ||
54 | + FIELD(SCREENING_TYPE2_REG0, COMPARE_A_ENABLE, 18, 1) | ||
55 | + FIELD(SCREENING_TYPE2_REG0, COMPARE_B, 19, 5) | ||
56 | + FIELD(SCREENING_TYPE2_REG0, COMPARE_B_ENABLE, 24, 1) | ||
57 | + FIELD(SCREENING_TYPE2_REG0, COMPARE_C, 25, 5) | ||
58 | + FIELD(SCREENING_TYPE2_REG0, COMPARE_C_ENABLE, 30, 1) | ||
59 | + FIELD(SCREENING_TYPE2_REG0, DROP_ON_MATCH, 31, 1) | ||
60 | |||
61 | REG32(SCREENING_TYPE2_ETHERTYPE_REG0, 0x6e0) | ||
62 | -REG32(TYPE2_COMPARE_0_WORD_0, 0x700) | ||
63 | |||
64 | -#define GEM_T2CW1_COMPARE_OFFSET_SHIFT (7) | ||
65 | -#define GEM_T2CW1_COMPARE_OFFSET_WIDTH (8 - GEM_T2CW1_COMPARE_OFFSET_SHIFT + 1) | ||
66 | -#define GEM_T2CW1_OFFSET_VALUE_SHIFT (0) | ||
67 | -#define GEM_T2CW1_OFFSET_VALUE_WIDTH (6 - GEM_T2CW1_OFFSET_VALUE_SHIFT + 1) | ||
68 | +REG32(TYPE2_COMPARE_0_WORD_0, 0x700) | ||
69 | + FIELD(TYPE2_COMPARE_0_WORD_0, MASK_VALUE, 0, 16) | ||
70 | + FIELD(TYPE2_COMPARE_0_WORD_0, COMPARE_VALUE, 16, 16) | ||
71 | + | ||
72 | +REG32(TYPE2_COMPARE_0_WORD_1, 0x704) | ||
73 | + FIELD(TYPE2_COMPARE_0_WORD_1, OFFSET_VALUE, 0, 7) | ||
74 | + FIELD(TYPE2_COMPARE_0_WORD_1, COMPARE_OFFSET, 7, 2) | ||
75 | + FIELD(TYPE2_COMPARE_0_WORD_1, DISABLE_MASK, 9, 1) | ||
76 | + FIELD(TYPE2_COMPARE_0_WORD_1, COMPARE_VLAN_ID, 10, 1) | ||
77 | |||
78 | /*****************************************/ | ||
79 | #define GEM_NWCTRL_TXSTART 0x00000200 /* Transmit Enable */ | ||
80 | @@ -XXX,XX +XXX,XX @@ static int get_queue_from_screen(CadenceGEMState *s, uint8_t *rxbuf_ptr, | ||
81 | mismatched = false; | ||
82 | |||
83 | /* Screening is based on UDP Port */ | ||
84 | - if (reg & GEM_ST1R_UDP_PORT_MATCH_ENABLE) { | ||
85 | + if (FIELD_EX32(reg, SCREENING_TYPE1_REG0, UDP_PORT_MATCH_EN)) { | ||
86 | uint16_t udp_port = rxbuf_ptr[14 + 22] << 8 | rxbuf_ptr[14 + 23]; | ||
87 | - if (udp_port == extract32(reg, GEM_ST1R_UDP_PORT_MATCH_SHIFT, | ||
88 | - GEM_ST1R_UDP_PORT_MATCH_WIDTH)) { | ||
89 | + if (udp_port == FIELD_EX32(reg, SCREENING_TYPE1_REG0, UDP_PORT_MATCH)) { | ||
90 | matched = true; | ||
91 | } else { | ||
92 | mismatched = true; | ||
93 | @@ -XXX,XX +XXX,XX @@ static int get_queue_from_screen(CadenceGEMState *s, uint8_t *rxbuf_ptr, | ||
32 | } | 94 | } |
33 | 95 | ||
34 | ret = get_phys_addr_lpae(env, addr, MMU_DATA_LOAD, ARMMMUIdx_Stage2, | 96 | /* Screening is based on DS/TC */ |
35 | + false, | 97 | - if (reg & GEM_ST1R_DSTC_ENABLE) { |
36 | &s2pa, &txattrs, &s2prot, &s2size, fi, | 98 | + if (FIELD_EX32(reg, SCREENING_TYPE1_REG0, DSTC_ENABLE)) { |
37 | pcacheattrs); | 99 | uint8_t dscp = rxbuf_ptr[14 + 1]; |
38 | if (ret) { | 100 | - if (dscp == extract32(reg, GEM_ST1R_DSTC_MATCH_SHIFT, |
39 | @@ -XXX,XX +XXX,XX @@ static ARMVAParameters aa32_va_parameters(CPUARMState *env, uint32_t va, | 101 | - GEM_ST1R_DSTC_MATCH_WIDTH)) { |
40 | }; | 102 | + if (dscp == FIELD_EX32(reg, SCREENING_TYPE1_REG0, DSTC_MATCH)) { |
41 | } | 103 | matched = true; |
42 | 104 | } else { | |
43 | +/** | 105 | mismatched = true; |
44 | + * get_phys_addr_lpae: perform one stage of page table walk, LPAE format | 106 | @@ -XXX,XX +XXX,XX @@ static int get_queue_from_screen(CadenceGEMState *s, uint8_t *rxbuf_ptr, |
45 | + * | 107 | } |
46 | + * Returns false if the translation was successful. Otherwise, phys_ptr, attrs, | 108 | |
47 | + * prot and page_size may not be filled in, and the populated fsr value provides | 109 | if (matched && !mismatched) { |
48 | + * information on why the translation aborted, in the format of a long-format | 110 | - return extract32(reg, GEM_ST1R_QUEUE_SHIFT, GEM_ST1R_QUEUE_WIDTH); |
49 | + * DFSR/IFSR fault register, with the following caveats: | 111 | + return FIELD_EX32(reg, SCREENING_TYPE1_REG0, QUEUE_NUM); |
50 | + * * the WnR bit is never set (the caller must do this). | 112 | } |
51 | + * | ||
52 | + * @env: CPUARMState | ||
53 | + * @address: virtual address to get physical address for | ||
54 | + * @access_type: MMU_DATA_LOAD, MMU_DATA_STORE or MMU_INST_FETCH | ||
55 | + * @mmu_idx: MMU index indicating required translation regime | ||
56 | + * @s1_is_el0: if @mmu_idx is ARMMMUIdx_Stage2 (so this is a stage 2 page table | ||
57 | + * walk), must be true if this is stage 2 of a stage 1+2 walk for an | ||
58 | + * EL0 access). If @mmu_idx is anything else, @s1_is_el0 is ignored. | ||
59 | + * @phys_ptr: set to the physical address corresponding to the virtual address | ||
60 | + * @attrs: set to the memory transaction attributes to use | ||
61 | + * @prot: set to the permissions for the page containing phys_ptr | ||
62 | + * @page_size_ptr: set to the size of the page containing phys_ptr | ||
63 | + * @fi: set to fault info if the translation fails | ||
64 | + * @cacheattrs: (if non-NULL) set to the cacheability/shareability attributes | ||
65 | + */ | ||
66 | static bool get_phys_addr_lpae(CPUARMState *env, target_ulong address, | ||
67 | MMUAccessType access_type, ARMMMUIdx mmu_idx, | ||
68 | + bool s1_is_el0, | ||
69 | hwaddr *phys_ptr, MemTxAttrs *txattrs, int *prot, | ||
70 | target_ulong *page_size_ptr, | ||
71 | ARMMMUFaultInfo *fi, ARMCacheAttrs *cacheattrs) | ||
72 | @@ -XXX,XX +XXX,XX @@ bool get_phys_addr(CPUARMState *env, target_ulong address, | ||
73 | |||
74 | /* S1 is done. Now do S2 translation. */ | ||
75 | ret = get_phys_addr_lpae(env, ipa, access_type, ARMMMUIdx_Stage2, | ||
76 | + mmu_idx == ARMMMUIdx_E10_0, | ||
77 | phys_ptr, attrs, &s2_prot, | ||
78 | page_size, fi, | ||
79 | cacheattrs != NULL ? &cacheattrs2 : NULL); | ||
80 | @@ -XXX,XX +XXX,XX @@ bool get_phys_addr(CPUARMState *env, target_ulong address, | ||
81 | } | 113 | } |
82 | 114 | ||
83 | if (regime_using_lpae_format(env, mmu_idx)) { | 115 | @@ -XXX,XX +XXX,XX @@ static int get_queue_from_screen(CadenceGEMState *s, uint8_t *rxbuf_ptr, |
84 | - return get_phys_addr_lpae(env, address, access_type, mmu_idx, | 116 | matched = false; |
85 | + return get_phys_addr_lpae(env, address, access_type, mmu_idx, false, | 117 | mismatched = false; |
86 | phys_ptr, attrs, prot, page_size, | 118 | |
87 | fi, cacheattrs); | 119 | - if (reg & GEM_ST2R_ETHERTYPE_ENABLE) { |
88 | } else if (regime_sctlr(env, mmu_idx) & SCTLR_XP) { | 120 | + if (FIELD_EX32(reg, SCREENING_TYPE2_REG0, ETHERTYPE_ENABLE)) { |
121 | uint16_t type = rxbuf_ptr[12] << 8 | rxbuf_ptr[13]; | ||
122 | - int et_idx = extract32(reg, GEM_ST2R_ETHERTYPE_INDEX_SHIFT, | ||
123 | - GEM_ST2R_ETHERTYPE_INDEX_WIDTH); | ||
124 | + int et_idx = FIELD_EX32(reg, SCREENING_TYPE2_REG0, | ||
125 | + ETHERTYPE_REG_INDEX); | ||
126 | |||
127 | if (et_idx > s->num_type2_screeners) { | ||
128 | qemu_log_mask(LOG_GUEST_ERROR, "Out of range ethertype " | ||
129 | @@ -XXX,XX +XXX,XX @@ static int get_queue_from_screen(CadenceGEMState *s, uint8_t *rxbuf_ptr, | ||
130 | |||
131 | /* Compare A, B, C */ | ||
132 | for (j = 0; j < 3; j++) { | ||
133 | - uint32_t cr0, cr1, mask; | ||
134 | + uint32_t cr0, cr1, mask, compare; | ||
135 | uint16_t rx_cmp; | ||
136 | int offset; | ||
137 | - int cr_idx = extract32(reg, GEM_ST2R_COMPARE_A_SHIFT + j * 6, | ||
138 | - GEM_ST2R_COMPARE_WIDTH); | ||
139 | + int cr_idx = extract32(reg, R_SCREENING_TYPE2_REG0_COMPARE_A_SHIFT + j * 6, | ||
140 | + R_SCREENING_TYPE2_REG0_COMPARE_A_LENGTH); | ||
141 | |||
142 | - if (!(reg & (GEM_ST2R_COMPARE_A_ENABLE << (j * 6)))) { | ||
143 | + if (!extract32(reg, R_SCREENING_TYPE2_REG0_COMPARE_A_ENABLE_SHIFT + j * 6, | ||
144 | + R_SCREENING_TYPE2_REG0_COMPARE_A_ENABLE_LENGTH)) { | ||
145 | continue; | ||
146 | } | ||
147 | + | ||
148 | if (cr_idx > s->num_type2_screeners) { | ||
149 | qemu_log_mask(LOG_GUEST_ERROR, "Out of range compare " | ||
150 | "register index: %d\n", cr_idx); | ||
151 | } | ||
152 | |||
153 | cr0 = s->regs[R_TYPE2_COMPARE_0_WORD_0 + cr_idx * 2]; | ||
154 | - cr1 = s->regs[R_TYPE2_COMPARE_0_WORD_0 + cr_idx * 2 + 1]; | ||
155 | - offset = extract32(cr1, GEM_T2CW1_OFFSET_VALUE_SHIFT, | ||
156 | - GEM_T2CW1_OFFSET_VALUE_WIDTH); | ||
157 | + cr1 = s->regs[R_TYPE2_COMPARE_0_WORD_1 + cr_idx * 2]; | ||
158 | + offset = FIELD_EX32(cr1, TYPE2_COMPARE_0_WORD_1, OFFSET_VALUE); | ||
159 | |||
160 | - switch (extract32(cr1, GEM_T2CW1_COMPARE_OFFSET_SHIFT, | ||
161 | - GEM_T2CW1_COMPARE_OFFSET_WIDTH)) { | ||
162 | + switch (FIELD_EX32(cr1, TYPE2_COMPARE_0_WORD_1, COMPARE_OFFSET)) { | ||
163 | case 3: /* Skip UDP header */ | ||
164 | qemu_log_mask(LOG_UNIMP, "TCP compare offsets" | ||
165 | "unimplemented - assuming UDP\n"); | ||
166 | @@ -XXX,XX +XXX,XX @@ static int get_queue_from_screen(CadenceGEMState *s, uint8_t *rxbuf_ptr, | ||
167 | } | ||
168 | |||
169 | rx_cmp = rxbuf_ptr[offset] << 8 | rxbuf_ptr[offset]; | ||
170 | - mask = extract32(cr0, 0, 16); | ||
171 | + mask = FIELD_EX32(cr0, TYPE2_COMPARE_0_WORD_0, MASK_VALUE); | ||
172 | + compare = FIELD_EX32(cr0, TYPE2_COMPARE_0_WORD_0, COMPARE_VALUE); | ||
173 | |||
174 | - if ((rx_cmp & mask) == (extract32(cr0, 16, 16) & mask)) { | ||
175 | + if ((rx_cmp & mask) == (compare & mask)) { | ||
176 | matched = true; | ||
177 | } else { | ||
178 | mismatched = true; | ||
179 | @@ -XXX,XX +XXX,XX @@ static int get_queue_from_screen(CadenceGEMState *s, uint8_t *rxbuf_ptr, | ||
180 | } | ||
181 | |||
182 | if (matched && !mismatched) { | ||
183 | - return extract32(reg, GEM_ST2R_QUEUE_SHIFT, GEM_ST2R_QUEUE_WIDTH); | ||
184 | + return FIELD_EX32(reg, SCREENING_TYPE2_REG0, QUEUE_NUM); | ||
185 | } | ||
186 | } | ||
187 | |||
89 | -- | 188 | -- |
90 | 2.20.1 | 189 | 2.34.1 |
91 | |||
92 | diff view generated by jsdifflib |
1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> | 1 | From: Luc Michel <luc.michel@amd.com> |
---|---|---|---|
2 | 2 | ||
3 | By using the TYPE_* definitions for devices, we can: | 3 | Use the FIELD macro to describe the NWCTRL register fields. |
4 | - quickly find where devices are used with 'git-grep' | ||
5 | - easily rename a device (one-line change). | ||
6 | 4 | ||
7 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 5 | Signed-off-by: Luc Michel <luc.michel@amd.com> |
8 | Message-id: 20200428154650.21991-1-f4bug@amsat.org | 6 | Reviewed-by: sai.pavan.boddu@amd.com |
9 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 7 | Message-id: 20231017194422.4124691-4-luc.michel@amd.com |
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
11 | --- | 9 | --- |
12 | hw/arm/mps2-tz.c | 2 +- | 10 | hw/net/cadence_gem.c | 53 +++++++++++++++++++++++++++++++++----------- |
13 | 1 file changed, 1 insertion(+), 1 deletion(-) | 11 | 1 file changed, 40 insertions(+), 13 deletions(-) |
14 | 12 | ||
15 | diff --git a/hw/arm/mps2-tz.c b/hw/arm/mps2-tz.c | 13 | diff --git a/hw/net/cadence_gem.c b/hw/net/cadence_gem.c |
16 | index XXXXXXX..XXXXXXX 100644 | 14 | index XXXXXXX..XXXXXXX 100644 |
17 | --- a/hw/arm/mps2-tz.c | 15 | --- a/hw/net/cadence_gem.c |
18 | +++ b/hw/arm/mps2-tz.c | 16 | +++ b/hw/net/cadence_gem.c |
19 | @@ -XXX,XX +XXX,XX @@ static void mps2tz_common_init(MachineState *machine) | 17 | @@ -XXX,XX +XXX,XX @@ |
20 | exit(EXIT_FAILURE); | 18 | } while (0) |
19 | |||
20 | REG32(NWCTRL, 0x0) /* Network Control reg */ | ||
21 | + FIELD(NWCTRL, LOOPBACK , 0, 1) | ||
22 | + FIELD(NWCTRL, LOOPBACK_LOCAL , 1, 1) | ||
23 | + FIELD(NWCTRL, ENABLE_RECEIVE, 2, 1) | ||
24 | + FIELD(NWCTRL, ENABLE_TRANSMIT, 3, 1) | ||
25 | + FIELD(NWCTRL, MAN_PORT_EN , 4, 1) | ||
26 | + FIELD(NWCTRL, CLEAR_ALL_STATS_REGS , 5, 1) | ||
27 | + FIELD(NWCTRL, INC_ALL_STATS_REGS, 6, 1) | ||
28 | + FIELD(NWCTRL, STATS_WRITE_EN, 7, 1) | ||
29 | + FIELD(NWCTRL, BACK_PRESSURE, 8, 1) | ||
30 | + FIELD(NWCTRL, TRANSMIT_START , 9, 1) | ||
31 | + FIELD(NWCTRL, TRANSMIT_HALT, 10, 1) | ||
32 | + FIELD(NWCTRL, TX_PAUSE_FRAME_RE, 11, 1) | ||
33 | + FIELD(NWCTRL, TX_PAUSE_FRAME_ZE, 12, 1) | ||
34 | + FIELD(NWCTRL, STATS_TAKE_SNAP, 13, 1) | ||
35 | + FIELD(NWCTRL, STATS_READ_SNAP, 14, 1) | ||
36 | + FIELD(NWCTRL, STORE_RX_TS, 15, 1) | ||
37 | + FIELD(NWCTRL, PFC_ENABLE, 16, 1) | ||
38 | + FIELD(NWCTRL, PFC_PRIO_BASED, 17, 1) | ||
39 | + FIELD(NWCTRL, FLUSH_RX_PKT_PCLK , 18, 1) | ||
40 | + FIELD(NWCTRL, TX_LPI_EN, 19, 1) | ||
41 | + FIELD(NWCTRL, PTP_UNICAST_ENA, 20, 1) | ||
42 | + FIELD(NWCTRL, ALT_SGMII_MODE, 21, 1) | ||
43 | + FIELD(NWCTRL, STORE_UDP_OFFSET, 22, 1) | ||
44 | + FIELD(NWCTRL, EXT_TSU_PORT_EN, 23, 1) | ||
45 | + FIELD(NWCTRL, ONE_STEP_SYNC_MO, 24, 1) | ||
46 | + FIELD(NWCTRL, PFC_CTRL , 25, 1) | ||
47 | + FIELD(NWCTRL, EXT_RXQ_SEL_EN , 26, 1) | ||
48 | + FIELD(NWCTRL, OSS_CORRECTION_FIELD, 27, 1) | ||
49 | + FIELD(NWCTRL, SEL_MII_ON_RGMII, 28, 1) | ||
50 | + FIELD(NWCTRL, TWO_PT_FIVE_GIG, 29, 1) | ||
51 | + FIELD(NWCTRL, IFG_EATS_QAV_CREDIT, 30, 1) | ||
52 | + | ||
53 | REG32(NWCFG, 0x4) /* Network Config reg */ | ||
54 | REG32(NWSTATUS, 0x8) /* Network Status reg */ | ||
55 | REG32(USERIO, 0xc) /* User IO reg */ | ||
56 | @@ -XXX,XX +XXX,XX @@ REG32(TYPE2_COMPARE_0_WORD_1, 0x704) | ||
57 | FIELD(TYPE2_COMPARE_0_WORD_1, COMPARE_VLAN_ID, 10, 1) | ||
58 | |||
59 | /*****************************************/ | ||
60 | -#define GEM_NWCTRL_TXSTART 0x00000200 /* Transmit Enable */ | ||
61 | -#define GEM_NWCTRL_TXENA 0x00000008 /* Transmit Enable */ | ||
62 | -#define GEM_NWCTRL_RXENA 0x00000004 /* Receive Enable */ | ||
63 | -#define GEM_NWCTRL_LOCALLOOP 0x00000002 /* Local Loopback */ | ||
64 | - | ||
65 | #define GEM_NWCFG_STRIP_FCS 0x00020000 /* Strip FCS field */ | ||
66 | #define GEM_NWCFG_LERR_DISC 0x00010000 /* Discard RX frames with len err */ | ||
67 | #define GEM_NWCFG_BUFF_OFST_M 0x0000C000 /* Receive buffer offset mask */ | ||
68 | @@ -XXX,XX +XXX,XX @@ static bool gem_can_receive(NetClientState *nc) | ||
69 | s = qemu_get_nic_opaque(nc); | ||
70 | |||
71 | /* Do nothing if receive is not enabled. */ | ||
72 | - if (!(s->regs[R_NWCTRL] & GEM_NWCTRL_RXENA)) { | ||
73 | + if (!FIELD_EX32(s->regs[R_NWCTRL], NWCTRL, ENABLE_RECEIVE)) { | ||
74 | if (s->can_rx_state != 1) { | ||
75 | s->can_rx_state = 1; | ||
76 | DB_PRINT("can't receive - no enable\n"); | ||
77 | @@ -XXX,XX +XXX,XX @@ static void gem_transmit(CadenceGEMState *s) | ||
78 | int q = 0; | ||
79 | |||
80 | /* Do nothing if transmit is not enabled. */ | ||
81 | - if (!(s->regs[R_NWCTRL] & GEM_NWCTRL_TXENA)) { | ||
82 | + if (!FIELD_EX32(s->regs[R_NWCTRL], NWCTRL, ENABLE_TRANSMIT)) { | ||
83 | return; | ||
21 | } | 84 | } |
22 | 85 | ||
23 | - sysbus_init_child_obj(OBJECT(machine), "iotkit", &mms->iotkit, | 86 | @@ -XXX,XX +XXX,XX @@ static void gem_transmit(CadenceGEMState *s) |
24 | + sysbus_init_child_obj(OBJECT(machine), TYPE_IOTKIT, &mms->iotkit, | 87 | while (tx_desc_get_used(desc) == 0) { |
25 | sizeof(mms->iotkit), mmc->armsse_type); | 88 | |
26 | iotkitdev = DEVICE(&mms->iotkit); | 89 | /* Do nothing if transmit is not enabled. */ |
27 | object_property_set_link(OBJECT(&mms->iotkit), OBJECT(system_memory), | 90 | - if (!(s->regs[R_NWCTRL] & GEM_NWCTRL_TXENA)) { |
91 | + if (!FIELD_EX32(s->regs[R_NWCTRL], NWCTRL, ENABLE_TRANSMIT)) { | ||
92 | return; | ||
93 | } | ||
94 | print_gem_tx_desc(desc, q); | ||
95 | @@ -XXX,XX +XXX,XX @@ static void gem_transmit(CadenceGEMState *s) | ||
96 | gem_transmit_updatestats(s, s->tx_packet, total_bytes); | ||
97 | |||
98 | /* Send the packet somewhere */ | ||
99 | - if (s->phy_loop || (s->regs[R_NWCTRL] & | ||
100 | - GEM_NWCTRL_LOCALLOOP)) { | ||
101 | + if (s->phy_loop || FIELD_EX32(s->regs[R_NWCTRL], NWCTRL, | ||
102 | + LOOPBACK_LOCAL)) { | ||
103 | qemu_receive_packet(qemu_get_queue(s->nic), s->tx_packet, | ||
104 | total_bytes); | ||
105 | } else { | ||
106 | @@ -XXX,XX +XXX,XX @@ static void gem_write(void *opaque, hwaddr offset, uint64_t val, | ||
107 | /* Handle register write side effects */ | ||
108 | switch (offset) { | ||
109 | case R_NWCTRL: | ||
110 | - if (val & GEM_NWCTRL_RXENA) { | ||
111 | + if (FIELD_EX32(val, NWCTRL, ENABLE_RECEIVE)) { | ||
112 | for (i = 0; i < s->num_priority_queues; ++i) { | ||
113 | gem_get_rx_desc(s, i); | ||
114 | } | ||
115 | } | ||
116 | - if (val & GEM_NWCTRL_TXSTART) { | ||
117 | + if (FIELD_EX32(val, NWCTRL, TRANSMIT_START)) { | ||
118 | gem_transmit(s); | ||
119 | } | ||
120 | - if (!(val & GEM_NWCTRL_TXENA)) { | ||
121 | + if (!(FIELD_EX32(val, NWCTRL, ENABLE_TRANSMIT))) { | ||
122 | /* Reset to start of Q when transmit disabled. */ | ||
123 | for (i = 0; i < s->num_priority_queues; i++) { | ||
124 | s->tx_desc_addr[i] = gem_get_tx_queue_base_addr(s, i); | ||
28 | -- | 125 | -- |
29 | 2.20.1 | 126 | 2.34.1 |
30 | |||
31 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Luc Michel <luc.michel@amd.com> | ||
1 | 2 | ||
3 | Use de FIELD macro to describe the NWCFG register fields. | ||
4 | |||
5 | Signed-off-by: Luc Michel <luc.michel@amd.com> | ||
6 | Reviewed-by: sai.pavan.boddu@amd.com | ||
7 | Message-id: 20231017194422.4124691-5-luc.michel@amd.com | ||
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
9 | --- | ||
10 | hw/net/cadence_gem.c | 60 ++++++++++++++++++++++++++++---------------- | ||
11 | 1 file changed, 39 insertions(+), 21 deletions(-) | ||
12 | |||
13 | diff --git a/hw/net/cadence_gem.c b/hw/net/cadence_gem.c | ||
14 | index XXXXXXX..XXXXXXX 100644 | ||
15 | --- a/hw/net/cadence_gem.c | ||
16 | +++ b/hw/net/cadence_gem.c | ||
17 | @@ -XXX,XX +XXX,XX @@ REG32(NWCTRL, 0x0) /* Network Control reg */ | ||
18 | FIELD(NWCTRL, IFG_EATS_QAV_CREDIT, 30, 1) | ||
19 | |||
20 | REG32(NWCFG, 0x4) /* Network Config reg */ | ||
21 | + FIELD(NWCFG, SPEED, 0, 1) | ||
22 | + FIELD(NWCFG, FULL_DUPLEX, 1, 1) | ||
23 | + FIELD(NWCFG, DISCARD_NON_VLAN_FRAMES, 2, 1) | ||
24 | + FIELD(NWCFG, JUMBO_FRAMES, 3, 1) | ||
25 | + FIELD(NWCFG, PROMISC, 4, 1) | ||
26 | + FIELD(NWCFG, NO_BROADCAST, 5, 1) | ||
27 | + FIELD(NWCFG, MULTICAST_HASH_EN, 6, 1) | ||
28 | + FIELD(NWCFG, UNICAST_HASH_EN, 7, 1) | ||
29 | + FIELD(NWCFG, RECV_1536_BYTE_FRAMES, 8, 1) | ||
30 | + FIELD(NWCFG, EXTERNAL_ADDR_MATCH_EN, 9, 1) | ||
31 | + FIELD(NWCFG, GIGABIT_MODE_ENABLE, 10, 1) | ||
32 | + FIELD(NWCFG, PCS_SELECT, 11, 1) | ||
33 | + FIELD(NWCFG, RETRY_TEST, 12, 1) | ||
34 | + FIELD(NWCFG, PAUSE_ENABLE, 13, 1) | ||
35 | + FIELD(NWCFG, RECV_BUF_OFFSET, 14, 2) | ||
36 | + FIELD(NWCFG, LEN_ERR_DISCARD, 16, 1) | ||
37 | + FIELD(NWCFG, FCS_REMOVE, 17, 1) | ||
38 | + FIELD(NWCFG, MDC_CLOCK_DIV, 18, 3) | ||
39 | + FIELD(NWCFG, DATA_BUS_WIDTH, 21, 2) | ||
40 | + FIELD(NWCFG, DISABLE_COPY_PAUSE_FRAMES, 23, 1) | ||
41 | + FIELD(NWCFG, RECV_CSUM_OFFLOAD_EN, 24, 1) | ||
42 | + FIELD(NWCFG, EN_HALF_DUPLEX_RX, 25, 1) | ||
43 | + FIELD(NWCFG, IGNORE_RX_FCS, 26, 1) | ||
44 | + FIELD(NWCFG, SGMII_MODE_ENABLE, 27, 1) | ||
45 | + FIELD(NWCFG, IPG_STRETCH_ENABLE, 28, 1) | ||
46 | + FIELD(NWCFG, NSP_ACCEPT, 29, 1) | ||
47 | + FIELD(NWCFG, IGNORE_IPG_RX_ER, 30, 1) | ||
48 | + FIELD(NWCFG, UNI_DIRECTION_ENABLE, 31, 1) | ||
49 | + | ||
50 | REG32(NWSTATUS, 0x8) /* Network Status reg */ | ||
51 | REG32(USERIO, 0xc) /* User IO reg */ | ||
52 | REG32(DMACFG, 0x10) /* DMA Control reg */ | ||
53 | @@ -XXX,XX +XXX,XX @@ REG32(TYPE2_COMPARE_0_WORD_1, 0x704) | ||
54 | FIELD(TYPE2_COMPARE_0_WORD_1, COMPARE_VLAN_ID, 10, 1) | ||
55 | |||
56 | /*****************************************/ | ||
57 | -#define GEM_NWCFG_STRIP_FCS 0x00020000 /* Strip FCS field */ | ||
58 | -#define GEM_NWCFG_LERR_DISC 0x00010000 /* Discard RX frames with len err */ | ||
59 | -#define GEM_NWCFG_BUFF_OFST_M 0x0000C000 /* Receive buffer offset mask */ | ||
60 | -#define GEM_NWCFG_BUFF_OFST_S 14 /* Receive buffer offset shift */ | ||
61 | -#define GEM_NWCFG_RCV_1538 0x00000100 /* Receive 1538 bytes frame */ | ||
62 | -#define GEM_NWCFG_UCAST_HASH 0x00000080 /* accept unicast if hash match */ | ||
63 | -#define GEM_NWCFG_MCAST_HASH 0x00000040 /* accept multicast if hash match */ | ||
64 | -#define GEM_NWCFG_BCAST_REJ 0x00000020 /* Reject broadcast packets */ | ||
65 | -#define GEM_NWCFG_PROMISC 0x00000010 /* Accept all packets */ | ||
66 | -#define GEM_NWCFG_JUMBO_FRAME 0x00000008 /* Jumbo Frames enable */ | ||
67 | - | ||
68 | #define GEM_DMACFG_ADDR_64B (1U << 30) | ||
69 | #define GEM_DMACFG_TX_BD_EXT (1U << 29) | ||
70 | #define GEM_DMACFG_RX_BD_EXT (1U << 28) | ||
71 | @@ -XXX,XX +XXX,XX @@ static const uint8_t broadcast_addr[] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; | ||
72 | static uint32_t gem_get_max_buf_len(CadenceGEMState *s, bool tx) | ||
73 | { | ||
74 | uint32_t size; | ||
75 | - if (s->regs[R_NWCFG] & GEM_NWCFG_JUMBO_FRAME) { | ||
76 | + if (FIELD_EX32(s->regs[R_NWCFG], NWCFG, JUMBO_FRAMES)) { | ||
77 | size = s->regs[R_JUMBO_MAX_LEN]; | ||
78 | if (size > s->jumbo_max_len) { | ||
79 | size = s->jumbo_max_len; | ||
80 | @@ -XXX,XX +XXX,XX @@ static uint32_t gem_get_max_buf_len(CadenceGEMState *s, bool tx) | ||
81 | } else if (tx) { | ||
82 | size = 1518; | ||
83 | } else { | ||
84 | - size = s->regs[R_NWCFG] & GEM_NWCFG_RCV_1538 ? 1538 : 1518; | ||
85 | + size = FIELD_EX32(s->regs[R_NWCFG], | ||
86 | + NWCFG, RECV_1536_BYTE_FRAMES) ? 1538 : 1518; | ||
87 | } | ||
88 | return size; | ||
89 | } | ||
90 | @@ -XXX,XX +XXX,XX @@ static int gem_mac_address_filter(CadenceGEMState *s, const uint8_t *packet) | ||
91 | int i, is_mc; | ||
92 | |||
93 | /* Promiscuous mode? */ | ||
94 | - if (s->regs[R_NWCFG] & GEM_NWCFG_PROMISC) { | ||
95 | + if (FIELD_EX32(s->regs[R_NWCFG], NWCFG, PROMISC)) { | ||
96 | return GEM_RX_PROMISCUOUS_ACCEPT; | ||
97 | } | ||
98 | |||
99 | if (!memcmp(packet, broadcast_addr, 6)) { | ||
100 | /* Reject broadcast packets? */ | ||
101 | - if (s->regs[R_NWCFG] & GEM_NWCFG_BCAST_REJ) { | ||
102 | + if (FIELD_EX32(s->regs[R_NWCFG], NWCFG, NO_BROADCAST)) { | ||
103 | return GEM_RX_REJECT; | ||
104 | } | ||
105 | return GEM_RX_BROADCAST_ACCEPT; | ||
106 | @@ -XXX,XX +XXX,XX @@ static int gem_mac_address_filter(CadenceGEMState *s, const uint8_t *packet) | ||
107 | |||
108 | /* Accept packets -w- hash match? */ | ||
109 | is_mc = is_multicast_ether_addr(packet); | ||
110 | - if ((is_mc && (s->regs[R_NWCFG] & GEM_NWCFG_MCAST_HASH)) || | ||
111 | - (!is_mc && (s->regs[R_NWCFG] & GEM_NWCFG_UCAST_HASH))) { | ||
112 | + if ((is_mc && (FIELD_EX32(s->regs[R_NWCFG], NWCFG, MULTICAST_HASH_EN))) || | ||
113 | + (!is_mc && FIELD_EX32(s->regs[R_NWCFG], NWCFG, UNICAST_HASH_EN))) { | ||
114 | uint64_t buckets; | ||
115 | unsigned hash_index; | ||
116 | |||
117 | @@ -XXX,XX +XXX,XX @@ static ssize_t gem_receive(NetClientState *nc, const uint8_t *buf, size_t size) | ||
118 | } | ||
119 | |||
120 | /* Discard packets with receive length error enabled ? */ | ||
121 | - if (s->regs[R_NWCFG] & GEM_NWCFG_LERR_DISC) { | ||
122 | + if (FIELD_EX32(s->regs[R_NWCFG], NWCFG, LEN_ERR_DISCARD)) { | ||
123 | unsigned type_len; | ||
124 | |||
125 | /* Fish the ethertype / length field out of the RX packet */ | ||
126 | @@ -XXX,XX +XXX,XX @@ static ssize_t gem_receive(NetClientState *nc, const uint8_t *buf, size_t size) | ||
127 | /* | ||
128 | * Determine configured receive buffer offset (probably 0) | ||
129 | */ | ||
130 | - rxbuf_offset = (s->regs[R_NWCFG] & GEM_NWCFG_BUFF_OFST_M) >> | ||
131 | - GEM_NWCFG_BUFF_OFST_S; | ||
132 | + rxbuf_offset = FIELD_EX32(s->regs[R_NWCFG], NWCFG, RECV_BUF_OFFSET); | ||
133 | |||
134 | /* The configure size of each receive buffer. Determines how many | ||
135 | * buffers needed to hold this packet. | ||
136 | @@ -XXX,XX +XXX,XX @@ static ssize_t gem_receive(NetClientState *nc, const uint8_t *buf, size_t size) | ||
137 | } | ||
138 | |||
139 | /* Strip of FCS field ? (usually yes) */ | ||
140 | - if (s->regs[R_NWCFG] & GEM_NWCFG_STRIP_FCS) { | ||
141 | + if (FIELD_EX32(s->regs[R_NWCFG], NWCFG, FCS_REMOVE)) { | ||
142 | rxbuf_ptr = (void *)buf; | ||
143 | } else { | ||
144 | unsigned crc_val; | ||
145 | -- | ||
146 | 2.34.1 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Luc Michel <luc.michel@amd.com> | ||
1 | 2 | ||
3 | Use de FIELD macro to describe the DMACFG register fields. | ||
4 | |||
5 | Signed-off-by: Luc Michel <luc.michel@amd.com> | ||
6 | Reviewed-by: sai.pavan.boddu@amd.com | ||
7 | Message-id: 20231017194422.4124691-6-luc.michel@amd.com | ||
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
9 | --- | ||
10 | hw/net/cadence_gem.c | 48 ++++++++++++++++++++++++++++---------------- | ||
11 | 1 file changed, 31 insertions(+), 17 deletions(-) | ||
12 | |||
13 | diff --git a/hw/net/cadence_gem.c b/hw/net/cadence_gem.c | ||
14 | index XXXXXXX..XXXXXXX 100644 | ||
15 | --- a/hw/net/cadence_gem.c | ||
16 | +++ b/hw/net/cadence_gem.c | ||
17 | @@ -XXX,XX +XXX,XX @@ REG32(NWCFG, 0x4) /* Network Config reg */ | ||
18 | |||
19 | REG32(NWSTATUS, 0x8) /* Network Status reg */ | ||
20 | REG32(USERIO, 0xc) /* User IO reg */ | ||
21 | + | ||
22 | REG32(DMACFG, 0x10) /* DMA Control reg */ | ||
23 | + FIELD(DMACFG, SEND_BCAST_TO_ALL_QS, 31, 1) | ||
24 | + FIELD(DMACFG, DMA_ADDR_BUS_WIDTH, 30, 1) | ||
25 | + FIELD(DMACFG, TX_BD_EXT_MODE_EN , 29, 1) | ||
26 | + FIELD(DMACFG, RX_BD_EXT_MODE_EN , 28, 1) | ||
27 | + FIELD(DMACFG, FORCE_MAX_AMBA_BURST_TX, 26, 1) | ||
28 | + FIELD(DMACFG, FORCE_MAX_AMBA_BURST_RX, 25, 1) | ||
29 | + FIELD(DMACFG, FORCE_DISCARD_ON_ERR, 24, 1) | ||
30 | + FIELD(DMACFG, RX_BUF_SIZE, 16, 8) | ||
31 | + FIELD(DMACFG, CRC_ERROR_REPORT, 13, 1) | ||
32 | + FIELD(DMACFG, INF_LAST_DBUF_SIZE_EN, 12, 1) | ||
33 | + FIELD(DMACFG, TX_PBUF_CSUM_OFFLOAD, 11, 1) | ||
34 | + FIELD(DMACFG, TX_PBUF_SIZE, 10, 1) | ||
35 | + FIELD(DMACFG, RX_PBUF_SIZE, 8, 2) | ||
36 | + FIELD(DMACFG, ENDIAN_SWAP_PACKET, 7, 1) | ||
37 | + FIELD(DMACFG, ENDIAN_SWAP_MGNT, 6, 1) | ||
38 | + FIELD(DMACFG, HDR_DATA_SPLIT_EN, 5, 1) | ||
39 | + FIELD(DMACFG, AMBA_BURST_LEN , 0, 5) | ||
40 | +#define GEM_DMACFG_RBUFSZ_MUL 64 /* DMA RX Buffer Size multiplier */ | ||
41 | + | ||
42 | REG32(TXSTATUS, 0x14) /* TX Status reg */ | ||
43 | REG32(RXQBASE, 0x18) /* RX Q Base address reg */ | ||
44 | REG32(TXQBASE, 0x1c) /* TX Q Base address reg */ | ||
45 | @@ -XXX,XX +XXX,XX @@ REG32(TYPE2_COMPARE_0_WORD_1, 0x704) | ||
46 | FIELD(TYPE2_COMPARE_0_WORD_1, COMPARE_VLAN_ID, 10, 1) | ||
47 | |||
48 | /*****************************************/ | ||
49 | -#define GEM_DMACFG_ADDR_64B (1U << 30) | ||
50 | -#define GEM_DMACFG_TX_BD_EXT (1U << 29) | ||
51 | -#define GEM_DMACFG_RX_BD_EXT (1U << 28) | ||
52 | -#define GEM_DMACFG_RBUFSZ_M 0x00FF0000 /* DMA RX Buffer Size mask */ | ||
53 | -#define GEM_DMACFG_RBUFSZ_S 16 /* DMA RX Buffer Size shift */ | ||
54 | -#define GEM_DMACFG_RBUFSZ_MUL 64 /* DMA RX Buffer Size multiplier */ | ||
55 | -#define GEM_DMACFG_TXCSUM_OFFL 0x00000800 /* Transmit checksum offload */ | ||
56 | |||
57 | #define GEM_TXSTATUS_TXCMPL 0x00000020 /* Transmit Complete */ | ||
58 | #define GEM_TXSTATUS_USED 0x00000001 /* sw owned descriptor encountered */ | ||
59 | @@ -XXX,XX +XXX,XX @@ static inline uint64_t tx_desc_get_buffer(CadenceGEMState *s, uint32_t *desc) | ||
60 | { | ||
61 | uint64_t ret = desc[0]; | ||
62 | |||
63 | - if (s->regs[R_DMACFG] & GEM_DMACFG_ADDR_64B) { | ||
64 | + if (FIELD_EX32(s->regs[R_DMACFG], DMACFG, DMA_ADDR_BUS_WIDTH)) { | ||
65 | ret |= (uint64_t)desc[2] << 32; | ||
66 | } | ||
67 | return ret; | ||
68 | @@ -XXX,XX +XXX,XX @@ static inline uint64_t rx_desc_get_buffer(CadenceGEMState *s, uint32_t *desc) | ||
69 | { | ||
70 | uint64_t ret = desc[0] & ~0x3UL; | ||
71 | |||
72 | - if (s->regs[R_DMACFG] & GEM_DMACFG_ADDR_64B) { | ||
73 | + if (FIELD_EX32(s->regs[R_DMACFG], DMACFG, DMA_ADDR_BUS_WIDTH)) { | ||
74 | ret |= (uint64_t)desc[2] << 32; | ||
75 | } | ||
76 | return ret; | ||
77 | @@ -XXX,XX +XXX,XX @@ static inline int gem_get_desc_len(CadenceGEMState *s, bool rx_n_tx) | ||
78 | { | ||
79 | int ret = 2; | ||
80 | |||
81 | - if (s->regs[R_DMACFG] & GEM_DMACFG_ADDR_64B) { | ||
82 | + if (FIELD_EX32(s->regs[R_DMACFG], DMACFG, DMA_ADDR_BUS_WIDTH)) { | ||
83 | ret += 2; | ||
84 | } | ||
85 | - if (s->regs[R_DMACFG] & (rx_n_tx ? GEM_DMACFG_RX_BD_EXT | ||
86 | - : GEM_DMACFG_TX_BD_EXT)) { | ||
87 | + if (s->regs[R_DMACFG] & (rx_n_tx ? R_DMACFG_RX_BD_EXT_MODE_EN_MASK | ||
88 | + : R_DMACFG_TX_BD_EXT_MODE_EN_MASK)) { | ||
89 | ret += 2; | ||
90 | } | ||
91 | |||
92 | @@ -XXX,XX +XXX,XX @@ static hwaddr gem_get_desc_addr(CadenceGEMState *s, bool tx, int q) | ||
93 | { | ||
94 | hwaddr desc_addr = 0; | ||
95 | |||
96 | - if (s->regs[R_DMACFG] & GEM_DMACFG_ADDR_64B) { | ||
97 | + if (FIELD_EX32(s->regs[R_DMACFG], DMACFG, DMA_ADDR_BUS_WIDTH)) { | ||
98 | desc_addr = s->regs[tx ? R_TBQPH : R_RBQPH]; | ||
99 | } | ||
100 | desc_addr <<= 32; | ||
101 | @@ -XXX,XX +XXX,XX @@ static ssize_t gem_receive(NetClientState *nc, const uint8_t *buf, size_t size) | ||
102 | /* The configure size of each receive buffer. Determines how many | ||
103 | * buffers needed to hold this packet. | ||
104 | */ | ||
105 | - rxbufsize = ((s->regs[R_DMACFG] & GEM_DMACFG_RBUFSZ_M) >> | ||
106 | - GEM_DMACFG_RBUFSZ_S) * GEM_DMACFG_RBUFSZ_MUL; | ||
107 | + rxbufsize = FIELD_EX32(s->regs[R_DMACFG], DMACFG, RX_BUF_SIZE); | ||
108 | + rxbufsize *= GEM_DMACFG_RBUFSZ_MUL; | ||
109 | + | ||
110 | bytes_to_copy = size; | ||
111 | |||
112 | /* Hardware allows a zero value here but warns against it. To avoid QEMU | ||
113 | @@ -XXX,XX +XXX,XX @@ static void gem_transmit(CadenceGEMState *s) | ||
114 | gem_update_int_status(s); | ||
115 | |||
116 | /* Is checksum offload enabled? */ | ||
117 | - if (s->regs[R_DMACFG] & GEM_DMACFG_TXCSUM_OFFL) { | ||
118 | + if (FIELD_EX32(s->regs[R_DMACFG], DMACFG, TX_PBUF_CSUM_OFFLOAD)) { | ||
119 | net_checksum_calculate(s->tx_packet, total_bytes, CSUM_ALL); | ||
120 | } | ||
121 | |||
122 | @@ -XXX,XX +XXX,XX @@ static void gem_transmit(CadenceGEMState *s) | ||
123 | |||
124 | /* read next descriptor */ | ||
125 | if (tx_desc_get_wrap(desc)) { | ||
126 | - if (s->regs[R_DMACFG] & GEM_DMACFG_ADDR_64B) { | ||
127 | + if (FIELD_EX32(s->regs[R_DMACFG], DMACFG, DMA_ADDR_BUS_WIDTH)) { | ||
128 | packet_desc_addr = s->regs[R_TBQPH]; | ||
129 | packet_desc_addr <<= 32; | ||
130 | } else { | ||
131 | -- | ||
132 | 2.34.1 | diff view generated by jsdifflib |
1 | Convert the Neon 3-reg-same VADD and VSUB insns to decodetree. | 1 | From: Luc Michel <luc.michel@amd.com> |
---|---|---|---|
2 | 2 | ||
3 | Note that we don't need the neon_3r_sizes[op] check here because all | 3 | Use de FIELD macro to describe the TXSTATUS and RXSTATUS register |
4 | size values are OK for VADD and VSUB; we'll add this when we convert | 4 | fields. |
5 | the first insn that has size restrictions. | ||
6 | 5 | ||
7 | For this we need one of the GVecGen*Fn typedefs currently in | 6 | Signed-off-by: Luc Michel <luc.michel@amd.com> |
8 | translate-a64.h; move them all to translate.h as a block so they | 7 | Reviewed-by: sai.pavan.boddu@amd.com |
9 | are visible to the 32-bit decoder. | 8 | Message-id: 20231017194422.4124691-7-luc.michel@amd.com |
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | --- | ||
11 | hw/net/cadence_gem.c | 34 +++++++++++++++++++++++++--------- | ||
12 | 1 file changed, 25 insertions(+), 9 deletions(-) | ||
10 | 13 | ||
11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 14 | diff --git a/hw/net/cadence_gem.c b/hw/net/cadence_gem.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 | 15 | index XXXXXXX..XXXXXXX 100644 |
24 | --- a/target/arm/translate-a64.h | 16 | --- a/hw/net/cadence_gem.c |
25 | +++ b/target/arm/translate-a64.h | 17 | +++ b/hw/net/cadence_gem.c |
26 | @@ -XXX,XX +XXX,XX @@ static inline int vec_full_reg_size(DisasContext *s) | 18 | @@ -XXX,XX +XXX,XX @@ REG32(DMACFG, 0x10) /* DMA Control reg */ |
27 | 19 | #define GEM_DMACFG_RBUFSZ_MUL 64 /* DMA RX Buffer Size multiplier */ | |
28 | bool disas_sve(DisasContext *, uint32_t); | 20 | |
29 | 21 | REG32(TXSTATUS, 0x14) /* TX Status reg */ | |
30 | -/* Note that the gvec expanders operate on offsets + sizes. */ | 22 | + FIELD(TXSTATUS, TX_USED_BIT_READ_MIDFRAME, 12, 1) |
31 | -typedef void GVecGen2Fn(unsigned, uint32_t, uint32_t, uint32_t, uint32_t); | 23 | + FIELD(TXSTATUS, TX_FRAME_TOO_LARGE, 11, 1) |
32 | -typedef void GVecGen2iFn(unsigned, uint32_t, uint32_t, int64_t, | 24 | + FIELD(TXSTATUS, TX_DMA_LOCKUP, 10, 1) |
33 | - uint32_t, uint32_t); | 25 | + FIELD(TXSTATUS, TX_MAC_LOCKUP, 9, 1) |
34 | -typedef void GVecGen3Fn(unsigned, uint32_t, uint32_t, | 26 | + FIELD(TXSTATUS, RESP_NOT_OK, 8, 1) |
35 | - uint32_t, uint32_t, uint32_t); | 27 | + FIELD(TXSTATUS, LATE_COLLISION, 7, 1) |
36 | -typedef void GVecGen4Fn(unsigned, uint32_t, uint32_t, uint32_t, | 28 | + FIELD(TXSTATUS, TRANSMIT_UNDER_RUN, 6, 1) |
37 | - uint32_t, uint32_t, uint32_t); | 29 | + FIELD(TXSTATUS, TRANSMIT_COMPLETE, 5, 1) |
30 | + FIELD(TXSTATUS, AMBA_ERROR, 4, 1) | ||
31 | + FIELD(TXSTATUS, TRANSMIT_GO, 3, 1) | ||
32 | + FIELD(TXSTATUS, RETRY_LIMIT, 2, 1) | ||
33 | + FIELD(TXSTATUS, COLLISION, 1, 1) | ||
34 | + FIELD(TXSTATUS, USED_BIT_READ, 0, 1) | ||
35 | + | ||
36 | REG32(RXQBASE, 0x18) /* RX Q Base address reg */ | ||
37 | REG32(TXQBASE, 0x1c) /* TX Q Base address reg */ | ||
38 | REG32(RXSTATUS, 0x20) /* RX Status reg */ | ||
39 | + FIELD(RXSTATUS, RX_DMA_LOCKUP, 5, 1) | ||
40 | + FIELD(RXSTATUS, RX_MAC_LOCKUP, 4, 1) | ||
41 | + FIELD(RXSTATUS, RESP_NOT_OK, 3, 1) | ||
42 | + FIELD(RXSTATUS, RECEIVE_OVERRUN, 2, 1) | ||
43 | + FIELD(RXSTATUS, FRAME_RECEIVED, 1, 1) | ||
44 | + FIELD(RXSTATUS, BUF_NOT_AVAILABLE, 0, 1) | ||
45 | + | ||
46 | REG32(ISR, 0x24) /* Interrupt Status reg */ | ||
47 | REG32(IER, 0x28) /* Interrupt Enable reg */ | ||
48 | REG32(IDR, 0x2c) /* Interrupt Disable reg */ | ||
49 | @@ -XXX,XX +XXX,XX @@ REG32(TYPE2_COMPARE_0_WORD_1, 0x704) | ||
50 | |||
51 | /*****************************************/ | ||
52 | |||
53 | -#define GEM_TXSTATUS_TXCMPL 0x00000020 /* Transmit Complete */ | ||
54 | -#define GEM_TXSTATUS_USED 0x00000001 /* sw owned descriptor encountered */ | ||
38 | - | 55 | - |
39 | #endif /* TARGET_ARM_TRANSLATE_A64_H */ | 56 | -#define GEM_RXSTATUS_FRMRCVD 0x00000002 /* Frame received */ |
40 | diff --git a/target/arm/translate.h b/target/arm/translate.h | 57 | -#define GEM_RXSTATUS_NOBUF 0x00000001 /* Buffer unavailable */ |
41 | index XXXXXXX..XXXXXXX 100644 | 58 | |
42 | --- a/target/arm/translate.h | 59 | /* GEM_ISR GEM_IER GEM_IDR GEM_IMR */ |
43 | +++ b/target/arm/translate.h | 60 | #define GEM_INT_TXCMPL 0x00000080 /* Transmit Complete */ |
44 | @@ -XXX,XX +XXX,XX @@ void gen_sshl_i64(TCGv_i64 d, TCGv_i64 a, TCGv_i64 b); | 61 | @@ -XXX,XX +XXX,XX @@ static void gem_get_rx_desc(CadenceGEMState *s, int q) |
45 | #define dc_isar_feature(name, ctx) \ | 62 | /* Descriptor owned by software ? */ |
46 | ({ DisasContext *ctx_ = (ctx); isar_feature_##name(ctx_->isar); }) | 63 | if (rx_desc_get_ownership(s->rx_desc[q]) == 1) { |
47 | 64 | DB_PRINT("descriptor 0x%" HWADDR_PRIx " owned by sw.\n", desc_addr); | |
48 | +/* Note that the gvec expanders operate on offsets + sizes. */ | 65 | - s->regs[R_RXSTATUS] |= GEM_RXSTATUS_NOBUF; |
49 | +typedef void GVecGen2Fn(unsigned, uint32_t, uint32_t, uint32_t, uint32_t); | 66 | + s->regs[R_RXSTATUS] |= R_RXSTATUS_BUF_NOT_AVAILABLE_MASK; |
50 | +typedef void GVecGen2iFn(unsigned, uint32_t, uint32_t, int64_t, | 67 | gem_set_isr(s, q, GEM_INT_RXUSED); |
51 | + uint32_t, uint32_t); | 68 | /* Handle interrupt consequences */ |
52 | +typedef void GVecGen3Fn(unsigned, uint32_t, uint32_t, | 69 | gem_update_int_status(s); |
53 | + uint32_t, uint32_t, uint32_t); | 70 | @@ -XXX,XX +XXX,XX @@ static ssize_t gem_receive(NetClientState *nc, const uint8_t *buf, size_t size) |
54 | +typedef void GVecGen4Fn(unsigned, uint32_t, uint32_t, uint32_t, | 71 | /* Count it */ |
55 | + uint32_t, uint32_t, uint32_t); | 72 | gem_receive_updatestats(s, buf, size); |
56 | + | 73 | |
57 | #endif /* TARGET_ARM_TRANSLATE_H */ | 74 | - s->regs[R_RXSTATUS] |= GEM_RXSTATUS_FRMRCVD; |
58 | diff --git a/target/arm/neon-dp.decode b/target/arm/neon-dp.decode | 75 | + s->regs[R_RXSTATUS] |= R_RXSTATUS_FRAME_RECEIVED_MASK; |
59 | index XXXXXXX..XXXXXXX 100644 | 76 | gem_set_isr(s, q, GEM_INT_RXCMPL); |
60 | --- a/target/arm/neon-dp.decode | 77 | |
61 | +++ b/target/arm/neon-dp.decode | 78 | /* Handle interrupt consequences */ |
62 | @@ -XXX,XX +XXX,XX @@ | 79 | @@ -XXX,XX +XXX,XX @@ static void gem_transmit(CadenceGEMState *s) |
63 | # | 80 | } |
64 | # This file is processed by scripts/decodetree.py | 81 | DB_PRINT("TX descriptor next: 0x%08x\n", s->tx_desc_addr[q]); |
65 | # | 82 | |
66 | +# VFP/Neon register fields; same as vfp.decode | 83 | - s->regs[R_TXSTATUS] |= GEM_TXSTATUS_TXCMPL; |
67 | +%vm_dp 5:1 0:4 | 84 | + s->regs[R_TXSTATUS] |= R_TXSTATUS_TRANSMIT_COMPLETE_MASK; |
68 | +%vn_dp 7:1 16:4 | 85 | gem_set_isr(s, q, GEM_INT_TXCMPL); |
69 | +%vd_dp 22:1 12:4 | 86 | |
70 | 87 | /* Handle interrupt consequences */ | |
71 | # Encodings for Neon data processing instructions where the T32 encoding | 88 | @@ -XXX,XX +XXX,XX @@ static void gem_transmit(CadenceGEMState *s) |
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 | } | ||
98 | + | ||
99 | +static bool do_3same(DisasContext *s, arg_3same *a, GVecGen3Fn fn) | ||
100 | +{ | ||
101 | + int vec_size = a->q ? 16 : 8; | ||
102 | + int rd_ofs = neon_reg_offset(a->vd, 0); | ||
103 | + int rn_ofs = neon_reg_offset(a->vn, 0); | ||
104 | + int rm_ofs = neon_reg_offset(a->vm, 0); | ||
105 | + | ||
106 | + if (!arm_dc_feature(s, ARM_FEATURE_NEON)) { | ||
107 | + return false; | ||
108 | + } | ||
109 | + | ||
110 | + /* UNDEF accesses to D16-D31 if they don't exist. */ | ||
111 | + if (!dc_isar_feature(aa32_simd_r32, s) && | ||
112 | + ((a->vd | a->vn | a->vm) & 0x10)) { | ||
113 | + return false; | ||
114 | + } | ||
115 | + | ||
116 | + if ((a->vn | a->vm | a->vd) & a->q) { | ||
117 | + return false; | ||
118 | + } | ||
119 | + | ||
120 | + if (!vfp_access_check(s)) { | ||
121 | + return true; | ||
122 | + } | ||
123 | + | ||
124 | + fn(a->size, rd_ofs, rn_ofs, rm_ofs, vec_size, vec_size); | ||
125 | + return true; | ||
126 | +} | ||
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 | } | 89 | } |
166 | 90 | ||
167 | if (size == 3) { | 91 | if (tx_desc_get_used(desc)) { |
92 | - s->regs[R_TXSTATUS] |= GEM_TXSTATUS_USED; | ||
93 | + s->regs[R_TXSTATUS] |= R_TXSTATUS_USED_BIT_READ_MASK; | ||
94 | /* IRQ TXUSED is defined only for queue 0 */ | ||
95 | if (q == 0) { | ||
96 | gem_set_isr(s, 0, GEM_INT_TXUSED); | ||
168 | -- | 97 | -- |
169 | 2.20.1 | 98 | 2.34.1 |
170 | |||
171 | diff view generated by jsdifflib |
1 | Convert the Neon 3-reg-same VMAX and VMIN insns to decodetree. | 1 | From: Luc Michel <luc.michel@amd.com> |
---|---|---|---|
2 | 2 | ||
3 | Use de FIELD macro to describe the IRQ related register fields. | ||
4 | |||
5 | Signed-off-by: Luc Michel <luc.michel@amd.com> | ||
6 | Reviewed-by: sai.pavan.boddu@amd.com | ||
7 | Message-id: 20231017194422.4124691-8-luc.michel@amd.com | ||
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> | ||
5 | Message-id: 20200430181003.21682-17-peter.maydell@linaro.org | ||
6 | --- | 9 | --- |
7 | target/arm/neon-dp.decode | 5 +++++ | 10 | hw/net/cadence_gem.c | 51 +++++++++++++++++++++++++++++++++----------- |
8 | target/arm/translate-neon.inc.c | 14 ++++++++++++++ | 11 | 1 file changed, 39 insertions(+), 12 deletions(-) |
9 | target/arm/translate.c | 21 ++------------------- | ||
10 | 3 files changed, 21 insertions(+), 19 deletions(-) | ||
11 | 12 | ||
12 | diff --git a/target/arm/neon-dp.decode b/target/arm/neon-dp.decode | 13 | diff --git a/hw/net/cadence_gem.c b/hw/net/cadence_gem.c |
13 | index XXXXXXX..XXXXXXX 100644 | 14 | index XXXXXXX..XXXXXXX 100644 |
14 | --- a/target/arm/neon-dp.decode | 15 | --- a/hw/net/cadence_gem.c |
15 | +++ b/target/arm/neon-dp.decode | 16 | +++ b/hw/net/cadence_gem.c |
16 | @@ -XXX,XX +XXX,XX @@ VBSL_3s 1111 001 1 0 . 01 .... .... 0001 ... 1 .... @3same_logic | 17 | @@ -XXX,XX +XXX,XX @@ REG32(RXSTATUS, 0x20) /* RX Status reg */ |
17 | VBIT_3s 1111 001 1 0 . 10 .... .... 0001 ... 1 .... @3same_logic | 18 | FIELD(RXSTATUS, BUF_NOT_AVAILABLE, 0, 1) |
18 | VBIF_3s 1111 001 1 0 . 11 .... .... 0001 ... 1 .... @3same_logic | 19 | |
19 | 20 | REG32(ISR, 0x24) /* Interrupt Status reg */ | |
20 | +VMAX_S_3s 1111 001 0 0 . .. .... .... 0110 . . . 0 .... @3same | 21 | + FIELD(ISR, TX_LOCKUP, 31, 1) |
21 | +VMAX_U_3s 1111 001 1 0 . .. .... .... 0110 . . . 0 .... @3same | 22 | + FIELD(ISR, RX_LOCKUP, 30, 1) |
22 | +VMIN_S_3s 1111 001 0 0 . .. .... .... 0110 . . . 1 .... @3same | 23 | + FIELD(ISR, TSU_TIMER, 29, 1) |
23 | +VMIN_U_3s 1111 001 1 0 . .. .... .... 0110 . . . 1 .... @3same | 24 | + FIELD(ISR, WOL, 28, 1) |
25 | + FIELD(ISR, RECV_LPI, 27, 1) | ||
26 | + FIELD(ISR, TSU_SEC_INCR, 26, 1) | ||
27 | + FIELD(ISR, PTP_PDELAY_RESP_XMIT, 25, 1) | ||
28 | + FIELD(ISR, PTP_PDELAY_REQ_XMIT, 24, 1) | ||
29 | + FIELD(ISR, PTP_PDELAY_RESP_RECV, 23, 1) | ||
30 | + FIELD(ISR, PTP_PDELAY_REQ_RECV, 22, 1) | ||
31 | + FIELD(ISR, PTP_SYNC_XMIT, 21, 1) | ||
32 | + FIELD(ISR, PTP_DELAY_REQ_XMIT, 20, 1) | ||
33 | + FIELD(ISR, PTP_SYNC_RECV, 19, 1) | ||
34 | + FIELD(ISR, PTP_DELAY_REQ_RECV, 18, 1) | ||
35 | + FIELD(ISR, PCS_LP_PAGE_RECV, 17, 1) | ||
36 | + FIELD(ISR, PCS_AN_COMPLETE, 16, 1) | ||
37 | + FIELD(ISR, EXT_IRQ, 15, 1) | ||
38 | + FIELD(ISR, PAUSE_FRAME_XMIT, 14, 1) | ||
39 | + FIELD(ISR, PAUSE_TIME_ELAPSED, 13, 1) | ||
40 | + FIELD(ISR, PAUSE_FRAME_RECV, 12, 1) | ||
41 | + FIELD(ISR, RESP_NOT_OK, 11, 1) | ||
42 | + FIELD(ISR, RECV_OVERRUN, 10, 1) | ||
43 | + FIELD(ISR, LINK_CHANGE, 9, 1) | ||
44 | + FIELD(ISR, USXGMII_INT, 8, 1) | ||
45 | + FIELD(ISR, XMIT_COMPLETE, 7, 1) | ||
46 | + FIELD(ISR, AMBA_ERROR, 6, 1) | ||
47 | + FIELD(ISR, RETRY_EXCEEDED, 5, 1) | ||
48 | + FIELD(ISR, XMIT_UNDER_RUN, 4, 1) | ||
49 | + FIELD(ISR, TX_USED, 3, 1) | ||
50 | + FIELD(ISR, RX_USED, 2, 1) | ||
51 | + FIELD(ISR, RECV_COMPLETE, 1, 1) | ||
52 | + FIELD(ISR, MGNT_FRAME_SENT, 0, 1) | ||
53 | REG32(IER, 0x28) /* Interrupt Enable reg */ | ||
54 | REG32(IDR, 0x2c) /* Interrupt Disable reg */ | ||
55 | REG32(IMR, 0x30) /* Interrupt Mask reg */ | ||
24 | + | 56 | + |
25 | VADD_3s 1111 001 0 0 . .. .... .... 1000 . . . 0 .... @3same | 57 | REG32(PHYMNTNC, 0x34) /* Phy Maintenance reg */ |
26 | VSUB_3s 1111 001 1 0 . .. .... .... 1000 . . . 0 .... @3same | 58 | REG32(RXPAUSE, 0x38) /* RX Pause Time reg */ |
27 | diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c | 59 | REG32(TXPAUSE, 0x3c) /* TX Pause Time reg */ |
28 | index XXXXXXX..XXXXXXX 100644 | 60 | @@ -XXX,XX +XXX,XX @@ REG32(TYPE2_COMPARE_0_WORD_1, 0x704) |
29 | --- a/target/arm/translate-neon.inc.c | 61 | /*****************************************/ |
30 | +++ b/target/arm/translate-neon.inc.c | 62 | |
31 | @@ -XXX,XX +XXX,XX @@ DO_3SAME(VEOR, tcg_gen_gvec_xor) | 63 | |
32 | DO_3SAME_BITSEL(VBSL, rd_ofs, rn_ofs, rm_ofs) | 64 | -/* GEM_ISR GEM_IER GEM_IDR GEM_IMR */ |
33 | DO_3SAME_BITSEL(VBIT, rm_ofs, rn_ofs, rd_ofs) | 65 | -#define GEM_INT_TXCMPL 0x00000080 /* Transmit Complete */ |
34 | DO_3SAME_BITSEL(VBIF, rm_ofs, rd_ofs, rn_ofs) | 66 | -#define GEM_INT_AMBA_ERR 0x00000040 |
35 | + | 67 | -#define GEM_INT_TXUSED 0x00000008 |
36 | +#define DO_3SAME_NO_SZ_3(INSN, FUNC) \ | 68 | -#define GEM_INT_RXUSED 0x00000004 |
37 | + static bool trans_##INSN##_3s(DisasContext *s, arg_3same *a) \ | 69 | -#define GEM_INT_RXCMPL 0x00000002 |
38 | + { \ | 70 | |
39 | + if (a->size == 3) { \ | 71 | #define GEM_PHYMNTNC_OP_R 0x20000000 /* read operation */ |
40 | + return false; \ | 72 | #define GEM_PHYMNTNC_OP_W 0x10000000 /* write operation */ |
41 | + } \ | 73 | @@ -XXX,XX +XXX,XX @@ static void gem_get_rx_desc(CadenceGEMState *s, int q) |
42 | + return do_3same(s, a, FUNC); \ | 74 | if (rx_desc_get_ownership(s->rx_desc[q]) == 1) { |
43 | + } | 75 | DB_PRINT("descriptor 0x%" HWADDR_PRIx " owned by sw.\n", desc_addr); |
44 | + | 76 | s->regs[R_RXSTATUS] |= R_RXSTATUS_BUF_NOT_AVAILABLE_MASK; |
45 | +DO_3SAME_NO_SZ_3(VMAX_S, tcg_gen_gvec_smax) | 77 | - gem_set_isr(s, q, GEM_INT_RXUSED); |
46 | +DO_3SAME_NO_SZ_3(VMAX_U, tcg_gen_gvec_umax) | 78 | + gem_set_isr(s, q, R_ISR_RX_USED_MASK); |
47 | +DO_3SAME_NO_SZ_3(VMIN_S, tcg_gen_gvec_smin) | 79 | /* Handle interrupt consequences */ |
48 | +DO_3SAME_NO_SZ_3(VMIN_U, tcg_gen_gvec_umin) | 80 | gem_update_int_status(s); |
49 | diff --git a/target/arm/translate.c b/target/arm/translate.c | 81 | } |
50 | index XXXXXXX..XXXXXXX 100644 | 82 | @@ -XXX,XX +XXX,XX @@ static ssize_t gem_receive(NetClientState *nc, const uint8_t *buf, size_t size) |
51 | --- a/target/arm/translate.c | 83 | |
52 | +++ b/target/arm/translate.c | 84 | if (size > gem_get_max_buf_len(s, false)) { |
53 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) | 85 | qemu_log_mask(LOG_GUEST_ERROR, "rx frame too long\n"); |
54 | rd_ofs, rn_ofs, rm_ofs, vec_size, vec_size); | 86 | - gem_set_isr(s, q, GEM_INT_AMBA_ERR); |
55 | return 0; | 87 | + gem_set_isr(s, q, R_ISR_AMBA_ERROR_MASK); |
56 | 88 | return -1; | |
57 | - case NEON_3R_VMAX: | 89 | } |
58 | - if (u) { | 90 | |
59 | - tcg_gen_gvec_umax(size, rd_ofs, rn_ofs, rm_ofs, | 91 | @@ -XXX,XX +XXX,XX @@ static ssize_t gem_receive(NetClientState *nc, const uint8_t *buf, size_t size) |
60 | - vec_size, vec_size); | 92 | gem_receive_updatestats(s, buf, size); |
61 | - } else { | 93 | |
62 | - tcg_gen_gvec_smax(size, rd_ofs, rn_ofs, rm_ofs, | 94 | s->regs[R_RXSTATUS] |= R_RXSTATUS_FRAME_RECEIVED_MASK; |
63 | - vec_size, vec_size); | 95 | - gem_set_isr(s, q, GEM_INT_RXCMPL); |
64 | - } | 96 | + gem_set_isr(s, q, R_ISR_RECV_COMPLETE_MASK); |
65 | - return 0; | 97 | |
66 | - case NEON_3R_VMIN: | 98 | /* Handle interrupt consequences */ |
67 | - if (u) { | 99 | gem_update_int_status(s); |
68 | - tcg_gen_gvec_umin(size, rd_ofs, rn_ofs, rm_ofs, | 100 | @@ -XXX,XX +XXX,XX @@ static void gem_transmit(CadenceGEMState *s) |
69 | - vec_size, vec_size); | 101 | HWADDR_PRIx " too large: size 0x%x space 0x%zx\n", |
70 | - } else { | 102 | packet_desc_addr, tx_desc_get_length(desc), |
71 | - tcg_gen_gvec_smin(size, rd_ofs, rn_ofs, rm_ofs, | 103 | gem_get_max_buf_len(s, true) - (p - s->tx_packet)); |
72 | - vec_size, vec_size); | 104 | - gem_set_isr(s, q, GEM_INT_AMBA_ERR); |
73 | - } | 105 | + gem_set_isr(s, q, R_ISR_AMBA_ERROR_MASK); |
74 | - return 0; | 106 | break; |
75 | - | 107 | } |
76 | case NEON_3R_VSHL: | 108 | |
77 | /* Note the operation is vshl vd,vm,vn */ | 109 | @@ -XXX,XX +XXX,XX @@ static void gem_transmit(CadenceGEMState *s) |
78 | tcg_gen_gvec_3(rd_ofs, rm_ofs, rn_ofs, vec_size, vec_size, | 110 | DB_PRINT("TX descriptor next: 0x%08x\n", s->tx_desc_addr[q]); |
79 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) | 111 | |
80 | 112 | s->regs[R_TXSTATUS] |= R_TXSTATUS_TRANSMIT_COMPLETE_MASK; | |
81 | case NEON_3R_VADD_VSUB: | 113 | - gem_set_isr(s, q, GEM_INT_TXCMPL); |
82 | case NEON_3R_LOGIC: | 114 | + gem_set_isr(s, q, R_ISR_XMIT_COMPLETE_MASK); |
83 | + case NEON_3R_VMAX: | 115 | |
84 | + case NEON_3R_VMIN: | 116 | /* Handle interrupt consequences */ |
85 | /* Already handled by decodetree */ | 117 | gem_update_int_status(s); |
86 | return 1; | 118 | @@ -XXX,XX +XXX,XX @@ static void gem_transmit(CadenceGEMState *s) |
119 | s->regs[R_TXSTATUS] |= R_TXSTATUS_USED_BIT_READ_MASK; | ||
120 | /* IRQ TXUSED is defined only for queue 0 */ | ||
121 | if (q == 0) { | ||
122 | - gem_set_isr(s, 0, GEM_INT_TXUSED); | ||
123 | + gem_set_isr(s, 0, R_ISR_TX_USED_MASK); | ||
124 | } | ||
125 | gem_update_int_status(s); | ||
87 | } | 126 | } |
88 | -- | 127 | -- |
89 | 2.20.1 | 128 | 2.34.1 |
90 | |||
91 | diff view generated by jsdifflib |
1 | From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com> | 1 | From: Luc Michel <luc.michel@amd.com> |
---|---|---|---|
2 | 2 | ||
3 | Remove inclusion of arm_gicv3_common.h, this already gets | 3 | Use the FIELD macro to describe the DESCONF6 register fields. |
4 | included via xlnx-versal.h. | ||
5 | 4 | ||
6 | Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | 5 | Signed-off-by: Luc Michel <luc.michel@amd.com> |
7 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | 6 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
8 | Reviewed-by: Luc Michel <luc.michel@greensocs.com> | 7 | Message-id: 20231017194422.4124691-9-luc.michel@amd.com |
9 | Message-id: 20200427181649.26851-2-edgar.iglesias@gmail.com | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
11 | --- | 9 | --- |
12 | hw/arm/xlnx-versal.c | 1 - | 10 | hw/net/cadence_gem.c | 4 ++-- |
13 | 1 file changed, 1 deletion(-) | 11 | 1 file changed, 2 insertions(+), 2 deletions(-) |
14 | 12 | ||
15 | diff --git a/hw/arm/xlnx-versal.c b/hw/arm/xlnx-versal.c | 13 | diff --git a/hw/net/cadence_gem.c b/hw/net/cadence_gem.c |
16 | index XXXXXXX..XXXXXXX 100644 | 14 | index XXXXXXX..XXXXXXX 100644 |
17 | --- a/hw/arm/xlnx-versal.c | 15 | --- a/hw/net/cadence_gem.c |
18 | +++ b/hw/arm/xlnx-versal.c | 16 | +++ b/hw/net/cadence_gem.c |
19 | @@ -XXX,XX +XXX,XX @@ | 17 | @@ -XXX,XX +XXX,XX @@ REG32(DESCONF3, 0x288) |
20 | #include "hw/arm/boot.h" | 18 | REG32(DESCONF4, 0x28c) |
21 | #include "kvm_arm.h" | 19 | REG32(DESCONF5, 0x290) |
22 | #include "hw/misc/unimp.h" | 20 | REG32(DESCONF6, 0x294) |
23 | -#include "hw/intc/arm_gicv3_common.h" | 21 | -#define GEM_DESCONF6_64B_MASK (1U << 23) |
24 | #include "hw/arm/xlnx-versal.h" | 22 | + FIELD(DESCONF6, DMA_ADDR_64B, 23, 1) |
25 | #include "hw/char/pl011.h" | 23 | REG32(DESCONF7, 0x298) |
24 | |||
25 | REG32(INT_Q1_STATUS, 0x400) | ||
26 | @@ -XXX,XX +XXX,XX @@ static void gem_reset(DeviceState *d) | ||
27 | s->regs[R_DESCONF] = 0x02D00111; | ||
28 | s->regs[R_DESCONF2] = 0x2ab10000 | s->jumbo_max_len; | ||
29 | s->regs[R_DESCONF5] = 0x002f2045; | ||
30 | - s->regs[R_DESCONF6] = GEM_DESCONF6_64B_MASK; | ||
31 | + s->regs[R_DESCONF6] = R_DESCONF6_DMA_ADDR_64B_MASK; | ||
32 | s->regs[R_INT_Q1_MASK] = 0x00000CE6; | ||
33 | s->regs[R_JUMBO_MAX_LEN] = s->jumbo_max_len; | ||
26 | 34 | ||
27 | -- | 35 | -- |
28 | 2.20.1 | 36 | 2.34.1 |
29 | 37 | ||
30 | 38 | diff view generated by jsdifflib |
1 | Convert the Neon logic ops in the 3-reg-same grouping to decodetree. | 1 | From: Luc Michel <luc.michel@amd.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 the FIELD macro to describe the PHYMNTNC register fields. | ||
4 | |||
5 | Signed-off-by: Luc Michel <luc.michel@amd.com> | ||
6 | Reviewed-by: sai.pavan.boddu@amd.com | ||
7 | Message-id: 20231017194422.4124691-10-luc.michel@amd.com | ||
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> | ||
7 | Message-id: 20200430181003.21682-16-peter.maydell@linaro.org | ||
8 | --- | 9 | --- |
9 | target/arm/neon-dp.decode | 12 +++++++++++ | 10 | hw/net/cadence_gem.c | 27 ++++++++++++++------------- |
10 | target/arm/translate-neon.inc.c | 19 +++++++++++++++++ | 11 | 1 file changed, 14 insertions(+), 13 deletions(-) |
11 | target/arm/translate.c | 38 +-------------------------------- | ||
12 | 3 files changed, 32 insertions(+), 37 deletions(-) | ||
13 | 12 | ||
14 | diff --git a/target/arm/neon-dp.decode b/target/arm/neon-dp.decode | 13 | diff --git a/hw/net/cadence_gem.c b/hw/net/cadence_gem.c |
15 | index XXXXXXX..XXXXXXX 100644 | 14 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/target/arm/neon-dp.decode | 15 | --- a/hw/net/cadence_gem.c |
17 | +++ b/target/arm/neon-dp.decode | 16 | +++ b/hw/net/cadence_gem.c |
18 | @@ -XXX,XX +XXX,XX @@ | 17 | @@ -XXX,XX +XXX,XX @@ REG32(IDR, 0x2c) /* Interrupt Disable reg */ |
19 | @3same .... ... . . . size:2 .... .... .... . q:1 . . .... \ | 18 | REG32(IMR, 0x30) /* Interrupt Mask reg */ |
20 | &3same vm=%vm_dp vn=%vn_dp vd=%vd_dp | 19 | |
21 | 20 | REG32(PHYMNTNC, 0x34) /* Phy Maintenance reg */ | |
22 | +@3same_logic .... ... . . . .. .... .... .... . q:1 .. .... \ | 21 | + FIELD(PHYMNTNC, DATA, 0, 16) |
23 | + &3same vm=%vm_dp vn=%vn_dp vd=%vd_dp size=0 | 22 | + FIELD(PHYMNTNC, REG_ADDR, 18, 5) |
23 | + FIELD(PHYMNTNC, PHY_ADDR, 23, 5) | ||
24 | + FIELD(PHYMNTNC, OP, 28, 2) | ||
25 | + FIELD(PHYMNTNC, ST, 30, 2) | ||
26 | +#define MDIO_OP_READ 0x3 | ||
27 | +#define MDIO_OP_WRITE 0x2 | ||
24 | + | 28 | + |
25 | +VAND_3s 1111 001 0 0 . 00 .... .... 0001 ... 1 .... @3same_logic | 29 | REG32(RXPAUSE, 0x38) /* RX Pause Time reg */ |
26 | +VBIC_3s 1111 001 0 0 . 01 .... .... 0001 ... 1 .... @3same_logic | 30 | REG32(TXPAUSE, 0x3c) /* TX Pause Time reg */ |
27 | +VORR_3s 1111 001 0 0 . 10 .... .... 0001 ... 1 .... @3same_logic | 31 | REG32(TXPARTIALSF, 0x40) /* TX Partial Store and Forward */ |
28 | +VORN_3s 1111 001 0 0 . 11 .... .... 0001 ... 1 .... @3same_logic | 32 | @@ -XXX,XX +XXX,XX @@ REG32(TYPE2_COMPARE_0_WORD_1, 0x704) |
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 | |
31 | +VBIT_3s 1111 001 1 0 . 10 .... .... 0001 ... 1 .... @3same_logic | 35 | |
32 | +VBIF_3s 1111 001 1 0 . 11 .... .... 0001 ... 1 .... @3same_logic | 36 | -#define GEM_PHYMNTNC_OP_R 0x20000000 /* read operation */ |
33 | + | 37 | -#define GEM_PHYMNTNC_OP_W 0x10000000 /* write operation */ |
34 | VADD_3s 1111 001 0 0 . .. .... .... 1000 . . . 0 .... @3same | 38 | -#define GEM_PHYMNTNC_ADDR 0x0F800000 /* Address bits */ |
35 | VSUB_3s 1111 001 1 0 . .. .... .... 1000 . . . 0 .... @3same | 39 | -#define GEM_PHYMNTNC_ADDR_SHFT 23 |
36 | diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c | 40 | -#define GEM_PHYMNTNC_REG 0x007C0000 /* register bits */ |
37 | index XXXXXXX..XXXXXXX 100644 | 41 | -#define GEM_PHYMNTNC_REG_SHIFT 18 |
38 | --- a/target/arm/translate-neon.inc.c | 42 | - |
39 | +++ b/target/arm/translate-neon.inc.c | 43 | /* Marvell PHY definitions */ |
40 | @@ -XXX,XX +XXX,XX @@ static bool do_3same(DisasContext *s, arg_3same *a, GVecGen3Fn fn) | 44 | #define BOARD_PHY_ADDRESS 0 /* PHY address we will emulate a device at */ |
41 | 45 | ||
42 | DO_3SAME(VADD, tcg_gen_gvec_add) | 46 | @@ -XXX,XX +XXX,XX @@ static uint64_t gem_read(void *opaque, hwaddr offset, unsigned size) |
43 | DO_3SAME(VSUB, tcg_gen_gvec_sub) | 47 | /* The interrupts get updated at the end of the function. */ |
44 | +DO_3SAME(VAND, tcg_gen_gvec_and) | 48 | break; |
45 | +DO_3SAME(VBIC, tcg_gen_gvec_andc) | 49 | case R_PHYMNTNC: |
46 | +DO_3SAME(VORR, tcg_gen_gvec_or) | 50 | - if (retval & GEM_PHYMNTNC_OP_R) { |
47 | +DO_3SAME(VORN, tcg_gen_gvec_orc) | 51 | + if (FIELD_EX32(retval, PHYMNTNC, OP) == MDIO_OP_READ) { |
48 | +DO_3SAME(VEOR, tcg_gen_gvec_xor) | 52 | uint32_t phy_addr, reg_num; |
49 | + | 53 | |
50 | +/* These insns are all gvec_bitsel but with the inputs in various orders. */ | 54 | - phy_addr = (retval & GEM_PHYMNTNC_ADDR) >> GEM_PHYMNTNC_ADDR_SHFT; |
51 | +#define DO_3SAME_BITSEL(INSN, O1, O2, O3) \ | 55 | + phy_addr = FIELD_EX32(retval, PHYMNTNC, PHY_ADDR); |
52 | + static void gen_##INSN##_3s(unsigned vece, uint32_t rd_ofs, \ | 56 | if (phy_addr == s->phy_addr) { |
53 | + uint32_t rn_ofs, uint32_t rm_ofs, \ | 57 | - reg_num = (retval & GEM_PHYMNTNC_REG) >> GEM_PHYMNTNC_REG_SHIFT; |
54 | + uint32_t oprsz, uint32_t maxsz) \ | 58 | + reg_num = FIELD_EX32(retval, PHYMNTNC, REG_ADDR); |
55 | + { \ | 59 | retval &= 0xFFFF0000; |
56 | + tcg_gen_gvec_bitsel(vece, rd_ofs, O1, O2, O3, oprsz, maxsz); \ | 60 | retval |= gem_phy_read(s, reg_num); |
57 | + } \ | 61 | } else { |
58 | + DO_3SAME(INSN, gen_##INSN##_3s) | 62 | @@ -XXX,XX +XXX,XX @@ static void gem_write(void *opaque, hwaddr offset, uint64_t val, |
59 | + | 63 | s->sar_active[(offset - R_SPADDR1HI) / 2] = true; |
60 | +DO_3SAME_BITSEL(VBSL, rd_ofs, rn_ofs, rm_ofs) | 64 | break; |
61 | +DO_3SAME_BITSEL(VBIT, rm_ofs, rn_ofs, rd_ofs) | 65 | case R_PHYMNTNC: |
62 | +DO_3SAME_BITSEL(VBIF, rm_ofs, rd_ofs, rn_ofs) | 66 | - if (val & GEM_PHYMNTNC_OP_W) { |
63 | diff --git a/target/arm/translate.c b/target/arm/translate.c | 67 | + if (FIELD_EX32(val, PHYMNTNC, OP) == MDIO_OP_WRITE) { |
64 | index XXXXXXX..XXXXXXX 100644 | 68 | uint32_t phy_addr, reg_num; |
65 | --- a/target/arm/translate.c | 69 | |
66 | +++ b/target/arm/translate.c | 70 | - phy_addr = (val & GEM_PHYMNTNC_ADDR) >> GEM_PHYMNTNC_ADDR_SHFT; |
67 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) | 71 | + phy_addr = FIELD_EX32(val, PHYMNTNC, PHY_ADDR); |
72 | if (phy_addr == s->phy_addr) { | ||
73 | - reg_num = (val & GEM_PHYMNTNC_REG) >> GEM_PHYMNTNC_REG_SHIFT; | ||
74 | + reg_num = FIELD_EX32(val, PHYMNTNC, REG_ADDR); | ||
75 | gem_phy_write(s, reg_num, val); | ||
68 | } | 76 | } |
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 | } | 77 | } |
119 | -- | 78 | -- |
120 | 2.20.1 | 79 | 2.34.1 |
121 | |||
122 | diff view generated by jsdifflib |
1 | From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com> | 1 | From: Luc Michel <luc.michel@amd.com> |
---|---|---|---|
2 | 2 | ||
3 | Add support for SD. | 3 | The MDIO access is done only on a write to the PHYMNTNC register. A |
4 | subsequent read is used to retrieve the result but does not trigger an | ||
5 | MDIO access by itself. | ||
4 | 6 | ||
5 | Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | 7 | Refactor the PHY access logic to perform all accesses (MDIO reads and |
6 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | 8 | writes) at PHYMNTNC write time. |
7 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 9 | |
8 | Reviewed-by: Luc Michel <luc.michel@greensocs.com> | 10 | Signed-off-by: Luc Michel <luc.michel@amd.com> |
9 | Message-id: 20200427181649.26851-9-edgar.iglesias@gmail.com | 11 | Reviewed-by: sai.pavan.boddu@amd.com |
12 | Message-id: 20231017194422.4124691-11-luc.michel@amd.com | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 13 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
11 | --- | 14 | --- |
12 | include/hw/arm/xlnx-versal.h | 12 ++++++++++++ | 15 | hw/net/cadence_gem.c | 56 ++++++++++++++++++++++++++------------------ |
13 | hw/arm/xlnx-versal.c | 31 +++++++++++++++++++++++++++++++ | 16 | 1 file changed, 33 insertions(+), 23 deletions(-) |
14 | 2 files changed, 43 insertions(+) | ||
15 | 17 | ||
16 | diff --git a/include/hw/arm/xlnx-versal.h b/include/hw/arm/xlnx-versal.h | 18 | diff --git a/hw/net/cadence_gem.c b/hw/net/cadence_gem.c |
17 | index XXXXXXX..XXXXXXX 100644 | 19 | index XXXXXXX..XXXXXXX 100644 |
18 | --- a/include/hw/arm/xlnx-versal.h | 20 | --- a/hw/net/cadence_gem.c |
19 | +++ b/include/hw/arm/xlnx-versal.h | 21 | +++ b/hw/net/cadence_gem.c |
20 | @@ -XXX,XX +XXX,XX @@ | 22 | @@ -XXX,XX +XXX,XX @@ static void gem_phy_write(CadenceGEMState *s, unsigned reg_num, uint16_t val) |
21 | 23 | s->phy_regs[reg_num] = val; | |
22 | #include "hw/sysbus.h" | 24 | } |
23 | #include "hw/arm/boot.h" | 25 | |
24 | +#include "hw/sd/sdhci.h" | 26 | +static void gem_handle_phy_access(CadenceGEMState *s) |
25 | #include "hw/intc/arm_gicv3.h" | 27 | +{ |
26 | #include "hw/char/pl011.h" | 28 | + uint32_t val = s->regs[R_PHYMNTNC]; |
27 | #include "hw/dma/xlnx-zdma.h" | 29 | + uint32_t phy_addr, reg_num; |
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 | + | 30 | + |
47 | struct { | 31 | + phy_addr = FIELD_EX32(val, PHYMNTNC, PHY_ADDR); |
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 | } | ||
73 | } | ||
74 | |||
75 | +#define SDHCI_CAPABILITIES 0x280737ec6481 /* Same as on ZynqMP. */ | ||
76 | +static void versal_create_sds(Versal *s, qemu_irq *pic) | ||
77 | +{ | ||
78 | + int i; | ||
79 | + | 32 | + |
80 | + for (i = 0; i < ARRAY_SIZE(s->pmc.iou.sd); i++) { | 33 | + if (phy_addr != s->phy_addr) { |
81 | + DeviceState *dev; | 34 | + /* no phy at this address */ |
82 | + MemoryRegion *mr; | 35 | + if (FIELD_EX32(val, PHYMNTNC, OP) == MDIO_OP_READ) { |
36 | + s->regs[R_PHYMNTNC] = FIELD_DP32(val, PHYMNTNC, DATA, 0xffff); | ||
37 | + } | ||
38 | + return; | ||
39 | + } | ||
83 | + | 40 | + |
84 | + sysbus_init_child_obj(OBJECT(s), "sd[*]", | 41 | + reg_num = FIELD_EX32(val, PHYMNTNC, REG_ADDR); |
85 | + &s->pmc.iou.sd[i], sizeof(s->pmc.iou.sd[i]), | ||
86 | + TYPE_SYSBUS_SDHCI); | ||
87 | + dev = DEVICE(&s->pmc.iou.sd[i]); | ||
88 | + | 42 | + |
89 | + object_property_set_uint(OBJECT(dev), | 43 | + switch (FIELD_EX32(val, PHYMNTNC, OP)) { |
90 | + 3, "sd-spec-version", &error_fatal); | 44 | + case MDIO_OP_READ: |
91 | + object_property_set_uint(OBJECT(dev), SDHCI_CAPABILITIES, "capareg", | 45 | + s->regs[R_PHYMNTNC] = FIELD_DP32(val, PHYMNTNC, DATA, |
92 | + &error_fatal); | 46 | + gem_phy_read(s, reg_num)); |
93 | + object_property_set_uint(OBJECT(dev), UHS_I, "uhs", &error_fatal); | 47 | + break; |
94 | + qdev_init_nofail(dev); | ||
95 | + | 48 | + |
96 | + mr = sysbus_mmio_get_region(SYS_BUS_DEVICE(dev), 0); | 49 | + case MDIO_OP_WRITE: |
97 | + memory_region_add_subregion(&s->mr_ps, | 50 | + gem_phy_write(s, reg_num, val); |
98 | + MM_PMC_SD0 + i * MM_PMC_SD0_SIZE, mr); | 51 | + break; |
99 | + | 52 | + |
100 | + sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, | 53 | + default: |
101 | + pic[VERSAL_SD0_IRQ_0 + i * 2]); | 54 | + break; /* only clause 22 operations are supported */ |
102 | + } | 55 | + } |
103 | +} | 56 | +} |
104 | + | 57 | + |
105 | /* This takes the board allocated linear DDR memory and creates aliases | 58 | /* |
106 | * for each split DDR range/aperture on the Versal address map. | 59 | * gem_read32: |
107 | */ | 60 | * Read a GEM register. |
108 | @@ -XXX,XX +XXX,XX @@ static void versal_realize(DeviceState *dev, Error **errp) | 61 | @@ -XXX,XX +XXX,XX @@ static uint64_t gem_read(void *opaque, hwaddr offset, unsigned size) |
109 | versal_create_uarts(s, pic); | 62 | DB_PRINT("lowering irqs on ISR read\n"); |
110 | versal_create_gems(s, pic); | 63 | /* The interrupts get updated at the end of the function. */ |
111 | versal_create_admas(s, pic); | 64 | break; |
112 | + versal_create_sds(s, pic); | 65 | - case R_PHYMNTNC: |
113 | versal_map_ddr(s); | 66 | - if (FIELD_EX32(retval, PHYMNTNC, OP) == MDIO_OP_READ) { |
114 | versal_unimp(s); | 67 | - uint32_t phy_addr, reg_num; |
68 | - | ||
69 | - phy_addr = FIELD_EX32(retval, PHYMNTNC, PHY_ADDR); | ||
70 | - if (phy_addr == s->phy_addr) { | ||
71 | - reg_num = FIELD_EX32(retval, PHYMNTNC, REG_ADDR); | ||
72 | - retval &= 0xFFFF0000; | ||
73 | - retval |= gem_phy_read(s, reg_num); | ||
74 | - } else { | ||
75 | - retval |= 0xFFFF; /* No device at this address */ | ||
76 | - } | ||
77 | - } | ||
78 | - break; | ||
79 | } | ||
80 | |||
81 | /* Squash read to clear bits */ | ||
82 | @@ -XXX,XX +XXX,XX @@ static void gem_write(void *opaque, hwaddr offset, uint64_t val, | ||
83 | s->sar_active[(offset - R_SPADDR1HI) / 2] = true; | ||
84 | break; | ||
85 | case R_PHYMNTNC: | ||
86 | - if (FIELD_EX32(val, PHYMNTNC, OP) == MDIO_OP_WRITE) { | ||
87 | - uint32_t phy_addr, reg_num; | ||
88 | - | ||
89 | - phy_addr = FIELD_EX32(val, PHYMNTNC, PHY_ADDR); | ||
90 | - if (phy_addr == s->phy_addr) { | ||
91 | - reg_num = FIELD_EX32(val, PHYMNTNC, REG_ADDR); | ||
92 | - gem_phy_write(s, reg_num, val); | ||
93 | - } | ||
94 | - } | ||
95 | + gem_handle_phy_access(s); | ||
96 | break; | ||
97 | } | ||
115 | 98 | ||
116 | -- | 99 | -- |
117 | 2.20.1 | 100 | 2.34.1 |
118 | |||
119 | diff view generated by jsdifflib |
1 | From: Fredrik Strupe <fredrik@strupe.net> | 1 | From: Luc Michel <luc.michel@amd.com> |
---|---|---|---|
2 | 2 | ||
3 | According to Arm ARM, VQDMULL is only valid when U=0, while having | 3 | The CRC was stored in an unsigned variable in gem_receive. Change it for |
4 | U=1 is unallocated. | 4 | a uint32_t to ensure we have the correct variable size here. |
5 | 5 | ||
6 | Signed-off-by: Fredrik Strupe <fredrik@strupe.net> | 6 | Signed-off-by: Luc Michel <luc.michel@amd.com> |
7 | Fixes: 695272dcb976 ("target-arm: Handle UNDEF cases for Neon 3-regs-different-widths") | 7 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 8 | Reviewed-by: sai.pavan.boddu@amd.com |
9 | Message-id: 20231017194422.4124691-12-luc.michel@amd.com | ||
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 | hw/net/cadence_gem.c | 2 +- |
12 | 1 file changed, 1 insertion(+), 1 deletion(-) | 13 | 1 file changed, 1 insertion(+), 1 deletion(-) |
13 | 14 | ||
14 | diff --git a/target/arm/translate.c b/target/arm/translate.c | 15 | diff --git a/hw/net/cadence_gem.c b/hw/net/cadence_gem.c |
15 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/target/arm/translate.c | 17 | --- a/hw/net/cadence_gem.c |
17 | +++ b/target/arm/translate.c | 18 | +++ b/hw/net/cadence_gem.c |
18 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) | 19 | @@ -XXX,XX +XXX,XX @@ static ssize_t gem_receive(NetClientState *nc, const uint8_t *buf, size_t size) |
19 | {0, 0, 0, 0}, /* VMLSL */ | 20 | if (FIELD_EX32(s->regs[R_NWCFG], NWCFG, FCS_REMOVE)) { |
20 | {0, 0, 0, 9}, /* VQDMLSL */ | 21 | rxbuf_ptr = (void *)buf; |
21 | {0, 0, 0, 0}, /* Integer VMULL */ | 22 | } else { |
22 | - {0, 0, 0, 1}, /* VQDMULL */ | 23 | - unsigned crc_val; |
23 | + {0, 0, 0, 9}, /* VQDMULL */ | 24 | + uint32_t crc_val; |
24 | {0, 0, 0, 0xa}, /* Polynomial VMULL */ | 25 | |
25 | {0, 0, 0, 7}, /* Reserved: always UNDEF */ | 26 | if (size > MAX_FRAME_SIZE - sizeof(crc_val)) { |
26 | }; | 27 | size = MAX_FRAME_SIZE - sizeof(crc_val); |
27 | -- | 28 | -- |
28 | 2.20.1 | 29 | 2.34.1 |
29 | 30 | ||
30 | 31 | diff view generated by jsdifflib |