From: Christoph Hellwig <hch@infradead.org>
To: Sanket Parmar <sparmar@cadence.com>
Cc: Christoph Hellwig <hch@infradead.org>,
"peter.chen@kernel.org" <peter.chen@kernel.org>,
Pawel Laszczak <pawell@cadence.com>,
"a-govindraju@ti.com" <a-govindraju@ti.com>,
"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Rahul Kumar <kurahul@cadence.com>,
"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
"kishon@ti.com" <kishon@ti.com>
Subject: Re: [PATCH 2/2] usb: cdns3: Optimize DMA request buffer allocation
Date: Tue, 9 Mar 2021 10:31:16 +0000 [thread overview]
Message-ID: <20210309103116.GA110148@infradead.org> (raw)
In-Reply-To: <BY5PR07MB81197BAC5B801816D2B2566CB0929@BY5PR07MB8119.namprd07.prod.outlook.com>
On Tue, Mar 09, 2021 at 10:18:43AM +0000, Sanket Parmar wrote:
> > On Tue, Mar 09, 2021 at 06:19:40AM +0100, Sanket Parmar wrote:
> > > dma_alloc_coherent() might fail on the platform with a small DMA region.
> > >
> > > To avoid such failure in cdns3_prepare_aligned_request_buf(),
> > > dma_alloc_coherent() is replaced with kmalloc and dma_map API to
> > > allocate aligned request buffer of dynamic length.
> >
> > dma_alloc_noncoherent is the proper API instead of using kmalloc, which
> > can lead to unaddressable memory that might require bounce buffering.
>
> cdns3 device required DMA coherent buffer to perform operations. So
> dma_alloc_noncoherent will not help here.
>
> Also all gadget classes(except g_ether) use kmalloc to allocated request buffer,
> and device driver uses usb_gadget_map_request_by_dev to map the request
> buffer. Similar approach is used to allocate aligned buffer.
If you can use kmalloc and dma_map_single you can use
dma_alloc_noncoherent per definition.
next prev parent reply other threads:[~2021-03-09 10:32 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-09 5:19 [PATCH 1/2] usb: cdns3: Use dma_pool_* api to alloc trb pool Sanket Parmar
2021-03-09 5:19 ` [PATCH 2/2] usb: cdns3: Optimize DMA request buffer allocation Sanket Parmar
2021-03-09 9:28 ` Christoph Hellwig
2021-03-09 10:18 ` Sanket Parmar
2021-03-09 10:31 ` Christoph Hellwig [this message]
2021-03-09 10:49 ` Sanket Parmar
2021-03-14 5:10 ` Peter Chen
2021-03-15 15:51 ` Sanket Parmar
2021-03-16 0:33 ` Peter Chen
2021-03-14 2:49 ` [PATCH 1/2] usb: cdns3: Use dma_pool_* api to alloc trb pool Peter Chen
2021-03-15 6:11 ` Sanket Parmar
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=20210309103116.GA110148@infradead.org \
--to=hch@infradead.org \
--cc=a-govindraju@ti.com \
--cc=gregkh@linuxfoundation.org \
--cc=kishon@ti.com \
--cc=kurahul@cadence.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=pawell@cadence.com \
--cc=peter.chen@kernel.org \
--cc=sparmar@cadence.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