[PATCH 2/6] powerpc: Provide for giveup_fpu/altivec to save state in alternate location

Alexander Graf agraf at suse.de
Wed Sep 11 03:12:47 EST 2013


On 10.09.2013, at 05:21, Paul Mackerras wrote:

> This provides a facility which is intended for use by KVM, where the
> contents of the FP/VSX and VMX (Altivec) registers can be saved away
> to somewhere other than the thread_struct when kernel code wants to
> use floating point or VMX instructions.  This is done by providing a
> pointer in the thread_struct to indicate where the state should be
> saved to.  The giveup_fpu() and giveup_altivec() functions test these
> pointers and save state to the indicated location if they are non-NULL.
> Note that the MSR_FP/VEC bits in task->thread.regs->msr are still used
> to indicate whether the CPU register state is live, even when an
> alternate save location is being used.
> 
> This also provides load_fp_state() and load_vr_state() functions, which
> load up FP/VSX and VMX state from memory into the CPU registers, and
> corresponding store_fp_state() and store_vr_state() functions, which
> store FP/VSX and VMX state into memory from the CPU registers.
> 
> Signed-off-by: Paul Mackerras <paulus at samba.org>
> ---
> arch/powerpc/include/asm/processor.h |  7 +++++++
> arch/powerpc/kernel/asm-offsets.c    |  2 ++
> arch/powerpc/kernel/fpu.S            | 25 ++++++++++++++++++++++++-
> arch/powerpc/kernel/ppc_ksyms.c      |  4 ++++
> arch/powerpc/kernel/process.c        |  7 +++++++
> arch/powerpc/kernel/vector.S         | 29 +++++++++++++++++++++++++++--
> 6 files changed, 71 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/powerpc/include/asm/processor.h b/arch/powerpc/include/asm/processor.h
> index 92f709d..8bc9d66 100644
> --- a/arch/powerpc/include/asm/processor.h
> +++ b/arch/powerpc/include/asm/processor.h
> @@ -212,6 +212,7 @@ struct thread_struct {
> #endif
> #endif
> 	struct thread_fp_state	fp_state;
> +	struct thread_fp_state	*fp_save_area;

Why do you need these pointers? Couldn't you handle everything you need through preempt notifiers?


Alex



More information about the Linuxppc-dev mailing list