diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2014-01-24 20:42:31 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-01-24 20:42:31 -0500 |
commit | 2d08cd0ef89a24f5eb6c6801c48cd06bca230d6d (patch) | |
tree | d9bbec83fa54dd5338144089b6dcb570a40237e7 /drivers/vfio/pci | |
parent | 5c85121bf618aece49155f6eea0d0b2c14c1a121 (diff) | |
parent | 3be3a074cf5ba641529d8fdae0e05ca642f23e12 (diff) |
Merge tag 'vfio-v3.14-rc1' of git://github.com/awilliam/linux-vfio
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
Diffstat (limited to 'drivers/vfio/pci')
-rw-r--r-- | drivers/vfio/pci/vfio_pci.c | 4 | ||||
-rw-r--r-- | drivers/vfio/pci/vfio_pci_intrs.c | 17 |
2 files changed, 4 insertions, 17 deletions
diff --git a/drivers/vfio/pci/vfio_pci.c b/drivers/vfio/pci/vfio_pci.c index 2319d206f630..7ba042498857 100644 --- a/drivers/vfio/pci/vfio_pci.c +++ b/drivers/vfio/pci/vfio_pci.c | |||
@@ -872,9 +872,13 @@ static pci_ers_result_t vfio_pci_aer_err_detected(struct pci_dev *pdev, | |||
872 | return PCI_ERS_RESULT_DISCONNECT; | 872 | return PCI_ERS_RESULT_DISCONNECT; |
873 | } | 873 | } |
874 | 874 | ||
875 | mutex_lock(&vdev->igate); | ||
876 | |||
875 | if (vdev->err_trigger) | 877 | if (vdev->err_trigger) |
876 | eventfd_signal(vdev->err_trigger, 1); | 878 | eventfd_signal(vdev->err_trigger, 1); |
877 | 879 | ||
880 | mutex_unlock(&vdev->igate); | ||
881 | |||
878 | vfio_device_put(device); | 882 | vfio_device_put(device); |
879 | 883 | ||
880 | return PCI_ERS_RESULT_CAN_RECOVER; | 884 | return PCI_ERS_RESULT_CAN_RECOVER; |
diff --git a/drivers/vfio/pci/vfio_pci_intrs.c b/drivers/vfio/pci/vfio_pci_intrs.c index 641bc87bdb96..210357691dc0 100644 --- a/drivers/vfio/pci/vfio_pci_intrs.c +++ b/drivers/vfio/pci/vfio_pci_intrs.c | |||
@@ -749,54 +749,37 @@ static int vfio_pci_set_err_trigger(struct vfio_pci_device *vdev, | |||
749 | unsigned count, uint32_t flags, void *data) | 749 | unsigned count, uint32_t flags, void *data) |
750 | { | 750 | { |
751 | int32_t fd = *(int32_t *)data; | 751 | int32_t fd = *(int32_t *)data; |
752 | struct pci_dev *pdev = vdev->pdev; | ||
753 | 752 | ||
754 | if ((index != VFIO_PCI_ERR_IRQ_INDEX) || | 753 | if ((index != VFIO_PCI_ERR_IRQ_INDEX) || |
755 | !(flags & VFIO_IRQ_SET_DATA_TYPE_MASK)) | 754 | !(flags & VFIO_IRQ_SET_DATA_TYPE_MASK)) |
756 | return -EINVAL; | 755 | return -EINVAL; |
757 | 756 | ||
758 | /* | ||
759 | * device_lock synchronizes setting and checking of | ||
760 | * err_trigger. The vfio_pci_aer_err_detected() is also | ||
761 | * called with device_lock held. | ||
762 | */ | ||
763 | |||
764 | /* DATA_NONE/DATA_BOOL enables loopback testing */ | 757 | /* DATA_NONE/DATA_BOOL enables loopback testing */ |
765 | |||
766 | if (flags & VFIO_IRQ_SET_DATA_NONE) { | 758 | if (flags & VFIO_IRQ_SET_DATA_NONE) { |
767 | device_lock(&pdev->dev); | ||
768 | if (vdev->err_trigger) | 759 | if (vdev->err_trigger) |
769 | eventfd_signal(vdev->err_trigger, 1); | 760 | eventfd_signal(vdev->err_trigger, 1); |
770 | device_unlock(&pdev->dev); | ||
771 | return 0; | 761 | return 0; |
772 | } else if (flags & VFIO_IRQ_SET_DATA_BOOL) { | 762 | } else if (flags & VFIO_IRQ_SET_DATA_BOOL) { |
773 | uint8_t trigger = *(uint8_t *)data; | 763 | uint8_t trigger = *(uint8_t *)data; |
774 | device_lock(&pdev->dev); | ||
775 | if (trigger && vdev->err_trigger) | 764 | if (trigger && vdev->err_trigger) |
776 | eventfd_signal(vdev->err_trigger, 1); | 765 | eventfd_signal(vdev->err_trigger, 1); |
777 | device_unlock(&pdev->dev); | ||
778 | return 0; | 766 | return 0; |
779 | } | 767 | } |
780 | 768 | ||
781 | /* Handle SET_DATA_EVENTFD */ | 769 | /* Handle SET_DATA_EVENTFD */ |
782 | |||
783 | if (fd == -1) { | 770 | if (fd == -1) { |
784 | device_lock(&pdev->dev); | ||
785 | if (vdev->err_trigger) | 771 | if (vdev->err_trigger) |
786 | eventfd_ctx_put(vdev->err_trigger); | 772 | eventfd_ctx_put(vdev->err_trigger); |
787 | vdev->err_trigger = NULL; | 773 | vdev->err_trigger = NULL; |
788 | device_unlock(&pdev->dev); | ||
789 | return 0; | 774 | return 0; |
790 | } else if (fd >= 0) { | 775 | } else if (fd >= 0) { |
791 | struct eventfd_ctx *efdctx; | 776 | struct eventfd_ctx *efdctx; |
792 | efdctx = eventfd_ctx_fdget(fd); | 777 | efdctx = eventfd_ctx_fdget(fd); |
793 | if (IS_ERR(efdctx)) | 778 | if (IS_ERR(efdctx)) |
794 | return PTR_ERR(efdctx); | 779 | return PTR_ERR(efdctx); |
795 | device_lock(&pdev->dev); | ||
796 | if (vdev->err_trigger) | 780 | if (vdev->err_trigger) |
797 | eventfd_ctx_put(vdev->err_trigger); | 781 | eventfd_ctx_put(vdev->err_trigger); |
798 | vdev->err_trigger = efdctx; | 782 | vdev->err_trigger = efdctx; |
799 | device_unlock(&pdev->dev); | ||
800 | return 0; | 783 | return 0; |
801 | } else | 784 | } else |
802 | return -EINVAL; | 785 | return -EINVAL; |