mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-11 20:48:49 +08:00
VFIO fixes for v5.8-rc3
- Fix double free of eventfd ctx (Alex Williamson) - Fix duplicate use of capability ID (Alex Williamson) - Fix SR-IOV VF memory enable handling (Alex Williamson) -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (GNU/Linux) iQIcBAABAgAGBQJe91WIAAoJECObm247sIsiYxUP+wSMBfCKLaI/DWnfylBFGWXP 2RKFhPYHBr7PYu3PS35UUK5mddpCAxjXjjrmSFy7VLbwGv1pBQylCqVdYO+z/P83 x4ciasUxIN96Y14IBctZ18XCcv5KKsEjoyQYxtpdnShmMMBrLfmM6kqQmsEmYlod VkLYYJx2GcX+hz7ThZxh0FcemBv8I6kdkxAX5/xM7X07vu3xpA/Z5qbjREfNaNWS PSmBuneEB+4JVeJoyOffIwCC7wtPL2gNCdS3AeIWLHrLTUb3JK+cPxYaqzj3nfHg FipOcoN5q0R4Wc1sZRmvkn9cBE2qLDPwwdtNL8NApZpsOeA05/QwyEe/X/0wNqaF rqhjnQYTQ6I6yqmg7APiO7vTz7YAsplJtWoxSmsT2oLPn93ObCeDunDn/pBYuRWF tdc5G74ewOA/ee1jJqsMx9xK8U0I+pQQ9ig/opROEutV1qmG57/13tusAaSvNGy4 OjFYx4LcR0zGjSF7YKFXs5EVPLt4EYLb4xnNKqunedlNvtjItuEhonSs8rpMKvK/ MC/Aa3xA3RtbDOhnAH20PRYuGFzExUWosUVXdDfdViVZ+S6L2ZGfVocJUm6fF/WY zxDLQC9OaenXhHNop2egRqbZTTvvzI3O78sFGhDhBLdJa/gQbDh9Asy9n/0+BpX2 TyW8LMfNzi70bX1LG64p =kuUL -----END PGP SIGNATURE----- Merge tag 'vfio-v5.8-rc3' of git://github.com/awilliam/linux-vfio Pull VFIO fixes from Alex Williamson: - Fix double free of eventfd ctx (Alex Williamson) - Fix duplicate use of capability ID (Alex Williamson) - Fix SR-IOV VF memory enable handling (Alex Williamson) * tag 'vfio-v5.8-rc3' of git://github.com/awilliam/linux-vfio: vfio/pci: Fix SR-IOV VF handling with MMIO blocking vfio/type1: Fix migration info capability ID vfio/pci: Clear error and request eventfd ctx after releasing
This commit is contained in:
commit
c322f5399f
@ -521,10 +521,14 @@ static void vfio_pci_release(void *device_data)
|
||||
vfio_pci_vf_token_user_add(vdev, -1);
|
||||
vfio_spapr_pci_eeh_release(vdev->pdev);
|
||||
vfio_pci_disable(vdev);
|
||||
if (vdev->err_trigger)
|
||||
if (vdev->err_trigger) {
|
||||
eventfd_ctx_put(vdev->err_trigger);
|
||||
if (vdev->req_trigger)
|
||||
vdev->err_trigger = NULL;
|
||||
}
|
||||
if (vdev->req_trigger) {
|
||||
eventfd_ctx_put(vdev->req_trigger);
|
||||
vdev->req_trigger = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
mutex_unlock(&vdev->reflck->lock);
|
||||
|
@ -398,9 +398,15 @@ static inline void p_setd(struct perm_bits *p, int off, u32 virt, u32 write)
|
||||
/* Caller should hold memory_lock semaphore */
|
||||
bool __vfio_pci_memory_enabled(struct vfio_pci_device *vdev)
|
||||
{
|
||||
struct pci_dev *pdev = vdev->pdev;
|
||||
u16 cmd = le16_to_cpu(*(__le16 *)&vdev->vconfig[PCI_COMMAND]);
|
||||
|
||||
return cmd & PCI_COMMAND_MEMORY;
|
||||
/*
|
||||
* SR-IOV VF memory enable is handled by the MSE bit in the
|
||||
* PF SR-IOV capability, there's therefore no need to trigger
|
||||
* faults based on the virtual value.
|
||||
*/
|
||||
return pdev->is_virtfn || (cmd & PCI_COMMAND_MEMORY);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1728,6 +1734,15 @@ int vfio_config_init(struct vfio_pci_device *vdev)
|
||||
vconfig[PCI_INTERRUPT_PIN]);
|
||||
|
||||
vconfig[PCI_INTERRUPT_PIN] = 0; /* Gratuitous for good VFs */
|
||||
|
||||
/*
|
||||
* VFs do no implement the memory enable bit of the COMMAND
|
||||
* register therefore we'll not have it set in our initial
|
||||
* copy of config space after pci_enable_device(). For
|
||||
* consistency with PFs, set the virtual enable bit here.
|
||||
*/
|
||||
*(__le16 *)&vconfig[PCI_COMMAND] |=
|
||||
cpu_to_le16(PCI_COMMAND_MEMORY);
|
||||
}
|
||||
|
||||
if (!IS_ENABLED(CONFIG_VFIO_PCI_INTX) || vdev->nointx)
|
||||
|
@ -1030,7 +1030,7 @@ struct vfio_iommu_type1_info_cap_iova_range {
|
||||
* size in bytes that can be used by user applications when getting the dirty
|
||||
* bitmap.
|
||||
*/
|
||||
#define VFIO_IOMMU_TYPE1_INFO_CAP_MIGRATION 1
|
||||
#define VFIO_IOMMU_TYPE1_INFO_CAP_MIGRATION 2
|
||||
|
||||
struct vfio_iommu_type1_info_cap_migration {
|
||||
struct vfio_info_cap_header header;
|
||||
|
Loading…
Reference in New Issue
Block a user