Re: [PATCH 1/2] powerpc: add 16K/64K pages support for the 44x PPC32 architectures.

2008-11-11 Thread Hollis Blanchard
On Tue, 2008-11-11 at 08:19 -0500, Josh Boyer wrote:
 On Fri, Oct 31, 2008 at 06:23:28PM -0500, Hollis Blanchard wrote:
 On Wed, Oct 22, 2008 at 9:28 AM, Christian Ehrhardt
 [EMAIL PROTECTED] wrote:
  Hi Ilya,
  I just tried your patch on my 440 board because it would help us in our
  environment.
  Unfortunately I run into a bug on early boot (mark_bootmem).
 
  A log can be found in this mail, this is the bug when running with 64k page
  size.
  I tried this with and without your 2/2 265k patch and also with page size
  configured to 16k, the error is the same in all cases.
 
  I used an earlier version of your patch in the past and it worked fine.
  Applying this old patch causes the same problem.
  Therefore I expect that there was some other code changed that breaks with
  page size != 4k.
 
 This patch seems to solve the problem for me, but I have to run and
 haven't yet worked out if it's the right fix.
 
 diff --git a/mm/bootmem.c b/mm/bootmem.c
 --- a/mm/bootmem.c
 +++ b/mm/bootmem.c
 @@ -300,7 +300,7 @@ static int __init mark_bootmem(unsigned
 unsigned long max;
 
 if (pos  bdata-node_min_pfn ||
 -   pos = bdata-node_low_pfn) {
 +   pos  bdata-node_low_pfn) {
 BUG_ON(pos != start);
 continue;
 }
 @@ -399,7 +399,7 @@ int __init reserve_bootmem(unsigned long
 unsigned long start, end;
 
 start = PFN_DOWN(addr);
 -   end = PFN_UP(addr + size);
 +   end = PFN_DOWN(addr + size);
 
 return mark_bootmem(start, end, 1, flags);
  }
 
 
 Hollis,  if I'm understanding things correctly this patch is no
 longer needed if we do the memory reserve in the boot wrapper for
 the errata.  Correct?

Correct.

-- 
Hollis Blanchard
IBM Linux Technology Center

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH 1/2] powerpc: add 16K/64K pages support for the 44x PPC32 architectures.

2008-11-11 Thread Josh Boyer
On Fri, Oct 31, 2008 at 06:23:28PM -0500, Hollis Blanchard wrote:
On Wed, Oct 22, 2008 at 9:28 AM, Christian Ehrhardt
[EMAIL PROTECTED] wrote:
 Hi Ilya,
 I just tried your patch on my 440 board because it would help us in our
 environment.
 Unfortunately I run into a bug on early boot (mark_bootmem).

 A log can be found in this mail, this is the bug when running with 64k page
 size.
 I tried this with and without your 2/2 265k patch and also with page size
 configured to 16k, the error is the same in all cases.

 I used an earlier version of your patch in the past and it worked fine.
 Applying this old patch causes the same problem.
 Therefore I expect that there was some other code changed that breaks with
 page size != 4k.

This patch seems to solve the problem for me, but I have to run and
haven't yet worked out if it's the right fix.

diff --git a/mm/bootmem.c b/mm/bootmem.c
--- a/mm/bootmem.c
+++ b/mm/bootmem.c
@@ -300,7 +300,7 @@ static int __init mark_bootmem(unsigned
unsigned long max;

if (pos  bdata-node_min_pfn ||
-   pos = bdata-node_low_pfn) {
+   pos  bdata-node_low_pfn) {
BUG_ON(pos != start);
continue;
}
@@ -399,7 +399,7 @@ int __init reserve_bootmem(unsigned long
unsigned long start, end;

start = PFN_DOWN(addr);
-   end = PFN_UP(addr + size);
+   end = PFN_DOWN(addr + size);

return mark_bootmem(start, end, 1, flags);
 }


Hollis,  if I'm understanding things correctly this patch is no
longer needed if we do the memory reserve in the boot wrapper for
the errata.  Correct?

josh
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH 1/2] powerpc: add 16K/64K pages support for the 44x PPC32 architectures.

2008-11-05 Thread Hollis Blanchard
On Mon, 2008-11-03 at 15:00 -0500, Josh Boyer wrote:
 On Mon, 03 Nov 2008 13:55:21 -0600
 Hollis Blanchard [EMAIL PROTECTED] wrote:
 
  On Mon, 2008-11-03 at 11:43 +1100, Benjamin Herrenschmidt wrote:
Cropping the size of the memory node.  That was simplest to do from the
cuboot wrapper at the time.  If marking it reserved via a reserve map
is more elegant and correct, we could do that.

But I will still like to know what about the other way is hairy please.
   
   I don't like it :-) Bad feeling ... don't like having a memory
   node entry that isn't aligned to some large power of two typically.
  
  More specifically, mm/bootmem.c seems to be making the implicit
  assumption that memory size is an even multiple of PAGE_SIZE. With 4K
  pages, 0x000 bytes of RAM fits; with 64K pages it does not.
 
 Hmm..  I dunno what to think about that.  Again, how does mem= play
 into this?  (I will look myself in a bit, but if someone knows offhand
 that would be nice..)
 
  Using the device tree reserve map stuff does indeed seem to solve the
  problem. However, I really don't understand the layering in
  arch/powerpc/boot at all, so I'll just put this patch out here and
  people can play with wrappers and prototypes all they want:
 
 This actually looks pretty nice.  I'll wait for David to Ack the fdt
 parts.

David?

