06 Oct, 2020

1 commit

  • Extend __sg_alloc_table_from_pages to support dynamic allocation of
    SG table from pages. It should be used by drivers that can't supply
    all the pages at one time.

    This function returns the last populated SGE in the table. Users should
    pass it as an argument to the function from the second call and forward.
    As before, nents will be equal to the number of populated SGEs (chunks).

    With this new extension, drivers can benefit the optimization of merging
    contiguous pages without a need to allocate all pages in advance and
    hold them in a large buffer.

    E.g. with the Infiniband driver that allocates a single page for hold the
    pages. For 1TB memory registration, the temporary buffer would consume only
    4KB, instead of 2GB.

    Link: https://lore.kernel.org/r/20201004154340.1080481-2-leon@kernel.org
    Signed-off-by: Maor Gottlieb
    Reviewed-by: Christoph Hellwig
    Signed-off-by: Leon Romanovsky
    Signed-off-by: Jason Gunthorpe

    Maor Gottlieb
     

06 Jul, 2020

1 commit


13 May, 2020

1 commit

  • struct sg_table is a common structure used for describing a memory
    buffer. It consists of a scatterlist with memory pages and DMA addresses
    (sgl entry), as well as the number of scatterlist entries: CPU pages
    (orig_nents entry) and DMA mapped pages (nents entry).

    It turned out that it was a common mistake to misuse nents and orig_nents
    entries, calling the scatterlist iterating functions with a wrong number
    of the entries.

    To avoid such issues, lets introduce a common wrappers operating directly
    on the struct sg_table objects, which take care of the proper use of
    the nents and orig_nents entries.

    While touching this, lets clarify some ambiguities in the comments for
    the existing for_each helpers.

    Signed-off-by: Marek Szyprowski
    Reviewed-by: Robin Murphy
    Signed-off-by: Christoph Hellwig

    Marek Szyprowski
     

21 Jun, 2019

1 commit

  • sg_alloc_table_chained() currently allows the caller to provide one
    preallocated SGL and returns if the requested number isn't bigger than
    size of that SGL. This is used to inline an SGL for an IO request.

    However, scattergather code only allows that size of the 1st preallocated
    SGL to be SG_CHUNK_SIZE(128). This means a substantial amount of memory
    (4KB) is claimed for the SGL for each IO request. If the I/O is small, it
    would be prudent to allocate a smaller SGL.

    Introduce an extra parameter to sg_alloc_table_chained() and
    sg_free_table_chained() for specifying size of the preallocated SGL.

    Both __sg_free_table() and __sg_alloc_table() assume that each SGL has the
    same size except for the last one. Change the code to allow both functions
    to accept a variable size for the 1st preallocated SGL.

    [mkp: attempted to clarify commit desc]

    Cc: Christoph Hellwig
    Cc: Bart Van Assche
    Cc: Ewan D. Milne
    Cc: Hannes Reinecke
    Cc: Sagi Grimberg
    Cc: Chuck Lever
    Cc: netdev@vger.kernel.org
    Cc: linux-nvme@lists.infradead.org
    Suggested-by: Christoph Hellwig
    Signed-off-by: Ming Lei
    Reviewed-by: Christoph Hellwig
    Signed-off-by: Martin K. Petersen

    Ming Lei
     

07 May, 2019

1 commit


12 Feb, 2019

