lkml.org 
[lkml]   [2019]   [Sep]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v9 1/5] swiotlb: Split size parameter to map/unmap APIs
On Wed, Sep 11, 2019 at 02:16:07PM +0800, Lu Baolu wrote:
> How about this change?
>
> diff --git a/kernel/dma/swiotlb.c b/kernel/dma/swiotlb.c
> index 89066efa3840..22a7848caca3 100644
> --- a/kernel/dma/swiotlb.c
> +++ b/kernel/dma/swiotlb.c
> @@ -466,8 +466,11 @@ phys_addr_t swiotlb_tbl_map_single(struct device
> *hwdev,
> pr_warn_once("%s is active and system is using DMA bounce
> buffers\n",
> sme_active() ? "SME" : "SEV");
>
> - if (WARN_ON(mapping_size > alloc_size))
> + if (mapping_size > alloc_size) {
> + dev_warn_once(hwdev, "Invalid sizes (mapping: %zd bytes,
> alloc: %zd bytes)",
> + mapping_size, alloc_size);
> return (phys_addr_t)DMA_MAPPING_ERROR;
> + }
>
> mask = dma_get_seg_boundary(hwdev);
>
> @@ -584,9 +587,6 @@ void swiotlb_tbl_unmap_single(struct device *hwdev,
> phys_addr_t tlb_addr,
> int index = (tlb_addr - io_tlb_start) >> IO_TLB_SHIFT;
> phys_addr_t orig_addr = io_tlb_orig_addr[index];
>
> - if (WARN_ON(mapping_size > alloc_size))
> - return;
> -
> /*
> * First, sync the memory before unmapping the entry
> */

Folded that into the commit, thanks Lu Baolu.

\
 
 \ /
  Last update: 2019-09-11 12:35    [W:0.025 / U:49.908 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site