]> xenbits.xensource.com Git - people/aperard/qemu-dm.git/commitdiff
hw/xen: Add "mode" parameter to xen-block devices
authorDavid Woodhouse <dwmw@amazon.co.uk>
Fri, 7 Feb 2025 14:37:24 +0000 (14:37 +0000)
committerAnthony PERARD <anthony.perard@vates.tech>
Mon, 10 Mar 2025 12:27:30 +0000 (13:27 +0100)
Block devices don't work in PV Grub (0.9x) if there is no mode specified. It
complains: "Error ENOENT when reading the mode"

Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
Message-Id: <20250207143724.30792-2-dwmw2@infradead.org>
Signed-off-by: Anthony PERARD <anthony.perard@vates.tech>
hw/block/xen-block.c

index 2098286b5f96b0888c08e3e8ddbd324303787946..ec04102b669edcdcc8febd6ed9e0158d48df9462 100644 (file)
@@ -408,6 +408,8 @@ static void xen_block_realize(XenDevice *xendev, Error **errp)
     }
 
     xen_device_backend_printf(xendev, "info", "%u", blockdev->info);
+    xen_device_backend_printf(xendev, "mode",
+                              (blockdev->info & VDISK_READONLY) ? "r" : "w");
 
     xen_device_frontend_printf(xendev, "virtual-device", "%lu",
                                vdev->number);