[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PULL 15/52] spapr: Refactor spapr_populate_memory() to allow
From: |
Alexander Graf |
Subject: |
[Qemu-ppc] [PULL 15/52] spapr: Refactor spapr_populate_memory() to allow memoryless nodes |
Date: |
Thu, 4 Sep 2014 19:20:03 +0200 |
From: Alexey Kardashevskiy <address@hidden>
Current QEMU does not support memoryless NUMA nodes, however
actual hardware may have them so it makes sense to have a way
to emulate them in QEMU. This prepares SPAPR for that.
This moves 2 calls of spapr_populate_memory_node() into
the existing loop over numa nodes so first several nodes may
have no memory and this still will work.
If there is no numa configuration, the code assumes there is just
a single node at 0 and it has all the guest memory.
Signed-off-by: Alexey Kardashevskiy <address@hidden>
Signed-off-by: Alexander Graf <address@hidden>
---
hw/ppc/spapr.c | 40 ++++++++++++++++++++--------------------
1 file changed, 20 insertions(+), 20 deletions(-)
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index 9b9b6c4..718a201 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -661,36 +661,36 @@ static void spapr_populate_memory_node(void *fdt, int
nodeid, hwaddr start,
static int spapr_populate_memory(sPAPREnvironment *spapr, void *fdt)
{
- hwaddr node0_size, mem_start, node_size;
- int i;
-
- /* memory node(s) */
- if (nb_numa_nodes > 1 && numa_info[0].node_mem < ram_size) {
- node0_size = numa_info[0].node_mem;
- } else {
- node0_size = ram_size;
- }
+ hwaddr mem_start, node_size;
+ int i, nb_nodes = nb_numa_nodes;
+ NodeInfo *nodes = numa_info;
+ NodeInfo ramnode;
- /* RMA */
- spapr_populate_memory_node(fdt, 0, 0, spapr->rma_size);
-
- /* RAM: Node 0 */
- if (node0_size > spapr->rma_size) {
- spapr_populate_memory_node(fdt, 0, spapr->rma_size,
- node0_size - spapr->rma_size);
+ /* No NUMA nodes, assume there is just one node with whole RAM */
+ if (!nb_numa_nodes) {
+ nb_nodes = 1;
+ ramnode.node_mem = ram_size;
+ nodes = &ramnode;
}
- /* RAM: Node 1 and beyond */
- mem_start = node0_size;
- for (i = 1; i < nb_numa_nodes; i++) {
+ for (i = 0, mem_start = 0; i < nb_nodes; ++i) {
+ if (!nodes[i].node_mem) {
+ continue;
+ }
if (mem_start >= ram_size) {
node_size = 0;
} else {
- node_size = numa_info[i].node_mem;
+ node_size = nodes[i].node_mem;
if (node_size > ram_size - mem_start) {
node_size = ram_size - mem_start;
}
}
+ if (!mem_start) {
+ /* ppc_spapr_init() checks for rma_size <= node0_size already */
+ spapr_populate_memory_node(fdt, i, 0, spapr->rma_size);
+ mem_start += spapr->rma_size;
+ node_size -= spapr->rma_size;
+ }
spapr_populate_memory_node(fdt, i, mem_start, node_size);
mem_start += node_size;
}
--
1.8.1.4
- [Qemu-ppc] [PULL 00/52] ppc patch queue 2014-09-04, Alexander Graf, 2014/09/04
- [Qemu-ppc] [PULL 09/52] hw/ppc/spapr_hcall.c: Fix typo in function names, Alexander Graf, 2014/09/04
- [Qemu-ppc] [PULL 03/52] linux-user: Fix Stack Pointer Bug in PPC setup_rt_frame, Alexander Graf, 2014/09/04
- [Qemu-ppc] [PULL 12/52] spapr: fix possible memory leak, Alexander Graf, 2014/09/04
- [Qemu-ppc] [PULL 13/52] spapr: Move DT memory node rendering to a helper, Alexander Graf, 2014/09/04
- [Qemu-ppc] [PULL 04/52] linux-user: Split PPC Trampoline Encoding from Register Save, Alexander Graf, 2014/09/04
- [Qemu-ppc] [PULL 07/52] linux-user: Implement do_setcontext for PPC64, Alexander Graf, 2014/09/04
- [Qemu-ppc] [PULL 15/52] spapr: Refactor spapr_populate_memory() to allow memoryless nodes,
Alexander Graf <=
- [Qemu-ppc] [PULL 17/52] spapr: Add a helper for node0_size calculation, Alexander Graf, 2014/09/04
- [Qemu-ppc] [PULL 08/52] linux-user: Handle PPC64 ELFv2 Function Pointers, Alexander Graf, 2014/09/04
- [Qemu-ppc] [PULL 16/52] spapr: Split memory nodes to power-of-two blocks, Alexander Graf, 2014/09/04
- [Qemu-ppc] [PULL 01/52] PPC: KVM: Fix g3beige and mac99 when HV is loaded, Alexander Graf, 2014/09/04
- [Qemu-ppc] [PULL 18/52] spapr: Fix ibm, associativity for memory nodes, Alexander Graf, 2014/09/04
- [Qemu-ppc] [PULL 10/52] spapr: add uuid/host details to device tree, Alexander Graf, 2014/09/04
- [Qemu-ppc] [PULL 14/52] spapr: Use DT memory node rendering helper for other nodes, Alexander Graf, 2014/09/04
- [Qemu-ppc] [PULL 02/52] ppc: spapr-rtas - implement os-term rtas call, Alexander Graf, 2014/09/04
- [Qemu-ppc] [PULL 19/52] loader: Add load_image_size() to replace load_image(), Alexander Graf, 2014/09/04
- [Qemu-ppc] [PULL 21/52] ppc: debug stub: Get trap instruction opcode from KVM, Alexander Graf, 2014/09/04