diff for duplicates of <20190215103239.28640-2-berrange@redhat.com> diff --git a/a/1.txt b/N1/1.txt index 6c74b27..c22e735 100644 --- a/a/1.txt +++ b/N1/1.txt @@ -1,3 +1,5 @@ +From: Daniel P. Berrangé <berrange@redhat.com> + A number of virtio devices (gpu, crypto, mouse, keyboard, tablet) only support the virtio-1 (aka modern) mode. Currently if the user launches QEMU, setting those devices to enable legacy mode, QEMU will silently @@ -13,21 +15,98 @@ disable_modern and disable_legacy fields that record the user's requested configuration. Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> +Message-Id: <20190215103239.28640-2-berrange@redhat.com> +Reviewed-by: Michael S. Tsirkin <mst@redhat.com> +Signed-off-by: Michael S. Tsirkin <mst@redhat.com> --- + hw/virtio/virtio-pci.h | 31 +++++++++++++++++++++++++------ hw/core/machine.c | 23 ++++++++++++++++++++--- hw/display/virtio-gpu-pci.c | 4 +++- hw/display/virtio-vga.c | 4 +++- hw/virtio/virtio-crypto-pci.c | 4 +++- hw/virtio/virtio-input-pci.c | 4 +++- hw/virtio/virtio-pci.c | 26 ++++++++++++++++---------- - hw/virtio/virtio-pci.h | 31 +++++++++++++++++++++++++------ 7 files changed, 73 insertions(+), 23 deletions(-) +diff --git a/hw/virtio/virtio-pci.h b/hw/virtio/virtio-pci.h +index 18581854ca..bfea2892a5 100644 +--- a/hw/virtio/virtio-pci.h ++++ b/hw/virtio/virtio-pci.h +@@ -15,6 +15,7 @@ + #ifndef QEMU_VIRTIO_PCI_H + #define QEMU_VIRTIO_PCI_H + ++#include "qapi/error.h" + #include "hw/pci/msi.h" + #include "hw/virtio/virtio-bus.h" + +@@ -118,6 +119,12 @@ typedef struct VirtIOPCIQueue { + uint32_t used[2]; + } VirtIOPCIQueue; + ++typedef enum { ++ VIRTIO_PCI_MODE_LEGACY, ++ VIRTIO_PCI_MODE_TRANSITIONAL, ++ VIRTIO_PCI_MODE_MODERN, ++} VirtIOPCIMode; ++ + struct VirtIOPCIProxy { + PCIDevice pci_dev; + MemoryRegion bar; +@@ -142,6 +149,7 @@ struct VirtIOPCIProxy { + bool disable_modern; + bool ignore_backend_features; + OnOffAuto disable_legacy; ++ VirtIOPCIMode mode; + uint32_t class_code; + uint32_t nvectors; + uint32_t dfselect; +@@ -156,23 +164,34 @@ struct VirtIOPCIProxy { + + static inline bool virtio_pci_modern(VirtIOPCIProxy *proxy) + { +- return !proxy->disable_modern; ++ return proxy->mode != VIRTIO_PCI_MODE_LEGACY; + } + + static inline bool virtio_pci_legacy(VirtIOPCIProxy *proxy) + { +- return proxy->disable_legacy == ON_OFF_AUTO_OFF; ++ return proxy->mode != VIRTIO_PCI_MODE_MODERN; + } + +-static inline void virtio_pci_force_virtio_1(VirtIOPCIProxy *proxy) ++static inline bool virtio_pci_force_virtio_1(VirtIOPCIProxy *proxy, ++ Error **errp) + { +- proxy->disable_modern = false; +- proxy->disable_legacy = ON_OFF_AUTO_ON; ++ if (proxy->disable_legacy == ON_OFF_AUTO_OFF) { ++ error_setg(errp, "Unable to set disable-legacy=off on a virtio-1.0 " ++ "only device"); ++ return false; ++ } ++ if (proxy->disable_modern == true) { ++ error_setg(errp, "Unable to set disable-modern=on on a virtio-1.0 " ++ "only device"); ++ return false; ++ } ++ proxy->mode = VIRTIO_PCI_MODE_MODERN; ++ return true; + } + + static inline void virtio_pci_disable_modern(VirtIOPCIProxy *proxy) + { +- proxy->disable_modern = true; ++ proxy->mode = VIRTIO_PCI_MODE_LEGACY; + } + + /* diff --git a/hw/core/machine.c b/hw/core/machine.c -index 077fbd182a..61fb791e6a 100644 +index 5d046a43e3..934c1bcceb 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c -@@ -96,9 +96,26 @@ const size_t hw_compat_2_7_len = G_N_ELEMENTS(hw_compat_2_7); +@@ -102,9 +102,26 @@ const size_t hw_compat_2_7_len = G_N_ELEMENTS(hw_compat_2_7); GlobalProperty hw_compat_2_6[] = { { "virtio-mmio", "format_transport_address", "off" }, @@ -73,10 +152,10 @@ index bdcd33c925..0bc4d9d424 100644 if (local_error) { diff --git a/hw/display/virtio-vga.c b/hw/display/virtio-vga.c -index 1e48009b74..d63fe8c345 100644 +index a2b803b75f..5d57bf5b0c 100644 --- a/hw/display/virtio-vga.c +++ b/hw/display/virtio-vga.c -@@ -145,7 +145,9 @@ static void virtio_vga_realize(VirtIOPCIProxy *vpci_dev, Error **errp) +@@ -154,7 +154,9 @@ static void virtio_vga_realize(VirtIOPCIProxy *vpci_dev, Error **errp) /* init virtio bits */ qdev_set_parent_bus(DEVICE(g), BUS(&vpci_dev->bus)); @@ -118,7 +197,7 @@ index 2c1397842b..28477729a3 100644 } diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c -index e978bfe760..ec31ec6cf3 100644 +index cb44e19b67..509c1ff555 100644 --- a/hw/virtio/virtio-pci.c +++ b/hw/virtio/virtio-pci.c @@ -1721,16 +1721,22 @@ static void virtio_pci_realize(PCIDevice *pci_dev, Error **errp) @@ -154,79 +233,5 @@ index e978bfe760..ec31ec6cf3 100644 } if (pcie_port && pci_is_express(pci_dev)) { -diff --git a/hw/virtio/virtio-pci.h b/hw/virtio/virtio-pci.h -index bd223a6e3b..16ef4c0a3f 100644 ---- a/hw/virtio/virtio-pci.h -+++ b/hw/virtio/virtio-pci.h -@@ -15,6 +15,7 @@ - #ifndef QEMU_VIRTIO_PCI_H - #define QEMU_VIRTIO_PCI_H - -+#include "qapi/error.h" - #include "hw/pci/msi.h" - #include "hw/virtio/virtio-bus.h" - -@@ -118,6 +119,12 @@ typedef struct VirtIOPCIQueue { - uint32_t used[2]; - } VirtIOPCIQueue; - -+typedef enum { -+ VIRTIO_PCI_MODE_LEGACY, -+ VIRTIO_PCI_MODE_TRANSITIONAL, -+ VIRTIO_PCI_MODE_MODERN, -+} VirtIOPCIMode; -+ - struct VirtIOPCIProxy { - PCIDevice pci_dev; - MemoryRegion bar; -@@ -142,6 +149,7 @@ struct VirtIOPCIProxy { - bool disable_modern; - bool ignore_backend_features; - OnOffAuto disable_legacy; -+ VirtIOPCIMode mode; - uint32_t class_code; - uint32_t nvectors; - uint32_t dfselect; -@@ -156,23 +164,34 @@ struct VirtIOPCIProxy { - - static inline bool virtio_pci_modern(VirtIOPCIProxy *proxy) - { -- return !proxy->disable_modern; -+ return proxy->mode != VIRTIO_PCI_MODE_LEGACY; - } - - static inline bool virtio_pci_legacy(VirtIOPCIProxy *proxy) - { -- return proxy->disable_legacy == ON_OFF_AUTO_OFF; -+ return proxy->mode != VIRTIO_PCI_MODE_MODERN; - } - --static inline void virtio_pci_force_virtio_1(VirtIOPCIProxy *proxy) -+static inline bool virtio_pci_force_virtio_1(VirtIOPCIProxy *proxy, -+ Error **errp) - { -- proxy->disable_modern = false; -- proxy->disable_legacy = ON_OFF_AUTO_ON; -+ if (proxy->disable_legacy == ON_OFF_AUTO_OFF) { -+ error_setg(errp, "Unable to set disable-legacy=off on a virtio-1.0 " -+ "only device"); -+ return false; -+ } -+ if (proxy->disable_modern == true) { -+ error_setg(errp, "Unable to set disable-modern=on on a virtio-1.0 " -+ "only device"); -+ return false; -+ } -+ proxy->mode = VIRTIO_PCI_MODE_MODERN; -+ return true; - } - - static inline void virtio_pci_disable_modern(VirtIOPCIProxy *proxy) - { -- proxy->disable_modern = true; -+ proxy->mode = VIRTIO_PCI_MODE_LEGACY; - } - - /* -- -2.20.1 +MST diff --git a/a/content_digest b/N1/content_digest index a2b919d..67ec932 100644 --- a/a/content_digest +++ b/N1/content_digest @@ -1,17 +1,17 @@ - "ref\020190215103239.28640-1-berrange@redhat.com\0" - "From\0Daniel P. Berrang\303\251 <berrange@redhat.com>\0" - "Subject\0[Qemu-devel] [PATCH v2 1/2] hw: report invalid disable-legacy|modern usage for virtio-1-only devs\0" - "Date\0Fri, 15 Feb 2019 10:32:38 +0000\0" + "ref\020190515121146.7248-1-mst@redhat.com\0" + "From\0Michael S. Tsirkin <mst@redhat.com>\0" + "Subject\0[Qemu-devel] [PULL 01/37] hw: report invalid disable-legacy|modern usage for virtio-1-only devs\0" + "Date\0Thu, 16 May 2019 08:17:43 -0400\0" "To\0qemu-devel@nongnu.org\0" - "Cc\0Michael S. Tsirkin <mst@redhat.com>" - Gonglei <arei.gonglei@huawei.com> - Marcel Apfelbaum <marcel.apfelbaum@gmail.com> + "Cc\0Peter Maydell <peter.maydell@linaro.org>" + " Daniel P. Berrang\303\251 <berrange@redhat.com>" Eduardo Habkost <ehabkost@redhat.com> - Gerd Hoffmann <kraxel@redhat.com> - " Andreas F\303\244rber <afaerber@suse.de>" - " Daniel P. Berrang\303\251 <berrange@redhat.com>\0" + Gonglei <arei.gonglei@huawei.com> + " Gerd Hoffmann <kraxel@redhat.com>\0" "\00:1\0" "b\0" + "From: Daniel P. Berrang\303\251 <berrange@redhat.com>\n" + "\n" "A number of virtio devices (gpu, crypto, mouse, keyboard, tablet) only\n" "support the virtio-1 (aka modern) mode. Currently if the user launches\n" "QEMU, setting those devices to enable legacy mode, QEMU will silently\n" @@ -27,21 +27,98 @@ "requested configuration.\n" "\n" "Signed-off-by: Daniel P. Berrang\303\251 <berrange@redhat.com>\n" + "Message-Id: <20190215103239.28640-2-berrange@redhat.com>\n" + "Reviewed-by: Michael S. Tsirkin <mst@redhat.com>\n" + "Signed-off-by: Michael S. Tsirkin <mst@redhat.com>\n" "---\n" + " hw/virtio/virtio-pci.h | 31 +++++++++++++++++++++++++------\n" " hw/core/machine.c | 23 ++++++++++++++++++++---\n" " hw/display/virtio-gpu-pci.c | 4 +++-\n" " hw/display/virtio-vga.c | 4 +++-\n" " hw/virtio/virtio-crypto-pci.c | 4 +++-\n" " hw/virtio/virtio-input-pci.c | 4 +++-\n" " hw/virtio/virtio-pci.c | 26 ++++++++++++++++----------\n" - " hw/virtio/virtio-pci.h | 31 +++++++++++++++++++++++++------\n" " 7 files changed, 73 insertions(+), 23 deletions(-)\n" "\n" + "diff --git a/hw/virtio/virtio-pci.h b/hw/virtio/virtio-pci.h\n" + "index 18581854ca..bfea2892a5 100644\n" + "--- a/hw/virtio/virtio-pci.h\n" + "+++ b/hw/virtio/virtio-pci.h\n" + "@@ -15,6 +15,7 @@\n" + " #ifndef QEMU_VIRTIO_PCI_H\n" + " #define QEMU_VIRTIO_PCI_H\n" + " \n" + "+#include \"qapi/error.h\"\n" + " #include \"hw/pci/msi.h\"\n" + " #include \"hw/virtio/virtio-bus.h\"\n" + " \n" + "@@ -118,6 +119,12 @@ typedef struct VirtIOPCIQueue {\n" + " uint32_t used[2];\n" + " } VirtIOPCIQueue;\n" + " \n" + "+typedef enum {\n" + "+ VIRTIO_PCI_MODE_LEGACY,\n" + "+ VIRTIO_PCI_MODE_TRANSITIONAL,\n" + "+ VIRTIO_PCI_MODE_MODERN,\n" + "+} VirtIOPCIMode;\n" + "+\n" + " struct VirtIOPCIProxy {\n" + " PCIDevice pci_dev;\n" + " MemoryRegion bar;\n" + "@@ -142,6 +149,7 @@ struct VirtIOPCIProxy {\n" + " bool disable_modern;\n" + " bool ignore_backend_features;\n" + " OnOffAuto disable_legacy;\n" + "+ VirtIOPCIMode mode;\n" + " uint32_t class_code;\n" + " uint32_t nvectors;\n" + " uint32_t dfselect;\n" + "@@ -156,23 +164,34 @@ struct VirtIOPCIProxy {\n" + " \n" + " static inline bool virtio_pci_modern(VirtIOPCIProxy *proxy)\n" + " {\n" + "- return !proxy->disable_modern;\n" + "+ return proxy->mode != VIRTIO_PCI_MODE_LEGACY;\n" + " }\n" + " \n" + " static inline bool virtio_pci_legacy(VirtIOPCIProxy *proxy)\n" + " {\n" + "- return proxy->disable_legacy == ON_OFF_AUTO_OFF;\n" + "+ return proxy->mode != VIRTIO_PCI_MODE_MODERN;\n" + " }\n" + " \n" + "-static inline void virtio_pci_force_virtio_1(VirtIOPCIProxy *proxy)\n" + "+static inline bool virtio_pci_force_virtio_1(VirtIOPCIProxy *proxy,\n" + "+ Error **errp)\n" + " {\n" + "- proxy->disable_modern = false;\n" + "- proxy->disable_legacy = ON_OFF_AUTO_ON;\n" + "+ if (proxy->disable_legacy == ON_OFF_AUTO_OFF) {\n" + "+ error_setg(errp, \"Unable to set disable-legacy=off on a virtio-1.0 \"\n" + "+ \"only device\");\n" + "+ return false;\n" + "+ }\n" + "+ if (proxy->disable_modern == true) {\n" + "+ error_setg(errp, \"Unable to set disable-modern=on on a virtio-1.0 \"\n" + "+ \"only device\");\n" + "+ return false;\n" + "+ }\n" + "+ proxy->mode = VIRTIO_PCI_MODE_MODERN;\n" + "+ return true;\n" + " }\n" + " \n" + " static inline void virtio_pci_disable_modern(VirtIOPCIProxy *proxy)\n" + " {\n" + "- proxy->disable_modern = true;\n" + "+ proxy->mode = VIRTIO_PCI_MODE_LEGACY;\n" + " }\n" + " \n" + " /*\n" "diff --git a/hw/core/machine.c b/hw/core/machine.c\n" - "index 077fbd182a..61fb791e6a 100644\n" + "index 5d046a43e3..934c1bcceb 100644\n" "--- a/hw/core/machine.c\n" "+++ b/hw/core/machine.c\n" - "@@ -96,9 +96,26 @@ const size_t hw_compat_2_7_len = G_N_ELEMENTS(hw_compat_2_7);\n" + "@@ -102,9 +102,26 @@ const size_t hw_compat_2_7_len = G_N_ELEMENTS(hw_compat_2_7);\n" " \n" " GlobalProperty hw_compat_2_6[] = {\n" " { \"virtio-mmio\", \"format_transport_address\", \"off\" },\n" @@ -87,10 +164,10 @@ " \n" " if (local_error) {\n" "diff --git a/hw/display/virtio-vga.c b/hw/display/virtio-vga.c\n" - "index 1e48009b74..d63fe8c345 100644\n" + "index a2b803b75f..5d57bf5b0c 100644\n" "--- a/hw/display/virtio-vga.c\n" "+++ b/hw/display/virtio-vga.c\n" - "@@ -145,7 +145,9 @@ static void virtio_vga_realize(VirtIOPCIProxy *vpci_dev, Error **errp)\n" + "@@ -154,7 +154,9 @@ static void virtio_vga_realize(VirtIOPCIProxy *vpci_dev, Error **errp)\n" " \n" " /* init virtio bits */\n" " qdev_set_parent_bus(DEVICE(g), BUS(&vpci_dev->bus));\n" @@ -132,7 +209,7 @@ " }\n" " \n" "diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c\n" - "index e978bfe760..ec31ec6cf3 100644\n" + "index cb44e19b67..509c1ff555 100644\n" "--- a/hw/virtio/virtio-pci.c\n" "+++ b/hw/virtio/virtio-pci.c\n" "@@ -1721,16 +1721,22 @@ static void virtio_pci_realize(PCIDevice *pci_dev, Error **errp)\n" @@ -168,81 +245,7 @@ " }\n" " \n" " if (pcie_port && pci_is_express(pci_dev)) {\n" - "diff --git a/hw/virtio/virtio-pci.h b/hw/virtio/virtio-pci.h\n" - "index bd223a6e3b..16ef4c0a3f 100644\n" - "--- a/hw/virtio/virtio-pci.h\n" - "+++ b/hw/virtio/virtio-pci.h\n" - "@@ -15,6 +15,7 @@\n" - " #ifndef QEMU_VIRTIO_PCI_H\n" - " #define QEMU_VIRTIO_PCI_H\n" - " \n" - "+#include \"qapi/error.h\"\n" - " #include \"hw/pci/msi.h\"\n" - " #include \"hw/virtio/virtio-bus.h\"\n" - " \n" - "@@ -118,6 +119,12 @@ typedef struct VirtIOPCIQueue {\n" - " uint32_t used[2];\n" - " } VirtIOPCIQueue;\n" - " \n" - "+typedef enum {\n" - "+ VIRTIO_PCI_MODE_LEGACY,\n" - "+ VIRTIO_PCI_MODE_TRANSITIONAL,\n" - "+ VIRTIO_PCI_MODE_MODERN,\n" - "+} VirtIOPCIMode;\n" - "+\n" - " struct VirtIOPCIProxy {\n" - " PCIDevice pci_dev;\n" - " MemoryRegion bar;\n" - "@@ -142,6 +149,7 @@ struct VirtIOPCIProxy {\n" - " bool disable_modern;\n" - " bool ignore_backend_features;\n" - " OnOffAuto disable_legacy;\n" - "+ VirtIOPCIMode mode;\n" - " uint32_t class_code;\n" - " uint32_t nvectors;\n" - " uint32_t dfselect;\n" - "@@ -156,23 +164,34 @@ struct VirtIOPCIProxy {\n" - " \n" - " static inline bool virtio_pci_modern(VirtIOPCIProxy *proxy)\n" - " {\n" - "- return !proxy->disable_modern;\n" - "+ return proxy->mode != VIRTIO_PCI_MODE_LEGACY;\n" - " }\n" - " \n" - " static inline bool virtio_pci_legacy(VirtIOPCIProxy *proxy)\n" - " {\n" - "- return proxy->disable_legacy == ON_OFF_AUTO_OFF;\n" - "+ return proxy->mode != VIRTIO_PCI_MODE_MODERN;\n" - " }\n" - " \n" - "-static inline void virtio_pci_force_virtio_1(VirtIOPCIProxy *proxy)\n" - "+static inline bool virtio_pci_force_virtio_1(VirtIOPCIProxy *proxy,\n" - "+ Error **errp)\n" - " {\n" - "- proxy->disable_modern = false;\n" - "- proxy->disable_legacy = ON_OFF_AUTO_ON;\n" - "+ if (proxy->disable_legacy == ON_OFF_AUTO_OFF) {\n" - "+ error_setg(errp, \"Unable to set disable-legacy=off on a virtio-1.0 \"\n" - "+ \"only device\");\n" - "+ return false;\n" - "+ }\n" - "+ if (proxy->disable_modern == true) {\n" - "+ error_setg(errp, \"Unable to set disable-modern=on on a virtio-1.0 \"\n" - "+ \"only device\");\n" - "+ return false;\n" - "+ }\n" - "+ proxy->mode = VIRTIO_PCI_MODE_MODERN;\n" - "+ return true;\n" - " }\n" - " \n" - " static inline void virtio_pci_disable_modern(VirtIOPCIProxy *proxy)\n" - " {\n" - "- proxy->disable_modern = true;\n" - "+ proxy->mode = VIRTIO_PCI_MODE_LEGACY;\n" - " }\n" - " \n" - " /*\n" "-- \n" - 2.20.1 + MST -347e3bbc6c33a5cf576385327d71cd24740758065e8c4fb3ee3cf82c69e1f46e +63daf1eea060465745b213372b66b0dd2b380af4eb2fee8895bc5ba4893a40f4
diff --git a/a/1.txt b/N2/1.txt index 6c74b27..c22e735 100644 --- a/a/1.txt +++ b/N2/1.txt @@ -1,3 +1,5 @@ +From: Daniel P. Berrangé <berrange@redhat.com> + A number of virtio devices (gpu, crypto, mouse, keyboard, tablet) only support the virtio-1 (aka modern) mode. Currently if the user launches QEMU, setting those devices to enable legacy mode, QEMU will silently @@ -13,21 +15,98 @@ disable_modern and disable_legacy fields that record the user's requested configuration. Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> +Message-Id: <20190215103239.28640-2-berrange@redhat.com> +Reviewed-by: Michael S. Tsirkin <mst@redhat.com> +Signed-off-by: Michael S. Tsirkin <mst@redhat.com> --- + hw/virtio/virtio-pci.h | 31 +++++++++++++++++++++++++------ hw/core/machine.c | 23 ++++++++++++++++++++--- hw/display/virtio-gpu-pci.c | 4 +++- hw/display/virtio-vga.c | 4 +++- hw/virtio/virtio-crypto-pci.c | 4 +++- hw/virtio/virtio-input-pci.c | 4 +++- hw/virtio/virtio-pci.c | 26 ++++++++++++++++---------- - hw/virtio/virtio-pci.h | 31 +++++++++++++++++++++++++------ 7 files changed, 73 insertions(+), 23 deletions(-) +diff --git a/hw/virtio/virtio-pci.h b/hw/virtio/virtio-pci.h +index 18581854ca..bfea2892a5 100644 +--- a/hw/virtio/virtio-pci.h ++++ b/hw/virtio/virtio-pci.h +@@ -15,6 +15,7 @@ + #ifndef QEMU_VIRTIO_PCI_H + #define QEMU_VIRTIO_PCI_H + ++#include "qapi/error.h" + #include "hw/pci/msi.h" + #include "hw/virtio/virtio-bus.h" + +@@ -118,6 +119,12 @@ typedef struct VirtIOPCIQueue { + uint32_t used[2]; + } VirtIOPCIQueue; + ++typedef enum { ++ VIRTIO_PCI_MODE_LEGACY, ++ VIRTIO_PCI_MODE_TRANSITIONAL, ++ VIRTIO_PCI_MODE_MODERN, ++} VirtIOPCIMode; ++ + struct VirtIOPCIProxy { + PCIDevice pci_dev; + MemoryRegion bar; +@@ -142,6 +149,7 @@ struct VirtIOPCIProxy { + bool disable_modern; + bool ignore_backend_features; + OnOffAuto disable_legacy; ++ VirtIOPCIMode mode; + uint32_t class_code; + uint32_t nvectors; + uint32_t dfselect; +@@ -156,23 +164,34 @@ struct VirtIOPCIProxy { + + static inline bool virtio_pci_modern(VirtIOPCIProxy *proxy) + { +- return !proxy->disable_modern; ++ return proxy->mode != VIRTIO_PCI_MODE_LEGACY; + } + + static inline bool virtio_pci_legacy(VirtIOPCIProxy *proxy) + { +- return proxy->disable_legacy == ON_OFF_AUTO_OFF; ++ return proxy->mode != VIRTIO_PCI_MODE_MODERN; + } + +-static inline void virtio_pci_force_virtio_1(VirtIOPCIProxy *proxy) ++static inline bool virtio_pci_force_virtio_1(VirtIOPCIProxy *proxy, ++ Error **errp) + { +- proxy->disable_modern = false; +- proxy->disable_legacy = ON_OFF_AUTO_ON; ++ if (proxy->disable_legacy == ON_OFF_AUTO_OFF) { ++ error_setg(errp, "Unable to set disable-legacy=off on a virtio-1.0 " ++ "only device"); ++ return false; ++ } ++ if (proxy->disable_modern == true) { ++ error_setg(errp, "Unable to set disable-modern=on on a virtio-1.0 " ++ "only device"); ++ return false; ++ } ++ proxy->mode = VIRTIO_PCI_MODE_MODERN; ++ return true; + } + + static inline void virtio_pci_disable_modern(VirtIOPCIProxy *proxy) + { +- proxy->disable_modern = true; ++ proxy->mode = VIRTIO_PCI_MODE_LEGACY; + } + + /* diff --git a/hw/core/machine.c b/hw/core/machine.c -index 077fbd182a..61fb791e6a 100644 +index 5d046a43e3..934c1bcceb 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c -@@ -96,9 +96,26 @@ const size_t hw_compat_2_7_len = G_N_ELEMENTS(hw_compat_2_7); +@@ -102,9 +102,26 @@ const size_t hw_compat_2_7_len = G_N_ELEMENTS(hw_compat_2_7); GlobalProperty hw_compat_2_6[] = { { "virtio-mmio", "format_transport_address", "off" }, @@ -73,10 +152,10 @@ index bdcd33c925..0bc4d9d424 100644 if (local_error) { diff --git a/hw/display/virtio-vga.c b/hw/display/virtio-vga.c -index 1e48009b74..d63fe8c345 100644 +index a2b803b75f..5d57bf5b0c 100644 --- a/hw/display/virtio-vga.c +++ b/hw/display/virtio-vga.c -@@ -145,7 +145,9 @@ static void virtio_vga_realize(VirtIOPCIProxy *vpci_dev, Error **errp) +@@ -154,7 +154,9 @@ static void virtio_vga_realize(VirtIOPCIProxy *vpci_dev, Error **errp) /* init virtio bits */ qdev_set_parent_bus(DEVICE(g), BUS(&vpci_dev->bus)); @@ -118,7 +197,7 @@ index 2c1397842b..28477729a3 100644 } diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c -index e978bfe760..ec31ec6cf3 100644 +index cb44e19b67..509c1ff555 100644 --- a/hw/virtio/virtio-pci.c +++ b/hw/virtio/virtio-pci.c @@ -1721,16 +1721,22 @@ static void virtio_pci_realize(PCIDevice *pci_dev, Error **errp) @@ -154,79 +233,5 @@ index e978bfe760..ec31ec6cf3 100644 } if (pcie_port && pci_is_express(pci_dev)) { -diff --git a/hw/virtio/virtio-pci.h b/hw/virtio/virtio-pci.h -index bd223a6e3b..16ef4c0a3f 100644 ---- a/hw/virtio/virtio-pci.h -+++ b/hw/virtio/virtio-pci.h -@@ -15,6 +15,7 @@ - #ifndef QEMU_VIRTIO_PCI_H - #define QEMU_VIRTIO_PCI_H - -+#include "qapi/error.h" - #include "hw/pci/msi.h" - #include "hw/virtio/virtio-bus.h" - -@@ -118,6 +119,12 @@ typedef struct VirtIOPCIQueue { - uint32_t used[2]; - } VirtIOPCIQueue; - -+typedef enum { -+ VIRTIO_PCI_MODE_LEGACY, -+ VIRTIO_PCI_MODE_TRANSITIONAL, -+ VIRTIO_PCI_MODE_MODERN, -+} VirtIOPCIMode; -+ - struct VirtIOPCIProxy { - PCIDevice pci_dev; - MemoryRegion bar; -@@ -142,6 +149,7 @@ struct VirtIOPCIProxy { - bool disable_modern; - bool ignore_backend_features; - OnOffAuto disable_legacy; -+ VirtIOPCIMode mode; - uint32_t class_code; - uint32_t nvectors; - uint32_t dfselect; -@@ -156,23 +164,34 @@ struct VirtIOPCIProxy { - - static inline bool virtio_pci_modern(VirtIOPCIProxy *proxy) - { -- return !proxy->disable_modern; -+ return proxy->mode != VIRTIO_PCI_MODE_LEGACY; - } - - static inline bool virtio_pci_legacy(VirtIOPCIProxy *proxy) - { -- return proxy->disable_legacy == ON_OFF_AUTO_OFF; -+ return proxy->mode != VIRTIO_PCI_MODE_MODERN; - } - --static inline void virtio_pci_force_virtio_1(VirtIOPCIProxy *proxy) -+static inline bool virtio_pci_force_virtio_1(VirtIOPCIProxy *proxy, -+ Error **errp) - { -- proxy->disable_modern = false; -- proxy->disable_legacy = ON_OFF_AUTO_ON; -+ if (proxy->disable_legacy == ON_OFF_AUTO_OFF) { -+ error_setg(errp, "Unable to set disable-legacy=off on a virtio-1.0 " -+ "only device"); -+ return false; -+ } -+ if (proxy->disable_modern == true) { -+ error_setg(errp, "Unable to set disable-modern=on on a virtio-1.0 " -+ "only device"); -+ return false; -+ } -+ proxy->mode = VIRTIO_PCI_MODE_MODERN; -+ return true; - } - - static inline void virtio_pci_disable_modern(VirtIOPCIProxy *proxy) - { -- proxy->disable_modern = true; -+ proxy->mode = VIRTIO_PCI_MODE_LEGACY; - } - - /* -- -2.20.1 +MST diff --git a/a/content_digest b/N2/content_digest index a2b919d..6233e5b 100644 --- a/a/content_digest +++ b/N2/content_digest @@ -1,17 +1,17 @@ - "ref\020190215103239.28640-1-berrange@redhat.com\0" - "From\0Daniel P. Berrang\303\251 <berrange@redhat.com>\0" - "Subject\0[Qemu-devel] [PATCH v2 1/2] hw: report invalid disable-legacy|modern usage for virtio-1-only devs\0" - "Date\0Fri, 15 Feb 2019 10:32:38 +0000\0" + "ref\020190520231008.20140-1-mst@redhat.com\0" + "From\0Michael S. Tsirkin <mst@redhat.com>\0" + "Subject\0[Qemu-devel] [PULL v2 01/36] hw: report invalid disable-legacy|modern usage for virtio-1-only devs\0" + "Date\0Mon, 20 May 2019 19:10:28 -0400\0" "To\0qemu-devel@nongnu.org\0" - "Cc\0Michael S. Tsirkin <mst@redhat.com>" - Gonglei <arei.gonglei@huawei.com> - Marcel Apfelbaum <marcel.apfelbaum@gmail.com> + "Cc\0Peter Maydell <peter.maydell@linaro.org>" + " Daniel P. Berrang\303\251 <berrange@redhat.com>" Eduardo Habkost <ehabkost@redhat.com> - Gerd Hoffmann <kraxel@redhat.com> - " Andreas F\303\244rber <afaerber@suse.de>" - " Daniel P. Berrang\303\251 <berrange@redhat.com>\0" + Gonglei <arei.gonglei@huawei.com> + " Gerd Hoffmann <kraxel@redhat.com>\0" "\00:1\0" "b\0" + "From: Daniel P. Berrang\303\251 <berrange@redhat.com>\n" + "\n" "A number of virtio devices (gpu, crypto, mouse, keyboard, tablet) only\n" "support the virtio-1 (aka modern) mode. Currently if the user launches\n" "QEMU, setting those devices to enable legacy mode, QEMU will silently\n" @@ -27,21 +27,98 @@ "requested configuration.\n" "\n" "Signed-off-by: Daniel P. Berrang\303\251 <berrange@redhat.com>\n" + "Message-Id: <20190215103239.28640-2-berrange@redhat.com>\n" + "Reviewed-by: Michael S. Tsirkin <mst@redhat.com>\n" + "Signed-off-by: Michael S. Tsirkin <mst@redhat.com>\n" "---\n" + " hw/virtio/virtio-pci.h | 31 +++++++++++++++++++++++++------\n" " hw/core/machine.c | 23 ++++++++++++++++++++---\n" " hw/display/virtio-gpu-pci.c | 4 +++-\n" " hw/display/virtio-vga.c | 4 +++-\n" " hw/virtio/virtio-crypto-pci.c | 4 +++-\n" " hw/virtio/virtio-input-pci.c | 4 +++-\n" " hw/virtio/virtio-pci.c | 26 ++++++++++++++++----------\n" - " hw/virtio/virtio-pci.h | 31 +++++++++++++++++++++++++------\n" " 7 files changed, 73 insertions(+), 23 deletions(-)\n" "\n" + "diff --git a/hw/virtio/virtio-pci.h b/hw/virtio/virtio-pci.h\n" + "index 18581854ca..bfea2892a5 100644\n" + "--- a/hw/virtio/virtio-pci.h\n" + "+++ b/hw/virtio/virtio-pci.h\n" + "@@ -15,6 +15,7 @@\n" + " #ifndef QEMU_VIRTIO_PCI_H\n" + " #define QEMU_VIRTIO_PCI_H\n" + " \n" + "+#include \"qapi/error.h\"\n" + " #include \"hw/pci/msi.h\"\n" + " #include \"hw/virtio/virtio-bus.h\"\n" + " \n" + "@@ -118,6 +119,12 @@ typedef struct VirtIOPCIQueue {\n" + " uint32_t used[2];\n" + " } VirtIOPCIQueue;\n" + " \n" + "+typedef enum {\n" + "+ VIRTIO_PCI_MODE_LEGACY,\n" + "+ VIRTIO_PCI_MODE_TRANSITIONAL,\n" + "+ VIRTIO_PCI_MODE_MODERN,\n" + "+} VirtIOPCIMode;\n" + "+\n" + " struct VirtIOPCIProxy {\n" + " PCIDevice pci_dev;\n" + " MemoryRegion bar;\n" + "@@ -142,6 +149,7 @@ struct VirtIOPCIProxy {\n" + " bool disable_modern;\n" + " bool ignore_backend_features;\n" + " OnOffAuto disable_legacy;\n" + "+ VirtIOPCIMode mode;\n" + " uint32_t class_code;\n" + " uint32_t nvectors;\n" + " uint32_t dfselect;\n" + "@@ -156,23 +164,34 @@ struct VirtIOPCIProxy {\n" + " \n" + " static inline bool virtio_pci_modern(VirtIOPCIProxy *proxy)\n" + " {\n" + "- return !proxy->disable_modern;\n" + "+ return proxy->mode != VIRTIO_PCI_MODE_LEGACY;\n" + " }\n" + " \n" + " static inline bool virtio_pci_legacy(VirtIOPCIProxy *proxy)\n" + " {\n" + "- return proxy->disable_legacy == ON_OFF_AUTO_OFF;\n" + "+ return proxy->mode != VIRTIO_PCI_MODE_MODERN;\n" + " }\n" + " \n" + "-static inline void virtio_pci_force_virtio_1(VirtIOPCIProxy *proxy)\n" + "+static inline bool virtio_pci_force_virtio_1(VirtIOPCIProxy *proxy,\n" + "+ Error **errp)\n" + " {\n" + "- proxy->disable_modern = false;\n" + "- proxy->disable_legacy = ON_OFF_AUTO_ON;\n" + "+ if (proxy->disable_legacy == ON_OFF_AUTO_OFF) {\n" + "+ error_setg(errp, \"Unable to set disable-legacy=off on a virtio-1.0 \"\n" + "+ \"only device\");\n" + "+ return false;\n" + "+ }\n" + "+ if (proxy->disable_modern == true) {\n" + "+ error_setg(errp, \"Unable to set disable-modern=on on a virtio-1.0 \"\n" + "+ \"only device\");\n" + "+ return false;\n" + "+ }\n" + "+ proxy->mode = VIRTIO_PCI_MODE_MODERN;\n" + "+ return true;\n" + " }\n" + " \n" + " static inline void virtio_pci_disable_modern(VirtIOPCIProxy *proxy)\n" + " {\n" + "- proxy->disable_modern = true;\n" + "+ proxy->mode = VIRTIO_PCI_MODE_LEGACY;\n" + " }\n" + " \n" + " /*\n" "diff --git a/hw/core/machine.c b/hw/core/machine.c\n" - "index 077fbd182a..61fb791e6a 100644\n" + "index 5d046a43e3..934c1bcceb 100644\n" "--- a/hw/core/machine.c\n" "+++ b/hw/core/machine.c\n" - "@@ -96,9 +96,26 @@ const size_t hw_compat_2_7_len = G_N_ELEMENTS(hw_compat_2_7);\n" + "@@ -102,9 +102,26 @@ const size_t hw_compat_2_7_len = G_N_ELEMENTS(hw_compat_2_7);\n" " \n" " GlobalProperty hw_compat_2_6[] = {\n" " { \"virtio-mmio\", \"format_transport_address\", \"off\" },\n" @@ -87,10 +164,10 @@ " \n" " if (local_error) {\n" "diff --git a/hw/display/virtio-vga.c b/hw/display/virtio-vga.c\n" - "index 1e48009b74..d63fe8c345 100644\n" + "index a2b803b75f..5d57bf5b0c 100644\n" "--- a/hw/display/virtio-vga.c\n" "+++ b/hw/display/virtio-vga.c\n" - "@@ -145,7 +145,9 @@ static void virtio_vga_realize(VirtIOPCIProxy *vpci_dev, Error **errp)\n" + "@@ -154,7 +154,9 @@ static void virtio_vga_realize(VirtIOPCIProxy *vpci_dev, Error **errp)\n" " \n" " /* init virtio bits */\n" " qdev_set_parent_bus(DEVICE(g), BUS(&vpci_dev->bus));\n" @@ -132,7 +209,7 @@ " }\n" " \n" "diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c\n" - "index e978bfe760..ec31ec6cf3 100644\n" + "index cb44e19b67..509c1ff555 100644\n" "--- a/hw/virtio/virtio-pci.c\n" "+++ b/hw/virtio/virtio-pci.c\n" "@@ -1721,16 +1721,22 @@ static void virtio_pci_realize(PCIDevice *pci_dev, Error **errp)\n" @@ -168,81 +245,7 @@ " }\n" " \n" " if (pcie_port && pci_is_express(pci_dev)) {\n" - "diff --git a/hw/virtio/virtio-pci.h b/hw/virtio/virtio-pci.h\n" - "index bd223a6e3b..16ef4c0a3f 100644\n" - "--- a/hw/virtio/virtio-pci.h\n" - "+++ b/hw/virtio/virtio-pci.h\n" - "@@ -15,6 +15,7 @@\n" - " #ifndef QEMU_VIRTIO_PCI_H\n" - " #define QEMU_VIRTIO_PCI_H\n" - " \n" - "+#include \"qapi/error.h\"\n" - " #include \"hw/pci/msi.h\"\n" - " #include \"hw/virtio/virtio-bus.h\"\n" - " \n" - "@@ -118,6 +119,12 @@ typedef struct VirtIOPCIQueue {\n" - " uint32_t used[2];\n" - " } VirtIOPCIQueue;\n" - " \n" - "+typedef enum {\n" - "+ VIRTIO_PCI_MODE_LEGACY,\n" - "+ VIRTIO_PCI_MODE_TRANSITIONAL,\n" - "+ VIRTIO_PCI_MODE_MODERN,\n" - "+} VirtIOPCIMode;\n" - "+\n" - " struct VirtIOPCIProxy {\n" - " PCIDevice pci_dev;\n" - " MemoryRegion bar;\n" - "@@ -142,6 +149,7 @@ struct VirtIOPCIProxy {\n" - " bool disable_modern;\n" - " bool ignore_backend_features;\n" - " OnOffAuto disable_legacy;\n" - "+ VirtIOPCIMode mode;\n" - " uint32_t class_code;\n" - " uint32_t nvectors;\n" - " uint32_t dfselect;\n" - "@@ -156,23 +164,34 @@ struct VirtIOPCIProxy {\n" - " \n" - " static inline bool virtio_pci_modern(VirtIOPCIProxy *proxy)\n" - " {\n" - "- return !proxy->disable_modern;\n" - "+ return proxy->mode != VIRTIO_PCI_MODE_LEGACY;\n" - " }\n" - " \n" - " static inline bool virtio_pci_legacy(VirtIOPCIProxy *proxy)\n" - " {\n" - "- return proxy->disable_legacy == ON_OFF_AUTO_OFF;\n" - "+ return proxy->mode != VIRTIO_PCI_MODE_MODERN;\n" - " }\n" - " \n" - "-static inline void virtio_pci_force_virtio_1(VirtIOPCIProxy *proxy)\n" - "+static inline bool virtio_pci_force_virtio_1(VirtIOPCIProxy *proxy,\n" - "+ Error **errp)\n" - " {\n" - "- proxy->disable_modern = false;\n" - "- proxy->disable_legacy = ON_OFF_AUTO_ON;\n" - "+ if (proxy->disable_legacy == ON_OFF_AUTO_OFF) {\n" - "+ error_setg(errp, \"Unable to set disable-legacy=off on a virtio-1.0 \"\n" - "+ \"only device\");\n" - "+ return false;\n" - "+ }\n" - "+ if (proxy->disable_modern == true) {\n" - "+ error_setg(errp, \"Unable to set disable-modern=on on a virtio-1.0 \"\n" - "+ \"only device\");\n" - "+ return false;\n" - "+ }\n" - "+ proxy->mode = VIRTIO_PCI_MODE_MODERN;\n" - "+ return true;\n" - " }\n" - " \n" - " static inline void virtio_pci_disable_modern(VirtIOPCIProxy *proxy)\n" - " {\n" - "- proxy->disable_modern = true;\n" - "+ proxy->mode = VIRTIO_PCI_MODE_LEGACY;\n" - " }\n" - " \n" - " /*\n" "-- \n" - 2.20.1 + MST -347e3bbc6c33a5cf576385327d71cd24740758065e8c4fb3ee3cf82c69e1f46e +df935e72602bdca6b4e4aabe937f20fcf00b526e7058a6035b835a5b19d83fa3
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.