Re: [Intel-gfx] [PATCH 06/10] vfio/mdev: Remove CONFIG_VFIO_MDEV_DEVICE

2021-06-08 Thread Christoph Hellwig
Looks good, Reviewed-by: Christoph Hellwig ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Re: [Intel-gfx] [PATCH 00/10] Allow mdev drivers to directly create the vfio_device

2021-06-08 Thread Christoph Hellwig
Btw, you list of CCs is a mess as alsmost no one is CCed on the whole list can can thus properly review it. ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Re: [Intel-gfx] [PATCH v9 01/14] swiotlb: Refactor swiotlb init functions

2021-06-13 Thread Christoph Hellwig
mset. Which means we can just move it to the callers that care instead of having a bool argument. Otherwise looks good: Reviewed-by: Christoph Hellwig ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Re: [Intel-gfx] [PATCH v9 02/14] swiotlb: Refactor swiotlb_create_debugfs

2021-06-13 Thread Christoph Hellwig
ce swiotlb_force; > > struct io_tlb_mem *io_tlb_default_mem; > +#ifdef CONFIG_DEBUG_FS > +static struct dentry *debugfs_dir; > +#endif What about moving this declaration into the main CONFIG_DEBUG_FS block near the functions using it? Otherwise looks good: Reviewed-by: Christoph Hellwig

Re: [Intel-gfx] [PATCH v9 03/14] swiotlb: Set dev->dma_io_tlb_mem to the swiotlb pool used

2021-06-13 Thread Christoph Hellwig
On Fri, Jun 11, 2021 at 11:33:15PM +0800, Claire Chang wrote: > I'm not sure if this would break arch/x86/pci/sta2x11-fixup.c > swiotlb_late_init_with_default_size is called here > https://elixir.bootlin.com/linux/v5.13-rc5/source/arch/x86/pci/sta2x11-fixup.c#L60 It will. It will also break all n

Re: [Intel-gfx] [PATCH v9 04/14] swiotlb: Add restricted DMA pool initialization

2021-06-13 Thread Christoph Hellwig
On Fri, Jun 11, 2021 at 11:26:49PM +0800, Claire Chang wrote: > Add the initialization function to create restricted DMA pools from > matching reserved-memory nodes. Bisection hazard: we should only add the new config option when the code is actually read to be used. So this patch should move to

Re: [Intel-gfx] [PATCH v9 05/14] swiotlb: Update is_swiotlb_buffer to add a struct device argument

2021-06-13 Thread Christoph Hellwig
Looks good, Reviewed-by: Christoph Hellwig ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Re: [Intel-gfx] [PATCH v9 06/14] swiotlb: Update is_swiotlb_active to add a struct device argument

2021-06-13 Thread Christoph Hellwig
int pcifront_connect_and_init_dma(struct > pcifront_device *pdev) > > spin_unlock(&pcifront_dev_lock); > > - if (!err && !is_swiotlb_active()) { > + if (!err && !is_swiotlb_active(&pdev->xdev->dev)) { This looks good as

Re: [Intel-gfx] [PATCH v9 07/14] swiotlb: Bounce data from/to restricted DMA pool if available

2021-06-13 Thread Christoph Hellwig
On Fri, Jun 11, 2021 at 11:26:52PM +0800, Claire Chang wrote: > Regardless of swiotlb setting, the restricted DMA pool is preferred if > available. > > The restricted DMA pools provide a basic level of protection against the > DMA overwriting buffer contents at unexpected times. However, to protec

Re: [Intel-gfx] [PATCH v9 08/14] swiotlb: Move alloc_size to find_slots

2021-06-13 Thread Christoph Hellwig
On Fri, Jun 11, 2021 at 11:26:53PM +0800, Claire Chang wrote: > Move the maintenance of alloc_size to find_slots for better code > reusability later. Looks good, Reviewed-by: Christoph Hellwig ___ Intel-gfx mailing list Intel-gfx@lists.freedeskt

Re: [Intel-gfx] [PATCH v9 09/14] swiotlb: Refactor swiotlb_tbl_unmap_single

2021-06-13 Thread Christoph Hellwig
TTR_SKIP_CPU_SYNC) && > + (dir == DMA_FROM_DEVICE || dir == DMA_BIDIRECTIONAL)) > + swiotlb_bounce(dev, tlb_addr, mapping_size, DMA_FROM_DEVICE); > + > + release_slots(dev, tlb_addr); Can you give this a swiotlb_ prefix? Otherwise looks good: Reviewed-by: Christoph Hellwig ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Re: [Intel-gfx] [PATCH v9 11/14] swiotlb: Add restricted DMA alloc/free support.

2021-06-13 Thread Christoph Hellwig
I think merging this with the next two patches would be a little more clear. ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Re: [Intel-gfx] [PATCH v9 11/14] swiotlb: Add restricted DMA alloc/free support.

2021-06-13 Thread Christoph Hellwig
On Mon, Jun 14, 2021 at 08:28:01AM +0200, Christoph Hellwig wrote: > I think merging this with the next two patches would be a little more > clear. Sorry, I mean the next patch and the previous one. ___ Intel-gfx mailing list Int

[Intel-gfx] Allow mdev drivers to directly create the vfio_device (v2 / alternative)

2021-06-14 Thread Christoph Hellwig
This is my alternative take on this series from Jason: https://lore.kernel.org/dri-devel/87czsszi9i@redhat.com/T/ The mdev/vfio parts are exactly the same, but this solves the driver core changes for the direct probing without the in/out flag that Greg hated, which cause a little more work, b

[Intel-gfx] [PATCH 01/10] driver core: Pull required checks into driver_probe_device()

2021-06-14 Thread Christoph Hellwig
callers to driver_probe_device() and will need these checks as well. Signed-off-by: Jason Gunthorpe [hch: drop the extra checks in device_driver_attach and bind_store] Signed-off-by: Christoph Hellwig --- drivers/base/bus.c | 2 +- drivers/base/dd.c | 32 ++-- 2 fi

[Intel-gfx] [PATCH 03/10] driver core: Flow the return code from ->probe() through to sysfs bind

2021-06-14 Thread Christoph Hellwig
e errors and returns all errors to the sysfs code. Signed-off-by: Christoph Hellwig --- drivers/base/bus.c | 6 +- drivers/base/dd.c | 29 - 2 files changed, 21 insertions(+), 14 deletions(-) diff --git a/drivers/base/bus.c b/drivers/base/bus.c index 7de1

[Intel-gfx] [PATCH 02/10] driver core: Better distinguish probe errors in really_probe

2021-06-14 Thread Christoph Hellwig
-by: Christoph Hellwig --- drivers/base/dd.c | 72 +++ 1 file changed, 41 insertions(+), 31 deletions(-) diff --git a/drivers/base/dd.c b/drivers/base/dd.c index 7477d3322b3a..999bc737a8f0 100644 --- a/drivers/base/dd.c +++ b/drivers/base/dd.c @@ -513

[Intel-gfx] [PATCH 04/10] driver core: Don't return EPROBE_DEFER to userspace during sysfs bind

2021-06-14 Thread Christoph Hellwig
_add where needed. This call is now a little later, which harmless, and the trigger reinjection check now also happens for the always_defer case, which is not required but otherwise harmless. Signed-off-by: Christoph Hellwig --- drivers/base/dd.c | 72 +

[Intel-gfx] [PATCH 05/10] driver core: Export device_driver_attach()

2021-06-14 Thread Christoph Hellwig
ind is synchronized with other logic. Call device_driver_attach() after device_add(). If probe() returns a failure then this will be preserved up through to the error return of device_driver_attach(). Signed-off-by: Jason Gunthorpe Signed-off-by: Christoph Hellwig --- drivers/base/base.h

[Intel-gfx] [PATCH 07/10] vfio/mdev: Allow the mdev_parent_ops to specify the device driver to bind

2021-06-14 Thread Christoph Hellwig
iver probe()/remove() - mdev_attr_groups becomes mdev_driver driver.dev_groups - Wrapper function callbacks are replaced with the same ones from struct vfio_device_ops Signed-off-by: Jason Gunthorpe Signed-off-by: Christoph Hellwig --- drivers/vfio/mdev/mdev_core.c | 30 ++---

[Intel-gfx] [PATCH 06/10] vfio/mdev: Remove CONFIG_VFIO_MDEV_DEVICE

2021-06-14 Thread Christoph Hellwig
Signed-off-by: Christoph Hellwig --- 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/vfio/mdev/mdev_core.c| 16

[Intel-gfx] [PATCH 08/10] vfio/mtty: Convert to use vfio_register_group_dev()

2021-06-14 Thread Christoph Hellwig
From: Jason Gunthorpe This is straightforward conversion, the mdev_state is actually serving as the vfio_device and we can replace all the mdev_get_drvdata()'s and the wonky dead code with a simple container_of() Reviewed-by: Christoph Hellwig Signed-off-by: Jason Gunthorpe Signed-o

[Intel-gfx] [PATCH 09/10] vfio/mdpy: Convert to use vfio_register_group_dev()

2021-06-14 Thread Christoph Hellwig
From: Jason Gunthorpe This is straightforward conversion, the mdev_state is actually serving as the vfio_device and we can replace all the mdev_get_drvdata()'s and the wonky dead code with a simple container_of(). Reviewed-by: Christoph Hellwig Signed-off-by: Jason Gunthorpe Signed-o

[Intel-gfx] [PATCH 10/10] vfio/mbochs: Convert to use vfio_register_group_dev()

2021-06-14 Thread Christoph Hellwig
From: Jason Gunthorpe This is straightforward conversion, the mdev_state is actually serving as the vfio_device and we can replace all the mdev_get_drvdata()'s and the wonky dead code with a simple container_of(). Reviewed-by: Christoph Hellwig Signed-off-by: Jason Gunthorpe Signed-o

Re: [Intel-gfx] [PATCH 02/10] driver core: Better distinguish probe errors in really_probe

2021-06-14 Thread Christoph Hellwig
On Tue, Jun 15, 2021 at 07:17:43AM +0200, Greg Kroah-Hartman wrote: > Like Kirti said, 0 needs to be handled here. Did this not spew a lot of > warnings in the logs? Trying again it did. But I didn't even notice given all the crap printed during a typical boot these days.. __

Re: [Intel-gfx] Allow mdev drivers to directly create the vfio_device (v2 / alternative)

2021-06-14 Thread Christoph Hellwig
On Tue, Jun 15, 2021 at 07:21:57AM +0200, Greg Kroah-Hartman wrote: > This looks much better as far as the driver core changes go, thank you > for doing this. > > I'm guessing there will be at least one more revision of this. Yes. > Do you > want this to go through my driver core tree or is ther

[Intel-gfx] Allow mdev drivers to directly create the vfio_device (v3)

2021-06-15 Thread Christoph Hellwig
This is my alternative take on this series from Jason: https://lore.kernel.org/dri-devel/87czsszi9i@redhat.com/T/ The mdev/vfio parts are exactly the same, but this solves the driver core changes for the direct probing without the in/out flag that Greg hated, which cause a little more work, b

[Intel-gfx] [PATCH 01/10] driver core: Pull required checks into driver_probe_device()

