06 Oct, 2020

1 commit

  • Split out all the bits that are purely for dma_map_ops implementations
    and related code into a new header so that they
    don't get pulled into all the drivers. That also means the architecture
    specific is not pulled in by
    any more, which leads to a missing includes that were pulled in by the
    x86 or arm versions in a few not overly portable drivers.

    Signed-off-by: Christoph Hellwig

    Christoph Hellwig
     

25 Sep, 2020

1 commit

  • This API is the equivalent of alloc_pages, except that the returned memory
    is guaranteed to be DMA addressable by the passed in device. The
    implementation will also be used to provide a more sensible replacement
    for DMA_ATTR_NON_CONSISTENT flag.

    Additionally dma_alloc_noncoherent is switched over to use dma_alloc_pages
    as its backend.

    Signed-off-by: Christoph Hellwig
    Acked-by: Thomas Bogendoerfer (MIPS part)

    Christoph Hellwig
     

04 Sep, 2020

1 commit

  • We found that callers of dma_get_seg_boundary mostly do an ALIGN
    with page mask and then do a page shift to get number of pages:
    ALIGN(boundary + 1, 1 << shift) >> shift

    However, the boundary might be as large as ULONG_MAX, which means
    that a device has no specific boundary limit. So either "+ 1" or
    passing it to ALIGN() would potentially overflow.

    According to kernel defines:
    #define ALIGN_MASK(x, mask) (((x) + (mask)) & ~(mask))
    #define ALIGN(x, a) ALIGN_MASK(x, (typeof(x))(a) - 1)

    We can simplify the logic here into a helper function doing:
    ALIGN(boundary + 1, 1 << shift) >> shift
    = ALIGN_MASK(b + 1, (1 << s) - 1) >> s
    = {[b + 1 + (1 << s) - 1] & ~[(1 << s) - 1]} >> s
    = [b + 1 + (1 << s) - 1] >> s
    = [b + (1 << s)] >> s
    = (b >> s) + 1

    This patch introduces and applies dma_get_seg_boundary_nr_pages()
    as an overflow-free helper for the dma_get_seg_boundary() callers
    to get numbers of pages. It also takes care of the NULL dev case
    for non-DMA API callers.

    Suggested-by: Christoph Hellwig
    Signed-off-by: Nicolin Chen
    Acked-by: Niklas Schnelle
    Acked-by: Michael Ellerman (powerpc)
    Signed-off-by: Christoph Hellwig

    Nicolin Chen
     

13 Aug, 2020

1 commit

  • Pull more parisc updates from Helge Deller:

    - Oscar Carter contributed a patch which fixes parisc's usage of
    dereference_function_descriptor() and thus will allow using the
    -Wcast-function-type compiler option in the top-level Makefile

    - Sven Schnelle fixed a bug in the SBA code to prevent crashes during
    kexec

    - John David Anglin provided implementations for __smp_store_release()
    and __smp_load_acquire barriers() which avoids using the sync
    assembler instruction and thus speeds up barrier paths

    - Some whitespace cleanups in parisc's atomic.h header file

    * 'parisc-5.9-2' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux:
    parisc: Implement __smp_store_release and __smp_load_acquire barriers
    parisc: mask out enable and reserved bits from sba imask
    parisc: Whitespace cleanups in atomic.h
    parisc/kernel/ftrace: Remove function callback casts
    sections.h: dereference_function_descriptor() returns void pointer

    Linus Torvalds
     

12 Aug, 2020

1 commit


27 Jun, 2020

1 commit


06 Apr, 2020

1 commit

  • request_irq() is preferred over setup_irq(). Invocations of setup_irq()
    occur after memory allocators are ready.

    Per tglx[1], setup_irq() existed in olden days when allocators were not
    ready by the time early interrupts were initialized.

    Hence replace setup_irq() by request_irq().

    [1] https://lkml.kernel.org/r/alpine.DEB.2.20.1710191609480.1971@nanos

    Signed-off-by: afzal mohammed
    Signed-off-by: Helge Deller

    afzal mohammed
     

04 Feb, 2020

1 commit

  • The most notable change is DEFINE_SHOW_ATTRIBUTE macro split in
    seq_file.h.

    Conversion rule is:

    llseek => proc_lseek
    unlocked_ioctl => proc_ioctl

    xxx => proc_xxx

    delete ".owner = THIS_MODULE" line

    [akpm@linux-foundation.org: fix drivers/isdn/capi/kcapi_proc.c]
    [sfr@canb.auug.org.au: fix kernel/sched/psi.c]
    Link: http://lkml.kernel.org/r/20200122180545.36222f50@canb.auug.org.au
    Link: http://lkml.kernel.org/r/20191225172546.GB13378@avx2
    Signed-off-by: Alexey Dobriyan
    Signed-off-by: Stephen Rothwell
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Alexey Dobriyan
     

