KVM: x86: Check irqchip mode before create PIT
authorTengfei Yu <moehanabichan@gmail.com>
Thu, 25 Jan 2024 05:08:23 +0000 (13:08 +0800)
committerPaolo Bonzini <pbonzini@redhat.com>
Wed, 31 Jan 2024 21:21:00 +0000 (16:21 -0500)
commit9e05d9b06757732477cca428e87f3d72163d01cf
treee5a607a5fc113f05df044f52deb4d3bc2b130f33
parent11f563320917d4c9cee5d572a344c1360487530d
KVM: x86: Check irqchip mode before create PIT

As the kvm api(https://docs.kernel.org/virt/kvm/api.html) reads,
KVM_CREATE_PIT2 call is only valid after enabling in-kernel irqchip
support via KVM_CREATE_IRQCHIP.

Without this check, I can create PIT first and enable irqchip-split
then, which may cause the PIT invalid because of lacking of in-kernel
PIC to inject the interrupt.

Signed-off-by: Tengfei Yu <moehanabichan@gmail.com>
Message-Id: <20240125050823.4893-1-moehanabichan@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/x86.c