From: Hollis Blanchard <hollisb@us.ibm.com>
To: dwg@au1.ibm.com, jwboyer@linux.vnet.ibm.com
Cc: linuxppc-dev@ozlabs.org, kvm-ppc@vger.kernel.org, yanok@emcraft.com
Subject: [PATCH] [v3] powerpc/4xx: work around CHIP11 errata in a more PAGE_SIZE-friendly way
Date: Tue, 11 Nov 2008 18:06:46 -0600 [thread overview]
Message-ID: <700c59731cf97778d3a4.1226448406@localhost.localdomain> (raw)
The current CHIP11 errata truncates the device tree memory node, and subtracts
(hardcoded) 4096 bytes. This breaks kernels with larger PAGE_SIZE, since the
bootmem allocator assumes that total memory is a multiple of 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>
---
Changes from v2:
- David pointed out I'd duplicated the fdt_add_mem_rsv() prototype, and that
4xx.c should directly include libfdt/libfdt.h instead.
Using large pages results in a huge performance improvement for KVM, and this
patch is required to make Ilya's large page patch work. David and/or Josh,
please apply.
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
@@ -20,8 +20,9 @@
#include "ops.h"
#include "reg.h"
#include "dcr.h"
+#include "libfdt/libfdt.h"
-static unsigned long chip_11_errata(unsigned long memsize)
+static void chip_11_errata(unsigned long memsize)
{
unsigned long pvr;
@@ -31,13 +32,11 @@ static unsigned long chip_11_errata(unsi
case 0x40000850:
case 0x400008d0:
case 0x200008d0:
- memsize -= 4096;
+ fdt_add_mem_rsv(fdt, memsize - 256, 256);
break;
default:
break;
}
-
- return memsize;
}
/* Read the 4xx SDRAM controller to get size of system memory. */
@@ -53,7 +52,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 +218,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
@@ -51,7 +51,7 @@
#define devp_offset_find(devp) (((int)(devp))-1)
#define devp_offset(devp) (devp ? ((int)(devp))-1 : 0)
-static void *fdt;
+void *fdt;
static void *buf; /* = NULL */
#define EXPAND_GRANULARITY 1024
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
@@ -14,6 +14,7 @@
#include <stddef.h>
#include "types.h"
#include "string.h"
+#include "libfdt_env.h"
#define COMMAND_LINE_SIZE 512
#define MAX_PATH_LEN 256
@@ -32,6 +33,9 @@ struct platform_ops {
void * (*vmlinux_alloc)(unsigned long size);
};
extern struct platform_ops platform_ops;
+
+/* The device tree itself. Should almost always be accessed via dt_ops. */
+extern void *fdt;
/* Device Tree operations */
struct dt_ops {
next reply other threads:[~2008-11-12 0:06 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-12 0:06 Hollis Blanchard [this message]
2008-11-12 0:09 ` [PATCH] [v3] powerpc/4xx: work around CHIP11 errata in a more David Gibson
2008-11-12 0:09 ` [PATCH] [v3] powerpc/4xx: work around CHIP11 errata in a more PAGE_SIZE-friendly way David Gibson
2008-11-12 4:37 ` [PATCH] [v3] powerpc/4xx: work around CHIP11 errata in a more Benjamin Herrenschmidt
2008-11-12 4:37 ` [PATCH] [v3] powerpc/4xx: work around CHIP11 errata in a more PAGE_SIZE-friendly way Benjamin Herrenschmidt
2008-11-12 11:31 ` [PATCH] [v3] powerpc/4xx: work around CHIP11 errata in a more Josh Boyer
2008-11-12 11:31 ` [PATCH] [v3] powerpc/4xx: work around CHIP11 errata in a more PAGE_SIZE-friendly way Josh Boyer
2008-11-12 11:52 ` [PATCH] [v3] powerpc/4xx: work around CHIP11 errata in a more Benjamin Herrenschmidt
2008-11-12 11:52 ` [PATCH] [v3] powerpc/4xx: work around CHIP11 errata in a more PAGE_SIZE-friendly way Benjamin Herrenschmidt
2008-11-12 15:11 ` [PATCH] [v3] powerpc/4xx: work around CHIP11 errata in a more Hollis Blanchard
2008-11-12 15:11 ` [PATCH] [v3] powerpc/4xx: work around CHIP11 errata in a more PAGE_SIZE-friendly way Hollis Blanchard
2008-11-12 20:44 ` [PATCH] [v3] powerpc/4xx: work around CHIP11 errata in a more Benjamin Herrenschmidt
2008-11-12 20:44 ` [PATCH] [v3] powerpc/4xx: work around CHIP11 errata in a more PAGE_SIZE-friendly way Benjamin Herrenschmidt
2008-11-12 20:53 ` [PATCH] [v3] powerpc/4xx: work around CHIP11 errata in a more Josh Boyer
2008-11-12 20:53 ` [PATCH] [v3] powerpc/4xx: work around CHIP11 errata in a more PAGE_SIZE-friendly way Josh Boyer
2008-11-13 19:54 ` [PATCH] [v3] powerpc/4xx: work around CHIP11 errata in a more Hollis Blanchard
2008-11-13 19:54 ` [PATCH] [v3] powerpc/4xx: work around CHIP11 errata in a more PAGE_SIZE-friendly way Hollis Blanchard
-- strict thread matches above, loose matches on Subject: below --
2008-11-14 17:25 Milton Miller
2008-11-14 17:29 ` Milton Miller
2008-11-14 22:09 ` Hollis Blanchard
2008-11-18 20:33 ` Hollis Blanchard
2008-11-24 20:07 ` Hollis Blanchard
2008-11-25 0:10 ` Michael Ellerman
2008-11-25 17:10 ` Milton Miller
2008-11-25 21:17 ` Hollis Blanchard
2008-11-25 21:53 ` Hollis Blanchard
2008-11-25 23:43 ` Michael Ellerman
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=700c59731cf97778d3a4.1226448406@localhost.localdomain \
--to=hollisb@us.ibm.com \
--cc=dwg@au1.ibm.com \
--cc=jwboyer@linux.vnet.ibm.com \
--cc=kvm-ppc@vger.kernel.org \
--cc=linuxppc-dev@ozlabs.org \
--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.