aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorEduardo Habkost <ehabkost@redhat.com>2015-11-12 15:29:54 -0200
committerMichael S. Tsirkin <mst@redhat.com>2015-11-25 13:42:37 +0200
commitfac862ffa605f6fa41f52033b27346d26a96bea5 (patch)
tree3621d13c24bc340449eb2ab7f071961afbb766b3 /include
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 <mst@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'include')
-rw-r--r--include/hw/boards.h5
-rw-r--r--include/qemu/osdep.h4
2 files changed, 9 insertions, 0 deletions
diff --git a/include/hw/boards.h b/include/hw/boards.h
index 24eb6f0e77..5da4fb00ee 100644
--- a/include/hw/boards.h
+++ b/include/hw/boards.h
@@ -51,6 +51,11 @@ bool machine_mem_merge(MachineState *machine);
* used to provide @cpu_index to socket number mapping, allowing
* a machine to group CPU threads belonging to the same socket/package
* Returns: socket number given cpu_index belongs to.
+ * @hw_version:
+ * Value of QEMU_VERSION when the machine was added to QEMU.
+ * Set only by old machines because they need to keep
+ * compatibility on code that exposed QEMU_VERSION to guests in
+ * the past (and now use qemu_hw_version()).
*/
struct MachineClass {
/*< private >*/
diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h
index 861d84b4e4..84e84ac700 100644
--- a/include/qemu/osdep.h
+++ b/include/qemu/osdep.h
@@ -256,6 +256,10 @@ static inline void qemu_timersub(const struct timeval *val1,
void qemu_set_cloexec(int fd);
+/* QEMU "hardware version" setting. Used to replace code that exposed
+ * QEMU_VERSION to guests in the past and need to keep compatibilty.
+ * Do not use qemu_hw_version() in new code.
+ */
void qemu_set_hw_version(const char *);
const char *qemu_hw_version(void);