1 commit

  • Commit 2db76d7c3c6d ("lib/scatterlist: sg_page_iter: support sg lists w/o
    backing pages") introduced the sg_page_iter_dma_address() function without
    providing a way to use it in the general case. If the sg_dma_len() is not
    equal to the sg length callers cannot safely use the
    for_each_sg_page/sg_page_iter_dma_address combination.

    Resolve this API mistake by providing a DMA specific iterator,
    for_each_sg_dma_page(), that uses the right length so
    sg_page_iter_dma_address() works as expected with all sglists.

    A new iterator type is introduced to provide compile-time safety against
    wrongly mixing accessors and iterators.

    Acked-by: Christoph Hellwig (for scatterlist)
    Acked-by: Thomas Hellstrom
    Acked-by: Sakari Ailus (ipu3-cio2)
    Signed-off-by: Jason Gunthorpe

    Jason Gunthorpe
     

06 Dec, 2018

1 commit

  • These days architectures are mostly out of the business of dealing with
    struct scatterlist at all, unless they have architecture specific iommu
    drivers. Replace the ARCH_HAS_SG_CHAIN symbol with a ARCH_NO_SG_CHAIN
    one only enabled for architectures with horrible legacy iommu drivers
    like alpha and parisc, and conditionally for arm which wants to keep it
    disable for legacy platforms.

    Signed-off-by: Christoph Hellwig
    Reviewed-by: Palmer Dabbelt

    Christoph Hellwig
     

29 Jun, 2018

1 commit

  • This was introduced more than a decade ago when sg chaining was
    added, but we never really caught anything with it. The scatterlist
    entry size can be critical, since drivers allocate it, so remove
    the magic member. Recently it's been triggering allocation stalls
    and failures in NVMe.

    Tested-by: Jordan Glover
    Acked-by: Christoph Hellwig
    Signed-off-by: Jens Axboe

    Jens Axboe
     

06 Apr, 2018

1 commit

  • Pull block layer updates from Jens Axboe:
    "It's a pretty quiet round this time, which is nice. This contains:

    - series from Bart, cleaning up the way we set/test/clear atomic
    queue flags.

    - series from Bart, fixing races between gendisk and queue
    registration and removal.

    - set of bcache fixes and improvements from various folks, by way of
    Michael Lyle.

    - set of lightnvm updates from Matias, most of it being the 1.2 to
    2.0 transition.

    - removal of unused DIO flags from Nikolay.

    - blk-mq/sbitmap memory ordering fixes from Omar.

    - divide-by-zero fix for BFQ from Paolo.

    - minor documentation patches from Randy.

    - timeout fix from Tejun.

    - Alpha "can't write a char atomically" fix from Mikulas.

    - set of NVMe fixes by way of Keith.

    - bsg and bsg-lib improvements from Christoph.

    - a few sed-opal fixes from Jonas.

    - cdrom check-disk-change deadlock fix from Maurizio.

    - various little fixes, comment fixes, etc from various folks"

    * tag 'for-4.17/block-20180402' of git://git.kernel.dk/linux-block: (139 commits)
    blk-mq: Directly schedule q->timeout_work when aborting a request
    blktrace: fix comment in blktrace_api.h
    lightnvm: remove function name in strings
    lightnvm: pblk: remove some unnecessary NULL checks
    lightnvm: pblk: don't recover unwritten lines
    lightnvm: pblk: implement 2.0 support
    lightnvm: pblk: implement get log report chunk
    lightnvm: pblk: rename ppaf* to addrf*
    lightnvm: pblk: check for supported version
    lightnvm: implement get log report chunk helpers
    lightnvm: make address conversions depend on generic device
    lightnvm: add support for 2.0 address format
    lightnvm: normalize geometry nomenclature
    lightnvm: complete geo structure with maxoc*
    lightnvm: add shorten OCSSD version in geo
    lightnvm: add minor version to generic geometry
    lightnvm: simplify geometry structure
    lightnvm: pblk: refactor init/exit sequences
    lightnvm: Avoid validation of default op value
    lightnvm: centralize permission check for lightnvm ioctl
    ...

    Linus Torvalds
     

31 Mar, 2018

1 commit

  • sg_init_marker initializes sg_magic in the sg table and calls
    sg_mark_end() on the last entry of the table. This can be useful to
    avoid memset in sg_init_table() when scatterlist is already zeroed out

    For example: when scatterlist is embedded inside other struct and that
    container struct is zeroed out

    Suggested-by: Daniel Borkmann
    Signed-off-by: Prashant Bhole
    Acked-by: John Fastabend
    Signed-off-by: Daniel Borkmann

    Prashant Bhole
     

01 Mar, 2018

1 commit


20 Jan, 2018

1 commit

  • This patch avoids that workloads with large block sizes (megabytes)
    can trigger the following call stack with the ib_srpt driver (that
    driver is the only driver that chains scatterlists allocated by
    sgl_alloc_order()):

    BUG: Bad page state in process kworker/0:1H pfn:2423a78
    page:fffffb03d08e9e00 count:-3 mapcount:0 mapping: (null) index:0x0
    flags: 0x57ffffc0000000()
    raw: 0057ffffc0000000 0000000000000000 0000000000000000 fffffffdffffffff
    raw: dead000000000100 dead000000000200 0000000000000000 0000000000000000
    page dumped because: nonzero _count
    CPU: 0 PID: 733 Comm: kworker/0:1H Tainted: G I 4.15.0-rc7.bart+ #1
    Hardware name: HP ProLiant DL380 G7, BIOS P67 08/16/2015
    Workqueue: ib-comp-wq ib_cq_poll_work [ib_core]
    Call Trace:
    dump_stack+0x5c/0x83
    bad_page+0xf5/0x10f
    get_page_from_freelist+0xa46/0x11b0
    __alloc_pages_nodemask+0x103/0x290
    sgl_alloc_order+0x101/0x180
    target_alloc_sgl+0x2c/0x40 [target_core_mod]
    srpt_alloc_rw_ctxs+0x173/0x2d0 [ib_srpt]
    srpt_handle_new_iu+0x61e/0x7f0 [ib_srpt]
    __ib_process_cq+0x55/0xa0 [ib_core]
    ib_cq_poll_work+0x1b/0x60 [ib_core]
    process_one_work+0x141/0x340
    worker_thread+0x47/0x3e0
    kthread+0xf5/0x130
    ret_from_fork+0x1f/0x30

    Fixes: e80a0af4759a ("lib/scatterlist: Introduce sgl_alloc() and sgl_free()")
    Reported-by: Laurence Oberman
    Tested-by: Laurence Oberman
    Signed-off-by: Bart Van Assche
    Cc: Nicholas A. Bellinger
    Cc: Laurence Oberman
    Signed-off-by: Jens Axboe

    Bart Van Assche
     

07 Jan, 2018

1 commit

  • Many kernel drivers contain code that allocates and frees both a
    scatterlist and the pages that populate that scatterlist.
    Introduce functions in lib/scatterlist.c that perform these tasks
    instead of duplicating this functionality in multiple drivers.
    Only include these functions in the build if CONFIG_SGL_ALLOC=y
    to avoid that the kernel size increases if this functionality is
    not used.

    Signed-off-by: Bart Van Assche
    Reviewed-by: Hannes Reinecke
    Reviewed-by: Johannes Thumshirn
    Signed-off-by: Jens Axboe

    Bart Van Assche
     

16 Nov, 2017

1 commit

  • Pull drm updates from Dave Airlie:
    "This is the main drm pull request for v4.15.

    Core:
    - Atomic object lifetime fixes
    - Atomic iterator improvements
    - Sparse/smatch fixes
    - Legacy kms ioctls to be interruptible
    - EDID override improvements
    - fb/gem helper cleanups
    - Simple outreachy patches
    - Documentation improvements
    - Fix dma-buf rcu races
    - DRM mode object leasing for improving VR use cases.
    - vgaarb improvements for non-x86 platforms.

    New driver:
    - tve200: Faraday Technology TVE200 block.

    This "TV Encoder" encodes a ITU-T BT.656 stream and can be found in
    the StorLink SL3516 (later Cortina Systems CS3516) as well as the
    Grain Media GM8180.

    New bridges:
    - SiI9234 support

    New panels:
    - S6E63J0X03, OTM8009A, Seiko 43WVF1G, 7" rpi touch panel, Toshiba
    LT089AC19000, Innolux AT043TN24

    i915:
    - Remove Coffeelake from alpha support
    - Cannonlake workarounds
    - Infoframe refactoring for DisplayPort
    - VBT updates
    - DisplayPort vswing/emph/buffer translation refactoring
    - CCS fixes
    - Restore GPU clock boost on missed vblanks
    - Scatter list updates for userptr allocations
    - Gen9+ transition watermarks
    - Display IPC (Isochronous Priority Control)
    - Private PAT management
    - GVT: improved error handling and pci config sanitizing
    - Execlist refactoring
    - Transparent Huge Page support
    - User defined priorities support
    - HuC/GuC firmware refactoring
    - DP MST fixes
    - eDP power sequencing fixes
    - Use RCU instead of stop_machine
    - PSR state tracking support
    - Eviction fixes
    - BDW DP aux channel timeout fixes
    - LSPCON fixes
    - Cannonlake PLL fixes

    amdgpu:
    - Per VM BO support
    - Powerplay cleanups
    - CI powerplay support
    - PASID mgr for kfd
    - SR-IOV fixes
    - initial GPU reset for vega10
    - Prime mmap support
    - TTM updates
    - Clock query interface for Raven
    - Fence to handle ioctl
    - UVD encode ring support on Polaris
    - Transparent huge page DMA support
    - Compute LRU pipe tweaks
    - BO flag to allow buffers to opt out of implicit sync
    - CTX priority setting API
    - VRAM lost infrastructure plumbing

    qxl:
    - fix flicker since atomic rework

    amdkfd:
    - Further improvements from internal AMD tree
    - Usermode events
    - Drop radeon support

    nouveau:
    - Pascal temperature sensor support
    - Improved BAR2 handling
    - MMU rework to support Pascal MMU

    exynos:
    - Improved HDMI/mixer support
    - HDMI audio interface support

    tegra:
    - Prep work for tegra186
    - Cleanup/fixes

    msm:
    - Preemption support for a5xx
    - Display fixes for 8x96 (snapdragon 820)
    - Async cursor plane fixes
    - FW loading rework
    - GPU debugging improvements

    vc4:
    - Prep for DSI panels
    - fix T-format tiling scanout
    - New madvise ioctl

    Rockchip:
    - LVDS support

    omapdrm:
    - omap4 HDMI CEC support

    etnaviv:
    - GPU performance counters groundwork

    sun4i:
    - refactor driver load + TCON backend
    - HDMI improvements
    - A31 support
    - Misc fixes

    udl:
    - Probe/EDID read fixes.

    tilcdc:
    - Misc fixes.

    pl111:
    - Support more variants

    adv7511:
    - Improve EDID handling.
    - HDMI CEC support

    sii8620:
    - Add remote control support"

    * tag 'drm-for-v4.15' of git://people.freedesktop.org/~airlied/linux: (1480 commits)
    drm/rockchip: analogix_dp: Use mutex rather than spinlock
    drm/mode_object: fix documentation for object lookups.
    drm/i915: Reorder context-close to avoid calling i915_vma_close() under RCU
    drm/i915: Move init_clock_gating() back to where it was
    drm/i915: Prune the reservation shared fence array
    drm/i915: Idle the GPU before shinking everything
    drm/i915: Lock llist_del_first() vs llist_del_all()
    drm/i915: Calculate ironlake intermediate watermarks correctly, v2.
    drm/i915: Disable lazy PPGTT page table optimization for vGPU
    drm/i915/execlists: Remove the priority "optimisation"
    drm/i915: Filter out spurious execlists context-switch interrupts
    drm/amdgpu: use irq-safe lock for kiq->ring_lock
    drm/amdgpu: bypass lru touch for KIQ ring submission
    drm/amdgpu: Potential uninitialized variable in amdgpu_vm_update_directories()
    drm/amdgpu: potential uninitialized variable in amdgpu_vce_ring_parse_cs()
    drm/amd/powerplay: initialize a variable before using it
    drm/amd/powerplay: suppress KASAN out of bounds warning in vega10_populate_all_memory_levels
    drm/amd/amdgpu: fix evicted VRAM bo adjudgement condition
    drm/vblank: Tune drm_crtc_accurate_vblank_count() WARN down to a debug
    drm/rockchip: add CONFIG_OF dependency for lvds
    ...

    Linus Torvalds
     

02 Nov, 2017

1 commit

  • Many source files in the tree are missing licensing information, which
    makes it harder for compliance tools to determine the correct license.

    By default all files without license information are under the default
    license of the kernel, which is GPL version 2.

    Update the files which contain no license information with the 'GPL-2.0'
    SPDX license identifier. The SPDX identifier is a legally binding
    shorthand, which can be used instead of the full boiler plate text.

    This patch is based on work done by Thomas Gleixner and Kate Stewart and
    Philippe Ombredanne.

    How this work was done:

    Patches were generated and checked against linux-4.14-rc6 for a subset of
    the use cases:
    - file had no licensing information it it.
    - file was a */uapi/* one with no licensing information in it,
    - file was a */uapi/* one with existing licensing information,

    Further patches will be generated in subsequent months to fix up cases
    where non-standard license headers were used, and references to license
    had to be inferred by heuristics based on keywords.

    The analysis to determine which SPDX License Identifier to be applied to
    a file was done in a spreadsheet of side by side results from of the
    output of two independent scanners (ScanCode & Windriver) producing SPDX
    tag:value files created by Philippe Ombredanne. Philippe prepared the
    base worksheet, and did an initial spot review of a few 1000 files.

    The 4.13 kernel was the starting point of the analysis with 60,537 files
    assessed. Kate Stewart did a file by file comparison of the scanner
    results in the spreadsheet to determine which SPDX license identifier(s)
    to be applied to the file. She confirmed any determination that was not
    immediately clear with lawyers working with the Linux Foundation.

    Criteria used to select files for SPDX license identifier tagging was:
    - Files considered eligible had to be source code files.
    - Make and config files were included as candidates if they contained >5
    lines of source
    - File already had some variant of a license header in it (even if
    Reviewed-by: Philippe Ombredanne
    Reviewed-by: Thomas Gleixner
    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     

07 Sep, 2017

3 commits

  • Drivers like i915 benefit from being able to control the maxium
    size of the sg coalesced segment while building the scatter-
    gather list.

    Introduce and export the __sg_alloc_table_from_pages function
    which will allow it that control.

    v2: Reorder parameters. (Chris Wilson)
    v3: Fix incomplete reordering in v2.
    v4: max_segment needs to be page aligned.
    v5: Rebase.
    v6: Rebase.
    v7: Fix spelling in commit and mention max segment size in
    __sg_alloc_table_from_pages kerneldoc. (Andrew Morton)

    Signed-off-by: Tvrtko Ursulin
    Cc: Masahiro Yamada
    Cc: linux-kernel@vger.kernel.org
    Cc: Chris Wilson
    Reviewed-by: Chris Wilson
    Cc: Joonas Lahtinen
    Cc: Andrew Morton
    Link: https://patchwork.freedesktop.org/patch/msgid/20170803091351.23594-1-tvrtko.ursulin@linux.intel.com

    Tvrtko Ursulin
     
  • Since the scatterlist length field is an unsigned int, make
    sure that sg_alloc_table_from_pages does not overflow it while
    coalescing pages to a single entry.

    v2: Drop reference to future use. Use UINT_MAX.
    v3: max_segment must be page aligned.
    v4: Do not rely on compiler to optimise out the rounddown.
    (Joonas Lahtinen)
    v5: Simplified loops and use post-increments rather than
    pre-increments. Use PAGE_MASK and fix comment typo.
    (Andy Shevchenko)
    v6: Commit spelling fix.

    Signed-off-by: Tvrtko Ursulin
    Cc: Masahiro Yamada
    Cc: linux-kernel@vger.kernel.org
    Reviewed-by: Chris Wilson
    Cc: Joonas Lahtinen
    Cc: Andy Shevchenko
    Link: https://patchwork.freedesktop.org/patch/msgid/20170803091312.22875-1-tvrtko.ursulin@linux.intel.com

    Tvrtko Ursulin
     
  • Scatterlist entries have an unsigned int for the offset so
    correct the sg_alloc_table_from_pages function accordingly.

    Since these are offsets withing a page, unsigned int is
    wide enough.

    Also converts callers which were using unsigned long locally
    with the lower_32_bits annotation to make it explicitly
    clear what is happening.

    v2: Use offset_in_page. (Chris Wilson)

    Signed-off-by: Tvrtko Ursulin
    Cc: Masahiro Yamada
    Cc: Pawel Osciak
    Cc: Marek Szyprowski
    Cc: Kyungmin Park
    Cc: Tomasz Stanislawski
    Cc: Matt Porter
    Cc: Alexandre Bounine
    Cc: linux-media@vger.kernel.org
    Cc: linux-kernel@vger.kernel.org
    Acked-by: Marek Szyprowski (v1)
    Reviewed-by: Chris Wilson
    Reviewed-by: Mauro Carvalho Chehab
    Link: https://patchwork.freedesktop.org/patch/msgid/20170731185512.20010-1-tvrtko.ursulin@linux.intel.com

    Tvrtko Ursulin
     

15 Jun, 2017

1 commit


16 Apr, 2016

1 commit


25 Aug, 2015

1 commit

  • Sometimes a scatter-gather has to be split into several chunks, or sub
    scatter lists. This happens for example if a scatter list will be
    handled by multiple DMA channels, each one filling a part of it.

    A concrete example comes with the media V4L2 API, where the scatter list
    is allocated from userspace to hold an image, regardless of the
    knowledge of how many DMAs will fill it :
    - in a simple RGB565 case, one DMA will pump data from the camera ISP
    to memory
    - in the trickier YUV422 case, 3 DMAs will pump data from the camera
    ISP pipes, one for pipe Y, one for pipe U and one for pipe V

    For these cases, it is necessary to split the original scatter list into
    multiple scatter lists, which is the purpose of this patch.

    The guarantees that are required for this patch are :
    - the intersection of spans of any couple of resulting scatter lists is
    empty.
    - the union of spans of all resulting scatter lists is a subrange of
    the span of the original scatter list.
    - streaming DMA API operations (mapping, unmapping) should not happen
    both on both the resulting and the original scatter list. It's either
    the first or the later ones.
    - the caller is reponsible to call kfree() on the resulting
    scatterlists.

    Signed-off-by: Robert Jarzmik
    Signed-off-by: Jens Axboe

    Robert Jarzmik
     

17 Aug, 2015

1 commit

  • There are a couple of uses of struct scatterlist that never go to
    the dma_map_sg() helper and thus don't care about ARCH_HAS_SG_CHAIN
    which indicates that we can map chained S/G list.

    The most important one is the crypto code, which currently has
    to open code a few helpers to always allow chaining. This patch
    removes a few #ifdef ARCH_HAS_SG_CHAIN statements so that we can
    switch the crypto code to these common helpers.

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Jens Axboe

    Christoph Hellwig
     

01 Jul, 2015

2 commits

  • do_device_access() takes a separate parameter to indicate the direction of
    data transfer, which it used to use to select the appropriate function out
    of sg_pcopy_{to,from}_buffer(). However these two functions now have

    So this patch makes it bypass these wrappers and call the underlying
    function sg_copy_buffer() directly; this has the same calling style as
    do_device_access() i.e. a separate direction-of-transfer parameter and no
    pointers-to-const, so skipping the wrappers not only eliminates the
    warning, it also make the code simpler :)

    [akpm@linux-foundation.org: fix very broken build]
    Signed-off-by: Dave Gordon
    Acked-by: Arnd Bergmann
    Cc: James Bottomley
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Dave Gordon
     
  • The 'buf' parameter of sg(p)copy_from_buffer() can and should be
    const-qualified, although because of the shared implementation of
    _to_buffer() and _from_buffer(), we have to cast this away internally.

    This means that callers who have a 'const' buffer containing the data to
    be copied to the sg-list no longer have to cast away the const-ness
    themselves. It also enables improved coverage by code analysis tools.

    Signed-off-by: Dave Gordon
    Cc: Akinobu Mita
    Cc: "Martin K. Petersen"
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Dave Gordon
     

26 Jun, 2015

1 commit


03 Jun, 2015

1 commit

  • When performing a dma_map_sg() call, the number of sg entries to map is
    required. Using sg_nents to retrieve the number of sg entries will
    return the total number of entries in the sg list up to the entry marked
    as the end. If there happen to be unused entries in the list, these will
    still be counted. Some dma_map_sg() implementations will not handle the
    unused entries correctly (lib/swiotlb.c) and execute a BUG_ON.

    The sg_nents_for_len() function will traverse the sg list and return the
    number of entries required to satisfy the supplied length argument. This
    can then be supplied to the dma_map_sg() call to successfully map the
    sg.

    Signed-off-by: Tom Lendacky
    Signed-off-by: Herbert Xu

    Tom Lendacky
     

06 May, 2015

1 commit


09 Aug, 2014

1 commit

  • Rather than have architectures #define ARCH_HAS_SG_CHAIN in an
    architecture specific scatterlist.h, make it a proper Kconfig option and
    use that instead. At same time, remove the header files are are now
    mostly useless and just include asm-generic/scatterlist.h.

    [sfr@canb.auug.org.au: powerpc files now need asm/dma.h]
    Signed-off-by: Laura Abbott
    Acked-by: Thomas Gleixner [x86]
    Acked-by: Benjamin Herrenschmidt [powerpc]
    Acked-by: Heiko Carstens
    Cc: Russell King
    Cc: Tony Luck
    Cc: Fenghua Yu
    Cc: Paul Mackerras
    Cc: Ingo Molnar
    Cc: "H. Peter Anvin"
    Cc: "James E.J. Bottomley"
    Cc: Martin Schwidefsky
    Signed-off-by: Stephen Rothwell
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Laura Abbott
     

26 Jul, 2014

1 commit

  • Blk-mq drivers usually preallocate their S/G list as part of the request,
    but if we want to support the very large S/G lists currently supported by
    the SCSI code that would tie up a lot of memory in the preallocated request
    pool. Add support to the scatterlist code so that it can initialize a
    S/G list that uses a preallocated first chunks and dynamically allocated
    additional chunks. That way the scsi-mq code can preallocate a first
    page worth of S/G entries as part of the request, and dynamically extend
    the S/G list when needed.

    Signed-off-by: Christoph Hellwig
    Reviewed-by: Martin K. Petersen
    Reviewed-by: Hannes Reinecke
    Reviewed-by: Webb Scales
    Acked-by: Jens Axboe
    Tested-by: Bart Van Assche
    Tested-by: Robert Elliott

    Christoph Hellwig
     

09 Dec, 2013

1 commit

  • sg_copy_buffer() can't meet demand for some drrivers(such usb
    mass storage), so we have to use the sg_miter_* APIs to access
    sg buffer, then need export sg_miter_skip() for these drivers.

    The API is needed for converting to sg_miter_* APIs in USB storage
    driver for accessing sg buffer.

    Acked-by: Andrew Morton
    Cc: FUJITA Tomonori
    Cc: Jens Axboe
    Signed-off-by: Ming Lei
    Reviewed-by: Tejun Heo
    Signed-off-by: Greg Kroah-Hartman

    Ming Lei
     

10 Jul, 2013

1 commit

  • The only difference between sg_pcopy_{from,to}_buffer() and
    sg_copy_{from,to}_buffer() is an additional argument that specifies the
    number of bytes to skip the SG list before copying.

    Signed-off-by: Akinobu Mita
    Cc: "David S. Miller"
    Cc: "James E.J. Bottomley"
    Cc: Douglas Gilbert
    Cc: Herbert Xu
    Cc: Horia Geanta
    Cc: Imre Deak
    Acked-by: Tejun Heo
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Akinobu Mita
     

30 May, 2013

1 commit


03 May, 2013

1 commit

  • Pull drm updates from Dave Airlie:
    "This is the main drm pull request for 3.10.

    Wierd bits:
    - OMAP drm changes required OMAP dss changes, in drivers/video, so I
    took them in here.
    - one more fbcon fix for font handover
    - VT switch avoidance in pm code
    - scatterlist helpers for gpu drivers - have acks from akpm

    Highlights:
    - qxl kms driver - driver for the spice qxl virtual GPU

    Nouveau:
    - fermi/kepler VRAM compression
    - GK110/nvf0 modesetting support.

    Tegra:
    - host1x core merged with 2D engine support

    i915:
    - vt switchless resume
    - more valleyview support
    - vblank fixes
    - modesetting pipe config rework

    radeon:
    - UVD engine support
    - SI chip tiling support
    - GPU registers initialisation from golden values.

    exynos:
    - device tree changes
    - fimc block support

    Otherwise:
    - bunches of fixes all over the place."

    * 'drm-next' of git://people.freedesktop.org/~airlied/linux: (513 commits)
    qxl: update to new idr interfaces.
    drm/nouveau: fix build with nv50->nvc0
    drm/radeon: fix handling of v6 power tables
    drm/radeon: clarify family checks in pm table parsing
    drm/radeon: consolidate UVD clock programming
    drm/radeon: fix UPLL_REF_DIV_MASK definition
    radeon: add bo tracking debugfs
    drm/radeon: add new richland pci ids
    drm/radeon: add some new SI PCI ids
    drm/radeon: fix scratch reg handling for UVD fence
    drm/radeon: allocate SA bo in the requested domain
    drm/radeon: fix possible segfault when parsing pm tables
    drm/radeon: fix endian bugs in atom_allocate_fb_scratch()
    OMAPDSS: TFP410: return EPROBE_DEFER if the i2c adapter not found
    OMAPDSS: VENC: Add error handling for venc_probe_pdata
    OMAPDSS: HDMI: Add error handling for hdmi_probe_pdata
    OMAPDSS: RFBI: Add error handling for rfbi_probe_pdata
    OMAPDSS: DSI: Add error handling for dsi_probe_pdata
    OMAPDSS: SDI: Add error handling for sdi_probe_pdata
    OMAPDSS: DPI: Add error handling for dpi_probe_pdata
    ...

    Linus Torvalds
     

28 Mar, 2013

1 commit

  • The i915 driver uses sg lists for memory without backing 'struct page'
    pages, similarly to other IO memory regions, setting only the DMA
    address for these. It does this, so that it can program the HW MMU
    tables in a uniform way both for sg lists with and without backing pages.

    Without a valid page pointer we can't call nth_page to get the current
    page in __sg_page_iter_next, so add a helper that relevant users can
    call separately. Also add a helper to get the DMA address of the current
    page (idea from Daniel).

    Convert all places in i915, to use the new API.

    Signed-off-by: Imre Deak
    Reviewed-by: Damien Lespiau
    Signed-off-by: Daniel Vetter

    Imre Deak
     

20 Mar, 2013

1 commit


28 Feb, 2013

2 commits

  • For better code reuse use the newly added page iterator to iterate
    through the pages. The offset, length within the page is still
    calculated by the mapping iterator as well as the actual mapping. Idea
    from Tejun Heo.

    Signed-off-by: Imre Deak
    Cc: Maxim Levitsky
    Cc: Tejun Heo
    Cc: Daniel Vetter
    Cc: James Hogan
    Cc: Stephen Warren
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Imre Deak
     
  • Add an iterator to walk through a scatter list a page at a time starting
    at a specific page offset. As opposed to the mapping iterator this is
    meant to be small, performing well even in simple loops like collecting
    all pages on the scatterlist into an array or setting up an iommu table
    based on the pages' DMA address.

    Signed-off-by: Imre Deak
    Cc: Maxim Levitsky
    Cc: Tejun Heo
    Cc: Daniel Vetter
    Tested-by: Stephen Warren
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Imre Deak
     

27 Sep, 2012

1 commit


30 Jul, 2012

1 commit

  • This patch adds a new constructor for an sg table. The table is constructed
    from an array of struct pages. All contiguous chunks of the pages are merged
    into a single sg nodes. A user may provide an offset and a size of a buffer if
    the buffer is not page-aligned.

    The function is dedicated for DMABUF exporters which often perform conversion
    from an page array to a scatterlist. Moreover the scatterlist should be
    squashed in order to save memory and to speed-up the process of DMA mapping
    using dma_map_sg.

    The code is based on the patch 'v4l: vb2-dma-contig: add support for
    scatterlist in userptr mode' and hints from Laurent Pinchart.

    Signed-off-by: Tomasz Stanislawski
    Signed-off-by: Kyungmin Park
    Acked-by: Daniel Vetter
    Acked-by: Laurent Pinchart
    Signed-off-by: Marek Szyprowski
    CC: Andrew Morton

    Tomasz Stanislawski
     

05 Mar, 2012

1 commit

  • If a header file is making use of BUG, BUG_ON, BUILD_BUG_ON, or any
    other BUG variant in a static inline (i.e. not in a #define) then
    that header really should be including and not just
    expecting it to be implicitly present.

    We can make this change risk-free, since if the files using these
    headers didn't have exposure to linux/bug.h already, they would have
    been causing compile failures/warnings.

    Signed-off-by: Paul Gortmaker

    Paul Gortmaker