mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-21 00:39:33 +07:00
arm64/sve: Factor out FPSIMD to SVE state conversion
Currently we convert from FPSIMD to SVE register state in memory in two places. To ease future maintenance, let's consolidate this in one place. Reviewed-by: Julien Grall <julien.grall@arm.com> Acked-by: Catalin Marinas <catalin.marinas@arm.com> Signed-off-by: Dave Martin <Dave.Martin@arm.com> Signed-off-by: Will Deacon <will@kernel.org>
This commit is contained in:
parent
592700f094
commit
d16af870a7
@ -406,6 +406,18 @@ static __uint128_t arm64_cpu_to_le128(__uint128_t x)
|
||||
|
||||
#define arm64_le128_to_cpu(x) arm64_cpu_to_le128(x)
|
||||
|
||||
static void __fpsimd_to_sve(void *sst, struct user_fpsimd_state const *fst,
|
||||
unsigned int vq)
|
||||
{
|
||||
unsigned int i;
|
||||
__uint128_t *p;
|
||||
|
||||
for (i = 0; i < 32; ++i) {
|
||||
p = (__uint128_t *)ZREG(sst, vq, i);
|
||||
*p = arm64_cpu_to_le128(fst->vregs[i]);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Transfer the FPSIMD state in task->thread.uw.fpsimd_state to
|
||||
* task->thread.sve_state.
|
||||
@ -423,17 +435,12 @@ static void fpsimd_to_sve(struct task_struct *task)
|
||||
unsigned int vq;
|
||||
void *sst = task->thread.sve_state;
|
||||
struct user_fpsimd_state const *fst = &task->thread.uw.fpsimd_state;
|
||||
unsigned int i;
|
||||
__uint128_t *p;
|
||||
|
||||
if (!system_supports_sve())
|
||||
return;
|
||||
|
||||
vq = sve_vq_from_vl(task->thread.sve_vl);
|
||||
for (i = 0; i < 32; ++i) {
|
||||
p = (__uint128_t *)ZREG(sst, vq, i);
|
||||
*p = arm64_cpu_to_le128(fst->vregs[i]);
|
||||
}
|
||||
__fpsimd_to_sve(sst, fst, vq);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -550,8 +557,6 @@ void sve_sync_from_fpsimd_zeropad(struct task_struct *task)
|
||||
unsigned int vq;
|
||||
void *sst = task->thread.sve_state;
|
||||
struct user_fpsimd_state const *fst = &task->thread.uw.fpsimd_state;
|
||||
unsigned int i;
|
||||
__uint128_t *p;
|
||||
|
||||
if (!test_tsk_thread_flag(task, TIF_SVE))
|
||||
return;
|
||||
@ -559,11 +564,7 @@ void sve_sync_from_fpsimd_zeropad(struct task_struct *task)
|
||||
vq = sve_vq_from_vl(task->thread.sve_vl);
|
||||
|
||||
memset(sst, 0, SVE_SIG_REGS_SIZE(vq));
|
||||
|
||||
for (i = 0; i < 32; ++i) {
|
||||
p = (__uint128_t *)ZREG(sst, vq, i);
|
||||
*p = arm64_cpu_to_le128(fst->vregs[i]);
|
||||
}
|
||||
__fpsimd_to_sve(sst, fst, vq);
|
||||
}
|
||||
|
||||
int sve_set_vector_length(struct task_struct *task,
|
||||
|
Loading…
Reference in New Issue
Block a user