2021-06-15 Thread Christoph Hellwig
callers to driver_probe_device() and will need these checks as well. Signed-off-by: Jason Gunthorpe [hch: drop the extra checks in device_driver_attach and bind_store] Signed-off-by: Christoph Hellwig Reviewed-by: Greg Kroah-Hartman Reviewed-by: Cornelia Huck --- drivers/base/bus.c | 2 +- d

Re: [Intel-gfx] [PATCH v10 01/12] swiotlb: Refactor swiotlb init functions

2021-06-15 Thread Christoph Hellwig
On Tue, Jun 15, 2021 at 09:27:00PM +0800, Claire Chang wrote: > Add a new function, swiotlb_init_io_tlb_mem, for the io_tlb_mem struct > initialization to make the code reusable. Looks good, Reviewed-by: Christoph Hellwig ___ Intel-gfx mailin

Re: [Intel-gfx] [PATCH v10 02/12] swiotlb: Refactor swiotlb_create_debugfs

2021-06-15 Thread Christoph Hellwig
On Tue, Jun 15, 2021 at 09:27:01PM +0800, Claire Chang wrote: > Split the debugfs creation to make the code reusable for supporting > different bounce buffer pools. > > Signed-off-by: Claire Chang Looks good, Reviewed-by: Christoph Hellwig _

[Intel-gfx] [PATCH 02/10] driver core: Better distinguish probe errors in really_probe

2021-06-15 Thread Christoph Hellwig
-by: Christoph Hellwig --- drivers/base/dd.c | 72 +++ 1 file changed, 42 insertions(+), 30 deletions(-) diff --git a/drivers/base/dd.c b/drivers/base/dd.c index 7477d3322b3a..fd83817240e6 100644 --- a/drivers/base/dd.c +++ b/drivers/base/dd.c @@ -513

Re: [Intel-gfx] [PATCH v10 03/12] swiotlb: Set dev->dma_io_tlb_mem to the swiotlb pool used

2021-06-15 Thread Christoph Hellwig
Looks good, Reviewed-by: Christoph Hellwig ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx

[Intel-gfx] [PATCH 03/10] driver core: Flow the return code from ->probe() through to sysfs bind

2021-06-15 Thread Christoph Hellwig
e errors and returns all errors to the sysfs code. Signed-off-by: Christoph Hellwig Reviewed-by: Greg Kroah-Hartman Reviewed-by: Cornelia Huck --- drivers/base/bus.c | 6 +- drivers/base/dd.c | 29 - 2 files changed, 21 insertions(+), 14 deletions(-) diff

Re: [Intel-gfx] [PATCH v10 04/12] swiotlb: Update is_swiotlb_buffer to add a struct device argument

2021-06-15 Thread Christoph Hellwig
On Tue, Jun 15, 2021 at 09:27:03PM +0800, Claire Chang wrote: > Update is_swiotlb_buffer to add a struct device argument. This will be > useful later to allow for different pools. > > Signed-off-by: Claire Chang Looks good, Reviewed-by: Chris

Re: [Intel-gfx] [PATCH v10 05/12] swiotlb: Update is_swiotlb_active to add a struct device argument

2021-06-15 Thread Christoph Hellwig
On Tue, Jun 15, 2021 at 09:27:04PM +0800, Claire Chang wrote: > Update is_swiotlb_active to add a struct device argument. This will be > useful later to allow for different pools. > > Signed-off-by: Claire Chang Looks good, Reviewed-by: Chris

[Intel-gfx] [PATCH 04/10] driver core: Don't return EPROBE_DEFER to userspace during sysfs bind

2021-06-15 Thread Christoph Hellwig
_add where needed. This also allows to nicely split out the defer_all_probes / probe_count checks so that they actually allow for full device_{block,unblock}_probing protection while not bothering the sysfs bind case. Signed-off-by: Christoph Hellwig Reviewed-by: Greg Kroah-Hartman --- drivers/base

Re: [Intel-gfx] [PATCH v10 06/12] swiotlb: Use is_dev_swiotlb_force for swiotlb data bouncing

2021-06-15 Thread Christoph Hellwig
Chang Looks good, Reviewed-by: Christoph Hellwig ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Re: [Intel-gfx] [PATCH v10 07/12] swiotlb: Move alloc_size to swiotlb_find_slots

2021-06-15 Thread Christoph Hellwig
On Tue, Jun 15, 2021 at 09:27:06PM +0800, Claire Chang wrote: > Rename find_slots to swiotlb_find_slots and move the maintenance of > alloc_size to it for better code reusability later. > > Signed-off-by: Claire Chang Looks good, Reviewed-by: Chris

[Intel-gfx] [PATCH 05/10] driver core: Export device_driver_attach()

2021-06-15 Thread Christoph Hellwig
ind is synchronized with other logic. Call device_driver_attach() after device_add(). If probe() returns a failure then this will be preserved up through to the error return of device_driver_attach(). Signed-off-by: Jason Gunthorpe Signed-off-by: Christoph Hellwig Reviewed-by: Cornelia H

Re: [Intel-gfx] [PATCH v10 08/12] swiotlb: Refactor swiotlb_tbl_unmap_single

2021-06-15 Thread Christoph Hellwig
Looks good, Reviewed-by: Christoph Hellwig ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Re: [Intel-gfx] [PATCH v10 09/12] swiotlb: Add restricted DMA pool initialization

2021-06-15 Thread Christoph Hellwig
ed-off-by: Claire Chang Looks good, Reviewed-by: Christoph Hellwig ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx

[Intel-gfx] [PATCH 06/10] vfio/mdev: Remove CONFIG_VFIO_MDEV_DEVICE

2021-06-15 Thread Christoph Hellwig
Signed-off-by: Christoph Hellwig Reviewed-by: Cornelia Huck --- 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/vfio/mdev

[Intel-gfx] [PATCH 07/10] vfio/mdev: Allow the mdev_parent_ops to specify the device driver to bind

2021-06-15 Thread Christoph Hellwig
iver probe()/remove() - mdev_attr_groups becomes mdev_driver driver.dev_groups - Wrapper function callbacks are replaced with the same ones from struct vfio_device_ops Signed-off-by: Jason Gunthorpe Signed-off-by: Christoph Hellwig --- drivers/vfio/mdev/mdev_core.c | 30 ++---

Re: [Intel-gfx] [PATCH v10 10/12] swiotlb: Add restricted DMA alloc/free support

2021-06-15 Thread Christoph Hellwig
* coherent allocation. Otherwise might break existing devices. > + * One must set up another device coherent pool by shared-dma-pool and > + * use dma_alloc_from_dev_coherent instead for atomic coherent > + * allocation to avoid mempry remapping. s

[Intel-gfx] [PATCH 08/10] vfio/mtty: Convert to use vfio_register_group_dev()

2021-06-15 Thread Christoph Hellwig
From: Jason Gunthorpe This is straightforward conversion, the mdev_state is actually serving as the vfio_device and we can replace all the mdev_get_drvdata()'s and the wonky dead code with a simple container_of() Reviewed-by: Christoph Hellwig Signed-off-by: Jason Gunthorpe Signed-o

[Intel-gfx] [PATCH 09/10] vfio/mdpy: Convert to use vfio_register_group_dev()

2021-06-15 Thread Christoph Hellwig
From: Jason Gunthorpe This is straightforward conversion, the mdev_state is actually serving as the vfio_device and we can replace all the mdev_get_drvdata()'s and the wonky dead code with a simple container_of(). Reviewed-by: Christoph Hellwig Signed-off-by: Jason Gunthorpe Signed-o

[Intel-gfx] [PATCH 10/10] vfio/mbochs: Convert to use vfio_register_group_dev()

2021-06-15 Thread Christoph Hellwig
From: Jason Gunthorpe This is straightforward conversion, the mdev_state is actually serving as the vfio_device and we can replace all the mdev_get_drvdata()'s and the wonky dead code with a simple container_of(). Reviewed-by: Christoph Hellwig Signed-off-by: Jason Gunthorpe Signed-o

Re: [Intel-gfx] Allow mdev drivers to directly create the vfio_device (v3)

2021-06-15 Thread Christoph Hellwig
On Tue, Jun 15, 2021 at 05:35:15PM -0300, Jason Gunthorpe wrote: > Yes, the rest of the drivers will get converted eventually too. There > is no reason to hold things back. Depending on timelines we might be > able to get AP into this cycle too... And I have a WIP tree to get rid of the weird indi

Re: [Intel-gfx] [PATCH v11 09/12] swiotlb: Add restricted DMA alloc/free support

2021-06-15 Thread Christoph Hellwig
On Wed, Jun 16, 2021 at 12:04:16PM +0800, Claire Chang wrote: > Just noticed that after propagating swiotlb_force setting into > io_tlb_default_mem->force, the memory allocation behavior for > swiotlb_force will change (i.e. always skipping arch_dma_alloc and > dma_direct_alloc_from_pool). Yes, I

Re: [Intel-gfx] [PATCH v11 09/12] swiotlb: Add restricted DMA alloc/free support

2021-06-15 Thread Christoph Hellwig
On Wed, Jun 16, 2021 at 01:10:02PM +0800, Claire Chang wrote: > On Wed, Jun 16, 2021 at 12:59 PM Christoph Hellwig wrote: > > > > On Wed, Jun 16, 2021 at 12:04:16PM +0800, Claire Chang wrote: > > > Just noticed that after propagating swiotlb_force setting into > > &g

Re: [Intel-gfx] [PATCH v12 06/12] swiotlb: Use is_swiotlb_force_bounce for swiotlb data bouncing

2021-06-16 Thread Christoph Hellwig
Chang Looks good, Reviewed-by: Christoph Hellwig ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Re: [Intel-gfx] [PATCH v12 09/12] swiotlb: Add restricted DMA alloc/free support

2021-06-16 Thread Christoph Hellwig
t allocation needs remapping, one must set up > another device coherent pool by shared-dma-pool and use > dma_alloc_from_dev_coherent instead for atomic coherent allocation. > > Signed-off-by: Claire Chang Looks good, Reviewed-by: Christoph Hellwig

[Intel-gfx] Allow mdev drivers to directly create the vfio_device (v4)

2021-06-17 Thread Christoph Hellwig
This is my alternative take on this series from Jason: https://lore.kernel.org/dri-devel/87czsszi9i@redhat.com/T/ The mdev/vfio parts are exactly the same, but this solves the driver core changes for the direct probing without the in/out flag that Greg hated, which cause a little more work, b

[Intel-gfx] [PATCH 01/10] driver core: Pull required checks into driver_probe_device()

2021-06-17 Thread Christoph Hellwig
callers to driver_probe_device() and will need these checks as well. Signed-off-by: Jason Gunthorpe [hch: drop the extra checks in device_driver_attach and bind_store] Signed-off-by: Christoph Hellwig Reviewed-by: Greg Kroah-Hartman Reviewed-by: Cornelia Huck --- drivers/base/bus.c | 2 +- d

[Intel-gfx] [PATCH 02/10] driver core: Better distinguish probe errors in really_probe

2021-06-17 Thread Christoph Hellwig
-by: Christoph Hellwig Reviewed-by: Cornelia Huck Reviewed-by: Greg Kroah-Hartman Reviewed-by: Kirti Wankhede --- drivers/base/dd.c | 72 +++ 1 file changed, 42 insertions(+), 30 deletions(-) diff --git a/drivers/base/dd.c b/drivers/base/dd.c in

