mirror of
https://github.com/torvalds/linux.git
synced 2024-11-11 14:42:24 +00:00
vfio fixes for v3.7-rc1
This includes a fix for PCI BAR mmaps after recent mm changes, fixing an interrupt race, and fixing a consistency bug in interrupt state when switching interrupt modes.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
iQIcBAABAgAGBQJQdZR1AAoJECObm247sIsiiL8QAJMFIHtNUhx70cj1aSEmg3f/
KGplW9t373Mp3NK8wIH/7tLNhkUIMAgXg2CaTNsYJeFqTAgOWjx1FzXTqCcGF++s
3Urbz/+jb6CXVhxe8YV37VbIKBTCglzx2FS2+raQOOjnMj2zQfO4agMokQPR/fMz
YBUJSYSPzYH8oKCboOEv4Jvk6htBxPwkND1j5ajys+ZxoniZp1mjd3gDwt6UtbmK
S4dp/boWEvLoHgn5aIgCky/zjIWl5ch/Eip3So5td7T0UzUfJTZPUknzs9LI58RZ
ACg2vpjwXniT/L+m2PDLmF8eDFfsZVef1zNN34VNDnY+QLpjr6YjcRT7AuHNT00m
EvWa9C/S29E0OJs/tNsDjHEs5uuZlqh8HHoGNsTIQn7FB+b6KVRB4MM4JRod+Xgb
FCYfSEsuXsBzBIfOK9uCrw1Xl+tSeigaEgMNy0FfKnBveL/ApOs29JskCpHLu62i
SYwKN5kFHnTibN/iTFivg0GPspg3T0I145EYqoXkrn4D5LGtDQqd5i3nwN2iMhzf
OUY0+dt0W2Qe1oaRzYiYP3mW7CKKqflMFuZeapf+eFl2jq+MU/z3hPWuXepkG4Vk
M6Qp20lxVkJFuWgf7rVoOyH6oV0WMrm9jshX6HvF5VMgEMRL4Huw5Jcr+cgxQIzk
Ntzvw4qQ8j0R0uugo5BH
=bBhC
-----END PGP SIGNATURE-----
Merge tag 'vfio-for-v3.7-rc1' of git://github.com/awilliam/linux-vfio
Pull vfio fixes from Alex Williamson:
"This includes a fix for PCI BAR mmaps after recent mm changes, fixing
an interrupt race, and fixing a consistency bug in interrupt state
when switching interrupt modes."
* tag 'vfio-for-v3.7-rc1' of git://github.com/awilliam/linux-vfio:
vfio: Fix PCI INTx disable consistency
vfio: Move PCI INTx eventfd setting earlier
vfio: Fix PCI mmap after b3b9c293
This commit is contained in:
commit
3dddebe059
@ -408,7 +408,7 @@ static int vfio_pci_mmap(void *device_data, struct vm_area_struct *vma)
|
||||
struct vfio_pci_device *vdev = device_data;
|
||||
struct pci_dev *pdev = vdev->pdev;
|
||||
unsigned int index;
|
||||
u64 phys_len, req_len, pgoff, req_start, phys;
|
||||
u64 phys_len, req_len, pgoff, req_start;
|
||||
int ret;
|
||||
|
||||
index = vma->vm_pgoff >> (VFIO_PCI_OFFSET_SHIFT - PAGE_SHIFT);
|
||||
@ -463,10 +463,9 @@ static int vfio_pci_mmap(void *device_data, struct vm_area_struct *vma)
|
||||
vma->vm_private_data = vdev;
|
||||
vma->vm_flags |= VM_IO | VM_DONTEXPAND | VM_DONTDUMP;
|
||||
vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
|
||||
vma->vm_pgoff = (pci_resource_start(pdev, index) >> PAGE_SHIFT) + pgoff;
|
||||
|
||||
phys = (pci_resource_start(pdev, index) >> PAGE_SHIFT) + pgoff;
|
||||
|
||||
return remap_pfn_range(vma, vma->vm_start, phys,
|
||||
return remap_pfn_range(vma, vma->vm_start, vma->vm_pgoff,
|
||||
req_len, vma->vm_page_prot);
|
||||
}
|
||||
|
||||
|
@ -366,6 +366,17 @@ static int vfio_intx_enable(struct vfio_pci_device *vdev)
|
||||
return -ENOMEM;
|
||||
|
||||
vdev->num_ctx = 1;
|
||||
|
||||
/*
|
||||
* If the virtual interrupt is masked, restore it. Devices
|
||||
* supporting DisINTx can be masked at the hardware level
|
||||
* here, non-PCI-2.3 devices will have to wait until the
|
||||
* interrupt is enabled.
|
||||
*/
|
||||
vdev->ctx[0].masked = vdev->virq_disabled;
|
||||
if (vdev->pci_2_3)
|
||||
pci_intx(vdev->pdev, !vdev->ctx[0].masked);
|
||||
|
||||
vdev->irq_type = VFIO_PCI_INTX_IRQ_INDEX;
|
||||
|
||||
return 0;
|
||||
@ -400,25 +411,26 @@ static int vfio_intx_set_signal(struct vfio_pci_device *vdev, int fd)
|
||||
return PTR_ERR(trigger);
|
||||
}
|
||||
|
||||
vdev->ctx[0].trigger = trigger;
|
||||
|
||||
if (!vdev->pci_2_3)
|
||||
irqflags = 0;
|
||||
|
||||
ret = request_irq(pdev->irq, vfio_intx_handler,
|
||||
irqflags, vdev->ctx[0].name, vdev);
|
||||
if (ret) {
|
||||
vdev->ctx[0].trigger = NULL;
|
||||
kfree(vdev->ctx[0].name);
|
||||
eventfd_ctx_put(trigger);
|
||||
return ret;
|
||||
}
|
||||
|
||||
vdev->ctx[0].trigger = trigger;
|
||||
|
||||
/*
|
||||
* INTx disable will stick across the new irq setup,
|
||||
* disable_irq won't.
|
||||
*/
|
||||
spin_lock_irqsave(&vdev->irqlock, flags);
|
||||
if (!vdev->pci_2_3 && (vdev->ctx[0].masked || vdev->virq_disabled))
|
||||
if (!vdev->pci_2_3 && vdev->ctx[0].masked)
|
||||
disable_irq_nosync(pdev->irq);
|
||||
spin_unlock_irqrestore(&vdev->irqlock, flags);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user