06 Jan, 2020

1 commit


15 Oct, 2019

1 commit

  • This breaks booting from sata_sil24 with the recent DMA change.
    According to James Bottomley this was in to improve performance by
    kicking the device into 32 bit descriptors, which are usually more
    efficient, especially with older dual descriptor format cards like we
    have on parisc systems.
    Remove it for now to make DMA working again.

    Fixes: dcc02c19cc06 ("sata_sil24: use dma_set_mask_and_coherent")
    Signed-off-by: Sven Schnelle
    Signed-off-by: Helge Deller

    Sven Schnelle
     

20 Sep, 2019

1 commit

  • Pull dma-mapping updates from Christoph Hellwig:

    - add dma-mapping and block layer helpers to take care of IOMMU merging
    for mmc plus subsequent fixups (Yoshihiro Shimoda)

    - rework handling of the pgprot bits for remapping (me)

    - take care of the dma direct infrastructure for swiotlb-xen (me)

    - improve the dma noncoherent remapping infrastructure (me)

    - better defaults for ->mmap, ->get_sgtable and ->get_required_mask
    (me)

    - cleanup mmaping of coherent DMA allocations (me)

    - various misc cleanups (Andy Shevchenko, me)

    * tag 'dma-mapping-5.4' of git://git.infradead.org/users/hch/dma-mapping: (41 commits)
    mmc: renesas_sdhi_internal_dmac: Add MMC_CAP2_MERGE_CAPABLE
    mmc: queue: Fix bigger segments usage
    arm64: use asm-generic/dma-mapping.h
    swiotlb-xen: merge xen_unmap_single into xen_swiotlb_unmap_page
    swiotlb-xen: simplify cache maintainance
    swiotlb-xen: use the same foreign page check everywhere
    swiotlb-xen: remove xen_swiotlb_dma_mmap and xen_swiotlb_dma_get_sgtable
    xen: remove the exports for xen_{create,destroy}_contiguous_region
    xen/arm: remove xen_dma_ops
    xen/arm: simplify dma_cache_maint
    xen/arm: use dev_is_dma_coherent
    xen/arm: consolidate page-coherent.h
    xen/arm: use dma-noncoherent.h calls for xen-swiotlb cache maintainance
    arm: remove wrappers for the generic dma remap helpers
    dma-mapping: introduce a dma_common_find_pages helper
    dma-mapping: always use VM_DMA_COHERENT for generic DMA remap
    vmalloc: lift the arm flag for coherent mappings to common code
    dma-mapping: provide a better default ->get_required_mask
    dma-mapping: remove the dma_declare_coherent_memory export
    remoteproc: don't allow modular build
    ...

    Linus Torvalds
     

08 Sep, 2019

1 commit

  • The HP Dino PCI controller chip can be used in two variants: as on-board
    controller (e.g. in B160L), or on an Add-On card ("Card-Mode") to bridge
    PCI components to systems without a PCI bus, e.g. to a HSC/GSC bus. One
    such Add-On card is the HP HSC-PCI Card which has one or more DEC Tulip
    PCI NIC chips connected to the on-card Dino PCI controller.

    Dino in Card-Mode has a big disadvantage: All PCI memory accesses need
    to go through the DINO_MEM_DATA register, so Linux drivers will not be
    able to use the ioremap() function. Without ioremap() many drivers will
    not work, one example is the tulip driver which then simply crashes the
    kernel if it tries to access the ports on the HP HSC card.

    This patch disables the HP HSC card if it finds one, and as such
    fixes the kernel crash on a HP D350/2 machine.

    Signed-off-by: Helge Deller
    Noticed-by: Phil Scarr
    Cc: stable@vger.kernel.org

    Helge Deller
     

06 Sep, 2019

1 commit


05 Sep, 2019

2 commits


04 Sep, 2019

2 commits

  • parisc is the only architecture that sets ARCH_NO_COHERENT_DMA_MMAP
    when an MMU is enabled. AFAIK this is because parisc CPUs use VIVT
    caches, which means exporting normally cachable memory to userspace is
    relatively dangrous due to cache aliasing.

    But normally cachable memory is only allocated by dma_alloc_coherent
    on parisc when using the sba_iommu or ccio_iommu drivers, so just
    remove the .mmap implementation for them so that we don't have to set
    ARCH_NO_COHERENT_DMA_MMAP, which I plan to get rid of.

    Signed-off-by: Christoph Hellwig

    Christoph Hellwig
     
  • While the default ->mmap and ->get_sgtable implementations work for the
    majority of our dma_map_ops impementations they are inherently safe
    for others that don't use the page allocator or CMA and/or use their
    own way of remapping not covered by the common code. So remove the
    defaults if these methods are not wired up, but instead wire up the
    default implementations for all safe instances.

    Fixes: e1c7e324539a ("dma-mapping: always provide the dma_map_ops based implementation")
    Signed-off-by: Christoph Hellwig

    Christoph Hellwig
     

09 Jun, 2019

1 commit

  • Pull yet more SPDX updates from Greg KH:
    "Another round of SPDX header file fixes for 5.2-rc4

    These are all more "GPL-2.0-or-later" or "GPL-2.0-only" tags being
    added, based on the text in the files. We are slowly chipping away at
    the 700+ different ways people tried to write the license text. All of
    these were reviewed on the spdx mailing list by a number of different
    people.

    We now have over 60% of the kernel files covered with SPDX tags:
    $ ./scripts/spdxcheck.py -v 2>&1 | grep Files
    Files checked: 64533
    Files with SPDX: 40392
    Files with errors: 0

    I think the majority of the "easy" fixups are now done, it's now the
    start of the longer-tail of crazy variants to wade through"

    * tag 'spdx-5.2-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: (159 commits)
    treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 450
    treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 449
    treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 448
    treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 446
    treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 445
    treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 444
    treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 443
    treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 442
    treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 441
    treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 440
    treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 438
    treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 437
    treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 436
    treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 435
    treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 434
    treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 433
    treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 432
    treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 431
    treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 430
    treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 429
    ...

    Linus Torvalds
     

07 Jun, 2019

1 commit

  • Pull parisc fixes from Helge Deller:

    - Fix crashes when accessing PCI devices on some machines like C240 and
    J5000. The crashes were triggered because we replaced cache flushes
    by nops in the alternative coding where we shouldn't for some
    machines.

    - Dave fixed a race in the usage of the sr1 space register when used to
    load the coherence index.

    - Use the hardware lpa instruction to to load the physical address of
    kernel virtual addresses in the iommu driver code.

    - The kernel may fail to link when CONFIG_MLONGCALLS isn't set. Solve
    that by rearranging functions in the final vmlinux executeable.

    - Some defconfig cleanups and removal of compiler warnings.

    * 'parisc-5.2-3' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux:
    parisc: Fix crash due alternative coding for NP iopdir_fdc bit
    parisc: Use lpa instruction to load physical addresses in driver code
    parisc: configs: Remove useless UEVENT_HELPER_PATH
    parisc: Use implicit space register selection for loading the coherence index of I/O pdirs
    parisc: Fix compiler warnings in float emulation code
    parisc/slab: cleanup after /proc/slab_allocators removal
    parisc: Allow building 64-bit kernel without -mlong-calls compiler option
    parisc: Kconfig: remove ARCH_DISCARD_MEMBLOCK

    Linus Torvalds
     

06 Jun, 2019

2 commits

  • Most I/O in the kernel is done using the kernel offset mapping.
    However, there is one API that uses aliased kernel address ranges:

    > The final category of APIs is for I/O to deliberately aliased address
    > ranges inside the kernel. Such aliases are set up by use of the
    > vmap/vmalloc API. Since kernel I/O goes via physical pages, the I/O
    > subsystem assumes that the user mapping and kernel offset mapping are
    > the only aliases. This isn't true for vmap aliases, so anything in
    > the kernel trying to do I/O to vmap areas must manually manage
    > coherency. It must do this by flushing the vmap range before doing
    > I/O and invalidating it after the I/O returns.

    For this reason, we should use the hardware lpa instruction to load the
    physical address of kernel virtual addresses in the driver code.

    I believe we only use the vmap/vmalloc API with old PA 1.x processors
    which don't have a sba, so we don't hit this problem.

    Tested on c3750, c8000 and rp3440.

    Signed-off-by: John David Anglin
    Signed-off-by: Helge Deller

    John David Anglin
     
  • We only support I/O to kernel space. Using %sr1 to load the coherence
    index may be racy unless interrupts are disabled. This patch changes the
    code used to load the coherence index to use implicit space register
    selection. This saves one instruction and eliminates the race.

    Tested on rp3440, c8000 and c3750.

    Signed-off-by: John David Anglin
    Cc: stable@vger.kernel.org
    Signed-off-by: Helge Deller

    John David Anglin
     

