11539Srgrimes// SPDX-License-Identifier: GPL-2.0-only
214288Spst// Copyright (C) 2021-2 ARM Limited.
31539Srgrimes// Original author: Mark Brown <broonie@kernel.org>
41539Srgrimes
51539Srgrimes#ifndef SME_INST_H
61539Srgrimes#define SME_INST_H
71539Srgrimes
81539Srgrimes/*
91539Srgrimes * RDSVL X\nx, #\imm
101539Srgrimes */
111539Srgrimes.macro rdsvl nx, imm
121539Srgrimes	.inst	0x4bf5800			\
13203964Simp		| (\imm << 5)			\
141539Srgrimes		| (\nx)
151539Srgrimes.endm
161539Srgrimes
171539Srgrimes.macro smstop
181539Srgrimes	msr	S0_3_C4_C6_3, xzr
191539Srgrimes.endm
201539Srgrimes
211539Srgrimes.macro smstart_za
221539Srgrimes	msr	S0_3_C4_C5_3, xzr
231539Srgrimes.endm
241539Srgrimes
251539Srgrimes.macro smstart_sm
261539Srgrimes	msr	S0_3_C4_C3_3, xzr
271539Srgrimes.endm
281539Srgrimes
29190498Sdelphij/*
3060833Sjake * LDR (vector to ZA array):
311539Srgrimes *	LDR ZA[\nw, #\offset], [X\nxbase, #\offset, MUL VL]
321539Srgrimes */
332162Spaul.macro _ldr_za nw, nxbase, offset=0
342162Spaul	.inst	0xe1000000			\
352162Spaul		| (((\nw) & 3) << 13)		\
3614288Spst		| ((\nxbase) << 5)		\
3714288Spst		| ((\offset) & 7)
381539Srgrimes.endm
3914288Spst
4014288Spst/*
4114288Spst * STR (vector from ZA array):
4214288Spst *	STR ZA[\nw, #\offset], [X\nxbase, #\offset, MUL VL]
4314288Spst */
441539Srgrimes.macro _str_za nw, nxbase, offset=0
451539Srgrimes	.inst	0xe1200000			\
46190498Sdelphij		| (((\nw) & 3) << 13)		\
471539Srgrimes		| ((\nxbase) << 5)		\
4814288Spst		| ((\offset) & 7)
4914288Spst.endm
5070492Sphk
5170492Sphk/*
5214288Spst * LDR (ZT0)
5314288Spst *
541539Srgrimes *	LDR ZT0, nx
551539Srgrimes */
561539Srgrimes.macro _ldr_zt nx
57190498Sdelphij	.inst	0xe11f8000			\
5814288Spst		| (((\nx) & 0x1f) << 5)
591539Srgrimes.endm
601539Srgrimes
611539Srgrimes/*
6270492Sphk * STR (ZT0)
6314288Spst *
6470492Sphk *	STR ZT0, nx
6514288Spst */
6614288Spst.macro _str_zt nx
6714288Spst	.inst	0xe13f8000			\
68190498Sdelphij		| (((\nx) & 0x1f) << 5)
6914288Spst.endm
7014288Spst
7193032Simp#endif
7214288Spst