kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yan Zhao <yan.y.zhao@intel.com>
To: alex.williamson@redhat.com, zhenyuw@linux.intel.com
Cc: intel-gvt-dev@lists.freedesktop.org, kvm@vger.kernel.org,
	linux-kernel@vger.kernel.org, pbonzini@redhat.com,
	kevin.tian@intel.com, peterx@redhat.com,
	Yan Zhao <yan.y.zhao@intel.com>
Subject: [PATCH v2 0/2] use vfio_dma_rw to read/write IOVAs from CPU side
Date: Tue, 14 Jan 2020 22:41:32 -0500	[thread overview]
Message-ID: <20200115034132.2753-1-yan.y.zhao@intel.com> (raw)

It is better for a device model to use IOVAs to read/write memory.
And because the rw operations come from CPUs, it is not necessary to call
vfio_pin_pages() to pin those pages.

patch 1 introduces interface vfio_dma_rw in vfio to read/write IOVAs
without pinning user space pages.

patch 2 let gvt switch from kvm side rw interface to vfio_dma_rw.

v2 changelog:
- rename vfio_iova_rw to vfio_dma_rw, vfio iommu driver ops .iova_rw
to .dma_rw. (Alex).
- change iova and len from unsigned long to dma_addr_t and size_t,
respectively. (Alex)
- fix possible overflow in dma->vaddr + iova - dma->iova + offset (Alex)
- split DMAs from on page boundary to on max available size to eliminate
  redundant searching of vfio_dma and switching mm. (Alex)
- add a check for IOMMU_WRITE permission.

Yan Zhao (2):
  vfio: introduce vfio_dma_rw to read/write a range of IOVAs
  drm/i915/gvt: subsitute kvm_read/write_guest with vfio_dma_rw

 drivers/gpu/drm/i915/gvt/kvmgt.c | 26 +++--------
 drivers/vfio/vfio.c              | 45 +++++++++++++++++++
 drivers/vfio/vfio_iommu_type1.c  | 76 ++++++++++++++++++++++++++++++++
 include/linux/vfio.h             |  5 +++
 4 files changed, 133 insertions(+), 19 deletions(-)

-- 
2.17.1


             reply	other threads:[~2020-01-15  3:51 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-15  3:41 Yan Zhao [this message]
2020-01-15  3:53 ` [PATCH v2 1/2] vfio: introduce vfio_dma_rw to read/write a range of IOVAs Yan Zhao
2020-01-15 20:06   ` Alex Williamson
2020-01-16  2:30     ` Mika Penttilä
2020-01-16  2:59       ` Alex Williamson
2020-01-16  3:15         ` Mika Penttilä
2020-01-16  3:58           ` Alex Williamson
2020-01-16  5:32     ` Yan Zhao
2020-01-15  3:54 ` [PATCH v2 2/2] drm/i915/gvt: subsitute kvm_read/write_guest with vfio_dma_rw Yan Zhao
2020-01-15 20:06   ` Alex Williamson
2020-01-16  5:49     ` Yan Zhao
2020-01-16 15:37       ` Alex Williamson
2020-01-19 10:06         ` Yan Zhao
2020-01-20 20:01           ` Alex Williamson
2020-01-21  8:12             ` Yan Zhao
2020-01-21 16:51               ` Alex Williamson
2020-01-21 22:10                 ` Yan Zhao
2020-01-22  3:07                   ` Yan Zhao
2020-01-23 10:02                     ` Yan Zhao

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=20200115034132.2753-1-yan.y.zhao@intel.com \
    --to=yan.y.zhao@intel.com \
    --cc=alex.williamson@redhat.com \
    --cc=intel-gvt-dev@lists.freedesktop.org \
    --cc=kevin.tian@intel.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=peterx@redhat.com \
    --cc=zhenyuw@linux.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).