[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 16/52] spapr: Split memory nodes to power-of-two bloc
From: |
Alexander Graf |
Subject: |
[Qemu-devel] [PULL 16/52] spapr: Split memory nodes to power-of-two blocks |
Date: |
Thu, 4 Sep 2014 19:20:04 +0200 |
From: Alexey Kardashevskiy <address@hidden>
Linux kernel expects nodes to have power-of-two size and
does WARN_ON if this is not the case:
[ 0.041456] WARNING: at drivers/base/memory.c:115
which is:
===
/* Validate blk_sz is a power of 2 and not less than section size */
if ((block_sz & (block_sz - 1)) || (block_sz < MIN_MEMORY_BLOCK_SIZE)) {
WARN_ON(1);
block_sz = MIN_MEMORY_BLOCK_SIZE;
}
===
This splits memory nodes into set of smaller blocks with
a size which is a power of two. This makes sure the start
address of every node is aligned to the node size.
Signed-off-by: Alexey Kardashevskiy <address@hidden>
Signed-off-by: Alexander Graf <address@hidden>
---
hw/ppc/spapr.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index 718a201..075806f 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -691,8 +691,18 @@ static int spapr_populate_memory(sPAPREnvironment *spapr,
void *fdt)
mem_start += spapr->rma_size;
node_size -= spapr->rma_size;
}
- spapr_populate_memory_node(fdt, i, mem_start, node_size);
- mem_start += node_size;
+ for ( ; node_size; ) {
+ hwaddr sizetmp = pow2floor(node_size);
+
+ /* mem_start != 0 here */
+ if (ffsl(mem_start) < ffsl(sizetmp)) {
+ sizetmp = 1ULL << (ffsl(mem_start) - 1);
+ }
+
+ spapr_populate_memory_node(fdt, i, mem_start, sizetmp);
+ node_size -= sizetmp;
+ mem_start += sizetmp;
+ }
}
return 0;
--
1.8.1.4
- [Qemu-devel] [PULL 09/52] hw/ppc/spapr_hcall.c: Fix typo in function names, (continued)
- [Qemu-devel] [PULL 09/52] hw/ppc/spapr_hcall.c: Fix typo in function names, Alexander Graf, 2014/09/04
- [Qemu-devel] [PULL 02/52] ppc: spapr-rtas - implement os-term rtas call, Alexander Graf, 2014/09/04
- [Qemu-devel] [PULL 07/52] linux-user: Implement do_setcontext for PPC64, Alexander Graf, 2014/09/04
- [Qemu-devel] [PULL 05/52] linux-user: Enable Signal Handlers on PPC64, Alexander Graf, 2014/09/04
- [Qemu-devel] [PULL 13/52] spapr: Move DT memory node rendering to a helper, Alexander Graf, 2014/09/04
- [Qemu-devel] [PULL 08/52] linux-user: Handle PPC64 ELFv2 Function Pointers, Alexander Graf, 2014/09/04
- [Qemu-devel] [PULL 15/52] spapr: Refactor spapr_populate_memory() to allow memoryless nodes, Alexander Graf, 2014/09/04
- [Qemu-devel] [PULL 10/52] spapr: add uuid/host details to device tree, Alexander Graf, 2014/09/04
- [Qemu-devel] [PULL 01/52] PPC: KVM: Fix g3beige and mac99 when HV is loaded, Alexander Graf, 2014/09/04
- [Qemu-devel] [PULL 17/52] spapr: Add a helper for node0_size calculation, Alexander Graf, 2014/09/04
- [Qemu-devel] [PULL 16/52] spapr: Split memory nodes to power-of-two blocks,
Alexander Graf <=
- [Qemu-devel] [PULL 06/52] linux-user: Properly Dereference PPC64 ELFv1 Signal Handler Pointer, Alexander Graf, 2014/09/04
- [Qemu-devel] [PULL 18/52] spapr: Fix ibm, associativity for memory nodes, Alexander Graf, 2014/09/04
- [Qemu-devel] [PULL 19/52] loader: Add load_image_size() to replace load_image(), Alexander Graf, 2014/09/04
- [Qemu-devel] [PULL 14/52] spapr: Use DT memory node rendering helper for other nodes, Alexander Graf, 2014/09/04
- [Qemu-devel] [PULL 11/52] PPC: mac99: Move NVRAM to page boundary when necessary, Alexander Graf, 2014/09/04
- [Qemu-devel] [PULL 21/52] ppc: debug stub: Get trap instruction opcode from KVM, Alexander Graf, 2014/09/04
- [Qemu-devel] [PULL 23/52] ppc: Add software breakpoint support, Alexander Graf, 2014/09/04
- [Qemu-devel] [PULL 20/52] spapr: Locate RTAS and device-tree based on real RMA, Alexander Graf, 2014/09/04
- [Qemu-devel] [PULL 22/52] ppc: synchronize excp_vectors for injecting exception, Alexander Graf, 2014/09/04
- [Qemu-devel] [PULL 27/52] target-ppc: Bug Fix: rlwnm, Alexander Graf, 2014/09/04