From: Jan Beulich Date: Thu, 15 Jul 2021 07:33:11 +0000 (+0200) Subject: VT-d: don't lose errors when flushing TLBs on multiple IOMMUs X-Git-Tag: archive/raspbian/4.14.3-1+rpi1^2~44^2~40 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=86c223c9818d23b92f84494389e5b76c7fc0ad29;p=xen.git VT-d: don't lose errors when flushing TLBs on multiple IOMMUs While no longer an immediate problem with flushes no longer timing out, errors (if any) get properly reported by iommu_flush_iotlb_{dsi,psi}(). Overwriting such an error with, perhaps, a success indicator received from another IOMMU will misguide callers. Record the first error, but don't bail from the loop (such that further necessary invalidation gets carried out on a best effort basis). Signed-off-by: Jan Beulich Reviewed-by: Kevin Tian master commit: e7059776f9755b989a992d229c68c3d7778412be master date: 2021-06-24 16:30:06 +0200 --- diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c index 69eba4acf5..e125e3188a 100644 --- a/xen/drivers/passthrough/vtd/iommu.c +++ b/xen/drivers/passthrough/vtd/iommu.c @@ -596,7 +596,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 @@ -604,6 +604,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) ) @@ -626,13 +628,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,