linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Joerg Roedel <joro@8bytes.org>
To: Lu Baolu <baolu.lu@linux.intel.com>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
	David Woodhouse <dwmw2@infradead.org>,
	Bjorn Helgaas <bhelgaas@google.com>,
	Christoph Hellwig <hch@lst.de>,
	ashok.raj@intel.com, jacob.jun.pan@intel.com, alan.cox@intel.com,
	kevin.tian@intel.com, mika.westerberg@linux.intel.com,
	Ingo Molnar <mingo@redhat.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	pengfei.xu@intel.com, Marek Szyprowski <m.szyprowski@samsung.com>,
	Robin Murphy <robin.murphy@arm.com>,
	Jonathan Corbet <corbet@lwn.net>,
	Boris Ostrovsky <boris.ostrovsky@oracle.com>,
	Juergen Gross <jgross@suse.com>,
	Stefano Stabellini <sstabellini@kernel.org>,
	Steven Rostedt <rostedt@goodmis.org>,
	iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v9 1/5] swiotlb: Split size parameter to map/unmap APIs
Date: Wed, 11 Sep 2019 12:35:18 +0200	[thread overview]
Message-ID: <20190911103517.GA21988@8bytes.org> (raw)
In-Reply-To: <0b939480-cb99-46fe-374e-a31441d21486@linux.intel.com>

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.

  reply	other threads:[~2019-09-11 10:35 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-06  6:14 [PATCH v9 0/5] iommu: Bounce page for untrusted devices Lu Baolu
2019-09-06  6:14 ` [PATCH v9 1/5] swiotlb: Split size parameter to map/unmap APIs Lu Baolu
2019-09-10 15:15   ` Konrad Rzeszutek Wilk
2019-09-11  6:16     ` Lu Baolu
2019-09-11 10:35       ` Joerg Roedel [this message]
2019-09-06  6:14 ` [PATCH v9 2/5] iommu/vt-d: Check whether device requires bounce buffer Lu Baolu
2019-09-06  6:14 ` [PATCH v9 3/5] iommu/vt-d: Don't switch off swiotlb if bounce page is used Lu Baolu
2019-09-06  6:14 ` [PATCH v9 4/5] iommu/vt-d: Add trace events for device dma map/unmap Lu Baolu
2019-09-06  6:14 ` [PATCH v9 5/5] iommu/vt-d: Use bounce buffer for untrusted devices Lu Baolu
2019-09-10 14:53 ` [PATCH v9 0/5] iommu: Bounce page " Joerg Roedel
2019-09-10 15:21   ` Konrad Rzeszutek Wilk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190911103517.GA21988@8bytes.org \
    --to=joro@8bytes.org \
    --cc=alan.cox@intel.com \
    --cc=ashok.raj@intel.com \
    --cc=baolu.lu@linux.intel.com \
    --cc=bhelgaas@google.com \
    --cc=boris.ostrovsky@oracle.com \
    --cc=corbet@lwn.net \
    --cc=dwmw2@infradead.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=hch@lst.de \
    --cc=iommu@lists.linux-foundation.org \
    --cc=jacob.jun.pan@intel.com \
    --cc=jgross@suse.com \
    --cc=kevin.tian@intel.com \
    --cc=konrad.wilk@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=m.szyprowski@samsung.com \
    --cc=mika.westerberg@linux.intel.com \
    --cc=mingo@redhat.com \
    --cc=pengfei.xu@intel.com \
    --cc=robin.murphy@arm.com \
    --cc=rostedt@goodmis.org \
    --cc=sstabellini@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).