Re: [PATCH 05/13] vfio/fsl: Move to the device set infrastructure

2021-07-20 Thread Jason Gunthorpe
On Tue, Jul 20, 2021 at 07:12:26PM +0300, Diana Craciun OSS wrote: > On 7/15/2021 3:20 AM, Jason Gunthorpe wrote: > > FSL uses the internal reflck to implement the open_device() functionality, > > conversion to the core code is straightforward. > > > > The decision on

Re: [PATCH 05/13] vfio/fsl: Move to the device set infrastructure

2021-07-20 Thread Jason Gunthorpe
On Tue, Jul 20, 2021 at 07:23:35PM +0300, Diana Craciun OSS wrote: > I have tested the changes and everything works as expected. Great, thanks, I added a Tested-by for you Jason

[PATCH v2 01/14] vfio/samples: Remove module get/put

2021-07-20 Thread Jason Gunthorpe
ot;) Fixes: 681c1615f891 ("vfio/mbochs: Convert to use vfio_register_group_dev()") Reviewed-by: Cornelia Huck Signed-off-by: Jason Gunthorpe --- samples/vfio-mdev/mbochs.c | 4 samples/vfio-mdev/mdpy.c | 4 2 files changed, 8 deletions(-) diff --git a/samples/vfio-mdev/mbochs.c

[PATCH v2 02/14] vfio/mbochs: Fix missing error unwind in mbochs_probe()

2021-07-20 Thread Jason Gunthorpe
Compared to mbochs_remove() two cases are missing from the vfio_register_group_dev() unwind. Add them in. Fixes: 681c1615f891 ("vfio/mbochs: Convert to use vfio_register_group_dev()") Reported-by: Cornelia Huck Signed-off-by: Jason Gunthorpe --- samples/vfio-mdev/mbochs.c | 7 +

[PATCH v2 04/14] vfio: Provide better generic support for open/release vfio_device_ops

2021-07-20 Thread Jason Gunthorpe
o group vfio_devices into sets. This implementation uses xarray instead of searching through the driver core structures, which simplifies the somewhat tricky locking in this area. Following patches convert all the drivers. Signed-off-by: Yishai Hadas Signed-off-by: Jason Gunthorpe --- drive

[PATCH v2 14/14] vfio: Remove struct vfio_device_ops open/release

2021-07-20 Thread Jason Gunthorpe
Nothing uses this anymore, delete it. Signed-off-by: Yishai Hadas Signed-off-by: Jason Gunthorpe --- drivers/vfio/mdev/vfio_mdev.c | 22 -- drivers/vfio/vfio.c | 14 +- include/linux/mdev.h | 7 --- include/linux/vfio.h | 4

[PATCH v2 06/14] vfio/fsl: Move to the device set infrastructure

2021-07-20 Thread Jason Gunthorpe
ned-off-by: Jason Gunthorpe --- drivers/vfio/fsl-mc/vfio_fsl_mc.c | 153 -- drivers/vfio/fsl-mc/vfio_fsl_mc_intr.c| 6 +- drivers/vfio/fsl-mc/vfio_fsl_mc_private.h | 7 - 3 files changed, 27 insertions(+), 139 deletions(-) diff --git a/drivers/vfio/fsl-mc/vfio_f

[PATCH v2 03/14] vfio: Introduce a vfio_uninit_group_dev() API call

2021-07-20 Thread Jason Gunthorpe
-by: Max Gurtovoy Signed-off-by: Jason Gunthorpe --- Documentation/driver-api/vfio.rst| 4 ++- drivers/vfio/fsl-mc/vfio_fsl_mc.c| 7 ++--- drivers/vfio/mdev/vfio_mdev.c| 13 +++--- drivers/vfio/pci/vfio_pci.c | 6 +++-- drivers/vfio

[PATCH v2 00/14] Provide core infrastructure for managing open/release

2021-07-20 Thread Jason Gunthorpe
ev open_device if there is no op - Fix style for else {} - Spelling fix for singleton - Acquire cur_mem under lock - Always use error unwind flow for vfio_pci_check_all_devices_bound() v1: https://lore.kernel.org/r/0-v1-eaf3ccbba33c+1add0-vfio_reflck_...@nvidia.com Jason Gunthorpe (12): vfi

[PATCH v2 08/14] vfio/pci: Move to the device set infrastructure

2021-07-20 Thread Jason Gunthorpe
ed by what devices pci_reset_bus() touches, which is either the entire bus or only the slot. Rely on the core code to do everything reflck was doing and delete reflck entirely. Signed-off-by: Yishai Hadas Signed-off-by: Jason Gunthorpe --- drivers/vfio/pci/vfio_pci.c

[PATCH v2 07/14] vfio/platform: Use open_device() instead of open coding a refcnt scheme

2021-07-20 Thread Jason Gunthorpe
Platform simply wants to run some code when the device is first opened/last closed. Use the core framework and locking for this. Aside from removing a bit of code this narrows the locking scope from a global lock. Signed-off-by: Yishai Hadas Signed-off-by: Jason Gunthorpe --- drivers/vfio

[PATCH v2 05/14] vfio/samples: Delete useless open/close

2021-07-20 Thread Jason Gunthorpe
The core code no longer requires these ops to be defined, so delete these empty functions and leave the op as NULL. mtty's functions only log a pointless message, delete that entirely. Signed-off-by: Yishai Hadas Reviewed-by: Cornelia Huck Signed-off-by: Jason Gunthorpe --- samples/vfio

[PATCH v2 09/14] vfio/pci: Change vfio_pci_try_bus_reset() to use the dev_set

2021-07-20 Thread Jason Gunthorpe
ucturing corrects a call to pci_dev_driver() without holding the device_lock() and removes a hard wiring to &vfio_pci_driver. Signed-off-by: Jason Gunthorpe --- drivers/vfio/pci/vfio_pci.c | 110 ++-- drivers/vfio/vfio.c | 10 include/linux/vfio.h

[PATCH v2 13/14] vfio/gvt: Fix open/close when multiple device FDs are open

