Skip to content
Commit f89259ed authored by Dave Martin's avatar Dave Martin
Browse files

arm64/sve: Add prctl controls for userspace vector length management



This patch adds two arm64-specific prctls, to permit userspace to
control its vector length:

 * PR_SVE_SET_VL: set the thread's SVE vector length and vector
   length inheritance mode.

 * PR_SVE_GET_VL: get the same information.

Although these calls shadow instruction set features in the SVE
architecture, these prctls provide additional control: the vector
length inheritance mode is Linux-specific and nothing to do with
the architecture, and the architecture does not permit EL0 to set
its own vector length directly.  Both can be used in portable tools
without requiring the use of SVE instructions.

Signed-off-by: default avatarDave Martin <Dave.Martin@arm.com>
Cc: Alex Bennée <alex.bennee@linaro.org>

---

Dropped Alex Bennée's Reviewed-by, since there are non-trivial changes
since v2.

Changes since v2
----------------

Bug fixes:

 * Remove preempt_disable() from sve_set_current_vl(), since it's
   (a) wrong, and (b) moved to sve_set_vector_length().

   This was a legacy from before migration to allowing kernel_neon_begin()
   in softirq.

ABI changes:

 * Changed return value of PR_SVE_SET_VL to encode the vector length
   deferred for the next exec, when PR_SVE_SET_VL_ONEXEC is passed.

   This allows a caller to probe for supported VLs without
   changing the current VL.

   Without this change, the return value is not very informative
   in this case, since the current VL doesn't change.

   Without PR_SVE_SET_VL_ONEXEC, the new current VL is returned,
   as in v2.
parent e4e2a304
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment