26ba25
From c279e652b149621847ef38f08254569632f7ee3b Mon Sep 17 00:00:00 2001
26ba25
From: David Gibson <dgibson@redhat.com>
26ba25
Date: Wed, 25 Jul 2018 07:23:41 +0100
26ba25
Subject: [PATCH 01/14] spapr: Correct inverted test in spapr_pc_dimm_node()
26ba25
26ba25
RH-Author: David Gibson <dgibson@redhat.com>
26ba25
Message-id: <20180725072341.8452-1-dgibson@redhat.com>
26ba25
Patchwork-id: 81498
26ba25
O-Subject: [RHEL-8.0 qemu-kvm PATCH] spapr: Correct inverted test in spapr_pc_dimm_node()
26ba25
Bugzilla: 1601671
26ba25
RH-Acked-by: Thomas Huth <thuth@redhat.com>
26ba25
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
26ba25
RH-Acked-by: Serhii Popovych <spopovyc@redhat.com>
26ba25
26ba25
From: David Gibson <david@gibson.dropbear.id.au>
26ba25
26ba25
This function was introduced between v2.11 and v2.12 to replace obsolete
26ba25
ways of specifying the NUMA nodes for DIMMs.  It's used to find the correct
26ba25
node for an LMB, by locating which DIMM object it lies within.
26ba25
26ba25
Unfortunately, one of the checks is inverted, so we check whether the
26ba25
address is less than two different things, rather than actually checking
26ba25
a range.  This introduced a regression, meaning that after a reboot qemu
26ba25
will advertise incorrect node information for memory to the guest.
26ba25
26ba25
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
26ba25
Reviewed-by: Greg Kurz <groug@kaod.org>
26ba25
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
26ba25
(cherry picked from commit ccc2cef8b3f1dedd059924eb8ec1a87eff8ef607)
26ba25
26ba25
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1601671
26ba25
Brew: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=17345816
26ba25
26ba25
Signed-off-by: David Gibson <dgibson@redhat.com>
26ba25
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
26ba25
---
26ba25
 hw/ppc/spapr.c | 2 +-
26ba25
 1 file changed, 1 insertion(+), 1 deletion(-)
26ba25
26ba25
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
26ba25
index ef00937..7de3f07 100644
26ba25
--- a/hw/ppc/spapr.c
26ba25
+++ b/hw/ppc/spapr.c
26ba25
@@ -659,7 +659,7 @@ static uint32_t spapr_pc_dimm_node(MemoryDeviceInfoList *list, ram_addr_t addr)
26ba25
         if (value && value->type == MEMORY_DEVICE_INFO_KIND_DIMM) {
26ba25
             PCDIMMDeviceInfo *pcdimm_info = value->u.dimm.data;
26ba25
 
26ba25
-            if (pcdimm_info->addr >= addr &&
26ba25
+            if (addr >= pcdimm_info->addr &&
26ba25
                 addr < (pcdimm_info->addr + pcdimm_info->size)) {
26ba25
                 return pcdimm_info->node;
26ba25
             }
26ba25
-- 
26ba25
1.8.3.1
26ba25