From: Jacob Pan <jacob.jun.pan@linux.intel.com>
To: iommu@lists.linux-foundation.org,
LKML <linux-kernel@vger.kernel.org>,
Joerg Roedel <joro@8bytes.org>,
David Woodhouse <dwmw2@infradead.org>
Cc: "Liu, Yi L" <yi.l.liu@intel.com>,
Lan Tianyu <tianyu.lan@intel.com>,
"Tian, Kevin" <kevin.tian@intel.com>,
Raj Ashok <ashok.raj@intel.com>,
Alex Williamson <alex.williamson@redhat.com>,
Jean Delvare <khali@linux-fr.org>,
Jacob Pan <jacob.jun.pan@linux.intel.com>
Subject: [RFC 6/9] iommu/vt-d: track device with pasid table bond to a guest
Date: Wed, 14 Jun 2017 15:23:00 -0700 [thread overview]
Message-ID: <1497478983-77580-7-git-send-email-jacob.jun.pan@linux.intel.com> (raw)
In-Reply-To: <1497478983-77580-1-git-send-email-jacob.jun.pan@linux.intel.com>
When PASID table pointer of an assigned device is bond to a guest,
the first level page tables are managed by the guest. However, only
host/physical IOMMU can detect fault events, e.g. page requests.
Therefore, we need to keep track of which device has its PASID table
pointer bond to a guest such that page request and other events can
be propagated to the guest as needed.
Signed-off-by: Jacob Pan <jacob.jun.pan@linux.intel.com>
Signed-off-by: Ashok Raj <ashok.raj@intel.com>
---
drivers/iommu/intel-iommu.c | 19 +------------------
include/linux/intel-iommu.h | 19 +++++++++++++++++++
2 files changed, 20 insertions(+), 18 deletions(-)
diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
index 6b8e997..9765277 100644
--- a/drivers/iommu/intel-iommu.c
+++ b/drivers/iommu/intel-iommu.c
@@ -416,24 +416,6 @@ struct dmar_domain {
iommu core */
};
-/* PCI domain-device relationship */
-struct device_domain_info {
- struct list_head link; /* link to domain siblings */
- struct list_head global; /* link to global list */
- u8 bus; /* PCI bus number */
- u8 devfn; /* PCI devfn number */
- u8 pasid_supported:3;
- u8 pasid_enabled:1;
- u8 pri_supported:1;
- u8 pri_enabled:1;
- u8 ats_supported:1;
- u8 ats_enabled:1;
- u8 ats_qdep;
- struct device *dev; /* it's NULL for PCIe-to-PCI bridge */
- struct intel_iommu *iommu; /* IOMMU used by this device */
- struct dmar_domain *domain; /* pointer to domain */
-};
-
struct dmar_rmrr_unit {
struct list_head list; /* list of rmrr units */
struct acpi_dmar_header *hdr; /* ACPI header */
@@ -5547,6 +5529,7 @@ static int intel_iommu_bind_pasid_table(struct iommu_domain *domain,
DMA_CCMD_MASK_NOBIT,
DMA_CCMD_DEVICE_INVL);
iommu->flush.flush_iotlb(iommu, did, 0, 0, DMA_TLB_DSI_FLUSH);
+ info->pasid_tbl_bond = 1;
spin_unlock_irqrestore(&iommu->lock, flags);
diff --git a/include/linux/intel-iommu.h b/include/linux/intel-iommu.h
index 8df6c91..ed39c56 100644
--- a/include/linux/intel-iommu.h
+++ b/include/linux/intel-iommu.h
@@ -434,6 +434,25 @@ struct intel_iommu {
u32 flags; /* Software defined flags */
};
+/* PCI domain-device relationship */
+struct device_domain_info {
+ struct list_head link; /* link to domain siblings */
+ struct list_head global; /* link to global list */
+ u8 bus; /* PCI bus number */
+ u8 devfn; /* PCI devfn number */
+ u8 pasid_supported:3;
+ u8 pasid_enabled:1;
+ u8 pasid_tbl_bond:1; /* bond to guest PASID table */
+ u8 pri_supported:1;
+ u8 pri_enabled:1;
+ u8 ats_supported:1;
+ u8 ats_enabled:1;
+ u8 ats_qdep;
+ struct device *dev; /* it's NULL for PCIe-to-PCI bridge */
+ struct intel_iommu *iommu; /* IOMMU used by this device */
+ struct dmar_domain *domain; /* pointer to domain */
+};
+
static inline void __iommu_flush_cache(
struct intel_iommu *iommu, void *addr, int size)
{
--
2.7.4
next prev parent reply other threads:[~2017-06-14 22:24 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-14 22:22 [RFC 0/9] IOMMU driver changes for shared virtual memory virtualization Jacob Pan
2017-06-14 22:22 ` [RFC 1/9] iommu: Introduce bind_pasid_table API function Jacob Pan
2017-06-22 22:52 ` Alex Williamson
2017-06-23 18:20 ` Jacob Pan
2017-06-14 22:22 ` [RFC 2/9] iommu/vt-d: add bind_pasid_table function Jacob Pan
2017-06-22 22:52 ` Alex Williamson
2017-06-23 18:19 ` Jacob Pan
2017-06-23 18:59 ` Alex Williamson
2017-06-23 20:21 ` Jacob Pan
2017-06-14 22:22 ` [RFC 3/9] iommu: Introduce iommu do invalidate API function Jacob Pan
2017-06-22 22:52 ` Alex Williamson
2017-06-14 22:22 ` [RFC 4/9] iommu/vt-d: Add iommu do invalidate function Jacob Pan
2017-06-22 22:52 ` Alex Williamson
2017-06-14 22:22 ` [RFC 5/9] iommu: Introduce fault notifier API Jacob Pan
2017-06-22 22:53 ` Alex Williamson
2017-06-23 18:59 ` Jacob Pan
2017-06-23 19:15 ` Alex Williamson
2017-06-26 15:27 ` Jacob Pan
2017-06-26 15:32 ` Alex Williamson
2017-06-14 22:23 ` Jacob Pan [this message]
2017-06-22 22:54 ` [RFC 6/9] iommu/vt-d: track device with pasid table bond to a guest Alex Williamson
2017-06-14 22:23 ` [RFC 7/9] iommu/dmar: notify unrecoverable faults Jacob Pan
2017-06-22 22:54 ` Alex Williamson
2017-06-23 20:19 ` Jacob Pan
2017-06-14 22:23 ` [RFC 8/9] iommu/intel-svm: notify page request to guest Jacob Pan
2017-06-22 22:53 ` Alex Williamson
2017-06-23 20:16 ` Jacob Pan
2017-06-23 20:34 ` Alex Williamson
2017-06-23 21:33 ` Jacob Pan
2017-06-14 22:23 ` [RFC 9/9] iommu/intel-svm: replace dev ops with generic fault notifier Jacob Pan
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=1497478983-77580-7-git-send-email-jacob.jun.pan@linux.intel.com \
--to=jacob.jun.pan@linux.intel.com \
--cc=alex.williamson@redhat.com \
--cc=ashok.raj@intel.com \
--cc=dwmw2@infradead.org \
--cc=iommu@lists.linux-foundation.org \
--cc=joro@8bytes.org \
--cc=kevin.tian@intel.com \
--cc=khali@linux-fr.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tianyu.lan@intel.com \
--cc=yi.l.liu@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).