2021-07-20 Thread Jason Gunthorpe
these really want the new open/close_device() semantics just change the function over. Reviewed-by: Zhenyu Wang Reviewed-by: Cornelia Huck Signed-off-by: Jason Gunthorpe --- drivers/gpu/drm/i915/gvt/kvmgt.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm

[PATCH v2 11/14] vfio/mbochs: Fix close when multiple device FDs are open

2021-07-20 Thread Jason Gunthorpe
Signed-off-by: Jason Gunthorpe --- samples/vfio-mdev/mbochs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/samples/vfio-mdev/mbochs.c b/samples/vfio-mdev/mbochs.c index fb81d11029e8a5..39002b07e692ac 100644 --- a/samples/vfio-mdev/mbochs.c +++ b/samples/vfio-mdev

[PATCH v2 10/14] vfio/pci: Reorganize VFIO_DEVICE_PCI_HOT_RESET to use the device set

2021-07-20 Thread Jason Gunthorpe
_driver(). Signed-off-by: Jason Gunthorpe --- drivers/vfio/pci/vfio_pci.c | 201 +++- 1 file changed, 84 insertions(+), 117 deletions(-) diff --git a/drivers/vfio/pci/vfio_pci.c b/drivers/vfio/pci/vfio_pci.c index fbc20f6d2dd412..d751d38f2175b6 100644 --- a/drivers/

[PATCH v2 12/14] vfio/ap, ccw: Fix open/close when multiple device FDs are open

2021-07-20 Thread Jason Gunthorpe
. Since these really want the new open/close_device() semantics just change the functions over. Reviewed-by: Cornelia Huck Signed-off-by: Jason Gunthorpe --- drivers/s390/cio/vfio_ccw_ops.c | 8 drivers/s390/crypto/vfio_ap_ops.c | 8 2 files changed, 8 insertions(+), 8

Re: [PATCH v2 02/14] vfio/mbochs: Fix missing error unwind in mbochs_probe()

2021-07-20 Thread Jason Gunthorpe
On Tue, Jul 20, 2021 at 04:01:27PM -0600, Alex Williamson wrote: > On Tue, 20 Jul 2021 14:42:48 -0300 > Jason Gunthorpe wrote: > > > Compared to mbochs_remove() two cases are missing from the > > vfio_register_group_dev() unwind. Add them in. > > > > Fixes: 68

Re: [PATCH v4 10/13] lib: test_hmm add module param for zone device type

2021-07-22 Thread Jason Gunthorpe
On Sat, Jul 17, 2021 at 02:21:32PM -0500, Alex Sierra wrote: > In order to configure device generic in test_hmm, two > module parameters should be passed, which correspon to the > SP start address of each device (2) spm_addr_dev0 & > spm_addr_dev1. If no parameters are passed, private device > type

Re: [PATCH rdma-next v2 1/2] lib/scatterlist: Fix wrong update of orig_nents