[Intel-gfx] [PATCH 03/10] driver core: Flow the return code from ->probe() through to sysfs bind

2021-06-17 Thread Christoph Hellwig
e errors and returns all errors to the sysfs code. Signed-off-by: Christoph Hellwig Reviewed-by: Greg Kroah-Hartman Reviewed-by: Cornelia Huck --- drivers/base/bus.c | 6 +- drivers/base/dd.c | 29 - 2 files changed, 21 insertions(+), 14 deletions(-) diff

[Intel-gfx] [PATCH 04/10] driver core: Don't return EPROBE_DEFER to userspace during sysfs bind

2021-06-17 Thread Christoph Hellwig
_add where needed. This also allows to nicely split out the defer_all_probes / probe_count checks so that they actually allow for full device_{block,unblock}_probing protection while not bothering the sysfs bind case. Signed-off-by: Christoph Hellwig Reviewed-by: Cornelia Huck Reviewed-by: Greg Kro

[Intel-gfx] [PATCH 05/10] driver core: Export device_driver_attach()

2021-06-17 Thread Christoph Hellwig
ind is synchronized with other logic. Call device_driver_attach() after device_add(). If probe() returns a failure then this will be preserved up through to the error return of device_driver_attach(). Signed-off-by: Jason Gunthorpe Signed-off-by: Christoph Hellwig Reviewed-by: Cornelia Huck Revie

[Intel-gfx] [PATCH 06/10] vfio/mdev: Remove CONFIG_VFIO_MDEV_DEVICE

2021-06-17 Thread Christoph Hellwig
Signed-off-by: Christoph Hellwig Reviewed-by: Cornelia Huck Reviewed-by: Greg Kroah-Hartman Reviewed-by: Kirti Wankhede --- Documentation/s390/vfio-ap.rst | 1 - arch/s390/Kconfig| 2 +- drivers/gpu/drm/i915/Kconfig | 2 +- drivers/vfio/mdev/Kconfig| 7

[Intel-gfx] [PATCH 07/10] vfio/mdev: Allow the mdev_parent_ops to specify the device driver to bind

2021-06-17 Thread Christoph Hellwig
iver probe()/remove() - mdev_attr_groups becomes mdev_driver driver.dev_groups - Wrapper function callbacks are replaced with the same ones from struct vfio_device_ops Signed-off-by: Jason Gunthorpe Signed-off-by: Christoph Hellwig Reviewed-by: Cornelia Huck Reviewed-by: Greg Kroah-Hartman Reviewed

[Intel-gfx] [PATCH 08/10] vfio/mtty: Convert to use vfio_register_group_dev()

2021-06-17 Thread Christoph Hellwig
From: Jason Gunthorpe This is straightforward conversion, the mdev_state is actually serving as the vfio_device and we can replace all the mdev_get_drvdata()'s and the wonky dead code with a simple container_of() Reviewed-by: Christoph Hellwig Signed-off-by: Jason Gunthorpe Signed-o

[Intel-gfx] [PATCH 09/10] vfio/mdpy: Convert to use vfio_register_group_dev()

2021-06-17 Thread Christoph Hellwig
From: Jason Gunthorpe This is straightforward conversion, the mdev_state is actually serving as the vfio_device and we can replace all the mdev_get_drvdata()'s and the wonky dead code with a simple container_of(). Reviewed-by: Christoph Hellwig Signed-off-by: Jason Gunthorpe Signed-o

[Intel-gfx] [PATCH 10/10] vfio/mbochs: Convert to use vfio_register_group_dev()

2021-06-17 Thread Christoph Hellwig
From: Jason Gunthorpe This is straightforward conversion, the mdev_state is actually serving as the vfio_device and we can replace all the mdev_get_drvdata()'s and the wonky dead code with a simple container_of(). Reviewed-by: Christoph Hellwig Signed-off-by: Jason Gunthorpe Signed-o

Re: [Intel-gfx] [PATCH v13 01/12] swiotlb: Refactor swiotlb init functions

2021-06-18 Thread Christoph Hellwig
On Fri, Jun 18, 2021 at 09:09:17AM -0500, Tom Lendacky wrote: > > swiotlb_init_with_tbl uses memblock_alloc to allocate the io_tlb_mem > > and memblock_alloc[1] will do memset in memblock_alloc_try_nid[2], so > > swiotlb_init_with_tbl is also good. > > I'm happy to add the memset in swiotlb_init_io

Re: [Intel-gfx] [PATCH 2/4] mm: add a io_mapping_map_user helper

2021-10-20 Thread Christoph Hellwig
On Wed, Oct 20, 2021 at 09:37:51PM +0200, Peter Zijlstra wrote: > > I'm not sure what exactly brought me to check this, but while debugging > > I noticed this outside the header guard. But then after some more checks I > > saw nothing actually selects CONFIG_IO_MAPPING because commit using > > it w

[Intel-gfx] refactor the i915 GVT support and move to the modern mdev API v2

2021-11-02 Thread Christoph Hellwig
Hi all, the GVT code in the i915 is a bit of a mess right now due to strange abstractions and lots of indirect calls. This series refactors various bits to clean that up. The main user visible change is that almost all of the GVT code moves out of the main i915 driver and into the kvmgt module.

[Intel-gfx] [PATCH 01/29] drm/i915/gvt: undef TRACE_INCLUDE_FILE in i915_trace.h

2021-11-02 Thread Christoph Hellwig
From: Zhenyu Wang Allow for including multiple trace headers. XXX: Needs a singoff. --- drivers/gpu/drm/i915/i915_trace.h | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/i915/i915_trace.h b/drivers/gpu/drm/i915/i915_trace.h index 63fec1c3c132d..a35a8b46ac2ce 100644 --- a/dr

