From mboxrd@z Thu Jan 1 00:00:00 1970 From: Quan Xu Subject: [Patch RFC 06/13] vt-d: Introduce a new per-domain flag - qi_flag. Date: Wed, 16 Sep 2015 09:24:00 -0400 Message-ID: <1442409847-65383-7-git-send-email-quan.xu@intel.com> References: <1442409847-65383-1-git-send-email-quan.xu@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1442409847-65383-1-git-send-email-quan.xu@intel.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: andrew.cooper3@citrix.com, eddie.dong@intel.com, ian.campbell@citrix.com, ian.jackson@eu.citrix.com, jbeulich@suse.com, jun.nakajima@intel.com, keir@xen.org, kevin.tian@intel.com, tim@xen.org, yang.z.zhang@intel.com, george.dunlap@eu.citrix.com Cc: Quan Xu , xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org The qi_flag is Set when submit Device-TLB invalidation requests. The qi_flag will be Clear in QI interrupt handler if there are no in-flight Device-TLB invalidation requests. Signed-off-by: Quan Xu --- xen/drivers/passthrough/vtd/iommu.c | 1 + xen/drivers/passthrough/vtd/qinval.c | 1 + xen/include/xen/hvm/iommu.h | 3 +++ 3 files changed, 5 insertions(+) diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c index e3acea5..fda9a84 100644 --- a/xen/drivers/passthrough/vtd/iommu.c +++ b/xen/drivers/passthrough/vtd/iommu.c @@ -1144,6 +1144,7 @@ scan_again: { qi_table_data(d) = 0; qi_table_pollslot(d) = 0; + QI_FLUSHING(d) = 0; } rcu_unlock_domain(d); } diff --git a/xen/drivers/passthrough/vtd/qinval.c b/xen/drivers/passthrough/vtd/qinval.c index abe6e9c..0d85ce7 100644 --- a/xen/drivers/passthrough/vtd/qinval.c +++ b/xen/drivers/passthrough/vtd/qinval.c @@ -165,6 +165,7 @@ static int queue_invalidate_wait(struct iommu *iommu, qinval_entry->q.inv_wait_dsc.lo.sdata = ++ qi_table_data(d); qinval_entry->q.inv_wait_dsc.hi.saddr = virt_to_maddr( &qi_table_pollslot(d)) >> 2; + QI_FLUSHING(d) = 1; rcu_unlock_domain(d); } else { qinval_entry->q.inv_wait_dsc.lo.sdata = QINVAL_STAT_DONE; diff --git a/xen/include/xen/hvm/iommu.h b/xen/include/xen/hvm/iommu.h index 28e7fc3..e838905 100644 --- a/xen/include/xen/hvm/iommu.h +++ b/xen/include/xen/hvm/iommu.h @@ -51,6 +51,7 @@ struct hvm_iommu { /* IOMMU Queued Invalidation(QI) */ struct qi_talbe talbe; + bool_t qi_flag; /* Features supported by the IOMMU */ DECLARE_BITMAP(features, IOMMU_FEAT_count); @@ -63,5 +64,7 @@ struct hvm_iommu { (d->arch.hvm_domain.hvm_iommu.talbe.qi_table_status_data) #define qi_table_pollslot(d) \ (d->arch.hvm_domain.hvm_iommu.talbe.qi_table_poll_slot) +#define QI_FLUSHING(d) \ + (d->arch.hvm_domain.hvm_iommu.qi_flag) #endif /* __XEN_HVM_IOMMU_H__ */ -- 1.8.3.2