kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nicolin Chen <nicolinc@nvidia.com>
To: <kwankhede@nvidia.com>, <corbet@lwn.net>, <hca@linux.ibm.com>,
	<gor@linux.ibm.com>, <agordeev@linux.ibm.com>,
	<borntraeger@linux.ibm.com>, <svens@linux.ibm.com>,
	<zhenyuw@linux.intel.com>, <zhi.a.wang@intel.com>,
	<jani.nikula@linux.intel.com>, <joonas.lahtinen@linux.intel.com>,
	<rodrigo.vivi@intel.com>, <tvrtko.ursulin@linux.intel.com>,
	<airlied@linux.ie>, <daniel@ffwll.ch>, <farman@linux.ibm.com>,
	<mjrosato@linux.ibm.com>, <pasic@linux.ibm.com>,
	<vneethv@linux.ibm.com>, <oberpar@linux.ibm.com>,
	<freude@linux.ibm.com>, <akrowiak@linux.ibm.com>,
	<jjherne@linux.ibm.com>, <alex.williamson@redhat.com>,
	<cohuck@redhat.com>, <jgg@nvidia.com>, <kevin.tian@intel.com>,
	<hch@infradead.org>
Cc: <jchrist@linux.ibm.com>, <kvm@vger.kernel.org>,
	<linux-doc@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<linux-s390@vger.kernel.org>,
	<intel-gvt-dev@lists.freedesktop.org>,
	<intel-gfx@lists.freedesktop.org>,
	<dri-devel@lists.freedesktop.org>, <terrence.xu@intel.com>
Subject: [PATCH v4 00/10] cover-letter: Update vfio_pin/unpin_pages API
Date: Fri, 22 Jul 2022 19:02:46 -0700	[thread overview]
Message-ID: <20220723020256.30081-1-nicolinc@nvidia.com> (raw)

This is a preparatory series for IOMMUFD v2 patches. It prepares for
replacing vfio_iommu_type1 implementations of vfio_pin/unpin_pages()
with IOMMUFD version.

There's a gap between these two versions: the vfio_iommu_type1 version
inputs a non-contiguous PFN list and outputs another PFN list for the
pinned physical page list, while the IOMMUFD version only supports a
contiguous address input by accepting the starting IO virtual address
of a set of pages to pin and by outputting to a physical page list.

The nature of existing callers mostly aligns with the IOMMUFD version,
except s390's vfio_ccw_cp code where some additional change is needed
along with this series. Overall, updating to "iova" and "phys_page"
does improve the caller side to some extent.

Also fix a misuse of physical address and virtual address in the s390's
crypto code. And update the input naming at the adjacent vfio_dma_rw().

This is on github:
https://github.com/nicolinc/iommufd/commits/vfio_pin_pages-v4

Terrence has tested this series on i915; Eric has tested on s390.

Thanks!

Changelog
v4:
 * Dropped double-shifting at two gvt_unpin_guest_page calls, fixing
   a bug that's discovered by Alex
 * Added Reviewed-by from Anthony Krowiak
 * Rebased on top of linux-vfio's next
v3: https://lore.kernel.org/kvm/20220708224427.1245-1-nicolinc@nvidia.com/
 * Added a patch to replace roundup with DIV_ROUND_UP in i915 gvt
 * Dropped the "driver->ops->unpin_pages" and NULL checks in PATCH-1
 * Changed to use WARN_ON and separate into lines in PATCH-1
 * Replaced "guest" words with "user" and fix typo in PATCH-5
 * Updated commit log of PATCH-1, PATCH-6, and PATCH-10
 * Added Reviewed/Acked-by from Christoph, Jason, Kirti, Kevin and Eric
 * Added Tested-by from Terrence (i915) and Eric (s390)
v2: https://lore.kernel.org/kvm/20220706062759.24946-1-nicolinc@nvidia.com/
 * Added a patch to make vfio_unpin_pages return void
 * Added two patches to remove PFN list from two s390 callers
 * Renamed "phys_page" 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-nicolinc@nvidia.com/

