1 | The following changes since commit 7e7eb9f852a46b51a71ae9d82590b2e4d28827ee: | 1 | Massive pullreq but almost all of that is RTH's SVE |
---|---|---|---|
2 | refactoring patchset. The other interesting thing here is | ||
3 | the fix for compiling on aarch64 macos. | ||
2 | 4 | ||
3 | Merge remote-tracking branch 'remotes/armbru/tags/pull-qapi-2021-01-28' into staging (2021-01-28 22:43:18 +0000) | 5 | thanks |
6 | -- PMM | ||
7 | |||
8 | The following changes since commit f7a1ea403e0282a7f57edd4298c4f65f24165da5: | ||
9 | |||
10 | Merge tag 'misc-pull-request' of gitlab.com:marcandre.lureau/qemu into staging (2022-05-29 16:34:56 -0700) | ||
4 | 11 | ||
5 | are available in the Git repository at: | 12 | are available in the Git repository at: |
6 | 13 | ||
7 | https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20210129 | 14 | https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20220530 |
8 | 15 | ||
9 | for you to fetch changes up to 11749122e1a86866591306d43603d2795a3dea1a: | 16 | for you to fetch changes up to b1071174d2a2ab371082b7d4b5f19e98edc61ac6: |
10 | 17 | ||
11 | hw/arm/stellaris: Remove board-creation reset of STELLARIS_SYS (2021-01-29 10:47:29 +0000) | 18 | target/arm: Remove aa64_sve check from before disas_sve (2022-05-30 17:05:12 +0100) |
12 | 19 | ||
13 | ---------------------------------------------------------------- | 20 | ---------------------------------------------------------------- |
14 | target-arm queue: | 21 | target-arm queue: |
15 | * Implement ID_PFR2 | 22 | * docs/system/arm: Add FEAT_HCX to list of emulated features |
16 | * Conditionalize DBGDIDR | 23 | * target/arm/hvf: Include missing "cpregs.h" |
17 | * rename xlnx-zcu102.canbusN properties | 24 | * hw/sd/allwinner-sdhost: report FIFO water level as 1 when data ready |
18 | * provide powerdown/reset mechanism for secure firmware on 'virt' board | 25 | * SVE: refactor to use TRANS/TRANS_FEAT macros and push |
19 | * hw/misc: Fix arith overflow in NPCM7XX PWM module | 26 | SVE feature check down to individual insn level |
20 | * target/arm: Replace magic value by MMU_DATA_LOAD definition | ||
21 | * configure: fix preadv errors on Catalina macOS with new XCode | ||
22 | * Various configure and other cleanups in preparation for iOS support | ||
23 | * hvf: Add hypervisor entitlement to output binaries (needed for Big Sur) | ||
24 | * Implement pvpanic-pci device | ||
25 | * Convert the CMSDK timer devices to the Clock framework | ||
26 | 27 | ||
27 | ---------------------------------------------------------------- | 28 | ---------------------------------------------------------------- |
28 | Alexander Graf (1): | 29 | Icenowy Zheng (1): |
29 | hvf: Add hypervisor entitlement to output binaries | 30 | hw/sd/allwinner-sdhost: report FIFO water level as 1 when data ready |
30 | 31 | ||
31 | Hao Wu (1): | 32 | Peter Maydell (1): |
32 | hw/misc: Fix arith overflow in NPCM7XX PWM module | 33 | docs/system/arm: Add FEAT_HCX to list of emulated features |
33 | |||
34 | Joelle van Dyne (7): | ||
35 | configure: cross-compiling with empty cross_prefix | ||
36 | osdep: build with non-working system() function | ||
37 | darwin: remove redundant dependency declaration | ||
38 | darwin: fix cross-compiling for Darwin | ||
39 | configure: cross compile should use x86_64 cpu_family | ||
40 | darwin: detect CoreAudio for build | ||
41 | darwin: remove 64-bit build detection on 32-bit OS | ||
42 | |||
43 | Maxim Uvarov (3): | ||
44 | hw: gpio: implement gpio-pwr driver for qemu reset/poweroff | ||
45 | arm-virt: refactor gpios creation | ||
46 | arm-virt: add secure pl061 for reset/power down | ||
47 | |||
48 | Mihai Carabas (4): | ||
49 | hw/misc/pvpanic: split-out generic and bus dependent code | ||
50 | hw/misc/pvpanic: add PCI interface support | ||
51 | pvpanic : update pvpanic spec document | ||
52 | tests/qtest: add a test case for pvpanic-pci | ||
53 | |||
54 | Paolo Bonzini (1): | ||
55 | arm: rename xlnx-zcu102.canbusN properties | ||
56 | |||
57 | Peter Maydell (26): | ||
58 | configure: Move preadv check to meson.build | ||
59 | ptimer: Add new ptimer_set_period_from_clock() function | ||
60 | clock: Add new clock_has_source() function | ||
61 | tests: Add a simple test of the CMSDK APB timer | ||
62 | tests: Add a simple test of the CMSDK APB watchdog | ||
63 | tests: Add a simple test of the CMSDK APB dual timer | ||
64 | hw/timer/cmsdk-apb-timer: Rename CMSDKAPBTIMER struct to CMSDKAPBTimer | ||
65 | hw/timer/cmsdk-apb-timer: Add Clock input | ||
66 | hw/timer/cmsdk-apb-dualtimer: Add Clock input | ||
67 | hw/watchdog/cmsdk-apb-watchdog: Add Clock input | ||
68 | hw/arm/armsse: Rename "MAINCLK" property to "MAINCLK_FRQ" | ||
69 | hw/arm/armsse: Wire up clocks | ||
70 | hw/arm/mps2: Inline CMSDK_APB_TIMER creation | ||
71 | hw/arm/mps2: Create and connect SYSCLK Clock | ||
72 | hw/arm/mps2-tz: Create and connect ARMSSE Clocks | ||
73 | hw/arm/musca: Create and connect ARMSSE Clocks | ||
74 | hw/arm/stellaris: Convert SSYS to QOM device | ||
75 | hw/arm/stellaris: Create Clock input for watchdog | ||
76 | hw/timer/cmsdk-apb-timer: Convert to use Clock input | ||
77 | hw/timer/cmsdk-apb-dualtimer: Convert to use Clock input | ||
78 | hw/watchdog/cmsdk-apb-watchdog: Convert to use Clock input | ||
79 | tests/qtest/cmsdk-apb-watchdog-test: Test clock changes | ||
80 | hw/arm/armsse: Use Clock to set system_clock_scale | ||
81 | arm: Don't set freq properties on CMSDK timer, dualtimer, watchdog, ARMSSE | ||
82 | arm: Remove frq properties on CMSDK timer, dualtimer, watchdog, ARMSSE | ||
83 | hw/arm/stellaris: Remove board-creation reset of STELLARIS_SYS | ||
84 | 34 | ||
85 | Philippe Mathieu-Daudé (1): | 35 | Philippe Mathieu-Daudé (1): |
86 | target/arm: Replace magic value by MMU_DATA_LOAD definition | 36 | target/arm/hvf: Include missing "cpregs.h" |
87 | 37 | ||
88 | Richard Henderson (2): | 38 | Richard Henderson (114): |
89 | target/arm: Implement ID_PFR2 | 39 | target/arm: Introduce TRANS, TRANS_FEAT |
90 | target/arm: Conditionalize DBGDIDR | 40 | target/arm: Move null function and sve check into gen_gvec_ool_zz |
41 | target/arm: Use TRANS_FEAT for gen_gvec_ool_zz | ||
42 | target/arm: Move null function and sve check into gen_gvec_ool_zzz | ||
43 | target/arm: Introduce gen_gvec_ool_arg_zzz | ||
44 | target/arm: Use TRANS_FEAT for gen_gvec_ool_arg_zzz | ||
45 | target/arm: Use TRANS_FEAT for do_sve2_zzz_ool | ||
46 | target/arm: Move null function and sve check into gen_gvec_ool_zzzz | ||
47 | target/arm: Use TRANS_FEAT for gen_gvec_ool_zzzz | ||
48 | target/arm: Introduce gen_gvec_ool_arg_zzzz | ||
49 | target/arm: Use TRANS_FEAT for do_sve2_zzzz_ool | ||
50 | target/arm: Use TRANS_FEAT for gen_gvec_ool_arg_zzzz | ||
51 | target/arm: Rename do_zzxz_ool to gen_gvec_ool_arg_zzxz | ||
52 | target/arm: Use TRANS_FEAT for gen_gvec_ool_arg_zzxz | ||
53 | target/arm: Use TRANS_FEAT for do_sve2_zzz_data | ||
54 | target/arm: Use TRANS_FEAT for do_sve2_zzzz_data | ||
55 | target/arm: Use TRANS_FEAT for do_sve2_zzw_data | ||
56 | target/arm: Use TRANS_FEAT for USDOT_zzzz | ||
57 | target/arm: Move null function and sve check into gen_gvec_ool_zzp | ||
58 | target/arm: Introduce gen_gvec_ool_arg_zpz | ||
59 | target/arm: Use TRANS_FEAT for gen_gvec_ool_arg_zpz | ||
60 | target/arm: Use TRANS_FEAT for do_sve2_zpz_data | ||
61 | target/arm: Rename do_zpzi_ool to gen_gvec_ool_arg_zpzi | ||
62 | target/arm: Use TRANS_FEAT for gen_gvec_ool_arg_zpzi | ||
63 | target/arm: Move null function and sve check into gen_gvec_ool_zzzp | ||
64 | target/arm: Introduce gen_gvec_ool_arg_zpzz | ||
65 | target/arm: Use TRANS_FEAT for gen_gvec_ool_arg_zpzz | ||
66 | target/arm: Use TRANS_FEAT for do_sve2_zpzz_ool | ||
67 | target/arm: Merge gen_gvec_fn_zz into do_mov_z | ||
68 | target/arm: Move null function and sve check into gen_gvec_fn_zzz | ||
69 | target/arm: Rename do_zzz_fn to gen_gvec_fn_arg_zzz | ||
70 | target/arm: More use of gen_gvec_fn_arg_zzz | ||
71 | target/arm: Use TRANS_FEAT for gen_gvec_fn_arg_zzz | ||
72 | target/arm: Use TRANS_FEAT for do_sve2_fn_zzz | ||
73 | target/arm: Use TRANS_FEAT for RAX1 | ||
74 | target/arm: Introduce gen_gvec_fn_arg_zzzz | ||
75 | target/arm: Use TRANS_FEAT for do_sve2_zzzz_fn | ||
76 | target/arm: Introduce gen_gvec_fn_zzi | ||
77 | target/arm: Use TRANS_FEAT for do_zz_dbm | ||
78 | target/arm: Hoist sve access check through do_sel_z | ||
79 | target/arm: Introduce gen_gvec_fn_arg_zzi | ||
80 | target/arm: Use TRANS_FEAT for do_sve2_fn2i | ||
81 | target/arm: Use TRANS_FEAT for do_vpz_ool | ||
82 | target/arm: Use TRANS_FEAT for do_shift_imm | ||
83 | target/arm: Introduce do_shift_zpzi | ||
84 | target/arm: Use TRANS_FEAT for do_shift_zpzi | ||
85 | target/arm: Use TRANS_FEAT for do_zpzzz_ool | ||
86 | target/arm: Move sve check into do_index | ||
87 | target/arm: Use TRANS_FEAT for do_index | ||
88 | target/arm: Use TRANS_FEAT for do_adr | ||
89 | target/arm: Use TRANS_FEAT for do_predset | ||
90 | target/arm: Use TRANS_FEAT for RDFFR, WRFFR | ||
91 | target/arm: Use TRANS_FEAT for do_pfirst_pnext | ||
92 | target/arm: Use TRANS_FEAT for do_EXT | ||
93 | target/arm: Use TRANS_FEAT for do_perm_pred3 | ||
94 | target/arm: Use TRANS_FEAT for do_perm_pred2 | ||
95 | target/arm: Move sve zip high_ofs into simd_data | ||
96 | target/arm: Use gen_gvec_ool_arg_zzz for do_zip, do_zip_q | ||
97 | target/arm: Use TRANS_FEAT for do_zip, do_zip_q | ||
98 | target/arm: Use TRANS_FEAT for do_clast_vector | ||
99 | target/arm: Use TRANS_FEAT for do_clast_fp | ||
100 | target/arm: Use TRANS_FEAT for do_clast_general | ||
101 | target/arm: Use TRANS_FEAT for do_last_fp | ||
102 | target/arm: Use TRANS_FEAT for do_last_general | ||
103 | target/arm: Use TRANS_FEAT for SPLICE | ||
104 | target/arm: Use TRANS_FEAT for do_ppzz_flags | ||
105 | target/arm: Use TRANS_FEAT for do_sve2_ppzz_flags | ||
106 | target/arm: Use TRANS_FEAT for do_ppzi_flags | ||
107 | target/arm: Use TRANS_FEAT for do_brk2, do_brk3 | ||
108 | target/arm: Use TRANS_FEAT for MUL_zzi | ||
109 | target/arm: Reject dup_i w/ shifted byte early | ||
110 | target/arm: Reject add/sub w/ shifted byte early | ||
111 | target/arm: Reject copy w/ shifted byte early | ||
112 | target/arm: Use TRANS_FEAT for ADD_zzi | ||
113 | target/arm: Use TRANS_FEAT for do_zzi_sat | ||
114 | target/arm: Use TRANS_FEAT for do_zzi_ool | ||
115 | target/arm: Introduce gen_gvec_{ptr,fpst}_zzzz | ||
116 | target/arm: Use TRANS_FEAT for FMMLA | ||
117 | target/arm: Move sve check into gen_gvec_fn_ppp | ||
118 | target/arm: Implement NOT (prediates) alias | ||
119 | target/arm: Use TRANS_FEAT for SEL_zpzz | ||
120 | target/arm: Use TRANS_FEAT for MOVPRFX | ||
121 | target/arm: Use TRANS_FEAT for FMLA | ||
122 | target/arm: Use TRANS_FEAT for BFMLA | ||
123 | target/arm: Rename do_zzz_fp to gen_gvec_ool_fpst_arg_zzz | ||
124 | target/arm: Use TRANS_FEAT for DO_FP3 | ||
125 | target/arm: Use TRANS_FEAT for FMUL_zzx | ||
126 | target/arm: Use TRANS_FEAT for FTMAD | ||
127 | target/arm: Move null function and sve check into do_reduce | ||
128 | target/arm: Use TRANS_FEAT for do_reduce | ||
129 | target/arm: Use TRANS_FEAT for FRECPE, FRSQRTE | ||
130 | target/arm: Expand frint_fns for MO_8 | ||
131 | target/arm: Rename do_zpz_ptr to gen_gvec_ool_fpst_arg_zpz | ||
132 | target/arm: Move null function and sve check into do_frint_mode | ||
133 | target/arm: Use TRANS_FEAT for do_frint_mode | ||
134 | target/arm: Use TRANS_FEAT for FLOGB | ||
135 | target/arm: Use TRANS_FEAT for do_ppz_fp | ||
136 | target/arm: Rename do_zpzz_ptr to gen_gvec_fpst_arg_zpzz | ||
137 | target/arm: Use TRANS_FEAT for gen_gvec_fpst_arg_zpzz | ||
138 | target/arm: Use TRANS_FEAT for FCADD | ||
139 | target/arm: Introduce gen_gvec_fpst_zzzzp | ||
140 | target/arm: Use TRANS_FEAT for gen_gvec_fpst_zzzzp | ||
141 | target/arm: Move null function and sve check into do_fp_imm | ||
142 | target/arm: Use TRANS_FEAT for DO_FP_IMM | ||
143 | target/arm: Use TRANS_FEAT for DO_FPCMP | ||
144 | target/arm: Remove assert in trans_FCMLA_zzxz | ||
145 | target/arm: Use TRANS_FEAT for FCMLA_zzxz | ||
146 | target/arm: Use TRANS_FEAT for do_narrow_extract | ||
147 | target/arm: Use TRANS_FEAT for do_shll_tb | ||
148 | target/arm: Use TRANS_FEAT for do_shr_narrow | ||
149 | target/arm: Use TRANS_FEAT for do_FMLAL_zzzw | ||
150 | target/arm: Use TRANS_FEAT for do_FMLAL_zzxw | ||
151 | target/arm: Add sve feature check for remaining trans_* functions | ||
152 | target/arm: Remove aa64_sve check from before disas_sve | ||
91 | 153 | ||
92 | docs/devel/clocks.rst | 16 +++ | 154 | docs/system/arm/emulation.rst | 1 + |
93 | docs/specs/pci-ids.txt | 1 + | 155 | target/arm/translate.h | 11 + |
94 | docs/specs/pvpanic.txt | 13 ++- | 156 | target/arm/sve.decode | 57 +- |
95 | docs/system/arm/virt.rst | 2 + | 157 | hw/sd/allwinner-sdhost.c | 7 + |
96 | configure | 78 ++++++++------ | 158 | target/arm/hvf/hvf.c | 1 + |
97 | meson.build | 34 ++++++- | 159 | target/arm/sve_helper.c | 6 +- |
98 | include/hw/arm/armsse.h | 14 ++- | 160 | target/arm/translate-a64.c | 2 +- |
99 | include/hw/arm/virt.h | 2 + | 161 | target/arm/translate-sve.c | 5367 +++++++++++++++-------------------------- |
100 | include/hw/clock.h | 15 +++ | 162 | 8 files changed, 2067 insertions(+), 3385 deletions(-) |
101 | include/hw/misc/pvpanic.h | 24 ++++- | ||
102 | include/hw/pci/pci.h | 1 + | ||
103 | include/hw/ptimer.h | 22 ++++ | ||
104 | include/hw/timer/cmsdk-apb-dualtimer.h | 5 +- | ||
105 | include/hw/timer/cmsdk-apb-timer.h | 34 ++----- | ||
106 | include/hw/watchdog/cmsdk-apb-watchdog.h | 5 +- | ||
107 | include/qemu/osdep.h | 12 +++ | ||
108 | include/qemu/typedefs.h | 1 + | ||
109 | target/arm/cpu.h | 1 + | ||
110 | hw/arm/armsse.c | 48 ++++++--- | ||
111 | hw/arm/mps2-tz.c | 14 ++- | ||
112 | hw/arm/mps2.c | 28 ++++- | ||
113 | hw/arm/musca.c | 13 ++- | ||
114 | hw/arm/stellaris.c | 170 +++++++++++++++++++++++-------- | ||
115 | hw/arm/virt.c | 111 ++++++++++++++++---- | ||
116 | hw/arm/xlnx-zcu102.c | 4 +- | ||
117 | hw/core/ptimer.c | 34 +++++++ | ||
118 | hw/gpio/gpio_pwr.c | 70 +++++++++++++ | ||
119 | hw/misc/npcm7xx_pwm.c | 23 ++++- | ||
120 | hw/misc/pvpanic-isa.c | 94 +++++++++++++++++ | ||
121 | hw/misc/pvpanic-pci.c | 94 +++++++++++++++++ | ||
122 | hw/misc/pvpanic.c | 85 ++-------------- | ||
123 | hw/timer/cmsdk-apb-dualtimer.c | 53 +++++++--- | ||
124 | hw/timer/cmsdk-apb-timer.c | 55 +++++----- | ||
125 | hw/watchdog/cmsdk-apb-watchdog.c | 29 ++++-- | ||
126 | target/arm/helper.c | 27 +++-- | ||
127 | target/arm/kvm64.c | 2 + | ||
128 | tests/qtest/cmsdk-apb-dualtimer-test.c | 130 +++++++++++++++++++++++ | ||
129 | tests/qtest/cmsdk-apb-timer-test.c | 75 ++++++++++++++ | ||
130 | tests/qtest/cmsdk-apb-watchdog-test.c | 131 ++++++++++++++++++++++++ | ||
131 | tests/qtest/npcm7xx_pwm-test.c | 4 +- | ||
132 | tests/qtest/pvpanic-pci-test.c | 94 +++++++++++++++++ | ||
133 | tests/qtest/xlnx-can-test.c | 30 +++--- | ||
134 | MAINTAINERS | 3 + | ||
135 | accel/hvf/entitlements.plist | 8 ++ | ||
136 | hw/arm/Kconfig | 1 + | ||
137 | hw/gpio/Kconfig | 3 + | ||
138 | hw/gpio/meson.build | 1 + | ||
139 | hw/i386/Kconfig | 2 +- | ||
140 | hw/misc/Kconfig | 12 ++- | ||
141 | hw/misc/meson.build | 4 +- | ||
142 | scripts/entitlement.sh | 13 +++ | ||
143 | tests/qtest/meson.build | 6 +- | ||
144 | 52 files changed, 1432 insertions(+), 319 deletions(-) | ||
145 | create mode 100644 hw/gpio/gpio_pwr.c | ||
146 | create mode 100644 hw/misc/pvpanic-isa.c | ||
147 | create mode 100644 hw/misc/pvpanic-pci.c | ||
148 | create mode 100644 tests/qtest/cmsdk-apb-dualtimer-test.c | ||
149 | create mode 100644 tests/qtest/cmsdk-apb-timer-test.c | ||
150 | create mode 100644 tests/qtest/cmsdk-apb-watchdog-test.c | ||
151 | create mode 100644 tests/qtest/pvpanic-pci-test.c | ||
152 | create mode 100644 accel/hvf/entitlements.plist | ||
153 | create mode 100755 scripts/entitlement.sh | ||
154 | 163 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | In commit 5814d587fe861fe9 we added support for emulating | ||
2 | FEAT_HCX (Support for the HCRX_EL2 register). However we | ||
3 | forgot to add it to the list in emulated.rst. Correct the | ||
4 | omission. | ||
1 | 5 | ||
6 | Fixes: 5814d587fe861fe9 ("target/arm: Enable FEAT_HCX for -cpu max") | ||
7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
8 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
9 | Message-id: 20220520084320.424166-1-peter.maydell@linaro.org | ||
10 | --- | ||
11 | docs/system/arm/emulation.rst | 1 + | ||
12 | 1 file changed, 1 insertion(+) | ||
13 | |||
14 | diff --git a/docs/system/arm/emulation.rst b/docs/system/arm/emulation.rst | ||
15 | index XXXXXXX..XXXXXXX 100644 | ||
16 | --- a/docs/system/arm/emulation.rst | ||
17 | +++ b/docs/system/arm/emulation.rst | ||
18 | @@ -XXX,XX +XXX,XX @@ the following architecture extensions: | ||
19 | - FEAT_FRINTTS (Floating-point to integer instructions) | ||
20 | - FEAT_FlagM (Flag manipulation instructions v2) | ||
21 | - FEAT_FlagM2 (Enhancements to flag manipulation instructions) | ||
22 | +- FEAT_HCX (Support for the HCRX_EL2 register) | ||
23 | - FEAT_HPDS (Hierarchical permission disables) | ||
24 | - FEAT_I8MM (AArch64 Int8 matrix multiplication instructions) | ||
25 | - FEAT_IDST (ID space trap handling) | ||
26 | -- | ||
27 | 2.25.1 | diff view generated by jsdifflib |
1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> | 1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> |
---|---|---|---|
2 | 2 | ||
3 | cpu_get_phys_page_debug() uses 'DATA LOAD' MMU access type. | 3 | Fix when building HVF on macOS Aarch64: |
4 | 4 | ||
5 | target/arm/hvf/hvf.c:586:15: error: unknown type name 'ARMCPRegInfo'; did you mean 'ARMCPUInfo'? | ||
6 | const ARMCPRegInfo *ri; | ||
7 | ^~~~~~~~~~~~ | ||
8 | ARMCPUInfo | ||
9 | target/arm/cpu-qom.h:38:3: note: 'ARMCPUInfo' declared here | ||
10 | } ARMCPUInfo; | ||
11 | ^ | ||
12 | target/arm/hvf/hvf.c:589:14: error: implicit declaration of function 'get_arm_cp_reginfo' is invalid in C99 [-Werror,-Wimplicit-function-declaration] | ||
13 | ri = get_arm_cp_reginfo(arm_cpu->cp_regs, key); | ||
14 | ^ | ||
15 | target/arm/hvf/hvf.c:589:12: warning: incompatible integer to pointer conversion assigning to 'const ARMCPUInfo *' (aka 'const struct ARMCPUInfo *') from 'int' [-Wint-conversion] | ||
16 | ri = get_arm_cp_reginfo(arm_cpu->cp_regs, key); | ||
17 | ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
18 | target/arm/hvf/hvf.c:591:26: error: no member named 'type' in 'struct ARMCPUInfo' | ||
19 | assert(!(ri->type & ARM_CP_NO_RAW)); | ||
20 | ~~ ^ | ||
21 | /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/assert.h:99:25: note: expanded from macro 'assert' | ||
22 | (__builtin_expect(!(e), 0) ? __assert_rtn(__func__, __ASSERT_FILE_NAME, __LINE__, #e) : (void)0) | ||
23 | ^ | ||
24 | target/arm/hvf/hvf.c:591:33: error: use of undeclared identifier 'ARM_CP_NO_RAW' | ||
25 | assert(!(ri->type & ARM_CP_NO_RAW)); | ||
26 | ^ | ||
27 | 1 warning and 4 errors generated. | ||
28 | |||
29 | Fixes: cf7c6d1004 ("target/arm: Split out cpregs.h") | ||
30 | Reported-by: Duncan Bayne <duncan@bayne.id.au> | ||
5 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 31 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> |
6 | Message-id: 20210127232822.3530782-1-f4bug@amsat.org | 32 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 33 | Message-id: 20220525161926.34233-1-philmd@fungible.com |
34 | Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1029 | ||
35 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 36 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
9 | --- | 37 | --- |
10 | target/arm/helper.c | 2 +- | 38 | target/arm/hvf/hvf.c | 1 + |
11 | 1 file changed, 1 insertion(+), 1 deletion(-) | 39 | 1 file changed, 1 insertion(+) |
12 | 40 | ||
13 | diff --git a/target/arm/helper.c b/target/arm/helper.c | 41 | diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c |
14 | index XXXXXXX..XXXXXXX 100644 | 42 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/target/arm/helper.c | 43 | --- a/target/arm/hvf/hvf.c |
16 | +++ b/target/arm/helper.c | 44 | +++ b/target/arm/hvf/hvf.c |
17 | @@ -XXX,XX +XXX,XX @@ hwaddr arm_cpu_get_phys_page_attrs_debug(CPUState *cs, vaddr addr, | 45 | @@ -XXX,XX +XXX,XX @@ |
18 | 46 | #include "sysemu/hvf_int.h" | |
19 | *attrs = (MemTxAttrs) {}; | 47 | #include "sysemu/hw_accel.h" |
20 | 48 | #include "hvf_arm.h" | |
21 | - ret = get_phys_addr(env, addr, 0, mmu_idx, &phys_addr, | 49 | +#include "cpregs.h" |
22 | + ret = get_phys_addr(env, addr, MMU_DATA_LOAD, mmu_idx, &phys_addr, | 50 | |
23 | attrs, &prot, &page_size, &fi, &cacheattrs); | 51 | #include <mach/mach_time.h> |
24 | 52 | ||
25 | if (ret) { | ||
26 | -- | 53 | -- |
27 | 2.20.1 | 54 | 2.25.1 |
28 | 55 | ||
29 | 56 | diff view generated by jsdifflib |
1 | Create and connect the two clocks needed by the ARMSSE. | 1 | From: Icenowy Zheng <uwu@icenowy.me> |
---|---|---|---|
2 | 2 | ||
3 | U-Boot queries the FIFO water level to reduce checking status register | ||
4 | when doing PIO SD card operation. | ||
5 | |||
6 | Report a FIFO water level of 1 when data is ready, to prevent the code | ||
7 | from trying to read 0 words from the FIFO each time. | ||
8 | |||
9 | Signed-off-by: Icenowy Zheng <uwu@icenowy.me> | ||
10 | Message-id: 20220520124200.2112699-1-uwu@icenowy.me | ||
11 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
3 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
4 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
5 | Reviewed-by: Luc Michel <luc@lmichel.fr> | ||
6 | Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
7 | Message-id: 20210128114145.20536-16-peter.maydell@linaro.org | ||
8 | Message-id: 20210121190622.22000-16-peter.maydell@linaro.org | ||
9 | --- | 13 | --- |
10 | hw/arm/musca.c | 12 ++++++++++++ | 14 | hw/sd/allwinner-sdhost.c | 7 +++++++ |
11 | 1 file changed, 12 insertions(+) | 15 | 1 file changed, 7 insertions(+) |
12 | 16 | ||
13 | diff --git a/hw/arm/musca.c b/hw/arm/musca.c | 17 | diff --git a/hw/sd/allwinner-sdhost.c b/hw/sd/allwinner-sdhost.c |
14 | index XXXXXXX..XXXXXXX 100644 | 18 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/hw/arm/musca.c | 19 | --- a/hw/sd/allwinner-sdhost.c |
16 | +++ b/hw/arm/musca.c | 20 | +++ b/hw/sd/allwinner-sdhost.c |
17 | @@ -XXX,XX +XXX,XX @@ | 21 | @@ -XXX,XX +XXX,XX @@ enum { |
18 | #include "hw/misc/tz-ppc.h" | ||
19 | #include "hw/misc/unimp.h" | ||
20 | #include "hw/rtc/pl031.h" | ||
21 | +#include "hw/qdev-clock.h" | ||
22 | #include "qom/object.h" | ||
23 | |||
24 | #define MUSCA_NUMIRQ_MAX 96 | ||
25 | @@ -XXX,XX +XXX,XX @@ struct MuscaMachineState { | ||
26 | UnimplementedDeviceState sdio; | ||
27 | UnimplementedDeviceState gpio; | ||
28 | UnimplementedDeviceState cryptoisland; | ||
29 | + Clock *sysclk; | ||
30 | + Clock *s32kclk; | ||
31 | }; | 22 | }; |
32 | 23 | ||
33 | #define TYPE_MUSCA_MACHINE "musca" | 24 | enum { |
34 | @@ -XXX,XX +XXX,XX @@ OBJECT_DECLARE_TYPE(MuscaMachineState, MuscaMachineClass, MUSCA_MACHINE) | 25 | + SD_STAR_FIFO_EMPTY = (1 << 2), |
35 | * don't model that in our SSE-200 model yet. | 26 | SD_STAR_CARD_PRESENT = (1 << 8), |
36 | */ | 27 | + SD_STAR_FIFO_LEVEL_1 = (1 << 17), |
37 | #define SYSCLK_FRQ 40000000 | 28 | }; |
38 | +/* Slow 32Khz S32KCLK frequency in Hz */ | 29 | |
39 | +#define S32KCLK_FRQ (32 * 1000) | 30 | enum { |
40 | 31 | @@ -XXX,XX +XXX,XX @@ static uint64_t allwinner_sdhost_read(void *opaque, hwaddr offset, | |
41 | static qemu_irq get_sse_irq_in(MuscaMachineState *mms, int irqno) | 32 | break; |
42 | { | 33 | case REG_SD_STAR: /* Status */ |
43 | @@ -XXX,XX +XXX,XX @@ static void musca_init(MachineState *machine) | 34 | res = s->status; |
44 | exit(1); | 35 | + if (sdbus_data_ready(&s->sdbus)) { |
45 | } | 36 | + res |= SD_STAR_FIFO_LEVEL_1; |
46 | 37 | + } else { | |
47 | + mms->sysclk = clock_new(OBJECT(machine), "SYSCLK"); | 38 | + res |= SD_STAR_FIFO_EMPTY; |
48 | + clock_set_hz(mms->sysclk, SYSCLK_FRQ); | 39 | + } |
49 | + mms->s32kclk = clock_new(OBJECT(machine), "S32KCLK"); | 40 | break; |
50 | + clock_set_hz(mms->s32kclk, S32KCLK_FRQ); | 41 | case REG_SD_FWLR: /* FIFO Water Level */ |
51 | + | 42 | res = s->fifo_wlevel; |
52 | object_initialize_child(OBJECT(machine), "sse-200", &mms->sse, | ||
53 | TYPE_SSE200); | ||
54 | ssedev = DEVICE(&mms->sse); | ||
55 | @@ -XXX,XX +XXX,XX @@ static void musca_init(MachineState *machine) | ||
56 | qdev_prop_set_uint32(ssedev, "init-svtor", mmc->init_svtor); | ||
57 | qdev_prop_set_uint32(ssedev, "SRAM_ADDR_WIDTH", mmc->sram_addr_width); | ||
58 | qdev_prop_set_uint32(ssedev, "MAINCLK_FRQ", SYSCLK_FRQ); | ||
59 | + qdev_connect_clock_in(ssedev, "MAINCLK", mms->sysclk); | ||
60 | + qdev_connect_clock_in(ssedev, "S32KCLK", mms->s32kclk); | ||
61 | /* | ||
62 | * Musca-A takes the default SSE-200 FPU/DSP settings (ie no for | ||
63 | * CPU0 and yes for CPU1); Musca-B1 explicitly enables them for CPU0. | ||
64 | -- | 43 | -- |
65 | 2.20.1 | 44 | 2.25.1 |
66 | |||
67 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | Steal the idea for these leaf function expanders from PowerPC. | ||
4 | |||
5 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
6 | Message-id: 20220527181907.189259-2-richard.henderson@linaro.org | ||
7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
9 | --- | ||
10 | target/arm/translate.h | 11 +++++++++++ | ||
11 | 1 file changed, 11 insertions(+) | ||
12 | |||
13 | diff --git a/target/arm/translate.h b/target/arm/translate.h | ||
14 | index XXXXXXX..XXXXXXX 100644 | ||
15 | --- a/target/arm/translate.h | ||
16 | +++ b/target/arm/translate.h | ||
17 | @@ -XXX,XX +XXX,XX @@ static inline MemOp finalize_memop(DisasContext *s, MemOp opc) | ||
18 | */ | ||
19 | uint64_t asimd_imm_const(uint32_t imm, int cmode, int op); | ||
20 | |||
21 | +/* | ||
22 | + * Helpers for implementing sets of trans_* functions. | ||
23 | + * Defer the implementation of NAME to FUNC, with optional extra arguments. | ||
24 | + */ | ||
25 | +#define TRANS(NAME, FUNC, ...) \ | ||
26 | + static bool trans_##NAME(DisasContext *s, arg_##NAME *a) \ | ||
27 | + { return FUNC(s, __VA_ARGS__); } | ||
28 | +#define TRANS_FEAT(NAME, FEAT, FUNC, ...) \ | ||
29 | + static bool trans_##NAME(DisasContext *s, arg_##NAME *a) \ | ||
30 | + { return dc_isar_feature(FEAT, s) && FUNC(s, __VA_ARGS__); } | ||
31 | + | ||
32 | #endif /* TARGET_ARM_TRANSLATE_H */ | ||
33 | -- | ||
34 | 2.25.1 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
4 | Message-id: 20220527181907.189259-3-richard.henderson@linaro.org | ||
5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | --- | ||
8 | target/arm/translate-sve.c | 36 +++++++++++++++--------------------- | ||
9 | 1 file changed, 15 insertions(+), 21 deletions(-) | ||
10 | |||
11 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c | ||
12 | index XXXXXXX..XXXXXXX 100644 | ||
13 | --- a/target/arm/translate-sve.c | ||
14 | +++ b/target/arm/translate-sve.c | ||
15 | @@ -XXX,XX +XXX,XX @@ static int pred_gvec_reg_size(DisasContext *s) | ||
16 | } | ||
17 | |||
18 | /* Invoke an out-of-line helper on 2 Zregs. */ | ||
19 | -static void gen_gvec_ool_zz(DisasContext *s, gen_helper_gvec_2 *fn, | ||
20 | +static bool gen_gvec_ool_zz(DisasContext *s, gen_helper_gvec_2 *fn, | ||
21 | int rd, int rn, int data) | ||
22 | { | ||
23 | - unsigned vsz = vec_full_reg_size(s); | ||
24 | - tcg_gen_gvec_2_ool(vec_full_reg_offset(s, rd), | ||
25 | - vec_full_reg_offset(s, rn), | ||
26 | - vsz, vsz, data, fn); | ||
27 | + if (fn == NULL) { | ||
28 | + return false; | ||
29 | + } | ||
30 | + if (sve_access_check(s)) { | ||
31 | + unsigned vsz = vec_full_reg_size(s); | ||
32 | + tcg_gen_gvec_2_ool(vec_full_reg_offset(s, rd), | ||
33 | + vec_full_reg_offset(s, rn), | ||
34 | + vsz, vsz, data, fn); | ||
35 | + } | ||
36 | + return true; | ||
37 | } | ||
38 | |||
39 | /* Invoke an out-of-line helper on 3 Zregs. */ | ||
40 | @@ -XXX,XX +XXX,XX @@ static bool trans_FEXPA(DisasContext *s, arg_rr_esz *a) | ||
41 | gen_helper_sve_fexpa_s, | ||
42 | gen_helper_sve_fexpa_d, | ||
43 | }; | ||
44 | - if (a->esz == 0) { | ||
45 | - return false; | ||
46 | - } | ||
47 | - if (sve_access_check(s)) { | ||
48 | - gen_gvec_ool_zz(s, fns[a->esz], a->rd, a->rn, 0); | ||
49 | - } | ||
50 | - return true; | ||
51 | + return gen_gvec_ool_zz(s, fns[a->esz], a->rd, a->rn, 0); | ||
52 | } | ||
53 | |||
54 | static bool trans_FTSSEL(DisasContext *s, arg_rrr_esz *a) | ||
55 | @@ -XXX,XX +XXX,XX @@ static bool trans_REV_v(DisasContext *s, arg_rr_esz *a) | ||
56 | gen_helper_sve_rev_b, gen_helper_sve_rev_h, | ||
57 | gen_helper_sve_rev_s, gen_helper_sve_rev_d | ||
58 | }; | ||
59 | - | ||
60 | - if (sve_access_check(s)) { | ||
61 | - gen_gvec_ool_zz(s, fns[a->esz], a->rd, a->rn, 0); | ||
62 | - } | ||
63 | - return true; | ||
64 | + return gen_gvec_ool_zz(s, fns[a->esz], a->rd, a->rn, 0); | ||
65 | } | ||
66 | |||
67 | static bool trans_TBL(DisasContext *s, arg_rrr_esz *a) | ||
68 | @@ -XXX,XX +XXX,XX @@ static bool trans_AESMC(DisasContext *s, arg_AESMC *a) | ||
69 | if (!dc_isar_feature(aa64_sve2_aes, s)) { | ||
70 | return false; | ||
71 | } | ||
72 | - if (sve_access_check(s)) { | ||
73 | - gen_gvec_ool_zz(s, gen_helper_crypto_aesmc, a->rd, a->rd, a->decrypt); | ||
74 | - } | ||
75 | - return true; | ||
76 | + return gen_gvec_ool_zz(s, gen_helper_crypto_aesmc, | ||
77 | + a->rd, a->rd, a->decrypt); | ||
78 | } | ||
79 | |||
80 | static bool do_aese(DisasContext *s, arg_rrr_esz *a, bool decrypt) | ||
81 | -- | ||
82 | 2.25.1 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | Convert SVE translation functions using gen_gvec_ool_zz to TRANS_FEAT. | ||
4 | |||
5 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
6 | Message-id: 20220527181907.189259-4-richard.henderson@linaro.org | ||
7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
9 | --- | ||
10 | target/arm/translate-sve.c | 39 +++++++++++++------------------------- | ||
11 | 1 file changed, 13 insertions(+), 26 deletions(-) | ||
12 | |||
13 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c | ||
14 | index XXXXXXX..XXXXXXX 100644 | ||
15 | --- a/target/arm/translate-sve.c | ||
16 | +++ b/target/arm/translate-sve.c | ||
17 | @@ -XXX,XX +XXX,XX @@ static bool trans_ADR_u32(DisasContext *s, arg_rrri *a) | ||
18 | *** SVE Integer Misc - Unpredicated Group | ||
19 | */ | ||
20 | |||
21 | -static bool trans_FEXPA(DisasContext *s, arg_rr_esz *a) | ||
22 | -{ | ||
23 | - static gen_helper_gvec_2 * const fns[4] = { | ||
24 | - NULL, | ||
25 | - gen_helper_sve_fexpa_h, | ||
26 | - gen_helper_sve_fexpa_s, | ||
27 | - gen_helper_sve_fexpa_d, | ||
28 | - }; | ||
29 | - return gen_gvec_ool_zz(s, fns[a->esz], a->rd, a->rn, 0); | ||
30 | -} | ||
31 | +static gen_helper_gvec_2 * const fexpa_fns[4] = { | ||
32 | + NULL, gen_helper_sve_fexpa_h, | ||
33 | + gen_helper_sve_fexpa_s, gen_helper_sve_fexpa_d, | ||
34 | +}; | ||
35 | +TRANS_FEAT(FEXPA, aa64_sve, gen_gvec_ool_zz, | ||
36 | + fexpa_fns[a->esz], a->rd, a->rn, 0) | ||
37 | |||
38 | static bool trans_FTSSEL(DisasContext *s, arg_rrr_esz *a) | ||
39 | { | ||
40 | @@ -XXX,XX +XXX,XX @@ static bool trans_INSR_r(DisasContext *s, arg_rrr_esz *a) | ||
41 | return true; | ||
42 | } | ||
43 | |||
44 | -static bool trans_REV_v(DisasContext *s, arg_rr_esz *a) | ||
45 | -{ | ||
46 | - static gen_helper_gvec_2 * const fns[4] = { | ||
47 | - gen_helper_sve_rev_b, gen_helper_sve_rev_h, | ||
48 | - gen_helper_sve_rev_s, gen_helper_sve_rev_d | ||
49 | - }; | ||
50 | - return gen_gvec_ool_zz(s, fns[a->esz], a->rd, a->rn, 0); | ||
51 | -} | ||
52 | +static gen_helper_gvec_2 * const rev_fns[4] = { | ||
53 | + gen_helper_sve_rev_b, gen_helper_sve_rev_h, | ||
54 | + gen_helper_sve_rev_s, gen_helper_sve_rev_d | ||
55 | +}; | ||
56 | +TRANS_FEAT(REV_v, aa64_sve, gen_gvec_ool_zz, rev_fns[a->esz], a->rd, a->rn, 0) | ||
57 | |||
58 | static bool trans_TBL(DisasContext *s, arg_rrr_esz *a) | ||
59 | { | ||
60 | @@ -XXX,XX +XXX,XX @@ static bool trans_USDOT_zzzz(DisasContext *s, arg_USDOT_zzzz *a) | ||
61 | return true; | ||
62 | } | ||
63 | |||
64 | -static bool trans_AESMC(DisasContext *s, arg_AESMC *a) | ||
65 | -{ | ||
66 | - if (!dc_isar_feature(aa64_sve2_aes, s)) { | ||
67 | - return false; | ||
68 | - } | ||
69 | - return gen_gvec_ool_zz(s, gen_helper_crypto_aesmc, | ||
70 | - a->rd, a->rd, a->decrypt); | ||
71 | -} | ||
72 | +TRANS_FEAT(AESMC, aa64_sve2_aes, gen_gvec_ool_zz, | ||
73 | + gen_helper_crypto_aesmc, a->rd, a->rd, a->decrypt) | ||
74 | |||
75 | static bool do_aese(DisasContext *s, arg_rrr_esz *a, bool decrypt) | ||
76 | { | ||
77 | -- | ||
78 | 2.25.1 | diff view generated by jsdifflib |
1 | Now no users are setting the frq properties on the CMSDK timer, | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | dualtimer, watchdog or ARMSSE SoC devices, we can remove the | ||
3 | properties and the struct fields that back them. | ||
4 | 2 | ||
3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
4 | Message-id: 20220527181907.189259-5-richard.henderson@linaro.org | ||
5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
5 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
6 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
7 | Reviewed-by: Luc Michel <luc@lmichel.fr> | ||
8 | Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
9 | Message-id: 20210128114145.20536-25-peter.maydell@linaro.org | ||
10 | Message-id: 20210121190622.22000-25-peter.maydell@linaro.org | ||
11 | --- | 7 | --- |
12 | include/hw/arm/armsse.h | 2 -- | 8 | target/arm/translate-sve.c | 74 ++++++++++++-------------------------- |
13 | include/hw/timer/cmsdk-apb-dualtimer.h | 2 -- | 9 | 1 file changed, 23 insertions(+), 51 deletions(-) |
14 | include/hw/timer/cmsdk-apb-timer.h | 2 -- | ||
15 | include/hw/watchdog/cmsdk-apb-watchdog.h | 2 -- | ||
16 | hw/arm/armsse.c | 2 -- | ||
17 | hw/timer/cmsdk-apb-dualtimer.c | 6 ------ | ||
18 | hw/timer/cmsdk-apb-timer.c | 6 ------ | ||
19 | hw/watchdog/cmsdk-apb-watchdog.c | 6 ------ | ||
20 | 8 files changed, 28 deletions(-) | ||
21 | 10 | ||
22 | diff --git a/include/hw/arm/armsse.h b/include/hw/arm/armsse.h | 11 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c |
23 | index XXXXXXX..XXXXXXX 100644 | 12 | index XXXXXXX..XXXXXXX 100644 |
24 | --- a/include/hw/arm/armsse.h | 13 | --- a/target/arm/translate-sve.c |
25 | +++ b/include/hw/arm/armsse.h | 14 | +++ b/target/arm/translate-sve.c |
26 | @@ -XXX,XX +XXX,XX @@ | 15 | @@ -XXX,XX +XXX,XX @@ static bool gen_gvec_ool_zz(DisasContext *s, gen_helper_gvec_2 *fn, |
27 | * + Clock input "S32KCLK": slow 32KHz clock used for a few peripherals | 16 | } |
28 | * + QOM property "memory" is a MemoryRegion containing the devices provided | 17 | |
29 | * by the board model. | 18 | /* Invoke an out-of-line helper on 3 Zregs. */ |
30 | - * + QOM property "MAINCLK_FRQ" is the frequency of the main system clock | 19 | -static void gen_gvec_ool_zzz(DisasContext *s, gen_helper_gvec_3 *fn, |
31 | * + QOM property "EXP_NUMIRQ" sets the number of expansion interrupts. | 20 | +static bool gen_gvec_ool_zzz(DisasContext *s, gen_helper_gvec_3 *fn, |
32 | * (In hardware, the SSE-200 permits the number of expansion interrupts | 21 | int rd, int rn, int rm, int data) |
33 | * for the two CPUs to be configured separately, but we restrict it to | 22 | { |
34 | @@ -XXX,XX +XXX,XX @@ struct ARMSSE { | 23 | - unsigned vsz = vec_full_reg_size(s); |
35 | /* Properties */ | 24 | - tcg_gen_gvec_3_ool(vec_full_reg_offset(s, rd), |
36 | MemoryRegion *board_memory; | 25 | - vec_full_reg_offset(s, rn), |
37 | uint32_t exp_numirq; | 26 | - vec_full_reg_offset(s, rm), |
38 | - uint32_t mainclk_frq; | 27 | - vsz, vsz, data, fn); |
39 | uint32_t sram_addr_width; | 28 | + if (fn == NULL) { |
40 | uint32_t init_svtor; | 29 | + return false; |
41 | bool cpu_fpu[SSE_MAX_CPUS]; | 30 | + } |
42 | diff --git a/include/hw/timer/cmsdk-apb-dualtimer.h b/include/hw/timer/cmsdk-apb-dualtimer.h | 31 | + if (sve_access_check(s)) { |
43 | index XXXXXXX..XXXXXXX 100644 | 32 | + unsigned vsz = vec_full_reg_size(s); |
44 | --- a/include/hw/timer/cmsdk-apb-dualtimer.h | 33 | + tcg_gen_gvec_3_ool(vec_full_reg_offset(s, rd), |
45 | +++ b/include/hw/timer/cmsdk-apb-dualtimer.h | 34 | + vec_full_reg_offset(s, rn), |
46 | @@ -XXX,XX +XXX,XX @@ | 35 | + vec_full_reg_offset(s, rm), |
47 | * https://developer.arm.com/products/system-design/system-design-kits/cortex-m-system-design-kit | 36 | + vsz, vsz, data, fn); |
48 | * | 37 | + } |
49 | * QEMU interface: | 38 | + return true; |
50 | - * + QOM property "pclk-frq": frequency at which the timer is clocked | 39 | } |
51 | * + Clock input "TIMCLK": clock (for both timers) | 40 | |
52 | * + sysbus MMIO region 0: the register bank | 41 | /* Invoke an out-of-line helper on 4 Zregs. */ |
53 | * + sysbus IRQ 0: combined timer interrupt TIMINTC | 42 | @@ -XXX,XX +XXX,XX @@ static bool trans_LSL_zzi(DisasContext *s, arg_rri_esz *a) |
54 | @@ -XXX,XX +XXX,XX @@ struct CMSDKAPBDualTimer { | 43 | |
55 | /*< public >*/ | 44 | static bool do_zzw_ool(DisasContext *s, arg_rrr_esz *a, gen_helper_gvec_3 *fn) |
56 | MemoryRegion iomem; | 45 | { |
57 | qemu_irq timerintc; | 46 | - if (fn == NULL) { |
58 | - uint32_t pclk_frq; | 47 | - return false; |
59 | Clock *timclk; | 48 | - } |
60 | 49 | - if (sve_access_check(s)) { | |
61 | CMSDKAPBDualTimerModule timermod[CMSDK_APB_DUALTIMER_NUM_MODULES]; | 50 | - gen_gvec_ool_zzz(s, fn, a->rd, a->rn, a->rm, 0); |
62 | diff --git a/include/hw/timer/cmsdk-apb-timer.h b/include/hw/timer/cmsdk-apb-timer.h | 51 | - } |
63 | index XXXXXXX..XXXXXXX 100644 | 52 | - return true; |
64 | --- a/include/hw/timer/cmsdk-apb-timer.h | 53 | + return gen_gvec_ool_zzz(s, fn, a->rd, a->rn, a->rm, 0); |
65 | +++ b/include/hw/timer/cmsdk-apb-timer.h | 54 | } |
66 | @@ -XXX,XX +XXX,XX @@ OBJECT_DECLARE_SIMPLE_TYPE(CMSDKAPBTimer, CMSDK_APB_TIMER) | 55 | |
56 | #define DO_ZZW(NAME, name) \ | ||
57 | @@ -XXX,XX +XXX,XX @@ static bool trans_RDVL(DisasContext *s, arg_RDVL *a) | ||
58 | |||
59 | static bool do_adr(DisasContext *s, arg_rrri *a, gen_helper_gvec_3 *fn) | ||
60 | { | ||
61 | - if (sve_access_check(s)) { | ||
62 | - gen_gvec_ool_zzz(s, fn, a->rd, a->rn, a->rm, a->imm); | ||
63 | - } | ||
64 | - return true; | ||
65 | + return gen_gvec_ool_zzz(s, fn, a->rd, a->rn, a->rm, a->imm); | ||
66 | } | ||
67 | |||
68 | static bool trans_ADR_p32(DisasContext *s, arg_rrri *a) | ||
69 | @@ -XXX,XX +XXX,XX @@ static bool trans_FTSSEL(DisasContext *s, arg_rrr_esz *a) | ||
70 | gen_helper_sve_ftssel_s, | ||
71 | gen_helper_sve_ftssel_d, | ||
72 | }; | ||
73 | - if (a->esz == 0) { | ||
74 | - return false; | ||
75 | - } | ||
76 | - if (sve_access_check(s)) { | ||
77 | - gen_gvec_ool_zzz(s, fns[a->esz], a->rd, a->rn, a->rm, 0); | ||
78 | - } | ||
79 | - return true; | ||
80 | + return gen_gvec_ool_zzz(s, fns[a->esz], a->rd, a->rn, a->rm, 0); | ||
81 | } | ||
67 | 82 | ||
68 | /* | 83 | /* |
69 | * QEMU interface: | 84 | @@ -XXX,XX +XXX,XX @@ static bool trans_TBL(DisasContext *s, arg_rrr_esz *a) |
70 | - * + QOM property "pclk-frq": frequency at which the timer is clocked | 85 | gen_helper_sve_tbl_b, gen_helper_sve_tbl_h, |
71 | * + Clock input "pclk": clock for the timer | 86 | gen_helper_sve_tbl_s, gen_helper_sve_tbl_d |
72 | * + sysbus MMIO region 0: the register bank | 87 | }; |
73 | * + sysbus IRQ 0: timer interrupt TIMERINT | 88 | - |
74 | @@ -XXX,XX +XXX,XX @@ struct CMSDKAPBTimer { | 89 | - if (sve_access_check(s)) { |
75 | /*< public >*/ | 90 | - gen_gvec_ool_zzz(s, fns[a->esz], a->rd, a->rn, a->rm, 0); |
76 | MemoryRegion iomem; | 91 | - } |
77 | qemu_irq timerint; | 92 | - return true; |
78 | - uint32_t pclk_frq; | 93 | + return gen_gvec_ool_zzz(s, fns[a->esz], a->rd, a->rn, a->rm, 0); |
79 | struct ptimer_state *timer; | 94 | } |
80 | Clock *pclk; | 95 | |
81 | 96 | static bool trans_TBL_sve2(DisasContext *s, arg_rrr_esz *a) | |
82 | diff --git a/include/hw/watchdog/cmsdk-apb-watchdog.h b/include/hw/watchdog/cmsdk-apb-watchdog.h | 97 | @@ -XXX,XX +XXX,XX @@ static bool trans_TBX(DisasContext *s, arg_rrr_esz *a) |
83 | index XXXXXXX..XXXXXXX 100644 | 98 | if (!dc_isar_feature(aa64_sve2, s)) { |
84 | --- a/include/hw/watchdog/cmsdk-apb-watchdog.h | 99 | return false; |
85 | +++ b/include/hw/watchdog/cmsdk-apb-watchdog.h | ||
86 | @@ -XXX,XX +XXX,XX @@ | ||
87 | * https://developer.arm.com/products/system-design/system-design-kits/cortex-m-system-design-kit | ||
88 | * | ||
89 | * QEMU interface: | ||
90 | - * + QOM property "wdogclk-frq": frequency at which the watchdog is clocked | ||
91 | * + Clock input "WDOGCLK": clock for the watchdog's timer | ||
92 | * + sysbus MMIO region 0: the register bank | ||
93 | * + sysbus IRQ 0: watchdog interrupt | ||
94 | @@ -XXX,XX +XXX,XX @@ struct CMSDKAPBWatchdog { | ||
95 | /*< public >*/ | ||
96 | MemoryRegion iomem; | ||
97 | qemu_irq wdogint; | ||
98 | - uint32_t wdogclk_frq; | ||
99 | bool is_luminary; | ||
100 | struct ptimer_state *timer; | ||
101 | Clock *wdogclk; | ||
102 | diff --git a/hw/arm/armsse.c b/hw/arm/armsse.c | ||
103 | index XXXXXXX..XXXXXXX 100644 | ||
104 | --- a/hw/arm/armsse.c | ||
105 | +++ b/hw/arm/armsse.c | ||
106 | @@ -XXX,XX +XXX,XX @@ static Property iotkit_properties[] = { | ||
107 | DEFINE_PROP_LINK("memory", ARMSSE, board_memory, TYPE_MEMORY_REGION, | ||
108 | MemoryRegion *), | ||
109 | DEFINE_PROP_UINT32("EXP_NUMIRQ", ARMSSE, exp_numirq, 64), | ||
110 | - DEFINE_PROP_UINT32("MAINCLK_FRQ", ARMSSE, mainclk_frq, 0), | ||
111 | DEFINE_PROP_UINT32("SRAM_ADDR_WIDTH", ARMSSE, sram_addr_width, 15), | ||
112 | DEFINE_PROP_UINT32("init-svtor", ARMSSE, init_svtor, 0x10000000), | ||
113 | DEFINE_PROP_BOOL("CPU0_FPU", ARMSSE, cpu_fpu[0], true), | ||
114 | @@ -XXX,XX +XXX,XX @@ static Property armsse_properties[] = { | ||
115 | DEFINE_PROP_LINK("memory", ARMSSE, board_memory, TYPE_MEMORY_REGION, | ||
116 | MemoryRegion *), | ||
117 | DEFINE_PROP_UINT32("EXP_NUMIRQ", ARMSSE, exp_numirq, 64), | ||
118 | - DEFINE_PROP_UINT32("MAINCLK_FRQ", ARMSSE, mainclk_frq, 0), | ||
119 | DEFINE_PROP_UINT32("SRAM_ADDR_WIDTH", ARMSSE, sram_addr_width, 15), | ||
120 | DEFINE_PROP_UINT32("init-svtor", ARMSSE, init_svtor, 0x10000000), | ||
121 | DEFINE_PROP_BOOL("CPU0_FPU", ARMSSE, cpu_fpu[0], false), | ||
122 | diff --git a/hw/timer/cmsdk-apb-dualtimer.c b/hw/timer/cmsdk-apb-dualtimer.c | ||
123 | index XXXXXXX..XXXXXXX 100644 | ||
124 | --- a/hw/timer/cmsdk-apb-dualtimer.c | ||
125 | +++ b/hw/timer/cmsdk-apb-dualtimer.c | ||
126 | @@ -XXX,XX +XXX,XX @@ static const VMStateDescription cmsdk_apb_dualtimer_vmstate = { | ||
127 | } | 100 | } |
128 | }; | 101 | - if (sve_access_check(s)) { |
129 | 102 | - gen_gvec_ool_zzz(s, fns[a->esz], a->rd, a->rn, a->rm, 0); | |
130 | -static Property cmsdk_apb_dualtimer_properties[] = { | 103 | - } |
131 | - DEFINE_PROP_UINT32("pclk-frq", CMSDKAPBDualTimer, pclk_frq, 0), | 104 | - return true; |
132 | - DEFINE_PROP_END_OF_LIST(), | 105 | + return gen_gvec_ool_zzz(s, fns[a->esz], a->rd, a->rn, a->rm, 0); |
133 | -}; | 106 | } |
134 | - | 107 | |
135 | static void cmsdk_apb_dualtimer_class_init(ObjectClass *klass, void *data) | 108 | static bool trans_UNPK(DisasContext *s, arg_UNPK *a) |
109 | @@ -XXX,XX +XXX,XX @@ static bool do_zip(DisasContext *s, arg_rrr_esz *a, bool high) | ||
110 | static bool do_zzz_data_ool(DisasContext *s, arg_rrr_esz *a, int data, | ||
111 | gen_helper_gvec_3 *fn) | ||
136 | { | 112 | { |
137 | DeviceClass *dc = DEVICE_CLASS(klass); | 113 | - if (sve_access_check(s)) { |
138 | @@ -XXX,XX +XXX,XX @@ static void cmsdk_apb_dualtimer_class_init(ObjectClass *klass, void *data) | 114 | - gen_gvec_ool_zzz(s, fn, a->rd, a->rn, a->rm, data); |
139 | dc->realize = cmsdk_apb_dualtimer_realize; | 115 | - } |
140 | dc->vmsd = &cmsdk_apb_dualtimer_vmstate; | 116 | - return true; |
141 | dc->reset = cmsdk_apb_dualtimer_reset; | 117 | + return gen_gvec_ool_zzz(s, fn, a->rd, a->rn, a->rm, data); |
142 | - device_class_set_props(dc, cmsdk_apb_dualtimer_properties); | ||
143 | } | 118 | } |
144 | 119 | ||
145 | static const TypeInfo cmsdk_apb_dualtimer_info = { | 120 | static bool trans_ZIP1_z(DisasContext *s, arg_rrr_esz *a) |
146 | diff --git a/hw/timer/cmsdk-apb-timer.c b/hw/timer/cmsdk-apb-timer.c | 121 | @@ -XXX,XX +XXX,XX @@ static bool trans_MUL_zzz(DisasContext *s, arg_rrr_esz *a) |
147 | index XXXXXXX..XXXXXXX 100644 | 122 | static bool do_sve2_zzz_ool(DisasContext *s, arg_rrr_esz *a, |
148 | --- a/hw/timer/cmsdk-apb-timer.c | 123 | gen_helper_gvec_3 *fn) |
149 | +++ b/hw/timer/cmsdk-apb-timer.c | 124 | { |
150 | @@ -XXX,XX +XXX,XX @@ static const VMStateDescription cmsdk_apb_timer_vmstate = { | 125 | - if (fn == NULL || !dc_isar_feature(aa64_sve2, s)) { |
126 | + if (!dc_isar_feature(aa64_sve2, s)) { | ||
127 | return false; | ||
151 | } | 128 | } |
152 | }; | 129 | - if (sve_access_check(s)) { |
153 | 130 | - gen_gvec_ool_zzz(s, fn, a->rd, a->rn, a->rm, 0); | |
154 | -static Property cmsdk_apb_timer_properties[] = { | 131 | - } |
155 | - DEFINE_PROP_UINT32("pclk-frq", CMSDKAPBTimer, pclk_frq, 0), | 132 | - return true; |
156 | - DEFINE_PROP_END_OF_LIST(), | 133 | + return gen_gvec_ool_zzz(s, fn, a->rd, a->rn, a->rm, 0); |
157 | -}; | ||
158 | - | ||
159 | static void cmsdk_apb_timer_class_init(ObjectClass *klass, void *data) | ||
160 | { | ||
161 | DeviceClass *dc = DEVICE_CLASS(klass); | ||
162 | @@ -XXX,XX +XXX,XX @@ static void cmsdk_apb_timer_class_init(ObjectClass *klass, void *data) | ||
163 | dc->realize = cmsdk_apb_timer_realize; | ||
164 | dc->vmsd = &cmsdk_apb_timer_vmstate; | ||
165 | dc->reset = cmsdk_apb_timer_reset; | ||
166 | - device_class_set_props(dc, cmsdk_apb_timer_properties); | ||
167 | } | 134 | } |
168 | 135 | ||
169 | static const TypeInfo cmsdk_apb_timer_info = { | 136 | static bool trans_SMULH_zzz(DisasContext *s, arg_rrr_esz *a) |
170 | diff --git a/hw/watchdog/cmsdk-apb-watchdog.c b/hw/watchdog/cmsdk-apb-watchdog.c | 137 | @@ -XXX,XX +XXX,XX @@ static bool do_aese(DisasContext *s, arg_rrr_esz *a, bool decrypt) |
171 | index XXXXXXX..XXXXXXX 100644 | 138 | if (!dc_isar_feature(aa64_sve2_aes, s)) { |
172 | --- a/hw/watchdog/cmsdk-apb-watchdog.c | 139 | return false; |
173 | +++ b/hw/watchdog/cmsdk-apb-watchdog.c | ||
174 | @@ -XXX,XX +XXX,XX @@ static const VMStateDescription cmsdk_apb_watchdog_vmstate = { | ||
175 | } | 140 | } |
176 | }; | 141 | - if (sve_access_check(s)) { |
177 | 142 | - gen_gvec_ool_zzz(s, gen_helper_crypto_aese, | |
178 | -static Property cmsdk_apb_watchdog_properties[] = { | 143 | - a->rd, a->rn, a->rm, decrypt); |
179 | - DEFINE_PROP_UINT32("wdogclk-frq", CMSDKAPBWatchdog, wdogclk_frq, 0), | 144 | - } |
180 | - DEFINE_PROP_END_OF_LIST(), | 145 | - return true; |
181 | -}; | 146 | + return gen_gvec_ool_zzz(s, gen_helper_crypto_aese, |
182 | - | 147 | + a->rd, a->rn, a->rm, decrypt); |
183 | static void cmsdk_apb_watchdog_class_init(ObjectClass *klass, void *data) | ||
184 | { | ||
185 | DeviceClass *dc = DEVICE_CLASS(klass); | ||
186 | @@ -XXX,XX +XXX,XX @@ static void cmsdk_apb_watchdog_class_init(ObjectClass *klass, void *data) | ||
187 | dc->realize = cmsdk_apb_watchdog_realize; | ||
188 | dc->vmsd = &cmsdk_apb_watchdog_vmstate; | ||
189 | dc->reset = cmsdk_apb_watchdog_reset; | ||
190 | - device_class_set_props(dc, cmsdk_apb_watchdog_properties); | ||
191 | } | 148 | } |
192 | 149 | ||
193 | static const TypeInfo cmsdk_apb_watchdog_info = { | 150 | static bool trans_AESE(DisasContext *s, arg_rrr_esz *a) |
151 | @@ -XXX,XX +XXX,XX @@ static bool do_sm4(DisasContext *s, arg_rrr_esz *a, gen_helper_gvec_3 *fn) | ||
152 | if (!dc_isar_feature(aa64_sve2_sm4, s)) { | ||
153 | return false; | ||
154 | } | ||
155 | - if (sve_access_check(s)) { | ||
156 | - gen_gvec_ool_zzz(s, fn, a->rd, a->rn, a->rm, 0); | ||
157 | - } | ||
158 | - return true; | ||
159 | + return gen_gvec_ool_zzz(s, fn, a->rd, a->rn, a->rm, 0); | ||
160 | } | ||
161 | |||
162 | static bool trans_SM4E(DisasContext *s, arg_rrr_esz *a) | ||
194 | -- | 163 | -- |
195 | 2.20.1 | 164 | 2.25.1 |
196 | |||
197 | diff view generated by jsdifflib |
1 | Switch the CMSDK APB watchdog device over to using its Clock input; | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | the wdogclk_frq property is now ignored. | ||
3 | 2 | ||
3 | Use gen_gvec_ool_arg_zzz instead of gen_gvec_ool_zzz | ||
4 | when the arguments come from arg_rrr_esz. | ||
5 | Replaces do_zzw_ool and do_zzz_data_ool. | ||
6 | |||
7 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
8 | Message-id: 20220527181907.189259-6-richard.henderson@linaro.org | ||
9 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
4 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
5 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
6 | Reviewed-by: Luc Michel <luc@lmichel.fr> | ||
7 | Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
8 | Message-id: 20210128114145.20536-21-peter.maydell@linaro.org | ||
9 | Message-id: 20210121190622.22000-21-peter.maydell@linaro.org | ||
10 | --- | 11 | --- |
11 | hw/watchdog/cmsdk-apb-watchdog.c | 18 ++++++++++++++---- | 12 | target/arm/translate-sve.c | 48 +++++++++++++++++--------------------- |
12 | 1 file changed, 14 insertions(+), 4 deletions(-) | 13 | 1 file changed, 21 insertions(+), 27 deletions(-) |
13 | 14 | ||
14 | diff --git a/hw/watchdog/cmsdk-apb-watchdog.c b/hw/watchdog/cmsdk-apb-watchdog.c | 15 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c |
15 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/hw/watchdog/cmsdk-apb-watchdog.c | 17 | --- a/target/arm/translate-sve.c |
17 | +++ b/hw/watchdog/cmsdk-apb-watchdog.c | 18 | +++ b/target/arm/translate-sve.c |
18 | @@ -XXX,XX +XXX,XX @@ static void cmsdk_apb_watchdog_reset(DeviceState *dev) | 19 | @@ -XXX,XX +XXX,XX @@ static bool gen_gvec_ool_zzz(DisasContext *s, gen_helper_gvec_3 *fn, |
19 | ptimer_transaction_commit(s->timer); | 20 | return true; |
20 | } | 21 | } |
21 | 22 | ||
22 | +static void cmsdk_apb_watchdog_clk_update(void *opaque) | 23 | +static bool gen_gvec_ool_arg_zzz(DisasContext *s, gen_helper_gvec_3 *fn, |
24 | + arg_rrr_esz *a, int data) | ||
23 | +{ | 25 | +{ |
24 | + CMSDKAPBWatchdog *s = CMSDK_APB_WATCHDOG(opaque); | 26 | + return gen_gvec_ool_zzz(s, fn, a->rd, a->rn, a->rm, data); |
25 | + | ||
26 | + ptimer_transaction_begin(s->timer); | ||
27 | + ptimer_set_period_from_clock(s->timer, s->wdogclk, 1); | ||
28 | + ptimer_transaction_commit(s->timer); | ||
29 | +} | 27 | +} |
30 | + | 28 | + |
31 | static void cmsdk_apb_watchdog_init(Object *obj) | 29 | /* Invoke an out-of-line helper on 4 Zregs. */ |
30 | static void gen_gvec_ool_zzzz(DisasContext *s, gen_helper_gvec_4 *fn, | ||
31 | int rd, int rn, int rm, int ra, int data) | ||
32 | @@ -XXX,XX +XXX,XX @@ static bool trans_LSL_zzi(DisasContext *s, arg_rri_esz *a) | ||
33 | return do_shift_imm(s, a, false, tcg_gen_gvec_shli); | ||
34 | } | ||
35 | |||
36 | -static bool do_zzw_ool(DisasContext *s, arg_rrr_esz *a, gen_helper_gvec_3 *fn) | ||
37 | -{ | ||
38 | - return gen_gvec_ool_zzz(s, fn, a->rd, a->rn, a->rm, 0); | ||
39 | -} | ||
40 | - | ||
41 | #define DO_ZZW(NAME, name) \ | ||
42 | static bool trans_##NAME##_zzw(DisasContext *s, arg_rrr_esz *a) \ | ||
43 | { \ | ||
44 | @@ -XXX,XX +XXX,XX @@ static bool trans_##NAME##_zzw(DisasContext *s, arg_rrr_esz *a) \ | ||
45 | gen_helper_sve_##name##_zzw_b, gen_helper_sve_##name##_zzw_h, \ | ||
46 | gen_helper_sve_##name##_zzw_s, NULL \ | ||
47 | }; \ | ||
48 | - return do_zzw_ool(s, a, fns[a->esz]); \ | ||
49 | + return gen_gvec_ool_arg_zzz(s, fns[a->esz], a, 0); \ | ||
50 | } | ||
51 | |||
52 | DO_ZZW(ASR, asr) | ||
53 | @@ -XXX,XX +XXX,XX @@ static bool trans_FTSSEL(DisasContext *s, arg_rrr_esz *a) | ||
54 | gen_helper_sve_ftssel_s, | ||
55 | gen_helper_sve_ftssel_d, | ||
56 | }; | ||
57 | - return gen_gvec_ool_zzz(s, fns[a->esz], a->rd, a->rn, a->rm, 0); | ||
58 | + return gen_gvec_ool_arg_zzz(s, fns[a->esz], a, 0); | ||
59 | } | ||
60 | |||
61 | /* | ||
62 | @@ -XXX,XX +XXX,XX @@ static bool trans_TBL(DisasContext *s, arg_rrr_esz *a) | ||
63 | gen_helper_sve_tbl_b, gen_helper_sve_tbl_h, | ||
64 | gen_helper_sve_tbl_s, gen_helper_sve_tbl_d | ||
65 | }; | ||
66 | - return gen_gvec_ool_zzz(s, fns[a->esz], a->rd, a->rn, a->rm, 0); | ||
67 | + return gen_gvec_ool_arg_zzz(s, fns[a->esz], a, 0); | ||
68 | } | ||
69 | |||
70 | static bool trans_TBL_sve2(DisasContext *s, arg_rrr_esz *a) | ||
71 | @@ -XXX,XX +XXX,XX @@ static bool trans_TBX(DisasContext *s, arg_rrr_esz *a) | ||
72 | if (!dc_isar_feature(aa64_sve2, s)) { | ||
73 | return false; | ||
74 | } | ||
75 | - return gen_gvec_ool_zzz(s, fns[a->esz], a->rd, a->rn, a->rm, 0); | ||
76 | + return gen_gvec_ool_arg_zzz(s, fns[a->esz], a, 0); | ||
77 | } | ||
78 | |||
79 | static bool trans_UNPK(DisasContext *s, arg_UNPK *a) | ||
80 | @@ -XXX,XX +XXX,XX @@ static bool do_zip(DisasContext *s, arg_rrr_esz *a, bool high) | ||
81 | return true; | ||
82 | } | ||
83 | |||
84 | -static bool do_zzz_data_ool(DisasContext *s, arg_rrr_esz *a, int data, | ||
85 | - gen_helper_gvec_3 *fn) | ||
86 | -{ | ||
87 | - return gen_gvec_ool_zzz(s, fn, a->rd, a->rn, a->rm, data); | ||
88 | -} | ||
89 | - | ||
90 | static bool trans_ZIP1_z(DisasContext *s, arg_rrr_esz *a) | ||
32 | { | 91 | { |
33 | SysBusDevice *sbd = SYS_BUS_DEVICE(obj); | 92 | return do_zip(s, a, false); |
34 | @@ -XXX,XX +XXX,XX @@ static void cmsdk_apb_watchdog_init(Object *obj) | 93 | @@ -XXX,XX +XXX,XX @@ static gen_helper_gvec_3 * const uzp_fns[4] = { |
35 | s, "cmsdk-apb-watchdog", 0x1000); | 94 | |
36 | sysbus_init_mmio(sbd, &s->iomem); | 95 | static bool trans_UZP1_z(DisasContext *s, arg_rrr_esz *a) |
37 | sysbus_init_irq(sbd, &s->wdogint); | ||
38 | - s->wdogclk = qdev_init_clock_in(DEVICE(s), "WDOGCLK", NULL, NULL); | ||
39 | + s->wdogclk = qdev_init_clock_in(DEVICE(s), "WDOGCLK", | ||
40 | + cmsdk_apb_watchdog_clk_update, s); | ||
41 | |||
42 | s->is_luminary = false; | ||
43 | s->id = cmsdk_apb_watchdog_id; | ||
44 | @@ -XXX,XX +XXX,XX @@ static void cmsdk_apb_watchdog_realize(DeviceState *dev, Error **errp) | ||
45 | { | 96 | { |
46 | CMSDKAPBWatchdog *s = CMSDK_APB_WATCHDOG(dev); | 97 | - return do_zzz_data_ool(s, a, 0, uzp_fns[a->esz]); |
47 | 98 | + return gen_gvec_ool_arg_zzz(s, uzp_fns[a->esz], a, 0); | |
48 | - if (s->wdogclk_frq == 0) { | 99 | } |
49 | + if (!clock_has_source(s->wdogclk)) { | 100 | |
50 | error_setg(errp, | 101 | static bool trans_UZP2_z(DisasContext *s, arg_rrr_esz *a) |
51 | - "CMSDK APB watchdog: wdogclk-frq property must be set"); | 102 | { |
52 | + "CMSDK APB watchdog: WDOGCLK clock must be connected"); | 103 | - return do_zzz_data_ool(s, a, 1 << a->esz, uzp_fns[a->esz]); |
53 | return; | 104 | + return gen_gvec_ool_arg_zzz(s, uzp_fns[a->esz], a, 1 << a->esz); |
105 | } | ||
106 | |||
107 | static bool trans_UZP1_q(DisasContext *s, arg_rrr_esz *a) | ||
108 | @@ -XXX,XX +XXX,XX @@ static bool trans_UZP1_q(DisasContext *s, arg_rrr_esz *a) | ||
109 | if (!dc_isar_feature(aa64_sve_f64mm, s)) { | ||
110 | return false; | ||
54 | } | 111 | } |
55 | 112 | - return do_zzz_data_ool(s, a, 0, gen_helper_sve2_uzp_q); | |
56 | @@ -XXX,XX +XXX,XX @@ static void cmsdk_apb_watchdog_realize(DeviceState *dev, Error **errp) | 113 | + return gen_gvec_ool_arg_zzz(s, gen_helper_sve2_uzp_q, a, 0); |
57 | PTIMER_POLICY_NO_COUNTER_ROUND_DOWN); | ||
58 | |||
59 | ptimer_transaction_begin(s->timer); | ||
60 | - ptimer_set_freq(s->timer, s->wdogclk_frq); | ||
61 | + ptimer_set_period_from_clock(s->timer, s->wdogclk, 1); | ||
62 | ptimer_transaction_commit(s->timer); | ||
63 | } | 114 | } |
64 | 115 | ||
116 | static bool trans_UZP2_q(DisasContext *s, arg_rrr_esz *a) | ||
117 | @@ -XXX,XX +XXX,XX @@ static bool trans_UZP2_q(DisasContext *s, arg_rrr_esz *a) | ||
118 | if (!dc_isar_feature(aa64_sve_f64mm, s)) { | ||
119 | return false; | ||
120 | } | ||
121 | - return do_zzz_data_ool(s, a, 16, gen_helper_sve2_uzp_q); | ||
122 | + return gen_gvec_ool_arg_zzz(s, gen_helper_sve2_uzp_q, a, 16); | ||
123 | } | ||
124 | |||
125 | static gen_helper_gvec_3 * const trn_fns[4] = { | ||
126 | @@ -XXX,XX +XXX,XX @@ static gen_helper_gvec_3 * const trn_fns[4] = { | ||
127 | |||
128 | static bool trans_TRN1_z(DisasContext *s, arg_rrr_esz *a) | ||
129 | { | ||
130 | - return do_zzz_data_ool(s, a, 0, trn_fns[a->esz]); | ||
131 | + return gen_gvec_ool_arg_zzz(s, trn_fns[a->esz], a, 0); | ||
132 | } | ||
133 | |||
134 | static bool trans_TRN2_z(DisasContext *s, arg_rrr_esz *a) | ||
135 | { | ||
136 | - return do_zzz_data_ool(s, a, 1 << a->esz, trn_fns[a->esz]); | ||
137 | + return gen_gvec_ool_arg_zzz(s, trn_fns[a->esz], a, 1 << a->esz); | ||
138 | } | ||
139 | |||
140 | static bool trans_TRN1_q(DisasContext *s, arg_rrr_esz *a) | ||
141 | @@ -XXX,XX +XXX,XX @@ static bool trans_TRN1_q(DisasContext *s, arg_rrr_esz *a) | ||
142 | if (!dc_isar_feature(aa64_sve_f64mm, s)) { | ||
143 | return false; | ||
144 | } | ||
145 | - return do_zzz_data_ool(s, a, 0, gen_helper_sve2_trn_q); | ||
146 | + return gen_gvec_ool_arg_zzz(s, gen_helper_sve2_trn_q, a, 0); | ||
147 | } | ||
148 | |||
149 | static bool trans_TRN2_q(DisasContext *s, arg_rrr_esz *a) | ||
150 | @@ -XXX,XX +XXX,XX @@ static bool trans_TRN2_q(DisasContext *s, arg_rrr_esz *a) | ||
151 | if (!dc_isar_feature(aa64_sve_f64mm, s)) { | ||
152 | return false; | ||
153 | } | ||
154 | - return do_zzz_data_ool(s, a, 16, gen_helper_sve2_trn_q); | ||
155 | + return gen_gvec_ool_arg_zzz(s, gen_helper_sve2_trn_q, a, 16); | ||
156 | } | ||
157 | |||
158 | /* | ||
159 | @@ -XXX,XX +XXX,XX @@ static bool do_sve2_zzz_ool(DisasContext *s, arg_rrr_esz *a, | ||
160 | if (!dc_isar_feature(aa64_sve2, s)) { | ||
161 | return false; | ||
162 | } | ||
163 | - return gen_gvec_ool_zzz(s, fn, a->rd, a->rn, a->rm, 0); | ||
164 | + return gen_gvec_ool_arg_zzz(s, fn, a, 0); | ||
165 | } | ||
166 | |||
167 | static bool trans_SMULH_zzz(DisasContext *s, arg_rrr_esz *a) | ||
168 | @@ -XXX,XX +XXX,XX @@ static bool do_aese(DisasContext *s, arg_rrr_esz *a, bool decrypt) | ||
169 | if (!dc_isar_feature(aa64_sve2_aes, s)) { | ||
170 | return false; | ||
171 | } | ||
172 | - return gen_gvec_ool_zzz(s, gen_helper_crypto_aese, | ||
173 | - a->rd, a->rn, a->rm, decrypt); | ||
174 | + return gen_gvec_ool_arg_zzz(s, gen_helper_crypto_aese, a, decrypt); | ||
175 | } | ||
176 | |||
177 | static bool trans_AESE(DisasContext *s, arg_rrr_esz *a) | ||
178 | @@ -XXX,XX +XXX,XX @@ static bool do_sm4(DisasContext *s, arg_rrr_esz *a, gen_helper_gvec_3 *fn) | ||
179 | if (!dc_isar_feature(aa64_sve2_sm4, s)) { | ||
180 | return false; | ||
181 | } | ||
182 | - return gen_gvec_ool_zzz(s, fn, a->rd, a->rn, a->rm, 0); | ||
183 | + return gen_gvec_ool_arg_zzz(s, fn, a, 0); | ||
184 | } | ||
185 | |||
186 | static bool trans_SM4E(DisasContext *s, arg_rrr_esz *a) | ||
65 | -- | 187 | -- |
66 | 2.20.1 | 188 | 2.25.1 |
67 | |||
68 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | 1 | From: Richard Henderson <richard.henderson@linaro.org> | |
2 | |||
3 | Convert SVE translation functions using | ||
4 | gen_gvec_ool_arg_zzz to TRANS_FEAT. | ||
5 | |||
6 | Remove trivial wrappers do_aese, do_sm4. | ||
7 | |||
8 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
9 | Message-id: 20220527181907.189259-7-richard.henderson@linaro.org | ||
10 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
12 | --- | ||
13 | target/arm/translate-sve.c | 165 ++++++++++--------------------------- | ||
14 | 1 file changed, 45 insertions(+), 120 deletions(-) | ||
15 | |||
16 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c | ||
17 | index XXXXXXX..XXXXXXX 100644 | ||
18 | --- a/target/arm/translate-sve.c | ||
19 | +++ b/target/arm/translate-sve.c | ||
20 | @@ -XXX,XX +XXX,XX @@ static bool trans_LSL_zzi(DisasContext *s, arg_rri_esz *a) | ||
21 | } | ||
22 | |||
23 | #define DO_ZZW(NAME, name) \ | ||
24 | -static bool trans_##NAME##_zzw(DisasContext *s, arg_rrr_esz *a) \ | ||
25 | -{ \ | ||
26 | - static gen_helper_gvec_3 * const fns[4] = { \ | ||
27 | + static gen_helper_gvec_3 * const name##_zzw_fns[4] = { \ | ||
28 | gen_helper_sve_##name##_zzw_b, gen_helper_sve_##name##_zzw_h, \ | ||
29 | gen_helper_sve_##name##_zzw_s, NULL \ | ||
30 | }; \ | ||
31 | - return gen_gvec_ool_arg_zzz(s, fns[a->esz], a, 0); \ | ||
32 | -} | ||
33 | + TRANS_FEAT(NAME, aa64_sve, gen_gvec_ool_arg_zzz, \ | ||
34 | + name##_zzw_fns[a->esz], a, 0) | ||
35 | |||
36 | -DO_ZZW(ASR, asr) | ||
37 | -DO_ZZW(LSR, lsr) | ||
38 | -DO_ZZW(LSL, lsl) | ||
39 | +DO_ZZW(ASR_zzw, asr) | ||
40 | +DO_ZZW(LSR_zzw, lsr) | ||
41 | +DO_ZZW(LSL_zzw, lsl) | ||
42 | |||
43 | #undef DO_ZZW | ||
44 | |||
45 | @@ -XXX,XX +XXX,XX @@ static gen_helper_gvec_2 * const fexpa_fns[4] = { | ||
46 | TRANS_FEAT(FEXPA, aa64_sve, gen_gvec_ool_zz, | ||
47 | fexpa_fns[a->esz], a->rd, a->rn, 0) | ||
48 | |||
49 | -static bool trans_FTSSEL(DisasContext *s, arg_rrr_esz *a) | ||
50 | -{ | ||
51 | - static gen_helper_gvec_3 * const fns[4] = { | ||
52 | - NULL, | ||
53 | - gen_helper_sve_ftssel_h, | ||
54 | - gen_helper_sve_ftssel_s, | ||
55 | - gen_helper_sve_ftssel_d, | ||
56 | - }; | ||
57 | - return gen_gvec_ool_arg_zzz(s, fns[a->esz], a, 0); | ||
58 | -} | ||
59 | +static gen_helper_gvec_3 * const ftssel_fns[4] = { | ||
60 | + NULL, gen_helper_sve_ftssel_h, | ||
61 | + gen_helper_sve_ftssel_s, gen_helper_sve_ftssel_d, | ||
62 | +}; | ||
63 | +TRANS_FEAT(FTSSEL, aa64_sve, gen_gvec_ool_arg_zzz, ftssel_fns[a->esz], a, 0) | ||
64 | |||
65 | /* | ||
66 | *** SVE Predicate Logical Operations Group | ||
67 | @@ -XXX,XX +XXX,XX @@ static gen_helper_gvec_2 * const rev_fns[4] = { | ||
68 | }; | ||
69 | TRANS_FEAT(REV_v, aa64_sve, gen_gvec_ool_zz, rev_fns[a->esz], a->rd, a->rn, 0) | ||
70 | |||
71 | -static bool trans_TBL(DisasContext *s, arg_rrr_esz *a) | ||
72 | -{ | ||
73 | - static gen_helper_gvec_3 * const fns[4] = { | ||
74 | - gen_helper_sve_tbl_b, gen_helper_sve_tbl_h, | ||
75 | - gen_helper_sve_tbl_s, gen_helper_sve_tbl_d | ||
76 | - }; | ||
77 | - return gen_gvec_ool_arg_zzz(s, fns[a->esz], a, 0); | ||
78 | -} | ||
79 | +static gen_helper_gvec_3 * const sve_tbl_fns[4] = { | ||
80 | + gen_helper_sve_tbl_b, gen_helper_sve_tbl_h, | ||
81 | + gen_helper_sve_tbl_s, gen_helper_sve_tbl_d | ||
82 | +}; | ||
83 | +TRANS_FEAT(TBL, aa64_sve, gen_gvec_ool_arg_zzz, sve_tbl_fns[a->esz], a, 0) | ||
84 | |||
85 | static bool trans_TBL_sve2(DisasContext *s, arg_rrr_esz *a) | ||
86 | { | ||
87 | @@ -XXX,XX +XXX,XX @@ static bool trans_TBL_sve2(DisasContext *s, arg_rrr_esz *a) | ||
88 | return true; | ||
89 | } | ||
90 | |||
91 | -static bool trans_TBX(DisasContext *s, arg_rrr_esz *a) | ||
92 | -{ | ||
93 | - static gen_helper_gvec_3 * const fns[4] = { | ||
94 | - gen_helper_sve2_tbx_b, gen_helper_sve2_tbx_h, | ||
95 | - gen_helper_sve2_tbx_s, gen_helper_sve2_tbx_d | ||
96 | - }; | ||
97 | - | ||
98 | - if (!dc_isar_feature(aa64_sve2, s)) { | ||
99 | - return false; | ||
100 | - } | ||
101 | - return gen_gvec_ool_arg_zzz(s, fns[a->esz], a, 0); | ||
102 | -} | ||
103 | +static gen_helper_gvec_3 * const tbx_fns[4] = { | ||
104 | + gen_helper_sve2_tbx_b, gen_helper_sve2_tbx_h, | ||
105 | + gen_helper_sve2_tbx_s, gen_helper_sve2_tbx_d | ||
106 | +}; | ||
107 | +TRANS_FEAT(TBX, aa64_sve2, gen_gvec_ool_arg_zzz, tbx_fns[a->esz], a, 0) | ||
108 | |||
109 | static bool trans_UNPK(DisasContext *s, arg_UNPK *a) | ||
110 | { | ||
111 | @@ -XXX,XX +XXX,XX @@ static gen_helper_gvec_3 * const uzp_fns[4] = { | ||
112 | gen_helper_sve_uzp_s, gen_helper_sve_uzp_d, | ||
113 | }; | ||
114 | |||
115 | -static bool trans_UZP1_z(DisasContext *s, arg_rrr_esz *a) | ||
116 | -{ | ||
117 | - return gen_gvec_ool_arg_zzz(s, uzp_fns[a->esz], a, 0); | ||
118 | -} | ||
119 | +TRANS_FEAT(UZP1_z, aa64_sve, gen_gvec_ool_arg_zzz, | ||
120 | + uzp_fns[a->esz], a, 0) | ||
121 | +TRANS_FEAT(UZP2_z, aa64_sve, gen_gvec_ool_arg_zzz, | ||
122 | + uzp_fns[a->esz], a, 1 << a->esz) | ||
123 | |||
124 | -static bool trans_UZP2_z(DisasContext *s, arg_rrr_esz *a) | ||
125 | -{ | ||
126 | - return gen_gvec_ool_arg_zzz(s, uzp_fns[a->esz], a, 1 << a->esz); | ||
127 | -} | ||
128 | - | ||
129 | -static bool trans_UZP1_q(DisasContext *s, arg_rrr_esz *a) | ||
130 | -{ | ||
131 | - if (!dc_isar_feature(aa64_sve_f64mm, s)) { | ||
132 | - return false; | ||
133 | - } | ||
134 | - return gen_gvec_ool_arg_zzz(s, gen_helper_sve2_uzp_q, a, 0); | ||
135 | -} | ||
136 | - | ||
137 | -static bool trans_UZP2_q(DisasContext *s, arg_rrr_esz *a) | ||
138 | -{ | ||
139 | - if (!dc_isar_feature(aa64_sve_f64mm, s)) { | ||
140 | - return false; | ||
141 | - } | ||
142 | - return gen_gvec_ool_arg_zzz(s, gen_helper_sve2_uzp_q, a, 16); | ||
143 | -} | ||
144 | +TRANS_FEAT(UZP1_q, aa64_sve_f64mm, gen_gvec_ool_arg_zzz, | ||
145 | + gen_helper_sve2_uzp_q, a, 0) | ||
146 | +TRANS_FEAT(UZP2_q, aa64_sve_f64mm, gen_gvec_ool_arg_zzz, | ||
147 | + gen_helper_sve2_uzp_q, a, 16) | ||
148 | |||
149 | static gen_helper_gvec_3 * const trn_fns[4] = { | ||
150 | gen_helper_sve_trn_b, gen_helper_sve_trn_h, | ||
151 | gen_helper_sve_trn_s, gen_helper_sve_trn_d, | ||
152 | }; | ||
153 | |||
154 | -static bool trans_TRN1_z(DisasContext *s, arg_rrr_esz *a) | ||
155 | -{ | ||
156 | - return gen_gvec_ool_arg_zzz(s, trn_fns[a->esz], a, 0); | ||
157 | -} | ||
158 | +TRANS_FEAT(TRN1_z, aa64_sve, gen_gvec_ool_arg_zzz, | ||
159 | + trn_fns[a->esz], a, 0) | ||
160 | +TRANS_FEAT(TRN2_z, aa64_sve, gen_gvec_ool_arg_zzz, | ||
161 | + trn_fns[a->esz], a, 1 << a->esz) | ||
162 | |||
163 | -static bool trans_TRN2_z(DisasContext *s, arg_rrr_esz *a) | ||
164 | -{ | ||
165 | - return gen_gvec_ool_arg_zzz(s, trn_fns[a->esz], a, 1 << a->esz); | ||
166 | -} | ||
167 | - | ||
168 | -static bool trans_TRN1_q(DisasContext *s, arg_rrr_esz *a) | ||
169 | -{ | ||
170 | - if (!dc_isar_feature(aa64_sve_f64mm, s)) { | ||
171 | - return false; | ||
172 | - } | ||
173 | - return gen_gvec_ool_arg_zzz(s, gen_helper_sve2_trn_q, a, 0); | ||
174 | -} | ||
175 | - | ||
176 | -static bool trans_TRN2_q(DisasContext *s, arg_rrr_esz *a) | ||
177 | -{ | ||
178 | - if (!dc_isar_feature(aa64_sve_f64mm, s)) { | ||
179 | - return false; | ||
180 | - } | ||
181 | - return gen_gvec_ool_arg_zzz(s, gen_helper_sve2_trn_q, a, 16); | ||
182 | -} | ||
183 | +TRANS_FEAT(TRN1_q, aa64_sve_f64mm, gen_gvec_ool_arg_zzz, | ||
184 | + gen_helper_sve2_trn_q, a, 0) | ||
185 | +TRANS_FEAT(TRN2_q, aa64_sve_f64mm, gen_gvec_ool_arg_zzz, | ||
186 | + gen_helper_sve2_trn_q, a, 16) | ||
187 | |||
188 | /* | ||
189 | *** SVE Permute Vector - Predicated Group | ||
190 | @@ -XXX,XX +XXX,XX @@ static bool trans_USDOT_zzzz(DisasContext *s, arg_USDOT_zzzz *a) | ||
191 | TRANS_FEAT(AESMC, aa64_sve2_aes, gen_gvec_ool_zz, | ||
192 | gen_helper_crypto_aesmc, a->rd, a->rd, a->decrypt) | ||
193 | |||
194 | -static bool do_aese(DisasContext *s, arg_rrr_esz *a, bool decrypt) | ||
195 | -{ | ||
196 | - if (!dc_isar_feature(aa64_sve2_aes, s)) { | ||
197 | - return false; | ||
198 | - } | ||
199 | - return gen_gvec_ool_arg_zzz(s, gen_helper_crypto_aese, a, decrypt); | ||
200 | -} | ||
201 | +TRANS_FEAT(AESE, aa64_sve2_aes, gen_gvec_ool_arg_zzz, | ||
202 | + gen_helper_crypto_aese, a, false) | ||
203 | +TRANS_FEAT(AESD, aa64_sve2_aes, gen_gvec_ool_arg_zzz, | ||
204 | + gen_helper_crypto_aese, a, true) | ||
205 | |||
206 | -static bool trans_AESE(DisasContext *s, arg_rrr_esz *a) | ||
207 | -{ | ||
208 | - return do_aese(s, a, false); | ||
209 | -} | ||
210 | - | ||
211 | -static bool trans_AESD(DisasContext *s, arg_rrr_esz *a) | ||
212 | -{ | ||
213 | - return do_aese(s, a, true); | ||
214 | -} | ||
215 | - | ||
216 | -static bool do_sm4(DisasContext *s, arg_rrr_esz *a, gen_helper_gvec_3 *fn) | ||
217 | -{ | ||
218 | - if (!dc_isar_feature(aa64_sve2_sm4, s)) { | ||
219 | - return false; | ||
220 | - } | ||
221 | - return gen_gvec_ool_arg_zzz(s, fn, a, 0); | ||
222 | -} | ||
223 | - | ||
224 | -static bool trans_SM4E(DisasContext *s, arg_rrr_esz *a) | ||
225 | -{ | ||
226 | - return do_sm4(s, a, gen_helper_crypto_sm4e); | ||
227 | -} | ||
228 | - | ||
229 | -static bool trans_SM4EKEY(DisasContext *s, arg_rrr_esz *a) | ||
230 | -{ | ||
231 | - return do_sm4(s, a, gen_helper_crypto_sm4ekey); | ||
232 | -} | ||
233 | +TRANS_FEAT(SM4E, aa64_sve2_sm4, gen_gvec_ool_arg_zzz, | ||
234 | + gen_helper_crypto_sm4e, a, 0) | ||
235 | +TRANS_FEAT(SM4EKEY, aa64_sve2_sm4, gen_gvec_ool_arg_zzz, | ||
236 | + gen_helper_crypto_sm4ekey, a, 0) | ||
237 | |||
238 | static bool trans_RAX1(DisasContext *s, arg_rrr_esz *a) | ||
239 | { | ||
240 | -- | ||
241 | 2.25.1 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | Convert SVE translation functions using do_sve2_zzz_ool | ||
4 | to use TRANS_FEAT and gen_gvec_ool_arg_zzz. | ||
5 | |||
6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Message-id: 20220527181907.189259-8-richard.henderson@linaro.org | ||
8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | --- | ||
11 | target/arm/translate-sve.c | 88 ++++++++++++++------------------------ | ||
12 | 1 file changed, 31 insertions(+), 57 deletions(-) | ||
13 | |||
14 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c | ||
15 | index XXXXXXX..XXXXXXX 100644 | ||
16 | --- a/target/arm/translate-sve.c | ||
17 | +++ b/target/arm/translate-sve.c | ||
18 | @@ -XXX,XX +XXX,XX @@ static bool trans_MUL_zzz(DisasContext *s, arg_rrr_esz *a) | ||
19 | return true; | ||
20 | } | ||
21 | |||
22 | -static bool do_sve2_zzz_ool(DisasContext *s, arg_rrr_esz *a, | ||
23 | - gen_helper_gvec_3 *fn) | ||
24 | -{ | ||
25 | - if (!dc_isar_feature(aa64_sve2, s)) { | ||
26 | - return false; | ||
27 | - } | ||
28 | - return gen_gvec_ool_arg_zzz(s, fn, a, 0); | ||
29 | -} | ||
30 | +static gen_helper_gvec_3 * const smulh_zzz_fns[4] = { | ||
31 | + gen_helper_gvec_smulh_b, gen_helper_gvec_smulh_h, | ||
32 | + gen_helper_gvec_smulh_s, gen_helper_gvec_smulh_d, | ||
33 | +}; | ||
34 | +TRANS_FEAT(SMULH_zzz, aa64_sve2, gen_gvec_ool_arg_zzz, | ||
35 | + smulh_zzz_fns[a->esz], a, 0) | ||
36 | |||
37 | -static bool trans_SMULH_zzz(DisasContext *s, arg_rrr_esz *a) | ||
38 | -{ | ||
39 | - static gen_helper_gvec_3 * const fns[4] = { | ||
40 | - gen_helper_gvec_smulh_b, gen_helper_gvec_smulh_h, | ||
41 | - gen_helper_gvec_smulh_s, gen_helper_gvec_smulh_d, | ||
42 | - }; | ||
43 | - return do_sve2_zzz_ool(s, a, fns[a->esz]); | ||
44 | -} | ||
45 | +static gen_helper_gvec_3 * const umulh_zzz_fns[4] = { | ||
46 | + gen_helper_gvec_umulh_b, gen_helper_gvec_umulh_h, | ||
47 | + gen_helper_gvec_umulh_s, gen_helper_gvec_umulh_d, | ||
48 | +}; | ||
49 | +TRANS_FEAT(UMULH_zzz, aa64_sve2, gen_gvec_ool_arg_zzz, | ||
50 | + umulh_zzz_fns[a->esz], a, 0) | ||
51 | |||
52 | -static bool trans_UMULH_zzz(DisasContext *s, arg_rrr_esz *a) | ||
53 | -{ | ||
54 | - static gen_helper_gvec_3 * const fns[4] = { | ||
55 | - gen_helper_gvec_umulh_b, gen_helper_gvec_umulh_h, | ||
56 | - gen_helper_gvec_umulh_s, gen_helper_gvec_umulh_d, | ||
57 | - }; | ||
58 | - return do_sve2_zzz_ool(s, a, fns[a->esz]); | ||
59 | -} | ||
60 | +TRANS_FEAT(PMUL_zzz, aa64_sve2, gen_gvec_ool_arg_zzz, | ||
61 | + gen_helper_gvec_pmul_b, a, 0) | ||
62 | |||
63 | -static bool trans_PMUL_zzz(DisasContext *s, arg_rrr_esz *a) | ||
64 | -{ | ||
65 | - return do_sve2_zzz_ool(s, a, gen_helper_gvec_pmul_b); | ||
66 | -} | ||
67 | +static gen_helper_gvec_3 * const sqdmulh_zzz_fns[4] = { | ||
68 | + gen_helper_sve2_sqdmulh_b, gen_helper_sve2_sqdmulh_h, | ||
69 | + gen_helper_sve2_sqdmulh_s, gen_helper_sve2_sqdmulh_d, | ||
70 | +}; | ||
71 | +TRANS_FEAT(SQDMULH_zzz, aa64_sve2, gen_gvec_ool_arg_zzz, | ||
72 | + sqdmulh_zzz_fns[a->esz], a, 0) | ||
73 | |||
74 | -static bool trans_SQDMULH_zzz(DisasContext *s, arg_rrr_esz *a) | ||
75 | -{ | ||
76 | - static gen_helper_gvec_3 * const fns[4] = { | ||
77 | - gen_helper_sve2_sqdmulh_b, gen_helper_sve2_sqdmulh_h, | ||
78 | - gen_helper_sve2_sqdmulh_s, gen_helper_sve2_sqdmulh_d, | ||
79 | - }; | ||
80 | - return do_sve2_zzz_ool(s, a, fns[a->esz]); | ||
81 | -} | ||
82 | - | ||
83 | -static bool trans_SQRDMULH_zzz(DisasContext *s, arg_rrr_esz *a) | ||
84 | -{ | ||
85 | - static gen_helper_gvec_3 * const fns[4] = { | ||
86 | - gen_helper_sve2_sqrdmulh_b, gen_helper_sve2_sqrdmulh_h, | ||
87 | - gen_helper_sve2_sqrdmulh_s, gen_helper_sve2_sqrdmulh_d, | ||
88 | - }; | ||
89 | - return do_sve2_zzz_ool(s, a, fns[a->esz]); | ||
90 | -} | ||
91 | +static gen_helper_gvec_3 * const sqrdmulh_zzz_fns[4] = { | ||
92 | + gen_helper_sve2_sqrdmulh_b, gen_helper_sve2_sqrdmulh_h, | ||
93 | + gen_helper_sve2_sqrdmulh_s, gen_helper_sve2_sqrdmulh_d, | ||
94 | +}; | ||
95 | +TRANS_FEAT(SQRDMULH_zzz, aa64_sve2, gen_gvec_ool_arg_zzz, | ||
96 | + sqrdmulh_zzz_fns[a->esz], a, 0) | ||
97 | |||
98 | /* | ||
99 | * SVE2 Integer - Predicated | ||
100 | @@ -XXX,XX +XXX,XX @@ static bool trans_UQRSHRNT(DisasContext *s, arg_rri_esz *a) | ||
101 | } | ||
102 | |||
103 | #define DO_SVE2_ZZZ_NARROW(NAME, name) \ | ||
104 | -static bool trans_##NAME(DisasContext *s, arg_rrr_esz *a) \ | ||
105 | -{ \ | ||
106 | - static gen_helper_gvec_3 * const fns[4] = { \ | ||
107 | + static gen_helper_gvec_3 * const name##_fns[4] = { \ | ||
108 | NULL, gen_helper_sve2_##name##_h, \ | ||
109 | gen_helper_sve2_##name##_s, gen_helper_sve2_##name##_d, \ | ||
110 | }; \ | ||
111 | - return do_sve2_zzz_ool(s, a, fns[a->esz]); \ | ||
112 | -} | ||
113 | + TRANS_FEAT(NAME, aa64_sve2, gen_gvec_ool_arg_zzz, \ | ||
114 | + name##_fns[a->esz], a, 0) | ||
115 | |||
116 | DO_SVE2_ZZZ_NARROW(ADDHNB, addhnb) | ||
117 | DO_SVE2_ZZZ_NARROW(ADDHNT, addhnt) | ||
118 | @@ -XXX,XX +XXX,XX @@ static bool trans_HISTCNT(DisasContext *s, arg_rprr_esz *a) | ||
119 | return do_sve2_zpzz_ool(s, a, fns[a->esz - 2]); | ||
120 | } | ||
121 | |||
122 | -static bool trans_HISTSEG(DisasContext *s, arg_rrr_esz *a) | ||
123 | -{ | ||
124 | - if (a->esz != 0) { | ||
125 | - return false; | ||
126 | - } | ||
127 | - return do_sve2_zzz_ool(s, a, gen_helper_sve2_histseg); | ||
128 | -} | ||
129 | +TRANS_FEAT(HISTSEG, aa64_sve2, gen_gvec_ool_arg_zzz, | ||
130 | + a->esz == 0 ? gen_helper_sve2_histseg : NULL, a, 0) | ||
131 | |||
132 | static bool do_sve2_zpzz_fp(DisasContext *s, arg_rprr_esz *a, | ||
133 | gen_helper_gvec_4_ptr *fn) | ||
134 | -- | ||
135 | 2.25.1 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
4 | Message-id: 20220527181907.189259-9-richard.henderson@linaro.org | ||
5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | --- | ||
8 | target/arm/translate-sve.c | 102 ++++++++++++++----------------------- | ||
9 | 1 file changed, 38 insertions(+), 64 deletions(-) | ||
10 | |||
11 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c | ||
12 | index XXXXXXX..XXXXXXX 100644 | ||
13 | --- a/target/arm/translate-sve.c | ||
14 | +++ b/target/arm/translate-sve.c | ||
15 | @@ -XXX,XX +XXX,XX @@ static bool gen_gvec_ool_arg_zzz(DisasContext *s, gen_helper_gvec_3 *fn, | ||
16 | } | ||
17 | |||
18 | /* Invoke an out-of-line helper on 4 Zregs. */ | ||
19 | -static void gen_gvec_ool_zzzz(DisasContext *s, gen_helper_gvec_4 *fn, | ||
20 | +static bool gen_gvec_ool_zzzz(DisasContext *s, gen_helper_gvec_4 *fn, | ||
21 | int rd, int rn, int rm, int ra, int data) | ||
22 | { | ||
23 | - unsigned vsz = vec_full_reg_size(s); | ||
24 | - tcg_gen_gvec_4_ool(vec_full_reg_offset(s, rd), | ||
25 | - vec_full_reg_offset(s, rn), | ||
26 | - vec_full_reg_offset(s, rm), | ||
27 | - vec_full_reg_offset(s, ra), | ||
28 | - vsz, vsz, data, fn); | ||
29 | + if (fn == NULL) { | ||
30 | + return false; | ||
31 | + } | ||
32 | + if (sve_access_check(s)) { | ||
33 | + unsigned vsz = vec_full_reg_size(s); | ||
34 | + tcg_gen_gvec_4_ool(vec_full_reg_offset(s, rd), | ||
35 | + vec_full_reg_offset(s, rn), | ||
36 | + vec_full_reg_offset(s, rm), | ||
37 | + vec_full_reg_offset(s, ra), | ||
38 | + vsz, vsz, data, fn); | ||
39 | + } | ||
40 | + return true; | ||
41 | } | ||
42 | |||
43 | /* Invoke an out-of-line helper on 2 Zregs and a predicate. */ | ||
44 | @@ -XXX,XX +XXX,XX @@ static bool trans_TBL_sve2(DisasContext *s, arg_rrr_esz *a) | ||
45 | if (!dc_isar_feature(aa64_sve2, s)) { | ||
46 | return false; | ||
47 | } | ||
48 | - if (sve_access_check(s)) { | ||
49 | - gen_gvec_ool_zzzz(s, fns[a->esz], a->rd, a->rn, | ||
50 | - (a->rn + 1) % 32, a->rm, 0); | ||
51 | - } | ||
52 | - return true; | ||
53 | + return gen_gvec_ool_zzzz(s, fns[a->esz], a->rd, a->rn, | ||
54 | + (a->rn + 1) % 32, a->rm, 0); | ||
55 | } | ||
56 | |||
57 | static gen_helper_gvec_3 * const tbx_fns[4] = { | ||
58 | @@ -XXX,XX +XXX,XX @@ static bool trans_DOT_zzzz(DisasContext *s, arg_DOT_zzzz *a) | ||
59 | { gen_helper_gvec_sdot_b, gen_helper_gvec_sdot_h }, | ||
60 | { gen_helper_gvec_udot_b, gen_helper_gvec_udot_h } | ||
61 | }; | ||
62 | - | ||
63 | - if (sve_access_check(s)) { | ||
64 | - gen_gvec_ool_zzzz(s, fns[a->u][a->sz], a->rd, a->rn, a->rm, a->ra, 0); | ||
65 | - } | ||
66 | - return true; | ||
67 | + return gen_gvec_ool_zzzz(s, fns[a->u][a->sz], | ||
68 | + a->rd, a->rn, a->rm, a->ra, 0); | ||
69 | } | ||
70 | |||
71 | /* | ||
72 | @@ -XXX,XX +XXX,XX @@ static bool trans_DOT_zzzz(DisasContext *s, arg_DOT_zzzz *a) | ||
73 | static bool do_zzxz_ool(DisasContext *s, arg_rrxr_esz *a, | ||
74 | gen_helper_gvec_4 *fn) | ||
75 | { | ||
76 | - if (fn == NULL) { | ||
77 | - return false; | ||
78 | - } | ||
79 | - if (sve_access_check(s)) { | ||
80 | - gen_gvec_ool_zzzz(s, fn, a->rd, a->rn, a->rm, a->ra, a->index); | ||
81 | - } | ||
82 | - return true; | ||
83 | + return gen_gvec_ool_zzzz(s, fn, a->rd, a->rn, a->rm, a->ra, a->index); | ||
84 | } | ||
85 | |||
86 | #define DO_RRXR(NAME, FUNC) \ | ||
87 | @@ -XXX,XX +XXX,XX @@ static bool trans_SQCADD_rot270(DisasContext *s, arg_rrr_esz *a) | ||
88 | static bool do_sve2_zzzz_ool(DisasContext *s, arg_rrrr_esz *a, | ||
89 | gen_helper_gvec_4 *fn, int data) | ||
90 | { | ||
91 | - if (fn == NULL || !dc_isar_feature(aa64_sve2, s)) { | ||
92 | + if (!dc_isar_feature(aa64_sve2, s)) { | ||
93 | return false; | ||
94 | } | ||
95 | - if (sve_access_check(s)) { | ||
96 | - gen_gvec_ool_zzzz(s, fn, a->rd, a->rn, a->rm, a->ra, data); | ||
97 | - } | ||
98 | - return true; | ||
99 | + return gen_gvec_ool_zzzz(s, fn, a->rd, a->rn, a->rm, a->ra, data); | ||
100 | } | ||
101 | |||
102 | static bool do_abal(DisasContext *s, arg_rrrr_esz *a, bool uns, bool sel) | ||
103 | @@ -XXX,XX +XXX,XX @@ static bool trans_CMLA_zzzz(DisasContext *s, arg_CMLA_zzzz *a) | ||
104 | if (!dc_isar_feature(aa64_sve2, s)) { | ||
105 | return false; | ||
106 | } | ||
107 | - if (sve_access_check(s)) { | ||
108 | - gen_gvec_ool_zzzz(s, fns[a->esz], a->rd, a->rn, a->rm, a->ra, a->rot); | ||
109 | - } | ||
110 | - return true; | ||
111 | + return gen_gvec_ool_zzzz(s, fns[a->esz], a->rd, a->rn, | ||
112 | + a->rm, a->ra, a->rot); | ||
113 | } | ||
114 | |||
115 | static bool trans_CDOT_zzzz(DisasContext *s, arg_CMLA_zzzz *a) | ||
116 | { | ||
117 | - if (!dc_isar_feature(aa64_sve2, s) || a->esz < MO_32) { | ||
118 | + static gen_helper_gvec_4 * const fns[] = { | ||
119 | + NULL, NULL, gen_helper_sve2_cdot_zzzz_s, gen_helper_sve2_cdot_zzzz_d | ||
120 | + }; | ||
121 | + | ||
122 | + if (!dc_isar_feature(aa64_sve2, s)) { | ||
123 | return false; | ||
124 | } | ||
125 | - if (sve_access_check(s)) { | ||
126 | - gen_helper_gvec_4 *fn = (a->esz == MO_32 | ||
127 | - ? gen_helper_sve2_cdot_zzzz_s | ||
128 | - : gen_helper_sve2_cdot_zzzz_d); | ||
129 | - gen_gvec_ool_zzzz(s, fn, a->rd, a->rn, a->rm, a->ra, a->rot); | ||
130 | - } | ||
131 | - return true; | ||
132 | + return gen_gvec_ool_zzzz(s, fns[a->esz], a->rd, a->rn, | ||
133 | + a->rm, a->ra, a->rot); | ||
134 | } | ||
135 | |||
136 | static bool trans_SQRDCMLAH_zzzz(DisasContext *s, arg_SQRDCMLAH_zzzz *a) | ||
137 | @@ -XXX,XX +XXX,XX @@ static bool trans_SQRDCMLAH_zzzz(DisasContext *s, arg_SQRDCMLAH_zzzz *a) | ||
138 | if (!dc_isar_feature(aa64_sve2, s)) { | ||
139 | return false; | ||
140 | } | ||
141 | - if (sve_access_check(s)) { | ||
142 | - gen_gvec_ool_zzzz(s, fns[a->esz], a->rd, a->rn, a->rm, a->ra, a->rot); | ||
143 | - } | ||
144 | - return true; | ||
145 | + return gen_gvec_ool_zzzz(s, fns[a->esz], a->rd, a->rn, | ||
146 | + a->rm, a->ra, a->rot); | ||
147 | } | ||
148 | |||
149 | static bool trans_USDOT_zzzz(DisasContext *s, arg_USDOT_zzzz *a) | ||
150 | @@ -XXX,XX +XXX,XX @@ static bool do_i8mm_zzzz_ool(DisasContext *s, arg_rrrr_esz *a, | ||
151 | if (!dc_isar_feature(aa64_sve_i8mm, s)) { | ||
152 | return false; | ||
153 | } | ||
154 | - if (sve_access_check(s)) { | ||
155 | - gen_gvec_ool_zzzz(s, fn, a->rd, a->rn, a->rm, a->ra, data); | ||
156 | - } | ||
157 | - return true; | ||
158 | + return gen_gvec_ool_zzzz(s, fn, a->rd, a->rn, a->rm, a->ra, data); | ||
159 | } | ||
160 | |||
161 | static bool trans_SMMLA(DisasContext *s, arg_rrrr_esz *a) | ||
162 | @@ -XXX,XX +XXX,XX @@ static bool trans_BFDOT_zzzz(DisasContext *s, arg_rrrr_esz *a) | ||
163 | if (!dc_isar_feature(aa64_sve_bf16, s)) { | ||
164 | return false; | ||
165 | } | ||
166 | - if (sve_access_check(s)) { | ||
167 | - gen_gvec_ool_zzzz(s, gen_helper_gvec_bfdot, | ||
168 | - a->rd, a->rn, a->rm, a->ra, 0); | ||
169 | - } | ||
170 | - return true; | ||
171 | + return gen_gvec_ool_zzzz(s, gen_helper_gvec_bfdot, | ||
172 | + a->rd, a->rn, a->rm, a->ra, 0); | ||
173 | } | ||
174 | |||
175 | static bool trans_BFDOT_zzxz(DisasContext *s, arg_rrxr_esz *a) | ||
176 | @@ -XXX,XX +XXX,XX @@ static bool trans_BFDOT_zzxz(DisasContext *s, arg_rrxr_esz *a) | ||
177 | if (!dc_isar_feature(aa64_sve_bf16, s)) { | ||
178 | return false; | ||
179 | } | ||
180 | - if (sve_access_check(s)) { | ||
181 | - gen_gvec_ool_zzzz(s, gen_helper_gvec_bfdot_idx, | ||
182 | - a->rd, a->rn, a->rm, a->ra, a->index); | ||
183 | - } | ||
184 | - return true; | ||
185 | + return gen_gvec_ool_zzzz(s, gen_helper_gvec_bfdot_idx, | ||
186 | + a->rd, a->rn, a->rm, a->ra, a->index); | ||
187 | } | ||
188 | |||
189 | static bool trans_BFMMLA(DisasContext *s, arg_rrrr_esz *a) | ||
190 | @@ -XXX,XX +XXX,XX @@ static bool trans_BFMMLA(DisasContext *s, arg_rrrr_esz *a) | ||
191 | if (!dc_isar_feature(aa64_sve_bf16, s)) { | ||
192 | return false; | ||
193 | } | ||
194 | - if (sve_access_check(s)) { | ||
195 | - gen_gvec_ool_zzzz(s, gen_helper_gvec_bfmmla, | ||
196 | - a->rd, a->rn, a->rm, a->ra, 0); | ||
197 | - } | ||
198 | - return true; | ||
199 | + return gen_gvec_ool_zzzz(s, gen_helper_gvec_bfmmla, | ||
200 | + a->rd, a->rn, a->rm, a->ra, 0); | ||
201 | } | ||
202 | |||
203 | static bool do_BFMLAL_zzzw(DisasContext *s, arg_rrrr_esz *a, bool sel) | ||
204 | -- | ||
205 | 2.25.1 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | Convert SVE translation functions directly using | ||
4 | gen_gvec_ool_zzzz to TRANS_FEAT. | ||
5 | |||
6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Message-id: 20220527181907.189259-10-richard.henderson@linaro.org | ||
8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | --- | ||
11 | target/arm/translate-sve.c | 89 +++++++++++++------------------------- | ||
12 | 1 file changed, 29 insertions(+), 60 deletions(-) | ||
13 | |||
14 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c | ||
15 | index XXXXXXX..XXXXXXX 100644 | ||
16 | --- a/target/arm/translate-sve.c | ||
17 | +++ b/target/arm/translate-sve.c | ||
18 | @@ -XXX,XX +XXX,XX @@ static gen_helper_gvec_3 * const sve_tbl_fns[4] = { | ||
19 | }; | ||
20 | TRANS_FEAT(TBL, aa64_sve, gen_gvec_ool_arg_zzz, sve_tbl_fns[a->esz], a, 0) | ||
21 | |||
22 | -static bool trans_TBL_sve2(DisasContext *s, arg_rrr_esz *a) | ||
23 | -{ | ||
24 | - static gen_helper_gvec_4 * const fns[4] = { | ||
25 | - gen_helper_sve2_tbl_b, gen_helper_sve2_tbl_h, | ||
26 | - gen_helper_sve2_tbl_s, gen_helper_sve2_tbl_d | ||
27 | - }; | ||
28 | - | ||
29 | - if (!dc_isar_feature(aa64_sve2, s)) { | ||
30 | - return false; | ||
31 | - } | ||
32 | - return gen_gvec_ool_zzzz(s, fns[a->esz], a->rd, a->rn, | ||
33 | - (a->rn + 1) % 32, a->rm, 0); | ||
34 | -} | ||
35 | +static gen_helper_gvec_4 * const sve2_tbl_fns[4] = { | ||
36 | + gen_helper_sve2_tbl_b, gen_helper_sve2_tbl_h, | ||
37 | + gen_helper_sve2_tbl_s, gen_helper_sve2_tbl_d | ||
38 | +}; | ||
39 | +TRANS_FEAT(TBL_sve2, aa64_sve2, gen_gvec_ool_zzzz, sve2_tbl_fns[a->esz], | ||
40 | + a->rd, a->rn, (a->rn + 1) % 32, a->rm, 0) | ||
41 | |||
42 | static gen_helper_gvec_3 * const tbx_fns[4] = { | ||
43 | gen_helper_sve2_tbx_b, gen_helper_sve2_tbx_h, | ||
44 | @@ -XXX,XX +XXX,XX @@ DO_ZZI(UMIN, umin) | ||
45 | |||
46 | #undef DO_ZZI | ||
47 | |||
48 | -static bool trans_DOT_zzzz(DisasContext *s, arg_DOT_zzzz *a) | ||
49 | -{ | ||
50 | - static gen_helper_gvec_4 * const fns[2][2] = { | ||
51 | - { gen_helper_gvec_sdot_b, gen_helper_gvec_sdot_h }, | ||
52 | - { gen_helper_gvec_udot_b, gen_helper_gvec_udot_h } | ||
53 | - }; | ||
54 | - return gen_gvec_ool_zzzz(s, fns[a->u][a->sz], | ||
55 | - a->rd, a->rn, a->rm, a->ra, 0); | ||
56 | -} | ||
57 | +static gen_helper_gvec_4 * const dot_fns[2][2] = { | ||
58 | + { gen_helper_gvec_sdot_b, gen_helper_gvec_sdot_h }, | ||
59 | + { gen_helper_gvec_udot_b, gen_helper_gvec_udot_h } | ||
60 | +}; | ||
61 | +TRANS_FEAT(DOT_zzzz, aa64_sve, gen_gvec_ool_zzzz, | ||
62 | + dot_fns[a->u][a->sz], a->rd, a->rn, a->rm, a->ra, 0) | ||
63 | |||
64 | /* | ||
65 | * SVE Multiply - Indexed | ||
66 | @@ -XXX,XX +XXX,XX @@ static bool trans_UMLSLT_zzzw(DisasContext *s, arg_rrrr_esz *a) | ||
67 | return do_umlsl_zzzw(s, a, true); | ||
68 | } | ||
69 | |||
70 | -static bool trans_CMLA_zzzz(DisasContext *s, arg_CMLA_zzzz *a) | ||
71 | -{ | ||
72 | - static gen_helper_gvec_4 * const fns[] = { | ||
73 | - gen_helper_sve2_cmla_zzzz_b, gen_helper_sve2_cmla_zzzz_h, | ||
74 | - gen_helper_sve2_cmla_zzzz_s, gen_helper_sve2_cmla_zzzz_d, | ||
75 | - }; | ||
76 | +static gen_helper_gvec_4 * const cmla_fns[] = { | ||
77 | + gen_helper_sve2_cmla_zzzz_b, gen_helper_sve2_cmla_zzzz_h, | ||
78 | + gen_helper_sve2_cmla_zzzz_s, gen_helper_sve2_cmla_zzzz_d, | ||
79 | +}; | ||
80 | +TRANS_FEAT(CMLA_zzzz, aa64_sve2, gen_gvec_ool_zzzz, | ||
81 | + cmla_fns[a->esz], a->rd, a->rn, a->rm, a->ra, a->rot) | ||
82 | |||
83 | - if (!dc_isar_feature(aa64_sve2, s)) { | ||
84 | - return false; | ||
85 | - } | ||
86 | - return gen_gvec_ool_zzzz(s, fns[a->esz], a->rd, a->rn, | ||
87 | - a->rm, a->ra, a->rot); | ||
88 | -} | ||
89 | +static gen_helper_gvec_4 * const cdot_fns[] = { | ||
90 | + NULL, NULL, gen_helper_sve2_cdot_zzzz_s, gen_helper_sve2_cdot_zzzz_d | ||
91 | +}; | ||
92 | +TRANS_FEAT(CDOT_zzzz, aa64_sve2, gen_gvec_ool_zzzz, | ||
93 | + cdot_fns[a->esz], a->rd, a->rn, a->rm, a->ra, a->rot) | ||
94 | |||
95 | -static bool trans_CDOT_zzzz(DisasContext *s, arg_CMLA_zzzz *a) | ||
96 | -{ | ||
97 | - static gen_helper_gvec_4 * const fns[] = { | ||
98 | - NULL, NULL, gen_helper_sve2_cdot_zzzz_s, gen_helper_sve2_cdot_zzzz_d | ||
99 | - }; | ||
100 | - | ||
101 | - if (!dc_isar_feature(aa64_sve2, s)) { | ||
102 | - return false; | ||
103 | - } | ||
104 | - return gen_gvec_ool_zzzz(s, fns[a->esz], a->rd, a->rn, | ||
105 | - a->rm, a->ra, a->rot); | ||
106 | -} | ||
107 | - | ||
108 | -static bool trans_SQRDCMLAH_zzzz(DisasContext *s, arg_SQRDCMLAH_zzzz *a) | ||
109 | -{ | ||
110 | - static gen_helper_gvec_4 * const fns[] = { | ||
111 | - gen_helper_sve2_sqrdcmlah_zzzz_b, gen_helper_sve2_sqrdcmlah_zzzz_h, | ||
112 | - gen_helper_sve2_sqrdcmlah_zzzz_s, gen_helper_sve2_sqrdcmlah_zzzz_d, | ||
113 | - }; | ||
114 | - | ||
115 | - if (!dc_isar_feature(aa64_sve2, s)) { | ||
116 | - return false; | ||
117 | - } | ||
118 | - return gen_gvec_ool_zzzz(s, fns[a->esz], a->rd, a->rn, | ||
119 | - a->rm, a->ra, a->rot); | ||
120 | -} | ||
121 | +static gen_helper_gvec_4 * const sqrdcmlah_fns[] = { | ||
122 | + gen_helper_sve2_sqrdcmlah_zzzz_b, gen_helper_sve2_sqrdcmlah_zzzz_h, | ||
123 | + gen_helper_sve2_sqrdcmlah_zzzz_s, gen_helper_sve2_sqrdcmlah_zzzz_d, | ||
124 | +}; | ||
125 | +TRANS_FEAT(SQRDCMLAH_zzzz, aa64_sve2, gen_gvec_ool_zzzz, | ||
126 | + sqrdcmlah_fns[a->esz], a->rd, a->rn, a->rm, a->ra, a->rot) | ||
127 | |||
128 | static bool trans_USDOT_zzzz(DisasContext *s, arg_USDOT_zzzz *a) | ||
129 | { | ||
130 | -- | ||
131 | 2.25.1 | diff view generated by jsdifflib |
1 | Add a simple test of the CMSDK watchdog, since we're about to do some | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | refactoring of how it is clocked. | ||
3 | 2 | ||
3 | Use gen_gvec_ool_arg_zzzz instead of gen_gvec_ool_zzzz | ||
4 | when the arguments come from arg_rrrr_esz. | ||
5 | |||
6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Message-id: 20220527181907.189259-11-richard.henderson@linaro.org | ||
8 | Reviewed-by: Peter Maydell <peter.maydell@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: Luc Michel <luc@lmichel.fr> | ||
6 | Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
7 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
8 | Message-id: 20210128114145.20536-5-peter.maydell@linaro.org | ||
9 | Message-id: 20210121190622.22000-5-peter.maydell@linaro.org | ||
10 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
11 | --- | 10 | --- |
12 | tests/qtest/cmsdk-apb-watchdog-test.c | 79 +++++++++++++++++++++++++++ | 11 | target/arm/translate-sve.c | 16 ++++++++++------ |
13 | MAINTAINERS | 1 + | 12 | 1 file changed, 10 insertions(+), 6 deletions(-) |
14 | tests/qtest/meson.build | 1 + | ||
15 | 3 files changed, 81 insertions(+) | ||
16 | create mode 100644 tests/qtest/cmsdk-apb-watchdog-test.c | ||
17 | 13 | ||
18 | diff --git a/tests/qtest/cmsdk-apb-watchdog-test.c b/tests/qtest/cmsdk-apb-watchdog-test.c | 14 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c |
19 | new file mode 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
20 | index XXXXXXX..XXXXXXX | 16 | --- a/target/arm/translate-sve.c |
21 | --- /dev/null | 17 | +++ b/target/arm/translate-sve.c |
22 | +++ b/tests/qtest/cmsdk-apb-watchdog-test.c | 18 | @@ -XXX,XX +XXX,XX @@ static bool gen_gvec_ool_zzzz(DisasContext *s, gen_helper_gvec_4 *fn, |
23 | @@ -XXX,XX +XXX,XX @@ | 19 | return true; |
24 | +/* | 20 | } |
25 | + * QTest testcase for the CMSDK APB watchdog device | 21 | |
26 | + * | 22 | +static bool gen_gvec_ool_arg_zzzz(DisasContext *s, gen_helper_gvec_4 *fn, |
27 | + * Copyright (c) 2021 Linaro Limited | 23 | + arg_rrrr_esz *a, int data) |
28 | + * | ||
29 | + * This program is free software; you can redistribute it and/or modify it | ||
30 | + * under the terms of the GNU General Public License as published by the | ||
31 | + * Free Software Foundation; either version 2 of the License, or | ||
32 | + * (at your option) any later version. | ||
33 | + * | ||
34 | + * This program is distributed in the hope that it will be useful, but WITHOUT | ||
35 | + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
36 | + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
37 | + * for more details. | ||
38 | + */ | ||
39 | + | ||
40 | +#include "qemu/osdep.h" | ||
41 | +#include "libqtest-single.h" | ||
42 | + | ||
43 | +/* | ||
44 | + * lm3s811evb watchdog; at board startup this runs at 200MHz / 16 == 12.5MHz, | ||
45 | + * which is 80ns per tick. | ||
46 | + */ | ||
47 | +#define WDOG_BASE 0x40000000 | ||
48 | + | ||
49 | +#define WDOGLOAD 0 | ||
50 | +#define WDOGVALUE 4 | ||
51 | +#define WDOGCONTROL 8 | ||
52 | +#define WDOGINTCLR 0xc | ||
53 | +#define WDOGRIS 0x10 | ||
54 | +#define WDOGMIS 0x14 | ||
55 | +#define WDOGLOCK 0xc00 | ||
56 | + | ||
57 | +static void test_watchdog(void) | ||
58 | +{ | 24 | +{ |
59 | + g_assert_cmpuint(readl(WDOG_BASE + WDOGRIS), ==, 0); | 25 | + return gen_gvec_ool_zzzz(s, fn, a->rd, a->rn, a->rm, a->ra, data); |
60 | + | ||
61 | + writel(WDOG_BASE + WDOGCONTROL, 1); | ||
62 | + writel(WDOG_BASE + WDOGLOAD, 1000); | ||
63 | + | ||
64 | + /* Step to just past the 500th tick */ | ||
65 | + clock_step(500 * 80 + 1); | ||
66 | + g_assert_cmpuint(readl(WDOG_BASE + WDOGRIS), ==, 0); | ||
67 | + g_assert_cmpuint(readl(WDOG_BASE + WDOGVALUE), ==, 500); | ||
68 | + | ||
69 | + /* Just past the 1000th tick: timer should have fired */ | ||
70 | + clock_step(500 * 80); | ||
71 | + g_assert_cmpuint(readl(WDOG_BASE + WDOGRIS), ==, 1); | ||
72 | + g_assert_cmpuint(readl(WDOG_BASE + WDOGVALUE), ==, 0); | ||
73 | + | ||
74 | + /* VALUE reloads at following tick */ | ||
75 | + clock_step(80); | ||
76 | + g_assert_cmpuint(readl(WDOG_BASE + WDOGVALUE), ==, 1000); | ||
77 | + | ||
78 | + /* Writing any value to WDOGINTCLR clears the interrupt and reloads */ | ||
79 | + clock_step(500 * 80); | ||
80 | + g_assert_cmpuint(readl(WDOG_BASE + WDOGVALUE), ==, 500); | ||
81 | + g_assert_cmpuint(readl(WDOG_BASE + WDOGRIS), ==, 1); | ||
82 | + writel(WDOG_BASE + WDOGINTCLR, 0); | ||
83 | + g_assert_cmpuint(readl(WDOG_BASE + WDOGVALUE), ==, 1000); | ||
84 | + g_assert_cmpuint(readl(WDOG_BASE + WDOGRIS), ==, 0); | ||
85 | +} | 26 | +} |
86 | + | 27 | + |
87 | +int main(int argc, char **argv) | 28 | /* Invoke an out-of-line helper on 2 Zregs and a predicate. */ |
88 | +{ | 29 | static void gen_gvec_ool_zzp(DisasContext *s, gen_helper_gvec_3 *fn, |
89 | + int r; | 30 | int rd, int rn, int pg, int data) |
90 | + | 31 | @@ -XXX,XX +XXX,XX @@ static bool do_sve2_zzzz_ool(DisasContext *s, arg_rrrr_esz *a, |
91 | + g_test_init(&argc, &argv, NULL); | 32 | if (!dc_isar_feature(aa64_sve2, s)) { |
92 | + | 33 | return false; |
93 | + qtest_start("-machine lm3s811evb"); | 34 | } |
94 | + | 35 | - return gen_gvec_ool_zzzz(s, fn, a->rd, a->rn, a->rm, a->ra, data); |
95 | + qtest_add_func("/cmsdk-apb-watchdog/watchdog", test_watchdog); | 36 | + return gen_gvec_ool_arg_zzzz(s, fn, a, data); |
96 | + | 37 | } |
97 | + r = g_test_run(); | 38 | |
98 | + | 39 | static bool do_abal(DisasContext *s, arg_rrrr_esz *a, bool uns, bool sel) |
99 | + qtest_end(); | 40 | @@ -XXX,XX +XXX,XX @@ static bool do_i8mm_zzzz_ool(DisasContext *s, arg_rrrr_esz *a, |
100 | + | 41 | if (!dc_isar_feature(aa64_sve_i8mm, s)) { |
101 | + return r; | 42 | return false; |
102 | +} | 43 | } |
103 | diff --git a/MAINTAINERS b/MAINTAINERS | 44 | - return gen_gvec_ool_zzzz(s, fn, a->rd, a->rn, a->rm, a->ra, data); |
104 | index XXXXXXX..XXXXXXX 100644 | 45 | + return gen_gvec_ool_arg_zzzz(s, fn, a, data); |
105 | --- a/MAINTAINERS | 46 | } |
106 | +++ b/MAINTAINERS | 47 | |
107 | @@ -XXX,XX +XXX,XX @@ F: hw/char/cmsdk-apb-uart.c | 48 | static bool trans_SMMLA(DisasContext *s, arg_rrrr_esz *a) |
108 | F: include/hw/char/cmsdk-apb-uart.h | 49 | @@ -XXX,XX +XXX,XX @@ static bool trans_BFDOT_zzzz(DisasContext *s, arg_rrrr_esz *a) |
109 | F: hw/watchdog/cmsdk-apb-watchdog.c | 50 | if (!dc_isar_feature(aa64_sve_bf16, s)) { |
110 | F: include/hw/watchdog/cmsdk-apb-watchdog.h | 51 | return false; |
111 | +F: tests/qtest/cmsdk-apb-watchdog-test.c | 52 | } |
112 | F: hw/misc/tz-ppc.c | 53 | - return gen_gvec_ool_zzzz(s, gen_helper_gvec_bfdot, |
113 | F: include/hw/misc/tz-ppc.h | 54 | - a->rd, a->rn, a->rm, a->ra, 0); |
114 | F: hw/misc/tz-mpc.c | 55 | + return gen_gvec_ool_arg_zzzz(s, gen_helper_gvec_bfdot, a, 0); |
115 | diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build | 56 | } |
116 | index XXXXXXX..XXXXXXX 100644 | 57 | |
117 | --- a/tests/qtest/meson.build | 58 | static bool trans_BFDOT_zzxz(DisasContext *s, arg_rrxr_esz *a) |
118 | +++ b/tests/qtest/meson.build | 59 | @@ -XXX,XX +XXX,XX @@ static bool trans_BFMMLA(DisasContext *s, arg_rrrr_esz *a) |
119 | @@ -XXX,XX +XXX,XX @@ qtests_npcm7xx = \ | 60 | if (!dc_isar_feature(aa64_sve_bf16, s)) { |
120 | 'npcm7xx_watchdog_timer-test'] | 61 | return false; |
121 | qtests_arm = \ | 62 | } |
122 | (config_all_devices.has_key('CONFIG_CMSDK_APB_TIMER') ? ['cmsdk-apb-timer-test'] : []) + \ | 63 | - return gen_gvec_ool_zzzz(s, gen_helper_gvec_bfmmla, |
123 | + (config_all_devices.has_key('CONFIG_CMSDK_APB_WATCHDOG') ? ['cmsdk-apb-watchdog-test'] : []) + \ | 64 | - a->rd, a->rn, a->rm, a->ra, 0); |
124 | (config_all_devices.has_key('CONFIG_PFLASH_CFI02') ? ['pflash-cfi02-test'] : []) + \ | 65 | + return gen_gvec_ool_arg_zzzz(s, gen_helper_gvec_bfmmla, a, 0); |
125 | (config_all_devices.has_key('CONFIG_NPCM7XX') ? qtests_npcm7xx : []) + \ | 66 | } |
126 | ['arm-cpu-features', | 67 | |
68 | static bool do_BFMLAL_zzzw(DisasContext *s, arg_rrrr_esz *a, bool sel) | ||
127 | -- | 69 | -- |
128 | 2.20.1 | 70 | 2.25.1 |
129 | |||
130 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | Convert SVE translation functions using do_sve2_zzzz_ool | ||
4 | to use TRANS_FEAT and gen_gvec_ool_arg_zzzz. | ||
5 | |||
6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Message-id: 20220527181907.189259-12-richard.henderson@linaro.org | ||
8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | --- | ||
11 | target/arm/translate-sve.c | 263 +++++++++++-------------------------- | ||
12 | 1 file changed, 79 insertions(+), 184 deletions(-) | ||
13 | |||
14 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c | ||
15 | index XXXXXXX..XXXXXXX 100644 | ||
16 | --- a/target/arm/translate-sve.c | ||
17 | +++ b/target/arm/translate-sve.c | ||
18 | @@ -XXX,XX +XXX,XX @@ static bool trans_SQCADD_rot270(DisasContext *s, arg_rrr_esz *a) | ||
19 | return do_cadd(s, a, true, true); | ||
20 | } | ||
21 | |||
22 | -static bool do_sve2_zzzz_ool(DisasContext *s, arg_rrrr_esz *a, | ||
23 | - gen_helper_gvec_4 *fn, int data) | ||
24 | -{ | ||
25 | - if (!dc_isar_feature(aa64_sve2, s)) { | ||
26 | - return false; | ||
27 | - } | ||
28 | - return gen_gvec_ool_arg_zzzz(s, fn, a, data); | ||
29 | -} | ||
30 | +static gen_helper_gvec_4 * const sabal_fns[4] = { | ||
31 | + NULL, gen_helper_sve2_sabal_h, | ||
32 | + gen_helper_sve2_sabal_s, gen_helper_sve2_sabal_d, | ||
33 | +}; | ||
34 | +TRANS_FEAT(SABALB, aa64_sve2, gen_gvec_ool_arg_zzzz, sabal_fns[a->esz], a, 0) | ||
35 | +TRANS_FEAT(SABALT, aa64_sve2, gen_gvec_ool_arg_zzzz, sabal_fns[a->esz], a, 1) | ||
36 | |||
37 | -static bool do_abal(DisasContext *s, arg_rrrr_esz *a, bool uns, bool sel) | ||
38 | -{ | ||
39 | - static gen_helper_gvec_4 * const fns[2][4] = { | ||
40 | - { NULL, gen_helper_sve2_sabal_h, | ||
41 | - gen_helper_sve2_sabal_s, gen_helper_sve2_sabal_d }, | ||
42 | - { NULL, gen_helper_sve2_uabal_h, | ||
43 | - gen_helper_sve2_uabal_s, gen_helper_sve2_uabal_d }, | ||
44 | - }; | ||
45 | - return do_sve2_zzzz_ool(s, a, fns[uns][a->esz], sel); | ||
46 | -} | ||
47 | - | ||
48 | -static bool trans_SABALB(DisasContext *s, arg_rrrr_esz *a) | ||
49 | -{ | ||
50 | - return do_abal(s, a, false, false); | ||
51 | -} | ||
52 | - | ||
53 | -static bool trans_SABALT(DisasContext *s, arg_rrrr_esz *a) | ||
54 | -{ | ||
55 | - return do_abal(s, a, false, true); | ||
56 | -} | ||
57 | - | ||
58 | -static bool trans_UABALB(DisasContext *s, arg_rrrr_esz *a) | ||
59 | -{ | ||
60 | - return do_abal(s, a, true, false); | ||
61 | -} | ||
62 | - | ||
63 | -static bool trans_UABALT(DisasContext *s, arg_rrrr_esz *a) | ||
64 | -{ | ||
65 | - return do_abal(s, a, true, true); | ||
66 | -} | ||
67 | +static gen_helper_gvec_4 * const uabal_fns[4] = { | ||
68 | + NULL, gen_helper_sve2_uabal_h, | ||
69 | + gen_helper_sve2_uabal_s, gen_helper_sve2_uabal_d, | ||
70 | +}; | ||
71 | +TRANS_FEAT(UABALB, aa64_sve2, gen_gvec_ool_arg_zzzz, uabal_fns[a->esz], a, 0) | ||
72 | +TRANS_FEAT(UABALT, aa64_sve2, gen_gvec_ool_arg_zzzz, uabal_fns[a->esz], a, 1) | ||
73 | |||
74 | static bool do_adcl(DisasContext *s, arg_rrrr_esz *a, bool sel) | ||
75 | { | ||
76 | @@ -XXX,XX +XXX,XX @@ static bool do_adcl(DisasContext *s, arg_rrrr_esz *a, bool sel) | ||
77 | * Note that in this case the ESZ field encodes both size and sign. | ||
78 | * Split out 'subtract' into bit 1 of the data field for the helper. | ||
79 | */ | ||
80 | - return do_sve2_zzzz_ool(s, a, fns[a->esz & 1], (a->esz & 2) | sel); | ||
81 | + return gen_gvec_ool_arg_zzzz(s, fns[a->esz & 1], a, (a->esz & 2) | sel); | ||
82 | } | ||
83 | |||
84 | -static bool trans_ADCLB(DisasContext *s, arg_rrrr_esz *a) | ||
85 | -{ | ||
86 | - return do_adcl(s, a, false); | ||
87 | -} | ||
88 | - | ||
89 | -static bool trans_ADCLT(DisasContext *s, arg_rrrr_esz *a) | ||
90 | -{ | ||
91 | - return do_adcl(s, a, true); | ||
92 | -} | ||
93 | +TRANS_FEAT(ADCLB, aa64_sve2, do_adcl, a, false) | ||
94 | +TRANS_FEAT(ADCLT, aa64_sve2, do_adcl, a, true) | ||
95 | |||
96 | static bool do_sve2_fn2i(DisasContext *s, arg_rri_esz *a, GVecGen2iFn *fn) | ||
97 | { | ||
98 | @@ -XXX,XX +XXX,XX @@ static bool trans_FMMLA(DisasContext *s, arg_rrrr_esz *a) | ||
99 | return true; | ||
100 | } | ||
101 | |||
102 | -static bool do_sqdmlal_zzzw(DisasContext *s, arg_rrrr_esz *a, | ||
103 | - bool sel1, bool sel2) | ||
104 | -{ | ||
105 | - static gen_helper_gvec_4 * const fns[] = { | ||
106 | - NULL, gen_helper_sve2_sqdmlal_zzzw_h, | ||
107 | - gen_helper_sve2_sqdmlal_zzzw_s, gen_helper_sve2_sqdmlal_zzzw_d, | ||
108 | - }; | ||
109 | - return do_sve2_zzzz_ool(s, a, fns[a->esz], (sel2 << 1) | sel1); | ||
110 | -} | ||
111 | +static gen_helper_gvec_4 * const sqdmlal_zzzw_fns[] = { | ||
112 | + NULL, gen_helper_sve2_sqdmlal_zzzw_h, | ||
113 | + gen_helper_sve2_sqdmlal_zzzw_s, gen_helper_sve2_sqdmlal_zzzw_d, | ||
114 | +}; | ||
115 | +TRANS_FEAT(SQDMLALB_zzzw, aa64_sve2, gen_gvec_ool_arg_zzzz, | ||
116 | + sqdmlal_zzzw_fns[a->esz], a, 0) | ||
117 | +TRANS_FEAT(SQDMLALT_zzzw, aa64_sve2, gen_gvec_ool_arg_zzzz, | ||
118 | + sqdmlal_zzzw_fns[a->esz], a, 3) | ||
119 | +TRANS_FEAT(SQDMLALBT, aa64_sve2, gen_gvec_ool_arg_zzzz, | ||
120 | + sqdmlal_zzzw_fns[a->esz], a, 2) | ||
121 | |||
122 | -static bool do_sqdmlsl_zzzw(DisasContext *s, arg_rrrr_esz *a, | ||
123 | - bool sel1, bool sel2) | ||
124 | -{ | ||
125 | - static gen_helper_gvec_4 * const fns[] = { | ||
126 | - NULL, gen_helper_sve2_sqdmlsl_zzzw_h, | ||
127 | - gen_helper_sve2_sqdmlsl_zzzw_s, gen_helper_sve2_sqdmlsl_zzzw_d, | ||
128 | - }; | ||
129 | - return do_sve2_zzzz_ool(s, a, fns[a->esz], (sel2 << 1) | sel1); | ||
130 | -} | ||
131 | +static gen_helper_gvec_4 * const sqdmlsl_zzzw_fns[] = { | ||
132 | + NULL, gen_helper_sve2_sqdmlsl_zzzw_h, | ||
133 | + gen_helper_sve2_sqdmlsl_zzzw_s, gen_helper_sve2_sqdmlsl_zzzw_d, | ||
134 | +}; | ||
135 | +TRANS_FEAT(SQDMLSLB_zzzw, aa64_sve2, gen_gvec_ool_arg_zzzz, | ||
136 | + sqdmlsl_zzzw_fns[a->esz], a, 0) | ||
137 | +TRANS_FEAT(SQDMLSLT_zzzw, aa64_sve2, gen_gvec_ool_arg_zzzz, | ||
138 | + sqdmlsl_zzzw_fns[a->esz], a, 3) | ||
139 | +TRANS_FEAT(SQDMLSLBT, aa64_sve2, gen_gvec_ool_arg_zzzz, | ||
140 | + sqdmlsl_zzzw_fns[a->esz], a, 2) | ||
141 | |||
142 | -static bool trans_SQDMLALB_zzzw(DisasContext *s, arg_rrrr_esz *a) | ||
143 | -{ | ||
144 | - return do_sqdmlal_zzzw(s, a, false, false); | ||
145 | -} | ||
146 | +static gen_helper_gvec_4 * const sqrdmlah_fns[] = { | ||
147 | + gen_helper_sve2_sqrdmlah_b, gen_helper_sve2_sqrdmlah_h, | ||
148 | + gen_helper_sve2_sqrdmlah_s, gen_helper_sve2_sqrdmlah_d, | ||
149 | +}; | ||
150 | +TRANS_FEAT(SQRDMLAH_zzzz, aa64_sve2, gen_gvec_ool_arg_zzzz, | ||
151 | + sqrdmlah_fns[a->esz], a, 0) | ||
152 | |||
153 | -static bool trans_SQDMLALT_zzzw(DisasContext *s, arg_rrrr_esz *a) | ||
154 | -{ | ||
155 | - return do_sqdmlal_zzzw(s, a, true, true); | ||
156 | -} | ||
157 | +static gen_helper_gvec_4 * const sqrdmlsh_fns[] = { | ||
158 | + gen_helper_sve2_sqrdmlsh_b, gen_helper_sve2_sqrdmlsh_h, | ||
159 | + gen_helper_sve2_sqrdmlsh_s, gen_helper_sve2_sqrdmlsh_d, | ||
160 | +}; | ||
161 | +TRANS_FEAT(SQRDMLSH_zzzz, aa64_sve2, gen_gvec_ool_arg_zzzz, | ||
162 | + sqrdmlsh_fns[a->esz], a, 0) | ||
163 | |||
164 | -static bool trans_SQDMLALBT(DisasContext *s, arg_rrrr_esz *a) | ||
165 | -{ | ||
166 | - return do_sqdmlal_zzzw(s, a, false, true); | ||
167 | -} | ||
168 | +static gen_helper_gvec_4 * const smlal_zzzw_fns[] = { | ||
169 | + NULL, gen_helper_sve2_smlal_zzzw_h, | ||
170 | + gen_helper_sve2_smlal_zzzw_s, gen_helper_sve2_smlal_zzzw_d, | ||
171 | +}; | ||
172 | +TRANS_FEAT(SMLALB_zzzw, aa64_sve2, gen_gvec_ool_arg_zzzz, | ||
173 | + smlal_zzzw_fns[a->esz], a, 0) | ||
174 | +TRANS_FEAT(SMLALT_zzzw, aa64_sve2, gen_gvec_ool_arg_zzzz, | ||
175 | + smlal_zzzw_fns[a->esz], a, 1) | ||
176 | |||
177 | -static bool trans_SQDMLSLB_zzzw(DisasContext *s, arg_rrrr_esz *a) | ||
178 | -{ | ||
179 | - return do_sqdmlsl_zzzw(s, a, false, false); | ||
180 | -} | ||
181 | +static gen_helper_gvec_4 * const umlal_zzzw_fns[] = { | ||
182 | + NULL, gen_helper_sve2_umlal_zzzw_h, | ||
183 | + gen_helper_sve2_umlal_zzzw_s, gen_helper_sve2_umlal_zzzw_d, | ||
184 | +}; | ||
185 | +TRANS_FEAT(UMLALB_zzzw, aa64_sve2, gen_gvec_ool_arg_zzzz, | ||
186 | + umlal_zzzw_fns[a->esz], a, 0) | ||
187 | +TRANS_FEAT(UMLALT_zzzw, aa64_sve2, gen_gvec_ool_arg_zzzz, | ||
188 | + umlal_zzzw_fns[a->esz], a, 1) | ||
189 | |||
190 | -static bool trans_SQDMLSLT_zzzw(DisasContext *s, arg_rrrr_esz *a) | ||
191 | -{ | ||
192 | - return do_sqdmlsl_zzzw(s, a, true, true); | ||
193 | -} | ||
194 | +static gen_helper_gvec_4 * const smlsl_zzzw_fns[] = { | ||
195 | + NULL, gen_helper_sve2_smlsl_zzzw_h, | ||
196 | + gen_helper_sve2_smlsl_zzzw_s, gen_helper_sve2_smlsl_zzzw_d, | ||
197 | +}; | ||
198 | +TRANS_FEAT(SMLSLB_zzzw, aa64_sve2, gen_gvec_ool_arg_zzzz, | ||
199 | + smlsl_zzzw_fns[a->esz], a, 0) | ||
200 | +TRANS_FEAT(SMLSLT_zzzw, aa64_sve2, gen_gvec_ool_arg_zzzz, | ||
201 | + smlsl_zzzw_fns[a->esz], a, 1) | ||
202 | |||
203 | -static bool trans_SQDMLSLBT(DisasContext *s, arg_rrrr_esz *a) | ||
204 | -{ | ||
205 | - return do_sqdmlsl_zzzw(s, a, false, true); | ||
206 | -} | ||
207 | - | ||
208 | -static bool trans_SQRDMLAH_zzzz(DisasContext *s, arg_rrrr_esz *a) | ||
209 | -{ | ||
210 | - static gen_helper_gvec_4 * const fns[] = { | ||
211 | - gen_helper_sve2_sqrdmlah_b, gen_helper_sve2_sqrdmlah_h, | ||
212 | - gen_helper_sve2_sqrdmlah_s, gen_helper_sve2_sqrdmlah_d, | ||
213 | - }; | ||
214 | - return do_sve2_zzzz_ool(s, a, fns[a->esz], 0); | ||
215 | -} | ||
216 | - | ||
217 | -static bool trans_SQRDMLSH_zzzz(DisasContext *s, arg_rrrr_esz *a) | ||
218 | -{ | ||
219 | - static gen_helper_gvec_4 * const fns[] = { | ||
220 | - gen_helper_sve2_sqrdmlsh_b, gen_helper_sve2_sqrdmlsh_h, | ||
221 | - gen_helper_sve2_sqrdmlsh_s, gen_helper_sve2_sqrdmlsh_d, | ||
222 | - }; | ||
223 | - return do_sve2_zzzz_ool(s, a, fns[a->esz], 0); | ||
224 | -} | ||
225 | - | ||
226 | -static bool do_smlal_zzzw(DisasContext *s, arg_rrrr_esz *a, bool sel) | ||
227 | -{ | ||
228 | - static gen_helper_gvec_4 * const fns[] = { | ||
229 | - NULL, gen_helper_sve2_smlal_zzzw_h, | ||
230 | - gen_helper_sve2_smlal_zzzw_s, gen_helper_sve2_smlal_zzzw_d, | ||
231 | - }; | ||
232 | - return do_sve2_zzzz_ool(s, a, fns[a->esz], sel); | ||
233 | -} | ||
234 | - | ||
235 | -static bool trans_SMLALB_zzzw(DisasContext *s, arg_rrrr_esz *a) | ||
236 | -{ | ||
237 | - return do_smlal_zzzw(s, a, false); | ||
238 | -} | ||
239 | - | ||
240 | -static bool trans_SMLALT_zzzw(DisasContext *s, arg_rrrr_esz *a) | ||
241 | -{ | ||
242 | - return do_smlal_zzzw(s, a, true); | ||
243 | -} | ||
244 | - | ||
245 | -static bool do_umlal_zzzw(DisasContext *s, arg_rrrr_esz *a, bool sel) | ||
246 | -{ | ||
247 | - static gen_helper_gvec_4 * const fns[] = { | ||
248 | - NULL, gen_helper_sve2_umlal_zzzw_h, | ||
249 | - gen_helper_sve2_umlal_zzzw_s, gen_helper_sve2_umlal_zzzw_d, | ||
250 | - }; | ||
251 | - return do_sve2_zzzz_ool(s, a, fns[a->esz], sel); | ||
252 | -} | ||
253 | - | ||
254 | -static bool trans_UMLALB_zzzw(DisasContext *s, arg_rrrr_esz *a) | ||
255 | -{ | ||
256 | - return do_umlal_zzzw(s, a, false); | ||
257 | -} | ||
258 | - | ||
259 | -static bool trans_UMLALT_zzzw(DisasContext *s, arg_rrrr_esz *a) | ||
260 | -{ | ||
261 | - return do_umlal_zzzw(s, a, true); | ||
262 | -} | ||
263 | - | ||
264 | -static bool do_smlsl_zzzw(DisasContext *s, arg_rrrr_esz *a, bool sel) | ||
265 | -{ | ||
266 | - static gen_helper_gvec_4 * const fns[] = { | ||
267 | - NULL, gen_helper_sve2_smlsl_zzzw_h, | ||
268 | - gen_helper_sve2_smlsl_zzzw_s, gen_helper_sve2_smlsl_zzzw_d, | ||
269 | - }; | ||
270 | - return do_sve2_zzzz_ool(s, a, fns[a->esz], sel); | ||
271 | -} | ||
272 | - | ||
273 | -static bool trans_SMLSLB_zzzw(DisasContext *s, arg_rrrr_esz *a) | ||
274 | -{ | ||
275 | - return do_smlsl_zzzw(s, a, false); | ||
276 | -} | ||
277 | - | ||
278 | -static bool trans_SMLSLT_zzzw(DisasContext *s, arg_rrrr_esz *a) | ||
279 | -{ | ||
280 | - return do_smlsl_zzzw(s, a, true); | ||
281 | -} | ||
282 | - | ||
283 | -static bool do_umlsl_zzzw(DisasContext *s, arg_rrrr_esz *a, bool sel) | ||
284 | -{ | ||
285 | - static gen_helper_gvec_4 * const fns[] = { | ||
286 | - NULL, gen_helper_sve2_umlsl_zzzw_h, | ||
287 | - gen_helper_sve2_umlsl_zzzw_s, gen_helper_sve2_umlsl_zzzw_d, | ||
288 | - }; | ||
289 | - return do_sve2_zzzz_ool(s, a, fns[a->esz], sel); | ||
290 | -} | ||
291 | - | ||
292 | -static bool trans_UMLSLB_zzzw(DisasContext *s, arg_rrrr_esz *a) | ||
293 | -{ | ||
294 | - return do_umlsl_zzzw(s, a, false); | ||
295 | -} | ||
296 | - | ||
297 | -static bool trans_UMLSLT_zzzw(DisasContext *s, arg_rrrr_esz *a) | ||
298 | -{ | ||
299 | - return do_umlsl_zzzw(s, a, true); | ||
300 | -} | ||
301 | +static gen_helper_gvec_4 * const umlsl_zzzw_fns[] = { | ||
302 | + NULL, gen_helper_sve2_umlsl_zzzw_h, | ||
303 | + gen_helper_sve2_umlsl_zzzw_s, gen_helper_sve2_umlsl_zzzw_d, | ||
304 | +}; | ||
305 | +TRANS_FEAT(UMLSLB_zzzw, aa64_sve2, gen_gvec_ool_arg_zzzz, | ||
306 | + umlsl_zzzw_fns[a->esz], a, 0) | ||
307 | +TRANS_FEAT(UMLSLT_zzzw, aa64_sve2, gen_gvec_ool_arg_zzzz, | ||
308 | + umlsl_zzzw_fns[a->esz], a, 1) | ||
309 | |||
310 | static gen_helper_gvec_4 * const cmla_fns[] = { | ||
311 | gen_helper_sve2_cmla_zzzz_b, gen_helper_sve2_cmla_zzzz_h, | ||
312 | -- | ||
313 | 2.25.1 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | Convert SVE translation functions directly using | ||
4 | gen_gvec_ool_arg_zzzz to TRANS_FEAT. | ||
5 | |||
6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Message-id: 20220527181907.189259-13-richard.henderson@linaro.org | ||
8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | --- | ||
11 | target/arm/translate-sve.c | 47 ++++++++------------------------------ | ||
12 | 1 file changed, 10 insertions(+), 37 deletions(-) | ||
13 | |||
14 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c | ||
15 | index XXXXXXX..XXXXXXX 100644 | ||
16 | --- a/target/arm/translate-sve.c | ||
17 | +++ b/target/arm/translate-sve.c | ||
18 | @@ -XXX,XX +XXX,XX @@ static bool trans_FMLSLT_zzxw(DisasContext *s, arg_rrxr_esz *a) | ||
19 | return do_FMLAL_zzxw(s, a, true, true); | ||
20 | } | ||
21 | |||
22 | -static bool do_i8mm_zzzz_ool(DisasContext *s, arg_rrrr_esz *a, | ||
23 | - gen_helper_gvec_4 *fn, int data) | ||
24 | -{ | ||
25 | - if (!dc_isar_feature(aa64_sve_i8mm, s)) { | ||
26 | - return false; | ||
27 | - } | ||
28 | - return gen_gvec_ool_arg_zzzz(s, fn, a, data); | ||
29 | -} | ||
30 | +TRANS_FEAT(SMMLA, aa64_sve_i8mm, gen_gvec_ool_arg_zzzz, | ||
31 | + gen_helper_gvec_smmla_b, a, 0) | ||
32 | +TRANS_FEAT(USMMLA, aa64_sve_i8mm, gen_gvec_ool_arg_zzzz, | ||
33 | + gen_helper_gvec_usmmla_b, a, 0) | ||
34 | +TRANS_FEAT(UMMLA, aa64_sve_i8mm, gen_gvec_ool_arg_zzzz, | ||
35 | + gen_helper_gvec_ummla_b, a, 0) | ||
36 | |||
37 | -static bool trans_SMMLA(DisasContext *s, arg_rrrr_esz *a) | ||
38 | -{ | ||
39 | - return do_i8mm_zzzz_ool(s, a, gen_helper_gvec_smmla_b, 0); | ||
40 | -} | ||
41 | - | ||
42 | -static bool trans_USMMLA(DisasContext *s, arg_rrrr_esz *a) | ||
43 | -{ | ||
44 | - return do_i8mm_zzzz_ool(s, a, gen_helper_gvec_usmmla_b, 0); | ||
45 | -} | ||
46 | - | ||
47 | -static bool trans_UMMLA(DisasContext *s, arg_rrrr_esz *a) | ||
48 | -{ | ||
49 | - return do_i8mm_zzzz_ool(s, a, gen_helper_gvec_ummla_b, 0); | ||
50 | -} | ||
51 | - | ||
52 | -static bool trans_BFDOT_zzzz(DisasContext *s, arg_rrrr_esz *a) | ||
53 | -{ | ||
54 | - if (!dc_isar_feature(aa64_sve_bf16, s)) { | ||
55 | - return false; | ||
56 | - } | ||
57 | - return gen_gvec_ool_arg_zzzz(s, gen_helper_gvec_bfdot, a, 0); | ||
58 | -} | ||
59 | +TRANS_FEAT(BFDOT_zzzz, aa64_sve_bf16, gen_gvec_ool_arg_zzzz, | ||
60 | + gen_helper_gvec_bfdot, a, 0) | ||
61 | |||
62 | static bool trans_BFDOT_zzxz(DisasContext *s, arg_rrxr_esz *a) | ||
63 | { | ||
64 | @@ -XXX,XX +XXX,XX @@ static bool trans_BFDOT_zzxz(DisasContext *s, arg_rrxr_esz *a) | ||
65 | a->rd, a->rn, a->rm, a->ra, a->index); | ||
66 | } | ||
67 | |||
68 | -static bool trans_BFMMLA(DisasContext *s, arg_rrrr_esz *a) | ||
69 | -{ | ||
70 | - if (!dc_isar_feature(aa64_sve_bf16, s)) { | ||
71 | - return false; | ||
72 | - } | ||
73 | - return gen_gvec_ool_arg_zzzz(s, gen_helper_gvec_bfmmla, a, 0); | ||
74 | -} | ||
75 | +TRANS_FEAT(BFMMLA, aa64_sve_bf16, gen_gvec_ool_arg_zzzz, | ||
76 | + gen_helper_gvec_bfmmla, a, 0) | ||
77 | |||
78 | static bool do_BFMLAL_zzzw(DisasContext *s, arg_rrrr_esz *a, bool sel) | ||
79 | { | ||
80 | -- | ||
81 | 2.25.1 | diff view generated by jsdifflib |
1 | Use the MAINCLK Clock input to set the system_clock_scale variable | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | rather than using the mainclk_frq property. | ||
3 | 2 | ||
3 | Rename the function to match gen_gvec_ool_arg_zzzz, | ||
4 | and move to be adjacent. | ||
5 | |||
6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Message-id: 20220527181907.189259-14-richard.henderson@linaro.org | ||
8 | Reviewed-by: Peter Maydell <peter.maydell@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: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
6 | Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
7 | Reviewed-by: Luc Michel <luc@lmichel.fr> | ||
8 | Message-id: 20210128114145.20536-23-peter.maydell@linaro.org | ||
9 | Message-id: 20210121190622.22000-23-peter.maydell@linaro.org | ||
10 | --- | 10 | --- |
11 | hw/arm/armsse.c | 24 +++++++++++++++++++----- | 11 | target/arm/translate-sve.c | 18 +++++++++--------- |
12 | 1 file changed, 19 insertions(+), 5 deletions(-) | 12 | 1 file changed, 9 insertions(+), 9 deletions(-) |
13 | 13 | ||
14 | diff --git a/hw/arm/armsse.c b/hw/arm/armsse.c | 14 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c |
15 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/hw/arm/armsse.c | 16 | --- a/target/arm/translate-sve.c |
17 | +++ b/hw/arm/armsse.c | 17 | +++ b/target/arm/translate-sve.c |
18 | @@ -XXX,XX +XXX,XX @@ static void armsse_forward_sec_resp_cfg(ARMSSE *s) | 18 | @@ -XXX,XX +XXX,XX @@ static bool gen_gvec_ool_arg_zzzz(DisasContext *s, gen_helper_gvec_4 *fn, |
19 | qdev_connect_gpio_out(dev_splitter, 2, s->sec_resp_cfg_in); | 19 | return gen_gvec_ool_zzzz(s, fn, a->rd, a->rn, a->rm, a->ra, data); |
20 | } | 20 | } |
21 | 21 | ||
22 | +static void armsse_mainclk_update(void *opaque) | 22 | +static bool gen_gvec_ool_arg_zzxz(DisasContext *s, gen_helper_gvec_4 *fn, |
23 | + arg_rrxr_esz *a) | ||
23 | +{ | 24 | +{ |
24 | + ARMSSE *s = ARM_SSE(opaque); | 25 | + return gen_gvec_ool_zzzz(s, fn, a->rd, a->rn, a->rm, a->ra, a->index); |
25 | + /* | ||
26 | + * Set system_clock_scale from our Clock input; this is what | ||
27 | + * controls the tick rate of the CPU SysTick timer. | ||
28 | + */ | ||
29 | + system_clock_scale = clock_ticks_to_ns(s->mainclk, 1); | ||
30 | +} | 26 | +} |
31 | + | 27 | + |
32 | static void armsse_init(Object *obj) | 28 | /* Invoke an out-of-line helper on 2 Zregs and a predicate. */ |
33 | { | 29 | static void gen_gvec_ool_zzp(DisasContext *s, gen_helper_gvec_3 *fn, |
34 | ARMSSE *s = ARM_SSE(obj); | 30 | int rd, int rn, int pg, int data) |
35 | @@ -XXX,XX +XXX,XX @@ static void armsse_init(Object *obj) | 31 | @@ -XXX,XX +XXX,XX @@ TRANS_FEAT(DOT_zzzz, aa64_sve, gen_gvec_ool_zzzz, |
36 | assert(info->sram_banks <= MAX_SRAM_BANKS); | 32 | * SVE Multiply - Indexed |
37 | assert(info->num_cpus <= SSE_MAX_CPUS); | 33 | */ |
38 | 34 | ||
39 | - s->mainclk = qdev_init_clock_in(DEVICE(s), "MAINCLK", NULL, NULL); | 35 | -static bool do_zzxz_ool(DisasContext *s, arg_rrxr_esz *a, |
40 | + s->mainclk = qdev_init_clock_in(DEVICE(s), "MAINCLK", | 36 | - gen_helper_gvec_4 *fn) |
41 | + armsse_mainclk_update, s); | 37 | -{ |
42 | s->s32kclk = qdev_init_clock_in(DEVICE(s), "S32KCLK", NULL, NULL); | 38 | - return gen_gvec_ool_zzzz(s, fn, a->rd, a->rn, a->rm, a->ra, a->index); |
43 | 39 | -} | |
44 | memory_region_init(&s->container, obj, "armsse-container", UINT64_MAX); | 40 | - |
45 | @@ -XXX,XX +XXX,XX @@ static void armsse_realize(DeviceState *dev, Error **errp) | 41 | #define DO_RRXR(NAME, FUNC) \ |
46 | return; | 42 | static bool NAME(DisasContext *s, arg_rrxr_esz *a) \ |
43 | - { return do_zzxz_ool(s, a, FUNC); } | ||
44 | + { return gen_gvec_ool_arg_zzxz(s, FUNC, a); } | ||
45 | |||
46 | DO_RRXR(trans_SDOT_zzxw_s, gen_helper_gvec_sdot_idx_b) | ||
47 | DO_RRXR(trans_SDOT_zzxw_d, gen_helper_gvec_sdot_idx_h) | ||
48 | @@ -XXX,XX +XXX,XX @@ static bool trans_SUDOT_zzxw_s(DisasContext *s, arg_rrxr_esz *a) | ||
49 | if (!dc_isar_feature(aa64_sve_i8mm, s)) { | ||
50 | return false; | ||
47 | } | 51 | } |
48 | 52 | - return do_zzxz_ool(s, a, gen_helper_gvec_sudot_idx_b); | |
49 | - if (!s->mainclk_frq) { | 53 | + return gen_gvec_ool_arg_zzxz(s, gen_helper_gvec_sudot_idx_b, a); |
50 | - error_setg(errp, "MAINCLK_FRQ property was not set"); | 54 | } |
51 | - return; | 55 | |
52 | + if (!clock_has_source(s->mainclk)) { | 56 | static bool trans_USDOT_zzxw_s(DisasContext *s, arg_rrxr_esz *a) |
53 | + error_setg(errp, "MAINCLK clock was not connected"); | 57 | @@ -XXX,XX +XXX,XX @@ static bool trans_USDOT_zzxw_s(DisasContext *s, arg_rrxr_esz *a) |
54 | + } | 58 | if (!dc_isar_feature(aa64_sve_i8mm, s)) { |
55 | + if (!clock_has_source(s->s32kclk)) { | 59 | return false; |
56 | + error_setg(errp, "S32KCLK clock was not connected"); | ||
57 | } | 60 | } |
58 | 61 | - return do_zzxz_ool(s, a, gen_helper_gvec_usdot_idx_b); | |
59 | assert(info->num_cpus <= SSE_MAX_CPUS); | 62 | + return gen_gvec_ool_arg_zzxz(s, gen_helper_gvec_usdot_idx_b, a); |
60 | @@ -XXX,XX +XXX,XX @@ static void armsse_realize(DeviceState *dev, Error **errp) | ||
61 | */ | ||
62 | sysbus_init_mmio(SYS_BUS_DEVICE(s), &s->container); | ||
63 | |||
64 | - system_clock_scale = NANOSECONDS_PER_SECOND / s->mainclk_frq; | ||
65 | + /* Set initial system_clock_scale from MAINCLK */ | ||
66 | + armsse_mainclk_update(s); | ||
67 | } | 63 | } |
68 | 64 | ||
69 | static void armsse_idau_check(IDAUInterface *ii, uint32_t address, | 65 | #undef DO_RRXR |
70 | -- | 66 | -- |
71 | 2.20.1 | 67 | 2.25.1 |
72 | |||
73 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | Convert SVE translation functions directly using | ||
4 | gen_gvec_ool_arg_zzxz to TRANS_FEAT. Also include | ||
5 | BFDOT_zzxz, which was using gen_gvec_ool_zzzz. | ||
6 | |||
7 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
8 | Message-id: 20220527181907.189259-15-richard.henderson@linaro.org | ||
9 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
11 | --- | ||
12 | target/arm/translate-sve.c | 48 +++++++++++--------------------------- | ||
13 | 1 file changed, 14 insertions(+), 34 deletions(-) | ||
14 | |||
15 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c | ||
16 | index XXXXXXX..XXXXXXX 100644 | ||
17 | --- a/target/arm/translate-sve.c | ||
18 | +++ b/target/arm/translate-sve.c | ||
19 | @@ -XXX,XX +XXX,XX @@ TRANS_FEAT(DOT_zzzz, aa64_sve, gen_gvec_ool_zzzz, | ||
20 | * SVE Multiply - Indexed | ||
21 | */ | ||
22 | |||
23 | -#define DO_RRXR(NAME, FUNC) \ | ||
24 | - static bool NAME(DisasContext *s, arg_rrxr_esz *a) \ | ||
25 | - { return gen_gvec_ool_arg_zzxz(s, FUNC, a); } | ||
26 | +TRANS_FEAT(SDOT_zzxw_s, aa64_sve, gen_gvec_ool_arg_zzxz, | ||
27 | + gen_helper_gvec_sdot_idx_b, a) | ||
28 | +TRANS_FEAT(SDOT_zzxw_d, aa64_sve, gen_gvec_ool_arg_zzxz, | ||
29 | + gen_helper_gvec_sdot_idx_h, a) | ||
30 | +TRANS_FEAT(UDOT_zzxw_s, aa64_sve, gen_gvec_ool_arg_zzxz, | ||
31 | + gen_helper_gvec_udot_idx_b, a) | ||
32 | +TRANS_FEAT(UDOT_zzxw_d, aa64_sve, gen_gvec_ool_arg_zzxz, | ||
33 | + gen_helper_gvec_udot_idx_h, a) | ||
34 | |||
35 | -DO_RRXR(trans_SDOT_zzxw_s, gen_helper_gvec_sdot_idx_b) | ||
36 | -DO_RRXR(trans_SDOT_zzxw_d, gen_helper_gvec_sdot_idx_h) | ||
37 | -DO_RRXR(trans_UDOT_zzxw_s, gen_helper_gvec_udot_idx_b) | ||
38 | -DO_RRXR(trans_UDOT_zzxw_d, gen_helper_gvec_udot_idx_h) | ||
39 | - | ||
40 | -static bool trans_SUDOT_zzxw_s(DisasContext *s, arg_rrxr_esz *a) | ||
41 | -{ | ||
42 | - if (!dc_isar_feature(aa64_sve_i8mm, s)) { | ||
43 | - return false; | ||
44 | - } | ||
45 | - return gen_gvec_ool_arg_zzxz(s, gen_helper_gvec_sudot_idx_b, a); | ||
46 | -} | ||
47 | - | ||
48 | -static bool trans_USDOT_zzxw_s(DisasContext *s, arg_rrxr_esz *a) | ||
49 | -{ | ||
50 | - if (!dc_isar_feature(aa64_sve_i8mm, s)) { | ||
51 | - return false; | ||
52 | - } | ||
53 | - return gen_gvec_ool_arg_zzxz(s, gen_helper_gvec_usdot_idx_b, a); | ||
54 | -} | ||
55 | - | ||
56 | -#undef DO_RRXR | ||
57 | +TRANS_FEAT(SUDOT_zzxw_s, aa64_sve_i8mm, gen_gvec_ool_arg_zzxz, | ||
58 | + gen_helper_gvec_sudot_idx_b, a) | ||
59 | +TRANS_FEAT(USDOT_zzxw_s, aa64_sve_i8mm, gen_gvec_ool_arg_zzxz, | ||
60 | + gen_helper_gvec_usdot_idx_b, a) | ||
61 | |||
62 | static bool do_sve2_zzz_data(DisasContext *s, int rd, int rn, int rm, int data, | ||
63 | gen_helper_gvec_3 *fn) | ||
64 | @@ -XXX,XX +XXX,XX @@ TRANS_FEAT(UMMLA, aa64_sve_i8mm, gen_gvec_ool_arg_zzzz, | ||
65 | |||
66 | TRANS_FEAT(BFDOT_zzzz, aa64_sve_bf16, gen_gvec_ool_arg_zzzz, | ||
67 | gen_helper_gvec_bfdot, a, 0) | ||
68 | - | ||
69 | -static bool trans_BFDOT_zzxz(DisasContext *s, arg_rrxr_esz *a) | ||
70 | -{ | ||
71 | - if (!dc_isar_feature(aa64_sve_bf16, s)) { | ||
72 | - return false; | ||
73 | - } | ||
74 | - return gen_gvec_ool_zzzz(s, gen_helper_gvec_bfdot_idx, | ||
75 | - a->rd, a->rn, a->rm, a->ra, a->index); | ||
76 | -} | ||
77 | +TRANS_FEAT(BFDOT_zzxz, aa64_sve_bf16, gen_gvec_ool_arg_zzxz, | ||
78 | + gen_helper_gvec_bfdot_idx, a) | ||
79 | |||
80 | TRANS_FEAT(BFMMLA, aa64_sve_bf16, gen_gvec_ool_arg_zzzz, | ||
81 | gen_helper_gvec_bfmmla, a, 0) | ||
82 | -- | ||
83 | 2.25.1 | diff view generated by jsdifflib |
1 | From: Mihai Carabas <mihai.carabas@oracle.com> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Add pvpanic PCI device support details in docs/specs/pvpanic.txt. | 3 | Convert SVE translation functions using do_sve2_zzz_data |
4 | to use TRANS_FEAT and gen_gvec_ool_zzz. | ||
4 | 5 | ||
5 | Signed-off-by: Mihai Carabas <mihai.carabas@oracle.com> | 6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
7 | Message-id: 20220527181907.189259-16-richard.henderson@linaro.org | ||
6 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
8 | --- | 10 | --- |
9 | docs/specs/pvpanic.txt | 13 ++++++++++++- | 11 | target/arm/translate-sve.c | 69 ++++++++++++++------------------------ |
10 | 1 file changed, 12 insertions(+), 1 deletion(-) | 12 | 1 file changed, 25 insertions(+), 44 deletions(-) |
11 | 13 | ||
12 | diff --git a/docs/specs/pvpanic.txt b/docs/specs/pvpanic.txt | 14 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c |
13 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
14 | --- a/docs/specs/pvpanic.txt | 16 | --- a/target/arm/translate-sve.c |
15 | +++ b/docs/specs/pvpanic.txt | 17 | +++ b/target/arm/translate-sve.c |
16 | @@ -XXX,XX +XXX,XX @@ | 18 | @@ -XXX,XX +XXX,XX @@ TRANS_FEAT(SUDOT_zzxw_s, aa64_sve_i8mm, gen_gvec_ool_arg_zzxz, |
17 | PVPANIC DEVICE | 19 | TRANS_FEAT(USDOT_zzxw_s, aa64_sve_i8mm, gen_gvec_ool_arg_zzxz, |
18 | ============== | 20 | gen_helper_gvec_usdot_idx_b, a) |
19 | 21 | ||
20 | -pvpanic device is a simulated ISA device, through which a guest panic | 22 | -static bool do_sve2_zzz_data(DisasContext *s, int rd, int rn, int rm, int data, |
21 | +pvpanic device is a simulated device, through which a guest panic | 23 | - gen_helper_gvec_3 *fn) |
22 | event is sent to qemu, and a QMP event is generated. This allows | 24 | -{ |
23 | management apps (e.g. libvirt) to be notified and respond to the event. | 25 | - if (fn == NULL || !dc_isar_feature(aa64_sve2, s)) { |
24 | 26 | - return false; | |
25 | @@ -XXX,XX +XXX,XX @@ The management app has the option of waiting for GUEST_PANICKED events, | 27 | - } |
26 | and/or polling for guest-panicked RunState, to learn when the pvpanic | 28 | - if (sve_access_check(s)) { |
27 | device has fired a panic event. | 29 | - unsigned vsz = vec_full_reg_size(s); |
28 | 30 | - tcg_gen_gvec_3_ool(vec_full_reg_offset(s, rd), | |
29 | +The pvpanic device can be implemented as an ISA device (using IOPORT) or as a | 31 | - vec_full_reg_offset(s, rn), |
30 | +PCI device. | 32 | - vec_full_reg_offset(s, rm), |
31 | + | 33 | - vsz, vsz, data, fn); |
32 | ISA Interface | 34 | - } |
33 | ------------- | 35 | - return true; |
34 | 36 | -} | |
35 | @@ -XXX,XX +XXX,XX @@ bit 1: a guest panic has happened and will be handled by the guest; | 37 | - |
36 | the host should record it or report it, but should not affect | 38 | #define DO_SVE2_RRX(NAME, FUNC) \ |
37 | the execution of the guest. | 39 | - static bool NAME(DisasContext *s, arg_rrx_esz *a) \ |
38 | 40 | - { return do_sve2_zzz_data(s, a->rd, a->rn, a->rm, a->index, FUNC); } | |
39 | +PCI Interface | 41 | + TRANS_FEAT(NAME, aa64_sve, gen_gvec_ool_zzz, FUNC, \ |
40 | +------------- | 42 | + a->rd, a->rn, a->rm, a->index) |
41 | + | 43 | |
42 | +The PCI interface is similar to the ISA interface except that it uses an MMIO | 44 | -DO_SVE2_RRX(trans_MUL_zzx_h, gen_helper_gvec_mul_idx_h) |
43 | +address space provided by its BAR0, 1 byte long. Any machine with a PCI bus | 45 | -DO_SVE2_RRX(trans_MUL_zzx_s, gen_helper_gvec_mul_idx_s) |
44 | +can enable a pvpanic device by adding '-device pvpanic-pci' to the command | 46 | -DO_SVE2_RRX(trans_MUL_zzx_d, gen_helper_gvec_mul_idx_d) |
45 | +line. | 47 | +DO_SVE2_RRX(MUL_zzx_h, gen_helper_gvec_mul_idx_h) |
46 | + | 48 | +DO_SVE2_RRX(MUL_zzx_s, gen_helper_gvec_mul_idx_s) |
47 | ACPI Interface | 49 | +DO_SVE2_RRX(MUL_zzx_d, gen_helper_gvec_mul_idx_d) |
48 | -------------- | 50 | |
51 | -DO_SVE2_RRX(trans_SQDMULH_zzx_h, gen_helper_sve2_sqdmulh_idx_h) | ||
52 | -DO_SVE2_RRX(trans_SQDMULH_zzx_s, gen_helper_sve2_sqdmulh_idx_s) | ||
53 | -DO_SVE2_RRX(trans_SQDMULH_zzx_d, gen_helper_sve2_sqdmulh_idx_d) | ||
54 | +DO_SVE2_RRX(SQDMULH_zzx_h, gen_helper_sve2_sqdmulh_idx_h) | ||
55 | +DO_SVE2_RRX(SQDMULH_zzx_s, gen_helper_sve2_sqdmulh_idx_s) | ||
56 | +DO_SVE2_RRX(SQDMULH_zzx_d, gen_helper_sve2_sqdmulh_idx_d) | ||
57 | |||
58 | -DO_SVE2_RRX(trans_SQRDMULH_zzx_h, gen_helper_sve2_sqrdmulh_idx_h) | ||
59 | -DO_SVE2_RRX(trans_SQRDMULH_zzx_s, gen_helper_sve2_sqrdmulh_idx_s) | ||
60 | -DO_SVE2_RRX(trans_SQRDMULH_zzx_d, gen_helper_sve2_sqrdmulh_idx_d) | ||
61 | +DO_SVE2_RRX(SQRDMULH_zzx_h, gen_helper_sve2_sqrdmulh_idx_h) | ||
62 | +DO_SVE2_RRX(SQRDMULH_zzx_s, gen_helper_sve2_sqrdmulh_idx_s) | ||
63 | +DO_SVE2_RRX(SQRDMULH_zzx_d, gen_helper_sve2_sqrdmulh_idx_d) | ||
64 | |||
65 | #undef DO_SVE2_RRX | ||
66 | |||
67 | #define DO_SVE2_RRX_TB(NAME, FUNC, TOP) \ | ||
68 | - static bool NAME(DisasContext *s, arg_rrx_esz *a) \ | ||
69 | - { \ | ||
70 | - return do_sve2_zzz_data(s, a->rd, a->rn, a->rm, \ | ||
71 | - (a->index << 1) | TOP, FUNC); \ | ||
72 | - } | ||
73 | + TRANS_FEAT(NAME, aa64_sve, gen_gvec_ool_zzz, FUNC, \ | ||
74 | + a->rd, a->rn, a->rm, (a->index << 1) | TOP) | ||
75 | |||
76 | -DO_SVE2_RRX_TB(trans_SQDMULLB_zzx_s, gen_helper_sve2_sqdmull_idx_s, false) | ||
77 | -DO_SVE2_RRX_TB(trans_SQDMULLB_zzx_d, gen_helper_sve2_sqdmull_idx_d, false) | ||
78 | -DO_SVE2_RRX_TB(trans_SQDMULLT_zzx_s, gen_helper_sve2_sqdmull_idx_s, true) | ||
79 | -DO_SVE2_RRX_TB(trans_SQDMULLT_zzx_d, gen_helper_sve2_sqdmull_idx_d, true) | ||
80 | +DO_SVE2_RRX_TB(SQDMULLB_zzx_s, gen_helper_sve2_sqdmull_idx_s, false) | ||
81 | +DO_SVE2_RRX_TB(SQDMULLB_zzx_d, gen_helper_sve2_sqdmull_idx_d, false) | ||
82 | +DO_SVE2_RRX_TB(SQDMULLT_zzx_s, gen_helper_sve2_sqdmull_idx_s, true) | ||
83 | +DO_SVE2_RRX_TB(SQDMULLT_zzx_d, gen_helper_sve2_sqdmull_idx_d, true) | ||
84 | |||
85 | -DO_SVE2_RRX_TB(trans_SMULLB_zzx_s, gen_helper_sve2_smull_idx_s, false) | ||
86 | -DO_SVE2_RRX_TB(trans_SMULLB_zzx_d, gen_helper_sve2_smull_idx_d, false) | ||
87 | -DO_SVE2_RRX_TB(trans_SMULLT_zzx_s, gen_helper_sve2_smull_idx_s, true) | ||
88 | -DO_SVE2_RRX_TB(trans_SMULLT_zzx_d, gen_helper_sve2_smull_idx_d, true) | ||
89 | +DO_SVE2_RRX_TB(SMULLB_zzx_s, gen_helper_sve2_smull_idx_s, false) | ||
90 | +DO_SVE2_RRX_TB(SMULLB_zzx_d, gen_helper_sve2_smull_idx_d, false) | ||
91 | +DO_SVE2_RRX_TB(SMULLT_zzx_s, gen_helper_sve2_smull_idx_s, true) | ||
92 | +DO_SVE2_RRX_TB(SMULLT_zzx_d, gen_helper_sve2_smull_idx_d, true) | ||
93 | |||
94 | -DO_SVE2_RRX_TB(trans_UMULLB_zzx_s, gen_helper_sve2_umull_idx_s, false) | ||
95 | -DO_SVE2_RRX_TB(trans_UMULLB_zzx_d, gen_helper_sve2_umull_idx_d, false) | ||
96 | -DO_SVE2_RRX_TB(trans_UMULLT_zzx_s, gen_helper_sve2_umull_idx_s, true) | ||
97 | -DO_SVE2_RRX_TB(trans_UMULLT_zzx_d, gen_helper_sve2_umull_idx_d, true) | ||
98 | +DO_SVE2_RRX_TB(UMULLB_zzx_s, gen_helper_sve2_umull_idx_s, false) | ||
99 | +DO_SVE2_RRX_TB(UMULLB_zzx_d, gen_helper_sve2_umull_idx_d, false) | ||
100 | +DO_SVE2_RRX_TB(UMULLT_zzx_s, gen_helper_sve2_umull_idx_s, true) | ||
101 | +DO_SVE2_RRX_TB(UMULLT_zzx_d, gen_helper_sve2_umull_idx_d, true) | ||
102 | |||
103 | #undef DO_SVE2_RRX_TB | ||
49 | 104 | ||
50 | -- | 105 | -- |
51 | 2.20.1 | 106 | 2.25.1 |
52 | |||
53 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | Convert SVE translation functions using do_sve2_zzzz_data | ||
4 | to use TRANS_FEAT and gen_gvec_ool_{zzzz,zzxz}. | ||
5 | |||
6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Message-id: 20220527181907.189259-17-richard.henderson@linaro.org | ||
8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | --- | ||
11 | target/arm/translate-sve.c | 106 ++++++++++++++----------------------- | ||
12 | 1 file changed, 41 insertions(+), 65 deletions(-) | ||
13 | |||
14 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c | ||
15 | index XXXXXXX..XXXXXXX 100644 | ||
16 | --- a/target/arm/translate-sve.c | ||
17 | +++ b/target/arm/translate-sve.c | ||
18 | @@ -XXX,XX +XXX,XX @@ DO_SVE2_RRX_TB(UMULLT_zzx_d, gen_helper_sve2_umull_idx_d, true) | ||
19 | |||
20 | #undef DO_SVE2_RRX_TB | ||
21 | |||
22 | -static bool do_sve2_zzzz_data(DisasContext *s, int rd, int rn, int rm, int ra, | ||
23 | - int data, gen_helper_gvec_4 *fn) | ||
24 | -{ | ||
25 | - if (fn == NULL || !dc_isar_feature(aa64_sve2, s)) { | ||
26 | - return false; | ||
27 | - } | ||
28 | - if (sve_access_check(s)) { | ||
29 | - unsigned vsz = vec_full_reg_size(s); | ||
30 | - tcg_gen_gvec_4_ool(vec_full_reg_offset(s, rd), | ||
31 | - vec_full_reg_offset(s, rn), | ||
32 | - vec_full_reg_offset(s, rm), | ||
33 | - vec_full_reg_offset(s, ra), | ||
34 | - vsz, vsz, data, fn); | ||
35 | - } | ||
36 | - return true; | ||
37 | -} | ||
38 | - | ||
39 | #define DO_SVE2_RRXR(NAME, FUNC) \ | ||
40 | - static bool NAME(DisasContext *s, arg_rrxr_esz *a) \ | ||
41 | - { return do_sve2_zzzz_data(s, a->rd, a->rn, a->rm, a->ra, a->index, FUNC); } | ||
42 | + TRANS_FEAT(NAME, aa64_sve2, gen_gvec_ool_arg_zzxz, FUNC, a) | ||
43 | |||
44 | -DO_SVE2_RRXR(trans_MLA_zzxz_h, gen_helper_gvec_mla_idx_h) | ||
45 | -DO_SVE2_RRXR(trans_MLA_zzxz_s, gen_helper_gvec_mla_idx_s) | ||
46 | -DO_SVE2_RRXR(trans_MLA_zzxz_d, gen_helper_gvec_mla_idx_d) | ||
47 | +DO_SVE2_RRXR(MLA_zzxz_h, gen_helper_gvec_mla_idx_h) | ||
48 | +DO_SVE2_RRXR(MLA_zzxz_s, gen_helper_gvec_mla_idx_s) | ||
49 | +DO_SVE2_RRXR(MLA_zzxz_d, gen_helper_gvec_mla_idx_d) | ||
50 | |||
51 | -DO_SVE2_RRXR(trans_MLS_zzxz_h, gen_helper_gvec_mls_idx_h) | ||
52 | -DO_SVE2_RRXR(trans_MLS_zzxz_s, gen_helper_gvec_mls_idx_s) | ||
53 | -DO_SVE2_RRXR(trans_MLS_zzxz_d, gen_helper_gvec_mls_idx_d) | ||
54 | +DO_SVE2_RRXR(MLS_zzxz_h, gen_helper_gvec_mls_idx_h) | ||
55 | +DO_SVE2_RRXR(MLS_zzxz_s, gen_helper_gvec_mls_idx_s) | ||
56 | +DO_SVE2_RRXR(MLS_zzxz_d, gen_helper_gvec_mls_idx_d) | ||
57 | |||
58 | -DO_SVE2_RRXR(trans_SQRDMLAH_zzxz_h, gen_helper_sve2_sqrdmlah_idx_h) | ||
59 | -DO_SVE2_RRXR(trans_SQRDMLAH_zzxz_s, gen_helper_sve2_sqrdmlah_idx_s) | ||
60 | -DO_SVE2_RRXR(trans_SQRDMLAH_zzxz_d, gen_helper_sve2_sqrdmlah_idx_d) | ||
61 | +DO_SVE2_RRXR(SQRDMLAH_zzxz_h, gen_helper_sve2_sqrdmlah_idx_h) | ||
62 | +DO_SVE2_RRXR(SQRDMLAH_zzxz_s, gen_helper_sve2_sqrdmlah_idx_s) | ||
63 | +DO_SVE2_RRXR(SQRDMLAH_zzxz_d, gen_helper_sve2_sqrdmlah_idx_d) | ||
64 | |||
65 | -DO_SVE2_RRXR(trans_SQRDMLSH_zzxz_h, gen_helper_sve2_sqrdmlsh_idx_h) | ||
66 | -DO_SVE2_RRXR(trans_SQRDMLSH_zzxz_s, gen_helper_sve2_sqrdmlsh_idx_s) | ||
67 | -DO_SVE2_RRXR(trans_SQRDMLSH_zzxz_d, gen_helper_sve2_sqrdmlsh_idx_d) | ||
68 | +DO_SVE2_RRXR(SQRDMLSH_zzxz_h, gen_helper_sve2_sqrdmlsh_idx_h) | ||
69 | +DO_SVE2_RRXR(SQRDMLSH_zzxz_s, gen_helper_sve2_sqrdmlsh_idx_s) | ||
70 | +DO_SVE2_RRXR(SQRDMLSH_zzxz_d, gen_helper_sve2_sqrdmlsh_idx_d) | ||
71 | |||
72 | #undef DO_SVE2_RRXR | ||
73 | |||
74 | #define DO_SVE2_RRXR_TB(NAME, FUNC, TOP) \ | ||
75 | - static bool NAME(DisasContext *s, arg_rrxr_esz *a) \ | ||
76 | - { \ | ||
77 | - return do_sve2_zzzz_data(s, a->rd, a->rn, a->rm, a->rd, \ | ||
78 | - (a->index << 1) | TOP, FUNC); \ | ||
79 | - } | ||
80 | + TRANS_FEAT(NAME, aa64_sve2, gen_gvec_ool_zzzz, FUNC, \ | ||
81 | + a->rd, a->rn, a->rm, a->ra, (a->index << 1) | TOP) | ||
82 | |||
83 | -DO_SVE2_RRXR_TB(trans_SQDMLALB_zzxw_s, gen_helper_sve2_sqdmlal_idx_s, false) | ||
84 | -DO_SVE2_RRXR_TB(trans_SQDMLALB_zzxw_d, gen_helper_sve2_sqdmlal_idx_d, false) | ||
85 | -DO_SVE2_RRXR_TB(trans_SQDMLALT_zzxw_s, gen_helper_sve2_sqdmlal_idx_s, true) | ||
86 | -DO_SVE2_RRXR_TB(trans_SQDMLALT_zzxw_d, gen_helper_sve2_sqdmlal_idx_d, true) | ||
87 | +DO_SVE2_RRXR_TB(SQDMLALB_zzxw_s, gen_helper_sve2_sqdmlal_idx_s, false) | ||
88 | +DO_SVE2_RRXR_TB(SQDMLALB_zzxw_d, gen_helper_sve2_sqdmlal_idx_d, false) | ||
89 | +DO_SVE2_RRXR_TB(SQDMLALT_zzxw_s, gen_helper_sve2_sqdmlal_idx_s, true) | ||
90 | +DO_SVE2_RRXR_TB(SQDMLALT_zzxw_d, gen_helper_sve2_sqdmlal_idx_d, true) | ||
91 | |||
92 | -DO_SVE2_RRXR_TB(trans_SQDMLSLB_zzxw_s, gen_helper_sve2_sqdmlsl_idx_s, false) | ||
93 | -DO_SVE2_RRXR_TB(trans_SQDMLSLB_zzxw_d, gen_helper_sve2_sqdmlsl_idx_d, false) | ||
94 | -DO_SVE2_RRXR_TB(trans_SQDMLSLT_zzxw_s, gen_helper_sve2_sqdmlsl_idx_s, true) | ||
95 | -DO_SVE2_RRXR_TB(trans_SQDMLSLT_zzxw_d, gen_helper_sve2_sqdmlsl_idx_d, true) | ||
96 | +DO_SVE2_RRXR_TB(SQDMLSLB_zzxw_s, gen_helper_sve2_sqdmlsl_idx_s, false) | ||
97 | +DO_SVE2_RRXR_TB(SQDMLSLB_zzxw_d, gen_helper_sve2_sqdmlsl_idx_d, false) | ||
98 | +DO_SVE2_RRXR_TB(SQDMLSLT_zzxw_s, gen_helper_sve2_sqdmlsl_idx_s, true) | ||
99 | +DO_SVE2_RRXR_TB(SQDMLSLT_zzxw_d, gen_helper_sve2_sqdmlsl_idx_d, true) | ||
100 | |||
101 | -DO_SVE2_RRXR_TB(trans_SMLALB_zzxw_s, gen_helper_sve2_smlal_idx_s, false) | ||
102 | -DO_SVE2_RRXR_TB(trans_SMLALB_zzxw_d, gen_helper_sve2_smlal_idx_d, false) | ||
103 | -DO_SVE2_RRXR_TB(trans_SMLALT_zzxw_s, gen_helper_sve2_smlal_idx_s, true) | ||
104 | -DO_SVE2_RRXR_TB(trans_SMLALT_zzxw_d, gen_helper_sve2_smlal_idx_d, true) | ||
105 | +DO_SVE2_RRXR_TB(SMLALB_zzxw_s, gen_helper_sve2_smlal_idx_s, false) | ||
106 | +DO_SVE2_RRXR_TB(SMLALB_zzxw_d, gen_helper_sve2_smlal_idx_d, false) | ||
107 | +DO_SVE2_RRXR_TB(SMLALT_zzxw_s, gen_helper_sve2_smlal_idx_s, true) | ||
108 | +DO_SVE2_RRXR_TB(SMLALT_zzxw_d, gen_helper_sve2_smlal_idx_d, true) | ||
109 | |||
110 | -DO_SVE2_RRXR_TB(trans_UMLALB_zzxw_s, gen_helper_sve2_umlal_idx_s, false) | ||
111 | -DO_SVE2_RRXR_TB(trans_UMLALB_zzxw_d, gen_helper_sve2_umlal_idx_d, false) | ||
112 | -DO_SVE2_RRXR_TB(trans_UMLALT_zzxw_s, gen_helper_sve2_umlal_idx_s, true) | ||
113 | -DO_SVE2_RRXR_TB(trans_UMLALT_zzxw_d, gen_helper_sve2_umlal_idx_d, true) | ||
114 | +DO_SVE2_RRXR_TB(UMLALB_zzxw_s, gen_helper_sve2_umlal_idx_s, false) | ||
115 | +DO_SVE2_RRXR_TB(UMLALB_zzxw_d, gen_helper_sve2_umlal_idx_d, false) | ||
116 | +DO_SVE2_RRXR_TB(UMLALT_zzxw_s, gen_helper_sve2_umlal_idx_s, true) | ||
117 | +DO_SVE2_RRXR_TB(UMLALT_zzxw_d, gen_helper_sve2_umlal_idx_d, true) | ||
118 | |||
119 | -DO_SVE2_RRXR_TB(trans_SMLSLB_zzxw_s, gen_helper_sve2_smlsl_idx_s, false) | ||
120 | -DO_SVE2_RRXR_TB(trans_SMLSLB_zzxw_d, gen_helper_sve2_smlsl_idx_d, false) | ||
121 | -DO_SVE2_RRXR_TB(trans_SMLSLT_zzxw_s, gen_helper_sve2_smlsl_idx_s, true) | ||
122 | -DO_SVE2_RRXR_TB(trans_SMLSLT_zzxw_d, gen_helper_sve2_smlsl_idx_d, true) | ||
123 | +DO_SVE2_RRXR_TB(SMLSLB_zzxw_s, gen_helper_sve2_smlsl_idx_s, false) | ||
124 | +DO_SVE2_RRXR_TB(SMLSLB_zzxw_d, gen_helper_sve2_smlsl_idx_d, false) | ||
125 | +DO_SVE2_RRXR_TB(SMLSLT_zzxw_s, gen_helper_sve2_smlsl_idx_s, true) | ||
126 | +DO_SVE2_RRXR_TB(SMLSLT_zzxw_d, gen_helper_sve2_smlsl_idx_d, true) | ||
127 | |||
128 | -DO_SVE2_RRXR_TB(trans_UMLSLB_zzxw_s, gen_helper_sve2_umlsl_idx_s, false) | ||
129 | -DO_SVE2_RRXR_TB(trans_UMLSLB_zzxw_d, gen_helper_sve2_umlsl_idx_d, false) | ||
130 | -DO_SVE2_RRXR_TB(trans_UMLSLT_zzxw_s, gen_helper_sve2_umlsl_idx_s, true) | ||
131 | -DO_SVE2_RRXR_TB(trans_UMLSLT_zzxw_d, gen_helper_sve2_umlsl_idx_d, true) | ||
132 | +DO_SVE2_RRXR_TB(UMLSLB_zzxw_s, gen_helper_sve2_umlsl_idx_s, false) | ||
133 | +DO_SVE2_RRXR_TB(UMLSLB_zzxw_d, gen_helper_sve2_umlsl_idx_d, false) | ||
134 | +DO_SVE2_RRXR_TB(UMLSLT_zzxw_s, gen_helper_sve2_umlsl_idx_s, true) | ||
135 | +DO_SVE2_RRXR_TB(UMLSLT_zzxw_d, gen_helper_sve2_umlsl_idx_d, true) | ||
136 | |||
137 | #undef DO_SVE2_RRXR_TB | ||
138 | |||
139 | #define DO_SVE2_RRXR_ROT(NAME, FUNC) \ | ||
140 | - static bool trans_##NAME(DisasContext *s, arg_##NAME *a) \ | ||
141 | - { \ | ||
142 | - return do_sve2_zzzz_data(s, a->rd, a->rn, a->rm, a->ra, \ | ||
143 | - (a->index << 2) | a->rot, FUNC); \ | ||
144 | - } | ||
145 | + TRANS_FEAT(NAME, aa64_sve2, gen_gvec_ool_zzzz, FUNC, \ | ||
146 | + a->rd, a->rn, a->rm, a->ra, (a->index << 2) | a->rot) | ||
147 | |||
148 | DO_SVE2_RRXR_ROT(CMLA_zzxz_h, gen_helper_sve2_cmla_idx_h) | ||
149 | DO_SVE2_RRXR_ROT(CMLA_zzxz_s, gen_helper_sve2_cmla_idx_s) | ||
150 | -- | ||
151 | 2.25.1 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | Convert SVE translation functions using do_sve2_zzw_data | ||
4 | to use TRANS_FEAT and gen_gvec_ool_arg_zzz. | ||
5 | |||
6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Message-id: 20220527181907.189259-18-richard.henderson@linaro.org | ||
8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | --- | ||
11 | target/arm/translate-sve.c | 297 ++++++++++++++++++------------------- | ||
12 | 1 file changed, 145 insertions(+), 152 deletions(-) | ||
13 | |||
14 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c | ||
15 | index XXXXXXX..XXXXXXX 100644 | ||
16 | --- a/target/arm/translate-sve.c | ||
17 | +++ b/target/arm/translate-sve.c | ||
18 | @@ -XXX,XX +XXX,XX @@ DO_SVE2_ZPZZ(USQADD, usqadd) | ||
19 | * SVE2 Widening Integer Arithmetic | ||
20 | */ | ||
21 | |||
22 | -static bool do_sve2_zzw_ool(DisasContext *s, arg_rrr_esz *a, | ||
23 | - gen_helper_gvec_3 *fn, int data) | ||
24 | -{ | ||
25 | - if (fn == NULL || !dc_isar_feature(aa64_sve2, s)) { | ||
26 | - return false; | ||
27 | - } | ||
28 | - if (sve_access_check(s)) { | ||
29 | - unsigned vsz = vec_full_reg_size(s); | ||
30 | - tcg_gen_gvec_3_ool(vec_full_reg_offset(s, a->rd), | ||
31 | - vec_full_reg_offset(s, a->rn), | ||
32 | - vec_full_reg_offset(s, a->rm), | ||
33 | - vsz, vsz, data, fn); | ||
34 | - } | ||
35 | - return true; | ||
36 | -} | ||
37 | +static gen_helper_gvec_3 * const saddl_fns[4] = { | ||
38 | + NULL, gen_helper_sve2_saddl_h, | ||
39 | + gen_helper_sve2_saddl_s, gen_helper_sve2_saddl_d, | ||
40 | +}; | ||
41 | +TRANS_FEAT(SADDLB, aa64_sve2, gen_gvec_ool_arg_zzz, | ||
42 | + saddl_fns[a->esz], a, 0) | ||
43 | +TRANS_FEAT(SADDLT, aa64_sve2, gen_gvec_ool_arg_zzz, | ||
44 | + saddl_fns[a->esz], a, 3) | ||
45 | +TRANS_FEAT(SADDLBT, aa64_sve2, gen_gvec_ool_arg_zzz, | ||
46 | + saddl_fns[a->esz], a, 2) | ||
47 | |||
48 | -#define DO_SVE2_ZZZ_TB(NAME, name, SEL1, SEL2) \ | ||
49 | -static bool trans_##NAME(DisasContext *s, arg_rrr_esz *a) \ | ||
50 | -{ \ | ||
51 | - static gen_helper_gvec_3 * const fns[4] = { \ | ||
52 | - NULL, gen_helper_sve2_##name##_h, \ | ||
53 | - gen_helper_sve2_##name##_s, gen_helper_sve2_##name##_d, \ | ||
54 | - }; \ | ||
55 | - return do_sve2_zzw_ool(s, a, fns[a->esz], (SEL2 << 1) | SEL1); \ | ||
56 | -} | ||
57 | +static gen_helper_gvec_3 * const ssubl_fns[4] = { | ||
58 | + NULL, gen_helper_sve2_ssubl_h, | ||
59 | + gen_helper_sve2_ssubl_s, gen_helper_sve2_ssubl_d, | ||
60 | +}; | ||
61 | +TRANS_FEAT(SSUBLB, aa64_sve2, gen_gvec_ool_arg_zzz, | ||
62 | + ssubl_fns[a->esz], a, 0) | ||
63 | +TRANS_FEAT(SSUBLT, aa64_sve2, gen_gvec_ool_arg_zzz, | ||
64 | + ssubl_fns[a->esz], a, 3) | ||
65 | +TRANS_FEAT(SSUBLBT, aa64_sve2, gen_gvec_ool_arg_zzz, | ||
66 | + ssubl_fns[a->esz], a, 2) | ||
67 | +TRANS_FEAT(SSUBLTB, aa64_sve2, gen_gvec_ool_arg_zzz, | ||
68 | + ssubl_fns[a->esz], a, 1) | ||
69 | |||
70 | -DO_SVE2_ZZZ_TB(SADDLB, saddl, false, false) | ||
71 | -DO_SVE2_ZZZ_TB(SSUBLB, ssubl, false, false) | ||
72 | -DO_SVE2_ZZZ_TB(SABDLB, sabdl, false, false) | ||
73 | +static gen_helper_gvec_3 * const sabdl_fns[4] = { | ||
74 | + NULL, gen_helper_sve2_sabdl_h, | ||
75 | + gen_helper_sve2_sabdl_s, gen_helper_sve2_sabdl_d, | ||
76 | +}; | ||
77 | +TRANS_FEAT(SABDLB, aa64_sve2, gen_gvec_ool_arg_zzz, | ||
78 | + sabdl_fns[a->esz], a, 0) | ||
79 | +TRANS_FEAT(SABDLT, aa64_sve2, gen_gvec_ool_arg_zzz, | ||
80 | + sabdl_fns[a->esz], a, 3) | ||
81 | |||
82 | -DO_SVE2_ZZZ_TB(UADDLB, uaddl, false, false) | ||
83 | -DO_SVE2_ZZZ_TB(USUBLB, usubl, false, false) | ||
84 | -DO_SVE2_ZZZ_TB(UABDLB, uabdl, false, false) | ||
85 | +static gen_helper_gvec_3 * const uaddl_fns[4] = { | ||
86 | + NULL, gen_helper_sve2_uaddl_h, | ||
87 | + gen_helper_sve2_uaddl_s, gen_helper_sve2_uaddl_d, | ||
88 | +}; | ||
89 | +TRANS_FEAT(UADDLB, aa64_sve2, gen_gvec_ool_arg_zzz, | ||
90 | + uaddl_fns[a->esz], a, 0) | ||
91 | +TRANS_FEAT(UADDLT, aa64_sve2, gen_gvec_ool_arg_zzz, | ||
92 | + uaddl_fns[a->esz], a, 3) | ||
93 | |||
94 | -DO_SVE2_ZZZ_TB(SADDLT, saddl, true, true) | ||
95 | -DO_SVE2_ZZZ_TB(SSUBLT, ssubl, true, true) | ||
96 | -DO_SVE2_ZZZ_TB(SABDLT, sabdl, true, true) | ||
97 | +static gen_helper_gvec_3 * const usubl_fns[4] = { | ||
98 | + NULL, gen_helper_sve2_usubl_h, | ||
99 | + gen_helper_sve2_usubl_s, gen_helper_sve2_usubl_d, | ||
100 | +}; | ||
101 | +TRANS_FEAT(USUBLB, aa64_sve2, gen_gvec_ool_arg_zzz, | ||
102 | + usubl_fns[a->esz], a, 0) | ||
103 | +TRANS_FEAT(USUBLT, aa64_sve2, gen_gvec_ool_arg_zzz, | ||
104 | + usubl_fns[a->esz], a, 3) | ||
105 | |||
106 | -DO_SVE2_ZZZ_TB(UADDLT, uaddl, true, true) | ||
107 | -DO_SVE2_ZZZ_TB(USUBLT, usubl, true, true) | ||
108 | -DO_SVE2_ZZZ_TB(UABDLT, uabdl, true, true) | ||
109 | +static gen_helper_gvec_3 * const uabdl_fns[4] = { | ||
110 | + NULL, gen_helper_sve2_uabdl_h, | ||
111 | + gen_helper_sve2_uabdl_s, gen_helper_sve2_uabdl_d, | ||
112 | +}; | ||
113 | +TRANS_FEAT(UABDLB, aa64_sve2, gen_gvec_ool_arg_zzz, | ||
114 | + uabdl_fns[a->esz], a, 0) | ||
115 | +TRANS_FEAT(UABDLT, aa64_sve2, gen_gvec_ool_arg_zzz, | ||
116 | + uabdl_fns[a->esz], a, 3) | ||
117 | |||
118 | -DO_SVE2_ZZZ_TB(SADDLBT, saddl, false, true) | ||
119 | -DO_SVE2_ZZZ_TB(SSUBLBT, ssubl, false, true) | ||
120 | -DO_SVE2_ZZZ_TB(SSUBLTB, ssubl, true, false) | ||
121 | +static gen_helper_gvec_3 * const sqdmull_fns[4] = { | ||
122 | + NULL, gen_helper_sve2_sqdmull_zzz_h, | ||
123 | + gen_helper_sve2_sqdmull_zzz_s, gen_helper_sve2_sqdmull_zzz_d, | ||
124 | +}; | ||
125 | +TRANS_FEAT(SQDMULLB_zzz, aa64_sve2, gen_gvec_ool_arg_zzz, | ||
126 | + sqdmull_fns[a->esz], a, 0) | ||
127 | +TRANS_FEAT(SQDMULLT_zzz, aa64_sve2, gen_gvec_ool_arg_zzz, | ||
128 | + sqdmull_fns[a->esz], a, 3) | ||
129 | |||
130 | -DO_SVE2_ZZZ_TB(SQDMULLB_zzz, sqdmull_zzz, false, false) | ||
131 | -DO_SVE2_ZZZ_TB(SQDMULLT_zzz, sqdmull_zzz, true, true) | ||
132 | +static gen_helper_gvec_3 * const smull_fns[4] = { | ||
133 | + NULL, gen_helper_sve2_smull_zzz_h, | ||
134 | + gen_helper_sve2_smull_zzz_s, gen_helper_sve2_smull_zzz_d, | ||
135 | +}; | ||
136 | +TRANS_FEAT(SMULLB_zzz, aa64_sve2, gen_gvec_ool_arg_zzz, | ||
137 | + smull_fns[a->esz], a, 0) | ||
138 | +TRANS_FEAT(SMULLT_zzz, aa64_sve2, gen_gvec_ool_arg_zzz, | ||
139 | + smull_fns[a->esz], a, 3) | ||
140 | |||
141 | -DO_SVE2_ZZZ_TB(SMULLB_zzz, smull_zzz, false, false) | ||
142 | -DO_SVE2_ZZZ_TB(SMULLT_zzz, smull_zzz, true, true) | ||
143 | +static gen_helper_gvec_3 * const umull_fns[4] = { | ||
144 | + NULL, gen_helper_sve2_umull_zzz_h, | ||
145 | + gen_helper_sve2_umull_zzz_s, gen_helper_sve2_umull_zzz_d, | ||
146 | +}; | ||
147 | +TRANS_FEAT(UMULLB_zzz, aa64_sve2, gen_gvec_ool_arg_zzz, | ||
148 | + umull_fns[a->esz], a, 0) | ||
149 | +TRANS_FEAT(UMULLT_zzz, aa64_sve2, gen_gvec_ool_arg_zzz, | ||
150 | + umull_fns[a->esz], a, 3) | ||
151 | |||
152 | -DO_SVE2_ZZZ_TB(UMULLB_zzz, umull_zzz, false, false) | ||
153 | -DO_SVE2_ZZZ_TB(UMULLT_zzz, umull_zzz, true, true) | ||
154 | - | ||
155 | -static bool do_eor_tb(DisasContext *s, arg_rrr_esz *a, bool sel1) | ||
156 | -{ | ||
157 | - static gen_helper_gvec_3 * const fns[4] = { | ||
158 | - gen_helper_sve2_eoril_b, gen_helper_sve2_eoril_h, | ||
159 | - gen_helper_sve2_eoril_s, gen_helper_sve2_eoril_d, | ||
160 | - }; | ||
161 | - return do_sve2_zzw_ool(s, a, fns[a->esz], (!sel1 << 1) | sel1); | ||
162 | -} | ||
163 | - | ||
164 | -static bool trans_EORBT(DisasContext *s, arg_rrr_esz *a) | ||
165 | -{ | ||
166 | - return do_eor_tb(s, a, false); | ||
167 | -} | ||
168 | - | ||
169 | -static bool trans_EORTB(DisasContext *s, arg_rrr_esz *a) | ||
170 | -{ | ||
171 | - return do_eor_tb(s, a, true); | ||
172 | -} | ||
173 | +static gen_helper_gvec_3 * const eoril_fns[4] = { | ||
174 | + gen_helper_sve2_eoril_b, gen_helper_sve2_eoril_h, | ||
175 | + gen_helper_sve2_eoril_s, gen_helper_sve2_eoril_d, | ||
176 | +}; | ||
177 | +TRANS_FEAT(EORBT, aa64_sve2, gen_gvec_ool_arg_zzz, eoril_fns[a->esz], a, 2) | ||
178 | +TRANS_FEAT(EORTB, aa64_sve2, gen_gvec_ool_arg_zzz, eoril_fns[a->esz], a, 1) | ||
179 | |||
180 | static bool do_trans_pmull(DisasContext *s, arg_rrr_esz *a, bool sel) | ||
181 | { | ||
182 | @@ -XXX,XX +XXX,XX @@ static bool do_trans_pmull(DisasContext *s, arg_rrr_esz *a, bool sel) | ||
183 | if (a->esz == 0 && !dc_isar_feature(aa64_sve2_pmull128, s)) { | ||
184 | return false; | ||
185 | } | ||
186 | - return do_sve2_zzw_ool(s, a, fns[a->esz], sel); | ||
187 | + return gen_gvec_ool_arg_zzz(s, fns[a->esz], a, sel); | ||
188 | } | ||
189 | |||
190 | -static bool trans_PMULLB(DisasContext *s, arg_rrr_esz *a) | ||
191 | -{ | ||
192 | - return do_trans_pmull(s, a, false); | ||
193 | -} | ||
194 | +TRANS_FEAT(PMULLB, aa64_sve2, do_trans_pmull, a, false) | ||
195 | +TRANS_FEAT(PMULLT, aa64_sve2, do_trans_pmull, a, true) | ||
196 | |||
197 | -static bool trans_PMULLT(DisasContext *s, arg_rrr_esz *a) | ||
198 | -{ | ||
199 | - return do_trans_pmull(s, a, true); | ||
200 | -} | ||
201 | +static gen_helper_gvec_3 * const saddw_fns[4] = { | ||
202 | + NULL, gen_helper_sve2_saddw_h, | ||
203 | + gen_helper_sve2_saddw_s, gen_helper_sve2_saddw_d, | ||
204 | +}; | ||
205 | +TRANS_FEAT(SADDWB, aa64_sve2, gen_gvec_ool_arg_zzz, saddw_fns[a->esz], a, 0) | ||
206 | +TRANS_FEAT(SADDWT, aa64_sve2, gen_gvec_ool_arg_zzz, saddw_fns[a->esz], a, 1) | ||
207 | |||
208 | -#define DO_SVE2_ZZZ_WTB(NAME, name, SEL2) \ | ||
209 | -static bool trans_##NAME(DisasContext *s, arg_rrr_esz *a) \ | ||
210 | -{ \ | ||
211 | - static gen_helper_gvec_3 * const fns[4] = { \ | ||
212 | - NULL, gen_helper_sve2_##name##_h, \ | ||
213 | - gen_helper_sve2_##name##_s, gen_helper_sve2_##name##_d, \ | ||
214 | - }; \ | ||
215 | - return do_sve2_zzw_ool(s, a, fns[a->esz], SEL2); \ | ||
216 | -} | ||
217 | +static gen_helper_gvec_3 * const ssubw_fns[4] = { | ||
218 | + NULL, gen_helper_sve2_ssubw_h, | ||
219 | + gen_helper_sve2_ssubw_s, gen_helper_sve2_ssubw_d, | ||
220 | +}; | ||
221 | +TRANS_FEAT(SSUBWB, aa64_sve2, gen_gvec_ool_arg_zzz, ssubw_fns[a->esz], a, 0) | ||
222 | +TRANS_FEAT(SSUBWT, aa64_sve2, gen_gvec_ool_arg_zzz, ssubw_fns[a->esz], a, 1) | ||
223 | |||
224 | -DO_SVE2_ZZZ_WTB(SADDWB, saddw, false) | ||
225 | -DO_SVE2_ZZZ_WTB(SADDWT, saddw, true) | ||
226 | -DO_SVE2_ZZZ_WTB(SSUBWB, ssubw, false) | ||
227 | -DO_SVE2_ZZZ_WTB(SSUBWT, ssubw, true) | ||
228 | +static gen_helper_gvec_3 * const uaddw_fns[4] = { | ||
229 | + NULL, gen_helper_sve2_uaddw_h, | ||
230 | + gen_helper_sve2_uaddw_s, gen_helper_sve2_uaddw_d, | ||
231 | +}; | ||
232 | +TRANS_FEAT(UADDWB, aa64_sve2, gen_gvec_ool_arg_zzz, uaddw_fns[a->esz], a, 0) | ||
233 | +TRANS_FEAT(UADDWT, aa64_sve2, gen_gvec_ool_arg_zzz, uaddw_fns[a->esz], a, 1) | ||
234 | |||
235 | -DO_SVE2_ZZZ_WTB(UADDWB, uaddw, false) | ||
236 | -DO_SVE2_ZZZ_WTB(UADDWT, uaddw, true) | ||
237 | -DO_SVE2_ZZZ_WTB(USUBWB, usubw, false) | ||
238 | -DO_SVE2_ZZZ_WTB(USUBWT, usubw, true) | ||
239 | +static gen_helper_gvec_3 * const usubw_fns[4] = { | ||
240 | + NULL, gen_helper_sve2_usubw_h, | ||
241 | + gen_helper_sve2_usubw_s, gen_helper_sve2_usubw_d, | ||
242 | +}; | ||
243 | +TRANS_FEAT(USUBWB, aa64_sve2, gen_gvec_ool_arg_zzz, usubw_fns[a->esz], a, 0) | ||
244 | +TRANS_FEAT(USUBWT, aa64_sve2, gen_gvec_ool_arg_zzz, usubw_fns[a->esz], a, 1) | ||
245 | |||
246 | static void gen_sshll_vec(unsigned vece, TCGv_vec d, TCGv_vec n, int64_t imm) | ||
247 | { | ||
248 | @@ -XXX,XX +XXX,XX @@ static bool trans_USHLLT(DisasContext *s, arg_rri_esz *a) | ||
249 | return do_sve2_shll_tb(s, a, true, true); | ||
250 | } | ||
251 | |||
252 | -static bool trans_BEXT(DisasContext *s, arg_rrr_esz *a) | ||
253 | -{ | ||
254 | - static gen_helper_gvec_3 * const fns[4] = { | ||
255 | - gen_helper_sve2_bext_b, gen_helper_sve2_bext_h, | ||
256 | - gen_helper_sve2_bext_s, gen_helper_sve2_bext_d, | ||
257 | - }; | ||
258 | - if (!dc_isar_feature(aa64_sve2_bitperm, s)) { | ||
259 | - return false; | ||
260 | - } | ||
261 | - return do_sve2_zzw_ool(s, a, fns[a->esz], 0); | ||
262 | -} | ||
263 | +static gen_helper_gvec_3 * const bext_fns[4] = { | ||
264 | + gen_helper_sve2_bext_b, gen_helper_sve2_bext_h, | ||
265 | + gen_helper_sve2_bext_s, gen_helper_sve2_bext_d, | ||
266 | +}; | ||
267 | +TRANS_FEAT(BEXT, aa64_sve2_bitperm, gen_gvec_ool_arg_zzz, | ||
268 | + bext_fns[a->esz], a, 0) | ||
269 | |||
270 | -static bool trans_BDEP(DisasContext *s, arg_rrr_esz *a) | ||
271 | -{ | ||
272 | - static gen_helper_gvec_3 * const fns[4] = { | ||
273 | - gen_helper_sve2_bdep_b, gen_helper_sve2_bdep_h, | ||
274 | - gen_helper_sve2_bdep_s, gen_helper_sve2_bdep_d, | ||
275 | - }; | ||
276 | - if (!dc_isar_feature(aa64_sve2_bitperm, s)) { | ||
277 | - return false; | ||
278 | - } | ||
279 | - return do_sve2_zzw_ool(s, a, fns[a->esz], 0); | ||
280 | -} | ||
281 | +static gen_helper_gvec_3 * const bdep_fns[4] = { | ||
282 | + gen_helper_sve2_bdep_b, gen_helper_sve2_bdep_h, | ||
283 | + gen_helper_sve2_bdep_s, gen_helper_sve2_bdep_d, | ||
284 | +}; | ||
285 | +TRANS_FEAT(BDEP, aa64_sve2_bitperm, gen_gvec_ool_arg_zzz, | ||
286 | + bdep_fns[a->esz], a, 0) | ||
287 | |||
288 | -static bool trans_BGRP(DisasContext *s, arg_rrr_esz *a) | ||
289 | -{ | ||
290 | - static gen_helper_gvec_3 * const fns[4] = { | ||
291 | - gen_helper_sve2_bgrp_b, gen_helper_sve2_bgrp_h, | ||
292 | - gen_helper_sve2_bgrp_s, gen_helper_sve2_bgrp_d, | ||
293 | - }; | ||
294 | - if (!dc_isar_feature(aa64_sve2_bitperm, s)) { | ||
295 | - return false; | ||
296 | - } | ||
297 | - return do_sve2_zzw_ool(s, a, fns[a->esz], 0); | ||
298 | -} | ||
299 | +static gen_helper_gvec_3 * const bgrp_fns[4] = { | ||
300 | + gen_helper_sve2_bgrp_b, gen_helper_sve2_bgrp_h, | ||
301 | + gen_helper_sve2_bgrp_s, gen_helper_sve2_bgrp_d, | ||
302 | +}; | ||
303 | +TRANS_FEAT(BGRP, aa64_sve2_bitperm, gen_gvec_ool_arg_zzz, | ||
304 | + bgrp_fns[a->esz], a, 0) | ||
305 | |||
306 | -static bool do_cadd(DisasContext *s, arg_rrr_esz *a, bool sq, bool rot) | ||
307 | -{ | ||
308 | - static gen_helper_gvec_3 * const fns[2][4] = { | ||
309 | - { gen_helper_sve2_cadd_b, gen_helper_sve2_cadd_h, | ||
310 | - gen_helper_sve2_cadd_s, gen_helper_sve2_cadd_d }, | ||
311 | - { gen_helper_sve2_sqcadd_b, gen_helper_sve2_sqcadd_h, | ||
312 | - gen_helper_sve2_sqcadd_s, gen_helper_sve2_sqcadd_d }, | ||
313 | - }; | ||
314 | - return do_sve2_zzw_ool(s, a, fns[sq][a->esz], rot); | ||
315 | -} | ||
316 | +static gen_helper_gvec_3 * const cadd_fns[4] = { | ||
317 | + gen_helper_sve2_cadd_b, gen_helper_sve2_cadd_h, | ||
318 | + gen_helper_sve2_cadd_s, gen_helper_sve2_cadd_d, | ||
319 | +}; | ||
320 | +TRANS_FEAT(CADD_rot90, aa64_sve2, gen_gvec_ool_arg_zzz, | ||
321 | + cadd_fns[a->esz], a, 0) | ||
322 | +TRANS_FEAT(CADD_rot270, aa64_sve2, gen_gvec_ool_arg_zzz, | ||
323 | + cadd_fns[a->esz], a, 1) | ||
324 | |||
325 | -static bool trans_CADD_rot90(DisasContext *s, arg_rrr_esz *a) | ||
326 | -{ | ||
327 | - return do_cadd(s, a, false, false); | ||
328 | -} | ||
329 | - | ||
330 | -static bool trans_CADD_rot270(DisasContext *s, arg_rrr_esz *a) | ||
331 | -{ | ||
332 | - return do_cadd(s, a, false, true); | ||
333 | -} | ||
334 | - | ||
335 | -static bool trans_SQCADD_rot90(DisasContext *s, arg_rrr_esz *a) | ||
336 | -{ | ||
337 | - return do_cadd(s, a, true, false); | ||
338 | -} | ||
339 | - | ||
340 | -static bool trans_SQCADD_rot270(DisasContext *s, arg_rrr_esz *a) | ||
341 | -{ | ||
342 | - return do_cadd(s, a, true, true); | ||
343 | -} | ||
344 | +static gen_helper_gvec_3 * const sqcadd_fns[4] = { | ||
345 | + gen_helper_sve2_sqcadd_b, gen_helper_sve2_sqcadd_h, | ||
346 | + gen_helper_sve2_sqcadd_s, gen_helper_sve2_sqcadd_d, | ||
347 | +}; | ||
348 | +TRANS_FEAT(SQCADD_rot90, aa64_sve2, gen_gvec_ool_arg_zzz, | ||
349 | + sqcadd_fns[a->esz], a, 0) | ||
350 | +TRANS_FEAT(SQCADD_rot270, aa64_sve2, gen_gvec_ool_arg_zzz, | ||
351 | + sqcadd_fns[a->esz], a, 1) | ||
352 | |||
353 | static gen_helper_gvec_4 * const sabal_fns[4] = { | ||
354 | NULL, gen_helper_sve2_sabal_h, | ||
355 | -- | ||
356 | 2.25.1 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | This is the last direct user of tcg_gen_gvec_4_ool. | ||
4 | |||
5 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
6 | Message-id: 20220527181907.189259-19-richard.henderson@linaro.org | ||
7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
9 | --- | ||
10 | target/arm/translate-sve.c | 17 ++--------------- | ||
11 | 1 file changed, 2 insertions(+), 15 deletions(-) | ||
12 | |||
13 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c | ||
14 | index XXXXXXX..XXXXXXX 100644 | ||
15 | --- a/target/arm/translate-sve.c | ||
16 | +++ b/target/arm/translate-sve.c | ||
17 | @@ -XXX,XX +XXX,XX @@ static gen_helper_gvec_4 * const sqrdcmlah_fns[] = { | ||
18 | TRANS_FEAT(SQRDCMLAH_zzzz, aa64_sve2, gen_gvec_ool_zzzz, | ||
19 | sqrdcmlah_fns[a->esz], a->rd, a->rn, a->rm, a->ra, a->rot) | ||
20 | |||
21 | -static bool trans_USDOT_zzzz(DisasContext *s, arg_USDOT_zzzz *a) | ||
22 | -{ | ||
23 | - if (a->esz != 2 || !dc_isar_feature(aa64_sve_i8mm, s)) { | ||
24 | - return false; | ||
25 | - } | ||
26 | - if (sve_access_check(s)) { | ||
27 | - unsigned vsz = vec_full_reg_size(s); | ||
28 | - tcg_gen_gvec_4_ool(vec_full_reg_offset(s, a->rd), | ||
29 | - vec_full_reg_offset(s, a->rn), | ||
30 | - vec_full_reg_offset(s, a->rm), | ||
31 | - vec_full_reg_offset(s, a->ra), | ||
32 | - vsz, vsz, 0, gen_helper_gvec_usdot_b); | ||
33 | - } | ||
34 | - return true; | ||
35 | -} | ||
36 | +TRANS_FEAT(USDOT_zzzz, aa64_sve_i8mm, gen_gvec_ool_arg_zzzz, | ||
37 | + a->esz == 2 ? gen_helper_gvec_usdot_b : NULL, a, 0) | ||
38 | |||
39 | TRANS_FEAT(AESMC, aa64_sve2_aes, gen_gvec_ool_zz, | ||
40 | gen_helper_crypto_aesmc, a->rd, a->rd, a->decrypt) | ||
41 | -- | ||
42 | 2.25.1 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
4 | Message-id: 20220527181907.189259-20-richard.henderson@linaro.org | ||
5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | --- | ||
8 | target/arm/translate-sve.c | 37 +++++++++++++++---------------------- | ||
9 | 1 file changed, 15 insertions(+), 22 deletions(-) | ||
10 | |||
11 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c | ||
12 | index XXXXXXX..XXXXXXX 100644 | ||
13 | --- a/target/arm/translate-sve.c | ||
14 | +++ b/target/arm/translate-sve.c | ||
15 | @@ -XXX,XX +XXX,XX @@ static bool gen_gvec_ool_arg_zzxz(DisasContext *s, gen_helper_gvec_4 *fn, | ||
16 | } | ||
17 | |||
18 | /* Invoke an out-of-line helper on 2 Zregs and a predicate. */ | ||
19 | -static void gen_gvec_ool_zzp(DisasContext *s, gen_helper_gvec_3 *fn, | ||
20 | +static bool gen_gvec_ool_zzp(DisasContext *s, gen_helper_gvec_3 *fn, | ||
21 | int rd, int rn, int pg, int data) | ||
22 | { | ||
23 | - unsigned vsz = vec_full_reg_size(s); | ||
24 | - tcg_gen_gvec_3_ool(vec_full_reg_offset(s, rd), | ||
25 | - vec_full_reg_offset(s, rn), | ||
26 | - pred_full_reg_offset(s, pg), | ||
27 | - vsz, vsz, data, fn); | ||
28 | + if (fn == NULL) { | ||
29 | + return false; | ||
30 | + } | ||
31 | + if (sve_access_check(s)) { | ||
32 | + unsigned vsz = vec_full_reg_size(s); | ||
33 | + tcg_gen_gvec_3_ool(vec_full_reg_offset(s, rd), | ||
34 | + vec_full_reg_offset(s, rn), | ||
35 | + pred_full_reg_offset(s, pg), | ||
36 | + vsz, vsz, data, fn); | ||
37 | + } | ||
38 | + return true; | ||
39 | } | ||
40 | |||
41 | /* Invoke an out-of-line helper on 3 Zregs and a predicate. */ | ||
42 | @@ -XXX,XX +XXX,XX @@ static bool trans_SEL_zpzz(DisasContext *s, arg_rprr_esz *a) | ||
43 | |||
44 | static bool do_zpz_ool(DisasContext *s, arg_rpr_esz *a, gen_helper_gvec_3 *fn) | ||
45 | { | ||
46 | - if (fn == NULL) { | ||
47 | - return false; | ||
48 | - } | ||
49 | - if (sve_access_check(s)) { | ||
50 | - gen_gvec_ool_zzp(s, fn, a->rd, a->rn, a->pg, 0); | ||
51 | - } | ||
52 | - return true; | ||
53 | + return gen_gvec_ool_zzp(s, fn, a->rd, a->rn, a->pg, 0); | ||
54 | } | ||
55 | |||
56 | #define DO_ZPZ(NAME, name) \ | ||
57 | @@ -XXX,XX +XXX,XX @@ static bool do_movz_zpz(DisasContext *s, int rd, int rn, int pg, | ||
58 | gen_helper_sve_movz_b, gen_helper_sve_movz_h, | ||
59 | gen_helper_sve_movz_s, gen_helper_sve_movz_d, | ||
60 | }; | ||
61 | - | ||
62 | - if (sve_access_check(s)) { | ||
63 | - gen_gvec_ool_zzp(s, fns[esz], rd, rn, pg, invert); | ||
64 | - } | ||
65 | - return true; | ||
66 | + return gen_gvec_ool_zzp(s, fns[esz], rd, rn, pg, invert); | ||
67 | } | ||
68 | |||
69 | static bool do_zpzi_ool(DisasContext *s, arg_rpri_esz *a, | ||
70 | gen_helper_gvec_3 *fn) | ||
71 | { | ||
72 | - if (sve_access_check(s)) { | ||
73 | - gen_gvec_ool_zzp(s, fn, a->rd, a->rn, a->pg, a->imm); | ||
74 | - } | ||
75 | - return true; | ||
76 | + return gen_gvec_ool_zzp(s, fn, a->rd, a->rn, a->pg, a->imm); | ||
77 | } | ||
78 | |||
79 | static bool trans_ASR_zpzi(DisasContext *s, arg_rpri_esz *a) | ||
80 | -- | ||
81 | 2.25.1 | diff view generated by jsdifflib |
1 | From: Maxim Uvarov <maxim.uvarov@linaro.org> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Add secure pl061 for reset/power down machine from | 3 | Use gen_gvec_ool_arg_zpz instead of gen_gvec_ool_zzp |
4 | the secure world (Arm Trusted Firmware). Connect it | 4 | when the arguments come from arg_rpr_esz. |
5 | with gpio-pwr driver. | 5 | Replaces do_zpz_ool. |
6 | 6 | ||
7 | Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org> | 7 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
8 | Reviewed-by: Andrew Jones <drjones@redhat.com> | 8 | Message-id: 20220527181907.189259-21-richard.henderson@linaro.org |
9 | [PMM: Added mention of the new device to the documentation] | 9 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
11 | --- | 11 | --- |
12 | docs/system/arm/virt.rst | 2 ++ | 12 | target/arm/translate-sve.c | 45 +++++++++++++++++++++----------------- |
13 | include/hw/arm/virt.h | 2 ++ | 13 | 1 file changed, 25 insertions(+), 20 deletions(-) |
14 | hw/arm/virt.c | 56 +++++++++++++++++++++++++++++++++++++++- | ||
15 | hw/arm/Kconfig | 1 + | ||
16 | 4 files changed, 60 insertions(+), 1 deletion(-) | ||
17 | 14 | ||
18 | diff --git a/docs/system/arm/virt.rst b/docs/system/arm/virt.rst | 15 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c |
19 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
20 | --- a/docs/system/arm/virt.rst | 17 | --- a/target/arm/translate-sve.c |
21 | +++ b/docs/system/arm/virt.rst | 18 | +++ b/target/arm/translate-sve.c |
22 | @@ -XXX,XX +XXX,XX @@ The virt board supports: | 19 | @@ -XXX,XX +XXX,XX @@ static bool gen_gvec_ool_zzp(DisasContext *s, gen_helper_gvec_3 *fn, |
23 | - Secure-World-only devices if the CPU has TrustZone: | 20 | return true; |
24 | |||
25 | - A second PL011 UART | ||
26 | + - A second PL061 GPIO controller, with GPIO lines for triggering | ||
27 | + a system reset or system poweroff | ||
28 | - A secure flash memory | ||
29 | - 16MB of secure RAM | ||
30 | |||
31 | diff --git a/include/hw/arm/virt.h b/include/hw/arm/virt.h | ||
32 | index XXXXXXX..XXXXXXX 100644 | ||
33 | --- a/include/hw/arm/virt.h | ||
34 | +++ b/include/hw/arm/virt.h | ||
35 | @@ -XXX,XX +XXX,XX @@ enum { | ||
36 | VIRT_GPIO, | ||
37 | VIRT_SECURE_UART, | ||
38 | VIRT_SECURE_MEM, | ||
39 | + VIRT_SECURE_GPIO, | ||
40 | VIRT_PCDIMM_ACPI, | ||
41 | VIRT_ACPI_GED, | ||
42 | VIRT_NVDIMM_ACPI, | ||
43 | @@ -XXX,XX +XXX,XX @@ struct VirtMachineClass { | ||
44 | bool kvm_no_adjvtime; | ||
45 | bool no_kvm_steal_time; | ||
46 | bool acpi_expose_flash; | ||
47 | + bool no_secure_gpio; | ||
48 | }; | ||
49 | |||
50 | struct VirtMachineState { | ||
51 | diff --git a/hw/arm/virt.c b/hw/arm/virt.c | ||
52 | index XXXXXXX..XXXXXXX 100644 | ||
53 | --- a/hw/arm/virt.c | ||
54 | +++ b/hw/arm/virt.c | ||
55 | @@ -XXX,XX +XXX,XX @@ static const MemMapEntry base_memmap[] = { | ||
56 | [VIRT_ACPI_GED] = { 0x09080000, ACPI_GED_EVT_SEL_LEN }, | ||
57 | [VIRT_NVDIMM_ACPI] = { 0x09090000, NVDIMM_ACPI_IO_LEN}, | ||
58 | [VIRT_PVTIME] = { 0x090a0000, 0x00010000 }, | ||
59 | + [VIRT_SECURE_GPIO] = { 0x090b0000, 0x00001000 }, | ||
60 | [VIRT_MMIO] = { 0x0a000000, 0x00000200 }, | ||
61 | /* ...repeating for a total of NUM_VIRTIO_TRANSPORTS, each of that size */ | ||
62 | [VIRT_PLATFORM_BUS] = { 0x0c000000, 0x02000000 }, | ||
63 | @@ -XXX,XX +XXX,XX @@ static void create_gpio_keys(const VirtMachineState *vms, | ||
64 | "gpios", phandle, 3, 0); | ||
65 | } | 21 | } |
66 | 22 | ||
67 | +#define SECURE_GPIO_POWEROFF 0 | 23 | +static bool gen_gvec_ool_arg_zpz(DisasContext *s, gen_helper_gvec_3 *fn, |
68 | +#define SECURE_GPIO_RESET 1 | 24 | + arg_rpr_esz *a, int data) |
69 | + | ||
70 | +static void create_secure_gpio_pwr(const VirtMachineState *vms, | ||
71 | + DeviceState *pl061_dev, | ||
72 | + uint32_t phandle) | ||
73 | +{ | 25 | +{ |
74 | + DeviceState *gpio_pwr_dev; | 26 | + return gen_gvec_ool_zzp(s, fn, a->rd, a->rn, a->pg, data); |
75 | + | ||
76 | + /* gpio-pwr */ | ||
77 | + gpio_pwr_dev = sysbus_create_simple("gpio-pwr", -1, NULL); | ||
78 | + | ||
79 | + /* connect secure pl061 to gpio-pwr */ | ||
80 | + qdev_connect_gpio_out(pl061_dev, SECURE_GPIO_RESET, | ||
81 | + qdev_get_gpio_in_named(gpio_pwr_dev, "reset", 0)); | ||
82 | + qdev_connect_gpio_out(pl061_dev, SECURE_GPIO_POWEROFF, | ||
83 | + qdev_get_gpio_in_named(gpio_pwr_dev, "shutdown", 0)); | ||
84 | + | ||
85 | + qemu_fdt_add_subnode(vms->fdt, "/gpio-poweroff"); | ||
86 | + qemu_fdt_setprop_string(vms->fdt, "/gpio-poweroff", "compatible", | ||
87 | + "gpio-poweroff"); | ||
88 | + qemu_fdt_setprop_cells(vms->fdt, "/gpio-poweroff", | ||
89 | + "gpios", phandle, SECURE_GPIO_POWEROFF, 0); | ||
90 | + qemu_fdt_setprop_string(vms->fdt, "/gpio-poweroff", "status", "disabled"); | ||
91 | + qemu_fdt_setprop_string(vms->fdt, "/gpio-poweroff", "secure-status", | ||
92 | + "okay"); | ||
93 | + | ||
94 | + qemu_fdt_add_subnode(vms->fdt, "/gpio-restart"); | ||
95 | + qemu_fdt_setprop_string(vms->fdt, "/gpio-restart", "compatible", | ||
96 | + "gpio-restart"); | ||
97 | + qemu_fdt_setprop_cells(vms->fdt, "/gpio-restart", | ||
98 | + "gpios", phandle, SECURE_GPIO_RESET, 0); | ||
99 | + qemu_fdt_setprop_string(vms->fdt, "/gpio-restart", "status", "disabled"); | ||
100 | + qemu_fdt_setprop_string(vms->fdt, "/gpio-restart", "secure-status", | ||
101 | + "okay"); | ||
102 | +} | 27 | +} |
103 | + | 28 | + |
104 | static void create_gpio_devices(const VirtMachineState *vms, int gpio, | 29 | + |
105 | MemoryRegion *mem) | 30 | /* Invoke an out-of-line helper on 3 Zregs and a predicate. */ |
31 | static void gen_gvec_ool_zzzp(DisasContext *s, gen_helper_gvec_4 *fn, | ||
32 | int rd, int rn, int rm, int pg, int data) | ||
33 | @@ -XXX,XX +XXX,XX @@ static bool trans_SEL_zpzz(DisasContext *s, arg_rprr_esz *a) | ||
34 | *** SVE Integer Arithmetic - Unary Predicated Group | ||
35 | */ | ||
36 | |||
37 | -static bool do_zpz_ool(DisasContext *s, arg_rpr_esz *a, gen_helper_gvec_3 *fn) | ||
38 | -{ | ||
39 | - return gen_gvec_ool_zzp(s, fn, a->rd, a->rn, a->pg, 0); | ||
40 | -} | ||
41 | - | ||
42 | #define DO_ZPZ(NAME, name) \ | ||
43 | static bool trans_##NAME(DisasContext *s, arg_rpr_esz *a) \ | ||
44 | { \ | ||
45 | @@ -XXX,XX +XXX,XX @@ static bool trans_##NAME(DisasContext *s, arg_rpr_esz *a) \ | ||
46 | gen_helper_sve_##name##_b, gen_helper_sve_##name##_h, \ | ||
47 | gen_helper_sve_##name##_s, gen_helper_sve_##name##_d, \ | ||
48 | }; \ | ||
49 | - return do_zpz_ool(s, a, fns[a->esz]); \ | ||
50 | + return gen_gvec_ool_arg_zpz(s, fns[a->esz], a, 0); \ | ||
51 | } | ||
52 | |||
53 | DO_ZPZ(CLS, cls) | ||
54 | @@ -XXX,XX +XXX,XX @@ static bool trans_FABS(DisasContext *s, arg_rpr_esz *a) | ||
55 | gen_helper_sve_fabs_s, | ||
56 | gen_helper_sve_fabs_d | ||
57 | }; | ||
58 | - return do_zpz_ool(s, a, fns[a->esz]); | ||
59 | + return gen_gvec_ool_arg_zpz(s, fns[a->esz], a, 0); | ||
60 | } | ||
61 | |||
62 | static bool trans_FNEG(DisasContext *s, arg_rpr_esz *a) | ||
63 | @@ -XXX,XX +XXX,XX @@ static bool trans_FNEG(DisasContext *s, arg_rpr_esz *a) | ||
64 | gen_helper_sve_fneg_s, | ||
65 | gen_helper_sve_fneg_d | ||
66 | }; | ||
67 | - return do_zpz_ool(s, a, fns[a->esz]); | ||
68 | + return gen_gvec_ool_arg_zpz(s, fns[a->esz], a, 0); | ||
69 | } | ||
70 | |||
71 | static bool trans_SXTB(DisasContext *s, arg_rpr_esz *a) | ||
72 | @@ -XXX,XX +XXX,XX @@ static bool trans_SXTB(DisasContext *s, arg_rpr_esz *a) | ||
73 | gen_helper_sve_sxtb_s, | ||
74 | gen_helper_sve_sxtb_d | ||
75 | }; | ||
76 | - return do_zpz_ool(s, a, fns[a->esz]); | ||
77 | + return gen_gvec_ool_arg_zpz(s, fns[a->esz], a, 0); | ||
78 | } | ||
79 | |||
80 | static bool trans_UXTB(DisasContext *s, arg_rpr_esz *a) | ||
81 | @@ -XXX,XX +XXX,XX @@ static bool trans_UXTB(DisasContext *s, arg_rpr_esz *a) | ||
82 | gen_helper_sve_uxtb_s, | ||
83 | gen_helper_sve_uxtb_d | ||
84 | }; | ||
85 | - return do_zpz_ool(s, a, fns[a->esz]); | ||
86 | + return gen_gvec_ool_arg_zpz(s, fns[a->esz], a, 0); | ||
87 | } | ||
88 | |||
89 | static bool trans_SXTH(DisasContext *s, arg_rpr_esz *a) | ||
90 | @@ -XXX,XX +XXX,XX @@ static bool trans_SXTH(DisasContext *s, arg_rpr_esz *a) | ||
91 | gen_helper_sve_sxth_s, | ||
92 | gen_helper_sve_sxth_d | ||
93 | }; | ||
94 | - return do_zpz_ool(s, a, fns[a->esz]); | ||
95 | + return gen_gvec_ool_arg_zpz(s, fns[a->esz], a, 0); | ||
96 | } | ||
97 | |||
98 | static bool trans_UXTH(DisasContext *s, arg_rpr_esz *a) | ||
99 | @@ -XXX,XX +XXX,XX @@ static bool trans_UXTH(DisasContext *s, arg_rpr_esz *a) | ||
100 | gen_helper_sve_uxth_s, | ||
101 | gen_helper_sve_uxth_d | ||
102 | }; | ||
103 | - return do_zpz_ool(s, a, fns[a->esz]); | ||
104 | + return gen_gvec_ool_arg_zpz(s, fns[a->esz], a, 0); | ||
105 | } | ||
106 | |||
107 | static bool trans_SXTW(DisasContext *s, arg_rpr_esz *a) | ||
106 | { | 108 | { |
107 | @@ -XXX,XX +XXX,XX @@ static void create_gpio_devices(const VirtMachineState *vms, int gpio, | 109 | - return do_zpz_ool(s, a, a->esz == 3 ? gen_helper_sve_sxtw_d : NULL); |
108 | qemu_fdt_setprop_string(vms->fdt, nodename, "clock-names", "apb_pclk"); | 110 | + return gen_gvec_ool_arg_zpz(s, a->esz == 3 ? gen_helper_sve_sxtw_d |
109 | qemu_fdt_setprop_cell(vms->fdt, nodename, "phandle", phandle); | 111 | + : NULL, a, 0); |
110 | |||
111 | + if (gpio != VIRT_GPIO) { | ||
112 | + /* Mark as not usable by the normal world */ | ||
113 | + qemu_fdt_setprop_string(vms->fdt, nodename, "status", "disabled"); | ||
114 | + qemu_fdt_setprop_string(vms->fdt, nodename, "secure-status", "okay"); | ||
115 | + } | ||
116 | g_free(nodename); | ||
117 | |||
118 | /* Child gpio devices */ | ||
119 | - create_gpio_keys(vms, pl061_dev, phandle); | ||
120 | + if (gpio == VIRT_GPIO) { | ||
121 | + create_gpio_keys(vms, pl061_dev, phandle); | ||
122 | + } else { | ||
123 | + create_secure_gpio_pwr(vms, pl061_dev, phandle); | ||
124 | + } | ||
125 | } | 112 | } |
126 | 113 | ||
127 | static void create_virtio_devices(const VirtMachineState *vms) | 114 | static bool trans_UXTW(DisasContext *s, arg_rpr_esz *a) |
128 | @@ -XXX,XX +XXX,XX @@ static void machvirt_init(MachineState *machine) | 115 | { |
129 | create_gpio_devices(vms, VIRT_GPIO, sysmem); | 116 | - return do_zpz_ool(s, a, a->esz == 3 ? gen_helper_sve_uxtw_d : NULL); |
117 | + return gen_gvec_ool_arg_zpz(s, a->esz == 3 ? gen_helper_sve_uxtw_d | ||
118 | + : NULL, a, 0); | ||
119 | } | ||
120 | |||
121 | #undef DO_ZPZ | ||
122 | @@ -XXX,XX +XXX,XX @@ static bool trans_COMPACT(DisasContext *s, arg_rpr_esz *a) | ||
123 | static gen_helper_gvec_3 * const fns[4] = { | ||
124 | NULL, NULL, gen_helper_sve_compact_s, gen_helper_sve_compact_d | ||
125 | }; | ||
126 | - return do_zpz_ool(s, a, fns[a->esz]); | ||
127 | + return gen_gvec_ool_arg_zpz(s, fns[a->esz], a, 0); | ||
128 | } | ||
129 | |||
130 | /* Call the helper that computes the ARM LastActiveElement pseudocode | ||
131 | @@ -XXX,XX +XXX,XX @@ static bool trans_REVB(DisasContext *s, arg_rpr_esz *a) | ||
132 | gen_helper_sve_revb_s, | ||
133 | gen_helper_sve_revb_d, | ||
134 | }; | ||
135 | - return do_zpz_ool(s, a, fns[a->esz]); | ||
136 | + return gen_gvec_ool_arg_zpz(s, fns[a->esz], a, 0); | ||
137 | } | ||
138 | |||
139 | static bool trans_REVH(DisasContext *s, arg_rpr_esz *a) | ||
140 | @@ -XXX,XX +XXX,XX @@ static bool trans_REVH(DisasContext *s, arg_rpr_esz *a) | ||
141 | gen_helper_sve_revh_s, | ||
142 | gen_helper_sve_revh_d, | ||
143 | }; | ||
144 | - return do_zpz_ool(s, a, fns[a->esz]); | ||
145 | + return gen_gvec_ool_arg_zpz(s, fns[a->esz], a, 0); | ||
146 | } | ||
147 | |||
148 | static bool trans_REVW(DisasContext *s, arg_rpr_esz *a) | ||
149 | { | ||
150 | - return do_zpz_ool(s, a, a->esz == 3 ? gen_helper_sve_revw_d : NULL); | ||
151 | + return gen_gvec_ool_arg_zpz(s, a->esz == 3 ? gen_helper_sve_revw_d | ||
152 | + : NULL, a, 0); | ||
153 | } | ||
154 | |||
155 | static bool trans_RBIT(DisasContext *s, arg_rpr_esz *a) | ||
156 | @@ -XXX,XX +XXX,XX @@ static bool trans_RBIT(DisasContext *s, arg_rpr_esz *a) | ||
157 | gen_helper_sve_rbit_s, | ||
158 | gen_helper_sve_rbit_d, | ||
159 | }; | ||
160 | - return do_zpz_ool(s, a, fns[a->esz]); | ||
161 | + return gen_gvec_ool_arg_zpz(s, fns[a->esz], a, 0); | ||
162 | } | ||
163 | |||
164 | static bool trans_SPLICE(DisasContext *s, arg_rprr_esz *a) | ||
165 | @@ -XXX,XX +XXX,XX @@ static bool do_sve2_zpz_ool(DisasContext *s, arg_rpr_esz *a, | ||
166 | if (!dc_isar_feature(aa64_sve2, s)) { | ||
167 | return false; | ||
130 | } | 168 | } |
131 | 169 | - return do_zpz_ool(s, a, fn); | |
132 | + if (vms->secure && !vmc->no_secure_gpio) { | 170 | + return gen_gvec_ool_arg_zpz(s, fn, a, 0); |
133 | + create_gpio_devices(vms, VIRT_SECURE_GPIO, secure_sysmem); | ||
134 | + } | ||
135 | + | ||
136 | /* connect powerdown request */ | ||
137 | vms->powerdown_notifier.notify = virt_powerdown_req; | ||
138 | qemu_register_powerdown_notifier(&vms->powerdown_notifier); | ||
139 | @@ -XXX,XX +XXX,XX @@ DEFINE_VIRT_MACHINE_AS_LATEST(6, 0) | ||
140 | |||
141 | static void virt_machine_5_2_options(MachineClass *mc) | ||
142 | { | ||
143 | + VirtMachineClass *vmc = VIRT_MACHINE_CLASS(OBJECT_CLASS(mc)); | ||
144 | + | ||
145 | virt_machine_6_0_options(mc); | ||
146 | compat_props_add(mc->compat_props, hw_compat_5_2, hw_compat_5_2_len); | ||
147 | + vmc->no_secure_gpio = true; | ||
148 | } | 171 | } |
149 | DEFINE_VIRT_MACHINE(5, 2) | 172 | |
150 | 173 | static bool trans_URECPE(DisasContext *s, arg_rpr_esz *a) | |
151 | diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig | ||
152 | index XXXXXXX..XXXXXXX 100644 | ||
153 | --- a/hw/arm/Kconfig | ||
154 | +++ b/hw/arm/Kconfig | ||
155 | @@ -XXX,XX +XXX,XX @@ config ARM_VIRT | ||
156 | select PL011 # UART | ||
157 | select PL031 # RTC | ||
158 | select PL061 # GPIO | ||
159 | + select GPIO_PWR | ||
160 | select PLATFORM_BUS | ||
161 | select SMBIOS | ||
162 | select VIRTIO_MMIO | ||
163 | -- | 174 | -- |
164 | 2.20.1 | 175 | 2.25.1 |
165 | |||
166 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | Convert SVE translation functions directly using | ||
4 | gen_gvec_ool_arg_zpz to TRANS_FEAT. | ||
5 | |||
6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Message-id: 20220527181907.189259-22-richard.henderson@linaro.org | ||
8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | --- | ||
11 | target/arm/translate-sve.c | 189 ++++++++++++------------------------- | ||
12 | 1 file changed, 60 insertions(+), 129 deletions(-) | ||
13 | |||
14 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c | ||
15 | index XXXXXXX..XXXXXXX 100644 | ||
16 | --- a/target/arm/translate-sve.c | ||
17 | +++ b/target/arm/translate-sve.c | ||
18 | @@ -XXX,XX +XXX,XX @@ static bool trans_SEL_zpzz(DisasContext *s, arg_rprr_esz *a) | ||
19 | *** SVE Integer Arithmetic - Unary Predicated Group | ||
20 | */ | ||
21 | |||
22 | -#define DO_ZPZ(NAME, name) \ | ||
23 | -static bool trans_##NAME(DisasContext *s, arg_rpr_esz *a) \ | ||
24 | -{ \ | ||
25 | - static gen_helper_gvec_3 * const fns[4] = { \ | ||
26 | - gen_helper_sve_##name##_b, gen_helper_sve_##name##_h, \ | ||
27 | - gen_helper_sve_##name##_s, gen_helper_sve_##name##_d, \ | ||
28 | +#define DO_ZPZ(NAME, FEAT, name) \ | ||
29 | + static gen_helper_gvec_3 * const name##_fns[4] = { \ | ||
30 | + gen_helper_##name##_b, gen_helper_##name##_h, \ | ||
31 | + gen_helper_##name##_s, gen_helper_##name##_d, \ | ||
32 | }; \ | ||
33 | - return gen_gvec_ool_arg_zpz(s, fns[a->esz], a, 0); \ | ||
34 | -} | ||
35 | + TRANS_FEAT(NAME, FEAT, gen_gvec_ool_arg_zpz, name##_fns[a->esz], a, 0) | ||
36 | |||
37 | -DO_ZPZ(CLS, cls) | ||
38 | -DO_ZPZ(CLZ, clz) | ||
39 | -DO_ZPZ(CNT_zpz, cnt_zpz) | ||
40 | -DO_ZPZ(CNOT, cnot) | ||
41 | -DO_ZPZ(NOT_zpz, not_zpz) | ||
42 | -DO_ZPZ(ABS, abs) | ||
43 | -DO_ZPZ(NEG, neg) | ||
44 | +DO_ZPZ(CLS, aa64_sve, sve_cls) | ||
45 | +DO_ZPZ(CLZ, aa64_sve, sve_clz) | ||
46 | +DO_ZPZ(CNT_zpz, aa64_sve, sve_cnt_zpz) | ||
47 | +DO_ZPZ(CNOT, aa64_sve, sve_cnot) | ||
48 | +DO_ZPZ(NOT_zpz, aa64_sve, sve_not_zpz) | ||
49 | +DO_ZPZ(ABS, aa64_sve, sve_abs) | ||
50 | +DO_ZPZ(NEG, aa64_sve, sve_neg) | ||
51 | +DO_ZPZ(RBIT, aa64_sve, sve_rbit) | ||
52 | |||
53 | -static bool trans_FABS(DisasContext *s, arg_rpr_esz *a) | ||
54 | -{ | ||
55 | - static gen_helper_gvec_3 * const fns[4] = { | ||
56 | - NULL, | ||
57 | - gen_helper_sve_fabs_h, | ||
58 | - gen_helper_sve_fabs_s, | ||
59 | - gen_helper_sve_fabs_d | ||
60 | - }; | ||
61 | - return gen_gvec_ool_arg_zpz(s, fns[a->esz], a, 0); | ||
62 | -} | ||
63 | +static gen_helper_gvec_3 * const fabs_fns[4] = { | ||
64 | + NULL, gen_helper_sve_fabs_h, | ||
65 | + gen_helper_sve_fabs_s, gen_helper_sve_fabs_d, | ||
66 | +}; | ||
67 | +TRANS_FEAT(FABS, aa64_sve, gen_gvec_ool_arg_zpz, fabs_fns[a->esz], a, 0) | ||
68 | |||
69 | -static bool trans_FNEG(DisasContext *s, arg_rpr_esz *a) | ||
70 | -{ | ||
71 | - static gen_helper_gvec_3 * const fns[4] = { | ||
72 | - NULL, | ||
73 | - gen_helper_sve_fneg_h, | ||
74 | - gen_helper_sve_fneg_s, | ||
75 | - gen_helper_sve_fneg_d | ||
76 | - }; | ||
77 | - return gen_gvec_ool_arg_zpz(s, fns[a->esz], a, 0); | ||
78 | -} | ||
79 | +static gen_helper_gvec_3 * const fneg_fns[4] = { | ||
80 | + NULL, gen_helper_sve_fneg_h, | ||
81 | + gen_helper_sve_fneg_s, gen_helper_sve_fneg_d, | ||
82 | +}; | ||
83 | +TRANS_FEAT(FNEG, aa64_sve, gen_gvec_ool_arg_zpz, fneg_fns[a->esz], a, 0) | ||
84 | |||
85 | -static bool trans_SXTB(DisasContext *s, arg_rpr_esz *a) | ||
86 | -{ | ||
87 | - static gen_helper_gvec_3 * const fns[4] = { | ||
88 | - NULL, | ||
89 | - gen_helper_sve_sxtb_h, | ||
90 | - gen_helper_sve_sxtb_s, | ||
91 | - gen_helper_sve_sxtb_d | ||
92 | - }; | ||
93 | - return gen_gvec_ool_arg_zpz(s, fns[a->esz], a, 0); | ||
94 | -} | ||
95 | +static gen_helper_gvec_3 * const sxtb_fns[4] = { | ||
96 | + NULL, gen_helper_sve_sxtb_h, | ||
97 | + gen_helper_sve_sxtb_s, gen_helper_sve_sxtb_d, | ||
98 | +}; | ||
99 | +TRANS_FEAT(SXTB, aa64_sve, gen_gvec_ool_arg_zpz, sxtb_fns[a->esz], a, 0) | ||
100 | |||
101 | -static bool trans_UXTB(DisasContext *s, arg_rpr_esz *a) | ||
102 | -{ | ||
103 | - static gen_helper_gvec_3 * const fns[4] = { | ||
104 | - NULL, | ||
105 | - gen_helper_sve_uxtb_h, | ||
106 | - gen_helper_sve_uxtb_s, | ||
107 | - gen_helper_sve_uxtb_d | ||
108 | - }; | ||
109 | - return gen_gvec_ool_arg_zpz(s, fns[a->esz], a, 0); | ||
110 | -} | ||
111 | +static gen_helper_gvec_3 * const uxtb_fns[4] = { | ||
112 | + NULL, gen_helper_sve_uxtb_h, | ||
113 | + gen_helper_sve_uxtb_s, gen_helper_sve_uxtb_d, | ||
114 | +}; | ||
115 | +TRANS_FEAT(UXTB, aa64_sve, gen_gvec_ool_arg_zpz, uxtb_fns[a->esz], a, 0) | ||
116 | |||
117 | -static bool trans_SXTH(DisasContext *s, arg_rpr_esz *a) | ||
118 | -{ | ||
119 | - static gen_helper_gvec_3 * const fns[4] = { | ||
120 | - NULL, NULL, | ||
121 | - gen_helper_sve_sxth_s, | ||
122 | - gen_helper_sve_sxth_d | ||
123 | - }; | ||
124 | - return gen_gvec_ool_arg_zpz(s, fns[a->esz], a, 0); | ||
125 | -} | ||
126 | +static gen_helper_gvec_3 * const sxth_fns[4] = { | ||
127 | + NULL, NULL, gen_helper_sve_sxth_s, gen_helper_sve_sxth_d | ||
128 | +}; | ||
129 | +TRANS_FEAT(SXTH, aa64_sve, gen_gvec_ool_arg_zpz, sxth_fns[a->esz], a, 0) | ||
130 | |||
131 | -static bool trans_UXTH(DisasContext *s, arg_rpr_esz *a) | ||
132 | -{ | ||
133 | - static gen_helper_gvec_3 * const fns[4] = { | ||
134 | - NULL, NULL, | ||
135 | - gen_helper_sve_uxth_s, | ||
136 | - gen_helper_sve_uxth_d | ||
137 | - }; | ||
138 | - return gen_gvec_ool_arg_zpz(s, fns[a->esz], a, 0); | ||
139 | -} | ||
140 | +static gen_helper_gvec_3 * const uxth_fns[4] = { | ||
141 | + NULL, NULL, gen_helper_sve_uxth_s, gen_helper_sve_uxth_d | ||
142 | +}; | ||
143 | +TRANS_FEAT(UXTH, aa64_sve, gen_gvec_ool_arg_zpz, uxth_fns[a->esz], a, 0) | ||
144 | |||
145 | -static bool trans_SXTW(DisasContext *s, arg_rpr_esz *a) | ||
146 | -{ | ||
147 | - return gen_gvec_ool_arg_zpz(s, a->esz == 3 ? gen_helper_sve_sxtw_d | ||
148 | - : NULL, a, 0); | ||
149 | -} | ||
150 | - | ||
151 | -static bool trans_UXTW(DisasContext *s, arg_rpr_esz *a) | ||
152 | -{ | ||
153 | - return gen_gvec_ool_arg_zpz(s, a->esz == 3 ? gen_helper_sve_uxtw_d | ||
154 | - : NULL, a, 0); | ||
155 | -} | ||
156 | - | ||
157 | -#undef DO_ZPZ | ||
158 | +TRANS_FEAT(SXTW, aa64_sve, gen_gvec_ool_arg_zpz, | ||
159 | + a->esz == 3 ? gen_helper_sve_sxtw_d : NULL, a, 0) | ||
160 | +TRANS_FEAT(UXTW, aa64_sve, gen_gvec_ool_arg_zpz, | ||
161 | + a->esz == 3 ? gen_helper_sve_uxtw_d : NULL, a, 0) | ||
162 | |||
163 | /* | ||
164 | *** SVE Integer Reduction Group | ||
165 | @@ -XXX,XX +XXX,XX @@ TRANS_FEAT(TRN2_q, aa64_sve_f64mm, gen_gvec_ool_arg_zzz, | ||
166 | *** SVE Permute Vector - Predicated Group | ||
167 | */ | ||
168 | |||
169 | -static bool trans_COMPACT(DisasContext *s, arg_rpr_esz *a) | ||
170 | -{ | ||
171 | - static gen_helper_gvec_3 * const fns[4] = { | ||
172 | - NULL, NULL, gen_helper_sve_compact_s, gen_helper_sve_compact_d | ||
173 | - }; | ||
174 | - return gen_gvec_ool_arg_zpz(s, fns[a->esz], a, 0); | ||
175 | -} | ||
176 | +static gen_helper_gvec_3 * const compact_fns[4] = { | ||
177 | + NULL, NULL, gen_helper_sve_compact_s, gen_helper_sve_compact_d | ||
178 | +}; | ||
179 | +TRANS_FEAT(COMPACT, aa64_sve, gen_gvec_ool_arg_zpz, compact_fns[a->esz], a, 0) | ||
180 | |||
181 | /* Call the helper that computes the ARM LastActiveElement pseudocode | ||
182 | * function, scaled by the element size. This includes the not found | ||
183 | @@ -XXX,XX +XXX,XX @@ static bool trans_CPY_m_v(DisasContext *s, arg_rpr_esz *a) | ||
184 | return true; | ||
185 | } | ||
186 | |||
187 | -static bool trans_REVB(DisasContext *s, arg_rpr_esz *a) | ||
188 | -{ | ||
189 | - static gen_helper_gvec_3 * const fns[4] = { | ||
190 | - NULL, | ||
191 | - gen_helper_sve_revb_h, | ||
192 | - gen_helper_sve_revb_s, | ||
193 | - gen_helper_sve_revb_d, | ||
194 | - }; | ||
195 | - return gen_gvec_ool_arg_zpz(s, fns[a->esz], a, 0); | ||
196 | -} | ||
197 | +static gen_helper_gvec_3 * const revb_fns[4] = { | ||
198 | + NULL, gen_helper_sve_revb_h, | ||
199 | + gen_helper_sve_revb_s, gen_helper_sve_revb_d, | ||
200 | +}; | ||
201 | +TRANS_FEAT(REVB, aa64_sve, gen_gvec_ool_arg_zpz, revb_fns[a->esz], a, 0) | ||
202 | |||
203 | -static bool trans_REVH(DisasContext *s, arg_rpr_esz *a) | ||
204 | -{ | ||
205 | - static gen_helper_gvec_3 * const fns[4] = { | ||
206 | - NULL, | ||
207 | - NULL, | ||
208 | - gen_helper_sve_revh_s, | ||
209 | - gen_helper_sve_revh_d, | ||
210 | - }; | ||
211 | - return gen_gvec_ool_arg_zpz(s, fns[a->esz], a, 0); | ||
212 | -} | ||
213 | +static gen_helper_gvec_3 * const revh_fns[4] = { | ||
214 | + NULL, NULL, gen_helper_sve_revh_s, gen_helper_sve_revh_d, | ||
215 | +}; | ||
216 | +TRANS_FEAT(REVH, aa64_sve, gen_gvec_ool_arg_zpz, revh_fns[a->esz], a, 0) | ||
217 | |||
218 | -static bool trans_REVW(DisasContext *s, arg_rpr_esz *a) | ||
219 | -{ | ||
220 | - return gen_gvec_ool_arg_zpz(s, a->esz == 3 ? gen_helper_sve_revw_d | ||
221 | - : NULL, a, 0); | ||
222 | -} | ||
223 | - | ||
224 | -static bool trans_RBIT(DisasContext *s, arg_rpr_esz *a) | ||
225 | -{ | ||
226 | - static gen_helper_gvec_3 * const fns[4] = { | ||
227 | - gen_helper_sve_rbit_b, | ||
228 | - gen_helper_sve_rbit_h, | ||
229 | - gen_helper_sve_rbit_s, | ||
230 | - gen_helper_sve_rbit_d, | ||
231 | - }; | ||
232 | - return gen_gvec_ool_arg_zpz(s, fns[a->esz], a, 0); | ||
233 | -} | ||
234 | +TRANS_FEAT(REVW, aa64_sve, gen_gvec_ool_arg_zpz, | ||
235 | + a->esz == 3 ? gen_helper_sve_revw_d : NULL, a, 0) | ||
236 | |||
237 | static bool trans_SPLICE(DisasContext *s, arg_rprr_esz *a) | ||
238 | { | ||
239 | -- | ||
240 | 2.25.1 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | Convert SVE translation functions using do_sve2_zpz_data | ||
4 | to use TRANS_FEAT and gen_gvec_ool_arg_zpz. | ||
5 | |||
6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Message-id: 20220527181907.189259-23-richard.henderson@linaro.org | ||
8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | --- | ||
11 | target/arm/translate-sve.c | 53 ++++++++++---------------------------- | ||
12 | 1 file changed, 14 insertions(+), 39 deletions(-) | ||
13 | |||
14 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c | ||
15 | index XXXXXXX..XXXXXXX 100644 | ||
16 | --- a/target/arm/translate-sve.c | ||
17 | +++ b/target/arm/translate-sve.c | ||
18 | @@ -XXX,XX +XXX,XX @@ static bool trans_UADALP_zpzz(DisasContext *s, arg_rprr_esz *a) | ||
19 | * SVE2 integer unary operations (predicated) | ||
20 | */ | ||
21 | |||
22 | -static bool do_sve2_zpz_ool(DisasContext *s, arg_rpr_esz *a, | ||
23 | - gen_helper_gvec_3 *fn) | ||
24 | -{ | ||
25 | - if (!dc_isar_feature(aa64_sve2, s)) { | ||
26 | - return false; | ||
27 | - } | ||
28 | - return gen_gvec_ool_arg_zpz(s, fn, a, 0); | ||
29 | -} | ||
30 | +TRANS_FEAT(URECPE, aa64_sve2, gen_gvec_ool_arg_zpz, | ||
31 | + a->esz == 2 ? gen_helper_sve2_urecpe_s : NULL, a, 0) | ||
32 | |||
33 | -static bool trans_URECPE(DisasContext *s, arg_rpr_esz *a) | ||
34 | -{ | ||
35 | - if (a->esz != 2) { | ||
36 | - return false; | ||
37 | - } | ||
38 | - return do_sve2_zpz_ool(s, a, gen_helper_sve2_urecpe_s); | ||
39 | -} | ||
40 | +TRANS_FEAT(URSQRTE, aa64_sve2, gen_gvec_ool_arg_zpz, | ||
41 | + a->esz == 2 ? gen_helper_sve2_ursqrte_s : NULL, a, 0) | ||
42 | |||
43 | -static bool trans_URSQRTE(DisasContext *s, arg_rpr_esz *a) | ||
44 | -{ | ||
45 | - if (a->esz != 2) { | ||
46 | - return false; | ||
47 | - } | ||
48 | - return do_sve2_zpz_ool(s, a, gen_helper_sve2_ursqrte_s); | ||
49 | -} | ||
50 | +static gen_helper_gvec_3 * const sqabs_fns[4] = { | ||
51 | + gen_helper_sve2_sqabs_b, gen_helper_sve2_sqabs_h, | ||
52 | + gen_helper_sve2_sqabs_s, gen_helper_sve2_sqabs_d, | ||
53 | +}; | ||
54 | +TRANS_FEAT(SQABS, aa64_sve2, gen_gvec_ool_arg_zpz, sqabs_fns[a->esz], a, 0) | ||
55 | |||
56 | -static bool trans_SQABS(DisasContext *s, arg_rpr_esz *a) | ||
57 | -{ | ||
58 | - static gen_helper_gvec_3 * const fns[4] = { | ||
59 | - gen_helper_sve2_sqabs_b, gen_helper_sve2_sqabs_h, | ||
60 | - gen_helper_sve2_sqabs_s, gen_helper_sve2_sqabs_d, | ||
61 | - }; | ||
62 | - return do_sve2_zpz_ool(s, a, fns[a->esz]); | ||
63 | -} | ||
64 | - | ||
65 | -static bool trans_SQNEG(DisasContext *s, arg_rpr_esz *a) | ||
66 | -{ | ||
67 | - static gen_helper_gvec_3 * const fns[4] = { | ||
68 | - gen_helper_sve2_sqneg_b, gen_helper_sve2_sqneg_h, | ||
69 | - gen_helper_sve2_sqneg_s, gen_helper_sve2_sqneg_d, | ||
70 | - }; | ||
71 | - return do_sve2_zpz_ool(s, a, fns[a->esz]); | ||
72 | -} | ||
73 | +static gen_helper_gvec_3 * const sqneg_fns[4] = { | ||
74 | + gen_helper_sve2_sqneg_b, gen_helper_sve2_sqneg_h, | ||
75 | + gen_helper_sve2_sqneg_s, gen_helper_sve2_sqneg_d, | ||
76 | +}; | ||
77 | +TRANS_FEAT(SQNEG, aa64_sve2, gen_gvec_ool_arg_zpz, sqneg_fns[a->esz], a, 0) | ||
78 | |||
79 | #define DO_SVE2_ZPZZ(NAME, name) \ | ||
80 | static bool trans_##NAME(DisasContext *s, arg_rprr_esz *a) \ | ||
81 | -- | ||
82 | 2.25.1 | diff view generated by jsdifflib |
1 | From: Maxim Uvarov <maxim.uvarov@linaro.org> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | No functional change. Just refactor code to better | 3 | Rename the function to match gen_gvec_ool_arg_zpz, |
4 | support secure and normal world gpios. | 4 | and move to be adjacent. |
5 | 5 | ||
6 | Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org> | 6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
7 | Reviewed-by: Andrew Jones <drjones@redhat.com> | 7 | Message-id: 20220527181907.189259-24-richard.henderson@linaro.org |
8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
9 | --- | 10 | --- |
10 | hw/arm/virt.c | 57 ++++++++++++++++++++++++++++++++------------------- | 11 | target/arm/translate-sve.c | 29 ++++++++++++++--------------- |
11 | 1 file changed, 36 insertions(+), 21 deletions(-) | 12 | 1 file changed, 14 insertions(+), 15 deletions(-) |
12 | 13 | ||
13 | diff --git a/hw/arm/virt.c b/hw/arm/virt.c | 14 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c |
14 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/hw/arm/virt.c | 16 | --- a/target/arm/translate-sve.c |
16 | +++ b/hw/arm/virt.c | 17 | +++ b/target/arm/translate-sve.c |
17 | @@ -XXX,XX +XXX,XX @@ static void virt_powerdown_req(Notifier *n, void *opaque) | 18 | @@ -XXX,XX +XXX,XX @@ static bool gen_gvec_ool_arg_zpz(DisasContext *s, gen_helper_gvec_3 *fn, |
19 | return gen_gvec_ool_zzp(s, fn, a->rd, a->rn, a->pg, data); | ||
20 | } | ||
21 | |||
22 | +static bool gen_gvec_ool_arg_zpzi(DisasContext *s, gen_helper_gvec_3 *fn, | ||
23 | + arg_rpri_esz *a) | ||
24 | +{ | ||
25 | + return gen_gvec_ool_zzp(s, fn, a->rd, a->rn, a->pg, a->imm); | ||
26 | +} | ||
27 | |||
28 | /* Invoke an out-of-line helper on 3 Zregs and a predicate. */ | ||
29 | static void gen_gvec_ool_zzzp(DisasContext *s, gen_helper_gvec_4 *fn, | ||
30 | @@ -XXX,XX +XXX,XX @@ static bool do_movz_zpz(DisasContext *s, int rd, int rn, int pg, | ||
31 | return gen_gvec_ool_zzp(s, fns[esz], rd, rn, pg, invert); | ||
32 | } | ||
33 | |||
34 | -static bool do_zpzi_ool(DisasContext *s, arg_rpri_esz *a, | ||
35 | - gen_helper_gvec_3 *fn) | ||
36 | -{ | ||
37 | - return gen_gvec_ool_zzp(s, fn, a->rd, a->rn, a->pg, a->imm); | ||
38 | -} | ||
39 | - | ||
40 | static bool trans_ASR_zpzi(DisasContext *s, arg_rpri_esz *a) | ||
41 | { | ||
42 | static gen_helper_gvec_3 * const fns[4] = { | ||
43 | @@ -XXX,XX +XXX,XX @@ static bool trans_ASR_zpzi(DisasContext *s, arg_rpri_esz *a) | ||
44 | /* Shift by element size is architecturally valid. For | ||
45 | arithmetic right-shift, it's the same as by one less. */ | ||
46 | a->imm = MIN(a->imm, (8 << a->esz) - 1); | ||
47 | - return do_zpzi_ool(s, a, fns[a->esz]); | ||
48 | + return gen_gvec_ool_arg_zpzi(s, fns[a->esz], a); | ||
49 | } | ||
50 | |||
51 | static bool trans_LSR_zpzi(DisasContext *s, arg_rpri_esz *a) | ||
52 | @@ -XXX,XX +XXX,XX @@ static bool trans_LSR_zpzi(DisasContext *s, arg_rpri_esz *a) | ||
53 | if (a->imm >= (8 << a->esz)) { | ||
54 | return do_movz_zpz(s, a->rd, a->rd, a->pg, a->esz, true); | ||
55 | } else { | ||
56 | - return do_zpzi_ool(s, a, fns[a->esz]); | ||
57 | + return gen_gvec_ool_arg_zpzi(s, fns[a->esz], a); | ||
18 | } | 58 | } |
19 | } | 59 | } |
20 | 60 | ||
21 | -static void create_gpio(const VirtMachineState *vms) | 61 | @@ -XXX,XX +XXX,XX @@ static bool trans_LSL_zpzi(DisasContext *s, arg_rpri_esz *a) |
22 | +static void create_gpio_keys(const VirtMachineState *vms, | 62 | if (a->imm >= (8 << a->esz)) { |
23 | + DeviceState *pl061_dev, | 63 | return do_movz_zpz(s, a->rd, a->rd, a->pg, a->esz, true); |
24 | + uint32_t phandle) | 64 | } else { |
25 | +{ | 65 | - return do_zpzi_ool(s, a, fns[a->esz]); |
26 | + gpio_key_dev = sysbus_create_simple("gpio-key", -1, | 66 | + return gen_gvec_ool_arg_zpzi(s, fns[a->esz], a); |
27 | + qdev_get_gpio_in(pl061_dev, 3)); | 67 | } |
28 | + | ||
29 | + qemu_fdt_add_subnode(vms->fdt, "/gpio-keys"); | ||
30 | + qemu_fdt_setprop_string(vms->fdt, "/gpio-keys", "compatible", "gpio-keys"); | ||
31 | + qemu_fdt_setprop_cell(vms->fdt, "/gpio-keys", "#size-cells", 0); | ||
32 | + qemu_fdt_setprop_cell(vms->fdt, "/gpio-keys", "#address-cells", 1); | ||
33 | + | ||
34 | + qemu_fdt_add_subnode(vms->fdt, "/gpio-keys/poweroff"); | ||
35 | + qemu_fdt_setprop_string(vms->fdt, "/gpio-keys/poweroff", | ||
36 | + "label", "GPIO Key Poweroff"); | ||
37 | + qemu_fdt_setprop_cell(vms->fdt, "/gpio-keys/poweroff", "linux,code", | ||
38 | + KEY_POWER); | ||
39 | + qemu_fdt_setprop_cells(vms->fdt, "/gpio-keys/poweroff", | ||
40 | + "gpios", phandle, 3, 0); | ||
41 | +} | ||
42 | + | ||
43 | +static void create_gpio_devices(const VirtMachineState *vms, int gpio, | ||
44 | + MemoryRegion *mem) | ||
45 | { | ||
46 | char *nodename; | ||
47 | DeviceState *pl061_dev; | ||
48 | - hwaddr base = vms->memmap[VIRT_GPIO].base; | ||
49 | - hwaddr size = vms->memmap[VIRT_GPIO].size; | ||
50 | - int irq = vms->irqmap[VIRT_GPIO]; | ||
51 | + hwaddr base = vms->memmap[gpio].base; | ||
52 | + hwaddr size = vms->memmap[gpio].size; | ||
53 | + int irq = vms->irqmap[gpio]; | ||
54 | const char compat[] = "arm,pl061\0arm,primecell"; | ||
55 | + SysBusDevice *s; | ||
56 | |||
57 | - pl061_dev = sysbus_create_simple("pl061", base, | ||
58 | - qdev_get_gpio_in(vms->gic, irq)); | ||
59 | + pl061_dev = qdev_new("pl061"); | ||
60 | + s = SYS_BUS_DEVICE(pl061_dev); | ||
61 | + sysbus_realize_and_unref(s, &error_fatal); | ||
62 | + memory_region_add_subregion(mem, base, sysbus_mmio_get_region(s, 0)); | ||
63 | + sysbus_connect_irq(s, 0, qdev_get_gpio_in(vms->gic, irq)); | ||
64 | |||
65 | uint32_t phandle = qemu_fdt_alloc_phandle(vms->fdt); | ||
66 | nodename = g_strdup_printf("/pl061@%" PRIx64, base); | ||
67 | @@ -XXX,XX +XXX,XX @@ static void create_gpio(const VirtMachineState *vms) | ||
68 | qemu_fdt_setprop_string(vms->fdt, nodename, "clock-names", "apb_pclk"); | ||
69 | qemu_fdt_setprop_cell(vms->fdt, nodename, "phandle", phandle); | ||
70 | |||
71 | - gpio_key_dev = sysbus_create_simple("gpio-key", -1, | ||
72 | - qdev_get_gpio_in(pl061_dev, 3)); | ||
73 | - qemu_fdt_add_subnode(vms->fdt, "/gpio-keys"); | ||
74 | - qemu_fdt_setprop_string(vms->fdt, "/gpio-keys", "compatible", "gpio-keys"); | ||
75 | - qemu_fdt_setprop_cell(vms->fdt, "/gpio-keys", "#size-cells", 0); | ||
76 | - qemu_fdt_setprop_cell(vms->fdt, "/gpio-keys", "#address-cells", 1); | ||
77 | - | ||
78 | - qemu_fdt_add_subnode(vms->fdt, "/gpio-keys/poweroff"); | ||
79 | - qemu_fdt_setprop_string(vms->fdt, "/gpio-keys/poweroff", | ||
80 | - "label", "GPIO Key Poweroff"); | ||
81 | - qemu_fdt_setprop_cell(vms->fdt, "/gpio-keys/poweroff", "linux,code", | ||
82 | - KEY_POWER); | ||
83 | - qemu_fdt_setprop_cells(vms->fdt, "/gpio-keys/poweroff", | ||
84 | - "gpios", phandle, 3, 0); | ||
85 | g_free(nodename); | ||
86 | + | ||
87 | + /* Child gpio devices */ | ||
88 | + create_gpio_keys(vms, pl061_dev, phandle); | ||
89 | } | 68 | } |
90 | 69 | ||
91 | static void create_virtio_devices(const VirtMachineState *vms) | 70 | @@ -XXX,XX +XXX,XX @@ static bool trans_ASRD(DisasContext *s, arg_rpri_esz *a) |
92 | @@ -XXX,XX +XXX,XX @@ static void machvirt_init(MachineState *machine) | 71 | if (a->imm >= (8 << a->esz)) { |
93 | if (has_ged && aarch64 && firmware_loaded && virt_is_acpi_enabled(vms)) { | 72 | return do_movz_zpz(s, a->rd, a->rd, a->pg, a->esz, true); |
94 | vms->acpi_dev = create_acpi_ged(vms); | ||
95 | } else { | 73 | } else { |
96 | - create_gpio(vms); | 74 | - return do_zpzi_ool(s, a, fns[a->esz]); |
97 | + create_gpio_devices(vms, VIRT_GPIO, sysmem); | 75 | + return gen_gvec_ool_arg_zpzi(s, fns[a->esz], a); |
98 | } | 76 | } |
99 | 77 | } | |
100 | /* connect powerdown request */ | 78 | |
79 | @@ -XXX,XX +XXX,XX @@ static bool trans_SQSHL_zpzi(DisasContext *s, arg_rpri_esz *a) | ||
80 | if (a->esz < 0 || !dc_isar_feature(aa64_sve2, s)) { | ||
81 | return false; | ||
82 | } | ||
83 | - return do_zpzi_ool(s, a, fns[a->esz]); | ||
84 | + return gen_gvec_ool_arg_zpzi(s, fns[a->esz], a); | ||
85 | } | ||
86 | |||
87 | static bool trans_UQSHL_zpzi(DisasContext *s, arg_rpri_esz *a) | ||
88 | @@ -XXX,XX +XXX,XX @@ static bool trans_UQSHL_zpzi(DisasContext *s, arg_rpri_esz *a) | ||
89 | if (a->esz < 0 || !dc_isar_feature(aa64_sve2, s)) { | ||
90 | return false; | ||
91 | } | ||
92 | - return do_zpzi_ool(s, a, fns[a->esz]); | ||
93 | + return gen_gvec_ool_arg_zpzi(s, fns[a->esz], a); | ||
94 | } | ||
95 | |||
96 | static bool trans_SRSHR(DisasContext *s, arg_rpri_esz *a) | ||
97 | @@ -XXX,XX +XXX,XX @@ static bool trans_SRSHR(DisasContext *s, arg_rpri_esz *a) | ||
98 | if (a->esz < 0 || !dc_isar_feature(aa64_sve2, s)) { | ||
99 | return false; | ||
100 | } | ||
101 | - return do_zpzi_ool(s, a, fns[a->esz]); | ||
102 | + return gen_gvec_ool_arg_zpzi(s, fns[a->esz], a); | ||
103 | } | ||
104 | |||
105 | static bool trans_URSHR(DisasContext *s, arg_rpri_esz *a) | ||
106 | @@ -XXX,XX +XXX,XX @@ static bool trans_URSHR(DisasContext *s, arg_rpri_esz *a) | ||
107 | if (a->esz < 0 || !dc_isar_feature(aa64_sve2, s)) { | ||
108 | return false; | ||
109 | } | ||
110 | - return do_zpzi_ool(s, a, fns[a->esz]); | ||
111 | + return gen_gvec_ool_arg_zpzi(s, fns[a->esz], a); | ||
112 | } | ||
113 | |||
114 | static bool trans_SQSHLU(DisasContext *s, arg_rpri_esz *a) | ||
115 | @@ -XXX,XX +XXX,XX @@ static bool trans_SQSHLU(DisasContext *s, arg_rpri_esz *a) | ||
116 | if (a->esz < 0 || !dc_isar_feature(aa64_sve2, s)) { | ||
117 | return false; | ||
118 | } | ||
119 | - return do_zpzi_ool(s, a, fns[a->esz]); | ||
120 | + return gen_gvec_ool_arg_zpzi(s, fns[a->esz], a); | ||
121 | } | ||
122 | |||
123 | /* | ||
101 | -- | 124 | -- |
102 | 2.20.1 | 125 | 2.25.1 |
103 | |||
104 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | Convert some SVE translation functions using | ||
4 | gen_gvec_ool_arg_zpzi to TRANS_FEAT. | ||
5 | |||
6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Message-id: 20220527181907.189259-25-richard.henderson@linaro.org | ||
8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | --- | ||
11 | target/arm/translate-sve.c | 85 ++++++++++++++------------------------ | ||
12 | 1 file changed, 30 insertions(+), 55 deletions(-) | ||
13 | |||
14 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c | ||
15 | index XXXXXXX..XXXXXXX 100644 | ||
16 | --- a/target/arm/translate-sve.c | ||
17 | +++ b/target/arm/translate-sve.c | ||
18 | @@ -XXX,XX +XXX,XX @@ static bool trans_ASRD(DisasContext *s, arg_rpri_esz *a) | ||
19 | } | ||
20 | } | ||
21 | |||
22 | -static bool trans_SQSHL_zpzi(DisasContext *s, arg_rpri_esz *a) | ||
23 | -{ | ||
24 | - static gen_helper_gvec_3 * const fns[4] = { | ||
25 | - gen_helper_sve2_sqshl_zpzi_b, gen_helper_sve2_sqshl_zpzi_h, | ||
26 | - gen_helper_sve2_sqshl_zpzi_s, gen_helper_sve2_sqshl_zpzi_d, | ||
27 | - }; | ||
28 | - if (a->esz < 0 || !dc_isar_feature(aa64_sve2, s)) { | ||
29 | - return false; | ||
30 | - } | ||
31 | - return gen_gvec_ool_arg_zpzi(s, fns[a->esz], a); | ||
32 | -} | ||
33 | +static gen_helper_gvec_3 * const sqshl_zpzi_fns[4] = { | ||
34 | + gen_helper_sve2_sqshl_zpzi_b, gen_helper_sve2_sqshl_zpzi_h, | ||
35 | + gen_helper_sve2_sqshl_zpzi_s, gen_helper_sve2_sqshl_zpzi_d, | ||
36 | +}; | ||
37 | +TRANS_FEAT(SQSHL_zpzi, aa64_sve2, gen_gvec_ool_arg_zpzi, | ||
38 | + a->esz < 0 ? NULL : sqshl_zpzi_fns[a->esz], a) | ||
39 | |||
40 | -static bool trans_UQSHL_zpzi(DisasContext *s, arg_rpri_esz *a) | ||
41 | -{ | ||
42 | - static gen_helper_gvec_3 * const fns[4] = { | ||
43 | - gen_helper_sve2_uqshl_zpzi_b, gen_helper_sve2_uqshl_zpzi_h, | ||
44 | - gen_helper_sve2_uqshl_zpzi_s, gen_helper_sve2_uqshl_zpzi_d, | ||
45 | - }; | ||
46 | - if (a->esz < 0 || !dc_isar_feature(aa64_sve2, s)) { | ||
47 | - return false; | ||
48 | - } | ||
49 | - return gen_gvec_ool_arg_zpzi(s, fns[a->esz], a); | ||
50 | -} | ||
51 | +static gen_helper_gvec_3 * const uqshl_zpzi_fns[4] = { | ||
52 | + gen_helper_sve2_uqshl_zpzi_b, gen_helper_sve2_uqshl_zpzi_h, | ||
53 | + gen_helper_sve2_uqshl_zpzi_s, gen_helper_sve2_uqshl_zpzi_d, | ||
54 | +}; | ||
55 | +TRANS_FEAT(UQSHL_zpzi, aa64_sve2, gen_gvec_ool_arg_zpzi, | ||
56 | + a->esz < 0 ? NULL : uqshl_zpzi_fns[a->esz], a) | ||
57 | |||
58 | -static bool trans_SRSHR(DisasContext *s, arg_rpri_esz *a) | ||
59 | -{ | ||
60 | - static gen_helper_gvec_3 * const fns[4] = { | ||
61 | - gen_helper_sve2_srshr_b, gen_helper_sve2_srshr_h, | ||
62 | - gen_helper_sve2_srshr_s, gen_helper_sve2_srshr_d, | ||
63 | - }; | ||
64 | - if (a->esz < 0 || !dc_isar_feature(aa64_sve2, s)) { | ||
65 | - return false; | ||
66 | - } | ||
67 | - return gen_gvec_ool_arg_zpzi(s, fns[a->esz], a); | ||
68 | -} | ||
69 | +static gen_helper_gvec_3 * const srshr_fns[4] = { | ||
70 | + gen_helper_sve2_srshr_b, gen_helper_sve2_srshr_h, | ||
71 | + gen_helper_sve2_srshr_s, gen_helper_sve2_srshr_d, | ||
72 | +}; | ||
73 | +TRANS_FEAT(SRSHR, aa64_sve2, gen_gvec_ool_arg_zpzi, | ||
74 | + a->esz < 0 ? NULL : srshr_fns[a->esz], a) | ||
75 | |||
76 | -static bool trans_URSHR(DisasContext *s, arg_rpri_esz *a) | ||
77 | -{ | ||
78 | - static gen_helper_gvec_3 * const fns[4] = { | ||
79 | - gen_helper_sve2_urshr_b, gen_helper_sve2_urshr_h, | ||
80 | - gen_helper_sve2_urshr_s, gen_helper_sve2_urshr_d, | ||
81 | - }; | ||
82 | - if (a->esz < 0 || !dc_isar_feature(aa64_sve2, s)) { | ||
83 | - return false; | ||
84 | - } | ||
85 | - return gen_gvec_ool_arg_zpzi(s, fns[a->esz], a); | ||
86 | -} | ||
87 | +static gen_helper_gvec_3 * const urshr_fns[4] = { | ||
88 | + gen_helper_sve2_urshr_b, gen_helper_sve2_urshr_h, | ||
89 | + gen_helper_sve2_urshr_s, gen_helper_sve2_urshr_d, | ||
90 | +}; | ||
91 | +TRANS_FEAT(URSHR, aa64_sve2, gen_gvec_ool_arg_zpzi, | ||
92 | + a->esz < 0 ? NULL : urshr_fns[a->esz], a) | ||
93 | |||
94 | -static bool trans_SQSHLU(DisasContext *s, arg_rpri_esz *a) | ||
95 | -{ | ||
96 | - static gen_helper_gvec_3 * const fns[4] = { | ||
97 | - gen_helper_sve2_sqshlu_b, gen_helper_sve2_sqshlu_h, | ||
98 | - gen_helper_sve2_sqshlu_s, gen_helper_sve2_sqshlu_d, | ||
99 | - }; | ||
100 | - if (a->esz < 0 || !dc_isar_feature(aa64_sve2, s)) { | ||
101 | - return false; | ||
102 | - } | ||
103 | - return gen_gvec_ool_arg_zpzi(s, fns[a->esz], a); | ||
104 | -} | ||
105 | +static gen_helper_gvec_3 * const sqshlu_fns[4] = { | ||
106 | + gen_helper_sve2_sqshlu_b, gen_helper_sve2_sqshlu_h, | ||
107 | + gen_helper_sve2_sqshlu_s, gen_helper_sve2_sqshlu_d, | ||
108 | +}; | ||
109 | +TRANS_FEAT(SQSHLU, aa64_sve2, gen_gvec_ool_arg_zpzi, | ||
110 | + a->esz < 0 ? NULL : sqshlu_fns[a->esz], a) | ||
111 | |||
112 | /* | ||
113 | *** SVE Bitwise Shift - Predicated Group | ||
114 | -- | ||
115 | 2.25.1 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
4 | Message-id: 20220527181907.189259-26-richard.henderson@linaro.org | ||
5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | --- | ||
8 | target/arm/translate-sve.c | 42 ++++++++++++++++---------------------- | ||
9 | 1 file changed, 18 insertions(+), 24 deletions(-) | ||
10 | |||
11 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c | ||
12 | index XXXXXXX..XXXXXXX 100644 | ||
13 | --- a/target/arm/translate-sve.c | ||
14 | +++ b/target/arm/translate-sve.c | ||
15 | @@ -XXX,XX +XXX,XX @@ static bool gen_gvec_ool_arg_zpzi(DisasContext *s, gen_helper_gvec_3 *fn, | ||
16 | } | ||
17 | |||
18 | /* Invoke an out-of-line helper on 3 Zregs and a predicate. */ | ||
19 | -static void gen_gvec_ool_zzzp(DisasContext *s, gen_helper_gvec_4 *fn, | ||
20 | +static bool gen_gvec_ool_zzzp(DisasContext *s, gen_helper_gvec_4 *fn, | ||
21 | int rd, int rn, int rm, int pg, int data) | ||
22 | { | ||
23 | - unsigned vsz = vec_full_reg_size(s); | ||
24 | - tcg_gen_gvec_4_ool(vec_full_reg_offset(s, rd), | ||
25 | - vec_full_reg_offset(s, rn), | ||
26 | - vec_full_reg_offset(s, rm), | ||
27 | - pred_full_reg_offset(s, pg), | ||
28 | - vsz, vsz, data, fn); | ||
29 | + if (fn == NULL) { | ||
30 | + return false; | ||
31 | + } | ||
32 | + if (sve_access_check(s)) { | ||
33 | + unsigned vsz = vec_full_reg_size(s); | ||
34 | + tcg_gen_gvec_4_ool(vec_full_reg_offset(s, rd), | ||
35 | + vec_full_reg_offset(s, rn), | ||
36 | + vec_full_reg_offset(s, rm), | ||
37 | + pred_full_reg_offset(s, pg), | ||
38 | + vsz, vsz, data, fn); | ||
39 | + } | ||
40 | + return true; | ||
41 | } | ||
42 | |||
43 | /* Invoke a vector expander on two Zregs. */ | ||
44 | @@ -XXX,XX +XXX,XX @@ static bool trans_UQSUB_zzz(DisasContext *s, arg_rrr_esz *a) | ||
45 | |||
46 | static bool do_zpzz_ool(DisasContext *s, arg_rprr_esz *a, gen_helper_gvec_4 *fn) | ||
47 | { | ||
48 | - if (fn == NULL) { | ||
49 | - return false; | ||
50 | - } | ||
51 | - if (sve_access_check(s)) { | ||
52 | - gen_gvec_ool_zzzp(s, fn, a->rd, a->rn, a->rm, a->pg, 0); | ||
53 | - } | ||
54 | - return true; | ||
55 | + return gen_gvec_ool_zzzp(s, fn, a->rd, a->rn, a->rm, a->pg, 0); | ||
56 | } | ||
57 | |||
58 | /* Select active elememnts from Zn and inactive elements from Zm, | ||
59 | @@ -XXX,XX +XXX,XX @@ TRANS_FEAT(REVW, aa64_sve, gen_gvec_ool_arg_zpz, | ||
60 | |||
61 | static bool trans_SPLICE(DisasContext *s, arg_rprr_esz *a) | ||
62 | { | ||
63 | - if (sve_access_check(s)) { | ||
64 | - gen_gvec_ool_zzzp(s, gen_helper_sve_splice, | ||
65 | - a->rd, a->rn, a->rm, a->pg, a->esz); | ||
66 | - } | ||
67 | - return true; | ||
68 | + return gen_gvec_ool_zzzp(s, gen_helper_sve_splice, | ||
69 | + a->rd, a->rn, a->rm, a->pg, a->esz); | ||
70 | } | ||
71 | |||
72 | static bool trans_SPLICE_sve2(DisasContext *s, arg_rpr_esz *a) | ||
73 | @@ -XXX,XX +XXX,XX @@ static bool trans_SPLICE_sve2(DisasContext *s, arg_rpr_esz *a) | ||
74 | if (!dc_isar_feature(aa64_sve2, s)) { | ||
75 | return false; | ||
76 | } | ||
77 | - if (sve_access_check(s)) { | ||
78 | - gen_gvec_ool_zzzp(s, gen_helper_sve_splice, | ||
79 | - a->rd, a->rn, (a->rn + 1) % 32, a->pg, a->esz); | ||
80 | - } | ||
81 | - return true; | ||
82 | + return gen_gvec_ool_zzzp(s, gen_helper_sve_splice, | ||
83 | + a->rd, a->rn, (a->rn + 1) % 32, a->pg, a->esz); | ||
84 | } | ||
85 | |||
86 | /* | ||
87 | -- | ||
88 | 2.25.1 | diff view generated by jsdifflib |
1 | Add a function for checking whether a clock has a source. This is | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | useful for devices which have input clocks that must be wired up by | ||
3 | the board as it allows them to fail in realize rather than ploughing | ||
4 | on with a zero-period clock. | ||
5 | 2 | ||
3 | Use gen_gvec_ool_arg_zpzz instead of gen_gvec_ool_zzzp | ||
4 | when the arguments come from arg_rprr_esz. | ||
5 | Replaces do_zpzz_ool. | ||
6 | |||
7 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
8 | Message-id: 20220527181907.189259-27-richard.henderson@linaro.org | ||
9 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
7 | Reviewed-by: Luc Michel <luc@lmichel.fr> | ||
8 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
9 | Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
10 | Message-id: 20210128114145.20536-3-peter.maydell@linaro.org | ||
11 | Message-id: 20210121190622.22000-3-peter.maydell@linaro.org | ||
12 | --- | 11 | --- |
13 | docs/devel/clocks.rst | 16 ++++++++++++++++ | 12 | target/arm/translate-sve.c | 21 +++++++++++---------- |
14 | include/hw/clock.h | 15 +++++++++++++++ | 13 | 1 file changed, 11 insertions(+), 10 deletions(-) |
15 | 2 files changed, 31 insertions(+) | ||
16 | 14 | ||
17 | diff --git a/docs/devel/clocks.rst b/docs/devel/clocks.rst | 15 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c |
18 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
19 | --- a/docs/devel/clocks.rst | 17 | --- a/target/arm/translate-sve.c |
20 | +++ b/docs/devel/clocks.rst | 18 | +++ b/target/arm/translate-sve.c |
21 | @@ -XXX,XX +XXX,XX @@ object during device instance init. For example: | 19 | @@ -XXX,XX +XXX,XX @@ static bool gen_gvec_ool_zzzp(DisasContext *s, gen_helper_gvec_4 *fn, |
22 | /* set initial value to 10ns / 100MHz */ | 20 | return true; |
23 | clock_set_ns(clk, 10); | 21 | } |
24 | 22 | ||
25 | +To enforce that the clock is wired up by the board code, you can | 23 | +static bool gen_gvec_ool_arg_zpzz(DisasContext *s, gen_helper_gvec_4 *fn, |
26 | +call ``clock_has_source()`` in your device's realize method: | 24 | + arg_rprr_esz *a, int data) |
27 | + | ||
28 | +.. code-block:: c | ||
29 | + | ||
30 | + if (!clock_has_source(s->clk)) { | ||
31 | + error_setg(errp, "MyDevice: clk input must be connected"); | ||
32 | + return; | ||
33 | + } | ||
34 | + | ||
35 | +Note that this only checks that the clock has been wired up; it is | ||
36 | +still possible that the output clock connected to it is disabled | ||
37 | +or has not yet been configured, in which case the period will be | ||
38 | +zero. You should use the clock callback to find out when the clock | ||
39 | +period changes. | ||
40 | + | ||
41 | Fetching clock frequency/period | ||
42 | ------------------------------- | ||
43 | |||
44 | diff --git a/include/hw/clock.h b/include/hw/clock.h | ||
45 | index XXXXXXX..XXXXXXX 100644 | ||
46 | --- a/include/hw/clock.h | ||
47 | +++ b/include/hw/clock.h | ||
48 | @@ -XXX,XX +XXX,XX @@ void clock_clear_callback(Clock *clk); | ||
49 | */ | ||
50 | void clock_set_source(Clock *clk, Clock *src); | ||
51 | |||
52 | +/** | ||
53 | + * clock_has_source: | ||
54 | + * @clk: the clock | ||
55 | + * | ||
56 | + * Returns true if the clock has a source clock connected to it. | ||
57 | + * This is useful for devices which have input clocks which must | ||
58 | + * be connected by the board/SoC code which creates them. The | ||
59 | + * device code can use this to check in its realize method that | ||
60 | + * the clock has been connected. | ||
61 | + */ | ||
62 | +static inline bool clock_has_source(const Clock *clk) | ||
63 | +{ | 25 | +{ |
64 | + return clk->source != NULL; | 26 | + return gen_gvec_ool_zzzp(s, fn, a->rd, a->rn, a->rm, a->pg, data); |
65 | +} | 27 | +} |
66 | + | 28 | + |
67 | /** | 29 | /* Invoke a vector expander on two Zregs. */ |
68 | * clock_set: | 30 | static void gen_gvec_fn_zz(DisasContext *s, GVecGen2Fn *gvec_fn, |
69 | * @clk: the clock to initialize. | 31 | int esz, int rd, int rn) |
32 | @@ -XXX,XX +XXX,XX @@ static bool trans_UQSUB_zzz(DisasContext *s, arg_rrr_esz *a) | ||
33 | *** SVE Integer Arithmetic - Binary Predicated Group | ||
34 | */ | ||
35 | |||
36 | -static bool do_zpzz_ool(DisasContext *s, arg_rprr_esz *a, gen_helper_gvec_4 *fn) | ||
37 | -{ | ||
38 | - return gen_gvec_ool_zzzp(s, fn, a->rd, a->rn, a->rm, a->pg, 0); | ||
39 | -} | ||
40 | - | ||
41 | /* Select active elememnts from Zn and inactive elements from Zm, | ||
42 | * storing the result in Zd. | ||
43 | */ | ||
44 | @@ -XXX,XX +XXX,XX @@ static bool trans_##NAME##_zpzz(DisasContext *s, arg_rprr_esz *a) \ | ||
45 | gen_helper_sve_##name##_zpzz_b, gen_helper_sve_##name##_zpzz_h, \ | ||
46 | gen_helper_sve_##name##_zpzz_s, gen_helper_sve_##name##_zpzz_d, \ | ||
47 | }; \ | ||
48 | - return do_zpzz_ool(s, a, fns[a->esz]); \ | ||
49 | + return gen_gvec_ool_arg_zpzz(s, fns[a->esz], a, 0); \ | ||
50 | } | ||
51 | |||
52 | DO_ZPZZ(AND, and) | ||
53 | @@ -XXX,XX +XXX,XX @@ static bool trans_SDIV_zpzz(DisasContext *s, arg_rprr_esz *a) | ||
54 | static gen_helper_gvec_4 * const fns[4] = { | ||
55 | NULL, NULL, gen_helper_sve_sdiv_zpzz_s, gen_helper_sve_sdiv_zpzz_d | ||
56 | }; | ||
57 | - return do_zpzz_ool(s, a, fns[a->esz]); | ||
58 | + return gen_gvec_ool_arg_zpzz(s, fns[a->esz], a, 0); | ||
59 | } | ||
60 | |||
61 | static bool trans_UDIV_zpzz(DisasContext *s, arg_rprr_esz *a) | ||
62 | @@ -XXX,XX +XXX,XX @@ static bool trans_UDIV_zpzz(DisasContext *s, arg_rprr_esz *a) | ||
63 | static gen_helper_gvec_4 * const fns[4] = { | ||
64 | NULL, NULL, gen_helper_sve_udiv_zpzz_s, gen_helper_sve_udiv_zpzz_d | ||
65 | }; | ||
66 | - return do_zpzz_ool(s, a, fns[a->esz]); | ||
67 | + return gen_gvec_ool_arg_zpzz(s, fns[a->esz], a, 0); | ||
68 | } | ||
69 | |||
70 | static bool trans_SEL_zpzz(DisasContext *s, arg_rprr_esz *a) | ||
71 | @@ -XXX,XX +XXX,XX @@ static bool trans_##NAME##_zpzw(DisasContext *s, arg_rprr_esz *a) \ | ||
72 | if (a->esz < 0 || a->esz >= 3) { \ | ||
73 | return false; \ | ||
74 | } \ | ||
75 | - return do_zpzz_ool(s, a, fns[a->esz]); \ | ||
76 | + return gen_gvec_ool_arg_zpzz(s, fns[a->esz], a, 0); \ | ||
77 | } | ||
78 | |||
79 | DO_ZPZW(ASR, asr) | ||
80 | @@ -XXX,XX +XXX,XX @@ static bool do_sve2_zpzz_ool(DisasContext *s, arg_rprr_esz *a, | ||
81 | if (!dc_isar_feature(aa64_sve2, s)) { | ||
82 | return false; | ||
83 | } | ||
84 | - return do_zpzz_ool(s, a, fn); | ||
85 | + return gen_gvec_ool_arg_zpzz(s, fn, a, 0); | ||
86 | } | ||
87 | |||
88 | static bool trans_SADALP_zpzz(DisasContext *s, arg_rprr_esz *a) | ||
70 | -- | 89 | -- |
71 | 2.20.1 | 90 | 2.25.1 |
72 | |||
73 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | Convert SVE translation functions directly using | ||
4 | gen_gvec_ool_arg_zpzz to TRANS_FEAT. | ||
5 | |||
6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Message-id: 20220527181907.189259-28-richard.henderson@linaro.org | ||
8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | --- | ||
11 | target/arm/translate-sve.c | 85 ++++++++++++++++---------------------- | ||
12 | 1 file changed, 36 insertions(+), 49 deletions(-) | ||
13 | |||
14 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c | ||
15 | index XXXXXXX..XXXXXXX 100644 | ||
16 | --- a/target/arm/translate-sve.c | ||
17 | +++ b/target/arm/translate-sve.c | ||
18 | @@ -XXX,XX +XXX,XX @@ static void do_sel_z(DisasContext *s, int rd, int rn, int rm, int pg, int esz) | ||
19 | gen_gvec_ool_zzzp(s, fns[esz], rd, rn, rm, pg, 0); | ||
20 | } | ||
21 | |||
22 | -#define DO_ZPZZ(NAME, name) \ | ||
23 | -static bool trans_##NAME##_zpzz(DisasContext *s, arg_rprr_esz *a) \ | ||
24 | -{ \ | ||
25 | - static gen_helper_gvec_4 * const fns[4] = { \ | ||
26 | - gen_helper_sve_##name##_zpzz_b, gen_helper_sve_##name##_zpzz_h, \ | ||
27 | - gen_helper_sve_##name##_zpzz_s, gen_helper_sve_##name##_zpzz_d, \ | ||
28 | +#define DO_ZPZZ(NAME, FEAT, name) \ | ||
29 | + static gen_helper_gvec_4 * const name##_zpzz_fns[4] = { \ | ||
30 | + gen_helper_##name##_zpzz_b, gen_helper_##name##_zpzz_h, \ | ||
31 | + gen_helper_##name##_zpzz_s, gen_helper_##name##_zpzz_d, \ | ||
32 | }; \ | ||
33 | - return gen_gvec_ool_arg_zpzz(s, fns[a->esz], a, 0); \ | ||
34 | -} | ||
35 | + TRANS_FEAT(NAME, FEAT, gen_gvec_ool_arg_zpzz, \ | ||
36 | + name##_zpzz_fns[a->esz], a, 0) | ||
37 | |||
38 | -DO_ZPZZ(AND, and) | ||
39 | -DO_ZPZZ(EOR, eor) | ||
40 | -DO_ZPZZ(ORR, orr) | ||
41 | -DO_ZPZZ(BIC, bic) | ||
42 | +DO_ZPZZ(AND_zpzz, aa64_sve, sve_and) | ||
43 | +DO_ZPZZ(EOR_zpzz, aa64_sve, sve_eor) | ||
44 | +DO_ZPZZ(ORR_zpzz, aa64_sve, sve_orr) | ||
45 | +DO_ZPZZ(BIC_zpzz, aa64_sve, sve_bic) | ||
46 | |||
47 | -DO_ZPZZ(ADD, add) | ||
48 | -DO_ZPZZ(SUB, sub) | ||
49 | +DO_ZPZZ(ADD_zpzz, aa64_sve, sve_add) | ||
50 | +DO_ZPZZ(SUB_zpzz, aa64_sve, sve_sub) | ||
51 | |||
52 | -DO_ZPZZ(SMAX, smax) | ||
53 | -DO_ZPZZ(UMAX, umax) | ||
54 | -DO_ZPZZ(SMIN, smin) | ||
55 | -DO_ZPZZ(UMIN, umin) | ||
56 | -DO_ZPZZ(SABD, sabd) | ||
57 | -DO_ZPZZ(UABD, uabd) | ||
58 | +DO_ZPZZ(SMAX_zpzz, aa64_sve, sve_smax) | ||
59 | +DO_ZPZZ(UMAX_zpzz, aa64_sve, sve_umax) | ||
60 | +DO_ZPZZ(SMIN_zpzz, aa64_sve, sve_smin) | ||
61 | +DO_ZPZZ(UMIN_zpzz, aa64_sve, sve_umin) | ||
62 | +DO_ZPZZ(SABD_zpzz, aa64_sve, sve_sabd) | ||
63 | +DO_ZPZZ(UABD_zpzz, aa64_sve, sve_uabd) | ||
64 | |||
65 | -DO_ZPZZ(MUL, mul) | ||
66 | -DO_ZPZZ(SMULH, smulh) | ||
67 | -DO_ZPZZ(UMULH, umulh) | ||
68 | +DO_ZPZZ(MUL_zpzz, aa64_sve, sve_mul) | ||
69 | +DO_ZPZZ(SMULH_zpzz, aa64_sve, sve_smulh) | ||
70 | +DO_ZPZZ(UMULH_zpzz, aa64_sve, sve_umulh) | ||
71 | |||
72 | -DO_ZPZZ(ASR, asr) | ||
73 | -DO_ZPZZ(LSR, lsr) | ||
74 | -DO_ZPZZ(LSL, lsl) | ||
75 | +DO_ZPZZ(ASR_zpzz, aa64_sve, sve_asr) | ||
76 | +DO_ZPZZ(LSR_zpzz, aa64_sve, sve_lsr) | ||
77 | +DO_ZPZZ(LSL_zpzz, aa64_sve, sve_lsl) | ||
78 | |||
79 | -static bool trans_SDIV_zpzz(DisasContext *s, arg_rprr_esz *a) | ||
80 | -{ | ||
81 | - static gen_helper_gvec_4 * const fns[4] = { | ||
82 | - NULL, NULL, gen_helper_sve_sdiv_zpzz_s, gen_helper_sve_sdiv_zpzz_d | ||
83 | - }; | ||
84 | - return gen_gvec_ool_arg_zpzz(s, fns[a->esz], a, 0); | ||
85 | -} | ||
86 | +static gen_helper_gvec_4 * const sdiv_fns[4] = { | ||
87 | + NULL, NULL, gen_helper_sve_sdiv_zpzz_s, gen_helper_sve_sdiv_zpzz_d | ||
88 | +}; | ||
89 | +TRANS_FEAT(SDIV_zpzz, aa64_sve, gen_gvec_ool_arg_zpzz, sdiv_fns[a->esz], a, 0) | ||
90 | |||
91 | -static bool trans_UDIV_zpzz(DisasContext *s, arg_rprr_esz *a) | ||
92 | -{ | ||
93 | - static gen_helper_gvec_4 * const fns[4] = { | ||
94 | - NULL, NULL, gen_helper_sve_udiv_zpzz_s, gen_helper_sve_udiv_zpzz_d | ||
95 | - }; | ||
96 | - return gen_gvec_ool_arg_zpzz(s, fns[a->esz], a, 0); | ||
97 | -} | ||
98 | +static gen_helper_gvec_4 * const udiv_fns[4] = { | ||
99 | + NULL, NULL, gen_helper_sve_udiv_zpzz_s, gen_helper_sve_udiv_zpzz_d | ||
100 | +}; | ||
101 | +TRANS_FEAT(UDIV_zpzz, aa64_sve, gen_gvec_ool_arg_zpzz, udiv_fns[a->esz], a, 0) | ||
102 | |||
103 | static bool trans_SEL_zpzz(DisasContext *s, arg_rprr_esz *a) | ||
104 | { | ||
105 | @@ -XXX,XX +XXX,XX @@ TRANS_FEAT(SQSHLU, aa64_sve2, gen_gvec_ool_arg_zpzi, | ||
106 | */ | ||
107 | |||
108 | #define DO_ZPZW(NAME, name) \ | ||
109 | -static bool trans_##NAME##_zpzw(DisasContext *s, arg_rprr_esz *a) \ | ||
110 | -{ \ | ||
111 | - static gen_helper_gvec_4 * const fns[3] = { \ | ||
112 | + static gen_helper_gvec_4 * const name##_zpzw_fns[4] = { \ | ||
113 | gen_helper_sve_##name##_zpzw_b, gen_helper_sve_##name##_zpzw_h, \ | ||
114 | - gen_helper_sve_##name##_zpzw_s, \ | ||
115 | + gen_helper_sve_##name##_zpzw_s, NULL \ | ||
116 | }; \ | ||
117 | - if (a->esz < 0 || a->esz >= 3) { \ | ||
118 | - return false; \ | ||
119 | - } \ | ||
120 | - return gen_gvec_ool_arg_zpzz(s, fns[a->esz], a, 0); \ | ||
121 | -} | ||
122 | + TRANS_FEAT(NAME##_zpzw, aa64_sve, gen_gvec_ool_arg_zpzz, \ | ||
123 | + a->esz < 0 ? NULL : name##_zpzw_fns[a->esz], a, 0) | ||
124 | |||
125 | DO_ZPZW(ASR, asr) | ||
126 | DO_ZPZW(LSR, lsr) | ||
127 | -- | ||
128 | 2.25.1 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | Convert SVE translation functions using do_sve2_zpzz_ool | ||
4 | to use TRANS_FEAT and gen_gvec_ool_arg_zpzz. | ||
5 | |||
6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Message-id: 20220527181907.189259-29-richard.henderson@linaro.org | ||
8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | --- | ||
11 | target/arm/translate-sve.c | 118 +++++++++++++------------------------ | ||
12 | 1 file changed, 40 insertions(+), 78 deletions(-) | ||
13 | |||
14 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c | ||
15 | index XXXXXXX..XXXXXXX 100644 | ||
16 | --- a/target/arm/translate-sve.c | ||
17 | +++ b/target/arm/translate-sve.c | ||
18 | @@ -XXX,XX +XXX,XX @@ static bool trans_SEL_zpzz(DisasContext *s, arg_rprr_esz *a) | ||
19 | return true; | ||
20 | } | ||
21 | |||
22 | -#undef DO_ZPZZ | ||
23 | - | ||
24 | /* | ||
25 | *** SVE Integer Arithmetic - Unary Predicated Group | ||
26 | */ | ||
27 | @@ -XXX,XX +XXX,XX @@ TRANS_FEAT(SQRDMULH_zzz, aa64_sve2, gen_gvec_ool_arg_zzz, | ||
28 | * SVE2 Integer - Predicated | ||
29 | */ | ||
30 | |||
31 | -static bool do_sve2_zpzz_ool(DisasContext *s, arg_rprr_esz *a, | ||
32 | - gen_helper_gvec_4 *fn) | ||
33 | -{ | ||
34 | - if (!dc_isar_feature(aa64_sve2, s)) { | ||
35 | - return false; | ||
36 | - } | ||
37 | - return gen_gvec_ool_arg_zpzz(s, fn, a, 0); | ||
38 | -} | ||
39 | +static gen_helper_gvec_4 * const sadlp_fns[4] = { | ||
40 | + NULL, gen_helper_sve2_sadalp_zpzz_h, | ||
41 | + gen_helper_sve2_sadalp_zpzz_s, gen_helper_sve2_sadalp_zpzz_d, | ||
42 | +}; | ||
43 | +TRANS_FEAT(SADALP_zpzz, aa64_sve2, gen_gvec_ool_arg_zpzz, | ||
44 | + sadlp_fns[a->esz], a, 0) | ||
45 | |||
46 | -static bool trans_SADALP_zpzz(DisasContext *s, arg_rprr_esz *a) | ||
47 | -{ | ||
48 | - static gen_helper_gvec_4 * const fns[3] = { | ||
49 | - gen_helper_sve2_sadalp_zpzz_h, | ||
50 | - gen_helper_sve2_sadalp_zpzz_s, | ||
51 | - gen_helper_sve2_sadalp_zpzz_d, | ||
52 | - }; | ||
53 | - if (a->esz == 0) { | ||
54 | - return false; | ||
55 | - } | ||
56 | - return do_sve2_zpzz_ool(s, a, fns[a->esz - 1]); | ||
57 | -} | ||
58 | - | ||
59 | -static bool trans_UADALP_zpzz(DisasContext *s, arg_rprr_esz *a) | ||
60 | -{ | ||
61 | - static gen_helper_gvec_4 * const fns[3] = { | ||
62 | - gen_helper_sve2_uadalp_zpzz_h, | ||
63 | - gen_helper_sve2_uadalp_zpzz_s, | ||
64 | - gen_helper_sve2_uadalp_zpzz_d, | ||
65 | - }; | ||
66 | - if (a->esz == 0) { | ||
67 | - return false; | ||
68 | - } | ||
69 | - return do_sve2_zpzz_ool(s, a, fns[a->esz - 1]); | ||
70 | -} | ||
71 | +static gen_helper_gvec_4 * const uadlp_fns[4] = { | ||
72 | + NULL, gen_helper_sve2_uadalp_zpzz_h, | ||
73 | + gen_helper_sve2_uadalp_zpzz_s, gen_helper_sve2_uadalp_zpzz_d, | ||
74 | +}; | ||
75 | +TRANS_FEAT(UADALP_zpzz, aa64_sve2, gen_gvec_ool_arg_zpzz, | ||
76 | + uadlp_fns[a->esz], a, 0) | ||
77 | |||
78 | /* | ||
79 | * SVE2 integer unary operations (predicated) | ||
80 | @@ -XXX,XX +XXX,XX @@ static gen_helper_gvec_3 * const sqneg_fns[4] = { | ||
81 | }; | ||
82 | TRANS_FEAT(SQNEG, aa64_sve2, gen_gvec_ool_arg_zpz, sqneg_fns[a->esz], a, 0) | ||
83 | |||
84 | -#define DO_SVE2_ZPZZ(NAME, name) \ | ||
85 | -static bool trans_##NAME(DisasContext *s, arg_rprr_esz *a) \ | ||
86 | -{ \ | ||
87 | - static gen_helper_gvec_4 * const fns[4] = { \ | ||
88 | - gen_helper_sve2_##name##_zpzz_b, gen_helper_sve2_##name##_zpzz_h, \ | ||
89 | - gen_helper_sve2_##name##_zpzz_s, gen_helper_sve2_##name##_zpzz_d, \ | ||
90 | - }; \ | ||
91 | - return do_sve2_zpzz_ool(s, a, fns[a->esz]); \ | ||
92 | -} | ||
93 | +DO_ZPZZ(SQSHL, aa64_sve2, sve2_sqshl) | ||
94 | +DO_ZPZZ(SQRSHL, aa64_sve2, sve2_sqrshl) | ||
95 | +DO_ZPZZ(SRSHL, aa64_sve2, sve2_srshl) | ||
96 | |||
97 | -DO_SVE2_ZPZZ(SQSHL, sqshl) | ||
98 | -DO_SVE2_ZPZZ(SQRSHL, sqrshl) | ||
99 | -DO_SVE2_ZPZZ(SRSHL, srshl) | ||
100 | +DO_ZPZZ(UQSHL, aa64_sve2, sve2_uqshl) | ||
101 | +DO_ZPZZ(UQRSHL, aa64_sve2, sve2_uqrshl) | ||
102 | +DO_ZPZZ(URSHL, aa64_sve2, sve2_urshl) | ||
103 | |||
104 | -DO_SVE2_ZPZZ(UQSHL, uqshl) | ||
105 | -DO_SVE2_ZPZZ(UQRSHL, uqrshl) | ||
106 | -DO_SVE2_ZPZZ(URSHL, urshl) | ||
107 | +DO_ZPZZ(SHADD, aa64_sve2, sve2_shadd) | ||
108 | +DO_ZPZZ(SRHADD, aa64_sve2, sve2_srhadd) | ||
109 | +DO_ZPZZ(SHSUB, aa64_sve2, sve2_shsub) | ||
110 | |||
111 | -DO_SVE2_ZPZZ(SHADD, shadd) | ||
112 | -DO_SVE2_ZPZZ(SRHADD, srhadd) | ||
113 | -DO_SVE2_ZPZZ(SHSUB, shsub) | ||
114 | +DO_ZPZZ(UHADD, aa64_sve2, sve2_uhadd) | ||
115 | +DO_ZPZZ(URHADD, aa64_sve2, sve2_urhadd) | ||
116 | +DO_ZPZZ(UHSUB, aa64_sve2, sve2_uhsub) | ||
117 | |||
118 | -DO_SVE2_ZPZZ(UHADD, uhadd) | ||
119 | -DO_SVE2_ZPZZ(URHADD, urhadd) | ||
120 | -DO_SVE2_ZPZZ(UHSUB, uhsub) | ||
121 | +DO_ZPZZ(ADDP, aa64_sve2, sve2_addp) | ||
122 | +DO_ZPZZ(SMAXP, aa64_sve2, sve2_smaxp) | ||
123 | +DO_ZPZZ(UMAXP, aa64_sve2, sve2_umaxp) | ||
124 | +DO_ZPZZ(SMINP, aa64_sve2, sve2_sminp) | ||
125 | +DO_ZPZZ(UMINP, aa64_sve2, sve2_uminp) | ||
126 | |||
127 | -DO_SVE2_ZPZZ(ADDP, addp) | ||
128 | -DO_SVE2_ZPZZ(SMAXP, smaxp) | ||
129 | -DO_SVE2_ZPZZ(UMAXP, umaxp) | ||
130 | -DO_SVE2_ZPZZ(SMINP, sminp) | ||
131 | -DO_SVE2_ZPZZ(UMINP, uminp) | ||
132 | - | ||
133 | -DO_SVE2_ZPZZ(SQADD_zpzz, sqadd) | ||
134 | -DO_SVE2_ZPZZ(UQADD_zpzz, uqadd) | ||
135 | -DO_SVE2_ZPZZ(SQSUB_zpzz, sqsub) | ||
136 | -DO_SVE2_ZPZZ(UQSUB_zpzz, uqsub) | ||
137 | -DO_SVE2_ZPZZ(SUQADD, suqadd) | ||
138 | -DO_SVE2_ZPZZ(USQADD, usqadd) | ||
139 | +DO_ZPZZ(SQADD_zpzz, aa64_sve2, sve2_sqadd) | ||
140 | +DO_ZPZZ(UQADD_zpzz, aa64_sve2, sve2_uqadd) | ||
141 | +DO_ZPZZ(SQSUB_zpzz, aa64_sve2, sve2_sqsub) | ||
142 | +DO_ZPZZ(UQSUB_zpzz, aa64_sve2, sve2_uqsub) | ||
143 | +DO_ZPZZ(SUQADD, aa64_sve2, sve2_suqadd) | ||
144 | +DO_ZPZZ(USQADD, aa64_sve2, sve2_usqadd) | ||
145 | |||
146 | /* | ||
147 | * SVE2 Widening Integer Arithmetic | ||
148 | @@ -XXX,XX +XXX,XX @@ static bool trans_##NAME(DisasContext *s, arg_rprr_esz *a) \ | ||
149 | DO_SVE2_PPZZ_MATCH(MATCH, match) | ||
150 | DO_SVE2_PPZZ_MATCH(NMATCH, nmatch) | ||
151 | |||
152 | -static bool trans_HISTCNT(DisasContext *s, arg_rprr_esz *a) | ||
153 | -{ | ||
154 | - static gen_helper_gvec_4 * const fns[2] = { | ||
155 | - gen_helper_sve2_histcnt_s, gen_helper_sve2_histcnt_d | ||
156 | - }; | ||
157 | - if (a->esz < 2) { | ||
158 | - return false; | ||
159 | - } | ||
160 | - return do_sve2_zpzz_ool(s, a, fns[a->esz - 2]); | ||
161 | -} | ||
162 | +static gen_helper_gvec_4 * const histcnt_fns[4] = { | ||
163 | + NULL, NULL, gen_helper_sve2_histcnt_s, gen_helper_sve2_histcnt_d | ||
164 | +}; | ||
165 | +TRANS_FEAT(HISTCNT, aa64_sve2, gen_gvec_ool_arg_zpzz, | ||
166 | + histcnt_fns[a->esz], a, 0) | ||
167 | |||
168 | TRANS_FEAT(HISTSEG, aa64_sve2, gen_gvec_ool_arg_zzz, | ||
169 | a->esz == 0 ? gen_helper_sve2_histseg : NULL, a, 0) | ||
170 | -- | ||
171 | 2.25.1 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | There is only one caller for gen_gvec_fn_zz; inline it. | ||
4 | |||
5 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
6 | Message-id: 20220527181907.189259-30-richard.henderson@linaro.org | ||
7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
9 | --- | ||
10 | target/arm/translate-sve.c | 13 +++---------- | ||
11 | 1 file changed, 3 insertions(+), 10 deletions(-) | ||
12 | |||
13 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c | ||
14 | index XXXXXXX..XXXXXXX 100644 | ||
15 | --- a/target/arm/translate-sve.c | ||
16 | +++ b/target/arm/translate-sve.c | ||
17 | @@ -XXX,XX +XXX,XX @@ static bool gen_gvec_ool_arg_zpzz(DisasContext *s, gen_helper_gvec_4 *fn, | ||
18 | return gen_gvec_ool_zzzp(s, fn, a->rd, a->rn, a->rm, a->pg, data); | ||
19 | } | ||
20 | |||
21 | -/* Invoke a vector expander on two Zregs. */ | ||
22 | -static void gen_gvec_fn_zz(DisasContext *s, GVecGen2Fn *gvec_fn, | ||
23 | - int esz, int rd, int rn) | ||
24 | -{ | ||
25 | - unsigned vsz = vec_full_reg_size(s); | ||
26 | - gvec_fn(esz, vec_full_reg_offset(s, rd), | ||
27 | - vec_full_reg_offset(s, rn), vsz, vsz); | ||
28 | -} | ||
29 | - | ||
30 | /* Invoke a vector expander on three Zregs. */ | ||
31 | static void gen_gvec_fn_zzz(DisasContext *s, GVecGen3Fn *gvec_fn, | ||
32 | int esz, int rd, int rn, int rm) | ||
33 | @@ -XXX,XX +XXX,XX @@ static void gen_gvec_fn_zzzz(DisasContext *s, GVecGen4Fn *gvec_fn, | ||
34 | static bool do_mov_z(DisasContext *s, int rd, int rn) | ||
35 | { | ||
36 | if (sve_access_check(s)) { | ||
37 | - gen_gvec_fn_zz(s, tcg_gen_gvec_mov, MO_8, rd, rn); | ||
38 | + unsigned vsz = vec_full_reg_size(s); | ||
39 | + tcg_gen_gvec_mov(MO_8, vec_full_reg_offset(s, rd), | ||
40 | + vec_full_reg_offset(s, rn), vsz, vsz); | ||
41 | } | ||
42 | return true; | ||
43 | } | ||
44 | -- | ||
45 | 2.25.1 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
4 | Message-id: 20220527181907.189259-31-richard.henderson@linaro.org | ||
5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | --- | ||
8 | target/arm/translate-sve.c | 36 +++++++++++++++--------------------- | ||
9 | 1 file changed, 15 insertions(+), 21 deletions(-) | ||
10 | |||
11 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c | ||
12 | index XXXXXXX..XXXXXXX 100644 | ||
13 | --- a/target/arm/translate-sve.c | ||
14 | +++ b/target/arm/translate-sve.c | ||
15 | @@ -XXX,XX +XXX,XX @@ static bool gen_gvec_ool_arg_zpzz(DisasContext *s, gen_helper_gvec_4 *fn, | ||
16 | } | ||
17 | |||
18 | /* Invoke a vector expander on three Zregs. */ | ||
19 | -static void gen_gvec_fn_zzz(DisasContext *s, GVecGen3Fn *gvec_fn, | ||
20 | +static bool gen_gvec_fn_zzz(DisasContext *s, GVecGen3Fn *gvec_fn, | ||
21 | int esz, int rd, int rn, int rm) | ||
22 | { | ||
23 | - unsigned vsz = vec_full_reg_size(s); | ||
24 | - gvec_fn(esz, vec_full_reg_offset(s, rd), | ||
25 | - vec_full_reg_offset(s, rn), | ||
26 | - vec_full_reg_offset(s, rm), vsz, vsz); | ||
27 | + if (gvec_fn == NULL) { | ||
28 | + return false; | ||
29 | + } | ||
30 | + if (sve_access_check(s)) { | ||
31 | + unsigned vsz = vec_full_reg_size(s); | ||
32 | + gvec_fn(esz, vec_full_reg_offset(s, rd), | ||
33 | + vec_full_reg_offset(s, rn), | ||
34 | + vec_full_reg_offset(s, rm), vsz, vsz); | ||
35 | + } | ||
36 | + return true; | ||
37 | } | ||
38 | |||
39 | /* Invoke a vector expander on four Zregs. */ | ||
40 | @@ -XXX,XX +XXX,XX @@ const uint64_t pred_esz_masks[4] = { | ||
41 | |||
42 | static bool do_zzz_fn(DisasContext *s, arg_rrr_esz *a, GVecGen3Fn *gvec_fn) | ||
43 | { | ||
44 | - if (sve_access_check(s)) { | ||
45 | - gen_gvec_fn_zzz(s, gvec_fn, a->esz, a->rd, a->rn, a->rm); | ||
46 | - } | ||
47 | - return true; | ||
48 | + return gen_gvec_fn_zzz(s, gvec_fn, a->esz, a->rd, a->rn, a->rm); | ||
49 | } | ||
50 | |||
51 | static bool trans_AND_zzz(DisasContext *s, arg_rrr_esz *a) | ||
52 | @@ -XXX,XX +XXX,XX @@ static bool trans_MUL_zzz(DisasContext *s, arg_rrr_esz *a) | ||
53 | if (!dc_isar_feature(aa64_sve2, s)) { | ||
54 | return false; | ||
55 | } | ||
56 | - if (sve_access_check(s)) { | ||
57 | - gen_gvec_fn_zzz(s, tcg_gen_gvec_mul, a->esz, a->rd, a->rn, a->rm); | ||
58 | - } | ||
59 | - return true; | ||
60 | + return gen_gvec_fn_zzz(s, tcg_gen_gvec_mul, a->esz, a->rd, a->rn, a->rm); | ||
61 | } | ||
62 | |||
63 | static gen_helper_gvec_3 * const smulh_zzz_fns[4] = { | ||
64 | @@ -XXX,XX +XXX,XX @@ static bool do_sve2_fn_zzz(DisasContext *s, arg_rrr_esz *a, GVecGen3Fn *fn) | ||
65 | if (!dc_isar_feature(aa64_sve2, s)) { | ||
66 | return false; | ||
67 | } | ||
68 | - if (sve_access_check(s)) { | ||
69 | - gen_gvec_fn_zzz(s, fn, a->esz, a->rd, a->rn, a->rm); | ||
70 | - } | ||
71 | - return true; | ||
72 | + return gen_gvec_fn_zzz(s, fn, a->esz, a->rd, a->rn, a->rm); | ||
73 | } | ||
74 | |||
75 | static bool trans_SABA(DisasContext *s, arg_rrr_esz *a) | ||
76 | @@ -XXX,XX +XXX,XX @@ static bool trans_RAX1(DisasContext *s, arg_rrr_esz *a) | ||
77 | if (!dc_isar_feature(aa64_sve2_sha3, s)) { | ||
78 | return false; | ||
79 | } | ||
80 | - if (sve_access_check(s)) { | ||
81 | - gen_gvec_fn_zzz(s, gen_gvec_rax1, MO_64, a->rd, a->rn, a->rm); | ||
82 | - } | ||
83 | - return true; | ||
84 | + return gen_gvec_fn_zzz(s, gen_gvec_rax1, MO_64, a->rd, a->rn, a->rm); | ||
85 | } | ||
86 | |||
87 | static bool trans_FCVTNT_sh(DisasContext *s, arg_rpr_esz *a) | ||
88 | -- | ||
89 | 2.25.1 | diff view generated by jsdifflib |
1 | Convert the SSYS code in the Stellaris boards (which encapsulates the | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | system registers) to a proper QOM device. This will provide us with | ||
3 | somewhere to put the output Clock whose frequency depends on the | ||
4 | setting of the PLL configuration registers. | ||
5 | 2 | ||
6 | This is a migration compatibility break for lm3s811evb, lm3s6965evb. | 3 | Rename the function to match gen_gvec_fn_zzz, |
4 | and move to be adjacent. | ||
7 | 5 | ||
8 | We use 3-phase reset here because the Clock will need to propagate | 6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
9 | its value in the hold phase. | 7 | Message-id: 20220527181907.189259-32-richard.henderson@linaro.org |
8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | --- | ||
11 | target/arm/translate-sve.c | 31 ++++++++++++++++--------------- | ||
12 | 1 file changed, 16 insertions(+), 15 deletions(-) | ||
10 | 13 | ||
11 | For the moment we reset the device during the board creation so that | 14 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c |
12 | the system_clock_scale global gets set; this will be removed in a | ||
13 | subsequent commit. | ||
14 | |||
15 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
16 | Reviewed-by: Luc Michel <luc@lmichel.fr> | ||
17 | Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
18 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
19 | Message-id: 20210128114145.20536-17-peter.maydell@linaro.org | ||
20 | Message-id: 20210121190622.22000-17-peter.maydell@linaro.org | ||
21 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
22 | --- | ||
23 | hw/arm/stellaris.c | 132 ++++++++++++++++++++++++++++++++++++--------- | ||
24 | 1 file changed, 107 insertions(+), 25 deletions(-) | ||
25 | |||
26 | diff --git a/hw/arm/stellaris.c b/hw/arm/stellaris.c | ||
27 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
28 | --- a/hw/arm/stellaris.c | 16 | --- a/target/arm/translate-sve.c |
29 | +++ b/hw/arm/stellaris.c | 17 | +++ b/target/arm/translate-sve.c |
30 | @@ -XXX,XX +XXX,XX @@ static void stellaris_gptm_realize(DeviceState *dev, Error **errp) | 18 | @@ -XXX,XX +XXX,XX @@ static bool gen_gvec_fn_zzz(DisasContext *s, GVecGen3Fn *gvec_fn, |
31 | 19 | return true; | |
32 | /* System controller. */ | 20 | } |
33 | 21 | ||
34 | -typedef struct { | 22 | +static bool gen_gvec_fn_arg_zzz(DisasContext *s, GVecGen3Fn *fn, |
35 | +#define TYPE_STELLARIS_SYS "stellaris-sys" | 23 | + arg_rrr_esz *a) |
36 | +OBJECT_DECLARE_SIMPLE_TYPE(ssys_state, STELLARIS_SYS) | 24 | +{ |
37 | + | 25 | + return gen_gvec_fn_zzz(s, fn, a->esz, a->rd, a->rn, a->rm); |
38 | +struct ssys_state { | ||
39 | + SysBusDevice parent_obj; | ||
40 | + | ||
41 | MemoryRegion iomem; | ||
42 | uint32_t pborctl; | ||
43 | uint32_t ldopctl; | ||
44 | @@ -XXX,XX +XXX,XX @@ typedef struct { | ||
45 | uint32_t dcgc[3]; | ||
46 | uint32_t clkvclr; | ||
47 | uint32_t ldoarst; | ||
48 | + qemu_irq irq; | ||
49 | + /* Properties (all read-only registers) */ | ||
50 | uint32_t user0; | ||
51 | uint32_t user1; | ||
52 | - qemu_irq irq; | ||
53 | - stellaris_board_info *board; | ||
54 | -} ssys_state; | ||
55 | + uint32_t did0; | ||
56 | + uint32_t did1; | ||
57 | + uint32_t dc0; | ||
58 | + uint32_t dc1; | ||
59 | + uint32_t dc2; | ||
60 | + uint32_t dc3; | ||
61 | + uint32_t dc4; | ||
62 | +}; | ||
63 | |||
64 | static void ssys_update(ssys_state *s) | ||
65 | { | ||
66 | @@ -XXX,XX +XXX,XX @@ static uint32_t pllcfg_fury[16] = { | ||
67 | |||
68 | static int ssys_board_class(const ssys_state *s) | ||
69 | { | ||
70 | - uint32_t did0 = s->board->did0; | ||
71 | + uint32_t did0 = s->did0; | ||
72 | switch (did0 & DID0_VER_MASK) { | ||
73 | case DID0_VER_0: | ||
74 | return DID0_CLASS_SANDSTORM; | ||
75 | @@ -XXX,XX +XXX,XX @@ static uint64_t ssys_read(void *opaque, hwaddr offset, | ||
76 | |||
77 | switch (offset) { | ||
78 | case 0x000: /* DID0 */ | ||
79 | - return s->board->did0; | ||
80 | + return s->did0; | ||
81 | case 0x004: /* DID1 */ | ||
82 | - return s->board->did1; | ||
83 | + return s->did1; | ||
84 | case 0x008: /* DC0 */ | ||
85 | - return s->board->dc0; | ||
86 | + return s->dc0; | ||
87 | case 0x010: /* DC1 */ | ||
88 | - return s->board->dc1; | ||
89 | + return s->dc1; | ||
90 | case 0x014: /* DC2 */ | ||
91 | - return s->board->dc2; | ||
92 | + return s->dc2; | ||
93 | case 0x018: /* DC3 */ | ||
94 | - return s->board->dc3; | ||
95 | + return s->dc3; | ||
96 | case 0x01c: /* DC4 */ | ||
97 | - return s->board->dc4; | ||
98 | + return s->dc4; | ||
99 | case 0x030: /* PBORCTL */ | ||
100 | return s->pborctl; | ||
101 | case 0x034: /* LDOPCTL */ | ||
102 | @@ -XXX,XX +XXX,XX @@ static const MemoryRegionOps ssys_ops = { | ||
103 | .endianness = DEVICE_NATIVE_ENDIAN, | ||
104 | }; | ||
105 | |||
106 | -static void ssys_reset(void *opaque) | ||
107 | +static void stellaris_sys_reset_enter(Object *obj, ResetType type) | ||
108 | { | ||
109 | - ssys_state *s = (ssys_state *)opaque; | ||
110 | + ssys_state *s = STELLARIS_SYS(obj); | ||
111 | |||
112 | s->pborctl = 0x7ffd; | ||
113 | s->rcc = 0x078e3ac0; | ||
114 | @@ -XXX,XX +XXX,XX @@ static void ssys_reset(void *opaque) | ||
115 | s->rcgc[0] = 1; | ||
116 | s->scgc[0] = 1; | ||
117 | s->dcgc[0] = 1; | ||
118 | +} | 26 | +} |
119 | + | 27 | + |
120 | +static void stellaris_sys_reset_hold(Object *obj) | 28 | /* Invoke a vector expander on four Zregs. */ |
121 | +{ | 29 | static void gen_gvec_fn_zzzz(DisasContext *s, GVecGen4Fn *gvec_fn, |
122 | + ssys_state *s = STELLARIS_SYS(obj); | 30 | int esz, int rd, int rn, int rm, int ra) |
123 | + | 31 | @@ -XXX,XX +XXX,XX @@ const uint64_t pred_esz_masks[4] = { |
124 | ssys_calculate_system_clock(s); | 32 | *** SVE Logical - Unpredicated Group |
33 | */ | ||
34 | |||
35 | -static bool do_zzz_fn(DisasContext *s, arg_rrr_esz *a, GVecGen3Fn *gvec_fn) | ||
36 | -{ | ||
37 | - return gen_gvec_fn_zzz(s, gvec_fn, a->esz, a->rd, a->rn, a->rm); | ||
38 | -} | ||
39 | - | ||
40 | static bool trans_AND_zzz(DisasContext *s, arg_rrr_esz *a) | ||
41 | { | ||
42 | - return do_zzz_fn(s, a, tcg_gen_gvec_and); | ||
43 | + return gen_gvec_fn_arg_zzz(s, tcg_gen_gvec_and, a); | ||
125 | } | 44 | } |
126 | 45 | ||
127 | +static void stellaris_sys_reset_exit(Object *obj) | 46 | static bool trans_ORR_zzz(DisasContext *s, arg_rrr_esz *a) |
128 | +{ | ||
129 | +} | ||
130 | + | ||
131 | static int stellaris_sys_post_load(void *opaque, int version_id) | ||
132 | { | 47 | { |
133 | ssys_state *s = opaque; | 48 | - return do_zzz_fn(s, a, tcg_gen_gvec_or); |
134 | @@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_stellaris_sys = { | 49 | + return gen_gvec_fn_arg_zzz(s, tcg_gen_gvec_or, a); |
135 | } | 50 | } |
136 | }; | 51 | |
137 | 52 | static bool trans_EOR_zzz(DisasContext *s, arg_rrr_esz *a) | |
138 | +static Property stellaris_sys_properties[] = { | ||
139 | + DEFINE_PROP_UINT32("user0", ssys_state, user0, 0), | ||
140 | + DEFINE_PROP_UINT32("user1", ssys_state, user1, 0), | ||
141 | + DEFINE_PROP_UINT32("did0", ssys_state, did0, 0), | ||
142 | + DEFINE_PROP_UINT32("did1", ssys_state, did1, 0), | ||
143 | + DEFINE_PROP_UINT32("dc0", ssys_state, dc0, 0), | ||
144 | + DEFINE_PROP_UINT32("dc1", ssys_state, dc1, 0), | ||
145 | + DEFINE_PROP_UINT32("dc2", ssys_state, dc2, 0), | ||
146 | + DEFINE_PROP_UINT32("dc3", ssys_state, dc3, 0), | ||
147 | + DEFINE_PROP_UINT32("dc4", ssys_state, dc4, 0), | ||
148 | + DEFINE_PROP_END_OF_LIST() | ||
149 | +}; | ||
150 | + | ||
151 | +static void stellaris_sys_instance_init(Object *obj) | ||
152 | +{ | ||
153 | + ssys_state *s = STELLARIS_SYS(obj); | ||
154 | + SysBusDevice *sbd = SYS_BUS_DEVICE(s); | ||
155 | + | ||
156 | + memory_region_init_io(&s->iomem, obj, &ssys_ops, s, "ssys", 0x00001000); | ||
157 | + sysbus_init_mmio(sbd, &s->iomem); | ||
158 | + sysbus_init_irq(sbd, &s->irq); | ||
159 | +} | ||
160 | + | ||
161 | static int stellaris_sys_init(uint32_t base, qemu_irq irq, | ||
162 | stellaris_board_info * board, | ||
163 | uint8_t *macaddr) | ||
164 | { | 53 | { |
165 | - ssys_state *s; | 54 | - return do_zzz_fn(s, a, tcg_gen_gvec_xor); |
166 | + DeviceState *dev = qdev_new(TYPE_STELLARIS_SYS); | 55 | + return gen_gvec_fn_arg_zzz(s, tcg_gen_gvec_xor, a); |
167 | + SysBusDevice *sbd = SYS_BUS_DEVICE(dev); | ||
168 | |||
169 | - s = g_new0(ssys_state, 1); | ||
170 | - s->irq = irq; | ||
171 | - s->board = board; | ||
172 | /* Most devices come preprogrammed with a MAC address in the user data. */ | ||
173 | - s->user0 = macaddr[0] | (macaddr[1] << 8) | (macaddr[2] << 16); | ||
174 | - s->user1 = macaddr[3] | (macaddr[4] << 8) | (macaddr[5] << 16); | ||
175 | + qdev_prop_set_uint32(dev, "user0", | ||
176 | + macaddr[0] | (macaddr[1] << 8) | (macaddr[2] << 16)); | ||
177 | + qdev_prop_set_uint32(dev, "user1", | ||
178 | + macaddr[3] | (macaddr[4] << 8) | (macaddr[5] << 16)); | ||
179 | + qdev_prop_set_uint32(dev, "did0", board->did0); | ||
180 | + qdev_prop_set_uint32(dev, "did1", board->did1); | ||
181 | + qdev_prop_set_uint32(dev, "dc0", board->dc0); | ||
182 | + qdev_prop_set_uint32(dev, "dc1", board->dc1); | ||
183 | + qdev_prop_set_uint32(dev, "dc2", board->dc2); | ||
184 | + qdev_prop_set_uint32(dev, "dc3", board->dc3); | ||
185 | + qdev_prop_set_uint32(dev, "dc4", board->dc4); | ||
186 | + | ||
187 | + sysbus_realize_and_unref(sbd, &error_fatal); | ||
188 | + sysbus_mmio_map(sbd, 0, base); | ||
189 | + sysbus_connect_irq(sbd, 0, irq); | ||
190 | + | ||
191 | + /* | ||
192 | + * Normally we should not be resetting devices like this during | ||
193 | + * board creation. For the moment we need to do so, because | ||
194 | + * system_clock_scale will only get set when the STELLARIS_SYS | ||
195 | + * device is reset, and we need its initial value to pass to | ||
196 | + * the watchdog device. This hack can be removed once the | ||
197 | + * watchdog has been converted to use a Clock input instead. | ||
198 | + */ | ||
199 | + device_cold_reset(dev); | ||
200 | |||
201 | - memory_region_init_io(&s->iomem, NULL, &ssys_ops, s, "ssys", 0x00001000); | ||
202 | - memory_region_add_subregion(get_system_memory(), base, &s->iomem); | ||
203 | - ssys_reset(s); | ||
204 | - vmstate_register(NULL, VMSTATE_INSTANCE_ID_ANY, &vmstate_stellaris_sys, s); | ||
205 | return 0; | ||
206 | } | 56 | } |
207 | 57 | ||
208 | - | 58 | static bool trans_BIC_zzz(DisasContext *s, arg_rrr_esz *a) |
209 | /* I2C controller. */ | ||
210 | |||
211 | #define TYPE_STELLARIS_I2C "stellaris-i2c" | ||
212 | @@ -XXX,XX +XXX,XX @@ static const TypeInfo stellaris_adc_info = { | ||
213 | .class_init = stellaris_adc_class_init, | ||
214 | }; | ||
215 | |||
216 | +static void stellaris_sys_class_init(ObjectClass *klass, void *data) | ||
217 | +{ | ||
218 | + DeviceClass *dc = DEVICE_CLASS(klass); | ||
219 | + ResettableClass *rc = RESETTABLE_CLASS(klass); | ||
220 | + | ||
221 | + dc->vmsd = &vmstate_stellaris_sys; | ||
222 | + rc->phases.enter = stellaris_sys_reset_enter; | ||
223 | + rc->phases.hold = stellaris_sys_reset_hold; | ||
224 | + rc->phases.exit = stellaris_sys_reset_exit; | ||
225 | + device_class_set_props(dc, stellaris_sys_properties); | ||
226 | +} | ||
227 | + | ||
228 | +static const TypeInfo stellaris_sys_info = { | ||
229 | + .name = TYPE_STELLARIS_SYS, | ||
230 | + .parent = TYPE_SYS_BUS_DEVICE, | ||
231 | + .instance_size = sizeof(ssys_state), | ||
232 | + .instance_init = stellaris_sys_instance_init, | ||
233 | + .class_init = stellaris_sys_class_init, | ||
234 | +}; | ||
235 | + | ||
236 | static void stellaris_register_types(void) | ||
237 | { | 59 | { |
238 | type_register_static(&stellaris_i2c_info); | 60 | - return do_zzz_fn(s, a, tcg_gen_gvec_andc); |
239 | type_register_static(&stellaris_gptm_info); | 61 | + return gen_gvec_fn_arg_zzz(s, tcg_gen_gvec_andc, a); |
240 | type_register_static(&stellaris_adc_info); | ||
241 | + type_register_static(&stellaris_sys_info); | ||
242 | } | 62 | } |
243 | 63 | ||
244 | type_init(stellaris_register_types) | 64 | static void gen_xar8_i64(TCGv_i64 d, TCGv_i64 n, TCGv_i64 m, int64_t sh) |
65 | @@ -XXX,XX +XXX,XX @@ static bool trans_NBSL(DisasContext *s, arg_rrrr_esz *a) | ||
66 | |||
67 | static bool trans_ADD_zzz(DisasContext *s, arg_rrr_esz *a) | ||
68 | { | ||
69 | - return do_zzz_fn(s, a, tcg_gen_gvec_add); | ||
70 | + return gen_gvec_fn_arg_zzz(s, tcg_gen_gvec_add, a); | ||
71 | } | ||
72 | |||
73 | static bool trans_SUB_zzz(DisasContext *s, arg_rrr_esz *a) | ||
74 | { | ||
75 | - return do_zzz_fn(s, a, tcg_gen_gvec_sub); | ||
76 | + return gen_gvec_fn_arg_zzz(s, tcg_gen_gvec_sub, a); | ||
77 | } | ||
78 | |||
79 | static bool trans_SQADD_zzz(DisasContext *s, arg_rrr_esz *a) | ||
80 | { | ||
81 | - return do_zzz_fn(s, a, tcg_gen_gvec_ssadd); | ||
82 | + return gen_gvec_fn_arg_zzz(s, tcg_gen_gvec_ssadd, a); | ||
83 | } | ||
84 | |||
85 | static bool trans_SQSUB_zzz(DisasContext *s, arg_rrr_esz *a) | ||
86 | { | ||
87 | - return do_zzz_fn(s, a, tcg_gen_gvec_sssub); | ||
88 | + return gen_gvec_fn_arg_zzz(s, tcg_gen_gvec_sssub, a); | ||
89 | } | ||
90 | |||
91 | static bool trans_UQADD_zzz(DisasContext *s, arg_rrr_esz *a) | ||
92 | { | ||
93 | - return do_zzz_fn(s, a, tcg_gen_gvec_usadd); | ||
94 | + return gen_gvec_fn_arg_zzz(s, tcg_gen_gvec_usadd, a); | ||
95 | } | ||
96 | |||
97 | static bool trans_UQSUB_zzz(DisasContext *s, arg_rrr_esz *a) | ||
98 | { | ||
99 | - return do_zzz_fn(s, a, tcg_gen_gvec_ussub); | ||
100 | + return gen_gvec_fn_arg_zzz(s, tcg_gen_gvec_ussub, a); | ||
101 | } | ||
102 | |||
103 | /* | ||
245 | -- | 104 | -- |
246 | 2.20.1 | 105 | 2.25.1 |
247 | |||
248 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | Two uses of gen_gvec_fn_zzz can pass on arg_rrr_esz instead. | ||
4 | |||
5 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
6 | Message-id: 20220527181907.189259-33-richard.henderson@linaro.org | ||
7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
9 | --- | ||
10 | target/arm/translate-sve.c | 4 ++-- | ||
11 | 1 file changed, 2 insertions(+), 2 deletions(-) | ||
12 | |||
13 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c | ||
14 | index XXXXXXX..XXXXXXX 100644 | ||
15 | --- a/target/arm/translate-sve.c | ||
16 | +++ b/target/arm/translate-sve.c | ||
17 | @@ -XXX,XX +XXX,XX @@ static bool trans_MUL_zzz(DisasContext *s, arg_rrr_esz *a) | ||
18 | if (!dc_isar_feature(aa64_sve2, s)) { | ||
19 | return false; | ||
20 | } | ||
21 | - return gen_gvec_fn_zzz(s, tcg_gen_gvec_mul, a->esz, a->rd, a->rn, a->rm); | ||
22 | + return gen_gvec_fn_arg_zzz(s, tcg_gen_gvec_mul, a); | ||
23 | } | ||
24 | |||
25 | static gen_helper_gvec_3 * const smulh_zzz_fns[4] = { | ||
26 | @@ -XXX,XX +XXX,XX @@ static bool do_sve2_fn_zzz(DisasContext *s, arg_rrr_esz *a, GVecGen3Fn *fn) | ||
27 | if (!dc_isar_feature(aa64_sve2, s)) { | ||
28 | return false; | ||
29 | } | ||
30 | - return gen_gvec_fn_zzz(s, fn, a->esz, a->rd, a->rn, a->rm); | ||
31 | + return gen_gvec_fn_arg_zzz(s, fn, a); | ||
32 | } | ||
33 | |||
34 | static bool trans_SABA(DisasContext *s, arg_rrr_esz *a) | ||
35 | -- | ||
36 | 2.25.1 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | Convert SVE translation functions directly using | ||
4 | gen_gvec_fn_arg_zzz to TRANS_FEAT. | ||
5 | |||
6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Message-id: 20220527181907.189259-34-richard.henderson@linaro.org | ||
8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | --- | ||
11 | target/arm/translate-sve.c | 66 +++++++------------------------------- | ||
12 | 1 file changed, 11 insertions(+), 55 deletions(-) | ||
13 | |||
14 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c | ||
15 | index XXXXXXX..XXXXXXX 100644 | ||
16 | --- a/target/arm/translate-sve.c | ||
17 | +++ b/target/arm/translate-sve.c | ||
18 | @@ -XXX,XX +XXX,XX @@ const uint64_t pred_esz_masks[4] = { | ||
19 | *** SVE Logical - Unpredicated Group | ||
20 | */ | ||
21 | |||
22 | -static bool trans_AND_zzz(DisasContext *s, arg_rrr_esz *a) | ||
23 | -{ | ||
24 | - return gen_gvec_fn_arg_zzz(s, tcg_gen_gvec_and, a); | ||
25 | -} | ||
26 | - | ||
27 | -static bool trans_ORR_zzz(DisasContext *s, arg_rrr_esz *a) | ||
28 | -{ | ||
29 | - return gen_gvec_fn_arg_zzz(s, tcg_gen_gvec_or, a); | ||
30 | -} | ||
31 | - | ||
32 | -static bool trans_EOR_zzz(DisasContext *s, arg_rrr_esz *a) | ||
33 | -{ | ||
34 | - return gen_gvec_fn_arg_zzz(s, tcg_gen_gvec_xor, a); | ||
35 | -} | ||
36 | - | ||
37 | -static bool trans_BIC_zzz(DisasContext *s, arg_rrr_esz *a) | ||
38 | -{ | ||
39 | - return gen_gvec_fn_arg_zzz(s, tcg_gen_gvec_andc, a); | ||
40 | -} | ||
41 | +TRANS_FEAT(AND_zzz, aa64_sve, gen_gvec_fn_arg_zzz, tcg_gen_gvec_and, a) | ||
42 | +TRANS_FEAT(ORR_zzz, aa64_sve, gen_gvec_fn_arg_zzz, tcg_gen_gvec_or, a) | ||
43 | +TRANS_FEAT(EOR_zzz, aa64_sve, gen_gvec_fn_arg_zzz, tcg_gen_gvec_xor, a) | ||
44 | +TRANS_FEAT(BIC_zzz, aa64_sve, gen_gvec_fn_arg_zzz, tcg_gen_gvec_andc, a) | ||
45 | |||
46 | static void gen_xar8_i64(TCGv_i64 d, TCGv_i64 n, TCGv_i64 m, int64_t sh) | ||
47 | { | ||
48 | @@ -XXX,XX +XXX,XX @@ static bool trans_NBSL(DisasContext *s, arg_rrrr_esz *a) | ||
49 | *** SVE Integer Arithmetic - Unpredicated Group | ||
50 | */ | ||
51 | |||
52 | -static bool trans_ADD_zzz(DisasContext *s, arg_rrr_esz *a) | ||
53 | -{ | ||
54 | - return gen_gvec_fn_arg_zzz(s, tcg_gen_gvec_add, a); | ||
55 | -} | ||
56 | - | ||
57 | -static bool trans_SUB_zzz(DisasContext *s, arg_rrr_esz *a) | ||
58 | -{ | ||
59 | - return gen_gvec_fn_arg_zzz(s, tcg_gen_gvec_sub, a); | ||
60 | -} | ||
61 | - | ||
62 | -static bool trans_SQADD_zzz(DisasContext *s, arg_rrr_esz *a) | ||
63 | -{ | ||
64 | - return gen_gvec_fn_arg_zzz(s, tcg_gen_gvec_ssadd, a); | ||
65 | -} | ||
66 | - | ||
67 | -static bool trans_SQSUB_zzz(DisasContext *s, arg_rrr_esz *a) | ||
68 | -{ | ||
69 | - return gen_gvec_fn_arg_zzz(s, tcg_gen_gvec_sssub, a); | ||
70 | -} | ||
71 | - | ||
72 | -static bool trans_UQADD_zzz(DisasContext *s, arg_rrr_esz *a) | ||
73 | -{ | ||
74 | - return gen_gvec_fn_arg_zzz(s, tcg_gen_gvec_usadd, a); | ||
75 | -} | ||
76 | - | ||
77 | -static bool trans_UQSUB_zzz(DisasContext *s, arg_rrr_esz *a) | ||
78 | -{ | ||
79 | - return gen_gvec_fn_arg_zzz(s, tcg_gen_gvec_ussub, a); | ||
80 | -} | ||
81 | +TRANS_FEAT(ADD_zzz, aa64_sve, gen_gvec_fn_arg_zzz, tcg_gen_gvec_add, a) | ||
82 | +TRANS_FEAT(SUB_zzz, aa64_sve, gen_gvec_fn_arg_zzz, tcg_gen_gvec_sub, a) | ||
83 | +TRANS_FEAT(SQADD_zzz, aa64_sve, gen_gvec_fn_arg_zzz, tcg_gen_gvec_ssadd, a) | ||
84 | +TRANS_FEAT(SQSUB_zzz, aa64_sve, gen_gvec_fn_arg_zzz, tcg_gen_gvec_sssub, a) | ||
85 | +TRANS_FEAT(UQADD_zzz, aa64_sve, gen_gvec_fn_arg_zzz, tcg_gen_gvec_usadd, a) | ||
86 | +TRANS_FEAT(UQSUB_zzz, aa64_sve, gen_gvec_fn_arg_zzz, tcg_gen_gvec_ussub, a) | ||
87 | |||
88 | /* | ||
89 | *** SVE Integer Arithmetic - Binary Predicated Group | ||
90 | @@ -XXX,XX +XXX,XX @@ static bool trans_MOVPRFX_z(DisasContext *s, arg_rpr_esz *a) | ||
91 | * SVE2 Integer Multiply - Unpredicated | ||
92 | */ | ||
93 | |||
94 | -static bool trans_MUL_zzz(DisasContext *s, arg_rrr_esz *a) | ||
95 | -{ | ||
96 | - if (!dc_isar_feature(aa64_sve2, s)) { | ||
97 | - return false; | ||
98 | - } | ||
99 | - return gen_gvec_fn_arg_zzz(s, tcg_gen_gvec_mul, a); | ||
100 | -} | ||
101 | +TRANS_FEAT(MUL_zzz, aa64_sve2, gen_gvec_fn_arg_zzz, tcg_gen_gvec_mul, a) | ||
102 | |||
103 | static gen_helper_gvec_3 * const smulh_zzz_fns[4] = { | ||
104 | gen_helper_gvec_smulh_b, gen_helper_gvec_smulh_h, | ||
105 | -- | ||
106 | 2.25.1 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | Convert SVE translation functions using do_sve2_fn_zzz | ||
4 | to use TRANS_FEAT and gen_gvec_fn_arg_zzz. | ||
5 | |||
6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Message-id: 20220527181907.189259-35-richard.henderson@linaro.org | ||
8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | --- | ||
11 | target/arm/translate-sve.c | 19 ++----------------- | ||
12 | 1 file changed, 2 insertions(+), 17 deletions(-) | ||
13 | |||
14 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c | ||
15 | index XXXXXXX..XXXXXXX 100644 | ||
16 | --- a/target/arm/translate-sve.c | ||
17 | +++ b/target/arm/translate-sve.c | ||
18 | @@ -XXX,XX +XXX,XX @@ static bool trans_SLI(DisasContext *s, arg_rri_esz *a) | ||
19 | return do_sve2_fn2i(s, a, gen_gvec_sli); | ||
20 | } | ||
21 | |||
22 | -static bool do_sve2_fn_zzz(DisasContext *s, arg_rrr_esz *a, GVecGen3Fn *fn) | ||
23 | -{ | ||
24 | - if (!dc_isar_feature(aa64_sve2, s)) { | ||
25 | - return false; | ||
26 | - } | ||
27 | - return gen_gvec_fn_arg_zzz(s, fn, a); | ||
28 | -} | ||
29 | - | ||
30 | -static bool trans_SABA(DisasContext *s, arg_rrr_esz *a) | ||
31 | -{ | ||
32 | - return do_sve2_fn_zzz(s, a, gen_gvec_saba); | ||
33 | -} | ||
34 | - | ||
35 | -static bool trans_UABA(DisasContext *s, arg_rrr_esz *a) | ||
36 | -{ | ||
37 | - return do_sve2_fn_zzz(s, a, gen_gvec_uaba); | ||
38 | -} | ||
39 | +TRANS_FEAT(SABA, aa64_sve2, gen_gvec_fn_arg_zzz, gen_gvec_saba, a) | ||
40 | +TRANS_FEAT(UABA, aa64_sve2, gen_gvec_fn_arg_zzz, gen_gvec_uaba, a) | ||
41 | |||
42 | static bool do_sve2_narrow_extract(DisasContext *s, arg_rri_esz *a, | ||
43 | const GVecGen2 ops[3]) | ||
44 | -- | ||
45 | 2.25.1 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | The decode for RAX1 sets esz to MO_8, because that's what | ||
4 | we use by default for "no esz present". We changed that | ||
5 | to MO_64 during translation because it is more logical for | ||
6 | the operation. However, the esz argument to gen_gvec_rax1 | ||
7 | is unused and forces MO_64 within that function, so there | ||
8 | is no need to do it here as well. | ||
9 | |||
10 | Simplify to use gen_gvec_fn_arg_zzz and TRANS_FEAT. | ||
11 | |||
12 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
13 | Message-id: 20220527181907.189259-36-richard.henderson@linaro.org | ||
14 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
15 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
16 | --- | ||
17 | target/arm/translate-sve.c | 8 +------- | ||
18 | 1 file changed, 1 insertion(+), 7 deletions(-) | ||
19 | |||
20 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c | ||
21 | index XXXXXXX..XXXXXXX 100644 | ||
22 | --- a/target/arm/translate-sve.c | ||
23 | +++ b/target/arm/translate-sve.c | ||
24 | @@ -XXX,XX +XXX,XX @@ TRANS_FEAT(SM4E, aa64_sve2_sm4, gen_gvec_ool_arg_zzz, | ||
25 | TRANS_FEAT(SM4EKEY, aa64_sve2_sm4, gen_gvec_ool_arg_zzz, | ||
26 | gen_helper_crypto_sm4ekey, a, 0) | ||
27 | |||
28 | -static bool trans_RAX1(DisasContext *s, arg_rrr_esz *a) | ||
29 | -{ | ||
30 | - if (!dc_isar_feature(aa64_sve2_sha3, s)) { | ||
31 | - return false; | ||
32 | - } | ||
33 | - return gen_gvec_fn_zzz(s, gen_gvec_rax1, MO_64, a->rd, a->rn, a->rm); | ||
34 | -} | ||
35 | +TRANS_FEAT(RAX1, aa64_sve2_sha3, gen_gvec_fn_arg_zzz, gen_gvec_rax1, a) | ||
36 | |||
37 | static bool trans_FCVTNT_sh(DisasContext *s, arg_rpr_esz *a) | ||
38 | { | ||
39 | -- | ||
40 | 2.25.1 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | Merge gen_gvec_fn_zzzz with the sve access check and the | ||
4 | dereference of arg_rrrr_esz. | ||
5 | |||
6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Message-id: 20220527181907.189259-37-richard.henderson@linaro.org | ||
8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | --- | ||
11 | target/arm/translate-sve.c | 25 ++++++++++++++----------- | ||
12 | 1 file changed, 14 insertions(+), 11 deletions(-) | ||
13 | |||
14 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c | ||
15 | index XXXXXXX..XXXXXXX 100644 | ||
16 | --- a/target/arm/translate-sve.c | ||
17 | +++ b/target/arm/translate-sve.c | ||
18 | @@ -XXX,XX +XXX,XX @@ static bool gen_gvec_fn_arg_zzz(DisasContext *s, GVecGen3Fn *fn, | ||
19 | } | ||
20 | |||
21 | /* Invoke a vector expander on four Zregs. */ | ||
22 | -static void gen_gvec_fn_zzzz(DisasContext *s, GVecGen4Fn *gvec_fn, | ||
23 | - int esz, int rd, int rn, int rm, int ra) | ||
24 | +static bool gen_gvec_fn_arg_zzzz(DisasContext *s, GVecGen4Fn *gvec_fn, | ||
25 | + arg_rrrr_esz *a) | ||
26 | { | ||
27 | - unsigned vsz = vec_full_reg_size(s); | ||
28 | - gvec_fn(esz, vec_full_reg_offset(s, rd), | ||
29 | - vec_full_reg_offset(s, rn), | ||
30 | - vec_full_reg_offset(s, rm), | ||
31 | - vec_full_reg_offset(s, ra), vsz, vsz); | ||
32 | + if (gvec_fn == NULL) { | ||
33 | + return false; | ||
34 | + } | ||
35 | + if (sve_access_check(s)) { | ||
36 | + unsigned vsz = vec_full_reg_size(s); | ||
37 | + gvec_fn(a->esz, vec_full_reg_offset(s, a->rd), | ||
38 | + vec_full_reg_offset(s, a->rn), | ||
39 | + vec_full_reg_offset(s, a->rm), | ||
40 | + vec_full_reg_offset(s, a->ra), vsz, vsz); | ||
41 | + } | ||
42 | + return true; | ||
43 | } | ||
44 | |||
45 | /* Invoke a vector move on two Zregs. */ | ||
46 | @@ -XXX,XX +XXX,XX @@ static bool do_sve2_zzzz_fn(DisasContext *s, arg_rrrr_esz *a, GVecGen4Fn *fn) | ||
47 | if (!dc_isar_feature(aa64_sve2, s)) { | ||
48 | return false; | ||
49 | } | ||
50 | - if (sve_access_check(s)) { | ||
51 | - gen_gvec_fn_zzzz(s, fn, a->esz, a->rd, a->rn, a->rm, a->ra); | ||
52 | - } | ||
53 | - return true; | ||
54 | + return gen_gvec_fn_arg_zzzz(s, fn, a); | ||
55 | } | ||
56 | |||
57 | static void gen_eor3_i64(TCGv_i64 d, TCGv_i64 n, TCGv_i64 m, TCGv_i64 k) | ||
58 | -- | ||
59 | 2.25.1 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | Convert SVE translation functions using do_sve2_zzzz_fn | ||
4 | to use TRANS_FEAT and gen_gvec_fn_arg_zzzz. | ||
5 | |||
6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Message-id: 20220527181907.189259-38-richard.henderson@linaro.org | ||
8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | --- | ||
11 | target/arm/translate-sve.c | 38 ++++++-------------------------------- | ||
12 | 1 file changed, 6 insertions(+), 32 deletions(-) | ||
13 | |||
14 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c | ||
15 | index XXXXXXX..XXXXXXX 100644 | ||
16 | --- a/target/arm/translate-sve.c | ||
17 | +++ b/target/arm/translate-sve.c | ||
18 | @@ -XXX,XX +XXX,XX @@ static bool trans_XAR(DisasContext *s, arg_rrri_esz *a) | ||
19 | return true; | ||
20 | } | ||
21 | |||
22 | -static bool do_sve2_zzzz_fn(DisasContext *s, arg_rrrr_esz *a, GVecGen4Fn *fn) | ||
23 | -{ | ||
24 | - if (!dc_isar_feature(aa64_sve2, s)) { | ||
25 | - return false; | ||
26 | - } | ||
27 | - return gen_gvec_fn_arg_zzzz(s, fn, a); | ||
28 | -} | ||
29 | - | ||
30 | static void gen_eor3_i64(TCGv_i64 d, TCGv_i64 n, TCGv_i64 m, TCGv_i64 k) | ||
31 | { | ||
32 | tcg_gen_xor_i64(d, n, m); | ||
33 | @@ -XXX,XX +XXX,XX @@ static void gen_eor3(unsigned vece, uint32_t d, uint32_t n, uint32_t m, | ||
34 | tcg_gen_gvec_4(d, n, m, a, oprsz, maxsz, &op); | ||
35 | } | ||
36 | |||
37 | -static bool trans_EOR3(DisasContext *s, arg_rrrr_esz *a) | ||
38 | -{ | ||
39 | - return do_sve2_zzzz_fn(s, a, gen_eor3); | ||
40 | -} | ||
41 | +TRANS_FEAT(EOR3, aa64_sve2, gen_gvec_fn_arg_zzzz, gen_eor3, a) | ||
42 | |||
43 | static void gen_bcax_i64(TCGv_i64 d, TCGv_i64 n, TCGv_i64 m, TCGv_i64 k) | ||
44 | { | ||
45 | @@ -XXX,XX +XXX,XX @@ static void gen_bcax(unsigned vece, uint32_t d, uint32_t n, uint32_t m, | ||
46 | tcg_gen_gvec_4(d, n, m, a, oprsz, maxsz, &op); | ||
47 | } | ||
48 | |||
49 | -static bool trans_BCAX(DisasContext *s, arg_rrrr_esz *a) | ||
50 | -{ | ||
51 | - return do_sve2_zzzz_fn(s, a, gen_bcax); | ||
52 | -} | ||
53 | +TRANS_FEAT(BCAX, aa64_sve2, gen_gvec_fn_arg_zzzz, gen_bcax, a) | ||
54 | |||
55 | static void gen_bsl(unsigned vece, uint32_t d, uint32_t n, uint32_t m, | ||
56 | uint32_t a, uint32_t oprsz, uint32_t maxsz) | ||
57 | @@ -XXX,XX +XXX,XX @@ static void gen_bsl(unsigned vece, uint32_t d, uint32_t n, uint32_t m, | ||
58 | tcg_gen_gvec_bitsel(vece, d, a, n, m, oprsz, maxsz); | ||
59 | } | ||
60 | |||
61 | -static bool trans_BSL(DisasContext *s, arg_rrrr_esz *a) | ||
62 | -{ | ||
63 | - return do_sve2_zzzz_fn(s, a, gen_bsl); | ||
64 | -} | ||
65 | +TRANS_FEAT(BSL, aa64_sve2, gen_gvec_fn_arg_zzzz, gen_bsl, a) | ||
66 | |||
67 | static void gen_bsl1n_i64(TCGv_i64 d, TCGv_i64 n, TCGv_i64 m, TCGv_i64 k) | ||
68 | { | ||
69 | @@ -XXX,XX +XXX,XX @@ static void gen_bsl1n(unsigned vece, uint32_t d, uint32_t n, uint32_t m, | ||
70 | tcg_gen_gvec_4(d, n, m, a, oprsz, maxsz, &op); | ||
71 | } | ||
72 | |||
73 | -static bool trans_BSL1N(DisasContext *s, arg_rrrr_esz *a) | ||
74 | -{ | ||
75 | - return do_sve2_zzzz_fn(s, a, gen_bsl1n); | ||
76 | -} | ||
77 | +TRANS_FEAT(BSL1N, aa64_sve2, gen_gvec_fn_arg_zzzz, gen_bsl1n, a) | ||
78 | |||
79 | static void gen_bsl2n_i64(TCGv_i64 d, TCGv_i64 n, TCGv_i64 m, TCGv_i64 k) | ||
80 | { | ||
81 | @@ -XXX,XX +XXX,XX @@ static void gen_bsl2n(unsigned vece, uint32_t d, uint32_t n, uint32_t m, | ||
82 | tcg_gen_gvec_4(d, n, m, a, oprsz, maxsz, &op); | ||
83 | } | ||
84 | |||
85 | -static bool trans_BSL2N(DisasContext *s, arg_rrrr_esz *a) | ||
86 | -{ | ||
87 | - return do_sve2_zzzz_fn(s, a, gen_bsl2n); | ||
88 | -} | ||
89 | +TRANS_FEAT(BSL2N, aa64_sve2, gen_gvec_fn_arg_zzzz, gen_bsl2n, a) | ||
90 | |||
91 | static void gen_nbsl_i64(TCGv_i64 d, TCGv_i64 n, TCGv_i64 m, TCGv_i64 k) | ||
92 | { | ||
93 | @@ -XXX,XX +XXX,XX @@ static void gen_nbsl(unsigned vece, uint32_t d, uint32_t n, uint32_t m, | ||
94 | tcg_gen_gvec_4(d, n, m, a, oprsz, maxsz, &op); | ||
95 | } | ||
96 | |||
97 | -static bool trans_NBSL(DisasContext *s, arg_rrrr_esz *a) | ||
98 | -{ | ||
99 | - return do_sve2_zzzz_fn(s, a, gen_nbsl); | ||
100 | -} | ||
101 | +TRANS_FEAT(NBSL, aa64_sve2, gen_gvec_fn_arg_zzzz, gen_nbsl, a) | ||
102 | |||
103 | /* | ||
104 | *** SVE Integer Arithmetic - Unpredicated Group | ||
105 | -- | ||
106 | 2.25.1 | diff view generated by jsdifflib |
1 | Switch the CMSDK APB timer device over to using its Clock input; the | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | pclk-frq property is now ignored. | ||
3 | 2 | ||
3 | We have two places that perform this particular operation. | ||
4 | |||
5 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
6 | Message-id: 20220527181907.189259-39-richard.henderson@linaro.org | ||
7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
4 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
5 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
6 | Reviewed-by: Luc Michel <luc@lmichel.fr> | ||
7 | Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
8 | Message-id: 20210128114145.20536-19-peter.maydell@linaro.org | ||
9 | Message-id: 20210121190622.22000-19-peter.maydell@linaro.org | ||
10 | --- | 9 | --- |
11 | hw/timer/cmsdk-apb-timer.c | 18 ++++++++++++++---- | 10 | target/arm/translate-sve.c | 30 +++++++++++++++++------------- |
12 | 1 file changed, 14 insertions(+), 4 deletions(-) | 11 | 1 file changed, 17 insertions(+), 13 deletions(-) |
13 | 12 | ||
14 | diff --git a/hw/timer/cmsdk-apb-timer.c b/hw/timer/cmsdk-apb-timer.c | 13 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c |
15 | index XXXXXXX..XXXXXXX 100644 | 14 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/hw/timer/cmsdk-apb-timer.c | 15 | --- a/target/arm/translate-sve.c |
17 | +++ b/hw/timer/cmsdk-apb-timer.c | 16 | +++ b/target/arm/translate-sve.c |
18 | @@ -XXX,XX +XXX,XX @@ static void cmsdk_apb_timer_reset(DeviceState *dev) | 17 | @@ -XXX,XX +XXX,XX @@ static bool gen_gvec_ool_arg_zpzz(DisasContext *s, gen_helper_gvec_4 *fn, |
19 | ptimer_transaction_commit(s->timer); | 18 | return gen_gvec_ool_zzzp(s, fn, a->rd, a->rn, a->rm, a->pg, data); |
20 | } | 19 | } |
21 | 20 | ||
22 | +static void cmsdk_apb_timer_clk_update(void *opaque) | 21 | +/* Invoke a vector expander on two Zregs and an immediate. */ |
22 | +static bool gen_gvec_fn_zzi(DisasContext *s, GVecGen2iFn *gvec_fn, | ||
23 | + int esz, int rd, int rn, uint64_t imm) | ||
23 | +{ | 24 | +{ |
24 | + CMSDKAPBTimer *s = CMSDK_APB_TIMER(opaque); | 25 | + if (gvec_fn == NULL) { |
25 | + | 26 | + return false; |
26 | + ptimer_transaction_begin(s->timer); | 27 | + } |
27 | + ptimer_set_period_from_clock(s->timer, s->pclk, 1); | 28 | + if (sve_access_check(s)) { |
28 | + ptimer_transaction_commit(s->timer); | 29 | + unsigned vsz = vec_full_reg_size(s); |
30 | + gvec_fn(esz, vec_full_reg_offset(s, rd), | ||
31 | + vec_full_reg_offset(s, rn), imm, vsz, vsz); | ||
32 | + } | ||
33 | + return true; | ||
29 | +} | 34 | +} |
30 | + | 35 | + |
31 | static void cmsdk_apb_timer_init(Object *obj) | 36 | /* Invoke a vector expander on three Zregs. */ |
32 | { | 37 | static bool gen_gvec_fn_zzz(DisasContext *s, GVecGen3Fn *gvec_fn, |
33 | SysBusDevice *sbd = SYS_BUS_DEVICE(obj); | 38 | int esz, int rd, int rn, int rm) |
34 | @@ -XXX,XX +XXX,XX @@ static void cmsdk_apb_timer_init(Object *obj) | 39 | @@ -XXX,XX +XXX,XX @@ static bool do_zz_dbm(DisasContext *s, arg_rr_dbm *a, GVecGen2iFn *gvec_fn) |
35 | s, "cmsdk-apb-timer", 0x1000); | 40 | extract32(a->dbm, 6, 6))) { |
36 | sysbus_init_mmio(sbd, &s->iomem); | 41 | return false; |
37 | sysbus_init_irq(sbd, &s->timerint); | 42 | } |
38 | - s->pclk = qdev_init_clock_in(DEVICE(s), "pclk", NULL, NULL); | 43 | - if (sve_access_check(s)) { |
39 | + s->pclk = qdev_init_clock_in(DEVICE(s), "pclk", | 44 | - unsigned vsz = vec_full_reg_size(s); |
40 | + cmsdk_apb_timer_clk_update, s); | 45 | - gvec_fn(MO_64, vec_full_reg_offset(s, a->rd), |
46 | - vec_full_reg_offset(s, a->rn), imm, vsz, vsz); | ||
47 | - } | ||
48 | - return true; | ||
49 | + return gen_gvec_fn_zzi(s, gvec_fn, MO_64, a->rd, a->rn, imm); | ||
41 | } | 50 | } |
42 | 51 | ||
43 | static void cmsdk_apb_timer_realize(DeviceState *dev, Error **errp) | 52 | static bool trans_AND_zzi(DisasContext *s, arg_rr_dbm *a) |
44 | { | 53 | @@ -XXX,XX +XXX,XX @@ static bool do_sve2_fn2i(DisasContext *s, arg_rri_esz *a, GVecGen2iFn *fn) |
45 | CMSDKAPBTimer *s = CMSDK_APB_TIMER(dev); | 54 | if (a->esz < 0 || !dc_isar_feature(aa64_sve2, s)) { |
46 | 55 | return false; | |
47 | - if (s->pclk_frq == 0) { | ||
48 | - error_setg(errp, "CMSDK APB timer: pclk-frq property must be set"); | ||
49 | + if (!clock_has_source(s->pclk)) { | ||
50 | + error_setg(errp, "CMSDK APB timer: pclk clock must be connected"); | ||
51 | return; | ||
52 | } | 56 | } |
53 | 57 | - if (sve_access_check(s)) { | |
54 | @@ -XXX,XX +XXX,XX @@ static void cmsdk_apb_timer_realize(DeviceState *dev, Error **errp) | 58 | - unsigned vsz = vec_full_reg_size(s); |
55 | PTIMER_POLICY_NO_COUNTER_ROUND_DOWN); | 59 | - unsigned rd_ofs = vec_full_reg_offset(s, a->rd); |
56 | 60 | - unsigned rn_ofs = vec_full_reg_offset(s, a->rn); | |
57 | ptimer_transaction_begin(s->timer); | 61 | - fn(a->esz, rd_ofs, rn_ofs, a->imm, vsz, vsz); |
58 | - ptimer_set_freq(s->timer, s->pclk_frq); | 62 | - } |
59 | + ptimer_set_period_from_clock(s->timer, s->pclk, 1); | 63 | - return true; |
60 | ptimer_transaction_commit(s->timer); | 64 | + return gen_gvec_fn_zzi(s, fn, a->esz, a->rd, a->rn, a->imm); |
61 | } | 65 | } |
62 | 66 | ||
67 | static bool trans_SSRA(DisasContext *s, arg_rri_esz *a) | ||
63 | -- | 68 | -- |
64 | 2.20.1 | 69 | 2.25.1 |
65 | |||
66 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
4 | Message-id: 20220527181907.189259-40-richard.henderson@linaro.org | ||
5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | --- | ||
8 | target/arm/translate-sve.c | 17 +++-------------- | ||
9 | 1 file changed, 3 insertions(+), 14 deletions(-) | ||
10 | |||
11 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c | ||
12 | index XXXXXXX..XXXXXXX 100644 | ||
13 | --- a/target/arm/translate-sve.c | ||
14 | +++ b/target/arm/translate-sve.c | ||
15 | @@ -XXX,XX +XXX,XX @@ static bool do_zz_dbm(DisasContext *s, arg_rr_dbm *a, GVecGen2iFn *gvec_fn) | ||
16 | return gen_gvec_fn_zzi(s, gvec_fn, MO_64, a->rd, a->rn, imm); | ||
17 | } | ||
18 | |||
19 | -static bool trans_AND_zzi(DisasContext *s, arg_rr_dbm *a) | ||
20 | -{ | ||
21 | - return do_zz_dbm(s, a, tcg_gen_gvec_andi); | ||
22 | -} | ||
23 | - | ||
24 | -static bool trans_ORR_zzi(DisasContext *s, arg_rr_dbm *a) | ||
25 | -{ | ||
26 | - return do_zz_dbm(s, a, tcg_gen_gvec_ori); | ||
27 | -} | ||
28 | - | ||
29 | -static bool trans_EOR_zzi(DisasContext *s, arg_rr_dbm *a) | ||
30 | -{ | ||
31 | - return do_zz_dbm(s, a, tcg_gen_gvec_xori); | ||
32 | -} | ||
33 | +TRANS_FEAT(AND_zzi, aa64_sve, do_zz_dbm, a, tcg_gen_gvec_andi) | ||
34 | +TRANS_FEAT(ORR_zzi, aa64_sve, do_zz_dbm, a, tcg_gen_gvec_ori) | ||
35 | +TRANS_FEAT(EOR_zzi, aa64_sve, do_zz_dbm, a, tcg_gen_gvec_xori) | ||
36 | |||
37 | static bool trans_DUPM(DisasContext *s, arg_DUPM *a) | ||
38 | { | ||
39 | -- | ||
40 | 2.25.1 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | The check is already done in gen_gvec_ool_zzzp, | ||
4 | which is called by do_sel_z; remove from callers. | ||
5 | |||
6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Message-id: 20220527181907.189259-41-richard.henderson@linaro.org | ||
8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | --- | ||
11 | target/arm/translate-sve.c | 14 ++++---------- | ||
12 | 1 file changed, 4 insertions(+), 10 deletions(-) | ||
13 | |||
14 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c | ||
15 | index XXXXXXX..XXXXXXX 100644 | ||
16 | --- a/target/arm/translate-sve.c | ||
17 | +++ b/target/arm/translate-sve.c | ||
18 | @@ -XXX,XX +XXX,XX @@ TRANS_FEAT(UQSUB_zzz, aa64_sve, gen_gvec_fn_arg_zzz, tcg_gen_gvec_ussub, a) | ||
19 | /* Select active elememnts from Zn and inactive elements from Zm, | ||
20 | * storing the result in Zd. | ||
21 | */ | ||
22 | -static void do_sel_z(DisasContext *s, int rd, int rn, int rm, int pg, int esz) | ||
23 | +static bool do_sel_z(DisasContext *s, int rd, int rn, int rm, int pg, int esz) | ||
24 | { | ||
25 | static gen_helper_gvec_4 * const fns[4] = { | ||
26 | gen_helper_sve_sel_zpzz_b, gen_helper_sve_sel_zpzz_h, | ||
27 | gen_helper_sve_sel_zpzz_s, gen_helper_sve_sel_zpzz_d | ||
28 | }; | ||
29 | - gen_gvec_ool_zzzp(s, fns[esz], rd, rn, rm, pg, 0); | ||
30 | + return gen_gvec_ool_zzzp(s, fns[esz], rd, rn, rm, pg, 0); | ||
31 | } | ||
32 | |||
33 | #define DO_ZPZZ(NAME, FEAT, name) \ | ||
34 | @@ -XXX,XX +XXX,XX @@ TRANS_FEAT(UDIV_zpzz, aa64_sve, gen_gvec_ool_arg_zpzz, udiv_fns[a->esz], a, 0) | ||
35 | |||
36 | static bool trans_SEL_zpzz(DisasContext *s, arg_rprr_esz *a) | ||
37 | { | ||
38 | - if (sve_access_check(s)) { | ||
39 | - do_sel_z(s, a->rd, a->rn, a->rm, a->pg, a->esz); | ||
40 | - } | ||
41 | - return true; | ||
42 | + return do_sel_z(s, a->rd, a->rn, a->rm, a->pg, a->esz); | ||
43 | } | ||
44 | |||
45 | /* | ||
46 | @@ -XXX,XX +XXX,XX @@ static bool trans_MOVPRFX(DisasContext *s, arg_MOVPRFX *a) | ||
47 | |||
48 | static bool trans_MOVPRFX_m(DisasContext *s, arg_rpr_esz *a) | ||
49 | { | ||
50 | - if (sve_access_check(s)) { | ||
51 | - do_sel_z(s, a->rd, a->rn, a->rd, a->pg, a->esz); | ||
52 | - } | ||
53 | - return true; | ||
54 | + return do_sel_z(s, a->rd, a->rn, a->rd, a->pg, a->esz); | ||
55 | } | ||
56 | |||
57 | static bool trans_MOVPRFX_z(DisasContext *s, arg_rpr_esz *a) | ||
58 | -- | ||
59 | 2.25.1 | diff view generated by jsdifflib |
1 | Add a simple test of the CMSDK APB timer, since we're about to do | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | some refactoring of how it is clocked. | ||
3 | 2 | ||
3 | We have two places that perform this particular operation. | ||
4 | |||
5 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
6 | Message-id: 20220527181907.189259-42-richard.henderson@linaro.org | ||
7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
4 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
5 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
6 | Reviewed-by: Luc Michel <luc@lmichel.fr> | ||
7 | Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
8 | Message-id: 20210128114145.20536-4-peter.maydell@linaro.org | ||
9 | Message-id: 20210121190622.22000-4-peter.maydell@linaro.org | ||
10 | --- | 9 | --- |
11 | tests/qtest/cmsdk-apb-timer-test.c | 75 ++++++++++++++++++++++++++++++ | 10 | target/arm/translate-sve.c | 21 +++++++++++++-------- |
12 | MAINTAINERS | 1 + | 11 | 1 file changed, 13 insertions(+), 8 deletions(-) |
13 | tests/qtest/meson.build | 1 + | ||
14 | 3 files changed, 77 insertions(+) | ||
15 | create mode 100644 tests/qtest/cmsdk-apb-timer-test.c | ||
16 | 12 | ||
17 | diff --git a/tests/qtest/cmsdk-apb-timer-test.c b/tests/qtest/cmsdk-apb-timer-test.c | 13 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c |
18 | new file mode 100644 | 14 | index XXXXXXX..XXXXXXX 100644 |
19 | index XXXXXXX..XXXXXXX | 15 | --- a/target/arm/translate-sve.c |
20 | --- /dev/null | 16 | +++ b/target/arm/translate-sve.c |
21 | +++ b/tests/qtest/cmsdk-apb-timer-test.c | 17 | @@ -XXX,XX +XXX,XX @@ static bool gen_gvec_fn_zzi(DisasContext *s, GVecGen2iFn *gvec_fn, |
22 | @@ -XXX,XX +XXX,XX @@ | 18 | return true; |
23 | +/* | 19 | } |
24 | + * QTest testcase for the CMSDK APB timer device | 20 | |
25 | + * | 21 | +static bool gen_gvec_fn_arg_zzi(DisasContext *s, GVecGen2iFn *gvec_fn, |
26 | + * Copyright (c) 2021 Linaro Limited | 22 | + arg_rri_esz *a) |
27 | + * | ||
28 | + * This program is free software; you can redistribute it and/or modify it | ||
29 | + * under the terms of the GNU General Public License as published by the | ||
30 | + * Free Software Foundation; either version 2 of the License, or | ||
31 | + * (at your option) any later version. | ||
32 | + * | ||
33 | + * This program is distributed in the hope that it will be useful, but WITHOUT | ||
34 | + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
35 | + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
36 | + * for more details. | ||
37 | + */ | ||
38 | + | ||
39 | +#include "qemu/osdep.h" | ||
40 | +#include "libqtest-single.h" | ||
41 | + | ||
42 | +/* IoTKit/ARMSSE-200 timer0; driven at 25MHz in mps2-an385, so 40ns per tick */ | ||
43 | +#define TIMER_BASE 0x40000000 | ||
44 | + | ||
45 | +#define CTRL 0 | ||
46 | +#define VALUE 4 | ||
47 | +#define RELOAD 8 | ||
48 | +#define INTSTATUS 0xc | ||
49 | + | ||
50 | +static void test_timer(void) | ||
51 | +{ | 23 | +{ |
52 | + g_assert_true(readl(TIMER_BASE + INTSTATUS) == 0); | 24 | + if (a->esz < 0) { |
53 | + | 25 | + /* Invalid tsz encoding -- see tszimm_esz. */ |
54 | + /* Start timer: will fire after 40 * 1000 == 40000 ns */ | 26 | + return false; |
55 | + writel(TIMER_BASE + RELOAD, 1000); | 27 | + } |
56 | + writel(TIMER_BASE + CTRL, 9); | 28 | + return gen_gvec_fn_zzi(s, gvec_fn, a->esz, a->rd, a->rn, a->imm); |
57 | + | ||
58 | + /* Step to just past the 500th tick and check VALUE */ | ||
59 | + clock_step(40 * 500 + 1); | ||
60 | + g_assert_cmpuint(readl(TIMER_BASE + INTSTATUS), ==, 0); | ||
61 | + g_assert_cmpuint(readl(TIMER_BASE + VALUE), ==, 500); | ||
62 | + | ||
63 | + /* Just past the 1000th tick: timer should have fired */ | ||
64 | + clock_step(40 * 500); | ||
65 | + g_assert_cmpuint(readl(TIMER_BASE + INTSTATUS), ==, 1); | ||
66 | + g_assert_cmpuint(readl(TIMER_BASE + VALUE), ==, 0); | ||
67 | + | ||
68 | + /* VALUE reloads at the following tick */ | ||
69 | + clock_step(40); | ||
70 | + g_assert_cmpuint(readl(TIMER_BASE + VALUE), ==, 1000); | ||
71 | + | ||
72 | + /* Check write-1-to-clear behaviour of INTSTATUS */ | ||
73 | + writel(TIMER_BASE + INTSTATUS, 0); | ||
74 | + g_assert_cmpuint(readl(TIMER_BASE + INTSTATUS), ==, 1); | ||
75 | + writel(TIMER_BASE + INTSTATUS, 1); | ||
76 | + g_assert_cmpuint(readl(TIMER_BASE + INTSTATUS), ==, 0); | ||
77 | + | ||
78 | + /* Turn off the timer */ | ||
79 | + writel(TIMER_BASE + CTRL, 0); | ||
80 | +} | 29 | +} |
81 | + | 30 | + |
82 | +int main(int argc, char **argv) | 31 | /* Invoke a vector expander on three Zregs. */ |
83 | +{ | 32 | static bool gen_gvec_fn_zzz(DisasContext *s, GVecGen3Fn *gvec_fn, |
84 | + int r; | 33 | int esz, int rd, int rn, int rm) |
85 | + | 34 | @@ -XXX,XX +XXX,XX @@ static bool trans_ADD_zzi(DisasContext *s, arg_rri_esz *a) |
86 | + g_test_init(&argc, &argv, NULL); | 35 | if (a->esz == 0 && extract32(s->insn, 13, 1)) { |
87 | + | 36 | return false; |
88 | + qtest_start("-machine mps2-an385"); | 37 | } |
89 | + | 38 | - if (sve_access_check(s)) { |
90 | + qtest_add_func("/cmsdk-apb-timer/timer", test_timer); | 39 | - unsigned vsz = vec_full_reg_size(s); |
91 | + | 40 | - tcg_gen_gvec_addi(a->esz, vec_full_reg_offset(s, a->rd), |
92 | + r = g_test_run(); | 41 | - vec_full_reg_offset(s, a->rn), a->imm, vsz, vsz); |
93 | + | 42 | - } |
94 | + qtest_end(); | 43 | - return true; |
95 | + | 44 | + return gen_gvec_fn_arg_zzi(s, tcg_gen_gvec_addi, a); |
96 | + return r; | 45 | } |
97 | +} | 46 | |
98 | diff --git a/MAINTAINERS b/MAINTAINERS | 47 | static bool trans_SUB_zzi(DisasContext *s, arg_rri_esz *a) |
99 | index XXXXXXX..XXXXXXX 100644 | 48 | @@ -XXX,XX +XXX,XX @@ TRANS_FEAT(ADCLT, aa64_sve2, do_adcl, a, true) |
100 | --- a/MAINTAINERS | 49 | |
101 | +++ b/MAINTAINERS | 50 | static bool do_sve2_fn2i(DisasContext *s, arg_rri_esz *a, GVecGen2iFn *fn) |
102 | @@ -XXX,XX +XXX,XX @@ F: include/hw/rtc/pl031.h | 51 | { |
103 | F: include/hw/arm/primecell.h | 52 | - if (a->esz < 0 || !dc_isar_feature(aa64_sve2, s)) { |
104 | F: hw/timer/cmsdk-apb-timer.c | 53 | + if (!dc_isar_feature(aa64_sve2, s)) { |
105 | F: include/hw/timer/cmsdk-apb-timer.h | 54 | return false; |
106 | +F: tests/qtest/cmsdk-apb-timer-test.c | 55 | } |
107 | F: hw/timer/cmsdk-apb-dualtimer.c | 56 | - return gen_gvec_fn_zzi(s, fn, a->esz, a->rd, a->rn, a->imm); |
108 | F: include/hw/timer/cmsdk-apb-dualtimer.h | 57 | + return gen_gvec_fn_arg_zzi(s, fn, a); |
109 | F: hw/char/cmsdk-apb-uart.c | 58 | } |
110 | diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build | 59 | |
111 | index XXXXXXX..XXXXXXX 100644 | 60 | static bool trans_SSRA(DisasContext *s, arg_rri_esz *a) |
112 | --- a/tests/qtest/meson.build | ||
113 | +++ b/tests/qtest/meson.build | ||
114 | @@ -XXX,XX +XXX,XX @@ qtests_npcm7xx = \ | ||
115 | 'npcm7xx_timer-test', | ||
116 | 'npcm7xx_watchdog_timer-test'] | ||
117 | qtests_arm = \ | ||
118 | + (config_all_devices.has_key('CONFIG_CMSDK_APB_TIMER') ? ['cmsdk-apb-timer-test'] : []) + \ | ||
119 | (config_all_devices.has_key('CONFIG_PFLASH_CFI02') ? ['pflash-cfi02-test'] : []) + \ | ||
120 | (config_all_devices.has_key('CONFIG_NPCM7XX') ? qtests_npcm7xx : []) + \ | ||
121 | ['arm-cpu-features', | ||
122 | -- | 61 | -- |
123 | 2.20.1 | 62 | 2.25.1 |
124 | |||
125 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | Convert SVE translation functions using do_sve2_fn2i | ||
4 | to use TRANS_FEAT and gen_gvec_fn_arg_zzi. | ||
5 | |||
6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Message-id: 20220527181907.189259-43-richard.henderson@linaro.org | ||
8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | --- | ||
11 | target/arm/translate-sve.c | 43 ++++++-------------------------------- | ||
12 | 1 file changed, 6 insertions(+), 37 deletions(-) | ||
13 | |||
14 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c | ||
15 | index XXXXXXX..XXXXXXX 100644 | ||
16 | --- a/target/arm/translate-sve.c | ||
17 | +++ b/target/arm/translate-sve.c | ||
18 | @@ -XXX,XX +XXX,XX @@ static bool do_adcl(DisasContext *s, arg_rrrr_esz *a, bool sel) | ||
19 | TRANS_FEAT(ADCLB, aa64_sve2, do_adcl, a, false) | ||
20 | TRANS_FEAT(ADCLT, aa64_sve2, do_adcl, a, true) | ||
21 | |||
22 | -static bool do_sve2_fn2i(DisasContext *s, arg_rri_esz *a, GVecGen2iFn *fn) | ||
23 | -{ | ||
24 | - if (!dc_isar_feature(aa64_sve2, s)) { | ||
25 | - return false; | ||
26 | - } | ||
27 | - return gen_gvec_fn_arg_zzi(s, fn, a); | ||
28 | -} | ||
29 | - | ||
30 | -static bool trans_SSRA(DisasContext *s, arg_rri_esz *a) | ||
31 | -{ | ||
32 | - return do_sve2_fn2i(s, a, gen_gvec_ssra); | ||
33 | -} | ||
34 | - | ||
35 | -static bool trans_USRA(DisasContext *s, arg_rri_esz *a) | ||
36 | -{ | ||
37 | - return do_sve2_fn2i(s, a, gen_gvec_usra); | ||
38 | -} | ||
39 | - | ||
40 | -static bool trans_SRSRA(DisasContext *s, arg_rri_esz *a) | ||
41 | -{ | ||
42 | - return do_sve2_fn2i(s, a, gen_gvec_srsra); | ||
43 | -} | ||
44 | - | ||
45 | -static bool trans_URSRA(DisasContext *s, arg_rri_esz *a) | ||
46 | -{ | ||
47 | - return do_sve2_fn2i(s, a, gen_gvec_ursra); | ||
48 | -} | ||
49 | - | ||
50 | -static bool trans_SRI(DisasContext *s, arg_rri_esz *a) | ||
51 | -{ | ||
52 | - return do_sve2_fn2i(s, a, gen_gvec_sri); | ||
53 | -} | ||
54 | - | ||
55 | -static bool trans_SLI(DisasContext *s, arg_rri_esz *a) | ||
56 | -{ | ||
57 | - return do_sve2_fn2i(s, a, gen_gvec_sli); | ||
58 | -} | ||
59 | +TRANS_FEAT(SSRA, aa64_sve2, gen_gvec_fn_arg_zzi, gen_gvec_ssra, a) | ||
60 | +TRANS_FEAT(USRA, aa64_sve2, gen_gvec_fn_arg_zzi, gen_gvec_usra, a) | ||
61 | +TRANS_FEAT(SRSRA, aa64_sve2, gen_gvec_fn_arg_zzi, gen_gvec_srsra, a) | ||
62 | +TRANS_FEAT(URSRA, aa64_sve2, gen_gvec_fn_arg_zzi, gen_gvec_ursra, a) | ||
63 | +TRANS_FEAT(SRI, aa64_sve2, gen_gvec_fn_arg_zzi, gen_gvec_sri, a) | ||
64 | +TRANS_FEAT(SLI, aa64_sve2, gen_gvec_fn_arg_zzi, gen_gvec_sli, a) | ||
65 | |||
66 | TRANS_FEAT(SABA, aa64_sve2, gen_gvec_fn_arg_zzz, gen_gvec_saba, a) | ||
67 | TRANS_FEAT(UABA, aa64_sve2, gen_gvec_fn_arg_zzz, gen_gvec_uaba, a) | ||
68 | -- | ||
69 | 2.25.1 | diff view generated by jsdifflib |
1 | Remove all the code that sets frequency properties on the CMSDK | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | timer, dualtimer and watchdog devices and on the ARMSSE SoC device: | ||
3 | these properties are unused now that the devices rely on their Clock | ||
4 | inputs instead. | ||
5 | 2 | ||
3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
4 | Message-id: 20220527181907.189259-44-richard.henderson@linaro.org | ||
5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
6 | 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é <f4bug@amsat.org> | ||
8 | Reviewed-by: Luc Michel <luc@lmichel.fr> | ||
9 | Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
10 | Message-id: 20210128114145.20536-24-peter.maydell@linaro.org | ||
11 | Message-id: 20210121190622.22000-24-peter.maydell@linaro.org | ||
12 | --- | 7 | --- |
13 | hw/arm/armsse.c | 7 ------- | 8 | target/arm/translate-sve.c | 20 +++++++------------- |
14 | hw/arm/mps2-tz.c | 1 - | 9 | 1 file changed, 7 insertions(+), 13 deletions(-) |
15 | hw/arm/mps2.c | 3 --- | ||
16 | hw/arm/musca.c | 1 - | ||
17 | hw/arm/stellaris.c | 3 --- | ||
18 | 5 files changed, 15 deletions(-) | ||
19 | 10 | ||
20 | diff --git a/hw/arm/armsse.c b/hw/arm/armsse.c | 11 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c |
21 | index XXXXXXX..XXXXXXX 100644 | 12 | index XXXXXXX..XXXXXXX 100644 |
22 | --- a/hw/arm/armsse.c | 13 | --- a/target/arm/translate-sve.c |
23 | +++ b/hw/arm/armsse.c | 14 | +++ b/target/arm/translate-sve.c |
24 | @@ -XXX,XX +XXX,XX @@ static void armsse_realize(DeviceState *dev, Error **errp) | 15 | @@ -XXX,XX +XXX,XX @@ static bool do_vpz_ool(DisasContext *s, arg_rpr_esz *a, |
25 | * it to the appropriate PPC port; then we can realize the PPC and | 16 | } |
26 | * map its upstream ends to the right place in the container. | 17 | |
27 | */ | 18 | #define DO_VPZ(NAME, name) \ |
28 | - qdev_prop_set_uint32(DEVICE(&s->timer0), "pclk-frq", s->mainclk_frq); | 19 | -static bool trans_##NAME(DisasContext *s, arg_rpr_esz *a) \ |
29 | qdev_connect_clock_in(DEVICE(&s->timer0), "pclk", s->mainclk); | 20 | -{ \ |
30 | if (!sysbus_realize(SYS_BUS_DEVICE(&s->timer0), errp)) { | 21 | - static gen_helper_gvec_reduc * const fns[4] = { \ |
31 | return; | 22 | + static gen_helper_gvec_reduc * const name##_fns[4] = { \ |
32 | @@ -XXX,XX +XXX,XX @@ static void armsse_realize(DeviceState *dev, Error **errp) | 23 | gen_helper_sve_##name##_b, gen_helper_sve_##name##_h, \ |
33 | object_property_set_link(OBJECT(&s->apb_ppc0), "port[0]", OBJECT(mr), | 24 | gen_helper_sve_##name##_s, gen_helper_sve_##name##_d, \ |
34 | &error_abort); | 25 | }; \ |
35 | 26 | - return do_vpz_ool(s, a, fns[a->esz]); \ | |
36 | - qdev_prop_set_uint32(DEVICE(&s->timer1), "pclk-frq", s->mainclk_frq); | 27 | -} |
37 | qdev_connect_clock_in(DEVICE(&s->timer1), "pclk", s->mainclk); | 28 | + TRANS_FEAT(NAME, aa64_sve, do_vpz_ool, a, name##_fns[a->esz]) |
38 | if (!sysbus_realize(SYS_BUS_DEVICE(&s->timer1), errp)) { | 29 | |
39 | return; | 30 | DO_VPZ(ORV, orv) |
40 | @@ -XXX,XX +XXX,XX @@ static void armsse_realize(DeviceState *dev, Error **errp) | 31 | DO_VPZ(ANDV, andv) |
41 | object_property_set_link(OBJECT(&s->apb_ppc0), "port[1]", OBJECT(mr), | 32 | @@ -XXX,XX +XXX,XX @@ DO_VPZ(UMAXV, umaxv) |
42 | &error_abort); | 33 | DO_VPZ(SMINV, sminv) |
43 | 34 | DO_VPZ(UMINV, uminv) | |
44 | - qdev_prop_set_uint32(DEVICE(&s->dualtimer), "pclk-frq", s->mainclk_frq); | 35 | |
45 | qdev_connect_clock_in(DEVICE(&s->dualtimer), "TIMCLK", s->mainclk); | 36 | -static bool trans_SADDV(DisasContext *s, arg_rpr_esz *a) |
46 | if (!sysbus_realize(SYS_BUS_DEVICE(&s->dualtimer), errp)) { | 37 | -{ |
47 | return; | 38 | - static gen_helper_gvec_reduc * const fns[4] = { |
48 | @@ -XXX,XX +XXX,XX @@ static void armsse_realize(DeviceState *dev, Error **errp) | 39 | - gen_helper_sve_saddv_b, gen_helper_sve_saddv_h, |
49 | /* Devices behind APB PPC1: | 40 | - gen_helper_sve_saddv_s, NULL |
50 | * 0x4002f000: S32K timer | 41 | - }; |
51 | */ | 42 | - return do_vpz_ool(s, a, fns[a->esz]); |
52 | - qdev_prop_set_uint32(DEVICE(&s->s32ktimer), "pclk-frq", S32KCLK); | 43 | -} |
53 | qdev_connect_clock_in(DEVICE(&s->s32ktimer), "pclk", s->s32kclk); | 44 | +static gen_helper_gvec_reduc * const saddv_fns[4] = { |
54 | if (!sysbus_realize(SYS_BUS_DEVICE(&s->s32ktimer), errp)) { | 45 | + gen_helper_sve_saddv_b, gen_helper_sve_saddv_h, |
55 | return; | 46 | + gen_helper_sve_saddv_s, NULL |
56 | @@ -XXX,XX +XXX,XX @@ static void armsse_realize(DeviceState *dev, Error **errp) | 47 | +}; |
57 | qdev_connect_gpio_out(DEVICE(&s->nmi_orgate), 0, | 48 | +TRANS_FEAT(SADDV, aa64_sve, do_vpz_ool, a, saddv_fns[a->esz]) |
58 | qdev_get_gpio_in_named(DEVICE(&s->armv7m), "NMI", 0)); | 49 | |
59 | 50 | #undef DO_VPZ | |
60 | - qdev_prop_set_uint32(DEVICE(&s->s32kwatchdog), "wdogclk-frq", S32KCLK); | ||
61 | qdev_connect_clock_in(DEVICE(&s->s32kwatchdog), "WDOGCLK", s->s32kclk); | ||
62 | if (!sysbus_realize(SYS_BUS_DEVICE(&s->s32kwatchdog), errp)) { | ||
63 | return; | ||
64 | @@ -XXX,XX +XXX,XX @@ static void armsse_realize(DeviceState *dev, Error **errp) | ||
65 | |||
66 | /* 0x40080000 .. 0x4008ffff : ARMSSE second Base peripheral region */ | ||
67 | |||
68 | - qdev_prop_set_uint32(DEVICE(&s->nswatchdog), "wdogclk-frq", s->mainclk_frq); | ||
69 | qdev_connect_clock_in(DEVICE(&s->nswatchdog), "WDOGCLK", s->mainclk); | ||
70 | if (!sysbus_realize(SYS_BUS_DEVICE(&s->nswatchdog), errp)) { | ||
71 | return; | ||
72 | @@ -XXX,XX +XXX,XX @@ static void armsse_realize(DeviceState *dev, Error **errp) | ||
73 | armsse_get_common_irq_in(s, 1)); | ||
74 | sysbus_mmio_map(SYS_BUS_DEVICE(&s->nswatchdog), 0, 0x40081000); | ||
75 | |||
76 | - qdev_prop_set_uint32(DEVICE(&s->swatchdog), "wdogclk-frq", s->mainclk_frq); | ||
77 | qdev_connect_clock_in(DEVICE(&s->swatchdog), "WDOGCLK", s->mainclk); | ||
78 | if (!sysbus_realize(SYS_BUS_DEVICE(&s->swatchdog), errp)) { | ||
79 | return; | ||
80 | diff --git a/hw/arm/mps2-tz.c b/hw/arm/mps2-tz.c | ||
81 | index XXXXXXX..XXXXXXX 100644 | ||
82 | --- a/hw/arm/mps2-tz.c | ||
83 | +++ b/hw/arm/mps2-tz.c | ||
84 | @@ -XXX,XX +XXX,XX @@ static void mps2tz_common_init(MachineState *machine) | ||
85 | object_property_set_link(OBJECT(&mms->iotkit), "memory", | ||
86 | OBJECT(system_memory), &error_abort); | ||
87 | qdev_prop_set_uint32(iotkitdev, "EXP_NUMIRQ", MPS2TZ_NUMIRQ); | ||
88 | - qdev_prop_set_uint32(iotkitdev, "MAINCLK_FRQ", SYSCLK_FRQ); | ||
89 | qdev_connect_clock_in(iotkitdev, "MAINCLK", mms->sysclk); | ||
90 | qdev_connect_clock_in(iotkitdev, "S32KCLK", mms->s32kclk); | ||
91 | sysbus_realize(SYS_BUS_DEVICE(&mms->iotkit), &error_fatal); | ||
92 | diff --git a/hw/arm/mps2.c b/hw/arm/mps2.c | ||
93 | index XXXXXXX..XXXXXXX 100644 | ||
94 | --- a/hw/arm/mps2.c | ||
95 | +++ b/hw/arm/mps2.c | ||
96 | @@ -XXX,XX +XXX,XX @@ static void mps2_common_init(MachineState *machine) | ||
97 | object_initialize_child(OBJECT(mms), name, &mms->timer[i], | ||
98 | TYPE_CMSDK_APB_TIMER); | ||
99 | sbd = SYS_BUS_DEVICE(&mms->timer[i]); | ||
100 | - qdev_prop_set_uint32(DEVICE(&mms->timer[i]), "pclk-frq", SYSCLK_FRQ); | ||
101 | qdev_connect_clock_in(DEVICE(&mms->timer[i]), "pclk", mms->sysclk); | ||
102 | sysbus_realize_and_unref(sbd, &error_fatal); | ||
103 | sysbus_mmio_map(sbd, 0, base); | ||
104 | @@ -XXX,XX +XXX,XX @@ static void mps2_common_init(MachineState *machine) | ||
105 | |||
106 | object_initialize_child(OBJECT(mms), "dualtimer", &mms->dualtimer, | ||
107 | TYPE_CMSDK_APB_DUALTIMER); | ||
108 | - qdev_prop_set_uint32(DEVICE(&mms->dualtimer), "pclk-frq", SYSCLK_FRQ); | ||
109 | qdev_connect_clock_in(DEVICE(&mms->dualtimer), "TIMCLK", mms->sysclk); | ||
110 | sysbus_realize(SYS_BUS_DEVICE(&mms->dualtimer), &error_fatal); | ||
111 | sysbus_connect_irq(SYS_BUS_DEVICE(&mms->dualtimer), 0, | ||
112 | @@ -XXX,XX +XXX,XX @@ static void mps2_common_init(MachineState *machine) | ||
113 | sysbus_mmio_map(SYS_BUS_DEVICE(&mms->dualtimer), 0, 0x40002000); | ||
114 | object_initialize_child(OBJECT(mms), "watchdog", &mms->watchdog, | ||
115 | TYPE_CMSDK_APB_WATCHDOG); | ||
116 | - qdev_prop_set_uint32(DEVICE(&mms->watchdog), "wdogclk-frq", SYSCLK_FRQ); | ||
117 | qdev_connect_clock_in(DEVICE(&mms->watchdog), "WDOGCLK", mms->sysclk); | ||
118 | sysbus_realize(SYS_BUS_DEVICE(&mms->watchdog), &error_fatal); | ||
119 | sysbus_connect_irq(SYS_BUS_DEVICE(&mms->watchdog), 0, | ||
120 | diff --git a/hw/arm/musca.c b/hw/arm/musca.c | ||
121 | index XXXXXXX..XXXXXXX 100644 | ||
122 | --- a/hw/arm/musca.c | ||
123 | +++ b/hw/arm/musca.c | ||
124 | @@ -XXX,XX +XXX,XX @@ static void musca_init(MachineState *machine) | ||
125 | qdev_prop_set_uint32(ssedev, "EXP_NUMIRQ", mmc->num_irqs); | ||
126 | qdev_prop_set_uint32(ssedev, "init-svtor", mmc->init_svtor); | ||
127 | qdev_prop_set_uint32(ssedev, "SRAM_ADDR_WIDTH", mmc->sram_addr_width); | ||
128 | - qdev_prop_set_uint32(ssedev, "MAINCLK_FRQ", SYSCLK_FRQ); | ||
129 | qdev_connect_clock_in(ssedev, "MAINCLK", mms->sysclk); | ||
130 | qdev_connect_clock_in(ssedev, "S32KCLK", mms->s32kclk); | ||
131 | /* | ||
132 | diff --git a/hw/arm/stellaris.c b/hw/arm/stellaris.c | ||
133 | index XXXXXXX..XXXXXXX 100644 | ||
134 | --- a/hw/arm/stellaris.c | ||
135 | +++ b/hw/arm/stellaris.c | ||
136 | @@ -XXX,XX +XXX,XX @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board) | ||
137 | if (board->dc1 & (1 << 3)) { /* watchdog present */ | ||
138 | dev = qdev_new(TYPE_LUMINARY_WATCHDOG); | ||
139 | |||
140 | - /* system_clock_scale is valid now */ | ||
141 | - uint32_t mainclk = NANOSECONDS_PER_SECOND / system_clock_scale; | ||
142 | - qdev_prop_set_uint32(dev, "wdogclk-frq", mainclk); | ||
143 | qdev_connect_clock_in(dev, "WDOGCLK", | ||
144 | qdev_get_clock_out(ssys_dev, "SYSCLK")); | ||
145 | 51 | ||
146 | -- | 52 | -- |
147 | 2.20.1 | 53 | 2.25.1 |
148 | |||
149 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
4 | Message-id: 20220527181907.189259-45-richard.henderson@linaro.org | ||
5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | --- | ||
8 | target/arm/translate-sve.c | 17 +++-------------- | ||
9 | 1 file changed, 3 insertions(+), 14 deletions(-) | ||
10 | |||
11 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c | ||
12 | index XXXXXXX..XXXXXXX 100644 | ||
13 | --- a/target/arm/translate-sve.c | ||
14 | +++ b/target/arm/translate-sve.c | ||
15 | @@ -XXX,XX +XXX,XX @@ static bool do_shift_imm(DisasContext *s, arg_rri_esz *a, bool asr, | ||
16 | return true; | ||
17 | } | ||
18 | |||
19 | -static bool trans_ASR_zzi(DisasContext *s, arg_rri_esz *a) | ||
20 | -{ | ||
21 | - return do_shift_imm(s, a, true, tcg_gen_gvec_sari); | ||
22 | -} | ||
23 | - | ||
24 | -static bool trans_LSR_zzi(DisasContext *s, arg_rri_esz *a) | ||
25 | -{ | ||
26 | - return do_shift_imm(s, a, false, tcg_gen_gvec_shri); | ||
27 | -} | ||
28 | - | ||
29 | -static bool trans_LSL_zzi(DisasContext *s, arg_rri_esz *a) | ||
30 | -{ | ||
31 | - return do_shift_imm(s, a, false, tcg_gen_gvec_shli); | ||
32 | -} | ||
33 | +TRANS_FEAT(ASR_zzi, aa64_sve, do_shift_imm, a, true, tcg_gen_gvec_sari) | ||
34 | +TRANS_FEAT(LSR_zzi, aa64_sve, do_shift_imm, a, false, tcg_gen_gvec_shri) | ||
35 | +TRANS_FEAT(LSL_zzi, aa64_sve, do_shift_imm, a, false, tcg_gen_gvec_shli) | ||
36 | |||
37 | #define DO_ZZW(NAME, name) \ | ||
38 | static gen_helper_gvec_3 * const name##_zzw_fns[4] = { \ | ||
39 | -- | ||
40 | 2.25.1 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Only define the register if it exists for the cpu. | 3 | Share code between the various shifts using arg_rpri_esz. |
4 | 4 | ||
5 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 5 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
6 | Message-id: 20210120031656.737646-1-richard.henderson@linaro.org | 6 | Message-id: 20220527181907.189259-46-richard.henderson@linaro.org |
7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
9 | --- | 9 | --- |
10 | target/arm/helper.c | 21 +++++++++++++++------ | 10 | target/arm/translate-sve.c | 68 +++++++++++++++++--------------------- |
11 | 1 file changed, 15 insertions(+), 6 deletions(-) | 11 | 1 file changed, 30 insertions(+), 38 deletions(-) |
12 | 12 | ||
13 | diff --git a/target/arm/helper.c b/target/arm/helper.c | 13 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c |
14 | index XXXXXXX..XXXXXXX 100644 | 14 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/target/arm/helper.c | 15 | --- a/target/arm/translate-sve.c |
16 | +++ b/target/arm/helper.c | 16 | +++ b/target/arm/translate-sve.c |
17 | @@ -XXX,XX +XXX,XX @@ static void define_debug_regs(ARMCPU *cpu) | 17 | @@ -XXX,XX +XXX,XX @@ static bool do_movz_zpz(DisasContext *s, int rd, int rn, int pg, |
18 | */ | 18 | return gen_gvec_ool_zzp(s, fns[esz], rd, rn, pg, invert); |
19 | int i; | 19 | } |
20 | int wrps, brps, ctx_cmps; | 20 | |
21 | - ARMCPRegInfo dbgdidr = { | 21 | +static bool do_shift_zpzi(DisasContext *s, arg_rpri_esz *a, bool asr, |
22 | - .name = "DBGDIDR", .cp = 14, .crn = 0, .crm = 0, .opc1 = 0, .opc2 = 0, | 22 | + gen_helper_gvec_3 * const fns[4]) |
23 | - .access = PL0_R, .accessfn = access_tda, | 23 | +{ |
24 | - .type = ARM_CP_CONST, .resetvalue = cpu->isar.dbgdidr, | 24 | + int max; |
25 | - }; | 25 | + |
26 | + if (a->esz < 0) { | ||
27 | + /* Invalid tsz encoding -- see tszimm_esz. */ | ||
28 | + return false; | ||
29 | + } | ||
26 | + | 30 | + |
27 | + /* | 31 | + /* |
28 | + * The Arm ARM says DBGDIDR is optional and deprecated if EL1 cannot | 32 | + * Shift by element size is architecturally valid. |
29 | + * use AArch32. Given that bit 15 is RES1, if the value is 0 then | 33 | + * For arithmetic right-shift, it's the same as by one less. |
30 | + * the register must not exist for this cpu. | 34 | + * For logical shifts and ASRD, it is a zeroing operation. |
31 | + */ | 35 | + */ |
32 | + if (cpu->isar.dbgdidr != 0) { | 36 | + max = 8 << a->esz; |
33 | + ARMCPRegInfo dbgdidr = { | 37 | + if (a->imm >= max) { |
34 | + .name = "DBGDIDR", .cp = 14, .crn = 0, .crm = 0, | 38 | + if (asr) { |
35 | + .opc1 = 0, .opc2 = 0, | 39 | + a->imm = max - 1; |
36 | + .access = PL0_R, .accessfn = access_tda, | 40 | + } else { |
37 | + .type = ARM_CP_CONST, .resetvalue = cpu->isar.dbgdidr, | 41 | + return do_movz_zpz(s, a->rd, a->rd, a->pg, a->esz, true); |
38 | + }; | 42 | + } |
39 | + define_one_arm_cp_reg(cpu, &dbgdidr); | ||
40 | + } | 43 | + } |
41 | 44 | + return gen_gvec_ool_arg_zpzi(s, fns[a->esz], a); | |
42 | /* Note that all these register fields hold "number of Xs minus 1". */ | 45 | +} |
43 | brps = arm_num_brps(cpu); | 46 | + |
44 | @@ -XXX,XX +XXX,XX @@ static void define_debug_regs(ARMCPU *cpu) | 47 | static bool trans_ASR_zpzi(DisasContext *s, arg_rpri_esz *a) |
45 | 48 | { | |
46 | assert(ctx_cmps <= brps); | 49 | static gen_helper_gvec_3 * const fns[4] = { |
47 | 50 | gen_helper_sve_asr_zpzi_b, gen_helper_sve_asr_zpzi_h, | |
48 | - define_one_arm_cp_reg(cpu, &dbgdidr); | 51 | gen_helper_sve_asr_zpzi_s, gen_helper_sve_asr_zpzi_d, |
49 | define_arm_cp_regs(cpu, debug_cp_reginfo); | 52 | }; |
50 | 53 | - if (a->esz < 0) { | |
51 | if (arm_feature(&cpu->env, ARM_FEATURE_LPAE)) { | 54 | - /* Invalid tsz encoding -- see tszimm_esz. */ |
55 | - return false; | ||
56 | - } | ||
57 | - /* Shift by element size is architecturally valid. For | ||
58 | - arithmetic right-shift, it's the same as by one less. */ | ||
59 | - a->imm = MIN(a->imm, (8 << a->esz) - 1); | ||
60 | - return gen_gvec_ool_arg_zpzi(s, fns[a->esz], a); | ||
61 | + return do_shift_zpzi(s, a, true, fns); | ||
62 | } | ||
63 | |||
64 | static bool trans_LSR_zpzi(DisasContext *s, arg_rpri_esz *a) | ||
65 | @@ -XXX,XX +XXX,XX @@ static bool trans_LSR_zpzi(DisasContext *s, arg_rpri_esz *a) | ||
66 | gen_helper_sve_lsr_zpzi_b, gen_helper_sve_lsr_zpzi_h, | ||
67 | gen_helper_sve_lsr_zpzi_s, gen_helper_sve_lsr_zpzi_d, | ||
68 | }; | ||
69 | - if (a->esz < 0) { | ||
70 | - return false; | ||
71 | - } | ||
72 | - /* Shift by element size is architecturally valid. | ||
73 | - For logical shifts, it is a zeroing operation. */ | ||
74 | - if (a->imm >= (8 << a->esz)) { | ||
75 | - return do_movz_zpz(s, a->rd, a->rd, a->pg, a->esz, true); | ||
76 | - } else { | ||
77 | - return gen_gvec_ool_arg_zpzi(s, fns[a->esz], a); | ||
78 | - } | ||
79 | + return do_shift_zpzi(s, a, false, fns); | ||
80 | } | ||
81 | |||
82 | static bool trans_LSL_zpzi(DisasContext *s, arg_rpri_esz *a) | ||
83 | @@ -XXX,XX +XXX,XX @@ static bool trans_LSL_zpzi(DisasContext *s, arg_rpri_esz *a) | ||
84 | gen_helper_sve_lsl_zpzi_b, gen_helper_sve_lsl_zpzi_h, | ||
85 | gen_helper_sve_lsl_zpzi_s, gen_helper_sve_lsl_zpzi_d, | ||
86 | }; | ||
87 | - if (a->esz < 0) { | ||
88 | - return false; | ||
89 | - } | ||
90 | - /* Shift by element size is architecturally valid. | ||
91 | - For logical shifts, it is a zeroing operation. */ | ||
92 | - if (a->imm >= (8 << a->esz)) { | ||
93 | - return do_movz_zpz(s, a->rd, a->rd, a->pg, a->esz, true); | ||
94 | - } else { | ||
95 | - return gen_gvec_ool_arg_zpzi(s, fns[a->esz], a); | ||
96 | - } | ||
97 | + return do_shift_zpzi(s, a, false, fns); | ||
98 | } | ||
99 | |||
100 | static bool trans_ASRD(DisasContext *s, arg_rpri_esz *a) | ||
101 | @@ -XXX,XX +XXX,XX @@ static bool trans_ASRD(DisasContext *s, arg_rpri_esz *a) | ||
102 | gen_helper_sve_asrd_b, gen_helper_sve_asrd_h, | ||
103 | gen_helper_sve_asrd_s, gen_helper_sve_asrd_d, | ||
104 | }; | ||
105 | - if (a->esz < 0) { | ||
106 | - return false; | ||
107 | - } | ||
108 | - /* Shift by element size is architecturally valid. For arithmetic | ||
109 | - right shift for division, it is a zeroing operation. */ | ||
110 | - if (a->imm >= (8 << a->esz)) { | ||
111 | - return do_movz_zpz(s, a->rd, a->rd, a->pg, a->esz, true); | ||
112 | - } else { | ||
113 | - return gen_gvec_ool_arg_zpzi(s, fns[a->esz], a); | ||
114 | - } | ||
115 | + return do_shift_zpzi(s, a, false, fns); | ||
116 | } | ||
117 | |||
118 | static gen_helper_gvec_3 * const sqshl_zpzi_fns[4] = { | ||
52 | -- | 119 | -- |
53 | 2.20.1 | 120 | 2.25.1 |
54 | |||
55 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
4 | Message-id: 20220527181907.189259-47-richard.henderson@linaro.org | ||
5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | --- | ||
8 | target/arm/translate-sve.c | 52 +++++++++++++++----------------------- | ||
9 | 1 file changed, 20 insertions(+), 32 deletions(-) | ||
10 | |||
11 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c | ||
12 | index XXXXXXX..XXXXXXX 100644 | ||
13 | --- a/target/arm/translate-sve.c | ||
14 | +++ b/target/arm/translate-sve.c | ||
15 | @@ -XXX,XX +XXX,XX @@ static bool do_shift_zpzi(DisasContext *s, arg_rpri_esz *a, bool asr, | ||
16 | return gen_gvec_ool_arg_zpzi(s, fns[a->esz], a); | ||
17 | } | ||
18 | |||
19 | -static bool trans_ASR_zpzi(DisasContext *s, arg_rpri_esz *a) | ||
20 | -{ | ||
21 | - static gen_helper_gvec_3 * const fns[4] = { | ||
22 | - gen_helper_sve_asr_zpzi_b, gen_helper_sve_asr_zpzi_h, | ||
23 | - gen_helper_sve_asr_zpzi_s, gen_helper_sve_asr_zpzi_d, | ||
24 | - }; | ||
25 | - return do_shift_zpzi(s, a, true, fns); | ||
26 | -} | ||
27 | +static gen_helper_gvec_3 * const asr_zpzi_fns[4] = { | ||
28 | + gen_helper_sve_asr_zpzi_b, gen_helper_sve_asr_zpzi_h, | ||
29 | + gen_helper_sve_asr_zpzi_s, gen_helper_sve_asr_zpzi_d, | ||
30 | +}; | ||
31 | +TRANS_FEAT(ASR_zpzi, aa64_sve, do_shift_zpzi, a, true, asr_zpzi_fns) | ||
32 | |||
33 | -static bool trans_LSR_zpzi(DisasContext *s, arg_rpri_esz *a) | ||
34 | -{ | ||
35 | - static gen_helper_gvec_3 * const fns[4] = { | ||
36 | - gen_helper_sve_lsr_zpzi_b, gen_helper_sve_lsr_zpzi_h, | ||
37 | - gen_helper_sve_lsr_zpzi_s, gen_helper_sve_lsr_zpzi_d, | ||
38 | - }; | ||
39 | - return do_shift_zpzi(s, a, false, fns); | ||
40 | -} | ||
41 | +static gen_helper_gvec_3 * const lsr_zpzi_fns[4] = { | ||
42 | + gen_helper_sve_lsr_zpzi_b, gen_helper_sve_lsr_zpzi_h, | ||
43 | + gen_helper_sve_lsr_zpzi_s, gen_helper_sve_lsr_zpzi_d, | ||
44 | +}; | ||
45 | +TRANS_FEAT(LSR_zpzi, aa64_sve, do_shift_zpzi, a, false, lsr_zpzi_fns) | ||
46 | |||
47 | -static bool trans_LSL_zpzi(DisasContext *s, arg_rpri_esz *a) | ||
48 | -{ | ||
49 | - static gen_helper_gvec_3 * const fns[4] = { | ||
50 | - gen_helper_sve_lsl_zpzi_b, gen_helper_sve_lsl_zpzi_h, | ||
51 | - gen_helper_sve_lsl_zpzi_s, gen_helper_sve_lsl_zpzi_d, | ||
52 | - }; | ||
53 | - return do_shift_zpzi(s, a, false, fns); | ||
54 | -} | ||
55 | +static gen_helper_gvec_3 * const lsl_zpzi_fns[4] = { | ||
56 | + gen_helper_sve_lsl_zpzi_b, gen_helper_sve_lsl_zpzi_h, | ||
57 | + gen_helper_sve_lsl_zpzi_s, gen_helper_sve_lsl_zpzi_d, | ||
58 | +}; | ||
59 | +TRANS_FEAT(LSL_zpzi, aa64_sve, do_shift_zpzi, a, false, lsl_zpzi_fns) | ||
60 | |||
61 | -static bool trans_ASRD(DisasContext *s, arg_rpri_esz *a) | ||
62 | -{ | ||
63 | - static gen_helper_gvec_3 * const fns[4] = { | ||
64 | - gen_helper_sve_asrd_b, gen_helper_sve_asrd_h, | ||
65 | - gen_helper_sve_asrd_s, gen_helper_sve_asrd_d, | ||
66 | - }; | ||
67 | - return do_shift_zpzi(s, a, false, fns); | ||
68 | -} | ||
69 | +static gen_helper_gvec_3 * const asrd_fns[4] = { | ||
70 | + gen_helper_sve_asrd_b, gen_helper_sve_asrd_h, | ||
71 | + gen_helper_sve_asrd_s, gen_helper_sve_asrd_d, | ||
72 | +}; | ||
73 | +TRANS_FEAT(ASRD, aa64_sve, do_shift_zpzi, a, false, asrd_fns) | ||
74 | |||
75 | static gen_helper_gvec_3 * const sqshl_zpzi_fns[4] = { | ||
76 | gen_helper_sve2_sqshl_zpzi_b, gen_helper_sve2_sqshl_zpzi_h, | ||
77 | -- | ||
78 | 2.25.1 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | Remove the DO_ZPZZZ macro, as it had just the two uses. | ||
4 | |||
5 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
6 | Message-id: 20220527181907.189259-48-richard.henderson@linaro.org | ||
7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
9 | --- | ||
10 | target/arm/translate-sve.c | 23 ++++++++++------------- | ||
11 | 1 file changed, 10 insertions(+), 13 deletions(-) | ||
12 | |||
13 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c | ||
14 | index XXXXXXX..XXXXXXX 100644 | ||
15 | --- a/target/arm/translate-sve.c | ||
16 | +++ b/target/arm/translate-sve.c | ||
17 | @@ -XXX,XX +XXX,XX @@ static bool do_zpzzz_ool(DisasContext *s, arg_rprrr_esz *a, | ||
18 | return true; | ||
19 | } | ||
20 | |||
21 | -#define DO_ZPZZZ(NAME, name) \ | ||
22 | -static bool trans_##NAME(DisasContext *s, arg_rprrr_esz *a) \ | ||
23 | -{ \ | ||
24 | - static gen_helper_gvec_5 * const fns[4] = { \ | ||
25 | - gen_helper_sve_##name##_b, gen_helper_sve_##name##_h, \ | ||
26 | - gen_helper_sve_##name##_s, gen_helper_sve_##name##_d, \ | ||
27 | - }; \ | ||
28 | - return do_zpzzz_ool(s, a, fns[a->esz]); \ | ||
29 | -} | ||
30 | +static gen_helper_gvec_5 * const mla_fns[4] = { | ||
31 | + gen_helper_sve_mla_b, gen_helper_sve_mla_h, | ||
32 | + gen_helper_sve_mla_s, gen_helper_sve_mla_d, | ||
33 | +}; | ||
34 | +TRANS_FEAT(MLA, aa64_sve, do_zpzzz_ool, a, mla_fns[a->esz]) | ||
35 | |||
36 | -DO_ZPZZZ(MLA, mla) | ||
37 | -DO_ZPZZZ(MLS, mls) | ||
38 | - | ||
39 | -#undef DO_ZPZZZ | ||
40 | +static gen_helper_gvec_5 * const mls_fns[4] = { | ||
41 | + gen_helper_sve_mls_b, gen_helper_sve_mls_h, | ||
42 | + gen_helper_sve_mls_s, gen_helper_sve_mls_d, | ||
43 | +}; | ||
44 | +TRANS_FEAT(MLS, aa64_sve, do_zpzzz_ool, a, mls_fns[a->esz]) | ||
45 | |||
46 | /* | ||
47 | *** SVE Index Generation Group | ||
48 | -- | ||
49 | 2.25.1 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
4 | Message-id: 20220527181907.189259-49-richard.henderson@linaro.org | ||
5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | --- | ||
8 | target/arm/translate-sve.c | 53 ++++++++++++++++++-------------------- | ||
9 | 1 file changed, 25 insertions(+), 28 deletions(-) | ||
10 | |||
11 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c | ||
12 | index XXXXXXX..XXXXXXX 100644 | ||
13 | --- a/target/arm/translate-sve.c | ||
14 | +++ b/target/arm/translate-sve.c | ||
15 | @@ -XXX,XX +XXX,XX @@ TRANS_FEAT(MLS, aa64_sve, do_zpzzz_ool, a, mls_fns[a->esz]) | ||
16 | *** SVE Index Generation Group | ||
17 | */ | ||
18 | |||
19 | -static void do_index(DisasContext *s, int esz, int rd, | ||
20 | +static bool do_index(DisasContext *s, int esz, int rd, | ||
21 | TCGv_i64 start, TCGv_i64 incr) | ||
22 | { | ||
23 | - unsigned vsz = vec_full_reg_size(s); | ||
24 | - TCGv_i32 desc = tcg_constant_i32(simd_desc(vsz, vsz, 0)); | ||
25 | - TCGv_ptr t_zd = tcg_temp_new_ptr(); | ||
26 | + unsigned vsz; | ||
27 | + TCGv_i32 desc; | ||
28 | + TCGv_ptr t_zd; | ||
29 | + | ||
30 | + if (!sve_access_check(s)) { | ||
31 | + return true; | ||
32 | + } | ||
33 | + | ||
34 | + vsz = vec_full_reg_size(s); | ||
35 | + desc = tcg_constant_i32(simd_desc(vsz, vsz, 0)); | ||
36 | + t_zd = tcg_temp_new_ptr(); | ||
37 | |||
38 | tcg_gen_addi_ptr(t_zd, cpu_env, vec_full_reg_offset(s, rd)); | ||
39 | if (esz == 3) { | ||
40 | @@ -XXX,XX +XXX,XX @@ static void do_index(DisasContext *s, int esz, int rd, | ||
41 | tcg_temp_free_i32(i32); | ||
42 | } | ||
43 | tcg_temp_free_ptr(t_zd); | ||
44 | + return true; | ||
45 | } | ||
46 | |||
47 | static bool trans_INDEX_ii(DisasContext *s, arg_INDEX_ii *a) | ||
48 | { | ||
49 | - if (sve_access_check(s)) { | ||
50 | - TCGv_i64 start = tcg_constant_i64(a->imm1); | ||
51 | - TCGv_i64 incr = tcg_constant_i64(a->imm2); | ||
52 | - do_index(s, a->esz, a->rd, start, incr); | ||
53 | - } | ||
54 | - return true; | ||
55 | + TCGv_i64 start = tcg_constant_i64(a->imm1); | ||
56 | + TCGv_i64 incr = tcg_constant_i64(a->imm2); | ||
57 | + return do_index(s, a->esz, a->rd, start, incr); | ||
58 | } | ||
59 | |||
60 | static bool trans_INDEX_ir(DisasContext *s, arg_INDEX_ir *a) | ||
61 | { | ||
62 | - if (sve_access_check(s)) { | ||
63 | - TCGv_i64 start = tcg_constant_i64(a->imm); | ||
64 | - TCGv_i64 incr = cpu_reg(s, a->rm); | ||
65 | - do_index(s, a->esz, a->rd, start, incr); | ||
66 | - } | ||
67 | - return true; | ||
68 | + TCGv_i64 start = tcg_constant_i64(a->imm); | ||
69 | + TCGv_i64 incr = cpu_reg(s, a->rm); | ||
70 | + return do_index(s, a->esz, a->rd, start, incr); | ||
71 | } | ||
72 | |||
73 | static bool trans_INDEX_ri(DisasContext *s, arg_INDEX_ri *a) | ||
74 | { | ||
75 | - if (sve_access_check(s)) { | ||
76 | - TCGv_i64 start = cpu_reg(s, a->rn); | ||
77 | - TCGv_i64 incr = tcg_constant_i64(a->imm); | ||
78 | - do_index(s, a->esz, a->rd, start, incr); | ||
79 | - } | ||
80 | - return true; | ||
81 | + TCGv_i64 start = cpu_reg(s, a->rn); | ||
82 | + TCGv_i64 incr = tcg_constant_i64(a->imm); | ||
83 | + return do_index(s, a->esz, a->rd, start, incr); | ||
84 | } | ||
85 | |||
86 | static bool trans_INDEX_rr(DisasContext *s, arg_INDEX_rr *a) | ||
87 | { | ||
88 | - if (sve_access_check(s)) { | ||
89 | - TCGv_i64 start = cpu_reg(s, a->rn); | ||
90 | - TCGv_i64 incr = cpu_reg(s, a->rm); | ||
91 | - do_index(s, a->esz, a->rd, start, incr); | ||
92 | - } | ||
93 | - return true; | ||
94 | + TCGv_i64 start = cpu_reg(s, a->rn); | ||
95 | + TCGv_i64 incr = cpu_reg(s, a->rm); | ||
96 | + return do_index(s, a->esz, a->rd, start, incr); | ||
97 | } | ||
98 | |||
99 | /* | ||
100 | -- | ||
101 | 2.25.1 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
4 | Message-id: 20220527181907.189259-50-richard.henderson@linaro.org | ||
5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | --- | ||
8 | target/arm/translate-sve.c | 35 ++++++++--------------------------- | ||
9 | 1 file changed, 8 insertions(+), 27 deletions(-) | ||
10 | |||
11 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c | ||
12 | index XXXXXXX..XXXXXXX 100644 | ||
13 | --- a/target/arm/translate-sve.c | ||
14 | +++ b/target/arm/translate-sve.c | ||
15 | @@ -XXX,XX +XXX,XX @@ static bool do_index(DisasContext *s, int esz, int rd, | ||
16 | return true; | ||
17 | } | ||
18 | |||
19 | -static bool trans_INDEX_ii(DisasContext *s, arg_INDEX_ii *a) | ||
20 | -{ | ||
21 | - TCGv_i64 start = tcg_constant_i64(a->imm1); | ||
22 | - TCGv_i64 incr = tcg_constant_i64(a->imm2); | ||
23 | - return do_index(s, a->esz, a->rd, start, incr); | ||
24 | -} | ||
25 | - | ||
26 | -static bool trans_INDEX_ir(DisasContext *s, arg_INDEX_ir *a) | ||
27 | -{ | ||
28 | - TCGv_i64 start = tcg_constant_i64(a->imm); | ||
29 | - TCGv_i64 incr = cpu_reg(s, a->rm); | ||
30 | - return do_index(s, a->esz, a->rd, start, incr); | ||
31 | -} | ||
32 | - | ||
33 | -static bool trans_INDEX_ri(DisasContext *s, arg_INDEX_ri *a) | ||
34 | -{ | ||
35 | - TCGv_i64 start = cpu_reg(s, a->rn); | ||
36 | - TCGv_i64 incr = tcg_constant_i64(a->imm); | ||
37 | - return do_index(s, a->esz, a->rd, start, incr); | ||
38 | -} | ||
39 | - | ||
40 | -static bool trans_INDEX_rr(DisasContext *s, arg_INDEX_rr *a) | ||
41 | -{ | ||
42 | - TCGv_i64 start = cpu_reg(s, a->rn); | ||
43 | - TCGv_i64 incr = cpu_reg(s, a->rm); | ||
44 | - return do_index(s, a->esz, a->rd, start, incr); | ||
45 | -} | ||
46 | +TRANS_FEAT(INDEX_ii, aa64_sve, do_index, a->esz, a->rd, | ||
47 | + tcg_constant_i64(a->imm1), tcg_constant_i64(a->imm2)) | ||
48 | +TRANS_FEAT(INDEX_ir, aa64_sve, do_index, a->esz, a->rd, | ||
49 | + tcg_constant_i64(a->imm), cpu_reg(s, a->rm)) | ||
50 | +TRANS_FEAT(INDEX_ri, aa64_sve, do_index, a->esz, a->rd, | ||
51 | + cpu_reg(s, a->rn), tcg_constant_i64(a->imm)) | ||
52 | +TRANS_FEAT(INDEX_rr, aa64_sve, do_index, a->esz, a->rd, | ||
53 | + cpu_reg(s, a->rn), cpu_reg(s, a->rm)) | ||
54 | |||
55 | /* | ||
56 | *** SVE Stack Allocation Group | ||
57 | -- | ||
58 | 2.25.1 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
4 | Message-id: 20220527181907.189259-51-richard.henderson@linaro.org | ||
5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | --- | ||
8 | target/arm/translate-sve.c | 23 ++++------------------- | ||
9 | 1 file changed, 4 insertions(+), 19 deletions(-) | ||
10 | |||
11 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c | ||
12 | index XXXXXXX..XXXXXXX 100644 | ||
13 | --- a/target/arm/translate-sve.c | ||
14 | +++ b/target/arm/translate-sve.c | ||
15 | @@ -XXX,XX +XXX,XX @@ static bool do_adr(DisasContext *s, arg_rrri *a, gen_helper_gvec_3 *fn) | ||
16 | return gen_gvec_ool_zzz(s, fn, a->rd, a->rn, a->rm, a->imm); | ||
17 | } | ||
18 | |||
19 | -static bool trans_ADR_p32(DisasContext *s, arg_rrri *a) | ||
20 | -{ | ||
21 | - return do_adr(s, a, gen_helper_sve_adr_p32); | ||
22 | -} | ||
23 | - | ||
24 | -static bool trans_ADR_p64(DisasContext *s, arg_rrri *a) | ||
25 | -{ | ||
26 | - return do_adr(s, a, gen_helper_sve_adr_p64); | ||
27 | -} | ||
28 | - | ||
29 | -static bool trans_ADR_s32(DisasContext *s, arg_rrri *a) | ||
30 | -{ | ||
31 | - return do_adr(s, a, gen_helper_sve_adr_s32); | ||
32 | -} | ||
33 | - | ||
34 | -static bool trans_ADR_u32(DisasContext *s, arg_rrri *a) | ||
35 | -{ | ||
36 | - return do_adr(s, a, gen_helper_sve_adr_u32); | ||
37 | -} | ||
38 | +TRANS_FEAT(ADR_p32, aa64_sve, do_adr, a, gen_helper_sve_adr_p32) | ||
39 | +TRANS_FEAT(ADR_p64, aa64_sve, do_adr, a, gen_helper_sve_adr_p64) | ||
40 | +TRANS_FEAT(ADR_s32, aa64_sve, do_adr, a, gen_helper_sve_adr_s32) | ||
41 | +TRANS_FEAT(ADR_u32, aa64_sve, do_adr, a, gen_helper_sve_adr_u32) | ||
42 | |||
43 | /* | ||
44 | *** SVE Integer Misc - Unpredicated Group | ||
45 | -- | ||
46 | 2.25.1 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
4 | Message-id: 20220527181907.189259-52-richard.henderson@linaro.org | ||
5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | --- | ||
8 | target/arm/translate-sve.c | 19 +++++-------------- | ||
9 | 1 file changed, 5 insertions(+), 14 deletions(-) | ||
10 | |||
11 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c | ||
12 | index XXXXXXX..XXXXXXX 100644 | ||
13 | --- a/target/arm/translate-sve.c | ||
14 | +++ b/target/arm/translate-sve.c | ||
15 | @@ -XXX,XX +XXX,XX @@ static bool do_predset(DisasContext *s, int esz, int rd, int pat, bool setflag) | ||
16 | return true; | ||
17 | } | ||
18 | |||
19 | -static bool trans_PTRUE(DisasContext *s, arg_PTRUE *a) | ||
20 | -{ | ||
21 | - return do_predset(s, a->esz, a->rd, a->pat, a->s); | ||
22 | -} | ||
23 | +TRANS_FEAT(PTRUE, aa64_sve, do_predset, a->esz, a->rd, a->pat, a->s) | ||
24 | |||
25 | -static bool trans_SETFFR(DisasContext *s, arg_SETFFR *a) | ||
26 | -{ | ||
27 | - /* Note pat == 31 is #all, to set all elements. */ | ||
28 | - return do_predset(s, 0, FFR_PRED_NUM, 31, false); | ||
29 | -} | ||
30 | +/* Note pat == 31 is #all, to set all elements. */ | ||
31 | +TRANS_FEAT(SETFFR, aa64_sve, do_predset, 0, FFR_PRED_NUM, 31, false) | ||
32 | |||
33 | -static bool trans_PFALSE(DisasContext *s, arg_PFALSE *a) | ||
34 | -{ | ||
35 | - /* Note pat == 32 is #unimp, to set no elements. */ | ||
36 | - return do_predset(s, 0, a->rd, 32, false); | ||
37 | -} | ||
38 | +/* Note pat == 32 is #unimp, to set no elements. */ | ||
39 | +TRANS_FEAT(PFALSE, aa64_sve, do_predset, 0, a->rd, 32, false) | ||
40 | |||
41 | static bool trans_RDFFR_p(DisasContext *s, arg_RDFFR_p *a) | ||
42 | { | ||
43 | -- | ||
44 | 2.25.1 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
4 | Message-id: 20220527181907.189259-53-richard.henderson@linaro.org | ||
5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | --- | ||
8 | target/arm/translate-sve.c | 11 ++--------- | ||
9 | 1 file changed, 2 insertions(+), 9 deletions(-) | ||
10 | |||
11 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c | ||
12 | index XXXXXXX..XXXXXXX 100644 | ||
13 | --- a/target/arm/translate-sve.c | ||
14 | +++ b/target/arm/translate-sve.c | ||
15 | @@ -XXX,XX +XXX,XX @@ static bool trans_RDFFR_p(DisasContext *s, arg_RDFFR_p *a) | ||
16 | return trans_AND_pppp(s, &alt_a); | ||
17 | } | ||
18 | |||
19 | -static bool trans_RDFFR(DisasContext *s, arg_RDFFR *a) | ||
20 | -{ | ||
21 | - return do_mov_p(s, a->rd, FFR_PRED_NUM); | ||
22 | -} | ||
23 | - | ||
24 | -static bool trans_WRFFR(DisasContext *s, arg_WRFFR *a) | ||
25 | -{ | ||
26 | - return do_mov_p(s, FFR_PRED_NUM, a->rn); | ||
27 | -} | ||
28 | +TRANS_FEAT(RDFFR, aa64_sve, do_mov_p, a->rd, FFR_PRED_NUM) | ||
29 | +TRANS_FEAT(WRFFR, aa64_sve, do_mov_p, FFR_PRED_NUM, a->rn) | ||
30 | |||
31 | static bool do_pfirst_pnext(DisasContext *s, arg_rr_esz *a, | ||
32 | void (*gen_fn)(TCGv_i32, TCGv_ptr, | ||
33 | -- | ||
34 | 2.25.1 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
4 | Message-id: 20220527181907.189259-54-richard.henderson@linaro.org | ||
5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | --- | ||
8 | target/arm/translate-sve.c | 11 ++--------- | ||
9 | 1 file changed, 2 insertions(+), 9 deletions(-) | ||
10 | |||
11 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c | ||
12 | index XXXXXXX..XXXXXXX 100644 | ||
13 | --- a/target/arm/translate-sve.c | ||
14 | +++ b/target/arm/translate-sve.c | ||
15 | @@ -XXX,XX +XXX,XX @@ static bool do_pfirst_pnext(DisasContext *s, arg_rr_esz *a, | ||
16 | return true; | ||
17 | } | ||
18 | |||
19 | -static bool trans_PFIRST(DisasContext *s, arg_rr_esz *a) | ||
20 | -{ | ||
21 | - return do_pfirst_pnext(s, a, gen_helper_sve_pfirst); | ||
22 | -} | ||
23 | - | ||
24 | -static bool trans_PNEXT(DisasContext *s, arg_rr_esz *a) | ||
25 | -{ | ||
26 | - return do_pfirst_pnext(s, a, gen_helper_sve_pnext); | ||
27 | -} | ||
28 | +TRANS_FEAT(PFIRST, aa64_sve, do_pfirst_pnext, a, gen_helper_sve_pfirst) | ||
29 | +TRANS_FEAT(PNEXT, aa64_sve, do_pfirst_pnext, a, gen_helper_sve_pnext) | ||
30 | |||
31 | /* | ||
32 | *** SVE Element Count Group | ||
33 | -- | ||
34 | 2.25.1 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
4 | Message-id: 20220527181907.189259-55-richard.henderson@linaro.org | ||
5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | --- | ||
8 | target/arm/translate-sve.c | 14 ++------------ | ||
9 | 1 file changed, 2 insertions(+), 12 deletions(-) | ||
10 | |||
11 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c | ||
12 | index XXXXXXX..XXXXXXX 100644 | ||
13 | --- a/target/arm/translate-sve.c | ||
14 | +++ b/target/arm/translate-sve.c | ||
15 | @@ -XXX,XX +XXX,XX @@ static bool do_EXT(DisasContext *s, int rd, int rn, int rm, int imm) | ||
16 | return true; | ||
17 | } | ||
18 | |||
19 | -static bool trans_EXT(DisasContext *s, arg_EXT *a) | ||
20 | -{ | ||
21 | - return do_EXT(s, a->rd, a->rn, a->rm, a->imm); | ||
22 | -} | ||
23 | - | ||
24 | -static bool trans_EXT_sve2(DisasContext *s, arg_rri *a) | ||
25 | -{ | ||
26 | - if (!dc_isar_feature(aa64_sve2, s)) { | ||
27 | - return false; | ||
28 | - } | ||
29 | - return do_EXT(s, a->rd, a->rn, (a->rn + 1) % 32, a->imm); | ||
30 | -} | ||
31 | +TRANS_FEAT(EXT, aa64_sve, do_EXT, a->rd, a->rn, a->rm, a->imm) | ||
32 | +TRANS_FEAT(EXT_sve2, aa64_sve2, do_EXT, a->rd, a->rn, (a->rn + 1) % 32, a->imm) | ||
33 | |||
34 | /* | ||
35 | *** SVE Permute - Unpredicated Group | ||
36 | -- | ||
37 | 2.25.1 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
4 | Message-id: 20220527181907.189259-56-richard.henderson@linaro.org | ||
5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | --- | ||
8 | target/arm/translate-sve.c | 35 ++++++----------------------------- | ||
9 | 1 file changed, 6 insertions(+), 29 deletions(-) | ||
10 | |||
11 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c | ||
12 | index XXXXXXX..XXXXXXX 100644 | ||
13 | --- a/target/arm/translate-sve.c | ||
14 | +++ b/target/arm/translate-sve.c | ||
15 | @@ -XXX,XX +XXX,XX @@ static bool do_perm_pred2(DisasContext *s, arg_rr_esz *a, bool high_odd, | ||
16 | return true; | ||
17 | } | ||
18 | |||
19 | -static bool trans_ZIP1_p(DisasContext *s, arg_rrr_esz *a) | ||
20 | -{ | ||
21 | - return do_perm_pred3(s, a, 0, gen_helper_sve_zip_p); | ||
22 | -} | ||
23 | - | ||
24 | -static bool trans_ZIP2_p(DisasContext *s, arg_rrr_esz *a) | ||
25 | -{ | ||
26 | - return do_perm_pred3(s, a, 1, gen_helper_sve_zip_p); | ||
27 | -} | ||
28 | - | ||
29 | -static bool trans_UZP1_p(DisasContext *s, arg_rrr_esz *a) | ||
30 | -{ | ||
31 | - return do_perm_pred3(s, a, 0, gen_helper_sve_uzp_p); | ||
32 | -} | ||
33 | - | ||
34 | -static bool trans_UZP2_p(DisasContext *s, arg_rrr_esz *a) | ||
35 | -{ | ||
36 | - return do_perm_pred3(s, a, 1, gen_helper_sve_uzp_p); | ||
37 | -} | ||
38 | - | ||
39 | -static bool trans_TRN1_p(DisasContext *s, arg_rrr_esz *a) | ||
40 | -{ | ||
41 | - return do_perm_pred3(s, a, 0, gen_helper_sve_trn_p); | ||
42 | -} | ||
43 | - | ||
44 | -static bool trans_TRN2_p(DisasContext *s, arg_rrr_esz *a) | ||
45 | -{ | ||
46 | - return do_perm_pred3(s, a, 1, gen_helper_sve_trn_p); | ||
47 | -} | ||
48 | +TRANS_FEAT(ZIP1_p, aa64_sve, do_perm_pred3, a, 0, gen_helper_sve_zip_p) | ||
49 | +TRANS_FEAT(ZIP2_p, aa64_sve, do_perm_pred3, a, 1, gen_helper_sve_zip_p) | ||
50 | +TRANS_FEAT(UZP1_p, aa64_sve, do_perm_pred3, a, 0, gen_helper_sve_uzp_p) | ||
51 | +TRANS_FEAT(UZP2_p, aa64_sve, do_perm_pred3, a, 1, gen_helper_sve_uzp_p) | ||
52 | +TRANS_FEAT(TRN1_p, aa64_sve, do_perm_pred3, a, 0, gen_helper_sve_trn_p) | ||
53 | +TRANS_FEAT(TRN2_p, aa64_sve, do_perm_pred3, a, 1, gen_helper_sve_trn_p) | ||
54 | |||
55 | static bool trans_REV_p(DisasContext *s, arg_rr_esz *a) | ||
56 | { | ||
57 | -- | ||
58 | 2.25.1 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
4 | Message-id: 20220527181907.189259-57-richard.henderson@linaro.org | ||
5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | --- | ||
8 | target/arm/translate-sve.c | 17 +++-------------- | ||
9 | 1 file changed, 3 insertions(+), 14 deletions(-) | ||
10 | |||
11 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c | ||
12 | index XXXXXXX..XXXXXXX 100644 | ||
13 | --- a/target/arm/translate-sve.c | ||
14 | +++ b/target/arm/translate-sve.c | ||
15 | @@ -XXX,XX +XXX,XX @@ TRANS_FEAT(UZP2_p, aa64_sve, do_perm_pred3, a, 1, gen_helper_sve_uzp_p) | ||
16 | TRANS_FEAT(TRN1_p, aa64_sve, do_perm_pred3, a, 0, gen_helper_sve_trn_p) | ||
17 | TRANS_FEAT(TRN2_p, aa64_sve, do_perm_pred3, a, 1, gen_helper_sve_trn_p) | ||
18 | |||
19 | -static bool trans_REV_p(DisasContext *s, arg_rr_esz *a) | ||
20 | -{ | ||
21 | - return do_perm_pred2(s, a, 0, gen_helper_sve_rev_p); | ||
22 | -} | ||
23 | - | ||
24 | -static bool trans_PUNPKLO(DisasContext *s, arg_PUNPKLO *a) | ||
25 | -{ | ||
26 | - return do_perm_pred2(s, a, 0, gen_helper_sve_punpk_p); | ||
27 | -} | ||
28 | - | ||
29 | -static bool trans_PUNPKHI(DisasContext *s, arg_PUNPKHI *a) | ||
30 | -{ | ||
31 | - return do_perm_pred2(s, a, 1, gen_helper_sve_punpk_p); | ||
32 | -} | ||
33 | +TRANS_FEAT(REV_p, aa64_sve, do_perm_pred2, a, 0, gen_helper_sve_rev_p) | ||
34 | +TRANS_FEAT(PUNPKLO, aa64_sve, do_perm_pred2, a, 0, gen_helper_sve_punpk_p) | ||
35 | +TRANS_FEAT(PUNPKHI, aa64_sve, do_perm_pred2, a, 1, gen_helper_sve_punpk_p) | ||
36 | |||
37 | /* | ||
38 | *** SVE Permute - Interleaving Group | ||
39 | -- | ||
40 | 2.25.1 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | This is in line with how we treat uzp, and will | ||
4 | eliminate the special case code during translation. | ||
5 | |||
6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Message-id: 20220527181907.189259-58-richard.henderson@linaro.org | ||
8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | --- | ||
11 | target/arm/sve_helper.c | 6 ++++-- | ||
12 | target/arm/translate-sve.c | 12 ++++++------ | ||
13 | 2 files changed, 10 insertions(+), 8 deletions(-) | ||
14 | |||
15 | diff --git a/target/arm/sve_helper.c b/target/arm/sve_helper.c | ||
16 | index XXXXXXX..XXXXXXX 100644 | ||
17 | --- a/target/arm/sve_helper.c | ||
18 | +++ b/target/arm/sve_helper.c | ||
19 | @@ -XXX,XX +XXX,XX @@ void HELPER(sve_punpk_p)(void *vd, void *vn, uint32_t pred_desc) | ||
20 | void HELPER(NAME)(void *vd, void *vn, void *vm, uint32_t desc) \ | ||
21 | { \ | ||
22 | intptr_t oprsz = simd_oprsz(desc); \ | ||
23 | + intptr_t odd_ofs = simd_data(desc); \ | ||
24 | intptr_t i, oprsz_2 = oprsz / 2; \ | ||
25 | ARMVectorReg tmp_n, tmp_m; \ | ||
26 | /* We produce output faster than we consume input. \ | ||
27 | @@ -XXX,XX +XXX,XX @@ void HELPER(NAME)(void *vd, void *vn, void *vm, uint32_t desc) \ | ||
28 | vm = memcpy(&tmp_m, vm, oprsz_2); \ | ||
29 | } \ | ||
30 | for (i = 0; i < oprsz_2; i += sizeof(TYPE)) { \ | ||
31 | - *(TYPE *)(vd + H(2 * i + 0)) = *(TYPE *)(vn + H(i)); \ | ||
32 | - *(TYPE *)(vd + H(2 * i + sizeof(TYPE))) = *(TYPE *)(vm + H(i)); \ | ||
33 | + *(TYPE *)(vd + H(2 * i + 0)) = *(TYPE *)(vn + odd_ofs + H(i)); \ | ||
34 | + *(TYPE *)(vd + H(2 * i + sizeof(TYPE))) = \ | ||
35 | + *(TYPE *)(vm + odd_ofs + H(i)); \ | ||
36 | } \ | ||
37 | if (sizeof(TYPE) == 16 && unlikely(oprsz & 16)) { \ | ||
38 | memset(vd + oprsz - 16, 0, 16); \ | ||
39 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c | ||
40 | index XXXXXXX..XXXXXXX 100644 | ||
41 | --- a/target/arm/translate-sve.c | ||
42 | +++ b/target/arm/translate-sve.c | ||
43 | @@ -XXX,XX +XXX,XX @@ static bool do_zip(DisasContext *s, arg_rrr_esz *a, bool high) | ||
44 | unsigned vsz = vec_full_reg_size(s); | ||
45 | unsigned high_ofs = high ? vsz / 2 : 0; | ||
46 | tcg_gen_gvec_3_ool(vec_full_reg_offset(s, a->rd), | ||
47 | - vec_full_reg_offset(s, a->rn) + high_ofs, | ||
48 | - vec_full_reg_offset(s, a->rm) + high_ofs, | ||
49 | - vsz, vsz, 0, fns[a->esz]); | ||
50 | + vec_full_reg_offset(s, a->rn), | ||
51 | + vec_full_reg_offset(s, a->rm), | ||
52 | + vsz, vsz, high_ofs, fns[a->esz]); | ||
53 | } | ||
54 | return true; | ||
55 | } | ||
56 | @@ -XXX,XX +XXX,XX @@ static bool do_zip_q(DisasContext *s, arg_rrr_esz *a, bool high) | ||
57 | unsigned vsz = vec_full_reg_size(s); | ||
58 | unsigned high_ofs = high ? QEMU_ALIGN_DOWN(vsz, 32) / 2 : 0; | ||
59 | tcg_gen_gvec_3_ool(vec_full_reg_offset(s, a->rd), | ||
60 | - vec_full_reg_offset(s, a->rn) + high_ofs, | ||
61 | - vec_full_reg_offset(s, a->rm) + high_ofs, | ||
62 | - vsz, vsz, 0, gen_helper_sve2_zip_q); | ||
63 | + vec_full_reg_offset(s, a->rn), | ||
64 | + vec_full_reg_offset(s, a->rm), | ||
65 | + vsz, vsz, high_ofs, gen_helper_sve2_zip_q); | ||
66 | } | ||
67 | return true; | ||
68 | } | ||
69 | -- | ||
70 | 2.25.1 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
4 | Message-id: 20220527181907.189259-59-richard.henderson@linaro.org | ||
5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | --- | ||
8 | target/arm/translate-sve.c | 25 +++++++------------------ | ||
9 | 1 file changed, 7 insertions(+), 18 deletions(-) | ||
10 | |||
11 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c | ||
12 | index XXXXXXX..XXXXXXX 100644 | ||
13 | --- a/target/arm/translate-sve.c | ||
14 | +++ b/target/arm/translate-sve.c | ||
15 | @@ -XXX,XX +XXX,XX @@ static bool do_zip(DisasContext *s, arg_rrr_esz *a, bool high) | ||
16 | gen_helper_sve_zip_b, gen_helper_sve_zip_h, | ||
17 | gen_helper_sve_zip_s, gen_helper_sve_zip_d, | ||
18 | }; | ||
19 | + unsigned vsz = vec_full_reg_size(s); | ||
20 | + unsigned high_ofs = high ? vsz / 2 : 0; | ||
21 | |||
22 | - if (sve_access_check(s)) { | ||
23 | - unsigned vsz = vec_full_reg_size(s); | ||
24 | - unsigned high_ofs = high ? vsz / 2 : 0; | ||
25 | - tcg_gen_gvec_3_ool(vec_full_reg_offset(s, a->rd), | ||
26 | - vec_full_reg_offset(s, a->rn), | ||
27 | - vec_full_reg_offset(s, a->rm), | ||
28 | - vsz, vsz, high_ofs, fns[a->esz]); | ||
29 | - } | ||
30 | - return true; | ||
31 | + return gen_gvec_ool_arg_zzz(s, fns[a->esz], a, high_ofs); | ||
32 | } | ||
33 | |||
34 | static bool trans_ZIP1_z(DisasContext *s, arg_rrr_esz *a) | ||
35 | @@ -XXX,XX +XXX,XX @@ static bool trans_ZIP2_z(DisasContext *s, arg_rrr_esz *a) | ||
36 | |||
37 | static bool do_zip_q(DisasContext *s, arg_rrr_esz *a, bool high) | ||
38 | { | ||
39 | + unsigned vsz = vec_full_reg_size(s); | ||
40 | + unsigned high_ofs = high ? QEMU_ALIGN_DOWN(vsz, 32) / 2 : 0; | ||
41 | + | ||
42 | if (!dc_isar_feature(aa64_sve_f64mm, s)) { | ||
43 | return false; | ||
44 | } | ||
45 | - if (sve_access_check(s)) { | ||
46 | - unsigned vsz = vec_full_reg_size(s); | ||
47 | - unsigned high_ofs = high ? QEMU_ALIGN_DOWN(vsz, 32) / 2 : 0; | ||
48 | - tcg_gen_gvec_3_ool(vec_full_reg_offset(s, a->rd), | ||
49 | - vec_full_reg_offset(s, a->rn), | ||
50 | - vec_full_reg_offset(s, a->rm), | ||
51 | - vsz, vsz, high_ofs, gen_helper_sve2_zip_q); | ||
52 | - } | ||
53 | - return true; | ||
54 | + return gen_gvec_ool_arg_zzz(s, gen_helper_sve2_zip_q, a, high_ofs); | ||
55 | } | ||
56 | |||
57 | static bool trans_ZIP1_q(DisasContext *s, arg_rrr_esz *a) | ||
58 | -- | ||
59 | 2.25.1 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | Convert SVE translation functions using do_zip* | ||
4 | to use TRANS_FEAT and gen_gvec_ool_arg_zzz. | ||
5 | |||
6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Message-id: 20220527181907.189259-60-richard.henderson@linaro.org | ||
8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | --- | ||
11 | target/arm/translate-sve.c | 54 +++++++++----------------------------- | ||
12 | 1 file changed, 13 insertions(+), 41 deletions(-) | ||
13 | |||
14 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c | ||
15 | index XXXXXXX..XXXXXXX 100644 | ||
16 | --- a/target/arm/translate-sve.c | ||
17 | +++ b/target/arm/translate-sve.c | ||
18 | @@ -XXX,XX +XXX,XX @@ TRANS_FEAT(PUNPKHI, aa64_sve, do_perm_pred2, a, 1, gen_helper_sve_punpk_p) | ||
19 | *** SVE Permute - Interleaving Group | ||
20 | */ | ||
21 | |||
22 | -static bool do_zip(DisasContext *s, arg_rrr_esz *a, bool high) | ||
23 | -{ | ||
24 | - static gen_helper_gvec_3 * const fns[4] = { | ||
25 | - gen_helper_sve_zip_b, gen_helper_sve_zip_h, | ||
26 | - gen_helper_sve_zip_s, gen_helper_sve_zip_d, | ||
27 | - }; | ||
28 | - unsigned vsz = vec_full_reg_size(s); | ||
29 | - unsigned high_ofs = high ? vsz / 2 : 0; | ||
30 | +static gen_helper_gvec_3 * const zip_fns[4] = { | ||
31 | + gen_helper_sve_zip_b, gen_helper_sve_zip_h, | ||
32 | + gen_helper_sve_zip_s, gen_helper_sve_zip_d, | ||
33 | +}; | ||
34 | +TRANS_FEAT(ZIP1_z, aa64_sve, gen_gvec_ool_arg_zzz, | ||
35 | + zip_fns[a->esz], a, 0) | ||
36 | +TRANS_FEAT(ZIP2_z, aa64_sve, gen_gvec_ool_arg_zzz, | ||
37 | + zip_fns[a->esz], a, vec_full_reg_size(s) / 2) | ||
38 | |||
39 | - return gen_gvec_ool_arg_zzz(s, fns[a->esz], a, high_ofs); | ||
40 | -} | ||
41 | - | ||
42 | -static bool trans_ZIP1_z(DisasContext *s, arg_rrr_esz *a) | ||
43 | -{ | ||
44 | - return do_zip(s, a, false); | ||
45 | -} | ||
46 | - | ||
47 | -static bool trans_ZIP2_z(DisasContext *s, arg_rrr_esz *a) | ||
48 | -{ | ||
49 | - return do_zip(s, a, true); | ||
50 | -} | ||
51 | - | ||
52 | -static bool do_zip_q(DisasContext *s, arg_rrr_esz *a, bool high) | ||
53 | -{ | ||
54 | - unsigned vsz = vec_full_reg_size(s); | ||
55 | - unsigned high_ofs = high ? QEMU_ALIGN_DOWN(vsz, 32) / 2 : 0; | ||
56 | - | ||
57 | - if (!dc_isar_feature(aa64_sve_f64mm, s)) { | ||
58 | - return false; | ||
59 | - } | ||
60 | - return gen_gvec_ool_arg_zzz(s, gen_helper_sve2_zip_q, a, high_ofs); | ||
61 | -} | ||
62 | - | ||
63 | -static bool trans_ZIP1_q(DisasContext *s, arg_rrr_esz *a) | ||
64 | -{ | ||
65 | - return do_zip_q(s, a, false); | ||
66 | -} | ||
67 | - | ||
68 | -static bool trans_ZIP2_q(DisasContext *s, arg_rrr_esz *a) | ||
69 | -{ | ||
70 | - return do_zip_q(s, a, true); | ||
71 | -} | ||
72 | +TRANS_FEAT(ZIP1_q, aa64_sve_f64mm, gen_gvec_ool_arg_zzz, | ||
73 | + gen_helper_sve2_zip_q, a, 0) | ||
74 | +TRANS_FEAT(ZIP2_q, aa64_sve_f64mm, gen_gvec_ool_arg_zzz, | ||
75 | + gen_helper_sve2_zip_q, a, | ||
76 | + QEMU_ALIGN_DOWN(vec_full_reg_size(s), 32) / 2) | ||
77 | |||
78 | static gen_helper_gvec_3 * const uzp_fns[4] = { | ||
79 | gen_helper_sve_uzp_b, gen_helper_sve_uzp_h, | ||
80 | -- | ||
81 | 2.25.1 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
4 | Message-id: 20220527181907.189259-61-richard.henderson@linaro.org | ||
5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | --- | ||
8 | target/arm/translate-sve.c | 11 ++--------- | ||
9 | 1 file changed, 2 insertions(+), 9 deletions(-) | ||
10 | |||
11 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c | ||
12 | index XXXXXXX..XXXXXXX 100644 | ||
13 | --- a/target/arm/translate-sve.c | ||
14 | +++ b/target/arm/translate-sve.c | ||
15 | @@ -XXX,XX +XXX,XX @@ static bool do_clast_vector(DisasContext *s, arg_rprr_esz *a, bool before) | ||
16 | return true; | ||
17 | } | ||
18 | |||
19 | -static bool trans_CLASTA_z(DisasContext *s, arg_rprr_esz *a) | ||
20 | -{ | ||
21 | - return do_clast_vector(s, a, false); | ||
22 | -} | ||
23 | - | ||
24 | -static bool trans_CLASTB_z(DisasContext *s, arg_rprr_esz *a) | ||
25 | -{ | ||
26 | - return do_clast_vector(s, a, true); | ||
27 | -} | ||
28 | +TRANS_FEAT(CLASTA_z, aa64_sve, do_clast_vector, a, false) | ||
29 | +TRANS_FEAT(CLASTB_z, aa64_sve, do_clast_vector, a, true) | ||
30 | |||
31 | /* Compute CLAST for a scalar. */ | ||
32 | static void do_clast_scalar(DisasContext *s, int esz, int pg, int rm, | ||
33 | -- | ||
34 | 2.25.1 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
4 | Message-id: 20220527181907.189259-62-richard.henderson@linaro.org | ||
5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | --- | ||
8 | target/arm/translate-sve.c | 11 ++--------- | ||
9 | 1 file changed, 2 insertions(+), 9 deletions(-) | ||
10 | |||
11 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c | ||
12 | index XXXXXXX..XXXXXXX 100644 | ||
13 | --- a/target/arm/translate-sve.c | ||
14 | +++ b/target/arm/translate-sve.c | ||
15 | @@ -XXX,XX +XXX,XX @@ static bool do_clast_fp(DisasContext *s, arg_rpr_esz *a, bool before) | ||
16 | return true; | ||
17 | } | ||
18 | |||
19 | -static bool trans_CLASTA_v(DisasContext *s, arg_rpr_esz *a) | ||
20 | -{ | ||
21 | - return do_clast_fp(s, a, false); | ||
22 | -} | ||
23 | - | ||
24 | -static bool trans_CLASTB_v(DisasContext *s, arg_rpr_esz *a) | ||
25 | -{ | ||
26 | - return do_clast_fp(s, a, true); | ||
27 | -} | ||
28 | +TRANS_FEAT(CLASTA_v, aa64_sve, do_clast_fp, a, false) | ||
29 | +TRANS_FEAT(CLASTB_v, aa64_sve, do_clast_fp, a, true) | ||
30 | |||
31 | /* Compute CLAST for a Xreg. */ | ||
32 | static bool do_clast_general(DisasContext *s, arg_rpr_esz *a, bool before) | ||
33 | -- | ||
34 | 2.25.1 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
4 | Message-id: 20220527181907.189259-63-richard.henderson@linaro.org | ||
5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | --- | ||
8 | target/arm/translate-sve.c | 11 ++--------- | ||
9 | 1 file changed, 2 insertions(+), 9 deletions(-) | ||
10 | |||
11 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c | ||
12 | index XXXXXXX..XXXXXXX 100644 | ||
13 | --- a/target/arm/translate-sve.c | ||
14 | +++ b/target/arm/translate-sve.c | ||
15 | @@ -XXX,XX +XXX,XX @@ static bool do_clast_general(DisasContext *s, arg_rpr_esz *a, bool before) | ||
16 | return true; | ||
17 | } | ||
18 | |||
19 | -static bool trans_CLASTA_r(DisasContext *s, arg_rpr_esz *a) | ||
20 | -{ | ||
21 | - return do_clast_general(s, a, false); | ||
22 | -} | ||
23 | - | ||
24 | -static bool trans_CLASTB_r(DisasContext *s, arg_rpr_esz *a) | ||
25 | -{ | ||
26 | - return do_clast_general(s, a, true); | ||
27 | -} | ||
28 | +TRANS_FEAT(CLASTA_r, aa64_sve, do_clast_general, a, false) | ||
29 | +TRANS_FEAT(CLASTB_r, aa64_sve, do_clast_general, a, true) | ||
30 | |||
31 | /* Compute LAST for a scalar. */ | ||
32 | static TCGv_i64 do_last_scalar(DisasContext *s, int esz, | ||
33 | -- | ||
34 | 2.25.1 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
4 | Message-id: 20220527181907.189259-64-richard.henderson@linaro.org | ||
5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | --- | ||
8 | target/arm/translate-sve.c | 11 ++--------- | ||
9 | 1 file changed, 2 insertions(+), 9 deletions(-) | ||
10 | |||
11 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c | ||
12 | index XXXXXXX..XXXXXXX 100644 | ||
13 | --- a/target/arm/translate-sve.c | ||
14 | +++ b/target/arm/translate-sve.c | ||
15 | @@ -XXX,XX +XXX,XX @@ static bool do_last_fp(DisasContext *s, arg_rpr_esz *a, bool before) | ||
16 | return true; | ||
17 | } | ||
18 | |||
19 | -static bool trans_LASTA_v(DisasContext *s, arg_rpr_esz *a) | ||
20 | -{ | ||
21 | - return do_last_fp(s, a, false); | ||
22 | -} | ||
23 | - | ||
24 | -static bool trans_LASTB_v(DisasContext *s, arg_rpr_esz *a) | ||
25 | -{ | ||
26 | - return do_last_fp(s, a, true); | ||
27 | -} | ||
28 | +TRANS_FEAT(LASTA_v, aa64_sve, do_last_fp, a, false) | ||
29 | +TRANS_FEAT(LASTB_v, aa64_sve, do_last_fp, a, true) | ||
30 | |||
31 | /* Compute LAST for a Xreg. */ | ||
32 | static bool do_last_general(DisasContext *s, arg_rpr_esz *a, bool before) | ||
33 | -- | ||
34 | 2.25.1 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
4 | Message-id: 20220527181907.189259-65-richard.henderson@linaro.org | ||
5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | --- | ||
8 | target/arm/translate-sve.c | 11 ++--------- | ||
9 | 1 file changed, 2 insertions(+), 9 deletions(-) | ||
10 | |||
11 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c | ||
12 | index XXXXXXX..XXXXXXX 100644 | ||
13 | --- a/target/arm/translate-sve.c | ||
14 | +++ b/target/arm/translate-sve.c | ||
15 | @@ -XXX,XX +XXX,XX @@ static bool do_last_general(DisasContext *s, arg_rpr_esz *a, bool before) | ||
16 | return true; | ||
17 | } | ||
18 | |||
19 | -static bool trans_LASTA_r(DisasContext *s, arg_rpr_esz *a) | ||
20 | -{ | ||
21 | - return do_last_general(s, a, false); | ||
22 | -} | ||
23 | - | ||
24 | -static bool trans_LASTB_r(DisasContext *s, arg_rpr_esz *a) | ||
25 | -{ | ||
26 | - return do_last_general(s, a, true); | ||
27 | -} | ||
28 | +TRANS_FEAT(LASTA_r, aa64_sve, do_last_general, a, false) | ||
29 | +TRANS_FEAT(LASTB_r, aa64_sve, do_last_general, a, true) | ||
30 | |||
31 | static bool trans_CPY_m_r(DisasContext *s, arg_rpr_esz *a) | ||
32 | { | ||
33 | -- | ||
34 | 2.25.1 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
4 | Message-id: 20220527181907.189259-66-richard.henderson@linaro.org | ||
5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | --- | ||
8 | target/arm/translate-sve.c | 17 ++++------------- | ||
9 | 1 file changed, 4 insertions(+), 13 deletions(-) | ||
10 | |||
11 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c | ||
12 | index XXXXXXX..XXXXXXX 100644 | ||
13 | --- a/target/arm/translate-sve.c | ||
14 | +++ b/target/arm/translate-sve.c | ||
15 | @@ -XXX,XX +XXX,XX @@ TRANS_FEAT(REVH, aa64_sve, gen_gvec_ool_arg_zpz, revh_fns[a->esz], a, 0) | ||
16 | TRANS_FEAT(REVW, aa64_sve, gen_gvec_ool_arg_zpz, | ||
17 | a->esz == 3 ? gen_helper_sve_revw_d : NULL, a, 0) | ||
18 | |||
19 | -static bool trans_SPLICE(DisasContext *s, arg_rprr_esz *a) | ||
20 | -{ | ||
21 | - return gen_gvec_ool_zzzp(s, gen_helper_sve_splice, | ||
22 | - a->rd, a->rn, a->rm, a->pg, a->esz); | ||
23 | -} | ||
24 | +TRANS_FEAT(SPLICE, aa64_sve, gen_gvec_ool_arg_zpzz, | ||
25 | + gen_helper_sve_splice, a, a->esz) | ||
26 | |||
27 | -static bool trans_SPLICE_sve2(DisasContext *s, arg_rpr_esz *a) | ||
28 | -{ | ||
29 | - if (!dc_isar_feature(aa64_sve2, s)) { | ||
30 | - return false; | ||
31 | - } | ||
32 | - return gen_gvec_ool_zzzp(s, gen_helper_sve_splice, | ||
33 | - a->rd, a->rn, (a->rn + 1) % 32, a->pg, a->esz); | ||
34 | -} | ||
35 | +TRANS_FEAT(SPLICE_sve2, aa64_sve2, gen_gvec_ool_zzzp, gen_helper_sve_splice, | ||
36 | + a->rd, a->rn, (a->rn + 1) % 32, a->pg, a->esz) | ||
37 | |||
38 | /* | ||
39 | *** SVE Integer Compare - Vectors Group | ||
40 | -- | ||
41 | 2.25.1 | diff view generated by jsdifflib |
1 | Create and connect the two clocks needed by the ARMSSE. | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
4 | Message-id: 20220527181907.189259-67-richard.henderson@linaro.org | ||
5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
3 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
4 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
5 | Reviewed-by: Luc Michel <luc@lmichel.fr> | ||
6 | Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
7 | Message-id: 20210128114145.20536-15-peter.maydell@linaro.org | ||
8 | Message-id: 20210121190622.22000-15-peter.maydell@linaro.org | ||
9 | --- | 7 | --- |
10 | hw/arm/mps2-tz.c | 13 +++++++++++++ | 8 | target/arm/translate-sve.c | 28 ++++++++++++---------------- |
11 | 1 file changed, 13 insertions(+) | 9 | 1 file changed, 12 insertions(+), 16 deletions(-) |
12 | 10 | ||
13 | diff --git a/hw/arm/mps2-tz.c b/hw/arm/mps2-tz.c | 11 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c |
14 | index XXXXXXX..XXXXXXX 100644 | 12 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/hw/arm/mps2-tz.c | 13 | --- a/target/arm/translate-sve.c |
16 | +++ b/hw/arm/mps2-tz.c | 14 | +++ b/target/arm/translate-sve.c |
17 | @@ -XXX,XX +XXX,XX @@ | 15 | @@ -XXX,XX +XXX,XX @@ static bool do_ppzz_flags(DisasContext *s, arg_rprr_esz *a, |
18 | #include "hw/net/lan9118.h" | 16 | } |
19 | #include "net/net.h" | 17 | |
20 | #include "hw/core/split-irq.h" | 18 | #define DO_PPZZ(NAME, name) \ |
21 | +#include "hw/qdev-clock.h" | 19 | -static bool trans_##NAME##_ppzz(DisasContext *s, arg_rprr_esz *a) \ |
22 | #include "qom/object.h" | 20 | -{ \ |
23 | 21 | - static gen_helper_gvec_flags_4 * const fns[4] = { \ | |
24 | #define MPS2TZ_NUMIRQ 92 | 22 | - gen_helper_sve_##name##_ppzz_b, gen_helper_sve_##name##_ppzz_h, \ |
25 | @@ -XXX,XX +XXX,XX @@ struct MPS2TZMachineState { | 23 | - gen_helper_sve_##name##_ppzz_s, gen_helper_sve_##name##_ppzz_d, \ |
26 | qemu_or_irq uart_irq_orgate; | 24 | - }; \ |
27 | DeviceState *lan9118; | 25 | - return do_ppzz_flags(s, a, fns[a->esz]); \ |
28 | SplitIRQ cpu_irq_splitter[MPS2TZ_NUMIRQ]; | 26 | -} |
29 | + Clock *sysclk; | 27 | + static gen_helper_gvec_flags_4 * const name##_ppzz_fns[4] = { \ |
30 | + Clock *s32kclk; | 28 | + gen_helper_sve_##name##_ppzz_b, gen_helper_sve_##name##_ppzz_h, \ |
31 | }; | 29 | + gen_helper_sve_##name##_ppzz_s, gen_helper_sve_##name##_ppzz_d, \ |
32 | 30 | + }; \ | |
33 | #define TYPE_MPS2TZ_MACHINE "mps2tz" | 31 | + TRANS_FEAT(NAME##_ppzz, aa64_sve, do_ppzz_flags, \ |
34 | @@ -XXX,XX +XXX,XX @@ OBJECT_DECLARE_TYPE(MPS2TZMachineState, MPS2TZMachineClass, MPS2TZ_MACHINE) | 32 | + a, name##_ppzz_fns[a->esz]) |
35 | 33 | ||
36 | /* Main SYSCLK frequency in Hz */ | 34 | DO_PPZZ(CMPEQ, cmpeq) |
37 | #define SYSCLK_FRQ 20000000 | 35 | DO_PPZZ(CMPNE, cmpne) |
38 | +/* Slow 32Khz S32KCLK frequency in Hz */ | 36 | @@ -XXX,XX +XXX,XX @@ DO_PPZZ(CMPHS, cmphs) |
39 | +#define S32KCLK_FRQ (32 * 1000) | 37 | #undef DO_PPZZ |
40 | 38 | ||
41 | /* Create an alias of an entire original MemoryRegion @orig | 39 | #define DO_PPZW(NAME, name) \ |
42 | * located at @base in the memory map. | 40 | -static bool trans_##NAME##_ppzw(DisasContext *s, arg_rprr_esz *a) \ |
43 | @@ -XXX,XX +XXX,XX @@ static void mps2tz_common_init(MachineState *machine) | 41 | -{ \ |
44 | exit(EXIT_FAILURE); | 42 | - static gen_helper_gvec_flags_4 * const fns[4] = { \ |
45 | } | 43 | - gen_helper_sve_##name##_ppzw_b, gen_helper_sve_##name##_ppzw_h, \ |
46 | 44 | - gen_helper_sve_##name##_ppzw_s, NULL \ | |
47 | + /* These clocks don't need migration because they are fixed-frequency */ | 45 | - }; \ |
48 | + mms->sysclk = clock_new(OBJECT(machine), "SYSCLK"); | 46 | - return do_ppzz_flags(s, a, fns[a->esz]); \ |
49 | + clock_set_hz(mms->sysclk, SYSCLK_FRQ); | 47 | -} |
50 | + mms->s32kclk = clock_new(OBJECT(machine), "S32KCLK"); | 48 | + static gen_helper_gvec_flags_4 * const name##_ppzw_fns[4] = { \ |
51 | + clock_set_hz(mms->s32kclk, S32KCLK_FRQ); | 49 | + gen_helper_sve_##name##_ppzw_b, gen_helper_sve_##name##_ppzw_h, \ |
52 | + | 50 | + gen_helper_sve_##name##_ppzw_s, NULL \ |
53 | object_initialize_child(OBJECT(machine), TYPE_IOTKIT, &mms->iotkit, | 51 | + }; \ |
54 | mmc->armsse_type); | 52 | + TRANS_FEAT(NAME##_ppzw, aa64_sve, do_ppzz_flags, \ |
55 | iotkitdev = DEVICE(&mms->iotkit); | 53 | + a, name##_ppzw_fns[a->esz]) |
56 | @@ -XXX,XX +XXX,XX @@ static void mps2tz_common_init(MachineState *machine) | 54 | |
57 | OBJECT(system_memory), &error_abort); | 55 | DO_PPZW(CMPEQ, cmpeq) |
58 | qdev_prop_set_uint32(iotkitdev, "EXP_NUMIRQ", MPS2TZ_NUMIRQ); | 56 | DO_PPZW(CMPNE, cmpne) |
59 | qdev_prop_set_uint32(iotkitdev, "MAINCLK_FRQ", SYSCLK_FRQ); | ||
60 | + qdev_connect_clock_in(iotkitdev, "MAINCLK", mms->sysclk); | ||
61 | + qdev_connect_clock_in(iotkitdev, "S32KCLK", mms->s32kclk); | ||
62 | sysbus_realize(SYS_BUS_DEVICE(&mms->iotkit), &error_fatal); | ||
63 | |||
64 | /* | ||
65 | -- | 57 | -- |
66 | 2.20.1 | 58 | 2.25.1 |
67 | |||
68 | diff view generated by jsdifflib |
1 | The old-style convenience function cmsdk_apb_timer_create() for | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | creating CMSDK_APB_TIMER objects is used in only two places in | ||
3 | mps2.c. Most of the rest of the code in that file uses the new | ||
4 | "initialize in place" coding style. | ||
5 | 2 | ||
6 | We want to connect up a Clock object which should be done between the | 3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
7 | object creation and realization; rather than adding a Clock* argument | 4 | Message-id: 20220527181907.189259-68-richard.henderson@linaro.org |
8 | to the convenience function, convert the timer creation code in | 5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
9 | mps2.c to the same style as is used already for the watchdog, | 6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
10 | dualtimer and other devices, and delete the now-unused convenience | 7 | --- |
11 | function. | 8 | target/arm/translate-sve.c | 28 ++++++++-------------------- |
9 | 1 file changed, 8 insertions(+), 20 deletions(-) | ||
12 | 10 | ||
13 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 11 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c |
14 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
15 | Reviewed-by: Luc Michel <luc@lmichel.fr> | ||
16 | Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
17 | Message-id: 20210128114145.20536-13-peter.maydell@linaro.org | ||
18 | Message-id: 20210121190622.22000-13-peter.maydell@linaro.org | ||
19 | --- | ||
20 | include/hw/timer/cmsdk-apb-timer.h | 21 --------------------- | ||
21 | hw/arm/mps2.c | 18 ++++++++++++++++-- | ||
22 | 2 files changed, 16 insertions(+), 23 deletions(-) | ||
23 | |||
24 | diff --git a/include/hw/timer/cmsdk-apb-timer.h b/include/hw/timer/cmsdk-apb-timer.h | ||
25 | index XXXXXXX..XXXXXXX 100644 | 12 | index XXXXXXX..XXXXXXX 100644 |
26 | --- a/include/hw/timer/cmsdk-apb-timer.h | 13 | --- a/target/arm/translate-sve.c |
27 | +++ b/include/hw/timer/cmsdk-apb-timer.h | 14 | +++ b/target/arm/translate-sve.c |
28 | @@ -XXX,XX +XXX,XX @@ struct CMSDKAPBTimer { | 15 | @@ -XXX,XX +XXX,XX @@ DO_SVE2_ZZZ_NARROW(SUBHNT, subhnt) |
29 | uint32_t intstatus; | 16 | DO_SVE2_ZZZ_NARROW(RSUBHNB, rsubhnb) |
30 | }; | 17 | DO_SVE2_ZZZ_NARROW(RSUBHNT, rsubhnt) |
31 | 18 | ||
32 | -/** | 19 | -static bool do_sve2_ppzz_flags(DisasContext *s, arg_rprr_esz *a, |
33 | - * cmsdk_apb_timer_create - convenience function to create TYPE_CMSDK_APB_TIMER | 20 | - gen_helper_gvec_flags_4 *fn) |
34 | - * @addr: location in system memory to map registers | ||
35 | - * @pclk_frq: frequency in Hz of the PCLK clock (used for calculating baud rate) | ||
36 | - */ | ||
37 | -static inline DeviceState *cmsdk_apb_timer_create(hwaddr addr, | ||
38 | - qemu_irq timerint, | ||
39 | - uint32_t pclk_frq) | ||
40 | -{ | 21 | -{ |
41 | - DeviceState *dev; | 22 | - if (!dc_isar_feature(aa64_sve2, s)) { |
42 | - SysBusDevice *s; | 23 | - return false; |
43 | - | 24 | - } |
44 | - dev = qdev_new(TYPE_CMSDK_APB_TIMER); | 25 | - return do_ppzz_flags(s, a, fn); |
45 | - s = SYS_BUS_DEVICE(dev); | 26 | -} |
46 | - qdev_prop_set_uint32(dev, "pclk-frq", pclk_frq); | 27 | +static gen_helper_gvec_flags_4 * const match_fns[4] = { |
47 | - sysbus_realize_and_unref(s, &error_fatal); | 28 | + gen_helper_sve2_match_ppzz_b, gen_helper_sve2_match_ppzz_h, NULL, NULL |
48 | - sysbus_mmio_map(s, 0, addr); | 29 | +}; |
49 | - sysbus_connect_irq(s, 0, timerint); | 30 | +TRANS_FEAT(MATCH, aa64_sve2, do_ppzz_flags, a, match_fns[a->esz]) |
50 | - return dev; | 31 | |
32 | -#define DO_SVE2_PPZZ_MATCH(NAME, name) \ | ||
33 | -static bool trans_##NAME(DisasContext *s, arg_rprr_esz *a) \ | ||
34 | -{ \ | ||
35 | - static gen_helper_gvec_flags_4 * const fns[4] = { \ | ||
36 | - gen_helper_sve2_##name##_ppzz_b, gen_helper_sve2_##name##_ppzz_h, \ | ||
37 | - NULL, NULL \ | ||
38 | - }; \ | ||
39 | - return do_sve2_ppzz_flags(s, a, fns[a->esz]); \ | ||
51 | -} | 40 | -} |
52 | - | 41 | - |
53 | #endif | 42 | -DO_SVE2_PPZZ_MATCH(MATCH, match) |
54 | diff --git a/hw/arm/mps2.c b/hw/arm/mps2.c | 43 | -DO_SVE2_PPZZ_MATCH(NMATCH, nmatch) |
55 | index XXXXXXX..XXXXXXX 100644 | 44 | +static gen_helper_gvec_flags_4 * const nmatch_fns[4] = { |
56 | --- a/hw/arm/mps2.c | 45 | + gen_helper_sve2_nmatch_ppzz_b, gen_helper_sve2_nmatch_ppzz_h, NULL, NULL |
57 | +++ b/hw/arm/mps2.c | 46 | +}; |
58 | @@ -XXX,XX +XXX,XX @@ struct MPS2MachineState { | 47 | +TRANS_FEAT(NMATCH, aa64_sve2, do_ppzz_flags, a, nmatch_fns[a->esz]) |
59 | /* CMSDK APB subsystem */ | 48 | |
60 | CMSDKAPBDualTimer dualtimer; | 49 | static gen_helper_gvec_4 * const histcnt_fns[4] = { |
61 | CMSDKAPBWatchdog watchdog; | 50 | NULL, NULL, gen_helper_sve2_histcnt_s, gen_helper_sve2_histcnt_d |
62 | + CMSDKAPBTimer timer[2]; | ||
63 | }; | ||
64 | |||
65 | #define TYPE_MPS2_MACHINE "mps2" | ||
66 | @@ -XXX,XX +XXX,XX @@ static void mps2_common_init(MachineState *machine) | ||
67 | } | ||
68 | |||
69 | /* CMSDK APB subsystem */ | ||
70 | - cmsdk_apb_timer_create(0x40000000, qdev_get_gpio_in(armv7m, 8), SYSCLK_FRQ); | ||
71 | - cmsdk_apb_timer_create(0x40001000, qdev_get_gpio_in(armv7m, 9), SYSCLK_FRQ); | ||
72 | + for (i = 0; i < ARRAY_SIZE(mms->timer); i++) { | ||
73 | + g_autofree char *name = g_strdup_printf("timer%d", i); | ||
74 | + hwaddr base = 0x40000000 + i * 0x1000; | ||
75 | + int irqno = 8 + i; | ||
76 | + SysBusDevice *sbd; | ||
77 | + | ||
78 | + object_initialize_child(OBJECT(mms), name, &mms->timer[i], | ||
79 | + TYPE_CMSDK_APB_TIMER); | ||
80 | + sbd = SYS_BUS_DEVICE(&mms->timer[i]); | ||
81 | + qdev_prop_set_uint32(DEVICE(&mms->timer[i]), "pclk-frq", SYSCLK_FRQ); | ||
82 | + sysbus_realize_and_unref(sbd, &error_fatal); | ||
83 | + sysbus_mmio_map(sbd, 0, base); | ||
84 | + sysbus_connect_irq(sbd, 0, qdev_get_gpio_in(armv7m, irqno)); | ||
85 | + } | ||
86 | + | ||
87 | object_initialize_child(OBJECT(mms), "dualtimer", &mms->dualtimer, | ||
88 | TYPE_CMSDK_APB_DUALTIMER); | ||
89 | qdev_prop_set_uint32(DEVICE(&mms->dualtimer), "pclk-frq", SYSCLK_FRQ); | ||
90 | -- | 51 | -- |
91 | 2.20.1 | 52 | 2.25.1 |
92 | |||
93 | diff view generated by jsdifflib |
1 | Create two input clocks on the ARMSSE devices, one for the normal | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | MAINCLK, and one for the 32KHz S32KCLK, and wire these up to the | ||
3 | appropriate devices. The old property-based clock frequency setting | ||
4 | will remain in place until conversion is complete. | ||
5 | 2 | ||
6 | This is a migration compatibility break for machines mps2-an505, | 3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
7 | mps2-an521, musca-a, musca-b1. | 4 | Message-id: 20220527181907.189259-69-richard.henderson@linaro.org |
5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | --- | ||
8 | target/arm/translate-sve.c | 8 +++----- | ||
9 | 1 file changed, 3 insertions(+), 5 deletions(-) | ||
8 | 10 | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 11 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c |
10 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
11 | Reviewed-by: Luc Michel <luc@lmichel.fr> | ||
12 | Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
13 | Message-id: 20210128114145.20536-12-peter.maydell@linaro.org | ||
14 | Message-id: 20210121190622.22000-12-peter.maydell@linaro.org | ||
15 | --- | ||
16 | include/hw/arm/armsse.h | 6 ++++++ | ||
17 | hw/arm/armsse.c | 17 +++++++++++++++-- | ||
18 | 2 files changed, 21 insertions(+), 2 deletions(-) | ||
19 | |||
20 | diff --git a/include/hw/arm/armsse.h b/include/hw/arm/armsse.h | ||
21 | index XXXXXXX..XXXXXXX 100644 | 12 | index XXXXXXX..XXXXXXX 100644 |
22 | --- a/include/hw/arm/armsse.h | 13 | --- a/target/arm/translate-sve.c |
23 | +++ b/include/hw/arm/armsse.h | 14 | +++ b/target/arm/translate-sve.c |
24 | @@ -XXX,XX +XXX,XX @@ | 15 | @@ -XXX,XX +XXX,XX @@ static bool do_ppzi_flags(DisasContext *s, arg_rpri_esz *a, |
25 | * per-CPU identity and control register blocks | 16 | } |
26 | * | 17 | |
27 | * QEMU interface: | 18 | #define DO_PPZI(NAME, name) \ |
28 | + * + Clock input "MAINCLK": clock for CPUs and most peripherals | 19 | -static bool trans_##NAME##_ppzi(DisasContext *s, arg_rpri_esz *a) \ |
29 | + * + Clock input "S32KCLK": slow 32KHz clock used for a few peripherals | 20 | -{ \ |
30 | * + QOM property "memory" is a MemoryRegion containing the devices provided | 21 | - static gen_helper_gvec_flags_3 * const fns[4] = { \ |
31 | * by the board model. | 22 | + static gen_helper_gvec_flags_3 * const name##_ppzi_fns[4] = { \ |
32 | * + QOM property "MAINCLK_FRQ" is the frequency of the main system clock | 23 | gen_helper_sve_##name##_ppzi_b, gen_helper_sve_##name##_ppzi_h, \ |
33 | @@ -XXX,XX +XXX,XX @@ | 24 | gen_helper_sve_##name##_ppzi_s, gen_helper_sve_##name##_ppzi_d, \ |
34 | #include "hw/misc/armsse-mhu.h" | 25 | }; \ |
35 | #include "hw/misc/unimp.h" | 26 | - return do_ppzi_flags(s, a, fns[a->esz]); \ |
36 | #include "hw/or-irq.h" | 27 | -} |
37 | +#include "hw/clock.h" | 28 | + TRANS_FEAT(NAME##_ppzi, aa64_sve, do_ppzi_flags, a, \ |
38 | #include "hw/core/split-irq.h" | 29 | + name##_ppzi_fns[a->esz]) |
39 | #include "hw/cpu/cluster.h" | 30 | |
40 | #include "qom/object.h" | 31 | DO_PPZI(CMPEQ, cmpeq) |
41 | @@ -XXX,XX +XXX,XX @@ struct ARMSSE { | 32 | DO_PPZI(CMPNE, cmpne) |
42 | |||
43 | uint32_t nsccfg; | ||
44 | |||
45 | + Clock *mainclk; | ||
46 | + Clock *s32kclk; | ||
47 | + | ||
48 | /* Properties */ | ||
49 | MemoryRegion *board_memory; | ||
50 | uint32_t exp_numirq; | ||
51 | diff --git a/hw/arm/armsse.c b/hw/arm/armsse.c | ||
52 | index XXXXXXX..XXXXXXX 100644 | ||
53 | --- a/hw/arm/armsse.c | ||
54 | +++ b/hw/arm/armsse.c | ||
55 | @@ -XXX,XX +XXX,XX @@ | ||
56 | #include "hw/arm/armsse.h" | ||
57 | #include "hw/arm/boot.h" | ||
58 | #include "hw/irq.h" | ||
59 | +#include "hw/qdev-clock.h" | ||
60 | |||
61 | /* Format of the System Information block SYS_CONFIG register */ | ||
62 | typedef enum SysConfigFormat { | ||
63 | @@ -XXX,XX +XXX,XX @@ static void armsse_init(Object *obj) | ||
64 | assert(info->sram_banks <= MAX_SRAM_BANKS); | ||
65 | assert(info->num_cpus <= SSE_MAX_CPUS); | ||
66 | |||
67 | + s->mainclk = qdev_init_clock_in(DEVICE(s), "MAINCLK", NULL, NULL); | ||
68 | + s->s32kclk = qdev_init_clock_in(DEVICE(s), "S32KCLK", NULL, NULL); | ||
69 | + | ||
70 | memory_region_init(&s->container, obj, "armsse-container", UINT64_MAX); | ||
71 | |||
72 | for (i = 0; i < info->num_cpus; i++) { | ||
73 | @@ -XXX,XX +XXX,XX @@ static void armsse_realize(DeviceState *dev, Error **errp) | ||
74 | * map its upstream ends to the right place in the container. | ||
75 | */ | ||
76 | qdev_prop_set_uint32(DEVICE(&s->timer0), "pclk-frq", s->mainclk_frq); | ||
77 | + qdev_connect_clock_in(DEVICE(&s->timer0), "pclk", s->mainclk); | ||
78 | if (!sysbus_realize(SYS_BUS_DEVICE(&s->timer0), errp)) { | ||
79 | return; | ||
80 | } | ||
81 | @@ -XXX,XX +XXX,XX @@ static void armsse_realize(DeviceState *dev, Error **errp) | ||
82 | &error_abort); | ||
83 | |||
84 | qdev_prop_set_uint32(DEVICE(&s->timer1), "pclk-frq", s->mainclk_frq); | ||
85 | + qdev_connect_clock_in(DEVICE(&s->timer1), "pclk", s->mainclk); | ||
86 | if (!sysbus_realize(SYS_BUS_DEVICE(&s->timer1), errp)) { | ||
87 | return; | ||
88 | } | ||
89 | @@ -XXX,XX +XXX,XX @@ static void armsse_realize(DeviceState *dev, Error **errp) | ||
90 | &error_abort); | ||
91 | |||
92 | qdev_prop_set_uint32(DEVICE(&s->dualtimer), "pclk-frq", s->mainclk_frq); | ||
93 | + qdev_connect_clock_in(DEVICE(&s->dualtimer), "TIMCLK", s->mainclk); | ||
94 | if (!sysbus_realize(SYS_BUS_DEVICE(&s->dualtimer), errp)) { | ||
95 | return; | ||
96 | } | ||
97 | @@ -XXX,XX +XXX,XX @@ static void armsse_realize(DeviceState *dev, Error **errp) | ||
98 | * 0x4002f000: S32K timer | ||
99 | */ | ||
100 | qdev_prop_set_uint32(DEVICE(&s->s32ktimer), "pclk-frq", S32KCLK); | ||
101 | + qdev_connect_clock_in(DEVICE(&s->s32ktimer), "pclk", s->s32kclk); | ||
102 | if (!sysbus_realize(SYS_BUS_DEVICE(&s->s32ktimer), errp)) { | ||
103 | return; | ||
104 | } | ||
105 | @@ -XXX,XX +XXX,XX @@ static void armsse_realize(DeviceState *dev, Error **errp) | ||
106 | qdev_get_gpio_in_named(DEVICE(&s->armv7m), "NMI", 0)); | ||
107 | |||
108 | qdev_prop_set_uint32(DEVICE(&s->s32kwatchdog), "wdogclk-frq", S32KCLK); | ||
109 | + qdev_connect_clock_in(DEVICE(&s->s32kwatchdog), "WDOGCLK", s->s32kclk); | ||
110 | if (!sysbus_realize(SYS_BUS_DEVICE(&s->s32kwatchdog), errp)) { | ||
111 | return; | ||
112 | } | ||
113 | @@ -XXX,XX +XXX,XX @@ static void armsse_realize(DeviceState *dev, Error **errp) | ||
114 | /* 0x40080000 .. 0x4008ffff : ARMSSE second Base peripheral region */ | ||
115 | |||
116 | qdev_prop_set_uint32(DEVICE(&s->nswatchdog), "wdogclk-frq", s->mainclk_frq); | ||
117 | + qdev_connect_clock_in(DEVICE(&s->nswatchdog), "WDOGCLK", s->mainclk); | ||
118 | if (!sysbus_realize(SYS_BUS_DEVICE(&s->nswatchdog), errp)) { | ||
119 | return; | ||
120 | } | ||
121 | @@ -XXX,XX +XXX,XX @@ static void armsse_realize(DeviceState *dev, Error **errp) | ||
122 | sysbus_mmio_map(SYS_BUS_DEVICE(&s->nswatchdog), 0, 0x40081000); | ||
123 | |||
124 | qdev_prop_set_uint32(DEVICE(&s->swatchdog), "wdogclk-frq", s->mainclk_frq); | ||
125 | + qdev_connect_clock_in(DEVICE(&s->swatchdog), "WDOGCLK", s->mainclk); | ||
126 | if (!sysbus_realize(SYS_BUS_DEVICE(&s->swatchdog), errp)) { | ||
127 | return; | ||
128 | } | ||
129 | @@ -XXX,XX +XXX,XX @@ static void armsse_idau_check(IDAUInterface *ii, uint32_t address, | ||
130 | |||
131 | static const VMStateDescription armsse_vmstate = { | ||
132 | .name = "iotkit", | ||
133 | - .version_id = 1, | ||
134 | - .minimum_version_id = 1, | ||
135 | + .version_id = 2, | ||
136 | + .minimum_version_id = 2, | ||
137 | .fields = (VMStateField[]) { | ||
138 | + VMSTATE_CLOCK(mainclk, ARMSSE), | ||
139 | + VMSTATE_CLOCK(s32kclk, ARMSSE), | ||
140 | VMSTATE_UINT32(nsccfg, ARMSSE), | ||
141 | VMSTATE_END_OF_LIST() | ||
142 | } | ||
143 | -- | 33 | -- |
144 | 2.20.1 | 34 | 2.25.1 |
145 | |||
146 | diff view generated by jsdifflib |
1 | While we transition the ARMSSE code from integer properties | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | specifying clock frequencies to Clock objects, we want to have the | ||
3 | device provide both at once. We want the final name of the main | ||
4 | input Clock to be "MAINCLK", following the hardware name. | ||
5 | Unfortunately creating an input Clock with a name X creates an | ||
6 | under-the-hood QOM property X; for "MAINCLK" this clashes with the | ||
7 | existing UINT32 property of that name. | ||
8 | 2 | ||
9 | Rename the UINT32 property to MAINCLK_FRQ so it can coexist with the | 3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
10 | MAINCLK Clock; once the transition is complete MAINCLK_FRQ will be | 4 | Message-id: 20220527181907.189259-70-richard.henderson@linaro.org |
11 | deleted. | 5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | --- | ||
8 | target/arm/translate-sve.c | 45 ++++++++++++-------------------------- | ||
9 | 1 file changed, 14 insertions(+), 31 deletions(-) | ||
12 | 10 | ||
13 | Commit created with: | 11 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c |
14 | perl -p -i -e 's/MAINCLK/MAINCLK_FRQ/g' hw/arm/{armsse,mps2-tz,musca}.c include/hw/arm/armsse.h | ||
15 | |||
16 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
17 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
18 | Reviewed-by: Luc Michel <luc@lmichel.fr> | ||
19 | Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
20 | Message-id: 20210128114145.20536-11-peter.maydell@linaro.org | ||
21 | Message-id: 20210121190622.22000-11-peter.maydell@linaro.org | ||
22 | --- | ||
23 | include/hw/arm/armsse.h | 2 +- | ||
24 | hw/arm/armsse.c | 6 +++--- | ||
25 | hw/arm/mps2-tz.c | 2 +- | ||
26 | hw/arm/musca.c | 2 +- | ||
27 | 4 files changed, 6 insertions(+), 6 deletions(-) | ||
28 | |||
29 | diff --git a/include/hw/arm/armsse.h b/include/hw/arm/armsse.h | ||
30 | index XXXXXXX..XXXXXXX 100644 | 12 | index XXXXXXX..XXXXXXX 100644 |
31 | --- a/include/hw/arm/armsse.h | 13 | --- a/target/arm/translate-sve.c |
32 | +++ b/include/hw/arm/armsse.h | 14 | +++ b/target/arm/translate-sve.c |
33 | @@ -XXX,XX +XXX,XX @@ | 15 | @@ -XXX,XX +XXX,XX @@ static bool do_brk2(DisasContext *s, arg_rpr_s *a, |
34 | * QEMU interface: | 16 | return true; |
35 | * + QOM property "memory" is a MemoryRegion containing the devices provided | 17 | } |
36 | * by the board model. | 18 | |
37 | - * + QOM property "MAINCLK" is the frequency of the main system clock | 19 | -static bool trans_BRKPA(DisasContext *s, arg_rprr_s *a) |
38 | + * + QOM property "MAINCLK_FRQ" is the frequency of the main system clock | 20 | -{ |
39 | * + QOM property "EXP_NUMIRQ" sets the number of expansion interrupts. | 21 | - return do_brk3(s, a, gen_helper_sve_brkpa, gen_helper_sve_brkpas); |
40 | * (In hardware, the SSE-200 permits the number of expansion interrupts | 22 | -} |
41 | * for the two CPUs to be configured separately, but we restrict it to | 23 | +TRANS_FEAT(BRKPA, aa64_sve, do_brk3, a, |
42 | diff --git a/hw/arm/armsse.c b/hw/arm/armsse.c | 24 | + gen_helper_sve_brkpa, gen_helper_sve_brkpas) |
43 | index XXXXXXX..XXXXXXX 100644 | 25 | +TRANS_FEAT(BRKPB, aa64_sve, do_brk3, a, |
44 | --- a/hw/arm/armsse.c | 26 | + gen_helper_sve_brkpb, gen_helper_sve_brkpbs) |
45 | +++ b/hw/arm/armsse.c | 27 | |
46 | @@ -XXX,XX +XXX,XX @@ static Property iotkit_properties[] = { | 28 | -static bool trans_BRKPB(DisasContext *s, arg_rprr_s *a) |
47 | DEFINE_PROP_LINK("memory", ARMSSE, board_memory, TYPE_MEMORY_REGION, | 29 | -{ |
48 | MemoryRegion *), | 30 | - return do_brk3(s, a, gen_helper_sve_brkpb, gen_helper_sve_brkpbs); |
49 | DEFINE_PROP_UINT32("EXP_NUMIRQ", ARMSSE, exp_numirq, 64), | 31 | -} |
50 | - DEFINE_PROP_UINT32("MAINCLK", ARMSSE, mainclk_frq, 0), | 32 | +TRANS_FEAT(BRKA_m, aa64_sve, do_brk2, a, |
51 | + DEFINE_PROP_UINT32("MAINCLK_FRQ", ARMSSE, mainclk_frq, 0), | 33 | + gen_helper_sve_brka_m, gen_helper_sve_brkas_m) |
52 | DEFINE_PROP_UINT32("SRAM_ADDR_WIDTH", ARMSSE, sram_addr_width, 15), | 34 | +TRANS_FEAT(BRKB_m, aa64_sve, do_brk2, a, |
53 | DEFINE_PROP_UINT32("init-svtor", ARMSSE, init_svtor, 0x10000000), | 35 | + gen_helper_sve_brkb_m, gen_helper_sve_brkbs_m) |
54 | DEFINE_PROP_BOOL("CPU0_FPU", ARMSSE, cpu_fpu[0], true), | 36 | |
55 | @@ -XXX,XX +XXX,XX @@ static Property armsse_properties[] = { | 37 | -static bool trans_BRKA_m(DisasContext *s, arg_rpr_s *a) |
56 | DEFINE_PROP_LINK("memory", ARMSSE, board_memory, TYPE_MEMORY_REGION, | 38 | -{ |
57 | MemoryRegion *), | 39 | - return do_brk2(s, a, gen_helper_sve_brka_m, gen_helper_sve_brkas_m); |
58 | DEFINE_PROP_UINT32("EXP_NUMIRQ", ARMSSE, exp_numirq, 64), | 40 | -} |
59 | - DEFINE_PROP_UINT32("MAINCLK", ARMSSE, mainclk_frq, 0), | 41 | +TRANS_FEAT(BRKA_z, aa64_sve, do_brk2, a, |
60 | + DEFINE_PROP_UINT32("MAINCLK_FRQ", ARMSSE, mainclk_frq, 0), | 42 | + gen_helper_sve_brka_z, gen_helper_sve_brkas_z) |
61 | DEFINE_PROP_UINT32("SRAM_ADDR_WIDTH", ARMSSE, sram_addr_width, 15), | 43 | +TRANS_FEAT(BRKB_z, aa64_sve, do_brk2, a, |
62 | DEFINE_PROP_UINT32("init-svtor", ARMSSE, init_svtor, 0x10000000), | 44 | + gen_helper_sve_brkb_z, gen_helper_sve_brkbs_z) |
63 | DEFINE_PROP_BOOL("CPU0_FPU", ARMSSE, cpu_fpu[0], false), | 45 | |
64 | @@ -XXX,XX +XXX,XX @@ static void armsse_realize(DeviceState *dev, Error **errp) | 46 | -static bool trans_BRKB_m(DisasContext *s, arg_rpr_s *a) |
65 | } | 47 | -{ |
66 | 48 | - return do_brk2(s, a, gen_helper_sve_brkb_m, gen_helper_sve_brkbs_m); | |
67 | if (!s->mainclk_frq) { | 49 | -} |
68 | - error_setg(errp, "MAINCLK property was not set"); | 50 | - |
69 | + error_setg(errp, "MAINCLK_FRQ property was not set"); | 51 | -static bool trans_BRKA_z(DisasContext *s, arg_rpr_s *a) |
70 | return; | 52 | -{ |
71 | } | 53 | - return do_brk2(s, a, gen_helper_sve_brka_z, gen_helper_sve_brkas_z); |
72 | 54 | -} | |
73 | diff --git a/hw/arm/mps2-tz.c b/hw/arm/mps2-tz.c | 55 | - |
74 | index XXXXXXX..XXXXXXX 100644 | 56 | -static bool trans_BRKB_z(DisasContext *s, arg_rpr_s *a) |
75 | --- a/hw/arm/mps2-tz.c | 57 | -{ |
76 | +++ b/hw/arm/mps2-tz.c | 58 | - return do_brk2(s, a, gen_helper_sve_brkb_z, gen_helper_sve_brkbs_z); |
77 | @@ -XXX,XX +XXX,XX @@ static void mps2tz_common_init(MachineState *machine) | 59 | -} |
78 | object_property_set_link(OBJECT(&mms->iotkit), "memory", | 60 | - |
79 | OBJECT(system_memory), &error_abort); | 61 | -static bool trans_BRKN(DisasContext *s, arg_rpr_s *a) |
80 | qdev_prop_set_uint32(iotkitdev, "EXP_NUMIRQ", MPS2TZ_NUMIRQ); | 62 | -{ |
81 | - qdev_prop_set_uint32(iotkitdev, "MAINCLK", SYSCLK_FRQ); | 63 | - return do_brk2(s, a, gen_helper_sve_brkn, gen_helper_sve_brkns); |
82 | + qdev_prop_set_uint32(iotkitdev, "MAINCLK_FRQ", SYSCLK_FRQ); | 64 | -} |
83 | sysbus_realize(SYS_BUS_DEVICE(&mms->iotkit), &error_fatal); | 65 | +TRANS_FEAT(BRKN, aa64_sve, do_brk2, a, |
84 | 66 | + gen_helper_sve_brkn, gen_helper_sve_brkns) | |
85 | /* | 67 | |
86 | diff --git a/hw/arm/musca.c b/hw/arm/musca.c | 68 | /* |
87 | index XXXXXXX..XXXXXXX 100644 | 69 | *** SVE Predicate Count Group |
88 | --- a/hw/arm/musca.c | ||
89 | +++ b/hw/arm/musca.c | ||
90 | @@ -XXX,XX +XXX,XX @@ static void musca_init(MachineState *machine) | ||
91 | qdev_prop_set_uint32(ssedev, "EXP_NUMIRQ", mmc->num_irqs); | ||
92 | qdev_prop_set_uint32(ssedev, "init-svtor", mmc->init_svtor); | ||
93 | qdev_prop_set_uint32(ssedev, "SRAM_ADDR_WIDTH", mmc->sram_addr_width); | ||
94 | - qdev_prop_set_uint32(ssedev, "MAINCLK", SYSCLK_FRQ); | ||
95 | + qdev_prop_set_uint32(ssedev, "MAINCLK_FRQ", SYSCLK_FRQ); | ||
96 | /* | ||
97 | * Musca-A takes the default SSE-200 FPU/DSP settings (ie no for | ||
98 | * CPU0 and yes for CPU1); Musca-B1 explicitly enables them for CPU0. | ||
99 | -- | 70 | -- |
100 | 2.20.1 | 71 | 2.25.1 |
101 | |||
102 | diff view generated by jsdifflib |
1 | As the first step in converting the CMSDK_APB_TIMER device to the | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | Clock framework, add a Clock input. For the moment we do nothing | ||
3 | with this clock; we will change the behaviour from using the | ||
4 | wdogclk-frq property to using the Clock once all the users of this | ||
5 | device have been converted to wire up the Clock. | ||
6 | 2 | ||
7 | This is a migration compatibility break for machines mps2-an385, | 3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
8 | mps2-an386, mps2-an500, mps2-an511, mps2-an505, mps2-an521, musca-a, | 4 | Message-id: 20220527181907.189259-71-richard.henderson@linaro.org |
9 | musca-b1, lm3s811evb, lm3s6965evb. | 5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | --- | ||
8 | target/arm/translate-sve.c | 10 +--------- | ||
9 | 1 file changed, 1 insertion(+), 9 deletions(-) | ||
10 | 10 | ||
11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 11 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c |
12 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
13 | Reviewed-by: Luc Michel <luc@lmichel.fr> | ||
14 | Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
15 | Message-id: 20210128114145.20536-10-peter.maydell@linaro.org | ||
16 | Message-id: 20210121190622.22000-10-peter.maydell@linaro.org | ||
17 | --- | ||
18 | include/hw/watchdog/cmsdk-apb-watchdog.h | 3 +++ | ||
19 | hw/watchdog/cmsdk-apb-watchdog.c | 7 +++++-- | ||
20 | 2 files changed, 8 insertions(+), 2 deletions(-) | ||
21 | |||
22 | diff --git a/include/hw/watchdog/cmsdk-apb-watchdog.h b/include/hw/watchdog/cmsdk-apb-watchdog.h | ||
23 | index XXXXXXX..XXXXXXX 100644 | 12 | index XXXXXXX..XXXXXXX 100644 |
24 | --- a/include/hw/watchdog/cmsdk-apb-watchdog.h | 13 | --- a/target/arm/translate-sve.c |
25 | +++ b/include/hw/watchdog/cmsdk-apb-watchdog.h | 14 | +++ b/target/arm/translate-sve.c |
26 | @@ -XXX,XX +XXX,XX @@ | 15 | @@ -XXX,XX +XXX,XX @@ static bool trans_SUBR_zzi(DisasContext *s, arg_rri_esz *a) |
27 | * | 16 | return true; |
28 | * QEMU interface: | 17 | } |
29 | * + QOM property "wdogclk-frq": frequency at which the watchdog is clocked | 18 | |
30 | + * + Clock input "WDOGCLK": clock for the watchdog's timer | 19 | -static bool trans_MUL_zzi(DisasContext *s, arg_rri_esz *a) |
31 | * + sysbus MMIO region 0: the register bank | 20 | -{ |
32 | * + sysbus IRQ 0: watchdog interrupt | 21 | - if (sve_access_check(s)) { |
33 | * | 22 | - unsigned vsz = vec_full_reg_size(s); |
34 | @@ -XXX,XX +XXX,XX @@ | 23 | - tcg_gen_gvec_muli(a->esz, vec_full_reg_offset(s, a->rd), |
35 | 24 | - vec_full_reg_offset(s, a->rn), a->imm, vsz, vsz); | |
36 | #include "hw/sysbus.h" | 25 | - } |
37 | #include "hw/ptimer.h" | 26 | - return true; |
38 | +#include "hw/clock.h" | 27 | -} |
39 | #include "qom/object.h" | 28 | +TRANS_FEAT(MUL_zzi, aa64_sve, gen_gvec_fn_arg_zzi, tcg_gen_gvec_muli, a) |
40 | 29 | ||
41 | #define TYPE_CMSDK_APB_WATCHDOG "cmsdk-apb-watchdog" | 30 | static bool do_zzi_sat(DisasContext *s, arg_rri_esz *a, bool u, bool d) |
42 | @@ -XXX,XX +XXX,XX @@ struct CMSDKAPBWatchdog { | 31 | { |
43 | uint32_t wdogclk_frq; | ||
44 | bool is_luminary; | ||
45 | struct ptimer_state *timer; | ||
46 | + Clock *wdogclk; | ||
47 | |||
48 | uint32_t control; | ||
49 | uint32_t intstatus; | ||
50 | diff --git a/hw/watchdog/cmsdk-apb-watchdog.c b/hw/watchdog/cmsdk-apb-watchdog.c | ||
51 | index XXXXXXX..XXXXXXX 100644 | ||
52 | --- a/hw/watchdog/cmsdk-apb-watchdog.c | ||
53 | +++ b/hw/watchdog/cmsdk-apb-watchdog.c | ||
54 | @@ -XXX,XX +XXX,XX @@ | ||
55 | #include "hw/irq.h" | ||
56 | #include "hw/qdev-properties.h" | ||
57 | #include "hw/registerfields.h" | ||
58 | +#include "hw/qdev-clock.h" | ||
59 | #include "hw/watchdog/cmsdk-apb-watchdog.h" | ||
60 | #include "migration/vmstate.h" | ||
61 | |||
62 | @@ -XXX,XX +XXX,XX @@ static void cmsdk_apb_watchdog_init(Object *obj) | ||
63 | s, "cmsdk-apb-watchdog", 0x1000); | ||
64 | sysbus_init_mmio(sbd, &s->iomem); | ||
65 | sysbus_init_irq(sbd, &s->wdogint); | ||
66 | + s->wdogclk = qdev_init_clock_in(DEVICE(s), "WDOGCLK", NULL, NULL); | ||
67 | |||
68 | s->is_luminary = false; | ||
69 | s->id = cmsdk_apb_watchdog_id; | ||
70 | @@ -XXX,XX +XXX,XX @@ static void cmsdk_apb_watchdog_realize(DeviceState *dev, Error **errp) | ||
71 | |||
72 | static const VMStateDescription cmsdk_apb_watchdog_vmstate = { | ||
73 | .name = "cmsdk-apb-watchdog", | ||
74 | - .version_id = 1, | ||
75 | - .minimum_version_id = 1, | ||
76 | + .version_id = 2, | ||
77 | + .minimum_version_id = 2, | ||
78 | .fields = (VMStateField[]) { | ||
79 | + VMSTATE_CLOCK(wdogclk, CMSDKAPBWatchdog), | ||
80 | VMSTATE_PTIMER(timer, CMSDKAPBWatchdog), | ||
81 | VMSTATE_UINT32(control, CMSDKAPBWatchdog), | ||
82 | VMSTATE_UINT32(intstatus, CMSDKAPBWatchdog), | ||
83 | -- | 32 | -- |
84 | 2.20.1 | 33 | 2.25.1 |
85 | |||
86 | diff view generated by jsdifflib |
1 | Create a fixed-frequency Clock object to be the SYSCLK, and wire it | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | up to the devices that require it. | ||
3 | 2 | ||
3 | Remove the unparsed extraction in trans_DUP_i, | ||
4 | which is intended to reject an 8-bit shift of | ||
5 | an 8-bit constant for 8-bit element. | ||
6 | |||
7 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
8 | Message-id: 20220527181907.189259-72-richard.henderson@linaro.org | ||
9 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
4 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
5 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
6 | Reviewed-by: Luc Michel <luc@lmichel.fr> | ||
7 | Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
8 | Message-id: 20210128114145.20536-14-peter.maydell@linaro.org | ||
9 | Message-id: 20210121190622.22000-14-peter.maydell@linaro.org | ||
10 | --- | 11 | --- |
11 | hw/arm/mps2.c | 9 +++++++++ | 12 | target/arm/sve.decode | 5 ++++- |
12 | 1 file changed, 9 insertions(+) | 13 | target/arm/translate-sve.c | 10 ++++++---- |
14 | 2 files changed, 10 insertions(+), 5 deletions(-) | ||
13 | 15 | ||
14 | diff --git a/hw/arm/mps2.c b/hw/arm/mps2.c | 16 | diff --git a/target/arm/sve.decode b/target/arm/sve.decode |
15 | index XXXXXXX..XXXXXXX 100644 | 17 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/hw/arm/mps2.c | 18 | --- a/target/arm/sve.decode |
17 | +++ b/hw/arm/mps2.c | 19 | +++ b/target/arm/sve.decode |
18 | @@ -XXX,XX +XXX,XX @@ | 20 | @@ -XXX,XX +XXX,XX @@ WHILE_ptr 00100101 esz:2 1 rm:5 001 100 rn:5 rw:1 rd:4 |
19 | #include "hw/net/lan9118.h" | 21 | FDUP 00100101 esz:2 111 00 1110 imm:8 rd:5 |
20 | #include "net/net.h" | 22 | |
21 | #include "hw/watchdog/cmsdk-apb-watchdog.h" | 23 | # SVE broadcast integer immediate (unpredicated) |
22 | +#include "hw/qdev-clock.h" | 24 | -DUP_i 00100101 esz:2 111 00 011 . ........ rd:5 imm=%sh8_i8s |
23 | #include "qom/object.h" | 25 | +{ |
24 | 26 | + INVALID 00100101 00 111 00 011 1 -------- ----- | |
25 | typedef enum MPS2FPGAType { | 27 | + DUP_i 00100101 esz:2 111 00 011 . ........ rd:5 imm=%sh8_i8s |
26 | @@ -XXX,XX +XXX,XX @@ struct MPS2MachineState { | 28 | +} |
27 | CMSDKAPBDualTimer dualtimer; | 29 | |
28 | CMSDKAPBWatchdog watchdog; | 30 | # SVE integer add/subtract immediate (unpredicated) |
29 | CMSDKAPBTimer timer[2]; | 31 | ADD_zzi 00100101 .. 100 000 11 . ........ ..... @rdn_sh_i8u |
30 | + Clock *sysclk; | 32 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c |
33 | index XXXXXXX..XXXXXXX 100644 | ||
34 | --- a/target/arm/translate-sve.c | ||
35 | +++ b/target/arm/translate-sve.c | ||
36 | @@ -XXX,XX +XXX,XX @@ const uint64_t pred_esz_masks[4] = { | ||
37 | 0x1111111111111111ull, 0x0101010101010101ull | ||
31 | }; | 38 | }; |
32 | 39 | ||
33 | #define TYPE_MPS2_MACHINE "mps2" | 40 | +static bool trans_INVALID(DisasContext *s, arg_INVALID *a) |
34 | @@ -XXX,XX +XXX,XX @@ static void mps2_common_init(MachineState *machine) | 41 | +{ |
35 | exit(EXIT_FAILURE); | 42 | + unallocated_encoding(s); |
43 | + return true; | ||
44 | +} | ||
45 | + | ||
46 | /* | ||
47 | *** SVE Logical - Unpredicated Group | ||
48 | */ | ||
49 | @@ -XXX,XX +XXX,XX @@ static bool trans_FDUP(DisasContext *s, arg_FDUP *a) | ||
50 | |||
51 | static bool trans_DUP_i(DisasContext *s, arg_DUP_i *a) | ||
52 | { | ||
53 | - if (a->esz == 0 && extract32(s->insn, 13, 1)) { | ||
54 | - return false; | ||
55 | - } | ||
56 | if (sve_access_check(s)) { | ||
57 | unsigned vsz = vec_full_reg_size(s); | ||
58 | int dofs = vec_full_reg_offset(s, a->rd); | ||
59 | - | ||
60 | tcg_gen_gvec_dup_imm(a->esz, dofs, vsz, vsz, a->imm); | ||
36 | } | 61 | } |
37 | 62 | return true; | |
38 | + /* This clock doesn't need migration because it is fixed-frequency */ | ||
39 | + mms->sysclk = clock_new(OBJECT(machine), "SYSCLK"); | ||
40 | + clock_set_hz(mms->sysclk, SYSCLK_FRQ); | ||
41 | + | ||
42 | /* The FPGA images have an odd combination of different RAMs, | ||
43 | * because in hardware they are different implementations and | ||
44 | * connected to different buses, giving varying performance/size | ||
45 | @@ -XXX,XX +XXX,XX @@ static void mps2_common_init(MachineState *machine) | ||
46 | TYPE_CMSDK_APB_TIMER); | ||
47 | sbd = SYS_BUS_DEVICE(&mms->timer[i]); | ||
48 | qdev_prop_set_uint32(DEVICE(&mms->timer[i]), "pclk-frq", SYSCLK_FRQ); | ||
49 | + qdev_connect_clock_in(DEVICE(&mms->timer[i]), "pclk", mms->sysclk); | ||
50 | sysbus_realize_and_unref(sbd, &error_fatal); | ||
51 | sysbus_mmio_map(sbd, 0, base); | ||
52 | sysbus_connect_irq(sbd, 0, qdev_get_gpio_in(armv7m, irqno)); | ||
53 | @@ -XXX,XX +XXX,XX @@ static void mps2_common_init(MachineState *machine) | ||
54 | object_initialize_child(OBJECT(mms), "dualtimer", &mms->dualtimer, | ||
55 | TYPE_CMSDK_APB_DUALTIMER); | ||
56 | qdev_prop_set_uint32(DEVICE(&mms->dualtimer), "pclk-frq", SYSCLK_FRQ); | ||
57 | + qdev_connect_clock_in(DEVICE(&mms->dualtimer), "TIMCLK", mms->sysclk); | ||
58 | sysbus_realize(SYS_BUS_DEVICE(&mms->dualtimer), &error_fatal); | ||
59 | sysbus_connect_irq(SYS_BUS_DEVICE(&mms->dualtimer), 0, | ||
60 | qdev_get_gpio_in(armv7m, 10)); | ||
61 | @@ -XXX,XX +XXX,XX @@ static void mps2_common_init(MachineState *machine) | ||
62 | object_initialize_child(OBJECT(mms), "watchdog", &mms->watchdog, | ||
63 | TYPE_CMSDK_APB_WATCHDOG); | ||
64 | qdev_prop_set_uint32(DEVICE(&mms->watchdog), "wdogclk-frq", SYSCLK_FRQ); | ||
65 | + qdev_connect_clock_in(DEVICE(&mms->watchdog), "WDOGCLK", mms->sysclk); | ||
66 | sysbus_realize(SYS_BUS_DEVICE(&mms->watchdog), &error_fatal); | ||
67 | sysbus_connect_irq(SYS_BUS_DEVICE(&mms->watchdog), 0, | ||
68 | qdev_get_gpio_in_named(armv7m, "NMI", 0)); | ||
69 | -- | 63 | -- |
70 | 2.20.1 | 64 | 2.25.1 |
71 | |||
72 | diff view generated by jsdifflib |
1 | As the first step in converting the CMSDK_APB_DUALTIMER device to the | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | Clock framework, add a Clock input. For the moment we do nothing | ||
3 | with this clock; we will change the behaviour from using the pclk-frq | ||
4 | property to using the Clock once all the users of this device have | ||
5 | been converted to wire up the Clock. | ||
6 | 2 | ||
7 | We take the opportunity to correct the name of the clock input to | 3 | Remove the unparsed extractions in trans_ADD_zzi, trans_SUBR_zzi, |
8 | match the hardware -- the dual timer names the clock which drives the | 4 | and do_zzi_sat which are intended to reject an 8-bit shift of an |
9 | timers TIMCLK. (It does also have a 'pclk' input, which is used only | 5 | 8-bit constant for 8-bit element. |
10 | for the register and APB bus logic; on the SSE-200 these clocks are | ||
11 | both connected together.) | ||
12 | 6 | ||
13 | This is a migration compatibility break for machines mps2-an385, | 7 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
14 | mps2-an386, mps2-an500, mps2-an511, mps2-an505, mps2-an521, musca-a, | 8 | Message-id: 20220527181907.189259-73-richard.henderson@linaro.org |
15 | musca-b1. | 9 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
11 | --- | ||
12 | target/arm/sve.decode | 35 ++++++++++++++++++++++++++++------- | ||
13 | target/arm/translate-sve.c | 9 --------- | ||
14 | 2 files changed, 28 insertions(+), 16 deletions(-) | ||
16 | 15 | ||
17 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 16 | diff --git a/target/arm/sve.decode b/target/arm/sve.decode |
18 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
19 | Reviewed-by: Luc Michel <luc@lmichel.fr> | ||
20 | Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
21 | Message-id: 20210128114145.20536-9-peter.maydell@linaro.org | ||
22 | Message-id: 20210121190622.22000-9-peter.maydell@linaro.org | ||
23 | --- | ||
24 | include/hw/timer/cmsdk-apb-dualtimer.h | 3 +++ | ||
25 | hw/timer/cmsdk-apb-dualtimer.c | 7 +++++-- | ||
26 | 2 files changed, 8 insertions(+), 2 deletions(-) | ||
27 | |||
28 | diff --git a/include/hw/timer/cmsdk-apb-dualtimer.h b/include/hw/timer/cmsdk-apb-dualtimer.h | ||
29 | index XXXXXXX..XXXXXXX 100644 | 17 | index XXXXXXX..XXXXXXX 100644 |
30 | --- a/include/hw/timer/cmsdk-apb-dualtimer.h | 18 | --- a/target/arm/sve.decode |
31 | +++ b/include/hw/timer/cmsdk-apb-dualtimer.h | 19 | +++ b/target/arm/sve.decode |
32 | @@ -XXX,XX +XXX,XX @@ | 20 | @@ -XXX,XX +XXX,XX @@ FDUP 00100101 esz:2 111 00 1110 imm:8 rd:5 |
33 | * | 21 | } |
34 | * QEMU interface: | 22 | |
35 | * + QOM property "pclk-frq": frequency at which the timer is clocked | 23 | # SVE integer add/subtract immediate (unpredicated) |
36 | + * + Clock input "TIMCLK": clock (for both timers) | 24 | -ADD_zzi 00100101 .. 100 000 11 . ........ ..... @rdn_sh_i8u |
37 | * + sysbus MMIO region 0: the register bank | 25 | -SUB_zzi 00100101 .. 100 001 11 . ........ ..... @rdn_sh_i8u |
38 | * + sysbus IRQ 0: combined timer interrupt TIMINTC | 26 | -SUBR_zzi 00100101 .. 100 011 11 . ........ ..... @rdn_sh_i8u |
39 | * + sysbus IRO 1: timer block 1 interrupt TIMINT1 | 27 | -SQADD_zzi 00100101 .. 100 100 11 . ........ ..... @rdn_sh_i8u |
40 | @@ -XXX,XX +XXX,XX @@ | 28 | -UQADD_zzi 00100101 .. 100 101 11 . ........ ..... @rdn_sh_i8u |
41 | 29 | -SQSUB_zzi 00100101 .. 100 110 11 . ........ ..... @rdn_sh_i8u | |
42 | #include "hw/sysbus.h" | 30 | -UQSUB_zzi 00100101 .. 100 111 11 . ........ ..... @rdn_sh_i8u |
43 | #include "hw/ptimer.h" | 31 | +{ |
44 | +#include "hw/clock.h" | 32 | + INVALID 00100101 00 100 000 11 1 -------- ----- |
45 | #include "qom/object.h" | 33 | + ADD_zzi 00100101 .. 100 000 11 . ........ ..... @rdn_sh_i8u |
46 | 34 | +} | |
47 | #define TYPE_CMSDK_APB_DUALTIMER "cmsdk-apb-dualtimer" | 35 | +{ |
48 | @@ -XXX,XX +XXX,XX @@ struct CMSDKAPBDualTimer { | 36 | + INVALID 00100101 00 100 001 11 1 -------- ----- |
49 | MemoryRegion iomem; | 37 | + SUB_zzi 00100101 .. 100 001 11 . ........ ..... @rdn_sh_i8u |
50 | qemu_irq timerintc; | 38 | +} |
51 | uint32_t pclk_frq; | 39 | +{ |
52 | + Clock *timclk; | 40 | + INVALID 00100101 00 100 011 11 1 -------- ----- |
53 | 41 | + SUBR_zzi 00100101 .. 100 011 11 . ........ ..... @rdn_sh_i8u | |
54 | CMSDKAPBDualTimerModule timermod[CMSDK_APB_DUALTIMER_NUM_MODULES]; | 42 | +} |
55 | uint32_t timeritcr; | 43 | +{ |
56 | diff --git a/hw/timer/cmsdk-apb-dualtimer.c b/hw/timer/cmsdk-apb-dualtimer.c | 44 | + INVALID 00100101 00 100 100 11 1 -------- ----- |
45 | + SQADD_zzi 00100101 .. 100 100 11 . ........ ..... @rdn_sh_i8u | ||
46 | +} | ||
47 | +{ | ||
48 | + INVALID 00100101 00 100 101 11 1 -------- ----- | ||
49 | + UQADD_zzi 00100101 .. 100 101 11 . ........ ..... @rdn_sh_i8u | ||
50 | +} | ||
51 | +{ | ||
52 | + INVALID 00100101 00 100 110 11 1 -------- ----- | ||
53 | + SQSUB_zzi 00100101 .. 100 110 11 . ........ ..... @rdn_sh_i8u | ||
54 | +} | ||
55 | +{ | ||
56 | + INVALID 00100101 00 100 111 11 1 -------- ----- | ||
57 | + UQSUB_zzi 00100101 .. 100 111 11 . ........ ..... @rdn_sh_i8u | ||
58 | +} | ||
59 | |||
60 | # SVE integer min/max immediate (unpredicated) | ||
61 | SMAX_zzi 00100101 .. 101 000 110 ........ ..... @rdn_i8s | ||
62 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c | ||
57 | index XXXXXXX..XXXXXXX 100644 | 63 | index XXXXXXX..XXXXXXX 100644 |
58 | --- a/hw/timer/cmsdk-apb-dualtimer.c | 64 | --- a/target/arm/translate-sve.c |
59 | +++ b/hw/timer/cmsdk-apb-dualtimer.c | 65 | +++ b/target/arm/translate-sve.c |
60 | @@ -XXX,XX +XXX,XX @@ | 66 | @@ -XXX,XX +XXX,XX @@ static bool trans_DUP_i(DisasContext *s, arg_DUP_i *a) |
61 | #include "hw/irq.h" | 67 | |
62 | #include "hw/qdev-properties.h" | 68 | static bool trans_ADD_zzi(DisasContext *s, arg_rri_esz *a) |
63 | #include "hw/registerfields.h" | 69 | { |
64 | +#include "hw/qdev-clock.h" | 70 | - if (a->esz == 0 && extract32(s->insn, 13, 1)) { |
65 | #include "hw/timer/cmsdk-apb-dualtimer.h" | 71 | - return false; |
66 | #include "migration/vmstate.h" | 72 | - } |
67 | 73 | return gen_gvec_fn_arg_zzi(s, tcg_gen_gvec_addi, a); | |
68 | @@ -XXX,XX +XXX,XX @@ static void cmsdk_apb_dualtimer_init(Object *obj) | ||
69 | for (i = 0; i < ARRAY_SIZE(s->timermod); i++) { | ||
70 | sysbus_init_irq(sbd, &s->timermod[i].timerint); | ||
71 | } | ||
72 | + s->timclk = qdev_init_clock_in(DEVICE(s), "TIMCLK", NULL, NULL); | ||
73 | } | 74 | } |
74 | 75 | ||
75 | static void cmsdk_apb_dualtimer_realize(DeviceState *dev, Error **errp) | 76 | @@ -XXX,XX +XXX,XX @@ static bool trans_SUBR_zzi(DisasContext *s, arg_rri_esz *a) |
76 | @@ -XXX,XX +XXX,XX @@ static const VMStateDescription cmsdk_dualtimermod_vmstate = { | 77 | .scalar_first = true } |
77 | 78 | }; | |
78 | static const VMStateDescription cmsdk_apb_dualtimer_vmstate = { | 79 | |
79 | .name = "cmsdk-apb-dualtimer", | 80 | - if (a->esz == 0 && extract32(s->insn, 13, 1)) { |
80 | - .version_id = 1, | 81 | - return false; |
81 | - .minimum_version_id = 1, | 82 | - } |
82 | + .version_id = 2, | 83 | if (sve_access_check(s)) { |
83 | + .minimum_version_id = 2, | 84 | unsigned vsz = vec_full_reg_size(s); |
84 | .fields = (VMStateField[]) { | 85 | tcg_gen_gvec_2s(vec_full_reg_offset(s, a->rd), |
85 | + VMSTATE_CLOCK(timclk, CMSDKAPBDualTimer), | 86 | @@ -XXX,XX +XXX,XX @@ TRANS_FEAT(MUL_zzi, aa64_sve, gen_gvec_fn_arg_zzi, tcg_gen_gvec_muli, a) |
86 | VMSTATE_STRUCT_ARRAY(timermod, CMSDKAPBDualTimer, | 87 | |
87 | CMSDK_APB_DUALTIMER_NUM_MODULES, | 88 | static bool do_zzi_sat(DisasContext *s, arg_rri_esz *a, bool u, bool d) |
88 | 1, cmsdk_dualtimermod_vmstate, | 89 | { |
90 | - if (a->esz == 0 && extract32(s->insn, 13, 1)) { | ||
91 | - return false; | ||
92 | - } | ||
93 | if (sve_access_check(s)) { | ||
94 | do_sat_addsub_vec(s, a->esz, a->rd, a->rn, | ||
95 | tcg_constant_i64(a->imm), u, d); | ||
89 | -- | 96 | -- |
90 | 2.20.1 | 97 | 2.25.1 |
91 | |||
92 | diff view generated by jsdifflib |
1 | From: Alexander Graf <agraf@csgraf.de> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | In macOS 11, QEMU only gets access to Hypervisor.framework if it has the | 3 | Remove the unparsed extractions in trans_CPY_{m,z}_i which are intended |
4 | respective entitlement. Add an entitlement template and automatically self | 4 | to reject an 8-bit shift of an 8-bit constant for 8-bit element. |
5 | sign and apply the entitlement in the build. | ||
6 | 5 | ||
7 | Signed-off-by: Alexander Graf <agraf@csgraf.de> | 6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
8 | Reviewed-by: Roman Bolshakov <r.bolshakov@yadro.com> | 7 | Message-id: 20220527181907.189259-74-richard.henderson@linaro.org |
9 | Tested-by: Roman Bolshakov <r.bolshakov@yadro.com> | 8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
11 | --- | 10 | --- |
12 | meson.build | 29 +++++++++++++++++++++++++---- | 11 | target/arm/sve.decode | 10 ++++++++-- |
13 | accel/hvf/entitlements.plist | 8 ++++++++ | 12 | target/arm/translate-sve.c | 6 ------ |
14 | scripts/entitlement.sh | 13 +++++++++++++ | 13 | 2 files changed, 8 insertions(+), 8 deletions(-) |
15 | 3 files changed, 46 insertions(+), 4 deletions(-) | ||
16 | create mode 100644 accel/hvf/entitlements.plist | ||
17 | create mode 100755 scripts/entitlement.sh | ||
18 | 14 | ||
19 | diff --git a/meson.build b/meson.build | 15 | diff --git a/target/arm/sve.decode b/target/arm/sve.decode |
20 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
21 | --- a/meson.build | 17 | --- a/target/arm/sve.decode |
22 | +++ b/meson.build | 18 | +++ b/target/arm/sve.decode |
23 | @@ -XXX,XX +XXX,XX @@ foreach target : target_dirs | 19 | @@ -XXX,XX +XXX,XX @@ DUPM 00000101 11 0000 dbm:13 rd:5 |
24 | }] | 20 | FCPY 00000101 .. 01 .... 110 imm:8 ..... @rdn_pg4 |
25 | endif | 21 | |
26 | foreach exe: execs | 22 | # SVE copy integer immediate (predicated) |
27 | - emulators += {exe['name']: | 23 | -CPY_m_i 00000101 .. 01 .... 01 . ........ ..... @rdn_pg4 imm=%sh8_i8s |
28 | - executable(exe['name'], exe['sources'], | 24 | -CPY_z_i 00000101 .. 01 .... 00 . ........ ..... @rdn_pg4 imm=%sh8_i8s |
29 | - install: true, | 25 | +{ |
30 | + exe_name = exe['name'] | 26 | + INVALID 00000101 00 01 ---- 01 1 -------- ----- |
31 | + exe_sign = 'CONFIG_HVF' in config_target | 27 | + CPY_m_i 00000101 .. 01 .... 01 . ........ ..... @rdn_pg4 imm=%sh8_i8s |
32 | + if exe_sign | 28 | +} |
33 | + exe_name += '-unsigned' | 29 | +{ |
34 | + endif | 30 | + INVALID 00000101 00 01 ---- 00 1 -------- ----- |
35 | + | 31 | + CPY_z_i 00000101 .. 01 .... 00 . ........ ..... @rdn_pg4 imm=%sh8_i8s |
36 | + emulator = executable(exe_name, exe['sources'], | 32 | +} |
37 | + install: not exe_sign, | 33 | |
38 | c_args: c_args, | 34 | ### SVE Permute - Extract Group |
39 | dependencies: arch_deps + deps + exe['dependencies'], | 35 | |
40 | objects: lib.extract_all_objects(recursive: true), | 36 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c |
41 | @@ -XXX,XX +XXX,XX @@ foreach target : target_dirs | 37 | index XXXXXXX..XXXXXXX 100644 |
42 | link_depends: [block_syms, qemu_syms] + exe.get('link_depends', []), | 38 | --- a/target/arm/translate-sve.c |
43 | link_args: link_args, | 39 | +++ b/target/arm/translate-sve.c |
44 | gui_app: exe['gui']) | 40 | @@ -XXX,XX +XXX,XX @@ static bool trans_FCPY(DisasContext *s, arg_FCPY *a) |
41 | |||
42 | static bool trans_CPY_m_i(DisasContext *s, arg_rpri_esz *a) | ||
43 | { | ||
44 | - if (a->esz == 0 && extract32(s->insn, 13, 1)) { | ||
45 | - return false; | ||
45 | - } | 46 | - } |
46 | + | 47 | if (sve_access_check(s)) { |
47 | + if exe_sign | 48 | do_cpy_m(s, a->esz, a->rd, a->rn, a->pg, tcg_constant_i64(a->imm)); |
48 | + emulators += {exe['name'] : custom_target(exe['name'], | 49 | } |
49 | + install: true, | 50 | @@ -XXX,XX +XXX,XX @@ static bool trans_CPY_z_i(DisasContext *s, arg_CPY_z_i *a) |
50 | + install_dir: get_option('bindir'), | 51 | gen_helper_sve_cpy_z_s, gen_helper_sve_cpy_z_d, |
51 | + depends: emulator, | 52 | }; |
52 | + output: exe['name'], | 53 | |
53 | + command: [ | 54 | - if (a->esz == 0 && extract32(s->insn, 13, 1)) { |
54 | + meson.current_source_dir() / 'scripts/entitlement.sh', | 55 | - return false; |
55 | + meson.current_build_dir() / exe_name, | 56 | - } |
56 | + meson.current_build_dir() / exe['name'], | 57 | if (sve_access_check(s)) { |
57 | + meson.current_source_dir() / 'accel/hvf/entitlements.plist' | 58 | unsigned vsz = vec_full_reg_size(s); |
58 | + ]) | 59 | tcg_gen_gvec_2i_ool(vec_full_reg_offset(s, a->rd), |
59 | + } | ||
60 | + else | ||
61 | + emulators += {exe['name']: emulator} | ||
62 | + endif | ||
63 | |||
64 | if 'CONFIG_TRACE_SYSTEMTAP' in config_host | ||
65 | foreach stp: [ | ||
66 | diff --git a/accel/hvf/entitlements.plist b/accel/hvf/entitlements.plist | ||
67 | new file mode 100644 | ||
68 | index XXXXXXX..XXXXXXX | ||
69 | --- /dev/null | ||
70 | +++ b/accel/hvf/entitlements.plist | ||
71 | @@ -XXX,XX +XXX,XX @@ | ||
72 | +<?xml version="1.0" encoding="UTF-8"?> | ||
73 | +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
74 | +<plist version="1.0"> | ||
75 | +<dict> | ||
76 | + <key>com.apple.security.hypervisor</key> | ||
77 | + <true/> | ||
78 | +</dict> | ||
79 | +</plist> | ||
80 | diff --git a/scripts/entitlement.sh b/scripts/entitlement.sh | ||
81 | new file mode 100755 | ||
82 | index XXXXXXX..XXXXXXX | ||
83 | --- /dev/null | ||
84 | +++ b/scripts/entitlement.sh | ||
85 | @@ -XXX,XX +XXX,XX @@ | ||
86 | +#!/bin/sh -e | ||
87 | +# | ||
88 | +# Helper script for the build process to apply entitlements | ||
89 | + | ||
90 | +SRC="$1" | ||
91 | +DST="$2" | ||
92 | +ENTITLEMENT="$3" | ||
93 | + | ||
94 | +trap 'rm "$DST.tmp"' exit | ||
95 | +cp -af "$SRC" "$DST.tmp" | ||
96 | +codesign --entitlements "$ENTITLEMENT" --force -s - "$DST.tmp" | ||
97 | +mv "$DST.tmp" "$DST" | ||
98 | +trap '' exit | ||
99 | -- | 60 | -- |
100 | 2.20.1 | 61 | 2.25.1 |
101 | |||
102 | diff view generated by jsdifflib |
1 | As the first step in converting the CMSDK_APB_TIMER device to the | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | Clock framework, add a Clock input. For the moment we do nothing | ||
3 | with this clock; we will change the behaviour from using the pclk-frq | ||
4 | property to using the Clock once all the users of this device have | ||
5 | been converted to wire up the Clock. | ||
6 | 2 | ||
7 | Since the device doesn't already have a doc comment for its "QEMU | 3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
8 | interface", we add one including the new Clock. | 4 | Message-id: 20220527181907.189259-75-richard.henderson@linaro.org |
5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | --- | ||
8 | target/arm/translate-sve.c | 5 +---- | ||
9 | 1 file changed, 1 insertion(+), 4 deletions(-) | ||
9 | 10 | ||
10 | This is a migration compatibility break for machines mps2-an505, | 11 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c |
11 | mps2-an521, musca-a, musca-b1. | ||
12 | |||
13 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
14 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
15 | Reviewed-by: Luc Michel <luc@lmichel.fr> | ||
16 | Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
17 | Message-id: 20210128114145.20536-8-peter.maydell@linaro.org | ||
18 | Message-id: 20210121190622.22000-8-peter.maydell@linaro.org | ||
19 | --- | ||
20 | include/hw/timer/cmsdk-apb-timer.h | 9 +++++++++ | ||
21 | hw/timer/cmsdk-apb-timer.c | 7 +++++-- | ||
22 | 2 files changed, 14 insertions(+), 2 deletions(-) | ||
23 | |||
24 | diff --git a/include/hw/timer/cmsdk-apb-timer.h b/include/hw/timer/cmsdk-apb-timer.h | ||
25 | index XXXXXXX..XXXXXXX 100644 | 12 | index XXXXXXX..XXXXXXX 100644 |
26 | --- a/include/hw/timer/cmsdk-apb-timer.h | 13 | --- a/target/arm/translate-sve.c |
27 | +++ b/include/hw/timer/cmsdk-apb-timer.h | 14 | +++ b/target/arm/translate-sve.c |
28 | @@ -XXX,XX +XXX,XX @@ | 15 | @@ -XXX,XX +XXX,XX @@ static bool trans_DUP_i(DisasContext *s, arg_DUP_i *a) |
29 | #include "hw/qdev-properties.h" | 16 | return true; |
30 | #include "hw/sysbus.h" | ||
31 | #include "hw/ptimer.h" | ||
32 | +#include "hw/clock.h" | ||
33 | #include "qom/object.h" | ||
34 | |||
35 | #define TYPE_CMSDK_APB_TIMER "cmsdk-apb-timer" | ||
36 | OBJECT_DECLARE_SIMPLE_TYPE(CMSDKAPBTimer, CMSDK_APB_TIMER) | ||
37 | |||
38 | +/* | ||
39 | + * QEMU interface: | ||
40 | + * + QOM property "pclk-frq": frequency at which the timer is clocked | ||
41 | + * + Clock input "pclk": clock for the timer | ||
42 | + * + sysbus MMIO region 0: the register bank | ||
43 | + * + sysbus IRQ 0: timer interrupt TIMERINT | ||
44 | + */ | ||
45 | struct CMSDKAPBTimer { | ||
46 | /*< private >*/ | ||
47 | SysBusDevice parent_obj; | ||
48 | @@ -XXX,XX +XXX,XX @@ struct CMSDKAPBTimer { | ||
49 | qemu_irq timerint; | ||
50 | uint32_t pclk_frq; | ||
51 | struct ptimer_state *timer; | ||
52 | + Clock *pclk; | ||
53 | |||
54 | uint32_t ctrl; | ||
55 | uint32_t value; | ||
56 | diff --git a/hw/timer/cmsdk-apb-timer.c b/hw/timer/cmsdk-apb-timer.c | ||
57 | index XXXXXXX..XXXXXXX 100644 | ||
58 | --- a/hw/timer/cmsdk-apb-timer.c | ||
59 | +++ b/hw/timer/cmsdk-apb-timer.c | ||
60 | @@ -XXX,XX +XXX,XX @@ | ||
61 | #include "hw/sysbus.h" | ||
62 | #include "hw/irq.h" | ||
63 | #include "hw/registerfields.h" | ||
64 | +#include "hw/qdev-clock.h" | ||
65 | #include "hw/timer/cmsdk-apb-timer.h" | ||
66 | #include "migration/vmstate.h" | ||
67 | |||
68 | @@ -XXX,XX +XXX,XX @@ static void cmsdk_apb_timer_init(Object *obj) | ||
69 | s, "cmsdk-apb-timer", 0x1000); | ||
70 | sysbus_init_mmio(sbd, &s->iomem); | ||
71 | sysbus_init_irq(sbd, &s->timerint); | ||
72 | + s->pclk = qdev_init_clock_in(DEVICE(s), "pclk", NULL, NULL); | ||
73 | } | 17 | } |
74 | 18 | ||
75 | static void cmsdk_apb_timer_realize(DeviceState *dev, Error **errp) | 19 | -static bool trans_ADD_zzi(DisasContext *s, arg_rri_esz *a) |
76 | @@ -XXX,XX +XXX,XX @@ static void cmsdk_apb_timer_realize(DeviceState *dev, Error **errp) | 20 | -{ |
77 | 21 | - return gen_gvec_fn_arg_zzi(s, tcg_gen_gvec_addi, a); | |
78 | static const VMStateDescription cmsdk_apb_timer_vmstate = { | 22 | -} |
79 | .name = "cmsdk-apb-timer", | 23 | +TRANS_FEAT(ADD_zzi, aa64_sve, gen_gvec_fn_arg_zzi, tcg_gen_gvec_addi, a) |
80 | - .version_id = 1, | 24 | |
81 | - .minimum_version_id = 1, | 25 | static bool trans_SUB_zzi(DisasContext *s, arg_rri_esz *a) |
82 | + .version_id = 2, | 26 | { |
83 | + .minimum_version_id = 2, | ||
84 | .fields = (VMStateField[]) { | ||
85 | VMSTATE_PTIMER(timer, CMSDKAPBTimer), | ||
86 | + VMSTATE_CLOCK(pclk, CMSDKAPBTimer), | ||
87 | VMSTATE_UINT32(ctrl, CMSDKAPBTimer), | ||
88 | VMSTATE_UINT32(value, CMSDKAPBTimer), | ||
89 | VMSTATE_UINT32(reload, CMSDKAPBTimer), | ||
90 | -- | 27 | -- |
91 | 2.20.1 | 28 | 2.25.1 |
92 | |||
93 | diff view generated by jsdifflib |
1 | The ptimer API currently provides two methods for setting the period: | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | ptimer_set_period(), which takes a period in nanoseconds, and | ||
3 | ptimer_set_freq(), which takes a frequency in Hz. Neither of these | ||
4 | lines up nicely with the Clock API, because although both the Clock | ||
5 | and the ptimer track the frequency using a representation of whole | ||
6 | and fractional nanoseconds, conversion via either period-in-ns or | ||
7 | frequency-in-Hz will introduce a rounding error. | ||
8 | 2 | ||
9 | Add a new function ptimer_set_period_from_clock() which takes the | 3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
10 | Clock object directly to avoid the rounding issues. This includes a | 4 | Message-id: 20220527181907.189259-76-richard.henderson@linaro.org |
11 | facility for the user to specify that there is a frequency divider | 5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
12 | between the Clock proper and the timer, as some timer devices like | 6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
13 | the CMSDK APB dualtimer need this. | 7 | --- |
8 | target/arm/translate-sve.c | 23 ++++------------------- | ||
9 | 1 file changed, 4 insertions(+), 19 deletions(-) | ||
14 | 10 | ||
15 | To avoid having to drag in clock.h from ptimer.h we add the Clock | 11 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c |
16 | type to typedefs.h. | ||
17 | |||
18 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
19 | Reviewed-by: Luc Michel <luc@lmichel.fr> | ||
20 | Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
21 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
22 | Message-id: 20210128114145.20536-2-peter.maydell@linaro.org | ||
23 | Message-id: 20210121190622.22000-2-peter.maydell@linaro.org | ||
24 | --- | ||
25 | include/hw/ptimer.h | 22 ++++++++++++++++++++++ | ||
26 | include/qemu/typedefs.h | 1 + | ||
27 | hw/core/ptimer.c | 34 ++++++++++++++++++++++++++++++++++ | ||
28 | 3 files changed, 57 insertions(+) | ||
29 | |||
30 | diff --git a/include/hw/ptimer.h b/include/hw/ptimer.h | ||
31 | index XXXXXXX..XXXXXXX 100644 | 12 | index XXXXXXX..XXXXXXX 100644 |
32 | --- a/include/hw/ptimer.h | 13 | --- a/target/arm/translate-sve.c |
33 | +++ b/include/hw/ptimer.h | 14 | +++ b/target/arm/translate-sve.c |
34 | @@ -XXX,XX +XXX,XX @@ void ptimer_transaction_commit(ptimer_state *s); | 15 | @@ -XXX,XX +XXX,XX @@ static bool do_zzi_sat(DisasContext *s, arg_rri_esz *a, bool u, bool d) |
35 | */ | 16 | return true; |
36 | void ptimer_set_period(ptimer_state *s, int64_t period); | ||
37 | |||
38 | +/** | ||
39 | + * ptimer_set_period_from_clock - Set counter increment from a Clock | ||
40 | + * @s: ptimer to configure | ||
41 | + * @clk: pointer to Clock object to take period from | ||
42 | + * @divisor: value to scale the clock frequency down by | ||
43 | + * | ||
44 | + * If the ptimer is being driven from a Clock, this is the preferred | ||
45 | + * way to tell the ptimer about the period, because it avoids any | ||
46 | + * possible rounding errors that might happen if the internal | ||
47 | + * representation of the Clock period was converted to either a period | ||
48 | + * in ns or a frequency in Hz. | ||
49 | + * | ||
50 | + * If the ptimer should run at the same frequency as the clock, | ||
51 | + * pass 1 as the @divisor; if the ptimer should run at half the | ||
52 | + * frequency, pass 2, and so on. | ||
53 | + * | ||
54 | + * This function will assert if it is called outside a | ||
55 | + * ptimer_transaction_begin/commit block. | ||
56 | + */ | ||
57 | +void ptimer_set_period_from_clock(ptimer_state *s, const Clock *clock, | ||
58 | + unsigned int divisor); | ||
59 | + | ||
60 | /** | ||
61 | * ptimer_set_freq - Set counter frequency in Hz | ||
62 | * @s: ptimer to configure | ||
63 | diff --git a/include/qemu/typedefs.h b/include/qemu/typedefs.h | ||
64 | index XXXXXXX..XXXXXXX 100644 | ||
65 | --- a/include/qemu/typedefs.h | ||
66 | +++ b/include/qemu/typedefs.h | ||
67 | @@ -XXX,XX +XXX,XX @@ typedef struct BlockDriverState BlockDriverState; | ||
68 | typedef struct BusClass BusClass; | ||
69 | typedef struct BusState BusState; | ||
70 | typedef struct Chardev Chardev; | ||
71 | +typedef struct Clock Clock; | ||
72 | typedef struct CompatProperty CompatProperty; | ||
73 | typedef struct CoMutex CoMutex; | ||
74 | typedef struct CPUAddressSpace CPUAddressSpace; | ||
75 | diff --git a/hw/core/ptimer.c b/hw/core/ptimer.c | ||
76 | index XXXXXXX..XXXXXXX 100644 | ||
77 | --- a/hw/core/ptimer.c | ||
78 | +++ b/hw/core/ptimer.c | ||
79 | @@ -XXX,XX +XXX,XX @@ | ||
80 | #include "sysemu/qtest.h" | ||
81 | #include "block/aio.h" | ||
82 | #include "sysemu/cpus.h" | ||
83 | +#include "hw/clock.h" | ||
84 | |||
85 | #define DELTA_ADJUST 1 | ||
86 | #define DELTA_NO_ADJUST -1 | ||
87 | @@ -XXX,XX +XXX,XX @@ void ptimer_set_period(ptimer_state *s, int64_t period) | ||
88 | } | ||
89 | } | 17 | } |
90 | 18 | ||
91 | +/* Set counter increment interval from a Clock */ | 19 | -static bool trans_SQADD_zzi(DisasContext *s, arg_rri_esz *a) |
92 | +void ptimer_set_period_from_clock(ptimer_state *s, const Clock *clk, | 20 | -{ |
93 | + unsigned int divisor) | 21 | - return do_zzi_sat(s, a, false, false); |
94 | +{ | 22 | -} |
95 | + /* | 23 | - |
96 | + * The raw clock period is a 64-bit value in units of 2^-32 ns; | 24 | -static bool trans_UQADD_zzi(DisasContext *s, arg_rri_esz *a) |
97 | + * put another way it's a 32.32 fixed-point ns value. Our internal | 25 | -{ |
98 | + * representation of the period is 64.32 fixed point ns, so | 26 | - return do_zzi_sat(s, a, true, false); |
99 | + * the conversion is simple. | 27 | -} |
100 | + */ | 28 | - |
101 | + uint64_t raw_period = clock_get(clk); | 29 | -static bool trans_SQSUB_zzi(DisasContext *s, arg_rri_esz *a) |
102 | + uint64_t period_frac; | 30 | -{ |
103 | + | 31 | - return do_zzi_sat(s, a, false, true); |
104 | + assert(s->in_transaction); | 32 | -} |
105 | + s->delta = ptimer_get_count(s); | 33 | - |
106 | + s->period = extract64(raw_period, 32, 32); | 34 | -static bool trans_UQSUB_zzi(DisasContext *s, arg_rri_esz *a) |
107 | + period_frac = extract64(raw_period, 0, 32); | 35 | -{ |
108 | + /* | 36 | - return do_zzi_sat(s, a, true, true); |
109 | + * divisor specifies a possible frequency divisor between the | 37 | -} |
110 | + * clock and the timer, so it is a multiplier on the period. | 38 | +TRANS_FEAT(SQADD_zzi, aa64_sve, do_zzi_sat, a, false, false) |
111 | + * We do the multiply after splitting the raw period out into | 39 | +TRANS_FEAT(UQADD_zzi, aa64_sve, do_zzi_sat, a, true, false) |
112 | + * period and frac to avoid having to do a 32*64->96 multiply. | 40 | +TRANS_FEAT(SQSUB_zzi, aa64_sve, do_zzi_sat, a, false, true) |
113 | + */ | 41 | +TRANS_FEAT(UQSUB_zzi, aa64_sve, do_zzi_sat, a, true, true) |
114 | + s->period *= divisor; | 42 | |
115 | + period_frac *= divisor; | 43 | static bool do_zzi_ool(DisasContext *s, arg_rri_esz *a, gen_helper_gvec_2i *fn) |
116 | + s->period += extract64(period_frac, 32, 32); | ||
117 | + s->period_frac = (uint32_t)period_frac; | ||
118 | + | ||
119 | + if (s->enabled) { | ||
120 | + s->need_reload = true; | ||
121 | + } | ||
122 | +} | ||
123 | + | ||
124 | /* Set counter frequency in Hz. */ | ||
125 | void ptimer_set_freq(ptimer_state *s, uint32_t freq) | ||
126 | { | 44 | { |
127 | -- | 45 | -- |
128 | 2.20.1 | 46 | 2.25.1 |
129 | |||
130 | diff view generated by jsdifflib |
1 | The state struct for the CMSDK APB timer device doesn't follow our | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | usual naming convention of camelcase -- "CMSDK" and "APB" are both | ||
3 | acronyms, but "TIMER" is not so should not be all-uppercase. | ||
4 | Globally rename the struct to "CMSDKAPBTimer" (bringing it into line | ||
5 | with CMSDKAPBWatchdog and CMSDKAPBDualTimer; CMSDKAPBUART remains | ||
6 | as-is because "UART" is an acronym). | ||
7 | 2 | ||
8 | Commit created with: | 3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
9 | perl -p -i -e 's/CMSDKAPBTIMER/CMSDKAPBTimer/g' hw/timer/cmsdk-apb-timer.c include/hw/arm/armsse.h include/hw/timer/cmsdk-apb-timer.h | 4 | Message-id: 20220527181907.189259-77-richard.henderson@linaro.org |
5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | --- | ||
8 | target/arm/translate-sve.c | 7 ++----- | ||
9 | 1 file changed, 2 insertions(+), 5 deletions(-) | ||
10 | 10 | ||
11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 11 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c |
12 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
13 | Reviewed-by: Luc Michel <luc@lmichel.fr> | ||
14 | Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
15 | Message-id: 20210128114145.20536-7-peter.maydell@linaro.org | ||
16 | Message-id: 20210121190622.22000-7-peter.maydell@linaro.org | ||
17 | --- | ||
18 | include/hw/arm/armsse.h | 6 +++--- | ||
19 | include/hw/timer/cmsdk-apb-timer.h | 4 ++-- | ||
20 | hw/timer/cmsdk-apb-timer.c | 28 ++++++++++++++-------------- | ||
21 | 3 files changed, 19 insertions(+), 19 deletions(-) | ||
22 | |||
23 | diff --git a/include/hw/arm/armsse.h b/include/hw/arm/armsse.h | ||
24 | index XXXXXXX..XXXXXXX 100644 | 12 | index XXXXXXX..XXXXXXX 100644 |
25 | --- a/include/hw/arm/armsse.h | 13 | --- a/target/arm/translate-sve.c |
26 | +++ b/include/hw/arm/armsse.h | 14 | +++ b/target/arm/translate-sve.c |
27 | @@ -XXX,XX +XXX,XX @@ struct ARMSSE { | 15 | @@ -XXX,XX +XXX,XX @@ static bool do_zzi_ool(DisasContext *s, arg_rri_esz *a, gen_helper_gvec_2i *fn) |
28 | TZPPC apb_ppc0; | ||
29 | TZPPC apb_ppc1; | ||
30 | TZMPC mpc[IOTS_NUM_MPC]; | ||
31 | - CMSDKAPBTIMER timer0; | ||
32 | - CMSDKAPBTIMER timer1; | ||
33 | - CMSDKAPBTIMER s32ktimer; | ||
34 | + CMSDKAPBTimer timer0; | ||
35 | + CMSDKAPBTimer timer1; | ||
36 | + CMSDKAPBTimer s32ktimer; | ||
37 | qemu_or_irq ppc_irq_orgate; | ||
38 | SplitIRQ sec_resp_splitter; | ||
39 | SplitIRQ ppc_irq_splitter[NUM_PPCS]; | ||
40 | diff --git a/include/hw/timer/cmsdk-apb-timer.h b/include/hw/timer/cmsdk-apb-timer.h | ||
41 | index XXXXXXX..XXXXXXX 100644 | ||
42 | --- a/include/hw/timer/cmsdk-apb-timer.h | ||
43 | +++ b/include/hw/timer/cmsdk-apb-timer.h | ||
44 | @@ -XXX,XX +XXX,XX @@ | ||
45 | #include "qom/object.h" | ||
46 | |||
47 | #define TYPE_CMSDK_APB_TIMER "cmsdk-apb-timer" | ||
48 | -OBJECT_DECLARE_SIMPLE_TYPE(CMSDKAPBTIMER, CMSDK_APB_TIMER) | ||
49 | +OBJECT_DECLARE_SIMPLE_TYPE(CMSDKAPBTimer, CMSDK_APB_TIMER) | ||
50 | |||
51 | -struct CMSDKAPBTIMER { | ||
52 | +struct CMSDKAPBTimer { | ||
53 | /*< private >*/ | ||
54 | SysBusDevice parent_obj; | ||
55 | |||
56 | diff --git a/hw/timer/cmsdk-apb-timer.c b/hw/timer/cmsdk-apb-timer.c | ||
57 | index XXXXXXX..XXXXXXX 100644 | ||
58 | --- a/hw/timer/cmsdk-apb-timer.c | ||
59 | +++ b/hw/timer/cmsdk-apb-timer.c | ||
60 | @@ -XXX,XX +XXX,XX @@ static const int timer_id[] = { | ||
61 | 0x0d, 0xf0, 0x05, 0xb1, /* CID0..CID3 */ | ||
62 | }; | ||
63 | |||
64 | -static void cmsdk_apb_timer_update(CMSDKAPBTIMER *s) | ||
65 | +static void cmsdk_apb_timer_update(CMSDKAPBTimer *s) | ||
66 | { | ||
67 | qemu_set_irq(s->timerint, !!(s->intstatus & R_INTSTATUS_IRQ_MASK)); | ||
68 | } | 16 | } |
69 | 17 | ||
70 | static uint64_t cmsdk_apb_timer_read(void *opaque, hwaddr offset, unsigned size) | 18 | #define DO_ZZI(NAME, name) \ |
71 | { | 19 | -static bool trans_##NAME##_zzi(DisasContext *s, arg_rri_esz *a) \ |
72 | - CMSDKAPBTIMER *s = CMSDK_APB_TIMER(opaque); | 20 | -{ \ |
73 | + CMSDKAPBTimer *s = CMSDK_APB_TIMER(opaque); | 21 | - static gen_helper_gvec_2i * const fns[4] = { \ |
74 | uint64_t r; | 22 | + static gen_helper_gvec_2i * const name##i_fns[4] = { \ |
75 | 23 | gen_helper_sve_##name##i_b, gen_helper_sve_##name##i_h, \ | |
76 | switch (offset) { | 24 | gen_helper_sve_##name##i_s, gen_helper_sve_##name##i_d, \ |
77 | @@ -XXX,XX +XXX,XX @@ static uint64_t cmsdk_apb_timer_read(void *opaque, hwaddr offset, unsigned size) | 25 | }; \ |
78 | static void cmsdk_apb_timer_write(void *opaque, hwaddr offset, uint64_t value, | 26 | - return do_zzi_ool(s, a, fns[a->esz]); \ |
79 | unsigned size) | 27 | -} |
80 | { | 28 | + TRANS_FEAT(NAME##_zzi, aa64_sve, do_zzi_ool, a, name##i_fns[a->esz]) |
81 | - CMSDKAPBTIMER *s = CMSDK_APB_TIMER(opaque); | 29 | |
82 | + CMSDKAPBTimer *s = CMSDK_APB_TIMER(opaque); | 30 | DO_ZZI(SMAX, smax) |
83 | 31 | DO_ZZI(UMAX, umax) | |
84 | trace_cmsdk_apb_timer_write(offset, value, size); | ||
85 | |||
86 | @@ -XXX,XX +XXX,XX @@ static const MemoryRegionOps cmsdk_apb_timer_ops = { | ||
87 | |||
88 | static void cmsdk_apb_timer_tick(void *opaque) | ||
89 | { | ||
90 | - CMSDKAPBTIMER *s = CMSDK_APB_TIMER(opaque); | ||
91 | + CMSDKAPBTimer *s = CMSDK_APB_TIMER(opaque); | ||
92 | |||
93 | if (s->ctrl & R_CTRL_IRQEN_MASK) { | ||
94 | s->intstatus |= R_INTSTATUS_IRQ_MASK; | ||
95 | @@ -XXX,XX +XXX,XX @@ static void cmsdk_apb_timer_tick(void *opaque) | ||
96 | |||
97 | static void cmsdk_apb_timer_reset(DeviceState *dev) | ||
98 | { | ||
99 | - CMSDKAPBTIMER *s = CMSDK_APB_TIMER(dev); | ||
100 | + CMSDKAPBTimer *s = CMSDK_APB_TIMER(dev); | ||
101 | |||
102 | trace_cmsdk_apb_timer_reset(); | ||
103 | s->ctrl = 0; | ||
104 | @@ -XXX,XX +XXX,XX @@ static void cmsdk_apb_timer_reset(DeviceState *dev) | ||
105 | static void cmsdk_apb_timer_init(Object *obj) | ||
106 | { | ||
107 | SysBusDevice *sbd = SYS_BUS_DEVICE(obj); | ||
108 | - CMSDKAPBTIMER *s = CMSDK_APB_TIMER(obj); | ||
109 | + CMSDKAPBTimer *s = CMSDK_APB_TIMER(obj); | ||
110 | |||
111 | memory_region_init_io(&s->iomem, obj, &cmsdk_apb_timer_ops, | ||
112 | s, "cmsdk-apb-timer", 0x1000); | ||
113 | @@ -XXX,XX +XXX,XX @@ static void cmsdk_apb_timer_init(Object *obj) | ||
114 | |||
115 | static void cmsdk_apb_timer_realize(DeviceState *dev, Error **errp) | ||
116 | { | ||
117 | - CMSDKAPBTIMER *s = CMSDK_APB_TIMER(dev); | ||
118 | + CMSDKAPBTimer *s = CMSDK_APB_TIMER(dev); | ||
119 | |||
120 | if (s->pclk_frq == 0) { | ||
121 | error_setg(errp, "CMSDK APB timer: pclk-frq property must be set"); | ||
122 | @@ -XXX,XX +XXX,XX @@ static const VMStateDescription cmsdk_apb_timer_vmstate = { | ||
123 | .version_id = 1, | ||
124 | .minimum_version_id = 1, | ||
125 | .fields = (VMStateField[]) { | ||
126 | - VMSTATE_PTIMER(timer, CMSDKAPBTIMER), | ||
127 | - VMSTATE_UINT32(ctrl, CMSDKAPBTIMER), | ||
128 | - VMSTATE_UINT32(value, CMSDKAPBTIMER), | ||
129 | - VMSTATE_UINT32(reload, CMSDKAPBTIMER), | ||
130 | - VMSTATE_UINT32(intstatus, CMSDKAPBTIMER), | ||
131 | + VMSTATE_PTIMER(timer, CMSDKAPBTimer), | ||
132 | + VMSTATE_UINT32(ctrl, CMSDKAPBTimer), | ||
133 | + VMSTATE_UINT32(value, CMSDKAPBTimer), | ||
134 | + VMSTATE_UINT32(reload, CMSDKAPBTimer), | ||
135 | + VMSTATE_UINT32(intstatus, CMSDKAPBTimer), | ||
136 | VMSTATE_END_OF_LIST() | ||
137 | } | ||
138 | }; | ||
139 | |||
140 | static Property cmsdk_apb_timer_properties[] = { | ||
141 | - DEFINE_PROP_UINT32("pclk-frq", CMSDKAPBTIMER, pclk_frq, 0), | ||
142 | + DEFINE_PROP_UINT32("pclk-frq", CMSDKAPBTimer, pclk_frq, 0), | ||
143 | DEFINE_PROP_END_OF_LIST(), | ||
144 | }; | ||
145 | |||
146 | @@ -XXX,XX +XXX,XX @@ static void cmsdk_apb_timer_class_init(ObjectClass *klass, void *data) | ||
147 | static const TypeInfo cmsdk_apb_timer_info = { | ||
148 | .name = TYPE_CMSDK_APB_TIMER, | ||
149 | .parent = TYPE_SYS_BUS_DEVICE, | ||
150 | - .instance_size = sizeof(CMSDKAPBTIMER), | ||
151 | + .instance_size = sizeof(CMSDKAPBTimer), | ||
152 | .instance_init = cmsdk_apb_timer_init, | ||
153 | .class_init = cmsdk_apb_timer_class_init, | ||
154 | }; | ||
155 | -- | 32 | -- |
156 | 2.20.1 | 33 | 2.25.1 |
157 | |||
158 | diff view generated by jsdifflib |
1 | Add a simple test of the CMSDK dual timer, since we're about to do | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | some refactoring of how it is clocked. | ||
3 | 2 | ||
3 | Use these for the several varieties of floating-point | ||
4 | multiply-add instructions. | ||
5 | |||
6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Message-id: 20220527181907.189259-78-richard.henderson@linaro.org | ||
8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
4 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
5 | Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
6 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
7 | Reviewed-by: Luc Michel <luc@lmichel.fr> | ||
8 | Message-id: 20210128114145.20536-6-peter.maydell@linaro.org | ||
9 | Message-id: 20210121190622.22000-6-peter.maydell@linaro.org | ||
10 | --- | 10 | --- |
11 | tests/qtest/cmsdk-apb-dualtimer-test.c | 130 +++++++++++++++++++++++++ | 11 | target/arm/translate-sve.c | 140 ++++++++++++++----------------------- |
12 | MAINTAINERS | 1 + | 12 | 1 file changed, 53 insertions(+), 87 deletions(-) |
13 | tests/qtest/meson.build | 1 + | ||
14 | 3 files changed, 132 insertions(+) | ||
15 | create mode 100644 tests/qtest/cmsdk-apb-dualtimer-test.c | ||
16 | 13 | ||
17 | diff --git a/tests/qtest/cmsdk-apb-dualtimer-test.c b/tests/qtest/cmsdk-apb-dualtimer-test.c | 14 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c |
18 | new file mode 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
19 | index XXXXXXX..XXXXXXX | 16 | --- a/target/arm/translate-sve.c |
20 | --- /dev/null | 17 | +++ b/target/arm/translate-sve.c |
21 | +++ b/tests/qtest/cmsdk-apb-dualtimer-test.c | 18 | @@ -XXX,XX +XXX,XX @@ static bool gen_gvec_ool_arg_zzxz(DisasContext *s, gen_helper_gvec_4 *fn, |
22 | @@ -XXX,XX +XXX,XX @@ | 19 | return gen_gvec_ool_zzzz(s, fn, a->rd, a->rn, a->rm, a->ra, a->index); |
23 | +/* | 20 | } |
24 | + * QTest testcase for the CMSDK APB dualtimer device | 21 | |
25 | + * | 22 | +/* Invoke an out-of-line helper on 4 Zregs, plus a pointer. */ |
26 | + * Copyright (c) 2021 Linaro Limited | 23 | +static bool gen_gvec_ptr_zzzz(DisasContext *s, gen_helper_gvec_4_ptr *fn, |
27 | + * | 24 | + int rd, int rn, int rm, int ra, |
28 | + * This program is free software; you can redistribute it and/or modify it | 25 | + int data, TCGv_ptr ptr) |
29 | + * under the terms of the GNU General Public License as published by the | ||
30 | + * Free Software Foundation; either version 2 of the License, or | ||
31 | + * (at your option) any later version. | ||
32 | + * | ||
33 | + * This program is distributed in the hope that it will be useful, but WITHOUT | ||
34 | + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
35 | + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
36 | + * for more details. | ||
37 | + */ | ||
38 | + | ||
39 | +#include "qemu/osdep.h" | ||
40 | +#include "libqtest-single.h" | ||
41 | + | ||
42 | +/* IoTKit/ARMSSE dualtimer; driven at 25MHz in mps2-an385, so 40ns per tick */ | ||
43 | +#define TIMER_BASE 0x40002000 | ||
44 | + | ||
45 | +#define TIMER1LOAD 0 | ||
46 | +#define TIMER1VALUE 4 | ||
47 | +#define TIMER1CONTROL 8 | ||
48 | +#define TIMER1INTCLR 0xc | ||
49 | +#define TIMER1RIS 0x10 | ||
50 | +#define TIMER1MIS 0x14 | ||
51 | +#define TIMER1BGLOAD 0x18 | ||
52 | + | ||
53 | +#define TIMER2LOAD 0x20 | ||
54 | +#define TIMER2VALUE 0x24 | ||
55 | +#define TIMER2CONTROL 0x28 | ||
56 | +#define TIMER2INTCLR 0x2c | ||
57 | +#define TIMER2RIS 0x30 | ||
58 | +#define TIMER2MIS 0x34 | ||
59 | +#define TIMER2BGLOAD 0x38 | ||
60 | + | ||
61 | +#define CTRL_ENABLE (1 << 7) | ||
62 | +#define CTRL_PERIODIC (1 << 6) | ||
63 | +#define CTRL_INTEN (1 << 5) | ||
64 | +#define CTRL_PRESCALE_1 (0 << 2) | ||
65 | +#define CTRL_PRESCALE_16 (1 << 2) | ||
66 | +#define CTRL_PRESCALE_256 (2 << 2) | ||
67 | +#define CTRL_32BIT (1 << 1) | ||
68 | +#define CTRL_ONESHOT (1 << 0) | ||
69 | + | ||
70 | +static void test_dualtimer(void) | ||
71 | +{ | 26 | +{ |
72 | + g_assert_true(readl(TIMER_BASE + TIMER1RIS) == 0); | 27 | + if (fn == NULL) { |
73 | + | 28 | + return false; |
74 | + /* Start timer: will fire after 40000 ns */ | 29 | + } |
75 | + writel(TIMER_BASE + TIMER1LOAD, 1000); | 30 | + if (sve_access_check(s)) { |
76 | + /* enable in free-running, wrapping, interrupt mode */ | 31 | + unsigned vsz = vec_full_reg_size(s); |
77 | + writel(TIMER_BASE + TIMER1CONTROL, CTRL_ENABLE | CTRL_INTEN); | 32 | + tcg_gen_gvec_4_ptr(vec_full_reg_offset(s, rd), |
78 | + | 33 | + vec_full_reg_offset(s, rn), |
79 | + /* Step to just past the 500th tick and check VALUE */ | 34 | + vec_full_reg_offset(s, rm), |
80 | + clock_step(500 * 40 + 1); | 35 | + vec_full_reg_offset(s, ra), |
81 | + g_assert_cmpuint(readl(TIMER_BASE + TIMER1RIS), ==, 0); | 36 | + ptr, vsz, vsz, data, fn); |
82 | + g_assert_cmpuint(readl(TIMER_BASE + TIMER1VALUE), ==, 500); | 37 | + } |
83 | + | 38 | + return true; |
84 | + /* Just past the 1000th tick: timer should have fired */ | ||
85 | + clock_step(500 * 40); | ||
86 | + g_assert_cmpuint(readl(TIMER_BASE + TIMER1RIS), ==, 1); | ||
87 | + g_assert_cmpuint(readl(TIMER_BASE + TIMER1VALUE), ==, 0); | ||
88 | + | ||
89 | + /* | ||
90 | + * We are in free-running wrapping 16-bit mode, so on the following | ||
91 | + * tick VALUE should have wrapped round to 0xffff. | ||
92 | + */ | ||
93 | + clock_step(40); | ||
94 | + g_assert_cmpuint(readl(TIMER_BASE + TIMER1VALUE), ==, 0xffff); | ||
95 | + | ||
96 | + /* Check that any write to INTCLR clears interrupt */ | ||
97 | + writel(TIMER_BASE + TIMER1INTCLR, 1); | ||
98 | + g_assert_cmpuint(readl(TIMER_BASE + TIMER1RIS), ==, 0); | ||
99 | + | ||
100 | + /* Turn off the timer */ | ||
101 | + writel(TIMER_BASE + TIMER1CONTROL, 0); | ||
102 | +} | 39 | +} |
103 | + | 40 | + |
104 | +static void test_prescale(void) | 41 | +static bool gen_gvec_fpst_zzzz(DisasContext *s, gen_helper_gvec_4_ptr *fn, |
42 | + int rd, int rn, int rm, int ra, | ||
43 | + int data, ARMFPStatusFlavour flavour) | ||
105 | +{ | 44 | +{ |
106 | + g_assert_true(readl(TIMER_BASE + TIMER2RIS) == 0); | 45 | + TCGv_ptr status = fpstatus_ptr(flavour); |
107 | + | 46 | + bool ret = gen_gvec_ptr_zzzz(s, fn, rd, rn, rm, ra, data, status); |
108 | + /* Start timer: will fire after 40 * 256 * 1000 == 1024000 ns */ | 47 | + tcg_temp_free_ptr(status); |
109 | + writel(TIMER_BASE + TIMER2LOAD, 1000); | 48 | + return ret; |
110 | + /* enable in periodic, wrapping, interrupt mode, prescale 256 */ | ||
111 | + writel(TIMER_BASE + TIMER2CONTROL, | ||
112 | + CTRL_ENABLE | CTRL_INTEN | CTRL_PERIODIC | CTRL_PRESCALE_256); | ||
113 | + | ||
114 | + /* Step to just past the 500th tick and check VALUE */ | ||
115 | + clock_step(40 * 256 * 501); | ||
116 | + g_assert_cmpuint(readl(TIMER_BASE + TIMER2RIS), ==, 0); | ||
117 | + g_assert_cmpuint(readl(TIMER_BASE + TIMER2VALUE), ==, 500); | ||
118 | + | ||
119 | + /* Just past the 1000th tick: timer should have fired */ | ||
120 | + clock_step(40 * 256 * 500); | ||
121 | + g_assert_cmpuint(readl(TIMER_BASE + TIMER2RIS), ==, 1); | ||
122 | + g_assert_cmpuint(readl(TIMER_BASE + TIMER2VALUE), ==, 0); | ||
123 | + | ||
124 | + /* In periodic mode the tick VALUE now reloads */ | ||
125 | + clock_step(40 * 256); | ||
126 | + g_assert_cmpuint(readl(TIMER_BASE + TIMER2VALUE), ==, 1000); | ||
127 | + | ||
128 | + /* Check that any write to INTCLR clears interrupt */ | ||
129 | + writel(TIMER_BASE + TIMER2INTCLR, 1); | ||
130 | + g_assert_cmpuint(readl(TIMER_BASE + TIMER2RIS), ==, 0); | ||
131 | + | ||
132 | + /* Turn off the timer */ | ||
133 | + writel(TIMER_BASE + TIMER2CONTROL, 0); | ||
134 | +} | 49 | +} |
135 | + | 50 | + |
136 | +int main(int argc, char **argv) | 51 | /* Invoke an out-of-line helper on 2 Zregs and a predicate. */ |
137 | +{ | 52 | static bool gen_gvec_ool_zzp(DisasContext *s, gen_helper_gvec_3 *fn, |
138 | + int r; | 53 | int rd, int rn, int pg, int data) |
54 | @@ -XXX,XX +XXX,XX @@ DO_SVE2_RRXR_ROT(CDOT_zzxw_d, gen_helper_sve2_cdot_idx_d) | ||
55 | |||
56 | static bool do_FMLA_zzxz(DisasContext *s, arg_rrxr_esz *a, bool sub) | ||
57 | { | ||
58 | - static gen_helper_gvec_4_ptr * const fns[3] = { | ||
59 | + static gen_helper_gvec_4_ptr * const fns[4] = { | ||
60 | + NULL, | ||
61 | gen_helper_gvec_fmla_idx_h, | ||
62 | gen_helper_gvec_fmla_idx_s, | ||
63 | gen_helper_gvec_fmla_idx_d, | ||
64 | }; | ||
65 | - | ||
66 | - if (sve_access_check(s)) { | ||
67 | - unsigned vsz = vec_full_reg_size(s); | ||
68 | - TCGv_ptr status = fpstatus_ptr(a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR); | ||
69 | - tcg_gen_gvec_4_ptr(vec_full_reg_offset(s, a->rd), | ||
70 | - vec_full_reg_offset(s, a->rn), | ||
71 | - vec_full_reg_offset(s, a->rm), | ||
72 | - vec_full_reg_offset(s, a->ra), | ||
73 | - status, vsz, vsz, (a->index << 1) | sub, | ||
74 | - fns[a->esz - 1]); | ||
75 | - tcg_temp_free_ptr(status); | ||
76 | - } | ||
77 | - return true; | ||
78 | + return gen_gvec_fpst_zzzz(s, fns[a->esz], a->rd, a->rn, a->rm, a->ra, | ||
79 | + (a->index << 1) | sub, | ||
80 | + a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR); | ||
81 | } | ||
82 | |||
83 | static bool trans_FMLA_zzxz(DisasContext *s, arg_FMLA_zzxz *a) | ||
84 | @@ -XXX,XX +XXX,XX @@ static bool trans_FCMLA_zpzzz(DisasContext *s, arg_FCMLA_zpzzz *a) | ||
85 | |||
86 | static bool trans_FCMLA_zzxz(DisasContext *s, arg_FCMLA_zzxz *a) | ||
87 | { | ||
88 | - static gen_helper_gvec_4_ptr * const fns[2] = { | ||
89 | + static gen_helper_gvec_4_ptr * const fns[4] = { | ||
90 | + NULL, | ||
91 | gen_helper_gvec_fcmlah_idx, | ||
92 | gen_helper_gvec_fcmlas_idx, | ||
93 | + NULL, | ||
94 | }; | ||
95 | |||
96 | - tcg_debug_assert(a->esz == 1 || a->esz == 2); | ||
97 | tcg_debug_assert(a->rd == a->ra); | ||
98 | - if (sve_access_check(s)) { | ||
99 | - unsigned vsz = vec_full_reg_size(s); | ||
100 | - TCGv_ptr status = fpstatus_ptr(a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR); | ||
101 | - tcg_gen_gvec_4_ptr(vec_full_reg_offset(s, a->rd), | ||
102 | - vec_full_reg_offset(s, a->rn), | ||
103 | - vec_full_reg_offset(s, a->rm), | ||
104 | - vec_full_reg_offset(s, a->ra), | ||
105 | - status, vsz, vsz, | ||
106 | - a->index * 4 + a->rot, | ||
107 | - fns[a->esz - 1]); | ||
108 | - tcg_temp_free_ptr(status); | ||
109 | - } | ||
110 | - return true; | ||
139 | + | 111 | + |
140 | + g_test_init(&argc, &argv, NULL); | 112 | + return gen_gvec_fpst_zzzz(s, fns[a->esz], a->rd, a->rn, a->rm, a->ra, |
141 | + | 113 | + a->index * 4 + a->rot, |
142 | + qtest_start("-machine mps2-an385"); | 114 | + a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR); |
143 | + | 115 | } |
144 | + qtest_add_func("/cmsdk-apb-dualtimer/dualtimer", test_dualtimer); | 116 | |
145 | + qtest_add_func("/cmsdk-apb-dualtimer/prescale", test_prescale); | 117 | /* |
146 | + | 118 | @@ -XXX,XX +XXX,XX @@ static bool trans_FMMLA(DisasContext *s, arg_rrrr_esz *a) |
147 | + r = g_test_run(); | 119 | return false; |
148 | + | 120 | } |
149 | + qtest_end(); | 121 | |
150 | + | 122 | - if (sve_access_check(s)) { |
151 | + return r; | 123 | - unsigned vsz = vec_full_reg_size(s); |
152 | +} | 124 | - TCGv_ptr status = fpstatus_ptr(FPST_FPCR); |
153 | diff --git a/MAINTAINERS b/MAINTAINERS | 125 | - tcg_gen_gvec_4_ptr(vec_full_reg_offset(s, a->rd), |
154 | index XXXXXXX..XXXXXXX 100644 | 126 | - vec_full_reg_offset(s, a->rn), |
155 | --- a/MAINTAINERS | 127 | - vec_full_reg_offset(s, a->rm), |
156 | +++ b/MAINTAINERS | 128 | - vec_full_reg_offset(s, a->ra), |
157 | @@ -XXX,XX +XXX,XX @@ F: include/hw/timer/cmsdk-apb-timer.h | 129 | - status, vsz, vsz, 0, fn); |
158 | F: tests/qtest/cmsdk-apb-timer-test.c | 130 | - tcg_temp_free_ptr(status); |
159 | F: hw/timer/cmsdk-apb-dualtimer.c | 131 | - } |
160 | F: include/hw/timer/cmsdk-apb-dualtimer.h | 132 | - return true; |
161 | +F: tests/qtest/cmsdk-apb-dualtimer-test.c | 133 | + return gen_gvec_fpst_zzzz(s, fn, a->rd, a->rn, a->rm, a->ra, 0, FPST_FPCR); |
162 | F: hw/char/cmsdk-apb-uart.c | 134 | } |
163 | F: include/hw/char/cmsdk-apb-uart.h | 135 | |
164 | F: hw/watchdog/cmsdk-apb-watchdog.c | 136 | static gen_helper_gvec_4 * const sqdmlal_zzzw_fns[] = { |
165 | diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build | 137 | @@ -XXX,XX +XXX,XX @@ static bool do_FMLAL_zzzw(DisasContext *s, arg_rrrr_esz *a, bool sub, bool sel) |
166 | index XXXXXXX..XXXXXXX 100644 | 138 | if (!dc_isar_feature(aa64_sve2, s)) { |
167 | --- a/tests/qtest/meson.build | 139 | return false; |
168 | +++ b/tests/qtest/meson.build | 140 | } |
169 | @@ -XXX,XX +XXX,XX @@ qtests_npcm7xx = \ | 141 | - if (sve_access_check(s)) { |
170 | 'npcm7xx_timer-test', | 142 | - unsigned vsz = vec_full_reg_size(s); |
171 | 'npcm7xx_watchdog_timer-test'] | 143 | - tcg_gen_gvec_4_ptr(vec_full_reg_offset(s, a->rd), |
172 | qtests_arm = \ | 144 | - vec_full_reg_offset(s, a->rn), |
173 | + (config_all_devices.has_key('CONFIG_CMSDK_APB_DUALTIMER') ? ['cmsdk-apb-dualtimer-test'] : []) + \ | 145 | - vec_full_reg_offset(s, a->rm), |
174 | (config_all_devices.has_key('CONFIG_CMSDK_APB_TIMER') ? ['cmsdk-apb-timer-test'] : []) + \ | 146 | - vec_full_reg_offset(s, a->ra), |
175 | (config_all_devices.has_key('CONFIG_CMSDK_APB_WATCHDOG') ? ['cmsdk-apb-watchdog-test'] : []) + \ | 147 | - cpu_env, vsz, vsz, (sel << 1) | sub, |
176 | (config_all_devices.has_key('CONFIG_PFLASH_CFI02') ? ['pflash-cfi02-test'] : []) + \ | 148 | - gen_helper_sve2_fmlal_zzzw_s); |
149 | - } | ||
150 | - return true; | ||
151 | + return gen_gvec_ptr_zzzz(s, gen_helper_sve2_fmlal_zzzw_s, | ||
152 | + a->rd, a->rn, a->rm, a->ra, | ||
153 | + (sel << 1) | sub, cpu_env); | ||
154 | } | ||
155 | |||
156 | static bool trans_FMLALB_zzzw(DisasContext *s, arg_rrrr_esz *a) | ||
157 | @@ -XXX,XX +XXX,XX @@ static bool do_FMLAL_zzxw(DisasContext *s, arg_rrxr_esz *a, bool sub, bool sel) | ||
158 | if (!dc_isar_feature(aa64_sve2, s)) { | ||
159 | return false; | ||
160 | } | ||
161 | - if (sve_access_check(s)) { | ||
162 | - unsigned vsz = vec_full_reg_size(s); | ||
163 | - tcg_gen_gvec_4_ptr(vec_full_reg_offset(s, a->rd), | ||
164 | - vec_full_reg_offset(s, a->rn), | ||
165 | - vec_full_reg_offset(s, a->rm), | ||
166 | - vec_full_reg_offset(s, a->ra), | ||
167 | - cpu_env, vsz, vsz, | ||
168 | - (a->index << 2) | (sel << 1) | sub, | ||
169 | - gen_helper_sve2_fmlal_zzxw_s); | ||
170 | - } | ||
171 | - return true; | ||
172 | + return gen_gvec_ptr_zzzz(s, gen_helper_sve2_fmlal_zzxw_s, | ||
173 | + a->rd, a->rn, a->rm, a->ra, | ||
174 | + (a->index << 2) | (sel << 1) | sub, cpu_env); | ||
175 | } | ||
176 | |||
177 | static bool trans_FMLALB_zzxw(DisasContext *s, arg_rrxr_esz *a) | ||
178 | @@ -XXX,XX +XXX,XX @@ static bool do_BFMLAL_zzzw(DisasContext *s, arg_rrrr_esz *a, bool sel) | ||
179 | if (!dc_isar_feature(aa64_sve_bf16, s)) { | ||
180 | return false; | ||
181 | } | ||
182 | - if (sve_access_check(s)) { | ||
183 | - TCGv_ptr status = fpstatus_ptr(FPST_FPCR); | ||
184 | - unsigned vsz = vec_full_reg_size(s); | ||
185 | - | ||
186 | - tcg_gen_gvec_4_ptr(vec_full_reg_offset(s, a->rd), | ||
187 | - vec_full_reg_offset(s, a->rn), | ||
188 | - vec_full_reg_offset(s, a->rm), | ||
189 | - vec_full_reg_offset(s, a->ra), | ||
190 | - status, vsz, vsz, sel, | ||
191 | - gen_helper_gvec_bfmlal); | ||
192 | - tcg_temp_free_ptr(status); | ||
193 | - } | ||
194 | - return true; | ||
195 | + return gen_gvec_fpst_zzzz(s, gen_helper_gvec_bfmlal, | ||
196 | + a->rd, a->rn, a->rm, a->ra, sel, FPST_FPCR); | ||
197 | } | ||
198 | |||
199 | static bool trans_BFMLALB_zzzw(DisasContext *s, arg_rrrr_esz *a) | ||
200 | @@ -XXX,XX +XXX,XX @@ static bool do_BFMLAL_zzxw(DisasContext *s, arg_rrxr_esz *a, bool sel) | ||
201 | if (!dc_isar_feature(aa64_sve_bf16, s)) { | ||
202 | return false; | ||
203 | } | ||
204 | - if (sve_access_check(s)) { | ||
205 | - TCGv_ptr status = fpstatus_ptr(FPST_FPCR); | ||
206 | - unsigned vsz = vec_full_reg_size(s); | ||
207 | - | ||
208 | - tcg_gen_gvec_4_ptr(vec_full_reg_offset(s, a->rd), | ||
209 | - vec_full_reg_offset(s, a->rn), | ||
210 | - vec_full_reg_offset(s, a->rm), | ||
211 | - vec_full_reg_offset(s, a->ra), | ||
212 | - status, vsz, vsz, (a->index << 1) | sel, | ||
213 | - gen_helper_gvec_bfmlal_idx); | ||
214 | - tcg_temp_free_ptr(status); | ||
215 | - } | ||
216 | - return true; | ||
217 | + return gen_gvec_fpst_zzzz(s, gen_helper_gvec_bfmlal_idx, | ||
218 | + a->rd, a->rn, a->rm, a->ra, | ||
219 | + (a->index << 1) | sel, FPST_FPCR); | ||
220 | } | ||
221 | |||
222 | static bool trans_BFMLALB_zzxw(DisasContext *s, arg_rrxr_esz *a) | ||
177 | -- | 223 | -- |
178 | 2.20.1 | 224 | 2.25.1 |
179 | |||
180 | diff view generated by jsdifflib |
1 | From: Joelle van Dyne <j@getutm.app> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | A workaround added in early days of 64-bit OSX forced x86_64 if the | 3 | Being able to specify the feature predicate in TRANS_FEAT |
4 | host machine had 64-bit support. This creates issues when cross- | 4 | makes it easier to split trans_FMMLA by element size, |
5 | compiling for ARM64. Additionally, the user can always use --cpu=* to | 5 | which also happens to simplify the decode. |
6 | manually set the host CPU and therefore this workaround should be | ||
7 | removed. | ||
8 | 6 | ||
7 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
8 | Message-id: 20220527181907.189259-79-richard.henderson@linaro.org | ||
9 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
10 | Signed-off-by: Joelle van Dyne <j@getutm.app> | ||
11 | Message-id: 20210126012457.39046-12-j@getutm.app | ||
12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
13 | --- | 11 | --- |
14 | configure | 11 ----------- | 12 | target/arm/sve.decode | 7 +++---- |
15 | 1 file changed, 11 deletions(-) | 13 | target/arm/translate-sve.c | 27 ++++----------------------- |
14 | 2 files changed, 7 insertions(+), 27 deletions(-) | ||
16 | 15 | ||
17 | diff --git a/configure b/configure | 16 | diff --git a/target/arm/sve.decode b/target/arm/sve.decode |
18 | index XXXXXXX..XXXXXXX 100755 | 17 | index XXXXXXX..XXXXXXX 100644 |
19 | --- a/configure | 18 | --- a/target/arm/sve.decode |
20 | +++ b/configure | 19 | +++ b/target/arm/sve.decode |
21 | @@ -XXX,XX +XXX,XX @@ fi | 20 | @@ -XXX,XX +XXX,XX @@ SQRDCMLAH_zzzz 01000100 esz:2 0 rm:5 0011 rot:2 rn:5 rd:5 ra=%reg_movprfx |
22 | # the correct CPU with the --cpu option. | 21 | USDOT_zzzz 01000100 .. 0 ..... 011 110 ..... ..... @rda_rn_rm |
23 | case $targetos in | 22 | |
24 | Darwin) | 23 | ### SVE2 floating point matrix multiply accumulate |
25 | - # on Leopard most of the system is 32-bit, so we have to ask the kernel if we can | 24 | -{ |
26 | - # run 64-bit userspace code. | 25 | - BFMMLA 01100100 01 1 ..... 111 001 ..... ..... @rda_rn_rm_e0 |
27 | - # If the user didn't specify a CPU explicitly and the kernel says this is | 26 | - FMMLA 01100100 .. 1 ..... 111 001 ..... ..... @rda_rn_rm |
28 | - # 64 bit hw, then assume x86_64. Otherwise fall through to the usual detection code. | 27 | -} |
29 | - if test -z "$cpu" && test "$(sysctl -n hw.optional.x86_64)" = "1"; then | 28 | +BFMMLA 01100100 01 1 ..... 111 001 ..... ..... @rda_rn_rm_e0 |
30 | - cpu="x86_64" | 29 | +FMMLA_s 01100100 10 1 ..... 111 001 ..... ..... @rda_rn_rm_e0 |
31 | - fi | 30 | +FMMLA_d 01100100 11 1 ..... 111 001 ..... ..... @rda_rn_rm_e0 |
32 | HOST_DSOSUF=".dylib" | 31 | |
33 | ;; | 32 | ### SVE2 Memory Gather Load Group |
34 | SunOS) | 33 | |
35 | @@ -XXX,XX +XXX,XX @@ OpenBSD) | 34 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c |
36 | Darwin) | 35 | index XXXXXXX..XXXXXXX 100644 |
37 | bsd="yes" | 36 | --- a/target/arm/translate-sve.c |
38 | darwin="yes" | 37 | +++ b/target/arm/translate-sve.c |
39 | - if [ "$cpu" = "x86_64" ] ; then | 38 | @@ -XXX,XX +XXX,XX @@ DO_SVE2_ZPZZ_FP(FMINP, fminp) |
40 | - QEMU_CFLAGS="-arch x86_64 $QEMU_CFLAGS" | 39 | * SVE Integer Multiply-Add (unpredicated) |
41 | - QEMU_LDFLAGS="-arch x86_64 $QEMU_LDFLAGS" | 40 | */ |
42 | - fi | 41 | |
43 | audio_drv_list="try-coreaudio try-sdl" | 42 | -static bool trans_FMMLA(DisasContext *s, arg_rrrr_esz *a) |
44 | audio_possible_drivers="coreaudio sdl" | 43 | -{ |
45 | # Disable attempts to use ObjectiveC features in os/object.h since they | 44 | - gen_helper_gvec_4_ptr *fn; |
45 | - | ||
46 | - switch (a->esz) { | ||
47 | - case MO_32: | ||
48 | - if (!dc_isar_feature(aa64_sve_f32mm, s)) { | ||
49 | - return false; | ||
50 | - } | ||
51 | - fn = gen_helper_fmmla_s; | ||
52 | - break; | ||
53 | - case MO_64: | ||
54 | - if (!dc_isar_feature(aa64_sve_f64mm, s)) { | ||
55 | - return false; | ||
56 | - } | ||
57 | - fn = gen_helper_fmmla_d; | ||
58 | - break; | ||
59 | - default: | ||
60 | - return false; | ||
61 | - } | ||
62 | - | ||
63 | - return gen_gvec_fpst_zzzz(s, fn, a->rd, a->rn, a->rm, a->ra, 0, FPST_FPCR); | ||
64 | -} | ||
65 | +TRANS_FEAT(FMMLA_s, aa64_sve_f32mm, gen_gvec_fpst_zzzz, gen_helper_fmmla_s, | ||
66 | + a->rd, a->rn, a->rm, a->ra, 0, FPST_FPCR) | ||
67 | +TRANS_FEAT(FMMLA_d, aa64_sve_f64mm, gen_gvec_fpst_zzzz, gen_helper_fmmla_d, | ||
68 | + a->rd, a->rn, a->rm, a->ra, 0, FPST_FPCR) | ||
69 | |||
70 | static gen_helper_gvec_4 * const sqdmlal_zzzw_fns[] = { | ||
71 | NULL, gen_helper_sve2_sqdmlal_zzzw_h, | ||
46 | -- | 72 | -- |
47 | 2.20.1 | 73 | 2.25.1 |
48 | |||
49 | diff view generated by jsdifflib |
1 | From: Paolo Bonzini <pbonzini@redhat.com> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | The properties to attach a CANBUS object to the xlnx-zcu102 machine have | 3 | Combined with the check already present in gen_mov_p, |
4 | a period in them. We want to use periods in properties for compound QAPI types, | 4 | we can simplify some special cases in trans_AND_pppp |
5 | and besides the "xlnx-zcu102." prefix is both unnecessary and different | 5 | and trans_BIC_pppp. |
6 | from any other machine property name. Remove it. | ||
7 | 6 | ||
8 | Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> | 7 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
9 | Message-id: 20210118162537.779542-1-pbonzini@redhat.com | 8 | Message-id: 20220527181907.189259-80-richard.henderson@linaro.org |
10 | Reviewed-by: Vikram Garhwal <fnu.vikram@xilinx.com> | 9 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
12 | --- | 11 | --- |
13 | hw/arm/xlnx-zcu102.c | 4 ++-- | 12 | target/arm/translate-sve.c | 30 ++++++++++++------------------ |
14 | tests/qtest/xlnx-can-test.c | 30 +++++++++++++++--------------- | 13 | 1 file changed, 12 insertions(+), 18 deletions(-) |
15 | 2 files changed, 17 insertions(+), 17 deletions(-) | ||
16 | 14 | ||
17 | diff --git a/hw/arm/xlnx-zcu102.c b/hw/arm/xlnx-zcu102.c | 15 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c |
18 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
19 | --- a/hw/arm/xlnx-zcu102.c | 17 | --- a/target/arm/translate-sve.c |
20 | +++ b/hw/arm/xlnx-zcu102.c | 18 | +++ b/target/arm/translate-sve.c |
21 | @@ -XXX,XX +XXX,XX @@ static void xlnx_zcu102_machine_instance_init(Object *obj) | 19 | @@ -XXX,XX +XXX,XX @@ static void do_dupi_z(DisasContext *s, int rd, uint64_t word) |
22 | s->secure = false; | 20 | } |
23 | /* Default to virt (EL2) being disabled */ | 21 | |
24 | s->virt = false; | 22 | /* Invoke a vector expander on three Pregs. */ |
25 | - object_property_add_link(obj, "xlnx-zcu102.canbus0", TYPE_CAN_BUS, | 23 | -static void gen_gvec_fn_ppp(DisasContext *s, GVecGen3Fn *gvec_fn, |
26 | + object_property_add_link(obj, "canbus0", TYPE_CAN_BUS, | 24 | +static bool gen_gvec_fn_ppp(DisasContext *s, GVecGen3Fn *gvec_fn, |
27 | (Object **)&s->canbus[0], | 25 | int rd, int rn, int rm) |
28 | object_property_allow_set_link, | 26 | { |
29 | 0); | 27 | - unsigned psz = pred_gvec_reg_size(s); |
30 | 28 | - gvec_fn(MO_64, pred_full_reg_offset(s, rd), | |
31 | - object_property_add_link(obj, "xlnx-zcu102.canbus1", TYPE_CAN_BUS, | 29 | - pred_full_reg_offset(s, rn), |
32 | + object_property_add_link(obj, "canbus1", TYPE_CAN_BUS, | 30 | - pred_full_reg_offset(s, rm), psz, psz); |
33 | (Object **)&s->canbus[1], | 31 | + if (sve_access_check(s)) { |
34 | object_property_allow_set_link, | 32 | + unsigned psz = pred_gvec_reg_size(s); |
35 | 0); | 33 | + gvec_fn(MO_64, pred_full_reg_offset(s, rd), |
36 | diff --git a/tests/qtest/xlnx-can-test.c b/tests/qtest/xlnx-can-test.c | 34 | + pred_full_reg_offset(s, rn), |
37 | index XXXXXXX..XXXXXXX 100644 | 35 | + pred_full_reg_offset(s, rm), psz, psz); |
38 | --- a/tests/qtest/xlnx-can-test.c | 36 | + } |
39 | +++ b/tests/qtest/xlnx-can-test.c | 37 | + return true; |
40 | @@ -XXX,XX +XXX,XX @@ static void test_can_bus(void) | 38 | } |
41 | uint8_t can_timestamp = 1; | 39 | |
42 | 40 | /* Invoke a vector move on two Pregs. */ | |
43 | QTestState *qts = qtest_init("-machine xlnx-zcu102" | 41 | @@ -XXX,XX +XXX,XX @@ static bool trans_AND_pppp(DisasContext *s, arg_rprr_s *a) |
44 | - " -object can-bus,id=canbus0" | 42 | }; |
45 | - " -machine xlnx-zcu102.canbus0=canbus0" | 43 | |
46 | - " -machine xlnx-zcu102.canbus1=canbus0" | 44 | if (!a->s) { |
47 | + " -object can-bus,id=canbus" | 45 | - if (!sve_access_check(s)) { |
48 | + " -machine canbus0=canbus" | 46 | - return true; |
49 | + " -machine canbus1=canbus" | 47 | - } |
50 | ); | 48 | if (a->rn == a->rm) { |
51 | 49 | if (a->pg == a->rn) { | |
52 | /* Configure the CAN0 and CAN1. */ | 50 | - do_mov_p(s, a->rd, a->rn); |
53 | @@ -XXX,XX +XXX,XX @@ static void test_can_loopback(void) | 51 | - } else { |
54 | uint32_t status = 0; | 52 | - gen_gvec_fn_ppp(s, tcg_gen_gvec_and, a->rd, a->rn, a->pg); |
55 | 53 | + return do_mov_p(s, a->rd, a->rn); | |
56 | QTestState *qts = qtest_init("-machine xlnx-zcu102" | 54 | } |
57 | - " -object can-bus,id=canbus0" | 55 | - return true; |
58 | - " -machine xlnx-zcu102.canbus0=canbus0" | 56 | + return gen_gvec_fn_ppp(s, tcg_gen_gvec_and, a->rd, a->rn, a->pg); |
59 | - " -machine xlnx-zcu102.canbus1=canbus0" | 57 | } else if (a->pg == a->rn || a->pg == a->rm) { |
60 | + " -object can-bus,id=canbus" | 58 | - gen_gvec_fn_ppp(s, tcg_gen_gvec_and, a->rd, a->rn, a->rm); |
61 | + " -machine canbus0=canbus" | 59 | - return true; |
62 | + " -machine canbus1=canbus" | 60 | + return gen_gvec_fn_ppp(s, tcg_gen_gvec_and, a->rd, a->rn, a->rm); |
63 | ); | 61 | } |
64 | 62 | } | |
65 | /* Configure the CAN0 in loopback mode. */ | 63 | return do_pppp_flags(s, a, &op); |
66 | @@ -XXX,XX +XXX,XX @@ static void test_can_filter(void) | 64 | @@ -XXX,XX +XXX,XX @@ static bool trans_BIC_pppp(DisasContext *s, arg_rprr_s *a) |
67 | uint8_t can_timestamp = 1; | 65 | }; |
68 | 66 | ||
69 | QTestState *qts = qtest_init("-machine xlnx-zcu102" | 67 | if (!a->s && a->pg == a->rn) { |
70 | - " -object can-bus,id=canbus0" | 68 | - if (sve_access_check(s)) { |
71 | - " -machine xlnx-zcu102.canbus0=canbus0" | 69 | - gen_gvec_fn_ppp(s, tcg_gen_gvec_andc, a->rd, a->rn, a->rm); |
72 | - " -machine xlnx-zcu102.canbus1=canbus0" | 70 | - } |
73 | + " -object can-bus,id=canbus" | 71 | - return true; |
74 | + " -machine canbus0=canbus" | 72 | + return gen_gvec_fn_ppp(s, tcg_gen_gvec_andc, a->rd, a->rn, a->rm); |
75 | + " -machine canbus1=canbus" | 73 | } |
76 | ); | 74 | return do_pppp_flags(s, a, &op); |
77 | 75 | } | |
78 | /* Configure the CAN0 and CAN1. */ | ||
79 | @@ -XXX,XX +XXX,XX @@ static void test_can_sleepmode(void) | ||
80 | uint8_t can_timestamp = 1; | ||
81 | |||
82 | QTestState *qts = qtest_init("-machine xlnx-zcu102" | ||
83 | - " -object can-bus,id=canbus0" | ||
84 | - " -machine xlnx-zcu102.canbus0=canbus0" | ||
85 | - " -machine xlnx-zcu102.canbus1=canbus0" | ||
86 | + " -object can-bus,id=canbus" | ||
87 | + " -machine canbus0=canbus" | ||
88 | + " -machine canbus1=canbus" | ||
89 | ); | ||
90 | |||
91 | /* Configure the CAN0. */ | ||
92 | @@ -XXX,XX +XXX,XX @@ static void test_can_snoopmode(void) | ||
93 | uint8_t can_timestamp = 1; | ||
94 | |||
95 | QTestState *qts = qtest_init("-machine xlnx-zcu102" | ||
96 | - " -object can-bus,id=canbus0" | ||
97 | - " -machine xlnx-zcu102.canbus0=canbus0" | ||
98 | - " -machine xlnx-zcu102.canbus1=canbus0" | ||
99 | + " -object can-bus,id=canbus" | ||
100 | + " -machine canbus0=canbus" | ||
101 | + " -machine canbus1=canbus" | ||
102 | ); | ||
103 | |||
104 | /* Configure the CAN0. */ | ||
105 | -- | 76 | -- |
106 | 2.20.1 | 77 | 2.25.1 |
107 | |||
108 | diff view generated by jsdifflib |
1 | Now that the watchdog device uses its Clock input rather than being | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | passed the value of system_clock_scale at creation time, we can | ||
3 | remove the hack where we reset the STELLARIS_SYS at board creation | ||
4 | time to force it to set system_clock_scale. Instead it will be reset | ||
5 | at the usual point in startup and will inform the watchdog of the | ||
6 | clock frequency at that point. | ||
7 | 2 | ||
3 | This alias is defined on EOR (prediates). While the | ||
4 | same operation could be performed with NAND or NOR, | ||
5 | only bother with the official alias. | ||
6 | |||
7 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
8 | Message-id: 20220527181907.189259-81-richard.henderson@linaro.org | ||
9 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
9 | Reviewed-by: Luc Michel <luc@lmichel.fr> | ||
10 | Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
11 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
12 | Message-id: 20210128114145.20536-26-peter.maydell@linaro.org | ||
13 | Message-id: 20210121190622.22000-26-peter.maydell@linaro.org | ||
14 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
15 | --- | 11 | --- |
16 | hw/arm/stellaris.c | 10 ---------- | 12 | target/arm/translate-sve.c | 5 +++++ |
17 | 1 file changed, 10 deletions(-) | 13 | 1 file changed, 5 insertions(+) |
18 | 14 | ||
19 | diff --git a/hw/arm/stellaris.c b/hw/arm/stellaris.c | 15 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c |
20 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
21 | --- a/hw/arm/stellaris.c | 17 | --- a/target/arm/translate-sve.c |
22 | +++ b/hw/arm/stellaris.c | 18 | +++ b/target/arm/translate-sve.c |
23 | @@ -XXX,XX +XXX,XX @@ static DeviceState *stellaris_sys_init(uint32_t base, qemu_irq irq, | 19 | @@ -XXX,XX +XXX,XX @@ static bool trans_EOR_pppp(DisasContext *s, arg_rprr_s *a) |
24 | sysbus_mmio_map(sbd, 0, base); | 20 | .fno = gen_helper_sve_eor_pppp, |
25 | sysbus_connect_irq(sbd, 0, irq); | 21 | .prefer_i64 = TCG_TARGET_REG_BITS == 64, |
26 | 22 | }; | |
27 | - /* | 23 | + |
28 | - * Normally we should not be resetting devices like this during | 24 | + /* Alias NOT (predicate) is EOR Pd.B, Pg/Z, Pn.B, Pg.B */ |
29 | - * board creation. For the moment we need to do so, because | 25 | + if (!a->s && a->pg == a->rm) { |
30 | - * system_clock_scale will only get set when the STELLARIS_SYS | 26 | + return gen_gvec_fn_ppp(s, tcg_gen_gvec_andc, a->rd, a->pg, a->rn); |
31 | - * device is reset, and we need its initial value to pass to | 27 | + } |
32 | - * the watchdog device. This hack can be removed once the | 28 | return do_pppp_flags(s, a, &op); |
33 | - * watchdog has been converted to use a Clock input instead. | ||
34 | - */ | ||
35 | - device_cold_reset(dev); | ||
36 | - | ||
37 | return dev; | ||
38 | } | 29 | } |
39 | 30 | ||
40 | -- | 31 | -- |
41 | 2.20.1 | 32 | 2.25.1 |
42 | |||
43 | diff view generated by jsdifflib |
1 | From: Joelle van Dyne <j@getutm.app> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | On iOS there is no CoreAudio, so we should not assume Darwin always | 3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
4 | has it. | 4 | Message-id: 20220527181907.189259-82-richard.henderson@linaro.org |
5 | 5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | |
6 | Signed-off-by: Joelle van Dyne <j@getutm.app> | ||
7 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
8 | Message-id: 20210126012457.39046-11-j@getutm.app | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
10 | --- | 7 | --- |
11 | configure | 35 +++++++++++++++++++++++++++++++++-- | 8 | target/arm/translate-sve.c | 5 +---- |
12 | 1 file changed, 33 insertions(+), 2 deletions(-) | 9 | 1 file changed, 1 insertion(+), 4 deletions(-) |
13 | 10 | ||
14 | diff --git a/configure b/configure | 11 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c |
15 | index XXXXXXX..XXXXXXX 100755 | 12 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/configure | 13 | --- a/target/arm/translate-sve.c |
17 | +++ b/configure | 14 | +++ b/target/arm/translate-sve.c |
18 | @@ -XXX,XX +XXX,XX @@ fdt="auto" | 15 | @@ -XXX,XX +XXX,XX @@ static gen_helper_gvec_4 * const udiv_fns[4] = { |
19 | netmap="no" | 16 | }; |
20 | sdl="auto" | 17 | TRANS_FEAT(UDIV_zpzz, aa64_sve, gen_gvec_ool_arg_zpzz, udiv_fns[a->esz], a, 0) |
21 | sdl_image="auto" | 18 | |
22 | +coreaudio="auto" | 19 | -static bool trans_SEL_zpzz(DisasContext *s, arg_rprr_esz *a) |
23 | virtiofsd="auto" | 20 | -{ |
24 | virtfs="auto" | 21 | - return do_sel_z(s, a->rd, a->rn, a->rm, a->pg, a->esz); |
25 | libudev="auto" | 22 | -} |
26 | @@ -XXX,XX +XXX,XX @@ Darwin) | 23 | +TRANS_FEAT(SEL_zpzz, aa64_sve, do_sel_z, a->rd, a->rn, a->rm, a->pg, a->esz) |
27 | QEMU_CFLAGS="-arch x86_64 $QEMU_CFLAGS" | 24 | |
28 | QEMU_LDFLAGS="-arch x86_64 $QEMU_LDFLAGS" | 25 | /* |
29 | fi | 26 | *** SVE Integer Arithmetic - Unary Predicated Group |
30 | - audio_drv_list="coreaudio try-sdl" | ||
31 | + audio_drv_list="try-coreaudio try-sdl" | ||
32 | audio_possible_drivers="coreaudio sdl" | ||
33 | # Disable attempts to use ObjectiveC features in os/object.h since they | ||
34 | # won't work when we're compiling with gcc as a C compiler. | ||
35 | @@ -XXX,XX +XXX,XX @@ EOF | ||
36 | fi | ||
37 | fi | ||
38 | |||
39 | +########################################## | ||
40 | +# detect CoreAudio | ||
41 | +if test "$coreaudio" != "no" ; then | ||
42 | + coreaudio_libs="-framework CoreAudio" | ||
43 | + cat > $TMPC << EOF | ||
44 | +#include <CoreAudio/CoreAudio.h> | ||
45 | +int main(void) | ||
46 | +{ | ||
47 | + return (int)AudioGetCurrentHostTime(); | ||
48 | +} | ||
49 | +EOF | ||
50 | + if compile_prog "" "$coreaudio_libs" ; then | ||
51 | + coreaudio=yes | ||
52 | + else | ||
53 | + coreaudio=no | ||
54 | + fi | ||
55 | +fi | ||
56 | + | ||
57 | ########################################## | ||
58 | # Sound support libraries probe | ||
59 | |||
60 | @@ -XXX,XX +XXX,XX @@ for drv in $audio_drv_list; do | ||
61 | fi | ||
62 | ;; | ||
63 | |||
64 | - coreaudio) | ||
65 | + coreaudio | try-coreaudio) | ||
66 | + if test "$coreaudio" = "no"; then | ||
67 | + if test "$drv" = "try-coreaudio"; then | ||
68 | + audio_drv_list=$(echo "$audio_drv_list" | sed -e 's/try-coreaudio//') | ||
69 | + else | ||
70 | + error_exit "$drv check failed" \ | ||
71 | + "Make sure to have the $drv is available." | ||
72 | + fi | ||
73 | + else | ||
74 | coreaudio_libs="-framework CoreAudio" | ||
75 | + if test "$drv" = "try-coreaudio"; then | ||
76 | + audio_drv_list=$(echo "$audio_drv_list" | sed -e 's/try-coreaudio/coreaudio/') | ||
77 | + fi | ||
78 | + fi | ||
79 | ;; | ||
80 | |||
81 | dsound) | ||
82 | -- | 27 | -- |
83 | 2.20.1 | 28 | 2.25.1 |
84 | |||
85 | diff view generated by jsdifflib |
1 | Now that the CMSDK APB watchdog uses its Clock input, it will | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | correctly respond when the system clock frequency is changed using | ||
3 | the RCC register on in the Stellaris board system registers. Test | ||
4 | that when the RCC register is written it causes the watchdog timer to | ||
5 | change speed. | ||
6 | 2 | ||
3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
4 | Message-id: 20220527181907.189259-83-richard.henderson@linaro.org | ||
5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
8 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
9 | Reviewed-by: Luc Michel <luc@lmichel.fr> | ||
10 | Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
11 | Message-id: 20210128114145.20536-22-peter.maydell@linaro.org | ||
12 | Message-id: 20210121190622.22000-22-peter.maydell@linaro.org | ||
13 | --- | 7 | --- |
14 | tests/qtest/cmsdk-apb-watchdog-test.c | 52 +++++++++++++++++++++++++++ | 8 | target/arm/translate-sve.c | 17 +++-------------- |
15 | 1 file changed, 52 insertions(+) | 9 | 1 file changed, 3 insertions(+), 14 deletions(-) |
16 | 10 | ||
17 | diff --git a/tests/qtest/cmsdk-apb-watchdog-test.c b/tests/qtest/cmsdk-apb-watchdog-test.c | 11 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c |
18 | index XXXXXXX..XXXXXXX 100644 | 12 | index XXXXXXX..XXXXXXX 100644 |
19 | --- a/tests/qtest/cmsdk-apb-watchdog-test.c | 13 | --- a/target/arm/translate-sve.c |
20 | +++ b/tests/qtest/cmsdk-apb-watchdog-test.c | 14 | +++ b/target/arm/translate-sve.c |
21 | @@ -XXX,XX +XXX,XX @@ | 15 | @@ -XXX,XX +XXX,XX @@ static bool trans_PRF_rr(DisasContext *s, arg_PRF_rr *a) |
16 | * In the meantime, just emit the moves. | ||
22 | */ | 17 | */ |
23 | 18 | ||
24 | #include "qemu/osdep.h" | 19 | -static bool trans_MOVPRFX(DisasContext *s, arg_MOVPRFX *a) |
25 | +#include "qemu/bitops.h" | 20 | -{ |
26 | #include "libqtest-single.h" | 21 | - return do_mov_z(s, a->rd, a->rn); |
22 | -} | ||
23 | - | ||
24 | -static bool trans_MOVPRFX_m(DisasContext *s, arg_rpr_esz *a) | ||
25 | -{ | ||
26 | - return do_sel_z(s, a->rd, a->rn, a->rd, a->pg, a->esz); | ||
27 | -} | ||
28 | - | ||
29 | -static bool trans_MOVPRFX_z(DisasContext *s, arg_rpr_esz *a) | ||
30 | -{ | ||
31 | - return do_movz_zpz(s, a->rd, a->rn, a->pg, a->esz, false); | ||
32 | -} | ||
33 | +TRANS_FEAT(MOVPRFX, aa64_sve, do_mov_z, a->rd, a->rn) | ||
34 | +TRANS_FEAT(MOVPRFX_m, aa64_sve, do_sel_z, a->rd, a->rn, a->rd, a->pg, a->esz) | ||
35 | +TRANS_FEAT(MOVPRFX_z, aa64_sve, do_movz_zpz, a->rd, a->rn, a->pg, a->esz, false) | ||
27 | 36 | ||
28 | /* | 37 | /* |
29 | @@ -XXX,XX +XXX,XX @@ | 38 | * SVE2 Integer Multiply - Unpredicated |
30 | #define WDOGMIS 0x14 | ||
31 | #define WDOGLOCK 0xc00 | ||
32 | |||
33 | +#define SSYS_BASE 0x400fe000 | ||
34 | +#define RCC 0x60 | ||
35 | +#define SYSDIV_SHIFT 23 | ||
36 | +#define SYSDIV_LENGTH 4 | ||
37 | + | ||
38 | static void test_watchdog(void) | ||
39 | { | ||
40 | g_assert_cmpuint(readl(WDOG_BASE + WDOGRIS), ==, 0); | ||
41 | @@ -XXX,XX +XXX,XX @@ static void test_watchdog(void) | ||
42 | g_assert_cmpuint(readl(WDOG_BASE + WDOGRIS), ==, 0); | ||
43 | } | ||
44 | |||
45 | +static void test_clock_change(void) | ||
46 | +{ | ||
47 | + uint32_t rcc; | ||
48 | + | ||
49 | + /* | ||
50 | + * Test that writing to the stellaris board's RCC register to | ||
51 | + * change the system clock frequency causes the watchdog | ||
52 | + * to change the speed it counts at. | ||
53 | + */ | ||
54 | + g_assert_cmpuint(readl(WDOG_BASE + WDOGRIS), ==, 0); | ||
55 | + | ||
56 | + writel(WDOG_BASE + WDOGCONTROL, 1); | ||
57 | + writel(WDOG_BASE + WDOGLOAD, 1000); | ||
58 | + | ||
59 | + /* Step to just past the 500th tick */ | ||
60 | + clock_step(80 * 500 + 1); | ||
61 | + g_assert_cmpuint(readl(WDOG_BASE + WDOGRIS), ==, 0); | ||
62 | + g_assert_cmpuint(readl(WDOG_BASE + WDOGVALUE), ==, 500); | ||
63 | + | ||
64 | + /* Rewrite RCC.SYSDIV from 16 to 8, so the clock is now 40ns per tick */ | ||
65 | + rcc = readl(SSYS_BASE + RCC); | ||
66 | + g_assert_cmpuint(extract32(rcc, SYSDIV_SHIFT, SYSDIV_LENGTH), ==, 0xf); | ||
67 | + rcc = deposit32(rcc, SYSDIV_SHIFT, SYSDIV_LENGTH, 7); | ||
68 | + writel(SSYS_BASE + RCC, rcc); | ||
69 | + | ||
70 | + /* Just past the 1000th tick: timer should have fired */ | ||
71 | + clock_step(40 * 500); | ||
72 | + g_assert_cmpuint(readl(WDOG_BASE + WDOGRIS), ==, 1); | ||
73 | + | ||
74 | + g_assert_cmpuint(readl(WDOG_BASE + WDOGVALUE), ==, 0); | ||
75 | + | ||
76 | + /* VALUE reloads at following tick */ | ||
77 | + clock_step(41); | ||
78 | + g_assert_cmpuint(readl(WDOG_BASE + WDOGVALUE), ==, 1000); | ||
79 | + | ||
80 | + /* Writing any value to WDOGINTCLR clears the interrupt and reloads */ | ||
81 | + clock_step(40 * 500); | ||
82 | + g_assert_cmpuint(readl(WDOG_BASE + WDOGVALUE), ==, 500); | ||
83 | + g_assert_cmpuint(readl(WDOG_BASE + WDOGRIS), ==, 1); | ||
84 | + writel(WDOG_BASE + WDOGINTCLR, 0); | ||
85 | + g_assert_cmpuint(readl(WDOG_BASE + WDOGVALUE), ==, 1000); | ||
86 | + g_assert_cmpuint(readl(WDOG_BASE + WDOGRIS), ==, 0); | ||
87 | +} | ||
88 | + | ||
89 | int main(int argc, char **argv) | ||
90 | { | ||
91 | int r; | ||
92 | @@ -XXX,XX +XXX,XX @@ int main(int argc, char **argv) | ||
93 | qtest_start("-machine lm3s811evb"); | ||
94 | |||
95 | qtest_add_func("/cmsdk-apb-watchdog/watchdog", test_watchdog); | ||
96 | + qtest_add_func("/cmsdk-apb-watchdog/watchdog_clock_change", | ||
97 | + test_clock_change); | ||
98 | |||
99 | r = g_test_run(); | ||
100 | |||
101 | -- | 39 | -- |
102 | 2.20.1 | 40 | 2.25.1 |
103 | |||
104 | diff view generated by jsdifflib |
1 | From: Joelle van Dyne <j@getutm.app> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | 3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
4 | Signed-off-by: Joelle van Dyne <j@getutm.app> | 4 | Message-id: 20220527181907.189259-84-richard.henderson@linaro.org |
5 | Message-id: 20210126012457.39046-9-j@getutm.app | 5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
7 | --- | 7 | --- |
8 | configure | 5 ++++- | 8 | target/arm/translate-sve.c | 11 ++--------- |
9 | 1 file changed, 4 insertions(+), 1 deletion(-) | 9 | 1 file changed, 2 insertions(+), 9 deletions(-) |
10 | 10 | ||
11 | diff --git a/configure b/configure | 11 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c |
12 | index XXXXXXX..XXXXXXX 100755 | 12 | index XXXXXXX..XXXXXXX 100644 |
13 | --- a/configure | 13 | --- a/target/arm/translate-sve.c |
14 | +++ b/configure | 14 | +++ b/target/arm/translate-sve.c |
15 | @@ -XXX,XX +XXX,XX @@ if test "$cross_compile" = "yes"; then | 15 | @@ -XXX,XX +XXX,XX @@ static bool do_FMLA_zzxz(DisasContext *s, arg_rrxr_esz *a, bool sub) |
16 | echo "system = 'darwin'" >> $cross | 16 | a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR); |
17 | fi | 17 | } |
18 | case "$ARCH" in | 18 | |
19 | - i386|x86_64) | 19 | -static bool trans_FMLA_zzxz(DisasContext *s, arg_FMLA_zzxz *a) |
20 | + i386) | 20 | -{ |
21 | echo "cpu_family = 'x86'" >> $cross | 21 | - return do_FMLA_zzxz(s, a, false); |
22 | ;; | 22 | -} |
23 | + x86_64) | 23 | - |
24 | + echo "cpu_family = 'x86_64'" >> $cross | 24 | -static bool trans_FMLS_zzxz(DisasContext *s, arg_FMLA_zzxz *a) |
25 | + ;; | 25 | -{ |
26 | ppc64le) | 26 | - return do_FMLA_zzxz(s, a, true); |
27 | echo "cpu_family = 'ppc64'" >> $cross | 27 | -} |
28 | ;; | 28 | +TRANS_FEAT(FMLA_zzxz, aa64_sve, do_FMLA_zzxz, a, false) |
29 | +TRANS_FEAT(FMLS_zzxz, aa64_sve, do_FMLA_zzxz, a, true) | ||
30 | |||
31 | /* | ||
32 | *** SVE Floating Point Multiply Indexed Group | ||
29 | -- | 33 | -- |
30 | 2.20.1 | 34 | 2.25.1 |
31 | |||
32 | diff view generated by jsdifflib |
1 | From: Joelle van Dyne <j@getutm.app> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Add objc to the Meson cross file as well as detection of Darwin. | 3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
4 | 4 | Message-id: 20220527181907.189259-85-richard.henderson@linaro.org | |
5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
6 | Signed-off-by: Joelle van Dyne <j@getutm.app> | ||
7 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
8 | Message-id: 20210126012457.39046-8-j@getutm.app | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
10 | --- | 7 | --- |
11 | configure | 4 ++++ | 8 | target/arm/translate-sve.c | 28 ++++------------------------ |
12 | 1 file changed, 4 insertions(+) | 9 | 1 file changed, 4 insertions(+), 24 deletions(-) |
13 | 10 | ||
14 | diff --git a/configure b/configure | 11 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c |
15 | index XXXXXXX..XXXXXXX 100755 | 12 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/configure | 13 | --- a/target/arm/translate-sve.c |
17 | +++ b/configure | 14 | +++ b/target/arm/translate-sve.c |
18 | @@ -XXX,XX +XXX,XX @@ echo "cpp_link_args = [${LDFLAGS:+$(meson_quote $LDFLAGS)}]" >> $cross | 15 | @@ -XXX,XX +XXX,XX @@ TRANS_FEAT(BFMMLA, aa64_sve_bf16, gen_gvec_ool_arg_zzzz, |
19 | echo "[binaries]" >> $cross | 16 | |
20 | echo "c = [$(meson_quote $cc)]" >> $cross | 17 | static bool do_BFMLAL_zzzw(DisasContext *s, arg_rrrr_esz *a, bool sel) |
21 | test -n "$cxx" && echo "cpp = [$(meson_quote $cxx)]" >> $cross | 18 | { |
22 | +test -n "$objcc" && echo "objc = [$(meson_quote $objcc)]" >> $cross | 19 | - if (!dc_isar_feature(aa64_sve_bf16, s)) { |
23 | echo "ar = [$(meson_quote $ar)]" >> $cross | 20 | - return false; |
24 | echo "nm = [$(meson_quote $nm)]" >> $cross | 21 | - } |
25 | echo "pkgconfig = [$(meson_quote $pkg_config_exe)]" >> $cross | 22 | return gen_gvec_fpst_zzzz(s, gen_helper_gvec_bfmlal, |
26 | @@ -XXX,XX +XXX,XX @@ if test "$cross_compile" = "yes"; then | 23 | a->rd, a->rn, a->rm, a->ra, sel, FPST_FPCR); |
27 | if test "$linux" = "yes" ; then | 24 | } |
28 | echo "system = 'linux'" >> $cross | 25 | |
29 | fi | 26 | -static bool trans_BFMLALB_zzzw(DisasContext *s, arg_rrrr_esz *a) |
30 | + if test "$darwin" = "yes" ; then | 27 | -{ |
31 | + echo "system = 'darwin'" >> $cross | 28 | - return do_BFMLAL_zzzw(s, a, false); |
32 | + fi | 29 | -} |
33 | case "$ARCH" in | 30 | - |
34 | i386|x86_64) | 31 | -static bool trans_BFMLALT_zzzw(DisasContext *s, arg_rrrr_esz *a) |
35 | echo "cpu_family = 'x86'" >> $cross | 32 | -{ |
33 | - return do_BFMLAL_zzzw(s, a, true); | ||
34 | -} | ||
35 | +TRANS_FEAT(BFMLALB_zzzw, aa64_sve_bf16, do_BFMLAL_zzzw, a, false) | ||
36 | +TRANS_FEAT(BFMLALT_zzzw, aa64_sve_bf16, do_BFMLAL_zzzw, a, true) | ||
37 | |||
38 | static bool do_BFMLAL_zzxw(DisasContext *s, arg_rrxr_esz *a, bool sel) | ||
39 | { | ||
40 | - if (!dc_isar_feature(aa64_sve_bf16, s)) { | ||
41 | - return false; | ||
42 | - } | ||
43 | return gen_gvec_fpst_zzzz(s, gen_helper_gvec_bfmlal_idx, | ||
44 | a->rd, a->rn, a->rm, a->ra, | ||
45 | (a->index << 1) | sel, FPST_FPCR); | ||
46 | } | ||
47 | |||
48 | -static bool trans_BFMLALB_zzxw(DisasContext *s, arg_rrxr_esz *a) | ||
49 | -{ | ||
50 | - return do_BFMLAL_zzxw(s, a, false); | ||
51 | -} | ||
52 | - | ||
53 | -static bool trans_BFMLALT_zzxw(DisasContext *s, arg_rrxr_esz *a) | ||
54 | -{ | ||
55 | - return do_BFMLAL_zzxw(s, a, true); | ||
56 | -} | ||
57 | +TRANS_FEAT(BFMLALB_zzxw, aa64_sve_bf16, do_BFMLAL_zzxw, a, false) | ||
58 | +TRANS_FEAT(BFMLALT_zzxw, aa64_sve_bf16, do_BFMLAL_zzxw, a, true) | ||
36 | -- | 59 | -- |
37 | 2.20.1 | 60 | 2.25.1 |
38 | |||
39 | diff view generated by jsdifflib |
1 | From: Mihai Carabas <mihai.carabas@oracle.com> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Add a test case for pvpanic-pci device. The scenario is the same as pvpanic | 3 | Rename the function to match gen_gvec_ool_arg_zzz, |
4 | ISA device, but is using the PCI bus. | 4 | and move to be adjacent. Split out gen_gvec_fpst_zzz |
5 | as a helper while we're at it. | ||
5 | 6 | ||
6 | Signed-off-by: Mihai Carabas <mihai.carabas@oracle.com> | 7 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
7 | Acked-by: Thomas Huth <thuth@redhat.com> | 8 | Message-id: 20220527181907.189259-86-richard.henderson@linaro.org |
8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
9 | Signed-off-by: Mihai Carabas <mihai.carabas@oracle.com> | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
11 | --- | 11 | --- |
12 | tests/qtest/pvpanic-pci-test.c | 94 ++++++++++++++++++++++++++++++++++ | 12 | target/arm/translate-sve.c | 50 +++++++++++++++++++++++--------------- |
13 | tests/qtest/meson.build | 1 + | 13 | 1 file changed, 30 insertions(+), 20 deletions(-) |
14 | 2 files changed, 95 insertions(+) | ||
15 | create mode 100644 tests/qtest/pvpanic-pci-test.c | ||
16 | 14 | ||
17 | diff --git a/tests/qtest/pvpanic-pci-test.c b/tests/qtest/pvpanic-pci-test.c | 15 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c |
18 | new file mode 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
19 | index XXXXXXX..XXXXXXX | 17 | --- a/target/arm/translate-sve.c |
20 | --- /dev/null | 18 | +++ b/target/arm/translate-sve.c |
21 | +++ b/tests/qtest/pvpanic-pci-test.c | 19 | @@ -XXX,XX +XXX,XX @@ static bool gen_gvec_ool_arg_zzz(DisasContext *s, gen_helper_gvec_3 *fn, |
22 | @@ -XXX,XX +XXX,XX @@ | 20 | return gen_gvec_ool_zzz(s, fn, a->rd, a->rn, a->rm, data); |
23 | +/* | 21 | } |
24 | + * QTest testcase for PV Panic PCI device | 22 | |
25 | + * | 23 | +/* Invoke an out-of-line helper on 3 Zregs, plus float_status. */ |
26 | + * Copyright (C) 2020 Oracle | 24 | +static bool gen_gvec_fpst_zzz(DisasContext *s, gen_helper_gvec_3_ptr *fn, |
27 | + * | 25 | + int rd, int rn, int rm, |
28 | + * Authors: | 26 | + int data, ARMFPStatusFlavour flavour) |
29 | + * Mihai Carabas <mihai.carabas@oracle.com> | 27 | +{ |
30 | + * | 28 | + if (fn == NULL) { |
31 | + * This work is licensed under the terms of the GNU GPL, version 2 or later. | 29 | + return false; |
32 | + * See the COPYING file in the top-level directory. | 30 | + } |
33 | + * | 31 | + if (sve_access_check(s)) { |
34 | + */ | 32 | + unsigned vsz = vec_full_reg_size(s); |
33 | + TCGv_ptr status = fpstatus_ptr(flavour); | ||
35 | + | 34 | + |
36 | +#include "qemu/osdep.h" | 35 | + tcg_gen_gvec_3_ptr(vec_full_reg_offset(s, rd), |
37 | +#include "libqos/libqtest.h" | 36 | + vec_full_reg_offset(s, rn), |
38 | +#include "qapi/qmp/qdict.h" | 37 | + vec_full_reg_offset(s, rm), |
39 | +#include "libqos/pci.h" | 38 | + status, vsz, vsz, data, fn); |
40 | +#include "libqos/pci-pc.h" | ||
41 | +#include "hw/pci/pci_regs.h" | ||
42 | + | 39 | + |
43 | +static void test_panic_nopause(void) | 40 | + tcg_temp_free_ptr(status); |
44 | +{ | 41 | + } |
45 | + uint8_t val; | 42 | + return true; |
46 | + QDict *response, *data; | ||
47 | + QTestState *qts; | ||
48 | + QPCIBus *pcibus; | ||
49 | + QPCIDevice *dev; | ||
50 | + QPCIBar bar; | ||
51 | + | ||
52 | + qts = qtest_init("-device pvpanic-pci,addr=04.0 -action panic=none"); | ||
53 | + pcibus = qpci_new_pc(qts, NULL); | ||
54 | + dev = qpci_device_find(pcibus, QPCI_DEVFN(0x4, 0x0)); | ||
55 | + qpci_device_enable(dev); | ||
56 | + bar = qpci_iomap(dev, 0, NULL); | ||
57 | + | ||
58 | + qpci_memread(dev, bar, 0, &val, sizeof(val)); | ||
59 | + g_assert_cmpuint(val, ==, 3); | ||
60 | + | ||
61 | + val = 1; | ||
62 | + qpci_memwrite(dev, bar, 0, &val, sizeof(val)); | ||
63 | + | ||
64 | + response = qtest_qmp_eventwait_ref(qts, "GUEST_PANICKED"); | ||
65 | + g_assert(qdict_haskey(response, "data")); | ||
66 | + data = qdict_get_qdict(response, "data"); | ||
67 | + g_assert(qdict_haskey(data, "action")); | ||
68 | + g_assert_cmpstr(qdict_get_str(data, "action"), ==, "run"); | ||
69 | + qobject_unref(response); | ||
70 | + | ||
71 | + qtest_quit(qts); | ||
72 | +} | 43 | +} |
73 | + | 44 | + |
74 | +static void test_panic(void) | 45 | +static bool gen_gvec_fpst_arg_zzz(DisasContext *s, gen_helper_gvec_3_ptr *fn, |
46 | + arg_rrr_esz *a, int data) | ||
75 | +{ | 47 | +{ |
76 | + uint8_t val; | 48 | + return gen_gvec_fpst_zzz(s, fn, a->rd, a->rn, a->rm, data, |
77 | + QDict *response, *data; | 49 | + a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR); |
78 | + QTestState *qts; | ||
79 | + QPCIBus *pcibus; | ||
80 | + QPCIDevice *dev; | ||
81 | + QPCIBar bar; | ||
82 | + | ||
83 | + qts = qtest_init("-device pvpanic-pci,addr=04.0 -action panic=pause"); | ||
84 | + pcibus = qpci_new_pc(qts, NULL); | ||
85 | + dev = qpci_device_find(pcibus, QPCI_DEVFN(0x4, 0x0)); | ||
86 | + qpci_device_enable(dev); | ||
87 | + bar = qpci_iomap(dev, 0, NULL); | ||
88 | + | ||
89 | + qpci_memread(dev, bar, 0, &val, sizeof(val)); | ||
90 | + g_assert_cmpuint(val, ==, 3); | ||
91 | + | ||
92 | + val = 1; | ||
93 | + qpci_memwrite(dev, bar, 0, &val, sizeof(val)); | ||
94 | + | ||
95 | + response = qtest_qmp_eventwait_ref(qts, "GUEST_PANICKED"); | ||
96 | + g_assert(qdict_haskey(response, "data")); | ||
97 | + data = qdict_get_qdict(response, "data"); | ||
98 | + g_assert(qdict_haskey(data, "action")); | ||
99 | + g_assert_cmpstr(qdict_get_str(data, "action"), ==, "pause"); | ||
100 | + qobject_unref(response); | ||
101 | + | ||
102 | + qtest_quit(qts); | ||
103 | +} | 50 | +} |
104 | + | 51 | + |
105 | +int main(int argc, char **argv) | 52 | /* Invoke an out-of-line helper on 4 Zregs. */ |
106 | +{ | 53 | static bool gen_gvec_ool_zzzz(DisasContext *s, gen_helper_gvec_4 *fn, |
107 | + int ret; | 54 | int rd, int rn, int rm, int ra, int data) |
108 | + | 55 | @@ -XXX,XX +XXX,XX @@ static bool trans_FADDA(DisasContext *s, arg_rprr_esz *a) |
109 | + g_test_init(&argc, &argv, NULL); | 56 | *** SVE Floating Point Arithmetic - Unpredicated Group |
110 | + qtest_add_func("/pvpanic-pci/panic", test_panic); | 57 | */ |
111 | + qtest_add_func("/pvpanic-pci/panic-nopause", test_panic_nopause); | 58 | |
112 | + | 59 | -static bool do_zzz_fp(DisasContext *s, arg_rrr_esz *a, |
113 | + ret = g_test_run(); | 60 | - gen_helper_gvec_3_ptr *fn) |
114 | + | 61 | -{ |
115 | + return ret; | 62 | - if (fn == NULL) { |
116 | +} | 63 | - return false; |
117 | diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build | 64 | - } |
118 | index XXXXXXX..XXXXXXX 100644 | 65 | - if (sve_access_check(s)) { |
119 | --- a/tests/qtest/meson.build | 66 | - unsigned vsz = vec_full_reg_size(s); |
120 | +++ b/tests/qtest/meson.build | 67 | - TCGv_ptr status = fpstatus_ptr(a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR); |
121 | @@ -XXX,XX +XXX,XX @@ qtests_i386 = \ | 68 | - tcg_gen_gvec_3_ptr(vec_full_reg_offset(s, a->rd), |
122 | config_all_devices.has_key('CONFIG_ISA_IPMI_BT') ? ['ipmi-bt-test'] : []) + \ | 69 | - vec_full_reg_offset(s, a->rn), |
123 | (config_all_devices.has_key('CONFIG_WDT_IB700') ? ['wdt_ib700-test'] : []) + \ | 70 | - vec_full_reg_offset(s, a->rm), |
124 | (config_all_devices.has_key('CONFIG_PVPANIC_ISA') ? ['pvpanic-test'] : []) + \ | 71 | - status, vsz, vsz, 0, fn); |
125 | + (config_all_devices.has_key('CONFIG_PVPANIC_PCI') ? ['pvpanic-pci-test'] : []) + \ | 72 | - tcg_temp_free_ptr(status); |
126 | (config_all_devices.has_key('CONFIG_HDA') ? ['intel-hda-test'] : []) + \ | 73 | - } |
127 | (config_all_devices.has_key('CONFIG_I82801B11') ? ['i82801b11-test'] : []) + \ | 74 | - return true; |
128 | (config_all_devices.has_key('CONFIG_IOH3420') ? ['ioh3420-test'] : []) + \ | 75 | -} |
76 | - | ||
77 | - | ||
78 | #define DO_FP3(NAME, name) \ | ||
79 | static bool trans_##NAME(DisasContext *s, arg_rrr_esz *a) \ | ||
80 | { \ | ||
81 | @@ -XXX,XX +XXX,XX @@ static bool trans_##NAME(DisasContext *s, arg_rrr_esz *a) \ | ||
82 | NULL, gen_helper_gvec_##name##_h, \ | ||
83 | gen_helper_gvec_##name##_s, gen_helper_gvec_##name##_d \ | ||
84 | }; \ | ||
85 | - return do_zzz_fp(s, a, fns[a->esz]); \ | ||
86 | + return gen_gvec_fpst_arg_zzz(s, fns[a->esz], a, 0); \ | ||
87 | } | ||
88 | |||
89 | DO_FP3(FADD_zzz, fadd) | ||
129 | -- | 90 | -- |
130 | 2.20.1 | 91 | 2.25.1 |
131 | |||
132 | diff view generated by jsdifflib |
1 | From: Joelle van Dyne <j@getutm.app> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Meson will find CoreFoundation, IOKit, and Cocoa as needed. | 3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
4 | 4 | Message-id: 20220527181907.189259-87-richard.henderson@linaro.org | |
5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
6 | Signed-off-by: Joelle van Dyne <j@getutm.app> | ||
7 | Message-id: 20210126012457.39046-7-j@getutm.app | ||
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
9 | --- | 7 | --- |
10 | configure | 1 - | 8 | target/arm/translate-sve.c | 7 ++----- |
11 | 1 file changed, 1 deletion(-) | 9 | 1 file changed, 2 insertions(+), 5 deletions(-) |
12 | 10 | ||
13 | diff --git a/configure b/configure | 11 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c |
14 | index XXXXXXX..XXXXXXX 100755 | 12 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/configure | 13 | --- a/target/arm/translate-sve.c |
16 | +++ b/configure | 14 | +++ b/target/arm/translate-sve.c |
17 | @@ -XXX,XX +XXX,XX @@ Darwin) | 15 | @@ -XXX,XX +XXX,XX @@ static bool trans_FADDA(DisasContext *s, arg_rprr_esz *a) |
18 | fi | 16 | */ |
19 | audio_drv_list="coreaudio try-sdl" | 17 | |
20 | audio_possible_drivers="coreaudio sdl" | 18 | #define DO_FP3(NAME, name) \ |
21 | - QEMU_LDFLAGS="-framework CoreFoundation -framework IOKit $QEMU_LDFLAGS" | 19 | -static bool trans_##NAME(DisasContext *s, arg_rrr_esz *a) \ |
22 | # Disable attempts to use ObjectiveC features in os/object.h since they | 20 | -{ \ |
23 | # won't work when we're compiling with gcc as a C compiler. | 21 | - static gen_helper_gvec_3_ptr * const fns[4] = { \ |
24 | QEMU_CFLAGS="-DOS_OBJECT_USE_OBJC=0 $QEMU_CFLAGS" | 22 | + static gen_helper_gvec_3_ptr * const name##_fns[4] = { \ |
23 | NULL, gen_helper_gvec_##name##_h, \ | ||
24 | gen_helper_gvec_##name##_s, gen_helper_gvec_##name##_d \ | ||
25 | }; \ | ||
26 | - return gen_gvec_fpst_arg_zzz(s, fns[a->esz], a, 0); \ | ||
27 | -} | ||
28 | + TRANS_FEAT(NAME, aa64_sve, gen_gvec_fpst_arg_zzz, name##_fns[a->esz], a, 0) | ||
29 | |||
30 | DO_FP3(FADD_zzz, fadd) | ||
31 | DO_FP3(FSUB_zzz, fsub) | ||
25 | -- | 32 | -- |
26 | 2.20.1 | 33 | 2.25.1 |
27 | |||
28 | diff view generated by jsdifflib |
1 | From: Joelle van Dyne <j@getutm.app> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Build without error on hosts without a working system(). If system() | 3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
4 | is called, return -1 with ENOSYS. | 4 | Message-id: 20220527181907.189259-88-richard.henderson@linaro.org |
5 | |||
6 | Signed-off-by: Joelle van Dyne <j@getutm.app> | ||
7 | Message-id: 20210126012457.39046-6-j@getutm.app | ||
8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
10 | --- | 7 | --- |
11 | meson.build | 1 + | 8 | target/arm/translate-sve.c | 26 +++++++------------------- |
12 | include/qemu/osdep.h | 12 ++++++++++++ | 9 | 1 file changed, 7 insertions(+), 19 deletions(-) |
13 | 2 files changed, 13 insertions(+) | ||
14 | 10 | ||
15 | diff --git a/meson.build b/meson.build | 11 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c |
16 | index XXXXXXX..XXXXXXX 100644 | 12 | index XXXXXXX..XXXXXXX 100644 |
17 | --- a/meson.build | 13 | --- a/target/arm/translate-sve.c |
18 | +++ b/meson.build | 14 | +++ b/target/arm/translate-sve.c |
19 | @@ -XXX,XX +XXX,XX @@ config_host_data.set('HAVE_DRM_H', cc.has_header('libdrm/drm.h')) | 15 | @@ -XXX,XX +XXX,XX @@ TRANS_FEAT(FMLS_zzxz, aa64_sve, do_FMLA_zzxz, a, true) |
20 | config_host_data.set('HAVE_PTY_H', cc.has_header('pty.h')) | 16 | *** SVE Floating Point Multiply Indexed Group |
21 | config_host_data.set('HAVE_SYS_IOCCOM_H', cc.has_header('sys/ioccom.h')) | 17 | */ |
22 | config_host_data.set('HAVE_SYS_KCOV_H', cc.has_header('sys/kcov.h')) | 18 | |
23 | +config_host_data.set('HAVE_SYSTEM_FUNCTION', cc.has_function('system', prefix: '#include <stdlib.h>')) | 19 | -static bool trans_FMUL_zzx(DisasContext *s, arg_FMUL_zzx *a) |
24 | 20 | -{ | |
25 | config_host_data.set('CONFIG_PREADV', cc.has_function('preadv', prefix: '#include <sys/uio.h>')) | 21 | - static gen_helper_gvec_3_ptr * const fns[3] = { |
26 | 22 | - gen_helper_gvec_fmul_idx_h, | |
27 | diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h | 23 | - gen_helper_gvec_fmul_idx_s, |
28 | index XXXXXXX..XXXXXXX 100644 | 24 | - gen_helper_gvec_fmul_idx_d, |
29 | --- a/include/qemu/osdep.h | 25 | - }; |
30 | +++ b/include/qemu/osdep.h | 26 | - |
31 | @@ -XXX,XX +XXX,XX @@ static inline void qemu_thread_jit_write(void) {} | 27 | - if (sve_access_check(s)) { |
32 | static inline void qemu_thread_jit_execute(void) {} | 28 | - unsigned vsz = vec_full_reg_size(s); |
33 | #endif | 29 | - TCGv_ptr status = fpstatus_ptr(a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR); |
34 | 30 | - tcg_gen_gvec_3_ptr(vec_full_reg_offset(s, a->rd), | |
35 | +/** | 31 | - vec_full_reg_offset(s, a->rn), |
36 | + * Platforms which do not support system() return ENOSYS | 32 | - vec_full_reg_offset(s, a->rm), |
37 | + */ | 33 | - status, vsz, vsz, a->index, fns[a->esz - 1]); |
38 | +#ifndef HAVE_SYSTEM_FUNCTION | 34 | - tcg_temp_free_ptr(status); |
39 | +#define system platform_does_not_support_system | 35 | - } |
40 | +static inline int platform_does_not_support_system(const char *command) | 36 | - return true; |
41 | +{ | 37 | -} |
42 | + errno = ENOSYS; | 38 | +static gen_helper_gvec_3_ptr * const fmul_idx_fns[4] = { |
43 | + return -1; | 39 | + NULL, gen_helper_gvec_fmul_idx_h, |
44 | +} | 40 | + gen_helper_gvec_fmul_idx_s, gen_helper_gvec_fmul_idx_d, |
45 | +#endif /* !HAVE_SYSTEM_FUNCTION */ | 41 | +}; |
46 | + | 42 | +TRANS_FEAT(FMUL_zzx, aa64_sve, gen_gvec_fpst_zzz, |
47 | #endif | 43 | + fmul_idx_fns[a->esz], a->rd, a->rn, a->rm, a->index, |
44 | + a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR) | ||
45 | |||
46 | /* | ||
47 | *** SVE Floating Point Fast Reduction Group | ||
48 | -- | 48 | -- |
49 | 2.20.1 | 49 | 2.25.1 |
50 | |||
51 | diff view generated by jsdifflib |
1 | From: Joelle van Dyne <j@getutm.app> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | The iOS toolchain does not use the host prefix naming convention. So we | 3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
4 | need to enable cross-compile options while allowing the PREFIX to be | 4 | Message-id: 20220527181907.189259-89-richard.henderson@linaro.org |
5 | blank. | 5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
6 | |||
7 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
8 | Signed-off-by: Joelle van Dyne <j@getutm.app> | ||
9 | Message-id: 20210126012457.39046-3-j@getutm.app | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
11 | --- | 7 | --- |
12 | configure | 6 ++++-- | 8 | target/arm/translate-sve.c | 29 +++++++---------------------- |
13 | 1 file changed, 4 insertions(+), 2 deletions(-) | 9 | 1 file changed, 7 insertions(+), 22 deletions(-) |
14 | 10 | ||
15 | diff --git a/configure b/configure | 11 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c |
16 | index XXXXXXX..XXXXXXX 100755 | 12 | index XXXXXXX..XXXXXXX 100644 |
17 | --- a/configure | 13 | --- a/target/arm/translate-sve.c |
18 | +++ b/configure | 14 | +++ b/target/arm/translate-sve.c |
19 | @@ -XXX,XX +XXX,XX @@ cpu="" | 15 | @@ -XXX,XX +XXX,XX @@ DO_PPZ(FCMNE_ppz0, fcmne0) |
20 | iasl="iasl" | 16 | *** SVE floating-point trig multiply-add coefficient |
21 | interp_prefix="/usr/gnemul/qemu-%M" | 17 | */ |
22 | static="no" | 18 | |
23 | +cross_compile="no" | 19 | -static bool trans_FTMAD(DisasContext *s, arg_FTMAD *a) |
24 | cross_prefix="" | 20 | -{ |
25 | audio_drv_list="" | 21 | - static gen_helper_gvec_3_ptr * const fns[3] = { |
26 | block_drv_rw_whitelist="" | 22 | - gen_helper_sve_ftmad_h, |
27 | @@ -XXX,XX +XXX,XX @@ for opt do | 23 | - gen_helper_sve_ftmad_s, |
28 | optarg=$(expr "x$opt" : 'x[^=]*=\(.*\)') | 24 | - gen_helper_sve_ftmad_d, |
29 | case "$opt" in | 25 | - }; |
30 | --cross-prefix=*) cross_prefix="$optarg" | 26 | - |
31 | + cross_compile="yes" | 27 | - if (a->esz == 0) { |
32 | ;; | 28 | - return false; |
33 | --cc=*) CC="$optarg" | 29 | - } |
34 | ;; | 30 | - if (sve_access_check(s)) { |
35 | @@ -XXX,XX +XXX,XX @@ $(echo Deprecated targets: $deprecated_targets_list | \ | 31 | - unsigned vsz = vec_full_reg_size(s); |
36 | --target-list-exclude=LIST exclude a set of targets from the default target-list | 32 | - TCGv_ptr status = fpstatus_ptr(a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR); |
37 | 33 | - tcg_gen_gvec_3_ptr(vec_full_reg_offset(s, a->rd), | |
38 | Advanced options (experts only): | 34 | - vec_full_reg_offset(s, a->rn), |
39 | - --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix] | 35 | - vec_full_reg_offset(s, a->rm), |
40 | + --cross-prefix=PREFIX use PREFIX for compile tools, PREFIX can be blank [$cross_prefix] | 36 | - status, vsz, vsz, a->imm, fns[a->esz - 1]); |
41 | --cc=CC use C compiler CC [$cc] | 37 | - tcg_temp_free_ptr(status); |
42 | --iasl=IASL use ACPI compiler IASL [$iasl] | 38 | - } |
43 | --host-cc=CC use C compiler CC [$host_cc] for code run at | 39 | - return true; |
44 | @@ -XXX,XX +XXX,XX @@ if has $sdl2_config; then | 40 | -} |
45 | fi | 41 | +static gen_helper_gvec_3_ptr * const ftmad_fns[4] = { |
46 | echo "strip = [$(meson_quote $strip)]" >> $cross | 42 | + NULL, gen_helper_sve_ftmad_h, |
47 | echo "windres = [$(meson_quote $windres)]" >> $cross | 43 | + gen_helper_sve_ftmad_s, gen_helper_sve_ftmad_d, |
48 | -if test -n "$cross_prefix"; then | 44 | +}; |
49 | +if test "$cross_compile" = "yes"; then | 45 | +TRANS_FEAT(FTMAD, aa64_sve, gen_gvec_fpst_zzz, |
50 | cross_arg="--cross-file config-meson.cross" | 46 | + ftmad_fns[a->esz], a->rd, a->rn, a->rm, a->imm, |
51 | echo "[host_machine]" >> $cross | 47 | + a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR) |
52 | if test "$mingw32" = "yes" ; then | 48 | |
49 | /* | ||
50 | *** SVE Floating Point Accumulating Reduction Group | ||
53 | -- | 51 | -- |
54 | 2.20.1 | 52 | 2.25.1 |
55 | |||
56 | diff view generated by jsdifflib |
1 | Move the preadv availability check to meson.build. This is what we | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | want to be doing for host-OS-feature-checks anyway, but it also fixes | ||
3 | a problem with building for macOS with the most recent XCode SDK on a | ||
4 | Catalina host. | ||
5 | 2 | ||
6 | On that configuration, 'preadv()' is provided as a weak symbol, so | 3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
7 | that programs can be built with optional support for it and make a | 4 | Message-id: 20220527181907.189259-90-richard.henderson@linaro.org |
8 | runtime availability check to see whether the preadv() they have is a | 5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
9 | working one or one which they must not call because it will | 6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
10 | runtime-assert. QEMU's configure test passes (unless you're building | 7 | --- |
11 | with --enable-werror) because the test program using preadv() | 8 | target/arm/translate-sve.c | 30 +++++++++++++++++------------- |
12 | compiles, but then QEMU crashes at runtime when preadv() is called, | 9 | 1 file changed, 17 insertions(+), 13 deletions(-) |
13 | with errors like: | ||
14 | 10 | ||
15 | dyld: lazy symbol binding failed: Symbol not found: _preadv | 11 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c |
16 | Referenced from: /Users/pm215/src/qemu/./build/x86/tests/test-replication | ||
17 | Expected in: /usr/lib/libSystem.B.dylib | ||
18 | |||
19 | dyld: Symbol not found: _preadv | ||
20 | Referenced from: /Users/pm215/src/qemu/./build/x86/tests/test-replication | ||
21 | Expected in: /usr/lib/libSystem.B.dylib | ||
22 | |||
23 | Meson's own function availability check has a special case for macOS | ||
24 | which adds '-Wl,-no_weak_imports' to the compiler flags, which forces | ||
25 | the test to require the real function, not the macOS-version-too-old | ||
26 | stub. | ||
27 | |||
28 | So this commit fixes the bug where macOS builds on Catalina currently | ||
29 | require --disable-werror. | ||
30 | |||
31 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
32 | Acked-by: Paolo Bonzini <pbonzini@redhat.com> | ||
33 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
34 | Message-id: 20210126155846.17109-1-peter.maydell@linaro.org | ||
35 | --- | ||
36 | configure | 16 ---------------- | ||
37 | meson.build | 4 +++- | ||
38 | 2 files changed, 3 insertions(+), 17 deletions(-) | ||
39 | |||
40 | diff --git a/configure b/configure | ||
41 | index XXXXXXX..XXXXXXX 100755 | ||
42 | --- a/configure | ||
43 | +++ b/configure | ||
44 | @@ -XXX,XX +XXX,XX @@ if compile_prog "" "" ; then | ||
45 | iovec=yes | ||
46 | fi | ||
47 | |||
48 | -########################################## | ||
49 | -# preadv probe | ||
50 | -cat > $TMPC <<EOF | ||
51 | -#include <sys/types.h> | ||
52 | -#include <sys/uio.h> | ||
53 | -#include <unistd.h> | ||
54 | -int main(void) { return preadv(0, 0, 0, 0); } | ||
55 | -EOF | ||
56 | -preadv=no | ||
57 | -if compile_prog "" "" ; then | ||
58 | - preadv=yes | ||
59 | -fi | ||
60 | - | ||
61 | ########################################## | ||
62 | # fdt probe | ||
63 | |||
64 | @@ -XXX,XX +XXX,XX @@ fi | ||
65 | if test "$iovec" = "yes" ; then | ||
66 | echo "CONFIG_IOVEC=y" >> $config_host_mak | ||
67 | fi | ||
68 | -if test "$preadv" = "yes" ; then | ||
69 | - echo "CONFIG_PREADV=y" >> $config_host_mak | ||
70 | -fi | ||
71 | if test "$membarrier" = "yes" ; then | ||
72 | echo "CONFIG_MEMBARRIER=y" >> $config_host_mak | ||
73 | fi | ||
74 | diff --git a/meson.build b/meson.build | ||
75 | index XXXXXXX..XXXXXXX 100644 | 12 | index XXXXXXX..XXXXXXX 100644 |
76 | --- a/meson.build | 13 | --- a/target/arm/translate-sve.c |
77 | +++ b/meson.build | 14 | +++ b/target/arm/translate-sve.c |
78 | @@ -XXX,XX +XXX,XX @@ config_host_data.set('HAVE_PTY_H', cc.has_header('pty.h')) | 15 | @@ -XXX,XX +XXX,XX @@ TRANS_FEAT(FMUL_zzx, aa64_sve, gen_gvec_fpst_zzz, |
79 | config_host_data.set('HAVE_SYS_IOCCOM_H', cc.has_header('sys/ioccom.h')) | 16 | typedef void gen_helper_fp_reduce(TCGv_i64, TCGv_ptr, TCGv_ptr, |
80 | config_host_data.set('HAVE_SYS_KCOV_H', cc.has_header('sys/kcov.h')) | 17 | TCGv_ptr, TCGv_i32); |
81 | 18 | ||
82 | +config_host_data.set('CONFIG_PREADV', cc.has_function('preadv', prefix: '#include <sys/uio.h>')) | 19 | -static void do_reduce(DisasContext *s, arg_rpr_esz *a, |
20 | +static bool do_reduce(DisasContext *s, arg_rpr_esz *a, | ||
21 | gen_helper_fp_reduce *fn) | ||
22 | { | ||
23 | - unsigned vsz = vec_full_reg_size(s); | ||
24 | - unsigned p2vsz = pow2ceil(vsz); | ||
25 | - TCGv_i32 t_desc = tcg_constant_i32(simd_desc(vsz, vsz, p2vsz)); | ||
26 | + unsigned vsz, p2vsz; | ||
27 | + TCGv_i32 t_desc; | ||
28 | TCGv_ptr t_zn, t_pg, status; | ||
29 | TCGv_i64 temp; | ||
30 | |||
31 | + if (fn == NULL) { | ||
32 | + return false; | ||
33 | + } | ||
34 | + if (!sve_access_check(s)) { | ||
35 | + return true; | ||
36 | + } | ||
83 | + | 37 | + |
84 | ignored = ['CONFIG_QEMU_INTERP_PREFIX'] # actually per-target | 38 | + vsz = vec_full_reg_size(s); |
85 | arrays = ['CONFIG_AUDIO_DRIVERS', 'CONFIG_BDRV_RW_WHITELIST', 'CONFIG_BDRV_RO_WHITELIST'] | 39 | + p2vsz = pow2ceil(vsz); |
86 | strings = ['HOST_DSOSUF', 'CONFIG_IASL'] | 40 | + t_desc = tcg_constant_i32(simd_desc(vsz, vsz, p2vsz)); |
87 | @@ -XXX,XX +XXX,XX @@ summary_info += {'PIE': get_option('b_pie')} | 41 | temp = tcg_temp_new_i64(); |
88 | summary_info += {'static build': config_host.has_key('CONFIG_STATIC')} | 42 | t_zn = tcg_temp_new_ptr(); |
89 | summary_info += {'malloc trim support': has_malloc_trim} | 43 | t_pg = tcg_temp_new_ptr(); |
90 | summary_info += {'membarrier': config_host.has_key('CONFIG_MEMBARRIER')} | 44 | @@ -XXX,XX +XXX,XX @@ static void do_reduce(DisasContext *s, arg_rpr_esz *a, |
91 | -summary_info += {'preadv support': config_host.has_key('CONFIG_PREADV')} | 45 | |
92 | +summary_info += {'preadv support': config_host_data.get('CONFIG_PREADV')} | 46 | write_fp_dreg(s, a->rd, temp); |
93 | summary_info += {'fdatasync': config_host.has_key('CONFIG_FDATASYNC')} | 47 | tcg_temp_free_i64(temp); |
94 | summary_info += {'madvise': config_host.has_key('CONFIG_MADVISE')} | 48 | + return true; |
95 | summary_info += {'posix_madvise': config_host.has_key('CONFIG_POSIX_MADVISE')} | 49 | } |
50 | |||
51 | #define DO_VPZ(NAME, name) \ | ||
52 | static bool trans_##NAME(DisasContext *s, arg_rpr_esz *a) \ | ||
53 | { \ | ||
54 | - static gen_helper_fp_reduce * const fns[3] = { \ | ||
55 | - gen_helper_sve_##name##_h, \ | ||
56 | + static gen_helper_fp_reduce * const fns[4] = { \ | ||
57 | + NULL, gen_helper_sve_##name##_h, \ | ||
58 | gen_helper_sve_##name##_s, \ | ||
59 | gen_helper_sve_##name##_d, \ | ||
60 | }; \ | ||
61 | - if (a->esz == 0) { \ | ||
62 | - return false; \ | ||
63 | - } \ | ||
64 | - if (sve_access_check(s)) { \ | ||
65 | - do_reduce(s, a, fns[a->esz - 1]); \ | ||
66 | - } \ | ||
67 | - return true; \ | ||
68 | + return do_reduce(s, a, fns[a->esz]); \ | ||
69 | } | ||
70 | |||
71 | DO_VPZ(FADDV, faddv) | ||
96 | -- | 72 | -- |
97 | 2.20.1 | 73 | 2.25.1 |
98 | |||
99 | diff view generated by jsdifflib |
1 | From: Hao Wu <wuhaotsh@google.com> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Fix potential overflow problem when calculating pwm_duty. | 3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
4 | 1. Ensure p->cmr and p->cnr to be from [0,65535], according to the | 4 | Message-id: 20220527181907.189259-91-richard.henderson@linaro.org |
5 | hardware specification. | ||
6 | 2. Changed duty to uint32_t. However, since MAX_DUTY * (p->cmr+1) | ||
7 | can excceed UINT32_MAX, we convert them to uint64_t in computation | ||
8 | and converted them back to uint32_t. | ||
9 | (duty is guaranteed to be <= MAX_DUTY so it won't overflow.) | ||
10 | |||
11 | Fixes: CID 1442342 | ||
12 | Suggested-by: Peter Maydell <peter.maydell@linaro.org> | ||
13 | Reviewed-by: Doug Evans <dje@google.com> | ||
14 | Signed-off-by: Hao Wu <wuhaotsh@google.com> | ||
15 | Message-id: 20210127011142.2122790-1-wuhaotsh@google.com | ||
16 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
17 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
18 | --- | 7 | --- |
19 | hw/misc/npcm7xx_pwm.c | 23 +++++++++++++++++++---- | 8 | target/arm/translate-sve.c | 14 ++++++-------- |
20 | tests/qtest/npcm7xx_pwm-test.c | 4 ++-- | 9 | 1 file changed, 6 insertions(+), 8 deletions(-) |
21 | 2 files changed, 21 insertions(+), 6 deletions(-) | ||
22 | 10 | ||
23 | diff --git a/hw/misc/npcm7xx_pwm.c b/hw/misc/npcm7xx_pwm.c | 11 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c |
24 | index XXXXXXX..XXXXXXX 100644 | 12 | index XXXXXXX..XXXXXXX 100644 |
25 | --- a/hw/misc/npcm7xx_pwm.c | 13 | --- a/target/arm/translate-sve.c |
26 | +++ b/hw/misc/npcm7xx_pwm.c | 14 | +++ b/target/arm/translate-sve.c |
27 | @@ -XXX,XX +XXX,XX @@ REG32(NPCM7XX_PWM_PWDR3, 0x50); | 15 | @@ -XXX,XX +XXX,XX @@ static bool do_reduce(DisasContext *s, arg_rpr_esz *a, |
28 | #define NPCM7XX_CH_INV BIT(2) | 16 | } |
29 | #define NPCM7XX_CH_MOD BIT(3) | 17 | |
30 | 18 | #define DO_VPZ(NAME, name) \ | |
31 | +#define NPCM7XX_MAX_CMR 65535 | 19 | -static bool trans_##NAME(DisasContext *s, arg_rpr_esz *a) \ |
32 | +#define NPCM7XX_MAX_CNR 65535 | 20 | -{ \ |
21 | - static gen_helper_fp_reduce * const fns[4] = { \ | ||
22 | - NULL, gen_helper_sve_##name##_h, \ | ||
23 | - gen_helper_sve_##name##_s, \ | ||
24 | - gen_helper_sve_##name##_d, \ | ||
25 | + static gen_helper_fp_reduce * const name##_fns[4] = { \ | ||
26 | + NULL, gen_helper_sve_##name##_h, \ | ||
27 | + gen_helper_sve_##name##_s, gen_helper_sve_##name##_d, \ | ||
28 | }; \ | ||
29 | - return do_reduce(s, a, fns[a->esz]); \ | ||
30 | -} | ||
31 | + TRANS_FEAT(NAME, aa64_sve, do_reduce, a, name##_fns[a->esz]) | ||
32 | |||
33 | DO_VPZ(FADDV, faddv) | ||
34 | DO_VPZ(FMINNMV, fminnmv) | ||
35 | @@ -XXX,XX +XXX,XX @@ DO_VPZ(FMAXNMV, fmaxnmv) | ||
36 | DO_VPZ(FMINV, fminv) | ||
37 | DO_VPZ(FMAXV, fmaxv) | ||
38 | |||
39 | +#undef DO_VPZ | ||
33 | + | 40 | + |
34 | /* Offset of each PWM channel's prescaler in the PPR register. */ | 41 | /* |
35 | static const int npcm7xx_ppr_base[] = { 0, 0, 8, 8 }; | 42 | *** SVE Floating Point Unary Operations - Unpredicated Group |
36 | /* Offset of each PWM channel's clock selector in the CSR register. */ | 43 | */ |
37 | @@ -XXX,XX +XXX,XX @@ static uint32_t npcm7xx_pwm_calculate_freq(NPCM7xxPWM *p) | ||
38 | |||
39 | static uint32_t npcm7xx_pwm_calculate_duty(NPCM7xxPWM *p) | ||
40 | { | ||
41 | - uint64_t duty; | ||
42 | + uint32_t duty; | ||
43 | |||
44 | if (p->running) { | ||
45 | if (p->cnr == 0) { | ||
46 | @@ -XXX,XX +XXX,XX @@ static uint32_t npcm7xx_pwm_calculate_duty(NPCM7xxPWM *p) | ||
47 | } else if (p->cmr >= p->cnr) { | ||
48 | duty = NPCM7XX_PWM_MAX_DUTY; | ||
49 | } else { | ||
50 | - duty = NPCM7XX_PWM_MAX_DUTY * (p->cmr + 1) / (p->cnr + 1); | ||
51 | + duty = (uint64_t)NPCM7XX_PWM_MAX_DUTY * (p->cmr + 1) / (p->cnr + 1); | ||
52 | } | ||
53 | } else { | ||
54 | duty = 0; | ||
55 | @@ -XXX,XX +XXX,XX @@ static void npcm7xx_pwm_write(void *opaque, hwaddr offset, | ||
56 | case A_NPCM7XX_PWM_CNR2: | ||
57 | case A_NPCM7XX_PWM_CNR3: | ||
58 | p = &s->pwm[npcm7xx_cnr_index(offset)]; | ||
59 | - p->cnr = value; | ||
60 | + if (value > NPCM7XX_MAX_CNR) { | ||
61 | + qemu_log_mask(LOG_GUEST_ERROR, | ||
62 | + "%s: invalid cnr value: %u", __func__, value); | ||
63 | + p->cnr = NPCM7XX_MAX_CNR; | ||
64 | + } else { | ||
65 | + p->cnr = value; | ||
66 | + } | ||
67 | npcm7xx_pwm_update_output(p); | ||
68 | break; | ||
69 | |||
70 | @@ -XXX,XX +XXX,XX @@ static void npcm7xx_pwm_write(void *opaque, hwaddr offset, | ||
71 | case A_NPCM7XX_PWM_CMR2: | ||
72 | case A_NPCM7XX_PWM_CMR3: | ||
73 | p = &s->pwm[npcm7xx_cmr_index(offset)]; | ||
74 | - p->cmr = value; | ||
75 | + if (value > NPCM7XX_MAX_CMR) { | ||
76 | + qemu_log_mask(LOG_GUEST_ERROR, | ||
77 | + "%s: invalid cmr value: %u", __func__, value); | ||
78 | + p->cmr = NPCM7XX_MAX_CMR; | ||
79 | + } else { | ||
80 | + p->cmr = value; | ||
81 | + } | ||
82 | npcm7xx_pwm_update_output(p); | ||
83 | break; | ||
84 | |||
85 | diff --git a/tests/qtest/npcm7xx_pwm-test.c b/tests/qtest/npcm7xx_pwm-test.c | ||
86 | index XXXXXXX..XXXXXXX 100644 | ||
87 | --- a/tests/qtest/npcm7xx_pwm-test.c | ||
88 | +++ b/tests/qtest/npcm7xx_pwm-test.c | ||
89 | @@ -XXX,XX +XXX,XX @@ static uint64_t pwm_compute_freq(QTestState *qts, uint32_t ppr, uint32_t csr, | ||
90 | |||
91 | static uint64_t pwm_compute_duty(uint32_t cnr, uint32_t cmr, bool inverted) | ||
92 | { | ||
93 | - uint64_t duty; | ||
94 | + uint32_t duty; | ||
95 | |||
96 | if (cnr == 0) { | ||
97 | /* PWM is stopped. */ | ||
98 | @@ -XXX,XX +XXX,XX @@ static uint64_t pwm_compute_duty(uint32_t cnr, uint32_t cmr, bool inverted) | ||
99 | } else if (cmr >= cnr) { | ||
100 | duty = MAX_DUTY; | ||
101 | } else { | ||
102 | - duty = MAX_DUTY * (cmr + 1) / (cnr + 1); | ||
103 | + duty = (uint64_t)MAX_DUTY * (cmr + 1) / (cnr + 1); | ||
104 | } | ||
105 | |||
106 | if (inverted) { | ||
107 | -- | 44 | -- |
108 | 2.20.1 | 45 | 2.25.1 |
109 | |||
110 | diff view generated by jsdifflib |
1 | From: Mihai Carabas <mihai.carabas@oracle.com> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Add PCI interface support for PVPANIC device. Create a new file pvpanic-pci.c | 3 | Rename do_zz_fp to gen_gvec_fpst_arg_zz, and move up. |
4 | where the PCI specific routines reside and update the build system with the new | 4 | Split out gen_gvec_fpst_zz as a helper while we're at it. |
5 | files and config structure. | ||
6 | 5 | ||
7 | Signed-off-by: Mihai Carabas <mihai.carabas@oracle.com> | 6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
8 | Reviewed-by: Gerd Hoffmann <kraxel@redhat.com> | 7 | Message-id: 20220527181907.189259-92-richard.henderson@linaro.org |
9 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
10 | Signed-off-by: Mihai Carabas <mihai.carabas@oracle.com> | ||
11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
12 | --- | 10 | --- |
13 | docs/specs/pci-ids.txt | 1 + | 11 | target/arm/translate-sve.c | 77 ++++++++++++++++++-------------------- |
14 | include/hw/misc/pvpanic.h | 1 + | 12 | 1 file changed, 36 insertions(+), 41 deletions(-) |
15 | include/hw/pci/pci.h | 1 + | ||
16 | hw/misc/pvpanic-pci.c | 94 +++++++++++++++++++++++++++++++++++++++ | ||
17 | hw/misc/Kconfig | 6 +++ | ||
18 | hw/misc/meson.build | 1 + | ||
19 | 6 files changed, 104 insertions(+) | ||
20 | create mode 100644 hw/misc/pvpanic-pci.c | ||
21 | 13 | ||
22 | diff --git a/docs/specs/pci-ids.txt b/docs/specs/pci-ids.txt | 14 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c |
23 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
24 | --- a/docs/specs/pci-ids.txt | 16 | --- a/target/arm/translate-sve.c |
25 | +++ b/docs/specs/pci-ids.txt | 17 | +++ b/target/arm/translate-sve.c |
26 | @@ -XXX,XX +XXX,XX @@ PCI devices (other than virtio): | 18 | @@ -XXX,XX +XXX,XX @@ static bool gen_gvec_ool_zz(DisasContext *s, gen_helper_gvec_2 *fn, |
27 | 1b36:000d PCI xhci usb host adapter | 19 | return true; |
28 | 1b36:000f mdpy (mdev sample device), linux/samples/vfio-mdev/mdpy.c | 20 | } |
29 | 1b36:0010 PCIe NVMe device (-device nvme) | 21 | |
30 | +1b36:0011 PCI PVPanic device (-device pvpanic-pci) | 22 | +static bool gen_gvec_fpst_zz(DisasContext *s, gen_helper_gvec_2_ptr *fn, |
31 | 23 | + int rd, int rn, int data, | |
32 | All these devices are documented in docs/specs. | 24 | + ARMFPStatusFlavour flavour) |
33 | 25 | +{ | |
34 | diff --git a/include/hw/misc/pvpanic.h b/include/hw/misc/pvpanic.h | 26 | + if (fn == NULL) { |
35 | index XXXXXXX..XXXXXXX 100644 | 27 | + return false; |
36 | --- a/include/hw/misc/pvpanic.h | 28 | + } |
37 | +++ b/include/hw/misc/pvpanic.h | 29 | + if (sve_access_check(s)) { |
38 | @@ -XXX,XX +XXX,XX @@ | 30 | + unsigned vsz = vec_full_reg_size(s); |
39 | #include "qom/object.h" | 31 | + TCGv_ptr status = fpstatus_ptr(flavour); |
40 | |||
41 | #define TYPE_PVPANIC_ISA_DEVICE "pvpanic" | ||
42 | +#define TYPE_PVPANIC_PCI_DEVICE "pvpanic-pci" | ||
43 | |||
44 | #define PVPANIC_IOPORT_PROP "ioport" | ||
45 | |||
46 | diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h | ||
47 | index XXXXXXX..XXXXXXX 100644 | ||
48 | --- a/include/hw/pci/pci.h | ||
49 | +++ b/include/hw/pci/pci.h | ||
50 | @@ -XXX,XX +XXX,XX @@ extern bool pci_available; | ||
51 | #define PCI_DEVICE_ID_REDHAT_PCIE_BRIDGE 0x000e | ||
52 | #define PCI_DEVICE_ID_REDHAT_MDPY 0x000f | ||
53 | #define PCI_DEVICE_ID_REDHAT_NVME 0x0010 | ||
54 | +#define PCI_DEVICE_ID_REDHAT_PVPANIC 0x0011 | ||
55 | #define PCI_DEVICE_ID_REDHAT_QXL 0x0100 | ||
56 | |||
57 | #define FMT_PCIBUS PRIx64 | ||
58 | diff --git a/hw/misc/pvpanic-pci.c b/hw/misc/pvpanic-pci.c | ||
59 | new file mode 100644 | ||
60 | index XXXXXXX..XXXXXXX | ||
61 | --- /dev/null | ||
62 | +++ b/hw/misc/pvpanic-pci.c | ||
63 | @@ -XXX,XX +XXX,XX @@ | ||
64 | +/* | ||
65 | + * QEMU simulated PCI pvpanic device. | ||
66 | + * | ||
67 | + * Copyright (C) 2020 Oracle | ||
68 | + * | ||
69 | + * Authors: | ||
70 | + * Mihai Carabas <mihai.carabas@oracle.com> | ||
71 | + * | ||
72 | + * This work is licensed under the terms of the GNU GPL, version 2 or later. | ||
73 | + * See the COPYING file in the top-level directory. | ||
74 | + * | ||
75 | + */ | ||
76 | + | 32 | + |
77 | +#include "qemu/osdep.h" | 33 | + tcg_gen_gvec_2_ptr(vec_full_reg_offset(s, rd), |
78 | +#include "qemu/log.h" | 34 | + vec_full_reg_offset(s, rn), |
79 | +#include "qemu/module.h" | 35 | + status, vsz, vsz, data, fn); |
80 | +#include "sysemu/runstate.h" | 36 | + tcg_temp_free_ptr(status); |
81 | + | ||
82 | +#include "hw/nvram/fw_cfg.h" | ||
83 | +#include "hw/qdev-properties.h" | ||
84 | +#include "migration/vmstate.h" | ||
85 | +#include "hw/misc/pvpanic.h" | ||
86 | +#include "qom/object.h" | ||
87 | +#include "hw/pci/pci.h" | ||
88 | + | ||
89 | +OBJECT_DECLARE_SIMPLE_TYPE(PVPanicPCIState, PVPANIC_PCI_DEVICE) | ||
90 | + | ||
91 | +/* | ||
92 | + * PVPanicPCIState for PCI device | ||
93 | + */ | ||
94 | +typedef struct PVPanicPCIState { | ||
95 | + PCIDevice dev; | ||
96 | + PVPanicState pvpanic; | ||
97 | +} PVPanicPCIState; | ||
98 | + | ||
99 | +static const VMStateDescription vmstate_pvpanic_pci = { | ||
100 | + .name = "pvpanic-pci", | ||
101 | + .version_id = 1, | ||
102 | + .minimum_version_id = 1, | ||
103 | + .fields = (VMStateField[]) { | ||
104 | + VMSTATE_PCI_DEVICE(dev, PVPanicPCIState), | ||
105 | + VMSTATE_END_OF_LIST() | ||
106 | + } | 37 | + } |
107 | +}; | 38 | + return true; |
108 | + | ||
109 | +static void pvpanic_pci_realizefn(PCIDevice *dev, Error **errp) | ||
110 | +{ | ||
111 | + PVPanicPCIState *s = PVPANIC_PCI_DEVICE(dev); | ||
112 | + PVPanicState *ps = &s->pvpanic; | ||
113 | + | ||
114 | + pvpanic_setup_io(&s->pvpanic, DEVICE(s), 2); | ||
115 | + | ||
116 | + pci_register_bar(dev, 0, PCI_BASE_ADDRESS_SPACE_MEMORY, &ps->mr); | ||
117 | +} | 39 | +} |
118 | + | 40 | + |
119 | +static Property pvpanic_pci_properties[] = { | 41 | +static bool gen_gvec_fpst_arg_zz(DisasContext *s, gen_helper_gvec_2_ptr *fn, |
120 | + DEFINE_PROP_UINT8("events", PVPanicPCIState, pvpanic.events, PVPANIC_PANICKED | PVPANIC_CRASHLOADED), | 42 | + arg_rr_esz *a, int data) |
121 | + DEFINE_PROP_END_OF_LIST(), | ||
122 | +}; | ||
123 | + | ||
124 | +static void pvpanic_pci_class_init(ObjectClass *klass, void *data) | ||
125 | +{ | 43 | +{ |
126 | + DeviceClass *dc = DEVICE_CLASS(klass); | 44 | + return gen_gvec_fpst_zz(s, fn, a->rd, a->rn, data, |
127 | + PCIDeviceClass *pc = PCI_DEVICE_CLASS(klass); | 45 | + a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR); |
128 | + | ||
129 | + device_class_set_props(dc, pvpanic_pci_properties); | ||
130 | + | ||
131 | + pc->realize = pvpanic_pci_realizefn; | ||
132 | + pc->vendor_id = PCI_VENDOR_ID_REDHAT; | ||
133 | + pc->device_id = PCI_DEVICE_ID_REDHAT_PVPANIC; | ||
134 | + pc->revision = 1; | ||
135 | + pc->class_id = PCI_CLASS_SYSTEM_OTHER; | ||
136 | + dc->vmsd = &vmstate_pvpanic_pci; | ||
137 | + | ||
138 | + set_bit(DEVICE_CATEGORY_MISC, dc->categories); | ||
139 | +} | 46 | +} |
140 | + | 47 | + |
141 | +static TypeInfo pvpanic_pci_info = { | 48 | /* Invoke an out-of-line helper on 3 Zregs. */ |
142 | + .name = TYPE_PVPANIC_PCI_DEVICE, | 49 | static bool gen_gvec_ool_zzz(DisasContext *s, gen_helper_gvec_3 *fn, |
143 | + .parent = TYPE_PCI_DEVICE, | 50 | int rd, int rn, int rm, int data) |
144 | + .instance_size = sizeof(PVPanicPCIState), | 51 | @@ -XXX,XX +XXX,XX @@ DO_VPZ(FMAXV, fmaxv) |
145 | + .class_init = pvpanic_pci_class_init, | 52 | *** SVE Floating Point Unary Operations - Unpredicated Group |
146 | + .interfaces = (InterfaceInfo[]) { | 53 | */ |
147 | + { INTERFACE_CONVENTIONAL_PCI_DEVICE }, | 54 | |
148 | + { } | 55 | -static void do_zz_fp(DisasContext *s, arg_rr_esz *a, gen_helper_gvec_2_ptr *fn) |
149 | + } | 56 | -{ |
57 | - unsigned vsz = vec_full_reg_size(s); | ||
58 | - TCGv_ptr status = fpstatus_ptr(a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR); | ||
59 | +static gen_helper_gvec_2_ptr * const frecpe_fns[] = { | ||
60 | + NULL, gen_helper_gvec_frecpe_h, | ||
61 | + gen_helper_gvec_frecpe_s, gen_helper_gvec_frecpe_d, | ||
150 | +}; | 62 | +}; |
151 | + | 63 | +TRANS_FEAT(FRECPE, aa64_sve, gen_gvec_fpst_arg_zz, frecpe_fns[a->esz], a, 0) |
152 | +static void pvpanic_register_types(void) | 64 | |
153 | +{ | 65 | - tcg_gen_gvec_2_ptr(vec_full_reg_offset(s, a->rd), |
154 | + type_register_static(&pvpanic_pci_info); | 66 | - vec_full_reg_offset(s, a->rn), |
155 | +} | 67 | - status, vsz, vsz, 0, fn); |
156 | + | 68 | - tcg_temp_free_ptr(status); |
157 | +type_init(pvpanic_register_types); | 69 | -} |
158 | diff --git a/hw/misc/Kconfig b/hw/misc/Kconfig | 70 | - |
159 | index XXXXXXX..XXXXXXX 100644 | 71 | -static bool trans_FRECPE(DisasContext *s, arg_rr_esz *a) |
160 | --- a/hw/misc/Kconfig | 72 | -{ |
161 | +++ b/hw/misc/Kconfig | 73 | - static gen_helper_gvec_2_ptr * const fns[3] = { |
162 | @@ -XXX,XX +XXX,XX @@ config IOTKIT_SYSINFO | 74 | - gen_helper_gvec_frecpe_h, |
163 | config PVPANIC_COMMON | 75 | - gen_helper_gvec_frecpe_s, |
164 | bool | 76 | - gen_helper_gvec_frecpe_d, |
165 | 77 | - }; | |
166 | +config PVPANIC_PCI | 78 | - if (a->esz == 0) { |
167 | + bool | 79 | - return false; |
168 | + default y if PCI_DEVICES | 80 | - } |
169 | + depends on PCI | 81 | - if (sve_access_check(s)) { |
170 | + select PVPANIC_COMMON | 82 | - do_zz_fp(s, a, fns[a->esz - 1]); |
171 | + | 83 | - } |
172 | config PVPANIC_ISA | 84 | - return true; |
173 | bool | 85 | -} |
174 | depends on ISA_BUS | 86 | - |
175 | diff --git a/hw/misc/meson.build b/hw/misc/meson.build | 87 | -static bool trans_FRSQRTE(DisasContext *s, arg_rr_esz *a) |
176 | index XXXXXXX..XXXXXXX 100644 | 88 | -{ |
177 | --- a/hw/misc/meson.build | 89 | - static gen_helper_gvec_2_ptr * const fns[3] = { |
178 | +++ b/hw/misc/meson.build | 90 | - gen_helper_gvec_frsqrte_h, |
179 | @@ -XXX,XX +XXX,XX @@ softmmu_ss.add(when: 'CONFIG_ARMSSE_CPUID', if_true: files('armsse-cpuid.c')) | 91 | - gen_helper_gvec_frsqrte_s, |
180 | softmmu_ss.add(when: 'CONFIG_ARMSSE_MHU', if_true: files('armsse-mhu.c')) | 92 | - gen_helper_gvec_frsqrte_d, |
181 | 93 | - }; | |
182 | softmmu_ss.add(when: 'CONFIG_PVPANIC_ISA', if_true: files('pvpanic-isa.c')) | 94 | - if (a->esz == 0) { |
183 | +softmmu_ss.add(when: 'CONFIG_PVPANIC_PCI', if_true: files('pvpanic-pci.c')) | 95 | - return false; |
184 | softmmu_ss.add(when: 'CONFIG_AUX', if_true: files('auxbus.c')) | 96 | - } |
185 | softmmu_ss.add(when: 'CONFIG_ASPEED_SOC', if_true: files('aspeed_scu.c', 'aspeed_sdmc.c', 'aspeed_xdma.c')) | 97 | - if (sve_access_check(s)) { |
186 | softmmu_ss.add(when: 'CONFIG_MSF2', if_true: files('msf2-sysreg.c')) | 98 | - do_zz_fp(s, a, fns[a->esz - 1]); |
99 | - } | ||
100 | - return true; | ||
101 | -} | ||
102 | +static gen_helper_gvec_2_ptr * const frsqrte_fns[] = { | ||
103 | + NULL, gen_helper_gvec_frsqrte_h, | ||
104 | + gen_helper_gvec_frsqrte_s, gen_helper_gvec_frsqrte_d, | ||
105 | +}; | ||
106 | +TRANS_FEAT(FRSQRTE, aa64_sve, gen_gvec_fpst_arg_zz, frsqrte_fns[a->esz], a, 0) | ||
107 | |||
108 | /* | ||
109 | *** SVE Floating Point Compare with Zero Group | ||
187 | -- | 110 | -- |
188 | 2.20.1 | 111 | 2.25.1 |
189 | |||
190 | diff view generated by jsdifflib |
1 | Create and connect the Clock input for the watchdog device on the | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | Stellaris boards. Because the Stellaris boards model the ability to | ||
3 | change the clock rate by programming PLL registers, we have to create | ||
4 | an output Clock on the ssys_state device and wire it up to the | ||
5 | watchdog. | ||
6 | 2 | ||
7 | Note that the old comment on ssys_calculate_system_clock() got the | 3 | Simplify indexing of this array. This will allow folding |
8 | units wrong -- system_clock_scale is in nanoseconds, not | 4 | of the illegal esz == 0 into the normal fn == NULL check. |
9 | milliseconds. Improve the commentary to clarify how we are | ||
10 | calculating the period. | ||
11 | 5 | ||
6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Message-id: 20220527181907.189259-93-richard.henderson@linaro.org | ||
8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
13 | Reviewed-by: Luc Michel <luc@lmichel.fr> | ||
14 | Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
15 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
16 | Message-id: 20210128114145.20536-18-peter.maydell@linaro.org | ||
17 | Message-id: 20210121190622.22000-18-peter.maydell@linaro.org | ||
18 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
19 | --- | 10 | --- |
20 | hw/arm/stellaris.c | 43 +++++++++++++++++++++++++++++++------------ | 11 | target/arm/translate-sve.c | 15 ++++++++------- |
21 | 1 file changed, 31 insertions(+), 12 deletions(-) | 12 | 1 file changed, 8 insertions(+), 7 deletions(-) |
22 | 13 | ||
23 | diff --git a/hw/arm/stellaris.c b/hw/arm/stellaris.c | 14 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c |
24 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
25 | --- a/hw/arm/stellaris.c | 16 | --- a/target/arm/translate-sve.c |
26 | +++ b/hw/arm/stellaris.c | 17 | +++ b/target/arm/translate-sve.c |
27 | @@ -XXX,XX +XXX,XX @@ | 18 | @@ -XXX,XX +XXX,XX @@ static bool trans_FCVTZU_dd(DisasContext *s, arg_rpr_esz *a) |
28 | #include "hw/watchdog/cmsdk-apb-watchdog.h" | 19 | return do_zpz_ptr(s, a->rd, a->rn, a->pg, false, gen_helper_sve_fcvtzu_dd); |
29 | #include "migration/vmstate.h" | ||
30 | #include "hw/misc/unimp.h" | ||
31 | +#include "hw/qdev-clock.h" | ||
32 | #include "cpu.h" | ||
33 | #include "qom/object.h" | ||
34 | |||
35 | @@ -XXX,XX +XXX,XX @@ struct ssys_state { | ||
36 | uint32_t clkvclr; | ||
37 | uint32_t ldoarst; | ||
38 | qemu_irq irq; | ||
39 | + Clock *sysclk; | ||
40 | /* Properties (all read-only registers) */ | ||
41 | uint32_t user0; | ||
42 | uint32_t user1; | ||
43 | @@ -XXX,XX +XXX,XX @@ static bool ssys_use_rcc2(ssys_state *s) | ||
44 | } | 20 | } |
45 | 21 | ||
46 | /* | 22 | -static gen_helper_gvec_3_ptr * const frint_fns[3] = { |
47 | - * Caculate the sys. clock period in ms. | 23 | +static gen_helper_gvec_3_ptr * const frint_fns[] = { |
48 | + * Calculate the system clock period. We only want to propagate | 24 | + NULL, |
49 | + * this change to the rest of the system if we're not being called | 25 | gen_helper_sve_frint_h, |
50 | + * from migration post-load. | 26 | gen_helper_sve_frint_s, |
51 | */ | 27 | gen_helper_sve_frint_d |
52 | -static void ssys_calculate_system_clock(ssys_state *s) | 28 | @@ -XXX,XX +XXX,XX @@ static bool trans_FRINTI(DisasContext *s, arg_rpr_esz *a) |
53 | +static void ssys_calculate_system_clock(ssys_state *s, bool propagate_clock) | 29 | return false; |
54 | { | ||
55 | + /* | ||
56 | + * SYSDIV field specifies divisor: 0 == /1, 1 == /2, etc. Input | ||
57 | + * clock is 200MHz, which is a period of 5 ns. Dividing the clock | ||
58 | + * frequency by X is the same as multiplying the period by X. | ||
59 | + */ | ||
60 | if (ssys_use_rcc2(s)) { | ||
61 | system_clock_scale = 5 * (((s->rcc2 >> 23) & 0x3f) + 1); | ||
62 | } else { | ||
63 | system_clock_scale = 5 * (((s->rcc >> 23) & 0xf) + 1); | ||
64 | } | 30 | } |
65 | + clock_set_ns(s->sysclk, system_clock_scale); | 31 | return do_zpz_ptr(s, a->rd, a->rn, a->pg, a->esz == MO_16, |
66 | + if (propagate_clock) { | 32 | - frint_fns[a->esz - 1]); |
67 | + clock_propagate(s->sysclk); | 33 | + frint_fns[a->esz]); |
68 | + } | ||
69 | } | 34 | } |
70 | 35 | ||
71 | static void ssys_write(void *opaque, hwaddr offset, | 36 | static bool trans_FRINTX(DisasContext *s, arg_rpr_esz *a) |
72 | @@ -XXX,XX +XXX,XX @@ static void ssys_write(void *opaque, hwaddr offset, | 37 | @@ -XXX,XX +XXX,XX @@ static bool trans_FRINTN(DisasContext *s, arg_rpr_esz *a) |
73 | s->int_status |= (1 << 6); | 38 | if (a->esz == 0) { |
74 | } | 39 | return false; |
75 | s->rcc = value; | 40 | } |
76 | - ssys_calculate_system_clock(s); | 41 | - return do_frint_mode(s, a, float_round_nearest_even, frint_fns[a->esz - 1]); |
77 | + ssys_calculate_system_clock(s, true); | 42 | + return do_frint_mode(s, a, float_round_nearest_even, frint_fns[a->esz]); |
78 | break; | ||
79 | case 0x070: /* RCC2 */ | ||
80 | if (ssys_board_class(s) == DID0_CLASS_SANDSTORM) { | ||
81 | @@ -XXX,XX +XXX,XX @@ static void ssys_write(void *opaque, hwaddr offset, | ||
82 | s->int_status |= (1 << 6); | ||
83 | } | ||
84 | s->rcc2 = value; | ||
85 | - ssys_calculate_system_clock(s); | ||
86 | + ssys_calculate_system_clock(s, true); | ||
87 | break; | ||
88 | case 0x100: /* RCGC0 */ | ||
89 | s->rcgc[0] = value; | ||
90 | @@ -XXX,XX +XXX,XX @@ static void stellaris_sys_reset_hold(Object *obj) | ||
91 | { | ||
92 | ssys_state *s = STELLARIS_SYS(obj); | ||
93 | |||
94 | - ssys_calculate_system_clock(s); | ||
95 | + /* OK to propagate clocks from the hold phase */ | ||
96 | + ssys_calculate_system_clock(s, true); | ||
97 | } | 43 | } |
98 | 44 | ||
99 | static void stellaris_sys_reset_exit(Object *obj) | 45 | static bool trans_FRINTP(DisasContext *s, arg_rpr_esz *a) |
100 | @@ -XXX,XX +XXX,XX @@ static int stellaris_sys_post_load(void *opaque, int version_id) | 46 | @@ -XXX,XX +XXX,XX @@ static bool trans_FRINTP(DisasContext *s, arg_rpr_esz *a) |
101 | { | 47 | if (a->esz == 0) { |
102 | ssys_state *s = opaque; | 48 | return false; |
103 | 49 | } | |
104 | - ssys_calculate_system_clock(s); | 50 | - return do_frint_mode(s, a, float_round_up, frint_fns[a->esz - 1]); |
105 | + ssys_calculate_system_clock(s, false); | 51 | + return do_frint_mode(s, a, float_round_up, frint_fns[a->esz]); |
106 | |||
107 | return 0; | ||
108 | } | 52 | } |
109 | @@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_stellaris_sys = { | 53 | |
110 | VMSTATE_UINT32_ARRAY(dcgc, ssys_state, 3), | 54 | static bool trans_FRINTM(DisasContext *s, arg_rpr_esz *a) |
111 | VMSTATE_UINT32(clkvclr, ssys_state), | 55 | @@ -XXX,XX +XXX,XX @@ static bool trans_FRINTM(DisasContext *s, arg_rpr_esz *a) |
112 | VMSTATE_UINT32(ldoarst, ssys_state), | 56 | if (a->esz == 0) { |
113 | + /* No field for sysclk -- handled in post-load instead */ | 57 | return false; |
114 | VMSTATE_END_OF_LIST() | ||
115 | } | 58 | } |
116 | }; | 59 | - return do_frint_mode(s, a, float_round_down, frint_fns[a->esz - 1]); |
117 | @@ -XXX,XX +XXX,XX @@ static void stellaris_sys_instance_init(Object *obj) | 60 | + return do_frint_mode(s, a, float_round_down, frint_fns[a->esz]); |
118 | memory_region_init_io(&s->iomem, obj, &ssys_ops, s, "ssys", 0x00001000); | ||
119 | sysbus_init_mmio(sbd, &s->iomem); | ||
120 | sysbus_init_irq(sbd, &s->irq); | ||
121 | + s->sysclk = qdev_init_clock_out(DEVICE(s), "SYSCLK"); | ||
122 | } | 61 | } |
123 | 62 | ||
124 | -static int stellaris_sys_init(uint32_t base, qemu_irq irq, | 63 | static bool trans_FRINTZ(DisasContext *s, arg_rpr_esz *a) |
125 | - stellaris_board_info * board, | 64 | @@ -XXX,XX +XXX,XX @@ static bool trans_FRINTZ(DisasContext *s, arg_rpr_esz *a) |
126 | - uint8_t *macaddr) | 65 | if (a->esz == 0) { |
127 | +static DeviceState *stellaris_sys_init(uint32_t base, qemu_irq irq, | 66 | return false; |
128 | + stellaris_board_info *board, | 67 | } |
129 | + uint8_t *macaddr) | 68 | - return do_frint_mode(s, a, float_round_to_zero, frint_fns[a->esz - 1]); |
130 | { | 69 | + return do_frint_mode(s, a, float_round_to_zero, frint_fns[a->esz]); |
131 | DeviceState *dev = qdev_new(TYPE_STELLARIS_SYS); | ||
132 | SysBusDevice *sbd = SYS_BUS_DEVICE(dev); | ||
133 | @@ -XXX,XX +XXX,XX @@ static int stellaris_sys_init(uint32_t base, qemu_irq irq, | ||
134 | */ | ||
135 | device_cold_reset(dev); | ||
136 | |||
137 | - return 0; | ||
138 | + return dev; | ||
139 | } | 70 | } |
140 | 71 | ||
141 | /* I2C controller. */ | 72 | static bool trans_FRINTA(DisasContext *s, arg_rpr_esz *a) |
142 | @@ -XXX,XX +XXX,XX @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board) | 73 | @@ -XXX,XX +XXX,XX @@ static bool trans_FRINTA(DisasContext *s, arg_rpr_esz *a) |
143 | int flash_size; | 74 | if (a->esz == 0) { |
144 | I2CBus *i2c; | 75 | return false; |
145 | DeviceState *dev; | ||
146 | + DeviceState *ssys_dev; | ||
147 | int i; | ||
148 | int j; | ||
149 | |||
150 | @@ -XXX,XX +XXX,XX @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board) | ||
151 | } | ||
152 | } | 76 | } |
153 | 77 | - return do_frint_mode(s, a, float_round_ties_away, frint_fns[a->esz - 1]); | |
154 | - stellaris_sys_init(0x400fe000, qdev_get_gpio_in(nvic, 28), | 78 | + return do_frint_mode(s, a, float_round_ties_away, frint_fns[a->esz]); |
155 | - board, nd_table[0].macaddr.a); | 79 | } |
156 | + ssys_dev = stellaris_sys_init(0x400fe000, qdev_get_gpio_in(nvic, 28), | 80 | |
157 | + board, nd_table[0].macaddr.a); | 81 | static bool trans_FRECPX(DisasContext *s, arg_rpr_esz *a) |
158 | |||
159 | |||
160 | if (board->dc1 & (1 << 3)) { /* watchdog present */ | ||
161 | @@ -XXX,XX +XXX,XX @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board) | ||
162 | /* system_clock_scale is valid now */ | ||
163 | uint32_t mainclk = NANOSECONDS_PER_SECOND / system_clock_scale; | ||
164 | qdev_prop_set_uint32(dev, "wdogclk-frq", mainclk); | ||
165 | + qdev_connect_clock_in(dev, "WDOGCLK", | ||
166 | + qdev_get_clock_out(ssys_dev, "SYSCLK")); | ||
167 | |||
168 | sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); | ||
169 | sysbus_mmio_map(SYS_BUS_DEVICE(dev), | ||
170 | -- | 82 | -- |
171 | 2.20.1 | 83 | 2.25.1 |
172 | |||
173 | diff view generated by jsdifflib |
1 | From: Maxim Uvarov <maxim.uvarov@linaro.org> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Implement gpio-pwr driver to allow reboot and poweroff machine. | 3 | Rename the function to match other expansion function and |
4 | This is simple driver with just 2 gpios lines. Current use case | 4 | move to be adjacent. Split out gen_gvec_fpst_zzp as a |
5 | is to reboot and poweroff virt machine in secure mode. Secure | 5 | helper while we're at it. |
6 | pl066 gpio chip is needed for that. | ||
7 | 6 | ||
8 | Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org> | 7 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
9 | Reviewed-by: Hao Wu <wuhaotsh@google.com> | 8 | Message-id: 20220527181907.189259-94-richard.henderson@linaro.org |
10 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
12 | --- | 11 | --- |
13 | hw/gpio/gpio_pwr.c | 70 +++++++++++++++++++++++++++++++++++++++++++++ | 12 | target/arm/translate-sve.c | 392 ++++++++++++------------------------- |
14 | hw/gpio/Kconfig | 3 ++ | 13 | 1 file changed, 129 insertions(+), 263 deletions(-) |
15 | hw/gpio/meson.build | 1 + | ||
16 | 3 files changed, 74 insertions(+) | ||
17 | create mode 100644 hw/gpio/gpio_pwr.c | ||
18 | 14 | ||
19 | diff --git a/hw/gpio/gpio_pwr.c b/hw/gpio/gpio_pwr.c | 15 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c |
20 | new file mode 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
21 | index XXXXXXX..XXXXXXX | 17 | --- a/target/arm/translate-sve.c |
22 | --- /dev/null | 18 | +++ b/target/arm/translate-sve.c |
23 | +++ b/hw/gpio/gpio_pwr.c | 19 | @@ -XXX,XX +XXX,XX @@ static bool gen_gvec_ool_arg_zpzi(DisasContext *s, gen_helper_gvec_3 *fn, |
24 | @@ -XXX,XX +XXX,XX @@ | 20 | return gen_gvec_ool_zzp(s, fn, a->rd, a->rn, a->pg, a->imm); |
25 | +/* | 21 | } |
26 | + * GPIO qemu power controller | 22 | |
27 | + * | 23 | +static bool gen_gvec_fpst_zzp(DisasContext *s, gen_helper_gvec_3_ptr *fn, |
28 | + * Copyright (c) 2020 Linaro Limited | 24 | + int rd, int rn, int pg, int data, |
29 | + * | 25 | + ARMFPStatusFlavour flavour) |
30 | + * Author: Maxim Uvarov <maxim.uvarov@linaro.org> | 26 | +{ |
31 | + * | 27 | + if (fn == NULL) { |
32 | + * Virtual gpio driver which can be used on top of pl061 | 28 | + return false; |
33 | + * to reboot and shutdown qemu virtual machine. One of use | 29 | + } |
34 | + * case is gpio driver for secure world application (ARM | 30 | + if (sve_access_check(s)) { |
35 | + * Trusted Firmware.). | 31 | + unsigned vsz = vec_full_reg_size(s); |
36 | + * | 32 | + TCGv_ptr status = fpstatus_ptr(flavour); |
37 | + * This work is licensed under the terms of the GNU GPL, version 2 or later. | ||
38 | + * See the COPYING file in the top-level directory. | ||
39 | + * SPDX-License-Identifier: GPL-2.0-or-later | ||
40 | + */ | ||
41 | + | 33 | + |
42 | +/* | 34 | + tcg_gen_gvec_3_ptr(vec_full_reg_offset(s, rd), |
43 | + * QEMU interface: | 35 | + vec_full_reg_offset(s, rn), |
44 | + * two named input GPIO lines: | 36 | + pred_full_reg_offset(s, pg), |
45 | + * 'reset' : when asserted, trigger system reset | 37 | + status, vsz, vsz, data, fn); |
46 | + * 'shutdown' : when asserted, trigger system shutdown | 38 | + tcg_temp_free_ptr(status); |
47 | + */ | ||
48 | + | ||
49 | +#include "qemu/osdep.h" | ||
50 | +#include "hw/sysbus.h" | ||
51 | +#include "sysemu/runstate.h" | ||
52 | + | ||
53 | +#define TYPE_GPIOPWR "gpio-pwr" | ||
54 | +OBJECT_DECLARE_SIMPLE_TYPE(GPIO_PWR_State, GPIOPWR) | ||
55 | + | ||
56 | +struct GPIO_PWR_State { | ||
57 | + SysBusDevice parent_obj; | ||
58 | +}; | ||
59 | + | ||
60 | +static void gpio_pwr_reset(void *opaque, int n, int level) | ||
61 | +{ | ||
62 | + if (level) { | ||
63 | + qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET); | ||
64 | + } | 39 | + } |
40 | + return true; | ||
65 | +} | 41 | +} |
66 | + | 42 | + |
67 | +static void gpio_pwr_shutdown(void *opaque, int n, int level) | 43 | +static bool gen_gvec_fpst_arg_zpz(DisasContext *s, gen_helper_gvec_3_ptr *fn, |
44 | + arg_rpr_esz *a, int data, | ||
45 | + ARMFPStatusFlavour flavour) | ||
68 | +{ | 46 | +{ |
69 | + if (level) { | 47 | + return gen_gvec_fpst_zzp(s, fn, a->rd, a->rn, a->pg, data, flavour); |
70 | + qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_SHUTDOWN); | ||
71 | + } | ||
72 | +} | 48 | +} |
73 | + | 49 | + |
74 | +static void gpio_pwr_init(Object *obj) | 50 | /* Invoke an out-of-line helper on 3 Zregs and a predicate. */ |
75 | +{ | 51 | static bool gen_gvec_ool_zzzp(DisasContext *s, gen_helper_gvec_4 *fn, |
76 | + DeviceState *dev = DEVICE(obj); | 52 | int rd, int rn, int rm, int pg, int data) |
77 | + | 53 | @@ -XXX,XX +XXX,XX @@ static bool trans_FCMLA_zzxz(DisasContext *s, arg_FCMLA_zzxz *a) |
78 | + qdev_init_gpio_in_named(dev, gpio_pwr_reset, "reset", 1); | 54 | *** SVE Floating Point Unary Operations Predicated Group |
79 | + qdev_init_gpio_in_named(dev, gpio_pwr_shutdown, "shutdown", 1); | 55 | */ |
80 | +} | 56 | |
81 | + | 57 | -static bool do_zpz_ptr(DisasContext *s, int rd, int rn, int pg, |
82 | +static const TypeInfo gpio_pwr_info = { | 58 | - bool is_fp16, gen_helper_gvec_3_ptr *fn) |
83 | + .name = TYPE_GPIOPWR, | 59 | -{ |
84 | + .parent = TYPE_SYS_BUS_DEVICE, | 60 | - if (sve_access_check(s)) { |
85 | + .instance_size = sizeof(GPIO_PWR_State), | 61 | - unsigned vsz = vec_full_reg_size(s); |
86 | + .instance_init = gpio_pwr_init, | 62 | - TCGv_ptr status = fpstatus_ptr(is_fp16 ? FPST_FPCR_F16 : FPST_FPCR); |
63 | - tcg_gen_gvec_3_ptr(vec_full_reg_offset(s, rd), | ||
64 | - vec_full_reg_offset(s, rn), | ||
65 | - pred_full_reg_offset(s, pg), | ||
66 | - status, vsz, vsz, 0, fn); | ||
67 | - tcg_temp_free_ptr(status); | ||
68 | - } | ||
69 | - return true; | ||
70 | -} | ||
71 | +TRANS_FEAT(FCVT_sh, aa64_sve, gen_gvec_fpst_arg_zpz, | ||
72 | + gen_helper_sve_fcvt_sh, a, 0, FPST_FPCR) | ||
73 | +TRANS_FEAT(FCVT_hs, aa64_sve, gen_gvec_fpst_arg_zpz, | ||
74 | + gen_helper_sve_fcvt_hs, a, 0, FPST_FPCR) | ||
75 | |||
76 | -static bool trans_FCVT_sh(DisasContext *s, arg_rpr_esz *a) | ||
77 | -{ | ||
78 | - return do_zpz_ptr(s, a->rd, a->rn, a->pg, false, gen_helper_sve_fcvt_sh); | ||
79 | -} | ||
80 | +TRANS_FEAT(BFCVT, aa64_sve_bf16, gen_gvec_fpst_arg_zpz, | ||
81 | + gen_helper_sve_bfcvt, a, 0, FPST_FPCR) | ||
82 | |||
83 | -static bool trans_FCVT_hs(DisasContext *s, arg_rpr_esz *a) | ||
84 | -{ | ||
85 | - return do_zpz_ptr(s, a->rd, a->rn, a->pg, false, gen_helper_sve_fcvt_hs); | ||
86 | -} | ||
87 | +TRANS_FEAT(FCVT_dh, aa64_sve, gen_gvec_fpst_arg_zpz, | ||
88 | + gen_helper_sve_fcvt_dh, a, 0, FPST_FPCR) | ||
89 | +TRANS_FEAT(FCVT_hd, aa64_sve, gen_gvec_fpst_arg_zpz, | ||
90 | + gen_helper_sve_fcvt_hd, a, 0, FPST_FPCR) | ||
91 | +TRANS_FEAT(FCVT_ds, aa64_sve, gen_gvec_fpst_arg_zpz, | ||
92 | + gen_helper_sve_fcvt_ds, a, 0, FPST_FPCR) | ||
93 | +TRANS_FEAT(FCVT_sd, aa64_sve, gen_gvec_fpst_arg_zpz, | ||
94 | + gen_helper_sve_fcvt_sd, a, 0, FPST_FPCR) | ||
95 | |||
96 | -static bool trans_BFCVT(DisasContext *s, arg_rpr_esz *a) | ||
97 | -{ | ||
98 | - if (!dc_isar_feature(aa64_sve_bf16, s)) { | ||
99 | - return false; | ||
100 | - } | ||
101 | - return do_zpz_ptr(s, a->rd, a->rn, a->pg, false, gen_helper_sve_bfcvt); | ||
102 | -} | ||
103 | +TRANS_FEAT(FCVTZS_hh, aa64_sve, gen_gvec_fpst_arg_zpz, | ||
104 | + gen_helper_sve_fcvtzs_hh, a, 0, FPST_FPCR_F16) | ||
105 | +TRANS_FEAT(FCVTZU_hh, aa64_sve, gen_gvec_fpst_arg_zpz, | ||
106 | + gen_helper_sve_fcvtzu_hh, a, 0, FPST_FPCR_F16) | ||
107 | +TRANS_FEAT(FCVTZS_hs, aa64_sve, gen_gvec_fpst_arg_zpz, | ||
108 | + gen_helper_sve_fcvtzs_hs, a, 0, FPST_FPCR_F16) | ||
109 | +TRANS_FEAT(FCVTZU_hs, aa64_sve, gen_gvec_fpst_arg_zpz, | ||
110 | + gen_helper_sve_fcvtzu_hs, a, 0, FPST_FPCR_F16) | ||
111 | +TRANS_FEAT(FCVTZS_hd, aa64_sve, gen_gvec_fpst_arg_zpz, | ||
112 | + gen_helper_sve_fcvtzs_hd, a, 0, FPST_FPCR_F16) | ||
113 | +TRANS_FEAT(FCVTZU_hd, aa64_sve, gen_gvec_fpst_arg_zpz, | ||
114 | + gen_helper_sve_fcvtzu_hd, a, 0, FPST_FPCR_F16) | ||
115 | |||
116 | -static bool trans_FCVT_dh(DisasContext *s, arg_rpr_esz *a) | ||
117 | -{ | ||
118 | - return do_zpz_ptr(s, a->rd, a->rn, a->pg, false, gen_helper_sve_fcvt_dh); | ||
119 | -} | ||
120 | +TRANS_FEAT(FCVTZS_ss, aa64_sve, gen_gvec_fpst_arg_zpz, | ||
121 | + gen_helper_sve_fcvtzs_ss, a, 0, FPST_FPCR) | ||
122 | +TRANS_FEAT(FCVTZU_ss, aa64_sve, gen_gvec_fpst_arg_zpz, | ||
123 | + gen_helper_sve_fcvtzu_ss, a, 0, FPST_FPCR) | ||
124 | +TRANS_FEAT(FCVTZS_sd, aa64_sve, gen_gvec_fpst_arg_zpz, | ||
125 | + gen_helper_sve_fcvtzs_sd, a, 0, FPST_FPCR) | ||
126 | +TRANS_FEAT(FCVTZU_sd, aa64_sve, gen_gvec_fpst_arg_zpz, | ||
127 | + gen_helper_sve_fcvtzu_sd, a, 0, FPST_FPCR) | ||
128 | +TRANS_FEAT(FCVTZS_ds, aa64_sve, gen_gvec_fpst_arg_zpz, | ||
129 | + gen_helper_sve_fcvtzs_ds, a, 0, FPST_FPCR) | ||
130 | +TRANS_FEAT(FCVTZU_ds, aa64_sve, gen_gvec_fpst_arg_zpz, | ||
131 | + gen_helper_sve_fcvtzu_ds, a, 0, FPST_FPCR) | ||
132 | |||
133 | -static bool trans_FCVT_hd(DisasContext *s, arg_rpr_esz *a) | ||
134 | -{ | ||
135 | - return do_zpz_ptr(s, a->rd, a->rn, a->pg, false, gen_helper_sve_fcvt_hd); | ||
136 | -} | ||
137 | - | ||
138 | -static bool trans_FCVT_ds(DisasContext *s, arg_rpr_esz *a) | ||
139 | -{ | ||
140 | - return do_zpz_ptr(s, a->rd, a->rn, a->pg, false, gen_helper_sve_fcvt_ds); | ||
141 | -} | ||
142 | - | ||
143 | -static bool trans_FCVT_sd(DisasContext *s, arg_rpr_esz *a) | ||
144 | -{ | ||
145 | - return do_zpz_ptr(s, a->rd, a->rn, a->pg, false, gen_helper_sve_fcvt_sd); | ||
146 | -} | ||
147 | - | ||
148 | -static bool trans_FCVTZS_hh(DisasContext *s, arg_rpr_esz *a) | ||
149 | -{ | ||
150 | - return do_zpz_ptr(s, a->rd, a->rn, a->pg, true, gen_helper_sve_fcvtzs_hh); | ||
151 | -} | ||
152 | - | ||
153 | -static bool trans_FCVTZU_hh(DisasContext *s, arg_rpr_esz *a) | ||
154 | -{ | ||
155 | - return do_zpz_ptr(s, a->rd, a->rn, a->pg, true, gen_helper_sve_fcvtzu_hh); | ||
156 | -} | ||
157 | - | ||
158 | -static bool trans_FCVTZS_hs(DisasContext *s, arg_rpr_esz *a) | ||
159 | -{ | ||
160 | - return do_zpz_ptr(s, a->rd, a->rn, a->pg, true, gen_helper_sve_fcvtzs_hs); | ||
161 | -} | ||
162 | - | ||
163 | -static bool trans_FCVTZU_hs(DisasContext *s, arg_rpr_esz *a) | ||
164 | -{ | ||
165 | - return do_zpz_ptr(s, a->rd, a->rn, a->pg, true, gen_helper_sve_fcvtzu_hs); | ||
166 | -} | ||
167 | - | ||
168 | -static bool trans_FCVTZS_hd(DisasContext *s, arg_rpr_esz *a) | ||
169 | -{ | ||
170 | - return do_zpz_ptr(s, a->rd, a->rn, a->pg, true, gen_helper_sve_fcvtzs_hd); | ||
171 | -} | ||
172 | - | ||
173 | -static bool trans_FCVTZU_hd(DisasContext *s, arg_rpr_esz *a) | ||
174 | -{ | ||
175 | - return do_zpz_ptr(s, a->rd, a->rn, a->pg, true, gen_helper_sve_fcvtzu_hd); | ||
176 | -} | ||
177 | - | ||
178 | -static bool trans_FCVTZS_ss(DisasContext *s, arg_rpr_esz *a) | ||
179 | -{ | ||
180 | - return do_zpz_ptr(s, a->rd, a->rn, a->pg, false, gen_helper_sve_fcvtzs_ss); | ||
181 | -} | ||
182 | - | ||
183 | -static bool trans_FCVTZU_ss(DisasContext *s, arg_rpr_esz *a) | ||
184 | -{ | ||
185 | - return do_zpz_ptr(s, a->rd, a->rn, a->pg, false, gen_helper_sve_fcvtzu_ss); | ||
186 | -} | ||
187 | - | ||
188 | -static bool trans_FCVTZS_sd(DisasContext *s, arg_rpr_esz *a) | ||
189 | -{ | ||
190 | - return do_zpz_ptr(s, a->rd, a->rn, a->pg, false, gen_helper_sve_fcvtzs_sd); | ||
191 | -} | ||
192 | - | ||
193 | -static bool trans_FCVTZU_sd(DisasContext *s, arg_rpr_esz *a) | ||
194 | -{ | ||
195 | - return do_zpz_ptr(s, a->rd, a->rn, a->pg, false, gen_helper_sve_fcvtzu_sd); | ||
196 | -} | ||
197 | - | ||
198 | -static bool trans_FCVTZS_ds(DisasContext *s, arg_rpr_esz *a) | ||
199 | -{ | ||
200 | - return do_zpz_ptr(s, a->rd, a->rn, a->pg, false, gen_helper_sve_fcvtzs_ds); | ||
201 | -} | ||
202 | - | ||
203 | -static bool trans_FCVTZU_ds(DisasContext *s, arg_rpr_esz *a) | ||
204 | -{ | ||
205 | - return do_zpz_ptr(s, a->rd, a->rn, a->pg, false, gen_helper_sve_fcvtzu_ds); | ||
206 | -} | ||
207 | - | ||
208 | -static bool trans_FCVTZS_dd(DisasContext *s, arg_rpr_esz *a) | ||
209 | -{ | ||
210 | - return do_zpz_ptr(s, a->rd, a->rn, a->pg, false, gen_helper_sve_fcvtzs_dd); | ||
211 | -} | ||
212 | - | ||
213 | -static bool trans_FCVTZU_dd(DisasContext *s, arg_rpr_esz *a) | ||
214 | -{ | ||
215 | - return do_zpz_ptr(s, a->rd, a->rn, a->pg, false, gen_helper_sve_fcvtzu_dd); | ||
216 | -} | ||
217 | +TRANS_FEAT(FCVTZS_dd, aa64_sve, gen_gvec_fpst_arg_zpz, | ||
218 | + gen_helper_sve_fcvtzs_dd, a, 0, FPST_FPCR) | ||
219 | +TRANS_FEAT(FCVTZU_dd, aa64_sve, gen_gvec_fpst_arg_zpz, | ||
220 | + gen_helper_sve_fcvtzu_dd, a, 0, FPST_FPCR) | ||
221 | |||
222 | static gen_helper_gvec_3_ptr * const frint_fns[] = { | ||
223 | NULL, | ||
224 | @@ -XXX,XX +XXX,XX @@ static gen_helper_gvec_3_ptr * const frint_fns[] = { | ||
225 | gen_helper_sve_frint_s, | ||
226 | gen_helper_sve_frint_d | ||
227 | }; | ||
228 | +TRANS_FEAT(FRINTI, aa64_sve, gen_gvec_fpst_arg_zpz, frint_fns[a->esz], | ||
229 | + a, 0, a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR) | ||
230 | |||
231 | -static bool trans_FRINTI(DisasContext *s, arg_rpr_esz *a) | ||
232 | -{ | ||
233 | - if (a->esz == 0) { | ||
234 | - return false; | ||
235 | - } | ||
236 | - return do_zpz_ptr(s, a->rd, a->rn, a->pg, a->esz == MO_16, | ||
237 | - frint_fns[a->esz]); | ||
238 | -} | ||
239 | - | ||
240 | -static bool trans_FRINTX(DisasContext *s, arg_rpr_esz *a) | ||
241 | -{ | ||
242 | - static gen_helper_gvec_3_ptr * const fns[3] = { | ||
243 | - gen_helper_sve_frintx_h, | ||
244 | - gen_helper_sve_frintx_s, | ||
245 | - gen_helper_sve_frintx_d | ||
246 | - }; | ||
247 | - if (a->esz == 0) { | ||
248 | - return false; | ||
249 | - } | ||
250 | - return do_zpz_ptr(s, a->rd, a->rn, a->pg, a->esz == MO_16, fns[a->esz - 1]); | ||
251 | -} | ||
252 | +static gen_helper_gvec_3_ptr * const frintx_fns[] = { | ||
253 | + NULL, | ||
254 | + gen_helper_sve_frintx_h, | ||
255 | + gen_helper_sve_frintx_s, | ||
256 | + gen_helper_sve_frintx_d | ||
87 | +}; | 257 | +}; |
88 | + | 258 | +TRANS_FEAT(FRINTX, aa64_sve, gen_gvec_fpst_arg_zpz, frintx_fns[a->esz], |
89 | +static void gpio_pwr_register_types(void) | 259 | + a, 0, a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR); |
90 | +{ | 260 | |
91 | + type_register_static(&gpio_pwr_info); | 261 | static bool do_frint_mode(DisasContext *s, arg_rpr_esz *a, |
92 | +} | 262 | int mode, gen_helper_gvec_3_ptr *fn) |
93 | + | 263 | @@ -XXX,XX +XXX,XX @@ static bool trans_FRINTA(DisasContext *s, arg_rpr_esz *a) |
94 | +type_init(gpio_pwr_register_types) | 264 | return do_frint_mode(s, a, float_round_ties_away, frint_fns[a->esz]); |
95 | diff --git a/hw/gpio/Kconfig b/hw/gpio/Kconfig | 265 | } |
96 | index XXXXXXX..XXXXXXX 100644 | 266 | |
97 | --- a/hw/gpio/Kconfig | 267 | -static bool trans_FRECPX(DisasContext *s, arg_rpr_esz *a) |
98 | +++ b/hw/gpio/Kconfig | 268 | -{ |
99 | @@ -XXX,XX +XXX,XX @@ config PL061 | 269 | - static gen_helper_gvec_3_ptr * const fns[3] = { |
100 | config GPIO_KEY | 270 | - gen_helper_sve_frecpx_h, |
101 | bool | 271 | - gen_helper_sve_frecpx_s, |
102 | 272 | - gen_helper_sve_frecpx_d | |
103 | +config GPIO_PWR | 273 | - }; |
104 | + bool | 274 | - if (a->esz == 0) { |
105 | + | 275 | - return false; |
106 | config SIFIVE_GPIO | 276 | - } |
107 | bool | 277 | - return do_zpz_ptr(s, a->rd, a->rn, a->pg, a->esz == MO_16, fns[a->esz - 1]); |
108 | diff --git a/hw/gpio/meson.build b/hw/gpio/meson.build | 278 | -} |
109 | index XXXXXXX..XXXXXXX 100644 | 279 | +static gen_helper_gvec_3_ptr * const frecpx_fns[] = { |
110 | --- a/hw/gpio/meson.build | 280 | + NULL, gen_helper_sve_frecpx_h, |
111 | +++ b/hw/gpio/meson.build | 281 | + gen_helper_sve_frecpx_s, gen_helper_sve_frecpx_d, |
112 | @@ -XXX,XX +XXX,XX @@ | 282 | +}; |
113 | softmmu_ss.add(when: 'CONFIG_E500', if_true: files('mpc8xxx.c')) | 283 | +TRANS_FEAT(FRECPX, aa64_sve, gen_gvec_fpst_arg_zpz, frecpx_fns[a->esz], |
114 | softmmu_ss.add(when: 'CONFIG_GPIO_KEY', if_true: files('gpio_key.c')) | 284 | + a, 0, a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR) |
115 | +softmmu_ss.add(when: 'CONFIG_GPIO_PWR', if_true: files('gpio_pwr.c')) | 285 | |
116 | softmmu_ss.add(when: 'CONFIG_MAX7310', if_true: files('max7310.c')) | 286 | -static bool trans_FSQRT(DisasContext *s, arg_rpr_esz *a) |
117 | softmmu_ss.add(when: 'CONFIG_PL061', if_true: files('pl061.c')) | 287 | -{ |
118 | softmmu_ss.add(when: 'CONFIG_PUV3', if_true: files('puv3_gpio.c')) | 288 | - static gen_helper_gvec_3_ptr * const fns[3] = { |
289 | - gen_helper_sve_fsqrt_h, | ||
290 | - gen_helper_sve_fsqrt_s, | ||
291 | - gen_helper_sve_fsqrt_d | ||
292 | - }; | ||
293 | - if (a->esz == 0) { | ||
294 | - return false; | ||
295 | - } | ||
296 | - return do_zpz_ptr(s, a->rd, a->rn, a->pg, a->esz == MO_16, fns[a->esz - 1]); | ||
297 | -} | ||
298 | +static gen_helper_gvec_3_ptr * const fsqrt_fns[] = { | ||
299 | + NULL, gen_helper_sve_fsqrt_h, | ||
300 | + gen_helper_sve_fsqrt_s, gen_helper_sve_fsqrt_d, | ||
301 | +}; | ||
302 | +TRANS_FEAT(FSQRT, aa64_sve, gen_gvec_fpst_arg_zpz, fsqrt_fns[a->esz], | ||
303 | + a, 0, a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR) | ||
304 | |||
305 | -static bool trans_SCVTF_hh(DisasContext *s, arg_rpr_esz *a) | ||
306 | -{ | ||
307 | - return do_zpz_ptr(s, a->rd, a->rn, a->pg, true, gen_helper_sve_scvt_hh); | ||
308 | -} | ||
309 | +TRANS_FEAT(SCVTF_hh, aa64_sve, gen_gvec_fpst_arg_zpz, | ||
310 | + gen_helper_sve_scvt_hh, a, 0, FPST_FPCR_F16) | ||
311 | +TRANS_FEAT(SCVTF_sh, aa64_sve, gen_gvec_fpst_arg_zpz, | ||
312 | + gen_helper_sve_scvt_sh, a, 0, FPST_FPCR_F16) | ||
313 | +TRANS_FEAT(SCVTF_dh, aa64_sve, gen_gvec_fpst_arg_zpz, | ||
314 | + gen_helper_sve_scvt_dh, a, 0, FPST_FPCR_F16) | ||
315 | |||
316 | -static bool trans_SCVTF_sh(DisasContext *s, arg_rpr_esz *a) | ||
317 | -{ | ||
318 | - return do_zpz_ptr(s, a->rd, a->rn, a->pg, true, gen_helper_sve_scvt_sh); | ||
319 | -} | ||
320 | +TRANS_FEAT(SCVTF_ss, aa64_sve, gen_gvec_fpst_arg_zpz, | ||
321 | + gen_helper_sve_scvt_ss, a, 0, FPST_FPCR) | ||
322 | +TRANS_FEAT(SCVTF_ds, aa64_sve, gen_gvec_fpst_arg_zpz, | ||
323 | + gen_helper_sve_scvt_ds, a, 0, FPST_FPCR) | ||
324 | |||
325 | -static bool trans_SCVTF_dh(DisasContext *s, arg_rpr_esz *a) | ||
326 | -{ | ||
327 | - return do_zpz_ptr(s, a->rd, a->rn, a->pg, true, gen_helper_sve_scvt_dh); | ||
328 | -} | ||
329 | +TRANS_FEAT(SCVTF_sd, aa64_sve, gen_gvec_fpst_arg_zpz, | ||
330 | + gen_helper_sve_scvt_sd, a, 0, FPST_FPCR) | ||
331 | +TRANS_FEAT(SCVTF_dd, aa64_sve, gen_gvec_fpst_arg_zpz, | ||
332 | + gen_helper_sve_scvt_dd, a, 0, FPST_FPCR) | ||
333 | |||
334 | -static bool trans_SCVTF_ss(DisasContext *s, arg_rpr_esz *a) | ||
335 | -{ | ||
336 | - return do_zpz_ptr(s, a->rd, a->rn, a->pg, false, gen_helper_sve_scvt_ss); | ||
337 | -} | ||
338 | +TRANS_FEAT(UCVTF_hh, aa64_sve, gen_gvec_fpst_arg_zpz, | ||
339 | + gen_helper_sve_ucvt_hh, a, 0, FPST_FPCR_F16) | ||
340 | +TRANS_FEAT(UCVTF_sh, aa64_sve, gen_gvec_fpst_arg_zpz, | ||
341 | + gen_helper_sve_ucvt_sh, a, 0, FPST_FPCR_F16) | ||
342 | +TRANS_FEAT(UCVTF_dh, aa64_sve, gen_gvec_fpst_arg_zpz, | ||
343 | + gen_helper_sve_ucvt_dh, a, 0, FPST_FPCR_F16) | ||
344 | |||
345 | -static bool trans_SCVTF_ds(DisasContext *s, arg_rpr_esz *a) | ||
346 | -{ | ||
347 | - return do_zpz_ptr(s, a->rd, a->rn, a->pg, false, gen_helper_sve_scvt_ds); | ||
348 | -} | ||
349 | +TRANS_FEAT(UCVTF_ss, aa64_sve, gen_gvec_fpst_arg_zpz, | ||
350 | + gen_helper_sve_ucvt_ss, a, 0, FPST_FPCR) | ||
351 | +TRANS_FEAT(UCVTF_ds, aa64_sve, gen_gvec_fpst_arg_zpz, | ||
352 | + gen_helper_sve_ucvt_ds, a, 0, FPST_FPCR) | ||
353 | +TRANS_FEAT(UCVTF_sd, aa64_sve, gen_gvec_fpst_arg_zpz, | ||
354 | + gen_helper_sve_ucvt_sd, a, 0, FPST_FPCR) | ||
355 | |||
356 | -static bool trans_SCVTF_sd(DisasContext *s, arg_rpr_esz *a) | ||
357 | -{ | ||
358 | - return do_zpz_ptr(s, a->rd, a->rn, a->pg, false, gen_helper_sve_scvt_sd); | ||
359 | -} | ||
360 | - | ||
361 | -static bool trans_SCVTF_dd(DisasContext *s, arg_rpr_esz *a) | ||
362 | -{ | ||
363 | - return do_zpz_ptr(s, a->rd, a->rn, a->pg, false, gen_helper_sve_scvt_dd); | ||
364 | -} | ||
365 | - | ||
366 | -static bool trans_UCVTF_hh(DisasContext *s, arg_rpr_esz *a) | ||
367 | -{ | ||
368 | - return do_zpz_ptr(s, a->rd, a->rn, a->pg, true, gen_helper_sve_ucvt_hh); | ||
369 | -} | ||
370 | - | ||
371 | -static bool trans_UCVTF_sh(DisasContext *s, arg_rpr_esz *a) | ||
372 | -{ | ||
373 | - return do_zpz_ptr(s, a->rd, a->rn, a->pg, true, gen_helper_sve_ucvt_sh); | ||
374 | -} | ||
375 | - | ||
376 | -static bool trans_UCVTF_dh(DisasContext *s, arg_rpr_esz *a) | ||
377 | -{ | ||
378 | - return do_zpz_ptr(s, a->rd, a->rn, a->pg, true, gen_helper_sve_ucvt_dh); | ||
379 | -} | ||
380 | - | ||
381 | -static bool trans_UCVTF_ss(DisasContext *s, arg_rpr_esz *a) | ||
382 | -{ | ||
383 | - return do_zpz_ptr(s, a->rd, a->rn, a->pg, false, gen_helper_sve_ucvt_ss); | ||
384 | -} | ||
385 | - | ||
386 | -static bool trans_UCVTF_ds(DisasContext *s, arg_rpr_esz *a) | ||
387 | -{ | ||
388 | - return do_zpz_ptr(s, a->rd, a->rn, a->pg, false, gen_helper_sve_ucvt_ds); | ||
389 | -} | ||
390 | - | ||
391 | -static bool trans_UCVTF_sd(DisasContext *s, arg_rpr_esz *a) | ||
392 | -{ | ||
393 | - return do_zpz_ptr(s, a->rd, a->rn, a->pg, false, gen_helper_sve_ucvt_sd); | ||
394 | -} | ||
395 | - | ||
396 | -static bool trans_UCVTF_dd(DisasContext *s, arg_rpr_esz *a) | ||
397 | -{ | ||
398 | - return do_zpz_ptr(s, a->rd, a->rn, a->pg, false, gen_helper_sve_ucvt_dd); | ||
399 | -} | ||
400 | +TRANS_FEAT(UCVTF_dd, aa64_sve, gen_gvec_fpst_arg_zpz, | ||
401 | + gen_helper_sve_ucvt_dd, a, 0, FPST_FPCR) | ||
402 | |||
403 | /* | ||
404 | *** SVE Memory - 32-bit Gather and Unsized Contiguous Group | ||
405 | @@ -XXX,XX +XXX,XX @@ TRANS_FEAT(SM4EKEY, aa64_sve2_sm4, gen_gvec_ool_arg_zzz, | ||
406 | |||
407 | TRANS_FEAT(RAX1, aa64_sve2_sha3, gen_gvec_fn_arg_zzz, gen_gvec_rax1, a) | ||
408 | |||
409 | -static bool trans_FCVTNT_sh(DisasContext *s, arg_rpr_esz *a) | ||
410 | -{ | ||
411 | - if (!dc_isar_feature(aa64_sve2, s)) { | ||
412 | - return false; | ||
413 | - } | ||
414 | - return do_zpz_ptr(s, a->rd, a->rn, a->pg, false, gen_helper_sve2_fcvtnt_sh); | ||
415 | -} | ||
416 | +TRANS_FEAT(FCVTNT_sh, aa64_sve2, gen_gvec_fpst_arg_zpz, | ||
417 | + gen_helper_sve2_fcvtnt_sh, a, 0, FPST_FPCR) | ||
418 | +TRANS_FEAT(FCVTNT_ds, aa64_sve2, gen_gvec_fpst_arg_zpz, | ||
419 | + gen_helper_sve2_fcvtnt_ds, a, 0, FPST_FPCR) | ||
420 | |||
421 | -static bool trans_BFCVTNT(DisasContext *s, arg_rpr_esz *a) | ||
422 | -{ | ||
423 | - if (!dc_isar_feature(aa64_sve_bf16, s)) { | ||
424 | - return false; | ||
425 | - } | ||
426 | - return do_zpz_ptr(s, a->rd, a->rn, a->pg, false, gen_helper_sve_bfcvtnt); | ||
427 | -} | ||
428 | +TRANS_FEAT(BFCVTNT, aa64_sve_bf16, gen_gvec_fpst_arg_zpz, | ||
429 | + gen_helper_sve_bfcvtnt, a, 0, FPST_FPCR) | ||
430 | |||
431 | -static bool trans_FCVTNT_ds(DisasContext *s, arg_rpr_esz *a) | ||
432 | -{ | ||
433 | - if (!dc_isar_feature(aa64_sve2, s)) { | ||
434 | - return false; | ||
435 | - } | ||
436 | - return do_zpz_ptr(s, a->rd, a->rn, a->pg, false, gen_helper_sve2_fcvtnt_ds); | ||
437 | -} | ||
438 | - | ||
439 | -static bool trans_FCVTLT_hs(DisasContext *s, arg_rpr_esz *a) | ||
440 | -{ | ||
441 | - if (!dc_isar_feature(aa64_sve2, s)) { | ||
442 | - return false; | ||
443 | - } | ||
444 | - return do_zpz_ptr(s, a->rd, a->rn, a->pg, false, gen_helper_sve2_fcvtlt_hs); | ||
445 | -} | ||
446 | - | ||
447 | -static bool trans_FCVTLT_sd(DisasContext *s, arg_rpr_esz *a) | ||
448 | -{ | ||
449 | - if (!dc_isar_feature(aa64_sve2, s)) { | ||
450 | - return false; | ||
451 | - } | ||
452 | - return do_zpz_ptr(s, a->rd, a->rn, a->pg, false, gen_helper_sve2_fcvtlt_sd); | ||
453 | -} | ||
454 | +TRANS_FEAT(FCVTLT_hs, aa64_sve2, gen_gvec_fpst_arg_zpz, | ||
455 | + gen_helper_sve2_fcvtlt_hs, a, 0, FPST_FPCR) | ||
456 | +TRANS_FEAT(FCVTLT_sd, aa64_sve2, gen_gvec_fpst_arg_zpz, | ||
457 | + gen_helper_sve2_fcvtlt_sd, a, 0, FPST_FPCR) | ||
458 | |||
459 | static bool trans_FCVTX_ds(DisasContext *s, arg_rpr_esz *a) | ||
460 | { | ||
119 | -- | 461 | -- |
120 | 2.20.1 | 462 | 2.25.1 |
121 | |||
122 | diff view generated by jsdifflib |
1 | Switch the CMSDK APB dualtimer device over to using its Clock input; | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | the pclk-frq property is now ignored. | ||
3 | 2 | ||
3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
4 | Message-id: 20220527181907.189259-95-richard.henderson@linaro.org | ||
5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
4 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
5 | Reviewed-by: Luc Michel <luc@lmichel.fr> | ||
6 | Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
7 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
8 | Message-id: 20210128114145.20536-20-peter.maydell@linaro.org | ||
9 | Message-id: 20210121190622.22000-20-peter.maydell@linaro.org | ||
10 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
11 | --- | 7 | --- |
12 | hw/timer/cmsdk-apb-dualtimer.c | 42 ++++++++++++++++++++++++++++++---- | 8 | target/arm/translate-sve.c | 52 +++++++++++++++++--------------------- |
13 | 1 file changed, 37 insertions(+), 5 deletions(-) | 9 | 1 file changed, 23 insertions(+), 29 deletions(-) |
14 | 10 | ||
15 | diff --git a/hw/timer/cmsdk-apb-dualtimer.c b/hw/timer/cmsdk-apb-dualtimer.c | 11 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c |
16 | index XXXXXXX..XXXXXXX 100644 | 12 | index XXXXXXX..XXXXXXX 100644 |
17 | --- a/hw/timer/cmsdk-apb-dualtimer.c | 13 | --- a/target/arm/translate-sve.c |
18 | +++ b/hw/timer/cmsdk-apb-dualtimer.c | 14 | +++ b/target/arm/translate-sve.c |
19 | @@ -XXX,XX +XXX,XX @@ static void cmsdk_apb_dualtimer_update(CMSDKAPBDualTimer *s) | 15 | @@ -XXX,XX +XXX,XX @@ TRANS_FEAT(FRINTX, aa64_sve, gen_gvec_fpst_arg_zpz, frintx_fns[a->esz], |
20 | qemu_set_irq(s->timerintc, timintc); | 16 | static bool do_frint_mode(DisasContext *s, arg_rpr_esz *a, |
17 | int mode, gen_helper_gvec_3_ptr *fn) | ||
18 | { | ||
19 | - if (sve_access_check(s)) { | ||
20 | - unsigned vsz = vec_full_reg_size(s); | ||
21 | - TCGv_i32 tmode = tcg_const_i32(mode); | ||
22 | - TCGv_ptr status = fpstatus_ptr(a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR); | ||
23 | + unsigned vsz; | ||
24 | + TCGv_i32 tmode; | ||
25 | + TCGv_ptr status; | ||
26 | |||
27 | - gen_helper_set_rmode(tmode, tmode, status); | ||
28 | - | ||
29 | - tcg_gen_gvec_3_ptr(vec_full_reg_offset(s, a->rd), | ||
30 | - vec_full_reg_offset(s, a->rn), | ||
31 | - pred_full_reg_offset(s, a->pg), | ||
32 | - status, vsz, vsz, 0, fn); | ||
33 | - | ||
34 | - gen_helper_set_rmode(tmode, tmode, status); | ||
35 | - tcg_temp_free_i32(tmode); | ||
36 | - tcg_temp_free_ptr(status); | ||
37 | + if (fn == NULL) { | ||
38 | + return false; | ||
39 | } | ||
40 | + if (!sve_access_check(s)) { | ||
41 | + return true; | ||
42 | + } | ||
43 | + | ||
44 | + vsz = vec_full_reg_size(s); | ||
45 | + tmode = tcg_const_i32(mode); | ||
46 | + status = fpstatus_ptr(a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR); | ||
47 | + | ||
48 | + gen_helper_set_rmode(tmode, tmode, status); | ||
49 | + | ||
50 | + tcg_gen_gvec_3_ptr(vec_full_reg_offset(s, a->rd), | ||
51 | + vec_full_reg_offset(s, a->rn), | ||
52 | + pred_full_reg_offset(s, a->pg), | ||
53 | + status, vsz, vsz, 0, fn); | ||
54 | + | ||
55 | + gen_helper_set_rmode(tmode, tmode, status); | ||
56 | + tcg_temp_free_i32(tmode); | ||
57 | + tcg_temp_free_ptr(status); | ||
58 | return true; | ||
21 | } | 59 | } |
22 | 60 | ||
23 | +static int cmsdk_dualtimermod_divisor(CMSDKAPBDualTimerModule *m) | 61 | static bool trans_FRINTN(DisasContext *s, arg_rpr_esz *a) |
24 | +{ | ||
25 | + /* Return the divisor set by the current CONTROL.PRESCALE value */ | ||
26 | + switch (FIELD_EX32(m->control, CONTROL, PRESCALE)) { | ||
27 | + case 0: | ||
28 | + return 1; | ||
29 | + case 1: | ||
30 | + return 16; | ||
31 | + case 2: | ||
32 | + case 3: /* UNDEFINED, we treat like 2 (and complained when it was set) */ | ||
33 | + return 256; | ||
34 | + default: | ||
35 | + g_assert_not_reached(); | ||
36 | + } | ||
37 | +} | ||
38 | + | ||
39 | static void cmsdk_dualtimermod_write_control(CMSDKAPBDualTimerModule *m, | ||
40 | uint32_t newctrl) | ||
41 | { | 62 | { |
42 | @@ -XXX,XX +XXX,XX @@ static void cmsdk_dualtimermod_write_control(CMSDKAPBDualTimerModule *m, | 63 | - if (a->esz == 0) { |
43 | default: | 64 | - return false; |
44 | g_assert_not_reached(); | 65 | - } |
45 | } | 66 | return do_frint_mode(s, a, float_round_nearest_even, frint_fns[a->esz]); |
46 | - ptimer_set_freq(m->timer, m->parent->pclk_frq / divisor); | ||
47 | + ptimer_set_period_from_clock(m->timer, m->parent->timclk, divisor); | ||
48 | } | ||
49 | |||
50 | if (changed & R_CONTROL_MODE_MASK) { | ||
51 | @@ -XXX,XX +XXX,XX @@ static void cmsdk_dualtimermod_reset(CMSDKAPBDualTimerModule *m) | ||
52 | * limit must both be set to 0xffff, so we wrap at 16 bits. | ||
53 | */ | ||
54 | ptimer_set_limit(m->timer, 0xffff, 1); | ||
55 | - ptimer_set_freq(m->timer, m->parent->pclk_frq); | ||
56 | + ptimer_set_period_from_clock(m->timer, m->parent->timclk, | ||
57 | + cmsdk_dualtimermod_divisor(m)); | ||
58 | ptimer_transaction_commit(m->timer); | ||
59 | } | 67 | } |
60 | 68 | ||
61 | @@ -XXX,XX +XXX,XX @@ static void cmsdk_apb_dualtimer_reset(DeviceState *dev) | 69 | static bool trans_FRINTP(DisasContext *s, arg_rpr_esz *a) |
62 | s->timeritop = 0; | 70 | { |
71 | - if (a->esz == 0) { | ||
72 | - return false; | ||
73 | - } | ||
74 | return do_frint_mode(s, a, float_round_up, frint_fns[a->esz]); | ||
63 | } | 75 | } |
64 | 76 | ||
65 | +static void cmsdk_apb_dualtimer_clk_update(void *opaque) | 77 | static bool trans_FRINTM(DisasContext *s, arg_rpr_esz *a) |
66 | +{ | ||
67 | + CMSDKAPBDualTimer *s = CMSDK_APB_DUALTIMER(opaque); | ||
68 | + int i; | ||
69 | + | ||
70 | + for (i = 0; i < ARRAY_SIZE(s->timermod); i++) { | ||
71 | + CMSDKAPBDualTimerModule *m = &s->timermod[i]; | ||
72 | + ptimer_transaction_begin(m->timer); | ||
73 | + ptimer_set_period_from_clock(m->timer, m->parent->timclk, | ||
74 | + cmsdk_dualtimermod_divisor(m)); | ||
75 | + ptimer_transaction_commit(m->timer); | ||
76 | + } | ||
77 | +} | ||
78 | + | ||
79 | static void cmsdk_apb_dualtimer_init(Object *obj) | ||
80 | { | 78 | { |
81 | SysBusDevice *sbd = SYS_BUS_DEVICE(obj); | 79 | - if (a->esz == 0) { |
82 | @@ -XXX,XX +XXX,XX @@ static void cmsdk_apb_dualtimer_init(Object *obj) | 80 | - return false; |
83 | for (i = 0; i < ARRAY_SIZE(s->timermod); i++) { | 81 | - } |
84 | sysbus_init_irq(sbd, &s->timermod[i].timerint); | 82 | return do_frint_mode(s, a, float_round_down, frint_fns[a->esz]); |
85 | } | ||
86 | - s->timclk = qdev_init_clock_in(DEVICE(s), "TIMCLK", NULL, NULL); | ||
87 | + s->timclk = qdev_init_clock_in(DEVICE(s), "TIMCLK", | ||
88 | + cmsdk_apb_dualtimer_clk_update, s); | ||
89 | } | 83 | } |
90 | 84 | ||
91 | static void cmsdk_apb_dualtimer_realize(DeviceState *dev, Error **errp) | 85 | static bool trans_FRINTZ(DisasContext *s, arg_rpr_esz *a) |
92 | @@ -XXX,XX +XXX,XX @@ static void cmsdk_apb_dualtimer_realize(DeviceState *dev, Error **errp) | 86 | { |
93 | CMSDKAPBDualTimer *s = CMSDK_APB_DUALTIMER(dev); | 87 | - if (a->esz == 0) { |
94 | int i; | 88 | - return false; |
95 | 89 | - } | |
96 | - if (s->pclk_frq == 0) { | 90 | return do_frint_mode(s, a, float_round_to_zero, frint_fns[a->esz]); |
97 | - error_setg(errp, "CMSDK APB timer: pclk-frq property must be set"); | 91 | } |
98 | + if (!clock_has_source(s->timclk)) { | 92 | |
99 | + error_setg(errp, "CMSDK APB dualtimer: TIMCLK clock must be connected"); | 93 | static bool trans_FRINTA(DisasContext *s, arg_rpr_esz *a) |
100 | return; | 94 | { |
101 | } | 95 | - if (a->esz == 0) { |
96 | - return false; | ||
97 | - } | ||
98 | return do_frint_mode(s, a, float_round_ties_away, frint_fns[a->esz]); | ||
99 | } | ||
102 | 100 | ||
103 | -- | 101 | -- |
104 | 2.20.1 | 102 | 2.25.1 |
105 | |||
106 | diff view generated by jsdifflib |
1 | From: Mihai Carabas <mihai.carabas@oracle.com> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | To ease the PCI device addition in next patches, split the code as follows: | 3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
4 | - generic code (read/write/setup) is being kept in pvpanic.c | 4 | Message-id: 20220527181907.189259-96-richard.henderson@linaro.org |
5 | - ISA dependent code moved to pvpanic-isa.c | ||
6 | |||
7 | Also, rename: | ||
8 | - ISA_PVPANIC_DEVICE -> PVPANIC_ISA_DEVICE. | ||
9 | - TYPE_PVPANIC -> TYPE_PVPANIC_ISA. | ||
10 | - MemoryRegion io -> mr. | ||
11 | - pvpanic_ioport_* in pvpanic_*. | ||
12 | |||
13 | Update the build system with the new files and config structure. | ||
14 | |||
15 | Signed-off-by: Mihai Carabas <mihai.carabas@oracle.com> | ||
16 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
17 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
18 | --- | 7 | --- |
19 | include/hw/misc/pvpanic.h | 23 +++++++++- | 8 | target/arm/translate-sve.c | 53 ++++++++++---------------------------- |
20 | hw/misc/pvpanic-isa.c | 94 +++++++++++++++++++++++++++++++++++++++ | 9 | 1 file changed, 14 insertions(+), 39 deletions(-) |
21 | hw/misc/pvpanic.c | 85 +++-------------------------------- | ||
22 | hw/i386/Kconfig | 2 +- | ||
23 | hw/misc/Kconfig | 6 ++- | ||
24 | hw/misc/meson.build | 3 +- | ||
25 | tests/qtest/meson.build | 2 +- | ||
26 | 7 files changed, 130 insertions(+), 85 deletions(-) | ||
27 | create mode 100644 hw/misc/pvpanic-isa.c | ||
28 | 10 | ||
29 | diff --git a/include/hw/misc/pvpanic.h b/include/hw/misc/pvpanic.h | 11 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c |
30 | index XXXXXXX..XXXXXXX 100644 | 12 | index XXXXXXX..XXXXXXX 100644 |
31 | --- a/include/hw/misc/pvpanic.h | 13 | --- a/target/arm/translate-sve.c |
32 | +++ b/include/hw/misc/pvpanic.h | 14 | +++ b/target/arm/translate-sve.c |
33 | @@ -XXX,XX +XXX,XX @@ | 15 | @@ -XXX,XX +XXX,XX @@ static bool do_frint_mode(DisasContext *s, arg_rpr_esz *a, |
34 | 16 | return true; | |
35 | #include "qom/object.h" | ||
36 | |||
37 | -#define TYPE_PVPANIC "pvpanic" | ||
38 | +#define TYPE_PVPANIC_ISA_DEVICE "pvpanic" | ||
39 | |||
40 | #define PVPANIC_IOPORT_PROP "ioport" | ||
41 | |||
42 | +/* The bit of supported pv event, TODO: include uapi header and remove this */ | ||
43 | +#define PVPANIC_F_PANICKED 0 | ||
44 | +#define PVPANIC_F_CRASHLOADED 1 | ||
45 | + | ||
46 | +/* The pv event value */ | ||
47 | +#define PVPANIC_PANICKED (1 << PVPANIC_F_PANICKED) | ||
48 | +#define PVPANIC_CRASHLOADED (1 << PVPANIC_F_CRASHLOADED) | ||
49 | + | ||
50 | +/* | ||
51 | + * PVPanicState for any device type | ||
52 | + */ | ||
53 | +typedef struct PVPanicState PVPanicState; | ||
54 | +struct PVPanicState { | ||
55 | + MemoryRegion mr; | ||
56 | + uint8_t events; | ||
57 | +}; | ||
58 | + | ||
59 | +void pvpanic_setup_io(PVPanicState *s, DeviceState *dev, unsigned size); | ||
60 | + | ||
61 | static inline uint16_t pvpanic_port(void) | ||
62 | { | ||
63 | - Object *o = object_resolve_path_type("", TYPE_PVPANIC, NULL); | ||
64 | + Object *o = object_resolve_path_type("", TYPE_PVPANIC_ISA_DEVICE, NULL); | ||
65 | if (!o) { | ||
66 | return 0; | ||
67 | } | ||
68 | diff --git a/hw/misc/pvpanic-isa.c b/hw/misc/pvpanic-isa.c | ||
69 | new file mode 100644 | ||
70 | index XXXXXXX..XXXXXXX | ||
71 | --- /dev/null | ||
72 | +++ b/hw/misc/pvpanic-isa.c | ||
73 | @@ -XXX,XX +XXX,XX @@ | ||
74 | +/* | ||
75 | + * QEMU simulated pvpanic device. | ||
76 | + * | ||
77 | + * Copyright Fujitsu, Corp. 2013 | ||
78 | + * | ||
79 | + * Authors: | ||
80 | + * Wen Congyang <wency@cn.fujitsu.com> | ||
81 | + * Hu Tao <hutao@cn.fujitsu.com> | ||
82 | + * | ||
83 | + * This work is licensed under the terms of the GNU GPL, version 2 or later. | ||
84 | + * See the COPYING file in the top-level directory. | ||
85 | + * | ||
86 | + */ | ||
87 | + | ||
88 | +#include "qemu/osdep.h" | ||
89 | +#include "qemu/log.h" | ||
90 | +#include "qemu/module.h" | ||
91 | +#include "sysemu/runstate.h" | ||
92 | + | ||
93 | +#include "hw/nvram/fw_cfg.h" | ||
94 | +#include "hw/qdev-properties.h" | ||
95 | +#include "hw/misc/pvpanic.h" | ||
96 | +#include "qom/object.h" | ||
97 | +#include "hw/isa/isa.h" | ||
98 | + | ||
99 | +OBJECT_DECLARE_SIMPLE_TYPE(PVPanicISAState, PVPANIC_ISA_DEVICE) | ||
100 | + | ||
101 | +/* | ||
102 | + * PVPanicISAState for ISA device and | ||
103 | + * use ioport. | ||
104 | + */ | ||
105 | +struct PVPanicISAState { | ||
106 | + ISADevice parent_obj; | ||
107 | + | ||
108 | + uint16_t ioport; | ||
109 | + PVPanicState pvpanic; | ||
110 | +}; | ||
111 | + | ||
112 | +static void pvpanic_isa_initfn(Object *obj) | ||
113 | +{ | ||
114 | + PVPanicISAState *s = PVPANIC_ISA_DEVICE(obj); | ||
115 | + | ||
116 | + pvpanic_setup_io(&s->pvpanic, DEVICE(s), 1); | ||
117 | +} | ||
118 | + | ||
119 | +static void pvpanic_isa_realizefn(DeviceState *dev, Error **errp) | ||
120 | +{ | ||
121 | + ISADevice *d = ISA_DEVICE(dev); | ||
122 | + PVPanicISAState *s = PVPANIC_ISA_DEVICE(dev); | ||
123 | + PVPanicState *ps = &s->pvpanic; | ||
124 | + FWCfgState *fw_cfg = fw_cfg_find(); | ||
125 | + uint16_t *pvpanic_port; | ||
126 | + | ||
127 | + if (!fw_cfg) { | ||
128 | + return; | ||
129 | + } | ||
130 | + | ||
131 | + pvpanic_port = g_malloc(sizeof(*pvpanic_port)); | ||
132 | + *pvpanic_port = cpu_to_le16(s->ioport); | ||
133 | + fw_cfg_add_file(fw_cfg, "etc/pvpanic-port", pvpanic_port, | ||
134 | + sizeof(*pvpanic_port)); | ||
135 | + | ||
136 | + isa_register_ioport(d, &ps->mr, s->ioport); | ||
137 | +} | ||
138 | + | ||
139 | +static Property pvpanic_isa_properties[] = { | ||
140 | + DEFINE_PROP_UINT16(PVPANIC_IOPORT_PROP, PVPanicISAState, ioport, 0x505), | ||
141 | + DEFINE_PROP_UINT8("events", PVPanicISAState, pvpanic.events, PVPANIC_PANICKED | PVPANIC_CRASHLOADED), | ||
142 | + DEFINE_PROP_END_OF_LIST(), | ||
143 | +}; | ||
144 | + | ||
145 | +static void pvpanic_isa_class_init(ObjectClass *klass, void *data) | ||
146 | +{ | ||
147 | + DeviceClass *dc = DEVICE_CLASS(klass); | ||
148 | + | ||
149 | + dc->realize = pvpanic_isa_realizefn; | ||
150 | + device_class_set_props(dc, pvpanic_isa_properties); | ||
151 | + set_bit(DEVICE_CATEGORY_MISC, dc->categories); | ||
152 | +} | ||
153 | + | ||
154 | +static TypeInfo pvpanic_isa_info = { | ||
155 | + .name = TYPE_PVPANIC_ISA_DEVICE, | ||
156 | + .parent = TYPE_ISA_DEVICE, | ||
157 | + .instance_size = sizeof(PVPanicISAState), | ||
158 | + .instance_init = pvpanic_isa_initfn, | ||
159 | + .class_init = pvpanic_isa_class_init, | ||
160 | +}; | ||
161 | + | ||
162 | +static void pvpanic_register_types(void) | ||
163 | +{ | ||
164 | + type_register_static(&pvpanic_isa_info); | ||
165 | +} | ||
166 | + | ||
167 | +type_init(pvpanic_register_types) | ||
168 | diff --git a/hw/misc/pvpanic.c b/hw/misc/pvpanic.c | ||
169 | index XXXXXXX..XXXXXXX 100644 | ||
170 | --- a/hw/misc/pvpanic.c | ||
171 | +++ b/hw/misc/pvpanic.c | ||
172 | @@ -XXX,XX +XXX,XX @@ | ||
173 | #include "hw/misc/pvpanic.h" | ||
174 | #include "qom/object.h" | ||
175 | |||
176 | -/* The bit of supported pv event, TODO: include uapi header and remove this */ | ||
177 | -#define PVPANIC_F_PANICKED 0 | ||
178 | -#define PVPANIC_F_CRASHLOADED 1 | ||
179 | - | ||
180 | -/* The pv event value */ | ||
181 | -#define PVPANIC_PANICKED (1 << PVPANIC_F_PANICKED) | ||
182 | -#define PVPANIC_CRASHLOADED (1 << PVPANIC_F_CRASHLOADED) | ||
183 | - | ||
184 | -typedef struct PVPanicState PVPanicState; | ||
185 | -DECLARE_INSTANCE_CHECKER(PVPanicState, ISA_PVPANIC_DEVICE, | ||
186 | - TYPE_PVPANIC) | ||
187 | - | ||
188 | static void handle_event(int event) | ||
189 | { | ||
190 | static bool logged; | ||
191 | @@ -XXX,XX +XXX,XX @@ static void handle_event(int event) | ||
192 | } | ||
193 | } | 17 | } |
194 | 18 | ||
195 | -#include "hw/isa/isa.h" | 19 | -static bool trans_FRINTN(DisasContext *s, arg_rpr_esz *a) |
196 | - | ||
197 | -struct PVPanicState { | ||
198 | - ISADevice parent_obj; | ||
199 | - | ||
200 | - MemoryRegion io; | ||
201 | - uint16_t ioport; | ||
202 | - uint8_t events; | ||
203 | -}; | ||
204 | - | ||
205 | /* return supported events on read */ | ||
206 | -static uint64_t pvpanic_ioport_read(void *opaque, hwaddr addr, unsigned size) | ||
207 | +static uint64_t pvpanic_read(void *opaque, hwaddr addr, unsigned size) | ||
208 | { | ||
209 | PVPanicState *pvp = opaque; | ||
210 | return pvp->events; | ||
211 | } | ||
212 | |||
213 | -static void pvpanic_ioport_write(void *opaque, hwaddr addr, uint64_t val, | ||
214 | +static void pvpanic_write(void *opaque, hwaddr addr, uint64_t val, | ||
215 | unsigned size) | ||
216 | { | ||
217 | handle_event(val); | ||
218 | } | ||
219 | |||
220 | static const MemoryRegionOps pvpanic_ops = { | ||
221 | - .read = pvpanic_ioport_read, | ||
222 | - .write = pvpanic_ioport_write, | ||
223 | + .read = pvpanic_read, | ||
224 | + .write = pvpanic_write, | ||
225 | .impl = { | ||
226 | .min_access_size = 1, | ||
227 | .max_access_size = 1, | ||
228 | }, | ||
229 | }; | ||
230 | |||
231 | -static void pvpanic_isa_initfn(Object *obj) | ||
232 | +void pvpanic_setup_io(PVPanicState *s, DeviceState *dev, unsigned size) | ||
233 | { | ||
234 | - PVPanicState *s = ISA_PVPANIC_DEVICE(obj); | ||
235 | - | ||
236 | - memory_region_init_io(&s->io, OBJECT(s), &pvpanic_ops, s, "pvpanic", 1); | ||
237 | + memory_region_init_io(&s->mr, OBJECT(dev), &pvpanic_ops, s, "pvpanic", size); | ||
238 | } | ||
239 | - | ||
240 | -static void pvpanic_isa_realizefn(DeviceState *dev, Error **errp) | ||
241 | -{ | 20 | -{ |
242 | - ISADevice *d = ISA_DEVICE(dev); | 21 | - return do_frint_mode(s, a, float_round_nearest_even, frint_fns[a->esz]); |
243 | - PVPanicState *s = ISA_PVPANIC_DEVICE(dev); | ||
244 | - FWCfgState *fw_cfg = fw_cfg_find(); | ||
245 | - uint16_t *pvpanic_port; | ||
246 | - | ||
247 | - if (!fw_cfg) { | ||
248 | - return; | ||
249 | - } | ||
250 | - | ||
251 | - pvpanic_port = g_malloc(sizeof(*pvpanic_port)); | ||
252 | - *pvpanic_port = cpu_to_le16(s->ioport); | ||
253 | - fw_cfg_add_file(fw_cfg, "etc/pvpanic-port", pvpanic_port, | ||
254 | - sizeof(*pvpanic_port)); | ||
255 | - | ||
256 | - isa_register_ioport(d, &s->io, s->ioport); | ||
257 | -} | 22 | -} |
258 | - | 23 | - |
259 | -static Property pvpanic_isa_properties[] = { | 24 | -static bool trans_FRINTP(DisasContext *s, arg_rpr_esz *a) |
260 | - DEFINE_PROP_UINT16(PVPANIC_IOPORT_PROP, PVPanicState, ioport, 0x505), | ||
261 | - DEFINE_PROP_UINT8("events", PVPanicState, events, PVPANIC_PANICKED | PVPANIC_CRASHLOADED), | ||
262 | - DEFINE_PROP_END_OF_LIST(), | ||
263 | -}; | ||
264 | - | ||
265 | -static void pvpanic_isa_class_init(ObjectClass *klass, void *data) | ||
266 | -{ | 25 | -{ |
267 | - DeviceClass *dc = DEVICE_CLASS(klass); | 26 | - return do_frint_mode(s, a, float_round_up, frint_fns[a->esz]); |
268 | - | ||
269 | - dc->realize = pvpanic_isa_realizefn; | ||
270 | - device_class_set_props(dc, pvpanic_isa_properties); | ||
271 | - set_bit(DEVICE_CATEGORY_MISC, dc->categories); | ||
272 | -} | 27 | -} |
273 | - | 28 | - |
274 | -static TypeInfo pvpanic_isa_info = { | 29 | -static bool trans_FRINTM(DisasContext *s, arg_rpr_esz *a) |
275 | - .name = TYPE_PVPANIC, | ||
276 | - .parent = TYPE_ISA_DEVICE, | ||
277 | - .instance_size = sizeof(PVPanicState), | ||
278 | - .instance_init = pvpanic_isa_initfn, | ||
279 | - .class_init = pvpanic_isa_class_init, | ||
280 | -}; | ||
281 | - | ||
282 | -static void pvpanic_register_types(void) | ||
283 | -{ | 30 | -{ |
284 | - type_register_static(&pvpanic_isa_info); | 31 | - return do_frint_mode(s, a, float_round_down, frint_fns[a->esz]); |
285 | -} | 32 | -} |
286 | - | 33 | - |
287 | -type_init(pvpanic_register_types) | 34 | -static bool trans_FRINTZ(DisasContext *s, arg_rpr_esz *a) |
288 | diff --git a/hw/i386/Kconfig b/hw/i386/Kconfig | 35 | -{ |
289 | index XXXXXXX..XXXXXXX 100644 | 36 | - return do_frint_mode(s, a, float_round_to_zero, frint_fns[a->esz]); |
290 | --- a/hw/i386/Kconfig | 37 | -} |
291 | +++ b/hw/i386/Kconfig | 38 | - |
292 | @@ -XXX,XX +XXX,XX @@ config PC | 39 | -static bool trans_FRINTA(DisasContext *s, arg_rpr_esz *a) |
293 | imply ISA_DEBUG | 40 | -{ |
294 | imply PARALLEL | 41 | - return do_frint_mode(s, a, float_round_ties_away, frint_fns[a->esz]); |
295 | imply PCI_DEVICES | 42 | -} |
296 | - imply PVPANIC | 43 | +TRANS_FEAT(FRINTN, aa64_sve, do_frint_mode, a, |
297 | + imply PVPANIC_ISA | 44 | + float_round_nearest_even, frint_fns[a->esz]) |
298 | imply QXL | 45 | +TRANS_FEAT(FRINTP, aa64_sve, do_frint_mode, a, |
299 | imply SEV | 46 | + float_round_up, frint_fns[a->esz]) |
300 | imply SGA | 47 | +TRANS_FEAT(FRINTM, aa64_sve, do_frint_mode, a, |
301 | diff --git a/hw/misc/Kconfig b/hw/misc/Kconfig | 48 | + float_round_down, frint_fns[a->esz]) |
302 | index XXXXXXX..XXXXXXX 100644 | 49 | +TRANS_FEAT(FRINTZ, aa64_sve, do_frint_mode, a, |
303 | --- a/hw/misc/Kconfig | 50 | + float_round_to_zero, frint_fns[a->esz]) |
304 | +++ b/hw/misc/Kconfig | 51 | +TRANS_FEAT(FRINTA, aa64_sve, do_frint_mode, a, |
305 | @@ -XXX,XX +XXX,XX @@ config IOTKIT_SYSCTL | 52 | + float_round_ties_away, frint_fns[a->esz]) |
306 | config IOTKIT_SYSINFO | 53 | |
307 | bool | 54 | static gen_helper_gvec_3_ptr * const frecpx_fns[] = { |
308 | 55 | NULL, gen_helper_sve_frecpx_h, | |
309 | -config PVPANIC | 56 | @@ -XXX,XX +XXX,XX @@ TRANS_FEAT(FCVTLT_hs, aa64_sve2, gen_gvec_fpst_arg_zpz, |
310 | +config PVPANIC_COMMON | 57 | TRANS_FEAT(FCVTLT_sd, aa64_sve2, gen_gvec_fpst_arg_zpz, |
311 | + bool | 58 | gen_helper_sve2_fcvtlt_sd, a, 0, FPST_FPCR) |
312 | + | 59 | |
313 | +config PVPANIC_ISA | 60 | -static bool trans_FCVTX_ds(DisasContext *s, arg_rpr_esz *a) |
314 | bool | 61 | -{ |
315 | depends on ISA_BUS | 62 | - if (!dc_isar_feature(aa64_sve2, s)) { |
316 | + select PVPANIC_COMMON | 63 | - return false; |
317 | 64 | - } | |
318 | config AUX | 65 | - return do_frint_mode(s, a, float_round_to_odd, gen_helper_sve_fcvt_ds); |
319 | bool | 66 | -} |
320 | diff --git a/hw/misc/meson.build b/hw/misc/meson.build | 67 | - |
321 | index XXXXXXX..XXXXXXX 100644 | 68 | -static bool trans_FCVTXNT_ds(DisasContext *s, arg_rpr_esz *a) |
322 | --- a/hw/misc/meson.build | 69 | -{ |
323 | +++ b/hw/misc/meson.build | 70 | - if (!dc_isar_feature(aa64_sve2, s)) { |
324 | @@ -XXX,XX +XXX,XX @@ softmmu_ss.add(when: 'CONFIG_EMC141X', if_true: files('emc141x.c')) | 71 | - return false; |
325 | softmmu_ss.add(when: 'CONFIG_UNIMP', if_true: files('unimp.c')) | 72 | - } |
326 | softmmu_ss.add(when: 'CONFIG_EMPTY_SLOT', if_true: files('empty_slot.c')) | 73 | - return do_frint_mode(s, a, float_round_to_odd, gen_helper_sve2_fcvtnt_ds); |
327 | softmmu_ss.add(when: 'CONFIG_LED', if_true: files('led.c')) | 74 | -} |
328 | +softmmu_ss.add(when: 'CONFIG_PVPANIC_COMMON', if_true: files('pvpanic.c')) | 75 | +TRANS_FEAT(FCVTX_ds, aa64_sve2, do_frint_mode, a, |
329 | 76 | + float_round_to_odd, gen_helper_sve_fcvt_ds) | |
330 | # ARM devices | 77 | +TRANS_FEAT(FCVTXNT_ds, aa64_sve2, do_frint_mode, a, |
331 | softmmu_ss.add(when: 'CONFIG_PL310', if_true: files('arm_l2x0.c')) | 78 | + float_round_to_odd, gen_helper_sve2_fcvtnt_ds) |
332 | @@ -XXX,XX +XXX,XX @@ softmmu_ss.add(when: 'CONFIG_IOTKIT_SYSINFO', if_true: files('iotkit-sysinfo.c') | 79 | |
333 | softmmu_ss.add(when: 'CONFIG_ARMSSE_CPUID', if_true: files('armsse-cpuid.c')) | 80 | static bool trans_FLOGB(DisasContext *s, arg_rpr_esz *a) |
334 | softmmu_ss.add(when: 'CONFIG_ARMSSE_MHU', if_true: files('armsse-mhu.c')) | 81 | { |
335 | |||
336 | -softmmu_ss.add(when: 'CONFIG_PVPANIC', if_true: files('pvpanic.c')) | ||
337 | +softmmu_ss.add(when: 'CONFIG_PVPANIC_ISA', if_true: files('pvpanic-isa.c')) | ||
338 | softmmu_ss.add(when: 'CONFIG_AUX', if_true: files('auxbus.c')) | ||
339 | softmmu_ss.add(when: 'CONFIG_ASPEED_SOC', if_true: files('aspeed_scu.c', 'aspeed_sdmc.c', 'aspeed_xdma.c')) | ||
340 | softmmu_ss.add(when: 'CONFIG_MSF2', if_true: files('msf2-sysreg.c')) | ||
341 | diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build | ||
342 | index XXXXXXX..XXXXXXX 100644 | ||
343 | --- a/tests/qtest/meson.build | ||
344 | +++ b/tests/qtest/meson.build | ||
345 | @@ -XXX,XX +XXX,XX @@ qtests_i386 = \ | ||
346 | (config_host.has_key('CONFIG_LINUX') and \ | ||
347 | config_all_devices.has_key('CONFIG_ISA_IPMI_BT') ? ['ipmi-bt-test'] : []) + \ | ||
348 | (config_all_devices.has_key('CONFIG_WDT_IB700') ? ['wdt_ib700-test'] : []) + \ | ||
349 | - (config_all_devices.has_key('CONFIG_PVPANIC') ? ['pvpanic-test'] : []) + \ | ||
350 | + (config_all_devices.has_key('CONFIG_PVPANIC_ISA') ? ['pvpanic-test'] : []) + \ | ||
351 | (config_all_devices.has_key('CONFIG_HDA') ? ['intel-hda-test'] : []) + \ | ||
352 | (config_all_devices.has_key('CONFIG_I82801B11') ? ['i82801b11-test'] : []) + \ | ||
353 | (config_all_devices.has_key('CONFIG_IOH3420') ? ['ioh3420-test'] : []) + \ | ||
354 | -- | 82 | -- |
355 | 2.20.1 | 83 | 2.25.1 |
356 | |||
357 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | This was defined at some point before ARMv8.4, and will | 3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
4 | shortly be used by new processor descriptions. | 4 | Message-id: 20220527181907.189259-97-richard.henderson@linaro.org |
5 | |||
6 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
7 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
8 | Message-id: 20210120204400.1056582-1-richard.henderson@linaro.org | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
10 | --- | 7 | --- |
11 | target/arm/cpu.h | 1 + | 8 | target/arm/translate-sve.c | 29 ++++++----------------------- |
12 | target/arm/helper.c | 4 ++-- | 9 | 1 file changed, 6 insertions(+), 23 deletions(-) |
13 | target/arm/kvm64.c | 2 ++ | ||
14 | 3 files changed, 5 insertions(+), 2 deletions(-) | ||
15 | 10 | ||
16 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h | 11 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c |
17 | index XXXXXXX..XXXXXXX 100644 | 12 | index XXXXXXX..XXXXXXX 100644 |
18 | --- a/target/arm/cpu.h | 13 | --- a/target/arm/translate-sve.c |
19 | +++ b/target/arm/cpu.h | 14 | +++ b/target/arm/translate-sve.c |
20 | @@ -XXX,XX +XXX,XX @@ struct ARMCPU { | 15 | @@ -XXX,XX +XXX,XX @@ TRANS_FEAT(FCVTX_ds, aa64_sve2, do_frint_mode, a, |
21 | uint32_t id_mmfr4; | 16 | TRANS_FEAT(FCVTXNT_ds, aa64_sve2, do_frint_mode, a, |
22 | uint32_t id_pfr0; | 17 | float_round_to_odd, gen_helper_sve2_fcvtnt_ds) |
23 | uint32_t id_pfr1; | 18 | |
24 | + uint32_t id_pfr2; | 19 | -static bool trans_FLOGB(DisasContext *s, arg_rpr_esz *a) |
25 | uint32_t mvfr0; | 20 | -{ |
26 | uint32_t mvfr1; | 21 | - static gen_helper_gvec_3_ptr * const fns[] = { |
27 | uint32_t mvfr2; | 22 | - NULL, gen_helper_flogb_h, |
28 | diff --git a/target/arm/helper.c b/target/arm/helper.c | 23 | - gen_helper_flogb_s, gen_helper_flogb_d |
29 | index XXXXXXX..XXXXXXX 100644 | 24 | - }; |
30 | --- a/target/arm/helper.c | 25 | - |
31 | +++ b/target/arm/helper.c | 26 | - if (!dc_isar_feature(aa64_sve2, s) || fns[a->esz] == NULL) { |
32 | @@ -XXX,XX +XXX,XX @@ void register_cp_regs_for_features(ARMCPU *cpu) | 27 | - return false; |
33 | .access = PL1_R, .type = ARM_CP_CONST, | 28 | - } |
34 | .accessfn = access_aa64_tid3, | 29 | - if (sve_access_check(s)) { |
35 | .resetvalue = 0 }, | 30 | - TCGv_ptr status = |
36 | - { .name = "MVFR4_EL1_RESERVED", .state = ARM_CP_STATE_AA64, | 31 | - fpstatus_ptr(a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR); |
37 | + { .name = "ID_PFR2", .state = ARM_CP_STATE_BOTH, | 32 | - unsigned vsz = vec_full_reg_size(s); |
38 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 3, .opc2 = 4, | 33 | - |
39 | .access = PL1_R, .type = ARM_CP_CONST, | 34 | - tcg_gen_gvec_3_ptr(vec_full_reg_offset(s, a->rd), |
40 | .accessfn = access_aa64_tid3, | 35 | - vec_full_reg_offset(s, a->rn), |
41 | - .resetvalue = 0 }, | 36 | - pred_full_reg_offset(s, a->pg), |
42 | + .resetvalue = cpu->isar.id_pfr2 }, | 37 | - status, vsz, vsz, 0, fns[a->esz]); |
43 | { .name = "MVFR5_EL1_RESERVED", .state = ARM_CP_STATE_AA64, | 38 | - tcg_temp_free_ptr(status); |
44 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 3, .opc2 = 5, | 39 | - } |
45 | .access = PL1_R, .type = ARM_CP_CONST, | 40 | - return true; |
46 | diff --git a/target/arm/kvm64.c b/target/arm/kvm64.c | 41 | -} |
47 | index XXXXXXX..XXXXXXX 100644 | 42 | +static gen_helper_gvec_3_ptr * const flogb_fns[] = { |
48 | --- a/target/arm/kvm64.c | 43 | + NULL, gen_helper_flogb_h, |
49 | +++ b/target/arm/kvm64.c | 44 | + gen_helper_flogb_s, gen_helper_flogb_d |
50 | @@ -XXX,XX +XXX,XX @@ bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf) | 45 | +}; |
51 | ARM64_SYS_REG(3, 0, 0, 1, 0)); | 46 | +TRANS_FEAT(FLOGB, aa64_sve2, gen_gvec_fpst_arg_zpz, flogb_fns[a->esz], |
52 | err |= read_sys_reg32(fdarray[2], &ahcf->isar.id_pfr1, | 47 | + a, 0, a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR) |
53 | ARM64_SYS_REG(3, 0, 0, 1, 1)); | 48 | |
54 | + err |= read_sys_reg32(fdarray[2], &ahcf->isar.id_pfr2, | 49 | static bool do_FMLAL_zzzw(DisasContext *s, arg_rrrr_esz *a, bool sub, bool sel) |
55 | + ARM64_SYS_REG(3, 0, 0, 3, 4)); | 50 | { |
56 | err |= read_sys_reg32(fdarray[2], &ahcf->isar.id_dfr0, | ||
57 | ARM64_SYS_REG(3, 0, 0, 1, 2)); | ||
58 | err |= read_sys_reg32(fdarray[2], &ahcf->isar.id_mmfr0, | ||
59 | -- | 51 | -- |
60 | 2.20.1 | 52 | 2.25.1 |
61 | |||
62 | diff view generated by jsdifflib |