All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Neuling <mikey@neuling.org>
To: Kumar Gala <galak@kernel.crashing.org>
Cc: linuxppc-dev@ozlabs.org, Paul Mackerras <paulus@samba.org>
Subject: Re: [PATCH 5/9] powerpc: Introduce VSX thread_struct and CONFIG_VSX
Date: Thu, 19 Jun 2008 14:35:20 +1000	[thread overview]
Message-ID: <14228.1213850120@neuling.org> (raw)
In-Reply-To: <5AEB0769-1394-4924-803D-C40CAF685519@kernel.crashing.org>

In message <5AEB0769-1394-4924-803D-C40CAF685519@kernel.crashing.org> you wrote
:
> >
> >
> > Index: linux-2.6-ozlabs/include/asm-powerpc/processor.h
> > ===================================================================
> > --- linux-2.6-ozlabs.orig/include/asm-powerpc/processor.h
> > +++ linux-2.6-ozlabs/include/asm-powerpc/processor.h
> > @@ -78,6 +78,7 @@ extern long kernel_thread(int (*fn)(void
> > /* Lazy FPU handling on uni-processor */
> > extern struct task_struct *last_task_used_math;
> > extern struct task_struct *last_task_used_altivec;
> > +extern struct task_struct *last_task_used_vsx;
> > extern struct task_struct *last_task_used_spe;
> >
> > #ifdef CONFIG_PPC32
> > @@ -136,8 +137,13 @@ typedef struct {
> > 	unsigned long seg;
> > } mm_segment_t;
> >
> > +#ifdef CONFIG_VSX
> > +#define TS_FPR(i) fpvsr.fp[i].fpr
> > +#define TS_FPRSTART fpvsr.fp
> > +#else
> > #define TS_FPR(i) fpr[i]
> > #define TS_FPRSTART fpr
> > +#endif
> >
> > struct thread_struct {
> > 	unsigned long	ksp;		/* Kernel stack pointer */
> > @@ -155,8 +161,19 @@ struct thread_struct {
> > 	unsigned long	dbcr0;		/* debug control register values */
> > 	unsigned long	dbcr1;
> > #endif
> > +#ifdef CONFIG_VSX
> > +	/* First 32 VSX registers (overlap with fpr[32]) */
> > +	union {
> > +		struct {
> > +			double fpr;
> > +			double vsrlow;
> > +		} fp[32];
> > +		vector128	vsr[32];
> > +	} fpvsr __attribute__((aligned(16)));
> 
> Do we really need a union here?  what would happen if you just changed  
> the type of fpr[32] from double to vector if #CONFIG_VSX?
>
> I really dont like the union and think we can just make the storage  
> look opaque which is the key.  I doubt we every really care about  
> using fpr[] as a double in the kernel.

I did something similar to this for the first cut of this patch, but it
made the code accessing this structure much less readable.

Personally, I think the union is good as it represents the true
structure of what it's storing.

> Also, the attribute is redundant, vector is already aligned(16).

Ok, I'll remove.

Mikey

> 
> > +#else
> > 	double		fpr[32];	/* Complete floating point set */
> > -	struct {			/* fpr ... fpscr must be contiguous */
> > +#endif
> > +	struct {
> >
> > 		unsigned int pad;
> > 		unsigned int val;	/* Floating point status */
> > @@ -176,6 +193,10 @@ struct thread_struct {
> > 	unsigned long	vrsave;
> > 	int		used_vr;	/* set if process has used altivec */
> > #endif /* CONFIG_ALTIVEC */
> > +#ifdef CONFIG_VSX
> > +	/* VSR status */
> > +	int		used_vsr;	/* set if process has used altivec */
> > +#endif /* CONFIG_VSX */
> > #ifdef CONFIG_SPE
> > 	unsigned long	evr[32];	/* upper 32-bits of SPE regs */
> > 	u64		acc;		/* Accumulator */
> > @@ -200,7 +221,11 @@ struct thread_struct {
> > 	.fpexc_mode = MSR_FE0 | MSR_FE1, \
> > }
> > #else
> > +#ifdef CONFIG_VSX
> > +#define	FPVSR_INIT_THREAD .fpvsr = { .vsr = 0, }
> > +#else
> > #define	FPVSR_INIT_THREAD .fpr = {0}
> > +#endif
> > #define INIT_THREAD  { \
> > 	.ksp = INIT_SP, \
> > 	.ksp_limit = INIT_SP_LIMIT, \
> > @@ -293,5 +318,9 @@ static inline void prefetchw(const void
> >
> > #endif /* __KERNEL__ */
> > #endif /* __ASSEMBLY__ */
> > +#ifdef CONFIG_VSX
> > +#define TS_FPRSPACING 2
> > +#else
> > #define TS_FPRSPACING 1
> > +#endif
> > #endif /* _ASM_POWERPC_PROCESSOR_H */
> > _______________________________________________
> > Linuxppc-dev mailing list
> > Linuxppc-dev@ozlabs.org
> > https://ozlabs.org/mailman/listinfo/linuxppc-dev
> 

  reply	other threads:[~2008-06-19  4:35 UTC|newest]

Thread overview: 106+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-18  0:47 [PATCH 0/9] powerpc: Add kernel support for POWER7 VSX Michael Neuling
2008-06-18  0:47 ` [PATCH 1/9] powerpc: Fix msr setting in 32 bit signal code Michael Neuling
2008-06-18 14:53   ` Kumar Gala
2008-06-18 23:55     ` Michael Neuling
2008-06-18  0:47 ` [PATCH 2/9] powerpc: Add macros to access floating point registers in thread_struct Michael Neuling
2008-06-18  0:47 ` [PATCH 3/9] powerpc: Move altivec_unavailable Michael Neuling
2008-06-18  0:47 ` [PATCH 5/9] powerpc: Introduce VSX thread_struct and CONFIG_VSX Michael Neuling
2008-06-18 19:35   ` Kumar Gala
2008-06-18 22:58     ` Paul Mackerras
2008-06-19  4:13       ` Kumar Gala
2008-06-19  4:30         ` Michael Neuling
2008-06-19  4:22   ` Kumar Gala
2008-06-19  4:35     ` Michael Neuling [this message]
2008-06-19  4:58       ` Kumar Gala
2008-06-19  5:37         ` Michael Neuling
2008-06-19  5:47           ` Kumar Gala
2008-06-19  6:01             ` Michael Neuling
2008-06-19  6:10               ` Kumar Gala
2008-06-19  9:33                 ` Benjamin Herrenschmidt
2008-06-19 13:24                   ` Kumar Gala
2008-06-18  0:47 ` [PATCH 4/9] powerpc: Make load_up_fpu and load_up_altivec callable Michael Neuling
2008-06-18  0:47 ` [PATCH 9/9] powerpc: Add CONFIG_VSX config option Michael Neuling
2008-06-18  0:47 ` [PATCH 6/9] powerpc: Add VSX CPU feature Michael Neuling
2008-06-18 16:28   ` Joel Schopp
2008-06-19  6:51   ` David Woodhouse
2008-06-19  7:00     ` Michael Neuling
2008-06-18  0:47 ` [PATCH 8/9] powerpc: Add VSX context save/restore, ptrace and signal support Michael Neuling
2008-06-18  0:47 ` [PATCH 7/9] powerpc: Add VSX assembler code macros Michael Neuling
2008-06-18 13:05 ` [PATCH 0/9] powerpc: Add kernel support for POWER7 VSX Kumar Gala
2008-06-18 23:54   ` Michael Neuling
2008-06-20  4:13 ` Michael Neuling
2008-06-20  4:13   ` [PATCH 7/9] powerpc: Add VSX assembler code macros Michael Neuling
2008-06-20  4:13   ` [PATCH 2/9] powerpc: Add macros to access floating point registers in thread_struct Michael Neuling
2008-06-20  6:39     ` Kumar Gala
2008-06-22 11:29       ` Michael Neuling
2008-06-20  4:13   ` [PATCH 9/9] powerpc: Add CONFIG_VSX config option Michael Neuling
2008-06-20  4:13   ` [PATCH 8/9] powerpc: Add VSX context save/restore, ptrace and signal support Michael Neuling
2008-06-20  4:13   ` [PATCH 6/9] powerpc: Add VSX CPU feature Michael Neuling
2008-06-20  4:13   ` [PATCH 4/9] powerpc: Make load_up_fpu and load_up_altivec callable Michael Neuling
2008-06-20  4:13   ` [PATCH 5/9] powerpc: Introduce VSX thread_struct and CONFIG_VSX Michael Neuling
2008-06-20  6:44     ` Kumar Gala
2008-06-20  4:13   ` [PATCH 3/9] powerpc: Move altivec_unavailable Michael Neuling
2008-06-20  4:13   ` [PATCH 1/9] powerpc: Fix msr setting in 32 bit signal code Michael Neuling
2008-06-20  6:35     ` Kumar Gala
2008-06-20  6:37   ` [PATCH 0/9] powerpc: Add kernel support for POWER7 VSX Kumar Gala
2008-06-20  8:15     ` Michael Neuling
2008-06-23  5:31   ` Michael Neuling
2008-06-23  5:31     ` [PATCH 2/9] powerpc: Add macros to access floating point registers in thread_struct Michael Neuling
2008-06-23  5:31     ` [PATCH 4/9] powerpc: Make load_up_fpu and load_up_altivec callable Michael Neuling
2008-06-23  5:31     ` [PATCH 3/9] powerpc: Move altivec_unavailable Michael Neuling
2008-06-23  5:31     ` [PATCH 1/9] powerpc: Fix msr setting in 32 bit signal code Michael Neuling
2008-06-23  5:31     ` [PATCH 9/9] powerpc: Add CONFIG_VSX config option Michael Neuling
2008-06-23  5:31     ` [PATCH 7/9] powerpc: Add VSX assembler code macros Michael Neuling
2008-06-23  5:31     ` [PATCH 8/9] powerpc: Add VSX context save/restore, ptrace and signal support Michael Neuling
2008-06-23  5:31     ` [PATCH 6/9] powerpc: Add VSX CPU feature Michael Neuling
2008-06-23  5:31     ` [PATCH 5/9] powerpc: Introduce VSX thread_struct and CONFIG_VSX Michael Neuling
2008-06-23  7:38     ` [PATCH 0/9] powerpc: Add kernel support for POWER7 VSX Michael Neuling
2008-06-23  7:38       ` [PATCH 2/9] powerpc: Add macros to access floating point registers in thread_struct Michael Neuling
2008-06-23  7:38       ` [PATCH 1/9] powerpc: Fix msr setting in 32 bit signal code Michael Neuling
2008-06-23 14:46         ` Kumar Gala
2008-06-23  7:38       ` [PATCH 8/9] powerpc: Add VSX context save/restore, ptrace and signal support Michael Neuling
2008-06-23  7:38       ` [PATCH 3/9] powerpc: Move altivec_unavailable Michael Neuling
2008-06-23  7:38       ` [PATCH 7/9] powerpc: Add VSX assembler code macros Michael Neuling
2008-06-23  7:38       ` [PATCH 5/9] powerpc: Introduce VSX thread_struct and CONFIG_VSX Michael Neuling
2008-06-23  7:38       ` [PATCH 9/9] powerpc: Add CONFIG_VSX config option Michael Neuling
2008-06-23  7:38       ` [PATCH 4/9] powerpc: Make load_up_fpu and load_up_altivec callable Michael Neuling
2008-06-23  7:38       ` [PATCH 6/9] powerpc: Add VSX CPU feature Michael Neuling
2008-06-24 10:57       ` [PATCH 0/9] powerpc: Add kernel support for POWER7 VSX Michael Neuling
2008-06-24 10:57         ` [PATCH 3/9] powerpc: Move altivec_unavailable Michael Neuling
2008-06-24 10:57         ` [PATCH 1/9] powerpc: Fix msr setting in 32 bit signal code Michael Neuling
2008-06-24 13:47           ` Kumar Gala
2008-06-24 10:57         ` [PATCH 2/9] powerpc: Add macros to access floating point registers in thread_struct Michael Neuling
2008-06-24 14:07           ` Kumar Gala
2008-06-24 16:33             ` Segher Boessenkool
2008-06-25  0:25             ` Michael Neuling
2008-06-24 10:57         ` [PATCH 7/9] powerpc: Add VSX assembler code macros Michael Neuling
2008-06-24 14:06           ` Kumar Gala
2008-06-25  0:06             ` Michael Neuling
2008-06-25  2:19               ` Kumar Gala
2008-06-24 10:57         ` [PATCH 5/9] powerpc: Introduce VSX thread_struct and CONFIG_VSX Michael Neuling
2008-06-24 10:57         ` [PATCH 9/9] powerpc: Add CONFIG_VSX config option Michael Neuling
2008-06-24 14:19           ` Kumar Gala
2008-06-24 10:57         ` [PATCH 8/9] powerpc: Add VSX context save/restore, ptrace and signal support Michael Neuling
2008-06-24 10:57         ` [PATCH 4/9] powerpc: Make load_up_fpu and load_up_altivec callable Michael Neuling
2008-06-24 14:01           ` Kumar Gala
2008-06-24 10:57         ` [PATCH 6/9] powerpc: Add VSX CPU feature Michael Neuling
2008-06-24 14:19           ` Kumar Gala
2008-06-25  4:07         ` [PATCH 0/9] powerpc: Add kernel support for POWER7 VSX Michael Neuling
2008-06-25  4:07           ` [PATCH 1/9] powerpc: Fix msr setting in 32 bit signal code Michael Neuling
2008-06-25  4:07           ` [PATCH 2/9] powerpc: Add macros to access floating point registers in thread_struct Michael Neuling
2008-06-25 14:08             ` Kumar Gala
2008-06-25 15:34               ` Scott Wood
2008-06-25 16:12                 ` Gabriel Paubert
2008-06-25 16:17                   ` Scott Wood
2008-06-25 17:07                     ` Kumar Gala
2008-06-26  0:09                       ` Michael Neuling
2008-06-26  7:07                         ` [PATCH] " Michael Neuling
2008-06-26 10:44                     ` [PATCH 2/9] " Gabriel Paubert
2008-06-25 17:08                   ` Andreas Schwab
2008-06-25  4:07           ` [PATCH 6/9] powerpc: Add VSX CPU feature Michael Neuling
2008-06-25  4:07           ` [PATCH 8/9] powerpc: Add VSX context save/restore, ptrace and signal support Michael Neuling
2008-06-25  4:07           ` [PATCH 9/9] powerpc: Add CONFIG_VSX config option Michael Neuling
2008-06-25  4:07           ` [PATCH 5/9] powerpc: Introduce VSX thread_struct and CONFIG_VSX Michael Neuling
2008-06-25  4:07           ` [PATCH 7/9] powerpc: Add VSX assembler code macros Michael Neuling
2008-06-25  4:07           ` [PATCH 4/9] powerpc: Make load_up_fpu and load_up_altivec callable Michael Neuling
2008-06-25  4:07           ` [PATCH 3/9] powerpc: Move altivec_unavailable Michael Neuling

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=14228.1213850120@neuling.org \
    --to=mikey@neuling.org \
    --cc=galak@kernel.crashing.org \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=paulus@samba.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.