linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] powerpc: Fix problems with 32bit PPC's running with more than 2GB of RAM
@ 2008-07-09 13:44 Stefan Roese
  2008-07-09 14:20 ` Kumar Gala
  2008-07-09 20:02 ` Benjamin Herrenschmidt
  0 siblings, 2 replies; 9+ messages in thread
From: Stefan Roese @ 2008-07-09 13:44 UTC (permalink / raw)
  To: linuxppc-dev

This patch enables 32bit PPC's (with 36bit physical address space, e.g.
IBM/AMCC PPC44x) to run with more than 2GB of RAM. Mostly its just
replacing types (unsigned long -> phys_addr_t).

Tested on an AMCC Katmai with 4GB of DDR2.

Signed-off-by: Stefan Roese <sr@denx.de>
---
 arch/powerpc/mm/init_32.c  |    4 ++--
 arch/powerpc/mm/mem.c      |    8 ++++----
 arch/powerpc/mm/mmu_decl.h |    4 ++--
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/arch/powerpc/mm/init_32.c b/arch/powerpc/mm/init_32.c
index 1952b4d..325ccdd 100644
--- a/arch/powerpc/mm/init_32.c
+++ b/arch/powerpc/mm/init_32.c
@@ -56,8 +56,8 @@
 
 DEFINE_PER_CPU(struct mmu_gather, mmu_gathers);
 
-unsigned long total_memory;
-unsigned long total_lowmem;
+phys_addr_t total_memory;
+phys_addr_t total_lowmem;
 
 phys_addr_t memstart_addr = (phys_addr_t)~0ull;
 EXPORT_SYMBOL(memstart_addr);
diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c
index 51f82d8..55ef772 100644
--- a/arch/powerpc/mm/mem.c
+++ b/arch/powerpc/mm/mem.c
@@ -329,7 +329,7 @@ static int __init mark_nonram_nosave(void)
 void __init paging_init(void)
 {
 	unsigned long total_ram = lmb_phys_mem_size();
-	unsigned long top_of_ram = lmb_end_of_DRAM();
+	phys_addr_t top_of_ram = lmb_end_of_DRAM();
 	unsigned long max_zone_pfns[MAX_NR_ZONES];
 
 #ifdef CONFIG_PPC32
@@ -348,10 +348,10 @@ void __init paging_init(void)
 	kmap_prot = PAGE_KERNEL;
 #endif /* CONFIG_HIGHMEM */
 
-	printk(KERN_DEBUG "Top of RAM: 0x%lx, Total RAM: 0x%lx\n",
-	       top_of_ram, total_ram);
+	printk(KERN_DEBUG "Top of RAM: 0x%llx, Total RAM: 0x%lx\n",
+	       (u64)top_of_ram, total_ram);
 	printk(KERN_DEBUG "Memory hole size: %ldMB\n",
-	       (top_of_ram - total_ram) >> 20);
+	       (long int)((top_of_ram - total_ram) >> 20));
 	memset(max_zone_pfns, 0, sizeof(max_zone_pfns));
 #ifdef CONFIG_HIGHMEM
 	max_zone_pfns[ZONE_DMA] = lowmem_end_addr >> PAGE_SHIFT;
diff --git a/arch/powerpc/mm/mmu_decl.h b/arch/powerpc/mm/mmu_decl.h
index 0480225..4e46c63 100644
--- a/arch/powerpc/mm/mmu_decl.h
+++ b/arch/powerpc/mm/mmu_decl.h
@@ -49,8 +49,8 @@ extern unsigned int num_tlbcam_entries;
 extern unsigned long ioremap_bot;
 extern unsigned long __max_low_memory;
 extern phys_addr_t __initial_memory_limit_addr;
-extern unsigned long total_memory;
-extern unsigned long total_lowmem;
+extern phys_addr_t total_memory;
+extern phys_addr_t total_lowmem;
 extern phys_addr_t memstart_addr;
 extern phys_addr_t lowmem_end_addr;
 
-- 
1.5.6.2

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

* Re: [PATCH] powerpc: Fix problems with 32bit PPC's running with more than 2GB of RAM
  2008-07-09 13:44 [PATCH] powerpc: Fix problems with 32bit PPC's running with more than 2GB of RAM Stefan Roese
@ 2008-07-09 14:20 ` Kumar Gala
  2008-07-09 15:05   ` Stefan Roese
  2008-07-09 20:02 ` Benjamin Herrenschmidt
  1 sibling, 1 reply; 9+ messages in thread
From: Kumar Gala @ 2008-07-09 14:20 UTC (permalink / raw)
  To: Stefan Roese; +Cc: linuxppc-dev


On Jul 9, 2008, at 8:44 AM, Stefan Roese wrote:

> This patch enables 32bit PPC's (with 36bit physical address space,  
> e.g.
> IBM/AMCC PPC44x) to run with more than 2GB of RAM. Mostly its just
> replacing types (unsigned long -> phys_addr_t).

should the commit header really be >= 4G.  I don't think there is any  
issue with 2-4G support as it stands.
>
>
> Tested on an AMCC Katmai with 4GB of DDR2.
>
> Signed-off-by: Stefan Roese <sr@denx.de>

- k

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

* Re: [PATCH] powerpc: Fix problems with 32bit PPC's running with more than 2GB of RAM
  2008-07-09 14:20 ` Kumar Gala