05 Jun, 2019

1 commit

  • Based on 1 normalized pattern(s):

    this program is free software you can redistribute it and or modify
    it under the terms of the gnu general public license version 2 as
    published by the free software foundation this program is
    distributed in the hope that it will be useful but without any
    warranty without even the implied warranty of merchantability or
    fitness for a particular purpose see the gnu general public license
    for more details you should have received a copy of the gnu general
    public license along with this program if not write to the free
    software foundation inc 59 temple place suite 330 boston ma 02111
    1307 usa

    extracted by the scancode license scanner the SPDX license identifier

    GPL-2.0-only

    has been chosen to replace the boilerplate/reference in 136 file(s).

    Signed-off-by: Thomas Gleixner
    Reviewed-by: Alexios Zavras
    Reviewed-by: Allison Randal
    Cc: linux-spdx@vger.kernel.org
    Link: https://lkml.kernel.org/r/20190530000436.384967451@linutronix.de
    Signed-off-by: Greg Kroah-Hartman

    Thomas Gleixner
     

31 May, 2019

3 commits

  • Based on 1 normalized pattern(s):

    distributed under the terms of the gpl version 2

    extracted by the scancode license scanner the SPDX license identifier

    GPL-2.0-only

    has been chosen to replace the boilerplate/reference in 1 file(s).

    Signed-off-by: Thomas Gleixner
    Reviewed-by: Steve Winslow
    Reviewed-by: Alexios Zavras
    Reviewed-by: Allison Randal
    Cc: linux-spdx@vger.kernel.org
    Link: https://lkml.kernel.org/r/20190528171439.671734884@linutronix.de
    Signed-off-by: Greg Kroah-Hartman

    Thomas Gleixner
     
  • Based on 1 normalized pattern(s):

    this program is free software you can redistribute it and or modify
    it under the terms of the gnu general public license as published by
    the free software foundation either version 2 of the license or at
    your option any later version this program is distributed in the
    hope that it will be useful but without any warranty without even
    the implied warranty of merchantability or fitness for a particular
    purpose see the gnu general public license for more details you
    should have received a copy of the gnu general public license along
    with this program if not write to the free software foundation inc
    59 temple place suite 330 boston ma 02111 1307 usa

    extracted by the scancode license scanner the SPDX license identifier

    GPL-2.0-or-later

    has been chosen to replace the boilerplate/reference in 1334 file(s).

    Signed-off-by: Thomas Gleixner
    Reviewed-by: Allison Randal
    Reviewed-by: Richard Fontana
    Cc: linux-spdx@vger.kernel.org
    Link: https://lkml.kernel.org/r/20190527070033.113240726@linutronix.de
    Signed-off-by: Greg Kroah-Hartman

    Thomas Gleixner
     
  • Based on 1 normalized pattern(s):

    this program is free software you can redistribute it and or modify
    it under the terms of the gnu general public license as published by
    the free software foundation either version 2 of the license or at
    your option any later version

    extracted by the scancode license scanner the SPDX license identifier

    GPL-2.0-or-later

    has been chosen to replace the boilerplate/reference in 3029 file(s).

    Signed-off-by: Thomas Gleixner
    Reviewed-by: Allison Randal
    Cc: linux-spdx@vger.kernel.org
    Link: https://lkml.kernel.org/r/20190527070032.746973796@linutronix.de
    Signed-off-by: Greg Kroah-Hartman

    Thomas Gleixner
     

21 May, 2019

1 commit


04 May, 2019

1 commit


07 Apr, 2019

1 commit


11 Mar, 2019

