mirror of
https://github.com/torvalds/linux.git
synced 2026-05-25 15:41:52 +02:00
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>
This commit is contained in:
parent
11f5633209
commit
9e05d9b067
|
|
@ -7016,6 +7016,9 @@ int kvm_arch_vm_ioctl(struct file *filp, unsigned int ioctl, unsigned long arg)
|
|||
r = -EEXIST;
|
||||
if (kvm->arch.vpit)
|
||||
goto create_pit_unlock;
|
||||
r = -ENOENT;
|
||||
if (!pic_in_kernel(kvm))
|
||||
goto create_pit_unlock;
|
||||
r = -ENOMEM;
|
||||
kvm->arch.vpit = kvm_create_pit(kvm, u.pit_config.flags);
|
||||
if (kvm->arch.vpit)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user