@ 2008-07-09 15:05   ` Stefan Roese
  0 siblings, 0 replies; 9+ messages in thread
From: Stefan Roese @ 2008-07-09 15:05 UTC (permalink / raw)
  To: Kumar Gala; +Cc: linuxppc-dev

On Wednesday 09 July 2008, Kumar Gala wrote:
> On Jul 9, 2008, at 8:44 AM, Stefan Roese wrote:
> > This patch enables 32bit PPC's (with 36bit physical address space,
> > e.g.
> > IBM/AMCC PPC44x) to run with more than 2GB of RAM. Mostly its just
> > replacing types (unsigned long -> phys_addr_t).
>
> should the commit header really be >= 4G.  I don't think there is any
> issue with 2-4G support as it stands.

Right. I'll fix this up and resubmit.

Thanks.

Best regards,
Stefan

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

* Re: [PATCH] powerpc: Fix problems with 32bit PPC's running with more than 2GB of RAM
  2008-07-09 13:44 [PATCH] powerpc: Fix problems with 32bit PPC's running with more than 2GB of RAM Stefan Roese
  2008-07-09 14:20 ` Kumar Gala
@ 2008-07-09 20:02 ` Benjamin Herrenschmidt
  2008-07-09 20:22   ` Josh Boyer
  1 sibling, 1 reply; 9+ messages in thread
From: Benjamin Herrenschmidt @ 2008-07-09 20:02 UTC (permalink / raw)
  To: Stefan Roese; +Cc: linuxppc-dev

On Wed, 2008-07-09 at 15:44 +0200, Stefan Roese wrote:
> This patch enables 32bit PPC's (with 36bit physical address space, e.g.
> IBM/AMCC PPC44x) to run with more than 2GB of RAM. Mostly its just
> replacing types (unsigned long -> phys_addr_t).
> 
> Tested on an AMCC Katmai with 4GB of DDR2.
> 
> Signed-off-by: Stefan Roese <sr@denx.de>

But DMAs will break no ?

Ben.

> ---
>  arch/powerpc/mm/init_32.c  |    4 ++--
>  arch/powerpc/mm/mem.c      |    8 ++++----
>  arch/powerpc/mm/mmu_decl.h |    4 ++--
>  3 files changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/arch/powerpc/mm/init_32.c b/arch/powerpc/mm/init_32.c
> index 1952b4d..325ccdd 100644
> --- a/arch/powerpc/mm/init_32.c
> +++ b/arch/powerpc/mm/init_32.c
> @@ -56,8 +56,8 @@
>  
>  DEFINE_PER_CPU(struct mmu_gather, mmu_gathers);
>  
> -unsigned long total_memory;
> -unsigned long total_lowmem;
> +phys_addr_t total_memory;
> +phys_addr_t total_lowmem;
>  
>  phys_addr_t memstart_addr = (phys_addr_t)~0ull;
>  EXPORT_SYMBOL(memstart_addr);
> diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c
> index 51f82d8..55ef772 100644
> --- a/arch/powerpc/mm/mem.c
> +++ b/arch/powerpc/mm/mem.c
> @@ -329,7 +329,7 @@ static int __init mark_nonram_nosave(void)
>  void __init paging_init(void)
>  {
>  	unsigned long total_ram = lmb_phys_mem_size();
> -	unsigned long top_of_ram = lmb_end_of_DRAM();
> +	phys_addr_t top_of_ram = lmb_end_of_DRAM();
>  	unsigned long max_zone_pfns[MAX_NR_ZONES];
>  
>  #ifdef CONFIG_PPC32
> @@ -348,10 +348,10 @@ void __init paging_init(void)
>  	kmap_prot = PAGE_KERNEL;
>  #endif /* CONFIG_HIGHMEM */
>  
> -	printk(KERN_DEBUG "Top of RAM: 0x%lx, Total RAM: 0x%lx\n",
> -	       top_of_ram, total_ram);
> +	printk(KERN_DEBUG "Top of RAM: 0x%llx, Total RAM: 0x%lx\n",
> +	       (u64)top_of_ram, total_ram);
>  	printk(KERN_DEBUG "Memory hole size: %ldMB\n",
> -	       (top_of_ram - total_ram) >> 20);
> +	       (long int)((top_of_ram - total_ram) >> 20));
>  	memset(max_zone_pfns, 0, sizeof(max_zone_pfns));
>  #ifdef CONFIG_HIGHMEM
>  	max_zone_pfns[ZONE_DMA] = lowmem_end_addr >> PAGE_SHIFT;
> diff --git a/arch/powerpc/mm/mmu_decl.h b/arch/powerpc/mm/mmu_decl.h
> index 0480225..4e46c63 100644
> --- a/arch/powerpc/mm/mmu_decl.h
> +++ b/arch/powerpc/mm/mmu_decl.h
> @@ -49,8 +49,8 @@ extern unsigned int num_tlbcam_entries;
>  extern unsigned long ioremap_bot;
>  extern unsigned long __max_low_memory;
>  extern phys_addr_t __initial_memory_limit_addr;
> -extern unsigned long total_memory;
> -extern unsigned long total_lowmem;
> +extern phys_addr_t total_memory;
> +extern phys_addr_t total_lowmem;
>  extern phys_addr_t memstart_addr;
>  extern phys_addr_t lowmem_end_addr;
>  

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

