lkml.org 
[lkml]   [2019]   [Sep]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
SubjectRe: [PATCH v9 1/5] swiotlb: Split size parameter to map/unmap APIs
From
Date
Hi,

On 9/10/19 11:15 PM, Konrad Rzeszutek Wilk wrote:
> On Fri, Sep 06, 2019 at 02:14:48PM +0800, Lu Baolu wrote:
>> This splits the size parameter to swiotlb_tbl_map_single() and
>> swiotlb_tbl_unmap_single() into an alloc_size and a mapping_size
>> parameter, where the latter one is rounded up to the iommu page
>> size.
> It does a bit more too. You have the WARN_ON. Can you make it be
> more verbose (as in details of which device requested it) and also use printk_once or so please?

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
*/
Best regards,
Baolu

\
 
 \ /
  Last update: 2019-09-11 08:19    [W:0.046 / U:0.080 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site