aboutsummaryrefslogtreecommitdiff
path: root/hw/block/xen-block.c
diff options
context:
space:
mode:
authorDavid Woodhouse <dwmw@amazon.co.uk>2023-01-30 17:27:07 +0100
committerDavid Woodhouse <dwmw@amazon.co.uk>2023-03-07 17:04:30 +0000
commit072519037dde8957cc8c519caad21e7816b46129 (patch)
treeb3e64b694105299128d944c49602006f567ff61c /hw/block/xen-block.c
parent240cc11369fc692c037a6ec46b358e75a55df894 (diff)
downloadqemu-072519037dde8957cc8c519caad21e7816b46129.zip
qemu-072519037dde8957cc8c519caad21e7816b46129.tar.gz
qemu-072519037dde8957cc8c519caad21e7816b46129.tar.bz2
hw/xen: Only advertise ring-page-order for xen-block if gnttab supports it
Whem emulating Xen, multi-page grants are distinctly non-trivial and we have elected not to support them for the time being. Don't advertise them to the guest. Signed-off-by: David Woodhouse <dwmw@amazon.co.uk> Reviewed-by: Paul Durrant <paul@xen.org>
Diffstat (limited to 'hw/block/xen-block.c')
-rw-r--r--hw/block/xen-block.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/hw/block/xen-block.c b/hw/block/xen-block.c
index 8729961..f5a7445 100644
--- a/hw/block/xen-block.c
+++ b/hw/block/xen-block.c
@@ -83,7 +83,8 @@ static void xen_block_connect(XenDevice *xendev, Error **errp)
g_free(ring_ref);
return;
}
- } else if (order <= blockdev->props.max_ring_page_order) {
+ } else if (qemu_xen_gnttab_can_map_multi() &&
+ order <= blockdev->props.max_ring_page_order) {
unsigned int i;
nr_ring_ref = 1 << order;
@@ -255,8 +256,12 @@ static void xen_block_realize(XenDevice *xendev, Error **errp)
}
xen_device_backend_printf(xendev, "feature-flush-cache", "%u", 1);
- xen_device_backend_printf(xendev, "max-ring-page-order", "%u",
- blockdev->props.max_ring_page_order);
+
+ if (qemu_xen_gnttab_can_map_multi()) {
+ xen_device_backend_printf(xendev, "max-ring-page-order", "%u",
+ blockdev->props.max_ring_page_order);
+ }
+
xen_device_backend_printf(xendev, "info", "%u", blockdev->info);
xen_device_frontend_printf(xendev, "virtual-device", "%lu",