2021-07-22 Thread Jason Gunthorpe
On Sun, Jul 18, 2021 at 02:09:12PM +0300, Leon Romanovsky wrote: > @@ -386,12 +414,14 @@ static struct scatterlist *get_next_sg(struct sg_table > *table, > return ERR_PTR(-ENOMEM); > sg_init_table(new_sg, alloc_size); > if (cur) { > + if (total_nents) > +

Re: [PATCH rdma-next v2 1/2] lib/scatterlist: Fix wrong update of orig_nents

2021-07-22 Thread Jason Gunthorpe
On Thu, Jul 22, 2021 at 02:07:51PM +0100, Christoph Hellwig wrote: > On Thu, Jul 22, 2021 at 10:00:40AM -0300, Jason Gunthorpe wrote: > > this is better: > > > >struct sg_append_table state; > > > >sg_append_init(&state, sgt, gfp_mask)

Re: [PATCH v4 10/13] lib: test_hmm add module param for zone device type

2021-07-22 Thread Jason Gunthorpe
On Thu, Jul 22, 2021 at 11:59:17AM -0500, Sierra Guiza, Alejandro (Alex) wrote: > > On 7/22/2021 7:23 AM, Jason Gunthorpe wrote: > > On Sat, Jul 17, 2021 at 02:21:32PM -0500, Alex Sierra wrote: > > > In order to configure device generic in test_hmm, two > > > modu

Re: [PATCH v2 06/14] vfio/fsl: Move to the device set infrastructure

2021-07-23 Thread Jason Gunthorpe
On Fri, Jul 23, 2021 at 09:44:35AM +0200, Christoph Hellwig wrote: > On Tue, Jul 20, 2021 at 02:42:52PM -0300, Jason Gunthorpe wrote: > > .write = vfio_fsl_mc_write, > > @@ -625,13 +526,15 @@ static int vfio_fsl_mc_probe(struct fsl_mc_device > > *mc_dev) > >

Re: [PATCH v2 07/14] vfio/platform: Use open_device() instead of open coding a refcnt scheme

2021-07-23 Thread Jason Gunthorpe
On Fri, Jul 23, 2021 at 09:45:21AM +0200, Christoph Hellwig wrote: > Looks good, > > Reviewed-by: Christoph Hellwig > > On Tue, Jul 20, 2021 at 02:42:53PM -0300, Jason Gunthorpe wrote: > > Platform simply wants to run some code when the device is first > > opene

Re: [PATCH v2 08/14] vfio/pci: Move to the device set infrastructure

2021-07-23 Thread Jason Gunthorpe
On Fri, Jul 23, 2021 at 09:47:49AM +0200, Christoph Hellwig wrote: > > @@ -2020,12 +2004,17 @@ static int vfio_pci_probe(struct pci_dev *pdev, > > const struct pci_device_id *id) > > INIT_LIST_HEAD(&vdev->vma_list); > > init_rwsem(&vdev->memory_lock); > > > > - ret = vfio_pci_reflck_at

Re: [PATCH v2 06/14] vfio/fsl: Move to the device set infrastructure

2021-07-23 Thread Jason Gunthorpe
On Fri, Jul 23, 2021 at 02:29:03PM +0200, Christoph Hellwig wrote: > On Fri, Jul 23, 2021 at 09:22:27AM -0300, Jason Gunthorpe wrote: > > > But do we even need the else part? Assingning &mc_dev->dev is > > > equivalent to the default per-device set anyway, isn&#

Re: [PATCH v2 09/14] vfio/pci: Change vfio_pci_try_bus_reset() to use the dev_set

2021-07-23 Thread Jason Gunthorpe
On Fri, Jul 23, 2021 at 10:05:43AM +0200, Christoph Hellwig wrote: > On Tue, Jul 20, 2021 at 02:42:55PM -0300, Jason Gunthorpe wrote: > > Keep track of all the vfio_devices that have been added to the device set > > and use this list in vfio_pci_try_bus_reset() instead of

Re: [PATCH v2 10/14] vfio/pci: Reorganize VFIO_DEVICE_PCI_HOT_RESET to use the device set

2021-07-23 Thread Jason Gunthorpe
On Fri, Jul 23, 2021 at 10:12:08AM +0200, Christoph Hellwig wrote: > On Tue, Jul 20, 2021 at 02:42:56PM -0300, Jason Gunthorpe wrote: > > Like vfio_pci_try_bus_reset() this code wants to reset all of the devices > > in the "reset group" which is the same mem

Re: [PATCH v2 04/14] vfio: Provide better generic support for open/release vfio_device_ops

2021-07-23 Thread Jason Gunthorpe
On Fri, Jul 23, 2021 at 09:39:14AM +0200, Christoph Hellwig wrote: > This looks unessecarily complicated. We can just try to load first > and then store it under the same lock, e.g.: Yes indeed, I went with this: int vfio_assign_device_set(struct vfio_device *device, void *set_id) { uns

Re: refactor the i915 GVT support

2021-07-27 Thread Jason Gunthorpe
On Thu, Jul 22, 2021 at 01:26:36PM +0200, Gerd Hoffmann wrote: > Hi, > > > https://github.com/intel/gvt-linux/blob/topic/gvt-xengt/drivers/gpu/drm/i915/gvt/xengt.c > > > But it's hard for some customers to contribute their own "hypervisor" > > module to the upstream Linux kernel. I am thinking

Re: refactor the i915 GVT support

2021-07-28 Thread Jason Gunthorpe
On Wed, Jul 28, 2021 at 01:38:58PM +, Wang, Zhi A wrote: > I guess those APIs you were talking about are KVM-only. For other > hypervisors, e.g. Xen, ARCN cannot use the APIs you mentioned. Not > sure if you have already noticed that VFIO is KVM-only right now. There is very little hard conne

[PATCH v3 00/14] Provide core infrastructure for managing open/release

2021-07-28 Thread Jason Gunthorpe
- Spelling fix for singleton - Acquire cur_mem under lock - Always use error unwind flow for vfio_pci_check_all_devices_bound() v1: https://lore.kernel.org/r/0-v1-eaf3ccbba33c+1add0-vfio_reflck_...@nvidia.com Jason Gunthorpe (12): vfio/samples: Remove module get/put vfio/mbochs: Fix mis

[PATCH v3 07/14] vfio/platform: Use open_device() instead of open coding a refcnt scheme

2021-07-28 Thread Jason Gunthorpe
Platform simply wants to run some code when the device is first opened/last closed. Use the core framework and locking for this. Aside from removing a bit of code this narrows the locking scope from a global lock. Signed-off-by: Jason Gunthorpe Signed-off-by: Yishai Hadas Reviewed-by: Cornelia

[PATCH v3 08/14] vfio/pci: Move to the device set infrastructure

2021-07-28 Thread Jason Gunthorpe
ed by what devices pci_reset_bus() touches, which is either the entire bus or only the slot. Rely on the core code to do everything reflck was doing and delete reflck entirely. Signed-off-by: Yishai Hadas Reviewed-by: Christoph Hellwig Signed-off-by: Jason Gunthorpe --- drivers/vfio/pci/

[PATCH v3 02/14] vfio/mbochs: Fix missing error unwind of mbochs_used_mbytes

2021-07-28 Thread Jason Gunthorpe
ot;) Reported-by: Cornelia Huck Co-developed-by: Alex Williamson Signed-off-by: Jason Gunthorpe --- samples/vfio-mdev/mbochs.c | 24 +++- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/samples/vfio-mdev/mbochs.c b/samples/vfio-mdev/mbochs.c index e

[PATCH v3 04/14] vfio: Provide better generic support for open/release vfio_device_ops

2021-07-28 Thread Jason Gunthorpe
o group vfio_devices into sets. This implementation uses xarray instead of searching through the driver core structures, which simplifies the somewhat tricky locking in this area. Following patches convert all the drivers. Signed-off-by: Yishai Hadas Reviewed-by: Cornelia Huck Signed-off-by: Jaso

[PATCH v3 11/14] vfio/mbochs: Fix close when multiple device FDs are open

2021-07-28 Thread Jason Gunthorpe
Reviewed-by: Christoph Hellwig Signed-off-by: Jason Gunthorpe --- samples/vfio-mdev/mbochs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/samples/vfio-mdev/mbochs.c b/samples/vfio-mdev/mbochs.c index 5ac65894fcd38c..6974626ec1c5d0 100644 --- a/samples/vfio-mdev/mbochs.c

[PATCH v3 05/14] vfio/samples: Delete useless open/close

2021-07-28 Thread Jason Gunthorpe
The core code no longer requires these ops to be defined, so delete these empty functions and leave the op as NULL. mtty's functions only log a pointless message, delete that entirely. Signed-off-by: Yishai Hadas Reviewed-by: Cornelia Huck Reviewed-by: Christoph Hellwig Signed-off-by:

[PATCH v3 10/14] vfio/pci: Reorganize VFIO_DEVICE_PCI_HOT_RESET to use the device set

2021-07-28 Thread Jason Gunthorpe
river(). Reviewed-off-by: Christoph Hellwig Signed-off-by: Jason Gunthorpe --- drivers/vfio/pci/vfio_pci.c | 215 +++- 1 file changed, 91 insertions(+), 124 deletions(-) diff --git a/drivers/vfio/pci/vfio_pci.c b/drivers/vfio/pci/vfio_pci.c index a1ae9a83a38621..72

[PATCH v3 06/14] vfio/fsl: Move to the device set infrastructure

2021-07-28 Thread Jason Gunthorpe
ned-off-by: Jason Gunthorpe --- drivers/vfio/fsl-mc/vfio_fsl_mc.c | 154 -- drivers/vfio/fsl-mc/vfio_fsl_mc_intr.c| 6 +- drivers/vfio/fsl-mc/vfio_fsl_mc_private.h | 7 - 3 files changed, 28 insertions(+), 139 deletions(-) diff --git a/drivers/vfio/fsl-mc/vfio_f

[PATCH v3 13/14] vfio/gvt: Fix open/close when multiple device FDs are open

2021-07-28 Thread Jason Gunthorpe
these really want the new open/close_device() semantics just change the function over. Reviewed-by: Zhenyu Wang Reviewed-by: Cornelia Huck Reviewed-by: Christoph Hellwig Signed-off-by: Jason Gunthorpe --- drivers/gpu/drm/i915/gvt/kvmgt.c | 8 1 file changed, 4 insertions(+), 4 deletions

[PATCH v3 03/14] vfio: Introduce a vfio_uninit_group_dev() API call

2021-07-28 Thread Jason Gunthorpe
-by: Max Gurtovoy Reviewed-by: Cornelia Huck Reviewed-by: Christoph Hellwig Signed-off-by: Jason Gunthorpe --- Documentation/driver-api/vfio.rst| 4 ++- drivers/vfio/fsl-mc/vfio_fsl_mc.c| 7 ++--- drivers/vfio/mdev/vfio_mdev.c| 13 +++--- drivers/vfio

[PATCH v3 01/14] vfio/samples: Remove module get/put

2021-07-28 Thread Jason Gunthorpe
ot;) Fixes: 681c1615f891 ("vfio/mbochs: Convert to use vfio_register_group_dev()") Reviewed-by: Cornelia Huck Reviewed-by: Christoph Hellwig Signed-off-by: Jason Gunthorpe --- samples/vfio-mdev/mbochs.c | 4 samples/vfio-mdev/mdpy.c | 4 2 files changed, 8 deletions(-) diff --git

[PATCH v3 14/14] vfio: Remove struct vfio_device_ops open/release

2021-07-28 Thread Jason Gunthorpe
Nothing uses this anymore, delete it. Signed-off-by: Yishai Hadas Reviewed-by: Christoph Hellwig Signed-off-by: Jason Gunthorpe --- drivers/vfio/mdev/vfio_mdev.c | 22 -- drivers/vfio/vfio.c | 14 +- include/linux/mdev.h | 7 --- include

[PATCH v3 09/14] vfio/pci: Change vfio_pci_try_bus_reset() to use the dev_set

2021-07-28 Thread Jason Gunthorpe
ucturing corrects a call to pci_dev_driver() without holding the device_lock() and removes a hard wiring to &vfio_pci_driver. Signed-off-by: Jason Gunthorpe --- drivers/vfio/pci/vfio_pci.c | 148 +++- 1 file changed, 62 insertions(+), 86 deletions(-) diff --g

[PATCH v3 12/14] vfio/ap, ccw: Fix open/close when multiple device FDs are open

2021-07-28 Thread Jason Gunthorpe
. Since these really want the new open/close_device() semantics just change the functions over. Reviewed-by: Cornelia Huck Signed-off-by: Jason Gunthorpe --- drivers/s390/cio/vfio_ccw_ops.c | 8 drivers/s390/crypto/vfio_ap_ops.c | 8 2 files changed, 8 insertions(+), 8

Re: [PATCH v3 02/14] vfio/mbochs: Fix missing error unwind of mbochs_used_mbytes

2021-07-29 Thread Jason Gunthorpe
On Thu, Jul 29, 2021 at 12:38:12PM +0300, Dan Carpenter wrote: > This should just be: > atomic_add(type->mbytes, &mbochs_avail_mbytes); Arg, yes, thanks Dan - I thought I got all of these. Jason

Re: refactor the i915 GVT support

2021-08-03 Thread Jason Gunthorpe
On Tue, Aug 03, 2021 at 05:43:15PM +0800, Zhenyu Wang wrote: > Acked-by: Zhenyu Wang > > Thanks a lot for this effort! Great, do we have a submission plan for this? how much does it clash with my open_device/etc patch? ie does the whole thing have to go through the vfio tree? Thanks, Jason

Re: [PATCH v3 09/14] vfio/pci: Change vfio_pci_try_bus_reset() to use the dev_set

2021-08-03 Thread Jason Gunthorpe
On Tue, Aug 03, 2021 at 10:34:06AM -0600, Alex Williamson wrote: > On Wed, 28 Jul 2021 21:49:18 -0300 > Jason Gunthorpe wrote: > > > Keep track of all the vfio_devices that have been added to the device set > > and use this list in vfio_pci_try_bus_reset() instead of trying

Re: [PATCH 18/18] vfio/mdev: Correct the function signatures for the mdev_type_attributes

2021-04-06 Thread Jason Gunthorpe
On Tue, Mar 23, 2021 at 08:31:03PM +0100, Christoph Hellwig wrote: > > - type = intel_gvt_find_vgpu_type(gvt, mtype_get_type_group_id(kobj)); > > + type = intel_gvt_find_vgpu_type(gvt, mtype_get_type_group_id(mtype)); > > Somewhere in this series you should probably switch > intel_gvt_find_vg

[PATCH v2 15/18] vfio/gvt: Make DRM_I915_GVT depend on VFIO_MDEV

2021-04-06 Thread Jason Gunthorpe
t get randconfig failures when the next patch creates a link time dependency related to the use of MDEV_TYPE. Reviewed-by: Kevin Tian Reviewed-by: Christoph Hellwig Signed-off-by: Jason Gunthorpe --- drivers/gpu/drm/i915/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/i

[PATCH v2 00/18] Make vfio_mdev type safe

2021-04-06 Thread Jason Gunthorpe
s, annotate reviewed-by's thanks all v1: https://lore.kernel.org/r/0-v1-7dedf20b2b75+4f785-vfio2_...@nvidia.com Jason Gunthorpe (18): vfio/mdev: Fix missing static's on MDEV_TYPE_ATTR's vfio/mdev: Do not allow a mdev_type to have a NULL parent pointer vfio/mdev: Add missing

[PATCH v2 16/18] vfio/gvt: Use mdev_get_type_group_id()

2021-04-06 Thread Jason Gunthorpe
intel_gvt_init_vgpu_type_groups() makes gvt->types 1:1 with the supported_type_groups array, so the type_group_id is also the index into gvt->types. Use it directly and remove the string matching. Reviewed-by: Kevin Tian Reviewed-by: Christoph Hellwig Signed-off-by: Jason Gun

[PATCH v2 18/18] vfio/mdev: Correct the function signatures for the mdev_type_attributes

2021-04-06 Thread Jason Gunthorpe
but if it is ever needed it would be hard to add in retroactively, so do it now. Reviewed-by: Kevin Tian Reviewed-by: Cornelia Huck Reviewed-by: Christoph Hellwig Signed-off-by: Jason Gunthorpe --- drivers/gpu/drm/i915/gvt/gvt.c| 21 +++-- drivers/s390/cio/vfio_ccw_ops.c

[PATCH v2 17/18] vfio/mdev: Remove kobj from mdev_parent_ops->create()

2021-04-06 Thread Jason Gunthorpe
Hellwig Signed-off-by: Jason Gunthorpe --- drivers/gpu/drm/i915/gvt/kvmgt.c | 2 +- drivers/s390/cio/vfio_ccw_ops.c | 2 +- drivers/s390/crypto/vfio_ap_ops.c | 2 +- drivers/vfio/mdev/mdev_core.c | 2 +- include/linux/mdev.h | 3 +-- samples/vfio-mdev/mbochs.c| 2

Re: [PATCH 00/34] Add HMM-based SVM memory manager to KFD v4

2021-04-08 Thread Jason Gunthorpe
nk: > https://github.com/RadeonOpenCompute/ROCK-Kernel-Driver/tree/fxkamd/hmm-wip > Link: > https://github.com/RadeonOpenCompute/ROCT-Thunk-Interface/tree/fxkamd/hmm-wip > Link: https://patchwork.freedesktop.org/series/85563/ > CC: Jérôme Glisse > CC: Jason Gunthorpe This series

Re: [PATCH v1 2/2] drivers/gpu/drm: don't select DMA_CMA or CMA from aspeed or etnaviv

2021-04-08 Thread Jason Gunthorpe
On Thu, Apr 08, 2021 at 01:38:17PM +0200, Daniel Vetter wrote: > If you want to change this, we need automatic conflict resolution like apt > and other package managers have, with suggestions how to fix the config if > you want to enable a driver, but some of its requirements are missing. The > cu

Re: linux-next: manual merge of the vfio tree with the drm tree

2021-04-15 Thread Jason Gunthorpe
On Thu, Apr 15, 2021 at 04:47:34PM +1000, Stephen Rothwell wrote: > Hi all, > > Today's linux-next merge of the vfio tree got a conflict in: > > drivers/gpu/drm/i915/gvt/gvt.c > > between commit: > > 9ff06c385300 ("drm/i915/gvt: Remove references to struct drm_device.pdev") > > from the dr

Re: [PATCH 1/2] vfio/pci: remove vfio_pci_nvlink2

2021-04-22 Thread Jason Gunthorpe
On Thu, Apr 22, 2021 at 11:49:31PM +1000, Michael Ellerman wrote: > Alex Williamson writes: > > On Mon, 12 Apr 2021 19:41:41 +1000 > > Michael Ellerman wrote: > > > >> Alex Williamson writes: > >> > On Fri, 26 Mar 2021 07:13:10 +0100 > >> > Christoph Hellwig wrote: > >> > > >> >> This driver

Re: [PATCH] vfio/gvt: fix DRM_I915_GVT dependency on VFIO_MDEV

2021-04-22 Thread Jason Gunthorpe
his makes my head hurt, thanks for finding it I also can't see an alternative to this ugly thing, besides having the i915 guys properly modularize this code someday Reviewed-by: Jason Gunthorpe Jason ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel

Re: [PATCH] vfio/gvt: fix DRM_I915_GVT dependency on VFIO_MDEV

2021-04-23 Thread Jason Gunthorpe
On Fri, Apr 23, 2021 at 11:54:26AM +0800, Zhenyu Wang wrote: > On 2021.04.22 10:58:10 -0300, Jason Gunthorpe wrote: > > On Thu, Apr 22, 2021 at 03:35:33PM +0200, Arnd Bergmann wrote: > > > From: Arnd Bergmann > > > > > > The Kconfig dependency is inco

[PATCH 00/12] Remove vfio_mdev.c, mdev_parent_ops and more

2021-04-23 Thread Jason Gunthorpe
vfio_device implementation part, the only VFIO special part of mdev that remains is the mdev specific iommu intervention. Thanks, Jason Jason Gunthorpe (12): vfio/mdev: Remove CONFIG_VFIO_MDEV_DEVICE vfio/mdev: Allow the mdev_parent_ops to specify the device driver to bind vfio/mtty: Co

[PATCH 01/12] vfio/mdev: Remove CONFIG_VFIO_MDEV_DEVICE

2021-04-23 Thread Jason Gunthorpe
prevented the samples from being built in. Signed-off-by: Jason Gunthorpe --- Documentation/s390/vfio-ap.rst | 1 - arch/s390/Kconfig| 2 +- drivers/gpu/drm/i915/Kconfig | 2 +- drivers/vfio/mdev/Kconfig| 7 --- drivers/vfio/mdev/Makefile | 3 +-- drivers

[PATCH 10/12] vfio/mdev: Remove mdev_parent_ops

2021-04-23 Thread Jason Gunthorpe
The last useful member in this struct is the supported_type_groups, move it to the mdev_driver and delete mdev_parent_ops. Replace it with mdev_driver as an argument to mdev_register_device() Signed-off-by: Jason Gunthorpe --- .../driver-api/vfio-mediated-device.rst | 36

[PATCH 08/12] vfio/gvt: Convert to use vfio_register_group_dev()

2021-04-23 Thread Jason Gunthorpe
While there is a confusing mess of pointers and structs in this driver, the struct kvmgt_vdev (which in turn is 1:1 with a struct intel_vgpu) is what holds the vfio_device. Replace all the drvdata's and weird derivations of vgpu and vdev with container_of() or vdev->vgpu. Signed-off-b

Re: [PATCH 08/12] vfio/gvt: Convert to use vfio_register_group_dev()

2021-04-26 Thread Jason Gunthorpe
mbers that are connected to it. Preserve VFIO's design of allowing mdev drivers to be !GPL by allowing the three functions that replace this module for !GPL usage. This goes along with the other 19 symbols that are already marked !GPL in VFIO. Signed-of

Re: [PATCH 00/12] Remove vfio_mdev.c, mdev_parent_ops and more

2021-04-26 Thread Jason Gunthorpe
On Mon, Apr 26, 2021 at 06:43:14PM +0200, Christian Borntraeger wrote: > On 24.04.21 01:02, Jason Gunthorpe wrote: > > Prologue > > > > > > This is series #3 in part of a larger work that arose from the minor > > remark that the mdev_parent_op

Re: [PATCH 01/12] vfio/mdev: Remove CONFIG_VFIO_MDEV_DEVICE

2021-04-26 Thread Jason Gunthorpe
On Fri, Apr 23, 2021 at 05:08:10PM -0700, Randy Dunlap wrote: > On 4/23/21 4:02 PM, Jason Gunthorpe wrote: > > @@ -171,7 +171,7 @@ config SAMPLE_VFIO_MDEV_MDPY_FB > > > > config SAMPLE_VFIO_MDEV_MBOCHS > > tristate "Build VFIO mdpy example mediated dev

Re: [PATCH 10/12] vfio/mdev: Remove mdev_parent_ops

2021-04-26 Thread Jason Gunthorpe
On Mon, Apr 26, 2021 at 04:19:11PM +0200, Christoph Hellwig wrote: > > +The mediated bus driver's probe function should create a vfio_device on > > top of > > +the mdev_device and connect it to an appropriate implementation of > > vfio_device_ops. > > Overly long line. > > > +This will provide

[PATCH v2 00/13] Remove vfio_mdev.c, mdev_parent_ops and more

2021-04-26 Thread Jason Gunthorpe
indirections to call bus_register()/bus_unregister() - Reflow long doc lines v1: https://lore.kernel.org/r/0-v1-d88406ed308e+418-vfio3_...@nvidia.com Jason Cc: Leon Romanovsky Cc: "Raj, Ashok" Cc: Dan Williams Cc: Max Gurtovoy Cc: Christoph Hellwig Cc: Tarun Gupta Cc: Daniel Vetter

[PATCH v2 01/13] vfio/mdev: Remove CONFIG_VFIO_MDEV_DEVICE

2021-04-26 Thread Jason Gunthorpe
For some reason the vfio_mdev shim mdev_driver has its own module and kconfig. As the next patch requires access to it from mdev.ko merge the two modules together and remove VFIO_MDEV_DEVICE. A later patch deletes this driver entirely. Signed-off-by: Jason Gunthorpe --- Documentation/s390/vfio

[PATCH v2 08/13] vfio/gvt: Convert to use vfio_register_group_dev()

2021-04-26 Thread Jason Gunthorpe
While there is a confusing mess of pointers and structs in this driver, the struct kvmgt_vdev (which in turn is 1:1 with a struct intel_vgpu) is what holds the vfio_device. Replace all the drvdata's and weird derivations of vgpu and vdev with container_of() or vdev->vgpu. Signed-off-b

[PATCH v2 11/13] vfio/mdev: Remove mdev_parent_ops

2021-04-26 Thread Jason Gunthorpe
The last useful member in this struct is the supported_type_groups, move it to the mdev_driver and delete mdev_parent_ops. Replace it with mdev_driver as an argument to mdev_register_device() Reviewed-by: Christoph Hellwig Signed-off-by: Jason Gunthorpe --- .../driver-api/vfio-mediated

Re: [PATCH v2 00/13] Remove vfio_mdev.c, mdev_parent_ops and more

2021-04-27 Thread Jason Gunthorpe
On Tue, Apr 27, 2021 at 03:30:42PM -0600, Alex Williamson wrote: > It'd be really helpful if you could consistently copy at least one > list, preferably one monitored by patchwork, for an entire series. The > kvm list is missing patches 06 and 08. I can find the latter hopping > over to the int

Re: [PATCH 00/12] Remove vfio_mdev.c, mdev_parent_ops and more

2021-04-27 Thread Jason Gunthorpe
On Tue, Apr 27, 2021 at 09:33:56AM +0200, Christian Borntraeger wrote: > On 26.04.21 19:42, Jason Gunthorpe wrote: > > On Mon, Apr 26, 2021 at 06:43:14PM +0200, Christian Borntraeger wrote: > > > On 24.04.21 01:02, Jason Gunthorpe wrote: > > > > Prologue > > &

Re: [PATCH v3 09/14] vfio/pci: Change vfio_pci_try_bus_reset() to use the dev_set

2021-08-05 Thread Jason Gunthorpe
On Tue, Aug 03, 2021 at 10:52:25AM -0600, Alex Williamson wrote: > On Tue, 3 Aug 2021 13:41:52 -0300 > Jason Gunthorpe wrote: > > On Tue, Aug 03, 2021 at 10:34:06AM -0600, Alex Williamson wrote: > > > I think the vfio_pci_find_reset_target() function needs to be re-worked

Re: [PATCH v3 09/14] vfio/pci: Change vfio_pci_try_bus_reset() to use the dev_set

2021-08-05 Thread Jason Gunthorpe
On Thu, Aug 05, 2021 at 11:33:11AM -0600, Alex Williamson wrote: > > +static int vfio_pci_is_device_in_set(struct pci_dev *pdev, void *data) > > +{ > > + struct vfio_device_set *dev_set = data; > > + struct vfio_device *cur; > > + > > + lockdep_assert_held(&dev_set->lock); > > + > > + list_

[PATCH v4 00/14] Provide core infrastructure for managing open/release

2021-08-05 Thread Jason Gunthorpe
mbochs - Return 0 from mdev open_device if there is no op - Fix style for else {} - Spelling fix for singleton - Acquire cur_mem under lock - Always use error unwind flow for vfio_pci_check_all_devices_bound() v1: https://lore.kernel.org/r/0-v1-eaf3ccbba33c+1add0-vfio_reflck_...@nvidia.com Jason G

[PATCH v4 11/14] vfio/mbochs: Fix close when multiple device FDs are open

2021-08-05 Thread Jason Gunthorpe
Reviewed-by: Christoph Hellwig Signed-off-by: Jason Gunthorpe --- samples/vfio-mdev/mbochs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/samples/vfio-mdev/mbochs.c b/samples/vfio-mdev/mbochs.c index 7b2e12fe70827c..c313ab4d1f4e4e 100644 --- a/samples/vfio-mdev/mbochs.c

[PATCH v4 09/14] vfio/pci: Change vfio_pci_try_bus_reset() to use the dev_set

2021-08-05 Thread Jason Gunthorpe
ing it inside vfio_pci_dev_set_try_reset(). This restructuring corrects a call to pci_dev_driver() without holding the device_lock() and removes a hard wiring to &vfio_pci_driver. Signed-off-by: Jason Gunthorpe --- drivers/vfio/pci/vfio_pci.c | 182 +--- 1 file chang

[PATCH v4 02/14] vfio/mbochs: Fix missing error unwind of mbochs_used_mbytes

2021-08-05 Thread Jason Gunthorpe
ot;) Reported-by: Cornelia Huck Co-developed-by: Alex Williamson Reviewed-by: Christoph Hellwig Signed-off-by: Jason Gunthorpe --- samples/vfio-mdev/mbochs.c | 24 +++- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/samples/vfio-mdev/mbochs.c b/samples/vfio-

[PATCH v4 04/14] vfio: Provide better generic support for open/release vfio_device_ops

2021-08-05 Thread Jason Gunthorpe
o group vfio_devices into sets. This implementation uses xarray instead of searching through the driver core structures, which simplifies the somewhat tricky locking in this area. Following patches convert all the drivers. Signed-off-by: Yishai Hadas Reviewed-by: Cornelia Huck Reviewed-by: Christoph

[PATCH v4 08/14] vfio/pci: Move to the device set infrastructure

2021-08-05 Thread Jason Gunthorpe
ed by what devices pci_reset_bus() touches, which is either the entire bus or only the slot. Rely on the core code to do everything reflck was doing and delete reflck entirely. Signed-off-by: Yishai Hadas Reviewed-by: Christoph Hellwig Signed-off-by: Jason Gunthorpe --- drivers/vfio/pci/

[PATCH v4 10/14] vfio/pci: Reorganize VFIO_DEVICE_PCI_HOT_RESET to use the device set

2021-08-05 Thread Jason Gunthorpe
i_dev_driver(). Reviewed-off-by: Christoph Hellwig Signed-off-by: Jason Gunthorpe --- drivers/vfio/pci/vfio_pci.c | 213 +++- 1 file changed, 89 insertions(+), 124 deletions(-) diff --git a/drivers/vfio/pci/vfio_pci.c b/drivers/vfio/pci/vfio_pci.c index 0147f04c91b2

[PATCH v4 03/14] vfio: Introduce a vfio_uninit_group_dev() API call

2021-08-05 Thread Jason Gunthorpe
-by: Max Gurtovoy Reviewed-by: Cornelia Huck Reviewed-by: Christoph Hellwig Signed-off-by: Jason Gunthorpe --- Documentation/driver-api/vfio.rst| 4 ++- drivers/vfio/fsl-mc/vfio_fsl_mc.c| 7 ++--- drivers/vfio/mdev/vfio_mdev.c| 13 +++--- drivers/vfio

[PATCH v4 14/14] vfio: Remove struct vfio_device_ops open/release

2021-08-05 Thread Jason Gunthorpe
Nothing uses this anymore, delete it. Signed-off-by: Yishai Hadas Reviewed-by: Christoph Hellwig Signed-off-by: Jason Gunthorpe --- drivers/vfio/mdev/vfio_mdev.c | 22 -- drivers/vfio/vfio.c | 14 +- include/linux/mdev.h | 7 --- include

[PATCH v4 06/14] vfio/fsl: Move to the device set infrastructure

2021-08-05 Thread Jason Gunthorpe
ned-off-by: Jason Gunthorpe --- drivers/vfio/fsl-mc/vfio_fsl_mc.c | 156 -- drivers/vfio/fsl-mc/vfio_fsl_mc_intr.c| 6 +- drivers/vfio/fsl-mc/vfio_fsl_mc_private.h | 7 - 3 files changed, 29 insertions(+), 140 deletions(-) diff --git a/drivers/vfio/fsl-mc/vfio_f

[PATCH v4 05/14] vfio/samples: Delete useless open/close

2021-08-05 Thread Jason Gunthorpe
The core code no longer requires these ops to be defined, so delete these empty functions and leave the op as NULL. mtty's functions only log a pointless message, delete that entirely. Signed-off-by: Yishai Hadas Reviewed-by: Cornelia Huck Reviewed-by: Christoph Hellwig Signed-off-by:

[PATCH v4 07/14] vfio/platform: Use open_device() instead of open coding a refcnt scheme

2021-08-05 Thread Jason Gunthorpe
Hellwig Signed-off-by: Jason Gunthorpe Signed-off-by: Yishai Hadas --- drivers/vfio/platform/vfio_platform_common.c | 95 --- drivers/vfio/platform/vfio_platform_private.h | 1 - 2 files changed, 40 insertions(+), 56 deletions(-) diff --git a/drivers/vfio/platform

[PATCH v4 01/14] vfio/samples: Remove module get/put

2021-08-05 Thread Jason Gunthorpe
ot;) Fixes: 681c1615f891 ("vfio/mbochs: Convert to use vfio_register_group_dev()") Reviewed-by: Cornelia Huck Reviewed-by: Christoph Hellwig Signed-off-by: Jason Gunthorpe --- samples/vfio-mdev/mbochs.c | 4 samples/vfio-mdev/mdpy.c | 4 2 files changed, 8 deletions(-) diff --git

