path: root/util
diff options
authorEduardo Habkost <>2015-11-12 15:29:54 -0200
committerMichael S. Tsirkin <>2015-11-25 13:42:37 +0200
commitfac862ffa605f6fa41f52033b27346d26a96bea5 (patch)
tree3621d13c24bc340449eb2ab7f071961afbb766b3 /util
parent541abd10a01da56c5f16582cd32d67114ec22a5c (diff)
osdep: Change default value of qemu_hw_version() to "2.5+"
There are two issues with qemu_hw_version() today: 1) If a machine has hw_version set, the value returned by it is not very useful, because it is not the actual QEMU version. 2) If a machine does't set hw_version, the return value of qemu_hw_version() is broken, because it will change when upgrading QEMU. For those reasons, using qemu_hw_version() is strongly discouraged, and should be used only in code that used QEMU_VERSION in the past and needs to keep compatibility. To fix (2), instead of making every machine broken by default unless they set hw_version, make qemu_hw_version() simply return "2.5+" if qemu_set_hw_version() is not called. Suggested-by: Michael S. Tsirkin <> Signed-off-by: Eduardo Habkost <> Reviewed-by: Michael S. Tsirkin <> Signed-off-by: Michael S. Tsirkin <>
Diffstat (limited to 'util')
1 files changed, 8 insertions, 1 deletions
diff --git a/util/osdep.c b/util/osdep.c
index 80c6bfe..534b511 100644
--- a/util/osdep.c
+++ b/util/osdep.c
@@ -52,7 +52,14 @@ extern int madvise(caddr_t, size_t, int);
static bool fips_enabled = false;
-static const char *hw_version = QEMU_VERSION;
+/* Starting on QEMU 2.5, qemu_hw_version() returns "2.5+" by default
+ * instead of QEMU_VERSION, so setting hw_version on MachineClass
+ * is no longer mandatory.
+ *
+ * Do NOT change this string, or it will break compatibility on all
+ * machine classes that don't set hw_version.
+ */
+static const char *hw_version = "2.5+";
int socket_set_cork(int fd, int v)
OpenPOWER on IntegriCloud