[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH for-1.3] vfio-pci: Fix KVM disabled path
From: |
Peter Maydell |
Subject: |
Re: [Qemu-devel] [PATCH for-1.3] vfio-pci: Fix KVM disabled path |
Date: |
Fri, 30 Nov 2012 18:57:15 +0000 |
On 27 November 2012 19:45, Alex Williamson <address@hidden> wrote:
> kvm_check_extension() explodes when KVM isn't enabled so we need to
> first test whether KVM is enabled. Use kvm_irqchip_in_kernel() for
> this since it matches the test we do before using this result.
> --- a/hw/vfio_pci.c
> +++ b/hw/vfio_pci.c
> @@ -438,7 +438,8 @@ static int vfio_enable_intx(VFIODevice *vdev)
> * Only conditional to avoid generating error messages on platforms
> * where we won't actually use the result anyway.
> */
> - if (kvm_check_extension(kvm_state, KVM_CAP_IRQFD_RESAMPLE)) {
> + if (kvm_irqchip_in_kernel() &&
> + kvm_check_extension(kvm_state, KVM_CAP_IRQFD_RESAMPLE)) {
> vdev->intx.route = pci_device_route_intx_to_irq(&vdev->pdev,
> vdev->intx.pin);
vfio_pci is supposed to be architecture-independent code, right?
kvm.h says you mustn't use kvm_irqchip_in_kernel() in such code
(its semantics vary from arch to arch). I think kvm_enabled()
is sufficient here since what we're actually guarding is just
the kvm_check_extension call.
-- PMM