[PATCH v4 13/14] vfio/gvt: Fix open/close when multiple device FDs are open

2021-08-05 Thread Jason Gunthorpe
these really want the new open/close_device() semantics just change the function over. Reviewed-by: Zhenyu Wang Reviewed-by: Cornelia Huck Reviewed-by: Christoph Hellwig Signed-off-by: Jason Gunthorpe --- drivers/gpu/drm/i915/gvt/kvmgt.c | 8 1 file changed, 4 insertions(+), 4 deletions

[PATCH v4 12/14] vfio/ap, ccw: Fix open/close when multiple device FDs are open

2021-08-05 Thread Jason Gunthorpe
. Since these really want the new open/close_device() semantics just change the functions over. Reviewed-by: Cornelia Huck Signed-off-by: Jason Gunthorpe --- drivers/s390/cio/vfio_ccw_ops.c | 8 drivers/s390/crypto/vfio_ap_ops.c | 8 2 files changed, 8 insertions(+), 8

Re: [PATCH v2 56/63] RDMA/mlx5: Use struct_group() to zero struct mlx5_ib_mr

2021-08-19 Thread Jason Gunthorpe
_mr that should be > initialized to zero. > > Cc: Leon Romanovsky > Cc: Doug Ledford > Cc: Jason Gunthorpe > Cc: linux-r...@vger.kernel.org > Signed-off-by: Kees Cook > --- > drivers/infiniband/hw/mlx5/mlx5_ib.h | 4 +++- > 1 file changed, 3 insertions(+), 1 del

