linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Consolidate mm_context_t definition in mmu.h
@ 2007-07-10 15:01 Josh Boyer
  2007-07-10 16:36 ` Arnd Bergmann
  2007-07-11 10:33 ` Christoph Hellwig
  0 siblings, 2 replies; 6+ messages in thread
From: Josh Boyer @ 2007-07-10 15:01 UTC (permalink / raw)
  To: paulus; +Cc: linuxppc-dev, david

All of the platforms except PPC64 share a common mm_context_t definition.
Defining it in mmu.h avoids duplicating it in the platform specific mmu
header files.

Signed-off-by: Josh Boyer <jwboyer@linux.vnet.ibm.com>

---
 include/asm-powerpc/mmu-44x.h       |    5 -----
 include/asm-powerpc/mmu-8xx.h       |    4 ----
 include/asm-powerpc/mmu-fsl-booke.h |    4 ----
 include/asm-powerpc/mmu-hash32.h    |    5 -----
 include/asm-powerpc/mmu-hash64.h    |   16 ----------------
 include/asm-powerpc/mmu.h           |   28 ++++++++++++++++++++++++++++
 6 files changed, 28 insertions(+), 34 deletions(-)

--- linux-2.6.orig/include/asm-powerpc/mmu-44x.h
+++ linux-2.6/include/asm-powerpc/mmu-44x.h
@@ -55,11 +55,6 @@
 
 typedef unsigned long long phys_addr_t;
 
-typedef struct {
-	unsigned long id;
-	unsigned long vdso_base;
-} mm_context_t;
-
 #endif /* !__ASSEMBLY__ */
 
 #ifndef CONFIG_PPC_EARLY_DEBUG_44x
--- linux-2.6.orig/include/asm-powerpc/mmu-8xx.h
+++ linux-2.6/include/asm-powerpc/mmu-8xx.h
@@ -138,10 +138,6 @@
 #ifndef __ASSEMBLY__
 typedef unsigned long phys_addr_t;
 
-typedef struct {
-	unsigned long id;
-	unsigned long vdso_base;
-} mm_context_t;
 #endif /* !__ASSEMBLY__ */
 
 #endif /* _ASM_POWERPC_MMU_8XX_H_ */
--- linux-2.6.orig/include/asm-powerpc/mmu-fsl-booke.h
+++ linux-2.6/include/asm-powerpc/mmu-fsl-booke.h
@@ -79,10 +79,6 @@ typedef unsigned long phys_addr_t;
 typedef unsigned long long phys_addr_t;
 #endif
 
-typedef struct {
-	unsigned long id;
-	unsigned long vdso_base;
-} mm_context_t;
 #endif /* !__ASSEMBLY__ */
 
 #endif /* _ASM_POWERPC_MMU_FSL_BOOKE_H_ */
--- linux-2.6.orig/include/asm-powerpc/mmu-hash32.h
+++ linux-2.6/include/asm-powerpc/mmu-hash32.h
@@ -79,11 +79,6 @@ struct hash_pte {
 	unsigned long pp:2;	/* Page protection */
 };
 
-typedef struct {
-	unsigned long id;
-	unsigned long vdso_base;
-} mm_context_t;
-
 typedef unsigned long phys_addr_t;
 
 #endif /* !__ASSEMBLY__ */