-- 
Hollis Blanchard
IBM Linux Technology Center

  powerpc/4xx: work around CHIP11 errata in a more PAGE_SIZE-friendly way
  
  The current CHIP11 errata truncates the device tree memory node, and 
  assumes a
  4K page size. This breaks kernels with non-4K PAGE_SIZE.
  
  Instead, use a device tree memory reservation to reserve only the 256 bytes
  actually affected by the errata, leaving the total memory size unaltered.
  
  Signed-off-by: Hollis Blanchard [EMAIL PROTECTED]
  
  diff --git a/arch/powerpc/boot/4xx.c b/arch/powerpc/boot/4xx.c
  --- a/arch/powerpc/boot/4xx.c
  +++ b/arch/powerpc/boot/4xx.c
  @@ -21,7 +21,7 @@
   #include reg.h
   #include dcr.h
  
  -static unsigned long chip_11_errata(unsigned long memsize)
  +static void chip_11_errata(unsigned long memsize)
   {
  unsigned long pvr;
  
  @@ -31,13 +31,11 @@ static unsigned long chip_11_errata(unsi
  case 0x4850:
  case 0x48d0:
  case 0x28d0:
  -   memsize -= 4096;
  +   fdt_reserve_mem(memsize - 256, 256);
  break;
  default:
  break;
  }
  -
  -   return memsize;
   }
  
   /* Read the 4xx SDRAM controller to get size of system memory. */
  @@ -53,7 +51,7 @@ void ibm4xx_sdram_fixup_memsize(void)
  memsize += SDRAM_CONFIG_BANK_SIZE(bank_config);
  }
  
  -   memsize = chip_11_errata(memsize);
  +   chip_11_errata(memsize);
  dt_fixup_memory(0, memsize);
   }
  
  @@ -219,7 +217,7 @@ void ibm4xx_denali_fixup_memsize(void)
  bank = 4; /* 4 banks */
  
  memsize = cs * (1  (col+row)) * bank * dpath;
  -   memsize = chip_11_errata(memsize);
  +   chip_11_errata(memsize);
  dt_fixup_memory(0, memsize);
   }
  
  diff --git a/arch/powerpc/boot/libfdt-wrapper.c 
  b/arch/powerpc/boot/libfdt-wrapper.c
  --- a/arch/powerpc/boot/libfdt-wrapper.c
  +++ b/arch/powerpc/boot/libfdt-wrapper.c
  @@ -167,6 +167,11 @@ static unsigned long fdt_wrapper_finaliz
  return (unsigned long)fdt;
   }
  
  +int fdt_reserve_mem(unsigned long addr, unsigned long bytes)
  +{
  +   return fdt_add_mem_rsv(fdt, addr, bytes);
  +}
  +
   void fdt_init(void *blob)
   {
  int err;
  diff --git a/arch/powerpc/boot/ops.h b/arch/powerpc/boot/ops.h
  --- a/arch/powerpc/boot/ops.h
  +++ b/arch/powerpc/boot/ops.h
  @@ -83,6 +83,7 @@ extern struct loader_info loader_info;
  
   void start(void);
   void fdt_init(void *blob);
  +int fdt_reserve_mem(unsigned long addr, unsigned long bytes);
   int serial_console_init(void);
   int ns16550_console_init(void *devp, struct serial_console_data *scdp);
   int mpsc_console_init(void *devp, struct serial_console_data *scdp);
  
  

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH 1/2] powerpc: add 16K/64K pages support for the 44x PPC32 architectures.

2008-11-05 Thread David Gibson
On Wed, Nov 05, 2008 at 11:33:28AM -0600, Hollis Blanchard wrote:
 On Mon, 2008-11-03 at 15:00 -0500, Josh Boyer wrote:
  On Mon, 03 Nov 2008 13:55:21 -0600
  Hollis Blanchard [EMAIL PROTECTED] wrote:
  
   On Mon, 2008-11-03 at 11:43 +1100, Benjamin Herrenschmidt wrote:
 Cropping the size of the memory node.  That was simplest to do from 
 the
 cuboot wrapper at the time.  If marking it reserved via a reserve map
 is more elegant and correct, we could do that.
 
 But I will still like to know what about the other way is hairy 
 please.

I don't like it :-) Bad feeling ... don't like having a memory
node entry that isn't aligned to some large power of two typically.
   
   More specifically, mm/bootmem.c seems to be making the implicit
   assumption that memory size is an even multiple of PAGE_SIZE. With 4K
   pages, 0x000 bytes of RAM fits; with 64K pages it does not.
  
  Hmm..  I dunno what to think about that.  Again, how does mem= play
  into this?  (I will look myself in a bit, but if someone knows offhand
  that would be nice..)
  
   Using the device tree reserve map stuff does indeed seem to solve the
   problem. However, I really don't understand the layering in
   arch/powerpc/boot at all, so I'll just put this patch out here and
   people can play with wrappers and prototypes all they want:
  
  This actually looks pretty nice.  I'll wait for David to Ack the fdt
  parts.
 
 David?

Sorry, I've been on leave for a few days.

I assume you mean the new call through to fdt_add_mem_rsv().

Hrm.. currently all the things in fdt_wrapper are hooks called through
dt_ops.  Adding such a trivial wrapper seems a little silly.  There
have been other people wanting to use other libfdt features directly,
knowing that they have a flat tree on their system.  I think it would
be more sensible, I think, to just expose the global fdt pointer, so
that people can use the libfdt functions directly, without having to
go through the wrapper code.

Unless of course there is occasion to use this add reserve callback
on real OF systems, in which case it should be a new dt_ops hook.

-- 
David Gibson| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au  | minimalist, thank you.  NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH 1/2] powerpc: add 16K/64K pages support for the 44x PPC32 architectures.

2008-11-03 Thread Josh Boyer
On Mon, 03 Nov 2008 11:43:54 +1100
Benjamin Herrenschmidt [EMAIL PROTECTED] wrote:

 
  Cropping the size of the memory node.  That was simplest to do from the
  cuboot wrapper at the time.  If marking it reserved via a reserve map
  is more elegant and correct, we could do that.
  
  But I will still like to know what about the other way is hairy please.
 
 I don't like it :-) Bad feeling ... don't like having a memory
 node entry that isn't aligned to some large power of two typically.

Erm, ok.  And does your heebie-geebies extend to people using the mem=
parameter in a similar fashion?

josh
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH 1/2] powerpc: add 16K/64K pages support for the 44x PPC32 architectures.

2008-11-03 Thread Hollis Blanchard
On Mon, 2008-11-03 at 11:43 +1100, Benjamin Herrenschmidt wrote:
  Cropping the size of the memory node.  That was simplest to do from the
  cuboot wrapper at the time.  If marking it reserved via a reserve map
  is more elegant and correct, we could do that.
  
  But I will still like to know what about the other way is hairy please.
 
 I don't like it :-) Bad feeling ... don't like having a memory
 node entry that isn't aligned to some large power of two typically.

More specifically, mm/bootmem.c seems to be making the implicit
assumption that memory size is an even multiple of PAGE_SIZE. With 4K
pages, 0x000 bytes of RAM fits; with 64K pages it does not.

Using the device tree reserve map stuff does indeed seem to solve the
problem. However, I really don't understand the layering in
arch/powerpc/boot at all, so I'll just put this patch out here and
people can play with wrappers and prototypes all they want:



powerpc/4xx: work around CHIP11 errata in a more PAGE_SIZE-friendly way

