Re: RE: [PATCH v3 0/2] usb: Check for DMA capable buffer sanity

2017-05-31 Thread Wolfram Sang
> So, if I2C is a bit different, then it might simply make sense to keep > the function local for I2C now? This seems like a sensible start to me > meanwhile. Then again, the DMA API would be for drivers. If the USB core wants to check for capable buffers, such a helper might be nice

Re: RE: [PATCH v3 0/2] usb: Check for DMA capable buffer sanity

2017-05-31 Thread Wolfram Sang
> So, if I2C is a bit different, then it might simply make sense to keep > the function local for I2C now? This seems like a sensible start to me > meanwhile. Then again, the DMA API would be for drivers. If the USB core wants to check for capable buffers, such a helper might be nice

Re: RE: [PATCH v3 0/2] usb: Check for DMA capable buffer sanity

2017-05-31 Thread Wolfram Sang
> > Possibly more useful would be a variant of (IIRC) dma_map_for_device() > > that will allocate a suitable bounce buffer for non-dma memory. > > I think it can already do so for memory that is outside the address > > range that the device can address (eg for a 32bit PCIe master in 64bit > >

Re: RE: [PATCH v3 0/2] usb: Check for DMA capable buffer sanity

2017-05-31 Thread Wolfram Sang
> > Possibly more useful would be a variant of (IIRC) dma_map_for_device() > > that will allocate a suitable bounce buffer for non-dma memory. > > I think it can already do so for memory that is outside the address > > range that the device can address (eg for a 32bit PCIe master in 64bit > >

Re: [PATCH v3 0/2] usb: Check for DMA capable buffer sanity

2017-05-31 Thread Wolfram Sang
> > +/* only works in process context because of stack detection */ > > +static inline bool is_dma_capable_addr(void *addr) > > +{ > > + return !(is_vmalloc_or_module_addr(addr) || > > +object_is_on_stack(addr)); > > This does not catch kmap'ed buffers which are not directly

Re: [PATCH v3 0/2] usb: Check for DMA capable buffer sanity

2017-05-31 Thread Wolfram Sang
> > +/* only works in process context because of stack detection */ > > +static inline bool is_dma_capable_addr(void *addr) > > +{ > > + return !(is_vmalloc_or_module_addr(addr) || > > +object_is_on_stack(addr)); > > This does not catch kmap'ed buffers which are not directly

Re: [PATCH v3 0/2] usb: Check for DMA capable buffer sanity

2017-05-31 Thread Vignesh R
On Sunday 28 May 2017 09:33 PM, Wolfram Sang wrote: > On Fri, May 05, 2017 at 02:08:31PM -0700, Florian Fainelli wrote: >> On 04/25/2017 05:56 PM, Florian Fainelli wrote: >>> Changes in v3: >>> >>> - added check in usb_gadget_map_request_by_dev (Felipe), new patch >>> - improved commit message

Re: [PATCH v3 0/2] usb: Check for DMA capable buffer sanity

2017-05-31 Thread Vignesh R
On Sunday 28 May 2017 09:33 PM, Wolfram Sang wrote: > On Fri, May 05, 2017 at 02:08:31PM -0700, Florian Fainelli wrote: >> On 04/25/2017 05:56 PM, Florian Fainelli wrote: >>> Changes in v3: >>> >>> - added check in usb_gadget_map_request_by_dev (Felipe), new patch >>> - improved commit message

Re: RE: [PATCH v3 0/2] usb: Check for DMA capable buffer sanity

2017-05-31 Thread Vignesh R
On Wednesday 31 May 2017 04:34 PM, David Laight wrote: > From: Wolfram Sang >> Sent: 28 May 2017 17:04 >> >> On Fri, May 05, 2017 at 02:08:31PM -0700, Florian Fainelli wrote: >>> On 04/25/2017 05:56 PM, Florian Fainelli wrote: Changes in v3: - added check in

Re: RE: [PATCH v3 0/2] usb: Check for DMA capable buffer sanity

2017-05-31 Thread Vignesh R
On Wednesday 31 May 2017 04:34 PM, David Laight wrote: > From: Wolfram Sang >> Sent: 28 May 2017 17:04 >> >> On Fri, May 05, 2017 at 02:08:31PM -0700, Florian Fainelli wrote: >>> On 04/25/2017 05:56 PM, Florian Fainelli wrote: Changes in v3: - added check in

RE: [PATCH v3 0/2] usb: Check for DMA capable buffer sanity

2017-05-31 Thread David Laight
From: Wolfram Sang > Sent: 28 May 2017 17:04 > > On Fri, May 05, 2017 at 02:08:31PM -0700, Florian Fainelli wrote: > > On 04/25/2017 05:56 PM, Florian Fainelli wrote: > > > Changes in v3: > > > > > > - added check in usb_gadget_map_request_by_dev (Felipe), new patch > > > - improved commit

RE: [PATCH v3 0/2] usb: Check for DMA capable buffer sanity

2017-05-31 Thread David Laight
From: Wolfram Sang > Sent: 28 May 2017 17:04 > > On Fri, May 05, 2017 at 02:08:31PM -0700, Florian Fainelli wrote: > > On 04/25/2017 05:56 PM, Florian Fainelli wrote: > > > Changes in v3: > > > > > > - added check in usb_gadget_map_request_by_dev (Felipe), new patch > > > - improved commit

Re: [PATCH v3 0/2] usb: Check for DMA capable buffer sanity

2017-05-28 Thread Wolfram Sang
On Fri, May 05, 2017 at 02:08:31PM -0700, Florian Fainelli wrote: > On 04/25/2017 05:56 PM, Florian Fainelli wrote: > > Changes in v3: > > > > - added check in usb_gadget_map_request_by_dev (Felipe), new patch > > - improved commit message description (Clemens) > > - added additiona checks for

Re: [PATCH v3 0/2] usb: Check for DMA capable buffer sanity

2017-05-28 Thread Wolfram Sang
On Fri, May 05, 2017 at 02:08:31PM -0700, Florian Fainelli wrote: > On 04/25/2017 05:56 PM, Florian Fainelli wrote: > > Changes in v3: > > > > - added check in usb_gadget_map_request_by_dev (Felipe), new patch > > - improved commit message description (Clemens) > > - added additiona checks for

Re: [PATCH v3 0/2] usb: Check for DMA capable buffer sanity

2017-05-05 Thread Florian Fainelli
On 04/25/2017 05:56 PM, Florian Fainelli wrote: > Changes in v3: > > - added check in usb_gadget_map_request_by_dev (Felipe), new patch > - improved commit message description (Clemens) > - added additiona checks for urb->setup_packet (Alan) > > Changes in v2: > > - moved the check from

Re: [PATCH v3 0/2] usb: Check for DMA capable buffer sanity

2017-05-05 Thread Florian Fainelli
On 04/25/2017 05:56 PM, Florian Fainelli wrote: > Changes in v3: > > - added check in usb_gadget_map_request_by_dev (Felipe), new patch > - improved commit message description (Clemens) > - added additiona checks for urb->setup_packet (Alan) > > Changes in v2: > > - moved the check from