powerpc: align DTL buffer to AMS boundary

Message ID 1302706373-11653-1-git-send-email-nacc@us.ibm.com
State Superseded
Headers show

Commit Message

Nishanth Aravamudan April 13, 2011, 2:52 p.m.
PAPR specifies that DTL buffers can not cross AMS environments (aka CMO
in the PAPR) and can not cross a memory entitlement granule boundary
(4k). This is found in section H_REGISTER_VPA of the PAPR.
kmalloc does not guarantee an alignment of the allocation, though,
beyond 8 bytes (at least in my understanding). Over-allocate and align
the resulting address. Tested both with and without AMS on a p7

Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>

Note, I initially put this in a firmware check if-block, but we have
also seen some issues with alignment with non-AMS partitions. The wasted
memory is unfortunate, though.

Cc: Paul Mackerras <paulus@samba.org>
Cc: Anton Blanchard <anton@samba.org>
Cc: linuxppc-dev@ozlabs.org

 arch/powerpc/platforms/pseries/setup.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)


diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c
index 0007241..7df5ddb 100644
--- a/arch/powerpc/platforms/pseries/setup.c
+++ b/arch/powerpc/platforms/pseries/setup.c
@@ -39,6 +39,7 @@ 
 #include <linux/irq.h>
 #include <linux/seq_file.h>
 #include <linux/root_dev.h>
+#include <linux/memblock.h>
 #include <asm/mmu.h>
 #include <asm/processor.h>
@@ -293,14 +294,15 @@  static int alloc_dispatch_logs(void)
 	for_each_possible_cpu(cpu) {
 		pp = &paca[cpu];
-		dtl = kmalloc_node(DISPATCH_LOG_BYTES, GFP_KERNEL,
-				   cpu_to_node(cpu));
+		dtl = kmalloc_node(DISPATCH_LOG_BYTES + DISPATCH_LOG_BYTES - 1,
+				   GFP_KERNEL, cpu_to_node(cpu));
 		if (!dtl) {
 			pr_warn("Failed to allocate dispatch trace log for cpu %d\n",
 			pr_warn("Stolen time statistics will be unreliable\n");
 		pp->dtl_ridx = 0;
 		pp->dispatch_log = dtl;