The current CHIP11 errata truncates the device tree memory node, and assumes a
4K page size. This breaks kernels with non-4K PAGE_SIZE.

Instead, use a device tree memory reservation to reserve only the 256 bytes
actually affected by the errata, leaving the total memory size unaltered.

Signed-off-by: Hollis Blanchard [EMAIL PROTECTED]

diff --git a/arch/powerpc/boot/4xx.c b/arch/powerpc/boot/4xx.c
--- a/arch/powerpc/boot/4xx.c
+++ b/arch/powerpc/boot/4xx.c
@@ -21,7 +21,7 @@
 #include reg.h
 #include dcr.h
 
-static unsigned long chip_11_errata(unsigned long memsize)
+static void chip_11_errata(unsigned long memsize)
 {
unsigned long pvr;
 
@@ -31,13 +31,11 @@ static unsigned long chip_11_errata(unsi
case 0x4850:
case 0x48d0:
case 0x28d0:
-   memsize -= 4096;
+   fdt_reserve_mem(memsize - 256, 256);
break;
default:
break;
}
-
-   return memsize;
 }
 
 /* Read the 4xx SDRAM controller to get size of system memory. */
@@ -53,7 +51,7 @@ void ibm4xx_sdram_fixup_memsize(void)
memsize += SDRAM_CONFIG_BANK_SIZE(bank_config);
}
 
-   memsize = chip_11_errata(memsize);
+   chip_11_errata(memsize);
dt_fixup_memory(0, memsize);
 }
 
@@ -219,7 +217,7 @@ void ibm4xx_denali_fixup_memsize(void)
bank = 4; /* 4 banks */
 
memsize = cs * (1  (col+row)) * bank * dpath;
-   memsize = chip_11_errata(memsize);
+   chip_11_errata(memsize);
dt_fixup_memory(0, memsize);
 }
 
diff --git a/arch/powerpc/boot/libfdt-wrapper.c 
b/arch/powerpc/boot/libfdt-wrapper.c
--- a/arch/powerpc/boot/libfdt-wrapper.c
+++ b/arch/powerpc/boot/libfdt-wrapper.c
@@ -167,6 +167,11 @@ static unsigned long fdt_wrapper_finaliz
return (unsigned long)fdt;
 }
 
+int fdt_reserve_mem(unsigned long addr, unsigned long bytes)
+{
+   return fdt_add_mem_rsv(fdt, addr, bytes);
+}
+
 void fdt_init(void *blob)
 {
int err;
diff --git a/arch/powerpc/boot/ops.h b/arch/powerpc/boot/ops.h
--- a/arch/powerpc/boot/ops.h
+++ b/arch/powerpc/boot/ops.h
@@ -83,6 +83,7 @@ extern struct loader_info loader_info;
 
 void start(void);
 void fdt_init(void *blob);
+int fdt_reserve_mem(unsigned long addr, unsigned long bytes);
 int serial_console_init(void);
 int ns16550_console_init(void *devp, struct serial_console_data *scdp);
 int mpsc_console_init(void *devp, struct serial_console_data *scdp);


-- 
Hollis Blanchard
IBM Linux Technology Center

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH 1/2] powerpc: add 16K/64K pages support for the 44x PPC32 architectures.

2008-11-03 Thread Josh Boyer
On Mon, 03 Nov 2008 13:55:21 -0600
Hollis Blanchard [EMAIL PROTECTED] wrote:

 On Mon, 2008-11-03 at 11:43 +1100, Benjamin Herrenschmidt wrote:
   Cropping the size of the memory node.  That was simplest to do from the
   cuboot wrapper at the time.  If marking it reserved via a reserve map
   is more elegant and correct, we could do that.
   
   But I will still like to know what about the other way is hairy please.
  
  I don't like it :-) Bad feeling ... don't like having a memory
  node entry that isn't aligned to some large power of two typically.
 
 More specifically, mm/bootmem.c seems to be making the implicit
 assumption that memory size is an even multiple of PAGE_SIZE. With 4K
 pages, 0x000 bytes of RAM fits; with 64K pages it does not.

Hmm..  I dunno what to think about that.  Again, how does mem= play
into this?  (I will look myself in a bit, but if someone knows offhand
that would be nice..)

 Using the device tree reserve map stuff does indeed seem to solve the
 problem. However, I really don't understand the layering in
 arch/powerpc/boot at all, so I'll just put this patch out here and
 people can play with wrappers and prototypes all they want:

This actually looks pretty nice.  I'll wait for David to Ack the fdt
parts.

josh

 powerpc/4xx: work around CHIP11 errata in a more PAGE_SIZE-friendly way
 
 The current CHIP11 errata truncates the device tree memory node, and assumes a
 4K page size. This breaks kernels with non-4K PAGE_SIZE.
 
 Instead, use a device tree memory reservation to reserve only the 256 bytes
 actually affected by the errata, leaving the total memory size unaltered.
 
 Signed-off-by: Hollis Blanchard [EMAIL PROTECTED]
 
 diff --git a/arch/powerpc/boot/4xx.c b/arch/powerpc/boot/4xx.c
 --- a/arch/powerpc/boot/4xx.c
 +++ b/arch/powerpc/boot/4xx.c
 @@ -21,7 +21,7 @@
  #include reg.h
  #include dcr.h
 
 -static unsigned long chip_11_errata(unsigned long memsize)
 +static void chip_11_errata(unsigned long memsize)
  {
   unsigned long pvr;
 
 @@ -31,13 +31,11 @@ static unsigned long chip_11_errata(unsi
   case 0x4850:
   case 0x48d0:
   case 0x28d0:
 - memsize -= 4096;
 + fdt_reserve_mem(memsize - 256, 256);
   break;
   default:
   break;
   }
 -
 - return memsize;
  }
 
  /* Read the 4xx SDRAM controller to get size of system memory. */
 @@ -53,7 +51,7 @@ void ibm4xx_sdram_fixup_memsize(void)
   memsize += SDRAM_CONFIG_BANK_SIZE(bank_config);
   }
 
 - memsize = chip_11_errata(memsize);
 + chip_11_errata(memsize);
   dt_fixup_memory(0, memsize);
  }
 
 @@ -219,7 +217,7 @@ void ibm4xx_denali_fixup_memsize(void)
   bank = 4; /* 4 banks */
 
   memsize = cs * (1  (col+row)) * bank * dpath;
 - memsize = chip_11_errata(memsize);
 + chip_11_errata(memsize);
   dt_fixup_memory(0, memsize);
  }
 
 diff --git a/arch/powerpc/boot/libfdt-wrapper.c 
 b/arch/powerpc/boot/libfdt-wrapper.c
 --- a/arch/powerpc/boot/libfdt-wrapper.c
 +++ b/arch/powerpc/boot/libfdt-wrapper.c
 @@ -167,6 +167,11 @@ static unsigned long fdt_wrapper_finaliz
   return (unsigned long)fdt;
  }
 
 +int fdt_reserve_mem(unsigned long addr, unsigned long bytes)
 +{
 + return fdt_add_mem_rsv(fdt, addr, bytes);
 +}
 +
  void fdt_init(void *blob)
  {
   int err;
 diff --git a/arch/powerpc/boot/ops.h b/arch/powerpc/boot/ops.h
 --- a/arch/powerpc/boot/ops.h
 +++ b/arch/powerpc/boot/ops.h
 @@ -83,6 +83,7 @@ extern struct loader_info loader_info;
 
  void start(void);
  void fdt_init(void *blob);
 +int fdt_reserve_mem(unsigned long addr, unsigned long bytes);
  int serial_console_init(void);
  int ns16550_console_init(void *devp, struct serial_console_data *scdp);
  int mpsc_console_init(void *devp, struct serial_console_data *scdp);
 
 
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH 1/2] powerpc: add 16K/64K pages support for the 44x PPC32 architectures.

