VFIO fixes for v4.7-rc2

- Fix irqfd shutdown ordering, build warning, and VPD short read
   (Alex Williamson)
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.14 (GNU/Linux)
 
 iQIcBAABAgAGBQJXUZujAAoJECObm247sIsiKB4QAJDFQ2xl4mMgkQZOGkFsp1QL
 /n7YuxMXdXa3wAyw81W6Fl2xM8K/xzkS+va//98sKAXRKSZKAwux4pDxRXmtsmiA
 N4xqqDSedrTJoJZZZlQsJjy2SQt/SHaWH8YkfdYIo3AoQc1DbgM1tNOyLbFcaN8g
 A5Jl8e/Th7xae7pp8sB58LnBOD73pEtRdRMkz4ikOGYB/GZij2JTzuPeCNcrEegm
 Juq4G7oQW9lJ+txEjPvY2uSmiq23gP+fP2FQ9Q3L1kUO+Rw86VxbKzCO6N/lNp4P
 Si3XHqSCPX5ga6fSLTtagQfPEivhsVD4uQezc5XuP2m3KePq4wGyTuKUGAQAqpPd
 0n8fwwvxQWU1hZxjvDls54iT66WCK7+15VcYK7MgmlfVt4sS6dbgiGImgx1tFvgT
 liGnO4exEbhD0slSoN4GpSZnKD7bczXFaAi3uuCXJZJn25mrFDH/x2b3PDjteG48
 lGNpRqaX2uNOMh/3AGCj0JqbYkBgMcBix1ku2y7bi1C79b7lrzALeMILjlSD+xNM
 7rTFMVMBM5PS04R5xGgxsZRqp92adDIYyVnlcTfjh+15dxlkX6Yh88IY8xTBtZsA
 ZRn0221Rvm9xfs4l8iJ0J1O1wFIpzQlaswjLGyiu/Zp8APy7v5/9P3DoHzQ1Nn88
 V13bUVt5UwycbGfE9Uk5
 =+hSM
 -----END PGP SIGNATURE-----

Merge tag 'vfio-v4.7-rc2' of git://github.com/awilliam/linux-vfio

Pull VFIO fixes from Alex Williamson:
 "Fix irqfd shutdown ordering, build warning, and VPD short read"

* tag 'vfio-v4.7-rc2' of git://github.com/awilliam/linux-vfio:
  vfio/pci: Allow VPD short read
  vfio/type1: Fix build warning
  vfio/pci: Fix ordering of eventfd vs virqfd shutdown
This commit is contained in:
Linus Torvalds 2016-06-04 12:25:36 -07:00
commit f2c6b9e4b2
3 changed files with 6 additions and 5 deletions

View File

@ -749,7 +749,8 @@ static int vfio_vpd_config_write(struct vfio_pci_device *vdev, int pos,
if (pci_write_vpd(pdev, addr & ~PCI_VPD_ADDR_F, 4, &data) != 4) if (pci_write_vpd(pdev, addr & ~PCI_VPD_ADDR_F, 4, &data) != 4)
return count; return count;
} else { } else {
if (pci_read_vpd(pdev, addr, 4, &data) != 4) data = 0;
if (pci_read_vpd(pdev, addr, 4, &data) < 0)
return count; return count;
*pdata = cpu_to_le32(data); *pdata = cpu_to_le32(data);
} }

View File

@ -228,9 +228,9 @@ static int vfio_intx_set_signal(struct vfio_pci_device *vdev, int fd)
static void vfio_intx_disable(struct vfio_pci_device *vdev) static void vfio_intx_disable(struct vfio_pci_device *vdev)
{ {
vfio_intx_set_signal(vdev, -1);
vfio_virqfd_disable(&vdev->ctx[0].unmask); vfio_virqfd_disable(&vdev->ctx[0].unmask);
vfio_virqfd_disable(&vdev->ctx[0].mask); vfio_virqfd_disable(&vdev->ctx[0].mask);
vfio_intx_set_signal(vdev, -1);
vdev->irq_type = VFIO_PCI_NUM_IRQS; vdev->irq_type = VFIO_PCI_NUM_IRQS;
vdev->num_ctx = 0; vdev->num_ctx = 0;
kfree(vdev->ctx); kfree(vdev->ctx);
@ -401,13 +401,13 @@ static void vfio_msi_disable(struct vfio_pci_device *vdev, bool msix)
struct pci_dev *pdev = vdev->pdev; struct pci_dev *pdev = vdev->pdev;
int i; int i;
vfio_msi_set_block(vdev, 0, vdev->num_ctx, NULL, msix);
for (i = 0; i < vdev->num_ctx; i++) { for (i = 0; i < vdev->num_ctx; i++) {
vfio_virqfd_disable(&vdev->ctx[i].unmask); vfio_virqfd_disable(&vdev->ctx[i].unmask);
vfio_virqfd_disable(&vdev->ctx[i].mask); vfio_virqfd_disable(&vdev->ctx[i].mask);
} }
vfio_msi_set_block(vdev, 0, vdev->num_ctx, NULL, msix);
if (msix) { if (msix) {
pci_disable_msix(vdev->pdev); pci_disable_msix(vdev->pdev);
kfree(vdev->msix); kfree(vdev->msix);

View File

@ -515,7 +515,7 @@ static int map_try_harder(struct vfio_domain *domain, dma_addr_t iova,
unsigned long pfn, long npage, int prot) unsigned long pfn, long npage, int prot)
{ {
long i; long i;
int ret; int ret = 0;
for (i = 0; i < npage; i++, pfn++, iova += PAGE_SIZE) { for (i = 0; i < npage; i++, pfn++, iova += PAGE_SIZE) {
ret = iommu_map(domain->domain, iova, ret = iommu_map(domain->domain, iova,