iommu.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Nicolin Chen <nicoleotsuka@gmail.com>
Cc: iommu@lists.linux-foundation.org, robin.murphy@arm.com,
	Christoph Hellwig <hch@lst.de>
Subject: Re: [PATCH] dma-contiguous: cleanup dma_alloc_contiguous
Date: Thu, 23 Jul 2020 08:09:47 +0200	[thread overview]
Message-ID: <20200723060947.GA10381@lst.de> (raw)
In-Reply-To: <20200723060047.GE5476@Asurada-Nvidia>

On Wed, Jul 22, 2020 at 11:00:48PM -0700, Nicolin Chen wrote:
> On Wed, Jul 22, 2020 at 04:43:07PM +0200, Christoph Hellwig wrote:
> > Split out a cma_alloc_aligned helper to deal with the "interesting"
> > calling conventions for cma_alloc, which then allows to the main
> > function to be written straight forward.  This also takes advantage
> > of the fact that NULL dev arguments have been gone from the DMA API
> > for a while.
> > 
> > Signed-off-by: Christoph Hellwig <hch@lst.de>
> > ---
> >  kernel/dma/contiguous.c | 31 ++++++++++++++-----------------
> >  1 file changed, 14 insertions(+), 17 deletions(-)
> > 
> > diff --git a/kernel/dma/contiguous.c b/kernel/dma/contiguous.c
> > index 15bc5026c485f2..f16b8d3f9932de 100644
> > --- a/kernel/dma/contiguous.c
> > +++ b/kernel/dma/contiguous.c
> > @@ -215,6 +215,13 @@ bool dma_release_from_contiguous(struct device *dev, struct page *pages,
> >  	return cma_release(dev_get_cma_area(dev), pages, count);
> >  }
> >  
> > +static struct page *cma_alloc_aligned(struct cma *cma, size_t size, gfp_t gfp)
> > +{
> > +	return cma_alloc(dma_contiguous_default_area, size >> PAGE_SHIFT,
> 
> Probably should be 'cma' here instead of 'dma_contiguous_default_area'?

Yes.  If only I could test the per-device CMAs on a normal x86 setup :)
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

      reply	other threads:[~2020-07-23  6:09 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-22 14:43 [PATCH] dma-contiguous: cleanup dma_alloc_contiguous Christoph Hellwig
2020-07-23  6:00 ` Nicolin Chen
2020-07-23  6:09   ` Christoph Hellwig [this message]

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=20200723060947.GA10381@lst.de \
    --to=hch@lst.de \
    --cc=iommu@lists.linux-foundation.org \
    --cc=nicoleotsuka@gmail.com \
    --cc=robin.murphy@arm.com \
    /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).