|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v5 01/10] vt-d: fix the IOMMU flush issue
On May 23, 2016 9:31 PM, Jan Beulich <JBeulich@xxxxxxxx> wrote:
> >>> On 18.05.16 at 10:08, <quan.xu@xxxxxxxxx> wrote:
> > --- a/xen/drivers/passthrough/vtd/iommu.c
> > +++ b/xen/drivers/passthrough/vtd/iommu.c
> > @@ -1391,13 +1399,26 @@ int domain_context_mapping_one(
> > spin_unlock(&iommu->lock);
> >
> > /* Context entry was previously non-present (with domid 0). */
> > - if ( iommu_flush_context_device(iommu, 0, (((u16)bus) << 8) | devfn,
> > - DMA_CCMD_MASK_NOBIT, 1) )
> > - iommu_flush_write_buffer(iommu);
> > - else
> > + rc = iommu_flush_context_device(iommu, 0, (((u16)bus) << 8) |
> > + devfn,
> > + DMA_CCMD_MASK_NOBIT, 1);
> > +
> > + /*
> > + * The current logic for rc returns:
> > + * - positive invoke iommu_flush_write_buffer to flush cache.
> > + * - zero success.
> > + * - negative failure. Continue to flush IOMMU IOTLB on a best
> > + * effort basis.
> > + */
> > + if ( rc <= 0 )
> > {
> > int flush_dev_iotlb = find_ats_dev_drhd(iommu) ? 1 : 0;
> > - iommu_flush_iotlb_dsi(iommu, 0, 1, flush_dev_iotlb);
> > +
> > + rc = iommu_flush_iotlb_dsi(iommu, 0, 1, flush_dev_iotlb);
>
> If rc was negative before this call, you may end up returning success without
> having been successful.
You are right.
IMO I need to add 'ret' here. Then ..
+ if ( rc <= 0 )
{
int flush_dev_iotlb = find_ats_dev_drhd(iommu) ? 1 : 0;
- iommu_flush_iotlb_dsi(iommu, iommu_domid, 0, flush_dev_iotlb);
+ int ret;
+
+ ret = iommu_flush_iotlb_dsi(iommu, iommu_domid, 0, flush_dev_iotlb);
+ ASSERT(ret <= 0);
+
+ if ( !rc )
+ rc = ret;
+ }
Quan
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |