This gives notes for userspace applications on device cdev usage.
Reviewed-by: Kevin Tian
Reviewed-by: Jason Gunthorpe
Signed-off-by: Yi Liu
---
Documentation/driver-api/vfio.rst | 139 ++
1 file changed, 139 insertions(+)
diff --git a/Documentation/driver-api
Tested-by: Terrence Xu
Tested-by: Zhenzhong Duan
Signed-off-by: Yi Liu
---
drivers/iommu/iommufd/Kconfig | 4 +-
drivers/vfio/Kconfig | 15 ++
drivers/vfio/Makefile | 2 +-
drivers/vfio/vfio.h | 89 ---
include/linux/vfio.h
Chen
Tested-by: Matthew Rosato
Tested-by: Yanting Jiang
Tested-by: Shameer Kolothum
Tested-by: Terrence Xu
Tested-by: Zhenzhong Duan
Signed-off-by: Yi Liu
---
drivers/vfio/device_cdev.c | 107 +
drivers/vfio/vfio.h| 13 +
drivers/vfio
This adds a local variable to store the user pointer cast result from arg.
It avoids the repeated casts in the code when more ioctls are added.
Reviewed-by: Jason Gunthorpe
Signed-off-by: Yi Liu
---
drivers/vfio/vfio_main.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git
Tested-by: Matthew Rosato
Tested-by: Yanting Jiang
Tested-by: Shameer Kolothum
Tested-by: Terrence Xu
Tested-by: Zhenzhong Duan
Signed-off-by: Yi Liu
---
drivers/vfio/device_cdev.c | 58 ++
drivers/vfio/vfio.h| 5
drivers/vfio/vfio_main.c
for the
physical devices that do not have IOMMU if the group code is not compiled
as the cdev interface does not support such devices.
Suggested-by: Jason Gunthorpe
Reviewed-by: Jason Gunthorpe
Tested-by: Zhenzhong Duan
Signed-off-by: Yi Liu
---
drivers/vfio/group.c | 10
refcount increment while the device is going to be unregistered.
Reviewed-by: Jason Gunthorpe
Tested-by: Zhenzhong Duan
Signed-off-by: Yi Liu
---
drivers/vfio/vfio_main.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/vfio/vfio_main.c b/drivers/vfio/vfio_main.c
It's common to get a reference to the iommufd context from a given file
descriptor. So adds an API for it. Existing users of this API are compiled
only when IOMMUFD is enabled, so no need to have a stub for the IOMMUFD
disabled case.
Signed-off-by: Yi Liu
---
drivers/iommu/iommufd/main.c | 24
This prepares for adding DETACH ioctl for emulated VFIO devices.
Reviewed-by: Kevin Tian
Reviewed-by: Jason Gunthorpe
Tested-by: Terrence Xu
Tested-by: Nicolin Chen
Tested-by: Matthew Rosato
Tested-by: Yanting Jiang
Tested-by: Shameer Kolothum
Tested-by: Zhenzhong Duan
Signed-off-by: Yi
This saves some lines when adding the kvm get logic for the vfio_device
cdev path.
This also renames _vfio_device_get_kvm_safe() to be vfio_device_get_kvm_safe().
Suggested-by: Jason Gunthorpe
Reviewed-by: Jason Gunthorpe
Tested-by: Zhenzhong Duan
Signed-off-by: Yi Liu
---
drivers/vfio
colin Chen
Tested-by: Matthew Rosato
Tested-by: Yanting Jiang
Tested-by: Shameer Kolothum
Tested-by: Zhenzhong Duan
Signed-off-by: Yi Liu
---
drivers/vfio/group.c | 2 ++
drivers/vfio/vfio.h | 1 +
drivers/vfio/vfio_main.c | 7 +++
3 files changed, 10 insertions(+)
diff --git a/dr
-by: Zhenzhong Duan
Signed-off-by: Yi Liu
---
drivers/vfio/vfio_main.c | 8 ++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/vfio/vfio_main.c b/drivers/vfio/vfio_main.c
index c71c0d1a079f..6d45caa1f9a0 100644
--- a/drivers/vfio/vfio_main.c
+++ b/drivers/vfio/vfio_main.c
This prepares for adding DETACH ioctl for physical VFIO devices.
Reviewed-by: Kevin Tian
Reviewed-by: Jason Gunthorpe
Tested-by: Terrence Xu
Tested-by: Nicolin Chen
Tested-by: Matthew Rosato
Tested-by: Yanting Jiang
Tested-by: Shameer Kolothum
Tested-by: Zhenzhong Duan
Signed-off-by: Yi
Duan
Signed-off-by: Yi Liu
---
drivers/vfio/group.c | 33 +
drivers/vfio/vfio.h | 3 +++
2 files changed, 36 insertions(+)
diff --git a/drivers/vfio/group.c b/drivers/vfio/group.c
index 088dd34c8931..2751d61689c4 100644
--- a/drivers/vfio/group.c
+++ b/drivers
thorpe
Reviewed-by: Eric Auger
Tested-by: Terrence Xu
Tested-by: Nicolin Chen
Tested-by: Matthew Rosato
Tested-by: Yanting Jiang
Tested-by: Shameer Kolothum
Tested-by: Zhenzhong Duan
Signed-off-by: Yi Liu
---
drivers/vfio/group.c | 11 ++-
drivers/vfio/vfio.h | 1 +
driver
-by: Shameer Kolothum
Tested-by: Zhenzhong Duan
Signed-off-by: Yi Liu
---
Documentation/virt/kvm/devices/vfio.rst | 47 -
include/uapi/linux/kvm.h| 13 +--
virt/kvm/vfio.c | 12 +++
3 files changed, 47 insertions(+), 25 deletions
Tested-by: Matthew Rosato
Tested-by: Yanting Jiang
Tested-by: Shameer Kolothum
Tested-by: Zhenzhong Duan
Signed-off-by: Yi Liu
---
drivers/vfio/iommufd.c | 12 +++-
drivers/vfio/vfio.h | 10 +-
drivers/vfio/vfio_main.c | 6 +++---
3 files changed, 15 insertions(+), 13
um
Tested-by: Zhenzhong Duan
Signed-off-by: Yi Liu
---
drivers/vfio/Kconfig | 12
drivers/vfio/Makefile | 1 +
drivers/vfio/device_cdev.c | 63 ++
drivers/vfio/vfio.h| 54
drivers/vfio/vfio_mai
rick.
Reviewed-by: Kevin Tian
Reviewed-by: Jason Gunthorpe
Tested-by: Terrence Xu
Tested-by: Nicolin Chen
Tested-by: Matthew Rosato
Tested-by: Yanting Jiang
Tested-by: Shameer Kolothum
Tested-by: Zhenzhong Duan
Signed-off-by: Nicolin Chen
Signed-off-by: Yi Liu
---
drivers/iommu/iommu
-off-by: Yi Liu
---
drivers/vfio/group.c | 17 +
drivers/vfio/iommufd.c | 35 +--
drivers/vfio/vfio.h| 9 +
3 files changed, 39 insertions(+), 22 deletions(-)
diff --git a/drivers/vfio/group.c b/drivers/vfio/group.c
index b8b77daf7aa6
Jiang
Tested-by: Shameer Kolothum
Tested-by: Zhenzhong Duan
Signed-off-by: Yi Liu
---
drivers/vfio/group.c | 13 +
drivers/vfio/iommufd.c | 22 --
drivers/vfio/vfio.h| 9 +
3 files changed, 30 insertions(+), 14 deletions(-)
diff --git a/drivers
Jiang
Tested-by: Shameer Kolothum
Tested-by: Zhenzhong Duan
Signed-off-by: Yi Liu
---
virt/kvm/vfio.c | 115
1 file changed, 58 insertions(+), 57 deletions(-)
diff --git a/virt/kvm/vfio.c b/virt/kvm/vfio.c
index b33c7b8488b3..8f7fa07e8170 100644
Tested-by: Yanting Jiang
Tested-by: Shameer Kolothum
Tested-by: Zhenzhong Duan
Signed-off-by: Yi Liu
---
drivers/vfio/group.c | 20 ++--
drivers/vfio/vfio.h | 8
drivers/vfio/vfio_main.c | 25 +++--
3 files changed, 33 insertions(+), 20
-by: Yi Liu
---
drivers/vfio/vfio.h | 3 +++
drivers/vfio/vfio_main.c | 36 +++-
2 files changed, 38 insertions(+), 1 deletion(-)
diff --git a/drivers/vfio/vfio.h b/drivers/vfio/vfio.h
index b1e327a85a32..332528af0846 100644
--- a/drivers/vfio/vfio.h
+++ b
-by: Jason Gunthorpe
Tested-by: Terrence Xu
Tested-by: Nicolin Chen
Tested-by: Matthew Rosato
Tested-by: Yanting Jiang
Tested-by: Shameer Kolothum
Tested-by: Zhenzhong Duan
Signed-off-by: Yi Liu
---
drivers/vfio/group.c | 53 +---
drivers/vfio/vfio.h
Tian
Reviewed-by: Eric Auger
Reviewed-by: Jason Gunthorpe
Tested-by: Terrence Xu
Tested-by: Nicolin Chen
Tested-by: Matthew Rosato
Tested-by: Yanting Jiang
Tested-by: Shameer Kolothum
Tested-by: Zhenzhong Duan
Signed-off-by: Yi Liu
---
drivers/vfio/group.c | 13 +++--
drivers
ct and device file reference.
(JasonG)
- Address comments from KevinT
- Remained the ioctl for detach, needs to Alex's taste
(https://lore.kernel.org/kvm/bn9pr11mb5276be9f4b0613ee859317028c...@bn9pr11mb5276.namprd11.prod.outlook.com/)
rfc: https://lore.kernel.org/kvm/20221219084718.9342-1-y
Gunthorpe
Tested-by: Yanting Jiang
Tested-by: Zhenzhong Duan
Signed-off-by: Jason Gunthorpe
Signed-off-by: Yi Liu
---
drivers/vfio/pci/vfio_pci_core.c | 61 ++--
include/uapi/linux/vfio.h| 21 +++
2 files changed, 71 insertions(+), 11 deletions
the return of vfio_pci_try_zap_and_vma_lock_cb().
However, it makes more sense to return -ENODEV.
Suggested-by: Alex Williamson
Reviewed-by: Jason Gunthorpe
Tested-by: Yanting Jiang
Tested-by: Terrence Xu
Tested-by: Zhenzhong Duan
Signed-off-by: Yi Liu
---
drivers/vfio/pci/vfio_pci_core.c | 6 +-
dr
to userspace.
Suggested-by: Jason Gunthorpe
Tested-by: Yanting Jiang
Tested-by: Zhenzhong Duan
Signed-off-by: Jason Gunthorpe
Signed-off-by: Yi Liu
---
drivers/vfio/pci/vfio_pci_core.c | 93
1 file changed, 33 insertions(+), 60 deletions(-)
diff --git
-by: Jason Gunthorpe
Tested-by: Yanting Jiang
Tested-by: Terrence Xu
Tested-by: Zhenzhong Duan
Signed-off-by: Yi Liu
---
drivers/iommu/iommufd/device.c | 30 ++
include/linux/iommufd.h| 2 ++
2 files changed, 32 insertions(+)
diff --git a/drivers/iommu/iommufd
Jiang
Tested-by: Terrence Xu
Tested-by: Zhenzhong Duan
Signed-off-by: Yi Liu
---
include/linux/vfio.h | 5 +
1 file changed, 5 insertions(+)
diff --git a/include/linux/vfio.h b/include/linux/vfio.h
index 2c137ea94a3e..2a45853773a6 100644
--- a/include/linux/vfio.h
+++ b/include/linux
Duan
Signed-off-by: Yi Liu
---
drivers/iommu/iommufd/main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/iommu/iommufd/main.c b/drivers/iommu/iommufd/main.c
index 3fbe636c3d8a..32ce7befc8dd 100644
--- a/drivers/iommu/iommufd/main.c
+++ b/drivers/iommu/iommufd/main.c
Jiang
Tested-by: Terrence Xu
Tested-by: Zhenzhong Duan
Signed-off-by: Jason Gunthorpe
Signed-off-by: Yi Liu
---
drivers/vfio/pci/vfio_pci_core.c | 55 +++-
1 file changed, 32 insertions(+), 23 deletions(-)
diff --git a/drivers/vfio/pci/vfio_pci_core.c b/drivers/vfio
This is needed by the vfio-pci driver to report affected devices in the
hot-reset for a given device.
Reviewed-by: Jason Gunthorpe
Tested-by: Yanting Jiang
Tested-by: Terrence Xu
Tested-by: Zhenzhong Duan
Signed-off-by: Yi Liu
---
drivers/iommu/iommufd/device.c | 12
include
virtue of being directly bound to the same iommufd context as the
calling device, or implicitly owned via a shared IOMMU group.
Suggested-by: Jason Gunthorpe
Suggested-by: Alex Williamson
Reviewed-by: Jason Gunthorpe
Tested-by: Yanting Jiang
Tested-by: Zhenzhong Duan
Signed-off-by: Yi Liu
This suits more on what the code does.
Reviewed-by: Kevin Tian
Reviewed-by: Jason Gunthorpe
Reviewed-by: Eric Auger
Signed-off-by: Yi Liu
---
drivers/vfio/pci/vfio_pci_core.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/vfio/pci/vfio_pci_core.c b/drivers
tch 10 to introduce a new _INFO ioctl for the usage of device
fd passing usage in cdev path (Jason, Alex)
v1: https://lore.kernel.org/kvm/20230316124156.12064-1-yi.l@intel.com/
Regards,
Yi Liu
Yi Liu (10):
vfio/pci: Update comment around group_fd get in
vfio_pci_ioctl_pci_hot
This gives notes for userspace applications on device cdev usage.
Reviewed-by: Kevin Tian
Signed-off-by: Yi Liu
---
Documentation/driver-api/vfio.rst | 139 ++
1 file changed, 139 insertions(+)
diff --git a/Documentation/driver-api/vfio.rst
b/Documentation/driver
Tested-by: Yanting Jiang
Tested-by: Shameer Kolothum
Tested-by: Terrence Xu
Signed-off-by: Yi Liu
---
drivers/vfio/device_cdev.c | 58 ++
drivers/vfio/vfio.h| 5
drivers/vfio/vfio_main.c | 15 +-
include/uapi/linux/vfio.h | 44
for the
physical devices that do not have IOMMU if the group code is not compiled
as the cdev interface does not support such devices.
Suggested-by: Jason Gunthorpe
Signed-off-by: Yi Liu
---
drivers/vfio/group.c | 10 --
drivers/vfio/vfio_main.c | 11 +++
2 files changed, 11
It's common to get a reference to the iommufd context from a given file
descriptor. So adds an API for it. Existing users of this API are compiled
only when IOMMUFD is enabled, so no need to have a stub for the IOMMUFD
disabled case.
Signed-off-by: Yi Liu
---
drivers/iommu/iommufd/main.c | 23
This adds a local variable to store the user pointer cast result from arg.
It avoids the repeated casts in the code when more ioctls are added.
Signed-off-by: Yi Liu
---
drivers/vfio/vfio_main.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/vfio/vfio_main.c b
Tested-by: Matthew Rosato
Tested-by: Yanting Jiang
Tested-by: Shameer Kolothum
Signed-off-by: Yi Liu
---
drivers/vfio/iommufd.c | 12 +++-
drivers/vfio/vfio.h | 10 +-
drivers/vfio/vfio_main.c | 6 +++---
3 files changed, 15 insertions(+), 13 deletions(-)
diff --git
Chen
Tested-by: Matthew Rosato
Tested-by: Yanting Jiang
Tested-by: Shameer Kolothum
Tested-by: Terrence Xu
Signed-off-by: Yi Liu
---
drivers/vfio/device_cdev.c | 107 +
drivers/vfio/vfio.h| 13 +
drivers/vfio/vfio_main.c | 5 ++
include
Tested-by: Terrence Xu
Signed-off-by: Yi Liu
---
drivers/iommu/iommufd/Kconfig | 4 +-
drivers/vfio/Kconfig | 15 ++
drivers/vfio/Makefile | 2 +-
drivers/vfio/vfio.h | 89 ---
include/linux/vfio.h | 25 --
5 files
Xu
Tested-by: Nicolin Chen
Tested-by: Matthew Rosato
Tested-by: Yanting Jiang
Tested-by: Shameer Kolothum
Signed-off-by: Yi Liu
---
drivers/vfio/Kconfig | 12
drivers/vfio/Makefile | 1 +
drivers/vfio/device_cdev.c | 63 ++
drivers/v
This aligns the bind/attach logic with the coming vfio device cdev support.
Reviewed-by: Kevin Tian
Reviewed-by: Jason Gunthorpe
Tested-by: Terrence Xu
Tested-by: Nicolin Chen
Tested-by: Matthew Rosato
Tested-by: Yanting Jiang
Tested-by: Shameer Kolothum
Signed-off-by: Yi Liu
---
drivers
rick.
Reviewed-by: Kevin Tian
Tested-by: Terrence Xu
Tested-by: Nicolin Chen
Tested-by: Matthew Rosato
Tested-by: Yanting Jiang
Tested-by: Shameer Kolothum
Signed-off-by: Nicolin Chen
Signed-off-by: Yi Liu
---
drivers/iommu/iommufd/device.c | 74 +++
This saves some lines when adding the kvm get logic for the vfio_device
cdev path.
This also renames _vfio_device_get_kvm_safe() to be vfio_device_get_kvm_safe().
Suggested-by: Jason Gunthorpe
Signed-off-by: Yi Liu
---
drivers/vfio/group.c | 7 +--
drivers/vfio/vfio.h | 6
Jiang
Tested-by: Shameer Kolothum
Signed-off-by: Yi Liu
---
drivers/vfio/group.c | 13 +
drivers/vfio/iommufd.c | 22 --
drivers/vfio/vfio.h| 9 +
3 files changed, 30 insertions(+), 14 deletions(-)
diff --git a/drivers/vfio/group.c b/drivers/vfio
-by: Yi Liu
---
drivers/vfio/vfio_main.c | 8 ++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/vfio/vfio_main.c b/drivers/vfio/vfio_main.c
index c71c0d1a079f..6d45caa1f9a0 100644
--- a/drivers/vfio/vfio_main.c
+++ b/drivers/vfio/vfio_main.c
@@ -332,6 +332,12 @@ void
refcount increment while the device is going to be unregistered.
Signed-off-by: Yi Liu
---
drivers/vfio/vfio_main.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/vfio/vfio_main.c b/drivers/vfio/vfio_main.c
index 6d45caa1f9a0..294bb5ecfc1c 100644
--- a/drivers
This prepares for adding DETACH ioctl for physical VFIO devices.
Reviewed-by: Kevin Tian
Reviewed-by: Jason Gunthorpe
Tested-by: Terrence Xu
Tested-by: Nicolin Chen
Tested-by: Matthew Rosato
Tested-by: Yanting Jiang
Tested-by: Shameer Kolothum
Signed-off-by: Yi Liu
---
Documentation
This prepares for adding DETACH ioctl for emulated VFIO devices.
Reviewed-by: Kevin Tian
Reviewed-by: Jason Gunthorpe
Tested-by: Terrence Xu
Tested-by: Nicolin Chen
Tested-by: Matthew Rosato
Tested-by: Yanting Jiang
Tested-by: Shameer Kolothum
Signed-off-by: Yi Liu
---
drivers/gpu/drm
-by: Shameer Kolothum
Signed-off-by: Yi Liu
---
Documentation/virt/kvm/devices/vfio.rst | 47 -
include/uapi/linux/kvm.h| 13 +--
virt/kvm/vfio.c | 12 +++
3 files changed, 47 insertions(+), 25 deletions(-)
diff --git
devices within the same group may be opened via different paths.
Reviewed-by: Kevin Tian
Reviewed-by: Jason Gunthorpe
Reviewed-by: Eric Auger
Tested-by: Terrence Xu
Tested-by: Nicolin Chen
Tested-by: Matthew Rosato
Tested-by: Yanting Jiang
Tested-by: Shameer Kolothum
Signed-off-by: Yi Liu
colin Chen
Tested-by: Matthew Rosato
Tested-by: Yanting Jiang
Tested-by: Shameer Kolothum
Signed-off-by: Yi Liu
---
drivers/vfio/group.c | 2 ++
drivers/vfio/vfio.h | 1 +
drivers/vfio/vfio_main.c | 7 +++
3 files changed, 10 insertions(+)
diff --git a/drivers/vfio/group.c b/dr
Jiang
Tested-by: Shameer Kolothum
Signed-off-by: Yi Liu
---
virt/kvm/vfio.c | 115
1 file changed, 58 insertions(+), 57 deletions(-)
diff --git a/virt/kvm/vfio.c b/virt/kvm/vfio.c
index b33c7b8488b3..8f7fa07e8170 100644
--- a/virt/kvm/vfio.c
+++ b
thorpe
Reviewed-by: Eric Auger
Tested-by: Terrence Xu
Tested-by: Nicolin Chen
Tested-by: Matthew Rosato
Tested-by: Yanting Jiang
Tested-by: Shameer Kolothum
Signed-off-by: Yi Liu
---
drivers/vfio/group.c | 11 ++-
drivers/vfio/vfio.h | 1 +
drivers/vfio/vfio_main.
Tested-by: Yanting Jiang
Tested-by: Shameer Kolothum
Signed-off-by: Yi Liu
---
drivers/vfio/group.c | 20 ++--
drivers/vfio/vfio.h | 8
drivers/vfio/vfio_main.c | 25 +++--
3 files changed, 33 insertions(+), 20 deletions(-)
diff --git
will be set to vfio_device
after device file is bound to iommufd in the cdev path.
Reviewed-by: Kevin Tian
Reviewed-by: Jason Gunthorpe
Tested-by: Terrence Xu
Tested-by: Nicolin Chen
Tested-by: Matthew Rosato
Tested-by: Yanting Jiang
Tested-by: Shameer Kolothum
Signed-off-by: Yi Liu
---
drivers
-by: Jason Gunthorpe
Tested-by: Terrence Xu
Tested-by: Nicolin Chen
Tested-by: Matthew Rosato
Tested-by: Yanting Jiang
Tested-by: Shameer Kolothum
Signed-off-by: Yi Liu
---
drivers/vfio/group.c | 53 +---
drivers/vfio/vfio.h | 3 +++
drivers/vfio
Tian
Reviewed-by: Eric Auger
Reviewed-by: Jason Gunthorpe
Tested-by: Terrence Xu
Tested-by: Nicolin Chen
Tested-by: Matthew Rosato
Tested-by: Yanting Jiang
Tested-by: Shameer Kolothum
Signed-off-by: Yi Liu
---
drivers/vfio/group.c | 13 +++--
drivers/vfio/vfio.h | 6
6.namprd11.prod.outlook.com/)
rfc: https://lore.kernel.org/kvm/20221219084718.9342-1-yi.l@intel.com/
Thanks,
Yi Liu
Nicolin Chen (1):
iommufd/device: Add iommufd_access_detach() API
Yi Liu (25):
vfio: Allocate per device file structure
vfio: Refine vfio file kAPIs for KVM
vfio
-by: Terrence Xu
Reviewed-by: Jason Gunthorpe
Signed-off-by: Yi Liu
---
drivers/iommu/iommufd/device.c | 30 ++
include/linux/iommufd.h| 2 ++
2 files changed, 32 insertions(+)
diff --git a/drivers/iommu/iommufd/device.c b/drivers/iommu/iommufd/device.c
index
virtue of being directly bound to the same iommufd context as the
calling device, or implicitly owned via a shared IOMMU group.
Suggested-by: Jason Gunthorpe
Suggested-by: Alex Williamson
Reviewed-by: Jason Gunthorpe
Signed-off-by: Yi Liu
---
drivers/vfio/iommufd.c | 44
This can be used to differentiate whether to report group_id or devid in
the revised VFIO_DEVICE_GET_PCI_HOT_RESET_INFO ioctl. At this moment, no
cdev path yet, so the vfio_device_cdev_opened() helper always returns false.
Reviewed-by: Kevin Tian
Tested-by: Terrence Xu
Signed-off-by: Yi Liu
the return of vfio_pci_try_zap_and_vma_lock_cb().
However, it makes more sense to return -ENODEV.
Suggested-by: Alex Williamson
Tested-by: Terrence Xu
Reviewed-by: Jason Gunthorpe
Signed-off-by: Yi Liu
---
drivers/vfio/pci/vfio_pci_core.c | 6 +-
drivers/vfio/vfio_main.c | 15 ++
This is needed by the vfio-pci driver to report affected devices in the
hot-reset for a given device.
Tested-by: Terrence Xu
Reviewed-by: Jason Gunthorpe
Signed-off-by: Yi Liu
---
drivers/iommu/iommufd/device.c | 12
include/linux/iommufd.h| 3 +++
2 files changed, 15
This suits more on what the code does.
Reviewed-by: Kevin Tian
Reviewed-by: Jason Gunthorpe
Reviewed-by: Eric Auger
Signed-off-by: Yi Liu
---
drivers/vfio/pci/vfio_pci_core.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/vfio/pci/vfio_pci_core.c b/drivers
Gunthorpe
Reviewed-by: Jason Gunthorpe
Tested-by: Yanting Jiang
Signed-off-by: Yi Liu
---
drivers/vfio/pci/vfio_pci_core.c | 61 ++--
include/uapi/linux/vfio.h| 21 +++
2 files changed, 71 insertions(+), 11 deletions(-)
diff --git a/drivers/vfio/pci
With this reservation, IOMMUFD users can encode the negative IDs for
specific purposes. e.g. VFIO needs two reserved values to tell userspace
the ID returned is not valid but has other meaning.
Tested-by: Terrence Xu
Reviewed-by: Jason Gunthorpe
Signed-off-by: Yi Liu
---
drivers/iommu/iommufd
x)
v1: https://lore.kernel.org/kvm/20230316124156.12064-1-yi.l@intel.com/
Regards,
Yi Liu
Yi Liu (10):
vfio/pci: Update comment around group_fd get in
vfio_pci_ioctl_pci_hot_reset()
vfio/pci: Move the existing hot reset logic to be a helper
iommufd: Reserve all negati
to userspace.
Suggested-by: Jason Gunthorpe
Signed-off-by: Jason Gunthorpe
Signed-off-by: Yi Liu
---
drivers/vfio/pci/vfio_pci_core.c | 93
1 file changed, 33 insertions(+), 60 deletions(-)
diff --git a/drivers/vfio/pci/vfio_pci_core.c b/drivers/vfio/pci
-by: Kevin Tian
Tested-by: Yanting Jiang
Tested-by: Terrence Xu
Signed-off-by: Yi Liu
---
drivers/vfio/pci/vfio_pci_core.c | 55 +++-
1 file changed, 32 insertions(+), 23 deletions(-)
diff --git a/drivers/vfio/pci/vfio_pci_core.c b/drivers/vfio/pci/vfio_pci_core.c
index
This gives notes for userspace applications on device cdev usage.
Reviewed-by: Kevin Tian
Signed-off-by: Yi Liu
---
Documentation/driver-api/vfio.rst | 139 ++
1 file changed, 139 insertions(+)
diff --git a/Documentation/driver-api/vfio.rst
b/Documentation/driver
noiommu devices, hence
noiommu devices do not support [AT|DE]TACH.
Tested-by: Nicolin Chen
Tested-by: Matthew Rosato
Tested-by: Yanting Jiang
Tested-by: Shameer Kolothum
Tested-by: Terrence Xu
Signed-off-by: Yi Liu
---
drivers/vfio/device_cdev.c | 66 ++
drivers
-off-by: Yi Liu
---
drivers/iommu/iommufd/Kconfig | 4 +-
drivers/vfio/Kconfig | 15 ++
drivers/vfio/Makefile | 2 +-
drivers/vfio/vfio.h | 89 ---
include/linux/vfio.h | 25 --
5 files changed, 123 insertions(+), 12
for the
physical devices that do not have IOMMU if the group code is not compiled
as the cdev interface does not support such devices.
Suggested-by: Jason Gunthorpe
Signed-off-by: Yi Liu
---
drivers/vfio/group.c | 10 --
drivers/vfio/vfio_main.c | 11 +++
2 files changed, 11
on cdev fds. cdev does not support noiommu devices, hence
noiommu devices do not support BIND.
Tested-by: Nicolin Chen
Tested-by: Matthew Rosato
Tested-by: Yanting Jiang
Tested-by: Shameer Kolothum
Tested-by: Terrence Xu
Signed-off-by: Yi Liu
---
drivers/vfio/device_cdev.c | 123
en
Tested-by: Matthew Rosato
Tested-by: Yanting Jiang
Tested-by: Shameer Kolothum
Signed-off-by: Yi Liu
---
drivers/vfio/Kconfig | 12
drivers/vfio/Makefile | 1 +
drivers/vfio/device_cdev.c | 62 ++
drivers/vfio/vfio.h
This avoids endless vfio_device refcount increasement by userspace,
which would keep blocking the vfio_unregister_group_dev().
Tested-by: Nicolin Chen
Tested-by: Matthew Rosato
Tested-by: Yanting Jiang
Tested-by: Shameer Kolothum
Tested-by: Terrence Xu
Signed-off-by: Yi Liu
---
drivers
This prepares for adding DETACH ioctl for emulated VFIO devices.
Reviewed-by: Kevin Tian
Tested-by: Terrence Xu
Tested-by: Nicolin Chen
Tested-by: Matthew Rosato
Tested-by: Yanting Jiang
Tested-by: Shameer Kolothum
Signed-off-by: Yi Liu
---
drivers/gpu/drm/i915/gvt/kvmgt.c | 1
rick.
Reviewed-by: Kevin Tian
Tested-by: Terrence Xu
Tested-by: Nicolin Chen
Tested-by: Matthew Rosato
Tested-by: Yanting Jiang
Tested-by: Shameer Kolothum
Signed-off-by: Nicolin Chen
Signed-off-by: Yi Liu
---
drivers/iommu/iommufd/device.c | 76 +++
This prepares for adding DETACH ioctl for physical VFIO devices.
Reviewed-by: Kevin Tian
Tested-by: Terrence Xu
Tested-by: Nicolin Chen
Tested-by: Matthew Rosato
Tested-by: Yanting Jiang
Tested-by: Shameer Kolothum
Signed-off-by: Yi Liu
---
Documentation/driver-api/vfio.rst
-by: Yanting Jiang
Tested-by: Shameer Kolothum
Signed-off-by: Yi Liu
---
drivers/vfio/iommufd.c | 12 +++-
drivers/vfio/vfio.h | 10 +-
drivers/vfio/vfio_main.c | 6 +++---
3 files changed, 15 insertions(+), 13 deletions(-)
diff --git a/drivers/vfio/iommufd.c b/drivers
This aligns the bind/attach logic with the coming vfio device cdev support.
Reviewed-by: Kevin Tian
Tested-by: Terrence Xu
Tested-by: Nicolin Chen
Tested-by: Matthew Rosato
Tested-by: Yanting Jiang
Tested-by: Shameer Kolothum
Signed-off-by: Yi Liu
---
drivers/vfio/group.c | 17
Kolothum
Signed-off-by: Yi Liu
---
drivers/vfio/group.c | 13 +
drivers/vfio/iommufd.c | 22 --
drivers/vfio/vfio.h| 9 +
3 files changed, 30 insertions(+), 14 deletions(-)
diff --git a/drivers/vfio/group.c b/drivers/vfio/group.c
index 4e6277191eb4
colin Chen
Tested-by: Matthew Rosato
Tested-by: Yanting Jiang
Tested-by: Shameer Kolothum
Signed-off-by: Yi Liu
---
drivers/vfio/group.c | 2 ++
drivers/vfio/vfio.h | 1 +
drivers/vfio/vfio_main.c | 7 +++
3 files changed, 10 insertions(+)
diff --git a/drivers/vfio/group.c b/dr
devices within the same group may be opened via different paths.
Reviewed-by: Kevin Tian
Reviewed-by: Jason Gunthorpe
Reviewed-by: Eric Auger
Tested-by: Terrence Xu
Tested-by: Nicolin Chen
Tested-by: Matthew Rosato
Tested-by: Yanting Jiang
Tested-by: Shameer Kolothum
Signed-off-by: Yi Liu
Tested-by: Yanting Jiang
Tested-by: Shameer Kolothum
Signed-off-by: Yi Liu
---
drivers/vfio/group.c | 20 ++--
drivers/vfio/vfio.h | 8
drivers/vfio/vfio_main.c | 25 +++--
3 files changed, 33 insertions(+), 20 deletions(-)
diff --git
thorpe
Reviewed-by: Eric Auger
Tested-by: Terrence Xu
Tested-by: Nicolin Chen
Tested-by: Matthew Rosato
Tested-by: Yanting Jiang
Tested-by: Shameer Kolothum
Signed-off-by: Yi Liu
---
drivers/vfio/group.c | 11 ++-
drivers/vfio/vfio.h | 1 +
drivers/vfio/vfio_main.
will be set to vfio_device
after device file is bound to iommufd in the cdev path.
Reviewed-by: Kevin Tian
Reviewed-by: Jason Gunthorpe
Tested-by: Terrence Xu
Tested-by: Nicolin Chen
Tested-by: Matthew Rosato
Tested-by: Yanting Jiang
Tested-by: Shameer Kolothum
Signed-off-by: Yi Liu
---
drivers
Jiang
Tested-by: Shameer Kolothum
Signed-off-by: Yi Liu
---
virt/kvm/vfio.c | 115
1 file changed, 58 insertions(+), 57 deletions(-)
diff --git a/virt/kvm/vfio.c b/virt/kvm/vfio.c
index b33c7b8488b3..8f7fa07e8170 100644
--- a/virt/kvm/vfio.c
+++ b
-by: Shameer Kolothum
Signed-off-by: Yi Liu
---
Documentation/virt/kvm/devices/vfio.rst | 47 -
include/uapi/linux/kvm.h| 13 +--
virt/kvm/vfio.c | 12 +++
3 files changed, 47 insertions(+), 25 deletions(-)
diff --git
-by: Jason Gunthorpe
Tested-by: Terrence Xu
Tested-by: Nicolin Chen
Tested-by: Matthew Rosato
Tested-by: Yanting Jiang
Tested-by: Shameer Kolothum
Signed-off-by: Yi Liu
---
drivers/vfio/group.c | 53 +---
drivers/vfio/vfio.h | 3 +++
drivers/vfio
Tian
Reviewed-by: Eric Auger
Reviewed-by: Jason Gunthorpe
Tested-by: Terrence Xu
Tested-by: Nicolin Chen
Tested-by: Matthew Rosato
Tested-by: Yanting Jiang
Tested-by: Shameer Kolothum
Signed-off-by: Yi Liu
---
drivers/vfio/group.c | 13 +++--
drivers/vfio/vfio.h | 6
mprd11.prod.outlook.com/)
rfc: https://lore.kernel.org/kvm/20221219084718.9342-1-yi.l@intel.com/
Thanks,
Yi Liu
Nicolin Chen (1):
iommufd/device: Add iommufd_access_detach() API
Yi Liu (21):
vfio: Allocate per device file structure
vfio: Refine vfio file kAPIs for KVM
vfio
With this reservation, IOMMUFD users can encode the negative IDs for
specific purposes. e.g. VFIO needs two reserved values to tell userspace
the ID returned is not valid but has other meaning.
Tested-by: Terrence Xu
Reviewed-by: Jason Gunthorpe
Signed-off-by: Yi Liu
---
drivers/iommu/iommufd
1 - 100 of 471 matches
Mail list logo