19 Aug, 2020

1 commit

  • commit 5b24993c21cbf2de11aff077a48c5cb0505a0450 upstream.

    When using kexec the SBA IOMMU IBASE might still have the RE
    bit set. This triggers a WARN_ON when trying to write back the
    IBASE register later, and it also makes some mask calculations fail.

    Cc:
    Signed-off-by: Sven Schnelle
    Signed-off-by: Helge Deller
    Signed-off-by: Greg Kroah-Hartman

    Sven Schnelle
     

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

2 commits

  • 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
     
  • totalram_pages and totalhigh_pages are made static inline function.

    Main motivation was that managed_page_count_lock handling was complicating
    things. It was discussed in length here,
    https://lore.kernel.org/patchwork/patch/995739/#1181785 So it seemes
    better to remove the lock and convert variables to atomic, with preventing
    poteintial store-to-read tearing as a bonus.

    [akpm@linux-foundation.org: coding style fixes]
    Link: http://lkml.kernel.org/r/1542090790-21750-4-git-send-email-arunks@codeaurora.org
    Signed-off-by: Arun KS
    Suggested-by: Michal Hocko
    Suggested-by: Vlastimil Babka
    Reviewed-by: Konstantin Khlebnikov
    Reviewed-by: Pavel Tatashin
    Acked-by: Michal Hocko
    Acked-by: Vlastimil Babka
    Cc: David Hildenbrand
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Arun KS
     

06 Dec, 2018

2 commits


23 Nov, 2018

3 commits

  • Let architectures opt into EISA support by selecting HAVE_EISA and
    handle everything else in drivers/eisa.

    Signed-off-by: Christoph Hellwig
    Acked-by: Thomas Gleixner
    Acked-by: Paul Burton
    Signed-off-by: Masahiro Yamada

    Christoph Hellwig
     
  • There is nothing architecture specific in the PCMCIA core, so allow
    building it everywhere. The actual host controllers will depend on ISA,
    PCI or a specific SOC.

    Signed-off-by: Christoph Hellwig
    Acked-by: Dominik Brodowski
    Acked-by: Thomas Gleixner
    Acked-by: Paul Burton
    Signed-off-by: Masahiro Yamada

    Christoph Hellwig
     
  • There is no good reason to duplicate the PCI menu in every architecture.
    Instead provide a selectable HAVE_PCI symbol that indicates availability
    of PCI support, and a FORCE_PCI symbol to for PCI on and the handle the
    rest in drivers/pci.

    Signed-off-by: Christoph Hellwig
    Reviewed-by: Palmer Dabbelt
    Acked-by: Max Filippov
    Acked-by: Thomas Gleixner
    Acked-by: Bjorn Helgaas
    Acked-by: Geert Uytterhoeven
    Acked-by: Paul Burton
    Signed-off-by: Masahiro Yamada

    Christoph Hellwig
     

17 Oct, 2018

2 commits

  • This patch adds the necessary code to patch a running kernel at runtime
    to improve performance.

    The current implementation offers a few optimizations variants:

    - When running a SMP kernel on a single UP processor, unwanted assembler
    statements like locking functions are overwritten with NOPs. When
    multiple instructions shall be skipped, one branch instruction is used
    instead of multiple nop instructions.

    - In the UP case, some pdtlb and pitlb instructions are patched to
    become pdtlb,l and pitlb,l which only flushes the CPU-local tlb
    entries instead of broadcasting the flush to other CPUs in the system
    and thus may improve performance.

    - fic and fdc instructions are skipped if no I- or D-caches are
    installed. This should speed up qemu emulation and cacheless systems.

    - If no cache coherence is needed for IO operations, the relevant fdc
    and sync instructions in the sba and ccio drivers are replaced by
    nops.

    - On systems which share I- and D-TLBs and thus don't have a seperate
    instruction TLB, the pitlb instruction is replaced by a nop.

    Live-patching is done early in the boot process, just after having run
    the system inventory. No drivers are running and thus no external
    interrupts should arrive. So the hope is that no TLB exceptions will
    occur during the patching. If this turns out to be wrong we will
    probably need to do the patching in real-mode.

    Signed-off-by: Helge Deller

    Helge Deller
     
  • While playing with qemu with an emulated RT8139cp NIC, I faced lots of
    the following warnings:
    Dino 0x00810000: stuck interrupt 2

    This patch ratelimits this warning and reports back that the IRQ was
    handled.

    Signed-off-by: Helge Deller

    Helge Deller