#include "net/net.h"
#include "hw/pci/pci.h"
#include "hw/pci/pcie.h"
+#include "hw/i386/x86.h"
#include "util/block-helpers.h"
static bool check_prop_still_unset(Object *obj, const char *name,
/* --- lost tick policy --- */
+static void qdev_propinfo_set_losttickpolicy(Object *obj, Visitor *v,
+ const char *name, void *opaque,
+ Error **errp)
+{
+ Property *prop = opaque;
+ int *ptr = object_field_prop_ptr(obj, prop);
+ int value;
+
+ if (!visit_type_enum(v, name, &value, prop->info->enum_table, errp)) {
+ return;
+ }
+
+ if (value == LOST_TICK_POLICY_SLEW) {
+ MachineState *ms = MACHINE(qdev_get_machine());
+
+ if (!object_dynamic_cast(OBJECT(ms), TYPE_X86_MACHINE)) {
+ error_setg(errp,
+ "the 'slew' policy is only available for x86 machines");
+ return;
+ }
+ }
+
+ *ptr = value;
+}
+
QEMU_BUILD_BUG_ON(sizeof(LostTickPolicy) != sizeof(int));
const PropertyInfo qdev_prop_losttickpolicy = {
.name = "LostTickPolicy",
.enum_table = &LostTickPolicy_lookup,
.get = qdev_propinfo_get_enum,
- .set = qdev_propinfo_set_enum,
+ .set = qdev_propinfo_set_losttickpolicy,
.set_default_value = qdev_propinfo_set_default_value_enum,
};