* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, see <http://www.gnu.org/licenses/>
*/
+
#include "qemu/osdep.h"
#include "qemu/error-report.h"
+#include "qemu/module.h"
#include "qapi/error.h"
-#include "qemu-common.h"
#include "cpu.h"
#include "qapi/visitor.h"
#include "hw/i386/apic.h"
#include "trace.h"
#include "sysemu/hax.h"
#include "sysemu/kvm.h"
-#include "hw/qdev.h"
+#include "hw/qdev-properties.h"
#include "hw/sysbus.h"
+#include "migration/qemu-file-types.h"
+#include "migration/vmstate.h"
static int apic_irq_delivered;
bool apic_report_tpr_access;
return 0;
}
-static void apic_dispatch_pre_save(void *opaque)
+static int apic_dispatch_pre_save(void *opaque)
{
APICCommonState *s = APIC_COMMON(opaque);
APICCommonClass *info = APIC_COMMON_GET_CLASS(s);
if (info->pre_save) {
info->pre_save(s);
}
+
+ return 0;
}
static int apic_dispatch_post_load(void *opaque, int version_id)
return s->wait_for_sipi != 0;
}
-static bool apic_irq_delivered_needed(void *opaque)
-{
- APICCommonState *s = APIC_COMMON(opaque);
- return s->cpu == X86_CPU(first_cpu) && apic_irq_delivered != 0;
-}
-
-static void apic_irq_delivered_pre_save(void *opaque)
-{
- APICCommonState *s = APIC_COMMON(opaque);
- s->apic_irq_delivered = apic_irq_delivered;
-}
-
-static int apic_irq_delivered_post_load(void *opaque, int version_id)
-{
- APICCommonState *s = APIC_COMMON(opaque);
- apic_irq_delivered = s->apic_irq_delivered;
- return 0;
-}
-
static const VMStateDescription vmstate_apic_common_sipi = {
.name = "apic_sipi",
.version_id = 1,
}
};
-static const VMStateDescription vmstate_apic_irq_delivered = {
- .name = "apic_irq_delivered",
- .version_id = 1,
- .minimum_version_id = 1,
- .needed = apic_irq_delivered_needed,
- .pre_save = apic_irq_delivered_pre_save,
- .post_load = apic_irq_delivered_post_load,
- .fields = (VMStateField[]) {
- VMSTATE_INT32(apic_irq_delivered, APICCommonState),
- VMSTATE_END_OF_LIST()
- }
-};
-
static const VMStateDescription vmstate_apic_common = {
.name = "apic",
.version_id = 3,
},
.subsections = (const VMStateDescription*[]) {
&vmstate_apic_common_sipi,
- &vmstate_apic_irq_delivered,
NULL
}
};
void *opaque, Error **errp)
{
APICCommonState *s = APIC_COMMON(obj);
- int64_t value;
+ uint32_t value;
value = s->apicbase & MSR_IA32_APICBASE_EXTD ? s->initial_apic_id : s->id;
- visit_type_int(v, name, &value, errp);
+ visit_type_uint32(v, name, &value, errp);
}
static void apic_common_set_id(Object *obj, Visitor *v, const char *name,
APICCommonState *s = APIC_COMMON(obj);
DeviceState *dev = DEVICE(obj);
Error *local_err = NULL;
- int64_t value;
+ uint32_t value;
if (dev->realized) {
qdev_prop_set_after_realize(dev, name, errp);
return;
}
- visit_type_int(v, name, &value, &local_err);
+ visit_type_uint32(v, name, &value, &local_err);
if (local_err) {
error_propagate(errp, local_err);
return;
APICCommonState *s = APIC_COMMON(obj);
s->id = s->initial_apic_id = -1;
- object_property_add(obj, "id", "int",
+ object_property_add(obj, "id", "uint32",
apic_common_get_id,
apic_common_set_id, NULL, NULL, NULL);
}
* Reason: APIC and CPU need to be wired up by
* x86_cpu_apic_create()
*/
- dc->cannot_instantiate_with_device_add_yet = true;
+ dc->user_creatable = false;
}
static const TypeInfo apic_common_type = {