[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH 3/7] iommu: push use of type-safe BFN and MFN into iommu_ops



> -----Original Message-----
> From: Jan Beulich [mailto:JBeulich@xxxxxxxx]
> Sent: 15 March 2018 16:16
> To: Paul Durrant <Paul.Durrant@xxxxxxxxxx>
> Cc: Suravee Suthikulpanit <suravee.suthikulpanit@xxxxxxx>; Andrew
> Cooper <Andrew.Cooper3@xxxxxxxxxx>; Kevin Tian <kevin.tian@xxxxxxxxx>;
> xen-devel@xxxxxxxxxxxxxxxxxxxx
> Subject: Re: [PATCH 3/7] iommu: push use of type-safe BFN and MFN into
> iommu_ops
> 
> >>> On 12.02.18 at 11:47, <paul.durrant@xxxxxxxxxx> wrote:
> > @@ -612,12 +612,12 @@ static int __must_check iommu_flush_iotlb(struct
> domain *d,
> >          if ( iommu_domid == -1 )
> >              continue;
> >
> > -        if ( page_count != 1 || bfn == bfn_x(INVALID_BFN) )
> > +        if ( page_count != 1 || bfn_eq(bfn, INVALID_BFN) )
> >              rc = iommu_flush_iotlb_dsi(iommu, iommu_domid,
> >                                         0, flush_dev_iotlb);
> >          else
> >              rc = iommu_flush_iotlb_psi(iommu, iommu_domid,
> > -                                       (paddr_t)bfn << PAGE_SHIFT_4K,
> > +                                       (paddr_t)bfn_x(bfn) << 
> > PAGE_SHIFT_4K,
> 
> The latest at this point you'll need to introduce bfn_to_baddr(). I
> also have a hard time seeing how this can then validly be cast to
> paddr_t.
> 

Well, it does look a little bogus... adding a bfn_to_baddr() does indeed sound 
like the best idea.

> > @@ -676,7 +676,8 @@ static int __must_check dma_pte_clear_one(struct
> domain *domain, u64 addr)
> >      iommu_flush_cache_entry(pte, sizeof(struct dma_pte));
> >
> >      if ( !this_cpu(iommu_dont_flush_iotlb) )
> > -        rc = iommu_flush_iotlb_pages(domain, addr >> PAGE_SHIFT_4K, 1);
> > +        rc = iommu_flush_iotlb_pages(domain, _bfn(addr >>
> PAGE_SHIFT_4K),
> 
> And baddr_to_bfn().
> 

Sure.

  Paul

> Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.