* Re: [PATCH] powerpc: Fix problems with 32bit PPC's running with more than 2GB of RAM
  2008-07-09 20:02 ` Benjamin Herrenschmidt
@ 2008-07-09 20:22   ` Josh Boyer
  2008-07-09 20:39     ` Benjamin Herrenschmidt
  0 siblings, 1 reply; 9+ messages in thread
From: Josh Boyer @ 2008-07-09 20:22 UTC (permalink / raw)
  To: benh; +Cc: linuxppc-dev, Stefan Roese

On Thu, 10 Jul 2008 06:02:38 +1000
Benjamin Herrenschmidt <benh@kernel.crashing.org> wrote:

> On Wed, 2008-07-09 at 15:44 +0200, Stefan Roese wrote:
> > This patch enables 32bit PPC's (with 36bit physical address space, e.g.
> > IBM/AMCC PPC44x) to run with more than 2GB of RAM. Mostly its just
> > replacing types (unsigned long -> phys_addr_t).
> > 
> > Tested on an AMCC Katmai with 4GB of DDR2.
> > 
> > Signed-off-by: Stefan Roese <sr@denx.de>
> 
> But DMAs will break no ?

How?

josh

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

* Re: [PATCH] powerpc: Fix problems with 32bit PPC's running with more than 2GB of RAM
  2008-07-09 20:22   ` Josh Boyer
@ 2008-07-09 20:39     ` Benjamin Herrenschmidt
  2008-07-10  0:44       ` Josh Boyer
  0 siblings, 1 reply; 9+ messages in thread
From: Benjamin Herrenschmidt @ 2008-07-09 20:39 UTC (permalink / raw)
  To: Josh Boyer; +Cc: linuxppc-dev, Stefan Roese

On Wed, 2008-07-09 at 16:22 -0400, Josh Boyer wrote:
> On Thu, 10 Jul 2008 06:02:38 +1000
> Benjamin Herrenschmidt <benh@kernel.crashing.org> wrote:
> 
> > On Wed, 2008-07-09 at 15:44 +0200, Stefan Roese wrote:
> > > This patch enables 32bit PPC's (with 36bit physical address space, e.g.
> > > IBM/AMCC PPC44x) to run with more than 2GB of RAM. Mostly its just
> > > replacing types (unsigned long -> phys_addr_t).
> > > 
> > > Tested on an AMCC Katmai with 4GB of DDR2.
> > > 
> > > Signed-off-by: Stefan Roese <sr@denx.de>
> > 
> > But DMAs will break no ?
> 
> How?

Hrm... forget it. It's fine up to 4G of RAM... (ie. as long as DMA is
below 32 bits).

Ben.

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

* Re: [PATCH] powerpc: Fix problems with 32bit PPC's running with more than 2GB of RAM
  2008-07-09 20:39     ` Benjamin Herrenschmidt
@ 2008-07-10  0:44       ` Josh Boyer
  2008-07-10 15:31         ` Becky Bruce
  0 siblings, 1 reply; 9+ messages in thread
From: Josh Boyer @ 2008-07-10  0:44 UTC (permalink / raw)
  To: benh; +Cc: linuxppc-dev, Stefan Roese

On Thu, 10 Jul 2008 06:39:39 +1000
Benjamin Herrenschmidt <benh@kernel.crashing.org> wrote:

> On Wed, 2008-07-09 at 16:22 -0400, Josh Boyer wrote:
> > On Thu, 10 Jul 2008 06:02:38 +1000
> > Benjamin Herrenschmidt <benh@kernel.crashing.org> wrote:
> > 
> > > On Wed, 2008-07-09 at 15:44 +0200, Stefan Roese wrote:
> > > > This patch enables 32bit PPC's (with 36bit physical address space, e.g.
> > > > IBM/AMCC PPC44x) to run with more than 2GB of RAM. Mostly its just
> > > > replacing types (unsigned long -> phys_addr_t).
> > > > 
> > > > Tested on an AMCC Katmai with 4GB of DDR2.
> > > > 
> > > > Signed-off-by: Stefan Roese <sr@denx.de>
> > > 
> > > But DMAs will break no ?
> > 
> > How?
> 
> Hrm... forget it. It's fine up to 4G of RAM... (ie. as long as DMA is
> below 32 bits).

Right.  We haven't really dealt with anything larger than 4 GiB, and we
certainly aren't dealing with discontiguous DRAM due to I/O ranges.

josh

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

* Re: [PATCH] powerpc: Fix problems with 32bit PPC's running with more than 2GB of RAM
  2008-07-10  0:44       ` Josh Boyer
