]> Git Repo - linux.git/commitdiff
Merge tag 'vfio-v3.14-rc1' of git://github.com/awilliam/linux-vfio
authorLinus Torvalds <[email protected]>
Sat, 25 Jan 2014 01:42:31 +0000 (17:42 -0800)
committerLinus Torvalds <[email protected]>
Sat, 25 Jan 2014 01:42:31 +0000 (17:42 -0800)
Pull vfio update from Alex Williamson:
 - convert to misc driver to support module auto loading
 - remove unnecessary and dangerous use of device_lock

* tag 'vfio-v3.14-rc1' of git://github.com/awilliam/linux-vfio:
  vfio-pci: Don't use device_lock around AER interrupt setup
  vfio: Convert control interface to misc driver
  misc: Reserve minor for VFIO

1  2 
drivers/vfio/pci/vfio_pci.c

index 2319d206f63092f7a73d90d6fdb5b36bf4447d5c,3ffd27f424182a7f6be3245b5fbb932af25b2dd7..7ba0424988573a83109293e4c7e80c5f683deec2
@@@ -139,14 -139,25 +139,14 @@@ static void vfio_pci_disable(struct vfi
        pci_write_config_word(pdev, PCI_COMMAND, PCI_COMMAND_INTX_DISABLE);
  
        /*
 -       * Careful, device_lock may already be held.  This is the case if
 -       * a driver unbind is blocked.  Try to get the locks ourselves to
 -       * prevent a deadlock.
 +       * Try to reset the device.  The success of this is dependent on
 +       * being able to lock the device, which is not always possible.
         */
        if (vdev->reset_works) {
 -              bool reset_done = false;
 -
 -              if (pci_cfg_access_trylock(pdev)) {
 -                      if (device_trylock(&pdev->dev)) {
 -                              __pci_reset_function_locked(pdev);
 -                              reset_done = true;
 -                              device_unlock(&pdev->dev);
 -                      }
 -                      pci_cfg_access_unlock(pdev);
 -              }
 -
 -              if (!reset_done)
 -                      pr_warn("%s: Unable to acquire locks for reset of %s\n",
 -                              __func__, dev_name(&pdev->dev));
 +              int ret = pci_try_reset_function(pdev);
 +              if (ret)
 +                      pr_warn("%s: Failed to reset device %s (%d)\n",
 +                              __func__, dev_name(&pdev->dev), ret);
        }
  
        pci_restore_state(pdev);
@@@ -503,7 -514,7 +503,7 @@@ static long vfio_pci_ioctl(void *device
  
        } else if (cmd == VFIO_DEVICE_RESET) {
                return vdev->reset_works ?
 -                      pci_reset_function(vdev->pdev) : -EINVAL;
 +                      pci_try_reset_function(vdev->pdev) : -EINVAL;
  
        } else if (cmd == VFIO_DEVICE_GET_PCI_HOT_RESET_INFO) {
                struct vfio_pci_hot_reset_info hdr;
@@@ -673,8 -684,8 +673,8 @@@ reset_info_exit
                                                    &info, slot);
                if (!ret)
                        /* User has access, do the reset */
 -                      ret = slot ? pci_reset_slot(vdev->pdev->slot) :
 -                                   pci_reset_bus(vdev->pdev->bus);
 +                      ret = slot ? pci_try_reset_slot(vdev->pdev->slot) :
 +                                   pci_try_reset_bus(vdev->pdev->bus);
  
  hot_reset_release:
                for (i--; i >= 0; i--)
@@@ -872,9 -883,13 +872,13 @@@ static pci_ers_result_t vfio_pci_aer_er
                return PCI_ERS_RESULT_DISCONNECT;
        }
  
+       mutex_lock(&vdev->igate);
        if (vdev->err_trigger)
                eventfd_signal(vdev->err_trigger, 1);
  
+       mutex_unlock(&vdev->igate);
        vfio_device_put(device);
  
        return PCI_ERS_RESULT_CAN_RECOVER;
This page took 0.065016 seconds and 4 git commands to generate.