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

Re: [Xen-devel] [PATCH v2 2/2] swiotlb-xen: implement xen_swiotlb_get_sgtable callback



On Wed, 18 Jan 2017, Andrii Anisov wrote:
> Stefano,
> 
> About this piece:
> 
> >
> > -       if (__generic_dma_ops(dev)->get_sgtable)
> > +
> > +       if (__generic_dma_ops(dev)->get_sgtable) {
> > +               /* We can't handle foreign pages here. */
> > +#ifdef CONFIG_ARM
> > +               unsigned long bfn = dma_to_pfn(dev, handle);
> > +#else
> > +               unsigned long bfn = handle >> PAGE_SHIFT;
> > +#endif
> > +               BUG_ON (!page_is_ram(bfn));
> >                 return __generic_dma_ops(dev)->get_sgtable(dev, sgt, 
> > cpu_addr, handle,
> >                                                                  size, 
> > attrs);
> > +       }
> >         return dma_common_get_sgtable(dev, sgt, cpu_addr, handle, size);
> >  }
> 
> 
> Would it be in drivers/xen/swiotlb-xen.c as you suggested, the whole
> "if (__generic_dma_ops(dev)->get_sgtable) {}" should be under ifdef.
> 
> IMO it would be better to avoid ifdefs in drivers/xen/swiotlb-xen.c,
> but I haven't find out how to do that.

Yes, I dislike ifdef like everybody else, but sometimes they are
unavoidable.

But please test this code because I only compile tested it :-)

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

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