@@ -248,6 +248,8 @@ struct MachineClass {
const char *alias;
const char *desc;
const char *deprecation_reason;
+ unsigned int major;
+ unsigned int minor;
void (*init)(MachineState *state);
void (*reset)(MachineState *state, ShutdownCause reason);
@@ -306,6 +308,18 @@ struct MachineClass {
ram_addr_t (*fixup_ram_size)(ram_addr_t size);
};
+static inline bool machine_check_version(int major, int minor)
+{
+ MachineClass *mc = MACHINE_GET_CLASS(qdev_get_machine());
+
+ /* unversioned is latest */
+ if (mc->major == 0 && mc->minor == 0) {
+ return true;
+ }
+
+ return mc->major > major || (mc->major == major && mc->minor >= minor);
+}
+
/**
* DeviceMemoryState:
* @base: address in guest physical address space where the memory