2008-11-03 Thread Benjamin Herrenschmidt
On Mon, 2008-11-03 at 06:26 -0500, Josh Boyer wrote:
 On Mon, 03 Nov 2008 11:43:54 +1100
 Benjamin Herrenschmidt [EMAIL PROTECTED] wrote:
 
  
   Cropping the size of the memory node.  That was simplest to do from the
   cuboot wrapper at the time.  If marking it reserved via a reserve map
   is more elegant and correct, we could do that.
   
   But I will still like to know what about the other way is hairy please.
  
  I don't like it :-) Bad feeling ... don't like having a memory
  node entry that isn't aligned to some large power of two typically.
 
 Erm, ok.  And does your heebie-geebies extend to people using the mem=
 parameter in a similar fashion?

Nah, not really. It's not that it won't work, I suppose it does, though
I would have preferred a way to reserve that memory rather than take
it off. In fact, that last page could be used for other things, for
example it could be used as a dummy page to point stale DMA to or
whatever else.

Ben.


___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH 1/2] powerpc: add 16K/64K pages support for the 44x PPC32 architectures.

2008-11-02 Thread Josh Boyer
On Sun, Nov 02, 2008 at 08:55:02AM +1100, Benjamin Herrenschmidt wrote:
On Sat, 2008-11-01 at 07:30 -0400, Josh Boyer wrote:
 
 That is on purpose.  The chip has an errata that causes badness if
 you use the last XX bytes of DRAM.  I forget exactly what XX is, but
 we just remove the last page.

Doing that from the device-tree is very hairy tho... you end up with
informations in there that aren't aligned etc... oh well.

What?  -ENOTVERBOSEENOUGH.

I don't see how this is really different from U-Boot just passing in
a smaller memory size in the old arch/ppc world.  (And I think U-Boot
will actually fixup the device tree in a similar manner itself these
days.)  So if there are problems with this, please do tell.

josh
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH 1/2] powerpc: add 16K/64K pages support for the 44x PPC32 architectures.

2008-11-02 Thread Benjamin Herrenschmidt
On Sun, 2008-11-02 at 08:41 -0500, Josh Boyer wrote:
 On Sun, Nov 02, 2008 at 08:55:02AM +1100, Benjamin Herrenschmidt wrote:
 On Sat, 2008-11-01 at 07:30 -0400, Josh Boyer wrote:
  
  That is on purpose.  The chip has an errata that causes badness if
  you use the last XX bytes of DRAM.  I forget exactly what XX is, but
  we just remove the last page.
 
 Doing that from the device-tree is very hairy tho... you end up with
 informations in there that aren't aligned etc... oh well.
 
 What?  -ENOTVERBOSEENOUGH.
 
 I don't see how this is really different from U-Boot just passing in
 a smaller memory size in the old arch/ppc world.  (And I think U-Boot
 will actually fixup the device tree in a similar manner itself these
 days.)  So if there are problems with this, please do tell.

Is it cropping the memory nodes or using the reserve map ?

Ben.


___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH 1/2] powerpc: add 16K/64K pages support for the 44x PPC32 architectures.

2008-11-02 Thread Josh Boyer
On Mon, 03 Nov 2008 08:33:16 +1100
Benjamin Herrenschmidt [EMAIL PROTECTED] wrote:

 On Sun, 2008-11-02 at 08:41 -0500, Josh Boyer wrote:
  On Sun, Nov 02, 2008 at 08:55:02AM +1100, Benjamin Herrenschmidt wrote:
  On Sat, 2008-11-01 at 07:30 -0400, Josh Boyer wrote:
   
   That is on purpose.  The chip has an errata that causes badness if
   you use the last XX bytes of DRAM.  I forget exactly what XX is, but
   we just remove the last page.
  
  Doing that from the device-tree is very hairy tho... you end up with
  informations in there that aren't aligned etc... oh well.
  
  What?  -ENOTVERBOSEENOUGH.
  
  I don't see how this is really different from U-Boot just passing in
  a smaller memory size in the old arch/ppc world.  (And I think U-Boot
  will actually fixup the device tree in a similar manner itself these
  days.)  So if there are problems with this, please do tell.
 
 Is it cropping the memory nodes or using the reserve map ?

Cropping the size of the memory node.  That was simplest to do from the
cuboot wrapper at the time.  If marking it reserved via a reserve map
is more elegant and correct, we could do that.

But I will still like to know what about the other way is hairy please.

josh
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH 1/2] powerpc: add 16K/64K pages support for the 44x PPC32 architectures.

2008-11-02 Thread Benjamin Herrenschmidt

 Cropping the size of the memory node.  That was simplest to do from the
 cuboot wrapper at the time.  If marking it reserved via a reserve map
 is more elegant and correct, we could do that.
 
 But I will still like to know what about the other way is hairy please.

I don't like it :-) Bad feeling ... don't like having a memory
node entry that isn't aligned to some large power of two typically.

Cheers,
Ben.


___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH 1/2] powerpc: add 16K/64K pages support for the 44x PPC32 architectures.

2008-11-01 Thread Josh Boyer
On Fri, Oct 31, 2008 at 06:23:28PM -0500, Hollis Blanchard wrote:
On Wed, Oct 22, 2008 at 9:28 AM, Christian Ehrhardt
[EMAIL PROTECTED] wrote:
 Hi Ilya,
 I just tried your patch on my 440 board because it would help us in our
 environment.
 Unfortunately I run into a bug on early boot (mark_bootmem).

 A log can be found in this mail, this is the bug when running with 64k page
 size.
 I tried this with and without your 2/2 265k patch and also with page size
 configured to 16k, the error is the same in all cases.

 I used an earlier version of your patch in the past and it worked fine.
 Applying this old patch causes the same problem.
 Therefore I expect that there was some other code changed that breaks with
 page size != 4k.

This patch seems to solve the problem for me, but I have to run and
haven't yet worked out if it's the right fix.

diff --git a/mm/bootmem.c b/mm/bootmem.c
--- a/mm/bootmem.c
+++ b/mm/bootmem.c
@@ -300,7 +300,7 @@ static int __init mark_bootmem(unsigned
unsigned long max;

if (pos  bdata-node_min_pfn ||
-   pos = bdata-node_low_pfn) {
+   pos  bdata-node_low_pfn) {
BUG_ON(pos != start);
continue;
}
@@ -399,7 +399,7 @@ int __init reserve_bootmem(unsigned long
unsigned long start, end;

start = PFN_DOWN(addr);
-   end = PFN_UP(addr + size);
+   end = PFN_DOWN(addr + size);

return mark_bootmem(start, end, 1, flags);
 }

Looks like the breakage may have been accidentally introduced by
Johannes Weiner [EMAIL PROTECTED] on Jul 24 (post 2.6.26).

FWIW, the boards Christian and I are hitting the problem on are
Sequoias with 256MB of RAM. cuImage is reporting only 0x000 bytes
of RAM though, which may be exacerbating the situation.

That is on purpose.  The chip has an errata that causes badness if
you use the last XX bytes of DRAM.  I forget exactly what XX is, but
we just remove the last page.

josh
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH 1/2] powerpc: add 16K/64K pages support for the 44x PPC32 architectures.

2008-11-01 Thread Benjamin Herrenschmidt
On Sat, 2008-11-01 at 07:30 -0400, Josh Boyer wrote:
 
 That is on purpose.  The chip has an errata that causes badness if
 you use the last XX bytes of DRAM.  I forget exactly what XX is, but
 we just remove the last page.

Doing that from the device-tree is very hairy tho... you end up with
informations in there that aren't aligned etc... oh well.

Ben.


___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH 1/2] powerpc: add 16K/64K pages support for the 44x PPC32 architectures.

2008-10-31 Thread Hollis Blanchard
On Wed, Oct 22, 2008 at 9:28 AM, Christian Ehrhardt
[EMAIL PROTECTED] wrote:
 Hi Ilya,
 I just tried your patch on my 440 board because it would help us in our
 environment.
 Unfortunately I run into a bug on early boot (mark_bootmem).

 A log can be found in this mail, this is the bug when running with 64k page
 size.
 I tried this with and without your 2/2 265k patch and also with page size
 configured to 16k, the error is the same in all cases.

 I used an earlier version of your patch in the past and it worked fine.
 Applying this old patch causes the same problem.
 Therefore I expect that there was some other code changed that breaks with
 page size != 4k.

This patch seems to solve the problem for me, but I have to run and
haven't yet worked out if it's the right fix.

diff --git a/mm/bootmem.c b/mm/bootmem.c
--- a/mm/bootmem.c
+++ b/mm/bootmem.c
@@ -300,7 +300,7 @@ static int __init mark_bootmem(unsigned
unsigned long max;

if (pos  bdata-node_min_pfn ||
-   pos = bdata-node_low_pfn) {
+   pos  bdata-node_low_pfn) {
BUG_ON(pos != start);
continue;
}
@@ -399,7 +399,7 @@ int __init reserve_bootmem(unsigned long
unsigned long start, end;

start = PFN_DOWN(addr);
-   end = PFN_UP(addr + size);
+   end = PFN_DOWN(addr + size);

return mark_bootmem(start, end, 1, flags);
 }

Looks like the breakage may have been accidentally introduced by
Johannes Weiner [EMAIL PROTECTED] on Jul 24 (post 2.6.26).

FWIW, the boards Christian and I are hitting the problem on are
Sequoias with 256MB of RAM. cuImage is reporting only 0x000 bytes
of RAM though, which may be exacerbating the situation.

-Hollis
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH 1/2] powerpc: add 16K/64K pages support for the 44x PPC32 architectures.

2008-10-22 Thread Christian Ehrhardt

Hi Ilya,
I just tried your patch on my 440 board because it would help us in our 
environment.

Unfortunately I run into a bug on early boot (mark_bootmem).

A log can be found in this mail, this is the bug when running with 64k 
page size.
I tried this with and without your 2/2 265k patch and also with page 
size configured to 16k, the error is the same in all cases.


I used an earlier version of your patch in the past and it worked fine. 
Applying this old patch causes the same problem.
Therefore I expect that there was some other code changed that breaks 
with page size != 4k.


I did not check that in detail yet, but I would be happy for every hint 
I could get to fix this.


= bootm
## Booting kernel from Legacy Image at 0400 ...
  Image Name:   Linux-2.6.27-dirty
  Image Type:   PowerPC Linux Kernel Image (gzip compressed)
  Data Size:1512203 Bytes =  1.4 MB
  Load Address: 0040
  Entry Point:  00400458
  Verifying Checksum ... OK
  Uncompressing Kernel Image ... OK
CPU clock-frequency - 0x27bc86a4 (667MHz)
CPU timebase-frequency - 0x27bc86a4 (667MHz)
/plb: clock-frequency - 9ef21a9 (167MHz)
/plb/opb: clock-frequency - 4f790d4 (83MHz)
/plb/opb/ebc: clock-frequency - 34fb5e3 (56MHz)
/plb/opb/[EMAIL PROTECTED]: clock-frequency - a8c000 (11MHz)
/plb/opb/[EMAIL PROTECTED]: clock-frequency - a8c000 (11MHz)
/plb/opb/[EMAIL PROTECTED]: clock-frequency - 42ecac (4MHz)
/plb/opb/[EMAIL PROTECTED]: clock-frequency - 42ecac (4MHz)
Memory - 0x0 0x0 0x000 (255MB)
ethernet0: local-mac-address - 00:10:ec:00:e2:3e
ethernet1: local-mac-address - 00:10:ec:80:e2:3e

zImage starting: loaded at 0x0040 (sp: 0x0fe3c820)
Allocating 0x3c54dc bytes for kernel ...
gunzipping (0x - 0x0040e000:0x007a2428)...done 0x380a90 bytes

Linux/PowerPC load: console=ttyS0,115200 ip=dhcp 
nfsroot=192.168.1.2:/home/paelzer/ubuntu_ppc.8.04 root=/dev/nfs rw

Finalizing device tree... flat tree at 0x40bed8
Using PowerPC 44x Platform machine description
Linux version 2.6.27-dirty ([EMAIL PROTECTED]) (gcc version 4.2.3) #5 
Wed Oct 22 15:15:40 CEST 2008

console [udbg0] enabled
[ cut here ]
Kernel BUG at c02be6cc [verbose debug info unavailable]
Oops: Exception in kernel mode, sig: 5 [#1]
PowerPC 44x Platform
NIP: c02be6cc LR: c02ba4e4 CTR: 
REGS: c0351eb0 TRAP: 0700   Not tainted  (2.6.27-dirty)
MSR: 00021000 ME  CR: 22004022  XER: 005f
TASK = c03204a8[0] 'swapper' THREAD: c035
GPR00: c02d0a1c c0351f60 c03204a8 0fff 1000 0001  

GPR08: e000   c02d0a14 2224  0ffa6800 
0ffbf000
GPR16: c02ed838 bfe8f45c   0ffa7500 0fe3cb20 0001 
c02d0a1c
GPR24:  0001 1000 0fff c039 0fff c039d1d0 
c02d0a08

NIP [c02be6cc] mark_bootmem+0xe0/0x124
LR [c02ba4e4] do_init_bootmem+0x134/0x168
Call Trace:
[c0351f60] [c02be6a4] mark_bootmem+0xb8/0x124 (unreliable)
[c0351f90] [c02ba4e4] do_init_bootmem+0x134/0x168
[c0351fb0] [c02b8e00] setup_arch+0x13c/0x1b8
[c0351fc0] [c02b066c] start_kernel+0x94/0x2ac
[c0351ff0] [c1e8] skpinv+0x190/0x1cc
Instruction dump:
7f07c378 4bfffe15 7c7e1b78 4192000c 2f83 409e0024 7f9ae000 419e0050
817f0014 83bf0004 3bebffec 4b68 0fe0 4800 7f63db78 7fa4eb78
---[ end trace 31fd0ba7d8756001 ]---
Kernel panic - not syncing: Attempted to kill the idle task!
Rebooting in 180 seconds..


Ilya Yanok wrote:

This patch adds support for page sizes bigger than 4K (16K/64K) on
PPC 44x.

Signed-off-by: Yuri Tikhonov [EMAIL PROTECTED]
Signed-off-by: Vladimir Panfilov [EMAIL PROTECTED]
Signed-off-by: Ilya Yanok [EMAIL PROTECTED]
---
 arch/powerpc/Kconfig   |   26 --
 arch/powerpc/include/asm/highmem.h |8 +++-
 arch/powerpc/include/asm/mmu-44x.h |   18 ++
 arch/powerpc/include/asm/page.h|   13 -
 arch/powerpc/include/asm/pgtable.h |3 +++
 arch/powerpc/kernel/asm-offsets.c  |4 
 arch/powerpc/kernel/head_44x.S |   22 +-
 arch/powerpc/kernel/misc_32.S  |   12 ++--
 arch/powerpc/mm/pgtable_32.c   |9 ++---
 arch/powerpc/platforms/Kconfig.cputype |2 +-
 10 files changed, 82 insertions(+), 35 deletions(-)

diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 587da5e..9627cfd 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -402,16 +402,30 @@ config PPC_HAS_HASH_64K
depends on PPC64
default n

-config PPC_64K_PAGES
-   bool 64k page size
-   depends on PPC64
-   select PPC_HAS_HASH_64K
+choice
+   prompt Page size
+   default PPC_4K_PAGES
help
- This option changes the kernel logical page size to 64k. On machines
+ The PAGE_SIZE definition. Increasing the page size may
+ improve the system performance in some dedicated cases like software
+ RAID with accelerated calculations. In PPC64 case on machines
 

Re: [PATCH 1/2] powerpc: add 16K/64K pages support for the 44x PPC32 architectures.

2008-10-22 Thread Christian Ehrhardt
Ilya, here the snippet you asked for with CONFIG_DEBUG_BUGVERBOSE 
enabled and bootmem_debug set.


## Booting kernel from Legacy Image at 0400 ...
  Image Name:   Linux-2.6.27-dirty
  Image Type:   PowerPC Linux Kernel Image (gzip compressed)
  Data Size:1521505 Bytes =  1.5 MB
  Load Address: 0040
  Entry Point:  00400458
  Verifying Checksum ... OK
  Uncompressing Kernel Image ... OK
CPU clock-frequency - 0x27bc86a4 (667MHz)
CPU timebase-frequency - 0x27bc86a4 (667MHz)
/plb: clock-frequency - 9ef21a9 (167MHz)
/plb/opb: clock-frequency - 4f790d4 (83MHz)
/plb/opb/ebc: clock-frequency - 34fb5e3 (56MHz)
/plb/opb/[EMAIL PROTECTED]: clock-frequency - a8c000 (11MHz)
/plb/opb/[EMAIL PROTECTED]: clock-frequency - a8c000 (11MHz)
/plb/opb/[EMAIL PROTECTED]: clock-frequency - 42ecac (4MHz)
/plb/opb/[EMAIL PROTECTED]: clock-frequency - 42ecac (4MHz)
Memory - 0x0 0x0 0x000 (255MB)
ethernet0: local-mac-address - 00:10:ec:00:e2:3e
ethernet1: local-mac-address - 00:10:ec:80:e2:3e

zImage starting: loaded at 0x0040 (sp: 0x0fe3c820)
Allocating 0x3d54dc bytes for kernel ...
gunzipping (0x - 0x0040e000:0x007b24a4)...done 0x390af8 bytes

Linux/PowerPC load: console=ttyS0,115200 ip=dhcp 
nfsroot=192.168.1.2:/home/paelzer/ubuntu_ppc.8.04 root=/dev/nfs rw 
bootmem_debug

Finalizing device tree... flat tree at 0x40bed8
Using PowerPC 44x Platform machine description
Linux version 2.6.27-dirty ([EMAIL PROTECTED]) (gcc version 4.2.3) #12 
Wed Oct 22 19:40:49 CEST 2008

console [udbg0] enabled
bootmem::init_bootmem_core nid=0 start=0 map=ffd end=fff mapsize=200
bootmem::mark_bootmem_node nid=0 start=0 end=fff reserve=0 flags=0
bootmem::__free nid=0 start=0 end=fff
bootmem::mark_bootmem_node nid=0 start=0 end=3e reserve=1 flags=0
bootmem::__reserve nid=0 start=0 end=3e flags=0
bootmem::mark_bootmem_node nid=0 start=40 end=41 reserve=1 flags=0
bootmem::__reserve nid=0 start=40 end=41 flags=0
bootmem::mark_bootmem_node nid=0 start=ffd end=fff reserve=1 flags=0
bootmem::__reserve nid=0 start=ffd end=fff flags=0
[ cut here ]
kernel BUG at mm/bootmem.c:320!
Oops: Exception in kernel mode, sig: 5 [#1]
PowerPC 44x Platform
NIP: c02ce838 LR: c02ca4e4 CTR: c000dcf8
REGS: c0361eb0 TRAP: 0700   Not tainted  (2.6.27-dirty)
MSR: 00021000 ME  CR: 22004022  XER: 005f
TASK = c03304a8[0] 'swapper' THREAD: c036
GPR00: c02e0c98 c0361f60 c03304a8 0fff 1000 0001  
4000
GPR08: e000   c02e0c90 2224  0ffa6800 
0ffbf000
GPR16: 100c  100c  0ffa7500 0fe3cb20 0001 
c02e0c98
GPR24:  0001 1000 0fff c03a 0fff c03ad1e0 
c02e0c84

NIP [c02ce838] mark_bootmem+0xe0/0x124
LR [c02ca4e4] do_init_bootmem+0x134/0x168
Call Trace:
[c0361f60] [c02ce810] mark_bootmem+0xb8/0x124 (unreliable)
[c0361f90] [c02ca4e4] do_init_bootmem+0x134/0x168
[c0361fb0] [c02c8e00] setup_arch+0x13c/0x1b8
[c0361fc0] [c02c066c] start_kernel+0x94/0x2ac
[c0361ff0] [c1e8] skpinv+0x190/0x1cc
Instruction dump:
7f07c378 4bfffe15 7c7e1b78 4192000c 2f83 409e0024 7f9ae000 419e0050
817f0014 83bf0004 3bebffec 4b68 0fe0 4800 7f63db78 7fa4eb78
---[ end trace 31fd0ba7d8756001 ]---
Kernel panic - not syncing: Attempted to kill the idle task!
Rebooting in 180 seconds..

Christian Ehrhardt wrote:

Hi Ilya,
I just tried your patch on my 440 board because it would help us in 
our environment.

Unfortunately I run into a bug on early boot (mark_bootmem).

A log can be found in this mail, this is the bug when running with 64k 
page size.
I tried this with and without your 2/2 265k patch and also with page 
size configured to 16k, the error is the same in all cases.


I used an earlier version of your patch in the past and it worked 
fine. Applying this old patch causes the same problem.
Therefore I expect that there was some other code changed that breaks 
with page size != 4k.


I did not check that in detail yet, but I would be happy for every 
hint I could get to fix this.


= bootm
## Booting kernel from Legacy Image at 0400 ...
  Image Name:   Linux-2.6.27-dirty
  Image Type:   PowerPC Linux Kernel Image (gzip compressed)
  Data Size:1512203 Bytes =  1.4 MB
  Load Address: 0040
  Entry Point:  00400458
  Verifying Checksum ... OK
  Uncompressing Kernel Image ... OK
CPU clock-frequency - 0x27bc86a4 (667MHz)
CPU timebase-frequency - 0x27bc86a4 (667MHz)
/plb: clock-frequency - 9ef21a9 (167MHz)
/plb/opb: clock-frequency - 4f790d4 (83MHz)
/plb/opb/ebc: clock-frequency - 34fb5e3 (56MHz)
/plb/opb/[EMAIL PROTECTED]: clock-frequency - a8c000 (11MHz)
/plb/opb/[EMAIL PROTECTED]: clock-frequency - a8c000 (11MHz)
/plb/opb/[EMAIL PROTECTED]: clock-frequency - 42ecac (4MHz)
/plb/opb/[EMAIL PROTECTED]: clock-frequency - 42ecac (4MHz)
Memory - 0x0 0x0 0x000 (255MB)
ethernet0: local-mac-address - 00:10:ec:00:e2:3e
ethernet1: local-mac-address - 00:10:ec:80:e2:3e

zImage starting: loaded at 0x0040 (sp: 0x0fe3c820)
Allocating 

Re: [PATCH 1/2] powerpc: add 16K/64K pages support for the 44x PPC32 architectures.

2008-10-18 Thread Josh Boyer
On Fri, 17 Oct 2008 08:54:52 -0700
prodyut hazarika [EMAIL PROTECTED] wrote:

 On Wed, Oct 15, 2008 at 7:22 PM, Ilya Yanok [EMAIL PROTECTED] wrote:
  This patch adds support for page sizes bigger than 4K (16K/64K) on
  PPC 44x.
 
 
 This patch looks good to me. Seems that all the review comments have
 been incorporated.
 
 Josh, it would be great if this patch is pulled into the mainline
 kernel. I have seen significant performance improvement with RAID0/5
 by using 64K pages.

It helps if you CC the person you're writing too :).

Anyway, I looked over it briefly and agree it looks pretty good.  A bit
late for 2.6.28, but I'll do a more thorough review and get it in for
2.6.29.

josh
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH 1/2] powerpc: add 16K/64K pages support for the 44x PPC32 architectures.

2008-10-18 Thread prodyut hazarika
 It helps if you CC the person you're writing too :).
Thanks Josh for pointing this out :-) I will be careful in future.

 Anyway, I looked over it briefly and agree it looks pretty good.  A bit
 late for 2.6.28, but I'll do a more thorough review and get it in for
 2.6.29.

Great. Look forward to seeing this on the mainline kernel.
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH 1/2] powerpc: add 16K/64K pages support for the 44x PPC32 architectures.

2008-10-17 Thread prodyut hazarika
On Wed, Oct 15, 2008 at 7:22 PM, Ilya Yanok [EMAIL PROTECTED] wrote:
 This patch adds support for page sizes bigger than 4K (16K/64K) on
 PPC 44x.


This patch looks good to me. Seems that all the review comments have
been incorporated.

Josh, it would be great if this patch is pulled into the mainline
kernel. I have seen significant performance improvement with RAID0/5
by using 64K pages.
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 1/2] powerpc: add 16K/64K pages support for the 44x PPC32 architectures.

2008-10-15 Thread Ilya Yanok
This patch adds support for page sizes bigger than 4K (16K/64K) on
PPC 44x.

Signed-off-by: Yuri Tikhonov [EMAIL PROTECTED]
Signed-off-by: Vladimir Panfilov [EMAIL PROTECTED]
Signed-off-by: Ilya Yanok [EMAIL PROTECTED]
---
 arch/powerpc/Kconfig   |   26 --
 arch/powerpc/include/asm/highmem.h |8 +++-
 arch/powerpc/include/asm/mmu-44x.h |   18 ++
 arch/powerpc/include/asm/page.h|   13 -
 arch/powerpc/include/asm/pgtable.h |3 +++
 arch/powerpc/kernel/asm-offsets.c  |4 
 arch/powerpc/kernel/head_44x.S |   22 +-
 arch/powerpc/kernel/misc_32.S  |   12 ++--
 arch/powerpc/mm/pgtable_32.c   |9 ++---
 arch/powerpc/platforms/Kconfig.cputype |2 +-
 10 files changed, 82 insertions(+), 35 deletions(-)

diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 587da5e..9627cfd 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -402,16 +402,30 @@ config PPC_HAS_HASH_64K
depends on PPC64
default n
 
-config PPC_64K_PAGES
-   bool 64k page size
-   depends on PPC64
-   select PPC_HAS_HASH_64K
+choice
+   prompt Page size
+   default PPC_4K_PAGES
help
- This option changes the kernel logical page size to 64k. On machines
+ The PAGE_SIZE definition. Increasing the page size may
+ improve the system performance in some dedicated cases like software
+ RAID with accelerated calculations. In PPC64 case on machines
  without processor support for 64k pages, the kernel will simulate
  them by loading each individual 4k page on demand transparently,
  while on hardware with such support, it will be used to map
  normal application pages.
+ If unsure, set it to 4 KB.
+
+config PPC_4K_PAGES
+   bool 4k page size
+
+config PPC_16K_PAGES
+   bool 16k page size if 44x
+
+config PPC_64K_PAGES
+   bool 64k page size if 44x || PPC64
+   select PPC_HAS_HASH_64K if PPC64
+
+endchoice
 
 config FORCE_MAX_ZONEORDER
int Maximum zone order
@@ -435,7 +449,7 @@ config FORCE_MAX_ZONEORDER
 
 config PPC_SUBPAGE_PROT
bool Support setting protections for 4k subpages
-   depends on PPC_64K_PAGES
+   depends on PPC64  PPC_64K_PAGES
help
  This option adds support for a system call to allow user programs
  to set access permissions (read/write, readonly, or no access)
diff --git a/arch/powerpc/include/asm/highmem.h 
b/arch/powerpc/include/asm/highmem.h
index 5d99b64..dc1132c 100644
--- a/arch/powerpc/include/asm/highmem.h
+++ b/arch/powerpc/include/asm/highmem.h
@@ -38,9 +38,15 @@ extern pte_t *pkmap_page_table;
  * easily, subsequent pte tables have to be allocated in one physical
  * chunk of RAM.
  */
+#if defined(CONFIG_PPC_64K_PAGES)  !defined(CONFIG_PPC64)
+#define PKMAP_ORDER(27 - PAGE_SHIFT)
+#define LAST_PKMAP (1  PKMAP_ORDER)
+#define PKMAP_BASE (FIXADDR_START - PAGE_SIZE*(LAST_PKMAP + 1))
+#else
 #define LAST_PKMAP (1  PTE_SHIFT)
-#define LAST_PKMAP_MASK (LAST_PKMAP-1)
 #define PKMAP_BASE ((FIXADDR_START - PAGE_SIZE*(LAST_PKMAP + 1))  
PMD_MASK)
+#endif
+#define LAST_PKMAP_MASK(LAST_PKMAP-1)
 #define PKMAP_NR(virt)  ((virt-PKMAP_BASE)  PAGE_SHIFT)
 #define PKMAP_ADDR(nr)  (PKMAP_BASE + ((nr)  PAGE_SHIFT))
 
diff --git a/arch/powerpc/include/asm/mmu-44x.h 
b/arch/powerpc/include/asm/mmu-44x.h
index a825524..2ca18e8 100644
--- a/arch/powerpc/include/asm/mmu-44x.h
+++ b/arch/powerpc/include/asm/mmu-44x.h
@@ -4,6 +4,8 @@
  * PPC440 support
  */
 
+#include asm/page.h
+
 #define PPC44x_MMUCR_TID   0x00ff
 #define PPC44x_MMUCR_STS   0x0001
 
@@ -73,4 +75,20 @@ typedef struct {
 /* Size of the TLBs used for pinning in lowmem */
 #define PPC_PIN_SIZE   (1  28)   /* 256M */
 
+#if (PAGE_SHIFT == 12)
+#define PPC44x_TLBE_SIZE   PPC44x_TLB_4K
+#elif (PAGE_SHIFT == 14)
+#define PPC44x_TLBE_SIZE   PPC44x_TLB_16K
+#elif (PAGE_SHIFT == 16)
+#define PPC44x_TLBE_SIZE   PPC44x_TLB_64K
+#else
+#error Unsupported PAGE_SIZE
+#endif
+
+#define PPC44x_PGD_OFF_SHIFT   (32 - PMD_SHIFT + 2)
+#define PPC44x_PGD_OFF_MASK(PMD_SHIFT - 2)
+#define PPC44x_PTE_ADD_SHIFT   (32 - PMD_SHIFT + PTE_SHIFT + 3)
+#define PPC44x_PTE_ADD_MASK(32 - 3 - PTE_SHIFT)
+#define PPC44x_RPN_MASK(31 - PAGE_SHIFT)
+
 #endif /* _ASM_POWERPC_MMU_44X_H_ */
diff --git a/arch/powerpc/include/asm/page.h b/arch/powerpc/include/asm/page.h
index e088545..537d5b1 100644
--- a/arch/powerpc/include/asm/page.h
+++ b/arch/powerpc/include/asm/page.h
@@ -15,12 +15,15 @@
 #include asm/types.h
 
 /*
- * On PPC32 page size is 4K. For PPC64 we support either 4K or 64K software
+ * On regular PPC32 page size is 4K (but we support 4K/16K/64K pages
+ * on PPC44x). For PPC64 we support either 4K or 64K software
  * page size. When using 64K pages however, whether we are