History

vfio/pci: Use the struct file as the handle not the vfio_group

VFIO PCI does a security check as part of hot reset to prove that the user has permission to manipulate all the devices that will be impacted by the reset. Use a new API vfio_file_has_dev() to perform this security check against the struct file directly and remove the vfio_group from VFIO PCI. Since VFIO PCI was the last user of vfio_group_get_external_user() and vfio_group_put_external_user() remove it as well.

Jason Gunthorpe committed 4 years ago

Commit 6a985ae1 parent 3e5449d3 files · +40 −75Browse files

Showing the changes to include (1 of 3 files). Show all

Unified · Split

include/linux/vfio.h+1−2
@@ -138,11 +138,10 @@ int vfio_mig_get_next_state(struct vfio_device *device, · 137 unmodified lines
138/*138/*
139 * External user API139 * External user API
140 */140 */
141extern struct vfio_group *vfio_group_get_external_user(struct file *filep);
142extern void vfio_group_put_external_user(struct vfio_group *group);
143extern struct iommu_group *vfio_file_iommu_group(struct file *file);141extern struct iommu_group *vfio_file_iommu_group(struct file *file);
144extern bool vfio_file_enforced_coherent(struct file *file);142extern bool vfio_file_enforced_coherent(struct file *file);
145extern void vfio_file_set_kvm(struct file *file, struct kvm *kvm);143extern void vfio_file_set_kvm(struct file *file, struct kvm *kvm);
144extern bool vfio_file_has_dev(struct file *file, struct vfio_device *device);
146 145
147#define VFIO_PIN_PAGES_MAX_ENTRIES (PAGE_SIZE/sizeof(unsigned long))146#define VFIO_PIN_PAGES_MAX_ENTRIES (PAGE_SIZE/sizeof(unsigned long))
148 147

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t