From: Hollis Blanchard <hollisb@us.ibm.com>
To: benh@kernel.crashing.org
Cc: dzu@denx.de, Ilya Yanok <yanok@emcraft.com>,
linuxppc-dev@ozlabs.org, pvr@emcraft.com,
Wolfgang Denk <wd@denx.de>
Subject: Re: [PATCH 1/2] powerpc: add 16K/64K pages support for the 44x PPC32 architectures.
Date: Mon, 03 Nov 2008 13:55:21 -0600 [thread overview]
Message-ID: <1225742121.24019.9.camel@localhost.localdomain> (raw)
In-Reply-To: <1225673034.8004.239.camel@pasglop>
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, 0xffff000 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 <hollisb@us.ibm.com>
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 0x40000850:
case 0x400008d0:
case 0x200008d0:
- 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
next prev parent reply other threads:[~2008-11-03 19:55 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-16 2:22 [RFC PATCH] Support for big page sizes on 44x (Updated) Ilya Yanok
2008-10-16 2:22 ` [PATCH 1/2] powerpc: add 16K/64K pages support for the 44x PPC32 architectures Ilya Yanok
2008-10-17 15:54 ` prodyut hazarika
2008-10-18 12:58 ` Josh Boyer
2008-10-18 20:36 ` prodyut hazarika
2008-10-22 14:28 ` Christian Ehrhardt
2008-10-22 17:54 ` Christian Ehrhardt
2008-10-31 23:23 ` Hollis Blanchard
2008-11-01 11:30 ` Josh Boyer
2008-11-01 21:55 ` Benjamin Herrenschmidt
2008-11-02 13:41 ` Josh Boyer
2008-11-02 21:33 ` Benjamin Herrenschmidt
2008-11-03 0:33 ` Josh Boyer
2008-11-03 0:43 ` Benjamin Herrenschmidt
2008-11-03 11:26 ` Josh Boyer
2008-11-03 20:17 ` Benjamin Herrenschmidt
2008-11-03 19:55 ` Hollis Blanchard [this message]
2008-11-03 20:00 ` Josh Boyer
2008-11-05 17:33 ` Hollis Blanchard
2008-11-06 1:48 ` David Gibson
2008-11-11 13:19 ` Josh Boyer
2008-11-11 15:00 ` Hollis Blanchard
2008-11-10 15:09 ` [1/2] " Milton Miller
2008-11-10 16:50 ` Ilya Yanok
2008-10-16 2:22 ` [PATCH 2/2] powerpc: support for 256K pages on PPC 44x Ilya Yanok
2008-11-10 15:09 ` [2/2] " Milton Miller
2008-11-10 16:24 ` Ilya Yanok
2008-11-11 14:59 ` Milton Miller
2008-11-14 4:32 ` Re[2]: " Yuri Tikhonov
2008-11-14 15:41 ` Milton Miller
2008-11-27 0:30 ` Re[4]: " Yuri Tikhonov
2008-11-11 2:17 ` [RFC PATCH] Support for big page sizes on 44x (Updated) Benjamin Herrenschmidt
2008-11-11 2:22 ` Benjamin Herrenschmidt
2008-11-24 20:32 ` Hollis Blanchard
2008-11-24 23:06 ` Wolfgang Denk
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=1225742121.24019.9.camel@localhost.localdomain \
--to=hollisb@us.ibm.com \
--cc=benh@kernel.crashing.org \
--cc=dzu@denx.de \
--cc=linuxppc-dev@ozlabs.org \
--cc=pvr@emcraft.com \
--cc=wd@denx.de \
--cc=yanok@emcraft.com \
/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.