[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 09/45] ppc/spapr: cleanup -machine pseries,nvdimm=X handling
From: |
Paolo Bonzini |
Subject: |
[PULL 09/45] ppc/spapr: cleanup -machine pseries,nvdimm=X handling |
Date: |
Tue, 15 Dec 2020 12:54:09 -0500 |
From: Igor Mammedov <imammedo@redhat.com>
Since NVDIMM support was introduced on pseries machine,
it ignored machine's nvdimm=on|off option and effectively
was always enabled on machines that support NVDIMM.
Later on commit
(28f5a716212 ppc/spapr_nvdimm: do not enable support with 'nvdimm=off')
makes QEMU error out in case user explicitly set 'nvdimm=off'
on CLI by peeking at machine_opts.
However that's a workaround and leaves 'nvdimms_state->is_enabled'
in inconsistent state (false) when it should be set true
by default.
Instead of using on machine_opts, set default to true for pseries
machine in initfn time. If user sets manually 'nvdimm=off'
it will overwrite default value to false and QEMU will error
as expected without need to peek into machine_opts.
That way pseries will have, nvdimm enabled by default and
will honor user provided 'nvdimm=on|off'.
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <20201208164606.4109134-1-imammedo@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
hw/ppc/spapr.c | 13 +++++++++++++
hw/ppc/spapr_nvdimm.c | 14 +-------------
2 files changed, 14 insertions(+), 13 deletions(-)
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index dee48a0043..489cefcb81 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -3275,6 +3275,19 @@ static void spapr_instance_init(Object *obj)
{
SpaprMachineState *spapr = SPAPR_MACHINE(obj);
SpaprMachineClass *smc = SPAPR_MACHINE_GET_CLASS(spapr);
+ MachineState *ms = MACHINE(spapr);
+ MachineClass *mc = MACHINE_GET_CLASS(ms);
+
+ /*
+ * NVDIMM support went live in 5.1 without considering that, in
+ * other archs, the user needs to enable NVDIMM support with the
+ * 'nvdimm' machine option and the default behavior is NVDIMM
+ * support disabled. It is too late to roll back to the standard
+ * behavior without breaking 5.1 guests.
+ */
+ if (mc->nvdimm_supported) {
+ ms->nvdimms_state->is_enabled = true;
+ }
spapr->htab_fd = -1;
spapr->use_hotplug_event_source = true;
diff --git a/hw/ppc/spapr_nvdimm.c b/hw/ppc/spapr_nvdimm.c
index 73ee006541..b46c36917c 100644
--- a/hw/ppc/spapr_nvdimm.c
+++ b/hw/ppc/spapr_nvdimm.c
@@ -27,10 +27,8 @@
#include "hw/ppc/spapr_nvdimm.h"
#include "hw/mem/nvdimm.h"
#include "qemu/nvdimm-utils.h"
-#include "qemu/option.h"
#include "hw/ppc/fdt.h"
#include "qemu/range.h"
-#include "sysemu/sysemu.h"
#include "hw/ppc/spapr_numa.h"
bool spapr_nvdimm_validate(HotplugHandler *hotplug_dev, NVDIMMDevice *nvdimm,
@@ -38,7 +36,6 @@ bool spapr_nvdimm_validate(HotplugHandler *hotplug_dev,
NVDIMMDevice *nvdimm,
{
const MachineClass *mc = MACHINE_GET_CLASS(hotplug_dev);
const MachineState *ms = MACHINE(hotplug_dev);
- const char *nvdimm_opt = qemu_opt_get(qemu_get_machine_opts(), "nvdimm");
g_autofree char *uuidstr = NULL;
QemuUUID uuid;
int ret;
@@ -48,16 +45,7 @@ bool spapr_nvdimm_validate(HotplugHandler *hotplug_dev,
NVDIMMDevice *nvdimm,
return false;
}
- /*
- * NVDIMM support went live in 5.1 without considering that, in
- * other archs, the user needs to enable NVDIMM support with the
- * 'nvdimm' machine option and the default behavior is NVDIMM
- * support disabled. It is too late to roll back to the standard
- * behavior without breaking 5.1 guests. What we can do is to
- * ensure that, if the user sets nvdimm=off, we error out
- * regardless of being 5.1 or newer.
- */
- if (!ms->nvdimms_state->is_enabled && nvdimm_opt) {
+ if (!ms->nvdimms_state->is_enabled) {
error_setg(errp, "nvdimm device found but 'nvdimm=off' was set");
return false;
}
--
2.26.2
- [PULL 00/45] Misc patches for 2020-12-15, Paolo Bonzini, 2020/12/15
- [PULL 03/45] vl: allow -incoming defer with -preconfig, Paolo Bonzini, 2020/12/15
- [PULL 02/45] vl: remove separate preconfig main_loop, Paolo Bonzini, 2020/12/15
- [PULL 05/45] vl: extract softmmu/globals.c, Paolo Bonzini, 2020/12/15
- [PULL 06/45] vl: move all generic initialization out of vl.c, Paolo Bonzini, 2020/12/15
- [PULL 08/45] machine: introduce MachineInitPhase, Paolo Bonzini, 2020/12/15
- [PULL 09/45] ppc/spapr: cleanup -machine pseries,nvdimm=X handling,
Paolo Bonzini <=
- [PULL 01/45] remove preconfig state, Paolo Bonzini, 2020/12/15
- [PULL 04/45] vl: extract softmmu/runstate.c, Paolo Bonzini, 2020/12/15
- [PULL 12/45] memory: allow creating MemoryRegions before accelerators, Paolo Bonzini, 2020/12/15
- [PULL 11/45] plugin: propagate errors, Paolo Bonzini, 2020/12/15
- [PULL 14/45] qmp: generalize watchdog-set-action to -no-reboot/-no-shutdown, Paolo Bonzini, 2020/12/15
- [PULL 10/45] vl: make qemu_get_machine_opts static, Paolo Bonzini, 2020/12/15
- [PULL 23/45] Remove the deprecated -show-cursor option, Paolo Bonzini, 2020/12/15
- [PULL 15/45] vl: Add an -action option specifying response to guest events, Paolo Bonzini, 2020/12/15
- [PULL 13/45] monitor: allow quitting while in preconfig state, Paolo Bonzini, 2020/12/15
- [PULL 16/45] vl: Add option to avoid stopping VM upon guest panic, Paolo Bonzini, 2020/12/15