|
|
c687bc |
From ad7aaf34400b1bbd41bbec182fd5895eaad50932 Mon Sep 17 00:00:00 2001
|
|
|
c687bc |
From: Greg Kurz <gkurz@redhat.com>
|
|
|
c687bc |
Date: Tue, 19 Jan 2021 15:09:51 -0500
|
|
|
c687bc |
Subject: [PATCH 3/9] spapr: Don't use spapr_drc_needed() in CAS code
|
|
|
c687bc |
|
|
|
c687bc |
RH-Author: Greg Kurz <gkurz@redhat.com>
|
|
|
c687bc |
Message-id: <20210119150954.1017058-4-gkurz@redhat.com>
|
|
|
c687bc |
Patchwork-id: 100683
|
|
|
c687bc |
O-Subject: [RHEL-8.4.0 qemu-kvm PATCH v2 3/6] spapr: Don't use spapr_drc_needed() in CAS code
|
|
|
c687bc |
Bugzilla: 1901837
|
|
|
c687bc |
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
c687bc |
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
|
|
|
c687bc |
RH-Acked-by: David Gibson <dgibson@redhat.com>
|
|
|
c687bc |
|
|
|
c687bc |
From: Greg Kurz <groug@kaod.org>
|
|
|
c687bc |
|
|
|
c687bc |
We currently don't support hotplug of devices between boot and CAS. If
|
|
|
c687bc |
this happens a CAS reboot is triggered. We detect this during CAS using
|
|
|
c687bc |
the spapr_drc_needed() function which is essentially a VMStateDescription
|
|
|
c687bc |
.needed callback. Even if the condition for CAS reboot happens to be the
|
|
|
c687bc |
same as for DRC migration, it looks wrong to piggyback a migration helper
|
|
|
c687bc |
for this.
|
|
|
c687bc |
|
|
|
c687bc |
Introduce a helper with slightly more explicit name and use it in both CAS
|
|
|
c687bc |
and DRC migration code. Since a subsequent patch will enhance this helper
|
|
|
c687bc |
to cover the case of hot unplug, let's go for spapr_drc_transient(). While
|
|
|
c687bc |
here convert spapr_hotplugged_dev_before_cas() to the "transient" wording as
|
|
|
c687bc |
well.
|
|
|
c687bc |
|
|
|
c687bc |
This doesn't change any behaviour.
|
|
|
c687bc |
|
|
|
c687bc |
Signed-off-by: Greg Kurz <groug@kaod.org>
|
|
|
c687bc |
Message-Id: <158169248180.3465937.9531405453362718771.stgit@bahia.lan>
|
|
|
c687bc |
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
|
|
|
c687bc |
(cherry picked from commit 4b63db1289a9e597bc151fa5e4d72f882cb6de1e)
|
|
|
c687bc |
Signed-off-by: Greg Kurz <gkurz@redhat.com>
|
|
|
c687bc |
Signed-off-by: Jon Maloy <jmaloy.redhat.com>
|
|
|
c687bc |
---
|
|
|
c687bc |
hw/ppc/spapr_drc.c | 20 ++++++++++++++------
|
|
|
c687bc |
hw/ppc/spapr_hcall.c | 14 +++++++++-----
|
|
|
c687bc |
include/hw/ppc/spapr_drc.h | 4 +++-
|
|
|
c687bc |
3 files changed, 26 insertions(+), 12 deletions(-)
|
|
|
c687bc |
|
|
|
c687bc |
diff --git a/hw/ppc/spapr_drc.c b/hw/ppc/spapr_drc.c
|
|
|
c687bc |
index 62f1a42592..9b498d429e 100644
|
|
|
c687bc |
--- a/hw/ppc/spapr_drc.c
|
|
|
c687bc |
+++ b/hw/ppc/spapr_drc.c
|
|
|
c687bc |
@@ -455,23 +455,31 @@ void spapr_drc_reset(SpaprDrc *drc)
|
|
|
c687bc |
}
|
|
|
c687bc |
}
|
|
|
c687bc |
|
|
|
c687bc |
-bool spapr_drc_needed(void *opaque)
|
|
|
c687bc |
+bool spapr_drc_transient(SpaprDrc *drc)
|
|
|
c687bc |
{
|
|
|
c687bc |
- SpaprDrc *drc = (SpaprDrc *)opaque;
|
|
|
c687bc |
SpaprDrcClass *drck = SPAPR_DR_CONNECTOR_GET_CLASS(drc);
|
|
|
c687bc |
|
|
|
c687bc |
- /* If no dev is plugged in there is no need to migrate the DRC state */
|
|
|
c687bc |
+ /*
|
|
|
c687bc |
+ * If no dev is plugged in there is no need to migrate the DRC state
|
|
|
c687bc |
+ * nor to reset the DRC at CAS.
|
|
|
c687bc |
+ */
|
|
|
c687bc |
if (!drc->dev) {
|
|
|
c687bc |
return false;
|
|
|
c687bc |
}
|
|
|
c687bc |
|
|
|
c687bc |
/*
|
|
|
c687bc |
- * We need to migrate the state if it's not equal to the expected
|
|
|
c687bc |
- * long-term state, which is the same as the coldplugged initial
|
|
|
c687bc |
- * state */
|
|
|
c687bc |
+ * We need to reset the DRC at CAS or to migrate the DRC state if it's
|
|
|
c687bc |
+ * not equal to the expected long-term state, which is the same as the
|
|
|
c687bc |
+ * coldplugged initial state.
|
|
|
c687bc |
+ */
|
|
|
c687bc |
return (drc->state != drck->ready_state);
|
|
|
c687bc |
}
|
|
|
c687bc |
|
|
|
c687bc |
+static bool spapr_drc_needed(void *opaque)
|
|
|
c687bc |
+{
|
|
|
c687bc |
+ return spapr_drc_transient(opaque);
|
|
|
c687bc |
+}
|
|
|
c687bc |
+
|
|
|
c687bc |
static const VMStateDescription vmstate_spapr_drc = {
|
|
|
c687bc |
.name = "spapr_drc",
|
|
|
c687bc |
.version_id = 1,
|
|
|
c687bc |
diff --git a/hw/ppc/spapr_hcall.c b/hw/ppc/spapr_hcall.c
|
|
|
c687bc |
index 0f19be794c..d70e643752 100644
|
|
|
c687bc |
--- a/hw/ppc/spapr_hcall.c
|
|
|
c687bc |
+++ b/hw/ppc/spapr_hcall.c
|
|
|
c687bc |
@@ -1640,20 +1640,24 @@ static uint32_t cas_check_pvr(SpaprMachineState *spapr, PowerPCCPU *cpu,
|
|
|
c687bc |
return best_compat;
|
|
|
c687bc |
}
|
|
|
c687bc |
|
|
|
c687bc |
-static bool spapr_hotplugged_dev_before_cas(void)
|
|
|
c687bc |
+static bool spapr_transient_dev_before_cas(void)
|
|
|
c687bc |
{
|
|
|
c687bc |
- Object *drc_container, *obj;
|
|
|
c687bc |
+ Object *drc_container;
|
|
|
c687bc |
ObjectProperty *prop;
|
|
|
c687bc |
ObjectPropertyIterator iter;
|
|
|
c687bc |
|
|
|
c687bc |
drc_container = container_get(object_get_root(), "/dr-connector");
|
|
|
c687bc |
object_property_iter_init(&iter, drc_container);
|
|
|
c687bc |
while ((prop = object_property_iter_next(&iter))) {
|
|
|
c687bc |
+ SpaprDrc *drc;
|
|
|
c687bc |
+
|
|
|
c687bc |
if (!strstart(prop->type, "link<", NULL)) {
|
|
|
c687bc |
continue;
|
|
|
c687bc |
}
|
|
|
c687bc |
- obj = object_property_get_link(drc_container, prop->name, NULL);
|
|
|
c687bc |
- if (spapr_drc_needed(obj)) {
|
|
|
c687bc |
+ drc = SPAPR_DR_CONNECTOR(object_property_get_link(drc_container,
|
|
|
c687bc |
+ prop->name, NULL));
|
|
|
c687bc |
+
|
|
|
c687bc |
+ if (spapr_drc_transient(drc)) {
|
|
|
c687bc |
return true;
|
|
|
c687bc |
}
|
|
|
c687bc |
}
|
|
|
c687bc |
@@ -1812,7 +1816,7 @@ static target_ulong h_client_architecture_support(PowerPCCPU *cpu,
|
|
|
c687bc |
|
|
|
c687bc |
spapr_irq_update_active_intc(spapr);
|
|
|
c687bc |
|
|
|
c687bc |
- if (spapr_hotplugged_dev_before_cas()) {
|
|
|
c687bc |
+ if (spapr_transient_dev_before_cas()) {
|
|
|
c687bc |
spapr->cas_reboot = true;
|
|
|
c687bc |
}
|
|
|
c687bc |
|
|
|
c687bc |
diff --git a/include/hw/ppc/spapr_drc.h b/include/hw/ppc/spapr_drc.h
|
|
|
c687bc |
index 83f03cc577..7e09d57114 100644
|
|
|
c687bc |
--- a/include/hw/ppc/spapr_drc.h
|
|
|
c687bc |
+++ b/include/hw/ppc/spapr_drc.h
|
|
|
c687bc |
@@ -269,7 +269,9 @@ int spapr_dt_drc(void *fdt, int offset, Object *owner, uint32_t drc_type_mask);
|
|
|
c687bc |
|
|
|
c687bc |
void spapr_drc_attach(SpaprDrc *drc, DeviceState *d, Error **errp);
|
|
|
c687bc |
void spapr_drc_detach(SpaprDrc *drc);
|
|
|
c687bc |
-bool spapr_drc_needed(void *opaque);
|
|
|
c687bc |
+
|
|
|
c687bc |
+/* Returns true if a hot plug/unplug request is pending */
|
|
|
c687bc |
+bool spapr_drc_transient(SpaprDrc *drc);
|
|
|
c687bc |
|
|
|
c687bc |
static inline bool spapr_drc_unplug_requested(SpaprDrc *drc)
|
|
|
c687bc |
{
|
|
|
c687bc |
--
|
|
|
c687bc |
2.18.2
|
|
|
c687bc |
|