[Intel-gfx] [PATCH 02/29] drm/i915/gvt: integrate into the main Makefile

2021-11-02 Thread Christoph Hellwig
Remove the separately included Makefile and just use the relative reference from the main i915 Makefile as for source files in other subdirectories. Signed-off-by: Christoph Hellwig --- drivers/gpu/drm/i915/Makefile | 29 - drivers/gpu/drm/i915/gvt/Makefile | 9

[Intel-gfx] [PATCH 03/29] drm/i915/gvt: remove module refcounting in intel_gvt_{, un}register_hypervisor

2021-11-02 Thread Christoph Hellwig
THIS_MODULE always is reference when a symbol called by it is used, so don't bother with the additional reference. Signed-off-by: Christoph Hellwig --- drivers/gpu/drm/i915/gvt/gvt.c | 6 -- 1 file changed, 6 deletions(-) diff --git a/drivers/gpu/drm/i915/gvt/gvt.c b/drivers/gpu/drm

[Intel-gfx] [PATCH 04/29] drm/i915/gvt: remove enum hypervisor_type

2021-11-02 Thread Christoph Hellwig
The only supported hypervisor is KVM, so don't bother with dead code enumerating hypervisors. Signed-off-by: Christoph Hellwig --- drivers/gpu/drm/i915/gvt/gvt.c | 17 +-- drivers/gpu/drm/i915/gvt/gvt.h | 1 - drivers/gpu/drm/i915/gvt/hypercall.h | 6 -- drivers/gpu/drm

[Intel-gfx] [PATCH 05/29] drm/i915/gvt: rename intel_vgpu_ops to intel_vgpu_mdev_ops

2021-11-02 Thread Christoph Hellwig
Free the intel_vgpu_ops symbol name for something that fits better. Signed-off-by: Christoph Hellwig --- drivers/gpu/drm/i915/gvt/kvmgt.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/i915/gvt/kvmgt.c b/drivers/gpu/drm/i915/gvt/kvmgt.c index

[Intel-gfx] [PATCH 06/29] drm/i915/gvt: move the gvt code into kvmgt.ko

2021-11-02 Thread Christoph Hellwig
device pointer. Signed-off-by: Christoph Hellwig --- drivers/gpu/drm/i915/Kconfig | 33 +++ drivers/gpu/drm/i915/Makefile| 7 +- drivers/gpu/drm/i915/gvt/gvt.c | 55 --- drivers/gpu/drm/i915/gvt/gvt.h | 6 +- drivers/gpu/drm/i915/gvt/kvmgt.c | 13 ++- drivers/gpu/drm

[Intel-gfx] [PATCH 07/29] drm/i915/gvt: remove intel_gvt_ops

2021-11-02 Thread Christoph Hellwig
Remove these pointless indirect alls by just calling the only instance of each method directly. Signed-off-by: Christoph Hellwig --- drivers/gpu/drm/i915/gvt/gvt.c | 20 +-- drivers/gpu/drm/i915/gvt/gvt.h | 24 -- drivers/gpu/drm/i915/gvt/hypercall.h | 2

[Intel-gfx] [PATCH 08/29] drm/i915/gvt: remove the map_gfn_to_mfn and set_trap_area ops

2021-11-02 Thread Christoph Hellwig
The map_gfn_to_mfn and set_trap_area ops are never defined, so remove them and clean up code that depends on them in the callers. Signed-off-by: Christoph Hellwig --- drivers/gpu/drm/i915/gvt/cfg_space.c | 89 ++-- drivers/gpu/drm/i915/gvt/hypercall.h | 4 -- drivers

[Intel-gfx] [PATCH 09/29] drm/i915/gvt: remove the unused from_virt_to_mfn op

2021-11-02 Thread Christoph Hellwig
Signed-off-by: Christoph Hellwig --- drivers/gpu/drm/i915/gvt/hypercall.h | 1 - drivers/gpu/drm/i915/gvt/kvmgt.c | 6 -- drivers/gpu/drm/i915/gvt/mpt.h | 12 3 files changed, 19 deletions(-) diff --git a/drivers/gpu/drm/i915/gvt/hypercall.h b/drivers/gpu/drm/i915

[Intel-gfx] [PATCH 10/29] drm/i915/gvt: merge struct kvmgt_vdev into struct intel_vgpu

2021-11-02 Thread Christoph Hellwig
Move towards having only a single structure for the per-VGPU state. Signed-off-by: Christoph Hellwig --- drivers/gpu/drm/i915/gvt/gvt.h | 31 ++- drivers/gpu/drm/i915/gvt/hypercall.h | 1 - drivers/gpu/drm/i915/gvt/kvmgt.c | 288 ++- drivers/gpu/drm/i915/gvt

Re: [Intel-gfx] refactor the i915 GVT support

2021-09-29 Thread Christoph Hellwig
On Wed, Sep 29, 2021 at 06:27:16PM +, Wang, Zhi A wrote: > Thanks for the idea. I am not sure i915 guys would take this idea since > that it's only for GVT-g, i915 doesn't use this at all. We need to take > a snapshot of both PCI configuration space and MMIO registers before > i915 driver st

[Intel-gfx] 5.14-rc2 warnings with kvmgvt

2021-07-21 Thread Christoph Hellwig
Hi all, I'm trying to test some changes for the gvt code, but even with a baseline 5.14-rc2 host and guest the 915 driver does not seem overly happy: [5.693099] i915 :00:04.0: [drm] Virtual GPU for Intel GVT-g detected. [5.694841] i915 :00:04.0: [drm] VT-d active for gfx access [

Re: [Intel-gfx] 5.14-rc2 warnings with kvmgvt

