Re: [PATCH v2 00/11] Connect VFIO to IOMMUFD

2022-11-08 Thread Nicolin Chen
On Mon, Nov 07, 2022 at 08:52:44PM -0400, Jason Gunthorpe wrote: > This is on github: https://github.com/jgunthorpe/linux/commits/vfio_iommufd [...] > v2: > - Rebase to v6.1-rc3, v4 iommufd series > - Fixup comments and commit messages from list remarks > - Fix leaking of the iommufd for mdevs

Re: [PATCH v2 07/11] vfio-iommufd: Support iommufd for physical VFIO devices

2022-11-07 Thread Nicolin Chen
On Mon, Nov 07, 2022 at 08:52:51PM -0400, Jason Gunthorpe wrote: > @@ -795,6 +800,10 @@ static int vfio_device_first_open(struct vfio_device > *device) > ret = vfio_group_use_container(device->group); > if (ret) > goto err_module_put; > + }

Re: [PATCH 06/10] vfio-iommufd: Allow iommufd to be used in place of a container fd

2022-11-01 Thread Nicolin Chen
On Tue, Nov 01, 2022 at 08:09:52AM +, Tian, Kevin wrote: > > From: Jason Gunthorpe > > Sent: Wednesday, October 26, 2022 2:51 AM > > > > menuconfig VFIO > > tristate "VFIO Non-Privileged userspace driver framework" > > select IOMMU_API > > + depends on IOMMUFD || !IOMMUFD >

Re: [PATCH 00/10] Connect VFIO to IOMMUFD

2022-10-31 Thread Nicolin Chen
On Tue, Nov 01, 2022 at 11:04:38AM +0800, Yi Liu wrote: > On 2022/11/1 07:24, Jason Gunthorpe wrote: > > On Mon, Oct 31, 2022 at 08:25:39PM +0800, Yi Liu wrote: > > > > There is something wrong with the test suite that it isn't covering > > > > the above, I'm going to look into that today. > > >

Re: [PATCH 00/10] Connect VFIO to IOMMUFD

2022-10-28 Thread Nicolin Chen
On Fri, Oct 28, 2022 at 04:53:21PM -0700, Nicolin Chen wrote: > On Tue, Oct 25, 2022 at 03:17:06PM -0300, Jason Gunthorpe wrote: > > This series provides an alternative container layer for VFIO implemented > > using iommufd. This is optional, if CONFIG_IOM

Re: [PATCH 00/10] Connect VFIO to IOMMUFD

2022-10-28 Thread Nicolin Chen
r the Intel GVT mdev. Aside from > the temporary limitation with P2P memory this is belived to be fully > compatible with VFIO. > > This is on github: https://github.com/jgunthorpe/linux/commits/vfio_iommufd Tested-by: Nicolin Chen Tested this branch on ARM64+SMMUv3 with the iommufd s

Re: [PATCH v3 00/10] Update vfio_pin/unpin_pages API

2022-07-22 Thread Nicolin Chen
On Fri, Jul 22, 2022 at 07:09:01PM -0600, Alex Williamson wrote: > > So, I think that I should send a v4, given that the patches aren't > > officially applied? > > Yep, please rebase on current vfio next branch. Thanks, Sent. And they are on Github, basing on linux-vfio next too:

[PATCH v4 06/10] vfio/ap: Change saved_pfn to saved_iova

2022-07-22 Thread Nicolin Chen
Reviewed-by: Jason Gunthorpe Reviewed-by: Tony Krowiak Tested-by: Eric Farman Signed-off-by: Nicolin Chen --- drivers/s390/crypto/vfio_ap_ops.c | 42 +++ drivers/s390/crypto/vfio_ap_private.h | 4 +-- 2 files changed, 19 insertions(+), 27 deletions(-) diff --git a/dri

[PATCH v4 09/10] vfio/ccw: Add kmap_local_page() for memcpy

2022-07-22 Thread Nicolin Chen
nthorpe Acked-by: Eric Farman Tested-by: Eric Farman Signed-off-by: Nicolin Chen --- drivers/s390/cio/vfio_ccw_cp.c | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/s390/cio/vfio_ccw_cp.c b/drivers/s390/cio/vfio_ccw_cp.c index 3854c3d573f5..cd4ec4f6d6ff

[PATCH v4 05/10] vfio: Pass in starting IOVA to vfio_pin/unpin_pages API

2022-07-22 Thread Nicolin Chen
ric Farman Signed-off-by: Nicolin Chen --- .../driver-api/vfio-mediated-device.rst | 4 +-- drivers/gpu/drm/i915/gvt/kvmgt.c | 18 + drivers/s390/cio/vfio_ccw_cp.c| 4 +-- drivers/s390/crypto/vfio_ap_ops.c | 9 +++ drivers/v

