[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20190911103517.GA21988@8bytes.org>
Date: Wed, 11 Sep 2019 12:35:18 +0200
From: Joerg Roedel <joro@...tes.org>
To: Lu Baolu <baolu.lu@...ux.intel.com>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@...cle.com>,
David Woodhouse <dwmw2@...radead.org>,
Bjorn Helgaas <bhelgaas@...gle.com>,
Christoph Hellwig <hch@....de>, ashok.raj@...el.com,
jacob.jun.pan@...el.com, alan.cox@...el.com, kevin.tian@...el.com,
mika.westerberg@...ux.intel.com, Ingo Molnar <mingo@...hat.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
pengfei.xu@...el.com, Marek Szyprowski <m.szyprowski@...sung.com>,
Robin Murphy <robin.murphy@....com>,
Jonathan Corbet <corbet@....net>,
Boris Ostrovsky <boris.ostrovsky@...cle.com>,
Juergen Gross <jgross@...e.com>,
Stefano Stabellini <sstabellini@...nel.org>,
Steven Rostedt <rostedt@...dmis.org>,
iommu@...ts.linux-foundation.org, linux-kernel@...r.kernel.org
Subject: Re: [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.
Powered by blists - more mailing lists