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

Re: [PATCH v10 10/12] swiotlb: Add restricted DMA alloc/free support



On Tue, Jun 15, 2021 at 09:27:09PM +0800, Claire Chang wrote:
> Add the functions, swiotlb_{alloc,free} to support the memory allocation
> from restricted DMA pool.
> 
> The restricted DMA pool is preferred if available.
> 
> Note that since coherent allocation needs remapping, one must set up
> another device coherent pool by shared-dma-pool and use
> dma_alloc_from_dev_coherent instead for atomic coherent allocation.

Note: when applied this should go before the next patch to make sure
bisection works fine.

>  #ifdef CONFIG_DMA_RESTRICTED_POOL
> +struct page *swiotlb_alloc(struct device *dev, size_t size)
> +{
> +     struct io_tlb_mem *mem = dev->dma_io_tlb_mem;
> +     phys_addr_t tlb_addr;
> +     int index;
> +
> +     /*
> +      * Skip io_tlb_default_mem since swiotlb_alloc doesn't support atomic
> +      * coherent allocation. Otherwise might break existing devices.
> +      * One must set up another device coherent pool by shared-dma-pool and
> +      * use dma_alloc_from_dev_coherent instead for atomic coherent
> +      * allocation to avoid mempry remapping.

s/mempry/memory/g

Otherwise looks good:

Reviewed-by: Christoph Hellwig <hch@xxxxxx>



 


Rackspace

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