[PATCH] drm: add func to better detect wether swiotlb is needed

Konrad Rzeszutek Wilk konrad.wilk at oracle.com
Wed Feb 27 19:25:50 UTC 2019


.snip..
> > -u64 drm_get_max_iomem(void)
> > +bool drm_need_swiotlb(int dma_bits)
> >  {
> >  	struct resource *tmp;
> >  	resource_size_t max_iomem = 0;
> > 
> > +	/*
> > +	 * Xen paravirtual hosts require swiotlb regardless of requested dma
> > +	 * transfer size.
> > +	 *
> > +	 * NOTE: Really, what it requires is use of the dma_alloc_coherent
> > +	 *       allocator used in ttm_dma_populate() instead of
> > +	 *       ttm_populate_and_map_pages(), which bounce buffers so much
> > in
> > +	 *       Xen it leads to swiotlb buffer exhaustion.
> > +	 */
> > +	if (xen_pv_domain())
> 
> I've not been following all of the ins and outs of the discussion on this so apologies if I'm missing some context, but...
> 
> This looks like the wrong test to me. I think it should be:
> 
> if ( xen_swiotlb )

Ah, that could be as well. 
> 


More information about the dri-devel mailing list