linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alan Stern <stern@rowland.harvard.edu>
To: Noam Liron <lnoam@marvell.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
	Yuval Shaia <yshaia@marvell.com>
Subject: Re: [EXT] Re: Enforce USB DMA allocations to specific range
Date: Thu, 11 Feb 2021 11:00:47 -0500	[thread overview]
Message-ID: <20210211160047.GB822348@rowland.harvard.edu> (raw)
In-Reply-To: <BYAPR18MB2741B58F5907F65C71ACF966B98C9@BYAPR18MB2741.namprd18.prod.outlook.com>

On Thu, Feb 11, 2021 at 08:38:40AM +0000, Noam Liron wrote:
> Hi Greg,
> 
> I am writing you again on the below subject, as I would like to get a "high level" opinion, and you are probably the most experienced ...
> 
> As I wrote below, I cannot rely on the DMA mask, as some USB allocation are not affected by it.
> I thought of using private DMA pool that will be allocated where I need it (at the start of physical memory). However, this means adding specific ASIC code, which is less elegant.
> Do you think that's the right way?
> 
> Thanks,
> Noam
> 
> 
> -----Original Message-----
> From: Greg KH <greg@kroah.com> 
> Sent: Monday, December 28, 2020 4:19 PM
> To: Noam Liron <lnoam@marvell.com>
> Cc: linux-usb@vger.kernel.org; Yuval Shaia <yshaia@marvell.com>
> Subject: [EXT] Re: Enforce USB DMA allocations to specific range
> 
> External Email
> 
> ----------------------------------------------------------------------
> On Mon, Dec 28, 2020 at 01:54:41PM +0000, Noam Liron wrote:
> > Hi Greg and thanks for your reply for my previous q. (Proper way to set a DMA_MASK on a USB device).
> > 
> > I am rephrasing my questions:
> > 
> > I am working on LK 4.14.76, on a SOC in which RAM starts at 0x200000000, and need to limit DMA buffer allocations to be at the range 0x200000000 -  0x220000000.
> > This is a SoC constraint.
> > Setting the controller dma_mask to 0x21FFFFFFF, didn't solve the problem, as I noticed that URB streaming DMA are first allocated by kmalloc and alike, which are not affected by the dma_mask.
> 
> Why not get support from who ever is forcing you to use that old kernel version?  You are paying them for this, right?  :)
> 
> > I plan to do the following:
> > Alloc coherent memory for the HCD using 'dma_declare_coherent_memory', and use the HCD_LOCAL_MEM so the usb core is told that it must copy data into local memory if the buffers happen to be placed in regular memory.
> > 
> > Is that the right way to deal with this case?

I think that is the correct way.  That's what the HCD_LOCAL_MEM flag was 
meant for.

Alan Stern

> Have you looked at how all of the existing host controller drivers do this?  Why will they not "just work" properly for you as well?
> What host controller driver are you using?
> 
> thanks,
> 
> greg k-h

      parent reply	other threads:[~2021-02-11 16:09 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-28 13:54 Enforce USB DMA allocations to specific range Noam Liron
2020-12-28 14:18 ` Greg KH
2020-12-28 15:18   ` [EXT] " Noam Liron
2021-02-11  8:38   ` Noam Liron
2021-02-11  9:02     ` Greg Kroah-Hartman
2021-02-11 16:00     ` Alan Stern [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=20210211160047.GB822348@rowland.harvard.edu \
    --to=stern@rowland.harvard.edu \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=lnoam@marvell.com \
    --cc=yshaia@marvell.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).