Nicolin Chen (10):
  vfio: Make vfio_unpin_pages() return void
  drm/i915/gvt: Replace roundup with DIV_ROUND_UP
  vfio/ap: Pass in physical address of ind to ap_aqic()
  vfio/ccw: Only pass in contiguous pages
  vfio: Pass in starting IOVA to vfio_pin/unpin_pages API
  vfio/ap: Change saved_pfn to saved_iova
  vfio/ccw: Change pa_pfn list to pa_iova list
  vfio: Rename user_iova of vfio_dma_rw()
  vfio/ccw: Add kmap_local_page() for memcpy
  vfio: Replace phys_pfn with pages for vfio_pin_pages()

 .../driver-api/vfio-mediated-device.rst       |   6 +-
 arch/s390/include/asm/ap.h                    |   6 +-
 drivers/gpu/drm/i915/gvt/kvmgt.c              |  45 ++--
 drivers/s390/cio/vfio_ccw_cp.c                | 195 +++++++++++-------
 drivers/s390/crypto/ap_queue.c                |   2 +-
 drivers/s390/crypto/vfio_ap_ops.c             |  54 +++--
 drivers/s390/crypto/vfio_ap_private.h         |   4 +-
 drivers/vfio/vfio.c                           |  54 ++---
 drivers/vfio/vfio.h                           |   8 +-
 drivers/vfio/vfio_iommu_type1.c               |  45 ++--
 include/linux/vfio.h                          |   9 +-
 11 files changed, 213 insertions(+), 215 deletions(-)

-- 
2.17.1


             reply	other threads:[~2022-07-23  2:04 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-23  2:02 Nicolin Chen [this message]
2022-07-23  2:02 ` [PATCH v4 01/10] vfio: Make vfio_unpin_pages() return void Nicolin Chen
2022-07-23  2:02 ` [PATCH v4 02/10] drm/i915/gvt: Replace roundup with DIV_ROUND_UP Nicolin Chen
2022-07-23  2:02 ` [PATCH v4 03/10] vfio/ap: Pass in physical address of ind to ap_aqic() Nicolin Chen
2022-07-23  2:02 ` [PATCH v4 04/10] vfio/ccw: Only pass in contiguous pages Nicolin Chen
2022-07-23  2:02 ` [PATCH v4 05/10] vfio: Pass in starting IOVA to vfio_pin/unpin_pages API Nicolin Chen
2022-07-23  2:02 ` [PATCH v4 06/10] vfio/ap: Change saved_pfn to saved_iova Nicolin Chen
2022-07-23  2:02 ` [PATCH v4 07/10] vfio/ccw: Change pa_pfn list to pa_iova list Nicolin Chen
2022-07-23  2:02 ` [PATCH v4 08/10] vfio: Rename user_iova of vfio_dma_rw() Nicolin Chen
2022-07-23  2:02 ` [PATCH v4 09/10] vfio/ccw: Add kmap_local_page() for memcpy Nicolin Chen
2022-07-23  2:02 ` [PATCH v4 10/10] vfio: Replace phys_pfn with pages for vfio_pin_pages() Nicolin Chen
2022-07-25 10:20 ` [PATCH v4 00/10] cover-letter: Update vfio_pin/unpin_pages API Xu, Terrence
2022-07-25 21:17 ` Alex Williamson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220723020256.30081-1-nicolinc@nvidia.com \
    --to=nicolinc@nvidia.com \
    --cc=agordeev@linux.ibm.com \
    --cc=airlied@linux.ie \
    --cc=akrowiak@linux.ibm.com \
    --cc=alex.williamson@redhat.com \
    --cc=borntraeger@linux.ibm.com \
    --cc=cohuck@redhat.com \
    --cc=corbet@lwn.net \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=farman@linux.ibm.com \
    --cc=freude@linux.ibm.com \
    --cc=gor@linux.ibm.com \
    --cc=hca@linux.ibm.com \
    --cc=hch@infradead.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-gvt-dev@lists.freedesktop.org \
    --cc=jani.nikula@linux.intel.com \
    --cc=jchrist@linux.ibm.com \
    --cc=jgg@nvidia.com \
    --cc=jjherne@linux.ibm.com \
    --cc=joonas.lahtinen@linux.intel.com \
    --cc=kevin.tian@intel.com \
    --cc=kvm@vger.kernel.org \
    --cc=kwankhede@nvidia.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=mjrosato@linux.ibm.com \
    --cc=oberpar@linux.ibm.com \
    --cc=pasic@linux.ibm.com \
    --cc=rodrigo.vivi@intel.com \
    --cc=svens@linux.ibm.com \
    --cc=terrence.xu@intel.com \
    --cc=tvrtko.ursulin@linux.intel.com \
    --cc=vneethv@linux.ibm.com \
    --cc=zhenyuw@linux.intel.com \
    --cc=zhi.a.wang@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).