include: Move hardware version declarations to new qemu/hw-version.h

The "hardware version" machinery (qemu_set_hw_version(),
qemu_hw_version(), and the QEMU_HW_VERSION define) is used by fewer
than 10 files.  Move it out from osdep.h into a new
qemu/hw-version.h.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20220208200856.3558249-6-peter.maydell@linaro.org
This commit is contained in:
Peter Maydell 2022-02-08 20:08:56 +00:00
parent ad768e6f2a
commit 15e09912b7
11 changed files with 36 additions and 16 deletions

View File

@ -24,6 +24,7 @@
#include "chardev/char.h" #include "chardev/char.h"
#include "qemu/cutils.h" #include "qemu/cutils.h"
#include "qemu/bswap.h" #include "qemu/bswap.h"
#include "qemu/hw-version.h"
#include "sysemu/reset.h" #include "sysemu/reset.h"
#include "sysemu/runstate.h" #include "sysemu/runstate.h"
#include "sysemu/sysemu.h" #include "sysemu/sysemu.h"

View File

@ -29,6 +29,7 @@
#include "qemu/error-report.h" #include "qemu/error-report.h"
#include "qemu/main-loop.h" #include "qemu/main-loop.h"
#include "qemu/timer.h" #include "qemu/timer.h"
#include "qemu/hw-version.h"
#include "sysemu/sysemu.h" #include "sysemu/sysemu.h"
#include "sysemu/blockdev.h" #include "sysemu/blockdev.h"
#include "sysemu/dma.h" #include "sysemu/dma.h"

View File

@ -28,6 +28,7 @@
#include "hw/pci/msix.h" #include "hw/pci/msix.h"
#include "qemu/iov.h" #include "qemu/iov.h"
#include "qemu/module.h" #include "qemu/module.h"
#include "qemu/hw-version.h"
#include "hw/scsi/scsi.h" #include "hw/scsi/scsi.h"
#include "scsi/constants.h" #include "scsi/constants.h"
#include "trace.h" #include "trace.h"

View File

@ -3,6 +3,7 @@
#include "qemu/error-report.h" #include "qemu/error-report.h"
#include "qemu/module.h" #include "qemu/module.h"
#include "qemu/option.h" #include "qemu/option.h"
#include "qemu/hw-version.h"
#include "hw/qdev-properties.h" #include "hw/qdev-properties.h"
#include "hw/scsi/scsi.h" #include "hw/scsi/scsi.h"
#include "migration/qemu-file-types.h" #include "migration/qemu-file-types.h"

View File

@ -25,6 +25,7 @@
#include "qemu/error-report.h" #include "qemu/error-report.h"
#include "qemu/main-loop.h" #include "qemu/main-loop.h"
#include "qemu/module.h" #include "qemu/module.h"
#include "qemu/hw-version.h"
#include "hw/scsi/scsi.h" #include "hw/scsi/scsi.h"
#include "migration/qemu-file-types.h" #include "migration/qemu-file-types.h"
#include "migration/vmstate.h" #include "migration/vmstate.h"

27
include/qemu/hw-version.h Normal file
View File

@ -0,0 +1,27 @@
/*
* QEMU "hardware version" machinery
*
* This work is licensed under the terms of the GNU GPL, version 2 or later.
* See the COPYING file in the top-level directory.
*/
#ifndef QEMU_HW_VERSION_H
#define QEMU_HW_VERSION_H
/*
* 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.
*/
#define QEMU_HW_VERSION "2.5+"
/* QEMU "hardware version" setting. Used to replace code that exposed
* QEMU_VERSION to guests in the past and need to keep compatibility.
* Do not use qemu_hw_version() in new code.
*/
void qemu_set_hw_version(const char *);
const char *qemu_hw_version(void);
#endif

View File

@ -534,22 +534,6 @@ static inline void qemu_timersub(const struct timeval *val1,
void qemu_set_cloexec(int fd); void qemu_set_cloexec(int fd);
/* 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.
*/
#define QEMU_HW_VERSION "2.5+"
/* QEMU "hardware version" setting. Used to replace code that exposed
* QEMU_VERSION to guests in the past and need to keep compatibility.
* Do not use qemu_hw_version() in new code.
*/
void qemu_set_hw_version(const char *);
const char *qemu_hw_version(void);
void fips_set_state(bool requested); void fips_set_state(bool requested);
bool fips_get_state(void); bool fips_get_state(void);

View File

@ -36,6 +36,7 @@
#include "qemu-version.h" #include "qemu-version.h"
#include "qemu/cutils.h" #include "qemu/cutils.h"
#include "qemu/help_option.h" #include "qemu/help_option.h"
#include "qemu/hw-version.h"
#include "qemu/uuid.h" #include "qemu/uuid.h"
#include "sysemu/reset.h" #include "sysemu/reset.h"
#include "sysemu/runstate.h" #include "sysemu/runstate.h"

View File

@ -21,6 +21,7 @@
#include "qemu/units.h" #include "qemu/units.h"
#include "qemu/cutils.h" #include "qemu/cutils.h"
#include "qemu/qemu-print.h" #include "qemu/qemu-print.h"
#include "qemu/hw-version.h"
#include "cpu.h" #include "cpu.h"
#include "tcg/helper-tcg.h" #include "tcg/helper-tcg.h"
#include "sysemu/reset.h" #include "sysemu/reset.h"

View File

@ -19,6 +19,7 @@
#include "qapi/error.h" #include "qapi/error.h"
#include "qapi/visitor.h" #include "qapi/visitor.h"
#include "qemu/module.h" #include "qemu/module.h"
#include "qemu/hw-version.h"
#include "qemu/qemu-print.h" #include "qemu/qemu-print.h"
#ifndef CONFIG_USER_ONLY #ifndef CONFIG_USER_ONLY
#include "sysemu/sysemu.h" #include "sysemu/sysemu.h"

View File

@ -40,6 +40,7 @@ extern int madvise(char *, size_t, int);
#include "qemu/error-report.h" #include "qemu/error-report.h"
#include "qemu/madvise.h" #include "qemu/madvise.h"
#include "qemu/mprotect.h" #include "qemu/mprotect.h"
#include "qemu/hw-version.h"
#include "monitor/monitor.h" #include "monitor/monitor.h"
static bool fips_enabled = false; static bool fips_enabled = false;