target/i386: Set maximum APIC ID to KVM prior to vCPU creation
commit19e2a9fb9da067acba95b3be83588bda5a3f6a99
authorZeng Guang <guang.zeng@intel.com>
Thu, 25 Aug 2022 02:52:46 +0000 (25 10:52 +0800)
committerPaolo Bonzini <pbonzini@redhat.com>
Mon, 31 Oct 2022 08:46:34 +0000 (31 09:46 +0100)
tree862b883ecf442cf17668308eb740aeb523383855
parentc891c24b1a4f5496cdb5f6afff9dae146334c7d3
target/i386: Set maximum APIC ID to KVM prior to vCPU creation

Specify maximum possible APIC ID assigned for current VM session to KVM
prior to the creation of vCPUs. By this setting, KVM can set up VM-scoped
data structure indexed by the APIC ID, e.g. Posted-Interrupt Descriptor
pointer table to support Intel IPI virtualization, with the most optimal
memory footprint.

It can be achieved by calling KVM_ENABLE_CAP for KVM_CAP_MAX_VCPU_ID
capability once KVM has enabled it. Ignoring the return error if KVM
doesn't support this capability yet.

Signed-off-by: Zeng Guang <guang.zeng@intel.com>
Acked-by: Peter Xu <peterx@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Message-Id: <20220825025246.26618-1-guang.zeng@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
hw/i386/x86.c
target/i386/kvm/kvm-stub.c
target/i386/kvm/kvm.c
target/i386/kvm/kvm_i386.h