2021-07-21 Thread Christoph Hellwig
On Wed, Jul 21, 2021 at 07:24:47AM -0400, Rodrigo Vivi wrote: > On Wed, Jul 21, 2021 at 01:10:49PM +0200, Christoph Hellwig wrote: > > Hi all, > > > > I'm trying to test some changes for the gvt code, but even with a baseline > > 5.14-rc2 host and guest the 915 d

[Intel-gfx] refactor the i915 GVT support

2021-07-21 Thread Christoph Hellwig
Hi all, the GVT code in the i915 is a bit of a mess right now due to strange abstractions and lots of indirect calls. This series refactors various bits to clean that up. The main user visible change is that almost all of the GVT code moves out of the main i915 driver and into the kvmgt module.

[Intel-gfx] [PATCH 01/21] drm/i915/gvt: integrate into the main Makefile

2021-07-21 Thread Christoph Hellwig
Remove the separately included Makefile and just use the relative reference from the main i915 Makefile as for source files in other subdirectories. Signed-off-by: Christoph Hellwig --- drivers/gpu/drm/i915/Makefile | 29 - drivers/gpu/drm/i915/gvt/Makefile | 9

[Intel-gfx] [PATCH 02/21] drm/i915/gvt: remove module refcounting in intel_gvt_{, un}register_hypervisor

2021-07-21 Thread Christoph Hellwig
THIS_MODULE always is reference when a symbol called by it is used, so don't bother with the additional reference. Signed-off-by: Christoph Hellwig --- drivers/gpu/drm/i915/gvt/gvt.c | 6 -- 1 file changed, 6 deletions(-) diff --git a/drivers/gpu/drm/i915/gvt/gvt.c b/drivers/gpu/drm

[Intel-gfx] [PATCH 03/21] drm/i915/gvt: remove enum hypervisor_type

2021-07-21 Thread Christoph Hellwig
The only supported hypervisor is KVM, so don't bother with dead code enumerating hypervisors. Signed-off-by: Christoph Hellwig --- drivers/gpu/drm/i915/gvt/gvt.c | 17 +-- drivers/gpu/drm/i915/gvt/gvt.h | 1 - drivers/gpu/drm/i915/gvt/hypercall.h | 6 -- drivers/gpu/drm

[Intel-gfx] [PATCH 04/21] drm/i915/gvt: move the gvt code into kvmgt.ko

2021-07-21 Thread Christoph Hellwig
GVT initialization and avoids the need for the global device pointer. Signed-off-by: Christoph Hellwig --- drivers/gpu/drm/i915/Kconfig | 31 +++-- drivers/gpu/drm/i915/Makefile | 7 +- .../drm/i915/gt/intel_execlists_submission.c | 4 +- drivers/gpu/drm/i915

[Intel-gfx] [PATCH 05/21] drm/i915/gvt: remove intel_gvt_ops

2021-07-21 Thread Christoph Hellwig
Remove these pointless indirect alls by just calling the only instance of each method directly. Signed-off-by: Christoph Hellwig --- drivers/gpu/drm/i915/gvt/gvt.c | 20 +-- drivers/gpu/drm/i915/gvt/gvt.h | 24 -- drivers/gpu/drm/i915/gvt/hypercall.h | 2

[Intel-gfx] [PATCH 06/21] drm/i915/gvt: remove the map_gfn_to_mfn and set_trap_area ops

2021-07-21 Thread Christoph Hellwig
The map_gfn_to_mfn and set_trap_area ops are never defined, so remove them and clean up code that depends on them in the callers. Signed-off-by: Christoph Hellwig --- drivers/gpu/drm/i915/gvt/cfg_space.c | 89 ++-- drivers/gpu/drm/i915/gvt/hypercall.h | 4 -- drivers

[Intel-gfx] [PATCH 07/21] drm/i915/gvt: remove the unused from_virt_to_mfn op

2021-07-21 Thread Christoph Hellwig
Signed-off-by: Christoph Hellwig --- drivers/gpu/drm/i915/gvt/hypercall.h | 1 - drivers/gpu/drm/i915/gvt/kvmgt.c | 6 -- drivers/gpu/drm/i915/gvt/mpt.h | 12 3 files changed, 19 deletions(-) diff --git a/drivers/gpu/drm/i915/gvt/hypercall.h b/drivers/gpu/drm/i915

[Intel-gfx] [PATCH 08/21] drm/i915/gvt: merge struct kvmgt_vdev into struct intel_vgpu

2021-07-21 Thread Christoph Hellwig
Move towards having only a single structure for the per-VGPU state. Signed-off-by: Christoph Hellwig --- drivers/gpu/drm/i915/gvt/gvt.h | 31 ++- drivers/gpu/drm/i915/gvt/hypercall.h | 1 - drivers/gpu/drm/i915/gvt/kvmgt.c | 288 ++- drivers/gpu/drm/i915/gvt

[Intel-gfx] [PATCH 09/21] drm/i915/gvt: merge struct kvmgt_guest_info into strut intel_vgpu

2021-07-21 Thread Christoph Hellwig
Consolidate the per-VGPU structures into a single one. Signed-off-by: Christoph Hellwig --- drivers/gpu/drm/i915/gvt/gvt.h | 8 +++ drivers/gpu/drm/i915/gvt/kvmgt.c | 117 --- 2 files changed, 52 insertions(+), 73 deletions(-) diff --git a/drivers/gpu/drm/i915

[Intel-gfx] [PATCH 10/21] drm/i915/gvt: remove vgpu->handle

