From 7f22201ac85186dd476d5ff8da278ab603df72b6 Mon Sep 17 00:00:00 2001 From: Roger Pau Monne Date: Mon, 18 Jan 2021 16:33:30 +0100 Subject: [PATCH] xen-block: fix reporting of discard feature MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Linux blkfront expects both "discard-granularity" and "discard-alignment" present on xenbus in order to properly enable the feature, not exposing "discard-alignment" left some Linux blkfront versions with a broken discard setup. This has also been addressed in Linux with: https://lore.kernel.org/lkml/20210118151528.81668-1-roger.pau@citrix.com/T/#u Fix QEMU to report a "discard-alignment" of 0, in order for it to work with older Linux frontends. Reported-by: Arthur Borsboom Signed-off-by: Roger Pau Monné Message-Id: <20210118153330.82324-1-roger.pau@citrix.com> Reviewed-by: Paul Durrant Signed-off-by: Kevin Wolf --- hw/block/xen-block.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/block/xen-block.c b/hw/block/xen-block.c index 0e7d66c2a7..a3b69e2709 100644 --- a/hw/block/xen-block.c +++ b/hw/block/xen-block.c @@ -253,6 +253,7 @@ static void xen_block_realize(XenDevice *xendev, Error **errp) xen_device_backend_printf(xendev, "feature-discard", "%u", 1); xen_device_backend_printf(xendev, "discard-granularity", "%u", conf->discard_granularity); + xen_device_backend_printf(xendev, "discard-alignment", "%u", 0); } xen_device_backend_printf(xendev, "feature-flush-cache", "%u", 1);