This patch postpones vapic_paddr initialization, which is perfromed by the migration functions. When vapic_paddr is synchronized within the migration process, apic_common functions could operate with incorrect apic state, if it hadn't loaded yet. This patch postpones the synchronization until whole virtual machine state is loaded.
Signed-off-by: Pavel Dovgalyuk <pavel.dovga...@ispras.ru> --- hw/intc/apic_common.c | 10 +++++++++- 1 files changed, 9 insertions(+), 1 deletions(-) diff --git a/hw/intc/apic_common.c b/hw/intc/apic_common.c index 2d2dfcb..c3590a6 100644 --- a/hw/intc/apic_common.c +++ b/hw/intc/apic_common.c @@ -91,13 +91,21 @@ void apic_enable_tpr_access_reporting(DeviceState *dev, bool enable) } } +static void do_apic_enable_vapic(void *data) +{ + APICCommonState *s = APIC_COMMON(data); + APICCommonClass *info = APIC_COMMON_GET_CLASS(s); + + info->vapic_base_update(s); +} + void apic_enable_vapic(DeviceState *dev, hwaddr paddr) { APICCommonState *s = APIC_COMMON(dev); APICCommonClass *info = APIC_COMMON_GET_CLASS(s); s->vapic_paddr = paddr; - info->vapic_base_update(s); + run_on_cpu(CPU(s->cpu), do_apic_enable_vapic, s); } void apic_handle_tpr_access_report(DeviceState *dev, target_ulong ip,