From: Lu Baolu <baolu.lu@linux.intel.com>
To: Joerg Roedel <joro@8bytes.org>,
David Woodhouse <dwmw2@infradead.org>,
Alex Williamson <alex.williamson@redhat.com>,
Kirti Wankhede <kwankhede@nvidia.com>
Cc: ashok.raj@intel.com, sanjay.k.kumar@intel.com,
jacob.jun.pan@intel.com, kevin.tian@intel.com,
Jean-Philippe Brucker <jean-philippe.brucker@arm.com>,
yi.l.liu@intel.com, yi.y.sun@intel.com, peterx@redhat.com,
tiwei.bie@intel.com, Zeng Xin <xin.zeng@intel.com>,
iommu@lists.linux-foundation.org, kvm@vger.kernel.org,
linux-kernel@vger.kernel.org, Lu Baolu <baolu.lu@linux.intel.com>
Subject: [RFC PATCH 0/5] iommu: APIs for paravirtual PASID allocation
Date: Mon, 12 Nov 2018 14:44:56 +0800 [thread overview]
Message-ID: <20181112064501.2290-1-baolu.lu@linux.intel.com> (raw)
This adds an uniformed API set for global PASIDs used by IOMMU
and device drivers which depend on IOMMU. It works for drivers
running on bare metal, full virtualized environments and para-
virtualized environment.
When PASID requests come from components running on the bare
metal hardware, the requests will be routed to the system wide
I/O ASID allocator.
^ ^ iommu_pasid_init()
| | iommu_pasid_exit()
| | iommu_pasid_alloc()
| | iommu_pasid_free()
.-------------------------------.
| IOMMU PASID APIs |
'-------------------------------'
| ^
v |
.------------. .---------------.
| I/O ASID | | |
| allocator | | IOMMU drivers |
| (drivers/ | | or |
| base/ | | virtio IOMMU |
| ioasid.c) | | |
'------------' '---------------'
When PASID requests come from components running in full-virtualized
or para-virtualized environments, they will be routed to the vendor-
specific or virtio IOMMU driver, where the requests will be intercepted
and routed to the Host Linux via VFIO interfaces.
......................................
. Guest Linux .
......................................
. .
. .----------------------------. .
. | IOMMU PASID APIs | .
. '----------------------------' .
. | .
. v .
. .----------. .---------------. ..---------.
. | I/O ASID | | IOMMU drivers | .| QEMU |
. '----------' | /virtio IOMMU |---->'---------'
. '---------------' .| virtio |
......................................'---------'
|
|
...........................................|....
. Host Linux | .
...........................................|....
. |-------------------' .
. v .
. .----------------------------. .
. | IOMMU PASID APIs | .
. '----------------------------' .
. | .
. v .---------------. .
. .----------. | IOMMU drivers | .
. | I/O ASID | | /virtio IOMMU | .
. '----------' '---------------' .
................................................
Below APIs are introduced:
* iommu_pasid_init(pasid)
- Initialize a PASID consumer. The vendor specific IOMMU
drivers are able to set the PASID range imposed by IOMMU
hardware through a callback in iommu_ops.
* iommu_pasid_exit(pasid)
- The PASID consumer stops consuming any PASID.
* iommu_pasid_alloc(pasid, min, max, private, *ioasid)
- Allocate a PASID and associate a @private data with this
PASID. The PASID value is stored in @ioaisd if returning
success.
* iommu_pasid_free(pasid, ioasid)
- Free a PASID to the pool so that it could be consumed by
others.
It also adds below helpers to lookup or iterate PASID items.
* iommu_pasid_for_each(pasid, func, data)
- Iterate PASID items of the consumer identified by @pasid,
and call @func() against each item. An error returned from
@func() will break the iteration.
* iommu_pasid_find(pasid, ioasid)
- Retrieve the private data associated with @ioasid.
This patch set depends on the I/O APSID allocator posted here
[1] for discussion.
[1] https://www.spinics.net/lists/iommu/msg30639.html
Best regards,
Lu Baolu
Lu Baolu (5):
iommu: Add APIs for IOMMU PASID management
iommu/vt-d: Initialize a PASID consumer
iommu/vt-d: Enlightened PASID allocation
iommu/vt-d: Allocate and free a pasid
iommu/vt-d: Use global pasid allocator
drivers/iommu/Kconfig | 1 +
drivers/iommu/intel-iommu.c | 83 +++++++++++++++++++++++++++++++---
drivers/iommu/intel-pasid.c | 88 +++++++++++++++++++++++++-----------
drivers/iommu/intel-pasid.h | 16 +++++--
drivers/iommu/intel-svm.c | 24 +++++-----
drivers/iommu/iommu.c | 89 +++++++++++++++++++++++++++++++++++++
include/linux/intel-iommu.h | 5 +++
include/linux/iommu.h | 73 ++++++++++++++++++++++++++++++
8 files changed, 332 insertions(+), 47 deletions(-)
--
2.17.1
next reply other threads:[~2018-11-12 6:44 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-12 6:44 Lu Baolu [this message]
2018-11-12 6:44 ` [RFC PATCH 1/5] iommu: Add APIs for IOMMU PASID management Lu Baolu
[not found] ` <20181112064501.2290-2-baolu.lu-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2018-12-15 22:38 ` Liu, Yi L
[not found] ` <A2975661238FB949B60364EF0F2C257439D8E060-0J0gbvR4kTg/UvCtAeCM4rfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2018-12-16 1:20 ` Lu Baolu
2019-01-30 19:05 ` Jacob Pan
2019-02-15 17:33 ` Jean-Philippe Brucker
[not found] ` <65452190-afac-bc71-de29-ce24b508955a-5wv7dgnIgG8@public.gmane.org>
2019-02-19 18:37 ` Jacob Pan
[not found] ` <20181112064501.2290-1-baolu.lu-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2018-11-12 6:44 ` [RFC PATCH 2/5] iommu/vt-d: Initialize a PASID consumer Lu Baolu
2018-11-12 6:44 ` [RFC PATCH 3/5] iommu/vt-d: Enlightened PASID allocation Lu Baolu
2018-11-19 16:36 ` [RFC PATCH 0/5] iommu: APIs for paravirtual " Konrad Rzeszutek Wilk
2018-11-20 2:29 ` Yi Sun
2018-11-12 6:45 ` [RFC PATCH 4/5] iommu/vt-d: Allocate and free a pasid Lu Baolu
2018-11-12 6:45 ` [RFC PATCH 5/5] iommu/vt-d: Use global pasid allocator Lu Baolu
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=20181112064501.2290-1-baolu.lu@linux.intel.com \
--to=baolu.lu@linux.intel.com \
--cc=alex.williamson@redhat.com \
--cc=ashok.raj@intel.com \
--cc=dwmw2@infradead.org \
--cc=iommu@lists.linux-foundation.org \
--cc=jacob.jun.pan@intel.com \
--cc=jean-philippe.brucker@arm.com \
--cc=joro@8bytes.org \
--cc=kevin.tian@intel.com \
--cc=kvm@vger.kernel.org \
--cc=kwankhede@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=peterx@redhat.com \
--cc=sanjay.k.kumar@intel.com \
--cc=tiwei.bie@intel.com \
--cc=xin.zeng@intel.com \
--cc=yi.l.liu@intel.com \
--cc=yi.y.sun@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).