--- linux-2.6.orig/include/asm-powerpc/mmu-hash64.h
+++ linux-2.6/include/asm-powerpc/mmu-hash64.h
@@ -359,22 +359,6 @@ extern void stab_initialize(unsigned lon
 
 #ifndef __ASSEMBLY__
 
-typedef unsigned long mm_context_id_t;
-
-typedef struct {
-	mm_context_id_t id;
-	u16 user_psize;		/* page size index */
-
-#ifdef CONFIG_PPC_MM_SLICES
-	u64 low_slices_psize;	/* SLB page size encodings */
-	u64 high_slices_psize;  /* 4 bits per slice for now */
-#else
-	u16 sllp;		/* SLB page size encoding */
-#endif
-	unsigned long vdso_base;
-} mm_context_t;
-
-
 static inline unsigned long vsid_scramble(unsigned long protovsid)
 {
 #if 0
--- linux-2.6.orig/include/asm-powerpc/mmu.h
+++ linux-2.6/include/asm-powerpc/mmu.h
@@ -19,5 +19,33 @@
 #  include <asm/mmu-8xx.h>
 #endif
 
+#ifndef __ASSEMBLY__
+
+#ifdef CONFIG_PPC64
+typedef unsigned long mm_context_id_t;
+
+typedef struct {
+	mm_context_id_t id;
+	u16 user_psize;		/* page size index */
+
+#ifdef CONFIG_PPC_MM_SLICES
+	u64 low_slices_psize;	/* SLB page size encodings */
+	u64 high_slices_psize;  /* 4 bits per slice for now */
+#else
+	u16 sllp;		/* SLB page size encoding */
+#endif
+	unsigned long vdso_base;
+} mm_context_t;
+
+#else /* !CONFIG_PPC64 */
+
+typedef struct {
+	unsigned long id;
+	unsigned long vdso_base;
+} mm_context_t;
+
+#endif /* CONFIG_PPC64 */
+#endif /* !__ASSEMBLY__ */
+
 #endif /* __KERNEL__ */
 #endif /* _ASM_POWERPC_MMU_H_ */

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Consolidate mm_context_t definition in mmu.h
  2007-07-10 15:01 [PATCH] Consolidate mm_context_t definition in mmu.h Josh Boyer
@ 2007-07-10 16:36 ` Arnd Bergmann
  2007-07-10 16:47   ` Josh Boyer
  2007-07-11 10:33 ` Christoph Hellwig
  1 sibling, 1 reply; 6+ messages in thread
From: Arnd Bergmann @ 2007-07-10 16:36 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: paulus, david

On Tuesday 10 July 2007, Josh Boyer wrote:
> +#ifdef CONFIG_PPC64
> +typedef unsigned long mm_context_id_t;
> +
> +typedef struct {
> +=A0=A0=A0=A0=A0=A0=A0mm_context_id_t id;
> +=A0=A0=A0=A0=A0=A0=A0u16 user_psize;=A0=A0=A0=A0=A0=A0=A0=A0=A0/* page s=
ize index */
> +
> +#ifdef CONFIG_PPC_MM_SLICES
> +=A0=A0=A0=A0=A0=A0=A0u64 low_slices_psize;=A0=A0=A0/* SLB page size enco=
dings */
> +=A0=A0=A0=A0=A0=A0=A0u64 high_slices_psize; =A0/* 4 bits per slice for n=
ow */
> +#else
> +=A0=A0=A0=A0=A0=A0=A0u16 sllp;=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0/* SLB page size encoding */
> +#endif
> +=A0=A0=A0=A0=A0=A0=A0unsigned long vdso_base;
> +} mm_context_t;
> +
> +#else /* !CONFIG_PPC64 */
> +
> +typedef struct {
> +=A0=A0=A0=A0=A0=A0=A0unsigned long id;
> +=A0=A0=A0=A0=A0=A0=A0unsigned long vdso_base;
> +} mm_context_t;
> +
> +#endif /* CONFIG_PPC64 */


It seems to me that you can easily consolidate this further, if you
allow the mm_context_id_t on 32 bit, or remove it on 64 bit:

+typedef unsigned long mm_context_id_t;
+
+typedef struct {
+       mm_context_id_t id;
+       u16 user_psize;         /* page size index */
+
+#ifdef CONFIG_PPC64
+#ifdef CONFIG_PPC_MM_SLICES
+       u64 low_slices_psize;   /* SLB page size encodings */
+       u64 high_slices_psize;  /* 4 bits per slice for now */
+#else
+       u16 sllp;               /* SLB page size encoding */
+#endif
+#endif
+       unsigned long vdso_base;
+} mm_context_t;

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Consolidate mm_context_t definition in mmu.h
  2007-07-10 16:36 ` Arnd Bergmann
@ 2007-07-10 16:47   ` Josh Boyer
  2007-07-10 16:55     ` Arnd Bergmann
  0 siblings, 1 reply; 6+ messages in thread
From: Josh Boyer @ 2007-07-10 16:47 UTC (permalink / raw)
  To: Arnd Bergmann; +Cc: linuxppc-dev, paulus, david

On Tue, 2007-07-10 at 18:36 +0200, Arnd Bergmann wrote:
> On Tuesday 10 July 2007, Josh Boyer wrote:
> > +#ifdef CONFIG_PPC64
> > +typedef unsigned long mm_context_id_t;
> > +
> > +typedef struct {
> > +       mm_context_id_t id;
> > +       u16 user_psize;         /* page size index */
> > +
> > +#ifdef CONFIG_PPC_MM_SLICES
> > +       u64 low_slices_psize;   /* SLB page size encodings */
> > +       u64 high_slices_psize;  /* 4 bits per slice for now */
> > +#else
> > +       u16 sllp;               /* SLB page size encoding */
> > +#endif
> > +       unsigned long vdso_base;
> > +} mm_context_t;
> > +
> > +#else /* !CONFIG_PPC64 */
> > +
> > +typedef struct {
> > +       unsigned long id;
> > +       unsigned long vdso_base;
> > +} mm_context_t;
> > +
> > +#endif /* CONFIG_PPC64 */
> 
> 
> It seems to me that you can easily consolidate this further, if you
> allow the mm_context_id_t on 32 bit, or remove it on 64 bit:

Hm... good point.  Though...

> 
> +typedef unsigned long mm_context_id_t;
> +
> +typedef struct {
> +       mm_context_id_t id;
> +       u16 user_psize;         /* page size index */
> +
> +#ifdef CONFIG_PPC64

This needs to be moved up to encompass the u16 user_psize member as
well, yes?

> +#ifdef CONFIG_PPC_MM_SLICES
> +       u64 low_slices_psize;   /* SLB page size encodings */
> +       u64 high_slices_psize;  /* 4 bits per slice for now */
> +#else
> +       u16 sllp;               /* SLB page size encoding */
> +#endif
> +#endif
> +       unsigned long vdso_base;
> +} mm_context_t;

josh

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Consolidate mm_context_t definition in mmu.h
  2007-07-10 16:47   ` Josh Boyer
@ 2007-07-10 16:55     ` Arnd Bergmann
  0 siblings, 0 replies; 6+ messages in thread
From: Arnd Bergmann @ 2007-07-10 16:55 UTC (permalink / raw)
  To: Josh Boyer; +Cc: linuxppc-dev, paulus, david

On Tuesday 10 July 2007, Josh Boyer wrote:
> > + =A0 =A0 =A0 u16 user_psize; =A0 =A0 =A0 =A0 /* page size index */
> > +
> > +#ifdef CONFIG_PPC64
>=20
> This needs to be moved up to encompass the u16 user_psize member as
> well, yes?
>=20

Yes, of course. my bad.

	Arnd <><

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Consolidate mm_context_t definition in mmu.h
  2007-07-10 15:01 [PATCH] Consolidate mm_context_t definition in mmu.h Josh Boyer
  2007-07-10 16:36 ` Arnd Bergmann
@ 2007-07-11 10:33 ` Christoph Hellwig
  2007-07-11 12:35   ` Josh Boyer
  1 sibling, 1 reply; 6+ messages in thread
From: Christoph Hellwig @ 2007-07-11 10:33 UTC (permalink / raw)
  To: Josh Boyer; +Cc: linuxppc-dev, paulus, david

On Tue, Jul 10, 2007 at 10:01:49AM -0500, Josh Boyer wrote:
> +
> +#ifdef CONFIG_PPC64
> +typedef unsigned long mm_context_id_t;
> +
> +typedef struct {
> +	mm_context_id_t id;
> +	u16 user_psize;		/* page size index */
> +
> +#ifdef CONFIG_PPC_MM_SLICES
> +	u64 low_slices_psize;	/* SLB page size encodings */
> +	u64 high_slices_psize;  /* 4 bits per slice for now */
> +#else
> +	u16 sllp;		/* SLB page size encoding */
> +#endif
> +	unsigned long vdso_base;
> +} mm_context_t;
> +
> +#else /* !CONFIG_PPC64 */
> +
> +typedef struct {
> +	unsigned long id;
> +	unsigned long vdso_base;
> +} mm_context_t;

mm_context_id_t isn't actually used anywhere but in te mm_context_t
definition.  So if you kill it you have two common fields and a bunch
of additional ones for PPC64 leading to a defintion like:

typedef struct {
	unsigned long id;

#ifdef CONFIG_PPC64
	u16 user_psize;		/* page size index */

#ifdef CONFIG_PPC_MM_SLICES
	u64 low_slices_psize;	/* SLB page size encodings */
	u64 high_slices_psize;  /* 4 bits per slice for now */
#else
	u16 sllp;		/* SLB page size encoding */
#endif
#endif

	unsigned long vdso_base;
} mm_context_t;

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Consolidate mm_context_t definition in mmu.h
  2007-07-11 10:33 ` Christoph Hellwig
@ 2007-07-11 12:35   ` Josh Boyer
  0 siblings, 0 replies; 6+ messages in thread
From: Josh Boyer @ 2007-07-11 12:35 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: linuxppc-dev, paulus, david

On Wed, 2007-07-11 at 12:33 +0200, Christoph Hellwig wrote:
> 
> mm_context_id_t isn't actually used anywhere but in te mm_context_t
> definition.  So if you kill it you have two common fields and a bunch
> of additional ones for PPC64 leading to a defintion like:
> 
> typedef struct {
> 	unsigned long id;
> 
> #ifdef CONFIG_PPC64
> 	u16 user_psize;		/* page size index */
> 
> #ifdef CONFIG_PPC_MM_SLICES
> 	u64 low_slices_psize;	/* SLB page size encodings */
> 	u64 high_slices_psize;  /* 4 bits per slice for now */
> #else
> 	u16 sllp;		/* SLB page size encoding */
> #endif
> #endif
> 
> 	unsigned long vdso_base;
> } mm_context_t;

Yes.  I did mostly the same thing in version 2 of the patch, just using
mm_context_id_t instead.  Paul said the ifdefs made his eyes hurt.

josh

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2007-07-11 12:35 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-10 15:01 [PATCH] Consolidate mm_context_t definition in mmu.h Josh Boyer
2007-07-10 16:36 ` Arnd Bergmann
2007-07-10 16:47   ` Josh Boyer
2007-07-10 16:55     ` Arnd Bergmann
2007-07-11 10:33 ` Christoph Hellwig
2007-07-11 12:35   ` Josh Boyer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).