From 5f2585772fff7ada93cb6691c51603451228a09c Mon Sep 17 00:00:00 2001 From: Evgeny Yakovlev Date: Tue, 5 Nov 2019 21:22:17 +0300 Subject: virtio-blk: advertise F_WCE (F_FLUSH) if F_CONFIG_WCE is advertised Virtio spec 1.1 (and earlier), 5.2.5.2 Driver Requirements: Device Initialization: "Devices SHOULD always offer VIRTIO_BLK_F_FLUSH, and MUST offer it if they offer VIRTIO_BLK_F_CONFIG_WCE" Currently F_CONFIG_WCE and F_WCE are not connected to each other. Qemu will advertise F_CONFIG_WCE if config-wce argument is set for virtio-blk device. And F_WCE is advertised only if underlying block backend actually has it's caching enabled. Fix this by advertising F_WCE if F_CONFIG_WCE is also advertised. To preserve backwards compatibility with newer machine types make this behaviour governed by "x-enable-wce-if-config-wce" virtio-blk-device property and introduce hw_compat_4_2 with new property being off by default for all machine types <= 4.2 (but don't introduce 4.3 machine type itself yet). Signed-off-by: Evgeny Yakovlev Message-Id: <1572978137-189218-1-git-send-email-wrfsh@yandex-team.ru> Signed-off-by: Stefan Hajnoczi --- hw/core/machine.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'hw/core') diff --git a/hw/core/machine.c b/hw/core/machine.c index 1689ad3bf8..023548b4f3 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -27,6 +27,11 @@ #include "hw/pci/pci.h" #include "hw/mem/nvdimm.h" +GlobalProperty hw_compat_4_2[] = { + { "virtio-blk-device", "x-enable-wce-if-config-wce", "off" }, +}; +const size_t hw_compat_4_2_len = G_N_ELEMENTS(hw_compat_4_2); + GlobalProperty hw_compat_4_1[] = { { "virtio-pci", "x-pcie-flr-init", "off" }, }; -- cgit v1.2.3