« Previous | Next » 

Revision d3c64d6a

IDd3c64d6a1874f94246af91963927fb4d924332f1

Added by Igor Mammedov about 11 years ago

target-i386: Split APIC creation from initialization in x86_cpu_realizefn()

When APIC is hotplugged during CPU hotplug, device_set_realized()
calls device_reset() on it. And if QEMU runs in KVM mode, following
call chain will fail:
apic_reset_common()
-> kvm_apic_vapic_base_update()
-> kvm_vcpu_ioctl(cpu->kvm_fd,...)
due to cpu->kvm_fd not being initialized yet.

cpu->kvm_fd is initialized during qemu_init_vcpu() but x86_cpu_apic_init()
can't be moved after it because kvm_init_vcpu() -> kvm_arch_reset_vcpu()
relies on APIC to determine if CPU is BSP for setting initial env->mp_state.

So split APIC device creation from its initialization and realize APIC
after CPU is created, when it's safe to call APIC's reset method.

Signed-off-by: Igor Mammedov <>
Reviewed-by: liguang <>
Reviewed-by: Eduardo Habkost <>
Signed-off-by: Andreas Färber <>

Files

  • added
  • modified
  • copied
  • renamed
  • deleted

View differences