@ 2008-07-10 15:31         ` Becky Bruce
  2008-07-12  3:33           ` Benjamin Herrenschmidt
  0 siblings, 1 reply; 9+ messages in thread
From: Becky Bruce @ 2008-07-10 15:31 UTC (permalink / raw)
  To: Josh Boyer; +Cc: Stefan Roese, linuxppc-dev


On Jul 9, 2008, at 7:44 PM, Josh Boyer wrote:

> On Thu, 10 Jul 2008 06:39:39 +1000
> Benjamin Herrenschmidt <benh@kernel.crashing.org> wrote:
>
>> On Wed, 2008-07-09 at 16:22 -0400, Josh Boyer wrote:
>>> On Thu, 10 Jul 2008 06:02:38 +1000
>>> Benjamin Herrenschmidt <benh@kernel.crashing.org> wrote:
>>>
>>>> On Wed, 2008-07-09 at 15:44 +0200, Stefan Roese wrote:
>>>>> This patch enables 32bit PPC's (with 36bit physical address  
>>>>> space, e.g.
>>>>> IBM/AMCC PPC44x) to run with more than 2GB of RAM. Mostly its just
>>>>> replacing types (unsigned long -> phys_addr_t).
>>>>>
>>>>> Tested on an AMCC Katmai with 4GB of DDR2.
>>>>>
>>>>> Signed-off-by: Stefan Roese <sr@denx.de>
>>>>
>>>> But DMAs will break no ?
>>>
>>> How?
>>
>> Hrm... forget it. It's fine up to 4G of RAM... (ie. as long as DMA is
>> below 32 bits).
>
> Right.  We haven't really dealt with anything larger than 4 GiB, and  
> we
> certainly aren't dealing with discontiguous DRAM due to I/O ranges.

Are you *sure* you can see all 4GB?  I thought we lost some of the 32- 
bit PCI address space for PCI IO......  Disclaimer: I'm no expert on  
PCI :)

FYI, I'm *very* close to having swiotlb fully functional on powerpc to  
support larger RAM - I am able to boot with 6GB on 8641 right now.   
There are some bugs that I'm still shaking out - I hope to push this  
out in the next couple of weeks.

Cheers,
B

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

* Re: [PATCH] powerpc: Fix problems with 32bit PPC's running with more than 2GB of RAM
  2008-07-10 15:31         ` Becky Bruce
@ 2008-07-12  3:33           ` Benjamin Herrenschmidt
  0 siblings, 0 replies; 9+ messages in thread
From: Benjamin Herrenschmidt @ 2008-07-12  3:33 UTC (permalink / raw)
  To: Becky Bruce; +Cc: linuxppc-dev, Stefan Roese


> Are you *sure* you can see all 4GB?  I thought we lost some of the 32- 
> bit PCI address space for PCI IO......  Disclaimer: I'm no expert on  
> PCI :)

You are right. I didn't think that through when I replied. We do lose
some of it for MMIO (not IO). So we cannot really go all the way to 4G
because we can't DMA to all of it, right.

> FYI, I'm *very* close to having swiotlb fully functional on powerpc to  
> support larger RAM - I am able to boot with 6GB on 8641 right now.   
> There are some bugs that I'm still shaking out - I hope to push this  
> out in the next couple of weeks.

That won't make .27 then ?

Cheers,
Ben.

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

end of thread, other threads:[~2008-07-12  3:34 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-09 13:44 [PATCH] powerpc: Fix problems with 32bit PPC's running with more than 2GB of RAM Stefan Roese
2008-07-09 14:20 ` Kumar Gala
2008-07-09 15:05   ` Stefan Roese
2008-07-09 20:02 ` Benjamin Herrenschmidt
2008-07-09 20:22   ` Josh Boyer
2008-07-09 20:39     ` Benjamin Herrenschmidt
2008-07-10  0:44       ` Josh Boyer
2008-07-10 15:31         ` Becky Bruce
2008-07-12  3:33           ` Benjamin Herrenschmidt

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).