lkml.org 
[lkml]   [2020]   [May]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH 09/15] device core: Add ability to handle multiple dma offsets
    On Wed, May 20, 2020 at 09:50:36AM -0400, Jim Quinlan wrote:
    > On Wed, May 20, 2020 at 1:43 AM Greg Kroah-Hartman
    > <gregkh@linuxfoundation.org> wrote:
    > >
    > > On Tue, May 19, 2020 at 04:34:07PM -0400, Jim Quinlan wrote:
    > > > diff --git a/include/linux/device.h b/include/linux/device.h
    > > > index ac8e37cd716a..6cd916860b5f 100644
    > > > --- a/include/linux/device.h
    > > > +++ b/include/linux/device.h
    > > > @@ -493,6 +493,8 @@ struct dev_links_info {
    > > > * @bus_dma_limit: Limit of an upstream bridge or bus which imposes a smaller
    > > > * DMA limit than the device itself supports.
    > > > * @dma_pfn_offset: offset of DMA memory range relatively of RAM
    > > > + * @dma_map: Like dma_pfn_offset but used when there are multiple
    > > > + * pfn offsets for multiple dma-ranges.
    > > > * @dma_parms: A low level driver may set these to teach IOMMU code about
    > > > * segment limitations.
    > > > * @dma_pools: Dma pools (if dma'ble device).
    > > > @@ -578,7 +580,12 @@ struct device {
    > > > allocations such descriptors. */
    > > > u64 bus_dma_limit; /* upstream dma constraint */
    > > > unsigned long dma_pfn_offset;
    > > > -
    > > > +#ifdef CONFIG_DMA_PFN_OFFSET_MAP
    > > > + const void *dma_offset_map; /* Like dma_pfn_offset, but for
    > > > + * the unlikely case of multiple
    > > > + * offsets. If non-null, dma_pfn_offset
    > > > + * will be 0. */
    > > > +#endif
    > > > struct device_dma_parameters *dma_parms;
    > > >
    > > > struct list_head dma_pools; /* dma pools (if dma'ble) */
    > >
    > > I'll defer to Christoph here, but I thought we were trying to get rid of
    > > stuff like this from struct device, not add new things to it for dma
    > Hi Greg,
    >
    > I wasn't aware of this policy. I put it in 'struct device' because
    > just like the existing dma_pfn_offset; it seemed to be the only way to
    > pull this off. I'll certainly follow any ideas on alternative
    > strategies from Christoph et al.
    >
    > > apis. And why is it a void *?
    > Just wanted to minimize the number of lines I've added to device.h, no
    > other reason.

    How would using a real type make this more lines? Never use a void *
    unless you have to, we want the compiler to check our errors for us :)

    thanks,

    greg k-h

    \
     
     \ /
      Last update: 2020-05-20 16:03    [W:3.498 / U:0.308 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site