[PATCH v4 10/10] vfio: Replace phys_pfn with pages for vfio_pin_pages()

2022-07-22 Thread Nicolin Chen
mmu_type1 to fit this new parameter too. Reviewed-by: Christoph Hellwig Reviewed-by: Kirti Wankhede Reviewed-by: Jason Gunthorpe Reviewed-by: Kevin Tian Acked-by: Eric Farman Tested-by: Terrence Xu Tested-by: Eric Farman Signed-off-by: Nicolin Chen --- .../driver-api/vfio-mediated-device.r

[PATCH v4 08/10] vfio: Rename user_iova of vfio_dma_rw()

2022-07-22 Thread Nicolin Chen
Following the updated vfio_pin/unpin_pages(), use the simpler "iova". Reviewed-by: Christoph Hellwig Reviewed-by: Jason Gunthorpe Reviewed-by: Kevin Tian Tested-by: Terrence Xu Tested-by: Eric Farman Signed-off-by: Nicolin Chen --- drivers/vfio/vfio.c | 6 +++--- include/linux/

[PATCH v4 07/10] vfio/ccw: Change pa_pfn list to pa_iova list

2022-07-22 Thread Nicolin Chen
the code. Reviewed-by: Jason Gunthorpe Reviewed-by: Eric Farman Tested-by: Eric Farman Signed-off-by: Nicolin Chen --- drivers/s390/cio/vfio_ccw_cp.c | 135 - 1 file changed, 64 insertions(+), 71 deletions(-) diff --git a/drivers/s390/cio/vfio_ccw_cp.c b/driver

[PATCH v4 04/10] vfio/ccw: Only pass in contiguous pages

2022-07-22 Thread Nicolin Chen
only, to have an efficient implementation in VFIO. Reviewed-by: Jason Gunthorpe Reviewed-by: Eric Farman Tested-by: Eric Farman Signed-off-by: Nicolin Chen --- drivers/s390/cio/vfio_ccw_cp.c | 70 +++--- 1 file changed, 56 insertions(+), 14 deletions(-) diff --git

[PATCH v4 01/10] vfio: Make vfio_unpin_pages() return void

2022-07-22 Thread Nicolin Chen
in the vfio core, thus drop the same check in the type1 code. Suggested-by: Christoph Hellwig Reviewed-by: Christoph Hellwig Reviewed-by: Jason Gunthorpe Reviewed-by: Kirti Wankhede Tested-by: Terrence Xu Signed-off-by: Nicolin Chen --- .../driver-api/vfio-mediated-device.rst | 2 +-

[PATCH v4 03/10] vfio/ap: Pass in physical address of ind to ap_aqic()

2022-07-22 Thread Nicolin Chen
ind" to "pa_ind". Reviewed-by: Harald Freudenberger Reviewed-by: Jason Gunthorpe Tested-by: Eric Farman Signed-off-by: Nicolin Chen --- arch/s390/include/asm/ap.h| 6 +++--- drivers/s390/crypto/ap_queue.c| 2 +- drivers/s390/crypto/vfio_ap_ops.c | 7 --- 3 fil

[PATCH v4 02/10] drm/i915/gvt: Replace roundup with DIV_ROUND_UP

2022-07-22 Thread Nicolin Chen
It's a bit redundant for the maths here using roundup. Suggested-by: Jason Gunthorpe Tested-by: Terrence Xu Signed-off-by: Nicolin Chen --- drivers/gpu/drm/i915/gvt/kvmgt.c | 7 ++- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/i915/gvt/kvmgt.c b/drivers

[PATCH v4 00/10] cover-letter: Update vfio_pin/unpin_pages API

2022-07-22 Thread Nicolin Chen
for vfio_pin_pages * Updated commit log of kmap_local_page() patch * Added Harald's "Reviewed-by" to pa_ind patch * Rebased on top of Alex's extern removal path v1: https://lore.kernel.org/kvm/20220616235212.15185-1-nicol...@nvidia.com/ Nicolin Chen (10): vfio: Make vfio_unpin

Re: [PATCH v3 00/10] Update vfio_pin/unpin_pages API

2022-07-22 Thread Nicolin Chen
On Fri, Jul 22, 2022 at 06:18:00PM -0600, Alex Williamson wrote: > External email: Use caution opening links or attachments > > > On Fri, 22 Jul 2022 16:12:19 -0700 > Nicolin Chen wrote: > > > On Fri, Jul 22, 2022 at 04:11:29PM -0600, Alex Williamson wrote: > &g

Re: [PATCH v3 00/10] Update vfio_pin/unpin_pages API

