diff mbox series

[08/26] hw/display/apple-gfx: Adds migration blocker

Message ID 20240715210705.32365-9-phil@philjordan.eu (mailing list archive)
State New, archived
Headers show
Series [01/26] hw/vmapple/apple-gfx: Introduce ParavirtualizedGraphics.Framework support | expand

Commit Message

Phil Dennis-Jordan July 15, 2024, 9:06 p.m. UTC
Although the underlying ParavirtualizedGraphics.framework does support
state (de-)serialisation, this is currently not yet integrated. We
therefore add a migration blocker for now.

Signed-off-by: Phil Dennis-Jordan <phil@philjordan.eu>
---
 hw/display/apple-gfx.m | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
diff mbox series

Patch

diff --git a/hw/display/apple-gfx.m b/hw/display/apple-gfx.m
index 39aba8d143..c97bd40cb5 100644
--- a/hw/display/apple-gfx.m
+++ b/hw/display/apple-gfx.m
@@ -24,6 +24,8 @@ 
 #include "sysemu/cpus.h"
 #include "ui/console.h"
 #include "monitor/monitor.h"
+#include "qapi/error.h"
+#include "migration/blocker.h"
 #import <ParavirtualizedGraphics/ParavirtualizedGraphics.h>
 
 #define TYPE_APPLE_GFX          "apple-gfx"
@@ -109,6 +111,8 @@  -(void)mmioWriteAtOffset:(size_t) offset value:(uint32_t)value;
 
 OBJECT_DECLARE_SIMPLE_TYPE(AppleGFXState, APPLE_GFX)
 
+static Error *apple_gfx_mig_blocker;
+
 static AppleGFXTask *apple_gfx_new_task(AppleGFXState *s, uint64_t len)
 {
     void *base = APPLE_GFX_BASE_VA;
@@ -362,6 +366,8 @@  static void apple_gfx_reset(DeviceState *d)
 static void apple_gfx_init(Object *obj)
 {
     AppleGFXState *s = APPLE_GFX(obj);
+    Error *local_err = NULL;
+    int r;
 
     memory_region_init_io(&s->iomem_gfx, obj, &apple_gfx_ops, s, TYPE_APPLE_GFX, 0x4000);
     memory_region_init_io(&s->iomem_iosfc, obj, &apple_iosfc_ops, s, TYPE_APPLE_GFX, 0x10000);
@@ -369,6 +375,16 @@  static void apple_gfx_init(Object *obj)
     sysbus_init_mmio(SYS_BUS_DEVICE(s), &s->iomem_iosfc);
     sysbus_init_irq(SYS_BUS_DEVICE(s), &s->irq_gfx);
     sysbus_init_irq(SYS_BUS_DEVICE(s), &s->irq_iosfc);
+
+    /* TODO: PVG framework supports serialising device state: integrate it! */
+    if (apple_gfx_mig_blocker == NULL) {
+        error_setg(&apple_gfx_mig_blocker,
+                  "Migration state blocked by apple-gfx display device");
+        r = migrate_add_blocker(&apple_gfx_mig_blocker, &local_err);
+        if (r < 0) {
+            error_report_err(local_err);
+        }
+    }
 }
 
 static void apple_gfx_realize(DeviceState *dev, Error **errp)