From: "Xu, Quan" <quan.xu@intel.com>
To: xen-devel@lists.xen.org
Cc: Kevin Tian <kevin.tian@intel.com>, Feng Wu <feng.wu@intel.com>,
Quan Xu <quan.xu@intel.com>,
dario.faggioli@citrix.com, Julien Grall <julien.grall@arm.com>,
Jan Beulich <jbeulich@suse.com>,
Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
Subject: [PATCH v12 5/6] IOMMU: move the domain crash logic up to the generic IOMMU layer
Date: Fri, 24 Jun 2016 13:51:57 +0800 [thread overview]
Message-ID: <1466747518-54402-6-git-send-email-quan.xu@intel.com> (raw)
In-Reply-To: <1466747518-54402-1-git-send-email-quan.xu@intel.com>
From: Quan Xu <quan.xu@intel.com>
Signed-off-by: Quan Xu <quan.xu@intel.com>
CC: Julien Grall <julien.grall@arm.com>
CC: Kevin Tian <kevin.tian@intel.com>
CC: Feng Wu <feng.wu@intel.com>
CC: Jan Beulich <jbeulich@suse.com>
CC: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
---
xen/drivers/passthrough/iommu.c | 30 ++++++++++++++++++++++++++++--
xen/drivers/passthrough/vtd/iommu.c | 11 +++++++++++
2 files changed, 39 insertions(+), 2 deletions(-)
diff --git a/xen/drivers/passthrough/iommu.c b/xen/drivers/passthrough/iommu.c
index 7656aeb..d793f5d 100644
--- a/xen/drivers/passthrough/iommu.c
+++ b/xen/drivers/passthrough/iommu.c
@@ -318,21 +318,47 @@ int iommu_iotlb_flush(struct domain *d, unsigned long gfn,
unsigned int page_count)
{
const struct domain_iommu *hd = dom_iommu(d);
+ int rc;
if ( !iommu_enabled || !hd->platform_ops || !hd->platform_ops->iotlb_flush )
return 0;
- return hd->platform_ops->iotlb_flush(d, gfn, page_count);
+ rc = hd->platform_ops->iotlb_flush(d, gfn, page_count);
+ if ( unlikely(rc) )
+ {
+ if ( !d->is_shutting_down && printk_ratelimit() )
+ printk(XENLOG_ERR
+ "d%d: IOMMU IOTLB flush failed: %d, gfn %#lx, page count %u\n",
+ d->domain_id, rc, gfn, page_count);
+
+ if ( !is_hardware_domain(d) )
+ domain_crash(d);
+ }
+
+ return rc;
}
int iommu_iotlb_flush_all(struct domain *d)
{
const struct domain_iommu *hd = dom_iommu(d);
+ int rc;
if ( !iommu_enabled || !hd->platform_ops || !hd->platform_ops->iotlb_flush_all )
return 0;
- return hd->platform_ops->iotlb_flush_all(d);
+ rc = hd->platform_ops->iotlb_flush_all(d);
+ if ( unlikely(rc) )
+ {
+ if ( !d->is_shutting_down && printk_ratelimit() )
+ printk(XENLOG_ERR
+ "d%d: IOMMU IOTLB flush all failed: %d\n",
+ d->domain_id, rc);
+
+ if ( !is_hardware_domain(d) )
+ domain_crash(d);
+ }
+
+ return rc;
}
int __init iommu_setup(void)
diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index 1b0a0f0..82332c8 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -1847,6 +1847,17 @@ int iommu_pte_flush(struct domain *d, u64 gfn, u64 *pte,
}
}
+ if ( unlikely(rc) )
+ {
+ if ( !d->is_shutting_down && printk_ratelimit() )
+ printk(XENLOG_ERR VTDPREFIX
+ " d%d: IOMMU pages flush failed: %d\n",
+ d->domain_id, rc);
+
+ if ( !is_hardware_domain(d) )
+ domain_crash(d);
+ }
+
return rc;
}
--
1.9.1
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
next prev parent reply other threads:[~2016-06-24 5:51 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-24 5:51 [PATCH v12 0/6] VT-d Device-TLB flush issue Xu, Quan
2016-06-24 5:51 ` [PATCH v12 1/6] IOMMU: add a timeout parameter for device IOTLB invalidation Xu, Quan
2016-06-24 11:30 ` Tian, Kevin
2016-06-27 8:03 ` Jan Beulich
2016-06-27 8:19 ` Xu, Quan
2016-06-27 8:28 ` Jan Beulich
2016-06-27 8:34 ` Xu, Quan
2016-06-24 5:51 ` [PATCH v12 2/6] vt-d: synchronize for Device-TLB flush one by one Xu, Quan
2016-06-24 11:33 ` Tian, Kevin
2016-06-24 5:51 ` [PATCH v12 3/6] vt-d: convert conditionals of qi_ctrl->qinval_maddr into ASSERT()s Xu, Quan
2016-06-24 11:35 ` Tian, Kevin
2016-06-24 5:51 ` [PATCH v12 4/6] IOMMU/x86: using a struct pci_dev* instead of SBDF Xu, Quan
2016-06-24 11:46 ` Tian, Kevin
2016-06-26 8:57 ` Xu, Quan
2016-06-26 10:32 ` Xu, Quan
2016-06-29 1:59 ` Tian, Kevin
2016-06-27 8:17 ` Jan Beulich
2016-06-27 8:25 ` Jan Beulich
2016-06-27 11:11 ` Xu, Quan
2016-06-27 15:19 ` Jan Beulich
2016-06-28 1:31 ` Xu, Quan
2016-06-24 5:51 ` Xu, Quan [this message]
2016-06-24 11:48 ` [PATCH v12 5/6] IOMMU: move the domain crash logic up to the generic IOMMU layer Tian, Kevin
2016-06-26 8:58 ` Xu, Quan
2016-06-27 8:18 ` Jan Beulich
2016-06-24 5:51 ` [PATCH v12 6/6] vt-d: fix vt-d Device-TLB flush timeout issue Xu, Quan
2016-06-24 11:55 ` Tian, Kevin
2016-06-24 12:54 ` Jan Beulich
2016-06-26 9:18 ` Xu, Quan
2016-06-27 7:56 ` Jan Beulich
2016-06-27 8:24 ` Jan Beulich
2016-06-27 12:56 ` Xu, Quan
2016-06-27 15:21 ` Jan Beulich
2016-06-28 7:06 ` Xu, Quan
2016-06-28 7:24 ` Jan Beulich
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=1466747518-54402-6-git-send-email-quan.xu@intel.com \
--to=quan.xu@intel.com \
--cc=dario.faggioli@citrix.com \
--cc=feng.wu@intel.com \
--cc=jbeulich@suse.com \
--cc=julien.grall@arm.com \
--cc=kevin.tian@intel.com \
--cc=suravee.suthikulpanit@amd.com \
--cc=xen-devel@lists.xen.org \
/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).