apic: Drop APICCommonState.idx and use APIC ID as index in local_apics[]
authorIgor Mammedov <imammedo@redhat.com>
Fri, 24 Jun 2016 14:27:00 +0000 (16:27 +0200)
committerEduardo Habkost <ehabkost@redhat.com>
Wed, 20 Jul 2016 15:02:19 +0000 (12:02 -0300)
commit1dfe3282cf851dce186ab15b07225e5d8588b63f
tree1a96b53914b8f18c52d716866697d852481da4e5
parent889211b18b8d0acc814fbbe01b986f07b229a8c9
apic: Drop APICCommonState.idx and use APIC ID as index in local_apics[]

local_apics[] is sized to contain all APIC ID supported in xAPIC mode,
so use APIC ID as index in it instead of constantly increasing counter idx.

Fixes error "apic initialization failed" when a CPU hotplugged and
unplugged more times than there are free slots in local_apics[].

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Radim Krčmář <rkrcmar@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
hw/intc/apic.c
include/hw/i386/apic_internal.h