diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c index 2804d0b1b7..38719cf8ec 100644 --- a/xen/drivers/passthrough/vtd/iommu.c +++ b/xen/drivers/passthrough/vtd/iommu.c @@ -590,7 +590,7 @@ static int __must_check iommu_flush_iotlb(struct domain *d, dfn_t dfn, struct vtd_iommu *iommu; bool_t flush_dev_iotlb; int iommu_domid; - int rc = 0; + int ret = 0; /* * No need pcideves_lock here because we have flush @@ -598,6 +598,8 @@ static int __must_check iommu_flush_iotlb(struct domain *d, dfn_t dfn, */ for_each_drhd_unit ( drhd ) { + int rc; + iommu = drhd->iommu; if ( !test_bit(iommu->index, &hd->arch.iommu_bitmap) ) @@ -620,13 +622,12 @@ static int __must_check iommu_flush_iotlb(struct domain *d, dfn_t dfn, flush_dev_iotlb); if ( rc > 0 ) - { iommu_flush_write_buffer(iommu); - rc = 0; - } + else if ( !ret ) + ret = rc; } - return rc; + return ret; } static int __must_check iommu_flush_iotlb_pages(struct domain *d,