Re: [PATCH v2 56/63] RDMA/mlx5: Use struct_group() to zero struct mlx5_ib_mr

2021-08-19 Thread Jason Gunthorpe
On Thu, Aug 19, 2021 at 09:19:08AM -0700, Kees Cook wrote: > On Thu, Aug 19, 2021 at 09:27:16AM -0300, Jason Gunthorpe wrote: > > On Tue, Aug 17, 2021 at 11:05:26PM -0700, Kees Cook wrote: > > > In preparation for FORTIFY_SOURCE performing compile-time and run-time > > >

Re: [RFC] Make use of non-dynamic dmabuf in RDMA

2021-08-19 Thread Jason Gunthorpe
On Wed, Aug 18, 2021 at 11:34:51AM +0200, Daniel Vetter wrote: > On Wed, Aug 18, 2021 at 9:45 AM Gal Pressman wrote: > > > > Hey all, > > > > Currently, the RDMA subsystem can only work with dynamic dmabuf > > attachments, which requires the RDMA device to support on-demand-paging > > (ODP) which

Re: [RFC] Make use of non-dynamic dmabuf in RDMA

2021-08-20 Thread Jason Gunthorpe
On Fri, Aug 20, 2021 at 09:25:30AM +0200, Daniel Vetter wrote: > On Fri, Aug 20, 2021 at 1:06 AM Jason Gunthorpe wrote: > > On Wed, Aug 18, 2021 at 11:34:51AM +0200, Daniel Vetter wrote: > > > On Wed, Aug 18, 2021 at 9:45 AM Gal Pressman wrote: > > > > > > &g

