Commit e6fda526 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull arm64 fixes from Catalin Marinas:
 "More SVE/SME fixes for ptrace() and for the (potentially future) case
  where SME is implemented in hardware without SVE support"

* tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux:
  arm64/fpsimd: Sync and zero pad FPSIMD state for streaming SVE
  arm64/fpsimd: Sync FPSIMD state with SVE for SME only systems
  arm64/ptrace: Don't enable SVE when setting streaming SVE
  arm64/ptrace: Flush FP state when setting ZT0
  arm64/fpsimd: Clear SME state in the target task when setting the VL
parents c8273a25 69af56ae
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -679,7 +679,7 @@ static void fpsimd_to_sve(struct task_struct *task)
	void *sst = task->thread.sve_state;
	struct user_fpsimd_state const *fst = &task->thread.uw.fpsimd_state;

	if (!system_supports_sve())
	if (!system_supports_sve() && !system_supports_sme())
		return;

	vq = sve_vq_from_vl(thread_get_cur_vl(&task->thread));
@@ -705,7 +705,7 @@ static void sve_to_fpsimd(struct task_struct *task)
	unsigned int i;
	__uint128_t const *p;

	if (!system_supports_sve())
	if (!system_supports_sve() && !system_supports_sme())
		return;

	vl = thread_get_cur_vl(&task->thread);
@@ -835,7 +835,8 @@ void sve_sync_from_fpsimd_zeropad(struct task_struct *task)
	void *sst = task->thread.sve_state;
	struct user_fpsimd_state const *fst = &task->thread.uw.fpsimd_state;

	if (!test_tsk_thread_flag(task, TIF_SVE))
	if (!test_tsk_thread_flag(task, TIF_SVE) &&
	    !thread_sm_enabled(&task->thread))
		return;

	vq = sve_vq_from_vl(thread_get_cur_vl(&task->thread));
@@ -909,7 +910,7 @@ int vec_set_vector_length(struct task_struct *task, enum vec_type type,
			 */
			task->thread.svcr &= ~(SVCR_SM_MASK |
					       SVCR_ZA_MASK);
			clear_thread_flag(TIF_SME);
			clear_tsk_thread_flag(task, TIF_SME);
			free_sme = true;
		}
	}
+7 −3
Original line number Diff line number Diff line
@@ -932,10 +932,12 @@ static int sve_set_common(struct task_struct *target,
	/*
	 * Ensure target->thread.sve_state is up to date with target's
	 * FPSIMD regs, so that a short copyin leaves trailing
	 * registers unmodified.  Always enable SVE even if going into
	 * streaming mode.
	 * registers unmodified.  Only enable SVE if we are
	 * configuring normal SVE, a system with streaming SVE may not
	 * have normal SVE.
	 */
	fpsimd_sync_to_sve(target);
	if (type == ARM64_VEC_SVE)
		set_tsk_thread_flag(target, TIF_SVE);
	target->thread.fp_type = FP_STATE_SVE;

@@ -1180,6 +1182,8 @@ static int zt_set(struct task_struct *target,
	if (ret == 0)
		target->thread.svcr |= SVCR_ZA_MASK;

	fpsimd_flush_task_state(target);

	return ret;
}