aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/hw/boards.h5
-rw-r--r--include/qemu/osdep.h4
-rw-r--r--util/osdep.c9
3 files changed, 17 insertions, 1 deletions
diff --git a/include/hw/boards.h b/include/hw/boards.h
index 24eb6f0..5da4fb00e 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 861d84b..84e84ac 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);
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)
{