[PATCH v3 3/3] Make KVM_CAP_IRQFD dependent on KVM_CAP_IRQCHIP

Pavel Fedin
2015-08-05T10:53:59Z

Now at least ARM is able to determine whether the machine has
virtualization support for irqchip or not at runtime. Obviously,
irqfd requires irqchip.

Signed-off-by: Pavel Fedin <p.fedin@samsung.com>
---
This has to be verified with PowerPC and S390 maintainers. I've got an
impression that KVM_CAP_IRQCHIP is forgotten on these architectures
(their KConfig selects HAVE_KVM_IRQCHIP but KVM_CAP_IRQCHIP is not
mentioned anywhere in the respective code).
---
virt/kvm/kvm_main.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index 9097741..7b49618 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -2478,12 +2478,13 @@ static long kvm_vm_ioctl_check_extension_generic(struct kvm *kvm, long arg)
#ifdef CONFIG_HAVE_KVM_MSI
case KVM_CAP_SIGNAL_MSI:
#endif
+ case KVM_CAP_CHECK_EXTENSION_VM:
+ return 1;
#ifdef CONFIG_HAVE_KVM_IRQFD
case KVM_CAP_IRQFD:
case KVM_CAP_IRQFD_RESAMPLE:
+ return kvm_vm_ioctl_check_extension(kvm, KVM_CAP_IRQCHIP);
#endif
- case KVM_CAP_CHECK_EXTENSION_VM:
- return 1;
#ifdef CONFIG_HAVE_KVM_IRQ_ROUTING
case KVM_CAP_IRQ_ROUTING:
return KVM_MAX_IRQ_ROUTES;
--
2.4.4