[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PULL 32/32] spapr: limit numa memory regions by ram size
From: |
Alexander Graf |
Subject: |
[Qemu-ppc] [PULL 32/32] spapr: limit numa memory regions by ram size |
Date: |
Fri, 20 Dec 2013 02:00:54 +0100 |
From: Paul Mackerras <address@hidden>
This makes sure that all NUMA memory blocks reside within RAM or
have zero length.
Reviewed-by: Thomas Huth <address@hidden>
Signed-off-by: Alexey Kardashevskiy <address@hidden>
Signed-off-by: Alexander Graf <address@hidden>
---
hw/ppc/spapr.c | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index 6a79b1f..93d02c1 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -526,12 +526,16 @@ static int spapr_populate_memory(sPAPREnvironment *spapr,
void *fdt)
cpu_to_be32(0x0), cpu_to_be32(0x0),
cpu_to_be32(0x0)};
char mem_name[32];
- hwaddr node0_size, mem_start;
+ hwaddr node0_size, mem_start, node_size;
uint64_t mem_reg_property[2];
int i, off;
/* memory node(s) */
- node0_size = (nb_numa_nodes > 1) ? node_mem[0] : ram_size;
+ if (nb_numa_nodes > 1 && node_mem[0] < ram_size) {
+ node0_size = node_mem[0];
+ } else {
+ node0_size = ram_size;
+ }
/* RMA */
mem_reg_property[0] = 0;
@@ -563,7 +567,15 @@ static int spapr_populate_memory(sPAPREnvironment *spapr,
void *fdt)
mem_start = node0_size;
for (i = 1; i < nb_numa_nodes; i++) {
mem_reg_property[0] = cpu_to_be64(mem_start);
- mem_reg_property[1] = cpu_to_be64(node_mem[i]);
+ if (mem_start >= ram_size) {
+ node_size = 0;
+ } else {
+ node_size = node_mem[i];
+ if (node_size > ram_size - mem_start) {
+ node_size = ram_size - mem_start;
+ }
+ }
+ mem_reg_property[1] = cpu_to_be64(node_size);
associativity[3] = associativity[4] = cpu_to_be32(i);
sprintf(mem_name, "memory@" TARGET_FMT_lx, mem_start);
off = fdt_add_subnode(fdt, 0, mem_name);
@@ -573,7 +585,7 @@ static int spapr_populate_memory(sPAPREnvironment *spapr,
void *fdt)
sizeof(mem_reg_property))));
_FDT((fdt_setprop(fdt, off, "ibm,associativity", associativity,
sizeof(associativity))));
- mem_start += node_mem[i];
+ mem_start += node_size;
}
return 0;
--
1.8.1.4
- [Qemu-ppc] [PULL 12/32] Add lxvw4x, (continued)
- [Qemu-ppc] [PULL 12/32] Add lxvw4x, Alexander Graf, 2013/12/19
- [Qemu-ppc] [PULL 15/32] target-ppc: move POWER7+ to a separate family, Alexander Graf, 2013/12/19
- [Qemu-ppc] [PULL 23/32] Add Power7 VSX Logical Instructions, Alexander Graf, 2013/12/19
- [Qemu-ppc] [PULL 31/32] spapr: make sure RMA is in first mode of first memory node, Alexander Graf, 2013/12/19
- [Qemu-ppc] [PULL 17/32] spapr-rtas: add ibm, (get|set)-system-parameter, Alexander Graf, 2013/12/19
- [Qemu-ppc] [PULL 19/32] spapr: tie spapr-nvram to -pflash, Alexander Graf, 2013/12/19
- [Qemu-ppc] [PULL 18/32] PPC: Use default pci bus name for grackle and heathrow, Alexander Graf, 2013/12/19
- [Qemu-ppc] [PULL 26/32] Add xxspltw, Alexander Graf, 2013/12/19
- [Qemu-ppc] [PULL 28/32] PPC: Add VSX to hflags, Alexander Graf, 2013/12/19
- [Qemu-ppc] [PULL 16/32] spapr-rtas: replace return code constants with macros, Alexander Graf, 2013/12/19
- [Qemu-ppc] [PULL 32/32] spapr: limit numa memory regions by ram size,
Alexander Graf <=
- [Qemu-ppc] [PULL 29/32] device_tree: s/qemu_devtree/qemu_fdt globally, Alexander Graf, 2013/12/19
- [Qemu-ppc] [PULL 25/32] Add xxsel, Alexander Graf, 2013/12/19
- [Qemu-ppc] [PULL 27/32] Add xxsldwi, Alexander Graf, 2013/12/19
- [Qemu-ppc] [PULL 21/32] Add VSX Scalar Move Instructions, Alexander Graf, 2013/12/19
- [Qemu-ppc] [PULL 30/32] device_tree: qemu_fdt_setprop: Rename val_array arg, Alexander Graf, 2013/12/19
- [Qemu-ppc] [PULL 22/32] Add VSX Vector Move Instructions, Alexander Graf, 2013/12/19
- [Qemu-ppc] [PULL 20/32] roms: Flush icache when writing roms to guest memory, Alexander Graf, 2013/12/19
- Re: [Qemu-ppc] [Qemu-devel] [PULL 00/32] ppc patch queue 2013-12-20, Andreas Färber, 2013/12/23