Re: [PATCH v2 56/63] RDMA/mlx5: Use struct_group() to zero struct mlx5_ib_mr

2021-08-20 Thread Jason Gunthorpe
On Thu, Aug 19, 2021 at 11:14:37AM -0700, Kees Cook wrote: > Which do you mean? When doing the conversions I tended to opt for > struct_group() since it provides more robust "intentionality". Strictly > speaking, the new memset helpers are doing field-spanning writes, but the > "clear to the end"

Re: [RFC] Make use of non-dynamic dmabuf in RDMA

2021-08-20 Thread Jason Gunthorpe
On Fri, Aug 20, 2021 at 03:58:33PM +0300, Gal Pressman wrote: > Though it would've been nicer if we could agree on a solution that could work > for more than 1-2 RDMA devices, using the existing tools the RDMA subsystem > has. I don't think it can really be done, revoke is necessary, and isn't a

Re: [PATCH rdma-next v3 2/3] lib/scatterlist: Fix wrong update of orig_nents

2021-08-20 Thread Jason Gunthorpe
On Thu, Jul 29, 2021 at 12:39:12PM +0300, Leon Romanovsky wrote: > +/** > + * __sg_free_table - Free a previously mapped sg table > + * @table: The sg table header to use > + * @max_ents:The maximum number of entries per single scatterlist > + * @total_ents: The total number of entr

Re: [PATCH rdma-next v3 2/3] lib/scatterlist: Fix wrong update of orig_nents

2021-08-20 Thread Jason Gunthorpe
On Fri, Aug 20, 2021 at 12:54:25PM -0300, Jason Gunthorpe wrote: > On Thu, Jul 29, 2021 at 12:39:12PM +0300, Leon Romanovsky wrote: > > > +/** > > + * __sg_free_table - Free a previously mapped sg table > > + * @table: The sg table header to use > > + * @max_en

  1   2   3   4   5   6   7   8   9   10   >