Skip to content

Commit 315cf04

Browse files
Julien Grallwilldeacon
authored andcommitted
arm64/fpsimdmacros: Introduce a macro to update ZCR_EL1.LEN
A follow-up patch will need to update ZCR_EL1.LEN. Add a macro that could be re-used in the current and new places to avoid code duplication. Signed-off-by: Julien Grall <julien.grall@arm.com> Signed-off-by: Mark Brown <broonie@kernel.org> Reviewed-by: Dave Martin <Dave.Martin@arm.com> Link: https://lore.kernel.org/r/20200828181155.17745-5-broonie@kernel.org Signed-off-by: Will Deacon <will@kernel.org>
1 parent 68a4c52 commit 315cf04

1 file changed

Lines changed: 12 additions & 7 deletions

File tree

arch/arm64/include/asm/fpsimdmacros.h

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,17 @@
183183
.purgem _for__body
184184
.endm
185185

186+
/* Update ZCR_EL1.LEN with the new VQ */
187+
.macro sve_load_vq xvqminus1, xtmp, xtmp2
188+
mrs_s \xtmp, SYS_ZCR_EL1
189+
bic \xtmp2, \xtmp, ZCR_ELx_LEN_MASK
190+
orr \xtmp2, \xtmp2, \xvqminus1
191+
cmp \xtmp2, \xtmp
192+
b.eq 921f
193+
msr_s SYS_ZCR_EL1, \xtmp2 //self-synchronising
194+
921:
195+
.endm
196+
186197
.macro sve_save nxbase, xpfpsr, nxtmp
187198
_for n, 0, 31, _sve_str_v \n, \nxbase, \n - 34
188199
_for n, 0, 15, _sve_str_p \n, \nxbase, \n - 16
@@ -197,13 +208,7 @@
197208
.endm
198209

199210
.macro sve_load nxbase, xpfpsr, xvqminus1, nxtmp, xtmp2
200-
mrs_s x\nxtmp, SYS_ZCR_EL1
201-
bic \xtmp2, x\nxtmp, ZCR_ELx_LEN_MASK
202-
orr \xtmp2, \xtmp2, \xvqminus1
203-
cmp \xtmp2, x\nxtmp
204-
b.eq 921f
205-
msr_s SYS_ZCR_EL1, \xtmp2 // self-synchronising
206-
921:
211+
sve_load_vq \xvqminus1, x\nxtmp, \xtmp2
207212
_for n, 0, 31, _sve_ldr_v \n, \nxbase, \n - 34
208213
_sve_ldr_p 0, \nxbase
209214
_sve_wrffr 0

0 commit comments

Comments
 (0)