summaryrefslogtreecommitdiffstats
path: root/drivers/vfio
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2019-07-17 11:23:13 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2019-07-17 11:23:13 -0700
commit37d4607ebbbf5d8b74cbcb9434a5ce6897a51864 (patch)
treed53055fb96f50898228631b5a784269b76e38dee /drivers/vfio
parent916f562fb28a49457d3d99d156ca415b50d6750e (diff)
parent1e4d09d2212d9e230b967f57bc8df463527dbd75 (diff)
downloadlinux-37d4607ebbbf5d8b74cbcb9434a5ce6897a51864.tar.bz2
Merge tag 'vfio-v5.3-rc1' of git://github.com/awilliam/linux-vfio
Pull VFIO updates from Alex Williamson: - Static symbol cleanup in mdev samples (Kefeng Wang) - Use vma help in nvlink code (Peng Hao) - Remove unused code in mbochs sample (YueHaibing) - Send uevents around mdev registration (Alex Williamson) * tag 'vfio-v5.3-rc1' of git://github.com/awilliam/linux-vfio: mdev: Send uevents around parent device registration sample/mdev/mbochs: remove set but not used variable 'mdev_state' vfio: vfio_pci_nvlink2: use a vma helper function vfio-mdev/samples: make some symbols static
Diffstat (limited to 'drivers/vfio')
-rw-r--r--drivers/vfio/mdev/mdev_core.c9
-rw-r--r--drivers/vfio/pci/vfio_pci_nvlink2.c3
2 files changed, 10 insertions, 2 deletions
diff --git a/drivers/vfio/mdev/mdev_core.c b/drivers/vfio/mdev/mdev_core.c
index ed8608763134..b558d4cfd082 100644
--- a/drivers/vfio/mdev/mdev_core.c
+++ b/drivers/vfio/mdev/mdev_core.c
@@ -143,6 +143,8 @@ int mdev_register_device(struct device *dev, const struct mdev_parent_ops *ops)
{
int ret;
struct mdev_parent *parent;
+ char *env_string = "MDEV_STATE=registered";
+ char *envp[] = { env_string, NULL };
/* check for mandatory ops */
if (!ops || !ops->create || !ops->remove || !ops->supported_type_groups)
@@ -194,6 +196,8 @@ int mdev_register_device(struct device *dev, const struct mdev_parent_ops *ops)
mutex_unlock(&parent_list_lock);
dev_info(dev, "MDEV: Registered\n");
+ kobject_uevent_env(&dev->kobj, KOBJ_CHANGE, envp);
+
return 0;
add_dev_err:
@@ -217,6 +221,8 @@ EXPORT_SYMBOL(mdev_register_device);
void mdev_unregister_device(struct device *dev)
{
struct mdev_parent *parent;
+ char *env_string = "MDEV_STATE=unregistered";
+ char *envp[] = { env_string, NULL };
mutex_lock(&parent_list_lock);
parent = __find_parent_device(dev);
@@ -240,6 +246,9 @@ void mdev_unregister_device(struct device *dev)
up_write(&parent->unreg_sem);
mdev_put_parent(parent);
+
+ /* We still have the caller's reference to use for the uevent */
+ kobject_uevent_env(&dev->kobj, KOBJ_CHANGE, envp);
}
EXPORT_SYMBOL(mdev_unregister_device);
diff --git a/drivers/vfio/pci/vfio_pci_nvlink2.c b/drivers/vfio/pci/vfio_pci_nvlink2.c
index 50fe3c4f7feb..f2983f0f84be 100644
--- a/drivers/vfio/pci/vfio_pci_nvlink2.c
+++ b/drivers/vfio/pci/vfio_pci_nvlink2.c
@@ -161,8 +161,7 @@ static int vfio_pci_nvgpu_mmap(struct vfio_pci_device *vdev,
atomic_inc(&data->mm->mm_count);
ret = (int) mm_iommu_newdev(data->mm, data->useraddr,
- (vma->vm_end - vma->vm_start) >> PAGE_SHIFT,
- data->gpu_hpa, &data->mem);
+ vma_pages(vma), data->gpu_hpa, &data->mem);
trace_vfio_pci_nvgpu_mmap(vdev->pdev, data->gpu_hpa, data->useraddr,
vma->vm_end - vma->vm_start, ret);