This patch adds extended APIC fields like efeat, ectrl, variable sized array extlvt to a new subsection of the vmstate of the apic_common module. Saving and loading of these fields makes migration of the apic state deterministic when extapic is enabled.
Signed-off-by: Manali Shukla <[email protected]> --- hw/intc/apic_common.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/hw/intc/apic_common.c b/hw/intc/apic_common.c index 37a7a7019d..cd4b480c8e 100644 --- a/hw/intc/apic_common.c +++ b/hw/intc/apic_common.c @@ -360,6 +360,12 @@ static bool apic_common_sipi_needed(void *opaque) return s->wait_for_sipi != 0; } +static bool apic_extended_needed(void *opaque) +{ + APICCommonState *s = opaque; + return s->nr_extlvt > 0; +} + static const VMStateDescription vmstate_apic_common_sipi = { .name = "apic_sipi", .version_id = 1, @@ -372,6 +378,20 @@ static const VMStateDescription vmstate_apic_common_sipi = { } }; +static const VMStateDescription vmstate_apic_extended = { + .name = "apic_extended", + .version_id = 1, + .minimum_version_id = 1, + .needed = apic_extended_needed, + .fields = (const VMStateField[]) { + VMSTATE_UINT32(efeat, APICCommonState), + VMSTATE_UINT32(ectrl, APICCommonState), + VMSTATE_VARRAY_UINT32(extlvt, APICCommonState, nr_extlvt, 0, + vmstate_info_uint32, uint32_t), + VMSTATE_END_OF_LIST() + } +}; + static const VMStateDescription vmstate_apic_common = { .name = "apic", .version_id = 3, @@ -404,6 +424,7 @@ static const VMStateDescription vmstate_apic_common = { }, .subsections = (const VMStateDescription * const []) { &vmstate_apic_common_sipi, + &vmstate_apic_extended, NULL } }; -- 2.43.0
