Skip to content

Commit 21eb468

Browse files
brooniectmarinas
authored andcommitted
arm64/sve: Document that __SVE_VQ_MAX is much larger than needed
__SVE_VQ_MAX is defined without comment as 512 but the actual architectural maximum is 16, a substantial difference which might not be obvious to readers especially given the several different units used for specifying vector sizes in various contexts and the fact that it's often used via macros. In an effort to minimise surprises for users who might assume the value is the architectural maximum and use it to do things like size allocations add a comment noting the difference, and add a note for SVE_VQ_MAX to aid discoverability. Signed-off-by: Mark Brown <[email protected]> Acked-by: Dave Martin <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Catalin Marinas <[email protected]>
1 parent 58a0484 commit 21eb468

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

arch/arm64/include/uapi/asm/sve_context.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,17 @@
1313

1414
#define __SVE_VQ_BYTES 16 /* number of bytes per quadword */
1515

16+
/*
17+
* Yes, __SVE_VQ_MAX is 512 QUADWORDS.
18+
*
19+
* To help ensure forward portability, this is much larger than the
20+
* current maximum value defined by the SVE architecture. While arrays
21+
* or static allocations can be sized based on this value, watch out!
22+
* It will waste a surprisingly large amount of memory.
23+
*
24+
* Dynamic sizing based on the actual runtime vector length is likely to
25+
* be preferable for most purposes.
26+
*/
1627
#define __SVE_VQ_MIN 1
1728
#define __SVE_VQ_MAX 512
1829

0 commit comments

Comments
 (0)