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