1 commit

  • Pull DMA mapping updates from Christoph Hellwig:

    - add debugfs support for dumping dma-debug information (Corentin
    Labbe)

    - Kconfig cleanups (Andy Shevchenko and me)

    - debugfs cleanups (Greg Kroah-Hartman)

    - improve dma_map_resource and use it in the media code

    - arch_setup_dma_ops / arch_teardown_dma_ops cleanups

    - various small cleanups and improvements for the per-device coherent
    allocator

    - make the DMA mask an upper bound and don't fail "too large" dma mask
    in the remaning two architectures - this will allow big driver
    cleanups in the following merge windows

    * tag 'dma-mapping-5.1' of git://git.infradead.org/users/hch/dma-mapping: (21 commits)
    Documentation/DMA-API-HOWTO: update dma_mask sections
    sparc64/pci_sun4v: allow large DMA masks
    sparc64/iommu: allow large DMA masks
    sparc64: refactor the ali DMA quirk
    ccio: allow large DMA masks
    dma-mapping: remove the DMA_MEMORY_EXCLUSIVE flag
    dma-mapping: remove dma_mark_declared_memory_occupied
    dma-mapping: move CONFIG_DMA_CMA to kernel/dma/Kconfig
    dma-mapping: improve selection of dma_declare_coherent availability
    dma-mapping: remove an incorrect __iommem annotation
    of: select OF_RESERVED_MEM automatically
    device.h: dma_mem is only needed for HAVE_GENERIC_DMA_COHERENT
    mfd/sm501: depend on HAS_DMA
    dma-mapping: add a kconfig symbol for arch_teardown_dma_ops availability
    dma-mapping: add a kconfig symbol for arch_setup_dma_ops availability
    dma-mapping: move debug configuration options to kernel/dma
    dma-debug: add dumping facility via debugfs
    dma: debug: no need to check return value of debugfs_create functions
    videobuf2: replace a layering violation with dma_map_resource
    dma-mapping: don't BUG when calling dma_map_resource on RAM
    ...

    Linus Torvalds
     

22 Feb, 2019

8 commits


20 Feb, 2019

1 commit

  • There is no harm in setting a 64-bit mask even if we don't need it,
    and the current ccio code is one of the few place in the kernel
    still rejecting larger than required DMA masks.

    Signed-off-by: Christoph Hellwig

    Christoph Hellwig
     

30 Dec, 2018

1 commit

  • Pull Kconfig file consolidation from Masahiro Yamada:
    "Consolidation of bus (PCI, PCMCIA, EISA, RapidIO) config entries by
    Christoph Hellwig.

    Currently, every architecture that wants to provide common peripheral
    busses needs to add some boilerplate code and include the right
    Kconfig files. This series instead just selects the presence (when
    needed) and then handles everything in the bus-specific Kconfig file
    under drivers/"

    * tag 'kconfig-v4.21-2' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild:
    pcmcia: remove per-arch PCMCIA config entry
    eisa: consolidate EISA Kconfig entry in drivers/eisa
    rapidio: consolidate RAPIDIO config entry in drivers/rapidio
    pcmcia: allow PCMCIA support independent of the architecture
    PCI: consolidate the PCI_SYSCALL symbol
    PCI: consolidate the PCI_DOMAINS and PCI_DOMAINS_GENERIC config options
    PCI: consolidate PCI config entry in drivers/pci
    MIPS: remove the HT_PCI config option

    Linus Torvalds
     

29 Dec, 2018

1 commit

  • Merge misc updates from Andrew Morton:

    - large KASAN update to use arm's "software tag-based mode"

    - a few misc things

    - sh updates

    - ocfs2 updates

    - just about all of MM

    * emailed patches from Andrew Morton : (167 commits)
    kernel/fork.c: mark 'stack_vm_area' with __maybe_unused
    memcg, oom: notify on oom killer invocation from the charge path
    mm, swap: fix swapoff with KSM pages
    include/linux/gfp.h: fix typo
    mm/hmm: fix memremap.h, move dev_page_fault_t callback to hmm
    hugetlbfs: Use i_mmap_rwsem to fix page fault/truncate race
    hugetlbfs: use i_mmap_rwsem for more pmd sharing synchronization
    memory_hotplug: add missing newlines to debugging output
    mm: remove __hugepage_set_anon_rmap()
    include/linux/vmstat.h: remove unused page state adjustment macro
    mm/page_alloc.c: allow error injection
    mm: migrate: drop unused argument of migrate_page_move_mapping()
    blkdev: avoid migration stalls for blkdev pages
    mm: migrate: provide buffer_migrate_page_norefs()
    mm: migrate: move migrate_page_lock_buffers()
    mm: migrate: lock buffers before migrate_page_move_mapping()
    mm: migration: factor out code to compute expected number of page references
    mm, page_alloc: enable pcpu_drain with zone capability
    kmemleak: add config to select auto scan
    mm/page_alloc.c: don't call kasan_free_pages() at deferred mem init
    ...

    Linus Torvalds