thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone

Blame SOURCES/kvm-ppc-spapr-Add-hotremovable-flag-on-DIMM-LMBs-on-drme.patch

8fced6
From 5b826e7ed09ecf3b2837d147fec6b593f629e450 Mon Sep 17 00:00:00 2001
8fced6
From: Greg Kurz <gkurz@redhat.com>
8fced6
Date: Fri, 4 Dec 2020 15:07:59 -0500
8fced6
Subject: [PATCH 01/14] ppc/spapr: Add hotremovable flag on DIMM LMBs on
8fced6
 drmem_v2
8fced6
MIME-Version: 1.0
8fced6
Content-Type: text/plain; charset=UTF-8
8fced6
Content-Transfer-Encoding: 8bit
8fced6
8fced6
RH-Author: Greg Kurz <gkurz@redhat.com>
8fced6
Message-id: <20201204150800.264829-2-gkurz@redhat.com>
8fced6
Patchwork-id: 100217
8fced6
O-Subject: [RHEL-8.4.0 qemu-kvm PATCH 1/2] ppc/spapr: Add hotremovable flag on DIMM LMBs on drmem_v2
8fced6
Bugzilla: 1901837
8fced6
RH-Acked-by: Danilo de Paula <ddepaula@redhat.com>
8fced6
RH-Acked-by: David Gibson <dgibson@redhat.com>
8fced6
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
8fced6
8fced6
From: Leonardo Bras <leonardo@linux.ibm.com>
8fced6
8fced6
On reboot, all memory that was previously added using object_add and
8fced6
device_add is placed in this DIMM area.
8fced6
8fced6
The new SPAPR_LMB_FLAGS_HOTREMOVABLE flag helps Linux to put this memory in
8fced6
the correct memory zone, so no unmovable allocations are made there,
8fced6
allowing the object to be easily hot-removed by device_del and
8fced6
object_del.
8fced6
8fced6
This new flag was accepted in Power Architecture documentation.
8fced6
8fced6
Signed-off-by: Leonardo Bras <leobras.c@gmail.com>
8fced6
Reviewed-by: Bharata B Rao <bharata@linux.ibm.com>
8fced6
Message-Id: <20200511200201.58537-1-leobras.c@gmail.com>
8fced6
[dwg: Fixed syntax error spotted by Cédric Le Goater]
8fced6
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
8fced6
(cherry picked from commit 0911a60c76b8598f1863c6951b2b690059465153)
8fced6
Signed-off-by: Greg Kurz <gkurz@redhat.com>
8fced6
8fced6
Conflicts:
8fced6
	hw/ppc/pnv.c
8fced6
8fced6
The changes in this file clearly don't belong to this
8fced6
patch. Same goes for the changes in target/ppc/cpu.h and
8fced6
target/ppc/excp_helper.c. Something went wrong when the
8fced6
patch was applied. Anyway, downstream doesn't especially
8fced6
care for pnv, so just drop the changes.
8fced6
8fced6
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
8fced6
---
8fced6
 hw/ppc/spapr.c         | 3 ++-
8fced6
 include/hw/ppc/spapr.h | 1 +
8fced6
 2 files changed, 3 insertions(+), 1 deletion(-)
8fced6
8fced6
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
8fced6
index a330f038b95..c74079702d0 100644
8fced6
--- a/hw/ppc/spapr.c
8fced6
+++ b/hw/ppc/spapr.c
8fced6
@@ -690,7 +690,8 @@ static int spapr_populate_drmem_v2(SpaprMachineState *spapr, void *fdt,
8fced6
         g_assert(drc);
8fced6
         elem = spapr_get_drconf_cell(size / lmb_size, addr,
8fced6
                                      spapr_drc_index(drc), node,
8fced6
-                                     SPAPR_LMB_FLAGS_ASSIGNED);
8fced6
+                                     (SPAPR_LMB_FLAGS_ASSIGNED |
8fced6
+                                      SPAPR_LMB_FLAGS_HOTREMOVABLE));
8fced6
         QSIMPLEQ_INSERT_TAIL(&drconf_queue, elem, entry);
8fced6
         nr_entries++;
8fced6
         cur_addr = addr + size;
8fced6
diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h
8fced6
index aa89cc4a95c..e047dabf300 100644
8fced6
--- a/include/hw/ppc/spapr.h
8fced6
+++ b/include/hw/ppc/spapr.h
8fced6
@@ -847,6 +847,7 @@ int spapr_rtc_import_offset(SpaprRtcState *rtc, int64_t legacy_offset);
8fced6
 #define SPAPR_LMB_FLAGS_ASSIGNED 0x00000008
8fced6
 #define SPAPR_LMB_FLAGS_DRC_INVALID 0x00000020
8fced6
 #define SPAPR_LMB_FLAGS_RESERVED 0x00000080
8fced6
+#define SPAPR_LMB_FLAGS_HOTREMOVABLE 0x00000100
8fced6
 
8fced6
 void spapr_do_system_reset_on_cpu(CPUState *cs, run_on_cpu_data arg);
8fced6
 
8fced6
-- 
8fced6
2.27.0
8fced6