2021-07-21 Thread Christoph Hellwig
Always pass the actual vgpu structure instead of encoding it as a "handle" and add a bool flag to denote if a VGPU is attached. Signed-off-by: Christoph Hellwig --- drivers/gpu/drm/i915/gvt/gvt.h | 3 +- drivers/gpu/drm/i915/gvt/hypercall.h | 32 +++ drivers/gpu/dr

[Intel-gfx] [PATCH 11/21] drm/i915/gvt: devirtualize ->{read, write}_gpa

2021-07-21 Thread Christoph Hellwig
Just call the VFIO functions directly instead of through the method table. Signed-off-by: Christoph Hellwig --- drivers/gpu/drm/i915/gvt/cmd_parser.c | 4 +-- drivers/gpu/drm/i915/gvt/execlist.c | 12 - drivers/gpu/drm/i915/gvt/gtt.c| 6 ++--- drivers/gpu/drm/i915/gvt/gvt.h

[Intel-gfx] [PATCH 12/21] drm/i915/gvt: devirtualize ->{get, put}_vfio_device

2021-07-21 Thread Christoph Hellwig
Just open code the calls to the VFIO APIs. Signed-off-by: Christoph Hellwig --- drivers/gpu/drm/i915/gvt/dmabuf.c| 12 ++- drivers/gpu/drm/i915/gvt/hypercall.h | 2 -- drivers/gpu/drm/i915/gvt/kvmgt.c | 22 drivers/gpu/drm/i915/gvt/mpt.h | 30

[Intel-gfx] [PATCH 13/21] drm/i915/gvt: devirtualize ->set_edid and ->set_opregion

2021-07-21 Thread Christoph Hellwig
Just call the code to setup the opregions and EDID data directly. Signed-off-by: Christoph Hellwig --- drivers/gpu/drm/i915/gvt/gvt.h | 3 +++ drivers/gpu/drm/i915/gvt/hypercall.h | 3 --- drivers/gpu/drm/i915/gvt/kvmgt.c | 6 ++ drivers/gpu/drm/i915/gvt/mpt.h | 32

[Intel-gfx] [PATCH 14/21] drm/i915/gvt: devirtualize ->detach_vgpu

2021-07-21 Thread Christoph Hellwig
Just call the function directly. Signed-off-by: Christoph Hellwig --- drivers/gpu/drm/i915/gvt/gvt.h | 1 + drivers/gpu/drm/i915/gvt/hypercall.h | 1 - drivers/gpu/drm/i915/gvt/kvmgt.c | 3 +-- drivers/gpu/drm/i915/gvt/mpt.h | 16 drivers/gpu/drm/i915/gvt

[Intel-gfx] [PATCH 15/21] drm/i915/gvt: devirtualize ->inject_msi

2021-07-21 Thread Christoph Hellwig
Just open code the MSI injection in a single place instead of going through the method table. Signed-off-by: Christoph Hellwig --- drivers/gpu/drm/i915/gvt/hypercall.h | 1 - drivers/gpu/drm/i915/gvt/interrupt.c | 38 +++- drivers/gpu/drm/i915/gvt/kvmgt.c | 24

[Intel-gfx] [PATCH 16/21] drm/i915/gvt: devirtualize ->is_valid_gfn

2021-07-21 Thread Christoph Hellwig
Just call the code directly and move towards the callers. Signed-off-by: Christoph Hellwig --- drivers/gpu/drm/i915/gvt/gtt.c | 20 ++-- drivers/gpu/drm/i915/gvt/hypercall.h | 1 - drivers/gpu/drm/i915/gvt/kvmgt.c | 17 - drivers/gpu/drm/i915/gvt/mpt.h

[Intel-gfx] [PATCH 17/21] drm/i915/gvt: devirtualize ->gfn_to_mfn

2021-07-21 Thread Christoph Hellwig
Just open code it in the only caller. Signed-off-by: Christoph Hellwig --- drivers/gpu/drm/i915/gvt/gtt.c | 9 + drivers/gpu/drm/i915/gvt/hypercall.h | 1 - drivers/gpu/drm/i915/gvt/kvmgt.c | 16 drivers/gpu/drm/i915/gvt/mpt.h | 14 -- 4

[Intel-gfx] [PATCH 18/21] drm/i915/gvt: devirtualize ->{enable, disable}_page_track

2021-07-21 Thread Christoph Hellwig
Just call the kvmgt functions directly. Signed-off-by: Christoph Hellwig --- drivers/gpu/drm/i915/gvt/gvt.h| 3 +++ drivers/gpu/drm/i915/gvt/hypercall.h | 2 -- drivers/gpu/drm/i915/gvt/kvmgt.c | 6 ++ drivers/gpu/drm/i915/gvt/mpt.h| 28

[Intel-gfx] [PATCH 19/21] drm/i915/gvt: devirtualize ->dma_{, un}map_guest_page

2021-07-21 Thread Christoph Hellwig
Just call the functions directly. Also remove a pointless wrapper. Signed-off-by: Christoph Hellwig --- drivers/gpu/drm/i915/gvt/dmabuf.c| 10 ++ drivers/gpu/drm/i915/gvt/gtt.c | 20 +-- drivers/gpu/drm/i915/gvt/gvt.h | 4 drivers/gpu/drm/i915/gvt

[Intel-gfx] [PATCH 20/21] drm/i915/gvt: devirtualize dma_pin_guest_page

2021-07-21 Thread Christoph Hellwig
Just call the function directly and remove a pointless wrapper. Signed-off-by: Christoph Hellwig --- drivers/gpu/drm/i915/gvt/dmabuf.c| 14 +- drivers/gpu/drm/i915/gvt/gvt.h | 1 + drivers/gpu/drm/i915/gvt/hypercall.h | 2 -- drivers/gpu/drm/i915/gvt/kvmgt.c | 4

  1   2   3   4   5   6   >