2022-07-22 Thread Nicolin Chen
On Fri, Jul 22, 2022 at 04:11:29PM -0600, Alex Williamson wrote: > GVT-g explodes for me with this series on my Broadwell test system, > continuously spewing the following: Thank you for running additional tests. > [ 47.348778] WARNING: CPU: 3 PID: 501 at >

Re: [PATCH v3 01/10] vfio: Make vfio_unpin_pages() return void

2022-07-12 Thread Nicolin Chen
On Tue, Jul 12, 2022 at 10:21:14AM -0400, Anthony Krowiak wrote: > > +void vfio_unpin_pages(struct vfio_device *device, unsigned long *user_pfn, > > + int npage) > > { > > struct vfio_container *container; > > struct vfio_iommu_driver *driver; > > - int ret; >

[PATCH v3 09/10] vfio/ccw: Add kmap_local_page() for memcpy

2022-07-08 Thread Nicolin Chen
nthorpe Acked-by: Eric Farman Tested-by: Eric Farman Signed-off-by: Nicolin Chen --- drivers/s390/cio/vfio_ccw_cp.c | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/s390/cio/vfio_ccw_cp.c b/drivers/s390/cio/vfio_ccw_cp.c index 3854c3d573f5..cd4ec4f6d6ff

[PATCH v3 08/10] vfio: Rename user_iova of vfio_dma_rw()

2022-07-08 Thread Nicolin Chen
Following the updated vfio_pin/unpin_pages(), use the simpler "iova". Reviewed-by: Christoph Hellwig Reviewed-by: Jason Gunthorpe Reviewed-by: Kevin Tian Tested-by: Terrence Xu Tested-by: Eric Farman Signed-off-by: Nicolin Chen --- drivers/vfio/vfio.c | 6 +++--- include/linux/

[PATCH v3 06/10] vfio/ap: Change saved_pfn to saved_iova

2022-07-08 Thread Nicolin Chen
Reviewed-by: Jason Gunthorpe Tested-by: Eric Farman Signed-off-by: Nicolin Chen --- drivers/s390/crypto/vfio_ap_ops.c | 42 +++ drivers/s390/crypto/vfio_ap_private.h | 4 +-- 2 files changed, 19 insertions(+), 27 deletions(-) diff --git a/drivers/s390/crypto/vfio_a

[PATCH v3 01/10] vfio: Make vfio_unpin_pages() return void

2022-07-08 Thread Nicolin Chen
in the vfio core, thus drop the same check in the type1 code. Suggested-by: Christoph Hellwig Reviewed-by: Christoph Hellwig Reviewed-by: Jason Gunthorpe Reviewed-by: Kirti Wankhede Tested-by: Terrence Xu Signed-off-by: Nicolin Chen --- .../driver-api/vfio-mediated-device.rst | 2 +-

[PATCH v3 07/10] vfio/ccw: Change pa_pfn list to pa_iova list

2022-07-08 Thread Nicolin Chen
the code. Reviewed-by: Jason Gunthorpe Reviewed-by: Eric Farman Tested-by: Eric Farman Signed-off-by: Nicolin Chen --- drivers/s390/cio/vfio_ccw_cp.c | 135 - 1 file changed, 64 insertions(+), 71 deletions(-) diff --git a/drivers/s390/cio/vfio_ccw_cp.c b/driver

[PATCH v3 05/10] vfio: Pass in starting IOVA to vfio_pin/unpin_pages API

2022-07-08 Thread Nicolin Chen
don't want to spend too much effort swapping its parameters and local variables at that level. Reviewed-by: Christoph Hellwig Reviewed by: Kirti Wankhede Reviewed-by: Jason Gunthorpe Reviewed-by: Kevin Tian Acked-by: Eric Farman Tested-by: Terrence Xu Tested-by: Eric Farman Signed-off-by: Ni

[PATCH v3 04/10] vfio/ccw: Only pass in contiguous pages

2022-07-08 Thread Nicolin Chen
only, to have an efficient implementation in VFIO. Reviewed-by: Jason Gunthorpe Reviewed-by: Eric Farman Tested-by: Eric Farman Signed-off-by: Nicolin Chen --- drivers/s390/cio/vfio_ccw_cp.c | 70 +++--- 1 file changed, 56 insertions(+), 14 deletions(-) diff --git

[PATCH v3 03/10] vfio/ap: Pass in physical address of ind to ap_aqic()

2022-07-08 Thread Nicolin Chen
ind" to "pa_ind". Reviewed-by: Harald Freudenberger Reviewed-by: Jason Gunthorpe Tested-by: Eric Farman Signed-off-by: Nicolin Chen --- arch/s390/include/asm/ap.h| 6 +++--- drivers/s390/crypto/ap_queue.c| 2 +- drivers/s390/crypto/vfio_ap_ops.c | 7 --- 3 fil

[PATCH v3 02/10] drm/i915/gvt: Replace roundup with DIV_ROUND_UP

2022-07-08 Thread Nicolin Chen
It's a bit redundant for the maths here using roundup. Suggested-by: Jason Gunthorpe Tested-by: Terrence Xu Signed-off-by: Nicolin Chen --- drivers/gpu/drm/i915/gvt/kvmgt.c | 7 ++- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/i915/gvt/kvmgt.c b/drivers

[PATCH v3 00/10] Update vfio_pin/unpin_pages API

2022-07-08 Thread Nicolin Chen
uot; parameter to "pages" for vfio_pin_pages * Updated commit log of kmap_local_page() patch * Added Harald's "Reviewed-by" to pa_ind patch * Rebased on top of Alex's extern removal path v1: https://lore.kernel.org/kvm/20220616235212.15185-1-nicol...@nvidia.com/ Nicolin

Re: [RFT][PATCH v2 0/9] Update vfio_pin/unpin_pages API

2022-07-08 Thread Nicolin Chen
On Fri, Jul 08, 2022 at 04:30:32PM -0400, Eric Farman wrote: > External email: Use caution opening links or attachments > > > On Tue, 2022-07-05 at 23:27 -0700, Nicolin Chen wrote: > > This is a preparatory series for IOMMUFD v2 patches. It prepares for > > re

Re: [RFT][PATCH v2 0/9] Update vfio_pin/unpin_pages API

2022-07-08 Thread Nicolin Chen
On Fri, Jul 08, 2022 at 07:24:30AM +, Xu, Terrence wrote: > External email: Use caution opening links or attachments > > > > -Original Message- > > From: intel-gvt-dev On Behalf > > Of > > On Thu, Jul 07, 2022 at 06:08:45AM +, Tian, Kevin wrote: > > > > > > Request for testing:

Re: [RFT][PATCH v2 1/9] vfio: Make vfio_unpin_pages() return void

2022-07-07 Thread Nicolin Chen
On Thu, Jul 07, 2022 at 04:22:10PM -0300, Jason Gunthorpe wrote: > On Thu, Jul 07, 2022 at 10:12:41AM -0700, Nicolin Chen wrote: > > On Thu, Jul 07, 2022 at 08:42:28AM +, Tian, Kevin wrote: > > > External email: Use caution opening links or attachments > > > > &

Re: [RFT][PATCH v2 1/9] vfio: Make vfio_unpin_pages() return void

2022-07-07 Thread Nicolin Chen
On Thu, Jul 07, 2022 at 08:42:28AM +, Tian, Kevin wrote: > External email: Use caution opening links or attachments > > > > From: Nicolin Chen > > Sent: Wednesday, July 6, 2022 2:28 PM > > > > There's only one caller that checks its return value with a

Re: [RFT][PATCH v2 4/9] vfio: Pass in starting IOVA to vfio_pin/unpin_pages API

2022-07-07 Thread Nicolin Chen
On Thu, Jul 07, 2022 at 08:46:12AM +, Tian, Kevin wrote: > External email: Use caution opening links or attachments > > > > From: Nicolin Chen > > Sent: Wednesday, July 6, 2022 2:28 PM > > /* > > - * Pin a set of guest PFNs and return their associate

Re: [RFT][PATCH v2 9/9] vfio: Replace phys_pfn with pages for vfio_pin_pages()

2022-07-07 Thread Nicolin Chen
On Thu, Jul 07, 2022 at 08:49:28AM +, Tian, Kevin wrote: > External email: Use caution opening links or attachments > > > > From: Nicolin Chen > > Sent: Wednesday, July 6, 2022 2:28 PM > > > > Most of the callers of vfio_pin_pages() want "struct page *

Re: [RFT][PATCH v2 0/9] Update vfio_pin/unpin_pages API

2022-07-07 Thread Nicolin Chen
On Thu, Jul 07, 2022 at 06:08:45AM +, Tian, Kevin wrote: > > Request for testing: I only did build for s390 and i915 code, so it'd > > be nice to have people who have environment to run sanity accordingly. > > > > +Terrence who is testing it for i915 now... Hi Terrence, would it be possible

Re: [RFT][PATCH v2 4/9] vfio: Pass in starting IOVA to vfio_pin/unpin_pages API

2022-07-06 Thread Nicolin Chen
On Wed, Jul 06, 2022 at 02:49:23PM -0300, Jason Gunthorpe wrote: > On Tue, Jul 05, 2022 at 11:27:54PM -0700, Nicolin Chen wrote: > > > These functions call back into the back-end IOMMU module by using the > > pin_pages > > diff --git a/drivers/gpu/drm/i915/gvt/kvmgt.

Re: [RFT][PATCH v2 4/9] vfio: Pass in starting IOVA to vfio_pin/unpin_pages API

2022-07-06 Thread Nicolin Chen
On Wed, Jul 06, 2022 at 02:49:23PM -0300, Jason Gunthorpe wrote: > On Tue, Jul 05, 2022 at 11:27:54PM -0700, Nicolin Chen wrote: > > > These functions call back into the back-end IOMMU module by using the > > pin_pages > > diff --git a/drivers/gpu/drm/i915/gvt/kvmgt.

Re: [RFT][PATCH v2 4/9] vfio: Pass in starting IOVA to vfio_pin/unpin_pages API

2022-07-06 Thread Nicolin Chen
On Tue, Jul 05, 2022 at 11:56:25PM -0700, Christoph Hellwig wrote: > > - vfio_unpin_pages(>matrix_mdev->vdev, >saved_pfn, 1); > > + vfio_unpin_pages(>matrix_mdev->vdev, q->saved_pfn << > > PAGE_SHIFT, 1); > > Overly long line here. The following PATCH-5 drops the "<<

Re: [RFT][PATCH v2 1/9] vfio: Make vfio_unpin_pages() return void

2022-07-06 Thread Nicolin Chen
On Tue, Jul 05, 2022 at 11:54:50PM -0700, Christoph Hellwig wrote: > > +void vfio_unpin_pages(struct vfio_device *device, unsigned long *user_pfn, > > + int npage) > > { > > struct vfio_container *container; > > struct vfio_iommu_driver *driver; > > - int ret; > > > >

[RFT][PATCH v2 8/9] vfio/ccw: Add kmap_local_page() for memcpy

2022-07-06 Thread Nicolin Chen
owing patch changing the vfio_pin_pages() API to return a list of "struct page *" instead of PFNs. It will block any IO memory from ever getting into this call path, for such a security purpose. In this patch, add kmap_local_page() to prepare for that. Suggested-by: Jason Gunthorpe Signed-off-by: Nicol

[RFT][PATCH v2 9/9] vfio: Replace phys_pfn with pages for vfio_pin_pages()

2022-07-06 Thread Nicolin Chen
with a "pages" list, to simplify callers. This also allows us to replace the vfio_iommu_type1 implementation with a more efficient one. For now, also update vfio_iommu_type1 to fit this new parameter too. Signed-off-by: Nicolin Chen --- .../driver-api/vfio-mediated-device.r

[RFT][PATCH v2 7/9] vfio: Rename user_iova of vfio_dma_rw()

2022-07-06 Thread Nicolin Chen
Following the updated vfio_pin/unpin_pages(), use the simpler "iova". Signed-off-by: Nicolin Chen --- drivers/vfio/vfio.c | 6 +++--- include/linux/vfio.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/vfio/vfio.c b/drivers/vfio/vfio.c index 81

[RFT][PATCH v2 6/9] vfio/ccw: Change pa_pfn list to pa_iova list

2022-07-06 Thread Nicolin Chen
simplify the code. Signed-off-by: Nicolin Chen --- drivers/s390/cio/vfio_ccw_cp.c | 135 - 1 file changed, 64 insertions(+), 71 deletions(-) diff --git a/drivers/s390/cio/vfio_ccw_cp.c b/drivers/s390/cio/vfio_ccw_cp.c index a739262f988d..3854c3d573f5 100644 --- a/driver

[RFT][PATCH v2 4/9] vfio: Pass in starting IOVA to vfio_pin/unpin_pages API

2022-07-06 Thread Nicolin Chen
don't want to spend too much effort swapping its parameters and local variables at that level. Signed-off-by: Nicolin Chen --- .../driver-api/vfio-mediated-device.rst | 4 +-- drivers/gpu/drm/i915/gvt/kvmgt.c | 24 ++--- drivers/s390/cio/vfio_ccw_cp.c

[RFT][PATCH v2 5/9] vfio/ap: Remove redundant pfn

2022-07-06 Thread Nicolin Chen
The vfio_ap_ops code maintains both nib address and its PFN, which is redundant, merely because vfio_pin/unpin_pages API wanted pfn. Since vfio_pin/unpin_pages() now accept "iova", remove duplicated pfn code in their callers too. Signed-off-by: Nicolin Chen --- drivers/s390/crypto/vfi

[RFT][PATCH v2 3/9] vfio/ccw: Only pass in contiguous pages

2022-07-06 Thread Nicolin Chen
only, to have an efficient implementation in VFIO. Signed-off-by: Nicolin Chen --- drivers/s390/cio/vfio_ccw_cp.c | 70 +++--- 1 file changed, 56 insertions(+), 14 deletions(-) diff --git a/drivers/s390/cio/vfio_ccw_cp.c b/drivers/s390/cio/vfio_ccw_cp.c index

[RFT][PATCH v2 2/9] vfio/ap: Pass in physical address of ind to ap_aqic()

2022-07-06 Thread Nicolin Chen
ind" to "pa_ind". Reviewed-by: Harald Freudenberger Signed-off-by: Nicolin Chen --- arch/s390/include/asm/ap.h| 6 +++--- drivers/s390/crypto/ap_queue.c| 2 +- drivers/s390/crypto/vfio_ap_ops.c | 7 --- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/arc

[RFT][PATCH v2 1/9] vfio: Make vfio_unpin_pages() return void

2022-07-06 Thread Nicolin Chen
There's only one caller that checks its return value with a WARN_ON_ONCE, while all other callers do not check return value at all. So simplify the API to return void by embedding similar WARN_ON_ONCEs. Suggested-by: Christoph Hellwig Signed-off-by: Nicolin Chen --- .../driver-api/vfio

[RFT][PATCH v2 0/9] Update vfio_pin/unpin_pages API

2022-07-06 Thread Nicolin Chen
sed on top of Alex's extern removal path v1: https://lore.kernel.org/kvm/20220616235212.15185-1-nicol...@nvidia.com/ Nicolin Chen (9): vfio: Make vfio_unpin_pages() return void vfio/ap: Pass in physical address of ind to ap_aqic() vfio/ccw: Only pass in contiguous pages vfio: Pass in starting

Re: [RFT][PATCH v1 5/6] vfio/ccw: Add kmap_local_page() for memcpy

2022-06-24 Thread Nicolin Chen
On Fri, Jun 24, 2022 at 04:30:42PM -0300, Jason Gunthorpe wrote: > On Fri, Jun 24, 2022 at 12:22:36PM -0700, Nicolin Chen wrote: > > On Fri, Jun 24, 2022 at 10:56:15AM -0300, Jason Gunthorpe wrote: > > > > > > How about the updated commit log below? Thanks. > >

Re: [RFT][PATCH v1 5/6] vfio/ccw: Add kmap_local_page() for memcpy

2022-06-24 Thread Nicolin Chen
On Fri, Jun 24, 2022 at 10:56:15AM -0300, Jason Gunthorpe wrote: > > How about the updated commit log below? Thanks. > > > > The pinned PFN list returned from vfio_pin_pages() is converted using > > page_to_pfn(), so direct access via memcpy() will crash on S390 if the > > PFN is an IO PFN, as

Re: [RFT][PATCH v1 3/6] vfio: Pass in starting IOVA to vfio_pin/unpin_pages API

2022-06-21 Thread Nicolin Chen
On Fri, Jun 17, 2022 at 01:42:42AM -0700, Christoph Hellwig wrote: > On Thu, Jun 16, 2022 at 04:52:09PM -0700, Nicolin Chen wrote: > > + ret = vfio_unpin_pages(>vfio_device, gfn << PAGE_SHIFT, npage); > > + drm_WARN_ON(>drm, ret != npage); > > The shifting o

Re: [RFT][PATCH v1 6/6] vfio: Replace phys_pfn with phys_page for vfio_pin_pages()

2022-06-21 Thread Nicolin Chen
On Mon, Jun 20, 2022 at 12:36:28PM -0300, Jason Gunthorpe wrote: > On Sun, Jun 19, 2022 at 11:37:47PM -0700, Christoph Hellwig wrote: > > On Sun, Jun 19, 2022 at 10:51:47PM -0700, Christoph Hellwig wrote: > > > On Mon, Jun 20, 2022 at 12:00:46AM -0300, Jason Gunthorpe wrote: > > > > On Fri, Jun

Re: [RFT][PATCH v1 5/6] vfio/ccw: Add kmap_local_page() for memcpy

2022-06-21 Thread Nicolin Chen
On Sun, Jun 19, 2022 at 11:32:07PM -0700, Christoph Hellwig wrote: > On Sun, Jun 19, 2022 at 11:57:26PM -0300, Jason Gunthorpe wrote: > > The remark about io memory is because on s390 memcpy() will crash even > > on ioremapped memory, you have to use the memcpy_to/fromio() which > > uses the

Re: [RFT][PATCH v1 1/6] vfio/ap: Pass in physical address of ind to ap_aqic()

2022-06-21 Thread Nicolin Chen
On Mon, Jun 20, 2022 at 12:00:53PM +0200, Harald Freudenberger wrote: > External email: Use caution opening links or attachments > > > On 2022-06-17 01:52, Nicolin Chen wrote: > > The ap_aqic() is called by vfio_ap_irq_enable() where it passes in a > > virt value that'

Re: [RFT][PATCH v1 6/6] vfio: Replace phys_pfn with phys_page for vfio_pin_pages()

2022-06-19 Thread Nicolin Chen
On Sat, Jun 18, 2022 at 11:18:17PM -0700, Christoph Hellwig wrote: > > > There is a bunch of code an comments in the iommu type1 code that > > > suggest we can pin memory that is not page backed. > > > > Would you mind explaining the use case for pinning memory that > > isn't page backed? And

Re: [RFT][PATCH v1 6/6] vfio: Replace phys_pfn with phys_page for vfio_pin_pages()

2022-06-18 Thread Nicolin Chen
On Fri, Jun 17, 2022 at 01:54:05AM -0700, Christoph Hellwig wrote: > There is a bunch of code an comments in the iommu type1 code that > suggest we can pin memory that is not page backed. Would you mind explaining the use case for pinning memory that isn't page backed? And do we have such use

Re: [RFT][PATCH v1 5/6] vfio/ccw: Add kmap_local_page() for memcpy

2022-06-18 Thread Nicolin Chen
On Fri, Jun 17, 2022 at 01:44:30AM -0700, Christoph Hellwig wrote: > On Thu, Jun 16, 2022 at 04:52:11PM -0700, Nicolin Chen wrote: > > The pinned PFN list returned from vfio_pin_pages() is simply converted > > using page_to_pfn() without protection, so direct access via memcpy()

Re: [RFT][PATCH v1 3/6] vfio: Pass in starting IOVA to vfio_pin/unpin_pages API

2022-06-18 Thread Nicolin Chen
On Fri, Jun 17, 2022 at 01:42:42AM -0700, Christoph Hellwig wrote: > On Thu, Jun 16, 2022 at 04:52:09PM -0700, Nicolin Chen wrote: > > + ret = vfio_unpin_pages(>vfio_device, gfn << PAGE_SHIFT, npage); > > + drm_WARN_ON(>drm, ret != npage); > > The shifting o

[RFT][PATCH v1 6/6] vfio: Replace phys_pfn with phys_page for vfio_pin_pages()

2022-06-17 Thread Nicolin Chen
page list, to simplify callers. This also allows us to replace the vfio_iommu_type1 implementation with a more efficient one. For now, also update vfio_iommu_type1 to fit this new parameter too. Signed-off-by: Nicolin Chen --- .../driver-api/vfio-mediated-device.rst | 2 +- dr

[RFT][PATCH v1 4/6] vfio: Rename user_iova of vfio_dma_rw()

2022-06-17 Thread Nicolin Chen
Following the updated vfio_pin/unpin_pages(), use the simpler "iova". Signed-off-by: Nicolin Chen --- drivers/vfio/vfio.c | 6 +++--- include/linux/vfio.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/vfio/vfio.c b/drivers/vfio/vfio.c index 86

[RFT][PATCH v1 3/6] vfio: Pass in starting IOVA to vfio_pin/unpin_pages API

2022-06-17 Thread Nicolin Chen
don't want to spend too much effort swapping its parameters and local variables at that level. Signed-off-by: Nicolin Chen --- .../driver-api/vfio-mediated-device.rst | 4 +-- drivers/gpu/drm/i915/gvt/kvmgt.c | 25 +++--- drivers/s390/cio/vfio_ccw_cp.c

[RFT][PATCH v1 2/6] vfio/ccw: Only pass in contiguous pages

2022-06-17 Thread Nicolin Chen
only, to have an efficient implementation in VFIO. Signed-off-by: Nicolin Chen --- drivers/s390/cio/vfio_ccw_cp.c | 68 +++--- 1 file changed, 54 insertions(+), 14 deletions(-) diff --git a/drivers/s390/cio/vfio_ccw_cp.c b/drivers/s390/cio/vfio_ccw_cp.c index

[RFT][PATCH v1 1/6] vfio/ap: Pass in physical address of ind to ap_aqic()

2022-06-17 Thread Nicolin Chen
ind" to "pa_ind". Signed-off-by: Nicolin Chen --- arch/s390/include/asm/ap.h| 6 +++--- drivers/s390/crypto/ap_queue.c| 2 +- drivers/s390/crypto/vfio_ap_ops.c | 7 --- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/arch/s390/include/asm/ap.h b/ar

[RFT][PATCH v1 0/6] Update vfio_pin/unpin_pages API

2022-06-17 Thread Nicolin Chen
ming at the adjacent vfio_dma_rw(). This is on github: https://github.com/nicolinc/iommufd/commits/vfio_pin_pages Request for testing: I only did build for s390 and i915 code, so it'd be nice to have people who have environment to run sanity accordingly. Thanks! Nicolin Chen (6): vfio/ap: Pass

[RFT][PATCH v1 5/6] vfio/ccw: Add kmap_local_page() for memcpy

2022-06-17 Thread Nicolin Chen
;from". Suggested-by: Jason Gunthorpe Signed-off-by: Nicolin Chen --- drivers/s390/cio/vfio_ccw_cp.c | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/s390/cio/vfio_ccw_cp.c b/drivers/s390/cio/vfio_ccw_cp.c index e2b01115b3ec..12cbe66721af 100644 --- a/dr

[PATCH] drm/tegra: hub: Do not enable orphaned window group

2020-05-20 Thread Nicolin Chen
running into tegra_windowgroup_enable/disable. Signed-off-by: Nicolin Chen --- drivers/gpu/drm/tegra/hub.c | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/tegra/hub.c b/drivers/gpu/drm/tegra/hub.c index 8183e617bf6b..a2ef8f218d4e 100644 --- a/drivers

Re: [PATCH] dma-buf: refcount the attachment for cache_sgt_mapping

2019-06-12 Thread Nicolin Chen
On Wed, Jun 12, 2019 at 08:20:41AM +, Koenig, Christian wrote: > Am 12.06.19 um 10:15 schrieb Nicolin Chen: > > Hi Christian, > > > > On Wed, Jun 12, 2019 at 08:05:53AM +, Koenig, Christian wrote: > >> Am 12.06.19 um 10:02 schrieb Nicolin Chen: > &g

Re: [PATCH] dma-buf: refcount the attachment for cache_sgt_mapping

2019-06-12 Thread Nicolin Chen
Hi Christian, On Wed, Jun 12, 2019 at 08:05:53AM +, Koenig, Christian wrote: > Am 12.06.19 um 10:02 schrieb Nicolin Chen: > > Hi Christian, > > > > Thanks for the quick reply. > > > > On Wed, Jun 12, 2019 at 07:45:38AM +, Koenig, Christian wrote: > >

Re: [PATCH] dma-buf: refcount the attachment for cache_sgt_mapping

2019-06-12 Thread Nicolin Chen
Hi Christian, Thanks for the quick reply. On Wed, Jun 12, 2019 at 07:45:38AM +, Koenig, Christian wrote: > Am 12.06.19 um 03:22 schrieb Nicolin Chen: > > Commit f13e143e7444 ("dma-buf: start caching of sg_table objects v2") > > added a support of caching the s

[PATCH] dma-buf: refcount the attachment for cache_sgt_mapping

2019-06-11 Thread Nicolin Chen
, it would need to get the same attachment pointer in order to reuse its sgt pointer. So this patch adds a refcount to the attach() function and lets it search for the existing attach pointer by matching the dev pointer. Signed-off-by: Nicolin Chen --- drivers/dma-buf/dma-buf.c | 23 ++

Re: Regression in Linux next with dma cma changes

2019-02-27 Thread Nicolin Chen
On Tue, Feb 26, 2019 at 12:01:55PM -0800, Tony Lindgren wrote: > Looks like commit d222e42e8816 ("dma-contiguous: do not allocate a > single page from CMA area") caused a regression at least for > omap dss where we now get the following error on init: > > omapdss_dispc 58001000.dispc: >

[PATCH] Revert "dma-contiguous: do not allocate a single page from CMA area"

2019-02-27 Thread Nicolin Chen
-off-by: Nicolin Chen --- Tony, Would you please test and verify? Thanks! kernel/dma/contiguous.c | 22 +++--- 1 file changed, 3 insertions(+), 19 deletions(-) diff --git a/kernel/dma/contiguous.c b/kernel/dma/contiguous.c index 09074bd04793..b2a87905846d 100644

Re: [PATCH] Revert "dma-contiguous: do not allocate a single page from CMA area"

2019-02-27 Thread Nicolin Chen
On Tue, Feb 26, 2019 at 11:35:44PM +, Robin Murphy wrote: > On 2019-02-26 8:23 pm, Nicolin Chen wrote: > > This reverts commit d222e42e88168fd67e6d131984b86477af1fc256. > > > > The original change breaks omap dss: > > omapdss_dispc 58001000.dispc: > >

[PATCH] drm/tegra: falcon: Validate firmware.vaddr with IS_ERR_OR_NULL

2018-11-01 Thread Nicolin Chen
/0x358 [tegra_drm] sp : 10feb4a0 [...] Call trace: falcon_load_firmware+0x80/0x358 [tegra_drm] vic_init+0x74/0x158 [tegra_drm] host1x_device_init+0x58/0x108 [host1x] tegra_drm_load+0xdc/0x2b8 [tegra_drm] Signed-off-by: Nicolin Chen --- drivers/gpu/drm/tegra/falcon.c | 5 +++-- 1 file