902636
From 0ba8d4ea1cc34230356cc446dfa8d1cb52cbd2f3 Mon Sep 17 00:00:00 2001
902636
From: Thomas Huth <thuth@redhat.com>
902636
Date: Fri, 29 May 2020 05:54:05 -0400
902636
Subject: [PATCH 23/42] s390x: protvirt: Add migration blocker
902636
902636
RH-Author: Thomas Huth <thuth@redhat.com>
902636
Message-id: <20200529055420.16855-24-thuth@redhat.com>
902636
Patchwork-id: 97043
902636
O-Subject: [RHEL-8.3.0 qemu-kvm PATCH v2 23/38] s390x: protvirt: Add migration blocker
902636
Bugzilla: 1828317
902636
RH-Acked-by: Claudio Imbrenda <cimbrend@redhat.com>
902636
RH-Acked-by: Cornelia Huck <cohuck@redhat.com>
902636
RH-Acked-by: David Hildenbrand <david@redhat.com>
902636
902636
From: Janosch Frank <frankja@linux.ibm.com>
902636
902636
Migration is not yet supported.
902636
902636
Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
902636
Reviewed-by: David Hildenbrand <david@redhat.com>
902636
Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>
902636
Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
902636
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
902636
Message-Id: <20200319131921.2367-5-frankja@linux.ibm.com>
902636
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
902636
(cherry picked from commit 0141e1b47707d90f5bd9d252da064ebdaca698a6)
902636
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
902636
---
902636
 hw/s390x/s390-virtio-ccw.c | 18 ++++++++++++++++++
902636
 1 file changed, 18 insertions(+)
902636
902636
diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c
902636
index 82da1d9ab5..dbd5125232 100644
902636
--- a/hw/s390x/s390-virtio-ccw.c
902636
+++ b/hw/s390x/s390-virtio-ccw.c
902636
@@ -44,6 +44,9 @@
902636
 #include "sysemu/sysemu.h"
902636
 #include "hw/s390x/pv.h"
902636
 #include <linux/kvm.h>
902636
+#include "migration/blocker.h"
902636
+
902636
+static Error *pv_mig_blocker;
902636
 
902636
 S390CPU *s390_cpu_addr2state(uint16_t cpu_addr)
902636
 {
902636
@@ -325,15 +328,30 @@ static void s390_machine_unprotect(S390CcwMachineState *ms)
902636
 {
902636
     s390_pv_vm_disable();
902636
     ms->pv = false;
902636
+    migrate_del_blocker(pv_mig_blocker);
902636
+    error_free_or_abort(&pv_mig_blocker);
902636
 }
902636
 
902636
 static int s390_machine_protect(S390CcwMachineState *ms)
902636
 {
902636
+    Error *local_err = NULL;
902636
     int rc;
902636
 
902636
+    error_setg(&pv_mig_blocker,
902636
+               "protected VMs are currently not migrateable.");
902636
+    rc = migrate_add_blocker(pv_mig_blocker, &local_err);
902636
+    if (rc) {
902636
+        error_report_err(local_err);
902636
+        error_free_or_abort(&pv_mig_blocker);
902636
+        return rc;
902636
+    }
902636
+
902636
     /* Create SE VM */
902636
     rc = s390_pv_vm_enable();
902636
     if (rc) {
902636
+        error_report_err(local_err);
902636
+        migrate_del_blocker(pv_mig_blocker);
902636
+        error_free_or_abort(&pv_mig_blocker);
902636
         return rc;
902636
     }
902636
 
902636
-- 
902636
2.27.0
902636