spapr: Correct inverted test in spapr_pc_dimm_node()
authorDavid Gibson <david@gibson.dropbear.id.au>
Tue, 10 Jul 2018 01:40:52 +0000 (11:40 +1000)
committerDavid Gibson <david@gibson.dropbear.id.au>
Mon, 16 Jul 2018 01:18:09 +0000 (11:18 +1000)
This function was introduced between v2.11 and v2.12 to replace obsolete
ways of specifying the NUMA nodes for DIMMs.  It's used to find the correct
node for an LMB, by locating which DIMM object it lies within.

Unfortunately, one of the checks is inverted, so we check whether the
address is less than two different things, rather than actually checking
a range.  This introduced a regression, meaning that after a reboot qemu
will advertise incorrect node information for memory to the guest.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Greg Kurz <groug@kaod.org>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
hw/ppc/spapr.c

index 3f5e1d3ec21a8338efbca8f5a16f71b55d137e8a..421b2dd09b515502cd11ccdd26420a8117f80cda 100644 (file)
@@ -665,7 +665,7 @@ static uint32_t spapr_pc_dimm_node(MemoryDeviceInfoList *list, ram_addr_t addr)
         if (value && value->type == MEMORY_DEVICE_INFO_KIND_DIMM) {
             PCDIMMDeviceInfo *pcdimm_info = value->u.dimm.data;
 
-            if (pcdimm_info->addr >= addr &&
+            if (addr >= pcdimm_info->addr &&
                 addr < (pcdimm_info->addr + pcdimm_info->size)) {
                 return pcdimm_info->node;
             }